diff --git a/.gitignore b/.gitignore index 1cf81ad..02331a2 100644 --- a/.gitignore +++ b/.gitignore @@ -16,6 +16,7 @@ node_modules coverage # Production +dist dist-ssr *.local @@ -46,6 +47,3 @@ vite.config.ts.timestamp-* # Temporary files *.tmp *.bak - -# Ignore core symlink -/core diff --git a/README.md b/README.md deleted file mode 100644 index 277ee14..0000000 --- a/README.md +++ /dev/null @@ -1,86 +0,0 @@ -# Care LiveKit Frontend - -This project extends the Care Frontend Core with LiveKit video functionality. - -## Setup - -### Prerequisites -- Node.js (v22) -- Git - -### Submodule Setup - -This project includes the Care Frontend Core as a Git submodule. The core repository (`care_fe`) is located at `./core` and tracks the `develop` branch. - -1. **Clone the Repository** - ```bash - # Clone with submodules - git clone --recursive https://github.com/ohcnetwork/care_livekit_fe.git - cd care_livekit_fe - ``` - -2. **If you already cloned without --recursive** - ```bash - git submodule init - git submodule update --remote - ``` - -### Development - -#### Updating Core Submodule -To get the latest changes from the `develop` branch of care_fe: - ```bash - git submodule update --remote core - ``` - -#### Working with Core - -When making changes to the core: - -1. Navigate to core and ensure you're on develop: - ```bash - cd core - git checkout develop - ``` - -2. Make your changes and push to care_fe: - ```bash - git add . - git commit -m "Your commit message" - git push origin develop - ``` - -3. Update the submodule reference in the main project: - ```bash - cd .. - git add core - git commit -m "Update core submodule" - git push - ``` - -### Troubleshooting - -#### Common Issues - -**Detached HEAD in core** - ```bash - cd core - git checkout develop - ``` - -**Check submodule status** - ```bash - git submodule status - ``` - -### Important Notes - -- The core submodule tracks the `develop` branch of care_fe -- Always push changes to the core repository before pushing the main repository -- Team members need to run `git submodule update --remote` to get latest submodule changes - -### Project Structure - -care_livekit_fe/ -├── core/ # Care Frontend Core (submodule) -├── src/ # src for this project \ No newline at end of file diff --git a/care-package.lock b/care-package.lock new file mode 100644 index 0000000..8338450 --- /dev/null +++ b/care-package.lock @@ -0,0 +1,4 @@ +{ + "package": "ohcnetwork/care_livekit_fe", + "branch": "main" +} \ No newline at end of file diff --git a/core b/core new file mode 120000 index 0000000..4fca981 --- /dev/null +++ b/core @@ -0,0 +1 @@ +../care_fe \ No newline at end of file diff --git a/dist/assets/__federation_expose_CareLivekit-0971ad60.js b/dist/assets/__federation_expose_CareLivekit-0971ad60.js deleted file mode 100644 index 8c31fdb..0000000 --- a/dist/assets/__federation_expose_CareLivekit-0971ad60.js +++ /dev/null @@ -1,34 +0,0 @@ -import { importShared } from './__federation_fn_import-68d74a8f.js'; -import { r as reactExports } from './__federation_shared_react-85510186.js'; - -var jsxRuntime = {exports: {}}; - -var reactJsxRuntime_production_min = {}; - -/** - * @license React - * react-jsx-runtime.production.min.js - * - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ -var f=reactExports,k=Symbol.for("react.element"),l=Symbol.for("react.fragment"),m=Object.prototype.hasOwnProperty,n=f.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,p={key:!0,ref:!0,__self:!0,__source:!0}; -function q(c,a,g){var b,d={},e=null,h=null;void 0!==g&&(e=""+g);void 0!==a.key&&(e=""+a.key);void 0!==a.ref&&(h=a.ref);for(b in a)m.call(a,b)&&!p.hasOwnProperty(b)&&(d[b]=a[b]);if(c&&c.defaultProps)for(b in a=c.defaultProps,a)void 0===d[b]&&(d[b]=a[b]);return {$$typeof:k,type:c,key:e,ref:h,props:d,_owner:n.current}}reactJsxRuntime_production_min.Fragment=l;reactJsxRuntime_production_min.jsx=q;reactJsxRuntime_production_min.jsxs=q; - -{ - jsxRuntime.exports = reactJsxRuntime_production_min; -} - -var jsxRuntimeExports = jsxRuntime.exports; - -const jsx = jsxRuntimeExports.jsx; - -const {Suspense} = await importShared('react'); - -const CareLivekit = () => { - return /* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx("div", { children: "Loading..." }), children: /* @__PURE__ */ jsx("div", { children: '"PageTitle not available"' }) }); -}; - -export { CareLivekit as default }; diff --git a/dist/assets/__federation_fn_import-68d74a8f.js b/dist/assets/__federation_fn_import-68d74a8f.js deleted file mode 100644 index 75837d1..0000000 --- a/dist/assets/__federation_fn_import-68d74a8f.js +++ /dev/null @@ -1,423 +0,0 @@ -import { _ as __vitePreload } from './preload-helper-1e3b7978.js'; - -const buildIdentifier = "[0-9A-Za-z-]+"; -const build = `(?:\\+(${buildIdentifier}(?:\\.${buildIdentifier})*))`; -const numericIdentifier = "0|[1-9]\\d*"; -const numericIdentifierLoose = "[0-9]+"; -const nonNumericIdentifier = "\\d*[a-zA-Z-][a-zA-Z0-9-]*"; -const preReleaseIdentifierLoose = `(?:${numericIdentifierLoose}|${nonNumericIdentifier})`; -const preReleaseLoose = `(?:-?(${preReleaseIdentifierLoose}(?:\\.${preReleaseIdentifierLoose})*))`; -const preReleaseIdentifier = `(?:${numericIdentifier}|${nonNumericIdentifier})`; -const preRelease = `(?:-(${preReleaseIdentifier}(?:\\.${preReleaseIdentifier})*))`; -const xRangeIdentifier = `${numericIdentifier}|x|X|\\*`; -const xRangePlain = `[v=\\s]*(${xRangeIdentifier})(?:\\.(${xRangeIdentifier})(?:\\.(${xRangeIdentifier})(?:${preRelease})?${build}?)?)?`; -const hyphenRange = `^\\s*(${xRangePlain})\\s+-\\s+(${xRangePlain})\\s*$`; -const mainVersionLoose = `(${numericIdentifierLoose})\\.(${numericIdentifierLoose})\\.(${numericIdentifierLoose})`; -const loosePlain = `[v=\\s]*${mainVersionLoose}${preReleaseLoose}?${build}?`; -const gtlt = "((?:<|>)?=?)"; -const comparatorTrim = `(\\s*)${gtlt}\\s*(${loosePlain}|${xRangePlain})`; -const loneTilde = "(?:~>?)"; -const tildeTrim = `(\\s*)${loneTilde}\\s+`; -const loneCaret = "(?:\\^)"; -const caretTrim = `(\\s*)${loneCaret}\\s+`; -const star = "(<|>)?=?\\s*\\*"; -const caret = `^${loneCaret}${xRangePlain}$`; -const mainVersion = `(${numericIdentifier})\\.(${numericIdentifier})\\.(${numericIdentifier})`; -const fullPlain = `v?${mainVersion}${preRelease}?${build}?`; -const tilde = `^${loneTilde}${xRangePlain}$`; -const xRange = `^${gtlt}\\s*${xRangePlain}$`; -const comparator = `^${gtlt}\\s*(${fullPlain})$|^$`; -const gte0 = "^\\s*>=\\s*0.0.0\\s*$"; -function parseRegex(source) { - return new RegExp(source); -} -function isXVersion(version) { - return !version || version.toLowerCase() === "x" || version === "*"; -} -function pipe(...fns) { - return (x) => { - return fns.reduce((v, f) => f(v), x); - }; -} -function extractComparator(comparatorString) { - return comparatorString.match(parseRegex(comparator)); -} -function combineVersion(major, minor, patch, preRelease2) { - const mainVersion2 = `${major}.${minor}.${patch}`; - if (preRelease2) { - return `${mainVersion2}-${preRelease2}`; - } - return mainVersion2; -} -function parseHyphen(range) { - return range.replace( - parseRegex(hyphenRange), - (_range, from, fromMajor, fromMinor, fromPatch, _fromPreRelease, _fromBuild, to, toMajor, toMinor, toPatch, toPreRelease) => { - if (isXVersion(fromMajor)) { - from = ""; - } else if (isXVersion(fromMinor)) { - from = `>=${fromMajor}.0.0`; - } else if (isXVersion(fromPatch)) { - from = `>=${fromMajor}.${fromMinor}.0`; - } else { - from = `>=${from}`; - } - if (isXVersion(toMajor)) { - to = ""; - } else if (isXVersion(toMinor)) { - to = `<${+toMajor + 1}.0.0-0`; - } else if (isXVersion(toPatch)) { - to = `<${toMajor}.${+toMinor + 1}.0-0`; - } else if (toPreRelease) { - to = `<=${toMajor}.${toMinor}.${toPatch}-${toPreRelease}`; - } else { - to = `<=${to}`; - } - return `${from} ${to}`.trim(); - } - ); -} -function parseComparatorTrim(range) { - return range.replace(parseRegex(comparatorTrim), "$1$2$3"); -} -function parseTildeTrim(range) { - return range.replace(parseRegex(tildeTrim), "$1~"); -} -function parseCaretTrim(range) { - return range.replace(parseRegex(caretTrim), "$1^"); -} -function parseCarets(range) { - return range.trim().split(/\s+/).map((rangeVersion) => { - return rangeVersion.replace( - parseRegex(caret), - (_, major, minor, patch, preRelease2) => { - if (isXVersion(major)) { - return ""; - } else if (isXVersion(minor)) { - return `>=${major}.0.0 <${+major + 1}.0.0-0`; - } else if (isXVersion(patch)) { - if (major === "0") { - return `>=${major}.${minor}.0 <${major}.${+minor + 1}.0-0`; - } else { - return `>=${major}.${minor}.0 <${+major + 1}.0.0-0`; - } - } else if (preRelease2) { - if (major === "0") { - if (minor === "0") { - return `>=${major}.${minor}.${patch}-${preRelease2} <${major}.${minor}.${+patch + 1}-0`; - } else { - return `>=${major}.${minor}.${patch}-${preRelease2} <${major}.${+minor + 1}.0-0`; - } - } else { - return `>=${major}.${minor}.${patch}-${preRelease2} <${+major + 1}.0.0-0`; - } - } else { - if (major === "0") { - if (minor === "0") { - return `>=${major}.${minor}.${patch} <${major}.${minor}.${+patch + 1}-0`; - } else { - return `>=${major}.${minor}.${patch} <${major}.${+minor + 1}.0-0`; - } - } - return `>=${major}.${minor}.${patch} <${+major + 1}.0.0-0`; - } - } - ); - }).join(" "); -} -function parseTildes(range) { - return range.trim().split(/\s+/).map((rangeVersion) => { - return rangeVersion.replace( - parseRegex(tilde), - (_, major, minor, patch, preRelease2) => { - if (isXVersion(major)) { - return ""; - } else if (isXVersion(minor)) { - return `>=${major}.0.0 <${+major + 1}.0.0-0`; - } else if (isXVersion(patch)) { - return `>=${major}.${minor}.0 <${major}.${+minor + 1}.0-0`; - } else if (preRelease2) { - return `>=${major}.${minor}.${patch}-${preRelease2} <${major}.${+minor + 1}.0-0`; - } - return `>=${major}.${minor}.${patch} <${major}.${+minor + 1}.0-0`; - } - ); - }).join(" "); -} -function parseXRanges(range) { - return range.split(/\s+/).map((rangeVersion) => { - return rangeVersion.trim().replace( - parseRegex(xRange), - (ret, gtlt2, major, minor, patch, preRelease2) => { - const isXMajor = isXVersion(major); - const isXMinor = isXMajor || isXVersion(minor); - const isXPatch = isXMinor || isXVersion(patch); - if (gtlt2 === "=" && isXPatch) { - gtlt2 = ""; - } - preRelease2 = ""; - if (isXMajor) { - if (gtlt2 === ">" || gtlt2 === "<") { - return "<0.0.0-0"; - } else { - return "*"; - } - } else if (gtlt2 && isXPatch) { - if (isXMinor) { - minor = 0; - } - patch = 0; - if (gtlt2 === ">") { - gtlt2 = ">="; - if (isXMinor) { - major = +major + 1; - minor = 0; - patch = 0; - } else { - minor = +minor + 1; - patch = 0; - } - } else if (gtlt2 === "<=") { - gtlt2 = "<"; - if (isXMinor) { - major = +major + 1; - } else { - minor = +minor + 1; - } - } - if (gtlt2 === "<") { - preRelease2 = "-0"; - } - return `${gtlt2 + major}.${minor}.${patch}${preRelease2}`; - } else if (isXMinor) { - return `>=${major}.0.0${preRelease2} <${+major + 1}.0.0-0`; - } else if (isXPatch) { - return `>=${major}.${minor}.0${preRelease2} <${major}.${+minor + 1}.0-0`; - } - return ret; - } - ); - }).join(" "); -} -function parseStar(range) { - return range.trim().replace(parseRegex(star), ""); -} -function parseGTE0(comparatorString) { - return comparatorString.trim().replace(parseRegex(gte0), ""); -} -function compareAtom(rangeAtom, versionAtom) { - rangeAtom = +rangeAtom || rangeAtom; - versionAtom = +versionAtom || versionAtom; - if (rangeAtom > versionAtom) { - return 1; - } - if (rangeAtom === versionAtom) { - return 0; - } - return -1; -} -function comparePreRelease(rangeAtom, versionAtom) { - const { preRelease: rangePreRelease } = rangeAtom; - const { preRelease: versionPreRelease } = versionAtom; - if (rangePreRelease === void 0 && !!versionPreRelease) { - return 1; - } - if (!!rangePreRelease && versionPreRelease === void 0) { - return -1; - } - if (rangePreRelease === void 0 && versionPreRelease === void 0) { - return 0; - } - for (let i = 0, n = rangePreRelease.length; i <= n; i++) { - const rangeElement = rangePreRelease[i]; - const versionElement = versionPreRelease[i]; - if (rangeElement === versionElement) { - continue; - } - if (rangeElement === void 0 && versionElement === void 0) { - return 0; - } - if (!rangeElement) { - return 1; - } - if (!versionElement) { - return -1; - } - return compareAtom(rangeElement, versionElement); - } - return 0; -} -function compareVersion(rangeAtom, versionAtom) { - return compareAtom(rangeAtom.major, versionAtom.major) || compareAtom(rangeAtom.minor, versionAtom.minor) || compareAtom(rangeAtom.patch, versionAtom.patch) || comparePreRelease(rangeAtom, versionAtom); -} -function eq(rangeAtom, versionAtom) { - return rangeAtom.version === versionAtom.version; -} -function compare(rangeAtom, versionAtom) { - switch (rangeAtom.operator) { - case "": - case "=": - return eq(rangeAtom, versionAtom); - case ">": - return compareVersion(rangeAtom, versionAtom) < 0; - case ">=": - return eq(rangeAtom, versionAtom) || compareVersion(rangeAtom, versionAtom) < 0; - case "<": - return compareVersion(rangeAtom, versionAtom) > 0; - case "<=": - return eq(rangeAtom, versionAtom) || compareVersion(rangeAtom, versionAtom) > 0; - case void 0: { - return true; - } - default: - return false; - } -} -function parseComparatorString(range) { - return pipe( - parseCarets, - parseTildes, - parseXRanges, - parseStar - )(range); -} -function parseRange(range) { - return pipe( - parseHyphen, - parseComparatorTrim, - parseTildeTrim, - parseCaretTrim - )(range.trim()).split(/\s+/).join(" "); -} -function satisfy(version, range) { - if (!version) { - return false; - } - const parsedRange = parseRange(range); - const parsedComparator = parsedRange.split(" ").map((rangeVersion) => parseComparatorString(rangeVersion)).join(" "); - const comparators = parsedComparator.split(/\s+/).map((comparator2) => parseGTE0(comparator2)); - const extractedVersion = extractComparator(version); - if (!extractedVersion) { - return false; - } - const [ - , - versionOperator, - , - versionMajor, - versionMinor, - versionPatch, - versionPreRelease - ] = extractedVersion; - const versionAtom = { - operator: versionOperator, - version: combineVersion( - versionMajor, - versionMinor, - versionPatch, - versionPreRelease - ), - major: versionMajor, - minor: versionMinor, - patch: versionPatch, - preRelease: versionPreRelease == null ? void 0 : versionPreRelease.split(".") - }; - for (const comparator2 of comparators) { - const extractedComparator = extractComparator(comparator2); - if (!extractedComparator) { - return false; - } - const [ - , - rangeOperator, - , - rangeMajor, - rangeMinor, - rangePatch, - rangePreRelease - ] = extractedComparator; - const rangeAtom = { - operator: rangeOperator, - version: combineVersion( - rangeMajor, - rangeMinor, - rangePatch, - rangePreRelease - ), - major: rangeMajor, - minor: rangeMinor, - patch: rangePatch, - preRelease: rangePreRelease == null ? void 0 : rangePreRelease.split(".") - }; - if (!compare(rangeAtom, versionAtom)) { - return false; - } - } - return true; -} - -const currentImports = {}; - -// eslint-disable-next-line no-undef -const moduleMap = {'react':{get:()=>()=>__federation_import(new URL('__federation_shared_react-85510186.js', import.meta.url).href),import:true},'react-dom':{get:()=>()=>__federation_import(new URL('__federation_shared_react-dom-5dad18ec.js', import.meta.url).href),import:true}}; -const moduleCache = Object.create(null); -async function importShared(name, shareScope = 'default') { - return moduleCache[name] - ? new Promise((r) => r(moduleCache[name])) - : (await getSharedFromRuntime(name, shareScope)) || getSharedFromLocal(name) -} -// eslint-disable-next-line -async function __federation_import(name) { - currentImports[name] ??= __vitePreload(() => import(name),true?[]:void 0); - return currentImports[name] -} -async function getSharedFromRuntime(name, shareScope) { - let module = null; - if (globalThis?.__federation_shared__?.[shareScope]?.[name]) { - const versionObj = globalThis.__federation_shared__[shareScope][name]; - const versionKey = Object.keys(versionObj)[0]; - const versionValue = Object.values(versionObj)[0]; - if (moduleMap[name]?.requiredVersion) { - // judge version satisfy - if (satisfy(versionKey, moduleMap[name].requiredVersion)) { - module = await (await versionValue.get())(); - } else { - console.log( - `provider support ${name}(${versionKey}) is not satisfied requiredVersion(\${moduleMap[name].requiredVersion})` - ); - } - } else { - module = await (await versionValue.get())(); - } - } - if (module) { - return flattenModule(module, name) - } -} -async function getSharedFromLocal(name) { - if (moduleMap[name]?.import) { - let module = await (await moduleMap[name].get())(); - return flattenModule(module, name) - } else { - console.error( - `consumer config import=false,so cant use callback shared module` - ); - } -} -function flattenModule(module, name) { - // use a shared module which export default a function will getting error 'TypeError: xxx is not a function' - if (typeof module.default === 'function') { - Object.keys(module).forEach((key) => { - if (key !== 'default') { - module.default[key] = module[key]; - } - }); - moduleCache[name] = module.default; - return module.default - } - if (module.default) module = Object.assign({}, module.default, module); - moduleCache[name] = module; - return module -} - -export { importShared, getSharedFromLocal as importSharedLocal, getSharedFromRuntime as importSharedRuntime }; diff --git a/dist/assets/__federation_shared_react-85510186.js b/dist/assets/__federation_shared_react-85510186.js deleted file mode 100644 index 6c0e45a..0000000 --- a/dist/assets/__federation_shared_react-85510186.js +++ /dev/null @@ -1,43 +0,0 @@ -function getDefaultExportFromCjs (x) { - return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x; -} - -var react = {exports: {}}; - -var react_production_min = {}; - -/** - * @license React - * react.production.min.js - * - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ -var l=Symbol.for("react.element"),n=Symbol.for("react.portal"),p=Symbol.for("react.fragment"),q=Symbol.for("react.strict_mode"),r=Symbol.for("react.profiler"),t=Symbol.for("react.provider"),u=Symbol.for("react.context"),v=Symbol.for("react.forward_ref"),w=Symbol.for("react.suspense"),x=Symbol.for("react.memo"),y=Symbol.for("react.lazy"),z=Symbol.iterator;function A(a){if(null===a||"object"!==typeof a)return null;a=z&&a[z]||a["@@iterator"];return "function"===typeof a?a:null} -var B={isMounted:function(){return !1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},C=Object.assign,D={};function E(a,b,e){this.props=a;this.context=b;this.refs=D;this.updater=e||B;}E.prototype.isReactComponent={}; -E.prototype.setState=function(a,b){if("object"!==typeof a&&"function"!==typeof a&&null!=a)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,a,b,"setState");};E.prototype.forceUpdate=function(a){this.updater.enqueueForceUpdate(this,a,"forceUpdate");};function F(){}F.prototype=E.prototype;function G(a,b,e){this.props=a;this.context=b;this.refs=D;this.updater=e||B;}var H=G.prototype=new F; -H.constructor=G;C(H,E.prototype);H.isPureReactComponent=!0;var I=Array.isArray,J=Object.prototype.hasOwnProperty,K={current:null},L={key:!0,ref:!0,__self:!0,__source:!0}; -function M(a,b,e){var d,c={},k=null,h=null;if(null!=b)for(d in void 0!==b.ref&&(h=b.ref),void 0!==b.key&&(k=""+b.key),b)J.call(b,d)&&!L.hasOwnProperty(d)&&(c[d]=b[d]);var g=arguments.length-2;if(1===g)c.children=e;else if(1>>1,e=a[d];if(0>>1;dg(C,c))ng(x,C)?(a[d]=x,a[n]=c,d=n):(a[d]=C,a[m]=c,d=m);else if(ng(x,c))a[d]=x,a[n]=c,d=n;else break a}}return b} - function g(a,b){var c=a.sortIndex-b.sortIndex;return 0!==c?c:a.id-b.id}if("object"===typeof performance&&"function"===typeof performance.now){var l=performance;exports.unstable_now=function(){return l.now()};}else {var p=Date,q=p.now();exports.unstable_now=function(){return p.now()-q};}var r=[],t=[],u=1,v=null,y=3,z=!1,A=!1,B=!1,D="function"===typeof setTimeout?setTimeout:null,E="function"===typeof clearTimeout?clearTimeout:null,F="undefined"!==typeof setImmediate?setImmediate:null; - "undefined"!==typeof navigator&&void 0!==navigator.scheduling&&void 0!==navigator.scheduling.isInputPending&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function G(a){for(var b=h(t);null!==b;){if(null===b.callback)k(t);else if(b.startTime<=a)k(t),b.sortIndex=b.expirationTime,f(r,b);else break;b=h(t);}}function H(a){B=!1;G(a);if(!A)if(null!==h(r))A=!0,I(J);else {var b=h(t);null!==b&&K(H,b.startTime-a);}} - function J(a,b){A=!1;B&&(B=!1,E(L),L=-1);z=!0;var c=y;try{G(b);for(v=h(r);null!==v&&(!(v.expirationTime>b)||a&&!M());){var d=v.callback;if("function"===typeof d){v.callback=null;y=v.priorityLevel;var e=d(v.expirationTime<=b);b=exports.unstable_now();"function"===typeof e?v.callback=e:v===h(r)&&k(r);G(b);}else k(r);v=h(r);}if(null!==v)var w=!0;else {var m=h(t);null!==m&&K(H,m.startTime-b);w=!1;}return w}finally{v=null,y=c,z=!1;}}var N=!1,O=null,L=-1,P=5,Q=-1; - function M(){return exports.unstable_now()-Qa||125d?(a.sortIndex=c,f(t,a),null===h(r)&&a===h(t)&&(B?(E(L),L=-1):B=!0,K(H,c-d))):(a.sortIndex=e,f(r,a),A||z||(A=!0,I(J)));return a}; - exports.unstable_shouldYield=M;exports.unstable_wrapCallback=function(a){var b=y;return function(){var c=y;y=b;try{return a.apply(this,arguments)}finally{y=c;}}}; -} (scheduler_production_min)); - -{ - scheduler.exports = scheduler_production_min; -} - -var schedulerExports = scheduler.exports; - -/** - * @license React - * react-dom.production.min.js - * - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ -var aa=reactExports,ca=schedulerExports;function p(a){for(var b="https://reactjs.org/docs/error-decoder.html?invariant="+a,c=1;cb}return !1}function v(a,b,c,d,e,f,g){this.acceptsBooleans=2===b||3===b||4===b;this.attributeName=d;this.attributeNamespace=e;this.mustUseProperty=c;this.propertyName=a;this.type=b;this.sanitizeURL=f;this.removeEmptyString=g;}var z={}; -"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(a){z[a]=new v(a,0,!1,a,null,!1,!1);});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(a){var b=a[0];z[b]=new v(b,1,!1,a[1],null,!1,!1);});["contentEditable","draggable","spellCheck","value"].forEach(function(a){z[a]=new v(a,2,!1,a.toLowerCase(),null,!1,!1);}); -["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(a){z[a]=new v(a,2,!1,a,null,!1,!1);});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(a){z[a]=new v(a,3,!1,a.toLowerCase(),null,!1,!1);}); -["checked","multiple","muted","selected"].forEach(function(a){z[a]=new v(a,3,!0,a,null,!1,!1);});["capture","download"].forEach(function(a){z[a]=new v(a,4,!1,a,null,!1,!1);});["cols","rows","size","span"].forEach(function(a){z[a]=new v(a,6,!1,a,null,!1,!1);});["rowSpan","start"].forEach(function(a){z[a]=new v(a,5,!1,a.toLowerCase(),null,!1,!1);});var ra=/[\-:]([a-z])/g;function sa(a){return a[1].toUpperCase()} -"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(a){var b=a.replace(ra, -sa);z[b]=new v(b,1,!1,a,null,!1,!1);});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(a){var b=a.replace(ra,sa);z[b]=new v(b,1,!1,a,"http://www.w3.org/1999/xlink",!1,!1);});["xml:base","xml:lang","xml:space"].forEach(function(a){var b=a.replace(ra,sa);z[b]=new v(b,1,!1,a,"http://www.w3.org/XML/1998/namespace",!1,!1);});["tabIndex","crossOrigin"].forEach(function(a){z[a]=new v(a,1,!1,a.toLowerCase(),null,!1,!1);}); -z.xlinkHref=new v("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(a){z[a]=new v(a,1,!1,a.toLowerCase(),null,!0,!0);}); -function ta(a,b,c,d){var e=z.hasOwnProperty(b)?z[b]:null;if(null!==e?0!==e.type:d||!(2h||e[g]!==f[h]){var k="\n"+e[g].replace(" at new "," at ");a.displayName&&k.includes("")&&(k=k.replace("",a.displayName));return k}while(1<=g&&0<=h)}break}}}finally{Na=!1,Error.prepareStackTrace=c;}return (a=a?a.displayName||a.name:"")?Ma(a):""} -function Pa(a){switch(a.tag){case 5:return Ma(a.type);case 16:return Ma("Lazy");case 13:return Ma("Suspense");case 19:return Ma("SuspenseList");case 0:case 2:case 15:return a=Oa(a.type,!1),a;case 11:return a=Oa(a.type.render,!1),a;case 1:return a=Oa(a.type,!0),a;default:return ""}} -function Qa(a){if(null==a)return null;if("function"===typeof a)return a.displayName||a.name||null;if("string"===typeof a)return a;switch(a){case ya:return "Fragment";case wa:return "Portal";case Aa:return "Profiler";case za:return "StrictMode";case Ea:return "Suspense";case Fa:return "SuspenseList"}if("object"===typeof a)switch(a.$$typeof){case Ca:return (a.displayName||"Context")+".Consumer";case Ba:return (a._context.displayName||"Context")+".Provider";case Da:var b=a.render;a=a.displayName;a||(a=b.displayName|| -b.name||"",a=""!==a?"ForwardRef("+a+")":"ForwardRef");return a;case Ga:return b=a.displayName||null,null!==b?b:Qa(a.type)||"Memo";case Ha:b=a._payload;a=a._init;try{return Qa(a(b))}catch(c){}}return null} -function Ra(a){var b=a.type;switch(a.tag){case 24:return "Cache";case 9:return (b.displayName||"Context")+".Consumer";case 10:return (b._context.displayName||"Context")+".Provider";case 18:return "DehydratedFragment";case 11:return a=b.render,a=a.displayName||a.name||"",b.displayName||(""!==a?"ForwardRef("+a+")":"ForwardRef");case 7:return "Fragment";case 5:return b;case 4:return "Portal";case 3:return "Root";case 6:return "Text";case 16:return Qa(b);case 8:return b===za?"StrictMode":"Mode";case 22:return "Offscreen"; -case 12:return "Profiler";case 21:return "Scope";case 13:return "Suspense";case 19:return "SuspenseList";case 25:return "TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if("function"===typeof b)return b.displayName||b.name||null;if("string"===typeof b)return b}return null}function Sa(a){switch(typeof a){case "boolean":case "number":case "string":case "undefined":return a;case "object":return a;default:return ""}} -function Ta(a){var b=a.type;return (a=a.nodeName)&&"input"===a.toLowerCase()&&("checkbox"===b||"radio"===b)} -function Ua(a){var b=Ta(a)?"checked":"value",c=Object.getOwnPropertyDescriptor(a.constructor.prototype,b),d=""+a[b];if(!a.hasOwnProperty(b)&&"undefined"!==typeof c&&"function"===typeof c.get&&"function"===typeof c.set){var e=c.get,f=c.set;Object.defineProperty(a,b,{configurable:!0,get:function(){return e.call(this)},set:function(a){d=""+a;f.call(this,a);}});Object.defineProperty(a,b,{enumerable:c.enumerable});return {getValue:function(){return d},setValue:function(a){d=""+a;},stopTracking:function(){a._valueTracker= -null;delete a[b];}}}}function Va(a){a._valueTracker||(a._valueTracker=Ua(a));}function Wa(a){if(!a)return !1;var b=a._valueTracker;if(!b)return !0;var c=b.getValue();var d="";a&&(d=Ta(a)?a.checked?"true":"false":a.value);a=d;return a!==c?(b.setValue(a),!0):!1}function Xa(a){a=a||("undefined"!==typeof document?document:void 0);if("undefined"===typeof a)return null;try{return a.activeElement||a.body}catch(b){return a.body}} -function Ya(a,b){var c=b.checked;return A({},b,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:null!=c?c:a._wrapperState.initialChecked})}function Za(a,b){var c=null==b.defaultValue?"":b.defaultValue,d=null!=b.checked?b.checked:b.defaultChecked;c=Sa(null!=b.value?b.value:c);a._wrapperState={initialChecked:d,initialValue:c,controlled:"checkbox"===b.type||"radio"===b.type?null!=b.checked:null!=b.value};}function ab(a,b){b=b.checked;null!=b&&ta(a,"checked",b,!1);} -function bb(a,b){ab(a,b);var c=Sa(b.value),d=b.type;if(null!=c)if("number"===d){if(0===c&&""===a.value||a.value!=c)a.value=""+c;}else a.value!==""+c&&(a.value=""+c);else if("submit"===d||"reset"===d){a.removeAttribute("value");return}b.hasOwnProperty("value")?cb(a,b.type,c):b.hasOwnProperty("defaultValue")&&cb(a,b.type,Sa(b.defaultValue));null==b.checked&&null!=b.defaultChecked&&(a.defaultChecked=!!b.defaultChecked);} -function db(a,b,c){if(b.hasOwnProperty("value")||b.hasOwnProperty("defaultValue")){var d=b.type;if(!("submit"!==d&&"reset"!==d||void 0!==b.value&&null!==b.value))return;b=""+a._wrapperState.initialValue;c||b===a.value||(a.value=b);a.defaultValue=b;}c=a.name;""!==c&&(a.name="");a.defaultChecked=!!a._wrapperState.initialChecked;""!==c&&(a.name=c);} -function cb(a,b,c){if("number"!==b||Xa(a.ownerDocument)!==a)null==c?a.defaultValue=""+a._wrapperState.initialValue:a.defaultValue!==""+c&&(a.defaultValue=""+c);}var eb=Array.isArray; -function fb(a,b,c,d){a=a.options;if(b){b={};for(var e=0;e"+b.valueOf().toString()+"";for(b=mb.firstChild;a.firstChild;)a.removeChild(a.firstChild);for(;b.firstChild;)a.appendChild(b.firstChild);}}); -function ob(a,b){if(b){var c=a.firstChild;if(c&&c===a.lastChild&&3===c.nodeType){c.nodeValue=b;return}}a.textContent=b;} -var pb={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0, -zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},qb=["Webkit","ms","Moz","O"];Object.keys(pb).forEach(function(a){qb.forEach(function(b){b=b+a.charAt(0).toUpperCase()+a.substring(1);pb[b]=pb[a];});});function rb(a,b,c){return null==b||"boolean"===typeof b||""===b?"":c||"number"!==typeof b||0===b||pb.hasOwnProperty(a)&&pb[a]?(""+b).trim():b+"px"} -function sb(a,b){a=a.style;for(var c in b)if(b.hasOwnProperty(c)){var d=0===c.indexOf("--"),e=rb(c,b[c],d);"float"===c&&(c="cssFloat");d?a.setProperty(c,e):a[c]=e;}}var tb=A({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0}); -function ub(a,b){if(b){if(tb[a]&&(null!=b.children||null!=b.dangerouslySetInnerHTML))throw Error(p(137,a));if(null!=b.dangerouslySetInnerHTML){if(null!=b.children)throw Error(p(60));if("object"!==typeof b.dangerouslySetInnerHTML||!("__html"in b.dangerouslySetInnerHTML))throw Error(p(61));}if(null!=b.style&&"object"!==typeof b.style)throw Error(p(62));}} -function vb(a,b){if(-1===a.indexOf("-"))return "string"===typeof b.is;switch(a){case "annotation-xml":case "color-profile":case "font-face":case "font-face-src":case "font-face-uri":case "font-face-format":case "font-face-name":case "missing-glyph":return !1;default:return !0}}var wb=null;function xb(a){a=a.target||a.srcElement||window;a.correspondingUseElement&&(a=a.correspondingUseElement);return 3===a.nodeType?a.parentNode:a}var yb=null,zb=null,Ab=null; -function Bb(a){if(a=Cb(a)){if("function"!==typeof yb)throw Error(p(280));var b=a.stateNode;b&&(b=Db(b),yb(a.stateNode,a.type,b));}}function Eb(a){zb?Ab?Ab.push(a):Ab=[a]:zb=a;}function Fb(){if(zb){var a=zb,b=Ab;Ab=zb=null;Bb(a);if(b)for(a=0;a>>=0;return 0===a?32:31-(pc(a)/qc|0)|0}var rc=64,sc=4194304; -function tc(a){switch(a&-a){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return a&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return a&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824; -default:return a}}function uc(a,b){var c=a.pendingLanes;if(0===c)return 0;var d=0,e=a.suspendedLanes,f=a.pingedLanes,g=c&268435455;if(0!==g){var h=g&~e;0!==h?d=tc(h):(f&=g,0!==f&&(d=tc(f)));}else g=c&~e,0!==g?d=tc(g):0!==f&&(d=tc(f));if(0===d)return 0;if(0!==b&&b!==d&&0===(b&e)&&(e=d&-d,f=b&-b,e>=f||16===e&&0!==(f&4194240)))return b;0!==(d&4)&&(d|=c&16);b=a.entangledLanes;if(0!==b)for(a=a.entanglements,b&=d;0c;c++)b.push(a);return b} -function Ac(a,b,c){a.pendingLanes|=b;536870912!==b&&(a.suspendedLanes=0,a.pingedLanes=0);a=a.eventTimes;b=31-oc(b);a[b]=c;}function Bc(a,b){var c=a.pendingLanes&~b;a.pendingLanes=b;a.suspendedLanes=0;a.pingedLanes=0;a.expiredLanes&=b;a.mutableReadLanes&=b;a.entangledLanes&=b;b=a.entanglements;var d=a.eventTimes;for(a=a.expirationTimes;0=be),ee=String.fromCharCode(32),fe=!1; -function ge(a,b){switch(a){case "keyup":return -1!==$d.indexOf(b.keyCode);case "keydown":return 229!==b.keyCode;case "keypress":case "mousedown":case "focusout":return !0;default:return !1}}function he(a){a=a.detail;return "object"===typeof a&&"data"in a?a.data:null}var ie=!1;function je(a,b){switch(a){case "compositionend":return he(b);case "keypress":if(32!==b.which)return null;fe=!0;return ee;case "textInput":return a=b.data,a===ee&&fe?null:a;default:return null}} -function ke(a,b){if(ie)return "compositionend"===a||!ae&&ge(a,b)?(a=nd(),md=ld=kd=null,ie=!1,a):null;switch(a){case "paste":return null;case "keypress":if(!(b.ctrlKey||b.altKey||b.metaKey)||b.ctrlKey&&b.altKey){if(b.char&&1=b)return {node:c,offset:b-a};a=d;}a:{for(;c;){if(c.nextSibling){c=c.nextSibling;break a}c=c.parentNode;}c=void 0;}c=Je(c);}}function Le(a,b){return a&&b?a===b?!0:a&&3===a.nodeType?!1:b&&3===b.nodeType?Le(a,b.parentNode):"contains"in a?a.contains(b):a.compareDocumentPosition?!!(a.compareDocumentPosition(b)&16):!1:!1} -function Me(){for(var a=window,b=Xa();b instanceof a.HTMLIFrameElement;){try{var c="string"===typeof b.contentWindow.location.href;}catch(d){c=!1;}if(c)a=b.contentWindow;else break;b=Xa(a.document);}return b}function Ne(a){var b=a&&a.nodeName&&a.nodeName.toLowerCase();return b&&("input"===b&&("text"===a.type||"search"===a.type||"tel"===a.type||"url"===a.type||"password"===a.type)||"textarea"===b||"true"===a.contentEditable)} -function Oe(a){var b=Me(),c=a.focusedElem,d=a.selectionRange;if(b!==c&&c&&c.ownerDocument&&Le(c.ownerDocument.documentElement,c)){if(null!==d&&Ne(c))if(b=d.start,a=d.end,void 0===a&&(a=b),"selectionStart"in c)c.selectionStart=b,c.selectionEnd=Math.min(a,c.value.length);else if(a=(b=c.ownerDocument||document)&&b.defaultView||window,a.getSelection){a=a.getSelection();var e=c.textContent.length,f=Math.min(d.start,e);d=void 0===d.end?f:Math.min(d.end,e);!a.extend&&f>d&&(e=d,d=f,f=e);e=Ke(c,f);var g=Ke(c, -d);e&&g&&(1!==a.rangeCount||a.anchorNode!==e.node||a.anchorOffset!==e.offset||a.focusNode!==g.node||a.focusOffset!==g.offset)&&(b=b.createRange(),b.setStart(e.node,e.offset),a.removeAllRanges(),f>d?(a.addRange(b),a.extend(g.node,g.offset)):(b.setEnd(g.node,g.offset),a.addRange(b)));}b=[];for(a=c;a=a.parentNode;)1===a.nodeType&&b.push({element:a,left:a.scrollLeft,top:a.scrollTop});"function"===typeof c.focus&&c.focus();for(c=0;c=document.documentMode,Qe=null,Re=null,Se=null,Te=!1; -function Ue(a,b,c){var d=c.window===c?c.document:9===c.nodeType?c:c.ownerDocument;Te||null==Qe||Qe!==Xa(d)||(d=Qe,"selectionStart"in d&&Ne(d)?d={start:d.selectionStart,end:d.selectionEnd}:(d=(d.ownerDocument&&d.ownerDocument.defaultView||window).getSelection(),d={anchorNode:d.anchorNode,anchorOffset:d.anchorOffset,focusNode:d.focusNode,focusOffset:d.focusOffset}),Se&&Ie(Se,d)||(Se=d,d=oe(Re,"onSelect"),0Tf||(a.current=Sf[Tf],Sf[Tf]=null,Tf--);}function G(a,b){Tf++;Sf[Tf]=a.current;a.current=b;}var Vf={},H=Uf(Vf),Wf=Uf(!1),Xf=Vf;function Yf(a,b){var c=a.type.contextTypes;if(!c)return Vf;var d=a.stateNode;if(d&&d.__reactInternalMemoizedUnmaskedChildContext===b)return d.__reactInternalMemoizedMaskedChildContext;var e={},f;for(f in c)e[f]=b[f];d&&(a=a.stateNode,a.__reactInternalMemoizedUnmaskedChildContext=b,a.__reactInternalMemoizedMaskedChildContext=e);return e} -function Zf(a){a=a.childContextTypes;return null!==a&&void 0!==a}function $f(){E(Wf);E(H);}function ag(a,b,c){if(H.current!==Vf)throw Error(p(168));G(H,b);G(Wf,c);}function bg(a,b,c){var d=a.stateNode;b=b.childContextTypes;if("function"!==typeof d.getChildContext)return c;d=d.getChildContext();for(var e in d)if(!(e in b))throw Error(p(108,Ra(a)||"Unknown",e));return A({},c,d)} -function cg(a){a=(a=a.stateNode)&&a.__reactInternalMemoizedMergedChildContext||Vf;Xf=H.current;G(H,a);G(Wf,Wf.current);return !0}function dg(a,b,c){var d=a.stateNode;if(!d)throw Error(p(169));c?(a=bg(a,b,Xf),d.__reactInternalMemoizedMergedChildContext=a,E(Wf),E(H),G(H,a)):E(Wf);G(Wf,c);}var eg=null,fg=!1,gg=!1;function hg(a){null===eg?eg=[a]:eg.push(a);}function ig(a){fg=!0;hg(a);} -function jg(){if(!gg&&null!==eg){gg=!0;var a=0,b=C;try{var c=eg;for(C=1;a>=g;e-=g;rg=1<<32-oc(b)+e|c<w?(x=u,u=null):x=u.sibling;var n=r(e,u,h[w],k);if(null===n){null===u&&(u=x);break}a&&u&&null===n.alternate&&b(e,u);g=f(n,g,w);null===m?l=n:m.sibling=n;m=n;u=x;}if(w===h.length)return c(e,u),I&&tg(e,w),l;if(null===u){for(;ww?(x=m,m=null):x=m.sibling;var t=r(e,m,n.value,k);if(null===t){null===m&&(m=x);break}a&&m&&null===t.alternate&&b(e,m);g=f(t,g,w);null===u?l=t:u.sibling=t;u=t;m=x;}if(n.done)return c(e, -m),I&&tg(e,w),l;if(null===m){for(;!n.done;w++,n=h.next())n=q(e,n.value,k),null!==n&&(g=f(n,g,w),null===u?l=n:u.sibling=n,u=n);I&&tg(e,w);return l}for(m=d(e,m);!n.done;w++,n=h.next())n=y(m,e,w,n.value,k),null!==n&&(a&&null!==n.alternate&&m.delete(null===n.key?w:n.key),g=f(n,g,w),null===u?l=n:u.sibling=n,u=n);a&&m.forEach(function(a){return b(e,a)});I&&tg(e,w);return l}function J(a,d,f,h){"object"===typeof f&&null!==f&&f.type===ya&&null===f.key&&(f=f.props.children);if("object"===typeof f&&null!==f){switch(f.$$typeof){case va:a:{for(var k= -f.key,l=d;null!==l;){if(l.key===k){k=f.type;if(k===ya){if(7===l.tag){c(a,l.sibling);d=e(l,f.props.children);d.return=a;a=d;break a}}else if(l.elementType===k||"object"===typeof k&&null!==k&&k.$$typeof===Ha&&Ng(k)===l.type){c(a,l.sibling);d=e(l,f.props);d.ref=Lg(a,l,f);d.return=a;a=d;break a}c(a,l);break}else b(a,l);l=l.sibling;}f.type===ya?(d=Tg(f.props.children,a.mode,h,f.key),d.return=a,a=d):(h=Rg(f.type,f.key,f.props,null,a.mode,h),h.ref=Lg(a,d,f),h.return=a,a=h);}return g(a);case wa:a:{for(l=f.key;null!== -d;){if(d.key===l)if(4===d.tag&&d.stateNode.containerInfo===f.containerInfo&&d.stateNode.implementation===f.implementation){c(a,d.sibling);d=e(d,f.children||[]);d.return=a;a=d;break a}else {c(a,d);break}else b(a,d);d=d.sibling;}d=Sg(f,a.mode,h);d.return=a;a=d;}return g(a);case Ha:return l=f._init,J(a,d,l(f._payload),h)}if(eb(f))return n(a,d,f,h);if(Ka(f))return t(a,d,f,h);Mg(a,f);}return "string"===typeof f&&""!==f||"number"===typeof f?(f=""+f,null!==d&&6===d.tag?(c(a,d.sibling),d=e(d,f),d.return=a,a=d): -(c(a,d),d=Qg(f,a.mode,h),d.return=a,a=d),g(a)):c(a,d)}return J}var Ug=Og(!0),Vg=Og(!1),Wg=Uf(null),Xg=null,Yg=null,Zg=null;function $g(){Zg=Yg=Xg=null;}function ah(a){var b=Wg.current;E(Wg);a._currentValue=b;}function bh(a,b,c){for(;null!==a;){var d=a.alternate;(a.childLanes&b)!==b?(a.childLanes|=b,null!==d&&(d.childLanes|=b)):null!==d&&(d.childLanes&b)!==b&&(d.childLanes|=b);if(a===c)break;a=a.return;}} -function ch(a,b){Xg=a;Zg=Yg=null;a=a.dependencies;null!==a&&null!==a.firstContext&&(0!==(a.lanes&b)&&(dh=!0),a.firstContext=null);}function eh(a){var b=a._currentValue;if(Zg!==a)if(a={context:a,memoizedValue:b,next:null},null===Yg){if(null===Xg)throw Error(p(308));Yg=a;Xg.dependencies={lanes:0,firstContext:a};}else Yg=Yg.next=a;return b}var fh=null;function gh(a){null===fh?fh=[a]:fh.push(a);} -function hh(a,b,c,d){var e=b.interleaved;null===e?(c.next=c,gh(b)):(c.next=e.next,e.next=c);b.interleaved=c;return ih(a,d)}function ih(a,b){a.lanes|=b;var c=a.alternate;null!==c&&(c.lanes|=b);c=a;for(a=a.return;null!==a;)a.childLanes|=b,c=a.alternate,null!==c&&(c.childLanes|=b),c=a,a=a.return;return 3===c.tag?c.stateNode:null}var jh=!1;function kh(a){a.updateQueue={baseState:a.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null};} -function lh(a,b){a=a.updateQueue;b.updateQueue===a&&(b.updateQueue={baseState:a.baseState,firstBaseUpdate:a.firstBaseUpdate,lastBaseUpdate:a.lastBaseUpdate,shared:a.shared,effects:a.effects});}function mh(a,b){return {eventTime:a,lane:b,tag:0,payload:null,callback:null,next:null}} -function nh(a,b,c){var d=a.updateQueue;if(null===d)return null;d=d.shared;if(0!==(K&2)){var e=d.pending;null===e?b.next=b:(b.next=e.next,e.next=b);d.pending=b;return ih(a,c)}e=d.interleaved;null===e?(b.next=b,gh(d)):(b.next=e.next,e.next=b);d.interleaved=b;return ih(a,c)}function oh(a,b,c){b=b.updateQueue;if(null!==b&&(b=b.shared,0!==(c&4194240))){var d=b.lanes;d&=a.pendingLanes;c|=d;b.lanes=c;Cc(a,c);}} -function ph(a,b){var c=a.updateQueue,d=a.alternate;if(null!==d&&(d=d.updateQueue,c===d)){var e=null,f=null;c=c.firstBaseUpdate;if(null!==c){do{var g={eventTime:c.eventTime,lane:c.lane,tag:c.tag,payload:c.payload,callback:c.callback,next:null};null===f?e=f=g:f=f.next=g;c=c.next;}while(null!==c);null===f?e=f=b:f=f.next=b;}else e=f=b;c={baseState:d.baseState,firstBaseUpdate:e,lastBaseUpdate:f,shared:d.shared,effects:d.effects};a.updateQueue=c;return}a=c.lastBaseUpdate;null===a?c.firstBaseUpdate=b:a.next= -b;c.lastBaseUpdate=b;} -function qh(a,b,c,d){var e=a.updateQueue;jh=!1;var f=e.firstBaseUpdate,g=e.lastBaseUpdate,h=e.shared.pending;if(null!==h){e.shared.pending=null;var k=h,l=k.next;k.next=null;null===g?f=l:g.next=l;g=k;var m=a.alternate;null!==m&&(m=m.updateQueue,h=m.lastBaseUpdate,h!==g&&(null===h?m.firstBaseUpdate=l:h.next=l,m.lastBaseUpdate=k));}if(null!==f){var q=e.baseState;g=0;m=l=k=null;h=f;do{var r=h.lane,y=h.eventTime;if((d&r)===r){null!==m&&(m=m.next={eventTime:y,lane:0,tag:h.tag,payload:h.payload,callback:h.callback, -next:null});a:{var n=a,t=h;r=b;y=c;switch(t.tag){case 1:n=t.payload;if("function"===typeof n){q=n.call(y,q,r);break a}q=n;break a;case 3:n.flags=n.flags&-65537|128;case 0:n=t.payload;r="function"===typeof n?n.call(y,q,r):n;if(null===r||void 0===r)break a;q=A({},q,r);break a;case 2:jh=!0;}}null!==h.callback&&0!==h.lane&&(a.flags|=64,r=e.effects,null===r?e.effects=[h]:r.push(h));}else y={eventTime:y,lane:r,tag:h.tag,payload:h.payload,callback:h.callback,next:null},null===m?(l=m=y,k=q):m=m.next=y,g|=r; -h=h.next;if(null===h)if(h=e.shared.pending,null===h)break;else r=h,h=r.next,r.next=null,e.lastBaseUpdate=r,e.shared.pending=null;}while(1);null===m&&(k=q);e.baseState=k;e.firstBaseUpdate=l;e.lastBaseUpdate=m;b=e.shared.interleaved;if(null!==b){e=b;do g|=e.lane,e=e.next;while(e!==b)}else null===f&&(e.shared.lanes=0);rh|=g;a.lanes=g;a.memoizedState=q;}} -function sh(a,b,c){a=b.effects;b.effects=null;if(null!==a)for(b=0;bc?c:4;a(!0);var d=Gh.transition;Gh.transition={};try{a(!1),b();}finally{C=c,Gh.transition=d;}}function wi(){return Uh().memoizedState} -function xi(a,b,c){var d=yi(a);c={lane:d,action:c,hasEagerState:!1,eagerState:null,next:null};if(zi(a))Ai(b,c);else if(c=hh(a,b,c,d),null!==c){var e=R();gi(c,a,d,e);Bi(c,b,d);}} -function ii(a,b,c){var d=yi(a),e={lane:d,action:c,hasEagerState:!1,eagerState:null,next:null};if(zi(a))Ai(b,e);else {var f=a.alternate;if(0===a.lanes&&(null===f||0===f.lanes)&&(f=b.lastRenderedReducer,null!==f))try{var g=b.lastRenderedState,h=f(g,c);e.hasEagerState=!0;e.eagerState=h;if(He(h,g)){var k=b.interleaved;null===k?(e.next=e,gh(b)):(e.next=k.next,k.next=e);b.interleaved=e;return}}catch(l){}finally{}c=hh(a,b,e,d);null!==c&&(e=R(),gi(c,a,d,e),Bi(c,b,d));}} -function zi(a){var b=a.alternate;return a===M||null!==b&&b===M}function Ai(a,b){Jh=Ih=!0;var c=a.pending;null===c?b.next=b:(b.next=c.next,c.next=b);a.pending=b;}function Bi(a,b,c){if(0!==(c&4194240)){var d=b.lanes;d&=a.pendingLanes;c|=d;b.lanes=c;Cc(a,c);}} -var Rh={readContext:eh,useCallback:P,useContext:P,useEffect:P,useImperativeHandle:P,useInsertionEffect:P,useLayoutEffect:P,useMemo:P,useReducer:P,useRef:P,useState:P,useDebugValue:P,useDeferredValue:P,useTransition:P,useMutableSource:P,useSyncExternalStore:P,useId:P,unstable_isNewReconciler:!1},Oh={readContext:eh,useCallback:function(a,b){Th().memoizedState=[a,void 0===b?null:b];return a},useContext:eh,useEffect:mi,useImperativeHandle:function(a,b,c){c=null!==c&&void 0!==c?c.concat([a]):null;return ki(4194308, -4,pi.bind(null,b,a),c)},useLayoutEffect:function(a,b){return ki(4194308,4,a,b)},useInsertionEffect:function(a,b){return ki(4,2,a,b)},useMemo:function(a,b){var c=Th();b=void 0===b?null:b;a=a();c.memoizedState=[a,b];return a},useReducer:function(a,b,c){var d=Th();b=void 0!==c?c(b):b;d.memoizedState=d.baseState=b;a={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:a,lastRenderedState:b};d.queue=a;a=a.dispatch=xi.bind(null,M,a);return [d.memoizedState,a]},useRef:function(a){var b= -Th();a={current:a};return b.memoizedState=a},useState:hi,useDebugValue:ri,useDeferredValue:function(a){return Th().memoizedState=a},useTransition:function(){var a=hi(!1),b=a[0];a=vi.bind(null,a[1]);Th().memoizedState=a;return [b,a]},useMutableSource:function(){},useSyncExternalStore:function(a,b,c){var d=M,e=Th();if(I){if(void 0===c)throw Error(p(407));c=c();}else {c=b();if(null===Q)throw Error(p(349));0!==(Hh&30)||di(d,b,c);}e.memoizedState=c;var f={value:c,getSnapshot:b};e.queue=f;mi(ai.bind(null,d, -f,a),[a]);d.flags|=2048;bi(9,ci.bind(null,d,f,c,b),void 0,null);return c},useId:function(){var a=Th(),b=Q.identifierPrefix;if(I){var c=sg;var d=rg;c=(d&~(1<<32-oc(d)-1)).toString(32)+c;b=":"+b+"R"+c;c=Kh++;0\x3c/script>",a=a.removeChild(a.firstChild)): -"string"===typeof d.is?a=g.createElement(c,{is:d.is}):(a=g.createElement(c),"select"===c&&(g=a,d.multiple?g.multiple=!0:d.size&&(g.size=d.size))):a=g.createElementNS(a,c);a[Of]=b;a[Pf]=d;zj(a,b,!1,!1);b.stateNode=a;a:{g=vb(c,d);switch(c){case "dialog":D("cancel",a);D("close",a);e=d;break;case "iframe":case "object":case "embed":D("load",a);e=d;break;case "video":case "audio":for(e=0;eGj&&(b.flags|=128,d=!0,Dj(f,!1),b.lanes=4194304);}else {if(!d)if(a=Ch(g),null!==a){if(b.flags|=128,d=!0,c=a.updateQueue,null!==c&&(b.updateQueue=c,b.flags|=4),Dj(f,!0),null===f.tail&&"hidden"===f.tailMode&&!g.alternate&&!I)return S(b),null}else 2*B()-f.renderingStartTime>Gj&&1073741824!==c&&(b.flags|=128,d=!0,Dj(f,!1),b.lanes=4194304);f.isBackwards?(g.sibling=b.child,b.child=g):(c=f.last,null!==c?c.sibling=g:b.child=g,f.last=g);}if(null!==f.tail)return b=f.tail,f.rendering= -b,f.tail=b.sibling,f.renderingStartTime=B(),b.sibling=null,c=L.current,G(L,d?c&1|2:c&1),b;S(b);return null;case 22:case 23:return Hj(),d=null!==b.memoizedState,null!==a&&null!==a.memoizedState!==d&&(b.flags|=8192),d&&0!==(b.mode&1)?0!==(fj&1073741824)&&(S(b),b.subtreeFlags&6&&(b.flags|=8192)):S(b),null;case 24:return null;case 25:return null}throw Error(p(156,b.tag));} -function Ij(a,b){wg(b);switch(b.tag){case 1:return Zf(b.type)&&$f(),a=b.flags,a&65536?(b.flags=a&-65537|128,b):null;case 3:return zh(),E(Wf),E(H),Eh(),a=b.flags,0!==(a&65536)&&0===(a&128)?(b.flags=a&-65537|128,b):null;case 5:return Bh(b),null;case 13:E(L);a=b.memoizedState;if(null!==a&&null!==a.dehydrated){if(null===b.alternate)throw Error(p(340));Ig();}a=b.flags;return a&65536?(b.flags=a&-65537|128,b):null;case 19:return E(L),null;case 4:return zh(),null;case 10:return ah(b.type._context),null;case 22:case 23:return Hj(), -null;case 24:return null;default:return null}}var Jj=!1,U=!1,Kj="function"===typeof WeakSet?WeakSet:Set,V=null;function Lj(a,b){var c=a.ref;if(null!==c)if("function"===typeof c)try{c(null);}catch(d){W(a,b,d);}else c.current=null;}function Mj(a,b,c){try{c();}catch(d){W(a,b,d);}}var Nj=!1; -function Oj(a,b){Cf=dd;a=Me();if(Ne(a)){if("selectionStart"in a)var c={start:a.selectionStart,end:a.selectionEnd};else a:{c=(c=a.ownerDocument)&&c.defaultView||window;var d=c.getSelection&&c.getSelection();if(d&&0!==d.rangeCount){c=d.anchorNode;var e=d.anchorOffset,f=d.focusNode;d=d.focusOffset;try{c.nodeType,f.nodeType;}catch(F){c=null;break a}var g=0,h=-1,k=-1,l=0,m=0,q=a,r=null;b:for(;;){for(var y;;){q!==c||0!==e&&3!==q.nodeType||(h=g+e);q!==f||0!==d&&3!==q.nodeType||(k=g+d);3===q.nodeType&&(g+= -q.nodeValue.length);if(null===(y=q.firstChild))break;r=q;q=y;}for(;;){if(q===a)break b;r===c&&++l===e&&(h=g);r===f&&++m===d&&(k=g);if(null!==(y=q.nextSibling))break;q=r;r=q.parentNode;}q=y;}c=-1===h||-1===k?null:{start:h,end:k};}else c=null;}c=c||{start:0,end:0};}else c=null;Df={focusedElem:a,selectionRange:c};dd=!1;for(V=b;null!==V;)if(b=V,a=b.child,0!==(b.subtreeFlags&1028)&&null!==a)a.return=b,V=a;else for(;null!==V;){b=V;try{var n=b.alternate;if(0!==(b.flags&1024))switch(b.tag){case 0:case 11:case 15:break; -case 1:if(null!==n){var t=n.memoizedProps,J=n.memoizedState,x=b.stateNode,w=x.getSnapshotBeforeUpdate(b.elementType===b.type?t:Ci(b.type,t),J);x.__reactInternalSnapshotBeforeUpdate=w;}break;case 3:var u=b.stateNode.containerInfo;1===u.nodeType?u.textContent="":9===u.nodeType&&u.documentElement&&u.removeChild(u.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(p(163));}}catch(F){W(b,b.return,F);}a=b.sibling;if(null!==a){a.return=b.return;V=a;break}V=b.return;}n=Nj;Nj=!1;return n} -function Pj(a,b,c){var d=b.updateQueue;d=null!==d?d.lastEffect:null;if(null!==d){var e=d=d.next;do{if((e.tag&a)===a){var f=e.destroy;e.destroy=void 0;void 0!==f&&Mj(b,c,f);}e=e.next;}while(e!==d)}}function Qj(a,b){b=b.updateQueue;b=null!==b?b.lastEffect:null;if(null!==b){var c=b=b.next;do{if((c.tag&a)===a){var d=c.create;c.destroy=d();}c=c.next;}while(c!==b)}}function Rj(a){var b=a.ref;if(null!==b){var c=a.stateNode;switch(a.tag){case 5:a=c;break;default:a=c;}"function"===typeof b?b(a):b.current=a;}} -function Sj(a){var b=a.alternate;null!==b&&(a.alternate=null,Sj(b));a.child=null;a.deletions=null;a.sibling=null;5===a.tag&&(b=a.stateNode,null!==b&&(delete b[Of],delete b[Pf],delete b[of],delete b[Qf],delete b[Rf]));a.stateNode=null;a.return=null;a.dependencies=null;a.memoizedProps=null;a.memoizedState=null;a.pendingProps=null;a.stateNode=null;a.updateQueue=null;}function Tj(a){return 5===a.tag||3===a.tag||4===a.tag} -function Uj(a){a:for(;;){for(;null===a.sibling;){if(null===a.return||Tj(a.return))return null;a=a.return;}a.sibling.return=a.return;for(a=a.sibling;5!==a.tag&&6!==a.tag&&18!==a.tag;){if(a.flags&2)continue a;if(null===a.child||4===a.tag)continue a;else a.child.return=a,a=a.child;}if(!(a.flags&2))return a.stateNode}} -function Vj(a,b,c){var d=a.tag;if(5===d||6===d)a=a.stateNode,b?8===c.nodeType?c.parentNode.insertBefore(a,b):c.insertBefore(a,b):(8===c.nodeType?(b=c.parentNode,b.insertBefore(a,c)):(b=c,b.appendChild(a)),c=c._reactRootContainer,null!==c&&void 0!==c||null!==b.onclick||(b.onclick=Bf));else if(4!==d&&(a=a.child,null!==a))for(Vj(a,b,c),a=a.sibling;null!==a;)Vj(a,b,c),a=a.sibling;} -function Wj(a,b,c){var d=a.tag;if(5===d||6===d)a=a.stateNode,b?c.insertBefore(a,b):c.appendChild(a);else if(4!==d&&(a=a.child,null!==a))for(Wj(a,b,c),a=a.sibling;null!==a;)Wj(a,b,c),a=a.sibling;}var X=null,Xj=!1;function Yj(a,b,c){for(c=c.child;null!==c;)Zj(a,b,c),c=c.sibling;} -function Zj(a,b,c){if(lc&&"function"===typeof lc.onCommitFiberUnmount)try{lc.onCommitFiberUnmount(kc,c);}catch(h){}switch(c.tag){case 5:U||Lj(c,b);case 6:var d=X,e=Xj;X=null;Yj(a,b,c);X=d;Xj=e;null!==X&&(Xj?(a=X,c=c.stateNode,8===a.nodeType?a.parentNode.removeChild(c):a.removeChild(c)):X.removeChild(c.stateNode));break;case 18:null!==X&&(Xj?(a=X,c=c.stateNode,8===a.nodeType?Kf(a.parentNode,c):1===a.nodeType&&Kf(a,c),bd(a)):Kf(X,c.stateNode));break;case 4:d=X;e=Xj;X=c.stateNode.containerInfo;Xj=!0; -Yj(a,b,c);X=d;Xj=e;break;case 0:case 11:case 14:case 15:if(!U&&(d=c.updateQueue,null!==d&&(d=d.lastEffect,null!==d))){e=d=d.next;do{var f=e,g=f.destroy;f=f.tag;void 0!==g&&(0!==(f&2)?Mj(c,b,g):0!==(f&4)&&Mj(c,b,g));e=e.next;}while(e!==d)}Yj(a,b,c);break;case 1:if(!U&&(Lj(c,b),d=c.stateNode,"function"===typeof d.componentWillUnmount))try{d.props=c.memoizedProps,d.state=c.memoizedState,d.componentWillUnmount();}catch(h){W(c,b,h);}Yj(a,b,c);break;case 21:Yj(a,b,c);break;case 22:c.mode&1?(U=(d=U)||null!== -c.memoizedState,Yj(a,b,c),U=d):Yj(a,b,c);break;default:Yj(a,b,c);}}function ak(a){var b=a.updateQueue;if(null!==b){a.updateQueue=null;var c=a.stateNode;null===c&&(c=a.stateNode=new Kj);b.forEach(function(b){var d=bk.bind(null,a,b);c.has(b)||(c.add(b),b.then(d,d));});}} -function ck(a,b){var c=b.deletions;if(null!==c)for(var d=0;de&&(e=g);d&=~f;}d=e;d=B()-d;d=(120>d?120:480>d?480:1080>d?1080:1920>d?1920:3E3>d?3E3:4320>d?4320:1960*lk(d/1960))-d;if(10a?16:a;if(null===wk)var d=!1;else {a=wk;wk=null;xk=0;if(0!==(K&6))throw Error(p(331));var e=K;K|=4;for(V=a.current;null!==V;){var f=V,g=f.child;if(0!==(V.flags&16)){var h=f.deletions;if(null!==h){for(var k=0;kB()-fk?Kk(a,0):rk|=c);Dk(a,b);}function Yk(a,b){0===b&&(0===(a.mode&1)?b=1:(b=sc,sc<<=1,0===(sc&130023424)&&(sc=4194304)));var c=R();a=ih(a,b);null!==a&&(Ac(a,b,c),Dk(a,c));}function uj(a){var b=a.memoizedState,c=0;null!==b&&(c=b.retryLane);Yk(a,c);} -function bk(a,b){var c=0;switch(a.tag){case 13:var d=a.stateNode;var e=a.memoizedState;null!==e&&(c=e.retryLane);break;case 19:d=a.stateNode;break;default:throw Error(p(314));}null!==d&&d.delete(b);Yk(a,c);}var Vk; -Vk=function(a,b,c){if(null!==a)if(a.memoizedProps!==b.pendingProps||Wf.current)dh=!0;else {if(0===(a.lanes&c)&&0===(b.flags&128))return dh=!1,yj(a,b,c);dh=0!==(a.flags&131072)?!0:!1;}else dh=!1,I&&0!==(b.flags&1048576)&&ug(b,ng,b.index);b.lanes=0;switch(b.tag){case 2:var d=b.type;ij(a,b);a=b.pendingProps;var e=Yf(b,H.current);ch(b,c);e=Nh(null,b,d,a,e,c);var f=Sh();b.flags|=1;"object"===typeof e&&null!==e&&"function"===typeof e.render&&void 0===e.$$typeof?(b.tag=1,b.memoizedState=null,b.updateQueue= -null,Zf(d)?(f=!0,cg(b)):f=!1,b.memoizedState=null!==e.state&&void 0!==e.state?e.state:null,kh(b),e.updater=Ei,b.stateNode=e,e._reactInternals=b,Ii(b,d,a,c),b=jj(null,b,d,!0,f,c)):(b.tag=0,I&&f&&vg(b),Xi(null,b,e,c),b=b.child);return b;case 16:d=b.elementType;a:{ij(a,b);a=b.pendingProps;e=d._init;d=e(d._payload);b.type=d;e=b.tag=Zk(d);a=Ci(d,a);switch(e){case 0:b=cj(null,b,d,a,c);break a;case 1:b=hj(null,b,d,a,c);break a;case 11:b=Yi(null,b,d,a,c);break a;case 14:b=$i(null,b,d,Ci(d.type,a),c);break a}throw Error(p(306, -d,""));}return b;case 0:return d=b.type,e=b.pendingProps,e=b.elementType===d?e:Ci(d,e),cj(a,b,d,e,c);case 1:return d=b.type,e=b.pendingProps,e=b.elementType===d?e:Ci(d,e),hj(a,b,d,e,c);case 3:a:{kj(b);if(null===a)throw Error(p(387));d=b.pendingProps;f=b.memoizedState;e=f.element;lh(a,b);qh(b,d,null,c);var g=b.memoizedState;d=g.element;if(f.isDehydrated)if(f={element:d,isDehydrated:!1,cache:g.cache,pendingSuspenseBoundaries:g.pendingSuspenseBoundaries,transitions:g.transitions},b.updateQueue.baseState= -f,b.memoizedState=f,b.flags&256){e=Ji(Error(p(423)),b);b=lj(a,b,d,c,e);break a}else if(d!==e){e=Ji(Error(p(424)),b);b=lj(a,b,d,c,e);break a}else for(yg=Lf(b.stateNode.containerInfo.firstChild),xg=b,I=!0,zg=null,c=Vg(b,null,d,c),b.child=c;c;)c.flags=c.flags&-3|4096,c=c.sibling;else {Ig();if(d===e){b=Zi(a,b,c);break a}Xi(a,b,d,c);}b=b.child;}return b;case 5:return Ah(b),null===a&&Eg(b),d=b.type,e=b.pendingProps,f=null!==a?a.memoizedProps:null,g=e.children,Ef(d,e)?g=null:null!==f&&Ef(d,f)&&(b.flags|=32), -gj(a,b),Xi(a,b,g,c),b.child;case 6:return null===a&&Eg(b),null;case 13:return oj(a,b,c);case 4:return yh(b,b.stateNode.containerInfo),d=b.pendingProps,null===a?b.child=Ug(b,null,d,c):Xi(a,b,d,c),b.child;case 11:return d=b.type,e=b.pendingProps,e=b.elementType===d?e:Ci(d,e),Yi(a,b,d,e,c);case 7:return Xi(a,b,b.pendingProps,c),b.child;case 8:return Xi(a,b,b.pendingProps.children,c),b.child;case 12:return Xi(a,b,b.pendingProps.children,c),b.child;case 10:a:{d=b.type._context;e=b.pendingProps;f=b.memoizedProps; -g=e.value;G(Wg,d._currentValue);d._currentValue=g;if(null!==f)if(He(f.value,g)){if(f.children===e.children&&!Wf.current){b=Zi(a,b,c);break a}}else for(f=b.child,null!==f&&(f.return=b);null!==f;){var h=f.dependencies;if(null!==h){g=f.child;for(var k=h.firstContext;null!==k;){if(k.context===d){if(1===f.tag){k=mh(-1,c&-c);k.tag=2;var l=f.updateQueue;if(null!==l){l=l.shared;var m=l.pending;null===m?k.next=k:(k.next=m.next,m.next=k);l.pending=k;}}f.lanes|=c;k=f.alternate;null!==k&&(k.lanes|=c);bh(f.return, -c,b);h.lanes|=c;break}k=k.next;}}else if(10===f.tag)g=f.type===b.type?null:f.child;else if(18===f.tag){g=f.return;if(null===g)throw Error(p(341));g.lanes|=c;h=g.alternate;null!==h&&(h.lanes|=c);bh(g,c,b);g=f.sibling;}else g=f.child;if(null!==g)g.return=f;else for(g=f;null!==g;){if(g===b){g=null;break}f=g.sibling;if(null!==f){f.return=g.return;g=f;break}g=g.return;}f=g;}Xi(a,b,e.children,c);b=b.child;}return b;case 9:return e=b.type,d=b.pendingProps.children,ch(b,c),e=eh(e),d=d(e),b.flags|=1,Xi(a,b,d,c), -b.child;case 14:return d=b.type,e=Ci(d,b.pendingProps),e=Ci(d.type,e),$i(a,b,d,e,c);case 15:return bj(a,b,b.type,b.pendingProps,c);case 17:return d=b.type,e=b.pendingProps,e=b.elementType===d?e:Ci(d,e),ij(a,b),b.tag=1,Zf(d)?(a=!0,cg(b)):a=!1,ch(b,c),Gi(b,d,e),Ii(b,d,e,c),jj(null,b,d,!0,a,c);case 19:return xj(a,b,c);case 22:return dj(a,b,c)}throw Error(p(156,b.tag));};function Fk(a,b){return ac(a,b)} -function $k(a,b,c,d){this.tag=a;this.key=c;this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null;this.index=0;this.ref=null;this.pendingProps=b;this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null;this.mode=d;this.subtreeFlags=this.flags=0;this.deletions=null;this.childLanes=this.lanes=0;this.alternate=null;}function Bg(a,b,c,d){return new $k(a,b,c,d)}function aj(a){a=a.prototype;return !(!a||!a.isReactComponent)} -function Zk(a){if("function"===typeof a)return aj(a)?1:0;if(void 0!==a&&null!==a){a=a.$$typeof;if(a===Da)return 11;if(a===Ga)return 14}return 2} -function Pg(a,b){var c=a.alternate;null===c?(c=Bg(a.tag,b,a.key,a.mode),c.elementType=a.elementType,c.type=a.type,c.stateNode=a.stateNode,c.alternate=a,a.alternate=c):(c.pendingProps=b,c.type=a.type,c.flags=0,c.subtreeFlags=0,c.deletions=null);c.flags=a.flags&14680064;c.childLanes=a.childLanes;c.lanes=a.lanes;c.child=a.child;c.memoizedProps=a.memoizedProps;c.memoizedState=a.memoizedState;c.updateQueue=a.updateQueue;b=a.dependencies;c.dependencies=null===b?null:{lanes:b.lanes,firstContext:b.firstContext}; -c.sibling=a.sibling;c.index=a.index;c.ref=a.ref;return c} -function Rg(a,b,c,d,e,f){var g=2;d=a;if("function"===typeof a)aj(a)&&(g=1);else if("string"===typeof a)g=5;else a:switch(a){case ya:return Tg(c.children,e,f,b);case za:g=8;e|=8;break;case Aa:return a=Bg(12,c,b,e|2),a.elementType=Aa,a.lanes=f,a;case Ea:return a=Bg(13,c,b,e),a.elementType=Ea,a.lanes=f,a;case Fa:return a=Bg(19,c,b,e),a.elementType=Fa,a.lanes=f,a;case Ia:return pj(c,e,f,b);default:if("object"===typeof a&&null!==a)switch(a.$$typeof){case Ba:g=10;break a;case Ca:g=9;break a;case Da:g=11; -break a;case Ga:g=14;break a;case Ha:g=16;d=null;break a}throw Error(p(130,null==a?a:typeof a,""));}b=Bg(g,c,b,e);b.elementType=a;b.type=d;b.lanes=f;return b}function Tg(a,b,c,d){a=Bg(7,a,d,b);a.lanes=c;return a}function pj(a,b,c,d){a=Bg(22,a,d,b);a.elementType=Ia;a.lanes=c;a.stateNode={isHidden:!1};return a}function Qg(a,b,c){a=Bg(6,a,null,b);a.lanes=c;return a} -function Sg(a,b,c){b=Bg(4,null!==a.children?a.children:[],a.key,b);b.lanes=c;b.stateNode={containerInfo:a.containerInfo,pendingChildren:null,implementation:a.implementation};return b} -function al(a,b,c,d,e){this.tag=b;this.containerInfo=a;this.finishedWork=this.pingCache=this.current=this.pendingChildren=null;this.timeoutHandle=-1;this.callbackNode=this.pendingContext=this.context=null;this.callbackPriority=0;this.eventTimes=zc(0);this.expirationTimes=zc(-1);this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0;this.entanglements=zc(0);this.identifierPrefix=d;this.onRecoverableError=e;this.mutableSourceEagerHydrationData= -null;}function bl(a,b,c,d,e,f,g,h,k){a=new al(a,b,c,h,k);1===b?(b=1,!0===f&&(b|=8)):b=0;f=Bg(3,null,null,b);a.current=f;f.stateNode=a;f.memoizedState={element:d,isDehydrated:c,cache:null,transitions:null,pendingSuspenseBoundaries:null};kh(f);return a}function cl(a,b,c){var d=3{ - dynamicLoadingCss([], false, './CareLivekit'); - return __federation_import('./__federation_expose_CareLivekit-0971ad60.js').then(module =>Object.keys(module).every(item => exportSet.has(item)) ? () => module.default : () => module)},}; +"./DoctorLiveConnect":()=>{ + dynamicLoadingCss(["style-42c466ea.css"], false, './DoctorLiveConnect'); + return __federation_import('./__federation_expose_DoctorLiveConnect-268a1a7a.js').then(module =>Object.keys(module).every(item => exportSet.has(item)) ? () => module.default : () => module)}, +"./DoctorConnectButtons":()=>{ + dynamicLoadingCss(["style-42c466ea.css"], false, './DoctorConnectButtons'); + return __federation_import('./__federation_expose_DoctorConnectButtons-a308ad42.js').then(module =>Object.keys(module).every(item => exportSet.has(item)) ? () => module.default : () => module)}, +"./manifest":()=>{ + dynamicLoadingCss(["style-42c466ea.css"], false, './manifest'); + return __federation_import('./__federation_expose_Manifest-2987f25b.js').then(module =>Object.keys(module).every(item => exportSet.has(item)) ? () => module.default : () => module)},}; const seen = {}; const dynamicLoadingCss = (cssFilePaths, dontAppendStylesToHead, exposeItemName) => { const metaUrl = import.meta.url; diff --git a/dist/index.html b/dist/index.html deleted file mode 100644 index 0844b50..0000000 --- a/dist/index.html +++ /dev/null @@ -1,73 +0,0 @@ - - - - - - CARE LiveKit Microfrontend - - - -
-

