@medplum/app 3.0.1 → 3.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,235 +0,0 @@
1
- function Bw(e,t){for(var n=0;n<t.length;n++){const r=t[n];if(typeof r!="string"&&!Array.isArray(r)){for(const o in r)if(o!=="default"&&!(o in e)){const i=Object.getOwnPropertyDescriptor(r,o);i&&Object.defineProperty(e,o,i.get?i:{enumerable:!0,get:()=>r[o]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))r(o);new MutationObserver(o=>{for(const i of o)if(i.type==="childList")for(const s of i.addedNodes)s.tagName==="LINK"&&s.rel==="modulepreload"&&r(s)}).observe(document,{childList:!0,subtree:!0});function n(o){const i={};return o.integrity&&(i.integrity=o.integrity),o.referrerPolicy&&(i.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?i.credentials="include":o.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function r(o){if(o.ep)return;o.ep=!0;const i=n(o);fetch(o.href,i)}})();var o0=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Dm(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Uw={exports:{}},kd={},Vw={exports:{}},$e={};/**
2
- * @license React
3
- * react.production.min.js
4
- *
5
- * Copyright (c) Facebook, Inc. and its affiliates.
6
- *
7
- * This source code is licensed under the MIT license found in the
8
- * LICENSE file in the root directory of this source tree.
9
- */var Zl=Symbol.for("react.element"),fk=Symbol.for("react.portal"),hk=Symbol.for("react.fragment"),pk=Symbol.for("react.strict_mode"),mk=Symbol.for("react.profiler"),gk=Symbol.for("react.provider"),yk=Symbol.for("react.context"),vk=Symbol.for("react.forward_ref"),xk=Symbol.for("react.suspense"),wk=Symbol.for("react.memo"),Sk=Symbol.for("react.lazy"),i0=Symbol.iterator;function bk(e){return e===null||typeof e!="object"?null:(e=i0&&e[i0]||e["@@iterator"],typeof e=="function"?e:null)}var Hw={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Ww=Object.assign,qw={};function ba(e,t,n){this.props=e,this.context=t,this.refs=qw,this.updater=n||Hw}ba.prototype.isReactComponent={};ba.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};ba.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function Gw(){}Gw.prototype=ba.prototype;function Im(e,t,n){this.props=e,this.context=t,this.refs=qw,this.updater=n||Hw}var _m=Im.prototype=new Gw;_m.constructor=Im;Ww(_m,ba.prototype);_m.isPureReactComponent=!0;var s0=Array.isArray,Qw=Object.prototype.hasOwnProperty,Am={current:null},Kw={key:!0,ref:!0,__self:!0,__source:!0};function Yw(e,t,n){var r,o={},i=null,s=null;if(t!=null)for(r in t.ref!==void 0&&(s=t.ref),t.key!==void 0&&(i=""+t.key),t)Qw.call(t,r)&&!Kw.hasOwnProperty(r)&&(o[r]=t[r]);var l=arguments.length-2;if(l===1)o.children=n;else if(1<l){for(var c=Array(l),u=0;u<l;u++)c[u]=arguments[u+2];o.children=c}if(e&&e.defaultProps)for(r in l=e.defaultProps,l)o[r]===void 0&&(o[r]=l[r]);return{$$typeof:Zl,type:e,key:i,ref:s,props:o,_owner:Am.current}}function Ck(e,t){return{$$typeof:Zl,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}function Nm(e){return typeof e=="object"&&e!==null&&e.$$typeof===Zl}function jk(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(n){return t[n]})}var a0=/\/+/g;function th(e,t){return typeof e=="object"&&e!==null&&e.key!=null?jk(""+e.key):t.toString(36)}function hu(e,t,n,r,o){var i=typeof e;(i==="undefined"||i==="boolean")&&(e=null);var s=!1;if(e===null)s=!0;else switch(i){case"string":case"number":s=!0;break;case"object":switch(e.$$typeof){case Zl:case fk:s=!0}}if(s)return s=e,o=o(s),e=r===""?"."+th(s,0):r,s0(o)?(n="",e!=null&&(n=e.replace(a0,"$&/")+"/"),hu(o,t,n,"",function(u){return u})):o!=null&&(Nm(o)&&(o=Ck(o,n+(!o.key||s&&s.key===o.key?"":(""+o.key).replace(a0,"$&/")+"/")+e)),t.push(o)),1;if(s=0,r=r===""?".":r+":",s0(e))for(var l=0;l<e.length;l++){i=e[l];var c=r+th(i,l);s+=hu(i,t,n,c,o)}else if(c=bk(e),typeof c=="function")for(e=c.call(e),l=0;!(i=e.next()).done;)i=i.value,c=r+th(i,l++),s+=hu(i,t,n,c,o);else if(i==="object")throw t=String(e),Error("Objects are not valid as a React child (found: "+(t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t)+"). If you meant to render a collection of children, use an array instead.");return s}function $c(e,t,n){if(e==null)return e;var r=[],o=0;return hu(e,r,"","",function(i){return t.call(n,i,o++)}),r}function Ek(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(n){(e._status===0||e._status===-1)&&(e._status=1,e._result=n)},function(n){(e._status===0||e._status===-1)&&(e._status=2,e._result=n)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var xn={current:null},pu={transition:null},Tk={ReactCurrentDispatcher:xn,ReactCurrentBatchConfig:pu,ReactCurrentOwner:Am};$e.Children={map:$c,forEach:function(e,t,n){$c(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return $c(e,function(){t++}),t},toArray:function(e){return $c(e,function(t){return t})||[]},only:function(e){if(!Nm(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};$e.Component=ba;$e.Fragment=hk;$e.Profiler=mk;$e.PureComponent=Im;$e.StrictMode=pk;$e.Suspense=xk;$e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Tk;$e.cloneElement=function(e,t,n){if(e==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+e+".");var r=Ww({},e.props),o=e.key,i=e.ref,s=e._owner;if(t!=null){if(t.ref!==void 0&&(i=t.ref,s=Am.current),t.key!==void 0&&(o=""+t.key),e.type&&e.type.defaultProps)var l=e.type.defaultProps;for(c in t)Qw.call(t,c)&&!Kw.hasOwnProperty(c)&&(r[c]=t[c]===void 0&&l!==void 0?l[c]:t[c])}var c=arguments.length-2;if(c===1)r.children=n;else if(1<c){l=Array(c);for(var u=0;u<c;u++)l[u]=arguments[u+2];r.children=l}return{$$typeof:Zl,type:e.type,key:o,ref:i,props:r,_owner:s}};$e.createContext=function(e){return e={$$typeof:yk,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},e.Provider={$$typeof:gk,_context:e},e.Consumer=e};$e.createElement=Yw;$e.createFactory=function(e){var t=Yw.bind(null,e);return t.type=e,t};$e.createRef=function(){return{current:null}};$e.forwardRef=function(e){return{$$typeof:vk,render:e}};$e.isValidElement=Nm;$e.lazy=function(e){return{$$typeof:Sk,_payload:{_status:-1,_result:e},_init:Ek}};$e.memo=function(e,t){return{$$typeof:wk,type:e,compare:t===void 0?null:t}};$e.startTransition=function(e){var t=pu.transition;pu.transition={};try{e()}finally{pu.transition=t}};$e.unstable_act=function(){throw Error("act(...) is not supported in production builds of React.")};$e.useCallback=function(e,t){return xn.current.useCallback(e,t)};$e.useContext=function(e){return xn.current.useContext(e)};$e.useDebugValue=function(){};$e.useDeferredValue=function(e){return xn.current.useDeferredValue(e)};$e.useEffect=function(e,t){return xn.current.useEffect(e,t)};$e.useId=function(){return xn.current.useId()};$e.useImperativeHandle=function(e,t,n){return xn.current.useImperativeHandle(e,t,n)};$e.useInsertionEffect=function(e,t){return xn.current.useInsertionEffect(e,t)};$e.useLayoutEffect=function(e,t){return xn.current.useLayoutEffect(e,t)};$e.useMemo=function(e,t){return xn.current.useMemo(e,t)};$e.useReducer=function(e,t,n){return xn.current.useReducer(e,t,n)};$e.useRef=function(e){return xn.current.useRef(e)};$e.useState=function(e){return xn.current.useState(e)};$e.useSyncExternalStore=function(e,t,n){return xn.current.useSyncExternalStore(e,t,n)};$e.useTransition=function(){return xn.current.useTransition()};$e.version="18.2.0";Vw.exports=$e;var p=Vw.exports;const b=Dm(p),Om=Bw({__proto__:null,default:b},[p]);/**
10
- * @license React
11
- * react-jsx-runtime.production.min.js
12
- *
13
- * Copyright (c) Facebook, Inc. and its affiliates.
14
- *
15
- * This source code is licensed under the MIT license found in the
16
- * LICENSE file in the root directory of this source tree.
17
- */var Pk=p,kk=Symbol.for("react.element"),Rk=Symbol.for("react.fragment"),Dk=Object.prototype.hasOwnProperty,Ik=Pk.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,_k={key:!0,ref:!0,__self:!0,__source:!0};function Xw(e,t,n){var r,o={},i=null,s=null;n!==void 0&&(i=""+n),t.key!==void 0&&(i=""+t.key),t.ref!==void 0&&(s=t.ref);for(r in t)Dk.call(t,r)&&!_k.hasOwnProperty(r)&&(o[r]=t[r]);if(e&&e.defaultProps)for(r in t=e.defaultProps,t)o[r]===void 0&&(o[r]=t[r]);return{$$typeof:kk,type:e,key:i,ref:s,props:o,_owner:Ik.current}}kd.Fragment=Rk;kd.jsx=Xw;kd.jsxs=Xw;Uw.exports=kd;var a=Uw.exports,Hr=function(){return Hr=Object.assign||function(t){for(var n,r=1,o=arguments.length;r<o;r++){n=arguments[r];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},Hr.apply(this,arguments)};function Jw(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]]);return n}function Ak(e,t,n){if(n||arguments.length===2)for(var r=0,o=t.length,i;r<o;r++)(i||!(r in t))&&(i||(i=Array.prototype.slice.call(t,0,r)),i[r]=t[r]);return e.concat(i||Array.prototype.slice.call(t))}var mu="right-scroll-bar-position",gu="width-before-scroll-bar",Nk="with-scroll-bars-hidden",Ok="--removed-body-scroll-bar-size";function nh(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function Mk(e,t){var n=p.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(r){var o=n.value;o!==r&&(n.value=r,n.callback(r,o))}}}})[0];return n.callback=t,n.facade}var l0=new WeakMap;function Lk(e,t){var n=Mk(t||null,function(r){return e.forEach(function(o){return nh(o,r)})});return p.useLayoutEffect(function(){var r=l0.get(n);if(r){var o=new Set(r),i=new Set(e),s=n.current;o.forEach(function(l){i.has(l)||nh(l,null)}),i.forEach(function(l){o.has(l)||nh(l,s)})}l0.set(n,e)},[e]),n}function $k(e){return e}function Fk(e,t){t===void 0&&(t=$k);var n=[],r=!1,o={read:function(){if(r)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(i){var s=t(i,r);return n.push(s),function(){n=n.filter(function(l){return l!==s})}},assignSyncMedium:function(i){for(r=!0;n.length;){var s=n;n=[],s.forEach(i)}n={push:function(l){return i(l)},filter:function(){return n}}},assignMedium:function(i){r=!0;var s=[];if(n.length){var l=n;n=[],l.forEach(i),s=n}var c=function(){var d=s;s=[],d.forEach(i)},u=function(){return Promise.resolve().then(c)};u(),n={push:function(d){s.push(d),u()},filter:function(d){return s=s.filter(d),n}}}};return o}function zk(e){e===void 0&&(e={});var t=Fk(null);return t.options=Hr({async:!0,ssr:!1},e),t}var Zw=function(e){var t=e.sideCar,n=Jw(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw new Error("Sidecar medium not found");return p.createElement(r,Hr({},n))};Zw.isSideCarExport=!0;function Bk(e,t){return e.useMedium(t),Zw}var eS=zk(),rh=function(){},Rd=p.forwardRef(function(e,t){var n=p.useRef(null),r=p.useState({onScrollCapture:rh,onWheelCapture:rh,onTouchMoveCapture:rh}),o=r[0],i=r[1],s=e.forwardProps,l=e.children,c=e.className,u=e.removeScrollBar,d=e.enabled,f=e.shards,h=e.sideCar,m=e.noIsolation,g=e.inert,y=e.allowPinchZoom,C=e.as,v=C===void 0?"div":C,x=e.gapMode,w=Jw(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noIsolation","inert","allowPinchZoom","as","gapMode"]),S=h,E=Lk([n,t]),j=Hr(Hr({},w),o);return p.createElement(p.Fragment,null,d&&p.createElement(S,{sideCar:eS,removeScrollBar:u,shards:f,noIsolation:m,inert:g,setCallbacks:i,allowPinchZoom:!!y,lockRef:n,gapMode:x}),s?p.cloneElement(p.Children.only(l),Hr(Hr({},j),{ref:E})):p.createElement(v,Hr({},j,{className:c,ref:E}),l))});Rd.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Rd.classNames={fullWidth:gu,zeroRight:mu};var Uk=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function Vk(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=Uk();return t&&e.setAttribute("nonce",t),e}function Hk(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function Wk(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var qk=function(){var e=0,t=null;return{add:function(n){e==0&&(t=Vk())&&(Hk(t,n),Wk(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},Gk=function(){var e=qk();return function(t,n){p.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},tS=function(){var e=Gk(),t=function(n){var r=n.styles,o=n.dynamic;return e(r,o),null};return t},Qk={left:0,top:0,right:0,gap:0},oh=function(e){return parseInt(e||"",10)||0},Kk=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],r=t[e==="padding"?"paddingTop":"marginTop"],o=t[e==="padding"?"paddingRight":"marginRight"];return[oh(n),oh(r),oh(o)]},Yk=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return Qk;var t=Kk(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},Xk=tS(),Jk=function(e,t,n,r){var o=e.left,i=e.top,s=e.right,l=e.gap;return n===void 0&&(n="margin"),`
18
- .`.concat(Nk,` {
19
- overflow: hidden `).concat(r,`;
20
- padding-right: `).concat(l,"px ").concat(r,`;
21
- }
22
- body {
23
- overflow: hidden `).concat(r,`;
24
- overscroll-behavior: contain;
25
- `).concat([t&&"position: relative ".concat(r,";"),n==="margin"&&`
26
- padding-left: `.concat(o,`px;
27
- padding-top: `).concat(i,`px;
28
- padding-right: `).concat(s,`px;
29
- margin-left:0;
30
- margin-top:0;
31
- margin-right: `).concat(l,"px ").concat(r,`;
32
- `),n==="padding"&&"padding-right: ".concat(l,"px ").concat(r,";")].filter(Boolean).join(""),`
33
- }
34
-
35
- .`).concat(mu,` {
36
- right: `).concat(l,"px ").concat(r,`;
37
- }
38
-
39
- .`).concat(gu,` {
40
- margin-right: `).concat(l,"px ").concat(r,`;
41
- }
42
-
43
- .`).concat(mu," .").concat(mu,` {
44
- right: 0 `).concat(r,`;
45
- }
46
-
47
- .`).concat(gu," .").concat(gu,` {
48
- margin-right: 0 `).concat(r,`;
49
- }
50
-
51
- body {
52
- `).concat(Ok,": ").concat(l,`px;
53
- }
54
- `)},Zk=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,o=r===void 0?"margin":r,i=p.useMemo(function(){return Yk(o)},[o]);return p.createElement(Xk,{styles:Jk(i,!t,o,n?"":"!important")})},tp=!1;if(typeof window<"u")try{var Fc=Object.defineProperty({},"passive",{get:function(){return tp=!0,!0}});window.addEventListener("test",Fc,Fc),window.removeEventListener("test",Fc,Fc)}catch{tp=!1}var bs=tp?{passive:!1}:!1,e2=function(e){return e.tagName==="TEXTAREA"},nS=function(e,t){var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!e2(e)&&n[t]==="visible")},t2=function(e){return nS(e,"overflowY")},n2=function(e){return nS(e,"overflowX")},c0=function(e,t){var n=t.ownerDocument,r=t;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var o=rS(e,r);if(o){var i=oS(e,r),s=i[1],l=i[2];if(s>l)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},r2=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},o2=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},rS=function(e,t){return e==="v"?t2(t):n2(t)},oS=function(e,t){return e==="v"?r2(t):o2(t)},i2=function(e,t){return e==="h"&&t==="rtl"?-1:1},s2=function(e,t,n,r,o){var i=i2(e,window.getComputedStyle(t).direction),s=i*r,l=n.target,c=t.contains(l),u=!1,d=s>0,f=0,h=0;do{var m=oS(e,l),g=m[0],y=m[1],C=m[2],v=y-C-i*g;(g||v)&&rS(e,l)&&(f+=v,h+=g),l instanceof ShadowRoot?l=l.host:l=l.parentNode}while(!c&&l!==document.body||c&&(t.contains(l)||t===l));return(d&&(o&&Math.abs(f)<1||!o&&s>f)||!d&&(o&&Math.abs(h)<1||!o&&-s>h))&&(u=!0),u},zc=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},u0=function(e){return[e.deltaX,e.deltaY]},d0=function(e){return e&&"current"in e?e.current:e},a2=function(e,t){return e[0]===t[0]&&e[1]===t[1]},l2=function(e){return`
55
- .block-interactivity-`.concat(e,` {pointer-events: none;}
56
- .allow-interactivity-`).concat(e,` {pointer-events: all;}
57
- `)},c2=0,Cs=[];function u2(e){var t=p.useRef([]),n=p.useRef([0,0]),r=p.useRef(),o=p.useState(c2++)[0],i=p.useState(tS)[0],s=p.useRef(e);p.useEffect(function(){s.current=e},[e]),p.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(o));var y=Ak([e.lockRef.current],(e.shards||[]).map(d0),!0).filter(Boolean);return y.forEach(function(C){return C.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),y.forEach(function(C){return C.classList.remove("allow-interactivity-".concat(o))})}}},[e.inert,e.lockRef.current,e.shards]);var l=p.useCallback(function(y,C){if("touches"in y&&y.touches.length===2)return!s.current.allowPinchZoom;var v=zc(y),x=n.current,w="deltaX"in y?y.deltaX:x[0]-v[0],S="deltaY"in y?y.deltaY:x[1]-v[1],E,j=y.target,T=Math.abs(w)>Math.abs(S)?"h":"v";if("touches"in y&&T==="h"&&j.type==="range")return!1;var P=c0(T,j);if(!P)return!0;if(P?E=T:(E=T==="v"?"h":"v",P=c0(T,j)),!P)return!1;if(!r.current&&"changedTouches"in y&&(w||S)&&(r.current=E),!E)return!0;var R=r.current||E;return s2(R,C,y,R==="h"?w:S,!0)},[]),c=p.useCallback(function(y){var C=y;if(!(!Cs.length||Cs[Cs.length-1]!==i)){var v="deltaY"in C?u0(C):zc(C),x=t.current.filter(function(E){return E.name===C.type&&(E.target===C.target||C.target===E.shadowParent)&&a2(E.delta,v)})[0];if(x&&x.should){C.cancelable&&C.preventDefault();return}if(!x){var w=(s.current.shards||[]).map(d0).filter(Boolean).filter(function(E){return E.contains(C.target)}),S=w.length>0?l(C,w[0]):!s.current.noIsolation;S&&C.cancelable&&C.preventDefault()}}},[]),u=p.useCallback(function(y,C,v,x){var w={name:y,delta:C,target:v,should:x,shadowParent:d2(v)};t.current.push(w),setTimeout(function(){t.current=t.current.filter(function(S){return S!==w})},1)},[]),d=p.useCallback(function(y){n.current=zc(y),r.current=void 0},[]),f=p.useCallback(function(y){u(y.type,u0(y),y.target,l(y,e.lockRef.current))},[]),h=p.useCallback(function(y){u(y.type,zc(y),y.target,l(y,e.lockRef.current))},[]);p.useEffect(function(){return Cs.push(i),e.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:h}),document.addEventListener("wheel",c,bs),document.addEventListener("touchmove",c,bs),document.addEventListener("touchstart",d,bs),function(){Cs=Cs.filter(function(y){return y!==i}),document.removeEventListener("wheel",c,bs),document.removeEventListener("touchmove",c,bs),document.removeEventListener("touchstart",d,bs)}},[]);var m=e.removeScrollBar,g=e.inert;return p.createElement(p.Fragment,null,g?p.createElement(i,{styles:l2(o)}):null,m?p.createElement(Zk,{gapMode:e.gapMode}):null)}function d2(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const f2=Bk(eS,u2);var Dd=p.forwardRef(function(e,t){return p.createElement(Rd,Hr({},e,{ref:t,sideCar:f2}))});Dd.classNames=Rd.classNames;function ct(e){return Object.keys(e)}function ih(e){return e&&typeof e=="object"&&!Array.isArray(e)}function Mm(e,t){const n={...e},r=t;return ih(e)&&ih(t)&&Object.keys(t).forEach(o=>{ih(r[o])&&o in e?n[o]=Mm(n[o],r[o]):n[o]=r[o]}),n}function h2(e){return e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`)}function p2(e){var t;return typeof e!="string"||!e.includes("var(--mantine-scale)")?e:(t=e.match(/^calc\((.*?)\)$/))==null?void 0:t[1].split("*")[0].trim()}function np(e){const t=p2(e);return typeof t=="number"?t:typeof t=="string"?t.includes("calc")||t.includes("var")?t:t.includes("px")?Number(t.replace("px","")):t.includes("rem")?Number(t.replace("rem",""))*16:t.includes("em")?Number(t.replace("em",""))*16:Number(t):NaN}function sh(e){return`calc(${e} * var(--mantine-scale))`}function iS(e,{shouldScale:t=!1}={}){function n(r){if(r===0||r==="0")return`0${e}`;if(typeof r=="number"){const o=`${r/16}${e}`;return t?sh(o):o}if(typeof r=="string"){if(r.startsWith("calc(")||r.startsWith("var(")||r.startsWith("clamp("))return r;if(r.includes(" "))return r.split(" ").map(i=>n(i)).join(" ");if(r.includes(e))return t?sh(r):r;const o=r.replace("px","");if(!Number.isNaN(Number(o))){const i=`${Number(o)/16}${e}`;return t?sh(i):i}}return r}return n}const $=iS("rem",{shouldScale:!0}),Nu=iS("em");function rs(e){return Object.keys(e).reduce((t,n)=>(e[n]!==void 0&&(t[n]=e[n]),t),{})}function sS(e){return typeof e=="number"?!0:typeof e=="string"?e.startsWith("calc(")||e.startsWith("var(")||e.includes(" ")&&e.trim()!==""?!0:/[0-9]/.test(e.trim().replace("-","")[0]):!1}function Co(e){return Array.isArray(e)||e===null?!1:typeof e=="object"?e.type!==b.Fragment:!1}function wn(e){const t=p.createContext(null);return[({children:o,value:i})=>b.createElement(t.Provider,{value:i},o),()=>{const o=p.useContext(t);if(o===null)throw new Error(e);return o}]}function ec(e=null){const t=p.createContext(e);return[({children:o,value:i})=>b.createElement(t.Provider,{value:i},o),()=>p.useContext(t)]}function f0(e,t){return n=>{if(typeof n!="string"||n.trim().length===0)throw new Error(t);return`${e}-${n}`}}function Ou(e,t){let n=e;for(;(n=n.parentElement)&&!n.matches(t););return n}function m2(e,t,n){for(let r=e-1;r>=0;r-=1)if(!t[r].disabled)return r;if(n){for(let r=t.length-1;r>-1;r-=1)if(!t[r].disabled)return r}return e}function g2(e,t,n){for(let r=e+1;r<t.length;r+=1)if(!t[r].disabled)return r;if(n){for(let r=0;r<t.length;r+=1)if(!t[r].disabled)return r}return e}function y2(e,t,n){return Ou(e,n)===Ou(t,n)}function aS({parentSelector:e,siblingSelector:t,onKeyDown:n,loop:r=!0,activateOnFocus:o=!1,dir:i="rtl",orientation:s}){return l=>{var g;n==null||n(l);const c=Array.from(((g=Ou(l.currentTarget,e))==null?void 0:g.querySelectorAll(t))||[]).filter(y=>y2(l.currentTarget,y,e)),u=c.findIndex(y=>l.currentTarget===y),d=g2(u,c,r),f=m2(u,c,r),h=i==="rtl"?f:d,m=i==="rtl"?d:f;switch(l.key){case"ArrowRight":{s==="horizontal"&&(l.stopPropagation(),l.preventDefault(),c[h].focus(),o&&c[h].click());break}case"ArrowLeft":{s==="horizontal"&&(l.stopPropagation(),l.preventDefault(),c[m].focus(),o&&c[m].click());break}case"ArrowUp":{s==="vertical"&&(l.stopPropagation(),l.preventDefault(),c[f].focus(),o&&c[f].click());break}case"ArrowDown":{s==="vertical"&&(l.stopPropagation(),l.preventDefault(),c[d].focus(),o&&c[d].click());break}case"Home":{l.stopPropagation(),l.preventDefault(),!c[0].disabled&&c[0].focus();break}case"End":{l.stopPropagation(),l.preventDefault();const y=c.length-1;!c[y].disabled&&c[y].focus();break}}}}const v2={app:100,modal:200,popover:300,overlay:400,max:9999};function _r(e){return v2[e]}const x2=()=>{};function w2(e,t={active:!0}){return typeof e!="function"||!t.active?t.onKeyDown||x2:n=>{var r;n.key==="Escape"&&(e(n),(r=t.onTrigger)==null||r.call(t))}}function je(e,t="size",n=!0){if(e!==void 0)return sS(e)?n?$(e):e:`var(--${t}-${e})`}function Kt(e){return je(e,"mantine-spacing")}function gt(e){return e===void 0?"var(--mantine-radius-default)":je(e,"mantine-radius")}function Xt(e){return je(e,"mantine-font-size")}function lS(e){return je(e,"mantine-line-height",!1)}function Lm(e){if(e)return je(e,"mantine-shadow",!1)}function Bn(e,t){return n=>{e==null||e(n),t==null||t(n)}}function $m(e,t){return e in t.breakpoints?np(t.breakpoints[e]):np(e)}function jl(e,t){const n=e.map(r=>({value:r,px:$m(r,t)}));return n.sort((r,o)=>r.px-o.px),n}function Qo(e){return typeof e=="object"&&e!==null?"base"in e?e.base:void 0:e}function S2(e,t,n){var r;return n?Array.from(((r=Ou(n,t))==null?void 0:r.querySelectorAll(e))||[]).findIndex(o=>o===n):null}function b2(){const[e,t]=p.useState(-1);return[e,{setHovered:t,resetHovered:()=>t(-1)}]}var C2={};function j2(){return typeof process<"u"&&C2?"production":"development"}function cS(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e))for(t=0;t<e.length;t++)e[t]&&(n=cS(e[t]))&&(r&&(r+=" "),r+=n);else for(t in e)e[t]&&(r&&(r+=" "),r+=t);return r}function Ye(){for(var e,t,n=0,r="";n<arguments.length;)(e=arguments[n++])&&(t=cS(e))&&(r&&(r+=" "),r+=t);return r}const E2={};function T2(e){const t={};return e.forEach(n=>{Object.entries(n).forEach(([r,o])=>{t[r]?t[r]=Ye(t[r],o):t[r]=o})}),t}function Id({theme:e,classNames:t,props:n,stylesCtx:r}){const i=(Array.isArray(t)?t:[t]).map(s=>typeof s=="function"?s(e,n,r):s||E2);return T2(i)}function Mu({theme:e,styles:t,props:n,stylesCtx:r}){return(Array.isArray(t)?t:[t]).reduce((i,s)=>typeof s=="function"?{...i,...s(e,n,r)}:{...i,...s},{})}function Fm(){return`mantine-${Math.random().toString(36).slice(2,11)}`}function h0(e){return typeof e!="string"?"":e.charAt(0).toUpperCase()+e.slice(1)}function Ai(e){const t=p.useRef(e);return p.useEffect(()=>{t.current=e}),p.useMemo(()=>(...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)},[])}function _d(e,t){const n=Ai(e),r=p.useRef(0);return p.useEffect(()=>()=>window.clearTimeout(r.current),[]),p.useCallback(()=>{window.clearTimeout(r.current),r.current=window.setTimeout(n,t)},[n,t])}const p0=["mousedown","touchstart"];function P2(e,t,n){const r=p.useRef();return p.useEffect(()=>{const o=i=>{const{target:s}=i??{};if(Array.isArray(n)){const l=(s==null?void 0:s.hasAttribute("data-ignore-outside-clicks"))||!document.body.contains(s)&&s.tagName!=="HTML";n.every(u=>!!u&&!i.composedPath().includes(u))&&!l&&e()}else r.current&&!r.current.contains(s)&&e()};return(t||p0).forEach(i=>document.addEventListener(i,o)),()=>{(t||p0).forEach(i=>document.removeEventListener(i,o))}},[r,e,n]),r}function uS({timeout:e=2e3}={}){const[t,n]=p.useState(null),[r,o]=p.useState(!1),[i,s]=p.useState(null),l=d=>{window.clearTimeout(i),s(window.setTimeout(()=>o(!1),e)),o(d)};return{copy:d=>{"clipboard"in navigator?navigator.clipboard.writeText(d).then(()=>l(!0)).catch(f=>n(f)):n(new Error("useClipboard: navigator.clipboard is not supported"))},reset:()=>{o(!1),n(null),window.clearTimeout(i)},error:t,copied:r}}function k2(e,t){try{return e.addEventListener("change",t),()=>e.removeEventListener("change",t)}catch{return e.addListener(t),()=>e.removeListener(t)}}function R2(e,t){return typeof t=="boolean"?t:typeof window<"u"&&"matchMedia"in window?window.matchMedia(e).matches:!1}function D2(e,t,{getInitialValueInEffect:n}={getInitialValueInEffect:!0}){const[r,o]=p.useState(n?t:R2(e)),i=p.useRef();return p.useEffect(()=>{if("matchMedia"in window)return i.current=window.matchMedia(e),o(i.current.matches),k2(i.current,s=>o(s.matches))},[e]),r}const Ca=typeof document<"u"?p.useLayoutEffect:p.useEffect;function fo(e,t){const n=p.useRef(!1);p.useEffect(()=>()=>{n.current=!1},[]),p.useEffect(()=>{if(n.current)return e();n.current=!0},t)}function dS({opened:e,shouldReturnFocus:t=!0}){const n=p.useRef(),r=()=>{var o;n.current&&"focus"in n.current&&typeof n.current.focus=="function"&&((o=n.current)==null||o.focus({preventScroll:!0}))};return fo(()=>{let o=-1;const i=s=>{s.key==="Tab"&&window.clearTimeout(o)};return document.addEventListener("keydown",i),e?n.current=document.activeElement:t&&(o=window.setTimeout(r,10)),()=>{window.clearTimeout(o),document.removeEventListener("keydown",i)}},[e,t]),r}function I2(e,t="body > :not(script)"){const n=Fm(),r=Array.from(document.querySelectorAll(t)).map(o=>{var c;if((c=o==null?void 0:o.shadowRoot)!=null&&c.contains(e)||o.contains(e))return;const i=o.getAttribute("aria-hidden"),s=o.getAttribute("data-hidden"),l=o.getAttribute("data-focus-id");return o.setAttribute("data-focus-id",n),i===null||i==="false"?o.setAttribute("aria-hidden","true"):!s&&!l&&o.setAttribute("data-hidden",i),{node:o,ariaHidden:s||null}});return()=>{r.forEach(o=>{!o||n!==o.node.getAttribute("data-focus-id")||(o.ariaHidden===null?o.node.removeAttribute("aria-hidden"):o.node.setAttribute("aria-hidden",o.ariaHidden),o.node.removeAttribute("data-focus-id"),o.node.removeAttribute("data-hidden"))})}}const _2=/input|select|textarea|button|object/,fS="a, input, select, textarea, button, object, [tabindex]";function A2(e){return e.style.display==="none"}function N2(e){if(e.getAttribute("aria-hidden")||e.getAttribute("hidden")||e.getAttribute("type")==="hidden")return!1;let n=e;for(;n&&!(n===document.body||n.nodeType===11);){if(A2(n))return!1;n=n.parentNode}return!0}function hS(e){let t=e.getAttribute("tabindex");return t===null&&(t=void 0),parseInt(t,10)}function rp(e){const t=e.nodeName.toLowerCase(),n=!Number.isNaN(hS(e));return(_2.test(t)&&!e.disabled||e instanceof HTMLAnchorElement&&e.href||n)&&N2(e)}function pS(e){const t=hS(e);return(Number.isNaN(t)||t>=0)&&rp(e)}function O2(e){return Array.from(e.querySelectorAll(fS)).filter(pS)}function M2(e,t){const n=O2(e);if(!n.length){t.preventDefault();return}const r=n[t.shiftKey?0:n.length-1],o=e.getRootNode();let i=r===o.activeElement||e===o.activeElement;const s=o.activeElement;if(s.tagName==="INPUT"&&s.getAttribute("type")==="radio"&&(i=n.filter(d=>d.getAttribute("type")==="radio"&&d.getAttribute("name")===s.getAttribute("name")).includes(r)),!i)return;t.preventDefault();const c=n[t.shiftKey?n.length-1:0];c&&c.focus()}function L2(e=!0){const t=p.useRef(),n=p.useRef(null),r=i=>{let s=i.querySelector("[data-autofocus]");if(!s){const l=Array.from(i.querySelectorAll(fS));s=l.find(pS)||l.find(rp)||null,!s&&rp(i)&&(s=i)}s&&s.focus({preventScroll:!0})},o=p.useCallback(i=>{if(e){if(i===null){n.current&&(n.current(),n.current=null);return}n.current=I2(i),t.current!==i&&(i?(setTimeout(()=>{i.getRootNode()&&r(i)}),t.current=i):t.current=null)}},[e]);return p.useEffect(()=>{if(!e)return;t.current&&setTimeout(()=>r(t.current));const i=s=>{s.key==="Tab"&&t.current&&M2(t.current,s)};return document.addEventListener("keydown",i),()=>{document.removeEventListener("keydown",i),n.current&&n.current()}},[e]),o}const $2=e=>(e+1)%1e6;function F2(){const[,e]=p.useReducer($2,0);return e}const z2=b.useId||(()=>{});function B2(){const e=z2();return e?`mantine-${e.replace(/:/g,"")}`:""}function Ln(e){const t=B2(),[n,r]=p.useState(t);return Ca(()=>{r(Fm())},[]),typeof e=="string"?e:typeof window>"u"?t:n}function mS(e,t,n){p.useEffect(()=>(window.addEventListener(e,t,n),()=>window.removeEventListener(e,t,n)),[e,t])}function zm(e,t){typeof e=="function"?e(t):typeof e=="object"&&e!==null&&"current"in e&&(e.current=t)}function U2(...e){return t=>{e.forEach(n=>zm(n,t))}}function tn(...e){return p.useCallback(U2(...e),e)}function yn({value:e,defaultValue:t,finalValue:n,onChange:r=()=>{}}){const[o,i]=p.useState(t!==void 0?t:n),s=(l,...c)=>{i(l),r==null||r(l,...c)};return e!==void 0?[e,r,!0]:[o,s,!1]}function $o(e,t){const n=t-e+1;return Array.from({length:n},(r,o)=>o+e)}const Bc="dots";function V2({total:e,siblings:t=1,boundaries:n=1,page:r,initialPage:o=1,onChange:i}){const s=Math.max(Math.trunc(e),0),[l,c]=yn({value:r,onChange:i,defaultValue:o,finalValue:o}),u=y=>{y<=0?c(1):y>s?c(s):c(y)},d=()=>u(l+1),f=()=>u(l-1),h=()=>u(1),m=()=>u(s);return{range:p.useMemo(()=>{if(t*2+3+n*2>=s)return $o(1,s);const C=Math.max(l-t,n),v=Math.min(l+t,s-n),x=C>n+2,w=v<s-(n+1);if(!x&&w){const S=t*2+n+2;return[...$o(1,S),Bc,...$o(s-(n-1),s)]}if(x&&!w){const S=n+1+2*t;return[...$o(1,n),Bc,...$o(s-S,s)]}return[...$o(1,n),Bc,...$o(C,v),Bc,...$o(s-n+1,s)]},[s,t,l]),active:l,setPage:u,next:d,previous:f,first:h,last:m}}function Bm(e,t){return D2("(prefers-reduced-motion: reduce)",e,t)}function H2(e=!1,t){const{onOpen:n,onClose:r}=t||{},[o,i]=p.useState(e),s=p.useCallback(()=>{i(u=>u||(n==null||n(),!0))},[n]),l=p.useCallback(()=>{i(u=>u&&(r==null||r(),!1))},[r]),c=p.useCallback(()=>{o?l():s()},[l,s,o]);return[o,{open:s,close:l,toggle:c}]}const gS=p.createContext(null);function Ad(){const e=p.useContext(gS);if(!e)throw new Error("[@mantine/core] MantineProvider was not found in tree");return e}function W2(){return Ad().cssVariablesResolver}function q2(){return Ad().classNamesPrefix}function Um(){return Ad().getStyleNonce}function G2(e){return/^#?([0-9A-F]{3}){1,2}([0-9A-F]{2})?$/i.test(e)}function Q2(e){let t=e.replace("#","");if(t.length===3){const s=t.split("");t=[s[0],s[0],s[1],s[1],s[2],s[2]].join("")}if(t.length===8){const s=parseInt(t.slice(6,8),16)/255;return{r:parseInt(t.slice(0,2),16),g:parseInt(t.slice(2,4),16),b:parseInt(t.slice(4,6),16),a:s}}const n=parseInt(t,16),r=n>>16&255,o=n>>8&255,i=n&255;return{r,g:o,b:i,a:1}}function K2(e){const[t,n,r,o]=e.replace(/[^0-9,./]/g,"").split(/[/,]/).map(Number);return{r:t,g:n,b:r,a:o||1}}function Y2(e){const t=/^hsla?\(\s*(\d+)\s*,\s*(\d+%)\s*,\s*(\d+%)\s*(,\s*(0?\.\d+|\d+(\.\d+)?))?\s*\)$/i,n=e.match(t);if(!n)return{r:0,g:0,b:0,a:1};const r=parseInt(n[1],10),o=parseInt(n[2],10)/100,i=parseInt(n[3],10)/100,s=n[5]?parseFloat(n[5]):void 0,l=(1-Math.abs(2*i-1))*o,c=r/60,u=l*(1-Math.abs(c%2-1)),d=i-l/2;let f,h,m;return c>=0&&c<1?(f=l,h=u,m=0):c>=1&&c<2?(f=u,h=l,m=0):c>=2&&c<3?(f=0,h=l,m=u):c>=3&&c<4?(f=0,h=u,m=l):c>=4&&c<5?(f=u,h=0,m=l):(f=l,h=0,m=u),{r:Math.round((f+d)*255),g:Math.round((h+d)*255),b:Math.round((m+d)*255),a:s||1}}function Vm(e){return G2(e)?Q2(e):e.startsWith("rgb")?K2(e):e.startsWith("hsl")?Y2(e):{r:0,g:0,b:0,a:1}}function Uc(e,t){if(e.startsWith("var("))return`color-mix(in srgb, ${e}, black ${t*100}%)`;const{r:n,g:r,b:o,a:i}=Vm(e),s=1-t,l=c=>Math.round(c*s);return`rgba(${l(n)}, ${l(r)}, ${l(o)}, ${i})`}function Lu(e,t){return typeof e.primaryShade=="number"?e.primaryShade:t==="dark"?e.primaryShade.dark:e.primaryShade.light}function ah(e){return e<=.03928?e/12.92:((e+.055)/1.055)**2.4}function X2(e){const t=e.match(/oklch\((.*?)%\s/);return t?parseFloat(t[1]):null}function J2(e){if(e.startsWith("oklch("))return(X2(e)||0)/100;const{r:t,g:n,b:r}=Vm(e),o=t/255,i=n/255,s=r/255,l=ah(o),c=ah(i),u=ah(s);return .2126*l+.7152*c+.0722*u}function Ba(e,t=.179){return e.startsWith("var(")?!1:J2(e)>t}function Jr({color:e,theme:t,colorScheme:n}){if(typeof e!="string")throw new Error(`[@mantine/core] Failed to parse color. Expected color to be a string, instead got ${typeof e}`);if(e==="bright")return{color:e,value:n==="dark"?t.white:t.black,shade:void 0,isThemeColor:!1,isLight:Ba(n==="dark"?t.white:t.black,t.luminanceThreshold),variable:"--mantine-color-bright"};if(e==="dimmed")return{color:e,value:n==="dark"?t.colors.dark[2]:t.colors.gray[7],shade:void 0,isThemeColor:!1,isLight:Ba(n==="dark"?t.colors.dark[2]:t.colors.gray[6],t.luminanceThreshold),variable:"--mantine-color-dimmed"};if(e==="white"||e==="black")return{color:e,value:e==="white"?t.white:t.black,shade:void 0,isThemeColor:!1,isLight:Ba(e==="white"?t.white:t.black,t.luminanceThreshold),variable:`--mantine-color-${e}`};const[r,o]=e.split("."),i=o?Number(o):void 0,s=r in t.colors;if(s){const l=i!==void 0?t.colors[r][i]:t.colors[r][Lu(t,n||"light")];return{color:r,value:l,shade:i,isThemeColor:s,isLight:Ba(l,t.luminanceThreshold),variable:o?`--mantine-color-${r}-${i}`:`--mantine-color-${r}-filled`}}return{color:e,value:e,isThemeColor:s,isLight:Ba(e,t.luminanceThreshold),shade:i,variable:void 0}}function wt(e,t){const n=Jr({color:e||t.primaryColor,theme:t});return n.variable?`var(${n.variable})`:e}function op(e,t){const n={from:(e==null?void 0:e.from)||t.defaultGradient.from,to:(e==null?void 0:e.to)||t.defaultGradient.to,deg:(e==null?void 0:e.deg)||t.defaultGradient.deg||0},r=wt(n.from,t),o=wt(n.to,t);return`linear-gradient(${n.deg}deg, ${r} 0%, ${o} 100%)`}function Qt(e,t){if(typeof e!="string"||t>1||t<0)return"rgba(0, 0, 0, 1)";if(e.startsWith("var(")){const i=(1-t)*100;return`color-mix(in srgb, ${e}, transparent ${i}%)`}if(e.startsWith("oklch"))return e.includes("/")?e.replace(/\/\s*[\d.]+\s*\)/,`/ ${t})`):e.replace(")",` / ${t})`);const{r:n,g:r,b:o}=Vm(e);return`rgba(${n}, ${r}, ${o}, ${t})`}const Z2=({color:e,theme:t,variant:n,gradient:r,autoContrast:o})=>{const i=Jr({color:e,theme:t}),s=typeof o=="boolean"?o:t.autoContrast;if(n==="filled"){const l=s&&i.isLight?"var(--mantine-color-black)":"var(--mantine-color-white)";return i.isThemeColor?i.shade===void 0?{background:`var(--mantine-color-${e}-filled)`,hover:`var(--mantine-color-${e}-filled-hover)`,color:l,border:`${$(1)} solid transparent`}:{background:`var(--mantine-color-${i.color}-${i.shade})`,hover:`var(--mantine-color-${i.color}-${i.shade===9?8:i.shade+1})`,color:l,border:`${$(1)} solid transparent`}:{background:e,hover:Uc(e,.1),color:l,border:`${$(1)} solid transparent`}}if(n==="light"){if(i.isThemeColor){if(i.shade===void 0)return{background:`var(--mantine-color-${e}-light)`,hover:`var(--mantine-color-${e}-light-hover)`,color:`var(--mantine-color-${e}-light-color)`,border:`${$(1)} solid transparent`};const l=t.colors[i.color][i.shade];return{background:Qt(l,.1),hover:Qt(l,.12),color:`var(--mantine-color-${i.color}-${Math.min(i.shade,6)})`,border:`${$(1)} solid transparent`}}return{background:Qt(e,.1),hover:Qt(e,.12),color:e,border:`${$(1)} solid transparent`}}if(n==="outline")return i.isThemeColor?i.shade===void 0?{background:"transparent",hover:`var(--mantine-color-${e}-outline-hover)`,color:`var(--mantine-color-${e}-outline)`,border:`${$(1)} solid var(--mantine-color-${e}-outline)`}:{background:"transparent",hover:Qt(t.colors[i.color][i.shade],.05),color:`var(--mantine-color-${i.color}-${i.shade})`,border:`${$(1)} solid var(--mantine-color-${i.color}-${i.shade})`}:{background:"transparent",hover:Qt(e,.05),color:e,border:`${$(1)} solid ${e}`};if(n==="subtle"){if(i.isThemeColor){if(i.shade===void 0)return{background:"transparent",hover:`var(--mantine-color-${e}-light-hover)`,color:`var(--mantine-color-${e}-light-color)`,border:`${$(1)} solid transparent`};const l=t.colors[i.color][i.shade];return{background:"transparent",hover:Qt(l,.12),color:`var(--mantine-color-${i.color}-${Math.min(i.shade,6)})`,border:`${$(1)} solid transparent`}}return{background:"transparent",hover:Qt(e,.12),color:e,border:`${$(1)} solid transparent`}}return n==="transparent"?i.isThemeColor?i.shade===void 0?{background:"transparent",hover:"transparent",color:`var(--mantine-color-${e}-light-color)`,border:`${$(1)} solid transparent`}:{background:"transparent",hover:"transparent",color:`var(--mantine-color-${i.color}-${Math.min(i.shade,6)})`,border:`${$(1)} solid transparent`}:{background:"transparent",hover:"transparent",color:e,border:`${$(1)} solid transparent`}:n==="white"?i.isThemeColor?i.shade===void 0?{background:"var(--mantine-color-white)",hover:Uc(t.white,.01),color:`var(--mantine-color-${e}-filled)`,border:`${$(1)} solid transparent`}:{background:"var(--mantine-color-white)",hover:Uc(t.white,.01),color:`var(--mantine-color-${i.color}-${i.shade})`,border:`${$(1)} solid transparent`}:{background:"var(--mantine-color-white)",hover:Uc(t.white,.01),color:e,border:`${$(1)} solid transparent`}:n==="gradient"?{background:op(r,t),hover:op(r,t),color:"var(--mantine-color-white)",border:"none"}:n==="default"?{background:"var(--mantine-color-default)",hover:"var(--mantine-color-default-hover)",color:"var(--mantine-color-default-color)",border:`${$(1)} solid var(--mantine-color-default-border)`}:{}},eR={dark:["#C9C9C9","#b8b8b8","#828282","#696969","#424242","#3b3b3b","#2e2e2e","#242424","#1f1f1f","#141414"],gray:["#f8f9fa","#f1f3f5","#e9ecef","#dee2e6","#ced4da","#adb5bd","#868e96","#495057","#343a40","#212529"],red:["#fff5f5","#ffe3e3","#ffc9c9","#ffa8a8","#ff8787","#ff6b6b","#fa5252","#f03e3e","#e03131","#c92a2a"],pink:["#fff0f6","#ffdeeb","#fcc2d7","#faa2c1","#f783ac","#f06595","#e64980","#d6336c","#c2255c","#a61e4d"],grape:["#f8f0fc","#f3d9fa","#eebefa","#e599f7","#da77f2","#cc5de8","#be4bdb","#ae3ec9","#9c36b5","#862e9c"],violet:["#f3f0ff","#e5dbff","#d0bfff","#b197fc","#9775fa","#845ef7","#7950f2","#7048e8","#6741d9","#5f3dc4"],indigo:["#edf2ff","#dbe4ff","#bac8ff","#91a7ff","#748ffc","#5c7cfa","#4c6ef5","#4263eb","#3b5bdb","#364fc7"],blue:["#e7f5ff","#d0ebff","#a5d8ff","#74c0fc","#4dabf7","#339af0","#228be6","#1c7ed6","#1971c2","#1864ab"],cyan:["#e3fafc","#c5f6fa","#99e9f2","#66d9e8","#3bc9db","#22b8cf","#15aabf","#1098ad","#0c8599","#0b7285"],teal:["#e6fcf5","#c3fae8","#96f2d7","#63e6be","#38d9a9","#20c997","#12b886","#0ca678","#099268","#087f5b"],green:["#ebfbee","#d3f9d8","#b2f2bb","#8ce99a","#69db7c","#51cf66","#40c057","#37b24d","#2f9e44","#2b8a3e"],lime:["#f4fce3","#e9fac8","#d8f5a2","#c0eb75","#a9e34b","#94d82d","#82c91e","#74b816","#66a80f","#5c940d"],yellow:["#fff9db","#fff3bf","#ffec99","#ffe066","#ffd43b","#fcc419","#fab005","#f59f00","#f08c00","#e67700"],orange:["#fff4e6","#ffe8cc","#ffd8a8","#ffc078","#ffa94d","#ff922b","#fd7e14","#f76707","#e8590c","#d9480f"]},m0="-apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica, Arial, sans-serif, Apple Color Emoji, Segoe UI Emoji",Hm={scale:1,fontSmoothing:!0,focusRing:"auto",white:"#fff",black:"#000",colors:eR,primaryShade:{light:6,dark:8},primaryColor:"blue",variantColorResolver:Z2,autoContrast:!1,luminanceThreshold:.3,fontFamily:m0,fontFamilyMonospace:"ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, Liberation Mono, Courier New, monospace",respectReducedMotion:!1,cursorType:"default",defaultGradient:{from:"blue",to:"cyan",deg:45},defaultRadius:"sm",activeClassName:"mantine-active",focusClassName:"",headings:{fontFamily:m0,fontWeight:"700",sizes:{h1:{fontSize:$(34),lineHeight:"1.3"},h2:{fontSize:$(26),lineHeight:"1.35"},h3:{fontSize:$(22),lineHeight:"1.4"},h4:{fontSize:$(18),lineHeight:"1.45"},h5:{fontSize:$(16),lineHeight:"1.5"},h6:{fontSize:$(14),lineHeight:"1.5"}}},fontSizes:{xs:$(12),sm:$(14),md:$(16),lg:$(18),xl:$(20)},lineHeights:{xs:"1.4",sm:"1.45",md:"1.55",lg:"1.6",xl:"1.65"},radius:{xs:$(2),sm:$(4),md:$(8),lg:$(16),xl:$(32)},spacing:{xs:$(10),sm:$(12),md:$(16),lg:$(20),xl:$(32)},breakpoints:{xs:"36em",sm:"48em",md:"62em",lg:"75em",xl:"88em"},shadows:{xs:`0 ${$(1)} ${$(3)} rgba(0, 0, 0, 0.05), 0 ${$(1)} ${$(2)} rgba(0, 0, 0, 0.1)`,sm:`0 ${$(1)} ${$(3)} rgba(0, 0, 0, 0.05), rgba(0, 0, 0, 0.05) 0 ${$(10)} ${$(15)} ${$(-5)}, rgba(0, 0, 0, 0.04) 0 ${$(7)} ${$(7)} ${$(-5)}`,md:`0 ${$(1)} ${$(3)} rgba(0, 0, 0, 0.05), rgba(0, 0, 0, 0.05) 0 ${$(20)} ${$(25)} ${$(-5)}, rgba(0, 0, 0, 0.04) 0 ${$(10)} ${$(10)} ${$(-5)}`,lg:`0 ${$(1)} ${$(3)} rgba(0, 0, 0, 0.05), rgba(0, 0, 0, 0.05) 0 ${$(28)} ${$(23)} ${$(-7)}, rgba(0, 0, 0, 0.04) 0 ${$(12)} ${$(12)} ${$(-7)}`,xl:`0 ${$(1)} ${$(3)} rgba(0, 0, 0, 0.05), rgba(0, 0, 0, 0.05) 0 ${$(36)} ${$(28)} ${$(-7)}, rgba(0, 0, 0, 0.04) 0 ${$(17)} ${$(17)} ${$(-7)}`},other:{},components:{}};function g0(e){return e==="auto"||e==="dark"||e==="light"}function tR({key:e="mantine-color-scheme-value"}={}){let t;return{get:n=>{if(typeof window>"u")return n;try{const r=window.localStorage.getItem(e);return g0(r)?r:n}catch{return n}},set:n=>{try{window.localStorage.setItem(e,n)}catch(r){console.warn("[@mantine/core] Local storage color scheme manager was unable to save color scheme.",r)}},subscribe:n=>{t=r=>{r.storageArea===window.localStorage&&r.key===e&&g0(r.newValue)&&n(r.newValue)},window.addEventListener("storage",t)},unsubscribe:()=>{window.removeEventListener("storage",t)},clear:()=>{window.localStorage.removeItem(e)}}}const nR="[@mantine/core] MantineProvider: Invalid theme.primaryColor, it accepts only key of theme.colors, learn more – https://mantine.dev/theming/colors/#primary-color",y0="[@mantine/core] MantineProvider: Invalid theme.primaryShade, it accepts only 0-9 integers or an object { light: 0-9, dark: 0-9 }";function lh(e){return e<0||e>9?!1:parseInt(e.toString(),10)===e}function v0(e){if(!(e.primaryColor in e.colors))throw new Error(nR);if(typeof e.primaryShade=="object"&&(!lh(e.primaryShade.dark)||!lh(e.primaryShade.light)))throw new Error(y0);if(typeof e.primaryShade=="number"&&!lh(e.primaryShade))throw new Error(y0)}function rR(e,t){var r;if(!t)return v0(e),e;const n=Mm(e,t);return t.fontFamily&&!((r=t.headings)!=null&&r.fontFamily)&&(n.headings.fontFamily=t.fontFamily),v0(n),n}const Wm=p.createContext(null),oR=()=>p.useContext(Wm)||Hm;function Nt(){const e=p.useContext(Wm);if(!e)throw new Error("@mantine/core: MantineProvider was not found in component tree, make sure you have it in your app");return e}function yS({theme:e,children:t,inherit:n=!0}){const r=oR(),o=p.useMemo(()=>rR(n?r:Hm,e),[e,r,n]);return b.createElement(Wm.Provider,{value:o},t)}yS.displayName="@mantine/core/MantineThemeProvider";function iR(){const e=Nt(),t=Um(),n=ct(e.breakpoints).reduce((r,o)=>{const i=e.breakpoints[o].includes("px"),s=np(e.breakpoints[o]),l=i?`${s-.1}px`:Nu(s-.1),c=i?`${s}px`:Nu(s);return`${r}@media (max-width: ${l}) {.mantine-visible-from-${o} {display: none !important;}}@media (min-width: ${c}) {.mantine-hidden-from-${o} {display: none !important;}}`},"");return b.createElement("style",{"data-mantine-styles":"classes",nonce:t==null?void 0:t(),dangerouslySetInnerHTML:{__html:n}})}function ch(e){return Object.entries(e).map(([t,n])=>`${t}: ${n};`).join("")}function uh(e,t){return(Array.isArray(e)?e:[e]).reduce((r,o)=>`${o}{${r}}`,t)}function sR(e,t){const n=ch(e.variables),r=n?uh(t,n):"",o=ch(e.dark),i=o?uh(`${t}[data-mantine-color-scheme="dark"]`,o):"",s=ch(e.light),l=s?uh(`${t}[data-mantine-color-scheme="light"]`,s):"";return`${r}${i}${l}`}function ja({color:e,theme:t,autoContrast:n=!0}){return(typeof n=="boolean"?n:t.autoContrast)&&Jr({color:e||t.primaryColor,theme:t}).isLight?"var(--mantine-color-black)":"var(--mantine-color-white)"}function x0(e,t){return ja({color:e.colors[e.primaryColor][Lu(e,t)],theme:e,autoContrast:null})}function js(e,t,n){ct(t).forEach(r=>Object.assign(e,{[`--mantine-${n}-${r}`]:t[r]}))}const vS=e=>{const t=Lu(e,"dark"),n=Lu(e,"light"),r=e.defaultRadius in e.radius?e.radius[e.defaultRadius]:$(e.defaultRadius),o={variables:{"--mantine-scale":e.scale.toString(),"--mantine-cursor-type":e.cursorType,"--mantine-webkit-font-smoothing":e.fontSmoothing?"antialiased":"unset","--mantine-color-scheme":"light dark","--mantine-moz-font-smoothing":e.fontSmoothing?"grayscale":"unset","--mantine-color-white":e.white,"--mantine-color-black":e.black,"--mantine-line-height":e.lineHeights.md,"--mantine-font-family":e.fontFamily,"--mantine-font-family-monospace":e.fontFamilyMonospace,"--mantine-font-family-headings":e.headings.fontFamily,"--mantine-heading-font-weight":e.headings.fontWeight,"--mantine-radius-default":r,"--mantine-primary-color-filled":`var(--mantine-color-${e.primaryColor}-filled)`,"--mantine-primary-color-filled-hover":`var(--mantine-color-${e.primaryColor}-filled-hover)`,"--mantine-primary-color-light":`var(--mantine-color-${e.primaryColor}-light)`,"--mantine-primary-color-light-hover":`var(--mantine-color-${e.primaryColor}-light-hover)`,"--mantine-primary-color-light-color":`var(--mantine-color-${e.primaryColor}-light-color)`},light:{"--mantine-primary-color-contrast":x0(e,"light"),"--mantine-color-bright":"var(--mantine-color-black)","--mantine-color-text":e.black,"--mantine-color-body":e.white,"--mantine-color-error":"var(--mantine-color-red-6)","--mantine-color-placeholder":"var(--mantine-color-gray-5)","--mantine-color-anchor":`var(--mantine-color-${e.primaryColor}-${n})`,"--mantine-color-default":"var(--mantine-color-white)","--mantine-color-default-hover":"var(--mantine-color-gray-0)","--mantine-color-default-color":"var(--mantine-color-black)","--mantine-color-default-border":"var(--mantine-color-gray-4)"},dark:{"--mantine-primary-color-contrast":x0(e,"dark"),"--mantine-color-bright":"var(--mantine-color-white)","--mantine-color-text":"var(--mantine-color-dark-0)","--mantine-color-body":"var(--mantine-color-dark-7)","--mantine-color-error":"var(--mantine-color-red-8)","--mantine-color-placeholder":"var(--mantine-color-dark-3)","--mantine-color-anchor":`var(--mantine-color-${e.primaryColor}-4)`,"--mantine-color-default":"var(--mantine-color-dark-6)","--mantine-color-default-hover":"var(--mantine-color-dark-5)","--mantine-color-default-color":"var(--mantine-color-white)","--mantine-color-default-border":"var(--mantine-color-dark-4)"}};js(o.variables,e.breakpoints,"breakpoint"),js(o.variables,e.spacing,"spacing"),js(o.variables,e.fontSizes,"font-size"),js(o.variables,e.lineHeights,"line-height"),js(o.variables,e.shadows,"shadow"),js(o.variables,e.radius,"radius"),e.colors[e.primaryColor].forEach((s,l)=>{o.variables[`--mantine-primary-color-${l}`]=`var(--mantine-color-${e.primaryColor}-${l})`}),ct(e.colors).forEach(s=>{e.colors[s].forEach((u,d)=>{o.variables[`--mantine-color-${s}-${d}`]=u});const l=`var(--mantine-color-${s}-${n===9?8:n+1})`,c=`var(--mantine-color-${s}-${t===9?8:t+1})`;o.light["--mantine-color-dimmed"]="var(--mantine-color-gray-6)",o.light[`--mantine-color-${s}-text`]=`var(--mantine-color-${s}-filled)`,o.light[`--mantine-color-${s}-filled`]=`var(--mantine-color-${s}-${n})`,o.light[`--mantine-color-${s}-filled-hover`]=l,o.light[`--mantine-color-${s}-light`]=Qt(e.colors[s][n],.1),o.light[`--mantine-color-${s}-light-hover`]=Qt(e.colors[s][n],.12),o.light[`--mantine-color-${s}-light-color`]=`var(--mantine-color-${s}-${n})`,o.light[`--mantine-color-${s}-outline`]=`var(--mantine-color-${s}-${n})`,o.light[`--mantine-color-${s}-outline-hover`]=Qt(e.colors[s][n],.05),o.dark["--mantine-color-dimmed"]="var(--mantine-color-dark-2)",o.dark[`--mantine-color-${s}-text`]=`var(--mantine-color-${s}-4)`,o.dark[`--mantine-color-${s}-filled`]=`var(--mantine-color-${s}-${t})`,o.dark[`--mantine-color-${s}-filled-hover`]=c,o.dark[`--mantine-color-${s}-light`]=Qt(e.colors[s][Math.max(0,t-2)],.15),o.dark[`--mantine-color-${s}-light-hover`]=Qt(e.colors[s][Math.max(0,t-2)],.2),o.dark[`--mantine-color-${s}-light-color`]=`var(--mantine-color-${s}-${Math.max(t-5,0)})`,o.dark[`--mantine-color-${s}-outline`]=`var(--mantine-color-${s}-${Math.max(t-4,0)})`,o.dark[`--mantine-color-${s}-outline-hover`]=Qt(e.colors[s][Math.max(t-4,0)],.05)});const i=e.headings.sizes;return ct(i).forEach(s=>{o.variables[`--mantine-${s}-font-size`]=i[s].fontSize,o.variables[`--mantine-${s}-line-height`]=i[s].lineHeight,o.variables[`--mantine-${s}-font-weight`]=i[s].fontWeight||e.headings.fontWeight}),o};function aR({theme:e,generator:t}){const n=vS(e),r=t==null?void 0:t(e);return r?Mm(n,r):n}const dh=vS(Hm);function lR(e){const t={variables:{},light:{},dark:{}};return ct(e.variables).forEach(n=>{dh.variables[n]!==e.variables[n]&&(t.variables[n]=e.variables[n])}),ct(e.light).forEach(n=>{dh.light[n]!==e.light[n]&&(t.light[n]=e.light[n])}),ct(e.dark).forEach(n=>{dh.dark[n]!==e.dark[n]&&(t.dark[n]=e.dark[n])}),t}function cR(e){return`
58
- ${e}[data-mantine-color-scheme="dark"] { --mantine-color-scheme: dark; }
59
- ${e}[data-mantine-color-scheme="light"] { --mantine-color-scheme: light; }
60
- `}function xS({cssVariablesSelector:e}){const t=Nt(),n=Um(),r=W2(),o=aR({theme:t,generator:r}),i=e===":root",s=i?lR(o):o,l=sR(s,e);return l?b.createElement("style",{"data-mantine-styles":!0,nonce:n==null?void 0:n(),dangerouslySetInnerHTML:{__html:`${l}${i?"":cR(e)}`}}):null}xS.displayName="@mantine/CssVariables";function uR(){const e=console.error;console.error=(...t)=>{t.length>1&&typeof t[0]=="string"&&t[0].toLowerCase().includes("extra attributes from the server")&&typeof t[1]=="string"&&t[1].toLowerCase().includes("data-mantine-color-scheme")||e(...t)}}function Es(e,t){var r;const n=e!=="auto"?e:window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";(r=t())==null||r.setAttribute("data-mantine-color-scheme",n)}function dR({manager:e,defaultColorScheme:t,getRootElement:n,forceColorScheme:r}){const o=p.useRef(),[i,s]=p.useState(()=>e.get(t)),l=r||i,c=p.useCallback(d=>{r||(Es(d,n),s(d),e.set(d))},[e.set,l,r]),u=p.useCallback(()=>{s(t),Es(t,n),e.clear()},[e.clear,t]);return p.useEffect(()=>(e.subscribe(c),e.unsubscribe),[e.subscribe,e.unsubscribe]),Ca(()=>{Es(e.get(t),n)},[]),p.useEffect(()=>{var f;if(r)return Es(r,n),()=>{};r===void 0&&Es(i,n),o.current=window.matchMedia("(prefers-color-scheme: dark)");const d=h=>{i==="auto"&&Es(h.matches?"dark":"light",n)};return(f=o.current)==null||f.addEventListener("change",d),()=>{var h;return(h=o.current)==null?void 0:h.removeEventListener("change",d)}},[i,r]),{colorScheme:l,setColorScheme:c,clearColorScheme:u}}function fR({respectReducedMotion:e,getRootElement:t}){Ca(()=>{var n;e&&((n=t())==null||n.setAttribute("data-respect-reduced-motion","true"))},[e])}uR();function wS({theme:e,children:t,getStyleNonce:n,withCssVariables:r=!0,cssVariablesSelector:o=":root",classNamesPrefix:i="mantine",colorSchemeManager:s=tR(),defaultColorScheme:l="light",getRootElement:c=()=>document.documentElement,cssVariablesResolver:u,forceColorScheme:d}){const{colorScheme:f,setColorScheme:h,clearColorScheme:m}=dR({defaultColorScheme:l,forceColorScheme:d,manager:s,getRootElement:c});return fR({respectReducedMotion:(e==null?void 0:e.respectReducedMotion)||!1,getRootElement:c}),b.createElement(gS.Provider,{value:{colorSchemeManager:s,colorScheme:f,setColorScheme:h,clearColorScheme:m,getRootElement:c,classNamesPrefix:i,getStyleNonce:n,cssVariablesResolver:u,cssVariablesSelector:o}},b.createElement(yS,{theme:e},r&&b.createElement(xS,{cssVariablesSelector:o}),b.createElement(iR,null),t))}wS.displayName="@mantine/core/MantineProvider";function Nd({classNames:e,styles:t,props:n,stylesCtx:r}){const o=Nt();return{resolvedClassNames:Id({theme:o,classNames:e,props:n,stylesCtx:r||void 0}),resolvedStyles:Mu({theme:o,styles:t,props:n,stylesCtx:r||void 0})}}const hR={always:"mantine-focus-always",auto:"mantine-focus-auto",never:"mantine-focus-never"};function pR({theme:e,options:t,unstyled:n}){return Ye((t==null?void 0:t.focusable)&&!n&&(e.focusClassName||hR[e.focusRing]),(t==null?void 0:t.active)&&!n&&e.activeClassName)}function mR({selector:e,stylesCtx:t,options:n,props:r,theme:o}){return Id({theme:o,classNames:n==null?void 0:n.classNames,props:(n==null?void 0:n.props)||r,stylesCtx:t})[e]}function gR({selector:e,stylesCtx:t,theme:n,classNames:r,props:o}){return Id({theme:n,classNames:r,props:o,stylesCtx:t})[e]}function yR({rootSelector:e,selector:t,className:n}){return e===t?n:void 0}function vR({selector:e,classes:t,unstyled:n}){return n?void 0:t[e]}function xR({themeName:e,classNamesPrefix:t,selector:n,withStaticClass:r}){return r===!1?[]:e.map(o=>`${t}-${o}-${n}`)}function wR({themeName:e,theme:t,selector:n,props:r,stylesCtx:o}){return e.map(i=>{var s,l;return(l=Id({theme:t,classNames:(s=t.components[i])==null?void 0:s.classNames,props:r,stylesCtx:o}))==null?void 0:l[n]})}function SR({options:e,classes:t,selector:n,unstyled:r}){return e!=null&&e.variant&&!r?t[`${n}--${e.variant}`]:void 0}function bR({theme:e,options:t,themeName:n,selector:r,classNamesPrefix:o,classNames:i,classes:s,unstyled:l,className:c,rootSelector:u,props:d,stylesCtx:f}){return Ye(pR({theme:e,options:t,unstyled:l}),wR({theme:e,themeName:n,selector:r,props:d,stylesCtx:f}),SR({options:t,classes:s,selector:r,unstyled:l}),gR({selector:r,stylesCtx:f,theme:e,classNames:i,props:d}),mR({selector:r,stylesCtx:f,options:t,props:d,theme:e}),yR({rootSelector:u,selector:r,className:c}),vR({selector:r,classes:s,unstyled:l}),xR({themeName:n,classNamesPrefix:o,selector:r,withStaticClass:t==null?void 0:t.withStaticClass}),t==null?void 0:t.className)}function CR({theme:e,themeName:t,props:n,stylesCtx:r,selector:o}){return t.map(i=>{var s;return Mu({theme:e,styles:(s=e.components[i])==null?void 0:s.styles,props:n,stylesCtx:r})[o]}).reduce((i,s)=>({...i,...s}),{})}function ip({style:e,theme:t}){return Array.isArray(e)?[...e].reduce((n,r)=>({...n,...ip({style:r,theme:t})}),{}):typeof e=="function"?e(t):e??{}}function jR(e){return e.reduce((t,n)=>(n&&Object.keys(n).forEach(r=>{t[r]={...t[r],...rs(n[r])}}),t),{})}function ER({vars:e,varsResolver:t,theme:n,props:r,stylesCtx:o,selector:i,themeName:s}){var l;return(l=jR([t==null?void 0:t(n,r,o),...s.map(c=>{var u,d,f;return(f=(d=(u=n.components)==null?void 0:u[c])==null?void 0:d.vars)==null?void 0:f.call(d,n,r,o)}),e==null?void 0:e(n,r,o)]))==null?void 0:l[i]}function TR({theme:e,themeName:t,selector:n,options:r,props:o,stylesCtx:i,rootSelector:s,styles:l,style:c,vars:u,varsResolver:d}){return{...CR({theme:e,themeName:t,props:o,stylesCtx:i,selector:n}),...Mu({theme:e,styles:l,props:o,stylesCtx:i})[n],...Mu({theme:e,styles:r==null?void 0:r.styles,props:(r==null?void 0:r.props)||o,stylesCtx:i})[n],...ER({theme:e,props:o,stylesCtx:i,vars:u,varsResolver:d,selector:n,themeName:t}),...s===n?ip({style:c,theme:e}):null,...ip({style:r==null?void 0:r.style,theme:e})}}function ue({name:e,classes:t,props:n,stylesCtx:r,className:o,style:i,rootSelector:s="root",unstyled:l,classNames:c,styles:u,vars:d,varsResolver:f}){const h=Nt(),m=q2(),g=(Array.isArray(e)?e:[e]).filter(y=>y);return(y,C)=>({className:bR({theme:h,options:C,themeName:g,selector:y,classNamesPrefix:m,classNames:c,classes:t,unstyled:l,className:o,rootSelector:s,props:n,stylesCtx:r}),style:TR({theme:h,themeName:g,selector:y,options:C,props:n,stylesCtx:r,rootSelector:s,styles:u,style:i,vars:d,varsResolver:f})})}function V(e,t,n){var s;const r=Nt(),o=(s=r.components[e])==null?void 0:s.defaultProps,i=typeof o=="function"?o(r):o;return{...t,...i,...rs(n)}}function w0(e){return ct(e).reduce((t,n)=>e[n]!==void 0?`${t}${h2(n)}:${e[n]};`:t,"").trim()}function PR({selector:e,styles:t,media:n}){const r=t?w0(t):"",o=Array.isArray(n)?n.map(i=>`@media${i.query}{${e}{${w0(i.styles)}}}`):[];return`${r?`${e}{${r}}`:""}${o.join("")}`.trim()}function Ea({selector:e,styles:t,media:n}){const r=Um();return b.createElement("style",{"data-mantine-styles":"inline",nonce:r==null?void 0:r(),dangerouslySetInnerHTML:{__html:PR({selector:e,styles:t,media:n})}})}function jo(e){const{m:t,mx:n,my:r,mt:o,mb:i,ml:s,mr:l,p:c,px:u,py:d,pt:f,pb:h,pl:m,pr:g,bg:y,c:C,opacity:v,ff:x,fz:w,fw:S,lts:E,ta:j,lh:T,fs:P,tt:R,td:I,w:O,miw:D,maw:A,h:M,mih:B,mah:F,bgsz:_,bgp:k,bgr:z,bga:q,pos:Q,top:re,left:Ce,bottom:Re,right:Oe,inset:ve,display:Ve,flex:Je,hiddenFrom:at,visibleFrom:Ft,lightHidden:pe,darkHidden:Fe,...Ne}=e;return{styleProps:rs({m:t,mx:n,my:r,mt:o,mb:i,ml:s,mr:l,p:c,px:u,py:d,pt:f,pb:h,pl:m,pr:g,bg:y,c:C,opacity:v,ff:x,fz:w,fw:S,lts:E,ta:j,lh:T,fs:P,tt:R,td:I,w:O,miw:D,maw:A,h:M,mih:B,mah:F,bgsz:_,bgp:k,bgr:z,bga:q,pos:Q,top:re,left:Ce,bottom:Re,right:Oe,inset:ve,display:Ve,flex:Je,hiddenFrom:at,visibleFrom:Ft,lightHidden:pe,darkHidden:Fe}),rest:Ne}}const kR={m:{type:"spacing",property:"margin"},mt:{type:"spacing",property:"marginTop"},mb:{type:"spacing",property:"marginBottom"},ml:{type:"spacing",property:"marginLeft"},mr:{type:"spacing",property:"marginRight"},mx:{type:"spacing",property:["marginRight","marginLeft"]},my:{type:"spacing",property:["marginTop","marginBottom"]},p:{type:"spacing",property:"padding"},pt:{type:"spacing",property:"paddingTop"},pb:{type:"spacing",property:"paddingBottom"},pl:{type:"spacing",property:"paddingLeft"},pr:{type:"spacing",property:"paddingRight"},px:{type:"spacing",property:["paddingRight","paddingLeft"]},py:{type:"spacing",property:["paddingTop","paddingBottom"]},bg:{type:"color",property:"background"},c:{type:"textColor",property:"color"},opacity:{type:"identity",property:"opacity"},ff:{type:"fontFamily",property:"fontFamily"},fz:{type:"fontSize",property:"fontSize"},fw:{type:"identity",property:"fontWeight"},lts:{type:"size",property:"letterSpacing"},ta:{type:"identity",property:"textAlign"},lh:{type:"lineHeight",property:"lineHeight"},fs:{type:"identity",property:"fontStyle"},tt:{type:"identity",property:"textTransform"},td:{type:"identity",property:"textDecoration"},w:{type:"spacing",property:"width"},miw:{type:"spacing",property:"minWidth"},maw:{type:"spacing",property:"maxWidth"},h:{type:"spacing",property:"height"},mih:{type:"spacing",property:"minHeight"},mah:{type:"spacing",property:"maxHeight"},bgsz:{type:"size",property:"backgroundSize"},bgp:{type:"identity",property:"backgroundPosition"},bgr:{type:"identity",property:"backgroundRepeat"},bga:{type:"identity",property:"backgroundAttachment"},pos:{type:"identity",property:"position"},top:{type:"identity",property:"top"},left:{type:"size",property:"left"},bottom:{type:"size",property:"bottom"},right:{type:"size",property:"right"},inset:{type:"size",property:"inset"},display:{type:"identity",property:"display"},flex:{type:"identity",property:"flex"}};function SS(e,t){const n=Jr({color:e,theme:t});return n.color==="dimmed"?"var(--mantine-color-dimmed)":n.color==="bright"?"var(--mantine-color-bright)":n.variable?`var(${n.variable})`:n.color}function RR(e,t){const n=Jr({color:e,theme:t});return n.isThemeColor&&n.shade===void 0?`var(--mantine-color-${n.color}-text)`:SS(e,t)}const S0={text:"var(--mantine-font-family)",mono:"var(--mantine-font-family-monospace)",heading:"var(--mantine-font-family-headings)"};function DR(e){return typeof e=="string"&&e in S0?S0[e]:e}function IR(e,t){return typeof e=="string"&&e in t.fontSizes?`var(--mantine-font-size-${e})`:typeof e=="number"||typeof e=="string"?$(e):e}function _R(e){return e}function AR(e,t){return typeof e=="string"&&e in t.lineHeights?`var(--mantine-line-height-${e})`:e}function NR(e){return typeof e=="number"?$(e):e}function OR(e,t){if(typeof e=="number")return $(e);if(typeof e=="string"){const n=e.replace("-","");if(!(n in t.spacing))return $(e);const r=`--mantine-spacing-${n}`;return e.startsWith("-")?`calc(var(${r}) * -1)`:`var(${r})`}return e}const fh={color:SS,textColor:RR,fontSize:IR,spacing:OR,identity:_R,size:NR,lineHeight:AR,fontFamily:DR};function b0(e){return e.replace("(min-width: ","").replace("em)","")}function MR({media:e,...t}){const r=Object.keys(e).sort((o,i)=>Number(b0(o))-Number(b0(i))).map(o=>({query:o,styles:e[o]}));return{...t,media:r}}function LR(e){if(typeof e!="object"||e===null)return!1;const t=Object.keys(e);return!(t.length===1&&t[0]==="base")}function $R(e){return typeof e=="object"&&e!==null?"base"in e?e.base:void 0:e}function FR(e){return typeof e=="object"&&e!==null?ct(e).filter(t=>t!=="base"):[]}function zR(e,t){return typeof e=="object"&&e!==null&&t in e?e[t]:e}function bS({styleProps:e,data:t,theme:n}){return MR(ct(e).reduce((r,o)=>{if(o==="hiddenFrom"||o==="visibleFrom")return r;const i=t[o],s=Array.isArray(i.property)?i.property:[i.property],l=$R(e[o]);if(!LR(e[o]))return s.forEach(u=>{r.inlineStyles[u]=fh[i.type](l,n)}),r;r.hasResponsiveStyles=!0;const c=FR(e[o]);return s.forEach(u=>{l&&(r.styles[u]=fh[i.type](l,n)),c.forEach(d=>{const f=`(min-width: ${n.breakpoints[d]})`;r.media[f]={...r.media[f],[u]:fh[i.type](zR(e[o],d),n)}})}),r},{hasResponsiveStyles:!1,styles:{},inlineStyles:{},media:{}}))}function tc(){return`__m__-${p.useId().replace(/:/g,"")}`}function CS(e,t){return Array.isArray(e)?[...e].reduce((n,r)=>({...n,...CS(r,t)}),{}):typeof e=="function"?e(t):e??{}}function jS(e){return e.startsWith("data-")?e:`data-${e}`}function BR(e){return Object.keys(e).reduce((t,n)=>{const r=e[n];return r===void 0||r===""||r===!1||r===null||(t[jS(n)]=e[n]),t},{})}function ES(e){return e?typeof e=="string"?{[jS(e)]:!0}:Array.isArray(e)?[...e].reduce((t,n)=>({...t,...ES(n)}),{}):BR(e):null}function sp(e,t){return Array.isArray(e)?[...e].reduce((n,r)=>({...n,...sp(r,t)}),{}):typeof e=="function"?e(t):e??{}}function UR({theme:e,style:t,vars:n,styleProps:r}){const o=sp(t,e),i=sp(n,e);return{...o,...i,...r}}const TS=p.forwardRef(({component:e,style:t,__vars:n,className:r,variant:o,mod:i,size:s,hiddenFrom:l,visibleFrom:c,lightHidden:u,darkHidden:d,renderRoot:f,...h},m)=>{const g=Nt(),y=e||"div",{styleProps:C,rest:v}=jo(h),x=tc(),w=bS({styleProps:C,theme:g,data:kR}),S={ref:m,style:UR({theme:g,style:t,vars:n,styleProps:w.inlineStyles}),className:Ye(r,{[x]:w.hasResponsiveStyles,"mantine-light-hidden":u,"mantine-dark-hidden":d,[`mantine-hidden-from-${l}`]:l,[`mantine-visible-from-${c}`]:c}),"data-variant":o,"data-size":sS(s)?void 0:s||void 0,...ES(i),...v};return b.createElement(b.Fragment,null,w.hasResponsiveStyles&&b.createElement(Ea,{selector:`.${x}`,styles:w.styles,media:w.media}),typeof f=="function"?f(S):b.createElement(y,{...S}))});TS.displayName="@mantine/core/Box";const W=TS;function PS(e){return e}function G(e){const t=p.forwardRef(e);return t.extend=PS,t}function cn(e){const t=p.forwardRef(e);return t.extend=PS,t}const VR=p.createContext({dir:"ltr",toggleDirection:()=>{},setDirection:()=>{}});function Ta(){return p.useContext(VR)}var kS={exports:{}},Qn={},RS={exports:{}},DS={};/**
61
- * @license React
62
- * scheduler.production.min.js
63
- *
64
- * Copyright (c) Facebook, Inc. and its affiliates.
65
- *
66
- * This source code is licensed under the MIT license found in the
67
- * LICENSE file in the root directory of this source tree.
68
- */(function(e){function t(k,z){var q=k.length;k.push(z);e:for(;0<q;){var Q=q-1>>>1,re=k[Q];if(0<o(re,z))k[Q]=z,k[q]=re,q=Q;else break e}}function n(k){return k.length===0?null:k[0]}function r(k){if(k.length===0)return null;var z=k[0],q=k.pop();if(q!==z){k[0]=q;e:for(var Q=0,re=k.length,Ce=re>>>1;Q<Ce;){var Re=2*(Q+1)-1,Oe=k[Re],ve=Re+1,Ve=k[ve];if(0>o(Oe,q))ve<re&&0>o(Ve,Oe)?(k[Q]=Ve,k[ve]=q,Q=ve):(k[Q]=Oe,k[Re]=q,Q=Re);else if(ve<re&&0>o(Ve,q))k[Q]=Ve,k[ve]=q,Q=ve;else break e}}return z}function o(k,z){var q=k.sortIndex-z.sortIndex;return q!==0?q:k.id-z.id}if(typeof performance=="object"&&typeof performance.now=="function"){var i=performance;e.unstable_now=function(){return i.now()}}else{var s=Date,l=s.now();e.unstable_now=function(){return s.now()-l}}var c=[],u=[],d=1,f=null,h=3,m=!1,g=!1,y=!1,C=typeof setTimeout=="function"?setTimeout:null,v=typeof clearTimeout=="function"?clearTimeout:null,x=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function w(k){for(var z=n(u);z!==null;){if(z.callback===null)r(u);else if(z.startTime<=k)r(u),z.sortIndex=z.expirationTime,t(c,z);else break;z=n(u)}}function S(k){if(y=!1,w(k),!g)if(n(c)!==null)g=!0,F(E);else{var z=n(u);z!==null&&_(S,z.startTime-k)}}function E(k,z){g=!1,y&&(y=!1,v(P),P=-1),m=!0;var q=h;try{for(w(z),f=n(c);f!==null&&(!(f.expirationTime>z)||k&&!O());){var Q=f.callback;if(typeof Q=="function"){f.callback=null,h=f.priorityLevel;var re=Q(f.expirationTime<=z);z=e.unstable_now(),typeof re=="function"?f.callback=re:f===n(c)&&r(c),w(z)}else r(c);f=n(c)}if(f!==null)var Ce=!0;else{var Re=n(u);Re!==null&&_(S,Re.startTime-z),Ce=!1}return Ce}finally{f=null,h=q,m=!1}}var j=!1,T=null,P=-1,R=5,I=-1;function O(){return!(e.unstable_now()-I<R)}function D(){if(T!==null){var k=e.unstable_now();I=k;var z=!0;try{z=T(!0,k)}finally{z?A():(j=!1,T=null)}}else j=!1}var A;if(typeof x=="function")A=function(){x(D)};else if(typeof MessageChannel<"u"){var M=new MessageChannel,B=M.port2;M.port1.onmessage=D,A=function(){B.postMessage(null)}}else A=function(){C(D,0)};function F(k){T=k,j||(j=!0,A())}function _(k,z){P=C(function(){k(e.unstable_now())},z)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(k){k.callback=null},e.unstable_continueExecution=function(){g||m||(g=!0,F(E))},e.unstable_forceFrameRate=function(k){0>k||125<k?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):R=0<k?Math.floor(1e3/k):5},e.unstable_getCurrentPriorityLevel=function(){return h},e.unstable_getFirstCallbackNode=function(){return n(c)},e.unstable_next=function(k){switch(h){case 1:case 2:case 3:var z=3;break;default:z=h}var q=h;h=z;try{return k()}finally{h=q}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(k,z){switch(k){case 1:case 2:case 3:case 4:case 5:break;default:k=3}var q=h;h=k;try{return z()}finally{h=q}},e.unstable_scheduleCallback=function(k,z,q){var Q=e.unstable_now();switch(typeof q=="object"&&q!==null?(q=q.delay,q=typeof q=="number"&&0<q?Q+q:Q):q=Q,k){case 1:var re=-1;break;case 2:re=250;break;case 5:re=1073741823;break;case 4:re=1e4;break;default:re=5e3}return re=q+re,k={id:d++,callback:z,priorityLevel:k,startTime:q,expirationTime:re,sortIndex:-1},q>Q?(k.sortIndex=q,t(u,k),n(c)===null&&k===n(u)&&(y?(v(P),P=-1):y=!0,_(S,q-Q))):(k.sortIndex=re,t(c,k),g||m||(g=!0,F(E))),k},e.unstable_shouldYield=O,e.unstable_wrapCallback=function(k){var z=h;return function(){var q=h;h=z;try{return k.apply(this,arguments)}finally{h=q}}}})(DS);RS.exports=DS;var HR=RS.exports;/**
69
- * @license React
70
- * react-dom.production.min.js
71
- *
72
- * Copyright (c) Facebook, Inc. and its affiliates.
73
- *
74
- * This source code is licensed under the MIT license found in the
75
- * LICENSE file in the root directory of this source tree.
76
- */var IS=p,qn=HR;function K(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n<arguments.length;n++)t+="&args[]="+encodeURIComponent(arguments[n]);return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var _S=new Set,El={};function os(e,t){ra(e,t),ra(e+"Capture",t)}function ra(e,t){for(El[e]=t,e=0;e<t.length;e++)_S.add(t[e])}var ho=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),ap=Object.prototype.hasOwnProperty,WR=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,C0={},j0={};function qR(e){return ap.call(j0,e)?!0:ap.call(C0,e)?!1:WR.test(e)?j0[e]=!0:(C0[e]=!0,!1)}function GR(e,t,n,r){if(n!==null&&n.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function QR(e,t,n,r){if(t===null||typeof t>"u"||GR(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function Sn(e,t,n,r,o,i,s){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=o,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=i,this.removeEmptyString=s}var Zt={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){Zt[e]=new Sn(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];Zt[t]=new Sn(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){Zt[e]=new Sn(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){Zt[e]=new Sn(e,2,!1,e,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){Zt[e]=new Sn(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){Zt[e]=new Sn(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){Zt[e]=new Sn(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){Zt[e]=new Sn(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){Zt[e]=new Sn(e,5,!1,e.toLowerCase(),null,!1,!1)});var qm=/[\-:]([a-z])/g;function Gm(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(qm,Gm);Zt[t]=new Sn(t,1,!1,e,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(qm,Gm);Zt[t]=new Sn(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(qm,Gm);Zt[t]=new Sn(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){Zt[e]=new Sn(e,1,!1,e.toLowerCase(),null,!1,!1)});Zt.xlinkHref=new Sn("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){Zt[e]=new Sn(e,1,!1,e.toLowerCase(),null,!0,!0)});function Qm(e,t,n,r){var o=Zt.hasOwnProperty(t)?Zt[t]:null;(o!==null?o.type!==0:r||!(2<t.length)||t[0]!=="o"&&t[0]!=="O"||t[1]!=="n"&&t[1]!=="N")&&(QR(t,n,o,r)&&(n=null),r||o===null?qR(t)&&(n===null?e.removeAttribute(t):e.setAttribute(t,""+n)):o.mustUseProperty?e[o.propertyName]=n===null?o.type===3?!1:"":n:(t=o.attributeName,r=o.attributeNamespace,n===null?e.removeAttribute(t):(o=o.type,n=o===3||o===4&&n===!0?"":""+n,r?e.setAttributeNS(r,t,n):e.setAttribute(t,n))))}var Eo=IS.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,Vc=Symbol.for("react.element"),_s=Symbol.for("react.portal"),As=Symbol.for("react.fragment"),Km=Symbol.for("react.strict_mode"),lp=Symbol.for("react.profiler"),AS=Symbol.for("react.provider"),NS=Symbol.for("react.context"),Ym=Symbol.for("react.forward_ref"),cp=Symbol.for("react.suspense"),up=Symbol.for("react.suspense_list"),Xm=Symbol.for("react.memo"),Bo=Symbol.for("react.lazy"),OS=Symbol.for("react.offscreen"),E0=Symbol.iterator;function Ua(e){return e===null||typeof e!="object"?null:(e=E0&&e[E0]||e["@@iterator"],typeof e=="function"?e:null)}var jt=Object.assign,hh;function sl(e){if(hh===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);hh=t&&t[1]||""}return`
77
- `+hh+e}var ph=!1;function mh(e,t){if(!e||ph)return"";ph=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(t)if(t=function(){throw Error()},Object.defineProperty(t.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(t,[])}catch(u){var r=u}Reflect.construct(e,[],t)}else{try{t.call()}catch(u){r=u}e.call(t.prototype)}else{try{throw Error()}catch(u){r=u}e()}}catch(u){if(u&&r&&typeof u.stack=="string"){for(var o=u.stack.split(`
78
- `),i=r.stack.split(`
79
- `),s=o.length-1,l=i.length-1;1<=s&&0<=l&&o[s]!==i[l];)l--;for(;1<=s&&0<=l;s--,l--)if(o[s]!==i[l]){if(s!==1||l!==1)do if(s--,l--,0>l||o[s]!==i[l]){var c=`
80
- `+o[s].replace(" at new "," at ");return e.displayName&&c.includes("<anonymous>")&&(c=c.replace("<anonymous>",e.displayName)),c}while(1<=s&&0<=l);break}}}finally{ph=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?sl(e):""}function KR(e){switch(e.tag){case 5:return sl(e.type);case 16:return sl("Lazy");case 13:return sl("Suspense");case 19:return sl("SuspenseList");case 0:case 2:case 15:return e=mh(e.type,!1),e;case 11:return e=mh(e.type.render,!1),e;case 1:return e=mh(e.type,!0),e;default:return""}}function dp(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case As:return"Fragment";case _s:return"Portal";case lp:return"Profiler";case Km:return"StrictMode";case cp:return"Suspense";case up:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case NS:return(e.displayName||"Context")+".Consumer";case AS:return(e._context.displayName||"Context")+".Provider";case Ym:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Xm:return t=e.displayName||null,t!==null?t:dp(e.type)||"Memo";case Bo:t=e._payload,e=e._init;try{return dp(e(t))}catch{}}return null}function YR(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return dp(t);case 8:return t===Km?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function ui(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function MS(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function XR(e){var t=MS(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var o=n.get,i=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return o.call(this)},set:function(s){r=""+s,i.call(this,s)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(s){r=""+s},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Hc(e){e._valueTracker||(e._valueTracker=XR(e))}function LS(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=MS(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function $u(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function fp(e,t){var n=t.checked;return jt({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function T0(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=ui(t.value!=null?t.value:n),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function $S(e,t){t=t.checked,t!=null&&Qm(e,"checked",t,!1)}function hp(e,t){$S(e,t);var n=ui(t.value),r=t.type;if(n!=null)r==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if(r==="submit"||r==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?pp(e,t.type,n):t.hasOwnProperty("defaultValue")&&pp(e,t.type,ui(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function P0(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!(r!=="submit"&&r!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,n!==""&&(e.name=n)}function pp(e,t,n){(t!=="number"||$u(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var al=Array.isArray;function Qs(e,t,n,r){if(e=e.options,t){t={};for(var o=0;o<n.length;o++)t["$"+n[o]]=!0;for(n=0;n<e.length;n++)o=t.hasOwnProperty("$"+e[n].value),e[n].selected!==o&&(e[n].selected=o),o&&r&&(e[n].defaultSelected=!0)}else{for(n=""+ui(n),t=null,o=0;o<e.length;o++){if(e[o].value===n){e[o].selected=!0,r&&(e[o].defaultSelected=!0);return}t!==null||e[o].disabled||(t=e[o])}t!==null&&(t.selected=!0)}}function mp(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error(K(91));return jt({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function k0(e,t){var n=t.value;if(n==null){if(n=t.children,t=t.defaultValue,n!=null){if(t!=null)throw Error(K(92));if(al(n)){if(1<n.length)throw Error(K(93));n=n[0]}t=n}t==null&&(t=""),n=t}e._wrapperState={initialValue:ui(n)}}function FS(e,t){var n=ui(t.value),r=ui(t.defaultValue);n!=null&&(n=""+n,n!==e.value&&(e.value=n),t.defaultValue==null&&e.defaultValue!==n&&(e.defaultValue=n)),r!=null&&(e.defaultValue=""+r)}function R0(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==""&&t!==null&&(e.value=t)}function zS(e){switch(e){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function gp(e,t){return e==null||e==="http://www.w3.org/1999/xhtml"?zS(t):e==="http://www.w3.org/2000/svg"&&t==="foreignObject"?"http://www.w3.org/1999/xhtml":e}var Wc,BS=function(e){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(t,n,r,o){MSApp.execUnsafeLocalFunction(function(){return e(t,n,r,o)})}:e}(function(e,t){if(e.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in e)e.innerHTML=t;else{for(Wc=Wc||document.createElement("div"),Wc.innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=Wc.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Tl(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var hl={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},JR=["Webkit","ms","Moz","O"];Object.keys(hl).forEach(function(e){JR.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),hl[t]=hl[e]})});function US(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||hl.hasOwnProperty(e)&&hl[e]?(""+t).trim():t+"px"}function VS(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,o=US(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,o):e[n]=o}}var ZR=jt({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function yp(e,t){if(t){if(ZR[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(K(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(K(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(K(61))}if(t.style!=null&&typeof t.style!="object")throw Error(K(62))}}function vp(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var xp=null;function Jm(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var wp=null,Ks=null,Ys=null;function D0(e){if(e=oc(e)){if(typeof wp!="function")throw Error(K(280));var t=e.stateNode;t&&(t=Fd(t),wp(e.stateNode,e.type,t))}}function HS(e){Ks?Ys?Ys.push(e):Ys=[e]:Ks=e}function WS(){if(Ks){var e=Ks,t=Ys;if(Ys=Ks=null,D0(e),t)for(e=0;e<t.length;e++)D0(t[e])}}function qS(e,t){return e(t)}function GS(){}var gh=!1;function QS(e,t,n){if(gh)return e(t,n);gh=!0;try{return qS(e,t,n)}finally{gh=!1,(Ks!==null||Ys!==null)&&(GS(),WS())}}function Pl(e,t){var n=e.stateNode;if(n===null)return null;var r=Fd(n);if(r===null)return null;n=r[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(r=!r.disabled)||(e=e.type,r=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!r;break e;default:e=!1}if(e)return null;if(n&&typeof n!="function")throw Error(K(231,t,typeof n));return n}var Sp=!1;if(ho)try{var Va={};Object.defineProperty(Va,"passive",{get:function(){Sp=!0}}),window.addEventListener("test",Va,Va),window.removeEventListener("test",Va,Va)}catch{Sp=!1}function eD(e,t,n,r,o,i,s,l,c){var u=Array.prototype.slice.call(arguments,3);try{t.apply(n,u)}catch(d){this.onError(d)}}var pl=!1,Fu=null,zu=!1,bp=null,tD={onError:function(e){pl=!0,Fu=e}};function nD(e,t,n,r,o,i,s,l,c){pl=!1,Fu=null,eD.apply(tD,arguments)}function rD(e,t,n,r,o,i,s,l,c){if(nD.apply(this,arguments),pl){if(pl){var u=Fu;pl=!1,Fu=null}else throw Error(K(198));zu||(zu=!0,bp=u)}}function is(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function KS(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function I0(e){if(is(e)!==e)throw Error(K(188))}function oD(e){var t=e.alternate;if(!t){if(t=is(e),t===null)throw Error(K(188));return t!==e?null:e}for(var n=e,r=t;;){var o=n.return;if(o===null)break;var i=o.alternate;if(i===null){if(r=o.return,r!==null){n=r;continue}break}if(o.child===i.child){for(i=o.child;i;){if(i===n)return I0(o),e;if(i===r)return I0(o),t;i=i.sibling}throw Error(K(188))}if(n.return!==r.return)n=o,r=i;else{for(var s=!1,l=o.child;l;){if(l===n){s=!0,n=o,r=i;break}if(l===r){s=!0,r=o,n=i;break}l=l.sibling}if(!s){for(l=i.child;l;){if(l===n){s=!0,n=i,r=o;break}if(l===r){s=!0,r=i,n=o;break}l=l.sibling}if(!s)throw Error(K(189))}}if(n.alternate!==r)throw Error(K(190))}if(n.tag!==3)throw Error(K(188));return n.stateNode.current===n?e:t}function YS(e){return e=oD(e),e!==null?XS(e):null}function XS(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=XS(e);if(t!==null)return t;e=e.sibling}return null}var JS=qn.unstable_scheduleCallback,_0=qn.unstable_cancelCallback,iD=qn.unstable_shouldYield,sD=qn.unstable_requestPaint,_t=qn.unstable_now,aD=qn.unstable_getCurrentPriorityLevel,Zm=qn.unstable_ImmediatePriority,ZS=qn.unstable_UserBlockingPriority,Bu=qn.unstable_NormalPriority,lD=qn.unstable_LowPriority,eb=qn.unstable_IdlePriority,Od=null,Gr=null;function cD(e){if(Gr&&typeof Gr.onCommitFiberRoot=="function")try{Gr.onCommitFiberRoot(Od,e,void 0,(e.current.flags&128)===128)}catch{}}var Er=Math.clz32?Math.clz32:fD,uD=Math.log,dD=Math.LN2;function fD(e){return e>>>=0,e===0?32:31-(uD(e)/dD|0)|0}var qc=64,Gc=4194304;function ll(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function Uu(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,o=e.suspendedLanes,i=e.pingedLanes,s=n&268435455;if(s!==0){var l=s&~o;l!==0?r=ll(l):(i&=s,i!==0&&(r=ll(i)))}else s=n&~o,s!==0?r=ll(s):i!==0&&(r=ll(i));if(r===0)return 0;if(t!==0&&t!==r&&!(t&o)&&(o=r&-r,i=t&-t,o>=i||o===16&&(i&4194240)!==0))return t;if(r&4&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0<t;)n=31-Er(t),o=1<<n,r|=e[n],t&=~o;return r}function hD(e,t){switch(e){case 1:case 2:case 4:return t+250;case 8:case 16:case 32:case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function pD(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,o=e.expirationTimes,i=e.pendingLanes;0<i;){var s=31-Er(i),l=1<<s,c=o[s];c===-1?(!(l&n)||l&r)&&(o[s]=hD(l,t)):c<=t&&(e.expiredLanes|=l),i&=~l}}function Cp(e){return e=e.pendingLanes&-1073741825,e!==0?e:e&1073741824?1073741824:0}function tb(){var e=qc;return qc<<=1,!(qc&4194240)&&(qc=64),e}function yh(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function nc(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Er(t),e[t]=n}function mD(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0<n;){var o=31-Er(n),i=1<<o;t[o]=0,r[o]=-1,e[o]=-1,n&=~i}}function eg(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-Er(n),o=1<<r;o&t|e[r]&t&&(e[r]|=t),n&=~o}}var Ke=0;function nb(e){return e&=-e,1<e?4<e?e&268435455?16:536870912:4:1}var rb,tg,ob,ib,sb,jp=!1,Qc=[],ei=null,ti=null,ni=null,kl=new Map,Rl=new Map,qo=[],gD="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset submit".split(" ");function A0(e,t){switch(e){case"focusin":case"focusout":ei=null;break;case"dragenter":case"dragleave":ti=null;break;case"mouseover":case"mouseout":ni=null;break;case"pointerover":case"pointerout":kl.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":Rl.delete(t.pointerId)}}function Ha(e,t,n,r,o,i){return e===null||e.nativeEvent!==i?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:i,targetContainers:[o]},t!==null&&(t=oc(t),t!==null&&tg(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,o!==null&&t.indexOf(o)===-1&&t.push(o),e)}function yD(e,t,n,r,o){switch(t){case"focusin":return ei=Ha(ei,e,t,n,r,o),!0;case"dragenter":return ti=Ha(ti,e,t,n,r,o),!0;case"mouseover":return ni=Ha(ni,e,t,n,r,o),!0;case"pointerover":var i=o.pointerId;return kl.set(i,Ha(kl.get(i)||null,e,t,n,r,o)),!0;case"gotpointercapture":return i=o.pointerId,Rl.set(i,Ha(Rl.get(i)||null,e,t,n,r,o)),!0}return!1}function ab(e){var t=Oi(e.target);if(t!==null){var n=is(t);if(n!==null){if(t=n.tag,t===13){if(t=KS(n),t!==null){e.blockedOn=t,sb(e.priority,function(){ob(n)});return}}else if(t===3&&n.stateNode.current.memoizedState.isDehydrated){e.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}e.blockedOn=null}function yu(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=Ep(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);xp=r,n.target.dispatchEvent(r),xp=null}else return t=oc(n),t!==null&&tg(t),e.blockedOn=n,!1;t.shift()}return!0}function N0(e,t,n){yu(e)&&n.delete(t)}function vD(){jp=!1,ei!==null&&yu(ei)&&(ei=null),ti!==null&&yu(ti)&&(ti=null),ni!==null&&yu(ni)&&(ni=null),kl.forEach(N0),Rl.forEach(N0)}function Wa(e,t){e.blockedOn===t&&(e.blockedOn=null,jp||(jp=!0,qn.unstable_scheduleCallback(qn.unstable_NormalPriority,vD)))}function Dl(e){function t(o){return Wa(o,e)}if(0<Qc.length){Wa(Qc[0],e);for(var n=1;n<Qc.length;n++){var r=Qc[n];r.blockedOn===e&&(r.blockedOn=null)}}for(ei!==null&&Wa(ei,e),ti!==null&&Wa(ti,e),ni!==null&&Wa(ni,e),kl.forEach(t),Rl.forEach(t),n=0;n<qo.length;n++)r=qo[n],r.blockedOn===e&&(r.blockedOn=null);for(;0<qo.length&&(n=qo[0],n.blockedOn===null);)ab(n),n.blockedOn===null&&qo.shift()}var Xs=Eo.ReactCurrentBatchConfig,Vu=!0;function xD(e,t,n,r){var o=Ke,i=Xs.transition;Xs.transition=null;try{Ke=1,ng(e,t,n,r)}finally{Ke=o,Xs.transition=i}}function wD(e,t,n,r){var o=Ke,i=Xs.transition;Xs.transition=null;try{Ke=4,ng(e,t,n,r)}finally{Ke=o,Xs.transition=i}}function ng(e,t,n,r){if(Vu){var o=Ep(e,t,n,r);if(o===null)Ph(e,t,r,Hu,n),A0(e,r);else if(yD(o,e,t,n,r))r.stopPropagation();else if(A0(e,r),t&4&&-1<gD.indexOf(e)){for(;o!==null;){var i=oc(o);if(i!==null&&rb(i),i=Ep(e,t,n,r),i===null&&Ph(e,t,r,Hu,n),i===o)break;o=i}o!==null&&r.stopPropagation()}else Ph(e,t,r,null,n)}}var Hu=null;function Ep(e,t,n,r){if(Hu=null,e=Jm(r),e=Oi(e),e!==null)if(t=is(e),t===null)e=null;else if(n=t.tag,n===13){if(e=KS(t),e!==null)return e;e=null}else if(n===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null);return Hu=e,null}function lb(e){switch(e){case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 1;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(aD()){case Zm:return 1;case ZS:return 4;case Bu:case lD:return 16;case eb:return 536870912;default:return 16}default:return 16}}var Ko=null,rg=null,vu=null;function cb(){if(vu)return vu;var e,t=rg,n=t.length,r,o="value"in Ko?Ko.value:Ko.textContent,i=o.length;for(e=0;e<n&&t[e]===o[e];e++);var s=n-e;for(r=1;r<=s&&t[n-r]===o[i-r];r++);return vu=o.slice(e,1<r?1-r:void 0)}function xu(e){var t=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function Kc(){return!0}function O0(){return!1}function Kn(e){function t(n,r,o,i,s){this._reactName=n,this._targetInst=o,this.type=r,this.nativeEvent=i,this.target=s,this.currentTarget=null;for(var l in e)e.hasOwnProperty(l)&&(n=e[l],this[l]=n?n(i):i[l]);return this.isDefaultPrevented=(i.defaultPrevented!=null?i.defaultPrevented:i.returnValue===!1)?Kc:O0,this.isPropagationStopped=O0,this}return jt(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var n=this.nativeEvent;n&&(n.preventDefault?n.preventDefault():typeof n.returnValue!="unknown"&&(n.returnValue=!1),this.isDefaultPrevented=Kc)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=Kc)},persist:function(){},isPersistent:Kc}),t}var Pa={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},og=Kn(Pa),rc=jt({},Pa,{view:0,detail:0}),SD=Kn(rc),vh,xh,qa,Md=jt({},rc,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:ig,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==qa&&(qa&&e.type==="mousemove"?(vh=e.screenX-qa.screenX,xh=e.screenY-qa.screenY):xh=vh=0,qa=e),vh)},movementY:function(e){return"movementY"in e?e.movementY:xh}}),M0=Kn(Md),bD=jt({},Md,{dataTransfer:0}),CD=Kn(bD),jD=jt({},rc,{relatedTarget:0}),wh=Kn(jD),ED=jt({},Pa,{animationName:0,elapsedTime:0,pseudoElement:0}),TD=Kn(ED),PD=jt({},Pa,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),kD=Kn(PD),RD=jt({},Pa,{data:0}),L0=Kn(RD),DD={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},ID={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},_D={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function AD(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=_D[e])?!!t[e]:!1}function ig(){return AD}var ND=jt({},rc,{key:function(e){if(e.key){var t=DD[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=xu(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?ID[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:ig,charCode:function(e){return e.type==="keypress"?xu(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?xu(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),OD=Kn(ND),MD=jt({},Md,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),$0=Kn(MD),LD=jt({},rc,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:ig}),$D=Kn(LD),FD=jt({},Pa,{propertyName:0,elapsedTime:0,pseudoElement:0}),zD=Kn(FD),BD=jt({},Md,{deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0}),UD=Kn(BD),VD=[9,13,27,32],sg=ho&&"CompositionEvent"in window,ml=null;ho&&"documentMode"in document&&(ml=document.documentMode);var HD=ho&&"TextEvent"in window&&!ml,ub=ho&&(!sg||ml&&8<ml&&11>=ml),F0=" ",z0=!1;function db(e,t){switch(e){case"keyup":return VD.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function fb(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Ns=!1;function WD(e,t){switch(e){case"compositionend":return fb(t);case"keypress":return t.which!==32?null:(z0=!0,F0);case"textInput":return e=t.data,e===F0&&z0?null:e;default:return null}}function qD(e,t){if(Ns)return e==="compositionend"||!sg&&db(e,t)?(e=cb(),vu=rg=Ko=null,Ns=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case"compositionend":return ub&&t.locale!=="ko"?null:t.data;default:return null}}var GD={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function B0(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!GD[e.type]:t==="textarea"}function hb(e,t,n,r){HS(r),t=Wu(t,"onChange"),0<t.length&&(n=new og("onChange","change",null,n,r),e.push({event:n,listeners:t}))}var gl=null,Il=null;function QD(e){jb(e,0)}function Ld(e){var t=Ls(e);if(LS(t))return e}function KD(e,t){if(e==="change")return t}var pb=!1;if(ho){var Sh;if(ho){var bh="oninput"in document;if(!bh){var U0=document.createElement("div");U0.setAttribute("oninput","return;"),bh=typeof U0.oninput=="function"}Sh=bh}else Sh=!1;pb=Sh&&(!document.documentMode||9<document.documentMode)}function V0(){gl&&(gl.detachEvent("onpropertychange",mb),Il=gl=null)}function mb(e){if(e.propertyName==="value"&&Ld(Il)){var t=[];hb(t,Il,e,Jm(e)),QS(QD,t)}}function YD(e,t,n){e==="focusin"?(V0(),gl=t,Il=n,gl.attachEvent("onpropertychange",mb)):e==="focusout"&&V0()}function XD(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return Ld(Il)}function JD(e,t){if(e==="click")return Ld(t)}function ZD(e,t){if(e==="input"||e==="change")return Ld(t)}function eI(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var kr=typeof Object.is=="function"?Object.is:eI;function _l(e,t){if(kr(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var o=n[r];if(!ap.call(t,o)||!kr(e[o],t[o]))return!1}return!0}function H0(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function W0(e,t){var n=H0(e);e=0;for(var r;n;){if(n.nodeType===3){if(r=e+n.textContent.length,e<=t&&r>=t)return{node:n,offset:t-e};e=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=H0(n)}}function gb(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?gb(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function yb(){for(var e=window,t=$u();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=$u(e.document)}return t}function ag(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function tI(e){var t=yb(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&gb(n.ownerDocument.documentElement,n)){if(r!==null&&ag(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var o=n.textContent.length,i=Math.min(r.start,o);r=r.end===void 0?i:Math.min(r.end,o),!e.extend&&i>r&&(o=r,r=i,i=o),o=W0(n,i);var s=W0(n,r);o&&s&&(e.rangeCount!==1||e.anchorNode!==o.node||e.anchorOffset!==o.offset||e.focusNode!==s.node||e.focusOffset!==s.offset)&&(t=t.createRange(),t.setStart(o.node,o.offset),e.removeAllRanges(),i>r?(e.addRange(t),e.extend(s.node,s.offset)):(t.setEnd(s.node,s.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n<t.length;n++)e=t[n],e.element.scrollLeft=e.left,e.element.scrollTop=e.top}}var nI=ho&&"documentMode"in document&&11>=document.documentMode,Os=null,Tp=null,yl=null,Pp=!1;function q0(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Pp||Os==null||Os!==$u(r)||(r=Os,"selectionStart"in r&&ag(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),yl&&_l(yl,r)||(yl=r,r=Wu(Tp,"onSelect"),0<r.length&&(t=new og("onSelect","select",null,t,n),e.push({event:t,listeners:r}),t.target=Os)))}function Yc(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var Ms={animationend:Yc("Animation","AnimationEnd"),animationiteration:Yc("Animation","AnimationIteration"),animationstart:Yc("Animation","AnimationStart"),transitionend:Yc("Transition","TransitionEnd")},Ch={},vb={};ho&&(vb=document.createElement("div").style,"AnimationEvent"in window||(delete Ms.animationend.animation,delete Ms.animationiteration.animation,delete Ms.animationstart.animation),"TransitionEvent"in window||delete Ms.transitionend.transition);function $d(e){if(Ch[e])return Ch[e];if(!Ms[e])return e;var t=Ms[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in vb)return Ch[e]=t[n];return e}var xb=$d("animationend"),wb=$d("animationiteration"),Sb=$d("animationstart"),bb=$d("transitionend"),Cb=new Map,G0="abort auxClick cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");function yi(e,t){Cb.set(e,t),os(t,[e])}for(var jh=0;jh<G0.length;jh++){var Eh=G0[jh],rI=Eh.toLowerCase(),oI=Eh[0].toUpperCase()+Eh.slice(1);yi(rI,"on"+oI)}yi(xb,"onAnimationEnd");yi(wb,"onAnimationIteration");yi(Sb,"onAnimationStart");yi("dblclick","onDoubleClick");yi("focusin","onFocus");yi("focusout","onBlur");yi(bb,"onTransitionEnd");ra("onMouseEnter",["mouseout","mouseover"]);ra("onMouseLeave",["mouseout","mouseover"]);ra("onPointerEnter",["pointerout","pointerover"]);ra("onPointerLeave",["pointerout","pointerover"]);os("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));os("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));os("onBeforeInput",["compositionend","keypress","textInput","paste"]);os("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));os("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));os("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var cl="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),iI=new Set("cancel close invalid load scroll toggle".split(" ").concat(cl));function Q0(e,t,n){var r=e.type||"unknown-event";e.currentTarget=n,rD(r,t,void 0,e),e.currentTarget=null}function jb(e,t){t=(t&4)!==0;for(var n=0;n<e.length;n++){var r=e[n],o=r.event;r=r.listeners;e:{var i=void 0;if(t)for(var s=r.length-1;0<=s;s--){var l=r[s],c=l.instance,u=l.currentTarget;if(l=l.listener,c!==i&&o.isPropagationStopped())break e;Q0(o,l,u),i=c}else for(s=0;s<r.length;s++){if(l=r[s],c=l.instance,u=l.currentTarget,l=l.listener,c!==i&&o.isPropagationStopped())break e;Q0(o,l,u),i=c}}}if(zu)throw e=bp,zu=!1,bp=null,e}function dt(e,t){var n=t[_p];n===void 0&&(n=t[_p]=new Set);var r=e+"__bubble";n.has(r)||(Eb(t,e,2,!1),n.add(r))}function Th(e,t,n){var r=0;t&&(r|=4),Eb(n,e,r,t)}var Xc="_reactListening"+Math.random().toString(36).slice(2);function Al(e){if(!e[Xc]){e[Xc]=!0,_S.forEach(function(n){n!=="selectionchange"&&(iI.has(n)||Th(n,!1,e),Th(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Xc]||(t[Xc]=!0,Th("selectionchange",!1,t))}}function Eb(e,t,n,r){switch(lb(t)){case 1:var o=xD;break;case 4:o=wD;break;default:o=ng}n=o.bind(null,t,n,e),o=void 0,!Sp||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(o=!0),r?o!==void 0?e.addEventListener(t,n,{capture:!0,passive:o}):e.addEventListener(t,n,!0):o!==void 0?e.addEventListener(t,n,{passive:o}):e.addEventListener(t,n,!1)}function Ph(e,t,n,r,o){var i=r;if(!(t&1)&&!(t&2)&&r!==null)e:for(;;){if(r===null)return;var s=r.tag;if(s===3||s===4){var l=r.stateNode.containerInfo;if(l===o||l.nodeType===8&&l.parentNode===o)break;if(s===4)for(s=r.return;s!==null;){var c=s.tag;if((c===3||c===4)&&(c=s.stateNode.containerInfo,c===o||c.nodeType===8&&c.parentNode===o))return;s=s.return}for(;l!==null;){if(s=Oi(l),s===null)return;if(c=s.tag,c===5||c===6){r=i=s;continue e}l=l.parentNode}}r=r.return}QS(function(){var u=i,d=Jm(n),f=[];e:{var h=Cb.get(e);if(h!==void 0){var m=og,g=e;switch(e){case"keypress":if(xu(n)===0)break e;case"keydown":case"keyup":m=OD;break;case"focusin":g="focus",m=wh;break;case"focusout":g="blur",m=wh;break;case"beforeblur":case"afterblur":m=wh;break;case"click":if(n.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":m=M0;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":m=CD;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":m=$D;break;case xb:case wb:case Sb:m=TD;break;case bb:m=zD;break;case"scroll":m=SD;break;case"wheel":m=UD;break;case"copy":case"cut":case"paste":m=kD;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":m=$0}var y=(t&4)!==0,C=!y&&e==="scroll",v=y?h!==null?h+"Capture":null:h;y=[];for(var x=u,w;x!==null;){w=x;var S=w.stateNode;if(w.tag===5&&S!==null&&(w=S,v!==null&&(S=Pl(x,v),S!=null&&y.push(Nl(x,S,w)))),C)break;x=x.return}0<y.length&&(h=new m(h,g,null,n,d),f.push({event:h,listeners:y}))}}if(!(t&7)){e:{if(h=e==="mouseover"||e==="pointerover",m=e==="mouseout"||e==="pointerout",h&&n!==xp&&(g=n.relatedTarget||n.fromElement)&&(Oi(g)||g[po]))break e;if((m||h)&&(h=d.window===d?d:(h=d.ownerDocument)?h.defaultView||h.parentWindow:window,m?(g=n.relatedTarget||n.toElement,m=u,g=g?Oi(g):null,g!==null&&(C=is(g),g!==C||g.tag!==5&&g.tag!==6)&&(g=null)):(m=null,g=u),m!==g)){if(y=M0,S="onMouseLeave",v="onMouseEnter",x="mouse",(e==="pointerout"||e==="pointerover")&&(y=$0,S="onPointerLeave",v="onPointerEnter",x="pointer"),C=m==null?h:Ls(m),w=g==null?h:Ls(g),h=new y(S,x+"leave",m,n,d),h.target=C,h.relatedTarget=w,S=null,Oi(d)===u&&(y=new y(v,x+"enter",g,n,d),y.target=w,y.relatedTarget=C,S=y),C=S,m&&g)t:{for(y=m,v=g,x=0,w=y;w;w=Ts(w))x++;for(w=0,S=v;S;S=Ts(S))w++;for(;0<x-w;)y=Ts(y),x--;for(;0<w-x;)v=Ts(v),w--;for(;x--;){if(y===v||v!==null&&y===v.alternate)break t;y=Ts(y),v=Ts(v)}y=null}else y=null;m!==null&&K0(f,h,m,y,!1),g!==null&&C!==null&&K0(f,C,g,y,!0)}}e:{if(h=u?Ls(u):window,m=h.nodeName&&h.nodeName.toLowerCase(),m==="select"||m==="input"&&h.type==="file")var E=KD;else if(B0(h))if(pb)E=ZD;else{E=XD;var j=YD}else(m=h.nodeName)&&m.toLowerCase()==="input"&&(h.type==="checkbox"||h.type==="radio")&&(E=JD);if(E&&(E=E(e,u))){hb(f,E,n,d);break e}j&&j(e,h,u),e==="focusout"&&(j=h._wrapperState)&&j.controlled&&h.type==="number"&&pp(h,"number",h.value)}switch(j=u?Ls(u):window,e){case"focusin":(B0(j)||j.contentEditable==="true")&&(Os=j,Tp=u,yl=null);break;case"focusout":yl=Tp=Os=null;break;case"mousedown":Pp=!0;break;case"contextmenu":case"mouseup":case"dragend":Pp=!1,q0(f,n,d);break;case"selectionchange":if(nI)break;case"keydown":case"keyup":q0(f,n,d)}var T;if(sg)e:{switch(e){case"compositionstart":var P="onCompositionStart";break e;case"compositionend":P="onCompositionEnd";break e;case"compositionupdate":P="onCompositionUpdate";break e}P=void 0}else Ns?db(e,n)&&(P="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(P="onCompositionStart");P&&(ub&&n.locale!=="ko"&&(Ns||P!=="onCompositionStart"?P==="onCompositionEnd"&&Ns&&(T=cb()):(Ko=d,rg="value"in Ko?Ko.value:Ko.textContent,Ns=!0)),j=Wu(u,P),0<j.length&&(P=new L0(P,e,null,n,d),f.push({event:P,listeners:j}),T?P.data=T:(T=fb(n),T!==null&&(P.data=T)))),(T=HD?WD(e,n):qD(e,n))&&(u=Wu(u,"onBeforeInput"),0<u.length&&(d=new L0("onBeforeInput","beforeinput",null,n,d),f.push({event:d,listeners:u}),d.data=T))}jb(f,t)})}function Nl(e,t,n){return{instance:e,listener:t,currentTarget:n}}function Wu(e,t){for(var n=t+"Capture",r=[];e!==null;){var o=e,i=o.stateNode;o.tag===5&&i!==null&&(o=i,i=Pl(e,n),i!=null&&r.unshift(Nl(e,i,o)),i=Pl(e,t),i!=null&&r.push(Nl(e,i,o))),e=e.return}return r}function Ts(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function K0(e,t,n,r,o){for(var i=t._reactName,s=[];n!==null&&n!==r;){var l=n,c=l.alternate,u=l.stateNode;if(c!==null&&c===r)break;l.tag===5&&u!==null&&(l=u,o?(c=Pl(n,i),c!=null&&s.unshift(Nl(n,c,l))):o||(c=Pl(n,i),c!=null&&s.push(Nl(n,c,l)))),n=n.return}s.length!==0&&e.push({event:t,listeners:s})}var sI=/\r\n?/g,aI=/\u0000|\uFFFD/g;function Y0(e){return(typeof e=="string"?e:""+e).replace(sI,`
81
- `).replace(aI,"")}function Jc(e,t,n){if(t=Y0(t),Y0(e)!==t&&n)throw Error(K(425))}function qu(){}var kp=null,Rp=null;function Dp(e,t){return e==="textarea"||e==="noscript"||typeof t.children=="string"||typeof t.children=="number"||typeof t.dangerouslySetInnerHTML=="object"&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var Ip=typeof setTimeout=="function"?setTimeout:void 0,lI=typeof clearTimeout=="function"?clearTimeout:void 0,X0=typeof Promise=="function"?Promise:void 0,cI=typeof queueMicrotask=="function"?queueMicrotask:typeof X0<"u"?function(e){return X0.resolve(null).then(e).catch(uI)}:Ip;function uI(e){setTimeout(function(){throw e})}function kh(e,t){var n=t,r=0;do{var o=n.nextSibling;if(e.removeChild(n),o&&o.nodeType===8)if(n=o.data,n==="/$"){if(r===0){e.removeChild(o),Dl(t);return}r--}else n!=="$"&&n!=="$?"&&n!=="$!"||r++;n=o}while(n);Dl(t)}function ri(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t==="$"||t==="$!"||t==="$?")break;if(t==="/$")return null}}return e}function J0(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="$"||n==="$!"||n==="$?"){if(t===0)return e;t--}else n==="/$"&&t++}e=e.previousSibling}return null}var ka=Math.random().toString(36).slice(2),Wr="__reactFiber$"+ka,Ol="__reactProps$"+ka,po="__reactContainer$"+ka,_p="__reactEvents$"+ka,dI="__reactListeners$"+ka,fI="__reactHandles$"+ka;function Oi(e){var t=e[Wr];if(t)return t;for(var n=e.parentNode;n;){if(t=n[po]||n[Wr]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=J0(e);e!==null;){if(n=e[Wr])return n;e=J0(e)}return t}e=n,n=e.parentNode}return null}function oc(e){return e=e[Wr]||e[po],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function Ls(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(K(33))}function Fd(e){return e[Ol]||null}var Ap=[],$s=-1;function vi(e){return{current:e}}function pt(e){0>$s||(e.current=Ap[$s],Ap[$s]=null,$s--)}function lt(e,t){$s++,Ap[$s]=e.current,e.current=t}var di={},ln=vi(di),Rn=vi(!1),Hi=di;function oa(e,t){var n=e.type.contextTypes;if(!n)return di;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var o={},i;for(i in n)o[i]=t[i];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=o),o}function Dn(e){return e=e.childContextTypes,e!=null}function Gu(){pt(Rn),pt(ln)}function Z0(e,t,n){if(ln.current!==di)throw Error(K(168));lt(ln,t),lt(Rn,n)}function Tb(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var o in r)if(!(o in t))throw Error(K(108,YR(e)||"Unknown",o));return jt({},n,r)}function Qu(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||di,Hi=ln.current,lt(ln,e),lt(Rn,Rn.current),!0}function ex(e,t,n){var r=e.stateNode;if(!r)throw Error(K(169));n?(e=Tb(e,t,Hi),r.__reactInternalMemoizedMergedChildContext=e,pt(Rn),pt(ln),lt(ln,e)):pt(Rn),lt(Rn,n)}var io=null,zd=!1,Rh=!1;function Pb(e){io===null?io=[e]:io.push(e)}function hI(e){zd=!0,Pb(e)}function xi(){if(!Rh&&io!==null){Rh=!0;var e=0,t=Ke;try{var n=io;for(Ke=1;e<n.length;e++){var r=n[e];do r=r(!0);while(r!==null)}io=null,zd=!1}catch(o){throw io!==null&&(io=io.slice(e+1)),JS(Zm,xi),o}finally{Ke=t,Rh=!1}}return null}var Fs=[],zs=0,Ku=null,Yu=0,nr=[],rr=0,Wi=null,so=1,ao="";function Ri(e,t){Fs[zs++]=Yu,Fs[zs++]=Ku,Ku=e,Yu=t}function kb(e,t,n){nr[rr++]=so,nr[rr++]=ao,nr[rr++]=Wi,Wi=e;var r=so;e=ao;var o=32-Er(r)-1;r&=~(1<<o),n+=1;var i=32-Er(t)+o;if(30<i){var s=o-o%5;i=(r&(1<<s)-1).toString(32),r>>=s,o-=s,so=1<<32-Er(t)+o|n<<o|r,ao=i+e}else so=1<<i|n<<o|r,ao=e}function lg(e){e.return!==null&&(Ri(e,1),kb(e,1,0))}function cg(e){for(;e===Ku;)Ku=Fs[--zs],Fs[zs]=null,Yu=Fs[--zs],Fs[zs]=null;for(;e===Wi;)Wi=nr[--rr],nr[rr]=null,ao=nr[--rr],nr[rr]=null,so=nr[--rr],nr[rr]=null}var Hn=null,Un=null,vt=!1,Cr=null;function Rb(e,t){var n=or(5,null,null,0);n.elementType="DELETED",n.stateNode=t,n.return=e,t=e.deletions,t===null?(e.deletions=[n],e.flags|=16):t.push(n)}function tx(e,t){switch(e.tag){case 5:var n=e.type;return t=t.nodeType!==1||n.toLowerCase()!==t.nodeName.toLowerCase()?null:t,t!==null?(e.stateNode=t,Hn=e,Un=ri(t.firstChild),!0):!1;case 6:return t=e.pendingProps===""||t.nodeType!==3?null:t,t!==null?(e.stateNode=t,Hn=e,Un=null,!0):!1;case 13:return t=t.nodeType!==8?null:t,t!==null?(n=Wi!==null?{id:so,overflow:ao}:null,e.memoizedState={dehydrated:t,treeContext:n,retryLane:1073741824},n=or(18,null,null,0),n.stateNode=t,n.return=e,e.child=n,Hn=e,Un=null,!0):!1;default:return!1}}function Np(e){return(e.mode&1)!==0&&(e.flags&128)===0}function Op(e){if(vt){var t=Un;if(t){var n=t;if(!tx(e,t)){if(Np(e))throw Error(K(418));t=ri(n.nextSibling);var r=Hn;t&&tx(e,t)?Rb(r,n):(e.flags=e.flags&-4097|2,vt=!1,Hn=e)}}else{if(Np(e))throw Error(K(418));e.flags=e.flags&-4097|2,vt=!1,Hn=e}}}function nx(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;Hn=e}function Zc(e){if(e!==Hn)return!1;if(!vt)return nx(e),vt=!0,!1;var t;if((t=e.tag!==3)&&!(t=e.tag!==5)&&(t=e.type,t=t!=="head"&&t!=="body"&&!Dp(e.type,e.memoizedProps)),t&&(t=Un)){if(Np(e))throw Db(),Error(K(418));for(;t;)Rb(e,t),t=ri(t.nextSibling)}if(nx(e),e.tag===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(K(317));e:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="/$"){if(t===0){Un=ri(e.nextSibling);break e}t--}else n!=="$"&&n!=="$!"&&n!=="$?"||t++}e=e.nextSibling}Un=null}}else Un=Hn?ri(e.stateNode.nextSibling):null;return!0}function Db(){for(var e=Un;e;)e=ri(e.nextSibling)}function ia(){Un=Hn=null,vt=!1}function ug(e){Cr===null?Cr=[e]:Cr.push(e)}var pI=Eo.ReactCurrentBatchConfig;function wr(e,t){if(e&&e.defaultProps){t=jt({},t),e=e.defaultProps;for(var n in e)t[n]===void 0&&(t[n]=e[n]);return t}return t}var Xu=vi(null),Ju=null,Bs=null,dg=null;function fg(){dg=Bs=Ju=null}function hg(e){var t=Xu.current;pt(Xu),e._currentValue=t}function Mp(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,r!==null&&(r.childLanes|=t)):r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t),e===n)break;e=e.return}}function Js(e,t){Ju=e,dg=Bs=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(kn=!0),e.firstContext=null)}function ar(e){var t=e._currentValue;if(dg!==e)if(e={context:e,memoizedValue:t,next:null},Bs===null){if(Ju===null)throw Error(K(308));Bs=e,Ju.dependencies={lanes:0,firstContext:e}}else Bs=Bs.next=e;return t}var Mi=null;function pg(e){Mi===null?Mi=[e]:Mi.push(e)}function Ib(e,t,n,r){var o=t.interleaved;return o===null?(n.next=n,pg(t)):(n.next=o.next,o.next=n),t.interleaved=n,mo(e,r)}function mo(e,t){e.lanes|=t;var n=e.alternate;for(n!==null&&(n.lanes|=t),n=e,e=e.return;e!==null;)e.childLanes|=t,n=e.alternate,n!==null&&(n.childLanes|=t),n=e,e=e.return;return n.tag===3?n.stateNode:null}var Uo=!1;function mg(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function _b(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function lo(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function oi(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,qe&2){var o=r.pending;return o===null?t.next=t:(t.next=o.next,o.next=t),r.pending=t,mo(e,n)}return o=r.interleaved,o===null?(t.next=t,pg(r)):(t.next=o.next,o.next=t),r.interleaved=t,mo(e,n)}function wu(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194240)!==0)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,eg(e,n)}}function rx(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var o=null,i=null;if(n=n.firstBaseUpdate,n!==null){do{var s={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};i===null?o=i=s:i=i.next=s,n=n.next}while(n!==null);i===null?o=i=t:i=i.next=t}else o=i=t;n={baseState:r.baseState,firstBaseUpdate:o,lastBaseUpdate:i,shared:r.shared,effects:r.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function Zu(e,t,n,r){var o=e.updateQueue;Uo=!1;var i=o.firstBaseUpdate,s=o.lastBaseUpdate,l=o.shared.pending;if(l!==null){o.shared.pending=null;var c=l,u=c.next;c.next=null,s===null?i=u:s.next=u,s=c;var d=e.alternate;d!==null&&(d=d.updateQueue,l=d.lastBaseUpdate,l!==s&&(l===null?d.firstBaseUpdate=u:l.next=u,d.lastBaseUpdate=c))}if(i!==null){var f=o.baseState;s=0,d=u=c=null,l=i;do{var h=l.lane,m=l.eventTime;if((r&h)===h){d!==null&&(d=d.next={eventTime:m,lane:0,tag:l.tag,payload:l.payload,callback:l.callback,next:null});e:{var g=e,y=l;switch(h=t,m=n,y.tag){case 1:if(g=y.payload,typeof g=="function"){f=g.call(m,f,h);break e}f=g;break e;case 3:g.flags=g.flags&-65537|128;case 0:if(g=y.payload,h=typeof g=="function"?g.call(m,f,h):g,h==null)break e;f=jt({},f,h);break e;case 2:Uo=!0}}l.callback!==null&&l.lane!==0&&(e.flags|=64,h=o.effects,h===null?o.effects=[l]:h.push(l))}else m={eventTime:m,lane:h,tag:l.tag,payload:l.payload,callback:l.callback,next:null},d===null?(u=d=m,c=f):d=d.next=m,s|=h;if(l=l.next,l===null){if(l=o.shared.pending,l===null)break;h=l,l=h.next,h.next=null,o.lastBaseUpdate=h,o.shared.pending=null}}while(!0);if(d===null&&(c=f),o.baseState=c,o.firstBaseUpdate=u,o.lastBaseUpdate=d,t=o.shared.interleaved,t!==null){o=t;do s|=o.lane,o=o.next;while(o!==t)}else i===null&&(o.shared.lanes=0);Gi|=s,e.lanes=s,e.memoizedState=f}}function ox(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;t<e.length;t++){var r=e[t],o=r.callback;if(o!==null){if(r.callback=null,r=n,typeof o!="function")throw Error(K(191,o));o.call(r)}}}var Ab=new IS.Component().refs;function Lp(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:jt({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var Bd={isMounted:function(e){return(e=e._reactInternals)?is(e)===e:!1},enqueueSetState:function(e,t,n){e=e._reactInternals;var r=mn(),o=si(e),i=lo(r,o);i.payload=t,n!=null&&(i.callback=n),t=oi(e,i,o),t!==null&&(Tr(t,e,o,r),wu(t,e,o))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=mn(),o=si(e),i=lo(r,o);i.tag=1,i.payload=t,n!=null&&(i.callback=n),t=oi(e,i,o),t!==null&&(Tr(t,e,o,r),wu(t,e,o))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=mn(),r=si(e),o=lo(n,r);o.tag=2,t!=null&&(o.callback=t),t=oi(e,o,r),t!==null&&(Tr(t,e,r,n),wu(t,e,r))}};function ix(e,t,n,r,o,i,s){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(r,i,s):t.prototype&&t.prototype.isPureReactComponent?!_l(n,r)||!_l(o,i):!0}function Nb(e,t,n){var r=!1,o=di,i=t.contextType;return typeof i=="object"&&i!==null?i=ar(i):(o=Dn(t)?Hi:ln.current,r=t.contextTypes,i=(r=r!=null)?oa(e,o):di),t=new t(n,i),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=Bd,e.stateNode=t,t._reactInternals=e,r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=o,e.__reactInternalMemoizedMaskedChildContext=i),t}function sx(e,t,n,r){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(n,r),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(n,r),t.state!==e&&Bd.enqueueReplaceState(t,t.state,null)}function $p(e,t,n,r){var o=e.stateNode;o.props=n,o.state=e.memoizedState,o.refs=Ab,mg(e);var i=t.contextType;typeof i=="object"&&i!==null?o.context=ar(i):(i=Dn(t)?Hi:ln.current,o.context=oa(e,i)),o.state=e.memoizedState,i=t.getDerivedStateFromProps,typeof i=="function"&&(Lp(e,t,i,n),o.state=e.memoizedState),typeof t.getDerivedStateFromProps=="function"||typeof o.getSnapshotBeforeUpdate=="function"||typeof o.UNSAFE_componentWillMount!="function"&&typeof o.componentWillMount!="function"||(t=o.state,typeof o.componentWillMount=="function"&&o.componentWillMount(),typeof o.UNSAFE_componentWillMount=="function"&&o.UNSAFE_componentWillMount(),t!==o.state&&Bd.enqueueReplaceState(o,o.state,null),Zu(e,n,o,r),o.state=e.memoizedState),typeof o.componentDidMount=="function"&&(e.flags|=4194308)}function Ga(e,t,n){if(e=n.ref,e!==null&&typeof e!="function"&&typeof e!="object"){if(n._owner){if(n=n._owner,n){if(n.tag!==1)throw Error(K(309));var r=n.stateNode}if(!r)throw Error(K(147,e));var o=r,i=""+e;return t!==null&&t.ref!==null&&typeof t.ref=="function"&&t.ref._stringRef===i?t.ref:(t=function(s){var l=o.refs;l===Ab&&(l=o.refs={}),s===null?delete l[i]:l[i]=s},t._stringRef=i,t)}if(typeof e!="string")throw Error(K(284));if(!n._owner)throw Error(K(290,e))}return e}function eu(e,t){throw e=Object.prototype.toString.call(t),Error(K(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function ax(e){var t=e._init;return t(e._payload)}function Ob(e){function t(v,x){if(e){var w=v.deletions;w===null?(v.deletions=[x],v.flags|=16):w.push(x)}}function n(v,x){if(!e)return null;for(;x!==null;)t(v,x),x=x.sibling;return null}function r(v,x){for(v=new Map;x!==null;)x.key!==null?v.set(x.key,x):v.set(x.index,x),x=x.sibling;return v}function o(v,x){return v=ai(v,x),v.index=0,v.sibling=null,v}function i(v,x,w){return v.index=w,e?(w=v.alternate,w!==null?(w=w.index,w<x?(v.flags|=2,x):w):(v.flags|=2,x)):(v.flags|=1048576,x)}function s(v){return e&&v.alternate===null&&(v.flags|=2),v}function l(v,x,w,S){return x===null||x.tag!==6?(x=Mh(w,v.mode,S),x.return=v,x):(x=o(x,w),x.return=v,x)}function c(v,x,w,S){var E=w.type;return E===As?d(v,x,w.props.children,S,w.key):x!==null&&(x.elementType===E||typeof E=="object"&&E!==null&&E.$$typeof===Bo&&ax(E)===x.type)?(S=o(x,w.props),S.ref=Ga(v,x,w),S.return=v,S):(S=Tu(w.type,w.key,w.props,null,v.mode,S),S.ref=Ga(v,x,w),S.return=v,S)}function u(v,x,w,S){return x===null||x.tag!==4||x.stateNode.containerInfo!==w.containerInfo||x.stateNode.implementation!==w.implementation?(x=Lh(w,v.mode,S),x.return=v,x):(x=o(x,w.children||[]),x.return=v,x)}function d(v,x,w,S,E){return x===null||x.tag!==7?(x=Ui(w,v.mode,S,E),x.return=v,x):(x=o(x,w),x.return=v,x)}function f(v,x,w){if(typeof x=="string"&&x!==""||typeof x=="number")return x=Mh(""+x,v.mode,w),x.return=v,x;if(typeof x=="object"&&x!==null){switch(x.$$typeof){case Vc:return w=Tu(x.type,x.key,x.props,null,v.mode,w),w.ref=Ga(v,null,x),w.return=v,w;case _s:return x=Lh(x,v.mode,w),x.return=v,x;case Bo:var S=x._init;return f(v,S(x._payload),w)}if(al(x)||Ua(x))return x=Ui(x,v.mode,w,null),x.return=v,x;eu(v,x)}return null}function h(v,x,w,S){var E=x!==null?x.key:null;if(typeof w=="string"&&w!==""||typeof w=="number")return E!==null?null:l(v,x,""+w,S);if(typeof w=="object"&&w!==null){switch(w.$$typeof){case Vc:return w.key===E?c(v,x,w,S):null;case _s:return w.key===E?u(v,x,w,S):null;case Bo:return E=w._init,h(v,x,E(w._payload),S)}if(al(w)||Ua(w))return E!==null?null:d(v,x,w,S,null);eu(v,w)}return null}function m(v,x,w,S,E){if(typeof S=="string"&&S!==""||typeof S=="number")return v=v.get(w)||null,l(x,v,""+S,E);if(typeof S=="object"&&S!==null){switch(S.$$typeof){case Vc:return v=v.get(S.key===null?w:S.key)||null,c(x,v,S,E);case _s:return v=v.get(S.key===null?w:S.key)||null,u(x,v,S,E);case Bo:var j=S._init;return m(v,x,w,j(S._payload),E)}if(al(S)||Ua(S))return v=v.get(w)||null,d(x,v,S,E,null);eu(x,S)}return null}function g(v,x,w,S){for(var E=null,j=null,T=x,P=x=0,R=null;T!==null&&P<w.length;P++){T.index>P?(R=T,T=null):R=T.sibling;var I=h(v,T,w[P],S);if(I===null){T===null&&(T=R);break}e&&T&&I.alternate===null&&t(v,T),x=i(I,x,P),j===null?E=I:j.sibling=I,j=I,T=R}if(P===w.length)return n(v,T),vt&&Ri(v,P),E;if(T===null){for(;P<w.length;P++)T=f(v,w[P],S),T!==null&&(x=i(T,x,P),j===null?E=T:j.sibling=T,j=T);return vt&&Ri(v,P),E}for(T=r(v,T);P<w.length;P++)R=m(T,v,P,w[P],S),R!==null&&(e&&R.alternate!==null&&T.delete(R.key===null?P:R.key),x=i(R,x,P),j===null?E=R:j.sibling=R,j=R);return e&&T.forEach(function(O){return t(v,O)}),vt&&Ri(v,P),E}function y(v,x,w,S){var E=Ua(w);if(typeof E!="function")throw Error(K(150));if(w=E.call(w),w==null)throw Error(K(151));for(var j=E=null,T=x,P=x=0,R=null,I=w.next();T!==null&&!I.done;P++,I=w.next()){T.index>P?(R=T,T=null):R=T.sibling;var O=h(v,T,I.value,S);if(O===null){T===null&&(T=R);break}e&&T&&O.alternate===null&&t(v,T),x=i(O,x,P),j===null?E=O:j.sibling=O,j=O,T=R}if(I.done)return n(v,T),vt&&Ri(v,P),E;if(T===null){for(;!I.done;P++,I=w.next())I=f(v,I.value,S),I!==null&&(x=i(I,x,P),j===null?E=I:j.sibling=I,j=I);return vt&&Ri(v,P),E}for(T=r(v,T);!I.done;P++,I=w.next())I=m(T,v,P,I.value,S),I!==null&&(e&&I.alternate!==null&&T.delete(I.key===null?P:I.key),x=i(I,x,P),j===null?E=I:j.sibling=I,j=I);return e&&T.forEach(function(D){return t(v,D)}),vt&&Ri(v,P),E}function C(v,x,w,S){if(typeof w=="object"&&w!==null&&w.type===As&&w.key===null&&(w=w.props.children),typeof w=="object"&&w!==null){switch(w.$$typeof){case Vc:e:{for(var E=w.key,j=x;j!==null;){if(j.key===E){if(E=w.type,E===As){if(j.tag===7){n(v,j.sibling),x=o(j,w.props.children),x.return=v,v=x;break e}}else if(j.elementType===E||typeof E=="object"&&E!==null&&E.$$typeof===Bo&&ax(E)===j.type){n(v,j.sibling),x=o(j,w.props),x.ref=Ga(v,j,w),x.return=v,v=x;break e}n(v,j);break}else t(v,j);j=j.sibling}w.type===As?(x=Ui(w.props.children,v.mode,S,w.key),x.return=v,v=x):(S=Tu(w.type,w.key,w.props,null,v.mode,S),S.ref=Ga(v,x,w),S.return=v,v=S)}return s(v);case _s:e:{for(j=w.key;x!==null;){if(x.key===j)if(x.tag===4&&x.stateNode.containerInfo===w.containerInfo&&x.stateNode.implementation===w.implementation){n(v,x.sibling),x=o(x,w.children||[]),x.return=v,v=x;break e}else{n(v,x);break}else t(v,x);x=x.sibling}x=Lh(w,v.mode,S),x.return=v,v=x}return s(v);case Bo:return j=w._init,C(v,x,j(w._payload),S)}if(al(w))return g(v,x,w,S);if(Ua(w))return y(v,x,w,S);eu(v,w)}return typeof w=="string"&&w!==""||typeof w=="number"?(w=""+w,x!==null&&x.tag===6?(n(v,x.sibling),x=o(x,w),x.return=v,v=x):(n(v,x),x=Mh(w,v.mode,S),x.return=v,v=x),s(v)):n(v,x)}return C}var sa=Ob(!0),Mb=Ob(!1),ic={},Qr=vi(ic),Ml=vi(ic),Ll=vi(ic);function Li(e){if(e===ic)throw Error(K(174));return e}function gg(e,t){switch(lt(Ll,t),lt(Ml,e),lt(Qr,ic),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:gp(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=gp(t,e)}pt(Qr),lt(Qr,t)}function aa(){pt(Qr),pt(Ml),pt(Ll)}function Lb(e){Li(Ll.current);var t=Li(Qr.current),n=gp(t,e.type);t!==n&&(lt(Ml,e),lt(Qr,n))}function yg(e){Ml.current===e&&(pt(Qr),pt(Ml))}var bt=vi(0);function ed(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||n.data==="$?"||n.data==="$!"))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!==void 0){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var Dh=[];function vg(){for(var e=0;e<Dh.length;e++)Dh[e]._workInProgressVersionPrimary=null;Dh.length=0}var Su=Eo.ReactCurrentDispatcher,Ih=Eo.ReactCurrentBatchConfig,qi=0,Ct=null,Lt=null,Bt=null,td=!1,vl=!1,$l=0,mI=0;function rn(){throw Error(K(321))}function xg(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!kr(e[n],t[n]))return!1;return!0}function wg(e,t,n,r,o,i){if(qi=i,Ct=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,Su.current=e===null||e.memoizedState===null?xI:wI,e=n(r,o),vl){i=0;do{if(vl=!1,$l=0,25<=i)throw Error(K(301));i+=1,Bt=Lt=null,t.updateQueue=null,Su.current=SI,e=n(r,o)}while(vl)}if(Su.current=nd,t=Lt!==null&&Lt.next!==null,qi=0,Bt=Lt=Ct=null,td=!1,t)throw Error(K(300));return e}function Sg(){var e=$l!==0;return $l=0,e}function Ur(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Bt===null?Ct.memoizedState=Bt=e:Bt=Bt.next=e,Bt}function lr(){if(Lt===null){var e=Ct.alternate;e=e!==null?e.memoizedState:null}else e=Lt.next;var t=Bt===null?Ct.memoizedState:Bt.next;if(t!==null)Bt=t,Lt=e;else{if(e===null)throw Error(K(310));Lt=e,e={memoizedState:Lt.memoizedState,baseState:Lt.baseState,baseQueue:Lt.baseQueue,queue:Lt.queue,next:null},Bt===null?Ct.memoizedState=Bt=e:Bt=Bt.next=e}return Bt}function Fl(e,t){return typeof t=="function"?t(e):t}function _h(e){var t=lr(),n=t.queue;if(n===null)throw Error(K(311));n.lastRenderedReducer=e;var r=Lt,o=r.baseQueue,i=n.pending;if(i!==null){if(o!==null){var s=o.next;o.next=i.next,i.next=s}r.baseQueue=o=i,n.pending=null}if(o!==null){i=o.next,r=r.baseState;var l=s=null,c=null,u=i;do{var d=u.lane;if((qi&d)===d)c!==null&&(c=c.next={lane:0,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null}),r=u.hasEagerState?u.eagerState:e(r,u.action);else{var f={lane:d,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null};c===null?(l=c=f,s=r):c=c.next=f,Ct.lanes|=d,Gi|=d}u=u.next}while(u!==null&&u!==i);c===null?s=r:c.next=l,kr(r,t.memoizedState)||(kn=!0),t.memoizedState=r,t.baseState=s,t.baseQueue=c,n.lastRenderedState=r}if(e=n.interleaved,e!==null){o=e;do i=o.lane,Ct.lanes|=i,Gi|=i,o=o.next;while(o!==e)}else o===null&&(n.lanes=0);return[t.memoizedState,n.dispatch]}function Ah(e){var t=lr(),n=t.queue;if(n===null)throw Error(K(311));n.lastRenderedReducer=e;var r=n.dispatch,o=n.pending,i=t.memoizedState;if(o!==null){n.pending=null;var s=o=o.next;do i=e(i,s.action),s=s.next;while(s!==o);kr(i,t.memoizedState)||(kn=!0),t.memoizedState=i,t.baseQueue===null&&(t.baseState=i),n.lastRenderedState=i}return[i,r]}function $b(){}function Fb(e,t){var n=Ct,r=lr(),o=t(),i=!kr(r.memoizedState,o);if(i&&(r.memoizedState=o,kn=!0),r=r.queue,bg(Ub.bind(null,n,r,e),[e]),r.getSnapshot!==t||i||Bt!==null&&Bt.memoizedState.tag&1){if(n.flags|=2048,zl(9,Bb.bind(null,n,r,o,t),void 0,null),Vt===null)throw Error(K(349));qi&30||zb(n,t,o)}return o}function zb(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=Ct.updateQueue,t===null?(t={lastEffect:null,stores:null},Ct.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function Bb(e,t,n,r){t.value=n,t.getSnapshot=r,Vb(t)&&Hb(e)}function Ub(e,t,n){return n(function(){Vb(t)&&Hb(e)})}function Vb(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!kr(e,n)}catch{return!0}}function Hb(e){var t=mo(e,1);t!==null&&Tr(t,e,1,-1)}function lx(e){var t=Ur();return typeof e=="function"&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Fl,lastRenderedState:e},t.queue=e,e=e.dispatch=vI.bind(null,Ct,e),[t.memoizedState,e]}function zl(e,t,n,r){return e={tag:e,create:t,destroy:n,deps:r,next:null},t=Ct.updateQueue,t===null?(t={lastEffect:null,stores:null},Ct.updateQueue=t,t.lastEffect=e.next=e):(n=t.lastEffect,n===null?t.lastEffect=e.next=e:(r=n.next,n.next=e,e.next=r,t.lastEffect=e)),e}function Wb(){return lr().memoizedState}function bu(e,t,n,r){var o=Ur();Ct.flags|=e,o.memoizedState=zl(1|t,n,void 0,r===void 0?null:r)}function Ud(e,t,n,r){var o=lr();r=r===void 0?null:r;var i=void 0;if(Lt!==null){var s=Lt.memoizedState;if(i=s.destroy,r!==null&&xg(r,s.deps)){o.memoizedState=zl(t,n,i,r);return}}Ct.flags|=e,o.memoizedState=zl(1|t,n,i,r)}function cx(e,t){return bu(8390656,8,e,t)}function bg(e,t){return Ud(2048,8,e,t)}function qb(e,t){return Ud(4,2,e,t)}function Gb(e,t){return Ud(4,4,e,t)}function Qb(e,t){if(typeof t=="function")return e=e(),t(e),function(){t(null)};if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function Kb(e,t,n){return n=n!=null?n.concat([e]):null,Ud(4,4,Qb.bind(null,t,e),n)}function Cg(){}function Yb(e,t){var n=lr();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&xg(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function Xb(e,t){var n=lr();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&xg(t,r[1])?r[0]:(e=e(),n.memoizedState=[e,t],e)}function Jb(e,t,n){return qi&21?(kr(n,t)||(n=tb(),Ct.lanes|=n,Gi|=n,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,kn=!0),e.memoizedState=n)}function gI(e,t){var n=Ke;Ke=n!==0&&4>n?n:4,e(!0);var r=Ih.transition;Ih.transition={};try{e(!1),t()}finally{Ke=n,Ih.transition=r}}function Zb(){return lr().memoizedState}function yI(e,t,n){var r=si(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},eC(e))tC(t,n);else if(n=Ib(e,t,n,r),n!==null){var o=mn();Tr(n,e,r,o),nC(n,t,r)}}function vI(e,t,n){var r=si(e),o={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(eC(e))tC(t,o);else{var i=e.alternate;if(e.lanes===0&&(i===null||i.lanes===0)&&(i=t.lastRenderedReducer,i!==null))try{var s=t.lastRenderedState,l=i(s,n);if(o.hasEagerState=!0,o.eagerState=l,kr(l,s)){var c=t.interleaved;c===null?(o.next=o,pg(t)):(o.next=c.next,c.next=o),t.interleaved=o;return}}catch{}finally{}n=Ib(e,t,o,r),n!==null&&(o=mn(),Tr(n,e,r,o),nC(n,t,r))}}function eC(e){var t=e.alternate;return e===Ct||t!==null&&t===Ct}function tC(e,t){vl=td=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function nC(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,eg(e,n)}}var nd={readContext:ar,useCallback:rn,useContext:rn,useEffect:rn,useImperativeHandle:rn,useInsertionEffect:rn,useLayoutEffect:rn,useMemo:rn,useReducer:rn,useRef:rn,useState:rn,useDebugValue:rn,useDeferredValue:rn,useTransition:rn,useMutableSource:rn,useSyncExternalStore:rn,useId:rn,unstable_isNewReconciler:!1},xI={readContext:ar,useCallback:function(e,t){return Ur().memoizedState=[e,t===void 0?null:t],e},useContext:ar,useEffect:cx,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,bu(4194308,4,Qb.bind(null,t,e),n)},useLayoutEffect:function(e,t){return bu(4194308,4,e,t)},useInsertionEffect:function(e,t){return bu(4,2,e,t)},useMemo:function(e,t){var n=Ur();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=Ur();return t=n!==void 0?n(t):t,r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=yI.bind(null,Ct,e),[r.memoizedState,e]},useRef:function(e){var t=Ur();return e={current:e},t.memoizedState=e},useState:lx,useDebugValue:Cg,useDeferredValue:function(e){return Ur().memoizedState=e},useTransition:function(){var e=lx(!1),t=e[0];return e=gI.bind(null,e[1]),Ur().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=Ct,o=Ur();if(vt){if(n===void 0)throw Error(K(407));n=n()}else{if(n=t(),Vt===null)throw Error(K(349));qi&30||zb(r,t,n)}o.memoizedState=n;var i={value:n,getSnapshot:t};return o.queue=i,cx(Ub.bind(null,r,i,e),[e]),r.flags|=2048,zl(9,Bb.bind(null,r,i,n,t),void 0,null),n},useId:function(){var e=Ur(),t=Vt.identifierPrefix;if(vt){var n=ao,r=so;n=(r&~(1<<32-Er(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=$l++,0<n&&(t+="H"+n.toString(32)),t+=":"}else n=mI++,t=":"+t+"r"+n.toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},wI={readContext:ar,useCallback:Yb,useContext:ar,useEffect:bg,useImperativeHandle:Kb,useInsertionEffect:qb,useLayoutEffect:Gb,useMemo:Xb,useReducer:_h,useRef:Wb,useState:function(){return _h(Fl)},useDebugValue:Cg,useDeferredValue:function(e){var t=lr();return Jb(t,Lt.memoizedState,e)},useTransition:function(){var e=_h(Fl)[0],t=lr().memoizedState;return[e,t]},useMutableSource:$b,useSyncExternalStore:Fb,useId:Zb,unstable_isNewReconciler:!1},SI={readContext:ar,useCallback:Yb,useContext:ar,useEffect:bg,useImperativeHandle:Kb,useInsertionEffect:qb,useLayoutEffect:Gb,useMemo:Xb,useReducer:Ah,useRef:Wb,useState:function(){return Ah(Fl)},useDebugValue:Cg,useDeferredValue:function(e){var t=lr();return Lt===null?t.memoizedState=e:Jb(t,Lt.memoizedState,e)},useTransition:function(){var e=Ah(Fl)[0],t=lr().memoizedState;return[e,t]},useMutableSource:$b,useSyncExternalStore:Fb,useId:Zb,unstable_isNewReconciler:!1};function la(e,t){try{var n="",r=t;do n+=KR(r),r=r.return;while(r);var o=n}catch(i){o=`
82
- Error generating stack: `+i.message+`
83
- `+i.stack}return{value:e,source:t,stack:o,digest:null}}function Nh(e,t,n){return{value:e,source:null,stack:n??null,digest:t??null}}function Fp(e,t){try{console.error(t.value)}catch(n){setTimeout(function(){throw n})}}var bI=typeof WeakMap=="function"?WeakMap:Map;function rC(e,t,n){n=lo(-1,n),n.tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){od||(od=!0,Kp=r),Fp(e,t)},n}function oC(e,t,n){n=lo(-1,n),n.tag=3;var r=e.type.getDerivedStateFromError;if(typeof r=="function"){var o=t.value;n.payload=function(){return r(o)},n.callback=function(){Fp(e,t)}}var i=e.stateNode;return i!==null&&typeof i.componentDidCatch=="function"&&(n.callback=function(){Fp(e,t),typeof r!="function"&&(ii===null?ii=new Set([this]):ii.add(this));var s=t.stack;this.componentDidCatch(t.value,{componentStack:s!==null?s:""})}),n}function ux(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new bI;var o=new Set;r.set(t,o)}else o=r.get(t),o===void 0&&(o=new Set,r.set(t,o));o.has(n)||(o.add(n),e=MI.bind(null,e,t,n),t.then(e,e))}function dx(e){do{var t;if((t=e.tag===13)&&(t=e.memoizedState,t=t!==null?t.dehydrated!==null:!0),t)return e;e=e.return}while(e!==null);return null}function fx(e,t,n,r,o){return e.mode&1?(e.flags|=65536,e.lanes=o,e):(e===t?e.flags|=65536:(e.flags|=128,n.flags|=131072,n.flags&=-52805,n.tag===1&&(n.alternate===null?n.tag=17:(t=lo(-1,1),t.tag=2,oi(n,t,1))),n.lanes|=1),e)}var CI=Eo.ReactCurrentOwner,kn=!1;function dn(e,t,n,r){t.child=e===null?Mb(t,null,n,r):sa(t,e.child,n,r)}function hx(e,t,n,r,o){n=n.render;var i=t.ref;return Js(t,o),r=wg(e,t,n,r,i,o),n=Sg(),e!==null&&!kn?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~o,go(e,t,o)):(vt&&n&&lg(t),t.flags|=1,dn(e,t,r,o),t.child)}function px(e,t,n,r,o){if(e===null){var i=n.type;return typeof i=="function"&&!Ig(i)&&i.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(t.tag=15,t.type=i,iC(e,t,i,r,o)):(e=Tu(n.type,null,r,t,t.mode,o),e.ref=t.ref,e.return=t,t.child=e)}if(i=e.child,!(e.lanes&o)){var s=i.memoizedProps;if(n=n.compare,n=n!==null?n:_l,n(s,r)&&e.ref===t.ref)return go(e,t,o)}return t.flags|=1,e=ai(i,r),e.ref=t.ref,e.return=t,t.child=e}function iC(e,t,n,r,o){if(e!==null){var i=e.memoizedProps;if(_l(i,r)&&e.ref===t.ref)if(kn=!1,t.pendingProps=r=i,(e.lanes&o)!==0)e.flags&131072&&(kn=!0);else return t.lanes=e.lanes,go(e,t,o)}return zp(e,t,n,r,o)}function sC(e,t,n){var r=t.pendingProps,o=r.children,i=e!==null?e.memoizedState:null;if(r.mode==="hidden")if(!(t.mode&1))t.memoizedState={baseLanes:0,cachePool:null,transitions:null},lt(Vs,zn),zn|=n;else{if(!(n&1073741824))return e=i!==null?i.baseLanes|n:n,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,lt(Vs,zn),zn|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=i!==null?i.baseLanes:n,lt(Vs,zn),zn|=r}else i!==null?(r=i.baseLanes|n,t.memoizedState=null):r=n,lt(Vs,zn),zn|=r;return dn(e,t,o,n),t.child}function aC(e,t){var n=t.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function zp(e,t,n,r,o){var i=Dn(n)?Hi:ln.current;return i=oa(t,i),Js(t,o),n=wg(e,t,n,r,i,o),r=Sg(),e!==null&&!kn?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~o,go(e,t,o)):(vt&&r&&lg(t),t.flags|=1,dn(e,t,n,o),t.child)}function mx(e,t,n,r,o){if(Dn(n)){var i=!0;Qu(t)}else i=!1;if(Js(t,o),t.stateNode===null)Cu(e,t),Nb(t,n,r),$p(t,n,r,o),r=!0;else if(e===null){var s=t.stateNode,l=t.memoizedProps;s.props=l;var c=s.context,u=n.contextType;typeof u=="object"&&u!==null?u=ar(u):(u=Dn(n)?Hi:ln.current,u=oa(t,u));var d=n.getDerivedStateFromProps,f=typeof d=="function"||typeof s.getSnapshotBeforeUpdate=="function";f||typeof s.UNSAFE_componentWillReceiveProps!="function"&&typeof s.componentWillReceiveProps!="function"||(l!==r||c!==u)&&sx(t,s,r,u),Uo=!1;var h=t.memoizedState;s.state=h,Zu(t,r,s,o),c=t.memoizedState,l!==r||h!==c||Rn.current||Uo?(typeof d=="function"&&(Lp(t,n,d,r),c=t.memoizedState),(l=Uo||ix(t,n,l,r,h,c,u))?(f||typeof s.UNSAFE_componentWillMount!="function"&&typeof s.componentWillMount!="function"||(typeof s.componentWillMount=="function"&&s.componentWillMount(),typeof s.UNSAFE_componentWillMount=="function"&&s.UNSAFE_componentWillMount()),typeof s.componentDidMount=="function"&&(t.flags|=4194308)):(typeof s.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=c),s.props=r,s.state=c,s.context=u,r=l):(typeof s.componentDidMount=="function"&&(t.flags|=4194308),r=!1)}else{s=t.stateNode,_b(e,t),l=t.memoizedProps,u=t.type===t.elementType?l:wr(t.type,l),s.props=u,f=t.pendingProps,h=s.context,c=n.contextType,typeof c=="object"&&c!==null?c=ar(c):(c=Dn(n)?Hi:ln.current,c=oa(t,c));var m=n.getDerivedStateFromProps;(d=typeof m=="function"||typeof s.getSnapshotBeforeUpdate=="function")||typeof s.UNSAFE_componentWillReceiveProps!="function"&&typeof s.componentWillReceiveProps!="function"||(l!==f||h!==c)&&sx(t,s,r,c),Uo=!1,h=t.memoizedState,s.state=h,Zu(t,r,s,o);var g=t.memoizedState;l!==f||h!==g||Rn.current||Uo?(typeof m=="function"&&(Lp(t,n,m,r),g=t.memoizedState),(u=Uo||ix(t,n,u,r,h,g,c)||!1)?(d||typeof s.UNSAFE_componentWillUpdate!="function"&&typeof s.componentWillUpdate!="function"||(typeof s.componentWillUpdate=="function"&&s.componentWillUpdate(r,g,c),typeof s.UNSAFE_componentWillUpdate=="function"&&s.UNSAFE_componentWillUpdate(r,g,c)),typeof s.componentDidUpdate=="function"&&(t.flags|=4),typeof s.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof s.componentDidUpdate!="function"||l===e.memoizedProps&&h===e.memoizedState||(t.flags|=4),typeof s.getSnapshotBeforeUpdate!="function"||l===e.memoizedProps&&h===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=g),s.props=r,s.state=g,s.context=c,r=u):(typeof s.componentDidUpdate!="function"||l===e.memoizedProps&&h===e.memoizedState||(t.flags|=4),typeof s.getSnapshotBeforeUpdate!="function"||l===e.memoizedProps&&h===e.memoizedState||(t.flags|=1024),r=!1)}return Bp(e,t,n,r,i,o)}function Bp(e,t,n,r,o,i){aC(e,t);var s=(t.flags&128)!==0;if(!r&&!s)return o&&ex(t,n,!1),go(e,t,i);r=t.stateNode,CI.current=t;var l=s&&typeof n.getDerivedStateFromError!="function"?null:r.render();return t.flags|=1,e!==null&&s?(t.child=sa(t,e.child,null,i),t.child=sa(t,null,l,i)):dn(e,t,l,i),t.memoizedState=r.state,o&&ex(t,n,!0),t.child}function lC(e){var t=e.stateNode;t.pendingContext?Z0(e,t.pendingContext,t.pendingContext!==t.context):t.context&&Z0(e,t.context,!1),gg(e,t.containerInfo)}function gx(e,t,n,r,o){return ia(),ug(o),t.flags|=256,dn(e,t,n,r),t.child}var Up={dehydrated:null,treeContext:null,retryLane:0};function Vp(e){return{baseLanes:e,cachePool:null,transitions:null}}function cC(e,t,n){var r=t.pendingProps,o=bt.current,i=!1,s=(t.flags&128)!==0,l;if((l=s)||(l=e!==null&&e.memoizedState===null?!1:(o&2)!==0),l?(i=!0,t.flags&=-129):(e===null||e.memoizedState!==null)&&(o|=1),lt(bt,o&1),e===null)return Op(t),e=t.memoizedState,e!==null&&(e=e.dehydrated,e!==null)?(t.mode&1?e.data==="$!"?t.lanes=8:t.lanes=1073741824:t.lanes=1,null):(s=r.children,e=r.fallback,i?(r=t.mode,i=t.child,s={mode:"hidden",children:s},!(r&1)&&i!==null?(i.childLanes=0,i.pendingProps=s):i=Wd(s,r,0,null),e=Ui(e,r,n,null),i.return=t,e.return=t,i.sibling=e,t.child=i,t.child.memoizedState=Vp(n),t.memoizedState=Up,e):jg(t,s));if(o=e.memoizedState,o!==null&&(l=o.dehydrated,l!==null))return jI(e,t,s,r,l,o,n);if(i){i=r.fallback,s=t.mode,o=e.child,l=o.sibling;var c={mode:"hidden",children:r.children};return!(s&1)&&t.child!==o?(r=t.child,r.childLanes=0,r.pendingProps=c,t.deletions=null):(r=ai(o,c),r.subtreeFlags=o.subtreeFlags&14680064),l!==null?i=ai(l,i):(i=Ui(i,s,n,null),i.flags|=2),i.return=t,r.return=t,r.sibling=i,t.child=r,r=i,i=t.child,s=e.child.memoizedState,s=s===null?Vp(n):{baseLanes:s.baseLanes|n,cachePool:null,transitions:s.transitions},i.memoizedState=s,i.childLanes=e.childLanes&~n,t.memoizedState=Up,r}return i=e.child,e=i.sibling,r=ai(i,{mode:"visible",children:r.children}),!(t.mode&1)&&(r.lanes=n),r.return=t,r.sibling=null,e!==null&&(n=t.deletions,n===null?(t.deletions=[e],t.flags|=16):n.push(e)),t.child=r,t.memoizedState=null,r}function jg(e,t){return t=Wd({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function tu(e,t,n,r){return r!==null&&ug(r),sa(t,e.child,null,n),e=jg(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function jI(e,t,n,r,o,i,s){if(n)return t.flags&256?(t.flags&=-257,r=Nh(Error(K(422))),tu(e,t,s,r)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(i=r.fallback,o=t.mode,r=Wd({mode:"visible",children:r.children},o,0,null),i=Ui(i,o,s,null),i.flags|=2,r.return=t,i.return=t,r.sibling=i,t.child=r,t.mode&1&&sa(t,e.child,null,s),t.child.memoizedState=Vp(s),t.memoizedState=Up,i);if(!(t.mode&1))return tu(e,t,s,null);if(o.data==="$!"){if(r=o.nextSibling&&o.nextSibling.dataset,r)var l=r.dgst;return r=l,i=Error(K(419)),r=Nh(i,r,void 0),tu(e,t,s,r)}if(l=(s&e.childLanes)!==0,kn||l){if(r=Vt,r!==null){switch(s&-s){case 4:o=2;break;case 16:o=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:o=32;break;case 536870912:o=268435456;break;default:o=0}o=o&(r.suspendedLanes|s)?0:o,o!==0&&o!==i.retryLane&&(i.retryLane=o,mo(e,o),Tr(r,e,o,-1))}return Dg(),r=Nh(Error(K(421))),tu(e,t,s,r)}return o.data==="$?"?(t.flags|=128,t.child=e.child,t=LI.bind(null,e),o._reactRetry=t,null):(e=i.treeContext,Un=ri(o.nextSibling),Hn=t,vt=!0,Cr=null,e!==null&&(nr[rr++]=so,nr[rr++]=ao,nr[rr++]=Wi,so=e.id,ao=e.overflow,Wi=t),t=jg(t,r.children),t.flags|=4096,t)}function yx(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),Mp(e.return,t,n)}function Oh(e,t,n,r,o){var i=e.memoizedState;i===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:o}:(i.isBackwards=t,i.rendering=null,i.renderingStartTime=0,i.last=r,i.tail=n,i.tailMode=o)}function uC(e,t,n){var r=t.pendingProps,o=r.revealOrder,i=r.tail;if(dn(e,t,r.children,n),r=bt.current,r&2)r=r&1|2,t.flags|=128;else{if(e!==null&&e.flags&128)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&yx(e,n,t);else if(e.tag===19)yx(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}r&=1}if(lt(bt,r),!(t.mode&1))t.memoizedState=null;else switch(o){case"forwards":for(n=t.child,o=null;n!==null;)e=n.alternate,e!==null&&ed(e)===null&&(o=n),n=n.sibling;n=o,n===null?(o=t.child,t.child=null):(o=n.sibling,n.sibling=null),Oh(t,!1,o,n,i);break;case"backwards":for(n=null,o=t.child,t.child=null;o!==null;){if(e=o.alternate,e!==null&&ed(e)===null){t.child=o;break}e=o.sibling,o.sibling=n,n=o,o=e}Oh(t,!0,n,null,i);break;case"together":Oh(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function Cu(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function go(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),Gi|=t.lanes,!(n&t.childLanes))return null;if(e!==null&&t.child!==e.child)throw Error(K(153));if(t.child!==null){for(e=t.child,n=ai(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=ai(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function EI(e,t,n){switch(t.tag){case 3:lC(t),ia();break;case 5:Lb(t);break;case 1:Dn(t.type)&&Qu(t);break;case 4:gg(t,t.stateNode.containerInfo);break;case 10:var r=t.type._context,o=t.memoizedProps.value;lt(Xu,r._currentValue),r._currentValue=o;break;case 13:if(r=t.memoizedState,r!==null)return r.dehydrated!==null?(lt(bt,bt.current&1),t.flags|=128,null):n&t.child.childLanes?cC(e,t,n):(lt(bt,bt.current&1),e=go(e,t,n),e!==null?e.sibling:null);lt(bt,bt.current&1);break;case 19:if(r=(n&t.childLanes)!==0,e.flags&128){if(r)return uC(e,t,n);t.flags|=128}if(o=t.memoizedState,o!==null&&(o.rendering=null,o.tail=null,o.lastEffect=null),lt(bt,bt.current),r)break;return null;case 22:case 23:return t.lanes=0,sC(e,t,n)}return go(e,t,n)}var dC,Hp,fC,hC;dC=function(e,t){for(var n=t.child;n!==null;){if(n.tag===5||n.tag===6)e.appendChild(n.stateNode);else if(n.tag!==4&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===t)break;for(;n.sibling===null;){if(n.return===null||n.return===t)return;n=n.return}n.sibling.return=n.return,n=n.sibling}};Hp=function(){};fC=function(e,t,n,r){var o=e.memoizedProps;if(o!==r){e=t.stateNode,Li(Qr.current);var i=null;switch(n){case"input":o=fp(e,o),r=fp(e,r),i=[];break;case"select":o=jt({},o,{value:void 0}),r=jt({},r,{value:void 0}),i=[];break;case"textarea":o=mp(e,o),r=mp(e,r),i=[];break;default:typeof o.onClick!="function"&&typeof r.onClick=="function"&&(e.onclick=qu)}yp(n,r);var s;n=null;for(u in o)if(!r.hasOwnProperty(u)&&o.hasOwnProperty(u)&&o[u]!=null)if(u==="style"){var l=o[u];for(s in l)l.hasOwnProperty(s)&&(n||(n={}),n[s]="")}else u!=="dangerouslySetInnerHTML"&&u!=="children"&&u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&u!=="autoFocus"&&(El.hasOwnProperty(u)?i||(i=[]):(i=i||[]).push(u,null));for(u in r){var c=r[u];if(l=o!=null?o[u]:void 0,r.hasOwnProperty(u)&&c!==l&&(c!=null||l!=null))if(u==="style")if(l){for(s in l)!l.hasOwnProperty(s)||c&&c.hasOwnProperty(s)||(n||(n={}),n[s]="");for(s in c)c.hasOwnProperty(s)&&l[s]!==c[s]&&(n||(n={}),n[s]=c[s])}else n||(i||(i=[]),i.push(u,n)),n=c;else u==="dangerouslySetInnerHTML"?(c=c?c.__html:void 0,l=l?l.__html:void 0,c!=null&&l!==c&&(i=i||[]).push(u,c)):u==="children"?typeof c!="string"&&typeof c!="number"||(i=i||[]).push(u,""+c):u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&(El.hasOwnProperty(u)?(c!=null&&u==="onScroll"&&dt("scroll",e),i||l===c||(i=[])):(i=i||[]).push(u,c))}n&&(i=i||[]).push("style",n);var u=i;(t.updateQueue=u)&&(t.flags|=4)}};hC=function(e,t,n,r){n!==r&&(t.flags|=4)};function Qa(e,t){if(!vt)switch(e.tailMode){case"hidden":t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case"collapsed":n=e.tail;for(var r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null}}function on(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var o=e.child;o!==null;)n|=o.lanes|o.childLanes,r|=o.subtreeFlags&14680064,r|=o.flags&14680064,o.return=e,o=o.sibling;else for(o=e.child;o!==null;)n|=o.lanes|o.childLanes,r|=o.subtreeFlags,r|=o.flags,o.return=e,o=o.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function TI(e,t,n){var r=t.pendingProps;switch(cg(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return on(t),null;case 1:return Dn(t.type)&&Gu(),on(t),null;case 3:return r=t.stateNode,aa(),pt(Rn),pt(ln),vg(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(e===null||e.child===null)&&(Zc(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,Cr!==null&&(Jp(Cr),Cr=null))),Hp(e,t),on(t),null;case 5:yg(t);var o=Li(Ll.current);if(n=t.type,e!==null&&t.stateNode!=null)fC(e,t,n,r,o),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!r){if(t.stateNode===null)throw Error(K(166));return on(t),null}if(e=Li(Qr.current),Zc(t)){r=t.stateNode,n=t.type;var i=t.memoizedProps;switch(r[Wr]=t,r[Ol]=i,e=(t.mode&1)!==0,n){case"dialog":dt("cancel",r),dt("close",r);break;case"iframe":case"object":case"embed":dt("load",r);break;case"video":case"audio":for(o=0;o<cl.length;o++)dt(cl[o],r);break;case"source":dt("error",r);break;case"img":case"image":case"link":dt("error",r),dt("load",r);break;case"details":dt("toggle",r);break;case"input":T0(r,i),dt("invalid",r);break;case"select":r._wrapperState={wasMultiple:!!i.multiple},dt("invalid",r);break;case"textarea":k0(r,i),dt("invalid",r)}yp(n,i),o=null;for(var s in i)if(i.hasOwnProperty(s)){var l=i[s];s==="children"?typeof l=="string"?r.textContent!==l&&(i.suppressHydrationWarning!==!0&&Jc(r.textContent,l,e),o=["children",l]):typeof l=="number"&&r.textContent!==""+l&&(i.suppressHydrationWarning!==!0&&Jc(r.textContent,l,e),o=["children",""+l]):El.hasOwnProperty(s)&&l!=null&&s==="onScroll"&&dt("scroll",r)}switch(n){case"input":Hc(r),P0(r,i,!0);break;case"textarea":Hc(r),R0(r);break;case"select":case"option":break;default:typeof i.onClick=="function"&&(r.onclick=qu)}r=o,t.updateQueue=r,r!==null&&(t.flags|=4)}else{s=o.nodeType===9?o:o.ownerDocument,e==="http://www.w3.org/1999/xhtml"&&(e=zS(n)),e==="http://www.w3.org/1999/xhtml"?n==="script"?(e=s.createElement("div"),e.innerHTML="<script><\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=s.createElement(n,{is:r.is}):(e=s.createElement(n),n==="select"&&(s=e,r.multiple?s.multiple=!0:r.size&&(s.size=r.size))):e=s.createElementNS(e,n),e[Wr]=t,e[Ol]=r,dC(e,t,!1,!1),t.stateNode=e;e:{switch(s=vp(n,r),n){case"dialog":dt("cancel",e),dt("close",e),o=r;break;case"iframe":case"object":case"embed":dt("load",e),o=r;break;case"video":case"audio":for(o=0;o<cl.length;o++)dt(cl[o],e);o=r;break;case"source":dt("error",e),o=r;break;case"img":case"image":case"link":dt("error",e),dt("load",e),o=r;break;case"details":dt("toggle",e),o=r;break;case"input":T0(e,r),o=fp(e,r),dt("invalid",e);break;case"option":o=r;break;case"select":e._wrapperState={wasMultiple:!!r.multiple},o=jt({},r,{value:void 0}),dt("invalid",e);break;case"textarea":k0(e,r),o=mp(e,r),dt("invalid",e);break;default:o=r}yp(n,o),l=o;for(i in l)if(l.hasOwnProperty(i)){var c=l[i];i==="style"?VS(e,c):i==="dangerouslySetInnerHTML"?(c=c?c.__html:void 0,c!=null&&BS(e,c)):i==="children"?typeof c=="string"?(n!=="textarea"||c!=="")&&Tl(e,c):typeof c=="number"&&Tl(e,""+c):i!=="suppressContentEditableWarning"&&i!=="suppressHydrationWarning"&&i!=="autoFocus"&&(El.hasOwnProperty(i)?c!=null&&i==="onScroll"&&dt("scroll",e):c!=null&&Qm(e,i,c,s))}switch(n){case"input":Hc(e),P0(e,r,!1);break;case"textarea":Hc(e),R0(e);break;case"option":r.value!=null&&e.setAttribute("value",""+ui(r.value));break;case"select":e.multiple=!!r.multiple,i=r.value,i!=null?Qs(e,!!r.multiple,i,!1):r.defaultValue!=null&&Qs(e,!!r.multiple,r.defaultValue,!0);break;default:typeof o.onClick=="function"&&(e.onclick=qu)}switch(n){case"button":case"input":case"select":case"textarea":r=!!r.autoFocus;break e;case"img":r=!0;break e;default:r=!1}}r&&(t.flags|=4)}t.ref!==null&&(t.flags|=512,t.flags|=2097152)}return on(t),null;case 6:if(e&&t.stateNode!=null)hC(e,t,e.memoizedProps,r);else{if(typeof r!="string"&&t.stateNode===null)throw Error(K(166));if(n=Li(Ll.current),Li(Qr.current),Zc(t)){if(r=t.stateNode,n=t.memoizedProps,r[Wr]=t,(i=r.nodeValue!==n)&&(e=Hn,e!==null))switch(e.tag){case 3:Jc(r.nodeValue,n,(e.mode&1)!==0);break;case 5:e.memoizedProps.suppressHydrationWarning!==!0&&Jc(r.nodeValue,n,(e.mode&1)!==0)}i&&(t.flags|=4)}else r=(n.nodeType===9?n:n.ownerDocument).createTextNode(r),r[Wr]=t,t.stateNode=r}return on(t),null;case 13:if(pt(bt),r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(vt&&Un!==null&&t.mode&1&&!(t.flags&128))Db(),ia(),t.flags|=98560,i=!1;else if(i=Zc(t),r!==null&&r.dehydrated!==null){if(e===null){if(!i)throw Error(K(318));if(i=t.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(K(317));i[Wr]=t}else ia(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;on(t),i=!1}else Cr!==null&&(Jp(Cr),Cr=null),i=!0;if(!i)return t.flags&65536?t:null}return t.flags&128?(t.lanes=n,t):(r=r!==null,r!==(e!==null&&e.memoizedState!==null)&&r&&(t.child.flags|=8192,t.mode&1&&(e===null||bt.current&1?$t===0&&($t=3):Dg())),t.updateQueue!==null&&(t.flags|=4),on(t),null);case 4:return aa(),Hp(e,t),e===null&&Al(t.stateNode.containerInfo),on(t),null;case 10:return hg(t.type._context),on(t),null;case 17:return Dn(t.type)&&Gu(),on(t),null;case 19:if(pt(bt),i=t.memoizedState,i===null)return on(t),null;if(r=(t.flags&128)!==0,s=i.rendering,s===null)if(r)Qa(i,!1);else{if($t!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(s=ed(e),s!==null){for(t.flags|=128,Qa(i,!1),r=s.updateQueue,r!==null&&(t.updateQueue=r,t.flags|=4),t.subtreeFlags=0,r=n,n=t.child;n!==null;)i=n,e=r,i.flags&=14680066,s=i.alternate,s===null?(i.childLanes=0,i.lanes=e,i.child=null,i.subtreeFlags=0,i.memoizedProps=null,i.memoizedState=null,i.updateQueue=null,i.dependencies=null,i.stateNode=null):(i.childLanes=s.childLanes,i.lanes=s.lanes,i.child=s.child,i.subtreeFlags=0,i.deletions=null,i.memoizedProps=s.memoizedProps,i.memoizedState=s.memoizedState,i.updateQueue=s.updateQueue,i.type=s.type,e=s.dependencies,i.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext}),n=n.sibling;return lt(bt,bt.current&1|2),t.child}e=e.sibling}i.tail!==null&&_t()>ca&&(t.flags|=128,r=!0,Qa(i,!1),t.lanes=4194304)}else{if(!r)if(e=ed(s),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),Qa(i,!0),i.tail===null&&i.tailMode==="hidden"&&!s.alternate&&!vt)return on(t),null}else 2*_t()-i.renderingStartTime>ca&&n!==1073741824&&(t.flags|=128,r=!0,Qa(i,!1),t.lanes=4194304);i.isBackwards?(s.sibling=t.child,t.child=s):(n=i.last,n!==null?n.sibling=s:t.child=s,i.last=s)}return i.tail!==null?(t=i.tail,i.rendering=t,i.tail=t.sibling,i.renderingStartTime=_t(),t.sibling=null,n=bt.current,lt(bt,r?n&1|2:n&1),t):(on(t),null);case 22:case 23:return Rg(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?zn&1073741824&&(on(t),t.subtreeFlags&6&&(t.flags|=8192)):on(t),null;case 24:return null;case 25:return null}throw Error(K(156,t.tag))}function PI(e,t){switch(cg(t),t.tag){case 1:return Dn(t.type)&&Gu(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return aa(),pt(Rn),pt(ln),vg(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return yg(t),null;case 13:if(pt(bt),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(K(340));ia()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return pt(bt),null;case 4:return aa(),null;case 10:return hg(t.type._context),null;case 22:case 23:return Rg(),null;case 24:return null;default:return null}}var nu=!1,sn=!1,kI=typeof WeakSet=="function"?WeakSet:Set,oe=null;function Us(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){Pt(e,t,r)}else n.current=null}function Wp(e,t,n){try{n()}catch(r){Pt(e,t,r)}}var vx=!1;function RI(e,t){if(kp=Vu,e=yb(),ag(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var o=r.anchorOffset,i=r.focusNode;r=r.focusOffset;try{n.nodeType,i.nodeType}catch{n=null;break e}var s=0,l=-1,c=-1,u=0,d=0,f=e,h=null;t:for(;;){for(var m;f!==n||o!==0&&f.nodeType!==3||(l=s+o),f!==i||r!==0&&f.nodeType!==3||(c=s+r),f.nodeType===3&&(s+=f.nodeValue.length),(m=f.firstChild)!==null;)h=f,f=m;for(;;){if(f===e)break t;if(h===n&&++u===o&&(l=s),h===i&&++d===r&&(c=s),(m=f.nextSibling)!==null)break;f=h,h=f.parentNode}f=m}n=l===-1||c===-1?null:{start:l,end:c}}else n=null}n=n||{start:0,end:0}}else n=null;for(Rp={focusedElem:e,selectionRange:n},Vu=!1,oe=t;oe!==null;)if(t=oe,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,oe=e;else for(;oe!==null;){t=oe;try{var g=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(g!==null){var y=g.memoizedProps,C=g.memoizedState,v=t.stateNode,x=v.getSnapshotBeforeUpdate(t.elementType===t.type?y:wr(t.type,y),C);v.__reactInternalSnapshotBeforeUpdate=x}break;case 3:var w=t.stateNode.containerInfo;w.nodeType===1?w.textContent="":w.nodeType===9&&w.documentElement&&w.removeChild(w.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(K(163))}}catch(S){Pt(t,t.return,S)}if(e=t.sibling,e!==null){e.return=t.return,oe=e;break}oe=t.return}return g=vx,vx=!1,g}function xl(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var o=r=r.next;do{if((o.tag&e)===e){var i=o.destroy;o.destroy=void 0,i!==void 0&&Wp(t,n,i)}o=o.next}while(o!==r)}}function Vd(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function qp(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t=="function"?t(e):t.current=e}}function pC(e){var t=e.alternate;t!==null&&(e.alternate=null,pC(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Wr],delete t[Ol],delete t[_p],delete t[dI],delete t[fI])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function mC(e){return e.tag===5||e.tag===3||e.tag===4}function xx(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||mC(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Gp(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=qu));else if(r!==4&&(e=e.child,e!==null))for(Gp(e,t,n),e=e.sibling;e!==null;)Gp(e,t,n),e=e.sibling}function Qp(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(Qp(e,t,n),e=e.sibling;e!==null;)Qp(e,t,n),e=e.sibling}var qt=null,Sr=!1;function Fo(e,t,n){for(n=n.child;n!==null;)gC(e,t,n),n=n.sibling}function gC(e,t,n){if(Gr&&typeof Gr.onCommitFiberUnmount=="function")try{Gr.onCommitFiberUnmount(Od,n)}catch{}switch(n.tag){case 5:sn||Us(n,t);case 6:var r=qt,o=Sr;qt=null,Fo(e,t,n),qt=r,Sr=o,qt!==null&&(Sr?(e=qt,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):qt.removeChild(n.stateNode));break;case 18:qt!==null&&(Sr?(e=qt,n=n.stateNode,e.nodeType===8?kh(e.parentNode,n):e.nodeType===1&&kh(e,n),Dl(e)):kh(qt,n.stateNode));break;case 4:r=qt,o=Sr,qt=n.stateNode.containerInfo,Sr=!0,Fo(e,t,n),qt=r,Sr=o;break;case 0:case 11:case 14:case 15:if(!sn&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){o=r=r.next;do{var i=o,s=i.destroy;i=i.tag,s!==void 0&&(i&2||i&4)&&Wp(n,t,s),o=o.next}while(o!==r)}Fo(e,t,n);break;case 1:if(!sn&&(Us(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(l){Pt(n,t,l)}Fo(e,t,n);break;case 21:Fo(e,t,n);break;case 22:n.mode&1?(sn=(r=sn)||n.memoizedState!==null,Fo(e,t,n),sn=r):Fo(e,t,n);break;default:Fo(e,t,n)}}function wx(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new kI),t.forEach(function(r){var o=$I.bind(null,e,r);n.has(r)||(n.add(r),r.then(o,o))})}}function yr(e,t){var n=t.deletions;if(n!==null)for(var r=0;r<n.length;r++){var o=n[r];try{var i=e,s=t,l=s;e:for(;l!==null;){switch(l.tag){case 5:qt=l.stateNode,Sr=!1;break e;case 3:qt=l.stateNode.containerInfo,Sr=!0;break e;case 4:qt=l.stateNode.containerInfo,Sr=!0;break e}l=l.return}if(qt===null)throw Error(K(160));gC(i,s,o),qt=null,Sr=!1;var c=o.alternate;c!==null&&(c.return=null),o.return=null}catch(u){Pt(o,t,u)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)yC(t,e),t=t.sibling}function yC(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(yr(t,e),Fr(e),r&4){try{xl(3,e,e.return),Vd(3,e)}catch(y){Pt(e,e.return,y)}try{xl(5,e,e.return)}catch(y){Pt(e,e.return,y)}}break;case 1:yr(t,e),Fr(e),r&512&&n!==null&&Us(n,n.return);break;case 5:if(yr(t,e),Fr(e),r&512&&n!==null&&Us(n,n.return),e.flags&32){var o=e.stateNode;try{Tl(o,"")}catch(y){Pt(e,e.return,y)}}if(r&4&&(o=e.stateNode,o!=null)){var i=e.memoizedProps,s=n!==null?n.memoizedProps:i,l=e.type,c=e.updateQueue;if(e.updateQueue=null,c!==null)try{l==="input"&&i.type==="radio"&&i.name!=null&&$S(o,i),vp(l,s);var u=vp(l,i);for(s=0;s<c.length;s+=2){var d=c[s],f=c[s+1];d==="style"?VS(o,f):d==="dangerouslySetInnerHTML"?BS(o,f):d==="children"?Tl(o,f):Qm(o,d,f,u)}switch(l){case"input":hp(o,i);break;case"textarea":FS(o,i);break;case"select":var h=o._wrapperState.wasMultiple;o._wrapperState.wasMultiple=!!i.multiple;var m=i.value;m!=null?Qs(o,!!i.multiple,m,!1):h!==!!i.multiple&&(i.defaultValue!=null?Qs(o,!!i.multiple,i.defaultValue,!0):Qs(o,!!i.multiple,i.multiple?[]:"",!1))}o[Ol]=i}catch(y){Pt(e,e.return,y)}}break;case 6:if(yr(t,e),Fr(e),r&4){if(e.stateNode===null)throw Error(K(162));o=e.stateNode,i=e.memoizedProps;try{o.nodeValue=i}catch(y){Pt(e,e.return,y)}}break;case 3:if(yr(t,e),Fr(e),r&4&&n!==null&&n.memoizedState.isDehydrated)try{Dl(t.containerInfo)}catch(y){Pt(e,e.return,y)}break;case 4:yr(t,e),Fr(e);break;case 13:yr(t,e),Fr(e),o=e.child,o.flags&8192&&(i=o.memoizedState!==null,o.stateNode.isHidden=i,!i||o.alternate!==null&&o.alternate.memoizedState!==null||(Pg=_t())),r&4&&wx(e);break;case 22:if(d=n!==null&&n.memoizedState!==null,e.mode&1?(sn=(u=sn)||d,yr(t,e),sn=u):yr(t,e),Fr(e),r&8192){if(u=e.memoizedState!==null,(e.stateNode.isHidden=u)&&!d&&e.mode&1)for(oe=e,d=e.child;d!==null;){for(f=oe=d;oe!==null;){switch(h=oe,m=h.child,h.tag){case 0:case 11:case 14:case 15:xl(4,h,h.return);break;case 1:Us(h,h.return);var g=h.stateNode;if(typeof g.componentWillUnmount=="function"){r=h,n=h.return;try{t=r,g.props=t.memoizedProps,g.state=t.memoizedState,g.componentWillUnmount()}catch(y){Pt(r,n,y)}}break;case 5:Us(h,h.return);break;case 22:if(h.memoizedState!==null){bx(f);continue}}m!==null?(m.return=h,oe=m):bx(f)}d=d.sibling}e:for(d=null,f=e;;){if(f.tag===5){if(d===null){d=f;try{o=f.stateNode,u?(i=o.style,typeof i.setProperty=="function"?i.setProperty("display","none","important"):i.display="none"):(l=f.stateNode,c=f.memoizedProps.style,s=c!=null&&c.hasOwnProperty("display")?c.display:null,l.style.display=US("display",s))}catch(y){Pt(e,e.return,y)}}}else if(f.tag===6){if(d===null)try{f.stateNode.nodeValue=u?"":f.memoizedProps}catch(y){Pt(e,e.return,y)}}else if((f.tag!==22&&f.tag!==23||f.memoizedState===null||f===e)&&f.child!==null){f.child.return=f,f=f.child;continue}if(f===e)break e;for(;f.sibling===null;){if(f.return===null||f.return===e)break e;d===f&&(d=null),f=f.return}d===f&&(d=null),f.sibling.return=f.return,f=f.sibling}}break;case 19:yr(t,e),Fr(e),r&4&&wx(e);break;case 21:break;default:yr(t,e),Fr(e)}}function Fr(e){var t=e.flags;if(t&2){try{e:{for(var n=e.return;n!==null;){if(mC(n)){var r=n;break e}n=n.return}throw Error(K(160))}switch(r.tag){case 5:var o=r.stateNode;r.flags&32&&(Tl(o,""),r.flags&=-33);var i=xx(e);Qp(e,i,o);break;case 3:case 4:var s=r.stateNode.containerInfo,l=xx(e);Gp(e,l,s);break;default:throw Error(K(161))}}catch(c){Pt(e,e.return,c)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function DI(e,t,n){oe=e,vC(e)}function vC(e,t,n){for(var r=(e.mode&1)!==0;oe!==null;){var o=oe,i=o.child;if(o.tag===22&&r){var s=o.memoizedState!==null||nu;if(!s){var l=o.alternate,c=l!==null&&l.memoizedState!==null||sn;l=nu;var u=sn;if(nu=s,(sn=c)&&!u)for(oe=o;oe!==null;)s=oe,c=s.child,s.tag===22&&s.memoizedState!==null?Cx(o):c!==null?(c.return=s,oe=c):Cx(o);for(;i!==null;)oe=i,vC(i),i=i.sibling;oe=o,nu=l,sn=u}Sx(e)}else o.subtreeFlags&8772&&i!==null?(i.return=o,oe=i):Sx(e)}}function Sx(e){for(;oe!==null;){var t=oe;if(t.flags&8772){var n=t.alternate;try{if(t.flags&8772)switch(t.tag){case 0:case 11:case 15:sn||Vd(5,t);break;case 1:var r=t.stateNode;if(t.flags&4&&!sn)if(n===null)r.componentDidMount();else{var o=t.elementType===t.type?n.memoizedProps:wr(t.type,n.memoizedProps);r.componentDidUpdate(o,n.memoizedState,r.__reactInternalSnapshotBeforeUpdate)}var i=t.updateQueue;i!==null&&ox(t,i,r);break;case 3:var s=t.updateQueue;if(s!==null){if(n=null,t.child!==null)switch(t.child.tag){case 5:n=t.child.stateNode;break;case 1:n=t.child.stateNode}ox(t,s,n)}break;case 5:var l=t.stateNode;if(n===null&&t.flags&4){n=l;var c=t.memoizedProps;switch(t.type){case"button":case"input":case"select":case"textarea":c.autoFocus&&n.focus();break;case"img":c.src&&(n.src=c.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(t.memoizedState===null){var u=t.alternate;if(u!==null){var d=u.memoizedState;if(d!==null){var f=d.dehydrated;f!==null&&Dl(f)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(K(163))}sn||t.flags&512&&qp(t)}catch(h){Pt(t,t.return,h)}}if(t===e){oe=null;break}if(n=t.sibling,n!==null){n.return=t.return,oe=n;break}oe=t.return}}function bx(e){for(;oe!==null;){var t=oe;if(t===e){oe=null;break}var n=t.sibling;if(n!==null){n.return=t.return,oe=n;break}oe=t.return}}function Cx(e){for(;oe!==null;){var t=oe;try{switch(t.tag){case 0:case 11:case 15:var n=t.return;try{Vd(4,t)}catch(c){Pt(t,n,c)}break;case 1:var r=t.stateNode;if(typeof r.componentDidMount=="function"){var o=t.return;try{r.componentDidMount()}catch(c){Pt(t,o,c)}}var i=t.return;try{qp(t)}catch(c){Pt(t,i,c)}break;case 5:var s=t.return;try{qp(t)}catch(c){Pt(t,s,c)}}}catch(c){Pt(t,t.return,c)}if(t===e){oe=null;break}var l=t.sibling;if(l!==null){l.return=t.return,oe=l;break}oe=t.return}}var II=Math.ceil,rd=Eo.ReactCurrentDispatcher,Eg=Eo.ReactCurrentOwner,ir=Eo.ReactCurrentBatchConfig,qe=0,Vt=null,Ot=null,Jt=0,zn=0,Vs=vi(0),$t=0,Bl=null,Gi=0,Hd=0,Tg=0,wl=null,Pn=null,Pg=0,ca=1/0,oo=null,od=!1,Kp=null,ii=null,ru=!1,Yo=null,id=0,Sl=0,Yp=null,ju=-1,Eu=0;function mn(){return qe&6?_t():ju!==-1?ju:ju=_t()}function si(e){return e.mode&1?qe&2&&Jt!==0?Jt&-Jt:pI.transition!==null?(Eu===0&&(Eu=tb()),Eu):(e=Ke,e!==0||(e=window.event,e=e===void 0?16:lb(e.type)),e):1}function Tr(e,t,n,r){if(50<Sl)throw Sl=0,Yp=null,Error(K(185));nc(e,n,r),(!(qe&2)||e!==Vt)&&(e===Vt&&(!(qe&2)&&(Hd|=n),$t===4&&Go(e,Jt)),In(e,r),n===1&&qe===0&&!(t.mode&1)&&(ca=_t()+500,zd&&xi()))}function In(e,t){var n=e.callbackNode;pD(e,t);var r=Uu(e,e===Vt?Jt:0);if(r===0)n!==null&&_0(n),e.callbackNode=null,e.callbackPriority=0;else if(t=r&-r,e.callbackPriority!==t){if(n!=null&&_0(n),t===1)e.tag===0?hI(jx.bind(null,e)):Pb(jx.bind(null,e)),cI(function(){!(qe&6)&&xi()}),n=null;else{switch(nb(r)){case 1:n=Zm;break;case 4:n=ZS;break;case 16:n=Bu;break;case 536870912:n=eb;break;default:n=Bu}n=TC(n,xC.bind(null,e))}e.callbackPriority=t,e.callbackNode=n}}function xC(e,t){if(ju=-1,Eu=0,qe&6)throw Error(K(327));var n=e.callbackNode;if(Zs()&&e.callbackNode!==n)return null;var r=Uu(e,e===Vt?Jt:0);if(r===0)return null;if(r&30||r&e.expiredLanes||t)t=sd(e,r);else{t=r;var o=qe;qe|=2;var i=SC();(Vt!==e||Jt!==t)&&(oo=null,ca=_t()+500,Bi(e,t));do try{NI();break}catch(l){wC(e,l)}while(!0);fg(),rd.current=i,qe=o,Ot!==null?t=0:(Vt=null,Jt=0,t=$t)}if(t!==0){if(t===2&&(o=Cp(e),o!==0&&(r=o,t=Xp(e,o))),t===1)throw n=Bl,Bi(e,0),Go(e,r),In(e,_t()),n;if(t===6)Go(e,r);else{if(o=e.current.alternate,!(r&30)&&!_I(o)&&(t=sd(e,r),t===2&&(i=Cp(e),i!==0&&(r=i,t=Xp(e,i))),t===1))throw n=Bl,Bi(e,0),Go(e,r),In(e,_t()),n;switch(e.finishedWork=o,e.finishedLanes=r,t){case 0:case 1:throw Error(K(345));case 2:Di(e,Pn,oo);break;case 3:if(Go(e,r),(r&130023424)===r&&(t=Pg+500-_t(),10<t)){if(Uu(e,0)!==0)break;if(o=e.suspendedLanes,(o&r)!==r){mn(),e.pingedLanes|=e.suspendedLanes&o;break}e.timeoutHandle=Ip(Di.bind(null,e,Pn,oo),t);break}Di(e,Pn,oo);break;case 4:if(Go(e,r),(r&4194240)===r)break;for(t=e.eventTimes,o=-1;0<r;){var s=31-Er(r);i=1<<s,s=t[s],s>o&&(o=s),r&=~i}if(r=o,r=_t()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*II(r/1960))-r,10<r){e.timeoutHandle=Ip(Di.bind(null,e,Pn,oo),r);break}Di(e,Pn,oo);break;case 5:Di(e,Pn,oo);break;default:throw Error(K(329))}}}return In(e,_t()),e.callbackNode===n?xC.bind(null,e):null}function Xp(e,t){var n=wl;return e.current.memoizedState.isDehydrated&&(Bi(e,t).flags|=256),e=sd(e,t),e!==2&&(t=Pn,Pn=n,t!==null&&Jp(t)),e}function Jp(e){Pn===null?Pn=e:Pn.push.apply(Pn,e)}function _I(e){for(var t=e;;){if(t.flags&16384){var n=t.updateQueue;if(n!==null&&(n=n.stores,n!==null))for(var r=0;r<n.length;r++){var o=n[r],i=o.getSnapshot;o=o.value;try{if(!kr(i(),o))return!1}catch{return!1}}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function Go(e,t){for(t&=~Tg,t&=~Hd,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var n=31-Er(t),r=1<<n;e[n]=-1,t&=~r}}function jx(e){if(qe&6)throw Error(K(327));Zs();var t=Uu(e,0);if(!(t&1))return In(e,_t()),null;var n=sd(e,t);if(e.tag!==0&&n===2){var r=Cp(e);r!==0&&(t=r,n=Xp(e,r))}if(n===1)throw n=Bl,Bi(e,0),Go(e,t),In(e,_t()),n;if(n===6)throw Error(K(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,Di(e,Pn,oo),In(e,_t()),null}function kg(e,t){var n=qe;qe|=1;try{return e(t)}finally{qe=n,qe===0&&(ca=_t()+500,zd&&xi())}}function Qi(e){Yo!==null&&Yo.tag===0&&!(qe&6)&&Zs();var t=qe;qe|=1;var n=ir.transition,r=Ke;try{if(ir.transition=null,Ke=1,e)return e()}finally{Ke=r,ir.transition=n,qe=t,!(qe&6)&&xi()}}function Rg(){zn=Vs.current,pt(Vs)}function Bi(e,t){e.finishedWork=null,e.finishedLanes=0;var n=e.timeoutHandle;if(n!==-1&&(e.timeoutHandle=-1,lI(n)),Ot!==null)for(n=Ot.return;n!==null;){var r=n;switch(cg(r),r.tag){case 1:r=r.type.childContextTypes,r!=null&&Gu();break;case 3:aa(),pt(Rn),pt(ln),vg();break;case 5:yg(r);break;case 4:aa();break;case 13:pt(bt);break;case 19:pt(bt);break;case 10:hg(r.type._context);break;case 22:case 23:Rg()}n=n.return}if(Vt=e,Ot=e=ai(e.current,null),Jt=zn=t,$t=0,Bl=null,Tg=Hd=Gi=0,Pn=wl=null,Mi!==null){for(t=0;t<Mi.length;t++)if(n=Mi[t],r=n.interleaved,r!==null){n.interleaved=null;var o=r.next,i=n.pending;if(i!==null){var s=i.next;i.next=o,r.next=s}n.pending=r}Mi=null}return e}function wC(e,t){do{var n=Ot;try{if(fg(),Su.current=nd,td){for(var r=Ct.memoizedState;r!==null;){var o=r.queue;o!==null&&(o.pending=null),r=r.next}td=!1}if(qi=0,Bt=Lt=Ct=null,vl=!1,$l=0,Eg.current=null,n===null||n.return===null){$t=1,Bl=t,Ot=null;break}e:{var i=e,s=n.return,l=n,c=t;if(t=Jt,l.flags|=32768,c!==null&&typeof c=="object"&&typeof c.then=="function"){var u=c,d=l,f=d.tag;if(!(d.mode&1)&&(f===0||f===11||f===15)){var h=d.alternate;h?(d.updateQueue=h.updateQueue,d.memoizedState=h.memoizedState,d.lanes=h.lanes):(d.updateQueue=null,d.memoizedState=null)}var m=dx(s);if(m!==null){m.flags&=-257,fx(m,s,l,i,t),m.mode&1&&ux(i,u,t),t=m,c=u;var g=t.updateQueue;if(g===null){var y=new Set;y.add(c),t.updateQueue=y}else g.add(c);break e}else{if(!(t&1)){ux(i,u,t),Dg();break e}c=Error(K(426))}}else if(vt&&l.mode&1){var C=dx(s);if(C!==null){!(C.flags&65536)&&(C.flags|=256),fx(C,s,l,i,t),ug(la(c,l));break e}}i=c=la(c,l),$t!==4&&($t=2),wl===null?wl=[i]:wl.push(i),i=s;do{switch(i.tag){case 3:i.flags|=65536,t&=-t,i.lanes|=t;var v=rC(i,c,t);rx(i,v);break e;case 1:l=c;var x=i.type,w=i.stateNode;if(!(i.flags&128)&&(typeof x.getDerivedStateFromError=="function"||w!==null&&typeof w.componentDidCatch=="function"&&(ii===null||!ii.has(w)))){i.flags|=65536,t&=-t,i.lanes|=t;var S=oC(i,l,t);rx(i,S);break e}}i=i.return}while(i!==null)}CC(n)}catch(E){t=E,Ot===n&&n!==null&&(Ot=n=n.return);continue}break}while(!0)}function SC(){var e=rd.current;return rd.current=nd,e===null?nd:e}function Dg(){($t===0||$t===3||$t===2)&&($t=4),Vt===null||!(Gi&268435455)&&!(Hd&268435455)||Go(Vt,Jt)}function sd(e,t){var n=qe;qe|=2;var r=SC();(Vt!==e||Jt!==t)&&(oo=null,Bi(e,t));do try{AI();break}catch(o){wC(e,o)}while(!0);if(fg(),qe=n,rd.current=r,Ot!==null)throw Error(K(261));return Vt=null,Jt=0,$t}function AI(){for(;Ot!==null;)bC(Ot)}function NI(){for(;Ot!==null&&!iD();)bC(Ot)}function bC(e){var t=EC(e.alternate,e,zn);e.memoizedProps=e.pendingProps,t===null?CC(e):Ot=t,Eg.current=null}function CC(e){var t=e;do{var n=t.alternate;if(e=t.return,t.flags&32768){if(n=PI(n,t),n!==null){n.flags&=32767,Ot=n;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{$t=6,Ot=null;return}}else if(n=TI(n,t,zn),n!==null){Ot=n;return}if(t=t.sibling,t!==null){Ot=t;return}Ot=t=e}while(t!==null);$t===0&&($t=5)}function Di(e,t,n){var r=Ke,o=ir.transition;try{ir.transition=null,Ke=1,OI(e,t,n,r)}finally{ir.transition=o,Ke=r}return null}function OI(e,t,n,r){do Zs();while(Yo!==null);if(qe&6)throw Error(K(327));n=e.finishedWork;var o=e.finishedLanes;if(n===null)return null;if(e.finishedWork=null,e.finishedLanes=0,n===e.current)throw Error(K(177));e.callbackNode=null,e.callbackPriority=0;var i=n.lanes|n.childLanes;if(mD(e,i),e===Vt&&(Ot=Vt=null,Jt=0),!(n.subtreeFlags&2064)&&!(n.flags&2064)||ru||(ru=!0,TC(Bu,function(){return Zs(),null})),i=(n.flags&15990)!==0,n.subtreeFlags&15990||i){i=ir.transition,ir.transition=null;var s=Ke;Ke=1;var l=qe;qe|=4,Eg.current=null,RI(e,n),yC(n,e),tI(Rp),Vu=!!kp,Rp=kp=null,e.current=n,DI(n),sD(),qe=l,Ke=s,ir.transition=i}else e.current=n;if(ru&&(ru=!1,Yo=e,id=o),i=e.pendingLanes,i===0&&(ii=null),cD(n.stateNode),In(e,_t()),t!==null)for(r=e.onRecoverableError,n=0;n<t.length;n++)o=t[n],r(o.value,{componentStack:o.stack,digest:o.digest});if(od)throw od=!1,e=Kp,Kp=null,e;return id&1&&e.tag!==0&&Zs(),i=e.pendingLanes,i&1?e===Yp?Sl++:(Sl=0,Yp=e):Sl=0,xi(),null}function Zs(){if(Yo!==null){var e=nb(id),t=ir.transition,n=Ke;try{if(ir.transition=null,Ke=16>e?16:e,Yo===null)var r=!1;else{if(e=Yo,Yo=null,id=0,qe&6)throw Error(K(331));var o=qe;for(qe|=4,oe=e.current;oe!==null;){var i=oe,s=i.child;if(oe.flags&16){var l=i.deletions;if(l!==null){for(var c=0;c<l.length;c++){var u=l[c];for(oe=u;oe!==null;){var d=oe;switch(d.tag){case 0:case 11:case 15:xl(8,d,i)}var f=d.child;if(f!==null)f.return=d,oe=f;else for(;oe!==null;){d=oe;var h=d.sibling,m=d.return;if(pC(d),d===u){oe=null;break}if(h!==null){h.return=m,oe=h;break}oe=m}}}var g=i.alternate;if(g!==null){var y=g.child;if(y!==null){g.child=null;do{var C=y.sibling;y.sibling=null,y=C}while(y!==null)}}oe=i}}if(i.subtreeFlags&2064&&s!==null)s.return=i,oe=s;else e:for(;oe!==null;){if(i=oe,i.flags&2048)switch(i.tag){case 0:case 11:case 15:xl(9,i,i.return)}var v=i.sibling;if(v!==null){v.return=i.return,oe=v;break e}oe=i.return}}var x=e.current;for(oe=x;oe!==null;){s=oe;var w=s.child;if(s.subtreeFlags&2064&&w!==null)w.return=s,oe=w;else e:for(s=x;oe!==null;){if(l=oe,l.flags&2048)try{switch(l.tag){case 0:case 11:case 15:Vd(9,l)}}catch(E){Pt(l,l.return,E)}if(l===s){oe=null;break e}var S=l.sibling;if(S!==null){S.return=l.return,oe=S;break e}oe=l.return}}if(qe=o,xi(),Gr&&typeof Gr.onPostCommitFiberRoot=="function")try{Gr.onPostCommitFiberRoot(Od,e)}catch{}r=!0}return r}finally{Ke=n,ir.transition=t}}return!1}function Ex(e,t,n){t=la(n,t),t=rC(e,t,1),e=oi(e,t,1),t=mn(),e!==null&&(nc(e,1,t),In(e,t))}function Pt(e,t,n){if(e.tag===3)Ex(e,e,n);else for(;t!==null;){if(t.tag===3){Ex(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(ii===null||!ii.has(r))){e=la(n,e),e=oC(t,e,1),t=oi(t,e,1),e=mn(),t!==null&&(nc(t,1,e),In(t,e));break}}t=t.return}}function MI(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),t=mn(),e.pingedLanes|=e.suspendedLanes&n,Vt===e&&(Jt&n)===n&&($t===4||$t===3&&(Jt&130023424)===Jt&&500>_t()-Pg?Bi(e,0):Tg|=n),In(e,t)}function jC(e,t){t===0&&(e.mode&1?(t=Gc,Gc<<=1,!(Gc&130023424)&&(Gc=4194304)):t=1);var n=mn();e=mo(e,t),e!==null&&(nc(e,t,n),In(e,n))}function LI(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),jC(e,n)}function $I(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,o=e.memoizedState;o!==null&&(n=o.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(K(314))}r!==null&&r.delete(t),jC(e,n)}var EC;EC=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||Rn.current)kn=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return kn=!1,EI(e,t,n);kn=!!(e.flags&131072)}else kn=!1,vt&&t.flags&1048576&&kb(t,Yu,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;Cu(e,t),e=t.pendingProps;var o=oa(t,ln.current);Js(t,n),o=wg(null,t,r,e,o,n);var i=Sg();return t.flags|=1,typeof o=="object"&&o!==null&&typeof o.render=="function"&&o.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,Dn(r)?(i=!0,Qu(t)):i=!1,t.memoizedState=o.state!==null&&o.state!==void 0?o.state:null,mg(t),o.updater=Bd,t.stateNode=o,o._reactInternals=t,$p(t,r,e,n),t=Bp(null,t,r,!0,i,n)):(t.tag=0,vt&&i&&lg(t),dn(null,t,o,n),t=t.child),t;case 16:r=t.elementType;e:{switch(Cu(e,t),e=t.pendingProps,o=r._init,r=o(r._payload),t.type=r,o=t.tag=zI(r),e=wr(r,e),o){case 0:t=zp(null,t,r,e,n);break e;case 1:t=mx(null,t,r,e,n);break e;case 11:t=hx(null,t,r,e,n);break e;case 14:t=px(null,t,r,wr(r.type,e),n);break e}throw Error(K(306,r,""))}return t;case 0:return r=t.type,o=t.pendingProps,o=t.elementType===r?o:wr(r,o),zp(e,t,r,o,n);case 1:return r=t.type,o=t.pendingProps,o=t.elementType===r?o:wr(r,o),mx(e,t,r,o,n);case 3:e:{if(lC(t),e===null)throw Error(K(387));r=t.pendingProps,i=t.memoizedState,o=i.element,_b(e,t),Zu(t,r,null,n);var s=t.memoizedState;if(r=s.element,i.isDehydrated)if(i={element:r,isDehydrated:!1,cache:s.cache,pendingSuspenseBoundaries:s.pendingSuspenseBoundaries,transitions:s.transitions},t.updateQueue.baseState=i,t.memoizedState=i,t.flags&256){o=la(Error(K(423)),t),t=gx(e,t,r,n,o);break e}else if(r!==o){o=la(Error(K(424)),t),t=gx(e,t,r,n,o);break e}else for(Un=ri(t.stateNode.containerInfo.firstChild),Hn=t,vt=!0,Cr=null,n=Mb(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(ia(),r===o){t=go(e,t,n);break e}dn(e,t,r,n)}t=t.child}return t;case 5:return Lb(t),e===null&&Op(t),r=t.type,o=t.pendingProps,i=e!==null?e.memoizedProps:null,s=o.children,Dp(r,o)?s=null:i!==null&&Dp(r,i)&&(t.flags|=32),aC(e,t),dn(e,t,s,n),t.child;case 6:return e===null&&Op(t),null;case 13:return cC(e,t,n);case 4:return gg(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=sa(t,null,r,n):dn(e,t,r,n),t.child;case 11:return r=t.type,o=t.pendingProps,o=t.elementType===r?o:wr(r,o),hx(e,t,r,o,n);case 7:return dn(e,t,t.pendingProps,n),t.child;case 8:return dn(e,t,t.pendingProps.children,n),t.child;case 12:return dn(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,o=t.pendingProps,i=t.memoizedProps,s=o.value,lt(Xu,r._currentValue),r._currentValue=s,i!==null)if(kr(i.value,s)){if(i.children===o.children&&!Rn.current){t=go(e,t,n);break e}}else for(i=t.child,i!==null&&(i.return=t);i!==null;){var l=i.dependencies;if(l!==null){s=i.child;for(var c=l.firstContext;c!==null;){if(c.context===r){if(i.tag===1){c=lo(-1,n&-n),c.tag=2;var u=i.updateQueue;if(u!==null){u=u.shared;var d=u.pending;d===null?c.next=c:(c.next=d.next,d.next=c),u.pending=c}}i.lanes|=n,c=i.alternate,c!==null&&(c.lanes|=n),Mp(i.return,n,t),l.lanes|=n;break}c=c.next}}else if(i.tag===10)s=i.type===t.type?null:i.child;else if(i.tag===18){if(s=i.return,s===null)throw Error(K(341));s.lanes|=n,l=s.alternate,l!==null&&(l.lanes|=n),Mp(s,n,t),s=i.sibling}else s=i.child;if(s!==null)s.return=i;else for(s=i;s!==null;){if(s===t){s=null;break}if(i=s.sibling,i!==null){i.return=s.return,s=i;break}s=s.return}i=s}dn(e,t,o.children,n),t=t.child}return t;case 9:return o=t.type,r=t.pendingProps.children,Js(t,n),o=ar(o),r=r(o),t.flags|=1,dn(e,t,r,n),t.child;case 14:return r=t.type,o=wr(r,t.pendingProps),o=wr(r.type,o),px(e,t,r,o,n);case 15:return iC(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,o=t.pendingProps,o=t.elementType===r?o:wr(r,o),Cu(e,t),t.tag=1,Dn(r)?(e=!0,Qu(t)):e=!1,Js(t,n),Nb(t,r,o),$p(t,r,o,n),Bp(null,t,r,!0,e,n);case 19:return uC(e,t,n);case 22:return sC(e,t,n)}throw Error(K(156,t.tag))};function TC(e,t){return JS(e,t)}function FI(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function or(e,t,n,r){return new FI(e,t,n,r)}function Ig(e){return e=e.prototype,!(!e||!e.isReactComponent)}function zI(e){if(typeof e=="function")return Ig(e)?1:0;if(e!=null){if(e=e.$$typeof,e===Ym)return 11;if(e===Xm)return 14}return 2}function ai(e,t){var n=e.alternate;return n===null?(n=or(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function Tu(e,t,n,r,o,i){var s=2;if(r=e,typeof e=="function")Ig(e)&&(s=1);else if(typeof e=="string")s=5;else e:switch(e){case As:return Ui(n.children,o,i,t);case Km:s=8,o|=8;break;case lp:return e=or(12,n,t,o|2),e.elementType=lp,e.lanes=i,e;case cp:return e=or(13,n,t,o),e.elementType=cp,e.lanes=i,e;case up:return e=or(19,n,t,o),e.elementType=up,e.lanes=i,e;case OS:return Wd(n,o,i,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case AS:s=10;break e;case NS:s=9;break e;case Ym:s=11;break e;case Xm:s=14;break e;case Bo:s=16,r=null;break e}throw Error(K(130,e==null?e:typeof e,""))}return t=or(s,n,t,o),t.elementType=e,t.type=r,t.lanes=i,t}function Ui(e,t,n,r){return e=or(7,e,r,t),e.lanes=n,e}function Wd(e,t,n,r){return e=or(22,e,r,t),e.elementType=OS,e.lanes=n,e.stateNode={isHidden:!1},e}function Mh(e,t,n){return e=or(6,e,null,t),e.lanes=n,e}function Lh(e,t,n){return t=or(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function BI(e,t,n,r,o){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=yh(0),this.expirationTimes=yh(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=yh(0),this.identifierPrefix=r,this.onRecoverableError=o,this.mutableSourceEagerHydrationData=null}function _g(e,t,n,r,o,i,s,l,c){return e=new BI(e,t,n,l,c),t===1?(t=1,i===!0&&(t|=8)):t=0,i=or(3,null,null,t),e.current=i,i.stateNode=e,i.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},mg(i),e}function UI(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:_s,key:r==null?null:""+r,children:e,containerInfo:t,implementation:n}}function PC(e){if(!e)return di;e=e._reactInternals;e:{if(is(e)!==e||e.tag!==1)throw Error(K(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if(Dn(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(t!==null);throw Error(K(171))}if(e.tag===1){var n=e.type;if(Dn(n))return Tb(e,n,t)}return t}function kC(e,t,n,r,o,i,s,l,c){return e=_g(n,r,!0,e,o,i,s,l,c),e.context=PC(null),n=e.current,r=mn(),o=si(n),i=lo(r,o),i.callback=t??null,oi(n,i,o),e.current.lanes=o,nc(e,o,r),In(e,r),e}function qd(e,t,n,r){var o=t.current,i=mn(),s=si(o);return n=PC(n),t.context===null?t.context=n:t.pendingContext=n,t=lo(i,s),t.payload={element:e},r=r===void 0?null:r,r!==null&&(t.callback=r),e=oi(o,t,s),e!==null&&(Tr(e,o,s,i),wu(e,o,s)),s}function ad(e){if(e=e.current,!e.child)return null;switch(e.child.tag){case 5:return e.child.stateNode;default:return e.child.stateNode}}function Tx(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function Ag(e,t){Tx(e,t),(e=e.alternate)&&Tx(e,t)}function VI(){return null}var RC=typeof reportError=="function"?reportError:function(e){console.error(e)};function Ng(e){this._internalRoot=e}Gd.prototype.render=Ng.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(K(409));qd(e,t,null,null)};Gd.prototype.unmount=Ng.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;Qi(function(){qd(null,e,null,null)}),t[po]=null}};function Gd(e){this._internalRoot=e}Gd.prototype.unstable_scheduleHydration=function(e){if(e){var t=ib();e={blockedOn:null,target:e,priority:t};for(var n=0;n<qo.length&&t!==0&&t<qo[n].priority;n++);qo.splice(n,0,e),n===0&&ab(e)}};function Og(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function Qd(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==" react-mount-point-unstable "))}function Px(){}function HI(e,t,n,r,o){if(o){if(typeof r=="function"){var i=r;r=function(){var u=ad(s);i.call(u)}}var s=kC(t,r,e,0,null,!1,!1,"",Px);return e._reactRootContainer=s,e[po]=s.current,Al(e.nodeType===8?e.parentNode:e),Qi(),s}for(;o=e.lastChild;)e.removeChild(o);if(typeof r=="function"){var l=r;r=function(){var u=ad(c);l.call(u)}}var c=_g(e,0,!1,null,null,!1,!1,"",Px);return e._reactRootContainer=c,e[po]=c.current,Al(e.nodeType===8?e.parentNode:e),Qi(function(){qd(t,c,n,r)}),c}function Kd(e,t,n,r,o){var i=n._reactRootContainer;if(i){var s=i;if(typeof o=="function"){var l=o;o=function(){var c=ad(s);l.call(c)}}qd(t,s,e,o)}else s=HI(n,t,e,o,r);return ad(s)}rb=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var n=ll(t.pendingLanes);n!==0&&(eg(t,n|1),In(t,_t()),!(qe&6)&&(ca=_t()+500,xi()))}break;case 13:Qi(function(){var r=mo(e,1);if(r!==null){var o=mn();Tr(r,e,1,o)}}),Ag(e,1)}};tg=function(e){if(e.tag===13){var t=mo(e,134217728);if(t!==null){var n=mn();Tr(t,e,134217728,n)}Ag(e,134217728)}};ob=function(e){if(e.tag===13){var t=si(e),n=mo(e,t);if(n!==null){var r=mn();Tr(n,e,t,r)}Ag(e,t)}};ib=function(){return Ke};sb=function(e,t){var n=Ke;try{return Ke=e,t()}finally{Ke=n}};wp=function(e,t,n){switch(t){case"input":if(hp(e,n),t=n.name,n.type==="radio"&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll("input[name="+JSON.stringify(""+t)+'][type="radio"]'),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var o=Fd(r);if(!o)throw Error(K(90));LS(r),hp(r,o)}}}break;case"textarea":FS(e,n);break;case"select":t=n.value,t!=null&&Qs(e,!!n.multiple,t,!1)}};qS=kg;GS=Qi;var WI={usingClientEntryPoint:!1,Events:[oc,Ls,Fd,HS,WS,kg]},Ka={findFiberByHostInstance:Oi,bundleType:0,version:"18.2.0",rendererPackageName:"react-dom"},qI={bundleType:Ka.bundleType,version:Ka.version,rendererPackageName:Ka.rendererPackageName,rendererConfig:Ka.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:Eo.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=YS(e),e===null?null:e.stateNode},findFiberByHostInstance:Ka.findFiberByHostInstance||VI,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.2.0-next-9e3b772b8-20220608"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var ou=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!ou.isDisabled&&ou.supportsFiber)try{Od=ou.inject(qI),Gr=ou}catch{}}Qn.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=WI;Qn.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Og(t))throw Error(K(200));return UI(e,t,null,n)};Qn.createRoot=function(e,t){if(!Og(e))throw Error(K(299));var n=!1,r="",o=RC;return t!=null&&(t.unstable_strictMode===!0&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onRecoverableError!==void 0&&(o=t.onRecoverableError)),t=_g(e,1,!1,null,null,n,!1,r,o),e[po]=t.current,Al(e.nodeType===8?e.parentNode:e),new Ng(t)};Qn.findDOMNode=function(e){if(e==null)return null;if(e.nodeType===1)return e;var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(K(188)):(e=Object.keys(e).join(","),Error(K(268,e)));return e=YS(t),e=e===null?null:e.stateNode,e};Qn.flushSync=function(e){return Qi(e)};Qn.hydrate=function(e,t,n){if(!Qd(t))throw Error(K(200));return Kd(null,e,t,!0,n)};Qn.hydrateRoot=function(e,t,n){if(!Og(e))throw Error(K(405));var r=n!=null&&n.hydratedSources||null,o=!1,i="",s=RC;if(n!=null&&(n.unstable_strictMode===!0&&(o=!0),n.identifierPrefix!==void 0&&(i=n.identifierPrefix),n.onRecoverableError!==void 0&&(s=n.onRecoverableError)),t=kC(t,null,e,1,n??null,o,!1,i,s),e[po]=t.current,Al(e),r)for(e=0;e<r.length;e++)n=r[e],o=n._getVersion,o=o(n._source),t.mutableSourceEagerHydrationData==null?t.mutableSourceEagerHydrationData=[n,o]:t.mutableSourceEagerHydrationData.push(n,o);return new Gd(t)};Qn.render=function(e,t,n){if(!Qd(t))throw Error(K(200));return Kd(null,e,t,!1,n)};Qn.unmountComponentAtNode=function(e){if(!Qd(e))throw Error(K(40));return e._reactRootContainer?(Qi(function(){Kd(null,null,e,!1,function(){e._reactRootContainer=null,e[po]=null})}),!0):!1};Qn.unstable_batchedUpdates=kg;Qn.unstable_renderSubtreeIntoContainer=function(e,t,n,r){if(!Qd(n))throw Error(K(200));if(e==null||e._reactInternals===void 0)throw Error(K(38));return Kd(e,t,n,!1,r)};Qn.version="18.2.0-next-9e3b772b8-20220608";function DC(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(DC)}catch(e){console.error(e)}}DC(),kS.exports=Qn;var sc=kS.exports;const ul=Dm(sc),GI=Bw({__proto__:null,default:ul},[sc]),[QI,dr]=wn("ScrollArea.Root component was not found in tree");function ua(e,t){const n=Ai(t);Ca(()=>{let r=0;if(e){const o=new ResizeObserver(()=>{cancelAnimationFrame(r),r=window.requestAnimationFrame(n)});return o.observe(e),()=>{window.cancelAnimationFrame(r),o.unobserve(e)}}},[e,n])}const KI=b.forwardRef((e,t)=>{const{style:n,...r}=e,o=dr(),[i,s]=b.useState(0),[l,c]=b.useState(0),u=!!(i&&l);return ua(o.scrollbarX,()=>{var f;const d=((f=o.scrollbarX)==null?void 0:f.offsetHeight)||0;o.onCornerHeightChange(d),c(d)}),ua(o.scrollbarY,()=>{var f;const d=((f=o.scrollbarY)==null?void 0:f.offsetWidth)||0;o.onCornerWidthChange(d),s(d)}),u?b.createElement("div",{...r,ref:t,style:{...n,width:i,height:l}}):null}),YI=b.forwardRef((e,t)=>{const n=dr(),r=!!(n.scrollbarX&&n.scrollbarY);return n.type!=="scroll"&&r?b.createElement(KI,{...e,ref:t}):null}),XI={scrollHideDelay:1e3,type:"hover"},IC=p.forwardRef((e,t)=>{const n=V("ScrollAreaRoot",XI,e),{type:r,scrollHideDelay:o,scrollbars:i,...s}=n,[l,c]=p.useState(null),[u,d]=p.useState(null),[f,h]=p.useState(null),[m,g]=p.useState(null),[y,C]=p.useState(null),[v,x]=p.useState(0),[w,S]=p.useState(0),[E,j]=p.useState(!1),[T,P]=p.useState(!1),R=tn(t,I=>c(I));return b.createElement(QI,{value:{type:r,scrollHideDelay:o,scrollArea:l,viewport:u,onViewportChange:d,content:f,onContentChange:h,scrollbarX:m,onScrollbarXChange:g,scrollbarXEnabled:E,onScrollbarXEnabledChange:j,scrollbarY:y,onScrollbarYChange:C,scrollbarYEnabled:T,onScrollbarYEnabledChange:P,onCornerWidthChange:x,onCornerHeightChange:S}},b.createElement(W,{...s,ref:R,__vars:{"--sa-corner-width":i!=="xy"?"0px":`${v}px`,"--sa-corner-height":i!=="xy"?"0px":`${w}px`}}))});IC.displayName="@mantine/core/ScrollAreaRoot";function _C(e,t){const n=e/t;return Number.isNaN(n)?0:n}function Yd(e){const t=_C(e.viewport,e.content),n=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,r=(e.scrollbar.size-n)*t;return Math.max(r,18)}function AC(e,t){return n=>{if(e[0]===e[1]||t[0]===t[1])return t[0];const r=(t[1]-t[0])/(e[1]-e[0]);return t[0]+r*(n-e[0])}}function JI(e,[t,n]){return Math.min(n,Math.max(t,e))}function kx(e,t,n="ltr"){const r=Yd(t),o=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,i=t.scrollbar.size-o,s=t.content-t.viewport,l=i-r,c=n==="ltr"?[0,s]:[s*-1,0],u=JI(e,c);return AC([0,s],[0,l])(u)}function ZI(e,t,n,r="ltr"){const o=Yd(n),i=o/2,s=t||i,l=o-s,c=n.scrollbar.paddingStart+s,u=n.scrollbar.size-n.scrollbar.paddingEnd-l,d=n.content-n.viewport,f=r==="ltr"?[0,d]:[d*-1,0];return AC([c,u],f)(e)}function NC(e,t){return e>0&&e<t}function ld(e){return e?parseInt(e,10):0}function Vi(e,t,{checkForDefaultPrevented:n=!0}={}){return r=>{e==null||e(r),(n===!1||!r.defaultPrevented)&&(t==null||t(r))}}const[e_,OC]=wn("ScrollAreaScrollbar was not found in tree"),MC=p.forwardRef((e,t)=>{const{sizes:n,hasThumb:r,onThumbChange:o,onThumbPointerUp:i,onThumbPointerDown:s,onThumbPositionChange:l,onDragScroll:c,onWheelScroll:u,onResize:d,...f}=e,h=dr(),[m,g]=b.useState(null),y=tn(t,P=>g(P)),C=b.useRef(null),v=b.useRef(""),{viewport:x}=h,w=n.content-n.viewport,S=Ai(u),E=Ai(l),j=_d(d,10),T=P=>{if(C.current){const R=P.clientX-C.current.left,I=P.clientY-C.current.top;c({x:R,y:I})}};return p.useEffect(()=>{const P=R=>{const I=R.target;(m==null?void 0:m.contains(I))&&S(R,w)};return document.addEventListener("wheel",P,{passive:!1}),()=>document.removeEventListener("wheel",P,{passive:!1})},[x,m,w,S]),p.useEffect(E,[n,E]),ua(m,j),ua(h.content,j),b.createElement(e_,{value:{scrollbar:m,hasThumb:r,onThumbChange:Ai(o),onThumbPointerUp:Ai(i),onThumbPositionChange:E,onThumbPointerDown:Ai(s)}},b.createElement("div",{...f,ref:y,style:{position:"absolute",...f.style},onPointerDown:Vi(e.onPointerDown,P=>{P.button===0&&(P.target.setPointerCapture(P.pointerId),C.current=m.getBoundingClientRect(),v.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",T(P))}),onPointerMove:Vi(e.onPointerMove,T),onPointerUp:Vi(e.onPointerUp,P=>{const R=P.target;R.hasPointerCapture(P.pointerId)&&R.releasePointerCapture(P.pointerId),document.body.style.webkitUserSelect=v.current,C.current=null})}))}),t_=p.forwardRef((e,t)=>{const{sizes:n,onSizesChange:r,style:o,...i}=e,s=dr(),[l,c]=p.useState(),u=p.useRef(null),d=tn(t,u,s.onScrollbarXChange);return p.useEffect(()=>{u.current&&c(getComputedStyle(u.current))},[u]),b.createElement(MC,{"data-orientation":"horizontal",...i,ref:d,sizes:n,style:{...o,"--sa-thumb-width":`${Yd(n)}px`},onThumbPointerDown:f=>e.onThumbPointerDown(f.x),onDragScroll:f=>e.onDragScroll(f.x),onWheelScroll:(f,h)=>{if(s.viewport){const m=s.viewport.scrollLeft+f.deltaX;e.onWheelScroll(m),NC(m,h)&&f.preventDefault()}},onResize:()=>{u.current&&s.viewport&&l&&r({content:s.viewport.scrollWidth,viewport:s.viewport.offsetWidth,scrollbar:{size:u.current.clientWidth,paddingStart:ld(l.paddingLeft),paddingEnd:ld(l.paddingRight)}})}})}),n_=p.forwardRef((e,t)=>{const{sizes:n,onSizesChange:r,style:o,...i}=e,s=dr(),[l,c]=b.useState(),u=p.useRef(null),d=tn(t,u,s.onScrollbarYChange);return p.useEffect(()=>{u.current&&c(getComputedStyle(u.current))},[u]),b.createElement(MC,{...i,"data-orientation":"vertical",ref:d,sizes:n,style:{"--sa-thumb-height":`${Yd(n)}px`,...o},onThumbPointerDown:f=>e.onThumbPointerDown(f.y),onDragScroll:f=>e.onDragScroll(f.y),onWheelScroll:(f,h)=>{if(s.viewport){const m=s.viewport.scrollTop+f.deltaY;e.onWheelScroll(m),NC(m,h)&&f.preventDefault()}},onResize:()=>{u.current&&s.viewport&&l&&r({content:s.viewport.scrollHeight,viewport:s.viewport.offsetHeight,scrollbar:{size:u.current.clientHeight,paddingStart:ld(l.paddingTop),paddingEnd:ld(l.paddingBottom)}})}})}),Mg=p.forwardRef((e,t)=>{const{orientation:n="vertical",...r}=e,{dir:o}=Ta(),i=dr(),s=p.useRef(null),l=p.useRef(0),[c,u]=p.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),d=_C(c.viewport,c.content),f={...r,sizes:c,onSizesChange:u,hasThumb:d>0&&d<1,onThumbChange:m=>{s.current=m},onThumbPointerUp:()=>{l.current=0},onThumbPointerDown:m=>{l.current=m}},h=(m,g)=>ZI(m,l.current,c,g);return n==="horizontal"?b.createElement(t_,{...f,ref:t,onThumbPositionChange:()=>{if(i.viewport&&s.current){const m=i.viewport.scrollLeft,g=kx(m,c,o);s.current.style.transform=`translate3d(${g}px, 0, 0)`}},onWheelScroll:m=>{i.viewport&&(i.viewport.scrollLeft=m)},onDragScroll:m=>{i.viewport&&(i.viewport.scrollLeft=h(m,o))}}):n==="vertical"?b.createElement(n_,{...f,ref:t,onThumbPositionChange:()=>{if(i.viewport&&s.current){const m=i.viewport.scrollTop,g=kx(m,c);s.current.style.transform=`translate3d(0, ${g}px, 0)`}},onWheelScroll:m=>{i.viewport&&(i.viewport.scrollTop=m)},onDragScroll:m=>{i.viewport&&(i.viewport.scrollTop=h(m))}}):null}),LC=p.forwardRef((e,t)=>{const n=dr(),{forceMount:r,...o}=e,[i,s]=p.useState(!1),l=e.orientation==="horizontal",c=_d(()=>{if(n.viewport){const u=n.viewport.offsetWidth<n.viewport.scrollWidth,d=n.viewport.offsetHeight<n.viewport.scrollHeight;s(l?u:d)}},10);return ua(n.viewport,c),ua(n.content,c),r||i?b.createElement(Mg,{"data-state":i?"visible":"hidden",...o,ref:t}):null}),r_=p.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=dr(),[i,s]=p.useState(!1);return p.useEffect(()=>{const{scrollArea:l}=o;let c=0;if(l){const u=()=>{window.clearTimeout(c),s(!0)},d=()=>{c=window.setTimeout(()=>s(!1),o.scrollHideDelay)};return l.addEventListener("pointerenter",u),l.addEventListener("pointerleave",d),()=>{window.clearTimeout(c),l.removeEventListener("pointerenter",u),l.removeEventListener("pointerleave",d)}}},[o.scrollArea,o.scrollHideDelay]),n||i?b.createElement(LC,{"data-state":i?"visible":"hidden",...r,ref:t}):null}),o_=p.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=dr(),i=e.orientation==="horizontal",[s,l]=p.useState("hidden"),c=_d(()=>l("idle"),100);return p.useEffect(()=>{if(s==="idle"){const u=window.setTimeout(()=>l("hidden"),o.scrollHideDelay);return()=>window.clearTimeout(u)}},[s,o.scrollHideDelay]),p.useEffect(()=>{const{viewport:u}=o,d=i?"scrollLeft":"scrollTop";if(u){let f=u[d];const h=()=>{const m=u[d];f!==m&&(l("scrolling"),c()),f=m};return u.addEventListener("scroll",h),()=>u.removeEventListener("scroll",h)}},[o.viewport,i,c]),n||s!=="hidden"?b.createElement(Mg,{"data-state":s==="hidden"?"hidden":"visible",...r,ref:t,onPointerEnter:Vi(e.onPointerEnter,()=>l("interacting")),onPointerLeave:Vi(e.onPointerLeave,()=>l("idle"))}):null}),Rx=b.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=dr(),{onScrollbarXEnabledChange:i,onScrollbarYEnabledChange:s}=o,l=e.orientation==="horizontal";return b.useEffect(()=>(l?i(!0):s(!0),()=>{l?i(!1):s(!1)}),[l,i,s]),o.type==="hover"?b.createElement(r_,{...r,ref:t,forceMount:n}):o.type==="scroll"?b.createElement(o_,{...r,ref:t,forceMount:n}):o.type==="auto"?b.createElement(LC,{...r,ref:t,forceMount:n}):o.type==="always"?b.createElement(Mg,{...r,ref:t}):null});function i_(e,t=()=>{}){let n={left:e.scrollLeft,top:e.scrollTop},r=0;return function o(){const i={left:e.scrollLeft,top:e.scrollTop},s=n.left!==i.left,l=n.top!==i.top;(s||l)&&t(),n=i,r=window.requestAnimationFrame(o)}(),()=>window.cancelAnimationFrame(r)}const s_=p.forwardRef((e,t)=>{const{style:n,...r}=e,o=dr(),i=OC(),{onThumbPositionChange:s}=i,l=tn(t,d=>i.onThumbChange(d)),c=p.useRef(),u=_d(()=>{c.current&&(c.current(),c.current=void 0)},100);return p.useEffect(()=>{const{viewport:d}=o;if(d){const f=()=>{if(u(),!c.current){const h=i_(d,s);c.current=h,s()}};return s(),d.addEventListener("scroll",f),()=>d.removeEventListener("scroll",f)}},[o.viewport,u,s]),b.createElement("div",{"data-state":i.hasThumb?"visible":"hidden",...r,ref:l,style:{width:"var(--sa-thumb-width)",height:"var(--sa-thumb-height)",...n},onPointerDownCapture:Vi(e.onPointerDownCapture,d=>{const h=d.target.getBoundingClientRect(),m=d.clientX-h.left,g=d.clientY-h.top;i.onThumbPointerDown({x:m,y:g})}),onPointerUp:Vi(e.onPointerUp,i.onThumbPointerUp)})}),Dx=b.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=OC();return n||o.hasThumb?b.createElement(s_,{ref:t,...r}):null}),$C=p.forwardRef(({children:e,style:t,...n},r)=>{const o=dr(),i=tn(r,o.onViewportChange);return b.createElement(W,{...n,ref:i,style:{overflowX:o.scrollbarXEnabled?"scroll":"hidden",overflowY:o.scrollbarYEnabled?"scroll":"hidden",...t}},b.createElement("div",{style:{minWidth:"100%",display:"table"},ref:o.onContentChange},e))});$C.displayName="@mantine/core/ScrollAreaViewport";var Lg={root:"m-d57069b5",viewport:"m-c0783ff9",viewportInner:"m-f8f631dd",scrollbar:"m-c44ba933",thumb:"m-d8b5e363",corner:"m-21657268"};const FC={scrollHideDelay:1e3,type:"hover",scrollbars:"xy"},a_=(e,{scrollbarSize:t})=>({root:{"--scrollarea-scrollbar-size":$(t)}}),fr=G((e,t)=>{const n=V("ScrollArea",FC,e),{classNames:r,className:o,style:i,styles:s,unstyled:l,scrollbarSize:c,vars:u,type:d,scrollHideDelay:f,viewportProps:h,viewportRef:m,onScrollPositionChange:g,children:y,offsetScrollbars:C,scrollbars:v,...x}=n,[w,S]=p.useState(!1),E=ue({name:"ScrollArea",props:n,classes:Lg,className:o,style:i,classNames:r,styles:s,unstyled:l,vars:u,varsResolver:a_});return b.createElement(IC,{type:d==="never"?"always":d,scrollHideDelay:f,ref:t,scrollbars:v,...E("root"),...x},b.createElement($C,{...h,...E("viewport"),ref:m,"data-offset-scrollbars":C===!0?"xy":C||void 0,"data-scrollbars":v||void 0,onScroll:typeof g=="function"?({currentTarget:j})=>g({x:j.scrollLeft,y:j.scrollTop}):void 0},y),(v==="xy"||v==="x")&&b.createElement(Rx,{...E("scrollbar"),orientation:"horizontal","data-hidden":d==="never"||void 0,forceMount:!0,onMouseEnter:()=>S(!0),onMouseLeave:()=>S(!1)},b.createElement(Dx,{...E("thumb")})),(v==="xy"||v==="y")&&b.createElement(Rx,{...E("scrollbar"),orientation:"vertical","data-hidden":d==="never"||void 0,forceMount:!0,onMouseEnter:()=>S(!0),onMouseLeave:()=>S(!1)},b.createElement(Dx,{...E("thumb")})),b.createElement(YI,{...E("corner"),"data-hovered":w||void 0,"data-hidden":d==="never"||void 0}))});fr.displayName="@mantine/core/ScrollArea";const $g=G((e,t)=>{const{children:n,classNames:r,styles:o,scrollbarSize:i,scrollHideDelay:s,type:l,dir:c,offsetScrollbars:u,viewportRef:d,onScrollPositionChange:f,unstyled:h,variant:m,viewportProps:g,scrollbars:y,style:C,vars:v,...x}=V("ScrollAreaAutosize",FC,e);return b.createElement(W,{...x,ref:t,style:[{display:"flex",overflow:"auto"},C]},b.createElement(W,{style:{display:"flex",flexDirection:"column",flex:1}},b.createElement(fr,{classNames:r,styles:o,scrollHideDelay:s,scrollbarSize:i,type:l,dir:c,offsetScrollbars:u,viewportRef:d,onScrollPositionChange:f,unstyled:h,variant:m,viewportProps:g,vars:v,scrollbars:y},n)))});fr.classes=Lg;$g.displayName="@mantine/core/ScrollAreaAutosize";$g.classes=Lg;fr.Autosize=$g;var zC={root:"m-87cf2631"};const l_={__staticSelector:"UnstyledButton"},Gn=cn((e,t)=>{const n=V("UnstyledButton",l_,e),{className:r,component:o="button",__staticSelector:i,unstyled:s,classNames:l,styles:c,style:u,...d}=n,f=ue({name:i,props:n,classes:zC,className:r,style:u,classNames:l,styles:c,unstyled:s});return b.createElement(W,{...f("root",{focusable:!0}),component:o,ref:t,type:o==="button"?"button":void 0,...d})});Gn.classes=zC;Gn.displayName="@mantine/core/UnstyledButton";var BC={root:"m-1b7284a3"};const c_={},u_=(e,{radius:t,shadow:n})=>({root:{"--paper-radius":t===void 0?void 0:gt(t),"--paper-shadow":Lm(n)}}),_n=cn((e,t)=>{const n=V("Paper",c_,e),{classNames:r,className:o,style:i,styles:s,unstyled:l,withBorder:c,vars:u,radius:d,shadow:f,variant:h,...m}=n,g=ue({name:"Paper",props:n,classes:BC,className:o,style:i,classNames:r,styles:s,unstyled:l,vars:u,varsResolver:u_});return b.createElement(W,{ref:t,mod:{"data-with-border":c},...g("root"),variant:h,...m})});_n.classes=BC;_n.displayName="@mantine/core/Paper";const Rr=Math.min,an=Math.max,cd=Math.round,iu=Math.floor,fi=e=>({x:e,y:e}),d_={left:"right",right:"left",bottom:"top",top:"bottom"},f_={start:"end",end:"start"};function Zp(e,t,n){return an(e,Rr(t,n))}function yo(e,t){return typeof e=="function"?e(t):e}function Dr(e){return e.split("-")[0]}function Ra(e){return e.split("-")[1]}function Fg(e){return e==="x"?"y":"x"}function zg(e){return e==="y"?"height":"width"}function ss(e){return["top","bottom"].includes(Dr(e))?"y":"x"}function Bg(e){return Fg(ss(e))}function h_(e,t,n){n===void 0&&(n=!1);const r=Ra(e),o=Bg(e),i=zg(o);let s=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[i]>t.floating[i]&&(s=ud(s)),[s,ud(s)]}function p_(e){const t=ud(e);return[em(e),t,em(t)]}function em(e){return e.replace(/start|end/g,t=>f_[t])}function m_(e,t,n){const r=["left","right"],o=["right","left"],i=["top","bottom"],s=["bottom","top"];switch(e){case"top":case"bottom":return n?t?o:r:t?r:o;case"left":case"right":return t?i:s;default:return[]}}function g_(e,t,n,r){const o=Ra(e);let i=m_(Dr(e),n==="start",r);return o&&(i=i.map(s=>s+"-"+o),t&&(i=i.concat(i.map(em)))),i}function ud(e){return e.replace(/left|right|bottom|top/g,t=>d_[t])}function y_(e){return{top:0,right:0,bottom:0,left:0,...e}}function Ug(e){return typeof e!="number"?y_(e):{top:e,right:e,bottom:e,left:e}}function da(e){return{...e,top:e.y,left:e.x,right:e.x+e.width,bottom:e.y+e.height}}function Ix(e,t,n){let{reference:r,floating:o}=e;const i=ss(t),s=Bg(t),l=zg(s),c=Dr(t),u=i==="y",d=r.x+r.width/2-o.width/2,f=r.y+r.height/2-o.height/2,h=r[l]/2-o[l]/2;let m;switch(c){case"top":m={x:d,y:r.y-o.height};break;case"bottom":m={x:d,y:r.y+r.height};break;case"right":m={x:r.x+r.width,y:f};break;case"left":m={x:r.x-o.width,y:f};break;default:m={x:r.x,y:r.y}}switch(Ra(t)){case"start":m[s]-=h*(n&&u?-1:1);break;case"end":m[s]+=h*(n&&u?-1:1);break}return m}const v_=async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:i=[],platform:s}=n,l=i.filter(Boolean),c=await(s.isRTL==null?void 0:s.isRTL(t));let u=await s.getElementRects({reference:e,floating:t,strategy:o}),{x:d,y:f}=Ix(u,r,c),h=r,m={},g=0;for(let y=0;y<l.length;y++){const{name:C,fn:v}=l[y],{x,y:w,data:S,reset:E}=await v({x:d,y:f,initialPlacement:r,placement:h,strategy:o,middlewareData:m,rects:u,platform:s,elements:{reference:e,floating:t}});if(d=x??d,f=w??f,m={...m,[C]:{...m[C],...S}},E&&g<=50){g++,typeof E=="object"&&(E.placement&&(h=E.placement),E.rects&&(u=E.rects===!0?await s.getElementRects({reference:e,floating:t,strategy:o}):E.rects),{x:d,y:f}=Ix(u,h,c)),y=-1;continue}}return{x:d,y:f,placement:h,strategy:o,middlewareData:m}};async function Vg(e,t){var n;t===void 0&&(t={});const{x:r,y:o,platform:i,rects:s,elements:l,strategy:c}=e,{boundary:u="clippingAncestors",rootBoundary:d="viewport",elementContext:f="floating",altBoundary:h=!1,padding:m=0}=yo(t,e),g=Ug(m),C=l[h?f==="floating"?"reference":"floating":f],v=da(await i.getClippingRect({element:(n=await(i.isElement==null?void 0:i.isElement(C)))==null||n?C:C.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(l.floating)),boundary:u,rootBoundary:d,strategy:c})),x=f==="floating"?{...s.floating,x:r,y:o}:s.reference,w=await(i.getOffsetParent==null?void 0:i.getOffsetParent(l.floating)),S=await(i.isElement==null?void 0:i.isElement(w))?await(i.getScale==null?void 0:i.getScale(w))||{x:1,y:1}:{x:1,y:1},E=da(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({rect:x,offsetParent:w,strategy:c}):x);return{top:(v.top-E.top+g.top)/S.y,bottom:(E.bottom-v.bottom+g.bottom)/S.y,left:(v.left-E.left+g.left)/S.x,right:(E.right-v.right+g.right)/S.x}}const x_=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:o,rects:i,platform:s,elements:l,middlewareData:c}=t,{element:u,padding:d=0}=yo(e,t)||{};if(u==null)return{};const f=Ug(d),h={x:n,y:r},m=Bg(o),g=zg(m),y=await s.getDimensions(u),C=m==="y",v=C?"top":"left",x=C?"bottom":"right",w=C?"clientHeight":"clientWidth",S=i.reference[g]+i.reference[m]-h[m]-i.floating[g],E=h[m]-i.reference[m],j=await(s.getOffsetParent==null?void 0:s.getOffsetParent(u));let T=j?j[w]:0;(!T||!await(s.isElement==null?void 0:s.isElement(j)))&&(T=l.floating[w]||i.floating[g]);const P=S/2-E/2,R=T/2-y[g]/2-1,I=Rr(f[v],R),O=Rr(f[x],R),D=I,A=T-y[g]-O,M=T/2-y[g]/2+P,B=Zp(D,M,A),F=!c.arrow&&Ra(o)!=null&&M!=B&&i.reference[g]/2-(M<D?I:O)-y[g]/2<0,_=F?M<D?M-D:M-A:0;return{[m]:h[m]+_,data:{[m]:B,centerOffset:M-B-_,...F&&{alignmentOffset:_}},reset:F}}}),w_=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:o,middlewareData:i,rects:s,initialPlacement:l,platform:c,elements:u}=t,{mainAxis:d=!0,crossAxis:f=!0,fallbackPlacements:h,fallbackStrategy:m="bestFit",fallbackAxisSideDirection:g="none",flipAlignment:y=!0,...C}=yo(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const v=Dr(o),x=Dr(l)===l,w=await(c.isRTL==null?void 0:c.isRTL(u.floating)),S=h||(x||!y?[ud(l)]:p_(l));!h&&g!=="none"&&S.push(...g_(l,y,g,w));const E=[l,...S],j=await Vg(t,C),T=[];let P=((r=i.flip)==null?void 0:r.overflows)||[];if(d&&T.push(j[v]),f){const D=h_(o,s,w);T.push(j[D[0]],j[D[1]])}if(P=[...P,{placement:o,overflows:T}],!T.every(D=>D<=0)){var R,I;const D=(((R=i.flip)==null?void 0:R.index)||0)+1,A=E[D];if(A)return{data:{index:D,overflows:P},reset:{placement:A}};let M=(I=P.filter(B=>B.overflows[0]<=0).sort((B,F)=>B.overflows[1]-F.overflows[1])[0])==null?void 0:I.placement;if(!M)switch(m){case"bestFit":{var O;const B=(O=P.map(F=>[F.placement,F.overflows.filter(_=>_>0).reduce((_,k)=>_+k,0)]).sort((F,_)=>F[1]-_[1])[0])==null?void 0:O[0];B&&(M=B);break}case"initialPlacement":M=l;break}if(o!==M)return{reset:{placement:M}}}return{}}}};function UC(e){const t=Rr(...e.map(i=>i.left)),n=Rr(...e.map(i=>i.top)),r=an(...e.map(i=>i.right)),o=an(...e.map(i=>i.bottom));return{x:t,y:n,width:r-t,height:o-n}}function S_(e){const t=e.slice().sort((o,i)=>o.y-i.y),n=[];let r=null;for(let o=0;o<t.length;o++){const i=t[o];!r||i.y-r.y>r.height/2?n.push([i]):n[n.length-1].push(i),r=i}return n.map(o=>da(UC(o)))}const b_=function(e){return e===void 0&&(e={}),{name:"inline",options:e,async fn(t){const{placement:n,elements:r,rects:o,platform:i,strategy:s}=t,{padding:l=2,x:c,y:u}=yo(e,t),d=Array.from(await(i.getClientRects==null?void 0:i.getClientRects(r.reference))||[]),f=S_(d),h=da(UC(d)),m=Ug(l);function g(){if(f.length===2&&f[0].left>f[1].right&&c!=null&&u!=null)return f.find(C=>c>C.left-m.left&&c<C.right+m.right&&u>C.top-m.top&&u<C.bottom+m.bottom)||h;if(f.length>=2){if(ss(n)==="y"){const I=f[0],O=f[f.length-1],D=Dr(n)==="top",A=I.top,M=O.bottom,B=D?I.left:O.left,F=D?I.right:O.right,_=F-B,k=M-A;return{top:A,bottom:M,left:B,right:F,width:_,height:k,x:B,y:A}}const C=Dr(n)==="left",v=an(...f.map(I=>I.right)),x=Rr(...f.map(I=>I.left)),w=f.filter(I=>C?I.left===x:I.right===v),S=w[0].top,E=w[w.length-1].bottom,j=x,T=v,P=T-j,R=E-S;return{top:S,bottom:E,left:j,right:T,width:P,height:R,x:j,y:S}}return h}const y=await i.getElementRects({reference:{getBoundingClientRect:g},floating:r.floating,strategy:s});return o.reference.x!==y.reference.x||o.reference.y!==y.reference.y||o.reference.width!==y.reference.width||o.reference.height!==y.reference.height?{reset:{rects:y}}:{}}}};async function C_(e,t){const{placement:n,platform:r,elements:o}=e,i=await(r.isRTL==null?void 0:r.isRTL(o.floating)),s=Dr(n),l=Ra(n),c=ss(n)==="y",u=["left","top"].includes(s)?-1:1,d=i&&c?-1:1,f=yo(t,e);let{mainAxis:h,crossAxis:m,alignmentAxis:g}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:0,crossAxis:0,alignmentAxis:null,...f};return l&&typeof g=="number"&&(m=l==="end"?g*-1:g),c?{x:m*d,y:h*u}:{x:h*u,y:m*d}}const VC=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:o,y:i,placement:s,middlewareData:l}=t,c=await C_(t,e);return s===((n=l.offset)==null?void 0:n.placement)&&(r=l.arrow)!=null&&r.alignmentOffset?{}:{x:o+c.x,y:i+c.y,data:{...c,placement:s}}}}},j_=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o}=t,{mainAxis:i=!0,crossAxis:s=!1,limiter:l={fn:C=>{let{x:v,y:x}=C;return{x:v,y:x}}},...c}=yo(e,t),u={x:n,y:r},d=await Vg(t,c),f=ss(Dr(o)),h=Fg(f);let m=u[h],g=u[f];if(i){const C=h==="y"?"top":"left",v=h==="y"?"bottom":"right",x=m+d[C],w=m-d[v];m=Zp(x,m,w)}if(s){const C=f==="y"?"top":"left",v=f==="y"?"bottom":"right",x=g+d[C],w=g-d[v];g=Zp(x,g,w)}const y=l.fn({...t,[h]:m,[f]:g});return{...y,data:{x:y.x-n,y:y.y-r}}}}},E_=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:o,rects:i,middlewareData:s}=t,{offset:l=0,mainAxis:c=!0,crossAxis:u=!0}=yo(e,t),d={x:n,y:r},f=ss(o),h=Fg(f);let m=d[h],g=d[f];const y=yo(l,t),C=typeof y=="number"?{mainAxis:y,crossAxis:0}:{mainAxis:0,crossAxis:0,...y};if(c){const w=h==="y"?"height":"width",S=i.reference[h]-i.floating[w]+C.mainAxis,E=i.reference[h]+i.reference[w]-C.mainAxis;m<S?m=S:m>E&&(m=E)}if(u){var v,x;const w=h==="y"?"width":"height",S=["top","left"].includes(Dr(o)),E=i.reference[f]-i.floating[w]+(S&&((v=s.offset)==null?void 0:v[f])||0)+(S?0:C.crossAxis),j=i.reference[f]+i.reference[w]+(S?0:((x=s.offset)==null?void 0:x[f])||0)-(S?C.crossAxis:0);g<E?g=E:g>j&&(g=j)}return{[h]:m,[f]:g}}}},T_=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){const{placement:n,rects:r,platform:o,elements:i}=t,{apply:s=()=>{},...l}=yo(e,t),c=await Vg(t,l),u=Dr(n),d=Ra(n),f=ss(n)==="y",{width:h,height:m}=r.floating;let g,y;u==="top"||u==="bottom"?(g=u,y=d===(await(o.isRTL==null?void 0:o.isRTL(i.floating))?"start":"end")?"left":"right"):(y=u,g=d==="end"?"top":"bottom");const C=m-c[g],v=h-c[y],x=!t.middlewareData.shift;let w=C,S=v;if(f){const j=h-c.left-c.right;S=d||x?Rr(v,j):j}else{const j=m-c.top-c.bottom;w=d||x?Rr(C,j):j}if(x&&!d){const j=an(c.left,0),T=an(c.right,0),P=an(c.top,0),R=an(c.bottom,0);f?S=h-2*(j!==0||T!==0?j+T:an(c.left,c.right)):w=m-2*(P!==0||R!==0?P+R:an(c.top,c.bottom))}await s({...t,availableWidth:S,availableHeight:w});const E=await o.getDimensions(i.floating);return h!==E.width||m!==E.height?{reset:{rects:!0}}:{}}}};function hi(e){return HC(e)?(e.nodeName||"").toLowerCase():"#document"}function Wn(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function To(e){var t;return(t=(HC(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function HC(e){return e instanceof Node||e instanceof Wn(e).Node}function vo(e){return e instanceof Element||e instanceof Wn(e).Element}function Zr(e){return e instanceof HTMLElement||e instanceof Wn(e).HTMLElement}function _x(e){return typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Wn(e).ShadowRoot}function ac(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=cr(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!["inline","contents"].includes(o)}function P_(e){return["table","td","th"].includes(hi(e))}function Hg(e){const t=Wg(),n=cr(e);return n.transform!=="none"||n.perspective!=="none"||(n.containerType?n.containerType!=="normal":!1)||!t&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!t&&(n.filter?n.filter!=="none":!1)||["transform","perspective","filter"].some(r=>(n.willChange||"").includes(r))||["paint","layout","strict","content"].some(r=>(n.contain||"").includes(r))}function k_(e){let t=fa(e);for(;Zr(t)&&!Xd(t);){if(Hg(t))return t;t=fa(t)}return null}function Wg(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function Xd(e){return["html","body","#document"].includes(hi(e))}function cr(e){return Wn(e).getComputedStyle(e)}function Jd(e){return vo(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.pageXOffset,scrollTop:e.pageYOffset}}function fa(e){if(hi(e)==="html")return e;const t=e.assignedSlot||e.parentNode||_x(e)&&e.host||To(e);return _x(t)?t.host:t}function WC(e){const t=fa(e);return Xd(t)?e.ownerDocument?e.ownerDocument.body:e.body:Zr(t)&&ac(t)?t:WC(t)}function co(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=WC(e),i=o===((r=e.ownerDocument)==null?void 0:r.body),s=Wn(o);return i?t.concat(s,s.visualViewport||[],ac(o)?o:[],s.frameElement&&n?co(s.frameElement):[]):t.concat(o,co(o,[],n))}function qC(e){const t=cr(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=Zr(e),i=o?e.offsetWidth:n,s=o?e.offsetHeight:r,l=cd(n)!==i||cd(r)!==s;return l&&(n=i,r=s),{width:n,height:r,$:l}}function qg(e){return vo(e)?e:e.contextElement}function ea(e){const t=qg(e);if(!Zr(t))return fi(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:i}=qC(t);let s=(i?cd(n.width):n.width)/r,l=(i?cd(n.height):n.height)/o;return(!s||!Number.isFinite(s))&&(s=1),(!l||!Number.isFinite(l))&&(l=1),{x:s,y:l}}const R_=fi(0);function GC(e){const t=Wn(e);return!Wg()||!t.visualViewport?R_:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function D_(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Wn(e)?!1:t}function Ki(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),i=qg(e);let s=fi(1);t&&(r?vo(r)&&(s=ea(r)):s=ea(e));const l=D_(i,n,r)?GC(i):fi(0);let c=(o.left+l.x)/s.x,u=(o.top+l.y)/s.y,d=o.width/s.x,f=o.height/s.y;if(i){const h=Wn(i),m=r&&vo(r)?Wn(r):r;let g=h.frameElement;for(;g&&r&&m!==h;){const y=ea(g),C=g.getBoundingClientRect(),v=cr(g),x=C.left+(g.clientLeft+parseFloat(v.paddingLeft))*y.x,w=C.top+(g.clientTop+parseFloat(v.paddingTop))*y.y;c*=y.x,u*=y.y,d*=y.x,f*=y.y,c+=x,u+=w,g=Wn(g).frameElement}}return da({width:d,height:f,x:c,y:u})}function I_(e){let{rect:t,offsetParent:n,strategy:r}=e;const o=Zr(n),i=To(n);if(n===i)return t;let s={scrollLeft:0,scrollTop:0},l=fi(1);const c=fi(0);if((o||!o&&r!=="fixed")&&((hi(n)!=="body"||ac(i))&&(s=Jd(n)),Zr(n))){const u=Ki(n);l=ea(n),c.x=u.x+n.clientLeft,c.y=u.y+n.clientTop}return{width:t.width*l.x,height:t.height*l.y,x:t.x*l.x-s.scrollLeft*l.x+c.x,y:t.y*l.y-s.scrollTop*l.y+c.y}}function __(e){return Array.from(e.getClientRects())}function QC(e){return Ki(To(e)).left+Jd(e).scrollLeft}function A_(e){const t=To(e),n=Jd(e),r=e.ownerDocument.body,o=an(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),i=an(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let s=-n.scrollLeft+QC(e);const l=-n.scrollTop;return cr(r).direction==="rtl"&&(s+=an(t.clientWidth,r.clientWidth)-o),{width:o,height:i,x:s,y:l}}function N_(e,t){const n=Wn(e),r=To(e),o=n.visualViewport;let i=r.clientWidth,s=r.clientHeight,l=0,c=0;if(o){i=o.width,s=o.height;const u=Wg();(!u||u&&t==="fixed")&&(l=o.offsetLeft,c=o.offsetTop)}return{width:i,height:s,x:l,y:c}}function O_(e,t){const n=Ki(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,i=Zr(e)?ea(e):fi(1),s=e.clientWidth*i.x,l=e.clientHeight*i.y,c=o*i.x,u=r*i.y;return{width:s,height:l,x:c,y:u}}function Ax(e,t,n){let r;if(t==="viewport")r=N_(e,n);else if(t==="document")r=A_(To(e));else if(vo(t))r=O_(t,n);else{const o=GC(e);r={...t,x:t.x-o.x,y:t.y-o.y}}return da(r)}function KC(e,t){const n=fa(e);return n===t||!vo(n)||Xd(n)?!1:cr(n).position==="fixed"||KC(n,t)}function M_(e,t){const n=t.get(e);if(n)return n;let r=co(e,[],!1).filter(l=>vo(l)&&hi(l)!=="body"),o=null;const i=cr(e).position==="fixed";let s=i?fa(e):e;for(;vo(s)&&!Xd(s);){const l=cr(s),c=Hg(s);!c&&l.position==="fixed"&&(o=null),(i?!c&&!o:!c&&l.position==="static"&&!!o&&["absolute","fixed"].includes(o.position)||ac(s)&&!c&&KC(e,s))?r=r.filter(d=>d!==s):o=l,s=fa(s)}return t.set(e,r),r}function L_(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const s=[...n==="clippingAncestors"?M_(t,this._c):[].concat(n),r],l=s[0],c=s.reduce((u,d)=>{const f=Ax(t,d,o);return u.top=an(f.top,u.top),u.right=Rr(f.right,u.right),u.bottom=Rr(f.bottom,u.bottom),u.left=an(f.left,u.left),u},Ax(t,l,o));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function $_(e){const{width:t,height:n}=qC(e);return{width:t,height:n}}function F_(e,t,n){const r=Zr(t),o=To(t),i=n==="fixed",s=Ki(e,!0,i,t);let l={scrollLeft:0,scrollTop:0};const c=fi(0);if(r||!r&&!i)if((hi(t)!=="body"||ac(o))&&(l=Jd(t)),r){const u=Ki(t,!0,i,t);c.x=u.x+t.clientLeft,c.y=u.y+t.clientTop}else o&&(c.x=QC(o));return{x:s.left+l.scrollLeft-c.x,y:s.top+l.scrollTop-c.y,width:s.width,height:s.height}}function Nx(e,t){return!Zr(e)||cr(e).position==="fixed"?null:t?t(e):e.offsetParent}function YC(e,t){const n=Wn(e);if(!Zr(e))return n;let r=Nx(e,t);for(;r&&P_(r)&&cr(r).position==="static";)r=Nx(r,t);return r&&(hi(r)==="html"||hi(r)==="body"&&cr(r).position==="static"&&!Hg(r))?n:r||k_(e)||n}const z_=async function(e){let{reference:t,floating:n,strategy:r}=e;const o=this.getOffsetParent||YC,i=this.getDimensions;return{reference:F_(t,await o(n),r),floating:{x:0,y:0,...await i(n)}}};function B_(e){return cr(e).direction==="rtl"}const U_={convertOffsetParentRelativeRectToViewportRelativeRect:I_,getDocumentElement:To,getClippingRect:L_,getOffsetParent:YC,getElementRects:z_,getClientRects:__,getDimensions:$_,getScale:ea,isElement:vo,isRTL:B_};function V_(e,t){let n=null,r;const o=To(e);function i(){clearTimeout(r),n&&n.disconnect(),n=null}function s(l,c){l===void 0&&(l=!1),c===void 0&&(c=1),i();const{left:u,top:d,width:f,height:h}=e.getBoundingClientRect();if(l||t(),!f||!h)return;const m=iu(d),g=iu(o.clientWidth-(u+f)),y=iu(o.clientHeight-(d+h)),C=iu(u),x={rootMargin:-m+"px "+-g+"px "+-y+"px "+-C+"px",threshold:an(0,Rr(1,c))||1};let w=!0;function S(E){const j=E[0].intersectionRatio;if(j!==c){if(!w)return s();j?s(!1,j):r=setTimeout(()=>{s(!1,1e-7)},100)}w=!1}try{n=new IntersectionObserver(S,{...x,root:o.ownerDocument})}catch{n=new IntersectionObserver(S,x)}n.observe(e)}return s(!0),i}function H_(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:o=!0,ancestorResize:i=!0,elementResize:s=typeof ResizeObserver=="function",layoutShift:l=typeof IntersectionObserver=="function",animationFrame:c=!1}=r,u=qg(e),d=o||i?[...u?co(u):[],...co(t)]:[];d.forEach(v=>{o&&v.addEventListener("scroll",n,{passive:!0}),i&&v.addEventListener("resize",n)});const f=u&&l?V_(u,n):null;let h=-1,m=null;s&&(m=new ResizeObserver(v=>{let[x]=v;x&&x.target===u&&m&&(m.unobserve(t),cancelAnimationFrame(h),h=requestAnimationFrame(()=>{m&&m.observe(t)})),n()}),u&&!c&&m.observe(u),m.observe(t));let g,y=c?Ki(e):null;c&&C();function C(){const v=Ki(e);y&&(v.x!==y.x||v.y!==y.y||v.width!==y.width||v.height!==y.height)&&n(),y=v,g=requestAnimationFrame(C)}return n(),()=>{d.forEach(v=>{o&&v.removeEventListener("scroll",n),i&&v.removeEventListener("resize",n)}),f&&f(),m&&m.disconnect(),m=null,c&&cancelAnimationFrame(g)}}const Gg=j_,XC=w_,W_=T_,Ox=x_,JC=b_,q_=E_,G_=(e,t,n)=>{const r=new Map,o={platform:U_,...n},i={...o.platform,_c:r};return v_(e,t,{...o,platform:i})},ZC=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:r,padding:o}=typeof e=="function"?e(n):e;return r&&t(r)?r.current!=null?Ox({element:r.current,padding:o}).fn(n):{}:r?Ox({element:r,padding:o}).fn(n):{}}}};var Pu=typeof document<"u"?p.useLayoutEffect:p.useEffect;function dd(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,r,o;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!dd(e[r],t[r]))return!1;return!0}if(o=Object.keys(e),n=o.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,o[r]))return!1;for(r=n;r--!==0;){const i=o[r];if(!(i==="_owner"&&e.$$typeof)&&!dd(e[i],t[i]))return!1}return!0}return e!==e&&t!==t}function ej(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Mx(e,t){const n=ej(e);return Math.round(t*n)/n}function Lx(e){const t=p.useRef(e);return Pu(()=>{t.current=e}),t}function Q_(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:o,elements:{reference:i,floating:s}={},transform:l=!0,whileElementsMounted:c,open:u}=e,[d,f]=p.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[h,m]=p.useState(r);dd(h,r)||m(r);const[g,y]=p.useState(null),[C,v]=p.useState(null),x=p.useCallback(_=>{_!==j.current&&(j.current=_,y(_))},[]),w=p.useCallback(_=>{_!==T.current&&(T.current=_,v(_))},[]),S=i||g,E=s||C,j=p.useRef(null),T=p.useRef(null),P=p.useRef(d),R=c!=null,I=Lx(c),O=Lx(o),D=p.useCallback(()=>{if(!j.current||!T.current)return;const _={placement:t,strategy:n,middleware:h};O.current&&(_.platform=O.current),G_(j.current,T.current,_).then(k=>{const z={...k,isPositioned:!0};A.current&&!dd(P.current,z)&&(P.current=z,sc.flushSync(()=>{f(z)}))})},[h,t,n,O]);Pu(()=>{u===!1&&P.current.isPositioned&&(P.current.isPositioned=!1,f(_=>({..._,isPositioned:!1})))},[u]);const A=p.useRef(!1);Pu(()=>(A.current=!0,()=>{A.current=!1}),[]),Pu(()=>{if(S&&(j.current=S),E&&(T.current=E),S&&E){if(I.current)return I.current(S,E,D);D()}},[S,E,D,I,R]);const M=p.useMemo(()=>({reference:j,floating:T,setReference:x,setFloating:w}),[x,w]),B=p.useMemo(()=>({reference:S,floating:E}),[S,E]),F=p.useMemo(()=>{const _={position:n,left:0,top:0};if(!B.floating)return _;const k=Mx(B.floating,d.x),z=Mx(B.floating,d.y);return l?{..._,transform:"translate("+k+"px, "+z+"px)",...ej(B.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:k,top:z}},[n,l,B.floating,d.x,d.y]);return p.useMemo(()=>({...d,update:D,refs:M,elements:B,floatingStyles:F}),[d,D,M,B,F])}var uo=typeof document<"u"?p.useLayoutEffect:p.useEffect;let $h=!1,K_=0;const $x=()=>"floating-ui-"+K_++;function Y_(){const[e,t]=p.useState(()=>$h?$x():void 0);return uo(()=>{e==null&&t($x())},[]),p.useEffect(()=>{$h||($h=!0)},[]),e}const X_=Om.useId,tj=X_||Y_;function J_(){const e=new Map;return{emit(t,n){var r;(r=e.get(t))==null||r.forEach(o=>o(n))},on(t,n){e.set(t,[...e.get(t)||[],n])},off(t,n){var r;e.set(t,((r=e.get(t))==null?void 0:r.filter(o=>o!==n))||[])}}}const Z_=p.createContext(null),e4=p.createContext(null),nj=()=>{var e;return((e=p.useContext(Z_))==null?void 0:e.id)||null},Qg=()=>p.useContext(e4);function Xo(e){return(e==null?void 0:e.ownerDocument)||document}function t4(){const e=navigator.userAgentData;return e!=null&&e.platform?e.platform:navigator.platform}function n4(){const e=navigator.userAgentData;return e&&Array.isArray(e.brands)?e.brands.map(t=>{let{brand:n,version:r}=t;return n+"/"+r}).join(" "):navigator.userAgent}function Zd(e){return Xo(e).defaultView||window}function qr(e){return e?e instanceof Element||e instanceof Zd(e).Element:!1}function rj(e){return e?e instanceof HTMLElement||e instanceof Zd(e).HTMLElement:!1}function r4(e){if(typeof ShadowRoot>"u")return!1;const t=Zd(e).ShadowRoot;return e instanceof t||e instanceof ShadowRoot}function o4(e){if(e.mozInputSource===0&&e.isTrusted)return!0;const t=/Android/i;return(t.test(t4())||t.test(n4()))&&e.pointerType?e.type==="click"&&e.buttons===1:e.detail===0&&!e.pointerType}function i4(e){return e.width===0&&e.height===0||e.width===1&&e.height===1&&e.pressure===0&&e.detail===0&&e.pointerType!=="mouse"||e.width<1&&e.height<1&&e.pressure===0&&e.detail===0}function oj(e,t){const n=["mouse","pen"];return t||n.push("",void 0),n.includes(e)}function s4(e){return"nativeEvent"in e}function tm(e,t){if(!e||!t)return!1;const n=t.getRootNode&&t.getRootNode();if(e.contains(t))return!0;if(n&&r4(n)){let r=t;for(;r;){if(e===r)return!0;r=r.parentNode||r.host}}return!1}function ij(e){return"data-floating-ui-"+e}function Fx(e){const t=p.useRef(e);return uo(()=>{t.current=e}),t}const zx=ij("safe-polygon");function ku(e,t,n){return n&&!oj(n)?0:typeof e=="number"?e:e==null?void 0:e[t]}function a4(e,t){t===void 0&&(t={});const{open:n,onOpenChange:r,dataRef:o,events:i,elements:{domReference:s,floating:l},refs:c}=e,{enabled:u=!0,delay:d=0,handleClose:f=null,mouseOnly:h=!1,restMs:m=0,move:g=!0}=t,y=Qg(),C=nj(),v=Fx(f),x=Fx(d),w=p.useRef(),S=p.useRef(),E=p.useRef(),j=p.useRef(),T=p.useRef(!0),P=p.useRef(!1),R=p.useRef(()=>{}),I=p.useCallback(()=>{var M;const B=(M=o.current.openEvent)==null?void 0:M.type;return(B==null?void 0:B.includes("mouse"))&&B!=="mousedown"},[o]);p.useEffect(()=>{if(!u)return;function M(){clearTimeout(S.current),clearTimeout(j.current),T.current=!0}return i.on("dismiss",M),()=>{i.off("dismiss",M)}},[u,i]),p.useEffect(()=>{if(!u||!v.current||!n)return;function M(F){I()&&r(!1,F)}const B=Xo(l).documentElement;return B.addEventListener("mouseleave",M),()=>{B.removeEventListener("mouseleave",M)}},[l,n,r,u,v,o,I]);const O=p.useCallback(function(M,B){B===void 0&&(B=!0);const F=ku(x.current,"close",w.current);F&&!E.current?(clearTimeout(S.current),S.current=setTimeout(()=>r(!1,M),F)):B&&(clearTimeout(S.current),r(!1,M))},[x,r]),D=p.useCallback(()=>{R.current(),E.current=void 0},[]),A=p.useCallback(()=>{if(P.current){const M=Xo(c.floating.current).body;M.style.pointerEvents="",M.removeAttribute(zx),P.current=!1}},[c]);return p.useEffect(()=>{if(!u)return;function M(){return o.current.openEvent?["click","mousedown"].includes(o.current.openEvent.type):!1}function B(k){if(clearTimeout(S.current),T.current=!1,h&&!oj(w.current)||m>0&&ku(x.current,"open")===0)return;const z=ku(x.current,"open",w.current);z?S.current=setTimeout(()=>{r(!0,k)},z):r(!0,k)}function F(k){if(M())return;R.current();const z=Xo(l);if(clearTimeout(j.current),v.current){n||clearTimeout(S.current),E.current=v.current({...e,tree:y,x:k.clientX,y:k.clientY,onClose(){A(),D(),O(k)}});const Q=E.current;z.addEventListener("mousemove",Q),R.current=()=>{z.removeEventListener("mousemove",Q)};return}(w.current==="touch"?!tm(l,k.relatedTarget):!0)&&O(k)}function _(k){M()||v.current==null||v.current({...e,tree:y,x:k.clientX,y:k.clientY,onClose(){A(),D(),O(k)}})(k)}if(qr(s)){const k=s;return n&&k.addEventListener("mouseleave",_),l==null||l.addEventListener("mouseleave",_),g&&k.addEventListener("mousemove",B,{once:!0}),k.addEventListener("mouseenter",B),k.addEventListener("mouseleave",F),()=>{n&&k.removeEventListener("mouseleave",_),l==null||l.removeEventListener("mouseleave",_),g&&k.removeEventListener("mousemove",B),k.removeEventListener("mouseenter",B),k.removeEventListener("mouseleave",F)}}},[s,l,u,e,h,m,g,O,D,A,r,n,y,x,v,o]),uo(()=>{var M;if(u&&n&&(M=v.current)!=null&&M.__options.blockPointerEvents&&I()){const _=Xo(l).body;if(_.setAttribute(zx,""),_.style.pointerEvents="none",P.current=!0,qr(s)&&l){var B,F;const k=s,z=y==null||(B=y.nodesRef.current.find(q=>q.id===C))==null||(F=B.context)==null?void 0:F.elements.floating;return z&&(z.style.pointerEvents=""),k.style.pointerEvents="auto",l.style.pointerEvents="auto",()=>{k.style.pointerEvents="",l.style.pointerEvents=""}}}},[u,n,C,l,s,y,v,o,I]),uo(()=>{n||(w.current=void 0,D(),A())},[n,D,A]),p.useEffect(()=>()=>{D(),clearTimeout(S.current),clearTimeout(j.current),A()},[u,D,A]),p.useMemo(()=>{if(!u)return{};function M(B){w.current=B.pointerType}return{reference:{onPointerDown:M,onPointerEnter:M,onMouseMove(B){n||m===0||(clearTimeout(j.current),j.current=setTimeout(()=>{T.current||r(!0,B.nativeEvent)},m))}},floating:{onMouseEnter(){clearTimeout(S.current)},onMouseLeave(B){i.emit("dismiss",{type:"mouseLeave",data:{returnFocus:!1}}),O(B.nativeEvent,!1)}}}},[i,u,m,n,r,O])}const sj=p.createContext({delay:0,initialDelay:0,timeoutMs:0,currentId:null,setCurrentId:()=>{},setState:()=>{},isInstantPhase:!1}),aj=()=>p.useContext(sj),l4=e=>{let{children:t,delay:n,timeoutMs:r=0}=e;const[o,i]=p.useReducer((c,u)=>({...c,...u}),{delay:n,timeoutMs:r,initialDelay:n,currentId:null,isInstantPhase:!1}),s=p.useRef(null),l=p.useCallback(c=>{i({currentId:c})},[]);return uo(()=>{o.currentId?s.current===null?s.current=o.currentId:i({isInstantPhase:!0}):(i({isInstantPhase:!1}),s.current=null)},[o.currentId]),p.createElement(sj.Provider,{value:p.useMemo(()=>({...o,setState:i,setCurrentId:l}),[o,i,l])},t)},c4=(e,t)=>{let{open:n,onOpenChange:r}=e,{id:o}=t;const{currentId:i,setCurrentId:s,initialDelay:l,setState:c,timeoutMs:u}=aj();uo(()=>{i&&(c({delay:{open:1,close:ku(l,"close")}}),i!==o&&r(!1))},[o,r,c,i,l]),uo(()=>{function d(){r(!1),c({delay:l,currentId:null})}if(!n&&i===o)if(u){const f=window.setTimeout(d,u);return()=>{clearTimeout(f)}}else d()},[n,c,i,o,r,l,u]),uo(()=>{n&&s(o)},[n,s,o])};function u4(e){let t=e.activeElement;for(;((n=t)==null||(r=n.shadowRoot)==null?void 0:r.activeElement)!=null;){var n,r;t=t.shadowRoot.activeElement}return t}function Fh(e,t){let n=e.filter(o=>{var i;return o.parentId===t&&((i=o.context)==null?void 0:i.open)}),r=n;for(;r.length;)r=e.filter(o=>{var i;return(i=r)==null?void 0:i.some(s=>{var l;return o.parentId===s.id&&((l=o.context)==null?void 0:l.open)})}),n=n.concat(r);return n}function d4(e){return"composedPath"in e?e.composedPath()[0]:e.target}const f4=Om.useInsertionEffect,h4=f4||(e=>e());function Ru(e){const t=p.useRef(()=>{});return h4(()=>{t.current=e}),p.useCallback(function(){for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return t.current==null?void 0:t.current(...r)},[])}function Du(e,t){if(t==null)return!1;if("composedPath"in e)return e.composedPath().includes(t);const n=e;return n.target!=null&&t.contains(n.target)}const p4={pointerdown:"onPointerDown",mousedown:"onMouseDown",click:"onClick"},m4={pointerdown:"onPointerDownCapture",mousedown:"onMouseDownCapture",click:"onClickCapture"},g4=e=>{var t,n;return{escapeKeyBubbles:typeof e=="boolean"?e:(t=e==null?void 0:e.escapeKey)!=null?t:!1,outsidePressBubbles:typeof e=="boolean"?e:(n=e==null?void 0:e.outsidePress)!=null?n:!0}};function y4(e,t){t===void 0&&(t={});const{open:n,onOpenChange:r,events:o,nodeId:i,elements:{reference:s,domReference:l,floating:c},dataRef:u}=e,{enabled:d=!0,escapeKey:f=!0,outsidePress:h=!0,outsidePressEvent:m="pointerdown",referencePress:g=!1,referencePressEvent:y="pointerdown",ancestorScroll:C=!1,bubbles:v}=t,x=Qg(),w=nj()!=null,S=Ru(typeof h=="function"?h:()=>!1),E=typeof h=="function"?S:h,j=p.useRef(!1),{escapeKeyBubbles:T,outsidePressBubbles:P}=g4(v),R=Ru(O=>{if(!n||!d||!f||O.key!=="Escape")return;const D=x?Fh(x.nodesRef.current,i):[];if(!T&&(O.stopPropagation(),D.length>0)){let A=!0;if(D.forEach(M=>{var B;if((B=M.context)!=null&&B.open&&!M.context.dataRef.current.__escapeKeyBubbles){A=!1;return}}),!A)return}o.emit("dismiss",{type:"escapeKey",data:{returnFocus:{preventScroll:!1}}}),r(!1,s4(O)?O.nativeEvent:O)}),I=Ru(O=>{const D=j.current;if(j.current=!1,D||typeof E=="function"&&!E(O))return;const A=d4(O);if(rj(A)&&c){const F=A.clientWidth>0&&A.scrollWidth>A.clientWidth,_=A.clientHeight>0&&A.scrollHeight>A.clientHeight;let k=_&&O.offsetX>A.clientWidth;if(_&&Zd(c).getComputedStyle(A).direction==="rtl"&&(k=O.offsetX<=A.offsetWidth-A.clientWidth),k||F&&O.offsetY>A.clientHeight)return}const M=x&&Fh(x.nodesRef.current,i).some(F=>{var _;return Du(O,(_=F.context)==null?void 0:_.elements.floating)});if(Du(O,c)||Du(O,l)||M)return;const B=x?Fh(x.nodesRef.current,i):[];if(B.length>0){let F=!0;if(B.forEach(_=>{var k;if((k=_.context)!=null&&k.open&&!_.context.dataRef.current.__outsidePressBubbles){F=!1;return}}),!F)return}o.emit("dismiss",{type:"outsidePress",data:{returnFocus:w?{preventScroll:!0}:o4(O)||i4(O)}}),r(!1,O)});return p.useEffect(()=>{if(!n||!d)return;u.current.__escapeKeyBubbles=T,u.current.__outsidePressBubbles=P;function O(M){r(!1,M)}const D=Xo(c);f&&D.addEventListener("keydown",R),E&&D.addEventListener(m,I);let A=[];return C&&(qr(l)&&(A=co(l)),qr(c)&&(A=A.concat(co(c))),!qr(s)&&s&&s.contextElement&&(A=A.concat(co(s.contextElement)))),A=A.filter(M=>{var B;return M!==((B=D.defaultView)==null?void 0:B.visualViewport)}),A.forEach(M=>{M.addEventListener("scroll",O,{passive:!0})}),()=>{f&&D.removeEventListener("keydown",R),E&&D.removeEventListener(m,I),A.forEach(M=>{M.removeEventListener("scroll",O)})}},[u,c,l,s,f,E,m,n,r,C,d,T,P,R,I]),p.useEffect(()=>{j.current=!1},[E,m]),p.useMemo(()=>d?{reference:{onKeyDown:R,[p4[y]]:O=>{g&&(o.emit("dismiss",{type:"referencePress",data:{returnFocus:!1}}),r(!1,O.nativeEvent))}},floating:{onKeyDown:R,[m4[m]]:()=>{j.current=!0}}}:{},[d,o,g,m,y,r,R])}function Kg(e){var t;e===void 0&&(e={});const{open:n=!1,onOpenChange:r,nodeId:o}=e,[i,s]=p.useState(null),l=((t=e.elements)==null?void 0:t.reference)||i,c=Q_(e),u=Qg(),d=Ru((S,E)=>{S&&(h.current.openEvent=E),r==null||r(S,E)}),f=p.useRef(null),h=p.useRef({}),m=p.useState(()=>J_())[0],g=tj(),y=p.useCallback(S=>{const E=qr(S)?{getBoundingClientRect:()=>S.getBoundingClientRect(),contextElement:S}:S;c.refs.setReference(E)},[c.refs]),C=p.useCallback(S=>{(qr(S)||S===null)&&(f.current=S,s(S)),(qr(c.refs.reference.current)||c.refs.reference.current===null||S!==null&&!qr(S))&&c.refs.setReference(S)},[c.refs]),v=p.useMemo(()=>({...c.refs,setReference:C,setPositionReference:y,domReference:f}),[c.refs,C,y]),x=p.useMemo(()=>({...c.elements,domReference:l}),[c.elements,l]),w=p.useMemo(()=>({...c,refs:v,elements:x,dataRef:h,nodeId:o,floatingId:g,events:m,open:n,onOpenChange:d}),[c,o,g,m,n,d,v,x]);return uo(()=>{const S=u==null?void 0:u.nodesRef.current.find(E=>E.id===o);S&&(S.context=w)}),p.useMemo(()=>({...c,context:w,refs:v,elements:x}),[c,v,x,w])}function v4(e,t){t===void 0&&(t={});const{open:n,onOpenChange:r,dataRef:o,events:i,refs:s,elements:{floating:l,domReference:c}}=e,{enabled:u=!0,keyboardOnly:d=!0}=t,f=p.useRef(""),h=p.useRef(!1),m=p.useRef();return p.useEffect(()=>{if(!u)return;const y=Xo(l).defaultView||window;function C(){!n&&rj(c)&&c===u4(Xo(c))&&(h.current=!0)}return y.addEventListener("blur",C),()=>{y.removeEventListener("blur",C)}},[l,c,n,u]),p.useEffect(()=>{if(!u)return;function g(y){(y.type==="referencePress"||y.type==="escapeKey")&&(h.current=!0)}return i.on("dismiss",g),()=>{i.off("dismiss",g)}},[i,u]),p.useEffect(()=>()=>{clearTimeout(m.current)},[]),p.useMemo(()=>u?{reference:{onPointerDown(g){let{pointerType:y}=g;f.current=y,h.current=!!(y&&d)},onMouseLeave(){h.current=!1},onFocus(g){var y;h.current||g.type==="focus"&&((y=o.current.openEvent)==null?void 0:y.type)==="mousedown"&&Du(o.current.openEvent,c)||r(!0,g.nativeEvent)},onBlur(g){h.current=!1;const y=g.relatedTarget,C=qr(y)&&y.hasAttribute(ij("focus-guard"))&&y.getAttribute("data-type")==="outside";m.current=setTimeout(()=>{tm(s.floating.current,y)||tm(c,y)||C||r(!1,g.nativeEvent)})}}}:{},[u,d,c,s,o,r])}function zh(e,t,n){const r=new Map;return{...n==="floating"&&{tabIndex:-1},...e,...t.map(o=>o?o[n]:null).concat(e).reduce((o,i)=>(i&&Object.entries(i).forEach(s=>{let[l,c]=s;if(l.indexOf("on")===0){if(r.has(l)||r.set(l,[]),typeof c=="function"){var u;(u=r.get(l))==null||u.push(c),o[l]=function(){for(var d,f=arguments.length,h=new Array(f),m=0;m<f;m++)h[m]=arguments[m];return(d=r.get(l))==null?void 0:d.map(g=>g(...h)).find(g=>g!==void 0)}}}else o[l]=c}),o),{})}}function x4(e){e===void 0&&(e=[]);const t=e,n=p.useCallback(i=>zh(i,e,"reference"),t),r=p.useCallback(i=>zh(i,e,"floating"),t),o=p.useCallback(i=>zh(i,e,"item"),e.map(i=>i==null?void 0:i.item));return p.useMemo(()=>({getReferenceProps:n,getFloatingProps:r,getItemProps:o}),[n,r,o])}function w4(e,t){t===void 0&&(t={});const{open:n,floatingId:r}=e,{enabled:o=!0,role:i="dialog"}=t,s=tj();return p.useMemo(()=>{const l={id:r,role:i};return o?i==="tooltip"?{reference:{"aria-describedby":n?r:void 0},floating:l}:{reference:{"aria-expanded":n?"true":"false","aria-haspopup":i==="alertdialog"?"dialog":i,"aria-controls":n?r:void 0,...i==="listbox"&&{role:"combobox"},...i==="menu"&&{id:s}},floating:{...l,...i==="menu"&&{"aria-labelledby":s}}}:{}},[o,i,n,r,s])}function lj(e,t){if(e==="rtl"&&(t.includes("right")||t.includes("left"))){const[n,r]=t.split("-"),o=n==="right"?"left":"right";return r===void 0?o:`${o}-${r}`}return t}function Bx(e,t,n,r){return e==="center"||r==="center"?{top:t}:e==="end"?{bottom:n}:e==="start"?{top:n}:{}}function Ux(e,t,n,r,o){return e==="center"||r==="center"?{left:t}:e==="end"?{[o==="ltr"?"right":"left"]:n}:e==="start"?{[o==="ltr"?"left":"right"]:n}:{}}const S4={bottom:"borderTopLeftRadius",left:"borderTopRightRadius",right:"borderBottomLeftRadius",top:"borderBottomRightRadius"};function b4({position:e,arrowSize:t,arrowOffset:n,arrowRadius:r,arrowPosition:o,arrowX:i,arrowY:s,dir:l}){const[c,u="center"]=e.split("-"),d={width:$(t),height:$(t),transform:"rotate(45deg)",position:"absolute",[S4[c]]:$(r)},f=$(-t/2);return c==="left"?{...d,...Bx(u,s,n,o),right:f,borderLeftColor:"transparent",borderBottomColor:"transparent"}:c==="right"?{...d,...Bx(u,s,n,o),left:f,borderRightColor:"transparent",borderTopColor:"transparent"}:c==="top"?{...d,...Ux(u,i,n,o,l),bottom:f,borderTopColor:"transparent",borderLeftColor:"transparent"}:c==="bottom"?{...d,...Ux(u,i,n,o,l),top:f,borderBottomColor:"transparent",borderRightColor:"transparent"}:{}}const Yg=p.forwardRef(({position:e,arrowSize:t,arrowOffset:n,arrowRadius:r,arrowPosition:o,visible:i,arrowX:s,arrowY:l,style:c,...u},d)=>{const{dir:f}=Ta();return i?b.createElement("div",{...u,ref:d,style:{...c,...b4({position:e,arrowSize:t,arrowOffset:n,arrowRadius:r,arrowPosition:o,dir:f,arrowX:s,arrowY:l})}}):null});Yg.displayName="@mantine/core/FloatingArrow";const[C4,cj]=wn("Popover component was not found in the tree");function Xg({children:e,active:t=!0,refProp:n="ref"}){const r=L2(t),o=tn(r,e==null?void 0:e.ref);return Co(e)?p.cloneElement(e,{[n]:o}):e}Xg.displayName="@mantine/core/FocusTrap";function j4(e){const t=document.createElement("div");return t.setAttribute("data-portal","true"),typeof e.className=="string"&&t.classList.add(...e.className.split(" ").filter(Boolean)),typeof e.style=="object"&&Object.assign(t.style,e.style),typeof e.id=="string"&&t.setAttribute("id",e.id),t}const E4={},uj=p.forwardRef((e,t)=>{const{children:n,target:r,...o}=V("Portal",E4,e),[i,s]=p.useState(!1),l=p.useRef(null);return Ca(()=>(s(!0),l.current=r?typeof r=="string"?document.querySelector(r):r:j4(o),zm(t,l.current),!r&&l.current&&document.body.appendChild(l.current),()=>{!r&&l.current&&document.body.removeChild(l.current)}),[r]),!i||!l.current?null:sc.createPortal(b.createElement(b.Fragment,null,n),l.current)});uj.displayName="@mantine/core/Portal";function as({withinPortal:e=!0,children:t,...n}){return e?b.createElement(uj,{...n},t):b.createElement(b.Fragment,null,t)}as.displayName="@mantine/core/OptionalPortal";const Ya=e=>({in:{opacity:1,transform:"scale(1)"},out:{opacity:0,transform:`scale(.9) translateY(${$(e==="bottom"?10:-10)})`},transitionProperty:"transform, opacity"}),su={fade:{in:{opacity:1},out:{opacity:0},transitionProperty:"opacity"},scale:{in:{opacity:1,transform:"scale(1)"},out:{opacity:0,transform:"scale(0)"},common:{transformOrigin:"top"},transitionProperty:"transform, opacity"},"scale-y":{in:{opacity:1,transform:"scaleY(1)"},out:{opacity:0,transform:"scaleY(0)"},common:{transformOrigin:"top"},transitionProperty:"transform, opacity"},"scale-x":{in:{opacity:1,transform:"scaleX(1)"},out:{opacity:0,transform:"scaleX(0)"},common:{transformOrigin:"left"},transitionProperty:"transform, opacity"},"skew-up":{in:{opacity:1,transform:"translateY(0) skew(0deg, 0deg)"},out:{opacity:0,transform:`translateY(-${$(20)}) skew(-10deg, -5deg)`},common:{transformOrigin:"top"},transitionProperty:"transform, opacity"},"skew-down":{in:{opacity:1,transform:"translateY(0) skew(0deg, 0deg)"},out:{opacity:0,transform:`translateY(${$(20)}) skew(-10deg, -5deg)`},common:{transformOrigin:"bottom"},transitionProperty:"transform, opacity"},"rotate-left":{in:{opacity:1,transform:"translateY(0) rotate(0deg)"},out:{opacity:0,transform:`translateY(${$(20)}) rotate(-5deg)`},common:{transformOrigin:"bottom"},transitionProperty:"transform, opacity"},"rotate-right":{in:{opacity:1,transform:"translateY(0) rotate(0deg)"},out:{opacity:0,transform:`translateY(${$(20)}) rotate(5deg)`},common:{transformOrigin:"top"},transitionProperty:"transform, opacity"},"slide-down":{in:{opacity:1,transform:"translateY(0)"},out:{opacity:0,transform:"translateY(-100%)"},common:{transformOrigin:"top"},transitionProperty:"transform, opacity"},"slide-up":{in:{opacity:1,transform:"translateY(0)"},out:{opacity:0,transform:"translateY(100%)"},common:{transformOrigin:"bottom"},transitionProperty:"transform, opacity"},"slide-left":{in:{opacity:1,transform:"translateX(0)"},out:{opacity:0,transform:"translateX(100%)"},common:{transformOrigin:"left"},transitionProperty:"transform, opacity"},"slide-right":{in:{opacity:1,transform:"translateX(0)"},out:{opacity:0,transform:"translateX(-100%)"},common:{transformOrigin:"right"},transitionProperty:"transform, opacity"},pop:{...Ya("bottom"),common:{transformOrigin:"center center"}},"pop-bottom-left":{...Ya("bottom"),common:{transformOrigin:"bottom left"}},"pop-bottom-right":{...Ya("bottom"),common:{transformOrigin:"bottom right"}},"pop-top-left":{...Ya("top"),common:{transformOrigin:"top left"}},"pop-top-right":{...Ya("top"),common:{transformOrigin:"top right"}}},Vx={entering:"in",entered:"in",exiting:"out",exited:"out","pre-exiting":"out","pre-entering":"out"};function T4({transition:e,state:t,duration:n,timingFunction:r}){const o={transitionDuration:`${n}ms`,transitionTimingFunction:r};return typeof e=="string"?e in su?{transitionProperty:su[e].transitionProperty,...o,...su[e].common,...su[e][Vx[t]]}:{}:{transitionProperty:e.transitionProperty,...o,...e.common,...e[Vx[t]]}}function P4({duration:e,exitDuration:t,timingFunction:n,mounted:r,onEnter:o,onExit:i,onEntered:s,onExited:l}){const c=Nt(),u=Bm(),d=c.respectReducedMotion?u:!1,[f,h]=p.useState(d?0:e),[m,g]=p.useState(r?"entered":"exited"),y=p.useRef(-1),C=v=>{const x=v?o:i,w=v?s:l;g(v?"pre-entering":"pre-exiting"),window.clearTimeout(y.current);const S=d?0:v?e:t;if(h(S),S===0)typeof x=="function"&&x(),typeof w=="function"&&w(),g(v?"entered":"exited");else{const E=window.setTimeout(()=>{typeof x=="function"&&x(),g(v?"entering":"exiting")},10);y.current=window.setTimeout(()=>{window.clearTimeout(E),typeof w=="function"&&w(),g(v?"entered":"exited")},S)}};return fo(()=>{C(r)},[r]),p.useEffect(()=>()=>window.clearTimeout(y.current),[]),{transitionDuration:f,transitionStatus:m,transitionTimingFunction:n||"ease"}}function ls({keepMounted:e,transition:t="fade",duration:n=250,exitDuration:r=n,mounted:o,children:i,timingFunction:s="ease",onExit:l,onEntered:c,onEnter:u,onExited:d}){const{transitionDuration:f,transitionStatus:h,transitionTimingFunction:m}=P4({mounted:o,exitDuration:r,duration:n,timingFunction:s,onExit:l,onEntered:c,onEnter:u,onExited:d});return f===0?o?b.createElement(b.Fragment,null,i({})):e?i({display:"none"}):null:h==="exited"?e?i({display:"none"}):null:b.createElement(b.Fragment,null,i(T4({transition:t,duration:f,state:h,timingFunction:m})))}ls.displayName="@mantine/core/Transition";var dj={dropdown:"m-38a85659",arrow:"m-a31dc6c1"};const k4={},Jg=G((e,t)=>{var C,v,x,w;const n=V("PopoverDropdown",k4,e),{className:r,style:o,vars:i,children:s,onKeyDownCapture:l,variant:c,classNames:u,styles:d,...f}=n,h=cj(),m=dS({opened:h.opened,shouldReturnFocus:h.returnFocus}),g=h.withRoles?{"aria-labelledby":h.getTargetId(),id:h.getDropdownId(),role:"dialog",tabIndex:-1}:{},y=tn(t,h.floating);return h.disabled?null:b.createElement(as,{...h.portalProps,withinPortal:h.withinPortal},b.createElement(ls,{mounted:h.opened,...h.transitionProps,transition:((C=h.transitionProps)==null?void 0:C.transition)||"fade",duration:((v=h.transitionProps)==null?void 0:v.duration)??150,keepMounted:h.keepMounted,exitDuration:typeof((x=h.transitionProps)==null?void 0:x.exitDuration)=="number"?h.transitionProps.exitDuration:(w=h.transitionProps)==null?void 0:w.duration},S=>b.createElement(Xg,{active:h.trapFocus},b.createElement(W,{...g,...f,variant:c,ref:y,onKeyDownCapture:w2(h.onClose,{active:h.closeOnEscape,onTrigger:m,onKeyDown:l}),"data-position":h.placement,...h.getStyles("dropdown",{className:r,props:n,classNames:u,styles:d,style:[{...S,zIndex:h.zIndex,top:h.y??0,left:h.x??0,width:h.width==="target"?void 0:$(h.width)},o]})},s,b.createElement(Yg,{ref:h.arrowRef,arrowX:h.arrowX,arrowY:h.arrowY,visible:h.withArrow,position:h.placement,arrowSize:h.arrowSize,arrowRadius:h.arrowRadius,arrowOffset:h.arrowOffset,arrowPosition:h.arrowPosition,...h.getStyles("arrow",{props:n,classNames:u,styles:d})})))))});Jg.classes=dj;Jg.displayName="@mantine/core/PopoverDropdown";const R4={refProp:"ref",popupType:"dialog"},fj=G((e,t)=>{const{children:n,refProp:r,popupType:o,...i}=V("PopoverTarget",R4,e);if(!Co(n))throw new Error("Popover.Target component children should be an element or a component that accepts ref. Fragments, strings, numbers and other primitive values are not supported");const s=i,l=cj(),c=tn(l.reference,n.ref,t),u=l.withRoles?{"aria-haspopup":o,"aria-expanded":l.opened,"aria-controls":l.getDropdownId(),id:l.getTargetId()}:{};return p.cloneElement(n,{...s,...u,...l.targetProps,className:Ye(l.targetProps.className,s.className,n.props.className),[r]:c,...l.controlled?null:{onClick:l.onToggle}})});fj.displayName="@mantine/core/PopoverTarget";function hj({opened:e,floating:t,position:n,positionDependencies:r}){const[o,i]=p.useState(0);p.useEffect(()=>{if(t.refs.reference.current&&t.refs.floating.current)return H_(t.refs.reference.current,t.refs.floating.current,t.update)},[t.refs.reference.current,t.refs.floating.current,e,o,n]),fo(()=>{t.update()},r),fo(()=>{i(s=>s+1)},[e])}function D4(e,t){var r,o,i,s;const n=[VC(e.offset)];return(r=e.middlewares)!=null&&r.shift&&n.push(Gg({limiter:q_()})),(o=e.middlewares)!=null&&o.flip&&n.push(XC()),(i=e.middlewares)!=null&&i.inline&&n.push(JC()),n.push(ZC({element:e.arrowRef,padding:e.arrowOffset})),((s=e.middlewares)!=null&&s.size||e.width==="target")&&n.push(W_({apply({rects:l,availableWidth:c,availableHeight:u}){var h,m;const f=((h=t().refs.floating.current)==null?void 0:h.style)??{};(m=e.middlewares)!=null&&m.size&&Object.assign(f,{maxWidth:`${c}px`,maxHeight:`${u}px`}),e.width==="target"&&Object.assign(f,{width:`${l.reference.width}px`})}})),n}function I4(e){const[t,n]=yn({value:e.opened,defaultValue:e.defaultOpened,finalValue:!1,onChange:e.onChange}),r=()=>{var s;t&&((s=e.onClose)==null||s.call(e),n(!1))},o=()=>{var s,l;t?((s=e.onClose)==null||s.call(e),n(!1)):((l=e.onOpen)==null||l.call(e),n(!0))},i=Kg({placement:e.position,middleware:D4(e,()=>i)});return hj({opened:e.opened,position:e.position,positionDependencies:e.positionDependencies||[],floating:i}),fo(()=>{var s;(s=e.onPositionChange)==null||s.call(e,i.placement)},[i.placement]),fo(()=>{var s,l;e.opened?(l=e.onOpen)==null||l.call(e):(s=e.onClose)==null||s.call(e)},[e.opened]),{floating:i,controlled:typeof e.opened=="boolean",opened:t,onClose:r,onToggle:o}}const _4={position:"bottom",offset:8,positionDependencies:[],transitionProps:{transition:"fade",duration:150},middlewares:{flip:!0,shift:!0,inline:!1},arrowSize:7,arrowOffset:5,arrowRadius:0,arrowPosition:"side",closeOnClickOutside:!0,withinPortal:!0,closeOnEscape:!0,trapFocus:!1,withRoles:!0,returnFocus:!1,clickOutsideEvents:["mousedown","touchstart"],zIndex:_r("popover"),__staticSelector:"Popover",width:"max-content"},A4=(e,{radius:t,shadow:n})=>({dropdown:{"--popover-radius":t===void 0?void 0:gt(t),"--popover-shadow":Lm(n)}});function Ar(e){var Fn,Yn,Ao,Wt,no,ee;const t=V("Popover",_4,e),{children:n,position:r,offset:o,onPositionChange:i,positionDependencies:s,opened:l,transitionProps:c,width:u,middlewares:d,withArrow:f,arrowSize:h,arrowOffset:m,arrowRadius:g,arrowPosition:y,unstyled:C,classNames:v,styles:x,closeOnClickOutside:w,withinPortal:S,portalProps:E,closeOnEscape:j,clickOutsideEvents:T,trapFocus:P,onClose:R,onOpen:I,onChange:O,zIndex:D,radius:A,shadow:M,id:B,defaultOpened:F,__staticSelector:_,withRoles:k,disabled:z,returnFocus:q,variant:Q,keepMounted:re,vars:Ce,...Re}=t,Oe=ue({name:_,props:t,classes:dj,classNames:v,styles:x,unstyled:C,rootSelector:"dropdown",vars:Ce,varsResolver:A4}),ve=p.useRef(null),[Ve,Je]=p.useState(null),[at,Ft]=p.useState(null),{dir:pe}=Ta(),Fe=Ln(B),Ne=I4({middlewares:d,width:u,position:lj(pe,r),offset:typeof o=="number"?o+(f?h/2:0):o,arrowRef:ve,arrowOffset:m,onPositionChange:i,positionDependencies:s,opened:l,defaultOpened:F,onChange:O,onOpen:I,onClose:R});P2(()=>w&&Ne.onClose(),T,[Ve,at]);const tt=p.useCallback(be=>{Je(be),Ne.floating.refs.setReference(be)},[Ne.floating.refs.setReference]),nt=p.useCallback(be=>{Ft(be),Ne.floating.refs.setFloating(be)},[Ne.floating.refs.setFloating]);return b.createElement(C4,{value:{returnFocus:q,disabled:z,controlled:Ne.controlled,reference:tt,floating:nt,x:Ne.floating.x,y:Ne.floating.y,arrowX:(Ao=(Yn=(Fn=Ne.floating)==null?void 0:Fn.middlewareData)==null?void 0:Yn.arrow)==null?void 0:Ao.x,arrowY:(ee=(no=(Wt=Ne.floating)==null?void 0:Wt.middlewareData)==null?void 0:no.arrow)==null?void 0:ee.y,opened:Ne.opened,arrowRef:ve,transitionProps:c,width:u,withArrow:f,arrowSize:h,arrowOffset:m,arrowRadius:g,arrowPosition:y,placement:Ne.floating.placement,trapFocus:P,withinPortal:S,portalProps:E,zIndex:D,radius:A,shadow:M,closeOnEscape:j,onClose:Ne.onClose,onToggle:Ne.onToggle,getTargetId:()=>`${Fe}-target`,getDropdownId:()=>`${Fe}-dropdown`,withRoles:k,targetProps:Re,__staticSelector:_,classNames:v,styles:x,unstyled:C,variant:Q,keepMounted:re,getStyles:Oe}},n)}Ar.Target=fj;Ar.Dropdown=Jg;Ar.displayName="@mantine/core/Popover";Ar.extend=e=>e;var jr={root:"m-5ae2e3c",barsLoader:"m-7a2bd4cd",bar:"m-870bb79","bars-loader-animation":"m-5d2b3b9d",dotsLoader:"m-4e3f22d7",dot:"m-870c4af","loader-dots-animation":"m-aac34a1",ovalLoader:"m-b34414df","oval-loader-animation":"m-f8e89c4b"};const N4=p.forwardRef(({className:e,...t},n)=>b.createElement(W,{component:"span",className:Ye(jr.barsLoader,e),...t,ref:n},b.createElement("span",{className:jr.bar}),b.createElement("span",{className:jr.bar}),b.createElement("span",{className:jr.bar}))),O4=p.forwardRef(({className:e,...t},n)=>b.createElement(W,{component:"span",className:Ye(jr.dotsLoader,e),...t,ref:n},b.createElement("span",{className:jr.dot}),b.createElement("span",{className:jr.dot}),b.createElement("span",{className:jr.dot}))),M4=p.forwardRef(({className:e,...t},n)=>b.createElement(W,{component:"span",className:Ye(jr.ovalLoader,e),...t,ref:n})),pj={bars:N4,oval:M4,dots:O4},L4={loaders:pj,type:"oval"},$4=(e,{size:t,color:n})=>({root:{"--loader-size":je(t,"loader-size"),"--loader-color":n?wt(n,e):void 0}}),Nn=G((e,t)=>{const n=V("Loader",L4,e),{size:r,color:o,type:i,vars:s,className:l,style:c,classNames:u,styles:d,unstyled:f,loaders:h,variant:m,children:g,...y}=n,C=ue({name:"Loader",props:n,classes:jr,className:l,style:c,classNames:u,styles:d,unstyled:f,vars:s,varsResolver:$4});return g?b.createElement(W,{...C("root"),ref:t,...y},g):b.createElement(W,{...C("root"),ref:t,component:h[i],variant:m,size:r,...y})});Nn.defaultLoaders=pj;Nn.classes=jr;Nn.displayName="@mantine/core/Loader";var ef={root:"m-8d3f4000",loader:"m-302b9fb1",group:"m-1a0f1b21"};const Hx={orientation:"horizontal"},F4=(e,{borderWidth:t})=>({group:{"--ai-border-width":$(t)}}),Zg=G((e,t)=>{const n=V("ActionIconGroup",Hx,e),{className:r,style:o,classNames:i,styles:s,unstyled:l,orientation:c,vars:u,borderWidth:d,variant:f,...h}=V("ActionIconGroup",Hx,e),m=ue({name:"ActionIconGroup",props:n,classes:ef,className:r,style:o,classNames:i,styles:s,unstyled:l,vars:u,varsResolver:F4,rootSelector:"group"});return b.createElement(W,{...m("group"),ref:t,variant:f,mod:{"data-orientation":c},role:"group",...h})});Zg.classes=ef;Zg.displayName="@mantine/core/ActionIconGroup";const z4={},B4=(e,{size:t,radius:n,variant:r,gradient:o,color:i,autoContrast:s})=>{const l=e.variantColorResolver({color:i||e.primaryColor,theme:e,gradient:o,variant:r||"filled",autoContrast:s});return{root:{"--ai-size":je(t,"ai-size"),"--ai-radius":n===void 0?void 0:gt(n),"--ai-bg":i||r?l.background:void 0,"--ai-hover":i||r?l.hover:void 0,"--ai-hover-color":i||r?l.hoverColor:void 0,"--ai-color":l.color,"--ai-bd":i||r?l.border:void 0}}},Ht=cn((e,t)=>{const n=V("ActionIcon",z4,e),{className:r,unstyled:o,variant:i,classNames:s,styles:l,style:c,loading:u,loaderProps:d,size:f,color:h,radius:m,__staticSelector:g,gradient:y,vars:C,children:v,disabled:x,"data-disabled":w,autoContrast:S,...E}=n,j=ue({name:["ActionIcon",g],props:n,className:r,style:c,classes:ef,classNames:s,styles:l,unstyled:o,vars:C,varsResolver:B4});return b.createElement(Gn,{...j("root",{active:!x&&!u&&!w}),...E,unstyled:o,variant:i,size:f,disabled:x||u,ref:t,mod:{loading:u,disabled:x||w}},u?b.createElement(Nn,{...j("loader"),color:"var(--ai-color)",size:"calc(var(--ai-size) * 0.55)",...d}):v)});Ht.classes=ef;Ht.displayName="@mantine/core/ActionIcon";Ht.Group=Zg;const mj=p.forwardRef(({size:e="var(--cb-icon-size, 70%)",style:t,...n},r)=>b.createElement("svg",{viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{...t,width:e,height:e},ref:r,...n},b.createElement("path",{d:"M11.7816 4.03157C12.0062 3.80702 12.0062 3.44295 11.7816 3.2184C11.5571 2.99385 11.193 2.99385 10.9685 3.2184L7.50005 6.68682L4.03164 3.2184C3.80708 2.99385 3.44301 2.99385 3.21846 3.2184C2.99391 3.44295 2.99391 3.80702 3.21846 4.03157L6.68688 7.49999L3.21846 10.9684C2.99391 11.193 2.99391 11.557 3.21846 11.7816C3.44301 12.0061 3.80708 12.0061 4.03164 11.7816L7.50005 8.31316L10.9685 11.7816C11.193 12.0061 11.5571 12.0061 11.7816 11.7816C12.0062 11.557 12.0062 11.193 11.7816 10.9684L8.31322 7.49999L11.7816 4.03157Z",fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd"})));mj.displayName="@mantine/core/CloseIcon";var gj={root:"m-86a44da5","root--subtle":"m-220c80f2"};const U4={variant:"subtle"},V4=(e,{size:t,radius:n,iconSize:r})=>({root:{"--cb-size":je(t,"cb-size"),"--cb-radius":n===void 0?void 0:gt(n),"--cb-icon-size":$(r)}}),cs=cn((e,t)=>{const n=V("CloseButton",U4,e),{iconSize:r,children:o,vars:i,radius:s,className:l,classNames:c,style:u,styles:d,unstyled:f,"data-disabled":h,disabled:m,variant:g,icon:y,...C}=n,v=ue({name:"CloseButton",props:n,className:l,style:u,classes:gj,classNames:c,styles:d,unstyled:f,vars:i,varsResolver:V4});return b.createElement(Gn,{ref:t,...C,unstyled:f,variant:g,disabled:m,mod:{disabled:m||h},...v("root",{variant:g,active:!0})},y||b.createElement(mj,null),o)});cs.classes=gj;cs.displayName="@mantine/core/CloseButton";function H4(e){return p.Children.toArray(e).filter(Boolean)}var yj={root:"m-4081bf90"};const W4={preventGrowOverflow:!0,gap:"md",align:"center",justify:"flex-start",wrap:"wrap"},q4=(e,{grow:t,preventGrowOverflow:n,gap:r,align:o,justify:i,wrap:s},{childWidth:l})=>({root:{"--group-child-width":t&&n?l:void 0,"--group-gap":Kt(r),"--group-align":o,"--group-justify":i,"--group-wrap":s}}),Y=G((e,t)=>{const n=V("Group",W4,e),{classNames:r,className:o,style:i,styles:s,unstyled:l,children:c,gap:u,align:d,justify:f,wrap:h,grow:m,preventGrowOverflow:g,vars:y,variant:C,__size:v,...x}=n,w=H4(c),S=w.length,E=Kt(u??"md"),T={childWidth:`calc(${100/S}% - (${E} - ${E} / ${S}))`},P=ue({name:"Group",props:n,stylesCtx:T,className:o,style:i,classes:yj,classNames:r,styles:s,unstyled:l,vars:y,varsResolver:q4});return b.createElement(W,{...P("root"),ref:t,variant:C,mod:{grow:m},size:v,...x},w)});Y.classes=yj;Y.displayName="@mantine/core/Group";var vj={root:"m-9814e45f"};const G4={zIndex:_r("modal")},Q4=(e,{gradient:t,color:n,backgroundOpacity:r,blur:o,radius:i,zIndex:s})=>({root:{"--overlay-bg":t||(n!==void 0||r!==void 0)&&Qt(n||"#000",r??.6)||void 0,"--overlay-filter":o?`blur(${$(o)})`:void 0,"--overlay-radius":i===void 0?void 0:gt(i),"--overlay-z-index":s==null?void 0:s.toString()}}),Ul=cn((e,t)=>{const n=V("Overlay",G4,e),{classNames:r,className:o,style:i,styles:s,unstyled:l,vars:c,fixed:u,center:d,children:f,radius:h,zIndex:m,gradient:g,blur:y,color:C,backgroundOpacity:v,...x}=n,w=ue({name:"Overlay",props:n,classes:vj,className:o,style:i,classNames:r,styles:s,unstyled:l,vars:c,varsResolver:Q4});return b.createElement(W,{ref:t,...w("root"),mod:{center:d,fixed:u},...x},f)});Ul.classes=vj;Ul.displayName="@mantine/core/Overlay";const[K4,Po]=wn("ModalBase component was not found in tree");function Y4({opened:e,transitionDuration:t}){const[n,r]=p.useState(e),o=p.useRef(),s=Bm()?0:t;return p.useEffect(()=>(e?(r(!0),window.clearTimeout(o.current)):s===0?r(!1):o.current=window.setTimeout(()=>r(!1),s),()=>window.clearTimeout(o.current)),[e,s]),n}function X4({id:e,transitionProps:t,opened:n,trapFocus:r,closeOnEscape:o,onClose:i,returnFocus:s}){const l=Ln(e),[c,u]=p.useState(!1),[d,f]=p.useState(!1),h=typeof(t==null?void 0:t.duration)=="number"?t==null?void 0:t.duration:200,m=Y4({opened:n,transitionDuration:h});return mS("keydown",g=>{!r&&g.key==="Escape"&&o&&i()}),dS({opened:n,shouldReturnFocus:r&&s}),{_id:l,titleMounted:c,bodyMounted:d,shouldLockScroll:m,setTitleMounted:u,setBodyMounted:f}}const J4=p.forwardRef(({keepMounted:e,opened:t,onClose:n,id:r,transitionProps:o,trapFocus:i,closeOnEscape:s,returnFocus:l,closeOnClickOutside:c,withinPortal:u,portalProps:d,lockScroll:f,children:h,zIndex:m,shadow:g,padding:y,__vars:C,unstyled:v,removeScrollProps:x,...w},S)=>{const{_id:E,titleMounted:j,bodyMounted:T,shouldLockScroll:P,setTitleMounted:R,setBodyMounted:I}=X4({id:r,transitionProps:o,opened:t,trapFocus:i,closeOnEscape:s,onClose:n,returnFocus:l});return b.createElement(as,{...d,withinPortal:u},b.createElement(K4,{value:{opened:t,onClose:n,closeOnClickOutside:c,transitionProps:{...o,keepMounted:e},getTitleId:()=>`${E}-title`,getBodyId:()=>`${E}-body`,titleMounted:j,bodyMounted:T,setTitleMounted:R,setBodyMounted:I,trapFocus:i,closeOnEscape:s,zIndex:m,unstyled:v}},b.createElement(Dd,{enabled:P&&f,...x},b.createElement(W,{ref:S,...w,__vars:{...C,"--mb-z-index":(m||_r("modal")).toString(),"--mb-shadow":Lm(g),"--mb-padding":Kt(y)}},h))))});function Z4(){const e=Po();return p.useEffect(()=>(e.setBodyMounted(!0),()=>e.setBodyMounted(!1)),[]),e.getBodyId()}var ha={title:"m-615af6c9",header:"m-b5489c3c",inner:"m-60c222c7",content:"m-fd1ab0aa",close:"m-606cb269",body:"m-5df29311"};const xj=p.forwardRef(({className:e,...t},n)=>{const r=Z4(),o=Po();return b.createElement(W,{ref:n,...t,id:r,className:Ye({[ha.body]:!o.unstyled},e)})});xj.displayName="@mantine/core/ModalBaseBody";const wj=p.forwardRef(({className:e,onClick:t,...n},r)=>{const o=Po();return b.createElement(cs,{ref:r,...n,onClick:i=>{o.onClose(),t==null||t(i)},className:Ye({[ha.close]:!o.unstyled},e),unstyled:o.unstyled})});wj.displayName="@mantine/core/ModalBaseCloseButton";const eA=p.forwardRef(({transitionProps:e,className:t,innerProps:n,onKeyDown:r,style:o,...i},s)=>{const l=Po(),c=u=>{var f;((f=u.target)==null?void 0:f.getAttribute("data-mantine-stop-propagation"))!=="true"&&u.key==="Escape"&&l.closeOnEscape&&l.onClose(),r==null||r(u)};return b.createElement(ls,{mounted:l.opened,transition:"pop",...l.transitionProps,...e},u=>b.createElement("div",{...n,className:Ye({[ha.inner]:!l.unstyled},n.className)},b.createElement(Xg,{active:l.opened&&l.trapFocus},b.createElement(_n,{...i,component:"section",role:"dialog",tabIndex:-1,"aria-modal":!0,"aria-describedby":l.bodyMounted?l.getBodyId():void 0,"aria-labelledby":l.titleMounted?l.getTitleId():void 0,onKeyDown:c,ref:s,style:[o,u],className:Ye({[ha.content]:!l.unstyled},t),unstyled:l.unstyled},i.children))))}),Sj=p.forwardRef(({className:e,...t},n)=>{const r=Po();return b.createElement(W,{component:"header",ref:n,className:Ye({[ha.header]:!r.unstyled},e),...t})});Sj.displayName="@mantine/core/ModalBaseHeader";const tA={duration:200,timingFunction:"ease",transition:"fade"};function nA(e){const t=Po();return{...tA,...t.transitionProps,...e}}const bj=p.forwardRef(({onClick:e,transitionProps:t,style:n,...r},o)=>{const i=Po(),s=nA(t);return b.createElement(ls,{mounted:i.opened,...s,transition:"fade"},l=>b.createElement(Ul,{ref:o,fixed:!0,style:[n,l],zIndex:i.zIndex,unstyled:i.unstyled,onClick:c=>{e==null||e(c),i.closeOnClickOutside&&i.onClose()},...r}))});bj.displayName="@mantine/core/ModalBaseOverlay";function rA(){const e=Po();return p.useEffect(()=>(e.setTitleMounted(!0),()=>e.setTitleMounted(!1)),[]),e.getTitleId()}const Cj=p.forwardRef(({className:e,...t},n)=>{const r=rA(),o=Po();return b.createElement(W,{component:"h2",ref:n,className:Ye({[ha.title]:!o.unstyled},e),...t,id:r})});Cj.displayName="@mantine/core/ModalBaseTitle";function oA({children:e}){return b.createElement(b.Fragment,null,e)}const[iA,Da]=ec({offsetBottom:!1,offsetTop:!1,describedBy:void 0,getStyles:null,inputId:void 0,labelId:void 0});var hr={wrapper:"m-6c018570",input:"m-8fb7ebe7",section:"m-82577fc2",placeholder:"m-88bacfd0",root:"m-46b77525",label:"m-8fdc1311",required:"m-78a94662",error:"m-8f816625",description:"m-fe47ce59"};const Wx={},sA=(e,{size:t})=>({description:{"--input-description-size":t===void 0?void 0:`calc(${Xt(t)} - ${$(2)})`}}),tf=G((e,t)=>{const n=V("InputDescription",Wx,e),{classNames:r,className:o,style:i,styles:s,unstyled:l,vars:c,size:u,__staticSelector:d,__inheritStyles:f=!0,variant:h,...m}=V("InputDescription",Wx,n),g=Da(),y=ue({name:["InputWrapper",d],props:n,classes:hr,className:o,style:i,classNames:r,styles:s,unstyled:l,rootSelector:"description",vars:c,varsResolver:sA}),C=f&&(g==null?void 0:g.getStyles)||y;return b.createElement(W,{component:"p",ref:t,variant:h,size:u,...C("description"),...m})});tf.classes=hr;tf.displayName="@mantine/core/InputDescription";const aA={},lA=(e,{size:t})=>({error:{"--input-error-size":t===void 0?void 0:`calc(${Xt(t)} - ${$(2)})`}}),nf=G((e,t)=>{const n=V("InputError",aA,e),{classNames:r,className:o,style:i,styles:s,unstyled:l,vars:c,size:u,__staticSelector:d,__inheritStyles:f=!0,variant:h,...m}=n,g=ue({name:["InputWrapper",d],props:n,classes:hr,className:o,style:i,classNames:r,styles:s,unstyled:l,rootSelector:"error",vars:c,varsResolver:lA}),y=Da(),C=f&&(y==null?void 0:y.getStyles)||g;return b.createElement(W,{component:"p",ref:t,variant:h,size:u,...C("error"),...m})});nf.classes=hr;nf.displayName="@mantine/core/InputError";const qx={labelElement:"label"},cA=(e,{size:t})=>({label:{"--input-label-size":Xt(t),"--input-asterisk-color":void 0}}),rf=G((e,t)=>{const n=V("InputLabel",qx,e),{classNames:r,className:o,style:i,styles:s,unstyled:l,vars:c,labelElement:u,size:d,required:f,htmlFor:h,onMouseDown:m,children:g,__staticSelector:y,variant:C,...v}=V("InputLabel",qx,n),x=ue({name:["InputWrapper",y],props:n,classes:hr,className:o,style:i,classNames:r,styles:s,unstyled:l,rootSelector:"label",vars:c,varsResolver:cA}),w=Da(),S=(w==null?void 0:w.getStyles)||x;return b.createElement(W,{...S("label"),component:u,variant:C,size:d,ref:t,htmlFor:u==="label"?h:void 0,mod:{required:f},onMouseDown:E=>{m==null||m(E),!E.defaultPrevented&&E.detail>1&&E.preventDefault()},...v},g,f&&b.createElement("span",{...S("required"),"aria-hidden":!0}," *"))});rf.classes=hr;rf.displayName="@mantine/core/InputLabel";const Gx={},ey=G((e,t)=>{const n=V("InputPlaceholder",Gx,e),{classNames:r,className:o,style:i,styles:s,unstyled:l,vars:c,__staticSelector:u,variant:d,error:f,...h}=V("InputPlaceholder",Gx,n),m=ue({name:["InputPlaceholder",u],props:n,classes:hr,className:o,style:i,classNames:r,styles:s,unstyled:l,rootSelector:"placeholder"});return b.createElement(W,{...m("placeholder"),mod:{error:!!f},component:"span",variant:d,ref:t,...h})});ey.classes=hr;ey.displayName="@mantine/core/InputPlaceholder";function uA(e,{hasDescription:t,hasError:n}){const r=e.findIndex(c=>c==="input"),o=e[r-1],i=e[r+1];return{offsetBottom:t&&i==="description"||n&&i==="error",offsetTop:t&&o==="description"||n&&o==="error"}}const dA={labelElement:"label",inputContainer:e=>e,inputWrapperOrder:["label","description","input","error"]},fA=(e,{size:t})=>({label:{"--input-label-size":Xt(t),"--input-asterisk-color":void 0},error:{"--input-error-size":t===void 0?void 0:`calc(${Xt(t)} - ${$(2)})`},description:{"--input-description-size":t===void 0?void 0:`calc(${Xt(t)} - ${$(2)})`}}),ty=G((e,t)=>{const n=V("InputWrapper",dA,e),{classNames:r,className:o,style:i,styles:s,unstyled:l,vars:c,size:u,variant:d,__staticSelector:f,inputContainer:h,inputWrapperOrder:m,label:g,error:y,description:C,labelProps:v,descriptionProps:x,errorProps:w,labelElement:S,children:E,withAsterisk:j,id:T,required:P,__stylesApiProps:R,...I}=n,O=ue({name:["InputWrapper",f],props:R||n,classes:hr,className:o,style:i,classNames:r,styles:s,unstyled:l,vars:c,varsResolver:fA}),D={size:u,variant:d,__staticSelector:f},A=Ln(T),M=typeof j=="boolean"?j:P,B=(w==null?void 0:w.id)||`${A}-error`,F=(x==null?void 0:x.id)||`${A}-description`,_=A,k=!!y&&typeof y!="boolean",z=!!C,q=`${k?B:""} ${z?F:""}`,Q=q.trim().length>0?q.trim():void 0,re=(v==null?void 0:v.id)||`${A}-label`,Ce=g&&b.createElement(rf,{key:"label",labelElement:S,id:re,htmlFor:_,required:M,...D,...v},g),Re=z&&b.createElement(tf,{key:"description",...x,...D,size:(x==null?void 0:x.size)||D.size,id:(x==null?void 0:x.id)||F},C),Oe=b.createElement(b.Fragment,{key:"input"},h(E)),ve=k&&b.createElement(nf,{...w,...D,size:(w==null?void 0:w.size)||D.size,key:"error",id:(w==null?void 0:w.id)||B},y),Ve=m.map(Je=>{switch(Je){case"label":return Ce;case"input":return Oe;case"description":return Re;case"error":return ve;default:return null}});return b.createElement(iA,{value:{getStyles:O,describedBy:Q,inputId:_,labelId:re,...uA(m,{hasDescription:z,hasError:k})}},b.createElement(W,{ref:t,variant:d,size:u,mod:{error:!!y},...O("root"),...I},Ve))});ty.classes=hr;ty.displayName="@mantine/core/InputWrapper";const hA={variant:"default",leftSectionPointerEvents:"none",rightSectionPointerEvents:"none",withAria:!0,withErrorStyles:!0},pA=(e,t,n)=>({wrapper:{"--input-margin-top":n.offsetTop?"calc(var(--mantine-spacing-xs) / 2)":void 0,"--input-margin-bottom":n.offsetBottom?"calc(var(--mantine-spacing-xs) / 2)":void 0,"--input-height":je(t.size,"input-height"),"--input-fz":Xt(t.size),"--input-radius":t.radius===void 0?void 0:gt(t.radius),"--input-left-section-width":t.leftSectionWidth!==void 0?$(t.leftSectionWidth):void 0,"--input-right-section-width":t.rightSectionWidth!==void 0?$(t.rightSectionWidth):void 0,"--input-padding-y":t.multiline?je(t.size,"input-padding-y"):void 0,"--input-left-section-pointer-events":t.leftSectionPointerEvents,"--input-right-section-pointer-events":t.rightSectionPointerEvents}}),St=cn((e,t)=>{const n=V("Input",hA,e),{classNames:r,className:o,style:i,styles:s,unstyled:l,required:c,__staticSelector:u,__stylesApiProps:d,size:f,wrapperProps:h,error:m,disabled:g,leftSection:y,leftSectionProps:C,leftSectionWidth:v,rightSection:x,rightSectionProps:w,rightSectionWidth:S,rightSectionPointerEvents:E,leftSectionPointerEvents:j,variant:T,vars:P,pointer:R,multiline:I,radius:O,id:D,withAria:A,withErrorStyles:M,...B}=n,{styleProps:F,rest:_}=jo(B),k=Da(),z={offsetBottom:k==null?void 0:k.offsetBottom,offsetTop:k==null?void 0:k.offsetTop},q=ue({name:["Input",u],props:d||n,classes:hr,className:o,style:i,classNames:r,styles:s,unstyled:l,stylesCtx:z,rootSelector:"wrapper",vars:P,varsResolver:pA}),Q=A?{required:c,disabled:g,"aria-invalid":!!m,"aria-describedby":k==null?void 0:k.describedBy,id:(k==null?void 0:k.inputId)||D}:{};return b.createElement(W,{...q("wrapper"),...F,...h,mod:{error:!!m&&M,pointer:R,disabled:g,multiline:I,"data-with-right-section":!!x,"data-with-left-section":!!y},variant:T,size:f},y&&b.createElement("div",{...C,"data-position":"left",...q("section",{className:C==null?void 0:C.className,style:C==null?void 0:C.style})},y),b.createElement(W,{component:"input",..._,...Q,ref:t,required:c,mod:{disabled:g,error:!!m&&M},variant:T,...q("input")}),x&&b.createElement("div",{...w,"data-position":"right",...q("section",{className:w==null?void 0:w.className,style:w==null?void 0:w.style})},x))});St.classes=hr;St.Wrapper=ty;St.Label=rf;St.Error=nf;St.Description=tf;St.Placeholder=ey;St.displayName="@mantine/core/Input";function mA(e,t,n){const r=V(e,t,n),{label:o,description:i,error:s,required:l,classNames:c,styles:u,className:d,unstyled:f,__staticSelector:h,__stylesApiProps:m,errorProps:g,labelProps:y,descriptionProps:C,wrapperProps:v,id:x,size:w,style:S,inputContainer:E,inputWrapperOrder:j,withAsterisk:T,variant:P,vars:R,...I}=r,{styleProps:O,rest:D}=jo(I),A={label:o,description:i,error:s,required:l,classNames:c,className:d,__staticSelector:h,__stylesApiProps:m||r,errorProps:g,labelProps:y,descriptionProps:C,unstyled:f,styles:u,size:w,style:S,inputContainer:E,inputWrapperOrder:j,withAsterisk:T,variant:P,id:x,...v};return{...D,classNames:c,styles:u,unstyled:f,wrapperProps:{...A,...O},inputProps:{required:l,classNames:c,styles:u,unstyled:f,size:w,__staticSelector:h,__stylesApiProps:m||r,error:s,variant:P,id:x}}}const gA={__staticSelector:"InputBase",withAria:!0},pr=cn((e,t)=>{const{inputProps:n,wrapperProps:r,...o}=mA("InputBase",gA,e);return b.createElement(St.Wrapper,{...r},b.createElement(St,{...n,...o,ref:t}))});pr.classes={...St.classes,...St.Wrapper.classes};pr.displayName="@mantine/core/InputBase";const yA={gap:{type:"spacing",property:"gap"},rowGap:{type:"spacing",property:"rowGap"},columnGap:{type:"spacing",property:"columnGap"},align:{type:"identity",property:"alignItems"},justify:{type:"identity",property:"justifyContent"},wrap:{type:"identity",property:"flexWrap"},direction:{type:"identity",property:"flexDirection"}};var jj={root:"m-8bffd616"};const vA={},pa=cn((e,t)=>{const n=V("Flex",vA,e),{classNames:r,className:o,style:i,styles:s,unstyled:l,vars:c,gap:u,rowGap:d,columnGap:f,align:h,justify:m,wrap:g,direction:y,...C}=n,v=ue({name:"Flex",classes:jj,props:n,className:o,style:i,classNames:r,styles:s,unstyled:l,vars:c}),x=Nt(),w=tc(),S=bS({styleProps:{gap:u,rowGap:d,columnGap:f,align:h,justify:m,wrap:g,direction:y},theme:x,data:yA});return b.createElement(b.Fragment,null,S.hasResponsiveStyles&&b.createElement(Ea,{selector:`.${w}`,styles:S.styles,media:S.media}),b.createElement(W,{ref:t,...v("root",{className:w,style:rs(S.inlineStyles)}),...C}))});pa.classes=jj;pa.displayName="@mantine/core/Flex";var Ej={root:"m-66836ed3","root--filled":"m-12b2e6d5","root--white":"m-cffd1856",wrapper:"m-a5d60502",body:"m-667c2793",title:"m-6a03f287",label:"m-698f4f23",icon:"m-667f2a6a",message:"m-7fa78076",closeButton:"m-87f54839"};const xA={},wA=(e,{radius:t,color:n,variant:r,autoContrast:o})=>{const i=e.variantColorResolver({color:n||e.primaryColor,theme:e,variant:r||"light",autoContrast:o});return{root:{"--alert-radius":t===void 0?void 0:gt(t),"--alert-bg":n||r?i.background:void 0,"--alert-color":i.color,"--alert-bd":n||r?i.border:void 0}}},us=G((e,t)=>{const n=V("Alert",xA,e),{classNames:r,className:o,style:i,styles:s,unstyled:l,vars:c,radius:u,color:d,title:f,children:h,id:m,icon:g,withCloseButton:y,onClose:C,closeButtonLabel:v,variant:x,autoContrast:w,...S}=n,E=ue({name:"Alert",classes:Ej,props:n,className:o,style:i,classNames:r,styles:s,unstyled:l,vars:c,varsResolver:wA}),j=Ln(m),T=f&&`${j}-title`||void 0,P=`${j}-body`;return b.createElement(W,{id:j,...E("root",{variant:x}),variant:x,ref:t,...S,role:"alert","aria-describedby":P,"aria-labelledby":T},b.createElement("div",{...E("wrapper")},g&&b.createElement("div",{...E("icon")},g),b.createElement("div",{...E("body")},f&&b.createElement("div",{...E("title"),"data-with-close-button":y||void 0},b.createElement("span",{id:T,...E("label")},f)),h&&b.createElement("div",{id:P,...E("message")},h)),y&&b.createElement(cs,{...E("closeButton"),onClick:C,variant:"transparent",size:16,iconSize:16,"aria-label":v,unstyled:l})))});us.classes=Ej;us.displayName="@mantine/core/Alert";var Tj={root:"m-b6d8b162"};function SA(e){if(e==="start")return"start";if(e==="end"||e)return"end"}const bA={inherit:!1},CA=(e,{variant:t,lineClamp:n,gradient:r,size:o,color:i})=>({root:{"--text-fz":Xt(o),"--text-lh":lS(o),"--text-gradient":t==="gradient"?op(r,e):void 0,"--text-line-clamp":typeof n=="number"?n.toString():void 0,"--text-color":i?wt(i,e):void 0}}),le=cn((e,t)=>{const n=V("Text",bA,e),{lineClamp:r,truncate:o,inline:i,inherit:s,gradient:l,span:c,__staticSelector:u,vars:d,className:f,style:h,classNames:m,styles:g,unstyled:y,variant:C,mod:v,size:x,...w}=n,S=ue({name:["Text",u],props:n,classes:Tj,className:f,style:h,classNames:m,styles:g,unstyled:y,vars:d,varsResolver:CA});return b.createElement(W,{...S("root",{focusable:!0}),ref:t,component:c?"span":"p",variant:C,mod:[{"data-truncate":SA(o),"data-line-clamp":typeof r=="number","data-inline":i,"data-inherit":s},v],size:x,...w})});le.classes=Tj;le.displayName="@mantine/core/Text";var Pj={root:"m-849cf0da"};const jA={underline:"hover"},Ue=cn((e,t)=>{const{underline:n,className:r,unstyled:o,...i}=V("Anchor",jA,e);return b.createElement(le,{component:"a",ref:t,className:Ye({[Pj.root]:!o},r),...i,mod:{underline:n},__staticSelector:"Anchor",unstyled:o})});Ue.classes=Pj;Ue.displayName="@mantine/core/Anchor";const[EA,Ia]=wn("AppShell was not found in tree");var wi={root:"m-89ab340",navbar:"m-45252eee",aside:"m-9cdde9a",header:"m-3b16f56b",main:"m-8983817",footer:"m-3840c879",section:"m-6dcfc7c7"};const TA={},ny=G((e,t)=>{const n=V("AppShellAside",TA,e),{classNames:r,className:o,style:i,styles:s,unstyled:l,vars:c,withBorder:u,zIndex:d,...f}=n,h=Ia();return h.disabled?null:b.createElement(W,{component:"aside",ref:t,mod:{"with-border":u??h.withBorder},...h.getStyles("aside",{className:o,classNames:r,styles:s,style:i}),...f,__vars:{"--app-shell-aside-z-index":`calc(${d??h.zIndex} + 1)`}})});ny.classes=wi;ny.displayName="@mantine/core/AppShellAside";const PA={},ry=G((e,t)=>{var m;const n=V("AppShellFooter",PA,e),{classNames:r,className:o,style:i,styles:s,unstyled:l,vars:c,withBorder:u,zIndex:d,...f}=n,h=Ia();return h.disabled?null:b.createElement(W,{component:"footer",ref:t,mod:{"with-border":u??h.withBorder},...h.getStyles("footer",{className:Ye({[Dd.classNames.zeroRight]:h.offsetScrollbars},o),classNames:r,styles:s,style:i}),...f,__vars:{"--app-shell-footer-z-index":(m=d??h.zIndex)==null?void 0:m.toString()}})});ry.classes=wi;ry.displayName="@mantine/core/AppShellFooter";const kA={},oy=G((e,t)=>{var m;const n=V("AppShellHeader",kA,e),{classNames:r,className:o,style:i,styles:s,unstyled:l,vars:c,withBorder:u,zIndex:d,...f}=n,h=Ia();return h.disabled?null:b.createElement(W,{component:"header",ref:t,mod:{"with-border":u??h.withBorder},...h.getStyles("header",{className:Ye({[Dd.classNames.zeroRight]:h.offsetScrollbars},o),classNames:r,styles:s,style:i}),...f,__vars:{"--app-shell-header-z-index":(m=d??h.zIndex)==null?void 0:m.toString()}})});oy.classes=wi;oy.displayName="@mantine/core/AppShellHeader";const RA={},iy=G((e,t)=>{const n=V("AppShellMain",RA,e),{classNames:r,className:o,style:i,styles:s,vars:l,...c}=n,u=Ia();return b.createElement(W,{component:"main",ref:t,...u.getStyles("main",{className:o,style:i,classNames:r,styles:s}),...c})});iy.classes=wi;iy.displayName="@mantine/core/AppShellMain";function lc(e){return typeof e=="object"?e.base:e}function cc(e){const t=typeof e=="object"&&e!==null&&typeof e.base<"u"&&Object.keys(e).length===1;return typeof e=="number"||typeof e=="string"||t}function uc(e){return!(typeof e!="object"||e===null||Object.keys(e).length===1&&"base"in e)}function DA({baseStyles:e,minMediaStyles:t,maxMediaStyles:n,aside:r,theme:o}){var c,u,d;const i=r==null?void 0:r.width,s="translateX(var(--app-shell-aside-width))",l="translateX(calc(var(--app-shell-aside-width) * -1))";if(r!=null&&r.breakpoint&&!((c=r==null?void 0:r.collapsed)!=null&&c.mobile)&&(n[r==null?void 0:r.breakpoint]=n[r==null?void 0:r.breakpoint]||{},n[r==null?void 0:r.breakpoint]["--app-shell-aside-width"]="100%",n[r==null?void 0:r.breakpoint]["--app-shell-aside-offset"]="0px"),cc(i)){const f=$(lc(i));e["--app-shell-aside-width"]=f,e["--app-shell-aside-offset"]=f}if(uc(i)&&(typeof i.base<"u"&&(e["--app-shell-aside-width"]=$(i.base),e["--app-shell-aside-offset"]=$(i.base)),ct(i).forEach(f=>{f!=="base"&&(t[f]=t[f]||{},t[f]["--app-shell-aside-width"]=$(i[f]),t[f]["--app-shell-aside-offset"]=$(i[f]))})),(u=r==null?void 0:r.collapsed)!=null&&u.desktop){const f=r.breakpoint;t[f]=t[f]||{},t[f]["--app-shell-aside-transform"]=s,t[f]["--app-shell-aside-transform-rtl"]=l,t[f]["--app-shell-aside-offset"]="0px !important"}if((d=r==null?void 0:r.collapsed)!=null&&d.mobile){const f=$m(r.breakpoint,o)-.1;n[f]=n[f]||{},n[f]["--app-shell-aside-width"]="100%",n[f]["--app-shell-aside-offset"]="0px",n[f]["--app-shell-aside-transform"]=s,n[f]["--app-shell-aside-transform-rtl"]=l}}function IA({baseStyles:e,minMediaStyles:t,footer:n}){const r=n==null?void 0:n.height,o="translateY(var(--app-shell-footer-height))",i=(n==null?void 0:n.offset)??!0;if(cc(r)){const s=$(lc(r));e["--app-shell-footer-height"]=s,i&&(e["--app-shell-footer-offset"]=s)}uc(r)&&(typeof r.base<"u"&&(e["--app-shell-footer-height"]=$(r.base),i&&(e["--app-shell-footer-offset"]=$(r.base))),ct(r).forEach(s=>{s!=="base"&&(t[s]=t[s]||{},t[s]["--app-shell-footer-height"]=$(r[s]),i&&(t[s]["--app-shell-footer-offset"]=$(r[s])))})),n!=null&&n.collapsed&&(e["--app-shell-footer-transform"]=o,e["--app-shell-footer-offset"]="0px !important")}function _A({baseStyles:e,minMediaStyles:t,header:n}){const r=n==null?void 0:n.height,o="translateY(calc(var(--app-shell-header-height) * -1))",i=(n==null?void 0:n.offset)??!0;if(cc(r)){const s=$(lc(r));e["--app-shell-header-height"]=s,i&&(e["--app-shell-header-offset"]=s)}uc(r)&&(typeof r.base<"u"&&(e["--app-shell-header-height"]=$(r.base),i&&(e["--app-shell-header-offset"]=$(r.base))),ct(r).forEach(s=>{s!=="base"&&(t[s]=t[s]||{},t[s]["--app-shell-header-height"]=$(r[s]),i&&(t[s]["--app-shell-header-offset"]=$(r[s])))})),n!=null&&n.collapsed&&(e["--app-shell-header-transform"]=o,e["--app-shell-header-offset"]="0px !important")}function AA({baseStyles:e,minMediaStyles:t,maxMediaStyles:n,navbar:r,theme:o}){var c,u,d;const i=r==null?void 0:r.width,s="translateX(calc(var(--app-shell-navbar-width) * -1))",l="translateX(var(--app-shell-navbar-width))";if(r!=null&&r.breakpoint&&!((c=r==null?void 0:r.collapsed)!=null&&c.mobile)&&(n[r==null?void 0:r.breakpoint]=n[r==null?void 0:r.breakpoint]||{},n[r==null?void 0:r.breakpoint]["--app-shell-navbar-width"]="100%",n[r==null?void 0:r.breakpoint]["--app-shell-navbar-offset"]="0px"),cc(i)){const f=$(lc(i));e["--app-shell-navbar-width"]=f,e["--app-shell-navbar-offset"]=f}if(uc(i)&&(typeof i.base<"u"&&(e["--app-shell-navbar-width"]=$(i.base),e["--app-shell-navbar-offset"]=$(i.base)),ct(i).forEach(f=>{f!=="base"&&(t[f]=t[f]||{},t[f]["--app-shell-navbar-width"]=$(i[f]),t[f]["--app-shell-navbar-offset"]=$(i[f]))})),(u=r==null?void 0:r.collapsed)!=null&&u.desktop){const f=r.breakpoint;t[f]=t[f]||{},t[f]["--app-shell-navbar-transform"]=s,t[f]["--app-shell-navbar-transform-rtl"]=l,t[f]["--app-shell-navbar-offset"]="0px !important"}if((d=r==null?void 0:r.collapsed)!=null&&d.mobile){const f=$m(r.breakpoint,o)-.1;n[f]=n[f]||{},n[f]["--app-shell-navbar-width"]="100%",n[f]["--app-shell-navbar-offset"]="0px",n[f]["--app-shell-navbar-transform"]=s,n[f]["--app-shell-navbar-transform-rtl"]=l}}function Bh(e){return Number(e)===0?"0px":Kt(e)}function NA({padding:e,baseStyles:t,minMediaStyles:n}){cc(e)&&(t["--app-shell-padding"]=Bh(lc(e))),uc(e)&&(e.base&&(t["--app-shell-padding"]=Bh(e.base)),ct(e).forEach(r=>{r!=="base"&&(n[r]=n[r]||{},n[r]["--app-shell-padding"]=Bh(e[r]))}))}function OA({navbar:e,header:t,footer:n,aside:r,padding:o,theme:i}){const s={},l={},c={};AA({baseStyles:c,minMediaStyles:s,maxMediaStyles:l,navbar:e,theme:i}),DA({baseStyles:c,minMediaStyles:s,maxMediaStyles:l,aside:r,theme:i}),_A({baseStyles:c,minMediaStyles:s,header:t}),IA({baseStyles:c,minMediaStyles:s,footer:n}),NA({baseStyles:c,minMediaStyles:s,padding:o});const u=jl(ct(s),i).map(h=>({query:`(min-width: ${Nu(h.px)})`,styles:s[h.value]})),d=jl(ct(l),i).map(h=>({query:`(max-width: ${Nu(h.px)})`,styles:l[h.value]})),f=[...u,...d];return{baseStyles:c,media:f}}function MA({navbar:e,header:t,aside:n,footer:r,padding:o}){const i=Nt(),s=Ad(),{media:l,baseStyles:c}=OA({navbar:e,header:t,footer:r,aside:n,padding:o,theme:i});return b.createElement(Ea,{media:l,styles:c,selector:s.cssVariablesSelector})}const LA={},sy=G((e,t)=>{const n=V("AppShellNavbar",LA,e),{classNames:r,className:o,style:i,styles:s,unstyled:l,vars:c,withBorder:u,zIndex:d,...f}=n,h=Ia();return h.disabled?null:b.createElement(W,{component:"nav",ref:t,mod:{"with-border":u??h.withBorder},...h.getStyles("navbar",{className:o,classNames:r,styles:s,style:i}),...f,__vars:{"--app-shell-navbar-z-index":`calc(${d??h.zIndex} + 1)`}})});sy.classes=wi;sy.displayName="@mantine/core/AppShellNavbar";const $A={},ay=cn((e,t)=>{const n=V("AppShellSection",$A,e),{classNames:r,className:o,style:i,styles:s,vars:l,grow:c,...u}=n,d=Ia();return b.createElement(W,{ref:t,mod:{grow:c},...d.getStyles("section",{className:o,style:i,classNames:r,styles:s}),...u})});ay.classes=wi;ay.displayName="@mantine/core/AppShellSection";function FA({transitionDuration:e,disabled:t}){const[n,r]=p.useState(!1),o=p.useRef(),i=p.useRef();return mS("resize",()=>{r(!0),clearTimeout(o.current),o.current=window.setTimeout(()=>r(!1),200)}),Ca(()=>{r(!0),clearTimeout(i.current),i.current=window.setTimeout(()=>r(!1),e||0)},[t,e]),n}const zA={withBorder:!0,offsetScrollbars:!0,padding:0,transitionDuration:200,transitionTimingFunction:"ease",zIndex:_r("app")},BA=(e,{transitionDuration:t,transitionTimingFunction:n})=>({root:{"--app-shell-transition-duration":`${t}ms`,"--app-shell-transition-timing-function":n}}),An=G((e,t)=>{const n=V("AppShell",zA,e),{classNames:r,className:o,style:i,styles:s,unstyled:l,vars:c,navbar:u,withBorder:d,padding:f,transitionDuration:h,transitionTimingFunction:m,header:g,zIndex:y,layout:C,disabled:v,aside:x,footer:w,offsetScrollbars:S,...E}=n,j=ue({name:"AppShell",classes:wi,props:n,className:o,style:i,classNames:r,styles:s,unstyled:l,vars:c,varsResolver:BA}),T=FA({disabled:v,transitionDuration:h});return b.createElement(EA,{value:{getStyles:j,withBorder:d,zIndex:y,disabled:v,offsetScrollbars:S}},b.createElement(MA,{navbar:u,header:g,aside:x,footer:w,padding:f}),b.createElement(W,{ref:t,...j("root"),mod:{resizing:T,layout:C,disabled:v},...E}))});An.classes=wi;An.displayName="@mantine/core/AppShell";An.Navbar=sy;An.Header=oy;An.Main=iy;An.Aside=ny;An.Footer=ry;An.Section=ay;function kj(e){return typeof e=="string"?{value:e,label:e}:"value"in e&&!("label"in e)?{value:e.value,label:e.value,disabled:e.disabled}:typeof e=="number"?{value:e.toString(),label:e.toString()}:"group"in e?{group:e.group,items:e.items.map(t=>kj(t))}:e}function Rj(e){return e?e.map(t=>kj(t)):[]}function Dj(e){return e.reduce((t,n)=>"group"in n?{...t,...Dj(n.items)}:(t[n.value]=n,t),{})}var vn={dropdown:"m-88b62a41",options:"m-b2821a6e",option:"m-92253aa5",search:"m-985517d8",empty:"m-2530cd1d",header:"m-858f94bd",footer:"m-82b967cb",group:"m-254f3e4f",groupLabel:"m-2bb2e9e5",chevron:"m-2943220b",optionsDropdownScrollArea:"m-71d052f9",optionsDropdownOption:"m-390b5f4",optionsDropdownCheckIcon:"m-8ee53fc2"};const UA={error:null},VA=(e,{size:t})=>({chevron:{"--combobox-chevron-size":je(t,"combobox-chevron-size")}}),of=G((e,t)=>{const n=V("ComboboxChevron",UA,e),{size:r,error:o,style:i,className:s,classNames:l,styles:c,unstyled:u,vars:d,...f}=n,h=ue({name:"ComboboxChevron",classes:vn,props:n,style:i,className:s,classNames:l,styles:c,unstyled:u,vars:d,varsResolver:VA,rootSelector:"chevron"});return b.createElement(W,{component:"svg",...f,...h("chevron"),size:r,viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",mod:["combobox-chevron",{error:o}],ref:t},b.createElement("path",{d:"M4.93179 5.43179C4.75605 5.60753 4.75605 5.89245 4.93179 6.06819C5.10753 6.24392 5.39245 6.24392 5.56819 6.06819L7.49999 4.13638L9.43179 6.06819C9.60753 6.24392 9.89245 6.24392 10.0682 6.06819C10.2439 5.89245 10.2439 5.60753 10.0682 5.43179L7.81819 3.18179C7.73379 3.0974 7.61933 3.04999 7.49999 3.04999C7.38064 3.04999 7.26618 3.0974 7.18179 3.18179L4.93179 5.43179ZM10.0682 9.56819C10.2439 9.39245 10.2439 9.10753 10.0682 8.93179C9.89245 8.75606 9.60753 8.75606 9.43179 8.93179L7.49999 10.8636L5.56819 8.93179C5.39245 8.75606 5.10753 8.75606 4.93179 8.93179C4.75605 9.10753 4.75605 9.39245 4.93179 9.56819L7.18179 11.8182C7.35753 11.9939 7.64245 11.9939 7.81819 11.8182L10.0682 9.56819Z",fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd"}))});of.classes=vn;of.displayName="@mantine/core/ComboboxChevron";const[HA,mr]=wn("Combobox component was not found in tree"),Ij=p.forwardRef(({size:e,onMouseDown:t,onClick:n,onClear:r,...o},i)=>b.createElement(cs,{ref:i,size:e||"sm",variant:"transparent",tabIndex:-1,"aria-hidden":!0,...o,onMouseDown:s=>{s.preventDefault(),t==null||t(s)},onClick:s=>{r(),n==null||n(s)}}));Ij.displayName="@mantine/core/ComboboxClearButton";const WA={},ly=G((e,t)=>{const{classNames:n,styles:r,className:o,style:i,hidden:s,...l}=V("ComboboxDropdown",WA,e),c=mr();return b.createElement(Ar.Dropdown,{...l,ref:t,role:"presentation","data-hidden":s||void 0,...c.getStyles("dropdown",{className:o,style:i,classNames:n,styles:r})})});ly.classes=vn;ly.displayName="@mantine/core/ComboboxDropdown";const qA={refProp:"ref"},_j=G((e,t)=>{const{children:n,refProp:r}=V("ComboboxDropdownTarget",qA,e);if(mr(),!Co(n))throw new Error("Combobox.DropdownTarget component children should be an element or a component that accepts ref. Fragments, strings, numbers and other primitive values are not supported");return b.createElement(Ar.Target,{ref:t,refProp:r},n)});_j.displayName="@mantine/core/ComboboxDropdownTarget";const GA={},cy=G((e,t)=>{const{classNames:n,className:r,style:o,styles:i,vars:s,...l}=V("ComboboxEmpty",GA,e),c=mr();return b.createElement(W,{ref:t,...c.getStyles("empty",{className:r,classNames:n,styles:i,style:o}),...l})});cy.classes=vn;cy.displayName="@mantine/core/ComboboxEmpty";function uy({onKeyDown:e,withKeyboardNavigation:t,withAriaAttributes:n,withExpandedAttribute:r,targetType:o}){const i=mr(),[s,l]=p.useState(null),c=d=>{if(e==null||e(d),!i.readOnly&&t){if(d.nativeEvent.code==="ArrowDown"&&(d.preventDefault(),i.store.dropdownOpened?l(i.store.selectNextOption()):(i.store.openDropdown("keyboard"),l(i.store.selectActiveOption()))),d.nativeEvent.code==="ArrowUp"&&(d.preventDefault(),i.store.dropdownOpened?l(i.store.selectPreviousOption()):(i.store.openDropdown("keyboard"),l(i.store.selectActiveOption()))),d.nativeEvent.code==="Enter"||d.nativeEvent.code==="NumpadEnter"){const f=i.store.getSelectedOptionIndex();i.store.dropdownOpened&&f!==-1?(d.preventDefault(),i.store.clickSelectedOption()):o==="button"&&(d.preventDefault(),i.store.openDropdown("keyboard"))}d.nativeEvent.code==="Escape"&&i.store.closeDropdown("keyboard"),d.nativeEvent.code==="Space"&&o==="button"&&(d.preventDefault(),i.store.toggleDropdown("keyboard"))}};return{...n?{"aria-haspopup":"listbox","aria-expanded":r&&!!(i.store.listId&&i.store.dropdownOpened)||void 0,"aria-controls":i.store.listId,"aria-activedescendant":i.store.dropdownOpened&&s||void 0,autoComplete:"off","data-expanded":i.store.dropdownOpened?!0:void 0}:{},onKeyDown:c}}const QA={refProp:"ref",targetType:"input",withKeyboardNavigation:!0,withAriaAttributes:!0,withExpandedAttribute:!1},Aj=G((e,t)=>{const{children:n,refProp:r,withKeyboardNavigation:o,withAriaAttributes:i,withExpandedAttribute:s,targetType:l,...c}=V("ComboboxEventsTarget",QA,e);if(!Co(n))throw new Error("Combobox.EventsTarget component children should be an element or a component that accepts ref. Fragments, strings, numbers and other primitive values are not supported");const u=mr(),d=uy({targetType:l,withAriaAttributes:i,withKeyboardNavigation:o,withExpandedAttribute:s,onKeyDown:n.props.onKeyDown});return p.cloneElement(n,{...d,...c,[r]:tn(t,u.store.targetRef,n==null?void 0:n.ref)})});Aj.displayName="@mantine/core/ComboboxEventsTarget";const KA={},dy=G((e,t)=>{const{classNames:n,className:r,style:o,styles:i,vars:s,...l}=V("ComboboxFooter",KA,e),c=mr();return b.createElement(W,{ref:t,...c.getStyles("footer",{className:r,classNames:n,style:o,styles:i}),...l})});dy.classes=vn;dy.displayName="@mantine/core/ComboboxFooter";const YA={},fy=G((e,t)=>{const{classNames:n,className:r,style:o,styles:i,vars:s,children:l,label:c,...u}=V("ComboboxGroup",YA,e),d=mr();return b.createElement(W,{ref:t,...d.getStyles("group",{className:r,classNames:n,style:o,styles:i}),...u},c&&b.createElement("div",{...d.getStyles("groupLabel",{classNames:n,styles:i})},c),l)});fy.classes=vn;fy.displayName="@mantine/core/ComboboxGroup";const XA={},hy=G((e,t)=>{const{classNames:n,className:r,style:o,styles:i,vars:s,...l}=V("ComboboxHeader",XA,e),c=mr();return b.createElement(W,{ref:t,...c.getStyles("header",{className:r,classNames:n,style:o,styles:i}),...l})});hy.classes=vn;hy.displayName="@mantine/core/ComboboxHeader";const JA={},py=G((e,t)=>{const n=V("ComboboxOption",JA,e),{classNames:r,className:o,style:i,styles:s,vars:l,onClick:c,id:u,active:d,onMouseDown:f,onMouseOver:h,disabled:m,selected:g,...y}=n,C=mr(),v=p.useId(),x=u||v;return b.createElement(W,{...C.getStyles("option",{className:o,classNames:r,styles:s,style:i}),...y,ref:t,id:x,mod:["combobox-option",{"combobox-active":d,"combobox-disabled":m,"combobox-selected":g}],role:"option",onClick:w=>{var S;m?w.preventDefault():((S=C.onOptionSubmit)==null||S.call(C,n.value,n),c==null||c(w))},onMouseDown:w=>{w.preventDefault(),f==null||f(w)},onMouseOver:w=>{C.resetSelectionOnOptionHover&&C.store.resetSelectedOption(),h==null||h(w)}})});py.classes=vn;py.displayName="@mantine/core/ComboboxOption";const ZA={},my=G((e,t)=>{const n=V("ComboboxOptions",ZA,e),{classNames:r,className:o,style:i,styles:s,id:l,onMouseDown:c,labelledBy:u,...d}=n,f=mr(),h=Ln(l);return p.useEffect(()=>{f.store.setListId(h)},[h]),b.createElement(W,{ref:t,...f.getStyles("options",{className:o,style:i,classNames:r,styles:s}),...d,id:h,role:"listbox","aria-labelledby":u,onMouseDown:m=>{m.preventDefault(),c==null||c(m)}})});my.classes=vn;my.displayName="@mantine/core/ComboboxOptions";const e3={withAriaAttributes:!0,withKeyboardNavigation:!0},gy=G((e,t)=>{const n=V("ComboboxSearch",e3,e),{classNames:r,styles:o,unstyled:i,vars:s,withAriaAttributes:l,onKeyDown:c,withKeyboardNavigation:u,size:d,...f}=n,h=mr(),m=h.getStyles("search"),g=uy({targetType:"input",withAriaAttributes:l,withKeyboardNavigation:u,withExpandedAttribute:!1,onKeyDown:c});return b.createElement(St,{ref:tn(t,h.store.searchRef),classNames:[{input:m.className},r],styles:[{input:m.style},o],size:d||h.size,...g,...f,__staticSelector:"Combobox"})});gy.classes=vn;gy.displayName="@mantine/core/ComboboxSearch";const t3={refProp:"ref",targetType:"input",withKeyboardNavigation:!0,withAriaAttributes:!0,withExpandedAttribute:!1},Nj=G((e,t)=>{const{children:n,refProp:r,withKeyboardNavigation:o,withAriaAttributes:i,withExpandedAttribute:s,targetType:l,...c}=V("ComboboxTarget",t3,e);if(!Co(n))throw new Error("Combobox.Target component children should be an element or a component that accepts ref. Fragments, strings, numbers and other primitive values are not supported");const u=mr(),d=uy({targetType:l,withAriaAttributes:i,withKeyboardNavigation:o,withExpandedAttribute:s,onKeyDown:n.props.onKeyDown}),f=p.cloneElement(n,{...d,...c});return b.createElement(Ar.Target,{ref:tn(t,u.store.targetRef)},f)});Nj.displayName="@mantine/core/ComboboxTarget";function n3(e,t,n){for(let r=e-1;r>=0;r-=1)if(!t[r].hasAttribute("data-combobox-disabled"))return r;if(n){for(let r=t.length-1;r>-1;r-=1)if(!t[r].hasAttribute("data-combobox-disabled"))return r}return e}function r3(e,t,n){for(let r=e+1;r<t.length;r+=1)if(!t[r].hasAttribute("data-combobox-disabled"))return r;if(n){for(let r=0;r<t.length;r+=1)if(!t[r].hasAttribute("data-combobox-disabled"))return r}return e}function o3(e){for(let t=0;t<e.length;t+=1)if(!e[t].hasAttribute("data-combobox-disabled"))return t;return-1}function yy({defaultOpened:e,opened:t,onOpenedChange:n,onDropdownClose:r,onDropdownOpen:o,loop:i=!0,scrollBehavior:s="instant"}={}){const[l,c]=yn({value:t,defaultValue:e,finalValue:!1,onChange:n}),u=p.useRef(null),d=p.useRef(-1),f=p.useRef(null),h=p.useRef(null),m=p.useRef(-1),g=p.useRef(-1),y=p.useRef(-1),C=p.useCallback((F="unknown")=>{l||(c(!0),o==null||o(F))},[c,o,l]),v=p.useCallback((F="unknown")=>{l&&(c(!1),r==null||r(F))},[c,r,l]),x=p.useCallback((F="unknown")=>{l?v(F):C(F)},[v,C,l]),w=p.useCallback(()=>{const F=document.querySelector(`#${u.current} [data-combobox-selected]`);F==null||F.removeAttribute("data-combobox-selected"),F==null||F.removeAttribute("aria-selected")},[]),S=p.useCallback(F=>{const _=document.getElementById(u.current),k=_==null?void 0:_.querySelectorAll("[data-combobox-option]");if(!k)return null;const z=F>=k.length?0:F<0?k.length-1:F;return d.current=z,k!=null&&k[z]&&!k[z].hasAttribute("data-combobox-disabled")?(w(),k[z].setAttribute("data-combobox-selected","true"),k[z].setAttribute("aria-selected","true"),k[z].scrollIntoView({block:"nearest",behavior:s}),k[z].id):null},[s,w]),E=p.useCallback(()=>{const F=document.querySelector(`#${u.current} [data-combobox-active]`);if(F){const _=document.querySelectorAll(`#${u.current} [data-combobox-option]`),k=Array.from(_).findIndex(z=>z===F);return S(k)}return S(0)},[S]),j=p.useCallback(()=>S(r3(d.current,document.querySelectorAll(`#${u.current} [data-combobox-option]`),i)),[S,i]),T=p.useCallback(()=>S(n3(d.current,document.querySelectorAll(`#${u.current} [data-combobox-option]`),i)),[S,i]),P=p.useCallback(()=>S(o3(document.querySelectorAll(`#${u.current} [data-combobox-option]`))),[S]),R=p.useCallback((F="selected")=>{y.current=window.setTimeout(()=>{const _=document.querySelectorAll(`#${u.current} [data-combobox-option]`),k=Array.from(_).findIndex(z=>z.hasAttribute(`data-combobox-${F}`));d.current=k},0)},[]),I=p.useCallback(()=>{d.current=-1,w()},[w]),O=p.useCallback(()=>{const F=document.querySelectorAll(`#${u.current} [data-combobox-option]`),_=F==null?void 0:F[d.current];_==null||_.click()},[]),D=p.useCallback(F=>{u.current=F},[]),A=p.useCallback(()=>{m.current=window.setTimeout(()=>f.current.focus(),0)},[]),M=p.useCallback(()=>{g.current=window.setTimeout(()=>h.current.focus(),0)},[]),B=p.useCallback(()=>d.current,[]);return p.useEffect(()=>()=>{window.clearTimeout(m.current),window.clearTimeout(g.current),window.clearTimeout(y.current)},[]),{dropdownOpened:l,openDropdown:C,closeDropdown:v,toggleDropdown:x,selectedOptionIndex:d.current,getSelectedOptionIndex:B,selectOption:S,selectFirstOption:P,selectActiveOption:E,selectNextOption:j,selectPreviousOption:T,resetSelectedOption:I,updateSelectedOptionIndex:R,listId:u.current,setListId:D,clickSelectedOption:O,searchRef:f,focusSearchInput:A,targetRef:h,focusTarget:M}}const i3={keepMounted:!0,withinPortal:!0,resetSelectionOnOptionHover:!1,width:"target",transitionProps:{transition:"fade",duration:0}},s3=(e,{size:t,dropdownPadding:n})=>({options:{"--combobox-option-fz":Xt(t),"--combobox-option-padding":je(t,"combobox-option-padding")},dropdown:{"--combobox-padding":n===void 0?void 0:$(n),"--combobox-option-fz":Xt(t),"--combobox-option-padding":je(t,"combobox-option-padding")}});function Me(e){const t=V("Combobox",i3,e),{classNames:n,styles:r,unstyled:o,children:i,store:s,vars:l,onOptionSubmit:c,onClose:u,size:d,dropdownPadding:f,resetSelectionOnOptionHover:h,__staticSelector:m,readOnly:g,...y}=t,C=yy(),v=s||C,x=ue({name:m||"Combobox",classes:vn,props:t,classNames:n,styles:r,unstyled:o,vars:l,varsResolver:s3}),w=()=>{u==null||u(),v.closeDropdown()};return b.createElement(HA,{value:{getStyles:x,store:v,onOptionSubmit:c,size:d,resetSelectionOnOptionHover:h,readOnly:g}},b.createElement(Ar,{opened:v.dropdownOpened,...y,onClose:w,withRoles:!1,unstyled:o},i))}const a3=e=>e;Me.extend=a3;Me.classes=vn;Me.displayName="@mantine/core/Combobox";Me.Target=Nj;Me.Dropdown=ly;Me.Options=my;Me.Option=py;Me.Search=gy;Me.Empty=cy;Me.Chevron=of;Me.Footer=dy;Me.Header=hy;Me.EventsTarget=Aj;Me.DropdownTarget=_j;Me.Group=fy;Me.ClearButton=Ij;var Oj={root:"m-5f75b09e",body:"m-5f6e695e",labelWrapper:"m-d3ea56bb",label:"m-8ee546b8",description:"m-328f68c0",error:"m-8e8a99cc"};const Mj=Oj,sf=p.forwardRef(({__staticSelector:e,__stylesApiProps:t,className:n,classNames:r,styles:o,unstyled:i,children:s,label:l,description:c,id:u,disabled:d,error:f,size:h,labelPosition:m="left",variant:g,style:y,vars:C,...v},x)=>{const w=ue({name:e,props:t,className:n,style:y,classes:Oj,classNames:r,styles:o,unstyled:i});return b.createElement(W,{...w("root"),ref:x,__vars:{"--label-fz":Xt(h),"--label-lh":je(h,"label-lh")},mod:{"label-position":m},variant:g,size:h,...v},b.createElement("div",{...w("body")},s,b.createElement("div",{...w("labelWrapper"),"data-disabled":d||void 0},l&&b.createElement("label",{...w("label"),"data-disabled":d||void 0,htmlFor:u},l),c&&b.createElement(St.Description,{size:h,__inheritStyles:!1,...w("description")},c),f&&f!=="boolean"&&b.createElement(St.Error,{size:h,__inheritStyles:!1,...w("error")},f))))});sf.displayName="@mantine/core/InlineInput";const Lj=p.createContext(null),l3=Lj.Provider,c3=()=>p.useContext(Lj);function vy({children:e,role:t}){const n=Da();return n?b.createElement("div",{role:t,"aria-labelledby":n.labelId,"aria-describedby":n.describedBy},e):b.createElement(b.Fragment,null,e)}const u3={},xy=G((e,t)=>{const{value:n,defaultValue:r,onChange:o,size:i,wrapperProps:s,children:l,...c}=V("CheckboxGroup",u3,e),[u,d]=yn({value:n,defaultValue:r,finalValue:[],onChange:o}),f=h=>{const m=h.currentTarget.value;d(u.includes(m)?u.filter(g=>g!==m):[...u,m])};return b.createElement(l3,{value:{value:u,onChange:f,size:i}},b.createElement(St.Wrapper,{size:i,ref:t,...s,...c,labelElement:"div",__staticSelector:"CheckboxGroup"},b.createElement(vy,{role:"group"},l)))});xy.classes=St.Wrapper.classes;xy.displayName="@mantine/core/CheckboxGroup";function af({size:e,style:t,...n}){const r=e!==void 0?{width:$(e),height:$(e),...t}:t;return b.createElement("svg",{viewBox:"0 0 10 7",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:r,"aria-hidden":!0,...n},b.createElement("path",{d:"M4 4.586L1.707 2.293A1 1 0 1 0 .293 3.707l3 3a.997.997 0 0 0 1.414 0l5-5A1 1 0 1 0 8.293.293L4 4.586z",fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd"}))}function d3({indeterminate:e,...t}){return e?b.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 32 6","aria-hidden":!0,...t},b.createElement("rect",{width:"32",height:"6",fill:"currentColor",rx:"3"})):b.createElement(af,{...t})}var $j={root:"m-bf2d988c",inner:"m-26062bec",input:"m-26063560",icon:"m-bf295423","input--outline":"m-215c4542"};const f3={labelPosition:"right",icon:d3},h3=(e,{radius:t,color:n,size:r,iconColor:o,variant:i,autoContrast:s})=>{const l=Jr({color:n||e.primaryColor,theme:e}),c=l.isThemeColor&&l.shade===void 0?`var(--mantine-color-${l.color}-outline)`:l.color;return{root:{"--checkbox-size":je(r,"checkbox-size"),"--checkbox-radius":t===void 0?void 0:gt(t),"--checkbox-color":i==="outline"?c:wt(n,e),"--checkbox-icon-color":o?wt(o,e):s?ja({color:n,theme:e}):void 0}}},ur=G((e,t)=>{const n=V("Checkbox",f3,e),{classNames:r,className:o,style:i,styles:s,unstyled:l,vars:c,color:u,label:d,id:f,size:h,radius:m,wrapperProps:g,children:y,checked:C,labelPosition:v,description:x,error:w,disabled:S,variant:E,indeterminate:j,icon:T,rootRef:P,iconColor:R,onChange:I,autoContrast:O,...D}=n,A=c3(),M=h||(A==null?void 0:A.size),B=T,F=ue({name:"Checkbox",props:n,classes:$j,className:o,style:i,classNames:r,styles:s,unstyled:l,vars:c,varsResolver:h3}),{styleProps:_,rest:k}=jo(D),z=Ln(f),q=A?{checked:A.value.includes(k.value),onChange:Q=>{A.onChange(Q),I==null||I(Q)}}:{};return b.createElement(sf,{...F("root"),__staticSelector:"Checkbox",__stylesApiProps:n,id:z,size:M,labelPosition:v,label:d,description:x,error:w,disabled:S,classNames:r,styles:s,unstyled:l,"data-checked":q.checked||C||void 0,variant:E,ref:P,..._,...g},b.createElement(W,{...F("inner"),mod:{"data-label-position":v}},b.createElement(W,{component:"input",id:z,ref:t,checked:C,disabled:S,mod:{error:!!w,indeterminate:j},...F("input",{focusable:!0,variant:E}),onChange:I,...k,...q,type:"checkbox"}),b.createElement(B,{indeterminate:j,...F("icon")})))});ur.classes={...$j,...Mj};ur.displayName="@mantine/core/Checkbox";ur.Group=xy;function ma(e){return"group"in e}function Fj({options:e,search:t,limit:n}){const r=t.trim().toLowerCase(),o=[];for(let i=0;i<e.length;i+=1){const s=e[i];if(o.length===n)return o;ma(s)&&o.push({group:s.group,items:Fj({options:s.items,search:t,limit:n-o.length})}),ma(s)||s.label.toLowerCase().includes(r)&&o.push(s)}return o}function p3(e){if(e.length===0)return!0;for(const t of e)if(!("group"in t)||t.items.length>0)return!1;return!0}function zj(e,t=new Set){if(Array.isArray(e))for(const n of e)if(ma(n))zj(n.items,t);else{if(typeof n.value>"u")throw new Error("[@mantine/core] Each option must have value property");if(typeof n.value!="string")throw new Error(`[@mantine/core] Option value must be a string, other data formats are not supported, got ${typeof n.value}`);if(t.has(n.value))throw new Error(`[@mantine/core] Duplicate options are not supported. Option with value "${n.value}" was provided more than once`);t.add(n.value)}}function Uh(e,t){return Array.isArray(e)?e.includes(t):e===t}function Bj({data:e,withCheckIcon:t,value:n,checkIconPosition:r,unstyled:o}){if(!ma(e)){const s=t&&Uh(n,e.value)&&b.createElement(af,{className:vn.optionsDropdownCheckIcon});return b.createElement(Me.Option,{value:e.value,disabled:e.disabled,className:Ye({[vn.optionsDropdownOption]:!o}),"data-reverse":r==="right"||void 0,"data-checked":Uh(n,e.value)||void 0,"aria-selected":Uh(n,e.value)},r==="left"&&s,b.createElement("span",null,e.label),r==="right"&&s)}const i=e.items.map(s=>b.createElement(Bj,{data:s,value:n,key:s.value,unstyled:o,withCheckIcon:t,checkIconPosition:r}));return b.createElement(Me.Group,{label:e.group},i)}function m3({data:e,hidden:t,hiddenWhenEmpty:n,filter:r,search:o,limit:i,maxDropdownHeight:s,withScrollArea:l=!0,filterOptions:c=!0,withCheckIcon:u=!1,value:d,checkIconPosition:f,nothingFoundMessage:h,unstyled:m,labelId:g}){zj(e);const C=typeof o=="string"?(r||Fj)({options:e,search:c?o:"",limit:i??1/0}):e,v=p3(C),x=C.map(w=>b.createElement(Bj,{data:w,key:ma(w)?w.group:w.value,withCheckIcon:u,value:d,checkIconPosition:f,unstyled:m}));return b.createElement(Me.Dropdown,{hidden:t||n&&v},b.createElement(Me.Options,{labelledBy:g},l?b.createElement(fr.Autosize,{mah:s??220,type:"scroll",scrollbarSize:"var(--_combobox-padding)",offsetScrollbars:"y",className:vn.optionsDropdownScrollArea},x):x,v&&h&&b.createElement(Me.Empty,null,h)))}const Uj=p.createContext(null),g3=Uj.Provider;function y3(){return{withinGroup:!!p.useContext(Uj)}}var lf={root:"m-f85678b6",image:"m-11f8ac07",placeholder:"m-104cd71f",group:"m-11def92b"};const v3={},x3=(e,{spacing:t})=>({group:{"--ag-spacing":Kt(t)}}),wy=G((e,t)=>{const n=V("AvatarGroup",v3,e),{classNames:r,className:o,style:i,styles:s,unstyled:l,vars:c,spacing:u,...d}=n,f=ue({name:"AvatarGroup",classes:lf,props:n,className:o,style:i,classNames:r,styles:s,unstyled:l,vars:c,varsResolver:x3,rootSelector:"group"});return b.createElement(g3,{value:!0},b.createElement(W,{ref:t,...f("group"),...d}))});wy.classes=lf;wy.displayName="@mantine/core/AvatarGroup";function w3(e){return b.createElement("svg",{...e,"data-avatar-placeholder-icon":!0,viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},b.createElement("path",{d:"M0.877014 7.49988C0.877014 3.84219 3.84216 0.877045 7.49985 0.877045C11.1575 0.877045 14.1227 3.84219 14.1227 7.49988C14.1227 11.1575 11.1575 14.1227 7.49985 14.1227C3.84216 14.1227 0.877014 11.1575 0.877014 7.49988ZM7.49985 1.82704C4.36683 1.82704 1.82701 4.36686 1.82701 7.49988C1.82701 8.97196 2.38774 10.3131 3.30727 11.3213C4.19074 9.94119 5.73818 9.02499 7.50023 9.02499C9.26206 9.02499 10.8093 9.94097 11.6929 11.3208C12.6121 10.3127 13.1727 8.97172 13.1727 7.49988C13.1727 4.36686 10.6328 1.82704 7.49985 1.82704ZM10.9818 11.9787C10.2839 10.7795 8.9857 9.97499 7.50023 9.97499C6.01458 9.97499 4.71624 10.7797 4.01845 11.9791C4.97952 12.7272 6.18765 13.1727 7.49985 13.1727C8.81227 13.1727 10.0206 12.727 10.9818 11.9787ZM5.14999 6.50487C5.14999 5.207 6.20212 4.15487 7.49999 4.15487C8.79786 4.15487 9.84999 5.207 9.84999 6.50487C9.84999 7.80274 8.79786 8.85487 7.49999 8.85487C6.20212 8.85487 5.14999 7.80274 5.14999 6.50487ZM7.49999 5.10487C6.72679 5.10487 6.09999 5.73167 6.09999 6.50487C6.09999 7.27807 6.72679 7.90487 7.49999 7.90487C8.27319 7.90487 8.89999 7.27807 8.89999 6.50487C8.89999 5.73167 8.27319 5.10487 7.49999 5.10487Z",fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd"}))}const S3={},b3=(e,{size:t,radius:n,variant:r,gradient:o,color:i,autoContrast:s})=>{const l=e.variantColorResolver({color:i||"gray",theme:e,gradient:o,variant:r||"light",autoContrast:s});return{root:{"--avatar-size":je(t,"avatar-size"),"--avatar-radius":n===void 0?void 0:gt(n),"--avatar-bg":i||r?l.background:void 0,"--avatar-color":i||r?l.color:void 0,"--avatar-bd":i||r?l.border:void 0}}},Yi=cn((e,t)=>{const n=V("Avatar",S3,e),{classNames:r,className:o,style:i,styles:s,unstyled:l,vars:c,src:u,alt:d,radius:f,color:h,gradient:m,imageProps:g,children:y,autoContrast:C,...v}=n,x=y3(),[w,S]=p.useState(!u),E=ue({name:"Avatar",props:n,classes:lf,className:o,style:i,classNames:r,styles:s,unstyled:l,vars:c,varsResolver:b3});return p.useEffect(()=>S(!u),[u]),b.createElement(W,{...E("root"),mod:{"within-group":x.withinGroup},ref:t,...v},w?b.createElement("span",{...E("placeholder"),title:d},y||b.createElement(w3,null)):b.createElement("img",{...g,...E("image"),src:u,alt:d,onError:j=>{var T;S(!0),(T=g==null?void 0:g.onError)==null||T.call(g,j)}}))});Yi.classes=lf;Yi.displayName="@mantine/core/Avatar";Yi.Group=wy;var Vj={root:"m-347db0ec","root--dot":"m-fbd81e3d",label:"m-5add502a",section:"m-91fdda9b"};const C3={},j3=(e,{radius:t,color:n,gradient:r,variant:o,size:i,autoContrast:s})=>{const l=e.variantColorResolver({color:n||e.primaryColor,theme:e,gradient:r,variant:o||"filled",autoContrast:s});return{root:{"--badge-height":je(i,"badge-height"),"--badge-padding-x":je(i,"badge-padding-x"),"--badge-fz":je(i,"badge-fz"),"--badge-radius":t===void 0?void 0:gt(t),"--badge-bg":n||o?l.background:void 0,"--badge-color":n||o?l.color:void 0,"--badge-bd":n||o?l.border:void 0,"--badge-dot-color":o==="dot"?wt(n,e):void 0}}},cf=cn((e,t)=>{const n=V("Badge",C3,e),{classNames:r,className:o,style:i,styles:s,unstyled:l,vars:c,radius:u,color:d,gradient:f,leftSection:h,rightSection:m,children:g,variant:y,fullWidth:C,autoContrast:v,circle:x,...w}=n,S=ue({name:"Badge",props:n,classes:Vj,className:o,style:i,classNames:r,styles:s,unstyled:l,vars:c,varsResolver:j3});return b.createElement(W,{variant:y,mod:{block:C,circle:x},...S("root",{variant:y}),ref:t,...w},h&&b.createElement("span",{...S("section"),"data-position":"left"},h),b.createElement("span",{...S("label")},g),m&&b.createElement("span",{...S("section"),"data-position":"right"},m))});cf.classes=Vj;cf.displayName="@mantine/core/Badge";var Hj={root:"m-ddec01c0",icon:"m-dde7bd57",cite:"m-dde51a35"};const E3={iconSize:48},T3=(e,{color:t,iconSize:n,radius:r})=>{const o=Jr({color:t||e.primaryColor,theme:e,colorScheme:"dark"}),i=Jr({color:t||e.primaryColor,theme:e,colorScheme:"light"});return{root:{"--bq-bg-light":Qt(i.value,.07),"--bq-bg-dark":Qt(o.value,.06),"--bq-bd":wt(t,e),"--bq-icon-size":$(n),"--bq-radius":gt(r)}}},Sy=G((e,t)=>{const n=V("Blockquote",E3,e),{classNames:r,className:o,style:i,styles:s,unstyled:l,vars:c,children:u,icon:d,iconSize:f,cite:h,...m}=n,g=ue({name:"Blockquote",classes:Hj,props:n,className:o,style:i,classNames:r,styles:s,unstyled:l,vars:c,varsResolver:T3});return b.createElement(W,{component:"blockquote",ref:t,...g("root"),...m},d&&b.createElement("span",{...g("icon")},d),u,h&&b.createElement("cite",{...g("cite")},h))});Sy.classes=Hj;Sy.displayName="@mantine/core/Blockquote";var uf={root:"m-77c9d27d",inner:"m-80f1301b",loader:"m-a25b86ee",label:"m-811560b9",section:"m-a74036a",group:"m-80d6d844"};const Qx={orientation:"horizontal"},P3=(e,{borderWidth:t})=>({group:{"--button-border-width":$(t)}}),by=G((e,t)=>{const n=V("ButtonGroup",Qx,e),{className:r,style:o,classNames:i,styles:s,unstyled:l,orientation:c,vars:u,borderWidth:d,variant:f,...h}=V("ButtonGroup",Qx,e),m=ue({name:"ButtonGroup",props:n,classes:uf,className:r,style:o,classNames:i,styles:s,unstyled:l,vars:u,varsResolver:P3,rootSelector:"group"});return b.createElement(W,{...m("group"),ref:t,variant:f,mod:{"data-orientation":c},role:"group",...h})});by.classes=uf;by.displayName="@mantine/core/ButtonGroup";const k3={},R3=(e,{radius:t,color:n,gradient:r,variant:o,size:i,justify:s,autoContrast:l})=>{const c=e.variantColorResolver({color:n||e.primaryColor,theme:e,gradient:r,variant:o||"filled",autoContrast:l});return{root:{"--button-justify":s,"--button-height":je(i,"button-height"),"--button-padding-x":je(i,"button-padding-x"),"--button-fz":i!=null&&i.includes("compact")?Xt(i.replace("compact-","")):Xt(i),"--button-radius":t===void 0?void 0:gt(t),"--button-bg":n||o?c.background:void 0,"--button-hover":n||o?c.hover:void 0,"--button-color":c.color,"--button-bd":n||o?c.border:void 0,"--button-hover-color":n||o?c.hoverColor:void 0}}},Z=cn((e,t)=>{const n=V("Button",k3,e),{style:r,vars:o,className:i,color:s,disabled:l,children:c,leftSection:u,rightSection:d,fullWidth:f,variant:h,radius:m,loading:g,loaderProps:y,gradient:C,classNames:v,styles:x,unstyled:w,"data-disabled":S,autoContrast:E,...j}=n,T=ue({name:"Button",props:n,classes:uf,className:i,style:r,classNames:v,styles:x,unstyled:w,vars:o,varsResolver:R3}),P=!!u,R=!!d;return b.createElement(Gn,{ref:t,...T("root",{active:!l&&!g&&!S}),unstyled:w,variant:h,disabled:l||g,mod:{disabled:l||S,loading:g,block:f,"with-left-section":P,"with-right-section":R},...j},b.createElement(W,{component:"span",...T("loader"),"aria-hidden":!0},b.createElement(Nn,{color:"var(--button-color)",size:"calc(var(--button-height) / 1.8)",...y})),b.createElement("span",{...T("inner")},u&&b.createElement(W,{component:"span",...T("section"),mod:{position:"left"}},u),b.createElement(W,{component:"span",mod:{loading:g},...T("label")},c),d&&b.createElement(W,{component:"span",...T("section"),mod:{position:"right"}},d)))});Z.classes=uf;Z.displayName="@mantine/core/Button";Z.Group=by;var Wj={root:"m-4451eb3a"};const D3={},Ut=cn((e,t)=>{const n=V("Center",D3,e),{classNames:r,className:o,style:i,styles:s,unstyled:l,vars:c,inline:u,...d}=n,f=ue({name:"Center",props:n,classes:Wj,className:o,style:i,classNames:r,styles:s,unstyled:l,vars:c});return b.createElement(W,{ref:t,mod:{inline:u},...f("root"),...d})});Ut.classes=Wj;Ut.displayName="@mantine/core/Center";const[I3,_3]=ec(),A3={};function qj(e){const{value:t,defaultValue:n,onChange:r,multiple:o,children:i}=V("ChipGroup",A3,e),[s,l]=yn({value:t,defaultValue:n,finalValue:o?[]:null,onChange:r}),c=d=>Array.isArray(s)?s.includes(d):d===s,u=d=>{const f=d.currentTarget.value;Array.isArray(s)?l(s.includes(f)?s.filter(h=>h!==f):[...s,f]):l(f)};return b.createElement(I3,{value:{isChipSelected:c,onChange:u,multiple:o}},i)}qj.displayName="@mantine/core/ChipGroup";var Gj={root:"m-f59ffda3",label:"m-be049a53","label--outline":"m-3904c1af","label--filled":"m-fa109255","label--light":"m-f7e165c3",iconWrapper:"m-9ac86df9",checkIcon:"m-d6d72580",input:"m-bde07329"};const N3={type:"checkbox"},O3=(e,{size:t,radius:n,variant:r,color:o,autoContrast:i})=>{const s=e.variantColorResolver({color:o||e.primaryColor,theme:e,variant:r||"filled",autoContrast:i});return{root:{"--chip-fz":Xt(t),"--chip-size":je(t,"chip-size"),"--chip-radius":n===void 0?void 0:gt(n),"--chip-checked-padding":je(t,"chip-checked-padding"),"--chip-padding":je(t,"chip-padding"),"--chip-icon-size":je(t,"chip-icon-size"),"--chip-bg":o||r?s.background:void 0,"--chip-hover":o||r?s.hover:void 0,"--chip-color":o||r?s.color:void 0,"--chip-bd":o||r?s.border:void 0,"--chip-spacing":je(t,"chip-spacing")}}},Vl=G((e,t)=>{const n=V("Chip",N3,e),{classNames:r,className:o,style:i,styles:s,unstyled:l,vars:c,id:u,checked:d,defaultChecked:f,onChange:h,value:m,wrapperProps:g,type:y,disabled:C,children:v,size:x,variant:w,icon:S,rootRef:E,autoContrast:j,...T}=n,P=ue({name:"Chip",classes:Gj,props:n,className:o,style:i,classNames:r,styles:s,unstyled:l,vars:c,varsResolver:O3}),R=_3(),I=Ln(u),{styleProps:O,rest:D}=jo(T),[A,M]=yn({value:d,defaultValue:f,finalValue:!1,onChange:h}),B=R?{checked:R.isChipSelected(m),onChange:_=>{R.onChange(_),h==null||h(_.currentTarget.checked)},type:R.multiple?"checkbox":"radio"}:{},F=B.checked||A;return b.createElement(W,{size:x,variant:w,ref:E,...P("root"),...O,...g},b.createElement("input",{type:y,...P("input"),checked:F,onChange:_=>M(_.currentTarget.checked),id:I,disabled:C,ref:t,value:m,...B,...D}),b.createElement("label",{htmlFor:I,"data-checked":F||void 0,"data-disabled":C||void 0,...P("label",{variant:w||"filled"})},F&&b.createElement("span",{...P("iconWrapper")},S||b.createElement(af,{...P("checkIcon")})),v))});Vl.classes=Gj;Vl.displayName="@mantine/core/Chip";Vl.Group=qj;var Qj={root:"m-7485cace"};const M3={},L3=(e,{size:t,fluid:n})=>({root:{"--container-size":n?void 0:je(t,"container-size")}}),Cy=G((e,t)=>{const n=V("Container",M3,e),{classNames:r,className:o,style:i,styles:s,unstyled:l,vars:c,fluid:u,...d}=n,f=ue({name:"Container",classes:Qj,props:n,className:o,style:i,classNames:r,styles:s,unstyled:l,vars:c,varsResolver:L3});return b.createElement(W,{ref:t,mod:{fluid:u},...f("root"),...d})});Cy.classes=Qj;Cy.displayName="@mantine/core/Container";const $3={timeout:1e3};function Kj(e){const{children:t,timeout:n,value:r,...o}=V("CopyButton",$3,e),i=uS({timeout:n}),s=()=>i.copy(r);return b.createElement(b.Fragment,null,t({copy:s,copied:i.copied,...o}))}Kj.displayName="@mantine/core/CopyButton";var Yj={root:"m-3eebeb36",label:"m-9e365f20"};const F3={orientation:"horizontal"},z3=(e,{color:t,variant:n,size:r})=>({root:{"--divider-color":t?wt(t,e):void 0,"--divider-border-style":n,"--divider-size":je(r,"divider-size")}}),Tn=G((e,t)=>{const n=V("Divider",F3,e),{classNames:r,className:o,style:i,styles:s,unstyled:l,vars:c,color:u,orientation:d,label:f,labelPosition:h,...m}=n,g=ue({name:"Divider",classes:Yj,props:n,className:o,style:i,classNames:r,styles:s,unstyled:l,vars:c,varsResolver:z3});return b.createElement(W,{ref:t,mod:{orientation:d,"with-label":!!f},...g("root"),...m,role:"separator"},f&&b.createElement(W,{component:"span",mod:{position:h},...g("label")},f))});Tn.classes=Yj;Tn.displayName="@mantine/core/Divider";function B3({open:e,close:t,openDelay:n,closeDelay:r}){const o=p.useRef(-1),i=p.useRef(-1),s=()=>{window.clearTimeout(o.current),window.clearTimeout(i.current)},l=()=>{s(),n===0||n===void 0?e():o.current=window.setTimeout(e,n)},c=()=>{s(),r===0||r===void 0?t():i.current=window.setTimeout(t,r)};return p.useEffect(()=>s,[]),{openDropdown:l,closeDropdown:c}}const[U3,Xj]=wn("Grid component was not found in tree"),nm=(e,t)=>e==="content"?"auto":e==="auto"?"0rem":e?`${100/(t/e)}%`:void 0,Kx=(e,t,n)=>n||e==="auto"?"100%":e==="content"?"unset":nm(e,t),Yx=(e,t)=>{if(e)return e==="auto"||t?"1":"auto"},Xx=(e,t)=>e===0?"0":e?`${100/(t/e)}%`:void 0;function V3({span:e,order:t,offset:n,selector:r}){var h;const o=Nt(),i=Xj(),l=Qo(e)===void 0?12:Qo(e),c=rs({"--col-order":(h=Qo(t))==null?void 0:h.toString(),"--col-flex-grow":Yx(l,i.grow),"--col-flex-basis":nm(l,i.columns),"--col-width":l==="content"?"auto":void 0,"--col-max-width":Kx(l,i.columns,i.grow),"--col-offset":Xx(Qo(n),i.columns)}),u=ct(o.breakpoints).reduce((m,g)=>{var y;return m[g]||(m[g]={}),typeof t=="object"&&t[g]!==void 0&&(m[g]["--col-order"]=(y=t[g])==null?void 0:y.toString()),typeof e=="object"&&e[g]!==void 0&&(m[g]["--col-flex-grow"]=Yx(e[g],i.grow),m[g]["--col-flex-basis"]=nm(e[g],i.columns),m[g]["--col-width"]=e[g]==="content"?"auto":void 0,m[g]["--col-max-width"]=Kx(e[g],i.columns,i.grow)),typeof n=="object"&&n[g]!==void 0&&(m[g]["--col-offset"]=Xx(n[g],i.columns)),m},{}),f=jl(ct(u),o).filter(m=>ct(u[m.value]).length>0).map(m=>({query:`(min-width: ${o.breakpoints[m.value]})`,styles:u[m.value]}));return b.createElement(Ea,{styles:c,media:f,selector:r})}var jy={root:"m-410352e9",inner:"m-dee7bd2f",col:"m-96bdd299"};const H3={span:12},Ey=G((e,t)=>{const n=V("GridCol",H3,e),{classNames:r,className:o,style:i,styles:s,vars:l,span:c,order:u,offset:d,...f}=n,h=Xj(),m=tc();return b.createElement(b.Fragment,null,b.createElement(V3,{selector:`.${m}`,span:c,order:u,offset:d}),b.createElement(W,{ref:t,...h.getStyles("col",{className:Ye(o,m),style:i,classNames:r,styles:s}),...f}))});Ey.classes=jy;Ey.displayName="@mantine/core/GridCol";function W3({gutter:e,selector:t}){const n=Nt(),r=rs({"--grid-gutter":Kt(Qo(e))}),o=ct(n.breakpoints).reduce((l,c)=>(l[c]||(l[c]={}),typeof e=="object"&&e[c]!==void 0&&(l[c]["--grid-gutter"]=Kt(e[c])),l),{}),s=jl(ct(o),n).filter(l=>ct(o[l.value]).length>0).map(l=>({query:`(min-width: ${n.breakpoints[l.value]})`,styles:o[l.value]}));return b.createElement(Ea,{styles:r,media:s,selector:t})}const q3={gutter:"md",grow:!1,columns:12},G3=(e,{justify:t,align:n,overflow:r})=>({root:{"--grid-justify":t,"--grid-align":n,"--grid-overflow":r}}),Vn=G((e,t)=>{const n=V("Grid",q3,e),{classNames:r,className:o,style:i,styles:s,unstyled:l,vars:c,grow:u,gutter:d,columns:f,align:h,justify:m,children:g,...y}=n,C=ue({name:"Grid",classes:jy,props:n,className:o,style:i,classNames:r,styles:s,unstyled:l,vars:c,varsResolver:G3}),v=tc();return b.createElement(U3,{value:{getStyles:C,grow:u,columns:f}},b.createElement(W3,{selector:`.${v}`,...n}),b.createElement(W,{ref:t,...C("root",{className:v}),...y},b.createElement("div",{...C("inner")},g)))});Vn.classes=jy;Vn.displayName="@mantine/core/Grid";Vn.Col=Ey;function fd(){return fd=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},fd.apply(this,arguments)}function Ty(e,t){if(e==null)return{};var n={},r=Object.keys(e),o,i;for(i=0;i<r.length;i++)o=r[i],!(t.indexOf(o)>=0)&&(n[o]=e[o]);return n}var Q3=p.useLayoutEffect,K3=function(t){var n=p.useRef(t);return Q3(function(){n.current=t}),n},Jx=function(t,n){if(typeof t=="function"){t(n);return}t.current=n},Y3=function(t,n){var r=p.useRef();return p.useCallback(function(o){t.current=o,r.current&&Jx(r.current,null),r.current=n,n&&Jx(n,o)},[n])},Zx={"min-height":"0","max-height":"none",height:"0",visibility:"hidden",overflow:"hidden",position:"absolute","z-index":"-1000",top:"0",right:"0"},X3=function(t){Object.keys(Zx).forEach(function(n){t.style.setProperty(n,Zx[n],"important")})},e1=X3,un=null,t1=function(t,n){var r=t.scrollHeight;return n.sizingStyle.boxSizing==="border-box"?r+n.borderSize:r-n.paddingSize};function J3(e,t,n,r){n===void 0&&(n=1),r===void 0&&(r=1/0),un||(un=document.createElement("textarea"),un.setAttribute("tabindex","-1"),un.setAttribute("aria-hidden","true"),e1(un)),un.parentNode===null&&document.body.appendChild(un);var o=e.paddingSize,i=e.borderSize,s=e.sizingStyle,l=s.boxSizing;Object.keys(s).forEach(function(h){var m=h;un.style[m]=s[m]}),e1(un),un.value=t;var c=t1(un,e);un.value=t,c=t1(un,e),un.value="x";var u=un.scrollHeight-o,d=u*n;l==="border-box"&&(d=d+o+i),c=Math.max(d,c);var f=u*r;return l==="border-box"&&(f=f+o+i),c=Math.min(f,c),[c,u]}var n1=function(){},Z3=function(t,n){return t.reduce(function(r,o){return r[o]=n[o],r},{})},eN=["borderBottomWidth","borderLeftWidth","borderRightWidth","borderTopWidth","boxSizing","fontFamily","fontSize","fontStyle","fontWeight","letterSpacing","lineHeight","paddingBottom","paddingLeft","paddingRight","paddingTop","tabSize","textIndent","textRendering","textTransform","width","wordBreak"],tN=!!document.documentElement.currentStyle,nN=function(t){var n=window.getComputedStyle(t);if(n===null)return null;var r=Z3(eN,n),o=r.boxSizing;if(o==="")return null;tN&&o==="border-box"&&(r.width=parseFloat(r.width)+parseFloat(r.borderRightWidth)+parseFloat(r.borderLeftWidth)+parseFloat(r.paddingRight)+parseFloat(r.paddingLeft)+"px");var i=parseFloat(r.paddingBottom)+parseFloat(r.paddingTop),s=parseFloat(r.borderBottomWidth)+parseFloat(r.borderTopWidth);return{sizingStyle:r,paddingSize:i,borderSize:s}},rN=nN;function Jj(e,t,n){var r=K3(n);p.useLayoutEffect(function(){var o=function(s){return r.current(s)};if(e)return e.addEventListener(t,o),function(){return e.removeEventListener(t,o)}},[])}var oN=function(t){Jj(window,"resize",t)},iN=function(t){Jj(document.fonts,"loadingdone",t)},sN=["cacheMeasurements","maxRows","minRows","onChange","onHeightChange"],aN=function(t,n){var r=t.cacheMeasurements,o=t.maxRows,i=t.minRows,s=t.onChange,l=s===void 0?n1:s,c=t.onHeightChange,u=c===void 0?n1:c,d=Ty(t,sN),f=d.value!==void 0,h=p.useRef(null),m=Y3(h,n),g=p.useRef(0),y=p.useRef(),C=function(){var w=h.current,S=r&&y.current?y.current:rN(w);if(S){y.current=S;var E=J3(S,w.value||w.placeholder||"x",i,o),j=E[0],T=E[1];g.current!==j&&(g.current=j,w.style.setProperty("height",j+"px","important"),u(j,{rowHeight:T}))}},v=function(w){f||C(),l(w)};return p.useLayoutEffect(C),oN(C),iN(C),p.createElement("textarea",fd({},d,{onChange:v,ref:m}))},lN=p.forwardRef(aN);const cN={},ds=G((e,t)=>{const{autosize:n,maxRows:r,minRows:o,__staticSelector:i,...s}=V("Textarea",cN,e),l=n&&j2()!=="test",c=l?{maxRows:r,minRows:o}:{};return b.createElement(pr,{component:l?lN:"textarea",ref:t,...s,__staticSelector:i||"Textarea",multiline:!0,"data-no-overflow":n&&r===void 0||void 0,...c})});ds.classes=pr.classes;ds.displayName="@mantine/core/Textarea";function r1(e,t){if(typeof e=="string"&&e.trim().length===0)return!0;try{return t(e),!0}catch{return!1}}const uN={serialize:JSON.stringify,deserialize:JSON.parse},fs=G((e,t)=>{const{value:n,defaultValue:r,onChange:o,formatOnBlur:i,validationError:s,serialize:l,deserialize:c,onFocus:u,onBlur:d,readOnly:f,error:h,...m}=V("JsonInput",uN,e),[g,y]=yn({value:n,defaultValue:r,finalValue:"",onChange:o}),[C,v]=p.useState(r1(g,c)),x=S=>{u==null||u(S),v(!0)},w=S=>{typeof d=="function"&&d(S);const E=r1(S.currentTarget.value,c);i&&!f&&E&&S.currentTarget.value.trim()!==""&&y(l(c(S.currentTarget.value),null,2)),v(E)};return b.createElement(ds,{value:g,onChange:S=>y(S.currentTarget.value),onFocus:x,onBlur:w,ref:t,readOnly:f,...m,autoComplete:"off",__staticSelector:"JsonInput",error:C?h:s||!0,"data-monospace":!0})});fs.classes=pr.classes;fs.displayName="@mantine/core/JsonInput";const[dN,fN]=wn("List component was not found in tree");var Py={root:"m-abbac491",item:"m-abb6bec2",itemWrapper:"m-75cd9f71",itemIcon:"m-60f83e5b"};const hN={},ky=G((e,t)=>{const n=V("ListItem",hN,e),{classNames:r,className:o,style:i,styles:s,vars:l,icon:c,children:u,...d}=n,f=fN(),h=c||f.icon,m={classNames:r,styles:s};return b.createElement(W,{...f.getStyles("item",{...m,className:o,style:i}),component:"li",mod:{"with-icon":!!h,centered:f.center},ref:t,...d},b.createElement("div",{...f.getStyles("itemWrapper",m)},h&&b.createElement("span",{...f.getStyles("itemIcon",m)},h),b.createElement("span",{...f.getStyles("itemLabel",m)},u)))});ky.classes=Py;ky.displayName="@mantine/core/ListItem";const pN={type:"unordered"},mN=(e,{size:t,spacing:n})=>({root:{"--list-fz":Xt(t),"--list-lh":lS(t),"--list-spacing":Kt(n)}}),pn=G((e,t)=>{const n=V("List",pN,e),{classNames:r,className:o,style:i,styles:s,unstyled:l,vars:c,children:u,type:d,withPadding:f,icon:h,spacing:m,center:g,listStyleType:y,...C}=n,v=ue({name:"List",classes:Py,props:n,className:o,style:i,classNames:r,styles:s,unstyled:l,vars:c,varsResolver:mN});return b.createElement(dN,{value:{center:g,icon:h,getStyles:v}},b.createElement(W,{...v("root",{style:{listStyleType:y}}),component:d==="unordered"?"ul":"ol",mod:{"with-padding":f},ref:t,...C},u))});pn.classes=Py;pn.displayName="@mantine/core/List";pn.Item=ky;var Zj={root:"m-6e45937b",loader:"m-e8eb006c",overlay:"m-df587f17"};const o1={transitionProps:{transition:"fade",duration:0},overlayProps:{backgroundOpacity:.75},zIndex:_r("overlay")},gN=(e,{zIndex:t})=>({root:{"--lo-z-index":t==null?void 0:t.toString()}}),Ry=G((e,t)=>{const n=V("LoadingOverlay",o1,e),{classNames:r,className:o,style:i,styles:s,unstyled:l,vars:c,transitionProps:u,loaderProps:d,overlayProps:f,visible:h,zIndex:m,...g}=n,y=Nt(),C=ue({name:"LoadingOverlay",classes:Zj,props:n,className:o,style:i,classNames:r,styles:s,unstyled:l,vars:c,varsResolver:gN}),v={...o1.overlayProps,...f};return b.createElement(ls,{transition:"fade",...u,mounted:!!h},x=>b.createElement(W,{...C("root",{style:x}),ref:t,...g},b.createElement(Nn,{...C("loader"),unstyled:l,...d}),b.createElement(Ul,{...v,...C("overlay"),"data-light":!0,unstyled:l,color:(f==null?void 0:f.color)||y.white}),b.createElement(Ul,{...v,...C("overlay"),"data-dark":!0,unstyled:l,color:(f==null?void 0:f.color)||y.colors.dark[5]})))});Ry.classes=Zj;Ry.displayName="@mantine/core/LoadingOverlay";const[yN,dc]=wn("Menu component was not found in the tree");var _a={dropdown:"m-dc9b7c9f",label:"m-9bfac126",divider:"m-efdf90cb",item:"m-99ac2aa1",itemLabel:"m-5476e0d3",itemSection:"m-8b75e504"};const vN={},Dy=G((e,t)=>{const{classNames:n,className:r,style:o,styles:i,vars:s,...l}=V("MenuDivider",vN,e),c=dc();return b.createElement(W,{ref:t,...c.getStyles("divider",{className:r,style:o,styles:i,classNames:n}),...l})});Dy.classes=_a;Dy.displayName="@mantine/core/MenuDivider";const xN={},Iy=G((e,t)=>{const{classNames:n,className:r,style:o,styles:i,vars:s,onMouseEnter:l,onMouseLeave:c,children:u,...d}=V("MenuDropdown",xN,e),f=p.useRef(null),h=dc(),m=C=>{var v,x;(C.key==="ArrowUp"||C.key==="ArrowDown")&&(C.preventDefault(),(x=(v=f.current)==null?void 0:v.querySelectorAll("[data-menu-item]:not(:disabled)")[0])==null||x.focus())},g=Bn(l,()=>(h.trigger==="hover"||h.trigger==="click-hover")&&h.openDropdown()),y=Bn(c,()=>(h.trigger==="hover"||h.trigger==="click-hover")&&h.closeDropdown());return b.createElement(Ar.Dropdown,{...d,onMouseEnter:g,onMouseLeave:y,role:"menu","aria-orientation":"vertical",ref:tn(t,f),...h.getStyles("dropdown",{className:r,style:o,styles:i,classNames:n,withStaticClass:!1}),tabIndex:-1,"data-menu-dropdown":!0,onKeyDown:m},b.createElement("div",{tabIndex:-1,"data-autofocus":!0}),u)});Iy.classes=_a;Iy.displayName="@mantine/core/MenuDropdown";const wN={},_y=cn((e,t)=>{const{classNames:n,className:r,style:o,styles:i,vars:s,color:l,closeMenuOnClick:c,leftSection:u,rightSection:d,children:f,disabled:h,...m}=V("MenuItem",wN,e),g=dc(),y=Nt(),{dir:C}=Ta(),v=p.useRef(),x=g.getItemIndex(v.current),w=m,S=Bn(w.onMouseLeave,()=>g.setHovered(-1)),E=Bn(w.onMouseEnter,()=>g.setHovered(g.getItemIndex(v.current))),j=Bn(w.onClick,()=>{typeof c=="boolean"?c&&g.closeDropdownImmediately():g.closeOnItemClick&&g.closeDropdownImmediately()}),T=Bn(w.onFocus,()=>g.setHovered(g.getItemIndex(v.current))),P=l?y.variantColorResolver({color:l,theme:y,variant:"light"}):void 0,R=l?Jr({color:l,theme:y}):null;return b.createElement(Gn,{...m,unstyled:g.unstyled,tabIndex:g.menuItemTabIndex,onFocus:T,...g.getStyles("item",{className:r,style:o,styles:i,classNames:n}),ref:tn(v,t),role:"menuitem",disabled:h,"data-menu-item":!0,"data-disabled":h||void 0,"data-hovered":g.hovered===x?!0:void 0,onMouseEnter:E,onMouseLeave:S,onClick:j,onKeyDown:aS({siblingSelector:"[data-menu-item]",parentSelector:"[data-menu-dropdown]",activateOnFocus:!1,loop:g.loop,dir:C,orientation:"vertical",onKeyDown:w.onKeydown}),__vars:{"--menu-item-color":R!=null&&R.isThemeColor&&(R==null?void 0:R.shade)===void 0?`var(--mantine-color-${R.color}-6)`:P==null?void 0:P.color,"--menu-item-hover":P==null?void 0:P.hover}},u&&b.createElement("div",{...g.getStyles("itemSection",{styles:i,classNames:n}),"data-position":"left"},u),f&&b.createElement("div",{...g.getStyles("itemLabel",{styles:i,classNames:n})},f),d&&b.createElement("div",{...g.getStyles("itemSection",{styles:i,classNames:n}),"data-position":"right"},d))});_y.classes=_a;_y.displayName="@mantine/core/MenuItem";const SN={},Ay=G((e,t)=>{const{classNames:n,className:r,style:o,styles:i,vars:s,...l}=V("MenuLabel",SN,e),c=dc();return b.createElement(W,{ref:t,...c.getStyles("label",{className:r,style:o,styles:i,classNames:n}),...l})});Ay.classes=_a;Ay.displayName="@mantine/core/MenuLabel";const bN={refProp:"ref"},eE=p.forwardRef((e,t)=>{const{children:n,refProp:r,...o}=V("MenuTarget",bN,e);if(!Co(n))throw new Error("Menu.Target component children should be an element or a component that accepts ref. Fragments, strings, numbers and other primitive values are not supported");const i=dc(),s=Bn(n.props.onClick,()=>{i.trigger==="click"?i.toggleDropdown():i.trigger==="click-hover"&&(i.setOpenedViaClick(!0),i.opened||i.openDropdown())}),l=Bn(n.props.onMouseEnter,()=>(i.trigger==="hover"||i.trigger==="click-hover")&&i.openDropdown()),c=Bn(n.props.onMouseLeave,()=>{(i.trigger==="hover"||i.trigger==="click-hover"&&!i.openedViaClick)&&i.closeDropdown()});return b.createElement(Ar.Target,{refProp:r,popupType:"menu",ref:t,...o},p.cloneElement(n,{onClick:s,onMouseEnter:l,onMouseLeave:c,"data-expanded":i.opened?!0:void 0}))});eE.displayName="@mantine/core/MenuTarget";const CN={trapFocus:!0,closeOnItemClick:!0,clickOutsideEvents:["mousedown","touchstart","keydown"],loop:!0,trigger:"click",openDelay:0,closeDelay:100,menuItemTabIndex:-1};function X(e){const t=V("Menu",CN,e),{children:n,onOpen:r,onClose:o,opened:i,defaultOpened:s,trapFocus:l,onChange:c,closeOnItemClick:u,loop:d,closeOnEscape:f,trigger:h,openDelay:m,closeDelay:g,classNames:y,styles:C,unstyled:v,variant:x,vars:w,menuItemTabIndex:S,...E}=t,j=ue({name:"Menu",classes:_a,props:t,classNames:y,styles:C,unstyled:v}),[T,{setHovered:P,resetHovered:R}]=b2(),[I,O]=yn({value:i,defaultValue:s,finalValue:!1,onChange:c}),[D,A]=p.useState(!1),M=()=>{O(!1),A(!1),I&&(o==null||o())},B=()=>{O(!0),!I&&(r==null||r())},F=()=>{I?M():B()},{openDropdown:_,closeDropdown:k}=B3({open:B,close:M,closeDelay:g,openDelay:m}),z=re=>S2("[data-menu-item]","[data-menu-dropdown]",re),{resolvedClassNames:q,resolvedStyles:Q}=Nd({classNames:y,styles:C,props:t});return fo(()=>{R()},[I]),b.createElement(yN,{value:{getStyles:j,opened:I,toggleDropdown:F,getItemIndex:z,hovered:T,setHovered:P,openedViaClick:D,setOpenedViaClick:A,closeOnItemClick:u,closeDropdown:h==="click"?M:k,openDropdown:h==="click"?B:_,closeDropdownImmediately:M,loop:d,trigger:h,unstyled:v,menuItemTabIndex:S}},b.createElement(Ar,{...E,opened:I,onChange:F,defaultOpened:s,trapFocus:l,closeOnEscape:f,__staticSelector:"Menu",classNames:q,styles:Q,unstyled:v,variant:x},n))}X.extend=e=>e;X.classes=_a;X.displayName="@mantine/core/Menu";X.Item=_y;X.Label=Ay;X.Dropdown=Iy;X.Target=eE;X.Divider=Dy;const[jN,Aa]=wn("Modal component was not found in tree");var ko={root:"m-9df02822",content:"m-54c44539",inner:"m-1f958f16",header:"m-d0e2b9cd"};const EN={},df=G((e,t)=>{const n=V("ModalBody",EN,e),{classNames:r,className:o,style:i,styles:s,vars:l,...c}=n,u=Aa();return b.createElement(xj,{ref:t,...u.getStyles("body",{classNames:r,style:i,styles:s,className:o}),...c})});df.classes=ko;df.displayName="@mantine/core/ModalBody";const TN={},ff=G((e,t)=>{const n=V("ModalCloseButton",TN,e),{classNames:r,className:o,style:i,styles:s,vars:l,...c}=n,u=Aa();return b.createElement(wj,{ref:t,...u.getStyles("close",{classNames:r,style:i,styles:s,className:o}),...c})});ff.classes=ko;ff.displayName="@mantine/core/ModalCloseButton";const PN={},hf=G((e,t)=>{const n=V("ModalContent",PN,e),{classNames:r,className:o,style:i,styles:s,vars:l,children:c,...u}=n,d=Aa(),f=d.scrollAreaComponent||oA;return b.createElement(eA,{...d.getStyles("content",{className:o,style:i,styles:s,classNames:r}),innerProps:d.getStyles("inner",{className:o,style:i,styles:s,classNames:r}),ref:t,...u},b.createElement(f,{style:{maxHeight:`calc(100vh - (${$(d.yOffset)} * 2))`}},c))});hf.classes=ko;hf.displayName="@mantine/core/ModalContent";const kN={},pf=G((e,t)=>{const n=V("ModalHeader",kN,e),{classNames:r,className:o,style:i,styles:s,vars:l,...c}=n,u=Aa();return b.createElement(Sj,{ref:t,...u.getStyles("header",{classNames:r,style:i,styles:s,className:o}),...c})});pf.classes=ko;pf.displayName="@mantine/core/ModalHeader";const RN={},mf=G((e,t)=>{const n=V("ModalOverlay",RN,e),{classNames:r,className:o,style:i,styles:s,vars:l,...c}=n,u=Aa();return b.createElement(bj,{ref:t,...u.getStyles("overlay",{classNames:r,style:i,styles:s,className:o}),...c})});mf.classes=ko;mf.displayName="@mantine/core/ModalOverlay";const DN={__staticSelector:"Modal",closeOnClickOutside:!0,withinPortal:!0,lockScroll:!0,trapFocus:!0,returnFocus:!0,closeOnEscape:!0,keepMounted:!1,zIndex:_r("modal"),transitionProps:{duration:200,transition:"pop"},yOffset:"5dvh"},IN=(e,{radius:t,size:n,yOffset:r,xOffset:o})=>({root:{"--modal-radius":t===void 0?void 0:gt(t),"--modal-size":je(n,"modal-size"),"--modal-y-offset":$(r),"--modal-x-offset":$(o)}}),gf=G((e,t)=>{const n=V("ModalRoot",DN,e),{classNames:r,className:o,style:i,styles:s,unstyled:l,vars:c,yOffset:u,scrollAreaComponent:d,radius:f,fullScreen:h,centered:m,xOffset:g,__staticSelector:y,...C}=n,v=ue({name:y,classes:ko,props:n,className:o,style:i,classNames:r,styles:s,unstyled:l,vars:c,varsResolver:IN});return b.createElement(jN,{value:{yOffset:u,scrollAreaComponent:d,getStyles:v}},b.createElement(J4,{ref:t,...v("root"),"data-full-screen":h||void 0,"data-centered":m||void 0,unstyled:l,...C}))});gf.classes=ko;gf.displayName="@mantine/core/ModalRoot";const _N={},yf=G((e,t)=>{const n=V("ModalTitle",_N,e),{classNames:r,className:o,style:i,styles:s,vars:l,...c}=n,u=Aa();return b.createElement(Cj,{ref:t,...u.getStyles("title",{classNames:r,style:i,styles:s,className:o}),...c})});yf.classes=ko;yf.displayName="@mantine/core/ModalTitle";const AN={closeOnClickOutside:!0,withinPortal:!0,lockScroll:!0,trapFocus:!0,returnFocus:!0,closeOnEscape:!0,keepMounted:!1,zIndex:_r("modal"),transitionProps:{duration:200,transition:"pop"},withOverlay:!0,withCloseButton:!0},bn=G((e,t)=>{const{title:n,withOverlay:r,overlayProps:o,withCloseButton:i,closeButtonProps:s,children:l,radius:c,...u}=V("Modal",AN,e),d=!!n||i;return b.createElement(gf,{ref:t,radius:c,...u},r&&b.createElement(mf,{...o}),b.createElement(hf,{radius:c},d&&b.createElement(pf,null,n&&b.createElement(yf,null,n),i&&b.createElement(ff,{...s})),b.createElement(df,null,l)))});bn.classes=ko;bn.displayName="@mantine/core/Modal";bn.Root=gf;bn.Overlay=mf;bn.Content=hf;bn.Body=df;bn.Header=pf;bn.Title=yf;bn.CloseButton=ff;const[NN,Ny]=ec(),[ON,MN]=ec();var vf={root:"m-7cda1cd6","root--default":"m-44da308b","root--contrast":"m-e3a01f8",label:"m-1e0e6180",remove:"m-ae386778",group:"m-1dcfd90b"};const LN={},$N=(e,{gap:t},{size:n})=>({group:{"--pg-gap":t!==void 0?je(t):je(n,"pg-gap")}}),Oy=G((e,t)=>{const n=V("PillGroup",LN,e),{classNames:r,className:o,style:i,styles:s,unstyled:l,vars:c,size:u,disabled:d,...f}=n,h=Ny(),m=(h==null?void 0:h.size)||u||void 0,g=ue({name:"PillGroup",classes:vf,props:n,className:o,style:i,classNames:r,styles:s,unstyled:l,vars:c,varsResolver:$N,stylesCtx:{size:m},rootSelector:"group"});return b.createElement(ON,{value:{size:m,disabled:d}},b.createElement(W,{ref:t,size:m,...g("group"),...f}))});Oy.classes=vf;Oy.displayName="@mantine/core/PillGroup";const FN={variant:"default"},zN=(e,{radius:t},{size:n})=>({root:{"--pill-fz":je(n,"pill-fz"),"--pill-height":je(n,"pill-height"),"--pill-radius":t===void 0?void 0:gt(t)}}),Xi=G((e,t)=>{const n=V("Pill",FN,e),{classNames:r,className:o,style:i,styles:s,unstyled:l,vars:c,variant:u,children:d,withRemoveButton:f,onRemove:h,removeButtonProps:m,radius:g,size:y,disabled:C,...v}=n,x=MN(),w=Ny(),S=y||(x==null?void 0:x.size)||void 0,E=(w==null?void 0:w.variant)==="filled"?"contrast":u||"default",j=ue({name:"Pill",classes:vf,props:n,className:o,style:i,classNames:r,styles:s,unstyled:l,vars:c,varsResolver:zN,stylesCtx:{size:S}});return b.createElement(W,{component:"span",ref:t,variant:E,size:S,...j("root",{variant:E}),mod:{"with-remove":f,disabled:C||(x==null?void 0:x.disabled)},...v},b.createElement("span",{...j("label")},d),f&&b.createElement(cs,{variant:"transparent",radius:g,tabIndex:-1,"aria-hidden":!0,unstyled:l,...m,...j("remove",{className:m==null?void 0:m.className,style:m==null?void 0:m.style}),onMouseDown:T=>{var P;T.preventDefault(),T.stopPropagation(),(P=m==null?void 0:m.onMouseDown)==null||P.call(m,T)},onClick:T=>{var P;T.stopPropagation(),h==null||h(),(P=m==null?void 0:m.onClick)==null||P.call(m,T)}}))});Xi.classes=vf;Xi.displayName="@mantine/core/Pill";Xi.Group=Oy;var tE={field:"m-45c4369d"};const BN={type:"visible"},My=G((e,t)=>{const n=V("PillsInputField",BN,e),{classNames:r,className:o,style:i,styles:s,unstyled:l,vars:c,type:u,disabled:d,id:f,pointer:h,...m}=n,g=Ny(),y=Da(),C=ue({name:"PillsInputField",classes:tE,props:n,className:o,style:i,classNames:r,styles:s,unstyled:l,rootSelector:"field"}),v=d||(g==null?void 0:g.disabled);return b.createElement(W,{component:"input",ref:tn(t,g==null?void 0:g.fieldRef),"data-type":u,disabled:v,mod:{disabled:v,pointer:h},...C("field"),...m,id:(y==null?void 0:y.inputId)||f,"aria-invalid":g==null?void 0:g.hasError,"aria-describedby":y==null?void 0:y.describedBy,type:"text",onMouseDown:x=>!h&&x.stopPropagation()})});My.classes=tE;My.displayName="@mantine/core/PillsInputField";const UN={},ga=G((e,t)=>{const n=V("PillsInput",UN,e),{children:r,onMouseDown:o,onClick:i,size:s,disabled:l,__staticSelector:c,error:u,variant:d,...f}=n,h=p.useRef();return b.createElement(NN,{value:{fieldRef:h,size:s,disabled:l,hasError:!!u,variant:d}},b.createElement(pr,{size:s,error:u,variant:d,component:"div",ref:t,onMouseDown:m=>{var g;m.preventDefault(),o==null||o(m),(g=h.current)==null||g.focus()},onClick:m=>{var g;m.preventDefault(),i==null||i(m),(g=h.current)==null||g.focus()},...f,multiline:!0,disabled:l,__staticSelector:c||"PillsInput",withAria:!1},r))});ga.displayName="@mantine/core/PillsInput";ga.Field=My;function VN({data:e,value:t}){const n=t.map(o=>o.trim().toLowerCase());return e.reduce((o,i)=>(ma(i)?o.push({group:i.group,items:i.items.filter(s=>n.indexOf(s.value.toLowerCase().trim())===-1)}):n.indexOf(i.value.toLowerCase().trim())===-1&&o.push(i),o),[])}const HN={maxValues:1/0,withCheckIcon:!0,checkIconPosition:"left",hiddenInputValuesDivider:","},xf=G((e,t)=>{const n=V("MultiSelect",HN,e),{classNames:r,className:o,style:i,styles:s,unstyled:l,vars:c,size:u,value:d,defaultValue:f,onChange:h,onKeyDown:m,variant:g,data:y,dropdownOpened:C,defaultDropdownOpened:v,onDropdownOpen:x,onDropdownClose:w,selectFirstOptionOnChange:S,onOptionSubmit:E,comboboxProps:j,filter:T,limit:P,withScrollArea:R,maxDropdownHeight:I,searchValue:O,defaultSearchValue:D,onSearchChange:A,readOnly:M,disabled:B,onFocus:F,onBlur:_,onPaste:k,radius:z,rightSection:q,rightSectionWidth:Q,rightSectionPointerEvents:re,rightSectionProps:Ce,leftSection:Re,leftSectionWidth:Oe,leftSectionPointerEvents:ve,leftSectionProps:Ve,inputContainer:Je,inputWrapperOrder:at,withAsterisk:Ft,labelProps:pe,descriptionProps:Fe,errorProps:Ne,wrapperProps:tt,description:nt,label:Fn,error:Yn,maxValues:Ao,searchable:Wt,nothingFoundMessage:no,withCheckIcon:ee,checkIconPosition:be,hidePickedOptions:rt,withErrorStyles:Ze,name:Dt,form:Mr,id:Xn,clearable:Ti,clearButtonProps:Cn,hiddenInputProps:Lr,placeholder:gr,hiddenInputValuesDivider:No,required:za,...Ac}=n,Oo=Ln(Xn),vs=Rj(y),Mo=Dj(vs),jn=yy({opened:C,defaultOpened:v,onDropdownOpen:x,onDropdownClose:()=>{w==null||w(),jn.resetSelectedOption()}}),{styleProps:Nc,rest:{type:r0,...Oc}}=jo(Ac),[nn,N]=yn({value:d,defaultValue:f,finalValue:[],onChange:h}),[L,H]=yn({value:O,defaultValue:D,finalValue:"",onChange:A}),J=ue({name:"MultiSelect",classes:{},props:n,classNames:r,styles:s,unstyled:l}),{resolvedClassNames:se,resolvedStyles:ke}=Nd({props:n,styles:s,classNames:r}),xe=De=>{m==null||m(De),De.key===" "&&!Wt&&(De.preventDefault(),jn.toggleDropdown()),De.key==="Backspace"&&L.length===0&&nn.length>0&&N(nn.slice(0,nn.length-1))},ye=nn.map((De,Ee)=>{var Ge;return b.createElement(Xi,{key:`${De}-${Ee}`,withRemoveButton:!M,onRemove:()=>N(nn.filter(Mt=>De!==Mt)),unstyled:l,...J("pill")},((Ge=Mo[De])==null?void 0:Ge.label)||De)});p.useEffect(()=>{S&&jn.selectFirstOption()},[S,nn]);const me=Ti&&nn.length>0&&!B&&!M&&b.createElement(Me.ClearButton,{size:u,...Cn,onClear:()=>{N([]),H("")}}),_e=VN({data:vs,value:nn});return b.createElement(b.Fragment,null,b.createElement(Me,{store:jn,classNames:se,styles:ke,unstyled:l,size:u,readOnly:M,__staticSelector:"MultiSelect",onOptionSubmit:De=>{E==null||E(De),H(""),jn.updateSelectedOptionIndex("selected"),nn.includes(Mo[De].value)?N(nn.filter(Ee=>Ee!==Mo[De].value)):nn.length<Ao&&N([...nn,Mo[De].value])},...j},b.createElement(Me.DropdownTarget,null,b.createElement(ga,{...Nc,__staticSelector:"MultiSelect",classNames:se,styles:ke,unstyled:l,size:u,className:o,style:i,variant:g,disabled:B,radius:z,rightSection:q||me||b.createElement(Me.Chevron,{size:u,error:Yn,unstyled:l}),rightSectionPointerEvents:re||(me?"all":"none"),rightSectionWidth:Q,rightSectionProps:Ce,leftSection:Re,leftSectionWidth:Oe,leftSectionPointerEvents:ve,leftSectionProps:Ve,inputContainer:Je,inputWrapperOrder:at,withAsterisk:Ft,labelProps:pe,descriptionProps:Fe,errorProps:Ne,wrapperProps:tt,description:nt,label:Fn,error:Yn,multiline:!0,withErrorStyles:Ze,__stylesApiProps:{...n,rightSectionPointerEvents:re||(me?"all":"none"),multiline:!0},pointer:!Wt,onClick:()=>Wt?jn.openDropdown():jn.toggleDropdown(),"data-expanded":jn.dropdownOpened||void 0,id:Oo,required:za},b.createElement(Xi.Group,{disabled:B,unstyled:l,...J("pillsList")},ye,b.createElement(Me.EventsTarget,null,b.createElement(ga.Field,{...Oc,ref:t,id:Oo,placeholder:gr,type:!Wt&&!gr?"hidden":"visible",...J("inputField"),unstyled:l,onFocus:De=>{F==null||F(De),Wt&&jn.openDropdown()},onBlur:De=>{_==null||_(De),jn.closeDropdown(),H("")},onKeyDown:xe,value:L,onChange:De=>{H(De.currentTarget.value),Wt&&jn.openDropdown(),S&&jn.selectFirstOption()},disabled:B,readOnly:M||!Wt,pointer:!Wt}))))),b.createElement(m3,{data:rt?_e:vs,hidden:M||B,filter:T,search:L,limit:P,hiddenWhenEmpty:!Wt||!no||rt&&_e.length===0&&L.trim().length===0,withScrollArea:R,maxDropdownHeight:I,filterOptions:Wt,value:nn,checkIconPosition:be,withCheckIcon:ee,nothingFoundMessage:no,unstyled:l,labelId:`${Oo}-label`})),b.createElement("input",{type:"hidden",name:Dt,value:nn.join(No),form:Mr,disabled:B,...Lr}))});xf.classes={...pr.classes,...Me.classes};xf.displayName="@mantine/core/MultiSelect";function WN(e){return"group"in e}function Ly({data:e}){if(WN(e)){const o=e.items.map(i=>b.createElement(Ly,{key:i.value,data:i}));return b.createElement("optgroup",{label:e.group},o)}const{value:t,label:n,...r}=e;return b.createElement("option",{key:e.value,value:e.value,...r},e.label)}Ly.displayName="@mantine/core/NativeSelectOption";const qN={rightSectionPointerEvents:"none"},mt=G((e,t)=>{const{data:n,children:r,size:o,error:i,rightSection:s,unstyled:l,...c}=V("NativeSelect",qN,e),u=Rj(n).map((d,f)=>b.createElement(Ly,{key:f,data:d}));return b.createElement(pr,{component:"select",ref:t,...c,__staticSelector:"NativeSelect",size:o,pointer:!0,error:i,unstyled:l,rightSection:s||b.createElement(of,{size:o,error:i,unstyled:l})},r||u)});mt.classes=pr.classes;mt.displayName="@mantine/core/NativeSelect";var nE={root:"m-a513464",icon:"m-a4ceffb",loader:"m-b0920b15",body:"m-a49ed24",title:"m-3feedf16",description:"m-3d733a3a",closeButton:"m-919a4d88"};const GN={withCloseButton:!0},QN=(e,{radius:t,color:n})=>({root:{"--notification-radius":t===void 0?void 0:gt(t),"--notification-color":n?wt(n,e):void 0}}),$y=G((e,t)=>{const n=V("Notification",GN,e),{className:r,color:o,radius:i,loading:s,withCloseButton:l,withBorder:c,title:u,icon:d,children:f,onClose:h,closeButtonProps:m,classNames:g,style:y,styles:C,unstyled:v,variant:x,vars:w,...S}=n,E=ue({name:"Notification",classes:nE,props:n,className:r,style:y,classNames:g,styles:C,unstyled:v,vars:w,varsResolver:QN});return b.createElement(W,{...E("root"),mod:{"data-with-icon":!!d||s,"data-with-border":c},ref:t,variant:x,...S,role:"alert"},d&&!s&&b.createElement("div",{...E("icon")},d),s&&b.createElement(Nn,{size:28,color:o,...E("loader")}),b.createElement("div",{...E("body")},u&&b.createElement("div",{...E("title")},u),b.createElement(W,{...E("description"),mod:{"data-with-title":!!u}},f)),l&&b.createElement(cs,{iconSize:16,color:"gray",...m,unstyled:v,onClick:h,...E("closeButton")}))});$y.classes=nE;$y.displayName="@mantine/core/Notification";const[KN,wf]=wn("Pagination.Root component was not found in tree");var fc={root:"m-4addd315",control:"m-326d024a",dots:"m-4ad7767d"};const YN={withPadding:!0},hc=G((e,t)=>{const n=V("PaginationControl",YN,e),{classNames:r,className:o,style:i,styles:s,vars:l,active:c,disabled:u,withPadding:d,...f}=n,h=wf(),m=u||h.disabled;return b.createElement(Gn,{ref:t,disabled:m,mod:{active:c,disabled:m,"with-padding":d},...h.getStyles("control",{className:o,style:i,classNames:r,styles:s,active:!m}),...f})});hc.classes=fc;hc.displayName="@mantine/core/PaginationControl";function pc({style:e,children:t,path:n,...r}){return b.createElement("svg",{viewBox:"0 0 16 16",xmlns:"http://www.w3.org/2000/svg",style:{width:"calc(var(--pagination-control-size) / 1.8)",height:"calc(var(--pagination-control-size) / 1.8)",...e},...r},b.createElement("path",{d:n,fill:"currentColor"}))}const XN=e=>b.createElement(pc,{...e,path:"M8.781 8l-3.3-3.3.943-.943L10.667 8l-4.243 4.243-.943-.943 3.3-3.3z"}),JN=e=>b.createElement(pc,{...e,path:"M7.219 8l3.3 3.3-.943.943L5.333 8l4.243-4.243.943.943-3.3 3.3z"}),ZN=e=>b.createElement(pc,{...e,path:"M6.85355 3.85355C7.04882 3.65829 7.04882 3.34171 6.85355 3.14645C6.65829 2.95118 6.34171 2.95118 6.14645 3.14645L2.14645 7.14645C1.95118 7.34171 1.95118 7.65829 2.14645 7.85355L6.14645 11.8536C6.34171 12.0488 6.65829 12.0488 6.85355 11.8536C7.04882 11.6583 7.04882 11.3417 6.85355 11.1464L3.20711 7.5L6.85355 3.85355ZM12.8536 3.85355C13.0488 3.65829 13.0488 3.34171 12.8536 3.14645C12.6583 2.95118 12.3417 2.95118 12.1464 3.14645L8.14645 7.14645C7.95118 7.34171 7.95118 7.65829 8.14645 7.85355L12.1464 11.8536C12.3417 12.0488 12.6583 12.0488 12.8536 11.8536C13.0488 11.6583 13.0488 11.3417 12.8536 11.1464L9.20711 7.5L12.8536 3.85355Z"}),e9=e=>b.createElement(pc,{...e,path:"M2.14645 11.1464C1.95118 11.3417 1.95118 11.6583 2.14645 11.8536C2.34171 12.0488 2.65829 12.0488 2.85355 11.8536L6.85355 7.85355C7.04882 7.65829 7.04882 7.34171 6.85355 7.14645L2.85355 3.14645C2.65829 2.95118 2.34171 2.95118 2.14645 3.14645C1.95118 3.34171 1.95118 3.65829 2.14645 3.85355L5.79289 7.5L2.14645 11.1464ZM8.14645 11.1464C7.95118 11.3417 7.95118 11.6583 8.14645 11.8536C8.34171 12.0488 8.65829 12.0488 8.85355 11.8536L12.8536 7.85355C13.0488 7.65829 13.0488 7.34171 12.8536 7.14645L8.85355 3.14645C8.65829 2.95118 8.34171 2.95118 8.14645 3.14645C7.95118 3.34171 7.95118 3.65829 8.14645 3.85355L11.7929 7.5L8.14645 11.1464Z"}),t9=e=>b.createElement(pc,{...e,path:"M2 8c0-.733.6-1.333 1.333-1.333.734 0 1.334.6 1.334 1.333s-.6 1.333-1.334 1.333C2.6 9.333 2 8.733 2 8zm9.333 0c0-.733.6-1.333 1.334-1.333C13.4 6.667 14 7.267 14 8s-.6 1.333-1.333 1.333c-.734 0-1.334-.6-1.334-1.333zM6.667 8c0-.733.6-1.333 1.333-1.333s1.333.6 1.333 1.333S8.733 9.333 8 9.333 6.667 8.733 6.667 8z"}),n9={icon:t9},Sf=G((e,t)=>{const n=V("PaginationDots",n9,e),{classNames:r,className:o,style:i,styles:s,vars:l,icon:c,...u}=n,d=wf(),f=c;return b.createElement(W,{ref:t,...d.getStyles("dots",{className:o,style:i,styles:s,classNames:r}),...u},b.createElement(f,{style:{width:"calc(var(--pagination-control-size) / 1.8)",height:"calc(var(--pagination-control-size) / 1.8)"}}))});Sf.classes=fc;Sf.displayName="@mantine/core/PaginationDots";function bf({icon:e,name:t,action:n,type:r}){const o={icon:e},i=p.forwardRef((s,l)=>{const{icon:c,...u}=V(t,o,s),d=c,f=wf(),h=r==="next"?f.active===f.total:f.active===1;return b.createElement(hc,{disabled:f.disabled||h,ref:l,onClick:f[n],withPadding:!1,...u},b.createElement(d,{style:{width:"calc(var(--pagination-control-size) / 1.8)",height:"calc(var(--pagination-control-size) / 1.8)"}}))});return i.displayName=`@mantine/core/${t}`,i}const rE=bf({icon:XN,name:"PaginationNext",action:"onNext",type:"next"}),oE=bf({icon:JN,name:"PaginationPrevious",action:"onPrevious",type:"previous"}),iE=bf({icon:ZN,name:"PaginationFirst",action:"onFirst",type:"previous"}),sE=bf({icon:e9,name:"PaginationLast",action:"onLast",type:"next"});function Fy({dotsIcon:e}){const t=wf(),n=t.range.map((r,o)=>{var i;return r==="dots"?b.createElement(Sf,{icon:e,key:o}):b.createElement(hc,{key:o,active:r===t.active,"aria-current":r===t.active?"page":void 0,onClick:()=>t.onChange(r),disabled:t.disabled,...(i=t.getItemProps)==null?void 0:i.call(t,r)},r)});return b.createElement(b.Fragment,null,n)}Fy.displayName="@mantine/core/PaginationItems";const r9={siblings:1,boundaries:1},o9=(e,{size:t,radius:n,color:r,autoContrast:o})=>({root:{"--pagination-control-radius":n===void 0?void 0:gt(n),"--pagination-control-size":je(t,"pagination-control-size"),"--pagination-control-fz":Xt(t),"--pagination-active-bg":r?wt(r,e):void 0,"--pagination-active-color":o?ja({color:r,theme:e}):void 0}}),Cf=G((e,t)=>{const n=V("PaginationRoot",r9,e),{classNames:r,className:o,style:i,styles:s,unstyled:l,vars:c,total:u,value:d,defaultValue:f,onChange:h,disabled:m,siblings:g,boundaries:y,color:C,radius:v,onNextPage:x,onPreviousPage:w,onFirstPage:S,onLastPage:E,getItemProps:j,autoContrast:T,...P}=n,R=ue({name:"Pagination",classes:fc,props:n,className:o,style:i,classNames:r,styles:s,unstyled:l,vars:c,varsResolver:o9}),{range:I,setPage:O,next:D,previous:A,active:M,first:B,last:F}=V2({page:d,initialPage:f,onChange:h,total:u,siblings:g,boundaries:y}),_=Bn(x,D),k=Bn(w,A),z=Bn(S,B),q=Bn(E,F);return b.createElement(KN,{value:{total:u,range:I,active:M,disabled:m,getItemProps:j,onChange:O,onNext:_,onPrevious:k,onFirst:z,onLast:q,getStyles:R}},b.createElement(W,{ref:t,...R("root"),...P}))});Cf.classes=fc;Cf.displayName="@mantine/core/PaginationRoot";const i9={withControls:!0,siblings:1,boundaries:1,gap:8},Nr=G((e,t)=>{const n=V("Pagination",i9,e),{withEdges:r,withControls:o,getControlProps:i,nextIcon:s,previousIcon:l,lastIcon:c,firstIcon:u,dotsIcon:d,total:f,gap:h,...m}=n;return f<=0?null:b.createElement(Cf,{ref:t,total:f,...m},b.createElement(Y,{gap:h},r&&b.createElement(iE,{icon:u,...i==null?void 0:i("first")}),o&&b.createElement(oE,{icon:l,...i==null?void 0:i("previous")}),b.createElement(Fy,{dotsIcon:d}),o&&b.createElement(rE,{icon:s,...i==null?void 0:i("next")}),r&&b.createElement(sE,{icon:c,...i==null?void 0:i("last")})))});Nr.classes=fc;Nr.displayName="@mantine/core/Pagination";Nr.Root=Cf;Nr.Control=hc;Nr.Dots=Sf;Nr.First=iE;Nr.Last=sE;Nr.Next=rE;Nr.Previous=oE;Nr.Items=Fy;const s9=({reveal:e})=>b.createElement("svg",{viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{width:"var(--psi-icon-size)",height:"var(--psi-icon-size)"}},b.createElement("path",{d:e?"M13.3536 2.35355C13.5488 2.15829 13.5488 1.84171 13.3536 1.64645C13.1583 1.45118 12.8417 1.45118 12.6464 1.64645L10.6828 3.61012C9.70652 3.21671 8.63759 3 7.5 3C4.30786 3 1.65639 4.70638 0.0760002 7.23501C-0.0253338 7.39715 -0.0253334 7.60288 0.0760014 7.76501C0.902945 9.08812 2.02314 10.1861 3.36061 10.9323L1.64645 12.6464C1.45118 12.8417 1.45118 13.1583 1.64645 13.3536C1.84171 13.5488 2.15829 13.5488 2.35355 13.3536L4.31723 11.3899C5.29348 11.7833 6.36241 12 7.5 12C10.6921 12 13.3436 10.2936 14.924 7.76501C15.0253 7.60288 15.0253 7.39715 14.924 7.23501C14.0971 5.9119 12.9769 4.81391 11.6394 4.06771L13.3536 2.35355ZM9.90428 4.38861C9.15332 4.1361 8.34759 4 7.5 4C4.80285 4 2.52952 5.37816 1.09622 7.50001C1.87284 8.6497 2.89609 9.58106 4.09974 10.1931L9.90428 4.38861ZM5.09572 10.6114L10.9003 4.80685C12.1039 5.41894 13.1272 6.35031 13.9038 7.50001C12.4705 9.62183 10.1971 11 7.5 11C6.65241 11 5.84668 10.8639 5.09572 10.6114Z":"M7.5 11C4.80285 11 2.52952 9.62184 1.09622 7.50001C2.52952 5.37816 4.80285 4 7.5 4C10.1971 4 12.4705 5.37816 13.9038 7.50001C12.4705 9.62183 10.1971 11 7.5 11ZM7.5 3C4.30786 3 1.65639 4.70638 0.0760002 7.23501C-0.0253338 7.39715 -0.0253334 7.60288 0.0760014 7.76501C1.65639 10.2936 4.30786 12 7.5 12C10.6921 12 13.3436 10.2936 14.924 7.76501C15.0253 7.60288 15.0253 7.39715 14.924 7.23501C13.3436 4.70638 10.6921 3 7.5 3ZM7.5 9.5C8.60457 9.5 9.5 8.60457 9.5 7.5C9.5 6.39543 8.60457 5.5 7.5 5.5C6.39543 5.5 5.5 6.39543 5.5 7.5C5.5 8.60457 6.39543 9.5 7.5 9.5Z",fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd"}));var rm={root:"m-f61ca620",input:"m-ccf8da4c",innerInput:"m-f2d85dd2",visibilityToggle:"m-b1072d44"};const a9={visibilityToggleIcon:s9},l9=(e,{size:t})=>({root:{"--psi-icon-size":je(t,"psi-icon-size"),"--psi-button-size":je(t,"psi-button-size")}}),Pr=G((e,t)=>{const n=V("PasswordInput",a9,e),{classNames:r,className:o,style:i,styles:s,unstyled:l,vars:c,required:u,error:d,leftSection:f,disabled:h,id:m,variant:g,inputContainer:y,description:C,label:v,size:x,errorProps:w,descriptionProps:S,labelProps:E,withAsterisk:j,inputWrapperOrder:T,wrapperProps:P,radius:R,rightSection:I,rightSectionWidth:O,rightSectionPointerEvents:D,leftSectionWidth:A,visible:M,defaultVisible:B,onVisibilityChange:F,visibilityToggleIcon:_,visibilityToggleButtonProps:k,rightSectionProps:z,leftSectionProps:q,leftSectionPointerEvents:Q,...re}=n,Ce=Ln(m),[Re,Oe]=yn({value:M,defaultValue:B,finalValue:!1,onChange:F}),ve=()=>Oe(!Re),Ve=ue({name:"PasswordInput",classes:rm,props:n,className:o,style:i,classNames:r,styles:s,unstyled:l,vars:c,varsResolver:l9}),{resolvedClassNames:Je,resolvedStyles:at}=Nd({classNames:r,styles:s,props:n}),{styleProps:Ft,rest:pe}=jo(re),Fe=_,Ne=b.createElement(Ht,{...Ve("visibilityToggle"),disabled:h,radius:R,"aria-hidden":!k,tabIndex:-1,...k,variant:"subtle",color:"gray",unstyled:l,onMouseDown:tt=>{var nt;tt.preventDefault(),(nt=k==null?void 0:k.onMouseDown)==null||nt.call(k,tt),ve()},onKeyDown:tt=>{var nt;(nt=k==null?void 0:k.onKeyDown)==null||nt.call(k,tt),tt.key===" "&&(tt.preventDefault(),ve())}},b.createElement(Fe,{reveal:Re}));return b.createElement(St.Wrapper,{required:u,id:Ce,label:v,error:d,description:C,size:x,classNames:Je,styles:at,__staticSelector:"PasswordInput",errorProps:w,descriptionProps:S,unstyled:l,withAsterisk:j,inputWrapperOrder:T,inputContainer:y,variant:g,labelProps:{...E,htmlFor:Ce},...Ve("root"),...Ft,...P},b.createElement(St,{component:"div",error:d,leftSection:f,size:x,classNames:{...Je,input:Ye(rm.input,Je.input)},styles:at,radius:R,disabled:h,__staticSelector:"PasswordInput",rightSectionWidth:O,rightSection:I??Ne,variant:g,unstyled:l,leftSectionWidth:A,rightSectionPointerEvents:D||"all",rightSectionProps:z,leftSectionProps:q,leftSectionPointerEvents:Q,withAria:!1},b.createElement("input",{required:u,"data-invalid":!!d||void 0,"data-with-left-section":!!f||void 0,...Ve("innerInput"),disabled:h,id:Ce,ref:t,...pe,autoComplete:pe.autoComplete||"off",type:Re?"text":"password"})))});Pr.classes={...pr.classes,...rm};Pr.displayName="@mantine/core/PasswordInput";const[c9,u9]=ec(),d9={},zy=G((e,t)=>{const{value:n,defaultValue:r,onChange:o,size:i,wrapperProps:s,children:l,name:c,...u}=V("RadioGroup",d9,e),d=Ln(c),[f,h]=yn({value:n,defaultValue:r,finalValue:"",onChange:o}),m=g=>h(g.currentTarget.value);return b.createElement(c9,{value:{value:f,onChange:m,size:i,name:d}},b.createElement(St.Wrapper,{size:i,ref:t,...s,...u,labelElement:"div",__staticSelector:"RadioGroup"},b.createElement(vy,{role:"radiogroup"},l)))});zy.classes=St.Wrapper.classes;zy.displayName="@mantine/core/RadioGroup";function f9({size:e,style:t,...n}){return b.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 5 5",style:{width:$(e),height:$(e),...t},"aria-hidden":!0,...n},b.createElement("circle",{cx:"2.5",cy:"2.5",r:"2.5",fill:"currentColor"}))}var aE={root:"m-f3f1af94",inner:"m-89c4f5e4",icon:"m-f3ed6b2b",radio:"m-8a3dbb89","radio--outline":"m-1bfe9d39"};const h9={labelPosition:"right"},p9=(e,{size:t,radius:n,color:r,iconColor:o,variant:i,autoContrast:s})=>{const l=Jr({color:r||e.primaryColor,theme:e}),c=l.isThemeColor&&l.shade===void 0?`var(--mantine-color-${l.color}-outline)`:l.color;return{root:{"--radio-size":je(t,"radio-size"),"--radio-radius":n===void 0?void 0:gt(n),"--radio-color":i==="outline"?c:wt(r,e),"--radio-icon-color":o?wt(o,e):s?ja({color:r,theme:e}):void 0,"--radio-icon-size":je(t,"radio-icon-size")}}},Hl=G((e,t)=>{const n=V("Radio",h9,e),{classNames:r,className:o,style:i,styles:s,unstyled:l,vars:c,id:u,size:d,label:f,labelPosition:h,description:m,error:g,radius:y,color:C,variant:v,disabled:x,wrapperProps:w,icon:S=f9,rootRef:E,iconColor:j,onChange:T,...P}=n,R=ue({name:"Radio",classes:aE,props:n,className:o,style:i,classNames:r,styles:s,unstyled:l,vars:c,varsResolver:p9}),I=u9(),O=(I==null?void 0:I.size)??d,D=n.size?d:O,{styleProps:A,rest:M}=jo(P),B=Ln(u),F=I?{checked:I.value===M.value,name:M.name??I.name,onChange:_=>{I.onChange(_),T==null||T(_)}}:{};return b.createElement(sf,{...R("root"),__staticSelector:"Radio",__stylesApiProps:n,id:B,size:D,labelPosition:h,label:f,description:m,error:g,disabled:x,classNames:r,styles:s,unstyled:l,"data-checked":F.checked||void 0,variant:v,ref:E,...A,...w},b.createElement(W,{...R("inner"),mod:{"label-position":h}},b.createElement(W,{...R("radio",{focusable:!0,variant:v}),onChange:T,...M,...F,component:"input",mod:{error:!!g},ref:t,id:B,disabled:x,type:"radio"}),b.createElement(S,{...R("icon"),"aria-hidden":!0})))});Hl.classes=aE;Hl.displayName="@mantine/core/Radio";Hl.Group=zy;const m9={duration:100,transition:"fade"};function g9(e,t){return{...m9,...t,...e}}function y9({offset:e,position:t}){const[n,r]=p.useState(!1),o=p.useRef(),{x:i,y:s,elements:l,refs:c,update:u,placement:d}=Kg({placement:t,middleware:[Gg({crossAxis:!0,padding:5,rootBoundary:"document"})]}),f=d.includes("right")?e:t.includes("left")?e*-1:0,h=d.includes("bottom")?e:t.includes("top")?e*-1:0,m=p.useCallback(({clientX:g,clientY:y})=>{c.setPositionReference({getBoundingClientRect(){return{width:0,height:0,x:g,y,left:g+f,top:y+h,right:g,bottom:y}}})},[l.reference]);return p.useEffect(()=>{if(c.floating.current){const g=o.current;g.addEventListener("mousemove",m);const y=co(c.floating.current);return y.forEach(C=>{C.addEventListener("scroll",u)}),()=>{g.removeEventListener("mousemove",m),y.forEach(C=>{C.removeEventListener("scroll",u)})}}},[l.reference,c.floating.current,u,m,n]),{handleMouseMove:m,x:i,y:s,opened:n,setOpened:r,boundaryRef:o,floating:c.setFloating}}var jf={tooltip:"m-1b3c8819",arrow:"m-f898399f"};const v9={refProp:"ref",withinPortal:!0,offset:10,position:"right",zIndex:_r("popover")},x9=(e,{radius:t,color:n})=>({tooltip:{"--tooltip-radius":t===void 0?void 0:gt(t),"--tooltip-bg":n?wt(n,e):void 0,"--tooltip-color":n?"var(--mantine-color-white)":void 0}}),By=G((e,t)=>{const n=V("TooltipFloating",v9,e),{children:r,refProp:o,withinPortal:i,style:s,className:l,classNames:c,styles:u,unstyled:d,radius:f,color:h,label:m,offset:g,position:y,multiline:C,zIndex:v,disabled:x,variant:w,vars:S,portalProps:E,...j}=n,T=Nt(),P=ue({name:"TooltipFloating",props:n,classes:jf,className:l,style:s,classNames:c,styles:u,unstyled:d,rootSelector:"tooltip",vars:S,varsResolver:x9}),{handleMouseMove:R,x:I,y:O,opened:D,boundaryRef:A,floating:M,setOpened:B}=y9({offset:g,position:y});if(!Co(r))throw new Error("[@mantine/core] Tooltip.Floating component children should be an element or a component that accepts ref, fragments, strings, numbers and other primitive values are not supported");const F=tn(A,r.ref,t),_=z=>{var q,Q;(Q=(q=r.props).onMouseEnter)==null||Q.call(q,z),R(z),B(!0)},k=z=>{var q,Q;(Q=(q=r.props).onMouseLeave)==null||Q.call(q,z),B(!1)};return b.createElement(b.Fragment,null,b.createElement(as,{...E,withinPortal:i},b.createElement(W,{...j,...P("tooltip",{style:{...CS(s,T),zIndex:v,display:!x&&D?"block":"none",top:(O&&Math.round(O))??"",left:(I&&Math.round(I))??""}}),variant:w,ref:M},m)),p.cloneElement(r,{...r.props,[o]:F,onMouseEnter:_,onMouseLeave:k}))});By.classes=jf;By.displayName="@mantine/core/TooltipFloating";const lE=p.createContext(!1),w9=lE.Provider,S9=()=>p.useContext(lE),b9={openDelay:0,closeDelay:0};function cE(e){const{openDelay:t,closeDelay:n,children:r}=V("TooltipGroup",b9,e);return b.createElement(w9,{value:!0},b.createElement(l4,{delay:{open:t,close:n}},r))}cE.displayName="@mantine/core/TooltipGroup";function C9(e){var j,T,P;const[t,n]=p.useState(!1),o=typeof e.opened=="boolean"?e.opened:t,i=S9(),s=Ln(),{delay:l,currentId:c,setCurrentId:u}=aj(),d=p.useCallback(R=>{n(R),R&&u(s)},[u,s]),{x:f,y:h,context:m,refs:g,update:y,placement:C,middlewareData:{arrow:{x:v,y:x}={}}}=Kg({placement:e.position,open:o,onOpenChange:d,middleware:[VC(e.offset),Gg({padding:8}),XC(),ZC({element:e.arrowRef,padding:e.arrowOffset}),...e.inline?[JC()]:[]]}),{getReferenceProps:w,getFloatingProps:S}=x4([a4(m,{enabled:(j=e.events)==null?void 0:j.hover,delay:i?l:{open:e.openDelay,close:e.closeDelay},mouseOnly:!((T=e.events)!=null&&T.touch)}),v4(m,{enabled:(P=e.events)==null?void 0:P.focus,keyboardOnly:!0}),w4(m,{role:"tooltip"}),y4(m,{enabled:typeof e.opened>"u"}),c4(m,{id:s})]);hj({opened:o,position:e.position,positionDependencies:e.positionDependencies,floating:{refs:g,update:y}}),fo(()=>{var R;(R=e.onPositionChange)==null||R.call(e,C)},[C]);const E=o&&c&&c!==s;return{x:f,y:h,arrowX:v,arrowY:x,reference:g.setReference,floating:g.setFloating,getFloatingProps:S,getReferenceProps:w,isGroupPhase:E,opened:o,placement:C}}const i1={position:"top",refProp:"ref",withinPortal:!0,inline:!1,arrowSize:4,arrowOffset:5,arrowRadius:0,arrowPosition:"side",offset:5,transitionProps:{duration:100,transition:"fade"},events:{hover:!0,focus:!1,touch:!1},zIndex:_r("popover"),positionDependencies:[]},j9=(e,{radius:t,color:n})=>({tooltip:{"--tooltip-radius":t===void 0?void 0:gt(t),"--tooltip-bg":n?wt(n,e):void 0,"--tooltip-color":n?"var(--mantine-color-white)":void 0}}),Na=G((e,t)=>{const n=V("Tooltip",i1,e),{children:r,position:o,refProp:i,label:s,openDelay:l,closeDelay:c,onPositionChange:u,opened:d,withinPortal:f,radius:h,color:m,classNames:g,styles:y,unstyled:C,style:v,className:x,withArrow:w,arrowSize:S,arrowOffset:E,arrowRadius:j,arrowPosition:T,offset:P,transitionProps:R,multiline:I,events:O,zIndex:D,disabled:A,positionDependencies:M,onClick:B,onMouseEnter:F,onMouseLeave:_,inline:k,variant:z,keepMounted:q,vars:Q,portalProps:re,...Ce}=V("Tooltip",i1,n),{dir:Re}=Ta(),Oe=p.useRef(null),ve=C9({position:lj(Re,o),closeDelay:c,openDelay:l,onPositionChange:u,opened:d,events:O,arrowRef:Oe,arrowOffset:E,offset:typeof P=="number"?P+(w?S/2:0):P,positionDependencies:[...M,r],inline:k}),Ve=ue({name:"Tooltip",props:n,classes:jf,className:x,style:v,classNames:g,styles:y,unstyled:C,rootSelector:"tooltip",vars:Q,varsResolver:j9});if(!Co(r))throw new Error("[@mantine/core] Tooltip component children should be an element or a component that accepts ref, fragments, strings, numbers and other primitive values are not supported");const Je=tn(ve.reference,r.ref,t),at=g9(R,{duration:100,transition:"fade"});return b.createElement(b.Fragment,null,b.createElement(as,{...re,withinPortal:f},b.createElement(ls,{...at,keepMounted:q,mounted:!A&&!!ve.opened,duration:ve.isGroupPhase?10:at.duration},Ft=>b.createElement(W,{...Ce,variant:z,mod:{multiline:I},...ve.getFloatingProps({ref:ve.floating,className:Ve("tooltip").className,style:{...Ve("tooltip").style,...Ft,zIndex:D,top:ve.y??0,left:ve.x??0}})},s,b.createElement(Yg,{ref:Oe,arrowX:ve.arrowX,arrowY:ve.arrowY,visible:w,position:ve.placement,arrowSize:S,arrowOffset:E,arrowRadius:j,arrowPosition:T,...Ve("arrow")})))),p.cloneElement(r,ve.getReferenceProps({onClick:B,onMouseEnter:F,onMouseLeave:_,onMouseMove:n.onMouseMove,onPointerDown:n.onPointerDown,onPointerEnter:n.onPointerEnter,[i]:Je,className:Ye(x,r.props.className),...r.props})))});Na.classes=jf;Na.displayName="@mantine/core/Tooltip";Na.Floating=By;Na.Group=cE;function E9({size:e,thickness:t,sum:n,value:r,root:o,offset:i}){const s=(e*.9-t*2)/2,l=Math.PI*s*2/100,c=o||r===void 0?`${(100-n)*l}, ${n*l}`:`${r*l}, ${(100-r)*l}`;return{strokeWidth:Number.isNaN(t)?12:t,cx:e/2||0,cy:e/2||0,r:s||0,transform:o?`scale(1, -1) translate(0, -${e})`:void 0,strokeDasharray:c,strokeDashoffset:o?0:i||0}}function uE({size:e,value:t,offset:n,sum:r,thickness:o,root:i,color:s,lineRoundCaps:l,tooltip:c,getStyles:u,display:d,...f}){const h=Nt();return b.createElement(Na.Floating,{disabled:!c,label:c},b.createElement(W,{component:"circle",...f,...u("curve"),__vars:{"--curve-color":s?wt(s,h):void 0},fill:"none",strokeLinecap:l?"round":"butt",...E9({sum:r,size:e,thickness:o,value:t,offset:n,root:i})}))}uE.displayName="@mantine/core/Curve";function T9({size:e,thickness:t,sections:n,renderRoundedLineCaps:r,rootColor:o}){const i=n.reduce((d,f)=>d+f.value,0),s=Math.PI*((e*.9-t*2)/2)*2;let l=s;const c=[],u=[];for(let d=0;d<n.length;d+=1)c.push({sum:i,offset:l,data:n[d],root:!1}),l-=n[d].value/100*s;if(c.push({sum:i,offset:l,data:{color:o},root:!0}),u.push({...c[c.length-1],lineRoundCaps:!1}),c.length>2){u.push({...c[0],lineRoundCaps:r}),u.push({...c[c.length-2],lineRoundCaps:r});for(let d=1;d<=c.length-3;d+=1)u.push({...c[d],lineRoundCaps:!1})}else u.push({...c[0],lineRoundCaps:r});return u}var dE={root:"m-b32e4812",svg:"m-d43b5134",curve:"m-b1ca1fbf",label:"m-b23f9dc4"};function P9(e,t){return Math.min(e||12,(t||120)/4)}const k9={size:120,thickness:12},R9=(e,{size:t,thickness:n})=>({root:{"--rp-size":$(t),"--rp-label-offset":$(n*2)}}),Ef=G((e,t)=>{const n=V("RingProgress",k9,e),{classNames:r,className:o,style:i,styles:s,unstyled:l,vars:c,label:u,sections:d,size:f,thickness:h,roundCaps:m,rootColor:g,...y}=n,C=ue({name:"RingProgress",classes:dE,props:n,className:o,style:i,classNames:r,styles:s,unstyled:l,vars:c,varsResolver:R9}),v=P9(h,f),x=T9({size:f,thickness:v,sections:d,renderRoundedLineCaps:m,rootColor:g}).map(({data:w,sum:S,root:E,lineRoundCaps:j,offset:T},P)=>b.createElement(uE,{...w,key:P,size:f,thickness:v,sum:S,offset:T,color:w==null?void 0:w.color,root:E,lineRoundCaps:j,getStyles:C}));return b.createElement(W,{...C("root"),size:f,ref:t,...y},b.createElement("svg",{...C("svg")},x),u&&b.createElement("div",{...C("label")},u))});Ef.classes=dE;Ef.displayName="@mantine/core/RingProgress";function D9({spacing:e,verticalSpacing:t,cols:n,selector:r}){var d;const o=Nt(),i=t===void 0?e:t,s=rs({"--sg-spacing-x":Kt(Qo(e)),"--sg-spacing-y":Kt(Qo(i)),"--sg-cols":(d=Qo(n))==null?void 0:d.toString()}),l=ct(o.breakpoints).reduce((f,h)=>(f[h]||(f[h]={}),typeof e=="object"&&e[h]!==void 0&&(f[h]["--sg-spacing-x"]=Kt(e[h])),typeof i=="object"&&i[h]!==void 0&&(f[h]["--sg-spacing-y"]=Kt(i[h])),typeof n=="object"&&n[h]!==void 0&&(f[h]["--sg-cols"]=n[h]),f),{}),u=jl(ct(l),o).filter(f=>ct(l[f.value]).length>0).map(f=>({query:`(min-width: ${o.breakpoints[f.value]})`,styles:l[f.value]}));return b.createElement(Ea,{styles:s,media:u,selector:r})}var fE={root:"m-2415a157"};const I9={cols:1,spacing:"md"},Uy=G((e,t)=>{const n=V("SimpleGrid",I9,e),{classNames:r,className:o,style:i,styles:s,unstyled:l,vars:c,cols:u,verticalSpacing:d,spacing:f,...h}=n,m=ue({name:"SimpleGrid",classes:fE,props:n,className:o,style:i,classNames:r,styles:s,unstyled:l,vars:c}),g=tc();return b.createElement(b.Fragment,null,b.createElement(D9,{...n,selector:`.${g}`}),b.createElement(W,{ref:t,...m("root",{className:g}),...h}))});Uy.classes=fE;Uy.displayName="@mantine/core/SimpleGrid";const _9={},Tf=G((e,t)=>{const{w:n,h:r,miw:o,mih:i,...s}=V("Space",_9,e);return b.createElement(W,{ref:t,...s,w:n,miw:o??n,h:r,mih:i??r})});Tf.displayName="@mantine/core/Space";var hE={root:"m-6d731127"};const A9={gap:"md",align:"stretch",justify:"flex-start"},N9=(e,{gap:t,align:n,justify:r})=>({root:{"--stack-gap":Kt(t),"--stack-align":n,"--stack-justify":r}}),Se=G((e,t)=>{const n=V("Stack",A9,e),{classNames:r,className:o,style:i,styles:s,unstyled:l,vars:c,align:u,justify:d,gap:f,variant:h,...m}=n,g=ue({name:"Stack",props:n,classes:hE,className:o,style:i,classNames:r,styles:s,unstyled:l,vars:c,varsResolver:N9});return b.createElement(W,{ref:t,...g("root"),variant:h,...m})});Se.classes=hE;Se.displayName="@mantine/core/Stack";const[O9,M9]=wn("Stepper component was not found in tree"),hd=()=>null;hd.displayName="@mantine/core/StepperCompleted";var Vy={root:"m-cbb4ea7e",steps:"m-aaf89d0b",separator:"m-2a371ac9",content:"m-78da155d",step:"m-cbb57068","step--horizontal":"m-f56b1e2c","step--vertical":"m-833edb7e",verticalSeparator:"m-6496b3f3",stepWrapper:"m-818e70b",stepIcon:"m-1959ad01",stepCompletedIcon:"m-a79331dc",stepBody:"m-1956aa2a",stepLabel:"m-12051f6c",stepDescription:"m-164eea74"};const au=(e,t)=>typeof e=="function"?b.createElement(e,{step:t||0}):e,L9={withIcon:!0,allowStepClick:!0,iconPosition:"left"},Hy=G((e,t)=>{const{classNames:n,className:r,style:o,styles:i,vars:s,step:l,state:c,color:u,icon:d,completedIcon:f,progressIcon:h,label:m,description:g,withIcon:y,iconSize:C,loading:v,allowStepClick:x,allowStepSelect:w,iconPosition:S,orientation:E,...j}=V("StepperStep",L9,e),T=M9(),P=Nt(),R={classNames:n,styles:i},I=c==="stepCompleted"?null:c==="stepProgress"?h:d,O={"data-progress":c==="stepProgress"||void 0,"data-completed":c==="stepCompleted"||void 0};return b.createElement(Gn,{...T.getStyles("step",{className:r,style:o,variant:T.orientation,...R}),mod:{"icon-position":S||T.iconPosition,"allow-click":x},ref:t,...O,...j,__vars:{"--step-color":u?wt(u,P):void 0},tabIndex:x?0:-1},y&&b.createElement("span",{...T.getStyles("stepWrapper",R)},b.createElement("span",{...T.getStyles("stepIcon",R),...O},b.createElement(ls,{mounted:c==="stepCompleted",transition:"pop",duration:200},D=>b.createElement("span",{...T.getStyles("stepCompletedIcon",{style:D,...R})},v?b.createElement(Nn,{color:"var(--mantine-color-white)",size:"calc(var(--stepper-icon-size) / 2)",...T.getStyles("stepLoader",R)}):au(f,l)||b.createElement(af,{size:"60%"}))),c!=="stepCompleted"?v?b.createElement(Nn,{...T.getStyles("stepLoader",R),size:"calc(var(--stepper-icon-size) / 2)",color:u}):au(I||d,l):null),E==="vertical"&&b.createElement("span",{...T.getStyles("verticalSeparator",R),"data-active":c==="stepCompleted"||void 0})),(m||g)&&b.createElement("span",{...T.getStyles("stepBody",R),"data-orientation":T.orientation,"data-icon-position":S||T.iconPosition},m&&b.createElement("span",{...T.getStyles("stepLabel",R)},au(m,l)),g&&b.createElement("span",{...T.getStyles("stepDescription",R)},au(g,l))))});Hy.classes=Vy;Hy.displayName="@mantine/core/StepperStep";const $9={orientation:"horizontal",iconPosition:"left",allowNextStepsSelect:!0,wrap:!0},F9=(e,{color:t,iconSize:n,size:r,contentPadding:o,radius:i,autoContrast:s})=>({root:{"--stepper-color":t?wt(t,e):void 0,"--stepper-icon-color":s?ja({color:t,theme:e}):void 0,"--stepper-icon-size":n===void 0?je(r,"stepper-icon-size"):$(n),"--stepper-content-padding":Kt(o),"--stepper-radius":i===void 0?void 0:gt(i),"--stepper-fz":Xt(r),"--stepper-spacing":Kt(r)}}),ya=G((e,t)=>{var _,k,z;const n=V("Stepper",$9,e),{classNames:r,className:o,style:i,styles:s,unstyled:l,vars:c,children:u,onStepClick:d,active:f,icon:h,completedIcon:m,progressIcon:g,color:y,iconSize:C,contentPadding:v,orientation:x,iconPosition:w,size:S,radius:E,allowNextStepsSelect:j,wrap:T,...P}=n,R=ue({name:"Stepper",classes:Vy,props:n,className:o,style:i,classNames:r,styles:s,unstyled:l,vars:c,varsResolver:F9}),I=p.Children.toArray(u),O=I.filter(q=>q.type!==hd),D=I.find(q=>q.type===hd),A=O.reduce((q,Q,re)=>{const Ce=f===re?"stepProgress":f>re?"stepCompleted":"stepInactive",Oe=typeof d!="function"?!1:typeof Q.props.allowStepSelect=="boolean"?Q.props.allowStepSelect:Ce==="stepCompleted"||j;return q.push(p.cloneElement(Q,{icon:Q.props.icon||h||re+1,key:re,step:re,state:Ce,onClick:()=>Oe&&(d==null?void 0:d(re)),allowStepClick:Oe,completedIcon:Q.props.completedIcon||m,progressIcon:Q.props.progressIcon||g,color:Q.props.color||y,iconSize:C,radius:E,iconPosition:Q.props.iconPosition||w,orientation:x,unstyled:l})),x==="horizontal"&&re!==O.length-1&&q.push(b.createElement("div",{...R("separator"),"data-active":re<f||void 0,"data-orientation":x,key:`separator-${re}`})),q},[]),M=(k=(_=O[f])==null?void 0:_.props)==null?void 0:k.children,B=(z=D==null?void 0:D.props)==null?void 0:z.children,F=f>O.length-1?B:M;return b.createElement(O9,{value:{getStyles:R,orientation:x,iconPosition:w}},b.createElement(W,{...R("root"),ref:t,size:S,...P},b.createElement(W,{...R("steps"),mod:{orientation:x,"icon-position":w,wrap:T&&x!=="vertical"}},A),F&&b.createElement("div",{...R("content")},F)))});ya.classes=Vy;ya.displayName="@mantine/core/Stepper";ya.Completed=hd;ya.Step=Hy;const pE=p.createContext(null),z9=pE.Provider,B9=()=>p.useContext(pE),U9={},Wy=G((e,t)=>{const{value:n,defaultValue:r,onChange:o,size:i,wrapperProps:s,children:l,...c}=V("SwitchGroup",U9,e),[u,d]=yn({value:n,defaultValue:r,finalValue:[],onChange:o}),f=h=>{const m=h.currentTarget.value;d(u.includes(m)?u.filter(g=>g!==m):[...u,m])};return b.createElement(z9,{value:{value:u,onChange:f,size:i}},b.createElement(St.Wrapper,{size:i,ref:t,...s,...c,labelElement:"div",__staticSelector:"SwitchGroup"},b.createElement(vy,{role:"group"},l)))});Wy.classes=St.Wrapper.classes;Wy.displayName="@mantine/core/SwitchGroup";var mE={root:"m-5f93f3bb",input:"m-926b4011",track:"m-9307d992",thumb:"m-93039a1d",trackLabel:"m-8277e082"};const V9={labelPosition:"right"},H9=(e,{radius:t,color:n,size:r})=>({root:{"--switch-radius":t===void 0?void 0:gt(t),"--switch-height":je(r,"switch-height"),"--switch-width":je(r,"switch-width"),"--switch-thumb-size":je(r,"switch-thumb-size"),"--switch-label-font-size":je(r,"switch-label-font-size"),"--switch-track-label-padding":je(r,"switch-track-label-padding"),"--switch-color":n?wt(n,e):void 0}}),mc=G((e,t)=>{const n=V("Switch",V9,e),{classNames:r,className:o,style:i,styles:s,unstyled:l,vars:c,color:u,label:d,offLabel:f,onLabel:h,id:m,size:g,radius:y,wrapperProps:C,children:v,thumbIcon:x,checked:w,defaultChecked:S,onChange:E,labelPosition:j,description:T,error:P,disabled:R,variant:I,rootRef:O,...D}=n,A=B9(),M=g||(A==null?void 0:A.size),B=ue({name:"Switch",props:n,classes:mE,className:o,style:i,classNames:r,styles:s,unstyled:l,vars:c,varsResolver:H9}),{styleProps:F,rest:_}=jo(D),k=Ln(m),z=A?{checked:A.value.includes(_.value),onChange:A.onChange}:{},[q,Q]=yn({value:z.checked??w,defaultValue:S,finalValue:!1});return b.createElement(sf,{...B("root"),__staticSelector:"Switch",__stylesApiProps:n,id:k,size:M,labelPosition:j,label:d,description:T,error:P,disabled:R,classNames:r,styles:s,unstyled:l,"data-checked":z.checked||void 0,variant:I,ref:O,...F,...C},b.createElement("input",{..._,disabled:R,checked:q,onChange:re=>{var Ce;A?(Ce=z.onChange)==null||Ce.call(z,re):E==null||E(re),Q(re.currentTarget.checked)},id:k,ref:t,type:"checkbox",...B("input")}),b.createElement(W,{component:"label",htmlFor:k,mod:{error:P,"label-position":j},...B("track")},b.createElement(W,{component:"span",mod:"reduce-motion",...B("thumb")},x),b.createElement("span",{...B("trackLabel")},q?h:f)))});mc.classes={...mE,...Mj};mc.displayName="@mantine/core/Switch";mc.Group=Wy;const[W9,q9]=wn("Table component was not found in the tree");var gc={table:"m-b23fa0ef",th:"m-4e7aa4f3",tr:"m-4e7aa4fd",td:"m-4e7aa4ef",tbody:"m-b2404537",thead:"m-b242d975",caption:"m-9e5a3ac7",scrollContainer:"m-a100c15",scrollContainerInner:"m-62259741"};function G9(e,t){if(!t)return;const n={};return t.columnBorder&&e.withColumnBorders&&(n["data-with-column-border"]=!0),t.rowBorder&&e.withRowBorders&&(n["data-with-row-border"]=!0),t.striped&&e.striped&&(n["data-striped"]=e.striped),t.highlightOnHover&&e.highlightOnHover&&(n["data-hover"]=!0),t.captionSide&&e.captionSide&&(n["data-side"]=e.captionSide),t.stickyHeader&&e.stickyHeader&&(n["data-sticky"]=!0),n}function hs(e,t){const n=`Table${e.charAt(0).toUpperCase()}${e.slice(1)}`,r=G((o,i)=>{const s=V(n,{},o),{classNames:l,className:c,style:u,styles:d,...f}=s,h=q9();return b.createElement(W,{component:e,ref:i,...G9(h,t),...h.getStyles(e,{className:c,classNames:l,style:u,styles:d,props:s}),...f})});return r.displayName=`@mantine/core/${n}`,r.classes=gc,r}const om=hs("th",{columnBorder:!0}),gE=hs("td",{columnBorder:!0}),Iu=hs("tr",{rowBorder:!0,striped:!0,highlightOnHover:!0}),yE=hs("thead",{stickyHeader:!0}),vE=hs("tbody"),xE=hs("tfoot"),wE=hs("caption",{captionSide:!0});function qy({data:e}){return b.createElement(b.Fragment,null,e.caption&&b.createElement(wE,null,e.caption),e.head&&b.createElement(yE,null,b.createElement(Iu,null,e.head.map((t,n)=>b.createElement(om,{key:n},t)))),e.body&&b.createElement(vE,null,e.body.map((t,n)=>b.createElement(Iu,{key:n},t.map((r,o)=>b.createElement(gE,{key:o},r))))),e.foot&&b.createElement(xE,null,b.createElement(Iu,null,e.foot.map((t,n)=>b.createElement(om,{key:n},t)))))}qy.displayName="@mantine/core/TableDataRenderer";const Q9={type:"scrollarea"},K9=(e,{minWidth:t,type:n})=>({scrollContainer:{"--table-min-width":$(t),"--table-overflow":n==="native"?"auto":void 0}}),Gy=G((e,t)=>{const n=V("TableScrollContainer",Q9,e),{classNames:r,className:o,style:i,styles:s,unstyled:l,vars:c,children:u,minWidth:d,type:f,...h}=n,m=ue({name:"TableScrollContainer",classes:gc,props:n,className:o,style:i,classNames:r,styles:s,unstyled:l,vars:c,varsResolver:K9,rootSelector:"scrollContainer"});return b.createElement(W,{component:f==="scrollarea"?fr:"div",...f==="scrollarea"?{offsetScrollbars:"x"}:{},ref:t,...m("scrollContainer"),...h},b.createElement("div",{...m("scrollContainerInner")},u))});Gy.classes=gc;Gy.displayName="@mantine/core/TableScrollContainer";const Y9={withRowBorders:!0,verticalSpacing:7},X9=(e,{layout:t,captionSide:n,horizontalSpacing:r,verticalSpacing:o,borderColor:i,stripedColor:s,highlightOnHoverColor:l,striped:c,highlightOnHover:u,stickyHeaderOffset:d,stickyHeader:f})=>({table:{"--table-layout":t,"--table-caption-side":n,"--table-horizontal-spacing":Kt(r),"--table-vertical-spacing":Kt(o),"--table-border-color":i?wt(i,e):void 0,"--table-striped-color":c&&s?wt(s,e):void 0,"--table-highlight-on-hover-color":u&&l?wt(l,e):void 0,"--table-sticky-header-offset":f?$(d):void 0}}),he=G((e,t)=>{const n=V("Table",Y9,e),{classNames:r,className:o,style:i,styles:s,unstyled:l,vars:c,horizontalSpacing:u,verticalSpacing:d,captionSide:f,stripedColor:h,highlightOnHoverColor:m,striped:g,highlightOnHover:y,withColumnBorders:C,withRowBorders:v,withTableBorder:x,borderColor:w,layout:S,variant:E,data:j,children:T,stickyHeader:P,stickyHeaderOffset:R,...I}=n,O=ue({name:"Table",props:n,className:o,style:i,classes:gc,classNames:r,styles:s,unstyled:l,rootSelector:"table",vars:c,varsResolver:X9});return b.createElement(W9,{value:{getStyles:O,stickyHeader:P,striped:g===!0?"odd":g||void 0,highlightOnHover:y,withColumnBorders:C,withRowBorders:v,captionSide:f||"bottom"}},b.createElement(W,{component:"table",variant:E,ref:t,mod:{"data-with-table-border":x},...O("table"),...I},T||!!j&&b.createElement(qy,{data:j})))});he.classes=gc;he.displayName="@mantine/core/Table";he.Td=gE;he.Th=om;he.Tr=Iu;he.Thead=yE;he.Tbody=vE;he.Tfoot=xE;he.Caption=wE;he.ScrollContainer=Gy;he.DataRenderer=qy;const[J9,Qy]=wn("Tabs component was not found in the tree");var yc={root:"m-89d60db1","list--default":"m-576c9d4",list:"m-89d33d6d",panel:"m-b0c91715",tab:"m-4ec4dce6",tabSection:"m-fc420b1f","tab--default":"m-539e827b","list--outline":"m-6772fbd5","tab--outline":"m-b59ab47c","tab--pills":"m-c3381914"};const Z9={},Ky=G((e,t)=>{const n=V("TabsList",Z9,e),{children:r,className:o,grow:i,justify:s,classNames:l,styles:c,style:u,...d}=n,f=Qy();return b.createElement(W,{...d,...f.getStyles("list",{className:o,style:u,classNames:l,styles:c,props:n,variant:f.variant}),ref:t,role:"tablist",variant:f.variant,mod:{grow:i,orientation:f.orientation,placement:f.orientation==="vertical"&&f.placement,inverted:f.inverted},"aria-orientation":f.orientation,__vars:{"--tabs-justify":s}},r)});Ky.classes=yc;Ky.displayName="@mantine/core/TabsList";const e5={},Yy=G((e,t)=>{const n=V("TabsPanel",e5,e),{children:r,className:o,value:i,classNames:s,styles:l,style:c,...u}=n,d=Qy(),f=d.value===i,h=d.keepMounted||n.keepMounted||f?r:null;return b.createElement(W,{...u,...d.getStyles("panel",{className:o,classNames:s,styles:l,style:[c,f?void 0:{display:"none"}],props:n}),ref:t,mod:{orientation:d.orientation},role:"tabpanel",id:d.getPanelId(i),"aria-labelledby":d.getTabId(i)},h)});Yy.classes=yc;Yy.displayName="@mantine/core/TabsPanel";const t5={},Xy=G((e,t)=>{const n=V("TabsTab",t5,e),{className:r,children:o,rightSection:i,leftSection:s,value:l,onClick:c,onKeyDown:u,disabled:d,color:f,style:h,classNames:m,styles:g,vars:y,...C}=n,v=Nt(),{dir:x}=Ta(),w=Qy(),S=l===w.value,E=T=>{w.onChange(w.allowTabDeactivation&&l===w.value?null:l),c==null||c(T)},j={classNames:m,styles:g,props:n};return b.createElement(Gn,{...C,...w.getStyles("tab",{className:r,style:h,variant:w.variant,...j}),disabled:d,unstyled:w.unstyled,variant:w.variant,mod:{active:S,disabled:d,orientation:w.orientation,inverted:w.inverted,placement:w.orientation==="vertical"&&w.placement},ref:t,role:"tab",id:w.getTabId(l),"aria-selected":S,tabIndex:S||w.value===null?0:-1,"aria-controls":w.getPanelId(l),onClick:E,__vars:{"--tabs-color":f?wt(f,v):void 0},onKeyDown:aS({siblingSelector:'[role="tab"]',parentSelector:'[role="tablist"]',activateOnFocus:w.activateTabWithKeyboard,loop:w.loop,orientation:w.orientation||"horizontal",dir:x,onKeyDown:u})},s&&b.createElement("span",{...w.getStyles("tabSection",j),"data-position":"left"},s),o&&b.createElement("span",{...w.getStyles("tabLabel",j)},o),i&&b.createElement("span",{...w.getStyles("tabSection",j),"data-position":"right"},i))});Xy.classes=yc;Xy.displayName="@mantine/core/TabsTab";const s1="Tabs.Tab or Tabs.Panel component was rendered with invalid value or without value",n5={keepMounted:!0,orientation:"horizontal",loop:!0,activateTabWithKeyboard:!0,allowTabDeactivation:!1,unstyled:!1,inverted:!1,variant:"default",placement:"left"},r5=(e,{radius:t,color:n,autoContrast:r})=>({root:{"--tabs-radius":gt(t),"--tabs-color":wt(n,e),"--tabs-text-color":r?ja({color:n,theme:e}):void 0}}),We=G((e,t)=>{const n=V("Tabs",n5,e),{defaultValue:r,value:o,onChange:i,orientation:s,children:l,loop:c,id:u,activateTabWithKeyboard:d,allowTabDeactivation:f,variant:h,color:m,radius:g,inverted:y,placement:C,keepMounted:v,classNames:x,styles:w,unstyled:S,className:E,style:j,vars:T,autoContrast:P,...R}=n,I=Ln(u),[O,D]=yn({value:o,defaultValue:r,finalValue:null,onChange:i}),A=ue({name:"Tabs",props:n,classes:yc,className:E,style:j,classNames:x,styles:w,unstyled:S,vars:T,varsResolver:r5});return b.createElement(J9,{value:{placement:C,value:O,orientation:s,id:I,loop:c,activateTabWithKeyboard:d,getTabId:f0(`${I}-tab`,s1),getPanelId:f0(`${I}-panel`,s1),onChange:D,allowTabDeactivation:f,variant:h,color:m,radius:g,inverted:y,keepMounted:v,unstyled:S,getStyles:A}},b.createElement(W,{ref:t,id:I,variant:h,mod:{orientation:s,inverted:s==="horizontal"&&y,placement:s==="vertical"&&C},...A("root"),...R},l))});We.classes=yc;We.displayName="@mantine/core/Tabs";We.Tab=Xy;We.Panel=Yy;We.List=Ky;const o5={},ie=G((e,t)=>{const n=V("TextInput",o5,e);return b.createElement(pr,{component:"input",ref:t,...n,__staticSelector:"TextInput"})});ie.classes=pr.classes;ie.displayName="@mantine/core/TextInput";var SE={root:"m-7341320d"};const i5={},s5=(e,{size:t,radius:n,variant:r,gradient:o,color:i,autoContrast:s})=>{const l=e.variantColorResolver({color:i||e.primaryColor,theme:e,gradient:o,variant:r||"filled",autoContrast:s});return{root:{"--ti-size":je(t,"ti-size"),"--ti-radius":n===void 0?void 0:gt(n),"--ti-bg":i||r?l.background:void 0,"--ti-color":i||r?l.color:void 0,"--ti-bd":i||r?l.border:void 0}}},Jy=G((e,t)=>{const n=V("ThemeIcon",i5,e),{classNames:r,className:o,style:i,styles:s,unstyled:l,vars:c,autoContrast:u,...d}=n,f=ue({name:"ThemeIcon",classes:SE,props:n,className:o,style:i,classNames:r,styles:s,unstyled:l,vars:c,varsResolver:s5});return b.createElement(W,{ref:t,...f("root"),...d})});Jy.classes=SE;Jy.displayName="@mantine/core/ThemeIcon";const a5=["h1","h2","h3","h4","h5","h6"];function l5(e,t){const n=t!==void 0?t:`h${e}`;return a5.includes(n)?{fontSize:`var(--mantine-${n}-font-size)`,fontWeight:`var(--mantine-${n}-font-weight)`,lineHeight:`var(--mantine-${n}-line-height)`}:{fontSize:$(n),fontWeight:`var(--mantine-h${e}-font-weight)`,lineHeight:`var(--mantine-h${e}-line-height)`}}var bE={root:"m-8a5d1357"};const c5={order:1},u5=(e,{order:t,size:n,lineClamp:r})=>{const o=l5(t,n);return{root:{"--title-fw":o.fontWeight,"--title-lh":o.lineHeight,"--title-fz":o.fontSize,"--title-line-clamp":typeof r=="number"?r.toString():void 0}}},ae=G((e,t)=>{const n=V("Title",c5,e),{classNames:r,className:o,style:i,styles:s,unstyled:l,order:c,vars:u,size:d,variant:f,lineClamp:h,...m}=n,g=ue({name:"Title",props:n,classes:bE,className:o,style:i,classNames:r,styles:s,unstyled:l,vars:u,varsResolver:u5});return[1,2,3,4,5,6].includes(c)?b.createElement(W,{...g("root"),component:`h${c}`,variant:f,ref:t,mod:{order:c,"data-line-clamp":typeof h=="number"},size:d,...m}):null});ae.classes=bE;ae.displayName="@mantine/core/Title";function d5(e){let t=e,n=!1;const r=new Set;return{getState(){return t},updateState(o){t=typeof o=="function"?o(t):o},setState(o){this.updateState(o),r.forEach(i=>i(t))},initialize(o){n||(t=o,n=!0)},subscribe(o){return r.add(o),()=>r.delete(o)}}}function f5(e){return p.useSyncExternalStore(e.subscribe,()=>e.getState(),()=>e.getState())}const h5=()=>d5({notifications:[],queue:[],limit:5}),ps=h5(),p5=(e=ps)=>f5(e);function Oa(e,t){const n=e.getState(),r=t([...n.notifications,...n.queue]);e.setState({notifications:r.slice(0,n.limit),queue:r.slice(n.limit),limit:n.limit})}function ce(e,t=ps){const n=e.id||Fm();return Oa(t,r=>e.id&&r.some(o=>o.id===e.id)?r:[...r,{...e,id:n}]),n}function CE(e,t=ps){return Oa(t,n=>n.filter(r=>{var o;return r.id===e?((o=r.onClose)==null||o.call(r,r),!1):!0})),e}function dl(e,t=ps){return Oa(t,n=>n.map(r=>r.id===e.id?{...r,...e}:r)),e.id}function m5(e=ps){Oa(e,()=>[])}function g5(e=ps){Oa(e,t=>t.slice(0,e.getState().limit))}const Kr={show:ce,hide:CE,update:dl,clean:m5,cleanQueue:g5,updateState:Oa};function im(e,t){return im=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,o){return r.__proto__=o,r},im(e,t)}function jE(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,im(e,t)}var EE={exports:{}},y5="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED",v5=y5,x5=v5;function TE(){}function PE(){}PE.resetWarningCache=TE;var w5=function(){function e(r,o,i,s,l,c){if(c!==x5){var u=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw u.name="Invariant Violation",u}}e.isRequired=e;function t(){return e}var n={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:PE,resetWarningCache:TE};return n.PropTypes=n,n};EE.exports=w5();var S5=EE.exports;const ze=Dm(S5),a1={disabled:!1},pd=b.createContext(null);var b5=function(t){return t.scrollTop},fl="unmounted",Ii="exited",_i="entering",Is="entered",sm="exiting",Ro=function(e){jE(t,e);function t(r,o){var i;i=e.call(this,r,o)||this;var s=o,l=s&&!s.isMounting?r.enter:r.appear,c;return i.appearStatus=null,r.in?l?(c=Ii,i.appearStatus=_i):c=Is:r.unmountOnExit||r.mountOnEnter?c=fl:c=Ii,i.state={status:c},i.nextCallback=null,i}t.getDerivedStateFromProps=function(o,i){var s=o.in;return s&&i.status===fl?{status:Ii}:null};var n=t.prototype;return n.componentDidMount=function(){this.updateStatus(!0,this.appearStatus)},n.componentDidUpdate=function(o){var i=null;if(o!==this.props){var s=this.state.status;this.props.in?s!==_i&&s!==Is&&(i=_i):(s===_i||s===Is)&&(i=sm)}this.updateStatus(!1,i)},n.componentWillUnmount=function(){this.cancelNextCallback()},n.getTimeouts=function(){var o=this.props.timeout,i,s,l;return i=s=l=o,o!=null&&typeof o!="number"&&(i=o.exit,s=o.enter,l=o.appear!==void 0?o.appear:s),{exit:i,enter:s,appear:l}},n.updateStatus=function(o,i){if(o===void 0&&(o=!1),i!==null)if(this.cancelNextCallback(),i===_i){if(this.props.unmountOnExit||this.props.mountOnEnter){var s=this.props.nodeRef?this.props.nodeRef.current:ul.findDOMNode(this);s&&b5(s)}this.performEnter(o)}else this.performExit();else this.props.unmountOnExit&&this.state.status===Ii&&this.setState({status:fl})},n.performEnter=function(o){var i=this,s=this.props.enter,l=this.context?this.context.isMounting:o,c=this.props.nodeRef?[l]:[ul.findDOMNode(this),l],u=c[0],d=c[1],f=this.getTimeouts(),h=l?f.appear:f.enter;if(!o&&!s||a1.disabled){this.safeSetState({status:Is},function(){i.props.onEntered(u)});return}this.props.onEnter(u,d),this.safeSetState({status:_i},function(){i.props.onEntering(u,d),i.onTransitionEnd(h,function(){i.safeSetState({status:Is},function(){i.props.onEntered(u,d)})})})},n.performExit=function(){var o=this,i=this.props.exit,s=this.getTimeouts(),l=this.props.nodeRef?void 0:ul.findDOMNode(this);if(!i||a1.disabled){this.safeSetState({status:Ii},function(){o.props.onExited(l)});return}this.props.onExit(l),this.safeSetState({status:sm},function(){o.props.onExiting(l),o.onTransitionEnd(s.exit,function(){o.safeSetState({status:Ii},function(){o.props.onExited(l)})})})},n.cancelNextCallback=function(){this.nextCallback!==null&&(this.nextCallback.cancel(),this.nextCallback=null)},n.safeSetState=function(o,i){i=this.setNextCallback(i),this.setState(o,i)},n.setNextCallback=function(o){var i=this,s=!0;return this.nextCallback=function(l){s&&(s=!1,i.nextCallback=null,o(l))},this.nextCallback.cancel=function(){s=!1},this.nextCallback},n.onTransitionEnd=function(o,i){this.setNextCallback(i);var s=this.props.nodeRef?this.props.nodeRef.current:ul.findDOMNode(this),l=o==null&&!this.props.addEndListener;if(!s||l){setTimeout(this.nextCallback,0);return}if(this.props.addEndListener){var c=this.props.nodeRef?[this.nextCallback]:[s,this.nextCallback],u=c[0],d=c[1];this.props.addEndListener(u,d)}o!=null&&setTimeout(this.nextCallback,o)},n.render=function(){var o=this.state.status;if(o===fl)return null;var i=this.props,s=i.children;i.in,i.mountOnEnter,i.unmountOnExit,i.appear,i.enter,i.exit,i.timeout,i.addEndListener,i.onEnter,i.onEntering,i.onEntered,i.onExit,i.onExiting,i.onExited,i.nodeRef;var l=Ty(i,["children","in","mountOnEnter","unmountOnExit","appear","enter","exit","timeout","addEndListener","onEnter","onEntering","onEntered","onExit","onExiting","onExited","nodeRef"]);return b.createElement(pd.Provider,{value:null},typeof s=="function"?s(o,l):b.cloneElement(b.Children.only(s),l))},t}(b.Component);Ro.contextType=pd;Ro.propTypes={};function Ps(){}Ro.defaultProps={in:!1,mountOnEnter:!1,unmountOnExit:!1,appear:!1,enter:!0,exit:!0,onEnter:Ps,onEntering:Ps,onEntered:Ps,onExit:Ps,onExiting:Ps,onExited:Ps};Ro.UNMOUNTED=fl;Ro.EXITED=Ii;Ro.ENTERING=_i;Ro.ENTERED=Is;Ro.EXITING=sm;const C5=Ro;function j5(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Zy(e,t){var n=function(i){return t&&p.isValidElement(i)?t(i):i},r=Object.create(null);return e&&p.Children.map(e,function(o){return o}).forEach(function(o){r[o.key]=n(o)}),r}function E5(e,t){e=e||{},t=t||{};function n(d){return d in t?t[d]:e[d]}var r=Object.create(null),o=[];for(var i in e)i in t?o.length&&(r[i]=o,o=[]):o.push(i);var s,l={};for(var c in t){if(r[c])for(s=0;s<r[c].length;s++){var u=r[c][s];l[r[c][s]]=n(u)}l[c]=n(c)}for(s=0;s<o.length;s++)l[o[s]]=n(o[s]);return l}function $i(e,t,n){return n[t]!=null?n[t]:e.props[t]}function T5(e,t){return Zy(e.children,function(n){return p.cloneElement(n,{onExited:t.bind(null,n),in:!0,appear:$i(n,"appear",e),enter:$i(n,"enter",e),exit:$i(n,"exit",e)})})}function P5(e,t,n){var r=Zy(e.children),o=E5(t,r);return Object.keys(o).forEach(function(i){var s=o[i];if(p.isValidElement(s)){var l=i in t,c=i in r,u=t[i],d=p.isValidElement(u)&&!u.props.in;c&&(!l||d)?o[i]=p.cloneElement(s,{onExited:n.bind(null,s),in:!0,exit:$i(s,"exit",e),enter:$i(s,"enter",e)}):!c&&l&&!d?o[i]=p.cloneElement(s,{in:!1}):c&&l&&p.isValidElement(u)&&(o[i]=p.cloneElement(s,{onExited:n.bind(null,s),in:u.props.in,exit:$i(s,"exit",e),enter:$i(s,"enter",e)}))}}),o}var k5=Object.values||function(e){return Object.keys(e).map(function(t){return e[t]})},R5={component:"div",childFactory:function(t){return t}},ev=function(e){jE(t,e);function t(r,o){var i;i=e.call(this,r,o)||this;var s=i.handleExited.bind(j5(i));return i.state={contextValue:{isMounting:!0},handleExited:s,firstRender:!0},i}var n=t.prototype;return n.componentDidMount=function(){this.mounted=!0,this.setState({contextValue:{isMounting:!1}})},n.componentWillUnmount=function(){this.mounted=!1},t.getDerivedStateFromProps=function(o,i){var s=i.children,l=i.handleExited,c=i.firstRender;return{children:c?T5(o,l):P5(o,s,l),firstRender:!1}},n.handleExited=function(o,i){var s=Zy(this.props.children);o.key in s||(o.props.onExited&&o.props.onExited(i),this.mounted&&this.setState(function(l){var c=fd({},l.children);return delete c[o.key],{children:c}}))},n.render=function(){var o=this.props,i=o.component,s=o.childFactory,l=Ty(o,["component","childFactory"]),c=this.state.contextValue,u=k5(this.state.children).map(s);return delete l.appear,delete l.enter,delete l.exit,i===null?b.createElement(pd.Provider,{value:c},u):b.createElement(pd.Provider,{value:c},b.createElement(i,l,u))},t}(b.Component);ev.propTypes={};ev.defaultProps=R5;const D5=ev,l1={left:"translateX(-100%)",right:"translateX(100%)","top-center":"translateY(-100%)","bottom-center":"translateY(100%)"},I5={left:"translateX(0)",right:"translateX(0)","top-center":"translateY(0)","bottom-center":"translateY(0)"};function _5({state:e,maxHeight:t,position:n,transitionDuration:r}){const[o,i]=n.split("-"),s=i==="center"?`${o}-center`:i,l={opacity:0,maxHeight:t,transform:l1[s],transitionDuration:`${r}ms, ${r}ms, ${r}ms`,transitionTimingFunction:"cubic-bezier(.51,.3,0,1.21), cubic-bezier(.51,.3,0,1.21), linear",transitionProperty:"opacity, transform, max-height"},c={opacity:1,transform:I5[s]},u={opacity:0,maxHeight:0,transform:l1[s]};return{...l,...{entering:c,entered:c,exiting:u,exited:u}[e]}}function A5(e,t){return typeof t=="number"?t:t===!1||e===!1?!1:e}const kE=p.forwardRef(({data:e,onHide:t,autoClose:n,...r},o)=>{const{autoClose:i,message:s,...l}=e,c=A5(n,e.autoClose),u=p.useRef(),d=()=>window.clearTimeout(u.current),f=()=>{t(e.id),d()},h=()=>{typeof c=="number"&&(u.current=window.setTimeout(f,c))};return p.useEffect(()=>{var m;(m=e.onOpen)==null||m.call(e,e)},[]),p.useEffect(()=>(h(),d),[c]),b.createElement($y,{...r,...l,onClose:f,ref:o,onMouseEnter:d,onMouseLeave:h},s)});kE.displayName="@mantine/notifications/NotificationContainer";var RE={root:"m-b37d9ac7",notification:"m-5ed0edd0"};const N5=C5,O5={position:"bottom-right",autoClose:4e3,transitionDuration:250,containerWidth:440,notificationMaxHeight:200,limit:5,zIndex:_r("overlay"),store:ps,withinPortal:!0},M5=(e,{zIndex:t,position:n,containerWidth:r})=>{const[o,i]=n.split("-");return{root:{"--notifications-z-index":t==null?void 0:t.toString(),"--notifications-top":o==="top"?"var(--mantine-spacing-md)":void 0,"--notifications-bottom":o==="bottom"?"var(--mantine-spacing-md)":void 0,"--notifications-left":i==="left"?"var(--mantine-spacing-md)":i==="center"?"50%":void 0,"--notifications-right":i==="right"?"var(--mantine-spacing-md)":void 0,"--notifications-transform":i==="center"?"translateX(-50%)":void 0,"--notifications-container-width":$(r)}}},Do=G((e,t)=>{const n=V("Notifications",O5,e),{classNames:r,className:o,style:i,styles:s,unstyled:l,vars:c,position:u,autoClose:d,transitionDuration:f,containerWidth:h,notificationMaxHeight:m,limit:g,zIndex:y,store:C,portalProps:v,withinPortal:x,...w}=n,S=Nt(),E=p5(C),j=F2(),T=Bm(),P=p.useRef({}),R=p.useRef(0),O=(S.respectReducedMotion?T:!1)?1:f,D=ue({name:"Notifications",classes:RE,props:n,className:o,style:i,classNames:r,styles:s,unstyled:l,vars:c,varsResolver:M5});p.useEffect(()=>{C==null||C.updateState(M=>({...M,limit:g||5}))},[g]),fo(()=>{E.notifications.length>R.current&&setTimeout(()=>j(),0),R.current=E.notifications.length},[E.notifications]);const A=E.notifications.map(({style:M,...B})=>b.createElement(N5,{key:B.id,timeout:O,onEnter:()=>P.current[B.id].offsetHeight,nodeRef:{current:P.current[B.id]}},F=>b.createElement(kE,{ref:_=>{P.current[B.id]=_},data:B,onHide:_=>CE(_,C),autoClose:d,...D("notification",{style:{..._5({state:F,position:u,transitionDuration:O,maxHeight:m}),...M}})})));return b.createElement(as,{withinPortal:x,...v},b.createElement(W,{...D("root"),ref:t,...w},b.createElement(D5,null,A)))});Do.classes=RE;Do.displayName="@mantine/notifications/Notifications";Do.show=Kr.show;Do.hide=Kr.hide;Do.update=Kr.update;Do.clean=Kr.clean;Do.cleanQueue=Kr.cleanQueue;Do.updateState=Kr.updateState;class L5{constructor(t,n){this.operator=t,this.child=n}toString(){return`${this.operator}(${this.child.toString()})`}}class vc{constructor(t,n,r){this.operator=t,this.left=n,this.right=r}toString(){return`${this.left.toString()} ${this.operator} ${this.right.toString()}`}}class $5{constructor(){this.prefixParselets={},this.infixParselets={}}registerInfix(t,n){return this.infixParselets[t]=n,this}registerPrefix(t,n){return this.prefixParselets[t]=n,this}prefix(t,n,r){return this.registerPrefix(t,{parse(o,i){const s=o.consumeAndParse(n);return r(i,s)}})}infixLeft(t,n,r){return this.registerInfix(t,{parse(o,i,s){const l=o.consumeAndParse(n);return r(i,s,l)},precedence:n})}construct(t){return new F5(t,this.prefixParselets,this.infixParselets)}}class F5{constructor(t,n,r){this.tokens=t,this.prefixParselets=n,this.infixParselets=r}hasMore(){return this.tokens.length>0}match(t){const n=this.peek();return(n==null?void 0:n.id)!==t?!1:(this.consume(),!0)}consumeAndParse(t=1/0){const n=this.consume(),r=this.prefixParselets[n.id];if(!r)throw Error(`Parse error at "${n.value}" (line ${n.line}, column ${n.column}). No matching prefix parselet.`);let o=r.parse(this,n);for(;t>this.getPrecedence();){const i=this.consume();o=this.getInfixParselet(i).parse(this,o,i)}return o}getPrecedence(){const t=this.peek();if(!t)return 1/0;const n=this.getInfixParselet(t);return n?n.precedence:1/0}consume(t,n){var r,o;if(!this.tokens.length)throw Error("Cant consume unknown more tokens.");if(t&&((r=this.peek())==null?void 0:r.id)!==t){const i=this.peek();throw Error(`Expected ${t} but got "${i.id}" (${i.value}) at line ${i.line} column ${i.column}.`)}if(n&&((o=this.peek())==null?void 0:o.value)!==n){const i=this.peek();throw Error(`Expected "${n}" but got "${i.value}" at line ${i.line} column ${i.column}.`)}return this.tokens.shift()}peek(){return this.tokens.length>0?this.tokens[0]:void 0}removeComments(){this.tokens=this.tokens.filter(t=>t.id!=="Comment")}getInfixParselet(t){return this.infixParselets[t.id==="Symbol"?t.value:t.id]}}const DE="ok",z5="created",B5="gone",U5="not-modified",V5="not-found",H5="forbidden",W5="accepted",q5={resourceType:"OperationOutcome",id:DE,issue:[{severity:"information",code:"informational",details:{text:"All OK"}}]},G5={resourceType:"OperationOutcome",id:V5,issue:[{severity:"error",code:"not-found",details:{text:"Not found"}}]},IE={resourceType:"OperationOutcome",id:H5,issue:[{severity:"error",code:"forbidden",details:{text:"Forbidden"}}]};function li(e,t){return{resourceType:"OperationOutcome",issue:[{severity:"error",code:"invalid",details:{text:e},expression:t?[t]:void 0}]}}function At(e){return{resourceType:"OperationOutcome",issue:[{severity:"error",code:"structure",details:{text:e}}]}}function Pf(e){return typeof e=="object"&&e!==null&&e.resourceType==="OperationOutcome"}function _E(e){return e.id===DE||e.id===z5||e.id===U5||e.id===W5}function Q5(e){return e.id===B5}class He extends Error{constructor(t,n){super(AE(t)),this.outcome=t,this.cause=n}}function ut(e){return e instanceof He?e.outcome:Pf(e)?e:li(Pe(e))}function Pe(e){return e?typeof e=="string"?e:e instanceof Error?e.message:Pf(e)?AE(e):typeof e=="object"&&"code"in e&&typeof e.code=="string"?e.code:JSON.stringify(e):"Unknown error"}function AE(e){var n;const t=((n=e.issue)==null?void 0:n.map(NE))??[];return t.length>0?t.join("; "):"Unknown error"}function NE(e){var n,r;let t;return(n=e.details)!=null&&n.text?e.diagnostics?t=`${e.details.text} (${e.diagnostics})`:t=e.details.text:e.diagnostics?t=e.diagnostics:t="Unknown error",(r=e.expression)!=null&&r.length&&(t+=` (${e.expression.join(", ")})`),t}function xt(e){const t=ht(e),n=xo(e);return n===t?{reference:t}:{reference:t,display:n}}function ht(e){return ys(e)?e.reference:`${e.resourceType}/${e.id}`}function tv(e){if(e)return ys(e)?e.reference.split("/")[1]:e.id}function K5(e){return e.resourceType==="Patient"||e.resourceType==="Practitioner"||e.resourceType==="RelatedPerson"}function xo(e){var t;if(K5(e)){const n=Y5(e);if(n)return n}if(e.resourceType==="Device"){const n=X5(e);if(n)return n}return e.resourceType==="Observation"&&"code"in e&&(t=e.code)!=null&&t.text?e.code.text:e.resourceType==="User"&&e.email?e.email:"name"in e&&e.name&&typeof e.name=="string"?e.name:ht(e)}function Y5(e){const t=e.name;if(t&&t.length>0)return Sc(t[0])}function X5(e){const t=e.deviceName;if(t&&t.length>0)return t[0].name}function J5(e){if(!("photo"in e))return;const t=e.photo;if(t)if(Array.isArray(t))for(const n of t){const r=c1(n);if(r)return r}else return c1(t)}function c1(e){if(e.url&&e.contentType&&e.contentType.startsWith("image/"))return e.url}function OE(e,t){const n=new Date(e);n.setUTCHours(0,0,0,0);const r=t?new Date(t):new Date;r.setUTCHours(0,0,0,0);const o=n.getUTCFullYear(),i=n.getUTCMonth(),s=n.getUTCDate(),l=r.getUTCFullYear(),c=r.getUTCMonth(),u=r.getUTCDate();let d=l-o;(c<i||c===i&&u<s)&&d--;let f=l*12+c-(o*12+i);u<s&&f--;const h=Math.floor((r.getTime()-n.getTime())/(1e3*60*60*24));return{years:d,months:f,days:h}}function Z5(e,t){const{years:n,months:r,days:o}=OE(e,t);return n>=2?n.toString().padStart(3,"0")+"Y":r>=1?r.toString().padStart(3,"0")+"M":o.toString().padStart(3,"0")+"D"}function xc(e,...t){var r;let n=e;for(let o=0;o<t.length&&n;o++)n=(r=n==null?void 0:n.extension)==null?void 0:r.find(i=>i.url===t[o]);return n}function On(e,t){return JSON.stringify(e,eO,t?2:void 0)}function eO(e,t){return!tO(e)&&Yt(t)?void 0:t}function tO(e){return!!/\d+$/.exec(e)}function Yt(e){if(e==null)return!0;const t=typeof e;return t==="string"||t==="object"?!kf(e):!1}function kf(e){if(e==null)return!1;const t=typeof e;return t==="string"&&e!==""||t==="object"&&("length"in e&&e.length>0||Object.keys(e).length>0)}function wc(e,t,n){return e===t||Yt(e)&&Yt(t)?!0:Yt(e)||Yt(t)?!1:Array.isArray(e)&&Array.isArray(t)?nO(e,t):Array.isArray(e)||Array.isArray(t)?!1:Jo(e)&&Jo(t)?rO(e,t,n):(Jo(e)||Jo(t),!1)}function nO(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!wc(e[n],t[n]))return!1;return!0}function rO(e,t,n){const r=new Set;Object.keys(e).forEach(o=>r.add(o)),Object.keys(t).forEach(o=>r.add(o)),n==="meta"&&(r.delete("versionId"),r.delete("lastUpdated"),r.delete("author"));for(const o of r){const i=e[o],s=t[o];if(!wc(i,s,o))return!1}return!0}function nv(e,t){return Yt(e)?!0:Yt(t)?!1:Array.isArray(e)&&Array.isArray(t)?oO(e,t):Array.isArray(e)||Array.isArray(t)?!1:Jo(e)&&Jo(t)?iO(e,t):Jo(e)||Jo(t)?!1:e===t}function oO(e,t){return t.every(n=>e.some(r=>nv(r,n)))}function iO(e,t){return Object.entries(t).every(([n,r])=>n in e&&nv(e[n],r))}function Si(e){return JSON.parse(JSON.stringify(e))}function ME(e){return!!/^\w{8}-\w{4}-\w{4}-\w{4}-\w{12}$/i.exec(e)}function Jo(e){return e!==null&&typeof e=="object"}const LE=[];for(let e=0;e<256;e++)LE.push(e.toString(16).padStart(2,"0"));function sO(e){const t=new Uint8Array(e),n=new Array(t.length);for(let r=0;r<t.length;r++)n[r]=LE[t[r]];return n.join("")}function aO(e){const t=new Uint8Array(e),n=[];for(let r=0;r<t.length;r++)n[r]=String.fromCharCode(t[r]);return window.btoa(n.join(""))}function en(e){return e?e.charAt(0).toUpperCase()+e.substring(1):""}function lO(e,t){var n,r;return(r=(n=e.coding)==null?void 0:n.find(o=>o.system===t))==null?void 0:r.code}function cO(e){if(e)return Array.isArray(e)?e:[e]}const u1=e=>new Promise(t=>{setTimeout(t,e)});function uO(e,t,n){const r=[];for(let o=0;o<n-1;o++){let i=e.indexOf(t);i<0&&(i=e.length),r.push(e.slice(0,i)),e=e.slice(i+t.length)}return e&&r.push(e),r}function Xa(e,t){return e?(e.push(t),e):[t]}function dO(e,t){const n=[];if(e.line&&n.push(...e.line),e.city||e.state||e.postalCode){const r=[];e.city&&r.push(e.city),e.state&&r.push(e.state),e.postalCode&&r.push(e.postalCode),n.push(r.join(", "))}return e.use&&(t!=null&&t.all||t!=null&&t.use)&&n.push("["+e.use+"]"),n.join((t==null?void 0:t.lineSeparator)??", ").trim()}function Sc(e,t){const n=[];if(e.prefix&&(t==null?void 0:t.prefix)!==!1&&n.push(...e.prefix),e.given&&n.push(...e.given),e.family&&n.push(e.family),e.suffix&&(t==null?void 0:t.suffix)!==!1&&n.push(...e.suffix),e.use&&(t!=null&&t.all||t!=null&&t.use)&&n.push("["+e.use+"]"),n.length===0){const r=ql(e.text);if(r)return r}return n.join(" ").trim()}function Rf(e){return e instanceof Date&&!isNaN(e.getTime())}function fO(e,t,n){if(!e)return"";const r=new Date("2000-01-01T"+e+"Z");return Rf(r)?r.toLocaleTimeString(t,n):""}function Mn(e,t,n){if(!e)return"";const r=new Date(e);return Rf(r)?r.toLocaleString(t,n):""}function hO(e,t,n){return!e||!e.start&&!e.end?"":Mn(e.start,t,n)+" - "+Mn(e.end,t,n)}const pO={s:"every second",min:"every minute",h:"hourly",d:"daily",wk:"weekly",mo:"monthly",a:"annually"},mO={s:"second",min:"minute",h:"hour",d:"day",wk:"week",mo:"month",a:"year"},gO={s:"seconds",min:"minutes",h:"hours",d:"days",wk:"weeks",mo:"months",a:"years"};function $E(e){if(!e)return"";const t=[];return yO(t,e.repeat),e.event&&t.push(e.event.map(n=>Mn(n)).join(", ")),en(t.join(" ").trim())}function yO(e,t){if(!(t!=null&&t.periodUnit))return;const n=t.frequency??1,r=t.period??1,o=t.periodUnit;n===1&&r===1?e.push(pO[o]):(n===1?e.push("once"):e.push(n+" times"),r===1?e.push("per "+mO[o]):e.push("per "+r+" "+gO[o])),t.dayOfWeek&&e.push("on "+t.dayOfWeek.map(en).join(", ")),t.timeOfDay&&e.push("at "+t.timeOfDay.map(i=>fO(i)).join(", "))}function Wl(e,t,n=!1){if(n&&t===void 0)throw new Error("Precision must be specified for exclusive ranges");const r=(e==null?void 0:e.low)&&{...e.low,comparator:void 0},o=(e==null?void 0:e.high)&&{...e.high,comparator:void 0};return(r==null?void 0:r.value)===void 0&&(o==null?void 0:o.value)===void 0?"":(r==null?void 0:r.value)!==void 0&&(o==null?void 0:o.value)===void 0?n&&t!==void 0?(r.value=wO(r.value,t),`> ${Vo(r,t)}`):`>= ${Vo(r,t)}`:(r==null?void 0:r.value)===void 0&&(o==null?void 0:o.value)!==void 0?n&&t!==void 0?(o.value=xO(o.value,t),`< ${Vo(o,t)}`):`<= ${Vo(o,t)}`:((r==null?void 0:r.unit)===(o==null?void 0:o.unit)&&(r==null||delete r.unit),`${Vo(r,t)} - ${Vo(o,t)}`)}function Vo(e,t){if(!e)return"";const n=[];return e.comparator&&(n.push(e.comparator),n.push(" ")),e.value!==void 0&&(t!==void 0?n.push(e.value.toFixed(t)):n.push(e.value)),e.unit&&(e.unit!=="%"&&n[n.length-1]!==" "&&n.push(" "),n.push(e.unit)),n.join("").trim()}function vO(e){return(e==null?void 0:e.value)===void 0?"":e.value.toLocaleString(void 0,{style:"currency",currency:e.currency??"USD",currencyDisplay:"narrowSymbol"})}function va(e){if(!e)return"";const t=ql(e.text);return t||(e.coding?e.coding.map(n=>ms(n)).join(", "):"")}function ms(e){return ql(e==null?void 0:e.display)??ql(e==null?void 0:e.code)??""}function FE(e){if(!e)return"";if("component"in e)return e.component.map(n=>FE(n)).join(" / ");if(e.valueQuantity)return Vo(e.valueQuantity);if(e.valueCodeableConcept)return va(e.valueCodeableConcept);const t=ql(e.valueString);return t||""}function ql(e){return typeof e=="string"?e:void 0}function xO(e,t,n=1){return(zE(e,t)+n)*Math.pow(10,-t)}function wO(e,t,n=1){return(zE(e,t)-n)*Math.pow(10,-t)}function zE(e,t){return t===void 0?e:Math.round(e*Math.pow(10,t))}function SO(e,t){const n=t.max&&t.max===Number.MAX_SAFE_INTEGER?Number.POSITIVE_INFINITY:t.max;return{path:e,description:"",type:t.type??[],min:t.min??0,max:n??1,isArray:!!n&&n>1,constraints:[]}}function bO(e){const t=Object.create(null);for(const[n,r]of Object.entries(e))t[n]={name:n,elements:Object.fromEntries(Object.entries(r.elements).map(([o,i])=>[o,SO(o,i)])),constraints:[],innerTypes:[]};return t}const CO={elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]}}},jO={elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},modifierExtension:{max:9007199254740991,type:[{code:"Extension"}]}}},EO={elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},use:{type:[{code:"code"}]},type:{type:[{code:"code"}]},text:{type:[{code:"string"}]},line:{max:9007199254740991,type:[{code:"string"}]},city:{type:[{code:"string"}]},district:{type:[{code:"string"}]},state:{type:[{code:"string"}]},postalCode:{type:[{code:"string"}]},country:{type:[{code:"string"}]},period:{type:[{code:"Period"}]}}},TO={elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},value:{type:[{code:"decimal"}]},comparator:{type:[{code:"code"}]},unit:{type:[{code:"string"}]},system:{type:[{code:"uri"}]},code:{type:[{code:"code"}]}}},PO={elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},"author[x]":{type:[{code:"Reference",targetProfile:["http://hl7.org/fhir/StructureDefinition/Practitioner","http://hl7.org/fhir/StructureDefinition/Patient","http://hl7.org/fhir/StructureDefinition/RelatedPerson","http://hl7.org/fhir/StructureDefinition/Organization"]},{code:"string"}]},time:{type:[{code:"dateTime"}]},text:{min:1,type:[{code:"markdown"}]}}},kO={elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},contentType:{type:[{code:"code"}]},language:{type:[{code:"code"}]},data:{type:[{code:"base64Binary"}]},url:{type:[{code:"url"}]},size:{type:[{code:"unsignedInt"}]},hash:{type:[{code:"base64Binary"}]},title:{type:[{code:"string"}]},creation:{type:[{code:"dateTime"}]}}},RO={elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},coding:{max:9007199254740991,type:[{code:"Coding"}]},text:{type:[{code:"string"}]}}},DO={elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},system:{type:[{code:"uri"}]},version:{type:[{code:"string"}]},code:{type:[{code:"code"}]},display:{type:[{code:"string"}]},userSelected:{type:[{code:"boolean"}]}}},IO={elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},name:{type:[{code:"string"}]},telecom:{max:9007199254740991,type:[{code:"ContactPoint"}]}}},_O={elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},system:{type:[{code:"code"}]},value:{type:[{code:"string"}]},use:{type:[{code:"code"}]},rank:{type:[{code:"positiveInt"}]},period:{type:[{code:"Period"}]}}},AO={elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},type:{min:1,type:[{code:"code"}]},name:{min:1,type:[{code:"string"}]},contact:{max:9007199254740991,type:[{code:"ContactDetail"}]}}},NO={elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},value:{type:[{code:"decimal"}]},comparator:{type:[{code:"code"}]},unit:{type:[{code:"string"}]},system:{type:[{code:"uri"}]},code:{type:[{code:"code"}]}}},OO={elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},type:{min:1,type:[{code:"code"}]},profile:{max:9007199254740991,type:[{code:"canonical",targetProfile:["http://hl7.org/fhir/StructureDefinition/StructureDefinition"]}]},"subject[x]":{type:[{code:"CodeableConcept"},{code:"Reference",targetProfile:["http://hl7.org/fhir/StructureDefinition/Group"]}]},mustSupport:{max:9007199254740991,type:[{code:"string"}]},codeFilter:{max:9007199254740991,type:[{code:"DataRequirementCodeFilter"}]},dateFilter:{max:9007199254740991,type:[{code:"DataRequirementDateFilter"}]},limit:{type:[{code:"positiveInt"}]},sort:{max:9007199254740991,type:[{code:"DataRequirementSort"}]}}},MO={elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},value:{type:[{code:"decimal"}]},comparator:{type:[{code:"code"}]},unit:{type:[{code:"string"}]},system:{type:[{code:"uri"}]},code:{type:[{code:"code"}]}}},LO={elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},modifierExtension:{max:9007199254740991,type:[{code:"Extension"}]},sequence:{type:[{code:"integer"}]},text:{type:[{code:"string"}]},additionalInstruction:{max:9007199254740991,type:[{code:"CodeableConcept"}]},patientInstruction:{type:[{code:"string"}]},timing:{type:[{code:"Timing"}]},"asNeeded[x]":{type:[{code:"boolean"},{code:"CodeableConcept"}]},site:{type:[{code:"CodeableConcept"}]},route:{type:[{code:"CodeableConcept"}]},method:{type:[{code:"CodeableConcept"}]},doseAndRate:{max:9007199254740991,type:[{code:"DosageDoseAndRate"}]},maxDosePerPeriod:{type:[{code:"Ratio"}]},maxDosePerAdministration:{type:[{code:"Quantity",profile:["http://hl7.org/fhir/StructureDefinition/SimpleQuantity"]}]},maxDosePerLifetime:{type:[{code:"Quantity",profile:["http://hl7.org/fhir/StructureDefinition/SimpleQuantity"]}]}}},$O={elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},value:{type:[{code:"decimal"}]},comparator:{type:[{code:"code"}]},unit:{type:[{code:"string"}]},system:{type:[{code:"uri"}]},code:{type:[{code:"code"}]}}},FO={elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},modifierExtension:{max:9007199254740991,type:[{code:"Extension"}]},path:{min:1,type:[{code:"string"}]},representation:{max:9007199254740991,type:[{code:"code"}]},sliceName:{type:[{code:"string"}]},sliceIsConstraining:{type:[{code:"boolean"}]},label:{type:[{code:"string"}]},code:{max:9007199254740991,type:[{code:"Coding"}]},slicing:{type:[{code:"ElementDefinitionSlicing"}]},short:{type:[{code:"string"}]},definition:{type:[{code:"markdown"}]},comment:{type:[{code:"markdown"}]},requirements:{type:[{code:"markdown"}]},alias:{max:9007199254740991,type:[{code:"string"}]},min:{type:[{code:"unsignedInt"}]},max:{type:[{code:"string"}]},base:{type:[{code:"ElementDefinitionBase"}]},contentReference:{type:[{code:"uri"}]},type:{max:9007199254740991,type:[{code:"ElementDefinitionType"}]},"defaultValue[x]":{type:[{code:"base64Binary"},{code:"boolean"},{code:"canonical"},{code:"code"},{code:"date"},{code:"dateTime"},{code:"decimal"},{code:"id"},{code:"instant"},{code:"integer"},{code:"markdown"},{code:"oid"},{code:"positiveInt"},{code:"string"},{code:"time"},{code:"unsignedInt"},{code:"uri"},{code:"url"},{code:"uuid"},{code:"Address"},{code:"Age"},{code:"Annotation"},{code:"Attachment"},{code:"CodeableConcept"},{code:"Coding"},{code:"ContactPoint"},{code:"Count"},{code:"Distance"},{code:"Duration"},{code:"HumanName"},{code:"Identifier"},{code:"Money"},{code:"Period"},{code:"Quantity"},{code:"Range"},{code:"Ratio"},{code:"Reference"},{code:"SampledData"},{code:"Signature"},{code:"Timing"},{code:"ContactDetail"},{code:"Contributor"},{code:"DataRequirement"},{code:"Expression"},{code:"ParameterDefinition"},{code:"RelatedArtifact"},{code:"TriggerDefinition"},{code:"UsageContext"},{code:"Dosage"},{code:"Meta"}]},meaningWhenMissing:{type:[{code:"markdown"}]},orderMeaning:{type:[{code:"string"}]},"fixed[x]":{type:[{code:"base64Binary"},{code:"boolean"},{code:"canonical"},{code:"code"},{code:"date"},{code:"dateTime"},{code:"decimal"},{code:"id"},{code:"instant"},{code:"integer"},{code:"markdown"},{code:"oid"},{code:"positiveInt"},{code:"string"},{code:"time"},{code:"unsignedInt"},{code:"uri"},{code:"url"},{code:"uuid"},{code:"Address"},{code:"Age"},{code:"Annotation"},{code:"Attachment"},{code:"CodeableConcept"},{code:"Coding"},{code:"ContactPoint"},{code:"Count"},{code:"Distance"},{code:"Duration"},{code:"HumanName"},{code:"Identifier"},{code:"Money"},{code:"Period"},{code:"Quantity"},{code:"Range"},{code:"Ratio"},{code:"Reference"},{code:"SampledData"},{code:"Signature"},{code:"Timing"},{code:"ContactDetail"},{code:"Contributor"},{code:"DataRequirement"},{code:"Expression"},{code:"ParameterDefinition"},{code:"RelatedArtifact"},{code:"TriggerDefinition"},{code:"UsageContext"},{code:"Dosage"},{code:"Meta"}]},"pattern[x]":{type:[{code:"base64Binary"},{code:"boolean"},{code:"canonical"},{code:"code"},{code:"date"},{code:"dateTime"},{code:"decimal"},{code:"id"},{code:"instant"},{code:"integer"},{code:"markdown"},{code:"oid"},{code:"positiveInt"},{code:"string"},{code:"time"},{code:"unsignedInt"},{code:"uri"},{code:"url"},{code:"uuid"},{code:"Address"},{code:"Age"},{code:"Annotation"},{code:"Attachment"},{code:"CodeableConcept"},{code:"Coding"},{code:"ContactPoint"},{code:"Count"},{code:"Distance"},{code:"Duration"},{code:"HumanName"},{code:"Identifier"},{code:"Money"},{code:"Period"},{code:"Quantity"},{code:"Range"},{code:"Ratio"},{code:"Reference"},{code:"SampledData"},{code:"Signature"},{code:"Timing"},{code:"ContactDetail"},{code:"Contributor"},{code:"DataRequirement"},{code:"Expression"},{code:"ParameterDefinition"},{code:"RelatedArtifact"},{code:"TriggerDefinition"},{code:"UsageContext"},{code:"Dosage"},{code:"Meta"}]},example:{max:9007199254740991,type:[{code:"ElementDefinitionExample"}]},"minValue[x]":{type:[{code:"date"},{code:"dateTime"},{code:"instant"},{code:"time"},{code:"decimal"},{code:"integer"},{code:"positiveInt"},{code:"unsignedInt"},{code:"Quantity"}]},"maxValue[x]":{type:[{code:"date"},{code:"dateTime"},{code:"instant"},{code:"time"},{code:"decimal"},{code:"integer"},{code:"positiveInt"},{code:"unsignedInt"},{code:"Quantity"}]},maxLength:{type:[{code:"integer"}]},condition:{max:9007199254740991,type:[{code:"id"}]},constraint:{max:9007199254740991,type:[{code:"ElementDefinitionConstraint"}]},mustSupport:{type:[{code:"boolean"}]},isModifier:{type:[{code:"boolean"}]},isModifierReason:{type:[{code:"string"}]},isSummary:{type:[{code:"boolean"}]},binding:{type:[{code:"ElementDefinitionBinding"}]},mapping:{max:9007199254740991,type:[{code:"ElementDefinitionMapping"}]}}},zO={elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},description:{type:[{code:"string"}]},name:{type:[{code:"id"}]},language:{min:1,type:[{code:"code"}]},expression:{type:[{code:"string"}]},reference:{type:[{code:"uri"}]}}},BO={elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},url:{min:1,type:[{code:"uri"}]},"value[x]":{type:[{code:"base64Binary"},{code:"boolean"},{code:"canonical"},{code:"code"},{code:"date"},{code:"dateTime"},{code:"decimal"},{code:"id"},{code:"instant"},{code:"integer"},{code:"markdown"},{code:"oid"},{code:"positiveInt"},{code:"string"},{code:"time"},{code:"unsignedInt"},{code:"uri"},{code:"url"},{code:"uuid"},{code:"Address"},{code:"Age"},{code:"Annotation"},{code:"Attachment"},{code:"CodeableConcept"},{code:"Coding"},{code:"ContactPoint"},{code:"Count"},{code:"Distance"},{code:"Duration"},{code:"HumanName"},{code:"Identifier"},{code:"Money"},{code:"Period"},{code:"Quantity"},{code:"Range"},{code:"Ratio"},{code:"Reference"},{code:"SampledData"},{code:"Signature"},{code:"Timing"},{code:"ContactDetail"},{code:"Contributor"},{code:"DataRequirement"},{code:"Expression"},{code:"ParameterDefinition"},{code:"RelatedArtifact"},{code:"TriggerDefinition"},{code:"UsageContext"},{code:"Dosage"},{code:"Meta"}]}}},UO={elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},use:{type:[{code:"code"}]},text:{type:[{code:"string"}]},family:{type:[{code:"string"}]},given:{max:9007199254740991,type:[{code:"string"}]},prefix:{max:9007199254740991,type:[{code:"string"}]},suffix:{max:9007199254740991,type:[{code:"string"}]},period:{type:[{code:"Period"}]}}},VO={elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},use:{type:[{code:"code"}]},type:{type:[{code:"CodeableConcept"}]},system:{type:[{code:"uri"}]},value:{type:[{code:"string"}]},period:{type:[{code:"Period"}]},assigner:{type:[{code:"Reference",targetProfile:["http://hl7.org/fhir/StructureDefinition/Organization"]}]}}},HO={elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},modifierExtension:{max:9007199254740991,type:[{code:"Extension"}]},country:{min:1,type:[{code:"CodeableConcept"}]},jurisdiction:{type:[{code:"CodeableConcept"}]},status:{min:1,type:[{code:"CodeableConcept"}]},dateRange:{min:1,type:[{code:"Period"}]},restoreDate:{type:[{code:"dateTime"}]}}},WO={elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},versionId:{type:[{code:"id"}]},lastUpdated:{type:[{code:"instant"}]},source:{type:[{code:"uri"}]},profile:{max:9007199254740991,type:[{code:"canonical",targetProfile:["http://hl7.org/fhir/StructureDefinition/StructureDefinition"]}]},security:{max:9007199254740991,type:[{code:"Coding"}]},tag:{max:9007199254740991,type:[{code:"Coding"}]},project:{type:[{code:"uri"}]},author:{type:[{code:"Reference"}]},account:{type:[{code:"Reference"}]},compartment:{max:9007199254740991,type:[{code:"Reference"}]}}},qO={elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},value:{type:[{code:"decimal"}]},currency:{type:[{code:"code"}]}}},GO={elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},status:{min:1,type:[{code:"code"}]},div:{min:1,type:[{code:"xhtml"}]}}},QO={elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},name:{type:[{code:"code"}]},use:{min:1,type:[{code:"code"}]},min:{type:[{code:"integer"}]},max:{type:[{code:"string"}]},documentation:{type:[{code:"string"}]},type:{min:1,type:[{code:"code"}]},profile:{type:[{code:"canonical",targetProfile:["http://hl7.org/fhir/StructureDefinition/StructureDefinition"]}]}}},KO={elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},start:{type:[{code:"dateTime"}]},end:{type:[{code:"dateTime"}]}}},YO={elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},modifierExtension:{max:9007199254740991,type:[{code:"Extension"}]},"age[x]":{type:[{code:"Range"},{code:"CodeableConcept"}]},gender:{type:[{code:"CodeableConcept"}]},race:{type:[{code:"CodeableConcept"}]},physiologicalCondition:{type:[{code:"CodeableConcept"}]}}},XO={elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},modifierExtension:{max:9007199254740991,type:[{code:"Extension"}]},height:{type:[{code:"Quantity"}]},width:{type:[{code:"Quantity"}]},depth:{type:[{code:"Quantity"}]},weight:{type:[{code:"Quantity"}]},nominalVolume:{type:[{code:"Quantity"}]},externalDiameter:{type:[{code:"Quantity"}]},shape:{type:[{code:"string"}]},color:{max:9007199254740991,type:[{code:"string"}]},imprint:{max:9007199254740991,type:[{code:"string"}]},image:{max:9007199254740991,type:[{code:"Attachment"}]},scoring:{type:[{code:"CodeableConcept"}]}}},JO={elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},modifierExtension:{max:9007199254740991,type:[{code:"Extension"}]},identifier:{type:[{code:"Identifier"}]},type:{min:1,type:[{code:"CodeableConcept"}]},period:{min:1,type:[{code:"Quantity"}]},specialPrecautionsForStorage:{max:9007199254740991,type:[{code:"CodeableConcept"}]}}},ZO={elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},value:{type:[{code:"decimal"}]},comparator:{type:[{code:"code"}]},unit:{type:[{code:"string"}]},system:{type:[{code:"uri"}]},code:{type:[{code:"code"}]}}},eM={elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},low:{type:[{code:"Quantity",profile:["http://hl7.org/fhir/StructureDefinition/SimpleQuantity"]}]},high:{type:[{code:"Quantity",profile:["http://hl7.org/fhir/StructureDefinition/SimpleQuantity"]}]}}},tM={elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},numerator:{type:[{code:"Quantity"}]},denominator:{type:[{code:"Quantity"}]}}},nM={elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},reference:{type:[{code:"string"}]},type:{type:[{code:"uri"}]},identifier:{type:[{code:"Identifier"}]},display:{type:[{code:"string"}]}}},rM={elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},type:{min:1,type:[{code:"code"}]},label:{type:[{code:"string"}]},display:{type:[{code:"string"}]},citation:{type:[{code:"markdown"}]},url:{type:[{code:"url"}]},document:{type:[{code:"Attachment"}]},resource:{type:[{code:"canonical",targetProfile:["http://hl7.org/fhir/StructureDefinition/Resource"]}]}}},oM={elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},origin:{min:1,type:[{code:"Quantity",profile:["http://hl7.org/fhir/StructureDefinition/SimpleQuantity"]}]},period:{min:1,type:[{code:"decimal"}]},factor:{type:[{code:"decimal"}]},lowerLimit:{type:[{code:"decimal"}]},upperLimit:{type:[{code:"decimal"}]},dimensions:{min:1,type:[{code:"positiveInt"}]},data:{type:[{code:"string"}]}}},iM={elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},type:{min:1,max:9007199254740991,type:[{code:"Coding"}]},when:{min:1,type:[{code:"instant"}]},who:{min:1,type:[{code:"Reference",targetProfile:["http://hl7.org/fhir/StructureDefinition/Practitioner","http://hl7.org/fhir/StructureDefinition/PractitionerRole","http://hl7.org/fhir/StructureDefinition/RelatedPerson","http://hl7.org/fhir/StructureDefinition/Patient","http://hl7.org/fhir/StructureDefinition/Device","http://hl7.org/fhir/StructureDefinition/Organization"]}]},onBehalfOf:{type:[{code:"Reference",targetProfile:["http://hl7.org/fhir/StructureDefinition/Practitioner","http://hl7.org/fhir/StructureDefinition/PractitionerRole","http://hl7.org/fhir/StructureDefinition/RelatedPerson","http://hl7.org/fhir/StructureDefinition/Patient","http://hl7.org/fhir/StructureDefinition/Device","http://hl7.org/fhir/StructureDefinition/Organization"]}]},targetFormat:{type:[{code:"code"}]},sigFormat:{type:[{code:"code"}]},data:{type:[{code:"base64Binary"}]}}},sM={elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},modifierExtension:{max:9007199254740991,type:[{code:"Extension"}]},"amount[x]":{type:[{code:"Quantity"},{code:"Range"},{code:"string"}]},amountType:{type:[{code:"CodeableConcept"}]},amountText:{type:[{code:"string"}]},referenceRange:{type:[{code:"SubstanceAmountReferenceRange"}]}}},aM={elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},modifierExtension:{max:9007199254740991,type:[{code:"Extension"}]},event:{max:9007199254740991,type:[{code:"dateTime"}]},repeat:{type:[{code:"TimingRepeat"}]},code:{type:[{code:"CodeableConcept"}]}}},lM={elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},type:{min:1,type:[{code:"code"}]},name:{type:[{code:"string"}]},"timing[x]":{type:[{code:"Timing"},{code:"Reference",targetProfile:["http://hl7.org/fhir/StructureDefinition/Schedule"]},{code:"date"},{code:"dateTime"}]},data:{max:9007199254740991,type:[{code:"DataRequirement"}]},condition:{type:[{code:"Expression"}]}}},cM={elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},code:{min:1,type:[{code:"Coding"}]},"value[x]":{min:1,type:[{code:"CodeableConcept"},{code:"Quantity"},{code:"Range"},{code:"Reference",targetProfile:["http://hl7.org/fhir/StructureDefinition/PlanDefinition","http://hl7.org/fhir/StructureDefinition/ResearchStudy","http://hl7.org/fhir/StructureDefinition/InsurancePlan","http://hl7.org/fhir/StructureDefinition/HealthcareService","http://hl7.org/fhir/StructureDefinition/Group","http://hl7.org/fhir/StructureDefinition/Location","http://hl7.org/fhir/StructureDefinition/Organization"]}]}}},uM={elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},value:{type:[{code:"decimal"}]},comparator:{type:[{code:"code"}]},unit:{type:[{code:"string"}]},system:{type:[{code:"uri"}]},code:{type:[{code:"code"}]}}},dM={elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},value:{type:[{code:"decimal"}]},comparator:{max:0,type:[{code:"code"}]},unit:{type:[{code:"string"}]},system:{type:[{code:"uri"}]},code:{type:[{code:"code"}]}}},fM={elements:{id:{type:[{code:"string"}]},meta:{type:[{code:"Meta"}]},implicitRules:{type:[{code:"uri"}]},language:{type:[{code:"code"}]},text:{type:[{code:"Narrative"}]},contained:{max:9007199254740991,type:[{code:"Resource"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},modifierExtension:{max:9007199254740991,type:[{code:"Extension"}]},url:{type:[{code:"uri"}]},version:{type:[{code:"string"}]},name:{type:[{code:"string"}]},title:{type:[{code:"string"}]},status:{min:1,type:[{code:"code"}]},experimental:{type:[{code:"boolean"}]},date:{type:[{code:"dateTime"}]},publisher:{type:[{code:"string"}]},contact:{max:9007199254740991,type:[{code:"ContactDetail"}]},description:{type:[{code:"markdown"}]},useContext:{max:9007199254740991,type:[{code:"UsageContext"}]},jurisdiction:{max:9007199254740991,type:[{code:"CodeableConcept"}]}}},hM={elements:{authorizeUrl:{min:1,type:[{code:"string"}]},tokenUrl:{min:1,type:[{code:"string"}]},tokenAuthMethod:{type:[{code:"code"}]},userInfoUrl:{min:1,type:[{code:"string"}]},clientId:{min:1,type:[{code:"string"}]},clientSecret:{min:1,type:[{code:"string"}]},usePkce:{type:[{code:"boolean"}]},useSubject:{type:[{code:"boolean"}]}}},pM={Element:CO,BackboneElement:jO,Address:EO,Age:TO,Annotation:PO,Attachment:kO,CodeableConcept:RO,Coding:DO,ContactDetail:IO,ContactPoint:_O,Contributor:AO,Count:NO,DataRequirement:OO,Distance:MO,Dosage:LO,Duration:$O,ElementDefinition:FO,Expression:zO,Extension:BO,HumanName:UO,Identifier:VO,MarketingStatus:HO,Meta:WO,Money:qO,Narrative:GO,ParameterDefinition:QO,Period:KO,Population:YO,ProdCharacteristic:XO,ProductShelfLife:JO,Quantity:ZO,Range:eM,Ratio:tM,Reference:nM,RelatedArtifact:rM,SampledData:oM,Signature:iM,SubstanceAmount:sM,Timing:aM,TriggerDefinition:lM,UsageContext:cM,MoneyQuantity:uM,SimpleQuantity:dM,MetadataResource:fM,IdentityProvider:hM};function ge(e){return[{type:U.boolean,value:e}]}function eo(e){return e==null?{type:"undefined",value:void 0}:Number.isSafeInteger(e)?{type:U.integer,value:e}:typeof e=="number"?{type:U.decimal,value:e}:typeof e=="boolean"?{type:U.boolean,value:e}:typeof e=="string"?{type:U.string,value:e}:sr(e)?{type:U.Quantity,value:e}:Io(e)?{type:e.resourceType,value:e}:{type:U.BackboneElement,value:e}}function Zo(e){return e.length===0?!1:!!e[0].value}function wo(e,t){if(e.length!==0){if(e.length===1&&(!t||e[0].type===t))return e[0];throw new Error(`Expected singleton of type ${t}, but found ${JSON.stringify(e)}`)}}function gn(e,t){if(!e.value)return;const n=gs(e.type,t);return n?rv(e.value,t,n):mM(e,t)}function rv(e,t,n){const r=n.type;if(!r||r.length===0)return;let o,i="undefined",s;if(n.path.endsWith("[x]")){const l=n.path.split(".").pop().replace("[x]","");for(const c of r){const u=l+en(c.code);if(o=e[u],s=e["_"+u],o!==void 0||s!==void 0){i=c.code;break}}}else console.assert(r.length===1,"Expected single type",n.path),o=e[t],i=r[0].code,s=e["_"+t];if(s)if(Array.isArray(o))for(let l=0;l<Math.max(o.length,s.length);l++)o[l]=p1(o[l],s[l]);else o=p1(o,s);if(!Yt(o))return(i==="Element"||i==="BackboneElement")&&(i=n.type[0].code),Array.isArray(o)?o.map(l=>d1(l,i)):d1(o,i)}function d1(e,t){return t==="Resource"&&Io(e)&&(t=e.resourceType),{type:t,value:e}}function mM(e,t){const n=e.value;if(!n||typeof n!="object")return;let r;if(t in n)r=n[t];else for(const o in U){const i=t+en(o);if(i in n){r=n[i];break}}if(!Yt(r))return Array.isArray(r)?r.map(eo):eo(r)}function BE(e){const t=[];for(const n of e){let r=!1;for(const o of t)if(Zo(HE(n,o))){r=!0;break}r||t.push(n)}return t}function UE(e){return ge(!Zo(e))}function VE(e,t){return e.length===0||t.length===0?[]:e.length!==t.length?ge(!1):ge(e.every((n,r)=>Zo(HE(n,t[r]))))}function HE(e,t){var o,i;const n=(o=e.value)==null?void 0:o.valueOf(),r=(i=t.value)==null?void 0:i.valueOf();return typeof n=="number"&&typeof r=="number"?ge(Math.abs(n-r)<1e-8):sr(n)&&sr(r)?ge(GE(n,r)):ge(typeof n=="object"&&typeof r=="object"?ov(e,t):n===r)}function WE(e,t){return e.length===0&&t.length===0?ge(!0):e.length!==t.length?ge(!1):(e.sort(f1),t.sort(f1),ge(e.every((n,r)=>Zo(gM(n,t[r])))))}function gM(e,t){const{type:n,value:r}=e,{type:o,value:i}=t,s=r==null?void 0:r.valueOf(),l=i==null?void 0:i.valueOf();return typeof s=="number"&&typeof l=="number"?ge(Math.abs(s-l)<.01):sr(s)&&sr(l)?ge(GE(s,l)):ge(n==="Coding"&&o==="Coding"?typeof s!="object"||typeof l!="object"?!1:s.code===l.code&&s.system===l.system:typeof s=="object"&&typeof l=="object"?ov({...s,id:void 0},{...l,id:void 0}):typeof s=="string"&&typeof l=="string"?s.toLowerCase()===l.toLowerCase():s===l)}function f1(e,t){var o,i;const n=(o=e.value)==null?void 0:o.valueOf(),r=(i=t.value)==null?void 0:i.valueOf();return typeof n=="number"&&typeof r=="number"?n-r:typeof n=="string"&&typeof r=="string"?n.localeCompare(r):0}function qE(e,t){const{value:n}=e;if(n==null)return!1;switch(t){case"Boolean":return typeof n=="boolean";case"Decimal":case"Integer":return typeof n=="number";case"Date":return typeof n=="string"&&!!/^\d{4}(-\d{2}(-\d{2})?)?/.exec(n);case"DateTime":return typeof n=="string"&&!!/^\d{4}(-\d{2}(-\d{2})?)?T/.exec(n);case"Time":return typeof n=="string"&&!!/^T\d/.exec(n);case"Period":return yM(n);case"Quantity":return sr(n);default:return typeof n=="object"&&(n==null?void 0:n.resourceType)===t}}function yM(e){return!!(e&&typeof e=="object"&&"start"in e)}function sr(e){return!!(e&&typeof e=="object"&&"value"in e&&typeof e.value=="number")}function GE(e,t){return Math.abs(e.value-t.value)<.01&&(e.unit===t.unit||e.code===t.code||e.unit===t.code||e.code===t.unit)}function ov(e,t){const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(const o of n){const i=e[o],s=t[o];if(h1(i)&&h1(s)){if(!ov(i,s))return!1}else if(i!==s)return!1}return!0}function h1(e){return e!==null&&typeof e=="object"}function p1(e,t){if(t){if(typeof t!="object")throw new Error("Primitive extension must be an object");return vM(e??{},t)}return e}function vM(e,t){return delete t.__proto__,delete t.constructor,Object.assign(e,t)}function xM(e){return new bM(e).parse()}const QE=bO(pM),iv=Object.create(null),m1=Object.create(null);function sv(e){let t;return e?(t=m1[e],t||(t=m1[e]=Object.create(null))):t=QE,t}function g1(e,t){var r;const n=Array.isArray(e)?e:((r=e.entry)==null?void 0:r.map(o=>o.resource))??[];for(const o of n)wM(o,t)}function wM(e,t){if(!(e!=null&&e.name))throw new Error("Failed loading StructureDefinition from bundle");if(e.resourceType!=="StructureDefinition")return;const n=xM(e),r=sv(t);r[e.name]=n,t&&e.url===t&&(iv[t]=n);for(const o of n.innerTypes)o.parentType=n,r[o.name]=o}function KE(e){return!!QE[e]}function av(e,t){return sv(t)[e]}function SM(e,t){const n=sv(t)[e];if(!n)throw new He(li("Unknown data type: "+e));return n}function YE(e){return!!iv[e]}function Df(e){return iv[e]}class bM{constructor(t){var n;if(!((n=t.snapshot)!=null&&n.element)||t.snapshot.element.length===0)throw new Error(`No snapshot defined for StructureDefinition '${t.name}'`);this.root=t.snapshot.element[0],this.elements=t.snapshot.element.slice(1),this.elementIndex=Object.create(null),this.index=0,this.resourceSchema={name:t.name,title:t.title,type:t.type,url:t.url,kind:t.kind,description:EM(t),elements:{},constraints:this.parseElementDefinition(this.root).constraints,innerTypes:[],summaryProperties:new Set,mandatoryProperties:new Set},this.innerTypes=[]}parse(){var n,r,o,i,s;let t=this.next();for(;t;){if(t.sliceName)this.parseSliceStart(t);else if((n=t.id)!=null&&n.includes(":")){if((r=this.slicingContext)!=null&&r.current){const l=Vh(t,this.slicingContext.path);this.slicingContext.current.elements[l]=this.parseElementDefinition(t)}}else{const l=this.parseElementDefinition(t);this.checkFieldEnter(t,l);let c=this.backboneContext;for(;c;){if((o=t.path)!=null&&o.startsWith(c.path+".")){c.type.elements[Vh(t,c.path)]=l;break}c=c.parent}if(!c){const u=Vh(t,this.root.path);t.isSummary&&((i=this.resourceSchema.summaryProperties)==null||i.add(u.replace("[x]",""))),l.min>0&&((s=this.resourceSchema.mandatoryProperties)==null||s.add(u.replace("[x]",""))),this.resourceSchema.elements[u]=l}this.checkFieldExit(t)}t=this.next()}return this.checkFieldExit(),this.innerTypes.length>0&&(this.resourceSchema.innerTypes=this.innerTypes),this.resourceSchema}checkFieldEnter(t,n){this.isInnerType(t)&&this.enterInnerType(t),t.slicing&&!this.slicingContext&&this.enterSlice(t,n)}enterInnerType(t){var n,r,o;for(;this.backboneContext&&!ks((n=this.backboneContext)==null?void 0:n.path,t.path);)this.innerTypes.push(this.backboneContext.type),this.backboneContext=this.backboneContext.parent;this.backboneContext={type:{name:x1(t),title:t.label,description:t.definition,elements:{},constraints:this.parseElementDefinition(t).constraints,innerTypes:[]},path:t.path??"",parent:ks((r=this.backboneContext)==null?void 0:r.path,t.path)?this.backboneContext:(o=this.backboneContext)==null?void 0:o.parent}}enterSlice(t,n){var r,o,i,s;jM(t)&&!((r=this.peek())!=null&&r.sliceName)||(n.slicing={discriminator:(((o=t.slicing)==null?void 0:o.discriminator)??[]).map(l=>{if(l.type!=="value"&&l.type!=="pattern"&&l.type!=="type")throw new Error(`Unsupported slicing discriminator type: ${l.type}`);return{path:l.path,type:l.type}}),slices:[],ordered:((i=t.slicing)==null?void 0:i.ordered)??!1,rule:(s=t.slicing)==null?void 0:s.rules},this.slicingContext={field:n.slicing,path:t.path??""})}checkFieldExit(t=void 0){var n;if(this.backboneContext&&!ks(this.backboneContext.path,t==null?void 0:t.path))if(this.backboneContext.parent)do this.innerTypes.push(this.backboneContext.type),this.backboneContext=this.backboneContext.parent;while(this.backboneContext&&!ks(this.backboneContext.path,t==null?void 0:t.path));else this.innerTypes.push(this.backboneContext.type),delete this.backboneContext;this.slicingContext&&!ks(this.slicingContext.path,t==null?void 0:t.path)&&((n=this.slicingContext)!=null&&n.current&&this.slicingContext.field.slices.push(this.slicingContext.current),delete this.slicingContext)}next(){const t=this.peek();if(t)return this.index++,t}peek(){const t=this.elements[this.index];if(t){if(this.elementIndex[t.path??""]=t,t.contentReference){const n=this.elementIndex[t.contentReference.slice(t.contentReference.indexOf("#")+1)];return n?{...n,id:t.id,path:t.path,min:t.min??n.min,max:t.max??n.max,contentReference:t.contentReference,definition:t.definition}:void 0}return t}}isInnerType(t){var r;const n=this.peek();return!!(ks(t==null?void 0:t.path,n==null?void 0:n.path)&&((r=t.type)!=null&&r.some(o=>["BackboneElement","Element"].includes(o.code))))}parseSliceStart(t){if(!this.slicingContext)throw new Error(`Invalid slice start before discriminator: ${t.sliceName} (${t.id})`);this.slicingContext.current&&this.slicingContext.field.slices.push(this.slicingContext.current),this.slicingContext.current={name:t.sliceName??"",path:t.path??"",definition:t.definition,type:this.parseElementDefinitionType(t),elements:{},min:t.min??0,max:t.max==="*"?Number.POSITIVE_INFINITY:Number.parseInt(t.max,10)}}parseElementDefinitionType(t){return(t.type??[]).map(n=>{var o;let r;return(n.code==="BackboneElement"||n.code==="Element")&&(r=x1(t)),r||(r=(o=xc(n,"http://hl7.org/fhir/StructureDefinition/structuredefinition-fhir-type"))==null?void 0:o.valueUrl),r||(r=n.code??""),{code:r,targetProfile:n.targetProfile,profile:n.profile}})}parseElementDefinition(t){var i,s;const n=y1(t.max),r=(i=t.base)!=null&&i.max?y1(t.base.max):n,o={type:"ElementDefinition",value:t};return{description:t.definition||"",path:t.path||((s=t.base)==null?void 0:s.path)||"",min:t.min??0,max:n,isArray:r>1,constraints:(t.constraint??[]).map(l=>({key:l.key??"",severity:l.severity??"error",expression:l.expression??"",description:l.human??""})),type:this.parseElementDefinitionType(t),fixed:v1(gn(o,"fixed[x]")),pattern:v1(gn(o,"pattern[x]")),binding:t.binding}}}function y1(e){return e==="*"?Number.POSITIVE_INFINITY:Number.parseInt(e,10)}function Vh(e,t=""){return CM(e.path,t)}function CM(e,t){return e?t&&e.startsWith(t)?e.substring(t.length+1):e:""}function ks(e,t){return!e||!t?!1:t.startsWith(e+".")||t===e}function v1(e){return Array.isArray(e)&&e.length>0?e[0]:Yt(e)?void 0:e}function jM(e){var n,r;const t=(n=e.slicing)==null?void 0:n.discriminator;return!!((r=e.type)!=null&&r.some(o=>o.code==="Extension")&&(t==null?void 0:t.length)===1&&t[0].type==="value"&&t[0].path==="url")}function EM(e){let t=e.description;return t!=null&&t.startsWith(`Base StructureDefinition for ${e.name} Type: `)&&(t=t.substring(`Base StructureDefinition for ${e.name} Type: `.length)),t}const U={Address:"Address",Age:"Age",Annotation:"Annotation",Attachment:"Attachment",BackboneElement:"BackboneElement",CodeableConcept:"CodeableConcept",Coding:"Coding",ContactDetail:"ContactDetail",ContactPoint:"ContactPoint",Contributor:"Contributor",Count:"Count",DataRequirement:"DataRequirement",Distance:"Distance",Dosage:"Dosage",Duration:"Duration",Expression:"Expression",Extension:"Extension",HumanName:"HumanName",Identifier:"Identifier",MarketingStatus:"MarketingStatus",Meta:"Meta",Money:"Money",Narrative:"Narrative",ParameterDefinition:"ParameterDefinition",Period:"Period",Population:"Population",ProdCharacteristic:"ProdCharacteristic",ProductShelfLife:"ProductShelfLife",Quantity:"Quantity",Range:"Range",Ratio:"Ratio",Reference:"Reference",RelatedArtifact:"RelatedArtifact",SampledData:"SampledData",Signature:"Signature",SubstanceAmount:"SubstanceAmount",SystemString:"http://hl7.org/fhirpath/System.String",Timing:"Timing",TriggerDefinition:"TriggerDefinition",UsageContext:"UsageContext",base64Binary:"base64Binary",boolean:"boolean",canonical:"canonical",code:"code",date:"date",dateTime:"dateTime",decimal:"decimal",id:"id",instant:"instant",integer:"integer",markdown:"markdown",oid:"oid",positiveInt:"positiveInt",string:"string",time:"time",unsignedInt:"unsignedInt",uri:"uri",url:"url",uuid:"uuid"};function TM(e){for(const t of e.base??[]){let n=pi.types[t];n||(n={searchParamsDetails:{}},pi.types[t]=n),n.searchParams||(n.searchParams={_id:{base:[t],code:"_id",type:"token",expression:t+".id"},_lastUpdated:{base:[t],code:"_lastUpdated",type:"date",expression:t+".meta.lastUpdated"},_compartment:{base:[t],code:"_compartment",type:"reference",expression:t+".meta.compartment"},_profile:{base:[t],code:"_profile",type:"uri",expression:t+".meta.profile"},_security:{base:[t],code:"_security",type:"token",expression:t+".meta.security"},_source:{base:[t],code:"_source",type:"uri",expression:t+".meta.source"},_tag:{base:[t],code:"_tag",type:"token",expression:t+".meta.tag"}}),n.searchParams[e.code]=e}}function x1(e){var n,r,o,i;const t=(r=(n=e.type)==null?void 0:n[0])==null?void 0:r.code;return t==="BackboneElement"||t==="Element"?PM((i=((o=e.base)==null?void 0:o.path)??e.path)==null?void 0:i.split(".")):t}function PM(e){return e.length===1?e[0]:e.map(en).join("")}function lv(e){var t;return(t=pi.types[e])==null?void 0:t.searchParams}function kM(e,t){var n,r;return(r=(n=pi.types[e])==null?void 0:n.searchParams)==null?void 0:r[t]}function md(e){const t=e.replaceAll("[x]","").split(".").pop();return XE(t)}function XE(e){let t;return e.length<100?t=e.match(/[A-Z]+(?![a-z])|[A-Z]?[a-z]+|\d+/g)??[]:t=e.split(/(?=[A-Z])/),t.map(DM).join(" ").replace("_"," ").replace(/\s+/g," ")}const RM=new Set(["ID","IP","PKCE","JWKS","URI","URL","OMB","UDI"]);function DM(e){const t=e.toUpperCase();return e===t?e:RM.has(t)?t:t.charAt(0)+e.slice(1)}function gs(e,t){const n=av(e);if(n)return JE(n.elements,t)}function JE(e,t){const n=e[t]??e[t+"[x]"];if(n)return n;for(let r=0;r<t.length;r++){const o=t[r];if(o>="A"&&o<="Z"){const i=t.slice(0,r)+"[x]",s=e[i];if(s)return s}}}function Io(e){return!!(e&&typeof e=="object"&&"resourceType"in e)}function ys(e){return!!(e&&typeof e=="object"&&"reference"in e)}const pi={types:{}};function _u(e){if(e.startsWith("T"))return e+"T00:00:00.000Z".substring(e.length);if(e.length<=10)return e;try{return new Date(e).toISOString()}catch{return e}}const Ja=()=>[],En={empty:(e,t)=>ge(t.length===0),hasValue:(e,t)=>ge(t.length!==0),exists:(e,t,n)=>ge(n?t.filter(r=>Zo(n.eval(e,[r]))).length>0:t.length>0),all:(e,t,n)=>ge(t.every(r=>Zo(n.eval(e,[r])))),allTrue:(e,t)=>{for(const n of t)if(!n.value)return ge(!1);return ge(!0)},anyTrue:(e,t)=>{for(const n of t)if(n.value)return ge(!0);return ge(!1)},allFalse:(e,t)=>{for(const n of t)if(n.value)return ge(!1);return ge(!0)},anyFalse:(e,t)=>{for(const n of t)if(!n.value)return ge(!0);return ge(!1)},subsetOf:Ja,supersetOf:Ja,count:(e,t)=>[{type:U.integer,value:t.length}],distinct:(e,t)=>{const n=[];for(const r of t)n.some(o=>o.value===r.value)||n.push(r);return n},isDistinct:(e,t)=>ge(t.length===En.distinct(e,t).length),where:(e,t,n)=>t.filter(r=>Zo(n.eval(e,[r]))),select:(e,t,n)=>t.map(r=>n.eval(e,[r])).flat(),repeat:Ja,ofType:(e,t,n)=>t.filter(r=>r.type===n.name),single:(e,t)=>{if(t.length>1)throw new Error("Expected input length one for single()");return t.length===0?[]:t.slice(0,1)},first:(e,t)=>t.length===0?[]:t.slice(0,1),last:(e,t)=>t.length===0?[]:t.slice(t.length-1,t.length),tail:(e,t)=>t.length===0?[]:t.slice(1,t.length),skip:(e,t,n)=>{var o;const r=(o=n.eval(e,t)[0])==null?void 0:o.value;if(typeof r!="number")throw new Error("Expected a number for skip(num)");return r>=t.length?[]:r<=0?t:t.slice(r,t.length)},take:(e,t,n)=>{var o;const r=(o=n.eval(e,t)[0])==null?void 0:o.value;if(typeof r!="number")throw new Error("Expected a number for take(num)");return r>=t.length?t:r<=0?[]:t.slice(0,r)},intersect:(e,t,n)=>{if(!n)return t;const r=n.eval(e,t),o=[];for(const i of t)!o.some(s=>s.value===i.value)&&r.some(s=>s.value===i.value)&&o.push(i);return o},exclude:(e,t,n)=>{if(!n)return t;const r=n.eval(e,t),o=[];for(const i of t)r.some(s=>s.value===i.value)||o.push(i);return o},union:(e,t,n)=>{if(!n)return t;const r=n.eval(e,t);return BE([...t,...r])},combine:(e,t,n)=>{if(!n)return t;const r=n.eval(e,t);return[...t,...r]},htmlChecks:(e,t,n)=>[eo(!0)],iif:(e,t,n,r,o)=>{const i=n.eval(e,t);if(i.length>1||i.length===1&&typeof i[0].value!="boolean")throw new Error("Expected criterion to evaluate to a Boolean");return Zo(i)?r.eval(e,t):o?o.eval(e,t):[]},toBoolean:(e,t)=>{if(t.length===0)return[];const[{value:n}]=Vr(t,1);if(typeof n=="boolean")return[{type:U.boolean,value:n}];if(typeof n=="number"&&(n===0||n===1))return ge(!!n);if(typeof n=="string"){const r=n.toLowerCase();if(["true","t","yes","y","1","1.0"].includes(r))return ge(!0);if(["false","f","no","n","0","0.0"].includes(r))return ge(!1)}return[]},convertsToBoolean:(e,t)=>t.length===0?[]:ge(En.toBoolean(e,t).length===1),toInteger:(e,t)=>{if(t.length===0)return[];const[{value:n}]=Vr(t,1);return typeof n=="number"?[{type:U.integer,value:n}]:typeof n=="string"&&/^[+-]?\d+$/.exec(n)?[{type:U.integer,value:parseInt(n,10)}]:typeof n=="boolean"?[{type:U.integer,value:n?1:0}]:[]},convertsToInteger:(e,t)=>t.length===0?[]:ge(En.toInteger(e,t).length===1),toDate:(e,t)=>{if(t.length===0)return[];const[{value:n}]=Vr(t,1);return typeof n=="string"&&/^\d{4}(-\d{2}(-\d{2})?)?/.exec(n)?[{type:U.date,value:_u(n)}]:[]},convertsToDate:(e,t)=>t.length===0?[]:ge(En.toDate(e,t).length===1),toDateTime:(e,t)=>{if(t.length===0)return[];const[{value:n}]=Vr(t,1);return typeof n=="string"&&/^\d{4}(-\d{2}(-\d{2})?)?/.exec(n)?[{type:U.dateTime,value:_u(n)}]:[]},convertsToDateTime:(e,t)=>t.length===0?[]:ge(En.toDateTime(e,t).length===1),toDecimal:(e,t)=>{if(t.length===0)return[];const[{value:n}]=Vr(t,1);return typeof n=="number"?[{type:U.decimal,value:n}]:typeof n=="string"&&/^-?\d{1,9}(\.\d{1,9})?$/.exec(n)?[{type:U.decimal,value:parseFloat(n)}]:typeof n=="boolean"?[{type:U.decimal,value:n?1:0}]:[]},convertsToDecimal:(e,t)=>t.length===0?[]:ge(En.toDecimal(e,t).length===1),toQuantity:(e,t)=>{if(t.length===0)return[];const[{value:n}]=Vr(t,1);return sr(n)?[{type:U.Quantity,value:n}]:typeof n=="number"?[{type:U.Quantity,value:{value:n,unit:"1"}}]:typeof n=="string"&&/^-?\d{1,9}(\.\d{1,9})?/.exec(n)?[{type:U.Quantity,value:{value:parseFloat(n),unit:"1"}}]:typeof n=="boolean"?[{type:U.Quantity,value:{value:n?1:0,unit:"1"}}]:[]},convertsToQuantity:(e,t)=>t.length===0?[]:ge(En.toQuantity(e,t).length===1),toString:(e,t)=>{if(t.length===0)return[];const[{value:n}]=Vr(t,1);return n==null?[]:sr(n)?[{type:U.string,value:`${n.value} '${n.unit}'`}]:[{type:U.string,value:n.toString()}]},convertsToString:(e,t)=>t.length===0?[]:ge(En.toString(e,t).length===1),toTime:(e,t)=>{if(t.length===0)return[];const[{value:n}]=Vr(t,1);if(typeof n=="string"){const r=/^T?(\d{2}(:\d{2}(:\d{2})?)?)/.exec(n);if(r)return[{type:U.time,value:_u("T"+r[1])}]}return[]},convertsToTime:(e,t)=>t.length===0?[]:ge(En.toTime(e,t).length===1),indexOf:(e,t,n)=>Zn((r,o)=>r.indexOf(o),e,t,n),substring:(e,t,n,r)=>Zn((o,i,s)=>{const l=i,c=s?l+s:o.length;return l<0||l>=o.length?void 0:o.substring(l,c)},e,t,n,r),startsWith:(e,t,n)=>Zn((r,o)=>r.startsWith(o),e,t,n),endsWith:(e,t,n)=>Zn((r,o)=>r.endsWith(o),e,t,n),contains:(e,t,n)=>Zn((r,o)=>r.includes(o),e,t,n),upper:(e,t)=>Zn(n=>n.toUpperCase(),e,t),lower:(e,t)=>Zn(n=>n.toLowerCase(),e,t),replace:(e,t,n,r)=>Zn((o,i,s)=>o.replaceAll(i,s),e,t,n,r),matches:(e,t,n)=>Zn((r,o)=>!!new RegExp(o).exec(r),e,t,n),replaceMatches:(e,t,n,r)=>Zn((o,i,s)=>o.replaceAll(i,s),e,t,n,r),length:(e,t)=>Zn(n=>n.length,e,t),toChars:(e,t)=>Zn(n=>n?n.split(""):void 0,e,t),abs:(e,t)=>zr(Math.abs,e,t),ceiling:(e,t)=>zr(Math.ceil,e,t),exp:(e,t)=>zr(Math.exp,e,t),floor:(e,t)=>zr(Math.floor,e,t),ln:(e,t)=>zr(Math.log,e,t),log:(e,t,n)=>zr((r,o)=>Math.log(r)/Math.log(o),e,t,n),power:(e,t,n)=>zr(Math.pow,e,t,n),round:(e,t)=>zr(Math.round,e,t),sqrt:(e,t)=>zr(Math.sqrt,e,t),truncate:(e,t)=>zr(n=>n|0,e,t),children:Ja,descendants:Ja,trace:(e,t,n)=>t,now:()=>[{type:U.dateTime,value:new Date().toISOString()}],timeOfDay:()=>[{type:U.time,value:new Date().toISOString().substring(11)}],today:()=>[{type:U.date,value:new Date().toISOString().substring(0,10)}],between:(e,t,n,r,o)=>{var u;const i=En.toDateTime(e,n.eval(e,t));if(i.length===0)throw new Error("Invalid start date");const s=En.toDateTime(e,r.eval(e,t));if(s.length===0)throw new Error("Invalid end date");const l=(u=o.eval(e,t)[0])==null?void 0:u.value;if(l!=="years"&&l!=="months"&&l!=="days")throw new Error("Invalid units");const c=OE(i[0].value,s[0].value);return[{type:U.Quantity,value:{value:c[l],unit:l}}]},is:(e,t,n)=>{let r="";return n instanceof cv?r=n.name:n instanceof dv&&(r=n.left.name+"."+n.right.name),r?t.map(o=>({type:U.boolean,value:qE(o,r)})):[]},not:(e,t)=>En.toBoolean(e,t).map(n=>({type:U.boolean,value:!n.value})),resolve:(e,t)=>t.map(n=>{const r=n.value;let o;if(typeof r=="string")o=r;else if(typeof r=="object"){const i=r;if(i.resource)return eo(i.resource);i.reference?o=i.reference:i.type&&i.identifier&&(o=`${i.type}?identifier=${i.identifier.system}|${i.identifier.value}`)}if(o!=null&&o.includes("?")){const[i]=o.split("?");return{type:i,value:{resourceType:i}}}if(o!=null&&o.includes("/")){const[i,s]=o.split("/");return{type:i,value:{resourceType:i,id:s}}}return{type:U.BackboneElement,value:void 0}}).filter(n=>!!n.value),as:(e,t)=>t,type:(e,t)=>t.map(({value:n})=>typeof n=="boolean"?{type:U.BackboneElement,value:{namespace:"System",name:"Boolean"}}:typeof n=="number"?{type:U.BackboneElement,value:{namespace:"System",name:"Integer"}}:Io(n)?{type:U.BackboneElement,value:{namespace:"FHIR",name:n.resourceType}}:{type:U.BackboneElement,value:null}),conformsTo:(e,t,n)=>{const r=n.eval(e,t)[0].value;if(!r.startsWith("http://hl7.org/fhir/StructureDefinition/"))throw new Error("Expected a StructureDefinition URL");const o=r.replace("http://hl7.org/fhir/StructureDefinition/","");return t.map(i=>{var s;return{type:U.boolean,value:((s=i.value)==null?void 0:s.resourceType)===o}})}};function Zn(e,t,n,...r){if(n.length===0)return[];const[{value:o}]=Vr(n,1);if(typeof o!="string")throw new Error("String function cannot be called with non-string");const i=e(o,...r.map(s=>{var l;return(l=s==null?void 0:s.eval(t,n)[0])==null?void 0:l.value}));return i===void 0?[]:Array.isArray(i)?i.map(eo):[eo(i)]}function zr(e,t,n,...r){if(n.length===0)return[];const[{value:o}]=Vr(n,1),i=sr(o),s=i?o.value:o;if(typeof s!="number")throw new Error("Math function cannot be called with non-number");const l=e(s,...r.map(d=>{var f;return(f=d.eval(t,n)[0])==null?void 0:f.value})),c=i?U.Quantity:n[0].type,u=i?{...o,value:l}:l;return[{type:c,value:u}]}function Vr(e,t){if(e.length!==t)throw new Error(`Expected ${t} arguments`);for(const n of e)if(n==null)throw new Error("Expected non-null argument");return e}class IM{constructor(t,n){this.original=t,this.child=n}eval(t,n){try{return n.length>0?n.map(r=>this.child.eval(t,[r])).flat():this.child.eval(t,[])}catch(r){throw new Error(`FhirPathError on "${this.original}": ${r}`)}}toString(){return this.child.toString()}}class Rs{constructor(t){this.value=t}eval(){return[this.value]}toString(){const t=this.value.value;return typeof t=="string"?`'${t}'`:t.toString()}}class cv{constructor(t){this.name=t}eval(t,n){if(this.name==="$this")return n;const r=t.variables[this.name];if(r)return[r];if(this.name.startsWith("%"))throw new Error(`Undefined variable ${this.name}`);return n.flatMap(o=>this.evalValue(o)).filter(o=>(o==null?void 0:o.value)!==void 0)}evalValue(t){const n=t.value;if(!(!n||typeof n!="object"))return Io(n)&&n.resourceType===this.name?t:gn(t,this.name)}toString(){return this.name}}class _M{eval(){return[]}toString(){return"{}"}}class AM extends L5{constructor(t,n,r){super(t,n),this.impl=r}eval(t,n){return this.impl(this.child.eval(t,n))}toString(){return this.operator+this.child.toString()}}class uv extends vc{constructor(t,n){super("as",t,n)}eval(t,n){return En.ofType(t,this.left.eval(t,n),this.right)}}class $n extends vc{}class vr extends $n{constructor(t,n,r,o){super(t,n,r),this.impl=o}eval(t,n){const r=this.left.eval(t,n);if(r.length!==1)return[];const o=this.right.eval(t,n);if(o.length!==1)return[];const i=r[0].value,s=o[0].value,l=sr(i)?i.value:i,c=sr(s)?s.value:s,u=this.impl(l,c);return typeof u=="boolean"?ge(u):sr(i)?[{type:U.Quantity,value:{...i,value:u}}]:[eo(u)]}}class NM extends vc{constructor(t,n){super("&",t,n)}eval(t,n){const r=this.left.eval(t,n),o=this.right.eval(t,n),i=[...r,...o];return i.length>0&&i.every(s=>typeof s.value=="string")?[{type:U.string,value:i.map(s=>s.value).join("")}]:i}}class OM extends $n{constructor(t,n){super("contains",t,n)}eval(t,n){const r=this.left.eval(t,n),o=this.right.eval(t,n);return ge(r.some(i=>i.value===o[0].value))}}class MM extends $n{constructor(t,n){super("in",t,n)}eval(t,n){const r=wo(this.left.eval(t,n)),o=this.right.eval(t,n);return r?ge(o.some(i=>i.value===r.value)):[]}}class dv extends vc{constructor(t,n){super(".",t,n)}eval(t,n){return this.right.eval(t,this.left.eval(t,n))}toString(){return`${this.left.toString()}.${this.right.toString()}`}}class ZE extends vc{constructor(t,n){super("|",t,n)}eval(t,n){const r=this.left.eval(t,n),o=this.right.eval(t,n);return BE([...r,...o])}}class LM extends $n{constructor(t,n){super("=",t,n)}eval(t,n){const r=this.left.eval(t,n),o=this.right.eval(t,n);return VE(r,o)}}class $M extends $n{constructor(t,n){super("!=",t,n)}eval(t,n){const r=this.left.eval(t,n),o=this.right.eval(t,n);return UE(VE(r,o))}}class FM extends $n{constructor(t,n){super("~",t,n)}eval(t,n){const r=this.left.eval(t,n),o=this.right.eval(t,n);return WE(r,o)}}class zM extends $n{constructor(t,n){super("!~",t,n)}eval(t,n){const r=this.left.eval(t,n),o=this.right.eval(t,n);return UE(WE(r,o))}}class fv extends $n{constructor(t,n){super("is",t,n)}eval(t,n){const r=this.left.eval(t,n);if(r.length!==1)return[];const o=this.right.name;return ge(qE(r[0],o))}}class BM extends $n{constructor(t,n){super("and",t,n)}eval(t,n){const r=wo(this.left.eval(t,n),"boolean"),o=wo(this.right.eval(t,n),"boolean");return(r==null?void 0:r.value)===!0&&(o==null?void 0:o.value)===!0?ge(!0):(r==null?void 0:r.value)===!1||(o==null?void 0:o.value)===!1?ge(!1):[]}}class UM extends $n{constructor(t,n){super("or",t,n)}eval(t,n){const r=wo(this.left.eval(t,n),"boolean"),o=wo(this.right.eval(t,n),"boolean");return(r==null?void 0:r.value)===!1&&(o==null?void 0:o.value)===!1?ge(!1):r!=null&&r.value||o!=null&&o.value?ge(!0):[]}}class VM extends $n{constructor(t,n){super("xor",t,n)}eval(t,n){const r=wo(this.left.eval(t,n),"boolean"),o=wo(this.right.eval(t,n),"boolean");return!r||!o?[]:ge(r.value!==o.value)}}class HM extends $n{constructor(t,n){super("implies",t,n)}eval(t,n){const r=wo(this.left.eval(t,n),"boolean"),o=wo(this.right.eval(t,n),"boolean");return(o==null?void 0:o.value)===!0||(r==null?void 0:r.value)===!1?ge(!0):!r||!o?[]:ge(!1)}}class hv{constructor(t,n){this.name=t,this.args=n}eval(t,n){const r=En[this.name];if(!r)throw new Error("Unrecognized function: "+this.name);return r(t,n,...this.args)}toString(){return`${this.name}(${this.args.map(t=>t.toString()).join(", ")})`}}class pv{constructor(t,n){this.left=t,this.expr=n}eval(t,n){const r=this.expr.eval(t,n);if(r.length!==1)return[];const o=r[0].value;if(typeof o!="number")throw new Error("Invalid indexer expression: should return integer}");const i=this.left.eval(t,n);return o in i?[i[o]]:[]}toString(){return`${this.left.toString()}[${this.expr.toString()}]`}}const WM=["year","years","month","months","week","weeks","day","days","hour","hours","minute","minutes","second","seconds","millisecond","milliseconds"];class qM{constructor(t,n,r,o){this.result=[],this.pos={index:0,line:1,column:0},this.markStack=[],this.str=t,this.keywords=n,this.operators=r,this.dateTimeLiterals=!!(o!=null&&o.dateTimeLiterals),this.symbolRegex=(o==null?void 0:o.symbolRegex)??/[$\w%]/}tokenize(){for(;this.pos.index<this.str.length;){const t=this.consumeToken();t&&this.result.push(t)}return this.result}prevToken(){return this.result.slice(-1)[0]}peekToken(){this.mark();const t=this.consumeToken();return this.reset(),t}consumeToken(){this.consumeWhitespace();const t=this.curr();if(!t)return;this.mark();const n=this.peek();return t==="/"&&n==="*"?this.consumeMultiLineComment():t==="/"&&n==="/"?this.consumeSingleLineComment():t==="'"||t==='"'?this.consumeString(t):t==="`"?this.consumeBacktickSymbol():t==="@"?this.consumeDateTime():/\d/.exec(t)?this.consumeNumber():/\w/.exec(t)?this.consumeSymbol():(t==="$"||t==="%")&&/\w/.exec(n)?this.consumeSymbol():this.consumeOperator()}consumeWhitespace(){this.consumeWhile(()=>/\s/.exec(this.curr()))}consumeMultiLineComment(){const t=this.pos.index;return this.consumeWhile(()=>this.curr()!=="*"||this.peek()!=="/"),this.advance(),this.advance(),this.buildToken("Comment",this.str.substring(t,this.pos.index))}consumeSingleLineComment(){return this.buildToken("Comment",this.consumeWhile(()=>this.curr()!==`
84
- `))}consumeString(t){this.advance();const n=this.buildToken("String",this.consumeWhile(()=>this.prev()==="\\"||this.curr()!==t));return this.advance(),n}consumeBacktickSymbol(){this.advance();const t=this.buildToken("Symbol",this.consumeWhile(()=>this.curr()!=="`"));return this.advance(),t}consumeDateTime(){this.advance();const t=this.pos.index;return this.consumeWhile(()=>/[\d-]/.exec(this.curr())),this.curr()==="T"&&(this.advance(),this.consumeWhile(()=>/[\d:]/.exec(this.curr())),this.curr()==="."&&/\d/.exec(this.peek())&&(this.advance(),this.consumeWhile(()=>/\d/.exec(this.curr()))),this.curr()==="Z"?this.advance():(this.curr()==="+"||this.curr()==="-")&&(this.advance(),this.consumeWhile(()=>/[\d:]/.exec(this.curr())))),this.buildToken("DateTime",this.str.substring(t,this.pos.index))}consumeNumber(){const t=this.pos.index;let n="Number";return this.consumeWhile(()=>/\d/.exec(this.curr())),this.curr()==="."&&/\d/.exec(this.peek())&&(this.advance(),this.consumeWhile(()=>/\d/.exec(this.curr()))),this.curr()==="-"&&this.dateTimeLiterals?(this.pos.index=t-1,this.consumeDateTime()):(this.curr()===" "&&GM(this.peekToken())&&(n="Quantity",this.consumeToken()),this.buildToken(n,this.str.substring(t,this.pos.index)))}consumeSymbol(){var n;const t=this.consumeWhile(()=>this.symbolRegex.exec(this.curr()));return((n=this.prevToken())==null?void 0:n.value)!=="."&&this.keywords.includes(t)?this.buildToken(t,t):this.buildToken("Symbol",t)}consumeOperator(){const t=this.curr(),n=this.peek(),r=t+n;return this.operators.includes(r)?(this.advance(),this.advance(),this.buildToken(r,r)):(this.advance(),this.buildToken(t,t))}consumeWhile(t){const n=this.pos.index;for(;this.pos.index<this.str.length&&t();)this.advance();return this.str.substring(n,this.pos.index)}curr(){return this.str[this.pos.index]}prev(){return this.str[this.pos.index-1]??""}peek(){return this.str[this.pos.index+1]??""}mark(){this.markStack.push({...this.pos})}reset(){const t=this.markStack.pop();if(!t)throw new Error("No mark to reset to");this.pos.index=t.index,this.pos.line=t.line,this.pos.column=t.column}advance(){this.pos.index++,this.curr()===`
85
- `?(this.pos.line++,this.pos.column=0):this.pos.column++}buildToken(t,n){const r=this.markStack.pop();if(!r)throw new Error("No mark for token");return{id:t,value:n,...r}}}function GM(e){return!!(e&&(e.id==="String"||e.id==="Symbol"&&WM.includes(e.value)))}const QM=["true","false"],KM=["!=","!~","<=",">=","{}","->"];function YM(e){return new qM(e,QM,KM).tokenize()}const Qe={FunctionCall:0,Dot:1,Indexer:2,UnaryAdd:3,UnarySubtract:3,Multiply:4,Divide:4,IntegerDivide:4,Modulo:4,Add:5,Subtract:5,Ampersand:5,Is:6,As:6,Union:7,GreaterThan:8,GreaterThanOrEquals:8,LessThan:8,LessThanOrEquals:8,Equals:9,Equivalent:9,NotEquals:9,NotEquivalent:9,In:10,Contains:10,And:11,Xor:12,Or:12,Implies:13,Arrow:100,Semicolon:200},XM={parse(e){var n;const t=e.consumeAndParse();if(!e.match(")"))throw new Error("Parse error: expected `)` got `"+((n=e.peek())==null?void 0:n.value)+"`");return t}},JM={parse(e,t){const n=e.consumeAndParse();if(!e.match("]"))throw new Error("Parse error: expected `]`");return new pv(t,n)},precedence:Qe.Indexer},ZM={parse(e,t){if(!(t instanceof cv))throw new Error("Unexpected parentheses");const n=[];for(;!e.match(")");)n.push(e.consumeAndParse()),e.match(",");return new hv(t.name,n)},precedence:Qe.FunctionCall};function eL(e){const t=e.split(" "),n=parseFloat(t[0]);let r=t[1];return r!=null&&r.startsWith("'")&&r.endsWith("'")?r=r.substring(1,r.length-1):r="{"+r+"}",{value:n,unit:r}}function tL(){return new $5().registerPrefix("String",{parse:(e,t)=>new Rs({type:U.string,value:t.value})}).registerPrefix("DateTime",{parse:(e,t)=>new Rs({type:U.dateTime,value:_u(t.value)})}).registerPrefix("Quantity",{parse:(e,t)=>new Rs({type:U.Quantity,value:eL(t.value)})}).registerPrefix("Number",{parse:(e,t)=>new Rs({type:t.value.includes(".")?U.decimal:U.integer,value:parseFloat(t.value)})}).registerPrefix("true",{parse:()=>new Rs({type:U.boolean,value:!0})}).registerPrefix("false",{parse:()=>new Rs({type:U.boolean,value:!1})}).registerPrefix("Symbol",{parse:(e,t)=>new cv(t.value)}).registerPrefix("{}",{parse:()=>new _M}).registerPrefix("(",XM).registerInfix("[",JM).registerInfix("(",ZM).prefix("+",Qe.UnaryAdd,(e,t)=>new AM("+",t,n=>n)).prefix("-",Qe.UnarySubtract,(e,t)=>new vr("-",t,t,(n,r)=>-r)).infixLeft(".",Qe.Dot,(e,t,n)=>new dv(e,n)).infixLeft("/",Qe.Divide,(e,t,n)=>new vr("/",e,n,(r,o)=>r/o)).infixLeft("*",Qe.Multiply,(e,t,n)=>new vr("*",e,n,(r,o)=>r*o)).infixLeft("+",Qe.Add,(e,t,n)=>new vr("+",e,n,(r,o)=>r+o)).infixLeft("-",Qe.Subtract,(e,t,n)=>new vr("-",e,n,(r,o)=>r-o)).infixLeft("|",Qe.Union,(e,t,n)=>new ZE(e,n)).infixLeft("=",Qe.Equals,(e,t,n)=>new LM(e,n)).infixLeft("!=",Qe.NotEquals,(e,t,n)=>new $M(e,n)).infixLeft("~",Qe.Equivalent,(e,t,n)=>new FM(e,n)).infixLeft("!~",Qe.NotEquivalent,(e,t,n)=>new zM(e,n)).infixLeft("<",Qe.LessThan,(e,t,n)=>new vr("<",e,n,(r,o)=>r<o)).infixLeft("<=",Qe.LessThanOrEquals,(e,t,n)=>new vr("<=",e,n,(r,o)=>r<=o)).infixLeft(">",Qe.GreaterThan,(e,t,n)=>new vr(">",e,n,(r,o)=>r>o)).infixLeft(">=",Qe.GreaterThanOrEquals,(e,t,n)=>new vr(">=",e,n,(r,o)=>r>=o)).infixLeft("&",Qe.Ampersand,(e,t,n)=>new NM(e,n)).infixLeft("and",Qe.And,(e,t,n)=>new BM(e,n)).infixLeft("as",Qe.As,(e,t,n)=>new uv(e,n)).infixLeft("contains",Qe.Contains,(e,t,n)=>new OM(e,n)).infixLeft("div",Qe.Divide,(e,t,n)=>new vr("div",e,n,(r,o)=>r/o|0)).infixLeft("in",Qe.In,(e,t,n)=>new MM(e,n)).infixLeft("is",Qe.Is,(e,t,n)=>new fv(e,n)).infixLeft("mod",Qe.Modulo,(e,t,n)=>new vr("mod",e,n,(r,o)=>r%o)).infixLeft("or",Qe.Or,(e,t,n)=>new UM(e,n)).infixLeft("xor",Qe.Xor,(e,t,n)=>new VM(e,n)).infixLeft("implies",Qe.Implies,(e,t,n)=>new HM(e,n))}const nL=tL();function eT(e){return new IM(e,nL.construct(YM(e)).consumeAndParse())}function rL(e,t){const n=Array.isArray(t)?t:[t];for(let r=0;r<n.length;r++){const o=n[r];typeof o=="object"&&"type"in o&&"value"in o||(n[r]=eo(n[r]))}return Gl(e,n).map(r=>r.value)}function Gl(e,t,n){const r=n??{};return eT(e).eval({variables:r},t).map(i=>{var s;return{type:i.type,value:(s=i.value)==null?void 0:s.valueOf()}})}var Ho=(e=>(e.BOOLEAN="BOOLEAN",e.NUMBER="NUMBER",e.QUANTITY="QUANTITY",e.TEXT="TEXT",e.REFERENCE="REFERENCE",e.CANONICAL="CANONICAL",e.DATE="DATE",e.DATETIME="DATETIME",e.PERIOD="PERIOD",e.UUID="UUID",e))(Ho||{});function If(e,t){var r,o;let n=(o=(r=pi.types[e])==null?void 0:r.searchParamsDetails)==null?void 0:o[t.code];return n||(n=iL(e,t)),n}function oL(e,t,n){const r=pi.types[e];r.searchParamsDetails||(r.searchParamsDetails={}),r.searchParamsDetails[t]=n}function iL(e,t){const n=t.code,r=lL(n),o=uL(e,t.expression),i={elementDefinitions:[],propertyTypes:new Set,array:!1};for(const l of o){const c=bl(l);c.length===1&&c[0]instanceof $n?i.propertyTypes.add("boolean"):tT(i,bl(l),e,1)}const s={columnName:r,type:cL(t,i.propertyTypes),elementDefinitions:i.elementDefinitions,array:i.array};return oL(e,n,s),s}function tT(e,t,n,r){const o=t[r];if(o instanceof uv){e.propertyTypes.add(o.right.toString());return}if(o instanceof hv){sL(e,o);return}const i=o.toString(),s=gs(n,i);if(!s)throw new Error(`Element definition not found for ${n} ${i}`);let l=!1,c=r+1;if(c<t.length&&t[c]instanceof pv&&(l=!0,c++),s.isArray&&!l&&(e.array=!0),c>=t.length){e.elementDefinitions.push(s);for(const u of s.type)e.propertyTypes.add(u.code);return}for(const u of s.type){let d=u.code;aL(d)&&(d=s.type[0].code),tT(e,t,d,c)}}function sL(e,t){if(t.name==="as"){e.propertyTypes.add(t.args[0].toString());return}if(t.name==="resolve"){e.propertyTypes.add("string");return}if(t.name==="where"&&t.args[0]instanceof fv){e.propertyTypes.add(t.args[0].right.toString());return}throw new Error(`Unhandled FHIRPath function: ${t.name}`)}function aL(e){return e==="Element"||e==="BackboneElement"}function lL(e){return e.split("-").reduce((t,n,r)=>t+(r?en(n):n),"")}function cL(e,t){switch(e.type){case"date":return t.size===1&&t.has(U.date)?"DATE":"DATETIME";case"number":return"NUMBER";case"quantity":return"QUANTITY";case"reference":return t.has(U.canonical)?"CANONICAL":"REFERENCE";case"token":return t.size===1&&t.has(U.boolean)?"BOOLEAN":"TEXT";default:return"TEXT"}}function uL(e,t){const n=[],r=eT(t);return am(e,r.child,n),n}function am(e,t,n){t instanceof ZE?(am(e,t.left,n),am(e,t.right,n)):t.toString().startsWith(e+".")&&n.push(t)}function bl(e){if(e instanceof uv||e instanceof pv)return[bl(e.left),e].flat();if(e instanceof $n)return[e];if(e instanceof dv)return[bl(e.left),bl(e.right)].flat();if(e instanceof hv){if(e.name==="where"&&!(e.args[0]instanceof fv))return[];if(e.name==="last")return[]}return[e]}const bc=20;var ne=(e=>(e.EQUALS="eq",e.NOT_EQUALS="ne",e.GREATER_THAN="gt",e.LESS_THAN="lt",e.GREATER_THAN_OR_EQUALS="ge",e.LESS_THAN_OR_EQUALS="le",e.STARTS_AFTER="sa",e.ENDS_BEFORE="eb",e.APPROXIMATELY="ap",e.CONTAINS="contains",e.EXACT="exact",e.TEXT="text",e.NOT="not",e.ABOVE="above",e.BELOW="below",e.IN="in",e.NOT_IN="not-in",e.OF_TYPE="of-type",e.MISSING="missing",e.IDENTIFIER="identifier",e.ITERATE="iterate",e))(ne||{});const nT={contains:"contains",exact:"exact",above:"above",below:"below",text:"text",not:"not",in:"in","not-in":"not-in","of-type":"of-type",missing:"missing",identifier:"identifier",iterate:"iterate"},mv={eq:"eq",ne:"ne",lt:"lt",le:"le",gt:"gt",ge:"ge",sa:"sa",eb:"eb",ap:"ap"};function dL(e){let t;for(const n of e.pathname.split("/"))n&&(t=n);return hL(t,e.searchParams.entries())}function fL(e){return dL(new URL(e,"https://example.com/"))}function hL(e,t){const n={resourceType:e};for(const[r,o]of t)pL(n,r,o);return n}function pL(e,t,n){var s,l;let r,o;const i=t.indexOf(":");if(i>=0?(r=t.substring(0,i),o=t.substring(i+1)):(r=t,o=""),r==="_has"||t.includes(".")){e.filters=Xa(e.filters,{code:t,operator:"eq",value:n});return}switch(r){case"_sort":mL(e,n);break;case"_count":e.count=parseInt(n,10);break;case"_offset":e.offset=parseInt(n,10);break;case"_total":e.total=n;break;case"_summary":n==="count"?(e.total="accurate",e.count=0):(n==="true"||n==="data"||n==="text")&&(e.summary=n);break;case"_include":{const c=w1(n);o==="iterate"&&(c.modifier="iterate"),e.include=Xa(e.include,c);break}case"_revinclude":{const c=w1(n);o==="iterate"&&(c.modifier="iterate"),e.revInclude=Xa(e.revInclude,c);break}case"_fields":case"_elements":e.fields=n.split(",");break;default:{const c=(l=(s=pi.types[e.resourceType])==null?void 0:s.searchParams)==null?void 0:l[r];c?e.filters=Xa(e.filters,gL(c,o,n)):e.filters=Xa(e.filters,xL(r,o,n))}}}function mL(e,t){for(const n of t.split(",")){let r,o=!1;n.startsWith("-")?(r=n.substring(1),o=!0):r=n,e.sortRules||(e.sortRules=[]),e.sortRules.push({code:r,descending:o})}}function gL(e,t,n){if(t==="missing")return{code:e.code,operator:"missing",value:n};switch(e.type){case"number":case"date":case"quantity":return yL(e,n);case"reference":case"string":case"token":case"uri":return vL(e,t,n);default:throw new Error("Unrecognized search parameter type: "+e.type)}}function yL(e,t){const{operator:n,value:r}=wL(t);return{code:e.code,operator:n,value:r}}function vL(e,t,n){return{code:e.code,operator:SL(t),value:n}}function xL(e,t,n){var o;let r="eq";if(t)r=t;else if(n.length>=2){const i=n.substring(0,2);i in mv&&(n.length===2||(o=n.at(2))!=null&&o.match(/\d/))&&(r=i,n=n.substring(i.length))}return{code:e,operator:r,value:n}}function wL(e){const t=e.substring(0,2),n=mv[t];return n?{operator:n,value:e.substring(2)}:{operator:"eq",value:e}}function SL(e){return nT[e]??"eq"}function w1(e){const t=e.split(":");if(t.includes("*"))throw new He(li("'*' is not supported as a value for search inclusion parameters"));if(t.length===1)throw new He(li(`Invalid include value '${e}': must be of the form ResourceType:search-parameter`));if(t.length===2)return{resourceType:t[0],searchParam:t[1]};if(t.length===3)return{resourceType:t[0],searchParam:t[1],targetType:t[2]};throw new He(li(`Invalid include value '${e}'`))}function Hs(e){const t=[];return e.fields&&t.push("_fields="+e.fields.join(",")),e.filters&&e.filters.forEach(n=>t.push(bL(n))),e.sortRules&&e.sortRules.length>0&&t.push(CL(e.sortRules)),e.offset!==void 0&&t.push("_offset="+e.offset),e.count!==void 0&&t.push("_count="+e.count),e.total!==void 0&&t.push("_total="+e.total),e.include&&e.include.forEach(n=>t.push(S1("_include",n))),e.revInclude&&e.revInclude.forEach(n=>t.push(S1("_revinclude",n))),t.length===0?"":(t.sort((n,r)=>n.localeCompare(r)),"?"+t.join("&"))}function bL(e){const t=e.operator in nT?":"+e.operator:"",n=e.operator!=="eq"&&e.operator in mv?e.operator:"";return`${e.code}${t}=${n}${encodeURIComponent(e.value)}`}function CL(e){return"_sort="+e.map(t=>t.descending?"-"+t.code:t.code).join(",")}function S1(e,t){return e+"="+t.resourceType+":"+t.searchParam+(t.targetType?":"+t.targetType:"")}function jL(e){if(typeof window<"u")return window.atob(e);if(typeof Buffer<"u")return Buffer.from(e,"base64").toString("binary");throw new Error("Unable to decode base64")}function EL(e){if(typeof window<"u")return window.btoa(e);if(typeof Buffer<"u")return Buffer.from(e,"binary").toString("base64");throw new Error("Unable to encode base64")}function b1(){const e=new Uint32Array(28);return crypto.getRandomValues(e),sO(e.buffer)}async function TL(e){return crypto.subtle.digest("SHA-256",new TextEncoder().encode(e))}function rT(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{const t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)})}function oT(e){var o,i,s;const t={};e=Si(e);for(const l of e.entry||[]){(o=l.resource)==null||delete o.meta;const c=(i=l.resource)==null?void 0:i.id;c&&(t[c]=rT(),l.fullUrl="urn:uuid:"+t[c],(s=l.resource)==null||delete s.id)}const n=e.entry,r=JSON.stringify({resourceType:"Bundle",type:"transaction",entry:n==null?void 0:n.map(l=>({fullUrl:l.fullUrl,request:{method:"POST",url:l.resource.resourceType},resource:l.resource}))},(l,c)=>PL(l,c,t),2);return kL(JSON.parse(r))}function PL(e,t,n){if(e==="reference"&&typeof t=="string"){let r;if(t.includes("/")?r=t.split("/")[1]:t.startsWith("urn:uuid:")?r=t.slice(9):t.startsWith("#")&&(r=t.slice(1)),r){const o=n[r];if(o)return"urn:uuid:"+o}}return t}function kL(e){const t=DL(e),{sorted:n,cycles:r}=RL(t),o={};for(const s of e.entry||[])s.fullUrl&&(o[s.fullUrl]=s);const i=n.map(s=>o[s]);for(const s of r)for(const l of s){const c=o[l],u={...c,request:{...c.request,method:"PUT"}};i.push(u)}return{...e,entry:i}}function RL(e){const t=[],n={},r=[];for(const i of Object.keys(e))n[i]=0;function o(i,s){if(n[i]===2)return!0;if(n[i]===1){const c=s.lastIndexOf(i);return c!==-1&&r.push(s.slice(c)),!0}n[i]=1,s.push(i);let l=!1;for(const c of e[i])o(c,s)||(l=!0);return n[i]=2,s.pop(),t.unshift(i),!l}for(const i in e)n[i]===0&&o(i,[]);return{sorted:t,cycles:r}}function iT(e,t){for(const n in e)if(e[n]&&typeof e[n]=="object"){const r=e[n];if(ys(r)){const o=r.reference;o.startsWith("urn:uuid:")&&t(o)}else iT(r,t)}}function DL(e){const t={};for(const n of e.entry||[])n.fullUrl&&(t[n.fullUrl]=[]);for(const n of e.entry||[]){const r=n.fullUrl;n.resource&&iT(n.resource,o=>{t[o]&&t[o].push(r)})}return t}class sT{constructor(t=10){this.max=t,this.cache=new Map}clear(){this.cache.clear()}get(t){const n=this.cache.get(t);return n&&(this.cache.delete(t),this.cache.set(t,n)),n}set(t,n){this.cache.has(t)?this.cache.delete(t):this.cache.size>=this.max&&this.cache.delete(this.first()),this.cache.set(t,n)}delete(t){this.cache.delete(t)}keys(){return this.cache.keys()}first(){return this.cache.keys().next().value}}const Gt={CSS:"text/css",DICOM:"application/dicom",FAVICON:"image/vnd.microsoft.icon",FHIR_JSON:"application/fhir+json",FORM_URL_ENCODED:"application/x-www-form-urlencoded",HL7_V2:"x-application/hl7-v2+er7",HTML:"text/html",JAVASCRIPT:"text/javascript",JSON:"application/json",JSON_PATCH:"application/json-patch+json",PNG:"image/png",SVG:"image/svg+xml",TEXT:"text/plain",TYPESCRIPT:"text/typescript"};class aT{constructor(){this.listeners={}}addEventListener(t,n){this.listeners[t]||(this.listeners[t]=[]),this.listeners[t].push(n)}removeEventListener(t,n){const r=this.listeners[t];if(r){for(let o=0;o<r.length;o++)if(r[o]===n){r.splice(o,1);return}}}dispatchEvent(t){const n=this.listeners[t.type];if(n)for(const r of n)r.call(this,t);return!t.defaultPrevented}}class IL{constructor(){this.emitter=new aT}dispatchEvent(t){this.emitter.dispatchEvent(t)}addEventListener(t,n){this.emitter.addEventListener(t,n)}removeEventListener(t,n){this.emitter.removeEventListener(t,n)}}const lm={"Patient-open":"Patient-open","Patient-close":"Patient-close","ImagingStudy-open":"ImagingStudy-open","ImagingStudy-close":"ImagingStudy-close","Encounter-open":"Encounter-open","Encounter-close":"Encounter-close","DiagnosticReport-open":"DiagnosticReport-open","DiagnosticReport-close":"DiagnosticReport-close","DiagnosticReport-select":"DiagnosticReport-select","DiagnosticReport-update":"DiagnosticReport-update",syncerror:"syncerror"},_L=["Patient","Encounter","ImagingStudy","DiagnosticReport","OperationOutcome","Bundle"],gv=["DiagnosticReport-update"];function AL(e){return gv.includes(e)}function NL(e){if(gv.includes(e))throw new He(At(`'context.version' is required for '${e}'.`))}const OL={"Patient-open":{patient:{resourceType:"Patient"},encounter:{resourceType:"Encounter",optional:!0}},"Patient-close":{patient:{resourceType:"Patient"},encounter:{resourceType:"Encounter",optional:!0}},"ImagingStudy-open":{study:{resourceType:"ImagingStudy"},encounter:{resourceType:"Encounter",optional:!0},patient:{resourceType:"Patient",optional:!0}},"ImagingStudy-close":{study:{resourceType:"ImagingStudy"},encounter:{resourceType:"Encounter",optional:!0},patient:{resourceType:"Patient",optional:!0}},"Encounter-open":{encounter:{resourceType:"Encounter"},patient:{resourceType:"Patient"}},"Encounter-close":{encounter:{resourceType:"Encounter"},patient:{resourceType:"Patient"}},"DiagnosticReport-open":{report:{resourceType:"DiagnosticReport"},encounter:{resourceType:"Encounter",optional:!0},study:{resourceType:"ImagingStudy",optional:!0,manyAllowed:!0},patient:{resourceType:"Patient"}},"DiagnosticReport-close":{report:{resourceType:"DiagnosticReport"},encounter:{resourceType:"Encounter",optional:!0},study:{resourceType:"ImagingStudy",optional:!0,manyAllowed:!0},patient:{resourceType:"Patient"}},"DiagnosticReport-select":{report:{resourceType:"DiagnosticReport"},select:{resourceType:"*",isArray:!0}},"DiagnosticReport-update":{report:{resourceType:"DiagnosticReport"},patient:{resourceType:"Patient",optional:!0},study:{resourceType:"ImagingStudy",optional:!0},updates:{resourceType:"Bundle"}},syncerror:{operationoutcome:{resourceType:"OperationOutcome"}}};function ML(e){return _L.includes(e)}function lT(e){return!!e.endpoint}function C1(e){if(!yv(e))throw new He(At("subscriptionRequest must be an object conforming to SubscriptionRequest type."));const{channelType:t,mode:n,topic:r,events:o}=e,i={"hub.channel.type":t,"hub.mode":n,"hub.topic":r,"hub.events":o.join(",")};return lT(e)&&(i.endpoint=e.endpoint),new URLSearchParams(i).toString()}function yv(e){if(typeof e!="object")return!1;const{channelType:t,mode:n,topic:r,events:o}=e;if(!(t&&n&&r&&o)||typeof r!="string"||typeof o!="object"||!Array.isArray(o)||o.length<1||t!=="websocket"||n!=="subscribe"&&n!=="unsubscribe")return!1;for(const i of o)if(!lm[i])return!1;return!(lT(e)&&!(typeof e.endpoint=="string"&&e.endpoint.startsWith("ws")))}function j1(e,t,n,r){if(typeof t!="object")throw new He(At(`context[${n}] is invalid. Context must contain a single valid FHIR resource! Resource is not an object.`));if(!(t.id&&typeof t.id=="string"))throw new He(At(`context[${n}] is invalid. Resource must contain a valid string ID.`));if(!t.resourceType)throw new He(At(`context[${n}] is invalid. Resource must contain a resource type. No resource type found.`));const o=r.resourceType;if(o!=="*"){if(!ML(t.resourceType))throw new He(At(`context[${n}] is invalid. Resource must contain a valid FHIRcast resource type. Resource type is not a known resource type.`));if(o&&t.resourceType!==o)throw new He(At(`context[${n}] is invalid. context[${n}] for the '${e}' event should contain resource of type ${o}.`))}}function LL(e,t,n,r,o){if(o.set(t.key,(o.get(t.key)??0)+1),!r.isArray)j1(e,t.resource,n,r);else{const{resources:i}=t;if(!i)throw new He(At(`context[${n}] is invalid. context[${n}] for the '${e}' with key '${String(t.key)}' should contain an array of resources on the key 'resources'.`));for(const s of i)j1(e,s,n,r)}}function $L(e,t){const n=new Map,r=OL[e];for(let o=0;o<t.length;o++){const i=t[o].key;if(!r[i])throw new He(At(`Key '${i}' not found for event '${e}'. Make sure to add only valid keys.`));LL(e,t[o],o,r[i],n)}for(const[o,i]of Object.entries(r)){if(!(i.optional||n.has(o)))throw new He(At(`Missing required key '${o}' on context for '${e}' event.`));if(!i.manyAllowed&&(n.get(o)||0)>1)throw new He(At(`${n.get(o)} context entries with key '${o}' found for the '${e}' event when schema only allows for 1.`))}}function E1(e,t,n,r){if(!(e&&typeof e=="string"))throw new He(At("Must provide a topic."));if(!lm[t])throw new He(At(`Must provide a valid FHIRcast event name. Supported events: ${Object.keys(lm).join(", ")}`));if(typeof n!="object")throw new He(At("context must be a context object or array of context objects."));if(gv.includes(t)&&!r)throw new He(At(`The '${t}' event must contain a 'context.versionId'.`));const o=Array.isArray(n)?n:[n];return $L(t,o),{timestamp:new Date().toISOString(),id:rT(),event:{"hub.topic":e,"hub.event":t,context:o,...r?{"context.versionId":r}:{}}}}class FL extends IL{constructor(t){if(super(),this.subRequest=t,!t.endpoint)throw new He(At("Subscription request should contain an endpoint."));if(!yv(t))throw new He(At("Subscription request failed validation."));const n=new WebSocket(t.endpoint);n.addEventListener("open",()=>{this.dispatchEvent({type:"connect"}),n.addEventListener("message",r=>{const o=JSON.parse(r.data);if(o["hub.topic"])return;const i=o;i.event["hub.event"]!=="heartbeat"&&(this.dispatchEvent({type:"message",payload:i}),n.send(JSON.stringify({id:o==null?void 0:o.id,timestamp:new Date().toISOString()})))}),n.addEventListener("close",()=>{this.dispatchEvent({type:"disconnect"})})}),this.websocket=n}disconnect(){this.websocket.close()}}function zL(e){const t=e.replace(/-/g,"+").replace(/_/g,"/"),n=jL(t),r=Array.from(n).reduce((i,s)=>{const l=("00"+s.charCodeAt(0).toString(16)).slice(-2);return`${i}%${l}`},""),o=decodeURIComponent(r);return JSON.parse(o)}function BL(e){return e.split(".").length===3}function vv(e){const[t,n,r]=e.split(".");return zL(n)}function UL(e){try{return typeof vv(e).login_id=="string"}catch{return!1}}function VL(e){try{const n=vv(e).exp;return typeof n=="number"?n*1e3:void 0}catch{return}}var T1;class xr{constructor(t){this[T1]="ReadablePromise",this.status="pending",this.suspender=t.then(n=>(this.status="success",this.response=n,n),n=>{throw this.status="error",this.error=n,n})}isPending(){return this.status==="pending"}isOk(){return this.status==="success"}read(){switch(this.status){case"pending":throw this.suspender;case"error":throw this.error;default:return this.response}}then(t,n){return this.suspender.then(t,n)}catch(t){return this.suspender.catch(t)}finally(t){return this.suspender.finally(t)}}T1=Symbol.toStringTag;class HL{constructor(t){this.storage=t??(typeof localStorage<"u"?localStorage:new WL)}clear(){this.storage.clear()}getString(t){return this.storage.getItem(t)??void 0}setString(t,n){n?this.storage.setItem(t,n):this.storage.removeItem(t)}getObject(t){const n=this.getString(t);return n?JSON.parse(n):void 0}setObject(t,n){this.setString(t,n?On(n):void 0)}}class WL{constructor(){this.data=new Map}get length(){return this.data.size}clear(){this.data.clear()}getItem(t){return this.data.get(t)??null}setItem(t,n){n?this.data.set(t,n):this.data.delete(t)}removeItem(t){this.data.delete(t)}key(t){return Array.from(this.data.keys())[t]}}const qL="3.0.1-9cbb1620",GL=Gt.FHIR_JSON+", */*; q=0.1",QL="https://api.medplum.com/",KL=1e3,YL=6e4,XL=0,P1="Binary/",k1={resourceType:"Device",id:"system",deviceName:[{type:"model-name",name:"System"}]};class JL extends aT{constructor(t){if(super(),this.initComplete=!0,t!=null&&t.baseUrl&&!t.baseUrl.startsWith("http"))throw new Error("Base URL must start with http or https");if(this.options=t??{},this.fetch=(t==null?void 0:t.fetch)??ZL(),this.storage=(t==null?void 0:t.storage)??new HL,this.createPdfImpl=t==null?void 0:t.createPdf,this.baseUrl=D1((t==null?void 0:t.baseUrl)??QL),this.fhirBaseUrl=D1(lu(this.baseUrl,(t==null?void 0:t.fhirUrlPath)??"fhir/R4/")),this.authorizeUrl=lu(this.baseUrl,(t==null?void 0:t.authorizeUrl)??"oauth2/authorize"),this.tokenUrl=lu(this.baseUrl,(t==null?void 0:t.tokenUrl)??"oauth2/token"),this.logoutUrl=lu(this.baseUrl,(t==null?void 0:t.logoutUrl)??"oauth2/logout"),this.clientId=(t==null?void 0:t.clientId)??"",this.clientSecret=(t==null?void 0:t.clientSecret)??"",this.onUnauthenticated=t==null?void 0:t.onUnauthenticated,this.cacheTime=(t==null?void 0:t.cacheTime)??(typeof window>"u"?XL:YL),this.cacheTime>0?this.requestCache=new sT((t==null?void 0:t.resourceCacheSize)??KL):this.requestCache=void 0,t!=null&&t.autoBatchTime?(this.autoBatchTime=t.autoBatchTime,this.autoBatchQueue=[]):(this.autoBatchTime=0,this.autoBatchQueue=void 0),t!=null&&t.accessToken)this.setAccessToken(t.accessToken),this.initPromise=Promise.resolve();else if(this.storage.getInitPromise!==void 0){const n=this.storage.getInitPromise(),r=new Promise(o=>{n.then(()=>{this.attemptResumeActiveLogin().then(o).catch(console.error),this.initComplete=!0}).catch(console.error)});this.initPromise=r,this.initComplete=!1}else this.initPromise=this.attemptResumeActiveLogin().catch(console.error);this.setupStorageListener()}get isInitialized(){return this.initComplete}getInitPromise(){return this.initPromise}async attemptResumeActiveLogin(){const t=this.getActiveLogin();t&&(this.setAccessToken(t.accessToken,t.refreshToken),await this.refreshProfile())}getBaseUrl(){return this.baseUrl}getAuthorizeUrl(){return this.authorizeUrl}getTokenUrl(){return this.tokenUrl}getLogoutUrl(){return this.logoutUrl}clear(){this.storage.clear(),sessionStorage.clear(),this.clearActiveLogin()}clearActiveLogin(){var t;this.storage.setString("activeLogin",void 0),(t=this.requestCache)==null||t.clear(),this.accessToken=void 0,this.refreshToken=void 0,this.refreshPromise=void 0,this.accessTokenExpires=void 0,this.sessionDetails=void 0,this.medplumServer=void 0,this.dispatchEvent({type:"change"})}invalidateUrl(t){var n;t=t.toString(),(n=this.requestCache)==null||n.delete(t)}invalidateAll(){var t;(t=this.requestCache)==null||t.clear()}invalidateSearches(t){const n=this.fhirBaseUrl+t;if(this.requestCache)for(const r of this.requestCache.keys())(r.endsWith(n)||r.includes(n+"?"))&&this.requestCache.delete(r)}get(t,n={}){t=t.toString();const r=this.getCacheEntry(t,n);if(r)return r.value;let o;t.startsWith(this.fhirBaseUrl)&&this.autoBatchQueue?o=new Promise((s,l)=>{this.autoBatchQueue.push({method:"GET",url:t.replace(this.fhirBaseUrl,""),options:n,resolve:s,reject:l}),this.autoBatchTimerId||(this.autoBatchTimerId=setTimeout(()=>this.executeAutoBatch(),this.autoBatchTime))}):o=this.request("GET",t,n);const i=new xr(o);return this.setCacheEntry(t,i),i}post(t,n,r,o={}){return t=t.toString(),this.setRequestBody(o,n),r&&this.setRequestContentType(o,r),this.invalidateUrl(t),this.request("POST",t,o)}put(t,n,r,o={}){return t=t.toString(),this.setRequestBody(o,n),r&&this.setRequestContentType(o,r),this.invalidateUrl(t),this.request("PUT",t,o)}patch(t,n,r={}){return t=t.toString(),this.setRequestBody(r,n),this.setRequestContentType(r,Gt.JSON_PATCH),this.invalidateUrl(t),this.request("PATCH",t,r)}delete(t,n){return t=t.toString(),this.invalidateUrl(t),this.request("DELETE",t,n)}async startNewUser(t,n){const{codeChallengeMethod:r,codeChallenge:o}=await this.startPkce();return this.post("auth/newuser",{...t,clientId:t.clientId??this.clientId,codeChallengeMethod:r,codeChallenge:o},void 0,n)}async startNewProject(t,n){return this.post("auth/newproject",t,void 0,n)}async startNewPatient(t,n){return this.post("auth/newpatient",t,void 0,n)}async startLogin(t,n){return this.post("auth/login",{...await this.ensureCodeChallenge(t),clientId:t.clientId??this.clientId,scope:t.scope},void 0,n)}async startGoogleLogin(t,n){return this.post("auth/google",{...await this.ensureCodeChallenge(t),clientId:t.clientId??this.clientId,scope:t.scope},void 0,n)}async ensureCodeChallenge(t){return t.codeChallenge?t:{...t,...await this.startPkce()}}async signOut(){await this.post(this.logoutUrl,{}),this.clear()}async signInWithRedirect(t){const r=new URLSearchParams(window.location.search).get("code");if(!r){await this.requestAuthorization(t);return}return this.processCode(r)}signOutWithRedirect(){window.location.assign(this.logoutUrl)}async signInWithExternalAuth(t,n,r,o,i=!0){let s=o;i&&(s=await this.ensureCodeChallenge(o)),window.location.assign(this.getExternalAuthRedirectUri(t,n,r,s,i))}async exchangeExternalAccessToken(t,n){if(n=n??this.clientId,!n)throw new Error("MedplumClient is missing clientId");const r=new URLSearchParams;return r.set("grant_type","urn:ietf:params:oauth:grant-type:token-exchange"),r.set("subject_token_type","urn:ietf:params:oauth:token-type:access_token"),r.set("client_id",n),r.set("subject_token",t),this.fetchTokens(r)}getExternalAuthRedirectUri(t,n,r,o,i=!0){const s=new URL(t);if(s.searchParams.set("response_type","code"),s.searchParams.set("client_id",n),s.searchParams.set("redirect_uri",r),s.searchParams.set("scope",o.scope??"openid profile email"),s.searchParams.set("state",JSON.stringify(o)),i){const{codeChallenge:l,codeChallengeMethod:c}=o;if(!c)throw new Error("`LoginRequest` for external auth must include a `codeChallengeMethod`.");if(!l)throw new Error("`LoginRequest` for external auth must include a `codeChallenge`.");s.searchParams.set("code_challenge_method",c),s.searchParams.set("code_challenge",l)}return s.toString()}fhirUrl(...t){return new URL(t.join("/"),this.fhirBaseUrl)}fhirSearchUrl(t,n){const r=this.fhirUrl(t);return n&&(r.search=new URLSearchParams(n).toString()),r}search(t,n,r){const o=this.fhirSearchUrl(t,n),i="search-"+o.toString(),s=this.getCacheEntry(i,r);if(s)return s.value;const l=new xr((async()=>{const c=await this.get(o,r);if(c.entry)for(const u of c.entry)this.cacheResource(u.resource);return c})());return this.setCacheEntry(i,l),l}searchOne(t,n,r){const o=this.fhirSearchUrl(t,n);o.searchParams.set("_count","1"),o.searchParams.sort();const i="searchOne-"+o.toString(),s=this.getCacheEntry(i,r);if(s)return s.value;const l=new xr(this.search(t,o.searchParams,r).then(c=>{var u,d;return(d=(u=c.entry)==null?void 0:u[0])==null?void 0:d.resource}));return this.setCacheEntry(i,l),l}searchResources(t,n,r){const i="searchResources-"+this.fhirSearchUrl(t,n).toString(),s=this.getCacheEntry(i,r);if(s)return s.value;const l=new xr(this.search(t,n,r).then(_1));return this.setCacheEntry(i,l),l}async*searchResourcePages(t,n,r){var i,s;let o=this.fhirSearchUrl(t,n);for(;o;){const l=new URL(o).searchParams,c=await this.search(t,l,r),u=(i=c.link)==null?void 0:i.find(d=>d.relation==="next");if(!((s=c.entry)!=null&&s.length)&&!u)break;yield _1(c),o=u!=null&&u.url?new URL(u.url):void 0}}searchValueSet(t,n,r){return this.valueSetExpand({url:t,filter:n},r)}valueSetExpand(t,n){const r=this.fhirUrl("ValueSet","$expand");return r.search=new URLSearchParams(t).toString(),this.get(r.toString(),n)}getCached(t,n){var o,i;const r=(i=(o=this.requestCache)==null?void 0:o.get(this.fhirUrl(t,n).toString()))==null?void 0:i.value;return r!=null&&r.isOk()?r.read():void 0}getCachedReference(t){const n=t.reference;if(!n)return;if(n==="system")return k1;const[r,o]=n.split("/");if(!(!r||!o))return this.getCached(r,o)}readResource(t,n,r){return this.get(this.fhirUrl(t,n),r)}readReference(t,n){const r=t.reference;if(!r)return new xr(Promise.reject(new Error("Missing reference")));if(r==="system")return new xr(Promise.resolve(k1));const[o,i]=r.split("/");return!o||!i?new xr(Promise.reject(new Error("Invalid reference"))):this.readResource(o,i,n)}requestSchema(t){if(KE(t))return Promise.resolve();const n=t+"-requestSchema",r=this.getCacheEntry(n,void 0);if(r)return r.value;const o=new xr((async()=>{const i=`{
86
- StructureDefinitionList(name: "${t}") {
87
- resourceType,
88
- name,
89
- kind,
90
- description,
91
- type,
92
- snapshot {
93
- element {
94
- id,
95
- path,
96
- definition,
97
- min,
98
- max,
99
- base {
100
- path,
101
- min,
102
- max
103
- },
104
- contentReference,
105
- type {
106
- code,
107
- profile,
108
- targetProfile
109
- },
110
- binding {
111
- strength,
112
- valueSet
113
- }
114
- }
115
- }
116
- }
117
- SearchParameterList(base: "${t}", _count: 100) {
118
- base,
119
- code,
120
- type,
121
- expression,
122
- target
123
- }
124
- }`.replace(/\s+/g," "),s=await this.graphql(i);g1(s.data.StructureDefinitionList);for(const l of s.data.SearchParameterList)TM(l)})());return this.setCacheEntry(n,o),o}requestProfileSchema(t){if(YE(t))return Promise.resolve();const n=t+"-requestSchema",r=this.getCacheEntry(n,void 0);if(r)return r.value;const o=new xr((async()=>{const i=await this.searchOne("StructureDefinition",{url:t,_sort:"-_lastUpdated"});i?g1([i],t):console.warn(`No StructureDefinition found for ${t}!`)})());return this.setCacheEntry(n,o),o}readHistory(t,n,r){return this.get(this.fhirUrl(t,n,"_history"),r)}readVersion(t,n,r,o){return this.get(this.fhirUrl(t,n,"_history",r),o)}readPatientEverything(t,n){return this.get(this.fhirUrl("Patient",t,"$everything"),n)}createResource(t,n){if(!t.resourceType)throw new Error("Missing resourceType");return this.invalidateSearches(t.resourceType),this.post(this.fhirUrl(t.resourceType),t,void 0,n)}async createResourceIfNoneExist(t,n,r){return await this.searchOne(t.resourceType,n,r)??this.createResource(t,r)}async createAttachment(t,n,r,o,i){const s=await this.createBinary(t,n,r,o,i);return{contentType:r,url:s.url,title:n}}createBinary(t,n,r,o,i){const s=this.fhirUrl("Binary");return n&&s.searchParams.set("_filename",n),o?this.uploadwithProgress(s,t,r,o,i):this.post(s,t,r,i)}uploadwithProgress(t,n,r,o,i){return new Promise((s,l)=>{var f;const c=new XMLHttpRequest,u=()=>c.abort();(f=i==null?void 0:i.signal)==null||f.addEventListener("abort",u);const d=h=>{var m;(m=i==null?void 0:i.signal)==null||m.removeEventListener("abort",u),h instanceof Error?l(h):s(h)};c.responseType="json",c.onabort=()=>d(new Error("Request aborted")),c.onerror=()=>d(new Error("Request error")),o&&(c.upload.onprogress=h=>o(h),c.upload.onload=h=>o(h)),c.onload=()=>{c.status>=200&&c.status<300?d(c.response):d(new He(ut(c.response||c.statusText)))},c.open("POST",t),c.withCredentials=!0,c.setRequestHeader("Authorization","Bearer "+this.accessToken),c.setRequestHeader("Cache-Control","no-cache, no-store, max-age=0"),c.setRequestHeader("Content-Type",r),c.setRequestHeader("X-Medplum","extended"),c.send(n)})}async createPdf(t,n,r,o){if(!this.createPdfImpl)throw new Error("PDF creation not enabled");const i=await this.createPdfImpl(t,r,o);return this.createBinary(i,n,"application/pdf")}createComment(t,n,r){const o=this.getProfile();let i,s;return t.resourceType==="Encounter"&&(i=xt(t),s=t.subject),t.resourceType==="ServiceRequest"&&(i=t.encounter,s=t.subject),t.resourceType==="Patient"&&(s=xt(t)),this.createResource({resourceType:"Communication",status:"completed",basedOn:[xt(t)],encounter:i,subject:s,sender:o?xt(o):void 0,sent:new Date().toISOString(),payload:[{contentString:n}]},r)}async updateResource(t,n){if(!t.resourceType)throw new Error("Missing resourceType");if(!t.id)throw new Error("Missing id");let r=await this.put(this.fhirUrl(t.resourceType,t.id),t,void 0,n);return r||(r=t),this.cacheResource(r),this.invalidateUrl(this.fhirUrl(t.resourceType,t.id,"_history")),this.invalidateSearches(t.resourceType),r}patchResource(t,n,r,o){return this.invalidateSearches(t),this.patch(this.fhirUrl(t,n),r,o)}deleteResource(t,n,r){return this.deleteCacheEntry(this.fhirUrl(t,n).toString()),this.invalidateSearches(t),this.delete(this.fhirUrl(t,n),r)}validateResource(t,n){return this.post(this.fhirUrl(t.resourceType,"$validate"),t,void 0,n)}executeBot(t,n,r,o){let i;if(typeof t=="string"){const s=t;i=this.fhirUrl("Bot",s,"$execute")}else{const s=t;i=this.fhirUrl("Bot","$execute")+`?identifier=${s.system}|${s.value}`}return this.post(i,n,r,o)}executeBatch(t,n){return this.post(this.fhirBaseUrl.slice(0,-1),t,void 0,n)}sendEmail(t,n){return this.post("email/v1/send",t,Gt.JSON,n)}graphql(t,n,r,o){return this.post(this.fhirUrl("$graphql"),{query:t,operationName:n,variables:r},Gt.JSON,o)}readResourceGraph(t,n,r,o){return this.get(`${this.fhirUrl(t,n)}/$graph?graph=${r}`,o)}pushToAgent(t,n,r,o,i,s){return this.post(this.fhirUrl("Agent",tv(t),"$push"),{destination:ht(n),body:r,contentType:o,waitForResponse:i},Gt.FHIR_JSON,s)}getActiveLogin(){return this.storage.getObject("activeLogin")}async setActiveLogin(t){var n,r;(!((n=this.sessionDetails)!=null&&n.profile)||ht(this.sessionDetails.profile)!==((r=t.profile)==null?void 0:r.reference))&&this.clearActiveLogin(),this.setAccessToken(t.accessToken,t.refreshToken),this.storage.setObject("activeLogin",t),this.addLogin(t),this.refreshPromise=void 0,await this.refreshProfile()}getAccessToken(){return this.accessToken}setAccessToken(t,n){this.accessToken=t,this.refreshToken=n,this.sessionDetails=void 0,this.accessTokenExpires=VL(t),this.medplumServer=UL(t)}getLogins(){return this.storage.getObject("logins")??[]}addLogin(t){const n=this.getLogins().filter(r=>{var o,i;return((o=r.profile)==null?void 0:o.reference)!==((i=t.profile)==null?void 0:i.reference)});n.push(t),this.storage.setObject("logins",n)}async refreshProfile(){return this.medplumServer?(this.profilePromise=new Promise((t,n)=>{this.get("auth/me").then(r=>{var i,s;this.profilePromise=void 0;const o=((s=(i=this.sessionDetails)==null?void 0:i.profile)==null?void 0:s.id)!==r.profile.id;this.sessionDetails=r,o&&this.dispatchEvent({type:"change"}),t(r.profile)}).catch(n)}),this.profilePromise):Promise.resolve(void 0)}isLoading(){return!!this.profilePromise}isSuperAdmin(){var t;return!!((t=this.sessionDetails)!=null&&t.project.superAdmin)}isProjectAdmin(){var t;return!!((t=this.sessionDetails)!=null&&t.membership.admin)}getProject(){var t;return(t=this.sessionDetails)==null?void 0:t.project}getProjectMembership(){var t;return(t=this.sessionDetails)==null?void 0:t.membership}getProfile(){var t;return(t=this.sessionDetails)==null?void 0:t.profile}async getProfileAsync(){return this.profilePromise?this.profilePromise:this.sessionDetails?this.sessionDetails.profile:this.refreshProfile()}getUserConfiguration(){var t;return(t=this.sessionDetails)==null?void 0:t.config}getAccessPolicy(){var t;return(t=this.sessionDetails)==null?void 0:t.accessPolicy}async download(t,n={}){this.refreshPromise&&await this.refreshPromise;const r=t.toString();return r.startsWith(P1)&&(t=this.fhirUrl(r)),this.addFetchOptionsDefaults(n),(await this.fetchWithRetry(t.toString(),n)).blob()}async uploadMedia(t,n,r,o,i){const s=await this.createBinary(t,r,n);return this.createResource({resourceType:"Media",status:"completed",content:{contentType:n,url:P1+s.id,title:r},...o},i)}async bulkExport(t="",n,r,o){const i=t&&`${t}/`,s=this.fhirUrl(`${i}$export`);return n&&s.searchParams.set("_type",n),r&&s.searchParams.set("_since",r),this.startAsyncRequest(s.toString(),o)}async startAsyncRequest(t,n={}){this.addFetchOptionsDefaults(n);const r=n.headers;r.Prefer="respond-async";const o=await this.fetchWithRetry(t,n);if(o.status===202){const i=await I1(o);if(i)return this.pollStatus(i)}return this.parseResponse(o,"POST",t)}getCacheEntry(t,n){if(!this.requestCache||(n==null?void 0:n.cache)==="no-cache"||(n==null?void 0:n.cache)==="reload")return;const r=this.requestCache.get(t);if(!(!r||r.requestTime+this.cacheTime<Date.now()))return r}setCacheEntry(t,n){this.requestCache&&this.requestCache.set(t,{requestTime:Date.now(),value:n})}cacheResource(t){var n,r;t!=null&&t.id&&!((r=(n=t.meta)==null?void 0:n.tag)!=null&&r.some(o=>o.code==="SUBSETTED"))&&this.setCacheEntry(this.fhirUrl(t.resourceType,t.id).toString(),new xr(Promise.resolve(t)))}deleteCacheEntry(t){this.requestCache&&this.requestCache.delete(t)}async request(t,n,r={}){await this.refreshIfExpired(),r.method=t,this.addFetchOptionsDefaults(r);const o=await this.fetchWithRetry(n,r);return this.parseResponse(o,t,n,r)}async parseResponse(t,n,r,o={}){if(t.status===401)return this.handleUnauthenticated(n,r,o);if(t.status===204||t.status===304)return;const i=t.headers.get("content-type"),s=i==null?void 0:i.includes("json");if(t.status===404&&!s)throw new He(G5);const l=t.headers.get("content-location"),c=o.redirect??this.options.redirect;if(t.status===201&&l&&c==="follow")return this.request("GET",l,{...o,body:void 0});let u;if(s)try{u=await t.json()}catch(d){throw console.error("Error parsing response",t.status,d),d}else u=await t.text();if(t.status>=400)throw new He(ut(u));return u}async fetchWithRetry(t,n){t.startsWith("http")||(t=new URL(t,this.baseUrl).href);const r=3,o=200;let i;for(let s=0;s<r;s++){try{if(this.options.verbose&&this.logRequest(t,n),i=await this.fetch(t,n),this.options.verbose&&this.logResponse(i),i.status<500)return i}catch(l){this.retryCatch(s,r,l)}await u1(o)}return i}logRequest(t,n){if(console.log(`> ${n.method} ${t}`),n.headers){const r=n.headers,o=Object.entries(r).sort((i,s)=>i[0].localeCompare(s[0]));for(const[i,s]of o)console.log(`> ${i}: ${s}`)}}logResponse(t){console.log(`< ${t.status} ${t.statusText}`),t.headers&&t.headers.forEach((n,r)=>console.log(`< ${r}: ${n}`))}async pollStatus(t){let n=!0,r;const o=2e3;for(;n;){const i={};this.addFetchOptionsDefaults(i);const s=await this.fetchWithRetry(t,i);if(s.status!==202&&(n=!1,r=s,s.status===201)){const l=await I1(s);l&&(r=await this.fetchWithRetry(l,i))}await u1(o)}return this.parseResponse(r,"POST",t)}async executeAutoBatch(){var o,i;const t=[...this.autoBatchQueue];if(this.autoBatchQueue.length=0,this.autoBatchTimerId=void 0,t.length===1){const s=t[0];try{s.resolve(await this.request(s.method,this.fhirBaseUrl+s.url,s.options))}catch(l){s.reject(new He(ut(l)))}return}const n={resourceType:"Bundle",type:"batch",entry:t.map(s=>({request:{method:s.method,url:s.url},resource:s.options.body?JSON.parse(s.options.body):void 0}))},r=await this.post(this.fhirBaseUrl.slice(0,-1),n);for(let s=0;s<t.length;s++){const l=t[s],c=(o=r.entry)==null?void 0:o[s];(i=c==null?void 0:c.response)!=null&&i.outcome&&!_E(c.response.outcome)?l.reject(new He(c.response.outcome)):l.resolve(c==null?void 0:c.resource)}}addFetchOptionsDefaults(t){let n=t.headers;n||(n={},t.headers=n),n.Accept||(n.Accept=GL),n["X-Medplum"]="extended",t.body&&!n["Content-Type"]&&(n["Content-Type"]=Gt.FHIR_JSON),this.accessToken?n.Authorization="Bearer "+this.accessToken:this.basicAuth&&(n.Authorization="Basic "+this.basicAuth),t.cache||(t.cache="no-cache"),t.credentials||(t.credentials="include")}setRequestContentType(t,n){t.headers||(t.headers={});const r=t.headers;r["Content-Type"]=n}setRequestBody(t,n){typeof n=="string"||typeof Blob<"u"&&n instanceof Blob||typeof File<"u"&&n instanceof File||typeof Uint8Array<"u"&&n instanceof Uint8Array?t.body=n:n&&(t.body=JSON.stringify(n))}handleUnauthenticated(t,n,r){return this.refresh()?this.request(t,n,r):(this.clearActiveLogin(),this.onUnauthenticated&&this.onUnauthenticated(),Promise.reject(new Error("Unauthenticated")))}async startPkce(){const t=b1();sessionStorage.setItem("pkceState",t);const n=b1();sessionStorage.setItem("codeVerifier",n);const r=await TL(n),o=aO(r).replaceAll("+","-").replaceAll("/","_").replaceAll("=","");return sessionStorage.setItem("codeChallenge",o),{codeChallengeMethod:"S256",codeChallenge:o}}async requestAuthorization(t){const n=await this.ensureCodeChallenge(t??{}),r=new URL(this.authorizeUrl);r.searchParams.set("response_type","code"),r.searchParams.set("state",sessionStorage.getItem("pkceState")),r.searchParams.set("client_id",n.clientId??this.clientId),r.searchParams.set("redirect_uri",n.redirectUri??R1()),r.searchParams.set("code_challenge_method",n.codeChallengeMethod),r.searchParams.set("code_challenge",n.codeChallenge),r.searchParams.set("scope",n.scope??"openid profile"),window.location.assign(r.toString())}processCode(t,n){const r=new URLSearchParams;if(r.set("grant_type","authorization_code"),r.set("code",t),r.set("client_id",(n==null?void 0:n.clientId)??this.clientId),r.set("redirect_uri",(n==null?void 0:n.redirectUri)??R1()),typeof sessionStorage<"u"){const o=sessionStorage.getItem("codeVerifier");o&&r.set("code_verifier",o)}return this.fetchTokens(r)}refreshIfExpired(){return!this.refreshPromise&&this.accessTokenExpires!==void 0&&this.accessTokenExpires<Date.now()&&this.refresh(),this.refreshPromise??Promise.resolve()}refresh(){if(this.refreshPromise)return this.refreshPromise;if(this.refreshToken){const t=new URLSearchParams;return t.set("grant_type","refresh_token"),t.set("client_id",this.clientId),t.set("refresh_token",this.refreshToken),this.refreshPromise=this.fetchTokens(t),this.refreshPromise}if(this.clientId&&this.clientSecret)return this.refreshPromise=this.startClientLogin(this.clientId,this.clientSecret),this.refreshPromise}async startClientLogin(t,n){this.clientId=t,this.clientSecret=n;const r=new URLSearchParams;return r.set("grant_type","client_credentials"),r.set("client_id",t),r.set("client_secret",n),this.fetchTokens(r)}async startJwtBearerLogin(t,n,r){this.clientId=t;const o=new URLSearchParams;return o.set("grant_type","urn:ietf:params:oauth:grant-type:jwt-bearer"),o.set("client_id",t),o.set("assertion",n),o.set("scope",r),this.fetchTokens(o)}async startJwtAssertionLogin(t){const n=new URLSearchParams;return n.append("grant_type","client_credentials"),n.append("client_assertion_type","urn:ietf:params:oauth:client-assertion-type:jwt-bearer"),n.append("client_assertion",t),this.fetchTokens(n)}setBasicAuth(t,n){this.clientId=t,this.clientSecret=n,this.basicAuth=EL(t+":"+n)}async fhircastSubscribe(t,n){if(!(typeof t=="string"&&t!==""))throw new He(At("Invalid topic provided. Topic must be a valid string."));if(!(typeof n=="object"&&Array.isArray(n)&&n.length>0))throw new He(At("Invalid events provided. Events must be an array of event names containing at least one event."));const r={channelType:"websocket",mode:"subscribe",topic:t,events:n},i=(await this.post("/fhircast/STU3",C1(r),Gt.FORM_URL_ENCODED))["hub.channel.endpoint"];if(!i)throw new Error("Invalid response!");return r.endpoint=i,r}async fhircastUnsubscribe(t){if(!yv(t))throw new He(At("Invalid topic or subscriptionRequest. SubscriptionRequest must be an object."));if(!(t.endpoint&&typeof t.endpoint=="string"&&t.endpoint.startsWith("ws")))throw new He(At("Provided subscription request must have an endpoint in order to unsubscribe."));t.mode="unsubscribe",await this.post("/fhircast/STU3",C1(t),Gt.FORM_URL_ENCODED)}fhircastConnect(t){return new FL(t)}async fhircastPublish(t,n,r,o){return AL(n)?this.post(`/fhircast/STU3/${t}`,E1(t,n,r,o),Gt.JSON):(NL(n),this.post(`/fhircast/STU3/${t}`,E1(t,n,r),Gt.JSON))}async fhircastGetContext(t){return this.get(`/fhircast/STU3/${t}`)}async invite(t,n){return this.post("admin/projects/"+t+"/invite",n)}async fetchTokens(t){const n={method:"POST",headers:{"Content-Type":Gt.FORM_URL_ENCODED},body:t.toString(),credentials:"include"},r=n.headers;this.basicAuth&&(r.Authorization=`Basic ${this.basicAuth}`);let o;try{o=await this.fetchWithRetry(this.tokenUrl,n)}catch(s){throw this.refreshPromise=void 0,s}if(!o.ok){this.clearActiveLogin();try{const s=await o.json();throw new He(li(s.error_description))}catch(s){throw new He(li("Failed to fetch tokens"),s)}}const i=await o.json();return await this.verifyTokens(i),this.getProfile()}async verifyTokens(t){const n=t.access_token;if(BL(n)){const r=vv(n);if(Date.now()>=r.exp*1e3)throw this.clearActiveLogin(),new Error("Token expired");if(r.cid){if(r.cid!==this.clientId)throw this.clearActiveLogin(),new Error("Token was not issued for this audience")}else if(this.clientId&&r.client_id!==this.clientId)throw this.clearActiveLogin(),new Error("Token was not issued for this audience")}return this.setActiveLogin({accessToken:n,refreshToken:t.refresh_token,project:t.project,profile:t.profile})}setupStorageListener(){try{window.addEventListener("storage",t=>{(t.key===null||t.key==="activeLogin")&&window.location.reload()})}catch{}}retryCatch(t,n,r){if(r.message==="Failed to fetch"&&t===1&&this.dispatchEvent({type:"offline"}),t>=n-1)throw r}}function ZL(){if(!globalThis.fetch)throw new Error("Fetch not available in this environment");return globalThis.fetch.bind(globalThis)}function R1(){return typeof window>"u"?"":window.location.protocol+"//"+window.location.host+"/"}function D1(e){return e.endsWith("/")?e:e+"/"}function lu(e,t){return new URL(t,e).toString()}async function I1(e){var o,i;const t=e.headers.get("content-location");if(t)return t;const n=e.headers.get("location");if(n)return n;const r=await e.json();if(Pf(r)&&((i=(o=r.issue)==null?void 0:o[0])!=null&&i.diagnostics))return r.issue[0].diagnostics}function _1(e){var n;const t=((n=e.entry)==null?void 0:n.map(r=>r.resource))??[];return Object.assign(t,{bundle:e})}const e$="http://hl7.org";function t$(e,t){return!(t.pattern&&!nv(e,t.pattern)||t.fixed&&!wc(e,t.fixed))}function n$(e,t,n,r){if(Array.isArray(e))return!1;const o=(r??n.elements)[t.path],i=n.type;switch(t.type){case"value":case"pattern":if(!e||!o)return!1;if(t$(e,o))return!0;break;case"type":return!e||!(i!=null&&i.length)?!1:i.some(s=>s.code===e.type)}return!1}var cT=p.createContext(void 0);function _f(){return p.useContext(cT)}function te(){return _f().medplum}function Af(){return _f().navigate}function xv(){return _f().profile}function r$(e){let t=e.medplum,n=e.navigate??o$,[r,o]=p.useState({profile:t.getProfile(),loading:!t.isInitialized});p.useEffect(()=>{t&&(t.isInitialized||(o(s=>({...s,loading:!0})),t.getInitPromise().then(()=>o(s=>({...s,loading:!1}))).catch(console.error)))},[t,t.isInitialized]),p.useEffect(()=>{function s(){o({...r,profile:t.getProfile()})}return t.addEventListener("change",s),()=>t.removeEventListener("change",s)},[t,r]);let i=p.useMemo(()=>({...r,medplum:t,navigate:n}),[r,t,n]);return a.jsx(cT.Provider,{value:i,children:e.children})}function o$(e){window.location.assign(e)}function st(e,t){let n=te(),[r,o]=p.useState(A1(n,e)),i=p.useCallback(s=>{wc(s,r)||o(s)},[r,o]);return p.useEffect(()=>{i(A1(n,e))},[n,e,i]),p.useEffect(()=>{let s=!0;return ys(e)&&n.readReference(e).then(l=>{s&&i(l)}).catch(l=>{s&&(i(void 0),t&&t(ut(l)))}),()=>s=!1},[n,r,e,i,t]),r}function A1(e,t){if(t){if(Io(t))return t;if(ys(t))return e.getCachedReference(t)}}function i$(e,t){return uT("searchOne",e,t)}function xa(e,t){return uT("searchResources",e,t)}function uT(e,t,n){let r=te(),[o,i]=p.useState(),[s,l]=p.useState(!1),[c,u]=p.useState(),[d,f]=p.useState();return p.useEffect(()=>{let h=r.fhirSearchUrl(t,n).toString();h!==o&&(i(h),r[e](t,n).then(m=>{l(!1),u(m),f(q5)}).catch(m=>{l(!1),u(void 0),f(ut(m))}))},[r,e,t,n,o,u]),[c,s,d]}function s$(e){const t=e.value;return t?a.jsx(a.Fragment,{children:dO(t)}):null}function N1(e,t){return e.line&&e.line.length>t?e.line[t]:""}function O1(e,t,n){const r=e.line||[];for(;r.length<=t;)r.push("");return r[t]=n,{...e,line:r}}function a$(e){const[t,n]=p.useState(e.defaultValue||{}),r=p.useRef();r.current=t;function o(h){n(h),e.onChange&&e.onChange(h)}function i(h){o({...r.current,use:h})}function s(h){o({...r.current,type:h})}function l(h){o(O1(r.current||{},0,h))}function c(h){o(O1(r.current||{},1,h))}function u(h){o({...r.current,city:h})}function d(h){o({...r.current,state:h})}function f(h){o({...r.current,postalCode:h})}return a.jsxs(Y,{gap:"xs",wrap:"nowrap",grow:!0,children:[a.jsx(mt,{"data-testid":"address-use",defaultValue:t.use,onChange:h=>i(h.currentTarget.value),data:["","home","work","temp","old","billing"]}),a.jsx(mt,{"data-testid":"address-type",defaultValue:t.type,onChange:h=>s(h.currentTarget.value),data:["","postal","physical","both"]}),a.jsx(ie,{placeholder:"Line 1",defaultValue:N1(t,0),onChange:h=>l(h.currentTarget.value)}),a.jsx(ie,{placeholder:"Line 2",defaultValue:N1(t,1),onChange:h=>c(h.currentTarget.value)}),a.jsx(ie,{placeholder:"City",defaultValue:t.city,onChange:h=>u(h.currentTarget.value)}),a.jsx(ie,{placeholder:"State",defaultValue:t.state,onChange:h=>d(h.currentTarget.value)}),a.jsx(ie,{placeholder:"Postal Code",defaultValue:t.postalCode,onChange:h=>f(h.currentTarget.value)})]})}function l$(e){const t=xv(),[n,r]=p.useState(e.defaultValue||{});function o(i){const s=i?{text:i,authorReference:t&&xt(t),time:new Date().toISOString()}:{};r(s),e.onChange&&e.onChange(s)}return a.jsx(ie,{name:e.name,placeholder:"Annotation text",defaultValue:n.text,onChange:i=>o(i.currentTarget.value)})}var c$={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"},u$=Object.defineProperty,d$=Object.defineProperties,f$=Object.getOwnPropertyDescriptors,gd=Object.getOwnPropertySymbols,dT=Object.prototype.hasOwnProperty,fT=Object.prototype.propertyIsEnumerable,M1=(e,t,n)=>t in e?u$(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,L1=(e,t)=>{for(var n in t||(t={}))dT.call(t,n)&&M1(e,n,t[n]);if(gd)for(var n of gd(t))fT.call(t,n)&&M1(e,n,t[n]);return e},h$=(e,t)=>d$(e,f$(t)),p$=(e,t)=>{var n={};for(var r in e)dT.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&gd)for(var r of gd(e))t.indexOf(r)<0&&fT.call(e,r)&&(n[r]=e[r]);return n},fe=(e,t,n)=>{const r=p.forwardRef((o,i)=>{var s=o,{color:l="currentColor",size:c=24,stroke:u=2,children:d}=s,f=p$(s,["color","size","stroke","children"]);return p.createElement("svg",L1(h$(L1({ref:i},c$),{width:c,height:c,stroke:l,strokeWidth:u,className:`tabler-icon tabler-icon-${e}`}),f),[...n.map(([h,m])=>p.createElement(h,m)),...d||[]])});return r.propTypes={color:ze.string,size:ze.oneOfType([ze.string,ze.number]),stroke:ze.oneOfType([ze.string,ze.number])},r.displayName=`${t}`,r},m$=fe("adjustments-horizontal","IconAdjustmentsHorizontal",[["path",{d:"M14 6m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0",key:"svg-0"}],["path",{d:"M4 6l8 0",key:"svg-1"}],["path",{d:"M16 6l4 0",key:"svg-2"}],["path",{d:"M8 12m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0",key:"svg-3"}],["path",{d:"M4 12l2 0",key:"svg-4"}],["path",{d:"M10 12l10 0",key:"svg-5"}],["path",{d:"M17 18m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0",key:"svg-6"}],["path",{d:"M4 18l11 0",key:"svg-7"}],["path",{d:"M19 18l1 0",key:"svg-8"}]]),Cc=fe("alert-circle","IconAlertCircle",[["path",{d:"M3 12a9 9 0 1 0 18 0a9 9 0 0 0 -18 0",key:"svg-0"}],["path",{d:"M12 8v4",key:"svg-1"}],["path",{d:"M12 16h.01",key:"svg-2"}]]),g$=fe("arrow-down","IconArrowDown",[["path",{d:"M12 5l0 14",key:"svg-0"}],["path",{d:"M18 13l-6 6",key:"svg-1"}],["path",{d:"M6 13l6 6",key:"svg-2"}]]),y$=fe("arrow-up","IconArrowUp",[["path",{d:"M12 5l0 14",key:"svg-0"}],["path",{d:"M18 11l-6 -6",key:"svg-1"}],["path",{d:"M6 11l6 -6",key:"svg-2"}]]),v$=fe("bleach-off","IconBleachOff",[["path",{d:"M5 19h14m1.986 -1.977a2 2 0 0 0 -.146 -.773l-7.1 -12.25a2 2 0 0 0 -3.5 0l-.815 1.405m-1.488 2.568l-4.797 8.277a2 2 0 0 0 1.75 2.75",key:"svg-0"}],["path",{d:"M3 3l18 18",key:"svg-1"}]]),x$=fe("bleach","IconBleach",[["path",{d:"M5 19h14a2 2 0 0 0 1.84 -2.75l-7.1 -12.25a2 2 0 0 0 -3.5 0l-7.1 12.25a2 2 0 0 0 1.75 2.75",key:"svg-0"}]]),w$=fe("box-multiple","IconBoxMultiple",[["path",{d:"M7 3m0 2a2 2 0 0 1 2 -2h10a2 2 0 0 1 2 2v10a2 2 0 0 1 -2 2h-10a2 2 0 0 1 -2 -2z",key:"svg-0"}],["path",{d:"M17 17v2a2 2 0 0 1 -2 2h-10a2 2 0 0 1 -2 -2v-10a2 2 0 0 1 2 -2h2",key:"svg-1"}]]),S$=fe("brackets-contain","IconBracketsContain",[["path",{d:"M7 4h-4v16h4",key:"svg-0"}],["path",{d:"M17 4h4v16h-4",key:"svg-1"}],["path",{d:"M8 16h.01",key:"svg-2"}],["path",{d:"M12 16h.01",key:"svg-3"}],["path",{d:"M16 16h.01",key:"svg-4"}]]),b$=fe("brand-asana","IconBrandAsana",[["path",{d:"M12 7m-3 0a3 3 0 1 0 6 0a3 3 0 1 0 -6 0",key:"svg-0"}],["path",{d:"M17 16m-3 0a3 3 0 1 0 6 0a3 3 0 1 0 -6 0",key:"svg-1"}],["path",{d:"M7 16m-3 0a3 3 0 1 0 6 0a3 3 0 1 0 -6 0",key:"svg-2"}]]),C$=fe("bucket-off","IconBucketOff",[["path",{d:"M5.029 5.036c-.655 .58 -1.029 1.25 -1.029 1.964c0 2.033 3.033 3.712 6.96 3.967m3.788 -.21c3.064 -.559 5.252 -2.029 5.252 -3.757c0 -2.21 -3.582 -4 -8 -4c-1.605 0 -3.1 .236 -4.352 .643",key:"svg-0"}],["path",{d:"M4 7c0 .664 .088 1.324 .263 1.965l2.737 10.035c.5 1.5 2.239 2 5 2s4.5 -.5 5 -2c.1 -.3 .252 -.812 .457 -1.535m.862 -3.146c.262 -.975 .735 -2.76 1.418 -5.354a7.45 7.45 0 0 0 .263 -1.965",key:"svg-1"}],["path",{d:"M3 3l18 18",key:"svg-2"}]]),j$=fe("bucket","IconBucket",[["path",{d:"M12 7m-8 0a8 4 0 1 0 16 0a8 4 0 1 0 -16 0",key:"svg-0"}],["path",{d:"M4 7c0 .664 .088 1.324 .263 1.965l2.737 10.035c.5 1.5 2.239 2 5 2s4.5 -.5 5 -2c.333 -1 1.246 -4.345 2.737 -10.035a7.45 7.45 0 0 0 .263 -1.965",key:"svg-1"}]]),E$=fe("building","IconBuilding",[["path",{d:"M3 21l18 0",key:"svg-0"}],["path",{d:"M9 8l1 0",key:"svg-1"}],["path",{d:"M9 12l1 0",key:"svg-2"}],["path",{d:"M9 16l1 0",key:"svg-3"}],["path",{d:"M14 8l1 0",key:"svg-4"}],["path",{d:"M14 12l1 0",key:"svg-5"}],["path",{d:"M14 16l1 0",key:"svg-6"}],["path",{d:"M5 21v-16a2 2 0 0 1 2 -2h10a2 2 0 0 1 2 2v16",key:"svg-7"}]]),ki=fe("calendar","IconCalendar",[["path",{d:"M4 7a2 2 0 0 1 2 -2h12a2 2 0 0 1 2 2v12a2 2 0 0 1 -2 2h-12a2 2 0 0 1 -2 -2v-12z",key:"svg-0"}],["path",{d:"M16 3v4",key:"svg-1"}],["path",{d:"M8 3v4",key:"svg-2"}],["path",{d:"M4 11h16",key:"svg-3"}],["path",{d:"M11 15h1",key:"svg-4"}],["path",{d:"M12 15v3",key:"svg-5"}]]),Nf=fe("check","IconCheck",[["path",{d:"M5 12l5 5l10 -10",key:"svg-0"}]]),T$=fe("checkbox","IconCheckbox",[["path",{d:"M9 11l3 3l8 -8",key:"svg-0"}],["path",{d:"M20 12v6a2 2 0 0 1 -2 2h-12a2 2 0 0 1 -2 -2v-12a2 2 0 0 1 2 -2h9",key:"svg-1"}]]),P$=fe("chevron-down","IconChevronDown",[["path",{d:"M6 9l6 6l6 -6",key:"svg-0"}]]),k$=fe("circle-filled","IconCircleFilled",[["path",{d:"M7 3.34a10 10 0 1 1 -4.995 8.984l-.005 -.324l.005 -.324a10 10 0 0 1 4.995 -8.336z",fill:"currentColor",key:"svg-0",strokeWidth:"0"}]]),yd=fe("circle-minus","IconCircleMinus",[["path",{d:"M12 12m-9 0a9 9 0 1 0 18 0a9 9 0 1 0 -18 0",key:"svg-0"}],["path",{d:"M9 12l6 0",key:"svg-1"}]]),vd=fe("circle-plus","IconCirclePlus",[["path",{d:"M3 12a9 9 0 1 0 18 0a9 9 0 0 0 -18 0",key:"svg-0"}],["path",{d:"M9 12h6",key:"svg-1"}],["path",{d:"M12 9v6",key:"svg-2"}]]),wv=fe("cloud-upload","IconCloudUpload",[["path",{d:"M7 18a4.6 4.4 0 0 1 0 -9a5 4.5 0 0 1 11 2h1a3.5 3.5 0 0 1 0 7h-1",key:"svg-0"}],["path",{d:"M9 15l3 -3l3 3",key:"svg-1"}],["path",{d:"M12 12l0 9",key:"svg-2"}]]),R$=fe("columns","IconColumns",[["path",{d:"M4 6l5.5 0",key:"svg-0"}],["path",{d:"M4 10l5.5 0",key:"svg-1"}],["path",{d:"M4 14l5.5 0",key:"svg-2"}],["path",{d:"M4 18l5.5 0",key:"svg-3"}],["path",{d:"M14.5 6l5.5 0",key:"svg-4"}],["path",{d:"M14.5 10l5.5 0",key:"svg-5"}],["path",{d:"M14.5 14l5.5 0",key:"svg-6"}],["path",{d:"M14.5 18l5.5 0",key:"svg-7"}]]),hT=fe("copy","IconCopy",[["path",{d:"M7 7m0 2.667a2.667 2.667 0 0 1 2.667 -2.667h8.666a2.667 2.667 0 0 1 2.667 2.667v8.666a2.667 2.667 0 0 1 -2.667 2.667h-8.666a2.667 2.667 0 0 1 -2.667 -2.667z",key:"svg-0"}],["path",{d:"M4.012 16.737a2.005 2.005 0 0 1 -1.012 -1.737v-10c0 -1.1 .9 -2 2 -2h10c.75 0 1.158 .385 1.5 1",key:"svg-1"}]]),D$=fe("currency-dollar","IconCurrencyDollar",[["path",{d:"M16.7 8a3 3 0 0 0 -2.7 -2h-4a3 3 0 0 0 0 6h4a3 3 0 0 1 0 6h-4a3 3 0 0 1 -2.7 -2",key:"svg-0"}],["path",{d:"M12 3v3m0 12v3",key:"svg-1"}]]),I$=fe("device-floppy","IconDeviceFloppy",[["path",{d:"M6 4h10l4 4v10a2 2 0 0 1 -2 2h-12a2 2 0 0 1 -2 -2v-12a2 2 0 0 1 2 -2",key:"svg-0"}],["path",{d:"M12 14m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0",key:"svg-1"}],["path",{d:"M14 4l0 4l-6 0l0 -4",key:"svg-2"}]]),_$=fe("dots","IconDots",[["path",{d:"M5 12m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0",key:"svg-0"}],["path",{d:"M12 12m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0",key:"svg-1"}],["path",{d:"M19 12m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0",key:"svg-2"}]]),A$=fe("edit","IconEdit",[["path",{d:"M7 7h-1a2 2 0 0 0 -2 2v9a2 2 0 0 0 2 2h9a2 2 0 0 0 2 -2v-1",key:"svg-0"}],["path",{d:"M20.385 6.585a2.1 2.1 0 0 0 -2.97 -2.97l-8.415 8.385v3h3l8.385 -8.415z",key:"svg-1"}],["path",{d:"M16 5l3 3",key:"svg-2"}]]),Of=fe("equal-not","IconEqualNot",[["path",{d:"M5 10h14",key:"svg-0"}],["path",{d:"M5 14h14",key:"svg-1"}],["path",{d:"M5 19l14 -14",key:"svg-2"}]]),Mf=fe("equal","IconEqual",[["path",{d:"M5 10h14",key:"svg-0"}],["path",{d:"M5 14h14",key:"svg-1"}]]),$1=fe("file-alert","IconFileAlert",[["path",{d:"M14 3v4a1 1 0 0 0 1 1h4",key:"svg-0"}],["path",{d:"M17 21h-10a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2z",key:"svg-1"}],["path",{d:"M12 17l.01 0",key:"svg-2"}],["path",{d:"M12 11l0 3",key:"svg-3"}]]),N$=fe("file-plus","IconFilePlus",[["path",{d:"M14 3v4a1 1 0 0 0 1 1h4",key:"svg-0"}],["path",{d:"M17 21h-10a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2z",key:"svg-1"}],["path",{d:"M12 11l0 6",key:"svg-2"}],["path",{d:"M9 14l6 0",key:"svg-3"}]]),O$=fe("filter","IconFilter",[["path",{d:"M4 4h16v2.172a2 2 0 0 1 -.586 1.414l-4.414 4.414v7l-6 2v-8.5l-4.48 -4.928a2 2 0 0 1 -.52 -1.345v-2.227z",key:"svg-0"}]]),M$=fe("forms","IconForms",[["path",{d:"M12 3a3 3 0 0 0 -3 3v12a3 3 0 0 0 3 3",key:"svg-0"}],["path",{d:"M6 3a3 3 0 0 1 3 3v12a3 3 0 0 1 -3 3",key:"svg-1"}],["path",{d:"M13 7h7a1 1 0 0 1 1 1v8a1 1 0 0 1 -1 1h-7",key:"svg-2"}],["path",{d:"M5 7h-1a1 1 0 0 0 -1 1v8a1 1 0 0 0 1 1h1",key:"svg-3"}],["path",{d:"M17 12h.01",key:"svg-4"}],["path",{d:"M13 12h.01",key:"svg-5"}]]),L$=fe("id","IconId",[["path",{d:"M3 4m0 3a3 3 0 0 1 3 -3h12a3 3 0 0 1 3 3v10a3 3 0 0 1 -3 3h-12a3 3 0 0 1 -3 -3z",key:"svg-0"}],["path",{d:"M9 10m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0",key:"svg-1"}],["path",{d:"M15 8l2 0",key:"svg-2"}],["path",{d:"M15 12l2 0",key:"svg-3"}],["path",{d:"M7 16l10 0",key:"svg-4"}]]),$$=fe("list-details","IconListDetails",[["path",{d:"M13 5h8",key:"svg-0"}],["path",{d:"M13 9h5",key:"svg-1"}],["path",{d:"M13 15h8",key:"svg-2"}],["path",{d:"M13 19h5",key:"svg-3"}],["path",{d:"M3 4m0 1a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v4a1 1 0 0 1 -1 1h-4a1 1 0 0 1 -1 -1z",key:"svg-4"}],["path",{d:"M3 14m0 1a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v4a1 1 0 0 1 -1 1h-4a1 1 0 0 1 -1 -1z",key:"svg-5"}]]),F$=fe("lock-access","IconLockAccess",[["path",{d:"M4 8v-2a2 2 0 0 1 2 -2h2",key:"svg-0"}],["path",{d:"M4 16v2a2 2 0 0 0 2 2h2",key:"svg-1"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v2",key:"svg-2"}],["path",{d:"M16 20h2a2 2 0 0 0 2 -2v-2",key:"svg-3"}],["path",{d:"M8 11m0 1a1 1 0 0 1 1 -1h6a1 1 0 0 1 1 1v3a1 1 0 0 1 -1 1h-6a1 1 0 0 1 -1 -1z",key:"svg-4"}],["path",{d:"M10 11v-2a2 2 0 1 1 4 0v2",key:"svg-5"}]]),z$=fe("lock","IconLock",[["path",{d:"M5 13a2 2 0 0 1 2 -2h10a2 2 0 0 1 2 2v6a2 2 0 0 1 -2 2h-10a2 2 0 0 1 -2 -2v-6z",key:"svg-0"}],["path",{d:"M11 16a1 1 0 1 0 2 0a1 1 0 0 0 -2 0",key:"svg-1"}],["path",{d:"M8 11v-4a4 4 0 1 1 8 0v4",key:"svg-2"}]]),B$=fe("logout","IconLogout",[["path",{d:"M14 8v-2a2 2 0 0 0 -2 -2h-7a2 2 0 0 0 -2 2v12a2 2 0 0 0 2 2h7a2 2 0 0 0 2 -2v-2",key:"svg-0"}],["path",{d:"M9 12h12l-3 -3",key:"svg-1"}],["path",{d:"M18 15l3 -3",key:"svg-2"}]]),pT=fe("math-greater","IconMathGreater",[["path",{d:"M5 18l14 -6l-14 -6",key:"svg-0"}]]),mT=fe("math-lower","IconMathLower",[["path",{d:"M19 18l-14 -6l14 -6",key:"svg-0"}]]),U$=fe("message","IconMessage",[["path",{d:"M8 9h8",key:"svg-0"}],["path",{d:"M8 13h6",key:"svg-1"}],["path",{d:"M18 4a3 3 0 0 1 3 3v8a3 3 0 0 1 -3 3h-5l-5 3v-3h-2a3 3 0 0 1 -3 -3v-8a3 3 0 0 1 3 -3h12z",key:"svg-2"}]]),V$=fe("microscope","IconMicroscope",[["path",{d:"M5 21h14",key:"svg-0"}],["path",{d:"M6 18h2",key:"svg-1"}],["path",{d:"M7 18v3",key:"svg-2"}],["path",{d:"M9 11l3 3l6 -6l-3 -3z",key:"svg-3"}],["path",{d:"M10.5 12.5l-1.5 1.5",key:"svg-4"}],["path",{d:"M17 3l3 3",key:"svg-5"}],["path",{d:"M12 21a6 6 0 0 0 3.715 -10.712",key:"svg-6"}]]),H$=fe("packages","IconPackages",[["path",{d:"M7 16.5l-5 -3l5 -3l5 3v5.5l-5 3z",key:"svg-0"}],["path",{d:"M2 13.5v5.5l5 3",key:"svg-1"}],["path",{d:"M7 16.545l5 -3.03",key:"svg-2"}],["path",{d:"M17 16.5l-5 -3l5 -3l5 3v5.5l-5 3z",key:"svg-3"}],["path",{d:"M12 19l5 3",key:"svg-4"}],["path",{d:"M17 16.5l5 -3",key:"svg-5"}],["path",{d:"M12 13.5v-5.5l-5 -3l5 -3l5 3v5.5",key:"svg-6"}],["path",{d:"M7 5.03v5.455",key:"svg-7"}],["path",{d:"M12 8l5 -3",key:"svg-8"}]]),W$=fe("pin","IconPin",[["path",{d:"M15 4.5l-4 4l-4 1.5l-1.5 1.5l7 7l1.5 -1.5l1.5 -4l4 -4",key:"svg-0"}],["path",{d:"M9 15l-4.5 4.5",key:"svg-1"}],["path",{d:"M14.5 4l5.5 5.5",key:"svg-2"}]]),q$=fe("pinned-off","IconPinnedOff",[["path",{d:"M3 3l18 18",key:"svg-0"}],["path",{d:"M15 4.5l-3.249 3.249m-2.57 1.433l-2.181 .818l-1.5 1.5l7 7l1.5 -1.5l.82 -2.186m1.43 -2.563l3.25 -3.251",key:"svg-1"}],["path",{d:"M9 15l-4.5 4.5",key:"svg-2"}],["path",{d:"M14.5 4l5.5 5.5",key:"svg-3"}]]),G$=fe("player-play","IconPlayerPlay",[["path",{d:"M7 4v16l13 -8z",key:"svg-0"}]]),Q$=fe("plus","IconPlus",[["path",{d:"M12 5l0 14",key:"svg-0"}],["path",{d:"M5 12l14 0",key:"svg-1"}]]),K$=fe("receipt","IconReceipt",[["path",{d:"M5 21v-16a2 2 0 0 1 2 -2h10a2 2 0 0 1 2 2v16l-3 -2l-2 2l-2 -2l-2 2l-2 -2l-3 2m4 -14h6m-6 4h6m-2 4h2",key:"svg-0"}]]),Y$=fe("refresh","IconRefresh",[["path",{d:"M20 11a8.1 8.1 0 0 0 -15.5 -2m-.5 -4v4h4",key:"svg-0"}],["path",{d:"M4 13a8.1 8.1 0 0 0 15.5 2m.5 4v-4h-4",key:"svg-1"}]]),X$=fe("report-medical","IconReportMedical",[["path",{d:"M9 5h-2a2 2 0 0 0 -2 2v12a2 2 0 0 0 2 2h10a2 2 0 0 0 2 -2v-12a2 2 0 0 0 -2 -2h-2",key:"svg-0"}],["path",{d:"M9 3m0 2a2 2 0 0 1 2 -2h2a2 2 0 0 1 2 2v0a2 2 0 0 1 -2 2h-2a2 2 0 0 1 -2 -2z",key:"svg-1"}],["path",{d:"M10 14l4 0",key:"svg-2"}],["path",{d:"M12 12l0 4",key:"svg-3"}]]),J$=fe("search","IconSearch",[["path",{d:"M10 10m-7 0a7 7 0 1 0 14 0a7 7 0 1 0 -14 0",key:"svg-0"}],["path",{d:"M21 21l-6 -6",key:"svg-1"}]]),cm=fe("settings","IconSettings",[["path",{d:"M10.325 4.317c.426 -1.756 2.924 -1.756 3.35 0a1.724 1.724 0 0 0 2.573 1.066c1.543 -.94 3.31 .826 2.37 2.37a1.724 1.724 0 0 0 1.065 2.572c1.756 .426 1.756 2.924 0 3.35a1.724 1.724 0 0 0 -1.066 2.573c.94 1.543 -.826 3.31 -2.37 2.37a1.724 1.724 0 0 0 -2.572 1.065c-.426 1.756 -2.924 1.756 -3.35 0a1.724 1.724 0 0 0 -2.573 -1.066c-1.543 .94 -3.31 -.826 -2.37 -2.37a1.724 1.724 0 0 0 -1.065 -2.572c-1.756 -.426 -1.756 -2.924 0 -3.35a1.724 1.724 0 0 0 1.066 -2.573c-.94 -1.543 .826 -3.31 2.37 -2.37c1 .608 2.296 .07 2.572 -1.065z",key:"svg-0"}],["path",{d:"M9 12a3 3 0 1 0 6 0a3 3 0 0 0 -6 0",key:"svg-1"}]]),Sv=fe("sort-ascending","IconSortAscending",[["path",{d:"M4 6l7 0",key:"svg-0"}],["path",{d:"M4 12l7 0",key:"svg-1"}],["path",{d:"M4 18l9 0",key:"svg-2"}],["path",{d:"M15 9l3 -3l3 3",key:"svg-3"}],["path",{d:"M18 6l0 12",key:"svg-4"}]]),bv=fe("sort-descending","IconSortDescending",[["path",{d:"M4 6l9 0",key:"svg-0"}],["path",{d:"M4 12l7 0",key:"svg-1"}],["path",{d:"M4 18l7 0",key:"svg-2"}],["path",{d:"M15 15l3 3l3 -3",key:"svg-3"}],["path",{d:"M18 6l0 12",key:"svg-4"}]]),Z$=fe("square","IconSquare",[["path",{d:"M3 3m0 2a2 2 0 0 1 2 -2h14a2 2 0 0 1 2 2v14a2 2 0 0 1 -2 2h-14a2 2 0 0 1 -2 -2z",key:"svg-0"}]]),e7=fe("star","IconStar",[["path",{d:"M12 17.75l-6.172 3.245l1.179 -6.873l-5 -4.867l6.9 -1l3.086 -6.253l3.086 6.253l6.9 1l-5 4.867l1.179 6.873z",key:"svg-0"}]]),t7=fe("switch-horizontal","IconSwitchHorizontal",[["path",{d:"M16 3l4 4l-4 4",key:"svg-0"}],["path",{d:"M10 7l10 0",key:"svg-1"}],["path",{d:"M8 13l-4 4l4 4",key:"svg-2"}],["path",{d:"M4 17l9 0",key:"svg-3"}]]),n7=fe("table-export","IconTableExport",[["path",{d:"M12.5 21h-7.5a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h14a2 2 0 0 1 2 2v7.5",key:"svg-0"}],["path",{d:"M3 10h18",key:"svg-1"}],["path",{d:"M10 3v18",key:"svg-2"}],["path",{d:"M16 19h6",key:"svg-3"}],["path",{d:"M19 16l3 3l-3 3",key:"svg-4"}]]),gT=fe("trash","IconTrash",[["path",{d:"M4 7l16 0",key:"svg-0"}],["path",{d:"M10 11l0 6",key:"svg-1"}],["path",{d:"M14 11l0 6",key:"svg-2"}],["path",{d:"M5 7l1 12a2 2 0 0 0 2 2h8a2 2 0 0 0 2 -2l1 -12",key:"svg-3"}],["path",{d:"M9 7v-3a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v3",key:"svg-4"}]]),F1=fe("upload","IconUpload",[["path",{d:"M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-2",key:"svg-0"}],["path",{d:"M7 9l5 -5l5 5",key:"svg-1"}],["path",{d:"M12 4l0 12",key:"svg-2"}]]),r7=fe("webhook","IconWebhook",[["path",{d:"M4.876 13.61a4 4 0 1 0 6.124 3.39h6",key:"svg-0"}],["path",{d:"M15.066 20.502a4 4 0 1 0 1.934 -7.502c-.706 0 -1.424 .179 -2 .5l-3 -5.5",key:"svg-1"}],["path",{d:"M16 8a4 4 0 1 0 -8 0c0 1.506 .77 2.818 2 3.5l-3 5.5",key:"svg-2"}]]),xd=fe("x","IconX",[["path",{d:"M18 6l-12 12",key:"svg-0"}],["path",{d:"M6 6l12 12",key:"svg-1"}]]);class yT extends p.Component{constructor(t){super(t),this.state={lastLocation:window.location.toString()}}static getDerivedStateFromError(t){return{error:t,lastLocation:window.location.toString()}}componentDidUpdate(t,n){window.location.toString()!==this.state.lastLocation&&this.setState({lastLocation:window.location.toString(),error:void 0})}shouldComponentUpdate(t,n){return!!(this.props.children!==t.children||n.error&&!this.state.error||this.state.lastLocation!==window.location.toString())}componentDidCatch(t,n){console.error("Uncaught error:",t,n)}render(){return this.state.error?a.jsx(us,{icon:a.jsx(Cc,{size:16}),title:"Something went wrong",color:"red",children:Pe(this.state.error)}):this.props.children}}function Ir(){return a.jsx(Ut,{style:{width:"100%",height:"100vh"},children:a.jsx(Nn,{})})}const o7="_main_1szoq_1",i7={main:o7};function Cv(e){const t=e.value;return t?a.jsx(a.Fragment,{children:Sc(t,e.options)}):null}function et(e){e.preventDefault(),e.stopPropagation()}function vT(e){if(z1(e))return!0;if(e instanceof HTMLTableCellElement){const t=e.children;if(t.length===1&&z1(t[0]))return!0}return!1}function z1(e){return e instanceof HTMLInputElement&&e.type==="checkbox"}function Ae(e){const t=Af(),{to:n,suffix:r,label:o,onClick:i,children:s,...l}=e;let c=s7(n);return r&&(c+="/"+r),a.jsx(Ue,{href:c,"aria-label":o,onClick:u=>{et(u),i?i(u):n&&t(c)},...l,children:s})}function s7(e){if(e){if(typeof e=="string")return a7(e);if(Io(e))return l7(e);if(ys(e))return c7(e)}return"#"}function a7(e){return e.startsWith("http://")||e.startsWith("https://")||e.startsWith("/")?e:"/"+e}function l7(e){return`/${e.resourceType}/${e.id}`}function c7(e){return`/${e.reference}`}function mi(e){const t=st(e.value),n=t?xo(t):e.alt??"",r=(t&&J5(t))??e.src,o=e.radius??"xl",i={...e};return delete i.value,delete i.link,e.link?a.jsx(Ae,{to:t,children:a.jsx(Yi,{src:r,alt:n,radius:o,...i})}):a.jsx(Yi,{src:r,alt:n,radius:o,...i})}const u7="_logoButton_189g3_1",d7="_user_189g3_11",f7="_userName_189g3_21",h7="_userActive_189g3_31",cu={logoButton:u7,user:d7,userName:f7,userActive:h7};function jv(e){const t=yy({onDropdownClose:()=>t.resetSelectedOption(),onDropdownOpen:()=>t.updateSelectedOptionIndex("active")}),{name:n,label:r,description:o,error:i,defaultValue:s,toOption:l,loadOptions:c,itemComponent:u,onChange:d,onCreate:f,creatable:h,clearable:m,required:g,placeholder:y,leftSection:C,maxValues:v,...x}=e,w=p7(s),[S,E]=p.useState(""),[j,T]=p.useState(),[P,R]=p.useState(),[I,O]=p.useState(),[D,A]=p.useState(w.map(l)),[M,B]=p.useState([]),F=u??m7,_=p.useRef();_.current=S;const k=p.useRef(),z=p.useRef(),q=p.useRef();q.current=j;const Q=p.useRef();Q.current=P;const re=p.useRef();re.current=I;const Ce=p.useRef();Ce.current=M;const Re=p.useCallback(()=>{if(T(void 0),_.current===z.current&&c===k.current)return;z.current=_.current,k.current=c;const pe=new AbortController;R(pe),c(_.current??"",pe.signal).then(Fe=>{pe.signal.aborted||(B(Fe.map(l)),R(void 0),re.current?(Fe.length>0&&d(Fe.slice(0,1)),O(!1)):Fe.length>0&&t.openDropdown())}).catch(Fe=>{pe.signal.aborted||Fe.message.includes("aborted")||ce({color:"red",message:Pe(Fe)})})},[t,c,d,l]),Oe=p.useCallback(pe=>{M&&M.length>0&&t.openDropdown(),t.updateSelectedOptionIndex(),E(pe.currentTarget.value),Q.current&&(Q.current.abort(),R(void 0)),q.current!==void 0&&window.clearTimeout(q.current);const Fe=window.setTimeout(()=>Re(),100);T(Fe)},[t,M,Re]),ve=p.useCallback(pe=>{const Fe=[],Ne=[...D];let tt=M==null?void 0:M.find(Fn=>Fn.value===pe),nt=tt==null?void 0:tt.resource;if(!nt&&h!==!1&&f&&(nt=f(pe),tt=l(nt)),nt&&Fe.push(nt),tt&&Ne.push(tt),v!==void 0)for(;Ne.length>v;)Ne.shift();d(Fe),A(Ne)},[h,M,D,v,d,f,l]),Ve=pe=>{E(""),B([]),z.current=void 0,ve(pe==="$create"?S:pe)},Je=p.useCallback(pe=>{const Fe=D.filter(Ne=>Ne.value!==pe.value);d(Fe.map(Ne=>Ne.resource)),A(Fe)},[D,d]),at=p.useCallback(pe=>{pe.key==="Enter"?!j&&!P?(et(pe),M&&M.length>0&&(B(M.slice(0,1)),ve(M[0].value))):O(!0):pe.key==="Backspace"&&S.length===0&&(et(pe),Je(D[D.length-1]))},[S,D,M,j,P,ve,Je]);p.useEffect(()=>()=>{Q.current&&Q.current.abort()},[]);const Ft=m&&D.length>0&&a.jsx(Me.ClearButton,{title:"Clear all",size:16,onClear:()=>{E(""),A([]),d([])}});return a.jsxs(Me,{store:t,onOptionSubmit:Ve,withinPortal:!0,shadow:"xl",...x,children:[a.jsx(Me.DropdownTarget,{children:a.jsx(ga,{label:r,description:o,error:i,className:e.className,leftSection:C,rightSection:P?a.jsx(Nn,{size:16}):Ft,required:g,children:a.jsxs(Xi.Group,{children:[D.map(pe=>a.jsx(Xi,{withRemoveButton:!0,onRemove:()=>Je(pe),children:pe.label},pe.value)),a.jsx(Me.EventsTarget,{children:a.jsx(ga.Field,{role:"searchbox",name:n,value:S,placeholder:y,onFocus:Oe,onBlur:()=>t.closeDropdown(),onKeyDown:at,onChange:Oe})})]})})}),a.jsx(Me.Dropdown,{children:a.jsxs(Me.Options,{children:[M.map(pe=>a.jsx(Me.Option,{value:pe.value,active:D.includes(pe),children:a.jsx(F,{...pe})},pe.value)),h&&S.trim().length>0&&a.jsxs(Me.Option,{value:"$create",children:["+ Create ",S]}),!h&&S.trim().length>0&&M.length===0&&a.jsx(Me.Empty,{children:"Nothing found"})]})})]})}function p7(e){return e?Array.isArray(e)?e:[e]:[]}function m7(e){return a.jsx(Y,{gap:"sm",children:a.jsx("span",{children:e.label})})}const g7="_searchInput_dick8_1",y7={searchInput:g7};function v7(e){return{value:e.id,label:xo(e),resource:e}}function x7(e){const t=Af(),n=te(),r=p.useCallback(async(i,s)=>{const l=S7(i),c={signal:s},u=await n.graphql(l,void 0,void 0,c);return b7(u,i)},[n]),o=p.useCallback(i=>{i.length>0&&t(`/${ht(i[0])}`)},[t]);return a.jsx(jv,{size:"sm",radius:"md",className:y7.searchInput,leftSection:a.jsx(J$,{size:16}),placeholder:"Search",itemComponent:w7,toOption:v7,onChange:o,loadOptions:r,maxValues:0,clearable:!1},`${e.pathname}?${e.searchParams}`)}const w7=p.forwardRef(({resource:e,...t},n)=>{var o;let r;return e.resourceType==="Patient"?r=e.birthDate:e.resourceType==="ServiceRequest"&&(r=(o=e.subject)==null?void 0:o.display),a.jsx("div",{ref:n,...t,children:a.jsxs(Y,{wrap:"nowrap",children:[a.jsx(mi,{value:e}),a.jsxs("div",{children:[a.jsx(le,{children:xo(e)}),a.jsx(le,{size:"xs",c:"dimmed",children:r})]})]})})});function S7(e){const t=JSON.stringify(e);return ME(e)?`{
125
- Patients1: PatientList(_id: ${t}, _count: 1) {
126
- resourceType
127
- id
128
- identifier {
129
- system
130
- value
131
- }
132
- name {
133
- given
134
- family
135
- }
136
- birthDate
137
- }
138
- ServiceRequestList(_id: ${t}, _count: 1) {
139
- resourceType
140
- id
141
- identifier {
142
- system
143
- value
144
- }
145
- subject {
146
- display
147
- }
148
- }
149
- }`.replace(/\s+/g," "):`{
150
- Patients1: PatientList(name: ${t}, _count: 5) {
151
- resourceType
152
- id
153
- identifier {
154
- system
155
- value
156
- }
157
- name {
158
- given
159
- family
160
- }
161
- birthDate
162
- }
163
- Patients2: PatientList(identifier: ${t}, _count: 5) {
164
- resourceType
165
- id
166
- identifier {
167
- system
168
- value
169
- }
170
- name {
171
- given
172
- family
173
- }
174
- birthDate
175
- }
176
- ServiceRequestList(identifier: ${t}, _count: 5) {
177
- resourceType
178
- id
179
- identifier {
180
- system
181
- value
182
- }
183
- subject {
184
- display
185
- }
186
- }
187
- }`.replace(/\s+/g," ")}function b7(e,t){const n=[];return e.data.Patients1&&n.push(...e.data.Patients1),e.data.Patients2&&n.push(...e.data.Patients2),e.data.ServiceRequestList&&n.push(...e.data.ServiceRequestList),j7(C7(n),t).slice(0,5)}function C7(e){const t=new Set,n=[];for(const r of e)t.has(r.id)||(t.add(r.id),n.push(r));return n}function j7(e,t){return e.sort((n,r)=>B1(r,t)-B1(n,t))}function B1(e,t){let n=0;if(e.identifier)for(const r of e.identifier)n=Math.max(n,U1(r.value,t));if(e.resourceType==="Patient"&&e.name)for(const r of e.name)n=Math.max(n,U1(Sc(r),t));return n}function U1(e,t){if(!e)return 0;const n=e.toLowerCase().indexOf(t.toLowerCase());return n<0?0:100-n}function E7(e){var c,u,d,f;const t=_f(),{medplum:n,profile:r,navigate:o}=t,i=n.getLogins(),[s,l]=p.useState(!1);return a.jsx(An.Header,{p:8,style:{zIndex:101},children:a.jsxs(Y,{justify:"space-between",children:[a.jsxs(Y,{gap:"xs",children:[a.jsx(Gn,{className:cu.logoButton,onClick:e.navbarToggle,children:e.logo}),!e.headerSearchDisabled&&a.jsx(x7,{pathname:e.pathname,searchParams:e.searchParams})]}),a.jsxs(X,{width:260,shadow:"xl",position:"bottom-end",transitionProps:{transition:"pop-top-right"},opened:s,onClose:()=>l(!1),children:[a.jsx(X.Target,{children:a.jsx(Gn,{className:Ye(cu.user,{[cu.userActive]:s}),onClick:()=>l(h=>!h),children:a.jsxs(Y,{gap:7,children:[a.jsx(mi,{value:r,radius:"xl",size:24}),a.jsx(le,{size:"sm",className:cu.userName,children:Sc((c=r==null?void 0:r.name)==null?void 0:c[0])}),a.jsx(P$,{size:12,stroke:1.5})]})})}),a.jsxs(X.Dropdown,{children:[a.jsxs(Se,{align:"center",p:"xl",children:[a.jsx(mi,{size:"xl",radius:100,value:t.profile}),a.jsx(Cv,{value:(d=(u=t.profile)==null?void 0:u.name)==null?void 0:d[0]}),a.jsx(le,{c:"dimmed",size:"xs",children:(f=n.getActiveLogin())==null?void 0:f.project.display})]}),i.length>1&&a.jsx(X.Divider,{}),i.map(h=>h.profile.reference!==ht(t.profile)&&a.jsx(X.Item,{onClick:()=>{n.setActiveLogin(h).then(()=>window.location.reload()).catch(console.log)},children:a.jsxs(Y,{children:[a.jsx(Yi,{radius:"xl"}),a.jsxs("div",{style:{flex:1},children:[a.jsx(le,{size:"sm",fw:500,children:h.profile.display}),a.jsx(le,{c:"dimmed",size:"xs",children:h.project.display})]})]})},h.profile.reference)),a.jsx(X.Divider,{}),a.jsx(X.Item,{leftSection:a.jsx(t7,{size:14,stroke:1.5}),onClick:()=>o("/signin"),children:"Add another account"}),a.jsx(X.Item,{leftSection:a.jsx(cm,{size:14,stroke:1.5}),onClick:()=>o(`/${ht(r)}`),children:"Account settings"}),a.jsx(X.Item,{leftSection:a.jsx(B$,{size:14,stroke:1.5}),onClick:async()=>{await n.signOut(),o("/signin")},children:"Sign out"}),a.jsx(le,{size:"xs",c:"dimmed",ta:"center",children:e.version})]})]})]})})}function T7(e){const t={};for(const n of Array.from(e.elements))n instanceof HTMLInputElement?P7(t,n):n instanceof HTMLTextAreaElement?t[n.name]=n.value:n instanceof HTMLSelectElement&&k7(t,n);return t}function P7(e,t){t.disabled||(t.type==="checkbox"||t.type==="radio")&&!t.checked||(e[t.name]=t.value)}function k7(e,t){e[t.name]=t.value}function Be(e){return a.jsx("form",{style:e.style,"data-testid":e.testid,onSubmit:t=>{t.preventDefault();const n=T7(t.target);e.onSubmit&&e.onSubmit(n)},children:e.children})}function R7(e){const t=te(),n=t.getUserConfiguration();function r(o){var d,f;const{menuname:i,bookmarkname:s}=o,l=`${e.pathname}?${e.searchParams.toString()}`,c=Si(n),u=(d=c.menu)==null?void 0:d.find(({title:h})=>h===i);(f=u==null?void 0:u.link)==null||f.push({name:s,target:l}),t.updateResource(c).then(h=>{n.menu=h.menu,t.dispatchEvent({type:"change"}),ce({color:"green",message:"Success"}),e.onOk()}).catch(h=>{ce({color:"red",message:Pe(h)})})}return a.jsx(bn,{title:"Add Bookmark",closeButtonProps:{"aria-label":"Close"},opened:e.visible,onClose:e.onCancel,children:a.jsx(Be,{onSubmit:r,children:a.jsxs(Se,{children:[a.jsx(D7,{config:n}),a.jsx(ie,{label:"Bookmark Name",type:"text",name:"bookmarkname",placeholder:"Bookmark Name",withAsterisk:!0}),a.jsx(Y,{justify:"flex-end",children:a.jsx(Z,{mt:"sm",type:"submit",children:"OK"})})]})})})}function D7(e){function t(r){var o;return(o=r==null?void 0:r.menu)==null?void 0:o.map(i=>i.title)}const n=t(e.config);return a.jsx(mt,{name:"menuname",defaultValue:n[0],label:"Select Menu Option",data:n,withAsterisk:!0})}function xT(e){return typeof e.code=="string"?e.code:JSON.stringify(e)}function I7(e){return typeof e.display=="string"?e.display:xT(e)}function _7(e){return{value:xT(e),label:I7(e),resource:e}}function A7(e){return{code:e,display:e}}function Ev(e){const t=te(),{binding:n,creatable:r,clearable:o,expandParams:i,...s}=e,l=p.useCallback(async(c,u)=>{var m;if(!n)return[];const f=(m=(await t.valueSetExpand({...i,url:n,filter:c},{signal:u})).expansion)==null?void 0:m.contains,h=[];for(const g of f)g.code&&!h.some(y=>y.code===g.code)&&h.push(g);return h},[t,i,n]);return a.jsx(jv,{...s,creatable:r??!0,clearable:o??!0,toOption:_7,loadOptions:l,onCreate:A7})}function wT(e){const{defaultValue:t,onChange:n,...r}=e,[o,i]=p.useState(t);function s(l){const c=l[0],u=O7(c);i(u),n&&n(u)}return a.jsx(Ev,{defaultValue:N7(o),onChange:s,...r})}function N7(e){return e?{code:e}:void 0}function O7(e){return e==null?void 0:e.code}function Tv(e){const[t,n]=p.useState(e.defaultValue),r=e.onChange,o=p.useCallback(i=>{n(i),r&&r(i)},[r]);return a.jsx(wT,{"data-autofocus":e.autoFocus,"data-testid":e.testId,defaultValue:t,onChange:o,name:e.name,placeholder:e.placeholder,binding:"https://medplum.com/fhir/ValueSet/resource-types",creatable:!1,maxValues:0,clearable:!1})}const M7="_menuTitle_9g6l5_1",L7="_link_9g6l5_9",$7="_linkActive_9g6l5_38",um={menuTitle:M7,link:L7,linkActive:$7};function F7(e){var l;const t=Af(),n=U7(e.pathname,e.searchParams,e.menus),[r,o]=p.useState(!1);function i(c,u){c.stopPropagation(),c.preventDefault(),t(u),window.innerWidth<768&&e.closeNavbar()}function s(c){c&&t(`/${c}`)}return a.jsxs(a.Fragment,{children:[a.jsx(An.Navbar,{children:a.jsxs(fr,{p:"xs",children:[!e.resourceTypeSearchDisabled&&a.jsx(An.Section,{mb:"sm",children:a.jsx(Tv,{name:"resourceType",placeholder:"Resource Type",onChange:c=>s(c)},window.location.pathname)}),a.jsxs(An.Section,{grow:!0,children:[(l=e.menus)==null?void 0:l.map(c=>{var u;return a.jsxs(p.Fragment,{children:[a.jsx(le,{className:um.menuTitle,children:c.title}),(u=c.links)==null?void 0:u.map(d=>a.jsxs(z7,{to:d.href,active:d.href===(n==null?void 0:n.href),onClick:f=>i(f,d.href),children:[a.jsx(B7,{to:d.href,icon:d.icon}),a.jsx("span",{children:d.label})]},d.href))]},`menu-${c.title}`)}),e.displayAddBookmark&&a.jsx(Z,{variant:"subtle",size:"xs",mt:"xl",leftSection:a.jsx(Q$,{size:"0.75rem"}),onClick:()=>o(!0),children:"Add Bookmark"})]})]})}),e.pathname&&e.searchParams&&a.jsx(R7,{pathname:e.pathname,searchParams:e.searchParams,visible:r,onOk:()=>o(!1),onCancel:()=>o(!1)})]})}function z7(e){return a.jsx(Ae,{onClick:e.onClick,to:e.to,className:Ye(um.link,{[um.linkActive]:e.active}),children:e.children})}function B7(e){return e.icon?e.icon:a.jsx(Tf,{w:30})}function U7(e,t,n){if(!e||!t||!n)return;let r,o=0;for(const i of n)if(i.links)for(const s of i.links){const l=V7(e,t,s.href);l>o&&(o=l,r=s)}return r}function V7(e,t,n){const r=new URL(n,"https://example.com");if(e!==r.pathname)return 0;const o=["_count","_offset"];for(const[s,l]of r.searchParams.entries())if(!o.includes(s)&&t.get(s)!==l)return 0;let i=1;for(const[s,l]of t.entries())o.includes(s)||r.searchParams.get(s)===l&&i++;return i}function H7(e){const[t,n]=p.useState(localStorage.navbarOpen==="true"),r=te(),o=xv();p.useEffect(()=>{function c(){ce({color:"red",message:"No connection to server",autoClose:!1})}return r.addEventListener("offline",c),()=>r.removeEventListener("offline",c)},[r]);function i(c){localStorage.navbarOpen=c.toString(),n(c)}function s(){i(!1)}function l(){i(!t)}return r.isLoading()?a.jsx(Ir,{}):a.jsxs(An,{header:{height:60},navbar:{width:250,breakpoint:"sm",collapsed:{desktop:!o||!t,mobile:!o||!t}},padding:0,children:[o&&a.jsx(E7,{pathname:e.pathname,searchParams:e.searchParams,headerSearchDisabled:e.headerSearchDisabled,logo:e.logo,version:e.version,navbarToggle:l}),o&&t?a.jsx(F7,{pathname:e.pathname,searchParams:e.searchParams,menus:e.menus,closeNavbar:s,displayAddBookmark:e.displayAddBookmark,resourceTypeSearchDisabled:e.resourceTypeSearchDisabled}):void 0,a.jsx(An.Main,{className:i7.main,children:a.jsx(yT,{children:a.jsx(p.Suspense,{fallback:a.jsx(Ir,{}),children:e.children})})})]})}function jc(e){const{contentType:t,url:n,title:r}=e.value??{};return n?a.jsxs("div",{"data-testid":"attachment-display",children:[(t==null?void 0:t.startsWith("image/"))&&a.jsx("img",{"data-testid":"attachment-image",style:{maxWidth:e.maxWidth},src:n,alt:r}),(t==null?void 0:t.startsWith("video/"))&&a.jsx("video",{"data-testid":"attachment-video",style:{maxWidth:e.maxWidth},controls:!0,children:a.jsx("source",{type:t,src:n})}),t==="application/pdf"&&a.jsx("div",{"data-testid":"attachment-pdf",style:{maxWidth:e.maxWidth,minHeight:400},children:a.jsx("iframe",{width:"100%",height:"400",src:n+"#navpanes=0",allowFullScreen:!0,frameBorder:0,seamless:!0})}),a.jsx("div",{"data-testid":"download-link",style:{padding:"2px 16px 16px 16px"},children:a.jsx(Ue,{href:n,"data-testid":"attachment-details",target:"_blank",rel:"noopener noreferrer",download:W7(r),children:r||"Download"})})]}):null}function W7(e){return e!=null&&e.includes(".")?e:void 0}function q7(e){var t;return a.jsx("div",{children:(t=e.values)==null?void 0:t.map((n,r)=>a.jsx("div",{children:a.jsx(jc,{value:n,maxWidth:e.maxWidth})},"attatchment-"+r))})}function Pv(e){const t=te(),n=p.useRef(null);function r(s){var l;et(s),(l=n.current)==null||l.click()}function o(s){et(s);const l=s.target.files;l&&Array.from(l).forEach(i)}function i(s){if(!s||!s.name)return;e.onUploadStart&&e.onUploadStart();const c=s.name,u=s.type||"application/octet-stream";t.createBinary(s,c,u,e.onUploadProgress).then(d=>{e.onUpload({contentType:d.contentType,url:d.url,title:c})}).catch(d=>{e.onUploadError&&e.onUploadError(ut(d))})}return a.jsxs(a.Fragment,{children:[a.jsx("input",{type:"file","data-testid":"upload-file-input",style:{display:"none"},ref:n,onChange:s=>o(s)}),e.children({onClick:r})]})}function G7(e){const[t,n]=p.useState(e.defaultValue??[]),r=p.useRef();r.current=t;function o(i){n(i),e.onChange&&e.onChange(i)}return a.jsxs("table",{style:{width:"100%"},children:[a.jsxs("colgroup",{children:[a.jsx("col",{width:"97%"}),a.jsx("col",{width:"3%"})]}),a.jsxs("tbody",{children:[t.map((i,s)=>a.jsxs("tr",{children:[a.jsx("td",{children:a.jsx(jc,{value:i,maxWidth:200})}),a.jsx("td",{children:a.jsx(Ht,{title:"Remove",variant:"subtle",size:"sm",color:"gray",onClick:l=>{et(l);const c=t.slice();c.splice(s,1),o(c)},children:a.jsx(yd,{})})})]},`${s}-${t.length}`)),a.jsxs("tr",{children:[a.jsx("td",{}),a.jsx("td",{children:a.jsx(Pv,{onUpload:i=>{o([...r.current,i])},children:i=>a.jsx(Ht,{...i,title:"Add",variant:"subtle",size:"sm",color:"green",children:a.jsx(wv,{})})})})]})]})]})}function ST(e){const[t,n]=p.useState(e.defaultValue);function r(o){n(o),e.onChange&&e.onChange(o)}return t?a.jsxs(a.Fragment,{children:[a.jsx(jc,{value:t,maxWidth:200}),a.jsx(Z,{onClick:o=>{et(o),r(void 0)},children:"Remove"})]}):a.jsx(Pv,{onUpload:r,children:o=>a.jsx(Z,{...o,children:"Upload..."})})}const bT=["meta","implicitRules","contained","extension","modifierExtension"],CT=["language","text"],Q7="_root_1b4d2_1",K7="_compact_1b4d2_14",V1={root:Q7,compact:K7};function kv(e){const{children:t,compact:n}=e;return a.jsx("dl",{className:Ye(V1.root,{[V1.compact]:n}),children:t})}function ta(e){return a.jsxs(a.Fragment,{children:[a.jsx("dt",{children:e.term}),a.jsx("dd",{children:e.children})]})}function Yr(e){return a.jsx(a.Fragment,{children:va(e.value)})}function Y7(e){return a.jsx(a.Fragment,{children:ms(e.value)})}function jT(e){const t=e.value;if(!t)return null;const n=[];return t.value&&n.push(t.value),(t.use||t.system)&&(n.push(" ["),t.use&&n.push(t.use),t.use&&t.system&&n.push(" "),t.system&&n.push(t.system),n.push("]")),a.jsx(a.Fragment,{children:n.join("").trim()})}function X7(e){var n;const t=e.value;return t?a.jsxs(a.Fragment,{children:[t.name,t.name&&": ",(n=t.telecom)==null?void 0:n.map(r=>a.jsx(jT,{value:r},`telecom-${t.name}-${r.value}`))]}):null}function J7(e){var t,n;return a.jsxs("div",{children:[(t=e.value)==null?void 0:t.system,": ",(n=e.value)==null?void 0:n.value]})}function Z7(e){return a.jsx(a.Fragment,{children:vO(e.value)})}function Ql(e){return a.jsx(a.Fragment,{children:Vo(e.value)})}function Rv(e){return a.jsx(a.Fragment,{children:Wl(e.value)})}function e6(e){const t=e.value;return t?a.jsxs(a.Fragment,{children:[a.jsx(Ql,{value:t.numerator})," / ",a.jsx(Ql,{value:t.denominator})]}):null}function wd(e){if(!e.value)return null;const t=e.value.display||e.value.reference||On(e.value);return e.link!==!1&&e.value.reference?a.jsx(Ae,{to:e.value,children:t}):a.jsx(a.Fragment,{children:t})}function t6(e){const{property:t,values:n}=e,r=t.type[0].code;return e.values?a.jsx(a.Fragment,{children:n.map((o,i)=>a.jsx("div",{children:a.jsx(So,{arrayElement:!0,property:t,propertyType:r,value:o,ignoreMissingValues:e.ignoreMissingValues,link:e.link})},`${i}-${n.length}`))}):a.jsx(a.Fragment,{})}function So(e){var i;const{property:t,propertyType:n,value:r}=e;if((i=t==null?void 0:t.path)==null?void 0:i.endsWith(".id"))return a.jsxs(W,{component:"div",style:{display:"flex",gap:3,alignItems:"center"},children:[r,!Yt(r)&&a.jsx(Kj,{value:r,timeout:2e3,children:({copied:s,copy:l})=>a.jsx(Na,{label:s?"Copied":"Copy",withArrow:!0,position:"right",children:a.jsx(Ht,{variant:"subtle",color:s?"teal":"gray",onClick:l,children:s?a.jsx(Nf,{size:"1rem"}):a.jsx(hT,{size:"1rem"})})})})]});if(t!=null&&t.max&&t.max>1&&!e.arrayElement)return n===U.Attachment?a.jsx(q7,{values:r,maxWidth:e.maxWidth}):a.jsx(t6,{property:t,values:r,ignoreMissingValues:e.ignoreMissingValues,link:e.link});switch(n){case U.boolean:return a.jsx(a.Fragment,{children:r===void 0?"":(!!r).toString()});case U.SystemString:case U.string:return a.jsx("div",{style:{whiteSpace:"pre-wrap"},children:r});case U.code:case U.date:case U.decimal:case U.id:case U.integer:case U.positiveInt:case U.unsignedInt:case U.uri:case U.url:return a.jsx(a.Fragment,{children:r});case U.canonical:return a.jsx(wd,{value:{reference:r},link:e.link});case U.dateTime:case U.instant:return a.jsx(a.Fragment,{children:Mn(r)});case U.markdown:return a.jsx("pre",{children:r});case U.Address:return a.jsx(s$,{value:r});case U.Annotation:return a.jsx(a.Fragment,{children:r==null?void 0:r.text});case U.Attachment:return a.jsx(jc,{value:r,maxWidth:e.maxWidth});case U.CodeableConcept:return a.jsx(Yr,{value:r});case U.Coding:return a.jsx(Y7,{value:r});case U.ContactDetail:return a.jsx(X7,{value:r});case U.ContactPoint:return a.jsx(jT,{value:r});case U.HumanName:return a.jsx(Cv,{value:r});case U.Identifier:return a.jsx(J7,{value:r});case U.Money:return a.jsx(Z7,{value:r});case U.Period:return a.jsx(a.Fragment,{children:hO(r)});case U.Quantity:case U.Duration:return a.jsx(Ql,{value:r});case U.Range:return a.jsx(Rv,{value:r});case U.Ratio:return a.jsx(e6,{value:r});case U.Reference:return a.jsx(wd,{value:r,link:e.link});case U.Timing:return a.jsx(a.Fragment,{children:$E(r)});case U.Dosage:case U.UsageContext:return a.jsx(dm,{value:{type:n,value:r},compact:!0,ignoreMissingValues:e.ignoreMissingValues});default:if(!t)throw Error(`Displaying property of type ${e.propertyType} requires element schema`);return a.jsx(dm,{value:{type:t.type[0].code,value:r},compact:!0,ignoreMissingValues:e.ignoreMissingValues})}}function Lf(e,t){const n=gn(e,t);return n?Array.isArray(n)?[n.map(r=>r.value),n[0].type]:[n.value,n.type]:[void 0,"undefined"]}function n6(e,t,n){const r=rv(e,t,n);return r?Array.isArray(r)?[r.map(o=>o.value),r[0].type]:[r.value,r.type]:[void 0,"undefined"]}function dm(e){const t=e.value,n=t.value;if(!n)return null;const r=t.type,o=av(r);return o?typeof n=="object"&&"name"in n&&Object.keys(n).length===1&&typeof n.name=="string"?a.jsx("div",{children:n.name}):a.jsx(kv,{compact:e.compact,children:Object.entries(o.elements).map(i=>{const[s,l]=i;if(bT.includes(s)||CT.includes(s)&&l.path.split(".").length===2)return null;const[c,u]=Lf(t,s);return e.ignoreMissingValues&&(!c||Array.isArray(c)&&c.length===0)?null:a.jsx(ta,{term:md(s),children:a.jsx(So,{property:l,propertyType:u,value:c,ignoreMissingValues:e.ignoreMissingValues,link:e.link})},s)})}):a.jsxs("div",{children:[r," not implemented"]})}function r6(e,t){const n=e.lastIndexOf(t);if(n===-1)return["",e];const r=e.substring(0,n),o=e.substring(n+t.length);return[r,o]}const wa=b.createContext({profileUrl:void 0,debugMode:!1,getModifiedNestedElement:()=>{}});function o6(e,t,n){const r=Object.create(null);function o(s){return r[s]}const i=e==null?void 0:e.elements;if(i){const s=new Set;for(const[l,c]of Object.entries(i)){const[u,d]=r6(l,".");s.has(u)&&(r[e.type+"."+l]=c),s.add(l)}}return{debugMode:n??!1,profileUrl:t,getModifiedNestedElement:o}}function ET(e){const{debugMode:t}=p.useContext(wa);let n;return t&&e.fhirPath?n=`${e.title} - ${e.fhirPath}`:n=e.title,a.jsxs(Y,{wrap:"nowrap","data-testid":e.testId,children:[a.jsx("div",{children:e.children}),a.jsx("div",{children:a.jsx(St.Wrapper,{id:e.htmlFor,label:n,description:e.description,withAsterisk:e.withAsterisk,children:null})})]})}function Le(e,t){var n,r,o;return(o=(r=(n=e==null?void 0:e.issue)==null?void 0:n.filter(i=>{var s;return TT((s=i.expression)==null?void 0:s[0],t)}))==null?void 0:r.map(i=>{var s;return(s=i.details)==null?void 0:s.text}))==null?void 0:o.join(`
188
- `)}function $f(e,t){var n;return(n=e==null?void 0:e.issue)==null?void 0:n.filter(r=>{var o;return TT((o=r.expression)==null?void 0:o[0],t)})}function TT(e,t){if(e===t)return!0;if(!e||!t)return!1;const n=e.indexOf(".");if(n>=0&&e.substring(n+1)===t)return!0;const r=t.indexOf(".");return r>=0&&t.substring(r+1)===e}function it(e){const{debugMode:t}=p.useContext(wa);let n;return t&&e.fhirPath?n=`${e.title} - ${e.fhirPath}`:n=e.title,a.jsx(St.Wrapper,{id:e.htmlFor,label:n,description:e.description,withAsterisk:e.withAsterisk,error:Le(e.outcome,e.htmlFor),"data-testid":e.testId,children:e.children})}function fm(e,t,n,r,o){const i=r.type;if(i.length>1)for(const s of i){const l=t.replace("[x]",en(s.code));l in e&&delete e[l]}return e[n]=o,e}function i6(e){return!!e&&!Yt(e.url)&&!Yt(e.name)}function s6(e){const{defaultValue:t,onChange:n,...r}=e,[o,i]=p.useState(t);function s(l){const c=l6(l);i(c),n&&n(c)}return a.jsx(Ev,{defaultValue:o&&a6(o),onChange:s,...r})}function a6(e){var t;return(t=e.coding)==null?void 0:t.map(n=>({system:n.system,code:n.code,display:n.display}))}function l6(e){if(e.length!==0)return{coding:e.map(t=>({system:t.system,code:t.code,display:t.display}))}}function PT(e){const{defaultValue:t,onChange:n,...r}=e,[o,i]=p.useState(t);function s(l){const c=l[0],u=c&&u6(c);i(u),n&&n(u)}return a.jsx(Ev,{defaultValue:o&&c6(o),maxValues:1,onChange:s,...r})}function c6(e){return{system:e.system,code:e.code,display:e.display}}function u6(e){return{system:e.system,code:e.code,display:e.display}}function kT(e){const{path:t,outcome:n}=e,{getModifiedNestedElement:r}=p.useContext(wa),[o,i]=p.useState(e.defaultValue),s=p.useRef();s.current=o;const[l,c,u]=p.useMemo(()=>["system","use","value"].map(g=>r(t+"."+g)),[r,t]);function d(g){g&&Object.keys(g).length===0&&(g=void 0),i(g),e.onChange&&e.onChange(g)}function f(g){const y={...s.current,system:g};g||delete y.system,d(y)}function h(g){const y={...s.current,use:g};g||delete y.use,d(y)}function m(g){const y={...s.current,value:g};g||delete y.value,d(y)}return a.jsxs(Y,{gap:"xs",grow:!0,wrap:"nowrap",align:"flex-start",children:[a.jsx(mt,{"data-testid":"system",defaultValue:o==null?void 0:o.system,required:((l==null?void 0:l.min)??0)>0,onChange:g=>f(g.currentTarget.value),data:["","email","phone","fax","pager","sms","other"],error:Le(n,t+".system")}),a.jsx(mt,{"data-testid":"use",defaultValue:o==null?void 0:o.use,required:((c==null?void 0:c.min)??0)>0,onChange:g=>h(g.currentTarget.value),data:["","home","work","temp","old","mobile"],error:Le(n,t+".use")}),a.jsx(ie,{placeholder:"Value",defaultValue:o==null?void 0:o.value,required:((u==null?void 0:u.min)??0)>0,onChange:g=>m(g.currentTarget.value),error:Le(n,t+".value")})]})}function d6(e){var l;const[t,n]=p.useState(e.defaultValue),r=p.useRef();r.current=t;function o(c){n(c),e.onChange&&e.onChange(c)}function i(c){const u={...r.current,name:c};c||delete u.name,o(u)}function s(c){const u={...r.current,telecom:c&&[c]};c||delete u.telecom,o(u)}return a.jsxs(Y,{gap:"xs",grow:!0,wrap:"nowrap",children:[a.jsx(ie,{"data-testid":e.name+"-name",name:e.name+"-name",placeholder:"Name",style:{width:180},defaultValue:t==null?void 0:t.name,onChange:c=>i(c.currentTarget.value)}),a.jsx(kT,{name:e.name+"-telecom",path:e.path+".telecom",defaultValue:(l=t==null?void 0:t.telecom)==null?void 0:l[0],onChange:s,outcome:e.outcome})]})}function f6(e){if(!e)return"";const t=new Date(e);return Rf(t)?t.toLocaleDateString("sv")+"T"+t.toLocaleTimeString("sv"):""}function RT(e){if(!e)return"";const t=new Date(e);return Rf(t)?t.toISOString():""}var h6={MEDPLUM_BASE_URL:"__MEDPLUM_BASE_URL__",MEDPLUM_CLIENT_ID:"__MEDPLUM_CLIENT_ID__",GOOGLE_CLIENT_ID:"__GOOGLE_CLIENT_ID__",RECAPTCHA_SITE_KEY:"__RECAPTCHA_SITE_KEY__",MEDPLUM_REGISTER_ENABLED:"__MEDPLUM_REGISTER_ENABLED__",MEDPLUM_VERSION:"3.0.1-9cbb1620",BASE_URL:"/",MODE:"production",DEV:!1,PROD:!0,SSR:!1};function Ji(e){return a.jsx(ie,{id:e.name,name:e.name,"data-autofocus":e.autoFocus,"data-testid":e.name,placeholder:e.placeholder,required:e.required,type:p6(),defaultValue:f6(e.defaultValue),autoFocus:e.autoFocus,error:Le(e.outcome,e.name),onChange:t=>{if(e.onChange){const n=t.currentTarget.value;e.onChange(RT(n))}}})}function p6(){return h6.NODE_ENV==="test"?"text":"datetime-local"}function m6(e){const{propertyType:t}=e,n=te(),[r,o]=p.useState(!1),[i,s]=p.useState(),l=p.useMemo(()=>{if(!(!t.profile||t.profile.length===0))return t.profile[0]},[t]);p.useEffect(()=>{l&&(o(!0),n.requestProfileSchema(l).then(()=>{const u=Df(l);o(!1),s(u)}).catch(u=>{o(!1),console.warn(u)}))},[n,l]);function c(u){e.onChange&&(console.log("Extension",u),e.onChange(u))}return l?l&&(r||!YE(l))?a.jsx("div",{children:"Loading..."}):i?a.jsx(_v,{profileUrl:l,typeName:i.name,defaultValue:e.defaultValue,onChange:c}):a.jsxs("div",{children:["StructureDefinition for ",l," not found"]}):a.jsx(g6,{...e})}function g6(e){return a.jsx(fs,{id:e.name,name:e.name,"data-testid":"extension-json-input",defaultValue:On(e.defaultValue),deserialize:JSON.parse,onChange:t=>{e.onChange&&e.onChange(JSON.parse(t))}})}function y6(e){var f,h,m;const{outcome:t,path:n}=e,[r,o]=p.useState(e.defaultValue);function i(g){o(g),e.onChange&&e.onChange(g)}function s(g){i({...r,use:g||void 0})}function l(g){i({...r,prefix:g?g.split(" "):void 0})}function c(g){i({...r,given:g?g.split(" "):void 0})}function u(g){i({...r,family:g||void 0})}function d(g){i({...r,suffix:g?g.split(" "):void 0})}return a.jsxs(Y,{gap:"xs",grow:!0,wrap:"nowrap",children:[a.jsx(mt,{defaultValue:r==null?void 0:r.use,name:e.name+"-use","data-testid":"use",onChange:g=>s(g.currentTarget.value),data:["","temp","old","usual","official","nickname","anonymous","maiden"],error:Le(t,n+".use")}),a.jsx(ie,{placeholder:"Prefix",name:e.name+"-prefix",defaultValue:(f=r==null?void 0:r.prefix)==null?void 0:f.join(" "),onChange:g=>l(g.currentTarget.value),error:Le(t,n+".prefix")}),a.jsx(ie,{placeholder:"Given",name:e.name+"-given",defaultValue:(h=r==null?void 0:r.given)==null?void 0:h.join(" "),onChange:g=>c(g.currentTarget.value),error:Le(t,n+".given")}),a.jsx(ie,{name:e.name+"-family",placeholder:"Family",defaultValue:r==null?void 0:r.family,onChange:g=>u(g.currentTarget.value),error:Le(t,n+".family")}),a.jsx(ie,{placeholder:"Suffix",name:e.name+"-suffix",defaultValue:(m=r==null?void 0:r.suffix)==null?void 0:m.join(" "),onChange:g=>d(g.currentTarget.value),error:Le(t,n+".suffix")})]})}function v6(e){const{path:t,outcome:n}=e,[r,o]=p.useState(e.defaultValue),{getModifiedNestedElement:i}=p.useContext(wa),[s,l]=p.useMemo(()=>["system","value"].map(u=>i(t+"."+u)),[i,t]);function c(u){o(u),e.onChange&&e.onChange(u)}return a.jsxs(Y,{gap:"xs",grow:!0,wrap:"nowrap",align:"flex-start",children:[a.jsx(ie,{placeholder:"System",required:((s==null?void 0:s.min)??0)>0,defaultValue:r==null?void 0:r.system,onChange:u=>c({...r,system:u.currentTarget.value}),error:Le(n,t+".system")}),a.jsx(ie,{placeholder:"Value",required:((l==null?void 0:l.min)??0)>0,defaultValue:r==null?void 0:r.value,onChange:u=>c({...r,value:u.currentTarget.value}),error:Le(n,t+".value")})]})}const x6=["USD","EUR","CAD","GBP","AUD"];function w6(e){var c;const{onChange:t}=e,[n,r]=p.useState(e.defaultValue),o=p.useCallback(u=>{r(u),t&&t(u)},[t]),i=p.useCallback(u=>{o({...n,currency:u.currentTarget.value})},[n,o]),s=p.useCallback(u=>{o({...n,value:u.currentTarget.valueAsNumber})},[n,o]),l=a.jsx(mt,{defaultValue:n==null?void 0:n.currency,data:x6,styles:{input:{fontWeight:500,borderTopLeftRadius:0,borderBottomLeftRadius:0,width:92}},onChange:i});return a.jsx(ie,{type:"number",label:e.label,placeholder:e.placeholder??"Value",defaultValue:((c=n==null?void 0:n.value)==null?void 0:c.toString())??"USD",leftSection:a.jsx(D$,{size:14}),rightSection:l,rightSectionWidth:92,onChange:s})}function S6(e){const[t,n]=p.useState(e.defaultValue);function r(o){n(o),e.onChange&&e.onChange(o)}return a.jsxs(Y,{gap:"xs",grow:!0,wrap:"nowrap",children:[a.jsx(Ji,{name:e.name+".start",placeholder:"Start",defaultValue:t==null?void 0:t.start,onChange:o=>r({...t,start:o})}),a.jsx(Ji,{name:e.name+".end",placeholder:"End",defaultValue:t==null?void 0:t.end,onChange:o=>r({...t,end:o})})]})}function Zi(e){const[t,n]=p.useState(e.defaultValue);function r(o){n(o),e.onChange&&e.onChange(o)}return a.jsxs(Y,{gap:"xs",grow:!0,wrap:"nowrap",children:[a.jsx(mt,{style:{width:80},"data-testid":e.name+"-comparator",defaultValue:t==null?void 0:t.comparator,data:["","<","<=",">=",">"],onChange:o=>r({...t,comparator:o.currentTarget.value})}),a.jsx(ie,{id:e.name,name:e.name,required:e.required,"data-autofocus":e.autoFocus,"data-testid":e.name+"-value",type:"number",placeholder:"Value",defaultValue:t==null?void 0:t.value,autoFocus:e.autoFocus,step:"any",onWheel:o=>{e.disableWheel&&o.currentTarget.blur()},onChange:o=>{r({...t,value:b6(o.currentTarget.value)})}}),a.jsx(ie,{placeholder:"Unit","data-testid":e.name+"-unit",defaultValue:t==null?void 0:t.unit,onChange:o=>r({...t,unit:o.currentTarget.value})})]})}function b6(e){if(e)return parseFloat(e)}function Dv(e){const[t,n]=p.useState(e.defaultValue);function r(o){n(o),e.onChange&&e.onChange(o)}return a.jsxs(Y,{gap:"xs",grow:!0,wrap:"nowrap",children:[a.jsx(Zi,{name:e.name+"-low",defaultValue:t==null?void 0:t.low,onChange:o=>r({...t,low:o})}),a.jsx(Zi,{name:e.name+"-high",defaultValue:t==null?void 0:t.high,onChange:o=>r({...t,high:o})})]})}function C6(e){const[t,n]=p.useState(e.defaultValue);function r(o){n(o),e.onChange&&e.onChange(o)}return a.jsxs(Y,{gap:"xs",grow:!0,wrap:"nowrap",children:[a.jsx(Zi,{name:e.name+"-numerator",defaultValue:t==null?void 0:t.numerator,onChange:o=>r({...t,numerator:o})}),a.jsx(Zi,{name:e.name+"-denominator",defaultValue:t==null?void 0:t.denominator,onChange:o=>r({...t,denominator:o})})]})}const j6={Observation:"code",User:"email:contains"},E6=["AccessPolicy","Account","ActivityDefinition","Bot","CapabilityStatement","ClientApplication","CodeSystem","CompartmentDefinition","ConceptMap","EffectEvidenceSynthesis","Endpoint","EventDefinition","Evidence","EvidenceVariable","ExampleScenario","GraphDefinition","HealthcareService","ImplementationGuide","InsurancePlan","Library","Location","Measure","MedicinalProduct","MessageDefinition","NamingSystem","OperationDefinition","Organization","Patient","Person","PlanDefinition","Practitioner","Project","Questionnaire","RelatedPerson","ResearchDefinition","ResearchElementDefinition","RiskEvidenceSynthesis","SearchParameter","StructureDefinition","StructureMap","TerminologyCapabilities","TestScript","UserConfiguration","ValueSet"];function T6(e){return{value:ht(e),label:xo(e),resource:e}}function Ma(e){const t=te(),{resourceType:n,searchCriteria:r}=e,[o,i]=p.useState(),s=st(e.defaultValue,i),l=e.onChange,c=p.useCallback(async(d,f)=>{const h=k6(n),m=new URLSearchParams({[h]:d??"",_count:"10",...r});return await t.searchResources(n,m,{signal:f})},[t,n,r]),u=p.useCallback(d=>{l&&l(d[0])},[l]);return e.defaultValue&&!o&&!s?null:a.jsx(jv,{name:e.name,required:e.required,itemComponent:P6,defaultValue:s,placeholder:e.placeholder,maxValues:1,toOption:T6,loadOptions:c,onChange:u,clearable:!0})}const P6=p.forwardRef(({label:e,resource:t,...n},r)=>a.jsx("div",{ref:r,...n,children:a.jsxs(Y,{wrap:"nowrap",children:[a.jsx(mi,{value:t}),a.jsxs("div",{children:[a.jsx(le,{children:e}),a.jsx(le,{size:"xs",c:"dimmed",children:t.birthDate})]})]})}));function k6(e){return j6[e]??(E6.includes(e)?"name":"_id")}function Ff(e){const{onChange:t}=e,n=te(),[r,o]=p.useState(e.defaultValue),[i,s]=p.useState(()=>R6(e.targetTypes)),[l,c]=p.useState(()=>D6(e.defaultValue,i)),u=p.useRef(new sT),d=p.useMemo(()=>(l==null?void 0:l.type)==="profile"?{...e.searchCriteria,_profile:l.value}:e.searchCriteria,[e.searchCriteria,l]);p.useEffect(()=>{let m=!1;const g=i==null?void 0:i.map(y=>{if(!_6(y))return Promise.resolve(y);m=!0;const C=y.value,v=u.current.get(C);if(v)return v;const x=I6(n,y.value).then(S=>{const E={...y};return S?kf(S.type)?(E.resourceType=S.type,E.name=S.name,E.title=S.title):(console.error(`StructureDefinition.type missing for ${y.value}`),E.error="StructureDefinition.type missing"):(console.error(`StructureDefinition not found for ${y.value}`),E.error="StructureDefinition not found"),E}).catch(S=>(console.error(S),{...y,error:S})),w=new xr(x);return u.current.set(C,w),w});!g||!m||Promise.all(g).then(y=>{if(s(y),!l)return;const C=y.findIndex(v=>v.value===l.value||v.resourceType===l.resourceType);if(C===-1){console.debug(`defaultValue had unexpected resourceType: ${l.resourceType}`);return}c(y[C])}).catch(console.error)},[n,l,i]);const f=p.useCallback(m=>{const g=m?xt(m):void 0;o(g),t&&t(g)},[t]),h=p.useMemo(()=>i?i.map(m=>({value:m.value,label:m.type==="profile"?m.title??m.name??m.resourceType??m.value:m.value})):[],[i]);return a.jsxs(Y,{gap:"xs",grow:!0,wrap:"nowrap",children:[i&&i.length>1&&a.jsx(mt,{"data-autofocus":e.autoFocus,"data-testid":"reference-input-resource-type-select",defaultValue:l==null?void 0:l.resourceType,autoFocus:e.autoFocus,onChange:m=>{const g=m.currentTarget.value,y=i.find(C=>C.value===g);c(y)},data:h}),!i&&a.jsx(Tv,{autoFocus:e.autoFocus,testId:"reference-input-resource-type-input",defaultValue:l==null?void 0:l.resourceType,onChange:m=>{c(m?{type:"resourceType",value:m,resourceType:m}:void 0)},name:e.name+"-resourceType",placeholder:"Resource Type"}),a.jsx(Ma,{resourceType:l==null?void 0:l.resourceType,name:e.name+"-id",required:e.required,placeholder:e.placeholder,defaultValue:r,searchCriteria:d,onChange:f})]})}function R6(e){if(!e||e.length===0||e.length===1&&e[0]==="Resource")return;const t=[];for(const n of e)n.includes("/")?t.push({type:"profile",value:n}):t.push({type:"resourceType",value:n,resourceType:n});return t}function D6(e,t){var r;const n=(r=e==null?void 0:e.reference)==null?void 0:r.split("/")[0];if(n){const o=t==null?void 0:t.find(i=>i.resourceType===n);return o||{type:"resourceType",value:n,resourceType:n}}if(t&&t.length>0)return t[0]}async function I6(e,t){const n=Df(t);if(n)return{type:n.type,name:n.name,title:n.title};const r=`{
189
- StructureDefinitionList(url: "${t}", _sort: "_lastUpdated", _count: 1) {
190
- type,
191
- name,
192
- title,
193
- }
194
- }`.replace(/\s+/g," ");return(await e.graphql(r)).data.StructureDefinitionList[0]}function _6(e){return e.type==="profile"&&!(e!=null&&e.error)&&Yt(e.resourceType)}const A6="_indented_ldk1d_1",DT={indented:A6};function N6(e,t,n){var r,o;for(const i of[n.elements,(r=n.typeSchema)==null?void 0:r.elements]){let s;if(kf(i)){const l=JE(i,t.path);l&&(s=rv(e.value,t.path,l))}if(s)return((o=cO(s))==null?void 0:o.some(l=>n$(l,t,n,i)))??!1}return!1}function O6(e,t,n){var r;if(e)for(const o of t){const i={value:e,type:((r=o.typeSchema)==null?void 0:r.name)??o.type[0].code};if(n.every(s=>N6(i,s,o)))return o.name}}function H1(e,t,n){if(!n||n.slices.length===0)return[e];const r=new Array(t.length+1);for(let o=0;o<r.length;o++)r[o]=[];for(const o of e){const i=O6(o,t,n.discriminator);let s=i?t.findIndex(l=>l.name===i):-1;s===-1&&(s=t.length),r[s].push(o)}for(let o=0;o<t.length;o++)r[o].length===0&&r[o].push(void 0);return r}function M6(e){return e.type!==void 0&&e.type.length>0}function L6(e){var C;const{property:t}=e,n=te(),[r,o]=p.useState(!0),[i,s]=p.useState([]),[l]=p.useState(()=>Array.isArray(e.defaultValue)?e.defaultValue:[]),[c,u]=p.useState([[]]),d=(C=t.type[0])==null?void 0:C.code;p.useEffect(()=>{if(!t.slicing){const S=[];s(S);const E=H1(l,S,t.slicing);u(E),o(!1);return}const v=[],x=[],w=[];for(const S of t.slicing.slices){if(!M6(S))continue;const E=S.type[0];let j;Yt(S.elements)&&E.profile&&(j=E.profile[0]),v.push(S),x.push(j),j?w.push(n.requestProfileSchema(j)):w.push(Promise.resolve())}Promise.all(w).then(()=>{for(let E=0;E<v.length;E++){const j=v[E],T=x[E];if(T){const P=Df(T);j.typeSchema=P}}s(v);const S=H1(l,v,t.slicing);u(S),o(!1)}).catch(S=>{console.error(S),o(!1)})},[n,t.slicing,d,l]);function f(v,x){const w=[...c];if(w[x]=v,u(w),e.onChange){const S=w.flat().filter(E=>E!==void 0);e.onChange(S)}}if(r)return a.jsx("div",{children:"Loading..."});const h=i.length,m=c[h],g=!(e.hideNonSliceValues??(d==="Extension"&&i.length>0)),y=md(t.path);return a.jsxs(Se,{className:e.indent?DT.indented:void 0,children:[i.map((v,x)=>a.jsx($6,{slice:v,property:t,defaultValue:c[x],onChange:w=>{f(w,x)},testId:`slice-${v.name}`},v.name)),g&&m.map((v,x)=>a.jsxs(Y,{wrap:"nowrap",style:{flexGrow:1},children:[a.jsx("div",{style:{flexGrow:1},children:a.jsx(La,{arrayElement:!0,property:e.property,name:e.name+"."+x,defaultValue:v,onChange:w=>{const S=[...m];S[x]=w,f(S,h)},defaultPropertyType:void 0,outcome:e.outcome})}),a.jsx(_T,{propertyDisplayName:y,testId:`nonsliced-remove-${x}`,onClick:w=>{et(w);const S=[...m];S.splice(x,1),f(S,h)}})]},`${x}-${m.length}`)),g&&c.flat().length<t.max&&a.jsx(Y,{wrap:"nowrap",style:{justifyContent:"flex-start"},children:a.jsx(IT,{propertyDisplayName:y,onClick:v=>{et(v);const x=[...m];x.push(void 0),f(x,h)},testId:"nonsliced-add"})})]})}function $6(e){const{slice:t,property:n}=e,[r,o]=p.useState(()=>e.defaultValue.map(u=>u??{}));function i(u){o(u),e.onChange&&e.onChange(u)}const s=t.min>0,l=Yt(t.elements),c=XE(t.name);return a.jsx(it,{title:c,description:t.definition,withAsterisk:s,fhirPath:`${n.path}:${t.name}`,testId:e.testId,children:a.jsxs(Se,{className:l?DT.indented:void 0,children:[r.map((u,d)=>a.jsxs(Y,{wrap:"nowrap",children:[a.jsx("div",{style:{flexGrow:1},children:a.jsx(Se,{children:Yt(t.elements)?a.jsx(Iv,{elementDefinitionType:t.type[0],name:t.name,defaultValue:u,onChange:f=>{const h=[...r];h[d]=f,i(h)},outcome:void 0,min:t.min,max:t.max,binding:void 0,path:t.path}):a.jsx(AT,{type:t.type[0].code,elements:t.elements,defaultValue:u,outcome:e.outcome,onChange:f=>{const h=[...r];h[d]=f,i(h)},testId:e.testId&&`${e.testId}-elements-${d}`})})}),r.length>t.min&&a.jsx(_T,{propertyDisplayName:c,testId:e.testId&&`${e.testId}-remove-${d}`,onClick:f=>{et(f);const h=[...r];h.splice(d,1),i(h)}})]},`${d}-${r.length}`)),r.length<t.max&&a.jsx(Y,{wrap:"nowrap",style:{justifyContent:"flex-start"},children:a.jsx(IT,{propertyDisplayName:c,onClick:u=>{et(u);const d=[...r,void 0];i(d)},testId:e.testId&&`${e.testId}-add`})})]})})}function IT({propertyDisplayName:e,onClick:t,testId:n}){const r=e?`Add ${e}`:"Add";return e?a.jsx(Z,{title:r,size:"sm",color:"green.6",variant:"subtle","data-testid":n,leftSection:a.jsx(vd,{size:"1.25rem"}),onClick:t,children:r}):a.jsx(Ht,{title:r,color:"green.6","data-testid":n,onClick:t,children:a.jsx(vd,{size:"1.25rem"})})}function _T({propertyDisplayName:e,onClick:t,testId:n}){return a.jsx(Ht,{title:e?`Remove ${e}`:"Remove",color:"red.5","data-testid":n,onClick:t,children:a.jsx(yd,{size:"1.25rem"})})}function F6(e){const[t,n]=p.useState(!1),r=uS(),o=p.useRef(null),i={...e.styles};return t||(i.input||(i.input={}),i.input.WebkitTextSecurity="disc"),a.jsxs(pa,{gap:"xs",children:[a.jsx(ds,{...e,styles:{...i,root:{...i.root??{},flexGrow:1}},ref:o,autosize:!0,minRows:1,onFocus:()=>n(!0),onBlur:()=>n(!1)}),a.jsx(Ht,{title:"Copy secret",onClick:()=>{var s;r.copy((s=o.current)==null?void 0:s.value),ce({color:"green",message:"Copied"})},children:a.jsx(hT,{})})]})}const z6=["sun","mon","tue","wed","thu","fri","sat"];function B6(e){const[t,n]=p.useState(e.defaultValue),[r,o]=p.useState(!1),i=p.useRef();return i.current=t,a.jsxs(a.Fragment,{children:[a.jsxs(Y,{gap:"xs",grow:!0,wrap:"nowrap",children:[a.jsx("span",{children:$E(i.current)||"No repeat"}),a.jsx(Z,{onClick:()=>o(!0),children:"Edit"})]}),a.jsx(U6,{visible:r,defaultValue:i.current,onOk:s=>{e.onChange&&e.onChange(s),n(s),o(!1)},onCancel:()=>o(!1)})]})}const W1={repeat:{period:1,periodUnit:"d"}};function U6(e){const[t,n]=p.useState(e.defaultValue||W1),r=p.useRef();r.current=t;function o(u){n({...r.current,event:[u]})}function i(u){n({...r.current,repeat:u})}function s(u){var d;i({...(d=r.current)==null?void 0:d.repeat,period:u})}function l(u){var d;i({...(d=r.current)==null?void 0:d.repeat,periodUnit:u})}function c(u){var d;i({...(d=r.current)==null?void 0:d.repeat,dayOfWeek:u})}return a.jsx(bn,{title:"Timing",closeButtonProps:{"aria-label":"Close"},opened:e.visible,onClose:()=>e.onCancel(),children:a.jsxs(Se,{children:[a.jsx(it,{title:"Starts on",htmlFor:"timing-dialog-start",children:a.jsx(Ji,{name:"timing-dialog-start",onChange:u=>o(u)})}),a.jsx(mc,{label:"Repeat",checked:!!t.repeat,onChange:u=>i(u.currentTarget.checked?W1.repeat:void 0)}),t.repeat&&a.jsxs(a.Fragment,{children:[a.jsx(it,{title:"Repeat every",htmlFor:"timing-dialog-period",children:a.jsxs(Y,{gap:"xs",grow:!0,wrap:"nowrap",children:[a.jsx(ie,{type:"number",step:1,id:"timing-dialog-period",name:"timing-dialog-period",defaultValue:t.repeat.period||1,onChange:u=>s(parseInt(u.currentTarget.value,10)||1)}),a.jsx(mt,{id:"timing-dialog-periodUnit",name:"timing-dialog-periodUnit",defaultValue:t.repeat.periodUnit,onChange:u=>l(u.currentTarget.value),data:[{label:"second",value:"s"},{label:"minute",value:"min"},{label:"hour",value:"h"},{label:"day",value:"d"},{label:"week",value:"wk"},{label:"month",value:"mo"},{label:"year",value:"a"}]})]})}),t.repeat.periodUnit==="wk"&&a.jsx(it,{title:"Repeat on",children:a.jsx(Vl.Group,{multiple:!0,onChange:c,children:a.jsx(Y,{justify:"space-between",mt:"md",gap:"xs",children:z6.map(u=>a.jsx(Vl,{value:u,size:"xs",radius:"xl",children:u.charAt(0).toUpperCase()},u))})})})]}),a.jsx(Y,{justify:"flex-end",children:a.jsx(Z,{onClick:()=>e.onOk(t),children:"OK"})})]})})}function La(e){var l;const{property:t,name:n,defaultValue:r,onChange:o}=e,i=e.defaultPropertyType&&e.defaultPropertyType!=="undefined"?e.defaultPropertyType:t.type[0].code,s=t.type;if((t.isArray||t.max>1)&&!e.arrayElement){if(i===U.Attachment)return a.jsx(G7,{name:n,defaultValue:r,onChange:o});const c=((l=s[0])==null?void 0:l.code)!==U.Extension;return a.jsx(L6,{property:t,name:n,defaultValue:r,indent:c,onChange:o,outcome:e.outcome})}return s.length>1?a.jsx(V6,{elementDefinitionTypes:s,...e}):a.jsx(Iv,{name:n,defaultValue:r,onChange:c=>{if(e.onChange){const u=e.name.replace("[x]",en(s[0].code));e.onChange(c,u)}},outcome:e.outcome,elementDefinitionType:s[0],min:t.min,max:t.min,binding:t.binding,path:t.path})}function V6(e){const t=e.elementDefinitionTypes;let n;e.defaultPropertyType&&(n=t.find(i=>i.code===e.defaultPropertyType)),n||(n=t[0]);const[r,o]=p.useState(n);return a.jsxs(Y,{gap:"xs",grow:!0,wrap:"nowrap",align:"flex-start",children:[a.jsx(mt,{style:{width:"200px"},defaultValue:r.code,onChange:i=>{o(t.find(s=>s.code===i.currentTarget.value))},data:t.map(i=>({value:i.code,label:i.code}))}),a.jsx(Iv,{name:e.name,defaultValue:e.defaultValue,outcome:e.outcome,elementDefinitionType:r,onChange:i=>{e.onChange&&e.onChange(i,e.name.replace("[x]",en(r.code)))},min:e.property.min,max:e.property.max,binding:e.property.binding,path:e.property.path})]})}function Iv(e){const{name:t,defaultValue:n,onChange:r,outcome:o,binding:i,path:s}=e,l=e.min!==void 0&&e.min>0,c=e.elementDefinitionType.code;if(!c)return a.jsx("div",{children:"Property type not specified "});const u={name:t,defaultValue:n,onChange:r,outcome:o,path:s};switch(c){case U.SystemString:case U.canonical:case U.string:case U.time:case U.uri:case U.url:return e.path==="Project.secret.value[x]"?a.jsx(F6,{id:t,name:t,"data-testid":t,defaultValue:n,required:l,onChange:d=>{e.onChange&&e.onChange(d.currentTarget.value)},error:Le(e.outcome,t)}):a.jsx(ie,{id:t,name:t,"data-testid":t,defaultValue:n,required:l,onChange:d=>{r&&r(d.currentTarget.value)},error:Le(o,t)});case U.date:return a.jsx(ie,{type:"date",id:t,name:t,"data-testid":t,defaultValue:n,required:l,onChange:d=>{r&&r(d.currentTarget.value)},error:Le(o,t)});case U.dateTime:case U.instant:return a.jsx(Ji,{name:t,defaultValue:n,onChange:r,outcome:o});case U.decimal:case U.integer:case U.positiveInt:case U.unsignedInt:return a.jsx(ie,{type:"number",step:c===U.decimal?"any":"1",id:t,name:t,"data-testid":t,defaultValue:n,required:l,onChange:d=>{r&&r(d.currentTarget.valueAsNumber)}});case U.code:return a.jsx(wT,{...u,binding:i==null?void 0:i.valueSet});case U.boolean:return a.jsx(ur,{id:t,name:t,"data-testid":t,defaultChecked:!!n,onChange:d=>{r&&r(d.currentTarget.checked)}});case U.base64Binary:case U.markdown:return a.jsx(ds,{id:t,spellCheck:c!==U.base64Binary,name:t,"data-testid":t,defaultValue:n,required:l,onChange:d=>{r&&r(d.currentTarget.value)}});case U.Address:return a.jsx(a$,{...u});case U.Annotation:return a.jsx(l$,{...u});case U.Attachment:return a.jsx(ST,{...u});case U.CodeableConcept:return a.jsx(s6,{binding:i==null?void 0:i.valueSet,...u});case U.Coding:return a.jsx(PT,{binding:i==null?void 0:i.valueSet,...u});case U.ContactDetail:return a.jsx(d6,{...u});case U.ContactPoint:return a.jsx(kT,{...u});case U.Extension:return a.jsx(m6,{...u,propertyType:e.elementDefinitionType});case U.HumanName:return a.jsx(y6,{...u});case U.Identifier:return a.jsx(v6,{...u});case U.Money:return a.jsx(w6,{...u});case U.Period:return a.jsx(S6,{...u});case U.Duration:case U.Quantity:return a.jsx(Zi,{...u});case U.Range:return a.jsx(Dv,{...u});case U.Ratio:return a.jsx(C6,{...u});case U.Reference:return a.jsx(Ff,{...u,targetTypes:W6(e.elementDefinitionType)});case U.Timing:return a.jsx(B6,{...u});case U.Dosage:case U.UsageContext:default:return a.jsx(_v,{typeName:c,defaultValue:n,onChange:r,outcome:o})}}const H6=[`${e$}/fhir/StructureDefinition/`,"https://medplum.com/fhir/StructureDefinition/"];function W6(e){var t;return(t=e==null?void 0:e.targetProfile)==null?void 0:t.map(n=>{const r=H6.find(o=>n.startsWith(o));return r?n.slice(r.length):n})}const hm=new Set(["extension","modifierExtension"]),q6=new Set(["id",...bT].filter(e=>!hm.has(e)));function AT(e){const{elements:t}=e,[n,r]=p.useState(e.defaultValue??{}),o=p.useMemo(()=>{const s=Object.create(null);for(const[l,c]of Object.entries(t))c.fixed&&(s[l]=c);return s},[t]);function i(s){for(const[l,c]of Object.entries(o))fm(s,l,l,c,c.fixed.value);r(s),e.onChange&&e.onChange(s)}return a.jsx(Se,{style:{flexGrow:1},"data-testid":e.testId,children:Object.entries(t).map(([s,l])=>{var h;if(!l.type||l.max===0||s==="url"&&l.fixed||hm.has(s)&&!kf((h=l.slicing)==null?void 0:h.slices))return null;if(q6.has(s))return null;if(CT.includes(s)&&l.path.split(".").length===2||s.includes("."))return null;const[c,u]=n6(n,s,l),d=l.min!==void 0&&l.min>0,f=a.jsx(La,{property:l,name:s,defaultValue:c,defaultPropertyType:u,onChange:(m,g)=>{i(fm({...n},s,g??s,l,m))},arrayElement:void 0,outcome:e.outcome},s);return e.type==="Extension"||hm.has(s)?f:l.type.length===1&&l.type[0].code==="boolean"?a.jsx(ET,{title:md(s),description:l.description,htmlFor:s,fhirPath:l.path,withAsterisk:d,children:f},s):a.jsx(it,{title:md(s),description:l.description,withAsterisk:d,htmlFor:s,outcome:e.outcome,fhirPath:l.path,children:f},s)})})}function _v(e){const{typeName:t}=e,[n,r]=p.useState(e.defaultValue??{}),o=p.useContext(wa),i=e.profileUrl??o.profileUrl,s=p.useMemo(()=>av(t,i),[t,i]),l=p.useMemo(()=>o6(s,i),[s,i]);if(!s)return a.jsxs("div",{children:[t," not implemented"]});function c(u){r(u),e.onChange&&e.onChange(u)}return a.jsx(wa.Provider,{value:l,children:a.jsx(AT,{type:s.type,elements:s.elements,defaultValue:n,onChange:c,outcome:e.outcome})})}const G6="_root_1vii2_1",Q6={root:G6};function Ec(e){const{children:t,...n}=e;return a.jsx(Cy,{className:Q6.root,...n,children:t})}const K6="_noteBody_10swh_1",Y6="_noteCite_10swh_5",X6="_noteRoot_10swh_10",q1={noteBody:K6,noteCite:Y6,noteRoot:X6};function NT({value:e}){return e?a.jsx(Se,{justify:"flex-start",gap:"xs",children:e.map(t=>{var n;return t.text&&a.jsx(Sy,{classNames:{cite:q1.noteCite,root:q1.noteRoot},cite:((n=t.authorReference)==null?void 0:n.display)||t.authorString,icon:null,children:t.text},`note-${t.text}`)})}):null}function Tc(e){const{value:t,link:n,...r}=e,[o,i]=p.useState(),s=st(t,i);let l;if(o&&!_E(o))l=`[${Pe(o)}]`;else if(s)l=xo(s);else return null;return n?a.jsx(Ae,{to:t,...r,children:l}):a.jsx(le,{component:"span",...r,children:l})}function na(e){return a.jsxs(Y,{gap:"xs",children:[a.jsx(mi,{size:24,radius:12,value:e.value,link:e.link}),a.jsx(Tc,{value:e.value,link:e.link})]})}const J6={draft:"blue",active:"blue","on-hold":"yellow",revoked:"red",completed:"green","entered-in-error":"red",unknown:"gray",retired:"gray",registered:"blue",preliminary:"blue",final:"green",amended:"yellow",corrected:"yellow",cancelled:"red",requested:"blue",received:"blue",accepted:"blue",rejected:"red",ready:"blue","in-progress":"blue",failed:"red",proposed:"blue",pending:"blue",booked:"blue",arrived:"blue",fulfilled:"green",noshow:"red","checked-in":"blue",waitlist:"gray",routine:"gray",urgent:"red",asap:"red",stat:"red","not-done":"red"};function OT(e){return a.jsx(cf,{color:J6[e.status],children:e.status})}const Z6="_table_pe9td_1",e8="_criticalRow_pe9td_12",t8="_noteBody_pe9td_23",n8="_noteCite_pe9td_27",r8="_noteRoot_pe9td_32",MT={table:Z6,criticalRow:e8,noteBody:t8,noteCite:n8,noteRoot:r8};Av.defaultProps={hideObservationNotes:!1,hideSpecimenInfo:!1};function Av(e){var s;const t=te(),n=st(e.value),[r,o]=p.useState();if(p.useEffect(()=>{n!=null&&n.specimen&&Promise.allSettled(n.specimen.map(l=>t.readReference(l))).then(l=>l.filter(c=>c.status==="fulfilled").map(c=>c.value)).then(o).catch(console.error)},[t,n]),!n)return null;const i=(r==null?void 0:r.flatMap(l=>l.note||[]))||[];if(n.presentedForm&&n.presentedForm.length>0){const l=n.presentedForm[0];(s=l.contentType)!=null&&s.startsWith("text/plain")&&l.data&&i.push({text:window.atob(l.data)})}return a.jsxs(Se,{children:[a.jsx(ae,{children:"Diagnostic Report"}),a.jsx(o8,{value:n}),r&&!e.hideSpecimenInfo&&i8(r),n.result&&a.jsx(s8,{hideObservationNotes:e.hideObservationNotes,value:n.result}),i.length>0&&a.jsx(NT,{value:i})]})}function o8({value:e}){var t,n;return a.jsxs(Y,{mt:"md",gap:30,children:[e.subject&&a.jsxs("div",{children:[a.jsx(le,{size:"xs",tt:"uppercase",c:"dimmed",children:"Subject"}),a.jsx(na,{value:e.subject,link:!0})]}),(t=e.resultsInterpreter)==null?void 0:t.map(r=>a.jsxs("div",{children:[a.jsx(le,{size:"xs",tt:"uppercase",c:"dimmed",children:"Interpreter"}),a.jsx(na,{value:r,link:!0})]},r.reference)),(n=e.performer)==null?void 0:n.map(r=>a.jsxs("div",{children:[a.jsx(le,{size:"xs",tt:"uppercase",c:"dimmed",children:"Performer"}),a.jsx(na,{value:r,link:!0})]},r.reference)),e.issued&&a.jsxs("div",{children:[a.jsx(le,{size:"xs",tt:"uppercase",c:"dimmed",children:"Issued"}),a.jsx(le,{children:Mn(e.issued)})]}),e.status&&a.jsxs("div",{children:[a.jsx(le,{size:"xs",tt:"uppercase",c:"dimmed",children:"Status"}),a.jsx(le,{children:en(e.status)})]})]})}function i8(e){return a.jsxs(Se,{gap:"xs",children:[a.jsx(ae,{order:2,size:"h6",children:"Specimens"}),a.jsx(pn,{type:"ordered",children:e==null?void 0:e.map(t=>{var n;return a.jsx(pn.Item,{ml:"sm",children:a.jsxs(Y,{gap:20,children:[a.jsxs(Y,{gap:5,children:[a.jsx(le,{fw:500,children:"Collected:"})," ",Mn((n=t.collection)==null?void 0:n.collectedDateTime)]}),a.jsxs(Y,{gap:5,children:[a.jsx(le,{fw:500,children:"Received:"})," ",Mn(t.receivedTime)]})]})},`specimen-${t.id}`)})})]})}function s8(e){return a.jsxs("table",{className:MT.table,children:[a.jsx("thead",{children:a.jsxs("tr",{children:[a.jsx("th",{children:"Test"}),a.jsx("th",{children:"Value"}),a.jsx("th",{children:"Reference Range"}),a.jsx("th",{children:"Interpretation"}),a.jsx("th",{children:"Category"}),a.jsx("th",{children:"Performer"}),a.jsx("th",{children:"Status"})]})}),a.jsx("tbody",{children:a.jsx(LT,{value:e.value,ancestorIds:e.ancestorIds,hideObservationNotes:e.hideObservationNotes})})]})}function LT(e){var t;return a.jsx(a.Fragment,{children:(t=e.value)==null?void 0:t.map(n=>a.jsx(a8,{value:n,ancestorIds:e.ancestorIds,hideObservationNotes:e.hideObservationNotes},`obs-${ys(n)?n.reference:n.id}`))})}function a8(e){var o,i;const t=st(e.value);if(!t||(o=e.ancestorIds)!=null&&o.includes(t.id))return null;const n=!e.hideObservationNotes&&t.note,r=u8(t);return a.jsxs(a.Fragment,{children:[a.jsxs("tr",{className:Ye({[MT.criticalRow]:r}),children:[a.jsx("td",{rowSpan:n?2:1,children:a.jsx(Ae,{to:t,children:a.jsx(Yr,{value:t.code})})}),a.jsx("td",{children:a.jsx(l8,{value:t})}),a.jsx("td",{children:a.jsx(c8,{value:t.referenceRange})}),a.jsx("td",{children:t.interpretation&&t.interpretation.length>0&&a.jsx(Yr,{value:t.interpretation[0]})}),a.jsx("td",{children:t.category&&t.category.length>0&&a.jsx(a.Fragment,{children:t.category.map(s=>a.jsx("div",{children:a.jsx(Yr,{value:s})},`category-${va(s)}`))})}),a.jsx("td",{children:(i=t.performer)==null?void 0:i.map(s=>a.jsx(wd,{value:s},s.reference))}),a.jsx("td",{children:t.status&&a.jsx(OT,{status:t.status})})]}),t.hasMember&&a.jsx(LT,{value:t.hasMember,ancestorIds:e.ancestorIds?[...e.ancestorIds,t.id]:[t.id],hideObservationNotes:e.hideObservationNotes}),n&&a.jsx("tr",{children:a.jsx("td",{colSpan:6,children:a.jsx(NT,{value:t.note})})})]})}function l8(e){const t=e.value;return a.jsx(a.Fragment,{children:FE(t)})}function c8(e){const t=e.value&&e.value.length>0&&e.value[0];return t?t.text?a.jsx(a.Fragment,{children:t.text}):a.jsx(Rv,{value:t}):null}function u8(e){var n,r,o,i;const t=(i=(o=(r=(n=e.interpretation)==null?void 0:n[0])==null?void 0:r.coding)==null?void 0:o[0])==null?void 0:i.code;return t==="AA"||t==="LL"||t==="HH"||t==="A"}const d8="_paper_1igaj_1",f8="_fill_1igaj_20",G1={paper:d8,fill:f8};function Nv(e){const{width:t,fill:n,className:r,children:o,...i}=e,s=t?{width:t}:void 0;return a.jsx(_n,{className:Ye(G1.paper,n&&G1.fill,r),style:s,shadow:"sm",radius:"sm",withBorder:!0,...i,children:o})}var $T={},Pc={};Object.defineProperty(Pc,"__esModule",{value:!0});Pc.Pointer=void 0;function h8(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function p8(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}var m8=function(){function e(t){t===void 0&&(t=[""]),this.tokens=t}return e.fromJSON=function(t){var n=t.split("/").map(h8);if(n[0]!=="")throw new Error("Invalid JSON Pointer: ".concat(t));return new e(n)},e.prototype.toString=function(){return this.tokens.map(p8).join("/")},e.prototype.evaluate=function(t){for(var n=null,r="",o=t,i=1,s=this.tokens.length;i<s;i++)n=o,r=this.tokens[i],!(r=="__proto__"||r=="constructor"||r=="prototype")&&(o=(n||{})[r]);return{parent:n,key:r,value:o}},e.prototype.get=function(t){return this.evaluate(t).value},e.prototype.set=function(t,n){var r=this.evaluate(t);r.parent&&(r.parent[r.key]=n)},e.prototype.push=function(t){this.tokens.push(t)},e.prototype.add=function(t){var n=this.tokens.concat(String(t));return new e(n)},e}();Pc.Pointer=m8;var Tt={},Ov={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.clone=e.objectType=e.hasOwnProperty=void 0,e.hasOwnProperty=Object.prototype.hasOwnProperty;function t(o){return o===void 0?"undefined":o===null?"null":Array.isArray(o)?"array":typeof o}e.objectType=t;function n(o){return o!=null&&typeof o=="object"}function r(o){if(!n(o))return o;if(o.constructor==Array){for(var i=o.length,s=new Array(i),l=0;l<i;l++)s[l]=r(o[l]);return s}if(o.constructor==Date){var c=new Date(+o);return c}var u={};for(var d in o)e.hasOwnProperty.call(o,d)&&(u[d]=r(o[d]));return u}e.clone=r})(Ov);var hn={};Object.defineProperty(hn,"__esModule",{value:!0});hn.diffAny=hn.diffObjects=hn.diffArrays=hn.intersection=hn.subtract=hn.isDestructive=void 0;var Kl=Ov;function g8(e){var t=e.op;return t==="remove"||t==="replace"||t==="copy"||t==="move"}hn.isDestructive=g8;function pm(e,t){var n={};for(var r in e)Kl.hasOwnProperty.call(e,r)&&e[r]!==void 0&&(n[r]=1);for(var o in t)Kl.hasOwnProperty.call(t,o)&&t[o]!==void 0&&delete n[o];return Object.keys(n)}hn.subtract=pm;function FT(e){for(var t=e.length,n={},r=0;r<t;r++){var o=e[r];for(var i in o)Kl.hasOwnProperty.call(o,i)&&o[i]!==void 0&&(n[i]=(n[i]||0)+1)}for(var i in n)n[i]<t&&delete n[i];return Object.keys(n)}hn.intersection=FT;function y8(e){return e.op==="add"}function v8(e){return e.op==="remove"}function Hh(e,t){return{operations:e.operations.concat(t),cost:e.cost+1}}function zT(e,t,n,r){r===void 0&&(r=zf);var o={"0,0":{operations:[],cost:0}};function i(d,f){var h="".concat(d,",").concat(f),m=o[h];if(m===void 0){if(d>0&&f>0&&!r(e[d-1],t[f-1],n.add(String(d-1))).length)m=i(d-1,f-1);else{var g=[];if(d>0){var y=i(d-1,f),C={op:"remove",index:d-1};g.push(Hh(y,C))}if(f>0){var v=i(d,f-1),x={op:"add",index:d-1,value:t[f-1]};g.push(Hh(v,x))}if(d>0&&f>0){var w=i(d-1,f-1),S={op:"replace",index:d-1,original:e[d-1],value:t[f-1]};g.push(Hh(w,S))}var E=g.sort(function(j,T){return j.cost-T.cost})[0];m=E}o[h]=m}return m}var s=isNaN(e.length)||e.length<=0?0:e.length,l=isNaN(t.length)||t.length<=0?0:t.length,c=i(s,l).operations,u=c.reduce(function(d,f){var h=d[0],m=d[1];if(y8(f)){var g=f.index+1+m,y=g<s+m?String(g):"-",C={op:f.op,path:n.add(y).toString(),value:f.value};return[h.concat(C),m+1]}else if(v8(f)){var C={op:f.op,path:n.add(String(f.index+m)).toString()};return[h.concat(C),m-1]}else{var v=n.add(String(f.index+m)),x=r(f.original,f.value,v);return[h.concat.apply(h,x),m]}},[[],0])[0];return u}hn.diffArrays=zT;function BT(e,t,n,r){r===void 0&&(r=zf);var o=[];return pm(e,t).forEach(function(i){o.push({op:"remove",path:n.add(i).toString()})}),pm(t,e).forEach(function(i){o.push({op:"add",path:n.add(i).toString(),value:t[i]})}),FT([e,t]).forEach(function(i){o.push.apply(o,r(e[i],t[i],n.add(i)))}),o}hn.diffObjects=BT;function zf(e,t,n,r){if(r===void 0&&(r=zf),e===t)return[];var o=(0,Kl.objectType)(e),i=(0,Kl.objectType)(t);return o=="array"&&i=="array"?zT(e,t,n,r):o=="object"&&i=="object"?BT(e,t,n,r):[{op:"replace",path:n.toString(),value:t}]}hn.diffAny=zf;var Mv=o0&&o0.__extends||function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&(r[i]=o[i])},e(t,n)};return function(t,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}();Object.defineProperty(Tt,"__esModule",{value:!0});Tt.apply=Tt.InvalidOperationError=Tt.test=Tt.copy=Tt.move=Tt.replace=Tt.remove=Tt.add=Tt.TestError=Tt.MissingError=void 0;var bo=Pc,Lv=Ov,x8=hn,Xr=function(e){Mv(t,e);function t(n){var r=e.call(this,"Value required at path: ".concat(n))||this;return r.path=n,r.name="MissingError",r}return t}(Error);Tt.MissingError=Xr;var UT=function(e){Mv(t,e);function t(n,r){var o=e.call(this,"Test failed: ".concat(n," != ").concat(r))||this;return o.actual=n,o.expected=r,o.name="TestError",o}return t}(Error);Tt.TestError=UT;function $v(e,t,n){if(Array.isArray(e))if(t=="-")e.push(n);else{var r=parseInt(t,10);e.splice(r,0,n)}else e[t]=n}function VT(e,t){if(Array.isArray(e)){var n=parseInt(t,10);e.splice(n,1)}else delete e[t]}function HT(e,t){var n=bo.Pointer.fromJSON(t.path).evaluate(e);return n.parent===void 0?new Xr(t.path):($v(n.parent,n.key,(0,Lv.clone)(t.value)),null)}Tt.add=HT;function WT(e,t){var n=bo.Pointer.fromJSON(t.path).evaluate(e);return n.value===void 0?new Xr(t.path):(VT(n.parent,n.key),null)}Tt.remove=WT;function qT(e,t){var n=bo.Pointer.fromJSON(t.path).evaluate(e);if(n.parent===null)return new Xr(t.path);if(Array.isArray(n.parent)){if(parseInt(n.key,10)>=n.parent.length)return new Xr(t.path)}else if(n.value===void 0)return new Xr(t.path);return n.parent[n.key]=(0,Lv.clone)(t.value),null}Tt.replace=qT;function GT(e,t){var n=bo.Pointer.fromJSON(t.from).evaluate(e);if(n.value===void 0)return new Xr(t.from);var r=bo.Pointer.fromJSON(t.path).evaluate(e);return r.parent===void 0?new Xr(t.path):(VT(n.parent,n.key),$v(r.parent,r.key,n.value),null)}Tt.move=GT;function QT(e,t){var n=bo.Pointer.fromJSON(t.from).evaluate(e);if(n.value===void 0)return new Xr(t.from);var r=bo.Pointer.fromJSON(t.path).evaluate(e);return r.parent===void 0?new Xr(t.path):($v(r.parent,r.key,(0,Lv.clone)(n.value)),null)}Tt.copy=QT;function KT(e,t){var n=bo.Pointer.fromJSON(t.path).evaluate(e);return(0,x8.diffAny)(n.value,t.value,new bo.Pointer).length?new UT(n.value,t.value):null}Tt.test=KT;var YT=function(e){Mv(t,e);function t(n){var r=e.call(this,"Invalid operation: ".concat(n.op))||this;return r.operation=n,r.name="InvalidOperationError",r}return t}(Error);Tt.InvalidOperationError=YT;function w8(e,t){switch(t.op){case"add":return HT(e,t);case"remove":return WT(e,t);case"replace":return qT(e,t);case"move":return GT(e,t);case"copy":return QT(e,t);case"test":return KT(e,t)}return new YT(t)}Tt.apply=w8;(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.createTests=e.createPatch=e.applyPatch=e.Pointer=void 0;var t=Pc;Object.defineProperty(e,"Pointer",{enumerable:!0,get:function(){return t.Pointer}});var n=Tt,r=hn;function o(u,d){return d.map(function(f){return(0,n.apply)(u,f)})}e.applyPatch=o;function i(u){function d(f,h,m){var g=u(f,h,m);return Array.isArray(g)?g:(0,r.diffAny)(f,h,m,d)}return d}function s(u,d,f){var h=new t.Pointer;return(f?i(f):r.diffAny)(u,d,h)}e.createPatch=s;function l(u,d){var f=t.Pointer.fromJSON(d).evaluate(u);if(f!==void 0)return{op:"test",path:d,value:f.value}}function c(u,d){var f=new Array;return d.filter(r.isDestructive).forEach(function(h){var m=l(u,h.path);if(m&&f.push(m),"from"in h){var g=l(u,h.from);g&&f.push(g)}}),f}e.createTests=c})($T);const S8="_root_w6lfx_1",b8="_removed_w6lfx_16",C8="_added_w6lfx_21",Wh={root:S8,removed:b8,added:C8};function j8(e){const t=te(),[n,r]=p.useState(!1);if(p.useEffect(()=>{t.requestSchema(e.original.resourceType).then(()=>r(!0)).catch(console.log)},[t,e.original.resourceType]),!n)return null;const o=$T.createPatch(e.original,e.revised),i=[eo(e.original)],s=[eo(e.revised)];return a.jsxs(he,{className:Wh.root,children:[a.jsx(he.Thead,{children:a.jsxs(he.Tr,{children:[a.jsx(he.Th,{}),a.jsx(he.Th,{children:"Before"}),a.jsx(he.Th,{children:"After"})]})}),a.jsx(he.Tbody,{children:o.map(l=>{var y,C,v;if(l.path.startsWith("/meta"))return null;const c=l.path,u=E8(c),d=If(e.original.resourceType,{resourceType:"SearchParameter",base:[e.original.resourceType],code:e.original.resourceType+"."+u,expression:e.original.resourceType+"."+u}),f=(y=d==null?void 0:d.elementDefinitions)==null?void 0:y[0],h=!!(f!=null&&f.isArray),m=l.op==="add"||(C=Gl(u,i))==null?void 0:C[0],g=l.op==="remove"||(v=Gl(u,s))==null?void 0:v[0];return a.jsxs(he.Tr,{children:[a.jsxs(he.Td,{children:[en(l.op)," ",u]}),a.jsx(he.Td,{className:Wh.removed,children:m&&a.jsx(So,{property:f,propertyType:m.type,value:Q1(m.value,h),ignoreMissingValues:!0})}),a.jsx(he.Td,{className:Wh.added,children:g&&a.jsx(So,{property:f,propertyType:g.type,value:Q1(g.value,h),ignoreMissingValues:!0})})]},`op-${l.op}-${l.path}`)})})]})}function E8(e){const t=e.split("/").filter(Boolean);let n="";for(let r=0;r<t.length;r++){const o=t[r];o==="-"?n+=".last()":/^\d+$/.test(o)?n+=`[${o}]`:(r>0&&(n+="."),n+=o)}return n}function Q1(e,t){return Array.isArray(e)&&!t?e[0]:!Array.isArray(e)&&t?[e]:e}function Fv(e){const t=te(),n=st(e.value),[r,o]=p.useState(!1);return p.useEffect(()=>{n&&t.requestSchema(n.resourceType).then(()=>o(!0)).catch(console.log)},[t,n]),!r||!n?null:a.jsx(dm,{value:{type:n.resourceType,value:e.forceUseInput?e.value:n},ignoreMissingValues:e.ignoreMissingValues})}function T8(e){return a.jsx(Ec,{children:e.children})}function es(e){var c,u;const{resource:t,profile:n,padding:r,popupMenuItems:o,...i}=e,s=n??((c=t.meta)==null?void 0:c.author),l=e.dateTime??((u=t.meta)==null?void 0:u.lastUpdated);return a.jsxs(Nv,{"data-testid":"timeline-item",fill:!0,...i,children:[a.jsxs(Y,{justify:"space-between",gap:8,mx:"xs",my:"sm",children:[a.jsx(mi,{value:s,link:!0,size:"md"}),a.jsxs("div",{style:{flex:1},children:[a.jsx(le,{size:"sm",children:a.jsx(Tc,{c:"dark",fw:500,value:s,link:!0})}),a.jsxs(le,{size:"xs",children:[a.jsx(Ae,{c:"dimmed",to:e.resource,children:Mn(l)}),a.jsx(le,{component:"span",c:"dimmed",mx:8,children:"·"}),a.jsx(Ae,{c:"dimmed",to:e.resource,children:e.resource.resourceType})]})]}),o&&a.jsxs(X,{position:"bottom-end",shadow:"md",width:200,children:[a.jsx(X.Target,{children:a.jsx(Ht,{color:"gray",variant:"subtle",radius:"xl","aria-label":`Actions for ${ht(e.resource)}`,children:a.jsx(_$,{})})}),o]})]}),a.jsxs(yT,{children:[r&&a.jsx("div",{style:{padding:"0 16px 16px 16px"},children:e.children}),!r&&a.jsx(a.Fragment,{children:e.children})]})]})}function XT(e,t){e.sort((n,r)=>{const o=K1(n,t),i=K1(r,t);return o>i?1:o<i?-1:Y1(n,t)-Y1(r,t)})}function K1(e,t){if(!JT(e,t)){const n=e.priority;if(typeof n=="string")return{stat:4,asap:3,urgent:2}[n]??0}return 0}function Y1(e,t){var r;if(!JT(e,t)){if(e.resourceType==="Communication"&&e.sent)return new Date(e.sent).getTime();if((e.resourceType==="DiagnosticReport"||e.resourceType==="Media"||e.resourceType==="Observation")&&e.issued)return new Date(e.issued).getTime();if(e.resourceType==="DocumentReference"&&e.date)return new Date(e.date).getTime()}const n=(r=e.meta)==null?void 0:r.lastUpdated;return n?new Date(n).getTime():0}function JT(e,t){return!!t&&e.resourceType===t.resourceType&&e.id===t.id}const P8="_pinnedComment_5uxzi_2",k8={pinnedComment:P8};function Bf(e){const t=te(),n=Af(),r=t.getProfile(),o=p.useRef(null),i=st(e.value),[s,l]=p.useState(),[c,u]=p.useState([]),d=e.loadTimelineResources,f=p.useRef(c);f.current=c;const h=p.useCallback(D=>{XT(D,i),D.reverse(),u(D)},[i]),m=p.useCallback(D=>{const A=[];for(const M of D){if(M.status!=="fulfilled")continue;const B=M.value;if(B.type==="history"&&l(B),B.entry)for(const F of B.entry)A.push(F.resource)}h(A)},[h]),g=p.useCallback(D=>h([...f.current,D]),[h]),y=p.useCallback(()=>{var M;let D,A;"resourceType"in e.value?(D=e.value.resourceType,A=e.value.id):[D,A]=(M=e.value.reference)==null?void 0:M.split("/"),d(t,D,A).then(m).catch(console.log)},[t,e.value,d,m]);p.useEffect(()=>y(),[y]);function C(D){!i||!e.createCommunication||t.createResource(e.createCommunication(i,r,D)).then(A=>g(A)).catch(console.log)}function v(D){!i||!e.createMedia||t.createResource(e.createMedia(i,r,D)).then(A=>g(A)).then(()=>dl({id:"upload-notification",color:"teal",title:"Upload complete",message:"",icon:a.jsx(Nf,{size:16}),autoClose:2e3})).catch(A=>dl({id:"upload-notification",color:"red",title:"Upload error",message:Pe(A),icon:a.jsx($1,{size:16}),autoClose:2e3}))}function x(D,A){return t.updateResource({...D,priority:A})}function w(D){x(D,"stat").then(y).catch(console.log)}function S(D){x(D,"routine").then(y).catch(console.log)}function E(D){n(`/${D.resourceType}/${D.id}`)}function j(D){n(`/${D.resourceType}/${D.id}/edit`)}function T(D){n(`/${D.resourceType}/${D.id}/delete`)}function P(D){var A;n(`/${D.resourceType}/${D.id}/_history/${(A=D.meta)==null?void 0:A.versionId}`)}function R(){ce({id:"upload-notification",loading:!0,title:"Initializing upload...",message:"Please wait...",autoClose:!1,withCloseButton:!1})}function I(D){dl({id:"upload-notification",loading:!0,title:"Uploading...",message:O8(D),autoClose:!1,withCloseButton:!1})}function O(D){dl({id:"upload-notification",color:"red",title:"Upload error",message:Pe(D),icon:a.jsx($1,{size:16}),autoClose:2e3})}return i?a.jsxs(T8,{children:[e.createCommunication&&a.jsx(Nv,{children:a.jsx(Be,{testid:"timeline-form",onSubmit:D=>{C(D.text);const A=o.current;A&&(A.value="",A.focus())},children:a.jsxs(Y,{gap:"xs",wrap:"nowrap",style:{width:"100%"},children:[a.jsx(mi,{value:r}),a.jsx(ie,{name:"text",ref:o,placeholder:"Add comment",style:{width:"100%",maxWidth:300}}),a.jsx(Ht,{type:"submit",radius:"xl",color:"blue",variant:"filled",children:a.jsx(U$,{size:16})}),a.jsx(Pv,{onUpload:v,onUploadStart:R,onUploadProgress:I,onUploadError:O,children:D=>a.jsx(Ht,{...D,radius:"xl",color:"blue",variant:"filled",children:a.jsx(wv,{size:16})})})]})})}),c.map(D=>{var M;if(!D)return null;const A=`${D.resourceType}/${D.id}/${(M=D.meta)==null?void 0:M.versionId}`;if(D.resourceType===i.resourceType&&D.id===i.id)return a.jsx(R8,{history:s,resource:D,onDetails:P},A);switch(D.resourceType){case"AuditEvent":return a.jsx(A8,{resource:D,onDetails:E},A);case"Communication":return a.jsx(I8,{resource:D,onPin:D.priority!=="stat"?w:void 0,onUnpin:D.priority==="stat"?S:void 0,onDetails:E,onEdit:j,onDelete:T},A);case"DiagnosticReport":return a.jsx(N8,{resource:D,onDetails:E,onEdit:j,onDelete:T},A);case"Media":return a.jsx(_8,{resource:D,onDetails:E,onEdit:j,onDelete:T},A);default:return a.jsx(es,{resource:D,padding:!0,children:a.jsx(Fv,{value:D,ignoreMissingValues:!0})},A)}})]}):a.jsx(Ut,{style:{width:"100%",height:"100%"},children:a.jsx(Nn,{})})}function Sa(e){return a.jsxs(X.Dropdown,{children:[a.jsx(X.Label,{children:"Resource"}),e.onPin&&a.jsx(X.Item,{leftSection:a.jsx(W$,{size:14}),onClick:()=>e.onPin(e.resource),"aria-label":`Pin ${ht(e.resource)}`,children:"Pin"}),e.onUnpin&&a.jsx(X.Item,{leftSection:a.jsx(q$,{size:14}),onClick:()=>e.onUnpin(e.resource),"aria-label":`Unpin ${ht(e.resource)}`,children:"Unpin"}),e.onDetails&&a.jsx(X.Item,{leftSection:a.jsx($$,{size:14}),onClick:()=>e.onDetails(e.resource),"aria-label":`Details ${ht(e.resource)}`,children:"Details"}),e.onEdit&&a.jsx(X.Item,{leftSection:a.jsx(A$,{size:14}),onClick:()=>e.onEdit(e.resource),"aria-label":`Edit ${ht(e.resource)}`,children:"Edit"}),e.onDelete&&a.jsxs(a.Fragment,{children:[a.jsx(X.Divider,{}),a.jsx(X.Label,{children:"Danger zone"}),a.jsx(X.Item,{color:"red",leftSection:a.jsx(gT,{size:14}),onClick:()=>e.onDelete(e.resource),"aria-label":`Delete ${ht(e.resource)}`,children:"Delete"})]})]})}function R8(e){const t=D8(e.history,e.resource);return t?a.jsx(es,{resource:e.resource,padding:!0,popupMenuItems:a.jsx(Sa,{...e}),children:a.jsx(j8,{original:t,revised:e.resource})}):a.jsxs(es,{resource:e.resource,padding:!0,popupMenuItems:a.jsx(Sa,{...e}),children:[a.jsx("h3",{children:"Created"}),a.jsx(Fv,{value:e.resource,ignoreMissingValues:!0,forceUseInput:!0})]})}function D8(e,t){const n=e.entry,r=n.findIndex(o=>{var i,s,l;return((s=(i=o.resource)==null?void 0:i.meta)==null?void 0:s.versionId)===((l=t.meta)==null?void 0:l.versionId)});if(!(r>=n.length-1))return n[r+1].resource}function I8(e){var r,o;const n=!e.resource.priority||e.resource.priority==="routine"?void 0:k8.pinnedComment;return a.jsx(es,{resource:e.resource,profile:e.resource.sender,dateTime:e.resource.sent,padding:!0,className:n,popupMenuItems:a.jsx(Sa,{...e}),children:a.jsx("p",{children:(o=(r=e.resource.payload)==null?void 0:r[0])==null?void 0:o.contentString})})}function _8(e){var r;const t=(r=e.resource.content)==null?void 0:r.contentType,n=t&&!t.startsWith("image/")&&!t.startsWith("video/")&&t!=="application/pdf";return a.jsx(es,{resource:e.resource,padding:!!n,popupMenuItems:a.jsx(Sa,{...e}),children:a.jsx(jc,{value:e.resource.content})})}function A8(e){return a.jsx(es,{resource:e.resource,padding:!0,popupMenuItems:a.jsx(Sa,{...e}),children:a.jsx(fr,{children:a.jsx("pre",{children:e.resource.outcomeDesc})})})}function N8(e){return a.jsx(es,{resource:e.resource,padding:!0,popupMenuItems:a.jsx(Sa,{...e}),children:a.jsx(Av,{value:e.resource})})}function O8(e){if(e.lengthComputable){const t=100*e.loaded/e.total;return`Uploaded: ${qh(e.loaded)} / ${qh(e.total)} ${t.toFixed(2)}%`}return`Uploaded: ${qh(e.loaded)}`}function qh(e){if(e===0)return"0.00 B";const t=Math.floor(Math.log(e)/Math.log(1024));return(e/Math.pow(1024,t)).toFixed(2)+" "+" KMGTP".charAt(t)+"B"}function M8(e){return a.jsx(Bf,{value:e.resource,loadTimelineResources:async(t,n,r)=>{const o=`${n}/${r}`;return Promise.allSettled([t.readHistory(n,r),t.search("Task",{_filter:`based-on eq ${o} or focus eq ${o} or subject eq ${o}`,_count:100})])}})}function we(e){const{children:t,...n}=e;return a.jsx(Ec,{children:a.jsx(Nv,{...n,children:t})})}function L8(e){return a.jsx(Bf,{value:e.encounter,loadTimelineResources:async(t,n,r)=>Promise.allSettled([t.readHistory("Encounter",r),t.search("Communication","encounter=Encounter/"+r),t.search("Media","encounter=Encounter/"+r)]),createCommunication:(t,n,r)=>({resourceType:"Communication",status:"completed",encounter:xt(t),subject:t.subject,sender:xt(n),sent:new Date().toISOString(),payload:[{contentString:r}]}),createMedia:(t,n,r)=>({resourceType:"Media",status:"completed",encounter:xt(t),subject:t.subject,operator:xt(n),issued:new Date().toISOString(),content:r})})}function $8(e){let t;try{t=rL(e.path,e.resource)}catch(n){return console.warn("FhirPathDisplay:",n),null}if(t.length>1)throw new Error(`Component "path" for "FhirPathDisplay" must resolve to a single element. Received ${t.length} elements [${JSON.stringify(t,null,2)}]`);return a.jsx(So,{value:t[0]||"",propertyType:e.propertyType})}function F8(e){return a.jsxs(bn,{title:"Export",closeButtonProps:{"aria-label":"Close"},opened:e.visible,onClose:e.onCancel,children:[a.jsxs(W,{display:"flex",style:{justifyContent:"space-between"},children:[e.exportCsv&&a.jsx(X1,{text:"CSV",exportLogic:e.exportCsv,onCancel:e.onCancel}),e.exportTransactionBundle&&a.jsx(X1,{text:"Transaction Bundle",exportLogic:e.exportTransactionBundle,onCancel:e.onCancel})]}),a.jsx(le,{style:{marginTop:"10px",marginLeft:"2px"},children:"Limited to 1000 records"})]})}function X1(e){return a.jsx(Z,{onClick:()=>{e.exportLogic(),e.onCancel()},children:`Export as ${e.text}`})}const z8={string:[ne.EQUALS,ne.NOT,ne.CONTAINS,ne.EXACT],fulltext:[ne.EQUALS,ne.NOT,ne.CONTAINS,ne.EXACT],token:[ne.EQUALS,ne.NOT],reference:[ne.EQUALS,ne.NOT],numeric:[ne.EQUALS,ne.NOT_EQUALS,ne.GREATER_THAN,ne.LESS_THAN,ne.GREATER_THAN_OR_EQUALS,ne.LESS_THAN_OR_EQUALS],quantity:[ne.EQUALS,ne.NOT_EQUALS,ne.GREATER_THAN,ne.LESS_THAN,ne.GREATER_THAN_OR_EQUALS,ne.LESS_THAN_OR_EQUALS],date:[ne.EQUALS,ne.NOT_EQUALS,ne.GREATER_THAN,ne.LESS_THAN,ne.GREATER_THAN_OR_EQUALS,ne.LESS_THAN_OR_EQUALS,ne.STARTS_AFTER,ne.ENDS_BEFORE,ne.APPROXIMATELY],datetime:[ne.EQUALS,ne.NOT_EQUALS,ne.GREATER_THAN,ne.LESS_THAN,ne.GREATER_THAN_OR_EQUALS,ne.LESS_THAN_OR_EQUALS,ne.STARTS_AFTER,ne.ENDS_BEFORE,ne.APPROXIMATELY]},B8={eq:"equals",ne:"not equals",gt:"greater than",lt:"less than",ge:"greater than or equals",le:"less than or equals",sa:"starts after",eb:"ends before",ap:"approximately",contains:"contains",exact:"exact",text:"text",not:"not",above:"above",below:"below",in:"in","not-in":"not in","of-type":"of type",missing:"missing",identifier:"identifier",iterate:"iterate"};function zv(e,t){return{...e,filters:t,offset:0,name:void 0}}function Bv(e,t){return zv(e,(e.filters??[]).filter(n=>n.code!==t))}function Uf(e,t,n,r,o){o&&(e=Bv(e,t));const i=[];return e.filters&&i.push(...e.filters),i.push({code:t,operator:n,value:r??""}),zv(e,i)}function U8(e,t){if(!e.filters)return e;const n=[...e.filters];return n.splice(t,1),{...e,filters:n,name:void 0}}function V8(e,t){return Uv(e,t,-1)}function H8(e,t){return Uv(e,t,0)}function W8(e,t){return Uv(e,t,1)}function Uv(e,t,n){const r=new Date;r.setDate(r.getDate()+n),r.setHours(0,0,0,0);const o=new Date(r.getTime());return o.setDate(o.getDate()+1),o.setTime(o.getTime()-1),Hv(e,t,r,o)}function q8(e,t){return Vv(e,t,-1)}function G8(e,t){return Vv(e,t,0)}function Q8(e,t){return Vv(e,t,1)}function Vv(e,t,n){const r=new Date;r.setMonth(r.getMonth()+n),r.setDate(1),r.setHours(0,0,0,0);const o=new Date(r.getTime());return o.setMonth(o.getMonth()+1),o.setDate(1),o.setHours(0,0,0,0),o.setTime(o.getTime()-1),Hv(e,t,r,o)}function K8(e,t){const n=new Date;return n.setMonth(0),n.setDate(1),n.setHours(0,0,0,0),Hv(e,t,n,new Date)}function Hv(e,t,n,r){return e=Bv(e,t),e=J1(e,t,ne.GREATER_THAN_OR_EQUALS,n),e=J1(e,t,ne.LESS_THAN_OR_EQUALS,r),e}function J1(e,t,n,r){return Uf(e,t,n,r.toISOString())}function Z1(e,t,n=!0){return Uf(e,t,ne.MISSING,n.toString())}function Y8(e,t){return e.offset===t?e:{...e,offset:t,name:void 0}}function X8(e,t){const n=e.count??bc,r=(t-1)*n;return Y8(e,r)}function J8(e,t,n){return t===Z8(e)&&n!==void 0&&n===eF(e)?e:{...e,sortRules:[{code:t,descending:!!n}],name:void 0}}function Z8(e){const t=e.sortRules;if(!t||t.length===0)return;const n=t[0].code;return n.startsWith("-")?n.substr(1):n}function eF(e){const t=e.sortRules;return!t||t.length===0?!1:!!t[0].descending}function tF(e){return z8[e.type]}function Wv(e){return B8[e]??""}function gi(e){let t=e;return t.includes(".")&&(t=t.split(".").pop()),t==="versionId"?"Version ID":(t=t.replace("[x]",""),t=t.replace(/([A-Z])/g," $1"),t=t.replace(/[-_]/g," "),t=t.replace(/\s+/g," "),t=t.trim(),t.toLowerCase()==="id"?"ID":t.split(/\s/).map(en).join(" "))}function nF(e,t){var r,o;const n=t.name;return n==="id"?e.id:n==="meta.versionId"?(r=e.meta)==null?void 0:r.versionId:n==="_lastUpdated"?Mn((o=e.meta)==null?void 0:o.lastUpdated):t.elementDefinition&&`${e.resourceType}.${t.name}`===t.elementDefinition.path?rF(e,t.elementDefinition):t.searchParams&&t.searchParams.length===1&&t.name===t.searchParams[0].code?oF(e,t.searchParams[0]):null}function rF(e,t){var i,s,l;const n=((l=(s=(i=t.path)==null?void 0:i.split("."))==null?void 0:s.pop())==null?void 0:l.replaceAll("[x]",""))??"",[r,o]=Lf({type:e.resourceType,value:e},n);return r?a.jsx(So,{property:t,propertyType:o,value:r,maxWidth:200,ignoreMissingValues:!0,link:!1}):null}function oF(e,t){const n=Gl(t.expression,[{type:e.resourceType,value:e}]);return!n||n.length===0?null:a.jsx(a.Fragment,{children:n.map((r,o)=>a.jsx(So,{propertyType:r.type,value:r.value,maxWidth:200,ignoreMissingValues:!0,link:!1},`${o}-${n.length}`))})}function iF(e){const t=p.useRef(!1),[n,r]=p.useState({search:JSON.parse(On(e.search))}),[o,i]=p.useState(!1);p.useEffect(()=>{r({search:e.search})},[e.search]);const s=p.useMemo(()=>{if(!e.visible)return[];const c=e.search.resourceType,u=SM(c),d=lv(c);return sF(u,d).sort((f,h)=>f.localeCompare(h)).map(f=>({value:f,label:gi(f)}))},[e.visible,e.search.resourceType]);if(!e.visible)return null;function l(c){r({search:{...n.search,fields:c}})}return a.jsx(bn,{title:"Fields",closeButtonProps:{"aria-label":"Close"},opened:e.visible,onClose:()=>{e.onCancel()},size:"auto",withOverlay:!0,closeOnClickOutside:!1,overlayProps:{onMouseDownCapture:()=>{t.current=o},onClick:()=>{t.current||e.onCancel(),t.current=!1},children:a.jsx("div",{"data-testid":"overlay-child"})},children:a.jsxs(Se,{children:[a.jsx(xf,{style:{width:550},placeholder:"Select fields to display",data:s,value:n.search.fields??[],onChange:l,onDropdownOpen:()=>i(!0),onDropdownClose:()=>i(!1),maxDropdownHeight:"250px",clearButtonProps:{"aria-label":"Clear selection"},clearable:!0,searchable:!0}),a.jsx(Y,{justify:"flex-end",children:a.jsx(Z,{onClick:()=>e.onOk(n.search),children:"OK"})})]})})}function sF(e,t){const n=[],r=new Set,o=new Set;for(const i of Object.keys(e.elements))n.push(i),r.add(i.toLowerCase()),o.add(gi(i));if(t)for(const i of Object.keys(t)){const s=gi(i);!r.has(i)&&!o.has(s)&&(n.push(i),r.add(i),o.add(s))}return n}function ZT(e){var o;const{resourceType:t,filter:n}=e,r=(o=pi.types[t].searchParams)==null?void 0:o[n.code];if(r){if(r.type==="reference"&&(n.operator===ne.EQUALS||n.operator===ne.NOT_EQUALS))return a.jsx(Tc,{value:{reference:n.value}});const i=If(t,r);if(n.code==="_lastUpdated"||i.type===Ho.DATETIME)return a.jsx(a.Fragment,{children:Mn(n.value)})}return a.jsx(a.Fragment,{children:n.value})}function eP(e){const t=If(e.resourceType,e.searchParam),n="filter-value";switch(t.type){case Ho.REFERENCE:return a.jsx(Ff,{name:n,defaultValue:e.defaultValue?{reference:e.defaultValue}:void 0,targetTypes:e.searchParam.target,autoFocus:e.autoFocus,onChange:r=>{r?e.onChange(r.reference):e.onChange("")}});case Ho.BOOLEAN:return a.jsx(ur,{name:n,"data-autofocus":e.autoFocus,"data-testid":n,defaultChecked:e.defaultValue==="true",autoFocus:e.autoFocus,onChange:r=>e.onChange(r.currentTarget.checked.toString())});case Ho.DATE:return a.jsx(ie,{type:"date",name:n,"data-autofocus":e.autoFocus,"data-testid":n,defaultValue:e.defaultValue,autoFocus:e.autoFocus,onChange:r=>e.onChange(r.currentTarget.value)});case Ho.DATETIME:return a.jsx(Ji,{name:n,defaultValue:e.defaultValue,autoFocus:e.autoFocus,onChange:e.onChange});case Ho.NUMBER:return a.jsx(ie,{type:"number",name:n,"data-autofocus":e.autoFocus,"data-testid":n,defaultValue:e.defaultValue,autoFocus:e.autoFocus,onChange:r=>e.onChange(r.currentTarget.value)});case Ho.QUANTITY:return a.jsx(Zi,{name:n,defaultValue:aF(e.defaultValue),autoFocus:e.autoFocus,onChange:r=>{r?e.onChange(`${r.value}`):e.onChange("")}});default:return a.jsx(ie,{name:n,"data-autofocus":e.autoFocus,"data-testid":n,defaultValue:e.defaultValue,autoFocus:e.autoFocus,onChange:r=>e.onChange(r.currentTarget.value),placeholder:"Search value"})}}function aF(e){if(e){const[t,n,r]=e.split("|");if(t)return{value:parseFloat(t),system:n,unit:r}}}function lF(e){const[t,n]=p.useState(JSON.parse(On(e.search))),[r,o]=p.useState(-1),i=p.useRef(t);i.current=t,p.useEffect(()=>{n(JSON.parse(On(e.search)))},[e.search]);function s(d){n(Uf(i.current,d.code,d.operator,d.value))}if(!e.visible)return null;const l=e.search.resourceType,c=lv(l)??{},u=t.filters||[];return a.jsxs(bn,{title:"Filters",closeButtonProps:{"aria-label":"Close"},size:900,opened:e.visible,onClose:e.onCancel,children:[a.jsx("div",{children:a.jsxs("table",{children:[a.jsxs("colgroup",{children:[a.jsx("col",{style:{width:200}}),a.jsx("col",{style:{width:200}}),a.jsx("col",{style:{width:380}}),a.jsx("col",{style:{width:120}})]}),a.jsx("thead",{children:a.jsxs("tr",{children:[a.jsx("th",{children:"Field"}),a.jsx("th",{children:"Operation"}),a.jsx("th",{children:"Value"}),a.jsx("th",{children:"Actions"})]})}),a.jsxs("tbody",{children:[u.map((d,f)=>f===r?a.jsx(ew,{resourceType:l,searchParams:c,defaultValue:d,okText:"Save",onOk:h=>{const m=[...u];m[f]=h,n(zv(i.current,m)),o(-1)},onCancel:()=>o(-1)},`filter-${d.code}-${d.operator}-${d.value}-input`):a.jsx(cF,{resourceType:l,searchParams:c,filter:d,onEdit:()=>o(f),onDelete:()=>n(U8(i.current,f))},`filter-${d.code}-${d.operator}-${d.value}-display`)),a.jsx(ew,{resourceType:l,searchParams:c,okText:"Add",onOk:s})]})]})}),a.jsx(Y,{justify:"flex-end",mt:"xl",children:a.jsx(Z,{onClick:()=>e.onOk(i.current),children:"OK"})})]})}function cF(e){const{filter:t}=e;return a.jsxs("tr",{children:[a.jsx("td",{children:gi(t.code)}),a.jsx("td",{children:Wv(t.operator)}),a.jsx("td",{children:a.jsx(ZT,{resourceType:e.resourceType,filter:t})}),a.jsxs("td",{children:[a.jsx(Z,{size:"compact-md",variant:"outline",onClick:e.onEdit,children:"Edit"}),a.jsx(Z,{size:"size-md",variant:"outline",onClick:e.onDelete,children:"Delete"})]})]})}function ew(e){const[t,n]=p.useState(e.defaultValue??{}),r=p.useRef(t);r.current=t;function o(u){n({...r.current,code:u})}function i(u){n({...r.current,operator:u})}function s(u){n({...r.current,value:u})}const l=e.searchParams[t.code],c=l&&tF(l);return a.jsxs("tr",{children:[a.jsx("td",{children:a.jsx(mt,{"data-testid":"filter-field",defaultValue:r.current.code,onChange:u=>o(u.currentTarget.value),data:["",...Object.keys(e.searchParams).map(u=>({value:u,label:gi(u)}))]})}),a.jsx("td",{children:c&&a.jsx(mt,{"data-testid":"filter-operation",defaultValue:t.operator,onChange:u=>i(u.currentTarget.value),data:["",...c.map(u=>({value:u,label:Wv(u)}))]})}),a.jsx("td",{children:l&&t.operator&&a.jsx(eP,{resourceType:e.resourceType,searchParam:l,defaultValue:t.value,onChange:s})}),a.jsxs("td",{children:[t.code&&t.operator&&a.jsx(Z,{size:"compact-md",variant:"outline",onClick:()=>{e.onOk(r.current),n({})},children:e.okText}),e.onCancel&&a.jsx(Z,{size:"compact-md",variant:"outline",onClick:e.onCancel,children:"Cancel"})]})]})}function uF(e){const[t,n]=p.useState(e.defaultValue??"");if(!e.visible||!e.searchParam||!e.filter)return null;function r(){e.onOk({...e.filter,value:t})}return a.jsx(bn,{title:e.title,size:"xl",opened:e.visible,onClose:e.onCancel,children:a.jsx(Be,{onSubmit:r,children:a.jsxs(Vn,{children:[a.jsx(Vn.Col,{span:10,children:a.jsx(eP,{resourceType:e.resourceType,searchParam:e.searchParam,defaultValue:t,autoFocus:!0,onChange:n})}),a.jsx(Vn.Col,{span:2,children:a.jsx(Z,{onClick:r,fullWidth:!0,children:"OK"})})]})})})}function dF(e){if(!e.searchParams)return null;function t(i,s){o(J8(e.search,i.code,s))}function n(i){o(Bv(e.search,i.code))}function r(i,s){e.onPrompt(i,{code:i.code,operator:s,value:""})}function o(i){e.onChange(i)}return e.searchParams.length===1?a.jsx(fF,{search:e.search,searchParam:e.searchParams[0],onSort:t,onPrompt:r,onChange:o,onClear:n}):a.jsx(X.Dropdown,{children:e.searchParams.map(i=>a.jsx(X.Item,{children:gi(i.code)},i.code))})}function fF(e){switch(e.searchParam.type){case"date":return a.jsx(hF,{...e});case"number":case"quantity":return a.jsx(pF,{...e});case"reference":return a.jsx(mF,{...e});case"string":case"token":case"uri":return a.jsx(gF,{...e});default:return a.jsxs(a.Fragment,{children:["Unknown search param type: ",e.searchParam.type]})}}function hF(e){const{searchParam:t}=e,n=t.code;return a.jsxs(X.Dropdown,{children:[a.jsx(X.Item,{leftSection:a.jsx(Sv,{size:14}),onClick:()=>e.onSort(t,!1),children:"Sort Oldest to Newest"}),a.jsx(X.Item,{leftSection:a.jsx(bv,{size:14}),onClick:()=>e.onSort(t,!0),children:"Sort Newest to Oldest"}),a.jsx(X.Divider,{}),a.jsx(X.Item,{leftSection:a.jsx(Mf,{size:14}),onClick:()=>e.onPrompt(t,ne.EQUALS),children:"Equals..."}),a.jsx(X.Item,{leftSection:a.jsx(Of,{size:14}),onClick:()=>e.onPrompt(t,ne.NOT_EQUALS),children:"Does not equal..."}),a.jsx(X.Divider,{}),a.jsx(X.Item,{leftSection:a.jsx(mT,{size:14}),onClick:()=>e.onPrompt(t,ne.ENDS_BEFORE),children:"Before..."}),a.jsx(X.Item,{leftSection:a.jsx(pT,{size:14}),onClick:()=>e.onPrompt(t,ne.STARTS_AFTER),children:"After..."}),a.jsx(X.Item,{leftSection:a.jsx(S$,{size:14}),onClick:()=>e.onPrompt(t,ne.EQUALS),children:"Between..."}),a.jsx(X.Divider,{}),a.jsx(X.Item,{leftSection:a.jsx(ki,{size:14}),onClick:()=>e.onChange(W8(e.search,n)),children:"Tomorrow"}),a.jsx(X.Item,{leftSection:a.jsx(ki,{size:14}),onClick:()=>e.onChange(H8(e.search,n)),children:"Today"}),a.jsx(X.Item,{leftSection:a.jsx(ki,{size:14}),onClick:()=>e.onChange(V8(e.search,n)),children:"Yesterday"}),a.jsx(X.Divider,{}),a.jsx(X.Item,{leftSection:a.jsx(ki,{size:14}),onClick:()=>e.onChange(Q8(e.search,n)),children:"Next Month"}),a.jsx(X.Item,{leftSection:a.jsx(ki,{size:14}),onClick:()=>e.onChange(G8(e.search,n)),children:"This Month"}),a.jsx(X.Item,{leftSection:a.jsx(ki,{size:14}),onClick:()=>e.onChange(q8(e.search,n)),children:"Last Month"}),a.jsx(X.Divider,{}),a.jsx(X.Item,{leftSection:a.jsx(ki,{size:14}),onClick:()=>e.onChange(K8(e.search,n)),children:"Year to date"}),a.jsx(Vf,{...e})]})}function pF(e){const{searchParam:t}=e;return a.jsxs(X.Dropdown,{children:[a.jsx(X.Item,{leftSection:a.jsx(Sv,{size:14}),onClick:()=>e.onSort(t,!1),children:"Sort Smallest to Largest"}),a.jsx(X.Item,{leftSection:a.jsx(bv,{size:14}),onClick:()=>e.onSort(t,!0),children:"Sort Largest to Smallest"}),a.jsx(X.Divider,{}),a.jsx(X.Item,{leftSection:a.jsx(Mf,{size:14}),onClick:()=>e.onPrompt(t,ne.EQUALS),children:"Equals..."}),a.jsx(X.Item,{leftSection:a.jsx(Of,{size:14}),onClick:()=>e.onPrompt(t,ne.NOT_EQUALS),children:"Does not equal..."}),a.jsx(X.Divider,{}),a.jsx(X.Item,{leftSection:a.jsx(pT,{size:14}),onClick:()=>e.onPrompt(t,ne.GREATER_THAN),children:"Greater than..."}),a.jsx(X.Item,{leftSection:a.jsx(cm,{size:14}),onClick:()=>e.onPrompt(t,ne.GREATER_THAN_OR_EQUALS),children:"Greater than or equal to..."}),a.jsx(X.Item,{leftSection:a.jsx(mT,{size:14}),onClick:()=>e.onPrompt(t,ne.LESS_THAN),children:"Less than..."}),a.jsx(X.Item,{leftSection:a.jsx(cm,{size:14}),onClick:()=>e.onPrompt(t,ne.LESS_THAN_OR_EQUALS),children:"Less than or equal to..."}),a.jsx(Vf,{...e})]})}function mF(e){const{searchParam:t}=e;return a.jsxs(X.Dropdown,{children:[a.jsx(X.Item,{leftSection:a.jsx(Mf,{size:14}),onClick:()=>e.onPrompt(t,ne.EQUALS),children:"Equals..."}),a.jsx(X.Item,{leftSection:a.jsx(Of,{size:14}),onClick:()=>e.onPrompt(t,ne.NOT),children:"Does not equal..."}),a.jsx(Vf,{...e})]})}function gF(e){const{searchParam:t}=e;return a.jsxs(X.Dropdown,{children:[a.jsx(X.Item,{leftSection:a.jsx(Sv,{size:14}),onClick:()=>e.onSort(t,!1),children:"Sort A to Z"}),a.jsx(X.Item,{leftSection:a.jsx(bv,{size:14}),onClick:()=>e.onSort(t,!0),children:"Sort Z to A"}),a.jsx(X.Divider,{}),a.jsx(X.Item,{leftSection:a.jsx(Mf,{size:14}),onClick:()=>e.onPrompt(t,ne.EQUALS),children:"Equals..."}),a.jsx(X.Item,{leftSection:a.jsx(Of,{size:14}),onClick:()=>e.onPrompt(t,ne.NOT),children:"Does not equal..."}),a.jsx(X.Divider,{}),a.jsx(X.Item,{leftSection:a.jsx(j$,{size:14}),onClick:()=>e.onPrompt(t,ne.CONTAINS),children:"Contains..."}),a.jsx(X.Item,{leftSection:a.jsx(C$,{size:14}),onClick:()=>e.onPrompt(t,ne.EQUALS),children:"Does not contain..."}),a.jsx(Vf,{...e})]})}function Vf(e){const{searchParam:t}=e,n=t.code;return a.jsxs(a.Fragment,{children:[a.jsx(X.Divider,{}),a.jsx(X.Item,{leftSection:a.jsx(x$,{size:14}),onClick:()=>e.onChange(Z1(e.search,n)),children:"Missing"}),a.jsx(X.Item,{leftSection:a.jsx(v$,{size:14}),onClick:()=>e.onChange(Z1(e.search,n,!1)),children:"Not missing"}),a.jsx(X.Divider,{}),a.jsx(X.Item,{leftSection:a.jsx(xd,{size:14}),onClick:()=>e.onClear(t),children:"Clear filters"})]})}const yF="_root_adxl2_1",vF="_table_adxl2_8",xF="_tr_adxl2_12",wF="_th_adxl2_18",SF="_control_adxl2_22",bF="_icon_adxl2_31",Za={root:yF,table:vF,tr:xF,th:wF,control:SF,icon:bF};function CF(e){const t=e.resourceType,n=[];for(const r of e.fields||["id","_lastUpdated"])n.push(jF(t,r));return n}function jF(e,t){var o;if(t==="_lastUpdated")return{name:"_lastUpdated",searchParams:[{resourceType:"SearchParameter",base:["Resource"],code:"_lastUpdated",name:"_lastUpdated",type:"date",expression:"Resource.meta.lastUpdated"}]};if(t==="meta.versionId")return{name:"meta.versionId",searchParams:[{resourceType:"SearchParameter",base:["Resource"],code:"_versionId",name:"_versionId",type:"token",expression:"Resource.meta.versionId"}]};const n=gs(e,t),r=kM(e,t.toLowerCase());if(n&&r)return{name:t,elementDefinition:n,searchParams:[r]};if(n){const i=lv(e);let s;if(i){const l=new RegExp(`${e}\\.${t.replaceAll("[x]","")}([^\\w-]|$)`);s=Object.values(i).filter(c=>!!c.expression&&l.test(c==null?void 0:c.expression)),s.length===0&&(s=void 0)}return{name:t,elementDefinition:n,searchParams:s}}if(r){const i=If(e,r);return{name:t,elementDefinition:(o=i.elementDefinitions)==null?void 0:o[0],searchParams:[r]}}return{name:t}}class EF extends Event{constructor(t){super("change"),this.definition=t}}class TF extends Event{constructor(t){super("load"),this.response=t}}class Sd extends Event{constructor(t,n){super("click"),this.resource=t,this.browserEvent=n}}function PF(e){var M,B,F;const t=te(),[n,r]=p.useState(),[o,i]=p.useState(),{search:s,onLoad:l}=e,[c,u]=p.useState({selected:{},fieldEditorVisible:!1,filterEditorVisible:!1,exportDialogVisible:!1,filterDialogVisible:!1}),d=p.useRef(c);d.current=c;const f=s.total??"accurate",h=p.useCallback(_=>{i(void 0),t.search(s.resourceType,Hs({...s,total:f,fields:void 0}),_).then(k=>{u({...d.current,searchResponse:k}),l&&l(new TF(k))}).catch(k=>{u({...d.current,searchResponse:void 0}),i(k)})},[t,s,f,l]),m=p.useCallback(()=>{u({...d.current,searchResponse:void 0}),h({cache:"reload"})},[h]);p.useEffect(()=>{h()},[h]);function g(_,k){_.stopPropagation();const q=_.target.checked,Q={...d.current.selected};q?Q[k]=!0:delete Q[k],u({...d.current,selected:Q})}function y(_){_.stopPropagation();const z=_.target.checked,q={},Q=d.current.searchResponse;z&&(Q!=null&&Q.entry)&&Q.entry.forEach(re=>{var Ce;(Ce=re.resource)!=null&&Ce.id&&(q[re.resource.id]=!0)}),u({...d.current,selected:q})}function C(){var k,z;const _=d.current;if(!((k=_.searchResponse)!=null&&k.entry)||_.searchResponse.entry.length===0)return!1;for(const q of _.searchResponse.entry)if((z=q.resource)!=null&&z.id&&!_.selected[q.resource.id])return!1;return!0}function v(_){e.onChange&&e.onChange(new EF(_))}function x(_,k){if(vT(_.target)||_.button===2)return;et(_);const z=_.button===1||_.ctrlKey||_.metaKey;!z&&e.onClick&&e.onClick(new Sd(k,_)),z&&e.onAuxClick&&e.onAuxClick(new Sd(k,_))}function w(){return!!(e.onExport??e.onExportCsv??e.onExportTransactionBundle)}if(p.useEffect(()=>{r(e.search.resourceType),t.requestSchema(e.search.resourceType).catch(console.error).finally(()=>r(void 0))},[t,e.search.resourceType]),!KE(e.search.resourceType)||n===e.search.resourceType)return a.jsx(Ut,{style:{width:"100%",height:"100%"},children:a.jsx(Nn,{})});const S=e.checkboxesEnabled,E=CF(s),j=s.resourceType,T=c.searchResponse,P=T==null?void 0:T.entry,R=P==null?void 0:P.map(_=>_.resource),I="subtle",O="gray",D=16,A=window.innerWidth<768;return a.jsxs("div",{className:Za.root,"data-testid":"search-control",children:[!e.hideToolbar&&a.jsxs(Y,{justify:"space-between",mb:"xl",children:[a.jsxs(Y,{gap:2,children:[a.jsx(Z,{size:"compact-md",variant:I,color:O,leftSection:a.jsx(R$,{size:D}),onClick:()=>u({...d.current,fieldEditorVisible:!0}),children:"Fields"}),a.jsx(Z,{size:"compact-md",variant:I,color:O,leftSection:a.jsx(O$,{size:D}),onClick:()=>u({...d.current,filterEditorVisible:!0}),children:"Filters"}),e.onNew&&a.jsx(Z,{size:"compact-md",variant:I,color:O,leftSection:a.jsx(N$,{size:D}),onClick:e.onNew,children:"New..."}),!A&&w()&&a.jsx(Z,{size:"compact-md",variant:I,color:O,leftSection:a.jsx(n7,{size:D}),onClick:e.onExport?e.onExport:()=>u({...d.current,exportDialogVisible:!0}),children:"Export..."}),!A&&e.onDelete&&a.jsx(Z,{size:"compact-md",variant:I,color:O,leftSection:a.jsx(gT,{size:D}),onClick:()=>e.onDelete(Object.keys(c.selected)),children:"Delete..."}),!A&&e.onBulk&&a.jsx(Z,{size:"compact-md",variant:I,color:O,leftSection:a.jsx(w$,{size:D}),onClick:()=>e.onBulk(Object.keys(c.selected)),children:"Bulk..."})]}),a.jsxs(Y,{gap:2,children:[T&&a.jsxs(le,{size:"xs",c:"dimmed",children:[IF(s,T.total),"-",_F(s,T.total)," of"," ",`${f==="estimate"?"~":""}${(M=T.total)==null?void 0:M.toLocaleString()}`]}),a.jsx(Ht,{variant:I,color:O,title:"Refresh",onClick:m,children:a.jsx(Y$,{size:D})})]})]}),a.jsxs(he,{className:Za.table,children:[a.jsxs(he.Thead,{children:[a.jsxs(he.Tr,{children:[S&&a.jsx(he.Th,{children:a.jsx("input",{type:"checkbox",value:"checked","aria-label":"all-checkbox","data-testid":"all-checkbox",checked:C(),onChange:_=>y(_)})}),E.map(_=>a.jsx(he.Th,{children:a.jsxs(X,{shadow:"md",width:240,position:"bottom-end",children:[a.jsx(X.Target,{children:a.jsx(Gn,{className:Za.control,p:2,children:a.jsxs(Y,{justify:"space-between",wrap:"nowrap",children:[a.jsx(le,{fw:500,children:gi(_.name)}),a.jsx(Ut,{className:Za.icon,children:a.jsx(m$,{size:14,stroke:1.5})})]})})}),a.jsx(dF,{search:e.search,searchParams:_.searchParams,onPrompt:(k,z)=>{u({...d.current,filterDialogVisible:!0,filterDialogSearchParam:k,filterDialogFilter:z})},onChange:k=>{v(k)}})]})},_.name))]}),!e.hideFilters&&a.jsxs(he.Tr,{children:[S&&a.jsx(he.Th,{}),E.map(_=>a.jsx(he.Th,{children:_.searchParams&&a.jsx(kF,{resourceType:j,searchParams:_.searchParams,filters:e.search.filters})},_.name))]})]}),a.jsx(he.Tbody,{children:R==null?void 0:R.map(_=>_&&a.jsxs(he.Tr,{className:Za.tr,"data-testid":"search-control-row",onClick:k=>x(k,_),onAuxClick:k=>x(k,_),children:[S&&a.jsx(he.Td,{children:a.jsx("input",{type:"checkbox",value:"checked","data-testid":"row-checkbox","aria-label":`Checkbox for ${_.id}`,checked:!!c.selected[_.id],onChange:k=>g(k,_.id)})}),E.map(k=>a.jsx(he.Td,{children:nF(_,k)},k.name))]},_.id))})]}),(R==null?void 0:R.length)===0&&a.jsx(Ec,{children:a.jsx(Ut,{style:{height:150},children:a.jsx(le,{size:"xl",c:"dimmed",children:"No results"})})}),(T==null?void 0:T.total)!==void 0&&T.total>0&&a.jsx(Ut,{m:"md",p:"md",children:a.jsx(Nr,{value:RF(s),total:DF(s,T.total),onChange:_=>v(X8(s,_)),getControlProps:_=>{switch(_){case"previous":return{"aria-label":"Previous page"};case"next":return{"aria-label":"Next page"};default:return{}}}})}),o&&a.jsx("div",{"data-testid":"search-error",children:a.jsx("pre",{style:{textAlign:"left"},children:JSON.stringify(o,void 0,2)})}),a.jsx(iF,{search:e.search,visible:d.current.fieldEditorVisible,onOk:_=>{v(_),u({...d.current,fieldEditorVisible:!1})},onCancel:()=>{u({...d.current,fieldEditorVisible:!1})}}),a.jsx(lF,{search:e.search,visible:d.current.filterEditorVisible,onOk:_=>{v(_),u({...d.current,filterEditorVisible:!1})},onCancel:()=>{u({...d.current,filterEditorVisible:!1})}}),a.jsx(F8,{visible:d.current.exportDialogVisible,exportCsv:e.onExportCsv,exportTransactionBundle:e.onExportTransactionBundle,onCancel:()=>{u({...d.current,exportDialogVisible:!1})}}),a.jsx(uF,{visible:d.current.filterDialogVisible,title:(B=c.filterDialogSearchParam)!=null&&B.code?gi(c.filterDialogSearchParam.code):"",resourceType:j,searchParam:c.filterDialogSearchParam,filter:c.filterDialogFilter,defaultValue:"",onOk:_=>{v(Uf(e.search,_.code,_.operator,_.value)),u({...d.current,filterDialogVisible:!1})},onCancel:()=>{u({...d.current,filterDialogVisible:!1})}},(F=c.filterDialogSearchParam)==null?void 0:F.code)]})}const kc=p.memo(PF);function kF(e){const t=(e.filters??[]).filter(n=>e.searchParams.find(r=>r.code===n.code));return t.length===0?a.jsx("span",{children:"no filters"}):a.jsx(a.Fragment,{children:t.map(n=>a.jsxs("div",{children:[Wv(n.operator)," ",a.jsx(ZT,{resourceType:e.resourceType,filter:n})]},`filter-${n.code}-${n.operator}-${n.value}`))})}function RF(e){return Math.floor((e.offset??0)/(e.count??bc))+1}function DF(e,t){const n=e.count??bc;return Math.ceil(t/n)}function IF(e,t){return Math.min(t,(e.offset??0)+1)}function _F(e,t){return Math.min(t,((e.offset??0)+1)*(e.count??bc))}function AF(e){const t=te(),[n,r]=p.useState(!1),[o,i]=p.useState(),{query:s,fields:l}=e,[c,u]=p.useState(),[d,f]=p.useState({}),h=p.useRef();h.current=c;const m=p.useRef({});m.current=d,p.useEffect(()=>{i(void 0),t.graphql(s).then(u).catch(w=>i(ut(w)))},[t,s]);function g(w,S){w.stopPropagation();const j=w.target.checked,T={...m.current};j?T[S]=!0:delete T[S],f(T)}function y(w){var P;w.stopPropagation();const E=w.target.checked,j={},T=(P=h.current)==null?void 0:P.data.ResourceList;E&&T&&T.forEach(R=>{R.id&&(j[R.id]=!0)}),f(j)}function C(){var S;const w=(S=h.current)==null?void 0:S.data.ResourceList;if(!w||w.length===0)return!1;for(const E of w)if(E.id&&!m.current[E.id])return!1;return!0}function v(w,S){vT(w.target)||(et(w),w.button!==1&&e.onClick&&e.onClick(new Sd(S,w)),w.button===1&&e.onAuxClick&&e.onAuxClick(new Sd(S,w)))}if(p.useEffect(()=>{t.requestSchema(e.resourceType).then(()=>r(!0)).catch(console.log)},[t,e.resourceType]),!n)return a.jsx(Nn,{});const x=e.checkboxesEnabled;return a.jsxs("div",{onContextMenu:w=>et(w),"data-testid":"search-control",children:[a.jsxs(he,{children:[a.jsx(he.Thead,{children:a.jsxs(he.Tr,{children:[x&&a.jsx(he.Th,{children:a.jsx("input",{type:"checkbox",value:"checked","aria-label":"all-checkbox","data-testid":"all-checkbox",checked:C(),onChange:w=>y(w)})}),l.map(w=>a.jsx(he.Th,{children:w.name},w.name))]})}),a.jsx(he.Tbody,{children:c==null?void 0:c.data.ResourceList.map(w=>w&&a.jsxs(he.Tr,{"data-testid":"search-control-row",onClick:S=>v(S,w),onAuxClick:S=>v(S,w),children:[x&&a.jsx(he.Td,{children:a.jsx("input",{type:"checkbox",value:"checked","data-testid":"row-checkbox","aria-label":`Checkbox for ${w.id}`,checked:!!d[w.id],onChange:S=>g(S,w.id)})}),l.map(S=>a.jsx(he.Td,{children:a.jsx($8,{propertyType:S.propertyType,path:S.fhirPath,resource:w})},S.name))]},w.id))})]}),(c==null?void 0:c.data.ResourceList.length)===0&&a.jsx("div",{"data-testid":"empty-search",children:"No results"}),o&&a.jsx("div",{"data-testid":"search-error",children:a.jsx("pre",{style:{textAlign:"left"},children:JSON.stringify(o,void 0,2)})}),e.onBulk&&a.jsx(Z,{onClick:()=>e.onBulk(Object.keys(m.current)),children:"Bulk..."})]})}const NF=p.memo(AF);function Or(e){return a.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 491 491",style:{width:e.size,height:e.size},children:[a.jsx("title",{children:"Medplum Logo"}),a.jsx("path",{fill:e.fill??"#ad7136",d:"M282 67c6-16 16-29 29-40L289 0c-22 17-37 41-43 68l17 23 19-24z"}),a.jsx("path",{fill:e.fill??"#946af9",d:"M311 63c-17 0-33 4-48 11-16-7-32-11-49-11-87 0-158 96-158 214s71 214 158 214c17 0 33-4 49-11 15 7 31 11 48 11 87 0 158-96 158-214S398 63 311 63z"}),a.jsx("path",{fill:e.fill??"#7857c5",d:"M231 489l-17 2c-87 0-158-96-158-214S127 63 214 63l17 1c-39 12-70 102-70 213s31 201 70 212z"}),a.jsx("path",{fill:e.fill??"#40bc26",d:"M207 220a176 176 0 01-177 43A176 176 0 01251 43l1 5c17 59 2 125-45 172z"}),a.jsx("path",{fill:e.fill??"#33961e",d:"M252 48A421 421 0 0057 270l-27-7A176 176 0 01251 43l1 5z"})]})}function OF(e){const{group:t}=e;return a.jsx(_n,{withBorder:!0,radius:"md",p:"xs",display:"flex",style:{alignItems:"center",justifyContent:"center"},children:a.jsxs(Y,{children:[t.measureScore&&a.jsx($F,{group:t}),!t.measureScore&&a.jsx(LF,{group:t})]})})}function MF(e){const{measure:t}=e;return a.jsxs(a.Fragment,{children:[a.jsx(le,{fz:"md",fw:500,mb:8,children:t.title}),a.jsx(le,{fz:"xs",c:"dimmed",mb:8,children:t.subtitle})]})}function LF(e){const{group:t}=e,n=t.population,r=n==null?void 0:n.find(c=>va(c.code)==="numerator"),o=n==null?void 0:n.find(c=>va(c.code)==="denominator"),i=r==null?void 0:r.count,s=o==null?void 0:o.count;if(s===0)return a.jsxs(W,{children:[a.jsx(ae,{order:3,children:"Not Applicable"}),a.jsx(le,{children:`Denominator: ${s}`})]});if(i===void 0||s===void 0)return a.jsxs(W,{children:[a.jsx(ae,{order:3,children:"Insufficient Data"}),a.jsx(le,{children:`Numerator: ${i}`}),a.jsx(le,{children:`Denominator: ${s}`})]});const l=i/s*100;return a.jsx(Ef,{size:120,thickness:12,roundCaps:!0,sections:[{value:l,color:tP(l)}],label:a.jsx(pa,{justify:"center",children:a.jsxs(le,{fw:700,fz:18,children:[i," / ",s]})})})}function $F(e){var r,o,i;const{group:t}=e,n=((r=t.measureScore)==null?void 0:r.unit)??((o=t.measureScore)==null?void 0:o.code);return a.jsx(a.Fragment,{children:n==="%"?a.jsx(Ef,{size:120,thickness:12,roundCaps:!0,sections:[{value:FF(t),color:tP(((i=t==null?void 0:t.measureScore)==null?void 0:i.value)??0)}],label:a.jsx(pa,{justify:"center",children:a.jsx(le,{fw:700,fz:18,children:a.jsx(Ql,{value:t.measureScore})})})}):a.jsx(pa,{h:120,align:"center",children:a.jsx(ae,{order:3,children:a.jsx(Ql,{value:t.measureScore})})})})}function FF(e){var r,o;const t=(r=e.measureScore)==null?void 0:r.value,n=(o=e.measureScore)==null?void 0:o.unit;return t?t<=1&&n==="%"?t*100:t:0}function tP(e){return e<=33?"red":e<=67?"yellow":"green"}function zF(e){var r;const t=st(e.measureReport),[n]=i$("Measure",{url:t==null?void 0:t.measure});return t?a.jsxs(W,{children:[n&&a.jsx(MF,{measure:n}),a.jsx(Uy,{cols:{base:3,sm:1},spacing:{base:"md",sm:"sm"},children:(r=t.group)==null?void 0:r.map((o,i)=>a.jsx(OF,{group:o},o.id??i))})]}):null}function to(e){var n;const t=((n=e.outcome)==null?void 0:n.issue)||e.issues;return!t||t.length===0?null:a.jsx(us,{icon:a.jsx(Cc,{size:16}),color:"red",children:t.map(r=>{var o;return a.jsx("div",{"data-testid":"text-field-error",children:NE(r)},(o=r.details)==null?void 0:o.text)})})}function BF(e){const t=p.useCallback((n,r,o)=>{const i=`${r}/${o}`,s=100;return Promise.allSettled([n.readHistory("Patient",o),n.search("Communication",{subject:i,_count:s}),n.search("Device",{patient:i,_count:s}),n.search("DeviceRequest",{patient:i,_count:s}),n.search("DiagnosticReport",{subject:i,_count:s}),n.search("Media",{subject:i,_count:s}),n.search("ServiceRequest",{subject:i,_count:s}),n.search("Task",{subject:i,_count:s})])},[]);return a.jsx(Bf,{value:e.patient,loadTimelineResources:t,createCommunication:(n,r,o)=>({resourceType:"Communication",status:"completed",subject:xt(n),sender:xt(r),sent:new Date().toISOString(),payload:[{contentString:o}]}),createMedia:(n,r,o)=>({resourceType:"Media",status:"completed",subject:xt(n),operator:xt(r),issued:new Date().toISOString(),content:o})})}const UF="_section_14dzq_2",VF="_hovering_14dzq_11",HF="_editing_14dzq_15",WF="_bottomActions_14dzq_20",Ws={section:UF,hovering:VF,editing:HF,bottomActions:WF};function qF(e){const t=te(),n=st(e.value),[r,o]=p.useState(!1),[i,s]=p.useState(),[l,c]=p.useState(),[u,d]=p.useState();function f(){c(void 0)}function h(){s(void 0)}const m=p.useRef();if(m.current=u,p.useEffect(()=>{t.requestSchema("PlanDefinition").then(()=>o(!0)).catch(console.log)},[t]),p.useEffect(()=>(d(JF(n??{resourceType:"PlanDefinition",status:"active"})),document.addEventListener("mouseover",f),document.addEventListener("click",h),()=>{document.removeEventListener("mouseover",f),document.removeEventListener("click",h)}),[n]),!r||!u)return null;function g(y,C){d({...m.current,[y]:C})}return a.jsx("div",{children:a.jsxs(Be,{testid:"questionnaire-form",onSubmit:()=>e.onSubmit(u),children:[a.jsx(ie,{label:"Plan Title",defaultValue:u.title,onChange:y=>g("title",y.currentTarget.value)}),a.jsx(nP,{actions:u.action||[],selectedKey:i,setSelectedKey:s,hoverKey:l,setHoverKey:c,onChange:y=>g("action",y)}),a.jsx(Z,{type:"submit",children:"Save"})]})})}function nP(e){const t=p.useRef();t.current=e.actions;function n(i){e.onChange(t.current.map(s=>s.id===i.id?i:s))}function r(i){e.onChange([...t.current,i]),e.setSelectedKey(i.id)}function o(i){e.onChange(t.current.filter(s=>s!==i))}return a.jsxs("div",{className:Ws.section,children:[e.actions.map(i=>a.jsx("div",{children:a.jsx(GF,{action:i,selectedKey:e.selectedKey,setSelectedKey:e.setSelectedKey,hoverKey:e.hoverKey,setHoverKey:e.setHoverKey,onChange:n,onRemove:()=>o(i)})},i.id)),a.jsx("div",{className:Ws.bottomActions,children:a.jsx(Ue,{href:"#",onClick:i=>{et(i),r({id:oP()})},children:"Add action"})})]})}function GF(e){const{action:t}=e,n=XF(t),r=e.selectedKey===e.action.id,o=e.hoverKey===e.action.id;function i(c){c.stopPropagation(),e.setSelectedKey(e.action.id)}function s(c){et(c),e.setHoverKey(e.action.id)}const l=Ye(Ws.section,{[Ws.editing]:r,[Ws.hovering]:o&&!r});return a.jsxs("div",{"data-testid":t.id,className:l,onClick:i,onMouseOver:s,onFocus:s,children:[r?a.jsx(KF,{action:t,actionType:n,onChange:e.onChange,selectedKey:e.selectedKey,setSelectedKey:e.setSelectedKey,hoverKey:e.hoverKey,setHoverKey:e.setHoverKey,onRemove:e.onRemove}):a.jsx(QF,{action:t,actionType:n}),a.jsx("div",{className:Ws.bottomActions,children:a.jsx(Ue,{href:"#",onClick:c=>{c.preventDefault(),e.onRemove()},children:"Remove"})})]})}const mm={path:"PlanDefinition.action.timing[x]",min:0,max:1,description:"",isArray:!1,constraints:[],type:["dateTime","Period","Range","Timing"].map(e=>({code:e}))};function QF(e){const{action:t,actionType:n}=e,[r,o]=rP(t);return a.jsxs("div",{children:[a.jsxs("div",{children:[t.title||"Untitled"," ",n&&`(${n})`]}),t.definitionCanonical&&a.jsx("div",{children:a.jsx(wd,{value:{reference:t.definitionCanonical}})}),r&&a.jsx("div",{children:a.jsx(So,{property:mm,propertyType:o,value:r})})]})}function KF(e){const{action:t}=e,[n,r]=p.useState(e.actionType);function o(i,s){e.onChange({...t,[i]:s})}return a.jsxs(Se,{gap:"xl",children:[a.jsx(ie,{name:`actionTitle-${t.id}`,label:"Title",defaultValue:t.title,onChange:i=>o("title",i.currentTarget.value)}),a.jsx(ie,{name:`actionDescription-${t.id}`,label:"Description",defaultValue:t.description,onChange:i=>o("description",i.currentTarget.value)}),a.jsx(mt,{label:"Type of Action",description:"The type of the action to be performed.",name:`actionType-${t.id}`,defaultValue:n,onChange:i=>r(i.currentTarget.value),data:["","appointment","lab","questionnaire","task"]}),t.action&&t.action.length>0&&a.jsx(nP,{actions:t.action,selectedKey:e.selectedKey,setSelectedKey:e.setSelectedKey,hoverKey:e.hoverKey,setHoverKey:e.setHoverKey,onChange:i=>o("action",i)}),(()=>{switch(n){case"appointment":return a.jsx(uu,{title:"Appointment",description:"The subject must schedule an appointment from the schedule.",resourceType:"Schedule",action:t,onChange:e.onChange});case"lab":return a.jsx(uu,{title:"Lab",description:"The subject must complete the following lab panel.",resourceType:"ActivityDefinition",action:t,onChange:e.onChange});case"questionnaire":return a.jsx(uu,{title:"Questionnaire",description:"The subject must complete the selected questionnaire.",resourceType:"Questionnaire",action:t,onChange:e.onChange});case"task":return a.jsx(uu,{title:"Task",description:"The subject must complete the following task.",resourceType:"ActivityDefinition",action:t,onChange:e.onChange});default:return null}})(),a.jsx(it,{title:"Timing",description:"When the action should take place.",children:a.jsx(YF,{name:"timing-"+t.id,action:t,onChange:e.onChange})})]})}function uu(e){const{id:t,definitionCanonical:n}=e.action,r=n!=null&&n.startsWith(e.resourceType+"/")?{reference:n}:void 0;return a.jsx(Ma,{name:t,resourceType:e.resourceType,defaultValue:r,loadOnFocus:!0,onChange:o=>{o?e.onChange({...e.action,definitionCanonical:ht(o)}):e.onChange({...e.action,definitionCanonical:void 0})}})}function YF(e){const t=e.action,n="timing",[r,o]=rP(t);return a.jsx(La,{property:mm,name:"timing[x]",defaultValue:r,defaultPropertyType:o,onChange:(i,s)=>{e.onChange(fm(t,n,s??n,mm,i))},outcome:void 0})}function XF(e){var t,n,r;if((t=e.definitionCanonical)!=null&&t.startsWith("Schedule"))return"appointment";if((n=e.definitionCanonical)!=null&&n.startsWith("Questionnaire/"))return"questionnaire";if((r=e.definitionCanonical)!=null&&r.startsWith("ActivityDefinition/"))return"task"}function rP(e){return Lf({type:"PlanDefinitionAction",value:e},"timing")}let Gh=1;function oP(e){if(e){if(e.startsWith("id-")){const t=parseInt(e.substring(3),10);isNaN(t)||(Gh=Math.max(Gh,t+1))}return e}return"id-"+Gh++}function JF(e){return{...e,action:iP(e.action)}}function iP(e){if(e)return e.map(t=>({...t,id:oP(t.id),action:iP(t.action)}))}var ft=(e=>(e.group="group",e.display="display",e.question="question",e.boolean="boolean",e.decimal="decimal",e.integer="integer",e.date="date",e.dateTime="dateTime",e.time="time",e.string="string",e.text="text",e.url="url",e.choice="choice",e.openChoice="open-choice",e.attachment="attachment",e.reference="reference",e.quantity="quantity",e))(ft||{});function ZF(e){return e.type==="choice"||e.type==="open-choice"}function ez(e,t){if(!e.enableWhen)return!0;const n=e.enableBehavior??"any";for(const r of e.enableWhen){const o=sP(t,r.question);if(r.operator==="exists"&&!r.answerBoolean&&!(o!=null&&o.length)){if(n==="any")return!0;continue}const{anyMatch:i,allMatch:s}=rz(r,o,n);if(n==="any"&&i)return!0;if(n==="all"&&!s)return!1}return n!=="any"}function tz(e,t,n){return e.map(r=>{var s;const o=(s=n.answerOption)==null?void 0:s.find(l=>ms(l.valueCoding)===r||l[t]===r),i=gn({type:"QuestionnaireItemAnswerOption",value:o},"value");return{[t]:i==null?void 0:i.value}})}function sP(e,t){if(e)for(const n of e){if(n.linkId===t)return n.answer;if(n.item){const r=sP(n.item,t);if(r)return r}}}function nz(e,t,n){if(n==="exists")return!!e===t.value;if(e){const r=n==="="||n==="!="?n==null?void 0:n.replace("=","~"):n,[{value:o}]=Gl(`%actualAnswer ${r} %expectedAnswer`,[e],{"%actualAnswer":e,"%expectedAnswer":t});return o}else return!1}function rz(e,t,n){const r=t||[],o=gn({type:"QuestionnaireItemEnableWhen",value:e},"answer[x]");let i=!1,s=!0;for(const l of r){const c=gn({type:"QuestionnaireResponseItemAnswer",value:l},"value[x]"),{operator:u}=e;if(nz(c,o,u)?i=!0:s=!1,n==="any"&&i)break}return{anyMatch:i,allMatch:s}}function aP(e){var n,r;const t=xc(e,"http://hl7.org/fhir/StructureDefinition/questionnaire-referenceResource");if(t){if(t.valueCode!==void 0)return[t.valueCode];if(t.valueCodeableConcept)return(r=(n=t.valueCodeableConcept)==null?void 0:n.coding)==null?void 0:r.map(o=>o.code)}}function Qh(e,t){var o;const n=Si(e);let r=xc(n,"http://hl7.org/fhir/StructureDefinition/questionnaire-referenceResource");return!t||t.length===0?(r&&(n.extension=(o=n.extension)==null?void 0:o.filter(i=>i!==r)),n):(r||(n.extension||(n.extension=[]),r={url:"http://hl7.org/fhir/StructureDefinition/questionnaire-referenceResource"},n.extension.push(r)),t.length===1?(r.valueCode=t[0],delete r.valueCodeableConcept):(r.valueCodeableConcept={coding:t.map(i=>({code:i}))},delete r.valueCode),n)}function oz(e,t,n){const r=xc(e,"http://hl7.org/fhir/StructureDefinition/questionnaire-referenceFilter");if(!(r!=null&&r.valueString))return;let o=r.valueString;t!=null&&t.reference&&(o=o.replaceAll("$subj",t.reference)),n!=null&&n.reference&&(o=o.replaceAll("$encounter",n.reference));const i={},s=o.split("&");for(const l of s){const[c,u]=uO(l,"=",2);i[c]=u}return i}function iz(e){return{resourceType:"QuestionnaireResponse",questionnaire:ht(e),item:lP(e.item),status:"in-progress"}}function lP(e){return(e==null?void 0:e.map(cP))??[]}function cP(e){var t;return{id:az(),linkId:e.linkId,text:e.text,item:lP(e.item),answer:((t=e.initial)==null?void 0:t.map(lz))??[]}}let sz=1;function az(){return"id-"+sz++}function lz(e){return{...e}}function cz(e){return e.value.display||e.value.reference||On(e.value)}function uz(e){var n,r,o,i;const t=(n=e==null?void 0:e.item)==null?void 0:n[0];if(t){const s=xc(t,"http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl");if(((i=(o=(r=s==null?void 0:s.valueCodeableConcept)==null?void 0:r.coding)==null?void 0:o[0])==null?void 0:i.code)==="page")return e.item.length}return 1}const uP=p.createContext({});function gm(e){const t=p.useContext(uP),n=e.item,r=e.response;function o(u){var f,h,m,g;let d;Array.isArray(u)?d=u:e.index>=(((h=(f=e.response)==null?void 0:f.answer)==null?void 0:h.length)??0)?d=(((m=e.response)==null?void 0:m.answer)??[]).concat([u]):d=(((g=e.response)==null?void 0:g.answer)??[]).map((C,v)=>v===e.index?u:C)??[],e.onChange({id:r==null?void 0:r.id,linkId:r==null?void 0:r.linkId,text:n.text,answer:d})}const i=n.type;if(!i)return null;const s=n.linkId;if(!s)return null;const l=n.initial&&n.initial.length>0?n.initial[0]:void 0,c=qv(r,e.index)??gn({type:"QuestionnaireItemInitial",value:l},"value");switch(i){case ft.display:return a.jsx("p",{children:e.item.text},e.item.linkId);case ft.boolean:return a.jsx(ET,{title:e.item.text,htmlFor:e.item.linkId,children:a.jsx(ur,{id:e.item.linkId,name:e.item.linkId,defaultChecked:c==null?void 0:c.value,onChange:u=>o({valueBoolean:u.currentTarget.checked})})},e.item.linkId);case ft.decimal:return a.jsx(ie,{type:"number",step:"any",id:s,name:s,required:n.required,defaultValue:c==null?void 0:c.value,onChange:u=>o({valueDecimal:u.currentTarget.valueAsNumber})});case ft.integer:return a.jsx(ie,{type:"number",step:1,id:s,name:s,required:n.required,defaultValue:c==null?void 0:c.value,onChange:u=>o({valueInteger:u.currentTarget.valueAsNumber})});case ft.date:return a.jsx(ie,{type:"date",id:s,name:s,required:n.required,defaultValue:c==null?void 0:c.value,onChange:u=>o({valueDate:u.currentTarget.value})});case ft.dateTime:return a.jsx(Ji,{name:s,required:n.required,defaultValue:c==null?void 0:c.value,onChange:u=>o({valueDateTime:u})});case ft.time:return a.jsx(ie,{type:"time",id:s,name:s,required:n.required,defaultValue:c==null?void 0:c.value,onChange:u=>o({valueTime:u.currentTarget.value})});case ft.string:case ft.url:return a.jsx(ie,{id:s,name:s,required:n.required,defaultValue:c==null?void 0:c.value,onChange:u=>o({valueString:u.currentTarget.value})});case ft.text:return a.jsx(ds,{id:s,name:s,required:n.required,defaultValue:c==null?void 0:c.value,onChange:u=>o({valueString:u.currentTarget.value})});case ft.attachment:return a.jsx(Y,{py:4,children:a.jsx(ST,{name:s,defaultValue:c==null?void 0:c.value,onChange:u=>o({valueAttachment:u})})});case ft.reference:return a.jsx(Ff,{name:s,required:n.required,targetTypes:aP(n),searchCriteria:oz(n,t.subject,t.encounter),defaultValue:c==null?void 0:c.value,onChange:u=>o({valueReference:u})});case ft.quantity:return a.jsx(Zi,{name:s,required:n.required,defaultValue:c==null?void 0:c.value,onChange:u=>o({valueQuantity:u}),disableWheel:!0});case ft.choice:case ft.openChoice:return gz(n)&&!n.answerValueSet?a.jsx(dz,{name:s,item:n,initial:l,response:r,onChangeAnswer:u=>o(u)}):a.jsx(fz,{name:s,item:n,initial:l,response:r,onChangeAnswer:u=>o(u)});default:return null}}function dz(e){var c;const{name:t,item:n,initial:r,response:o}=e;if(!((c=n.answerOption)!=null&&c.length))return a.jsx(dP,{});const i=gn({type:"QuestionnaireItemInitial",value:r},"value"),s=[""];for(const u of n.answerOption){const d=gn({type:"QuestionnaireItemAnswerOption",value:u},"value");s.push(tw(d))}const l=qv(o)??i;if(n.repeats){const{propertyName:u,data:d}=yz(e.item),f=pz(o);return a.jsx(xf,{data:d,placeholder:"Select items",searchable:!0,defaultValue:f||[tw(i)],onChange:h=>{const m=tz(h,u,n);e.onChangeAnswer(m)}})}return a.jsx(mt,{id:t,name:t,onChange:u=>{const d=u.currentTarget.selectedIndex;if(d===0){e.onChangeAnswer({});return}const f=n.answerOption[d-1],h=gn({type:"QuestionnaireItemAnswerOption",value:f},"value"),m="value"+en(h.type);e.onChangeAnswer({[m]:h.value})},defaultValue:ms(l==null?void 0:l.value)||(l==null?void 0:l.value),data:s})}function fz(e){var s;const{name:t,item:n,initial:r,onChangeAnswer:o,response:i}=e;return!((s=n.answerOption)!=null&&s.length)&&!n.answerValueSet?a.jsx(dP,{}):n.answerValueSet?a.jsx(PT,{name:t,binding:n.answerValueSet,onChange:l=>o({valueCoding:l})}):a.jsx(hz,{name:(i==null?void 0:i.id)??t,item:n,initial:r,response:i,onChangeAnswer:o})}function hz(e){const{name:t,item:n,initial:r,onChangeAnswer:o,response:i}=e,s=gs("QuestionnaireItemAnswerOption","value[x]"),l=gn({type:"QuestionnaireItemInitial",value:r},"value"),c=[];let u;if(n.answerOption)for(let h=0;h<n.answerOption.length;h++){const m=n.answerOption[h],g=`${t}-option-${h}`,y=gn({type:"QuestionnaireItemAnswerOption",value:m},"value");y!=null&&y.value&&(l&&On(y)===On(l)&&(u=g),c.push([g,y]))}const d=qv(i),f=mz(c,d);return a.jsx(Hl.Group,{name:t,value:f??u,onChange:h=>{const m=c.find(g=>g[0]===h);if(m){const g=m[1],y="value"+en(g.type);o({[y]:g.value})}},children:c.map(([h,m])=>a.jsx(Hl,{id:h,value:h,py:4,label:a.jsx(So,{property:s,propertyType:m.type,value:m.value})},h))})}function dP(){return a.jsx(ie,{disabled:!0,placeholder:"No Answers Defined"})}function fP(e){return gn({type:"QuestionnaireItemAnswer",value:e},"value")}function qv(e,t=0){const n=e.answer;return fP((n==null?void 0:n[t])??{})}function pz(e){const t=e.answer;return t?t.map(r=>fP(r)).map(r=>ms(r==null?void 0:r.value)||(r==null?void 0:r.value)):[]}function mz(e,t){var n;return(n=e.find(r=>wc(r[1].value,t==null?void 0:t.value)))==null?void 0:n[0]}function tw(e){if(e)return e.type==="CodeableConcept"?va(e.value):e.type==="Coding"?ms(e.value):e.type==="Reference"?cz(e):e.value.toString()}function gz(e){var t;return!!((t=e.extension)!=null&&t.some(n=>{var r,o,i;return n.url==="http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl"&&((i=(o=(r=n.valueCodeableConcept)==null?void 0:r.coding)==null?void 0:o[0])==null?void 0:i.code)==="drop-down"}))}function yz(e){var i;if(((i=e.answerOption)==null?void 0:i.length)===0)return{propertyName:"",data:[]};const t=e.answerOption[0],n=gn({type:"QuestionnaireItemAnswerOption",value:t},"value"),r="value"+en(n.type),o=(e.answerOption??[]).map(s=>({value:nw(s,r),label:nw(s,r)}));return{propertyName:r,data:o}}function nw(e,t){var n;return ms(e.valueCoding)||((n=e[t])==null?void 0:n.toString())}const vz="_section_cpwxo_1",xz="_hovering_cpwxo_10",wz="_editing_cpwxo_14",Sz="_questionBody_cpwxo_19",bz="_topActions_cpwxo_23",Cz="_bottomActions_cpwxo_32",jz="_movementActions_cpwxo_43",Ez="_movementIcons_cpwxo_55",Tz="_columnAlignment_cpwxo_59",Pz="_linkIdInput_cpwxo_64",kz="_typeSelect_cpwxo_69",er={section:vz,hovering:xz,editing:wz,questionBody:Sz,topActions:bz,bottomActions:Cz,movementActions:jz,movementIcons:Ez,columnAlignment:Tz,linkIdInput:Pz,typeSelect:kz};function Rz(e){const t=te(),n=st(e.questionnaire),[r,o]=p.useState(!1),[i,s]=p.useState(),[l,c]=p.useState(),[u,d]=p.useState();function f(){d(void 0)}function h(){c(void 0)}p.useEffect(()=>{t.requestSchema("Questionnaire").then(()=>o(!0)).catch(console.log)},[t]),p.useEffect(()=>(s(Az(n??{resourceType:"Questionnaire",status:"active"})),document.addEventListener("mouseover",f),document.addEventListener("click",h),()=>{document.removeEventListener("mouseover",f),document.removeEventListener("click",h)}),[n]);const m=(g,y)=>{s(g),e.autoSave&&!y&&e.onSubmit&&e.onSubmit(g)};return!r||!i?null:a.jsx("div",{children:a.jsxs(Be,{testid:"questionnaire-form",onSubmit:()=>e.onSubmit(i),children:[a.jsx(hP,{item:i,selectedKey:l,setSelectedKey:c,hoverKey:u,setHoverKey:d,onChange:m}),a.jsx(Z,{type:"submit",children:"Save"})]})})}function hP(e){var w;const t=e.item,n=e.item,r=Io(e.item),o=r||n.type===ft.group,i=n.linkId??"[untitled]",s=e.selectedKey===e.item.id,l=e.hoverKey===e.item.id,c=p.useRef();c.current=e.item;function u(S){et(S),e.setSelectedKey(e.item.id)}function d(S){et(S),e.setHoverKey(e.item.id)}function f(S){var j;const E=c.current;e.onChange({...E,item:(j=E.item)==null?void 0:j.map(T=>T.id===S.id?S:T)})}function h(S,E){e.onChange({...e.item,item:[...e.item.item??[],S]},E)}function m(S){var E;e.onChange({...e.item,item:(E=e.item.item)==null?void 0:E.filter(j=>j!==S)})}function g(S,E){e.onChange({...c.current,[S]:E})}function y(S){e.onChange({...e.item,...S})}function C(S){var E;e.onChange({...e.item,item:(E=e.item.item)==null?void 0:E.map(j=>j===S?{...j,repeats:!j.repeats}:j)})}function v(S,E){const j=Mz(e.item.item,S,E);e.onChange({...e.item,item:j})}const x=Ye(er.section,{[er.editing]:s,[er.hovering]:l&&!s});return a.jsxs("div",{"data-testid":n.linkId,className:x,onClick:u,onMouseOver:d,onFocus:d,children:[a.jsx("div",{className:er.questionBody,children:s?a.jsxs(a.Fragment,{children:[r&&a.jsx(ie,{size:"xl",defaultValue:t.title,onBlur:S=>g("title",S.currentTarget.value)}),!r&&a.jsx(ds,{autosize:!0,minRows:2,defaultValue:n.text,onBlur:S=>g("text",S.currentTarget.value)}),n.type==="reference"&&a.jsx(_z,{item:n,onChange:y}),ZF(n)&&a.jsx(Dz,{item:n,onChange:S=>y(S)})]}):a.jsxs(a.Fragment,{children:[t.title&&a.jsx(ae,{children:t.title}),n.text&&a.jsx("div",{children:n.text}),!o&&a.jsx(gm,{item:n,index:0,onChange:()=>{},response:{linkId:n.linkId}})]})}),(w=n.item)==null?void 0:w.map((S,E)=>a.jsx("div",{children:a.jsx(hP,{item:S,selectedKey:e.selectedKey,setSelectedKey:e.setSelectedKey,hoverKey:e.hoverKey,isFirst:E===0,isLast:E===(e.item.item??[]).length-1,setHoverKey:e.setHoverKey,onChange:f,onRemove:()=>m(S),onRepeatable:C,onMoveUp:()=>v(E,-1),onMoveDown:()=>v(E,1)})},S.id)),!o&&a.jsx("div",{className:er.topActions,children:s?a.jsxs(a.Fragment,{children:[a.jsx(ie,{size:"xs",className:er.linkIdInput,defaultValue:n.linkId,onBlur:S=>g("linkId",S.currentTarget.value)}),!o&&a.jsx(mt,{size:"xs",className:er.typeSelect,defaultValue:n.type,onChange:S=>g("type",S.currentTarget.value),data:[{value:"display",label:"Display"},{value:"boolean",label:"Boolean"},{value:"decimal",label:"Decimal"},{value:"integer",label:"Integer"},{value:"date",label:"Date"},{value:"dateTime",label:"Date/Time"},{value:"time",label:"Time"},{value:"string",label:"String"},{value:"text",label:"Text"},{value:"url",label:"URL"},{value:"choice",label:"Choice"},{value:"open-choice",label:"Open Choice"},{value:"attachment",label:"Attachment"},{value:"reference",label:"Reference"},{value:"quantity",label:"Quantity"}]})]}):a.jsx("div",{children:i})}),!r&&a.jsx(W,{className:er.movementActions,children:a.jsxs(W,{className:er.columnAlignment,children:[!e.isFirst&&a.jsx(Ue,{href:"#",onClick:S=>{S.preventDefault(),e.onMoveUp&&e.onMoveUp()},children:a.jsx(y$,{"data-testid":"up-button",size:15,className:er.movementIcons})}),!e.isLast&&a.jsx(Ue,{href:"#",onClick:S=>{S.preventDefault(),e.onMoveDown&&e.onMoveDown()},children:a.jsx(g$,{"data-testid":"down-button",size:15,className:er.movementIcons})})]})}),a.jsxs("div",{className:er.bottomActions,children:[o&&a.jsxs(a.Fragment,{children:[a.jsx(Ue,{href:"#",onClick:S=>{S.preventDefault(),h({id:ts(),linkId:xm("q"),type:"string",text:"Question"})},children:"Add item"}),a.jsx(Ue,{href:"#",onClick:S=>{S.preventDefault(),h({id:ts(),linkId:xm("g"),type:"group",text:"Group"},!0)},children:"Add group"})]}),r&&a.jsx(Ue,{href:"#",onClick:S=>{S.preventDefault(),h(Oz(),!0)},children:"Add Page"}),s&&!r&&a.jsxs(a.Fragment,{children:[a.jsx(Ue,{href:"#",onClick:S=>{S.preventDefault(),e.onRepeatable&&e.onRepeatable(n)},children:n.repeats?"Remove Repeatable":"Make Repeatable"}),a.jsx(Ue,{href:"#",onClick:S=>{S.preventDefault(),e.onRemove&&e.onRemove()},children:"Remove"})]})]})]})}function Dz(e){const t=gs("QuestionnaireItemAnswerOption","value[x]"),n=e.item.answerOption??[];return a.jsxs("div",{children:[e.item.answerValueSet!==void 0?a.jsx(ie,{placeholder:"Enter Value Set",defaultValue:e.item.answerValueSet,onChange:r=>e.onChange({...e.item,answerValueSet:r.target.value})}):a.jsx(Iz,{options:n,property:t,item:e.item,onChange:e.onChange}),a.jsxs(W,{display:"flex",children:[a.jsx(Ue,{href:"#",onClick:r=>{et(r),e.onChange({...e.item,answerValueSet:void 0,answerOption:[...n,{id:ts()}]})},children:"Add choice"}),a.jsx(Tf,{w:"lg"}),a.jsx(Ue,{href:"#",onClick:r=>{et(r),e.onChange({...e.item,answerOption:[],answerValueSet:""})},children:"Add value set"})]})]})}function Iz(e){return a.jsx("div",{children:e.options.map(t=>{const[n,r]=Lf({type:"QuestionnaireItemAnswerOption",value:t},"value");return a.jsxs("div",{style:{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center",width:"80%"},children:[a.jsx("div",{children:a.jsx(La,{name:"value[x]",property:e.property,defaultPropertyType:r,defaultValue:n,onChange:(o,i)=>{const s=[...e.options],l=s.findIndex(c=>c.id===t.id);s[l]={id:t.id,[i]:o},e.onChange({...e.item,answerOption:s})},outcome:void 0},t.id)}),a.jsx("div",{children:a.jsx(Ue,{href:"#",onClick:o=>{et(o),e.onChange({...e.item,answerOption:e.options.filter(i=>i.id!==t.id)})},children:"Remove"})})]},t.id)})})}function _z(e){const t=aP(e.item)??[];return a.jsxs(a.Fragment,{children:[t.map((n,r)=>a.jsxs(Y,{children:[a.jsx(Tv,{name:"resourceType",placeholder:"Resource Type",defaultValue:n,onChange:o=>{e.onChange(Qh(e.item,t.map(i=>i===n?o:i)))}}),a.jsx(Ue,{href:"#",onClick:o=>{et(o),e.onChange(Qh(e.item,t.filter(i=>i!==n)))},children:"Remove"})]},`${n}-${r}`)),a.jsx(Ue,{href:"#",onClick:n=>{et(n),e.onChange(Qh(e.item,[...t,""]))},children:"Add Resource Type"})]})}let ym=1,vm=1;function xm(e){return e+ym++}function ts(){return"id-"+vm++}function Az(e){return{...e,id:e.id||ts(),item:pP(e.item)}}function pP(e){if(e)return e.forEach(t=>{var n,r;(n=t.id)!=null&&n.match(/^id-\d+$/)&&(vm=Math.max(vm,parseInt(t.id.substring(3),10)+1)),(r=t.linkId)!=null&&r.match(/^q\d+$/)&&(ym=Math.max(ym,parseInt(t.linkId.substring(1),10)+1))}),e.map(t=>({...t,id:t.id||ts(),item:pP(t.item),answerOption:Nz(t.answerOption)}))}function Nz(e){if(e)return e.map(t=>({...t,id:t.id||ts()}))}function Oz(){return{id:ts(),linkId:xm("s"),type:"group",text:"New Page",extension:[{url:"http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl",valueCodeableConcept:{coding:[{system:"http://hl7.org/fhir/questionnaire-item-control",code:"page"}]}}]}}function Mz(e,t,n){const r=e??[],o=t+n;if(o<0||o>=r.length)return r;const i=[...r];return[i[t],i[o]]=[i[o],i[t]],i}function mP(e){const{item:t,response:n,onChange:r}=e,[o,i]=p.useState(Lz(t,n??{linkId:t.linkId}));if(!e.checkForQuestionEnabled(t)||!n)return null;if(t.type===ft.display)return a.jsx("p",{children:t.text},t.linkId);const s=(t==null?void 0:t.repeats)&&t.type!==ft.choice&&t.type!==ft.openChoice;return t.type===ft.boolean?a.jsx(gm,{item:t,response:n,onChange:l=>r([l]),index:0},t.linkId):a.jsxs(it,{htmlFor:e.item.linkId,title:e.item.text,withAsterisk:e.item.required,children:[[...Array(o)].map((l,c)=>a.jsx(gm,{item:t,response:n,onChange:u=>r([u]),index:c},`${t.linkId}-${c}`)),s&&a.jsx(Ue,{onClick:()=>i(l=>l+1),children:"Add Item"})]},e.item.linkId)}function Lz(e,t){if(e.type===ft.choice||e.type===ft.openChoice)return 1;const n=t.answer;return n!=null&&n.length?n.length:1}function gP(e){const[t,n]=p.useState(e.response);if(t.length===0)return null;function r(i,s){const l=t.map((c,u)=>u===s?i[0]:c);n(l),e.onChange(l)}function o(){const i=cP(e.item);n([...t,i])}return a.jsxs(a.Fragment,{children:[t.map((i,s)=>a.jsx(yP,{item:e.item,response:i,checkForQuestionEnabled:e.checkForQuestionEnabled,onChange:l=>r(l,s)},i.id)),e.item.repeats&&a.jsx(Ue,{onClick:o,children:`Add Group: ${e.item.text}`})]})}function yP(e){var i;const{response:t,checkForQuestionEnabled:n,onChange:r}=e;function o(s){var d;const l=(d=t.item)==null?void 0:d.map(f=>s.find(m=>m.id===f.id)??f),c=l==null?void 0:l.concat(s.slice(1)),u={...t,item:c};r([u])}return e.checkForQuestionEnabled(e.item)?a.jsxs("div",{children:[e.item.text&&a.jsx(ae,{order:3,mb:"md",children:e.item.text}),a.jsx(Se,{children:(i=e.item.item)==null?void 0:i.map(s=>{var l,c,u;return s.type===ft.group?s.repeats?a.jsx(gP,{item:s,response:((l=t.item)==null?void 0:l.filter(d=>d.linkId===s.linkId))??[],checkForQuestionEnabled:n,onChange:o},s.linkId):a.jsx(yP,{item:s,checkForQuestionEnabled:n,response:((c=t.item)==null?void 0:c.find(d=>d.linkId===s.linkId))??{linkId:s.linkId},onChange:o},s.linkId):a.jsx(mP,{item:s,response:(u=t.item)==null?void 0:u.find(d=>d.linkId===s.linkId),onChange:o,checkForQuestionEnabled:n},s.linkId)})})]},e.item.linkId):null}function $z(e){const{items:t,response:n,activePage:r,onChange:o,nextStep:i,prevStep:s,numberOfPages:l,renderPages:c,submitButtonText:u,checkForQuestionEnabled:d}=e,f=t.map(h=>{var y;const m=((y=n==null?void 0:n.item)==null?void 0:y.filter(C=>C.linkId===h.linkId))??[],g=h.type===ft.group?a.jsx(gP,{item:h,response:m,onChange:o,checkForQuestionEnabled:d},h.linkId):a.jsx(mP,{item:h,response:m==null?void 0:m[0],onChange:o,checkForQuestionEnabled:d},h.linkId);return c?a.jsx(ya.Step,{label:h.text,children:g},h.linkId):g});return a.jsxs(a.Fragment,{children:[c&&a.jsx(ya,{active:r??0,allowNextStepsSelect:!1,p:6,children:f}),!c&&a.jsx(Se,{children:f}),a.jsx(Fz,{activePage:r??0,numberOfPages:l,nextStep:i,prevStep:s,submitButtonText:u})]})}function Fz(e){const t=e.activePage>0,n=e.activePage<e.numberOfPages-1,r=e.activePage===e.numberOfPages-1;return a.jsxs(Y,{justify:"flex-end",mt:"xl",gap:"xs",children:[t&&a.jsx(Z,{onClick:e.prevStep,children:"Back"}),n&&a.jsx(Z,{onClick:o=>{o.currentTarget.closest("form").reportValidity()&&e.nextStep()},children:"Next"}),r&&a.jsx(Z,{type:"submit",children:e.submitButtonText??"Submit"})]})}function vP(e){const t=te(),n=t.getProfile(),[r,o]=p.useState(!1),i=st(e.questionnaire),[s,l]=p.useState(),[c,u]=p.useState(0);p.useEffect(()=>{t.requestSchema("Questionnaire").then(()=>t.requestSchema("QuestionnaireResponse")).then(()=>o(!0)).catch(console.log)},[t]),p.useEffect(()=>{l(i?iz(i):void 0)},[i]);function d(y){const C=(s==null?void 0:s.item)??[],x={resourceType:"QuestionnaireResponse",status:"in-progress",item:xP(C,Array.isArray(y)?y:[y])};l(x)}function f(y){return ez(y,(s==null?void 0:s.item)??[])}if(!r||!i)return null;const h=uz(i),m=()=>u(y=>y+1),g=()=>u(y=>y-1);return a.jsx(uP.Provider,{value:{subject:e.subject,encounter:e.encounter},children:a.jsxs(Be,{testid:"questionnaire-form",onSubmit:()=>{e.onSubmit&&s&&e.onSubmit({...s,questionnaire:ht(i),subject:e.subject,source:xt(n),authored:new Date().toISOString(),status:"completed"})},children:[i.title&&a.jsx(ae,{children:i.title}),a.jsx($z,{items:i.item??[],response:s,onChange:d,renderPages:h>1,activePage:c,numberOfPages:h,submitButtonText:e.submitButtonText,checkForQuestionEnabled:f,nextStep:m,prevStep:g})]})})}function zz(e,t){const n=xP(e.item??[],t.item??[]);return{...t,item:n.length>0?n:void 0,answer:t.answer&&t.answer.length>0?t.answer:e.answer}}function xP(e,t){const n=[],r=new Set;for(const o of e){const i=o.id,s=t.find(l=>l.id===i);s?(n.push(zz(o,s)),r.add(s.id)):n.push(o)}for(const o of t)r.has(o.id)||n.push(o);return n}const Bz="_section_4m5it_1",Uz={section:Bz},Vz=["gender","age","gestationalAge","context","appliesTo","category"],Hz={definition:{resourceType:"ObservationDefinition",code:{text:""}},onSubmit:()=>{}};function Wz(e){e=Object.assign(Hz,e);const t=e.definition,[n,r]=p.useState([]),[o,i]=p.useState(1),[s,l]=p.useState(1);return p.useEffect(()=>{const g=Qz(t,l);r(Kz(g.qualifiedInterval||[],i))},[t]),a.jsxs(Be,{testid:"reference-range-editor",onSubmit:c,children:[a.jsx(Se,{children:n.map(g=>{var y;return a.jsx(qz,{unit:Xz((y=t.quantitativeDetails)==null?void 0:y.unit),onChange:f,onAdd:h,onRemove:m,onRemoveGroup:d,intervalGroup:g},`group-${g.id}`)})}),a.jsx(Ht,{title:"Add Group",variant:"subtle",size:"sm",onClick:g=>{et(g),u({id:`group-id-${o}`,filters:{},intervals:[]}),i(y=>y+1)},children:a.jsx(vd,{})}),a.jsx(Y,{justify:"flex-end",children:a.jsx(Z,{type:"submit",children:"Save"})})]});function c(){const g=n.flatMap(y=>y.intervals).filter(y=>!Jz(y));e.onSubmit({...t,qualifiedInterval:g})}function u(g){r(y=>[...y,g])}function d(g){r(y=>y.filter(C=>C.id!==g.id))}function f(g,y){r(C=>{C=[...C];const v=C.find(w=>w.id===g),x=v==null?void 0:v.intervals.findIndex(w=>w.id===y.id);return x!==void 0&&(v!=null&&v.intervals[x])&&(v.intervals[x]=y),C})}function h(g,y){y.id===void 0&&(y.id=`id-${s}`,l(C=>C+1)),r(C=>{C=[...C];const v=C.findIndex(x=>x.id===g);if(v!==-1){const x={...C[v]};y={...y,...x.filters},x.intervals=[...x.intervals,y],C[v]=x}return C})}function m(g,y){r(C=>{C=[...C];const v=C.find(x=>x.id===g);return v&&(v.intervals=v.intervals.filter(x=>x.id!==y.id)),C})}}function qz(e){const{intervalGroup:t,unit:n}=e;return a.jsx(Ec,{"data-testid":t.id,className:Uz.section,children:a.jsxs(Se,{gap:"lg",children:[a.jsx(Y,{justify:"flex-end",children:a.jsx(Ht,{title:"Remove Group",variant:"subtle","data-testid":`remove-group-button-${t.id}`,size:"sm",onClick:r=>{et(r),e.onRemoveGroup(t)},children:a.jsx(yd,{})},`remove-group-button-${t.id}`)}),a.jsx(Gz,{intervalGroup:t,onChange:e.onChange}),a.jsx(Tn,{}),t.intervals.map(r=>a.jsxs(Se,{gap:"xs",children:[a.jsxs(Y,{children:[a.jsx(ie,{"data-testid":`condition-${r.id}`,defaultValue:r.condition,label:"Condition: ",size:"sm",onChange:o=>{et(o),e.onChange(t.id,{...r,condition:o.currentTarget.value.trim()})}},`condition-${r.id}`),a.jsx(Ht,{title:"Remove Interval",variant:"subtle",size:"sm","data-testid":`remove-interval-${r.id}`,onClick:o=>{et(o),e.onRemove(t.id,r)},children:a.jsx(yd,{})},`remove-interval-${r.id}`)]}),a.jsx(Dv,{onChange:o=>{e.onChange(t.id,{...r,range:o})},name:`range-${r.id}`,defaultValue:r.range},`range-${r.id}`)]},`interval-${r.id}`)),a.jsx(Ht,{title:"Add Interval",variant:"subtle",size:"sm",onClick:r=>{et(r),e.onAdd(t.id,{range:{low:{unit:n},high:{unit:n}}})},children:a.jsx(vd,{})})]})})}function Gz(e){var r,o;const{intervalGroup:t,onChange:n}=e;t.filters.age||(t.filters.age={});for(const i of["low","high"])(r=t.filters.age[i])!=null&&r.unit||(t.filters.age[i]={...t.filters.age[i],unit:"years",system:"http://unitsofmeasure.org"});return a.jsxs(Se,{style:{maxWidth:"50%"},children:[a.jsx(Y,{children:a.jsx(mt,{data:["","male","female"],label:"Gender:",defaultValue:t.filters.gender||"",onChange:i=>{for(const s of t.intervals){let l=i.currentTarget.value;l===""&&(l=void 0),n(t.id,{...s,gender:l})}}})}),a.jsxs(Y,{gap:"xs",children:[a.jsx(le,{component:"label",htmlFor:`div-age-${t.id}`,children:"Age:"}),a.jsx("div",{id:`div-age-${t.id}`,children:a.jsx(Dv,{name:`age-${t.id}`,defaultValue:t.filters.age,onChange:i=>{for(const s of t.intervals)n(t.id,{...s,age:i})}},`age-${t.id}`)})]}),a.jsx(mt,{data:["","pre-puberty","follicular","midcycle","luteal","postmenopausal"],label:"Endocrine:",defaultValue:((o=t.filters.context)==null?void 0:o.text)||"",onChange:i=>{for(const s of t.intervals){let l=i.currentTarget.value;l===""?(l=void 0,n(t.id,{...s,context:void 0})):n(t.id,{...s,context:{text:l,coding:[{code:l,system:"http://terminology.hl7.org/CodeSystem/referencerange-meaning"}]}})}}}),a.jsx(mt,{data:["","reference","critical","absolute"],label:"Category: ",defaultValue:t.filters.category,onChange:i=>{for(const s of t.intervals){const l=i.currentTarget.value;l===""?n(t.id,{...s,category:void 0}):n(t.id,{...s,category:l})}}})]})}function Qz(e,t){const n=e.qualifiedInterval||[];let r=Math.max(...n.map(o=>{var s;const i=parseInt(((s=o.id)==null?void 0:s.substring(3))||"",10);return isNaN(i)?Number.NEGATIVE_INFINITY:i}))+1;return Number.isFinite(r)||(r=1),e={...e,qualifiedInterval:n.map(o=>({...o,id:o.id||`id-${r++}`}))},t(r),e}function Kz(e,t){let n=1;const r={};for(const o of e){const i=Yz(o);i in r||(r[i]={id:`group-id-${n++}`,filters:Object.fromEntries(Vz.map(s=>[s,o[s]])),intervals:[]}),r[i].intervals.push(o)}return t(n),Object.values(r)}function Yz(e){var n,r;return[`gender=${e.gender}`,`age=${Wl(e.age)}`,`gestationalAge=${Wl(e.gestationalAge)}`,`context=${(n=e.context)==null?void 0:n.text}`,`appliesTo=${(r=e.appliesTo)==null?void 0:r.map(o=>o.text).join("+")}`,`category=${e.category}`].join(":")}function Xz(e){return e&&(lO(e,"http://unitsofmeasure.org")||e.text)}function Jz(e){var t,n,r,o;return((n=(t=e.range)==null?void 0:t.low)==null?void 0:n.value)===void 0&&((o=(r=e.range)==null?void 0:r.high)==null?void 0:o.value)===void 0}function Zz(e){var u;const t=te(),n=st(e.value),[r,o]=p.useState(!1),[i,s]=p.useState();if(p.useEffect(()=>{n&&!r&&(t.executeBatch(l(n)).then(s).catch(console.log),o(!0))},[t,n,r]),!n||!i)return null;return a.jsx(Vn,{children:(u=n.action)==null?void 0:u.map((d,f)=>{var y,C,v,x,w,S;const h=d.resource&&c(d.resource),m=(C=(y=h==null?void 0:h.input)==null?void 0:y[0])==null?void 0:C.valueReference,g=(x=(v=h==null?void 0:h.output)==null?void 0:v[0])==null?void 0:x.valueReference;return a.jsxs(p.Fragment,{children:[a.jsx(Vn.Col,{span:1,p:"md",children:(h==null?void 0:h.status)==="completed"?a.jsx(T$,{}):a.jsx(Z$,{color:"gray"})}),a.jsxs(Vn.Col,{span:9,p:"xs",children:[a.jsx(le,{fw:500,children:d.title}),d.description&&a.jsx("div",{children:d.description}),a.jsxs("div",{children:["Last edited by ",a.jsx(Tc,{value:(w=h==null?void 0:h.meta)==null?void 0:w.author})," on ",Mn((S=h==null?void 0:h.meta)==null?void 0:S.lastUpdated)]}),a.jsxs("div",{children:["Status: ",a.jsx(OT,{status:(h==null?void 0:h.status)||"unknown"})]})]}),a.jsxs(Vn.Col,{span:2,p:"md",children:[m&&!g&&a.jsx(Z,{onClick:()=>e.onStart(h,m),children:"Start"}),m&&g&&a.jsx(Z,{onClick:()=>e.onEdit(h,m,g),children:"Edit"})]})]},`action-${f}`)})});function l(d){var h;const f=[];if(d.action)for(const m of d.action)(h=m.resource)!=null&&h.reference&&f.push({request:{method:"GET",url:m.resource.reference}});return{resourceType:"Bundle",type:"batch",entry:f}}function c(d){for(const f of i==null?void 0:i.entry)if(f.resource&&d.reference===ht(f.resource))return f.resource}}function wP(e,t){const n=eB(e,t);return tB(n,e,t)}function eB(e,t){const n=e.length,r=t.length,o=n+r+1,i=1+2*o,s=i/2|0,l=new Array(i);l[s+1]={i:0,j:-1,prev:void 0,snake:!0};for(let c=0;c<o;c++){for(let u=-c;u<=c;u+=2){const d=s+u,f=d+1,h=d-1,m=l[f],g=l[h];let y,C=0;u===-c||u!==c&&g.i<m.i?(C=m.i,y=m):(C=g.i+1,y=g),l[h]=void 0;let v=C-u,x={i:C,j:v,prev:nB(y),snake:!1};for(;C<n&&v<r&&e[C]===t[v];)C++,v++;if(C>x.i&&(x={i:C,j:v,prev:x,snake:!0}),l[d]=x,C>=n&&v>=r)return l[d]}l[s+c-1]=void 0}}function tB(e,t,n){const r=[];let o=e;for(o.snake&&(o=o.prev);o!=null&&o.prev&&o.prev.j>=0;){const i=o.i,s=o.j;o=o.prev;const l=o.i,c=o.j,u={position:l,lines:t.slice(l,i)},d={position:c,lines:n.slice(c,s)};let f;u.lines.length===0&&d.lines.length>0?f="insert":u.lines.length>0&&d.lines.length===0?f="delete":f="change",r.push({original:u,revised:d,type:f}),o.snake&&(o=o.prev)}return r}function nB(e){return e&&!e.snake&&e.prev?e.prev:e}function rB(e){const t=e.entry.filter(r=>!!r.resource).map(r=>{var o;return{meta:(o=r.resource)==null?void 0:o.meta,lines:On(r.resource,!0).match(/[^\r\n]+/g)}}).sort((r,o)=>r.meta.lastUpdated.localeCompare(o.meta.lastUpdated)),n=t[0].lines.map(r=>({id:t[0].meta.versionId,meta:t[0].meta,value:r,span:1}));return oB(n,t),iB(n),n}function oB(e,t){for(let n=1;n<t.length;n++){const r=wP(t[n-1].lines,t[n].lines);for(const o of r){const i=o.original.position,s=o.original.lines,l=o.revised.lines;if((o.type==="delete"||o.type==="change")&&e.splice(i,s.length),o.type==="insert"||o.type==="change")for(let c=0;c<o.revised.lines.length;c++)e.splice(i+c,0,{id:t[n].meta.versionId,meta:t[n].meta,value:l[c],span:1})}}}function iB(e){let t=0;for(;t<e.length;){let n=t;for(;n<e.length&&e[n].id===e[t].id;)e[n].span=-1,n++;e[t].span=n-t,t=n}}const sB="_container_n4i51_1",aB="_root_n4i51_5",lB="_startRow_n4i51_20",cB="_normalRow_n4i51_24",uB="_author_n4i51_28",dB="_dateTime_n4i51_32",fB="_lineNumber_n4i51_37",hB="_line_n4i51_37",pB="_pre_n4i51_52",ro={container:sB,root:aB,startRow:lB,normalRow:cB,author:uB,dateTime:dB,lineNumber:fB,line:hB,pre:pB};function mB(e,t){return`/${e.resourceType}/${e.id}/_history/${t}`}function gB(e){const t=Math.floor((Date.now()-Date.parse(e))/1e3),n=Math.floor(t/31536e3);if(n>0)return Ds(n,"year");const r=Math.floor(t/2592e3);if(r>0)return Ds(r,"month");const o=Math.floor(t/86400);if(o>0)return Ds(o,"day");const i=Math.floor(t/3600);if(i>0)return Ds(i,"hour");const s=Math.floor(t/60);return s>0?Ds(s,"minute"):Ds(t,"second")}function Ds(e,t){return`${e} ${e===1?t:t+"s"} ago`}function yB(e){var s,l;const t=te(),[n,r]=p.useState(e.history);if(p.useEffect(()=>{!e.history&&e.resourceType&&e.id&&t.readHistory(e.resourceType,e.id).then(r).catch(console.log)},[t,e.history,e.resourceType,e.id]),!n)return a.jsx("div",{children:"Loading..."});const o=(l=(s=n.entry)==null?void 0:s[0])==null?void 0:l.resource;if(!o)return null;const i=rB(n);return a.jsx("div",{className:ro.container,children:a.jsx("table",{className:ro.root,children:a.jsx("tbody",{children:i.map((c,u)=>a.jsxs("tr",{className:c.span>0?ro.startRow:ro.normalRow,children:[c.span>0&&a.jsxs(a.Fragment,{children:[a.jsx("td",{className:ro.author,rowSpan:c.span,children:a.jsx(na,{value:c.meta.author,link:!0})}),a.jsx("td",{className:ro.dateTime,rowSpan:c.span,children:a.jsx(Ae,{to:mB(o,c.meta.versionId),children:gB(c.meta.lastUpdated)})})]}),a.jsx("td",{className:ro.lineNumber,children:u+1}),a.jsx("td",{className:ro.line,children:a.jsx("pre",{className:ro.pre,children:c.value})})]},"row-"+u))})})})}const vB="_removed_mgz0k_2",xB="_added_mgz0k_7",rw={removed:vB,added:xB};function wB(e){let t=e.original,n=e.revised;e.ignoreMeta&&(t={...t,meta:void 0},n={...n,meta:void 0});const r=On(t,!0).match(/[^\r\n]+/g),o=On(n,!0).match(/[^\r\n]+/g),i=wP(r,o);return a.jsx("pre",{style:{color:"gray"},children:i.map((s,l)=>a.jsx(SB,{delta:s},"delta"+l))})}function SB(e){return a.jsxs(a.Fragment,{children:["...",a.jsx("br",{}),e.delta.original.lines.length>0&&a.jsx("div",{className:rw.removed,children:e.delta.original.lines.join(`
195
- `)}),e.delta.revised.lines.length>0&&a.jsx("div",{className:rw.added,children:e.delta.revised.lines.join(`
196
- `)}),"...",a.jsx("br",{})]})}function Gv(e){const{outcome:t}=e,n=te(),r=st(e.defaultValue),[o,i]=p.useState(),[s,l]=p.useState();return p.useEffect(()=>{if(r)if(l(Si(r)),e.profileUrl){const c=e.profileUrl;n.requestProfileSchema(e.profileUrl).then(()=>{const u=Df(c);u?i(u.name):console.log(`Schema not found for ${c}`)}).catch(console.log)}else{const c=e.schemaName??(r==null?void 0:r.resourceType);n.requestSchema(c).then(()=>i(c)).catch(console.log)}},[n,r,e.schemaName,e.profileUrl]),!o||!s?a.jsx("div",{children:"Loading..."}):a.jsxs("form",{noValidate:!0,autoComplete:"off",onSubmit:c=>{c.preventDefault(),e.onSubmit&&e.onSubmit(s)},children:[a.jsxs(Se,{mb:"xl",children:[a.jsx(it,{title:"Resource Type",htmlFor:"resourceType",outcome:t,children:a.jsx(ie,{name:"resourceType",defaultValue:s.resourceType,disabled:!0})}),a.jsx(it,{title:"ID",htmlFor:"id",outcome:t,children:a.jsx(ie,{name:"id",defaultValue:s.id,disabled:!0})})]}),a.jsx(_v,{typeName:o,defaultValue:s,outcome:t,onChange:l,profileUrl:e.profileUrl}),a.jsxs(Y,{justify:"flex-end",mt:"xl",children:[a.jsx(Z,{type:"submit",children:"OK"}),e.onDelete&&a.jsx(Z,{variant:"outline",color:"red",type:"button",onClick:()=>{e.onDelete(s)},children:"Delete"})]})]})}function bB(e){var o;const t=te(),[n,r]=p.useState(e.history);return p.useEffect(()=>{!e.history&&e.resourceType&&e.id&&t.readHistory(e.resourceType,e.id).then(r).catch(console.log)},[t,e.history,e.resourceType,e.id]),n?a.jsxs(he,{withTableBorder:!0,withRowBorders:!0,withColumnBorders:!0,children:[a.jsx(he.Thead,{children:a.jsxs(he.Tr,{children:[a.jsx(he.Th,{children:"Author"}),a.jsx(he.Th,{children:"Date"}),a.jsx(he.Th,{children:"Version"})]})}),a.jsx(he.Tbody,{children:(o=n.entry)==null?void 0:o.map((i,s)=>a.jsx(CB,{entry:i},"entry-"+s))})]}):a.jsx("div",{children:"Loading..."})}function CB(e){var r,o,i;const{response:t,resource:n}=e.entry;return n?a.jsxs(he.Tr,{children:[a.jsx(he.Td,{children:a.jsx(na,{value:(r=n.meta)==null?void 0:r.author,link:!0})}),a.jsx(he.Td,{children:Mn((o=n.meta)==null?void 0:o.lastUpdated)}),a.jsx(he.Td,{children:a.jsx(Ae,{to:jB(n),children:(i=n.meta)==null?void 0:i.versionId})})]}):a.jsx(he.Tr,{children:a.jsx(he.Td,{colSpan:3,children:Pe(t==null?void 0:t.outcome)})})}function jB(e){var t;return`/${e.resourceType}/${e.id}/_history/${(t=e.meta)==null?void 0:t.versionId}`}function EB(e){return a.jsx(Bf,{value:e.serviceRequest,loadTimelineResources:async(t,n,r)=>{const o=`${n}/${r}`,i=100;return Promise.allSettled([t.readHistory("ServiceRequest",r),t.search("Communication",{"based-on":o,_count:i}),t.search("DiagnosticReport",{"based-on":o,_count:i}),t.search("Media",{"based-on":o,_count:i}),t.search("DocumentReference",{related:o,_count:i}),t.search("Task",{_filter:`based-on eq ${o} or focus eq ${o} or subject eq ${o}`,_count:i})])},createCommunication:(t,n,r)=>({resourceType:"Communication",status:"completed",basedOn:[xt(t)],subject:t.subject,sender:xt(n),sent:new Date().toISOString(),payload:[{contentString:r}]}),createMedia:(t,n,r)=>({resourceType:"Media",status:"completed",basedOn:[xt(t)],subject:t.subject,operator:xt(n),issued:new Date().toISOString(),content:r})})}function TB(e){const t=te(),{client:n,patient:r,encounter:o,children:i,...s}=e;function l(){t.createResource({resourceType:"SmartAppLaunch",patient:r,encounter:o}).then(c=>{const u=new URL(n.launchUri);u.searchParams.set("iss",t.getBaseUrl()+"fhir/R4"),u.searchParams.set("launch",c.id),window.location.assign(u.toString())}).catch(c=>ce({color:"red",message:Pe(c),autoClose:!1}))}return a.jsx(Ue,{onClick:()=>l(),...s,children:i})}function SP(e){const t=te(),[n,r]=p.useState();return a.jsxs(Be,{style:{maxWidth:400},onSubmit:async o=>{try{e.handleAuthResponse(await t.startNewProject({login:e.login,projectName:o.projectName}))}catch(i){r(ut(i))}},children:[a.jsxs(Ut,{style:{flexDirection:"column"},children:[a.jsx(Or,{size:32}),a.jsx(ae,{children:"Create project"})]}),a.jsxs(Se,{gap:"xl",children:[a.jsx(ie,{name:"projectName",label:"Project Name",placeholder:"My Project",required:!0,autoFocus:!0,error:Le(n,"firstName")}),a.jsxs(le,{c:"dimmed",size:"xs",children:["By clicking submit you agree to the Medplum"," ",a.jsx(Ue,{href:"https://www.medplum.com/privacy",children:"Privacy Policy"})," and ",a.jsx(Ue,{href:"https://www.medplum.com/terms",children:"Terms of Service"}),"."]})]}),a.jsx(Y,{justify:"flex-end",mt:"xl",wrap:"nowrap",children:a.jsx(Z,{type:"submit",children:"Create project"})})]})}function bP(e,t){const n=document.getElementsByTagName("head")[0],r=document.createElement("script");r.async=!0,r.src=e,r.onload=t??null,n.appendChild(r)}function CP(e){const t=te(),{googleClientId:n,handleGoogleCredential:r}=e,o=p.useRef(null),[i,s]=p.useState(typeof google<"u"),[l,c]=p.useState(!1),[u,d]=p.useState(!1);return p.useEffect(()=>{if(typeof google>"u"){bP("https://accounts.google.com/gsi/client",()=>s(!0));return}l||(google.accounts.id.initialize({client_id:n,callback:r}),c(!0)),o.current&&!u&&(google.accounts.id.renderButton(o.current,{}),d(!0))},[t,n,l,i,o,u,r]),n?a.jsx("div",{ref:o}):null}var PB={MEDPLUM_BASE_URL:"__MEDPLUM_BASE_URL__",MEDPLUM_CLIENT_ID:"__MEDPLUM_CLIENT_ID__",GOOGLE_CLIENT_ID:"__GOOGLE_CLIENT_ID__",RECAPTCHA_SITE_KEY:"__RECAPTCHA_SITE_KEY__",MEDPLUM_REGISTER_ENABLED:"__MEDPLUM_REGISTER_ENABLED__",MEDPLUM_VERSION:"3.0.1-9cbb1620",BASE_URL:"/",MODE:"production",DEV:!1,PROD:!0,SSR:!1};function jP(e){var t;if(e)return e;if(typeof window<"u"){const n=window.location.protocol+"//"+window.location.host;if((((t=PB.GOOGLE_AUTH_ORIGINS)==null?void 0:t.split(","))??[]).includes(n))return"__GOOGLE_CLIENT_ID__"}}function EP(e){typeof grecaptcha>"u"&&bP("https://www.google.com/recaptcha/api.js?render="+e)}function TP(e){return new Promise((t,n)=>{grecaptcha.ready(async()=>{try{t(await grecaptcha.execute(e,{action:"submit"}))}catch(r){n(r)}})})}function kB(e){const t=jP(e.googleClientId),n=e.recaptchaSiteKey,r=te(),[o,i]=p.useState(),s=$f(o,void 0);return p.useEffect(()=>{n&&EP(n)},[n]),a.jsxs(Be,{style:{maxWidth:400},onSubmit:async l=>{try{let c="";n&&(c=await TP(n)),e.handleAuthResponse(await r.startNewUser({projectId:e.projectId,clientId:e.clientId,firstName:l.firstName,lastName:l.lastName,email:l.email,password:l.password,remember:l.remember==="true",recaptchaSiteKey:n,recaptchaToken:c}))}catch(c){i(ut(c))}},children:[a.jsx(Ut,{style:{flexDirection:"column"},children:e.children}),a.jsx(to,{issues:s}),t&&a.jsxs(a.Fragment,{children:[a.jsx(Y,{justify:"center",p:"xl",style:{height:70},children:a.jsx(CP,{googleClientId:t,handleGoogleCredential:async l=>{try{e.handleAuthResponse(await r.startGoogleLogin({googleClientId:l.clientId,googleCredential:l.credential,createUser:!0}))}catch(c){i(ut(c))}}})}),a.jsx(Tn,{label:"or",labelPosition:"center",my:"lg"})]}),a.jsxs(Se,{gap:"xl",children:[a.jsx(ie,{name:"firstName",type:"text",label:"First name",placeholder:"First name",required:!0,autoFocus:!0,error:Le(o,"firstName")}),a.jsx(ie,{name:"lastName",type:"text",label:"Last name",placeholder:"Last name",required:!0,error:Le(o,"lastName")}),a.jsx(ie,{name:"email",type:"email",label:"Email",placeholder:"name@domain.com",required:!0,error:Le(o,"email")}),a.jsx(Pr,{name:"password",label:"Password",autoComplete:"off",required:!0,error:Le(o,"password")}),a.jsxs(le,{c:"dimmed",size:"xs",children:["By clicking submit you agree to the Medplum"," ",a.jsx(Ue,{href:"https://www.medplum.com/privacy",children:"Privacy Policy"})," and ",a.jsx(Ue,{href:"https://www.medplum.com/terms",children:"Terms of Service"}),"."]}),a.jsxs(le,{c:"dimmed",size:"xs",children:["This site is protected by reCAPTCHA and the Google"," ",a.jsx(Ue,{href:"https://policies.google.com/privacy",children:"Privacy Policy"})," and ",a.jsx(Ue,{href:"https://policies.google.com/terms",children:"Terms of Service"})," apply."]})]}),a.jsxs(Y,{justify:"space-between",mt:"xl",wrap:"nowrap",children:[a.jsx(ur,{name:"remember",label:"Remember me",size:"xs"}),a.jsx(Z,{type:"submit",children:"Create account"})]})]})}function RB(e){const{type:t,projectId:n,clientId:r,googleClientId:o,recaptchaSiteKey:i,onSuccess:s}=e,l=te(),[c,u]=p.useState(),[d,f]=p.useState();p.useEffect(()=>{t==="patient"&&c&&l.startNewPatient({login:c,projectId:n}).then(m=>l.processCode(m.code)).then(()=>s()).catch(m=>f(ut(m)))},[l,t,n,c,s]);function h(m){m.code?l.processCode(m.code).then(()=>s()).catch(console.log):m.login&&u(m.login)}return a.jsxs(we,{width:450,children:[d&&a.jsx("pre",{children:JSON.stringify(d,null,2)}),!c&&a.jsx(kB,{projectId:n,clientId:r,googleClientId:o,recaptchaSiteKey:i,handleAuthResponse:h,children:e.children}),c&&t==="project"&&a.jsx(SP,{login:c,handleAuthResponse:h})]})}function DB(e){const[t,n]=p.useState();return t?a.jsx(_B,{email:t,...e}):a.jsx(IB,{setEmail:n,...e})}function IB(e){const{setEmail:t,onRegister:n,handleAuthResponse:r,children:o,disableEmailAuth:i,...s}=e,l=te(),c=!e.disableGoogleAuth&&jP(e.googleClientId),u=p.useCallback(async h=>{if(!h.authorizeUrl)return!1;const m=JSON.stringify({...await l.ensureCodeChallenge(s),domain:h.domain}),g=new URL(h.authorizeUrl);return g.searchParams.set("state",m),window.location.assign(g.toString()),!0},[l,s]),d=p.useCallback(async h=>{const m=await l.post("auth/method",{email:h.email});await u(m)||t(h.email)},[l,u,t]),f=p.useCallback(async h=>{const m=await l.startGoogleLogin({...s,googleCredential:h.credential});await u(m)||r(m)},[l,s,u,r]);return a.jsxs(Be,{style:{maxWidth:400},onSubmit:d,children:[a.jsx(Ut,{style:{flexDirection:"column"},children:o}),c&&a.jsxs(a.Fragment,{children:[a.jsx(Y,{justify:"center",p:"xl",style:{height:70},children:a.jsx(CP,{googleClientId:c,handleGoogleCredential:f})}),!i&&a.jsx(Tn,{label:"or",labelPosition:"center",my:"lg"})]}),!i&&a.jsx(ie,{name:"email",type:"email",label:"Email",placeholder:"name@domain.com",required:!0,autoFocus:!0}),a.jsxs(Y,{justify:"space-between",mt:"xl",gap:0,wrap:"nowrap",children:[a.jsx("div",{children:n&&a.jsx(Ue,{component:"button",type:"button",color:"dimmed",onClick:n,size:"xs",children:"Register"})}),!i&&a.jsx(Z,{type:"submit",children:"Next"})]})]})}function _B(e){const{onForgotPassword:t,handleAuthResponse:n,children:r,...o}=e,i=te(),[s,l]=p.useState(),c=$f(s,void 0),u=p.useCallback(d=>{i.startLogin({...o,password:d.password,remember:d.remember==="on"}).then(n).catch(f=>l(ut(f)))},[i,o,n]);return a.jsxs(Be,{style:{maxWidth:400},onSubmit:u,children:[a.jsx(Ut,{style:{flexDirection:"column"},children:r}),a.jsx(to,{issues:c}),a.jsx(Se,{gap:"xl",children:a.jsx(Pr,{name:"password",label:"Password",autoComplete:"off",required:!0,autoFocus:!0,error:Le(s,"password")})}),a.jsxs(Y,{justify:"space-between",mt:"xl",gap:0,wrap:"nowrap",children:[t&&a.jsx(Ue,{component:"button",type:"button",c:"dimmed",onClick:t,size:"xs",children:"Forgot password"}),a.jsx(ur,{id:"remember",name:"remember",label:"Remember me",size:"xs",style:{lineHeight:1}}),a.jsx(Z,{type:"submit",children:"Sign in"})]})]})}function AB(e){const t=te(),[n,r]=p.useState();return a.jsxs(Se,{children:[a.jsxs(Ut,{style:{flexDirection:"column"},children:[a.jsx(Or,{size:32}),a.jsx(ae,{order:3,children:"Choose profile"})]}),a.jsx(to,{outcome:n}),e.memberships.map(o=>{var i,s;return a.jsx(Gn,{onClick:()=>{t.post("auth/profile",{login:e.login,profile:o.id}).then(e.handleAuthResponse).catch(l=>r(ut(l)))},children:a.jsxs(Y,{children:[a.jsx(Yi,{radius:"xl"}),a.jsxs("div",{style:{flex:1},children:[a.jsx(le,{size:"sm",fw:500,children:(i=o.profile)==null?void 0:i.display}),a.jsx(le,{c:"dimmed",size:"xs",children:(s=o.project)==null?void 0:s.display})]})]})},o.id)})]})}function NB(e){const t=te();return a.jsx(Be,{style:{maxWidth:400},onSubmit:n=>{t.post("auth/scope",{login:e.login,scope:Object.keys(n).join(" ")}).then(e.handleAuthResponse).catch(console.log)},children:a.jsxs(Se,{children:[a.jsxs(Ut,{style:{flexDirection:"column"},children:[a.jsx(Or,{size:32}),a.jsx(ae,{children:"Choose scope"})]}),a.jsx(Se,{children:(e.scope??"openid").split(" ").map(n=>a.jsx(ur,{id:n,name:n,label:n,defaultChecked:!0},n))}),a.jsx(Y,{justify:"flex-end",mt:"xl",children:a.jsx(Z,{type:"submit",children:"Set scope"})})]})})}function OB(e){const t=te(),[n,r]=p.useState();return a.jsx(Be,{style:{maxWidth:400},onSubmit:o=>{r(void 0),t.post("auth/mfa/verify",{login:e.login,token:o.token}).then(e.handleAuthResponse).catch(i=>r(Pe(i)))},children:a.jsxs(Se,{children:[a.jsxs(Ut,{style:{flexDirection:"column"},children:[a.jsx(Or,{size:32}),a.jsx(ae,{children:"Enter MFA code"})]}),n&&a.jsx(us,{icon:a.jsx(Cc,{size:16}),title:"Error",color:"red",children:n}),a.jsx(Se,{children:a.jsx(ie,{name:"token",label:"MFA code",required:!0})}),a.jsx(Y,{justify:"flex-end",mt:"xl",children:a.jsx(Z,{type:"submit",children:"Submit code"})})]})})}function PP(e){const{login:t,chooseScopes:n,onSuccess:r,onForgotPassword:o,onRegister:i,onCode:s,...l}=e,c=te(),[u,d]=p.useState(),[f,h]=p.useState(!1),[m,g]=p.useState(),y=p.useCallback(x=>{s?s(x):c.processCode(x).then(()=>{r&&r()}).catch(w=>ce({color:"red",message:Pe(w)}))},[c,s,r]),C=p.useCallback(x=>{h(!!x.mfaRequired),x.login&&d(x.login),x.memberships&&g(x.memberships),x.code&&(n?g(void 0):y(x.code))},[n,y]),v=p.useCallback(x=>{y(x.code)},[y]);return p.useEffect(()=>{t&&!u&&c.get("auth/login/"+t).then(C).catch(x=>ce({color:"red",message:Pe(x)}))},[c,t,u,C]),a.jsx(we,{width:450,children:u?f?a.jsx(OB,{login:u,handleAuthResponse:C}):m?a.jsx(AB,{login:u,memberships:m,handleAuthResponse:C}):e.projectId==="new"?a.jsx(SP,{login:u,handleAuthResponse:C}):e.chooseScopes?a.jsx(NB,{login:u,scope:e.scope,handleAuthResponse:v}):a.jsx("div",{children:"Success"}):a.jsx(DB,{onForgotPassword:o,onRegister:i,handleAuthResponse:C,disableGoogleAuth:e.disableGoogleAuth,disableEmailAuth:e.disableEmailAuth,...l,children:e.children})})}var kP,ow=sc;kP=ow.createRoot,ow.hydrateRoot;/**
197
- * @remix-run/router v1.14.2
198
- *
199
- * Copyright (c) Remix Software Inc.
200
- *
201
- * This source code is licensed under the MIT license found in the
202
- * LICENSE.md file in the root directory of this source tree.
203
- *
204
- * @license MIT
205
- */function kt(){return kt=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},kt.apply(this,arguments)}var It;(function(e){e.Pop="POP",e.Push="PUSH",e.Replace="REPLACE"})(It||(It={}));const iw="popstate";function MB(e){e===void 0&&(e={});function t(r,o){let{pathname:i,search:s,hash:l}=r.location;return Yl("",{pathname:i,search:s,hash:l},o.state&&o.state.usr||null,o.state&&o.state.key||"default")}function n(r,o){return typeof o=="string"?o:Rc(o)}return $B(t,n,null,e)}function Ie(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function ns(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function LB(){return Math.random().toString(36).substr(2,8)}function sw(e,t){return{usr:e.state,key:e.key,idx:t}}function Yl(e,t,n,r){return n===void 0&&(n=null),kt({pathname:typeof e=="string"?e:e.pathname,search:"",hash:""},typeof t=="string"?_o(t):t,{state:n,key:t&&t.key||r||LB()})}function Rc(e){let{pathname:t="/",search:n="",hash:r=""}=e;return n&&n!=="?"&&(t+=n.charAt(0)==="?"?n:"?"+n),r&&r!=="#"&&(t+=r.charAt(0)==="#"?r:"#"+r),t}function _o(e){let t={};if(e){let n=e.indexOf("#");n>=0&&(t.hash=e.substr(n),e=e.substr(0,n));let r=e.indexOf("?");r>=0&&(t.search=e.substr(r),e=e.substr(0,r)),e&&(t.pathname=e)}return t}function $B(e,t,n,r){r===void 0&&(r={});let{window:o=document.defaultView,v5Compat:i=!1}=r,s=o.history,l=It.Pop,c=null,u=d();u==null&&(u=0,s.replaceState(kt({},s.state,{idx:u}),""));function d(){return(s.state||{idx:null}).idx}function f(){l=It.Pop;let C=d(),v=C==null?null:C-u;u=C,c&&c({action:l,location:y.location,delta:v})}function h(C,v){l=It.Push;let x=Yl(y.location,C,v);n&&n(x,C),u=d()+1;let w=sw(x,u),S=y.createHref(x);try{s.pushState(w,"",S)}catch(E){if(E instanceof DOMException&&E.name==="DataCloneError")throw E;o.location.assign(S)}i&&c&&c({action:l,location:y.location,delta:1})}function m(C,v){l=It.Replace;let x=Yl(y.location,C,v);n&&n(x,C),u=d();let w=sw(x,u),S=y.createHref(x);s.replaceState(w,"",S),i&&c&&c({action:l,location:y.location,delta:0})}function g(C){let v=o.location.origin!=="null"?o.location.origin:o.location.href,x=typeof C=="string"?C:Rc(C);return Ie(v,"No window.location.(origin|href) available to create URL for href: "+x),new URL(x,v)}let y={get action(){return l},get location(){return e(o,s)},listen(C){if(c)throw new Error("A history only accepts one active listener");return o.addEventListener(iw,f),c=C,()=>{o.removeEventListener(iw,f),c=null}},createHref(C){return t(o,C)},createURL:g,encodeLocation(C){let v=g(C);return{pathname:v.pathname,search:v.search,hash:v.hash}},push:h,replace:m,go(C){return s.go(C)}};return y}var Et;(function(e){e.data="data",e.deferred="deferred",e.redirect="redirect",e.error="error"})(Et||(Et={}));const FB=new Set(["lazy","caseSensitive","path","id","index","children"]);function zB(e){return e.index===!0}function wm(e,t,n,r){return n===void 0&&(n=[]),r===void 0&&(r={}),e.map((o,i)=>{let s=[...n,i],l=typeof o.id=="string"?o.id:s.join("-");if(Ie(o.index!==!0||!o.children,"Cannot specify children on an index route"),Ie(!r[l],'Found a route id collision on id "'+l+`". Route id's must be globally unique within Data Router usages`),zB(o)){let c=kt({},o,t(o),{id:l});return r[l]=c,c}else{let c=kt({},o,t(o),{id:l,children:void 0});return r[l]=c,o.children&&(c.children=wm(o.children,t,s,r)),c}})}function qs(e,t,n){n===void 0&&(n="/");let r=typeof t=="string"?_o(t):t,o=Dc(r.pathname||"/",n);if(o==null)return null;let i=RP(e);UB(i);let s=null;for(let l=0;s==null&&l<i.length;++l)s=XB(i[l],eU(o));return s}function BB(e,t){let{route:n,pathname:r,params:o}=e;return{id:n.id,pathname:r,params:o,data:t[n.id],handle:n.handle}}function RP(e,t,n,r){t===void 0&&(t=[]),n===void 0&&(n=[]),r===void 0&&(r="");let o=(i,s,l)=>{let c={relativePath:l===void 0?i.path||"":l,caseSensitive:i.caseSensitive===!0,childrenIndex:s,route:i};c.relativePath.startsWith("/")&&(Ie(c.relativePath.startsWith(r),'Absolute route path "'+c.relativePath+'" nested under path '+('"'+r+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),c.relativePath=c.relativePath.slice(r.length));let u=ci([r,c.relativePath]),d=n.concat(c);i.children&&i.children.length>0&&(Ie(i.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+u+'".')),RP(i.children,t,d,u)),!(i.path==null&&!i.index)&&t.push({path:u,score:KB(u,i.index),routesMeta:d})};return e.forEach((i,s)=>{var l;if(i.path===""||!((l=i.path)!=null&&l.includes("?")))o(i,s);else for(let c of DP(i.path))o(i,s,c)}),t}function DP(e){let t=e.split("/");if(t.length===0)return[];let[n,...r]=t,o=n.endsWith("?"),i=n.replace(/\?$/,"");if(r.length===0)return o?[i,""]:[i];let s=DP(r.join("/")),l=[];return l.push(...s.map(c=>c===""?i:[i,c].join("/"))),o&&l.push(...s),l.map(c=>e.startsWith("/")&&c===""?"/":c)}function UB(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:YB(t.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}const VB=/^:[\w-]+$/,HB=3,WB=2,qB=1,GB=10,QB=-2,aw=e=>e==="*";function KB(e,t){let n=e.split("/"),r=n.length;return n.some(aw)&&(r+=QB),t&&(r+=WB),n.filter(o=>!aw(o)).reduce((o,i)=>o+(VB.test(i)?HB:i===""?qB:GB),r)}function YB(e,t){return e.length===t.length&&e.slice(0,-1).every((r,o)=>r===t[o])?e[e.length-1]-t[t.length-1]:0}function XB(e,t){let{routesMeta:n}=e,r={},o="/",i=[];for(let s=0;s<n.length;++s){let l=n[s],c=s===n.length-1,u=o==="/"?t:t.slice(o.length)||"/",d=JB({path:l.relativePath,caseSensitive:l.caseSensitive,end:c},u);if(!d)return null;Object.assign(r,d.params);let f=l.route;i.push({params:r,pathname:ci([o,d.pathname]),pathnameBase:oU(ci([o,d.pathnameBase])),route:f}),d.pathnameBase!=="/"&&(o=ci([o,d.pathnameBase]))}return i}function JB(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[n,r]=ZB(e.path,e.caseSensitive,e.end),o=t.match(n);if(!o)return null;let i=o[0],s=i.replace(/(.)\/+$/,"$1"),l=o.slice(1);return{params:r.reduce((u,d,f)=>{let{paramName:h,isOptional:m}=d;if(h==="*"){let y=l[f]||"";s=i.slice(0,i.length-y.length).replace(/(.)\/+$/,"$1")}const g=l[f];return m&&!g?u[h]=void 0:u[h]=tU(g||"",h),u},{}),pathname:i,pathnameBase:s,pattern:e}}function ZB(e,t,n){t===void 0&&(t=!1),n===void 0&&(n=!0),ns(e==="*"||!e.endsWith("*")||e.endsWith("/*"),'Route path "'+e+'" will be treated as if it were '+('"'+e.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+e.replace(/\*$/,"/*")+'".'));let r=[],o="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(s,l,c)=>(r.push({paramName:l,isOptional:c!=null}),c?"/?([^\\/]+)?":"/([^\\/]+)"));return e.endsWith("*")?(r.push({paramName:"*"}),o+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?o+="\\/*$":e!==""&&e!=="/"&&(o+="(?:(?=\\/|$))"),[new RegExp(o,t?void 0:"i"),r]}function eU(e){try{return decodeURI(e)}catch(t){return ns(!1,'The URL path "'+e+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+t+").")),e}}function tU(e,t){try{return decodeURIComponent(e)}catch(n){return ns(!1,'The value for the URL param "'+t+'" will not be decoded because'+(' the string "'+e+'" is a malformed URL segment. This is probably')+(" due to a bad percent encoding ("+n+").")),e}}function Dc(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith("/")?t.length-1:t.length,r=e.charAt(n);return r&&r!=="/"?null:e.slice(n)||"/"}function nU(e,t){t===void 0&&(t="/");let{pathname:n,search:r="",hash:o=""}=typeof e=="string"?_o(e):e;return{pathname:n?n.startsWith("/")?n:rU(n,t):t,search:iU(r),hash:sU(o)}}function rU(e,t){let n=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(o=>{o===".."?n.length>1&&n.pop():o!=="."&&n.push(o)}),n.length>1?n.join("/"):"/"}function Kh(e,t,n,r){return"Cannot include a '"+e+"' character in a manually specified "+("`to."+t+"` field ["+JSON.stringify(r)+"]. Please separate it out to the ")+("`to."+n+"` field. Alternatively you may provide the full path as ")+'a string in <Link to="..."> and the router will parse it for you.'}function IP(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function _P(e,t){let n=IP(e);return t?n.map((r,o)=>o===e.length-1?r.pathname:r.pathnameBase):n.map(r=>r.pathnameBase)}function AP(e,t,n,r){r===void 0&&(r=!1);let o;typeof e=="string"?o=_o(e):(o=kt({},e),Ie(!o.pathname||!o.pathname.includes("?"),Kh("?","pathname","search",o)),Ie(!o.pathname||!o.pathname.includes("#"),Kh("#","pathname","hash",o)),Ie(!o.search||!o.search.includes("#"),Kh("#","search","hash",o)));let i=e===""||o.pathname==="",s=i?"/":o.pathname,l;if(s==null)l=n;else{let f=t.length-1;if(!r&&s.startsWith("..")){let h=s.split("/");for(;h[0]==="..";)h.shift(),f-=1;o.pathname=h.join("/")}l=f>=0?t[f]:"/"}let c=nU(o,l),u=s&&s!=="/"&&s.endsWith("/"),d=(i||s===".")&&n.endsWith("/");return!c.pathname.endsWith("/")&&(u||d)&&(c.pathname+="/"),c}const ci=e=>e.join("/").replace(/\/\/+/g,"/"),oU=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),iU=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,sU=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e;class Qv{constructor(t,n,r,o){o===void 0&&(o=!1),this.status=t,this.statusText=n||"",this.internal=o,r instanceof Error?(this.data=r.toString(),this.error=r):this.data=r}}function NP(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}const OP=["post","put","patch","delete"],aU=new Set(OP),lU=["get",...OP],cU=new Set(lU),uU=new Set([301,302,303,307,308]),dU=new Set([307,308]),Yh={state:"idle",location:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},fU={state:"idle",data:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},el={state:"unblocked",proceed:void 0,reset:void 0,location:void 0},MP=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,hU=e=>({hasErrorBoundary:!!e.hasErrorBoundary}),LP="remix-router-transitions";function pU(e){const t=e.window?e.window:typeof window<"u"?window:void 0,n=typeof t<"u"&&typeof t.document<"u"&&typeof t.document.createElement<"u",r=!n;Ie(e.routes.length>0,"You must provide a non-empty routes array to createRouter");let o;if(e.mapRouteProperties)o=e.mapRouteProperties;else if(e.detectErrorBoundary){let N=e.detectErrorBoundary;o=L=>({hasErrorBoundary:N(L)})}else o=hU;let i={},s=wm(e.routes,o,void 0,i),l,c=e.basename||"/",u=kt({v7_fetcherPersist:!1,v7_normalizeFormMethod:!1,v7_partialHydration:!1,v7_prependBasename:!1,v7_relativeSplatPath:!1},e.future),d=null,f=new Set,h=null,m=null,g=null,y=e.hydrationData!=null,C=qs(s,e.history.location,c),v=null;if(C==null){let N=tr(404,{pathname:e.history.location.pathname}),{matches:L,route:H}=mw(s);C=L,v={[H.id]:N}}let x,w=C.some(N=>N.route.lazy),S=C.some(N=>N.route.loader);if(w)x=!1;else if(!S)x=!0;else if(u.v7_partialHydration){let N=e.hydrationData?e.hydrationData.loaderData:null,L=e.hydrationData?e.hydrationData.errors:null;x=C.every(H=>H.route.loader&&H.route.loader.hydrate!==!0&&(N&&N[H.route.id]!==void 0||L&&L[H.route.id]!==void 0))}else x=e.hydrationData!=null;let E,j={historyAction:e.history.action,location:e.history.location,matches:C,initialized:x,navigation:Yh,restoreScrollPosition:e.hydrationData!=null?!1:null,preventScrollReset:!1,revalidation:"idle",loaderData:e.hydrationData&&e.hydrationData.loaderData||{},actionData:e.hydrationData&&e.hydrationData.actionData||null,errors:e.hydrationData&&e.hydrationData.errors||v,fetchers:new Map,blockers:new Map},T=It.Pop,P=!1,R,I=!1,O=new Map,D=null,A=!1,M=!1,B=[],F=[],_=new Map,k=0,z=-1,q=new Map,Q=new Set,re=new Map,Ce=new Map,Re=new Set,Oe=new Map,ve=new Map,Ve=!1;function Je(){if(d=e.history.listen(N=>{let{action:L,location:H,delta:J}=N;if(Ve){Ve=!1;return}ns(ve.size===0||J!=null,"You are trying to use a blocker on a POP navigation to a location that was not created by @remix-run/router. This will fail silently in production. This can happen if you are navigating outside the router via `window.history.pushState`/`window.location.hash` instead of using router navigation APIs. This can also happen if you are using createHashRouter and the user manually changes the URL.");let se=vs({currentLocation:j.location,nextLocation:H,historyAction:L});if(se&&J!=null){Ve=!0,e.history.go(J*-1),Oo(se,{state:"blocked",location:H,proceed(){Oo(se,{state:"proceeding",proceed:void 0,reset:void 0,location:H}),e.history.go(J)},reset(){let ke=new Map(j.blockers);ke.set(se,el),pe({blockers:ke})}});return}return nt(L,H)}),n){EU(t,O);let N=()=>TU(t,O);t.addEventListener("pagehide",N),D=()=>t.removeEventListener("pagehide",N)}return j.initialized||nt(It.Pop,j.location,{initialHydration:!0}),E}function at(){d&&d(),D&&D(),f.clear(),R&&R.abort(),j.fetchers.forEach((N,L)=>Xn(L)),j.blockers.forEach((N,L)=>Ac(L))}function Ft(N){return f.add(N),()=>f.delete(N)}function pe(N,L){L===void 0&&(L={}),j=kt({},j,N);let H=[],J=[];u.v7_fetcherPersist&&j.fetchers.forEach((se,ke)=>{se.state==="idle"&&(Re.has(ke)?J.push(ke):H.push(ke))}),[...f].forEach(se=>se(j,{deletedFetchers:J,unstable_viewTransitionOpts:L.viewTransitionOpts,unstable_flushSync:L.flushSync===!0})),u.v7_fetcherPersist&&(H.forEach(se=>j.fetchers.delete(se)),J.forEach(se=>Xn(se)))}function Fe(N,L,H){var J,se;let{flushSync:ke}=H===void 0?{}:H,xe=j.actionData!=null&&j.navigation.formMethod!=null&&br(j.navigation.formMethod)&&j.navigation.state==="loading"&&((J=N.state)==null?void 0:J._isRedirect)!==!0,ye;L.actionData?Object.keys(L.actionData).length>0?ye=L.actionData:ye=null:xe?ye=j.actionData:ye=null;let me=L.loaderData?pw(j.loaderData,L.loaderData,L.matches||[],L.errors):j.loaderData,_e=j.blockers;_e.size>0&&(_e=new Map(_e),_e.forEach((Ge,Mt)=>_e.set(Mt,el)));let De=P===!0||j.navigation.formMethod!=null&&br(j.navigation.formMethod)&&((se=N.state)==null?void 0:se._isRedirect)!==!0;l&&(s=l,l=void 0),A||T===It.Pop||(T===It.Push?e.history.push(N,N.state):T===It.Replace&&e.history.replace(N,N.state));let Ee;if(T===It.Pop){let Ge=O.get(j.location.pathname);Ge&&Ge.has(N.pathname)?Ee={currentLocation:j.location,nextLocation:N}:O.has(N.pathname)&&(Ee={currentLocation:N,nextLocation:j.location})}else if(I){let Ge=O.get(j.location.pathname);Ge?Ge.add(N.pathname):(Ge=new Set([N.pathname]),O.set(j.location.pathname,Ge)),Ee={currentLocation:j.location,nextLocation:N}}pe(kt({},L,{actionData:ye,loaderData:me,historyAction:T,location:N,initialized:!0,navigation:Yh,revalidation:"idle",restoreScrollPosition:Oc(N,L.matches||j.matches),preventScrollReset:De,blockers:_e}),{viewTransitionOpts:Ee,flushSync:ke===!0}),T=It.Pop,P=!1,I=!1,A=!1,M=!1,B=[],F=[]}async function Ne(N,L){if(typeof N=="number"){e.history.go(N);return}let H=Sm(j.location,j.matches,c,u.v7_prependBasename,N,u.v7_relativeSplatPath,L==null?void 0:L.fromRouteId,L==null?void 0:L.relative),{path:J,submission:se,error:ke}=lw(u.v7_normalizeFormMethod,!1,H,L),xe=j.location,ye=Yl(j.location,J,L&&L.state);ye=kt({},ye,e.history.encodeLocation(ye));let me=L&&L.replace!=null?L.replace:void 0,_e=It.Push;me===!0?_e=It.Replace:me===!1||se!=null&&br(se.formMethod)&&se.formAction===j.location.pathname+j.location.search&&(_e=It.Replace);let De=L&&"preventScrollReset"in L?L.preventScrollReset===!0:void 0,Ee=(L&&L.unstable_flushSync)===!0,Ge=vs({currentLocation:xe,nextLocation:ye,historyAction:_e});if(Ge){Oo(Ge,{state:"blocked",location:ye,proceed(){Oo(Ge,{state:"proceeding",proceed:void 0,reset:void 0,location:ye}),Ne(N,L)},reset(){let Mt=new Map(j.blockers);Mt.set(Ge,el),pe({blockers:Mt})}});return}return await nt(_e,ye,{submission:se,pendingError:ke,preventScrollReset:De,replace:L&&L.replace,enableViewTransition:L&&L.unstable_viewTransition,flushSync:Ee})}function tt(){if(rt(),pe({revalidation:"loading"}),j.navigation.state!=="submitting"){if(j.navigation.state==="idle"){nt(j.historyAction,j.location,{startUninterruptedRevalidation:!0});return}nt(T||j.historyAction,j.navigation.location,{overrideNavigation:j.navigation})}}async function nt(N,L,H){R&&R.abort(),R=null,T=N,A=(H&&H.startUninterruptedRevalidation)===!0,r0(j.location,j.matches),P=(H&&H.preventScrollReset)===!0,I=(H&&H.enableViewTransition)===!0;let J=l||s,se=H&&H.overrideNavigation,ke=qs(J,L,c),xe=(H&&H.flushSync)===!0;if(!ke){let Mt=tr(404,{pathname:L.pathname}),{matches:Jn,route:zt}=mw(J);Mo(),Fe(L,{matches:Jn,loaderData:{},errors:{[zt.id]:Mt}},{flushSync:xe});return}if(j.initialized&&!M&&xU(j.location,L)&&!(H&&H.submission&&br(H.submission.formMethod))){Fe(L,{matches:ke},{flushSync:xe});return}R=new AbortController;let ye=nl(e.history,L,R.signal,H&&H.submission),me,_e;if(H&&H.pendingError)_e={[Cl(ke).route.id]:H.pendingError};else if(H&&H.submission&&br(H.submission.formMethod)){let Mt=await Fn(ye,L,H.submission,ke,{replace:H.replace,flushSync:xe});if(Mt.shortCircuited)return;me=Mt.pendingActionData,_e=Mt.pendingActionError,se=Xh(L,H.submission),xe=!1,ye=new Request(ye.url,{signal:ye.signal})}let{shortCircuited:De,loaderData:Ee,errors:Ge}=await Yn(ye,L,ke,se,H&&H.submission,H&&H.fetcherSubmission,H&&H.replace,H&&H.initialHydration===!0,xe,me,_e);De||(R=null,Fe(L,kt({matches:ke},me?{actionData:me}:{},{loaderData:Ee,errors:Ge})))}async function Fn(N,L,H,J,se){se===void 0&&(se={}),rt();let ke=CU(L,H);pe({navigation:ke},{flushSync:se.flushSync===!0});let xe,ye=Cm(J,L);if(!ye.route.action&&!ye.route.lazy)xe={type:Et.error,error:tr(405,{method:N.method,pathname:L.pathname,routeId:ye.route.id})};else if(xe=await tl("action",N,ye,J,i,o,c,u.v7_relativeSplatPath),N.signal.aborted)return{shortCircuited:!0};if(zi(xe)){let me;return se&&se.replace!=null?me=se.replace:me=xe.location===j.location.pathname+j.location.search,await ee(j,xe,{submission:H,replace:me}),{shortCircuited:!0}}if(Gs(xe)){let me=Cl(J,ye.route.id);return(se&&se.replace)!==!0&&(T=It.Push),{pendingActionData:{},pendingActionError:{[me.route.id]:xe.error}}}if(Fi(xe))throw tr(400,{type:"defer-action"});return{pendingActionData:{[ye.route.id]:xe.data}}}async function Yn(N,L,H,J,se,ke,xe,ye,me,_e,De){let Ee=J||Xh(L,se),Ge=se||ke||vw(Ee),Mt=l||s,[Jn,zt]=cw(e.history,j,H,Ge,L,u.v7_partialHydration&&ye===!0,M,B,F,Re,re,Q,Mt,c,_e,De);if(Mo(ot=>!(H&&H.some(yt=>yt.route.id===ot))||Jn&&Jn.some(yt=>yt.route.id===ot)),z=++k,Jn.length===0&&zt.length===0){let ot=gr();return Fe(L,kt({matches:H,loaderData:{},errors:De||null},_e?{actionData:_e}:{},ot?{fetchers:new Map(j.fetchers)}:{}),{flushSync:me}),{shortCircuited:!0}}if(!A&&(!u.v7_partialHydration||!ye)){zt.forEach(yt=>{let $r=j.fetchers.get(yt.key),Lc=rl(void 0,$r?$r.data:void 0);j.fetchers.set(yt.key,Lc)});let ot=_e||j.actionData;pe(kt({navigation:Ee},ot?Object.keys(ot).length===0?{actionData:null}:{actionData:ot}:{},zt.length>0?{fetchers:new Map(j.fetchers)}:{}),{flushSync:me})}zt.forEach(ot=>{_.has(ot.key)&&Cn(ot.key),ot.controller&&_.set(ot.key,ot.controller)});let xs=()=>zt.forEach(ot=>Cn(ot.key));R&&R.signal.addEventListener("abort",xs);let{results:Xf,loaderResults:ws,fetcherResults:Lo}=await be(j.matches,H,Jn,zt,N);if(N.signal.aborted)return{shortCircuited:!0};R&&R.signal.removeEventListener("abort",xs),zt.forEach(ot=>_.delete(ot.key));let Pi=gw(Xf);if(Pi){if(Pi.idx>=Jn.length){let ot=zt[Pi.idx-Jn.length].key;Q.add(ot)}return await ee(j,Pi.result,{replace:xe}),{shortCircuited:!0}}let{loaderData:Jf,errors:Zf}=hw(j,H,Jn,ws,De,zt,Lo,Oe);Oe.forEach((ot,yt)=>{ot.subscribe($r=>{($r||ot.done)&&Oe.delete(yt)})});let eh=gr(),Ss=No(z),Mc=eh||Ss||zt.length>0;return kt({loaderData:Jf,errors:Zf},Mc?{fetchers:new Map(j.fetchers)}:{})}function Ao(N,L,H,J){if(r)throw new Error("router.fetch() was called during the server render, but it shouldn't be. You are likely calling a useFetcher() method in the body of your component. Try moving it to a useEffect or a callback.");_.has(N)&&Cn(N);let se=(J&&J.unstable_flushSync)===!0,ke=l||s,xe=Sm(j.location,j.matches,c,u.v7_prependBasename,H,u.v7_relativeSplatPath,L,J==null?void 0:J.relative),ye=qs(ke,xe,c);if(!ye){Dt(N,L,tr(404,{pathname:xe}),{flushSync:se});return}let{path:me,submission:_e,error:De}=lw(u.v7_normalizeFormMethod,!0,xe,J);if(De){Dt(N,L,De,{flushSync:se});return}let Ee=Cm(ye,me);if(P=(J&&J.preventScrollReset)===!0,_e&&br(_e.formMethod)){Wt(N,L,me,Ee,ye,se,_e);return}re.set(N,{routeId:L,path:me}),no(N,L,me,Ee,ye,se,_e)}async function Wt(N,L,H,J,se,ke,xe){if(rt(),re.delete(N),!J.route.action&&!J.route.lazy){let yt=tr(405,{method:xe.formMethod,pathname:H,routeId:L});Dt(N,L,yt,{flushSync:ke});return}let ye=j.fetchers.get(N);Ze(N,jU(xe,ye),{flushSync:ke});let me=new AbortController,_e=nl(e.history,H,me.signal,xe);_.set(N,me);let De=k,Ee=await tl("action",_e,J,se,i,o,c,u.v7_relativeSplatPath);if(_e.signal.aborted){_.get(N)===me&&_.delete(N);return}if(u.v7_fetcherPersist&&Re.has(N)){if(zi(Ee)||Gs(Ee)){Ze(N,zo(void 0));return}}else{if(zi(Ee))if(_.delete(N),z>De){Ze(N,zo(void 0));return}else return Q.add(N),Ze(N,rl(xe)),ee(j,Ee,{fetcherSubmission:xe});if(Gs(Ee)){Dt(N,L,Ee.error);return}}if(Fi(Ee))throw tr(400,{type:"defer-action"});let Ge=j.navigation.location||j.location,Mt=nl(e.history,Ge,me.signal),Jn=l||s,zt=j.navigation.state!=="idle"?qs(Jn,j.navigation.location,c):j.matches;Ie(zt,"Didn't find any matches after fetcher action");let xs=++k;q.set(N,xs);let Xf=rl(xe,Ee.data);j.fetchers.set(N,Xf);let[ws,Lo]=cw(e.history,j,zt,xe,Ge,!1,M,B,F,Re,re,Q,Jn,c,{[J.route.id]:Ee.data},void 0);Lo.filter(yt=>yt.key!==N).forEach(yt=>{let $r=yt.key,Lc=j.fetchers.get($r),dk=rl(void 0,Lc?Lc.data:void 0);j.fetchers.set($r,dk),_.has($r)&&Cn($r),yt.controller&&_.set($r,yt.controller)}),pe({fetchers:new Map(j.fetchers)});let Pi=()=>Lo.forEach(yt=>Cn(yt.key));me.signal.addEventListener("abort",Pi);let{results:Jf,loaderResults:Zf,fetcherResults:eh}=await be(j.matches,zt,ws,Lo,Mt);if(me.signal.aborted)return;me.signal.removeEventListener("abort",Pi),q.delete(N),_.delete(N),Lo.forEach(yt=>_.delete(yt.key));let Ss=gw(Jf);if(Ss){if(Ss.idx>=ws.length){let yt=Lo[Ss.idx-ws.length].key;Q.add(yt)}return ee(j,Ss.result)}let{loaderData:Mc,errors:ot}=hw(j,j.matches,ws,Zf,void 0,Lo,eh,Oe);if(j.fetchers.has(N)){let yt=zo(Ee.data);j.fetchers.set(N,yt)}No(xs),j.navigation.state==="loading"&&xs>z?(Ie(T,"Expected pending action"),R&&R.abort(),Fe(j.navigation.location,{matches:zt,loaderData:Mc,errors:ot,fetchers:new Map(j.fetchers)})):(pe({errors:ot,loaderData:pw(j.loaderData,Mc,zt,ot),fetchers:new Map(j.fetchers)}),M=!1)}async function no(N,L,H,J,se,ke,xe){let ye=j.fetchers.get(N);Ze(N,rl(xe,ye?ye.data:void 0),{flushSync:ke});let me=new AbortController,_e=nl(e.history,H,me.signal);_.set(N,me);let De=k,Ee=await tl("loader",_e,J,se,i,o,c,u.v7_relativeSplatPath);if(Fi(Ee)&&(Ee=await zP(Ee,_e.signal,!0)||Ee),_.get(N)===me&&_.delete(N),!_e.signal.aborted){if(Re.has(N)){Ze(N,zo(void 0));return}if(zi(Ee))if(z>De){Ze(N,zo(void 0));return}else{Q.add(N),await ee(j,Ee);return}if(Gs(Ee)){Dt(N,L,Ee.error);return}Ie(!Fi(Ee),"Unhandled fetcher deferred data"),Ze(N,zo(Ee.data))}}async function ee(N,L,H){let{submission:J,fetcherSubmission:se,replace:ke}=H===void 0?{}:H;L.revalidate&&(M=!0);let xe=Yl(N.location,L.location,{_isRedirect:!0});if(Ie(xe,"Expected a location on the redirect navigation"),n){let Ge=!1;if(L.reloadDocument)Ge=!0;else if(MP.test(L.location)){const Mt=e.history.createURL(L.location);Ge=Mt.origin!==t.location.origin||Dc(Mt.pathname,c)==null}if(Ge){ke?t.location.replace(L.location):t.location.assign(L.location);return}}R=null;let ye=ke===!0?It.Replace:It.Push,{formMethod:me,formAction:_e,formEncType:De}=N.navigation;!J&&!se&&me&&_e&&De&&(J=vw(N.navigation));let Ee=J||se;if(dU.has(L.status)&&Ee&&br(Ee.formMethod))await nt(ye,xe,{submission:kt({},Ee,{formAction:L.location}),preventScrollReset:P});else{let Ge=Xh(xe,J);await nt(ye,xe,{overrideNavigation:Ge,fetcherSubmission:se,preventScrollReset:P})}}async function be(N,L,H,J,se){let ke=await Promise.all([...H.map(me=>tl("loader",se,me,L,i,o,c,u.v7_relativeSplatPath)),...J.map(me=>me.matches&&me.match&&me.controller?tl("loader",nl(e.history,me.path,me.controller.signal),me.match,me.matches,i,o,c,u.v7_relativeSplatPath):{type:Et.error,error:tr(404,{pathname:me.path})})]),xe=ke.slice(0,H.length),ye=ke.slice(H.length);return await Promise.all([yw(N,H,xe,xe.map(()=>se.signal),!1,j.loaderData),yw(N,J.map(me=>me.match),ye,J.map(me=>me.controller?me.controller.signal:null),!0)]),{results:ke,loaderResults:xe,fetcherResults:ye}}function rt(){M=!0,B.push(...Mo()),re.forEach((N,L)=>{_.has(L)&&(F.push(L),Cn(L))})}function Ze(N,L,H){H===void 0&&(H={}),j.fetchers.set(N,L),pe({fetchers:new Map(j.fetchers)},{flushSync:(H&&H.flushSync)===!0})}function Dt(N,L,H,J){J===void 0&&(J={});let se=Cl(j.matches,L);Xn(N),pe({errors:{[se.route.id]:H},fetchers:new Map(j.fetchers)},{flushSync:(J&&J.flushSync)===!0})}function Mr(N){return u.v7_fetcherPersist&&(Ce.set(N,(Ce.get(N)||0)+1),Re.has(N)&&Re.delete(N)),j.fetchers.get(N)||fU}function Xn(N){let L=j.fetchers.get(N);_.has(N)&&!(L&&L.state==="loading"&&q.has(N))&&Cn(N),re.delete(N),q.delete(N),Q.delete(N),Re.delete(N),j.fetchers.delete(N)}function Ti(N){if(u.v7_fetcherPersist){let L=(Ce.get(N)||0)-1;L<=0?(Ce.delete(N),Re.add(N)):Ce.set(N,L)}else Xn(N);pe({fetchers:new Map(j.fetchers)})}function Cn(N){let L=_.get(N);Ie(L,"Expected fetch controller: "+N),L.abort(),_.delete(N)}function Lr(N){for(let L of N){let H=Mr(L),J=zo(H.data);j.fetchers.set(L,J)}}function gr(){let N=[],L=!1;for(let H of Q){let J=j.fetchers.get(H);Ie(J,"Expected fetcher: "+H),J.state==="loading"&&(Q.delete(H),N.push(H),L=!0)}return Lr(N),L}function No(N){let L=[];for(let[H,J]of q)if(J<N){let se=j.fetchers.get(H);Ie(se,"Expected fetcher: "+H),se.state==="loading"&&(Cn(H),q.delete(H),L.push(H))}return Lr(L),L.length>0}function za(N,L){let H=j.blockers.get(N)||el;return ve.get(N)!==L&&ve.set(N,L),H}function Ac(N){j.blockers.delete(N),ve.delete(N)}function Oo(N,L){let H=j.blockers.get(N)||el;Ie(H.state==="unblocked"&&L.state==="blocked"||H.state==="blocked"&&L.state==="blocked"||H.state==="blocked"&&L.state==="proceeding"||H.state==="blocked"&&L.state==="unblocked"||H.state==="proceeding"&&L.state==="unblocked","Invalid blocker state transition: "+H.state+" -> "+L.state);let J=new Map(j.blockers);J.set(N,L),pe({blockers:J})}function vs(N){let{currentLocation:L,nextLocation:H,historyAction:J}=N;if(ve.size===0)return;ve.size>1&&ns(!1,"A router only supports one blocker at a time");let se=Array.from(ve.entries()),[ke,xe]=se[se.length-1],ye=j.blockers.get(ke);if(!(ye&&ye.state==="proceeding")&&xe({currentLocation:L,nextLocation:H,historyAction:J}))return ke}function Mo(N){let L=[];return Oe.forEach((H,J)=>{(!N||N(J))&&(H.cancel(),L.push(J),Oe.delete(J))}),L}function jn(N,L,H){if(h=N,g=L,m=H||null,!y&&j.navigation===Yh){y=!0;let J=Oc(j.location,j.matches);J!=null&&pe({restoreScrollPosition:J})}return()=>{h=null,g=null,m=null}}function Nc(N,L){return m&&m(N,L.map(J=>BB(J,j.loaderData)))||N.key}function r0(N,L){if(h&&g){let H=Nc(N,L);h[H]=g()}}function Oc(N,L){if(h){let H=Nc(N,L),J=h[H];if(typeof J=="number")return J}return null}function nn(N){i={},l=wm(N,o,void 0,i)}return E={get basename(){return c},get future(){return u},get state(){return j},get routes(){return s},get window(){return t},initialize:Je,subscribe:Ft,enableScrollRestoration:jn,navigate:Ne,fetch:Ao,revalidate:tt,createHref:N=>e.history.createHref(N),encodeLocation:N=>e.history.encodeLocation(N),getFetcher:Mr,deleteFetcher:Ti,dispose:at,getBlocker:za,deleteBlocker:Ac,_internalFetchControllers:_,_internalActiveDeferreds:Oe,_internalSetRoutes:nn},E}function mU(e){return e!=null&&("formData"in e&&e.formData!=null||"body"in e&&e.body!==void 0)}function Sm(e,t,n,r,o,i,s,l){let c,u;if(s){c=[];for(let f of t)if(c.push(f),f.route.id===s){u=f;break}}else c=t,u=t[t.length-1];let d=AP(o||".",_P(c,i),Dc(e.pathname,n)||e.pathname,l==="path");return o==null&&(d.search=e.search,d.hash=e.hash),(o==null||o===""||o===".")&&u&&u.route.index&&!Kv(d.search)&&(d.search=d.search?d.search.replace(/^\?/,"?index&"):"?index"),r&&n!=="/"&&(d.pathname=d.pathname==="/"?n:ci([n,d.pathname])),Rc(d)}function lw(e,t,n,r){if(!r||!mU(r))return{path:n};if(r.formMethod&&!bU(r.formMethod))return{path:n,error:tr(405,{method:r.formMethod})};let o=()=>({path:n,error:tr(400,{type:"invalid-body"})}),i=r.formMethod||"get",s=e?i.toUpperCase():i.toLowerCase(),l=FP(n);if(r.body!==void 0){if(r.formEncType==="text/plain"){if(!br(s))return o();let h=typeof r.body=="string"?r.body:r.body instanceof FormData||r.body instanceof URLSearchParams?Array.from(r.body.entries()).reduce((m,g)=>{let[y,C]=g;return""+m+y+"="+C+`
206
- `},""):String(r.body);return{path:n,submission:{formMethod:s,formAction:l,formEncType:r.formEncType,formData:void 0,json:void 0,text:h}}}else if(r.formEncType==="application/json"){if(!br(s))return o();try{let h=typeof r.body=="string"?JSON.parse(r.body):r.body;return{path:n,submission:{formMethod:s,formAction:l,formEncType:r.formEncType,formData:void 0,json:h,text:void 0}}}catch{return o()}}}Ie(typeof FormData=="function","FormData is not available in this environment");let c,u;if(r.formData)c=bm(r.formData),u=r.formData;else if(r.body instanceof FormData)c=bm(r.body),u=r.body;else if(r.body instanceof URLSearchParams)c=r.body,u=fw(c);else if(r.body==null)c=new URLSearchParams,u=new FormData;else try{c=new URLSearchParams(r.body),u=fw(c)}catch{return o()}let d={formMethod:s,formAction:l,formEncType:r&&r.formEncType||"application/x-www-form-urlencoded",formData:u,json:void 0,text:void 0};if(br(d.formMethod))return{path:n,submission:d};let f=_o(n);return t&&f.search&&Kv(f.search)&&c.append("index",""),f.search="?"+c,{path:Rc(f),submission:d}}function gU(e,t){let n=e;if(t){let r=e.findIndex(o=>o.route.id===t);r>=0&&(n=e.slice(0,r))}return n}function cw(e,t,n,r,o,i,s,l,c,u,d,f,h,m,g,y){let C=y?Object.values(y)[0]:g?Object.values(g)[0]:void 0,v=e.createURL(t.location),x=e.createURL(o),w=y?Object.keys(y)[0]:void 0,E=gU(n,w).filter((T,P)=>{let{route:R}=T;if(R.lazy)return!0;if(R.loader==null)return!1;if(i)return R.loader.hydrate?!0:t.loaderData[R.id]===void 0&&(!t.errors||t.errors[R.id]===void 0);if(yU(t.loaderData,t.matches[P],T)||l.some(D=>D===T.route.id))return!0;let I=t.matches[P],O=T;return uw(T,kt({currentUrl:v,currentParams:I.params,nextUrl:x,nextParams:O.params},r,{actionResult:C,defaultShouldRevalidate:s||v.pathname+v.search===x.pathname+x.search||v.search!==x.search||$P(I,O)}))}),j=[];return d.forEach((T,P)=>{if(i||!n.some(A=>A.route.id===T.routeId)||u.has(P))return;let R=qs(h,T.path,m);if(!R){j.push({key:P,routeId:T.routeId,path:T.path,matches:null,match:null,controller:null});return}let I=t.fetchers.get(P),O=Cm(R,T.path),D=!1;f.has(P)?D=!1:c.includes(P)?D=!0:I&&I.state!=="idle"&&I.data===void 0?D=s:D=uw(O,kt({currentUrl:v,currentParams:t.matches[t.matches.length-1].params,nextUrl:x,nextParams:n[n.length-1].params},r,{actionResult:C,defaultShouldRevalidate:s})),D&&j.push({key:P,routeId:T.routeId,path:T.path,matches:R,match:O,controller:new AbortController})}),[E,j]}function yU(e,t,n){let r=!t||n.route.id!==t.route.id,o=e[n.route.id]===void 0;return r||o}function $P(e,t){let n=e.route.path;return e.pathname!==t.pathname||n!=null&&n.endsWith("*")&&e.params["*"]!==t.params["*"]}function uw(e,t){if(e.route.shouldRevalidate){let n=e.route.shouldRevalidate(t);if(typeof n=="boolean")return n}return t.defaultShouldRevalidate}async function dw(e,t,n){if(!e.lazy)return;let r=await e.lazy();if(!e.lazy)return;let o=n[e.id];Ie(o,"No route found in manifest");let i={};for(let s in r){let c=o[s]!==void 0&&s!=="hasErrorBoundary";ns(!c,'Route "'+o.id+'" has a static property "'+s+'" defined but its lazy function is also returning a value for this property. '+('The lazy route property "'+s+'" will be ignored.')),!c&&!FB.has(s)&&(i[s]=r[s])}Object.assign(o,i),Object.assign(o,kt({},t(o),{lazy:void 0}))}async function tl(e,t,n,r,o,i,s,l,c){c===void 0&&(c={});let u,d,f,h=y=>{let C,v=new Promise((x,w)=>C=w);return f=()=>C(),t.signal.addEventListener("abort",f),Promise.race([y({request:t,params:n.params,context:c.requestContext}),v])};try{let y=n.route[e];if(n.route.lazy)if(y){let C,v=await Promise.all([h(y).catch(x=>{C=x}),dw(n.route,i,o)]);if(C)throw C;d=v[0]}else if(await dw(n.route,i,o),y=n.route[e],y)d=await h(y);else if(e==="action"){let C=new URL(t.url),v=C.pathname+C.search;throw tr(405,{method:t.method,pathname:v,routeId:n.route.id})}else return{type:Et.data,data:void 0};else if(y)d=await h(y);else{let C=new URL(t.url),v=C.pathname+C.search;throw tr(404,{pathname:v})}Ie(d!==void 0,"You defined "+(e==="action"?"an action":"a loader")+" for route "+('"'+n.route.id+"\" but didn't return anything from your `"+e+"` ")+"function. Please return a value or `null`.")}catch(y){u=Et.error,d=y}finally{f&&t.signal.removeEventListener("abort",f)}if(SU(d)){let y=d.status;if(uU.has(y)){let v=d.headers.get("Location");if(Ie(v,"Redirects returned/thrown from loaders/actions must have a Location header"),!MP.test(v))v=Sm(new URL(t.url),r.slice(0,r.indexOf(n)+1),s,!0,v,l);else if(!c.isStaticRequest){let x=new URL(t.url),w=v.startsWith("//")?new URL(x.protocol+v):new URL(v),S=Dc(w.pathname,s)!=null;w.origin===x.origin&&S&&(v=w.pathname+w.search+w.hash)}if(c.isStaticRequest)throw d.headers.set("Location",v),d;return{type:Et.redirect,status:y,location:v,revalidate:d.headers.get("X-Remix-Revalidate")!==null,reloadDocument:d.headers.get("X-Remix-Reload-Document")!==null}}if(c.isRouteRequest)throw{type:u===Et.error?Et.error:Et.data,response:d};let C;try{let v=d.headers.get("Content-Type");v&&/\bapplication\/json\b/.test(v)?d.body==null?C=null:C=await d.json():C=await d.text()}catch(v){return{type:Et.error,error:v}}return u===Et.error?{type:u,error:new Qv(y,d.statusText,C),headers:d.headers}:{type:Et.data,data:C,statusCode:d.status,headers:d.headers}}if(u===Et.error)return{type:u,error:d};if(wU(d)){var m,g;return{type:Et.deferred,deferredData:d,statusCode:(m=d.init)==null?void 0:m.status,headers:((g=d.init)==null?void 0:g.headers)&&new Headers(d.init.headers)}}return{type:Et.data,data:d}}function nl(e,t,n,r){let o=e.createURL(FP(t)).toString(),i={signal:n};if(r&&br(r.formMethod)){let{formMethod:s,formEncType:l}=r;i.method=s.toUpperCase(),l==="application/json"?(i.headers=new Headers({"Content-Type":l}),i.body=JSON.stringify(r.json)):l==="text/plain"?i.body=r.text:l==="application/x-www-form-urlencoded"&&r.formData?i.body=bm(r.formData):i.body=r.formData}return new Request(o,i)}function bm(e){let t=new URLSearchParams;for(let[n,r]of e.entries())t.append(n,typeof r=="string"?r:r.name);return t}function fw(e){let t=new FormData;for(let[n,r]of e.entries())t.append(n,r);return t}function vU(e,t,n,r,o){let i={},s=null,l,c=!1,u={};return n.forEach((d,f)=>{let h=t[f].route.id;if(Ie(!zi(d),"Cannot handle redirect results in processLoaderData"),Gs(d)){let m=Cl(e,h),g=d.error;r&&(g=Object.values(r)[0],r=void 0),s=s||{},s[m.route.id]==null&&(s[m.route.id]=g),i[h]=void 0,c||(c=!0,l=NP(d.error)?d.error.status:500),d.headers&&(u[h]=d.headers)}else Fi(d)?(o.set(h,d.deferredData),i[h]=d.deferredData.data):i[h]=d.data,d.statusCode!=null&&d.statusCode!==200&&!c&&(l=d.statusCode),d.headers&&(u[h]=d.headers)}),r&&(s=r,i[Object.keys(r)[0]]=void 0),{loaderData:i,errors:s,statusCode:l||200,loaderHeaders:u}}function hw(e,t,n,r,o,i,s,l){let{loaderData:c,errors:u}=vU(t,n,r,o,l);for(let d=0;d<i.length;d++){let{key:f,match:h,controller:m}=i[d];Ie(s!==void 0&&s[d]!==void 0,"Did not find corresponding fetcher result");let g=s[d];if(!(m&&m.signal.aborted))if(Gs(g)){let y=Cl(e.matches,h==null?void 0:h.route.id);u&&u[y.route.id]||(u=kt({},u,{[y.route.id]:g.error})),e.fetchers.delete(f)}else if(zi(g))Ie(!1,"Unhandled fetcher revalidation redirect");else if(Fi(g))Ie(!1,"Unhandled fetcher deferred data");else{let y=zo(g.data);e.fetchers.set(f,y)}}return{loaderData:c,errors:u}}function pw(e,t,n,r){let o=kt({},t);for(let i of n){let s=i.route.id;if(t.hasOwnProperty(s)?t[s]!==void 0&&(o[s]=t[s]):e[s]!==void 0&&i.route.loader&&(o[s]=e[s]),r&&r.hasOwnProperty(s))break}return o}function Cl(e,t){return(t?e.slice(0,e.findIndex(r=>r.route.id===t)+1):[...e]).reverse().find(r=>r.route.hasErrorBoundary===!0)||e[0]}function mw(e){let t=e.length===1?e[0]:e.find(n=>n.index||!n.path||n.path==="/")||{id:"__shim-error-route__"};return{matches:[{params:{},pathname:"",pathnameBase:"",route:t}],route:t}}function tr(e,t){let{pathname:n,routeId:r,method:o,type:i}=t===void 0?{}:t,s="Unknown Server Error",l="Unknown @remix-run/router error";return e===400?(s="Bad Request",o&&n&&r?l="You made a "+o+' request to "'+n+'" but '+('did not provide a `loader` for route "'+r+'", ')+"so there is no way to handle the request.":i==="defer-action"?l="defer() is not supported in actions":i==="invalid-body"&&(l="Unable to encode submission body")):e===403?(s="Forbidden",l='Route "'+r+'" does not match URL "'+n+'"'):e===404?(s="Not Found",l='No route matches URL "'+n+'"'):e===405&&(s="Method Not Allowed",o&&n&&r?l="You made a "+o.toUpperCase()+' request to "'+n+'" but '+('did not provide an `action` for route "'+r+'", ')+"so there is no way to handle the request.":o&&(l='Invalid request method "'+o.toUpperCase()+'"')),new Qv(e||500,s,new Error(l),!0)}function gw(e){for(let t=e.length-1;t>=0;t--){let n=e[t];if(zi(n))return{result:n,idx:t}}}function FP(e){let t=typeof e=="string"?_o(e):e;return Rc(kt({},t,{hash:""}))}function xU(e,t){return e.pathname!==t.pathname||e.search!==t.search?!1:e.hash===""?t.hash!=="":e.hash===t.hash?!0:t.hash!==""}function Fi(e){return e.type===Et.deferred}function Gs(e){return e.type===Et.error}function zi(e){return(e&&e.type)===Et.redirect}function wU(e){let t=e;return t&&typeof t=="object"&&typeof t.data=="object"&&typeof t.subscribe=="function"&&typeof t.cancel=="function"&&typeof t.resolveData=="function"}function SU(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.headers=="object"&&typeof e.body<"u"}function bU(e){return cU.has(e.toLowerCase())}function br(e){return aU.has(e.toLowerCase())}async function yw(e,t,n,r,o,i){for(let s=0;s<n.length;s++){let l=n[s],c=t[s];if(!c)continue;let u=e.find(f=>f.route.id===c.route.id),d=u!=null&&!$P(u,c)&&(i&&i[c.route.id])!==void 0;if(Fi(l)&&(o||d)){let f=r[s];Ie(f,"Expected an AbortSignal for revalidating fetcher deferred result"),await zP(l,f,o).then(h=>{h&&(n[s]=h||n[s])})}}}async function zP(e,t,n){if(n===void 0&&(n=!1),!await e.deferredData.resolveData(t)){if(n)try{return{type:Et.data,data:e.deferredData.unwrappedData}}catch(o){return{type:Et.error,error:o}}return{type:Et.data,data:e.deferredData.data}}}function Kv(e){return new URLSearchParams(e).getAll("index").some(t=>t==="")}function Cm(e,t){let n=typeof t=="string"?_o(t).search:t.search;if(e[e.length-1].route.index&&Kv(n||""))return e[e.length-1];let r=IP(e);return r[r.length-1]}function vw(e){let{formMethod:t,formAction:n,formEncType:r,text:o,formData:i,json:s}=e;if(!(!t||!n||!r)){if(o!=null)return{formMethod:t,formAction:n,formEncType:r,formData:void 0,json:void 0,text:o};if(i!=null)return{formMethod:t,formAction:n,formEncType:r,formData:i,json:void 0,text:void 0};if(s!==void 0)return{formMethod:t,formAction:n,formEncType:r,formData:void 0,json:s,text:void 0}}}function Xh(e,t){return t?{state:"loading",location:e,formMethod:t.formMethod,formAction:t.formAction,formEncType:t.formEncType,formData:t.formData,json:t.json,text:t.text}:{state:"loading",location:e,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0}}function CU(e,t){return{state:"submitting",location:e,formMethod:t.formMethod,formAction:t.formAction,formEncType:t.formEncType,formData:t.formData,json:t.json,text:t.text}}function rl(e,t){return e?{state:"loading",formMethod:e.formMethod,formAction:e.formAction,formEncType:e.formEncType,formData:e.formData,json:e.json,text:e.text,data:t}:{state:"loading",formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:t}}function jU(e,t){return{state:"submitting",formMethod:e.formMethod,formAction:e.formAction,formEncType:e.formEncType,formData:e.formData,json:e.json,text:e.text,data:t?t.data:void 0}}function zo(e){return{state:"idle",formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:e}}function EU(e,t){try{let n=e.sessionStorage.getItem(LP);if(n){let r=JSON.parse(n);for(let[o,i]of Object.entries(r||{}))i&&Array.isArray(i)&&t.set(o,new Set(i||[]))}}catch{}}function TU(e,t){if(t.size>0){let n={};for(let[r,o]of t)n[r]=[...o];try{e.sessionStorage.setItem(LP,JSON.stringify(n))}catch(r){ns(!1,"Failed to save applied view transitions in sessionStorage ("+r+").")}}}/**
207
- * React Router v6.21.3
208
- *
209
- * Copyright (c) Remix Software Inc.
210
- *
211
- * This source code is licensed under the MIT license found in the
212
- * LICENSE.md file in the root directory of this source tree.
213
- *
214
- * @license MIT
215
- */function Xl(){return Xl=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Xl.apply(this,arguments)}const Hf=p.createContext(null),BP=p.createContext(null),Wf=p.createContext(null),qf=p.createContext(null),bi=p.createContext({outlet:null,matches:[],isDataRoute:!1}),UP=p.createContext(null);function Gf(){return p.useContext(qf)!=null}function Ci(){return Gf()||Ie(!1),p.useContext(qf).location}function VP(e){p.useContext(Wf).static||p.useLayoutEffect(e)}function Rt(){let{isDataRoute:e}=p.useContext(bi);return e?zU():PU()}function PU(){Gf()||Ie(!1);let e=p.useContext(Hf),{basename:t,future:n,navigator:r}=p.useContext(Wf),{matches:o}=p.useContext(bi),{pathname:i}=Ci(),s=JSON.stringify(_P(o,n.v7_relativeSplatPath)),l=p.useRef(!1);return VP(()=>{l.current=!0}),p.useCallback(function(u,d){if(d===void 0&&(d={}),!l.current)return;if(typeof u=="number"){r.go(u);return}let f=AP(u,JSON.parse(s),i,d.relative==="path");e==null&&t!=="/"&&(f.pathname=f.pathname==="/"?t:ci([t,f.pathname])),(d.replace?r.replace:r.push)(f,d.state,d)},[t,r,s,i,e])}const kU=p.createContext(null);function RU(e){let t=p.useContext(bi).outlet;return t&&p.createElement(kU.Provider,{value:e},t)}function Xe(){let{matches:e}=p.useContext(bi),t=e[e.length-1];return t?t.params:{}}function DU(e,t){return HP(e,t)}function HP(e,t,n,r){Gf()||Ie(!1);let{navigator:o}=p.useContext(Wf),{matches:i}=p.useContext(bi),s=i[i.length-1],l=s?s.params:{};s&&s.pathname;let c=s?s.pathnameBase:"/";s&&s.route;let u=Ci(),d;if(t){var f;let C=typeof t=="string"?_o(t):t;c==="/"||(f=C.pathname)!=null&&f.startsWith(c)||Ie(!1),d=C}else d=u;let h=d.pathname||"/",m=c==="/"?h:h.slice(c.length)||"/",g=qs(e,{pathname:m}),y=OU(g&&g.map(C=>Object.assign({},C,{params:Object.assign({},l,C.params),pathname:ci([c,o.encodeLocation?o.encodeLocation(C.pathname).pathname:C.pathname]),pathnameBase:C.pathnameBase==="/"?c:ci([c,o.encodeLocation?o.encodeLocation(C.pathnameBase).pathname:C.pathnameBase])})),i,n,r);return t&&y?p.createElement(qf.Provider,{value:{location:Xl({pathname:"/",search:"",hash:"",state:null,key:"default"},d),navigationType:It.Pop}},y):y}function IU(){let e=FU(),t=NP(e)?e.status+" "+e.statusText:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,o={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return p.createElement(p.Fragment,null,p.createElement("h2",null,"Unexpected Application Error!"),p.createElement("h3",{style:{fontStyle:"italic"}},t),n?p.createElement("pre",{style:o},n):null,null)}const _U=p.createElement(IU,null);class AU extends p.Component{constructor(t){super(t),this.state={location:t.location,revalidation:t.revalidation,error:t.error}}static getDerivedStateFromError(t){return{error:t}}static getDerivedStateFromProps(t,n){return n.location!==t.location||n.revalidation!=="idle"&&t.revalidation==="idle"?{error:t.error,location:t.location,revalidation:t.revalidation}:{error:t.error!==void 0?t.error:n.error,location:n.location,revalidation:t.revalidation||n.revalidation}}componentDidCatch(t,n){console.error("React Router caught the following error during render",t,n)}render(){return this.state.error!==void 0?p.createElement(bi.Provider,{value:this.props.routeContext},p.createElement(UP.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function NU(e){let{routeContext:t,match:n,children:r}=e,o=p.useContext(Hf);return o&&o.static&&o.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(o.staticContext._deepestRenderedBoundaryId=n.route.id),p.createElement(bi.Provider,{value:t},r)}function OU(e,t,n,r){var o;if(t===void 0&&(t=[]),n===void 0&&(n=null),r===void 0&&(r=null),e==null){var i;if((i=n)!=null&&i.errors)e=n.matches;else return null}let s=e,l=(o=n)==null?void 0:o.errors;if(l!=null){let d=s.findIndex(f=>f.route.id&&(l==null?void 0:l[f.route.id]));d>=0||Ie(!1),s=s.slice(0,Math.min(s.length,d+1))}let c=!1,u=-1;if(n&&r&&r.v7_partialHydration)for(let d=0;d<s.length;d++){let f=s[d];if((f.route.HydrateFallback||f.route.hydrateFallbackElement)&&(u=d),f.route.id){let{loaderData:h,errors:m}=n,g=f.route.loader&&h[f.route.id]===void 0&&(!m||m[f.route.id]===void 0);if(f.route.lazy||g){c=!0,u>=0?s=s.slice(0,u+1):s=[s[0]];break}}}return s.reduceRight((d,f,h)=>{let m,g=!1,y=null,C=null;n&&(m=l&&f.route.id?l[f.route.id]:void 0,y=f.route.errorElement||_U,c&&(u<0&&h===0?(BU("route-fallback",!1),g=!0,C=null):u===h&&(g=!0,C=f.route.hydrateFallbackElement||null)));let v=t.concat(s.slice(0,h+1)),x=()=>{let w;return m?w=y:g?w=C:f.route.Component?w=p.createElement(f.route.Component,null):f.route.element?w=f.route.element:w=d,p.createElement(NU,{match:f,routeContext:{outlet:d,matches:v,isDataRoute:n!=null},children:w})};return n&&(f.route.ErrorBoundary||f.route.errorElement||h===0)?p.createElement(AU,{location:n.location,revalidation:n.revalidation,component:y,error:m,children:x(),routeContext:{outlet:null,matches:v,isDataRoute:!0}}):x()},null)}var WP=function(e){return e.UseBlocker="useBlocker",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e}(WP||{}),bd=function(e){return e.UseBlocker="useBlocker",e.UseLoaderData="useLoaderData",e.UseActionData="useActionData",e.UseRouteError="useRouteError",e.UseNavigation="useNavigation",e.UseRouteLoaderData="useRouteLoaderData",e.UseMatches="useMatches",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e.UseRouteId="useRouteId",e}(bd||{});function MU(e){let t=p.useContext(Hf);return t||Ie(!1),t}function LU(e){let t=p.useContext(BP);return t||Ie(!1),t}function $U(e){let t=p.useContext(bi);return t||Ie(!1),t}function qP(e){let t=$U(),n=t.matches[t.matches.length-1];return n.route.id||Ie(!1),n.route.id}function FU(){var e;let t=p.useContext(UP),n=LU(bd.UseRouteError),r=qP(bd.UseRouteError);return t!==void 0?t:(e=n.errors)==null?void 0:e[r]}function zU(){let{router:e}=MU(WP.UseNavigateStable),t=qP(bd.UseNavigateStable),n=p.useRef(!1);return VP(()=>{n.current=!0}),p.useCallback(function(o,i){i===void 0&&(i={}),n.current&&(typeof o=="number"?e.navigate(o):e.navigate(o,Xl({fromRouteId:t},i)))},[e,t])}const xw={};function BU(e,t,n){!t&&!xw[e]&&(xw[e]=!0)}function Yv(e){return RU(e.context)}function de(e){Ie(!1)}function UU(e){let{basename:t="/",children:n=null,location:r,navigationType:o=It.Pop,navigator:i,static:s=!1,future:l}=e;Gf()&&Ie(!1);let c=t.replace(/^\/*/,"/"),u=p.useMemo(()=>({basename:c,navigator:i,static:s,future:Xl({v7_relativeSplatPath:!1},l)}),[c,l,i,s]);typeof r=="string"&&(r=_o(r));let{pathname:d="/",search:f="",hash:h="",state:m=null,key:g="default"}=r,y=p.useMemo(()=>{let C=Dc(d,c);return C==null?null:{location:{pathname:C,search:f,hash:h,state:m,key:g},navigationType:o}},[c,d,f,h,m,g,o]);return y==null?null:p.createElement(Wf.Provider,{value:u},p.createElement(qf.Provider,{children:n,value:y}))}function VU(e){let{children:t,location:n}=e;return DU(jm(t),n)}new Promise(()=>{});function jm(e,t){t===void 0&&(t=[]);let n=[];return p.Children.forEach(e,(r,o)=>{if(!p.isValidElement(r))return;let i=[...t,o];if(r.type===p.Fragment){n.push.apply(n,jm(r.props.children,i));return}r.type!==de&&Ie(!1),!r.props.index||!r.props.children||Ie(!1);let s={id:r.props.id||i.join("-"),caseSensitive:r.props.caseSensitive,element:r.props.element,Component:r.props.Component,index:r.props.index,path:r.props.path,loader:r.props.loader,action:r.props.action,errorElement:r.props.errorElement,ErrorBoundary:r.props.ErrorBoundary,hasErrorBoundary:r.props.ErrorBoundary!=null||r.props.errorElement!=null,shouldRevalidate:r.props.shouldRevalidate,handle:r.props.handle,lazy:r.props.lazy};r.props.children&&(s.children=jm(r.props.children,i)),n.push(s)}),n}function HU(e){let t={hasErrorBoundary:e.ErrorBoundary!=null||e.errorElement!=null};return e.Component&&Object.assign(t,{element:p.createElement(e.Component),Component:void 0}),e.HydrateFallback&&Object.assign(t,{hydrateFallbackElement:p.createElement(e.HydrateFallback),HydrateFallback:void 0}),e.ErrorBoundary&&Object.assign(t,{errorElement:p.createElement(e.ErrorBoundary),ErrorBoundary:void 0}),t}/**
216
- * React Router DOM v6.21.3
217
- *
218
- * Copyright (c) Remix Software Inc.
219
- *
220
- * This source code is licensed under the MIT license found in the
221
- * LICENSE.md file in the root directory of this source tree.
222
- *
223
- * @license MIT
224
- */function Cd(){return Cd=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Cd.apply(this,arguments)}function Em(e){return e===void 0&&(e=""),new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,n)=>{let r=e[n];return t.concat(Array.isArray(r)?r.map(o=>[n,o]):[[n,r]])},[]))}function WU(e,t){let n=Em(e);return t&&t.forEach((r,o)=>{n.has(o)||t.getAll(o).forEach(i=>{n.append(o,i)})}),n}function qU(e,t){return pU({basename:t==null?void 0:t.basename,future:Cd({},t==null?void 0:t.future,{v7_prependBasename:!0}),history:MB({window:t==null?void 0:t.window}),hydrationData:(t==null?void 0:t.hydrationData)||GU(),routes:e,mapRouteProperties:HU,window:t==null?void 0:t.window}).initialize()}function GU(){var e;let t=(e=window)==null?void 0:e.__staticRouterHydrationData;return t&&t.errors&&(t=Cd({},t,{errors:QU(t.errors)})),t}function QU(e){if(!e)return null;let t=Object.entries(e),n={};for(let[r,o]of t)if(o&&o.__type==="RouteErrorResponse")n[r]=new Qv(o.status,o.statusText,o.data,o.internal===!0);else if(o&&o.__type==="Error"){if(o.__subType){let i=window[o.__subType];if(typeof i=="function")try{let s=new i(o.message);s.stack="",n[r]=s}catch{}}if(n[r]==null){let i=new Error(o.message);i.stack="",n[r]=i}}else n[r]=o;return n}const KU=p.createContext({isTransitioning:!1}),YU=p.createContext(new Map),XU="startTransition",ww=Om[XU],JU="flushSync",Sw=GI[JU];function ZU(e){ww?ww(e):e()}function ol(e){Sw?Sw(e):e()}class eV{constructor(){this.status="pending",this.promise=new Promise((t,n)=>{this.resolve=r=>{this.status==="pending"&&(this.status="resolved",t(r))},this.reject=r=>{this.status==="pending"&&(this.status="rejected",n(r))}})}}function tV(e){let{fallbackElement:t,router:n,future:r}=e,[o,i]=p.useState(n.state),[s,l]=p.useState(),[c,u]=p.useState({isTransitioning:!1}),[d,f]=p.useState(),[h,m]=p.useState(),[g,y]=p.useState(),C=p.useRef(new Map),{v7_startTransition:v}=r||{},x=p.useCallback(T=>{v?ZU(T):T()},[v]),w=p.useCallback((T,P)=>{let{deletedFetchers:R,unstable_flushSync:I,unstable_viewTransitionOpts:O}=P;R.forEach(A=>C.current.delete(A)),T.fetchers.forEach((A,M)=>{A.data!==void 0&&C.current.set(M,A.data)});let D=n.window==null||typeof n.window.document.startViewTransition!="function";if(!O||D){I?ol(()=>i(T)):x(()=>i(T));return}if(I){ol(()=>{h&&(d&&d.resolve(),h.skipTransition()),u({isTransitioning:!0,flushSync:!0,currentLocation:O.currentLocation,nextLocation:O.nextLocation})});let A=n.window.document.startViewTransition(()=>{ol(()=>i(T))});A.finished.finally(()=>{ol(()=>{f(void 0),m(void 0),l(void 0),u({isTransitioning:!1})})}),ol(()=>m(A));return}h?(d&&d.resolve(),h.skipTransition(),y({state:T,currentLocation:O.currentLocation,nextLocation:O.nextLocation})):(l(T),u({isTransitioning:!0,flushSync:!1,currentLocation:O.currentLocation,nextLocation:O.nextLocation}))},[n.window,h,d,C,x]);p.useLayoutEffect(()=>n.subscribe(w),[n,w]),p.useEffect(()=>{c.isTransitioning&&!c.flushSync&&f(new eV)},[c]),p.useEffect(()=>{if(d&&s&&n.window){let T=s,P=d.promise,R=n.window.document.startViewTransition(async()=>{x(()=>i(T)),await P});R.finished.finally(()=>{f(void 0),m(void 0),l(void 0),u({isTransitioning:!1})}),m(R)}},[x,s,d,n.window]),p.useEffect(()=>{d&&s&&o.location.key===s.location.key&&d.resolve()},[d,h,o.location,s]),p.useEffect(()=>{!c.isTransitioning&&g&&(l(g.state),u({isTransitioning:!0,flushSync:!1,currentLocation:g.currentLocation,nextLocation:g.nextLocation}),y(void 0))},[c.isTransitioning,g]),p.useEffect(()=>{},[]);let S=p.useMemo(()=>({createHref:n.createHref,encodeLocation:n.encodeLocation,go:T=>n.navigate(T),push:(T,P,R)=>n.navigate(T,{state:P,preventScrollReset:R==null?void 0:R.preventScrollReset}),replace:(T,P,R)=>n.navigate(T,{replace:!0,state:P,preventScrollReset:R==null?void 0:R.preventScrollReset})}),[n]),E=n.basename||"/",j=p.useMemo(()=>({router:n,navigator:S,static:!1,basename:E}),[n,S,E]);return p.createElement(p.Fragment,null,p.createElement(Hf.Provider,{value:j},p.createElement(BP.Provider,{value:o},p.createElement(YU.Provider,{value:C.current},p.createElement(KU.Provider,{value:c},p.createElement(UU,{basename:E,location:o.location,navigationType:o.historyAction,navigator:S,future:{v7_relativeSplatPath:n.future.v7_relativeSplatPath}},o.initialized||n.future.v7_partialHydration?p.createElement(nV,{routes:n.routes,future:n.future,state:o}):t))))),null)}function nV(e){let{routes:t,future:n,state:r}=e;return HP(t,void 0,r,n)}var bw;(function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher",e.useViewTransitionState="useViewTransitionState"})(bw||(bw={}));var Cw;(function(e){e.UseFetcher="useFetcher",e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"})(Cw||(Cw={}));function Xv(e){let t=p.useRef(Em(e)),n=p.useRef(!1),r=Ci(),o=p.useMemo(()=>WU(r.search,n.current?null:t.current),[r.search]),i=Rt(),s=p.useCallback((l,c)=>{const u=Em(typeof l=="function"?l(o):l);n.current=!0,i("?"+u,c)},[i,o]);return[o,s]}const rV=new Map([["aac","audio/aac"],["abw","application/x-abiword"],["arc","application/x-freearc"],["avif","image/avif"],["avi","video/x-msvideo"],["azw","application/vnd.amazon.ebook"],["bin","application/octet-stream"],["bmp","image/bmp"],["bz","application/x-bzip"],["bz2","application/x-bzip2"],["cda","application/x-cdf"],["csh","application/x-csh"],["css","text/css"],["csv","text/csv"],["doc","application/msword"],["docx","application/vnd.openxmlformats-officedocument.wordprocessingml.document"],["eot","application/vnd.ms-fontobject"],["epub","application/epub+zip"],["gz","application/gzip"],["gif","image/gif"],["heic","image/heic"],["heif","image/heif"],["htm","text/html"],["html","text/html"],["ico","image/vnd.microsoft.icon"],["ics","text/calendar"],["jar","application/java-archive"],["jpeg","image/jpeg"],["jpg","image/jpeg"],["js","text/javascript"],["json","application/json"],["jsonld","application/ld+json"],["mid","audio/midi"],["midi","audio/midi"],["mjs","text/javascript"],["mp3","audio/mpeg"],["mp4","video/mp4"],["mpeg","video/mpeg"],["mpkg","application/vnd.apple.installer+xml"],["odp","application/vnd.oasis.opendocument.presentation"],["ods","application/vnd.oasis.opendocument.spreadsheet"],["odt","application/vnd.oasis.opendocument.text"],["oga","audio/ogg"],["ogv","video/ogg"],["ogx","application/ogg"],["opus","audio/opus"],["otf","font/otf"],["png","image/png"],["pdf","application/pdf"],["php","application/x-httpd-php"],["ppt","application/vnd.ms-powerpoint"],["pptx","application/vnd.openxmlformats-officedocument.presentationml.presentation"],["rar","application/vnd.rar"],["rtf","application/rtf"],["sh","application/x-sh"],["svg","image/svg+xml"],["swf","application/x-shockwave-flash"],["tar","application/x-tar"],["tif","image/tiff"],["tiff","image/tiff"],["ts","video/mp2t"],["ttf","font/ttf"],["txt","text/plain"],["vsd","application/vnd.visio"],["wav","audio/wav"],["weba","audio/webm"],["webm","video/webm"],["webp","image/webp"],["woff","font/woff"],["woff2","font/woff2"],["xhtml","application/xhtml+xml"],["xls","application/vnd.ms-excel"],["xlsx","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"],["xml","application/xml"],["xul","application/vnd.mozilla.xul+xml"],["zip","application/zip"],["7z","application/x-7z-compressed"],["mkv","video/x-matroska"],["mov","video/quicktime"],["msg","application/vnd.ms-outlook"]]);function Ic(e,t){const n=oV(e);if(typeof n.path!="string"){const{webkitRelativePath:r}=e;Object.defineProperty(n,"path",{value:typeof t=="string"?t:typeof r=="string"&&r.length>0?r:e.name,writable:!1,configurable:!1,enumerable:!0})}return n}function oV(e){const{name:t}=e;if(t&&t.lastIndexOf(".")!==-1&&!e.type){const r=t.split(".").pop().toLowerCase(),o=rV.get(r);o&&Object.defineProperty(e,"type",{value:o,writable:!1,configurable:!1,enumerable:!0})}return e}var $a=(e,t,n)=>new Promise((r,o)=>{var i=c=>{try{l(n.next(c))}catch(u){o(u)}},s=c=>{try{l(n.throw(c))}catch(u){o(u)}},l=c=>c.done?r(c.value):Promise.resolve(c.value).then(i,s);l((n=n.apply(e,t)).next())});const iV=[".DS_Store","Thumbs.db"];function sV(e){return $a(this,null,function*(){return jd(e)&&aV(e.dataTransfer)?dV(e.dataTransfer,e.type):lV(e)?cV(e):Array.isArray(e)&&e.every(t=>"getFile"in t&&typeof t.getFile=="function")?uV(e):[]})}function aV(e){return jd(e)}function lV(e){return jd(e)&&jd(e.target)}function jd(e){return typeof e=="object"&&e!==null}function cV(e){return Tm(e.target.files).map(t=>Ic(t))}function uV(e){return $a(this,null,function*(){return(yield Promise.all(e.map(n=>n.getFile()))).map(n=>Ic(n))})}function dV(e,t){return $a(this,null,function*(){if(e.items){const n=Tm(e.items).filter(o=>o.kind==="file");if(t!=="drop")return n;const r=yield Promise.all(n.map(fV));return jw(GP(r))}return jw(Tm(e.files).map(n=>Ic(n)))})}function jw(e){return e.filter(t=>iV.indexOf(t.name)===-1)}function Tm(e){if(e===null)return[];const t=[];for(let n=0;n<e.length;n++){const r=e[n];t.push(r)}return t}function fV(e){if(typeof e.webkitGetAsEntry!="function")return Ew(e);const t=e.webkitGetAsEntry();return t&&t.isDirectory?QP(t):Ew(e)}function GP(e){return e.reduce((t,n)=>[...t,...Array.isArray(n)?GP(n):[n]],[])}function Ew(e){const t=e.getAsFile();if(!t)return Promise.reject(`${e} is not a File`);const n=Ic(t);return Promise.resolve(n)}function hV(e){return $a(this,null,function*(){return e.isDirectory?QP(e):pV(e)})}function QP(e){const t=e.createReader();return new Promise((n,r)=>{const o=[];function i(){t.readEntries(s=>$a(this,null,function*(){if(s.length){const l=Promise.all(s.map(hV));o.push(l),i()}else try{const l=yield Promise.all(o);n(l)}catch(l){r(l)}}),s=>{r(s)})}i()})}function pV(e){return $a(this,null,function*(){return new Promise((t,n)=>{e.file(r=>{const o=Ic(r,e.fullPath);t(o)},r=>{n(r)})})})}function mV(e,t){if(e&&t){const n=Array.isArray(t)?t:t.split(","),r=e.name||"",o=(e.type||"").toLowerCase(),i=o.replace(/\/.*$/,"");return n.some(s=>{const l=s.trim().toLowerCase();return l.charAt(0)==="."?r.toLowerCase().endsWith(l):l.endsWith("/*")?i===l.replace(/\/.*$/,""):o===l})}return!0}var gV=Object.defineProperty,yV=Object.defineProperties,vV=Object.getOwnPropertyDescriptors,Tw=Object.getOwnPropertySymbols,xV=Object.prototype.hasOwnProperty,wV=Object.prototype.propertyIsEnumerable,Pw=(e,t,n)=>t in e?gV(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,SV=(e,t)=>{for(var n in t||(t={}))xV.call(t,n)&&Pw(e,n,t[n]);if(Tw)for(var n of Tw(t))wV.call(t,n)&&Pw(e,n,t[n]);return e},bV=(e,t)=>yV(e,vV(t));const CV="file-invalid-type",jV="file-too-large",EV="file-too-small",TV="too-many-files",PV=e=>{e=Array.isArray(e)&&e.length===1?e[0]:e;const t=Array.isArray(e)?`one of ${e.join(", ")}`:e;return{code:CV,message:`File type must be ${t}`}},kw=e=>({code:jV,message:`File is larger than ${e} ${e===1?"byte":"bytes"}`}),Rw=e=>({code:EV,message:`File is smaller than ${e} ${e===1?"byte":"bytes"}`}),kV={code:TV,message:"Too many files"};function KP(e,t){const n=e.type==="application/x-moz-file"||mV(e,t);return[n,n?null:PV(t)]}function YP(e,t,n){if(Ni(e.size))if(Ni(t)&&Ni(n)){if(e.size>n)return[!1,kw(n)];if(e.size<t)return[!1,Rw(t)]}else{if(Ni(t)&&e.size<t)return[!1,Rw(t)];if(Ni(n)&&e.size>n)return[!1,kw(n)]}return[!0,null]}function Ni(e){return e!=null}function RV({files:e,accept:t,minSize:n,maxSize:r,multiple:o,maxFiles:i,validator:s}){return!o&&e.length>1||o&&i>=1&&e.length>i?!1:e.every(l=>{const[c]=KP(l,t),[u]=YP(l,n,r),d=s?s(l):null;return c&&u&&!d})}function Ed(e){return typeof e.isPropagationStopped=="function"?e.isPropagationStopped():typeof e.cancelBubble<"u"?e.cancelBubble:!1}function du(e){return e.dataTransfer?Array.prototype.some.call(e.dataTransfer.types,t=>t==="Files"||t==="application/x-moz-file"):!!e.target&&!!e.target.files}function Dw(e){e.preventDefault()}function DV(e){return e.indexOf("MSIE")!==-1||e.indexOf("Trident/")!==-1}function IV(e){return e.indexOf("Edge/")!==-1}function _V(e=window.navigator.userAgent){return DV(e)||IV(e)}function Br(...e){return(t,...n)=>e.some(r=>(!Ed(t)&&r&&r(t,...n),Ed(t)))}function AV(){return"showOpenFilePicker"in window}function NV(e){return Ni(e)?[{description:"Files",accept:Object.entries(e).filter(([n,r])=>{let o=!0;return XP(n)||(console.warn(`Skipped "${n}" because it is not a valid MIME type. Check https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types for a list of valid MIME types.`),o=!1),(!Array.isArray(r)||!r.every(JP))&&(console.warn(`Skipped "${n}" because an invalid file extension was provided.`),o=!1),o}).reduce((n,[r,o])=>bV(SV({},n),{[r]:o}),{})}]:e}function OV(e){if(Ni(e))return Object.entries(e).reduce((t,[n,r])=>[...t,n,...r],[]).filter(t=>XP(t)||JP(t)).join(",")}function MV(e){return e instanceof DOMException&&(e.name==="AbortError"||e.code===e.ABORT_ERR)}function LV(e){return e instanceof DOMException&&(e.name==="SecurityError"||e.code===e.SECURITY_ERR)}function XP(e){return e==="audio/*"||e==="video/*"||e==="image/*"||e==="text/*"||/\w+\/[-+.\w]+/g.test(e)}function JP(e){return/^.*\.[\w]+$/.test(e)}var $V=Object.defineProperty,FV=Object.defineProperties,zV=Object.getOwnPropertyDescriptors,Td=Object.getOwnPropertySymbols,ZP=Object.prototype.hasOwnProperty,ek=Object.prototype.propertyIsEnumerable,Iw=(e,t,n)=>t in e?$V(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,fn=(e,t)=>{for(var n in t||(t={}))ZP.call(t,n)&&Iw(e,n,t[n]);if(Td)for(var n of Td(t))ek.call(t,n)&&Iw(e,n,t[n]);return e},Wo=(e,t)=>FV(e,zV(t)),Pd=(e,t)=>{var n={};for(var r in e)ZP.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Td)for(var r of Td(e))t.indexOf(r)<0&&ek.call(e,r)&&(n[r]=e[r]);return n};const Jv=p.forwardRef((e,t)=>{var n=e,{children:r}=n,o=Pd(n,["children"]);const i=nk(o),{open:s}=i,l=Pd(i,["open"]);return p.useImperativeHandle(t,()=>({open:s}),[s]),b.createElement(p.Fragment,null,r(Wo(fn({},l),{open:s})))});Jv.displayName="Dropzone";const tk={disabled:!1,getFilesFromEvent:sV,maxSize:1/0,minSize:0,multiple:!0,maxFiles:0,preventDropOnDocument:!0,noClick:!1,noKeyboard:!1,noDrag:!1,noDragEventsBubbling:!1,validator:null,useFsAccessApi:!0,autoFocus:!1};Jv.defaultProps=tk;Jv.propTypes={children:ze.func,accept:ze.objectOf(ze.arrayOf(ze.string)),multiple:ze.bool,preventDropOnDocument:ze.bool,noClick:ze.bool,noKeyboard:ze.bool,noDrag:ze.bool,noDragEventsBubbling:ze.bool,minSize:ze.number,maxSize:ze.number,maxFiles:ze.number,disabled:ze.bool,getFilesFromEvent:ze.func,onFileDialogCancel:ze.func,onFileDialogOpen:ze.func,useFsAccessApi:ze.bool,autoFocus:ze.bool,onDragEnter:ze.func,onDragLeave:ze.func,onDragOver:ze.func,onDrop:ze.func,onDropAccepted:ze.func,onDropRejected:ze.func,onError:ze.func,validator:ze.func};const Pm={isFocused:!1,isFileDialogActive:!1,isDragActive:!1,isDragAccept:!1,isDragReject:!1,acceptedFiles:[],fileRejections:[]};function nk(e={}){const{accept:t,disabled:n,getFilesFromEvent:r,maxSize:o,minSize:i,multiple:s,maxFiles:l,onDragEnter:c,onDragLeave:u,onDragOver:d,onDrop:f,onDropAccepted:h,onDropRejected:m,onFileDialogCancel:g,onFileDialogOpen:y,useFsAccessApi:C,autoFocus:v,preventDropOnDocument:x,noClick:w,noKeyboard:S,noDrag:E,noDragEventsBubbling:j,onError:T,validator:P}=fn(fn({},tk),e),R=p.useMemo(()=>OV(t),[t]),I=p.useMemo(()=>NV(t),[t]),O=p.useMemo(()=>typeof y=="function"?y:_w,[y]),D=p.useMemo(()=>typeof g=="function"?g:_w,[g]),A=p.useRef(null),M=p.useRef(null),[B,F]=p.useReducer(BV,Pm),{isFocused:_,isFileDialogActive:k}=B,z=p.useRef(typeof window<"u"&&window.isSecureContext&&C&&AV()),q=()=>{!z.current&&k&&setTimeout(()=>{if(M.current){const{files:ee}=M.current;ee.length||(F({type:"closeDialog"}),D())}},300)};p.useEffect(()=>(window.addEventListener("focus",q,!1),()=>{window.removeEventListener("focus",q,!1)}),[M,k,D,z]);const Q=p.useRef([]),re=ee=>{A.current&&A.current.contains(ee.target)||(ee.preventDefault(),Q.current=[])};p.useEffect(()=>(x&&(document.addEventListener("dragover",Dw,!1),document.addEventListener("drop",re,!1)),()=>{x&&(document.removeEventListener("dragover",Dw),document.removeEventListener("drop",re))}),[A,x]),p.useEffect(()=>(!n&&v&&A.current&&A.current.focus(),()=>{}),[A,v,n]);const Ce=p.useCallback(ee=>{T?T(ee):console.error(ee)},[T]),Re=p.useCallback(ee=>{ee.preventDefault(),ee.persist(),Yn(ee),Q.current=[...Q.current,ee.target],du(ee)&&Promise.resolve(r(ee)).then(be=>{if(Ed(ee)&&!j)return;const rt=be.length,Ze=rt>0&&RV({files:be,accept:R,minSize:i,maxSize:o,multiple:s,maxFiles:l,validator:P}),Dt=rt>0&&!Ze;F({isDragAccept:Ze,isDragReject:Dt,isDragActive:!0,type:"setDraggedFiles"}),c&&c(ee)}).catch(be=>Ce(be))},[r,c,Ce,j,R,i,o,s,l,P]),Oe=p.useCallback(ee=>{ee.preventDefault(),ee.persist(),Yn(ee);const be=du(ee);if(be&&ee.dataTransfer)try{ee.dataTransfer.dropEffect="copy"}catch{}return be&&d&&d(ee),!1},[d,j]),ve=p.useCallback(ee=>{ee.preventDefault(),ee.persist(),Yn(ee);const be=Q.current.filter(Ze=>A.current&&A.current.contains(Ze)),rt=be.indexOf(ee.target);rt!==-1&&be.splice(rt,1),Q.current=be,!(be.length>0)&&(F({type:"setDraggedFiles",isDragActive:!1,isDragAccept:!1,isDragReject:!1}),du(ee)&&u&&u(ee))},[A,u,j]),Ve=p.useCallback((ee,be)=>{const rt=[],Ze=[];ee.forEach(Dt=>{const[Mr,Xn]=KP(Dt,R),[Ti,Cn]=YP(Dt,i,o),Lr=P?P(Dt):null;if(Mr&&Ti&&!Lr)rt.push(Dt);else{let gr=[Xn,Cn];Lr&&(gr=gr.concat(Lr)),Ze.push({file:Dt,errors:gr.filter(No=>No)})}}),(!s&&rt.length>1||s&&l>=1&&rt.length>l)&&(rt.forEach(Dt=>{Ze.push({file:Dt,errors:[kV]})}),rt.splice(0)),F({acceptedFiles:rt,fileRejections:Ze,type:"setFiles"}),f&&f(rt,Ze,be),Ze.length>0&&m&&m(Ze,be),rt.length>0&&h&&h(rt,be)},[F,s,R,i,o,l,f,h,m,P]),Je=p.useCallback(ee=>{ee.preventDefault(),ee.persist(),Yn(ee),Q.current=[],du(ee)&&Promise.resolve(r(ee)).then(be=>{Ed(ee)&&!j||Ve(be,ee)}).catch(be=>Ce(be)),F({type:"reset"})},[r,Ve,Ce,j]),at=p.useCallback(()=>{if(z.current){F({type:"openDialog"}),O();const ee={multiple:s,types:I};window.showOpenFilePicker(ee).then(be=>r(be)).then(be=>{Ve(be,null),F({type:"closeDialog"})}).catch(be=>{MV(be)?(D(be),F({type:"closeDialog"})):LV(be)?(z.current=!1,M.current?(M.current.value=null,M.current.click()):Ce(new Error("Cannot open the file picker because the https://developer.mozilla.org/en-US/docs/Web/API/File_System_Access_API is not supported and no <input> was provided."))):Ce(be)});return}M.current&&(F({type:"openDialog"}),O(),M.current.value=null,M.current.click())},[F,O,D,C,Ve,Ce,I,s]),Ft=p.useCallback(ee=>{!A.current||!A.current.isEqualNode(ee.target)||(ee.key===" "||ee.key==="Enter"||ee.keyCode===32||ee.keyCode===13)&&(ee.preventDefault(),at())},[A,at]),pe=p.useCallback(()=>{F({type:"focus"})},[]),Fe=p.useCallback(()=>{F({type:"blur"})},[]),Ne=p.useCallback(()=>{w||(_V()?setTimeout(at,0):at())},[w,at]),tt=ee=>n?null:ee,nt=ee=>S?null:tt(ee),Fn=ee=>E?null:tt(ee),Yn=ee=>{j&&ee.stopPropagation()},Ao=p.useMemo(()=>(ee={})=>{var be=ee,{refKey:rt="ref",role:Ze,onKeyDown:Dt,onFocus:Mr,onBlur:Xn,onClick:Ti,onDragEnter:Cn,onDragOver:Lr,onDragLeave:gr,onDrop:No}=be,za=Pd(be,["refKey","role","onKeyDown","onFocus","onBlur","onClick","onDragEnter","onDragOver","onDragLeave","onDrop"]);return fn(fn({onKeyDown:nt(Br(Dt,Ft)),onFocus:nt(Br(Mr,pe)),onBlur:nt(Br(Xn,Fe)),onClick:tt(Br(Ti,Ne)),onDragEnter:Fn(Br(Cn,Re)),onDragOver:Fn(Br(Lr,Oe)),onDragLeave:Fn(Br(gr,ve)),onDrop:Fn(Br(No,Je)),role:typeof Ze=="string"&&Ze!==""?Ze:"presentation",[rt]:A},!n&&!S?{tabIndex:0}:{}),za)},[A,Ft,pe,Fe,Ne,Re,Oe,ve,Je,S,E,n]),Wt=p.useCallback(ee=>{ee.stopPropagation()},[]),no=p.useMemo(()=>(ee={})=>{var be=ee,{refKey:rt="ref",onChange:Ze,onClick:Dt}=be,Mr=Pd(be,["refKey","onChange","onClick"]);const Xn={accept:R,multiple:s,type:"file",style:{display:"none"},onChange:tt(Br(Ze,Je)),onClick:tt(Br(Dt,Wt)),tabIndex:-1,[rt]:M};return fn(fn({},Xn),Mr)},[M,t,s,Je,n]);return Wo(fn({},B),{isFocused:_&&!n,getRootProps:Ao,getInputProps:no,rootRef:A,inputRef:M,open:tt(at)})}function BV(e,t){switch(t.type){case"focus":return Wo(fn({},e),{isFocused:!0});case"blur":return Wo(fn({},e),{isFocused:!1});case"openDialog":return Wo(fn({},Pm),{isFileDialogActive:!0});case"closeDialog":return Wo(fn({},e),{isFileDialogActive:!1});case"setDraggedFiles":return Wo(fn({},e),{isDragActive:t.isDragActive,isDragAccept:t.isDragAccept,isDragReject:t.isDragReject});case"setFiles":return Wo(fn({},e),{acceptedFiles:t.acceptedFiles,fileRejections:t.fileRejections});case"reset":return fn({},Pm);default:return e}}function _w(){}const[UV,VV]=wn("Dropzone component was not found in tree");function Zv(e){const t=n=>{const{children:r,...o}=V(`Dropzone${h0(e)}`,{},n),i=VV(),s=Co(r)?r:b.createElement("span",null,r);return i[e]?p.cloneElement(s,o):null};return t.displayName=`@mantine/dropzone/${h0(e)}`,t}const HV=Zv("accept"),WV=Zv("reject"),qV=Zv("idle");var Jl={root:"m-d46a4834",inner:"m-b85f7144",fullScreen:"m-96f6e9ad",dropzone:"m-7946116d"};const GV={loading:!1,multiple:!0,maxSize:1/0,autoFocus:!1,activateOnClick:!0,activateOnDrag:!0,dragEventsBubbling:!0,activateOnKeyboard:!0,useFsAccessApi:!0,variant:"light",rejectColor:"red"},QV=(e,{radius:t,variant:n,acceptColor:r,rejectColor:o})=>{const i=e.variantColorResolver({color:r||e.primaryColor,theme:e,variant:n}),s=e.variantColorResolver({color:o||"red",theme:e,variant:n});return{root:{"--dropzone-radius":gt(t),"--dropzone-accept-color":i.color,"--dropzone-accept-bg":i.background,"--dropzone-reject-color":s.color,"--dropzone-reject-bg":s.background}}},ji=G((e,t)=>{const n=V("Dropzone",GV,e),{classNames:r,className:o,style:i,styles:s,unstyled:l,vars:c,radius:u,disabled:d,loading:f,multiple:h,maxSize:m,accept:g,children:y,onDropAny:C,onDrop:v,onReject:x,openRef:w,name:S,maxFiles:E,autoFocus:j,activateOnClick:T,activateOnDrag:P,dragEventsBubbling:R,activateOnKeyboard:I,onDragEnter:O,onDragLeave:D,onDragOver:A,onFileDialogCancel:M,onFileDialogOpen:B,preventDropOnDocument:F,useFsAccessApi:_,getFilesFromEvent:k,validator:z,rejectColor:q,acceptColor:Q,enablePointerEvents:re,loaderProps:Ce,...Re}=n,Oe=ue({name:"Dropzone",classes:Jl,props:n,className:o,style:i,classNames:r,styles:s,unstyled:l,vars:c,varsResolver:QV}),{getRootProps:ve,getInputProps:Ve,isDragAccept:Je,isDragReject:at,open:Ft}=nk({onDrop:C,onDropAccepted:v,onDropRejected:x,disabled:d||f,accept:Array.isArray(g)?g.reduce((Fe,Ne)=>({...Fe,[Ne]:[]}),{}):g,multiple:h,maxSize:m,maxFiles:E,autoFocus:j,noClick:!T,noDrag:!P,noDragEventsBubbling:!R,noKeyboard:!I,onDragEnter:O,onDragLeave:D,onDragOver:A,onFileDialogCancel:M,onFileDialogOpen:B,preventDropOnDocument:F,useFsAccessApi:_,validator:z,...k?{getFilesFromEvent:k}:null});zm(w,Ft);const pe=!Je&&!at;return b.createElement(UV,{value:{accept:Je,reject:at,idle:pe}},b.createElement(W,{...ve({ref:t}),...Oe("root",{focusable:!0}),...Re,mod:{accept:Je,reject:at,idle:pe,loading:f,"activate-on-click":T}},b.createElement(Ry,{visible:f,overlayProps:{radius:u},unstyled:l,loaderProps:Ce}),b.createElement("input",{...Ve(),name:S}),b.createElement("div",{...Oe("inner"),"data-enable-pointer-events":re||void 0},y)))});ji.classes=Jl;ji.displayName="@mantine/dropzone/Dropzone";ji.Accept=HV;ji.Idle=qV;ji.Reject=WV;const KV={loading:!1,maxSize:1/0,activateOnClick:!1,activateOnDrag:!0,dragEventsBubbling:!0,activateOnKeyboard:!0,active:!0,zIndex:_r("max"),withinPortal:!0},e0=G((e,t)=>{const n=V("DropzoneFullScreen",KV,e),{classNames:r,className:o,style:i,styles:s,unstyled:l,vars:c,active:u,onDrop:d,onReject:f,zIndex:h,withinPortal:m,portalProps:g,...y}=n,C=ue({name:"DropzoneFullScreen",classes:Jl,props:n,className:o,style:i,classNames:r,styles:s,unstyled:l,rootSelector:"fullScreen"}),{resolvedClassNames:v,resolvedStyles:x}=Nd({classNames:r,styles:s,props:n}),[w,S]=p.useState(0),[E,{open:j,close:T}]=H2(!1),P=I=>{var O;(O=I.dataTransfer)!=null&&O.types.includes("Files")&&(S(D=>D+1),j())},R=()=>{S(I=>I-1)};return p.useEffect(()=>{w===0&&T()},[w]),p.useEffect(()=>{if(u)return document.addEventListener("dragenter",P,!1),document.addEventListener("dragleave",R,!1),()=>{document.removeEventListener("dragenter",P,!1),document.removeEventListener("dragleave",R,!1)}},[u]),b.createElement(as,{...g,withinPortal:m},b.createElement(W,{...C("fullScreen",{style:{opacity:E?1:0,pointerEvents:E?"all":"none",zIndex:h}}),ref:t},b.createElement(ji,{...y,classNames:v,styles:x,unstyled:l,className:Jl.dropzone,onDrop:I=>{d==null||d(I),T(),S(0)},onReject:I=>{f==null||f(I),T(),S(0)}})))});e0.classes=Jl;e0.displayName="@mantine/dropzone/DropzoneFullScreen";ji.FullScreen=e0;const fu=ji,YV='{"resourceType": "Bundle"}';function Jh({id:e,title:t,message:n,color:r,icon:o,withCloseButton:i=!1,method:s="show",loading:l}){Kr[s]({id:e,loading:l,title:t,message:n,color:r,icon:o,withCloseButton:i,autoClose:!1})}function XV(){const e=Nt(),t=te(),[n,r]=p.useState({}),o=p.useCallback(async(l,c)=>{const u="batch-upload";Jh({id:u,title:"Batch Upload in Progress",message:"Your batch data is being uploaded. This may take a moment...",method:"show",loading:!0});try{r({});let d=JSON.parse(l);d.type!=="batch"&&d.type!=="transaction"&&(d=oT(d));const f=await t.executeBatch(d);r(h=>({...h,[c]:f})),Jh({id:u,title:"Batch Upload Successful",message:"Your batch data was successfully uploaded.",color:"green",method:"update",icon:a.jsx(Nf,{size:"1rem"}),withCloseButton:!0})}catch(d){Jh({id:u,title:"Batch Upload Failed",color:"red",message:Pe(d),method:"update",icon:a.jsx(xd,{size:"1rem"}),withCloseButton:!0})}},[t]),i=p.useCallback(async l=>{for(const c of l){const u=new FileReader;u.onload=d=>{var f;return o((f=d.target)==null?void 0:f.result,c.name)},u.readAsText(c)}},[o]),s=p.useCallback(async l=>{await o(l.input,"JSON Data")},[o]);return a.jsxs(we,{children:[a.jsx(ae,{children:"Batch Create"}),a.jsxs("p",{children:["Use this page to create, read, or update multiple resources. For more details, see ",a.jsx("a",{href:"https://www.hl7.org/fhir/http.html#transaction",children:"FHIR Batch and Transaction"}),"."]}),Object.keys(n).length===0&&a.jsxs(a.Fragment,{children:[a.jsx("h3",{children:"Input"}),a.jsxs(We,{defaultValue:"upload",children:[a.jsxs(We.List,{children:[a.jsx(We.Tab,{value:"upload",children:"File Upload"}),a.jsx(We.Tab,{value:"json",children:"JSON"})]}),a.jsx(We.Panel,{value:"upload",pt:"xs",children:a.jsx(fu,{onDrop:i,accept:["application/json"],children:a.jsxs(Y,{justify:"center",gap:"xl",style:{minHeight:220,pointerEvents:"none"},children:[a.jsx(fu.Accept,{children:a.jsx(F1,{size:50,stroke:1.5,color:e.colors[e.primaryColor][5]})}),a.jsx(fu.Reject,{children:a.jsx(xd,{size:50,stroke:1.5,color:e.colors.red[5]})}),a.jsx(fu.Idle,{children:a.jsx(F1,{size:50,stroke:1.5})}),a.jsxs("div",{children:[a.jsx(le,{size:"xl",inline:!0,children:"Drag files here or click to select files"}),a.jsx(le,{size:"sm",color:"dimmed",inline:!0,mt:7,children:"Attach as many files as you like"})]})]})})}),a.jsx(We.Panel,{value:"json",pt:"xs",children:a.jsxs(Be,{onSubmit:s,children:[a.jsx(fs,{"data-testid":"batch-input",name:"input",autosize:!0,minRows:20,defaultValue:YV,deserialize:JSON.parse}),a.jsx(Y,{justify:"flex-end",mt:"xl",wrap:"nowrap",children:a.jsx(Z,{type:"submit",children:"Submit"})})]})})]})]}),Object.keys(n).length>0&&a.jsxs(a.Fragment,{children:[a.jsx("h3",{children:"Output"}),a.jsxs(We,{defaultValue:Object.keys(n)[0],children:[a.jsx(We.List,{children:Object.keys(n).map(l=>a.jsx(We.Tab,{value:l,children:l},l))}),Object.keys(n).map(l=>a.jsx(We.Panel,{value:l,children:a.jsx("pre",{style:{border:"1px solid #888"},children:JSON.stringify(n[l],void 0,2)})},l))]}),a.jsx(Y,{justify:"flex-end",mt:"xl",wrap:"nowrap",children:a.jsx(Z,{onClick:()=>r({}),children:"Start over"})})]})]})}function JV(){const{resourceType:e}=Xe(),n=(Object.fromEntries(new URLSearchParams(location.search).entries()).ids||"").split(",").filter(o=>!!o),[r]=xa("Questionnaire",`subject-type=${e}`);return r?r.length===0?a.jsxs(we,{children:[a.jsxs(ae,{children:["No apps for ",e]}),a.jsx(Ae,{to:`/${e}`,children:"Return to search page"})]}):a.jsx(we,{children:a.jsx("div",{children:r.map(o=>a.jsxs("div",{children:[a.jsx("h3",{children:a.jsx(Ae,{to:`/forms/${o.id}?subject=`+n.map(i=>`${e}/${i}`).join(","),children:o.name})}),a.jsx("p",{children:o.description})]},o.id))})}):a.jsx(Ir,{})}function ZV(){const e=te(),[t,n]=p.useState(),[r,o]=p.useState(!1);return a.jsx(we,{width:450,children:a.jsxs(Be,{style:{maxWidth:400},onSubmit:i=>{n(void 0),e.post("auth/changepassword",i).then(()=>o(!0)).catch(s=>n(ut(s)))},children:[a.jsxs(Ut,{style:{flexDirection:"column"},children:[a.jsx(Or,{size:32}),a.jsx(ae,{children:"Change password"})]}),!r&&a.jsxs(Se,{gap:"xl",mt:"xl",children:[a.jsx(Pr,{name:"oldPassword",label:"Old password",required:!0,autoFocus:!0,error:Le(t,"oldPassword")}),a.jsx(Pr,{name:"newPassword",label:"New password",required:!0,error:Le(t,"newPassword")}),a.jsx(Pr,{name:"confirmPassword",label:"Confirm new password",required:!0,error:Le(t,"confirmPassword")}),a.jsx(Y,{justify:"flex-end",mt:"xl",wrap:"nowrap",children:a.jsx(Z,{type:"submit",children:"Change password"})})]}),r&&a.jsx("div",{"data-testid":"success",children:"Password changed successfully"})]})})}const rk=["Form","JSON"],Zh=rk[0].toLowerCase();function eH(){const e=Rt(),{resourceType:t}=Xe(),n=window.location.pathname.split("/").pop(),[r,o]=p.useState(n??Zh);function i(s){s||(s=Zh),o(s),e(`/${t}/new/${s}`)}return a.jsxs(a.Fragment,{children:[a.jsxs(_n,{children:[a.jsxs(le,{p:"md",fw:500,children:["New ",t]}),a.jsx(fr,{children:a.jsx(We,{defaultValue:Zh,value:r,onChange:i,children:a.jsx(We.List,{style:{whiteSpace:"nowrap",flexWrap:"nowrap"},children:rk.map(s=>a.jsx(We.Tab,{value:s.toLowerCase(),px:"md",children:s},s))})})})]}),a.jsx(Yv,{})]})}function tH(){return a.jsx(we,{children:a.jsxs(Se,{children:[a.jsx(ae,{order:1,children:"Unexpected Error"}),a.jsx(le,{children:"We're sorry, something went wrong."}),a.jsxs(le,{children:["Please contact ",a.jsx(Ue,{href:"mailto:support@medplum.com",children:"support"})," for assistance."]})]})})}const nH="_root_1fbwr_1",rH="_entry_1fbwr_8",oH="_key_1fbwr_13",iH="_value_1fbwr_20",Qf={root:nH,entry:rH,key:oH,value:iH};function Te(e){return a.jsx(fr,{children:a.jsx("div",{className:Qf.root,children:e.children})})}Te.Entry=function(t){return a.jsx("div",{className:Qf.entry,children:t.children})};Te.Key=function(t){return a.jsx("div",{className:Qf.key,children:t.children})};Te.Value=function(t){return a.jsx("div",{className:Qf.value,children:t.children})};function sH(e){if(e.gender==="male")return"blue";if(e.gender==="female")return"pink"}function ok(e){var n,r;const t=st(e.patient);return t?a.jsxs(Te,{children:[a.jsx(mi,{value:t,size:"lg",color:sH(t)}),a.jsxs(Te.Entry,{children:[a.jsx(Te.Key,{children:"Name"}),a.jsx(Te.Value,{children:a.jsx(Ae,{to:t,fw:500,children:t.name?a.jsx(Cv,{value:t.name[0],options:{use:!1}}):"[blank]"})})]}),t.birthDate&&a.jsxs(a.Fragment,{children:[a.jsxs(Te.Entry,{children:[a.jsx(Te.Key,{children:"DoB"}),a.jsx(Te.Value,{children:t.birthDate})]}),a.jsxs(Te.Entry,{children:[a.jsx(Te.Key,{children:"Age"}),a.jsx(Te.Value,{children:Z5(t.birthDate)})]})]}),t.gender&&a.jsxs(Te.Entry,{children:[a.jsx(Te.Key,{children:"Gender"}),a.jsx(Te.Value,{children:t.gender})]}),t.address&&a.jsxs(Te.Entry,{children:[a.jsx(Te.Key,{children:"State"}),a.jsx(Te.Value,{children:(n=t.address[0])==null?void 0:n.state})]}),(r=t.identifier)==null?void 0:r.map(o=>a.jsxs(Te.Entry,{children:[a.jsx(Te.Key,{children:o==null?void 0:o.system}),a.jsx(Te.Value,{children:o==null?void 0:o.value})]},`${o==null?void 0:o.system}-${o==null?void 0:o.value}`))]}):null}function ik(e){const t=st(e.resource);if(!t)return null;const n=[{key:"Type",value:a.jsx(Ae,{to:`/${t.resourceType}`,children:t.resourceType})}];function r(l,c){l&&c&&n.push({key:l,value:c})}function o(l){l&&r(l.system,l.value)}function i(l,c){Array.isArray(c)?c.forEach(u=>i(l,u)):typeof c=="string"?r(l,c):c&&(Array.isArray(c.coding)?r(l,c.coding.map(u=>u.display||u.code).join(", ")):r(l,c.text))}const s=xo(t);return s!==ht(t)&&r("Name",s),"category"in t&&i("Category",t.category),t.resourceType!=="Bot"&&"code"in t&&i("Code",t.code),"identifier"in t&&(Array.isArray(t.identifier)?t.identifier.forEach(o):o(t.identifier)),n.length===1&&n.push({key:"ID",value:t.id}),a.jsx(Te,{children:n.map(l=>a.jsxs(Te.Entry,{children:[a.jsx(Te.Key,{children:l.key}),a.jsx(Te.Value,{children:l.value})]},`${l.key}-${l.value}`))})}function t0(e){if(e.resourceType==="Patient")return e;if(e.resourceType==="DiagnosticReport"||e.resourceType==="Encounter"||e.resourceType==="Observation"||e.resourceType==="ServiceRequest")return e.subject}function aH(e){var t;if(e.resourceType==="Specimen")return e;if(e.resourceType==="Observation")return e.specimen;if(e.resourceType==="DiagnosticReport"||e.resourceType==="ServiceRequest")return(t=e.specimen)==null?void 0:t[0]}function Au(e,t){return new Promise((n,r)=>{var i;const o=new MessageChannel;o.port1.onmessage=({data:s})=>{o.port1.close(),s.error?r(s.error):n(s.result)},(i=e.contentWindow)==null||i.postMessage(t,"https://codeeditor.medplum.com",[o.port2])})}function Ei(e){var t;return tv((t=e.getActiveLogin())==null?void 0:t.project)}function lH(e,t){const n=new Blob([e],{type:Gt.JSON}),r=URL.createObjectURL(n),o=document.createElement("a");o.href=r;const i=t??new Date().toISOString().replace(/\D/g,"");o.download=`${i}.json`,document.body.appendChild(o),o.click(),URL.revokeObjectURL(r)}function cH(){const{id:e}=Xe(),t=Ci(),r=Object.fromEntries(new URLSearchParams(t.search).entries()).subject,o=te(),[i,s]=p.useState(!0),[l,c]=p.useState(),[u,d]=p.useState(),[f,h]=p.useState(),[m,g]=p.useState(),[y,C]=p.useState();if(p.useEffect(()=>{const w={resourceType:"Bundle",type:"batch",entry:[{request:{method:"GET",url:`Questionnaire/${e}`}}]};if(r){const S=r.split(",").filter(E=>!!E);S.length===1&&w.entry.push({request:{method:"GET",url:S[0]}}),d(S)}o.executeBatch(w).then(S=>{var E,j,T,P,R,I,O,D;((T=(j=(E=S.entry)==null?void 0:E[0])==null?void 0:j.response)==null?void 0:T.status)!=="200"?g((I=(R=(P=S.entry)==null?void 0:P[0])==null?void 0:R.response)==null?void 0:I.outcome):(c((O=S.entry[0])==null?void 0:O.resource),h((D=S.entry[1])==null?void 0:D.resource)),s(!1)}).catch(S=>{g(S),s(!1)})},[o,e,r]),m)return a.jsx(we,{children:a.jsx("pre",{"data-testid":"error",children:JSON.stringify(m,void 0,2)})});if(y)return a.jsxs(we,{children:[a.jsx(ae,{children:l==null?void 0:l.title}),a.jsx("p",{children:"Your response has been recorded."}),a.jsxs("ul",{children:[y.length===1&&a.jsx("li",{children:a.jsx(Ae,{to:y[0],children:"Review your answers"})}),y.length>1&&a.jsxs("li",{children:["Review your answers:",a.jsx("ul",{children:y.map(w=>a.jsx("li",{children:a.jsx(Ae,{to:w,children:ht(w)})},w.id))})]}),f&&a.jsx("li",{children:a.jsxs(Ae,{to:f,children:["Back to ",xo(f)]})}),a.jsx("li",{children:a.jsx(Ae,{to:"/",children:"Go back home"})})]})]});if(i||!l)return a.jsx(Ir,{});const v=f&&t0(f);return a.jsxs(a.Fragment,{children:[a.jsxs(_n,{shadow:"xs",radius:0,children:[v&&a.jsx(ok,{patient:v}),f&&f.resourceType!=="Patient"&&a.jsx(ik,{resource:f}),a.jsx(W,{px:"xl",py:"md",children:a.jsxs(le,{children:[xo(l),u&&u.length>1&&a.jsxs(a.Fragment,{children:[" (for ",u.length," resources)"]})]})})]}),a.jsx(we,{children:a.jsx(vP,{questionnaire:l,subject:f&&xt(f),onSubmit:x})})]});async function x(w){const S=[];if(!u||u.length===0)S.push(await o.createResource(w));else for(const E of u)S.push(await o.createResource({...w,subject:{reference:E}}));C(S)}}const uH="_paper_unw9o_1",dH={paper:uH},fH={Bot:"/admin/bots/new",ClientApplication:"/admin/clients/new"};function sk(e,t){const n=e.resourceType||hH(t),r=e.fields??pH(n),o=e.filters??(e.resourceType?void 0:mH(n)),i=e.sortRules??gH(n),s=e.offset??0,l=e.count??bc;return{...e,resourceType:n,fields:r,filters:o,sortRules:i,offset:s,count:l}}function hH(e){var t,n;return localStorage.getItem("defaultResourceType")??((n=(t=e==null?void 0:e.option)==null?void 0:t.find(r=>r.id==="defaultResourceType"))==null?void 0:n.valueString)??"Patient"}function pH(e){const t=n0(e);if(t!=null&&t.fields)return t.fields;const n=["id","_lastUpdated"];switch(e){case"Patient":n.push("name","birthDate","gender");break;case"AccessPolicy":case"Bot":case"ClientApplication":case"Practitioner":case"Project":case"Organization":case"Questionnaire":case"UserConfiguration":n.push("name");break;case"CodeSystem":case"ValueSet":n.push("name","title","status");break;case"Condition":n.push("subject","code","clinicalStatus");break;case"Device":n.push("manufacturer","deviceName","patient");break;case"DeviceDefinition":n.push("manufacturer[x]","deviceName");break;case"DeviceRequest":n.push("code[x]","subject");break;case"DiagnosticReport":case"Observation":n.push("subject","code","status");break;case"Encounter":n.push("subject");break;case"ServiceRequest":n.push("subject","code","status","orderDetail");break;case"Subscription":n.push("criteria");break;case"User":n.push("email");break}return n}function mH(e){var t;return(t=n0(e))==null?void 0:t.filters}function gH(e){const t=n0(e);return t!=null&&t.sortRules?t.sortRules:[{code:"_lastUpdated",descending:!0}]}function n0(e){const t=localStorage.getItem(e+"-defaultSearch");return t?JSON.parse(t):void 0}function yH(e){localStorage.setItem("defaultResourceType",e.resourceType),localStorage.setItem(e.resourceType+"-defaultSearch",JSON.stringify(e))}async function vH(e,t){const n={resourceType:e.resourceType,count:1e3,offset:0,filters:e.filters},r=sk(n,t.getUserConfiguration()),o=await t.search(r.resourceType,Hs({...r,total:"accurate",fields:void 0}));return oT(o)}function Aw(){const e=te(),t=Rt(),n=Ci(),[r,o]=p.useState();return p.useEffect(()=>{const i=fL(n.pathname+n.search),s=sk(i,e.getUserConfiguration());n.pathname===`/${s.resourceType}`&&n.search===Hs(s)?(yH(s),o(s)):t(`/${s.resourceType}${Hs(s)}`)},[e,t,n]),!(r!=null&&r.resourceType)||!r.fields||r.fields.length===0?a.jsx(Ir,{}):a.jsx(_n,{shadow:"xs",m:"md",p:"xs",className:dH.paper,children:a.jsx(kc,{checkboxesEnabled:!0,search:r,userConfig:e.getUserConfiguration(),onClick:i=>t(`/${i.resource.resourceType}/${i.resource.id}`),onAuxClick:i=>window.open(`/${i.resource.resourceType}/${i.resource.id}`,"_blank"),onChange:i=>{t(`/${r.resourceType}${Hs(i.definition)}`)},onNew:()=>{t(fH[r.resourceType]??`/${r.resourceType}/new`)},onExportCsv:()=>{const i=e.fhirUrl(r.resourceType,"$csv")+Hs(r);e.download(i).then(s=>{window.open(window.URL.createObjectURL(s),"_blank")}).catch(s=>ce({color:"red",message:Pe(s),autoClose:!1}))},onExportTransactionBundle:async()=>{vH(r,e).then(i=>lH(JSON.stringify(i,void 0,2))).catch(i=>ce({color:"red",message:Pe(i),autoClose:!1}))},onDelete:i=>{window.confirm("Are you sure you want to delete these resources?")&&(e.invalidateSearches(r.resourceType),e.executeBatch({resourceType:"Bundle",type:"batch",entry:i.map(s=>({request:{method:"DELETE",url:`${r.resourceType}/${s}`}}))}).then(()=>o({...r})).catch(s=>ce({color:"red",message:Pe(s),autoClose:!1})))},onBulk:i=>{t(`/bulk/${r.resourceType}?ids=${i.join(",")}`)}})})}function xH(){const e=te(),[t,n]=p.useState(),[r,o]=p.useState(void 0);p.useEffect(()=>{e.get("auth/mfa/status").then(l=>{const c=new URL("https://chart.googleapis.com/chart");c.searchParams.set("chs","300x300"),c.searchParams.set("cht","qr"),c.searchParams.set("chl",l.enrollUri),c.searchParams.set("choe","UTF-8"),n(c.toString()),o(l.enrolled)}).catch(l=>ce({color:"red",message:Pe(l),autoClose:!1}))},[e]);const i=p.useCallback(l=>{e.post("auth/mfa/enroll",l).then(()=>{o(!0),ce({color:"green",message:"Success"})}).catch(c=>ce({color:"red",message:Pe(c),autoClose:!1}))},[e]),s=p.useCallback(()=>{e.post("auth/mfa/disable",{}).catch(console.log)},[e]);return r===void 0?null:r?a.jsx(we,{children:a.jsxs(Y,{children:[a.jsx(ae,{children:"MFA is enabled"}),a.jsx(Z,{onClick:s,children:"Disable MFA"})]})}):a.jsx(we,{width:400,children:a.jsxs(Be,{onSubmit:i,children:[a.jsx(ae,{children:"Multi Factor Auth Setup"}),a.jsx(Ut,{children:a.jsx("img",{src:t})}),a.jsx(ie,{name:"token",label:"Code"}),a.jsx(Y,{justify:"flex-end",mt:"xl",children:a.jsx(Z,{type:"submit",children:"Enroll"})})]})})}const km={baseUrl:"__MEDPLUM_BASE_URL__",clientId:"__MEDPLUM_CLIENT_ID__",googleClientId:"__GOOGLE_CLIENT_ID__",recaptchaSiteKey:"__RECAPTCHA_SITE_KEY__",registerEnabled:"__MEDPLUM_REGISTER_ENABLED__"};function _c(){return km}function ak(){try{return km.registerEnabled!==!1&&km.registerEnabled!=="false"}catch{return!0}}function wH(){const e=Rt(),[t]=Xv(),n=t.get("client_id");if(!n)return null;const r=t.get("scope")||"openid";function o(i){const s=new URL(t.get("redirect_uri"));for(const l of["scope","state","nonce"])t.has(l)&&s.searchParams.set(l,t.get(l));s.searchParams.set("code",i),window.location.assign(s.toString())}return a.jsxs(PP,{onCode:o,onForgotPassword:()=>e("/resetpassword"),onRegister:()=>e("/register"),googleClientId:_c().googleClientId,clientId:n||void 0,scope:r,nonce:t.get("nonce")||void 0,launch:t.get("launch")||void 0,codeChallenge:t.get("code_challenge")||void 0,codeChallengeMethod:t.get("code_challenge_method")||void 0,chooseScopes:r!=="openid",children:[a.jsx(Or,{size:32}),a.jsx(ae,{children:"Sign in to Medplum"})]})}function SH(){const e=te(),t=Rt(),n=_c();return p.useEffect(()=>{e.getProfile()&&t("/signin?project=new")},[e,t]),ak()?a.jsxs(RB,{type:"project",onSuccess:()=>t("/"),googleClientId:n.googleClientId,recaptchaSiteKey:n.recaptchaSiteKey,children:[a.jsx(Or,{size:32}),a.jsx(ae,{children:"Create a new account"})]}):a.jsx(we,{width:450,children:a.jsx(us,{icon:a.jsx(Cc,{size:16}),title:"New projects disabled",color:"red",children:"New projects are disabled on this server."})})}function bH(){const e=Rt(),t=te(),[n,r]=p.useState(),[o,i]=p.useState(!1),s=_c().recaptchaSiteKey;return p.useEffect(()=>{EP(s)},[s]),a.jsx(we,{width:450,children:a.jsxs(Be,{style:{maxWidth:400},onSubmit:async l=>{let c="";c=await TP(s),t.post("auth/resetpassword",{...l,recaptchaToken:c}).then(()=>i(!0)).catch(u=>r(ut(u)))},children:[a.jsxs(Se,{gap:"lg",mb:"xl",align:"center",children:[a.jsx(Or,{size:32}),a.jsx(ae,{children:"Medplum Password Reset"})]}),a.jsxs(Se,{gap:"xl",children:[a.jsx(to,{issues:$f(n,void 0)}),!o&&a.jsxs(a.Fragment,{children:[a.jsx(ie,{name:"email",type:"email",label:"Email",required:!0,autoFocus:!0,error:Le(n,"email")}),a.jsxs(Y,{justify:"space-between",mt:"xl",wrap:"nowrap",children:[a.jsx(Ue,{component:"button",type:"button",color:"dimmed",onClick:()=>e("/register"),size:"xs",children:"Register"}),a.jsx(Z,{type:"submit",children:"Reset password"})]})]}),o&&a.jsx("div",{children:"If the account exists on our system, a password reset email will be sent."})]})]})})}function CH(){var i;const e=Rt(),t=te(),[n,r]=p.useState();p.useEffect(()=>{t.get("auth/me").then(r).catch(s=>ce({color:"red",message:Pe(s),autoClose:!1}))},[t]);function o(s){t.post("auth/revoke",{loginId:s}).then(()=>t.get("auth/me",{cache:"no-cache"})).then(r).then(()=>ce({color:"green",message:"Login revoked"})).catch(l=>ce({color:"red",message:Pe(l),autoClose:!1}))}return n?a.jsxs(a.Fragment,{children:[a.jsxs(we,{children:[a.jsx(ae,{children:"Security"}),a.jsxs(kv,{children:[a.jsx(ta,{term:"ID",children:a.jsx(Ue,{href:`/${ht(n.profile)}`,children:n.profile.id})}),a.jsx(ta,{term:"Resource Type",children:n.profile.resourceType}),a.jsx(ta,{term:"Name",children:Sc((i=n.profile.name)==null?void 0:i[0])})]})]}),a.jsxs(we,{children:[a.jsx(ae,{children:"Sessions"}),a.jsxs(he,{children:[a.jsx("thead",{children:a.jsxs("tr",{children:[a.jsx("th",{children:"OS"}),a.jsx("th",{children:"Browser"}),a.jsx("th",{children:"IP Address"}),a.jsx("th",{children:"Auth Method"}),a.jsx("th",{children:"Last Updated"}),a.jsx("th",{})]})}),a.jsx("tbody",{children:n.security.sessions.map(s=>a.jsxs("tr",{children:[a.jsx("td",{children:s.os}),a.jsx("td",{children:s.browser}),a.jsx("td",{children:s.remoteAddress}),a.jsx("td",{children:s.authMethod}),a.jsx("td",{children:Mn(s.lastUpdated)}),a.jsx("td",{children:a.jsx(Ue,{href:"#",onClick:()=>o(s.id),children:"Revoke"})})]},s.id))})]})]}),a.jsxs(we,{children:[a.jsx(ae,{children:"Password"}),a.jsx(Z,{onClick:()=>e("/changepassword"),children:"Change password"})]}),a.jsxs(we,{children:[a.jsx(ae,{children:"Multi Factor Auth"}),a.jsxs("p",{children:["Enrolled: ",n.security.mfaEnrolled.toString()]}),!n.security.mfaEnrolled&&a.jsx(Z,{onClick:()=>e("/mfa"),children:"Enroll"})]})]}):null}function jH(){const{id:e,secret:t}=Xe(),n=te(),[r,o]=p.useState(),[i,s]=p.useState(!1),l=$f(r,void 0);return a.jsxs(we,{width:450,children:[a.jsx(to,{issues:l}),a.jsxs(Be,{style:{maxWidth:400},onSubmit:c=>{if(c.password!==c.confirmPassword){o(li("Passwords do not match","confirmPassword"));return}o(void 0);const u={id:e,secret:t,password:c.password};n.post("auth/setpassword",u).then(()=>s(!0)).catch(d=>o(ut(d)))},children:[a.jsxs(Ut,{style:{flexDirection:"column"},children:[a.jsx(Or,{size:32}),a.jsx(ae,{children:"Set password"})]}),!i&&a.jsxs(Se,{children:[a.jsx(Pr,{name:"password",label:"New password",required:!0,error:Le(r,"password")}),a.jsx(Pr,{name:"confirmPassword",label:"Confirm new password",required:!0,error:Le(r,"confirmPassword")}),a.jsx(Y,{justify:"flex-end",mt:"xl",children:a.jsx(Z,{type:"submit",children:"Set password"})})]}),i&&a.jsxs("div",{"data-testid":"success",children:["Password set. You can now ",a.jsx(Ae,{to:"/signin",children:"sign in"}),"."]})]})]})}function EH(){const e=xv(),t=Rt(),[n]=Xv(),r=_c(),o=p.useCallback(()=>{const i=n.get("next");t(i!=null&&i.startsWith("/")?i:"/")},[n,t]);return p.useEffect(()=>{e&&n.has("next")&&o()},[e,n,o]),a.jsxs(PP,{onSuccess:()=>o(),onForgotPassword:()=>t("/resetpassword"),onRegister:ak()?()=>t("/register"):void 0,googleClientId:r.googleClientId,login:n.get("login")||void 0,projectId:n.get("project")||void 0,children:[a.jsx(Or,{size:32}),a.jsx(ae,{children:"Sign in to Medplum"}),n.get("project")==="new"&&a.jsx("div",{children:"Sign in again to create a new project"})]})}function TH(){const e=Rt(),t=Ci(),[n,r]=p.useState(),[o,i]=p.useState(),[s,l]=p.useState();return p.useEffect(()=>{const c=Object.fromEntries(new URLSearchParams(t.search).entries());r(c.resourceType),i(c.query),l(JSON.parse(c.fields))},[t]),!n||!o||!s?null:a.jsx(NF,{resourceType:n,checkboxesEnabled:!0,query:o,fields:s,onClick:c=>e(`/${n}/${c.resource.id}`),onAuxClick:c=>window.open(`/${n}/${c.resource.id}`,"_blank"),onBulk:c=>{e(`/bulk/${n}?ids=${c.join(",")}`)}})}function Kf(e){const t=te(),n=Ei(t),r=Rt(),[o,i]=p.useState({resourceType:"ProjectMembership",filters:[{code:"project",operator:ne.EQUALS,value:"Project/"+n},{code:"profile-type",operator:ne.EQUALS,value:e.resourceType}],fields:e.fields,count:100});return a.jsx(kc,{search:o,onClick:s=>r(`/admin/members/${s.resource.id}`),onChange:s=>i(s.definition),hideFilters:!0,hideToolbar:!0})}function PH(){return a.jsxs(a.Fragment,{children:[a.jsx(ae,{children:"Bots"}),a.jsx(Kf,{resourceType:"Bot",fields:["user","profile","admin","_lastUpdated"]}),a.jsx(Y,{justify:"flex-end",children:a.jsx(Ae,{to:"/admin/bots/new",children:"Create new bot"})})]})}function kH(){return a.jsxs(a.Fragment,{children:[a.jsx(ae,{children:"Clients"}),a.jsx(Kf,{resourceType:"ClientApplication",fields:["user","profile","admin","_lastUpdated"]}),a.jsx(Y,{justify:"flex-end",children:a.jsx(Ae,{to:"/admin/clients/new",children:"Create new client"})})]})}function Yf(e){return a.jsx(Ma,{resourceType:"AccessPolicy",name:"accessPolicy",defaultValue:e.defaultValue,placeholder:"Access Policy",onChange:t=>{Io(t)?e.onChange(xt(t)):e.onChange(void 0)}})}function RH(){const e=te(),t=Ei(e),[n,r]=p.useState(""),[o,i]=p.useState(""),[s,l]=p.useState(),[c,u]=p.useState(),[d,f]=p.useState(void 0);return a.jsxs(a.Fragment,{children:[a.jsx(ae,{children:"Create new Bot"}),a.jsxs(Be,{onSubmit:()=>{const h={name:n,description:o,accessPolicy:s};e.post("admin/projects/"+t+"/bot",h).then(m=>{e.invalidateSearches("Bot"),e.invalidateSearches("ProjectMembership"),f(m),ce({color:"green",message:"Bot created"})}).catch(m=>{ce({color:"red",message:Pe(m),autoClose:!1}),u(ut(m))})},children:[!d&&a.jsxs(Se,{children:[a.jsx(it,{title:"Name",htmlFor:"name",outcome:c,children:a.jsx(ie,{id:"name",name:"name",required:!0,autoFocus:!0,onChange:h=>r(h.currentTarget.value),error:Le(c,"name")})}),a.jsx(it,{title:"Description",htmlFor:"description",outcome:c,children:a.jsx(ie,{id:"description",name:"description",onChange:h=>i(h.currentTarget.value),error:Le(c,"description")})}),a.jsx(it,{title:"Access Policy",htmlFor:"accessPolicy",outcome:c,children:a.jsx(Yf,{name:"accessPolicy",onChange:l})}),a.jsx(Y,{justify:"flex-end",children:a.jsx(Z,{type:"submit",children:"Create Bot"})})]}),d&&a.jsxs("div",{"data-testid":"success",children:[a.jsx(le,{children:"Bot created"}),a.jsxs(pn,{children:[a.jsx(pn.Item,{children:a.jsx(Ae,{to:d,children:"Go to new bot"})}),a.jsx(pn.Item,{children:a.jsx(Ae,{to:"/admin/bots",children:"Back to bots list"})})]})]})]})]})}function DH(){const e=te(),t=Ei(e),[n,r]=p.useState(""),[o,i]=p.useState(""),[s,l]=p.useState(""),[c,u]=p.useState(),[d,f]=p.useState(),[h,m]=p.useState(void 0);return a.jsxs(a.Fragment,{children:[a.jsx(ae,{children:"Create new Client"}),a.jsxs(Be,{onSubmit:()=>{const g={name:n,description:o,redirectUri:s,accessPolicy:c};e.post("admin/projects/"+t+"/client",g).then(y=>{e.invalidateSearches("ClientApplication"),e.invalidateSearches("ProjectMembership"),m(y),ce({color:"green",message:"Client created"})}).catch(y=>{ce({color:"red",message:Pe(y),autoClose:!1}),f(ut(y))})},children:[!h&&a.jsxs(Se,{children:[a.jsx(it,{title:"Name",htmlFor:"name",outcome:d,children:a.jsx(ie,{id:"name",name:"name",required:!0,autoFocus:!0,onChange:g=>r(g.currentTarget.value),error:Le(d,"name")})}),a.jsx(it,{title:"Description",htmlFor:"description",outcome:d,children:a.jsx(ie,{id:"description",name:"description",onChange:g=>i(g.currentTarget.value),error:Le(d,"description")})}),a.jsx(it,{title:"Redirect URI",htmlFor:"redirectUri",outcome:d,children:a.jsx(ie,{id:"redirectUri",name:"redirectUri",onChange:g=>l(g.currentTarget.value),error:Le(d,"redirectUri")})}),a.jsx(it,{title:"Access Policy",htmlFor:"accessPolicy",outcome:d,children:a.jsx(Yf,{name:"accessPolicy",onChange:u})}),a.jsx(Y,{justify:"flex-end",children:a.jsx(Z,{type:"submit",children:"Create Client"})})]}),h&&a.jsxs("div",{"data-testid":"success",children:[a.jsx(le,{children:"Client created"}),a.jsxs(pn,{children:[a.jsx(pn.Item,{children:a.jsx(Ae,{to:h,children:"Go to new client"})}),a.jsx(pn.Item,{children:a.jsx(Ae,{to:"/admin/clients",children:"Back to clients list"})})]})]})]})]})}function IH(e){return a.jsx(Ma,{resourceType:"UserConfiguration",name:"userConfiguration",defaultValue:e.defaultValue,placeholder:"User Configuration",onChange:t=>{Io(t)?e.onChange(xt(t)):e.onChange(void 0)}})}function _H(){const{membershipId:e}=Xe(),t=te(),n=Ei(t),r=Rt(),o=t.get(`admin/projects/${n}/members/${e}`).read(),[i,s]=p.useState(o.accessPolicy),[l,c]=p.useState(o.userConfiguration),[u,d]=p.useState(o.admin),[f,h]=p.useState(),[m,g]=p.useState(!1);function y(){window.confirm("Are you sure?")&&t.delete(`admin/projects/${n}/members/${e}`).then(()=>t.get(`admin/projects/${n}`,{cache:"no-cache"})).then(()=>r("/admin/project")).catch(C=>h(ut(C)))}return a.jsxs(a.Fragment,{children:[a.jsx(ae,{children:"Edit membership"}),a.jsx("h3",{children:a.jsx(na,{value:o.profile,link:!0})}),a.jsxs(Be,{onSubmit:()=>{const C={...o,accessPolicy:i,userConfiguration:l,admin:u};t.post(`admin/projects/${n}/members/${e}`,C).then(()=>g(!0)).catch(v=>h(ut(v)))},children:[!m&&a.jsxs(Se,{children:[a.jsx(it,{title:"Access Policy",htmlFor:"accessPolicy",outcome:f,children:a.jsx(Yf,{name:"accessPolicy",defaultValue:i,onChange:s})}),a.jsx(it,{title:"User Configuration",htmlFor:"userConfiguration",outcome:f,children:a.jsx(IH,{name:"userConfiguration",defaultValue:l,onChange:c})}),a.jsx(it,{title:"Admin",htmlFor:"admin",outcome:f,children:a.jsx(ur,{id:"admin",name:"admin",defaultChecked:u,onChange:C=>d(C.currentTarget.checked)})}),a.jsxs(Y,{justify:"flex-end",mt:"xl",children:[a.jsx(Z,{type:"submit",children:"Save"}),a.jsx(Z,{type:"button",color:"red",variant:"outline",onClick:y,children:"Remove user"})]})]}),m&&a.jsxs("div",{"data-testid":"success",children:[a.jsx("p",{children:"User updated"}),a.jsx("pre",{children:JSON.stringify(f,void 0,2)}),a.jsxs("p",{children:["Click ",a.jsx(Ae,{to:"/admin/project",children:"here"})," to return to the project admin page."]})]})]})]})}function AH(){const e=te(),[t,n]=p.useState(e.getProject()),[r,o]=p.useState(),[i,s]=p.useState(),[l,c]=p.useState(!1),[u,d]=p.useState(void 0),f=p.useCallback(h=>{const m={resourceType:h.resourceType,firstName:h.firstName,lastName:h.lastName,email:h.email,sendEmail:h.sendEmail==="on",accessPolicy:r,admin:h.isAdmin==="on"};e.invite(t==null?void 0:t.id,m).then(g=>{e.invalidateSearches("Patient"),e.invalidateSearches("Practitioner"),e.invalidateSearches("ProjectMembership"),Pf(g)?s(g):d(g),c(m.sendEmail??!1),ce({color:"green",message:"Invite success"})}).catch(g=>{ce({color:"red",message:Pe(g),autoClose:!1}),s(ut(g))})},[e,t,r]);return a.jsxs(Be,{onSubmit:f,children:[!u&&!i&&a.jsxs(Se,{children:[a.jsx(ae,{children:"Invite new member"}),e.isSuperAdmin()&&a.jsx(it,{title:"Project",htmlFor:"project",outcome:i,children:a.jsx(Ma,{resourceType:"Project",name:"project",defaultValue:t,onChange:n})}),a.jsx(mt,{name:"resourceType",label:"Role",defaultValue:"Practitioner",data:["Practitioner","Patient","RelatedPerson"],error:Le(i,"resourceType")}),a.jsx(ie,{name:"firstName",label:"First Name",required:!0,autoFocus:!0,error:Le(i,"firstName")}),a.jsx(ie,{name:"lastName",label:"Last Name",required:!0,error:Le(i,"lastName")}),a.jsx(ie,{name:"email",type:"email",label:"Email",required:!0,error:Le(i,"email")}),a.jsx(it,{title:"Access Policy",htmlFor:"accessPolicy",outcome:i,children:a.jsx(Yf,{name:"accessPolicy",onChange:o})}),a.jsx(ur,{name:"sendEmail",label:"Send email",defaultChecked:!0}),a.jsx(ur,{name:"isAdmin",label:"Admin"}),a.jsx(Y,{justify:"flex-end",children:a.jsx(Z,{type:"submit",children:"Invite"})})]}),i&&a.jsxs("div",{"data-testid":"success",children:[a.jsx("p",{children:"User created, email couldn't be sent"}),a.jsx("p",{children:"Could not send email. Make sure you have AWS SES set up."}),a.jsxs("p",{children:["Click ",a.jsx(Ae,{to:"/admin/project",children:"here"})," to return to the project admin page."]})]}),u&&a.jsxs("div",{"data-testid":"success",children:[a.jsx(le,{children:"User created"}),l&&a.jsx(le,{children:"Email sent"}),a.jsxs(pn,{children:[a.jsx(pn.Item,{children:a.jsx(Ae,{to:u,children:"Go to new membership"})}),a.jsx(pn.Item,{children:a.jsx(Ae,{to:u.profile,children:"Go to new profile"})}),a.jsx(pn.Item,{children:a.jsx(Ae,{to:"/admin/users",children:"Back to users list"})})]})]})]})}function NH(){return a.jsxs(a.Fragment,{children:[a.jsx(ae,{children:"Patients"}),a.jsx(Kf,{resourceType:"Patient",fields:["user","profile","_lastUpdated"]}),a.jsx(Y,{justify:"flex-end",children:a.jsx(Ae,{to:"/admin/invite",children:"Invite new patient"})})]})}function Nw(){const e=te(),t=Ei(e),n=e.get(`admin/projects/${t}`).read();return a.jsxs(a.Fragment,{children:[a.jsx(ae,{children:"Details"}),a.jsxs(kv,{children:[a.jsx(ta,{term:"ID",children:n.project.id}),a.jsx(ta,{term:"Name",children:n.project.name})]})]})}const Ow=["Details","Users","Patients","Clients","Bots","Secrets","Sites"];function OH(){const e=Rt(),n=Ci().pathname.replace("/admin/","")||Ow[0],r=te(),o=Ei(r),i=p.useMemo(()=>r.get("admin/projects/"+o).read(),[r,o]);function s(l){e(`/admin/${l}`)}return a.jsxs(a.Fragment,{children:[a.jsxs(_n,{children:[a.jsx(Te,{children:a.jsxs(Te.Entry,{children:[a.jsx(Te.Key,{children:"Project"}),a.jsx(Te.Value,{children:i.project.name})]})}),a.jsx(fr,{children:a.jsx(We,{value:n.toLowerCase(),onChange:s,children:a.jsx(We.List,{style:{whiteSpace:"nowrap",flexWrap:"nowrap"},children:Ow.map(l=>a.jsx(We.Tab,{value:l.toLowerCase(),children:l},l))})})})]}),a.jsx(we,{children:a.jsx(Yv,{})})]})}function MH(){const e=te(),t=Ei(e),n=e.get(`admin/projects/${t}`).read(),[r,o]=p.useState(!1),[i,s]=p.useState();return p.useEffect(()=>{e.requestSchema("Project").then(()=>o(!0)).catch(console.log)},[e]),p.useEffect(()=>{n&&s(Si(n.project.secret||[]))},[e,n]),!r||!i?a.jsx("div",{children:"Loading..."}):a.jsxs("form",{noValidate:!0,autoComplete:"off",onSubmit:l=>{l.preventDefault(),e.post(`admin/projects/${t}/secrets`,i).then(()=>e.get(`admin/projects/${t}`,{cache:"reload"})).then(()=>ce({color:"green",message:"Saved"})).catch(console.log)},children:[a.jsx(ae,{children:"Project Secrets"}),a.jsx("p",{children:"Use project secrets to store sensitive information such as API keys or other access credentials."}),a.jsx(La,{property:gs("Project","secret"),name:"secret",defaultValue:i,onChange:s,outcome:void 0}),a.jsx(Z,{type:"submit",children:"Save"})]})}function LH(){const e=te(),t=Ei(e),n=e.get(`admin/projects/${t}`).read(),[r,o]=p.useState(!1),[i,s]=p.useState();return p.useEffect(()=>{e.requestSchema("Project").then(()=>o(!0)).catch(console.log)},[e]),p.useEffect(()=>{n&&s(Si(n.project.site||[]))},[e,n]),!r||!i?a.jsx("div",{children:"Loading..."}):a.jsxs("form",{noValidate:!0,autoComplete:"off",onSubmit:l=>{l.preventDefault(),e.post(`admin/projects/${t}/sites`,i).then(()=>e.get(`admin/projects/${t}`,{cache:"reload"})).then(()=>ce({color:"green",message:"Saved"})).catch(c=>{var d,f,h,m;const u=ut(c);ce({color:"red",message:`Error ${(f=(d=u.issue)==null?void 0:d[0].details)==null?void 0:f.text} ${(m=(h=u.issue)==null?void 0:h[0].expression)==null?void 0:m[0]}`,autoClose:!1})})},children:[a.jsx(ae,{children:"Project Sites"}),a.jsx("p",{children:"Use project sites configure your project on a separate domain."}),a.jsx(La,{property:gs("Project","site"),name:"site",defaultValue:i,onChange:s,outcome:void 0}),a.jsx(Z,{type:"submit",children:"Save"})]})}function $H(){const e=te();if(!e.isLoading()&&!e.isSuperAdmin())return a.jsx(to,{outcome:IE});function t(){il(e,"Rebuilding Structure Definitions","admin/super/structuredefinitions")}function n(){il(e,"Rebuilding Search Parameters","admin/super/searchparameters")}function r(){il(e,"Rebuilding Value Sets","admin/super/valuesets")}function o(u){il(e,"Reindexing Resources","admin/super/reindex",u)}function i(u){il(e,"Rebuilding Compartments","admin/super/compartments",u)}function s(u){e.post("admin/super/removebotidjobsfromqueue",u).then(()=>ce({color:"green",message:"Done"})).catch(d=>ce({color:"red",message:Pe(d),autoClose:!1}))}function l(u){e.post("admin/super/purge",{...u,before:RT(u.before)}).then(()=>ce({color:"green",message:"Done"})).catch(d=>ce({color:"red",message:Pe(d),autoClose:!1}))}function c(u){e.post("admin/super/setpassword",u).then(()=>ce({color:"green",message:"Done"})).catch(d=>ce({color:"red",message:Pe(d),autoClose:!1}))}return a.jsxs(we,{width:600,children:[a.jsx(ae,{order:1,children:"Super Admin"}),a.jsx(Tn,{my:"lg"}),a.jsx(ae,{order:2,children:"Structure Definitions"}),a.jsx("p",{children:"StructureDefinition resources contain the metadata about resource types. They are provided with the FHIR specification. Medplum also includes some custom StructureDefinition resources for internal data types. Press this button to update the database StructureDefinitions from the FHIR specification."}),a.jsx(Be,{children:a.jsx(Z,{onClick:t,children:"Rebuild StructureDefinitions"})}),a.jsx(Tn,{my:"lg"}),a.jsx(ae,{order:2,children:"Search Parameters"}),a.jsx("p",{children:"SearchParameter resources contain the metadata about filters and sorting. They are provided with the FHIR specification. Medplum also includes some custom SearchParameter resources for internal data types. Press this button to update the database SearchParameters from the FHIR specification."}),a.jsx(Be,{children:a.jsx(Z,{onClick:n,children:"Rebuild SearchParameters"})}),a.jsx(Tn,{my:"lg"}),a.jsx(ae,{order:2,children:"Value Sets"}),a.jsx("p",{children:"ValueSet resources enum values for a wide variety of use cases. Press this button to update the database ValueSets from the FHIR specification."}),a.jsx(Be,{children:a.jsx(Z,{onClick:r,children:"Rebuild ValueSets"})}),a.jsx(Tn,{my:"lg"}),a.jsx(ae,{order:2,children:"Reindex Resources"}),a.jsx("p",{children:"When Medplum changes how resources are indexed, the system may require a reindex for old resources to be indexed properly."}),a.jsx(Be,{onSubmit:o,children:a.jsxs(Se,{children:[a.jsx(it,{title:"Resource Type",children:a.jsx(ie,{name:"resourceType",placeholder:"Reindex Resource Type"})}),a.jsx(Z,{type:"submit",children:"Reindex"})]})}),a.jsx(Tn,{my:"lg"}),a.jsx(ae,{order:2,children:"Rebuild Compartments"}),a.jsx("p",{children:"When Medplum changes how resource compartments are derived, the system may require a rebuild for old resources to take effect."}),a.jsx(Be,{onSubmit:i,children:a.jsxs(Se,{children:[a.jsx(it,{title:"Resource Type",children:a.jsx(ie,{name:"resourceType",placeholder:"Compartments Resource Type"})}),a.jsx(Z,{type:"submit",children:"Rebuild Compartments"})]})}),a.jsx(Tn,{my:"lg"}),a.jsx(ae,{order:2,children:"Purge Resources"}),a.jsx("p",{children:"As system generated resources accumulate, the system may require a purge to remove old resources."}),a.jsx(Be,{onSubmit:l,children:a.jsxs(Se,{children:[a.jsx(it,{title:"Purge Resource Type",htmlFor:"purgeResourceType",children:a.jsx(mt,{id:"purgeResourceType",name:"resourceType",data:["","AuditEvent","Login"]})}),a.jsx(it,{title:"Purge Before",htmlFor:"before",children:a.jsx(Ji,{name:"before",placeholder:"Before Date"})}),a.jsx(Z,{type:"submit",children:"Purge"})]})}),a.jsx(Tn,{my:"lg"}),a.jsx(ae,{order:2,children:"Remove Bot ID Jobs from Queue"}),a.jsx("p",{children:"Remove all queued jobs for a Bot ID"}),a.jsx(Be,{onSubmit:s,children:a.jsxs(Se,{children:[a.jsx(it,{title:"Bot ID",children:a.jsx(ie,{name:"botId",placeholder:"Bot Id"})}),a.jsx(Z,{type:"submit",children:"Remove Jobs by Bot ID"})]})}),a.jsx(Tn,{my:"lg"}),a.jsx(ae,{order:2,children:"Force Set Password"}),a.jsx("p",{children:'Note that this applies to all projects for the user. Therefore, this should only be used in extreme circumstances. Always prefer to use the "Forgot Password" flow first.'}),a.jsx(Be,{onSubmit:c,children:a.jsxs(Se,{children:[a.jsx(ie,{name:"email",label:"Email",required:!0}),a.jsx(Pr,{name:"password",label:"Password",required:!0}),a.jsx(ie,{name:"projectId",label:"Project ID"}),a.jsx(Z,{type:"submit",children:"Force Set Password"})]})})]})}function il(e,t,n,r){Kr.show({id:n,loading:!0,title:t,message:"Running...",autoClose:!1,withCloseButton:!1});const o={method:"POST"};r&&(o.body=JSON.stringify(r)),e.startAsyncRequest(n,o).then(()=>{Kr.update({id:n,color:"green",title:t,message:"Done",icon:a.jsx(Nf,{size:"1rem"}),autoClose:!1,withCloseButton:!0})}).catch(i=>{Kr.update({id:n,color:"red",title:t,message:Pe(i),icon:a.jsx(xd,{size:"1rem"}),autoClose:!1,withCloseButton:!0})})}function FH(){const e=te();if(!e.isLoading()&&!e.isProjectAdmin())return a.jsx(to,{outcome:IE});function t(n){e.post("admin/projects/setpassword",n).then(()=>ce({color:"green",message:"Done"})).catch(r=>ce({color:"red",message:Pe(r),autoClose:!1}))}return a.jsxs(we,{width:600,children:[a.jsx(ae,{order:1,children:"Project Admin"}),a.jsx(Tn,{my:"lg"}),a.jsx(ae,{order:2,children:"Force Set Password"}),a.jsx(le,{children:"Sets the password for the specified user in this project."}),a.jsx(le,{children:"This action can only be performed by project administrators. Passwords can only be set for users scoped in this project."}),a.jsx(Be,{onSubmit:t,children:a.jsxs(Se,{children:[a.jsx(ie,{name:"email",label:"Email",required:!0}),a.jsx(Pr,{name:"password",label:"Password",required:!0}),a.jsx(Z,{type:"submit",children:"Force Set Password"})]})})]})}function zH(){return a.jsxs(a.Fragment,{children:[a.jsx(ae,{children:"Users"}),a.jsx(Kf,{resourceType:"Practitioner",fields:["user","profile","admin","_lastUpdated"]}),a.jsx(Y,{justify:"flex-end",children:a.jsx(Ae,{to:"/admin/invite",children:"Invite new user"})})]})}function BH(){const[e]=xa("ObservationDefinition","_count=100");return e?a.jsxs(he,{withTableBorder:!0,withRowBorders:!0,withColumnBorders:!0,children:[a.jsx("thead",{children:a.jsxs("tr",{children:[a.jsx("th",{children:"Category"}),a.jsx("th",{children:"Code"}),a.jsx("th",{children:"Method"}),a.jsx("th",{children:"Unit"}),a.jsx("th",{children:"Precision"}),a.jsx("th",{children:"Ranges"})]})}),a.jsx("tbody",{children:e.map(t=>{var n,r,o,i;return a.jsxs("tr",{children:[a.jsx("td",{children:a.jsx(Yr,{value:(n=t.category)==null?void 0:n[0]})}),a.jsx("td",{children:a.jsx(Yr,{value:t.code})}),a.jsx("td",{children:a.jsx(Yr,{value:t.method})}),a.jsx("td",{children:(o=(r=t.quantitativeDetails)==null?void 0:r.unit)==null?void 0:o.text}),a.jsx("td",{children:(i=t.quantitativeDetails)==null?void 0:i.decimalPrecision}),a.jsx("td",{children:a.jsx(Rm,{ranges:t.qualifiedInterval})})]},t.id)})})]}):a.jsx(Ir,{})}function Rm(e){const{ranges:t}=e;if(!t)return null;const n=Mw(t.map(o=>o.gender));if(n.length>1)return n.sort((o,i)=>o.localeCompare(i)),a.jsx(a.Fragment,{children:n.map(o=>{var i;return a.jsxs(p.Fragment,{children:[a.jsx("div",{children:a.jsx("strong",{children:en(o)})}),a.jsx(Rm,{ranges:(i=e.ranges)==null?void 0:i.filter(s=>s.gender===o)})]},o)})});const r=Mw(t.map(o=>o.age&&Wl(o.age)));return r.length>1?(r.sort((o,i)=>o.localeCompare(i)),a.jsx(a.Fragment,{children:r.map(o=>{var i;return a.jsxs(p.Fragment,{children:[a.jsx("div",{children:a.jsx("strong",{children:en(o)})}),a.jsx(Rm,{ranges:(i=e.ranges)==null?void 0:i.filter(s=>Wl(s.age)===o)})]},o)})})):a.jsx(a.Fragment,{children:t.map(o=>a.jsx("table",{children:a.jsx("tbody",{children:a.jsxs("tr",{children:[a.jsx("td",{children:o.condition}),a.jsx("td",{children:a.jsx(Rv,{value:o.range})})]})})},`range-${o.condition}`))})}function Mw(e){return[...new Set(e.filter(t=>!!t))]}function UH(){const[e]=xa("ActivityDefinition","_count=100"),[t]=xa("ObservationDefinition","_count=100");return!e||!t?a.jsx(Ir,{}):a.jsxs(he,{withTableBorder:!0,withRowBorders:!0,withColumnBorders:!0,children:[a.jsx("thead",{children:a.jsxs("tr",{children:[a.jsx("th",{children:"Category"}),a.jsx("th",{children:"Assay"}),e.map(n=>a.jsx("th",{children:n.name},n.id))]})}),a.jsx("tbody",{children:t.map(n=>{var r;return a.jsxs("tr",{children:[a.jsx("td",{children:a.jsx(Yr,{value:(r=n.category)==null?void 0:r[0]})}),a.jsx("td",{children:a.jsx(Yr,{value:n.code})}),e.map(o=>{var i;return a.jsx("td",{children:(i=o.observationResultRequirement)!=null&&i.find(s=>{var l;return(l=s.reference)==null?void 0:l.includes(n.id)})?"✅":""},o.id)})]},n.id)})})]})}function VH(e){var s;const t=te(),[n,r]=p.useState(),[o,i]=p.useState();return o?a.jsxs(a.Fragment,{children:[a.jsx("p",{children:"Request group created successfully."}),a.jsxs("ul",{children:[a.jsxs("li",{children:["Go to the"," ",a.jsx(Ae,{to:o,suffix:"checklist",children:"Request Group"})]}),a.jsxs("li",{children:["Back to the ",a.jsx(Ae,{to:e.planDefinition,children:"Plan Definition"})]})]})]}):a.jsx(Be,{onSubmit:()=>{t.post(t.fhirUrl("PlanDefinition",e.planDefinition.id,"$apply"),{resourceType:"Parameters",parameter:[{name:"subject",valueReference:n}]}).then(i).catch(console.log)},children:a.jsxs(Se,{children:[a.jsxs(ae,{children:['Start "',e.planDefinition.title,'"']}),a.jsxs(le,{children:["Use the ",a.jsx("strong",{children:"Apply"})," operation to create a group of tasks for a workflow."]}),a.jsx(le,{children:"The following tasks will be created:"}),a.jsx("ul",{children:(s=e.planDefinition.action)==null?void 0:s.map((l,c)=>{var u;return a.jsxs("li",{children:[((u=l.definitionCanonical)==null?void 0:u.startsWith("Questionnaire/"))&&"Questionnaire request: ",l.title&&a.jsx(a.Fragment,{children:l.title}),l.code&&a.jsx(Yr,{value:l.code[0]})]},`action-${c}`)})}),a.jsx(it,{title:"Subject",children:a.jsx(Ff,{name:"subject",targetTypes:["Patient","Practitioner"],defaultValue:n,onChange:r})}),a.jsx(Y,{justify:"flex-end",mt:"xl",children:a.jsx(Z,{type:"submit",children:"Go"})})]})})}function HH(){const{resourceType:e,id:t}=Xe(),n=st({reference:e+"/"+t});return n?a.jsx(we,{children:a.jsx(VH,{planDefinition:n})}):null}function WH(){const{resourceType:e,id:t}=Xe(),n=st({reference:e+"/"+t}),[r,o]=xa("Questionnaire","subject-type="+e),[i,s]=xa("ClientApplication",{_count:1e3});if(!n||o||s)return a.jsx(Ir,{});const l=i==null?void 0:i.filter(d=>qH(e)&&!!d.launchUri);if((!r||r.length===0)&&(!l||l.length===0))return a.jsxs(we,{children:[a.jsx(ae,{children:"Apps"}),a.jsxs("p",{children:["No apps found. Contact your administrator or ",a.jsx("a",{href:"mailto:support@medplum.com",children:"Medplum Support"})," to add automation here."]})]});let c,u;return n.resourceType==="Patient"?c=xt(n):n.resourceType==="Encounter"&&(c=n.subject,u=xt(n)),a.jsxs(we,{children:[r==null?void 0:r.map(d=>a.jsxs("div",{children:[a.jsx(ae,{order:3,children:a.jsx(Ae,{to:`/forms/${d.id}?subject=${ht(n)}`,children:d.title||d.name})}),a.jsx(le,{children:d.description})]},d.id)),l==null?void 0:l.map(d=>a.jsxs("div",{children:[a.jsx(ae,{order:3,children:a.jsx(TB,{client:d,patient:c,encounter:u,children:d.name})}),a.jsx(le,{children:d.description})]},d.id))]})}function qH(e){return e==="Patient"||e==="Encounter"}function GH(){const{resourceType:e,id:t}=Xe(),n=Rt(),[r,o]=p.useState({resourceType:"AuditEvent",filters:[{code:"entity",operator:ne.EQUALS,value:`${e}/${t}`}],fields:["id","outcome","outcomeDesc","_lastUpdated"],sortRules:[{code:"-_lastUpdated"}],count:20});return a.jsx(we,{children:a.jsx(kc,{search:r,onClick:i=>n(`/${i.resource.resourceType}/${i.resource.id}`),onChange:i=>o(i.definition),hideFilters:!0})})}function QH(){const e=te(),{resourceType:t,id:n}=Xe(),r=e.readHistory(t,n).read();return a.jsx(we,{children:a.jsx(yB,{history:r})})}const KH="_hl7Input_k5xm3_1",YH={hl7Input:KH};function XH(e){return a.jsx("iframe",{frameBorder:"0",src:"https://codeeditor.medplum.com/bot-runner.html",className:e.className,ref:e.iframeRef,"data-testid":e.testId,style:{width:"100%",height:"100%",minHeight:e.minHeight}})}function JH(e){const t=e.defaultValue,n=new URL(`https://codeeditor.medplum.com/${e.language}-editor.html`);return e.module&&n.searchParams.set("module",e.module),a.jsx("iframe",{frameBorder:"0",src:n.toString(),style:{width:"100%",height:"100%",minHeight:e.minHeight},ref:e.iframeRef,"data-testid":e.testId,onLoad:r=>{Au(r.currentTarget,{command:"setValue",value:t}).catch(console.error)}})}const ZH=`{
225
- "resourceType": "Patient",
226
- "name": [
227
- {
228
- "given": [
229
- "Alice"
230
- ],
231
- "family": "Smith"
232
- }
233
- ]
234
- }`,eW="MSH|^~\\&|ADT1|MCM|LABADT|MCM|198808181126|SECURITY|ADT|MSG00001|P|2.1\rPID|||PATID1234^5^M11||JONES^WILLIAM^A^III||19610615|M-||C|1200 N ELM STREET^^GREENSBORO^NC^27401-1020|GL|(919)379-1212|(919)271-3434||S||PATID12345001^2^M10|123456789|987654^NC\rNK1|1|JONES^BARBARA^K|SPO|||||20011105\rPV1|1|I|2000^2012^01||||004777^LEBAUER^SIDNEY^J.|||SUR||-||1|A0-";function tW(){const e=te(),{id:t}=Xe(),[n,r]=p.useState(),[o,i]=p.useState(),[s,l]=p.useState(ZH),[c,u]=p.useState(eW),[d,f]=p.useState(Gt.FHIR_JSON),h=p.useRef(null),m=p.useRef(null),[g,y]=p.useState(!1);p.useEffect(()=>{e.readResource("Bot",t).then(async j=>{r(j),i(await nW(e,j))}).catch(j=>ce({color:"red",message:Pe(j),autoClose:!1}))},[e,t]);const C=p.useCallback(()=>Au(h.current,{command:"getValue"}),[]),v=p.useCallback(()=>Au(h.current,{command:"getOutput"}),[]),x=p.useCallback(async()=>d===Gt.FHIR_JSON?JSON.parse(s):c,[d,s,c]),w=p.useCallback(async j=>{j.preventDefault(),j.stopPropagation(),y(!0);try{const T=await C(),P=await e.createAttachment(T,"index.ts","text/typescript"),R=[];n!=null&&n.sourceCode?R.push({op:"replace",path:"/sourceCode",value:P}):R.push({op:"add",path:"/sourceCode",value:P}),await e.patchResource("Bot",t,R),ce({color:"green",message:"Saved"})}catch(T){ce({color:"red",message:Pe(T),autoClose:!1})}finally{y(!1)}},[e,t,n,C]),S=p.useCallback(async j=>{j.preventDefault(),j.stopPropagation(),y(!0);try{const T=await v();await e.post(e.fhirUrl("Bot",t,"$deploy"),{code:T}),ce({color:"green",message:"Deployed"})}catch(T){ce({color:"red",message:Pe(T),autoClose:!1})}finally{y(!1)}},[e,t,v]),E=p.useCallback(async j=>{j.preventDefault(),j.stopPropagation(),y(!0);try{const T=await x(),P=await e.post(e.fhirUrl("Bot",t,"$execute"),T,d);await Au(m.current,{command:"setValue",value:P}),ce({color:"green",message:"Success"})}catch(T){ce({color:"red",message:Pe(T),autoClose:!1})}finally{y(!1)}},[e,t,x,d]);return!n||o===void 0?null:a.jsxs(Vn,{m:0,gutter:0,style:{overflow:"hidden"},children:[a.jsx(Vn.Col,{span:8,children:a.jsxs(_n,{m:2,pb:"xs",pr:"xs",pt:"xs",shadow:"md",mih:400,children:[a.jsx(JH,{iframeRef:h,language:"typescript",module:"commonjs",testId:"code-frame",defaultValue:o,minHeight:"528px"}),a.jsxs(Y,{justify:"flex-end",gap:"xs",children:[a.jsx(Z,{type:"button",onClick:w,loading:g,leftSection:a.jsx(I$,{size:"1rem"}),children:"Save"}),a.jsx(Z,{type:"button",onClick:S,loading:g,leftSection:a.jsx(wv,{size:"1rem"}),children:"Deploy"}),a.jsx(Z,{type:"button",onClick:E,loading:g,leftSection:a.jsx(G$,{size:"1rem"}),children:"Execute"})]})]})}),a.jsxs(Vn.Col,{span:4,children:[a.jsxs(_n,{m:2,pb:"xs",pr:"xs",pt:"xs",shadow:"md",children:[a.jsx(mt,{data:[{label:"FHIR",value:Gt.FHIR_JSON},{label:"HL7",value:Gt.HL7_V2}],onChange:j=>f(j.currentTarget.value)}),d===Gt.FHIR_JSON?a.jsx(fs,{value:s,onChange:j=>l(j),autosize:!0,minRows:15}):a.jsx("textarea",{className:YH.hl7Input,value:c,onChange:j=>u(j.currentTarget.value),rows:15})]}),a.jsx(_n,{m:2,p:"xs",shadow:"md",children:a.jsx(XH,{iframeRef:m,className:"medplum-bot-output-frame",testId:"output-frame",minHeight:"200px"})})]})]})}async function nW(e,t){var n,r,o;if((n=t.sourceCode)!=null&&n.url){const i=(o=(r=t.sourceCode.url)==null?void 0:r.split("/"))==null?void 0:o.find(ME);return(await e.download(e.fhirUrl("Binary",i))).text()}return t.code??""}function Fa(e){let t=e.meta;return t&&(t={...t,lastUpdated:void 0,versionId:void 0,author:void 0}),{...e,meta:t}}function rW(e,t){var n,r;(r=(n=e==null?void 0:e.meta)==null?void 0:n.profile)!=null&&r.includes(t)||(e.meta=e.meta??{},e.meta.profile=e.meta.profile??[],e.meta.profile.push(t))}function oW(e,t){var n,r;if((r=(n=e==null?void 0:e.meta)==null?void 0:n.profile)!=null&&r.includes(t)){const o=e.meta.profile.indexOf(t);e.meta.profile.splice(o,1)}}function iW(){const e=te(),{resourceType:t,id:n}=Xe(),r={reference:t+"/"+n},o=p.useCallback(i=>{e.updateResource(Fa(i)).then(()=>{ce({color:"green",message:"Success"})}).catch(s=>{ce({color:"red",message:Pe(s),autoClose:!1})})},[e]);switch(t){case"PlanDefinition":return a.jsx(we,{children:a.jsx(qF,{value:r,onSubmit:o})});case"Questionnaire":return a.jsx(we,{children:a.jsx(Rz,{questionnaire:r,onSubmit:o})});default:return null}}function sW(){const{resourceType:e,id:t}=Xe(),n=st({reference:e+"/"+t}),r=Rt();return n?a.jsx(we,{children:a.jsx(Zz,{value:n,onStart:(o,i)=>r(`/forms/${tv(i)}`),onEdit:(o,i,s)=>r(`/${s.reference}}`)})}):null}function aW(){const e=te(),{resourceType:t,id:n}=Xe(),r=Rt();return a.jsxs(we,{children:[a.jsxs("p",{children:["Are you sure you want to delete this ",t,"?"]}),a.jsx(Z,{color:"red",onClick:()=>{e.deleteResource(t,n).then(()=>r(`/${t}`)).catch(o=>ce({color:"red",message:Pe(o),autoClose:!1}))},children:"Delete"})]})}function lW(){const{resourceType:e,id:t}=Xe(),n=st({reference:e+"/"+t});return n?a.jsx(we,{children:a.jsx(Fv,{value:n})}):null}function cW(){const e=te(),{resourceType:t,id:n}=Xe(),[r,o]=p.useState(),i=Rt(),[s,l]=p.useState();p.useEffect(()=>{e.readResource(t,n).then(d=>o(Si(d))).catch(d=>{l(ut(d)),ce({color:"red",message:Pe(d),autoClose:!1})})},[e,t,n]);const c=p.useCallback(d=>{l(void 0),e.updateResource(Fa(d)).then(()=>{i(`/${t}/${n}/details`),ce({color:"green",message:"Success"})}).catch(f=>{l(ut(f)),ce({color:"red",message:Pe(f),autoClose:!1})})},[e,t,n,i]),u=p.useCallback(()=>i(`/${t}/${n}/delete`),[i,t,n]);return r?a.jsx(we,{children:a.jsx(Gv,{defaultValue:r,onSubmit:c,onDelete:u,outcome:s})}):null}function uW(){const e=te(),{resourceType:t,id:n}=Xe(),r=e.readHistory(t,n).read();return a.jsx(we,{children:a.jsx(bB,{history:r})})}function dW(){const e=te(),{resourceType:t,id:n}=Xe(),r=st({reference:t+"/"+n}),o=Rt(),[i,s]=p.useState(),l=p.useCallback(c=>{e.updateResource(Fa(JSON.parse(c.resource))).then(()=>{s(void 0),o(`/${t}/${n}/details`),ce({color:"green",message:"Success"})}).catch(u=>{ce({color:"red",message:Pe(u),autoClose:!1})})},[e,t,n,o]);return r?a.jsxs(we,{children:[i&&a.jsx(to,{outcome:i}),a.jsxs(Be,{onSubmit:l,children:[a.jsx(fs,{name:"resource","data-testid":"resource-json",autosize:!0,minRows:24,defaultValue:On(r,!0),formatOnBlur:!0,deserialize:JSON.parse}),a.jsx(Y,{justify:"flex-end",mt:"xl",wrap:"nowrap",children:a.jsx(Z,{type:"submit",children:"OK"})})]})]}):null}function fW(){const{resourceType:e,id:t}=Xe();return st({reference:e+"/"+t})?a.jsxs(we,{children:[a.jsxs(us,{icon:a.jsx(Cc,{size:16}),mb:"xl",children:["This is just a preview! Access your form here:",a.jsx("br",{}),a.jsx(Ue,{href:`/forms/${t}`,children:`/forms/${t}`})]}),a.jsx(vP,{questionnaire:{reference:e+"/"+t},onSubmit:()=>alert("You submitted the preview")})]}):null}function hW(){const e=te(),{id:t}=Xe(),[n,r]=p.useState(),[o,i]=p.useState(0),s=e.searchResources("Subscription","status=active&_count=100").read().filter(c=>pW(c,t));function l(){n&&e.createResource({resourceType:"Subscription",status:"active",reason:`Connect bot ${n.name} to questionnaire responses`,criteria:"QuestionnaireResponse?questionnaire=Questionnaire/"+t,channel:{type:"rest-hook",endpoint:ht(n)}}).then(()=>{r(void 0),i(Date.now()),e.invalidateSearches("Subscription"),ce({color:"green",message:"Success"})}).catch(c=>ce({color:"red",message:Pe(c),autoClose:!1}))}return a.jsxs(we,{children:[a.jsx(ae,{children:"Bots"}),s.length===0&&a.jsx("p",{children:"No bots found."}),s.map(c=>{var u;return a.jsxs("div",{children:[a.jsx("h3",{children:a.jsx(Tc,{value:{reference:(u=c.channel)==null?void 0:u.endpoint},link:!0})}),a.jsxs("p",{children:["Criteria: ",c.criteria]})]},c.id)}),a.jsx("hr",{}),a.jsx(ae,{children:"Connect to bot"}),a.jsxs(Y,{children:[a.jsx(Ma,{name:"bot",resourceType:"Bot",onChange:c=>r(c)}),a.jsx(Z,{onClick:l,children:"Connect"})]}),a.jsx("div",{style:{display:"none"},children:o})]})}function pW(e,t){var o;const n=e.criteria||"",r=((o=e.channel)==null?void 0:o.endpoint)||"";return n.startsWith("QuestionnaireResponse?")&&n.includes(t)&&r.startsWith("Bot/")}function mW(){const{id:e}=Xe(),t=Rt(),[n,r]=p.useState({resourceType:"QuestionnaireResponse",filters:[{code:"questionnaire",operator:ne.EQUALS,value:"Questionnaire/"+e}],fields:["id","_lastUpdated"]});return a.jsx(we,{children:a.jsx(kc,{search:n,onClick:o=>t(`/${o.resource.resourceType}/${o.resource.id}`),onChange:o=>r(o.definition),hideFilters:!0,hideToolbar:!0})})}function gW(){const e=te(),{resourceType:t,id:n}=Xe(),r=st({reference:t+"/"+n}),o=p.useCallback(i=>{e.updateResource(Fa(i)).then(()=>{ce({color:"green",message:"Success"})}).catch(s=>{ce({color:"red",message:Pe(s),autoClose:!1})})},[e]);return r?a.jsx(we,{children:a.jsx(Wz,{onSubmit:o,definition:r})}):null}function yW(){const{resourceType:e,id:t}=Xe(),n=st({reference:e+"/"+t});return n?a.jsx(we,{children:e==="MeasureReport"?a.jsx(zF,{measureReport:n}):a.jsx(Av,{value:n})}):null}const vW="_container_1ue98_1",xW="_entry_1ue98_14",wW="_active_1ue98_21",ep={container:vW,entry:xW,active:wW};function SW(e){const t=te(),n=st(e.value),[r,o]=p.useState();return p.useEffect(()=>{if(!n)return;const i=t0(n);if(!i)return;const s="reference"in i?i.reference:ht(i);t.search("ServiceRequest","subject="+s).then(l=>{const u=l.entry.map(d=>d.resource);XT(u),u.reverse(),o(u)}).catch(l=>ce({color:"red",message:Pe(l),autoClose:!1}))},[t,n]),r?a.jsx("div",{"data-testid":"quick-service-requests",className:ep.container,children:r.map(i=>{var s,l,c,u,d,f,h;return a.jsxs("div",{className:Ye(ep.entry,{[ep.active]:i.id===(n==null?void 0:n.id)}),children:[a.jsx("p",{children:a.jsx(Ae,{to:i,children:bW(i)})}),((l=(s=i.category)==null?void 0:s[0])==null?void 0:l.text)&&a.jsx("p",{children:(c=i.category[0])==null?void 0:c.text}),((f=(d=(u=i.code)==null?void 0:u.coding)==null?void 0:d[0])==null?void 0:f.code)&&a.jsx("p",{children:(h=i.code.coding[0])==null?void 0:h.code}),a.jsx("p",{children:CW(i)})]},i.id)})}):null}function bW(e){if(e.identifier){for(const t of e.identifier)if(t.value)return t.value}return e.id||""}function CW(e){var t;return e.authoredOn?e.authoredOn.substring(0,10):(t=e.meta)!=null&&t.lastUpdated?e.meta.lastUpdated.substring(0,10):""}const jW="_container_1l2dh_1",EW={container:jW};function TW(e){var o,i,s,l;const t=st(e.valueSet);if(!t)return null;const n=[""],r=(l=(s=(i=(o=t.compose)==null?void 0:o.include)==null?void 0:i[0])==null?void 0:s.concept)==null?void 0:l.map(c=>c.code);return r&&n.push(...r),e.defaultValue&&!n.includes(e.defaultValue)&&n.push(e.defaultValue),a.jsx("div",{className:EW.container,children:a.jsx(mt,{defaultValue:e.defaultValue,onChange:c=>e.onChange(c.currentTarget.value),data:n})})}function PW(e){var n,r;const t=st(e.specimen);return t?a.jsxs(Te,{children:[a.jsxs(Te.Entry,{children:[a.jsx(Te.Key,{children:"Type"}),a.jsx(Te.Value,{children:"Specimen"})]}),a.jsxs(Te.Entry,{children:[a.jsx(Te.Key,{children:"Collected"}),a.jsx(Te.Value,{children:Mn((n=t.collection)==null?void 0:n.collectedDateTime)})]}),a.jsxs(Te.Entry,{children:[a.jsx(Te.Key,{children:"Specimen Age"}),a.jsx(Te.Value,{children:kW(t)})]}),(r=t.collection)!=null&&r.collectedDateTime&&t.receivedTime?a.jsxs(Te.Entry,{children:[a.jsx(Te.Key,{children:"Specimen Stability"}),a.jsx(Te.Value,{children:RW(t)})]}):a.jsx(a.Fragment,{})]}):null}function kW(e){var o;const t=(o=e.collection)==null?void 0:o.collectedDateTime;if(!t)return;const n=new Date(t);return lk(ck(n,new Date))}function RW(e){var r;if(!((r=e.collection)!=null&&r.collectedDateTime)||!e.receivedTime)return;const t=new Date(e.collection.collectedDateTime),n=new Date(e.receivedTime);return lk(ck(t,n))}function lk(e){return e.toString().padStart(3,"0")+"D"}function ck(e,t){const n=t.getTime()-e.getTime();return Math.floor(n/(1e3*3600*24))}function DW(e){const t=["Timeline"];return e==="Bot"&&t.push("Editor","Subscriptions"),e==="PlanDefinition"&&t.push("Apply","Builder"),e==="Questionnaire"&&t.push("Preview","Builder","Bots","Responses"),(e==="DiagnosticReport"||e==="MeasureReport")&&t.push("Report"),e==="RequestGroup"&&t.push("Checklist"),e==="ObservationDefinition"&&t.push("Ranges"),t.push("Details","Edit","Event","History","Blame","JSON","Apps","Profiles"),t}const IW=["Profiles"];function _W(){var w,S,E,j,T,P,R;const e=te(),{resourceType:t,id:n}=Xe(),r={reference:t+"/"+n},o=Rt(),[i,s]=p.useState(),l=st(r,s),c=DW(t),[u,d]=p.useState(()=>{const I=window.location.pathname.split("/").pop();return I&&c.map(O=>O.toLowerCase()).includes(I)?I:c[0].toLowerCase()}),f=Nt();async function h(){var D,A;const O=(A=(D=(await e.readHistory(t,n)).entry)==null?void 0:D.find(M=>!!M.resource))==null?void 0:A.resource;O?m(O):ce({color:"red",message:"No history to restore",autoClose:!1})}function m(I){e.updateResource(Fa(I)).then(()=>{s(void 0),ce({color:"green",message:"Success"})}).catch(O=>{ce({color:"red",message:Pe(O),autoClose:!1})})}if(i)return Q5(i)?a.jsxs(we,{children:[a.jsx(ae,{children:"Deleted"}),a.jsx("p",{children:"The resource was deleted."}),a.jsx(Z,{color:"red",onClick:h,children:"Restore"})]}):a.jsx(to,{outcome:i});function g(I){I||(I=c[0].toLowerCase()),d(I),o(`/${t}/${n}/${I}`)}function y(I){const O=l,D=O.orderDetail||[];D.length===0&&D.push({}),D[0].text!==I&&(D[0].text=I,m({...O,orderDetail:D}))}const C=l&&t0(l),v=l&&aH(l),x=(E=(S=(w=e.getUserConfiguration())==null?void 0:w.option)==null?void 0:S.find(I=>I.id==="statusValueSet"))==null?void 0:E.valueString;return a.jsxs(a.Fragment,{children:[(l==null?void 0:l.resourceType)==="ServiceRequest"&&x&&a.jsx(TW,{valueSet:{reference:x},defaultValue:(T=(j=l.orderDetail)==null?void 0:j[0])==null?void 0:T.text,onChange:y},ht(l)+"-"+((R=(P=l.orderDetail)==null?void 0:P[0])==null?void 0:R.text)),l&&a.jsx(SW,{value:l}),l&&a.jsxs(_n,{children:[C&&a.jsx(ok,{patient:C}),v&&a.jsx(PW,{specimen:v}),t!=="Patient"&&a.jsx(ik,{resource:r}),a.jsx(fr,{children:a.jsx(We,{value:u.toLowerCase(),onChange:g,children:a.jsx(We.List,{style:{whiteSpace:"nowrap",flexWrap:"nowrap"},children:c.map(I=>a.jsx(We.Tab,{value:I.toLowerCase(),children:IW.includes(I)?a.jsxs(Y,{gap:"xs",wrap:"nowrap",children:[I,a.jsx(cf,{color:f.primaryColor,size:"sm",children:"Beta"})]}):I},I))})})})]}),a.jsx(Yv,{})]})}function Lw(){var v,x,w,S;const e=Rt(),{resourceType:t,id:n,versionId:r,tab:o}=Xe(),i=te(),[s,l]=p.useState(!0),[c,u]=p.useState(),[d,f]=p.useState();if(p.useEffect(()=>{f(void 0),l(!0),i.readHistory(t,n).then(E=>u(E)).then(()=>l(!1)).catch(E=>{f(E),l(!1)})},[i,t,n]),s)return a.jsx(Ir,{});if(!c)return a.jsxs(we,{children:[a.jsx(ae,{children:"Resource not found"}),a.jsx(Ae,{to:`/${t}`,children:"Return to search page"})]});const h=c.entry,m=h.findIndex(E=>{var j,T;return((T=(j=E.resource)==null?void 0:j.meta)==null?void 0:T.versionId)===r});if(m===-1)return a.jsxs(we,{children:[a.jsx(ae,{children:"Version not found"}),a.jsx(Ae,{to:`/${t}/${n}`,children:"Return to resource"})]});const g=h[m].resource,y=m<h.length-1?h[m+1].resource:void 0,C="diff";return a.jsx(a.Fragment,{children:a.jsxs(We,{value:o||C,onChange:E=>e(`/${t}/${n}/_history/${r}/${E||C}`),children:[a.jsxs(_n,{children:[a.jsx(Ec,{fluid:!0,p:"md",children:a.jsx(le,{children:`${t} ${n}`})}),a.jsxs(We.List,{children:[a.jsx(We.Tab,{value:"diff",children:"Diff"}),a.jsx(We.Tab,{value:"raw",children:"Raw"})]})]}),a.jsxs(we,{children:[d&&a.jsx("pre",{"data-testid":"error",children:JSON.stringify(d,void 0,2)}),a.jsx(We.Panel,{value:"diff",children:y?a.jsxs(a.Fragment,{children:[a.jsxs("ul",{children:[a.jsxs("li",{children:["Current: ",(v=g.meta)==null?void 0:v.versionId]}),a.jsxs("li",{children:["Previous:"," ",a.jsx(Ae,{to:`/${t}/${n}/_history/${(x=y.meta)==null?void 0:x.versionId}`,children:(w=y.meta)==null?void 0:w.versionId})]})]}),a.jsx(wB,{original:y,revised:g})]}):a.jsxs(a.Fragment,{children:[a.jsxs("ul",{children:[a.jsxs("li",{children:["Current: ",(S=g.meta)==null?void 0:S.versionId]}),a.jsx("li",{children:"Previous: (none)"})]}),a.jsx("pre",{children:JSON.stringify(g,void 0,2)})]})}),a.jsx(We.Panel,{value:"raw",children:a.jsx("pre",{children:JSON.stringify(g,void 0,2)})})]})]})})}function AW(){const{resourceType:e,id:t}=Xe(),n=Rt(),[r,o]=p.useState({resourceType:"Subscription",filters:[{code:"url",operator:ne.EQUALS,value:`${e}/${t}`}],fields:["id","criteria","status","_lastUpdated"]});return a.jsx(we,{children:a.jsx(kc,{search:r,onClick:i=>n(`/${i.resource.resourceType}/${i.resource.id}`),onChange:i=>o(i.definition),hideFilters:!0})})}function $w(){const{resourceType:e,id:t}=Xe(),n={reference:e+"/"+t};switch(e){case"Encounter":return a.jsx(L8,{encounter:n});case"Patient":return a.jsx(BF,{patient:n});case"ServiceRequest":return a.jsx(EB,{serviceRequest:n});default:return a.jsx(M8,{resource:n})}}function uk(e,t){const n=te(),r=Rt();return{defaultValue:{resourceType:e},handleSubmit:s=>{t&&t(void 0),n.createResource(s).then(l=>r("/"+l.resourceType+"/"+l.id)).catch(l=>{t&&t(ut(l))})}}}function Fw(){const{resourceType:e}=Xe(),[t,n]=p.useState(),{defaultValue:r,handleSubmit:o}=uk(e,n);return a.jsx(we,{children:a.jsx(Gv,{defaultValue:r,onSubmit:o,outcome:t})})}function NW(){const{resourceType:e}=Xe(),[t,n]=p.useState(),{defaultValue:r,handleSubmit:o}=uk(e,n),i=p.useCallback(s=>{o(JSON.parse(s["new-resource"]))},[o]);return a.jsxs(we,{children:[t&&a.jsx(to,{outcome:t}),a.jsxs(Be,{onSubmit:i,children:[a.jsx(fs,{name:"new-resource","data-testid":"create-resource-json",autosize:!0,minRows:24,defaultValue:On(r,!0),formatOnBlur:!0,deserialize:JSON.parse}),a.jsx(Y,{justify:"flex-end",mt:"xl",wrap:"nowrap",children:a.jsx(Z,{type:"submit",children:"OK"})})]})]})}function OW(){const e=te(),{resourceType:t,id:n}=Xe(),[r,o]=p.useState(),[i,s]=p.useState(),[l,c]=p.useState();return p.useEffect(()=>{e.readResource(t,n).then(u=>o(Si(u))).catch(u=>{ce({color:"red",message:Pe(u)})})},[e,t,n]),p.useEffect(()=>{e.searchResources("StructureDefinition",{type:t,derivation:"constraint",_count:50}).then(u=>{c(u.filter(i6))}).catch(console.error)},[e,t]),r?a.jsxs(we,{children:[a.jsxs(ae,{order:2,children:["Available ",t," profiles"]}),a.jsx(Se,{children:a.jsxs(a.Fragment,{children:[a.jsx(We,{value:i==null?void 0:i.url,onChange:u=>s(l==null?void 0:l.find(d=>d.url===u)),children:a.jsx(We.List,{children:l==null?void 0:l.map(u=>{var h,m;const d=(m=(h=r.meta)==null?void 0:h.profile)==null?void 0:m.includes(u.url),f=d?"This profile is present in this resource's meta.profile property.":"This profile is not included in this resource's meta.profile property.";return a.jsx(We.Tab,{value:u.url,title:f,rightSection:d&&a.jsx(Jy,{variant:"outline",color:"green",size:"xs",style:{borderStyle:"none"},children:a.jsx(k$,{size:"90%"})}),children:u.title||u.name},u.url)})})}),i?a.jsx(MW,{profile:i,resource:r,onResourceUpdated:u=>o(u)},i.url):a.jsx(le,{my:"lg",fz:"lg",fs:"italic",ta:"center",children:"Select a profile above"})]})})]}):null}const MW=({profile:e,resource:t,onResourceUpdated:n})=>{const r=te(),[o,i]=p.useState(),[s,l]=p.useState(()=>{var u,d;return(d=(u=t.meta)==null?void 0:u.profile)==null?void 0:d.includes(e.url)}),c=p.useCallback(u=>{i(void 0);const d=Fa(u);s?rW(d,e.url):oW(d,e.url),r.updateResource(d).then(f=>{n(f),ce({color:"green",message:"Success"})}).catch(f=>{i(ut(f)),ce({color:"red",message:Pe(f)})})},[r,e.url,n,s]);return a.jsxs(Se,{children:[a.jsx(mc,{size:"md",checked:s,label:`Conform resource to ${e.title}`,onChange:u=>l(u.currentTarget.checked),"data-testid":"profile-toggle"}),s?a.jsx(Gv,{profileUrl:e.url,defaultValue:t,onSubmit:c,outcome:o}):a.jsx("form",{noValidate:!0,onSubmit:u=>{u.preventDefault(),c(t)},children:a.jsx(Y,{justify:"flex-end",mt:"xl",children:a.jsx(Z,{type:"submit",children:"OK"})})})]})};function LW(){return a.jsx(VU,{children:a.jsxs(de,{errorElement:a.jsx(tH,{}),children:[a.jsx(de,{path:"/signin",element:a.jsx(EH,{})}),a.jsx(de,{path:"/oauth",element:a.jsx(wH,{})}),a.jsx(de,{path:"/resetpassword",element:a.jsx(bH,{})}),a.jsx(de,{path:"/setpassword/:id/:secret",element:a.jsx(jH,{})}),a.jsx(de,{path:"/register",element:a.jsx(SH,{})}),a.jsx(de,{path:"/changepassword",element:a.jsx(ZV,{})}),a.jsx(de,{path:"/security",element:a.jsx(CH,{})}),a.jsx(de,{path:"/mfa",element:a.jsx(xH,{})}),a.jsx(de,{path:"/batch",element:a.jsx(XV,{})}),a.jsx(de,{path:"/bulk/:resourceType",element:a.jsx(JV,{})}),a.jsx(de,{path:"/smart",element:a.jsx(TH,{})}),a.jsx(de,{path:"/forms/:id",element:a.jsx(cH,{})}),a.jsx(de,{path:"/admin/super",element:a.jsx($H,{})}),a.jsx(de,{path:"/admin/config",element:a.jsx(FH,{})}),a.jsxs(de,{path:"/admin",element:a.jsx(OH,{}),children:[a.jsx(de,{path:"patients",element:a.jsx(NH,{})}),a.jsx(de,{path:"bots/new",element:a.jsx(RH,{})}),a.jsx(de,{path:"bots",element:a.jsx(PH,{})}),a.jsx(de,{path:"clients/new",element:a.jsx(DH,{})}),a.jsx(de,{path:"clients",element:a.jsx(kH,{})}),a.jsx(de,{path:"details",element:a.jsx(Nw,{})}),a.jsx(de,{path:"invite",element:a.jsx(AH,{})}),a.jsx(de,{path:"users",element:a.jsx(zH,{})}),a.jsx(de,{path:"project",element:a.jsx(Nw,{})}),a.jsx(de,{path:"secrets",element:a.jsx(MH,{})}),a.jsx(de,{path:"sites",element:a.jsx(LH,{})}),a.jsx(de,{path:"members/:membershipId",element:a.jsx(_H,{})})]}),a.jsx(de,{path:"/lab/assays",element:a.jsx(BH,{})}),a.jsx(de,{path:"/lab/panels",element:a.jsx(UH,{})}),a.jsx(de,{path:"/:resourceType/:id/_history/:versionId/:tab",element:a.jsx(Lw,{})}),a.jsx(de,{path:"/:resourceType/:id/_history/:versionId",element:a.jsx(Lw,{})}),a.jsxs(de,{path:"/:resourceType/new",element:a.jsx(eH,{}),children:[a.jsx(de,{index:!0,element:a.jsx(Fw,{})}),a.jsx(de,{path:"form",element:a.jsx(Fw,{})}),a.jsx(de,{path:"json",element:a.jsx(NW,{})})]}),a.jsxs(de,{path:"/:resourceType/:id",element:a.jsx(_W,{}),children:[a.jsx(de,{index:!0,element:a.jsx($w,{})}),a.jsx(de,{path:"apply",element:a.jsx(HH,{})}),a.jsx(de,{path:"apps",element:a.jsx(WH,{})}),a.jsx(de,{path:"event",element:a.jsx(GH,{})}),a.jsx(de,{path:"blame",element:a.jsx(QH,{})}),a.jsx(de,{path:"bots",element:a.jsx(hW,{})}),a.jsx(de,{path:"builder",element:a.jsx(iW,{})}),a.jsx(de,{path:"checklist",element:a.jsx(sW,{})}),a.jsx(de,{path:"delete",element:a.jsx(aW,{})}),a.jsx(de,{path:"details",element:a.jsx(lW,{})}),a.jsx(de,{path:"edit",element:a.jsx(cW,{})}),a.jsx(de,{path:"editor",element:a.jsx(tW,{})}),a.jsx(de,{path:"history",element:a.jsx(uW,{})}),a.jsx(de,{path:"json",element:a.jsx(dW,{})}),a.jsx(de,{path:"preview",element:a.jsx(fW,{})}),a.jsx(de,{path:"responses",element:a.jsx(mW,{})}),a.jsx(de,{path:"report",element:a.jsx(yW,{})}),a.jsx(de,{path:"ranges",element:a.jsx(gW,{})}),a.jsx(de,{path:"subscriptions",element:a.jsx(AW,{})}),a.jsx(de,{path:"timeline",element:a.jsx($w,{})}),a.jsx(de,{path:"profiles",element:a.jsx(OW,{})})]}),a.jsx(de,{path:"/:resourceType",element:a.jsx(Aw,{})}),a.jsx(de,{path:"/",element:a.jsx(Aw,{})})]})})}function $W(){const e=te(),t=e.getUserConfiguration(),n=Ci(),[r]=Xv();return e.isLoading()?a.jsx(Ir,{}):a.jsx(H7,{logo:a.jsx(Or,{size:24}),pathname:n.pathname,searchParams:r,version:qL,menus:FW(t),displayAddBookmark:!!(t!=null&&t.id),children:a.jsx(p.Suspense,{fallback:a.jsx(Ir,{}),children:a.jsx(LW,{})})})}function FW(e){var n;const t=((n=e==null?void 0:e.menu)==null?void 0:n.map(r=>{var o;return{title:r.title,links:((o=r.link)==null?void 0:o.map(i=>({label:i.name,href:i.target,icon:zW(i.target)})))||[]}}))||[];return t.push({title:"Settings",links:[{label:"Security",href:"/security",icon:a.jsx(z$,{})}]}),t}const zw={Patient:e7,Practitioner:L$,Organization:E$,ServiceRequest:K$,DiagnosticReport:X$,Questionnaire:M$,admin:b$,AccessPolicy:F$,Subscription:r7,batch:H$,Observation:V$};function zW(e){try{const t=new URL(e,"https://app.medplum.com").pathname.split("/")[1];if(t in zw){const n=zw[t];return a.jsx(n,{})}}catch{}return a.jsx(Tf,{w:30})}"serviceWorker"in navigator&&window.addEventListener("load",()=>{navigator.serviceWorker.getRegistrations().then(e=>Promise.all(e.map(t=>t.unregister()))).catch(e=>console.error("SW registration failed: ",e))});async function BW(){const e=_c(),t=new JL({baseUrl:e.baseUrl,clientId:e.clientId,cacheTime:6e4,autoBatchTime:100,onUnauthenticated:()=>{window.location.pathname!=="/signin"&&window.location.pathname!=="/oauth"&&(window.location.href="/signin?next="+encodeURIComponent(window.location.pathname+window.location.search))}}),n={headings:{sizes:{h1:{fontSize:"1.125rem",fontWeight:"500",lineHeight:"2.0"}}},fontSizes:{xs:"0.6875rem",sm:"0.875rem",md:"0.875rem",lg:"1.0rem",xl:"1.125rem"}},r=qU([{path:"*",element:a.jsx($W,{})}]),o=s=>r.navigate(s);kP(document.getElementById("root")).render(a.jsx(p.StrictMode,{children:a.jsx(r$,{medplum:t,navigate:o,children:a.jsxs(wS,{theme:n,children:[a.jsx(Do,{position:"bottom-right"}),a.jsx(tV,{router:r})]})})}))}BW().catch(console.error);
235
- //# sourceMappingURL=index-zIwJmiPc.js.map