@medplum/app 2.2.0 → 2.2.1
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.
|
@@ -86,7 +86,7 @@ function ZC(e,t){for(var r=0;r<t.length;r++){const n=t[r];if(typeof n!="string"&
|
|
|
86
86
|
Error generating stack: `+i.message+`
|
|
87
87
|
`+i.stack}return{value:e,source:t,stack:o,digest:null}}function fg(e,t,r){return{value:e,source:null,stack:r??null,digest:t??null}}function zv(e,t){try{console.error(t.value)}catch(r){setTimeout(function(){throw r})}}var wz=typeof WeakMap=="function"?WeakMap:Map;function I2(e,t,r){r=wo(-1,r),r.tag=3,r.payload={element:null};var n=t.value;return r.callback=function(){Gd||(Gd=!0,Kv=n),zv(e,t)},r}function D2(e,t,r){r=wo(-1,r),r.tag=3;var n=e.type.getDerivedStateFromError;if(typeof n=="function"){var o=t.value;r.payload=function(){return n(o)},r.callback=function(){zv(e,t)}}var i=e.stateNode;return i!==null&&typeof i.componentDidCatch=="function"&&(r.callback=function(){zv(e,t),typeof n!="function"&&(hi===null?hi=new Set([this]):hi.add(this));var a=t.stack;this.componentDidCatch(t.value,{componentStack:a!==null?a:""})}),r}function Xw(e,t,r){var n=e.pingCache;if(n===null){n=e.pingCache=new wz;var o=new Set;n.set(t,o)}else o=n.get(t),o===void 0&&(o=new Set,n.set(t,o));o.has(r)||(o.add(r),e=Dz.bind(null,e,t,r),t.then(e,e))}function Jw(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 Zw(e,t,r,n,o){return e.mode&1?(e.flags|=65536,e.lanes=o,e):(e===t?e.flags|=65536:(e.flags|=128,r.flags|=131072,r.flags&=-52805,r.tag===1&&(r.alternate===null?r.tag=17:(t=wo(-1,1),t.tag=2,pi(r,t,1))),r.lanes|=1),e)}var bz=No.ReactCurrentOwner,Or=!1;function pr(e,t,r,n){t.child=e===null?f2(t,null,r,n):vs(t,e.child,r,n)}function eb(e,t,r,n,o){r=r.render;var i=t.ref;return ss(t,o),n=j0(e,t,r,n,i,o),r=O0(),e!==null&&!Or?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~o,Co(e,t,o)):(pt&&r&&p0(t),t.flags|=1,pr(e,t,n,o),t.child)}function tb(e,t,r,n,o){if(e===null){var i=r.type;return typeof i=="function"&&!A0(i)&&i.defaultProps===void 0&&r.compare===null&&r.defaultProps===void 0?(t.tag=15,t.type=i,N2(e,t,i,n,o)):(e=pd(r.type,null,n,t,t.mode,o),e.ref=t.ref,e.return=t,t.child=e)}if(i=e.child,!(e.lanes&o)){var a=i.memoizedProps;if(r=r.compare,r=r!==null?r:Zl,r(a,n)&&e.ref===t.ref)return Co(e,t,o)}return t.flags|=1,e=gi(i,n),e.ref=t.ref,e.return=t,t.child=e}function N2(e,t,r,n,o){if(e!==null){var i=e.memoizedProps;if(Zl(i,n)&&e.ref===t.ref)if(Or=!1,t.pendingProps=n=i,(e.lanes&o)!==0)e.flags&131072&&(Or=!0);else return t.lanes=e.lanes,Co(e,t,o)}return Fv(e,t,r,n,o)}function A2(e,t,r){var n=t.pendingProps,o=n.children,i=e!==null?e.memoizedState:null;if(n.mode==="hidden")if(!(t.mode&1))t.memoizedState={baseLanes:0,cachePool:null,transitions:null},rt(Ja,Ur),Ur|=r;else{if(!(r&1073741824))return e=i!==null?i.baseLanes|r:r,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,rt(Ja,Ur),Ur|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},n=i!==null?i.baseLanes:r,rt(Ja,Ur),Ur|=n}else i!==null?(n=i.baseLanes|r,t.memoizedState=null):n=r,rt(Ja,Ur),Ur|=n;return pr(e,t,o,r),t.child}function M2(e,t){var r=t.ref;(e===null&&r!==null||e!==null&&e.ref!==r)&&(t.flags|=512,t.flags|=2097152)}function Fv(e,t,r,n,o){var i=$r(r)?Zi:ar.current;return i=ms(t,i),ss(t,o),r=j0(e,t,r,n,i,o),n=O0(),e!==null&&!Or?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~o,Co(e,t,o)):(pt&&n&&p0(t),t.flags|=1,pr(e,t,r,o),t.child)}function rb(e,t,r,n,o){if($r(r)){var i=!0;Md(t)}else i=!1;if(ss(t,o),t.stateNode===null)ud(e,t),u2(t,r,n),Lv(t,r,n,o),n=!0;else if(e===null){var a=t.stateNode,l=t.memoizedProps;a.props=l;var c=a.context,u=r.contextType;typeof u=="object"&&u!==null?u=fn(u):(u=$r(r)?Zi:ar.current,u=ms(t,u));var d=r.getDerivedStateFromProps,p=typeof d=="function"||typeof a.getSnapshotBeforeUpdate=="function";p||typeof a.UNSAFE_componentWillReceiveProps!="function"&&typeof a.componentWillReceiveProps!="function"||(l!==n||c!==u)&&Gw(t,a,n,u),ei=!1;var h=t.memoizedState;a.state=h,Bd(t,n,a,o),c=t.memoizedState,l!==n||h!==c||Er.current||ei?(typeof d=="function"&&(Mv(t,r,d,n),c=t.memoizedState),(l=ei||qw(t,r,l,n,h,c,u))?(p||typeof a.UNSAFE_componentWillMount!="function"&&typeof a.componentWillMount!="function"||(typeof a.componentWillMount=="function"&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount=="function"&&a.UNSAFE_componentWillMount()),typeof a.componentDidMount=="function"&&(t.flags|=4194308)):(typeof a.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=n,t.memoizedState=c),a.props=n,a.state=c,a.context=u,n=l):(typeof a.componentDidMount=="function"&&(t.flags|=4194308),n=!1)}else{a=t.stateNode,l2(e,t),l=t.memoizedProps,u=t.type===t.elementType?l:wn(t.type,l),a.props=u,p=t.pendingProps,h=a.context,c=r.contextType,typeof c=="object"&&c!==null?c=fn(c):(c=$r(r)?Zi:ar.current,c=ms(t,c));var m=r.getDerivedStateFromProps;(d=typeof m=="function"||typeof a.getSnapshotBeforeUpdate=="function")||typeof a.UNSAFE_componentWillReceiveProps!="function"&&typeof a.componentWillReceiveProps!="function"||(l!==p||h!==c)&&Gw(t,a,n,c),ei=!1,h=t.memoizedState,a.state=h,Bd(t,n,a,o);var g=t.memoizedState;l!==p||h!==g||Er.current||ei?(typeof m=="function"&&(Mv(t,r,m,n),g=t.memoizedState),(u=ei||qw(t,r,u,n,h,g,c)||!1)?(d||typeof a.UNSAFE_componentWillUpdate!="function"&&typeof a.componentWillUpdate!="function"||(typeof a.componentWillUpdate=="function"&&a.componentWillUpdate(n,g,c),typeof a.UNSAFE_componentWillUpdate=="function"&&a.UNSAFE_componentWillUpdate(n,g,c)),typeof a.componentDidUpdate=="function"&&(t.flags|=4),typeof a.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof a.componentDidUpdate!="function"||l===e.memoizedProps&&h===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!="function"||l===e.memoizedProps&&h===e.memoizedState||(t.flags|=1024),t.memoizedProps=n,t.memoizedState=g),a.props=n,a.state=g,a.context=c,n=u):(typeof a.componentDidUpdate!="function"||l===e.memoizedProps&&h===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!="function"||l===e.memoizedProps&&h===e.memoizedState||(t.flags|=1024),n=!1)}return Vv(e,t,r,n,i,o)}function Vv(e,t,r,n,o,i){M2(e,t);var a=(t.flags&128)!==0;if(!n&&!a)return o&&Vw(t,r,!1),Co(e,t,i);n=t.stateNode,bz.current=t;var l=a&&typeof r.getDerivedStateFromError!="function"?null:n.render();return t.flags|=1,e!==null&&a?(t.child=vs(t,e.child,null,i),t.child=vs(t,null,l,i)):pr(e,t,l,i),t.memoizedState=n.state,o&&Vw(t,r,!0),t.child}function L2(e){var t=e.stateNode;t.pendingContext?Fw(e,t.pendingContext,t.pendingContext!==t.context):t.context&&Fw(e,t.context,!1),b0(e,t.containerInfo)}function nb(e,t,r,n,o){return gs(),m0(o),t.flags|=256,pr(e,t,r,n),t.child}var Bv={dehydrated:null,treeContext:null,retryLane:0};function Uv(e){return{baseLanes:e,cachePool:null,transitions:null}}function z2(e,t,r){var n=t.pendingProps,o=yt.current,i=!1,a=(t.flags&128)!==0,l;if((l=a)||(l=e!==null&&e.memoizedState===null?!1:(o&2)!==0),l?(i=!0,t.flags&=-129):(e===null||e.memoizedState!==null)&&(o|=1),rt(yt,o&1),e===null)return Nv(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):(a=n.children,e=n.fallback,i?(n=t.mode,i=t.child,a={mode:"hidden",children:a},!(n&1)&&i!==null?(i.childLanes=0,i.pendingProps=a):i=Yh(a,n,0,null),e=Xi(e,n,r,null),i.return=t,e.return=t,i.sibling=e,t.child=i,t.child.memoizedState=Uv(r),t.memoizedState=Bv,e):$0(t,a));if(o=e.memoizedState,o!==null&&(l=o.dehydrated,l!==null))return _z(e,t,a,n,l,o,r);if(i){i=n.fallback,a=t.mode,o=e.child,l=o.sibling;var c={mode:"hidden",children:n.children};return!(a&1)&&t.child!==o?(n=t.child,n.childLanes=0,n.pendingProps=c,t.deletions=null):(n=gi(o,c),n.subtreeFlags=o.subtreeFlags&14680064),l!==null?i=gi(l,i):(i=Xi(i,a,r,null),i.flags|=2),i.return=t,n.return=t,n.sibling=i,t.child=n,n=i,i=t.child,a=e.child.memoizedState,a=a===null?Uv(r):{baseLanes:a.baseLanes|r,cachePool:null,transitions:a.transitions},i.memoizedState=a,i.childLanes=e.childLanes&~r,t.memoizedState=Bv,n}return i=e.child,e=i.sibling,n=gi(i,{mode:"visible",children:n.children}),!(t.mode&1)&&(n.lanes=r),n.return=t,n.sibling=null,e!==null&&(r=t.deletions,r===null?(t.deletions=[e],t.flags|=16):r.push(e)),t.child=n,t.memoizedState=null,n}function $0(e,t){return t=Yh({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function vu(e,t,r,n){return n!==null&&m0(n),vs(t,e.child,null,r),e=$0(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function _z(e,t,r,n,o,i,a){if(r)return t.flags&256?(t.flags&=-257,n=fg(Error(q(422))),vu(e,t,a,n)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(i=n.fallback,o=t.mode,n=Yh({mode:"visible",children:n.children},o,0,null),i=Xi(i,o,a,null),i.flags|=2,n.return=t,i.return=t,n.sibling=i,t.child=n,t.mode&1&&vs(t,e.child,null,a),t.child.memoizedState=Uv(a),t.memoizedState=Bv,i);if(!(t.mode&1))return vu(e,t,a,null);if(o.data==="$!"){if(n=o.nextSibling&&o.nextSibling.dataset,n)var l=n.dgst;return n=l,i=Error(q(419)),n=fg(i,n,void 0),vu(e,t,a,n)}if(l=(a&e.childLanes)!==0,Or||l){if(n=Bt,n!==null){switch(a&-a){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&(n.suspendedLanes|a)?0:o,o!==0&&o!==i.retryLane&&(i.retryLane=o,Oo(e,o),On(n,e,o,-1))}return N0(),n=fg(Error(q(421))),vu(e,t,a,n)}return o.data==="$?"?(t.flags|=128,t.child=e.child,t=Nz.bind(null,e),o._reactRetry=t,null):(e=i.treeContext,Hr=fi(o.nextSibling),Gr=t,pt=!0,Sn=null,e!==null&&(nn[on++]=vo,nn[on++]=yo,nn[on++]=ea,vo=e.id,yo=e.overflow,ea=t),t=$0(t,n.children),t.flags|=4096,t)}function ob(e,t,r){e.lanes|=t;var n=e.alternate;n!==null&&(n.lanes|=t),Av(e.return,t,r)}function pg(e,t,r,n,o){var i=e.memoizedState;i===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:n,tail:r,tailMode:o}:(i.isBackwards=t,i.rendering=null,i.renderingStartTime=0,i.last=n,i.tail=r,i.tailMode=o)}function F2(e,t,r){var n=t.pendingProps,o=n.revealOrder,i=n.tail;if(pr(e,t,n.children,r),n=yt.current,n&2)n=n&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&&ob(e,r,t);else if(e.tag===19)ob(e,r,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}n&=1}if(rt(yt,n),!(t.mode&1))t.memoizedState=null;else switch(o){case"forwards":for(r=t.child,o=null;r!==null;)e=r.alternate,e!==null&&Ud(e)===null&&(o=r),r=r.sibling;r=o,r===null?(o=t.child,t.child=null):(o=r.sibling,r.sibling=null),pg(t,!1,o,r,i);break;case"backwards":for(r=null,o=t.child,t.child=null;o!==null;){if(e=o.alternate,e!==null&&Ud(e)===null){t.child=o;break}e=o.sibling,o.sibling=r,r=o,o=e}pg(t,!0,r,null,i);break;case"together":pg(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function ud(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function Co(e,t,r){if(e!==null&&(t.dependencies=e.dependencies),ra|=t.lanes,!(r&t.childLanes))return null;if(e!==null&&t.child!==e.child)throw Error(q(153));if(t.child!==null){for(e=t.child,r=gi(e,e.pendingProps),t.child=r,r.return=t;e.sibling!==null;)e=e.sibling,r=r.sibling=gi(e,e.pendingProps),r.return=t;r.sibling=null}return t.child}function Sz(e,t,r){switch(t.tag){case 3:L2(t),gs();break;case 5:p2(t);break;case 1:$r(t.type)&&Md(t);break;case 4:b0(t,t.stateNode.containerInfo);break;case 10:var n=t.type._context,o=t.memoizedProps.value;rt(Fd,n._currentValue),n._currentValue=o;break;case 13:if(n=t.memoizedState,n!==null)return n.dehydrated!==null?(rt(yt,yt.current&1),t.flags|=128,null):r&t.child.childLanes?z2(e,t,r):(rt(yt,yt.current&1),e=Co(e,t,r),e!==null?e.sibling:null);rt(yt,yt.current&1);break;case 19:if(n=(r&t.childLanes)!==0,e.flags&128){if(n)return F2(e,t,r);t.flags|=128}if(o=t.memoizedState,o!==null&&(o.rendering=null,o.tail=null,o.lastEffect=null),rt(yt,yt.current),n)break;return null;case 22:case 23:return t.lanes=0,A2(e,t,r)}return Co(e,t,r)}var V2,Wv,B2,U2;V2=function(e,t){for(var r=t.child;r!==null;){if(r.tag===5||r.tag===6)e.appendChild(r.stateNode);else if(r.tag!==4&&r.child!==null){r.child.return=r,r=r.child;continue}if(r===t)break;for(;r.sibling===null;){if(r.return===null||r.return===t)return;r=r.return}r.sibling.return=r.return,r=r.sibling}};Wv=function(){};B2=function(e,t,r,n){var o=e.memoizedProps;if(o!==n){e=t.stateNode,Gi(Jn.current);var i=null;switch(r){case"input":o=fv(e,o),n=fv(e,n),i=[];break;case"select":o=wt({},o,{value:void 0}),n=wt({},n,{value:void 0}),i=[];break;case"textarea":o=mv(e,o),n=mv(e,n),i=[];break;default:typeof o.onClick!="function"&&typeof n.onClick=="function"&&(e.onclick=Nd)}vv(r,n);var a;r=null;for(u in o)if(!n.hasOwnProperty(u)&&o.hasOwnProperty(u)&&o[u]!=null)if(u==="style"){var l=o[u];for(a in l)l.hasOwnProperty(a)&&(r||(r={}),r[a]="")}else u!=="dangerouslySetInnerHTML"&&u!=="children"&&u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&u!=="autoFocus"&&(ql.hasOwnProperty(u)?i||(i=[]):(i=i||[]).push(u,null));for(u in n){var c=n[u];if(l=o!=null?o[u]:void 0,n.hasOwnProperty(u)&&c!==l&&(c!=null||l!=null))if(u==="style")if(l){for(a in l)!l.hasOwnProperty(a)||c&&c.hasOwnProperty(a)||(r||(r={}),r[a]="");for(a in c)c.hasOwnProperty(a)&&l[a]!==c[a]&&(r||(r={}),r[a]=c[a])}else r||(i||(i=[]),i.push(u,r)),r=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"&&(ql.hasOwnProperty(u)?(c!=null&&u==="onScroll"&&at("scroll",e),i||l===c||(i=[])):(i=i||[]).push(u,c))}r&&(i=i||[]).push("style",r);var u=i;(t.updateQueue=u)&&(t.flags|=4)}};U2=function(e,t,r,n){r!==n&&(t.flags|=4)};function rl(e,t){if(!pt)switch(e.tailMode){case"hidden":t=e.tail;for(var r=null;t!==null;)t.alternate!==null&&(r=t),t=t.sibling;r===null?e.tail=null:r.sibling=null;break;case"collapsed":r=e.tail;for(var n=null;r!==null;)r.alternate!==null&&(n=r),r=r.sibling;n===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:n.sibling=null}}function er(e){var t=e.alternate!==null&&e.alternate.child===e.child,r=0,n=0;if(t)for(var o=e.child;o!==null;)r|=o.lanes|o.childLanes,n|=o.subtreeFlags&14680064,n|=o.flags&14680064,o.return=e,o=o.sibling;else for(o=e.child;o!==null;)r|=o.lanes|o.childLanes,n|=o.subtreeFlags,n|=o.flags,o.return=e,o=o.sibling;return e.subtreeFlags|=n,e.childLanes=r,t}function Pz(e,t,r){var n=t.pendingProps;switch(h0(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return er(t),null;case 1:return $r(t.type)&&Ad(),er(t),null;case 3:return n=t.stateNode,ys(),lt(Er),lt(ar),S0(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(mu(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,Sn!==null&&(Jv(Sn),Sn=null))),Wv(e,t),er(t),null;case 5:_0(t);var o=Gi(oc.current);if(r=t.type,e!==null&&t.stateNode!=null)B2(e,t,r,n,o),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!n){if(t.stateNode===null)throw Error(q(166));return er(t),null}if(e=Gi(Jn.current),mu(t)){n=t.stateNode,r=t.type;var i=t.memoizedProps;switch(n[Qn]=t,n[rc]=i,e=(t.mode&1)!==0,r){case"dialog":at("cancel",n),at("close",n);break;case"iframe":case"object":case"embed":at("load",n);break;case"video":case"audio":for(o=0;o<Sl.length;o++)at(Sl[o],n);break;case"source":at("error",n);break;case"img":case"image":case"link":at("error",n),at("load",n);break;case"details":at("toggle",n);break;case"input":pw(n,i),at("invalid",n);break;case"select":n._wrapperState={wasMultiple:!!i.multiple},at("invalid",n);break;case"textarea":mw(n,i),at("invalid",n)}vv(r,i),o=null;for(var a in i)if(i.hasOwnProperty(a)){var l=i[a];a==="children"?typeof l=="string"?n.textContent!==l&&(i.suppressHydrationWarning!==!0&&hu(n.textContent,l,e),o=["children",l]):typeof l=="number"&&n.textContent!==""+l&&(i.suppressHydrationWarning!==!0&&hu(n.textContent,l,e),o=["children",""+l]):ql.hasOwnProperty(a)&&l!=null&&a==="onScroll"&&at("scroll",n)}switch(r){case"input":au(n),hw(n,i,!0);break;case"textarea":au(n),gw(n);break;case"select":case"option":break;default:typeof i.onClick=="function"&&(n.onclick=Nd)}n=o,t.updateQueue=n,n!==null&&(t.flags|=4)}else{a=o.nodeType===9?o:o.ownerDocument,e==="http://www.w3.org/1999/xhtml"&&(e=g$(r)),e==="http://www.w3.org/1999/xhtml"?r==="script"?(e=a.createElement("div"),e.innerHTML="<script><\/script>",e=e.removeChild(e.firstChild)):typeof n.is=="string"?e=a.createElement(r,{is:n.is}):(e=a.createElement(r),r==="select"&&(a=e,n.multiple?a.multiple=!0:n.size&&(a.size=n.size))):e=a.createElementNS(e,r),e[Qn]=t,e[rc]=n,V2(e,t,!1,!1),t.stateNode=e;e:{switch(a=yv(r,n),r){case"dialog":at("cancel",e),at("close",e),o=n;break;case"iframe":case"object":case"embed":at("load",e),o=n;break;case"video":case"audio":for(o=0;o<Sl.length;o++)at(Sl[o],e);o=n;break;case"source":at("error",e),o=n;break;case"img":case"image":case"link":at("error",e),at("load",e),o=n;break;case"details":at("toggle",e),o=n;break;case"input":pw(e,n),o=fv(e,n),at("invalid",e);break;case"option":o=n;break;case"select":e._wrapperState={wasMultiple:!!n.multiple},o=wt({},n,{value:void 0}),at("invalid",e);break;case"textarea":mw(e,n),o=mv(e,n),at("invalid",e);break;default:o=n}vv(r,o),l=o;for(i in l)if(l.hasOwnProperty(i)){var c=l[i];i==="style"?x$(e,c):i==="dangerouslySetInnerHTML"?(c=c?c.__html:void 0,c!=null&&v$(e,c)):i==="children"?typeof c=="string"?(r!=="textarea"||c!=="")&&Gl(e,c):typeof c=="number"&&Gl(e,""+c):i!=="suppressContentEditableWarning"&&i!=="suppressHydrationWarning"&&i!=="autoFocus"&&(ql.hasOwnProperty(i)?c!=null&&i==="onScroll"&&at("scroll",e):c!=null&&Zy(e,i,c,a))}switch(r){case"input":au(e),hw(e,n,!1);break;case"textarea":au(e),gw(e);break;case"option":n.value!=null&&e.setAttribute("value",""+xi(n.value));break;case"select":e.multiple=!!n.multiple,i=n.value,i!=null?ns(e,!!n.multiple,i,!1):n.defaultValue!=null&&ns(e,!!n.multiple,n.defaultValue,!0);break;default:typeof o.onClick=="function"&&(e.onclick=Nd)}switch(r){case"button":case"input":case"select":case"textarea":n=!!n.autoFocus;break e;case"img":n=!0;break e;default:n=!1}}n&&(t.flags|=4)}t.ref!==null&&(t.flags|=512,t.flags|=2097152)}return er(t),null;case 6:if(e&&t.stateNode!=null)U2(e,t,e.memoizedProps,n);else{if(typeof n!="string"&&t.stateNode===null)throw Error(q(166));if(r=Gi(oc.current),Gi(Jn.current),mu(t)){if(n=t.stateNode,r=t.memoizedProps,n[Qn]=t,(i=n.nodeValue!==r)&&(e=Gr,e!==null))switch(e.tag){case 3:hu(n.nodeValue,r,(e.mode&1)!==0);break;case 5:e.memoizedProps.suppressHydrationWarning!==!0&&hu(n.nodeValue,r,(e.mode&1)!==0)}i&&(t.flags|=4)}else n=(r.nodeType===9?r:r.ownerDocument).createTextNode(n),n[Qn]=t,t.stateNode=n}return er(t),null;case 13:if(lt(yt),n=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(pt&&Hr!==null&&t.mode&1&&!(t.flags&128))a2(),gs(),t.flags|=98560,i=!1;else if(i=mu(t),n!==null&&n.dehydrated!==null){if(e===null){if(!i)throw Error(q(318));if(i=t.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(q(317));i[Qn]=t}else gs(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;er(t),i=!1}else Sn!==null&&(Jv(Sn),Sn=null),i=!0;if(!i)return t.flags&65536?t:null}return t.flags&128?(t.lanes=r,t):(n=n!==null,n!==(e!==null&&e.memoizedState!==null)&&n&&(t.child.flags|=8192,t.mode&1&&(e===null||yt.current&1?zt===0&&(zt=3):N0())),t.updateQueue!==null&&(t.flags|=4),er(t),null);case 4:return ys(),Wv(e,t),e===null&&ec(t.stateNode.containerInfo),er(t),null;case 10:return y0(t.type._context),er(t),null;case 17:return $r(t.type)&&Ad(),er(t),null;case 19:if(lt(yt),i=t.memoizedState,i===null)return er(t),null;if(n=(t.flags&128)!==0,a=i.rendering,a===null)if(n)rl(i,!1);else{if(zt!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(a=Ud(e),a!==null){for(t.flags|=128,rl(i,!1),n=a.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),t.subtreeFlags=0,n=r,r=t.child;r!==null;)i=r,e=n,i.flags&=14680066,a=i.alternate,a===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=a.childLanes,i.lanes=a.lanes,i.child=a.child,i.subtreeFlags=0,i.deletions=null,i.memoizedProps=a.memoizedProps,i.memoizedState=a.memoizedState,i.updateQueue=a.updateQueue,i.type=a.type,e=a.dependencies,i.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext}),r=r.sibling;return rt(yt,yt.current&1|2),t.child}e=e.sibling}i.tail!==null&&$t()>ws&&(t.flags|=128,n=!0,rl(i,!1),t.lanes=4194304)}else{if(!n)if(e=Ud(a),e!==null){if(t.flags|=128,n=!0,r=e.updateQueue,r!==null&&(t.updateQueue=r,t.flags|=4),rl(i,!0),i.tail===null&&i.tailMode==="hidden"&&!a.alternate&&!pt)return er(t),null}else 2*$t()-i.renderingStartTime>ws&&r!==1073741824&&(t.flags|=128,n=!0,rl(i,!1),t.lanes=4194304);i.isBackwards?(a.sibling=t.child,t.child=a):(r=i.last,r!==null?r.sibling=a:t.child=a,i.last=a)}return i.tail!==null?(t=i.tail,i.rendering=t,i.tail=t.sibling,i.renderingStartTime=$t(),t.sibling=null,r=yt.current,rt(yt,n?r&1|2:r&1),t):(er(t),null);case 22:case 23:return D0(),n=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==n&&(t.flags|=8192),n&&t.mode&1?Ur&1073741824&&(er(t),t.subtreeFlags&6&&(t.flags|=8192)):er(t),null;case 24:return null;case 25:return null}throw Error(q(156,t.tag))}function jz(e,t){switch(h0(t),t.tag){case 1:return $r(t.type)&&Ad(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return ys(),lt(Er),lt(ar),S0(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return _0(t),null;case 13:if(lt(yt),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(q(340));gs()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return lt(yt),null;case 4:return ys(),null;case 10:return y0(t.type._context),null;case 22:case 23:return D0(),null;case 24:return null;default:return null}}var yu=!1,rr=!1,Oz=typeof WeakSet=="function"?WeakSet:Set,se=null;function Xa(e,t){var r=e.ref;if(r!==null)if(typeof r=="function")try{r(null)}catch(n){St(e,t,n)}else r.current=null}function Hv(e,t,r){try{r()}catch(n){St(e,t,n)}}var ib=!1;function Cz(e,t){if(Ev=Td,e=G$(),f0(e)){if("selectionStart"in e)var r={start:e.selectionStart,end:e.selectionEnd};else e:{r=(r=e.ownerDocument)&&r.defaultView||window;var n=r.getSelection&&r.getSelection();if(n&&n.rangeCount!==0){r=n.anchorNode;var o=n.anchorOffset,i=n.focusNode;n=n.focusOffset;try{r.nodeType,i.nodeType}catch{r=null;break e}var a=0,l=-1,c=-1,u=0,d=0,p=e,h=null;t:for(;;){for(var m;p!==r||o!==0&&p.nodeType!==3||(l=a+o),p!==i||n!==0&&p.nodeType!==3||(c=a+n),p.nodeType===3&&(a+=p.nodeValue.length),(m=p.firstChild)!==null;)h=p,p=m;for(;;){if(p===e)break t;if(h===r&&++u===o&&(l=a),h===i&&++d===n&&(c=a),(m=p.nextSibling)!==null)break;p=h,h=p.parentNode}p=m}r=l===-1||c===-1?null:{start:l,end:c}}else r=null}r=r||{start:0,end:0}}else r=null;for($v={focusedElem:e,selectionRange:r},Td=!1,se=t;se!==null;)if(t=se,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,se=e;else for(;se!==null;){t=se;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 v=g.memoizedProps,_=g.memoizedState,y=t.stateNode,x=y.getSnapshotBeforeUpdate(t.elementType===t.type?v:wn(t.type,v),_);y.__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(q(163))}}catch(b){St(t,t.return,b)}if(e=t.sibling,e!==null){e.return=t.return,se=e;break}se=t.return}return g=ib,ib=!1,g}function Dl(e,t,r){var n=t.updateQueue;if(n=n!==null?n.lastEffect:null,n!==null){var o=n=n.next;do{if((o.tag&e)===e){var i=o.destroy;o.destroy=void 0,i!==void 0&&Hv(t,r,i)}o=o.next}while(o!==n)}}function Qh(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var r=t=t.next;do{if((r.tag&e)===e){var n=r.create;r.destroy=n()}r=r.next}while(r!==t)}}function qv(e){var t=e.ref;if(t!==null){var r=e.stateNode;switch(e.tag){case 5:e=r;break;default:e=r}typeof t=="function"?t(e):t.current=e}}function W2(e){var t=e.alternate;t!==null&&(e.alternate=null,W2(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Qn],delete t[rc],delete t[Tv],delete t[cz],delete t[uz])),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 H2(e){return e.tag===5||e.tag===3||e.tag===4}function ab(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||H2(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 Gv(e,t,r){var n=e.tag;if(n===5||n===6)e=e.stateNode,t?r.nodeType===8?r.parentNode.insertBefore(e,t):r.insertBefore(e,t):(r.nodeType===8?(t=r.parentNode,t.insertBefore(e,r)):(t=r,t.appendChild(e)),r=r._reactRootContainer,r!=null||t.onclick!==null||(t.onclick=Nd));else if(n!==4&&(e=e.child,e!==null))for(Gv(e,t,r),e=e.sibling;e!==null;)Gv(e,t,r),e=e.sibling}function Qv(e,t,r){var n=e.tag;if(n===5||n===6)e=e.stateNode,t?r.insertBefore(e,t):r.appendChild(e);else if(n!==4&&(e=e.child,e!==null))for(Qv(e,t,r),e=e.sibling;e!==null;)Qv(e,t,r),e=e.sibling}var Gt=null,bn=!1;function Ko(e,t,r){for(r=r.child;r!==null;)q2(e,t,r),r=r.sibling}function q2(e,t,r){if(Xn&&typeof Xn.onCommitFiberUnmount=="function")try{Xn.onCommitFiberUnmount(Fh,r)}catch{}switch(r.tag){case 5:rr||Xa(r,t);case 6:var n=Gt,o=bn;Gt=null,Ko(e,t,r),Gt=n,bn=o,Gt!==null&&(bn?(e=Gt,r=r.stateNode,e.nodeType===8?e.parentNode.removeChild(r):e.removeChild(r)):Gt.removeChild(r.stateNode));break;case 18:Gt!==null&&(bn?(e=Gt,r=r.stateNode,e.nodeType===8?ag(e.parentNode,r):e.nodeType===1&&ag(e,r),Xl(e)):ag(Gt,r.stateNode));break;case 4:n=Gt,o=bn,Gt=r.stateNode.containerInfo,bn=!0,Ko(e,t,r),Gt=n,bn=o;break;case 0:case 11:case 14:case 15:if(!rr&&(n=r.updateQueue,n!==null&&(n=n.lastEffect,n!==null))){o=n=n.next;do{var i=o,a=i.destroy;i=i.tag,a!==void 0&&(i&2||i&4)&&Hv(r,t,a),o=o.next}while(o!==n)}Ko(e,t,r);break;case 1:if(!rr&&(Xa(r,t),n=r.stateNode,typeof n.componentWillUnmount=="function"))try{n.props=r.memoizedProps,n.state=r.memoizedState,n.componentWillUnmount()}catch(l){St(r,t,l)}Ko(e,t,r);break;case 21:Ko(e,t,r);break;case 22:r.mode&1?(rr=(n=rr)||r.memoizedState!==null,Ko(e,t,r),rr=n):Ko(e,t,r);break;default:Ko(e,t,r)}}function sb(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var r=e.stateNode;r===null&&(r=e.stateNode=new Oz),t.forEach(function(n){var o=Az.bind(null,e,n);r.has(n)||(r.add(n),n.then(o,o))})}}function yn(e,t){var r=t.deletions;if(r!==null)for(var n=0;n<r.length;n++){var o=r[n];try{var i=e,a=t,l=a;e:for(;l!==null;){switch(l.tag){case 5:Gt=l.stateNode,bn=!1;break e;case 3:Gt=l.stateNode.containerInfo,bn=!0;break e;case 4:Gt=l.stateNode.containerInfo,bn=!0;break e}l=l.return}if(Gt===null)throw Error(q(160));q2(i,a,o),Gt=null,bn=!1;var c=o.alternate;c!==null&&(c.return=null),o.return=null}catch(u){St(o,t,u)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)G2(t,e),t=t.sibling}function G2(e,t){var r=e.alternate,n=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(yn(t,e),Fn(e),n&4){try{Dl(3,e,e.return),Qh(3,e)}catch(v){St(e,e.return,v)}try{Dl(5,e,e.return)}catch(v){St(e,e.return,v)}}break;case 1:yn(t,e),Fn(e),n&512&&r!==null&&Xa(r,r.return);break;case 5:if(yn(t,e),Fn(e),n&512&&r!==null&&Xa(r,r.return),e.flags&32){var o=e.stateNode;try{Gl(o,"")}catch(v){St(e,e.return,v)}}if(n&4&&(o=e.stateNode,o!=null)){var i=e.memoizedProps,a=r!==null?r.memoizedProps:i,l=e.type,c=e.updateQueue;if(e.updateQueue=null,c!==null)try{l==="input"&&i.type==="radio"&&i.name!=null&&h$(o,i),yv(l,a);var u=yv(l,i);for(a=0;a<c.length;a+=2){var d=c[a],p=c[a+1];d==="style"?x$(o,p):d==="dangerouslySetInnerHTML"?v$(o,p):d==="children"?Gl(o,p):Zy(o,d,p,u)}switch(l){case"input":pv(o,i);break;case"textarea":m$(o,i);break;case"select":var h=o._wrapperState.wasMultiple;o._wrapperState.wasMultiple=!!i.multiple;var m=i.value;m!=null?ns(o,!!i.multiple,m,!1):h!==!!i.multiple&&(i.defaultValue!=null?ns(o,!!i.multiple,i.defaultValue,!0):ns(o,!!i.multiple,i.multiple?[]:"",!1))}o[rc]=i}catch(v){St(e,e.return,v)}}break;case 6:if(yn(t,e),Fn(e),n&4){if(e.stateNode===null)throw Error(q(162));o=e.stateNode,i=e.memoizedProps;try{o.nodeValue=i}catch(v){St(e,e.return,v)}}break;case 3:if(yn(t,e),Fn(e),n&4&&r!==null&&r.memoizedState.isDehydrated)try{Xl(t.containerInfo)}catch(v){St(e,e.return,v)}break;case 4:yn(t,e),Fn(e);break;case 13:yn(t,e),Fn(e),o=e.child,o.flags&8192&&(i=o.memoizedState!==null,o.stateNode.isHidden=i,!i||o.alternate!==null&&o.alternate.memoizedState!==null||(T0=$t())),n&4&&sb(e);break;case 22:if(d=r!==null&&r.memoizedState!==null,e.mode&1?(rr=(u=rr)||d,yn(t,e),rr=u):yn(t,e),Fn(e),n&8192){if(u=e.memoizedState!==null,(e.stateNode.isHidden=u)&&!d&&e.mode&1)for(se=e,d=e.child;d!==null;){for(p=se=d;se!==null;){switch(h=se,m=h.child,h.tag){case 0:case 11:case 14:case 15:Dl(4,h,h.return);break;case 1:Xa(h,h.return);var g=h.stateNode;if(typeof g.componentWillUnmount=="function"){n=h,r=h.return;try{t=n,g.props=t.memoizedProps,g.state=t.memoizedState,g.componentWillUnmount()}catch(v){St(n,r,v)}}break;case 5:Xa(h,h.return);break;case 22:if(h.memoizedState!==null){cb(p);continue}}m!==null?(m.return=h,se=m):cb(p)}d=d.sibling}e:for(d=null,p=e;;){if(p.tag===5){if(d===null){d=p;try{o=p.stateNode,u?(i=o.style,typeof i.setProperty=="function"?i.setProperty("display","none","important"):i.display="none"):(l=p.stateNode,c=p.memoizedProps.style,a=c!=null&&c.hasOwnProperty("display")?c.display:null,l.style.display=y$("display",a))}catch(v){St(e,e.return,v)}}}else if(p.tag===6){if(d===null)try{p.stateNode.nodeValue=u?"":p.memoizedProps}catch(v){St(e,e.return,v)}}else if((p.tag!==22&&p.tag!==23||p.memoizedState===null||p===e)&&p.child!==null){p.child.return=p,p=p.child;continue}if(p===e)break e;for(;p.sibling===null;){if(p.return===null||p.return===e)break e;d===p&&(d=null),p=p.return}d===p&&(d=null),p.sibling.return=p.return,p=p.sibling}}break;case 19:yn(t,e),Fn(e),n&4&&sb(e);break;case 21:break;default:yn(t,e),Fn(e)}}function Fn(e){var t=e.flags;if(t&2){try{e:{for(var r=e.return;r!==null;){if(H2(r)){var n=r;break e}r=r.return}throw Error(q(160))}switch(n.tag){case 5:var o=n.stateNode;n.flags&32&&(Gl(o,""),n.flags&=-33);var i=ab(e);Qv(e,i,o);break;case 3:case 4:var a=n.stateNode.containerInfo,l=ab(e);Gv(e,l,a);break;default:throw Error(q(161))}}catch(c){St(e,e.return,c)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function Ez(e,t,r){se=e,Q2(e)}function Q2(e,t,r){for(var n=(e.mode&1)!==0;se!==null;){var o=se,i=o.child;if(o.tag===22&&n){var a=o.memoizedState!==null||yu;if(!a){var l=o.alternate,c=l!==null&&l.memoizedState!==null||rr;l=yu;var u=rr;if(yu=a,(rr=c)&&!u)for(se=o;se!==null;)a=se,c=a.child,a.tag===22&&a.memoizedState!==null?ub(o):c!==null?(c.return=a,se=c):ub(o);for(;i!==null;)se=i,Q2(i),i=i.sibling;se=o,yu=l,rr=u}lb(e)}else o.subtreeFlags&8772&&i!==null?(i.return=o,se=i):lb(e)}}function lb(e){for(;se!==null;){var t=se;if(t.flags&8772){var r=t.alternate;try{if(t.flags&8772)switch(t.tag){case 0:case 11:case 15:rr||Qh(5,t);break;case 1:var n=t.stateNode;if(t.flags&4&&!rr)if(r===null)n.componentDidMount();else{var o=t.elementType===t.type?r.memoizedProps:wn(t.type,r.memoizedProps);n.componentDidUpdate(o,r.memoizedState,n.__reactInternalSnapshotBeforeUpdate)}var i=t.updateQueue;i!==null&&Hw(t,i,n);break;case 3:var a=t.updateQueue;if(a!==null){if(r=null,t.child!==null)switch(t.child.tag){case 5:r=t.child.stateNode;break;case 1:r=t.child.stateNode}Hw(t,a,r)}break;case 5:var l=t.stateNode;if(r===null&&t.flags&4){r=l;var c=t.memoizedProps;switch(t.type){case"button":case"input":case"select":case"textarea":c.autoFocus&&r.focus();break;case"img":c.src&&(r.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 p=d.dehydrated;p!==null&&Xl(p)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(q(163))}rr||t.flags&512&&qv(t)}catch(h){St(t,t.return,h)}}if(t===e){se=null;break}if(r=t.sibling,r!==null){r.return=t.return,se=r;break}se=t.return}}function cb(e){for(;se!==null;){var t=se;if(t===e){se=null;break}var r=t.sibling;if(r!==null){r.return=t.return,se=r;break}se=t.return}}function ub(e){for(;se!==null;){var t=se;try{switch(t.tag){case 0:case 11:case 15:var r=t.return;try{Qh(4,t)}catch(c){St(t,r,c)}break;case 1:var n=t.stateNode;if(typeof n.componentDidMount=="function"){var o=t.return;try{n.componentDidMount()}catch(c){St(t,o,c)}}var i=t.return;try{qv(t)}catch(c){St(t,i,c)}break;case 5:var a=t.return;try{qv(t)}catch(c){St(t,a,c)}}}catch(c){St(t,t.return,c)}if(t===e){se=null;break}var l=t.sibling;if(l!==null){l.return=t.return,se=l;break}se=t.return}}var $z=Math.ceil,qd=No.ReactCurrentDispatcher,k0=No.ReactCurrentOwner,cn=No.ReactCurrentBatchConfig,Ae=0,Bt=null,Dt=null,Yt=0,Ur=0,Ja=Ci(0),zt=0,lc=null,ra=0,Kh=0,R0=0,Nl=null,jr=null,T0=0,ws=1/0,ho=null,Gd=!1,Kv=null,hi=null,xu=!1,ai=null,Qd=0,Al=0,Yv=null,dd=-1,fd=0;function gr(){return Ae&6?$t():dd!==-1?dd:dd=$t()}function mi(e){return e.mode&1?Ae&2&&Yt!==0?Yt&-Yt:fz.transition!==null?(fd===0&&(fd=R$()),fd):(e=He,e!==0||(e=window.event,e=e===void 0?16:L$(e.type)),e):1}function On(e,t,r,n){if(50<Al)throw Al=0,Yv=null,Error(q(185));Pc(e,r,n),(!(Ae&2)||e!==Bt)&&(e===Bt&&(!(Ae&2)&&(Kh|=r),zt===4&&oi(e,Yt)),kr(e,n),r===1&&Ae===0&&!(t.mode&1)&&(ws=$t()+500,Hh&&Ei()))}function kr(e,t){var r=e.callbackNode;f7(e,t);var n=Rd(e,e===Bt?Yt:0);if(n===0)r!==null&&xw(r),e.callbackNode=null,e.callbackPriority=0;else if(t=n&-n,e.callbackPriority!==t){if(r!=null&&xw(r),t===1)e.tag===0?dz(db.bind(null,e)):n2(db.bind(null,e)),sz(function(){!(Ae&6)&&Ei()}),r=null;else{switch(T$(n)){case 1:r=o0;break;case 4:r=$$;break;case 16:r=kd;break;case 536870912:r=k$;break;default:r=kd}r=rk(r,K2.bind(null,e))}e.callbackPriority=t,e.callbackNode=r}}function K2(e,t){if(dd=-1,fd=0,Ae&6)throw Error(q(327));var r=e.callbackNode;if(ls()&&e.callbackNode!==r)return null;var n=Rd(e,e===Bt?Yt:0);if(n===0)return null;if(n&30||n&e.expiredLanes||t)t=Kd(e,n);else{t=n;var o=Ae;Ae|=2;var i=X2();(Bt!==e||Yt!==t)&&(ho=null,ws=$t()+500,Yi(e,t));do try{Tz();break}catch(l){Y2(e,l)}while(!0);v0(),qd.current=i,Ae=o,Dt!==null?t=0:(Bt=null,Yt=0,t=zt)}if(t!==0){if(t===2&&(o=Sv(e),o!==0&&(n=o,t=Xv(e,o))),t===1)throw r=lc,Yi(e,0),oi(e,n),kr(e,$t()),r;if(t===6)oi(e,n);else{if(o=e.current.alternate,!(n&30)&&!kz(o)&&(t=Kd(e,n),t===2&&(i=Sv(e),i!==0&&(n=i,t=Xv(e,i))),t===1))throw r=lc,Yi(e,0),oi(e,n),kr(e,$t()),r;switch(e.finishedWork=o,e.finishedLanes=n,t){case 0:case 1:throw Error(q(345));case 2:Fi(e,jr,ho);break;case 3:if(oi(e,n),(n&130023424)===n&&(t=T0+500-$t(),10<t)){if(Rd(e,0)!==0)break;if(o=e.suspendedLanes,(o&n)!==n){gr(),e.pingedLanes|=e.suspendedLanes&o;break}e.timeoutHandle=Rv(Fi.bind(null,e,jr,ho),t);break}Fi(e,jr,ho);break;case 4:if(oi(e,n),(n&4194240)===n)break;for(t=e.eventTimes,o=-1;0<n;){var a=31-jn(n);i=1<<a,a=t[a],a>o&&(o=a),n&=~i}if(n=o,n=$t()-n,n=(120>n?120:480>n?480:1080>n?1080:1920>n?1920:3e3>n?3e3:4320>n?4320:1960*$z(n/1960))-n,10<n){e.timeoutHandle=Rv(Fi.bind(null,e,jr,ho),n);break}Fi(e,jr,ho);break;case 5:Fi(e,jr,ho);break;default:throw Error(q(329))}}}return kr(e,$t()),e.callbackNode===r?K2.bind(null,e):null}function Xv(e,t){var r=Nl;return e.current.memoizedState.isDehydrated&&(Yi(e,t).flags|=256),e=Kd(e,t),e!==2&&(t=jr,jr=r,t!==null&&Jv(t)),e}function Jv(e){jr===null?jr=e:jr.push.apply(jr,e)}function kz(e){for(var t=e;;){if(t.flags&16384){var r=t.updateQueue;if(r!==null&&(r=r.stores,r!==null))for(var n=0;n<r.length;n++){var o=r[n],i=o.getSnapshot;o=o.value;try{if(!Cn(i(),o))return!1}catch{return!1}}}if(r=t.child,t.subtreeFlags&16384&&r!==null)r.return=t,t=r;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 oi(e,t){for(t&=~R0,t&=~Kh,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var r=31-jn(t),n=1<<r;e[r]=-1,t&=~n}}function db(e){if(Ae&6)throw Error(q(327));ls();var t=Rd(e,0);if(!(t&1))return kr(e,$t()),null;var r=Kd(e,t);if(e.tag!==0&&r===2){var n=Sv(e);n!==0&&(t=n,r=Xv(e,n))}if(r===1)throw r=lc,Yi(e,0),oi(e,t),kr(e,$t()),r;if(r===6)throw Error(q(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,Fi(e,jr,ho),kr(e,$t()),null}function I0(e,t){var r=Ae;Ae|=1;try{return e(t)}finally{Ae=r,Ae===0&&(ws=$t()+500,Hh&&Ei())}}function na(e){ai!==null&&ai.tag===0&&!(Ae&6)&&ls();var t=Ae;Ae|=1;var r=cn.transition,n=He;try{if(cn.transition=null,He=1,e)return e()}finally{He=n,cn.transition=r,Ae=t,!(Ae&6)&&Ei()}}function D0(){Ur=Ja.current,lt(Ja)}function Yi(e,t){e.finishedWork=null,e.finishedLanes=0;var r=e.timeoutHandle;if(r!==-1&&(e.timeoutHandle=-1,az(r)),Dt!==null)for(r=Dt.return;r!==null;){var n=r;switch(h0(n),n.tag){case 1:n=n.type.childContextTypes,n!=null&&Ad();break;case 3:ys(),lt(Er),lt(ar),S0();break;case 5:_0(n);break;case 4:ys();break;case 13:lt(yt);break;case 19:lt(yt);break;case 10:y0(n.type._context);break;case 22:case 23:D0()}r=r.return}if(Bt=e,Dt=e=gi(e.current,null),Yt=Ur=t,zt=0,lc=null,R0=Kh=ra=0,jr=Nl=null,qi!==null){for(t=0;t<qi.length;t++)if(r=qi[t],n=r.interleaved,n!==null){r.interleaved=null;var o=n.next,i=r.pending;if(i!==null){var a=i.next;i.next=o,n.next=a}r.pending=n}qi=null}return e}function Y2(e,t){do{var r=Dt;try{if(v0(),ld.current=Hd,Wd){for(var n=xt.memoizedState;n!==null;){var o=n.queue;o!==null&&(o.pending=null),n=n.next}Wd=!1}if(ta=0,Ft=Lt=xt=null,Il=!1,ic=0,k0.current=null,r===null||r.return===null){zt=1,lc=t,Dt=null;break}e:{var i=e,a=r.return,l=r,c=t;if(t=Yt,l.flags|=32768,c!==null&&typeof c=="object"&&typeof c.then=="function"){var u=c,d=l,p=d.tag;if(!(d.mode&1)&&(p===0||p===11||p===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=Jw(a);if(m!==null){m.flags&=-257,Zw(m,a,l,i,t),m.mode&1&&Xw(i,u,t),t=m,c=u;var g=t.updateQueue;if(g===null){var v=new Set;v.add(c),t.updateQueue=v}else g.add(c);break e}else{if(!(t&1)){Xw(i,u,t),N0();break e}c=Error(q(426))}}else if(pt&&l.mode&1){var _=Jw(a);if(_!==null){!(_.flags&65536)&&(_.flags|=256),Zw(_,a,l,i,t),m0(xs(c,l));break e}}i=c=xs(c,l),zt!==4&&(zt=2),Nl===null?Nl=[i]:Nl.push(i),i=a;do{switch(i.tag){case 3:i.flags|=65536,t&=-t,i.lanes|=t;var y=I2(i,c,t);Ww(i,y);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"&&(hi===null||!hi.has(w)))){i.flags|=65536,t&=-t,i.lanes|=t;var b=D2(i,l,t);Ww(i,b);break e}}i=i.return}while(i!==null)}Z2(r)}catch(C){t=C,Dt===r&&r!==null&&(Dt=r=r.return);continue}break}while(!0)}function X2(){var e=qd.current;return qd.current=Hd,e===null?Hd:e}function N0(){(zt===0||zt===3||zt===2)&&(zt=4),Bt===null||!(ra&268435455)&&!(Kh&268435455)||oi(Bt,Yt)}function Kd(e,t){var r=Ae;Ae|=2;var n=X2();(Bt!==e||Yt!==t)&&(ho=null,Yi(e,t));do try{Rz();break}catch(o){Y2(e,o)}while(!0);if(v0(),Ae=r,qd.current=n,Dt!==null)throw Error(q(261));return Bt=null,Yt=0,zt}function Rz(){for(;Dt!==null;)J2(Dt)}function Tz(){for(;Dt!==null&&!n7();)J2(Dt)}function J2(e){var t=tk(e.alternate,e,Ur);e.memoizedProps=e.pendingProps,t===null?Z2(e):Dt=t,k0.current=null}function Z2(e){var t=e;do{var r=t.alternate;if(e=t.return,t.flags&32768){if(r=jz(r,t),r!==null){r.flags&=32767,Dt=r;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{zt=6,Dt=null;return}}else if(r=Pz(r,t,Ur),r!==null){Dt=r;return}if(t=t.sibling,t!==null){Dt=t;return}Dt=t=e}while(t!==null);zt===0&&(zt=5)}function Fi(e,t,r){var n=He,o=cn.transition;try{cn.transition=null,He=1,Iz(e,t,r,n)}finally{cn.transition=o,He=n}return null}function Iz(e,t,r,n){do ls();while(ai!==null);if(Ae&6)throw Error(q(327));r=e.finishedWork;var o=e.finishedLanes;if(r===null)return null;if(e.finishedWork=null,e.finishedLanes=0,r===e.current)throw Error(q(177));e.callbackNode=null,e.callbackPriority=0;var i=r.lanes|r.childLanes;if(p7(e,i),e===Bt&&(Dt=Bt=null,Yt=0),!(r.subtreeFlags&2064)&&!(r.flags&2064)||xu||(xu=!0,rk(kd,function(){return ls(),null})),i=(r.flags&15990)!==0,r.subtreeFlags&15990||i){i=cn.transition,cn.transition=null;var a=He;He=1;var l=Ae;Ae|=4,k0.current=null,Cz(e,r),G2(r,e),Z7($v),Td=!!Ev,$v=Ev=null,e.current=r,Ez(r),o7(),Ae=l,He=a,cn.transition=i}else e.current=r;if(xu&&(xu=!1,ai=e,Qd=o),i=e.pendingLanes,i===0&&(hi=null),s7(r.stateNode),kr(e,$t()),t!==null)for(n=e.onRecoverableError,r=0;r<t.length;r++)o=t[r],n(o.value,{componentStack:o.stack,digest:o.digest});if(Gd)throw Gd=!1,e=Kv,Kv=null,e;return Qd&1&&e.tag!==0&&ls(),i=e.pendingLanes,i&1?e===Yv?Al++:(Al=0,Yv=e):Al=0,Ei(),null}function ls(){if(ai!==null){var e=T$(Qd),t=cn.transition,r=He;try{if(cn.transition=null,He=16>e?16:e,ai===null)var n=!1;else{if(e=ai,ai=null,Qd=0,Ae&6)throw Error(q(331));var o=Ae;for(Ae|=4,se=e.current;se!==null;){var i=se,a=i.child;if(se.flags&16){var l=i.deletions;if(l!==null){for(var c=0;c<l.length;c++){var u=l[c];for(se=u;se!==null;){var d=se;switch(d.tag){case 0:case 11:case 15:Dl(8,d,i)}var p=d.child;if(p!==null)p.return=d,se=p;else for(;se!==null;){d=se;var h=d.sibling,m=d.return;if(W2(d),d===u){se=null;break}if(h!==null){h.return=m,se=h;break}se=m}}}var g=i.alternate;if(g!==null){var v=g.child;if(v!==null){g.child=null;do{var _=v.sibling;v.sibling=null,v=_}while(v!==null)}}se=i}}if(i.subtreeFlags&2064&&a!==null)a.return=i,se=a;else e:for(;se!==null;){if(i=se,i.flags&2048)switch(i.tag){case 0:case 11:case 15:Dl(9,i,i.return)}var y=i.sibling;if(y!==null){y.return=i.return,se=y;break e}se=i.return}}var x=e.current;for(se=x;se!==null;){a=se;var w=a.child;if(a.subtreeFlags&2064&&w!==null)w.return=a,se=w;else e:for(a=x;se!==null;){if(l=se,l.flags&2048)try{switch(l.tag){case 0:case 11:case 15:Qh(9,l)}}catch(C){St(l,l.return,C)}if(l===a){se=null;break e}var b=l.sibling;if(b!==null){b.return=l.return,se=b;break e}se=l.return}}if(Ae=o,Ei(),Xn&&typeof Xn.onPostCommitFiberRoot=="function")try{Xn.onPostCommitFiberRoot(Fh,e)}catch{}n=!0}return n}finally{He=r,cn.transition=t}}return!1}function fb(e,t,r){t=xs(r,t),t=I2(e,t,1),e=pi(e,t,1),t=gr(),e!==null&&(Pc(e,1,t),kr(e,t))}function St(e,t,r){if(e.tag===3)fb(e,e,r);else for(;t!==null;){if(t.tag===3){fb(t,e,r);break}else if(t.tag===1){var n=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof n.componentDidCatch=="function"&&(hi===null||!hi.has(n))){e=xs(r,e),e=D2(t,e,1),t=pi(t,e,1),e=gr(),t!==null&&(Pc(t,1,e),kr(t,e));break}}t=t.return}}function Dz(e,t,r){var n=e.pingCache;n!==null&&n.delete(t),t=gr(),e.pingedLanes|=e.suspendedLanes&r,Bt===e&&(Yt&r)===r&&(zt===4||zt===3&&(Yt&130023424)===Yt&&500>$t()-T0?Yi(e,0):R0|=r),kr(e,t)}function ek(e,t){t===0&&(e.mode&1?(t=cu,cu<<=1,!(cu&130023424)&&(cu=4194304)):t=1);var r=gr();e=Oo(e,t),e!==null&&(Pc(e,t,r),kr(e,r))}function Nz(e){var t=e.memoizedState,r=0;t!==null&&(r=t.retryLane),ek(e,r)}function Az(e,t){var r=0;switch(e.tag){case 13:var n=e.stateNode,o=e.memoizedState;o!==null&&(r=o.retryLane);break;case 19:n=e.stateNode;break;default:throw Error(q(314))}n!==null&&n.delete(t),ek(e,r)}var tk;tk=function(e,t,r){if(e!==null)if(e.memoizedProps!==t.pendingProps||Er.current)Or=!0;else{if(!(e.lanes&r)&&!(t.flags&128))return Or=!1,Sz(e,t,r);Or=!!(e.flags&131072)}else Or=!1,pt&&t.flags&1048576&&o2(t,zd,t.index);switch(t.lanes=0,t.tag){case 2:var n=t.type;ud(e,t),e=t.pendingProps;var o=ms(t,ar.current);ss(t,r),o=j0(null,t,n,e,o,r);var i=O0();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,$r(n)?(i=!0,Md(t)):i=!1,t.memoizedState=o.state!==null&&o.state!==void 0?o.state:null,w0(t),o.updater=qh,t.stateNode=o,o._reactInternals=t,Lv(t,n,e,r),t=Vv(null,t,n,!0,i,r)):(t.tag=0,pt&&i&&p0(t),pr(null,t,o,r),t=t.child),t;case 16:n=t.elementType;e:{switch(ud(e,t),e=t.pendingProps,o=n._init,n=o(n._payload),t.type=n,o=t.tag=Lz(n),e=wn(n,e),o){case 0:t=Fv(null,t,n,e,r);break e;case 1:t=rb(null,t,n,e,r);break e;case 11:t=eb(null,t,n,e,r);break e;case 14:t=tb(null,t,n,wn(n.type,e),r);break e}throw Error(q(306,n,""))}return t;case 0:return n=t.type,o=t.pendingProps,o=t.elementType===n?o:wn(n,o),Fv(e,t,n,o,r);case 1:return n=t.type,o=t.pendingProps,o=t.elementType===n?o:wn(n,o),rb(e,t,n,o,r);case 3:e:{if(L2(t),e===null)throw Error(q(387));n=t.pendingProps,i=t.memoizedState,o=i.element,l2(e,t),Bd(t,n,null,r);var a=t.memoizedState;if(n=a.element,i.isDehydrated)if(i={element:n,isDehydrated:!1,cache:a.cache,pendingSuspenseBoundaries:a.pendingSuspenseBoundaries,transitions:a.transitions},t.updateQueue.baseState=i,t.memoizedState=i,t.flags&256){o=xs(Error(q(423)),t),t=nb(e,t,n,r,o);break e}else if(n!==o){o=xs(Error(q(424)),t),t=nb(e,t,n,r,o);break e}else for(Hr=fi(t.stateNode.containerInfo.firstChild),Gr=t,pt=!0,Sn=null,r=f2(t,null,n,r),t.child=r;r;)r.flags=r.flags&-3|4096,r=r.sibling;else{if(gs(),n===o){t=Co(e,t,r);break e}pr(e,t,n,r)}t=t.child}return t;case 5:return p2(t),e===null&&Nv(t),n=t.type,o=t.pendingProps,i=e!==null?e.memoizedProps:null,a=o.children,kv(n,o)?a=null:i!==null&&kv(n,i)&&(t.flags|=32),M2(e,t),pr(e,t,a,r),t.child;case 6:return e===null&&Nv(t),null;case 13:return z2(e,t,r);case 4:return b0(t,t.stateNode.containerInfo),n=t.pendingProps,e===null?t.child=vs(t,null,n,r):pr(e,t,n,r),t.child;case 11:return n=t.type,o=t.pendingProps,o=t.elementType===n?o:wn(n,o),eb(e,t,n,o,r);case 7:return pr(e,t,t.pendingProps,r),t.child;case 8:return pr(e,t,t.pendingProps.children,r),t.child;case 12:return pr(e,t,t.pendingProps.children,r),t.child;case 10:e:{if(n=t.type._context,o=t.pendingProps,i=t.memoizedProps,a=o.value,rt(Fd,n._currentValue),n._currentValue=a,i!==null)if(Cn(i.value,a)){if(i.children===o.children&&!Er.current){t=Co(e,t,r);break e}}else for(i=t.child,i!==null&&(i.return=t);i!==null;){var l=i.dependencies;if(l!==null){a=i.child;for(var c=l.firstContext;c!==null;){if(c.context===n){if(i.tag===1){c=wo(-1,r&-r),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|=r,c=i.alternate,c!==null&&(c.lanes|=r),Av(i.return,r,t),l.lanes|=r;break}c=c.next}}else if(i.tag===10)a=i.type===t.type?null:i.child;else if(i.tag===18){if(a=i.return,a===null)throw Error(q(341));a.lanes|=r,l=a.alternate,l!==null&&(l.lanes|=r),Av(a,r,t),a=i.sibling}else a=i.child;if(a!==null)a.return=i;else for(a=i;a!==null;){if(a===t){a=null;break}if(i=a.sibling,i!==null){i.return=a.return,a=i;break}a=a.return}i=a}pr(e,t,o.children,r),t=t.child}return t;case 9:return o=t.type,n=t.pendingProps.children,ss(t,r),o=fn(o),n=n(o),t.flags|=1,pr(e,t,n,r),t.child;case 14:return n=t.type,o=wn(n,t.pendingProps),o=wn(n.type,o),tb(e,t,n,o,r);case 15:return N2(e,t,t.type,t.pendingProps,r);case 17:return n=t.type,o=t.pendingProps,o=t.elementType===n?o:wn(n,o),ud(e,t),t.tag=1,$r(n)?(e=!0,Md(t)):e=!1,ss(t,r),u2(t,n,o),Lv(t,n,o,r),Vv(null,t,n,!0,e,r);case 19:return F2(e,t,r);case 22:return A2(e,t,r)}throw Error(q(156,t.tag))};function rk(e,t){return E$(e,t)}function Mz(e,t,r,n){this.tag=e,this.key=r,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=n,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function an(e,t,r,n){return new Mz(e,t,r,n)}function A0(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Lz(e){if(typeof e=="function")return A0(e)?1:0;if(e!=null){if(e=e.$$typeof,e===t0)return 11;if(e===r0)return 14}return 2}function gi(e,t){var r=e.alternate;return r===null?(r=an(e.tag,t,e.key,e.mode),r.elementType=e.elementType,r.type=e.type,r.stateNode=e.stateNode,r.alternate=e,e.alternate=r):(r.pendingProps=t,r.type=e.type,r.flags=0,r.subtreeFlags=0,r.deletions=null),r.flags=e.flags&14680064,r.childLanes=e.childLanes,r.lanes=e.lanes,r.child=e.child,r.memoizedProps=e.memoizedProps,r.memoizedState=e.memoizedState,r.updateQueue=e.updateQueue,t=e.dependencies,r.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},r.sibling=e.sibling,r.index=e.index,r.ref=e.ref,r}function pd(e,t,r,n,o,i){var a=2;if(n=e,typeof e=="function")A0(e)&&(a=1);else if(typeof e=="string")a=5;else e:switch(e){case Ba:return Xi(r.children,o,i,t);case e0:a=8,o|=8;break;case lv:return e=an(12,r,t,o|2),e.elementType=lv,e.lanes=i,e;case cv:return e=an(13,r,t,o),e.elementType=cv,e.lanes=i,e;case uv:return e=an(19,r,t,o),e.elementType=uv,e.lanes=i,e;case d$:return Yh(r,o,i,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case c$:a=10;break e;case u$:a=9;break e;case t0:a=11;break e;case r0:a=14;break e;case Zo:a=16,n=null;break e}throw Error(q(130,e==null?e:typeof e,""))}return t=an(a,r,t,o),t.elementType=e,t.type=n,t.lanes=i,t}function Xi(e,t,r,n){return e=an(7,e,n,t),e.lanes=r,e}function Yh(e,t,r,n){return e=an(22,e,n,t),e.elementType=d$,e.lanes=r,e.stateNode={isHidden:!1},e}function hg(e,t,r){return e=an(6,e,null,t),e.lanes=r,e}function mg(e,t,r){return t=an(4,e.children!==null?e.children:[],e.key,t),t.lanes=r,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function zz(e,t,r,n,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=Km(0),this.expirationTimes=Km(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Km(0),this.identifierPrefix=n,this.onRecoverableError=o,this.mutableSourceEagerHydrationData=null}function M0(e,t,r,n,o,i,a,l,c){return e=new zz(e,t,r,l,c),t===1?(t=1,i===!0&&(t|=8)):t=0,i=an(3,null,null,t),e.current=i,i.stateNode=e,i.memoizedState={element:n,isDehydrated:r,cache:null,transitions:null,pendingSuspenseBoundaries:null},w0(i),e}function Fz(e,t,r){var n=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:Va,key:n==null?null:""+n,children:e,containerInfo:t,implementation:r}}function nk(e){if(!e)return wi;e=e._reactInternals;e:{if(pa(e)!==e||e.tag!==1)throw Error(q(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if($r(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(t!==null);throw Error(q(171))}if(e.tag===1){var r=e.type;if($r(r))return r2(e,r,t)}return t}function ok(e,t,r,n,o,i,a,l,c){return e=M0(r,n,!0,e,o,i,a,l,c),e.context=nk(null),r=e.current,n=gr(),o=mi(r),i=wo(n,o),i.callback=t??null,pi(r,i,o),e.current.lanes=o,Pc(e,o,n),kr(e,n),e}function Xh(e,t,r,n){var o=t.current,i=gr(),a=mi(o);return r=nk(r),t.context===null?t.context=r:t.pendingContext=r,t=wo(i,a),t.payload={element:e},n=n===void 0?null:n,n!==null&&(t.callback=n),e=pi(o,t,a),e!==null&&(On(e,o,a,i),sd(e,o,a)),a}function Yd(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 pb(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var r=e.retryLane;e.retryLane=r!==0&&r<t?r:t}}function L0(e,t){pb(e,t),(e=e.alternate)&&pb(e,t)}function Vz(){return null}var ik=typeof reportError=="function"?reportError:function(e){console.error(e)};function z0(e){this._internalRoot=e}Jh.prototype.render=z0.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(q(409));Xh(e,t,null,null)};Jh.prototype.unmount=z0.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;na(function(){Xh(null,e,null,null)}),t[jo]=null}};function Jh(e){this._internalRoot=e}Jh.prototype.unstable_scheduleHydration=function(e){if(e){var t=N$();e={blockedOn:null,target:e,priority:t};for(var r=0;r<ni.length&&t!==0&&t<ni[r].priority;r++);ni.splice(r,0,e),r===0&&M$(e)}};function F0(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function Zh(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==" react-mount-point-unstable "))}function hb(){}function Bz(e,t,r,n,o){if(o){if(typeof n=="function"){var i=n;n=function(){var u=Yd(a);i.call(u)}}var a=ok(t,n,e,0,null,!1,!1,"",hb);return e._reactRootContainer=a,e[jo]=a.current,ec(e.nodeType===8?e.parentNode:e),na(),a}for(;o=e.lastChild;)e.removeChild(o);if(typeof n=="function"){var l=n;n=function(){var u=Yd(c);l.call(u)}}var c=M0(e,0,!1,null,null,!1,!1,"",hb);return e._reactRootContainer=c,e[jo]=c.current,ec(e.nodeType===8?e.parentNode:e),na(function(){Xh(t,c,r,n)}),c}function em(e,t,r,n,o){var i=r._reactRootContainer;if(i){var a=i;if(typeof o=="function"){var l=o;o=function(){var c=Yd(a);l.call(c)}}Xh(t,a,e,o)}else a=Bz(r,t,e,o,n);return Yd(a)}I$=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var r=_l(t.pendingLanes);r!==0&&(i0(t,r|1),kr(t,$t()),!(Ae&6)&&(ws=$t()+500,Ei()))}break;case 13:na(function(){var n=Oo(e,1);if(n!==null){var o=gr();On(n,e,1,o)}}),L0(e,1)}};a0=function(e){if(e.tag===13){var t=Oo(e,134217728);if(t!==null){var r=gr();On(t,e,134217728,r)}L0(e,134217728)}};D$=function(e){if(e.tag===13){var t=mi(e),r=Oo(e,t);if(r!==null){var n=gr();On(r,e,t,n)}L0(e,t)}};N$=function(){return He};A$=function(e,t){var r=He;try{return He=e,t()}finally{He=r}};wv=function(e,t,r){switch(t){case"input":if(pv(e,r),t=r.name,r.type==="radio"&&t!=null){for(r=e;r.parentNode;)r=r.parentNode;for(r=r.querySelectorAll("input[name="+JSON.stringify(""+t)+'][type="radio"]'),t=0;t<r.length;t++){var n=r[t];if(n!==e&&n.form===e.form){var o=Wh(n);if(!o)throw Error(q(90));p$(n),pv(n,o)}}}break;case"textarea":m$(e,r);break;case"select":t=r.value,t!=null&&ns(e,!!r.multiple,t,!1)}};_$=I0;S$=na;var Uz={usingClientEntryPoint:!1,Events:[Oc,qa,Wh,w$,b$,I0]},nl={findFiberByHostInstance:Hi,bundleType:0,version:"18.2.0",rendererPackageName:"react-dom"},Wz={bundleType:nl.bundleType,version:nl.version,rendererPackageName:nl.rendererPackageName,rendererConfig:nl.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:No.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=O$(e),e===null?null:e.stateNode},findFiberByHostInstance:nl.findFiberByHostInstance||Vz,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 wu=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!wu.isDisabled&&wu.supportsFiber)try{Fh=wu.inject(Wz),Xn=wu}catch{}}Xr.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Uz;Xr.createPortal=function(e,t){var r=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!F0(t))throw Error(q(200));return Fz(e,t,null,r)};Xr.createRoot=function(e,t){if(!F0(e))throw Error(q(299));var r=!1,n="",o=ik;return t!=null&&(t.unstable_strictMode===!0&&(r=!0),t.identifierPrefix!==void 0&&(n=t.identifierPrefix),t.onRecoverableError!==void 0&&(o=t.onRecoverableError)),t=M0(e,1,!1,null,null,r,!1,n,o),e[jo]=t.current,ec(e.nodeType===8?e.parentNode:e),new z0(t)};Xr.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(q(188)):(e=Object.keys(e).join(","),Error(q(268,e)));return e=O$(t),e=e===null?null:e.stateNode,e};Xr.flushSync=function(e){return na(e)};Xr.hydrate=function(e,t,r){if(!Zh(t))throw Error(q(200));return em(null,e,t,!0,r)};Xr.hydrateRoot=function(e,t,r){if(!F0(e))throw Error(q(405));var n=r!=null&&r.hydratedSources||null,o=!1,i="",a=ik;if(r!=null&&(r.unstable_strictMode===!0&&(o=!0),r.identifierPrefix!==void 0&&(i=r.identifierPrefix),r.onRecoverableError!==void 0&&(a=r.onRecoverableError)),t=ok(t,null,e,1,r??null,o,!1,i,a),e[jo]=t.current,ec(e),n)for(e=0;e<n.length;e++)r=n[e],o=r._getVersion,o=o(r._source),t.mutableSourceEagerHydrationData==null?t.mutableSourceEagerHydrationData=[r,o]:t.mutableSourceEagerHydrationData.push(r,o);return new Jh(t)};Xr.render=function(e,t,r){if(!Zh(t))throw Error(q(200));return em(null,e,t,!1,r)};Xr.unmountComponentAtNode=function(e){if(!Zh(e))throw Error(q(40));return e._reactRootContainer?(na(function(){em(null,null,e,!1,function(){e._reactRootContainer=null,e[jo]=null})}),!0):!1};Xr.unstable_batchedUpdates=I0;Xr.unstable_renderSubtreeIntoContainer=function(e,t,r,n){if(!Zh(r))throw Error(q(200));if(e==null||e._reactInternals===void 0)throw Error(q(38));return em(e,t,r,!1,n)};Xr.version="18.2.0-next-9e3b772b8-20220608";function ak(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(ak)}catch(e){console.error(e)}}ak(),o$.exports=Xr;var As=o$.exports;const hd=Ay(As),Hz=ZC({__proto__:null,default:hd},[As]);var qz=Object.defineProperty,Gz=Object.defineProperties,Qz=Object.getOwnPropertyDescriptors,mb=Object.getOwnPropertySymbols,Kz=Object.prototype.hasOwnProperty,Yz=Object.prototype.propertyIsEnumerable,gb=(e,t,r)=>t in e?qz(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Zv=(e,t)=>{for(var r in t||(t={}))Kz.call(t,r)&&gb(e,r,t[r]);if(mb)for(var r of mb(t))Yz.call(t,r)&&gb(e,r,t[r]);return e},vb=(e,t)=>Gz(e,Qz(t));const Xz=["subtle","filled","outline","light","default","transparent","gradient"],bu={xs:j(18),sm:j(22),md:j(28),lg:j(34),xl:j(44)};function Jz({variant:e,theme:t,color:r,gradient:n}){const o=t.fn.variant({color:r,variant:e,gradient:n});return e==="gradient"?{border:0,backgroundImage:o.background,color:o.color,"&:hover":t.fn.hover({backgroundSize:"200%"})}:Xz.includes(e)?Zv({border:`${j(1)} solid ${o.border}`,backgroundColor:o.background,color:o.color},t.fn.hover({backgroundColor:o.hover})):null}var Zz=W((e,{radius:t,color:r,gradient:n},{variant:o,size:i})=>({root:vb(Zv({position:"relative",borderRadius:e.fn.radius(t),padding:0,lineHeight:1,display:"flex",alignItems:"center",justifyContent:"center",height:L({size:i,sizes:bu}),minHeight:L({size:i,sizes:bu}),width:L({size:i,sizes:bu}),minWidth:L({size:i,sizes:bu})},Jz({variant:o,theme:e,color:r,gradient:n})),{"&:active":e.activeStyles,"& [data-action-icon-loader]":{maxWidth:"70%"},"&:disabled, &[data-disabled]":{color:e.colors.gray[e.colorScheme==="dark"?6:4],cursor:"not-allowed",backgroundColor:o==="transparent"?void 0:e.fn.themeColor("gray",e.colorScheme==="dark"?8:1),borderColor:o==="transparent"?void 0:e.fn.themeColor("gray",e.colorScheme==="dark"?8:1),backgroundImage:"none",pointerEvents:"none","&:active":{transform:"none"}},"&[data-loading]":{pointerEvents:"none","&::before":vb(Zv({content:'""'},e.fn.cover(j(-1))),{backgroundColor:e.colorScheme==="dark"?e.fn.rgba(e.colors.dark[7],.5):"rgba(255, 255, 255, .5)",borderRadius:e.fn.radius(t),cursor:"not-allowed"})}})}));const e8=Zz;var t8=Object.defineProperty,Xd=Object.getOwnPropertySymbols,sk=Object.prototype.hasOwnProperty,lk=Object.prototype.propertyIsEnumerable,yb=(e,t,r)=>t in e?t8(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,xb=(e,t)=>{for(var r in t||(t={}))sk.call(t,r)&&yb(e,r,t[r]);if(Xd)for(var r of Xd(t))lk.call(t,r)&&yb(e,r,t[r]);return e},wb=(e,t)=>{var r={};for(var n in e)sk.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&Xd)for(var n of Xd(e))t.indexOf(n)<0&&lk.call(e,n)&&(r[n]=e[n]);return r};function r8(e){var t=e,{size:r,color:n}=t,o=wb(t,["size","color"]);const i=o,{style:a}=i,l=wb(i,["style"]);return S.createElement("svg",xb({viewBox:"0 0 135 140",xmlns:"http://www.w3.org/2000/svg",fill:n,style:xb({width:r},a)},l),S.createElement("rect",{y:"10",width:"15",height:"120",rx:"6"},S.createElement("animate",{attributeName:"height",begin:"0.5s",dur:"1s",values:"120;110;100;90;80;70;60;50;40;140;120",calcMode:"linear",repeatCount:"indefinite"}),S.createElement("animate",{attributeName:"y",begin:"0.5s",dur:"1s",values:"10;15;20;25;30;35;40;45;50;0;10",calcMode:"linear",repeatCount:"indefinite"})),S.createElement("rect",{x:"30",y:"10",width:"15",height:"120",rx:"6"},S.createElement("animate",{attributeName:"height",begin:"0.25s",dur:"1s",values:"120;110;100;90;80;70;60;50;40;140;120",calcMode:"linear",repeatCount:"indefinite"}),S.createElement("animate",{attributeName:"y",begin:"0.25s",dur:"1s",values:"10;15;20;25;30;35;40;45;50;0;10",calcMode:"linear",repeatCount:"indefinite"})),S.createElement("rect",{x:"60",width:"15",height:"140",rx:"6"},S.createElement("animate",{attributeName:"height",begin:"0s",dur:"1s",values:"120;110;100;90;80;70;60;50;40;140;120",calcMode:"linear",repeatCount:"indefinite"}),S.createElement("animate",{attributeName:"y",begin:"0s",dur:"1s",values:"10;15;20;25;30;35;40;45;50;0;10",calcMode:"linear",repeatCount:"indefinite"})),S.createElement("rect",{x:"90",y:"10",width:"15",height:"120",rx:"6"},S.createElement("animate",{attributeName:"height",begin:"0.25s",dur:"1s",values:"120;110;100;90;80;70;60;50;40;140;120",calcMode:"linear",repeatCount:"indefinite"}),S.createElement("animate",{attributeName:"y",begin:"0.25s",dur:"1s",values:"10;15;20;25;30;35;40;45;50;0;10",calcMode:"linear",repeatCount:"indefinite"})),S.createElement("rect",{x:"120",y:"10",width:"15",height:"120",rx:"6"},S.createElement("animate",{attributeName:"height",begin:"0.5s",dur:"1s",values:"120;110;100;90;80;70;60;50;40;140;120",calcMode:"linear",repeatCount:"indefinite"}),S.createElement("animate",{attributeName:"y",begin:"0.5s",dur:"1s",values:"10;15;20;25;30;35;40;45;50;0;10",calcMode:"linear",repeatCount:"indefinite"})))}var n8=Object.defineProperty,Jd=Object.getOwnPropertySymbols,ck=Object.prototype.hasOwnProperty,uk=Object.prototype.propertyIsEnumerable,bb=(e,t,r)=>t in e?n8(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,_b=(e,t)=>{for(var r in t||(t={}))ck.call(t,r)&&bb(e,r,t[r]);if(Jd)for(var r of Jd(t))uk.call(t,r)&&bb(e,r,t[r]);return e},Sb=(e,t)=>{var r={};for(var n in e)ck.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&Jd)for(var n of Jd(e))t.indexOf(n)<0&&uk.call(e,n)&&(r[n]=e[n]);return r};function o8(e){var t=e,{size:r,color:n}=t,o=Sb(t,["size","color"]);const i=o,{style:a}=i,l=Sb(i,["style"]);return S.createElement("svg",_b({viewBox:"0 0 38 38",xmlns:"http://www.w3.org/2000/svg",stroke:n,style:_b({width:r,height:r},a)},l),S.createElement("g",{fill:"none",fillRule:"evenodd"},S.createElement("g",{transform:"translate(2.5 2.5)",strokeWidth:"5"},S.createElement("circle",{strokeOpacity:".5",cx:"16",cy:"16",r:"16"}),S.createElement("path",{d:"M32 16c0-9.94-8.06-16-16-16"},S.createElement("animateTransform",{attributeName:"transform",type:"rotate",from:"0 16 16",to:"360 16 16",dur:"1s",repeatCount:"indefinite"})))))}var i8=Object.defineProperty,Zd=Object.getOwnPropertySymbols,dk=Object.prototype.hasOwnProperty,fk=Object.prototype.propertyIsEnumerable,Pb=(e,t,r)=>t in e?i8(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,jb=(e,t)=>{for(var r in t||(t={}))dk.call(t,r)&&Pb(e,r,t[r]);if(Zd)for(var r of Zd(t))fk.call(t,r)&&Pb(e,r,t[r]);return e},Ob=(e,t)=>{var r={};for(var n in e)dk.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&Zd)for(var n of Zd(e))t.indexOf(n)<0&&fk.call(e,n)&&(r[n]=e[n]);return r};function a8(e){var t=e,{size:r,color:n}=t,o=Ob(t,["size","color"]);const i=o,{style:a}=i,l=Ob(i,["style"]);return S.createElement("svg",jb({viewBox:"0 0 120 30",xmlns:"http://www.w3.org/2000/svg",fill:n,style:jb({width:r},a)},l),S.createElement("circle",{cx:"15",cy:"15",r:"15"},S.createElement("animate",{attributeName:"r",from:"15",to:"15",begin:"0s",dur:"0.8s",values:"15;9;15",calcMode:"linear",repeatCount:"indefinite"}),S.createElement("animate",{attributeName:"fill-opacity",from:"1",to:"1",begin:"0s",dur:"0.8s",values:"1;.5;1",calcMode:"linear",repeatCount:"indefinite"})),S.createElement("circle",{cx:"60",cy:"15",r:"9",fillOpacity:"0.3"},S.createElement("animate",{attributeName:"r",from:"9",to:"9",begin:"0s",dur:"0.8s",values:"9;15;9",calcMode:"linear",repeatCount:"indefinite"}),S.createElement("animate",{attributeName:"fill-opacity",from:"0.5",to:"0.5",begin:"0s",dur:"0.8s",values:".5;1;.5",calcMode:"linear",repeatCount:"indefinite"})),S.createElement("circle",{cx:"105",cy:"15",r:"15"},S.createElement("animate",{attributeName:"r",from:"15",to:"15",begin:"0s",dur:"0.8s",values:"15;9;15",calcMode:"linear",repeatCount:"indefinite"}),S.createElement("animate",{attributeName:"fill-opacity",from:"1",to:"1",begin:"0s",dur:"0.8s",values:"1;.5;1",calcMode:"linear",repeatCount:"indefinite"})))}var s8=Object.defineProperty,ef=Object.getOwnPropertySymbols,pk=Object.prototype.hasOwnProperty,hk=Object.prototype.propertyIsEnumerable,Cb=(e,t,r)=>t in e?s8(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,l8=(e,t)=>{for(var r in t||(t={}))pk.call(t,r)&&Cb(e,r,t[r]);if(ef)for(var r of ef(t))hk.call(t,r)&&Cb(e,r,t[r]);return e},c8=(e,t)=>{var r={};for(var n in e)pk.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&ef)for(var n of ef(e))t.indexOf(n)<0&&hk.call(e,n)&&(r[n]=e[n]);return r};const gg={bars:r8,oval:o8,dots:a8},u8={xs:j(18),sm:j(22),md:j(36),lg:j(44),xl:j(58)},d8={size:"md"};function hn(e){const t=H("Loader",d8,e),{size:r,color:n,variant:o}=t,i=c8(t,["size","color","variant"]),a=Jt(),l=o in gg?o:a.loader;return S.createElement(ie,l8({role:"presentation",component:gg[l]||gg.bars,size:L({size:r,sizes:u8}),color:a.fn.variant({variant:"filled",primaryFallback:!1,color:n||a.primaryColor}).background},i))}hn.displayName="@mantine/core/Loader";var f8=Object.defineProperty,tf=Object.getOwnPropertySymbols,mk=Object.prototype.hasOwnProperty,gk=Object.prototype.propertyIsEnumerable,Eb=(e,t,r)=>t in e?f8(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,$b=(e,t)=>{for(var r in t||(t={}))mk.call(t,r)&&Eb(e,r,t[r]);if(tf)for(var r of tf(t))gk.call(t,r)&&Eb(e,r,t[r]);return e},p8=(e,t)=>{var r={};for(var n in e)mk.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&tf)for(var n of tf(e))t.indexOf(n)<0&&gk.call(e,n)&&(r[n]=e[n]);return r};const h8={color:"gray",size:"md",variant:"subtle"},vk=f.forwardRef((e,t)=>{const r=H("ActionIcon",h8,e),{className:n,color:o,children:i,radius:a,size:l,variant:c,gradient:u,disabled:d,loaderProps:p,loading:h,unstyled:m,__staticSelector:g}=r,v=p8(r,["className","color","children","radius","size","variant","gradient","disabled","loaderProps","loading","unstyled","__staticSelector"]),{classes:_,cx:y,theme:x}=e8({radius:a,color:o,gradient:u},{name:["ActionIcon",g],unstyled:m,size:l,variant:c}),w=S.createElement(hn,$b({color:x.fn.variant({color:o,variant:c}).color,size:"100%","data-action-icon-loader":!0},p));return S.createElement(So,$b({className:y(_.root,n),ref:t,disabled:d,"data-disabled":d||void 0,"data-loading":h||void 0,unstyled:m},v),h?w:i)});vk.displayName="@mantine/core/ActionIcon";const vr=vk;var m8=Object.defineProperty,g8=Object.defineProperties,v8=Object.getOwnPropertyDescriptors,rf=Object.getOwnPropertySymbols,yk=Object.prototype.hasOwnProperty,xk=Object.prototype.propertyIsEnumerable,kb=(e,t,r)=>t in e?m8(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,y8=(e,t)=>{for(var r in t||(t={}))yk.call(t,r)&&kb(e,r,t[r]);if(rf)for(var r of rf(t))xk.call(t,r)&&kb(e,r,t[r]);return e},x8=(e,t)=>g8(e,v8(t)),w8=(e,t)=>{var r={};for(var n in e)yk.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&rf)for(var n of rf(e))t.indexOf(n)<0&&xk.call(e,n)&&(r[n]=e[n]);return r};function V0(e){const t=H("Portal",{},e),{children:r,target:n,className:o,innerRef:i}=t,a=w8(t,["children","target","className","innerRef"]),l=Jt(),[c,u]=f.useState(!1),d=f.useRef();return qE(()=>(u(!0),d.current=n?typeof n=="string"?document.querySelector(n):n:document.createElement("div"),n||document.body.appendChild(d.current),()=>{!n&&document.body.removeChild(d.current)}),[n]),c?As.createPortal(S.createElement("div",x8(y8({className:o,dir:l.dir},a),{ref:i}),r),d.current):null}V0.displayName="@mantine/core/Portal";var b8=Object.defineProperty,nf=Object.getOwnPropertySymbols,wk=Object.prototype.hasOwnProperty,bk=Object.prototype.propertyIsEnumerable,Rb=(e,t,r)=>t in e?b8(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,_8=(e,t)=>{for(var r in t||(t={}))wk.call(t,r)&&Rb(e,r,t[r]);if(nf)for(var r of nf(t))bk.call(t,r)&&Rb(e,r,t[r]);return e},S8=(e,t)=>{var r={};for(var n in e)wk.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&nf)for(var n of nf(e))t.indexOf(n)<0&&bk.call(e,n)&&(r[n]=e[n]);return r};function Ms(e){var t=e,{withinPortal:r=!0,children:n}=t,o=S8(t,["withinPortal","children"]);return r?S.createElement(V0,_8({},o),n):S.createElement(S.Fragment,null,n)}Ms.displayName="@mantine/core/OptionalPortal";var P8=Object.defineProperty,j8=Object.defineProperties,O8=Object.getOwnPropertyDescriptors,Tb=Object.getOwnPropertySymbols,C8=Object.prototype.hasOwnProperty,E8=Object.prototype.propertyIsEnumerable,Ib=(e,t,r)=>t in e?P8(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,vg=(e,t)=>{for(var r in t||(t={}))C8.call(t,r)&&Ib(e,r,t[r]);if(Tb)for(var r of Tb(t))E8.call(t,r)&&Ib(e,r,t[r]);return e},Db=(e,t)=>j8(e,O8(t));function $8({variant:e,color:t,theme:r}){if(e==="filled")return{backgroundColor:r.fn.variant({variant:"filled",color:t}).background,color:r.white};if(e==="outline"){const n=r.fn.variant({variant:"outline",color:t});return{color:n.color,borderColor:n.border,backgroundColor:r.colorScheme==="dark"?r.colors.dark[6]:r.white}}if(e==="light"){const n=r.fn.variant({variant:"light",color:t});return{backgroundColor:n.background,color:n.color}}return null}var k8=W((e,{radius:t,color:r},{variant:n})=>({root:vg(Db(vg({},e.fn.fontStyles()),{position:"relative",overflow:"hidden",paddingTop:e.spacing.sm,paddingBottom:e.spacing.sm,paddingLeft:e.spacing.md,paddingRight:e.spacing.sm,borderRadius:e.fn.radius(t),border:`${j(1)} solid transparent`}),$8({variant:n,color:r,theme:e})),wrapper:{display:"flex"},body:{flex:1},title:{boxSizing:"border-box",margin:0,marginBottom:e.spacing.xs,display:"flex",alignItems:"center",justifyContent:"space-between",lineHeight:e.lineHeight,fontSize:e.fontSizes.sm,fontWeight:700,"&[data-with-close-button]":{paddingRight:e.spacing.md}},label:{display:"block",overflow:"hidden",textOverflow:"ellipsis"},icon:{lineHeight:1,width:j(20),height:j(20),display:"flex",alignItems:"center",justifyContent:"flex-start",marginRight:e.spacing.md,marginTop:1},message:Db(vg({},e.fn.fontStyles()),{lineHeight:e.lineHeight,textOverflow:"ellipsis",overflow:"hidden",fontSize:e.fontSizes.sm,color:n==="filled"?e.white:e.colorScheme==="dark"?n==="light"?e.white:e.colors.dark[0]:e.black}),closeButton:{width:j(10),height:j(10),color:n==="filled"?e.white:e.colorScheme==="dark"?n==="light"?e.white:e.colors.dark[0]:e.black}}));const R8=k8;var T8=Object.defineProperty,of=Object.getOwnPropertySymbols,_k=Object.prototype.hasOwnProperty,Sk=Object.prototype.propertyIsEnumerable,Nb=(e,t,r)=>t in e?T8(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Ab=(e,t)=>{for(var r in t||(t={}))_k.call(t,r)&&Nb(e,r,t[r]);if(of)for(var r of of(t))Sk.call(t,r)&&Nb(e,r,t[r]);return e},I8=(e,t)=>{var r={};for(var n in e)_k.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&of)for(var n of of(e))t.indexOf(n)<0&&Sk.call(e,n)&&(r[n]=e[n]);return r};function Pk(e){const t=e,{width:r,height:n,style:o}=t,i=I8(t,["width","height","style"]);return S.createElement("svg",Ab({viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:Ab({width:r,height:n},o)},i),S.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"}))}Pk.displayName="@mantine/core/CloseIcon";var D8=Object.defineProperty,af=Object.getOwnPropertySymbols,jk=Object.prototype.hasOwnProperty,Ok=Object.prototype.propertyIsEnumerable,Mb=(e,t,r)=>t in e?D8(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,N8=(e,t)=>{for(var r in t||(t={}))jk.call(t,r)&&Mb(e,r,t[r]);if(af)for(var r of af(t))Ok.call(t,r)&&Mb(e,r,t[r]);return e},A8=(e,t)=>{var r={};for(var n in e)jk.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&af)for(var n of af(e))t.indexOf(n)<0&&Ok.call(e,n)&&(r[n]=e[n]);return r};const M8={xs:j(12),sm:j(16),md:j(20),lg:j(28),xl:j(34)},L8={size:"sm"},Ck=f.forwardRef((e,t)=>{const r=H("CloseButton",L8,e),{iconSize:n,size:o,children:i}=r,a=A8(r,["iconSize","size","children"]),l=j(n||M8[o]);return S.createElement(vr,N8({ref:t,__staticSelector:"CloseButton",size:o},a),i||S.createElement(Pk,{width:l,height:l}))});Ck.displayName="@mantine/core/CloseButton";const Ec=Ck;var z8=Object.defineProperty,sf=Object.getOwnPropertySymbols,Ek=Object.prototype.hasOwnProperty,$k=Object.prototype.propertyIsEnumerable,Lb=(e,t,r)=>t in e?z8(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,F8=(e,t)=>{for(var r in t||(t={}))Ek.call(t,r)&&Lb(e,r,t[r]);if(sf)for(var r of sf(t))$k.call(t,r)&&Lb(e,r,t[r]);return e},V8=(e,t)=>{var r={};for(var n in e)Ek.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&sf)for(var n of sf(e))t.indexOf(n)<0&&$k.call(e,n)&&(r[n]=e[n]);return r};const B8={variant:"light"},$c=f.forwardRef((e,t)=>{const r=H("Alert",B8,e),{id:n,className:o,title:i,variant:a,children:l,color:c,classNames:u,icon:d,styles:p,onClose:h,radius:m,withCloseButton:g,closeButtonLabel:v,unstyled:_}=r,y=V8(r,["id","className","title","variant","children","color","classNames","icon","styles","onClose","radius","withCloseButton","closeButtonLabel","unstyled"]),{classes:x,cx:w}=R8({color:c,radius:m},{classNames:u,styles:p,unstyled:_,variant:a,name:"Alert"}),b=Nr(n),C=i&&`${b}-title`,O=`${b}-body`;return S.createElement(ie,F8({id:b,role:"alert","aria-labelledby":C,"aria-describedby":O,className:w(x.root,x[a],o),ref:t},y),S.createElement("div",{className:x.wrapper},d&&S.createElement("div",{className:x.icon},d),S.createElement("div",{className:x.body},i&&S.createElement("div",{className:x.title,"data-with-close-button":g||void 0},S.createElement("span",{id:C,className:x.label},i)),S.createElement("div",{id:O,className:x.message},l)),g&&S.createElement(Ec,{className:x.closeButton,onClick:h,variant:"transparent",size:16,iconSize:16,"aria-label":v})))});$c.displayName="@mantine/core/Alert";var U8=Object.defineProperty,W8=Object.defineProperties,H8=Object.getOwnPropertyDescriptors,zb=Object.getOwnPropertySymbols,q8=Object.prototype.hasOwnProperty,G8=Object.prototype.propertyIsEnumerable,Fb=(e,t,r)=>t in e?U8(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,_u=(e,t)=>{for(var r in t||(t={}))q8.call(t,r)&&Fb(e,r,t[r]);if(zb)for(var r of zb(t))G8.call(t,r)&&Fb(e,r,t[r]);return e},Q8=(e,t)=>W8(e,H8(t));function K8({underline:e,strikethrough:t}){const r=[];return e&&r.push("underline"),t&&r.push("line-through"),r.length>0?r.join(" "):"none"}function Y8({theme:e,color:t}){return t==="dimmed"?e.fn.dimmed():typeof t=="string"&&(t in e.colors||t.split(".")[0]in e.colors)?e.fn.variant({variant:"filled",color:t}).background:t||"inherit"}function X8(e){return typeof e=="number"?{overflow:"hidden",textOverflow:"ellipsis",display:"-webkit-box",WebkitLineClamp:e,WebkitBoxOrient:"vertical"}:null}function J8({theme:e,truncate:t}){return t==="start"?{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",direction:e.dir==="ltr"?"rtl":"ltr",textAlign:e.dir==="ltr"?"right":"left"}:t?{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}:null}var Z8=W((e,{color:t,lineClamp:r,truncate:n,inline:o,inherit:i,underline:a,gradient:l,weight:c,transform:u,align:d,strikethrough:p,italic:h},{size:m})=>{const g=e.fn.variant({variant:"gradient",gradient:l});return{root:Q8(_u(_u(_u(_u({},e.fn.fontStyles()),e.fn.focusStyles()),X8(r)),J8({theme:e,truncate:n})),{color:Y8({color:t,theme:e}),fontFamily:i?"inherit":e.fontFamily,fontSize:i||m===void 0?"inherit":L({size:m,sizes:e.fontSizes}),lineHeight:i?"inherit":o?1:e.lineHeight,textDecoration:K8({underline:a,strikethrough:p}),WebkitTapHighlightColor:"transparent",fontWeight:i?"inherit":c,textTransform:u,textAlign:d,fontStyle:h?"italic":void 0}),gradient:{backgroundImage:g.background,WebkitBackgroundClip:"text",WebkitTextFillColor:"transparent"}}});const eF=Z8;var tF=Object.defineProperty,lf=Object.getOwnPropertySymbols,kk=Object.prototype.hasOwnProperty,Rk=Object.prototype.propertyIsEnumerable,Vb=(e,t,r)=>t in e?tF(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,rF=(e,t)=>{for(var r in t||(t={}))kk.call(t,r)&&Vb(e,r,t[r]);if(lf)for(var r of lf(t))Rk.call(t,r)&&Vb(e,r,t[r]);return e},nF=(e,t)=>{var r={};for(var n in e)kk.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&lf)for(var n of lf(e))t.indexOf(n)<0&&Rk.call(e,n)&&(r[n]=e[n]);return r};const oF={variant:"text"},Tk=f.forwardRef((e,t)=>{const r=H("Text",oF,e),{className:n,size:o,weight:i,transform:a,color:l,align:c,variant:u,lineClamp:d,truncate:p,gradient:h,inline:m,inherit:g,underline:v,strikethrough:_,italic:y,classNames:x,styles:w,unstyled:b,span:C,__staticSelector:O}=r,P=nF(r,["className","size","weight","transform","color","align","variant","lineClamp","truncate","gradient","inline","inherit","underline","strikethrough","italic","classNames","styles","unstyled","span","__staticSelector"]),{classes:E,cx:$}=eF({color:l,lineClamp:d,truncate:p,inline:m,inherit:g,underline:v,strikethrough:_,italic:y,weight:i,transform:a,align:c,gradient:h},{unstyled:b,name:O||"Text",variant:u,size:o});return S.createElement(ie,rF({ref:t,className:$(E.root,{[E.gradient]:u==="gradient"},n),component:C?"span":"div"},P))});Tk.displayName="@mantine/core/Text";const oe=Tk;var iF=Object.defineProperty,Bb=Object.getOwnPropertySymbols,aF=Object.prototype.hasOwnProperty,sF=Object.prototype.propertyIsEnumerable,Ub=(e,t,r)=>t in e?iF(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,lF=(e,t)=>{for(var r in t||(t={}))aF.call(t,r)&&Ub(e,r,t[r]);if(Bb)for(var r of Bb(t))sF.call(t,r)&&Ub(e,r,t[r]);return e};function cF({theme:e,color:t}){return t==="dimmed"?e.fn.dimmed():e.fn.themeColor(t||e.primaryColor,e.colorScheme==="dark"?4:7,!1,!0)}var uF=W((e,{color:t,underline:r})=>({root:lF({backgroundColor:"transparent",cursor:"pointer",padding:0,border:0,color:cF({theme:e,color:t})},e.fn.hover({textDecoration:r?"underline":"none"}))}));const dF=uF;var fF=Object.defineProperty,cf=Object.getOwnPropertySymbols,Ik=Object.prototype.hasOwnProperty,Dk=Object.prototype.propertyIsEnumerable,Wb=(e,t,r)=>t in e?fF(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Hb=(e,t)=>{for(var r in t||(t={}))Ik.call(t,r)&&Wb(e,r,t[r]);if(cf)for(var r of cf(t))Dk.call(t,r)&&Wb(e,r,t[r]);return e},pF=(e,t)=>{var r={};for(var n in e)Ik.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&cf)for(var n of cf(e))t.indexOf(n)<0&&Dk.call(e,n)&&(r[n]=e[n]);return r};const hF={underline:!0},Nk=f.forwardRef((e,t)=>{const r=H("Anchor",hF,e),{component:n,className:o,unstyled:i,variant:a,size:l,color:c,underline:u}=r,d=pF(r,["component","className","unstyled","variant","size","color","underline"]),{classes:p,cx:h}=dF({color:c,underline:u},{name:"Anchor",unstyled:i,variant:a,size:l}),m=n==="button"?{type:"button"}:null;return S.createElement(oe,Hb(Hb({component:n||"a",ref:t,className:h(p.root,o),size:l},m),d))});Nk.displayName="@mantine/core/Anchor";const Le=Nk,Ak=f.createContext({zIndex:1e3,fixed:!1,layout:"default"}),mF=Ak.Provider;function Mk(){return f.useContext(Ak)}function tm(e,t){if(!e)return[];const r=Object.keys(e).filter(n=>n!=="base").map(n=>[L({size:n,sizes:t.breakpoints,units:"em"}),e[n]]);return r.sort((n,o)=>xr(n[0])-xr(o[0])),r}var gF=Object.defineProperty,vF=Object.defineProperties,yF=Object.getOwnPropertyDescriptors,qb=Object.getOwnPropertySymbols,xF=Object.prototype.hasOwnProperty,wF=Object.prototype.propertyIsEnumerable,Gb=(e,t,r)=>t in e?gF(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Su=(e,t)=>{for(var r in t||(t={}))xF.call(t,r)&&Gb(e,r,t[r]);if(qb)for(var r of qb(t))wF.call(t,r)&&Gb(e,r,t[r]);return e},Qb=(e,t)=>vF(e,yF(t)),bF=W((e,{height:t,width:r,fixed:n,position:o,hiddenBreakpoint:i,zIndex:a,section:l,withBorder:c,layout:u})=>{const d=typeof r=="object"&&r!==null?tm(r,e).reduce((h,[m,g])=>(h[`@media (min-width: ${ir(m)})`]={width:j(g),minWidth:j(g)},h),{}):null,p=c?{[l==="navbar"?"borderRight":"borderLeft"]:`${j(1)} solid ${e.colorScheme==="dark"?e.colors.dark[5]:e.colors.gray[2]}`}:{};return{root:Qb(Su(Su(Qb(Su(Su({},e.fn.fontStyles()),o),{top:u==="alt"?0:(o==null?void 0:o.top)||"var(--mantine-header-height)",bottom:0,zIndex:a,height:t?j(t):u==="alt"?"auto":"calc(100vh - var(--mantine-header-height, 0rem) - var(--mantine-footer-height, 0rem))",width:r!=null&&r.base?j(r==null?void 0:r.base):"100%",position:n?"fixed":"static",boxSizing:"border-box",display:"flex",flexDirection:"column",backgroundColor:e.colorScheme==="dark"?e.colors.dark[7]:e.white}),p),d),{"&[data-hidden]":{[`@media (max-width: ${ir(xr(L({size:i,sizes:e.breakpoints}))-1)})`]:{display:"none"}}})}});const _F=bF;var SF=Object.defineProperty,uf=Object.getOwnPropertySymbols,Lk=Object.prototype.hasOwnProperty,zk=Object.prototype.propertyIsEnumerable,Kb=(e,t,r)=>t in e?SF(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Yb=(e,t)=>{for(var r in t||(t={}))Lk.call(t,r)&&Kb(e,r,t[r]);if(uf)for(var r of uf(t))zk.call(t,r)&&Kb(e,r,t[r]);return e},PF=(e,t)=>{var r={};for(var n in e)Lk.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&uf)for(var n of uf(e))t.indexOf(n)<0&&zk.call(e,n)&&(r[n]=e[n]);return r};const Fk=f.forwardRef((e,t)=>{var r=e,{width:n,height:o,fixed:i=!1,position:a,zIndex:l,hiddenBreakpoint:c="md",hidden:u=!1,withBorder:d=!0,className:p,classNames:h,styles:m,children:g,section:v,__staticSelector:_,unstyled:y,variant:x}=r,w=PF(r,["width","height","fixed","position","zIndex","hiddenBreakpoint","hidden","withBorder","className","classNames","styles","children","section","__staticSelector","unstyled","variant"]);const b=Mk(),{classes:C,cx:O,theme:P}=_F({width:n,height:o,fixed:b.fixed||i,position:a,hiddenBreakpoint:c,zIndex:l||b.zIndex||Tn("app"),section:v,withBorder:d,layout:b.layout},{classNames:h,styles:m,name:_,unstyled:y,variant:x}),E=tm(n,P).reduce(($,[k,I])=>($[`@media (min-width: ${ir(k)})`]={[`--mantine-${v}-width`]:j(I)},$),{});return S.createElement(ie,Yb({component:v==="navbar"?"nav":"aside",ref:t,"data-hidden":u||void 0,className:O(C.root,p)},w),g,S.createElement(HE,{styles:()=>({":root":Yb({[`--mantine-${v}-width`]:n!=null&&n.base?j(n.base):"0rem"},E)})}))});Fk.displayName="@mantine/core/HorizontalSection";var jF=Object.defineProperty,df=Object.getOwnPropertySymbols,Vk=Object.prototype.hasOwnProperty,Bk=Object.prototype.propertyIsEnumerable,Xb=(e,t,r)=>t in e?jF(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,OF=(e,t)=>{for(var r in t||(t={}))Vk.call(t,r)&&Xb(e,r,t[r]);if(df)for(var r of df(t))Bk.call(t,r)&&Xb(e,r,t[r]);return e},CF=(e,t)=>{var r={};for(var n in e)Vk.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&df)for(var n of df(e))t.indexOf(n)<0&&Bk.call(e,n)&&(r[n]=e[n]);return r};const Uk=f.forwardRef((e,t)=>{var r=e,{children:n,grow:o=!1,sx:i}=r,a=CF(r,["children","grow","sx"]);return S.createElement(ie,OF({ref:t,sx:[{flex:o?1:0,boxSizing:"border-box"},...wc(i)]},a),n)});Uk.displayName="@mantine/core/Section";const EF=Uk;var $F=Object.defineProperty,Jb=Object.getOwnPropertySymbols,kF=Object.prototype.hasOwnProperty,RF=Object.prototype.propertyIsEnumerable,Zb=(e,t,r)=>t in e?$F(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,TF=(e,t)=>{for(var r in t||(t={}))kF.call(t,r)&&Zb(e,r,t[r]);if(Jb)for(var r of Jb(t))RF.call(t,r)&&Zb(e,r,t[r]);return e};const IF={fixed:!1,position:{top:0,left:0},hiddenBreakpoint:"md",hidden:!1},Ml=f.forwardRef((e,t)=>{const r=H("Navbar",IF,e);return S.createElement(Fk,TF({section:"navbar",__staticSelector:"Navbar",ref:t},r))});Ml.Section=EF;Ml.displayName="@mantine/core/Navbar";var DF=Object.defineProperty,NF=Object.defineProperties,AF=Object.getOwnPropertyDescriptors,e_=Object.getOwnPropertySymbols,MF=Object.prototype.hasOwnProperty,LF=Object.prototype.propertyIsEnumerable,t_=(e,t,r)=>t in e?DF(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,yg=(e,t)=>{for(var r in t||(t={}))MF.call(t,r)&&t_(e,r,t[r]);if(e_)for(var r of e_(t))LF.call(t,r)&&t_(e,r,t[r]);return e},r_=(e,t)=>NF(e,AF(t)),zF=W((e,{height:t,fixed:r,position:n,zIndex:o,borderPosition:i,layout:a})=>{const l=typeof t=="object"&&t!==null?tm(t,e).reduce((c,[u,d])=>(c[`@media (min-width: ${ir(u)})`]={height:j(d),minHeight:j(d)},c),{}):null;return{root:r_(yg(r_(yg(yg({},e.fn.fontStyles()),n),{zIndex:o,left:a==="alt"?"var(--mantine-navbar-width, 0)":0,right:a==="alt"?"var(--mantine-aside-width, 0)":0,height:typeof t=="object"?j(t==null?void 0:t.base)||"100%":j(t),maxHeight:typeof t=="object"?j(t==null?void 0:t.base)||"100%":j(t),position:r?"fixed":"static",boxSizing:"border-box",backgroundColor:e.colorScheme==="dark"?e.colors.dark[7]:e.white}),l),{borderBottom:i==="bottom"?`${j(1)} solid ${e.colorScheme==="dark"?e.colors.dark[5]:e.colors.gray[2]}`:void 0,borderTop:i==="top"?`${j(1)} solid ${e.colorScheme==="dark"?e.colors.dark[5]:e.colors.gray[2]}`:void 0})}});const FF=zF;var VF=Object.defineProperty,ff=Object.getOwnPropertySymbols,Wk=Object.prototype.hasOwnProperty,Hk=Object.prototype.propertyIsEnumerable,n_=(e,t,r)=>t in e?VF(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,o_=(e,t)=>{for(var r in t||(t={}))Wk.call(t,r)&&n_(e,r,t[r]);if(ff)for(var r of ff(t))Hk.call(t,r)&&n_(e,r,t[r]);return e},BF=(e,t)=>{var r={};for(var n in e)Wk.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&ff)for(var n of ff(e))t.indexOf(n)<0&&Hk.call(e,n)&&(r[n]=e[n]);return r};const qk=f.forwardRef((e,t)=>{var r=e,{children:n,className:o,classNames:i,styles:a,height:l,fixed:c=!1,withBorder:u=!0,position:d,zIndex:p,section:h,unstyled:m,__staticSelector:g,variant:v}=r,_=BF(r,["children","className","classNames","styles","height","fixed","withBorder","position","zIndex","section","unstyled","__staticSelector","variant"]);const y=Mk(),x=p||y.zIndex||Tn("app"),{classes:w,cx:b,theme:C}=FF({height:l,fixed:y.fixed||c,position:d,zIndex:typeof x=="number"&&y.layout==="default"?x+1:x,layout:y.layout,borderPosition:u?h==="header"?"bottom":"top":"none"},{name:g,classNames:i,styles:a,unstyled:m,variant:v}),O=typeof l=="object"&&l!==null?tm(l,C).reduce((P,[E,$])=>(P[`@media (min-width: ${ir(E)})`]={[`--mantine-${h}-height`]:j($)},P),{}):null;return S.createElement(ie,o_({component:h==="header"?"header":"footer",className:b(w.root,o),ref:t},_),n,S.createElement(HE,{styles:()=>({":root":o_({[`--mantine-${h}-height`]:typeof l=="object"?j(l==null?void 0:l.base)||"100%":j(l)},O)})}))});qk.displayName="@mantine/core/VerticalSection";var UF=Object.defineProperty,WF=Object.defineProperties,HF=Object.getOwnPropertyDescriptors,i_=Object.getOwnPropertySymbols,qF=Object.prototype.hasOwnProperty,GF=Object.prototype.propertyIsEnumerable,a_=(e,t,r)=>t in e?UF(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,QF=(e,t)=>{for(var r in t||(t={}))qF.call(t,r)&&a_(e,r,t[r]);if(i_)for(var r of i_(t))GF.call(t,r)&&a_(e,r,t[r]);return e},KF=(e,t)=>WF(e,HF(t));const YF={fixed:!1,position:{top:0,left:0,right:0}},Gk=f.forwardRef((e,t)=>{const r=H("Header",YF,e);return S.createElement(qk,KF(QF({section:"header",__staticSelector:"Header"},r),{ref:t}))});Gk.displayName="@mantine/core/Header";var XF=Object.defineProperty,s_=Object.getOwnPropertySymbols,JF=Object.prototype.hasOwnProperty,ZF=Object.prototype.propertyIsEnumerable,l_=(e,t,r)=>t in e?XF(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Qk=(e,t)=>{for(var r in t||(t={}))JF.call(t,r)&&l_(e,r,t[r]);if(s_)for(var r of s_(t))ZF.call(t,r)&&l_(e,r,t[r]);return e};function eV(e,t){const r=L({size:e.padding,sizes:t.spacing}),n=e.navbarOffsetBreakpoint?L({size:e.navbarOffsetBreakpoint,sizes:t.breakpoints}):null,o=e.asideOffsetBreakpoint?L({size:e.asideOffsetBreakpoint,sizes:t.breakpoints}):null;if(!e.fixed)return{padding:r};const i=xr(n),a=xr(o);return Qk({minHeight:"100vh",paddingTop:`calc(var(--mantine-header-height, 0px) + ${r})`,paddingBottom:`calc(var(--mantine-footer-height, 0px) + ${r})`,paddingLeft:`calc(var(--mantine-navbar-width, 0px) + ${r})`,paddingRight:`calc(var(--mantine-aside-width, 0px) + ${r})`},i===a?{[`@media (max-width: ${ir(i-1)})`]:{paddingLeft:r,paddingRight:r}}:{[`@media (max-width: ${ir(i-1)})`]:{paddingLeft:r},[`@media (max-width: ${ir(a-1)})`]:{paddingRight:r}})}var tV=W((e,t)=>({root:{boxSizing:"border-box"},body:{display:"flex",boxSizing:"border-box"},main:Qk({flex:1,width:"100vw",boxSizing:"border-box"},eV(t,e))}));const rV=tV;var nV=Object.defineProperty,pf=Object.getOwnPropertySymbols,Kk=Object.prototype.hasOwnProperty,Yk=Object.prototype.propertyIsEnumerable,c_=(e,t,r)=>t in e?nV(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,oV=(e,t)=>{for(var r in t||(t={}))Kk.call(t,r)&&c_(e,r,t[r]);if(pf)for(var r of pf(t))Yk.call(t,r)&&c_(e,r,t[r]);return e},iV=(e,t)=>{var r={};for(var n in e)Kk.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&pf)for(var n of pf(e))t.indexOf(n)<0&&Yk.call(e,n)&&(r[n]=e[n]);return r};const aV={fixed:!0,padding:"md"},Xk=f.forwardRef((e,t)=>{const r=H("AppShell",aV,e),{children:n,navbar:o,header:i,footer:a,aside:l,fixed:c,zIndex:u,padding:d,navbarOffsetBreakpoint:p,asideOffsetBreakpoint:h,className:m,styles:g,classNames:v,unstyled:_,hidden:y,layout:x,variant:w}=r,b=iV(r,["children","navbar","header","footer","aside","fixed","zIndex","padding","navbarOffsetBreakpoint","asideOffsetBreakpoint","className","styles","classNames","unstyled","hidden","layout","variant"]),{classes:C,cx:O}=rV({padding:d,fixed:c,navbarOffsetBreakpoint:p,asideOffsetBreakpoint:h},{styles:g,classNames:v,unstyled:_,name:"AppShell",variant:w});return y?S.createElement(S.Fragment,null,n):S.createElement(mF,{value:{fixed:c,zIndex:u,layout:x}},S.createElement(ie,oV({className:O(C.root,m),ref:t},b),i,S.createElement("div",{className:C.body},o,S.createElement("main",{className:C.main},n),l),a))});Xk.displayName="@mantine/core/AppShell";const Pu={xs:j(1),sm:j(2),md:j(3),lg:j(4),xl:j(5)};function ju(e,t){const r=e.fn.variant({variant:"outline",color:t}).border;return typeof t=="string"&&(t in e.colors||t.split(".")[0]in e.colors)?r:t===void 0?e.colorScheme==="dark"?e.colors.dark[4]:e.colors.gray[4]:t}var sV=W((e,{color:t},{size:r,variant:n})=>({root:{},withLabel:{borderTop:"0 !important"},left:{"&::before":{display:"none"}},right:{"&::after":{display:"none"}},label:{display:"flex",alignItems:"center","&::before":{content:'""',flex:1,height:j(1),borderTop:`${L({size:r,sizes:Pu})} ${n} ${ju(e,t)}`,marginRight:e.spacing.xs},"&::after":{content:'""',flex:1,borderTop:`${L({size:r,sizes:Pu})} ${n} ${ju(e,t)}`,marginLeft:e.spacing.xs}},labelDefaultStyles:{color:t==="dark"?e.colors.dark[1]:e.fn.themeColor(t,e.colorScheme==="dark"?5:e.fn.primaryShade(),!1)},horizontal:{border:0,borderTopWidth:j(L({size:r,sizes:Pu})),borderTopColor:ju(e,t),borderTopStyle:n,margin:0},vertical:{border:0,alignSelf:"stretch",height:"auto",borderLeftWidth:j(L({size:r,sizes:Pu})),borderLeftColor:ju(e,t),borderLeftStyle:n}}));const lV=sV;var cV=Object.defineProperty,uV=Object.defineProperties,dV=Object.getOwnPropertyDescriptors,hf=Object.getOwnPropertySymbols,Jk=Object.prototype.hasOwnProperty,Zk=Object.prototype.propertyIsEnumerable,u_=(e,t,r)=>t in e?cV(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,d_=(e,t)=>{for(var r in t||(t={}))Jk.call(t,r)&&u_(e,r,t[r]);if(hf)for(var r of hf(t))Zk.call(t,r)&&u_(e,r,t[r]);return e},fV=(e,t)=>uV(e,dV(t)),pV=(e,t)=>{var r={};for(var n in e)Jk.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&hf)for(var n of hf(e))t.indexOf(n)<0&&Zk.call(e,n)&&(r[n]=e[n]);return r};const hV={orientation:"horizontal",size:"xs",labelPosition:"left",variant:"solid"},hr=f.forwardRef((e,t)=>{const r=H("Divider",hV,e),{className:n,color:o,orientation:i,size:a,label:l,labelPosition:c,labelProps:u,variant:d,styles:p,classNames:h,unstyled:m}=r,g=pV(r,["className","color","orientation","size","label","labelPosition","labelProps","variant","styles","classNames","unstyled"]),{classes:v,cx:_}=lV({color:o},{classNames:h,styles:p,unstyled:m,name:"Divider",variant:d,size:a}),y=i==="vertical",x=i==="horizontal",w=!!l&&x,b=!(u!=null&&u.color);return S.createElement(ie,d_({ref:t,className:_(v.root,{[v.vertical]:y,[v.horizontal]:x,[v.withLabel]:w},n),role:"separator"},g),w&&S.createElement(oe,fV(d_({},u),{size:(u==null?void 0:u.size)||"xs",mt:j(2),className:_(v.label,v[c],{[v.labelDefaultStyles]:b})}),l))});hr.displayName="@mantine/core/Divider";var mV=Object.defineProperty,gV=Object.defineProperties,vV=Object.getOwnPropertyDescriptors,f_=Object.getOwnPropertySymbols,yV=Object.prototype.hasOwnProperty,xV=Object.prototype.propertyIsEnumerable,p_=(e,t,r)=>t in e?mV(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,h_=(e,t)=>{for(var r in t||(t={}))yV.call(t,r)&&p_(e,r,t[r]);if(f_)for(var r of f_(t))xV.call(t,r)&&p_(e,r,t[r]);return e},wV=(e,t)=>gV(e,vV(t)),bV=W((e,t,{size:r})=>({item:wV(h_({},e.fn.fontStyles()),{boxSizing:"border-box",wordBreak:"break-all",textAlign:"left",width:"100%",padding:`calc(${L({size:r,sizes:e.spacing})} / 1.5) ${L({size:r,sizes:e.spacing})}`,cursor:"pointer",fontSize:L({size:r,sizes:e.fontSizes}),color:e.colorScheme==="dark"?e.colors.dark[0]:e.black,borderRadius:e.fn.radius(),"&[data-hovered]":{backgroundColor:e.colorScheme==="dark"?e.colors.dark[4]:e.colors.gray[1]},"&[data-selected]":h_({backgroundColor:e.fn.variant({variant:"filled"}).background,color:e.fn.variant({variant:"filled"}).color},e.fn.hover({backgroundColor:e.fn.variant({variant:"filled"}).hover})),"&[data-disabled]":{cursor:"default",color:e.colors.dark[2]}}),nothingFound:{boxSizing:"border-box",color:e.colors.gray[6],paddingTop:`calc(${L({size:r,sizes:e.spacing})} / 2)`,paddingBottom:`calc(${L({size:r,sizes:e.spacing})} / 2)`,textAlign:"center"},separator:{boxSizing:"border-box",textAlign:"left",width:"100%",padding:`calc(${L({size:r,sizes:e.spacing})} / 1.5) ${L({size:r,sizes:e.spacing})}`},separatorLabel:{color:e.colorScheme==="dark"?e.colors.dark[3]:e.colors.gray[5]}}));const _V=bV;var SV=Object.defineProperty,m_=Object.getOwnPropertySymbols,PV=Object.prototype.hasOwnProperty,jV=Object.prototype.propertyIsEnumerable,g_=(e,t,r)=>t in e?SV(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,OV=(e,t)=>{for(var r in t||(t={}))PV.call(t,r)&&g_(e,r,t[r]);if(m_)for(var r of m_(t))jV.call(t,r)&&g_(e,r,t[r]);return e};function eR({data:e,hovered:t,classNames:r,styles:n,isItemSelected:o,uuid:i,__staticSelector:a,onItemHover:l,onItemSelect:c,itemsRefs:u,itemComponent:d,size:p,nothingFound:h,creatable:m,createLabel:g,unstyled:v,variant:_}){const{classes:y}=_V(null,{classNames:r,styles:n,unstyled:v,name:a,variant:_,size:p}),x=[],w=[];let b=null;const C=(P,E)=>{const $=typeof o=="function"?o(P.value):!1;return S.createElement(d,OV({key:P.value,className:y.item,"data-disabled":P.disabled||void 0,"data-hovered":!P.disabled&&t===E||void 0,"data-selected":!P.disabled&&$||void 0,selected:$,onMouseEnter:()=>l(E),id:`${i}-${E}`,role:"option",tabIndex:-1,"aria-selected":t===E,ref:k=>{u&&u.current&&(u.current[P.value]=k)},onMouseDown:P.disabled?null:k=>{k.preventDefault(),c(P)},disabled:P.disabled,variant:_},P))};let O=null;if(e.forEach((P,E)=>{P.creatable?b=E:P.group?(O!==P.group&&(O=P.group,w.push(S.createElement("div",{className:y.separator,key:`__mantine-divider-${E}`},S.createElement(hr,{classNames:{label:y.separatorLabel},label:P.group})))),w.push(C(P,E))):x.push(C(P,E))}),m){const P=e[b];x.push(S.createElement("div",{key:Lh(),className:y.item,"data-hovered":t===b||void 0,onMouseEnter:()=>l(b),onMouseDown:E=>{E.preventDefault(),c(P)},tabIndex:-1,ref:E=>{u&&u.current&&(u.current[P.value]=E)}},g))}return w.length>0&&x.length>0&&x.unshift(S.createElement("div",{className:y.separator,key:"empty-group-separator"},S.createElement(hr,null))),w.length>0||x.length>0?S.createElement(S.Fragment,null,w,x):S.createElement(oe,{size:p,unstyled:v,className:y.nothingFound},h)}eR.displayName="@mantine/core/SelectItems";var CV=Object.defineProperty,mf=Object.getOwnPropertySymbols,tR=Object.prototype.hasOwnProperty,rR=Object.prototype.propertyIsEnumerable,v_=(e,t,r)=>t in e?CV(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,EV=(e,t)=>{for(var r in t||(t={}))tR.call(t,r)&&v_(e,r,t[r]);if(mf)for(var r of mf(t))rR.call(t,r)&&v_(e,r,t[r]);return e},$V=(e,t)=>{var r={};for(var n in e)tR.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&mf)for(var n of mf(e))t.indexOf(n)<0&&rR.call(e,n)&&(r[n]=e[n]);return r};const nR=f.forwardRef((e,t)=>{var r=e,{label:n,value:o}=r,i=$V(r,["label","value"]);return S.createElement("div",EV({ref:t},i),n||o)});nR.displayName="@mantine/core/DefaultItem";function kV(e,t){typeof e=="function"?e(t):e!=null&&(e.current=t)}function oR(...e){return t=>e.forEach(r=>kV(r,t))}function ha(...e){return f.useCallback(oR(...e),e)}const iR=f.forwardRef((e,t)=>{const{children:r,...n}=e,o=f.Children.toArray(r),i=o.find(TV);if(i){const a=i.props.children,l=o.map(c=>c===i?f.Children.count(a)>1?f.Children.only(null):f.isValidElement(a)?a.props.children:null:c);return f.createElement(ey,it({},n,{ref:t}),f.isValidElement(a)?f.cloneElement(a,void 0,l):null)}return f.createElement(ey,it({},n,{ref:t}),r)});iR.displayName="Slot";const ey=f.forwardRef((e,t)=>{const{children:r,...n}=e;return f.isValidElement(r)?f.cloneElement(r,{...IV(n,r.props),ref:oR(t,r.ref)}):f.Children.count(r)>1?f.Children.only(null):null});ey.displayName="SlotClone";const RV=({children:e})=>f.createElement(f.Fragment,null,e);function TV(e){return f.isValidElement(e)&&e.type===RV}function IV(e,t){const r={...t};for(const n in t){const o=e[n],i=t[n];/^on[A-Z]/.test(n)?o&&i?r[n]=(...l)=>{i(...l),o(...l)}:o&&(r[n]=o):n==="style"?r[n]={...o,...i}:n==="className"&&(r[n]=[o,i].filter(Boolean).join(" "))}return{...e,...r}}const DV=["a","button","div","h2","h3","img","label","li","nav","ol","p","span","svg","ul"],kc=DV.reduce((e,t)=>{const r=f.forwardRef((n,o)=>{const{asChild:i,...a}=n,l=i?iR:t;return f.useEffect(()=>{window[Symbol.for("radix-ui")]=!0},[]),f.createElement(l,it({},a,{ref:o}))});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),ty=globalThis!=null&&globalThis.document?f.useLayoutEffect:()=>{};function NV(e,t){return f.useReducer((r,n)=>{const o=t[r][n];return o??r},e)}const Rc=e=>{const{present:t,children:r}=e,n=AV(t),o=typeof r=="function"?r({present:n.isPresent}):f.Children.only(r),i=ha(n.ref,o.ref);return typeof r=="function"||n.isPresent?f.cloneElement(o,{ref:i}):null};Rc.displayName="Presence";function AV(e){const[t,r]=f.useState(),n=f.useRef({}),o=f.useRef(e),i=f.useRef("none"),a=e?"mounted":"unmounted",[l,c]=NV(a,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return f.useEffect(()=>{const u=Ou(n.current);i.current=l==="mounted"?u:"none"},[l]),ty(()=>{const u=n.current,d=o.current;if(d!==e){const h=i.current,m=Ou(u);e?c("MOUNT"):m==="none"||(u==null?void 0:u.display)==="none"?c("UNMOUNT"):c(d&&h!==m?"ANIMATION_OUT":"UNMOUNT"),o.current=e}},[e,c]),ty(()=>{if(t){const u=p=>{const m=Ou(n.current).includes(p.animationName);p.target===t&&m&&As.flushSync(()=>c("ANIMATION_END"))},d=p=>{p.target===t&&(i.current=Ou(n.current))};return t.addEventListener("animationstart",d),t.addEventListener("animationcancel",u),t.addEventListener("animationend",u),()=>{t.removeEventListener("animationstart",d),t.removeEventListener("animationcancel",u),t.removeEventListener("animationend",u)}}else c("ANIMATION_END")},[t,c]),{isPresent:["mounted","unmountSuspended"].includes(l),ref:f.useCallback(u=>{u&&(n.current=getComputedStyle(u)),r(u)},[])}}function Ou(e){return(e==null?void 0:e.animationName)||"none"}function MV(e,t=[]){let r=[];function n(i,a){const l=f.createContext(a),c=r.length;r=[...r,a];function u(p){const{scope:h,children:m,...g}=p,v=(h==null?void 0:h[e][c])||l,_=f.useMemo(()=>g,Object.values(g));return f.createElement(v.Provider,{value:_},m)}function d(p,h){const m=(h==null?void 0:h[e][c])||l,g=f.useContext(m);if(g)return g;if(a!==void 0)return a;throw new Error(`\`${p}\` must be used within \`${i}\``)}return u.displayName=i+"Provider",[u,d]}const o=()=>{const i=r.map(a=>f.createContext(a));return function(l){const c=(l==null?void 0:l[e])||i;return f.useMemo(()=>({[`__scope${e}`]:{...l,[e]:c}}),[l,c])}};return o.scopeName=e,[n,LV(o,...t)]}function LV(...e){const t=e[0];if(e.length===1)return t;const r=()=>{const n=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(i){const a=n.reduce((l,{useScope:c,scopeName:u})=>{const p=c(i)[`__scope${u}`];return{...l,...p}},{});return f.useMemo(()=>({[`__scope${t.scopeName}`]:a}),[a])}};return r.scopeName=t.scopeName,r}function Ui(e){const t=f.useRef(e);return f.useEffect(()=>{t.current=e}),f.useMemo(()=>(...r)=>{var n;return(n=t.current)===null||n===void 0?void 0:n.call(t,...r)},[])}const zV=f.createContext(void 0);function FV(e){const t=f.useContext(zV);return e||t||"ltr"}function VV(e,[t,r]){return Math.min(r,Math.max(t,e))}function Ji(e,t,{checkForDefaultPrevented:r=!0}={}){return function(o){if(e==null||e(o),r===!1||!o.defaultPrevented)return t==null?void 0:t(o)}}function BV(e,t){return f.useReducer((r,n)=>{const o=t[r][n];return o??r},e)}const aR="ScrollArea",[sR,xye]=MV(aR),[UV,gn]=sR(aR),WV=f.forwardRef((e,t)=>{const{__scopeScrollArea:r,type:n="hover",dir:o,scrollHideDelay:i=600,...a}=e,[l,c]=f.useState(null),[u,d]=f.useState(null),[p,h]=f.useState(null),[m,g]=f.useState(null),[v,_]=f.useState(null),[y,x]=f.useState(0),[w,b]=f.useState(0),[C,O]=f.useState(!1),[P,E]=f.useState(!1),$=ha(t,I=>c(I)),k=FV(o);return f.createElement(UV,{scope:r,type:n,dir:k,scrollHideDelay:i,scrollArea:l,viewport:u,onViewportChange:d,content:p,onContentChange:h,scrollbarX:m,onScrollbarXChange:g,scrollbarXEnabled:C,onScrollbarXEnabledChange:O,scrollbarY:v,onScrollbarYChange:_,scrollbarYEnabled:P,onScrollbarYEnabledChange:E,onCornerWidthChange:x,onCornerHeightChange:b},f.createElement(kc.div,it({dir:k},a,{ref:$,style:{position:"relative","--radix-scroll-area-corner-width":y+"px","--radix-scroll-area-corner-height":w+"px",...e.style}})))}),HV="ScrollAreaViewport",qV=f.forwardRef((e,t)=>{const{__scopeScrollArea:r,children:n,...o}=e,i=gn(HV,r),a=f.useRef(null),l=ha(t,a,i.onViewportChange);return f.createElement(f.Fragment,null,f.createElement("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"}}),f.createElement(kc.div,it({"data-radix-scroll-area-viewport":""},o,{ref:l,style:{overflowX:i.scrollbarXEnabled?"scroll":"hidden",overflowY:i.scrollbarYEnabled?"scroll":"hidden",...e.style}}),f.createElement("div",{ref:i.onContentChange,style:{minWidth:"100%",display:"table"}},n)))}),Ao="ScrollAreaScrollbar",GV=f.forwardRef((e,t)=>{const{forceMount:r,...n}=e,o=gn(Ao,e.__scopeScrollArea),{onScrollbarXEnabledChange:i,onScrollbarYEnabledChange:a}=o,l=e.orientation==="horizontal";return f.useEffect(()=>(l?i(!0):a(!0),()=>{l?i(!1):a(!1)}),[l,i,a]),o.type==="hover"?f.createElement(QV,it({},n,{ref:t,forceMount:r})):o.type==="scroll"?f.createElement(KV,it({},n,{ref:t,forceMount:r})):o.type==="auto"?f.createElement(lR,it({},n,{ref:t,forceMount:r})):o.type==="always"?f.createElement(B0,it({},n,{ref:t})):null}),QV=f.forwardRef((e,t)=>{const{forceMount:r,...n}=e,o=gn(Ao,e.__scopeScrollArea),[i,a]=f.useState(!1);return f.useEffect(()=>{const l=o.scrollArea;let c=0;if(l){const u=()=>{window.clearTimeout(c),a(!0)},d=()=>{c=window.setTimeout(()=>a(!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]),f.createElement(Rc,{present:r||i},f.createElement(lR,it({"data-state":i?"visible":"hidden"},n,{ref:t})))}),KV=f.forwardRef((e,t)=>{const{forceMount:r,...n}=e,o=gn(Ao,e.__scopeScrollArea),i=e.orientation==="horizontal",a=nm(()=>c("SCROLL_END"),100),[l,c]=BV("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});return f.useEffect(()=>{if(l==="idle"){const u=window.setTimeout(()=>c("HIDE"),o.scrollHideDelay);return()=>window.clearTimeout(u)}},[l,o.scrollHideDelay,c]),f.useEffect(()=>{const u=o.viewport,d=i?"scrollLeft":"scrollTop";if(u){let p=u[d];const h=()=>{const m=u[d];p!==m&&(c("SCROLL"),a()),p=m};return u.addEventListener("scroll",h),()=>u.removeEventListener("scroll",h)}},[o.viewport,i,c,a]),f.createElement(Rc,{present:r||l!=="hidden"},f.createElement(B0,it({"data-state":l==="hidden"?"hidden":"visible"},n,{ref:t,onPointerEnter:Ji(e.onPointerEnter,()=>c("POINTER_ENTER")),onPointerLeave:Ji(e.onPointerLeave,()=>c("POINTER_LEAVE"))})))}),lR=f.forwardRef((e,t)=>{const r=gn(Ao,e.__scopeScrollArea),{forceMount:n,...o}=e,[i,a]=f.useState(!1),l=e.orientation==="horizontal",c=nm(()=>{if(r.viewport){const u=r.viewport.offsetWidth<r.viewport.scrollWidth,d=r.viewport.offsetHeight<r.viewport.scrollHeight;a(l?u:d)}},10);return bs(r.viewport,c),bs(r.content,c),f.createElement(Rc,{present:n||i},f.createElement(B0,it({"data-state":i?"visible":"hidden"},o,{ref:t})))}),B0=f.forwardRef((e,t)=>{const{orientation:r="vertical",...n}=e,o=gn(Ao,e.__scopeScrollArea),i=f.useRef(null),a=f.useRef(0),[l,c]=f.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),u=fR(l.viewport,l.content),d={...n,sizes:l,onSizesChange:c,hasThumb:u>0&&u<1,onThumbChange:h=>i.current=h,onThumbPointerUp:()=>a.current=0,onThumbPointerDown:h=>a.current=h};function p(h,m){return nB(h,a.current,l,m)}return r==="horizontal"?f.createElement(YV,it({},d,{ref:t,onThumbPositionChange:()=>{if(o.viewport&&i.current){const h=o.viewport.scrollLeft,m=y_(h,l,o.dir);i.current.style.transform=`translate3d(${m}px, 0, 0)`}},onWheelScroll:h=>{o.viewport&&(o.viewport.scrollLeft=h)},onDragScroll:h=>{o.viewport&&(o.viewport.scrollLeft=p(h,o.dir))}})):r==="vertical"?f.createElement(XV,it({},d,{ref:t,onThumbPositionChange:()=>{if(o.viewport&&i.current){const h=o.viewport.scrollTop,m=y_(h,l);i.current.style.transform=`translate3d(0, ${m}px, 0)`}},onWheelScroll:h=>{o.viewport&&(o.viewport.scrollTop=h)},onDragScroll:h=>{o.viewport&&(o.viewport.scrollTop=p(h))}})):null}),YV=f.forwardRef((e,t)=>{const{sizes:r,onSizesChange:n,...o}=e,i=gn(Ao,e.__scopeScrollArea),[a,l]=f.useState(),c=f.useRef(null),u=ha(t,c,i.onScrollbarXChange);return f.useEffect(()=>{c.current&&l(getComputedStyle(c.current))},[c]),f.createElement(uR,it({"data-orientation":"horizontal"},o,{ref:u,sizes:r,style:{bottom:0,left:i.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:i.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":rm(r)+"px",...e.style},onThumbPointerDown:d=>e.onThumbPointerDown(d.x),onDragScroll:d=>e.onDragScroll(d.x),onWheelScroll:(d,p)=>{if(i.viewport){const h=i.viewport.scrollLeft+d.deltaX;e.onWheelScroll(h),hR(h,p)&&d.preventDefault()}},onResize:()=>{c.current&&i.viewport&&a&&n({content:i.viewport.scrollWidth,viewport:i.viewport.offsetWidth,scrollbar:{size:c.current.clientWidth,paddingStart:gf(a.paddingLeft),paddingEnd:gf(a.paddingRight)}})}}))}),XV=f.forwardRef((e,t)=>{const{sizes:r,onSizesChange:n,...o}=e,i=gn(Ao,e.__scopeScrollArea),[a,l]=f.useState(),c=f.useRef(null),u=ha(t,c,i.onScrollbarYChange);return f.useEffect(()=>{c.current&&l(getComputedStyle(c.current))},[c]),f.createElement(uR,it({"data-orientation":"vertical"},o,{ref:u,sizes:r,style:{top:0,right:i.dir==="ltr"?0:void 0,left:i.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":rm(r)+"px",...e.style},onThumbPointerDown:d=>e.onThumbPointerDown(d.y),onDragScroll:d=>e.onDragScroll(d.y),onWheelScroll:(d,p)=>{if(i.viewport){const h=i.viewport.scrollTop+d.deltaY;e.onWheelScroll(h),hR(h,p)&&d.preventDefault()}},onResize:()=>{c.current&&i.viewport&&a&&n({content:i.viewport.scrollHeight,viewport:i.viewport.offsetHeight,scrollbar:{size:c.current.clientHeight,paddingStart:gf(a.paddingTop),paddingEnd:gf(a.paddingBottom)}})}}))}),[JV,cR]=sR(Ao),uR=f.forwardRef((e,t)=>{const{__scopeScrollArea:r,sizes:n,hasThumb:o,onThumbChange:i,onThumbPointerUp:a,onThumbPointerDown:l,onThumbPositionChange:c,onDragScroll:u,onWheelScroll:d,onResize:p,...h}=e,m=gn(Ao,r),[g,v]=f.useState(null),_=ha(t,$=>v($)),y=f.useRef(null),x=f.useRef(""),w=m.viewport,b=n.content-n.viewport,C=Ui(d),O=Ui(c),P=nm(p,10);function E($){if(y.current){const k=$.clientX-y.current.left,I=$.clientY-y.current.top;u({x:k,y:I})}}return f.useEffect(()=>{const $=k=>{const I=k.target;(g==null?void 0:g.contains(I))&&C(k,b)};return document.addEventListener("wheel",$,{passive:!1}),()=>document.removeEventListener("wheel",$,{passive:!1})},[w,g,b,C]),f.useEffect(O,[n,O]),bs(g,P),bs(m.content,P),f.createElement(JV,{scope:r,scrollbar:g,hasThumb:o,onThumbChange:Ui(i),onThumbPointerUp:Ui(a),onThumbPositionChange:O,onThumbPointerDown:Ui(l)},f.createElement(kc.div,it({},h,{ref:_,style:{position:"absolute",...h.style},onPointerDown:Ji(e.onPointerDown,$=>{$.button===0&&($.target.setPointerCapture($.pointerId),y.current=g.getBoundingClientRect(),x.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",E($))}),onPointerMove:Ji(e.onPointerMove,E),onPointerUp:Ji(e.onPointerUp,$=>{const k=$.target;k.hasPointerCapture($.pointerId)&&k.releasePointerCapture($.pointerId),document.body.style.webkitUserSelect=x.current,y.current=null})})))}),ry="ScrollAreaThumb",ZV=f.forwardRef((e,t)=>{const{forceMount:r,...n}=e,o=cR(ry,e.__scopeScrollArea);return f.createElement(Rc,{present:r||o.hasThumb},f.createElement(eB,it({ref:t},n)))}),eB=f.forwardRef((e,t)=>{const{__scopeScrollArea:r,style:n,...o}=e,i=gn(ry,r),a=cR(ry,r),{onThumbPositionChange:l}=a,c=ha(t,p=>a.onThumbChange(p)),u=f.useRef(),d=nm(()=>{u.current&&(u.current(),u.current=void 0)},100);return f.useEffect(()=>{const p=i.viewport;if(p){const h=()=>{if(d(),!u.current){const m=oB(p,l);u.current=m,l()}};return l(),p.addEventListener("scroll",h),()=>p.removeEventListener("scroll",h)}},[i.viewport,d,l]),f.createElement(kc.div,it({"data-state":a.hasThumb?"visible":"hidden"},o,{ref:c,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...n},onPointerDownCapture:Ji(e.onPointerDownCapture,p=>{const m=p.target.getBoundingClientRect(),g=p.clientX-m.left,v=p.clientY-m.top;a.onThumbPointerDown({x:g,y:v})}),onPointerUp:Ji(e.onPointerUp,a.onThumbPointerUp)}))}),dR="ScrollAreaCorner",tB=f.forwardRef((e,t)=>{const r=gn(dR,e.__scopeScrollArea),n=!!(r.scrollbarX&&r.scrollbarY);return r.type!=="scroll"&&n?f.createElement(rB,it({},e,{ref:t})):null}),rB=f.forwardRef((e,t)=>{const{__scopeScrollArea:r,...n}=e,o=gn(dR,r),[i,a]=f.useState(0),[l,c]=f.useState(0),u=!!(i&&l);return bs(o.scrollbarX,()=>{var d;const p=((d=o.scrollbarX)===null||d===void 0?void 0:d.offsetHeight)||0;o.onCornerHeightChange(p),c(p)}),bs(o.scrollbarY,()=>{var d;const p=((d=o.scrollbarY)===null||d===void 0?void 0:d.offsetWidth)||0;o.onCornerWidthChange(p),a(p)}),u?f.createElement(kc.div,it({},n,{ref:t,style:{width:i,height:l,position:"absolute",right:o.dir==="ltr"?0:void 0,left:o.dir==="rtl"?0:void 0,bottom:0,...e.style}})):null});function gf(e){return e?parseInt(e,10):0}function fR(e,t){const r=e/t;return isNaN(r)?0:r}function rm(e){const t=fR(e.viewport,e.content),r=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,n=(e.scrollbar.size-r)*t;return Math.max(n,18)}function nB(e,t,r,n="ltr"){const o=rm(r),i=o/2,a=t||i,l=o-a,c=r.scrollbar.paddingStart+a,u=r.scrollbar.size-r.scrollbar.paddingEnd-l,d=r.content-r.viewport,p=n==="ltr"?[0,d]:[d*-1,0];return pR([c,u],p)(e)}function y_(e,t,r="ltr"){const n=rm(t),o=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,i=t.scrollbar.size-o,a=t.content-t.viewport,l=i-n,c=r==="ltr"?[0,a]:[a*-1,0],u=VV(e,c);return pR([0,a],[0,l])(u)}function pR(e,t){return r=>{if(e[0]===e[1]||t[0]===t[1])return t[0];const n=(t[1]-t[0])/(e[1]-e[0]);return t[0]+n*(r-e[0])}}function hR(e,t){return e>0&&e<t}const oB=(e,t=()=>{})=>{let r={left:e.scrollLeft,top:e.scrollTop},n=0;return function o(){const i={left:e.scrollLeft,top:e.scrollTop},a=r.left!==i.left,l=r.top!==i.top;(a||l)&&t(),r=i,n=window.requestAnimationFrame(o)}(),()=>window.cancelAnimationFrame(n)};function nm(e,t){const r=Ui(e),n=f.useRef(0);return f.useEffect(()=>()=>window.clearTimeout(n.current),[]),f.useCallback(()=>{window.clearTimeout(n.current),n.current=window.setTimeout(r,t)},[r,t])}function bs(e,t){const r=Ui(t);ty(()=>{let n=0;if(e){const o=new ResizeObserver(()=>{cancelAnimationFrame(n),n=window.requestAnimationFrame(r)});return o.observe(e),()=>{window.cancelAnimationFrame(n),o.unobserve(e)}}},[e,r])}const iB=WV,aB=qV,x_=GV,w_=ZV,sB=tB;var lB=W((e,{scrollbarSize:t,offsetScrollbars:r,scrollbarHovered:n,hidden:o})=>({root:{overflow:"hidden"},viewport:{width:"100%",height:"100%",paddingRight:r?j(t):void 0,paddingBottom:r?j(t):void 0},scrollbar:{display:o?"none":"flex",userSelect:"none",touchAction:"none",boxSizing:"border-box",padding:`calc(${j(t)} / 5)`,transition:"background-color 150ms ease, opacity 150ms ease","&:hover":{backgroundColor:e.colorScheme==="dark"?e.colors.dark[8]:e.colors.gray[0],[`& .${Vt("thumb")}`]:{backgroundColor:e.colorScheme==="dark"?e.fn.rgba(e.white,.5):e.fn.rgba(e.black,.5)}},'&[data-orientation="vertical"]':{width:j(t)},'&[data-orientation="horizontal"]':{flexDirection:"column",height:j(t)},'&[data-state="hidden"]':{display:"none",opacity:0}},thumb:{ref:Vt("thumb"),flex:1,backgroundColor:e.colorScheme==="dark"?e.fn.rgba(e.white,.4):e.fn.rgba(e.black,.4),borderRadius:j(t),position:"relative",transition:"background-color 150ms ease",display:o?"none":void 0,overflow:"hidden","&::before":{content:'""',position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",width:"100%",height:"100%",minWidth:j(44),minHeight:j(44)}},corner:{backgroundColor:e.colorScheme==="dark"?e.colors.dark[6]:e.colors.gray[0],transition:"opacity 150ms ease",opacity:n?1:0,display:o?"none":void 0}}));const cB=lB;var uB=Object.defineProperty,dB=Object.defineProperties,fB=Object.getOwnPropertyDescriptors,vf=Object.getOwnPropertySymbols,mR=Object.prototype.hasOwnProperty,gR=Object.prototype.propertyIsEnumerable,b_=(e,t,r)=>t in e?uB(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,ny=(e,t)=>{for(var r in t||(t={}))mR.call(t,r)&&b_(e,r,t[r]);if(vf)for(var r of vf(t))gR.call(t,r)&&b_(e,r,t[r]);return e},vR=(e,t)=>dB(e,fB(t)),yR=(e,t)=>{var r={};for(var n in e)mR.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&vf)for(var n of vf(e))t.indexOf(n)<0&&gR.call(e,n)&&(r[n]=e[n]);return r};const xR={scrollbarSize:12,scrollHideDelay:1e3,type:"hover",offsetScrollbars:!1},om=f.forwardRef((e,t)=>{const r=H("ScrollArea",xR,e),{children:n,className:o,classNames:i,styles:a,scrollbarSize:l,scrollHideDelay:c,type:u,dir:d,offsetScrollbars:p,viewportRef:h,onScrollPositionChange:m,unstyled:g,variant:v,viewportProps:_}=r,y=yR(r,["children","className","classNames","styles","scrollbarSize","scrollHideDelay","type","dir","offsetScrollbars","viewportRef","onScrollPositionChange","unstyled","variant","viewportProps"]),[x,w]=f.useState(!1),b=Jt(),{classes:C,cx:O}=cB({scrollbarSize:l,offsetScrollbars:p,scrollbarHovered:x,hidden:u==="never"},{name:"ScrollArea",classNames:i,styles:a,unstyled:g,variant:v});return S.createElement(iB,{type:u==="never"?"always":u,scrollHideDelay:c,dir:d||b.dir,ref:t,asChild:!0},S.createElement(ie,ny({className:O(C.root,o)},y),S.createElement(aB,vR(ny({},_),{className:C.viewport,ref:h,onScroll:typeof m=="function"?({currentTarget:P})=>m({x:P.scrollLeft,y:P.scrollTop}):void 0}),n),S.createElement(x_,{orientation:"horizontal",className:C.scrollbar,forceMount:!0,onMouseEnter:()=>w(!0),onMouseLeave:()=>w(!1)},S.createElement(w_,{className:C.thumb})),S.createElement(x_,{orientation:"vertical",className:C.scrollbar,forceMount:!0,onMouseEnter:()=>w(!0),onMouseLeave:()=>w(!1)},S.createElement(w_,{className:C.thumb})),S.createElement(sB,{className:C.corner})))}),wR=f.forwardRef((e,t)=>{const r=H("ScrollAreaAutosize",xR,e),{children:n,classNames:o,styles:i,scrollbarSize:a,scrollHideDelay:l,type:c,dir:u,offsetScrollbars:d,viewportRef:p,onScrollPositionChange:h,unstyled:m,sx:g,variant:v,viewportProps:_}=r,y=yR(r,["children","classNames","styles","scrollbarSize","scrollHideDelay","type","dir","offsetScrollbars","viewportRef","onScrollPositionChange","unstyled","sx","variant","viewportProps"]);return S.createElement(ie,vR(ny({},y),{ref:t,sx:[{display:"flex"},...wc(g)]}),S.createElement(ie,{sx:{display:"flex",flexDirection:"column",flex:1}},S.createElement(om,{classNames:o,styles:i,scrollHideDelay:l,scrollbarSize:a,type:c,dir:u,offsetScrollbars:d,viewportRef:p,onScrollPositionChange:h,unstyled:m,variant:v,viewportProps:_},n)))});wR.displayName="@mantine/core/ScrollAreaAutosize";om.displayName="@mantine/core/ScrollArea";om.Autosize=wR;const ma=om;var pB=Object.defineProperty,hB=Object.defineProperties,mB=Object.getOwnPropertyDescriptors,yf=Object.getOwnPropertySymbols,bR=Object.prototype.hasOwnProperty,_R=Object.prototype.propertyIsEnumerable,__=(e,t,r)=>t in e?pB(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,S_=(e,t)=>{for(var r in t||(t={}))bR.call(t,r)&&__(e,r,t[r]);if(yf)for(var r of yf(t))_R.call(t,r)&&__(e,r,t[r]);return e},gB=(e,t)=>hB(e,mB(t)),vB=(e,t)=>{var r={};for(var n in e)bR.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&yf)for(var n of yf(e))t.indexOf(n)<0&&_R.call(e,n)&&(r[n]=e[n]);return r};const U0=f.forwardRef((e,t)=>{var r=e,{style:n}=r,o=vB(r,["style"]);return S.createElement(ma,gB(S_({},o),{style:S_({width:"100%"},n),viewportProps:{tabIndex:-1},viewportRef:t}),o.children)});U0.displayName="@mantine/core/SelectScrollArea";var yB=W(()=>({dropdown:{},itemsWrapper:{padding:j(4),display:"flex",width:"100%",boxSizing:"border-box"}}));const xB=yB,En=Math.min,nr=Math.max,xf=Math.round,Cu=Math.floor,bi=e=>({x:e,y:e}),wB={left:"right",right:"left",bottom:"top",top:"bottom"},bB={start:"end",end:"start"};function oy(e,t,r){return nr(e,En(t,r))}function Eo(e,t){return typeof e=="function"?e(t):e}function $n(e){return e.split("-")[0]}function Ls(e){return e.split("-")[1]}function W0(e){return e==="x"?"y":"x"}function H0(e){return e==="y"?"height":"width"}function ga(e){return["top","bottom"].includes($n(e))?"y":"x"}function q0(e){return W0(ga(e))}function _B(e,t,r){r===void 0&&(r=!1);const n=Ls(e),o=q0(e),i=H0(o);let a=o==="x"?n===(r?"end":"start")?"right":"left":n==="start"?"bottom":"top";return t.reference[i]>t.floating[i]&&(a=wf(a)),[a,wf(a)]}function SB(e){const t=wf(e);return[iy(e),t,iy(t)]}function iy(e){return e.replace(/start|end/g,t=>bB[t])}function PB(e,t,r){const n=["left","right"],o=["right","left"],i=["top","bottom"],a=["bottom","top"];switch(e){case"top":case"bottom":return r?t?o:n:t?n:o;case"left":case"right":return t?i:a;default:return[]}}function jB(e,t,r,n){const o=Ls(e);let i=PB($n(e),r==="start",n);return o&&(i=i.map(a=>a+"-"+o),t&&(i=i.concat(i.map(iy)))),i}function wf(e){return e.replace(/left|right|bottom|top/g,t=>wB[t])}function OB(e){return{top:0,right:0,bottom:0,left:0,...e}}function G0(e){return typeof e!="number"?OB(e):{top:e,right:e,bottom:e,left:e}}function _s(e){return{...e,top:e.y,left:e.x,right:e.x+e.width,bottom:e.y+e.height}}function P_(e,t,r){let{reference:n,floating:o}=e;const i=ga(t),a=q0(t),l=H0(a),c=$n(t),u=i==="y",d=n.x+n.width/2-o.width/2,p=n.y+n.height/2-o.height/2,h=n[l]/2-o[l]/2;let m;switch(c){case"top":m={x:d,y:n.y-o.height};break;case"bottom":m={x:d,y:n.y+n.height};break;case"right":m={x:n.x+n.width,y:p};break;case"left":m={x:n.x-o.width,y:p};break;default:m={x:n.x,y:n.y}}switch(Ls(t)){case"start":m[a]-=h*(r&&u?-1:1);break;case"end":m[a]+=h*(r&&u?-1:1);break}return m}const CB=async(e,t,r)=>{const{placement:n="bottom",strategy:o="absolute",middleware:i=[],platform:a}=r,l=i.filter(Boolean),c=await(a.isRTL==null?void 0:a.isRTL(t));let u=await a.getElementRects({reference:e,floating:t,strategy:o}),{x:d,y:p}=P_(u,n,c),h=n,m={},g=0;for(let v=0;v<l.length;v++){const{name:_,fn:y}=l[v],{x,y:w,data:b,reset:C}=await y({x:d,y:p,initialPlacement:n,placement:h,strategy:o,middlewareData:m,rects:u,platform:a,elements:{reference:e,floating:t}});if(d=x??d,p=w??p,m={...m,[_]:{...m[_],...b}},C&&g<=50){g++,typeof C=="object"&&(C.placement&&(h=C.placement),C.rects&&(u=C.rects===!0?await a.getElementRects({reference:e,floating:t,strategy:o}):C.rects),{x:d,y:p}=P_(u,h,c)),v=-1;continue}}return{x:d,y:p,placement:h,strategy:o,middlewareData:m}};async function Q0(e,t){var r;t===void 0&&(t={});const{x:n,y:o,platform:i,rects:a,elements:l,strategy:c}=e,{boundary:u="clippingAncestors",rootBoundary:d="viewport",elementContext:p="floating",altBoundary:h=!1,padding:m=0}=Eo(t,e),g=G0(m),_=l[h?p==="floating"?"reference":"floating":p],y=_s(await i.getClippingRect({element:(r=await(i.isElement==null?void 0:i.isElement(_)))==null||r?_:_.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(l.floating)),boundary:u,rootBoundary:d,strategy:c})),x=p==="floating"?{...a.floating,x:n,y:o}:a.reference,w=await(i.getOffsetParent==null?void 0:i.getOffsetParent(l.floating)),b=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},C=_s(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({rect:x,offsetParent:w,strategy:c}):x);return{top:(y.top-C.top+g.top)/b.y,bottom:(C.bottom-y.bottom+g.bottom)/b.y,left:(y.left-C.left+g.left)/b.x,right:(C.right-y.right+g.right)/b.x}}const j_=e=>({name:"arrow",options:e,async fn(t){const{x:r,y:n,placement:o,rects:i,platform:a,elements:l,middlewareData:c}=t,{element:u,padding:d=0}=Eo(e,t)||{};if(u==null)return{};const p=G0(d),h={x:r,y:n},m=q0(o),g=H0(m),v=await a.getDimensions(u),_=m==="y",y=_?"top":"left",x=_?"bottom":"right",w=_?"clientHeight":"clientWidth",b=i.reference[g]+i.reference[m]-h[m]-i.floating[g],C=h[m]-i.reference[m],O=await(a.getOffsetParent==null?void 0:a.getOffsetParent(u));let P=O?O[w]:0;(!P||!await(a.isElement==null?void 0:a.isElement(O)))&&(P=l.floating[w]||i.floating[g]);const E=b/2-C/2,$=P/2-v[g]/2-1,k=En(p[y],$),I=En(p[x],$),T=k,N=P-v[g]-I,A=P/2-v[g]/2+E,z=oy(T,A,N),G=!c.arrow&&Ls(o)!=null&&A!=z&&i.reference[g]/2-(A<T?k:I)-v[g]/2<0,X=G?A<T?A-T:A-N:0;return{[m]:h[m]+X,data:{[m]:z,centerOffset:A-z-X,...G&&{alignmentOffset:X}},reset:G}}}),SR=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var r,n;const{placement:o,middlewareData:i,rects:a,initialPlacement:l,platform:c,elements:u}=t,{mainAxis:d=!0,crossAxis:p=!0,fallbackPlacements:h,fallbackStrategy:m="bestFit",fallbackAxisSideDirection:g="none",flipAlignment:v=!0,..._}=Eo(e,t);if((r=i.arrow)!=null&&r.alignmentOffset)return{};const y=$n(o),x=$n(l)===l,w=await(c.isRTL==null?void 0:c.isRTL(u.floating)),b=h||(x||!v?[wf(l)]:SB(l));!h&&g!=="none"&&b.push(...jB(l,v,g,w));const C=[l,...b],O=await Q0(t,_),P=[];let E=((n=i.flip)==null?void 0:n.overflows)||[];if(d&&P.push(O[y]),p){const T=_B(o,a,w);P.push(O[T[0]],O[T[1]])}if(E=[...E,{placement:o,overflows:P}],!P.every(T=>T<=0)){var $,k;const T=((($=i.flip)==null?void 0:$.index)||0)+1,N=C[T];if(N)return{data:{index:T,overflows:E},reset:{placement:N}};let A=(k=E.filter(z=>z.overflows[0]<=0).sort((z,G)=>z.overflows[1]-G.overflows[1])[0])==null?void 0:k.placement;if(!A)switch(m){case"bestFit":{var I;const z=(I=E.map(G=>[G.placement,G.overflows.filter(X=>X>0).reduce((X,R)=>X+R,0)]).sort((G,X)=>G[1]-X[1])[0])==null?void 0:I[0];z&&(A=z);break}case"initialPlacement":A=l;break}if(o!==A)return{reset:{placement:A}}}return{}}}};function PR(e){const t=En(...e.map(i=>i.left)),r=En(...e.map(i=>i.top)),n=nr(...e.map(i=>i.right)),o=nr(...e.map(i=>i.bottom));return{x:t,y:r,width:n-t,height:o-r}}function EB(e){const t=e.slice().sort((o,i)=>o.y-i.y),r=[];let n=null;for(let o=0;o<t.length;o++){const i=t[o];!n||i.y-n.y>n.height/2?r.push([i]):r[r.length-1].push(i),n=i}return r.map(o=>_s(PR(o)))}const jR=function(e){return e===void 0&&(e={}),{name:"inline",options:e,async fn(t){const{placement:r,elements:n,rects:o,platform:i,strategy:a}=t,{padding:l=2,x:c,y:u}=Eo(e,t),d=Array.from(await(i.getClientRects==null?void 0:i.getClientRects(n.reference))||[]),p=EB(d),h=_s(PR(d)),m=G0(l);function g(){if(p.length===2&&p[0].left>p[1].right&&c!=null&&u!=null)return p.find(_=>c>_.left-m.left&&c<_.right+m.right&&u>_.top-m.top&&u<_.bottom+m.bottom)||h;if(p.length>=2){if(ga(r)==="y"){const k=p[0],I=p[p.length-1],T=$n(r)==="top",N=k.top,A=I.bottom,z=T?k.left:I.left,G=T?k.right:I.right,X=G-z,R=A-N;return{top:N,bottom:A,left:z,right:G,width:X,height:R,x:z,y:N}}const _=$n(r)==="left",y=nr(...p.map(k=>k.right)),x=En(...p.map(k=>k.left)),w=p.filter(k=>_?k.left===x:k.right===y),b=w[0].top,C=w[w.length-1].bottom,O=x,P=y,E=P-O,$=C-b;return{top:b,bottom:C,left:O,right:P,width:E,height:$,x:O,y:b}}return h}const v=await i.getElementRects({reference:{getBoundingClientRect:g},floating:n.floating,strategy:a});return o.reference.x!==v.reference.x||o.reference.y!==v.reference.y||o.reference.width!==v.reference.width||o.reference.height!==v.reference.height?{reset:{rects:v}}:{}}}};async function $B(e,t){const{placement:r,platform:n,elements:o}=e,i=await(n.isRTL==null?void 0:n.isRTL(o.floating)),a=$n(r),l=Ls(r),c=ga(r)==="y",u=["left","top"].includes(a)?-1:1,d=i&&c?-1:1,p=Eo(t,e);let{mainAxis:h,crossAxis:m,alignmentAxis:g}=typeof p=="number"?{mainAxis:p,crossAxis:0,alignmentAxis:null}:{mainAxis:0,crossAxis:0,alignmentAxis:null,...p};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 OR=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var r,n;const{x:o,y:i,placement:a,middlewareData:l}=t,c=await $B(t,e);return a===((r=l.offset)==null?void 0:r.placement)&&(n=l.arrow)!=null&&n.alignmentOffset?{}:{x:o+c.x,y:i+c.y,data:{...c,placement:a}}}}},K0=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:r,y:n,placement:o}=t,{mainAxis:i=!0,crossAxis:a=!1,limiter:l={fn:_=>{let{x:y,y:x}=_;return{x:y,y:x}}},...c}=Eo(e,t),u={x:r,y:n},d=await Q0(t,c),p=ga($n(o)),h=W0(p);let m=u[h],g=u[p];if(i){const _=h==="y"?"top":"left",y=h==="y"?"bottom":"right",x=m+d[_],w=m-d[y];m=oy(x,m,w)}if(a){const _=p==="y"?"top":"left",y=p==="y"?"bottom":"right",x=g+d[_],w=g-d[y];g=oy(x,g,w)}const v=l.fn({...t,[h]:m,[p]:g});return{...v,data:{x:v.x-r,y:v.y-n}}}}},kB=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:r,y:n,placement:o,rects:i,middlewareData:a}=t,{offset:l=0,mainAxis:c=!0,crossAxis:u=!0}=Eo(e,t),d={x:r,y:n},p=ga(o),h=W0(p);let m=d[h],g=d[p];const v=Eo(l,t),_=typeof v=="number"?{mainAxis:v,crossAxis:0}:{mainAxis:0,crossAxis:0,...v};if(c){const w=h==="y"?"height":"width",b=i.reference[h]-i.floating[w]+_.mainAxis,C=i.reference[h]+i.reference[w]-_.mainAxis;m<b?m=b:m>C&&(m=C)}if(u){var y,x;const w=h==="y"?"width":"height",b=["top","left"].includes($n(o)),C=i.reference[p]-i.floating[w]+(b&&((y=a.offset)==null?void 0:y[p])||0)+(b?0:_.crossAxis),O=i.reference[p]+i.reference[w]+(b?0:((x=a.offset)==null?void 0:x[p])||0)-(b?_.crossAxis:0);g<C?g=C:g>O&&(g=O)}return{[h]:m,[p]:g}}}},RB=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){const{placement:r,rects:n,platform:o,elements:i}=t,{apply:a=()=>{},...l}=Eo(e,t),c=await Q0(t,l),u=$n(r),d=Ls(r),p=ga(r)==="y",{width:h,height:m}=n.floating;let g,v;u==="top"||u==="bottom"?(g=u,v=d===(await(o.isRTL==null?void 0:o.isRTL(i.floating))?"start":"end")?"left":"right"):(v=u,g=d==="end"?"top":"bottom");const _=m-c[g],y=h-c[v],x=!t.middlewareData.shift;let w=_,b=y;if(p){const O=h-c.left-c.right;b=d||x?En(y,O):O}else{const O=m-c.top-c.bottom;w=d||x?En(_,O):O}if(x&&!d){const O=nr(c.left,0),P=nr(c.right,0),E=nr(c.top,0),$=nr(c.bottom,0);p?b=h-2*(O!==0||P!==0?O+P:nr(c.left,c.right)):w=m-2*(E!==0||$!==0?E+$:nr(c.top,c.bottom))}await a({...t,availableWidth:b,availableHeight:w});const C=await o.getDimensions(i.floating);return h!==C.width||m!==C.height?{reset:{rects:!0}}:{}}}};function _i(e){return CR(e)?(e.nodeName||"").toLowerCase():"#document"}function Qr(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Mo(e){var t;return(t=(CR(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function CR(e){return e instanceof Node||e instanceof Qr(e).Node}function $o(e){return e instanceof Element||e instanceof Qr(e).Element}function ro(e){return e instanceof HTMLElement||e instanceof Qr(e).HTMLElement}function O_(e){return typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Qr(e).ShadowRoot}function Tc(e){const{overflow:t,overflowX:r,overflowY:n,display:o}=mn(e);return/auto|scroll|overlay|hidden|clip/.test(t+n+r)&&!["inline","contents"].includes(o)}function TB(e){return["table","td","th"].includes(_i(e))}function Y0(e){const t=X0(),r=mn(e);return r.transform!=="none"||r.perspective!=="none"||(r.containerType?r.containerType!=="normal":!1)||!t&&(r.backdropFilter?r.backdropFilter!=="none":!1)||!t&&(r.filter?r.filter!=="none":!1)||["transform","perspective","filter"].some(n=>(r.willChange||"").includes(n))||["paint","layout","strict","content"].some(n=>(r.contain||"").includes(n))}function IB(e){let t=Ss(e);for(;ro(t)&&!im(t);){if(Y0(t))return t;t=Ss(t)}return null}function X0(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function im(e){return["html","body","#document"].includes(_i(e))}function mn(e){return Qr(e).getComputedStyle(e)}function am(e){return $o(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.pageXOffset,scrollTop:e.pageYOffset}}function Ss(e){if(_i(e)==="html")return e;const t=e.assignedSlot||e.parentNode||O_(e)&&e.host||Mo(e);return O_(t)?t.host:t}function ER(e){const t=Ss(e);return im(t)?e.ownerDocument?e.ownerDocument.body:e.body:ro(t)&&Tc(t)?t:ER(t)}function bo(e,t,r){var n;t===void 0&&(t=[]),r===void 0&&(r=!0);const o=ER(e),i=o===((n=e.ownerDocument)==null?void 0:n.body),a=Qr(o);return i?t.concat(a,a.visualViewport||[],Tc(o)?o:[],a.frameElement&&r?bo(a.frameElement):[]):t.concat(o,bo(o,[],r))}function $R(e){const t=mn(e);let r=parseFloat(t.width)||0,n=parseFloat(t.height)||0;const o=ro(e),i=o?e.offsetWidth:r,a=o?e.offsetHeight:n,l=xf(r)!==i||xf(n)!==a;return l&&(r=i,n=a),{width:r,height:n,$:l}}function J0(e){return $o(e)?e:e.contextElement}function cs(e){const t=J0(e);if(!ro(t))return bi(1);const r=t.getBoundingClientRect(),{width:n,height:o,$:i}=$R(t);let a=(i?xf(r.width):r.width)/n,l=(i?xf(r.height):r.height)/o;return(!a||!Number.isFinite(a))&&(a=1),(!l||!Number.isFinite(l))&&(l=1),{x:a,y:l}}const DB=bi(0);function kR(e){const t=Qr(e);return!X0()||!t.visualViewport?DB:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function NB(e,t,r){return t===void 0&&(t=!1),!r||t&&r!==Qr(e)?!1:t}function oa(e,t,r,n){t===void 0&&(t=!1),r===void 0&&(r=!1);const o=e.getBoundingClientRect(),i=J0(e);let a=bi(1);t&&(n?$o(n)&&(a=cs(n)):a=cs(e));const l=NB(i,r,n)?kR(i):bi(0);let c=(o.left+l.x)/a.x,u=(o.top+l.y)/a.y,d=o.width/a.x,p=o.height/a.y;if(i){const h=Qr(i),m=n&&$o(n)?Qr(n):n;let g=h.frameElement;for(;g&&n&&m!==h;){const v=cs(g),_=g.getBoundingClientRect(),y=mn(g),x=_.left+(g.clientLeft+parseFloat(y.paddingLeft))*v.x,w=_.top+(g.clientTop+parseFloat(y.paddingTop))*v.y;c*=v.x,u*=v.y,d*=v.x,p*=v.y,c+=x,u+=w,g=Qr(g).frameElement}}return _s({width:d,height:p,x:c,y:u})}function AB(e){let{rect:t,offsetParent:r,strategy:n}=e;const o=ro(r),i=Mo(r);if(r===i)return t;let a={scrollLeft:0,scrollTop:0},l=bi(1);const c=bi(0);if((o||!o&&n!=="fixed")&&((_i(r)!=="body"||Tc(i))&&(a=am(r)),ro(r))){const u=oa(r);l=cs(r),c.x=u.x+r.clientLeft,c.y=u.y+r.clientTop}return{width:t.width*l.x,height:t.height*l.y,x:t.x*l.x-a.scrollLeft*l.x+c.x,y:t.y*l.y-a.scrollTop*l.y+c.y}}function MB(e){return Array.from(e.getClientRects())}function RR(e){return oa(Mo(e)).left+am(e).scrollLeft}function LB(e){const t=Mo(e),r=am(e),n=e.ownerDocument.body,o=nr(t.scrollWidth,t.clientWidth,n.scrollWidth,n.clientWidth),i=nr(t.scrollHeight,t.clientHeight,n.scrollHeight,n.clientHeight);let a=-r.scrollLeft+RR(e);const l=-r.scrollTop;return mn(n).direction==="rtl"&&(a+=nr(t.clientWidth,n.clientWidth)-o),{width:o,height:i,x:a,y:l}}function zB(e,t){const r=Qr(e),n=Mo(e),o=r.visualViewport;let i=n.clientWidth,a=n.clientHeight,l=0,c=0;if(o){i=o.width,a=o.height;const u=X0();(!u||u&&t==="fixed")&&(l=o.offsetLeft,c=o.offsetTop)}return{width:i,height:a,x:l,y:c}}function FB(e,t){const r=oa(e,!0,t==="fixed"),n=r.top+e.clientTop,o=r.left+e.clientLeft,i=ro(e)?cs(e):bi(1),a=e.clientWidth*i.x,l=e.clientHeight*i.y,c=o*i.x,u=n*i.y;return{width:a,height:l,x:c,y:u}}function C_(e,t,r){let n;if(t==="viewport")n=zB(e,r);else if(t==="document")n=LB(Mo(e));else if($o(t))n=FB(t,r);else{const o=kR(e);n={...t,x:t.x-o.x,y:t.y-o.y}}return _s(n)}function TR(e,t){const r=Ss(e);return r===t||!$o(r)||im(r)?!1:mn(r).position==="fixed"||TR(r,t)}function VB(e,t){const r=t.get(e);if(r)return r;let n=bo(e,[],!1).filter(l=>$o(l)&&_i(l)!=="body"),o=null;const i=mn(e).position==="fixed";let a=i?Ss(e):e;for(;$o(a)&&!im(a);){const l=mn(a),c=Y0(a);!c&&l.position==="fixed"&&(o=null),(i?!c&&!o:!c&&l.position==="static"&&!!o&&["absolute","fixed"].includes(o.position)||Tc(a)&&!c&&TR(e,a))?n=n.filter(d=>d!==a):o=l,a=Ss(a)}return t.set(e,n),n}function BB(e){let{element:t,boundary:r,rootBoundary:n,strategy:o}=e;const a=[...r==="clippingAncestors"?VB(t,this._c):[].concat(r),n],l=a[0],c=a.reduce((u,d)=>{const p=C_(t,d,o);return u.top=nr(p.top,u.top),u.right=En(p.right,u.right),u.bottom=En(p.bottom,u.bottom),u.left=nr(p.left,u.left),u},C_(t,l,o));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function UB(e){return $R(e)}function WB(e,t,r){const n=ro(t),o=Mo(t),i=r==="fixed",a=oa(e,!0,i,t);let l={scrollLeft:0,scrollTop:0};const c=bi(0);if(n||!n&&!i)if((_i(t)!=="body"||Tc(o))&&(l=am(t)),n){const u=oa(t,!0,i,t);c.x=u.x+t.clientLeft,c.y=u.y+t.clientTop}else o&&(c.x=RR(o));return{x:a.left+l.scrollLeft-c.x,y:a.top+l.scrollTop-c.y,width:a.width,height:a.height}}function E_(e,t){return!ro(e)||mn(e).position==="fixed"?null:t?t(e):e.offsetParent}function IR(e,t){const r=Qr(e);if(!ro(e))return r;let n=E_(e,t);for(;n&&TB(n)&&mn(n).position==="static";)n=E_(n,t);return n&&(_i(n)==="html"||_i(n)==="body"&&mn(n).position==="static"&&!Y0(n))?r:n||IB(e)||r}const HB=async function(e){let{reference:t,floating:r,strategy:n}=e;const o=this.getOffsetParent||IR,i=this.getDimensions;return{reference:WB(t,await o(r),n),floating:{x:0,y:0,...await i(r)}}};function qB(e){return mn(e).direction==="rtl"}const GB={convertOffsetParentRelativeRectToViewportRelativeRect:AB,getDocumentElement:Mo,getClippingRect:BB,getOffsetParent:IR,getElementRects:HB,getClientRects:MB,getDimensions:UB,getScale:cs,isElement:$o,isRTL:qB};function QB(e,t){let r=null,n;const o=Mo(e);function i(){clearTimeout(n),r&&r.disconnect(),r=null}function a(l,c){l===void 0&&(l=!1),c===void 0&&(c=1),i();const{left:u,top:d,width:p,height:h}=e.getBoundingClientRect();if(l||t(),!p||!h)return;const m=Cu(d),g=Cu(o.clientWidth-(u+p)),v=Cu(o.clientHeight-(d+h)),_=Cu(u),x={rootMargin:-m+"px "+-g+"px "+-v+"px "+-_+"px",threshold:nr(0,En(1,c))||1};let w=!0;function b(C){const O=C[0].intersectionRatio;if(O!==c){if(!w)return a();O?a(!1,O):n=setTimeout(()=>{a(!1,1e-7)},100)}w=!1}try{r=new IntersectionObserver(b,{...x,root:o.ownerDocument})}catch{r=new IntersectionObserver(b,x)}r.observe(e)}return a(!0),i}function KB(e,t,r,n){n===void 0&&(n={});const{ancestorScroll:o=!0,ancestorResize:i=!0,elementResize:a=typeof ResizeObserver=="function",layoutShift:l=typeof IntersectionObserver=="function",animationFrame:c=!1}=n,u=J0(e),d=o||i?[...u?bo(u):[],...bo(t)]:[];d.forEach(y=>{o&&y.addEventListener("scroll",r,{passive:!0}),i&&y.addEventListener("resize",r)});const p=u&&l?QB(u,r):null;let h=-1,m=null;a&&(m=new ResizeObserver(y=>{let[x]=y;x&&x.target===u&&m&&(m.unobserve(t),cancelAnimationFrame(h),h=requestAnimationFrame(()=>{m&&m.observe(t)})),r()}),u&&!c&&m.observe(u),m.observe(t));let g,v=c?oa(e):null;c&&_();function _(){const y=oa(e);v&&(y.x!==v.x||y.y!==v.y||y.width!==v.width||y.height!==v.height)&&r(),v=y,g=requestAnimationFrame(_)}return r(),()=>{d.forEach(y=>{o&&y.removeEventListener("scroll",r),i&&y.removeEventListener("resize",r)}),p&&p(),m&&m.disconnect(),m=null,c&&cancelAnimationFrame(g)}}const YB=(e,t,r)=>{const n=new Map,o={platform:GB,...r},i={...o.platform,_c:n};return CB(e,t,{...o,platform:i})},DR=e=>{const{element:t,padding:r}=e;function n(o){return Object.prototype.hasOwnProperty.call(o,"current")}return{name:"arrow",options:e,fn(o){return n(t)?t.current!=null?j_({element:t.current,padding:r}).fn(o):{}:t?j_({element:t,padding:r}).fn(o):{}}}};var md=typeof document<"u"?f.useLayoutEffect:f.useEffect;function bf(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 r,n,o;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(r=e.length,r!=t.length)return!1;for(n=r;n--!==0;)if(!bf(e[n],t[n]))return!1;return!0}if(o=Object.keys(e),r=o.length,r!==Object.keys(t).length)return!1;for(n=r;n--!==0;)if(!Object.prototype.hasOwnProperty.call(t,o[n]))return!1;for(n=r;n--!==0;){const i=o[n];if(!(i==="_owner"&&e.$$typeof)&&!bf(e[i],t[i]))return!1}return!0}return e!==e&&t!==t}function $_(e){const t=f.useRef(e);return md(()=>{t.current=e}),t}function XB(e){e===void 0&&(e={});const{placement:t="bottom",strategy:r="absolute",middleware:n=[],platform:o,whileElementsMounted:i,open:a}=e,[l,c]=f.useState({x:null,y:null,strategy:r,placement:t,middlewareData:{},isPositioned:!1}),[u,d]=f.useState(n);bf(u,n)||d(n);const p=f.useRef(null),h=f.useRef(null),m=f.useRef(l),g=$_(i),v=$_(o),[_,y]=f.useState(null),[x,w]=f.useState(null),b=f.useCallback(k=>{p.current!==k&&(p.current=k,y(k))},[]),C=f.useCallback(k=>{h.current!==k&&(h.current=k,w(k))},[]),O=f.useCallback(()=>{if(!p.current||!h.current)return;const k={placement:t,strategy:r,middleware:u};v.current&&(k.platform=v.current),YB(p.current,h.current,k).then(I=>{const T={...I,isPositioned:!0};P.current&&!bf(m.current,T)&&(m.current=T,As.flushSync(()=>{c(T)}))})},[u,t,r,v]);md(()=>{a===!1&&m.current.isPositioned&&(m.current.isPositioned=!1,c(k=>({...k,isPositioned:!1})))},[a]);const P=f.useRef(!1);md(()=>(P.current=!0,()=>{P.current=!1}),[]),md(()=>{if(_&&x){if(g.current)return g.current(_,x,O);O()}},[_,x,O,g]);const E=f.useMemo(()=>({reference:p,floating:h,setReference:b,setFloating:C}),[b,C]),$=f.useMemo(()=>({reference:_,floating:x}),[_,x]);return f.useMemo(()=>({...l,update:O,refs:E,elements:$,reference:b,floating:C}),[l,O,E,$,b,C])}var Ps=typeof document<"u"?f.useLayoutEffect:f.useEffect;let xg=!1,JB=0;const k_=()=>"floating-ui-"+JB++;function ZB(){const[e,t]=f.useState(()=>xg?k_():void 0);return Ps(()=>{e==null&&t(k_())},[]),f.useEffect(()=>{xg||(xg=!0)},[]),e}const eU=Bl.useId,R_=eU||ZB;function tU(){const e=new Map;return{emit(t,r){var n;(n=e.get(t))==null||n.forEach(o=>o(r))},on(t,r){e.set(t,[...e.get(t)||[],r])},off(t,r){e.set(t,(e.get(t)||[]).filter(n=>n!==r))}}}const rU=f.createContext(null),nU=f.createContext(null),NR=()=>{var e;return((e=f.useContext(rU))==null?void 0:e.id)||null},Z0=()=>f.useContext(nU);function si(e){return(e==null?void 0:e.ownerDocument)||document}function oU(){const e=navigator.userAgentData;return e!=null&&e.platform?e.platform:navigator.platform}function iU(){const e=navigator.userAgentData;return e&&Array.isArray(e.brands)?e.brands.map(t=>{let{brand:r,version:n}=t;return r+"/"+n}).join(" "):navigator.userAgent}function ex(e){return si(e).defaultView||window}function Kn(e){return e?e instanceof ex(e).Element:!1}function AR(e){return e?e instanceof ex(e).HTMLElement:!1}function aU(e){if(typeof ShadowRoot>"u")return!1;const t=ex(e).ShadowRoot;return e instanceof t||e instanceof ShadowRoot}function sU(e){if(e.mozInputSource===0&&e.isTrusted)return!0;const t=/Android/i;return(t.test(oU())||t.test(iU()))&&e.pointerType?e.type==="click"&&e.buttons===1:e.detail===0&&!e.pointerType}function lU(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 MR(e,t){const r=["mouse","pen"];return t||r.push("",void 0),r.includes(e)}function T_(e){const t=f.useRef(e);return Ps(()=>{t.current=e}),t}const I_="data-floating-ui-safe-polygon";function gd(e,t,r){return r&&!MR(r)?0:typeof e=="number"?e:e==null?void 0:e[t]}const cU=function(e,t){let{enabled:r=!0,delay:n=0,handleClose:o=null,mouseOnly:i=!1,restMs:a=0,move:l=!0}=t===void 0?{}:t;const{open:c,onOpenChange:u,dataRef:d,events:p,elements:{domReference:h,floating:m},refs:g}=e,v=Z0(),_=NR(),y=T_(o),x=T_(n),w=f.useRef(),b=f.useRef(),C=f.useRef(),O=f.useRef(),P=f.useRef(!0),E=f.useRef(!1),$=f.useRef(()=>{}),k=f.useCallback(()=>{var A;const z=(A=d.current.openEvent)==null?void 0:A.type;return(z==null?void 0:z.includes("mouse"))&&z!=="mousedown"},[d]);f.useEffect(()=>{if(!r)return;function A(){clearTimeout(b.current),clearTimeout(O.current),P.current=!0}return p.on("dismiss",A),()=>{p.off("dismiss",A)}},[r,p]),f.useEffect(()=>{if(!r||!y.current||!c)return;function A(){k()&&u(!1)}const z=si(m).documentElement;return z.addEventListener("mouseleave",A),()=>{z.removeEventListener("mouseleave",A)}},[m,c,u,r,y,d,k]);const I=f.useCallback(function(A){A===void 0&&(A=!0);const z=gd(x.current,"close",w.current);z&&!C.current?(clearTimeout(b.current),b.current=setTimeout(()=>u(!1),z)):A&&(clearTimeout(b.current),u(!1))},[x,u]),T=f.useCallback(()=>{$.current(),C.current=void 0},[]),N=f.useCallback(()=>{if(E.current){const A=si(g.floating.current).body;A.style.pointerEvents="",A.removeAttribute(I_),E.current=!1}},[g]);return f.useEffect(()=>{if(!r)return;function A(){return d.current.openEvent?["click","mousedown"].includes(d.current.openEvent.type):!1}function z(R){if(clearTimeout(b.current),P.current=!1,i&&!MR(w.current)||a>0&&gd(x.current,"open")===0)return;d.current.openEvent=R;const M=gd(x.current,"open",w.current);M?b.current=setTimeout(()=>{u(!0)},M):u(!0)}function G(R){if(A())return;$.current();const M=si(m);if(clearTimeout(O.current),y.current){c||clearTimeout(b.current),C.current=y.current({...e,tree:v,x:R.clientX,y:R.clientY,onClose(){N(),T(),I()}});const V=C.current;M.addEventListener("mousemove",V),$.current=()=>{M.removeEventListener("mousemove",V)};return}I()}function X(R){A()||y.current==null||y.current({...e,tree:v,x:R.clientX,y:R.clientY,onClose(){N(),T(),I()}})(R)}if(Kn(h)){const R=h;return c&&R.addEventListener("mouseleave",X),m==null||m.addEventListener("mouseleave",X),l&&R.addEventListener("mousemove",z,{once:!0}),R.addEventListener("mouseenter",z),R.addEventListener("mouseleave",G),()=>{c&&R.removeEventListener("mouseleave",X),m==null||m.removeEventListener("mouseleave",X),l&&R.removeEventListener("mousemove",z),R.removeEventListener("mouseenter",z),R.removeEventListener("mouseleave",G)}}},[h,m,r,e,i,a,l,I,T,N,u,c,v,x,y,d]),Ps(()=>{var A;if(r&&c&&(A=y.current)!=null&&A.__options.blockPointerEvents&&k()){const X=si(m).body;if(X.setAttribute(I_,""),X.style.pointerEvents="none",E.current=!0,Kn(h)&&m){var z,G;const R=h,M=v==null||(z=v.nodesRef.current.find(V=>V.id===_))==null||(G=z.context)==null?void 0:G.elements.floating;return M&&(M.style.pointerEvents=""),R.style.pointerEvents="auto",m.style.pointerEvents="auto",()=>{R.style.pointerEvents="",m.style.pointerEvents=""}}}},[r,c,_,m,h,v,y,d,k]),Ps(()=>{c||(w.current=void 0,T(),N())},[c,T,N]),f.useEffect(()=>()=>{T(),clearTimeout(b.current),clearTimeout(O.current),N()},[r,T,N]),f.useMemo(()=>{if(!r)return{};function A(z){w.current=z.pointerType}return{reference:{onPointerDown:A,onPointerEnter:A,onMouseMove(){c||a===0||(clearTimeout(O.current),O.current=setTimeout(()=>{P.current||u(!0)},a))}},floating:{onMouseEnter(){clearTimeout(b.current)},onMouseLeave(){p.emit("dismiss",{type:"mouseLeave",data:{returnFocus:!1}}),I(!1)}}}},[p,r,a,c,u,I])},LR=f.createContext({delay:0,initialDelay:0,timeoutMs:0,currentId:null,setCurrentId:()=>{},setState:()=>{},isInstantPhase:!1}),zR=()=>f.useContext(LR),uU=e=>{let{children:t,delay:r,timeoutMs:n=0}=e;const[o,i]=f.useReducer((c,u)=>({...c,...u}),{delay:r,timeoutMs:n,initialDelay:r,currentId:null,isInstantPhase:!1}),a=f.useRef(null),l=f.useCallback(c=>{i({currentId:c})},[]);return Ps(()=>{o.currentId?a.current===null?a.current=o.currentId:i({isInstantPhase:!0}):(i({isInstantPhase:!1}),a.current=null)},[o.currentId]),f.createElement(LR.Provider,{value:f.useMemo(()=>({...o,setState:i,setCurrentId:l}),[o,i,l])},t)},dU=(e,t)=>{let{open:r,onOpenChange:n}=e,{id:o}=t;const{currentId:i,setCurrentId:a,initialDelay:l,setState:c,timeoutMs:u}=zR();f.useEffect(()=>{i&&(c({delay:{open:1,close:gd(l,"close")}}),i!==o&&n(!1))},[o,n,c,i,l]),f.useEffect(()=>{function d(){n(!1),c({delay:l,currentId:null})}if(!r&&i===o)if(u){const p=window.setTimeout(d,u);return()=>{clearTimeout(p)}}else d()},[r,c,i,o,n,l,u]),f.useEffect(()=>{r&&a(o)},[r,a,o])};function fU(e){let t=e.activeElement;for(;((r=t)==null||(n=r.shadowRoot)==null?void 0:n.activeElement)!=null;){var r,n;t=t.shadowRoot.activeElement}return t}function D_(e,t){if(!e||!t)return!1;const r=t.getRootNode&&t.getRootNode();if(e.contains(t))return!0;if(r&&aU(r)){let n=t;do{if(n&&e===n)return!0;n=n.parentNode||n.host}while(n)}return!1}function wg(e,t){let r=e.filter(o=>{var i;return o.parentId===t&&((i=o.context)==null?void 0:i.open)})||[],n=r;for(;n.length;)n=e.filter(o=>{var i;return(i=n)==null?void 0:i.some(a=>{var l;return o.parentId===a.id&&((l=o.context)==null?void 0:l.open)})})||[],r=r.concat(n);return r}function pU(e){return"composedPath"in e?e.composedPath()[0]:e.target}const hU=Bl.useInsertionEffect,mU=hU||(e=>e());function FR(e){const t=f.useRef(()=>{});return mU(()=>{t.current=e}),f.useCallback(function(){for(var r=arguments.length,n=new Array(r),o=0;o<r;o++)n[o]=arguments[o];return t.current==null?void 0:t.current(...n)},[])}function vd(e,t){if(t==null)return!1;if("composedPath"in e)return e.composedPath().includes(t);const r=e;return r.target!=null&&t.contains(r.target)}const gU={pointerdown:"onPointerDown",mousedown:"onMouseDown",click:"onClick"},vU={pointerdown:"onPointerDownCapture",mousedown:"onMouseDownCapture",click:"onClickCapture"},yU=function(e){var t,r;return e===void 0&&(e=!0),{escapeKeyBubbles:typeof e=="boolean"?e:(t=e.escapeKey)!=null?t:!0,outsidePressBubbles:typeof e=="boolean"?e:(r=e.outsidePress)!=null?r:!0}},xU=function(e,t){let{open:r,onOpenChange:n,events:o,nodeId:i,elements:{reference:a,domReference:l,floating:c},dataRef:u}=e,{enabled:d=!0,escapeKey:p=!0,outsidePress:h=!0,outsidePressEvent:m="pointerdown",referencePress:g=!1,referencePressEvent:v="pointerdown",ancestorScroll:_=!1,bubbles:y=!0}=t===void 0?{}:t;const x=Z0(),w=NR()!=null,b=FR(typeof h=="function"?h:()=>!1),C=typeof h=="function"?b:h,O=f.useRef(!1),{escapeKeyBubbles:P,outsidePressBubbles:E}=yU(y);return f.useEffect(()=>{if(!r||!d)return;u.current.__escapeKeyBubbles=P,u.current.__outsidePressBubbles=E;function $(A){if(A.key==="Escape"){const z=x?wg(x.nodesRef.current,i):[];if(z.length>0){let G=!0;if(z.forEach(X=>{var R;if((R=X.context)!=null&&R.open&&!X.context.dataRef.current.__escapeKeyBubbles){G=!1;return}}),!G)return}o.emit("dismiss",{type:"escapeKey",data:{returnFocus:{preventScroll:!1}}}),n(!1)}}function k(A){const z=O.current;if(O.current=!1,z||typeof C=="function"&&!C(A))return;const G=pU(A);if(AR(G)&&c){const M=c.ownerDocument.defaultView||window,V=G.scrollWidth>G.clientWidth,Q=G.scrollHeight>G.clientHeight;let Z=Q&&A.offsetX>G.clientWidth;if(Q&&M.getComputedStyle(G).direction==="rtl"&&(Z=A.offsetX<=G.offsetWidth-G.clientWidth),Z||V&&A.offsetY>G.clientHeight)return}const X=x&&wg(x.nodesRef.current,i).some(M=>{var V;return vd(A,(V=M.context)==null?void 0:V.elements.floating)});if(vd(A,c)||vd(A,l)||X)return;const R=x?wg(x.nodesRef.current,i):[];if(R.length>0){let M=!0;if(R.forEach(V=>{var Q;if((Q=V.context)!=null&&Q.open&&!V.context.dataRef.current.__outsidePressBubbles){M=!1;return}}),!M)return}o.emit("dismiss",{type:"outsidePress",data:{returnFocus:w?{preventScroll:!0}:sU(A)||lU(A)}}),n(!1)}function I(){n(!1)}const T=si(c);p&&T.addEventListener("keydown",$),C&&T.addEventListener(m,k);let N=[];return _&&(Kn(l)&&(N=bo(l)),Kn(c)&&(N=N.concat(bo(c))),!Kn(a)&&a&&a.contextElement&&(N=N.concat(bo(a.contextElement)))),N=N.filter(A=>{var z;return A!==((z=T.defaultView)==null?void 0:z.visualViewport)}),N.forEach(A=>{A.addEventListener("scroll",I,{passive:!0})}),()=>{p&&T.removeEventListener("keydown",$),C&&T.removeEventListener(m,k),N.forEach(A=>{A.removeEventListener("scroll",I)})}},[u,c,l,a,p,C,m,o,x,i,r,n,_,d,P,E,w]),f.useEffect(()=>{O.current=!1},[C,m]),f.useMemo(()=>d?{reference:{[gU[v]]:()=>{g&&(o.emit("dismiss",{type:"referencePress",data:{returnFocus:!1}}),n(!1))}},floating:{[vU[m]]:()=>{O.current=!0}}}:{},[d,o,g,m,v,n])},wU=function(e,t){let{open:r,onOpenChange:n,dataRef:o,events:i,refs:a,elements:{floating:l,domReference:c}}=e,{enabled:u=!0,keyboardOnly:d=!0}=t===void 0?{}:t;const p=f.useRef(""),h=f.useRef(!1),m=f.useRef();return f.useEffect(()=>{if(!u)return;const v=si(l).defaultView||window;function _(){!r&&AR(c)&&c===fU(si(c))&&(h.current=!0)}return v.addEventListener("blur",_),()=>{v.removeEventListener("blur",_)}},[l,c,r,u]),f.useEffect(()=>{if(!u)return;function g(v){(v.type==="referencePress"||v.type==="escapeKey")&&(h.current=!0)}return i.on("dismiss",g),()=>{i.off("dismiss",g)}},[i,u]),f.useEffect(()=>()=>{clearTimeout(m.current)},[]),f.useMemo(()=>u?{reference:{onPointerDown(g){let{pointerType:v}=g;p.current=v,h.current=!!(v&&d)},onMouseLeave(){h.current=!1},onFocus(g){var v;h.current||g.type==="focus"&&((v=o.current.openEvent)==null?void 0:v.type)==="mousedown"&&o.current.openEvent&&vd(o.current.openEvent,c)||(o.current.openEvent=g.nativeEvent,n(!0))},onBlur(g){h.current=!1;const v=g.relatedTarget,_=Kn(v)&&v.hasAttribute("data-floating-ui-focus-guard")&&v.getAttribute("data-type")==="outside";m.current=setTimeout(()=>{D_(a.floating.current,v)||D_(c,v)||_||n(!1)})}}}:{},[u,d,c,a,o,n])},bU=function(e,t){let{open:r}=e,{enabled:n=!0,role:o="dialog"}=t===void 0?{}:t;const i=R_(),a=R_();return f.useMemo(()=>{const l={id:i,role:o};return n?o==="tooltip"?{reference:{"aria-describedby":r?i:void 0},floating:l}:{reference:{"aria-expanded":r?"true":"false","aria-haspopup":o==="alertdialog"?"dialog":o,"aria-controls":r?i:void 0,...o==="listbox"&&{role:"combobox"},...o==="menu"&&{id:a}},floating:{...l,...o==="menu"&&{"aria-labelledby":a}}}:{}},[n,o,r,i,a])};function tx(e){e===void 0&&(e={});const{open:t=!1,onOpenChange:r,nodeId:n}=e,o=XB(e),i=Z0(),a=f.useRef(null),l=f.useRef({}),c=f.useState(()=>tU())[0],[u,d]=f.useState(null),p=f.useCallback(y=>{const x=Kn(y)?{getBoundingClientRect:()=>y.getBoundingClientRect(),contextElement:y}:y;o.refs.setReference(x)},[o.refs]),h=f.useCallback(y=>{(Kn(y)||y===null)&&(a.current=y,d(y)),(Kn(o.refs.reference.current)||o.refs.reference.current===null||y!==null&&!Kn(y))&&o.refs.setReference(y)},[o.refs]),m=f.useMemo(()=>({...o.refs,setReference:h,setPositionReference:p,domReference:a}),[o.refs,h,p]),g=f.useMemo(()=>({...o.elements,domReference:u}),[o.elements,u]),v=FR(r),_=f.useMemo(()=>({...o,refs:m,elements:g,dataRef:l,nodeId:n,events:c,open:t,onOpenChange:v}),[o,n,c,t,v,m,g]);return Ps(()=>{const y=i==null?void 0:i.nodesRef.current.find(x=>x.id===n);y&&(y.context=_)}),f.useMemo(()=>({...o,context:_,refs:m,reference:h,positionReference:p}),[o,m,_,h,p])}function bg(e,t,r){const n=new Map;return{...r==="floating"&&{tabIndex:-1},...e,...t.map(o=>o?o[r]:null).concat(e).reduce((o,i)=>(i&&Object.entries(i).forEach(a=>{let[l,c]=a;if(l.indexOf("on")===0){if(n.has(l)||n.set(l,[]),typeof c=="function"){var u;(u=n.get(l))==null||u.push(c),o[l]=function(){for(var d,p=arguments.length,h=new Array(p),m=0;m<p;m++)h[m]=arguments[m];(d=n.get(l))==null||d.forEach(g=>g(...h))}}}else o[l]=c}),o),{})}}const _U=function(e){e===void 0&&(e=[]);const t=e,r=f.useCallback(i=>bg(i,e,"reference"),t),n=f.useCallback(i=>bg(i,e,"floating"),t),o=f.useCallback(i=>bg(i,e,"item"),e.map(i=>i==null?void 0:i.item));return f.useMemo(()=>({getReferenceProps:r,getFloatingProps:n,getItemProps:o}),[r,n,o])};function VR({opened:e,floating:t,position:r,positionDependencies:n}){const[o,i]=f.useState(0);f.useEffect(()=>{if(t.refs.reference.current&&t.refs.floating.current)return KB(t.refs.reference.current,t.refs.floating.current,t.update)},[t.refs.reference.current,t.refs.floating.current,e,o,r]),ln(()=>{t.update()},n),ln(()=>{i(a=>a+1)},[e])}function SU(e){const t=[OR(e.offset)];return e.middlewares.shift&&t.push(K0({limiter:kB()})),e.middlewares.flip&&t.push(SR()),e.middlewares.inline&&t.push(jR()),t.push(DR({element:e.arrowRef,padding:e.arrowOffset})),t}function PU(e){const[t,r]=Tr({value:e.opened,defaultValue:e.defaultOpened,finalValue:!1,onChange:e.onChange}),n=()=>{var a;(a=e.onClose)==null||a.call(e),r(!1)},o=()=>{var a,l;t?((a=e.onClose)==null||a.call(e),r(!1)):((l=e.onOpen)==null||l.call(e),r(!0))},i=tx({placement:e.position,middleware:[...SU(e),...e.width==="target"?[RB({apply({rects:a}){var l,c;Object.assign((c=(l=i.refs.floating.current)==null?void 0:l.style)!=null?c:{},{width:`${a.reference.width}px`})}})]:[]]});return VR({opened:e.opened,position:e.position,positionDependencies:e.positionDependencies,floating:i}),ln(()=>{var a;(a=e.onPositionChange)==null||a.call(e,i.placement)},[i.placement]),ln(()=>{var a,l;e.opened?(l=e.onOpen)==null||l.call(e):(a=e.onClose)==null||a.call(e)},[e.opened]),{floating:i,controlled:typeof e.opened=="boolean",opened:t,onClose:n,onToggle:o}}const BR={context:"Popover component was not found in the tree",children:"Popover.Target component children should be an element or a component that accepts ref. Fragments, strings, numbers and other primitive values are not supported"},[jU,UR]=Do(BR.context);var OU=Object.defineProperty,CU=Object.defineProperties,EU=Object.getOwnPropertyDescriptors,_f=Object.getOwnPropertySymbols,WR=Object.prototype.hasOwnProperty,HR=Object.prototype.propertyIsEnumerable,N_=(e,t,r)=>t in e?OU(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Eu=(e,t)=>{for(var r in t||(t={}))WR.call(t,r)&&N_(e,r,t[r]);if(_f)for(var r of _f(t))HR.call(t,r)&&N_(e,r,t[r]);return e},$U=(e,t)=>CU(e,EU(t)),kU=(e,t)=>{var r={};for(var n in e)WR.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&_f)for(var n of _f(e))t.indexOf(n)<0&&HR.call(e,n)&&(r[n]=e[n]);return r};const RU={refProp:"ref",popupType:"dialog",shouldOverrideDefaultTargetId:!0},qR=f.forwardRef((e,t)=>{const r=H("PopoverTarget",RU,e),{children:n,refProp:o,popupType:i,shouldOverrideDefaultTargetId:a}=r,l=kU(r,["children","refProp","popupType","shouldOverrideDefaultTargetId"]);if(!Rs(n))throw new Error(BR.children);const c=l,u=UR(),d=Is(u.reference,n.ref,t),p=u.withRoles?{"aria-haspopup":i,"aria-expanded":u.opened,"aria-controls":u.getDropdownId(),id:a?u.getTargetId():n.props.id}:{};return f.cloneElement(n,Eu($U(Eu(Eu(Eu({},c),p),u.targetProps),{className:wE(u.targetProps.className,c.className,n.props.className),[o]:d}),u.controlled?null:{onClick:u.onToggle}))});qR.displayName="@mantine/core/PopoverTarget";var TU=W((e,{radius:t,shadow:r})=>({dropdown:{position:"absolute",backgroundColor:e.white,background:e.colorScheme==="dark"?e.colors.dark[6]:e.white,border:`${j(1)} solid ${e.colorScheme==="dark"?e.colors.dark[4]:e.colors.gray[2]}`,padding:`${e.spacing.sm} ${e.spacing.md}`,boxShadow:e.shadows[r]||r||"none",borderRadius:e.fn.radius(t),"&:focus":{outline:0}},arrow:{backgroundColor:"inherit",border:`${j(1)} solid ${e.colorScheme==="dark"?e.colors.dark[4]:e.colors.gray[2]}`,zIndex:1}}));const IU=TU;var DU=Object.defineProperty,A_=Object.getOwnPropertySymbols,NU=Object.prototype.hasOwnProperty,AU=Object.prototype.propertyIsEnumerable,M_=(e,t,r)=>t in e?DU(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Ra=(e,t)=>{for(var r in t||(t={}))NU.call(t,r)&&M_(e,r,t[r]);if(A_)for(var r of A_(t))AU.call(t,r)&&M_(e,r,t[r]);return e};const L_={entering:"in",entered:"in",exiting:"out",exited:"out","pre-exiting":"out","pre-entering":"out"};function MU({transition:e,state:t,duration:r,timingFunction:n}){const o={transitionDuration:`${r}ms`,transitionTimingFunction:n};return typeof e=="string"?e in nu?Ra(Ra(Ra({transitionProperty:nu[e].transitionProperty},o),nu[e].common),nu[e][L_[t]]):null:Ra(Ra(Ra({transitionProperty:e.transitionProperty},o),e.common),e[L_[t]])}function LU({duration:e,exitDuration:t,timingFunction:r,mounted:n,onEnter:o,onExit:i,onEntered:a,onExited:l}){const c=Jt(),u=zh(),d=c.respectReducedMotion?u:!1,[p,h]=f.useState(d?0:e),[m,g]=f.useState(n?"entered":"exited"),v=f.useRef(-1),_=y=>{const x=y?o:i,w=y?a:l;g(y?"pre-entering":"pre-exiting"),window.clearTimeout(v.current);const b=d?0:y?e:t;if(h(b),b===0)typeof x=="function"&&x(),typeof w=="function"&&w(),g(y?"entered":"exited");else{const C=window.setTimeout(()=>{typeof x=="function"&&x(),g(y?"entering":"exiting")},10);v.current=window.setTimeout(()=>{window.clearTimeout(C),typeof w=="function"&&w(),g(y?"entered":"exited")},b)}};return ln(()=>{_(n)},[n]),f.useEffect(()=>()=>window.clearTimeout(v.current),[]),{transitionDuration:p,transitionStatus:m,transitionTimingFunction:r||c.transitionTimingFunction}}function va({keepMounted:e,transition:t,duration:r=250,exitDuration:n=r,mounted:o,children:i,timingFunction:a,onExit:l,onEntered:c,onEnter:u,onExited:d}){const{transitionDuration:p,transitionStatus:h,transitionTimingFunction:m}=LU({mounted:o,exitDuration:n,duration:r,timingFunction:a,onExit:l,onEntered:c,onEnter:u,onExited:d});return p===0?o?S.createElement(S.Fragment,null,i({})):e?i({display:"none"}):null:h==="exited"?e?i({display:"none"}):null:S.createElement(S.Fragment,null,i(MU({transition:t,duration:p,state:h,timingFunction:m})))}va.displayName="@mantine/core/Transition";function rx({children:e,active:t=!0,refProp:r="ref"}){const n=X6(t),o=Is(n,e==null?void 0:e.ref);return Rs(e)?f.cloneElement(e,{[r]:o}):e}rx.displayName="@mantine/core/FocusTrap";var zU=Object.defineProperty,FU=Object.defineProperties,VU=Object.getOwnPropertyDescriptors,z_=Object.getOwnPropertySymbols,BU=Object.prototype.hasOwnProperty,UU=Object.prototype.propertyIsEnumerable,F_=(e,t,r)=>t in e?zU(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Yo=(e,t)=>{for(var r in t||(t={}))BU.call(t,r)&&F_(e,r,t[r]);if(z_)for(var r of z_(t))UU.call(t,r)&&F_(e,r,t[r]);return e},$u=(e,t)=>FU(e,VU(t));function V_(e,t,r,n){return e==="center"||n==="center"?{top:t}:e==="end"?{bottom:r}:e==="start"?{top:r}:{}}function B_(e,t,r,n,o){return e==="center"||n==="center"?{left:t}:e==="end"?{[o==="ltr"?"right":"left"]:r}:e==="start"?{[o==="ltr"?"left":"right"]:r}:{}}const WU={bottom:"borderTopLeftRadius",left:"borderTopRightRadius",right:"borderBottomLeftRadius",top:"borderBottomRightRadius"};function HU({position:e,arrowSize:t,arrowOffset:r,arrowRadius:n,arrowPosition:o,arrowX:i,arrowY:a,dir:l}){const[c,u="center"]=e.split("-"),d={width:j(t),height:j(t),transform:"rotate(45deg)",position:"absolute",[WU[c]]:j(n)},p=j(-t/2);return c==="left"?$u(Yo(Yo({},d),V_(u,a,r,o)),{right:p,borderLeftColor:"transparent",borderBottomColor:"transparent"}):c==="right"?$u(Yo(Yo({},d),V_(u,a,r,o)),{left:p,borderRightColor:"transparent",borderTopColor:"transparent"}):c==="top"?$u(Yo(Yo({},d),B_(u,i,r,o,l)),{bottom:p,borderTopColor:"transparent",borderLeftColor:"transparent"}):c==="bottom"?$u(Yo(Yo({},d),B_(u,i,r,o,l)),{top:p,borderBottomColor:"transparent",borderRightColor:"transparent"}):{}}var qU=Object.defineProperty,GU=Object.defineProperties,QU=Object.getOwnPropertyDescriptors,Sf=Object.getOwnPropertySymbols,GR=Object.prototype.hasOwnProperty,QR=Object.prototype.propertyIsEnumerable,U_=(e,t,r)=>t in e?qU(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,KU=(e,t)=>{for(var r in t||(t={}))GR.call(t,r)&&U_(e,r,t[r]);if(Sf)for(var r of Sf(t))QR.call(t,r)&&U_(e,r,t[r]);return e},YU=(e,t)=>GU(e,QU(t)),XU=(e,t)=>{var r={};for(var n in e)GR.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&Sf)for(var n of Sf(e))t.indexOf(n)<0&&QR.call(e,n)&&(r[n]=e[n]);return r};const nx=f.forwardRef((e,t)=>{var r=e,{position:n,arrowSize:o,arrowOffset:i,arrowRadius:a,arrowPosition:l,visible:c,arrowX:u,arrowY:d}=r,p=XU(r,["position","arrowSize","arrowOffset","arrowRadius","arrowPosition","visible","arrowX","arrowY"]);const h=Jt();return c?S.createElement("div",YU(KU({},p),{ref:t,style:HU({position:n,arrowSize:o,arrowOffset:i,arrowRadius:a,arrowPosition:l,dir:h.dir,arrowX:u,arrowY:d})})):null});nx.displayName="@mantine/core/FloatingArrow";var JU=Object.defineProperty,ZU=Object.defineProperties,eW=Object.getOwnPropertyDescriptors,Pf=Object.getOwnPropertySymbols,KR=Object.prototype.hasOwnProperty,YR=Object.prototype.propertyIsEnumerable,W_=(e,t,r)=>t in e?JU(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Ta=(e,t)=>{for(var r in t||(t={}))KR.call(t,r)&&W_(e,r,t[r]);if(Pf)for(var r of Pf(t))YR.call(t,r)&&W_(e,r,t[r]);return e},ku=(e,t)=>ZU(e,eW(t)),tW=(e,t)=>{var r={};for(var n in e)KR.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&Pf)for(var n of Pf(e))t.indexOf(n)<0&&YR.call(e,n)&&(r[n]=e[n]);return r};const rW={};function XR(e){var t;const r=H("PopoverDropdown",rW,e),{style:n,className:o,children:i,onKeyDownCapture:a}=r,l=tW(r,["style","className","children","onKeyDownCapture"]),c=UR(),{classes:u,cx:d}=IU({radius:c.radius,shadow:c.shadow},{name:c.__staticSelector,classNames:c.classNames,styles:c.styles,unstyled:c.unstyled,variant:c.variant}),p=GE({opened:c.opened,shouldReturnFocus:c.returnFocus}),h=c.withRoles?{"aria-labelledby":c.getTargetId(),id:c.getDropdownId(),role:"dialog"}:{};return c.disabled?null:S.createElement(Ms,ku(Ta({},c.portalProps),{withinPortal:c.withinPortal}),S.createElement(va,ku(Ta({mounted:c.opened},c.transitionProps),{transition:c.transitionProps.transition||"fade",duration:(t=c.transitionProps.duration)!=null?t:150,keepMounted:c.keepMounted,exitDuration:typeof c.transitionProps.exitDuration=="number"?c.transitionProps.exitDuration:c.transitionProps.duration}),m=>{var g,v;return S.createElement(rx,{active:c.trapFocus},S.createElement(ie,Ta(ku(Ta({},h),{tabIndex:-1,ref:c.floating,style:ku(Ta(Ta({},n),m),{zIndex:c.zIndex,top:(g=c.y)!=null?g:0,left:(v=c.x)!=null?v:0,width:c.width==="target"?void 0:j(c.width)}),className:d(u.dropdown,o),onKeyDownCapture:y9(c.onClose,{active:c.closeOnEscape,onTrigger:p,onKeyDown:a}),"data-position":c.placement}),l),i,S.createElement(nx,{ref:c.arrowRef,arrowX:c.arrowX,arrowY:c.arrowY,visible:c.withArrow,position:c.placement,arrowSize:c.arrowSize,arrowRadius:c.arrowRadius,arrowOffset:c.arrowOffset,arrowPosition:c.arrowPosition,className:u.arrow})))}))}XR.displayName="@mantine/core/PopoverDropdown";function JR(e,t){if(e==="rtl"&&(t.includes("right")||t.includes("left"))){const[r,n]=t.split("-"),o=r==="right"?"left":"right";return n===void 0?o:`${o}-${n}`}return t}var H_=Object.getOwnPropertySymbols,nW=Object.prototype.hasOwnProperty,oW=Object.prototype.propertyIsEnumerable,iW=(e,t)=>{var r={};for(var n in e)nW.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&H_)for(var n of H_(e))t.indexOf(n)<0&&oW.call(e,n)&&(r[n]=e[n]);return r};const aW={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:!1,closeOnEscape:!0,trapFocus:!1,withRoles:!0,returnFocus:!1,clickOutsideEvents:["mousedown","touchstart"],zIndex:Tn("popover"),__staticSelector:"Popover",width:"max-content"};function Lo(e){var t,r,n,o,i,a;const l=f.useRef(null),c=H("Popover",aW,e),{children:u,position:d,offset:p,onPositionChange:h,positionDependencies:m,opened:g,transitionProps:v,width:_,middlewares:y,withArrow:x,arrowSize:w,arrowOffset:b,arrowRadius:C,arrowPosition:O,unstyled:P,classNames:E,styles:$,closeOnClickOutside:k,withinPortal:I,portalProps:T,closeOnEscape:N,clickOutsideEvents:A,trapFocus:z,onClose:G,onOpen:X,onChange:R,zIndex:M,radius:V,shadow:Q,id:Z,defaultOpened:_e,__staticSelector:xe,withRoles:Ve,disabled:Me,returnFocus:gt,variant:Nt,keepMounted:ke}=c,Ht=iW(c,["children","position","offset","onPositionChange","positionDependencies","opened","transitionProps","width","middlewares","withArrow","arrowSize","arrowOffset","arrowRadius","arrowPosition","unstyled","classNames","styles","closeOnClickOutside","withinPortal","portalProps","closeOnEscape","clickOutsideEvents","trapFocus","onClose","onOpen","onChange","zIndex","radius","shadow","id","defaultOpened","__staticSelector","withRoles","disabled","returnFocus","variant","keepMounted"]),[Lr,lr]=f.useState(null),[qt,At]=f.useState(null),ao=Nr(Z),Uo=Jt(),Je=PU({middlewares:y,width:_,position:JR(Uo.dir,d),offset:typeof p=="number"?p+(x?w/2:0):p,arrowRef:l,arrowOffset:b,onPositionChange:h,positionDependencies:m,opened:g,defaultOpened:_e,onChange:R,onOpen:X,onClose:G});F6(()=>Je.opened&&k&&Je.onClose(),A,[Lr,qt]);const so=f.useCallback(cr=>{lr(cr),Je.floating.reference(cr)},[Je.floating.reference]),_r=f.useCallback(cr=>{At(cr),Je.floating.floating(cr)},[Je.floating.floating]);return S.createElement(jU,{value:{returnFocus:gt,disabled:Me,controlled:Je.controlled,reference:so,floating:_r,x:Je.floating.x,y:Je.floating.y,arrowX:(n=(r=(t=Je.floating)==null?void 0:t.middlewareData)==null?void 0:r.arrow)==null?void 0:n.x,arrowY:(a=(i=(o=Je.floating)==null?void 0:o.middlewareData)==null?void 0:i.arrow)==null?void 0:a.y,opened:Je.opened,arrowRef:l,transitionProps:v,width:_,withArrow:x,arrowSize:w,arrowOffset:b,arrowRadius:C,arrowPosition:O,placement:Je.floating.placement,trapFocus:z,withinPortal:I,portalProps:T,zIndex:M,radius:V,shadow:Q,closeOnEscape:N,onClose:Je.onClose,onToggle:Je.onToggle,getTargetId:()=>`${ao}-target`,getDropdownId:()=>`${ao}-dropdown`,withRoles:Ve,targetProps:Ht,__staticSelector:xe,classNames:E,styles:$,unstyled:P,variant:Nt,keepMounted:ke}},u)}Lo.Target=qR;Lo.Dropdown=XR;Lo.displayName="@mantine/core/Popover";var sW=Object.defineProperty,jf=Object.getOwnPropertySymbols,ZR=Object.prototype.hasOwnProperty,eT=Object.prototype.propertyIsEnumerable,q_=(e,t,r)=>t in e?sW(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,lW=(e,t)=>{for(var r in t||(t={}))ZR.call(t,r)&&q_(e,r,t[r]);if(jf)for(var r of jf(t))eT.call(t,r)&&q_(e,r,t[r]);return e},cW=(e,t)=>{var r={};for(var n in e)ZR.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&jf)for(var n of jf(e))t.indexOf(n)<0&&eT.call(e,n)&&(r[n]=e[n]);return r};function uW(e){var t=e,{children:r,component:n="div",maxHeight:o=220,direction:i="column",id:a,innerRef:l,__staticSelector:c,styles:u,classNames:d,unstyled:p}=t,h=cW(t,["children","component","maxHeight","direction","id","innerRef","__staticSelector","styles","classNames","unstyled"]);const{classes:m}=xB(null,{name:c,styles:u,classNames:d,unstyled:p});return S.createElement(Lo.Dropdown,lW({p:0,onMouseDown:g=>g.preventDefault()},h),S.createElement("div",{style:{maxHeight:j(o),display:"flex"}},S.createElement(ie,{component:n||"div",id:`${a}-items`,"aria-labelledby":`${a}-label`,role:"listbox",onMouseDown:g=>g.preventDefault(),style:{flex:1,overflowY:n!==U0?"auto":void 0},"data-combobox-popover":!0,tabIndex:-1,ref:l},S.createElement("div",{className:m.itemsWrapper,style:{flexDirection:i}},r))))}function Ll({opened:e,transitionProps:t={transition:"fade",duration:0},shadow:r,withinPortal:n,portalProps:o,children:i,__staticSelector:a,onDirectionChange:l,switchDirectionOnFlip:c,zIndex:u,dropdownPosition:d,positionDependencies:p=[],classNames:h,styles:m,unstyled:g,readOnly:v,variant:_}){return S.createElement(Lo,{unstyled:g,classNames:h,styles:m,width:"target",withRoles:!1,opened:e,middlewares:{flip:d==="flip",shift:!1},position:d==="flip"?"bottom":d,positionDependencies:p,zIndex:u,__staticSelector:a,withinPortal:n,portalProps:o,transitionProps:t,shadow:r,disabled:v,onPositionChange:y=>c&&(l==null?void 0:l(y==="top"?"column-reverse":"column")),variant:_},i)}Ll.Target=Lo.Target;Ll.Dropdown=uW;var dW=Object.defineProperty,fW=Object.defineProperties,pW=Object.getOwnPropertyDescriptors,Of=Object.getOwnPropertySymbols,tT=Object.prototype.hasOwnProperty,rT=Object.prototype.propertyIsEnumerable,G_=(e,t,r)=>t in e?dW(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Ru=(e,t)=>{for(var r in t||(t={}))tT.call(t,r)&&G_(e,r,t[r]);if(Of)for(var r of Of(t))rT.call(t,r)&&G_(e,r,t[r]);return e},hW=(e,t)=>fW(e,pW(t)),mW=(e,t)=>{var r={};for(var n in e)tT.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&Of)for(var n of Of(e))t.indexOf(n)<0&&rT.call(e,n)&&(r[n]=e[n]);return r};function nT(e,t,r){const n=H(e,t,r),{label:o,description:i,error:a,required:l,classNames:c,styles:u,className:d,unstyled:p,__staticSelector:h,sx:m,errorProps:g,labelProps:v,descriptionProps:_,wrapperProps:y,id:x,size:w,style:b,inputContainer:C,inputWrapperOrder:O,withAsterisk:P,variant:E}=n,$=mW(n,["label","description","error","required","classNames","styles","className","unstyled","__staticSelector","sx","errorProps","labelProps","descriptionProps","wrapperProps","id","size","style","inputContainer","inputWrapperOrder","withAsterisk","variant"]),k=Nr(x),{systemStyles:I,rest:T}=oo($),N=Ru({label:o,description:i,error:a,required:l,classNames:c,className:d,__staticSelector:h,sx:m,errorProps:g,labelProps:v,descriptionProps:_,unstyled:p,styles:u,id:k,size:w,style:b,inputContainer:C,inputWrapperOrder:O,withAsterisk:P,variant:E},y);return hW(Ru({},T),{classNames:c,styles:u,unstyled:p,wrapperProps:Ru(Ru({},N),I),inputProps:{required:l,classNames:c,styles:u,unstyled:p,id:k,size:w,__staticSelector:h,error:a,variant:E}})}var gW=W((e,t,{size:r})=>({label:{display:"inline-block",fontSize:L({size:r,sizes:e.fontSizes}),fontWeight:500,color:e.colorScheme==="dark"?e.colors.dark[0]:e.colors.gray[9],wordBreak:"break-word",cursor:"default",WebkitTapHighlightColor:"transparent"},required:{color:e.fn.variant({variant:"filled",color:"red"}).background}}));const vW=gW;var yW=Object.defineProperty,Cf=Object.getOwnPropertySymbols,oT=Object.prototype.hasOwnProperty,iT=Object.prototype.propertyIsEnumerable,Q_=(e,t,r)=>t in e?yW(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,xW=(e,t)=>{for(var r in t||(t={}))oT.call(t,r)&&Q_(e,r,t[r]);if(Cf)for(var r of Cf(t))iT.call(t,r)&&Q_(e,r,t[r]);return e},wW=(e,t)=>{var r={};for(var n in e)oT.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&Cf)for(var n of Cf(e))t.indexOf(n)<0&&iT.call(e,n)&&(r[n]=e[n]);return r};const bW={labelElement:"label",size:"sm"},ox=f.forwardRef((e,t)=>{const r=H("InputLabel",bW,e),{labelElement:n,children:o,required:i,size:a,classNames:l,styles:c,unstyled:u,className:d,htmlFor:p,__staticSelector:h,variant:m,onMouseDown:g}=r,v=wW(r,["labelElement","children","required","size","classNames","styles","unstyled","className","htmlFor","__staticSelector","variant","onMouseDown"]),{classes:_,cx:y}=vW(null,{name:["InputWrapper",h],classNames:l,styles:c,unstyled:u,variant:m,size:a});return S.createElement(ie,xW({component:n,ref:t,className:y(_.label,d),htmlFor:n==="label"?p:void 0,onMouseDown:x=>{g==null||g(x),!x.defaultPrevented&&x.detail>1&&x.preventDefault()}},v),o,i&&S.createElement("span",{className:_.required,"aria-hidden":!0}," *"))});ox.displayName="@mantine/core/InputLabel";var _W=W((e,t,{size:r})=>({error:{wordBreak:"break-word",color:e.fn.variant({variant:"filled",color:"red"}).background,fontSize:`calc(${L({size:r,sizes:e.fontSizes})} - ${j(2)})`,lineHeight:1.2,display:"block"}}));const SW=_W;var PW=Object.defineProperty,Ef=Object.getOwnPropertySymbols,aT=Object.prototype.hasOwnProperty,sT=Object.prototype.propertyIsEnumerable,K_=(e,t,r)=>t in e?PW(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,jW=(e,t)=>{for(var r in t||(t={}))aT.call(t,r)&&K_(e,r,t[r]);if(Ef)for(var r of Ef(t))sT.call(t,r)&&K_(e,r,t[r]);return e},OW=(e,t)=>{var r={};for(var n in e)aT.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&Ef)for(var n of Ef(e))t.indexOf(n)<0&&sT.call(e,n)&&(r[n]=e[n]);return r};const CW={size:"sm"},ix=f.forwardRef((e,t)=>{const r=H("InputError",CW,e),{children:n,className:o,classNames:i,styles:a,unstyled:l,size:c,__staticSelector:u,variant:d}=r,p=OW(r,["children","className","classNames","styles","unstyled","size","__staticSelector","variant"]),{classes:h,cx:m}=SW(null,{name:["InputWrapper",u],classNames:i,styles:a,unstyled:l,variant:d,size:c});return S.createElement(oe,jW({className:m(h.error,o),ref:t},p),n)});ix.displayName="@mantine/core/InputError";var EW=W((e,t,{size:r})=>({description:{wordBreak:"break-word",color:e.colorScheme==="dark"?e.colors.dark[2]:e.colors.gray[6],fontSize:`calc(${L({size:r,sizes:e.fontSizes})} - ${j(2)})`,lineHeight:1.2,display:"block"}}));const $W=EW;var kW=Object.defineProperty,$f=Object.getOwnPropertySymbols,lT=Object.prototype.hasOwnProperty,cT=Object.prototype.propertyIsEnumerable,Y_=(e,t,r)=>t in e?kW(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,RW=(e,t)=>{for(var r in t||(t={}))lT.call(t,r)&&Y_(e,r,t[r]);if($f)for(var r of $f(t))cT.call(t,r)&&Y_(e,r,t[r]);return e},TW=(e,t)=>{var r={};for(var n in e)lT.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&$f)for(var n of $f(e))t.indexOf(n)<0&&cT.call(e,n)&&(r[n]=e[n]);return r};const IW={size:"sm"},ax=f.forwardRef((e,t)=>{const r=H("InputDescription",IW,e),{children:n,className:o,classNames:i,styles:a,unstyled:l,size:c,__staticSelector:u,variant:d}=r,p=TW(r,["children","className","classNames","styles","unstyled","size","__staticSelector","variant"]),{classes:h,cx:m}=$W(null,{name:["InputWrapper",u],classNames:i,styles:a,unstyled:l,variant:d,size:c});return S.createElement(oe,RW({color:"dimmed",className:m(h.description,o),ref:t,unstyled:l},p),n)});ax.displayName="@mantine/core/InputDescription";const uT=f.createContext({offsetBottom:!1,offsetTop:!1,describedBy:void 0}),DW=uT.Provider,NW=()=>f.useContext(uT);function AW(e,{hasDescription:t,hasError:r}){const n=e.findIndex(c=>c==="input"),o=e[n-1],i=e[n+1];return{offsetBottom:t&&i==="description"||r&&i==="error",offsetTop:t&&o==="description"||r&&o==="error"}}var MW=Object.defineProperty,LW=Object.defineProperties,zW=Object.getOwnPropertyDescriptors,X_=Object.getOwnPropertySymbols,FW=Object.prototype.hasOwnProperty,VW=Object.prototype.propertyIsEnumerable,J_=(e,t,r)=>t in e?MW(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,BW=(e,t)=>{for(var r in t||(t={}))FW.call(t,r)&&J_(e,r,t[r]);if(X_)for(var r of X_(t))VW.call(t,r)&&J_(e,r,t[r]);return e},UW=(e,t)=>LW(e,zW(t)),WW=W(e=>({root:UW(BW({},e.fn.fontStyles()),{lineHeight:e.lineHeight})}));const HW=WW;var qW=Object.defineProperty,GW=Object.defineProperties,QW=Object.getOwnPropertyDescriptors,kf=Object.getOwnPropertySymbols,dT=Object.prototype.hasOwnProperty,fT=Object.prototype.propertyIsEnumerable,Z_=(e,t,r)=>t in e?qW(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Xo=(e,t)=>{for(var r in t||(t={}))dT.call(t,r)&&Z_(e,r,t[r]);if(kf)for(var r of kf(t))fT.call(t,r)&&Z_(e,r,t[r]);return e},eS=(e,t)=>GW(e,QW(t)),KW=(e,t)=>{var r={};for(var n in e)dT.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&kf)for(var n of kf(e))t.indexOf(n)<0&&fT.call(e,n)&&(r[n]=e[n]);return r};const YW={labelElement:"label",size:"sm",inputContainer:e=>e,inputWrapperOrder:["label","description","input","error"]},pT=f.forwardRef((e,t)=>{const r=H("InputWrapper",YW,e),{className:n,label:o,children:i,required:a,id:l,error:c,description:u,labelElement:d,labelProps:p,descriptionProps:h,errorProps:m,classNames:g,styles:v,size:_,inputContainer:y,__staticSelector:x,unstyled:w,inputWrapperOrder:b,withAsterisk:C,variant:O}=r,P=KW(r,["className","label","children","required","id","error","description","labelElement","labelProps","descriptionProps","errorProps","classNames","styles","size","inputContainer","__staticSelector","unstyled","inputWrapperOrder","withAsterisk","variant"]),{classes:E,cx:$}=HW(null,{classNames:g,styles:v,name:["InputWrapper",x],unstyled:w,variant:O,size:_}),k={classNames:g,styles:v,unstyled:w,size:_,variant:O,__staticSelector:x},I=typeof C=="boolean"?C:a,T=l?`${l}-error`:m==null?void 0:m.id,N=l?`${l}-description`:h==null?void 0:h.id,z=`${!!c&&typeof c!="boolean"?T:""} ${u?N:""}`,G=z.trim().length>0?z.trim():void 0,X=o&&S.createElement(ox,Xo(Xo({key:"label",labelElement:d,id:l?`${l}-label`:void 0,htmlFor:l,required:I},k),p),o),R=u&&S.createElement(ax,eS(Xo(Xo({key:"description"},h),k),{size:(h==null?void 0:h.size)||k.size,id:(h==null?void 0:h.id)||N}),u),M=S.createElement(f.Fragment,{key:"input"},y(i)),V=typeof c!="boolean"&&c&&S.createElement(ix,eS(Xo(Xo({},m),k),{size:(m==null?void 0:m.size)||k.size,key:"error",id:(m==null?void 0:m.id)||T}),c),Q=b.map(Z=>{switch(Z){case"label":return X;case"input":return M;case"description":return R;case"error":return V;default:return null}});return S.createElement(DW,{value:Xo({describedBy:G},AW(b,{hasDescription:!!R,hasError:!!V}))},S.createElement(ie,Xo({className:$(E.root,n),ref:t},P),Q))});pT.displayName="@mantine/core/InputWrapper";var XW=Object.defineProperty,Rf=Object.getOwnPropertySymbols,hT=Object.prototype.hasOwnProperty,mT=Object.prototype.propertyIsEnumerable,tS=(e,t,r)=>t in e?XW(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,JW=(e,t)=>{for(var r in t||(t={}))hT.call(t,r)&&tS(e,r,t[r]);if(Rf)for(var r of Rf(t))mT.call(t,r)&&tS(e,r,t[r]);return e},ZW=(e,t)=>{var r={};for(var n in e)hT.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&Rf)for(var n of Rf(e))t.indexOf(n)<0&&mT.call(e,n)&&(r[n]=e[n]);return r};const eH={},gT=f.forwardRef((e,t)=>{const r=H("InputPlaceholder",eH,e),{sx:n}=r,o=ZW(r,["sx"]);return S.createElement(ie,JW({component:"span",sx:[i=>i.fn.placeholderStyles(),...wc(n)],ref:t},o))});gT.displayName="@mantine/core/InputPlaceholder";var tH=Object.defineProperty,rH=Object.defineProperties,nH=Object.getOwnPropertyDescriptors,rS=Object.getOwnPropertySymbols,oH=Object.prototype.hasOwnProperty,iH=Object.prototype.propertyIsEnumerable,nS=(e,t,r)=>t in e?tH(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Tu=(e,t)=>{for(var r in t||(t={}))oH.call(t,r)&&nS(e,r,t[r]);if(rS)for(var r of rS(t))iH.call(t,r)&&nS(e,r,t[r]);return e},_g=(e,t)=>rH(e,nH(t));const Et={xs:j(30),sm:j(36),md:j(42),lg:j(50),xl:j(60)},aH=["default","filled","unstyled"];function sH({theme:e,variant:t}){return aH.includes(t)?t==="default"?{border:`${j(1)} solid ${e.colorScheme==="dark"?e.colors.dark[4]:e.colors.gray[4]}`,backgroundColor:e.colorScheme==="dark"?e.colors.dark[6]:e.white,transition:"border-color 100ms ease","&:focus, &:focus-within":e.focusRingStyles.inputStyles(e)}:t==="filled"?{border:`${j(1)} solid transparent`,backgroundColor:e.colorScheme==="dark"?e.colors.dark[5]:e.colors.gray[1],"&:focus, &:focus-within":e.focusRingStyles.inputStyles(e)}:{borderWidth:0,color:e.colorScheme==="dark"?e.colors.dark[0]:e.black,backgroundColor:"transparent",minHeight:j(28),outline:0,"&:focus, &:focus-within":{outline:"none",borderColor:"transparent"},"&:disabled":{backgroundColor:"transparent","&:focus, &:focus-within":{outline:"none",borderColor:"transparent"}}}:null}var lH=W((e,{multiline:t,radius:r,invalid:n,rightSectionWidth:o,withRightSection:i,iconWidth:a,offsetBottom:l,offsetTop:c,pointer:u},{variant:d,size:p})=>{const h=e.fn.variant({variant:"filled",color:"red"}).background,m=d==="default"||d==="filled"?{minHeight:L({size:p,sizes:Et}),paddingLeft:`calc(${L({size:p,sizes:Et})} / 3)`,paddingRight:i?o||L({size:p,sizes:Et}):`calc(${L({size:p,sizes:Et})} / 3)`,borderRadius:e.fn.radius(r)}:d==="unstyled"&&i?{paddingRight:o||L({size:p,sizes:Et})}:null;return{wrapper:{position:"relative",marginTop:c?`calc(${e.spacing.xs} / 2)`:void 0,marginBottom:l?`calc(${e.spacing.xs} / 2)`:void 0,"&:has(input:disabled)":{"& .mantine-Input-rightSection":{display:"none"}}},input:_g(Tu(Tu(_g(Tu({},e.fn.fontStyles()),{height:t?d==="unstyled"?void 0:"auto":L({size:p,sizes:Et}),WebkitTapHighlightColor:"transparent",lineHeight:t?e.lineHeight:`calc(${L({size:p,sizes:Et})} - ${j(2)})`,appearance:"none",resize:"none",boxSizing:"border-box",fontSize:L({size:p,sizes:e.fontSizes}),width:"100%",color:e.colorScheme==="dark"?e.colors.dark[0]:e.black,display:"block",textAlign:"left",cursor:u?"pointer":void 0}),sH({theme:e,variant:d})),m),{"&:disabled, &[data-disabled]":{backgroundColor:e.colorScheme==="dark"?e.colors.dark[6]:e.colors.gray[1],color:e.colors.dark[2],opacity:.6,cursor:"not-allowed",pointerEvents:"none","&::placeholder":{color:e.colors.dark[2]}},"&[data-invalid]":{color:h,borderColor:h,"&::placeholder":{opacity:1,color:h}},"&[data-with-icon]":{paddingLeft:typeof a=="number"?j(a):L({size:p,sizes:Et})},"&::placeholder":_g(Tu({},e.fn.placeholderStyles()),{opacity:1}),"&::-webkit-inner-spin-button, &::-webkit-outer-spin-button, &::-webkit-search-decoration, &::-webkit-search-cancel-button, &::-webkit-search-results-button, &::-webkit-search-results-decoration":{appearance:"none"},"&[type=number]":{MozAppearance:"textfield"}}),icon:{pointerEvents:"none",position:"absolute",zIndex:1,left:0,top:0,bottom:0,display:"flex",alignItems:"center",justifyContent:"center",width:a?j(a):L({size:p,sizes:Et}),color:n?e.colors.red[e.colorScheme==="dark"?6:7]:e.colorScheme==="dark"?e.colors.dark[2]:e.colors.gray[5]},rightSection:{position:"absolute",top:0,bottom:0,right:0,display:"flex",alignItems:"center",justifyContent:"center",width:o||L({size:p,sizes:Et})}}});const cH=lH;var uH=Object.defineProperty,dH=Object.defineProperties,fH=Object.getOwnPropertyDescriptors,Tf=Object.getOwnPropertySymbols,vT=Object.prototype.hasOwnProperty,yT=Object.prototype.propertyIsEnumerable,oS=(e,t,r)=>t in e?uH(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Iu=(e,t)=>{for(var r in t||(t={}))vT.call(t,r)&&oS(e,r,t[r]);if(Tf)for(var r of Tf(t))yT.call(t,r)&&oS(e,r,t[r]);return e},iS=(e,t)=>dH(e,fH(t)),pH=(e,t)=>{var r={};for(var n in e)vT.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&Tf)for(var n of Tf(e))t.indexOf(n)<0&&yT.call(e,n)&&(r[n]=e[n]);return r};const hH={size:"sm",variant:"default"},ya=f.forwardRef((e,t)=>{const r=H("Input",hH,e),{className:n,error:o,required:i,disabled:a,variant:l,icon:c,style:u,rightSectionWidth:d,iconWidth:p,rightSection:h,rightSectionProps:m,radius:g,size:v,wrapperProps:_,classNames:y,styles:x,__staticSelector:w,multiline:b,sx:C,unstyled:O,pointer:P}=r,E=pH(r,["className","error","required","disabled","variant","icon","style","rightSectionWidth","iconWidth","rightSection","rightSectionProps","radius","size","wrapperProps","classNames","styles","__staticSelector","multiline","sx","unstyled","pointer"]),{offsetBottom:$,offsetTop:k,describedBy:I}=NW(),{classes:T,cx:N}=cH({radius:g,multiline:b,invalid:!!o,rightSectionWidth:d?j(d):void 0,iconWidth:p,withRightSection:!!h,offsetBottom:$,offsetTop:k,pointer:P},{classNames:y,styles:x,name:["Input",w],unstyled:O,variant:l,size:v}),{systemStyles:A,rest:z}=oo(E);return S.createElement(ie,Iu(Iu({className:N(T.wrapper,n),sx:C,style:u},A),_),c&&S.createElement("div",{className:T.icon},c),S.createElement(ie,iS(Iu({component:"input"},z),{ref:t,required:i,"aria-invalid":!!o,"aria-describedby":I,disabled:a,"data-disabled":a||void 0,"data-with-icon":!!c||void 0,"data-invalid":!!o||void 0,className:T.input})),h&&S.createElement("div",iS(Iu({},m),{className:T.rightSection}),h))});ya.displayName="@mantine/core/Input";ya.Wrapper=pT;ya.Label=ox;ya.Description=ax;ya.Error=ix;ya.Placeholder=gT;const Ut=ya;var mH=Object.defineProperty,If=Object.getOwnPropertySymbols,xT=Object.prototype.hasOwnProperty,wT=Object.prototype.propertyIsEnumerable,aS=(e,t,r)=>t in e?mH(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,gH=(e,t)=>{for(var r in t||(t={}))xT.call(t,r)&&aS(e,r,t[r]);if(If)for(var r of If(t))wT.call(t,r)&&aS(e,r,t[r]);return e},vH=(e,t)=>{var r={};for(var n in e)xT.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&If)for(var n of If(e))t.indexOf(n)<0&&wT.call(e,n)&&(r[n]=e[n]);return r};function yH(e){const t=e,{style:r}=t,n=vH(t,["style"]);return S.createElement("svg",gH({viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:r},n),S.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"}))}var xH=Object.defineProperty,wH=Object.defineProperties,bH=Object.getOwnPropertyDescriptors,sS=Object.getOwnPropertySymbols,_H=Object.prototype.hasOwnProperty,SH=Object.prototype.propertyIsEnumerable,lS=(e,t,r)=>t in e?xH(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,PH=(e,t)=>{for(var r in t||(t={}))_H.call(t,r)&&lS(e,r,t[r]);if(sS)for(var r of sS(t))SH.call(t,r)&&lS(e,r,t[r]);return e},jH=(e,t)=>wH(e,bH(t));const bT=f.createContext(null);function OH({spacing:e,children:t}){return S.createElement(bT.Provider,{value:{spacing:e}},t)}function CH(){const e=f.useContext(bT);return e?jH(PH({},e),{withinGroup:!0}):{spacing:null,withinGroup:!1}}var EH=W((e,{spacing:t})=>({root:{display:"flex",paddingLeft:L({size:t,sizes:e.spacing})}}));const $H=EH;var kH=Object.defineProperty,Df=Object.getOwnPropertySymbols,_T=Object.prototype.hasOwnProperty,ST=Object.prototype.propertyIsEnumerable,cS=(e,t,r)=>t in e?kH(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,RH=(e,t)=>{for(var r in t||(t={}))_T.call(t,r)&&cS(e,r,t[r]);if(Df)for(var r of Df(t))ST.call(t,r)&&cS(e,r,t[r]);return e},TH=(e,t)=>{var r={};for(var n in e)_T.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&Df)for(var n of Df(e))t.indexOf(n)<0&&ST.call(e,n)&&(r[n]=e[n]);return r};const IH={},PT=f.forwardRef((e,t)=>{const r=H("AvatarGroup",IH,e),{children:n,spacing:o="sm",unstyled:i,className:a,variant:l}=r,c=TH(r,["children","spacing","unstyled","className","variant"]),{classes:u,cx:d}=$H({spacing:o},{name:"AvatarGroup",unstyled:i,variant:l});return S.createElement(OH,{spacing:o},S.createElement(ie,RH({ref:t,className:d(u.root,a)},c),n))});PT.displayName="@mantine/core/AvatarGroup";var DH=Object.defineProperty,NH=Object.defineProperties,AH=Object.getOwnPropertyDescriptors,uS=Object.getOwnPropertySymbols,MH=Object.prototype.hasOwnProperty,LH=Object.prototype.propertyIsEnumerable,dS=(e,t,r)=>t in e?DH(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,ol=(e,t)=>{for(var r in t||(t={}))MH.call(t,r)&&dS(e,r,t[r]);if(uS)for(var r of uS(t))LH.call(t,r)&&dS(e,r,t[r]);return e},fS=(e,t)=>NH(e,AH(t));const zH=["filled","light","gradient","outline"],Du={xs:j(16),sm:j(26),md:j(38),lg:j(56),xl:j(84)};function FH({withinGroup:e,spacing:t,theme:r}){return e?{marginLeft:`calc(${L({size:t,sizes:r.spacing})} * -1)`,backgroundColor:`${r.colorScheme==="dark"?r.colors.dark[7]:r.white}`,border:`${j(2)} solid ${r.colorScheme==="dark"?r.colors.dark[7]:r.white}`}:null}function VH({theme:e,variant:t,color:r,gradient:n}){const o=e.fn.variant({variant:t,color:r,gradient:n});return zH.includes(t)?{placeholder:{color:o.color,backgroundColor:o.background,backgroundImage:t==="gradient"?o.background:void 0,border:`${j(t==="gradient"?0:1)} solid ${o.border}`},placeholderIcon:{color:o.color}}:{}}var BH=W((e,{radius:t,withinGroup:r,spacing:n,color:o,gradient:i},{variant:a,size:l})=>{const c=VH({theme:e,color:o,gradient:i,variant:a});return{root:ol(fS(ol({},e.fn.focusStyles()),{WebkitTapHighlightColor:"transparent",boxSizing:"border-box",position:"relative",display:"block",userSelect:"none",overflow:"hidden",borderRadius:e.fn.radius(t),textDecoration:"none",border:0,backgroundColor:"transparent",padding:0,width:L({size:l,sizes:Du}),minWidth:L({size:l,sizes:Du}),height:L({size:l,sizes:Du})}),FH({withinGroup:r,spacing:n,theme:e})),image:{objectFit:"cover",width:"100%",height:"100%",display:"block"},placeholder:ol(fS(ol({},e.fn.fontStyles()),{fontWeight:700,display:"flex",alignItems:"center",justifyContent:"center",width:"100%",height:"100%",userSelect:"none",borderRadius:e.fn.radius(t),fontSize:`calc(${L({size:l,sizes:Du})} / 2.5)`}),c.placeholder),placeholderIcon:ol({width:"70%",height:"70%"},c.placeholderIcon)}});const UH=BH;var WH=Object.defineProperty,HH=Object.defineProperties,qH=Object.getOwnPropertyDescriptors,Nf=Object.getOwnPropertySymbols,jT=Object.prototype.hasOwnProperty,OT=Object.prototype.propertyIsEnumerable,pS=(e,t,r)=>t in e?WH(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,hS=(e,t)=>{for(var r in t||(t={}))jT.call(t,r)&&pS(e,r,t[r]);if(Nf)for(var r of Nf(t))OT.call(t,r)&&pS(e,r,t[r]);return e},GH=(e,t)=>HH(e,qH(t)),QH=(e,t)=>{var r={};for(var n in e)jT.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&Nf)for(var n of Nf(e))t.indexOf(n)<0&&OT.call(e,n)&&(r[n]=e[n]);return r};const KH={size:"md",color:"gray",variant:"light"},sx=f.forwardRef((e,t)=>{const r=H("Avatar",KH,e),{className:n,size:o,src:i,alt:a,radius:l,children:c,color:u,variant:d,gradient:p,classNames:h,styles:m,imageProps:g,unstyled:v}=r,_=QH(r,["className","size","src","alt","radius","children","color","variant","gradient","classNames","styles","imageProps","unstyled"]),y=CH(),[x,w]=f.useState(!i),{classes:b,cx:C}=UH({color:u,radius:l,withinGroup:y.withinGroup,spacing:y.spacing,gradient:p},{classNames:h,styles:m,unstyled:v,name:"Avatar",variant:d,size:o});return f.useEffect(()=>{w(!i)},[i]),S.createElement(ie,hS({component:"div",className:C(b.root,n),ref:t},_),x?S.createElement("div",{className:b.placeholder,title:a},c||S.createElement(yH,{className:b.placeholderIcon})):S.createElement("img",GH(hS({},g),{className:b.image,src:i,alt:a,onError:()=>w(!0)})))});sx.displayName="@mantine/core/Avatar";sx.Group=PT;const Af=sx;var YH=Object.defineProperty,XH=Object.defineProperties,JH=Object.getOwnPropertyDescriptors,mS=Object.getOwnPropertySymbols,ZH=Object.prototype.hasOwnProperty,eq=Object.prototype.propertyIsEnumerable,gS=(e,t,r)=>t in e?YH(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Sg=(e,t)=>{for(var r in t||(t={}))ZH.call(t,r)&&gS(e,r,t[r]);if(mS)for(var r of mS(t))eq.call(t,r)&&gS(e,r,t[r]);return e},tq=(e,t)=>XH(e,JH(t));const rq=["light","filled","outline","dot","gradient"],Pg={xs:{fontSize:j(9),height:j(16)},sm:{fontSize:j(10),height:j(18)},md:{fontSize:j(11),height:j(20)},lg:{fontSize:j(13),height:j(26)},xl:{fontSize:j(16),height:j(32)}},nq={xs:j(4),sm:j(4),md:j(6),lg:j(8),xl:j(10)};function oq({theme:e,variant:t,color:r,size:n,gradient:o}){if(!rq.includes(t))return null;if(t==="dot"){const a=L({size:n,sizes:nq});return{backgroundColor:"transparent",color:e.colorScheme==="dark"?e.colors.dark[0]:e.colors.gray[7],border:`${j(1)} solid ${e.colorScheme==="dark"?e.colors.dark[3]:e.colors.gray[3]}`,paddingLeft:`calc(${L({size:n,sizes:e.spacing})} / 1.5 - ${a} / 2)`,"&::before":{content:'""',display:"block",width:a,height:a,borderRadius:a,backgroundColor:e.fn.themeColor(r,e.colorScheme==="dark"?4:e.fn.primaryShade("light"),!0),marginRight:a}}}const i=e.fn.variant({color:r,variant:t,gradient:o});return{background:i.background,color:i.color,border:`${j(t==="gradient"?0:1)} solid ${i.border}`}}var iq=W((e,{color:t,radius:r,gradient:n,fullWidth:o},{variant:i,size:a})=>{const{fontSize:l,height:c}=a in Pg?Pg[a]:Pg.md;return{leftSection:{marginRight:`calc(${e.spacing.xs} / 2)`},rightSection:{marginLeft:`calc(${e.spacing.xs} / 2)`},inner:{whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},root:Sg(tq(Sg(Sg({},e.fn.focusStyles()),e.fn.fontStyles()),{fontSize:l,height:c,WebkitTapHighlightColor:"transparent",lineHeight:`calc(${c} - ${j(2)})`,textDecoration:"none",padding:`0 calc(${L({size:a,sizes:e.spacing})} / 1.5)`,boxSizing:"border-box",display:o?"flex":"inline-flex",alignItems:"center",justifyContent:"center",width:o?"100%":"auto",textTransform:"uppercase",borderRadius:e.fn.radius(r),fontWeight:700,letterSpacing:j(.25),cursor:"inherit",textOverflow:"ellipsis",overflow:"hidden"}),oq({theme:e,variant:i,color:t,size:a,gradient:n}))}});const aq=iq;var sq=Object.defineProperty,Mf=Object.getOwnPropertySymbols,CT=Object.prototype.hasOwnProperty,ET=Object.prototype.propertyIsEnumerable,vS=(e,t,r)=>t in e?sq(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,lq=(e,t)=>{for(var r in t||(t={}))CT.call(t,r)&&vS(e,r,t[r]);if(Mf)for(var r of Mf(t))ET.call(t,r)&&vS(e,r,t[r]);return e},cq=(e,t)=>{var r={};for(var n in e)CT.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&Mf)for(var n of Mf(e))t.indexOf(n)<0&&ET.call(e,n)&&(r[n]=e[n]);return r};const uq={variant:"light",size:"md",radius:"xl"},$T=f.forwardRef((e,t)=>{const r=H("Badge",uq,e),{className:n,color:o,variant:i,fullWidth:a,children:l,size:c,leftSection:u,rightSection:d,radius:p,gradient:h,classNames:m,styles:g,unstyled:v}=r,_=cq(r,["className","color","variant","fullWidth","children","size","leftSection","rightSection","radius","gradient","classNames","styles","unstyled"]),{classes:y,cx:x}=aq({fullWidth:a,color:o,radius:p,gradient:h},{classNames:m,styles:g,name:"Badge",unstyled:v,variant:i,size:c});return S.createElement(ie,lq({className:x(y.root,n),ref:t},_),u&&S.createElement("span",{className:y.leftSection},u),S.createElement("span",{className:y.inner},l),d&&S.createElement("span",{className:y.rightSection},d))});$T.displayName="@mantine/core/Badge";const dq=$T;var fq=Object.defineProperty,Lf=Object.getOwnPropertySymbols,kT=Object.prototype.hasOwnProperty,RT=Object.prototype.propertyIsEnumerable,yS=(e,t,r)=>t in e?fq(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,xS=(e,t)=>{for(var r in t||(t={}))kT.call(t,r)&&yS(e,r,t[r]);if(Lf)for(var r of Lf(t))RT.call(t,r)&&yS(e,r,t[r]);return e},pq=(e,t)=>{var r={};for(var n in e)kT.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&Lf)for(var n of Lf(e))t.indexOf(n)<0&&RT.call(e,n)&&(r[n]=e[n]);return r};function hq(e){const t=e,{style:r}=t,n=pq(t,["style"]);return S.createElement("svg",xS({viewBox:"0 0 409.294 409.294",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",style:xS({width:j(20),height:j(20)},r)},n),S.createElement("path",{d:"M0 204.647v175.412h175.412V204.647H58.471c0-64.48 52.461-116.941 116.941-116.941V29.235C78.684 29.235 0 107.919 0 204.647zM409.294 87.706V29.235c-96.728 0-175.412 78.684-175.412 175.412v175.412h175.412V204.647H292.353c0-64.48 52.461-116.941 116.941-116.941z"}))}var mq=Object.defineProperty,gq=Object.defineProperties,vq=Object.getOwnPropertyDescriptors,wS=Object.getOwnPropertySymbols,yq=Object.prototype.hasOwnProperty,xq=Object.prototype.propertyIsEnumerable,bS=(e,t,r)=>t in e?mq(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,wq=(e,t)=>{for(var r in t||(t={}))yq.call(t,r)&&bS(e,r,t[r]);if(wS)for(var r of wS(t))xq.call(t,r)&&bS(e,r,t[r]);return e},bq=(e,t)=>gq(e,vq(t)),_q=W((e,{color:t})=>({root:bq(wq({},e.fn.fontStyles()),{fontSize:e.fontSizes.lg,lineHeight:e.lineHeight,color:e.colorScheme==="dark"?e.colors.dark[0]:e.black,margin:0,borderTopRightRadius:e.radius.sm,borderBottomRightRadius:e.radius.sm,padding:`${e.spacing.md} ${e.spacing.lg}`}),inner:{display:"flex"},body:{flex:1,overflow:"hidden",textOverflow:"ellipsis"},icon:{color:e.fn.variant({variant:"filled",color:t}).background,marginRight:e.spacing.lg,marginTop:j(2),width:j(22)},cite:{display:"block",fontSize:e.fontSizes.sm,marginTop:e.spacing.xs,color:e.colorScheme==="dark"?e.colors.dark[2]:e.colors.gray[6],overflow:"hidden",textOverflow:"ellipsis"}}));const Sq=_q;var Pq=Object.defineProperty,zf=Object.getOwnPropertySymbols,TT=Object.prototype.hasOwnProperty,IT=Object.prototype.propertyIsEnumerable,_S=(e,t,r)=>t in e?Pq(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,jq=(e,t)=>{for(var r in t||(t={}))TT.call(t,r)&&_S(e,r,t[r]);if(zf)for(var r of zf(t))IT.call(t,r)&&_S(e,r,t[r]);return e},Oq=(e,t)=>{var r={};for(var n in e)TT.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&zf)for(var n of zf(e))t.indexOf(n)<0&&IT.call(e,n)&&(r[n]=e[n]);return r};const Cq={color:"gray",icon:S.createElement(hq,null)},DT=f.forwardRef((e,t)=>{const r=H("Blockquote",Cq,e),{className:n,color:o,icon:i,cite:a,children:l,classNames:c,styles:u,unstyled:d,variant:p}=r,h=Oq(r,["className","color","icon","cite","children","classNames","styles","unstyled","variant"]),{classes:m,cx:g}=Sq({color:o},{classNames:c,styles:u,unstyled:d,name:"Blockquote",variant:p});return S.createElement(ie,jq({component:"blockquote",className:g(m.root,n),ref:t},h),S.createElement("div",{className:m.inner},i&&S.createElement("div",{className:m.icon},i),S.createElement("div",{className:m.body},l,a&&S.createElement("cite",{className:m.cite},a))))});DT.displayName="@mantine/core/Blockquote";var Eq=W((e,{orientation:t,buttonBorderWidth:r})=>({root:{display:"flex",flexDirection:t==="vertical"?"column":"row","& [data-button]":{"&:first-of-type:not(:last-of-type)":{borderBottomRightRadius:0,[t==="vertical"?"borderBottomLeftRadius":"borderTopRightRadius"]:0,[t==="vertical"?"borderBottomWidth":"borderRightWidth"]:`calc(${j(r)} / 2)`},"&:last-of-type:not(:first-of-type)":{borderTopLeftRadius:0,[t==="vertical"?"borderTopRightRadius":"borderBottomLeftRadius"]:0,[t==="vertical"?"borderTopWidth":"borderLeftWidth"]:`calc(${j(r)} / 2)`},"&:not(:first-of-type):not(:last-of-type)":{borderRadius:0,[t==="vertical"?"borderTopWidth":"borderLeftWidth"]:`calc(${j(r)} / 2)`,[t==="vertical"?"borderBottomWidth":"borderRightWidth"]:`calc(${j(r)} / 2)`},"& + [data-button]":{[t==="vertical"?"marginTop":"marginLeft"]:`calc(${r} * -1)`,"@media (min-resolution: 192dpi)":{[t==="vertical"?"marginTop":"marginLeft"]:0}}}}}));const $q=Eq;var kq=Object.defineProperty,Ff=Object.getOwnPropertySymbols,NT=Object.prototype.hasOwnProperty,AT=Object.prototype.propertyIsEnumerable,SS=(e,t,r)=>t in e?kq(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Rq=(e,t)=>{for(var r in t||(t={}))NT.call(t,r)&&SS(e,r,t[r]);if(Ff)for(var r of Ff(t))AT.call(t,r)&&SS(e,r,t[r]);return e},Tq=(e,t)=>{var r={};for(var n in e)NT.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&Ff)for(var n of Ff(e))t.indexOf(n)<0&&AT.call(e,n)&&(r[n]=e[n]);return r};const Iq={orientation:"horizontal",buttonBorderWidth:1},MT=f.forwardRef((e,t)=>{const r=H("ButtonGroup",Iq,e),{className:n,orientation:o,buttonBorderWidth:i,unstyled:a}=r,l=Tq(r,["className","orientation","buttonBorderWidth","unstyled"]),{classes:c,cx:u}=$q({orientation:o,buttonBorderWidth:i},{name:"ButtonGroup",unstyled:a});return S.createElement(ie,Rq({className:u(c.root,n),ref:t},l))});MT.displayName="@mantine/core/ButtonGroup";var Dq=Object.defineProperty,Nq=Object.defineProperties,Aq=Object.getOwnPropertyDescriptors,PS=Object.getOwnPropertySymbols,Mq=Object.prototype.hasOwnProperty,Lq=Object.prototype.propertyIsEnumerable,jS=(e,t,r)=>t in e?Dq(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,go=(e,t)=>{for(var r in t||(t={}))Mq.call(t,r)&&jS(e,r,t[r]);if(PS)for(var r of PS(t))Lq.call(t,r)&&jS(e,r,t[r]);return e},yd=(e,t)=>Nq(e,Aq(t));const zq=["filled","outline","light","white","default","subtle","gradient"],ay={xs:{height:Et.xs,paddingLeft:j(14),paddingRight:j(14)},sm:{height:Et.sm,paddingLeft:j(18),paddingRight:j(18)},md:{height:Et.md,paddingLeft:j(22),paddingRight:j(22)},lg:{height:Et.lg,paddingLeft:j(26),paddingRight:j(26)},xl:{height:Et.xl,paddingLeft:j(32),paddingRight:j(32)},"compact-xs":{height:j(22),paddingLeft:j(7),paddingRight:j(7)},"compact-sm":{height:j(26),paddingLeft:j(8),paddingRight:j(8)},"compact-md":{height:j(30),paddingLeft:j(10),paddingRight:j(10)},"compact-lg":{height:j(34),paddingLeft:j(12),paddingRight:j(12)},"compact-xl":{height:j(40),paddingLeft:j(14),paddingRight:j(14)}};function Fq({compact:e,size:t,withLeftIcon:r,withRightIcon:n}){if(e)return ay[`compact-${t}`];const o=ay[t];return o?yd(go({},o),{paddingLeft:r?`calc(${o.paddingLeft} / 1.5)`:o.paddingLeft,paddingRight:n?`calc(${o.paddingRight} / 1.5)`:o.paddingRight}):{}}const Vq=e=>({display:e?"block":"inline-block",width:e?"100%":"auto"});function Bq({variant:e,theme:t,color:r,gradient:n}){if(!zq.includes(e))return null;const o=t.fn.variant({color:r,variant:e,gradient:n});return e==="gradient"?go({border:0,backgroundImage:o.background,color:o.color},t.fn.hover({backgroundSize:"200%"})):go({border:`${j(1)} solid ${o.border}`,backgroundColor:o.background,color:o.color},t.fn.hover({backgroundColor:o.hover}))}var Uq=W((e,{radius:t,fullWidth:r,compact:n,withLeftIcon:o,withRightIcon:i,color:a,gradient:l},{variant:c,size:u})=>({root:yd(go(yd(go(go(go(go({},Fq({compact:n,size:u,withLeftIcon:o,withRightIcon:i})),e.fn.fontStyles()),e.fn.focusStyles()),Vq(r)),{borderRadius:e.fn.radius(t),fontWeight:600,position:"relative",lineHeight:1,fontSize:L({size:u,sizes:e.fontSizes}),userSelect:"none",cursor:"pointer"}),Bq({variant:c,theme:e,color:a,gradient:l})),{"&:active":e.activeStyles,"&:disabled, &[data-disabled]":{borderColor:"transparent",backgroundColor:e.colorScheme==="dark"?e.colors.dark[4]:e.colors.gray[2],color:e.colorScheme==="dark"?e.colors.dark[6]:e.colors.gray[5],cursor:"not-allowed",backgroundImage:"none",pointerEvents:"none","&:active":{transform:"none"}},"&[data-loading]":{pointerEvents:"none","&::before":yd(go({content:'""'},e.fn.cover(j(-1))),{backgroundColor:e.colorScheme==="dark"?e.fn.rgba(e.colors.dark[7],.5):"rgba(255, 255, 255, .5)",borderRadius:e.fn.radius(t),cursor:"not-allowed"})}}),icon:{display:"flex",alignItems:"center"},leftIcon:{marginRight:e.spacing.xs},rightIcon:{marginLeft:e.spacing.xs},centerLoader:{position:"absolute",left:"50%",transform:"translateX(-50%)",opacity:.5},inner:{display:"flex",alignItems:"center",justifyContent:"center",height:"100%",overflow:"visible"},label:{whiteSpace:"nowrap",height:"100%",overflow:"hidden",display:"flex",alignItems:"center"}}));const Wq=Uq;var Hq=Object.defineProperty,Vf=Object.getOwnPropertySymbols,LT=Object.prototype.hasOwnProperty,zT=Object.prototype.propertyIsEnumerable,OS=(e,t,r)=>t in e?Hq(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,CS=(e,t)=>{for(var r in t||(t={}))LT.call(t,r)&&OS(e,r,t[r]);if(Vf)for(var r of Vf(t))zT.call(t,r)&&OS(e,r,t[r]);return e},qq=(e,t)=>{var r={};for(var n in e)LT.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&Vf)for(var n of Vf(e))t.indexOf(n)<0&&zT.call(e,n)&&(r[n]=e[n]);return r};const Gq={size:"sm",type:"button",variant:"filled",loaderPosition:"left"},lx=f.forwardRef((e,t)=>{const r=H("Button",Gq,e),{className:n,size:o,color:i,type:a,disabled:l,children:c,leftIcon:u,rightIcon:d,fullWidth:p,variant:h,radius:m,uppercase:g,compact:v,loading:_,loaderPosition:y,loaderProps:x,gradient:w,classNames:b,styles:C,unstyled:O}=r,P=qq(r,["className","size","color","type","disabled","children","leftIcon","rightIcon","fullWidth","variant","radius","uppercase","compact","loading","loaderPosition","loaderProps","gradient","classNames","styles","unstyled"]),{classes:E,cx:$,theme:k}=Wq({radius:m,color:i,fullWidth:p,compact:v,gradient:w,withLeftIcon:!!u,withRightIcon:!!d},{name:"Button",unstyled:O,classNames:b,styles:C,variant:h,size:o}),I=k.fn.variant({color:i,variant:h}),T=S.createElement(hn,CS({color:I.color,size:`calc(${L({size:o,sizes:ay}).height} / 2)`},x));return S.createElement(So,CS({className:$(E.root,n),type:a,disabled:l,"data-button":!0,"data-disabled":l||void 0,"data-loading":_||void 0,ref:t,unstyled:O},P),S.createElement("div",{className:E.inner},(u||_&&y==="left")&&S.createElement("span",{className:$(E.icon,E.leftIcon)},_&&y==="left"?T:u),_&&y==="center"&&S.createElement("span",{className:E.centerLoader},T),S.createElement("span",{className:E.label,style:{textTransform:g?"uppercase":void 0}},c),(d||_&&y==="right")&&S.createElement("span",{className:$(E.icon,E.rightIcon)},_&&y==="right"?T:d)))});lx.displayName="@mantine/core/Button";lx.Group=MT;const re=lx;var Qq=W((e,{radius:t,shadow:r})=>({root:{outline:0,WebkitTapHighlightColor:"transparent",display:"block",textDecoration:"none",color:e.colorScheme==="dark"?e.colors.dark[0]:e.black,backgroundColor:e.colorScheme==="dark"?e.colors.dark[7]:e.white,boxSizing:"border-box",borderRadius:e.fn.radius(t),boxShadow:e.shadows[r]||r||"none","&[data-with-border]":{border:`${j(1)} solid ${e.colorScheme==="dark"?e.colors.dark[4]:e.colors.gray[3]}`}}}));const Kq=Qq;var Yq=Object.defineProperty,Bf=Object.getOwnPropertySymbols,FT=Object.prototype.hasOwnProperty,VT=Object.prototype.propertyIsEnumerable,ES=(e,t,r)=>t in e?Yq(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Xq=(e,t)=>{for(var r in t||(t={}))FT.call(t,r)&&ES(e,r,t[r]);if(Bf)for(var r of Bf(t))VT.call(t,r)&&ES(e,r,t[r]);return e},Jq=(e,t)=>{var r={};for(var n in e)FT.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&Bf)for(var n of Bf(e))t.indexOf(n)<0&&VT.call(e,n)&&(r[n]=e[n]);return r};const Zq={},BT=f.forwardRef((e,t)=>{const r=H("Paper",Zq,e),{className:n,children:o,radius:i,withBorder:a,shadow:l,unstyled:c,variant:u}=r,d=Jq(r,["className","children","radius","withBorder","shadow","unstyled","variant"]),{classes:p,cx:h}=Kq({radius:i,shadow:l},{name:"Paper",unstyled:c,variant:u});return S.createElement(ie,Xq({className:h(p.root,n),"data-with-border":a||void 0,ref:t},d),o)});BT.displayName="@mantine/core/Paper";const un=BT;var eG=W((e,{inline:t})=>({root:{display:t?"inline-flex":"flex",alignItems:"center",justifyContent:"center"}}));const tG=eG;var rG=Object.defineProperty,Uf=Object.getOwnPropertySymbols,UT=Object.prototype.hasOwnProperty,WT=Object.prototype.propertyIsEnumerable,$S=(e,t,r)=>t in e?rG(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,nG=(e,t)=>{for(var r in t||(t={}))UT.call(t,r)&&$S(e,r,t[r]);if(Uf)for(var r of Uf(t))WT.call(t,r)&&$S(e,r,t[r]);return e},oG=(e,t)=>{var r={};for(var n in e)UT.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&Uf)for(var n of Uf(e))t.indexOf(n)<0&&WT.call(e,n)&&(r[n]=e[n]);return r};const HT=f.forwardRef((e,t)=>{const r=H("Center",{},e),{inline:n,className:o,unstyled:i,variant:a}=r,l=oG(r,["inline","className","unstyled","variant"]),{classes:c,cx:u}=tG({inline:n},{name:"Center",unstyled:i,variant:a});return S.createElement(ie,nG({ref:t,className:u(c.root,o)},l))});HT.displayName="@mantine/core/Center";const or=HT,qT=f.createContext(null),iG=qT.Provider,aG=()=>f.useContext(qT);var sG=Object.defineProperty,Wf=Object.getOwnPropertySymbols,GT=Object.prototype.hasOwnProperty,QT=Object.prototype.propertyIsEnumerable,kS=(e,t,r)=>t in e?sG(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,RS=(e,t)=>{for(var r in t||(t={}))GT.call(t,r)&&kS(e,r,t[r]);if(Wf)for(var r of Wf(t))QT.call(t,r)&&kS(e,r,t[r]);return e},lG=(e,t)=>{var r={};for(var n in e)GT.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&Wf)for(var n of Wf(e))t.indexOf(n)<0&&QT.call(e,n)&&(r[n]=e[n]);return r};const cG={size:"sm"},KT=f.forwardRef((e,t)=>{const r=H("CheckboxGroup",cG,e),{children:n,value:o,defaultValue:i,onChange:a,size:l,wrapperProps:c}=r,u=lG(r,["children","value","defaultValue","onChange","size","wrapperProps"]),[d,p]=Tr({value:o,defaultValue:i,finalValue:[],onChange:a}),h=m=>{const g=m.currentTarget.value;p(d.includes(g)?d.filter(v=>v!==g):[...d,g])};return S.createElement(iG,{value:{value:d,onChange:h,size:l}},S.createElement(Ut.Wrapper,RS(RS({labelElement:"div",size:l,__staticSelector:"CheckboxGroup",ref:t},c),u),n))});KT.displayName="@mantine/core/CheckboxGroup";var uG=Object.defineProperty,Hf=Object.getOwnPropertySymbols,YT=Object.prototype.hasOwnProperty,XT=Object.prototype.propertyIsEnumerable,TS=(e,t,r)=>t in e?uG(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,qf=(e,t)=>{for(var r in t||(t={}))YT.call(t,r)&&TS(e,r,t[r]);if(Hf)for(var r of Hf(t))XT.call(t,r)&&TS(e,r,t[r]);return e},JT=(e,t)=>{var r={};for(var n in e)YT.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&Hf)for(var n of Hf(e))t.indexOf(n)<0&&XT.call(e,n)&&(r[n]=e[n]);return r};function ZT(e){const t=e,{width:r,height:n,style:o}=t,i=JT(t,["width","height","style"]);return S.createElement("svg",qf({viewBox:"0 0 10 7",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:qf({width:r,height:n},o)},i),S.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 eI(e){var t=e,{indeterminate:r}=t,n=JT(t,["indeterminate"]);return r?S.createElement("svg",qf({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 32 6"},n),S.createElement("rect",{width:"32",height:"6",fill:"currentColor",rx:"3"})):S.createElement(ZT,qf({},n))}var dG=Object.defineProperty,fG=Object.defineProperties,pG=Object.getOwnPropertyDescriptors,IS=Object.getOwnPropertySymbols,hG=Object.prototype.hasOwnProperty,mG=Object.prototype.propertyIsEnumerable,DS=(e,t,r)=>t in e?dG(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,NS=(e,t)=>{for(var r in t||(t={}))hG.call(t,r)&&DS(e,r,t[r]);if(IS)for(var r of IS(t))mG.call(t,r)&&DS(e,r,t[r]);return e},AS=(e,t)=>fG(e,pG(t));const gG={xs:j(16),sm:j(20),md:j(24),lg:j(30),xl:j(36)};var vG=W((e,{radius:t,color:r,transitionDuration:n,labelPosition:o,error:i,indeterminate:a},{size:l})=>{const c=L({size:l,sizes:gG}),u=e.fn.variant({variant:"filled",color:r});return{icon:AS(NS({},e.fn.cover()),{ref:Vt("icon"),color:a?"inherit":e.white,transform:a?"none":`translateY(${j(5)}) scale(0.5)`,opacity:a?1:0,transitionProperty:"opacity, transform",transitionTimingFunction:"ease",transitionDuration:`${n}ms`,pointerEvents:"none",width:"60%",position:"absolute",zIndex:1,margin:"auto","@media (prefers-reduced-motion)":{transitionDuration:e.respectReducedMotion?"0ms":void 0}}),inner:{position:"relative",width:c,height:c,order:o==="left"?2:1},input:AS(NS({},e.fn.focusStyles()),{appearance:"none",backgroundColor:e.colorScheme==="dark"?e.colors.dark[6]:e.white,border:`${j(1)} solid ${i?e.fn.variant({variant:"filled",color:"red"}).background:e.colorScheme==="dark"?e.colors.dark[4]:e.colors.gray[4]}`,width:c,height:c,borderRadius:e.fn.radius(t),padding:0,display:"block",margin:0,transition:`border-color ${n}ms ease, background-color ${n}ms ease`,cursor:e.cursorType,"&:checked":{backgroundColor:u.background,borderColor:u.background,[`& + .${Vt("icon")}`]:{opacity:1,color:e.white,transform:"translateY(0) scale(1)"}},"&:disabled":{backgroundColor:e.colorScheme==="dark"?e.colors.dark[4]:e.colors.gray[2],borderColor:e.colorScheme==="dark"?e.colors.dark[6]:e.colors.gray[3],cursor:"not-allowed",pointerEvents:"none",[`& + .${Vt("icon")}`]:{color:e.colorScheme==="dark"?e.colors.dark[6]:e.colors.gray[5]}}})}});const yG=vG;var xG=Object.defineProperty,wG=Object.defineProperties,bG=Object.getOwnPropertyDescriptors,MS=Object.getOwnPropertySymbols,_G=Object.prototype.hasOwnProperty,SG=Object.prototype.propertyIsEnumerable,LS=(e,t,r)=>t in e?xG(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,PG=(e,t)=>{for(var r in t||(t={}))_G.call(t,r)&&LS(e,r,t[r]);if(MS)for(var r of MS(t))SG.call(t,r)&&LS(e,r,t[r]);return e},jG=(e,t)=>wG(e,bG(t));const jg={xs:j(16),sm:j(20),md:j(24),lg:j(30),xl:j(36)};var OG=W((e,{labelPosition:t},{size:r})=>({root:{},body:{display:"flex","&:has(input:disabled) label":{color:e.colorScheme==="dark"?e.colors.dark[3]:e.colors.gray[5]}},labelWrapper:jG(PG({},e.fn.fontStyles()),{display:"inline-flex",flexDirection:"column",WebkitTapHighlightColor:"transparent",fontSize:r in jg?L({size:r,sizes:e.fontSizes}):void 0,lineHeight:r in jg?L({size:r,sizes:jg}):void 0,color:e.colorScheme==="dark"?e.colors.dark[0]:e.black,cursor:e.cursorType,order:t==="left"?1:2}),description:{marginTop:`calc(${e.spacing.xs} / 2)`,[t==="left"?"paddingRight":"paddingLeft"]:e.spacing.sm},error:{marginTop:`calc(${e.spacing.xs} / 2)`,[t==="left"?"paddingRight":"paddingLeft"]:e.spacing.sm},label:{cursor:e.cursorType,[t==="left"?"paddingRight":"paddingLeft"]:e.spacing.sm,"&:disabled, &[data-disabled]":{color:e.colorScheme==="dark"?e.colors.dark[3]:e.colors.gray[5]}}}));const CG=OG;var EG=Object.defineProperty,Gf=Object.getOwnPropertySymbols,tI=Object.prototype.hasOwnProperty,rI=Object.prototype.propertyIsEnumerable,zS=(e,t,r)=>t in e?EG(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,$G=(e,t)=>{for(var r in t||(t={}))tI.call(t,r)&&zS(e,r,t[r]);if(Gf)for(var r of Gf(t))rI.call(t,r)&&zS(e,r,t[r]);return e},kG=(e,t)=>{var r={};for(var n in e)tI.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&Gf)for(var n of Gf(e))t.indexOf(n)<0&&rI.call(e,n)&&(r[n]=e[n]);return r};const sm=f.forwardRef((e,t)=>{var r=e,{__staticSelector:n,className:o,classNames:i,styles:a,unstyled:l,children:c,label:u,description:d,id:p,disabled:h,error:m,size:g,labelPosition:v,variant:_}=r,y=kG(r,["__staticSelector","className","classNames","styles","unstyled","children","label","description","id","disabled","error","size","labelPosition","variant"]);const{classes:x,cx:w}=CG({labelPosition:v},{name:n,styles:a,classNames:i,unstyled:l,variant:_,size:g});return S.createElement(ie,$G({className:w(x.root,o),ref:t},y),S.createElement("div",{className:w(x.body)},c,S.createElement("div",{className:x.labelWrapper},u!=null&&S.createElement("label",{className:x.label,"data-disabled":h||void 0,htmlFor:p},u),d&&S.createElement(Ut.Description,{className:x.description},d),m&&m!=="boolean"&&S.createElement(Ut.Error,{className:x.error},m))))});sm.displayName="@mantine/core/InlineInput";var RG=Object.defineProperty,Qf=Object.getOwnPropertySymbols,nI=Object.prototype.hasOwnProperty,oI=Object.prototype.propertyIsEnumerable,FS=(e,t,r)=>t in e?RG(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Nu=(e,t)=>{for(var r in t||(t={}))nI.call(t,r)&&FS(e,r,t[r]);if(Qf)for(var r of Qf(t))oI.call(t,r)&&FS(e,r,t[r]);return e},TG=(e,t)=>{var r={};for(var n in e)nI.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&Qf)for(var n of Qf(e))t.indexOf(n)<0&&oI.call(e,n)&&(r[n]=e[n]);return r};const IG={size:"sm",transitionDuration:100,icon:eI,labelPosition:"right"},kn=f.forwardRef((e,t)=>{const r=H("Checkbox",IG,e),{className:n,style:o,sx:i,checked:a,disabled:l,color:c,label:u,indeterminate:d,id:p,size:h,radius:m,wrapperProps:g,children:v,classNames:_,styles:y,transitionDuration:x,icon:w,unstyled:b,labelPosition:C,description:O,error:P,variant:E}=r,$=TG(r,["className","style","sx","checked","disabled","color","label","indeterminate","id","size","radius","wrapperProps","children","classNames","styles","transitionDuration","icon","unstyled","labelPosition","description","error","variant"]),k=aG(),I=Nr(p),{systemStyles:T,rest:N}=oo($),{classes:A}=yG({radius:m,color:c,transitionDuration:x,labelPosition:C,error:!!P,indeterminate:d},{name:"Checkbox",classNames:_,styles:y,unstyled:b,variant:E,size:(k==null?void 0:k.size)||h}),z=k?{checked:k.value.includes(N.value),onChange:k.onChange}:{};return S.createElement(sm,Nu(Nu({className:n,sx:i,style:o,id:I,size:(k==null?void 0:k.size)||h,labelPosition:C,label:u,description:O,error:P,disabled:l,__staticSelector:"Checkbox",classNames:_,styles:y,unstyled:b,"data-checked":z.checked||void 0,variant:E},T),g),S.createElement("div",{className:A.inner},S.createElement("input",Nu(Nu({id:I,ref:t,type:"checkbox",className:A.input,checked:a,disabled:l},N),z)),S.createElement(w,{indeterminate:d,className:A.icon})))});kn.displayName="@mantine/core/Checkbox";kn.Group=KT;const iI=f.createContext(null),DG=iI.Provider,NG=()=>f.useContext(iI),AG={};function aI(e){const{value:t,defaultValue:r,onChange:n,multiple:o,children:i}=H("ChipGroup",AG,e),[a,l]=Tr({value:t,defaultValue:r,finalValue:o?[]:null,onChange:n}),c=d=>Array.isArray(a)?a.includes(d):d===a,u=d=>{const p=d.currentTarget.value;Array.isArray(a)?l(a.includes(p)?a.filter(h=>h!==p):[...a,p]):l(p)};return S.createElement(DG,{value:{isChipSelected:c,onChange:u,multiple:o}},i)}aI.displayName="@mantine/core/ChipGroup";var MG=Object.defineProperty,LG=Object.defineProperties,zG=Object.getOwnPropertyDescriptors,VS=Object.getOwnPropertySymbols,FG=Object.prototype.hasOwnProperty,VG=Object.prototype.propertyIsEnumerable,BS=(e,t,r)=>t in e?MG(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Pn=(e,t)=>{for(var r in t||(t={}))FG.call(t,r)&&BS(e,r,t[r]);if(VS)for(var r of VS(t))VG.call(t,r)&&BS(e,r,t[r]);return e},Pl=(e,t)=>LG(e,zG(t));const US={xs:j(24),sm:j(28),md:j(32),lg:j(36),xl:j(40)},il={xs:j(10),sm:j(12),md:j(14),lg:j(16),xl:j(18)},WS={xs:j(16),sm:j(20),md:j(24),lg:j(28),xl:j(32)},Au={xs:j(7.5),sm:j(10),md:j(11.5),lg:j(13),xl:j(15)};function BG(e,{color:t},r){const n=e.fn.variant({variant:"filled",color:t}),o=e.fn.variant({variant:"light",color:t});return r==="light"?{label:Pn({backgroundColor:e.colorScheme==="dark"?e.colors.dark[6]:e.colors.gray[1]},e.fn.hover({backgroundColor:e.colorScheme==="dark"?e.colors.dark[5]:e.colors.gray[0]})),checked:Pl(Pn({color:o.color,backgroundColor:o.background},e.fn.hover({backgroundColor:o.hover})),{"&, &:hover":{backgroundColor:e.fn.variant({variant:"light",color:t}).background}})}:r==="filled"?{label:Pn({backgroundColor:e.colorScheme==="dark"?e.colors.dark[6]:e.colors.gray[1]},e.fn.hover({backgroundColor:e.colorScheme==="dark"?e.colors.dark[5]:e.colors.gray[0]})),checked:Pn({color:n.color,backgroundColor:n.background},e.fn.hover({backgroundColor:n.hover}))}:r==="outline"?{label:Pn({backgroundColor:e.colorScheme==="dark"?e.colors.dark[6]:e.white,borderColor:e.colorScheme==="dark"?e.colors.dark[4]:e.colors.gray[4]},e.fn.hover({backgroundColor:e.colorScheme==="dark"?e.colors.dark[5]:e.colors.gray[0]})),checked:{border:`${j(1)} solid ${n.background}`}}:{label:null,checked:null}}var UG=W((e,{radius:t,color:r},{size:n,variant:o})=>{const i=BG(e,{color:r},o);return{root:{},label:Pl(Pn(Pl(Pn({ref:Vt("label")},e.fn.fontStyles()),{boxSizing:"border-box",color:e.colorScheme==="dark"?e.colors.dark[0]:e.black,display:"inline-flex",alignItems:"center",userSelect:"none",border:`${j(1)} solid transparent`,borderRadius:e.fn.radius(t),height:L({size:n,sizes:US}),fontSize:L({size:n,sizes:e.fontSizes}),lineHeight:`calc(${L({size:n,sizes:US})} - ${j(2)})`,paddingLeft:L({size:n,sizes:WS}),paddingRight:L({size:n,sizes:WS}),cursor:"pointer",whiteSpace:"nowrap",transition:"background-color 100ms ease",WebkitTapHighlightColor:"transparent"}),i.label),{"&[data-disabled]":Pl(Pn({backgroundColor:e.colorScheme==="dark"?e.colors.dark[5]:e.colors.gray[1],borderColor:e.colorScheme==="dark"?e.colors.dark[5]:e.colors.gray[1],color:e.colorScheme==="dark"?e.colors.dark[3]:e.colors.gray[5],cursor:"not-allowed",pointerEvents:"none"},e.fn.hover({backgroundColor:e.colorScheme==="dark"?e.colors.dark[5]:e.colors.gray[1]})),{[`& .${Vt("iconWrapper")}`]:{color:e.colorScheme==="dark"?e.colors.dark[3]:e.colors.gray[5]}}),"&[data-checked]":{paddingLeft:L({size:n,sizes:Au}),paddingRight:L({size:n,sizes:Au}),"&:not([data-disabled])":i.checked}}),iconWrapper:{ref:Vt("iconWrapper"),color:o==="filled"?e.white:e.fn.variant({variant:"filled",color:r}).background,width:`calc(${L({size:n,sizes:il})} + (${L({size:n,sizes:e.spacing})} / 1.5))`,maxWidth:`calc(${L({size:n,sizes:il})} + (${L({size:n,sizes:e.spacing})} / 1.5))`,height:L({size:n,sizes:il}),display:"inline-block",verticalAlign:"middle",overflow:"hidden"},checkIcon:{width:L({size:n,sizes:il}),height:`calc(${L({size:n,sizes:il})} / 1.1)`,display:"block"},input:{width:0,height:0,padding:0,opacity:0,margin:0,"&:disabled + label":Pl(Pn({backgroundColor:e.colorScheme==="dark"?e.colors.dark[5]:e.colors.gray[1],borderColor:e.colorScheme==="dark"?e.colors.dark[5]:e.colors.gray[1],color:e.colorScheme==="dark"?e.colors.dark[3]:e.colors.gray[5],cursor:"not-allowed",pointerEvents:"none"},e.fn.hover({backgroundColor:e.colorScheme==="dark"?e.colors.dark[5]:e.colors.gray[1]})),{[`& .${Vt("iconWrapper")}`]:{color:e.colorScheme==="dark"?e.colors.dark[3]:e.colors.gray[5]},"&[data-checked]":{paddingLeft:L({size:n,sizes:Au}),paddingRight:L({size:n,sizes:Au}),"&:not([data-disabled])":{backgroundColor:e.colorScheme==="dark"?e.colors.dark[5]:e.colors.gray[1],borderColor:e.colorScheme==="dark"?e.colors.dark[5]:e.colors.gray[1],color:e.colorScheme==="dark"?e.colors.dark[3]:e.colors.gray[5]}}}),"&:focus":{outline:"none",[`& + .${Vt("label")}`]:Pn({},e.focusRing==="always"||e.focusRing==="auto"?e.focusRingStyles.styles(e):e.focusRingStyles.resetStyles(e)),"&:focus:not(:focus-visible)":{[`& + .${Vt("label")}`]:Pn({},e.focusRing==="auto"||e.focusRing==="never"?e.focusRingStyles.resetStyles(e):null)}}}}});const WG=UG;var HG=Object.defineProperty,Kf=Object.getOwnPropertySymbols,sI=Object.prototype.hasOwnProperty,lI=Object.prototype.propertyIsEnumerable,HS=(e,t,r)=>t in e?HG(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Mu=(e,t)=>{for(var r in t||(t={}))sI.call(t,r)&&HS(e,r,t[r]);if(Kf)for(var r of Kf(t))lI.call(t,r)&&HS(e,r,t[r]);return e},qG=(e,t)=>{var r={};for(var n in e)sI.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&Kf)for(var n of Kf(e))t.indexOf(n)<0&&lI.call(e,n)&&(r[n]=e[n]);return r};const GG={type:"checkbox",size:"sm",radius:"xl",variant:"outline"},Yf=f.forwardRef((e,t)=>{const r=H("Chip",GG,e),{radius:n,type:o,size:i,variant:a,disabled:l,id:c,color:u,children:d,className:p,classNames:h,style:m,styles:g,checked:v,defaultChecked:_,onChange:y,sx:x,wrapperProps:w,value:b,unstyled:C}=r,O=qG(r,["radius","type","size","variant","disabled","id","color","children","className","classNames","style","styles","checked","defaultChecked","onChange","sx","wrapperProps","value","unstyled"]),P=NG(),E=Nr(c),{systemStyles:$,rest:k}=oo(O),{classes:I,cx:T}=WG({radius:n,color:u},{classNames:h,styles:g,unstyled:C,name:"Chip",variant:a,size:i}),[N,A]=Tr({value:v,defaultValue:_,finalValue:!1,onChange:y}),z=P?{checked:P.isChipSelected(b),onChange:P.onChange,type:P.multiple?"checkbox":"radio"}:{},G=z.checked||N;return S.createElement(ie,Mu(Mu({className:T(I.root,p),style:m,sx:x},$),w),S.createElement("input",Mu(Mu({type:o,className:I.input,checked:G,onChange:X=>A(X.currentTarget.checked),id:E,disabled:l,ref:t,value:b},z),k)),S.createElement("label",{htmlFor:E,"data-checked":G||void 0,"data-disabled":l||void 0,className:I.label},G&&S.createElement("span",{className:I.iconWrapper},S.createElement(ZT,{className:I.checkIcon})),d))});Yf.displayName="@mantine/core/Chip";Yf.Group=aI;var QG=W((e,{fluid:t,sizes:r},{size:n})=>({root:{paddingLeft:e.spacing.md,paddingRight:e.spacing.md,maxWidth:t?"100%":L({size:n,sizes:r}),marginLeft:"auto",marginRight:"auto"}}));const KG=QG;var YG=Object.defineProperty,Xf=Object.getOwnPropertySymbols,cI=Object.prototype.hasOwnProperty,uI=Object.prototype.propertyIsEnumerable,qS=(e,t,r)=>t in e?YG(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,XG=(e,t)=>{for(var r in t||(t={}))cI.call(t,r)&&qS(e,r,t[r]);if(Xf)for(var r of Xf(t))uI.call(t,r)&&qS(e,r,t[r]);return e},JG=(e,t)=>{var r={};for(var n in e)cI.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&Xf)for(var n of Xf(e))t.indexOf(n)<0&&uI.call(e,n)&&(r[n]=e[n]);return r};const ZG={sizes:{xs:j(540),sm:j(720),md:j(960),lg:j(1140),xl:j(1320)}},dI=f.forwardRef((e,t)=>{const r=H("Container",ZG,e),{className:n,fluid:o,size:i,unstyled:a,sizes:l,variant:c}=r,u=JG(r,["className","fluid","size","unstyled","sizes","variant"]),{classes:d,cx:p}=KG({fluid:o,sizes:l},{unstyled:a,name:"Container",variant:c,size:i});return S.createElement(ie,XG({className:p(d.root,n),ref:t},u))});dI.displayName="@mantine/core/Container";var eQ=Object.defineProperty,Jf=Object.getOwnPropertySymbols,fI=Object.prototype.hasOwnProperty,pI=Object.prototype.propertyIsEnumerable,GS=(e,t,r)=>t in e?eQ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,tQ=(e,t)=>{for(var r in t||(t={}))fI.call(t,r)&&GS(e,r,t[r]);if(Jf)for(var r of Jf(t))pI.call(t,r)&&GS(e,r,t[r]);return e},rQ=(e,t)=>{var r={};for(var n in e)fI.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&Jf)for(var n of Jf(e))t.indexOf(n)<0&&pI.call(e,n)&&(r[n]=e[n]);return r};const nQ={timeout:1e3};function hI(e){const t=H("CopyButton",nQ,e),{children:r,timeout:n,value:o}=t,i=rQ(t,["children","timeout","value"]),a=V6({timeout:n}),l=()=>a.copy(o);return S.createElement(S.Fragment,null,r(tQ({copy:l,copied:a.copied},i)))}hI.displayName="@mantine/core/CopyButton";const[oQ,zs]=Do("ModalBase component was not found in tree");var iQ=W(()=>({close:{marginLeft:"auto",marginRight:0}}));const aQ=iQ;var sQ=Object.defineProperty,Zf=Object.getOwnPropertySymbols,mI=Object.prototype.hasOwnProperty,gI=Object.prototype.propertyIsEnumerable,QS=(e,t,r)=>t in e?sQ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,lQ=(e,t)=>{for(var r in t||(t={}))mI.call(t,r)&&QS(e,r,t[r]);if(Zf)for(var r of Zf(t))gI.call(t,r)&&QS(e,r,t[r]);return e},cQ=(e,t)=>{var r={};for(var n in e)mI.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&Zf)for(var n of Zf(e))t.indexOf(n)<0&&gI.call(e,n)&&(r[n]=e[n]);return r};const uQ={size:"sm"},dQ=f.forwardRef((e,t)=>{const r=zs(),n=H(`${r.__staticSelector}CloseButton`,uQ,e),{className:o}=n,i=cQ(n,["className"]),{classes:a,cx:l}=aQ(null,r.stylesApi);return S.createElement(Ec,lQ({className:l(a.close,o),ref:t,onClick:r.onClose},i))});var fQ=W(()=>({overlay:{}}));const pQ=fQ;var hQ=Object.defineProperty,mQ=Object.defineProperties,gQ=Object.getOwnPropertyDescriptors,KS=Object.getOwnPropertySymbols,vQ=Object.prototype.hasOwnProperty,yQ=Object.prototype.propertyIsEnumerable,YS=(e,t,r)=>t in e?hQ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,xQ=(e,t)=>{for(var r in t||(t={}))vQ.call(t,r)&&YS(e,r,t[r]);if(KS)for(var r of KS(t))yQ.call(t,r)&&YS(e,r,t[r]);return e},wQ=(e,t)=>mQ(e,gQ(t)),bQ=W((e,{color:t,opacity:r,blur:n,radius:o,gradient:i,fixed:a,zIndex:l})=>({root:wQ(xQ({},e.fn.cover(0)),{position:a?"fixed":"absolute",backgroundColor:i?void 0:e.fn.rgba(t,r),backgroundImage:i,backdropFilter:n?`blur(${j(n)})`:void 0,borderRadius:e.fn.radius(o),zIndex:l,"&[data-center]":{display:"flex",alignItems:"center",justifyContent:"center"}})}));const _Q=bQ;var SQ=Object.defineProperty,ep=Object.getOwnPropertySymbols,vI=Object.prototype.hasOwnProperty,yI=Object.prototype.propertyIsEnumerable,XS=(e,t,r)=>t in e?SQ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,PQ=(e,t)=>{for(var r in t||(t={}))vI.call(t,r)&&XS(e,r,t[r]);if(ep)for(var r of ep(t))yI.call(t,r)&&XS(e,r,t[r]);return e},jQ=(e,t)=>{var r={};for(var n in e)vI.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&ep)for(var n of ep(e))t.indexOf(n)<0&&yI.call(e,n)&&(r[n]=e[n]);return r};const OQ={opacity:.6,color:"#000",zIndex:Tn("modal"),radius:0},xI=f.forwardRef((e,t)=>{const r=H("Overlay",OQ,e),{variant:n,opacity:o,color:i,blur:a,gradient:l,zIndex:c,radius:u,children:d,className:p,classNames:h,styles:m,unstyled:g,center:v,fixed:_}=r,y=jQ(r,["variant","opacity","color","blur","gradient","zIndex","radius","children","className","classNames","styles","unstyled","center","fixed"]),{classes:x,cx:w}=_Q({color:i,opacity:o,blur:a,radius:u,gradient:l,fixed:_,zIndex:c},{name:"Overlay",classNames:h,styles:m,unstyled:g,variant:n});return S.createElement(ie,PQ({ref:t,className:w(x.root,p),"data-center":v||void 0},y),d)});xI.displayName="@mantine/core/Overlay";const wI=xI;var CQ=Object.defineProperty,EQ=Object.defineProperties,$Q=Object.getOwnPropertyDescriptors,tp=Object.getOwnPropertySymbols,bI=Object.prototype.hasOwnProperty,_I=Object.prototype.propertyIsEnumerable,JS=(e,t,r)=>t in e?CQ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,al=(e,t)=>{for(var r in t||(t={}))bI.call(t,r)&&JS(e,r,t[r]);if(tp)for(var r of tp(t))_I.call(t,r)&&JS(e,r,t[r]);return e},kQ=(e,t)=>EQ(e,$Q(t)),RQ=(e,t)=>{var r={};for(var n in e)bI.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&tp)for(var n of tp(e))t.indexOf(n)<0&&_I.call(e,n)&&(r[n]=e[n]);return r};const TQ={},IQ=f.forwardRef((e,t)=>{const r=zs(),n=H(`${r.__staticSelector}Overlay`,TQ,e),{onClick:o,transitionProps:i,style:a,className:l}=n,c=RQ(n,["onClick","transitionProps","style","className"]),{classes:u,cx:d}=pQ(null,r.stylesApi),p=h=>{o==null||o(h),r.closeOnClickOutside&&r.onClose()};return S.createElement(va,kQ(al(al({mounted:r.opened},r.transitionProps),i),{transition:"fade"}),h=>S.createElement(wI,al({ref:t,onClick:p,fixed:!0,style:al(al({},a),h),className:d(u.overlay,l),zIndex:r.zIndex},c)))});var DQ=W((e,{zIndex:t})=>({inner:{position:"fixed",width:"100%",top:0,bottom:0,maxHeight:"100%",zIndex:t,pointerEvents:"none"},content:{pointerEvents:"all"}}));const NQ=DQ;var AQ=Object.defineProperty,rp=Object.getOwnPropertySymbols,SI=Object.prototype.hasOwnProperty,PI=Object.prototype.propertyIsEnumerable,ZS=(e,t,r)=>t in e?AQ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,sl=(e,t)=>{for(var r in t||(t={}))SI.call(t,r)&&ZS(e,r,t[r]);if(rp)for(var r of rp(t))PI.call(t,r)&&ZS(e,r,t[r]);return e},MQ=(e,t)=>{var r={};for(var n in e)SI.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&rp)for(var n of rp(e))t.indexOf(n)<0&&PI.call(e,n)&&(r[n]=e[n]);return r};const LQ={},zQ=f.forwardRef((e,t)=>{const r=zs(),n=H(`${r.__staticSelector}Content`,LQ,e),{className:o,transitionProps:i,style:a,onKeyDown:l}=n,c=MQ(n,["className","transitionProps","style","onKeyDown"]),{classes:u,cx:d}=NQ({zIndex:r.zIndex},r.stylesApi),p=h=>{var m;((m=h.target)==null?void 0:m.getAttribute("data-mantine-stop-propagation"))!=="true"&&h.key==="Escape"&&r.closeOnEscape&&r.onClose(),l==null||l(h)};return S.createElement(va,sl(sl({mounted:r.opened,transition:"pop"},r.transitionProps),i),h=>S.createElement("div",{className:d(u.inner)},S.createElement(rx,{active:r.opened&&r.trapFocus},S.createElement(un,sl({component:"section",role:"dialog",tabIndex:-1,"aria-modal":!0,"aria-describedby":r.bodyMounted?r.getBodyId():void 0,"aria-labelledby":r.titleMounted?r.getTitleId():void 0,onKeyDown:p,ref:t,className:d(u.content,o),style:sl(sl({},a),h),shadow:r.shadow},c),c.children))))});var FQ=W((e,{padding:t})=>{const r=L({size:t,sizes:e.spacing});return{header:{display:"flex",justifyContent:"space-between",alignItems:"center",padding:r,paddingRight:`calc(${r} - ${j(5)})`,position:"sticky",top:0,backgroundColor:e.colorScheme==="dark"?e.colors.dark[7]:e.white,zIndex:1e3}}});const VQ=FQ;var BQ=Object.defineProperty,np=Object.getOwnPropertySymbols,jI=Object.prototype.hasOwnProperty,OI=Object.prototype.propertyIsEnumerable,eP=(e,t,r)=>t in e?BQ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,UQ=(e,t)=>{for(var r in t||(t={}))jI.call(t,r)&&eP(e,r,t[r]);if(np)for(var r of np(t))OI.call(t,r)&&eP(e,r,t[r]);return e},WQ=(e,t)=>{var r={};for(var n in e)jI.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&np)for(var n of np(e))t.indexOf(n)<0&&OI.call(e,n)&&(r[n]=e[n]);return r};const HQ={},qQ=f.forwardRef((e,t)=>{const r=zs(),n=H(`${r.__staticSelector}Header`,HQ,e),{className:o}=n,i=WQ(n,["className"]),{classes:a,cx:l}=VQ({padding:r.padding},r.stylesApi);return S.createElement(ie,UQ({ref:t,className:l(a.header,o)},i))});var GQ=W(e=>({title:{lineHeight:1,padding:0,margin:0,fontWeight:400,fontSize:e.fontSizes.md}}));const QQ=GQ;var KQ=Object.defineProperty,op=Object.getOwnPropertySymbols,CI=Object.prototype.hasOwnProperty,EI=Object.prototype.propertyIsEnumerable,tP=(e,t,r)=>t in e?KQ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,YQ=(e,t)=>{for(var r in t||(t={}))CI.call(t,r)&&tP(e,r,t[r]);if(op)for(var r of op(t))EI.call(t,r)&&tP(e,r,t[r]);return e},XQ=(e,t)=>{var r={};for(var n in e)CI.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&op)for(var n of op(e))t.indexOf(n)<0&&EI.call(e,n)&&(r[n]=e[n]);return r};const JQ={},ZQ=f.forwardRef((e,t)=>{const r=zs(),n=H(`${r.__staticSelector}Title`,JQ,e),{className:o}=n,i=XQ(n,["className"]),{classes:a,cx:l}=QQ(null,r.stylesApi);return f.useEffect(()=>(r.setTitleMounted(!0),()=>r.setTitleMounted(!1)),[]),S.createElement(ie,YQ({component:"h2",id:r.getTitleId(),className:l(a.title,o),ref:t},i))});var eK=W((e,{padding:t})=>({body:{padding:L({size:t,sizes:e.spacing}),"&:not(:only-child)":{paddingTop:0}}}));const tK=eK;var rK=Object.defineProperty,ip=Object.getOwnPropertySymbols,$I=Object.prototype.hasOwnProperty,kI=Object.prototype.propertyIsEnumerable,rP=(e,t,r)=>t in e?rK(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,nK=(e,t)=>{for(var r in t||(t={}))$I.call(t,r)&&rP(e,r,t[r]);if(ip)for(var r of ip(t))kI.call(t,r)&&rP(e,r,t[r]);return e},oK=(e,t)=>{var r={};for(var n in e)$I.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&ip)for(var n of ip(e))t.indexOf(n)<0&&kI.call(e,n)&&(r[n]=e[n]);return r};const iK={},aK=f.forwardRef((e,t)=>{const r=zs(),n=H(`${r.__staticSelector}Body`,iK,e),{className:o}=n,i=oK(n,["className"]),{classes:a,cx:l}=tK({padding:r.padding},r.stylesApi);return f.useEffect(()=>(r.setBodyMounted(!0),()=>r.setBodyMounted(!1)),[]),S.createElement(ie,nK({id:r.getBodyId(),className:l(a.body,o),ref:t},i))});function sK({children:e}){return S.createElement(S.Fragment,null,e)}function lK({opened:e,transitionDuration:t}){const[r,n]=f.useState(e),o=f.useRef(),a=zh()?0:t;return f.useEffect(()=>(e?(n(!0),window.clearTimeout(o.current)):a===0?n(!1):o.current=window.setTimeout(()=>n(!1),a),()=>window.clearTimeout(o.current)),[e,a]),r}var cK=W(()=>({root:{}}));const uK=cK;var dK=Object.defineProperty,fK=Object.defineProperties,pK=Object.getOwnPropertyDescriptors,ap=Object.getOwnPropertySymbols,RI=Object.prototype.hasOwnProperty,TI=Object.prototype.propertyIsEnumerable,nP=(e,t,r)=>t in e?dK(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Og=(e,t)=>{for(var r in t||(t={}))RI.call(t,r)&&nP(e,r,t[r]);if(ap)for(var r of ap(t))TI.call(t,r)&&nP(e,r,t[r]);return e},oP=(e,t)=>fK(e,pK(t)),hK=(e,t)=>{var r={};for(var n in e)RI.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&ap)for(var n of ap(e))t.indexOf(n)<0&&TI.call(e,n)&&(r[n]=e[n]);return r};const cx={closeOnClickOutside:!0,withinPortal:!0,lockScroll:!0,trapFocus:!0,returnFocus:!0,closeOnEscape:!0,keepMounted:!1,zIndex:Tn("modal"),padding:"md",size:"md",shadow:"xl"};function kt(e){const t=H("ModalBase",cx,e),{opened:r,onClose:n,children:o,closeOnClickOutside:i,__staticSelector:a,transitionProps:l,withinPortal:c,portalProps:u,keepMounted:d,target:p,zIndex:h,lockScroll:m,trapFocus:g,closeOnEscape:v,returnFocus:_,padding:y,shadow:x,id:w,size:b,variant:C,classNames:O,unstyled:P,styles:E,className:$}=t,k=hK(t,["opened","onClose","children","closeOnClickOutside","__staticSelector","transitionProps","withinPortal","portalProps","keepMounted","target","zIndex","lockScroll","trapFocus","closeOnEscape","returnFocus","padding","shadow","id","size","variant","classNames","unstyled","styles","className"]),{classes:I,cx:T}=uK(null,{name:a,classNames:O,styles:E,unstyled:P,variant:C,size:b}),N=Nr(w),[A,z]=f.useState(!1),[G,X]=f.useState(!1),R=typeof(l==null?void 0:l.duration)=="number"?l==null?void 0:l.duration:200,M=lK({opened:r,transitionDuration:R});return iv("keydown",V=>{!g&&V.key==="Escape"&&v&&n()}),GE({opened:r,shouldReturnFocus:g&&_}),S.createElement(Ms,oP(Og({},u),{withinPortal:c,target:p}),S.createElement(oQ,{value:{__staticSelector:a,opened:r,onClose:n,closeOnClickOutside:i,transitionProps:oP(Og({},l),{duration:R,keepMounted:d}),zIndex:h,padding:y,id:N,getTitleId:()=>`${N}-title`,getBodyId:()=>`${N}-body`,titleMounted:A,bodyMounted:G,setTitleMounted:z,setBodyMounted:X,trapFocus:g,closeOnEscape:v,shadow:x,stylesApi:{name:a,size:b,variant:C,classNames:O,styles:E,unstyled:P}}},S.createElement(f9,{enabled:M&&m},S.createElement(ie,Og({className:T(I.root,$)},k),o))))}kt.CloseButton=dQ;kt.Overlay=IQ;kt.Content=zQ;kt.Header=qQ;kt.Title=ZQ;kt.Body=aK;kt.NativeScrollArea=sK;const mK={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 gK=Object.defineProperty,vK=Object.defineProperties,yK=Object.getOwnPropertyDescriptors,sp=Object.getOwnPropertySymbols,II=Object.prototype.hasOwnProperty,DI=Object.prototype.propertyIsEnumerable,iP=(e,t,r)=>t in e?gK(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,xK=(e,t)=>{for(var r in t||(t={}))II.call(t,r)&&iP(e,r,t[r]);if(sp)for(var r of sp(t))DI.call(t,r)&&iP(e,r,t[r]);return e},wK=(e,t)=>vK(e,yK(t)),bK=(e,t)=>{var r={};for(var n in e)II.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&sp)for(var n of sp(e))t.indexOf(n)<0&&DI.call(e,n)&&(r[n]=e[n]);return r};const _K={},lp=f.forwardRef((e,t)=>{const r=H("Flex",_K,e),{gap:n,rowGap:o,columnGap:i,align:a,justify:l,wrap:c,direction:u,sx:d}=r,p=bK(r,["gap","rowGap","columnGap","align","justify","wrap","direction","sx"]);return S.createElement(ie,wK(xK({},p),{sx:[{display:"flex"},h=>av({gap:n,rowGap:o,columnGap:i,align:a,justify:l,wrap:c,direction:u},h,mK),...wc(d)],ref:t}))});lp.displayName="@mantine/core/Flex";const[SK,PK]=Do("Grid component was not found in tree");var jK=Object.defineProperty,aP=Object.getOwnPropertySymbols,OK=Object.prototype.hasOwnProperty,CK=Object.prototype.propertyIsEnumerable,sP=(e,t,r)=>t in e?jK(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,EK=(e,t)=>{for(var r in t||(t={}))OK.call(t,r)&&sP(e,r,t[r]);if(aP)for(var r of aP(t))CK.call(t,r)&&sP(e,r,t[r]);return e};const ux=(e,t)=>e==="content"?"auto":e==="auto"?"0rem":e?`${100/(t/e)}%`:void 0,NI=(e,t,r)=>r||e==="auto"||e==="content"?"unset":ux(e,t),AI=(e,t)=>{if(e)return e==="auto"||t?1:0},MI=(e,t)=>e===0?0:e?`${100/(t/e)}%`:void 0,LI=(e,t)=>typeof e<"u"?`calc(${L({size:e,sizes:t.spacing})} / 2)`:void 0;function $K({sizes:e,offsets:t,orders:r,theme:n,columns:o,gutters:i,grow:a}){return jE.reduce((l,c)=>(l[`@media (min-width: ${ir(n.breakpoints[c])})`]={order:r[c],flexBasis:ux(e[c],o),padding:LI(i[c],n),flexShrink:0,width:e[c]==="content"?"auto":void 0,maxWidth:NI(e[c],o,a),marginLeft:MI(t[c],o),flexGrow:AI(e[c],a)},l),{})}var kK=W((e,{gutter:t,gutterXs:r,gutterSm:n,gutterMd:o,gutterLg:i,gutterXl:a,grow:l,offset:c,offsetXs:u,offsetSm:d,offsetMd:p,offsetLg:h,offsetXl:m,columns:g,span:v,xs:_,sm:y,md:x,lg:w,xl:b,order:C,orderXs:O,orderSm:P,orderMd:E,orderLg:$,orderXl:k})=>({col:EK({boxSizing:"border-box",flexGrow:AI(v,l),order:C,padding:LI(t,e),marginLeft:MI(c,g),flexBasis:ux(v,g),flexShrink:0,width:v==="content"?"auto":void 0,maxWidth:NI(v,g,l)},$K({sizes:{xs:_,sm:y,md:x,lg:w,xl:b},offsets:{xs:u,sm:d,md:p,lg:h,xl:m},orders:{xs:O,sm:P,md:E,lg:$,xl:k},gutters:{xs:r,sm:n,md:o,lg:i,xl:a},theme:e,columns:g,grow:l}))}));const RK=kK;var TK=Object.defineProperty,cp=Object.getOwnPropertySymbols,zI=Object.prototype.hasOwnProperty,FI=Object.prototype.propertyIsEnumerable,lP=(e,t,r)=>t in e?TK(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,IK=(e,t)=>{for(var r in t||(t={}))zI.call(t,r)&&lP(e,r,t[r]);if(cp)for(var r of cp(t))FI.call(t,r)&&lP(e,r,t[r]);return e},DK=(e,t)=>{var r={};for(var n in e)zI.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&cp)for(var n of cp(e))t.indexOf(n)<0&&FI.call(e,n)&&(r[n]=e[n]);return r};const NK={};function AK(e){return e==="auto"||e==="content"?!0:typeof e=="number"&&e>0&&e%1===0}const VI=f.forwardRef((e,t)=>{const r=H("GridCol",NK,e),{children:n,span:o,offset:i,offsetXs:a,offsetSm:l,offsetMd:c,offsetLg:u,offsetXl:d,xs:p,sm:h,md:m,lg:g,xl:v,order:_,orderXs:y,orderSm:x,orderMd:w,orderLg:b,orderXl:C,className:O,unstyled:P,variant:E}=r,$=DK(r,["children","span","offset","offsetXs","offsetSm","offsetMd","offsetLg","offsetXl","xs","sm","md","lg","xl","order","orderXs","orderSm","orderMd","orderLg","orderXl","className","unstyled","variant"]),k=PK(),I=o||k.columns,{classes:T,cx:N}=RK({gutter:k.gutter,gutterXs:k.gutterXs,gutterSm:k.gutterSm,gutterMd:k.gutterMd,gutterLg:k.gutterLg,gutterXl:k.gutterXl,offset:i,offsetXs:a,offsetSm:l,offsetMd:c,offsetLg:u,offsetXl:d,xs:p,sm:h,md:m,lg:g,xl:v,order:_,orderXs:y,orderSm:x,orderMd:w,orderLg:b,orderXl:C,grow:k.grow,columns:k.columns,span:I},{unstyled:P,name:"Grid",variant:E});return!AK(I)||I>k.columns?null:S.createElement(ie,IK({className:N(T.col,O),ref:t},$),n)});VI.displayName="@mantine/core/Col";var MK=Object.defineProperty,cP=Object.getOwnPropertySymbols,LK=Object.prototype.hasOwnProperty,zK=Object.prototype.propertyIsEnumerable,uP=(e,t,r)=>t in e?MK(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,FK=(e,t)=>{for(var r in t||(t={}))LK.call(t,r)&&uP(e,r,t[r]);if(cP)for(var r of cP(t))zK.call(t,r)&&uP(e,r,t[r]);return e};function VK(e,t){return jE.reduce((r,n)=>(typeof e[n]<"u"&&(r[`@media (min-width: ${t.breakpoints[n]})`]={margin:`calc(-${L({size:e[n],sizes:t.spacing})} / 2)`}),r),{})}var BK=W((e,{justify:t,align:r,gutter:n,gutterXs:o,gutterSm:i,gutterMd:a,gutterLg:l,gutterXl:c})=>({root:FK({margin:`calc(-${L({size:n,sizes:e.spacing})} / 2)`,display:"flex",flexWrap:"wrap",justifyContent:t,alignItems:r},VK({xs:o,sm:i,md:a,lg:l,xl:c},e))}));const UK=BK;var WK=Object.defineProperty,up=Object.getOwnPropertySymbols,BI=Object.prototype.hasOwnProperty,UI=Object.prototype.propertyIsEnumerable,dP=(e,t,r)=>t in e?WK(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,HK=(e,t)=>{for(var r in t||(t={}))BI.call(t,r)&&dP(e,r,t[r]);if(up)for(var r of up(t))UI.call(t,r)&&dP(e,r,t[r]);return e},qK=(e,t)=>{var r={};for(var n in e)BI.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&up)for(var n of up(e))t.indexOf(n)<0&&UI.call(e,n)&&(r[n]=e[n]);return r};const GK={gutter:"md",justify:"flex-start",align:"stretch",columns:12},sn=f.forwardRef((e,t)=>{const r=H("Grid",GK,e),{gutter:n,gutterXs:o,gutterSm:i,gutterMd:a,gutterLg:l,gutterXl:c,children:u,grow:d,justify:p,align:h,columns:m,className:g,unstyled:v,variant:_}=r,y=qK(r,["gutter","gutterXs","gutterSm","gutterMd","gutterLg","gutterXl","children","grow","justify","align","columns","className","unstyled","variant"]),{classes:x,cx:w}=UK({gutter:n,justify:p,align:h,gutterXs:o,gutterSm:i,gutterMd:a,gutterLg:l,gutterXl:c},{unstyled:v,name:"Grid",variant:_});return S.createElement(SK,{value:{gutter:n,gutterXs:o,gutterSm:i,gutterMd:a,gutterLg:l,gutterXl:c,grow:d,columns:m}},S.createElement(ie,HK({className:w(x.root,g),ref:t},y),u))});sn.Col=VI;sn.displayName="@mantine/core/Grid";function QK(e){return f.Children.toArray(e).filter(Boolean)}const WI={left:"flex-start",center:"center",right:"flex-end",apart:"space-between"};var KK=W((e,{spacing:t,position:r,noWrap:n,grow:o,align:i,count:a})=>({root:{boxSizing:"border-box",display:"flex",flexDirection:"row",alignItems:i||"center",flexWrap:n?"nowrap":"wrap",justifyContent:WI[r],gap:L({size:t,sizes:e.spacing}),"& > *":{boxSizing:"border-box",maxWidth:o?`calc(${100/a}% - (${j(L({size:t,sizes:e.spacing}))} - ${L({size:t,sizes:e.spacing})} / ${a}))`:void 0,flexGrow:o?1:0}}}));const YK=KK;var XK=Object.defineProperty,dp=Object.getOwnPropertySymbols,HI=Object.prototype.hasOwnProperty,qI=Object.prototype.propertyIsEnumerable,fP=(e,t,r)=>t in e?XK(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,JK=(e,t)=>{for(var r in t||(t={}))HI.call(t,r)&&fP(e,r,t[r]);if(dp)for(var r of dp(t))qI.call(t,r)&&fP(e,r,t[r]);return e},ZK=(e,t)=>{var r={};for(var n in e)HI.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&dp)for(var n of dp(e))t.indexOf(n)<0&&qI.call(e,n)&&(r[n]=e[n]);return r};const eY={position:"left",spacing:"md"},Y=f.forwardRef((e,t)=>{const r=H("Group",eY,e),{className:n,position:o,align:i,children:a,noWrap:l,grow:c,spacing:u,unstyled:d,variant:p}=r,h=ZK(r,["className","position","align","children","noWrap","grow","spacing","unstyled","variant"]),m=QK(a),{classes:g,cx:v}=YK({align:i,grow:c,noWrap:l,spacing:u,position:o,count:m.length},{unstyled:d,name:"Group",variant:p});return S.createElement(ie,JK({className:v(g.root,n),ref:t},h),m)});Y.displayName="@mantine/core/Group";function tY({open:e,close:t,openDelay:r,closeDelay:n}){const o=f.useRef(-1),i=f.useRef(-1),a=()=>{window.clearTimeout(o.current),window.clearTimeout(i.current)},l=()=>{a(),r===0?e():o.current=window.setTimeout(e,r)},c=()=>{a(),n===0?t():i.current=window.setTimeout(t,n)};return f.useEffect(()=>a,[]),{openDropdown:l,closeDropdown:c}}function pP(e,t){if(typeof e=="string"&&e.trim().length===0)return!0;try{return t(e),!0}catch{return!1}}var rY=W((e,t,{size:r})=>({input:{fontFamily:e.fontFamilyMonospace,fontSize:`calc(${L({size:r,sizes:e.fontSizes})} - ${j(2)})`}}));const nY=rY;function dx(e,t){if(e==null)return{};var r={},n=Object.keys(e),o,i;for(i=0;i<n.length;i++)o=n[i],!(t.indexOf(o)>=0)&&(r[o]=e[o]);return r}var oY=f.useLayoutEffect,iY=function(t){var r=f.useRef(t);return oY(function(){r.current=t}),r},hP=function(t,r){if(typeof t=="function"){t(r);return}t.current=r},aY=function(t,r){var n=f.useRef();return f.useCallback(function(o){t.current=o,n.current&&hP(n.current,null),n.current=r,r&&hP(r,o)},[r])},mP={"min-height":"0","max-height":"none",height:"0",visibility:"hidden",overflow:"hidden",position:"absolute","z-index":"-1000",top:"0",right:"0"},gP=function(t){Object.keys(mP).forEach(function(r){t.style.setProperty(r,mP[r],"important")})},Br=null,sY=function(t,r){var n=t.scrollHeight;return r.sizingStyle.boxSizing==="border-box"?n+r.borderSize:n-r.paddingSize};function lY(e,t,r,n){r===void 0&&(r=1),n===void 0&&(n=1/0),Br||(Br=document.createElement("textarea"),Br.setAttribute("tabindex","-1"),Br.setAttribute("aria-hidden","true"),gP(Br)),Br.parentNode===null&&document.body.appendChild(Br);var o=e.paddingSize,i=e.borderSize,a=e.sizingStyle,l=a.boxSizing;Object.keys(a).forEach(function(h){var m=h;Br.style[m]=a[m]}),gP(Br),Br.value=t;var c=sY(Br,e);Br.value="x";var u=Br.scrollHeight-o,d=u*r;l==="border-box"&&(d=d+o+i),c=Math.max(d,c);var p=u*n;return l==="border-box"&&(p=p+o+i),c=Math.min(p,c),[c,u]}var vP=function(){},cY=function(t,r){return t.reduce(function(n,o){return n[o]=r[o],n},{})},uY=["borderBottomWidth","borderLeftWidth","borderRightWidth","borderTopWidth","boxSizing","fontFamily","fontSize","fontStyle","fontWeight","letterSpacing","lineHeight","paddingBottom","paddingLeft","paddingRight","paddingTop","tabSize","textIndent","textRendering","textTransform","width","wordBreak"],dY=!!document.documentElement.currentStyle,fY=function(t){var r=window.getComputedStyle(t);if(r===null)return null;var n=cY(uY,r),o=n.boxSizing;if(o==="")return null;dY&&o==="border-box"&&(n.width=parseFloat(n.width)+parseFloat(n.borderRightWidth)+parseFloat(n.borderLeftWidth)+parseFloat(n.paddingRight)+parseFloat(n.paddingLeft)+"px");var i=parseFloat(n.paddingBottom)+parseFloat(n.paddingTop),a=parseFloat(n.borderBottomWidth)+parseFloat(n.borderTopWidth);return{sizingStyle:n,paddingSize:i,borderSize:a}},pY=function(t){var r=iY(t);f.useLayoutEffect(function(){var n=function(i){r.current(i)};return window.addEventListener("resize",n),function(){window.removeEventListener("resize",n)}},[])},hY=function(t,r){var n=t.cacheMeasurements,o=t.maxRows,i=t.minRows,a=t.onChange,l=a===void 0?vP:a,c=t.onHeightChange,u=c===void 0?vP:c,d=dx(t,["cacheMeasurements","maxRows","minRows","onChange","onHeightChange"]),p=d.value!==void 0,h=f.useRef(null),m=aY(h,r),g=f.useRef(0),v=f.useRef(),_=function(){var w=h.current,b=n&&v.current?v.current:fY(w);if(b){v.current=b;var C=lY(b,w.value||w.placeholder||"x",i,o),O=C[0],P=C[1];g.current!==O&&(g.current=O,w.style.setProperty("height",O+"px","important"),u(O,{rowHeight:P}))}},y=function(w){p||_(),l(w)};return f.useLayoutEffect(_),pY(_),f.createElement("textarea",it({},d,{onChange:y,ref:m}))},mY=f.forwardRef(hY);const gY=mY;var vY=W(e=>({input:{paddingTop:e.spacing.xs,paddingBottom:e.spacing.xs}}));const yY=vY;var xY=Object.defineProperty,wY=Object.defineProperties,bY=Object.getOwnPropertyDescriptors,fp=Object.getOwnPropertySymbols,GI=Object.prototype.hasOwnProperty,QI=Object.prototype.propertyIsEnumerable,yP=(e,t,r)=>t in e?xY(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Ia=(e,t)=>{for(var r in t||(t={}))GI.call(t,r)&&yP(e,r,t[r]);if(fp)for(var r of fp(t))QI.call(t,r)&&yP(e,r,t[r]);return e},Cg=(e,t)=>wY(e,bY(t)),_Y=(e,t)=>{var r={};for(var n in e)GI.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&fp)for(var n of fp(e))t.indexOf(n)<0&&QI.call(e,n)&&(r[n]=e[n]);return r};const SY={autosize:!1,size:"sm",__staticSelector:"Textarea"},Ic=f.forwardRef((e,t)=>{const r=H("Textarea",SY,e),{autosize:n,maxRows:o,minRows:i,label:a,error:l,description:c,id:u,className:d,required:p,style:h,wrapperProps:m,classNames:g,styles:v,size:_,__staticSelector:y,sx:x,errorProps:w,descriptionProps:b,labelProps:C,inputWrapperOrder:O,inputContainer:P,unstyled:E,withAsterisk:$,variant:k}=r,I=_Y(r,["autosize","maxRows","minRows","label","error","description","id","className","required","style","wrapperProps","classNames","styles","size","__staticSelector","sx","errorProps","descriptionProps","labelProps","inputWrapperOrder","inputContainer","unstyled","withAsterisk","variant"]),T=Nr(u),{classes:N,cx:A}=yY(),{systemStyles:z,rest:G}=oo(I),X=Ia({required:p,ref:t,error:l,id:T,classNames:Cg(Ia({},g),{input:A(N.input,g==null?void 0:g.input)}),styles:v,__staticSelector:y,size:_,multiline:!0,unstyled:E,variant:k},G);return S.createElement(Ut.Wrapper,Ia(Ia({label:a,error:l,id:T,description:c,required:p,style:h,className:d,classNames:g,styles:v,size:_,__staticSelector:y,sx:x,errorProps:w,labelProps:C,descriptionProps:b,inputContainer:P,inputWrapperOrder:O,unstyled:E,withAsterisk:$,variant:k},z),m),n?S.createElement(Ut,Cg(Ia({},X),{component:gY,maxRows:o,minRows:i})):S.createElement(Ut,Cg(Ia({},X),{component:"textarea",rows:i})))});Ic.displayName="@mantine/core/Textarea";var PY=Object.defineProperty,jY=Object.defineProperties,OY=Object.getOwnPropertyDescriptors,pp=Object.getOwnPropertySymbols,KI=Object.prototype.hasOwnProperty,YI=Object.prototype.propertyIsEnumerable,xP=(e,t,r)=>t in e?PY(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,wP=(e,t)=>{for(var r in t||(t={}))KI.call(t,r)&&xP(e,r,t[r]);if(pp)for(var r of pp(t))YI.call(t,r)&&xP(e,r,t[r]);return e},CY=(e,t)=>jY(e,OY(t)),EY=(e,t)=>{var r={};for(var n in e)KI.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&pp)for(var n of pp(e))t.indexOf(n)<0&&YI.call(e,n)&&(r[n]=e[n]);return r};const $Y={formatOnBlur:!1,size:"sm",serialize:JSON.stringify,deserialize:JSON.parse},Fs=f.forwardRef((e,t)=>{const r=H("JsonInput",$Y,e),{value:n,defaultValue:o,onChange:i,onFocus:a,onBlur:l,error:c,formatOnBlur:u,size:d,validationError:p,classNames:h,unstyled:m,readOnly:g,variant:v,serialize:_,deserialize:y}=r,x=EY(r,["value","defaultValue","onChange","onFocus","onBlur","error","formatOnBlur","size","validationError","classNames","unstyled","readOnly","variant","serialize","deserialize"]),{classes:w,cx:b}=nY(null,{name:"JsonInput",unstyled:m,size:d,variant:v}),[C,O]=Tr({value:n,defaultValue:o,finalValue:"",onChange:i}),[P,E]=f.useState(pP(C,y)),$=I=>{typeof a=="function"&&a(I),E(!0)},k=I=>{typeof l=="function"&&l(I);const T=pP(I.currentTarget.value,y);u&&!g&&T&&I.currentTarget.value.trim()!==""&&O(_(y(I.currentTarget.value),null,2)),E(T)};return S.createElement(Ic,wP({value:C,onChange:I=>O(I.currentTarget.value),onFocus:$,onBlur:k,error:P?c:p||!0,__staticSelector:"JsonInput",classNames:CY(wP({},h),{input:b(w.input,h==null?void 0:h.input)}),autoComplete:"off",ref:t,unstyled:m,readOnly:g,size:d,variant:v},x))});Fs.displayName="@mantine/core/JsonInput";const[kY,RY]=Do("List component was not found in tree");var TY=W((e,{spacing:t,center:r})=>({itemWrapper:{ref:Vt("itemWrapper"),display:"inline-flex",flexDirection:"column",whiteSpace:"normal"},item:{whiteSpace:"nowrap",lineHeight:r?1:e.lineHeight,"&:not(:first-of-type)":{marginTop:L({size:t,sizes:e.spacing})},"&[data-with-icon]":{listStyle:"none",[`& .${Vt("itemWrapper")}`]:{display:"inline-flex",alignItems:r?"center":"flex-start",flexDirection:"row"}}},itemIcon:{display:"inline-block",verticalAlign:"middle",marginRight:e.spacing.sm}}));const IY=TY;var DY=Object.defineProperty,hp=Object.getOwnPropertySymbols,XI=Object.prototype.hasOwnProperty,JI=Object.prototype.propertyIsEnumerable,bP=(e,t,r)=>t in e?DY(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,NY=(e,t)=>{for(var r in t||(t={}))XI.call(t,r)&&bP(e,r,t[r]);if(hp)for(var r of hp(t))JI.call(t,r)&&bP(e,r,t[r]);return e},AY=(e,t)=>{var r={};for(var n in e)XI.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&hp)for(var n of hp(e))t.indexOf(n)<0&&JI.call(e,n)&&(r[n]=e[n]);return r};const MY={},ZI=f.forwardRef((e,t)=>{const r=H("ListItem",MY,e),{className:n,children:o,icon:i}=r,a=AY(r,["className","children","icon"]),{icon:l,spacing:c,center:u,listStyleType:d,size:p,withPadding:h,classNames:m,styles:g,unstyled:v,variant:_}=RY(),y=i||l,{classes:x,cx:w}=IY({withPadding:h,listStyleType:d,center:u,spacing:c},{classNames:m,styles:g,unstyled:v,name:"List",variant:_,size:p});return S.createElement(ie,NY({component:"li",className:w(x.item,n),"data-with-icon":!!y||void 0,ref:t},a),S.createElement("div",{className:x.itemWrapper},y&&S.createElement("span",{className:x.itemIcon},y),S.createElement("span",null,o)))});ZI.displayName="@mantine/core/ListItem";var LY=Object.defineProperty,zY=Object.defineProperties,FY=Object.getOwnPropertyDescriptors,_P=Object.getOwnPropertySymbols,VY=Object.prototype.hasOwnProperty,BY=Object.prototype.propertyIsEnumerable,SP=(e,t,r)=>t in e?LY(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,UY=(e,t)=>{for(var r in t||(t={}))VY.call(t,r)&&SP(e,r,t[r]);if(_P)for(var r of _P(t))BY.call(t,r)&&SP(e,r,t[r]);return e},WY=(e,t)=>zY(e,FY(t)),HY=W((e,{withPadding:t,listStyleType:r},{size:n})=>({root:WY(UY({},e.fn.fontStyles()),{listStyleType:r,color:e.colorScheme==="dark"?e.colors.dark[0]:e.black,fontSize:L({size:n,sizes:e.fontSizes}),lineHeight:e.lineHeight,margin:0,paddingLeft:t?e.spacing.xl:0,listStylePosition:"inside"})}));const qY=HY;var GY=Object.defineProperty,mp=Object.getOwnPropertySymbols,eD=Object.prototype.hasOwnProperty,tD=Object.prototype.propertyIsEnumerable,PP=(e,t,r)=>t in e?GY(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,QY=(e,t)=>{for(var r in t||(t={}))eD.call(t,r)&&PP(e,r,t[r]);if(mp)for(var r of mp(t))tD.call(t,r)&&PP(e,r,t[r]);return e},KY=(e,t)=>{var r={};for(var n in e)eD.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&mp)for(var n of mp(e))t.indexOf(n)<0&&tD.call(e,n)&&(r[n]=e[n]);return r};const YY={type:"unordered",size:"md",spacing:0},Cr=f.forwardRef((e,t)=>{const r=H("List",YY,e),{children:n,type:o,size:i,listStyleType:a,withPadding:l,center:c,spacing:u,icon:d,className:p,styles:h,classNames:m,unstyled:g,variant:v}=r,_=KY(r,["children","type","size","listStyleType","withPadding","center","spacing","icon","className","styles","classNames","unstyled","variant"]),{classes:y,cx:x}=qY({withPadding:l,listStyleType:a,center:c,spacing:u},{classNames:m,styles:h,name:"List",unstyled:g,size:i,variant:v});return S.createElement(kY,{value:{spacing:u,center:c,icon:d,listStyleType:a,size:i,withPadding:l,classNames:m,styles:h,unstyled:g,variant:v}},S.createElement(ie,QY({component:o==="unordered"?"ul":"ol",className:x(y.root,p),ref:t},_),n))});Cr.Item=ZI;Cr.displayName="@mantine/core/List";var XY=Object.defineProperty,JY=Object.defineProperties,ZY=Object.getOwnPropertyDescriptors,jP=Object.getOwnPropertySymbols,eX=Object.prototype.hasOwnProperty,tX=Object.prototype.propertyIsEnumerable,OP=(e,t,r)=>t in e?XY(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,rX=(e,t)=>{for(var r in t||(t={}))eX.call(t,r)&&OP(e,r,t[r]);if(jP)for(var r of jP(t))tX.call(t,r)&&OP(e,r,t[r]);return e},nX=(e,t)=>JY(e,ZY(t)),oX=W(e=>({root:nX(rX({},e.fn.cover()),{display:"flex",alignItems:"center",justifyContent:"center",overflow:"hidden"})}));const iX=oX;var aX=Object.defineProperty,sX=Object.defineProperties,lX=Object.getOwnPropertyDescriptors,gp=Object.getOwnPropertySymbols,rD=Object.prototype.hasOwnProperty,nD=Object.prototype.propertyIsEnumerable,CP=(e,t,r)=>t in e?aX(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Lu=(e,t)=>{for(var r in t||(t={}))rD.call(t,r)&&CP(e,r,t[r]);if(gp)for(var r of gp(t))nD.call(t,r)&&CP(e,r,t[r]);return e},cX=(e,t)=>sX(e,lX(t)),uX=(e,t)=>{var r={};for(var n in e)rD.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&gp)for(var n of gp(e))t.indexOf(n)<0&&nD.call(e,n)&&(r[n]=e[n]);return r};const dX={overlayOpacity:.75,transitionDuration:0,radius:0,zIndex:Tn("overlay")},oD=f.forwardRef((e,t)=>{const r=H("LoadingOverlay",dX,e),{className:n,visible:o,loaderProps:i,overlayOpacity:a,overlayColor:l,transitionDuration:c,exitTransitionDuration:u,zIndex:d,style:p,loader:h,radius:m,overlayBlur:g,unstyled:v,variant:_,keepMounted:y}=r,x=uX(r,["className","visible","loaderProps","overlayOpacity","overlayColor","transitionDuration","exitTransitionDuration","zIndex","style","loader","radius","overlayBlur","unstyled","variant","keepMounted"]),{classes:w,cx:b,theme:C}=iX(null,{name:"LoadingOverlay",unstyled:v,variant:_}),O=`calc(${d} + 1)`;return S.createElement(va,{keepMounted:y,duration:c,exitDuration:u,mounted:o,transition:"fade"},P=>S.createElement(ie,Lu({className:b(w.root,n),style:cX(Lu(Lu({},P),p),{zIndex:d}),ref:t},x),h?S.createElement("div",{style:{zIndex:O}},h):S.createElement(hn,Lu({style:{zIndex:O}},i)),S.createElement(wI,{opacity:a,zIndex:d,radius:m,blur:g,unstyled:v,color:l||(C.colorScheme==="dark"?C.colors.dark[5]:C.white)})))});oD.displayName="@mantine/core/LoadingOverlay";const iD={context:"Menu component was not found in the tree",children:"Menu.Target component children should be an element or a component that accepts ref. Fragments, strings, numbers and other primitive values are not supported"},[fX,Dc]=Do(iD.context);var pX=W(e=>({divider:{marginTop:j(4),marginBottom:j(4),borderTop:`${j(1)} solid ${e.colorScheme==="dark"?e.colors.dark[4]:e.colors.gray[2]}`}}));const hX=pX;var mX=Object.defineProperty,vp=Object.getOwnPropertySymbols,aD=Object.prototype.hasOwnProperty,sD=Object.prototype.propertyIsEnumerable,EP=(e,t,r)=>t in e?mX(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,gX=(e,t)=>{for(var r in t||(t={}))aD.call(t,r)&&EP(e,r,t[r]);if(vp)for(var r of vp(t))sD.call(t,r)&&EP(e,r,t[r]);return e},vX=(e,t)=>{var r={};for(var n in e)aD.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&vp)for(var n of vp(e))t.indexOf(n)<0&&sD.call(e,n)&&(r[n]=e[n]);return r};const yX={},lD=f.forwardRef((e,t)=>{const r=H("MenuDivider",yX,e),{children:n,className:o}=r,i=vX(r,["children","className"]),{classNames:a,styles:l,unstyled:c,variant:u}=Dc(),{classes:d,cx:p}=hX(null,{name:"Menu",classNames:a,styles:l,unstyled:c,variant:u});return S.createElement(ie,gX({className:p(d.divider,o),ref:t},i))});lD.displayName="@mantine/core/MenuDivider";var xX=Object.defineProperty,yp=Object.getOwnPropertySymbols,cD=Object.prototype.hasOwnProperty,uD=Object.prototype.propertyIsEnumerable,$P=(e,t,r)=>t in e?xX(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,wX=(e,t)=>{for(var r in t||(t={}))cD.call(t,r)&&$P(e,r,t[r]);if(yp)for(var r of yp(t))uD.call(t,r)&&$P(e,r,t[r]);return e},bX=(e,t)=>{var r={};for(var n in e)cD.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&yp)for(var n of yp(e))t.indexOf(n)<0&&uD.call(e,n)&&(r[n]=e[n]);return r};const _X={};function dD(e){const t=H("MenuDropdown",_X,e),{children:r,onMouseEnter:n,onMouseLeave:o}=t,i=bX(t,["children","onMouseEnter","onMouseLeave"]),a=f.useRef(),l=Dc(),c=p=>{var h;(p.key==="ArrowUp"||p.key==="ArrowDown")&&(p.preventDefault(),(h=a.current.querySelectorAll("[data-menu-item]:not(:disabled)")[0])==null||h.focus())},u=Wr(n,()=>l.trigger==="hover"&&l.openDropdown()),d=Wr(o,()=>l.trigger==="hover"&&l.closeDropdown());return S.createElement(Lo.Dropdown,wX({onMouseEnter:u,onMouseLeave:d,role:"menu","aria-orientation":"vertical"},i),S.createElement("div",{tabIndex:-1,"data-menu-dropdown":!0,"data-autofocus":!0,onKeyDown:c,ref:a,style:{outline:0}},r))}dD.displayName="@mantine/core/MenuDropdown";var SX=Object.defineProperty,PX=Object.defineProperties,jX=Object.getOwnPropertyDescriptors,kP=Object.getOwnPropertySymbols,OX=Object.prototype.hasOwnProperty,CX=Object.prototype.propertyIsEnumerable,RP=(e,t,r)=>t in e?SX(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,EX=(e,t)=>{for(var r in t||(t={}))OX.call(t,r)&&RP(e,r,t[r]);if(kP)for(var r of kP(t))CX.call(t,r)&&RP(e,r,t[r]);return e},$X=(e,t)=>PX(e,jX(t)),kX=W((e,{color:t,radius:r})=>({item:$X(EX({},e.fn.fontStyles()),{WebkitTapHighlightColor:"transparent",fontSize:e.fontSizes.sm,border:0,backgroundColor:"transparent",outline:0,width:"100%",textAlign:"left",textDecoration:"none",boxSizing:"border-box",padding:`${e.spacing.xs} ${e.spacing.sm}`,cursor:"pointer",borderRadius:e.fn.radius(r),color:t?e.fn.variant({variant:"filled",primaryFallback:!1,color:t}).background:e.colorScheme==="dark"?e.colors.dark[0]:e.black,display:"flex",alignItems:"center","&:disabled":{color:e.colorScheme==="dark"?e.colors.dark[3]:e.colors.gray[5],pointerEvents:"none",userSelect:"none"},"&[data-hovered]":{backgroundColor:t?e.fn.variant({variant:"light",color:t}).background:e.colorScheme==="dark"?e.fn.rgba(e.colors.dark[3],.35):e.colors.gray[1]}}),itemLabel:{flex:1},itemIcon:{display:"flex",justifyContent:"center",alignItems:"center",marginRight:e.spacing.xs},itemRightSection:{}}));const RX=kX;var TX=Object.defineProperty,IX=Object.defineProperties,DX=Object.getOwnPropertyDescriptors,xp=Object.getOwnPropertySymbols,fD=Object.prototype.hasOwnProperty,pD=Object.prototype.propertyIsEnumerable,TP=(e,t,r)=>t in e?TX(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,NX=(e,t)=>{for(var r in t||(t={}))fD.call(t,r)&&TP(e,r,t[r]);if(xp)for(var r of xp(t))pD.call(t,r)&&TP(e,r,t[r]);return e},AX=(e,t)=>IX(e,DX(t)),MX=(e,t)=>{var r={};for(var n in e)fD.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&xp)for(var n of xp(e))t.indexOf(n)<0&&pD.call(e,n)&&(r[n]=e[n]);return r};const LX={},hD=f.forwardRef((e,t)=>{const r=H("MenuItem",LX,e),{children:n,className:o,color:i,closeMenuOnClick:a,icon:l,rightSection:c}=r,u=MX(r,["children","className","color","closeMenuOnClick","icon","rightSection"]),d=Dc(),{classes:p,cx:h,theme:m}=RX({radius:d.radius,color:i},{name:"Menu",classNames:d.classNames,styles:d.styles,unstyled:d.unstyled,variant:d.variant}),g=f.useRef(),v=d.getItemIndex(g.current),_=u,y=Wr(_.onMouseLeave,()=>d.setHovered(-1)),x=Wr(_.onMouseEnter,()=>d.setHovered(d.getItemIndex(g.current))),w=Wr(_.onClick,()=>{typeof a=="boolean"?a&&d.closeDropdownImmediately():d.closeOnItemClick&&d.closeDropdownImmediately()}),b=Wr(_.onFocus,()=>d.setHovered(d.getItemIndex(g.current)));return S.createElement(ie,AX(NX({component:"button",type:"button"},u),{tabIndex:-1,onFocus:b,className:h(p.item,o),ref:Is(g,t),role:"menuitem","data-menu-item":!0,"data-hovered":d.hovered===v?!0:void 0,onMouseEnter:x,onMouseLeave:y,onClick:w,onKeyDown:yE({siblingSelector:"[data-menu-item]",parentSelector:"[data-menu-dropdown]",activateOnFocus:!1,loop:d.loop,dir:m.dir,orientation:"vertical",onKeyDown:_.onKeydown})}),l&&S.createElement("div",{className:p.itemIcon},l),n&&S.createElement("div",{className:p.itemLabel},n),c&&S.createElement("div",{className:p.itemRightSection},c))});hD.displayName="@mantine/core/MenuItem";const zX=hD;var FX=W(e=>({label:{color:e.colorScheme==="dark"?e.colors.dark[2]:e.colors.gray[6],fontWeight:500,fontSize:e.fontSizes.xs,padding:`calc(${e.spacing.xs} / 2) ${e.spacing.sm}`,cursor:"default"}}));const VX=FX;var BX=Object.defineProperty,wp=Object.getOwnPropertySymbols,mD=Object.prototype.hasOwnProperty,gD=Object.prototype.propertyIsEnumerable,IP=(e,t,r)=>t in e?BX(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,UX=(e,t)=>{for(var r in t||(t={}))mD.call(t,r)&&IP(e,r,t[r]);if(wp)for(var r of wp(t))gD.call(t,r)&&IP(e,r,t[r]);return e},WX=(e,t)=>{var r={};for(var n in e)mD.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&wp)for(var n of wp(e))t.indexOf(n)<0&&gD.call(e,n)&&(r[n]=e[n]);return r};const HX={},vD=f.forwardRef((e,t)=>{const r=H("MenuLabel",HX,e),{children:n,className:o}=r,i=WX(r,["children","className"]),{classNames:a,styles:l,unstyled:c,variant:u}=Dc(),{classes:d,cx:p}=VX(null,{name:"Menu",classNames:a,styles:l,unstyled:c,variant:u});return S.createElement(oe,UX({className:p(d.label,o),ref:t},i),n)});vD.displayName="@mantine/core/MenuLabel";var qX=Object.defineProperty,bp=Object.getOwnPropertySymbols,yD=Object.prototype.hasOwnProperty,xD=Object.prototype.propertyIsEnumerable,DP=(e,t,r)=>t in e?qX(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,GX=(e,t)=>{for(var r in t||(t={}))yD.call(t,r)&&DP(e,r,t[r]);if(bp)for(var r of bp(t))xD.call(t,r)&&DP(e,r,t[r]);return e},QX=(e,t)=>{var r={};for(var n in e)yD.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&bp)for(var n of bp(e))t.indexOf(n)<0&&xD.call(e,n)&&(r[n]=e[n]);return r};const KX={refProp:"ref"},wD=f.forwardRef((e,t)=>{const r=H("MenuTarget",KX,e),{children:n,refProp:o}=r,i=QX(r,["children","refProp"]);if(!Rs(n))throw new Error(iD.children);const a=Dc(),l=Wr(n.props.onClick,()=>a.trigger==="click"&&a.toggleDropdown()),c=Wr(n.props.onMouseEnter,()=>a.trigger==="hover"&&a.openDropdown()),u=Wr(n.props.onMouseLeave,()=>a.trigger==="hover"&&a.closeDropdown());return S.createElement(Lo.Target,GX({refProp:o,popupType:"menu",ref:t},i),f.cloneElement(n,{onClick:l,onMouseEnter:c,onMouseLeave:u,"data-expanded":a.opened?!0:void 0}))});wD.displayName="@mantine/core/MenuTarget";var YX=W({dropdown:{padding:j(4)}});const XX=YX;var JX=Object.defineProperty,ZX=Object.defineProperties,eJ=Object.getOwnPropertyDescriptors,_p=Object.getOwnPropertySymbols,bD=Object.prototype.hasOwnProperty,_D=Object.prototype.propertyIsEnumerable,NP=(e,t,r)=>t in e?JX(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,AP=(e,t)=>{for(var r in t||(t={}))bD.call(t,r)&&NP(e,r,t[r]);if(_p)for(var r of _p(t))_D.call(t,r)&&NP(e,r,t[r]);return e},MP=(e,t)=>ZX(e,eJ(t)),tJ=(e,t)=>{var r={};for(var n in e)bD.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&_p)for(var n of _p(e))t.indexOf(n)<0&&_D.call(e,n)&&(r[n]=e[n]);return r};const rJ={closeOnItemClick:!0,loop:!0,trigger:"click",openDelay:0,closeDelay:100};function J(e){const t=H("Menu",rJ,e),{children:r,onOpen:n,onClose:o,opened:i,defaultOpened:a,onChange:l,closeOnItemClick:c,loop:u,closeOnEscape:d,trigger:p,openDelay:h,closeDelay:m,classNames:g,styles:v,unstyled:_,radius:y,variant:x}=t,w=tJ(t,["children","onOpen","onClose","opened","defaultOpened","onChange","closeOnItemClick","loop","closeOnEscape","trigger","openDelay","closeDelay","classNames","styles","unstyled","radius","variant"]),{classes:b,cx:C}=XX(),[O,{setHovered:P,resetHovered:E}]=x9(),[$,k]=Tr({value:i,defaultValue:a,finalValue:!1,onChange:l}),I=()=>{k(!1),$&&(o==null||o())},T=()=>{k(!0),!$&&(n==null||n())},N=()=>$?I():T(),{openDropdown:A,closeDropdown:z}=tY({open:T,close:I,closeDelay:m,openDelay:h}),G=X=>g9("[data-menu-item]","[data-menu-dropdown]",X);return ln(()=>{E()},[$]),S.createElement(fX,{value:{opened:$,toggleDropdown:N,getItemIndex:G,hovered:O,setHovered:P,closeOnItemClick:c,closeDropdown:p==="click"?I:z,openDropdown:p==="click"?T:A,closeDropdownImmediately:I,loop:u,trigger:p,radius:y,classNames:g,styles:v,unstyled:_,variant:x}},S.createElement(Lo,MP(AP({},w),{radius:y,opened:$,onChange:N,defaultOpened:a,trapFocus:p==="click",closeOnEscape:d&&p==="click",__staticSelector:"Menu",classNames:MP(AP({},g),{dropdown:C(b.dropdown,g==null?void 0:g.dropdown)}),styles:v,unstyled:_,variant:x}),r))}J.displayName="@mantine/core/Menu";J.Item=zX;J.Label=vD;J.Dropdown=dD;J.Target=wD;J.Divider=lD;const[nJ,oJ]=Do("Modal component was not found in tree"),iJ={xs:j(320),sm:j(380),md:j(440),lg:j(620),xl:j(780)};var aJ=W((e,{yOffset:t,xOffset:r,centered:n,fullScreen:o},{size:i})=>({content:{flex:o?"0 0 100%":`0 0 ${L({size:i,sizes:iJ})}`,maxWidth:"100%",maxHeight:o?void 0:`calc(100dvh - (${j(t)} * 2))`,height:o?"100vh":void 0,borderRadius:o?0:void 0,overflowY:"auto"},inner:{paddingTop:o?0:t,paddingBottom:o?0:t,paddingLeft:o?0:r,paddingRight:o?0:r,display:"flex",justifyContent:"center",alignItems:n?"center":"flex-start"}}));const sJ=aJ;var lJ=Object.defineProperty,cJ=Object.defineProperties,uJ=Object.getOwnPropertyDescriptors,Sp=Object.getOwnPropertySymbols,SD=Object.prototype.hasOwnProperty,PD=Object.prototype.propertyIsEnumerable,LP=(e,t,r)=>t in e?lJ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,sy=(e,t)=>{for(var r in t||(t={}))SD.call(t,r)&&LP(e,r,t[r]);if(Sp)for(var r of Sp(t))PD.call(t,r)&&LP(e,r,t[r]);return e},jD=(e,t)=>cJ(e,uJ(t)),dJ=(e,t)=>{var r={};for(var n in e)SD.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&Sp)for(var n of Sp(e))t.indexOf(n)<0&&PD.call(e,n)&&(r[n]=e[n]);return r};const fJ=jD(sy({},cx),{yOffset:"5dvh",xOffset:"5vw"});function OD(e){const t=H("ModalRoot",fJ,e),{classNames:r,variant:n,size:o,yOffset:i,xOffset:a,scrollAreaComponent:l,radius:c,centered:u,fullScreen:d}=t,p=dJ(t,["classNames","variant","size","yOffset","xOffset","scrollAreaComponent","radius","centered","fullScreen"]),{classes:h,cx:m}=sJ({yOffset:i,xOffset:a,centered:u,fullScreen:d},{name:"Modal",variant:n,size:o});return S.createElement(nJ,{value:{yOffset:i,scrollAreaComponent:l,radius:c}},S.createElement(kt,sy({__staticSelector:"Modal",size:o,variant:n,classNames:jD(sy({},r),{content:m(h.content,r==null?void 0:r.content),inner:m(h.inner,r==null?void 0:r.inner)})},p)))}var pJ=Object.defineProperty,Pp=Object.getOwnPropertySymbols,CD=Object.prototype.hasOwnProperty,ED=Object.prototype.propertyIsEnumerable,zP=(e,t,r)=>t in e?pJ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,hJ=(e,t)=>{for(var r in t||(t={}))CD.call(t,r)&&zP(e,r,t[r]);if(Pp)for(var r of Pp(t))ED.call(t,r)&&zP(e,r,t[r]);return e},mJ=(e,t)=>{var r={};for(var n in e)CD.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&Pp)for(var n of Pp(e))t.indexOf(n)<0&&ED.call(e,n)&&(r[n]=e[n]);return r};const gJ={shadow:"xl"},$D=f.forwardRef((e,t)=>{const r=H("ModalContent",gJ,e),{children:n,scrollAreaComponent:o}=r,i=mJ(r,["children","scrollAreaComponent"]),a=oJ(),l=o||a.scrollAreaComponent||kt.NativeScrollArea;return S.createElement(kt.Content,hJ({ref:t,radius:a.radius},i),S.createElement(l,{style:{maxHeight:`calc(100dvh - (${j(a.yOffset)} * 2))`}},n))});var vJ=Object.defineProperty,yJ=Object.defineProperties,xJ=Object.getOwnPropertyDescriptors,jp=Object.getOwnPropertySymbols,kD=Object.prototype.hasOwnProperty,RD=Object.prototype.propertyIsEnumerable,FP=(e,t,r)=>t in e?vJ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,xd=(e,t)=>{for(var r in t||(t={}))kD.call(t,r)&&FP(e,r,t[r]);if(jp)for(var r of jp(t))RD.call(t,r)&&FP(e,r,t[r]);return e},wJ=(e,t)=>yJ(e,xJ(t)),bJ=(e,t)=>{var r={};for(var n in e)kD.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&jp)for(var n of jp(e))t.indexOf(n)<0&&RD.call(e,n)&&(r[n]=e[n]);return r};const _J=wJ(xd({},cx),{transitionProps:{duration:200,transition:"pop"},withOverlay:!0,withCloseButton:!0});function Ar(e){const t=H("Modal",_J,e),{title:r,withOverlay:n,overlayProps:o,withCloseButton:i,closeButtonProps:a,children:l}=t,c=bJ(t,["title","withOverlay","overlayProps","withCloseButton","closeButtonProps","children"]),u=!!r||i;return S.createElement(OD,xd({},c),n&&S.createElement(kt.Overlay,xd({},o)),S.createElement($D,null,u&&S.createElement(kt.Header,null,r&&S.createElement(kt.Title,null,r),i&&S.createElement(kt.CloseButton,xd({},a))),S.createElement(kt.Body,null,l)))}Ar.Root=OD;Ar.CloseButton=kt.CloseButton;Ar.Overlay=kt.Overlay;Ar.Content=$D;Ar.Header=kt.Header;Ar.Title=kt.Title;Ar.Body=kt.Body;Ar.NativeScrollArea=kt.NativeScrollArea;const TD={xs:j(16),sm:j(22),md:j(26),lg:j(30),xl:j(36)},SJ={xs:j(10),sm:j(12),md:j(14),lg:j(16),xl:j(18)};var PJ=W((e,{disabled:t,radius:r,readOnly:n},{size:o,variant:i})=>({defaultValue:{display:"flex",alignItems:"center",backgroundColor:t?e.colorScheme==="dark"?e.colors.dark[5]:e.colors.gray[3]:e.colorScheme==="dark"?e.colors.dark[7]:i==="filled"?e.white:e.colors.gray[1],color:t?e.colorScheme==="dark"?e.colors.dark[1]:e.colors.gray[7]:e.colorScheme==="dark"?e.colors.dark[0]:e.colors.gray[7],height:L({size:o,sizes:TD}),paddingLeft:`calc(${L({size:o,sizes:e.spacing})} / 1.5)`,paddingRight:t||n?L({size:o,sizes:e.spacing}):0,fontWeight:500,fontSize:L({size:o,sizes:SJ}),borderRadius:L({size:r,sizes:e.radius}),cursor:t?"not-allowed":"default",userSelect:"none",maxWidth:`calc(100% - ${j(10)})`},defaultValueRemove:{color:e.colorScheme==="dark"?e.colors.dark[0]:e.colors.gray[7],marginLeft:`calc(${L({size:o,sizes:e.spacing})} / 6)`},defaultValueLabel:{display:"block",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}})),jJ=Object.defineProperty,Op=Object.getOwnPropertySymbols,ID=Object.prototype.hasOwnProperty,DD=Object.prototype.propertyIsEnumerable,VP=(e,t,r)=>t in e?jJ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,OJ=(e,t)=>{for(var r in t||(t={}))ID.call(t,r)&&VP(e,r,t[r]);if(Op)for(var r of Op(t))DD.call(t,r)&&VP(e,r,t[r]);return e},CJ=(e,t)=>{var r={};for(var n in e)ID.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&Op)for(var n of Op(e))t.indexOf(n)<0&&DD.call(e,n)&&(r[n]=e[n]);return r};const EJ={xs:16,sm:22,md:24,lg:26,xl:30};function ND(e){var t=e,{label:r,classNames:n,styles:o,className:i,onRemove:a,disabled:l,readOnly:c,size:u,radius:d="sm",variant:p,unstyled:h}=t,m=CJ(t,["label","classNames","styles","className","onRemove","disabled","readOnly","size","radius","variant","unstyled"]);const{classes:g,cx:v}=PJ({disabled:l,readOnly:c,radius:d},{name:"MultiSelect",classNames:n,styles:o,unstyled:h,size:u,variant:p});return S.createElement("div",OJ({className:v(g.defaultValue,i)},m),S.createElement("span",{className:g.defaultValueLabel},r),!l&&!c&&S.createElement(Ec,{"aria-hidden":!0,onMouseDown:a,size:EJ[u],radius:2,color:"blue",variant:"transparent",iconSize:"70%",className:g.defaultValueRemove,tabIndex:-1,unstyled:h}))}ND.displayName="@mantine/core/MultiSelect/DefaultValue";function $J({data:e,searchable:t,limit:r,searchValue:n,filter:o,value:i,disableSelectedItemFiltering:a}){if(!t&&i.length===0)return e;if(!t){const c=[];for(let u=0;u<e.length;u+=1)(a||!i.some(d=>d===e[u].value&&!e[u].disabled))&&c.push(e[u]);return c}const l=[];for(let c=0;c<e.length&&(o(n,!a&&i.some(u=>u===e[c].value&&!e[c].disabled),e[c])&&l.push(e[c]),!(l.length>=r));c+=1);return l}var kJ=Object.defineProperty,Cp=Object.getOwnPropertySymbols,AD=Object.prototype.hasOwnProperty,MD=Object.prototype.propertyIsEnumerable,BP=(e,t,r)=>t in e?kJ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,UP=(e,t)=>{for(var r in t||(t={}))AD.call(t,r)&&BP(e,r,t[r]);if(Cp)for(var r of Cp(t))MD.call(t,r)&&BP(e,r,t[r]);return e},RJ=(e,t)=>{var r={};for(var n in e)AD.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&Cp)for(var n of Cp(e))t.indexOf(n)<0&&MD.call(e,n)&&(r[n]=e[n]);return r};const TJ={xs:j(14),sm:j(18),md:j(20),lg:j(24),xl:j(28)};function IJ(e){var t=e,{size:r,error:n,style:o}=t,i=RJ(t,["size","error","style"]);const a=Jt(),l=L({size:r,sizes:TJ});return S.createElement("svg",UP({viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:UP({color:n?a.colors.red[6]:a.colors.gray[6],width:l,height:l},o),"data-chevron":!0},i),S.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"}))}var DJ=Object.defineProperty,NJ=Object.defineProperties,AJ=Object.getOwnPropertyDescriptors,WP=Object.getOwnPropertySymbols,MJ=Object.prototype.hasOwnProperty,LJ=Object.prototype.propertyIsEnumerable,HP=(e,t,r)=>t in e?DJ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,zJ=(e,t)=>{for(var r in t||(t={}))MJ.call(t,r)&&HP(e,r,t[r]);if(WP)for(var r of WP(t))LJ.call(t,r)&&HP(e,r,t[r]);return e},FJ=(e,t)=>NJ(e,AJ(t));function LD({shouldClear:e,clearButtonProps:t,onClear:r,size:n,error:o}){return e?S.createElement(Ec,FJ(zJ({},t),{variant:"transparent",onClick:r,size:n,onMouseDown:i=>i.preventDefault()})):S.createElement(IJ,{error:o,size:n})}LD.displayName="@mantine/core/SelectRightSection";var VJ=Object.defineProperty,BJ=Object.defineProperties,UJ=Object.getOwnPropertyDescriptors,Ep=Object.getOwnPropertySymbols,zD=Object.prototype.hasOwnProperty,FD=Object.prototype.propertyIsEnumerable,qP=(e,t,r)=>t in e?VJ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Eg=(e,t)=>{for(var r in t||(t={}))zD.call(t,r)&&qP(e,r,t[r]);if(Ep)for(var r of Ep(t))FD.call(t,r)&&qP(e,r,t[r]);return e},GP=(e,t)=>BJ(e,UJ(t)),WJ=(e,t)=>{var r={};for(var n in e)zD.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&Ep)for(var n of Ep(e))t.indexOf(n)<0&&FD.call(e,n)&&(r[n]=e[n]);return r};function VD(e){var t=e,{styles:r,rightSection:n,rightSectionWidth:o,theme:i}=t,a=WJ(t,["styles","rightSection","rightSectionWidth","theme"]);if(n)return{rightSection:n,rightSectionWidth:o,styles:r};const l=typeof r=="function"?r(i):r;return{rightSection:!a.readOnly&&!(a.disabled&&a.shouldClear)&&S.createElement(LD,Eg({},a)),styles:GP(Eg({},l),{rightSection:GP(Eg({},l==null?void 0:l.rightSection),{pointerEvents:a.shouldClear?void 0:"none"})})}}var HJ=Object.defineProperty,qJ=Object.defineProperties,GJ=Object.getOwnPropertyDescriptors,QP=Object.getOwnPropertySymbols,QJ=Object.prototype.hasOwnProperty,KJ=Object.prototype.propertyIsEnumerable,KP=(e,t,r)=>t in e?HJ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,YJ=(e,t)=>{for(var r in t||(t={}))QJ.call(t,r)&&KP(e,r,t[r]);if(QP)for(var r of QP(t))KJ.call(t,r)&&KP(e,r,t[r]);return e},XJ=(e,t)=>qJ(e,GJ(t)),JJ=W((e,{invalid:t},{size:r})=>({wrapper:{position:"relative","&:has(input:disabled)":{cursor:"not-allowed",pointerEvents:"none","& .mantine-MultiSelect-input":{backgroundColor:e.colorScheme==="dark"?e.colors.dark[6]:e.colors.gray[1],color:e.colors.dark[2],opacity:.6,"&::placeholder":{color:e.colors.dark[2]}},"& .mantine-MultiSelect-defaultValue":{backgroundColor:e.colorScheme==="dark"?e.colors.dark[5]:e.colors.gray[3],color:e.colorScheme==="dark"?e.colors.dark[1]:e.colors.gray[7]}}},values:{minHeight:`calc(${L({size:r,sizes:Et})} - ${j(2)})`,display:"flex",alignItems:"center",flexWrap:"wrap",marginLeft:`calc(-${e.spacing.xs} / 2)`,boxSizing:"border-box","&[data-clearable]":{marginRight:L({size:r,sizes:Et})}},value:{margin:`calc(${e.spacing.xs} / 2 - ${j(2)}) calc(${e.spacing.xs} / 2)`},searchInput:XJ(YJ({},e.fn.fontStyles()),{flex:1,minWidth:j(60),backgroundColor:"transparent",border:0,outline:0,fontSize:L({size:r,sizes:e.fontSizes}),padding:0,marginLeft:`calc(${e.spacing.xs} / 2)`,appearance:"none",color:"inherit",maxHeight:L({size:r,sizes:TD}),"&::placeholder":{opacity:1,color:t?e.colors.red[e.fn.primaryShade()]:e.colorScheme==="dark"?e.colors.dark[3]:e.colors.gray[5]},"&:disabled":{cursor:"not-allowed",pointerEvents:"none"}}),searchInputEmpty:{width:"100%"},searchInputInputHidden:{flex:0,width:0,minWidth:0,margin:0,overflow:"hidden"},searchInputPointer:{cursor:"pointer","&:disabled":{cursor:"not-allowed",pointerEvents:"none"}},input:{cursor:"pointer","&:disabled":{cursor:"not-allowed",pointerEvents:"none"}}}));const ZJ=JJ;var eZ=Object.defineProperty,tZ=Object.defineProperties,rZ=Object.getOwnPropertyDescriptors,$p=Object.getOwnPropertySymbols,BD=Object.prototype.hasOwnProperty,UD=Object.prototype.propertyIsEnumerable,YP=(e,t,r)=>t in e?eZ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Da=(e,t)=>{for(var r in t||(t={}))BD.call(t,r)&&YP(e,r,t[r]);if($p)for(var r of $p(t))UD.call(t,r)&&YP(e,r,t[r]);return e},XP=(e,t)=>tZ(e,rZ(t)),nZ=(e,t)=>{var r={};for(var n in e)BD.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&$p)for(var n of $p(e))t.indexOf(n)<0&&UD.call(e,n)&&(r[n]=e[n]);return r};function oZ(e,t,r){return t?!1:r.label.toLowerCase().trim().includes(e.toLowerCase().trim())}function iZ(e,t){return!!e&&!t.some(r=>r.value.toLowerCase()===e.toLowerCase())}function JP(e,t){if(!Array.isArray(e))return;if(t.length===0)return[];const r=t.map(n=>typeof n=="object"?n.value:n);return e.filter(n=>r.includes(n))}const aZ={size:"sm",valueComponent:ND,itemComponent:nR,transitionProps:{transition:"fade",duration:0},maxDropdownHeight:220,shadow:"sm",searchable:!1,filter:oZ,limit:1/0,clearSearchOnChange:!0,clearable:!1,clearSearchOnBlur:!1,disabled:!1,initiallyOpened:!1,creatable:!1,shouldCreate:iZ,switchDirectionOnFlip:!1,zIndex:Tn("popover"),selectOnBlur:!1,positionDependencies:[],dropdownPosition:"flip"},lm=f.forwardRef((e,t)=>{const r=H("MultiSelect",aZ,e),{className:n,style:o,required:i,label:a,description:l,size:c,error:u,classNames:d,styles:p,wrapperProps:h,value:m,defaultValue:g,data:v,onChange:_,valueComponent:y,itemComponent:x,id:w,transitionProps:b,maxDropdownHeight:C,shadow:O,nothingFound:P,onFocus:E,onBlur:$,searchable:k,placeholder:I,filter:T,limit:N,clearSearchOnChange:A,clearable:z,clearSearchOnBlur:G,variant:X,onSearchChange:R,searchValue:M,disabled:V,initiallyOpened:Q,radius:Z,icon:_e,rightSection:xe,rightSectionWidth:Ve,creatable:Me,getCreateLabel:gt,shouldCreate:Nt,onCreate:ke,sx:Ht,dropdownComponent:Lr,onDropdownClose:lr,onDropdownOpen:qt,maxSelectedValues:At,withinPortal:ao,portalProps:Uo,switchDirectionOnFlip:Je,zIndex:so,selectOnBlur:_r,name:cr,dropdownPosition:Ti,errorProps:Zr,labelProps:lo,descriptionProps:ee,form:me,positionDependencies:ft,onKeyDown:Be,unstyled:bt,inputContainer:Dn,inputWrapperOrder:vn,readOnly:zr,withAsterisk:Wo,clearButtonProps:Nn,hoverOnSearchChange:An,disableSelectedItemFiltering:co}=r,Ii=nZ(r,["className","style","required","label","description","size","error","classNames","styles","wrapperProps","value","defaultValue","data","onChange","valueComponent","itemComponent","id","transitionProps","maxDropdownHeight","shadow","nothingFound","onFocus","onBlur","searchable","placeholder","filter","limit","clearSearchOnChange","clearable","clearSearchOnBlur","variant","onSearchChange","searchValue","disabled","initiallyOpened","radius","icon","rightSection","rightSectionWidth","creatable","getCreateLabel","shouldCreate","onCreate","sx","dropdownComponent","onDropdownClose","onDropdownOpen","maxSelectedValues","withinPortal","portalProps","switchDirectionOnFlip","zIndex","selectOnBlur","name","dropdownPosition","errorProps","labelProps","descriptionProps","form","positionDependencies","onKeyDown","unstyled","inputContainer","inputWrapperOrder","readOnly","withAsterisk","clearButtonProps","hoverOnSearchChange","disableSelectedItemFiltering"]),{classes:ur,cx:Ho,theme:ja}=ZJ({invalid:!!u},{name:"MultiSelect",classNames:d,styles:p,unstyled:bt,size:c,variant:X}),{systemStyles:Mm,rest:D}=oo(Ii),F=f.useRef(),U=f.useRef({}),K=Nr(w),[te,ge]=f.useState(Q),[we,he]=f.useState(-1),[fe,Re]=f.useState("column"),[Ge,Pe]=Tr({value:M,defaultValue:"",finalValue:void 0,onChange:R}),[Qe,Ze]=f.useState(!1),{scrollIntoView:Tt,targetRef:Fr,scrollableRef:Di}=cL({duration:0,offset:5,cancelable:!1,isList:!0}),Oa=Me&&typeof gt=="function";let Mn=null;const Vr=v.map(ye=>typeof ye=="string"?{label:ye,value:ye}:ye),qo=w9({data:Vr}),[et,Ln]=Tr({value:JP(m,v),defaultValue:JP(g,v),finalValue:[],onChange:_}),dr=f.useRef(!!At&&At<et.length),uo=ye=>{if(!zr){const tt=et.filter(en=>en!==ye);Ln(tt),At&&tt.length<At&&(dr.current=!1)}},Ke=ye=>{Pe(ye.currentTarget.value),!V&&!dr.current&&k&&ge(!0)},Sr=ye=>{typeof E=="function"&&E(ye),!V&&!dr.current&&k&&ge(!0)},Ee=$J({data:qo,searchable:k,searchValue:Ge,limit:N,filter:T,value:et,disableSelectedItemFiltering:co});Oa&&Nt(Ge,qo)&&(Mn=gt(Ge),Ee.push({label:Ge,value:Ge,creatable:!0}));const fr=Math.min(we,Ee.length-1),Us=(ye,tt,en)=>{let Go=ye;for(;en(Go);)if(Go=tt(Go),!Ee[Go].disabled)return Go;return ye};ln(()=>{he(An&&Ge?0:-1)},[Ge,An]),ln(()=>{!V&&et.length>v.length&&ge(!1),At&&et.length<At&&(dr.current=!1),At&&et.length>=At&&(dr.current=!0,ge(!1))},[et]);const Ca=ye=>{if(!zr)if(A&&Pe(""),et.includes(ye.value))uo(ye.value);else{if(ye.creatable&&typeof ke=="function"){const tt=ke(ye.value);typeof tt<"u"&&tt!==null&&Ln(typeof tt=="string"?[...et,tt]:[...et,tt.value])}else Ln([...et,ye.value]);et.length===At-1&&(dr.current=!0,ge(!1)),Ee.length===1&&ge(!1)}},aA=ye=>{typeof $=="function"&&$(ye),_r&&Ee[fr]&&te&&Ca(Ee[fr]),G&&Pe(""),ge(!1)},sA=ye=>{if(Qe||(Be==null||Be(ye),zr)||ye.key!=="Backspace"&&At&&dr.current)return;const tt=fe==="column",en=()=>{he(Ni=>{var fo;const Ws=Us(Ni,Ai=>Ai+1,Ai=>Ai<Ee.length-1);return te&&(Fr.current=U.current[(fo=Ee[Ws])==null?void 0:fo.value],Tt({alignment:tt?"end":"start"})),Ws})},Go=()=>{he(Ni=>{var fo;const Ws=Us(Ni,Ai=>Ai-1,Ai=>Ai>0);return te&&(Fr.current=U.current[(fo=Ee[Ws])==null?void 0:fo.value],Tt({alignment:tt?"start":"end"})),Ws})};switch(ye.key){case"ArrowUp":{ye.preventDefault(),ge(!0),tt?Go():en();break}case"ArrowDown":{ye.preventDefault(),ge(!0),tt?en():Go();break}case"Enter":{ye.preventDefault(),Ee[fr]&&te?Ca(Ee[fr]):ge(!0);break}case" ":{k||(ye.preventDefault(),Ee[fr]&&te?Ca(Ee[fr]):ge(!0));break}case"Backspace":{et.length>0&&Ge.length===0&&(Ln(et.slice(0,-1)),ge(!0),At&&(dr.current=!1));break}case"Home":{if(!k){ye.preventDefault(),te||ge(!0);const Ni=Ee.findIndex(fo=>!fo.disabled);he(Ni),Tt({alignment:tt?"end":"start"})}break}case"End":{if(!k){ye.preventDefault(),te||ge(!0);const Ni=Ee.map(fo=>!!fo.disabled).lastIndexOf(!1);he(Ni),Tt({alignment:tt?"end":"start"})}break}case"Escape":ge(!1)}},lA=et.map(ye=>{let tt=qo.find(en=>en.value===ye&&!en.disabled);return!tt&&Oa&&(tt={value:ye,label:ye}),tt}).filter(ye=>!!ye).map((ye,tt)=>S.createElement(y,XP(Da({},ye),{variant:X,disabled:V,className:ur.value,readOnly:zr,onRemove:en=>{en.preventDefault(),en.stopPropagation(),uo(ye.value)},key:ye.value,size:c,styles:p,classNames:d,radius:Z,index:tt}))),cA=ye=>et.includes(ye),uA=()=>{var ye;Pe(""),Ln([]),(ye=F.current)==null||ye.focus(),At&&(dr.current=!1)},Jc=!zr&&(Ee.length>0?te:te&&!!P);return ln(()=>{const ye=Jc?qt:lr;typeof ye=="function"&&ye()},[Jc]),S.createElement(Ut.Wrapper,Da(Da({required:i,id:K,label:a,error:u,description:l,size:c,className:n,style:o,classNames:d,styles:p,__staticSelector:"MultiSelect",sx:Ht,errorProps:Zr,descriptionProps:ee,labelProps:lo,inputContainer:Dn,inputWrapperOrder:vn,unstyled:bt,withAsterisk:Wo,variant:X},Mm),h),S.createElement(Ll,{opened:Jc,transitionProps:b,shadow:"sm",withinPortal:ao,portalProps:Uo,__staticSelector:"MultiSelect",onDirectionChange:Re,switchDirectionOnFlip:Je,zIndex:so,dropdownPosition:Ti,positionDependencies:[...ft,Ge],classNames:d,styles:p,unstyled:bt,variant:X},S.createElement(Ll.Target,null,S.createElement("div",{className:ur.wrapper,role:"combobox","aria-haspopup":"listbox","aria-owns":te&&Jc?`${K}-items`:null,"aria-controls":K,"aria-expanded":te,onMouseLeave:()=>he(-1),tabIndex:-1},S.createElement("input",{type:"hidden",name:cr,value:et.join(","),form:me,disabled:V}),S.createElement(Ut,Da({__staticSelector:"MultiSelect",style:{overflow:"hidden"},component:"div",multiline:!0,size:c,variant:X,disabled:V,error:u,required:i,radius:Z,icon:_e,unstyled:bt,onMouseDown:ye=>{var tt;ye.preventDefault(),!V&&!dr.current&&ge(!te),(tt=F.current)==null||tt.focus()},classNames:XP(Da({},d),{input:Ho({[ur.input]:!k},d==null?void 0:d.input)})},VD({theme:ja,rightSection:xe,rightSectionWidth:Ve,styles:p,size:c,shouldClear:z&&et.length>0,onClear:uA,error:u,disabled:V,clearButtonProps:Nn,readOnly:zr})),S.createElement("div",{className:ur.values,"data-clearable":z||void 0},lA,S.createElement("input",Da({ref:Is(t,F),type:"search",id:K,className:Ho(ur.searchInput,{[ur.searchInputPointer]:!k,[ur.searchInputInputHidden]:!te&&et.length>0||!k&&et.length>0,[ur.searchInputEmpty]:et.length===0}),onKeyDown:sA,value:Ge,onChange:Ke,onFocus:Sr,onBlur:aA,readOnly:!k||dr.current||zr,placeholder:et.length===0?I:void 0,disabled:V,"data-mantine-stop-propagation":te,autoComplete:"off",onCompositionStart:()=>Ze(!0),onCompositionEnd:()=>Ze(!1)},D)))))),S.createElement(Ll.Dropdown,{component:Lr||U0,maxHeight:C,direction:fe,id:K,innerRef:Di,__staticSelector:"MultiSelect",classNames:d,styles:p},S.createElement(eR,{data:Ee,hovered:fr,classNames:d,styles:p,uuid:K,__staticSelector:"MultiSelect",onItemHover:he,onItemSelect:Ca,itemsRefs:U,itemComponent:x,size:c,nothingFound:P,isItemSelected:cA,creatable:Me&&!!Mn,createLabel:Mn,unstyled:bt,variant:X}))))});lm.displayName="@mantine/core/MultiSelect";var sZ=Object.defineProperty,lZ=Object.defineProperties,cZ=Object.getOwnPropertyDescriptors,kp=Object.getOwnPropertySymbols,WD=Object.prototype.hasOwnProperty,HD=Object.prototype.propertyIsEnumerable,ZP=(e,t,r)=>t in e?sZ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,zu=(e,t)=>{for(var r in t||(t={}))WD.call(t,r)&&ZP(e,r,t[r]);if(kp)for(var r of kp(t))HD.call(t,r)&&ZP(e,r,t[r]);return e},ej=(e,t)=>lZ(e,cZ(t)),uZ=(e,t)=>{var r={};for(var n in e)WD.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&kp)for(var n of kp(e))t.indexOf(n)<0&&HD.call(e,n)&&(r[n]=e[n]);return r};const dZ={size:"sm"},mt=f.forwardRef((e,t)=>{const r=nT("NativeSelect",dZ,e),{inputProps:n,wrapperProps:o,data:i,onChange:a,value:l,classNames:c,styles:u,rightSection:d,rightSectionWidth:p}=r,h=uZ(r,["inputProps","wrapperProps","data","onChange","value","classNames","styles","rightSection","rightSectionWidth"]),m=Jt(),v=i.map(_=>typeof _=="string"?{label:_,value:_}:_).map(_=>S.createElement("option",{key:_.value,value:_.value,disabled:_.disabled},_.label));return S.createElement(Ut.Wrapper,ej(zu({},o),{__staticSelector:"NativeSelect"}),S.createElement(Ut,zu(ej(zu(zu({},n),h),{onChange:a,component:"select",ref:t,value:l===null?"":l,__staticSelector:"NativeSelect",pointer:m.cursorType==="pointer"}),VD({theme:m,rightSection:d,rightSectionWidth:p,styles:u,shouldClear:!1,size:n.size,error:o.error,readOnly:!1})),v))});mt.displayName="@mantine/core/NativeSelect";var fZ=W((e,{color:t,radius:r,withTitle:n})=>{const o=e.fn.radius(r),i=e.fn.variant({variant:"filled",color:t});return{closeButton:e.fn.hover({backgroundColor:e.colorScheme==="dark"?e.colors.dark[8]:e.colors.gray[0]}),icon:{boxSizing:"border-box",marginRight:e.spacing.md,width:j(28),height:j(28),borderRadius:j(28),display:"flex",flex:"none",alignItems:"center",justifyContent:"center",backgroundColor:i.background,color:e.white},root:{overflow:"hidden",boxSizing:"border-box",position:"relative",display:"flex",alignItems:"center",paddingLeft:j(22),paddingRight:e.spacing.xs,paddingTop:e.spacing.xs,paddingBottom:e.spacing.xs,borderRadius:o,backgroundColor:e.colorScheme==="dark"?e.colors.dark[6]:e.white,boxShadow:e.shadows.lg,"&::before":{content:'""',display:"block",position:"absolute",width:j(6),top:o,bottom:o,left:j(4),borderRadius:o,backgroundColor:i.background},"&[data-with-icon]":{paddingLeft:e.spacing.xs,"&::before":{display:"none"}},"&[data-with-border]":{border:`${j(1)} solid ${e.colorScheme==="dark"?e.colors.dark[4]:e.colors.gray[3]}`}},body:{flex:1,overflow:"hidden",marginRight:e.spacing.xs},loader:{marginRight:e.spacing.md},title:{lineHeight:1.4,marginBottom:j(2),overflow:"hidden",textOverflow:"ellipsis",color:e.colorScheme==="dark"?e.white:e.colors.gray[9]},description:{color:n?e.colorScheme==="dark"?e.colors.dark[2]:e.colors.gray[6]:e.colorScheme==="dark"?e.colors.dark[0]:e.black,lineHeight:1.4,overflow:"hidden",textOverflow:"ellipsis"}}});const pZ=fZ;var hZ=Object.defineProperty,mZ=Object.defineProperties,gZ=Object.getOwnPropertyDescriptors,Rp=Object.getOwnPropertySymbols,qD=Object.prototype.hasOwnProperty,GD=Object.prototype.propertyIsEnumerable,tj=(e,t,r)=>t in e?hZ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,rj=(e,t)=>{for(var r in t||(t={}))qD.call(t,r)&&tj(e,r,t[r]);if(Rp)for(var r of Rp(t))GD.call(t,r)&&tj(e,r,t[r]);return e},vZ=(e,t)=>mZ(e,gZ(t)),yZ=(e,t)=>{var r={};for(var n in e)qD.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&Rp)for(var n of Rp(e))t.indexOf(n)<0&&GD.call(e,n)&&(r[n]=e[n]);return r};const xZ={withCloseButton:!0},QD=f.forwardRef((e,t)=>{const r=H("Notification",xZ,e),{className:n,color:o,radius:i,loading:a,withCloseButton:l,withBorder:c,title:u,icon:d,children:p,onClose:h,closeButtonProps:m,classNames:g,styles:v,unstyled:_,variant:y}=r,x=yZ(r,["className","color","radius","loading","withCloseButton","withBorder","title","icon","children","onClose","closeButtonProps","classNames","styles","unstyled","variant"]),{classes:w,cx:b}=pZ({color:o,radius:i,withTitle:!!u},{name:"Notification",classNames:g,styles:v,unstyled:_,variant:y});return S.createElement(ie,rj({className:b(w.root,n),"data-with-icon":!!d||a||void 0,"data-with-border":c||void 0,role:"alert",ref:t},x),d&&!a&&S.createElement("div",{className:w.icon},d),a&&S.createElement(hn,{size:28,color:o,className:w.loader}),S.createElement("div",{className:w.body},u&&S.createElement(oe,{className:w.title,size:"sm",weight:500},u),S.createElement(oe,{color:"dimmed",className:w.description,size:"sm"},p)),l&&S.createElement(Ec,vZ(rj({iconSize:16,color:"gray"},m),{onClick:h,className:w.closeButton})))});QD.displayName="@mantine/core/Notification";var wZ=Object.defineProperty,bZ=Object.defineProperties,_Z=Object.getOwnPropertyDescriptors,Tp=Object.getOwnPropertySymbols,KD=Object.prototype.hasOwnProperty,YD=Object.prototype.propertyIsEnumerable,nj=(e,t,r)=>t in e?wZ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,$g=(e,t)=>{for(var r in t||(t={}))KD.call(t,r)&&nj(e,r,t[r]);if(Tp)for(var r of Tp(t))YD.call(t,r)&&nj(e,r,t[r]);return e},SZ=(e,t)=>bZ(e,_Z(t)),PZ=(e,t)=>{var r={};for(var n in e)KD.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&Tp)for(var n of Tp(e))t.indexOf(n)<0&&YD.call(e,n)&&(r[n]=e[n]);return r};const jZ={type:"text",size:"sm",__staticSelector:"TextInput"},le=f.forwardRef((e,t)=>{const r=nT("TextInput",jZ,e),{inputProps:n,wrapperProps:o}=r,i=PZ(r,["inputProps","wrapperProps"]);return S.createElement(Ut.Wrapper,$g({},o),S.createElement(Ut,SZ($g($g({},n),i),{ref:t})))});le.displayName="@mantine/core/TextInput";const[OZ,cm]=Do("Pagination.Root component was not found in tree"),CZ={siblings:1,boundaries:1};function XD(e){const{total:t,value:r,defaultValue:n,onChange:o,disabled:i,children:a,siblings:l,boundaries:c,color:u,radius:d,onNextPage:p,onPreviousPage:h,onFirstPage:m,onLastPage:g,getItemProps:v,classNames:_,styles:y,unstyled:x,variant:w,size:b}=H("PaginationRoot",CZ,e),{range:C,setPage:O,next:P,previous:E,active:$,first:k,last:I}=nL({page:r,initialPage:n,onChange:o,total:t,siblings:l,boundaries:c}),T=Wr(p,P),N=Wr(h,E),A=Wr(m,k),z=Wr(g,I);return S.createElement(OZ,{value:{total:t,range:C,active:$,disabled:i,color:u,radius:d,getItemProps:v,onChange:O,onNext:T,onPrevious:N,onFirst:A,onLast:z,stylesApi:{name:"Pagination",classNames:_,styles:y,unstyled:x,variant:w,size:b}}},a)}const cc={xs:j(22),sm:j(26),md:j(32),lg:j(38),xl:j(44)};var EZ=W((e,{color:t,radius:r,withPadding:n},{size:o})=>{const i=e.fn.variant({color:t,variant:"filled"});return{control:{cursor:"pointer",userSelect:"none",display:"flex",alignItems:"center",justifyContent:"center",border:`${j(1)} solid ${e.colorScheme==="dark"?e.colors.dark[4]:e.colors.gray[4]}`,color:e.colorScheme==="dark"?e.colors.dark[0]:e.black,height:L({size:o,sizes:cc}),minWidth:L({size:o,sizes:cc}),padding:n?`0 calc(${L({size:o,sizes:e.spacing})} / 2)`:void 0,fontSize:L({size:o,sizes:e.fontSizes}),borderRadius:e.fn.radius(r),lineHeight:1,backgroundColor:e.colorScheme==="dark"?e.colors.dark[6]:e.white,"&:not([data-disabled])":e.fn.hover({backgroundColor:e.colorScheme==="dark"?e.colors.dark[5]:e.colors.gray[0]}),"&:active:not([data-disabled])":e.activeStyles,"&[data-disabled]":{opacity:.4,cursor:"not-allowed",pointerEvents:"none"},"&[data-active]":{borderColor:"transparent",color:i.color,backgroundColor:i.background,"&:not([data-disabled])":e.fn.hover({backgroundColor:i.hover})}}}});const $Z=EZ;var kZ=Object.defineProperty,RZ=Object.defineProperties,TZ=Object.getOwnPropertyDescriptors,Ip=Object.getOwnPropertySymbols,JD=Object.prototype.hasOwnProperty,ZD=Object.prototype.propertyIsEnumerable,oj=(e,t,r)=>t in e?kZ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,IZ=(e,t)=>{for(var r in t||(t={}))JD.call(t,r)&&oj(e,r,t[r]);if(Ip)for(var r of Ip(t))ZD.call(t,r)&&oj(e,r,t[r]);return e},DZ=(e,t)=>RZ(e,TZ(t)),NZ=(e,t)=>{var r={};for(var n in e)JD.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&Ip)for(var n of Ip(e))t.indexOf(n)<0&&ZD.call(e,n)&&(r[n]=e[n]);return r};const AZ={withPadding:!0},um=f.forwardRef((e,t)=>{const r=H("PaginationControl",AZ,e),{active:n,className:o,disabled:i,withPadding:a}=r,l=NZ(r,["active","className","disabled","withPadding"]),c=cm(),{classes:u,cx:d}=$Z({color:c.color,radius:c.radius,withPadding:a},c.stylesApi);return S.createElement(So,DZ(IZ({},l),{disabled:i,"data-active":n||void 0,"data-disabled":i||void 0,ref:t,className:d(u.control,o)}))});um.displayName="@mantine/core/PaginationControl";var MZ=Object.defineProperty,LZ=Object.defineProperties,zZ=Object.getOwnPropertyDescriptors,Dp=Object.getOwnPropertySymbols,eN=Object.prototype.hasOwnProperty,tN=Object.prototype.propertyIsEnumerable,ij=(e,t,r)=>t in e?MZ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,ia=(e,t)=>{for(var r in t||(t={}))eN.call(t,r)&&ij(e,r,t[r]);if(Dp)for(var r of Dp(t))tN.call(t,r)&&ij(e,r,t[r]);return e},Nc=(e,t)=>LZ(e,zZ(t)),FZ=(e,t)=>{var r={};for(var n in e)eN.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&Dp)for(var n of Dp(e))t.indexOf(n)<0&&tN.call(e,n)&&(r[n]=e[n]);return r};function rN(e){return`calc(${L({size:e,sizes:cc})} / 2)`}function Ac(e){var t=e,{size:r,style:n,children:o,path:i}=t,a=FZ(t,["size","style","children","path"]);return S.createElement("svg",ia({viewBox:"0 0 16 16",xmlns:"http://www.w3.org/2000/svg",style:ia({width:r,height:r},n)},a),S.createElement("path",{d:i,fill:"currentColor"}))}const VZ=e=>S.createElement(Ac,Nc(ia({},e),{path:"M8.781 8l-3.3-3.3.943-.943L10.667 8l-4.243 4.243-.943-.943 3.3-3.3z"})),BZ=e=>S.createElement(Ac,Nc(ia({},e),{path:"M7.219 8l3.3 3.3-.943.943L5.333 8l4.243-4.243.943.943-3.3 3.3z"})),UZ=e=>S.createElement(Ac,Nc(ia({},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"})),WZ=e=>S.createElement(Ac,Nc(ia({},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"})),HZ=e=>S.createElement(Ac,Nc(ia({},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"}));var qZ=W((e,t,{size:r})=>({dots:{height:L({size:r,sizes:cc}),minWidth:L({size:r,sizes:cc}),display:"flex",alignItems:"center",justifyContent:"center",pointerEvents:"none"}}));const GZ=qZ;var QZ=Object.defineProperty,Np=Object.getOwnPropertySymbols,nN=Object.prototype.hasOwnProperty,oN=Object.prototype.propertyIsEnumerable,aj=(e,t,r)=>t in e?QZ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,KZ=(e,t)=>{for(var r in t||(t={}))nN.call(t,r)&&aj(e,r,t[r]);if(Np)for(var r of Np(t))oN.call(t,r)&&aj(e,r,t[r]);return e},YZ=(e,t)=>{var r={};for(var n in e)nN.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&Np)for(var n of Np(e))t.indexOf(n)<0&&oN.call(e,n)&&(r[n]=e[n]);return r};const XZ={icon:HZ},fx=f.forwardRef((e,t)=>{const r=H("PaginationDots",XZ,e),{className:n,icon:o}=r,i=YZ(r,["className","icon"]),a=cm(),{classes:l,cx:c}=GZ(null,a.stylesApi);return S.createElement(ie,KZ({ref:t,className:c(l.dots,n)},i),S.createElement(o,{size:rN(a.stylesApi.size)}))});fx.displayName="@mantine/core/PaginationDots";var JZ=Object.defineProperty,sj=Object.getOwnPropertySymbols,ZZ=Object.prototype.hasOwnProperty,eee=Object.prototype.propertyIsEnumerable,lj=(e,t,r)=>t in e?JZ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,tee=(e,t)=>{for(var r in t||(t={}))ZZ.call(t,r)&&lj(e,r,t[r]);if(sj)for(var r of sj(t))eee.call(t,r)&&lj(e,r,t[r]);return e};function px({dotsIcon:e}){const t=cm(),r=t.range.map((n,o)=>{var i;return n==="dots"?S.createElement(fx,{icon:e,key:o}):S.createElement(um,tee({key:o,active:n===t.active,"aria-current":n===t.active?"page":void 0,onClick:()=>t.onChange(n),disabled:t.disabled},(i=t.getItemProps)==null?void 0:i.call(t,n)),n)});return S.createElement(S.Fragment,null,r)}px.displayName="@mantine/core/PaginationItems";var ree=W(e=>({icon:{transform:e.dir==="rtl"?"rotate(180deg)":"unset"}}));const nee=ree;var oee=Object.defineProperty,Ap=Object.getOwnPropertySymbols,iN=Object.prototype.hasOwnProperty,aN=Object.prototype.propertyIsEnumerable,cj=(e,t,r)=>t in e?oee(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,iee=(e,t)=>{for(var r in t||(t={}))iN.call(t,r)&&cj(e,r,t[r]);if(Ap)for(var r of Ap(t))aN.call(t,r)&&cj(e,r,t[r]);return e},aee=(e,t)=>{var r={};for(var n in e)iN.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&Ap)for(var n of Ap(e))t.indexOf(n)<0&&aN.call(e,n)&&(r[n]=e[n]);return r};function dm({icon:e,name:t,action:r,type:n}){const o={icon:e},i=f.forwardRef((a,l)=>{const c=H(t,o,a),{icon:u}=c,d=aee(c,["icon"]),{classes:p}=nee(),h=cm(),m=n==="next"?h.active===h.total:h.active===1;return S.createElement(um,iee({disabled:h.disabled||m,ref:l,onClick:h[r],withPadding:!1},d),S.createElement(u,{className:p.icon,size:rN(h.stylesApi.size)}))});return i.displayName=`@mantine/core/${t}`,i}const sN=dm({icon:VZ,name:"PaginationNext",action:"onNext",type:"next"}),lN=dm({icon:BZ,name:"PaginationPrevious",action:"onPrevious",type:"previous"}),cN=dm({icon:UZ,name:"PaginationFirst",action:"onFirst",type:"previous"}),uN=dm({icon:WZ,name:"PaginationLast",action:"onLast",type:"next"});var see=Object.defineProperty,Mp=Object.getOwnPropertySymbols,dN=Object.prototype.hasOwnProperty,fN=Object.prototype.propertyIsEnumerable,uj=(e,t,r)=>t in e?see(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,ll=(e,t)=>{for(var r in t||(t={}))dN.call(t,r)&&uj(e,r,t[r]);if(Mp)for(var r of Mp(t))fN.call(t,r)&&uj(e,r,t[r]);return e},lee=(e,t)=>{var r={};for(var n in e)dN.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&Mp)for(var n of Mp(e))t.indexOf(n)<0&&fN.call(e,n)&&(r[n]=e[n]);return r};const cee={withControls:!0,siblings:1,boundaries:1};function io(e){const t=H("Pagination",cee,e),{withEdges:r,withControls:n,classNames:o,styles:i,unstyled:a,variant:l,size:c,total:u,value:d,defaultValue:p,onChange:h,disabled:m,siblings:g,boundaries:v,color:_,radius:y,onNextPage:x,onPreviousPage:w,onFirstPage:b,onLastPage:C,getItemProps:O,getControlProps:P,spacing:E,nextIcon:$,previousIcon:k,lastIcon:I,firstIcon:T,dotsIcon:N}=t,A=lee(t,["withEdges","withControls","classNames","styles","unstyled","variant","size","total","value","defaultValue","onChange","disabled","siblings","boundaries","color","radius","onNextPage","onPreviousPage","onFirstPage","onLastPage","getItemProps","getControlProps","spacing","nextIcon","previousIcon","lastIcon","firstIcon","dotsIcon"]),z=Jt();return u<=0?null:S.createElement(XD,{classNames:o,styles:i,unstyled:a,variant:l,size:c,total:u,value:d,defaultValue:p,onChange:h,disabled:m,siblings:g,boundaries:v,color:_,radius:y,onNextPage:x,onPreviousPage:w,onFirstPage:b,onLastPage:C,getItemProps:O},S.createElement(Y,ll({spacing:E??`calc(${L({size:c,sizes:z.spacing})} / 2)`},A),r&&S.createElement(cN,ll({icon:T},P==null?void 0:P("first"))),n&&S.createElement(lN,ll({icon:k},P==null?void 0:P("previous"))),S.createElement(px,{dotsIcon:N}),n&&S.createElement(sN,ll({icon:$},P==null?void 0:P("next"))),r&&S.createElement(uN,ll({icon:I},P==null?void 0:P("last")))))}io.displayName="@mantine/core/Pagination";io.Root=XD;io.Items=px;io.Control=um;io.Dots=fx;io.Next=sN;io.Previous=lN;io.Last=uN;io.First=cN;const uee=({reveal:e,size:t})=>S.createElement("svg",{viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{width:t,height:t}},S.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 dee=Object.defineProperty,fee=Object.defineProperties,pee=Object.getOwnPropertyDescriptors,dj=Object.getOwnPropertySymbols,hee=Object.prototype.hasOwnProperty,mee=Object.prototype.propertyIsEnumerable,fj=(e,t,r)=>t in e?dee(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,kg=(e,t)=>{for(var r in t||(t={}))hee.call(t,r)&&fj(e,r,t[r]);if(dj)for(var r of dj(t))mee.call(t,r)&&fj(e,r,t[r]);return e},pj=(e,t)=>fee(e,pee(t)),gee=W((e,{rightSectionWidth:t},{size:r})=>({visibilityToggle:{},input:{position:"relative",overflow:"hidden"},innerInput:pj(kg(kg({},e.fn.fontStyles()),e.fn.cover(0)),{backgroundColor:"transparent",border:`${j(1)} solid transparent`,borderLeftWidth:0,borderRightWidth:0,boxSizing:"border-box",display:"block",width:`calc(100% - ${j(t)})`,paddingLeft:`calc(${L({size:r,sizes:Et})} / 3)`,fontSize:L({size:r,sizes:e.fontSizes}),height:`calc(${L({size:r,sizes:Et})} - ${j(2)})`,lineHeight:`calc(${L({size:r,sizes:Et})} - ${j(4)})`,color:e.colorScheme==="dark"?e.colors.dark[0]:e.black,"&::-ms-reveal, &::-ms-clear":{display:"none"},"&:focus":{outline:0},"&:disabled":{cursor:"not-allowed",pointerEvents:"none",backgroundColor:e.colorScheme==="dark"?e.colors.dark[6]:e.colors.gray[1],color:e.colors.dark[2],opacity:.6,"&::placeholder":{color:e.colors.dark[2]}},"&::placeholder":pj(kg({},e.fn.placeholderStyles()),{opacity:1}),"&[data-invalid]":{color:e.fn.variant({variant:"filled",color:"red"}).background,"&::placeholder":{opacity:1,color:e.fn.variant({variant:"filled",color:"red"}).background}},"&[data-with-icon]":{paddingLeft:L({size:r,sizes:Et})}})}));const vee=gee;var yee=Object.defineProperty,xee=Object.defineProperties,wee=Object.getOwnPropertyDescriptors,Lp=Object.getOwnPropertySymbols,pN=Object.prototype.hasOwnProperty,hN=Object.prototype.propertyIsEnumerable,hj=(e,t,r)=>t in e?yee(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Fu=(e,t)=>{for(var r in t||(t={}))pN.call(t,r)&&hj(e,r,t[r]);if(Lp)for(var r of Lp(t))hN.call(t,r)&&hj(e,r,t[r]);return e},bee=(e,t)=>xee(e,wee(t)),_ee=(e,t)=>{var r={};for(var n in e)pN.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&Lp)for(var n of Lp(e))t.indexOf(n)<0&&hN.call(e,n)&&(r[n]=e[n]);return r};const See={xs:j(22),sm:j(26),md:j(28),lg:j(32),xl:j(40)},Pee={xs:j(12),sm:j(15),md:j(17),lg:j(19),xl:j(21)},jee={xs:j(28),sm:j(32),md:j(34),lg:j(44),xl:j(54)},Oee={size:"sm",toggleTabIndex:-1,visibilityToggleIcon:uee,__staticSelector:"PasswordInput"},Zn=f.forwardRef((e,t)=>{const r=H("PasswordInput",Oee,e),{radius:n,disabled:o,size:i,toggleTabIndex:a,className:l,id:c,label:u,error:d,required:p,style:h,icon:m,description:g,wrapperProps:v,classNames:_,styles:y,variant:x,visibilityToggleIcon:w,__staticSelector:b,sx:C,labelProps:O,descriptionProps:P,errorProps:E,unstyled:$,visibilityToggleLabel:k,withAsterisk:I,inputContainer:T,iconWidth:N,inputWrapperOrder:A,visible:z,defaultVisible:G,onVisibilityChange:X}=r,R=_ee(r,["radius","disabled","size","toggleTabIndex","className","id","label","error","required","style","icon","description","wrapperProps","classNames","styles","variant","visibilityToggleIcon","__staticSelector","sx","labelProps","descriptionProps","errorProps","unstyled","visibilityToggleLabel","withAsterisk","inputContainer","iconWidth","inputWrapperOrder","visible","defaultVisible","onVisibilityChange"]),M=L({size:i,sizes:jee}),{classes:V}=vee({rightSectionWidth:M},{name:"PasswordInput",classNames:_,styles:y,unstyled:$,size:i,variant:x}),Q=Nr(c),{systemStyles:Z,rest:_e}=oo(R),[xe,Ve]=Tr({value:z,defaultValue:G,finalValue:!1,onChange:X}),Me=()=>Ve(!xe),gt=S.createElement(vr,{className:V.visibilityToggle,tabIndex:a,radius:n,size:L({size:i,sizes:See}),"aria-hidden":!k,"aria-label":k,unstyled:$,onMouseDown:Nt=>{Nt.preventDefault(),Me()},onKeyDown:Nt=>{Nt.key===" "&&(Nt.preventDefault(),Me())}},S.createElement(w,{reveal:xe,size:L({size:i,sizes:Pee})}));return S.createElement(Ut.Wrapper,Fu(Fu({required:p,id:Q,label:u,error:d,description:g,size:i,className:l,style:h,classNames:_,styles:y,__staticSelector:b,sx:C,errorProps:E,descriptionProps:P,labelProps:O,unstyled:$,withAsterisk:I,inputWrapperOrder:A,inputContainer:T,variant:x},Z),v),S.createElement(Ut,{component:"div",error:d,icon:m,size:i,classNames:bee(Fu({},_),{input:V.input}),styles:y,radius:n,disabled:o,__staticSelector:b,rightSectionWidth:M,rightSection:!o&>,variant:x,unstyled:$,iconWidth:N},S.createElement("input",Fu({type:xe?"text":"password",required:p,"data-invalid":!!d||void 0,"data-with-icon":!!m||void 0,className:V.innerInput,disabled:o,id:Q,ref:t,autoComplete:"off"},_e))))});Zn.displayName="@mantine/core/PasswordInput";const mN=f.createContext(!1),Cee=mN.Provider,Eee=()=>f.useContext(mN);function gN({children:e,openDelay:t=0,closeDelay:r=0}){return S.createElement(Cee,{value:!0},S.createElement(uU,{delay:{open:t,close:r}},e))}gN.displayName="@mantine/core/TooltipGroup";var $ee=Object.defineProperty,kee=Object.defineProperties,Ree=Object.getOwnPropertyDescriptors,mj=Object.getOwnPropertySymbols,Tee=Object.prototype.hasOwnProperty,Iee=Object.prototype.propertyIsEnumerable,gj=(e,t,r)=>t in e?$ee(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,vj=(e,t)=>{for(var r in t||(t={}))Tee.call(t,r)&&gj(e,r,t[r]);if(mj)for(var r of mj(t))Iee.call(t,r)&&gj(e,r,t[r]);return e},Dee=(e,t)=>kee(e,Ree(t));function Nee(e,t){if(!t)return{backgroundColor:e.colorScheme==="dark"?e.colors.gray[2]:e.colors.gray[9],color:e.colorScheme==="dark"?e.black:e.white};const r=e.fn.variant({variant:"filled",color:t,primaryFallback:!1});return{backgroundColor:r.background,color:r.color}}var Aee=W((e,{color:t,radius:r,width:n,multiline:o})=>({tooltip:Dee(vj(vj({},e.fn.fontStyles()),Nee(e,t)),{lineHeight:e.lineHeight,fontSize:e.fontSizes.sm,borderRadius:e.fn.radius(r),padding:`calc(${e.spacing.xs} / 2) ${e.spacing.xs}`,position:"absolute",whiteSpace:o?"unset":"nowrap",pointerEvents:"none",width:n}),arrow:{backgroundColor:"inherit",border:0,zIndex:1}}));const vN=Aee,yN={children:"Tooltip component children should be an element or a component that accepts ref, fragments, strings, numbers and other primitive values are not supported"};function Mee({offset:e,position:t}){const[r,n]=f.useState(!1),o=f.useRef(),{x:i,y:a,reference:l,floating:c,refs:u,update:d,placement:p}=tx({placement:t,middleware:[K0({crossAxis:!0,padding:5,rootBoundary:"document"})]}),h=p.includes("right")?e:t.includes("left")?e*-1:0,m=p.includes("bottom")?e:t.includes("top")?e*-1:0,g=f.useCallback(({clientX:v,clientY:_})=>{l({getBoundingClientRect(){return{width:0,height:0,x:v,y:_,left:v+h,top:_+m,right:v,bottom:_}}})},[l]);return f.useEffect(()=>{if(u.floating.current){const v=o.current;v.addEventListener("mousemove",g);const _=bo(u.floating.current);return _.forEach(y=>{y.addEventListener("scroll",d)}),()=>{v.removeEventListener("mousemove",g),_.forEach(y=>{y.removeEventListener("scroll",d)})}}},[l,u.floating.current,d,g,r]),{handleMouseMove:g,x:i,y:a,opened:r,setOpened:n,boundaryRef:o,floating:c}}var Lee=Object.defineProperty,zee=Object.defineProperties,Fee=Object.getOwnPropertyDescriptors,zp=Object.getOwnPropertySymbols,xN=Object.prototype.hasOwnProperty,wN=Object.prototype.propertyIsEnumerable,yj=(e,t,r)=>t in e?Lee(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Vu=(e,t)=>{for(var r in t||(t={}))xN.call(t,r)&&yj(e,r,t[r]);if(zp)for(var r of zp(t))wN.call(t,r)&&yj(e,r,t[r]);return e},Bu=(e,t)=>zee(e,Fee(t)),Vee=(e,t)=>{var r={};for(var n in e)xN.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&zp)for(var n of zp(e))t.indexOf(n)<0&&wN.call(e,n)&&(r[n]=e[n]);return r};const Bee={refProp:"ref",withinPortal:!0,offset:10,position:"right",zIndex:Tn("popover")};function bN(e){var t;const r=H("TooltipFloating",Bee,e),{children:n,refProp:o,withinPortal:i,portalProps:a,style:l,className:c,classNames:u,styles:d,unstyled:p,radius:h,color:m,label:g,offset:v,position:_,multiline:y,width:x,zIndex:w,disabled:b,variant:C}=r,O=Vee(r,["children","refProp","withinPortal","portalProps","style","className","classNames","styles","unstyled","radius","color","label","offset","position","multiline","width","zIndex","disabled","variant"]),{handleMouseMove:P,x:E,y:$,opened:k,boundaryRef:I,floating:T,setOpened:N}=Mee({offset:v,position:_}),{classes:A,cx:z}=vN({radius:h,color:m,multiline:y,width:x},{name:"TooltipFloating",classNames:u,styles:d,unstyled:p,variant:C});if(!Rs(n))throw new Error(yN.children);const G=Is(I,n.ref),X=M=>{var V,Q;(Q=(V=n.props).onMouseEnter)==null||Q.call(V,M),P(M),N(!0)},R=M=>{var V,Q;(Q=(V=n.props).onMouseLeave)==null||Q.call(V,M),N(!1)};return S.createElement(S.Fragment,null,S.createElement(Ms,Bu(Vu({},a),{withinPortal:i}),S.createElement(ie,Bu(Vu({},O),{ref:T,className:z(A.tooltip,c),style:Bu(Vu({},l),{zIndex:w,display:!b&&k?"block":"none",top:$??"",left:(t=Math.round(E))!=null?t:""})}),g)),f.cloneElement(n,Bu(Vu({},n.props),{[o]:G,onMouseEnter:X,onMouseLeave:R})))}bN.displayName="@mantine/core/TooltipFloating";function Uee(e){const[t,r]=f.useState(!1),o=typeof e.opened=="boolean"?e.opened:t,i=Eee(),a=Nr(),{delay:l,currentId:c,setCurrentId:u}=zR(),d=f.useCallback(E=>{r(E),E&&u(a)},[u,a]),{x:p,y:h,reference:m,floating:g,context:v,refs:_,update:y,placement:x,middlewareData:{arrow:{x:w,y:b}={}}}=tx({placement:e.position,open:o,onOpenChange:d,middleware:[OR(e.offset),K0({padding:8}),SR(),DR({element:e.arrowRef,padding:e.arrowOffset}),...e.inline?[jR()]:[]]}),{getReferenceProps:C,getFloatingProps:O}=_U([cU(v,{enabled:e.events.hover,delay:i?l:{open:e.openDelay,close:e.closeDelay},mouseOnly:!e.events.touch}),wU(v,{enabled:e.events.focus,keyboardOnly:!0}),bU(v,{role:"tooltip"}),xU(v,{enabled:typeof e.opened===void 0}),dU(v,{id:a})]);return VR({opened:o,position:e.position,positionDependencies:e.positionDependencies,floating:{refs:_,update:y}}),ln(()=>{var E;(E=e.onPositionChange)==null||E.call(e,x)},[x]),{x:p,y:h,arrowX:w,arrowY:b,reference:m,floating:g,getFloatingProps:O,getReferenceProps:C,isGroupPhase:o&&c&&c!==a,opened:o,placement:x}}var Wee=Object.defineProperty,Hee=Object.defineProperties,qee=Object.getOwnPropertyDescriptors,Fp=Object.getOwnPropertySymbols,_N=Object.prototype.hasOwnProperty,SN=Object.prototype.propertyIsEnumerable,xj=(e,t,r)=>t in e?Wee(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Mi=(e,t)=>{for(var r in t||(t={}))_N.call(t,r)&&xj(e,r,t[r]);if(Fp)for(var r of Fp(t))SN.call(t,r)&&xj(e,r,t[r]);return e},Rg=(e,t)=>Hee(e,qee(t)),Gee=(e,t)=>{var r={};for(var n in e)_N.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&Fp)for(var n of Fp(e))t.indexOf(n)<0&&SN.call(e,n)&&(r[n]=e[n]);return r};const Qee={position:"top",refProp:"ref",withinPortal:!1,inline:!1,arrowSize:4,arrowOffset:5,arrowRadius:0,arrowPosition:"side",offset:5,transitionProps:{duration:100,transition:"fade"},width:"auto",events:{hover:!0,focus:!1,touch:!1},zIndex:Tn("popover"),positionDependencies:[]},fm=f.forwardRef((e,t)=>{var r;const n=f.useRef(null),o=H("Tooltip",Qee,e),{children:i,position:a,refProp:l,label:c,openDelay:u,closeDelay:d,onPositionChange:p,opened:h,withinPortal:m,portalProps:g,radius:v,color:_,classNames:y,styles:x,unstyled:w,style:b,className:C,withArrow:O,arrowSize:P,arrowOffset:E,arrowRadius:$,arrowPosition:k,offset:I,transitionProps:T,multiline:N,width:A,events:z,zIndex:G,disabled:X,positionDependencies:R,onClick:M,onMouseEnter:V,onMouseLeave:Q,inline:Z,variant:_e,keepMounted:xe}=o,Ve=Gee(o,["children","position","refProp","label","openDelay","closeDelay","onPositionChange","opened","withinPortal","portalProps","radius","color","classNames","styles","unstyled","style","className","withArrow","arrowSize","arrowOffset","arrowRadius","arrowPosition","offset","transitionProps","multiline","width","events","zIndex","disabled","positionDependencies","onClick","onMouseEnter","onMouseLeave","inline","variant","keepMounted"]),{classes:Me,cx:gt,theme:Nt}=vN({radius:v,color:_,width:A,multiline:N},{name:"Tooltip",classNames:y,styles:x,unstyled:w,variant:_e}),ke=Uee({position:JR(Nt.dir,a),closeDelay:d,openDelay:u,onPositionChange:p,opened:h,events:z,arrowRef:n,arrowOffset:E,offset:I+(O?P/2:0),positionDependencies:[...R,i],inline:Z});if(!Rs(i))throw new Error(yN.children);const Ht=Is(ke.reference,i.ref,t);return S.createElement(S.Fragment,null,S.createElement(Ms,Rg(Mi({},g),{withinPortal:m}),S.createElement(va,Rg(Mi({keepMounted:xe,mounted:!X&&ke.opened},T),{transition:T.transition||"fade",duration:ke.isGroupPhase?10:(r=T.duration)!=null?r:100}),Lr=>{var lr,qt;return S.createElement(ie,Mi(Mi({},Ve),ke.getFloatingProps({ref:ke.floating,className:Me.tooltip,style:Rg(Mi(Mi({},b),Lr),{zIndex:G,top:(lr=ke.y)!=null?lr:0,left:(qt=ke.x)!=null?qt:0})})),c,S.createElement(nx,{ref:n,arrowX:ke.arrowX,arrowY:ke.arrowY,visible:O,position:ke.placement,arrowSize:P,arrowOffset:E,arrowRadius:$,arrowPosition:k,className:Me.arrow}))})),f.cloneElement(i,ke.getReferenceProps(Mi({onClick:M,onMouseEnter:V,onMouseLeave:Q,onMouseMove:e.onMouseMove,onPointerDown:e.onPointerDown,onPointerEnter:e.onPointerEnter,[l]:Ht,className:gt(C,i.props.className)},i.props))))});fm.Group=gN;fm.Floating=bN;fm.displayName="@mantine/core/Tooltip";const PN=fm;var Kee=Object.defineProperty,Vp=Object.getOwnPropertySymbols,jN=Object.prototype.hasOwnProperty,ON=Object.prototype.propertyIsEnumerable,wj=(e,t,r)=>t in e?Kee(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,bj=(e,t)=>{for(var r in t||(t={}))jN.call(t,r)&&wj(e,r,t[r]);if(Vp)for(var r of Vp(t))ON.call(t,r)&&wj(e,r,t[r]);return e},Yee=(e,t)=>{var r={};for(var n in e)jN.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&Vp)for(var n of Vp(e))t.indexOf(n)<0&&ON.call(e,n)&&(r[n]=e[n]);return r};function Xee(e){const t=e,{width:r,height:n,style:o}=t,i=Yee(t,["width","height","style"]);return S.createElement("svg",bj({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 5 5",style:bj({width:r,height:n},o)},i),S.createElement("path",{fill:"currentColor",d:"M0 2.5a2.5 2.5 0 115 0 2.5 2.5 0 01-5 0z"}))}const CN=f.createContext(null),Jee=CN.Provider,Zee=()=>f.useContext(CN);var ete=Object.defineProperty,Bp=Object.getOwnPropertySymbols,EN=Object.prototype.hasOwnProperty,$N=Object.prototype.propertyIsEnumerable,_j=(e,t,r)=>t in e?ete(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Sj=(e,t)=>{for(var r in t||(t={}))EN.call(t,r)&&_j(e,r,t[r]);if(Bp)for(var r of Bp(t))$N.call(t,r)&&_j(e,r,t[r]);return e},tte=(e,t)=>{var r={};for(var n in e)EN.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&Bp)for(var n of Bp(e))t.indexOf(n)<0&&$N.call(e,n)&&(r[n]=e[n]);return r};const rte={size:"sm"},kN=f.forwardRef((e,t)=>{const r=H("RadioGroup",rte,e),{children:n,value:o,defaultValue:i,onChange:a,size:l,wrapperProps:c,unstyled:u,name:d}=r,p=tte(r,["children","value","defaultValue","onChange","size","wrapperProps","unstyled","name"]),h=Nr(d),[m,g]=Tr({value:o,defaultValue:i,finalValue:"",onChange:a}),v=_=>g(_.currentTarget.value);return S.createElement(Jee,{value:{value:m,onChange:v,size:l,name:h}},S.createElement(Ut.Wrapper,Sj(Sj({labelElement:"div",size:l,__staticSelector:"RadioGroup",ref:t,unstyled:u},c),p),n))});kN.displayName="@mantine/core/RadioGroup";var nte=Object.defineProperty,ote=Object.defineProperties,ite=Object.getOwnPropertyDescriptors,Pj=Object.getOwnPropertySymbols,ate=Object.prototype.hasOwnProperty,ste=Object.prototype.propertyIsEnumerable,jj=(e,t,r)=>t in e?nte(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,lte=(e,t)=>{for(var r in t||(t={}))ate.call(t,r)&&jj(e,r,t[r]);if(Pj)for(var r of Pj(t))ste.call(t,r)&&jj(e,r,t[r]);return e},cte=(e,t)=>ote(e,ite(t));const Tg={xs:j(16),sm:j(20),md:j(24),lg:j(30),xl:j(36)},Uu={xs:j(6),sm:j(8),md:j(10),lg:j(14),xl:j(16)};var ute=W((e,{color:t,transitionDuration:r,labelPosition:n,error:o},{size:i})=>{const a=e.fn.variant({variant:"filled",color:t}),l=e.fn.variant({variant:"filled",color:"red"}).background;return{inner:{order:n==="left"?2:1,position:"relative",alignSelf:"flex-start"},icon:{ref:Vt("icon"),color:e.white,opacity:0,transform:`scale(0.75) translateY(${j(2)})`,transition:`opacity ${r}ms ${e.transitionTimingFunction}`,pointerEvents:"none",width:L({sizes:Uu,size:i}),height:L({sizes:Uu,size:i}),position:"absolute",top:`calc(50% - ${L({sizes:Uu,size:i})} / 2)`,left:`calc(50% - ${L({sizes:Uu,size:i})} / 2)`},radio:cte(lte({},e.fn.focusStyles()),{backgroundColor:e.colorScheme==="dark"?e.colors.dark[6]:e.white,border:`${j(1)} solid ${o?l:e.colorScheme==="dark"?e.colors.dark[4]:e.colors.gray[4]}`,position:"relative",appearance:"none",width:L({sizes:Tg,size:i}),height:L({sizes:Tg,size:i}),borderRadius:L({sizes:Tg,size:i}),margin:0,display:"flex",alignItems:"center",justifyContent:"center",transitionProperty:"background-color, border-color",transitionTimingFunction:e.transitionTimingFunction,transitionDuration:`${r}ms`,cursor:e.cursorType,"&:checked":{background:a.background,borderColor:a.background,[`& + .${Vt("icon")}`]:{opacity:1,transform:"scale(1)"}},"&:disabled":{borderColor:e.colorScheme==="dark"?e.colors.dark[5]:e.colors.gray[4],backgroundColor:e.colorScheme==="dark"?e.colors.dark[5]:e.colors.gray[1],[`& + .${Vt("icon")}`]:{color:e.colorScheme==="dark"?e.colors.dark[6]:e.colors.gray[4]}}})}});const dte=ute;var fte=Object.defineProperty,Up=Object.getOwnPropertySymbols,RN=Object.prototype.hasOwnProperty,TN=Object.prototype.propertyIsEnumerable,Oj=(e,t,r)=>t in e?fte(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Wu=(e,t)=>{for(var r in t||(t={}))RN.call(t,r)&&Oj(e,r,t[r]);if(Up)for(var r of Up(t))TN.call(t,r)&&Oj(e,r,t[r]);return e},pte=(e,t)=>{var r={};for(var n in e)RN.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&Up)for(var n of Up(e))t.indexOf(n)<0&&TN.call(e,n)&&(r[n]=e[n]);return r};const hte={icon:Xee,transitionDuration:100,size:"sm",labelPosition:"right"},Wp=f.forwardRef((e,t)=>{var r,n;const o=H("Radio",hte,e),{className:i,style:a,id:l,label:c,size:u,title:d,disabled:p,color:h,classNames:m,styles:g,sx:v,icon:_,transitionDuration:y,wrapperProps:x,unstyled:w,labelPosition:b,description:C,error:O,variant:P}=o,E=pte(o,["className","style","id","label","size","title","disabled","color","classNames","styles","sx","icon","transitionDuration","wrapperProps","unstyled","labelPosition","description","error","variant"]),$=Zee(),k=(r=$==null?void 0:$.size)!=null?r:u,I=e.size?u:k,{classes:T}=dte({color:h,transitionDuration:y,labelPosition:b,error:!!O},{name:"Radio",classNames:m,styles:g,unstyled:w,variant:P,size:I}),{systemStyles:N,rest:A}=oo(E),z=Nr(l),G=$?{checked:$.value===A.value,name:(n=A.name)!=null?n:$.name,onChange:$.onChange}:{};return S.createElement(sm,Wu(Wu({className:i,sx:v,style:a,id:z,size:I,labelPosition:b,label:c,description:C,error:O,disabled:p,__staticSelector:"Radio",classNames:m,styles:g,unstyled:w,"data-checked":G.checked||void 0,variant:P},N),x),S.createElement("div",{className:T.inner},S.createElement("input",Wu(Wu({ref:t,className:T.radio,type:"radio",id:z,disabled:p},A),G)),S.createElement(_,{className:T.icon,"aria-hidden":!0})))});Wp.displayName="@mantine/core/Radio";Wp.Group=kN;function mte({size:e,thickness:t,sum:r,value:n,root:o,offset:i}){const a=(e*.9-t*2)/2,l=Math.PI*a*2/100,c=o?`${(100-r)*l}, ${r*l}`:`${n*l}, ${(100-n)*l}`;return{strokeWidth:t,cx:e/2,cy:e/2,r:a,transform:o?`scale(1, -1) translate(0, -${e})`:null,strokeDasharray:c,strokeDashoffset:o?0:i}}var gte=Object.defineProperty,vte=Object.defineProperties,yte=Object.getOwnPropertyDescriptors,Hp=Object.getOwnPropertySymbols,IN=Object.prototype.hasOwnProperty,DN=Object.prototype.propertyIsEnumerable,Cj=(e,t,r)=>t in e?gte(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Ej=(e,t)=>{for(var r in t||(t={}))IN.call(t,r)&&Cj(e,r,t[r]);if(Hp)for(var r of Hp(t))DN.call(t,r)&&Cj(e,r,t[r]);return e},xte=(e,t)=>vte(e,yte(t)),wte=(e,t)=>{var r={};for(var n in e)IN.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&Hp)for(var n of Hp(e))t.indexOf(n)<0&&DN.call(e,n)&&(r[n]=e[n]);return r};function NN(e){var t=e,{size:r,value:n,offset:o,sum:i,thickness:a,root:l,color:c,lineRoundCaps:u,tooltip:d}=t,p=wte(t,["size","value","offset","sum","thickness","root","color","lineRoundCaps","tooltip"]);const h=Jt(),m=h.fn.themeColor(c||(h.colorScheme==="dark"?"dark":"gray"),c?h.fn.primaryShade():h.colorScheme==="dark"?4:1,!1);return S.createElement(PN.Floating,{disabled:!d,label:d},S.createElement("circle",Ej(xte(Ej({},p),{fill:"none",strokeLinecap:u?"round":"butt",stroke:m}),mte({sum:i,size:r,thickness:a,value:n,offset:o,root:l}))))}NN.displayName="@mantine/core/Curve";var bte=Object.defineProperty,_te=Object.defineProperties,Ste=Object.getOwnPropertyDescriptors,$j=Object.getOwnPropertySymbols,Pte=Object.prototype.hasOwnProperty,jte=Object.prototype.propertyIsEnumerable,kj=(e,t,r)=>t in e?bte(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,cl=(e,t)=>{for(var r in t||(t={}))Pte.call(t,r)&&kj(e,r,t[r]);if($j)for(var r of $j(t))jte.call(t,r)&&kj(e,r,t[r]);return e},ul=(e,t)=>_te(e,Ste(t));function Ote({size:e,thickness:t,sections:r,renderRoundedLineCaps:n,rootColor:o}){const i=r.reduce((d,p)=>d+p.value,0),a=Math.PI*((e*.9-t*2)/2)*2;let l=a;const c=[],u=[];for(let d=0;d<r.length;d+=1)c.push({sum:i,offset:l,data:r[d],root:!1}),l-=r[d].value/100*a;if(c.push({sum:i,offset:l,data:{color:o},root:!0}),u.push(ul(cl({},c[c.length-1]),{lineRoundCaps:!1})),c.length>2){u.push(ul(cl({},c[0]),{lineRoundCaps:n})),u.push(ul(cl({},c[c.length-2]),{lineRoundCaps:n}));for(let d=1;d<=c.length-3;d+=1)u.push(ul(cl({},c[d]),{lineRoundCaps:!1}))}else u.push(ul(cl({},c[0]),{lineRoundCaps:n}));return u}var Cte=W({root:{position:"relative"},label:{position:"absolute",top:"50%",transform:"translateY(-50%)"}});const Ete=Cte;var $te=Object.defineProperty,kte=Object.defineProperties,Rte=Object.getOwnPropertyDescriptors,qp=Object.getOwnPropertySymbols,AN=Object.prototype.hasOwnProperty,MN=Object.prototype.propertyIsEnumerable,Rj=(e,t,r)=>t in e?$te(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Ig=(e,t)=>{for(var r in t||(t={}))AN.call(t,r)&&Rj(e,r,t[r]);if(qp)for(var r of qp(t))MN.call(t,r)&&Rj(e,r,t[r]);return e},Tte=(e,t)=>kte(e,Rte(t)),Ite=(e,t)=>{var r={};for(var n in e)AN.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&qp)for(var n of qp(e))t.indexOf(n)<0&&MN.call(e,n)&&(r[n]=e[n]);return r};const Dte={size:120,thickness:12},hx=f.forwardRef((e,t)=>{const r=H("RingProgress",Dte,e),{className:n,style:o,label:i,sections:a,size:l,thickness:c,classNames:u,styles:d,roundCaps:p,rootColor:h,unstyled:m,variant:g}=r,v=Ite(r,["className","style","label","sections","size","thickness","classNames","styles","roundCaps","rootColor","unstyled","variant"]),{classes:_,cx:y}=Ete(null,{name:"RingProgress",classNames:u,styles:d,unstyled:m,variant:g}),x=Ote({size:l,thickness:c,sections:a,renderRoundedLineCaps:p,rootColor:h}).map(({data:w,sum:b,root:C,lineRoundCaps:O,offset:P},E)=>S.createElement(NN,Tte(Ig({},w),{key:E,size:l,thickness:c,sum:b,offset:P,color:w==null?void 0:w.color,root:C,lineRoundCaps:O})));return S.createElement(ie,Ig({style:Ig({width:l,height:l},o),className:y(_.root,n),ref:t},v),S.createElement("svg",{style:{width:l,height:l,transform:"rotate(-90deg)"}},x),i&&S.createElement("div",{className:_.label,style:{right:c*2,left:c*2}},i))});hx.displayName="@mantine/core/RingProgress";function Nte(e,t){if(t.length===0)return t;const r="maxWidth"in t[0]?"maxWidth":"minWidth",n=[...t].sort((o,i)=>xr(L({size:i[r],sizes:e.breakpoints}))-xr(L({size:o[r],sizes:e.breakpoints})));return r==="minWidth"?n.reverse():n}var Ate=Object.defineProperty,Tj=Object.getOwnPropertySymbols,Mte=Object.prototype.hasOwnProperty,Lte=Object.prototype.propertyIsEnumerable,Ij=(e,t,r)=>t in e?Ate(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,zte=(e,t)=>{for(var r in t||(t={}))Mte.call(t,r)&&Ij(e,r,t[r]);if(Tj)for(var r of Tj(t))Lte.call(t,r)&&Ij(e,r,t[r]);return e},Fte=W((e,{spacing:t,breakpoints:r,cols:n,verticalSpacing:o})=>{const i=o!=null,a=Nte(e,r).reduce((l,c)=>{var u,d;const p="maxWidth"in c?"max-width":"min-width",h=L({size:p==="max-width"?c.maxWidth:c.minWidth,sizes:e.breakpoints,units:"em"}),m=xr(h)-(p==="max-width"?1:0);return l[`@media (${p}: ${ir(m)})`]={gridTemplateColumns:`repeat(${c.cols}, minmax(0, 1fr))`,gap:`${L({size:(u=c.verticalSpacing)!=null?u:i?o:t,sizes:e.spacing})} ${L({size:(d=c.spacing)!=null?d:t,sizes:e.spacing})}`},l},{});return{root:zte({boxSizing:"border-box",display:"grid",gridTemplateColumns:`repeat(${n}, minmax(0, 1fr))`,gap:`${L({size:i?o:t,sizes:e.spacing})} ${L({size:t,sizes:e.spacing})}`},a)}});const Vte=Fte;var Bte=Object.defineProperty,Gp=Object.getOwnPropertySymbols,LN=Object.prototype.hasOwnProperty,zN=Object.prototype.propertyIsEnumerable,Dj=(e,t,r)=>t in e?Bte(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Ute=(e,t)=>{for(var r in t||(t={}))LN.call(t,r)&&Dj(e,r,t[r]);if(Gp)for(var r of Gp(t))zN.call(t,r)&&Dj(e,r,t[r]);return e},Wte=(e,t)=>{var r={};for(var n in e)LN.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&Gp)for(var n of Gp(e))t.indexOf(n)<0&&zN.call(e,n)&&(r[n]=e[n]);return r};const Hte={breakpoints:[],cols:1,spacing:"md"},FN=f.forwardRef((e,t)=>{const r=H("SimpleGrid",Hte,e),{className:n,breakpoints:o,cols:i,spacing:a,verticalSpacing:l,children:c,unstyled:u,variant:d}=r,p=Wte(r,["className","breakpoints","cols","spacing","verticalSpacing","children","unstyled","variant"]),{classes:h,cx:m}=Vte({breakpoints:o,cols:i,spacing:a,verticalSpacing:l},{name:"SimpleGrid",unstyled:u,variant:d});return S.createElement(ie,Ute({className:m(h.root,n),ref:t},p),c)});FN.displayName="@mantine/core/SimpleGrid";var qte=Object.defineProperty,Qp=Object.getOwnPropertySymbols,VN=Object.prototype.hasOwnProperty,BN=Object.prototype.propertyIsEnumerable,Nj=(e,t,r)=>t in e?qte(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Gte=(e,t)=>{for(var r in t||(t={}))VN.call(t,r)&&Nj(e,r,t[r]);if(Qp)for(var r of Qp(t))BN.call(t,r)&&Nj(e,r,t[r]);return e},Qte=(e,t)=>{var r={};for(var n in e)VN.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&Qp)for(var n of Qp(e))t.indexOf(n)<0&&BN.call(e,n)&&(r[n]=e[n]);return r};const Kte={w:0,h:0},pm=f.forwardRef((e,t)=>{const r=H("Space",Kte,e),{w:n,h:o}=r,i=Qte(r,["w","h"]);return S.createElement(ie,Gte({ref:t,w:n,miw:n,h:o,mih:o},i))});pm.displayName="@mantine/core/Space";var Yte=W((e,{spacing:t,align:r,justify:n})=>({root:{display:"flex",flexDirection:"column",alignItems:r,justifyContent:n,gap:L({size:t,sizes:e.spacing})}}));const Xte=Yte;var Jte=Object.defineProperty,Kp=Object.getOwnPropertySymbols,UN=Object.prototype.hasOwnProperty,WN=Object.prototype.propertyIsEnumerable,Aj=(e,t,r)=>t in e?Jte(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Zte=(e,t)=>{for(var r in t||(t={}))UN.call(t,r)&&Aj(e,r,t[r]);if(Kp)for(var r of Kp(t))WN.call(t,r)&&Aj(e,r,t[r]);return e},ere=(e,t)=>{var r={};for(var n in e)UN.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&Kp)for(var n of Kp(e))t.indexOf(n)<0&&WN.call(e,n)&&(r[n]=e[n]);return r};const tre={spacing:"md",align:"stretch",justify:"flex-start"},je=f.forwardRef((e,t)=>{const r=H("Stack",tre,e),{spacing:n,className:o,align:i,justify:a,unstyled:l,variant:c}=r,u=ere(r,["spacing","className","align","justify","unstyled","variant"]),{classes:d,cx:p}=Xte({spacing:n,align:i,justify:a},{name:"Stack",unstyled:l,variant:c});return S.createElement(ie,Zte({className:p(d.root,o),ref:t},u))});je.displayName="@mantine/core/Stack";var rre=Object.defineProperty,nre=Object.defineProperties,ore=Object.getOwnPropertyDescriptors,Mj=Object.getOwnPropertySymbols,ire=Object.prototype.hasOwnProperty,are=Object.prototype.propertyIsEnumerable,Lj=(e,t,r)=>t in e?rre(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Dg=(e,t)=>{for(var r in t||(t={}))ire.call(t,r)&&Lj(e,r,t[r]);if(Mj)for(var r of Mj(t))are.call(t,r)&&Lj(e,r,t[r]);return e},sre=(e,t)=>nre(e,ore(t));const HN={xs:j(34),sm:j(36),md:j(42),lg:j(48),xl:j(52)};var lre=W((e,{color:t,iconSize:r,radius:n,allowStepClick:o,iconPosition:i,orientation:a},{size:l})=>{const c=r?j(r):L({size:l,sizes:HN}),u=l==="xl"||l==="lg"?e.spacing.md:e.spacing.sm,d=e.fn.radius(n),p=e.fn.variant({variant:"filled",color:t||e.primaryColor,primaryFallback:!1}),h=`calc(${e.spacing.xs} / 2)`,m={step:{justifyContent:"flex-start",minHeight:`calc(${c} + ${e.spacing.xl} + ${h})`,marginTop:h,overflow:"hidden","&:first-of-type":{marginTop:0},[`&:last-of-type .${Vt("verticalSeparator")}`]:{display:"none"}}};return{stepLoader:{},step:Dg({display:"flex",flexDirection:i==="left"?"row":"row-reverse",cursor:o?"pointer":"default"},a==="vertical"?m.step:{alignItems:"center"}),stepWrapper:{position:"relative"},verticalSeparator:{top:`calc(${c} + ${h})`,left:`calc(${c} / 2)`,height:"100vh",position:"absolute",borderLeft:`${j(2)} solid ${e.colorScheme==="dark"?e.colors.dark[5]:e.colors.gray[1]}`,ref:Vt("verticalSeparator")},verticalSeparatorActive:{borderColor:e.fn.variant({variant:"filled",color:t}).background},stepIcon:{boxSizing:"border-box",height:c,width:c,minWidth:c,borderRadius:d,display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:e.colorScheme==="dark"?e.colors.dark[5]:e.colors.gray[1],border:`${j(2)} solid ${e.colorScheme==="dark"?e.colors.dark[5]:e.colors.gray[1]}`,transition:"background-color 150ms ease, border-color 150ms ease",position:"relative",fontWeight:700,color:e.colorScheme==="dark"?e.colors.dark[1]:e.colors.gray[7],fontSize:L({size:l,sizes:e.fontSizes}),"&[data-progress]":{borderColor:p.background},"&[data-completed]":{backgroundColor:p.background,borderColor:p.background,color:e.white}},stepCompletedIcon:sre(Dg({},e.fn.cover()),{display:"flex",alignItems:"center",justifyContent:"center",color:e.white}),stepBody:Dg({display:"flex",flexDirection:"column",marginLeft:i==="left"?u:void 0,marginRight:i==="right"?u:void 0},a==="vertical"?{marginTop:`calc(${r} / 4)`}:null),stepLabel:{textAlign:i,fontWeight:500,fontSize:L({size:l,sizes:e.fontSizes}),lineHeight:1},stepDescription:{textAlign:i,marginTop:`calc(${L({size:l,sizes:e.spacing})} / 3)`,marginBottom:`calc(${L({size:l,sizes:e.spacing})} / 3)`,fontSize:`calc(${L({size:l,sizes:e.fontSizes})} - ${j(2)})`,lineHeight:1}}});const cre=lre;var ure=Object.defineProperty,Yp=Object.getOwnPropertySymbols,qN=Object.prototype.hasOwnProperty,GN=Object.prototype.propertyIsEnumerable,zj=(e,t,r)=>t in e?ure(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Ng=(e,t)=>{for(var r in t||(t={}))qN.call(t,r)&&zj(e,r,t[r]);if(Yp)for(var r of Yp(t))GN.call(t,r)&&zj(e,r,t[r]);return e},dre=(e,t)=>{var r={};for(var n in e)qN.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&Yp)for(var n of Yp(e))t.indexOf(n)<0&&GN.call(e,n)&&(r[n]=e[n]);return r};const fre={xs:16,sm:18,md:20,lg:22,xl:24},pre={withIcon:!0,size:"md",radius:"xl",allowStepClick:!0,iconPosition:"left",__staticSelector:"Step"},Hu=(e,t)=>typeof e=="function"?S.createElement(e,{step:t}):e,QN=f.forwardRef((e,t)=>{const r=H("StepperStep",pre,e),{className:n,step:o,state:i,color:a,icon:l,completedIcon:c,progressIcon:u,label:d,description:p,withIcon:h,iconSize:m,size:g,radius:v,loading:_,allowStepClick:y,allowStepSelect:x,iconPosition:w,__staticSelector:b,classNames:C,styles:O,unstyled:P,orientation:E,variant:$}=r,k=dre(r,["className","step","state","color","icon","completedIcon","progressIcon","label","description","withIcon","iconSize","size","radius","loading","allowStepClick","allowStepSelect","iconPosition","__staticSelector","classNames","styles","unstyled","orientation","variant"]),{classes:I,cx:T}=cre({color:a,iconSize:m,radius:v,allowStepClick:y,iconPosition:w,orientation:E},{name:b,classNames:C,styles:O,unstyled:P,variant:$,size:g}),N=L({size:g,sizes:fre}),A=i==="stepCompleted"?null:i==="stepProgress"?u:l,z={"data-progress":i==="stepProgress"||void 0,"data-completed":i==="stepCompleted"||void 0};return S.createElement(So,Ng(Ng({className:T(I.step,n),tabIndex:y?0:-1,ref:t},z),k),h&&S.createElement("div",{className:I.stepWrapper},S.createElement("div",Ng({className:I.stepIcon},z),S.createElement(va,{mounted:i==="stepCompleted",transition:"pop",duration:200},G=>S.createElement("div",{className:I.stepCompletedIcon,style:G},_?S.createElement(hn,{color:"#fff",size:N,className:I.stepLoader}):Hu(c,o)||S.createElement(eI,{indeterminate:!1,width:N,height:N}))),i!=="stepCompleted"?_?S.createElement(hn,{size:N,color:a}):Hu(A||l,o):null),E==="vertical"&&S.createElement("div",{className:T(I.verticalSeparator,{[I.verticalSeparatorActive]:i==="stepCompleted"})})),(d||p)&&S.createElement("div",{className:I.stepBody},d&&S.createElement(oe,{className:I.stepLabel},Hu(d,o)),p&&S.createElement(oe,{className:I.stepDescription,color:"dimmed"},Hu(p,o))))});QN.displayName="@mantine/core/Step";function Xp(e){return null}Xp.displayName="@mantine/core/StepCompleted";var hre=Object.defineProperty,mre=Object.defineProperties,gre=Object.getOwnPropertyDescriptors,Fj=Object.getOwnPropertySymbols,vre=Object.prototype.hasOwnProperty,yre=Object.prototype.propertyIsEnumerable,Vj=(e,t,r)=>t in e?hre(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,dl=(e,t)=>{for(var r in t||(t={}))vre.call(t,r)&&Vj(e,r,t[r]);if(Fj)for(var r of Fj(t))yre.call(t,r)&&Vj(e,r,t[r]);return e},xre=(e,t)=>mre(e,gre(t)),wre=W((e,{contentPadding:t,color:r,orientation:n,iconPosition:o,iconSize:i,breakpoint:a},{size:l})=>{const c=typeof a<"u",u=xr(L({size:a,sizes:e.breakpoints})),d=typeof i<"u"?`calc(${j(i)} / 2 - ${j(1)})`:`calc(${L({size:l,sizes:HN})} / 2 - ${j(1)})`,p={steps:{flexDirection:"column",alignItems:o==="left"?"flex-start":"flex-end"},separator:{width:j(2),minHeight:e.spacing.xl,marginLeft:o==="left"?d:0,marginRight:o==="right"?d:0,marginTop:`calc(${e.spacing.xs} / 2)`,marginBottom:`calc(${e.spacing.xs} - ${j(2)})`}},h={steps:{[`@media (max-width: ${ir(u-1)})`]:p.steps},separator:{[`@media (max-width: ${ir(u-1)})`]:p.separator}};return{root:{},steps:dl(dl({display:"flex",boxSizing:"border-box",alignItems:"center"},n==="vertical"?p.steps:null),c?h.steps:null),separator:dl(dl({boxSizing:"border-box",transition:"background-color 150ms ease",flex:1,height:j(2),backgroundColor:e.colorScheme==="dark"?e.colors.dark[4]:e.colors.gray[2],marginLeft:e.spacing.md,marginRight:e.spacing.md},n==="vertical"?p.separator:null),c?h.separator:null),separatorActive:{backgroundColor:e.fn.variant({variant:"filled",color:r||e.primaryColor,primaryFallback:!1}).background},content:xre(dl({},e.fn.fontStyles()),{paddingTop:L({size:t,sizes:e.spacing})})}});const bre=wre;var _re=Object.defineProperty,Jp=Object.getOwnPropertySymbols,KN=Object.prototype.hasOwnProperty,YN=Object.prototype.propertyIsEnumerable,Bj=(e,t,r)=>t in e?_re(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Sre=(e,t)=>{for(var r in t||(t={}))KN.call(t,r)&&Bj(e,r,t[r]);if(Jp)for(var r of Jp(t))YN.call(t,r)&&Bj(e,r,t[r]);return e},Pre=(e,t)=>{var r={};for(var n in e)KN.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&Jp)for(var n of Jp(e))t.indexOf(n)<0&&YN.call(e,n)&&(r[n]=e[n]);return r};const jre={contentPadding:"md",size:"md",radius:"xl",orientation:"horizontal",iconPosition:"left",allowNextStepsSelect:!0},uc=f.forwardRef((e,t)=>{var r,n,o;const i=H("Stepper",jre,e),{className:a,children:l,onStepClick:c,active:u,icon:d,completedIcon:p,progressIcon:h,color:m,iconSize:g,contentPadding:v,size:_,radius:y,orientation:x,breakpoint:w,iconPosition:b,allowNextStepsSelect:C,classNames:O,styles:P,unstyled:E,variant:$}=i,k=Pre(i,["className","children","onStepClick","active","icon","completedIcon","progressIcon","color","iconSize","contentPadding","size","radius","orientation","breakpoint","iconPosition","allowNextStepsSelect","classNames","styles","unstyled","variant"]),{classes:I,cx:T}=bre({contentPadding:v,color:m,orientation:x,iconPosition:b,iconSize:g,breakpoint:w},{name:"Stepper",classNames:O,styles:P,unstyled:E,variant:$,size:_}),N=f.Children.toArray(l),A=N.filter(V=>V.type!==Xp),z=N.find(V=>V.type===Xp),G=A.reduce((V,Q,Z)=>{const _e=u===Z?"stepProgress":u>Z?"stepCompleted":"stepInactive",Ve=typeof c!="function"?!1:typeof Q.props.allowStepSelect=="boolean"?Q.props.allowStepSelect:_e==="stepCompleted"||C;return V.push(f.cloneElement(Q,{__staticSelector:"Stepper",icon:Q.props.icon||d||Z+1,key:Z,step:Z,variant:$,state:_e,onClick:()=>Ve&&c(Z),allowStepClick:Ve,completedIcon:Q.props.completedIcon||p,progressIcon:Q.props.progressIcon||h,color:Q.props.color||m,iconSize:g,size:_,radius:y,classNames:O,styles:P,iconPosition:Q.props.iconPosition||b,orientation:x,unstyled:E})),x==="horizontal"&&Z!==A.length-1&&V.push(S.createElement("div",{className:T(I.separator,{[I.separatorActive]:Z<u}),key:`separator-${Z}`})),V},[]),X=(n=(r=A[u])==null?void 0:r.props)==null?void 0:n.children,R=(o=z==null?void 0:z.props)==null?void 0:o.children,M=u>A.length-1?R:X;return S.createElement(ie,Sre({className:T(I.root,a),ref:t},k),S.createElement("div",{className:I.steps},G),M&&S.createElement("div",{className:I.content},M))});uc.Step=QN;uc.Completed=Xp;uc.displayName="@mantine/core/Stepper";const XN=f.createContext(null),Ore=XN.Provider,Cre=()=>f.useContext(XN);var Ere=Object.defineProperty,Zp=Object.getOwnPropertySymbols,JN=Object.prototype.hasOwnProperty,ZN=Object.prototype.propertyIsEnumerable,Uj=(e,t,r)=>t in e?Ere(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Wj=(e,t)=>{for(var r in t||(t={}))JN.call(t,r)&&Uj(e,r,t[r]);if(Zp)for(var r of Zp(t))ZN.call(t,r)&&Uj(e,r,t[r]);return e},$re=(e,t)=>{var r={};for(var n in e)JN.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&Zp)for(var n of Zp(e))t.indexOf(n)<0&&ZN.call(e,n)&&(r[n]=e[n]);return r};const kre={size:"sm"},e5=f.forwardRef((e,t)=>{const r=H("SwitchGroup",kre,e),{children:n,value:o,defaultValue:i,onChange:a,size:l,wrapperProps:c}=r,u=$re(r,["children","value","defaultValue","onChange","size","wrapperProps"]),[d,p]=Tr({value:o,defaultValue:i,finalValue:[],onChange:a}),h=m=>{const g=m.currentTarget.value;p(d.includes(g)?d.filter(v=>v!==g):[...d,g])};return S.createElement(Ore,{value:{value:d,onChange:h,size:l}},S.createElement(Ut.Wrapper,Wj(Wj({labelElement:"div",size:l,__staticSelector:"SwitchGroup",ref:t},c),u),n))});e5.displayName="@mantine/core/SwitchGroup";var Rre=Object.defineProperty,Tre=Object.defineProperties,Ire=Object.getOwnPropertyDescriptors,Hj=Object.getOwnPropertySymbols,Dre=Object.prototype.hasOwnProperty,Nre=Object.prototype.propertyIsEnumerable,qj=(e,t,r)=>t in e?Rre(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Are=(e,t)=>{for(var r in t||(t={}))Dre.call(t,r)&&qj(e,r,t[r]);if(Hj)for(var r of Hj(t))Nre.call(t,r)&&qj(e,r,t[r]);return e},Mre=(e,t)=>Tre(e,Ire(t));const Lre={xs:j(16),sm:j(20),md:j(24),lg:j(30),xl:j(36)},zre={xs:j(32),sm:j(38),md:j(46),lg:j(56),xl:j(72)},Fre={xs:j(12),sm:j(14),md:j(18),lg:j(22),xl:j(28)},Vre={xs:j(5),sm:j(6),md:j(7),lg:j(9),xl:j(11)},Bre={xs:j(4),sm:j(5),md:j(6),lg:j(8),xl:j(10)};var Ure=W((e,{radius:t,color:r,labelPosition:n,error:o},{size:i})=>{const a=L({size:i,sizes:Fre}),l=L({size:t,sizes:e.radius}),c=e.fn.variant({variant:"filled",color:r}),u=L({size:i,sizes:zre}),d=j(i==="xs"?1:2),p=e.fn.variant({variant:"filled",color:"red"}).background;return{root:{position:"relative"},input:{height:0,width:0,overflow:"hidden",whiteSpace:"nowrap",padding:0,WebkitClipPath:"inset(50%)",clipPath:"inset(50%)",position:"absolute"},track:Mre(Are({},e.fn.focusStyles("input:focus + &")),{cursor:e.cursorType,overflow:"hidden",WebkitTapHighlightColor:"transparent",position:"relative",borderRadius:l,backgroundColor:e.colorScheme==="dark"?e.colors.dark[6]:e.colors.gray[2],border:`${j(1)} solid ${o?p:e.colorScheme==="dark"?e.colors.dark[4]:e.colors.gray[3]}`,height:L({size:i,sizes:Lre}),minWidth:u,margin:0,transitionProperty:"background-color, border-color",transitionTimingFunction:e.transitionTimingFunction,transitionDuration:"150ms",boxSizing:"border-box",appearance:"none",display:"flex",alignItems:"center",fontSize:L({size:i,sizes:Vre}),fontWeight:600,order:n==="left"?2:1,userSelect:"none",zIndex:0,lineHeight:0,color:e.colorScheme==="dark"?e.colors.dark[1]:e.colors.gray[6],transition:`color 150ms ${e.transitionTimingFunction}`,"input:checked + &":{backgroundColor:c.background,borderColor:c.background,color:e.white,transition:`color 150ms ${e.transitionTimingFunction}`},"input:disabled + &":{backgroundColor:e.colorScheme==="dark"?e.colors.dark[4]:e.colors.gray[2],borderColor:e.colorScheme==="dark"?e.colors.dark[4]:e.colors.gray[2],cursor:"not-allowed",pointerEvents:"none"}}),thumb:{position:"absolute",zIndex:1,borderRadius:l,boxSizing:"border-box",display:"flex",backgroundColor:e.white,height:a,width:a,border:`${j(1)} solid ${e.colorScheme==="dark"?e.white:e.colors.gray[3]}`,left:d,transition:`left 150ms ${e.transitionTimingFunction}`,"& > *":{margin:"auto"},"@media (prefers-reduced-motion)":{transitionDuration:e.respectReducedMotion?"0ms":""},"input:checked + * > &":{left:`calc(100% - ${a} - ${d})`,borderColor:e.white},"input:disabled + * > &":{borderColor:e.colorScheme==="dark"?e.colors.dark[4]:e.colors.gray[2],backgroundColor:e.colorScheme==="dark"?e.colors.dark[3]:e.colors.gray[0]}},trackLabel:{height:"100%",display:"grid",placeContent:"center",minWidth:`calc(${u} - ${a})`,paddingInline:L({size:i,sizes:Bre}),marginLeft:`calc(${a} + ${d})`,transition:`margin 150ms ${e.transitionTimingFunction}`,"input:checked + * > &":{marginLeft:0,marginRight:`calc(${a} + ${d})`}}}});const Wre=Ure;var Hre=Object.defineProperty,qre=Object.defineProperties,Gre=Object.getOwnPropertyDescriptors,eh=Object.getOwnPropertySymbols,t5=Object.prototype.hasOwnProperty,r5=Object.prototype.propertyIsEnumerable,Gj=(e,t,r)=>t in e?Hre(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Ag=(e,t)=>{for(var r in t||(t={}))t5.call(t,r)&&Gj(e,r,t[r]);if(eh)for(var r of eh(t))r5.call(t,r)&&Gj(e,r,t[r]);return e},Qre=(e,t)=>qre(e,Gre(t)),Kre=(e,t)=>{var r={};for(var n in e)t5.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&eh)for(var n of eh(e))t.indexOf(n)<0&&r5.call(e,n)&&(r[n]=e[n]);return r};const Yre={offLabel:"",onLabel:"",size:"sm",radius:"xl",error:!1},mx=f.forwardRef((e,t)=>{var r;const n=H("Switch",Yre,e),{className:o,color:i,label:a,offLabel:l,onLabel:c,id:u,style:d,size:p,radius:h,wrapperProps:m,children:g,unstyled:v,styles:_,classNames:y,thumbIcon:x,sx:w,checked:b,defaultChecked:C,onChange:O,labelPosition:P,description:E,error:$,disabled:k,variant:I}=n,T=Kre(n,["className","color","label","offLabel","onLabel","id","style","size","radius","wrapperProps","children","unstyled","styles","classNames","thumbIcon","sx","checked","defaultChecked","onChange","labelPosition","description","error","disabled","variant"]),N=Cre(),A=(N==null?void 0:N.size)||p,{classes:z,cx:G}=Wre({color:i,radius:h,labelPosition:P,error:!!$},{name:"Switch",classNames:y,styles:_,unstyled:v,size:A,variant:I}),{systemStyles:X,rest:R}=oo(T),M=Nr(u),V=N?{checked:N.value.includes(R.value),onChange:N.onChange}:{},[Q,Z]=Tr({value:(r=V.checked)!=null?r:b,defaultValue:C,finalValue:!1});return S.createElement(sm,Ag(Ag({className:G(o,z.root),sx:w,style:d,id:M,size:(N==null?void 0:N.size)||p,labelPosition:P,label:a,description:E,error:$,disabled:k,__staticSelector:"Switch",classNames:y,styles:_,unstyled:v,"data-checked":V.checked||void 0,variant:I},X),m),S.createElement("input",Qre(Ag({},R),{disabled:k,checked:Q,onChange:_e=>{N?V.onChange(_e):O==null||O(_e),Z(_e.currentTarget.checked)},id:M,ref:t,type:"checkbox",className:z.input})),S.createElement("label",{htmlFor:M,className:z.track},S.createElement("div",{className:z.thumb},x),S.createElement("div",{className:z.trackLabel},Q?c:l)))});mx.displayName="@mantine/core/Switch";mx.Group=e5;var Xre=Object.defineProperty,Jre=Object.defineProperties,Zre=Object.getOwnPropertyDescriptors,Qj=Object.getOwnPropertySymbols,ene=Object.prototype.hasOwnProperty,tne=Object.prototype.propertyIsEnumerable,Kj=(e,t,r)=>t in e?Xre(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,rne=(e,t)=>{for(var r in t||(t={}))ene.call(t,r)&&Kj(e,r,t[r]);if(Qj)for(var r of Qj(t))tne.call(t,r)&&Kj(e,r,t[r]);return e},nne=(e,t)=>Jre(e,Zre(t)),one=W((e,{captionSide:t,horizontalSpacing:r,verticalSpacing:n,fontSize:o,withBorder:i,withColumnBorders:a})=>{const l=`${j(1)} solid ${e.colorScheme==="dark"?e.colors.dark[4]:e.colors.gray[3]}`;return{root:nne(rne({},e.fn.fontStyles()),{width:"100%",borderCollapse:"collapse",captionSide:t,color:e.colorScheme==="dark"?e.colors.dark[0]:e.black,lineHeight:e.lineHeight,border:i?l:void 0,"& > caption":{marginTop:t==="top"?0:e.spacing.xs,marginBottom:t==="bottom"?0:e.spacing.xs,fontSize:e.fontSizes.sm,color:e.colorScheme==="dark"?e.colors.dark[2]:e.colors.gray[6]},"& > thead > tr > th, & > tfoot > tr > th, & > tbody > tr > th":{textAlign:"left",fontWeight:"bold",color:e.colorScheme==="dark"?e.colors.dark[0]:e.colors.gray[7],fontSize:L({size:o,sizes:e.fontSizes}),padding:`${L({size:n,sizes:e.spacing})} ${L({size:r,sizes:e.spacing})}`},"& > thead > tr > th":{borderBottom:l},"& > tfoot > tr > th, & > tbody > tr > th":{borderTop:l},"& > tbody > tr > td":{padding:`${L({size:n,sizes:e.spacing})} ${L({size:r,sizes:e.spacing})}`,borderTop:l,fontSize:L({size:o,sizes:e.fontSizes})},"& > tbody > tr:first-of-type > td, & > tbody > tr:first-of-type > th":{borderTop:"none"},"& > thead > tr > th, & > tbody > tr > td":{borderRight:a?l:"none","&:last-of-type":{borderRight:"none",borderLeft:a?l:"none"}},"& > tbody > tr > th":{borderRight:a?l:"none"},"&[data-striped] > tbody > tr:nth-of-type(odd)":{backgroundColor:e.colorScheme==="dark"?e.colors.dark[6]:e.colors.gray[0]},"&[data-hover] > tbody > tr":e.fn.hover({backgroundColor:e.colorScheme==="dark"?e.colors.dark[5]:e.colors.gray[1]})})}});const ine=one;var ane=Object.defineProperty,sne=Object.defineProperties,lne=Object.getOwnPropertyDescriptors,th=Object.getOwnPropertySymbols,n5=Object.prototype.hasOwnProperty,o5=Object.prototype.propertyIsEnumerable,Yj=(e,t,r)=>t in e?ane(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,cne=(e,t)=>{for(var r in t||(t={}))n5.call(t,r)&&Yj(e,r,t[r]);if(th)for(var r of th(t))o5.call(t,r)&&Yj(e,r,t[r]);return e},une=(e,t)=>sne(e,lne(t)),dne=(e,t)=>{var r={};for(var n in e)n5.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&th)for(var n of th(e))t.indexOf(n)<0&&o5.call(e,n)&&(r[n]=e[n]);return r};const fne={striped:!1,highlightOnHover:!1,captionSide:"top",horizontalSpacing:"xs",fontSize:"sm",verticalSpacing:7,withBorder:!1,withColumnBorders:!1},xa=f.forwardRef((e,t)=>{const r=H("Table",fne,e),{className:n,children:o,striped:i,highlightOnHover:a,captionSide:l,horizontalSpacing:c,verticalSpacing:u,fontSize:d,unstyled:p,withBorder:h,withColumnBorders:m,variant:g}=r,v=dne(r,["className","children","striped","highlightOnHover","captionSide","horizontalSpacing","verticalSpacing","fontSize","unstyled","withBorder","withColumnBorders","variant"]),{classes:_,cx:y}=ine({captionSide:l,verticalSpacing:u,horizontalSpacing:c,fontSize:d,withBorder:h,withColumnBorders:m},{unstyled:p,name:"Table",variant:g});return S.createElement(ie,une(cne({},v),{component:"table",ref:t,className:y(_.root,n),"data-striped":i||void 0,"data-hover":a||void 0}),o)});xa.displayName="@mantine/core/Table";const ly={context:"Tabs component was not found in the tree",value:"Tabs.Tab or Tabs.Panel component was rendered with invalid value or without value"},[pne,gx]=Do(ly.context);var hne=Object.defineProperty,Xj=Object.getOwnPropertySymbols,mne=Object.prototype.hasOwnProperty,gne=Object.prototype.propertyIsEnumerable,Jj=(e,t,r)=>t in e?hne(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,vne=(e,t)=>{for(var r in t||(t={}))mne.call(t,r)&&Jj(e,r,t[r]);if(Xj)for(var r of Xj(t))gne.call(t,r)&&Jj(e,r,t[r]);return e};function yne({orientation:e,inverted:t,placement:r},n,o){const i=e==="vertical";return o==="default"?{[i?r==="left"?"borderRight":"borderLeft":t?"borderTop":"borderBottom"]:`${j(2)} solid ${n.colorScheme==="dark"?n.colors.dark[4]:n.colors.gray[3]}`}:o==="outline"?{[i?r==="left"?"borderRight":"borderLeft":t?"borderTop":"borderBottom"]:`${j(1)} solid ${n.colorScheme==="dark"?n.colors.dark[4]:n.colors.gray[3]}`}:o==="pills"?{gap:`calc(${n.spacing.sm} / 2)`}:{}}var xne=W((e,t,{variant:r})=>{const n=t.orientation==="vertical";return{tabsList:vne({display:"flex",flexWrap:"wrap",flexDirection:n?"column":"row",justifyContent:WI[t.position],'& [role="tab"]':{flex:t.grow?1:void 0}},yne(t,e,r))}});const wne=xne;var bne=Object.defineProperty,_ne=Object.defineProperties,Sne=Object.getOwnPropertyDescriptors,rh=Object.getOwnPropertySymbols,i5=Object.prototype.hasOwnProperty,a5=Object.prototype.propertyIsEnumerable,Zj=(e,t,r)=>t in e?bne(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Pne=(e,t)=>{for(var r in t||(t={}))i5.call(t,r)&&Zj(e,r,t[r]);if(rh)for(var r of rh(t))a5.call(t,r)&&Zj(e,r,t[r]);return e},jne=(e,t)=>_ne(e,Sne(t)),One=(e,t)=>{var r={};for(var n in e)i5.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&rh)for(var n of rh(e))t.indexOf(n)<0&&a5.call(e,n)&&(r[n]=e[n]);return r};const Cne={grow:!1,position:"left"},s5=f.forwardRef((e,t)=>{const r=H("TabsList",Cne,e),{children:n,className:o,grow:i,position:a}=r,l=One(r,["children","className","grow","position"]),{orientation:c,variant:u,color:d,radius:p,inverted:h,placement:m,classNames:g,styles:v,unstyled:_}=gx(),{classes:y,cx:x}=wne({orientation:c,grow:i,color:d,position:a,radius:p,inverted:h,placement:m},{name:"Tabs",unstyled:_,classNames:g,styles:v,variant:u});return S.createElement(ie,jne(Pne({},l),{className:x(y.tabsList,o),ref:t,role:"tablist","aria-orientation":c}),n)});s5.displayName="@mantine/core/TabsList";var Ene=W((e,{orientation:t})=>({panel:{flex:t==="vertical"?1:void 0}}));const $ne=Ene;var kne=Object.defineProperty,Rne=Object.defineProperties,Tne=Object.getOwnPropertyDescriptors,nh=Object.getOwnPropertySymbols,l5=Object.prototype.hasOwnProperty,c5=Object.prototype.propertyIsEnumerable,eO=(e,t,r)=>t in e?kne(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Ine=(e,t)=>{for(var r in t||(t={}))l5.call(t,r)&&eO(e,r,t[r]);if(nh)for(var r of nh(t))c5.call(t,r)&&eO(e,r,t[r]);return e},Dne=(e,t)=>Rne(e,Tne(t)),Nne=(e,t)=>{var r={};for(var n in e)l5.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&nh)for(var n of nh(e))t.indexOf(n)<0&&c5.call(e,n)&&(r[n]=e[n]);return r};const Ane={},u5=f.forwardRef((e,t)=>{const r=H("TabsPanel",Ane,e),{value:n,children:o,sx:i,className:a}=r,l=Nne(r,["value","children","sx","className"]),c=gx(),{classes:u,cx:d}=$ne({orientation:c.orientation,color:c.color,radius:c.radius,inverted:c.inverted,placement:c.placement},{name:"Tabs",unstyled:c.unstyled,classNames:c.classNames,styles:c.styles,variant:c.variant}),p=c.getPanelId(n),h=c.value===n,m=c.keepMounted||h?o:null;return f.useEffect(()=>(c.setMountedPanelIds(g=>[...g,p]),c.setMountedPanelIds(g=>g.filter(v=>v!==p))),[p]),S.createElement(ie,Dne(Ine({},l),{ref:t,sx:[{display:h?void 0:"none"},...wc(i)],className:d(u.panel,a),role:"tabpanel",id:p,"aria-labelledby":c.getTabId(n)}),m)});u5.displayName="@mantine/core/TabsPanel";var Mne=Object.defineProperty,Lne=Object.defineProperties,zne=Object.getOwnPropertyDescriptors,tO=Object.getOwnPropertySymbols,Fne=Object.prototype.hasOwnProperty,Vne=Object.prototype.propertyIsEnumerable,rO=(e,t,r)=>t in e?Mne(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Za=(e,t)=>{for(var r in t||(t={}))Fne.call(t,r)&&rO(e,r,t[r]);if(tO)for(var r of tO(t))Vne.call(t,r)&&rO(e,r,t[r]);return e},nO=(e,t)=>Lne(e,zne(t));function Bne(e,{orientation:t,color:r,radius:n,inverted:o,placement:i},a){const l=t==="vertical",c=e.fn.variant({color:r,variant:"filled"}),u=j(e.fn.radius(n)),d=t==="vertical"?i==="left"?`${u} 0 0 ${u}`:` 0 ${u} ${u} 0`:o?`0 0 ${u} ${u}`:`${u} ${u} 0 0`;return a==="default"?nO(Za({[l?i==="left"?"borderRight":"borderLeft":o?"borderTop":"borderBottom"]:`${j(2)} solid transparent`,[l?i==="left"?"marginRight":"marginLeft":o?"marginTop":"marginBottom"]:j(-2),borderRadius:d},e.fn.hover({backgroundColor:e.colorScheme==="dark"?e.colors.dark[6]:e.colors.gray[0],borderColor:e.colorScheme==="dark"?e.colors.dark[4]:e.colors.gray[3]})),{"&[data-active]":Za({borderColor:c.background,color:e.colorScheme==="dark"?e.white:e.black},e.fn.hover({borderColor:c.background}))}):a==="outline"?{borderRadius:d,border:`${j(1)} solid transparent`,[l?i==="left"?"borderRight":"borderLeft":o?"borderTop":"borderBottom"]:"none","&[data-active]":{borderColor:e.colorScheme==="dark"?e.colors.dark[4]:e.colors.gray[3],"&::before":{content:'""',backgroundColor:e.colorScheme==="dark"?e.colors.dark[7]:e.white,position:"absolute",bottom:l?0:o?"unset":j(-1),top:l?0:o?j(-1):"unset",[l?"width":"height"]:j(1),right:l?i==="left"?j(-1):"unset":0,left:l?i==="left"?"unset":j(-1):0}}}:a==="pills"?nO(Za({borderRadius:e.fn.radius(n)},e.fn.hover({backgroundColor:e.colorScheme==="dark"?e.colors.dark[6]:e.colors.gray[0]})),{"&[data-active]":Za({backgroundColor:c.background,color:e.white},e.fn.hover({backgroundColor:c.background}))}):{}}var Une=W((e,t,{variant:r})=>({tabLabel:{},tab:Za({position:"relative",padding:`${e.spacing.xs} ${e.spacing.md}`,paddingLeft:t.withIcon?e.spacing.xs:void 0,paddingRight:t.withRightSection?e.spacing.xs:void 0,fontSize:e.fontSizes.sm,whiteSpace:"nowrap",zIndex:0,display:"flex",alignItems:"center",justifyContent:t.orientation==="horizontal"?"center":void 0,lineHeight:1,"&:disabled":Za({opacity:.5,cursor:"not-allowed"},e.fn.hover({backgroundColor:"transparent"})),"&:focus":{zIndex:1}},Bne(e,t,r)),tabRightSection:{display:"flex",justifyContent:"center",alignItems:"center","&:not(:only-child)":{marginLeft:j(7)}},tabIcon:{display:"flex",justifyContent:"center",alignItems:"center","&:not(:only-child)":{marginRight:j(7)}}}));const Wne=Une;var Hne=Object.defineProperty,qne=Object.defineProperties,Gne=Object.getOwnPropertyDescriptors,oh=Object.getOwnPropertySymbols,d5=Object.prototype.hasOwnProperty,f5=Object.prototype.propertyIsEnumerable,oO=(e,t,r)=>t in e?Hne(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Qne=(e,t)=>{for(var r in t||(t={}))d5.call(t,r)&&oO(e,r,t[r]);if(oh)for(var r of oh(t))f5.call(t,r)&&oO(e,r,t[r]);return e},Kne=(e,t)=>qne(e,Gne(t)),Yne=(e,t)=>{var r={};for(var n in e)d5.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&oh)for(var n of oh(e))t.indexOf(n)<0&&f5.call(e,n)&&(r[n]=e[n]);return r};const Xne={},p5=f.forwardRef((e,t)=>{const r=H("TabsTab",Xne,e),{value:n,children:o,onKeyDown:i,onClick:a,className:l,icon:c,rightSection:u,color:d}=r,p=Yne(r,["value","children","onKeyDown","onClick","className","icon","rightSection","color"]),h=gx(),m=!!c,g=!!u,{theme:v,classes:_,cx:y}=Wne({withIcon:m||g&&!o,withRightSection:g||m&&!o,orientation:h.orientation,color:d||h.color,radius:h.radius,inverted:h.inverted,placement:h.placement},{name:"Tabs",unstyled:h.unstyled,classNames:h.classNames,styles:h.styles,variant:h.variant}),x=n===h.value,w=h.getPanelId(n),b=h.mountedPanelIds.includes(n)?w:void 0,C=O=>{h.onTabChange(h.allowTabDeactivation&&n===h.value?null:n),a==null||a(O)};return S.createElement(So,Kne(Qne({},p),{unstyled:h.unstyled,className:y(_.tab,l),"data-active":x||void 0,ref:t,type:"button",role:"tab",id:h.getTabId(n),"aria-selected":x,tabIndex:x||h.value===null?0:-1,"aria-controls":b,onClick:C,onKeyDown:yE({siblingSelector:'[role="tab"]',parentSelector:'[role="tablist"]',activateOnFocus:h.activateTabWithKeyboard,loop:h.loop,dir:v.dir,orientation:h.orientation,onKeyDown:i})}),c&&S.createElement("span",{className:_.tabIcon},c),o&&S.createElement("span",{className:_.tabLabel},o),u&&S.createElement("span",{className:_.tabRightSection},u))});p5.displayName="@mantine/core/Tab";function h5({defaultValue:e,value:t,onTabChange:r,orientation:n,children:o,loop:i,id:a,activateTabWithKeyboard:l,allowTabDeactivation:c,variant:u,color:d,radius:p,inverted:h,placement:m,keepMounted:g=!0,classNames:v,styles:_,unstyled:y}){const x=Nr(a),[w,b]=f.useState([]),[C,O]=Tr({value:t,defaultValue:e,finalValue:null,onChange:r});return S.createElement(pne,{value:{placement:m,value:C,orientation:n,id:x,loop:i,activateTabWithKeyboard:l,getTabId:j1(`${x}-tab`,ly.value),getPanelId:j1(`${x}-panel`,ly.value),onTabChange:O,setMountedPanelIds:b,mountedPanelIds:w,allowTabDeactivation:c,variant:u,color:d,radius:p,inverted:h,keepMounted:g,classNames:v,styles:_,unstyled:y}},o)}h5.displayName="@mantine/core/TabsProvider";var Jne=W((e,{orientation:t,placement:r})=>({root:{display:t==="vertical"?"flex":void 0,flexDirection:r==="right"?"row-reverse":"row"}}));const Zne=Jne;var eoe=Object.defineProperty,toe=Object.defineProperties,roe=Object.getOwnPropertyDescriptors,ih=Object.getOwnPropertySymbols,m5=Object.prototype.hasOwnProperty,g5=Object.prototype.propertyIsEnumerable,iO=(e,t,r)=>t in e?eoe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,noe=(e,t)=>{for(var r in t||(t={}))m5.call(t,r)&&iO(e,r,t[r]);if(ih)for(var r of ih(t))g5.call(t,r)&&iO(e,r,t[r]);return e},ooe=(e,t)=>toe(e,roe(t)),ioe=(e,t)=>{var r={};for(var n in e)m5.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&ih)for(var n of ih(e))t.indexOf(n)<0&&g5.call(e,n)&&(r[n]=e[n]);return r};const aoe={orientation:"horizontal",loop:!0,activateTabWithKeyboard:!0,allowTabDeactivation:!1,unstyled:!1,inverted:!1,variant:"default",placement:"left"},We=f.forwardRef((e,t)=>{const r=H("Tabs",aoe,e),{defaultValue:n,value:o,orientation:i,loop:a,activateTabWithKeyboard:l,allowTabDeactivation:c,children:u,id:d,onTabChange:p,variant:h,color:m,className:g,unstyled:v,classNames:_,styles:y,radius:x,inverted:w,keepMounted:b,placement:C}=r,O=ioe(r,["defaultValue","value","orientation","loop","activateTabWithKeyboard","allowTabDeactivation","children","id","onTabChange","variant","color","className","unstyled","classNames","styles","radius","inverted","keepMounted","placement"]),{classes:P,cx:E}=Zne({orientation:i,color:m,radius:x,inverted:w,placement:C},{unstyled:v,name:"Tabs",classNames:_,styles:y,variant:h});return S.createElement(h5,{activateTabWithKeyboard:l,defaultValue:n,orientation:i,onTabChange:p,value:o,id:d,loop:a,allowTabDeactivation:c,color:m,variant:h,radius:x,inverted:w,keepMounted:b,placement:C,classNames:_,styles:y,unstyled:v},S.createElement(ie,ooe(noe({},O),{className:E(P.root,g),id:d,ref:t}),u))});We.List=s5;We.Tab=p5;We.Panel=u5;We.displayName="@mantine/core/Tabs";var soe=Object.defineProperty,loe=Object.defineProperties,coe=Object.getOwnPropertyDescriptors,aO=Object.getOwnPropertySymbols,uoe=Object.prototype.hasOwnProperty,doe=Object.prototype.propertyIsEnumerable,sO=(e,t,r)=>t in e?soe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,foe=(e,t)=>{for(var r in t||(t={}))uoe.call(t,r)&&sO(e,r,t[r]);if(aO)for(var r of aO(t))doe.call(t,r)&&sO(e,r,t[r]);return e},poe=(e,t)=>loe(e,coe(t));function hoe(e,t,r){return typeof e<"u"?e in r.headings.sizes?r.headings.sizes[e].fontSize:j(e):r.headings.sizes[t].fontSize}function moe(e,t,r){return typeof e<"u"&&e in r.headings.sizes?r.headings.sizes[e].lineHeight:r.headings.sizes[t].lineHeight}var goe=W((e,{element:t,weight:r,inline:n},{size:o})=>({root:poe(foe({},e.fn.fontStyles()),{fontFamily:e.headings.fontFamily,fontWeight:r||e.headings.sizes[t].fontWeight||e.headings.fontWeight,fontSize:hoe(o,t,e),lineHeight:n?1:moe(o,t,e),margin:0})}));const voe=goe;var yoe=Object.defineProperty,ah=Object.getOwnPropertySymbols,v5=Object.prototype.hasOwnProperty,y5=Object.prototype.propertyIsEnumerable,lO=(e,t,r)=>t in e?yoe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,xoe=(e,t)=>{for(var r in t||(t={}))v5.call(t,r)&&lO(e,r,t[r]);if(ah)for(var r of ah(t))y5.call(t,r)&&lO(e,r,t[r]);return e},woe=(e,t)=>{var r={};for(var n in e)v5.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&ah)for(var n of ah(e))t.indexOf(n)<0&&y5.call(e,n)&&(r[n]=e[n]);return r};const boe={order:1},ue=f.forwardRef((e,t)=>{const r=H("Title",boe,e),{className:n,order:o,children:i,unstyled:a,size:l,weight:c,inline:u,variant:d}=r,p=woe(r,["className","order","children","unstyled","size","weight","inline","variant"]),{classes:h,cx:m}=voe({element:`h${o}`,weight:c,inline:u},{name:"Title",unstyled:a,variant:d,size:l});return[1,2,3,4,5,6].includes(o)?S.createElement(oe,xoe({variant:d,component:`h${o}`,ref:t,className:m(h.root,n)},p),i):null});ue.displayName="@mantine/core/Title";function cy(e,t){return cy=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},cy(e,t)}function x5(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,cy(e,t)}var w5={exports:{}},_oe="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED",Soe=_oe,Poe=Soe;function b5(){}function _5(){}_5.resetWarningCache=b5;var joe=function(){function e(n,o,i,a,l,c){if(c!==Poe){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 r={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:_5,resetWarningCache:b5};return r.PropTypes=r,r};w5.exports=joe();var Ooe=w5.exports;const Ie=Ay(Ooe),cO={disabled:!1},sh=S.createContext(null);var jl="unmounted",Vi="exited",Bi="entering",Fa="entered",uy="exiting",zo=function(e){x5(t,e);function t(n,o){var i;i=e.call(this,n,o)||this;var a=o,l=a&&!a.isMounting?n.enter:n.appear,c;return i.appearStatus=null,n.in?l?(c=Vi,i.appearStatus=Bi):c=Fa:n.unmountOnExit||n.mountOnEnter?c=jl:c=Vi,i.state={status:c},i.nextCallback=null,i}t.getDerivedStateFromProps=function(o,i){var a=o.in;return a&&i.status===jl?{status:Vi}:null};var r=t.prototype;return r.componentDidMount=function(){this.updateStatus(!0,this.appearStatus)},r.componentDidUpdate=function(o){var i=null;if(o!==this.props){var a=this.state.status;this.props.in?a!==Bi&&a!==Fa&&(i=Bi):(a===Bi||a===Fa)&&(i=uy)}this.updateStatus(!1,i)},r.componentWillUnmount=function(){this.cancelNextCallback()},r.getTimeouts=function(){var o=this.props.timeout,i,a,l;return i=a=l=o,o!=null&&typeof o!="number"&&(i=o.exit,a=o.enter,l=o.appear!==void 0?o.appear:a),{exit:i,enter:a,appear:l}},r.updateStatus=function(o,i){o===void 0&&(o=!1),i!==null?(this.cancelNextCallback(),i===Bi?this.performEnter(o):this.performExit()):this.props.unmountOnExit&&this.state.status===Vi&&this.setState({status:jl})},r.performEnter=function(o){var i=this,a=this.props.enter,l=this.context?this.context.isMounting:o,c=this.props.nodeRef?[l]:[hd.findDOMNode(this),l],u=c[0],d=c[1],p=this.getTimeouts(),h=l?p.appear:p.enter;if(!o&&!a||cO.disabled){this.safeSetState({status:Fa},function(){i.props.onEntered(u)});return}this.props.onEnter(u,d),this.safeSetState({status:Bi},function(){i.props.onEntering(u,d),i.onTransitionEnd(h,function(){i.safeSetState({status:Fa},function(){i.props.onEntered(u,d)})})})},r.performExit=function(){var o=this,i=this.props.exit,a=this.getTimeouts(),l=this.props.nodeRef?void 0:hd.findDOMNode(this);if(!i||cO.disabled){this.safeSetState({status:Vi},function(){o.props.onExited(l)});return}this.props.onExit(l),this.safeSetState({status:uy},function(){o.props.onExiting(l),o.onTransitionEnd(a.exit,function(){o.safeSetState({status:Vi},function(){o.props.onExited(l)})})})},r.cancelNextCallback=function(){this.nextCallback!==null&&(this.nextCallback.cancel(),this.nextCallback=null)},r.safeSetState=function(o,i){i=this.setNextCallback(i),this.setState(o,i)},r.setNextCallback=function(o){var i=this,a=!0;return this.nextCallback=function(l){a&&(a=!1,i.nextCallback=null,o(l))},this.nextCallback.cancel=function(){a=!1},this.nextCallback},r.onTransitionEnd=function(o,i){this.setNextCallback(i);var a=this.props.nodeRef?this.props.nodeRef.current:hd.findDOMNode(this),l=o==null&&!this.props.addEndListener;if(!a||l){setTimeout(this.nextCallback,0);return}if(this.props.addEndListener){var c=this.props.nodeRef?[this.nextCallback]:[a,this.nextCallback],u=c[0],d=c[1];this.props.addEndListener(u,d)}o!=null&&setTimeout(this.nextCallback,o)},r.render=function(){var o=this.state.status;if(o===jl)return null;var i=this.props,a=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=dx(i,["children","in","mountOnEnter","unmountOnExit","appear","enter","exit","timeout","addEndListener","onEnter","onEntering","onEntered","onExit","onExiting","onExited","nodeRef"]);return S.createElement(sh.Provider,{value:null},typeof a=="function"?a(o,l):S.cloneElement(S.Children.only(a),l))},t}(S.Component);zo.contextType=sh;zo.propTypes={};function Na(){}zo.defaultProps={in:!1,mountOnEnter:!1,unmountOnExit:!1,appear:!1,enter:!0,exit:!0,onEnter:Na,onEntering:Na,onEntered:Na,onExit:Na,onExiting:Na,onExited:Na};zo.UNMOUNTED=jl;zo.EXITED=Vi;zo.ENTERING=Bi;zo.ENTERED=Fa;zo.EXITING=uy;const Coe=zo;function Eoe(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function vx(e,t){var r=function(i){return t&&f.isValidElement(i)?t(i):i},n=Object.create(null);return e&&f.Children.map(e,function(o){return o}).forEach(function(o){n[o.key]=r(o)}),n}function $oe(e,t){e=e||{},t=t||{};function r(d){return d in t?t[d]:e[d]}var n=Object.create(null),o=[];for(var i in e)i in t?o.length&&(n[i]=o,o=[]):o.push(i);var a,l={};for(var c in t){if(n[c])for(a=0;a<n[c].length;a++){var u=n[c][a];l[n[c][a]]=r(u)}l[c]=r(c)}for(a=0;a<o.length;a++)l[o[a]]=r(o[a]);return l}function Qi(e,t,r){return r[t]!=null?r[t]:e.props[t]}function koe(e,t){return vx(e.children,function(r){return f.cloneElement(r,{onExited:t.bind(null,r),in:!0,appear:Qi(r,"appear",e),enter:Qi(r,"enter",e),exit:Qi(r,"exit",e)})})}function Roe(e,t,r){var n=vx(e.children),o=$oe(t,n);return Object.keys(o).forEach(function(i){var a=o[i];if(f.isValidElement(a)){var l=i in t,c=i in n,u=t[i],d=f.isValidElement(u)&&!u.props.in;c&&(!l||d)?o[i]=f.cloneElement(a,{onExited:r.bind(null,a),in:!0,exit:Qi(a,"exit",e),enter:Qi(a,"enter",e)}):!c&&l&&!d?o[i]=f.cloneElement(a,{in:!1}):c&&l&&f.isValidElement(u)&&(o[i]=f.cloneElement(a,{onExited:r.bind(null,a),in:u.props.in,exit:Qi(a,"exit",e),enter:Qi(a,"enter",e)}))}}),o}var Toe=Object.values||function(e){return Object.keys(e).map(function(t){return e[t]})},Ioe={component:"div",childFactory:function(t){return t}},yx=function(e){x5(t,e);function t(n,o){var i;i=e.call(this,n,o)||this;var a=i.handleExited.bind(Eoe(i));return i.state={contextValue:{isMounting:!0},handleExited:a,firstRender:!0},i}var r=t.prototype;return r.componentDidMount=function(){this.mounted=!0,this.setState({contextValue:{isMounting:!1}})},r.componentWillUnmount=function(){this.mounted=!1},t.getDerivedStateFromProps=function(o,i){var a=i.children,l=i.handleExited,c=i.firstRender;return{children:c?koe(o,l):Roe(o,a,l),firstRender:!1}},r.handleExited=function(o,i){var a=vx(this.props.children);o.key in a||(o.props.onExited&&o.props.onExited(i),this.mounted&&this.setState(function(l){var c=it({},l.children);return delete c[o.key],{children:c}}))},r.render=function(){var o=this.props,i=o.component,a=o.childFactory,l=dx(o,["component","childFactory"]),c=this.state.contextValue,u=Toe(this.state.children).map(a);return delete l.appear,delete l.enter,delete l.exit,i===null?S.createElement(sh.Provider,{value:c},u):S.createElement(sh.Provider,{value:c},S.createElement(i,l,u))},t}(S.Component);yx.propTypes={};yx.defaultProps=Ioe;const Doe=yx,[Noe,Mc]=S9("mantine-notifications"),pe=Mc("show"),Aoe=Mc("hide"),Moe=Mc("clean"),Loe=Mc("cleanQueue"),Ol=Mc("update"),_o={show:pe,hide:Aoe,clean:Moe,cleanQueue:Loe,update:Ol};function zoe([e,t],r){const n={};return e==="top"&&(n.top=r),e==="bottom"&&(n.bottom=r),t==="left"&&(n.left=r),t==="right"&&(n.right=r),t==="center"&&(n.left="50%",n.transform="translateX(-50%)"),n}var Foe=Object.defineProperty,uO=Object.getOwnPropertySymbols,Voe=Object.prototype.hasOwnProperty,Boe=Object.prototype.propertyIsEnumerable,dO=(e,t,r)=>t in e?Foe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,fO=(e,t)=>{for(var r in t||(t={}))Voe.call(t,r)&&dO(e,r,t[r]);if(uO)for(var r of uO(t))Boe.call(t,r)&&dO(e,r,t[r]);return e};const pO={left:"translateX(-100%)",right:"translateX(100%)","top-center":"translateY(-100%)","bottom-center":"translateY(100%)"},Uoe={left:"translateX(0)",right:"translateX(0)","top-center":"translateY(0)","bottom-center":"translateY(0)"};function Woe({state:e,maxHeight:t,positioning:r,transitionDuration:n}){const[o,i]=r,a=i==="center"?`${o}-center`:i,l={opacity:0,maxHeight:t,transform:pO[a],transitionDuration:`${n}ms, ${n}ms, ${n}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:Uoe[a]},u={opacity:0,maxHeight:0,transform:pO[a]},d={entering:c,entered:c,exiting:u,exited:u};return fO(fO({},l),d[e])}function Hoe(e,t){return typeof t=="number"?t:t===!1||e===!1?!1:e}var qoe=Object.defineProperty,Goe=Object.defineProperties,Qoe=Object.getOwnPropertyDescriptors,lh=Object.getOwnPropertySymbols,S5=Object.prototype.hasOwnProperty,P5=Object.prototype.propertyIsEnumerable,hO=(e,t,r)=>t in e?qoe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,mO=(e,t)=>{for(var r in t||(t={}))S5.call(t,r)&&hO(e,r,t[r]);if(lh)for(var r of lh(t))P5.call(t,r)&&hO(e,r,t[r]);return e},Koe=(e,t)=>Goe(e,Qoe(t)),gO=(e,t)=>{var r={};for(var n in e)S5.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&lh)for(var n of lh(e))t.indexOf(n)<0&&P5.call(e,n)&&(r[n]=e[n]);return r};function j5(e){var t=e,{notification:r,autoClose:n,onHide:o,innerRef:i}=t,a=gO(t,["notification","autoClose","onHide","innerRef"]);const l=r,{autoClose:c,message:u}=l,d=gO(l,["autoClose","message"]),p=Hoe(n,c),h=f.useRef(),m=()=>{o(r.id),window.clearTimeout(h.current)},g=()=>{clearTimeout(h.current)},v=()=>{typeof p=="number"&&(h.current=window.setTimeout(m,p))};return f.useEffect(()=>{typeof r.onOpen=="function"&&r.onOpen(r)},[]),f.useEffect(()=>(v(),g),[n,r.autoClose]),S.createElement(QD,Koe(mO(mO({},d),a),{onClose:m,onMouseEnter:g,onMouseLeave:v,ref:i}),u)}j5.displayName="@mantine/notifications/NotificationContainer";var Yoe=W((e,{zIndex:t})=>({notifications:{width:`calc(100% - ${e.spacing.md} * 2)`,boxSizing:"border-box",position:"fixed",zIndex:t},notification:{"&:not(:first-of-type)":{marginTop:e.spacing.sm}}}));const Xoe=Yoe;var Joe=Object.defineProperty,Zoe=Object.defineProperties,eie=Object.getOwnPropertyDescriptors,vO=Object.getOwnPropertySymbols,tie=Object.prototype.hasOwnProperty,rie=Object.prototype.propertyIsEnumerable,yO=(e,t,r)=>t in e?Joe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,nie=(e,t)=>{for(var r in t||(t={}))tie.call(t,r)&&yO(e,r,t[r]);if(vO)for(var r of vO(t))rie.call(t,r)&&yO(e,r,t[r]);return e},oie=(e,t)=>Zoe(e,eie(t));function iie({limit:e}){const{state:t,queue:r,update:n,cleanQueue:o}=oL({initialValues:[],limit:e});return{notifications:t,queue:r,showNotification:u=>{const d=u.id||Lh();return n(p=>u.id&&p.some(h=>h.id===u.id)?p:[...p,oie(nie({},u),{id:d})]),d},updateNotification:u=>n(d=>{const p=d.findIndex(m=>m.id===u.id);if(p===-1)return d;const h=[...d];return h[p]=u,h}),hideNotification:u=>n(d=>d.filter(p=>p.id===u?(typeof p.onClose=="function"&&p.onClose(p),!1):!0)),cleanQueue:o,clean:()=>n(()=>[])}}var aie=Object.defineProperty,ch=Object.getOwnPropertySymbols,O5=Object.prototype.hasOwnProperty,C5=Object.prototype.propertyIsEnumerable,xO=(e,t,r)=>t in e?aie(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Mg=(e,t)=>{for(var r in t||(t={}))O5.call(t,r)&&xO(e,r,t[r]);if(ch)for(var r of ch(t))C5.call(t,r)&&xO(e,r,t[r]);return e},sie=(e,t)=>{var r={};for(var n in e)O5.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&ch)for(var n of ch(e))t.indexOf(n)<0&&C5.call(e,n)&&(r[n]=e[n]);return r};const lie=["top-left","top-right","top-center","bottom-left","bottom-right","bottom-center"],wa=e=>{var t=e,{className:r,position:n="bottom-right",autoClose:o=4e3,transitionDuration:i=250,containerWidth:a=j(440),notificationMaxHeight:l=j(200),limit:c=5,zIndex:u=Tn("overlay"),style:d,children:p,target:h}=t,m=sie(t,["className","position","autoClose","transitionDuration","containerWidth","notificationMaxHeight","limit","zIndex","style","children","target"]);const g=Z6(),v=f.useRef({}),_=f.useRef(0),{notifications:y,showNotification:x,updateNotification:w,hideNotification:b,clean:C,cleanQueue:O}=iie({limit:c}),{classes:P,cx:E,theme:$}=Xoe({zIndex:u}),k=zh(),T=($.respectReducedMotion?k:!1)?1:i,N=(lie.includes(n)?n:"bottom-right").split("-");ln(()=>{y.length>_.current&&setTimeout(()=>g(),0),_.current=y.length},[y]),Noe({show:x,hide:b,update:w,clean:C,cleanQueue:O});const A=y.map(z=>S.createElement(Coe,{key:z.id,timeout:T,onEnter:()=>v.current[z.id].offsetHeight,nodeRef:{current:v.current[z.id]}},G=>S.createElement(j5,{innerRef:X=>{v.current[z.id]=X},notification:z,onHide:b,className:P.notification,autoClose:o,sx:[Mg({},Woe({state:G,positioning:N,transitionDuration:T,maxHeight:l})),...Array.isArray(z.sx)?z.sx:[z.sx]]})));return S.createElement(V0,{target:h},S.createElement(ie,Mg({className:E(P.notifications,r),style:d,sx:Mg({maxWidth:a},zoe(N,$.spacing.md))},m),S.createElement(Doe,null,A)))};wa.displayName="@mantine/notifications/Notifications";wa.show=_o.show;wa.hide=_o.hide;wa.update=_o.update;wa.clean=_o.clean;wa.cleanQueue=_o.cleanQueue;class cie{constructor(t,r){this.operator=t,this.child=r}toString(){return`${this.operator}(${this.child.toString()})`}}class Lc{constructor(t,r,n){this.operator=t,this.left=r,this.right=n}toString(){return`${this.left.toString()} ${this.operator} ${this.right.toString()}`}}class uie{constructor(){this.prefixParselets={},this.infixParselets={}}registerInfix(t,r){return this.infixParselets[t]=r,this}registerPrefix(t,r){return this.prefixParselets[t]=r,this}prefix(t,r,n){return this.registerPrefix(t,{parse(o,i){const a=o.consumeAndParse(r);return n(i,a)}})}infixLeft(t,r,n){return this.registerInfix(t,{parse(o,i,a){const l=o.consumeAndParse(r);return n(i,a,l)},precedence:r})}construct(t){return new die(t,this.prefixParselets,this.infixParselets)}}class die{constructor(t,r,n){this.tokens=t,this.prefixParselets=r,this.infixParselets=n}hasMore(){return this.tokens.length>0}match(t){const r=this.peek();return(r==null?void 0:r.id)!==t?!1:(this.consume(),!0)}consumeAndParse(t=1/0){const r=this.consume(),n=this.prefixParselets[r.id];if(!n)throw Error(`Parse error at "${r.value}" (line ${r.line}, column ${r.column}). No matching prefix parselet.`);let o=n.parse(this,r);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 r=this.getInfixParselet(t);return r?r.precedence:1/0}consume(t,r){var n,o;if(!this.tokens.length)throw Error("Cant consume unknown more tokens.");if(t&&((n=this.peek())==null?void 0:n.id)!==t){const i=this.peek();throw Error(`Expected ${t} but got "${i.id}" at line ${i.line} column ${i.column}.`)}if(r&&((o=this.peek())==null?void 0:o.value)!==r){const i=this.peek();throw Error(`Expected "${r}" 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]}}function ht(e){const t=nt(e),r=ko(e);return r===t?{reference:t}:{reference:t,display:r}}function nt(e){return Pa(e)?e.reference:`${e.resourceType}/${e.id}`}function xx(e){if(e)return Pa(e)?e.reference.split("/")[1]:e.id}function fie(e){return e.resourceType==="Patient"||e.resourceType==="Practitioner"||e.resourceType==="RelatedPerson"}function ko(e){var t;if(fie(e)){const r=pie(e);if(r)return r}if(e.resourceType==="Device"){const r=hie(e);if(r)return r}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:nt(e)}function pie(e){const t=e.name;if(t&&t.length>0)return zc(t[0])}function hie(e){const t=e.deviceName;if(t&&t.length>0)return t[0].name}function mie(e){if(!("photo"in e))return;const t=e.photo;if(t)if(Array.isArray(t))for(const r of t){const n=wO(r);if(n)return n}else return wO(t)}function wO(e){if(e.url&&e.contentType&&e.contentType.startsWith("image/"))return e.url}function E5(e,t){const r=new Date(e);r.setUTCHours(0,0,0,0);const n=t?new Date(t):new Date;n.setUTCHours(0,0,0,0);const o=r.getUTCFullYear(),i=r.getUTCMonth(),a=r.getUTCDate(),l=n.getUTCFullYear(),c=n.getUTCMonth(),u=n.getUTCDate();let d=l-o;(c<i||c===i&&u<a)&&d--;let p=l*12+c-(o*12+i);u<a&&p--;const h=Math.floor((n.getTime()-r.getTime())/(1e3*60*60*24));return{years:d,months:p,days:h}}function gie(e,t){const{years:r,months:n,days:o}=E5(e,t);return r>=2?r.toString().padStart(3,"0")+"Y":n>=1?n.toString().padStart(3,"0")+"M":o.toString().padStart(3,"0")+"D"}function hm(e,...t){var n;let r=e;for(let o=0;o<t.length&&r;o++)r=(n=r==null?void 0:r.extension)==null?void 0:n.find(i=>i.url===t[o]);return r}function Ir(e,t){return JSON.stringify(e,vie,t?2:void 0)}function vie(e,t){return!yie(e)&&xo(t)?void 0:t}function yie(e){return!!/\d+$/.exec(e)}function xo(e){if(e==null)return!0;const t=typeof e;return t==="string"&&e===""||t==="object"&&Object.keys(e).length===0}function mm(e,t,r){return e===t||xo(e)&&xo(t)?!0:xo(e)||xo(t)?!1:Array.isArray(e)&&Array.isArray(t)?xie(e,t):Array.isArray(e)||Array.isArray(t)?!1:qu(e)&&qu(t)?wie(e,t,r):(qu(e)||qu(t),!1)}function xie(e,t){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(!mm(e[r],t[r]))return!1;return!0}function wie(e,t,r){const n=new Set;Object.keys(e).forEach(o=>n.add(o)),Object.keys(t).forEach(o=>n.add(o)),r==="meta"&&(n.delete("versionId"),n.delete("lastUpdated"),n.delete("author"));for(const o of n){const i=e[o],a=t[o];if(!mm(i,a,o))return!1}return!0}function ba(e){return JSON.parse(JSON.stringify(e))}function $5(e){return!!/^\w{8}-\w{4}-\w{4}-\w{4}-\w{12}$/i.exec(e)}function qu(e){return e!==null&&typeof e=="object"}const k5=[];for(let e=0;e<256;e++)k5.push(e.toString(16).padStart(2,"0"));function bie(e){const t=new Uint8Array(e),r=new Array(t.length);for(let n=0;n<t.length;n++)r[n]=k5[t[n]];return r.join("")}function _ie(e){const t=new Uint8Array(e),r=[];for(let n=0;n<t.length;n++)r[n]=String.fromCharCode(t[n]);return window.btoa(r.join(""))}function sr(e){return e?e.charAt(0).toUpperCase()+e.substring(1):""}function Sie(e,t){var r,n;return(n=(r=e.coding)==null?void 0:r.find(o=>o.system===t))==null?void 0:n.code}const bO=e=>new Promise(t=>{setTimeout(t,e)});function Pie(e,t,r){const n=[];for(let o=0;o<r-1;o++){let i=e.indexOf(t);i<0&&(i=e.length),n.push(e.slice(0,i)),e=e.slice(i+t.length)}return e&&n.push(e),n}function jie(e,t){const r=[];if(e.line&&r.push(...e.line),e.city||e.state||e.postalCode){const n=[];e.city&&n.push(e.city),e.state&&n.push(e.state),e.postalCode&&n.push(e.postalCode),r.push(n.join(", "))}return e.use&&(t!=null&&t.all||t!=null&&t.use)&&r.push("["+e.use+"]"),r.join((t==null?void 0:t.lineSeparator)??", ").trim()}function zc(e,t){const r=[];if(e.prefix&&(t==null?void 0:t.prefix)!==!1&&r.push(...e.prefix),e.given&&r.push(...e.given),e.family&&r.push(e.family),e.suffix&&(t==null?void 0:t.suffix)!==!1&&r.push(...e.suffix),e.use&&(t!=null&&t.all||t!=null&&t.use)&&r.push("["+e.use+"]"),r.length===0){const n=fc(e.text);if(n)return n}return r.join(" ").trim()}function gm(e){return e instanceof Date&&!isNaN(e.getTime())}function Oie(e,t,r){if(!e)return"";const n=new Date("2000-01-01T"+e+"Z");return gm(n)?n.toLocaleTimeString(t,r):""}function Dr(e,t,r){if(!e)return"";const n=new Date(e);return gm(n)?n.toLocaleString(t,r):""}function Cie(e,t,r){return!e||!e.start&&!e.end?"":Dr(e.start,t,r)+" - "+Dr(e.end,t,r)}const Eie={s:"every second",min:"every minute",h:"hourly",d:"daily",wk:"weekly",mo:"monthly",a:"annually"},$ie={s:"second",min:"minute",h:"hour",d:"day",wk:"week",mo:"month",a:"year"},kie={s:"seconds",min:"minutes",h:"hours",d:"days",wk:"weeks",mo:"months",a:"years"};function R5(e){if(!e)return"";const t=[];return Rie(t,e.repeat),e.event&&t.push(e.event.map(r=>Dr(r)).join(", ")),sr(t.join(" ").trim())}function Rie(e,t){if(!(t!=null&&t.periodUnit))return;const r=t.frequency??1,n=t.period??1,o=t.periodUnit;r===1&&n===1?e.push(Eie[o]):(r===1?e.push("once"):e.push(r+" times"),n===1?e.push("per "+$ie[o]):e.push("per "+n+" "+kie[o])),t.dayOfWeek&&e.push("on "+t.dayOfWeek.map(sr).join(", ")),t.timeOfDay&&e.push("at "+t.timeOfDay.map(i=>Oie(i)).join(", "))}function dc(e,t,r=!1){if(r&&t===void 0)throw new Error("Precision must be specified for exclusive ranges");const n=(e==null?void 0:e.low)&&{...e.low,comparator:void 0},o=(e==null?void 0:e.high)&&{...e.high,comparator:void 0};return(n==null?void 0:n.value)===void 0&&(o==null?void 0:o.value)===void 0?"":(n==null?void 0:n.value)!==void 0&&(o==null?void 0:o.value)===void 0?r&&t!==void 0?(n.value=Die(n.value,t),`> ${ti(n,t)}`):`>= ${ti(n,t)}`:(n==null?void 0:n.value)===void 0&&(o==null?void 0:o.value)!==void 0?r&&t!==void 0?(o.value=Iie(o.value,t),`< ${ti(o,t)}`):`<= ${ti(o,t)}`:((n==null?void 0:n.unit)===(o==null?void 0:o.unit)&&(n==null||delete n.unit),`${ti(n,t)} - ${ti(o,t)}`)}function ti(e,t){if(!e)return"";const r=[];return e.comparator&&(r.push(e.comparator),r.push(" ")),e.value!==void 0&&(t!==void 0?r.push(e.value.toFixed(t)):r.push(e.value)),e.unit&&(e.unit!=="%"&&r[r.length-1]!==" "&&r.push(" "),r.push(e.unit)),r.join("").trim()}function Tie(e){return(e==null?void 0:e.value)===void 0?"":e.value.toLocaleString(void 0,{style:"currency",currency:e.currency??"USD",currencyDisplay:"narrowSymbol"})}function js(e){if(!e)return"";const t=fc(e.text);return t||(e.coding?e.coding.map(r=>_a(r)).join(", "):"")}function _a(e){return fc(e==null?void 0:e.display)??fc(e==null?void 0:e.code)??""}function T5(e){if(!e)return"";if("component"in e)return e.component.map(r=>T5(r)).join(" / ");if(e.valueQuantity)return ti(e.valueQuantity);if(e.valueCodeableConcept)return js(e.valueCodeableConcept);const t=fc(e.valueString);return t||""}function fc(e){return typeof e=="string"?e:void 0}function Iie(e,t,r=1){return(I5(e,t)+r)*Math.pow(10,-t)}function Die(e,t,r=1){return(I5(e,t)-r)*Math.pow(10,-t)}function I5(e,t){return t===void 0?e:Math.round(e*Math.pow(10,t))}function Nie(e){const t=e.max&&e.max===Number.MAX_SAFE_INTEGER?Number.POSITIVE_INFINITY:e.max;return{path:"",description:"",type:e.type??[],min:e.min??0,max:t??1,isArray:!!t&&t>1,constraints:[]}}function Aie(e){const t=Object.create(null);for(const[r,n]of Object.entries(e))t[r]={name:r,elements:Object.fromEntries(Object.entries(n.elements).map(([o,i])=>[o,Nie(i)])),constraints:[],innerTypes:[]};return t}const Mie={elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]}}},Lie={elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},modifierExtension:{max:9007199254740991,type:[{code:"Extension"}]}}},zie={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"}]}}},Fie={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"}]}}},Vie={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"}]}}},Bie={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"}]}}},Uie={elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},coding:{max:9007199254740991,type:[{code:"Coding"}]},text:{type:[{code:"string"}]}}},Wie={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"}]}}},Hie={elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},name:{type:[{code:"string"}]},telecom:{max:9007199254740991,type:[{code:"ContactPoint"}]}}},qie={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"}]}}},Gie={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"}]}}},Qie={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"}]}}},Kie={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"}]}}},Yie={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"}]}}},Xie={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"}]},maxDosePerLifetime:{type:[{code:"Quantity"}]}}},Jie={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"}]}}},Zie={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"}]}}},eae={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"}]}}},tae={elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},url:{min:1,type:[{code:"string"}]},"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"}]}}},rae={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"}]}}},nae={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"]}]}}},oae={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"}]}}},iae={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"}]}}},aae={elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},value:{type:[{code:"decimal"}]},currency:{type:[{code:"code"}]}}},sae={elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},status:{min:1,type:[{code:"code"}]},div:{min:1,type:[{code:"xhtml"}]}}},lae={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"]}]}}},cae={elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},start:{type:[{code:"dateTime"}]},end:{type:[{code:"dateTime"}]}}},uae={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"}]}}},dae={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"}]}}},fae={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"}]}}},pae={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"}]}}},hae={elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},low:{type:[{code:"Quantity"}]},high:{type:[{code:"Quantity"}]}}},mae={elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},numerator:{type:[{code:"Quantity"}]},denominator:{type:[{code:"Quantity"}]}}},gae={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"}]}}},vae={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"]}]}}},yae={elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},origin:{min:1,type:[{code:"Quantity"}]},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"}]}}},xae={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"}]}}},wae={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"}]}}},bae={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"}]}}},_ae={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"}]}}},Sae={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"]}]}}},Pae={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"}]}}},jae={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"}]}}},Oae={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"}]}}},Cae={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"}]}}},Eae={Element:Mie,BackboneElement:Lie,Address:zie,Age:Fie,Annotation:Vie,Attachment:Bie,CodeableConcept:Uie,Coding:Wie,ContactDetail:Hie,ContactPoint:qie,Contributor:Gie,Count:Qie,DataRequirement:Kie,Distance:Yie,Dosage:Xie,Duration:Jie,ElementDefinition:Zie,Expression:eae,Extension:tae,HumanName:rae,Identifier:nae,MarketingStatus:oae,Meta:iae,Money:aae,Narrative:sae,ParameterDefinition:lae,Period:cae,Population:uae,ProdCharacteristic:dae,ProductShelfLife:fae,Quantity:pae,Range:hae,Ratio:mae,Reference:gae,RelatedArtifact:vae,SampledData:yae,Signature:xae,SubstanceAmount:wae,Timing:bae,TriggerDefinition:_ae,UsageContext:Sae,MoneyQuantity:Pae,SimpleQuantity:jae,MetadataResource:Oae,IdentityProvider:Cae};function ve(e){return[{type:B.boolean,value:e}]}function no(e){return e==null?{type:"undefined",value:void 0}:Number.isSafeInteger(e)?{type:B.integer,value:e}:typeof e=="number"?{type:B.decimal,value:e}:typeof e=="boolean"?{type:B.boolean,value:e}:typeof e=="string"?{type:B.string,value:e}:dn(e)?{type:B.Quantity,value:e}:Fo(e)?{type:e.resourceType,value:e}:{type:B.BackboneElement,value:e}}function li(e){return e.length===0?!1:!!e[0].value}function Ro(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 yr(e,t){if(!e.value)return;const r=Sa(e.type,t);return r?$ae(e,t,r):kae(e,t)}function $ae(e,t,r){const n=r.type;if(!n||n.length===0)return;let o,i="undefined";if(n.length===1)o=e.value[t],i=n[0].code;else for(const l of n){const c=t.replace("[x]","")+sr(l.code);if(c in e.value){o=e.value[c],i=l.code;break}}const a=e.value["_"+t];if(a&&(Array.isArray(o)?o=o.map((l,c)=>a[c]?jO(l??{},a[c]):l):o=jO(o??{},a)),!xo(o))return(i==="Element"||i==="BackboneElement")&&(i=r.type[0].code),Array.isArray(o)?o.map(l=>_O(l,i)):_O(o,i)}function _O(e,t){return t==="Resource"&&Fo(e)&&(t=e.resourceType),{type:t,value:e}}function kae(e,t){const r=e.value;if(!r||typeof r!="object")return;let n;if(t in r)n=r[t];else for(const o in B){const i=t+sr(o);if(i in r){n=r[i];break}}if(!xo(n))return Array.isArray(n)?n.map(no):no(n)}function D5(e){const t=[];for(const r of e){let n=!1;for(const o of t)if(li(M5(r,o))){n=!0;break}n||t.push(r)}return t}function N5(e){return ve(!li(e))}function A5(e,t){return e.length===0||t.length===0?[]:e.length!==t.length?ve(!1):ve(e.every((r,n)=>li(M5(r,t[n]))))}function M5(e,t){var o,i;const r=(o=e.value)==null?void 0:o.valueOf(),n=(i=t.value)==null?void 0:i.valueOf();return typeof r=="number"&&typeof n=="number"?ve(Math.abs(r-n)<1e-8):dn(r)&&dn(n)?ve(F5(r,n)):ve(typeof r=="object"&&typeof n=="object"?wx(e,t):r===n)}function L5(e,t){return e.length===0&&t.length===0?ve(!0):e.length!==t.length?ve(!1):(e.sort(SO),t.sort(SO),ve(e.every((r,n)=>li(Rae(r,t[n])))))}function Rae(e,t){const{type:r,value:n}=e,{type:o,value:i}=t,a=n==null?void 0:n.valueOf(),l=i==null?void 0:i.valueOf();return typeof a=="number"&&typeof l=="number"?ve(Math.abs(a-l)<.01):dn(a)&&dn(l)?ve(F5(a,l)):ve(r==="Coding"&&o==="Coding"?typeof a!="object"||typeof l!="object"?!1:a.code===l.code&&a.system===l.system:typeof a=="object"&&typeof l=="object"?wx({...a,id:void 0},{...l,id:void 0}):typeof a=="string"&&typeof l=="string"?a.toLowerCase()===l.toLowerCase():a===l)}function SO(e,t){var o,i;const r=(o=e.value)==null?void 0:o.valueOf(),n=(i=t.value)==null?void 0:i.valueOf();return typeof r=="number"&&typeof n=="number"?r-n:typeof r=="string"&&typeof n=="string"?r.localeCompare(n):0}function z5(e,t){const{value:r}=e;if(r==null)return!1;switch(t){case"Boolean":return typeof r=="boolean";case"Decimal":case"Integer":return typeof r=="number";case"Date":return typeof r=="string"&&!!/^\d{4}(-\d{2}(-\d{2})?)?/.exec(r);case"DateTime":return typeof r=="string"&&!!/^\d{4}(-\d{2}(-\d{2})?)?T/.exec(r);case"Time":return typeof r=="string"&&!!/^T\d/.exec(r);case"Period":return Tae(r);case"Quantity":return dn(r);default:return typeof r=="object"&&(r==null?void 0:r.resourceType)===t}}function Tae(e){return!!(e&&typeof e=="object"&&"start"in e)}function dn(e){return!!(e&&typeof e=="object"&&"value"in e&&typeof e.value=="number")}function F5(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 wx(e,t){const r=Object.keys(e),n=Object.keys(t);if(r.length!==n.length)return!1;for(const o of r){const i=e[o],a=t[o];if(PO(i)&&PO(a)){if(!wx(i,a))return!1}else if(i!==a)return!1}return!0}function PO(e){return e!==null&&typeof e=="object"}function jO(e,t){return delete t.__proto__,delete t.constructor,Object.assign(e,t)}const V5="ok",Iae="created",Dae="gone",Nae="not-modified",Aae="not-found",Mae="forbidden",Lae="accepted",zae={resourceType:"OperationOutcome",id:V5,issue:[{severity:"information",code:"informational",details:{text:"All OK"}}]},Fae={resourceType:"OperationOutcome",id:Aae,issue:[{severity:"error",code:"not-found",details:{text:"Not found"}}]},B5={resourceType:"OperationOutcome",id:Mae,issue:[{severity:"error",code:"forbidden",details:{text:"Forbidden"}}]};function vi(e,t){return{resourceType:"OperationOutcome",issue:[{severity:"error",code:"invalid",details:{text:e},expression:t?[t]:void 0}]}}function Rt(e){return{resourceType:"OperationOutcome",issue:[{severity:"error",code:"structure",details:{text:e}}]}}function vm(e){return typeof e=="object"&&e!==null&&e.resourceType==="OperationOutcome"}function U5(e){return e.id===V5||e.id===Iae||e.id===Nae||e.id===Lae}function Vae(e){return e.id===Dae}class Ne extends Error{constructor(t,r){super(W5(t)),this.outcome=t,this.cause=r}}function dt(e){return e instanceof Ne?e.outcome:vm(e)?e:vi(Oe(e))}function Oe(e){return e?typeof e=="string"?e:e instanceof Error?e.message:vm(e)?W5(e):typeof e=="object"&&"code"in e&&typeof e.code=="string"?e.code:JSON.stringify(e):"Unknown error"}function W5(e){var r;const t=((r=e.issue)==null?void 0:r.map(H5))??[];return t.length>0?t.join("; "):"Unknown error"}function H5(e){var r,n;let t;return(r=e.details)!=null&&r.text?e.diagnostics?t=`${e.details.text} (${e.diagnostics})`:t=e.details.text:e.diagnostics?t=e.diagnostics:t="Unknown error",(n=e.expression)!=null&&n.length&&(t+=` (${e.expression.join(", ")})`),t}function Bae(e){return new Gae(e).parse()}const pc=Aie(Eae);function Uae(e){var r;const t=Array.isArray(e)?e:((r=e.entry)==null?void 0:r.map(n=>n.resource))??[];for(const n of t)Wae(n)}function Wae(e){if(!(e!=null&&e.name))throw new Error("Failed loading StructureDefinition from bundle");if(e.resourceType!=="StructureDefinition")return;const t=Bae(e);pc[e.name]=t;for(const r of t.innerTypes)r.parentType=t,pc[r.name]=r}function Hae(e){return!!pc[e]}function bx(e){return pc[e]}function qae(e){const t=pc[e];if(!t)throw new Ne(vi("Unknown data type: "+e));return t}class Gae{constructor(t){var r;if(!((r=t.snapshot)!=null&&r.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,url:t.url,kind:t.kind,description:Yae(t),elements:{},constraints:this.parseElementDefinition(this.root).constraints,innerTypes:[],summaryProperties:new Set,mandatoryProperties:new Set},this.innerTypes=[]}parse(){var r,n,o,i,a;let t=this.next();for(;t;){if(t.sliceName)this.parseSliceStart(t);else if((r=t.id)!=null&&r.includes(":")){if((n=this.slicingContext)!=null&&n.current){const l=Lg(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[Lg(t,c.path)]=l;break}c=c.parent}if(!c){const u=Lg(t,this.root.path);t.isSummary&&((i=this.resourceSchema.summaryProperties)==null||i.add(u.replace("[x]",""))),l.min>0&&((a=this.resourceSchema.mandatoryProperties)==null||a.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,r){this.isInnerType(t)&&this.enterInnerType(t),t.slicing&&!this.slicingContext&&this.enterSlice(t,r)}enterInnerType(t){var r,n,o;for(;this.backboneContext&&!Aa((r=this.backboneContext)==null?void 0:r.path,t.path);)this.innerTypes.push(this.backboneContext.type),this.backboneContext=this.backboneContext.parent;this.backboneContext={type:{name:EO(t),description:t.definition,elements:{},constraints:this.parseElementDefinition(t).constraints,innerTypes:[]},path:t.path??"",parent:Aa((n=this.backboneContext)==null?void 0:n.path,t.path)?this.backboneContext:(o=this.backboneContext)==null?void 0:o.parent}}enterSlice(t,r){var n,o,i,a;Kae(t)&&!((n=this.peek())!=null&&n.sliceName)||(r.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:(a=t.slicing)==null?void 0:a.rules},this.slicingContext={field:r.slicing,path:t.path??""})}checkFieldExit(t=void 0){var r;if(this.backboneContext&&!Aa(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&&!Aa(this.backboneContext.path,t==null?void 0:t.path));else this.innerTypes.push(this.backboneContext.type),delete this.backboneContext;this.slicingContext&&!Aa(this.slicingContext.path,t==null?void 0:t.path)&&((r=this.slicingContext)!=null&&r.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 r=this.elementIndex[t.contentReference.slice(t.contentReference.indexOf("#")+1)];return r?{...r,id:t.id,path:t.path,min:t.min??r.min,max:t.max??r.max,contentReference:t.contentReference,definition:t.definition}:void 0}return t}}isInnerType(t){var n;const r=this.peek();return!!(Aa(t==null?void 0:t.path,r==null?void 0:r.path)&&((n=t.type)!=null&&n.some(o=>["BackboneElement","Element"].includes(o.code))))}parseSliceStart(t){var r;if(!this.slicingContext)throw new Error("Invalid slice start before discriminator: "+t.sliceName);this.slicingContext.current&&this.slicingContext.field.slices.push(this.slicingContext.current),this.slicingContext.current={name:t.sliceName??"",type:(r=t.type)==null?void 0:r.map(n=>({code:n.code??"",targetProfile:n.targetProfile})),elements:{},min:t.min??0,max:t.max==="*"?Number.POSITIVE_INFINITY:Number.parseInt(t.max,10)}}parseElementDefinition(t){var i,a;const r=OO(t.max),n=(i=t.base)!=null&&i.max?OO(t.base.max):r,o={type:"ElementDefinition",value:t};return{description:t.definition||"",path:t.path||((a=t.base)==null?void 0:a.path)||"",min:t.min??0,max:r,isArray:n>1,constraints:(t.constraint??[]).map(l=>({key:l.key??"",severity:l.severity??"error",expression:l.expression??"",description:l.human??""})),type:(t.type??[]).map(l=>({code:["BackboneElement","Element"].includes(l.code)?EO(t):l.code??"",targetProfile:l.targetProfile})),fixed:CO(yr(o,"fixed")),pattern:CO(yr(o,"pattern")),binding:t.binding}}}function OO(e){return e==="*"?Number.POSITIVE_INFINITY:Number.parseInt(e,10)}function Lg(e,t=""){return Qae(e.path,t)}function Qae(e,t){return e?t&&e.startsWith(t)?e.substring(t.length+1):e:""}function Aa(e,t){return!e||!t?!1:t.startsWith(e+".")||t===e}function CO(e){return Array.isArray(e)&&e.length>0?e[0]:xo(e)?void 0:e}function Kae(e){var r,n;const t=(r=e.slicing)==null?void 0:r.discriminator;return!!((n=e.type)!=null&&n.some(o=>o.code==="Extension")&&(t==null?void 0:t.length)===1&&t[0].type==="value"&&t[0].path==="url")}function Yae(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 B={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 Xae(e){for(const t of e.base??[]){let r=Si.types[t];r||(r={searchParamsDetails:{}},Si.types[t]=r),r.searchParams||(r.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"}}),r.searchParams[e.code]=e}}function EO(e){var r,n,o,i;const t=(n=(r=e.type)==null?void 0:r[0])==null?void 0:n.code;return t==="BackboneElement"||t==="Element"?Jae((i=((o=e.base)==null?void 0:o.path)??e.path)==null?void 0:i.split(".")):t}function Jae(e){return e.length===1?e[0]:e.map(sr).join("")}function _x(e){var t;return(t=Si.types[e])==null?void 0:t.searchParams}function Zae(e,t){var r,n;return(n=(r=Si.types[e])==null?void 0:r.searchParams)==null?void 0:n[t]}function dy(e){return e.replaceAll("[x]","").split(".").pop().split(/(?=[A-Z])/).map(tse).join(" ").replace("_"," ").replace(/\s+/g," ")}const ese=new Set(["ID","IP","PKCE","JWKS","URI","URL"]);function tse(e){const t=e.toUpperCase();return ese.has(t)?t:t.charAt(0)+e.slice(1)}function Sa(e,t){const r=bx(e);if(r)return r.elements[t]??r.elements[t+"[x]"]}function Fo(e){return!!(e&&typeof e=="object"&&"resourceType"in e)}function Pa(e){return!!(e&&typeof e=="object"&&"reference"in e)}const Si={types:{}};function wd(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 fl=()=>[],Pr={empty:(e,t)=>ve(t.length===0),exists:(e,t,r)=>ve(r?t.filter(n=>li(r.eval(e,[n]))).length>0:t.length>0),all:(e,t,r)=>ve(t.every(n=>li(r.eval(e,[n])))),allTrue:(e,t)=>{for(const r of t)if(!r.value)return ve(!1);return ve(!0)},anyTrue:(e,t)=>{for(const r of t)if(r.value)return ve(!0);return ve(!1)},allFalse:(e,t)=>{for(const r of t)if(r.value)return ve(!1);return ve(!0)},anyFalse:(e,t)=>{for(const r of t)if(!r.value)return ve(!0);return ve(!1)},subsetOf:fl,supersetOf:fl,count:(e,t)=>[{type:B.integer,value:t.length}],distinct:(e,t)=>{const r=[];for(const n of t)r.some(o=>o.value===n.value)||r.push(n);return r},isDistinct:(e,t)=>ve(t.length===Pr.distinct(e,t).length),where:(e,t,r)=>t.filter(n=>li(r.eval(e,[n]))),select:(e,t,r)=>t.map(n=>r.eval(e,[n])).flat(),repeat:fl,ofType:(e,t,r)=>t.filter(n=>n.type===r.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,r)=>{var o;const n=(o=r.eval(e,t)[0])==null?void 0:o.value;if(typeof n!="number")throw new Error("Expected a number for skip(num)");return n>=t.length?[]:n<=0?t:t.slice(n,t.length)},take:(e,t,r)=>{var o;const n=(o=r.eval(e,t)[0])==null?void 0:o.value;if(typeof n!="number")throw new Error("Expected a number for take(num)");return n>=t.length?t:n<=0?[]:t.slice(0,n)},intersect:(e,t,r)=>{if(!r)return t;const n=r.eval(e,t),o=[];for(const i of t)!o.some(a=>a.value===i.value)&&n.some(a=>a.value===i.value)&&o.push(i);return o},exclude:(e,t,r)=>{if(!r)return t;const n=r.eval(e,t),o=[];for(const i of t)n.some(a=>a.value===i.value)||o.push(i);return o},union:(e,t,r)=>{if(!r)return t;const n=r.eval(e,t);return D5([...t,...n])},combine:(e,t,r)=>{if(!r)return t;const n=r.eval(e,t);return[...t,...n]},htmlChecks:(e,t,r)=>[no(!0)],iif:(e,t,r,n,o)=>{const i=r.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 li(i)?n.eval(e,t):o?o.eval(e,t):[]},toBoolean:(e,t)=>{if(t.length===0)return[];const[{value:r}]=Wn(t,1);if(typeof r=="boolean")return[{type:B.boolean,value:r}];if(typeof r=="number"&&(r===0||r===1))return ve(!!r);if(typeof r=="string"){const n=r.toLowerCase();if(["true","t","yes","y","1","1.0"].includes(n))return ve(!0);if(["false","f","no","n","0","0.0"].includes(n))return ve(!1)}return[]},convertsToBoolean:(e,t)=>t.length===0?[]:ve(Pr.toBoolean(e,t).length===1),toInteger:(e,t)=>{if(t.length===0)return[];const[{value:r}]=Wn(t,1);return typeof r=="number"?[{type:B.integer,value:r}]:typeof r=="string"&&/^[+-]?\d+$/.exec(r)?[{type:B.integer,value:parseInt(r,10)}]:typeof r=="boolean"?[{type:B.integer,value:r?1:0}]:[]},convertsToInteger:(e,t)=>t.length===0?[]:ve(Pr.toInteger(e,t).length===1),toDate:(e,t)=>{if(t.length===0)return[];const[{value:r}]=Wn(t,1);return typeof r=="string"&&/^\d{4}(-\d{2}(-\d{2})?)?/.exec(r)?[{type:B.date,value:wd(r)}]:[]},convertsToDate:(e,t)=>t.length===0?[]:ve(Pr.toDate(e,t).length===1),toDateTime:(e,t)=>{if(t.length===0)return[];const[{value:r}]=Wn(t,1);return typeof r=="string"&&/^\d{4}(-\d{2}(-\d{2})?)?/.exec(r)?[{type:B.dateTime,value:wd(r)}]:[]},convertsToDateTime:(e,t)=>t.length===0?[]:ve(Pr.toDateTime(e,t).length===1),toDecimal:(e,t)=>{if(t.length===0)return[];const[{value:r}]=Wn(t,1);return typeof r=="number"?[{type:B.decimal,value:r}]:typeof r=="string"&&/^-?\d{1,9}(\.\d{1,9})?$/.exec(r)?[{type:B.decimal,value:parseFloat(r)}]:typeof r=="boolean"?[{type:B.decimal,value:r?1:0}]:[]},convertsToDecimal:(e,t)=>t.length===0?[]:ve(Pr.toDecimal(e,t).length===1),toQuantity:(e,t)=>{if(t.length===0)return[];const[{value:r}]=Wn(t,1);return dn(r)?[{type:B.Quantity,value:r}]:typeof r=="number"?[{type:B.Quantity,value:{value:r,unit:"1"}}]:typeof r=="string"&&/^-?\d{1,9}(\.\d{1,9})?/.exec(r)?[{type:B.Quantity,value:{value:parseFloat(r),unit:"1"}}]:typeof r=="boolean"?[{type:B.Quantity,value:{value:r?1:0,unit:"1"}}]:[]},convertsToQuantity:(e,t)=>t.length===0?[]:ve(Pr.toQuantity(e,t).length===1),toString:(e,t)=>{if(t.length===0)return[];const[{value:r}]=Wn(t,1);return r==null?[]:dn(r)?[{type:B.string,value:`${r.value} '${r.unit}'`}]:[{type:B.string,value:r.toString()}]},convertsToString:(e,t)=>t.length===0?[]:ve(Pr.toString(e,t).length===1),toTime:(e,t)=>{if(t.length===0)return[];const[{value:r}]=Wn(t,1);if(typeof r=="string"){const n=/^T?(\d{2}(:\d{2}(:\d{2})?)?)/.exec(r);if(n)return[{type:B.time,value:wd("T"+n[1])}]}return[]},convertsToTime:(e,t)=>t.length===0?[]:ve(Pr.toTime(e,t).length===1),indexOf:(e,t,r)=>tn((n,o)=>n.indexOf(o),e,t,r),substring:(e,t,r,n)=>tn((o,i,a)=>{const l=i,c=a?l+a:o.length;return l<0||l>=o.length?void 0:o.substring(l,c)},e,t,r,n),startsWith:(e,t,r)=>tn((n,o)=>n.startsWith(o),e,t,r),endsWith:(e,t,r)=>tn((n,o)=>n.endsWith(o),e,t,r),contains:(e,t,r)=>tn((n,o)=>n.includes(o),e,t,r),upper:(e,t)=>tn(r=>r.toUpperCase(),e,t),lower:(e,t)=>tn(r=>r.toLowerCase(),e,t),replace:(e,t,r,n)=>tn((o,i,a)=>o.replaceAll(i,a),e,t,r,n),matches:(e,t,r)=>tn((n,o)=>!!new RegExp(o).exec(n),e,t,r),replaceMatches:(e,t,r,n)=>tn((o,i,a)=>o.replaceAll(i,a),e,t,r,n),length:(e,t)=>tn(r=>r.length,e,t),toChars:(e,t)=>tn(r=>r?r.split(""):void 0,e,t),abs:(e,t)=>Vn(Math.abs,e,t),ceiling:(e,t)=>Vn(Math.ceil,e,t),exp:(e,t)=>Vn(Math.exp,e,t),floor:(e,t)=>Vn(Math.floor,e,t),ln:(e,t)=>Vn(Math.log,e,t),log:(e,t,r)=>Vn((n,o)=>Math.log(n)/Math.log(o),e,t,r),power:(e,t,r)=>Vn(Math.pow,e,t,r),round:(e,t)=>Vn(Math.round,e,t),sqrt:(e,t)=>Vn(Math.sqrt,e,t),truncate:(e,t)=>Vn(r=>r|0,e,t),children:fl,descendants:fl,trace:(e,t,r)=>(console.log("trace",t,r),t),now:()=>[{type:B.dateTime,value:new Date().toISOString()}],timeOfDay:()=>[{type:B.time,value:new Date().toISOString().substring(11)}],today:()=>[{type:B.date,value:new Date().toISOString().substring(0,10)}],between:(e,t,r,n,o)=>{var u;const i=Pr.toDateTime(e,r.eval(e,t));if(i.length===0)throw new Error("Invalid start date");const a=Pr.toDateTime(e,n.eval(e,t));if(a.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=E5(i[0].value,a[0].value);return[{type:B.Quantity,value:{value:c[l],unit:l}}]},is:(e,t,r)=>{let n="";return r instanceof Sx?n=r.name:r instanceof jx&&(n=r.left.name+"."+r.right.name),n?t.map(o=>({type:B.boolean,value:z5(o,n)})):[]},not:(e,t)=>Pr.toBoolean(e,t).map(r=>({type:B.boolean,value:!r.value})),resolve:(e,t)=>t.map(r=>{const n=r.value;let o;if(typeof n=="string")o=n;else if(typeof n=="object"){const i=n;if(i.resource)return no(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,a]=o.split("/");return{type:i,value:{resourceType:i,id:a}}}return{type:B.BackboneElement,value:void 0}}).filter(r=>!!r.value),as:(e,t)=>t,type:(e,t)=>t.map(({value:r})=>typeof r=="boolean"?{type:B.BackboneElement,value:{namespace:"System",name:"Boolean"}}:typeof r=="number"?{type:B.BackboneElement,value:{namespace:"System",name:"Integer"}}:Fo(r)?{type:B.BackboneElement,value:{namespace:"FHIR",name:r.resourceType}}:{type:B.BackboneElement,value:null}),conformsTo:(e,t,r)=>{const n=r.eval(e,t)[0].value;if(!n.startsWith("http://hl7.org/fhir/StructureDefinition/"))throw new Error("Expected a StructureDefinition URL");const o=n.replace("http://hl7.org/fhir/StructureDefinition/","");return t.map(i=>{var a;return{type:B.boolean,value:((a=i.value)==null?void 0:a.resourceType)===o}})}};function tn(e,t,r,...n){if(r.length===0)return[];const[{value:o}]=Wn(r,1);if(typeof o!="string")throw new Error("String function cannot be called with non-string");const i=e(o,...n.map(a=>{var l;return(l=a==null?void 0:a.eval(t,r)[0])==null?void 0:l.value}));return i===void 0?[]:Array.isArray(i)?i.map(no):[no(i)]}function Vn(e,t,r,...n){if(r.length===0)return[];const[{value:o}]=Wn(r,1),i=dn(o),a=i?o.value:o;if(typeof a!="number")throw new Error("Math function cannot be called with non-number");const l=e(a,...n.map(d=>{var p;return(p=d.eval(t,r)[0])==null?void 0:p.value})),c=i?B.Quantity:r[0].type,u=i?{...o,value:l}:l;return[{type:c,value:u}]}function Wn(e,t){if(e.length!==t)throw new Error(`Expected ${t} arguments`);for(const r of e)if(r==null)throw new Error("Expected non-null argument");return e}class rse{constructor(t,r){this.original=t,this.child=r}eval(t,r){try{return r.length>0?r.map(n=>this.child.eval(t,[n])).flat():this.child.eval(t,[])}catch(n){throw new Error(`FhirPathError on "${this.original}": ${n}`)}}toString(){return this.child.toString()}}class Ma{constructor(t){this.value=t}eval(){return[this.value]}toString(){const t=this.value.value;return typeof t=="string"?`'${t}'`:t.toString()}}class Sx{constructor(t){this.name=t}eval(t,r){if(this.name==="$this")return r;if(this.name.startsWith("%")){const n=t.variables[this.name.slice(1)];if(!n)throw new Error(`Undefined variable ${this.name}`);return[n]}return r.flatMap(n=>this.evalValue(n)).filter(n=>(n==null?void 0:n.value)!==void 0)}evalValue(t){const r=t.value;if(!(!r||typeof r!="object"))return Fo(r)&&r.resourceType===this.name?t:yr(t,this.name)}toString(){return this.name}}class nse{eval(){return[]}toString(){return"{}"}}class ose extends cie{constructor(t,r,n){super(t,r),this.impl=n}eval(t,r){return this.impl(this.child.eval(t,r))}toString(){return this.operator+this.child.toString()}}class Px extends Lc{constructor(t,r){super("as",t,r)}eval(t,r){return Pr.ofType(t,this.left.eval(t,r),this.right)}}class Mr extends Lc{}class xn extends Mr{constructor(t,r,n,o){super(t,r,n),this.impl=o}eval(t,r){const n=this.left.eval(t,r);if(n.length!==1)return[];const o=this.right.eval(t,r);if(o.length!==1)return[];const i=n[0].value,a=o[0].value,l=dn(i)?i.value:i,c=dn(a)?a.value:a,u=this.impl(l,c);return typeof u=="boolean"?ve(u):dn(i)?[{type:B.Quantity,value:{...i,value:u}}]:[no(u)]}}class ise extends Lc{constructor(t,r){super("&",t,r)}eval(t,r){const n=this.left.eval(t,r),o=this.right.eval(t,r),i=[...n,...o];return i.length>0&&i.every(a=>typeof a.value=="string")?[{type:B.string,value:i.map(a=>a.value).join("")}]:i}}class ase extends Mr{constructor(t,r){super("contains",t,r)}eval(t,r){const n=this.left.eval(t,r),o=this.right.eval(t,r);return ve(n.some(i=>i.value===o[0].value))}}class sse extends Mr{constructor(t,r){super("in",t,r)}eval(t,r){const n=Ro(this.left.eval(t,r)),o=this.right.eval(t,r);return n?ve(o.some(i=>i.value===n.value)):[]}}class jx extends Lc{constructor(t,r){super(".",t,r)}eval(t,r){return this.right.eval(t,this.left.eval(t,r))}toString(){return`${this.left.toString()}.${this.right.toString()}`}}class q5 extends Lc{constructor(t,r){super("|",t,r)}eval(t,r){const n=this.left.eval(t,r),o=this.right.eval(t,r);return D5([...n,...o])}}class lse extends Mr{constructor(t,r){super("=",t,r)}eval(t,r){const n=this.left.eval(t,r),o=this.right.eval(t,r);return A5(n,o)}}class cse extends Mr{constructor(t,r){super("!=",t,r)}eval(t,r){const n=this.left.eval(t,r),o=this.right.eval(t,r);return N5(A5(n,o))}}class use extends Mr{constructor(t,r){super("~",t,r)}eval(t,r){const n=this.left.eval(t,r),o=this.right.eval(t,r);return L5(n,o)}}class dse extends Mr{constructor(t,r){super("!~",t,r)}eval(t,r){const n=this.left.eval(t,r),o=this.right.eval(t,r);return N5(L5(n,o))}}class Ox extends Mr{constructor(t,r){super("is",t,r)}eval(t,r){const n=this.left.eval(t,r);if(n.length!==1)return[];const o=this.right.name;return ve(z5(n[0],o))}}class fse extends Mr{constructor(t,r){super("and",t,r)}eval(t,r){const n=Ro(this.left.eval(t,r),"boolean"),o=Ro(this.right.eval(t,r),"boolean");return(n==null?void 0:n.value)===!0&&(o==null?void 0:o.value)===!0?ve(!0):(n==null?void 0:n.value)===!1||(o==null?void 0:o.value)===!1?ve(!1):[]}}class pse extends Mr{constructor(t,r){super("or",t,r)}eval(t,r){const n=Ro(this.left.eval(t,r),"boolean"),o=Ro(this.right.eval(t,r),"boolean");return(n==null?void 0:n.value)===!1&&(o==null?void 0:o.value)===!1?ve(!1):n!=null&&n.value||o!=null&&o.value?ve(!0):[]}}class hse extends Mr{constructor(t,r){super("xor",t,r)}eval(t,r){const n=Ro(this.left.eval(t,r),"boolean"),o=Ro(this.right.eval(t,r),"boolean");return!n||!o?[]:ve(n.value!==o.value)}}class mse extends Mr{constructor(t,r){super("implies",t,r)}eval(t,r){const n=Ro(this.left.eval(t,r),"boolean"),o=Ro(this.right.eval(t,r),"boolean");return(o==null?void 0:o.value)===!0||(n==null?void 0:n.value)===!1?ve(!0):!n||!o?[]:ve(!1)}}class Cx{constructor(t,r){this.name=t,this.args=r}eval(t,r){const n=Pr[this.name];if(!n)throw new Error("Unrecognized function: "+this.name);return n(t,r,...this.args)}toString(){return`${this.name}(${this.args.map(t=>t.toString()).join(", ")})`}}class Ex{constructor(t,r){this.left=t,this.expr=r}eval(t,r){const n=this.expr.eval(t,r);if(n.length!==1)return[];const o=n[0].value;if(typeof o!="number")throw new Error("Invalid indexer expression: should return integer}");const i=this.left.eval(t,r);return o in i?[i[o]]:[]}toString(){return`${this.left.toString()}[${this.expr.toString()}]`}}const gse=["year","years","month","months","week","weeks","day","days","hour","hours","minute","minutes","second","seconds","millisecond","milliseconds"];class vse{constructor(t,r,n,o){this.result=[],this.pos={index:0,line:1,column:0},this.markStack=[],this.str=t,this.keywords=r,this.operators=n,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 r=this.peek();return t==="/"&&r==="*"?this.consumeMultiLineComment():t==="/"&&r==="/"?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(r)?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()!==`
|
|
88
88
|
`))}consumeString(t){this.advance();const r=this.buildToken("String",this.consumeWhile(()=>this.prev()==="\\"||this.curr()!==t));return this.advance(),r}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 r="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()===" "&&yse(this.peekToken())&&(r="Quantity",this.consumeToken()),this.buildToken(r,this.str.substring(t,this.pos.index)))}consumeSymbol(){var r;const t=this.consumeWhile(()=>this.symbolRegex.exec(this.curr()));return((r=this.prevToken())==null?void 0:r.value)!=="."&&this.keywords.includes(t)?this.buildToken(t,t):this.buildToken("Symbol",t)}consumeOperator(){const t=this.curr(),r=this.peek(),n=t+r;return this.operators.includes(n)?(this.advance(),this.advance(),this.buildToken(n,n)):(this.advance(),this.buildToken(t,t))}consumeWhile(t){const r=this.pos.index;for(;this.pos.index<this.str.length&&t();)this.advance();return this.str.substring(r,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()===`
|
|
89
|
-
`?(this.pos.line++,this.pos.column=0):this.pos.column++}buildToken(t,r){const n=this.markStack.pop();if(!n)throw new Error("No mark for token");return{id:t,value:r,...n}}}function yse(e){return!!(e&&(e.id==="String"||e.id==="Symbol"&&gse.includes(e.value)))}const xse=["true","false"],wse=["!=","!~","<=",">=","{}","->"];function bse(e){return new vse(e,xse,wse).tokenize()}const Ue={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},_se={parse(e){var r;const t=e.consumeAndParse();if(!e.match(")"))throw new Error("Parse error: expected `)` got `"+((r=e.peek())==null?void 0:r.value)+"`");return t}},Sse={parse(e,t){const r=e.consumeAndParse();if(!e.match("]"))throw new Error("Parse error: expected `]`");return new Ex(t,r)},precedence:Ue.Indexer},Pse={parse(e,t){if(!(t instanceof Sx))throw new Error("Unexpected parentheses");const r=[];for(;!e.match(")");)r.push(e.consumeAndParse()),e.match(",");return new Cx(t.name,r)},precedence:Ue.FunctionCall};function jse(e){const t=e.split(" "),r=parseFloat(t[0]);let n=t[1];return n!=null&&n.startsWith("'")&&n.endsWith("'")?n=n.substring(1,n.length-1):n="{"+n+"}",{value:r,unit:n}}function Ose(){return new uie().registerPrefix("String",{parse:(e,t)=>new Ma({type:B.string,value:t.value})}).registerPrefix("DateTime",{parse:(e,t)=>new Ma({type:B.dateTime,value:wd(t.value)})}).registerPrefix("Quantity",{parse:(e,t)=>new Ma({type:B.Quantity,value:jse(t.value)})}).registerPrefix("Number",{parse:(e,t)=>new Ma({type:B.decimal,value:parseFloat(t.value)})}).registerPrefix("true",{parse:()=>new Ma({type:B.boolean,value:!0})}).registerPrefix("false",{parse:()=>new Ma({type:B.boolean,value:!1})}).registerPrefix("Symbol",{parse:(e,t)=>new Sx(t.value)}).registerPrefix("{}",{parse:()=>new nse}).registerPrefix("(",_se).registerInfix("[",Sse).registerInfix("(",Pse).prefix("+",Ue.UnaryAdd,(e,t)=>new ose("+",t,r=>r)).prefix("-",Ue.UnarySubtract,(e,t)=>new xn("-",t,t,(r,n)=>-n)).infixLeft(".",Ue.Dot,(e,t,r)=>new jx(e,r)).infixLeft("/",Ue.Divide,(e,t,r)=>new xn("/",e,r,(n,o)=>n/o)).infixLeft("*",Ue.Multiply,(e,t,r)=>new xn("*",e,r,(n,o)=>n*o)).infixLeft("+",Ue.Add,(e,t,r)=>new xn("+",e,r,(n,o)=>n+o)).infixLeft("-",Ue.Subtract,(e,t,r)=>new xn("-",e,r,(n,o)=>n-o)).infixLeft("|",Ue.Union,(e,t,r)=>new q5(e,r)).infixLeft("=",Ue.Equals,(e,t,r)=>new lse(e,r)).infixLeft("!=",Ue.NotEquals,(e,t,r)=>new cse(e,r)).infixLeft("~",Ue.Equivalent,(e,t,r)=>new use(e,r)).infixLeft("!~",Ue.NotEquivalent,(e,t,r)=>new dse(e,r)).infixLeft("<",Ue.LessThan,(e,t,r)=>new xn("<",e,r,(n,o)=>n<o)).infixLeft("<=",Ue.LessThanOrEquals,(e,t,r)=>new xn("<=",e,r,(n,o)=>n<=o)).infixLeft(">",Ue.GreaterThan,(e,t,r)=>new xn(">",e,r,(n,o)=>n>o)).infixLeft(">=",Ue.GreaterThanOrEquals,(e,t,r)=>new xn(">=",e,r,(n,o)=>n>=o)).infixLeft("&",Ue.Ampersand,(e,t,r)=>new ise(e,r)).infixLeft("and",Ue.And,(e,t,r)=>new fse(e,r)).infixLeft("as",Ue.As,(e,t,r)=>new Px(e,r)).infixLeft("contains",Ue.Contains,(e,t,r)=>new ase(e,r)).infixLeft("div",Ue.Divide,(e,t,r)=>new xn("div",e,r,(n,o)=>n/o|0)).infixLeft("in",Ue.In,(e,t,r)=>new sse(e,r)).infixLeft("is",Ue.Is,(e,t,r)=>new Ox(e,r)).infixLeft("mod",Ue.Modulo,(e,t,r)=>new xn("mod",e,r,(n,o)=>n%o)).infixLeft("or",Ue.Or,(e,t,r)=>new pse(e,r)).infixLeft("xor",Ue.Xor,(e,t,r)=>new hse(e,r)).infixLeft("implies",Ue.Implies,(e,t,r)=>new mse(e,r))}const Cse=Ose();function G5(e){return new rse(e,Cse.construct(bse(e)).consumeAndParse())}function Ese(e,t){const r=Array.isArray(t)?t:[t];for(let n=0;n<r.length;n++){const o=r[n];typeof o=="object"&&"type"in o&&"value"in o||(r[n]=no(r[n]))}return hc(e,r).map(n=>n.value)}function hc(e,t,r){const n=r??{};return G5(e).eval({variables:n},t).map(i=>{var a;return{type:i.type,value:(a=i.value)==null?void 0:a.valueOf()}})}var ri=(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))(ri||{});function ym(e,t){var n,o;let r=(o=(n=Si.types[e])==null?void 0:n.searchParamsDetails)==null?void 0:o[t.code];return r||(r=kse(e,t)),r}function $se(e,t,r){const n=Si.types[e];n.searchParamsDetails||(n.searchParamsDetails={}),n.searchParamsDetails[t]=r}function kse(e,t){const r=t.code,n=Ise(r),o=Nse(e,t.expression),i={elementDefinitions:[],propertyTypes:new Set,array:!1};for(const l of o){const c=zl(l);c.length===1&&c[0]instanceof Mr?i.propertyTypes.add("boolean"):Q5(i,zl(l),e,1)}const a={columnName:n,type:Dse(t,i.propertyTypes),elementDefinitions:i.elementDefinitions,array:i.array};return $se(e,r,a),a}function Q5(e,t,r,n){const o=t[n];if(o instanceof Px){e.propertyTypes.add(o.right.toString());return}if(o instanceof Cx){Rse(e,o);return}const i=o.toString(),a=Sa(r,i);if(!a)throw new Error(`Element definition not found for ${r} ${i}`);let l=!1,c=n+1;if(c<t.length&&t[c]instanceof Ex&&(l=!0,c++),a.isArray&&!l&&(e.array=!0),c>=t.length){e.elementDefinitions.push(a);for(const u of a.type)e.propertyTypes.add(u.code);return}for(const u of a.type){let d=u.code;Tse(d)&&(d=a.type[0].code),Q5(e,t,d,c)}}function Rse(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 Ox){e.propertyTypes.add(t.args[0].right.toString());return}throw new Error(`Unhandled FHIRPath function: ${t.name}`)}function Tse(e){return e==="Element"||e==="BackboneElement"}function Ise(e){return e.split("-").reduce((t,r,n)=>t+(n?sr(r):r),"")}function Dse(e,t){switch(e.type){case"date":return t.size===1&&t.has(B.date)?"DATE":"DATETIME";case"number":return"NUMBER";case"quantity":return"QUANTITY";case"reference":return t.has(B.canonical)?"CANONICAL":"REFERENCE";case"token":return t.size===1&&t.has(B.boolean)?"BOOLEAN":"TEXT";default:return"TEXT"}}function Nse(e,t){const r=[],n=G5(t);return fy(e,n.child,r),r}function fy(e,t,r){t instanceof q5?(fy(e,t.left,r),fy(e,t.right,r)):t.toString().startsWith(e+".")&&r.push(t)}function zl(e){if(e instanceof Px||e instanceof Ex)return[zl(e.left),e].flat();if(e instanceof Mr)return[e];if(e instanceof jx)return[zl(e.left),zl(e.right)].flat();if(e instanceof Cx){if(e.name==="where"&&!(e.args[0]instanceof Ox))return[];if(e.name==="last")return[]}return[e]}const Fc=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 K5={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"},$x={eq:"eq",ne:"ne",lt:"lt",le:"le",gt:"gt",ge:"ge",sa:"sa",eb:"eb",ap:"ap"};function Ase(e){let t;for(const r of e.pathname.split("/"))r&&(t=r);return Lse(t,e.searchParams.entries())}function Mse(e){return Ase(new URL(e,"https://example.com/"))}function Lse(e,t){const r={resourceType:e};for(const[n,o]of t)zse(r,n,o);return r}function zse(e,t,r){var a,l;let n,o;const i=t.indexOf(":");if(i>=0?(n=t.substring(0,i),o=t.substring(i+1)):(n=t,o=""),n==="_has"||t.includes(".")){zg(e,{code:t,operator:"eq",value:r});return}switch(n){case"_sort":Fse(e,r);break;case"_count":e.count=parseInt(r,10);break;case"_offset":e.offset=parseInt(r,10);break;case"_total":e.total=r;break;case"_summary":r==="count"?(e.total="accurate",e.count=0):(r==="true"||r==="data"||r==="text")&&(e.summary=r);break;case"_include":{const c=$O(r);o==="iterate"&&(c.modifier="iterate"),e.include?e.include.push(c):e.include=[c];break}case"_revinclude":{const c=$O(r);o==="iterate"&&(c.modifier="iterate"),e.revInclude?e.revInclude.push(c):e.revInclude=[c];break}case"_fields":case"_elements":e.fields=r.split(",");break;default:{const c=(l=(a=Si.types[e.resourceType])==null?void 0:a.searchParams)==null?void 0:l[n];c?zg(e,Vse(c,o,r)):zg(e,Wse(n,o,r))}}}function Fse(e,t){for(const r of t.split(",")){let n,o=!1;r.startsWith("-")?(n=r.substring(1),o=!0):n=r,e.sortRules||(e.sortRules=[]),e.sortRules.push({code:n,descending:o})}}function Vse(e,t,r){if(t==="missing")return{code:e.code,operator:"missing",value:r};switch(e.type){case"number":case"date":case"quantity":return Bse(e,r);case"reference":case"string":case"token":case"uri":return Use(e,t,r);default:throw new Error("Unrecognized search parameter type: "+e.type)}}function Bse(e,t){const{operator:r,value:n}=Hse(t);return{code:e.code,operator:r,value:n}}function Use(e,t,r){return{code:e.code,operator:qse(t),value:r}}function Wse(e,t,r){var o;let n="eq";if(t)n=t;else if(r.length>=2){const i=r.substring(0,2);i in $x&&(r.length===2||(o=r.at(2))!=null&&o.match(/\d/))&&(n=i,r=r.substring(i.length))}return{code:e,operator:n,value:r}}function Hse(e){const t=e.substring(0,2),r=$x[t];return r?{operator:r,value:e.substring(2)}:{operator:"eq",value:e}}function qse(e){return K5[e]??"eq"}function $O(e){const t=e.split(":");if(t.includes("*"))throw new Ne(vi("'*' is not supported as a value for search inclusion parameters"));if(t.length===1)throw new Ne(vi(`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 Ne(vi(`Invalid include value '${e}'`))}function zg(e,t){e.filters?e.filters.push(t):e.filters=[t]}function es(e){const t=[];return e.fields&&t.push("_fields="+e.fields.join(",")),e.filters&&e.filters.forEach(r=>t.push(Gse(r))),e.sortRules&&e.sortRules.length>0&&t.push(Qse(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(r=>t.push(kO("_include",r))),e.revInclude&&e.revInclude.forEach(r=>t.push(kO("_revinclude",r))),t.length===0?"":(t.sort((r,n)=>r.localeCompare(n)),"?"+t.join("&"))}function Gse(e){const t=e.operator in K5?":"+e.operator:"",r=e.operator!=="eq"&&e.operator in $x?e.operator:"";return`${e.code}${t}=${r}${encodeURIComponent(e.value)}`}function Qse(e){return"_sort="+e.map(t=>t.descending?"-"+t.code:t.code).join(",")}function kO(e,t){return e+"="+t.resourceType+":"+t.searchParam+(t.targetType?":"+t.targetType:"")}function Kse(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 Yse(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 RO(){const e=new Uint32Array(28);return crypto.getRandomValues(e),bie(e.buffer)}async function Xse(e){return crypto.subtle.digest("SHA-256",new TextEncoder().encode(e))}function Y5(){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 X5(e){var o,i,a;const t={};e=ba(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]=Y5(),l.fullUrl="urn:uuid:"+t[c],(a=l.resource)==null||delete a.id)}const r=e.entry,n=JSON.stringify({resourceType:"Bundle",type:"transaction",entry:r==null?void 0:r.map(l=>({fullUrl:l.fullUrl,request:{method:"POST",url:l.resource.resourceType},resource:l.resource}))},(l,c)=>Jse(l,c,t),2);return Zse(JSON.parse(n))}function Jse(e,t,r){if(e==="reference"&&typeof t=="string"){let n;if(t.includes("/")?n=t.split("/")[1]:t.startsWith("urn:uuid:")?n=t.slice(9):t.startsWith("#")&&(n=t.slice(1)),n){const o=r[n];if(o)return"urn:uuid:"+o}}return t}function Zse(e){const t=tle(e),{sorted:r,cycles:n}=ele(t),o={};for(const a of e.entry||[])a.fullUrl&&(o[a.fullUrl]=a);const i=r.map(a=>o[a]);for(const a of n)for(const l of a){const c=o[l],u={...c,request:{...c.request,method:"PUT"}};i.push(u)}return{...e,entry:i}}function ele(e){const t=[],r={},n=[];for(const i of Object.keys(e))r[i]=0;function o(i,a){if(r[i]===2)return!0;if(r[i]===1){const c=a.lastIndexOf(i);return c!==-1&&n.push(a.slice(c)),!0}r[i]=1,a.push(i);let l=!1;for(const c of e[i])o(c,a)||(l=!0);return r[i]=2,a.pop(),t.unshift(i),!l}for(const i in e)r[i]===0&&o(i,[]);return{sorted:t,cycles:n}}function J5(e,t){for(const r in e)if(e[r]&&typeof e[r]=="object"){const n=e[r];if(Pa(n)){const o=n.reference;o.startsWith("urn:uuid:")&&t(o)}else J5(n,t)}}function tle(e){const t={};for(const r of e.entry||[])r.fullUrl&&(t[r.fullUrl]=[]);for(const r of e.entry||[]){const n=r.fullUrl;r.resource&&J5(r.resource,o=>{t[o]&&t[o].push(n)})}return t}class rle{constructor(t=10){this.max=t,this.cache=new Map}clear(){this.cache.clear()}get(t){const r=this.cache.get(t);return r&&(this.cache.delete(t),this.cache.set(t,r)),r}set(t,r){this.cache.has(t)?this.cache.delete(t):this.cache.size>=this.max&&this.cache.delete(this.first()),this.cache.set(t,r)}delete(t){this.cache.delete(t)}keys(){return this.cache.keys()}first(){return this.cache.keys().next().value}}const Qt={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 Z5{constructor(){this.listeners={}}addEventListener(t,r){this.listeners[t]||(this.listeners[t]=[]),this.listeners[t].push(r)}removeEventListener(t,r){const n=this.listeners[t];if(n){for(let o=0;o<n.length;o++)if(n[o]===r){n.splice(o,1);return}}}dispatchEvent(t){const r=this.listeners[t.type];if(r)for(const n of r)n.call(this,t);return!t.defaultPrevented}}class nle{constructor(){this.emitter=new Z5}dispatchEvent(t){this.emitter.dispatchEvent(t)}addEventListener(t,r){this.emitter.addEventListener(t,r)}removeEventListener(t,r){this.emitter.removeEventListener(t,r)}}const py={"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"},ole=["Patient","Encounter","ImagingStudy","DiagnosticReport","OperationOutcome","Bundle"],kx=["DiagnosticReport-update"];function ile(e){return kx.includes(e)}function ale(e){if(kx.includes(e))throw new Ne(Rt(`'context.version' is required for '${e}'.`))}const sle={"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 lle(e){return ole.includes(e)}function e4(e){return!!e.endpoint}function TO(e){if(!Rx(e))throw new Ne(Rt("subscriptionRequest must be an object conforming to SubscriptionRequest type."));const{channelType:t,mode:r,topic:n,events:o}=e,i={"hub.channel.type":t,"hub.mode":r,"hub.topic":n,"hub.events":o.join(",")};return e4(e)&&(i.endpoint=e.endpoint),new URLSearchParams(i).toString()}function Rx(e){if(typeof e!="object")return!1;const{channelType:t,mode:r,topic:n,events:o}=e;if(!(t&&r&&n&&o)||typeof n!="string"||typeof o!="object"||!Array.isArray(o)||o.length<1||t!=="websocket"||r!=="subscribe"&&r!=="unsubscribe")return!1;for(const i of o)if(!py[i])return!1;return!(e4(e)&&!(typeof e.endpoint=="string"&&e.endpoint.startsWith("ws")))}function IO(e,t,r,n){if(typeof t!="object")throw new Ne(Rt(`context[${r}] is invalid. Context must contain a single valid FHIR resource! Resource is not an object.`));if(!(t.id&&typeof t.id=="string"))throw new Ne(Rt(`context[${r}] is invalid. Resource must contain a valid string ID.`));if(!t.resourceType)throw new Ne(Rt(`context[${r}] is invalid. Resource must contain a resource type. No resource type found.`));const o=n.resourceType;if(o!=="*"){if(!lle(t.resourceType))throw new Ne(Rt(`context[${r}] 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 Ne(Rt(`context[${r}] is invalid. context[${r}] for the '${e}' event should contain resource of type ${o}.`))}}function cle(e,t,r,n,o){if(o.set(t.key,(o.get(t.key)??0)+1),!n.isArray)IO(e,t.resource,r,n);else{const{resources:i}=t;if(!i)throw new Ne(Rt(`context[${r}] is invalid. context[${r}] for the '${e}' with key '${String(t.key)}' should contain an array of resources on the key 'resources'.`));for(const a of i)IO(e,a,r,n)}}function ule(e,t){const r=new Map,n=sle[e];for(let o=0;o<t.length;o++){const i=t[o].key;if(!n[i])throw new Ne(Rt(`Key '${i}' not found for event '${e}'. Make sure to add only valid keys.`));cle(e,t[o],o,n[i],r)}for(const[o,i]of Object.entries(n)){if(!(i.optional||r.has(o)))throw new Ne(Rt(`Missing required key '${o}' on context for '${e}' event.`));if(!i.manyAllowed&&(r.get(o)||0)>1)throw new Ne(Rt(`${r.get(o)} context entries with key '${o}' found for the '${e}' event when schema only allows for 1.`))}}function DO(e,t,r,n){if(!(e&&typeof e=="string"))throw new Ne(Rt("Must provide a topic."));if(!py[t])throw new Ne(Rt(`Must provide a valid FHIRcast event name. Supported events: ${Object.keys(py).join(", ")}`));if(typeof r!="object")throw new Ne(Rt("context must be a context object or array of context objects."));if(kx.includes(t)&&!n)throw new Ne(Rt(`The '${t}' event must contain a 'context.versionId'.`));const o=Array.isArray(r)?r:[r];return ule(t,o),{timestamp:new Date().toISOString(),id:Y5(),event:{"hub.topic":e,"hub.event":t,context:o,...n?{"context.versionId":n}:{}}}}class dle extends nle{constructor(t){if(super(),this.subRequest=t,!t.endpoint)throw new Ne(Rt("Subscription request should contain an endpoint."));if(!Rx(t))throw new Ne(Rt("Subscription request failed validation."));const r=new WebSocket(t.endpoint);r.addEventListener("open",()=>{this.dispatchEvent({type:"connect"}),r.addEventListener("message",n=>{const o=JSON.parse(n.data);if(o["hub.topic"])return;const i=o;i.event["hub.event"]!=="heartbeat"&&(this.dispatchEvent({type:"message",payload:i}),r.send(JSON.stringify({id:o==null?void 0:o.id,timestamp:new Date().toISOString()})))}),r.addEventListener("close",()=>{this.dispatchEvent({type:"disconnect"})})}),this.websocket=r}disconnect(){this.websocket.close()}}function fle(e){const t=e.replace(/-/g,"+").replace(/_/g,"/"),r=Kse(t),n=Array.from(r).reduce((i,a)=>{const l=("00"+a.charCodeAt(0).toString(16)).slice(-2);return`${i}%${l}`},""),o=decodeURIComponent(n);return JSON.parse(o)}function ple(e){return e.split(".").length===3}function t4(e){const[t,r,n]=e.split(".");return fle(r)}function hle(e){try{return typeof t4(e).login_id=="string"}catch{return!1}}var NO;class po{constructor(t){this[NO]="ReadablePromise",this.status="pending",this.suspender=t.then(r=>(this.status="success",this.response=r,r),r=>{throw this.status="error",this.error=r,r})}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,r){return this.suspender.then(t,r)}catch(t){return this.suspender.catch(t)}finally(t){return this.suspender.finally(t)}}NO=Symbol.toStringTag;class mle{constructor(t){this.storage=t??(typeof localStorage<"u"?localStorage:new gle)}clear(){this.storage.clear()}getString(t){return this.storage.getItem(t)??void 0}setString(t,r){r?this.storage.setItem(t,r):this.storage.removeItem(t)}getObject(t){const r=this.getString(t);return r?JSON.parse(r):void 0}setObject(t,r){this.setString(t,r?Ir(r):void 0)}}class gle{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,r){r?this.data.set(t,r):this.data.delete(t)}removeItem(t){this.data.delete(t)}key(t){return Array.from(this.data.keys())[t]}}const vle="2.2.0-82ebbb9a",yle=Qt.FHIR_JSON+", */*; q=0.1",xle="https://api.medplum.com/",wle=1e3,ble=6e4,AO="Binary/",MO={resourceType:"Device",id:"system",deviceName:[{name:"System"}]};class _le extends Z5{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)??Sle(),this.storage=(t==null?void 0:t.storage)??new mle,this.createPdfImpl=t==null?void 0:t.createPdf,this.baseUrl=zO((t==null?void 0:t.baseUrl)??xle),this.fhirBaseUrl=zO(Gu(this.baseUrl,(t==null?void 0:t.fhirUrlPath)??"fhir/R4/")),this.authorizeUrl=Gu(this.baseUrl,(t==null?void 0:t.authorizeUrl)??"oauth2/authorize"),this.tokenUrl=Gu(this.baseUrl,(t==null?void 0:t.tokenUrl)??"oauth2/token"),this.logoutUrl=Gu(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)??ble,this.cacheTime>0?this.requestCache=new rle((t==null?void 0:t.resourceCacheSize)??wle):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 r=this.storage.getInitPromise(),n=new Promise(o=>{r.then(()=>{this.attemptResumeActiveLogin().then(o).catch(console.error),this.initComplete=!0}).catch(console.error)});this.initPromise=n,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.sessionDetails=void 0,this.medplumServer=void 0,this.dispatchEvent({type:"change"})}invalidateUrl(t){var r;t=t.toString(),(r=this.requestCache)==null||r.delete(t)}invalidateAll(){var t;(t=this.requestCache)==null||t.clear()}invalidateSearches(t){const r=this.fhirBaseUrl+t;if(this.requestCache)for(const n of this.requestCache.keys())(n.endsWith(r)||n.includes(r+"?"))&&this.requestCache.delete(n)}get(t,r={}){t=t.toString();const n=this.getCacheEntry(t,r);if(n)return n.value;let o;t.startsWith(this.fhirBaseUrl)&&this.autoBatchQueue?o=new Promise((a,l)=>{this.autoBatchQueue.push({method:"GET",url:t.replace(this.fhirBaseUrl,""),options:r,resolve:a,reject:l}),this.autoBatchTimerId||(this.autoBatchTimerId=setTimeout(()=>this.executeAutoBatch(),this.autoBatchTime))}):o=this.request("GET",t,r);const i=new po(o);return this.setCacheEntry(t,i),i}post(t,r,n,o={}){return t=t.toString(),this.setRequestBody(o,r),n&&this.setRequestContentType(o,n),this.invalidateUrl(t),this.request("POST",t,o)}put(t,r,n,o={}){return t=t.toString(),this.setRequestBody(o,r),n&&this.setRequestContentType(o,n),this.invalidateUrl(t),this.request("PUT",t,o)}patch(t,r,n={}){return t=t.toString(),this.setRequestBody(n,r),this.setRequestContentType(n,Qt.JSON_PATCH),this.invalidateUrl(t),this.request("PATCH",t,n)}delete(t,r){return t=t.toString(),this.invalidateUrl(t),this.request("DELETE",t,r)}async startNewUser(t,r){const{codeChallengeMethod:n,codeChallenge:o}=await this.startPkce();return this.post("auth/newuser",{...t,clientId:t.clientId??this.clientId,codeChallengeMethod:n,codeChallenge:o},void 0,r)}async startNewProject(t,r){return this.post("auth/newproject",t,void 0,r)}async startNewPatient(t,r){return this.post("auth/newpatient",t,void 0,r)}async startLogin(t,r){return this.post("auth/login",{...await this.ensureCodeChallenge(t),clientId:t.clientId??this.clientId,scope:t.scope},void 0,r)}async startGoogleLogin(t,r){return this.post("auth/google",{...await this.ensureCodeChallenge(t),clientId:t.clientId??this.clientId,scope:t.scope},void 0,r)}async ensureCodeChallenge(t){return t.codeChallenge?t:{...t,...await this.startPkce()}}async signOut(){await this.post(this.logoutUrl,{}),this.clear()}async signInWithRedirect(t){const n=new URLSearchParams(window.location.search).get("code");if(n)return this.processCode(n);await this.requestAuthorization(t)}signOutWithRedirect(){window.location.assign(this.logoutUrl)}async signInWithExternalAuth(t,r,n,o,i=!0){let a=o;i&&(a=await this.ensureCodeChallenge(o)),window.location.assign(this.getExternalAuthRedirectUri(t,r,n,a,i))}async exchangeExternalAccessToken(t,r){if(r=r??this.clientId,!r)throw new Error("MedplumClient is missing clientId");const n=new URLSearchParams;return n.set("grant_type","urn:ietf:params:oauth:grant-type:token-exchange"),n.set("subject_token_type","urn:ietf:params:oauth:token-type:access_token"),n.set("client_id",r),n.set("subject_token",t),this.fetchTokens(n)}getExternalAuthRedirectUri(t,r,n,o,i=!0){const a=new URL(t);if(a.searchParams.set("response_type","code"),a.searchParams.set("client_id",r),a.searchParams.set("redirect_uri",n),a.searchParams.set("scope","openid profile email"),a.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`.");a.searchParams.set("code_challenge_method",c),a.searchParams.set("code_challenge",l)}return a.toString()}fhirUrl(...t){return new URL(t.join("/"),this.fhirBaseUrl)}fhirSearchUrl(t,r){const n=this.fhirUrl(t);return r&&(n.search=new URLSearchParams(r).toString()),n}search(t,r,n){const o=this.fhirSearchUrl(t,r),i=o.toString()+"-search",a=this.getCacheEntry(i,n);if(a)return a.value;const l=new po((async()=>{const c=await this.get(o,n);if(c.entry)for(const u of c.entry)this.cacheResource(u.resource);return c})());return this.setCacheEntry(i,l),l}searchOne(t,r,n){const o=this.fhirSearchUrl(t,r);o.searchParams.set("_count","1"),o.searchParams.sort();const i=o.toString()+"-searchOne",a=this.getCacheEntry(i,n);if(a)return a.value;const l=new po(this.search(t,o.searchParams,n).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,r,n){const i=this.fhirSearchUrl(t,r).toString()+"-searchResources",a=this.getCacheEntry(i,n);if(a)return a.value;const l=new po(this.search(t,r,n).then(VO));return this.setCacheEntry(i,l),l}async*searchResourcePages(t,r,n){var i,a;let o=this.fhirSearchUrl(t,r);for(;o;){const l=new URL(o).searchParams,c=await this.search(t,l,n),u=(i=c.link)==null?void 0:i.find(d=>d.relation==="next");if(!((a=c.entry)!=null&&a.length)&&!u)break;yield VO(c),o=u!=null&&u.url?new URL(u.url):void 0}}searchValueSet(t,r,n){const o=this.fhirUrl("ValueSet","$expand");return o.searchParams.set("url",t),o.searchParams.set("filter",r),this.get(o.toString(),n)}getCached(t,r){var o,i;const n=(i=(o=this.requestCache)==null?void 0:o.get(this.fhirUrl(t,r).toString()))==null?void 0:i.value;return n!=null&&n.isOk()?n.read():void 0}getCachedReference(t){const r=t.reference;if(!r)return;if(r==="system")return MO;const[n,o]=r.split("/");if(!(!n||!o))return this.getCached(n,o)}readResource(t,r,n){return this.get(this.fhirUrl(t,r),n)}readReference(t,r){const n=t.reference;if(!n)return new po(Promise.reject(new Error("Missing reference")));if(n==="system")return new po(Promise.resolve(MO));const[o,i]=n.split("/");return!o||!i?new po(Promise.reject(new Error("Invalid reference"))):this.readResource(o,i,r)}requestSchema(t){if(Hae(t))return Promise.resolve();const r=t+"-requestSchema",n=this.getCacheEntry(r,void 0);if(n)return n.value;const o=new po((async()=>{const i=`{
|
|
89
|
+
`?(this.pos.line++,this.pos.column=0):this.pos.column++}buildToken(t,r){const n=this.markStack.pop();if(!n)throw new Error("No mark for token");return{id:t,value:r,...n}}}function yse(e){return!!(e&&(e.id==="String"||e.id==="Symbol"&&gse.includes(e.value)))}const xse=["true","false"],wse=["!=","!~","<=",">=","{}","->"];function bse(e){return new vse(e,xse,wse).tokenize()}const Ue={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},_se={parse(e){var r;const t=e.consumeAndParse();if(!e.match(")"))throw new Error("Parse error: expected `)` got `"+((r=e.peek())==null?void 0:r.value)+"`");return t}},Sse={parse(e,t){const r=e.consumeAndParse();if(!e.match("]"))throw new Error("Parse error: expected `]`");return new Ex(t,r)},precedence:Ue.Indexer},Pse={parse(e,t){if(!(t instanceof Sx))throw new Error("Unexpected parentheses");const r=[];for(;!e.match(")");)r.push(e.consumeAndParse()),e.match(",");return new Cx(t.name,r)},precedence:Ue.FunctionCall};function jse(e){const t=e.split(" "),r=parseFloat(t[0]);let n=t[1];return n!=null&&n.startsWith("'")&&n.endsWith("'")?n=n.substring(1,n.length-1):n="{"+n+"}",{value:r,unit:n}}function Ose(){return new uie().registerPrefix("String",{parse:(e,t)=>new Ma({type:B.string,value:t.value})}).registerPrefix("DateTime",{parse:(e,t)=>new Ma({type:B.dateTime,value:wd(t.value)})}).registerPrefix("Quantity",{parse:(e,t)=>new Ma({type:B.Quantity,value:jse(t.value)})}).registerPrefix("Number",{parse:(e,t)=>new Ma({type:B.decimal,value:parseFloat(t.value)})}).registerPrefix("true",{parse:()=>new Ma({type:B.boolean,value:!0})}).registerPrefix("false",{parse:()=>new Ma({type:B.boolean,value:!1})}).registerPrefix("Symbol",{parse:(e,t)=>new Sx(t.value)}).registerPrefix("{}",{parse:()=>new nse}).registerPrefix("(",_se).registerInfix("[",Sse).registerInfix("(",Pse).prefix("+",Ue.UnaryAdd,(e,t)=>new ose("+",t,r=>r)).prefix("-",Ue.UnarySubtract,(e,t)=>new xn("-",t,t,(r,n)=>-n)).infixLeft(".",Ue.Dot,(e,t,r)=>new jx(e,r)).infixLeft("/",Ue.Divide,(e,t,r)=>new xn("/",e,r,(n,o)=>n/o)).infixLeft("*",Ue.Multiply,(e,t,r)=>new xn("*",e,r,(n,o)=>n*o)).infixLeft("+",Ue.Add,(e,t,r)=>new xn("+",e,r,(n,o)=>n+o)).infixLeft("-",Ue.Subtract,(e,t,r)=>new xn("-",e,r,(n,o)=>n-o)).infixLeft("|",Ue.Union,(e,t,r)=>new q5(e,r)).infixLeft("=",Ue.Equals,(e,t,r)=>new lse(e,r)).infixLeft("!=",Ue.NotEquals,(e,t,r)=>new cse(e,r)).infixLeft("~",Ue.Equivalent,(e,t,r)=>new use(e,r)).infixLeft("!~",Ue.NotEquivalent,(e,t,r)=>new dse(e,r)).infixLeft("<",Ue.LessThan,(e,t,r)=>new xn("<",e,r,(n,o)=>n<o)).infixLeft("<=",Ue.LessThanOrEquals,(e,t,r)=>new xn("<=",e,r,(n,o)=>n<=o)).infixLeft(">",Ue.GreaterThan,(e,t,r)=>new xn(">",e,r,(n,o)=>n>o)).infixLeft(">=",Ue.GreaterThanOrEquals,(e,t,r)=>new xn(">=",e,r,(n,o)=>n>=o)).infixLeft("&",Ue.Ampersand,(e,t,r)=>new ise(e,r)).infixLeft("and",Ue.And,(e,t,r)=>new fse(e,r)).infixLeft("as",Ue.As,(e,t,r)=>new Px(e,r)).infixLeft("contains",Ue.Contains,(e,t,r)=>new ase(e,r)).infixLeft("div",Ue.Divide,(e,t,r)=>new xn("div",e,r,(n,o)=>n/o|0)).infixLeft("in",Ue.In,(e,t,r)=>new sse(e,r)).infixLeft("is",Ue.Is,(e,t,r)=>new Ox(e,r)).infixLeft("mod",Ue.Modulo,(e,t,r)=>new xn("mod",e,r,(n,o)=>n%o)).infixLeft("or",Ue.Or,(e,t,r)=>new pse(e,r)).infixLeft("xor",Ue.Xor,(e,t,r)=>new hse(e,r)).infixLeft("implies",Ue.Implies,(e,t,r)=>new mse(e,r))}const Cse=Ose();function G5(e){return new rse(e,Cse.construct(bse(e)).consumeAndParse())}function Ese(e,t){const r=Array.isArray(t)?t:[t];for(let n=0;n<r.length;n++){const o=r[n];typeof o=="object"&&"type"in o&&"value"in o||(r[n]=no(r[n]))}return hc(e,r).map(n=>n.value)}function hc(e,t,r){const n=r??{};return G5(e).eval({variables:n},t).map(i=>{var a;return{type:i.type,value:(a=i.value)==null?void 0:a.valueOf()}})}var ri=(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))(ri||{});function ym(e,t){var n,o;let r=(o=(n=Si.types[e])==null?void 0:n.searchParamsDetails)==null?void 0:o[t.code];return r||(r=kse(e,t)),r}function $se(e,t,r){const n=Si.types[e];n.searchParamsDetails||(n.searchParamsDetails={}),n.searchParamsDetails[t]=r}function kse(e,t){const r=t.code,n=Ise(r),o=Nse(e,t.expression),i={elementDefinitions:[],propertyTypes:new Set,array:!1};for(const l of o){const c=zl(l);c.length===1&&c[0]instanceof Mr?i.propertyTypes.add("boolean"):Q5(i,zl(l),e,1)}const a={columnName:n,type:Dse(t,i.propertyTypes),elementDefinitions:i.elementDefinitions,array:i.array};return $se(e,r,a),a}function Q5(e,t,r,n){const o=t[n];if(o instanceof Px){e.propertyTypes.add(o.right.toString());return}if(o instanceof Cx){Rse(e,o);return}const i=o.toString(),a=Sa(r,i);if(!a)throw new Error(`Element definition not found for ${r} ${i}`);let l=!1,c=n+1;if(c<t.length&&t[c]instanceof Ex&&(l=!0,c++),a.isArray&&!l&&(e.array=!0),c>=t.length){e.elementDefinitions.push(a);for(const u of a.type)e.propertyTypes.add(u.code);return}for(const u of a.type){let d=u.code;Tse(d)&&(d=a.type[0].code),Q5(e,t,d,c)}}function Rse(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 Ox){e.propertyTypes.add(t.args[0].right.toString());return}throw new Error(`Unhandled FHIRPath function: ${t.name}`)}function Tse(e){return e==="Element"||e==="BackboneElement"}function Ise(e){return e.split("-").reduce((t,r,n)=>t+(n?sr(r):r),"")}function Dse(e,t){switch(e.type){case"date":return t.size===1&&t.has(B.date)?"DATE":"DATETIME";case"number":return"NUMBER";case"quantity":return"QUANTITY";case"reference":return t.has(B.canonical)?"CANONICAL":"REFERENCE";case"token":return t.size===1&&t.has(B.boolean)?"BOOLEAN":"TEXT";default:return"TEXT"}}function Nse(e,t){const r=[],n=G5(t);return fy(e,n.child,r),r}function fy(e,t,r){t instanceof q5?(fy(e,t.left,r),fy(e,t.right,r)):t.toString().startsWith(e+".")&&r.push(t)}function zl(e){if(e instanceof Px||e instanceof Ex)return[zl(e.left),e].flat();if(e instanceof Mr)return[e];if(e instanceof jx)return[zl(e.left),zl(e.right)].flat();if(e instanceof Cx){if(e.name==="where"&&!(e.args[0]instanceof Ox))return[];if(e.name==="last")return[]}return[e]}const Fc=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 K5={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"},$x={eq:"eq",ne:"ne",lt:"lt",le:"le",gt:"gt",ge:"ge",sa:"sa",eb:"eb",ap:"ap"};function Ase(e){let t;for(const r of e.pathname.split("/"))r&&(t=r);return Lse(t,e.searchParams.entries())}function Mse(e){return Ase(new URL(e,"https://example.com/"))}function Lse(e,t){const r={resourceType:e};for(const[n,o]of t)zse(r,n,o);return r}function zse(e,t,r){var a,l;let n,o;const i=t.indexOf(":");if(i>=0?(n=t.substring(0,i),o=t.substring(i+1)):(n=t,o=""),n==="_has"||t.includes(".")){zg(e,{code:t,operator:"eq",value:r});return}switch(n){case"_sort":Fse(e,r);break;case"_count":e.count=parseInt(r,10);break;case"_offset":e.offset=parseInt(r,10);break;case"_total":e.total=r;break;case"_summary":r==="count"?(e.total="accurate",e.count=0):(r==="true"||r==="data"||r==="text")&&(e.summary=r);break;case"_include":{const c=$O(r);o==="iterate"&&(c.modifier="iterate"),e.include?e.include.push(c):e.include=[c];break}case"_revinclude":{const c=$O(r);o==="iterate"&&(c.modifier="iterate"),e.revInclude?e.revInclude.push(c):e.revInclude=[c];break}case"_fields":case"_elements":e.fields=r.split(",");break;default:{const c=(l=(a=Si.types[e.resourceType])==null?void 0:a.searchParams)==null?void 0:l[n];c?zg(e,Vse(c,o,r)):zg(e,Wse(n,o,r))}}}function Fse(e,t){for(const r of t.split(",")){let n,o=!1;r.startsWith("-")?(n=r.substring(1),o=!0):n=r,e.sortRules||(e.sortRules=[]),e.sortRules.push({code:n,descending:o})}}function Vse(e,t,r){if(t==="missing")return{code:e.code,operator:"missing",value:r};switch(e.type){case"number":case"date":case"quantity":return Bse(e,r);case"reference":case"string":case"token":case"uri":return Use(e,t,r);default:throw new Error("Unrecognized search parameter type: "+e.type)}}function Bse(e,t){const{operator:r,value:n}=Hse(t);return{code:e.code,operator:r,value:n}}function Use(e,t,r){return{code:e.code,operator:qse(t),value:r}}function Wse(e,t,r){var o;let n="eq";if(t)n=t;else if(r.length>=2){const i=r.substring(0,2);i in $x&&(r.length===2||(o=r.at(2))!=null&&o.match(/\d/))&&(n=i,r=r.substring(i.length))}return{code:e,operator:n,value:r}}function Hse(e){const t=e.substring(0,2),r=$x[t];return r?{operator:r,value:e.substring(2)}:{operator:"eq",value:e}}function qse(e){return K5[e]??"eq"}function $O(e){const t=e.split(":");if(t.includes("*"))throw new Ne(vi("'*' is not supported as a value for search inclusion parameters"));if(t.length===1)throw new Ne(vi(`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 Ne(vi(`Invalid include value '${e}'`))}function zg(e,t){e.filters?e.filters.push(t):e.filters=[t]}function es(e){const t=[];return e.fields&&t.push("_fields="+e.fields.join(",")),e.filters&&e.filters.forEach(r=>t.push(Gse(r))),e.sortRules&&e.sortRules.length>0&&t.push(Qse(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(r=>t.push(kO("_include",r))),e.revInclude&&e.revInclude.forEach(r=>t.push(kO("_revinclude",r))),t.length===0?"":(t.sort((r,n)=>r.localeCompare(n)),"?"+t.join("&"))}function Gse(e){const t=e.operator in K5?":"+e.operator:"",r=e.operator!=="eq"&&e.operator in $x?e.operator:"";return`${e.code}${t}=${r}${encodeURIComponent(e.value)}`}function Qse(e){return"_sort="+e.map(t=>t.descending?"-"+t.code:t.code).join(",")}function kO(e,t){return e+"="+t.resourceType+":"+t.searchParam+(t.targetType?":"+t.targetType:"")}function Kse(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 Yse(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 RO(){const e=new Uint32Array(28);return crypto.getRandomValues(e),bie(e.buffer)}async function Xse(e){return crypto.subtle.digest("SHA-256",new TextEncoder().encode(e))}function Y5(){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 X5(e){var o,i,a;const t={};e=ba(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]=Y5(),l.fullUrl="urn:uuid:"+t[c],(a=l.resource)==null||delete a.id)}const r=e.entry,n=JSON.stringify({resourceType:"Bundle",type:"transaction",entry:r==null?void 0:r.map(l=>({fullUrl:l.fullUrl,request:{method:"POST",url:l.resource.resourceType},resource:l.resource}))},(l,c)=>Jse(l,c,t),2);return Zse(JSON.parse(n))}function Jse(e,t,r){if(e==="reference"&&typeof t=="string"){let n;if(t.includes("/")?n=t.split("/")[1]:t.startsWith("urn:uuid:")?n=t.slice(9):t.startsWith("#")&&(n=t.slice(1)),n){const o=r[n];if(o)return"urn:uuid:"+o}}return t}function Zse(e){const t=tle(e),{sorted:r,cycles:n}=ele(t),o={};for(const a of e.entry||[])a.fullUrl&&(o[a.fullUrl]=a);const i=r.map(a=>o[a]);for(const a of n)for(const l of a){const c=o[l],u={...c,request:{...c.request,method:"PUT"}};i.push(u)}return{...e,entry:i}}function ele(e){const t=[],r={},n=[];for(const i of Object.keys(e))r[i]=0;function o(i,a){if(r[i]===2)return!0;if(r[i]===1){const c=a.lastIndexOf(i);return c!==-1&&n.push(a.slice(c)),!0}r[i]=1,a.push(i);let l=!1;for(const c of e[i])o(c,a)||(l=!0);return r[i]=2,a.pop(),t.unshift(i),!l}for(const i in e)r[i]===0&&o(i,[]);return{sorted:t,cycles:n}}function J5(e,t){for(const r in e)if(e[r]&&typeof e[r]=="object"){const n=e[r];if(Pa(n)){const o=n.reference;o.startsWith("urn:uuid:")&&t(o)}else J5(n,t)}}function tle(e){const t={};for(const r of e.entry||[])r.fullUrl&&(t[r.fullUrl]=[]);for(const r of e.entry||[]){const n=r.fullUrl;r.resource&&J5(r.resource,o=>{t[o]&&t[o].push(n)})}return t}class rle{constructor(t=10){this.max=t,this.cache=new Map}clear(){this.cache.clear()}get(t){const r=this.cache.get(t);return r&&(this.cache.delete(t),this.cache.set(t,r)),r}set(t,r){this.cache.has(t)?this.cache.delete(t):this.cache.size>=this.max&&this.cache.delete(this.first()),this.cache.set(t,r)}delete(t){this.cache.delete(t)}keys(){return this.cache.keys()}first(){return this.cache.keys().next().value}}const Qt={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 Z5{constructor(){this.listeners={}}addEventListener(t,r){this.listeners[t]||(this.listeners[t]=[]),this.listeners[t].push(r)}removeEventListener(t,r){const n=this.listeners[t];if(n){for(let o=0;o<n.length;o++)if(n[o]===r){n.splice(o,1);return}}}dispatchEvent(t){const r=this.listeners[t.type];if(r)for(const n of r)n.call(this,t);return!t.defaultPrevented}}class nle{constructor(){this.emitter=new Z5}dispatchEvent(t){this.emitter.dispatchEvent(t)}addEventListener(t,r){this.emitter.addEventListener(t,r)}removeEventListener(t,r){this.emitter.removeEventListener(t,r)}}const py={"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"},ole=["Patient","Encounter","ImagingStudy","DiagnosticReport","OperationOutcome","Bundle"],kx=["DiagnosticReport-update"];function ile(e){return kx.includes(e)}function ale(e){if(kx.includes(e))throw new Ne(Rt(`'context.version' is required for '${e}'.`))}const sle={"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 lle(e){return ole.includes(e)}function e4(e){return!!e.endpoint}function TO(e){if(!Rx(e))throw new Ne(Rt("subscriptionRequest must be an object conforming to SubscriptionRequest type."));const{channelType:t,mode:r,topic:n,events:o}=e,i={"hub.channel.type":t,"hub.mode":r,"hub.topic":n,"hub.events":o.join(",")};return e4(e)&&(i.endpoint=e.endpoint),new URLSearchParams(i).toString()}function Rx(e){if(typeof e!="object")return!1;const{channelType:t,mode:r,topic:n,events:o}=e;if(!(t&&r&&n&&o)||typeof n!="string"||typeof o!="object"||!Array.isArray(o)||o.length<1||t!=="websocket"||r!=="subscribe"&&r!=="unsubscribe")return!1;for(const i of o)if(!py[i])return!1;return!(e4(e)&&!(typeof e.endpoint=="string"&&e.endpoint.startsWith("ws")))}function IO(e,t,r,n){if(typeof t!="object")throw new Ne(Rt(`context[${r}] is invalid. Context must contain a single valid FHIR resource! Resource is not an object.`));if(!(t.id&&typeof t.id=="string"))throw new Ne(Rt(`context[${r}] is invalid. Resource must contain a valid string ID.`));if(!t.resourceType)throw new Ne(Rt(`context[${r}] is invalid. Resource must contain a resource type. No resource type found.`));const o=n.resourceType;if(o!=="*"){if(!lle(t.resourceType))throw new Ne(Rt(`context[${r}] 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 Ne(Rt(`context[${r}] is invalid. context[${r}] for the '${e}' event should contain resource of type ${o}.`))}}function cle(e,t,r,n,o){if(o.set(t.key,(o.get(t.key)??0)+1),!n.isArray)IO(e,t.resource,r,n);else{const{resources:i}=t;if(!i)throw new Ne(Rt(`context[${r}] is invalid. context[${r}] for the '${e}' with key '${String(t.key)}' should contain an array of resources on the key 'resources'.`));for(const a of i)IO(e,a,r,n)}}function ule(e,t){const r=new Map,n=sle[e];for(let o=0;o<t.length;o++){const i=t[o].key;if(!n[i])throw new Ne(Rt(`Key '${i}' not found for event '${e}'. Make sure to add only valid keys.`));cle(e,t[o],o,n[i],r)}for(const[o,i]of Object.entries(n)){if(!(i.optional||r.has(o)))throw new Ne(Rt(`Missing required key '${o}' on context for '${e}' event.`));if(!i.manyAllowed&&(r.get(o)||0)>1)throw new Ne(Rt(`${r.get(o)} context entries with key '${o}' found for the '${e}' event when schema only allows for 1.`))}}function DO(e,t,r,n){if(!(e&&typeof e=="string"))throw new Ne(Rt("Must provide a topic."));if(!py[t])throw new Ne(Rt(`Must provide a valid FHIRcast event name. Supported events: ${Object.keys(py).join(", ")}`));if(typeof r!="object")throw new Ne(Rt("context must be a context object or array of context objects."));if(kx.includes(t)&&!n)throw new Ne(Rt(`The '${t}' event must contain a 'context.versionId'.`));const o=Array.isArray(r)?r:[r];return ule(t,o),{timestamp:new Date().toISOString(),id:Y5(),event:{"hub.topic":e,"hub.event":t,context:o,...n?{"context.versionId":n}:{}}}}class dle extends nle{constructor(t){if(super(),this.subRequest=t,!t.endpoint)throw new Ne(Rt("Subscription request should contain an endpoint."));if(!Rx(t))throw new Ne(Rt("Subscription request failed validation."));const r=new WebSocket(t.endpoint);r.addEventListener("open",()=>{this.dispatchEvent({type:"connect"}),r.addEventListener("message",n=>{const o=JSON.parse(n.data);if(o["hub.topic"])return;const i=o;i.event["hub.event"]!=="heartbeat"&&(this.dispatchEvent({type:"message",payload:i}),r.send(JSON.stringify({id:o==null?void 0:o.id,timestamp:new Date().toISOString()})))}),r.addEventListener("close",()=>{this.dispatchEvent({type:"disconnect"})})}),this.websocket=r}disconnect(){this.websocket.close()}}function fle(e){const t=e.replace(/-/g,"+").replace(/_/g,"/"),r=Kse(t),n=Array.from(r).reduce((i,a)=>{const l=("00"+a.charCodeAt(0).toString(16)).slice(-2);return`${i}%${l}`},""),o=decodeURIComponent(n);return JSON.parse(o)}function ple(e){return e.split(".").length===3}function t4(e){const[t,r,n]=e.split(".");return fle(r)}function hle(e){try{return typeof t4(e).login_id=="string"}catch{return!1}}var NO;class po{constructor(t){this[NO]="ReadablePromise",this.status="pending",this.suspender=t.then(r=>(this.status="success",this.response=r,r),r=>{throw this.status="error",this.error=r,r})}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,r){return this.suspender.then(t,r)}catch(t){return this.suspender.catch(t)}finally(t){return this.suspender.finally(t)}}NO=Symbol.toStringTag;class mle{constructor(t){this.storage=t??(typeof localStorage<"u"?localStorage:new gle)}clear(){this.storage.clear()}getString(t){return this.storage.getItem(t)??void 0}setString(t,r){r?this.storage.setItem(t,r):this.storage.removeItem(t)}getObject(t){const r=this.getString(t);return r?JSON.parse(r):void 0}setObject(t,r){this.setString(t,r?Ir(r):void 0)}}class gle{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,r){r?this.data.set(t,r):this.data.delete(t)}removeItem(t){this.data.delete(t)}key(t){return Array.from(this.data.keys())[t]}}const vle="2.2.1-545c34fc",yle=Qt.FHIR_JSON+", */*; q=0.1",xle="https://api.medplum.com/",wle=1e3,ble=6e4,AO="Binary/",MO={resourceType:"Device",id:"system",deviceName:[{name:"System"}]};class _le extends Z5{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)??Sle(),this.storage=(t==null?void 0:t.storage)??new mle,this.createPdfImpl=t==null?void 0:t.createPdf,this.baseUrl=zO((t==null?void 0:t.baseUrl)??xle),this.fhirBaseUrl=zO(Gu(this.baseUrl,(t==null?void 0:t.fhirUrlPath)??"fhir/R4/")),this.authorizeUrl=Gu(this.baseUrl,(t==null?void 0:t.authorizeUrl)??"oauth2/authorize"),this.tokenUrl=Gu(this.baseUrl,(t==null?void 0:t.tokenUrl)??"oauth2/token"),this.logoutUrl=Gu(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)??ble,this.cacheTime>0?this.requestCache=new rle((t==null?void 0:t.resourceCacheSize)??wle):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 r=this.storage.getInitPromise(),n=new Promise(o=>{r.then(()=>{this.attemptResumeActiveLogin().then(o).catch(console.error),this.initComplete=!0}).catch(console.error)});this.initPromise=n,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.sessionDetails=void 0,this.medplumServer=void 0,this.dispatchEvent({type:"change"})}invalidateUrl(t){var r;t=t.toString(),(r=this.requestCache)==null||r.delete(t)}invalidateAll(){var t;(t=this.requestCache)==null||t.clear()}invalidateSearches(t){const r=this.fhirBaseUrl+t;if(this.requestCache)for(const n of this.requestCache.keys())(n.endsWith(r)||n.includes(r+"?"))&&this.requestCache.delete(n)}get(t,r={}){t=t.toString();const n=this.getCacheEntry(t,r);if(n)return n.value;let o;t.startsWith(this.fhirBaseUrl)&&this.autoBatchQueue?o=new Promise((a,l)=>{this.autoBatchQueue.push({method:"GET",url:t.replace(this.fhirBaseUrl,""),options:r,resolve:a,reject:l}),this.autoBatchTimerId||(this.autoBatchTimerId=setTimeout(()=>this.executeAutoBatch(),this.autoBatchTime))}):o=this.request("GET",t,r);const i=new po(o);return this.setCacheEntry(t,i),i}post(t,r,n,o={}){return t=t.toString(),this.setRequestBody(o,r),n&&this.setRequestContentType(o,n),this.invalidateUrl(t),this.request("POST",t,o)}put(t,r,n,o={}){return t=t.toString(),this.setRequestBody(o,r),n&&this.setRequestContentType(o,n),this.invalidateUrl(t),this.request("PUT",t,o)}patch(t,r,n={}){return t=t.toString(),this.setRequestBody(n,r),this.setRequestContentType(n,Qt.JSON_PATCH),this.invalidateUrl(t),this.request("PATCH",t,n)}delete(t,r){return t=t.toString(),this.invalidateUrl(t),this.request("DELETE",t,r)}async startNewUser(t,r){const{codeChallengeMethod:n,codeChallenge:o}=await this.startPkce();return this.post("auth/newuser",{...t,clientId:t.clientId??this.clientId,codeChallengeMethod:n,codeChallenge:o},void 0,r)}async startNewProject(t,r){return this.post("auth/newproject",t,void 0,r)}async startNewPatient(t,r){return this.post("auth/newpatient",t,void 0,r)}async startLogin(t,r){return this.post("auth/login",{...await this.ensureCodeChallenge(t),clientId:t.clientId??this.clientId,scope:t.scope},void 0,r)}async startGoogleLogin(t,r){return this.post("auth/google",{...await this.ensureCodeChallenge(t),clientId:t.clientId??this.clientId,scope:t.scope},void 0,r)}async ensureCodeChallenge(t){return t.codeChallenge?t:{...t,...await this.startPkce()}}async signOut(){await this.post(this.logoutUrl,{}),this.clear()}async signInWithRedirect(t){const n=new URLSearchParams(window.location.search).get("code");if(n)return this.processCode(n);await this.requestAuthorization(t)}signOutWithRedirect(){window.location.assign(this.logoutUrl)}async signInWithExternalAuth(t,r,n,o,i=!0){let a=o;i&&(a=await this.ensureCodeChallenge(o)),window.location.assign(this.getExternalAuthRedirectUri(t,r,n,a,i))}async exchangeExternalAccessToken(t,r){if(r=r??this.clientId,!r)throw new Error("MedplumClient is missing clientId");const n=new URLSearchParams;return n.set("grant_type","urn:ietf:params:oauth:grant-type:token-exchange"),n.set("subject_token_type","urn:ietf:params:oauth:token-type:access_token"),n.set("client_id",r),n.set("subject_token",t),this.fetchTokens(n)}getExternalAuthRedirectUri(t,r,n,o,i=!0){const a=new URL(t);if(a.searchParams.set("response_type","code"),a.searchParams.set("client_id",r),a.searchParams.set("redirect_uri",n),a.searchParams.set("scope","openid profile email"),a.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`.");a.searchParams.set("code_challenge_method",c),a.searchParams.set("code_challenge",l)}return a.toString()}fhirUrl(...t){return new URL(t.join("/"),this.fhirBaseUrl)}fhirSearchUrl(t,r){const n=this.fhirUrl(t);return r&&(n.search=new URLSearchParams(r).toString()),n}search(t,r,n){const o=this.fhirSearchUrl(t,r),i=o.toString()+"-search",a=this.getCacheEntry(i,n);if(a)return a.value;const l=new po((async()=>{const c=await this.get(o,n);if(c.entry)for(const u of c.entry)this.cacheResource(u.resource);return c})());return this.setCacheEntry(i,l),l}searchOne(t,r,n){const o=this.fhirSearchUrl(t,r);o.searchParams.set("_count","1"),o.searchParams.sort();const i=o.toString()+"-searchOne",a=this.getCacheEntry(i,n);if(a)return a.value;const l=new po(this.search(t,o.searchParams,n).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,r,n){const i=this.fhirSearchUrl(t,r).toString()+"-searchResources",a=this.getCacheEntry(i,n);if(a)return a.value;const l=new po(this.search(t,r,n).then(VO));return this.setCacheEntry(i,l),l}async*searchResourcePages(t,r,n){var i,a;let o=this.fhirSearchUrl(t,r);for(;o;){const l=new URL(o).searchParams,c=await this.search(t,l,n),u=(i=c.link)==null?void 0:i.find(d=>d.relation==="next");if(!((a=c.entry)!=null&&a.length)&&!u)break;yield VO(c),o=u!=null&&u.url?new URL(u.url):void 0}}searchValueSet(t,r,n){const o=this.fhirUrl("ValueSet","$expand");return o.searchParams.set("url",t),o.searchParams.set("filter",r),this.get(o.toString(),n)}getCached(t,r){var o,i;const n=(i=(o=this.requestCache)==null?void 0:o.get(this.fhirUrl(t,r).toString()))==null?void 0:i.value;return n!=null&&n.isOk()?n.read():void 0}getCachedReference(t){const r=t.reference;if(!r)return;if(r==="system")return MO;const[n,o]=r.split("/");if(!(!n||!o))return this.getCached(n,o)}readResource(t,r,n){return this.get(this.fhirUrl(t,r),n)}readReference(t,r){const n=t.reference;if(!n)return new po(Promise.reject(new Error("Missing reference")));if(n==="system")return new po(Promise.resolve(MO));const[o,i]=n.split("/");return!o||!i?new po(Promise.reject(new Error("Invalid reference"))):this.readResource(o,i,r)}requestSchema(t){if(Hae(t))return Promise.resolve();const r=t+"-requestSchema",n=this.getCacheEntry(r,void 0);if(n)return n.value;const o=new po((async()=>{const i=`{
|
|
90
90
|
StructureDefinitionList(name: "${t}") {
|
|
91
91
|
resourceType,
|
|
92
92
|
name,
|
|
@@ -187,9 +187,9 @@ Error generating stack: `+i.message+`
|
|
|
187
187
|
}
|
|
188
188
|
}
|
|
189
189
|
}`.replace(/\s+/g," ")}function Ace(e,t){const r=[];return e.data.Patients1&&r.push(...e.data.Patients1),e.data.Patients2&&r.push(...e.data.Patients2),e.data.ServiceRequestList&&r.push(...e.data.ServiceRequestList),Lce(Mce(r),t).slice(0,5)}function Mce(e){const t=new Set,r=[];for(const n of e)t.has(n.id)||(t.add(n.id),r.push(n));return r}function Lce(e,t){return e.sort((r,n)=>YO(n,t)-YO(r,t))}function YO(e,t){let r=0;if(e.identifier)for(const n of e.identifier)r=Math.max(r,XO(n.value,t));if(e.resourceType==="Patient"&&e.name)for(const n of e.name)r=Math.max(r,XO(zc(n),t));return r}function XO(e,t){if(!e)return 0;const r=e.toLowerCase().indexOf(t.toLowerCase());return r<0?0:100-r}const zce=W(e=>({logoButton:{padding:`${e.spacing.xs} ${e.spacing.sm}`,borderRadius:e.radius.sm,transition:"background-color 100ms ease","&:hover":{backgroundColor:e.fn.lighten(e.fn.variant({variant:"filled",color:e.primaryColor}).background,.8)}},user:{padding:`${e.spacing.xs} ${e.spacing.sm}`,borderRadius:e.radius.sm,transition:"background-color 100ms ease","&:hover":{backgroundColor:e.fn.lighten(e.fn.variant({variant:"filled",color:e.primaryColor}).background,.8)}},userName:{fontWeight:500,lineHeight:1,marginRight:3,[e.fn.smallerThan("xs")]:{display:"none"}},userActive:{backgroundColor:e.fn.lighten(e.fn.variant({variant:"filled",color:e.primaryColor}).background,.8)}}));function Fce(e){var d,p,h,m;const t=xm(),{medplum:r,profile:n,navigate:o}=t,i=r.getLogins(),{classes:a,cx:l}=zce(),[c,u]=f.useState(!1);return s.jsx(Gk,{height:60,p:8,style:{zIndex:101},children:s.jsxs(Y,{position:"apart",children:[s.jsxs(Y,{spacing:"xs",children:[s.jsx(So,{className:a.logoButton,onClick:e.navbarToggle,children:e.logo}),!e.headerSearchDisabled&&s.jsx(Ice,{pathname:e.pathname,searchParams:e.searchParams})]}),s.jsxs(J,{width:260,shadow:"xl",position:"bottom-end",transitionProps:{transition:"pop-top-right"},opened:c,onClose:()=>u(!1),children:[s.jsx(J.Target,{children:s.jsx(So,{className:l(a.user,{[a.userActive]:c}),onClick:()=>u(g=>!g),children:s.jsxs(Y,{spacing:7,children:[s.jsx(Pi,{value:n,radius:"xl",size:24}),s.jsx(oe,{size:"sm",className:a.userName,children:zc((d=n==null?void 0:n.name)==null?void 0:d[0])}),s.jsx(Qle,{size:12,stroke:1.5})]})})}),s.jsxs(J.Dropdown,{children:[s.jsxs(je,{align:"center",p:"xl",children:[s.jsx(Pi,{size:"xl",radius:100,value:t.profile}),s.jsx(Mx,{value:(h=(p=t.profile)==null?void 0:p.name)==null?void 0:h[0]}),s.jsx(oe,{color:"dimmed",size:"xs",children:(m=r.getActiveLogin())==null?void 0:m.project.display})]}),i.length>1&&s.jsx(J.Divider,{}),i.map(g=>g.profile.reference!==nt(t.profile)&&s.jsx(J.Item,{onClick:()=>{r.setActiveLogin(g).then(()=>window.location.reload()).catch(console.log)},children:s.jsxs(Y,{children:[s.jsx(Af,{radius:"xl"}),s.jsxs("div",{style:{flex:1},children:[s.jsx(oe,{size:"sm",weight:500,children:g.profile.display}),s.jsx(oe,{color:"dimmed",size:"xs",children:g.project.display})]})]})},g.profile.reference)),s.jsx(J.Divider,{}),s.jsx(J.Item,{icon:s.jsx(_ce,{size:14,stroke:1.5}),onClick:()=>o("/signin"),children:"Add another account"}),s.jsx(J.Item,{icon:s.jsx(hy,{size:14,stroke:1.5}),onClick:()=>o(`/${nt(n)}`),children:"Account settings"}),s.jsx(J.Item,{icon:s.jsx(lce,{size:14,stroke:1.5}),onClick:async()=>{await r.signOut(),o("/signin")},children:"Sign out"}),s.jsx(oe,{size:"xs",color:"dimmed",align:"center",children:e.version})]})]})]})})}function Vce(e){const t={};for(const r of Array.from(e.elements))r instanceof HTMLInputElement?Bce(t,r):r instanceof HTMLTextAreaElement?t[r.name]=r.value:r instanceof HTMLSelectElement&&Uce(t,r);return t}function Bce(e,t){t.disabled||(t.type==="checkbox"||t.type==="radio")&&!t.checked||(e[t.name]=t.value)}function Uce(e,t){e[t.name]=t.value}function De(e){return s.jsx("form",{style:e.style,"data-testid":e.testid,onSubmit:t=>{t.preventDefault();const r=Vce(t.target);e.onSubmit&&e.onSubmit(r)},children:e.children})}function Wce(e){const t=ae(),r=t.getUserConfiguration();function n(o){var d,p;const{menuname:i,bookmarkname:a}=o,l=`${e.pathname}?${e.searchParams.toString()}`,c=ba(r),u=(d=c.menu)==null?void 0:d.find(({title:h})=>h===i);(p=u==null?void 0:u.link)==null||p.push({name:a,target:l}),t.updateResource(c).then(h=>{r.menu=h.menu,t.dispatchEvent({type:"change"}),pe({color:"green",message:"Success"}),e.onOk()}).catch(h=>{pe({color:"red",message:Oe(h)})})}return s.jsx(Ar,{title:"Add Bookmark",closeButtonProps:{"aria-label":"Close"},opened:e.visible,onClose:e.onCancel,children:s.jsx(De,{onSubmit:n,children:s.jsxs(je,{children:[s.jsx(Hce,{config:r}),s.jsx(le,{label:"Bookmark Name",type:"text",name:"bookmarkname",placeholder:"Bookmark Name",withAsterisk:!0}),s.jsx(Y,{position:"right",children:s.jsx(re,{mt:"sm",type:"submit",children:"OK"})})]})})})}function Hce(e){function t(n){var o;return(o=n==null?void 0:n.menu)==null?void 0:o.map(i=>i.title)}const r=t(e.config);return s.jsx(mt,{name:"menuname",defaultValue:r[0],label:"Select Menu Option",placeholder:"Menu",data:r,withAsterisk:!0})}function zx(e){return typeof e.code=="string"?e.code:JSON.stringify(e)}function qce(e){return typeof e.display=="string"?e.display:zx(e)}function Gce(e){return{value:zx(e),label:qce(e),resource:e}}function Qce(e){return{code:e,display:e}}function Fx(e){const t=ae(),{binding:r,creatable:n,clearable:o,...i}=e,a=f.useCallback(async(l,c)=>{var h;if(!r)return[];const d=(h=(await t.searchValueSet(r,l,{signal:c})).expansion)==null?void 0:h.contains,p=[];for(const m of d)m.code&&!p.some(g=>g.code===m.code)&&p.push(m);return p},[t,r]);return s.jsx(Lx,{...i,creatable:n??!0,clearable:o??!0,toKey:zx,toOption:Gce,loadOptions:a,onCreate:Qce,getCreateLabel:n===!1?void 0:l=>`+ Create ${l}`})}function d4(e){const[t,r]=f.useState(e.defaultValue);function n(o){const i=o[0],a=Yce(i);r(a),e.onChange&&e.onChange(a)}return s.jsx(Fx,{binding:e.binding,name:e.name,placeholder:e.placeholder,defaultValue:Kce(t),onChange:n,creatable:e.creatable,maxSelectedValues:e.maxSelectedValues??1,clearSearchOnChange:e.clearSearchOnChange,clearable:e.clearable})}function Kce(e){return e?{code:e}:void 0}function Yce(e){return e==null?void 0:e.code}function Vx(e){const[t,r]=f.useState(e.defaultValue),n=e.onChange,o=f.useCallback(i=>{r(i),n&&n(i)},[n]);return s.jsx(d4,{"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,maxSelectedValues:0,clearSearchOnChange:!0,clearable:!1})}const f4=W(e=>({menuTitle:{margin:"20px 0 4px 6px",fontSize:"9px",fontWeight:"normal",textTransform:"uppercase",letterSpacing:"2px"},link:{...e.fn.focusStyles(),display:"flex",alignItems:"center",textDecoration:"none",fontSize:e.fontSizes.sm,color:e.colorScheme==="dark"?e.colors.dark[1]:e.colors.gray[7],padding:"8px 12px",borderRadius:e.radius.sm,fontWeight:500,"&:hover":{backgroundColor:e.colorScheme==="dark"?e.colors.dark[6]:e.colors.gray[0],color:e.colorScheme==="dark"?e.white:e.black,textDecoration:"none","& svg":{color:e.colorScheme==="dark"?e.white:e.black}},"& svg":{color:e.colorScheme==="dark"?e.colors.dark[2]:e.colors.gray[6],marginRight:e.spacing.sm,strokeWidth:1.5,width:18,height:18}},linkActive:{"&, &:hover":{backgroundColor:e.fn.variant({variant:"light",color:e.primaryColor}).background,color:e.fn.variant({variant:"light",color:e.primaryColor}).color,"& svg":{color:e.fn.variant({variant:"light",color:e.primaryColor}).color}}}}));function Xce(e){var c;const{classes:t}=f4(),r=wm(),n=eue(e.pathname,e.searchParams,e.menus),[o,i]=f.useState(!1);function a(u,d){u.stopPropagation(),u.preventDefault(),r(d),window.innerWidth<768&&e.closeNavbar()}function l(u){u&&r(`/${u}`)}return s.jsxs(s.Fragment,{children:[s.jsx(Ml,{width:{sm:250},p:"xs",children:s.jsxs(ma,{children:[!e.resourceTypeSearchDisabled&&s.jsx(Ml.Section,{mb:"sm",children:s.jsx(Vx,{name:"resourceType",placeholder:"Resource Type",onChange:u=>l(u)},window.location.pathname)}),s.jsxs(Ml.Section,{grow:!0,children:[(c=e.menus)==null?void 0:c.map(u=>{var d;return s.jsxs(f.Fragment,{children:[s.jsx(oe,{className:t.menuTitle,children:u.title}),(d=u.links)==null?void 0:d.map(p=>s.jsxs(Jce,{to:p.href,active:p.href===(n==null?void 0:n.href),onClick:h=>a(h,p.href),children:[s.jsx(Zce,{to:p.href,icon:p.icon}),s.jsx("span",{children:p.label})]},p.href))]},`menu-${u.title}`)}),e.displayAddBookmark&&s.jsx(re,{variant:"subtle",size:"xs",mt:"xl",leftIcon:s.jsx(mce,{size:"0.75rem"}),onClick:()=>i(!0),children:"Add Bookmark"})]})]})}),e.pathname&&e.searchParams&&s.jsx(Wce,{pathname:e.pathname,searchParams:e.searchParams,visible:o,onOk:()=>i(!1),onCancel:()=>i(!1)})]})}function Jce(e){const{classes:t,cx:r}=f4();return s.jsx($e,{onClick:e.onClick,to:e.to,className:r(t.link,{[t.linkActive]:e.active}),children:e.children})}function Zce(e){return e.icon?e.icon:s.jsx(pm,{w:30})}function eue(e,t,r){if(!e||!t||!r)return;let n,o=0;for(const i of r)if(i.links)for(const a of i.links){const l=tue(e,t,a.href);l>o&&(o=l,n=a)}return n}function tue(e,t,r){const n=new URL(r,"https://example.com");if(e!==n.pathname)return 0;const o=["_count","_offset"];for(const[a,l]of n.searchParams.entries())if(!o.includes(a)&&t.get(a)!==l)return 0;let i=1;for(const[a,l]of t.entries())o.includes(a)||n.searchParams.get(a)===l&&i++;return i}function rue(e){var u;const t=Jt(),[r,n]=f.useState(localStorage.navbarOpen==="true"),o=ae(),i=Tx();f.useEffect(()=>{function d(){pe({color:"red",message:"No connection to server",autoClose:!1})}return o.addEventListener("offline",d),()=>o.removeEventListener("offline",d)},[o]);function a(d){localStorage.navbarOpen=d.toString(),n(d)}function l(){a(!1)}function c(){a(!r)}return o.isLoading()?s.jsx(Rn,{}):s.jsx(Xk,{styles:{main:{background:t.colorScheme==="dark"?t.colors.dark[8]:t.colors.gray[0]}},padding:0,fixed:!0,header:i&&s.jsx(Fce,{pathname:e.pathname,searchParams:e.searchParams,headerSearchDisabled:e.headerSearchDisabled,logo:e.logo,version:e.version,navbarToggle:c}),navbar:i&&r?s.jsx(Xce,{pathname:e.pathname,searchParams:e.searchParams,menus:e.menus,closeNavbar:l,displayAddBookmark:e.displayAddBookmark,resourceTypeSearchDisabled:e.resourceTypeSearchDisabled}):void 0,children:s.jsx(c4,{children:s.jsx(f.Suspense,{fallback:s.jsx(Rn,{}),children:e.children})},`${e.pathname}?${(u=e.searchParams)==null?void 0:u.toString()}`)})}function Vc(e){const{contentType:t,url:r,title:n}=e.value??{};return r?s.jsxs("div",{"data-testid":"attachment-display",children:[(t==null?void 0:t.startsWith("image/"))&&s.jsx("img",{"data-testid":"attachment-image",style:{maxWidth:e.maxWidth},src:r,alt:n}),(t==null?void 0:t.startsWith("video/"))&&s.jsx("video",{"data-testid":"attachment-video",style:{maxWidth:e.maxWidth},controls:!0,children:s.jsx("source",{type:t,src:r})}),t==="application/pdf"&&s.jsx("div",{"data-testid":"attachment-pdf",style:{maxWidth:e.maxWidth,minHeight:400},children:s.jsx("iframe",{width:"100%",height:"400",src:r+"#navpanes=0",allowFullScreen:!0,frameBorder:0,seamless:!0})}),s.jsx("div",{"data-testid":"download-link",style:{padding:"2px 16px 16px 16px"},children:s.jsx(Le,{href:r,"data-testid":"attachment-details",target:"_blank",rel:"noopener noreferrer",download:nue(n),children:n||"Download"})})]}):null}function nue(e){return e!=null&&e.includes(".")?e:void 0}function oue(e){var t;return s.jsx("div",{children:(t=e.values)==null?void 0:t.map((r,n)=>s.jsx("div",{children:s.jsx(Vc,{value:r,maxWidth:e.maxWidth})},"attatchment-"+n))})}function Bx(e){const t=ae(),r=f.useRef(null);function n(a){var l;ct(a),(l=r.current)==null||l.click()}function o(a){ct(a);const l=a.target.files;l&&Array.from(l).forEach(i)}function i(a){if(!a||!a.name)return;e.onUploadStart&&e.onUploadStart();const c=a.name,u=a.type||"application/octet-stream";t.createBinary(a,c,u,e.onUploadProgress).then(d=>{e.onUpload({contentType:d.contentType,url:d.url,title:c})}).catch(d=>{e.onUploadError&&e.onUploadError(dt(d))})}return s.jsxs(s.Fragment,{children:[s.jsx("input",{type:"file","data-testid":"upload-file-input",style:{display:"none"},ref:r,onChange:a=>o(a)}),e.children({onClick:n})]})}function iue(e){const[t,r]=f.useState(e.defaultValue??[]),n=f.useRef();n.current=t;function o(i){r(i),e.onChange&&e.onChange(i)}return s.jsxs("table",{style:{width:"100%"},children:[s.jsxs("colgroup",{children:[s.jsx("col",{width:"97%"}),s.jsx("col",{width:"3%"})]}),s.jsxs("tbody",{children:[t.map((i,a)=>s.jsxs("tr",{children:[s.jsx("td",{children:s.jsx(Vc,{value:i,maxWidth:200})}),s.jsx("td",{children:s.jsx(vr,{title:"Remove",size:"sm",onClick:l=>{ct(l);const c=t.slice();c.splice(a,1),o(c)},children:s.jsx(dh,{})})})]},`${a}-${t.length}`)),s.jsxs("tr",{children:[s.jsx("td",{}),s.jsx("td",{children:s.jsx(Bx,{onUpload:i=>{o([...n.current,i])},children:i=>s.jsx(vr,{...i,title:"Add",size:"sm",color:"green",children:s.jsx(Dx,{size:16})})})})]})]})]})}function p4(e){const[t,r]=f.useState(e.defaultValue);function n(o){r(o),e.onChange&&e.onChange(o)}return t?s.jsxs(s.Fragment,{children:[s.jsx(Vc,{value:t,maxWidth:200}),s.jsx(re,{onClick:o=>{ct(o),n(void 0)},children:"Remove"})]}):s.jsx(Bx,{onUpload:n,children:o=>s.jsx(re,{...o,children:"Upload..."})})}const h4=["meta","implicitRules","contained","extension","modifierExtension"],m4=["language","text"],aue=W(e=>({root:{display:"grid",gridTemplateColumns:"30% 70%",margin:0,"& > dt, & > dd":{padding:`${e.spacing.sm} ${e.spacing.sm}`,borderTop:`0.1px solid ${e.colors.gray[3]}`,margin:0}},compact:{gridTemplateColumns:"20% 80%","& > dt, & > dd":{padding:`0 ${e.spacing.xs} ${e.spacing.xs} 0`,border:0}}}));function Ux(e){const{children:t,compact:r}=e,{classes:n,cx:o}=aue();return s.jsx("dl",{className:o(n.root,{[n.compact]:r}),children:t})}function us(e){return s.jsxs(s.Fragment,{children:[s.jsx("dt",{children:e.term}),s.jsx("dd",{children:e.children})]})}function eo(e){return s.jsx(s.Fragment,{children:js(e.value)})}function sue(e){return s.jsx(s.Fragment,{children:_a(e.value)})}function g4(e){const t=e.value;if(!t)return null;const r=[];return t.value&&r.push(t.value),(t.use||t.system)&&(r.push(" ["),t.use&&r.push(t.use),t.use&&t.system&&r.push(" "),t.system&&r.push(t.system),r.push("]")),s.jsx(s.Fragment,{children:r.join("").trim()})}function lue(e){var r;const t=e.value;return t?s.jsxs(s.Fragment,{children:[t.name,t.name&&": ",(r=t.telecom)==null?void 0:r.map(n=>s.jsx(g4,{value:n},`telecom-${t.name}-${n.value}`))]}):null}function cue(e){var t,r;return s.jsxs("div",{children:[(t=e.value)==null?void 0:t.system,": ",(r=e.value)==null?void 0:r.value]})}function uue(e){return s.jsx(s.Fragment,{children:Tie(e.value)})}function mc(e){return s.jsx(s.Fragment,{children:ti(e.value)})}function Wx(e){return s.jsx(s.Fragment,{children:dc(e.value)})}function due(e){const t=e.value;return t?s.jsxs(s.Fragment,{children:[s.jsx(mc,{value:t.numerator})," / ",s.jsx(mc,{value:t.denominator})]}):null}function ph(e){if(!e.value)return null;const t=e.value.display||e.value.reference||Ir(e.value);return e.link!==!1&&e.value.reference?s.jsx($e,{to:e.value,children:t}):s.jsx(s.Fragment,{children:t})}function fue(e){const{property:t,values:r}=e,n=t.type[0].code;return e.values?s.jsx(s.Fragment,{children:r.map((o,i)=>s.jsx("div",{children:s.jsx(To,{arrayElement:!0,property:t,propertyType:n,value:o,ignoreMissingValues:e.ignoreMissingValues,link:e.link})},`${i}-${r.length}`))}):s.jsx(s.Fragment,{})}function To(e){var i;const{property:t,propertyType:r,value:n}=e;if((i=t==null?void 0:t.path)==null?void 0:i.endsWith(".id"))return s.jsxs(ie,{component:"div",sx:{display:"flex",gap:3,alignItems:"center"},children:[n,!xo(n)&&s.jsx(hI,{value:n,timeout:2e3,children:({copied:a,copy:l})=>s.jsx(PN,{label:a?"Copied":"Copy",withArrow:!0,position:"right",children:s.jsx(vr,{color:a?"teal":"gray",onClick:l,children:a?s.jsx(_m,{size:"1rem"}):s.jsx(Yle,{size:"1rem"})})})})]});if(t!=null&&t.max&&t.max>1&&!e.arrayElement)return r===B.Attachment?s.jsx(oue,{values:n,maxWidth:e.maxWidth}):s.jsx(fue,{property:t,values:n,ignoreMissingValues:e.ignoreMissingValues,link:e.link});switch(r){case B.boolean:return s.jsx(s.Fragment,{children:n===void 0?"":(!!n).toString()});case B.SystemString:case B.string:return s.jsx("div",{style:{whiteSpace:"pre-wrap"},children:n});case B.code:case B.date:case B.decimal:case B.id:case B.integer:case B.positiveInt:case B.unsignedInt:case B.uri:case B.url:return s.jsx(s.Fragment,{children:n});case B.canonical:return s.jsx(ph,{value:{reference:n},link:e.link});case B.dateTime:case B.instant:return s.jsx(s.Fragment,{children:Dr(n)});case B.markdown:return s.jsx("pre",{children:n});case B.Address:return s.jsx(Cle,{value:n});case B.Annotation:return s.jsx(s.Fragment,{children:n==null?void 0:n.text});case B.Attachment:return s.jsx(Vc,{value:n,maxWidth:e.maxWidth});case B.CodeableConcept:return s.jsx(eo,{value:n});case B.Coding:return s.jsx(sue,{value:n});case B.ContactDetail:return s.jsx(lue,{value:n});case B.ContactPoint:return s.jsx(g4,{value:n});case B.HumanName:return s.jsx(Mx,{value:n});case B.Identifier:return s.jsx(cue,{value:n});case B.Money:return s.jsx(uue,{value:n});case B.Period:return s.jsx(s.Fragment,{children:Cie(n)});case B.Quantity:case B.Duration:return s.jsx(mc,{value:n});case B.Range:return s.jsx(Wx,{value:n});case B.Ratio:return s.jsx(due,{value:n});case B.Reference:return s.jsx(ph,{value:n,link:e.link});case B.Timing:return s.jsx(s.Fragment,{children:R5(n)});case B.Dosage:case B.UsageContext:return s.jsx(my,{value:{type:r,value:n},compact:!0,ignoreMissingValues:e.ignoreMissingValues});default:if(!t)throw Error(`Displaying property of type ${e.propertyType} requires element schema`);return s.jsx(my,{value:{type:t.type[0].code,value:n},compact:!0,ignoreMissingValues:e.ignoreMissingValues})}}function Bc(e,t){const r=yr(e,t);return r?Array.isArray(r)?[r.map(n=>n.value),r[0].type]:[r.value,r.type]:[void 0,"undefined"]}function my(e){const t=e.value,r=t.value;if(!r)return null;const n=t.type,o=bx(n);return o?typeof r=="object"&&"name"in r&&Object.keys(r).length===1&&typeof r.name=="string"?s.jsx("div",{children:r.name}):s.jsx(Ux,{compact:e.compact,children:Object.entries(o.elements).map(i=>{const[a,l]=i;if(h4.includes(a)||m4.includes(a)&&l.path.split(".").length===2)return null;const[c,u]=Bc(t,a);return e.ignoreMissingValues&&(!c||Array.isArray(c)&&c.length===0)?null:s.jsx(us,{term:dy(a),children:s.jsx(To,{property:l,propertyType:u,value:c,ignoreMissingValues:e.ignoreMissingValues,link:e.link})},a)})}):s.jsxs("div",{children:[n," not implemented"]})}function v4(e){return s.jsxs(Y,{noWrap:!0,children:[s.jsx("div",{children:e.children}),s.jsx("div",{children:s.jsx(Ut.Wrapper,{id:e.htmlFor,label:e.title,description:e.description,withAsterisk:e.withAsterisk,children:null})})]})}function ut(e,t){var r,n,o;return(o=(n=(r=e==null?void 0:e.issue)==null?void 0:r.filter(i=>{var a;return y4((a=i.expression)==null?void 0:a[0],t)}))==null?void 0:n.map(i=>{var a;return(a=i.details)==null?void 0:a.text}))==null?void 0:o.join(`
|
|
190
|
-
`)}function Hx(e,t){var r;return(r=e==null?void 0:e.issue)==null?void 0:r.filter(n=>{var o;return y4((o=n.expression)==null?void 0:o[0],t)})}function y4(e,t){if(e===t)return!0;if(!e||!t)return!1;const r=e.indexOf(".");if(r>=0&&e.substring(r+1)===t)return!0;const n=t.indexOf(".");return n>=0&&t.substring(n+1)===e}function ot(e){return s.jsx(Ut.Wrapper,{id:e.htmlFor,label:e.title,description:e.description,withAsterisk:e.withAsterisk,error:ut(e.outcome,e.htmlFor),children:e.children})}function gy(e,t,r,n,o){const i=n.type;if(i.length>1)for(const a of i){const l=t.replace("[x]",sr(a.code));l in e&&delete e[l]}return e[r]=o,e}function pue(e){const[t,r]=f.useState(e.defaultValue);function n(o){const i=mue(o);r(i),e.onChange&&e.onChange(i)}return s.jsx(Fx,{binding:e.binding,name:e.name,placeholder:e.placeholder,defaultValue:t&&hue(t),maxSelectedValues:1,onChange:n})}function hue(e){var t;return(t=e.coding)==null?void 0:t.map(r=>({system:r.system,code:r.code,display:r.display}))}function mue(e){if(e.length!==0)return{coding:e.map(t=>({system:t.system,code:t.code,display:t.display}))}}function x4(e){const[t,r]=f.useState(e.defaultValue);function n(o){const i=o[0],a=i&&vue(i);r(a),e.onChange&&e.onChange(a)}return s.jsx(Fx,{binding:e.binding,name:e.name,placeholder:e.placeholder,defaultValue:t&&gue(t),maxSelectedValues:1,onChange:n})}function gue(e){return{system:e.system,code:e.code,display:e.display}}function vue(e){return{system:e.system,code:e.code,display:e.display}}function w4(e){const[t,r]=f.useState(e.defaultValue),n=f.useRef();n.current=t;function o(c){c&&Object.keys(c).length===0&&(c=void 0),r(c),e.onChange&&e.onChange(c)}function i(c){const u={...n.current,system:c};c||delete u.system,o(u)}function a(c){const u={...n.current,use:c};c||delete u.use,o(u)}function l(c){const u={...n.current,value:c};c||delete u.value,o(u)}return s.jsxs(Y,{spacing:"xs",grow:!0,noWrap:!0,children:[s.jsx(mt,{"data-testid":"system",defaultValue:t==null?void 0:t.system,onChange:c=>i(c.currentTarget.value),data:["","email","phone","fax","pager","sms","other"]}),s.jsx(mt,{"data-testid":"use",defaultValue:t==null?void 0:t.use,onChange:c=>a(c.currentTarget.value),data:["","home","work","temp","old","mobile"]}),s.jsx(le,{placeholder:"Value",defaultValue:t==null?void 0:t.value,onChange:c=>l(c.currentTarget.value)})]})}function yue(e){var l;const[t,r]=f.useState(e.defaultValue),n=f.useRef();n.current=t;function o(c){r(c),e.onChange&&e.onChange(c)}function i(c){const u={...n.current,name:c};c||delete u.name,o(u)}function a(c){const u={...n.current,telecom:c&&[c]};c||delete u.telecom,o(u)}return s.jsxs(Y,{spacing:"xs",grow:!0,noWrap:!0,children:[s.jsx(le,{"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)}),s.jsx(w4,{name:e.name+"-telecom",defaultValue:(l=t==null?void 0:t.telecom)==null?void 0:l[0],onChange:a})]})}function xue(e){if(!e)return"";const t=new Date(e);return gm(t)?t.toLocaleDateString("sv")+"T"+t.toLocaleTimeString("sv"):""}function b4(e){if(!e)return"";const t=new Date(e);return gm(t)?t.toISOString():""}var wue={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:"2.2.0-82ebbb9a",BASE_URL:"/",MODE:"production",DEV:!1,PROD:!0,SSR:!1};function aa(e){return s.jsx(le,{id:e.name,name:e.name,"data-autofocus":e.autoFocus,"data-testid":e.name,placeholder:e.placeholder,required:e.required,type:bue(),defaultValue:xue(e.defaultValue),autoFocus:e.autoFocus,error:ut(e.outcome,e.name),onChange:t=>{if(e.onChange){const r=t.currentTarget.value;e.onChange(b4(r))}}})}function bue(){return wue.NODE_ENV==="test"?"text":"datetime-local"}function _ue(e){return s.jsx(Fs,{id:e.name,name:e.name,"data-testid":"extension-input",defaultValue:Ir(e.defaultValue),deserialize:JSON.parse,onChange:t=>{e.onChange&&e.onChange(JSON.parse(t))}})}function Sue(e){var d,p,h;const[t,r]=f.useState(e.defaultValue),n=f.useRef();n.current=t;function o(m){r(m),e.onChange&&e.onChange(m)}function i(m){o({...n.current,use:m||void 0})}function a(m){o({...n.current,prefix:m?m.split(" "):void 0})}function l(m){o({...n.current,given:m?m.split(" "):void 0})}function c(m){o({...n.current,family:m||void 0})}function u(m){o({...n.current,suffix:m?m.split(" "):void 0})}return s.jsxs(Y,{spacing:"xs",grow:!0,noWrap:!0,children:[s.jsx(mt,{defaultValue:t==null?void 0:t.use,name:e.name+"-use","data-testid":"use",onChange:m=>i(m.currentTarget.value),data:["","temp","old","usual","official","nickname","anonymous","maiden"]}),s.jsx(le,{placeholder:"Prefix",name:e.name+"-prefix",defaultValue:(d=t==null?void 0:t.prefix)==null?void 0:d.join(" "),onChange:m=>a(m.currentTarget.value)}),s.jsx(le,{placeholder:"Given",name:e.name+"-given",defaultValue:(p=t==null?void 0:t.given)==null?void 0:p.join(" "),onChange:m=>l(m.currentTarget.value)}),s.jsx(le,{name:e.name+"-family",placeholder:"Family",defaultValue:t==null?void 0:t.family,onChange:m=>c(m.currentTarget.value)}),s.jsx(le,{placeholder:"Suffix",name:e.name+"-suffix",defaultValue:(h=t==null?void 0:t.suffix)==null?void 0:h.join(" "),onChange:m=>u(m.currentTarget.value)})]})}function Pue(e){const[t,r]=f.useState(e.defaultValue);function n(o){r(o),e.onChange&&e.onChange(o)}return s.jsxs(Y,{spacing:"xs",grow:!0,noWrap:!0,children:[s.jsx(le,{placeholder:"System",defaultValue:t==null?void 0:t.system,onChange:o=>n({...t,system:o.currentTarget.value})}),s.jsx(le,{placeholder:"Value",defaultValue:t==null?void 0:t.value,onChange:o=>n({...t,value:o.currentTarget.value})})]})}const jue=["USD","EUR","CAD","GBP","AUD"];function Oue(e){var c;const{onChange:t}=e,[r,n]=f.useState(e.defaultValue),o=f.useCallback(u=>{n(u),t&&t(u)},[t]),i=f.useCallback(u=>{o({...r,currency:u.currentTarget.value})},[r,o]),a=f.useCallback(u=>{o({...r,value:u.currentTarget.valueAsNumber})},[r,o]),l=s.jsx(mt,{defaultValue:r==null?void 0:r.currency,data:jue,styles:{input:{fontWeight:500,borderTopLeftRadius:0,borderBottomLeftRadius:0,width:92}},onChange:i});return s.jsx(le,{type:"number",label:e.label,placeholder:e.placeholder??"Value",defaultValue:((c=r==null?void 0:r.value)==null?void 0:c.toString())??"USD",icon:s.jsx(Xle,{size:14}),rightSection:l,rightSectionWidth:92,onChange:a})}function Cue(e){const[t,r]=f.useState(e.defaultValue);function n(o){r(o),e.onChange&&e.onChange(o)}return s.jsxs(Y,{spacing:"xs",grow:!0,noWrap:!0,children:[s.jsx(aa,{name:e.name+".start",placeholder:"Start",defaultValue:t==null?void 0:t.start,onChange:o=>n({...t,start:o})}),s.jsx(aa,{name:e.name+".end",placeholder:"End",defaultValue:t==null?void 0:t.end,onChange:o=>n({...t,end:o})})]})}function sa(e){const[t,r]=f.useState(e.defaultValue);function n(o){r(o),e.onChange&&e.onChange(o)}return s.jsxs(Y,{spacing:"xs",grow:!0,noWrap:!0,children:[s.jsx(mt,{style:{width:80},"data-testid":e.name+"-comparator",defaultValue:t==null?void 0:t.comparator,data:["","<","<=",">=",">"],onChange:o=>n({...t,comparator:o.currentTarget.value})}),s.jsx(le,{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=>{n({...t,value:Eue(o.currentTarget.value)})}}),s.jsx(le,{placeholder:"Unit","data-testid":e.name+"-unit",defaultValue:t==null?void 0:t.unit,onChange:o=>n({...t,unit:o.currentTarget.value})})]})}function Eue(e){if(e)return parseFloat(e)}function qx(e){const[t,r]=f.useState(e.defaultValue);function n(o){r(o),e.onChange&&e.onChange(o)}return s.jsxs(Y,{spacing:"xs",grow:!0,noWrap:!0,children:[s.jsx(sa,{name:e.name+"-low",defaultValue:t==null?void 0:t.low,onChange:o=>n({...t,low:o})}),s.jsx(sa,{name:e.name+"-high",defaultValue:t==null?void 0:t.high,onChange:o=>n({...t,high:o})})]})}function $ue(e){const[t,r]=f.useState(e.defaultValue);function n(o){r(o),e.onChange&&e.onChange(o)}return s.jsxs(Y,{spacing:"xs",grow:!0,noWrap:!0,children:[s.jsx(sa,{name:e.name+"-numerator",defaultValue:t==null?void 0:t.numerator,onChange:o=>n({...t,numerator:o})}),s.jsx(sa,{name:e.name+"-denominator",defaultValue:t==null?void 0:t.denominator,onChange:o=>n({...t,denominator:o})})]})}const kue={Observation:"code",User:"email:contains"},Rue=["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 Tue(e){return{value:nt(e),label:ko(e),resource:e}}function Vs(e){const t=ae(),{resourceType:r,searchCriteria:n}=e,[o,i]=f.useState(),a=Xe(e.defaultValue,i),l=e.onChange,c=f.useCallback(async(d,p)=>{const h=Due(r),m=new URLSearchParams({[h]:d,_count:"10",...n});return await t.searchResources(r,m,{signal:p})},[t,r,n]),u=f.useCallback(d=>{l&&l(d[0])},[l]);return e.defaultValue&&!o&&!a?null:s.jsx(Lx,{name:e.name,required:e.required,itemComponent:Iue,defaultValue:a,placeholder:e.placeholder,maxSelectedValues:1,toKey:nt,toOption:Tue,loadOptions:c,onChange:u,clearable:!0})}const Iue=f.forwardRef(({label:e,resource:t,...r},n)=>s.jsx("div",{ref:n,...r,children:s.jsxs(Y,{noWrap:!0,children:[s.jsx(Pi,{value:t}),s.jsxs("div",{children:[s.jsx(oe,{children:e}),s.jsx(oe,{size:"xs",color:"dimmed",children:t.birthDate})]})]})}));function Due(e){return kue[e]??(Rue.includes(e)?"name":"_id")}function jm(e){const t=Nue(e.targetTypes),r=Aue(e.defaultValue,t),[n,o]=f.useState(e.defaultValue),[i,a]=f.useState(r);function l(c){o(c),e.onChange&&e.onChange(c)}return s.jsxs(Y,{spacing:"xs",grow:!0,noWrap:!0,children:[t&&t.length>1&&s.jsx(mt,{"data-autofocus":e.autoFocus,"data-testid":"reference-input-resource-type-select",defaultValue:i,autoFocus:e.autoFocus,onChange:c=>a(c.currentTarget.value),data:t}),!t&&s.jsx(Vx,{autoFocus:e.autoFocus,testId:"reference-input-resource-type-input",defaultValue:i,onChange:a,name:e.name+"-resourceType",placeholder:"Resource Type"}),s.jsx(Vs,{resourceType:i,name:e.name+"-id",required:e.required,placeholder:e.placeholder,defaultValue:n,searchCriteria:e.searchCriteria,onChange:c=>{l(c?ht(c):void 0)}})]})}function Nue(e){if(!(!e||e.length===0||e.length===1&&e[0]==="Resource"))return e}function Aue(e,t){var n;const r=(n=e==null?void 0:e.reference)==null?void 0:n.split("/")[0];if(r)return r;if(t&&t.length>0)return t[0]}function Mue(e){const[t,r]=f.useState(e.defaultValue&&Array.isArray(e.defaultValue)?e.defaultValue:[]),n=f.useRef();n.current=t;function o(i){r(i),e.onChange&&e.onChange(i)}return s.jsxs(je,{style:{marginTop:"1rem",marginLeft:"1rem"},children:[t.map((i,a)=>s.jsxs(Y,{noWrap:!0,children:[s.jsx("div",{style:{flexGrow:1},children:s.jsx(la,{arrayElement:!0,property:e.property,name:e.name+"."+a,defaultValue:i,onChange:l=>{const c=[...n.current];c[a]=l,o(c)}})}),s.jsx("div",{children:s.jsx(vr,{title:"Remove",size:"sm",onClick:l=>{ct(l);const c=[...n.current];c.splice(a,1),o(c)},children:s.jsx(dh,{})})})]},`${a}-${t.length}`)),s.jsx(Y,{noWrap:!0,style:{justifyContent:"flex-end"},children:s.jsx("div",{children:s.jsx(vr,{title:"Add",size:"sm",color:"green",onClick:i=>{ct(i);const a=[...n.current];a.push(void 0),o(a)},children:s.jsx(Ix,{})})})})]})}const Lue=["sun","mon","tue","wed","thu","fri","sat"];function zue(e){const[t,r]=f.useState(e.defaultValue),[n,o]=f.useState(!1),i=f.useRef();return i.current=t,s.jsxs(s.Fragment,{children:[s.jsxs(Y,{spacing:"xs",grow:!0,noWrap:!0,children:[s.jsx("span",{children:R5(i.current)||"No repeat"}),s.jsx(re,{onClick:()=>o(!0),children:"Edit"})]}),s.jsx(Fue,{visible:n,defaultValue:i.current,onOk:a=>{e.onChange&&e.onChange(a),r(a),o(!1)},onCancel:()=>o(!1)})]})}const JO={repeat:{period:1,periodUnit:"d"}};function Fue(e){const[t,r]=f.useState(e.defaultValue||JO),n=f.useRef();n.current=t;function o(u){r({...n.current,event:[u]})}function i(u){r({...n.current,repeat:u})}function a(u){var d;i({...(d=n.current)==null?void 0:d.repeat,period:u})}function l(u){var d;i({...(d=n.current)==null?void 0:d.repeat,periodUnit:u})}function c(u){var d;i({...(d=n.current)==null?void 0:d.repeat,dayOfWeek:u})}return s.jsx(Ar,{title:"Timing",closeButtonProps:{"aria-label":"Close"},opened:e.visible,onClose:()=>e.onCancel(),children:s.jsxs(je,{children:[s.jsx(ot,{title:"Starts on",htmlFor:"timing-dialog-start",children:s.jsx(aa,{name:"timing-dialog-start",onChange:u=>o(u)})}),s.jsx(mx,{label:"Repeat",checked:!!t.repeat,onChange:u=>i(u.currentTarget.checked?JO.repeat:void 0)}),t.repeat&&s.jsxs(s.Fragment,{children:[s.jsx(ot,{title:"Repeat every",htmlFor:"timing-dialog-period",children:s.jsxs(Y,{spacing:"xs",grow:!0,noWrap:!0,children:[s.jsx(le,{type:"number",step:1,id:"timing-dialog-period",name:"timing-dialog-period",defaultValue:t.repeat.period||1,onChange:u=>a(parseInt(u.currentTarget.value,10)||1)}),s.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"&&s.jsx(ot,{title:"Repeat on",children:s.jsx(Yf.Group,{multiple:!0,onChange:c,children:s.jsx(Y,{position:"apart",mt:"md",spacing:"xs",children:Lue.map(u=>s.jsx(Yf,{value:u,size:"xs",radius:"xl",children:u.charAt(0).toUpperCase()},u))})})})]}),s.jsx(Y,{position:"right",children:s.jsx(re,{onClick:()=>e.onOk(t),children:"OK"})})]})})}function la(e){const t=e.property,r=e.defaultPropertyType&&e.defaultPropertyType!=="undefined"?e.defaultPropertyType:t.type[0].code,n=e.name,o=e.defaultValue;if(t.max>1&&!e.arrayElement)return r===B.Attachment?s.jsx(iue,{name:n,defaultValue:o,onChange:e.onChange}):s.jsx(Mue,{property:t,name:n,defaultValue:o,onChange:e.onChange});const i=t.type;return i.length>1?s.jsx(Vue,{elementDefinitionTypes:i,...e}):s.jsx(_4,{elementDefinitionType:i[0],...e})}function Vue(e){const t=e.elementDefinitionTypes;let r;e.defaultPropertyType&&(r=t.find(i=>i.code===e.defaultPropertyType)),r||(r=t[0]);const[n,o]=f.useState(r);return s.jsxs(Y,{spacing:"xs",grow:!0,noWrap:!0,children:[s.jsx(mt,{style:{width:"200px"},defaultValue:n.code,onChange:i=>{o(t.find(a=>a.code===i.currentTarget.value))},data:t.map(i=>({value:i.code,label:i.code}))}),s.jsx(_4,{...e,elementDefinitionType:n,onChange:i=>{e.onChange&&e.onChange(i,e.name.replace("[x]",sr(n.code)))}})]})}function _4(e){var a,l,c;const t=e.property,r=e.elementDefinitionType.code,n=e.name,o=e.defaultValue,i=t.min!==void 0&&t.min>0;switch(r){case B.SystemString:case B.canonical:case B.string:case B.time:case B.uri:case B.url:return s.jsx(le,{id:n,name:n,"data-testid":n,defaultValue:o,required:i,onChange:u=>{e.onChange&&e.onChange(u.currentTarget.value)},error:ut(e.outcome,n)});case B.date:return s.jsx(le,{type:"date",id:n,name:n,"data-testid":n,defaultValue:o,required:i,onChange:u=>{e.onChange&&e.onChange(u.currentTarget.value)},error:ut(e.outcome,n)});case B.dateTime:case B.instant:return s.jsx(aa,{name:n,defaultValue:o,onChange:e.onChange,outcome:e.outcome});case B.decimal:case B.integer:case B.positiveInt:case B.unsignedInt:return s.jsx(le,{type:"number",step:r===B.decimal?"any":"1",id:n,name:n,"data-testid":n,defaultValue:o,required:i,onChange:u=>{e.onChange&&e.onChange(u.currentTarget.valueAsNumber)}});case B.code:return s.jsx(d4,{binding:(a=t.binding)==null?void 0:a.valueSet,name:n,defaultValue:o,onChange:e.onChange});case B.boolean:return s.jsx(kn,{id:n,name:n,"data-testid":n,defaultChecked:!!o,onChange:u=>{e.onChange&&e.onChange(u.currentTarget.checked)}});case B.markdown:return s.jsx(Ic,{id:n,name:n,"data-testid":n,defaultValue:o,required:i,onChange:u=>{e.onChange&&e.onChange(u.currentTarget.value)}});case B.Address:return s.jsx(Ele,{name:n,defaultValue:o,onChange:e.onChange});case B.Annotation:return s.jsx($le,{name:n,defaultValue:o,onChange:e.onChange});case B.Attachment:return s.jsx(p4,{name:n,defaultValue:o,onChange:e.onChange});case B.CodeableConcept:return s.jsx(pue,{binding:(l=t.binding)==null?void 0:l.valueSet,name:n,defaultValue:o,onChange:e.onChange});case B.Coding:return s.jsx(x4,{binding:(c=t.binding)==null?void 0:c.valueSet,name:n,defaultValue:o,onChange:e.onChange});case B.ContactDetail:return s.jsx(yue,{name:n,defaultValue:o,onChange:e.onChange});case B.ContactPoint:return s.jsx(w4,{name:n,defaultValue:o,onChange:e.onChange});case B.Extension:return s.jsx(_ue,{name:n,defaultValue:o,onChange:e.onChange});case B.HumanName:return s.jsx(Sue,{name:n,defaultValue:o,onChange:e.onChange});case B.Identifier:return s.jsx(Pue,{name:n,defaultValue:o,onChange:e.onChange});case B.Money:return s.jsx(Oue,{name:n,defaultValue:o,onChange:e.onChange});case B.Period:return s.jsx(Cue,{name:n,defaultValue:o,onChange:e.onChange});case B.Duration:case B.Quantity:return s.jsx(sa,{name:n,defaultValue:o,onChange:e.onChange});case B.Range:return s.jsx(qx,{name:n,defaultValue:o,onChange:e.onChange});case B.Ratio:return s.jsx($ue,{name:n,defaultValue:o,onChange:e.onChange});case B.Reference:return s.jsx(jm,{name:n,defaultValue:o,targetTypes:Bue(t),onChange:e.onChange});case B.Timing:return s.jsx(zue,{name:n,defaultValue:o,onChange:e.onChange});case B.Dosage:case B.UsageContext:return s.jsx(vy,{typeName:r,defaultValue:o,onChange:e.onChange,outcome:e.outcome});default:return s.jsx(vy,{typeName:t.type[0].code,defaultValue:o,onChange:e.onChange,outcome:e.outcome})}}function Bue(e){var t,r,n;return(n=(r=(t=e==null?void 0:e.type)==null?void 0:t[0])==null?void 0:r.targetProfile)==null?void 0:n.map(o=>o.split("/").pop())}function vy(e){const[t,r]=f.useState(e.defaultValue??{});function n(l){r(l),e.onChange&&e.onChange(l)}const o=e.typeName,i=bx(o);if(!i)return s.jsxs("div",{children:[o," not implemented"]});const a={type:o,value:t};return s.jsx(je,{children:Object.entries(i.elements).map(([l,c])=>{if(l==="id"||h4.includes(l)||m4.includes(l)&&c.path.split(".").length===2||!c.type)return null;const[u,d]=Bc(a,l),p=c.min!==void 0&&c.min>0;return c.type.length===1&&c.type[0].code==="boolean"?s.jsx(v4,{title:dy(l),description:c.description,htmlFor:l,children:s.jsx(la,{property:c,name:l,defaultValue:u,defaultPropertyType:d,outcome:e.outcome,onChange:(h,m)=>{n(gy(t,l,m??l,c,h))}})},l):s.jsx(ot,{title:dy(l),description:c.description,withAsterisk:p,htmlFor:l,outcome:e.outcome,children:s.jsx(la,{property:c,name:l,defaultValue:u,defaultPropertyType:d,onChange:(h,m)=>{n(gy(t,l,m??l,c,h))}})},l)})})}const Uue=W(()=>({root:{"@media (max-width: 800px)":{paddingLeft:4,paddingRight:4}}}));function Uc(e){const{children:t,...r}=e,{classes:n}=Uue();return s.jsx(dI,{className:n.root,...r,children:t})}const Wue=W(e=>({noteBody:{fontSize:e.fontSizes.sm},noteCite:{fontSize:e.fontSizes.xs,marginBlockStart:3},noteRoot:{padding:5}}));function S4({value:e}){const{classes:t}=Wue();return e?s.jsx(je,{justify:"flex-start",spacing:"xs",children:e.map(r=>{var n;return r.text&&s.jsx(DT,{classNames:{cite:t.noteCite,body:t.noteBody,root:t.noteRoot},cite:((n=r.authorReference)==null?void 0:n.display)||r.authorString,icon:null,children:r.text},`note-${r.text}`)})}):null}function Wc(e){const{value:t,link:r,...n}=e,[o,i]=f.useState(),a=Xe(t,i);let l;if(o&&!U5(o))l=`[${Oe(o)}]`;else if(a)l=ko(a);else return null;return r?s.jsx($e,{to:t,...n,children:l}):s.jsx(oe,{component:"span",...n,children:l})}function ds(e){return s.jsxs(Y,{spacing:"xs",children:[s.jsx(Pi,{size:24,radius:12,value:e.value,link:e.link}),s.jsx(Wc,{value:e.value,link:e.link})]})}const Hue={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"};function P4(e){return s.jsx(dq,{color:Hue[e.status],children:e.status})}const j4=W(e=>({table:{border:`0.1px solid ${e.colors.gray[5]}`,borderCollapse:"collapse","& td, & th":{border:`0.1px solid ${e.colors.gray[5]}`,padding:4}},criticalRow:{background:e.colorScheme==="dark"?e.colors.red[7]:e.colors.red[1],border:`0.1px solid ${e.colors.red[5]}`,color:e.colors.red[5],fontWeight:500,"& td":{border:`0.1px solid ${e.colors.red[5]}`}},noteBody:{fontSize:e.fontSizes.sm},noteCite:{fontSize:e.fontSizes.xs,marginBlockStart:3},noteRoot:{padding:5}}));Gx.defaultProps={hideObservationNotes:!1,hideSpecimenInfo:!1};function Gx(e){var a;const t=ae(),r=Xe(e.value),[n,o]=f.useState();if(f.useEffect(()=>{r!=null&&r.specimen&&Promise.allSettled(r.specimen.map(l=>t.readReference(l))).then(l=>l.filter(c=>c.status==="fulfilled").map(c=>c.value)).then(o).catch(console.error)},[t,r]),!r)return null;const i=(n==null?void 0:n.flatMap(l=>l.note||[]))||[];if(r.presentedForm&&r.presentedForm.length>0){const l=r.presentedForm[0];(a=l.contentType)!=null&&a.startsWith("text/plain")&&l.data&&i.push({text:window.atob(l.data)})}return s.jsxs(je,{children:[s.jsx(ue,{children:"Diagnostic Report"}),s.jsx(que,{value:r}),n&&!e.hideSpecimenInfo&&Gue(n),r.result&&s.jsx(Que,{hideObservationNotes:e.hideObservationNotes,value:r.result}),i.length>0&&s.jsx(S4,{value:i})]})}function que({value:e}){var t,r;return s.jsxs(Y,{mt:"md",spacing:30,children:[e.subject&&s.jsxs("div",{children:[s.jsx(oe,{size:"xs",transform:"uppercase",color:"dimmed",children:"Subject"}),s.jsx(oe,{children:s.jsx(ds,{value:e.subject,link:!0})})]}),(t=e.resultsInterpreter)==null?void 0:t.map(n=>s.jsxs("div",{children:[s.jsx(oe,{size:"xs",transform:"uppercase",color:"dimmed",children:"Interpreter"}),s.jsx(oe,{children:s.jsx(ds,{value:n,link:!0})})]},n.reference)),(r=e.performer)==null?void 0:r.map(n=>s.jsxs("div",{children:[s.jsx(oe,{size:"xs",transform:"uppercase",color:"dimmed",children:"Performer"}),s.jsx(oe,{children:s.jsx(ds,{value:n,link:!0})})]},n.reference)),e.issued&&s.jsxs("div",{children:[s.jsx(oe,{size:"xs",transform:"uppercase",color:"dimmed",children:"Issued"}),s.jsx(oe,{children:Dr(e.issued)})]}),e.status&&s.jsxs("div",{children:[s.jsx(oe,{size:"xs",transform:"uppercase",color:"dimmed",children:"Status"}),s.jsx(oe,{children:sr(e.status)})]})]})}function Gue(e){return s.jsxs(je,{spacing:"xs",children:[s.jsx(ue,{order:2,size:"h6",children:"Specimens"}),s.jsx(Cr,{type:"ordered",children:e==null?void 0:e.map(t=>{var r;return s.jsx(Cr.Item,{ml:"sm",children:s.jsxs(Y,{spacing:20,children:[s.jsxs(Y,{spacing:5,children:[s.jsx(oe,{fw:500,children:"Collected:"})," ",Dr((r=t.collection)==null?void 0:r.collectedDateTime)]}),s.jsxs(Y,{spacing:5,children:[s.jsx(oe,{fw:500,children:"Received:"})," ",Dr(t.receivedTime)]})]})},`specimen-${t.id}`)})})]})}function Que(e){const{classes:t}=j4();return s.jsxs("table",{className:t.table,children:[s.jsx("thead",{children:s.jsxs("tr",{children:[s.jsx("th",{children:"Test"}),s.jsx("th",{children:"Value"}),s.jsx("th",{children:"Reference Range"}),s.jsx("th",{children:"Interpretation"}),s.jsx("th",{children:"Category"}),s.jsx("th",{children:"Performer"}),s.jsx("th",{children:"Status"})]})}),s.jsx("tbody",{children:s.jsx(O4,{value:e.value,ancestorIds:e.ancestorIds,hideObservationNotes:e.hideObservationNotes})})]})}function O4(e){var t;return s.jsx(s.Fragment,{children:(t=e.value)==null?void 0:t.map(r=>s.jsx(Kue,{value:r,ancestorIds:e.ancestorIds,hideObservationNotes:e.hideObservationNotes},`obs-${Pa(r)?r.reference:r.id}`))})}function Kue(e){var a,l;const{classes:t,cx:r}=j4(),n=Xe(e.value);if(!n||(a=e.ancestorIds)!=null&&a.includes(n.id))return null;const o=!e.hideObservationNotes&&n.note,i=Jue(n);return s.jsxs(s.Fragment,{children:[s.jsxs("tr",{className:r({[t.criticalRow]:i}),children:[s.jsx("td",{rowSpan:o?2:1,children:s.jsx($e,{to:n,children:s.jsx(eo,{value:n.code})})}),s.jsx("td",{children:s.jsx(Yue,{value:n})}),s.jsx("td",{children:s.jsx(Xue,{value:n.referenceRange})}),s.jsx("td",{children:n.interpretation&&n.interpretation.length>0&&s.jsx(eo,{value:n.interpretation[0]})}),s.jsx("td",{children:n.category&&n.category.length>0&&s.jsx(s.Fragment,{children:n.category.map(c=>s.jsx("div",{children:s.jsx(eo,{value:c})},`category-${js(c)}`))})}),s.jsx("td",{children:(l=n.performer)==null?void 0:l.map(c=>s.jsx(ph,{value:c},c.reference))}),s.jsx("td",{children:n.status&&s.jsx(P4,{status:n.status})})]}),n.hasMember&&s.jsx(O4,{value:n.hasMember,ancestorIds:e.ancestorIds?[...e.ancestorIds,n.id]:[n.id],hideObservationNotes:e.hideObservationNotes}),o&&s.jsx("tr",{children:s.jsx("td",{colSpan:6,children:s.jsx(S4,{value:n.note})})})]})}function Yue(e){const t=e.value;return s.jsx(s.Fragment,{children:T5(t)})}function Xue(e){const t=e.value&&e.value.length>0&&e.value[0];return t?t.text?s.jsx(s.Fragment,{children:t.text}):s.jsx(Wx,{value:t}):null}function Jue(e){var r,n,o,i;const t=(i=(o=(n=(r=e.interpretation)==null?void 0:r[0])==null?void 0:n.coding)==null?void 0:o[0])==null?void 0:i.code;return t==="AA"||t==="LL"||t==="HH"||t==="A"}const Zue=W((e,{width:t,fill:r})=>({paper:{maxWidth:t,margin:`${e.spacing.xl} auto`,padding:r?0:e.spacing.md,"@media (max-width: 800px)":{padding:r?0:8},"& img":{width:"100%",maxWidth:"100%"},"& video":{width:"100%",maxWidth:"100%"}}})),ede={shadow:"xs",radius:"md",withBorder:!0};function Qx(e){const{className:t,children:r,width:n,fill:o,unstyled:i,...a}=H("Panel",ede,e),{classes:l,cx:c}=Zue({width:n,fill:o},{name:"Panel",unstyled:i});return s.jsx(un,{className:c(l.paper,t),...a,children:r})}var C4={},Hc={};Object.defineProperty(Hc,"__esModule",{value:!0});Hc.Pointer=void 0;function tde(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function rde(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}var nde=function(){function e(t){t===void 0&&(t=[""]),this.tokens=t}return e.fromJSON=function(t){var r=t.split("/").map(tde);if(r[0]!=="")throw new Error("Invalid JSON Pointer: ".concat(t));return new e(r)},e.prototype.toString=function(){return this.tokens.map(rde).join("/")},e.prototype.evaluate=function(t){for(var r=null,n="",o=t,i=1,a=this.tokens.length;i<a;i++)r=o,n=this.tokens[i],!(n=="__proto__"||n=="constructor"||n=="prototype")&&(o=(r||{})[n]);return{parent:r,key:n,value:o}},e.prototype.get=function(t){return this.evaluate(t).value},e.prototype.set=function(t,r){var n=this.evaluate(t);n.parent&&(n.parent[n.key]=r)},e.prototype.push=function(t){this.tokens.push(t)},e.prototype.add=function(t){var r=this.tokens.concat(String(t));return new e(r)},e}();Hc.Pointer=nde;var _t={},Kx={};(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 r(o){return o!=null&&typeof o=="object"}function n(o){if(!r(o))return o;if(o.constructor==Array){for(var i=o.length,a=new Array(i),l=0;l<i;l++)a[l]=n(o[l]);return a}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]=n(o[d]));return u}e.clone=n})(Kx);var mr={};Object.defineProperty(mr,"__esModule",{value:!0});mr.diffAny=mr.diffObjects=mr.diffArrays=mr.intersection=mr.subtract=mr.isDestructive=void 0;var gc=Kx;function ode(e){var t=e.op;return t==="remove"||t==="replace"||t==="copy"||t==="move"}mr.isDestructive=ode;function yy(e,t){var r={};for(var n in e)gc.hasOwnProperty.call(e,n)&&e[n]!==void 0&&(r[n]=1);for(var o in t)gc.hasOwnProperty.call(t,o)&&t[o]!==void 0&&delete r[o];return Object.keys(r)}mr.subtract=yy;function E4(e){for(var t=e.length,r={},n=0;n<t;n++){var o=e[n];for(var i in o)gc.hasOwnProperty.call(o,i)&&o[i]!==void 0&&(r[i]=(r[i]||0)+1)}for(var i in r)r[i]<t&&delete r[i];return Object.keys(r)}mr.intersection=E4;function ide(e){return e.op==="add"}function ade(e){return e.op==="remove"}function Fg(e,t){return{operations:e.operations.concat(t),cost:e.cost+1}}function $4(e,t,r,n){n===void 0&&(n=Om);var o={"0,0":{operations:[],cost:0}};function i(d,p){var h="".concat(d,",").concat(p),m=o[h];if(m===void 0){if(d>0&&p>0&&!n(e[d-1],t[p-1],r.add(String(d-1))).length)m=i(d-1,p-1);else{var g=[];if(d>0){var v=i(d-1,p),_={op:"remove",index:d-1};g.push(Fg(v,_))}if(p>0){var y=i(d,p-1),x={op:"add",index:d-1,value:t[p-1]};g.push(Fg(y,x))}if(d>0&&p>0){var w=i(d-1,p-1),b={op:"replace",index:d-1,original:e[d-1],value:t[p-1]};g.push(Fg(w,b))}var C=g.sort(function(O,P){return O.cost-P.cost})[0];m=C}o[h]=m}return m}var a=isNaN(e.length)||e.length<=0?0:e.length,l=isNaN(t.length)||t.length<=0?0:t.length,c=i(a,l).operations,u=c.reduce(function(d,p){var h=d[0],m=d[1];if(ide(p)){var g=p.index+1+m,v=g<a+m?String(g):"-",_={op:p.op,path:r.add(v).toString(),value:p.value};return[h.concat(_),m+1]}else if(ade(p)){var _={op:p.op,path:r.add(String(p.index+m)).toString()};return[h.concat(_),m-1]}else{var y=r.add(String(p.index+m)),x=n(p.original,p.value,y);return[h.concat.apply(h,x),m]}},[[],0])[0];return u}mr.diffArrays=$4;function k4(e,t,r,n){n===void 0&&(n=Om);var o=[];return yy(e,t).forEach(function(i){o.push({op:"remove",path:r.add(i).toString()})}),yy(t,e).forEach(function(i){o.push({op:"add",path:r.add(i).toString(),value:t[i]})}),E4([e,t]).forEach(function(i){o.push.apply(o,n(e[i],t[i],r.add(i)))}),o}mr.diffObjects=k4;function Om(e,t,r,n){if(n===void 0&&(n=Om),e===t)return[];var o=(0,gc.objectType)(e),i=(0,gc.objectType)(t);return o=="array"&&i=="array"?$4(e,t,r,n):o=="object"&&i=="object"?k4(e,t,r,n):[{op:"replace",path:r.toString(),value:t}]}mr.diffAny=Om;var Yx=g1&&g1.__extends||function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,o){n.__proto__=o}||function(n,o){for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&(n[i]=o[i])},e(t,r)};return function(t,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");e(t,r);function n(){this.constructor=t}t.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(_t,"__esModule",{value:!0});_t.apply=_t.InvalidOperationError=_t.test=_t.copy=_t.move=_t.replace=_t.remove=_t.add=_t.TestError=_t.MissingError=void 0;var Io=Hc,Xx=Kx,sde=mr,to=function(e){Yx(t,e);function t(r){var n=e.call(this,"Value required at path: ".concat(r))||this;return n.path=r,n.name="MissingError",n}return t}(Error);_t.MissingError=to;var R4=function(e){Yx(t,e);function t(r,n){var o=e.call(this,"Test failed: ".concat(r," != ").concat(n))||this;return o.actual=r,o.expected=n,o.name="TestError",o}return t}(Error);_t.TestError=R4;function Jx(e,t,r){if(Array.isArray(e))if(t=="-")e.push(r);else{var n=parseInt(t,10);e.splice(n,0,r)}else e[t]=r}function T4(e,t){if(Array.isArray(e)){var r=parseInt(t,10);e.splice(r,1)}else delete e[t]}function I4(e,t){var r=Io.Pointer.fromJSON(t.path).evaluate(e);return r.parent===void 0?new to(t.path):(Jx(r.parent,r.key,(0,Xx.clone)(t.value)),null)}_t.add=I4;function D4(e,t){var r=Io.Pointer.fromJSON(t.path).evaluate(e);return r.value===void 0?new to(t.path):(T4(r.parent,r.key),null)}_t.remove=D4;function N4(e,t){var r=Io.Pointer.fromJSON(t.path).evaluate(e);if(r.parent===null)return new to(t.path);if(Array.isArray(r.parent)){if(parseInt(r.key,10)>=r.parent.length)return new to(t.path)}else if(r.value===void 0)return new to(t.path);return r.parent[r.key]=(0,Xx.clone)(t.value),null}_t.replace=N4;function A4(e,t){var r=Io.Pointer.fromJSON(t.from).evaluate(e);if(r.value===void 0)return new to(t.from);var n=Io.Pointer.fromJSON(t.path).evaluate(e);return n.parent===void 0?new to(t.path):(T4(r.parent,r.key),Jx(n.parent,n.key,r.value),null)}_t.move=A4;function M4(e,t){var r=Io.Pointer.fromJSON(t.from).evaluate(e);if(r.value===void 0)return new to(t.from);var n=Io.Pointer.fromJSON(t.path).evaluate(e);return n.parent===void 0?new to(t.path):(Jx(n.parent,n.key,(0,Xx.clone)(r.value)),null)}_t.copy=M4;function L4(e,t){var r=Io.Pointer.fromJSON(t.path).evaluate(e);return(0,sde.diffAny)(r.value,t.value,new Io.Pointer).length?new R4(r.value,t.value):null}_t.test=L4;var z4=function(e){Yx(t,e);function t(r){var n=e.call(this,"Invalid operation: ".concat(r.op))||this;return n.operation=r,n.name="InvalidOperationError",n}return t}(Error);_t.InvalidOperationError=z4;function lde(e,t){switch(t.op){case"add":return I4(e,t);case"remove":return D4(e,t);case"replace":return N4(e,t);case"move":return A4(e,t);case"copy":return M4(e,t);case"test":return L4(e,t)}return new z4(t)}_t.apply=lde;(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.createTests=e.createPatch=e.applyPatch=e.Pointer=void 0;var t=Hc;Object.defineProperty(e,"Pointer",{enumerable:!0,get:function(){return t.Pointer}});var r=_t,n=mr;function o(u,d){return d.map(function(p){return(0,r.apply)(u,p)})}e.applyPatch=o;function i(u){function d(p,h,m){var g=u(p,h,m);return Array.isArray(g)?g:(0,n.diffAny)(p,h,m,d)}return d}function a(u,d,p){var h=new t.Pointer;return(p?i(p):n.diffAny)(u,d,h)}e.createPatch=a;function l(u,d){var p=t.Pointer.fromJSON(d).evaluate(u);if(p!==void 0)return{op:"test",path:d,value:p.value}}function c(u,d){var p=new Array;return d.filter(n.isDestructive).forEach(function(h){var m=l(u,h.path);if(m&&p.push(m),"from"in h){var g=l(u,h.from);g&&p.push(g)}}),p}e.createTests=c})(C4);const cde=W(e=>({root:{borderCollapse:"collapse",width:"100%","& tr":{borderTop:`0.1px solid ${e.colors.gray[3]}`},"& th, & td":{padding:`${e.spacing.sm} ${e.spacing.sm}`,verticalAlign:"top"}},removed:{color:e.colors.red[7],fontFamily:"monospace",textDecoration:"line-through",whiteSpace:"pre-wrap"},added:{color:e.colors.green[7],fontFamily:"monospace",whiteSpace:"pre-wrap"}}));function ude(e){const{classes:t}=cde(),r=ae(),[n,o]=f.useState(!1);if(f.useEffect(()=>{r.requestSchema(e.original.resourceType).then(()=>o(!0)).catch(console.log)},[r,e.original.resourceType]),!n)return null;const i=C4.createPatch(e.original,e.revised),a=[no(e.original)],l=[no(e.revised)];return s.jsxs("table",{className:t.root,children:[s.jsx("thead",{children:s.jsxs("tr",{children:[s.jsx("th",{}),s.jsx("th",{children:"Before"}),s.jsx("th",{children:"After"})]})}),s.jsx("tbody",{children:i.map(c=>{var _,y,x;if(c.path.startsWith("/meta"))return null;const u=c.path,d=dde(u),p=ym(e.original.resourceType,{resourceType:"SearchParameter",base:[e.original.resourceType],code:e.original.resourceType+"."+d,expression:e.original.resourceType+"."+d}),h=(_=p==null?void 0:p.elementDefinitions)==null?void 0:_[0],m=!!(h!=null&&h.isArray),g=c.op==="add"||(y=hc(d,a))==null?void 0:y[0],v=c.op==="remove"||(x=hc(d,l))==null?void 0:x[0];return s.jsxs("tr",{children:[s.jsxs("td",{children:[sr(c.op)," ",d]}),s.jsx("td",{className:t.removed,children:g&&s.jsx(To,{property:h,propertyType:g.type,value:ZO(g.value,m),ignoreMissingValues:!0})}),s.jsx("td",{className:t.added,children:v&&s.jsx(To,{property:h,propertyType:v.type,value:ZO(v.value,m),ignoreMissingValues:!0})})]},`op-${c.op}-${c.path}`)})})]})}function dde(e){const t=e.split("/").filter(Boolean);let r="";for(let n=0;n<t.length;n++){const o=t[n];o==="-"?r+=".last()":/^\d+$/.test(o)?r+=`[${o}]`:(n>0&&(r+="."),r+=o)}return r}function ZO(e,t){return Array.isArray(e)&&!t?e[0]:!Array.isArray(e)&&t?[e]:e}function Zx(e){const t=ae(),r=Xe(e.value),[n,o]=f.useState(!1);return f.useEffect(()=>{r&&t.requestSchema(r.resourceType).then(()=>o(!0)).catch(console.log)},[t,r]),!n||!r?null:s.jsx(my,{value:{type:r.resourceType,value:e.forceUseInput?e.value:r},ignoreMissingValues:e.ignoreMissingValues})}function fde(e){return s.jsx(Uc,{children:e.children})}function ca(e){var c,u;const{resource:t,profile:r,padding:n,popupMenuItems:o,...i}=e,a=r??((c=t.meta)==null?void 0:c.author),l=e.dateTime??((u=t.meta)==null?void 0:u.lastUpdated);return s.jsxs(Qx,{"data-testid":"timeline-item",fill:!0,...i,children:[s.jsxs(Y,{position:"apart",spacing:8,mx:"xs",my:"sm",children:[s.jsx(Pi,{value:a,link:!0,size:"md"}),s.jsxs("div",{style:{flex:1},children:[s.jsx(oe,{size:"sm",children:s.jsx(Wc,{color:"dark",weight:500,value:a,link:!0})}),s.jsxs(oe,{size:"xs",children:[s.jsx($e,{color:"dimmed",to:e.resource,children:Dr(l)}),s.jsx(oe,{component:"span",color:"dimmed",mx:8,children:"·"}),s.jsx($e,{color:"dimmed",to:e.resource,children:e.resource.resourceType})]})]}),o&&s.jsxs(J,{position:"bottom-end",shadow:"md",width:200,children:[s.jsx(J.Target,{children:s.jsx(vr,{radius:"xl","aria-label":`Actions for ${nt(e.resource)}`,children:s.jsx(Zle,{})})}),o]})]}),s.jsxs(c4,{children:[n&&s.jsx("div",{style:{padding:"0 16px 16px 16px"},children:e.children}),!n&&s.jsx(s.Fragment,{children:e.children})]})]})}function F4(e,t){e.sort((r,n)=>{const o=eC(r,t),i=eC(n,t);return o>i?1:o<i?-1:tC(r,t)-tC(n,t)})}function eC(e,t){if(!V4(e,t)){const r=e.priority;if(typeof r=="string")return{stat:4,asap:3,urgent:2}[r]??0}return 0}function tC(e,t){var n;if(!V4(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 r=(n=e.meta)==null?void 0:n.lastUpdated;return r?new Date(r).getTime():0}function V4(e,t){return!!t&&e.resourceType===t.resourceType&&e.id===t.id}const pde=W(e=>({pinnedComment:{backgroundColor:e.colors.blue[0]}}));function Cm(e){const t=ae(),r=wm(),n=t.getProfile(),o=f.useRef(null),i=Xe(e.value),[a,l]=f.useState(),[c,u]=f.useState([]),d=e.loadTimelineResources,p=f.useRef(c);p.current=c;const h=f.useCallback(T=>{F4(T,i),T.reverse(),u(T)},[i]),m=f.useCallback(T=>{const N=[];for(const A of T){if(A.status!=="fulfilled")continue;const z=A.value;if(z.type==="history"&&l(z),z.entry)for(const G of z.entry)N.push(G.resource)}h(N)},[h]),g=f.useCallback(T=>h([...p.current,T]),[h]),v=f.useCallback(()=>{var A;let T,N;"resourceType"in e.value?(T=e.value.resourceType,N=e.value.id):[T,N]=(A=e.value.reference)==null?void 0:A.split("/"),d(t,T,N).then(m).catch(console.log)},[t,e.value,d,m]);f.useEffect(()=>v(),[v]);function _(T){!i||!e.createCommunication||t.createResource(e.createCommunication(i,n,T)).then(N=>g(N)).catch(console.log)}function y(T){!i||!e.createMedia||t.createResource(e.createMedia(i,n,T)).then(N=>g(N)).then(()=>Ol({id:"upload-notification",color:"teal",title:"Upload complete",message:"",icon:s.jsx(_m,{size:16}),autoClose:2e3})).catch(N=>Ol({id:"upload-notification",color:"red",title:"Upload error",message:Oe(N),icon:s.jsx(GO,{size:16}),autoClose:2e3}))}function x(T,N){return t.updateResource({...T,priority:N})}function w(T){x(T,"stat").then(v).catch(console.log)}function b(T){x(T,"routine").then(v).catch(console.log)}function C(T){r(`/${T.resourceType}/${T.id}`)}function O(T){r(`/${T.resourceType}/${T.id}/edit`)}function P(T){r(`/${T.resourceType}/${T.id}/delete`)}function E(T){var N;r(`/${T.resourceType}/${T.id}/_history/${(N=T.meta)==null?void 0:N.versionId}`)}function $(){pe({id:"upload-notification",loading:!0,title:"Initializing upload...",message:"Please wait...",autoClose:!1,withCloseButton:!1})}function k(T){Ol({id:"upload-notification",loading:!0,title:"Uploading...",message:wde(T),autoClose:!1,withCloseButton:!1})}function I(T){Ol({id:"upload-notification",color:"red",title:"Upload error",message:Oe(T),icon:s.jsx(GO,{size:16}),autoClose:2e3})}return i?s.jsxs(fde,{children:[e.createCommunication&&s.jsx(Qx,{children:s.jsx(De,{testid:"timeline-form",onSubmit:T=>{_(T.text);const N=o.current;N&&(N.value="",N.focus())},children:s.jsxs(Y,{spacing:"xs",noWrap:!0,style:{width:"100%"},children:[s.jsx(Pi,{value:n}),s.jsx(le,{name:"text",ref:o,placeholder:"Add comment",style:{width:"100%",maxWidth:300}}),s.jsx(vr,{type:"submit",radius:"xl",color:"blue",variant:"filled",children:s.jsx(cce,{size:16})}),s.jsx(Bx,{onUpload:y,onUploadStart:$,onUploadProgress:k,onUploadError:I,children:T=>s.jsx(vr,{...T,radius:"xl",color:"blue",variant:"filled",children:s.jsx(Dx,{size:16})})})]})})}),c.map(T=>{var A;if(!T)return null;const N=`${T.resourceType}/${T.id}/${(A=T.meta)==null?void 0:A.versionId}`;if(T.resourceType===i.resourceType&&T.id===i.id)return s.jsx(hde,{history:a,resource:T,onDetails:E},N);switch(T.resourceType){case"AuditEvent":return s.jsx(yde,{resource:T,onDetails:C},N);case"Communication":return s.jsx(gde,{resource:T,onPin:T.priority!=="stat"?w:void 0,onUnpin:T.priority==="stat"?b:void 0,onDetails:C,onEdit:O,onDelete:P},N);case"DiagnosticReport":return s.jsx(xde,{resource:T,onDetails:C,onEdit:O,onDelete:P},N);case"Media":return s.jsx(vde,{resource:T,onDetails:C,onEdit:O,onDelete:P},N);default:return s.jsx(ca,{resource:T,padding:!0,children:s.jsx(Zx,{value:T,ignoreMissingValues:!0})},N)}})]}):s.jsx(or,{style:{width:"100%",height:"100%"},children:s.jsx(hn,{})})}function Cs(e){return s.jsxs(J.Dropdown,{children:[s.jsx(J.Label,{children:"Resource"}),e.onPin&&s.jsx(J.Item,{icon:s.jsx(fce,{size:14}),onClick:()=>e.onPin(e.resource),"aria-label":`Pin ${nt(e.resource)}`,children:"Pin"}),e.onUnpin&&s.jsx(J.Item,{icon:s.jsx(pce,{size:14}),onClick:()=>e.onUnpin(e.resource),"aria-label":`Unpin ${nt(e.resource)}`,children:"Unpin"}),e.onDetails&&s.jsx(J.Item,{icon:s.jsx(ice,{size:14}),onClick:()=>e.onDetails(e.resource),"aria-label":`Details ${nt(e.resource)}`,children:"Details"}),e.onEdit&&s.jsx(J.Item,{icon:s.jsx(ece,{size:14}),onClick:()=>e.onEdit(e.resource),"aria-label":`Edit ${nt(e.resource)}`,children:"Edit"}),e.onDelete&&s.jsxs(s.Fragment,{children:[s.jsx(J.Divider,{}),s.jsx(J.Label,{children:"Danger zone"}),s.jsx(J.Item,{color:"red",icon:s.jsx(l4,{size:14}),onClick:()=>e.onDelete(e.resource),"aria-label":`Delete ${nt(e.resource)}`,children:"Delete"})]})]})}function hde(e){const t=mde(e.history,e.resource);return t?s.jsx(ca,{resource:e.resource,padding:!0,popupMenuItems:s.jsx(Cs,{...e}),children:s.jsx(ude,{original:t,revised:e.resource})}):s.jsxs(ca,{resource:e.resource,padding:!0,popupMenuItems:s.jsx(Cs,{...e}),children:[s.jsx("h3",{children:"Created"}),s.jsx(Zx,{value:e.resource,ignoreMissingValues:!0,forceUseInput:!0})]})}function mde(e,t){const r=e.entry,n=r.findIndex(o=>{var i,a,l;return((a=(i=o.resource)==null?void 0:i.meta)==null?void 0:a.versionId)===((l=t.meta)==null?void 0:l.versionId)});if(!(n>=r.length-1))return r[n+1].resource}function gde(e){var o,i;const{classes:t}=pde(),n=!e.resource.priority||e.resource.priority==="routine"?void 0:t.pinnedComment;return s.jsx(ca,{resource:e.resource,profile:e.resource.sender,dateTime:e.resource.sent,padding:!0,className:n,popupMenuItems:s.jsx(Cs,{...e}),children:s.jsx("p",{children:(i=(o=e.resource.payload)==null?void 0:o[0])==null?void 0:i.contentString})})}function vde(e){var n;const t=(n=e.resource.content)==null?void 0:n.contentType,r=t&&!t.startsWith("image/")&&!t.startsWith("video/")&&t!=="application/pdf";return s.jsx(ca,{resource:e.resource,padding:!!r,popupMenuItems:s.jsx(Cs,{...e}),children:s.jsx(Vc,{value:e.resource.content})})}function yde(e){return s.jsx(ca,{resource:e.resource,padding:!0,popupMenuItems:s.jsx(Cs,{...e}),children:s.jsx(ma,{children:s.jsx("pre",{children:e.resource.outcomeDesc})})})}function xde(e){return s.jsx(ca,{resource:e.resource,padding:!0,popupMenuItems:s.jsx(Cs,{...e}),children:s.jsx(Gx,{value:e.resource})})}function wde(e){if(e.lengthComputable){const t=100*e.loaded/e.total;return`Uploaded: ${Vg(e.loaded)} / ${Vg(e.total)} ${t.toFixed(2)}%`}return`Uploaded: ${Vg(e.loaded)}`}function Vg(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 bde(e){return s.jsx(Cm,{value:e.resource,loadTimelineResources:async(t,r,n)=>{const o=`${r}/${n}`,i=100;return Promise.allSettled([t.readHistory(r,n),t.search("Task",{_filter:`based-on eq ${o} or focus eq ${o} or subject eq ${o}`,_count:i})])}})}function be(e){const{children:t,...r}=e;return s.jsx(Uc,{children:s.jsx(Qx,{...r,children:t})})}function _de(e){return s.jsx(Cm,{value:e.encounter,loadTimelineResources:async(t,r,n)=>Promise.allSettled([t.readHistory("Encounter",n),t.search("Communication","encounter=Encounter/"+n),t.search("Media","encounter=Encounter/"+n)]),createCommunication:(t,r,n)=>({resourceType:"Communication",status:"completed",encounter:ht(t),subject:t.subject,sender:ht(r),sent:new Date().toISOString(),payload:[{contentString:n}]}),createMedia:(t,r,n)=>({resourceType:"Media",status:"completed",encounter:ht(t),subject:t.subject,operator:ht(r),issued:new Date().toISOString(),content:n})})}function Sde(e){let t;try{t=Ese(e.path,e.resource)}catch(r){return console.warn("FhirPathDisplay:",r),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 s.jsx(To,{value:t[0]||"",propertyType:e.propertyType})}function Pde(e){return s.jsxs(Ar,{title:"Export",closeButtonProps:{"aria-label":"Close"},opened:e.visible,onClose:e.onCancel,children:[s.jsxs(ie,{display:"flex",sx:{justifyContent:"space-between"},children:[e.exportCsv&&s.jsx(rC,{text:"CSV",exportLogic:e.exportCsv,onCancel:e.onCancel}),e.exportTransactionBundle&&s.jsx(rC,{text:"Transaction Bundle",exportLogic:e.exportTransactionBundle,onCancel:e.onCancel})]}),s.jsx(oe,{sx:{marginTop:"10px",marginLeft:"2px"},children:"Limited to 1000 records"})]})}function rC(e){return s.jsx(re,{onClick:()=>{e.exportLogic(),e.onCancel()},children:`Export as ${e.text}`})}const jde={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]},Ode={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 e1(e,t){return{...e,filters:t,offset:0,name:void 0}}function t1(e,t){return e1(e,(e.filters??[]).filter(r=>r.code!==t))}function Em(e,t,r,n,o){o&&(e=t1(e,t));const i=[];return e.filters&&i.push(...e.filters),i.push({code:t,operator:r,value:n??""}),e1(e,i)}function Cde(e,t){if(!e.filters)return e;const r=[...e.filters];return r.splice(t,1),{...e,filters:r,name:void 0}}function Ede(e,t){return r1(e,t,-1)}function $de(e,t){return r1(e,t,0)}function kde(e,t){return r1(e,t,1)}function r1(e,t,r){const n=new Date;n.setDate(n.getDate()+r),n.setHours(0,0,0,0);const o=new Date(n.getTime());return o.setDate(o.getDate()+1),o.setTime(o.getTime()-1),o1(e,t,n,o)}function Rde(e,t){return n1(e,t,-1)}function Tde(e,t){return n1(e,t,0)}function Ide(e,t){return n1(e,t,1)}function n1(e,t,r){const n=new Date;n.setMonth(n.getMonth()+r),n.setDate(1),n.setHours(0,0,0,0);const o=new Date(n.getTime());return o.setMonth(o.getMonth()+1),o.setDate(1),o.setHours(0,0,0,0),o.setTime(o.getTime()-1),o1(e,t,n,o)}function Dde(e,t){const r=new Date;return r.setMonth(0),r.setDate(1),r.setHours(0,0,0,0),o1(e,t,r,new Date)}function o1(e,t,r,n){return e=t1(e,t),e=nC(e,t,ne.GREATER_THAN_OR_EQUALS,r),e=nC(e,t,ne.LESS_THAN_OR_EQUALS,n),e}function nC(e,t,r,n){return Em(e,t,r,n.toISOString())}function oC(e,t,r=!0){return Em(e,t,ne.MISSING,r.toString())}function Nde(e,t){return e.offset===t?e:{...e,offset:t,name:void 0}}function Ade(e,t){const r=e.count??Fc,n=(t-1)*r;return Nde(e,n)}function Mde(e,t,r){return t===Lde(e)&&r!==void 0&&r===zde(e)?e:{...e,sortRules:[{code:t,descending:!!r}],name:void 0}}function Lde(e){const t=e.sortRules;if(!t||t.length===0)return;const r=t[0].code;return r.startsWith("-")?r.substr(1):r}function zde(e){const t=e.sortRules;return!t||t.length===0?!1:!!t[0].descending}function Fde(e){return jde[e.type]}function i1(e){return Ode[e]??""}function ji(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(sr).join(" "))}function Vde(e,t){var n,o;const r=t.name;return r==="id"?e.id:r==="meta.versionId"?(n=e.meta)==null?void 0:n.versionId:r==="_lastUpdated"?Dr((o=e.meta)==null?void 0:o.lastUpdated):t.elementDefinition&&`${e.resourceType}.${t.name}`===t.elementDefinition.path?Bde(e,t.elementDefinition):t.searchParams&&t.searchParams.length===1&&t.name===t.searchParams[0].code?Ude(e,t.searchParams[0]):null}function Bde(e,t){var i,a,l;const r=((l=(a=(i=t.path)==null?void 0:i.split("."))==null?void 0:a.pop())==null?void 0:l.replaceAll("[x]",""))??"",[n,o]=Bc({type:e.resourceType,value:e},r);return n?s.jsx(To,{property:t,propertyType:o,value:n,maxWidth:200,ignoreMissingValues:!0,link:!1}):null}function Ude(e,t){const r=hc(t.expression,[{type:e.resourceType,value:e}]);return!r||r.length===0?null:s.jsx(s.Fragment,{children:r.map((n,o)=>s.jsx(To,{propertyType:n.type,value:n.value,maxWidth:200,ignoreMissingValues:!0,link:!1},`${o}-${r.length}`))})}function Wde(e){const t=f.useRef(!1),[r,n]=f.useState({search:JSON.parse(Ir(e.search))}),[o,i]=f.useState(!1);f.useEffect(()=>{n({search:e.search})},[e.search]);const a=f.useMemo(()=>{if(!e.visible)return[];const c=e.search.resourceType,u=qae(c),d=_x(c);return Hde(u,d).sort((p,h)=>p.localeCompare(h)).map(p=>({value:p,label:ji(p)}))},[e.visible,e.search.resourceType]);if(!e.visible)return null;function l(c){n({search:{...r.search,fields:c}})}return s.jsx(Ar,{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:s.jsx("div",{"data-testid":"overlay-child"})},children:s.jsxs(je,{children:[s.jsx(lm,{withinPortal:!0,style:{width:550},placeholder:"Select fields to display",data:a,value:r.search.fields??[],onChange:l,onDropdownOpen:()=>i(!0),onDropdownClose:()=>i(!1),maxDropdownHeight:"250px",dropdownPosition:"bottom",clearButtonProps:{"aria-label":"Clear selection"},clearable:!0,searchable:!0}),s.jsx(Y,{position:"right",children:s.jsx(re,{onClick:()=>e.onOk(r.search),children:"OK"})})]})})}function Hde(e,t){const r=[],n=new Set,o=new Set;for(const i of Object.keys(e.elements))r.push(i),n.add(i.toLowerCase()),o.add(ji(i));if(t)for(const i of Object.keys(t)){const a=ji(i);!n.has(i)&&!o.has(a)&&(r.push(i),n.add(i),o.add(a))}return r}function B4(e){var o;const{resourceType:t,filter:r}=e,n=(o=Si.types[t].searchParams)==null?void 0:o[r.code];if(n){if(n.type==="reference"&&(r.operator===ne.EQUALS||r.operator===ne.NOT_EQUALS))return s.jsx(Wc,{value:{reference:r.value}});const i=ym(t,n);if(r.code==="_lastUpdated"||i.type===ri.DATETIME)return s.jsx(s.Fragment,{children:Dr(r.value)})}return s.jsx(s.Fragment,{children:r.value})}function U4(e){const t=ym(e.resourceType,e.searchParam),r="filter-value";switch(t.type){case ri.REFERENCE:return s.jsx(jm,{name:r,defaultValue:e.defaultValue?{reference:e.defaultValue}:void 0,targetTypes:e.searchParam.target,autoFocus:e.autoFocus,onChange:n=>{n?e.onChange(n.reference):e.onChange("")}});case ri.BOOLEAN:return s.jsx(kn,{name:r,"data-autofocus":e.autoFocus,"data-testid":r,defaultChecked:e.defaultValue==="true",autoFocus:e.autoFocus,onChange:n=>e.onChange(n.currentTarget.checked.toString())});case ri.DATE:return s.jsx(le,{type:"date",name:r,"data-autofocus":e.autoFocus,"data-testid":r,defaultValue:e.defaultValue,autoFocus:e.autoFocus,onChange:n=>e.onChange(n.currentTarget.value)});case ri.DATETIME:return s.jsx(aa,{name:r,defaultValue:e.defaultValue,autoFocus:e.autoFocus,onChange:e.onChange});case ri.NUMBER:return s.jsx(le,{type:"number",name:r,"data-autofocus":e.autoFocus,"data-testid":r,defaultValue:e.defaultValue,autoFocus:e.autoFocus,onChange:n=>e.onChange(n.currentTarget.value)});case ri.QUANTITY:return s.jsx(sa,{name:r,defaultValue:qde(e.defaultValue),autoFocus:e.autoFocus,onChange:n=>{n?e.onChange(`${n.value}`):e.onChange("")}});default:return s.jsx(le,{name:r,"data-autofocus":e.autoFocus,"data-testid":r,defaultValue:e.defaultValue,autoFocus:e.autoFocus,onChange:n=>e.onChange(n.currentTarget.value),placeholder:"Search value"})}}function qde(e){if(e){const[t,r,n]=e.split("|");if(t)return{value:parseFloat(t),system:r,unit:n}}}function Gde(e){const[t,r]=f.useState(JSON.parse(Ir(e.search))),[n,o]=f.useState(-1),i=f.useRef(t);i.current=t,f.useEffect(()=>{r(JSON.parse(Ir(e.search)))},[e.search]);function a(d){r(Em(i.current,d.code,d.operator,d.value))}if(!e.visible)return null;const l=e.search.resourceType,c=_x(l)??{},u=t.filters||[];return s.jsxs(Ar,{title:"Filters",closeButtonProps:{"aria-label":"Close"},size:900,opened:e.visible,onClose:e.onCancel,children:[s.jsx("div",{children:s.jsxs("table",{children:[s.jsxs("colgroup",{children:[s.jsx("col",{style:{width:200}}),s.jsx("col",{style:{width:200}}),s.jsx("col",{style:{width:380}}),s.jsx("col",{style:{width:120}})]}),s.jsx("thead",{children:s.jsxs("tr",{children:[s.jsx("th",{children:"Field"}),s.jsx("th",{children:"Operation"}),s.jsx("th",{children:"Value"}),s.jsx("th",{children:"Actions"})]})}),s.jsxs("tbody",{children:[u.map((d,p)=>p===n?s.jsx(iC,{resourceType:l,searchParams:c,defaultValue:d,okText:"Save",onOk:h=>{const m=[...u];m[p]=h,r(e1(i.current,m)),o(-1)},onCancel:()=>o(-1)},`filter-${d.code}-${d.operator}-${d.value}-input`):s.jsx(Qde,{resourceType:l,searchParams:c,filter:d,onEdit:()=>o(p),onDelete:()=>r(Cde(i.current,p))},`filter-${d.code}-${d.operator}-${d.value}-display`)),s.jsx(iC,{resourceType:l,searchParams:c,okText:"Add",onOk:a})]})]})}),s.jsx(Y,{position:"right",mt:"xl",children:s.jsx(re,{onClick:()=>e.onOk(i.current),children:"OK"})})]})}function Qde(e){const{filter:t}=e;return s.jsxs("tr",{children:[s.jsx("td",{children:ji(t.code)}),s.jsx("td",{children:i1(t.operator)}),s.jsx("td",{children:s.jsx(B4,{resourceType:e.resourceType,filter:t})}),s.jsxs("td",{children:[s.jsx(re,{compact:!0,variant:"outline",onClick:e.onEdit,children:"Edit"}),s.jsx(re,{compact:!0,variant:"outline",onClick:e.onDelete,children:"Delete"})]})]})}function iC(e){const[t,r]=f.useState(e.defaultValue??{}),n=f.useRef(t);n.current=t;function o(u){r({...n.current,code:u})}function i(u){r({...n.current,operator:u})}function a(u){r({...n.current,value:u})}const l=e.searchParams[t.code],c=l&&Fde(l);return s.jsxs("tr",{children:[s.jsx("td",{children:s.jsx(mt,{"data-testid":"filter-field",defaultValue:n.current.code,onChange:u=>o(u.currentTarget.value),data:["",...Object.keys(e.searchParams).map(u=>({value:u,label:ji(u)}))]})}),s.jsx("td",{children:c&&s.jsx(mt,{"data-testid":"filter-operation",defaultValue:t.operator,onChange:u=>i(u.currentTarget.value),data:["",...c.map(u=>({value:u,label:i1(u)}))]})}),s.jsx("td",{children:l&&t.operator&&s.jsx(U4,{resourceType:e.resourceType,searchParam:l,defaultValue:t.value,onChange:a})}),s.jsxs("td",{children:[t.code&&t.operator&&s.jsx(re,{compact:!0,variant:"outline",onClick:()=>{e.onOk(n.current),r({})},children:e.okText}),e.onCancel&&s.jsx(re,{compact:!0,variant:"outline",onClick:e.onCancel,children:"Cancel"})]})]})}function Kde(e){const[t,r]=f.useState(e.defaultValue??"");if(!e.visible||!e.searchParam||!e.filter)return null;function n(){e.onOk({...e.filter,value:t})}return s.jsx(Ar,{title:e.title,size:"xl",opened:e.visible,onClose:e.onCancel,children:s.jsx(De,{onSubmit:n,children:s.jsxs(sn,{children:[s.jsx(sn.Col,{span:10,children:s.jsx(U4,{resourceType:e.resourceType,searchParam:e.searchParam,defaultValue:t,autoFocus:!0,onChange:r})}),s.jsx(sn.Col,{span:2,children:s.jsx(re,{onClick:n,fullWidth:!0,children:"OK"})})]})})})}function Yde(e){if(!e.searchParams)return null;function t(i,a){o(Mde(e.search,i.code,a))}function r(i){o(t1(e.search,i.code))}function n(i,a){e.onPrompt(i,{code:i.code,operator:a,value:""})}function o(i){e.onChange(i)}return e.searchParams.length===1?s.jsx(Xde,{search:e.search,searchParam:e.searchParams[0],onSort:t,onPrompt:n,onChange:o,onClear:r}):s.jsx(J.Dropdown,{children:e.searchParams.map(i=>s.jsx(J.Item,{children:ji(i.code)},i.code))})}function Xde(e){switch(e.searchParam.type){case"date":return s.jsx(Jde,{...e});case"number":case"quantity":return s.jsx(Zde,{...e});case"reference":return s.jsx(efe,{...e});case"string":case"token":case"uri":return s.jsx(tfe,{...e});default:return s.jsxs(s.Fragment,{children:["Unknown search param type: ",e.searchParam.type]})}}function Jde(e){const{searchParam:t}=e,r=t.code;return s.jsxs(J.Dropdown,{children:[s.jsx(J.Item,{icon:s.jsx(Nx,{size:14}),onClick:()=>e.onSort(t,!1),children:"Sort Oldest to Newest"}),s.jsx(J.Item,{icon:s.jsx(Ax,{size:14}),onClick:()=>e.onSort(t,!0),children:"Sort Newest to Oldest"}),s.jsx(J.Divider,{}),s.jsx(J.Item,{icon:s.jsx(Pm,{size:14}),onClick:()=>e.onPrompt(t,ne.EQUALS),children:"Equals..."}),s.jsx(J.Item,{icon:s.jsx(Sm,{size:14}),onClick:()=>e.onPrompt(t,ne.NOT_EQUALS),children:"Does not equal..."}),s.jsx(J.Divider,{}),s.jsx(J.Item,{icon:s.jsx(s4,{size:14}),onClick:()=>e.onPrompt(t,ne.ENDS_BEFORE),children:"Before..."}),s.jsx(J.Item,{icon:s.jsx(a4,{size:14}),onClick:()=>e.onPrompt(t,ne.STARTS_AFTER),children:"After..."}),s.jsx(J.Item,{icon:s.jsx(Ble,{size:14}),onClick:()=>e.onPrompt(t,ne.EQUALS),children:"Between..."}),s.jsx(J.Divider,{}),s.jsx(J.Item,{icon:s.jsx(Li,{size:14}),onClick:()=>e.onChange(kde(e.search,r)),children:"Tomorrow"}),s.jsx(J.Item,{icon:s.jsx(Li,{size:14}),onClick:()=>e.onChange($de(e.search,r)),children:"Today"}),s.jsx(J.Item,{icon:s.jsx(Li,{size:14}),onClick:()=>e.onChange(Ede(e.search,r)),children:"Yesterday"}),s.jsx(J.Divider,{}),s.jsx(J.Item,{icon:s.jsx(Li,{size:14}),onClick:()=>e.onChange(Ide(e.search,r)),children:"Next Month"}),s.jsx(J.Item,{icon:s.jsx(Li,{size:14}),onClick:()=>e.onChange(Tde(e.search,r)),children:"This Month"}),s.jsx(J.Item,{icon:s.jsx(Li,{size:14}),onClick:()=>e.onChange(Rde(e.search,r)),children:"Last Month"}),s.jsx(J.Divider,{}),s.jsx(J.Item,{icon:s.jsx(Li,{size:14}),onClick:()=>e.onChange(Dde(e.search,r)),children:"Year to date"}),s.jsx($m,{...e})]})}function Zde(e){const{searchParam:t}=e;return s.jsxs(J.Dropdown,{children:[s.jsx(J.Item,{icon:s.jsx(Nx,{size:14}),onClick:()=>e.onSort(t,!1),children:"Sort Smallest to Largest"}),s.jsx(J.Item,{icon:s.jsx(Ax,{size:14}),onClick:()=>e.onSort(t,!0),children:"Sort Largest to Smallest"}),s.jsx(J.Divider,{}),s.jsx(J.Item,{icon:s.jsx(Pm,{size:14}),onClick:()=>e.onPrompt(t,ne.EQUALS),children:"Equals..."}),s.jsx(J.Item,{icon:s.jsx(Sm,{size:14}),onClick:()=>e.onPrompt(t,ne.NOT_EQUALS),children:"Does not equal..."}),s.jsx(J.Divider,{}),s.jsx(J.Item,{icon:s.jsx(a4,{size:14}),onClick:()=>e.onPrompt(t,ne.GREATER_THAN),children:"Greater than..."}),s.jsx(J.Item,{icon:s.jsx(hy,{size:14}),onClick:()=>e.onPrompt(t,ne.GREATER_THAN_OR_EQUALS),children:"Greater than or equal to..."}),s.jsx(J.Item,{icon:s.jsx(s4,{size:14}),onClick:()=>e.onPrompt(t,ne.LESS_THAN),children:"Less than..."}),s.jsx(J.Item,{icon:s.jsx(hy,{size:14}),onClick:()=>e.onPrompt(t,ne.LESS_THAN_OR_EQUALS),children:"Less than or equal to..."}),s.jsx($m,{...e})]})}function efe(e){const{searchParam:t}=e;return s.jsxs(J.Dropdown,{children:[s.jsx(J.Item,{icon:s.jsx(Pm,{size:14}),onClick:()=>e.onPrompt(t,ne.EQUALS),children:"Equals..."}),s.jsx(J.Item,{icon:s.jsx(Sm,{size:14}),onClick:()=>e.onPrompt(t,ne.NOT),children:"Does not equal..."}),s.jsx($m,{...e})]})}function tfe(e){const{searchParam:t}=e;return s.jsxs(J.Dropdown,{children:[s.jsx(J.Item,{icon:s.jsx(Nx,{size:14}),onClick:()=>e.onSort(t,!1),children:"Sort A to Z"}),s.jsx(J.Item,{icon:s.jsx(Ax,{size:14}),onClick:()=>e.onSort(t,!0),children:"Sort Z to A"}),s.jsx(J.Divider,{}),s.jsx(J.Item,{icon:s.jsx(Pm,{size:14}),onClick:()=>e.onPrompt(t,ne.EQUALS),children:"Equals..."}),s.jsx(J.Item,{icon:s.jsx(Sm,{size:14}),onClick:()=>e.onPrompt(t,ne.NOT),children:"Does not equal..."}),s.jsx(J.Divider,{}),s.jsx(J.Item,{icon:s.jsx(Hle,{size:14}),onClick:()=>e.onPrompt(t,ne.CONTAINS),children:"Contains..."}),s.jsx(J.Item,{icon:s.jsx(Wle,{size:14}),onClick:()=>e.onPrompt(t,ne.EQUALS),children:"Does not contain..."}),s.jsx($m,{...e})]})}function $m(e){const{searchParam:t}=e,r=t.code;return s.jsxs(s.Fragment,{children:[s.jsx(J.Divider,{}),s.jsx(J.Item,{icon:s.jsx(Fle,{size:14}),onClick:()=>e.onChange(oC(e.search,r)),children:"Missing"}),s.jsx(J.Item,{icon:s.jsx(zle,{size:14}),onClick:()=>e.onChange(oC(e.search,r,!1)),children:"Not missing"}),s.jsx(J.Divider,{}),s.jsx(J.Item,{icon:s.jsx(fh,{size:14}),onClick:()=>e.onClear(t),children:"Clear filters"})]})}function rfe(e){const t=e.resourceType,r=[];for(const n of e.fields||["id","_lastUpdated"])r.push(nfe(t,n));return r}function nfe(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 r=Sa(e,t),n=Zae(e,t.toLowerCase());if(r&&n)return{name:t,elementDefinition:r,searchParams:[n]};if(r){const i=_x(e);let a;if(i){const l=new RegExp(`${e}\\.${t.replaceAll("[x]","")}([^\\w-]|$)`);a=Object.values(i).filter(c=>!!c.expression&&l.test(c==null?void 0:c.expression)),a.length===0&&(a=void 0)}return{name:t,elementDefinition:r,searchParams:a}}if(n){const i=ym(e,n);return{name:t,elementDefinition:(o=i.elementDefinitions)==null?void 0:o[0],searchParams:[n]}}return{name:t}}class ofe extends Event{constructor(t){super("change"),this.definition=t}}class ife extends Event{constructor(t){super("load"),this.response=t}}class hh extends Event{constructor(t,r){super("click"),this.resource=t,this.browserEvent=r}}const afe=W(e=>({root:{maxWidth:"100%",overflow:"auto",textAlign:"left",marginBottom:"20px"},table:{cursor:"pointer"},tr:{"&:hover":{backgroundColor:e.colorScheme==="dark"?e.colors.dark[7]:e.colors.gray[0]}},th:{padding:"0 !important"},control:{width:"100%",padding:`${e.spacing.xs} ${e.spacing.md}`,"&:hover":{backgroundColor:e.colorScheme==="dark"?e.colors.dark[6]:e.colors.gray[0]}},icon:{width:21,height:21,borderRadius:21}}));function sfe(e){var z,G,X;const{classes:t}=afe(),r=ae(),[n,o]=f.useState(!1),[i,a]=f.useState(),{search:l,onLoad:c}=e,[u,d]=f.useState({selected:{},fieldEditorVisible:!1,filterEditorVisible:!1,exportDialogVisible:!1,filterDialogVisible:!1}),p=f.useRef(u);p.current=u;const h=l.total??"accurate",m=f.useCallback(R=>{a(void 0),r.search(l.resourceType,es({...l,total:h,fields:void 0}),R).then(M=>{d({...p.current,searchResponse:M}),c&&c(new ife(M))}).catch(M=>{d({...p.current,searchResponse:void 0}),a(M)})},[r,l,h,c]),g=f.useCallback(()=>{d({...p.current,searchResponse:void 0}),m({cache:"reload"})},[m]);f.useEffect(()=>{m()},[m]);function v(R,M){R.stopPropagation();const Q=R.target.checked,Z={...p.current.selected};Q?Z[M]=!0:delete Z[M],d({...p.current,selected:Z})}function _(R){R.stopPropagation();const V=R.target.checked,Q={},Z=p.current.searchResponse;V&&(Z!=null&&Z.entry)&&Z.entry.forEach(_e=>{var xe;(xe=_e.resource)!=null&&xe.id&&(Q[_e.resource.id]=!0)}),d({...p.current,selected:Q})}function y(){var M,V;const R=p.current;if(!((M=R.searchResponse)!=null&&M.entry)||R.searchResponse.entry.length===0)return!1;for(const Q of R.searchResponse.entry)if((V=Q.resource)!=null&&V.id&&!R.selected[Q.resource.id])return!1;return!0}function x(R){e.onChange&&e.onChange(new ofe(R))}function w(R,M){if(u4(R.target)||R.button===2)return;ct(R);const V=R.button===1||R.ctrlKey||R.metaKey;!V&&e.onClick&&e.onClick(new hh(M,R)),V&&e.onAuxClick&&e.onAuxClick(new hh(M,R))}function b(){return!!(e.onExport??e.onExportCsv??e.onExportTransactionBundle)}if(f.useEffect(()=>{o(!1),r.requestSchema(e.search.resourceType).then(()=>o(!0)).catch(console.log)},[r,e.search.resourceType]),!n)return s.jsx(or,{style:{width:"100%",height:"100%"},children:s.jsx(hn,{})});const C=e.checkboxesEnabled,O=rfe(l),P=l.resourceType,E=u.searchResponse,$=E==null?void 0:E.entry,k=$==null?void 0:$.map(R=>R.resource),I="subtle",T="gray",N=16,A=window.innerWidth<768;return s.jsxs("div",{className:t.root,"data-testid":"search-control",children:[!e.hideToolbar&&s.jsxs(Y,{position:"apart",mb:"xl",children:[s.jsxs(Y,{spacing:2,children:[s.jsx(re,{compact:!0,variant:I,color:T,leftIcon:s.jsx(Kle,{size:N}),onClick:()=>d({...p.current,fieldEditorVisible:!0}),children:"Fields"}),s.jsx(re,{compact:!0,variant:I,color:T,leftIcon:s.jsx(rce,{size:N}),onClick:()=>d({...p.current,filterEditorVisible:!0}),children:"Filters"}),e.onNew&&s.jsx(re,{compact:!0,variant:I,color:T,leftIcon:s.jsx(tce,{size:N}),onClick:e.onNew,children:"New..."}),!A&&b()&&s.jsx(re,{compact:!0,variant:I,color:T,leftIcon:s.jsx(Sce,{size:N}),onClick:e.onExport?e.onExport:()=>d({...p.current,exportDialogVisible:!0}),children:"Export..."}),!A&&e.onDelete&&s.jsx(re,{compact:!0,variant:I,color:T,leftIcon:s.jsx(l4,{size:N}),onClick:()=>e.onDelete(Object.keys(u.selected)),children:"Delete..."}),!A&&e.onBulk&&s.jsx(re,{compact:!0,variant:I,color:T,leftIcon:s.jsx(Vle,{size:N}),onClick:()=>e.onBulk(Object.keys(u.selected)),children:"Bulk..."})]}),s.jsxs(Y,{spacing:2,children:[E&&s.jsxs(oe,{size:"xs",color:"dimmed",children:[dfe(l,E.total),"-",ffe(l,E.total)," of"," ",`${h==="estimate"?"~":""}${(z=E.total)==null?void 0:z.toLocaleString()}`]}),s.jsx(vr,{title:"Refresh",onClick:g,children:s.jsx(vce,{size:"1.125rem"})})]})]}),s.jsxs(xa,{className:t.table,children:[s.jsxs("thead",{children:[s.jsxs("tr",{children:[C&&s.jsx("th",{children:s.jsx("input",{type:"checkbox",value:"checked","aria-label":"all-checkbox","data-testid":"all-checkbox",checked:y(),onChange:R=>_(R)})}),O.map(R=>s.jsx("th",{children:s.jsxs(J,{shadow:"md",width:240,position:"bottom-end",children:[s.jsx(J.Target,{children:s.jsx(So,{className:t.control,children:s.jsxs(Y,{position:"apart",noWrap:!0,children:[s.jsx(oe,{weight:500,size:"sm",children:ji(R.name)}),s.jsx(or,{className:t.icon,children:s.jsx(Ale,{size:14,stroke:1.5})})]})})}),s.jsx(Yde,{search:e.search,searchParams:R.searchParams,onPrompt:(M,V)=>{d({...p.current,filterDialogVisible:!0,filterDialogSearchParam:M,filterDialogFilter:V})},onChange:M=>{x(M)}})]})},R.name))]}),!e.hideFilters&&s.jsxs("tr",{children:[C&&s.jsx("th",{}),O.map(R=>s.jsx("th",{children:R.searchParams&&s.jsx(lfe,{resourceType:P,searchParams:R.searchParams,filters:e.search.filters})},R.name))]})]}),s.jsx("tbody",{children:k==null?void 0:k.map(R=>R&&s.jsxs("tr",{className:t.tr,"data-testid":"search-control-row",onClick:M=>w(M,R),onAuxClick:M=>w(M,R),children:[C&&s.jsx("td",{children:s.jsx("input",{type:"checkbox",value:"checked","data-testid":"row-checkbox","aria-label":`Checkbox for ${R.id}`,checked:!!u.selected[R.id],onChange:M=>v(M,R.id)})}),O.map(M=>s.jsx("td",{children:Vde(R,M)},M.name))]},R.id))})]}),(k==null?void 0:k.length)===0&&s.jsx(Uc,{children:s.jsx(or,{style:{height:150},children:s.jsx(oe,{size:"xl",color:"dimmed",children:"No results"})})}),(E==null?void 0:E.total)!==void 0&&E.total>0&&s.jsx(or,{m:"md",p:"md",children:s.jsx(io,{value:cfe(l),total:ufe(l,E.total),onChange:R=>x(Ade(l,R)),getControlProps:R=>{switch(R){case"previous":return{"aria-label":"Previous page"};case"next":return{"aria-label":"Next page"};default:return{}}}})}),i&&s.jsx("div",{"data-testid":"search-error",children:s.jsx("pre",{style:{textAlign:"left"},children:JSON.stringify(i,void 0,2)})}),s.jsx(Wde,{search:e.search,visible:p.current.fieldEditorVisible,onOk:R=>{x(R),d({...p.current,fieldEditorVisible:!1})},onCancel:()=>{d({...p.current,fieldEditorVisible:!1})}}),s.jsx(Gde,{search:e.search,visible:p.current.filterEditorVisible,onOk:R=>{x(R),d({...p.current,filterEditorVisible:!1})},onCancel:()=>{d({...p.current,filterEditorVisible:!1})}}),s.jsx(Pde,{visible:p.current.exportDialogVisible,exportCsv:e.onExportCsv,exportTransactionBundle:e.onExportTransactionBundle,onCancel:()=>{d({...p.current,exportDialogVisible:!1})}}),s.jsx(Kde,{visible:p.current.filterDialogVisible,title:(G=u.filterDialogSearchParam)!=null&&G.code?ji(u.filterDialogSearchParam.code):"",resourceType:P,searchParam:u.filterDialogSearchParam,filter:u.filterDialogFilter,defaultValue:"",onOk:R=>{x(Em(e.search,R.code,R.operator,R.value)),d({...p.current,filterDialogVisible:!1})},onCancel:()=>{d({...p.current,filterDialogVisible:!1})}},(X=u.filterDialogSearchParam)==null?void 0:X.code)]})}const qc=f.memo(sfe);function lfe(e){const t=(e.filters??[]).filter(r=>e.searchParams.find(n=>n.code===r.code));return t.length===0?s.jsx("span",{children:"no filters"}):s.jsx(s.Fragment,{children:t.map(r=>s.jsxs("div",{children:[i1(r.operator)," ",s.jsx(B4,{resourceType:e.resourceType,filter:r})]},`filter-${r.code}-${r.operator}-${r.value}`))})}function cfe(e){return Math.floor((e.offset??0)/(e.count??Fc))+1}function ufe(e,t){const r=e.count??Fc;return Math.ceil(t/r)}function dfe(e,t){return Math.min(t,(e.offset??0)+1)}function ffe(e,t){return Math.min(t,((e.offset??0)+1)*(e.count??Fc))}function pfe(e){const t=ae(),[r,n]=f.useState(!1),[o,i]=f.useState(),{query:a,fields:l}=e,[c,u]=f.useState(),[d,p]=f.useState({}),h=f.useRef();h.current=c;const m=f.useRef({});m.current=d,f.useEffect(()=>{i(void 0),t.graphql(a).then(u).catch(w=>i(dt(w)))},[t,a]);function g(w,b){w.stopPropagation();const O=w.target.checked,P={...m.current};O?P[b]=!0:delete P[b],p(P)}function v(w){var E;w.stopPropagation();const C=w.target.checked,O={},P=(E=h.current)==null?void 0:E.data.ResourceList;C&&P&&P.forEach($=>{$.id&&(O[$.id]=!0)}),p(O)}function _(){var b;const w=(b=h.current)==null?void 0:b.data.ResourceList;if(!w||w.length===0)return!1;for(const C of w)if(C.id&&!m.current[C.id])return!1;return!0}function y(w,b){u4(w.target)||(ct(w),w.button!==1&&e.onClick&&e.onClick(new hh(b,w)),w.button===1&&e.onAuxClick&&e.onAuxClick(new hh(b,w)))}if(f.useEffect(()=>{t.requestSchema(e.resourceType).then(()=>n(!0)).catch(console.log)},[t,e.resourceType]),!r)return s.jsx(hn,{});const x=e.checkboxesEnabled;return s.jsxs("div",{onContextMenu:w=>ct(w),"data-testid":"search-control",children:[s.jsxs(xa,{children:[s.jsx("thead",{children:s.jsxs("tr",{children:[x&&s.jsx("th",{children:s.jsx("input",{type:"checkbox",value:"checked","aria-label":"all-checkbox","data-testid":"all-checkbox",checked:_(),onChange:w=>v(w)})}),l.map(w=>s.jsx("th",{children:w.name},w.name))]})}),s.jsx("tbody",{children:c==null?void 0:c.data.ResourceList.map(w=>w&&s.jsxs("tr",{"data-testid":"search-control-row",onClick:b=>y(b,w),onAuxClick:b=>y(b,w),children:[x&&s.jsx("td",{children:s.jsx("input",{type:"checkbox",value:"checked","data-testid":"row-checkbox","aria-label":`Checkbox for ${w.id}`,checked:!!d[w.id],onChange:b=>g(b,w.id)})}),l.map(b=>s.jsx("td",{children:s.jsx(Sde,{propertyType:b.propertyType,path:b.fhirPath,resource:w})},b.name))]},w.id))})]}),(c==null?void 0:c.data.ResourceList.length)===0&&s.jsx("div",{"data-testid":"empty-search",children:"No results"}),o&&s.jsx("div",{"data-testid":"search-error",children:s.jsx("pre",{style:{textAlign:"left"},children:JSON.stringify(o,void 0,2)})}),e.onBulk&&s.jsx(re,{onClick:()=>e.onBulk(Object.keys(m.current)),children:"Bulk..."})]})}const hfe=f.memo(pfe);function In(e){return s.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 491 491",style:{width:e.size,height:e.size},children:[s.jsx("title",{children:"Medplum Logo"}),s.jsx("path",{fill:e.fill??"#ad7136",d:"M282 67c6-16 16-29 29-40L289 0c-22 17-37 41-43 68l17 23 19-24z"}),s.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"}),s.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"}),s.jsx("path",{fill:e.fill??"#40bc26",d:"M207 220a176 176 0 01-177 43A176 176 0 01251 43l1 5c17 59 2 125-45 172z"}),s.jsx("path",{fill:e.fill??"#33961e",d:"M252 48A421 421 0 0057 270l-27-7A176 176 0 01251 43l1 5z"})]})}function mfe(e){const{group:t}=e;return s.jsx(un,{withBorder:!0,radius:"md",p:"xs",display:"flex",sx:{alignItems:"center",justifyContent:"center"},children:s.jsxs(Y,{children:[t.measureScore&&s.jsx(yfe,{group:t}),!t.measureScore&&s.jsx(vfe,{group:t})]})})}function gfe(e){const{measure:t}=e;return s.jsxs(s.Fragment,{children:[s.jsx(oe,{fz:"md",fw:500,mb:8,children:t.title}),s.jsx(oe,{fz:"xs",c:"dimmed",mb:8,children:t.subtitle})]})}function vfe(e){const{group:t}=e,r=t.population,n=r==null?void 0:r.find(c=>js(c.code)==="numerator"),o=r==null?void 0:r.find(c=>js(c.code)==="denominator"),i=n==null?void 0:n.count,a=o==null?void 0:o.count;if(a===0)return s.jsxs(ie,{children:[s.jsx(ue,{order:3,children:"Not Applicable"}),s.jsx(oe,{children:`Denominator: ${a}`})]});if(i===void 0||a===void 0)return s.jsxs(ie,{children:[s.jsx(ue,{order:3,children:"Insufficient Data"}),s.jsx(oe,{children:`Numerator: ${i}`}),s.jsx(oe,{children:`Denominator: ${a}`})]});const l=i/a*100;return s.jsx(hx,{size:120,thickness:12,roundCaps:!0,sections:[{value:l,color:W4(l)}],label:s.jsx(lp,{justify:"center",children:s.jsxs(oe,{fw:700,fz:18,children:[i," / ",a]})})})}function yfe(e){var n,o,i;const{group:t}=e,r=((n=t.measureScore)==null?void 0:n.unit)??((o=t.measureScore)==null?void 0:o.code);return s.jsx(s.Fragment,{children:r==="%"?s.jsx(hx,{size:120,thickness:12,roundCaps:!0,sections:[{value:xfe(t),color:W4(((i=t==null?void 0:t.measureScore)==null?void 0:i.value)??0)}],label:s.jsx(lp,{justify:"center",children:s.jsx(oe,{fw:700,fz:18,children:s.jsx(mc,{value:t.measureScore})})})}):s.jsx(lp,{h:120,align:"center",children:s.jsx(ue,{order:3,children:s.jsx(mc,{value:t.measureScore})})})})}function xfe(e){var n,o;const t=(n=e.measureScore)==null?void 0:n.value,r=(o=e.measureScore)==null?void 0:o.unit;return t?t<=1&&r==="%"?t*100:t:0}function W4(e){return e<=33?"red":e<=67?"yellow":"green"}function wfe(e){var n;const t=Xe(e.measureReport),[r]=Ole("Measure",{url:t==null?void 0:t.measure});return t?s.jsxs(ie,{children:[r&&s.jsx(gfe,{measure:r}),s.jsx(FN,{cols:3,breakpoints:[{maxWidth:"48rem",cols:2,spacing:"md"},{maxWidth:"36rem",cols:1,spacing:"sm"}],spacing:"md",children:(n=t.group)==null?void 0:n.map((o,i)=>s.jsx(mfe,{group:o},o.id??i))})]}):null}function Vo(e){var r;const t=((r=e.outcome)==null?void 0:r.issue)||e.issues;return!t||t.length===0?null:s.jsx($c,{icon:s.jsx(bm,{size:16}),color:"red",children:t.map(n=>{var o;return s.jsx("div",{"data-testid":"text-field-error",children:H5(n)},(o=n.details)==null?void 0:o.text)})})}function bfe(e){const t=f.useCallback((r,n,o)=>{const i=`${n}/${o}`,a=100;return Promise.allSettled([r.readHistory("Patient",o),r.search("Communication",{subject:i,_count:a}),r.search("Device",{patient:i,_count:a}),r.search("DeviceRequest",{patient:i,_count:a}),r.search("DiagnosticReport",{subject:i,_count:a}),r.search("Media",{subject:i,_count:a}),r.search("ServiceRequest",{subject:i,_count:a}),r.search("Task",{subject:i,_count:a})])},[]);return s.jsx(Cm,{value:e.patient,loadTimelineResources:t,createCommunication:(r,n,o)=>({resourceType:"Communication",status:"completed",subject:ht(r),sender:ht(n),sent:new Date().toISOString(),payload:[{contentString:o}]}),createMedia:(r,n,o)=>({resourceType:"Media",status:"completed",subject:ht(r),operator:ht(n),issued:new Date().toISOString(),content:o})})}const H4=W(e=>({section:{position:"relative",margin:"4px 4px 8px 0",padding:"6px 12px 16px 6px",border:`1.5px solid ${e.colors.gray[1]}`,borderRadius:e.radius.sm,transition:"all 0.1s"},hovering:{border:`1.5px solid ${e.colors.blue[5]}`},editing:{border:`1.5px solid ${e.colors.gray[1]}`,borderLeft:`4px solid ${e.colors.blue[5]}`},bottomActions:{position:"absolute",right:4,bottom:0,fontSize:e.fontSizes.xs,"& a":{marginLeft:8}}}));function _fe(e){const t=ae(),r=Xe(e.value),[n,o]=f.useState(!1),[i,a]=f.useState(),[l,c]=f.useState(),[u,d]=f.useState();function p(){c(void 0)}function h(){a(void 0)}const m=f.useRef();if(m.current=u,f.useEffect(()=>{t.requestSchema("PlanDefinition").then(()=>o(!0)).catch(console.log)},[t]),f.useEffect(()=>(d(Efe(r??{resourceType:"PlanDefinition"})),document.addEventListener("mouseover",p),document.addEventListener("click",h),()=>{document.removeEventListener("mouseover",p),document.removeEventListener("click",h)}),[r]),!n||!u)return null;function g(v,_){d({...m.current,[v]:_})}return s.jsx("div",{children:s.jsxs(De,{testid:"questionnaire-form",onSubmit:()=>e.onSubmit(u),children:[s.jsx(le,{label:"Plan Title",defaultValue:u.title,onChange:v=>g("title",v.currentTarget.value)}),s.jsx(q4,{actions:u.action||[],selectedKey:i,setSelectedKey:a,hoverKey:l,setHoverKey:c,onChange:v=>g("action",v)}),s.jsx(re,{type:"submit",children:"Save"})]})})}function q4(e){const{classes:t}=H4(),r=f.useRef();r.current=e.actions;function n(a){e.onChange(r.current.map(l=>l.id===a.id?a:l))}function o(a){e.onChange([...r.current,a]),e.setSelectedKey(a.id)}function i(a){e.onChange(r.current.filter(l=>l!==a))}return s.jsxs("div",{className:t.section,children:[e.actions.map(a=>s.jsx("div",{children:s.jsx(Sfe,{action:a,selectedKey:e.selectedKey,setSelectedKey:e.setSelectedKey,hoverKey:e.hoverKey,setHoverKey:e.setHoverKey,onChange:n,onRemove:()=>i(a)})},a.id)),s.jsx("div",{className:t.bottomActions,children:s.jsx(Le,{href:"#",onClick:a=>{ct(a),o({id:Q4()})},children:"Add action"})})]})}function Sfe(e){const{classes:t,cx:r}=H4(),{action:n}=e,o=Cfe(n),i=e.selectedKey===e.action.id,a=e.hoverKey===e.action.id;function l(d){d.stopPropagation(),e.setSelectedKey(e.action.id)}function c(d){ct(d),e.setHoverKey(e.action.id)}const u=r(t.section,{[t.editing]:i,[t.hovering]:a&&!i});return s.jsxs("div",{"data-testid":n.id,className:u,onClick:l,onMouseOver:c,onFocus:c,children:[i?s.jsx(jfe,{action:n,actionType:o,onChange:e.onChange,selectedKey:e.selectedKey,setSelectedKey:e.setSelectedKey,hoverKey:e.hoverKey,setHoverKey:e.setHoverKey,onRemove:e.onRemove}):s.jsx(Pfe,{action:n,actionType:o}),s.jsx("div",{className:t.bottomActions,children:s.jsx(Le,{href:"#",onClick:d=>{d.preventDefault(),e.onRemove()},children:"Remove"})})]})}const xy={path:"PlanDefinition.action.timing[x]",min:0,max:1,description:"",isArray:!1,constraints:[],type:["dateTime","Period","Range","Timing"].map(e=>({code:e}))};function Pfe(e){const{action:t,actionType:r}=e,[n,o]=G4(t);return s.jsxs("div",{children:[s.jsxs("div",{children:[t.title||"Untitled"," ",r&&`(${r})`]}),t.definitionCanonical&&s.jsx("div",{children:s.jsx(ph,{value:{reference:t.definitionCanonical}})}),n&&s.jsx("div",{children:s.jsx(To,{property:xy,propertyType:o,value:n})})]})}function jfe(e){const{action:t}=e,[r,n]=f.useState(e.actionType);function o(i,a){e.onChange({...t,[i]:a})}return s.jsxs(je,{spacing:"xl",children:[s.jsx(le,{name:`actionTitle-${t.id}`,label:"Title",defaultValue:t.title,onChange:i=>o("title",i.currentTarget.value)}),s.jsx(le,{name:`actionDescription-${t.id}`,label:"Description",defaultValue:t.description,onChange:i=>o("description",i.currentTarget.value)}),s.jsx(mt,{label:"Type of Action",description:"The type of the action to be performed.",name:`actionType-${t.id}`,defaultValue:r,onChange:i=>n(i.currentTarget.value),data:["","appointment","lab","questionnaire","task"]}),t.action&&t.action.length>0&&s.jsx(q4,{actions:t.action,selectedKey:e.selectedKey,setSelectedKey:e.setSelectedKey,hoverKey:e.hoverKey,setHoverKey:e.setHoverKey,onChange:i=>o("action",i)}),(()=>{switch(r){case"appointment":return s.jsx(Qu,{title:"Appointment",description:"The subject must schedule an appointment from the schedule.",resourceType:"Schedule",action:t,onChange:e.onChange});case"lab":return s.jsx(Qu,{title:"Lab",description:"The subject must complete the following lab panel.",resourceType:"ActivityDefinition",action:t,onChange:e.onChange});case"questionnaire":return s.jsx(Qu,{title:"Questionnaire",description:"The subject must complete the selected questionnaire.",resourceType:"Questionnaire",action:t,onChange:e.onChange});case"task":return s.jsx(Qu,{title:"Task",description:"The subject must complete the following task.",resourceType:"ActivityDefinition",action:t,onChange:e.onChange});default:return null}})(),s.jsx(ot,{title:"Timing",description:"When the action should take place.",children:s.jsx(Ofe,{name:"timing-"+t.id,action:t,onChange:e.onChange})})]})}function Qu(e){const{id:t,definitionCanonical:r}=e.action,n=r!=null&&r.startsWith(e.resourceType+"/")?{reference:r}:void 0;return s.jsx(Vs,{name:t,resourceType:e.resourceType,defaultValue:n,loadOnFocus:!0,onChange:o=>{o?e.onChange({...e.action,definitionCanonical:nt(o)}):e.onChange({...e.action,definitionCanonical:void 0})}})}function Ofe(e){const t=e.action,r="timing",[n,o]=G4(t);return s.jsx(la,{property:xy,name:"timing[x]",defaultValue:n,defaultPropertyType:o,onChange:(i,a)=>{e.onChange(gy(t,r,a??r,xy,i))}})}function Cfe(e){var t,r,n;if((t=e.definitionCanonical)!=null&&t.startsWith("Schedule"))return"appointment";if((r=e.definitionCanonical)!=null&&r.startsWith("Questionnaire/"))return"questionnaire";if((n=e.definitionCanonical)!=null&&n.startsWith("ActivityDefinition/"))return"task"}function G4(e){return Bc({type:"PlanDefinitionAction",value:e},"timing")}let Bg=1;function Q4(e){if(e){if(e.startsWith("id-")){const t=parseInt(e.substring(3),10);isNaN(t)||(Bg=Math.max(Bg,t+1))}return e}return"id-"+Bg++}function Efe(e){return{...e,action:K4(e.action)}}function K4(e){if(e)return e.map(t=>({...t,id:Q4(t.id),action:K4(t.action)}))}var st=(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))(st||{});function $fe(e){return e.type==="choice"||e.type==="open-choice"}function kfe(e,t){if(!e.enableWhen)return!0;const r=e.enableBehavior??"any";for(const n of e.enableWhen){const o=Y4(t,n.question);if(n.operator==="exists"&&!n.answerBoolean&&!(o!=null&&o.length)){if(r==="any")return!0;continue}const{anyMatch:i,allMatch:a}=Ife(n,o,r);if(r==="any"&&i)return!0;if(r==="all"&&!a)return!1}return r!=="any"}function Rfe(e,t,r){return e.map(n=>{var a;const o=(a=r.answerOption)==null?void 0:a.find(l=>_a(l.valueCoding)===n||l[t]===n),i=yr({type:"QuestionnaireItemAnswerOption",value:o},"value");return{[t]:i==null?void 0:i.value}})}function Y4(e,t){if(e)for(const r of e){if(r.linkId===t)return r.answer;if(r.item){const n=Y4(r.item,t);if(n)return n}}}function Tfe(e,t,r){if(r==="exists")return!!e===t.value;if(e){const n=r==="="||r==="!="?r==null?void 0:r.replace("=","~"):r,[{value:o}]=hc(`%actualAnswer ${n} %expectedAnswer`,[e],{actualAnswer:e,expectedAnswer:t});return o}else return!1}function Ife(e,t,r){const n=t||[],o=yr({type:"QuestionnaireItemEnableWhen",value:e},"answer[x]");let i=!1,a=!0;for(const l of n){const c=yr({type:"QuestionnaireResponseItemAnswer",value:l},"value[x]"),{operator:u}=e;if(Tfe(c,o,u)?i=!0:a=!1,r==="any"&&i)break}return{anyMatch:i,allMatch:a}}function X4(e){var r,n;const t=hm(e,"http://hl7.org/fhir/StructureDefinition/questionnaire-referenceResource");if(t){if(t.valueCode!==void 0)return[t.valueCode];if(t.valueCodeableConcept)return(n=(r=t.valueCodeableConcept)==null?void 0:r.coding)==null?void 0:n.map(o=>o.code)}}function Ug(e,t){var o;const r=ba(e);let n=hm(r,"http://hl7.org/fhir/StructureDefinition/questionnaire-referenceResource");return!t||t.length===0?(n&&(r.extension=(o=r.extension)==null?void 0:o.filter(i=>i!==n)),r):(n||(r.extension||(r.extension=[]),n={url:"http://hl7.org/fhir/StructureDefinition/questionnaire-referenceResource"},r.extension.push(n)),t.length===1?(n.valueCode=t[0],delete n.valueCodeableConcept):(n.valueCodeableConcept={coding:t.map(i=>({code:i}))},delete n.valueCode),r)}function Dfe(e,t,r){const n=hm(e,"http://hl7.org/fhir/StructureDefinition/questionnaire-referenceFilter");if(!(n!=null&&n.valueString))return;let o=n.valueString;t!=null&&t.reference&&(o=o.replaceAll("$subj",t.reference)),r!=null&&r.reference&&(o=o.replaceAll("$encounter",r.reference));const i={},a=o.split("&");for(const l of a){const[c,u]=Pie(l,"=",2);i[c]=u}return i}function Nfe(e){return{resourceType:"QuestionnaireResponse",questionnaire:nt(e),item:J4(e.item)}}function J4(e){return(e==null?void 0:e.map(Z4))??[]}function Z4(e){var t;return{id:Mfe(),linkId:e.linkId,text:e.text,item:J4(e.item),answer:((t=e.initial)==null?void 0:t.map(Lfe))??[]}}let Afe=1;function Mfe(){return"id-"+Afe++}function Lfe(e){return{...e}}function zfe(e){return e.value.display||e.value.reference||Ir(e.value)}function Ffe(e){var r,n,o,i;const t=(r=e==null?void 0:e.item)==null?void 0:r[0];if(t){const a=hm(t,"http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl");if(((i=(o=(n=a==null?void 0:a.valueCodeableConcept)==null?void 0:n.coding)==null?void 0:o[0])==null?void 0:i.code)==="page")return e.item.length}return 1}const e3=f.createContext({});function wy(e){const t=f.useContext(e3),r=e.item,n=e.response;function o(u){var p,h,m,g;let d;Array.isArray(u)?d=u:e.index>=(((h=(p=e.response)==null?void 0:p.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((_,y)=>y===e.index?u:_)??[],e.onChange({id:n==null?void 0:n.id,linkId:n==null?void 0:n.linkId,text:r.text,answer:d})}const i=r.type;if(!i)return null;const a=r.linkId;if(!a)return null;const l=r.initial&&r.initial.length>0?r.initial[0]:void 0,c=a1(n,e.index)??yr({type:"QuestionnaireItemInitial",value:l},"value");switch(i){case st.display:return s.jsx("p",{children:e.item.text},e.item.linkId);case st.boolean:return s.jsx(v4,{title:e.item.text,htmlFor:e.item.linkId,children:s.jsx(kn,{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 st.decimal:return s.jsx(le,{type:"number",step:"any",id:a,name:a,required:r.required,defaultValue:c==null?void 0:c.value,onChange:u=>o({valueDecimal:u.currentTarget.valueAsNumber})});case st.integer:return s.jsx(le,{type:"number",step:1,id:a,name:a,required:r.required,defaultValue:c==null?void 0:c.value,onChange:u=>o({valueInteger:u.currentTarget.valueAsNumber})});case st.date:return s.jsx(le,{type:"date",id:a,name:a,required:r.required,defaultValue:c==null?void 0:c.value,onChange:u=>o({valueDate:u.currentTarget.value})});case st.dateTime:return s.jsx(aa,{name:a,required:r.required,defaultValue:c==null?void 0:c.value,onChange:u=>o({valueDateTime:u})});case st.time:return s.jsx(le,{type:"time",id:a,name:a,required:r.required,defaultValue:c==null?void 0:c.value,onChange:u=>o({valueTime:u.currentTarget.value})});case st.string:case st.url:return s.jsx(le,{id:a,name:a,required:r.required,defaultValue:c==null?void 0:c.value,onChange:u=>o({valueString:u.currentTarget.value})});case st.text:return s.jsx(Ic,{id:a,name:a,required:r.required,defaultValue:c==null?void 0:c.value,onChange:u=>o({valueString:u.currentTarget.value})});case st.attachment:return s.jsx(Y,{py:4,children:s.jsx(p4,{name:a,defaultValue:c==null?void 0:c.value,onChange:u=>o({valueAttachment:u})})});case st.reference:return s.jsx(jm,{name:a,required:r.required,targetTypes:X4(r),searchCriteria:Dfe(r,t.subject,t.encounter),defaultValue:c==null?void 0:c.value,onChange:u=>o({valueReference:u})});case st.quantity:return s.jsx(sa,{name:a,required:r.required,defaultValue:c==null?void 0:c.value,onChange:u=>o({valueQuantity:u}),disableWheel:!0});case st.choice:case st.openChoice:return qfe(r)&&!r.answerValueSet?s.jsx(Vfe,{name:a,item:r,initial:l,response:n,onChangeAnswer:u=>o(u)}):s.jsx(Bfe,{name:a,item:r,initial:l,response:n,onChangeAnswer:u=>o(u)});default:return null}}function Vfe(e){var c;const{name:t,item:r,initial:n,response:o}=e;if(!((c=r.answerOption)!=null&&c.length))return s.jsx(t3,{});const i=yr({type:"QuestionnaireItemInitial",value:n},"value"),a=[""];for(const u of r.answerOption){const d=yr({type:"QuestionnaireItemAnswerOption",value:u},"value");a.push(aC(d))}const l=a1(o)??i;if(r.repeats){const{propertyName:u,data:d}=Gfe(e.item),p=Wfe(o);return s.jsx(lm,{data:d,placeholder:"Select items",searchable:!0,defaultValue:p||[aC(i)],onChange:h=>{const m=Rfe(h,u,r);e.onChangeAnswer(m)}})}return s.jsx(mt,{id:t,name:t,onChange:u=>{const d=u.currentTarget.selectedIndex;if(d===0){e.onChangeAnswer({});return}const p=r.answerOption[d-1],h=yr({type:"QuestionnaireItemAnswerOption",value:p},"value"),m="value"+sr(h.type);e.onChangeAnswer({[m]:h.value})},defaultValue:_a(l==null?void 0:l.value)||(l==null?void 0:l.value),data:a})}function Bfe(e){var a;const{name:t,item:r,initial:n,onChangeAnswer:o,response:i}=e;return!((a=r.answerOption)!=null&&a.length)&&!r.answerValueSet?s.jsx(t3,{}):r.answerValueSet?s.jsx(x4,{name:t,binding:r.answerValueSet,onChange:l=>o({valueCoding:l})}):s.jsx(Ufe,{name:(i==null?void 0:i.id)??t,item:r,initial:n,response:i,onChangeAnswer:o})}function Ufe(e){const{name:t,item:r,initial:n,onChangeAnswer:o,response:i}=e,a=Sa("QuestionnaireItemAnswerOption","value[x]"),l=yr({type:"QuestionnaireItemInitial",value:n},"value"),c=[];let u;if(r.answerOption)for(let h=0;h<r.answerOption.length;h++){const m=r.answerOption[h],g=`${t}-option-${h}`,v=yr({type:"QuestionnaireItemAnswerOption",value:m},"value");l&&Ir(v)===Ir(l)&&(u=g),c.push([g,v])}const d=a1(i),p=Hfe(c,d);return s.jsx(Wp.Group,{name:t,value:p??u,onChange:h=>{const m=c.find(g=>g[0]===h);if(m){const g=m[1],v="value"+sr(g.type);o({[v]:g.value})}},children:c.map(([h,m])=>s.jsx(Wp,{id:h,value:h,py:4,label:s.jsx(To,{property:a,propertyType:m.type,value:m.value})},h))})}function t3(){return s.jsx(le,{disabled:!0,placeholder:"No Answers Defined"})}function r3(e){return yr({type:"QuestionnaireItemAnswer",value:e},"value")}function a1(e,t=0){const r=e.answer;return r3((r==null?void 0:r[t])??{})}function Wfe(e){const t=e.answer;return t?t.map(n=>r3(n)).map(n=>_a(n==null?void 0:n.value)||(n==null?void 0:n.value)):[]}function Hfe(e,t){var r;return(r=e.find(n=>mm(n[1].value,t==null?void 0:t.value)))==null?void 0:r[0]}function aC(e){if(e)return e.type==="CodeableConcept"?js(e.value):e.type==="Coding"?_a(e.value):e.type==="Reference"?zfe(e):e.value.toString()}function qfe(e){var t;return!!((t=e.extension)!=null&&t.some(r=>{var n,o,i;return r.url==="http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl"&&((i=(o=(n=r.valueCodeableConcept)==null?void 0:n.coding)==null?void 0:o[0])==null?void 0:i.code)==="drop-down"}))}function Gfe(e){var i;if(((i=e.answerOption)==null?void 0:i.length)===0)return{propertyName:"",data:[]};const t=e.answerOption[0],r=yr({type:"QuestionnaireItemAnswerOption",value:t},"value"),n="value"+sr(r.type),o=(e.answerOption??[]).map(a=>({value:sC(a,n),label:sC(a,n)}));return{propertyName:n,data:o}}function sC(e,t){var r;return _a(e.valueCoding)||((r=e[t])==null?void 0:r.toString())}const Qfe=W(e=>({section:{position:"relative",margin:"4px 4px 8px 0",padding:"6px 12px 16px 6px",border:`1.5px solid ${e.colors.gray[1]}`,borderRadius:e.radius.sm,transition:"all 0.1s"},hovering:{border:`1.5px solid ${e.colors.blue[5]}`},editing:{border:`1.5px solid ${e.colors.gray[1]}`,borderLeft:`4px solid ${e.colors.blue[5]}`},questionBody:{maxWidth:600},topActions:{position:"absolute",right:32,top:1,padding:4,color:e.colors.gray[5],fontSize:e.fontSizes.xs},bottomActions:{position:"absolute",right:4,bottom:0,fontSize:e.fontSizes.xs,"& a":{marginLeft:8}},movementActions:{position:"absolute",right:8,top:0,paddingTop:8,fontSize:e.fontSizes.xs,"& a":{marginLeft:8}},movementIcons:{color:e.colors.gray[5]},columnAlignment:{display:"flex",flexDirection:"column"},linkIdInput:{width:100,marginBottom:4},typeSelect:{width:100}}));function Kfe(e){const t=ae(),r=Xe(e.questionnaire),[n,o]=f.useState(!1),[i,a]=f.useState(),[l,c]=f.useState(),[u,d]=f.useState();function p(){d(void 0)}function h(){c(void 0)}f.useEffect(()=>{t.requestSchema("Questionnaire").then(()=>o(!0)).catch(console.log)},[t]),f.useEffect(()=>(a(Zfe(r??{resourceType:"Questionnaire"})),document.addEventListener("mouseover",p),document.addEventListener("click",h),()=>{document.removeEventListener("mouseover",p),document.removeEventListener("click",h)}),[r]);const m=(g,v)=>{a(g),e.autoSave&&!v&&e.onSubmit&&e.onSubmit(g)};return!n||!i?null:s.jsx("div",{children:s.jsxs(De,{testid:"questionnaire-form",onSubmit:()=>e.onSubmit(i),children:[s.jsx(n3,{item:i,selectedKey:l,setSelectedKey:c,hoverKey:u,setHoverKey:d,onChange:m}),s.jsx(re,{type:"submit",children:"Save"})]})})}function n3(e){var C;const{classes:t,cx:r}=Qfe(),n=e.item,o=e.item,i=Fo(e.item),a=i||o.type===st.group,l=o.linkId??"[untitled]",c=e.selectedKey===e.item.id,u=e.hoverKey===e.item.id,d=f.useRef();d.current=e.item;function p(O){ct(O),e.setSelectedKey(e.item.id)}function h(O){ct(O),e.setHoverKey(e.item.id)}function m(O){var E;const P=d.current;e.onChange({...P,item:(E=P.item)==null?void 0:E.map($=>$.id===O.id?O:$)})}function g(O,P){e.onChange({...e.item,item:[...e.item.item??[],O]},P)}function v(O){var P;e.onChange({...e.item,item:(P=e.item.item)==null?void 0:P.filter(E=>E!==O)})}function _(O,P){e.onChange({...d.current,[O]:P})}function y(O){e.onChange({...e.item,...O})}function x(O){var P;e.onChange({...e.item,item:(P=e.item.item)==null?void 0:P.map(E=>E===O?{...E,repeats:!E.repeats}:E)})}function w(O,P){const E=rpe(e.item.item,O,P);e.onChange({...e.item,item:E})}const b=r(t.section,{[t.editing]:c,[t.hovering]:u&&!c});return s.jsxs("div",{"data-testid":o.linkId,className:b,onClick:p,onMouseOver:h,onFocus:h,children:[s.jsx("div",{className:t.questionBody,children:c?s.jsxs(s.Fragment,{children:[i&&s.jsx(le,{size:"xl",defaultValue:n.title,onBlur:O=>_("title",O.currentTarget.value)}),!i&&s.jsx(Ic,{autosize:!0,minRows:2,defaultValue:o.text,onBlur:O=>_("text",O.currentTarget.value)}),o.type==="reference"&&s.jsx(Jfe,{item:o,onChange:y}),$fe(o)&&s.jsx(Yfe,{item:o,onChange:O=>y(O)})]}):s.jsxs(s.Fragment,{children:[n.title&&s.jsx(ue,{children:n.title}),o.text&&s.jsx("div",{children:o.text}),!a&&s.jsx(wy,{item:o,index:0,onChange:()=>{},response:{}})]})}),(C=o.item)==null?void 0:C.map((O,P)=>s.jsx("div",{children:s.jsx(n3,{item:O,selectedKey:e.selectedKey,setSelectedKey:e.setSelectedKey,hoverKey:e.hoverKey,isFirst:P===0,isLast:P===(e.item.item??[]).length-1,setHoverKey:e.setHoverKey,onChange:m,onRemove:()=>v(O),onRepeatable:x,onMoveUp:()=>w(P,-1),onMoveDown:()=>w(P,1)})},O.id)),!a&&s.jsx("div",{className:t.topActions,children:c?s.jsxs(s.Fragment,{children:[s.jsx(le,{size:"xs",className:t.linkIdInput,defaultValue:o.linkId,onBlur:O=>_("linkId",O.currentTarget.value)}),!a&&s.jsx(mt,{size:"xs",className:t.typeSelect,defaultValue:o.type,onChange:O=>_("type",O.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"}]})]}):s.jsx("div",{children:l})}),!i&&s.jsx(ie,{className:t.movementActions,children:s.jsxs(ie,{className:t.columnAlignment,children:[!e.isFirst&&s.jsx(Le,{href:"#",onClick:O=>{O.preventDefault(),e.onMoveUp&&e.onMoveUp()},children:s.jsx(Lle,{"data-testid":"up-button",size:15,className:t.movementIcons})}),!e.isLast&&s.jsx(Le,{href:"#",onClick:O=>{O.preventDefault(),e.onMoveDown&&e.onMoveDown()},children:s.jsx(Mle,{"data-testid":"down-button",size:15,className:t.movementIcons})})]})}),s.jsxs("div",{className:t.bottomActions,children:[a&&s.jsxs(s.Fragment,{children:[s.jsx(Le,{href:"#",onClick:O=>{O.preventDefault(),g({id:ua(),linkId:Sy("q"),type:"string",text:"Question"})},children:"Add item"}),s.jsx(Le,{href:"#",onClick:O=>{O.preventDefault(),g({id:ua(),linkId:Sy("g"),type:"group",text:"Group"},!0)},children:"Add group"})]}),i&&s.jsx(Le,{href:"#",onClick:O=>{O.preventDefault(),g(tpe(),!0)},children:"Add Page"}),c&&!i&&s.jsxs(s.Fragment,{children:[s.jsx(Le,{href:"#",onClick:O=>{O.preventDefault(),e.onRepeatable&&e.onRepeatable(o)},children:o.repeats?"Remove Repeatable":"Make Repeatable"}),s.jsx(Le,{href:"#",onClick:O=>{O.preventDefault(),e.onRemove&&e.onRemove()},children:"Remove"})]})]})]})}function Yfe(e){const t=Sa("QuestionnaireItemAnswerOption","value[x]"),r=e.item.answerOption??[];return s.jsxs("div",{children:[e.item.answerValueSet!==void 0?s.jsx(le,{placeholder:"Enter Value Set",defaultValue:e.item.answerValueSet,onChange:n=>e.onChange({...e.item,answerValueSet:n.target.value})}):s.jsx(Xfe,{options:r,property:t,item:e.item,onChange:e.onChange}),s.jsxs(ie,{display:"flex",children:[s.jsx(Le,{href:"#",onClick:n=>{ct(n),e.onChange({...e.item,answerValueSet:void 0,answerOption:[...r,{id:ua()}]})},children:"Add choice"}),s.jsx(pm,{w:"lg"}),s.jsx(Le,{href:"#",onClick:n=>{ct(n),e.onChange({...e.item,answerOption:[],answerValueSet:""})},children:"Add value set"})]})]})}function Xfe(e){return s.jsx("div",{children:e.options.map(t=>{const[r,n]=Bc({type:"QuestionnaireItemAnswerOption",value:t},"value");return s.jsxs("div",{style:{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center",width:"80%"},children:[s.jsx("div",{children:s.jsx(la,{name:"value[x]",property:e.property,defaultPropertyType:n,defaultValue:r,onChange:(o,i)=>{const a=[...e.options],l=a.findIndex(c=>c.id===t.id);a[l]={id:t.id,[i]:o},e.onChange({...e.item,answerOption:a})}},t.id)}),s.jsx("div",{children:s.jsx(Le,{href:"#",onClick:o=>{ct(o),e.onChange({...e.item,answerOption:e.options.filter(i=>i.id!==t.id)})},children:"Remove"})})]},t.id)})})}function Jfe(e){const t=X4(e.item)??[];return s.jsxs(s.Fragment,{children:[t.map((r,n)=>s.jsxs(Y,{children:[s.jsx(Vx,{name:"resourceType",placeholder:"Resource Type",defaultValue:r,onChange:o=>{e.onChange(Ug(e.item,t.map(i=>i===r?o:i)))}}),s.jsx(Le,{href:"#",onClick:o=>{ct(o),e.onChange(Ug(e.item,t.filter(i=>i!==r)))},children:"Remove"})]},`${r}-${n}`)),s.jsx(Le,{href:"#",onClick:r=>{ct(r),e.onChange(Ug(e.item,[...t,""]))},children:"Add Resource Type"})]})}let by=1,_y=1;function Sy(e){return e+by++}function ua(){return"id-"+_y++}function Zfe(e){return{...e,id:e.id||ua(),item:o3(e.item)}}function o3(e){if(e)return e.forEach(t=>{var r,n;(r=t.id)!=null&&r.match(/^id-\d+$/)&&(_y=Math.max(_y,parseInt(t.id.substring(3),10)+1)),(n=t.linkId)!=null&&n.match(/^q\d+$/)&&(by=Math.max(by,parseInt(t.linkId.substring(1),10)+1))}),e.map(t=>({...t,id:t.id||ua(),item:o3(t.item),answerOption:epe(t.answerOption)}))}function epe(e){if(e)return e.map(t=>({...t,id:t.id||ua()}))}function tpe(){return{id:ua(),linkId:Sy("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 rpe(e,t,r){const n=e??[],o=t+r;if(o<0||o>=n.length)return n;const i=[...n];return[i[t],i[o]]=[i[o],i[t]],i}function i3(e){const{item:t,response:r,onChange:n}=e,[o,i]=f.useState(npe(t,r??{}));if(!e.checkForQuestionEnabled(t)||!r)return null;if(t.type===st.display)return s.jsx("p",{children:t.text},t.linkId);const a=(t==null?void 0:t.repeats)&&t.type!==st.choice&&t.type!==st.openChoice;return t.type===st.boolean?s.jsx(wy,{item:t,response:r,onChange:l=>n([l]),index:0},t.linkId):s.jsxs(ot,{htmlFor:e.item.linkId,title:e.item.text,withAsterisk:e.item.required,children:[[...Array(o)].map((l,c)=>s.jsx(wy,{item:t,response:r,onChange:u=>n([u]),index:c},`${t.linkId}-${c}`)),a&&s.jsx(Le,{onClick:()=>i(l=>l+1),children:"Add Item"})]},e.item.linkId)}function npe(e,t){if(e.type===st.choice||e.type===st.openChoice)return 1;const r=t.answer;return r!=null&&r.length?r.length:1}function a3(e){const[t,r]=f.useState(e.response);if(t.length===0)return null;function n(i,a){const l=t.map((c,u)=>u===a?i[0]:c);r(l),e.onChange(l)}function o(){const i=Z4(e.item);r([...t,i])}return s.jsxs(s.Fragment,{children:[t.map((i,a)=>s.jsx(s3,{item:e.item,response:i,checkForQuestionEnabled:e.checkForQuestionEnabled,onChange:l=>n(l,a)},i.id)),e.item.repeats&&s.jsx(Le,{onClick:o,children:`Add Group: ${e.item.text}`})]})}function s3(e){var i;const{response:t,checkForQuestionEnabled:r,onChange:n}=e;function o(a){var d;const l=(d=t.item)==null?void 0:d.map(p=>a.find(m=>m.id===p.id)??p),c=l==null?void 0:l.concat(a.slice(1)),u={...t,item:c};n([u])}return e.checkForQuestionEnabled(e.item)?s.jsxs("div",{children:[e.item.text&&s.jsx(ue,{order:3,mb:"md",children:e.item.text}),s.jsx(je,{children:(i=e.item.item)==null?void 0:i.map(a=>{var l,c,u;return a.type===st.group?a.repeats?s.jsx(a3,{item:a,response:((l=t.item)==null?void 0:l.filter(d=>d.linkId===a.linkId))??[],checkForQuestionEnabled:r,onChange:o},a.linkId):s.jsx(s3,{item:a,checkForQuestionEnabled:r,response:((c=t.item)==null?void 0:c.find(d=>d.linkId===a.linkId))??{},onChange:o},a.linkId):s.jsx(i3,{item:a,response:(u=t.item)==null?void 0:u.find(d=>d.linkId===a.linkId),onChange:o,checkForQuestionEnabled:r},a.linkId)})})]},e.item.linkId):null}function ope(e){const{items:t,response:r,activePage:n,onChange:o,nextStep:i,prevStep:a,numberOfPages:l,renderPages:c,submitButtonText:u,checkForQuestionEnabled:d}=e,p=t.map(h=>{var v;const m=((v=r==null?void 0:r.item)==null?void 0:v.filter(_=>_.linkId===h.linkId))??[],g=h.type===st.group?s.jsx(a3,{item:h,response:m,onChange:o,checkForQuestionEnabled:d},h.linkId):s.jsx(i3,{item:h,response:m==null?void 0:m[0],onChange:o,checkForQuestionEnabled:d},h.linkId);return c?s.jsx(uc.Step,{label:h.text,children:g},h.linkId):g});return s.jsxs(s.Fragment,{children:[c&&s.jsx(uc,{active:n??0,allowNextStepsSelect:!1,p:6,children:p}),!c&&s.jsx(je,{children:p}),s.jsx(ipe,{activePage:n??0,numberOfPages:l,nextStep:i,prevStep:a,submitButtonText:u})]})}function ipe(e){const t=e.activePage>0,r=e.activePage<e.numberOfPages-1,n=e.activePage===e.numberOfPages-1;return s.jsxs(Y,{position:"right",mt:"xl",spacing:"xs",children:[t&&s.jsx(re,{onClick:e.prevStep,children:"Back"}),r&&s.jsx(re,{onClick:o=>{o.currentTarget.closest("form").reportValidity()&&e.nextStep()},children:"Next"}),n&&s.jsx(re,{type:"submit",children:e.submitButtonText??"Submit"})]})}function l3(e){const t=ae(),r=t.getProfile(),[n,o]=f.useState(!1),i=Xe(e.questionnaire),[a,l]=f.useState(),[c,u]=f.useState(0);f.useEffect(()=>{t.requestSchema("Questionnaire").then(()=>t.requestSchema("QuestionnaireResponse")).then(()=>o(!0)).catch(console.log)},[t]),f.useEffect(()=>{l(i?Nfe(i):void 0)},[i]);function d(v){const _=(a==null?void 0:a.item)??[],x={resourceType:"QuestionnaireResponse",item:c3(_,Array.isArray(v)?v:[v])};l(x)}function p(v){return kfe(v,(a==null?void 0:a.item)??[])}if(!n||!i)return null;const h=Ffe(i),m=()=>u(v=>v+1),g=()=>u(v=>v-1);return s.jsx(e3.Provider,{value:{subject:e.subject,encounter:e.encounter},children:s.jsxs(De,{testid:"questionnaire-form",onSubmit:()=>{e.onSubmit&&a&&e.onSubmit({...a,questionnaire:nt(i),subject:e.subject,source:ht(r),authored:new Date().toISOString(),status:"completed"})},children:[i.title&&s.jsx(ue,{children:i.title}),s.jsx(ope,{items:i.item??[],response:a,onChange:d,renderPages:h>1,activePage:c,numberOfPages:h,submitButtonText:e.submitButtonText,checkForQuestionEnabled:p,nextStep:m,prevStep:g})]})})}function ape(e,t){const r=c3(e.item??[],t.item??[]);return{...t,item:r.length>0?r:void 0,answer:t.answer&&t.answer.length>0?t.answer:e.answer}}function c3(e,t){const r=[],n=new Set;for(const o of e){const i=o.id,a=t.find(l=>l.id===i);a?(r.push(ape(o,a)),n.add(a.id)):r.push(o)}for(const o of t)n.has(o.id)||r.push(o);return r}const spe=W(e=>({section:{position:"relative",margin:"4px 4px 8px 0",padding:"6px 12px 16px 6px",border:`1.5px solid ${e.colors.gray[3]}`,borderRadius:e.radius.sm,transition:"all 0.1s"}})),lpe=["gender","age","gestationalAge","context","appliesTo","category"],cpe={definition:{resourceType:"ObservationDefinition"},onSubmit:()=>{}};function upe(e){e=Object.assign(cpe,e);const t=e.definition,[r,n]=f.useState([]),[o,i]=f.useState(1),[a,l]=f.useState(1);return f.useEffect(()=>{const g=ppe(t,l);n(hpe(g.qualifiedInterval||[],i))},[t]),s.jsxs(De,{testid:"reference-range-editor",onSubmit:c,children:[s.jsx(je,{children:r.map(g=>{var v;return s.jsx(dpe,{unit:gpe((v=t.quantitativeDetails)==null?void 0:v.unit),onChange:p,onAdd:h,onRemove:m,onRemoveGroup:d,intervalGroup:g},`group-${g.id}`)})}),s.jsx(vr,{title:"Add Group",size:"sm",onClick:g=>{ct(g),u({id:`group-id-${o}`,filters:{},intervals:[]}),i(v=>v+1)},children:s.jsx(Ix,{})}),s.jsx(Y,{position:"right",children:s.jsx(re,{type:"submit",children:"Save"})})]});function c(){const g=r.flatMap(v=>v.intervals).filter(v=>!vpe(v));e.onSubmit({...t,qualifiedInterval:g})}function u(g){n(v=>[...v,g])}function d(g){n(v=>v.filter(_=>_.id!==g.id))}function p(g,v){n(_=>{_=[..._];const y=_.find(w=>w.id===g),x=y==null?void 0:y.intervals.findIndex(w=>w.id===v.id);return x!==void 0&&(y!=null&&y.intervals[x])&&(y.intervals[x]=v),_})}function h(g,v){v.id===void 0&&(v.id=`id-${a}`,l(_=>_+1)),n(_=>{_=[..._];const y=_.findIndex(x=>x.id===g);if(y!==-1){const x={..._[y]};v={...v,...x.filters},x.intervals=[...x.intervals,v],_[y]=x}return _})}function m(g,v){n(_=>{_=[..._];const y=_.find(x=>x.id===g);return y&&(y.intervals=y.intervals.filter(x=>x.id!==v.id)),_})}}function dpe(e){const{intervalGroup:t,unit:r}=e,{classes:n}=spe();return s.jsx(Uc,{"data-testid":t.id,className:n.section,children:s.jsxs(je,{spacing:"lg",children:[s.jsx(Y,{position:"right",children:s.jsx(vr,{title:"Remove Group","data-testid":`remove-group-button-${t.id}`,size:"sm",onClick:o=>{ct(o),e.onRemoveGroup(t)},children:s.jsx(dh,{})},`remove-group-button-${t.id}`)}),s.jsx(fpe,{intervalGroup:t,onChange:e.onChange}),s.jsx(hr,{}),t.intervals.map(o=>s.jsxs(je,{spacing:"xs",children:[s.jsxs(Y,{children:[s.jsx(le,{"data-testid":`condition-${o.id}`,defaultValue:o.condition,label:"Condition: ",size:"sm",onChange:i=>{ct(i),e.onChange(t.id,{...o,condition:i.currentTarget.value.trim()})}},`condition-${o.id}`),s.jsx(vr,{title:"Remove Interval",size:"sm","data-testid":`remove-interval-${o.id}`,onClick:i=>{ct(i),e.onRemove(t.id,o)},children:s.jsx(dh,{})},`remove-interval-${o.id}`)]}),s.jsx(qx,{onChange:i=>{e.onChange(t.id,{...o,range:i})},name:`range-${o.id}`,defaultValue:o.range},`range-${o.id}`)]},`interval-${o.id}`)),s.jsx(vr,{title:"Add Interval",size:"sm",onClick:o=>{ct(o),e.onAdd(t.id,{range:{low:{unit:r},high:{unit:r}}})},children:s.jsx(Ix,{})})]})})}function fpe(e){var n,o;const{intervalGroup:t,onChange:r}=e;t.filters.age||(t.filters.age={});for(const i of["low","high"])(n=t.filters.age[i])!=null&&n.unit||(t.filters.age[i]={...t.filters.age[i],unit:"years",system:"http://unitsofmeasure.org"});return s.jsxs(je,{style:{maxWidth:"50%"},children:[s.jsx(Y,{children:s.jsx(mt,{data:["","male","female"],label:"Gender:",defaultValue:t.filters.gender||"",onChange:i=>{for(const a of t.intervals){let l=i.currentTarget.value;l===""&&(l=void 0),r(t.id,{...a,gender:l})}}})}),s.jsxs(Y,{spacing:"xs",children:[s.jsx(oe,{component:"label",htmlFor:`div-age-${t.id}`,children:"Age:"}),s.jsx("div",{id:`div-age-${t.id}`,children:s.jsx(qx,{name:`age-${t.id}`,defaultValue:t.filters.age,onChange:i=>{for(const a of t.intervals)r(t.id,{...a,age:i})}},`age-${t.id}`)})]}),s.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 a of t.intervals){let l=i.currentTarget.value;l===""?(l=void 0,r(t.id,{...a,context:void 0})):r(t.id,{...a,context:{text:l,coding:[{code:l,system:"http://terminology.hl7.org/CodeSystem/referencerange-meaning"}]}})}}}),s.jsx(mt,{data:["","reference","critical","absolute"],label:"Category: ",defaultValue:t.filters.category,onChange:i=>{for(const a of t.intervals){const l=i.currentTarget.value;l===""?r(t.id,{...a,category:void 0}):r(t.id,{...a,category:l})}}})]})}function ppe(e,t){const r=e.qualifiedInterval||[];let n=Math.max(...r.map(o=>{var a;const i=parseInt(((a=o.id)==null?void 0:a.substring(3))||"",10);return isNaN(i)?Number.NEGATIVE_INFINITY:i}))+1;return Number.isFinite(n)||(n=1),e={...e,qualifiedInterval:r.map(o=>({...o,id:o.id||`id-${n++}`}))},t(n),e}function hpe(e,t){let r=1;const n={};for(const o of e){const i=mpe(o);i in n||(n[i]={id:`group-id-${r++}`,filters:Object.fromEntries(lpe.map(a=>[a,o[a]])),intervals:[]}),n[i].intervals.push(o)}return t(r),Object.values(n)}function mpe(e){var r,n;return[`gender=${e.gender}`,`age=${dc(e.age)}`,`gestationalAge=${dc(e.gestationalAge)}`,`context=${(r=e.context)==null?void 0:r.text}`,`appliesTo=${(n=e.appliesTo)==null?void 0:n.map(o=>o.text).join("+")}`,`category=${e.category}`].join(":")}function gpe(e){return e&&(Sie(e,"http://unitsofmeasure.org")||e.text)}function vpe(e){var t,r,n,o;return((r=(t=e.range)==null?void 0:t.low)==null?void 0:r.value)===void 0&&((o=(n=e.range)==null?void 0:n.high)==null?void 0:o.value)===void 0}function ype(e){var u;const t=ae(),r=Xe(e.value),[n,o]=f.useState(!1),[i,a]=f.useState();if(f.useEffect(()=>{r&&!n&&(t.executeBatch(l(r)).then(a).catch(console.log),o(!0))},[t,r,n]),!r||!i)return null;return s.jsx(sn,{children:(u=r.action)==null?void 0:u.map((d,p)=>{var v,_,y,x,w,b;const h=d.resource&&c(d.resource),m=(_=(v=h==null?void 0:h.input)==null?void 0:v[0])==null?void 0:_.valueReference,g=(x=(y=h==null?void 0:h.output)==null?void 0:y[0])==null?void 0:x.valueReference;return s.jsxs(f.Fragment,{children:[s.jsx(sn.Col,{span:1,p:"md",children:(h==null?void 0:h.status)==="completed"?s.jsx(Gle,{}):s.jsx(wce,{color:"gray"})}),s.jsxs(sn.Col,{span:9,p:"xs",children:[s.jsx(oe,{weight:500,children:d.title}),d.description&&s.jsx("div",{children:d.description}),s.jsxs("div",{children:["Last edited by ",s.jsx(Wc,{value:(w=h==null?void 0:h.meta)==null?void 0:w.author})," on ",Dr((b=h==null?void 0:h.meta)==null?void 0:b.lastUpdated)]}),s.jsxs("div",{children:["Status: ",s.jsx(P4,{status:(h==null?void 0:h.status)||"unknown"})]})]}),s.jsxs(sn.Col,{span:2,p:"md",children:[m&&!g&&s.jsx(re,{onClick:()=>e.onStart(h,m),children:"Start"}),m&&g&&s.jsx(re,{onClick:()=>e.onEdit(h,m,g),children:"Edit"})]})]},`action-${p}`)})});function l(d){var h;const p=[];if(d.action)for(const m of d.action)(h=m.resource)!=null&&h.reference&&p.push({request:{method:"GET",url:m.resource.reference}});return{resourceType:"Bundle",type:"batch",entry:p}}function c(d){for(const p of i==null?void 0:i.entry)if(p.resource&&d.reference===nt(p.resource))return p.resource}}function u3(e,t){const r=xpe(e,t);return wpe(r,e,t)}function xpe(e,t){const r=e.length,n=t.length,o=r+n+1,i=1+2*o,a=i/2|0,l=new Array(i);l[a+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=a+u,p=d+1,h=d-1,m=l[p],g=l[h];let v,_=0;u===-c||u!==c&&g.i<m.i?(_=m.i,v=m):(_=g.i+1,v=g),l[h]=void 0;let y=_-u,x={i:_,j:y,prev:bpe(v),snake:!1};for(;_<r&&y<n&&e[_]===t[y];)_++,y++;if(_>x.i&&(x={i:_,j:y,prev:x,snake:!0}),l[d]=x,_>=r&&y>=n)return l[d]}l[a+c-1]=void 0}}function wpe(e,t,r){const n=[];let o=e;for(o.snake&&(o=o.prev);o!=null&&o.prev&&o.prev.j>=0;){const i=o.i,a=o.j;o=o.prev;const l=o.i,c=o.j,u={position:l,lines:t.slice(l,i)},d={position:c,lines:r.slice(c,a)};let p;u.lines.length===0&&d.lines.length>0?p="insert":u.lines.length>0&&d.lines.length===0?p="delete":p="change",n.push({original:u,revised:d,type:p}),o.snake&&(o=o.prev)}return n}function bpe(e){return e&&!e.snake&&e.prev?e.prev:e}function _pe(e){const t=e.entry.filter(n=>!!n.resource).map(n=>{var o;return{meta:(o=n.resource)==null?void 0:o.meta,lines:Ir(n.resource,!0).match(/[^\r\n]+/g)}}).sort((n,o)=>n.meta.lastUpdated.localeCompare(o.meta.lastUpdated)),r=t[0].lines.map(n=>({id:t[0].meta.versionId,meta:t[0].meta,value:n,span:1}));return Spe(r,t),Ppe(r),r}function Spe(e,t){for(let r=1;r<t.length;r++){const n=u3(t[r-1].lines,t[r].lines);for(const o of n){const i=o.original.position,a=o.original.lines,l=o.revised.lines;if((o.type==="delete"||o.type==="change")&&e.splice(i,a.length),o.type==="insert"||o.type==="change")for(let c=0;c<o.revised.lines.length;c++)e.splice(i+c,0,{id:t[r].meta.versionId,meta:t[r].meta,value:l[c],span:1})}}}function Ppe(e){let t=0;for(;t<e.length;){let r=t;for(;r<e.length&&e[r].id===e[t].id;)e[r].span=-1,r++;e[t].span=r-t,t=r}}function jpe(e,t){return`/${e.resourceType}/${e.id}/_history/${t}`}function Ope(e){const t=Math.floor((Date.now()-Date.parse(e))/1e3),r=Math.floor(t/31536e3);if(r>0)return La(r,"year");const n=Math.floor(t/2592e3);if(n>0)return La(n,"month");const o=Math.floor(t/86400);if(o>0)return La(o,"day");const i=Math.floor(t/3600);if(i>0)return La(i,"hour");const a=Math.floor(t/60);return a>0?La(a,"minute"):La(t,"second")}function La(e,t){return`${e} ${e===1?t:t+"s"} ago`}const Cpe=W(e=>({container:{overflowX:"auto"},root:{border:`0.1px solid ${e.colors.gray[3]}`,borderCollapse:"collapse",borderRadius:e.radius.sm,borderSpacing:0,fontSize:e.fontSizes.xs,width:"100%","& td":{padding:"2px 4px 0 4px",verticalAlign:"top",whiteSpace:"nowrap"}},startRow:{borderTop:`0.1px solid ${e.colors.gray[3]}`},normalRow:{borderTop:0},author:{lineHeight:"10px"},dateTime:{borderRight:`0.1px solid ${e.colors.gray[3]}`,lineHeight:"20px"},lineNumber:{backgroundColor:e.colors.gray[1],border:0,color:e.colors.gray[5],fontFamily:e.fontFamilyMonospace,padding:`${e.spacing.xs} ${e.spacing.sm}`,textAlign:"right"},line:{fontFamily:e.fontFamilyMonospace,fontSize:e.fontSizes.sm,padding:`${e.spacing.xs} ${e.spacing.sm}`},pre:{margin:0}}));function Epe(e){var l,c;const{classes:t}=Cpe(),r=ae(),[n,o]=f.useState(e.history);if(f.useEffect(()=>{!e.history&&e.resourceType&&e.id&&r.readHistory(e.resourceType,e.id).then(o).catch(console.log)},[r,e.history,e.resourceType,e.id]),!n)return s.jsx("div",{children:"Loading..."});const i=(c=(l=n.entry)==null?void 0:l[0])==null?void 0:c.resource;if(!i)return null;const a=_pe(n);return s.jsx("div",{className:t.container,children:s.jsx("table",{className:t.root,children:s.jsx("tbody",{children:a.map((u,d)=>s.jsxs("tr",{className:u.span>0?t.startRow:t.normalRow,children:[u.span>0&&s.jsxs(s.Fragment,{children:[s.jsx("td",{className:t.author,rowSpan:u.span,children:s.jsx(ds,{value:u.meta.author,link:!0})}),s.jsx("td",{className:t.dateTime,rowSpan:u.span,children:s.jsx($e,{to:jpe(i,u.meta.versionId),children:Ope(u.meta.lastUpdated)})})]}),s.jsx("td",{className:t.lineNumber,children:d+1}),s.jsx("td",{className:t.line,children:s.jsx("pre",{className:t.pre,children:u.value})})]},"row-"+d))})})})}const $pe=W(e=>({removed:{color:e.colors.red[7],textDecoration:"line-through"},added:{color:e.colors.green[7]}}));function kpe(e){let t=e.original,r=e.revised;e.ignoreMeta&&(t={...t,meta:void 0},r={...r,meta:void 0});const n=Ir(t,!0).match(/[^\r\n]+/g),o=Ir(r,!0).match(/[^\r\n]+/g),i=u3(n,o);return s.jsx("pre",{style:{color:"gray"},children:i.map((a,l)=>s.jsx(Rpe,{delta:a},"delta"+l))})}function Rpe(e){const{classes:t}=$pe();return s.jsxs(s.Fragment,{children:["...",s.jsx("br",{}),e.delta.original.lines.length>0&&s.jsx("div",{className:t.removed,children:e.delta.original.lines.join(`
|
|
190
|
+
`)}function Hx(e,t){var r;return(r=e==null?void 0:e.issue)==null?void 0:r.filter(n=>{var o;return y4((o=n.expression)==null?void 0:o[0],t)})}function y4(e,t){if(e===t)return!0;if(!e||!t)return!1;const r=e.indexOf(".");if(r>=0&&e.substring(r+1)===t)return!0;const n=t.indexOf(".");return n>=0&&t.substring(n+1)===e}function ot(e){return s.jsx(Ut.Wrapper,{id:e.htmlFor,label:e.title,description:e.description,withAsterisk:e.withAsterisk,error:ut(e.outcome,e.htmlFor),children:e.children})}function gy(e,t,r,n,o){const i=n.type;if(i.length>1)for(const a of i){const l=t.replace("[x]",sr(a.code));l in e&&delete e[l]}return e[r]=o,e}function pue(e){const[t,r]=f.useState(e.defaultValue);function n(o){const i=mue(o);r(i),e.onChange&&e.onChange(i)}return s.jsx(Fx,{binding:e.binding,name:e.name,placeholder:e.placeholder,defaultValue:t&&hue(t),maxSelectedValues:1,onChange:n})}function hue(e){var t;return(t=e.coding)==null?void 0:t.map(r=>({system:r.system,code:r.code,display:r.display}))}function mue(e){if(e.length!==0)return{coding:e.map(t=>({system:t.system,code:t.code,display:t.display}))}}function x4(e){const[t,r]=f.useState(e.defaultValue);function n(o){const i=o[0],a=i&&vue(i);r(a),e.onChange&&e.onChange(a)}return s.jsx(Fx,{binding:e.binding,name:e.name,placeholder:e.placeholder,defaultValue:t&&gue(t),maxSelectedValues:1,onChange:n})}function gue(e){return{system:e.system,code:e.code,display:e.display}}function vue(e){return{system:e.system,code:e.code,display:e.display}}function w4(e){const[t,r]=f.useState(e.defaultValue),n=f.useRef();n.current=t;function o(c){c&&Object.keys(c).length===0&&(c=void 0),r(c),e.onChange&&e.onChange(c)}function i(c){const u={...n.current,system:c};c||delete u.system,o(u)}function a(c){const u={...n.current,use:c};c||delete u.use,o(u)}function l(c){const u={...n.current,value:c};c||delete u.value,o(u)}return s.jsxs(Y,{spacing:"xs",grow:!0,noWrap:!0,children:[s.jsx(mt,{"data-testid":"system",defaultValue:t==null?void 0:t.system,onChange:c=>i(c.currentTarget.value),data:["","email","phone","fax","pager","sms","other"]}),s.jsx(mt,{"data-testid":"use",defaultValue:t==null?void 0:t.use,onChange:c=>a(c.currentTarget.value),data:["","home","work","temp","old","mobile"]}),s.jsx(le,{placeholder:"Value",defaultValue:t==null?void 0:t.value,onChange:c=>l(c.currentTarget.value)})]})}function yue(e){var l;const[t,r]=f.useState(e.defaultValue),n=f.useRef();n.current=t;function o(c){r(c),e.onChange&&e.onChange(c)}function i(c){const u={...n.current,name:c};c||delete u.name,o(u)}function a(c){const u={...n.current,telecom:c&&[c]};c||delete u.telecom,o(u)}return s.jsxs(Y,{spacing:"xs",grow:!0,noWrap:!0,children:[s.jsx(le,{"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)}),s.jsx(w4,{name:e.name+"-telecom",defaultValue:(l=t==null?void 0:t.telecom)==null?void 0:l[0],onChange:a})]})}function xue(e){if(!e)return"";const t=new Date(e);return gm(t)?t.toLocaleDateString("sv")+"T"+t.toLocaleTimeString("sv"):""}function b4(e){if(!e)return"";const t=new Date(e);return gm(t)?t.toISOString():""}var wue={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:"2.2.1-545c34fc",BASE_URL:"/",MODE:"production",DEV:!1,PROD:!0,SSR:!1};function aa(e){return s.jsx(le,{id:e.name,name:e.name,"data-autofocus":e.autoFocus,"data-testid":e.name,placeholder:e.placeholder,required:e.required,type:bue(),defaultValue:xue(e.defaultValue),autoFocus:e.autoFocus,error:ut(e.outcome,e.name),onChange:t=>{if(e.onChange){const r=t.currentTarget.value;e.onChange(b4(r))}}})}function bue(){return wue.NODE_ENV==="test"?"text":"datetime-local"}function _ue(e){return s.jsx(Fs,{id:e.name,name:e.name,"data-testid":"extension-input",defaultValue:Ir(e.defaultValue),deserialize:JSON.parse,onChange:t=>{e.onChange&&e.onChange(JSON.parse(t))}})}function Sue(e){var d,p,h;const[t,r]=f.useState(e.defaultValue),n=f.useRef();n.current=t;function o(m){r(m),e.onChange&&e.onChange(m)}function i(m){o({...n.current,use:m||void 0})}function a(m){o({...n.current,prefix:m?m.split(" "):void 0})}function l(m){o({...n.current,given:m?m.split(" "):void 0})}function c(m){o({...n.current,family:m||void 0})}function u(m){o({...n.current,suffix:m?m.split(" "):void 0})}return s.jsxs(Y,{spacing:"xs",grow:!0,noWrap:!0,children:[s.jsx(mt,{defaultValue:t==null?void 0:t.use,name:e.name+"-use","data-testid":"use",onChange:m=>i(m.currentTarget.value),data:["","temp","old","usual","official","nickname","anonymous","maiden"]}),s.jsx(le,{placeholder:"Prefix",name:e.name+"-prefix",defaultValue:(d=t==null?void 0:t.prefix)==null?void 0:d.join(" "),onChange:m=>a(m.currentTarget.value)}),s.jsx(le,{placeholder:"Given",name:e.name+"-given",defaultValue:(p=t==null?void 0:t.given)==null?void 0:p.join(" "),onChange:m=>l(m.currentTarget.value)}),s.jsx(le,{name:e.name+"-family",placeholder:"Family",defaultValue:t==null?void 0:t.family,onChange:m=>c(m.currentTarget.value)}),s.jsx(le,{placeholder:"Suffix",name:e.name+"-suffix",defaultValue:(h=t==null?void 0:t.suffix)==null?void 0:h.join(" "),onChange:m=>u(m.currentTarget.value)})]})}function Pue(e){const[t,r]=f.useState(e.defaultValue);function n(o){r(o),e.onChange&&e.onChange(o)}return s.jsxs(Y,{spacing:"xs",grow:!0,noWrap:!0,children:[s.jsx(le,{placeholder:"System",defaultValue:t==null?void 0:t.system,onChange:o=>n({...t,system:o.currentTarget.value})}),s.jsx(le,{placeholder:"Value",defaultValue:t==null?void 0:t.value,onChange:o=>n({...t,value:o.currentTarget.value})})]})}const jue=["USD","EUR","CAD","GBP","AUD"];function Oue(e){var c;const{onChange:t}=e,[r,n]=f.useState(e.defaultValue),o=f.useCallback(u=>{n(u),t&&t(u)},[t]),i=f.useCallback(u=>{o({...r,currency:u.currentTarget.value})},[r,o]),a=f.useCallback(u=>{o({...r,value:u.currentTarget.valueAsNumber})},[r,o]),l=s.jsx(mt,{defaultValue:r==null?void 0:r.currency,data:jue,styles:{input:{fontWeight:500,borderTopLeftRadius:0,borderBottomLeftRadius:0,width:92}},onChange:i});return s.jsx(le,{type:"number",label:e.label,placeholder:e.placeholder??"Value",defaultValue:((c=r==null?void 0:r.value)==null?void 0:c.toString())??"USD",icon:s.jsx(Xle,{size:14}),rightSection:l,rightSectionWidth:92,onChange:a})}function Cue(e){const[t,r]=f.useState(e.defaultValue);function n(o){r(o),e.onChange&&e.onChange(o)}return s.jsxs(Y,{spacing:"xs",grow:!0,noWrap:!0,children:[s.jsx(aa,{name:e.name+".start",placeholder:"Start",defaultValue:t==null?void 0:t.start,onChange:o=>n({...t,start:o})}),s.jsx(aa,{name:e.name+".end",placeholder:"End",defaultValue:t==null?void 0:t.end,onChange:o=>n({...t,end:o})})]})}function sa(e){const[t,r]=f.useState(e.defaultValue);function n(o){r(o),e.onChange&&e.onChange(o)}return s.jsxs(Y,{spacing:"xs",grow:!0,noWrap:!0,children:[s.jsx(mt,{style:{width:80},"data-testid":e.name+"-comparator",defaultValue:t==null?void 0:t.comparator,data:["","<","<=",">=",">"],onChange:o=>n({...t,comparator:o.currentTarget.value})}),s.jsx(le,{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=>{n({...t,value:Eue(o.currentTarget.value)})}}),s.jsx(le,{placeholder:"Unit","data-testid":e.name+"-unit",defaultValue:t==null?void 0:t.unit,onChange:o=>n({...t,unit:o.currentTarget.value})})]})}function Eue(e){if(e)return parseFloat(e)}function qx(e){const[t,r]=f.useState(e.defaultValue);function n(o){r(o),e.onChange&&e.onChange(o)}return s.jsxs(Y,{spacing:"xs",grow:!0,noWrap:!0,children:[s.jsx(sa,{name:e.name+"-low",defaultValue:t==null?void 0:t.low,onChange:o=>n({...t,low:o})}),s.jsx(sa,{name:e.name+"-high",defaultValue:t==null?void 0:t.high,onChange:o=>n({...t,high:o})})]})}function $ue(e){const[t,r]=f.useState(e.defaultValue);function n(o){r(o),e.onChange&&e.onChange(o)}return s.jsxs(Y,{spacing:"xs",grow:!0,noWrap:!0,children:[s.jsx(sa,{name:e.name+"-numerator",defaultValue:t==null?void 0:t.numerator,onChange:o=>n({...t,numerator:o})}),s.jsx(sa,{name:e.name+"-denominator",defaultValue:t==null?void 0:t.denominator,onChange:o=>n({...t,denominator:o})})]})}const kue={Observation:"code",User:"email:contains"},Rue=["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 Tue(e){return{value:nt(e),label:ko(e),resource:e}}function Vs(e){const t=ae(),{resourceType:r,searchCriteria:n}=e,[o,i]=f.useState(),a=Xe(e.defaultValue,i),l=e.onChange,c=f.useCallback(async(d,p)=>{const h=Due(r),m=new URLSearchParams({[h]:d,_count:"10",...n});return await t.searchResources(r,m,{signal:p})},[t,r,n]),u=f.useCallback(d=>{l&&l(d[0])},[l]);return e.defaultValue&&!o&&!a?null:s.jsx(Lx,{name:e.name,required:e.required,itemComponent:Iue,defaultValue:a,placeholder:e.placeholder,maxSelectedValues:1,toKey:nt,toOption:Tue,loadOptions:c,onChange:u,clearable:!0})}const Iue=f.forwardRef(({label:e,resource:t,...r},n)=>s.jsx("div",{ref:n,...r,children:s.jsxs(Y,{noWrap:!0,children:[s.jsx(Pi,{value:t}),s.jsxs("div",{children:[s.jsx(oe,{children:e}),s.jsx(oe,{size:"xs",color:"dimmed",children:t.birthDate})]})]})}));function Due(e){return kue[e]??(Rue.includes(e)?"name":"_id")}function jm(e){const t=Nue(e.targetTypes),r=Aue(e.defaultValue,t),[n,o]=f.useState(e.defaultValue),[i,a]=f.useState(r);function l(c){o(c),e.onChange&&e.onChange(c)}return s.jsxs(Y,{spacing:"xs",grow:!0,noWrap:!0,children:[t&&t.length>1&&s.jsx(mt,{"data-autofocus":e.autoFocus,"data-testid":"reference-input-resource-type-select",defaultValue:i,autoFocus:e.autoFocus,onChange:c=>a(c.currentTarget.value),data:t}),!t&&s.jsx(Vx,{autoFocus:e.autoFocus,testId:"reference-input-resource-type-input",defaultValue:i,onChange:a,name:e.name+"-resourceType",placeholder:"Resource Type"}),s.jsx(Vs,{resourceType:i,name:e.name+"-id",required:e.required,placeholder:e.placeholder,defaultValue:n,searchCriteria:e.searchCriteria,onChange:c=>{l(c?ht(c):void 0)}})]})}function Nue(e){if(!(!e||e.length===0||e.length===1&&e[0]==="Resource"))return e}function Aue(e,t){var n;const r=(n=e==null?void 0:e.reference)==null?void 0:n.split("/")[0];if(r)return r;if(t&&t.length>0)return t[0]}function Mue(e){const[t,r]=f.useState(e.defaultValue&&Array.isArray(e.defaultValue)?e.defaultValue:[]),n=f.useRef();n.current=t;function o(i){r(i),e.onChange&&e.onChange(i)}return s.jsxs(je,{style:{marginTop:"1rem",marginLeft:"1rem"},children:[t.map((i,a)=>s.jsxs(Y,{noWrap:!0,children:[s.jsx("div",{style:{flexGrow:1},children:s.jsx(la,{arrayElement:!0,property:e.property,name:e.name+"."+a,defaultValue:i,onChange:l=>{const c=[...n.current];c[a]=l,o(c)}})}),s.jsx("div",{children:s.jsx(vr,{title:"Remove",size:"sm",onClick:l=>{ct(l);const c=[...n.current];c.splice(a,1),o(c)},children:s.jsx(dh,{})})})]},`${a}-${t.length}`)),s.jsx(Y,{noWrap:!0,style:{justifyContent:"flex-end"},children:s.jsx("div",{children:s.jsx(vr,{title:"Add",size:"sm",color:"green",onClick:i=>{ct(i);const a=[...n.current];a.push(void 0),o(a)},children:s.jsx(Ix,{})})})})]})}const Lue=["sun","mon","tue","wed","thu","fri","sat"];function zue(e){const[t,r]=f.useState(e.defaultValue),[n,o]=f.useState(!1),i=f.useRef();return i.current=t,s.jsxs(s.Fragment,{children:[s.jsxs(Y,{spacing:"xs",grow:!0,noWrap:!0,children:[s.jsx("span",{children:R5(i.current)||"No repeat"}),s.jsx(re,{onClick:()=>o(!0),children:"Edit"})]}),s.jsx(Fue,{visible:n,defaultValue:i.current,onOk:a=>{e.onChange&&e.onChange(a),r(a),o(!1)},onCancel:()=>o(!1)})]})}const JO={repeat:{period:1,periodUnit:"d"}};function Fue(e){const[t,r]=f.useState(e.defaultValue||JO),n=f.useRef();n.current=t;function o(u){r({...n.current,event:[u]})}function i(u){r({...n.current,repeat:u})}function a(u){var d;i({...(d=n.current)==null?void 0:d.repeat,period:u})}function l(u){var d;i({...(d=n.current)==null?void 0:d.repeat,periodUnit:u})}function c(u){var d;i({...(d=n.current)==null?void 0:d.repeat,dayOfWeek:u})}return s.jsx(Ar,{title:"Timing",closeButtonProps:{"aria-label":"Close"},opened:e.visible,onClose:()=>e.onCancel(),children:s.jsxs(je,{children:[s.jsx(ot,{title:"Starts on",htmlFor:"timing-dialog-start",children:s.jsx(aa,{name:"timing-dialog-start",onChange:u=>o(u)})}),s.jsx(mx,{label:"Repeat",checked:!!t.repeat,onChange:u=>i(u.currentTarget.checked?JO.repeat:void 0)}),t.repeat&&s.jsxs(s.Fragment,{children:[s.jsx(ot,{title:"Repeat every",htmlFor:"timing-dialog-period",children:s.jsxs(Y,{spacing:"xs",grow:!0,noWrap:!0,children:[s.jsx(le,{type:"number",step:1,id:"timing-dialog-period",name:"timing-dialog-period",defaultValue:t.repeat.period||1,onChange:u=>a(parseInt(u.currentTarget.value,10)||1)}),s.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"&&s.jsx(ot,{title:"Repeat on",children:s.jsx(Yf.Group,{multiple:!0,onChange:c,children:s.jsx(Y,{position:"apart",mt:"md",spacing:"xs",children:Lue.map(u=>s.jsx(Yf,{value:u,size:"xs",radius:"xl",children:u.charAt(0).toUpperCase()},u))})})})]}),s.jsx(Y,{position:"right",children:s.jsx(re,{onClick:()=>e.onOk(t),children:"OK"})})]})})}function la(e){const t=e.property,r=e.defaultPropertyType&&e.defaultPropertyType!=="undefined"?e.defaultPropertyType:t.type[0].code,n=e.name,o=e.defaultValue;if(t.max>1&&!e.arrayElement)return r===B.Attachment?s.jsx(iue,{name:n,defaultValue:o,onChange:e.onChange}):s.jsx(Mue,{property:t,name:n,defaultValue:o,onChange:e.onChange});const i=t.type;return i.length>1?s.jsx(Vue,{elementDefinitionTypes:i,...e}):s.jsx(_4,{elementDefinitionType:i[0],...e})}function Vue(e){const t=e.elementDefinitionTypes;let r;e.defaultPropertyType&&(r=t.find(i=>i.code===e.defaultPropertyType)),r||(r=t[0]);const[n,o]=f.useState(r);return s.jsxs(Y,{spacing:"xs",grow:!0,noWrap:!0,children:[s.jsx(mt,{style:{width:"200px"},defaultValue:n.code,onChange:i=>{o(t.find(a=>a.code===i.currentTarget.value))},data:t.map(i=>({value:i.code,label:i.code}))}),s.jsx(_4,{...e,elementDefinitionType:n,onChange:i=>{e.onChange&&e.onChange(i,e.name.replace("[x]",sr(n.code)))}})]})}function _4(e){var a,l,c;const t=e.property,r=e.elementDefinitionType.code,n=e.name,o=e.defaultValue,i=t.min!==void 0&&t.min>0;switch(r){case B.SystemString:case B.canonical:case B.string:case B.time:case B.uri:case B.url:return s.jsx(le,{id:n,name:n,"data-testid":n,defaultValue:o,required:i,onChange:u=>{e.onChange&&e.onChange(u.currentTarget.value)},error:ut(e.outcome,n)});case B.date:return s.jsx(le,{type:"date",id:n,name:n,"data-testid":n,defaultValue:o,required:i,onChange:u=>{e.onChange&&e.onChange(u.currentTarget.value)},error:ut(e.outcome,n)});case B.dateTime:case B.instant:return s.jsx(aa,{name:n,defaultValue:o,onChange:e.onChange,outcome:e.outcome});case B.decimal:case B.integer:case B.positiveInt:case B.unsignedInt:return s.jsx(le,{type:"number",step:r===B.decimal?"any":"1",id:n,name:n,"data-testid":n,defaultValue:o,required:i,onChange:u=>{e.onChange&&e.onChange(u.currentTarget.valueAsNumber)}});case B.code:return s.jsx(d4,{binding:(a=t.binding)==null?void 0:a.valueSet,name:n,defaultValue:o,onChange:e.onChange});case B.boolean:return s.jsx(kn,{id:n,name:n,"data-testid":n,defaultChecked:!!o,onChange:u=>{e.onChange&&e.onChange(u.currentTarget.checked)}});case B.markdown:return s.jsx(Ic,{id:n,name:n,"data-testid":n,defaultValue:o,required:i,onChange:u=>{e.onChange&&e.onChange(u.currentTarget.value)}});case B.Address:return s.jsx(Ele,{name:n,defaultValue:o,onChange:e.onChange});case B.Annotation:return s.jsx($le,{name:n,defaultValue:o,onChange:e.onChange});case B.Attachment:return s.jsx(p4,{name:n,defaultValue:o,onChange:e.onChange});case B.CodeableConcept:return s.jsx(pue,{binding:(l=t.binding)==null?void 0:l.valueSet,name:n,defaultValue:o,onChange:e.onChange});case B.Coding:return s.jsx(x4,{binding:(c=t.binding)==null?void 0:c.valueSet,name:n,defaultValue:o,onChange:e.onChange});case B.ContactDetail:return s.jsx(yue,{name:n,defaultValue:o,onChange:e.onChange});case B.ContactPoint:return s.jsx(w4,{name:n,defaultValue:o,onChange:e.onChange});case B.Extension:return s.jsx(_ue,{name:n,defaultValue:o,onChange:e.onChange});case B.HumanName:return s.jsx(Sue,{name:n,defaultValue:o,onChange:e.onChange});case B.Identifier:return s.jsx(Pue,{name:n,defaultValue:o,onChange:e.onChange});case B.Money:return s.jsx(Oue,{name:n,defaultValue:o,onChange:e.onChange});case B.Period:return s.jsx(Cue,{name:n,defaultValue:o,onChange:e.onChange});case B.Duration:case B.Quantity:return s.jsx(sa,{name:n,defaultValue:o,onChange:e.onChange});case B.Range:return s.jsx(qx,{name:n,defaultValue:o,onChange:e.onChange});case B.Ratio:return s.jsx($ue,{name:n,defaultValue:o,onChange:e.onChange});case B.Reference:return s.jsx(jm,{name:n,defaultValue:o,targetTypes:Bue(t),onChange:e.onChange});case B.Timing:return s.jsx(zue,{name:n,defaultValue:o,onChange:e.onChange});case B.Dosage:case B.UsageContext:return s.jsx(vy,{typeName:r,defaultValue:o,onChange:e.onChange,outcome:e.outcome});default:return s.jsx(vy,{typeName:t.type[0].code,defaultValue:o,onChange:e.onChange,outcome:e.outcome})}}function Bue(e){var t,r,n;return(n=(r=(t=e==null?void 0:e.type)==null?void 0:t[0])==null?void 0:r.targetProfile)==null?void 0:n.map(o=>o.split("/").pop())}function vy(e){const[t,r]=f.useState(e.defaultValue??{});function n(l){r(l),e.onChange&&e.onChange(l)}const o=e.typeName,i=bx(o);if(!i)return s.jsxs("div",{children:[o," not implemented"]});const a={type:o,value:t};return s.jsx(je,{children:Object.entries(i.elements).map(([l,c])=>{if(l==="id"||h4.includes(l)||m4.includes(l)&&c.path.split(".").length===2||!c.type)return null;const[u,d]=Bc(a,l),p=c.min!==void 0&&c.min>0;return c.type.length===1&&c.type[0].code==="boolean"?s.jsx(v4,{title:dy(l),description:c.description,htmlFor:l,children:s.jsx(la,{property:c,name:l,defaultValue:u,defaultPropertyType:d,outcome:e.outcome,onChange:(h,m)=>{n(gy(t,l,m??l,c,h))}})},l):s.jsx(ot,{title:dy(l),description:c.description,withAsterisk:p,htmlFor:l,outcome:e.outcome,children:s.jsx(la,{property:c,name:l,defaultValue:u,defaultPropertyType:d,onChange:(h,m)=>{n(gy(t,l,m??l,c,h))}})},l)})})}const Uue=W(()=>({root:{"@media (max-width: 800px)":{paddingLeft:4,paddingRight:4}}}));function Uc(e){const{children:t,...r}=e,{classes:n}=Uue();return s.jsx(dI,{className:n.root,...r,children:t})}const Wue=W(e=>({noteBody:{fontSize:e.fontSizes.sm},noteCite:{fontSize:e.fontSizes.xs,marginBlockStart:3},noteRoot:{padding:5}}));function S4({value:e}){const{classes:t}=Wue();return e?s.jsx(je,{justify:"flex-start",spacing:"xs",children:e.map(r=>{var n;return r.text&&s.jsx(DT,{classNames:{cite:t.noteCite,body:t.noteBody,root:t.noteRoot},cite:((n=r.authorReference)==null?void 0:n.display)||r.authorString,icon:null,children:r.text},`note-${r.text}`)})}):null}function Wc(e){const{value:t,link:r,...n}=e,[o,i]=f.useState(),a=Xe(t,i);let l;if(o&&!U5(o))l=`[${Oe(o)}]`;else if(a)l=ko(a);else return null;return r?s.jsx($e,{to:t,...n,children:l}):s.jsx(oe,{component:"span",...n,children:l})}function ds(e){return s.jsxs(Y,{spacing:"xs",children:[s.jsx(Pi,{size:24,radius:12,value:e.value,link:e.link}),s.jsx(Wc,{value:e.value,link:e.link})]})}const Hue={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"};function P4(e){return s.jsx(dq,{color:Hue[e.status],children:e.status})}const j4=W(e=>({table:{border:`0.1px solid ${e.colors.gray[5]}`,borderCollapse:"collapse","& td, & th":{border:`0.1px solid ${e.colors.gray[5]}`,padding:4}},criticalRow:{background:e.colorScheme==="dark"?e.colors.red[7]:e.colors.red[1],border:`0.1px solid ${e.colors.red[5]}`,color:e.colors.red[5],fontWeight:500,"& td":{border:`0.1px solid ${e.colors.red[5]}`}},noteBody:{fontSize:e.fontSizes.sm},noteCite:{fontSize:e.fontSizes.xs,marginBlockStart:3},noteRoot:{padding:5}}));Gx.defaultProps={hideObservationNotes:!1,hideSpecimenInfo:!1};function Gx(e){var a;const t=ae(),r=Xe(e.value),[n,o]=f.useState();if(f.useEffect(()=>{r!=null&&r.specimen&&Promise.allSettled(r.specimen.map(l=>t.readReference(l))).then(l=>l.filter(c=>c.status==="fulfilled").map(c=>c.value)).then(o).catch(console.error)},[t,r]),!r)return null;const i=(n==null?void 0:n.flatMap(l=>l.note||[]))||[];if(r.presentedForm&&r.presentedForm.length>0){const l=r.presentedForm[0];(a=l.contentType)!=null&&a.startsWith("text/plain")&&l.data&&i.push({text:window.atob(l.data)})}return s.jsxs(je,{children:[s.jsx(ue,{children:"Diagnostic Report"}),s.jsx(que,{value:r}),n&&!e.hideSpecimenInfo&&Gue(n),r.result&&s.jsx(Que,{hideObservationNotes:e.hideObservationNotes,value:r.result}),i.length>0&&s.jsx(S4,{value:i})]})}function que({value:e}){var t,r;return s.jsxs(Y,{mt:"md",spacing:30,children:[e.subject&&s.jsxs("div",{children:[s.jsx(oe,{size:"xs",transform:"uppercase",color:"dimmed",children:"Subject"}),s.jsx(oe,{children:s.jsx(ds,{value:e.subject,link:!0})})]}),(t=e.resultsInterpreter)==null?void 0:t.map(n=>s.jsxs("div",{children:[s.jsx(oe,{size:"xs",transform:"uppercase",color:"dimmed",children:"Interpreter"}),s.jsx(oe,{children:s.jsx(ds,{value:n,link:!0})})]},n.reference)),(r=e.performer)==null?void 0:r.map(n=>s.jsxs("div",{children:[s.jsx(oe,{size:"xs",transform:"uppercase",color:"dimmed",children:"Performer"}),s.jsx(oe,{children:s.jsx(ds,{value:n,link:!0})})]},n.reference)),e.issued&&s.jsxs("div",{children:[s.jsx(oe,{size:"xs",transform:"uppercase",color:"dimmed",children:"Issued"}),s.jsx(oe,{children:Dr(e.issued)})]}),e.status&&s.jsxs("div",{children:[s.jsx(oe,{size:"xs",transform:"uppercase",color:"dimmed",children:"Status"}),s.jsx(oe,{children:sr(e.status)})]})]})}function Gue(e){return s.jsxs(je,{spacing:"xs",children:[s.jsx(ue,{order:2,size:"h6",children:"Specimens"}),s.jsx(Cr,{type:"ordered",children:e==null?void 0:e.map(t=>{var r;return s.jsx(Cr.Item,{ml:"sm",children:s.jsxs(Y,{spacing:20,children:[s.jsxs(Y,{spacing:5,children:[s.jsx(oe,{fw:500,children:"Collected:"})," ",Dr((r=t.collection)==null?void 0:r.collectedDateTime)]}),s.jsxs(Y,{spacing:5,children:[s.jsx(oe,{fw:500,children:"Received:"})," ",Dr(t.receivedTime)]})]})},`specimen-${t.id}`)})})]})}function Que(e){const{classes:t}=j4();return s.jsxs("table",{className:t.table,children:[s.jsx("thead",{children:s.jsxs("tr",{children:[s.jsx("th",{children:"Test"}),s.jsx("th",{children:"Value"}),s.jsx("th",{children:"Reference Range"}),s.jsx("th",{children:"Interpretation"}),s.jsx("th",{children:"Category"}),s.jsx("th",{children:"Performer"}),s.jsx("th",{children:"Status"})]})}),s.jsx("tbody",{children:s.jsx(O4,{value:e.value,ancestorIds:e.ancestorIds,hideObservationNotes:e.hideObservationNotes})})]})}function O4(e){var t;return s.jsx(s.Fragment,{children:(t=e.value)==null?void 0:t.map(r=>s.jsx(Kue,{value:r,ancestorIds:e.ancestorIds,hideObservationNotes:e.hideObservationNotes},`obs-${Pa(r)?r.reference:r.id}`))})}function Kue(e){var a,l;const{classes:t,cx:r}=j4(),n=Xe(e.value);if(!n||(a=e.ancestorIds)!=null&&a.includes(n.id))return null;const o=!e.hideObservationNotes&&n.note,i=Jue(n);return s.jsxs(s.Fragment,{children:[s.jsxs("tr",{className:r({[t.criticalRow]:i}),children:[s.jsx("td",{rowSpan:o?2:1,children:s.jsx($e,{to:n,children:s.jsx(eo,{value:n.code})})}),s.jsx("td",{children:s.jsx(Yue,{value:n})}),s.jsx("td",{children:s.jsx(Xue,{value:n.referenceRange})}),s.jsx("td",{children:n.interpretation&&n.interpretation.length>0&&s.jsx(eo,{value:n.interpretation[0]})}),s.jsx("td",{children:n.category&&n.category.length>0&&s.jsx(s.Fragment,{children:n.category.map(c=>s.jsx("div",{children:s.jsx(eo,{value:c})},`category-${js(c)}`))})}),s.jsx("td",{children:(l=n.performer)==null?void 0:l.map(c=>s.jsx(ph,{value:c},c.reference))}),s.jsx("td",{children:n.status&&s.jsx(P4,{status:n.status})})]}),n.hasMember&&s.jsx(O4,{value:n.hasMember,ancestorIds:e.ancestorIds?[...e.ancestorIds,n.id]:[n.id],hideObservationNotes:e.hideObservationNotes}),o&&s.jsx("tr",{children:s.jsx("td",{colSpan:6,children:s.jsx(S4,{value:n.note})})})]})}function Yue(e){const t=e.value;return s.jsx(s.Fragment,{children:T5(t)})}function Xue(e){const t=e.value&&e.value.length>0&&e.value[0];return t?t.text?s.jsx(s.Fragment,{children:t.text}):s.jsx(Wx,{value:t}):null}function Jue(e){var r,n,o,i;const t=(i=(o=(n=(r=e.interpretation)==null?void 0:r[0])==null?void 0:n.coding)==null?void 0:o[0])==null?void 0:i.code;return t==="AA"||t==="LL"||t==="HH"||t==="A"}const Zue=W((e,{width:t,fill:r})=>({paper:{maxWidth:t,margin:`${e.spacing.xl} auto`,padding:r?0:e.spacing.md,"@media (max-width: 800px)":{padding:r?0:8},"& img":{width:"100%",maxWidth:"100%"},"& video":{width:"100%",maxWidth:"100%"}}})),ede={shadow:"xs",radius:"md",withBorder:!0};function Qx(e){const{className:t,children:r,width:n,fill:o,unstyled:i,...a}=H("Panel",ede,e),{classes:l,cx:c}=Zue({width:n,fill:o},{name:"Panel",unstyled:i});return s.jsx(un,{className:c(l.paper,t),...a,children:r})}var C4={},Hc={};Object.defineProperty(Hc,"__esModule",{value:!0});Hc.Pointer=void 0;function tde(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function rde(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}var nde=function(){function e(t){t===void 0&&(t=[""]),this.tokens=t}return e.fromJSON=function(t){var r=t.split("/").map(tde);if(r[0]!=="")throw new Error("Invalid JSON Pointer: ".concat(t));return new e(r)},e.prototype.toString=function(){return this.tokens.map(rde).join("/")},e.prototype.evaluate=function(t){for(var r=null,n="",o=t,i=1,a=this.tokens.length;i<a;i++)r=o,n=this.tokens[i],!(n=="__proto__"||n=="constructor"||n=="prototype")&&(o=(r||{})[n]);return{parent:r,key:n,value:o}},e.prototype.get=function(t){return this.evaluate(t).value},e.prototype.set=function(t,r){var n=this.evaluate(t);n.parent&&(n.parent[n.key]=r)},e.prototype.push=function(t){this.tokens.push(t)},e.prototype.add=function(t){var r=this.tokens.concat(String(t));return new e(r)},e}();Hc.Pointer=nde;var _t={},Kx={};(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 r(o){return o!=null&&typeof o=="object"}function n(o){if(!r(o))return o;if(o.constructor==Array){for(var i=o.length,a=new Array(i),l=0;l<i;l++)a[l]=n(o[l]);return a}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]=n(o[d]));return u}e.clone=n})(Kx);var mr={};Object.defineProperty(mr,"__esModule",{value:!0});mr.diffAny=mr.diffObjects=mr.diffArrays=mr.intersection=mr.subtract=mr.isDestructive=void 0;var gc=Kx;function ode(e){var t=e.op;return t==="remove"||t==="replace"||t==="copy"||t==="move"}mr.isDestructive=ode;function yy(e,t){var r={};for(var n in e)gc.hasOwnProperty.call(e,n)&&e[n]!==void 0&&(r[n]=1);for(var o in t)gc.hasOwnProperty.call(t,o)&&t[o]!==void 0&&delete r[o];return Object.keys(r)}mr.subtract=yy;function E4(e){for(var t=e.length,r={},n=0;n<t;n++){var o=e[n];for(var i in o)gc.hasOwnProperty.call(o,i)&&o[i]!==void 0&&(r[i]=(r[i]||0)+1)}for(var i in r)r[i]<t&&delete r[i];return Object.keys(r)}mr.intersection=E4;function ide(e){return e.op==="add"}function ade(e){return e.op==="remove"}function Fg(e,t){return{operations:e.operations.concat(t),cost:e.cost+1}}function $4(e,t,r,n){n===void 0&&(n=Om);var o={"0,0":{operations:[],cost:0}};function i(d,p){var h="".concat(d,",").concat(p),m=o[h];if(m===void 0){if(d>0&&p>0&&!n(e[d-1],t[p-1],r.add(String(d-1))).length)m=i(d-1,p-1);else{var g=[];if(d>0){var v=i(d-1,p),_={op:"remove",index:d-1};g.push(Fg(v,_))}if(p>0){var y=i(d,p-1),x={op:"add",index:d-1,value:t[p-1]};g.push(Fg(y,x))}if(d>0&&p>0){var w=i(d-1,p-1),b={op:"replace",index:d-1,original:e[d-1],value:t[p-1]};g.push(Fg(w,b))}var C=g.sort(function(O,P){return O.cost-P.cost})[0];m=C}o[h]=m}return m}var a=isNaN(e.length)||e.length<=0?0:e.length,l=isNaN(t.length)||t.length<=0?0:t.length,c=i(a,l).operations,u=c.reduce(function(d,p){var h=d[0],m=d[1];if(ide(p)){var g=p.index+1+m,v=g<a+m?String(g):"-",_={op:p.op,path:r.add(v).toString(),value:p.value};return[h.concat(_),m+1]}else if(ade(p)){var _={op:p.op,path:r.add(String(p.index+m)).toString()};return[h.concat(_),m-1]}else{var y=r.add(String(p.index+m)),x=n(p.original,p.value,y);return[h.concat.apply(h,x),m]}},[[],0])[0];return u}mr.diffArrays=$4;function k4(e,t,r,n){n===void 0&&(n=Om);var o=[];return yy(e,t).forEach(function(i){o.push({op:"remove",path:r.add(i).toString()})}),yy(t,e).forEach(function(i){o.push({op:"add",path:r.add(i).toString(),value:t[i]})}),E4([e,t]).forEach(function(i){o.push.apply(o,n(e[i],t[i],r.add(i)))}),o}mr.diffObjects=k4;function Om(e,t,r,n){if(n===void 0&&(n=Om),e===t)return[];var o=(0,gc.objectType)(e),i=(0,gc.objectType)(t);return o=="array"&&i=="array"?$4(e,t,r,n):o=="object"&&i=="object"?k4(e,t,r,n):[{op:"replace",path:r.toString(),value:t}]}mr.diffAny=Om;var Yx=g1&&g1.__extends||function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,o){n.__proto__=o}||function(n,o){for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&(n[i]=o[i])},e(t,r)};return function(t,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");e(t,r);function n(){this.constructor=t}t.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(_t,"__esModule",{value:!0});_t.apply=_t.InvalidOperationError=_t.test=_t.copy=_t.move=_t.replace=_t.remove=_t.add=_t.TestError=_t.MissingError=void 0;var Io=Hc,Xx=Kx,sde=mr,to=function(e){Yx(t,e);function t(r){var n=e.call(this,"Value required at path: ".concat(r))||this;return n.path=r,n.name="MissingError",n}return t}(Error);_t.MissingError=to;var R4=function(e){Yx(t,e);function t(r,n){var o=e.call(this,"Test failed: ".concat(r," != ").concat(n))||this;return o.actual=r,o.expected=n,o.name="TestError",o}return t}(Error);_t.TestError=R4;function Jx(e,t,r){if(Array.isArray(e))if(t=="-")e.push(r);else{var n=parseInt(t,10);e.splice(n,0,r)}else e[t]=r}function T4(e,t){if(Array.isArray(e)){var r=parseInt(t,10);e.splice(r,1)}else delete e[t]}function I4(e,t){var r=Io.Pointer.fromJSON(t.path).evaluate(e);return r.parent===void 0?new to(t.path):(Jx(r.parent,r.key,(0,Xx.clone)(t.value)),null)}_t.add=I4;function D4(e,t){var r=Io.Pointer.fromJSON(t.path).evaluate(e);return r.value===void 0?new to(t.path):(T4(r.parent,r.key),null)}_t.remove=D4;function N4(e,t){var r=Io.Pointer.fromJSON(t.path).evaluate(e);if(r.parent===null)return new to(t.path);if(Array.isArray(r.parent)){if(parseInt(r.key,10)>=r.parent.length)return new to(t.path)}else if(r.value===void 0)return new to(t.path);return r.parent[r.key]=(0,Xx.clone)(t.value),null}_t.replace=N4;function A4(e,t){var r=Io.Pointer.fromJSON(t.from).evaluate(e);if(r.value===void 0)return new to(t.from);var n=Io.Pointer.fromJSON(t.path).evaluate(e);return n.parent===void 0?new to(t.path):(T4(r.parent,r.key),Jx(n.parent,n.key,r.value),null)}_t.move=A4;function M4(e,t){var r=Io.Pointer.fromJSON(t.from).evaluate(e);if(r.value===void 0)return new to(t.from);var n=Io.Pointer.fromJSON(t.path).evaluate(e);return n.parent===void 0?new to(t.path):(Jx(n.parent,n.key,(0,Xx.clone)(r.value)),null)}_t.copy=M4;function L4(e,t){var r=Io.Pointer.fromJSON(t.path).evaluate(e);return(0,sde.diffAny)(r.value,t.value,new Io.Pointer).length?new R4(r.value,t.value):null}_t.test=L4;var z4=function(e){Yx(t,e);function t(r){var n=e.call(this,"Invalid operation: ".concat(r.op))||this;return n.operation=r,n.name="InvalidOperationError",n}return t}(Error);_t.InvalidOperationError=z4;function lde(e,t){switch(t.op){case"add":return I4(e,t);case"remove":return D4(e,t);case"replace":return N4(e,t);case"move":return A4(e,t);case"copy":return M4(e,t);case"test":return L4(e,t)}return new z4(t)}_t.apply=lde;(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.createTests=e.createPatch=e.applyPatch=e.Pointer=void 0;var t=Hc;Object.defineProperty(e,"Pointer",{enumerable:!0,get:function(){return t.Pointer}});var r=_t,n=mr;function o(u,d){return d.map(function(p){return(0,r.apply)(u,p)})}e.applyPatch=o;function i(u){function d(p,h,m){var g=u(p,h,m);return Array.isArray(g)?g:(0,n.diffAny)(p,h,m,d)}return d}function a(u,d,p){var h=new t.Pointer;return(p?i(p):n.diffAny)(u,d,h)}e.createPatch=a;function l(u,d){var p=t.Pointer.fromJSON(d).evaluate(u);if(p!==void 0)return{op:"test",path:d,value:p.value}}function c(u,d){var p=new Array;return d.filter(n.isDestructive).forEach(function(h){var m=l(u,h.path);if(m&&p.push(m),"from"in h){var g=l(u,h.from);g&&p.push(g)}}),p}e.createTests=c})(C4);const cde=W(e=>({root:{borderCollapse:"collapse",width:"100%","& tr":{borderTop:`0.1px solid ${e.colors.gray[3]}`},"& th, & td":{padding:`${e.spacing.sm} ${e.spacing.sm}`,verticalAlign:"top"}},removed:{color:e.colors.red[7],fontFamily:"monospace",textDecoration:"line-through",whiteSpace:"pre-wrap"},added:{color:e.colors.green[7],fontFamily:"monospace",whiteSpace:"pre-wrap"}}));function ude(e){const{classes:t}=cde(),r=ae(),[n,o]=f.useState(!1);if(f.useEffect(()=>{r.requestSchema(e.original.resourceType).then(()=>o(!0)).catch(console.log)},[r,e.original.resourceType]),!n)return null;const i=C4.createPatch(e.original,e.revised),a=[no(e.original)],l=[no(e.revised)];return s.jsxs("table",{className:t.root,children:[s.jsx("thead",{children:s.jsxs("tr",{children:[s.jsx("th",{}),s.jsx("th",{children:"Before"}),s.jsx("th",{children:"After"})]})}),s.jsx("tbody",{children:i.map(c=>{var _,y,x;if(c.path.startsWith("/meta"))return null;const u=c.path,d=dde(u),p=ym(e.original.resourceType,{resourceType:"SearchParameter",base:[e.original.resourceType],code:e.original.resourceType+"."+d,expression:e.original.resourceType+"."+d}),h=(_=p==null?void 0:p.elementDefinitions)==null?void 0:_[0],m=!!(h!=null&&h.isArray),g=c.op==="add"||(y=hc(d,a))==null?void 0:y[0],v=c.op==="remove"||(x=hc(d,l))==null?void 0:x[0];return s.jsxs("tr",{children:[s.jsxs("td",{children:[sr(c.op)," ",d]}),s.jsx("td",{className:t.removed,children:g&&s.jsx(To,{property:h,propertyType:g.type,value:ZO(g.value,m),ignoreMissingValues:!0})}),s.jsx("td",{className:t.added,children:v&&s.jsx(To,{property:h,propertyType:v.type,value:ZO(v.value,m),ignoreMissingValues:!0})})]},`op-${c.op}-${c.path}`)})})]})}function dde(e){const t=e.split("/").filter(Boolean);let r="";for(let n=0;n<t.length;n++){const o=t[n];o==="-"?r+=".last()":/^\d+$/.test(o)?r+=`[${o}]`:(n>0&&(r+="."),r+=o)}return r}function ZO(e,t){return Array.isArray(e)&&!t?e[0]:!Array.isArray(e)&&t?[e]:e}function Zx(e){const t=ae(),r=Xe(e.value),[n,o]=f.useState(!1);return f.useEffect(()=>{r&&t.requestSchema(r.resourceType).then(()=>o(!0)).catch(console.log)},[t,r]),!n||!r?null:s.jsx(my,{value:{type:r.resourceType,value:e.forceUseInput?e.value:r},ignoreMissingValues:e.ignoreMissingValues})}function fde(e){return s.jsx(Uc,{children:e.children})}function ca(e){var c,u;const{resource:t,profile:r,padding:n,popupMenuItems:o,...i}=e,a=r??((c=t.meta)==null?void 0:c.author),l=e.dateTime??((u=t.meta)==null?void 0:u.lastUpdated);return s.jsxs(Qx,{"data-testid":"timeline-item",fill:!0,...i,children:[s.jsxs(Y,{position:"apart",spacing:8,mx:"xs",my:"sm",children:[s.jsx(Pi,{value:a,link:!0,size:"md"}),s.jsxs("div",{style:{flex:1},children:[s.jsx(oe,{size:"sm",children:s.jsx(Wc,{color:"dark",weight:500,value:a,link:!0})}),s.jsxs(oe,{size:"xs",children:[s.jsx($e,{color:"dimmed",to:e.resource,children:Dr(l)}),s.jsx(oe,{component:"span",color:"dimmed",mx:8,children:"·"}),s.jsx($e,{color:"dimmed",to:e.resource,children:e.resource.resourceType})]})]}),o&&s.jsxs(J,{position:"bottom-end",shadow:"md",width:200,children:[s.jsx(J.Target,{children:s.jsx(vr,{radius:"xl","aria-label":`Actions for ${nt(e.resource)}`,children:s.jsx(Zle,{})})}),o]})]}),s.jsxs(c4,{children:[n&&s.jsx("div",{style:{padding:"0 16px 16px 16px"},children:e.children}),!n&&s.jsx(s.Fragment,{children:e.children})]})]})}function F4(e,t){e.sort((r,n)=>{const o=eC(r,t),i=eC(n,t);return o>i?1:o<i?-1:tC(r,t)-tC(n,t)})}function eC(e,t){if(!V4(e,t)){const r=e.priority;if(typeof r=="string")return{stat:4,asap:3,urgent:2}[r]??0}return 0}function tC(e,t){var n;if(!V4(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 r=(n=e.meta)==null?void 0:n.lastUpdated;return r?new Date(r).getTime():0}function V4(e,t){return!!t&&e.resourceType===t.resourceType&&e.id===t.id}const pde=W(e=>({pinnedComment:{backgroundColor:e.colors.blue[0]}}));function Cm(e){const t=ae(),r=wm(),n=t.getProfile(),o=f.useRef(null),i=Xe(e.value),[a,l]=f.useState(),[c,u]=f.useState([]),d=e.loadTimelineResources,p=f.useRef(c);p.current=c;const h=f.useCallback(T=>{F4(T,i),T.reverse(),u(T)},[i]),m=f.useCallback(T=>{const N=[];for(const A of T){if(A.status!=="fulfilled")continue;const z=A.value;if(z.type==="history"&&l(z),z.entry)for(const G of z.entry)N.push(G.resource)}h(N)},[h]),g=f.useCallback(T=>h([...p.current,T]),[h]),v=f.useCallback(()=>{var A;let T,N;"resourceType"in e.value?(T=e.value.resourceType,N=e.value.id):[T,N]=(A=e.value.reference)==null?void 0:A.split("/"),d(t,T,N).then(m).catch(console.log)},[t,e.value,d,m]);f.useEffect(()=>v(),[v]);function _(T){!i||!e.createCommunication||t.createResource(e.createCommunication(i,n,T)).then(N=>g(N)).catch(console.log)}function y(T){!i||!e.createMedia||t.createResource(e.createMedia(i,n,T)).then(N=>g(N)).then(()=>Ol({id:"upload-notification",color:"teal",title:"Upload complete",message:"",icon:s.jsx(_m,{size:16}),autoClose:2e3})).catch(N=>Ol({id:"upload-notification",color:"red",title:"Upload error",message:Oe(N),icon:s.jsx(GO,{size:16}),autoClose:2e3}))}function x(T,N){return t.updateResource({...T,priority:N})}function w(T){x(T,"stat").then(v).catch(console.log)}function b(T){x(T,"routine").then(v).catch(console.log)}function C(T){r(`/${T.resourceType}/${T.id}`)}function O(T){r(`/${T.resourceType}/${T.id}/edit`)}function P(T){r(`/${T.resourceType}/${T.id}/delete`)}function E(T){var N;r(`/${T.resourceType}/${T.id}/_history/${(N=T.meta)==null?void 0:N.versionId}`)}function $(){pe({id:"upload-notification",loading:!0,title:"Initializing upload...",message:"Please wait...",autoClose:!1,withCloseButton:!1})}function k(T){Ol({id:"upload-notification",loading:!0,title:"Uploading...",message:wde(T),autoClose:!1,withCloseButton:!1})}function I(T){Ol({id:"upload-notification",color:"red",title:"Upload error",message:Oe(T),icon:s.jsx(GO,{size:16}),autoClose:2e3})}return i?s.jsxs(fde,{children:[e.createCommunication&&s.jsx(Qx,{children:s.jsx(De,{testid:"timeline-form",onSubmit:T=>{_(T.text);const N=o.current;N&&(N.value="",N.focus())},children:s.jsxs(Y,{spacing:"xs",noWrap:!0,style:{width:"100%"},children:[s.jsx(Pi,{value:n}),s.jsx(le,{name:"text",ref:o,placeholder:"Add comment",style:{width:"100%",maxWidth:300}}),s.jsx(vr,{type:"submit",radius:"xl",color:"blue",variant:"filled",children:s.jsx(cce,{size:16})}),s.jsx(Bx,{onUpload:y,onUploadStart:$,onUploadProgress:k,onUploadError:I,children:T=>s.jsx(vr,{...T,radius:"xl",color:"blue",variant:"filled",children:s.jsx(Dx,{size:16})})})]})})}),c.map(T=>{var A;if(!T)return null;const N=`${T.resourceType}/${T.id}/${(A=T.meta)==null?void 0:A.versionId}`;if(T.resourceType===i.resourceType&&T.id===i.id)return s.jsx(hde,{history:a,resource:T,onDetails:E},N);switch(T.resourceType){case"AuditEvent":return s.jsx(yde,{resource:T,onDetails:C},N);case"Communication":return s.jsx(gde,{resource:T,onPin:T.priority!=="stat"?w:void 0,onUnpin:T.priority==="stat"?b:void 0,onDetails:C,onEdit:O,onDelete:P},N);case"DiagnosticReport":return s.jsx(xde,{resource:T,onDetails:C,onEdit:O,onDelete:P},N);case"Media":return s.jsx(vde,{resource:T,onDetails:C,onEdit:O,onDelete:P},N);default:return s.jsx(ca,{resource:T,padding:!0,children:s.jsx(Zx,{value:T,ignoreMissingValues:!0})},N)}})]}):s.jsx(or,{style:{width:"100%",height:"100%"},children:s.jsx(hn,{})})}function Cs(e){return s.jsxs(J.Dropdown,{children:[s.jsx(J.Label,{children:"Resource"}),e.onPin&&s.jsx(J.Item,{icon:s.jsx(fce,{size:14}),onClick:()=>e.onPin(e.resource),"aria-label":`Pin ${nt(e.resource)}`,children:"Pin"}),e.onUnpin&&s.jsx(J.Item,{icon:s.jsx(pce,{size:14}),onClick:()=>e.onUnpin(e.resource),"aria-label":`Unpin ${nt(e.resource)}`,children:"Unpin"}),e.onDetails&&s.jsx(J.Item,{icon:s.jsx(ice,{size:14}),onClick:()=>e.onDetails(e.resource),"aria-label":`Details ${nt(e.resource)}`,children:"Details"}),e.onEdit&&s.jsx(J.Item,{icon:s.jsx(ece,{size:14}),onClick:()=>e.onEdit(e.resource),"aria-label":`Edit ${nt(e.resource)}`,children:"Edit"}),e.onDelete&&s.jsxs(s.Fragment,{children:[s.jsx(J.Divider,{}),s.jsx(J.Label,{children:"Danger zone"}),s.jsx(J.Item,{color:"red",icon:s.jsx(l4,{size:14}),onClick:()=>e.onDelete(e.resource),"aria-label":`Delete ${nt(e.resource)}`,children:"Delete"})]})]})}function hde(e){const t=mde(e.history,e.resource);return t?s.jsx(ca,{resource:e.resource,padding:!0,popupMenuItems:s.jsx(Cs,{...e}),children:s.jsx(ude,{original:t,revised:e.resource})}):s.jsxs(ca,{resource:e.resource,padding:!0,popupMenuItems:s.jsx(Cs,{...e}),children:[s.jsx("h3",{children:"Created"}),s.jsx(Zx,{value:e.resource,ignoreMissingValues:!0,forceUseInput:!0})]})}function mde(e,t){const r=e.entry,n=r.findIndex(o=>{var i,a,l;return((a=(i=o.resource)==null?void 0:i.meta)==null?void 0:a.versionId)===((l=t.meta)==null?void 0:l.versionId)});if(!(n>=r.length-1))return r[n+1].resource}function gde(e){var o,i;const{classes:t}=pde(),n=!e.resource.priority||e.resource.priority==="routine"?void 0:t.pinnedComment;return s.jsx(ca,{resource:e.resource,profile:e.resource.sender,dateTime:e.resource.sent,padding:!0,className:n,popupMenuItems:s.jsx(Cs,{...e}),children:s.jsx("p",{children:(i=(o=e.resource.payload)==null?void 0:o[0])==null?void 0:i.contentString})})}function vde(e){var n;const t=(n=e.resource.content)==null?void 0:n.contentType,r=t&&!t.startsWith("image/")&&!t.startsWith("video/")&&t!=="application/pdf";return s.jsx(ca,{resource:e.resource,padding:!!r,popupMenuItems:s.jsx(Cs,{...e}),children:s.jsx(Vc,{value:e.resource.content})})}function yde(e){return s.jsx(ca,{resource:e.resource,padding:!0,popupMenuItems:s.jsx(Cs,{...e}),children:s.jsx(ma,{children:s.jsx("pre",{children:e.resource.outcomeDesc})})})}function xde(e){return s.jsx(ca,{resource:e.resource,padding:!0,popupMenuItems:s.jsx(Cs,{...e}),children:s.jsx(Gx,{value:e.resource})})}function wde(e){if(e.lengthComputable){const t=100*e.loaded/e.total;return`Uploaded: ${Vg(e.loaded)} / ${Vg(e.total)} ${t.toFixed(2)}%`}return`Uploaded: ${Vg(e.loaded)}`}function Vg(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 bde(e){return s.jsx(Cm,{value:e.resource,loadTimelineResources:async(t,r,n)=>{const o=`${r}/${n}`,i=100;return Promise.allSettled([t.readHistory(r,n),t.search("Task",{_filter:`based-on eq ${o} or focus eq ${o} or subject eq ${o}`,_count:i})])}})}function be(e){const{children:t,...r}=e;return s.jsx(Uc,{children:s.jsx(Qx,{...r,children:t})})}function _de(e){return s.jsx(Cm,{value:e.encounter,loadTimelineResources:async(t,r,n)=>Promise.allSettled([t.readHistory("Encounter",n),t.search("Communication","encounter=Encounter/"+n),t.search("Media","encounter=Encounter/"+n)]),createCommunication:(t,r,n)=>({resourceType:"Communication",status:"completed",encounter:ht(t),subject:t.subject,sender:ht(r),sent:new Date().toISOString(),payload:[{contentString:n}]}),createMedia:(t,r,n)=>({resourceType:"Media",status:"completed",encounter:ht(t),subject:t.subject,operator:ht(r),issued:new Date().toISOString(),content:n})})}function Sde(e){let t;try{t=Ese(e.path,e.resource)}catch(r){return console.warn("FhirPathDisplay:",r),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 s.jsx(To,{value:t[0]||"",propertyType:e.propertyType})}function Pde(e){return s.jsxs(Ar,{title:"Export",closeButtonProps:{"aria-label":"Close"},opened:e.visible,onClose:e.onCancel,children:[s.jsxs(ie,{display:"flex",sx:{justifyContent:"space-between"},children:[e.exportCsv&&s.jsx(rC,{text:"CSV",exportLogic:e.exportCsv,onCancel:e.onCancel}),e.exportTransactionBundle&&s.jsx(rC,{text:"Transaction Bundle",exportLogic:e.exportTransactionBundle,onCancel:e.onCancel})]}),s.jsx(oe,{sx:{marginTop:"10px",marginLeft:"2px"},children:"Limited to 1000 records"})]})}function rC(e){return s.jsx(re,{onClick:()=>{e.exportLogic(),e.onCancel()},children:`Export as ${e.text}`})}const jde={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]},Ode={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 e1(e,t){return{...e,filters:t,offset:0,name:void 0}}function t1(e,t){return e1(e,(e.filters??[]).filter(r=>r.code!==t))}function Em(e,t,r,n,o){o&&(e=t1(e,t));const i=[];return e.filters&&i.push(...e.filters),i.push({code:t,operator:r,value:n??""}),e1(e,i)}function Cde(e,t){if(!e.filters)return e;const r=[...e.filters];return r.splice(t,1),{...e,filters:r,name:void 0}}function Ede(e,t){return r1(e,t,-1)}function $de(e,t){return r1(e,t,0)}function kde(e,t){return r1(e,t,1)}function r1(e,t,r){const n=new Date;n.setDate(n.getDate()+r),n.setHours(0,0,0,0);const o=new Date(n.getTime());return o.setDate(o.getDate()+1),o.setTime(o.getTime()-1),o1(e,t,n,o)}function Rde(e,t){return n1(e,t,-1)}function Tde(e,t){return n1(e,t,0)}function Ide(e,t){return n1(e,t,1)}function n1(e,t,r){const n=new Date;n.setMonth(n.getMonth()+r),n.setDate(1),n.setHours(0,0,0,0);const o=new Date(n.getTime());return o.setMonth(o.getMonth()+1),o.setDate(1),o.setHours(0,0,0,0),o.setTime(o.getTime()-1),o1(e,t,n,o)}function Dde(e,t){const r=new Date;return r.setMonth(0),r.setDate(1),r.setHours(0,0,0,0),o1(e,t,r,new Date)}function o1(e,t,r,n){return e=t1(e,t),e=nC(e,t,ne.GREATER_THAN_OR_EQUALS,r),e=nC(e,t,ne.LESS_THAN_OR_EQUALS,n),e}function nC(e,t,r,n){return Em(e,t,r,n.toISOString())}function oC(e,t,r=!0){return Em(e,t,ne.MISSING,r.toString())}function Nde(e,t){return e.offset===t?e:{...e,offset:t,name:void 0}}function Ade(e,t){const r=e.count??Fc,n=(t-1)*r;return Nde(e,n)}function Mde(e,t,r){return t===Lde(e)&&r!==void 0&&r===zde(e)?e:{...e,sortRules:[{code:t,descending:!!r}],name:void 0}}function Lde(e){const t=e.sortRules;if(!t||t.length===0)return;const r=t[0].code;return r.startsWith("-")?r.substr(1):r}function zde(e){const t=e.sortRules;return!t||t.length===0?!1:!!t[0].descending}function Fde(e){return jde[e.type]}function i1(e){return Ode[e]??""}function ji(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(sr).join(" "))}function Vde(e,t){var n,o;const r=t.name;return r==="id"?e.id:r==="meta.versionId"?(n=e.meta)==null?void 0:n.versionId:r==="_lastUpdated"?Dr((o=e.meta)==null?void 0:o.lastUpdated):t.elementDefinition&&`${e.resourceType}.${t.name}`===t.elementDefinition.path?Bde(e,t.elementDefinition):t.searchParams&&t.searchParams.length===1&&t.name===t.searchParams[0].code?Ude(e,t.searchParams[0]):null}function Bde(e,t){var i,a,l;const r=((l=(a=(i=t.path)==null?void 0:i.split("."))==null?void 0:a.pop())==null?void 0:l.replaceAll("[x]",""))??"",[n,o]=Bc({type:e.resourceType,value:e},r);return n?s.jsx(To,{property:t,propertyType:o,value:n,maxWidth:200,ignoreMissingValues:!0,link:!1}):null}function Ude(e,t){const r=hc(t.expression,[{type:e.resourceType,value:e}]);return!r||r.length===0?null:s.jsx(s.Fragment,{children:r.map((n,o)=>s.jsx(To,{propertyType:n.type,value:n.value,maxWidth:200,ignoreMissingValues:!0,link:!1},`${o}-${r.length}`))})}function Wde(e){const t=f.useRef(!1),[r,n]=f.useState({search:JSON.parse(Ir(e.search))}),[o,i]=f.useState(!1);f.useEffect(()=>{n({search:e.search})},[e.search]);const a=f.useMemo(()=>{if(!e.visible)return[];const c=e.search.resourceType,u=qae(c),d=_x(c);return Hde(u,d).sort((p,h)=>p.localeCompare(h)).map(p=>({value:p,label:ji(p)}))},[e.visible,e.search.resourceType]);if(!e.visible)return null;function l(c){n({search:{...r.search,fields:c}})}return s.jsx(Ar,{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:s.jsx("div",{"data-testid":"overlay-child"})},children:s.jsxs(je,{children:[s.jsx(lm,{withinPortal:!0,style:{width:550},placeholder:"Select fields to display",data:a,value:r.search.fields??[],onChange:l,onDropdownOpen:()=>i(!0),onDropdownClose:()=>i(!1),maxDropdownHeight:"250px",dropdownPosition:"bottom",clearButtonProps:{"aria-label":"Clear selection"},clearable:!0,searchable:!0}),s.jsx(Y,{position:"right",children:s.jsx(re,{onClick:()=>e.onOk(r.search),children:"OK"})})]})})}function Hde(e,t){const r=[],n=new Set,o=new Set;for(const i of Object.keys(e.elements))r.push(i),n.add(i.toLowerCase()),o.add(ji(i));if(t)for(const i of Object.keys(t)){const a=ji(i);!n.has(i)&&!o.has(a)&&(r.push(i),n.add(i),o.add(a))}return r}function B4(e){var o;const{resourceType:t,filter:r}=e,n=(o=Si.types[t].searchParams)==null?void 0:o[r.code];if(n){if(n.type==="reference"&&(r.operator===ne.EQUALS||r.operator===ne.NOT_EQUALS))return s.jsx(Wc,{value:{reference:r.value}});const i=ym(t,n);if(r.code==="_lastUpdated"||i.type===ri.DATETIME)return s.jsx(s.Fragment,{children:Dr(r.value)})}return s.jsx(s.Fragment,{children:r.value})}function U4(e){const t=ym(e.resourceType,e.searchParam),r="filter-value";switch(t.type){case ri.REFERENCE:return s.jsx(jm,{name:r,defaultValue:e.defaultValue?{reference:e.defaultValue}:void 0,targetTypes:e.searchParam.target,autoFocus:e.autoFocus,onChange:n=>{n?e.onChange(n.reference):e.onChange("")}});case ri.BOOLEAN:return s.jsx(kn,{name:r,"data-autofocus":e.autoFocus,"data-testid":r,defaultChecked:e.defaultValue==="true",autoFocus:e.autoFocus,onChange:n=>e.onChange(n.currentTarget.checked.toString())});case ri.DATE:return s.jsx(le,{type:"date",name:r,"data-autofocus":e.autoFocus,"data-testid":r,defaultValue:e.defaultValue,autoFocus:e.autoFocus,onChange:n=>e.onChange(n.currentTarget.value)});case ri.DATETIME:return s.jsx(aa,{name:r,defaultValue:e.defaultValue,autoFocus:e.autoFocus,onChange:e.onChange});case ri.NUMBER:return s.jsx(le,{type:"number",name:r,"data-autofocus":e.autoFocus,"data-testid":r,defaultValue:e.defaultValue,autoFocus:e.autoFocus,onChange:n=>e.onChange(n.currentTarget.value)});case ri.QUANTITY:return s.jsx(sa,{name:r,defaultValue:qde(e.defaultValue),autoFocus:e.autoFocus,onChange:n=>{n?e.onChange(`${n.value}`):e.onChange("")}});default:return s.jsx(le,{name:r,"data-autofocus":e.autoFocus,"data-testid":r,defaultValue:e.defaultValue,autoFocus:e.autoFocus,onChange:n=>e.onChange(n.currentTarget.value),placeholder:"Search value"})}}function qde(e){if(e){const[t,r,n]=e.split("|");if(t)return{value:parseFloat(t),system:r,unit:n}}}function Gde(e){const[t,r]=f.useState(JSON.parse(Ir(e.search))),[n,o]=f.useState(-1),i=f.useRef(t);i.current=t,f.useEffect(()=>{r(JSON.parse(Ir(e.search)))},[e.search]);function a(d){r(Em(i.current,d.code,d.operator,d.value))}if(!e.visible)return null;const l=e.search.resourceType,c=_x(l)??{},u=t.filters||[];return s.jsxs(Ar,{title:"Filters",closeButtonProps:{"aria-label":"Close"},size:900,opened:e.visible,onClose:e.onCancel,children:[s.jsx("div",{children:s.jsxs("table",{children:[s.jsxs("colgroup",{children:[s.jsx("col",{style:{width:200}}),s.jsx("col",{style:{width:200}}),s.jsx("col",{style:{width:380}}),s.jsx("col",{style:{width:120}})]}),s.jsx("thead",{children:s.jsxs("tr",{children:[s.jsx("th",{children:"Field"}),s.jsx("th",{children:"Operation"}),s.jsx("th",{children:"Value"}),s.jsx("th",{children:"Actions"})]})}),s.jsxs("tbody",{children:[u.map((d,p)=>p===n?s.jsx(iC,{resourceType:l,searchParams:c,defaultValue:d,okText:"Save",onOk:h=>{const m=[...u];m[p]=h,r(e1(i.current,m)),o(-1)},onCancel:()=>o(-1)},`filter-${d.code}-${d.operator}-${d.value}-input`):s.jsx(Qde,{resourceType:l,searchParams:c,filter:d,onEdit:()=>o(p),onDelete:()=>r(Cde(i.current,p))},`filter-${d.code}-${d.operator}-${d.value}-display`)),s.jsx(iC,{resourceType:l,searchParams:c,okText:"Add",onOk:a})]})]})}),s.jsx(Y,{position:"right",mt:"xl",children:s.jsx(re,{onClick:()=>e.onOk(i.current),children:"OK"})})]})}function Qde(e){const{filter:t}=e;return s.jsxs("tr",{children:[s.jsx("td",{children:ji(t.code)}),s.jsx("td",{children:i1(t.operator)}),s.jsx("td",{children:s.jsx(B4,{resourceType:e.resourceType,filter:t})}),s.jsxs("td",{children:[s.jsx(re,{compact:!0,variant:"outline",onClick:e.onEdit,children:"Edit"}),s.jsx(re,{compact:!0,variant:"outline",onClick:e.onDelete,children:"Delete"})]})]})}function iC(e){const[t,r]=f.useState(e.defaultValue??{}),n=f.useRef(t);n.current=t;function o(u){r({...n.current,code:u})}function i(u){r({...n.current,operator:u})}function a(u){r({...n.current,value:u})}const l=e.searchParams[t.code],c=l&&Fde(l);return s.jsxs("tr",{children:[s.jsx("td",{children:s.jsx(mt,{"data-testid":"filter-field",defaultValue:n.current.code,onChange:u=>o(u.currentTarget.value),data:["",...Object.keys(e.searchParams).map(u=>({value:u,label:ji(u)}))]})}),s.jsx("td",{children:c&&s.jsx(mt,{"data-testid":"filter-operation",defaultValue:t.operator,onChange:u=>i(u.currentTarget.value),data:["",...c.map(u=>({value:u,label:i1(u)}))]})}),s.jsx("td",{children:l&&t.operator&&s.jsx(U4,{resourceType:e.resourceType,searchParam:l,defaultValue:t.value,onChange:a})}),s.jsxs("td",{children:[t.code&&t.operator&&s.jsx(re,{compact:!0,variant:"outline",onClick:()=>{e.onOk(n.current),r({})},children:e.okText}),e.onCancel&&s.jsx(re,{compact:!0,variant:"outline",onClick:e.onCancel,children:"Cancel"})]})]})}function Kde(e){const[t,r]=f.useState(e.defaultValue??"");if(!e.visible||!e.searchParam||!e.filter)return null;function n(){e.onOk({...e.filter,value:t})}return s.jsx(Ar,{title:e.title,size:"xl",opened:e.visible,onClose:e.onCancel,children:s.jsx(De,{onSubmit:n,children:s.jsxs(sn,{children:[s.jsx(sn.Col,{span:10,children:s.jsx(U4,{resourceType:e.resourceType,searchParam:e.searchParam,defaultValue:t,autoFocus:!0,onChange:r})}),s.jsx(sn.Col,{span:2,children:s.jsx(re,{onClick:n,fullWidth:!0,children:"OK"})})]})})})}function Yde(e){if(!e.searchParams)return null;function t(i,a){o(Mde(e.search,i.code,a))}function r(i){o(t1(e.search,i.code))}function n(i,a){e.onPrompt(i,{code:i.code,operator:a,value:""})}function o(i){e.onChange(i)}return e.searchParams.length===1?s.jsx(Xde,{search:e.search,searchParam:e.searchParams[0],onSort:t,onPrompt:n,onChange:o,onClear:r}):s.jsx(J.Dropdown,{children:e.searchParams.map(i=>s.jsx(J.Item,{children:ji(i.code)},i.code))})}function Xde(e){switch(e.searchParam.type){case"date":return s.jsx(Jde,{...e});case"number":case"quantity":return s.jsx(Zde,{...e});case"reference":return s.jsx(efe,{...e});case"string":case"token":case"uri":return s.jsx(tfe,{...e});default:return s.jsxs(s.Fragment,{children:["Unknown search param type: ",e.searchParam.type]})}}function Jde(e){const{searchParam:t}=e,r=t.code;return s.jsxs(J.Dropdown,{children:[s.jsx(J.Item,{icon:s.jsx(Nx,{size:14}),onClick:()=>e.onSort(t,!1),children:"Sort Oldest to Newest"}),s.jsx(J.Item,{icon:s.jsx(Ax,{size:14}),onClick:()=>e.onSort(t,!0),children:"Sort Newest to Oldest"}),s.jsx(J.Divider,{}),s.jsx(J.Item,{icon:s.jsx(Pm,{size:14}),onClick:()=>e.onPrompt(t,ne.EQUALS),children:"Equals..."}),s.jsx(J.Item,{icon:s.jsx(Sm,{size:14}),onClick:()=>e.onPrompt(t,ne.NOT_EQUALS),children:"Does not equal..."}),s.jsx(J.Divider,{}),s.jsx(J.Item,{icon:s.jsx(s4,{size:14}),onClick:()=>e.onPrompt(t,ne.ENDS_BEFORE),children:"Before..."}),s.jsx(J.Item,{icon:s.jsx(a4,{size:14}),onClick:()=>e.onPrompt(t,ne.STARTS_AFTER),children:"After..."}),s.jsx(J.Item,{icon:s.jsx(Ble,{size:14}),onClick:()=>e.onPrompt(t,ne.EQUALS),children:"Between..."}),s.jsx(J.Divider,{}),s.jsx(J.Item,{icon:s.jsx(Li,{size:14}),onClick:()=>e.onChange(kde(e.search,r)),children:"Tomorrow"}),s.jsx(J.Item,{icon:s.jsx(Li,{size:14}),onClick:()=>e.onChange($de(e.search,r)),children:"Today"}),s.jsx(J.Item,{icon:s.jsx(Li,{size:14}),onClick:()=>e.onChange(Ede(e.search,r)),children:"Yesterday"}),s.jsx(J.Divider,{}),s.jsx(J.Item,{icon:s.jsx(Li,{size:14}),onClick:()=>e.onChange(Ide(e.search,r)),children:"Next Month"}),s.jsx(J.Item,{icon:s.jsx(Li,{size:14}),onClick:()=>e.onChange(Tde(e.search,r)),children:"This Month"}),s.jsx(J.Item,{icon:s.jsx(Li,{size:14}),onClick:()=>e.onChange(Rde(e.search,r)),children:"Last Month"}),s.jsx(J.Divider,{}),s.jsx(J.Item,{icon:s.jsx(Li,{size:14}),onClick:()=>e.onChange(Dde(e.search,r)),children:"Year to date"}),s.jsx($m,{...e})]})}function Zde(e){const{searchParam:t}=e;return s.jsxs(J.Dropdown,{children:[s.jsx(J.Item,{icon:s.jsx(Nx,{size:14}),onClick:()=>e.onSort(t,!1),children:"Sort Smallest to Largest"}),s.jsx(J.Item,{icon:s.jsx(Ax,{size:14}),onClick:()=>e.onSort(t,!0),children:"Sort Largest to Smallest"}),s.jsx(J.Divider,{}),s.jsx(J.Item,{icon:s.jsx(Pm,{size:14}),onClick:()=>e.onPrompt(t,ne.EQUALS),children:"Equals..."}),s.jsx(J.Item,{icon:s.jsx(Sm,{size:14}),onClick:()=>e.onPrompt(t,ne.NOT_EQUALS),children:"Does not equal..."}),s.jsx(J.Divider,{}),s.jsx(J.Item,{icon:s.jsx(a4,{size:14}),onClick:()=>e.onPrompt(t,ne.GREATER_THAN),children:"Greater than..."}),s.jsx(J.Item,{icon:s.jsx(hy,{size:14}),onClick:()=>e.onPrompt(t,ne.GREATER_THAN_OR_EQUALS),children:"Greater than or equal to..."}),s.jsx(J.Item,{icon:s.jsx(s4,{size:14}),onClick:()=>e.onPrompt(t,ne.LESS_THAN),children:"Less than..."}),s.jsx(J.Item,{icon:s.jsx(hy,{size:14}),onClick:()=>e.onPrompt(t,ne.LESS_THAN_OR_EQUALS),children:"Less than or equal to..."}),s.jsx($m,{...e})]})}function efe(e){const{searchParam:t}=e;return s.jsxs(J.Dropdown,{children:[s.jsx(J.Item,{icon:s.jsx(Pm,{size:14}),onClick:()=>e.onPrompt(t,ne.EQUALS),children:"Equals..."}),s.jsx(J.Item,{icon:s.jsx(Sm,{size:14}),onClick:()=>e.onPrompt(t,ne.NOT),children:"Does not equal..."}),s.jsx($m,{...e})]})}function tfe(e){const{searchParam:t}=e;return s.jsxs(J.Dropdown,{children:[s.jsx(J.Item,{icon:s.jsx(Nx,{size:14}),onClick:()=>e.onSort(t,!1),children:"Sort A to Z"}),s.jsx(J.Item,{icon:s.jsx(Ax,{size:14}),onClick:()=>e.onSort(t,!0),children:"Sort Z to A"}),s.jsx(J.Divider,{}),s.jsx(J.Item,{icon:s.jsx(Pm,{size:14}),onClick:()=>e.onPrompt(t,ne.EQUALS),children:"Equals..."}),s.jsx(J.Item,{icon:s.jsx(Sm,{size:14}),onClick:()=>e.onPrompt(t,ne.NOT),children:"Does not equal..."}),s.jsx(J.Divider,{}),s.jsx(J.Item,{icon:s.jsx(Hle,{size:14}),onClick:()=>e.onPrompt(t,ne.CONTAINS),children:"Contains..."}),s.jsx(J.Item,{icon:s.jsx(Wle,{size:14}),onClick:()=>e.onPrompt(t,ne.EQUALS),children:"Does not contain..."}),s.jsx($m,{...e})]})}function $m(e){const{searchParam:t}=e,r=t.code;return s.jsxs(s.Fragment,{children:[s.jsx(J.Divider,{}),s.jsx(J.Item,{icon:s.jsx(Fle,{size:14}),onClick:()=>e.onChange(oC(e.search,r)),children:"Missing"}),s.jsx(J.Item,{icon:s.jsx(zle,{size:14}),onClick:()=>e.onChange(oC(e.search,r,!1)),children:"Not missing"}),s.jsx(J.Divider,{}),s.jsx(J.Item,{icon:s.jsx(fh,{size:14}),onClick:()=>e.onClear(t),children:"Clear filters"})]})}function rfe(e){const t=e.resourceType,r=[];for(const n of e.fields||["id","_lastUpdated"])r.push(nfe(t,n));return r}function nfe(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 r=Sa(e,t),n=Zae(e,t.toLowerCase());if(r&&n)return{name:t,elementDefinition:r,searchParams:[n]};if(r){const i=_x(e);let a;if(i){const l=new RegExp(`${e}\\.${t.replaceAll("[x]","")}([^\\w-]|$)`);a=Object.values(i).filter(c=>!!c.expression&&l.test(c==null?void 0:c.expression)),a.length===0&&(a=void 0)}return{name:t,elementDefinition:r,searchParams:a}}if(n){const i=ym(e,n);return{name:t,elementDefinition:(o=i.elementDefinitions)==null?void 0:o[0],searchParams:[n]}}return{name:t}}class ofe extends Event{constructor(t){super("change"),this.definition=t}}class ife extends Event{constructor(t){super("load"),this.response=t}}class hh extends Event{constructor(t,r){super("click"),this.resource=t,this.browserEvent=r}}const afe=W(e=>({root:{maxWidth:"100%",overflow:"auto",textAlign:"left",marginBottom:"20px"},table:{cursor:"pointer"},tr:{"&:hover":{backgroundColor:e.colorScheme==="dark"?e.colors.dark[7]:e.colors.gray[0]}},th:{padding:"0 !important"},control:{width:"100%",padding:`${e.spacing.xs} ${e.spacing.md}`,"&:hover":{backgroundColor:e.colorScheme==="dark"?e.colors.dark[6]:e.colors.gray[0]}},icon:{width:21,height:21,borderRadius:21}}));function sfe(e){var z,G,X;const{classes:t}=afe(),r=ae(),[n,o]=f.useState(!1),[i,a]=f.useState(),{search:l,onLoad:c}=e,[u,d]=f.useState({selected:{},fieldEditorVisible:!1,filterEditorVisible:!1,exportDialogVisible:!1,filterDialogVisible:!1}),p=f.useRef(u);p.current=u;const h=l.total??"accurate",m=f.useCallback(R=>{a(void 0),r.search(l.resourceType,es({...l,total:h,fields:void 0}),R).then(M=>{d({...p.current,searchResponse:M}),c&&c(new ife(M))}).catch(M=>{d({...p.current,searchResponse:void 0}),a(M)})},[r,l,h,c]),g=f.useCallback(()=>{d({...p.current,searchResponse:void 0}),m({cache:"reload"})},[m]);f.useEffect(()=>{m()},[m]);function v(R,M){R.stopPropagation();const Q=R.target.checked,Z={...p.current.selected};Q?Z[M]=!0:delete Z[M],d({...p.current,selected:Z})}function _(R){R.stopPropagation();const V=R.target.checked,Q={},Z=p.current.searchResponse;V&&(Z!=null&&Z.entry)&&Z.entry.forEach(_e=>{var xe;(xe=_e.resource)!=null&&xe.id&&(Q[_e.resource.id]=!0)}),d({...p.current,selected:Q})}function y(){var M,V;const R=p.current;if(!((M=R.searchResponse)!=null&&M.entry)||R.searchResponse.entry.length===0)return!1;for(const Q of R.searchResponse.entry)if((V=Q.resource)!=null&&V.id&&!R.selected[Q.resource.id])return!1;return!0}function x(R){e.onChange&&e.onChange(new ofe(R))}function w(R,M){if(u4(R.target)||R.button===2)return;ct(R);const V=R.button===1||R.ctrlKey||R.metaKey;!V&&e.onClick&&e.onClick(new hh(M,R)),V&&e.onAuxClick&&e.onAuxClick(new hh(M,R))}function b(){return!!(e.onExport??e.onExportCsv??e.onExportTransactionBundle)}if(f.useEffect(()=>{o(!1),r.requestSchema(e.search.resourceType).then(()=>o(!0)).catch(console.log)},[r,e.search.resourceType]),!n)return s.jsx(or,{style:{width:"100%",height:"100%"},children:s.jsx(hn,{})});const C=e.checkboxesEnabled,O=rfe(l),P=l.resourceType,E=u.searchResponse,$=E==null?void 0:E.entry,k=$==null?void 0:$.map(R=>R.resource),I="subtle",T="gray",N=16,A=window.innerWidth<768;return s.jsxs("div",{className:t.root,"data-testid":"search-control",children:[!e.hideToolbar&&s.jsxs(Y,{position:"apart",mb:"xl",children:[s.jsxs(Y,{spacing:2,children:[s.jsx(re,{compact:!0,variant:I,color:T,leftIcon:s.jsx(Kle,{size:N}),onClick:()=>d({...p.current,fieldEditorVisible:!0}),children:"Fields"}),s.jsx(re,{compact:!0,variant:I,color:T,leftIcon:s.jsx(rce,{size:N}),onClick:()=>d({...p.current,filterEditorVisible:!0}),children:"Filters"}),e.onNew&&s.jsx(re,{compact:!0,variant:I,color:T,leftIcon:s.jsx(tce,{size:N}),onClick:e.onNew,children:"New..."}),!A&&b()&&s.jsx(re,{compact:!0,variant:I,color:T,leftIcon:s.jsx(Sce,{size:N}),onClick:e.onExport?e.onExport:()=>d({...p.current,exportDialogVisible:!0}),children:"Export..."}),!A&&e.onDelete&&s.jsx(re,{compact:!0,variant:I,color:T,leftIcon:s.jsx(l4,{size:N}),onClick:()=>e.onDelete(Object.keys(u.selected)),children:"Delete..."}),!A&&e.onBulk&&s.jsx(re,{compact:!0,variant:I,color:T,leftIcon:s.jsx(Vle,{size:N}),onClick:()=>e.onBulk(Object.keys(u.selected)),children:"Bulk..."})]}),s.jsxs(Y,{spacing:2,children:[E&&s.jsxs(oe,{size:"xs",color:"dimmed",children:[dfe(l,E.total),"-",ffe(l,E.total)," of"," ",`${h==="estimate"?"~":""}${(z=E.total)==null?void 0:z.toLocaleString()}`]}),s.jsx(vr,{title:"Refresh",onClick:g,children:s.jsx(vce,{size:"1.125rem"})})]})]}),s.jsxs(xa,{className:t.table,children:[s.jsxs("thead",{children:[s.jsxs("tr",{children:[C&&s.jsx("th",{children:s.jsx("input",{type:"checkbox",value:"checked","aria-label":"all-checkbox","data-testid":"all-checkbox",checked:y(),onChange:R=>_(R)})}),O.map(R=>s.jsx("th",{children:s.jsxs(J,{shadow:"md",width:240,position:"bottom-end",children:[s.jsx(J.Target,{children:s.jsx(So,{className:t.control,children:s.jsxs(Y,{position:"apart",noWrap:!0,children:[s.jsx(oe,{weight:500,size:"sm",children:ji(R.name)}),s.jsx(or,{className:t.icon,children:s.jsx(Ale,{size:14,stroke:1.5})})]})})}),s.jsx(Yde,{search:e.search,searchParams:R.searchParams,onPrompt:(M,V)=>{d({...p.current,filterDialogVisible:!0,filterDialogSearchParam:M,filterDialogFilter:V})},onChange:M=>{x(M)}})]})},R.name))]}),!e.hideFilters&&s.jsxs("tr",{children:[C&&s.jsx("th",{}),O.map(R=>s.jsx("th",{children:R.searchParams&&s.jsx(lfe,{resourceType:P,searchParams:R.searchParams,filters:e.search.filters})},R.name))]})]}),s.jsx("tbody",{children:k==null?void 0:k.map(R=>R&&s.jsxs("tr",{className:t.tr,"data-testid":"search-control-row",onClick:M=>w(M,R),onAuxClick:M=>w(M,R),children:[C&&s.jsx("td",{children:s.jsx("input",{type:"checkbox",value:"checked","data-testid":"row-checkbox","aria-label":`Checkbox for ${R.id}`,checked:!!u.selected[R.id],onChange:M=>v(M,R.id)})}),O.map(M=>s.jsx("td",{children:Vde(R,M)},M.name))]},R.id))})]}),(k==null?void 0:k.length)===0&&s.jsx(Uc,{children:s.jsx(or,{style:{height:150},children:s.jsx(oe,{size:"xl",color:"dimmed",children:"No results"})})}),(E==null?void 0:E.total)!==void 0&&E.total>0&&s.jsx(or,{m:"md",p:"md",children:s.jsx(io,{value:cfe(l),total:ufe(l,E.total),onChange:R=>x(Ade(l,R)),getControlProps:R=>{switch(R){case"previous":return{"aria-label":"Previous page"};case"next":return{"aria-label":"Next page"};default:return{}}}})}),i&&s.jsx("div",{"data-testid":"search-error",children:s.jsx("pre",{style:{textAlign:"left"},children:JSON.stringify(i,void 0,2)})}),s.jsx(Wde,{search:e.search,visible:p.current.fieldEditorVisible,onOk:R=>{x(R),d({...p.current,fieldEditorVisible:!1})},onCancel:()=>{d({...p.current,fieldEditorVisible:!1})}}),s.jsx(Gde,{search:e.search,visible:p.current.filterEditorVisible,onOk:R=>{x(R),d({...p.current,filterEditorVisible:!1})},onCancel:()=>{d({...p.current,filterEditorVisible:!1})}}),s.jsx(Pde,{visible:p.current.exportDialogVisible,exportCsv:e.onExportCsv,exportTransactionBundle:e.onExportTransactionBundle,onCancel:()=>{d({...p.current,exportDialogVisible:!1})}}),s.jsx(Kde,{visible:p.current.filterDialogVisible,title:(G=u.filterDialogSearchParam)!=null&&G.code?ji(u.filterDialogSearchParam.code):"",resourceType:P,searchParam:u.filterDialogSearchParam,filter:u.filterDialogFilter,defaultValue:"",onOk:R=>{x(Em(e.search,R.code,R.operator,R.value)),d({...p.current,filterDialogVisible:!1})},onCancel:()=>{d({...p.current,filterDialogVisible:!1})}},(X=u.filterDialogSearchParam)==null?void 0:X.code)]})}const qc=f.memo(sfe);function lfe(e){const t=(e.filters??[]).filter(r=>e.searchParams.find(n=>n.code===r.code));return t.length===0?s.jsx("span",{children:"no filters"}):s.jsx(s.Fragment,{children:t.map(r=>s.jsxs("div",{children:[i1(r.operator)," ",s.jsx(B4,{resourceType:e.resourceType,filter:r})]},`filter-${r.code}-${r.operator}-${r.value}`))})}function cfe(e){return Math.floor((e.offset??0)/(e.count??Fc))+1}function ufe(e,t){const r=e.count??Fc;return Math.ceil(t/r)}function dfe(e,t){return Math.min(t,(e.offset??0)+1)}function ffe(e,t){return Math.min(t,((e.offset??0)+1)*(e.count??Fc))}function pfe(e){const t=ae(),[r,n]=f.useState(!1),[o,i]=f.useState(),{query:a,fields:l}=e,[c,u]=f.useState(),[d,p]=f.useState({}),h=f.useRef();h.current=c;const m=f.useRef({});m.current=d,f.useEffect(()=>{i(void 0),t.graphql(a).then(u).catch(w=>i(dt(w)))},[t,a]);function g(w,b){w.stopPropagation();const O=w.target.checked,P={...m.current};O?P[b]=!0:delete P[b],p(P)}function v(w){var E;w.stopPropagation();const C=w.target.checked,O={},P=(E=h.current)==null?void 0:E.data.ResourceList;C&&P&&P.forEach($=>{$.id&&(O[$.id]=!0)}),p(O)}function _(){var b;const w=(b=h.current)==null?void 0:b.data.ResourceList;if(!w||w.length===0)return!1;for(const C of w)if(C.id&&!m.current[C.id])return!1;return!0}function y(w,b){u4(w.target)||(ct(w),w.button!==1&&e.onClick&&e.onClick(new hh(b,w)),w.button===1&&e.onAuxClick&&e.onAuxClick(new hh(b,w)))}if(f.useEffect(()=>{t.requestSchema(e.resourceType).then(()=>n(!0)).catch(console.log)},[t,e.resourceType]),!r)return s.jsx(hn,{});const x=e.checkboxesEnabled;return s.jsxs("div",{onContextMenu:w=>ct(w),"data-testid":"search-control",children:[s.jsxs(xa,{children:[s.jsx("thead",{children:s.jsxs("tr",{children:[x&&s.jsx("th",{children:s.jsx("input",{type:"checkbox",value:"checked","aria-label":"all-checkbox","data-testid":"all-checkbox",checked:_(),onChange:w=>v(w)})}),l.map(w=>s.jsx("th",{children:w.name},w.name))]})}),s.jsx("tbody",{children:c==null?void 0:c.data.ResourceList.map(w=>w&&s.jsxs("tr",{"data-testid":"search-control-row",onClick:b=>y(b,w),onAuxClick:b=>y(b,w),children:[x&&s.jsx("td",{children:s.jsx("input",{type:"checkbox",value:"checked","data-testid":"row-checkbox","aria-label":`Checkbox for ${w.id}`,checked:!!d[w.id],onChange:b=>g(b,w.id)})}),l.map(b=>s.jsx("td",{children:s.jsx(Sde,{propertyType:b.propertyType,path:b.fhirPath,resource:w})},b.name))]},w.id))})]}),(c==null?void 0:c.data.ResourceList.length)===0&&s.jsx("div",{"data-testid":"empty-search",children:"No results"}),o&&s.jsx("div",{"data-testid":"search-error",children:s.jsx("pre",{style:{textAlign:"left"},children:JSON.stringify(o,void 0,2)})}),e.onBulk&&s.jsx(re,{onClick:()=>e.onBulk(Object.keys(m.current)),children:"Bulk..."})]})}const hfe=f.memo(pfe);function In(e){return s.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 491 491",style:{width:e.size,height:e.size},children:[s.jsx("title",{children:"Medplum Logo"}),s.jsx("path",{fill:e.fill??"#ad7136",d:"M282 67c6-16 16-29 29-40L289 0c-22 17-37 41-43 68l17 23 19-24z"}),s.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"}),s.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"}),s.jsx("path",{fill:e.fill??"#40bc26",d:"M207 220a176 176 0 01-177 43A176 176 0 01251 43l1 5c17 59 2 125-45 172z"}),s.jsx("path",{fill:e.fill??"#33961e",d:"M252 48A421 421 0 0057 270l-27-7A176 176 0 01251 43l1 5z"})]})}function mfe(e){const{group:t}=e;return s.jsx(un,{withBorder:!0,radius:"md",p:"xs",display:"flex",sx:{alignItems:"center",justifyContent:"center"},children:s.jsxs(Y,{children:[t.measureScore&&s.jsx(yfe,{group:t}),!t.measureScore&&s.jsx(vfe,{group:t})]})})}function gfe(e){const{measure:t}=e;return s.jsxs(s.Fragment,{children:[s.jsx(oe,{fz:"md",fw:500,mb:8,children:t.title}),s.jsx(oe,{fz:"xs",c:"dimmed",mb:8,children:t.subtitle})]})}function vfe(e){const{group:t}=e,r=t.population,n=r==null?void 0:r.find(c=>js(c.code)==="numerator"),o=r==null?void 0:r.find(c=>js(c.code)==="denominator"),i=n==null?void 0:n.count,a=o==null?void 0:o.count;if(a===0)return s.jsxs(ie,{children:[s.jsx(ue,{order:3,children:"Not Applicable"}),s.jsx(oe,{children:`Denominator: ${a}`})]});if(i===void 0||a===void 0)return s.jsxs(ie,{children:[s.jsx(ue,{order:3,children:"Insufficient Data"}),s.jsx(oe,{children:`Numerator: ${i}`}),s.jsx(oe,{children:`Denominator: ${a}`})]});const l=i/a*100;return s.jsx(hx,{size:120,thickness:12,roundCaps:!0,sections:[{value:l,color:W4(l)}],label:s.jsx(lp,{justify:"center",children:s.jsxs(oe,{fw:700,fz:18,children:[i," / ",a]})})})}function yfe(e){var n,o,i;const{group:t}=e,r=((n=t.measureScore)==null?void 0:n.unit)??((o=t.measureScore)==null?void 0:o.code);return s.jsx(s.Fragment,{children:r==="%"?s.jsx(hx,{size:120,thickness:12,roundCaps:!0,sections:[{value:xfe(t),color:W4(((i=t==null?void 0:t.measureScore)==null?void 0:i.value)??0)}],label:s.jsx(lp,{justify:"center",children:s.jsx(oe,{fw:700,fz:18,children:s.jsx(mc,{value:t.measureScore})})})}):s.jsx(lp,{h:120,align:"center",children:s.jsx(ue,{order:3,children:s.jsx(mc,{value:t.measureScore})})})})}function xfe(e){var n,o;const t=(n=e.measureScore)==null?void 0:n.value,r=(o=e.measureScore)==null?void 0:o.unit;return t?t<=1&&r==="%"?t*100:t:0}function W4(e){return e<=33?"red":e<=67?"yellow":"green"}function wfe(e){var n;const t=Xe(e.measureReport),[r]=Ole("Measure",{url:t==null?void 0:t.measure});return t?s.jsxs(ie,{children:[r&&s.jsx(gfe,{measure:r}),s.jsx(FN,{cols:3,breakpoints:[{maxWidth:"48rem",cols:2,spacing:"md"},{maxWidth:"36rem",cols:1,spacing:"sm"}],spacing:"md",children:(n=t.group)==null?void 0:n.map((o,i)=>s.jsx(mfe,{group:o},o.id??i))})]}):null}function Vo(e){var r;const t=((r=e.outcome)==null?void 0:r.issue)||e.issues;return!t||t.length===0?null:s.jsx($c,{icon:s.jsx(bm,{size:16}),color:"red",children:t.map(n=>{var o;return s.jsx("div",{"data-testid":"text-field-error",children:H5(n)},(o=n.details)==null?void 0:o.text)})})}function bfe(e){const t=f.useCallback((r,n,o)=>{const i=`${n}/${o}`,a=100;return Promise.allSettled([r.readHistory("Patient",o),r.search("Communication",{subject:i,_count:a}),r.search("Device",{patient:i,_count:a}),r.search("DeviceRequest",{patient:i,_count:a}),r.search("DiagnosticReport",{subject:i,_count:a}),r.search("Media",{subject:i,_count:a}),r.search("ServiceRequest",{subject:i,_count:a}),r.search("Task",{subject:i,_count:a})])},[]);return s.jsx(Cm,{value:e.patient,loadTimelineResources:t,createCommunication:(r,n,o)=>({resourceType:"Communication",status:"completed",subject:ht(r),sender:ht(n),sent:new Date().toISOString(),payload:[{contentString:o}]}),createMedia:(r,n,o)=>({resourceType:"Media",status:"completed",subject:ht(r),operator:ht(n),issued:new Date().toISOString(),content:o})})}const H4=W(e=>({section:{position:"relative",margin:"4px 4px 8px 0",padding:"6px 12px 16px 6px",border:`1.5px solid ${e.colors.gray[1]}`,borderRadius:e.radius.sm,transition:"all 0.1s"},hovering:{border:`1.5px solid ${e.colors.blue[5]}`},editing:{border:`1.5px solid ${e.colors.gray[1]}`,borderLeft:`4px solid ${e.colors.blue[5]}`},bottomActions:{position:"absolute",right:4,bottom:0,fontSize:e.fontSizes.xs,"& a":{marginLeft:8}}}));function _fe(e){const t=ae(),r=Xe(e.value),[n,o]=f.useState(!1),[i,a]=f.useState(),[l,c]=f.useState(),[u,d]=f.useState();function p(){c(void 0)}function h(){a(void 0)}const m=f.useRef();if(m.current=u,f.useEffect(()=>{t.requestSchema("PlanDefinition").then(()=>o(!0)).catch(console.log)},[t]),f.useEffect(()=>(d(Efe(r??{resourceType:"PlanDefinition"})),document.addEventListener("mouseover",p),document.addEventListener("click",h),()=>{document.removeEventListener("mouseover",p),document.removeEventListener("click",h)}),[r]),!n||!u)return null;function g(v,_){d({...m.current,[v]:_})}return s.jsx("div",{children:s.jsxs(De,{testid:"questionnaire-form",onSubmit:()=>e.onSubmit(u),children:[s.jsx(le,{label:"Plan Title",defaultValue:u.title,onChange:v=>g("title",v.currentTarget.value)}),s.jsx(q4,{actions:u.action||[],selectedKey:i,setSelectedKey:a,hoverKey:l,setHoverKey:c,onChange:v=>g("action",v)}),s.jsx(re,{type:"submit",children:"Save"})]})})}function q4(e){const{classes:t}=H4(),r=f.useRef();r.current=e.actions;function n(a){e.onChange(r.current.map(l=>l.id===a.id?a:l))}function o(a){e.onChange([...r.current,a]),e.setSelectedKey(a.id)}function i(a){e.onChange(r.current.filter(l=>l!==a))}return s.jsxs("div",{className:t.section,children:[e.actions.map(a=>s.jsx("div",{children:s.jsx(Sfe,{action:a,selectedKey:e.selectedKey,setSelectedKey:e.setSelectedKey,hoverKey:e.hoverKey,setHoverKey:e.setHoverKey,onChange:n,onRemove:()=>i(a)})},a.id)),s.jsx("div",{className:t.bottomActions,children:s.jsx(Le,{href:"#",onClick:a=>{ct(a),o({id:Q4()})},children:"Add action"})})]})}function Sfe(e){const{classes:t,cx:r}=H4(),{action:n}=e,o=Cfe(n),i=e.selectedKey===e.action.id,a=e.hoverKey===e.action.id;function l(d){d.stopPropagation(),e.setSelectedKey(e.action.id)}function c(d){ct(d),e.setHoverKey(e.action.id)}const u=r(t.section,{[t.editing]:i,[t.hovering]:a&&!i});return s.jsxs("div",{"data-testid":n.id,className:u,onClick:l,onMouseOver:c,onFocus:c,children:[i?s.jsx(jfe,{action:n,actionType:o,onChange:e.onChange,selectedKey:e.selectedKey,setSelectedKey:e.setSelectedKey,hoverKey:e.hoverKey,setHoverKey:e.setHoverKey,onRemove:e.onRemove}):s.jsx(Pfe,{action:n,actionType:o}),s.jsx("div",{className:t.bottomActions,children:s.jsx(Le,{href:"#",onClick:d=>{d.preventDefault(),e.onRemove()},children:"Remove"})})]})}const xy={path:"PlanDefinition.action.timing[x]",min:0,max:1,description:"",isArray:!1,constraints:[],type:["dateTime","Period","Range","Timing"].map(e=>({code:e}))};function Pfe(e){const{action:t,actionType:r}=e,[n,o]=G4(t);return s.jsxs("div",{children:[s.jsxs("div",{children:[t.title||"Untitled"," ",r&&`(${r})`]}),t.definitionCanonical&&s.jsx("div",{children:s.jsx(ph,{value:{reference:t.definitionCanonical}})}),n&&s.jsx("div",{children:s.jsx(To,{property:xy,propertyType:o,value:n})})]})}function jfe(e){const{action:t}=e,[r,n]=f.useState(e.actionType);function o(i,a){e.onChange({...t,[i]:a})}return s.jsxs(je,{spacing:"xl",children:[s.jsx(le,{name:`actionTitle-${t.id}`,label:"Title",defaultValue:t.title,onChange:i=>o("title",i.currentTarget.value)}),s.jsx(le,{name:`actionDescription-${t.id}`,label:"Description",defaultValue:t.description,onChange:i=>o("description",i.currentTarget.value)}),s.jsx(mt,{label:"Type of Action",description:"The type of the action to be performed.",name:`actionType-${t.id}`,defaultValue:r,onChange:i=>n(i.currentTarget.value),data:["","appointment","lab","questionnaire","task"]}),t.action&&t.action.length>0&&s.jsx(q4,{actions:t.action,selectedKey:e.selectedKey,setSelectedKey:e.setSelectedKey,hoverKey:e.hoverKey,setHoverKey:e.setHoverKey,onChange:i=>o("action",i)}),(()=>{switch(r){case"appointment":return s.jsx(Qu,{title:"Appointment",description:"The subject must schedule an appointment from the schedule.",resourceType:"Schedule",action:t,onChange:e.onChange});case"lab":return s.jsx(Qu,{title:"Lab",description:"The subject must complete the following lab panel.",resourceType:"ActivityDefinition",action:t,onChange:e.onChange});case"questionnaire":return s.jsx(Qu,{title:"Questionnaire",description:"The subject must complete the selected questionnaire.",resourceType:"Questionnaire",action:t,onChange:e.onChange});case"task":return s.jsx(Qu,{title:"Task",description:"The subject must complete the following task.",resourceType:"ActivityDefinition",action:t,onChange:e.onChange});default:return null}})(),s.jsx(ot,{title:"Timing",description:"When the action should take place.",children:s.jsx(Ofe,{name:"timing-"+t.id,action:t,onChange:e.onChange})})]})}function Qu(e){const{id:t,definitionCanonical:r}=e.action,n=r!=null&&r.startsWith(e.resourceType+"/")?{reference:r}:void 0;return s.jsx(Vs,{name:t,resourceType:e.resourceType,defaultValue:n,loadOnFocus:!0,onChange:o=>{o?e.onChange({...e.action,definitionCanonical:nt(o)}):e.onChange({...e.action,definitionCanonical:void 0})}})}function Ofe(e){const t=e.action,r="timing",[n,o]=G4(t);return s.jsx(la,{property:xy,name:"timing[x]",defaultValue:n,defaultPropertyType:o,onChange:(i,a)=>{e.onChange(gy(t,r,a??r,xy,i))}})}function Cfe(e){var t,r,n;if((t=e.definitionCanonical)!=null&&t.startsWith("Schedule"))return"appointment";if((r=e.definitionCanonical)!=null&&r.startsWith("Questionnaire/"))return"questionnaire";if((n=e.definitionCanonical)!=null&&n.startsWith("ActivityDefinition/"))return"task"}function G4(e){return Bc({type:"PlanDefinitionAction",value:e},"timing")}let Bg=1;function Q4(e){if(e){if(e.startsWith("id-")){const t=parseInt(e.substring(3),10);isNaN(t)||(Bg=Math.max(Bg,t+1))}return e}return"id-"+Bg++}function Efe(e){return{...e,action:K4(e.action)}}function K4(e){if(e)return e.map(t=>({...t,id:Q4(t.id),action:K4(t.action)}))}var st=(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))(st||{});function $fe(e){return e.type==="choice"||e.type==="open-choice"}function kfe(e,t){if(!e.enableWhen)return!0;const r=e.enableBehavior??"any";for(const n of e.enableWhen){const o=Y4(t,n.question);if(n.operator==="exists"&&!n.answerBoolean&&!(o!=null&&o.length)){if(r==="any")return!0;continue}const{anyMatch:i,allMatch:a}=Ife(n,o,r);if(r==="any"&&i)return!0;if(r==="all"&&!a)return!1}return r!=="any"}function Rfe(e,t,r){return e.map(n=>{var a;const o=(a=r.answerOption)==null?void 0:a.find(l=>_a(l.valueCoding)===n||l[t]===n),i=yr({type:"QuestionnaireItemAnswerOption",value:o},"value");return{[t]:i==null?void 0:i.value}})}function Y4(e,t){if(e)for(const r of e){if(r.linkId===t)return r.answer;if(r.item){const n=Y4(r.item,t);if(n)return n}}}function Tfe(e,t,r){if(r==="exists")return!!e===t.value;if(e){const n=r==="="||r==="!="?r==null?void 0:r.replace("=","~"):r,[{value:o}]=hc(`%actualAnswer ${n} %expectedAnswer`,[e],{actualAnswer:e,expectedAnswer:t});return o}else return!1}function Ife(e,t,r){const n=t||[],o=yr({type:"QuestionnaireItemEnableWhen",value:e},"answer[x]");let i=!1,a=!0;for(const l of n){const c=yr({type:"QuestionnaireResponseItemAnswer",value:l},"value[x]"),{operator:u}=e;if(Tfe(c,o,u)?i=!0:a=!1,r==="any"&&i)break}return{anyMatch:i,allMatch:a}}function X4(e){var r,n;const t=hm(e,"http://hl7.org/fhir/StructureDefinition/questionnaire-referenceResource");if(t){if(t.valueCode!==void 0)return[t.valueCode];if(t.valueCodeableConcept)return(n=(r=t.valueCodeableConcept)==null?void 0:r.coding)==null?void 0:n.map(o=>o.code)}}function Ug(e,t){var o;const r=ba(e);let n=hm(r,"http://hl7.org/fhir/StructureDefinition/questionnaire-referenceResource");return!t||t.length===0?(n&&(r.extension=(o=r.extension)==null?void 0:o.filter(i=>i!==n)),r):(n||(r.extension||(r.extension=[]),n={url:"http://hl7.org/fhir/StructureDefinition/questionnaire-referenceResource"},r.extension.push(n)),t.length===1?(n.valueCode=t[0],delete n.valueCodeableConcept):(n.valueCodeableConcept={coding:t.map(i=>({code:i}))},delete n.valueCode),r)}function Dfe(e,t,r){const n=hm(e,"http://hl7.org/fhir/StructureDefinition/questionnaire-referenceFilter");if(!(n!=null&&n.valueString))return;let o=n.valueString;t!=null&&t.reference&&(o=o.replaceAll("$subj",t.reference)),r!=null&&r.reference&&(o=o.replaceAll("$encounter",r.reference));const i={},a=o.split("&");for(const l of a){const[c,u]=Pie(l,"=",2);i[c]=u}return i}function Nfe(e){return{resourceType:"QuestionnaireResponse",questionnaire:nt(e),item:J4(e.item)}}function J4(e){return(e==null?void 0:e.map(Z4))??[]}function Z4(e){var t;return{id:Mfe(),linkId:e.linkId,text:e.text,item:J4(e.item),answer:((t=e.initial)==null?void 0:t.map(Lfe))??[]}}let Afe=1;function Mfe(){return"id-"+Afe++}function Lfe(e){return{...e}}function zfe(e){return e.value.display||e.value.reference||Ir(e.value)}function Ffe(e){var r,n,o,i;const t=(r=e==null?void 0:e.item)==null?void 0:r[0];if(t){const a=hm(t,"http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl");if(((i=(o=(n=a==null?void 0:a.valueCodeableConcept)==null?void 0:n.coding)==null?void 0:o[0])==null?void 0:i.code)==="page")return e.item.length}return 1}const e3=f.createContext({});function wy(e){const t=f.useContext(e3),r=e.item,n=e.response;function o(u){var p,h,m,g;let d;Array.isArray(u)?d=u:e.index>=(((h=(p=e.response)==null?void 0:p.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((_,y)=>y===e.index?u:_)??[],e.onChange({id:n==null?void 0:n.id,linkId:n==null?void 0:n.linkId,text:r.text,answer:d})}const i=r.type;if(!i)return null;const a=r.linkId;if(!a)return null;const l=r.initial&&r.initial.length>0?r.initial[0]:void 0,c=a1(n,e.index)??yr({type:"QuestionnaireItemInitial",value:l},"value");switch(i){case st.display:return s.jsx("p",{children:e.item.text},e.item.linkId);case st.boolean:return s.jsx(v4,{title:e.item.text,htmlFor:e.item.linkId,children:s.jsx(kn,{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 st.decimal:return s.jsx(le,{type:"number",step:"any",id:a,name:a,required:r.required,defaultValue:c==null?void 0:c.value,onChange:u=>o({valueDecimal:u.currentTarget.valueAsNumber})});case st.integer:return s.jsx(le,{type:"number",step:1,id:a,name:a,required:r.required,defaultValue:c==null?void 0:c.value,onChange:u=>o({valueInteger:u.currentTarget.valueAsNumber})});case st.date:return s.jsx(le,{type:"date",id:a,name:a,required:r.required,defaultValue:c==null?void 0:c.value,onChange:u=>o({valueDate:u.currentTarget.value})});case st.dateTime:return s.jsx(aa,{name:a,required:r.required,defaultValue:c==null?void 0:c.value,onChange:u=>o({valueDateTime:u})});case st.time:return s.jsx(le,{type:"time",id:a,name:a,required:r.required,defaultValue:c==null?void 0:c.value,onChange:u=>o({valueTime:u.currentTarget.value})});case st.string:case st.url:return s.jsx(le,{id:a,name:a,required:r.required,defaultValue:c==null?void 0:c.value,onChange:u=>o({valueString:u.currentTarget.value})});case st.text:return s.jsx(Ic,{id:a,name:a,required:r.required,defaultValue:c==null?void 0:c.value,onChange:u=>o({valueString:u.currentTarget.value})});case st.attachment:return s.jsx(Y,{py:4,children:s.jsx(p4,{name:a,defaultValue:c==null?void 0:c.value,onChange:u=>o({valueAttachment:u})})});case st.reference:return s.jsx(jm,{name:a,required:r.required,targetTypes:X4(r),searchCriteria:Dfe(r,t.subject,t.encounter),defaultValue:c==null?void 0:c.value,onChange:u=>o({valueReference:u})});case st.quantity:return s.jsx(sa,{name:a,required:r.required,defaultValue:c==null?void 0:c.value,onChange:u=>o({valueQuantity:u}),disableWheel:!0});case st.choice:case st.openChoice:return qfe(r)&&!r.answerValueSet?s.jsx(Vfe,{name:a,item:r,initial:l,response:n,onChangeAnswer:u=>o(u)}):s.jsx(Bfe,{name:a,item:r,initial:l,response:n,onChangeAnswer:u=>o(u)});default:return null}}function Vfe(e){var c;const{name:t,item:r,initial:n,response:o}=e;if(!((c=r.answerOption)!=null&&c.length))return s.jsx(t3,{});const i=yr({type:"QuestionnaireItemInitial",value:n},"value"),a=[""];for(const u of r.answerOption){const d=yr({type:"QuestionnaireItemAnswerOption",value:u},"value");a.push(aC(d))}const l=a1(o)??i;if(r.repeats){const{propertyName:u,data:d}=Gfe(e.item),p=Wfe(o);return s.jsx(lm,{data:d,placeholder:"Select items",searchable:!0,defaultValue:p||[aC(i)],onChange:h=>{const m=Rfe(h,u,r);e.onChangeAnswer(m)}})}return s.jsx(mt,{id:t,name:t,onChange:u=>{const d=u.currentTarget.selectedIndex;if(d===0){e.onChangeAnswer({});return}const p=r.answerOption[d-1],h=yr({type:"QuestionnaireItemAnswerOption",value:p},"value"),m="value"+sr(h.type);e.onChangeAnswer({[m]:h.value})},defaultValue:_a(l==null?void 0:l.value)||(l==null?void 0:l.value),data:a})}function Bfe(e){var a;const{name:t,item:r,initial:n,onChangeAnswer:o,response:i}=e;return!((a=r.answerOption)!=null&&a.length)&&!r.answerValueSet?s.jsx(t3,{}):r.answerValueSet?s.jsx(x4,{name:t,binding:r.answerValueSet,onChange:l=>o({valueCoding:l})}):s.jsx(Ufe,{name:(i==null?void 0:i.id)??t,item:r,initial:n,response:i,onChangeAnswer:o})}function Ufe(e){const{name:t,item:r,initial:n,onChangeAnswer:o,response:i}=e,a=Sa("QuestionnaireItemAnswerOption","value[x]"),l=yr({type:"QuestionnaireItemInitial",value:n},"value"),c=[];let u;if(r.answerOption)for(let h=0;h<r.answerOption.length;h++){const m=r.answerOption[h],g=`${t}-option-${h}`,v=yr({type:"QuestionnaireItemAnswerOption",value:m},"value");l&&Ir(v)===Ir(l)&&(u=g),c.push([g,v])}const d=a1(i),p=Hfe(c,d);return s.jsx(Wp.Group,{name:t,value:p??u,onChange:h=>{const m=c.find(g=>g[0]===h);if(m){const g=m[1],v="value"+sr(g.type);o({[v]:g.value})}},children:c.map(([h,m])=>s.jsx(Wp,{id:h,value:h,py:4,label:s.jsx(To,{property:a,propertyType:m.type,value:m.value})},h))})}function t3(){return s.jsx(le,{disabled:!0,placeholder:"No Answers Defined"})}function r3(e){return yr({type:"QuestionnaireItemAnswer",value:e},"value")}function a1(e,t=0){const r=e.answer;return r3((r==null?void 0:r[t])??{})}function Wfe(e){const t=e.answer;return t?t.map(n=>r3(n)).map(n=>_a(n==null?void 0:n.value)||(n==null?void 0:n.value)):[]}function Hfe(e,t){var r;return(r=e.find(n=>mm(n[1].value,t==null?void 0:t.value)))==null?void 0:r[0]}function aC(e){if(e)return e.type==="CodeableConcept"?js(e.value):e.type==="Coding"?_a(e.value):e.type==="Reference"?zfe(e):e.value.toString()}function qfe(e){var t;return!!((t=e.extension)!=null&&t.some(r=>{var n,o,i;return r.url==="http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl"&&((i=(o=(n=r.valueCodeableConcept)==null?void 0:n.coding)==null?void 0:o[0])==null?void 0:i.code)==="drop-down"}))}function Gfe(e){var i;if(((i=e.answerOption)==null?void 0:i.length)===0)return{propertyName:"",data:[]};const t=e.answerOption[0],r=yr({type:"QuestionnaireItemAnswerOption",value:t},"value"),n="value"+sr(r.type),o=(e.answerOption??[]).map(a=>({value:sC(a,n),label:sC(a,n)}));return{propertyName:n,data:o}}function sC(e,t){var r;return _a(e.valueCoding)||((r=e[t])==null?void 0:r.toString())}const Qfe=W(e=>({section:{position:"relative",margin:"4px 4px 8px 0",padding:"6px 12px 16px 6px",border:`1.5px solid ${e.colors.gray[1]}`,borderRadius:e.radius.sm,transition:"all 0.1s"},hovering:{border:`1.5px solid ${e.colors.blue[5]}`},editing:{border:`1.5px solid ${e.colors.gray[1]}`,borderLeft:`4px solid ${e.colors.blue[5]}`},questionBody:{maxWidth:600},topActions:{position:"absolute",right:32,top:1,padding:4,color:e.colors.gray[5],fontSize:e.fontSizes.xs},bottomActions:{position:"absolute",right:4,bottom:0,fontSize:e.fontSizes.xs,"& a":{marginLeft:8}},movementActions:{position:"absolute",right:8,top:0,paddingTop:8,fontSize:e.fontSizes.xs,"& a":{marginLeft:8}},movementIcons:{color:e.colors.gray[5]},columnAlignment:{display:"flex",flexDirection:"column"},linkIdInput:{width:100,marginBottom:4},typeSelect:{width:100}}));function Kfe(e){const t=ae(),r=Xe(e.questionnaire),[n,o]=f.useState(!1),[i,a]=f.useState(),[l,c]=f.useState(),[u,d]=f.useState();function p(){d(void 0)}function h(){c(void 0)}f.useEffect(()=>{t.requestSchema("Questionnaire").then(()=>o(!0)).catch(console.log)},[t]),f.useEffect(()=>(a(Zfe(r??{resourceType:"Questionnaire"})),document.addEventListener("mouseover",p),document.addEventListener("click",h),()=>{document.removeEventListener("mouseover",p),document.removeEventListener("click",h)}),[r]);const m=(g,v)=>{a(g),e.autoSave&&!v&&e.onSubmit&&e.onSubmit(g)};return!n||!i?null:s.jsx("div",{children:s.jsxs(De,{testid:"questionnaire-form",onSubmit:()=>e.onSubmit(i),children:[s.jsx(n3,{item:i,selectedKey:l,setSelectedKey:c,hoverKey:u,setHoverKey:d,onChange:m}),s.jsx(re,{type:"submit",children:"Save"})]})})}function n3(e){var C;const{classes:t,cx:r}=Qfe(),n=e.item,o=e.item,i=Fo(e.item),a=i||o.type===st.group,l=o.linkId??"[untitled]",c=e.selectedKey===e.item.id,u=e.hoverKey===e.item.id,d=f.useRef();d.current=e.item;function p(O){ct(O),e.setSelectedKey(e.item.id)}function h(O){ct(O),e.setHoverKey(e.item.id)}function m(O){var E;const P=d.current;e.onChange({...P,item:(E=P.item)==null?void 0:E.map($=>$.id===O.id?O:$)})}function g(O,P){e.onChange({...e.item,item:[...e.item.item??[],O]},P)}function v(O){var P;e.onChange({...e.item,item:(P=e.item.item)==null?void 0:P.filter(E=>E!==O)})}function _(O,P){e.onChange({...d.current,[O]:P})}function y(O){e.onChange({...e.item,...O})}function x(O){var P;e.onChange({...e.item,item:(P=e.item.item)==null?void 0:P.map(E=>E===O?{...E,repeats:!E.repeats}:E)})}function w(O,P){const E=rpe(e.item.item,O,P);e.onChange({...e.item,item:E})}const b=r(t.section,{[t.editing]:c,[t.hovering]:u&&!c});return s.jsxs("div",{"data-testid":o.linkId,className:b,onClick:p,onMouseOver:h,onFocus:h,children:[s.jsx("div",{className:t.questionBody,children:c?s.jsxs(s.Fragment,{children:[i&&s.jsx(le,{size:"xl",defaultValue:n.title,onBlur:O=>_("title",O.currentTarget.value)}),!i&&s.jsx(Ic,{autosize:!0,minRows:2,defaultValue:o.text,onBlur:O=>_("text",O.currentTarget.value)}),o.type==="reference"&&s.jsx(Jfe,{item:o,onChange:y}),$fe(o)&&s.jsx(Yfe,{item:o,onChange:O=>y(O)})]}):s.jsxs(s.Fragment,{children:[n.title&&s.jsx(ue,{children:n.title}),o.text&&s.jsx("div",{children:o.text}),!a&&s.jsx(wy,{item:o,index:0,onChange:()=>{},response:{}})]})}),(C=o.item)==null?void 0:C.map((O,P)=>s.jsx("div",{children:s.jsx(n3,{item:O,selectedKey:e.selectedKey,setSelectedKey:e.setSelectedKey,hoverKey:e.hoverKey,isFirst:P===0,isLast:P===(e.item.item??[]).length-1,setHoverKey:e.setHoverKey,onChange:m,onRemove:()=>v(O),onRepeatable:x,onMoveUp:()=>w(P,-1),onMoveDown:()=>w(P,1)})},O.id)),!a&&s.jsx("div",{className:t.topActions,children:c?s.jsxs(s.Fragment,{children:[s.jsx(le,{size:"xs",className:t.linkIdInput,defaultValue:o.linkId,onBlur:O=>_("linkId",O.currentTarget.value)}),!a&&s.jsx(mt,{size:"xs",className:t.typeSelect,defaultValue:o.type,onChange:O=>_("type",O.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"}]})]}):s.jsx("div",{children:l})}),!i&&s.jsx(ie,{className:t.movementActions,children:s.jsxs(ie,{className:t.columnAlignment,children:[!e.isFirst&&s.jsx(Le,{href:"#",onClick:O=>{O.preventDefault(),e.onMoveUp&&e.onMoveUp()},children:s.jsx(Lle,{"data-testid":"up-button",size:15,className:t.movementIcons})}),!e.isLast&&s.jsx(Le,{href:"#",onClick:O=>{O.preventDefault(),e.onMoveDown&&e.onMoveDown()},children:s.jsx(Mle,{"data-testid":"down-button",size:15,className:t.movementIcons})})]})}),s.jsxs("div",{className:t.bottomActions,children:[a&&s.jsxs(s.Fragment,{children:[s.jsx(Le,{href:"#",onClick:O=>{O.preventDefault(),g({id:ua(),linkId:Sy("q"),type:"string",text:"Question"})},children:"Add item"}),s.jsx(Le,{href:"#",onClick:O=>{O.preventDefault(),g({id:ua(),linkId:Sy("g"),type:"group",text:"Group"},!0)},children:"Add group"})]}),i&&s.jsx(Le,{href:"#",onClick:O=>{O.preventDefault(),g(tpe(),!0)},children:"Add Page"}),c&&!i&&s.jsxs(s.Fragment,{children:[s.jsx(Le,{href:"#",onClick:O=>{O.preventDefault(),e.onRepeatable&&e.onRepeatable(o)},children:o.repeats?"Remove Repeatable":"Make Repeatable"}),s.jsx(Le,{href:"#",onClick:O=>{O.preventDefault(),e.onRemove&&e.onRemove()},children:"Remove"})]})]})]})}function Yfe(e){const t=Sa("QuestionnaireItemAnswerOption","value[x]"),r=e.item.answerOption??[];return s.jsxs("div",{children:[e.item.answerValueSet!==void 0?s.jsx(le,{placeholder:"Enter Value Set",defaultValue:e.item.answerValueSet,onChange:n=>e.onChange({...e.item,answerValueSet:n.target.value})}):s.jsx(Xfe,{options:r,property:t,item:e.item,onChange:e.onChange}),s.jsxs(ie,{display:"flex",children:[s.jsx(Le,{href:"#",onClick:n=>{ct(n),e.onChange({...e.item,answerValueSet:void 0,answerOption:[...r,{id:ua()}]})},children:"Add choice"}),s.jsx(pm,{w:"lg"}),s.jsx(Le,{href:"#",onClick:n=>{ct(n),e.onChange({...e.item,answerOption:[],answerValueSet:""})},children:"Add value set"})]})]})}function Xfe(e){return s.jsx("div",{children:e.options.map(t=>{const[r,n]=Bc({type:"QuestionnaireItemAnswerOption",value:t},"value");return s.jsxs("div",{style:{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center",width:"80%"},children:[s.jsx("div",{children:s.jsx(la,{name:"value[x]",property:e.property,defaultPropertyType:n,defaultValue:r,onChange:(o,i)=>{const a=[...e.options],l=a.findIndex(c=>c.id===t.id);a[l]={id:t.id,[i]:o},e.onChange({...e.item,answerOption:a})}},t.id)}),s.jsx("div",{children:s.jsx(Le,{href:"#",onClick:o=>{ct(o),e.onChange({...e.item,answerOption:e.options.filter(i=>i.id!==t.id)})},children:"Remove"})})]},t.id)})})}function Jfe(e){const t=X4(e.item)??[];return s.jsxs(s.Fragment,{children:[t.map((r,n)=>s.jsxs(Y,{children:[s.jsx(Vx,{name:"resourceType",placeholder:"Resource Type",defaultValue:r,onChange:o=>{e.onChange(Ug(e.item,t.map(i=>i===r?o:i)))}}),s.jsx(Le,{href:"#",onClick:o=>{ct(o),e.onChange(Ug(e.item,t.filter(i=>i!==r)))},children:"Remove"})]},`${r}-${n}`)),s.jsx(Le,{href:"#",onClick:r=>{ct(r),e.onChange(Ug(e.item,[...t,""]))},children:"Add Resource Type"})]})}let by=1,_y=1;function Sy(e){return e+by++}function ua(){return"id-"+_y++}function Zfe(e){return{...e,id:e.id||ua(),item:o3(e.item)}}function o3(e){if(e)return e.forEach(t=>{var r,n;(r=t.id)!=null&&r.match(/^id-\d+$/)&&(_y=Math.max(_y,parseInt(t.id.substring(3),10)+1)),(n=t.linkId)!=null&&n.match(/^q\d+$/)&&(by=Math.max(by,parseInt(t.linkId.substring(1),10)+1))}),e.map(t=>({...t,id:t.id||ua(),item:o3(t.item),answerOption:epe(t.answerOption)}))}function epe(e){if(e)return e.map(t=>({...t,id:t.id||ua()}))}function tpe(){return{id:ua(),linkId:Sy("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 rpe(e,t,r){const n=e??[],o=t+r;if(o<0||o>=n.length)return n;const i=[...n];return[i[t],i[o]]=[i[o],i[t]],i}function i3(e){const{item:t,response:r,onChange:n}=e,[o,i]=f.useState(npe(t,r??{}));if(!e.checkForQuestionEnabled(t)||!r)return null;if(t.type===st.display)return s.jsx("p",{children:t.text},t.linkId);const a=(t==null?void 0:t.repeats)&&t.type!==st.choice&&t.type!==st.openChoice;return t.type===st.boolean?s.jsx(wy,{item:t,response:r,onChange:l=>n([l]),index:0},t.linkId):s.jsxs(ot,{htmlFor:e.item.linkId,title:e.item.text,withAsterisk:e.item.required,children:[[...Array(o)].map((l,c)=>s.jsx(wy,{item:t,response:r,onChange:u=>n([u]),index:c},`${t.linkId}-${c}`)),a&&s.jsx(Le,{onClick:()=>i(l=>l+1),children:"Add Item"})]},e.item.linkId)}function npe(e,t){if(e.type===st.choice||e.type===st.openChoice)return 1;const r=t.answer;return r!=null&&r.length?r.length:1}function a3(e){const[t,r]=f.useState(e.response);if(t.length===0)return null;function n(i,a){const l=t.map((c,u)=>u===a?i[0]:c);r(l),e.onChange(l)}function o(){const i=Z4(e.item);r([...t,i])}return s.jsxs(s.Fragment,{children:[t.map((i,a)=>s.jsx(s3,{item:e.item,response:i,checkForQuestionEnabled:e.checkForQuestionEnabled,onChange:l=>n(l,a)},i.id)),e.item.repeats&&s.jsx(Le,{onClick:o,children:`Add Group: ${e.item.text}`})]})}function s3(e){var i;const{response:t,checkForQuestionEnabled:r,onChange:n}=e;function o(a){var d;const l=(d=t.item)==null?void 0:d.map(p=>a.find(m=>m.id===p.id)??p),c=l==null?void 0:l.concat(a.slice(1)),u={...t,item:c};n([u])}return e.checkForQuestionEnabled(e.item)?s.jsxs("div",{children:[e.item.text&&s.jsx(ue,{order:3,mb:"md",children:e.item.text}),s.jsx(je,{children:(i=e.item.item)==null?void 0:i.map(a=>{var l,c,u;return a.type===st.group?a.repeats?s.jsx(a3,{item:a,response:((l=t.item)==null?void 0:l.filter(d=>d.linkId===a.linkId))??[],checkForQuestionEnabled:r,onChange:o},a.linkId):s.jsx(s3,{item:a,checkForQuestionEnabled:r,response:((c=t.item)==null?void 0:c.find(d=>d.linkId===a.linkId))??{},onChange:o},a.linkId):s.jsx(i3,{item:a,response:(u=t.item)==null?void 0:u.find(d=>d.linkId===a.linkId),onChange:o,checkForQuestionEnabled:r},a.linkId)})})]},e.item.linkId):null}function ope(e){const{items:t,response:r,activePage:n,onChange:o,nextStep:i,prevStep:a,numberOfPages:l,renderPages:c,submitButtonText:u,checkForQuestionEnabled:d}=e,p=t.map(h=>{var v;const m=((v=r==null?void 0:r.item)==null?void 0:v.filter(_=>_.linkId===h.linkId))??[],g=h.type===st.group?s.jsx(a3,{item:h,response:m,onChange:o,checkForQuestionEnabled:d},h.linkId):s.jsx(i3,{item:h,response:m==null?void 0:m[0],onChange:o,checkForQuestionEnabled:d},h.linkId);return c?s.jsx(uc.Step,{label:h.text,children:g},h.linkId):g});return s.jsxs(s.Fragment,{children:[c&&s.jsx(uc,{active:n??0,allowNextStepsSelect:!1,p:6,children:p}),!c&&s.jsx(je,{children:p}),s.jsx(ipe,{activePage:n??0,numberOfPages:l,nextStep:i,prevStep:a,submitButtonText:u})]})}function ipe(e){const t=e.activePage>0,r=e.activePage<e.numberOfPages-1,n=e.activePage===e.numberOfPages-1;return s.jsxs(Y,{position:"right",mt:"xl",spacing:"xs",children:[t&&s.jsx(re,{onClick:e.prevStep,children:"Back"}),r&&s.jsx(re,{onClick:o=>{o.currentTarget.closest("form").reportValidity()&&e.nextStep()},children:"Next"}),n&&s.jsx(re,{type:"submit",children:e.submitButtonText??"Submit"})]})}function l3(e){const t=ae(),r=t.getProfile(),[n,o]=f.useState(!1),i=Xe(e.questionnaire),[a,l]=f.useState(),[c,u]=f.useState(0);f.useEffect(()=>{t.requestSchema("Questionnaire").then(()=>t.requestSchema("QuestionnaireResponse")).then(()=>o(!0)).catch(console.log)},[t]),f.useEffect(()=>{l(i?Nfe(i):void 0)},[i]);function d(v){const _=(a==null?void 0:a.item)??[],x={resourceType:"QuestionnaireResponse",item:c3(_,Array.isArray(v)?v:[v])};l(x)}function p(v){return kfe(v,(a==null?void 0:a.item)??[])}if(!n||!i)return null;const h=Ffe(i),m=()=>u(v=>v+1),g=()=>u(v=>v-1);return s.jsx(e3.Provider,{value:{subject:e.subject,encounter:e.encounter},children:s.jsxs(De,{testid:"questionnaire-form",onSubmit:()=>{e.onSubmit&&a&&e.onSubmit({...a,questionnaire:nt(i),subject:e.subject,source:ht(r),authored:new Date().toISOString(),status:"completed"})},children:[i.title&&s.jsx(ue,{children:i.title}),s.jsx(ope,{items:i.item??[],response:a,onChange:d,renderPages:h>1,activePage:c,numberOfPages:h,submitButtonText:e.submitButtonText,checkForQuestionEnabled:p,nextStep:m,prevStep:g})]})})}function ape(e,t){const r=c3(e.item??[],t.item??[]);return{...t,item:r.length>0?r:void 0,answer:t.answer&&t.answer.length>0?t.answer:e.answer}}function c3(e,t){const r=[],n=new Set;for(const o of e){const i=o.id,a=t.find(l=>l.id===i);a?(r.push(ape(o,a)),n.add(a.id)):r.push(o)}for(const o of t)n.has(o.id)||r.push(o);return r}const spe=W(e=>({section:{position:"relative",margin:"4px 4px 8px 0",padding:"6px 12px 16px 6px",border:`1.5px solid ${e.colors.gray[3]}`,borderRadius:e.radius.sm,transition:"all 0.1s"}})),lpe=["gender","age","gestationalAge","context","appliesTo","category"],cpe={definition:{resourceType:"ObservationDefinition"},onSubmit:()=>{}};function upe(e){e=Object.assign(cpe,e);const t=e.definition,[r,n]=f.useState([]),[o,i]=f.useState(1),[a,l]=f.useState(1);return f.useEffect(()=>{const g=ppe(t,l);n(hpe(g.qualifiedInterval||[],i))},[t]),s.jsxs(De,{testid:"reference-range-editor",onSubmit:c,children:[s.jsx(je,{children:r.map(g=>{var v;return s.jsx(dpe,{unit:gpe((v=t.quantitativeDetails)==null?void 0:v.unit),onChange:p,onAdd:h,onRemove:m,onRemoveGroup:d,intervalGroup:g},`group-${g.id}`)})}),s.jsx(vr,{title:"Add Group",size:"sm",onClick:g=>{ct(g),u({id:`group-id-${o}`,filters:{},intervals:[]}),i(v=>v+1)},children:s.jsx(Ix,{})}),s.jsx(Y,{position:"right",children:s.jsx(re,{type:"submit",children:"Save"})})]});function c(){const g=r.flatMap(v=>v.intervals).filter(v=>!vpe(v));e.onSubmit({...t,qualifiedInterval:g})}function u(g){n(v=>[...v,g])}function d(g){n(v=>v.filter(_=>_.id!==g.id))}function p(g,v){n(_=>{_=[..._];const y=_.find(w=>w.id===g),x=y==null?void 0:y.intervals.findIndex(w=>w.id===v.id);return x!==void 0&&(y!=null&&y.intervals[x])&&(y.intervals[x]=v),_})}function h(g,v){v.id===void 0&&(v.id=`id-${a}`,l(_=>_+1)),n(_=>{_=[..._];const y=_.findIndex(x=>x.id===g);if(y!==-1){const x={..._[y]};v={...v,...x.filters},x.intervals=[...x.intervals,v],_[y]=x}return _})}function m(g,v){n(_=>{_=[..._];const y=_.find(x=>x.id===g);return y&&(y.intervals=y.intervals.filter(x=>x.id!==v.id)),_})}}function dpe(e){const{intervalGroup:t,unit:r}=e,{classes:n}=spe();return s.jsx(Uc,{"data-testid":t.id,className:n.section,children:s.jsxs(je,{spacing:"lg",children:[s.jsx(Y,{position:"right",children:s.jsx(vr,{title:"Remove Group","data-testid":`remove-group-button-${t.id}`,size:"sm",onClick:o=>{ct(o),e.onRemoveGroup(t)},children:s.jsx(dh,{})},`remove-group-button-${t.id}`)}),s.jsx(fpe,{intervalGroup:t,onChange:e.onChange}),s.jsx(hr,{}),t.intervals.map(o=>s.jsxs(je,{spacing:"xs",children:[s.jsxs(Y,{children:[s.jsx(le,{"data-testid":`condition-${o.id}`,defaultValue:o.condition,label:"Condition: ",size:"sm",onChange:i=>{ct(i),e.onChange(t.id,{...o,condition:i.currentTarget.value.trim()})}},`condition-${o.id}`),s.jsx(vr,{title:"Remove Interval",size:"sm","data-testid":`remove-interval-${o.id}`,onClick:i=>{ct(i),e.onRemove(t.id,o)},children:s.jsx(dh,{})},`remove-interval-${o.id}`)]}),s.jsx(qx,{onChange:i=>{e.onChange(t.id,{...o,range:i})},name:`range-${o.id}`,defaultValue:o.range},`range-${o.id}`)]},`interval-${o.id}`)),s.jsx(vr,{title:"Add Interval",size:"sm",onClick:o=>{ct(o),e.onAdd(t.id,{range:{low:{unit:r},high:{unit:r}}})},children:s.jsx(Ix,{})})]})})}function fpe(e){var n,o;const{intervalGroup:t,onChange:r}=e;t.filters.age||(t.filters.age={});for(const i of["low","high"])(n=t.filters.age[i])!=null&&n.unit||(t.filters.age[i]={...t.filters.age[i],unit:"years",system:"http://unitsofmeasure.org"});return s.jsxs(je,{style:{maxWidth:"50%"},children:[s.jsx(Y,{children:s.jsx(mt,{data:["","male","female"],label:"Gender:",defaultValue:t.filters.gender||"",onChange:i=>{for(const a of t.intervals){let l=i.currentTarget.value;l===""&&(l=void 0),r(t.id,{...a,gender:l})}}})}),s.jsxs(Y,{spacing:"xs",children:[s.jsx(oe,{component:"label",htmlFor:`div-age-${t.id}`,children:"Age:"}),s.jsx("div",{id:`div-age-${t.id}`,children:s.jsx(qx,{name:`age-${t.id}`,defaultValue:t.filters.age,onChange:i=>{for(const a of t.intervals)r(t.id,{...a,age:i})}},`age-${t.id}`)})]}),s.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 a of t.intervals){let l=i.currentTarget.value;l===""?(l=void 0,r(t.id,{...a,context:void 0})):r(t.id,{...a,context:{text:l,coding:[{code:l,system:"http://terminology.hl7.org/CodeSystem/referencerange-meaning"}]}})}}}),s.jsx(mt,{data:["","reference","critical","absolute"],label:"Category: ",defaultValue:t.filters.category,onChange:i=>{for(const a of t.intervals){const l=i.currentTarget.value;l===""?r(t.id,{...a,category:void 0}):r(t.id,{...a,category:l})}}})]})}function ppe(e,t){const r=e.qualifiedInterval||[];let n=Math.max(...r.map(o=>{var a;const i=parseInt(((a=o.id)==null?void 0:a.substring(3))||"",10);return isNaN(i)?Number.NEGATIVE_INFINITY:i}))+1;return Number.isFinite(n)||(n=1),e={...e,qualifiedInterval:r.map(o=>({...o,id:o.id||`id-${n++}`}))},t(n),e}function hpe(e,t){let r=1;const n={};for(const o of e){const i=mpe(o);i in n||(n[i]={id:`group-id-${r++}`,filters:Object.fromEntries(lpe.map(a=>[a,o[a]])),intervals:[]}),n[i].intervals.push(o)}return t(r),Object.values(n)}function mpe(e){var r,n;return[`gender=${e.gender}`,`age=${dc(e.age)}`,`gestationalAge=${dc(e.gestationalAge)}`,`context=${(r=e.context)==null?void 0:r.text}`,`appliesTo=${(n=e.appliesTo)==null?void 0:n.map(o=>o.text).join("+")}`,`category=${e.category}`].join(":")}function gpe(e){return e&&(Sie(e,"http://unitsofmeasure.org")||e.text)}function vpe(e){var t,r,n,o;return((r=(t=e.range)==null?void 0:t.low)==null?void 0:r.value)===void 0&&((o=(n=e.range)==null?void 0:n.high)==null?void 0:o.value)===void 0}function ype(e){var u;const t=ae(),r=Xe(e.value),[n,o]=f.useState(!1),[i,a]=f.useState();if(f.useEffect(()=>{r&&!n&&(t.executeBatch(l(r)).then(a).catch(console.log),o(!0))},[t,r,n]),!r||!i)return null;return s.jsx(sn,{children:(u=r.action)==null?void 0:u.map((d,p)=>{var v,_,y,x,w,b;const h=d.resource&&c(d.resource),m=(_=(v=h==null?void 0:h.input)==null?void 0:v[0])==null?void 0:_.valueReference,g=(x=(y=h==null?void 0:h.output)==null?void 0:y[0])==null?void 0:x.valueReference;return s.jsxs(f.Fragment,{children:[s.jsx(sn.Col,{span:1,p:"md",children:(h==null?void 0:h.status)==="completed"?s.jsx(Gle,{}):s.jsx(wce,{color:"gray"})}),s.jsxs(sn.Col,{span:9,p:"xs",children:[s.jsx(oe,{weight:500,children:d.title}),d.description&&s.jsx("div",{children:d.description}),s.jsxs("div",{children:["Last edited by ",s.jsx(Wc,{value:(w=h==null?void 0:h.meta)==null?void 0:w.author})," on ",Dr((b=h==null?void 0:h.meta)==null?void 0:b.lastUpdated)]}),s.jsxs("div",{children:["Status: ",s.jsx(P4,{status:(h==null?void 0:h.status)||"unknown"})]})]}),s.jsxs(sn.Col,{span:2,p:"md",children:[m&&!g&&s.jsx(re,{onClick:()=>e.onStart(h,m),children:"Start"}),m&&g&&s.jsx(re,{onClick:()=>e.onEdit(h,m,g),children:"Edit"})]})]},`action-${p}`)})});function l(d){var h;const p=[];if(d.action)for(const m of d.action)(h=m.resource)!=null&&h.reference&&p.push({request:{method:"GET",url:m.resource.reference}});return{resourceType:"Bundle",type:"batch",entry:p}}function c(d){for(const p of i==null?void 0:i.entry)if(p.resource&&d.reference===nt(p.resource))return p.resource}}function u3(e,t){const r=xpe(e,t);return wpe(r,e,t)}function xpe(e,t){const r=e.length,n=t.length,o=r+n+1,i=1+2*o,a=i/2|0,l=new Array(i);l[a+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=a+u,p=d+1,h=d-1,m=l[p],g=l[h];let v,_=0;u===-c||u!==c&&g.i<m.i?(_=m.i,v=m):(_=g.i+1,v=g),l[h]=void 0;let y=_-u,x={i:_,j:y,prev:bpe(v),snake:!1};for(;_<r&&y<n&&e[_]===t[y];)_++,y++;if(_>x.i&&(x={i:_,j:y,prev:x,snake:!0}),l[d]=x,_>=r&&y>=n)return l[d]}l[a+c-1]=void 0}}function wpe(e,t,r){const n=[];let o=e;for(o.snake&&(o=o.prev);o!=null&&o.prev&&o.prev.j>=0;){const i=o.i,a=o.j;o=o.prev;const l=o.i,c=o.j,u={position:l,lines:t.slice(l,i)},d={position:c,lines:r.slice(c,a)};let p;u.lines.length===0&&d.lines.length>0?p="insert":u.lines.length>0&&d.lines.length===0?p="delete":p="change",n.push({original:u,revised:d,type:p}),o.snake&&(o=o.prev)}return n}function bpe(e){return e&&!e.snake&&e.prev?e.prev:e}function _pe(e){const t=e.entry.filter(n=>!!n.resource).map(n=>{var o;return{meta:(o=n.resource)==null?void 0:o.meta,lines:Ir(n.resource,!0).match(/[^\r\n]+/g)}}).sort((n,o)=>n.meta.lastUpdated.localeCompare(o.meta.lastUpdated)),r=t[0].lines.map(n=>({id:t[0].meta.versionId,meta:t[0].meta,value:n,span:1}));return Spe(r,t),Ppe(r),r}function Spe(e,t){for(let r=1;r<t.length;r++){const n=u3(t[r-1].lines,t[r].lines);for(const o of n){const i=o.original.position,a=o.original.lines,l=o.revised.lines;if((o.type==="delete"||o.type==="change")&&e.splice(i,a.length),o.type==="insert"||o.type==="change")for(let c=0;c<o.revised.lines.length;c++)e.splice(i+c,0,{id:t[r].meta.versionId,meta:t[r].meta,value:l[c],span:1})}}}function Ppe(e){let t=0;for(;t<e.length;){let r=t;for(;r<e.length&&e[r].id===e[t].id;)e[r].span=-1,r++;e[t].span=r-t,t=r}}function jpe(e,t){return`/${e.resourceType}/${e.id}/_history/${t}`}function Ope(e){const t=Math.floor((Date.now()-Date.parse(e))/1e3),r=Math.floor(t/31536e3);if(r>0)return La(r,"year");const n=Math.floor(t/2592e3);if(n>0)return La(n,"month");const o=Math.floor(t/86400);if(o>0)return La(o,"day");const i=Math.floor(t/3600);if(i>0)return La(i,"hour");const a=Math.floor(t/60);return a>0?La(a,"minute"):La(t,"second")}function La(e,t){return`${e} ${e===1?t:t+"s"} ago`}const Cpe=W(e=>({container:{overflowX:"auto"},root:{border:`0.1px solid ${e.colors.gray[3]}`,borderCollapse:"collapse",borderRadius:e.radius.sm,borderSpacing:0,fontSize:e.fontSizes.xs,width:"100%","& td":{padding:"2px 4px 0 4px",verticalAlign:"top",whiteSpace:"nowrap"}},startRow:{borderTop:`0.1px solid ${e.colors.gray[3]}`},normalRow:{borderTop:0},author:{lineHeight:"10px"},dateTime:{borderRight:`0.1px solid ${e.colors.gray[3]}`,lineHeight:"20px"},lineNumber:{backgroundColor:e.colors.gray[1],border:0,color:e.colors.gray[5],fontFamily:e.fontFamilyMonospace,padding:`${e.spacing.xs} ${e.spacing.sm}`,textAlign:"right"},line:{fontFamily:e.fontFamilyMonospace,fontSize:e.fontSizes.sm,padding:`${e.spacing.xs} ${e.spacing.sm}`},pre:{margin:0}}));function Epe(e){var l,c;const{classes:t}=Cpe(),r=ae(),[n,o]=f.useState(e.history);if(f.useEffect(()=>{!e.history&&e.resourceType&&e.id&&r.readHistory(e.resourceType,e.id).then(o).catch(console.log)},[r,e.history,e.resourceType,e.id]),!n)return s.jsx("div",{children:"Loading..."});const i=(c=(l=n.entry)==null?void 0:l[0])==null?void 0:c.resource;if(!i)return null;const a=_pe(n);return s.jsx("div",{className:t.container,children:s.jsx("table",{className:t.root,children:s.jsx("tbody",{children:a.map((u,d)=>s.jsxs("tr",{className:u.span>0?t.startRow:t.normalRow,children:[u.span>0&&s.jsxs(s.Fragment,{children:[s.jsx("td",{className:t.author,rowSpan:u.span,children:s.jsx(ds,{value:u.meta.author,link:!0})}),s.jsx("td",{className:t.dateTime,rowSpan:u.span,children:s.jsx($e,{to:jpe(i,u.meta.versionId),children:Ope(u.meta.lastUpdated)})})]}),s.jsx("td",{className:t.lineNumber,children:d+1}),s.jsx("td",{className:t.line,children:s.jsx("pre",{className:t.pre,children:u.value})})]},"row-"+d))})})})}const $pe=W(e=>({removed:{color:e.colors.red[7],textDecoration:"line-through"},added:{color:e.colors.green[7]}}));function kpe(e){let t=e.original,r=e.revised;e.ignoreMeta&&(t={...t,meta:void 0},r={...r,meta:void 0});const n=Ir(t,!0).match(/[^\r\n]+/g),o=Ir(r,!0).match(/[^\r\n]+/g),i=u3(n,o);return s.jsx("pre",{style:{color:"gray"},children:i.map((a,l)=>s.jsx(Rpe,{delta:a},"delta"+l))})}function Rpe(e){const{classes:t}=$pe();return s.jsxs(s.Fragment,{children:["...",s.jsx("br",{}),e.delta.original.lines.length>0&&s.jsx("div",{className:t.removed,children:e.delta.original.lines.join(`
|
|
191
191
|
`)}),e.delta.revised.lines.length>0&&s.jsx("div",{className:t.added,children:e.delta.revised.lines.join(`
|
|
192
|
-
`)}),"...",s.jsx("br",{})]})}function d3(e){const t=ae(),r=Xe(e.defaultValue),[n,o]=f.useState(!1),[i,a]=f.useState();return f.useEffect(()=>{r&&(a(ba(r)),t.requestSchema(r.resourceType).then(()=>o(!0)).catch(console.log))},[t,r]),!n||!i?s.jsx("div",{children:"Loading..."}):s.jsxs("form",{noValidate:!0,autoComplete:"off",onSubmit:l=>{l.preventDefault(),e.onSubmit&&e.onSubmit(i)},children:[s.jsxs(je,{mb:"xl",children:[s.jsx(ot,{title:"Resource Type",htmlFor:"resourceType",outcome:e.outcome,children:s.jsx(le,{name:"resourceType",defaultValue:i.resourceType,disabled:!0})}),s.jsx(ot,{title:"ID",htmlFor:"id",outcome:e.outcome,children:s.jsx(le,{name:"id",defaultValue:i.id,disabled:!0})})]}),s.jsx(vy,{typeName:i.resourceType,defaultValue:i,outcome:e.outcome,onChange:a}),s.jsxs(Y,{position:"right",mt:"xl",children:[s.jsx(re,{type:"submit",children:"OK"}),e.onDelete&&s.jsx(re,{variant:"outline",color:"red",type:"button",onClick:()=>{e.onDelete(i)},children:"Delete"})]})]})}function Tpe(e){var o;const t=ae(),[r,n]=f.useState(e.history);return f.useEffect(()=>{!e.history&&e.resourceType&&e.id&&t.readHistory(e.resourceType,e.id).then(n).catch(console.log)},[t,e.history,e.resourceType,e.id]),r?s.jsxs(xa,{withBorder:!0,withColumnBorders:!0,children:[s.jsx("thead",{children:s.jsxs("tr",{children:[s.jsx("th",{children:"Author"}),s.jsx("th",{children:"Date"}),s.jsx("th",{children:"Version"})]})}),s.jsx("tbody",{children:(o=r.entry)==null?void 0:o.map((i,a)=>s.jsx(Ipe,{entry:i},"entry-"+a))})]}):s.jsx("div",{children:"Loading..."})}function Ipe(e){var n,o,i;const{response:t,resource:r}=e.entry;return r?s.jsxs("tr",{children:[s.jsx("td",{children:s.jsx(ds,{value:(n=r.meta)==null?void 0:n.author,link:!0})}),s.jsx("td",{children:Dr((o=r.meta)==null?void 0:o.lastUpdated)}),s.jsx("td",{children:s.jsx($e,{to:Dpe(r),children:(i=r.meta)==null?void 0:i.versionId})})]}):s.jsx("tr",{children:s.jsx("td",{colSpan:3,children:Oe(t==null?void 0:t.outcome)})})}function Dpe(e){var t;return`/${e.resourceType}/${e.id}/_history/${(t=e.meta)==null?void 0:t.versionId}`}function Npe(e){return s.jsx(Cm,{value:e.serviceRequest,loadTimelineResources:async(t,r,n)=>{const o=`${r}/${n}`,i=100;return Promise.allSettled([t.readHistory("ServiceRequest",n),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,r,n)=>({resourceType:"Communication",status:"completed",basedOn:[ht(t)],subject:t.subject,sender:ht(r),sent:new Date().toISOString(),payload:[{contentString:n}]}),createMedia:(t,r,n)=>({resourceType:"Media",status:"completed",basedOn:[ht(t)],subject:t.subject,operator:ht(r),issued:new Date().toISOString(),content:n})})}function f3(e){const t=ae(),[r,n]=f.useState();return s.jsxs(De,{style:{maxWidth:400},onSubmit:async o=>{try{e.handleAuthResponse(await t.startNewProject({login:e.login,projectName:o.projectName}))}catch(i){n(dt(i))}},children:[s.jsxs(or,{sx:{flexDirection:"column"},children:[s.jsx(In,{size:32}),s.jsx(ue,{children:"Create project"})]}),s.jsxs(je,{spacing:"xl",children:[s.jsx(le,{name:"projectName",label:"Project Name",placeholder:"My Project",required:!0,autoFocus:!0,error:ut(r,"firstName")}),s.jsxs(oe,{color:"dimmed",size:"xs",children:["By clicking submit you agree to the Medplum"," ",s.jsx(Le,{href:"https://www.medplum.com/privacy",children:"Privacy Policy"})," and ",s.jsx(Le,{href:"https://www.medplum.com/terms",children:"Terms of Service"}),"."]})]}),s.jsx(Y,{position:"right",mt:"xl",noWrap:!0,children:s.jsx(re,{type:"submit",children:"Create project"})})]})}function p3(e,t){const r=document.getElementsByTagName("head")[0],n=document.createElement("script");n.async=!0,n.src=e,n.onload=t??null,r.appendChild(n)}function h3(e){const t=ae(),{googleClientId:r,handleGoogleCredential:n}=e,o=f.useRef(null),[i,a]=f.useState(typeof google<"u"),[l,c]=f.useState(!1),[u,d]=f.useState(!1);return f.useEffect(()=>{if(typeof google>"u"){p3("https://accounts.google.com/gsi/client",()=>a(!0));return}l||(google.accounts.id.initialize({client_id:r,callback:n}),c(!0)),o.current&&!u&&(google.accounts.id.renderButton(o.current,{}),d(!0))},[t,r,l,i,o,u,n]),r?s.jsx("div",{ref:o}):null}var Ape={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:"2.2.0-82ebbb9a",BASE_URL:"/",MODE:"production",DEV:!1,PROD:!0,SSR:!1};function m3(e){var t;if(e)return e;if(typeof window<"u"){const r=window.location.protocol+"//"+window.location.host;if((((t=Ape.GOOGLE_AUTH_ORIGINS)==null?void 0:t.split(","))??[]).includes(r))return"__GOOGLE_CLIENT_ID__"}}function g3(e){typeof grecaptcha>"u"&&p3("https://www.google.com/recaptcha/api.js?render="+e)}function v3(e){return new Promise((t,r)=>{grecaptcha.ready(async()=>{try{t(await grecaptcha.execute(e,{action:"submit"}))}catch(n){r(n)}})})}function Mpe(e){const t=m3(e.googleClientId),r=e.recaptchaSiteKey,n=ae(),[o,i]=f.useState(),a=Hx(o,void 0);return f.useEffect(()=>{r&&g3(r)},[r]),s.jsxs(De,{style:{maxWidth:400},onSubmit:async l=>{try{let c="";r&&(c=await v3(r)),e.handleAuthResponse(await n.startNewUser({projectId:e.projectId,clientId:e.clientId,firstName:l.firstName,lastName:l.lastName,email:l.email,password:l.password,remember:l.remember==="true",recaptchaSiteKey:r,recaptchaToken:c}))}catch(c){i(dt(c))}},children:[s.jsx(or,{sx:{flexDirection:"column"},children:e.children}),s.jsx(Vo,{issues:a}),t&&s.jsxs(s.Fragment,{children:[s.jsx(Y,{position:"center",p:"xl",style:{height:70},children:s.jsx(h3,{googleClientId:t,handleGoogleCredential:async l=>{try{e.handleAuthResponse(await n.startGoogleLogin({googleClientId:l.clientId,googleCredential:l.credential,createUser:!0}))}catch(c){i(dt(c))}}})}),s.jsx(hr,{label:"or",labelPosition:"center",my:"lg"})]}),s.jsxs(je,{spacing:"xl",children:[s.jsx(le,{name:"firstName",type:"text",label:"First name",placeholder:"First name",required:!0,autoFocus:!0,error:ut(o,"firstName")}),s.jsx(le,{name:"lastName",type:"text",label:"Last name",placeholder:"Last name",required:!0,error:ut(o,"lastName")}),s.jsx(le,{name:"email",type:"email",label:"Email",placeholder:"name@domain.com",required:!0,error:ut(o,"email")}),s.jsx(Zn,{name:"password",label:"Password",autoComplete:"off",required:!0,error:ut(o,"password")}),s.jsxs(oe,{color:"dimmed",size:"xs",children:["By clicking submit you agree to the Medplum"," ",s.jsx(Le,{href:"https://www.medplum.com/privacy",children:"Privacy Policy"})," and ",s.jsx(Le,{href:"https://www.medplum.com/terms",children:"Terms of Service"}),"."]}),s.jsxs(oe,{color:"dimmed",size:"xs",children:["This site is protected by reCAPTCHA and the Google"," ",s.jsx(Le,{href:"https://policies.google.com/privacy",children:"Privacy Policy"})," and ",s.jsx(Le,{href:"https://policies.google.com/terms",children:"Terms of Service"})," apply."]})]}),s.jsxs(Y,{position:"apart",mt:"xl",noWrap:!0,children:[s.jsx(kn,{name:"remember",label:"Remember me",size:"xs"}),s.jsx(re,{type:"submit",children:"Create account"})]})]})}function Lpe(e){const{type:t,projectId:r,clientId:n,googleClientId:o,recaptchaSiteKey:i,onSuccess:a}=e,l=ae(),[c,u]=f.useState(),[d,p]=f.useState();f.useEffect(()=>{t==="patient"&&c&&l.startNewPatient({login:c,projectId:r}).then(m=>l.processCode(m.code)).then(()=>a()).catch(m=>p(dt(m)))},[l,t,r,c,a]);function h(m){m.code?l.processCode(m.code).then(()=>a()).catch(console.log):m.login&&u(m.login)}return s.jsxs(be,{width:450,children:[d&&s.jsx("pre",{children:JSON.stringify(d,null,2)}),!c&&s.jsx(Mpe,{projectId:r,clientId:n,googleClientId:o,recaptchaSiteKey:i,handleAuthResponse:h,children:e.children}),c&&t==="project"&&s.jsx(f3,{login:c,handleAuthResponse:h})]})}function zpe(e){const[t,r]=f.useState();return t?s.jsx(Vpe,{email:t,...e}):s.jsx(Fpe,{setEmail:r,...e})}function Fpe(e){const{setEmail:t,onRegister:r,handleAuthResponse:n,children:o,disableEmailAuth:i,...a}=e,l=ae(),c=!e.disableGoogleAuth&&m3(e.googleClientId),u=f.useCallback(async h=>{if(!h.authorizeUrl)return!1;const m=JSON.stringify({...await l.ensureCodeChallenge(a),domain:h.domain}),g=new URL(h.authorizeUrl);return g.searchParams.set("state",m),window.location.assign(g.toString()),!0},[l,a]),d=f.useCallback(async h=>{const m=await l.post("auth/method",{email:h.email});await u(m)||t(h.email)},[l,u,t]),p=f.useCallback(async h=>{const m=await l.startGoogleLogin({...a,googleCredential:h.credential});await u(m)||n(m)},[l,a,u,n]);return s.jsxs(De,{style:{maxWidth:400},onSubmit:d,children:[s.jsx(or,{sx:{flexDirection:"column"},children:o}),c&&s.jsxs(s.Fragment,{children:[s.jsx(Y,{position:"center",p:"xl",style:{height:70},children:s.jsx(h3,{googleClientId:c,handleGoogleCredential:p})}),!i&&s.jsx(hr,{label:"or",labelPosition:"center",my:"lg"})]}),!i&&s.jsx(le,{name:"email",type:"email",label:"Email",placeholder:"name@domain.com",required:!0,autoFocus:!0}),s.jsxs(Y,{position:"apart",mt:"xl",spacing:0,noWrap:!0,children:[s.jsx("div",{children:r&&s.jsx(Le,{component:"button",type:"button",color:"dimmed",onClick:r,size:"xs",children:"Register"})}),!i&&s.jsx(re,{type:"submit",children:"Next"})]})]})}function Vpe(e){const{onForgotPassword:t,handleAuthResponse:r,children:n,...o}=e,i=ae(),[a,l]=f.useState(),c=Hx(a,void 0),u=f.useCallback(d=>{i.startLogin({...o,password:d.password,remember:d.remember==="on"}).then(r).catch(p=>l(dt(p)))},[i,o,r]);return s.jsxs(De,{style:{maxWidth:400},onSubmit:u,children:[s.jsx(or,{sx:{flexDirection:"column"},children:n}),s.jsx(Vo,{issues:c}),s.jsx(je,{spacing:"xl",children:s.jsx(Zn,{name:"password",label:"Password",autoComplete:"off",required:!0,autoFocus:!0,error:ut(a,"password")})}),s.jsxs(Y,{position:"apart",mt:"xl",spacing:0,noWrap:!0,children:[t&&s.jsx(Le,{component:"button",type:"button",color:"dimmed",onClick:t,size:"xs",children:"Forgot password"}),s.jsx(kn,{id:"remember",name:"remember",label:"Remember me",size:"xs",sx:{lineHeight:1}}),s.jsx(re,{type:"submit",children:"Sign in"})]})]})}function Bpe(e){const t=ae(),[r,n]=f.useState();return s.jsxs(je,{children:[s.jsxs(or,{sx:{flexDirection:"column"},children:[s.jsx(In,{size:32}),s.jsx(ue,{order:3,children:"Choose profile"})]}),s.jsx(Vo,{outcome:r}),e.memberships.map(o=>{var i,a;return s.jsx(So,{onClick:()=>{t.post("auth/profile",{login:e.login,profile:o.id}).then(e.handleAuthResponse).catch(l=>n(dt(l)))},children:s.jsxs(Y,{children:[s.jsx(Af,{radius:"xl"}),s.jsxs("div",{style:{flex:1},children:[s.jsx(oe,{size:"sm",weight:500,children:(i=o.profile)==null?void 0:i.display}),s.jsx(oe,{color:"dimmed",size:"xs",children:(a=o.project)==null?void 0:a.display})]})]})},o.id)})]})}function Upe(e){const t=ae();return s.jsx(De,{style:{maxWidth:400},onSubmit:r=>{t.post("auth/scope",{login:e.login,scope:Object.keys(r).join(" ")}).then(e.handleAuthResponse).catch(console.log)},children:s.jsxs(je,{children:[s.jsxs(or,{sx:{flexDirection:"column"},children:[s.jsx(In,{size:32}),s.jsx(ue,{children:"Choose scope"})]}),s.jsx(je,{children:(e.scope??"openid").split(" ").map(r=>s.jsx(kn,{id:r,name:r,label:r,defaultChecked:!0},r))}),s.jsx(Y,{position:"right",mt:"xl",children:s.jsx(re,{type:"submit",children:"Set scope"})})]})})}function Wpe(e){const t=ae(),[r,n]=f.useState();return s.jsx(De,{style:{maxWidth:400},onSubmit:o=>{n(void 0),t.post("auth/mfa/verify",{login:e.login,token:o.token}).then(e.handleAuthResponse).catch(i=>n(Oe(i)))},children:s.jsxs(je,{children:[s.jsxs(or,{sx:{flexDirection:"column"},children:[s.jsx(In,{size:32}),s.jsx(ue,{children:"Enter MFA code"})]}),r&&s.jsx($c,{icon:s.jsx(bm,{size:16}),title:"Error",color:"red",children:r}),s.jsx(je,{children:s.jsx(le,{name:"token",label:"MFA code",required:!0})}),s.jsx(Y,{position:"right",mt:"xl",children:s.jsx(re,{type:"submit",children:"Submit code"})})]})})}function y3(e){const{login:t,chooseScopes:r,onSuccess:n,onForgotPassword:o,onRegister:i,onCode:a,...l}=e,c=ae(),[u,d]=f.useState(),[p,h]=f.useState(!1),[m,g]=f.useState(),v=f.useCallback(x=>{a?a(x):c.processCode(x).then(()=>{n&&n()}).catch(w=>pe({color:"red",message:Oe(w)}))},[c,a,n]),_=f.useCallback(x=>{h(!!x.mfaRequired),x.login&&d(x.login),x.memberships&&g(x.memberships),x.code&&(r?g(void 0):v(x.code))},[r,v]),y=f.useCallback(x=>{v(x.code)},[v]);return f.useEffect(()=>{t&&!u&&c.get("auth/login/"+t).then(_).catch(x=>pe({color:"red",message:Oe(x)}))},[c,t,u,_]),s.jsx(be,{width:450,children:u?p?s.jsx(Wpe,{login:u,handleAuthResponse:_}):m?s.jsx(Bpe,{login:u,memberships:m,handleAuthResponse:_}):e.projectId==="new"?s.jsx(f3,{login:u,handleAuthResponse:_}):e.chooseScopes?s.jsx(Upe,{login:u,scope:e.scope,handleAuthResponse:y}):s.jsx("div",{children:"Success"}):s.jsx(zpe,{onForgotPassword:o,onRegister:i,handleAuthResponse:_,disableGoogleAuth:e.disableGoogleAuth,disableEmailAuth:e.disableEmailAuth,...l,children:e.children})})}var x3,lC=As;x3=lC.createRoot,lC.hydrateRoot;/**
|
|
192
|
+
`)}),"...",s.jsx("br",{})]})}function d3(e){const t=ae(),r=Xe(e.defaultValue),[n,o]=f.useState(!1),[i,a]=f.useState();return f.useEffect(()=>{r&&(a(ba(r)),t.requestSchema(r.resourceType).then(()=>o(!0)).catch(console.log))},[t,r]),!n||!i?s.jsx("div",{children:"Loading..."}):s.jsxs("form",{noValidate:!0,autoComplete:"off",onSubmit:l=>{l.preventDefault(),e.onSubmit&&e.onSubmit(i)},children:[s.jsxs(je,{mb:"xl",children:[s.jsx(ot,{title:"Resource Type",htmlFor:"resourceType",outcome:e.outcome,children:s.jsx(le,{name:"resourceType",defaultValue:i.resourceType,disabled:!0})}),s.jsx(ot,{title:"ID",htmlFor:"id",outcome:e.outcome,children:s.jsx(le,{name:"id",defaultValue:i.id,disabled:!0})})]}),s.jsx(vy,{typeName:i.resourceType,defaultValue:i,outcome:e.outcome,onChange:a}),s.jsxs(Y,{position:"right",mt:"xl",children:[s.jsx(re,{type:"submit",children:"OK"}),e.onDelete&&s.jsx(re,{variant:"outline",color:"red",type:"button",onClick:()=>{e.onDelete(i)},children:"Delete"})]})]})}function Tpe(e){var o;const t=ae(),[r,n]=f.useState(e.history);return f.useEffect(()=>{!e.history&&e.resourceType&&e.id&&t.readHistory(e.resourceType,e.id).then(n).catch(console.log)},[t,e.history,e.resourceType,e.id]),r?s.jsxs(xa,{withBorder:!0,withColumnBorders:!0,children:[s.jsx("thead",{children:s.jsxs("tr",{children:[s.jsx("th",{children:"Author"}),s.jsx("th",{children:"Date"}),s.jsx("th",{children:"Version"})]})}),s.jsx("tbody",{children:(o=r.entry)==null?void 0:o.map((i,a)=>s.jsx(Ipe,{entry:i},"entry-"+a))})]}):s.jsx("div",{children:"Loading..."})}function Ipe(e){var n,o,i;const{response:t,resource:r}=e.entry;return r?s.jsxs("tr",{children:[s.jsx("td",{children:s.jsx(ds,{value:(n=r.meta)==null?void 0:n.author,link:!0})}),s.jsx("td",{children:Dr((o=r.meta)==null?void 0:o.lastUpdated)}),s.jsx("td",{children:s.jsx($e,{to:Dpe(r),children:(i=r.meta)==null?void 0:i.versionId})})]}):s.jsx("tr",{children:s.jsx("td",{colSpan:3,children:Oe(t==null?void 0:t.outcome)})})}function Dpe(e){var t;return`/${e.resourceType}/${e.id}/_history/${(t=e.meta)==null?void 0:t.versionId}`}function Npe(e){return s.jsx(Cm,{value:e.serviceRequest,loadTimelineResources:async(t,r,n)=>{const o=`${r}/${n}`,i=100;return Promise.allSettled([t.readHistory("ServiceRequest",n),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,r,n)=>({resourceType:"Communication",status:"completed",basedOn:[ht(t)],subject:t.subject,sender:ht(r),sent:new Date().toISOString(),payload:[{contentString:n}]}),createMedia:(t,r,n)=>({resourceType:"Media",status:"completed",basedOn:[ht(t)],subject:t.subject,operator:ht(r),issued:new Date().toISOString(),content:n})})}function f3(e){const t=ae(),[r,n]=f.useState();return s.jsxs(De,{style:{maxWidth:400},onSubmit:async o=>{try{e.handleAuthResponse(await t.startNewProject({login:e.login,projectName:o.projectName}))}catch(i){n(dt(i))}},children:[s.jsxs(or,{sx:{flexDirection:"column"},children:[s.jsx(In,{size:32}),s.jsx(ue,{children:"Create project"})]}),s.jsxs(je,{spacing:"xl",children:[s.jsx(le,{name:"projectName",label:"Project Name",placeholder:"My Project",required:!0,autoFocus:!0,error:ut(r,"firstName")}),s.jsxs(oe,{color:"dimmed",size:"xs",children:["By clicking submit you agree to the Medplum"," ",s.jsx(Le,{href:"https://www.medplum.com/privacy",children:"Privacy Policy"})," and ",s.jsx(Le,{href:"https://www.medplum.com/terms",children:"Terms of Service"}),"."]})]}),s.jsx(Y,{position:"right",mt:"xl",noWrap:!0,children:s.jsx(re,{type:"submit",children:"Create project"})})]})}function p3(e,t){const r=document.getElementsByTagName("head")[0],n=document.createElement("script");n.async=!0,n.src=e,n.onload=t??null,r.appendChild(n)}function h3(e){const t=ae(),{googleClientId:r,handleGoogleCredential:n}=e,o=f.useRef(null),[i,a]=f.useState(typeof google<"u"),[l,c]=f.useState(!1),[u,d]=f.useState(!1);return f.useEffect(()=>{if(typeof google>"u"){p3("https://accounts.google.com/gsi/client",()=>a(!0));return}l||(google.accounts.id.initialize({client_id:r,callback:n}),c(!0)),o.current&&!u&&(google.accounts.id.renderButton(o.current,{}),d(!0))},[t,r,l,i,o,u,n]),r?s.jsx("div",{ref:o}):null}var Ape={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:"2.2.1-545c34fc",BASE_URL:"/",MODE:"production",DEV:!1,PROD:!0,SSR:!1};function m3(e){var t;if(e)return e;if(typeof window<"u"){const r=window.location.protocol+"//"+window.location.host;if((((t=Ape.GOOGLE_AUTH_ORIGINS)==null?void 0:t.split(","))??[]).includes(r))return"__GOOGLE_CLIENT_ID__"}}function g3(e){typeof grecaptcha>"u"&&p3("https://www.google.com/recaptcha/api.js?render="+e)}function v3(e){return new Promise((t,r)=>{grecaptcha.ready(async()=>{try{t(await grecaptcha.execute(e,{action:"submit"}))}catch(n){r(n)}})})}function Mpe(e){const t=m3(e.googleClientId),r=e.recaptchaSiteKey,n=ae(),[o,i]=f.useState(),a=Hx(o,void 0);return f.useEffect(()=>{r&&g3(r)},[r]),s.jsxs(De,{style:{maxWidth:400},onSubmit:async l=>{try{let c="";r&&(c=await v3(r)),e.handleAuthResponse(await n.startNewUser({projectId:e.projectId,clientId:e.clientId,firstName:l.firstName,lastName:l.lastName,email:l.email,password:l.password,remember:l.remember==="true",recaptchaSiteKey:r,recaptchaToken:c}))}catch(c){i(dt(c))}},children:[s.jsx(or,{sx:{flexDirection:"column"},children:e.children}),s.jsx(Vo,{issues:a}),t&&s.jsxs(s.Fragment,{children:[s.jsx(Y,{position:"center",p:"xl",style:{height:70},children:s.jsx(h3,{googleClientId:t,handleGoogleCredential:async l=>{try{e.handleAuthResponse(await n.startGoogleLogin({googleClientId:l.clientId,googleCredential:l.credential,createUser:!0}))}catch(c){i(dt(c))}}})}),s.jsx(hr,{label:"or",labelPosition:"center",my:"lg"})]}),s.jsxs(je,{spacing:"xl",children:[s.jsx(le,{name:"firstName",type:"text",label:"First name",placeholder:"First name",required:!0,autoFocus:!0,error:ut(o,"firstName")}),s.jsx(le,{name:"lastName",type:"text",label:"Last name",placeholder:"Last name",required:!0,error:ut(o,"lastName")}),s.jsx(le,{name:"email",type:"email",label:"Email",placeholder:"name@domain.com",required:!0,error:ut(o,"email")}),s.jsx(Zn,{name:"password",label:"Password",autoComplete:"off",required:!0,error:ut(o,"password")}),s.jsxs(oe,{color:"dimmed",size:"xs",children:["By clicking submit you agree to the Medplum"," ",s.jsx(Le,{href:"https://www.medplum.com/privacy",children:"Privacy Policy"})," and ",s.jsx(Le,{href:"https://www.medplum.com/terms",children:"Terms of Service"}),"."]}),s.jsxs(oe,{color:"dimmed",size:"xs",children:["This site is protected by reCAPTCHA and the Google"," ",s.jsx(Le,{href:"https://policies.google.com/privacy",children:"Privacy Policy"})," and ",s.jsx(Le,{href:"https://policies.google.com/terms",children:"Terms of Service"})," apply."]})]}),s.jsxs(Y,{position:"apart",mt:"xl",noWrap:!0,children:[s.jsx(kn,{name:"remember",label:"Remember me",size:"xs"}),s.jsx(re,{type:"submit",children:"Create account"})]})]})}function Lpe(e){const{type:t,projectId:r,clientId:n,googleClientId:o,recaptchaSiteKey:i,onSuccess:a}=e,l=ae(),[c,u]=f.useState(),[d,p]=f.useState();f.useEffect(()=>{t==="patient"&&c&&l.startNewPatient({login:c,projectId:r}).then(m=>l.processCode(m.code)).then(()=>a()).catch(m=>p(dt(m)))},[l,t,r,c,a]);function h(m){m.code?l.processCode(m.code).then(()=>a()).catch(console.log):m.login&&u(m.login)}return s.jsxs(be,{width:450,children:[d&&s.jsx("pre",{children:JSON.stringify(d,null,2)}),!c&&s.jsx(Mpe,{projectId:r,clientId:n,googleClientId:o,recaptchaSiteKey:i,handleAuthResponse:h,children:e.children}),c&&t==="project"&&s.jsx(f3,{login:c,handleAuthResponse:h})]})}function zpe(e){const[t,r]=f.useState();return t?s.jsx(Vpe,{email:t,...e}):s.jsx(Fpe,{setEmail:r,...e})}function Fpe(e){const{setEmail:t,onRegister:r,handleAuthResponse:n,children:o,disableEmailAuth:i,...a}=e,l=ae(),c=!e.disableGoogleAuth&&m3(e.googleClientId),u=f.useCallback(async h=>{if(!h.authorizeUrl)return!1;const m=JSON.stringify({...await l.ensureCodeChallenge(a),domain:h.domain}),g=new URL(h.authorizeUrl);return g.searchParams.set("state",m),window.location.assign(g.toString()),!0},[l,a]),d=f.useCallback(async h=>{const m=await l.post("auth/method",{email:h.email});await u(m)||t(h.email)},[l,u,t]),p=f.useCallback(async h=>{const m=await l.startGoogleLogin({...a,googleCredential:h.credential});await u(m)||n(m)},[l,a,u,n]);return s.jsxs(De,{style:{maxWidth:400},onSubmit:d,children:[s.jsx(or,{sx:{flexDirection:"column"},children:o}),c&&s.jsxs(s.Fragment,{children:[s.jsx(Y,{position:"center",p:"xl",style:{height:70},children:s.jsx(h3,{googleClientId:c,handleGoogleCredential:p})}),!i&&s.jsx(hr,{label:"or",labelPosition:"center",my:"lg"})]}),!i&&s.jsx(le,{name:"email",type:"email",label:"Email",placeholder:"name@domain.com",required:!0,autoFocus:!0}),s.jsxs(Y,{position:"apart",mt:"xl",spacing:0,noWrap:!0,children:[s.jsx("div",{children:r&&s.jsx(Le,{component:"button",type:"button",color:"dimmed",onClick:r,size:"xs",children:"Register"})}),!i&&s.jsx(re,{type:"submit",children:"Next"})]})]})}function Vpe(e){const{onForgotPassword:t,handleAuthResponse:r,children:n,...o}=e,i=ae(),[a,l]=f.useState(),c=Hx(a,void 0),u=f.useCallback(d=>{i.startLogin({...o,password:d.password,remember:d.remember==="on"}).then(r).catch(p=>l(dt(p)))},[i,o,r]);return s.jsxs(De,{style:{maxWidth:400},onSubmit:u,children:[s.jsx(or,{sx:{flexDirection:"column"},children:n}),s.jsx(Vo,{issues:c}),s.jsx(je,{spacing:"xl",children:s.jsx(Zn,{name:"password",label:"Password",autoComplete:"off",required:!0,autoFocus:!0,error:ut(a,"password")})}),s.jsxs(Y,{position:"apart",mt:"xl",spacing:0,noWrap:!0,children:[t&&s.jsx(Le,{component:"button",type:"button",color:"dimmed",onClick:t,size:"xs",children:"Forgot password"}),s.jsx(kn,{id:"remember",name:"remember",label:"Remember me",size:"xs",sx:{lineHeight:1}}),s.jsx(re,{type:"submit",children:"Sign in"})]})]})}function Bpe(e){const t=ae(),[r,n]=f.useState();return s.jsxs(je,{children:[s.jsxs(or,{sx:{flexDirection:"column"},children:[s.jsx(In,{size:32}),s.jsx(ue,{order:3,children:"Choose profile"})]}),s.jsx(Vo,{outcome:r}),e.memberships.map(o=>{var i,a;return s.jsx(So,{onClick:()=>{t.post("auth/profile",{login:e.login,profile:o.id}).then(e.handleAuthResponse).catch(l=>n(dt(l)))},children:s.jsxs(Y,{children:[s.jsx(Af,{radius:"xl"}),s.jsxs("div",{style:{flex:1},children:[s.jsx(oe,{size:"sm",weight:500,children:(i=o.profile)==null?void 0:i.display}),s.jsx(oe,{color:"dimmed",size:"xs",children:(a=o.project)==null?void 0:a.display})]})]})},o.id)})]})}function Upe(e){const t=ae();return s.jsx(De,{style:{maxWidth:400},onSubmit:r=>{t.post("auth/scope",{login:e.login,scope:Object.keys(r).join(" ")}).then(e.handleAuthResponse).catch(console.log)},children:s.jsxs(je,{children:[s.jsxs(or,{sx:{flexDirection:"column"},children:[s.jsx(In,{size:32}),s.jsx(ue,{children:"Choose scope"})]}),s.jsx(je,{children:(e.scope??"openid").split(" ").map(r=>s.jsx(kn,{id:r,name:r,label:r,defaultChecked:!0},r))}),s.jsx(Y,{position:"right",mt:"xl",children:s.jsx(re,{type:"submit",children:"Set scope"})})]})})}function Wpe(e){const t=ae(),[r,n]=f.useState();return s.jsx(De,{style:{maxWidth:400},onSubmit:o=>{n(void 0),t.post("auth/mfa/verify",{login:e.login,token:o.token}).then(e.handleAuthResponse).catch(i=>n(Oe(i)))},children:s.jsxs(je,{children:[s.jsxs(or,{sx:{flexDirection:"column"},children:[s.jsx(In,{size:32}),s.jsx(ue,{children:"Enter MFA code"})]}),r&&s.jsx($c,{icon:s.jsx(bm,{size:16}),title:"Error",color:"red",children:r}),s.jsx(je,{children:s.jsx(le,{name:"token",label:"MFA code",required:!0})}),s.jsx(Y,{position:"right",mt:"xl",children:s.jsx(re,{type:"submit",children:"Submit code"})})]})})}function y3(e){const{login:t,chooseScopes:r,onSuccess:n,onForgotPassword:o,onRegister:i,onCode:a,...l}=e,c=ae(),[u,d]=f.useState(),[p,h]=f.useState(!1),[m,g]=f.useState(),v=f.useCallback(x=>{a?a(x):c.processCode(x).then(()=>{n&&n()}).catch(w=>pe({color:"red",message:Oe(w)}))},[c,a,n]),_=f.useCallback(x=>{h(!!x.mfaRequired),x.login&&d(x.login),x.memberships&&g(x.memberships),x.code&&(r?g(void 0):v(x.code))},[r,v]),y=f.useCallback(x=>{v(x.code)},[v]);return f.useEffect(()=>{t&&!u&&c.get("auth/login/"+t).then(_).catch(x=>pe({color:"red",message:Oe(x)}))},[c,t,u,_]),s.jsx(be,{width:450,children:u?p?s.jsx(Wpe,{login:u,handleAuthResponse:_}):m?s.jsx(Bpe,{login:u,memberships:m,handleAuthResponse:_}):e.projectId==="new"?s.jsx(f3,{login:u,handleAuthResponse:_}):e.chooseScopes?s.jsx(Upe,{login:u,scope:e.scope,handleAuthResponse:y}):s.jsx("div",{children:"Success"}):s.jsx(zpe,{onForgotPassword:o,onRegister:i,handleAuthResponse:_,disableGoogleAuth:e.disableGoogleAuth,disableEmailAuth:e.disableEmailAuth,...l,children:e.children})})}var x3,lC=As;x3=lC.createRoot,lC.hydrateRoot;/**
|
|
193
193
|
* @remix-run/router v1.13.1
|
|
194
194
|
*
|
|
195
195
|
* Copyright (c) Remix Software Inc.
|
|
@@ -232,4 +232,4 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
232
232
|
}
|
|
233
233
|
]
|
|
234
234
|
}`,Lve="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-",zve=W(()=>({hl7Input:{fontFamily:"monospace",fontSize:"12px",lineHeight:1.55,padding:"10px 12px",whiteSpace:"nowrap",width:"100%"}}));function Fve(){const e=ae(),{id:t}=Ye(),[r,n]=f.useState(),[o,i]=f.useState(),[a,l]=f.useState(Mve),[c,u]=f.useState(Lve),[d,p]=f.useState(Qt.FHIR_JSON),{classes:h}=zve(),m=f.useRef(null),g=f.useRef(null),[v,_]=f.useState(!1);f.useEffect(()=>{e.readResource("Bot",t).then(async P=>{n(P),i(await Vve(e,P))}).catch(P=>pe({color:"red",message:Oe(P),autoClose:!1}))},[e,t]);const y=f.useCallback(()=>bd(m.current,{command:"getValue"}),[]),x=f.useCallback(()=>bd(m.current,{command:"getOutput"}),[]),w=f.useCallback(async()=>d===Qt.FHIR_JSON?JSON.parse(a):c,[d,a,c]),b=f.useCallback(async P=>{P.preventDefault(),P.stopPropagation(),_(!0);try{const E=await y(),$=await e.createAttachment(E,"index.ts","text/typescript"),k=[];r!=null&&r.sourceCode?k.push({op:"replace",path:"/sourceCode",value:$}):k.push({op:"add",path:"/sourceCode",value:$}),await e.patchResource("Bot",t,k),pe({color:"green",message:"Saved"})}catch(E){pe({color:"red",message:Oe(E),autoClose:!1})}finally{_(!1)}},[e,t,r,y]),C=f.useCallback(async P=>{P.preventDefault(),P.stopPropagation(),_(!0);try{const E=await x();await e.post(e.fhirUrl("Bot",t,"$deploy"),{code:E}),pe({color:"green",message:"Deployed"})}catch(E){pe({color:"red",message:Oe(E),autoClose:!1})}finally{_(!1)}},[e,t,x]),O=f.useCallback(async P=>{P.preventDefault(),P.stopPropagation(),_(!0);try{const E=await w(),$=await e.post(e.fhirUrl("Bot",t,"$execute"),E,d);await bd(g.current,{command:"setValue",value:$}),pe({color:"green",message:"Success"})}catch(E){pe({color:"red",message:Oe(E),autoClose:!1})}finally{_(!1)}},[e,t,w,d]);return!r||o===void 0?null:s.jsxs(sn,{m:0,gutter:0,style:{overflow:"hidden"},children:[s.jsx(sn.Col,{span:8,children:s.jsxs(un,{m:2,pb:"xs",pr:"xs",pt:"xs",shadow:"md",mih:400,children:[s.jsx(Ave,{iframeRef:m,language:"typescript",module:"commonjs",testId:"code-frame",defaultValue:o,minHeight:"528px"}),s.jsxs(Y,{position:"right",spacing:"xs",children:[s.jsx(re,{type:"button",onClick:b,loading:v,leftIcon:s.jsx(Jle,{size:"1rem"}),children:"Save"}),s.jsx(re,{type:"button",onClick:C,loading:v,leftIcon:s.jsx(Dx,{size:"1rem"}),children:"Deploy"}),s.jsx(re,{type:"button",onClick:O,loading:v,leftIcon:s.jsx(hce,{size:"1rem"}),children:"Execute"})]})]})}),s.jsxs(sn.Col,{span:4,children:[s.jsxs(un,{m:2,pb:"xs",pr:"xs",pt:"xs",shadow:"md",children:[s.jsx(mt,{data:[{label:"FHIR",value:Qt.FHIR_JSON},{label:"HL7",value:Qt.HL7_V2}],onChange:P=>p(P.currentTarget.value)}),d===Qt.FHIR_JSON?s.jsx(Fs,{value:a,onChange:P=>l(P),minRows:15}):s.jsx("textarea",{className:h.hl7Input,value:c,onChange:P=>u(P.currentTarget.value),rows:15})]}),s.jsx(un,{m:2,p:"xs",shadow:"md",children:s.jsx(Nve,{iframeRef:g,className:"medplum-bot-output-frame",testId:"output-frame",minHeight:"200px"})})]})]})}async function Vve(e,t){var r,n,o;if((r=t.sourceCode)!=null&&r.url){const i=(o=(n=t.sourceCode.url)==null?void 0:n.split("/"))==null?void 0:o.find($5);return(await e.download(e.fhirUrl("Binary",i))).text()}return t.code??""}function Xc(e){let t=e.meta;return t&&(t={...t,lastUpdated:void 0,versionId:void 0,author:void 0}),{...e,meta:t}}function Bve(){const e=ae(),{resourceType:t,id:r}=Ye(),n={reference:t+"/"+r},o=f.useCallback(i=>{e.updateResource(Xc(i)).then(()=>{pe({color:"green",message:"Success"})}).catch(a=>{pe({color:"red",message:Oe(a),autoClose:!1})})},[e]);switch(t){case"PlanDefinition":return s.jsx(be,{children:s.jsx(_fe,{value:n,onSubmit:o})});case"Questionnaire":return s.jsx(be,{children:s.jsx(Kfe,{questionnaire:n,onSubmit:o})});default:return null}}function Uve(){const{resourceType:e,id:t}=Ye(),r=Xe({reference:e+"/"+t}),n=jt();return r?s.jsx(be,{children:s.jsx(ype,{value:r,onStart:(o,i)=>n(`/forms/${xx(i)}`),onEdit:(o,i,a)=>n(`/${a.reference}}`)})}):null}function Wve(){const e=ae(),{resourceType:t,id:r}=Ye(),n=jt();return s.jsxs(be,{children:[s.jsxs("p",{children:["Are you sure you want to delete this ",t,"?"]}),s.jsx(re,{color:"red",onClick:()=>{e.deleteResource(t,r).then(()=>n(`/${t}`)).catch(o=>pe({color:"red",message:Oe(o),autoClose:!1}))},children:"Delete"})]})}function Hve(){const{resourceType:e,id:t}=Ye(),r=Xe({reference:e+"/"+t});return r?s.jsx(be,{children:s.jsx(Zx,{value:r})}):null}function qve(){const e=ae(),{resourceType:t,id:r}=Ye(),[n,o]=f.useState(),i=jt(),[a,l]=f.useState();f.useEffect(()=>{e.readResource(t,r).then(d=>o(ba(d))).catch(d=>{l(dt(d)),pe({color:"red",message:Oe(d),autoClose:!1})})},[e,t,r]);const c=f.useCallback(d=>{l(void 0),e.updateResource(Xc(d)).then(()=>{i(`/${t}/${r}/details`),pe({color:"green",message:"Success"})}).catch(p=>{l(dt(p)),pe({color:"red",message:Oe(p),autoClose:!1})})},[e,t,r,i]),u=f.useCallback(()=>i(`/${t}/${r}/delete`),[i,t,r]);return n?s.jsx(be,{children:s.jsx(d3,{defaultValue:n,onSubmit:c,onDelete:u,outcome:a})}):null}function Gve(){const e=ae(),{resourceType:t,id:r}=Ye(),n=e.readHistory(t,r).read();return s.jsx(be,{children:s.jsx(Tpe,{history:n})})}function Qve(){const e=ae(),{resourceType:t,id:r}=Ye(),n=Xe({reference:t+"/"+r}),o=jt(),[i,a]=f.useState(),l=f.useCallback(c=>{e.updateResource(Xc(JSON.parse(c.resource))).then(()=>{a(void 0),o(`/${t}/${r}/details`),pe({color:"green",message:"Success"})}).catch(u=>{pe({color:"red",message:Oe(u),autoClose:!1})})},[e,t,r,o]);return n?s.jsxs(be,{children:[i&&s.jsx(Vo,{outcome:i}),s.jsxs(De,{onSubmit:l,children:[s.jsx(Fs,{name:"resource","data-testid":"resource-json",minRows:24,defaultValue:Ir(n,!0),formatOnBlur:!0,deserialize:JSON.parse}),s.jsx(Y,{position:"right",mt:"xl",noWrap:!0,children:s.jsx(re,{type:"submit",children:"OK"})})]})]}):null}function Kve(){const{resourceType:e,id:t}=Ye();return Xe({reference:e+"/"+t})?s.jsxs(be,{children:[s.jsxs($c,{icon:s.jsx(bm,{size:16}),mb:"xl",children:["This is just a preview! Access your form here:",s.jsx("br",{}),s.jsx(Le,{href:`/forms/${t}`,children:`/forms/${t}`})]}),s.jsx(l3,{questionnaire:{reference:e+"/"+t},onSubmit:()=>alert("You submitted the preview")})]}):null}function Yve(){const e=ae(),{id:t}=Ye(),[r,n]=f.useState(),[o,i]=f.useState(0),a=e.searchResources("Subscription","status=active&_count=100").read().filter(c=>Xve(c,t));function l(){r&&e.createResource({resourceType:"Subscription",status:"active",reason:r.name,criteria:"QuestionnaireResponse?questionnaire=Questionnaire/"+t,channel:{type:"rest-hook",endpoint:nt(r)}}).then(()=>{n(void 0),i(Date.now()),e.invalidateSearches("Subscription"),pe({color:"green",message:"Success"})}).catch(c=>pe({color:"red",message:Oe(c),autoClose:!1}))}return s.jsxs(be,{children:[s.jsx(ue,{children:"Bots"}),a.length===0&&s.jsx("p",{children:"No bots found."}),a.map(c=>{var u;return s.jsxs("div",{children:[s.jsx("h3",{children:s.jsx(Wc,{value:{reference:(u=c.channel)==null?void 0:u.endpoint},link:!0})}),s.jsxs("p",{children:["Criteria: ",c.criteria]})]},c.id)}),s.jsx("hr",{}),s.jsx(ue,{children:"Connect to bot"}),s.jsxs(Y,{children:[s.jsx(Vs,{name:"bot",resourceType:"Bot",onChange:n}),s.jsx(re,{onClick:l,children:"Connect"})]}),s.jsx("div",{style:{display:"none"},children:o})]})}function Xve(e,t){var o;const r=e.criteria||"",n=((o=e.channel)==null?void 0:o.endpoint)||"";return r.startsWith("QuestionnaireResponse?")&&r.includes(t)&&n.startsWith("Bot/")}function Jve(){const{id:e}=Ye(),t=jt(),[r,n]=f.useState({resourceType:"QuestionnaireResponse",filters:[{code:"questionnaire",operator:ne.EQUALS,value:"Questionnaire/"+e}],fields:["id","_lastUpdated"]});return s.jsx(be,{children:s.jsx(qc,{search:r,onClick:o=>t(`/${o.resource.resourceType}/${o.resource.id}`),onChange:o=>n(o.definition),hideFilters:!0,hideToolbar:!0})})}function Zve(){const e=ae(),{resourceType:t,id:r}=Ye(),n=Xe({reference:t+"/"+r}),o=f.useCallback(i=>{e.updateResource(Xc(i)).then(()=>{pe({color:"green",message:"Success"})}).catch(a=>{pe({color:"red",message:Oe(a),autoClose:!1})})},[e]);return n?s.jsx(be,{children:s.jsx(upe,{onSubmit:o,definition:n})}):null}function eye(){const{resourceType:e,id:t}=Ye(),r=Xe({reference:e+"/"+t});return r?s.jsx(be,{children:e==="MeasureReport"?s.jsx(wfe,{measureReport:r}):s.jsx(Gx,{value:r})}):null}const tye=W(e=>({container:{position:"fixed",top:300,left:0,width:160,zIndex:5,fontSize:e.fontSizes.xs,"@media (max-width: 700px)":{display:"none"}},entry:{textAlign:"center",width:150,backgroundColor:e.colors.gray[0],border:`1px solid ${e.colors.gray[3]}`},active:{width:160,backgroundColor:e.colors.yellow[0],border:`1px solid ${e.colors.yellow[5]}`}}));function rye(e){const{classes:t,cx:r}=tye(),n=ae(),o=Xe(e.value),[i,a]=f.useState();return f.useEffect(()=>{if(!o)return;const l=h1(o);if(!l)return;const c="reference"in l?l.reference:nt(l);n.search("ServiceRequest","subject="+c).then(u=>{const p=u.entry.map(h=>h.resource);F4(p),p.reverse(),a(p)}).catch(u=>pe({color:"red",message:Oe(u),autoClose:!1}))},[n,o]),i?s.jsx("div",{"data-testid":"quick-service-requests",className:t.container,children:i.map(l=>{var c,u,d,p,h,m,g;return s.jsxs("div",{className:r(t.entry,{[t.active]:l.id===(o==null?void 0:o.id)}),children:[s.jsx("p",{children:s.jsx($e,{to:l,children:nye(l)})}),((u=(c=l.category)==null?void 0:c[0])==null?void 0:u.text)&&s.jsx("p",{children:(d=l.category[0])==null?void 0:d.text}),((m=(h=(p=l.code)==null?void 0:p.coding)==null?void 0:h[0])==null?void 0:m.code)&&s.jsx("p",{children:(g=l.code.coding[0])==null?void 0:g.code}),s.jsx("p",{children:oye(l)})]},l.id)})}):null}function nye(e){if(e.identifier){for(const t of e.identifier)if(t.value)return t.value}return e.id||""}function oye(e){var t;return e.authoredOn?e.authoredOn.substring(0,10):(t=e.meta)!=null&&t.lastUpdated?e.meta.lastUpdated.substring(0,10):""}const iye=W(()=>({container:{position:"absolute",top:65,right:5,width:200,height:50,zIndex:15}}));function aye(e){var i,a,l,c;const{classes:t}=iye(),r=Xe(e.valueSet);if(!r)return null;const n=[""],o=(c=(l=(a=(i=r.compose)==null?void 0:i.include)==null?void 0:a[0])==null?void 0:l.concept)==null?void 0:c.map(u=>u.code);return o&&n.push(...o),e.defaultValue&&!n.includes(e.defaultValue)&&n.push(e.defaultValue),s.jsx("div",{className:t.container,children:s.jsx(mt,{defaultValue:e.defaultValue,onChange:u=>e.onChange(u.currentTarget.value),data:n})})}function sye(e){var r,n;const t=Xe(e.specimen);return t?s.jsxs(Se,{children:[s.jsxs(Se.Entry,{children:[s.jsx(Se.Key,{children:"Type"}),s.jsx(Se.Value,{children:"Specimen"})]}),s.jsxs(Se.Entry,{children:[s.jsx(Se.Key,{children:"Collected"}),s.jsx(Se.Value,{children:Dr((r=t.collection)==null?void 0:r.collectedDateTime)})]}),s.jsxs(Se.Entry,{children:[s.jsx(Se.Key,{children:"Specimen Age"}),s.jsx(Se.Value,{children:lye(t)})]}),(n=t.collection)!=null&&n.collectedDateTime&&t.receivedTime?s.jsxs(Se.Entry,{children:[s.jsx(Se.Key,{children:"Specimen Stability"}),s.jsx(Se.Value,{children:cye(t)})]}):s.jsx(s.Fragment,{})]}):null}function lye(e){var o;const t=(o=e.collection)==null?void 0:o.collectedDateTime;if(!t)return;const r=new Date(t);return nA(oA(r,new Date))}function cye(e){var n;if(!((n=e.collection)!=null&&n.collectedDateTime)||!e.receivedTime)return;const t=new Date(e.collection.collectedDateTime),r=new Date(e.receivedTime);return nA(oA(t,r))}function nA(e){return e.toString().padStart(3,"0")+"D"}function oA(e,t){const r=t.getTime()-e.getTime();return Math.floor(r/(1e3*3600*24))}function uye(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"),t}function dye(){var x,w,b,C,O,P,E;const e=ae(),{resourceType:t,id:r}=Ye(),n={reference:t+"/"+r},o=jt(),[i,a]=f.useState(),l=Xe(n,a),c=uye(t),[u,d]=f.useState(()=>{const $=window.location.pathname.split("/").pop();return $&&c.map(k=>k.toLowerCase()).includes($)?$:c[0].toLowerCase()});async function p(){var I,T;const k=(T=(I=(await e.readHistory(t,r)).entry)==null?void 0:I.find(N=>!!N.resource))==null?void 0:T.resource;k?h(k):pe({color:"red",message:"No history to restore",autoClose:!1})}function h($){e.updateResource(Xc($)).then(()=>{a(void 0),pe({color:"green",message:"Success"})}).catch(k=>{pe({color:"red",message:Oe(k),autoClose:!1})})}if(i)return Vae(i)?s.jsxs(be,{children:[s.jsx(ue,{children:"Deleted"}),s.jsx("p",{children:"The resource was deleted."}),s.jsx(re,{color:"red",onClick:p,children:"Restore"})]}):s.jsx(Vo,{outcome:i});function m($){d($),o(`/${t}/${r}/${$}`)}function g($){const k=l,I=k.orderDetail||[];I.length===0&&I.push({}),I[0].text!==$&&(I[0].text=$,h({...k,orderDetail:I}))}const v=l&&h1(l),_=l&&Gge(l),y=(b=(w=(x=e.getUserConfiguration())==null?void 0:x.option)==null?void 0:w.find($=>$.id==="statusValueSet"))==null?void 0:b.valueString;return s.jsxs(s.Fragment,{children:[(l==null?void 0:l.resourceType)==="ServiceRequest"&&y&&s.jsx(aye,{valueSet:{reference:y},defaultValue:(O=(C=l.orderDetail)==null?void 0:C[0])==null?void 0:O.text,onChange:g},nt(l)+"-"+((E=(P=l.orderDetail)==null?void 0:P[0])==null?void 0:E.text)),l&&s.jsx(rye,{value:l}),l&&s.jsxs(un,{children:[v&&s.jsx(eA,{patient:v}),_&&s.jsx(sye,{specimen:_}),t!=="Patient"&&s.jsx(tA,{resource:n}),s.jsx(ma,{children:s.jsx(We,{value:u.toLowerCase(),onTabChange:m,children:s.jsx(We.List,{style:{whiteSpace:"nowrap",flexWrap:"nowrap"},children:c.map($=>s.jsx(We.Tab,{value:$.toLowerCase(),children:$},$))})})})]}),s.jsx(u1,{})]})}function KC(){var y,x,w,b;const e=jt(),{resourceType:t,id:r,versionId:n,tab:o}=Ye(),i=ae(),[a,l]=f.useState(!0),[c,u]=f.useState(),[d,p]=f.useState();if(f.useEffect(()=>{p(void 0),l(!0),i.readHistory(t,r).then(C=>u(C)).then(()=>l(!1)).catch(C=>{p(C),l(!1)})},[i,t,r]),a)return s.jsx(Rn,{});if(!c)return s.jsxs(be,{children:[s.jsx(ue,{children:"Resource not found"}),s.jsx($e,{to:`/${t}`,children:"Return to search page"})]});const h=c.entry,m=h.findIndex(C=>{var O,P;return((P=(O=C.resource)==null?void 0:O.meta)==null?void 0:P.versionId)===n});if(m===-1)return s.jsxs(be,{children:[s.jsx(ue,{children:"Version not found"}),s.jsx($e,{to:`/${t}/${r}`,children:"Return to resource"})]});const g=h[m].resource,v=m<h.length-1?h[m+1].resource:void 0,_="diff";return s.jsx(s.Fragment,{children:s.jsxs(We,{value:o||_,onTabChange:C=>e(`/${t}/${r}/_history/${n}/${C}`),children:[s.jsxs(un,{children:[s.jsx(Uc,{fluid:!0,p:"md",children:s.jsx(oe,{children:`${t} ${r}`})}),s.jsxs(We.List,{children:[s.jsx(We.Tab,{value:"diff",children:"Diff"}),s.jsx(We.Tab,{value:"raw",children:"Raw"})]})]}),s.jsxs(be,{children:[d&&s.jsx("pre",{"data-testid":"error",children:JSON.stringify(d,void 0,2)}),s.jsx(We.Panel,{value:"diff",children:v?s.jsxs(s.Fragment,{children:[s.jsxs("ul",{children:[s.jsxs("li",{children:["Current: ",(y=g.meta)==null?void 0:y.versionId]}),s.jsxs("li",{children:["Previous:"," ",s.jsx($e,{to:`/${t}/${r}/_history/${(x=v.meta)==null?void 0:x.versionId}`,children:(w=v.meta)==null?void 0:w.versionId})]})]}),s.jsx(kpe,{original:v,revised:g})]}):s.jsxs(s.Fragment,{children:[s.jsxs("ul",{children:[s.jsxs("li",{children:["Current: ",(b=g.meta)==null?void 0:b.versionId]}),s.jsx("li",{children:"Previous: (none)"})]}),s.jsx("pre",{children:JSON.stringify(g,void 0,2)})]})}),s.jsx(We.Panel,{value:"raw",children:s.jsx("pre",{children:JSON.stringify(g,void 0,2)})})]})]})})}function fye(){const{resourceType:e,id:t}=Ye(),r=jt(),[n,o]=f.useState({resourceType:"Subscription",filters:[{code:"url",operator:ne.EQUALS,value:`${e}/${t}`}],fields:["id","criteria","status","_lastUpdated"]});return s.jsx(be,{children:s.jsx(qc,{search:n,onClick:i=>r(`/${i.resource.resourceType}/${i.resource.id}`),onChange:i=>o(i.definition),hideFilters:!0})})}function YC(){const{resourceType:e,id:t}=Ye(),r={reference:e+"/"+t};switch(e){case"Encounter":return s.jsx(_de,{encounter:r});case"Patient":return s.jsx(bfe,{patient:r});case"ServiceRequest":return s.jsx(Npe,{serviceRequest:r});default:return s.jsx(bde,{resource:r})}}function iA(e,t){const r=ae(),n=jt();return{defaultValue:{resourceType:e},handleSubmit:a=>{t&&t(void 0),r.createResource(a).then(l=>n("/"+l.resourceType+"/"+l.id)).catch(l=>{t&&t(dt(l))})}}}function XC(){const{resourceType:e}=Ye(),[t,r]=f.useState(),{defaultValue:n,handleSubmit:o}=iA(e,r);return s.jsx(be,{children:s.jsx(d3,{defaultValue:n,onSubmit:o,outcome:t})})}function pye(){const{resourceType:e}=Ye(),[t,r]=f.useState(),{defaultValue:n,handleSubmit:o}=iA(e,r),i=f.useCallback(a=>{o(JSON.parse(a["new-resource"]))},[o]);return s.jsxs(be,{children:[t&&s.jsx(Vo,{outcome:t}),s.jsxs(De,{onSubmit:i,children:[s.jsx(Fs,{name:"new-resource","data-testid":"create-resource-json",minRows:24,defaultValue:Ir(n,!0),formatOnBlur:!0,deserialize:JSON.parse}),s.jsx(Y,{position:"right",mt:"xl",noWrap:!0,children:s.jsx(re,{type:"submit",children:"OK"})})]})]})}function hye(){return s.jsx(Xhe,{children:s.jsxs(ce,{errorElement:s.jsx(Hge,{}),children:[s.jsx(ce,{path:"/signin",element:s.jsx(dve,{})}),s.jsx(ce,{path:"/oauth",element:s.jsx(ave,{})}),s.jsx(ce,{path:"/resetpassword",element:s.jsx(lve,{})}),s.jsx(ce,{path:"/setpassword/:id/:secret",element:s.jsx(uve,{})}),s.jsx(ce,{path:"/register",element:s.jsx(sve,{})}),s.jsx(ce,{path:"/changepassword",element:s.jsx(Bge,{})}),s.jsx(ce,{path:"/security",element:s.jsx(cve,{})}),s.jsx(ce,{path:"/mfa",element:s.jsx(ove,{})}),s.jsx(ce,{path:"/batch",element:s.jsx(Fge,{})}),s.jsx(ce,{path:"/bulk/:resourceType",element:s.jsx(Vge,{})}),s.jsx(ce,{path:"/smart",element:s.jsx(fve,{})}),s.jsx(ce,{path:"/forms/:id",element:s.jsx(Kge,{})}),s.jsx(ce,{path:"/admin/super",element:s.jsx(Pve,{})}),s.jsx(ce,{path:"/admin/config",element:s.jsx(jve,{})}),s.jsxs(ce,{path:"/admin",element:s.jsx(bve,{}),children:[s.jsx(ce,{path:"patients",element:s.jsx(wve,{})}),s.jsx(ce,{path:"bots/new",element:s.jsx(mve,{})}),s.jsx(ce,{path:"bots",element:s.jsx(pve,{})}),s.jsx(ce,{path:"clients/new",element:s.jsx(gve,{})}),s.jsx(ce,{path:"clients",element:s.jsx(hve,{})}),s.jsx(ce,{path:"details",element:s.jsx(qC,{})}),s.jsx(ce,{path:"invite",element:s.jsx(xve,{})}),s.jsx(ce,{path:"users",element:s.jsx(Ove,{})}),s.jsx(ce,{path:"project",element:s.jsx(qC,{})}),s.jsx(ce,{path:"secrets",element:s.jsx(_ve,{})}),s.jsx(ce,{path:"sites",element:s.jsx(Sve,{})}),s.jsx(ce,{path:"members/:membershipId",element:s.jsx(yve,{})})]}),s.jsx(ce,{path:"/lab/assays",element:s.jsx(Cve,{})}),s.jsx(ce,{path:"/lab/panels",element:s.jsx(Eve,{})}),s.jsx(ce,{path:"/:resourceType/:id/_history/:versionId/:tab",element:s.jsx(KC,{})}),s.jsx(ce,{path:"/:resourceType/:id/_history/:versionId",element:s.jsx(KC,{})}),s.jsxs(ce,{path:"/:resourceType/new",element:s.jsx(Wge,{}),children:[s.jsx(ce,{index:!0,element:s.jsx(XC,{})}),s.jsx(ce,{path:"form",element:s.jsx(XC,{})}),s.jsx(ce,{path:"json",element:s.jsx(pye,{})})]}),s.jsxs(ce,{path:"/:resourceType/:id",element:s.jsx(dye,{}),children:[s.jsx(ce,{index:!0,element:s.jsx(YC,{})}),s.jsx(ce,{path:"apply",element:s.jsx(kve,{})}),s.jsx(ce,{path:"apps",element:s.jsx(Rve,{})}),s.jsx(ce,{path:"event",element:s.jsx(Ive,{})}),s.jsx(ce,{path:"blame",element:s.jsx(Dve,{})}),s.jsx(ce,{path:"bots",element:s.jsx(Yve,{})}),s.jsx(ce,{path:"builder",element:s.jsx(Bve,{})}),s.jsx(ce,{path:"checklist",element:s.jsx(Uve,{})}),s.jsx(ce,{path:"delete",element:s.jsx(Wve,{})}),s.jsx(ce,{path:"details",element:s.jsx(Hve,{})}),s.jsx(ce,{path:"edit",element:s.jsx(qve,{})}),s.jsx(ce,{path:"editor",element:s.jsx(Fve,{})}),s.jsx(ce,{path:"history",element:s.jsx(Gve,{})}),s.jsx(ce,{path:"json",element:s.jsx(Qve,{})}),s.jsx(ce,{path:"preview",element:s.jsx(Kve,{})}),s.jsx(ce,{path:"responses",element:s.jsx(Jve,{})}),s.jsx(ce,{path:"report",element:s.jsx(eye,{})}),s.jsx(ce,{path:"ranges",element:s.jsx(Zve,{})}),s.jsx(ce,{path:"subscriptions",element:s.jsx(fye,{})}),s.jsx(ce,{path:"timeline",element:s.jsx(YC,{})})]}),s.jsx(ce,{path:"/:resourceType",element:s.jsx(HC,{})}),s.jsx(ce,{path:"/",element:s.jsx(HC,{})})]})})}function mye(){const e=ae(),t=e.getUserConfiguration(),r=ki(),[n]=d1();return e.isLoading()?s.jsx(Rn,{}):s.jsx(rue,{logo:s.jsx(In,{size:24}),pathname:r.pathname,searchParams:n,version:vle,menus:gye(t),displayAddBookmark:!!(t!=null&&t.id),children:s.jsx(f.Suspense,{fallback:s.jsx(Rn,{}),children:s.jsx(hye,{})})})}function gye(e){var r;const t=((r=e==null?void 0:e.menu)==null?void 0:r.map(n=>{var o;return{title:n.title,links:((o=n.link)==null?void 0:o.map(i=>({label:i.name,href:i.target,icon:vye(i.target)})))||[]}}))||[];return t.push({title:"Settings",links:[{label:"Security",href:"/security",icon:s.jsx(sce,{})}]}),t}const JC={Patient:bce,Practitioner:oce,Organization:qle,ServiceRequest:gce,DiagnosticReport:yce,Questionnaire:nce,admin:Ule,AccessPolicy:ace,Subscription:Pce,batch:dce,Observation:uce};function vye(e){try{const t=new URL(e,"https://app.medplum.com").pathname.split("/")[1];if(t in JC){const r=JC[t];return s.jsx(r,{})}}catch{}return s.jsx(pm,{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 yye(){const e=Yc(),t=new _le({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))}}),r={headings:{sizes:{h1:{fontSize:"1.125rem",fontWeight:500,lineHeight:2}}},fontSizes:{xs:"0.6875rem",sm:"0.875rem",md:"0.875rem",lg:"1.0rem",xl:"1.125rem"}},n=eme([{path:"*",element:s.jsx(mye,{})}]),o=a=>n.navigate(a);x3(document.getElementById("root")).render(s.jsx(f.StrictMode,{children:s.jsx(Ple,{medplum:t,navigate:o,children:s.jsxs(UE,{theme:r,withGlobalStyles:!0,withNormalizeCSS:!0,children:[s.jsx(wa,{position:"bottom-right"}),s.jsx(cme,{router:n})]})})}))}yye().catch(console.error);
|
|
235
|
-
//# sourceMappingURL=index
|
|
235
|
+
//# sourceMappingURL=index-8kAuBKQq.js.map
|