CARE LiveKit Microfrontend

- -
- ⚠️ This is a microfrontend module and cannot be used as a standalone application. -
- -

- This repository contains the LiveKit video conferencing microfrontend for the CARE platform. - It is designed to be integrated with the main CARE application. -

- -

- To use this module, please visit the main CARE application at - github.com/ohcnetwork/care_fe -

- -

Technical Details

-

- This microfrontend is built using: -

    -
  • Vite
  • -
  • Module Federation
  • -
  • LiveKit SDK
  • -
  • React
  • -
  • TypeScript
  • -
-

-
- - \ No newline at end of file diff --git a/index.html b/index.html deleted file mode 100644 index 0844b50..0000000 --- a/index.html +++ /dev/null @@ -1,73 +0,0 @@ - - - - - - CARE LiveKit Microfrontend - - - -
-

CARE LiveKit Microfrontend

- -
- ⚠️ This is a microfrontend module and cannot be used as a standalone application. -
- -

- This repository contains the LiveKit video conferencing microfrontend for the CARE platform. - It is designed to be integrated with the main CARE application. -

- -

- To use this module, please visit the main CARE application at - github.com/ohcnetwork/care_fe -

- -

Technical Details

-

- This microfrontend is built using: -

    -
  • Vite
  • -
  • Module Federation
  • -
  • LiveKit SDK
  • -
  • React
  • -
  • TypeScript
  • -
-

-
- - \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 798ba02..bb1be1b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11,8 +11,7 @@ "dependencies": { "@livekit/components-react": "^2.6.2", "@livekit/components-styles": "^1.1.3", - "livekit-client": "^2.5.5", - "raviger": "^4.1.2" + "livekit-client": "^2.5.5" }, "devDependencies": { "@originjs/vite-plugin-federation": "^1.3.6", @@ -93,6 +92,15 @@ "url": "https://opencollective.com/babel" } }, + "node_modules/@babel/core/node_modules/semver": { + "version": "6.3.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", + "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", + "dev": true, + "bin": { + "semver": "bin/semver.js" + } + }, "node_modules/@babel/generator": { "version": "7.26.2", "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.26.2.tgz", @@ -125,6 +133,15 @@ "node": ">=6.9.0" } }, + "node_modules/@babel/helper-compilation-targets/node_modules/semver": { + "version": "6.3.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", + "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", + "dev": true, + "bin": { + "semver": "bin/semver.js" + } + }, "node_modules/@babel/helper-module-imports": { "version": "7.25.9", "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.25.9.tgz", @@ -705,6 +722,18 @@ "node": ">=6.0.0" } }, + "node_modules/@jridgewell/source-map": { + "version": "0.3.6", + "resolved": "https://registry.npmjs.org/@jridgewell/source-map/-/source-map-0.3.6.tgz", + "integrity": "sha512-1ZJTZebgqllO79ue2bm3rIGud/bOe0pP5BjSRCRxxYkEZS8STV7zN84UBbiYu7jy+eCKSnVIUgoWWE/tt+shMQ==", + "dev": true, + "optional": true, + "peer": true, + "dependencies": { + "@jridgewell/gen-mapping": "^0.3.5", + "@jridgewell/trace-mapping": "^0.3.25" + } + }, "node_modules/@jridgewell/sourcemap-codec": { "version": "1.5.0", "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.0.tgz", @@ -722,9 +751,9 @@ } }, "node_modules/@livekit/components-core": { - "version": "0.11.10", - "resolved": "https://registry.npmjs.org/@livekit/components-core/-/components-core-0.11.10.tgz", - "integrity": "sha512-PvFlKq1W64b9GfFjG7L4/o7ulAl5yFFpDTvG+JHQiXkaPaecMPt/qPbs6zdvUlC7om1TGMuW/pIN7o585Xz9Fg==", + "version": "0.11.9", + "resolved": "https://registry.npmjs.org/@livekit/components-core/-/components-core-0.11.9.tgz", + "integrity": "sha512-LPE1BZ+YTaqsVqGy/GAlpiO5rEI8XpEaf1TQcGdZN1BCBas9hTHt7/aHMbHQJ0K5xuAFQx8is6dFe451T4qXIQ==", "dependencies": { "@floating-ui/dom": "1.6.11", "loglevel": "1.9.1", @@ -739,11 +768,11 @@ } }, "node_modules/@livekit/components-react": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/@livekit/components-react/-/components-react-2.6.9.tgz", - "integrity": "sha512-j43i/Dm8dlI2jxv5wv0s+69QPVqVEjg0y2tyznfs/7RDcaIZsIIzNijPu1kLditerzvzQdRsOgFQ3UWONcTkGA==", + "version": "2.6.5", + "resolved": "https://registry.npmjs.org/@livekit/components-react/-/components-react-2.6.5.tgz", + "integrity": "sha512-G3BpBlKy+lWTV9MH3/oBTBC17Z8CWqZ9GnjcG/xmYI0IvqmY89tVWph7cj2Bq0taniA+mD3U9EMPr68fOb1m1g==", "dependencies": { - "@livekit/components-core": "0.11.10", + "@livekit/components-core": "0.11.9", "clsx": "2.1.1", "usehooks-ts": "3.1.0" }, @@ -764,22 +793,17 @@ } }, "node_modules/@livekit/components-styles": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/@livekit/components-styles/-/components-styles-1.1.4.tgz", - "integrity": "sha512-QCupn7tQ/dy/WZclrfsgtDe8peiGYS6Ied1IGkKOysaXo04l90t62SIUTKyxgd0dNDhUDC0p34qCggGZs/44lQ==", + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/@livekit/components-styles/-/components-styles-1.1.3.tgz", + "integrity": "sha512-ddWskAoELHLaR0aiTDAASmym7+ggrEmZEOSvyVDt2ueUJIuayDOH8JMmLYmzVp5++dgE8o14ZmSeMYUPuaH1Ag==", "engines": { "node": ">=18" } }, - "node_modules/@livekit/mutex": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/@livekit/mutex/-/mutex-1.0.0.tgz", - "integrity": "sha512-aiUhoThBNF9UyGTxEURFzJLhhPLIVTnQiEVMjRhPnfHNKLfo2JY9xovHKIus7B78UD5hsP6DlgpmAsjrz4U0Iw==" - }, "node_modules/@livekit/protocol": { - "version": "1.24.0", - "resolved": "https://registry.npmjs.org/@livekit/protocol/-/protocol-1.24.0.tgz", - "integrity": "sha512-9dCsqnkMn7lvbI4NGh18zhLDsrXyUcpS++TEFgEk5Xv1WM3R2kT3EzqgL1P/mr3jaabM6rJ8wZA/KJLuQNpF5w==", + "version": "1.23.0", + "resolved": "https://registry.npmjs.org/@livekit/protocol/-/protocol-1.23.0.tgz", + "integrity": "sha512-Hh83moW437mWhiyRgoDMedJ/s/rCTfe3ACSaIJ3n2NlVaq/+BTuB/yH7a6alM1NEkGBSmgrEHxabDfozVUlgYg==", "dependencies": { "@bufbuild/protobuf": "^1.10.0" } @@ -804,6 +828,17 @@ "integrity": "sha512-AYnb1nQyY49te+VRAVgmzfcgjYS91mY5P0TKUDCLEM+gNnA+3T6rWITXRLYCpahpqSQbN5cE+gHpnPyXjHWxcw==", "dev": true }, + "node_modules/@types/node": { + "version": "22.7.4", + "resolved": "https://registry.npmjs.org/@types/node/-/node-22.7.4.tgz", + "integrity": "sha512-y+NPi1rFzDs1NdQHHToqeiX2TIS79SWEAw9GYhkkx8bD0ChpfqC+n2j5OXOCpzfojBEBt6DnEnnG9MY0zk1XLg==", + "dev": true, + "optional": true, + "peer": true, + "dependencies": { + "undici-types": "~6.19.2" + } + }, "node_modules/@types/prop-types": { "version": "15.7.13", "resolved": "https://registry.npmjs.org/@types/prop-types/-/prop-types-15.7.13.tgz", @@ -848,10 +883,24 @@ "vite": "^4.1.0-beta.0" } }, + "node_modules/acorn": { + "version": "8.12.1", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.12.1.tgz", + "integrity": "sha512-tcpGyI9zbizT9JbV6oYE477V6mTlXvvi0T0G3SNIYE2apm/G5huBa1+K89VGeovbg+jycCrfhl3ADxErOuO6Jg==", + "dev": true, + "optional": true, + "peer": true, + "bin": { + "acorn": "bin/acorn" + }, + "engines": { + "node": ">=0.4.0" + } + }, "node_modules/browserslist": { - "version": "4.24.2", - "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.24.2.tgz", - "integrity": "sha512-ZIc+Q62revdMcqC6aChtW4jz3My3klmCO1fEmINZY/8J3EpBg5/A/D0AKmBveUh6pgoeycoMkVMko84tuYS+Gg==", + "version": "4.24.0", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.24.0.tgz", + "integrity": "sha512-Rmb62sR1Zpjql25eSanFGEhAxcFwfA1K0GuQcLoaJBAcENegrQut3hYdhXFF1obQfiDyqIW/cLM5HSJ/9k884A==", "dev": true, "funding": [ { @@ -868,10 +917,10 @@ } ], "dependencies": { - "caniuse-lite": "^1.0.30001669", - "electron-to-chromium": "^1.5.41", + "caniuse-lite": "^1.0.30001663", + "electron-to-chromium": "^1.5.28", "node-releases": "^2.0.18", - "update-browserslist-db": "^1.1.1" + "update-browserslist-db": "^1.1.0" }, "bin": { "browserslist": "cli.js" @@ -880,10 +929,18 @@ "node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7" } }, + "node_modules/buffer-from": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz", + "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==", + "dev": true, + "optional": true, + "peer": true + }, "node_modules/caniuse-lite": { - "version": "1.0.30001683", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001683.tgz", - "integrity": "sha512-iqmNnThZ0n70mNwvxpEC2nBJ037ZHZUoBI5Gorh1Mw6IlEAZujEoU1tXA628iZfzm7R9FvFzxbfdgml82a3k8Q==", + "version": "1.0.30001667", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001667.tgz", + "integrity": "sha512-7LTwJjcRkzKFmtqGsibMeuXmvFDfZq/nzIjnmgCGzKKRVzjD72selLDK1oPF/Oxzmt4fNcPvTDvGqSDG4tCALw==", "dev": true, "funding": [ { @@ -908,6 +965,14 @@ "node": ">=6" } }, + "node_modules/commander": { + "version": "2.20.3", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", + "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==", + "dev": true, + "optional": true, + "peer": true + }, "node_modules/convert-source-map": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-2.0.0.tgz", @@ -938,9 +1003,9 @@ } }, "node_modules/electron-to-chromium": { - "version": "1.5.64", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.64.tgz", - "integrity": "sha512-IXEuxU+5ClW2IGEYFC2T7szbyVgehupCWQe5GNh+H065CD6U6IFN0s4KeAMFGNmQolRU4IV7zGBWSYMmZ8uuqQ==", + "version": "1.5.32", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.32.tgz", + "integrity": "sha512-M+7ph0VGBQqqpTT2YrabjNKSQ2fEl9PVx6AK3N558gDH9NO8O6XN9SXXFWRo9u9PbEg/bWq+tjXQr+eXmxubCw==", "dev": true }, "node_modules/esbuild": { @@ -1068,12 +1133,11 @@ } }, "node_modules/livekit-client": { - "version": "2.6.3", - "resolved": "https://registry.npmjs.org/livekit-client/-/livekit-client-2.6.3.tgz", - "integrity": "sha512-sUFjdERYdazGmYUCkxV46qKrL8Pg4Aw+9fs/DxV0EC/YtVd7zQh2QObip7IkyT8Ipj4gXhH8CkSinisZ1KpsJQ==", + "version": "2.5.7", + "resolved": "https://registry.npmjs.org/livekit-client/-/livekit-client-2.5.7.tgz", + "integrity": "sha512-g15/e9J9eZStQM4B7dgUP7eLAKbqJYh37n8IkR9n0M4/1ZxkyPgVvxkaooPNxp9C0Ri6cefN5uHNbyyXWUJOVw==", "dependencies": { - "@livekit/mutex": "1.0.0", - "@livekit/protocol": "1.24.0", + "@livekit/protocol": "1.23.0", "events": "^3.3.0", "loglevel": "^1.8.0", "sdp-transform": "^2.14.1", @@ -1083,11 +1147,6 @@ "webrtc-adapter": "^9.0.0" } }, - "node_modules/livekit-client/node_modules/tslib": { - "version": "2.7.0", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.7.0.tgz", - "integrity": "sha512-gLXCKdN1/j47AiHiOkJN69hJmcbGTHI0ImLmbYLHykhgeN0jVGola9yVjFgzCUklsZQMW55o+dW7IXv3RCXDzA==" - }, "node_modules/lodash.debounce": { "version": "4.0.8", "resolved": "https://registry.npmjs.org/lodash.debounce/-/lodash.debounce-4.0.8.tgz", @@ -1126,6 +1185,12 @@ "yallist": "^3.0.2" } }, + "node_modules/lru-cache/node_modules/yallist": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz", + "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==", + "dev": true + }, "node_modules/magic-string": { "version": "0.27.0", "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.27.0.tgz", @@ -1169,15 +1234,15 @@ "dev": true }, "node_modules/picocolors": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz", - "integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==", + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.0.tgz", + "integrity": "sha512-TQ92mBOW0l3LeMeyLV6mzy/kWr8lkd/hp3mTg7wYK7zJhuBStmGMBG0BdeDZS/dZx1IukaX6Bk11zcln25o1Aw==", "dev": true }, "node_modules/postcss": { - "version": "8.4.49", - "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.49.tgz", - "integrity": "sha512-OCVPnIObs4N29kxTjzLfUryOkvZEq+pf8jTF0lg8E7uETuWHA+v7j3c/xJmiqpX450191LlmZfUKkXxkTry7nA==", + "version": "8.4.47", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.47.tgz", + "integrity": "sha512-56rxCq7G/XfB4EkXq9Egn5GCqugWvDFjafDOThIdMBsI15iqPqR5r15TfSr1YPYeEI19YeaXMCbY6u88Y76GLQ==", "dev": true, "funding": [ { @@ -1195,24 +1260,13 @@ ], "dependencies": { "nanoid": "^3.3.7", - "picocolors": "^1.1.1", + "picocolors": "^1.1.0", "source-map-js": "^1.2.1" }, "engines": { "node": "^10 || ^12 || >=14" } }, - "node_modules/raviger": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/raviger/-/raviger-4.1.2.tgz", - "integrity": "sha512-w5SodiqNhlFLl5zpvZxICdT+ORM+b0YI6w0jlJJS/yzOM1MRIN1nGQvOzds/tWKrN0V1vUBzttkEv7djHQUMdA==", - "engines": { - "node": ">=12" - }, - "peerDependencies": { - "react": "^16.8.0 || ^17.0.0 || ^18.0.0" - } - }, "node_modules/react": { "version": "18.3.1", "resolved": "https://registry.npmjs.org/react/-/react-18.3.1.tgz", @@ -1293,13 +1347,15 @@ "sdp-verify": "checker.js" } }, - "node_modules/semver": { - "version": "6.3.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", - "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", + "node_modules/source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", "dev": true, - "bin": { - "semver": "bin/semver.js" + "optional": true, + "peer": true, + "engines": { + "node": ">=0.10.0" } }, "node_modules/source-map-js": { @@ -1311,15 +1367,47 @@ "node": ">=0.10.0" } }, + "node_modules/source-map-support": { + "version": "0.5.21", + "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.21.tgz", + "integrity": "sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w==", + "dev": true, + "optional": true, + "peer": true, + "dependencies": { + "buffer-from": "^1.0.0", + "source-map": "^0.6.0" + } + }, + "node_modules/terser": { + "version": "5.34.1", + "resolved": "https://registry.npmjs.org/terser/-/terser-5.34.1.tgz", + "integrity": "sha512-FsJZ7iZLd/BXkz+4xrRTGJ26o/6VTjQytUk8b8OxkwcD2I+79VPJlz7qss1+zE7h8GNIScFqXcDyJ/KqBYZFVA==", + "dev": true, + "optional": true, + "peer": true, + "dependencies": { + "@jridgewell/source-map": "^0.3.3", + "acorn": "^8.8.2", + "commander": "^2.20.0", + "source-map-support": "~0.5.20" + }, + "bin": { + "terser": "bin/terser" + }, + "engines": { + "node": ">=10" + } + }, "node_modules/ts-debounce": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/ts-debounce/-/ts-debounce-4.0.0.tgz", "integrity": "sha512-+1iDGY6NmOGidq7i7xZGA4cm8DAa6fqdYcvO5Z6yBevH++Bdo9Qt/mN0TzHUgcCcKv1gmh9+W5dHqz8pMWbCbg==" }, "node_modules/tslib": { - "version": "2.8.1", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz", - "integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==" + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.7.0.tgz", + "integrity": "sha512-gLXCKdN1/j47AiHiOkJN69hJmcbGTHI0ImLmbYLHykhgeN0jVGola9yVjFgzCUklsZQMW55o+dW7IXv3RCXDzA==" }, "node_modules/typed-emitter": { "version": "2.1.0", @@ -1342,6 +1430,14 @@ "node": ">=4.2.0" } }, + "node_modules/undici-types": { + "version": "6.19.8", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.19.8.tgz", + "integrity": "sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw==", + "dev": true, + "optional": true, + "peer": true + }, "node_modules/update-browserslist-db": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.1.1.tgz", @@ -1452,12 +1548,6 @@ "node": ">=6.0.0", "npm": ">=3.10.0" } - }, - "node_modules/yallist": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz", - "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==", - "dev": true } } } diff --git a/package.json b/package.json index 2a29af2..4c22b1a 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,6 @@ "version": "0.0.1", "description": "", "main": "index.js", - "homepage": "https://ohcnetwork.github.io/care_livekit_fe/", "scripts": { "start": "vite build --watch & vite preview --port 5173", "build": "vite build", @@ -14,8 +13,7 @@ "dependencies": { "@livekit/components-react": "^2.6.2", "@livekit/components-styles": "^1.1.3", - "livekit-client": "^2.5.5", - "raviger": "^4.1.2" + "livekit-client": "^2.5.5" }, "peerDependencies": { "react": "18.3.1", diff --git a/src/api/README.md b/src/api/README.md deleted file mode 100644 index ca3e223..0000000 --- a/src/api/README.md +++ /dev/null @@ -1,144 +0,0 @@ -# CARE's data fetching utilities: `useQuery` and `request` - -There are two main ways to fetch data in CARE: `useQuery` and `request`. Both of these utilities are built on top of [fetch](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API/Using_Fetch). - -## `useQuery` - -`useQuery` is a React hook that allows you to fetch data and automatically update the UI when the data changes. It is -a wrapper around `request` that is designed to be used in React components. Only "GET" requests are supported with `useQuery`. For other request methods (mutations), use `request`. - -### Usage - -```jsx -import { useQuery } from "@care/request"; -import FooRoutes from "@foo/routes"; - -export default function FooDetails({ children, id }) { - const { res, data, loading, error } = useQuery(FooRoutes.getFoo, { - pathParams: { id }, - }); - - /* 🪄 Here typeof data is automatically inferred from the specified route. */ - - if (loading) return ; - - if (res.status === 403) { - navigate("/forbidden"); - return null; - } - - if (error) { - return ; - } - - return ( -
- {data.id} - {data.name} -
- ); -} -``` - -### API - -```ts -useQuery(route: Route, options?: QueryOptions): ReturnType; -``` - -#### `route` - -A route object that specifies the endpoint to fetch data from. - -```ts -const FooRoutes = { - getFoo: { - path: "/api/v1/foo/{id}/", // 👈 The path to the endpoint. Slug parameters can be specified using curly braces. - - method: "GET", // 👈 The HTTP method to use. Optional; defaults to "GET". - TRes: Type(), // 👈 The type of the response body (for type inference). - TBody: Type(), // 👈 The type of the request body (for type inference). - noAuth: true, // 👈 Whether to skip adding the Authorization header to the request. - }, -} as const; // 👈 This is important for type inference to work properly. -``` - -#### `options` - -An object that specifies options for the request. - -```ts -const options = { - prefetch: true, // 👈 Whether to prefetch the data when the component mounts. - refetchOnWindowFocus: true, // 👈 Whether to refetch the data when the window regains focus. - - // The following options are passed directly to the underlying `request` function. - - pathParams: { id: "123" }, // 👈 The slug parameters to use in the path. - // If you accidentally forget to specify a slug parameter an error will be - // thrown before the request is made. - - query: { limit: 10 }, // 👈 The query parameters to be added to the request URL. - body: { name: "foo" }, // 👈 The body to be sent with the request. Should be compatible with the TBody type of the route. - headers: { "X-Foo": "bar" }, // 👈 Additional headers to be sent with the request. (Coming soon...) - - silent: true, // 👈 Whether to suppress notifications for this request. - // This is useful for requests that are made in the background. - - reattempts: 3, // 👈 The number of times to retry the request if it fails. - // Reattempts are only made if the request fails due to a network error. Responses with - // status codes in the 400s and 500s are not retried. - - onResponse: (res) => { - // 👈 An optional callback that is called after the response is received. - if (res.status === 403) { - navigate("/forbidden"); - } - }, - // This is useful for handling responses with status codes in the 400s and 500s for a specific request. -}; -``` - -#### `ReturnType` - -The `useQuery` hook returns an object with the following properties: - -```ts -{ - res: Type | undefined; // 👈 The response object. `undefined` if the request has not been made yet. - - data: TRes | null; // 👈 The response body. `null` if the request has not been made yet. - - error: any; // 👈 The error that occurred while making the request if any. - - loading: boolean; // 👈 Whether the request is currently in progress. - - refetch: () => void; // 👈 A function that can be called to refetch the data. - // Ideal for revalidating stale data after a mutation. -} -``` - -## `request` - -`request` is a function that allows you to fetch data. It is a wrapper around `fetch` that adds some useful features. It can be used in both React components and non-React code. For fetching data in React components, prefer using `useQuery`. For mutations, use `request`. - -### `request` usage - -```ts -import { request } from "@care/request"; -import FooRoutes from "@foo/routes"; - -export default async function updateFoo(id: string, object: Foo) { - const { res, data } = await request(FooRoutes.updateFoo, { - pathParams: { id }, - body: object, // 👈 The body is automatically serialized to JSON. Should be compatible with the TBody type of the route. - }); - - if (res.status === 403) { - navigate("/forbidden"); - return null; - } - - return data; -} -``` diff --git a/src/api/api.tsx b/src/api/api.tsx index 2e8ff55..320d63d 100644 --- a/src/api/api.tsx +++ b/src/api/api.tsx @@ -1,46 +1,4 @@ -/** - * A fake function that returns an empty object casted to type T - * @returns Empty object as type T - */ -export function Type(): T { - return {} as T; -} - -export interface JwtTokenObtainPair { - access: string; - refresh: string; -} - -export const USER_TYPE_OPTIONS = [ - { id: "Pharmacist", role: "Pharmacist", readOnly: false }, - { id: "Volunteer", role: "Volunteer", readOnly: false }, - { id: "StaffReadOnly", role: "Staff", readOnly: true }, - { id: "Staff", role: "Staff", readOnly: false }, - // { id: "NurseReadOnly", role: "Nurse", readOnly: true }, - { id: "Nurse", role: "Nurse", readOnly: false }, - { id: "Doctor", role: "Doctor", readOnly: false }, - { id: "WardAdmin", role: "Ward Admin", readOnly: false }, - { id: "LocalBodyAdmin", role: "Local Body Admin", readOnly: false }, - { id: "DistrictLabAdmin", role: "District Lab Admin", readOnly: false }, - { id: "DistrictReadOnlyAdmin", role: "District Admin", readOnly: true }, - { id: "DistrictAdmin", role: "District Admin", readOnly: false }, - { id: "StateLabAdmin", role: "State Lab Admin", readOnly: false }, - { id: "StateReadOnlyAdmin", role: "State Admin", readOnly: true }, - { id: "StateAdmin", role: "State Admin", readOnly: false }, -] as const; - -export type UserRole = (typeof USER_TYPE_OPTIONS)[number]["id"]; - -export type UserBareMinimum = { - id: number; - username: string; - first_name: string; - last_name: string; - email: string; - user_type: UserRole; - last_login: string | undefined; - read_profile_picture_url?: string; -}; +import { Type } from "@/Utils/request/api"; export interface LiveKitTokenRequest { source: string; @@ -54,12 +12,6 @@ export interface LiveKitTokenResponse { } const routes = { - // User Endpoints - currentUser: { - path: "/api/v1/users/getcurrentuser/", - TRes: Type(), - }, - // Livekit Endpoints livekit: { create_room: { path: "/api/care_livekit/create_room/", diff --git a/src/api/request.ts b/src/api/request.ts deleted file mode 100644 index 730b53e..0000000 --- a/src/api/request.ts +++ /dev/null @@ -1,104 +0,0 @@ -import careConfig from "@careConfig"; - -import handleResponse from "@/api/handleResponse"; -import { RequestOptions, RequestResult, Route } from "@/api/types"; -import { makeHeaders, makeUrl } from "@/api/utils"; - -type ControllerXORControllerRef = - | { - controller?: AbortController; - controllerRef?: undefined; - } - | { - controller?: undefined; - controllerRef: React.MutableRefObject; - }; - -type Options = RequestOptions & - ControllerXORControllerRef; - -export default async function request( - { path, method, noAuth }: Route, - { - query, - body, - pathParams, - controller, - controllerRef, - onResponse, - silent, - reattempts = 3, - }: Options = {} -): Promise> { - if (controllerRef) { - controllerRef.current?.abort(); - controllerRef.current = new AbortController(); - } - - const signal = controller?.signal ?? controllerRef?.current?.signal; - const url = `${careConfig.apiUrl}${makeUrl(path, query, pathParams)}`; - - const options: RequestInit = { method, signal }; - - if (body) { - options.body = JSON.stringify(body); - } - - let result: RequestResult = { - res: undefined, - data: undefined, - error: undefined, - }; - - for (let i = 0; i < reattempts + 1; i++) { - options.headers = makeHeaders(noAuth ?? false); - - try { - const res = await fetch(url, options); - - const data = await getResponseBody(res); - - result = { - res, - data: res.ok ? data : undefined, - error: res.ok ? undefined : (data as Record), - }; - - onResponse?.(result); - handleResponse(result, silent); - - return result; - } catch (error: any) { - result = { error, res: undefined, data: undefined }; - } - } - - console.error( - `Request failed after ${reattempts + 1} attempts`, - result.error - ); - return result; -} - -async function getResponseBody(res: Response): Promise { - if (!(res.headers.get("content-length") !== "0")) { - return null as TData; - } - - const isJson = res.headers.get("content-type")?.includes("application/json"); - const isImage = res.headers.get("content-type")?.includes("image"); - - if (isImage) { - return (await res.blob()) as TData; - } - - if (!isJson) { - return (await res.text()) as TData; - } - - try { - return await res.json(); - } catch { - return (await res.text()) as TData; - } -} diff --git a/src/api/types.ts b/src/api/types.ts deleted file mode 100644 index aed066a..0000000 --- a/src/api/types.ts +++ /dev/null @@ -1,44 +0,0 @@ -type QueryParamValue = string | number | boolean | null | undefined; - -export type QueryParams = Record; - -interface RouteBase { - path: string; - TRes: TData; - noAuth?: boolean; -} - -export interface QueryRoute extends RouteBase { - method?: "GET"; -} - -export interface MutationRoute extends RouteBase { - method: "POST" | "PUT" | "PATCH" | "DELETE"; - TBody?: TBody; -} - -export type Route = - | QueryRoute - | MutationRoute; - -export interface RequestResult { - res: Response | undefined; - data: TData | undefined; - error: undefined | Record; -} - -export interface RequestOptions { - query?: QueryParams; - body?: TBody; - pathParams?: Record; - onResponse?: (res: RequestResult) => void; - silent?: boolean; - reattempts?: number; -} - -export interface PaginatedResponse { - count: number; - next: string | null; - previous: string | null; - results: TItem[]; -} diff --git a/src/api/useMutation.ts b/src/api/useMutation.ts deleted file mode 100644 index 6be494a..0000000 --- a/src/api/useMutation.ts +++ /dev/null @@ -1,38 +0,0 @@ -import React from "react"; - -import request from "@/api/request"; -import { MutationRoute, RequestOptions, RequestResult } from "@/api/types"; -import { mergeRequestOptions } from "@/api/utils"; - -export default function useMutation( - route: MutationRoute, - options: RequestOptions -) { - const [response, setResponse] = React.useState>(); - const [isProcessing, setIsProcessing] = React.useState(false); - - const controllerRef = React.useRef(); - - const runQuery = React.useCallback( - async (overrides?: RequestOptions) => { - controllerRef.current?.abort(); - - const controller = new AbortController(); - controllerRef.current = controller; - - const resolvedOptions = - options && overrides - ? mergeRequestOptions(options, overrides) - : overrides ?? options; - - setIsProcessing(true); - const response = await request(route, { ...resolvedOptions, controller }); - setResponse(response); - setIsProcessing(false); - return response; - }, - [route, JSON.stringify(options)] - ); - - return { ...response, isProcessing, mutate: runQuery }; -} diff --git a/src/api/useQuery.ts b/src/api/useQuery.ts deleted file mode 100644 index c42abe7..0000000 --- a/src/api/useQuery.ts +++ /dev/null @@ -1,60 +0,0 @@ -import { useCallback, useEffect, useRef, useState } from "react"; - -import request from "@/api/request"; -import { QueryRoute, RequestOptions, RequestResult } from "@/api/types"; -import { mergeRequestOptions } from "@/api/utils"; - -export interface QueryOptions extends RequestOptions { - prefetch?: boolean; - refetchOnWindowFocus?: boolean; - key?: string; -} - -export default function useQuery( - route: QueryRoute, - options?: QueryOptions -) { - const [response, setResponse] = useState>(); - const [loading, setLoading] = useState(false); - - const controllerRef = useRef(); - - const runQuery = useCallback( - async (overrides?: QueryOptions) => { - controllerRef.current?.abort(); - - const controller = new AbortController(); - controllerRef.current = controller; - - const resolvedOptions = - options && overrides - ? mergeRequestOptions(options, overrides) - : overrides ?? options; - - setLoading(true); - const response = await request(route, { ...resolvedOptions, controller }); - setResponse(response); - setLoading(false); - return response; - }, - [route, JSON.stringify(options)] - ); - - useEffect(() => { - if (options?.prefetch ?? true) { - runQuery(); - } - }, [runQuery, options?.prefetch]); - - useEffect(() => { - if (options?.refetchOnWindowFocus) { - const onFocus = () => runQuery(); - - window.addEventListener("focus", onFocus); - - return () => window.removeEventListener("focus", onFocus); - } - }, [runQuery, options?.refetchOnWindowFocus]); - - return { ...response, loading, refetch: runQuery }; -} diff --git a/src/api/utils.ts b/src/api/utils.ts deleted file mode 100644 index d9cad9f..0000000 --- a/src/api/utils.ts +++ /dev/null @@ -1,110 +0,0 @@ -import { Dispatch, SetStateAction } from "react"; - -import { LocalStorageKeys } from "@/common/constants"; - -import { QueryParams, RequestOptions } from "@/api/types"; - -export function makeUrl( - path: string, - query?: QueryParams, - pathParams?: Record -) { - if (pathParams) { - path = Object.entries(pathParams).reduce( - (acc, [key, value]) => acc.replace(`{${key}}`, `${value}`), - path - ); - } - - ensurePathNotMissingReplacements(path); - - if (query) { - path += `?${makeQueryParams(query)}`; - } - - return path; -} - -const makeQueryParams = (query: QueryParams) => { - const qParams = new URLSearchParams(); - - Object.entries(query).forEach(([key, value]) => { - if (value !== undefined) { - qParams.set(key, `${value}`); - } - }); - - return qParams.toString(); -}; - -const ensurePathNotMissingReplacements = (path: string) => { - const missingParams = path.match(/\{.*\}/g); - - if (missingParams) { - const msg = `Missing path params: ${missingParams.join( - ", " - )}. Path: ${path}`; - Notification.Error({ msg }); - throw new Error(msg); - } -}; - -export function makeHeaders(noAuth: boolean) { - const headers = new Headers({ - "Content-Type": "application/json", - Accept: "application/json", - }); - - if (!noAuth) { - const token = getAuthorizationHeader(); - - if (token) { - headers.append("Authorization", token); - } - } - - return headers; -} - -export function getAuthorizationHeader() { - const bearerToken = localStorage.getItem(LocalStorageKeys.accessToken); - - if (bearerToken) { - return `Bearer ${bearerToken}`; - } - - return null; -} - -export function mergeRequestOptions( - options: RequestOptions, - overrides: RequestOptions -): RequestOptions { - return { - ...options, - ...overrides, - - query: { ...options.query, ...overrides.query }, - body: (options.body || overrides.body) && { - ...(options.body ?? {}), - ...(overrides.body ?? {}), - }, - pathParams: { ...options.pathParams, ...overrides.pathParams }, - - onResponse: (res) => { - options.onResponse?.(res); - overrides.onResponse?.(res); - }, - silent: overrides.silent ?? options.silent, - }; -} - -export function handleUploadPercentage( - event: ProgressEvent, - setUploadPercent: Dispatch> -) { - if (event.lengthComputable) { - const percentComplete = Math.round((event.loaded / event.total) * 100); - setUploadPercent(percentComplete); - } -} diff --git a/src/common/constants.ts b/src/common/constants.ts deleted file mode 100644 index 3715f5d..0000000 --- a/src/common/constants.ts +++ /dev/null @@ -1,1719 +0,0 @@ -import { IconName } from "@/CAREUI/icons/CareIcon"; - -import { SortOption } from "@/components/Common/SortDropdown"; -import { - PatientCategory, - SpokeRelationship, -} from "@/components/Facility/models"; -import { PhoneNumberValidator } from "@/components/Form/FieldValidators"; - -import { dateQueryString } from "@/Utils/utils"; - -import { SchemaType } from "./schemaParser"; - -export const RESULTS_PER_PAGE_LIMIT = 14; -export const PAGINATION_LIMIT = 36; - -/** - * Contains local storage keys that are potentially used in multiple places. - */ -export const LocalStorageKeys = { - accessToken: "care_access_token", - refreshToken: "care_refresh_token", -}; -export interface OptionsType { - id: number | string; - text: string; - label?: string; - desc?: string; - disabled?: boolean; -} - -export const USER_TYPE_OPTIONS = [ - { id: "Pharmacist", role: "Pharmacist", readOnly: false }, - { id: "Volunteer", role: "Volunteer", readOnly: false }, - { id: "StaffReadOnly", role: "Staff", readOnly: true }, - { id: "Staff", role: "Staff", readOnly: false }, - // { id: "NurseReadOnly", role: "Nurse", readOnly: true }, - { id: "Nurse", role: "Nurse", readOnly: false }, - { id: "Doctor", role: "Doctor", readOnly: false }, - { id: "WardAdmin", role: "Ward Admin", readOnly: false }, - { id: "LocalBodyAdmin", role: "Local Body Admin", readOnly: false }, - { id: "DistrictLabAdmin", role: "District Lab Admin", readOnly: false }, - { id: "DistrictReadOnlyAdmin", role: "District Admin", readOnly: true }, - { id: "DistrictAdmin", role: "District Admin", readOnly: false }, - { id: "StateLabAdmin", role: "State Lab Admin", readOnly: false }, - { id: "StateReadOnlyAdmin", role: "State Admin", readOnly: true }, - { id: "StateAdmin", role: "State Admin", readOnly: false }, -] as const; - -export const USER_LAST_ACTIVE_OPTIONS = [ - { id: 1, text: "24 hours" }, - { id: 7, text: "7 days" }, - { id: 30, text: "30 days" }, - { id: 90, text: "90 days" }, - { id: 365, text: "1 Year" }, - { id: "never", text: "Never" }, -]; - -export type UserRole = (typeof USER_TYPE_OPTIONS)[number]["id"]; - -export const USER_TYPES = USER_TYPE_OPTIONS.map((o) => o.id); - -export const DOWNLOAD_TYPES: Array = [ - "Facility List", - "Facility Capacity List", - "Facility Doctors List", - "Facility Triage Data", -]; - -export const TEST_TYPE_CHOICES: Array = [ - { id: 10, text: "UNK" }, - { id: 20, text: "ANTIGEN" }, - { id: 30, text: "RTPCR" }, - { id: 40, text: "CBNAAT" }, - { id: 50, text: "TRUENAT" }, - { id: 60, text: "RTLAMP" }, - { id: 70, text: "POCPCR" }, -]; - -export const DISTRICT_CHOICES: Array = [ - { id: 1, text: "Thiruvananthapuram" }, - { id: 2, text: "Kollam" }, - { id: 3, text: "Pathanamthitta" }, - { id: 4, text: "Alappuzha" }, - { id: 5, text: "Kottayam" }, - { id: 6, text: "Idukki" }, - { id: 7, text: "Ernakulam" }, - { id: 8, text: "Thrissur" }, - { id: 9, text: "Palakkad" }, - { id: 10, text: "Malappuram" }, - { id: 11, text: "Kozhikode" }, - { id: 12, text: "Wayanad" }, - { id: 13, text: "Kannur" }, - { id: 14, text: "Kasaragod" }, -]; - -export const VEHICLE_TYPES: Array = [ - { id: 1, text: "Basic" }, - { id: 2, text: "Cardiac" }, - { id: 3, text: "Hearse" }, -]; - -export const FACILITY_TYPES: Array = [ - // { id: 1, text: "Educational Inst" }, - // { id: 4, text: "Hostel" }, - // { id: 5, text: "Hotel" }, - // { id: 6, text: "Lodge" }, - { id: 800, text: "Primary Health Centres" }, - { id: 802, text: "Family Health Centres" }, - { id: 803, text: "Community Health Centres" }, - { id: 840, text: "Women and Child Health Centres" }, - { id: 830, text: "Taluk Hospitals" }, - { id: 860, text: "District Hospitals" }, - { id: 870, text: "Govt Medical College Hospitals" }, - { id: 9, text: "Govt Labs" }, - { id: 10, text: "Private Labs" }, - { id: 7, text: "TeleMedicine" }, - { id: 2, text: "Private Hospital" }, - { id: 910, text: "Autonomous healthcare facility" }, - { id: 1300, text: "Shifting Centre" }, - { id: 1500, text: "Request Approving Center" }, - { id: 1510, text: "Request Fulfilment Center" }, - { id: 3, text: "Other" }, - - // { id: 8, text: "Govt Hospital" }, - // { id: 801, text: "24x7 Public Health Centres" }, - // { id: 820, text: "Urban Primary Health Center" }, - // { id: 831, text: "Taluk Headquarters Hospitals" }, - // { id: 850, text: "General hospitals" }, - - // { id: 900, text: "Co-operative hospitals" }, - - // { id: 950, text: "Corona Testing Labs" }, - // { id: 1000, text: "Corona Care Centre" }, - - // { id: 1010, text: "COVID-19 Domiciliary Care Center" }, - // { id: 1100, text: "First Line Treatment Centre" }, - // { id: 1200, text: "Second Line Treatment Center" }, - // { id: 1400, text: "Covid Management Center" }, - // { id: 1600, text: "District War Room" }, -]; - -export const SHIFTING_CHOICES_WARTIME: Array = [ - { id: 10, text: "PENDING", label: "SHIFTING APPROVAL PENDING" }, - { id: 15, text: "ON HOLD" }, - { id: 20, text: "APPROVED" }, - { id: 30, text: "REJECTED" }, - { id: 40, text: "DESTINATION APPROVED" }, - { id: 50, text: "DESTINATION REJECTED" }, - { id: 55, text: "TRANSPORTATION TO BE ARRANGED" }, - { id: 60, text: "PATIENT TO BE PICKED UP" }, - { id: 70, text: "TRANSFER IN PROGRESS" }, - { id: 80, text: "COMPLETED" }, - { id: 90, text: "PATIENT EXPIRED" }, - { id: 100, text: "CANCELLED" }, -]; - -export const SHIFTING_CHOICES_PEACETIME: Array = [ - { id: 20, text: "APPROVED", label: "PATIENTS TO BE SHIFTED" }, - { id: 40, text: "DESTINATION APPROVED" }, - // { id: 50, text: "DESTINATION REJECTED" }, - { id: 60, text: "PATIENT TO BE PICKED UP", label: "TRANSPORTATION ARRANGED" }, - { id: 70, text: "TRANSFER IN PROGRESS" }, - { id: 80, text: "COMPLETED" }, - { id: 90, text: "PATIENT EXPIRED" }, - { id: 100, text: "CANCELLED" }, -]; - -export const SHIFTING_VEHICLE_CHOICES: Array = [ - { id: 10, text: "D Level Ambulance" }, - { id: 20, text: "All double chambered Ambulance with EMT" }, - { id: 30, text: "Ambulance without EMT" }, - { id: 50, text: "Car" }, - { id: 50, text: "Auto-rickshaw" }, -]; - -export const SHIFTING_FILTER_ORDER: Array = [ - { id: 1, text: "created_date", desc: "ASC Created Date" }, - { id: 2, text: "-created_date", desc: "DESC Created Date" }, - { id: 3, text: "modified_date", desc: "ASC Modified Date" }, - { id: 4, text: "-modified_date", desc: "DESC Modified Date" }, -]; - -export const PATIENT_SORT_OPTIONS: SortOption[] = [ - { isAscending: false, value: "-created_date" }, - { isAscending: true, value: "created_date" }, - { isAscending: false, value: "-category_severity" }, - { isAscending: true, value: "category_severity" }, - { isAscending: false, value: "-modified_date" }, - { isAscending: true, value: "modified_date" }, - { - isAscending: true, - value: "facility__name,last_consultation__current_bed__bed__name", - }, - { - isAscending: false, - value: "facility__name,-last_consultation__current_bed__bed__name", - }, - { isAscending: false, value: "-review_time" }, - { isAscending: true, value: "review_time" }, - { isAscending: true, value: "name" }, - { isAscending: false, value: "-name" }, -]; - -export const EVENTS_SORT_OPTIONS: SortOption[] = [ - { isAscending: false, value: "-created_date" }, - { isAscending: true, value: "created_date" }, - { isAscending: false, value: "-taken_at" }, - { isAscending: true, value: "taken_at" }, -]; - -export const DISCHARGED_PATIENT_SORT_OPTIONS: SortOption[] = [ - { isAscending: false, value: "-created_date" }, - { isAscending: true, value: "created_date" }, - { isAscending: false, value: "-modified_date" }, - { isAscending: true, value: "modified_date" }, - { isAscending: true, value: "name" }, - { isAscending: false, value: "-name" }, -]; - -export const BED_TYPES = [100, 200, 300, 400, 500]; - -export const DOCTOR_SPECIALIZATION: Array = [ - { id: 1, text: "General Medicine" }, - { id: 2, text: "Pulmonology" }, - { id: 3, text: "Intensivist" }, - { id: 4, text: "Pediatrician" }, - { id: 6, text: "Anesthesiologist" }, - { id: 7, text: "Cardiac Surgeon" }, - { id: 8, text: "Cardiologist" }, - { id: 9, text: "Dentist" }, - { id: 10, text: "Dermatologist" }, - { id: 11, text: "Diabetologist" }, - { id: 12, text: "Emergency Medicine Physician" }, - { id: 13, text: "Endocrinologist" }, - { id: 14, text: "Family Physician" }, - { id: 15, text: "Gastroenterologist" }, - { id: 16, text: "General Surgeon" }, - { id: 17, text: "Geriatrician" }, - { id: 18, text: "Hematologist" }, - { id: 19, text: "Immunologist" }, - { id: 20, text: "Infectious Disease Specialist" }, - { id: 21, text: "MBBS doctor" }, - { id: 22, text: "Medical Officer" }, - { id: 23, text: "Nephrologist" }, - { id: 24, text: "Neuro Surgeon" }, - { id: 25, text: "Neurologist" }, - { id: 26, text: "Obstetrician and Gynecologist" }, - { id: 27, text: "Oncologist" }, - { id: 28, text: "Oncology Surgeon" }, - { id: 29, text: "Ophthalmologist" }, - { - id: 30, - text: "Oral and Maxillofacial Surgeon", - }, - { id: 31, text: "Orthopedic" }, - { id: 32, text: "Orthopedic Surgeon" }, - { id: 33, text: "Otolaryngologist (ENT)" }, - { id: 34, text: "Palliative care Physician" }, - { id: 35, text: "Pathologist" }, - { id: 36, text: "Pediatric Surgeon" }, - { id: 37, text: "Physician" }, - { id: 38, text: "Plastic Surgeon" }, - { id: 39, text: "Psychiatrist" }, - { id: 40, text: "Pulmonologist" }, - { id: 41, text: "Radio technician" }, - { id: 42, text: "Radiologist" }, - { id: 43, text: "Rheumatologist" }, - { id: 44, text: "Sports Medicine Specialist" }, - { id: 45, text: "Thoraco-Vascular Surgeon" }, - { - id: 46, - text: "Transfusion Medicine Specialist", - }, - { id: 47, text: "Urologist" }, - { id: 48, text: "Nurse" }, - { id: 5, text: "Others" }, -]; - -export const MEDICAL_HISTORY_CHOICES: Array = [ - { id: 1, text: "NO" }, - { id: 2, text: "Diabetes" }, - { id: 3, text: "Heart Disease" }, - { id: 4, text: "HyperTension" }, - { id: 5, text: "Kidney Diseases" }, - { id: 6, text: "Lung Diseases/Asthma" }, - { id: 7, text: "Cancer" }, - { id: 8, text: "OTHER" }, -]; - -export const REVIEW_AT_CHOICES: Array = [ - { id: -1, text: "No Review" }, - { id: 10, text: "10 mins" }, - { id: 15, text: "15 mins" }, - { id: 30, text: "30 mins" }, - { id: 60, text: "1 hr" }, - { id: 2 * 60, text: "2 hr" }, - { id: 3 * 60, text: "3 hr" }, - { id: 4 * 60, text: "4 hr" }, - { id: 6 * 60, text: "6 hr" }, - { id: 8 * 60, text: "8 hr" }, - { id: 12 * 60, text: "12 hr" }, - { id: 24 * 60, text: "24 hr" }, - { id: 36 * 60, text: "36 hr" }, - { id: 2 * 24 * 60, text: "2 days" }, - { id: 3 * 24 * 60, text: "3 days" }, - { id: 5 * 24 * 60, text: "5 days" }, - { id: 7 * 24 * 60, text: "7 days" }, - { id: 10 * 24 * 60, text: "10 days" }, - { id: 14 * 24 * 60, text: "2 weeks" }, - { id: 21 * 24 * 60, text: "3 weeks" }, - { id: 25 * 24 * 60, text: "25 days" }, - { id: 30 * 24 * 60, text: "1 month" }, -]; - -export const DISCHARGE_REASONS = [ - { id: 1, text: "Recovered" }, - { id: 2, text: "Referred" }, - { id: 3, text: "Expired" }, - { id: 4, text: "LAMA" }, -] as const; - -export const CONSCIOUSNESS_LEVEL = [ - { id: 20, value: "UNRESPONSIVE" }, - { id: 15, value: "RESPONDS_TO_PAIN" }, - { id: 10, value: "RESPONDS_TO_VOICE" }, - { id: 5, value: "ALERT" }, - { id: 25, value: "AGITATED_OR_CONFUSED" }, - { - id: 30, - value: "ONSET_OF_AGITATION_AND_CONFUSION", - }, -] as const; - -export const PUPIL_REACTION_OPTIONS = [ - { id: 0, value: "UNKNOWN" }, - { id: 5, value: "BRISK" }, - { id: 10, value: "SLUGGISH" }, - { id: 15, value: "FIXED" }, - { id: 20, value: "CANNOT_BE_ASSESSED" }, -] as const; - -export const LIMB_RESPONSE_OPTIONS = [ - { id: 0, value: "UNKNOWN" }, - { id: 5, value: "STRONG" }, - { id: 10, value: "MODERATE" }, - { id: 15, value: "WEAK" }, - { id: 20, value: "FLEXION" }, - { id: 25, value: "EXTENSION" }, - { id: 30, value: "NONE" }, -] as const; - -export const OXYGEN_MODALITY_OPTIONS = [ - { value: "NASAL_PRONGS" }, - { value: "SIMPLE_FACE_MASK" }, - { value: "NON_REBREATHING_MASK" }, - { value: "HIGH_FLOW_NASAL_CANNULA" }, -] as const; - -export const GENDER_TYPES = [ - { id: 1, text: "Male", icon: "M" }, - { id: 2, text: "Female", icon: "F" }, - { id: 3, text: "Transgender", icon: "TRANS" }, -] as const; - -export const SAMPLE_TEST_RESULT = [ - { id: 1, text: "POSITIVE" }, - { id: 2, text: "NEGATIVE" }, - { id: 3, text: "AWAITING" }, - { id: 4, text: "INVALID" }, -]; - -export const CONSULTATION_SUGGESTION = [ - { id: "HI", text: "Home Isolation", deprecated: true }, // # Deprecated. Preserving option for backward compatibility (use only for readonly operations) - { id: "A", text: "Admission" }, - { id: "R", text: "Refer to another Hospital", editDisabled: true }, - { id: "OP", text: "OP Consultation" }, - { id: "DC", text: "Domiciliary Care" }, - { id: "DD", text: "Declare Death", editDisabled: true }, -] as const; - -export type ConsultationSuggestionValue = - (typeof CONSULTATION_SUGGESTION)[number]["id"]; - -export const ADMITTED_TO = [ - { id: "1", text: "Isolation" }, - { id: "2", text: "ICU" }, - { id: "6", text: "Bed with oxygen support" }, - { id: "7", text: "Regular" }, - { id: "None", text: "No bed assigned" }, -]; - -export const RESPIRATORY_SUPPORT = [ - { id: "NIV", value: "NON_INVASIVE" }, - { id: "IV", value: "INVASIVE" }, - { id: "O2", value: "OXYGEN_SUPPORT" }, - { id: "NONE", value: "UNKNOWN" }, -] as const; - -export const VENTILATOR_MODE_OPTIONS = [ - "VCV", - "PCV", - "PRVC", - "APRV", - "VC_SIMV", - "PC_SIMV", - "PRVC_SIMV", - "ASV", - "PSV", -] as const; - -export const INSULIN_INTAKE_FREQUENCY_OPTIONS = [ - "UNKNOWN", - "OD", - "BD", - "TD", -] as const; - -export type PatientCategoryID = - | "Comfort" - | "Stable" - | "Moderate" - | "Critical" - | "ActivelyDying"; - -export const PATIENT_CATEGORIES: { - id: PatientCategoryID; - text: PatientCategory; - description: string; - twClass: string; -}[] = [ - { - id: "Comfort", // Comfort Care is discontinued - text: "Comfort Care", - twClass: "patient-comfort", - description: "End of life care", - }, - { - id: "Stable", - text: "Mild", - twClass: "patient-stable", - description: "Urgent: not life-threatening", - }, - { - id: "Moderate", - text: "Moderate", - twClass: "patient-abnormal", - description: "Emergency: could be life-threatening", - }, - { - id: "Critical", - text: "Critical", - twClass: "patient-critical", - description: "Immediate: life-threatening", - }, - { - id: "ActivelyDying", - text: "Actively Dying", - twClass: "patient-activelydying", - description: "", - }, -]; - -export const PATIENT_FILTER_CATEGORIES = PATIENT_CATEGORIES; - -export const SAMPLE_TEST_STATUS = [ - { id: 1, text: "REQUEST_SUBMITTED", desc: "Request Submitted" }, - { id: 2, text: "APPROVED", desc: "Approved for Sample Collection" }, - { id: 3, text: "DENIED", desc: "Request Denied" }, - { - id: 4, - text: "SENT_TO_COLLECTON_CENTRE", - desc: "Sample taken and sent to collection centre", - }, - { id: 5, text: "RECEIVED_AND_FORWARED", desc: "Received And Forwarded" }, - { id: 6, text: "RECEIVED_AT_LAB", desc: "Received At Lab" }, - { id: 7, text: "COMPLETED", desc: "Test Completed" }, -]; - -export const SAMPLE_FLOW_RULES = { - REQUEST_SUBMITTED: ["APPROVED", "DENIED"], - APPROVED: [ - "SENT_TO_COLLECTON_CENTRE", - "RECEIVED_AND_FORWARED", - "RECEIVED_AT_LAB", - "COMPLETED", - ], - DENIED: ["REQUEST_SUBMITTED"], - SENT_TO_COLLECTON_CENTRE: [ - "RECEIVED_AND_FORWARED", - "RECEIVED_AT_LAB", - "COMPLETED", - ], - RECEIVED_AND_FORWARED: ["RECEIVED_AT_LAB", "COMPLETED"], - RECEIVED_AT_LAB: ["COMPLETED"], -}; - -export const TEST_TYPE = [ - "UNK", - "ANTIGEN", - "RTPCR", - "CBNAAT", - "TRUENAT", - "RTLAMP", - "POCPCR", -]; - -export const VACCINES = [ - "CoviShield", - "Covaxin", - "Sputnik", - "Moderna", - "Pfizer", - "Janssen", - "Sinovac", -]; - -export const BLOOD_GROUPS = [ - "UNK", - "A+", - "A-", - "B+", - "B-", - "AB+", - "AB-", - "O+", - "O-", -]; - -export const SAMPLE_TYPE_CHOICES = [ - { id: "0", text: "UNKNOWN" }, - { id: "1", text: "BA/ETA" }, - { id: "2", text: "TS/NPS/NS" }, - { id: "3", text: "Blood in EDTA" }, - { id: "4", text: "Acute Sera" }, - { id: "5", text: "Covalescent sera" }, - { id: "6", text: "Biopsy" }, - { id: "7", text: "AMR" }, - { id: "8", text: "Communicable Diseases" }, - { id: "9", text: "OTHER TYPE" }, -]; - -export const ICMR_CATEGORY = [ - "Cat 0", - "Cat 1", - "Cat 2", - "Cat 3", - "Cat 4", - "Cat 5a", - "Cat 5b", -]; - -export const TELEMEDICINE_ACTIONS = [ - { id: 10, text: "NO_ACTION", desc: "No Action" }, - { id: 20, text: "PENDING", desc: "Pending" }, - { id: 30, text: "SPECIALIST_REQUIRED", desc: "Specialist Required" }, - { id: 40, text: "PLAN_FOR_HOME_CARE", desc: "Plan for Home Care" }, - { id: 50, text: "FOLLOW_UP_NOT_REQUIRED", desc: "Follow Up Not Required" }, - { id: 60, text: "COMPLETE", desc: "Complete" }, - { id: 70, text: "REVIEW", desc: "Review" }, - { id: 80, text: "NOT_REACHABLE", desc: "Not Reachable" }, - { id: 90, text: "DISCHARGE_RECOMMENDED", desc: "Discharge Recommended" }, -]; - -export const FRONTLINE_WORKER = [ - "NOT APPLICABLE", - "HEALTHCARE WORKER", - "ELECTED REPRESENTATIVE", - "POLICE OFFICER", - "REVENUE OFFICIAL", - "TEACHER", - "FIRE FORCE", - "ANGNAWADI WORKER", - "KUDUMBASREE", - "VOLUNTEER", - "SUPERVISOR", -]; - -export const DESIGNATION_HEALTH_CARE_WORKER = [ - "AMBULANCE DRIVER", - "ASHA", - "ATTENDER", - "CLEANING STAFF", - "CSSD STAFF", - "ANEASTHESIA TECHNICHIAN", - "DIALYSIS TECHNICIAN", - "DIETICIAN", - "DOCTOR", - "FIELD STAFF", - "LAB ASSISTANT", - "LAB TECHNICIAN", - "NURSING ASSISTANT", - "OFFICE STAFF", - "PALLIATIVE NURSE", - "PHARMACIST", - "PHYSICIAN ASSISTANT", - "PHYSIOTHERAPIST", - "PSYCHOLOGIST", - "RADIOLOGY TECHNICIAN", - "SECURITY STAFF", - "SONOLOGIST", - "STAFF NURSE", - "OTHERS", -]; - -type NotificationEvent = { - id: string; - text: string; - icon: IconName; -}; - -export const NOTIFICATION_EVENTS: NotificationEvent[] = [ - { id: "MESSAGE", text: "Notice", icon: "l-comment-alt-message" }, - { - id: "PATIENT_CREATED", - text: "Patient Created", - icon: "l-user-plus", - }, - { - id: "PATIENT_UPDATED", - text: "Patient Updated", - icon: "l-edit", - }, - { - id: "PATIENT_CONSULTATION_CREATED", - text: "Patient Consultation Created", - icon: "l-heart", - }, - { - id: "PATIENT_CONSULTATION_UPDATED", - text: "Patient Consultation Updated", - icon: "l-heart-medical", - }, - { - id: "INVESTIGATION_SESSION_CREATED", - text: "Investigation Session Created", - icon: "l-search", - }, - { - id: "INVESTIGATION_UPDATED", - text: "Investigation Updated", - icon: "l-search-plus", - }, - { - id: "PATIENT_FILE_UPLOAD_CREATED", - text: "Patient File Upload Created", - icon: "l-file-medical", - }, - { - id: "CONSULTATION_FILE_UPLOAD_CREATED", - text: "Consultation File Upload Created", - icon: "l-file-upload", - }, - { - id: "PATIENT_CONSULTATION_UPDATE_CREATED", - text: "Patient Log Update Created", - icon: "l-heart", - }, - { - id: "PATIENT_CONSULTATION_UPDATE_UPDATED", - text: "Patient Log Update Updated", - icon: "l-heart-medical", - }, - { - id: "SHIFTING_UPDATED", - text: "Shifting Updated", - icon: "l-ambulance", - }, - { - id: "PATIENT_NOTE_ADDED", - text: "Patient Note Added", - icon: "l-notes", - }, -]; - -export const BREATHLESSNESS_LEVEL = [ - "NOT BREATHLESS", - "MILD", - "MODERATE", - "SEVERE", -]; - -export const RESOURCE_CATEGORY_CHOICES = ["OXYGEN"]; - -export const RESOURCE_CHOICES: Array = [ - { id: 10, text: "PENDING" }, - { id: 15, text: "ON HOLD" }, - { id: 20, text: "APPROVED" }, - { id: 30, text: "REJECTED" }, - { id: 55, text: "TRANSPORTATION TO BE ARRANGED" }, - { id: 70, text: "TRANSFER IN PROGRESS" }, - { id: 80, text: "COMPLETED" }, -]; -export const RESOURCE_SUBCATEGORIES: Array = [ - { id: 110, text: "LMO in KL" }, - { id: 120, text: "B TYPE OXYGEN CYLINDER" }, - { id: 130, text: "C TYPE OXYGEN CYLINDER" }, - { id: 140, text: "JUMBO D TYPE OXYGEN CYLINDER" }, - { id: 1000, text: "UNSPECIFIED" }, -]; - -export const RESOURCE_FILTER_ORDER: Array = [ - { id: 1, text: "created_date", desc: "ASC Created Date" }, - { id: 2, text: "-created_date", desc: "DESC Created Date" }, - { id: 3, text: "modified_date", desc: "ASC Modified Date" }, - { id: 4, text: "-modified_date", desc: "DESC Modified Date" }, -]; - -export const HEARTBEAT_RHYTHM_CHOICES = [ - "REGULAR", - "IRREGULAR", - "UNKNOWN", -] as const; - -export const NURSING_CARE_PROCEDURES = [ - "oral_care", - "hair_care", - "bed_bath", - "eye_care", - "perineal_care", - "skin_care", - "pre_enema", - "wound_dressing", - "lymphedema_care", - "ascitic_tapping", - "colostomy_care", - "colostomy_change", - "personal_hygiene", - "positioning", - "suctioning", - "ryles_tube_care", - "ryles_tube_change", - "iv_sitecare", - "nubulisation", - "dressing", - "dvt_pump_stocking", - "restrain", - "chest_tube_care", - "tracheostomy_care", - "tracheostomy_tube_change", - "stoma_care", - "catheter_care", - "catheter_change", -] as const; - -export const EYE_OPEN_SCALE = [ - { value: 1, text: "No Response" }, - { value: 2, text: "To Pain" }, - { value: 3, text: "To Speech" }, - { value: 4, text: "Spontaneous" }, -]; - -export const VERBAL_RESPONSE_SCALE = [ - { value: 1, text: "No Response" }, - { value: 2, text: "Incomprehensible words/Moans to pain" }, - { value: 3, text: "Inappropriate words/Cry to Pain" }, - { value: 4, text: "Confused/Irritable" }, - { value: 5, text: "Oriented to Time, Place and Person" }, -]; - -export const MOTOR_RESPONSE_SCALE = [ - { value: 1, text: "No Response" }, - { value: 2, text: "Abnormal Extension(decerebrate)" }, - { value: 3, text: "Abnormal Flexion(decorticate)" }, - { value: 4, text: "Flexion/Withdrawal from pain" }, - { value: 5, text: "Moves to localized pain" }, - { value: 6, text: "Obeying commands/Normal acrivity" }, -]; - -export const RHYTHM_CHOICES = [ - { id: 5, text: "REGULAR", desc: "Regular" }, - { id: 10, text: "IRREGULAR", desc: "Irregular" }, -] as const; - -export const BOWEL_ISSUE_CHOICES = [ - "NO_DIFFICULTY", - "CONSTIPATION", - "DIARRHOEA", -] as const; - -export const BLADDER_DRAINAGE_CHOICES = [ - "NORMAL", - "CONDOM_CATHETER", - "DIAPER", - "INTERMITTENT_CATHETER", - "CONTINUOUS_INDWELLING_CATHETER", - "CONTINUOUS_SUPRAPUBIC_CATHETER", - "UROSTOMY", -] as const; - -export const BLADDER_ISSUE_CHOICES = [ - "NO_ISSUES", - "INCONTINENCE", - "RETENTION", - "HESITANCY", -] as const; - -export const URINATION_FREQUENCY_CHOICES = [ - "NORMAL", - "DECREASED", - "INCREASED", -] as const; - -export const SLEEP_CHOICES = [ - "EXCESSIVE", - "SATISFACTORY", - "UNSATISFACTORY", - "NO_SLEEP", -] as const; - -export const NUTRITION_ROUTE_CHOICES = [ - "ORAL", - "RYLES_TUBE", - "GASTROSTOMY_OR_JEJUNOSTOMY", - "PEG", - "PARENTERAL_TUBING_FLUID", - "PARENTERAL_TUBING_TPN", -] as const; - -export const ORAL_ISSUE_CHOICES = [ - "NO_ISSUE", - "DYSPHAGIA", - "ODYNOPHAGIA", -] as const; - -export const APPETITE_CHOICES = [ - "INCREASED", - "SATISFACTORY", - "REDUCED", - "NO_TASTE_FOR_FOOD", - "CANNOT_BE_ASSESSED", -] as const; - -export const LOCATION_BED_TYPES = [ - { id: "ISOLATION", name: "Isolation" }, - { id: "ICU", name: "ICU" }, - { id: "BED_WITH_OXYGEN_SUPPORT", name: "Bed with oxygen support" }, - { id: "REGULAR", name: "Regular" }, -] as const; - -export type CameraPTZ = { - icon?: IconName; - label: string; - action: string; - loadingLabel?: string; - shortcutKey: string[]; - value?: number; -}; - -export const CAMERA_STATES = { - IDLE: "idle", - MOVING: { - GENERIC: "Moving", - UP: "Moving Up", - DOWN: "Moving Down", - LEFT: "Moving Left", - RIGHT: "Moving Right", - }, - ZOOMING: { - IN: "Zooming In", - OUT: "Zooming Out", - }, - PRECISION: "Setting Precision", - UPDATING_PRESET: "Updating Preset", -}; - -export const getCameraPTZ: (precision: number) => CameraPTZ[] = (precision) => [ - { - icon: "l-angle-up", - label: "Move Up", - action: "up", - loadingLabel: CAMERA_STATES.MOVING.UP, - shortcutKey: ["Control", "Shift", "ArrowUp"], - }, - { - icon: "l-angle-down", - label: "Move Down", - action: "down", - loadingLabel: CAMERA_STATES.MOVING.DOWN, - shortcutKey: ["Control", "Shift", "ArrowDown"], - }, - { - icon: "l-angle-left", - label: "Move Left", - action: "left", - loadingLabel: CAMERA_STATES.MOVING.LEFT, - shortcutKey: ["Control", "Shift", "ArrowLeft"], - }, - { - icon: "l-angle-right", - label: "Move Right", - action: "right", - loadingLabel: CAMERA_STATES.MOVING.RIGHT, - shortcutKey: ["Control", "Shift", "ArrowRight"], - }, - { - value: precision, - label: "Precision", - action: "precision", - loadingLabel: CAMERA_STATES.PRECISION, - shortcutKey: ["Shift", "P"], - }, - { - icon: "l-search-plus", - label: "Zoom In", - action: "zoomIn", - loadingLabel: CAMERA_STATES.ZOOMING.IN, - shortcutKey: ["Shift", "I"], - }, - { - icon: "l-search-minus", - label: "Zoom Out", - action: "zoomOut", - loadingLabel: CAMERA_STATES.ZOOMING.OUT, - shortcutKey: ["Shift", "O"], - }, - { - icon: "l-save", - label: "Update Preset", - action: "updatePreset", - loadingLabel: CAMERA_STATES.UPDATING_PRESET, - shortcutKey: ["Shift", "S"], - }, - { - icon: "l-redo", - label: "Reset", - action: "reset", - shortcutKey: ["Shift", "R"], - }, - { - icon: "l-expand-arrows-alt", - label: "Full Screen", - action: "fullScreen", - shortcutKey: ["F"], - }, -]; - -// in future, if you find Unicon equivalents of all these icons, please replace them. Only use the same iconset throughout. -export const FACILITY_FEATURE_TYPES: { - id: number; - name: string; - icon: IconName; -}[] = [ - { - id: 1, - name: "CT Scan", - icon: "l-compact-disc", - }, - { - id: 2, - name: "Maternity Care", - icon: "l-baby-carriage", - }, - { - id: 3, - name: "X-Ray", - icon: "l-clipboard-alt", - }, - { - id: 4, - name: "Neonatal Care", - icon: "l-baby-carriage", - }, - { - id: 5, - name: "Operation Theater", - icon: "l-syringe", - }, - { - id: 6, - name: "Blood Bank", - icon: "l-medical-drip", - }, -]; - -export const WAVEFORM_VIEWABLE_LENGTH = 400; - -//blacklisted paths will not scroll to top -export const BLACKLISTED_PATHS: RegExp[] = [ - /\/facility\/([A-Za-z0-9]+(-[A-Za-z0-9]+)+)\/patient\/([A-Za-z0-9]+(-[A-Za-z0-9]+)+)\/consultation\/([A-Za-z0-9]+(-[A-Za-z0-9]+)+)\/feed+/i, - /\/facility\/([A-Za-z0-9]+(-[A-Za-z0-9]+)+)\/patient\/([A-Za-z0-9]+(-[A-Za-z0-9]+)+)\/consultation\/([A-Za-z0-9]+(-[A-Za-z0-9]+)+)\/summary+/i, - /\/facility\/([A-Za-z0-9]+(-[A-Za-z0-9]+)+)\/patient\/([A-Za-z0-9]+(-[A-Za-z0-9]+)+)\/consultation\/([A-Za-z0-9]+(-[A-Za-z0-9]+)+)\/medicines+/i, - /\/facility\/([A-Za-z0-9]+(-[A-Za-z0-9]+)+)\/patient\/([A-Za-z0-9]+(-[A-Za-z0-9]+)+)\/consultation\/([A-Za-z0-9]+(-[A-Za-z0-9]+)+)\/files+/i, - /\/facility\/([A-Za-z0-9]+(-[A-Za-z0-9]+)+)\/patient\/([A-Za-z0-9]+(-[A-Za-z0-9]+)+)\/consultation\/([A-Za-z0-9]+(-[A-Za-z0-9]+)+)\/investigations+/i, - /\/facility\/([A-Za-z0-9]+(-[A-Za-z0-9]+)+)\/patient\/([A-Za-z0-9]+(-[A-Za-z0-9]+)+)\/consultation\/([A-Za-z0-9]+(-[A-Za-z0-9]+)+)\/abg+/i, - /\/facility\/([A-Za-z0-9]+(-[A-Za-z0-9]+)+)\/patient\/([A-Za-z0-9]+(-[A-Za-z0-9]+)+)\/consultation\/([A-Za-z0-9]+(-[A-Za-z0-9]+)+)\/nursing+/i, - /\/facility\/([A-Za-z0-9]+(-[A-Za-z0-9]+)+)\/patient\/([A-Za-z0-9]+(-[A-Za-z0-9]+)+)\/consultation\/([A-Za-z0-9]+(-[A-Za-z0-9]+)+)\/neurological_monitoring+/i, - /\/facility\/([A-Za-z0-9]+(-[A-Za-z0-9]+)+)\/patient\/([A-Za-z0-9]+(-[A-Za-z0-9]+)+)\/consultation\/([A-Za-z0-9]+(-[A-Za-z0-9]+)+)\/ventilator+/i, - /\/facility\/([A-Za-z0-9]+(-[A-Za-z0-9]+)+)\/patient\/([A-Za-z0-9]+(-[A-Za-z0-9]+)+)\/consultation\/([A-Za-z0-9]+(-[A-Za-z0-9]+)+)\/nutrition+/i, - /\/facility\/([A-Za-z0-9]+(-[A-Za-z0-9]+)+)\/patient\/([A-Za-z0-9]+(-[A-Za-z0-9]+)+)\/consultation\/([A-Za-z0-9]+(-[A-Za-z0-9]+)+)\/pressure_sore+/i, - /\/facility\/([A-Za-z0-9]+(-[A-Za-z0-9]+)+)\/patient\/([A-Za-z0-9]+(-[A-Za-z0-9]+)+)\/consultation\/([A-Za-z0-9]+(-[A-Za-z0-9]+)+)\/dialysis+/i, -]; - -export const AssetImportSchema: SchemaType = { - Name: { prop: "name", type: "string" }, - Type: { - prop: "asset_type", - type: "string", - oneOf: ["INTERNAL", "EXTERNAL"], - required: true, - }, - Class: { - prop: "asset_class", - type: "string", - oneOf: ["HL7MONITOR", "ONVIF", "VENTILATOR", ""], - }, - Description: { prop: "description", type: "string" }, - "Working Status": { - prop: "is_working", - type: "boolean", - parse: (status: string) => { - if (status === "WORKING") { - return true; - } else if (status === "NOT WORKING") { - return false; - } else { - throw new Error("Invalid Working Status: " + status); - } - }, - required: true, - }, - "Not Working Reason": { prop: "not_working_reason", type: "string" }, - "Serial Number": { prop: "serial_number", type: "string" }, - "QR Code ID": { prop: "qr_code_id", type: "string" }, - Manufacturer: { prop: "manufacturer", type: "string" }, - "Vendor Name": { prop: "vendor_name", type: "string" }, - "Support Name": { prop: "support_name", type: "string" }, - "Support Email": { - prop: "support_email", - type: "string", - parse: (email: string) => { - if (!email) return null; - const isValid = /^[\w-.]+@([\w-]+\.)+[\w-]{2,4}$/.test(email); - - if (!isValid) { - throw new Error("Invalid Support Email: " + email); - } - - return email; - }, - }, - "Support Phone Number": { - prop: "support_phone", - type: "string", - parse: (phone: number | string) => { - phone = String(phone); - if (phone.length === 10 && !phone.startsWith("1800")) { - phone = "+91" + phone; - } - if (phone.startsWith("91") && phone.length === 12) { - phone = "+" + phone; - } - if (phone.startsWith("+911800")) { - phone = "1800" + phone.slice(6); - } - if ( - PhoneNumberValidator(["mobile", "landline", "support"])(phone) !== - undefined - ) { - throw new Error("Invalid Support Phone Number: " + phone); - } - - return phone ? phone : undefined; - }, - required: true, - }, - "Warranty End Date": { - prop: "warranty_amc_end_of_validity", - type: "string", - parse: (date: string) => { - if (!date) return null; - //handles both "YYYY-MM-DD" and long date format eg : Wed Oct 14 2020 05:30:00 GMT+0530 (India Standard Time) - if (isNaN(Date.parse(date))) { - const parts = date.split("-"); - if (parts.length !== 3) { - throw new Error("Invalid Date Format: " + date); - } - const reformattedDateStr = `${parts[2]}-${parts[1]}-${parts[0]}`; - const parsed = new Date(reformattedDateStr); - if (String(parsed) === "Invalid Date") { - throw new Error("Invalid Date: " + date); - } - return dateQueryString(parsed); - } else { - const parsed = new Date(date); - if (String(parsed) === "Invalid Date") { - throw new Error("Invalid Date: " + date); - } - return dateQueryString(parsed); - } - }, - }, - "Last Service Date": { - prop: "last_serviced_on", - type: "string", - parse: (date: string) => { - if (!date) return null; - if (isNaN(Date.parse(date))) { - const parts = date.split("-"); - if (parts.length !== 3) { - throw new Error("Invalid Date Format: " + date); - } - const reformattedDateStr = `${parts[2]}-${parts[1]}-${parts[0]}`; - const parsed = new Date(reformattedDateStr); - if (String(parsed) === "Invalid Date") { - throw new Error("Invalid Date: " + date); - } - return dateQueryString(parsed); - } else { - const parsed = new Date(date); - if (String(parsed) === "Invalid Date") { - throw new Error("Invalid Date: " + date); - } - return dateQueryString(parsed); - } - }, - }, - Notes: { prop: "note", type: "string" }, - "Config - IP Address": { - parent: "meta", - prop: "local_ip_address", - type: "string", - parse: (ip: string) => { - if (!ip) return null; - const isValid = - /^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/.test( - ip - ); - - if (!isValid) { - throw new Error("Invalid Config IP Address: " + ip); - } - - return ip; - }, - }, - "Config: Camera Access Key": { - parent: "meta", - prop: "camera_access_key", - type: "string", - }, -}; - -export const USER_TYPES_MAP = { - Pharmacist: "Pharmacist", - Volunteer: "Volunteer", - StaffReadOnly: "Staff", - Staff: "Staff", - Doctor: "Doctor", - Nurse: "Nurse", - NurseReadOnly: "Nurse", - WardAdmin: "Ward Admin", - LocalBodyAdmin: "Local Body Admin", - DistrictLabAdmin: "District Lab Admin", - DistrictReadOnlyAdmin: "District Admin", - DistrictAdmin: "District Admin", - StateLabAdmin: "State Lab Admin", - StateReadOnlyAdmin: "State Admin", - StateAdmin: "State Admin", - RemoteSpecialist: "Remote Specialist", -} as const; - -export const AREACODES: Record = { - CA: [ - "403", - "587", - "250", - "604", - "778", - "204", - "431", - "506", - "709", - "867", - "902", - "226", - "249", - "289", - "343", - "365", - "416", - "437", - "519", - "613", - "647", - "705", - "807", - "902", - "418", - "438", - "450", - "514", - "579", - "581", - "819", - "306", - "639", - "867", - ], - JM: ["658", "876"], - PR: ["787", "939"], - DO: ["809", "829"], - RE: ["262", "263", "692", "693"], - YT: ["269", "639"], - CC: ["89162"], - CX: ["89164"], - BQ: ["9"], - KZ: ["6", "7"], - SJ: ["79"], -}; - -export const IN_LANDLINE_AREA_CODES = [ - "11", - "22", - "33", - "44", - "20", - "40", - "79", - "80", - "120", - "124", - "129", - "135", - "141", - "160", - "161", - "172", - "175", - "181", - "183", - "233", - "240", - "241", - "250", - "251", - "253", - "257", - "260", - "261", - "265", - "343", - "413", - "422", - "431", - "435", - "452", - "462", - "471", - "474", - "477", - "478", - "481", - "484", - "485", - "487", - "490", - "497", - "512", - "522", - "532", - "542", - "551", - "562", - "581", - "591", - "621", - "612", - "641", - "657", - "712", - "721", - "724", - "751", - "761", - "821", - "824", - "831", - "836", - "866", - "870", - "891", - "4822", -]; - -export const CONSENT_TYPE_CHOICES = [ - { id: 1, text: "Consent for admission" }, - { id: 2, text: "Patient Code Status" }, - { id: 3, text: "Consent for procedure" }, - { id: 4, text: "High risk consent" }, - { id: 5, text: "Others" }, -]; - -export const CONSENT_PATIENT_CODE_STATUS_CHOICES = [ - { id: 1, text: "Do Not Hospitalise (DNH)" }, - { id: 2, text: "Do Not Resuscitate (DNR)" }, - { id: 3, text: "Comfort Care Only" }, - { id: 4, text: "Active treatment" }, -]; - -export const SOCIOECONOMIC_STATUS_CHOICES = [ - "MIDDLE_CLASS", - "POOR", - "VERY_POOR", - "WELL_OFF", -] as const; - -export const DOMESTIC_HEALTHCARE_SUPPORT_CHOICES = [ - "FAMILY_MEMBER", - "PAID_CAREGIVER", - "NO_SUPPORT", -] as const; - -export const OCCUPATION_TYPES = [ - { - id: 27, - text: "Aircraft Pilot or Flight Engineer", - value: "PILOT_FLIGHT", - }, - { id: 5, text: "Animal Handler", value: "ANIMAL_HANDLER" }, - { - id: 9, - text: "Business or Finance related Occupations", - value: "BUSINESS_RELATED", - }, - { id: 2, text: "Businessman", value: "BUSINESSMAN" }, - { id: 14, text: "Chef or Head Cook", value: "CHEF" }, - { - id: 24, - text: "Construction and Extraction Worker", - value: "CONSTRUCTION_EXTRACTION", - }, - { id: 17, text: "Custodial Occupations", value: "CUSTODIAL" }, - { - id: 18, - text: "Customer Service Occupations", - value: "CUSTOMER_SERVICE", - }, - { id: 10, text: "Engineer", value: "ENGINEER" }, - { - id: 25, - text: "Farming, Fishing and Forestry", - value: "AGRI_NATURAL", - }, - { - id: 4, - text: "Healthcare Lab Worker", - value: "HEALTH_CARE_LAB_WORKER", - }, - { - id: 7, - text: "Healthcare Practitioner", - value: "HEALTHCARE_PRACTITIONER", - }, - { id: 3, text: "Healthcare Worker", value: "HEALTH_CARE_WORKER" }, - { id: 30, text: "Homemaker", value: "HOMEMAKER" }, - { - id: 16, - text: "Hospitality Service Occupations", - value: "HOSPITALITY", - }, - { - id: 21, - text: "Insurance Sales Agent", - value: "INSURANCE_SALES_AGENT", - }, - { id: 29, text: "Military", value: "MILITARY" }, - { - id: 13, - text: "Office and Administrative Support Occupations", - value: "OFFICE_ADMINISTRATIVE", - }, - { - id: 12, - text: "Other Professional Occupations", - value: "OTHER_PROFESSIONAL_OCCUPATIONS", - }, - { id: 8, text: "Paramedics", value: "PARADEMICS" }, - { - id: 26, - text: "Production Occupations", - value: "PRODUCTION_OCCUPATION", - }, - { - id: 15, - text: "Protective Service Occupations", - value: "PROTECTIVE_SERVICE", - }, - { id: 23, text: "Real Estate Sales Agent", value: "REAL_ESTATE" }, - { id: 20, text: "Retail Sales Worker", value: "RETAIL_SALES_WORKER" }, - { - id: 22, - text: "Sales Representative", - value: "SALES_REPRESENTATIVE", - }, - { id: 19, text: "Sales Supervisor", value: "SALES_SUPERVISOR" }, - { id: 1, text: "Student", value: "STUDENT" }, - { id: 11, text: "Teacher", value: "TEACHER" }, - { id: 28, text: "Vehicle Driver", value: "VEHICLE_DRIVER" }, - { id: 6, text: "Others", value: "OTHERS" }, - { id: 32, text: "Not Applicable", value: "NOT_APPLICABLE" }, -]; - -export const PATIENT_NOTES_THREADS = { - Doctors: 10, - Nurses: 20, -} as const; - -export const RATION_CARD_CATEGORY = ["BPL", "APL", "NO_CARD"] as const; - -export const DEFAULT_ALLOWED_EXTENSIONS = [ - "image/*", - "video/*", - "audio/*", - "text/plain", - "text/csv", - "application/rtf", - "application/msword", - "application/vnd.oasis.opendocument.text", - "application/pdf", - "application/vnd.ms-excel", - "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", - "application/vnd.oasis.opendocument.spreadsheet,application/pdf", -]; - -export const SPOKE_RELATION_TYPES = [ - { - text: "Regular", - value: SpokeRelationship.REGULAR, - }, - { - text: "Tele ICU", - value: SpokeRelationship.TELE_ICU, - }, -]; - -export const HumanBodyPaths = { - anterior: [ - { - d: "M535.244,212.572c32.253.43,32.684-31.823,32.684-31.823,9.891-.215,14.191-19.783,13.331-23.653s-7.526-1.5-7.526-1.5c3.656-30.1-9.676-48.38-17.847-53.756S535.244,95.6,535.244,95.6h.43s-12.472.86-20.643,6.236-21.5,23.653-17.846,53.756c0,0-6.666-2.365-7.526,1.5s3.44,23.438,13.331,23.653c0,0,.43,32.253,32.684,31.823Z", - transform: "translate(-362.967 -95.599)", - region: "AnteriorHead", - }, - { - d: "M512.129,213.97s31.608,4.954,47.574-1.394v14.456s-26.287,4.355-47.574,0Z", - transform: "translate(-362.967 -95.599)", - region: "AnteriorNeck", - }, - { - d: "M505.355,231.279s-56.766,25.8-69.452,34.4c0,0,15.7,20.857,21.072,66.872C456.975,332.555,469.417,246.838,505.355,231.279Z", - transform: "translate(-362.967 -95.599)", - region: "AnteriorRightShoulder", - }, - { - d: "M526.482,232.838l.806,137.346s-46.607-22.2-67.745,18.762C459.543,388.946,455.685,234.612,526.482,232.838Z", - transform: "translate(-362.967 -95.599)", - region: "AnteriorRightChest", - }, - { - d: "M433.108,269.768s34.728,55.552,18.279,141.992c0,0-19.57-9.107-33.761-7.333,0,0-1.613-106.276,0-110.952S429.721,271.058,433.108,269.768Z", - transform: "translate(-362.967 -95.599)", - region: "AnteriorRightArm", - }, - { - d: "M415.207,408.781s27.254-.968,35.963,11.45c0,0-7.58,59.024-13.547,77.57s-19.03,56.766-19.03,56.766l-22.254-2.742s1.451-34.672,1.29-45.477,5-49.993,9.514-62.249S415.207,408.781,415.207,408.781Z", - transform: "translate(-362.967 -95.599)", - region: "AnteriorRightForearm", - }, - { - d: "M396.6,556.524l18.245,2.606a1.808,1.808,0,0,1,1.565,1.776c.049,6.373.053,30.692-2.6,41.987-2.568,10.951-16.244,28.022-26.205,35.726a4.126,4.126,0,0,1-6.575-2.7c-.192-1.322-.39-2.923-.584-4.855a1.828,1.828,0,0,0-2.054-1.637l-4.174.551a1.818,1.818,0,0,1-2.026-2.171c.631-3.043,1.887-8.187,3.72-11.529,2.591-4.724,5.9-18.948,5.442-26.76a1.79,1.79,0,0,0-1.514-1.635,7.118,7.118,0,0,0-5.448,1c-1.364,1.043-3.83,4.558-5.963,7.825-1.941,2.973-6.715.452-5.152-2.736.018-.037.037-.074.056-.111,1.936-3.71,13.063-18.708,16.288-24.513,2.9-5.221,13.627-8.747,15.171-11.984A1.706,1.706,0,0,1,396.6,556.524Z", - transform: "translate(-362.967 -95.599)", - region: "AnteriorRightHand", - }, - { - d: "M674.037,556.2l-18.244,2.606a1.808,1.808,0,0,0-1.566,1.776c-.049,6.373-.052,30.692,2.6,41.988,2.569,10.951,16.244,28.021,26.205,35.726a4.126,4.126,0,0,0,6.576-2.7c.191-1.322.389-2.922.584-4.855a1.827,1.827,0,0,1,2.053-1.637l4.174.551a1.818,1.818,0,0,0,2.027-2.17c-.632-3.043-1.888-8.188-3.721-11.53-2.59-4.723-5.9-18.948-5.442-26.76a1.79,1.79,0,0,1,1.515-1.634,7.114,7.114,0,0,1,5.447,1c1.364,1.043,3.83,4.558,5.964,7.826,1.94,2.973,6.715.451,5.151-2.736-.018-.038-.037-.075-.056-.112-1.935-3.709-13.063-18.707-16.288-24.513-2.9-5.221-13.627-8.746-15.171-11.984A1.707,1.707,0,0,0,674.037,556.2Z", - transform: "translate(-362.967 -95.599)", - region: "AnteriorLeftHand", - }, - { - d: "M544.705,232.838h19.137s18.062,15.643,20,19.513,29.888,42.79,26.878,128.154c0,0-16.557-16.556-31.178-15.051,0,0,2.365-33.114-34.834-34.619Z", - transform: "translate(-362.967 -95.599)", - region: "AnteriorLeftChest", - }, - { - d: "M569.432,231.279s61.927,31.824,65.153,35.694c0,0-12.9,9.752-18.707,73.791C615.878,340.764,610.072,268.048,569.432,231.279Z", - transform: "translate(-362.967 -95.599)", - region: "AnteriorLeftShoulder", - }, - { - d: "M638.455,271.058s14.407,18.923,14.837,23.223-1.291,105.362.86,108.8c0,0-26.233,1.29-34.834,9.891,0,0-4.3-51.176.86-78.484S633.079,279.659,638.455,271.058Z", - transform: "translate(-362.967 -95.599)", - region: "AnteriorLeftArm", - }, - { - d: "M621.038,419s16.342-12.257,33.974-10.537c0,0,7.741,26.233,8.816,34.189s10.321,49.241,9.246,66.658.087,41.069.087,41.069-16.214,3.44-20.084,4.731c0,0-17.2-46.661-18.062-52.036S620.982,426.52,621.038,419Z", - transform: "translate(-362.967 -95.599)", - region: "AnteriorLeftForearm", - }, - { - d: "M510.758,934.272s-20.723,1.451-24.973,1.5a56.32,56.32,0,0,0-1.556,10.672c0,4.355.484,25.481-.645,28.061s-21.771,27.254-23.383,30.641.645,8.386,1.935,9.192,2.1,4.757,4.193,5.644c1.807.765,3.064,3.709,5.644,4.032s10.482-.645,12.418.726c0,0,.887,3.144,2.58,3.306.864.082,5.644,1.774,10.644-5.967s13.04-35.019,13.439-37.791c.249-1.732-1.183-2.125-1.506-5.189a112.484,112.484,0,0,1,1.855-20.64C513.419,948.3,510.758,934.272,510.758,934.272Z", - transform: "translate(-362.967 -95.599)", - region: "AnteriorRightFoot", - }, - { - d: "M563.251,934.191s20.756.564,25.006.616c0,0,.151,7.125.151,11.479s.162,24.351,1.29,26.932,22.531,27.576,24.144,30.963-.645,8.386-1.935,9.192-2.1,4.758-4.193,5.645c-1.807.764-3.064,3.709-5.645,4.031s-10.482-.645-12.417.726c0,0-.887,3.145-2.581,3.306-.864.082-5.644,1.774-10.643-5.967s-13.04-35.018-13.439-37.79c-.25-1.733,1.182-2.126,1.5-5.19a112.484,112.484,0,0,0-1.855-20.64C560.623,947.334,563.251,934.191,563.251,934.191Z", - transform: "translate(-362.967 -95.599)", - region: "AnteriorLeftFoot", - }, - { - d: "M485.2,932.363l24.513-1.4s1.666-37.2,2.526-41.285,4.731-85.149,4.086-99.771c0,0-30,2.527-49.348-3.924,0,0-6.451,44.026-1.828,62.841C467.775,859.527,484.874,929.6,485.2,932.363Z", - transform: "translate(-362.967 -95.599)", - region: "AnteriorRightLeg", - }, - { - d: "M469.231,420.715s-5.966-30.318-4.515-34.834a115.141,115.141,0,0,1,16.772-10.966c10.428-5.483,29.727-6.773,36.339-3.548,5.81,2.834,4.972,2.548,13.439,4.73l.054-142.13h9.192V334.92s32.415,1.291,31.931,33.06a72.9,72.9,0,0,0,8.869,2.419c5.322,1.129,23.062,9.031,25.642,19.675,0,0-4.945,22.2-3.655,32.684,0,0-39.4-29.835-47.306-31.609s-12.959,2.31-16.933,2.8c-4.483.547-11.71-.628-18.142-2.9C514.306,388.7,475.2,414.909,469.231,420.715Z", - transform: "translate(-362.967 -95.599)", - region: "AnteriorLowerChest", - }, - { - d: "M461.813,481.665c2.43-11.313,8.042-43.207,7.1-55.467,0,0,48.3-30.56,50.88-30.4s12.122,5.564,23.841,2.338c0,0,6.719-3.225,13.331.162s34.874,24.149,46.324,28.987c0,0-.524,28.746,1.573,37.777s10.159,42.091,10.966,46.123,0,.806,0,.806-58.057,50.155-59.669,52.574c0,0-6.451-6.29-20.481-6.774s-20.643,6.774-20.643,6.774l-60.152-51.122S460.965,485.617,461.813,481.665Z", - transform: "translate(-362.967 -95.599)", - region: "AnteriorAbdomen", - }, - { - d: "M554.381,790.77s30.748,3.226,51.39-4.945c0,0,3.441,40.424,0,63.432s-16.449,76.871-17.094,81.816c0,0-23.33.108-25.91-1.4,0,0-3.011-33.328-3.871-43S550.08,810.982,554.381,790.77Z", - transform: "translate(-362.967 -95.599)", - region: "AnteriorLeftLeg", - }, - { - d: "M454.072,520.056s-4.515,29.35-6.128,48.7.323,59.346,6.128,81.278,21.288,89.343,14.514,131.272c0,0,20.464,8.064,47.808,4.516,0,0,7.2-74.822,6.7-87.73,0,0,3.333-50.745,3.333-58.7s1.72-27.738,1.72-27.738-20.642-10.106-14.837-44.08C513.311,567.576,462.351,524.571,454.072,520.056Z", - transform: "translate(-362.967 -95.599)", - region: "AnteriorRightThigh", - }, - { - d: "M553.114,785.825s37.713,2.741,50.615-3.548c0,0-6.451-35.8-1.129-63.325s19.943-77.408,20.8-92.03,2.33-87.3-7.221-108.371l-56.426,49.455s3.441,37.629-18.922,44.725c0,0,7.741,68.807,7.741,78.913S554.857,777.654,553.114,785.825Z", - transform: "translate(-362.967 -95.599)", - region: "AnteriorLeftThigh", - }, - { - d: "M535.624,610.466s16.722-10.1,18.818-27.355-3.386-17.578-5.805-18.545-13.063-1.291-13.063-1.291h.1s-10.644.323-13.063,1.291-7.9,1.29-5.806,18.545S535.624,610.466,535.624,610.466Z", - transform: "translate(-362.967 -95.599)", - region: "AnteriorGroin", - }, - ], - - posterior: [ - { - d: "M 506.9838 158.0121 C 509.6029 173.1336 512.1258 187.9477 521.5039 184.4407 C 517.7283 191.6346 525.6919 202.9266 528.0919 210.8841 C 544.9623 208.3461 562.3174 208.3461 579.1878 210.8841 C 581.5893 202.9236 589.5363 191.6662 585.7863 184.4511 C 595.6744 187.4586 596.8188 174.3021 600.3813 158.5926 C 600.1173 156.4611 595.9999 158.5806 594.7788 159.0816 C 597.7384 128.3122 591.2088 97.1811 553.7104 97.22 C 516.1444 97.1497 509.5249 128.2116 512.5008 159.0891 C 511.0564 158.4651 508.4914 157.0971 506.9838 158.0121 Z", - transform: "translate(-390.349 -94.472)", - region: "PosteriorHead", - }, - { - d: "M 503.129 213.97 s 30.871 -1.97 46.871 0.03 v 12.456 s -26 -2.456 -47.574 0 Z", - transform: "translate(-362.967 -95.599)", - region: "PosteriorNeck", - }, - { - d: "M545.584,228.037V361.6s-13.6,10.828-25.282,13.145c-10.077,2-36.162,3.374-36.766-.857S478.9,239.117,545.584,228.037Z", - transform: "translate(-390.349 -94.472)", - region: "PosteriorLeftChest", - }, - { - d: "M563.865,228.037V361.6s13.6,10.828,25.282,13.145c10.076,2,36.161,3.374,36.766-.857S630.546,239.117,563.865,228.037Z", - transform: "translate(-390.349 -94.472)", - region: "PosteriorRightChest", - }, - { - d: "M550.973,228.188h8.914l.151,136.435s20.7,17.828,59.681,16.317c0,0-4.684,38.528-1.057,56.508s9.216,41.248,9.216,41.248-77.812,30.218-145.954-.151c0,0,9.67-35.96,9.972-58.321a167.6,167.6,0,0,0-4.23-39.888s37.924,5.439,62.1-15.713C549.764,364.623,550.52,228.188,550.973,228.188Z", - transform: "translate(-390.349 -94.472)", - region: "PosteriorAbdomen", - }, - { - d: "M523.223,230.857s-40.694,20.548-50.968,25.182-11.08,5.439-11.08,5.439,15.512,18.735,18.533,70.509C479.708,331.987,489.58,244.354,523.223,230.857Z", - transform: "translate(-390.349 -94.472)", - region: "PosteriorLeftShoulder", - }, - { - d: "M587.084,230.857s40.693,20.548,50.968,25.182,11.08,5.439,11.08,5.439S633.62,280.213,630.6,331.987C630.6,331.987,620.726,244.354,587.084,230.857Z", - transform: "translate(-390.349 -94.472)", - region: "PosteriorRightShoulder", - }, - { - d: "M457.951,265.306s-12.49,14.706-13.5,29.613,1.813,82.194.6,95.691c0,0,15.512-1.209,22.16,3.022s9.872,4.23,9.872,4.23,3.223-32.232,1.41-53.385S467.823,277.393,457.951,265.306Z", - transform: "translate(-390.349 -94.472)", - region: "PosteriorLeftArm", - }, - { - d: "M444.655,394.639s3.627-1.209,8.864,1.612,21.153,4.835,21.153,4.835a241.987,241.987,0,0,1-6.245,50.968c-6.446,27.8-23.167,79.977-22.966,81.992,0,0-17.325-4.03-20.951-3.828,0,0,1.209-21.354,1.612-31.427s.2-42.91,6.648-63.659S444.454,396.049,444.655,394.639Z", - transform: "translate(-390.349 -94.472)", - region: "PosteriorLeftForearm", - }, - { - d: "M423.5,533.844s-4.029,2.82-7.454,5.036-12.49,13.1-15.311,18.131-11.482,15.915-10.274,16.923,5.44.2,7.454-2.216,7.051-8.663,10.476-7.253c0,0,1.007,12.087-3.224,22.966s-4.633,13.7-4.633,13.7,2.591,2.22,7.063.809q.291-.091.592-.2s1.612,4.835.806,8.864,3.022,3.425,7.655,1.007,21.959-22.562,24.175-35.053,1.611-40.895,1.611-40.895S427.33,534.65,423.5,533.844Z", - transform: "translate(-390.349 -94.472)", - region: "PosteriorLeftHand", - }, - { - d: "M650.678,265.306s12.49,14.706,13.5,29.613-1.813,82.194-.6,95.691c0,0-15.512-1.209-22.16,3.022s-9.871,4.23-9.871,4.23-3.224-32.232-1.41-53.385S640.807,277.393,650.678,265.306Z", - transform: "translate(-390.349 -94.472)", - region: "PosteriorRightArm", - }, - { - d: "M663.974,394.639s-3.626-1.209-8.864,1.612-21.153,4.835-21.153,4.835a242.066,242.066,0,0,0,6.245,50.968c6.447,27.8,23.168,79.977,22.966,81.992,0,0,17.325-4.03,20.951-3.828,0,0-1.208-21.354-1.611-31.427s-.2-42.91-6.648-63.659S664.175,396.049,663.974,394.639Z", - transform: "translate(-390.349 -94.472)", - region: "PosteriorRightForearm", - }, - { - d: "M685.127,533.844s4.029,2.82,7.453,5.036,12.491,13.1,15.311,18.131,11.483,15.915,10.274,16.923-5.439.2-7.454-2.216-7.051-8.663-10.475-7.253c0,0-1.008,12.087,3.223,22.966s4.633,13.7,4.633,13.7-2.59,2.22-7.062.809q-.291-.091-.593-.2s-1.612,4.835-.806,8.864-3.022,3.425-7.655,1.007-21.958-22.562-24.174-35.053-1.612-40.895-1.612-40.895S681.3,534.65,685.127,533.844Z", - transform: "translate(-390.349 -94.472)", - region: "PosteriorRightHand", - }, - { - d: "M552.635,495.366s0,66.279-.6,69.9c-.051.277-.126.982-.2,2.065-5.691,6.673-27.473,28.254-58.673,9.04a10.164,10.164,0,0,1-1.738-1.309c-23.066-21.783-7.076-50.968-6.371-52.2l-2.216-1.234c-.176.327-17.652,32.107,6.849,55.249a14.16,14.16,0,0,0,2.166,1.662c9.519,5.842,18.232,8.033,25.988,8.033,16.116,0,27.977-9.519,33.642-15.235-1.661,20.07-6.144,82.369-6.5,86-.4,4.231-7.605,77.51-7.605,80.935,0,0-36.111-4.785-45.579-2.972,0,0,.2-37.672-2.821-59.63s-14.5-65.473-15.914-101.936-1.411-65.473,7.453-91.46C480.514,482.272,499.048,497.582,552.635,495.366Z", - transform: "translate(-390.349 -94.472)", - region: "PosteriorLeftThighAndButtock", - }, - { - d: "M555.471,495.366s0,66.279.6,69.9c.051.277.126.982.2,2.065,5.691,6.673,27.473,28.254,58.673,9.04a10.164,10.164,0,0,0,1.738-1.309c23.066-21.783,7.076-50.968,6.371-52.2l2.216-1.234c.176.327,17.652,32.107-6.85,55.249a14.151,14.151,0,0,1-2.165,1.662c-9.519,5.842-18.232,8.033-25.988,8.033-16.116,0-27.977-9.519-33.643-15.235,1.662,20.07,6.145,82.369,6.5,86,.4,4.231,7.605,77.51,7.605,80.935,0,0,36.111-4.785,45.579-2.972,0,0-.2-37.672,2.82-59.63s14.5-65.473,15.915-101.936,1.41-65.473-7.453-91.46C627.592,482.272,609.058,497.582,555.471,495.366Z", - transform: "translate(-390.349 -94.472)", - region: "PosteriorRightThighAndButtock", - }, - { - d: "M492.2,739.529s21.354-2.418,42.909,3.425c0,0,3.627,43.312,1.612,61.846s-7.655,75.445-6.849,80.078c0,0-19.944.907-25.988,2.518,0,0-2.619-29.009-9.267-49.154S486.961,754.839,492.2,739.529Z", - transform: "translate(-390.349 -94.472)", - region: "PosteriorLeftLeg", - }, - { - d: "M617.088,739.529s-21.354-2.418-42.909,3.425c0,0-3.626,43.312-1.612,61.846s7.655,75.445,6.85,80.078c0,0,19.944.907,25.987,2.518,0,0,2.619-29.009,9.267-49.154S622.326,754.839,617.088,739.529Z", - transform: "translate(-390.349 -94.472)", - region: "PosteriorRightLeg", - }, - { - d: "M504.387,891.023s17.728-.806,24.879-2.619c0,0,2.015,6.245,1.209,18.131s-1.007,21.555-.6,23.771,1.813,9.67-1.209,15.512S520,967.172,516.978,972.007s-10.275,5.439-11.886-1.611c0,0-1.813,3.424-7.857,1.41s-9.67-1.209-11.483-5.44-4.835-11.684-1.41-16.922,18.937-18.534,20.145-25.182S505.6,895.455,504.387,891.023Z", - transform: "translate(-390.349 -94.472)", - region: "PosteriorLeftFoot", - }, - { - d: "M604.752,891.023s-17.728-.806-24.88-2.619c0,0-2.014,6.245-1.209,18.131s1.008,21.555.605,23.771-1.813,9.67,1.209,15.512,8.662,21.354,11.684,26.189,10.274,5.439,11.886-1.611c0,0,1.813,3.424,7.856,1.41s9.67-1.209,11.483-5.44,4.835-11.684,1.41-16.922-18.936-18.534-20.145-25.182S603.543,895.455,604.752,891.023Z", - transform: "translate(-390.349 -94.472)", - region: "PosteriorRightFoot", - }, - ], -} as const; - -export type HumanBodyRegion = (typeof HumanBodyPaths)[ - | "anterior" - | "posterior"][number]["region"]; - -export const PressureSoreExudateAmountOptions = [ - "None", - "Light", - "Moderate", - "Heavy", -] as const; - -export const PressureSoreTissueTypeOptions = [ - "Closed", - "Epithelial", - "Granulation", - "Slough", - "Necrotic", -] as const; - -export const FILE_EXTENSIONS = { - IMAGE: ["jpeg", "jpg", "png", "gif", "svg", "bmp", "webp", "jfif"], - AUDIO: ["mp3", "wav"], - VIDEO: [ - "webm", - "mpg", - "mp2", - "mpeg", - "mpe", - "mpv", - "ogg", - "mp4", - "m4v", - "avi", - "wmv", - "mov", - "qt", - "flv", - "swf", - ], - PRESENTATION: ["pptx"], - DOCUMENT: ["pdf", "docx"], -} as const; - -export const PREVIEWABLE_FILE_EXTENSIONS = [ - "html", - "htm", - "pdf", - "mp4", - "webm", - "jpg", - "jpeg", - "png", - "gif", - "webp", -] as const; - -export const HEADER_CONTENT_TYPES = { - pdf: "application/pdf", - txt: "text/plain", - jpeg: "image/jpeg", - jpg: "image/jpeg", - doc: "application/msword", - xls: "application/vnd.ms-excel", - docx: "application/vnd.openxmlformats-officedocument.wordprocessingml.document", - epub: "application/epub+zip", - gif: "image/gif", - html: "text/html", - htm: "text/html", - mp4: "video/mp4", - png: "image/png", - ppt: "application/vnd.ms-powerpoint", - pptx: "application/vnd.openxmlformats-officedocument.presentationml.presentation", - svg: "image/svg+xml", - xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", -} as const; diff --git a/src/components/CareLivekit.tsx b/src/components/CareLivekit.tsx deleted file mode 100644 index 71ce171..0000000 --- a/src/components/CareLivekit.tsx +++ /dev/null @@ -1,11 +0,0 @@ -import React, { Suspense } from "react"; - -const CareLivekit: React.FC = () => { - return ( - Loading...}> -
"PageTitle not available"
-
- ); -}; - -export default CareLivekit; diff --git a/src/components/DoctorConnectButtons.tsx b/src/components/DoctorConnectButtons.tsx index b3e9332..65d2d42 100644 --- a/src/components/DoctorConnectButtons.tsx +++ b/src/components/DoctorConnectButtons.tsx @@ -1,45 +1,35 @@ -import React from "react"; +import CareIcon from "@core/CAREUI/icons/CareIcon"; +import { triggerGoal } from "@core/Integrations/Plausible"; import { navigate } from "raviger"; +import React from "react"; -import { triggerGoal } from "core/Integrations/Plausible"; - -// Create a type wrapper component for the lazy-loaded components -const DoctorConnectButtons = ({ user }: { user: any }) => { - const AuthUserWrapper = () => { - const authUser = useAuthUser(); - const handleLivekitConnect = async ( - e: React.MouseEvent - ) => { - e.preventDefault(); - e.stopPropagation(); - - await triggerGoal("Doctor Connect Click", { - medium: "Livekit Video Call", - userId: authUser.id, - targetUserType: user.user_type, - }); +import { DoctorConnectButtonComponentType } from "@/pluginTypes"; - navigate(`/live_connect/${user.username}`); - }; +const DoctorConnectButtons: DoctorConnectButtonComponentType = ({ user }) => { + const authUser = { username: "devdistrictadmin" }; + const handleLivekitConnect = (e: React.MouseEvent) => { + e.preventDefault(); + e.stopPropagation(); - const ConnectDoctorText = "Connect via Livekit Video Call"; + triggerGoal("Doctor Connect Click", { + medium: "Livekit Video Call", + userId: authUser.username, + targetUserType: user.user_type, + }); - return ( - -
- {ConnectDoctorText} - Loading...
}> - - - -
- ); + // Navigate to the Livekit video call page with the user's ID + navigate(`/live_connect/${user.username}`); }; + const ConnectDoctorText = "Connect via Livekit Video Call"; + return ( - Loading...}> - - + +
+ {ConnectDoctorText} + +
+
); }; diff --git a/src/components/DoctorLiveConnect.tsx b/src/components/DoctorLiveConnect.tsx index 90d8708..3a40983 100644 --- a/src/components/DoctorLiveConnect.tsx +++ b/src/components/DoctorLiveConnect.tsx @@ -1,33 +1,14 @@ import React from "react"; + import LiveKitComponent from "./LiveKitComponent"; -// Convert core imports to lazy imports -const useAuthContext = React.lazy(() => - import("@core/common/hooks/useAuthUser").then( - (module) => module.useAuthContext - ) -); const PageTitle = React.lazy(() => import("@core/components/Common/PageTitle")); const DoctorLiveConnect = ({ username }: { username: string }) => { - // Wrap the useAuthContext in a React.Suspense - const AuthContextWrapper = () => { - const auth = useAuthContext(); - const currentUser = auth?.user; - - return ( - - ); - }; - + const currentUser = { username: "devdistrictadmin" }; return (
- Loading...
}> - - +
@@ -40,9 +21,10 @@ const DoctorLiveConnect = ({ username }: { username: string }) => {
- Loading...
}> - - +
diff --git a/src/index.ts b/src/index.ts new file mode 100644 index 0000000..9cb3a91 --- /dev/null +++ b/src/index.ts @@ -0,0 +1,4 @@ +export { default as DoctorConnectButtons } from "./components/DoctorConnectButtons"; + +export { default as manifest } from "./manifest"; +export { default as routes } from "./routes"; diff --git a/src/index.tsx b/src/index.tsx deleted file mode 100644 index bbf5306..0000000 --- a/src/index.tsx +++ /dev/null @@ -1,16 +0,0 @@ -// export { default as DoctorConnectButtons } from "./components/DoctorConnectButtons"; - -// export { default as manifest } from "./manifest"; -// export { default as routes } from "./routes"; -import React from "react"; -import { PageTitle } from "core"; - -const CareLivekit: React.FC = () => { - return ( -
- -
- ); -}; - -export default CareLivekit; diff --git a/src/models/models.ts b/src/models/models.ts deleted file mode 100644 index e69de29..0000000 diff --git a/vite.config.mts b/vite.config.mts new file mode 100644 index 0000000..e8164df --- /dev/null +++ b/vite.config.mts @@ -0,0 +1,294 @@ +import { ValidateEnv } from "@julr/vite-plugin-validate-env"; +import federation from "@originjs/vite-plugin-federation"; +import react from "@vitejs/plugin-react-swc"; +import DOMPurify from "dompurify"; +import fs from "fs"; +import { JSDOM } from "jsdom"; +import { marked } from "marked"; +import { createRequire } from "node:module"; +import path from "path"; +import { defineConfig, loadEnv } from "vite"; +import checker from "vite-plugin-checker"; +import { VitePWA } from "vite-plugin-pwa"; +import { viteStaticCopy } from "vite-plugin-static-copy"; +import { z } from "zod"; + +import { treeShakeCareIcons } from "./plugins/treeShakeCareIcons"; + +const pdfWorkerPath = path.join( + path.dirname( + createRequire(import.meta.url).resolve("pdfjs-dist/package.json"), + ), + "build", + "pdf.worker.min.mjs", +); + +// Convert goal description markdown to HTML +function getDescriptionHtml(description: string) { + // note: escaped description causes issues with markdown parsing + const html = marked.parse(description, { + async: false, + gfm: true, + breaks: true, + }); + const purify = DOMPurify(new JSDOM("").window); + const sanitizedHtml = purify.sanitize(html); + return JSON.stringify(sanitizedHtml); +} + +function getPluginAliases() { + const pluginsDir = path.resolve(__dirname, "apps"); + // Make sure the `apps` folder exists + if (!fs.existsSync(pluginsDir)) { + return {}; + } + const pluginFolders = fs.readdirSync(pluginsDir); + + const aliases = {}; + + pluginFolders.forEach((pluginFolder) => { + const pluginSrcPath = path.join(pluginsDir, pluginFolder, "src"); + if (fs.existsSync(pluginSrcPath)) { + aliases[`@apps/${pluginFolder}`] = pluginSrcPath; + aliases[`@app-manifest/${pluginFolder}`] = path.join( + pluginSrcPath, + "manifest.ts", + ); + } + }); + + return aliases; +} + +function getPluginDependencies(): string[] { + const pluginsDir = path.resolve(__dirname, "apps"); + // Make sure the `apps` folder exists + if (!fs.existsSync(pluginsDir)) { + return []; + } + const pluginFolders = fs.readdirSync(pluginsDir); + + const dependencies = new Set(); + + pluginFolders.forEach((pluginFolder) => { + const packageJsonPath = path.join(pluginsDir, pluginFolder, "package.json"); + if (fs.existsSync(packageJsonPath)) { + const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, "utf8")); + const pluginDependencies = packageJson.dependencies + ? Object.keys(packageJson.dependencies) + : []; + pluginDependencies.forEach((dep) => dependencies.add(dep)); + } + }); + + return Array.from(dependencies); +} + +// Recursive function to check if the module is statically imported by an entry point +function isStaticallyImportedByEntry( + getModuleInfo: (moduleId: string) => any, + moduleId: string, + visited = new Set(), +) { + if (visited.has(moduleId)) return false; + visited.add(moduleId); + + const modInfo = getModuleInfo(moduleId); + if (!modInfo) return false; + + // Check if the module is an entry point + if (modInfo.isEntry) { + return true; + } + + // Check all static importers + for (const importerId of modInfo.importers) { + if (isStaticallyImportedByEntry(getModuleInfo, importerId, visited)) { + return true; + } + } + + return false; +} + +/** @type {import('vite').UserConfig} */ +export default defineConfig(({ mode }) => { + const env = loadEnv(mode, process.cwd(), ""); + + const cdnUrls = + env.REACT_CDN_URLS || + [ + "https://egov-s3-facility-10bedicu.s3.amazonaws.com", + "https://egov-s3-patient-data-10bedicu.s3.amazonaws.com", + "http://localhost:4566", + ].join(" "); + + return { + envPrefix: "REACT_", + define: { + __CUSTOM_DESCRIPTION_HTML__: getDescriptionHtml( + env.REACT_CUSTOM_DESCRIPTION || "", + ), + }, + plugins: [ + // Federation Config for care_livekit_fe + federation({ + name: "core", + remotes: { + livekit: { + external: `Promise.resolve("https://ohcnetwork.github.io/care_livekit_fe/assets/remoteEntry.js")`, + from: "vite", + externalType: "promise", + }, + }, + shared: { + react: { requiredVersion: "^18.0.0", singleton: true }, + "react-dom": { requiredVersion: "^18.0.0", singleton: true }, + }, + }), + ValidateEnv({ + validator: "zod", + schema: { + REACT_CARE_API_URL: z.string().url(), + + REACT_SENTRY_DSN: z.string().url().optional(), + REACT_SENTRY_ENVIRONMENT: z.string().optional(), + + REACT_PLAUSIBLE_SITE_DOMAIN: z + .string() + .regex(/^[a-zA-Z0-9][a-zA-Z0-9-_.]*\.[a-zA-Z]{2,}$/) + .optional() + .describe("Domain name without protocol (e.g., sub.domain.com)"), + + REACT_PLAUSIBLE_SERVER_URL: z.string().url().optional(), + REACT_CDN_URLS: z + .string() + .optional() + .transform((val) => val?.split(" ")) + .pipe(z.array(z.string().url()).optional()) + .describe("Optional: Space-separated list of CDN URLs"), + }, + }), + viteStaticCopy({ + targets: [ + { + src: pdfWorkerPath, + dest: "", + }, + ], + }), + react(), + checker({ typescript: true }), + treeShakeCareIcons({ + iconWhitelist: ["default"], + }), + VitePWA({ + strategies: "injectManifest", + srcDir: "src", + filename: "service-worker.ts", + injectRegister: "script-defer", + devOptions: { + enabled: true, + type: "module", + }, + injectManifest: { + maximumFileSizeToCacheInBytes: 7000000, + }, + manifest: { + name: "Care", + short_name: "Care", + theme_color: "#0e9f6e", + background_color: "#ffffff", + display: "standalone", + icons: [ + { + src: "images/icons/pwa-64x64.png", + sizes: "64x64", + type: "image/png", + }, + { + src: "images/icons/pwa-192x192.png", + sizes: "192x192", + type: "image/png", + }, + { + src: "images/icons/pwa-512x512.png", + sizes: "512x512", + type: "image/png", + purpose: "any", + }, + { + src: "images/icons/maskable-icon-512x512.png", + sizes: "512x512", + type: "image/png", + purpose: "maskable", + }, + ], + }, + }), + ], + resolve: { + alias: { + ...getPluginAliases(), + "@": path.resolve(__dirname, "./src"), + "@careConfig": path.resolve(__dirname, "./care.config.ts"), + "@core": path.resolve(__dirname, "src/"), + }, + }, + // optimizeDeps: { + // include: getPluginDependencies(), + // }, + build: { + target: "es2022", + outDir: "build", + assetsDir: "bundle", + sourcemap: true, + rollupOptions: { + output: { + manualChunks(id, { getModuleInfo }) { + if (id.includes("node_modules")) { + const moduleInfo = getModuleInfo(id); + + // Determine if the module should be in the 'vendor' chunk + const manualVendorChunks = /tiny-invariant/; + if ( + manualVendorChunks.test(id) || + isStaticallyImportedByEntry(getModuleInfo, id) + ) { + return "vendor"; + } else { + // group lazy-loaded dependencies by their dynamic importer + const dynamicImporters = moduleInfo?.dynamicImporters || []; + if (dynamicImporters && dynamicImporters.length > 0) { + // Use the first dynamic importer to name the chunk + const importerChunkName = dynamicImporters[0] + ? dynamicImporters[0].split("/").pop() + : "vendor".split(".")[0]; + return `chunk-${importerChunkName}`; + } + // If no dynamic importers are found, let Rollup handle it automatically + } + } + }, + }, + }, + }, + esbuild: { + target: "es2022", + }, + server: { + port: 4000, + }, + preview: { + headers: { + "Content-Security-Policy-Report-Only": `default-src 'self';\ + script-src 'self' blob: 'nonce-f51b9742' https://plausible.10bedicu.in;\ + style-src 'self' 'unsafe-inline';\ + connect-src 'self' https://plausible.10bedicu.in;\ + img-src 'self' https://cdn.ohc.network ${cdnUrls};\ + object-src 'self' ${cdnUrls};`, + }, + port: 4000, + }, + }; +}); diff --git a/vite.config.ts b/vite.config.ts index 827c160..bc72be8 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -1,26 +1,20 @@ -import { defineConfig } from "vite"; -import react from "@vitejs/plugin-react"; import federation from "@originjs/vite-plugin-federation"; +import react from "@vitejs/plugin-react"; import path from "path"; +import { defineConfig } from "vite"; export default defineConfig({ + envPrefix: "REACT_", plugins: [ react(), federation({ name: "care_livekit", filename: "remoteEntry.js", exposes: { - "./CareLivekit": "./src/components/CareLivekit.tsx", + "./DoctorLiveConnect": "./src/components/DoctorLiveConnect.tsx", + "./DoctorConnectButtons": "./src/components/DoctorConnectButtons.tsx", + "./manifest": "./src/manifest.ts", }, - // remotes: { - // core: { - // external: - // 'Promise.resolve(window.location.origin + "/bundle/sharedCore.js")', - // from: "vite", - // externalType: "promise", - // }, - // }, - shared: ["react", "react-dom"], }), ], build: { @@ -32,15 +26,24 @@ export default defineConfig({ }, rollupOptions: { external: ["core/PageTitle"], + input: { + main: "./src/index.ts", + }, output: { format: "esm", entryFileNames: "assets/[name].js", + chunkFileNames: "assets/[name].js", }, }, }, + server: { + origin: "http://localhost:5173", + }, resolve: { alias: { - "@": path.resolve(__dirname, "./src"), + "@": path.resolve(__dirname, "../../src"), + "@core": path.resolve(__dirname, "../../src"), + "@careConfig": path.resolve(__dirname, "../../care.config.ts"), }, }, });