momentic 1.0.82 → 1.0.83
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/bin/cli.js
CHANGED
|
@@ -2979,7 +2979,7 @@ ${i.stack}`),a.status(500).send("Internal Server Error")}),n){let i=SS.static(n)
|
|
|
2979
2979
|
|
|
2980
2980
|
Using Command Prompt on Windows:
|
|
2981
2981
|
for /f "tokens=5" %a in ('netstat -ano ^| findstr :58888') do taskkill /PID %a /F
|
|
2982
|
-
`)}import SL from"events";import vb from"fs";import bL from"open";import sl from"path";import{fileURLToPath as wL}from"url";import RP from"diff-lines";import{gt as IP}from"semver";import{execSync as dP}from"child_process";import{platform as pP}from"os";function Jd(){return xS()?(b.info("Setting device pixel ratio to 2 automatically since a Mac OS Retina screen was detected."),b.info("If you are using a low pixel-density monitor, you should manually set --pixel-ratio to 1 to avoid incorrect viewport calculations."),b.info("Confirm your device's pixel-ratio at https://www.mydevice.io."),2):(b.info("Setting device pixel ratio to 1."),b.info("If you are using Momentic on a high-pixel density (HiDPI) monitor, relaunch with the --pixel-ratio option to avoid incorrect viewport calculations"),b.info("Confirm your device's pixel-ratio at https://www.mydevice.io."),1)}function xS(){return pP()==="darwin"&&dP("system_profiler SPDisplaysDataType").toString().includes("Retina")}function Xd(n){xS()&&n===1&&(b.warn("If you are using Momentic on a Retina screen, relaunch with the --pixel-ratio option to avoid incorrect viewport calculations."),b.warn("Confirm your device's pixel-ratio at https://www.mydevice.io."))}import uP from"@actions/exec";import mP from"@actions/io";import hP from"quote";import fP from"string-argv";async function TS(n,e=!0){let t=fP(n),r=await mP.which(t[0],!0),o=t.slice(1),i=uP.exec(hP(r),o,{delay:100});if(e)return i}import{existsSync as gP,statSync as yP}from"fs";var Wa=!!process.env.CI||!process.stdout.isTTY||!!process.env.TF_BUILD;function qi(n){try{return gP(n)&&yP(n).isDirectory()}catch(e){return b.error({err:e},`Error reading path ${n} during directory existence check`),!1}}import SP from"csv-parser";import{createReadStream as bP}from"fs";function Zd(n){return new Promise((e,t)=>{let r=[];bP(n).pipe(SP()).on("data",o=>r.push(o)).on("end",()=>e(r)).on("error",o=>t(o))})}import Ga from"semver";import{z as Va}from"zod";var ko="1.0.82",wP="https://registry.npmjs.org/momentic",vP=Va.object({versions:Va.record(Va.string(),Va.unknown()).optional()});async function CS(n){if(!ko){n.warn("Unable to check CLI version because CLI_VERSION is not set");return}let e;for(let r=0;r<2;r++)try{let o=await F(fetch(wP),{milliseconds:2e3});if(!o.ok)throw new Error(`Got error status code ${o.statusText}`);let i=await o.json();e=vP.parse(i).versions;break}catch(o){n.warn({err:o},"Failed to fetch npm registry data")}if(!e){n.warn("Failed to fetch npm registry data. Skipping version check.");return}let t;for(let r of Object.keys(e))Ga.valid(r)&&(!t||Ga.gt(r,t))&&Ga.gt(r,ko)&&Ga.lt(r,"2.0.0")&&!r.includes("alpha")&&(t=r);t&&(b.warn(`Update available: v${ko} -> v${t}`),b.warn("This version may be missing critical fixes, features, and security updates."),b.warn(`Run "npx momentic@${t} -V" to update`))}import{existsSync as TP,mkdirSync as CP,statSync as EP}from"fs";import{dirname as AP}from"path";import AS from"readline/promises";import{hostname as xP}from"os";var $=Ua({app:"cli",clientToken:"pub7eb923f18fb3f1d42ac5eba8c5ea13a5",hostname:xP(),disableConsoleLogs:!0}).child({version:"1.0.82"});var Qd=!1,RS=(()=>{try{return EP("/.dockerenv"),!0}catch{return!1}})();async function nt(n,e){if(Wa||Qd||RS)return!0;$.flush(),await new Promise(s=>setTimeout(s,500));let t=AS.createInterface({input:process.stdin,output:process.stdout}),r=n.split("."),o;if(r.length===1)o=n;else{let s=`${r.slice(0,r.length-1).join(".").trim()}.`;e?b.warn(s):b.log(s),o=r[r.length-1].trim()}let i=await t.question(`${o} ('y' for yes / n for no / 'A' to accept all) `);return t.close(),i==="A"?(Qd=!0,setTimeout(()=>{Qd=!1},3e3),!0):i.toLowerCase()==="y"}async function ep(n){let e=AP(n);return qi(e)?TP(n)?nt(`File '${ES(n)}' already exists. Overwrite existing content?`,!0):!0:await nt(`Directory '${ES(e)}' doesn't exist. Create it now?`,!0)?(CP(e,{recursive:!0}),!0):!1}function ES(n){return n.replace(/(\s+)/g,"\\$1")}async function IS(n,e){if(Wa||RS)return e;let t=AS.createInterface({input:process.stdin,output:process.stdout}),r=await t.question(`${n} `);return t.close(),r.trim()||e}async function PS({test:n,fragment:e,entities:t,client:r,logger:o,yes:i}){IP(e.schemaVersion,ut)&&(b.error(`This version of the CLI does not support the schema version of the fragment (${e.schemaVersion}). Please update to the latest version of the CLI and retry this command.`),process.exit(1)),Zm(e.steps).forEach(f=>{t.modules[f]||(b.error(`The test patch contains a module with id ${f} that could not be found in the current project. This suggests that either this test patch or your local file system may be out of date.`),process.exit(1))}),e.createdAt.getTime()<Date.now()-7*24*60*60*1e3&&!i&&!await nt("The test patch you are applying is more than 7 days old. Are you sure you want to continue?",!0)&&process.exit(1);let a=n.lastModified.getTime();e.createdAt.getTime()+60*60*1e3<a&&!i&&!await nt("The test patch you are applying was created before the test was last updated. Are you sure you want to continue?",!0)&&process.exit(1);let l=ud(n.fullFilePath,o,t),c=l.steps;if(!Array.isArray(c))throw new Error(`Test ${n.fullFilePath} is missing steps array`);let d,p;if(e.schemaVersion!==ut){let{steps:f,newVersion:g}=await yi({metadata:{id:e.id,schemaVersion:e.schemaVersion},steps:e.steps,logger:b});d=g,p=Te.array().parse(f)}else p=Te.array().parse(e.steps);let{stepsToSave:u,moduleUpdates:m}=await It({stepLists:{steps:p}});u.beforeSteps=l.beforeSteps??void 0,u.afterSteps=l.afterSteps??void 0;let h=RP(JSON.stringify(c,void 0,2),JSON.stringify(u,void 0,2),{n_surrounding:5});b.dimmed("=".repeat(30)),b.dimmed(h),b.dimmed("=".repeat(30)),b.dimmed(""),d&&b.warn(`If this patch is applied, your test will also be automatically upgraded to the latest schema version (${d}). Schema upgrades have no impact on functionality, although you may notice minor differences in the test YAML.`),!i&&!await nt("Do you want to apply this patch?")&&(b.dimmed("Cancelled."),process.exit(1)),Ai(n.relativePath,u,d??e.schemaVersion,t.project),b.success("Patch applied successfully."),await r.patchTestFragment(e.id,{applied:!0,appliedAt:new Date})}import{cloneDeep as PP}from"lodash-es";async function qa({client:n,skipPrompts:e,project:t}){let r=await n.getAllEnvironments(),o=PP(t.config);o.environments||(o.environments=[]);for(let i of r){let s=o.environments?.find(a=>a.name===i.name);if(s)!e&&!await nt(`Environment ${i.name} already exists in the project configuration file. Would you like to overwrite its variables?`)&&process.exit(1),s.baseUrl=i.variables[be],delete i.variables[be],s.envVariables=i.variables;else{let a=i.variables[be];delete i.variables[be],o.environments.push({name:i.name,baseUrl:a,envVariables:i.variables})}}Ao(o,t.configFilePath),b.success(`Pulled ${r.length} environments successfully! Please make sure to commit any changes to your project configuration file.`)}import{createHash as LS}from"crypto";import OS from"fs";async function NS({testsToFetch:n,client:e,all:t,yes:r}){let{tests:o,modules:i}=await e.getTestYAMLExport({paths:n,all:t}),s=0;for(let[l,c]of Object.entries(o)){let d=kS(l,we.TEST);!r&&!await ep(d)||(s+=1,OS.writeFileSync(d,c,"utf-8"),$.info({checksum:LS("md5").update(c).digest("hex")},`Wrote '${d}'`))}let a=0;for(let[l,c]of Object.entries(i)){let d=kS(l,we.MODULE);!r&&!await ep(d)||(a+=1,OS.writeFileSync(d,c,"utf-8"),$.info({checksum:LS("md5").update(c).digest("hex")},`Wrote '${d}'`))}s===0?b.success("Pulled 0 tests."):b.success(`Pulled ${s} test${s>1?"s":""}${a?` and ${a} module${a>1?"s":""}`:""}!`)}function kS(n,e){switch(e){case we.TEST:return`${Ee(n)}.${En.TEST}`;case we.MODULE:return`${Ee(n)}.${En.MODULE}`;default:throw new Error(`Unknown entity type ${e}`)}}async function _S(n){let{project:e,client:t,skipPrompts:r}=n;b.info("Welcome to the Momentic Cloud importer wizard! \u{1F636}\u200D\u{1F32B}\uFE0F"),b.info("Importing environments from Momentic Cloud."),b.info(`This command will overwrite all local environment configuration in ${e.configFilePath} with environments from Momentic Cloud.`),await nt("Are you sure you want to proceed?",!0)||(b.info("Aborting..."),process.exit(1)),await qa({client:t,project:e,skipPrompts:r}),b.success(`Successfully imported environments from Momentic Cloud. We recommend pulling secrets out of ${e.configFilePath} into .env files or dynamically set environment variables for security.`),b.info("Importing tests and modules from Momentic Cloud."),await NS({testsToFetch:[],client:t,all:!0,yes:r}),b.success("Successfully imported tests and modules from Momentic Cloud. You can move them to the desired location in your project. We recommend committing these files to version control so you can share them with team members and run Momentic tests in CI.")}import kt from"fs";import Lr from"path";import LP from"yaml";function MS(){qi("momentic")||(b.error(`The migration command should be ran from the v0 root Momentic directory, which should contain a folder called 'momentic'. No folder named 'momentic' was found in the current working directory (${process.cwd()}).`),process.exit(1));let n={name:"default",include:Wi,environments:[]};b.info("Migrating environments");let e=DS(["momentic/environments"],OP);for(let r of e){let o=LP.parse(kt.readFileSync(r,"utf-8"));try{let i=hs.parse(o),s=i.variables[be]??"";delete i.variables[be],n.environments?.push({name:i.name,baseUrl:s,envVariables:i.variables})}catch(i){b.error(`${r} failed to parse as a valid environment file.`),b.error(i),process.exit(1)}}b.info("Migrating tests");let t=pd("./momentic",b);for(let r of t){let o=Lr.join(...r.fullPathSegments),i=Lr.join(Lr.dirname(o),`${r.fileName.slice(0,-5)}.test.yaml`);b.info(`Moving test ${o} to ${i}`),kt.renameSync(o,i)}if(qi("momentic/modules")){b.info("Migrating modules");for(let r of kt.readdirSync("./momentic/modules")){if(!r.endsWith(".yaml"))continue;let o=Lr.resolve(Lr.join("./momentic/modules",r));if(!kt.readFileSync(o,"utf-8").includes("schemaVersion")){b.warn(`Skipping file ${o} since it does not have valid Momentic module contents`);continue}let s=`${o.slice(0,-5)}.module.yaml`;b.info(`Moving module ${o} to ${s}`),kt.renameSync(o,s)}}return b.info("Writing new project configuration file"),Ao(n,"momentic.config.yaml"),kt.rmSync("./momentic/environments",{recursive:!0,force:!0}),kt.rmSync("./momentic/fixtures",{recursive:!0,force:!0}),b.success("Migration succeeded!"),b.info("Going forward:"),b.info(` - You can store test and module files anywhere under the project root (${process.cwd()})`),b.info(" - Environment details and other common options are tracked in the root momentic.config.yaml file"),n}function DS(n,e,t=new Set){for(let r of n){let o=Lr.resolve(r),i=!1;try{i=kt.existsSync(o)&&kt.statSync(o).isDirectory()}catch(s){b.error({err:s},`Error reading path ${o} during collect paths`)}if(o&&i){let s=kt.readdirSync(o).map(a=>Lr.join(o,a));DS(s,e,t);continue}if(o.endsWith(".yaml")){try{if(!kt.existsSync(o)||!kt.statSync(o).isFile()){b.warn(`File not found or unreadable: ${o}`);continue}}catch(s){b.error({err:s},`Error reading file ${o} during collect paths`);continue}if(!e(o))continue;t.add(o)}}return t}function OP(n){return n.endsWith(".yaml")?kt.readFileSync(n,"utf8").includes("momentic/environment")?!0:(b.warn(`Skipping YAML that is not a Momentic environment: ${n}`),!1):!1}import{Argument as Ka,Option as Me}from"@commander-js/extra-typings";import{validateHeaderValue as kP}from"http";import{cpus as FS}from"os";import{parse as eoe}from"yaml";import{z as B}from"zod";var Ya=58888,tp=30*60*1e3,Jn=new Me("--api-key <key>","API key for authentication. If not supplied, attempts to read the MOMENTIC_API_KEY env var."),Or=new Me("--server <server>","Momentic server to use. Leave unchanged unless using Momentic on-premise."),Xn=new Me("-y, --yes","Skip all confirmation prompts."),np=new Me("-w, --wait","Wait for tests to finish running before exiting. Only applicable when running tests remotely").implies({remote:!0}),rp=new Me("--wait-timeout <waitTimeout>",`The maximum number of seconds to wait for tests to complete. Only applicable when the --wait option is specified. Defaults to ${tp/1e3} seconds.`),Ja=new Me("--custom-headers <customHeaders...>","Specify custom headers in the form HEADER=VALUE to be sent with each request during the test. Multiple entries can be provided."),op=new Me("--no-report","Skip reporting test results to Momentic Cloud when running with the --local flag.").implies({local:!0}),zS=new Me("--reporter <reporter>","Output report files in a standardized format to a local directory. See the --reporter-dir flag for information on the output directory.").choices(Object.values(As)),BS=new Me("--reporter-dir <reporterDir>","Output directory to store report files. Relative paths are resolved relative to the project root, which is defined by the detected momentic.config.yaml. Defaults to 'reports' if unset."),jS=new Me("--include <includePatterns...>","Only include tests that match the provided regex patterns. Multiple patterns can be provided. The patterns will be matched against the test file paths and the pattern only needs to match a part of the path for the test to be included."),$S=new Me("--exclude <excludePatterns...>","The inverted version of --include: a test that matches any of the provided exclusion patterns will be excluded from running."),ip=new Me("--pixel-ratio <pixelRatio>","Device pixel ratio of your screen or monitor. Mac OS Retina displays and machines marketed as 'HiDPI' should set this to 2. Visit https://www.mydevice.io/ to find your device's pixel ratio."),HS=new Me("--port <port>",`Port to run the app on. Defaults to ${Ya}.`),sp=new Me("--input-csv <inputCsv>","Path to a CSV file on disk where each row represents a set of inputs that will be made available to all tests that are ran. The first line of the CSV must be the input names."),Xa=new Me("--env <env>","Name of the environment to use when running tests."),Za=new Me("--url-override <urlOverride>","Fully qualified url (e.g. https://www.google.com) to start all tests from. Overrides any default starting url set from the test or environment."),WS=new Me("--shard-index <shardIndex>","The index of the shard to run tests for. Defaults to 1.").default(1).argParser(n=>parseInt(n,10)),kr=new Me("-c, --config <configPath>","Absolute or relative path to a Momentic configuration file (*.momentic.config.yaml)"),ap=new Me("-f, --filter <filter>","Run tests within the project that has a name equal to the filter provided. This option cannot be used together with file path or directory arguments, but substring matches are allowed."),GS=new Me("--shard-count <shardCount>","The number of shards that tests are being run on. Defaults to 1.").default(1).argParser(n=>parseInt(n,10)),VS=new Ka("<tests...>",`One or more test paths to queue on Momentic Cloud.
|
|
2982
|
+
`)}import SL from"events";import vb from"fs";import bL from"open";import sl from"path";import{fileURLToPath as wL}from"url";import RP from"diff-lines";import{gt as IP}from"semver";import{execSync as dP}from"child_process";import{platform as pP}from"os";function Jd(){return xS()?(b.info("Setting device pixel ratio to 2 automatically since a Mac OS Retina screen was detected."),b.info("If you are using a low pixel-density monitor, you should manually set --pixel-ratio to 1 to avoid incorrect viewport calculations."),b.info("Confirm your device's pixel-ratio at https://www.mydevice.io."),2):(b.info("Setting device pixel ratio to 1."),b.info("If you are using Momentic on a high-pixel density (HiDPI) monitor, relaunch with the --pixel-ratio option to avoid incorrect viewport calculations"),b.info("Confirm your device's pixel-ratio at https://www.mydevice.io."),1)}function xS(){return pP()==="darwin"&&dP("system_profiler SPDisplaysDataType").toString().includes("Retina")}function Xd(n){xS()&&n===1&&(b.warn("If you are using Momentic on a Retina screen, relaunch with the --pixel-ratio option to avoid incorrect viewport calculations."),b.warn("Confirm your device's pixel-ratio at https://www.mydevice.io."))}import uP from"@actions/exec";import mP from"@actions/io";import hP from"quote";import fP from"string-argv";async function TS(n,e=!0){let t=fP(n),r=await mP.which(t[0],!0),o=t.slice(1),i=uP.exec(hP(r),o,{delay:100});if(e)return i}import{existsSync as gP,statSync as yP}from"fs";var Wa=!!process.env.CI||!process.stdout.isTTY||!!process.env.TF_BUILD;function qi(n){try{return gP(n)&&yP(n).isDirectory()}catch(e){return b.error({err:e},`Error reading path ${n} during directory existence check`),!1}}import SP from"csv-parser";import{createReadStream as bP}from"fs";function Zd(n){return new Promise((e,t)=>{let r=[];bP(n).pipe(SP()).on("data",o=>r.push(o)).on("end",()=>e(r)).on("error",o=>t(o))})}import Ga from"semver";import{z as Va}from"zod";var ko="1.0.83",wP="https://registry.npmjs.org/momentic",vP=Va.object({versions:Va.record(Va.string(),Va.unknown()).optional()});async function CS(n){if(!ko){n.warn("Unable to check CLI version because CLI_VERSION is not set");return}let e;for(let r=0;r<2;r++)try{let o=await F(fetch(wP),{milliseconds:2e3});if(!o.ok)throw new Error(`Got error status code ${o.statusText}`);let i=await o.json();e=vP.parse(i).versions;break}catch(o){n.warn({err:o},"Failed to fetch npm registry data")}if(!e){n.warn("Failed to fetch npm registry data. Skipping version check.");return}let t;for(let r of Object.keys(e))Ga.valid(r)&&(!t||Ga.gt(r,t))&&Ga.gt(r,ko)&&Ga.lt(r,"2.0.0")&&!r.includes("alpha")&&(t=r);t&&(b.warn(`Update available: v${ko} -> v${t}`),b.warn("This version may be missing critical fixes, features, and security updates."),b.warn(`Run "npx momentic@${t} -V" to update`))}import{existsSync as TP,mkdirSync as CP,statSync as EP}from"fs";import{dirname as AP}from"path";import AS from"readline/promises";import{hostname as xP}from"os";var $=Ua({app:"cli",clientToken:"pub7eb923f18fb3f1d42ac5eba8c5ea13a5",hostname:xP(),disableConsoleLogs:!0}).child({version:"1.0.83"});var Qd=!1,RS=(()=>{try{return EP("/.dockerenv"),!0}catch{return!1}})();async function nt(n,e){if(Wa||Qd||RS)return!0;$.flush(),await new Promise(s=>setTimeout(s,500));let t=AS.createInterface({input:process.stdin,output:process.stdout}),r=n.split("."),o;if(r.length===1)o=n;else{let s=`${r.slice(0,r.length-1).join(".").trim()}.`;e?b.warn(s):b.log(s),o=r[r.length-1].trim()}let i=await t.question(`${o} ('y' for yes / n for no / 'A' to accept all) `);return t.close(),i==="A"?(Qd=!0,setTimeout(()=>{Qd=!1},3e3),!0):i.toLowerCase()==="y"}async function ep(n){let e=AP(n);return qi(e)?TP(n)?nt(`File '${ES(n)}' already exists. Overwrite existing content?`,!0):!0:await nt(`Directory '${ES(e)}' doesn't exist. Create it now?`,!0)?(CP(e,{recursive:!0}),!0):!1}function ES(n){return n.replace(/(\s+)/g,"\\$1")}async function IS(n,e){if(Wa||RS)return e;let t=AS.createInterface({input:process.stdin,output:process.stdout}),r=await t.question(`${n} `);return t.close(),r.trim()||e}async function PS({test:n,fragment:e,entities:t,client:r,logger:o,yes:i}){IP(e.schemaVersion,ut)&&(b.error(`This version of the CLI does not support the schema version of the fragment (${e.schemaVersion}). Please update to the latest version of the CLI and retry this command.`),process.exit(1)),Zm(e.steps).forEach(f=>{t.modules[f]||(b.error(`The test patch contains a module with id ${f} that could not be found in the current project. This suggests that either this test patch or your local file system may be out of date.`),process.exit(1))}),e.createdAt.getTime()<Date.now()-7*24*60*60*1e3&&!i&&!await nt("The test patch you are applying is more than 7 days old. Are you sure you want to continue?",!0)&&process.exit(1);let a=n.lastModified.getTime();e.createdAt.getTime()+60*60*1e3<a&&!i&&!await nt("The test patch you are applying was created before the test was last updated. Are you sure you want to continue?",!0)&&process.exit(1);let l=ud(n.fullFilePath,o,t),c=l.steps;if(!Array.isArray(c))throw new Error(`Test ${n.fullFilePath} is missing steps array`);let d,p;if(e.schemaVersion!==ut){let{steps:f,newVersion:g}=await yi({metadata:{id:e.id,schemaVersion:e.schemaVersion},steps:e.steps,logger:b});d=g,p=Te.array().parse(f)}else p=Te.array().parse(e.steps);let{stepsToSave:u,moduleUpdates:m}=await It({stepLists:{steps:p}});u.beforeSteps=l.beforeSteps??void 0,u.afterSteps=l.afterSteps??void 0;let h=RP(JSON.stringify(c,void 0,2),JSON.stringify(u,void 0,2),{n_surrounding:5});b.dimmed("=".repeat(30)),b.dimmed(h),b.dimmed("=".repeat(30)),b.dimmed(""),d&&b.warn(`If this patch is applied, your test will also be automatically upgraded to the latest schema version (${d}). Schema upgrades have no impact on functionality, although you may notice minor differences in the test YAML.`),!i&&!await nt("Do you want to apply this patch?")&&(b.dimmed("Cancelled."),process.exit(1)),Ai(n.relativePath,u,d??e.schemaVersion,t.project),b.success("Patch applied successfully."),await r.patchTestFragment(e.id,{applied:!0,appliedAt:new Date})}import{cloneDeep as PP}from"lodash-es";async function qa({client:n,skipPrompts:e,project:t}){let r=await n.getAllEnvironments(),o=PP(t.config);o.environments||(o.environments=[]);for(let i of r){let s=o.environments?.find(a=>a.name===i.name);if(s)!e&&!await nt(`Environment ${i.name} already exists in the project configuration file. Would you like to overwrite its variables?`)&&process.exit(1),s.baseUrl=i.variables[be],delete i.variables[be],s.envVariables=i.variables;else{let a=i.variables[be];delete i.variables[be],o.environments.push({name:i.name,baseUrl:a,envVariables:i.variables})}}Ao(o,t.configFilePath),b.success(`Pulled ${r.length} environments successfully! Please make sure to commit any changes to your project configuration file.`)}import{createHash as LS}from"crypto";import OS from"fs";async function NS({testsToFetch:n,client:e,all:t,yes:r}){let{tests:o,modules:i}=await e.getTestYAMLExport({paths:n,all:t}),s=0;for(let[l,c]of Object.entries(o)){let d=kS(l,we.TEST);!r&&!await ep(d)||(s+=1,OS.writeFileSync(d,c,"utf-8"),$.info({checksum:LS("md5").update(c).digest("hex")},`Wrote '${d}'`))}let a=0;for(let[l,c]of Object.entries(i)){let d=kS(l,we.MODULE);!r&&!await ep(d)||(a+=1,OS.writeFileSync(d,c,"utf-8"),$.info({checksum:LS("md5").update(c).digest("hex")},`Wrote '${d}'`))}s===0?b.success("Pulled 0 tests."):b.success(`Pulled ${s} test${s>1?"s":""}${a?` and ${a} module${a>1?"s":""}`:""}!`)}function kS(n,e){switch(e){case we.TEST:return`${Ee(n)}.${En.TEST}`;case we.MODULE:return`${Ee(n)}.${En.MODULE}`;default:throw new Error(`Unknown entity type ${e}`)}}async function _S(n){let{project:e,client:t,skipPrompts:r}=n;b.info("Welcome to the Momentic Cloud importer wizard! \u{1F636}\u200D\u{1F32B}\uFE0F"),b.info("Importing environments from Momentic Cloud."),b.info(`This command will overwrite all local environment configuration in ${e.configFilePath} with environments from Momentic Cloud.`),await nt("Are you sure you want to proceed?",!0)||(b.info("Aborting..."),process.exit(1)),await qa({client:t,project:e,skipPrompts:r}),b.success(`Successfully imported environments from Momentic Cloud. We recommend pulling secrets out of ${e.configFilePath} into .env files or dynamically set environment variables for security.`),b.info("Importing tests and modules from Momentic Cloud."),await NS({testsToFetch:[],client:t,all:!0,yes:r}),b.success("Successfully imported tests and modules from Momentic Cloud. You can move them to the desired location in your project. We recommend committing these files to version control so you can share them with team members and run Momentic tests in CI.")}import kt from"fs";import Lr from"path";import LP from"yaml";function MS(){qi("momentic")||(b.error(`The migration command should be ran from the v0 root Momentic directory, which should contain a folder called 'momentic'. No folder named 'momentic' was found in the current working directory (${process.cwd()}).`),process.exit(1));let n={name:"default",include:Wi,environments:[]};b.info("Migrating environments");let e=DS(["momentic/environments"],OP);for(let r of e){let o=LP.parse(kt.readFileSync(r,"utf-8"));try{let i=hs.parse(o),s=i.variables[be]??"";delete i.variables[be],n.environments?.push({name:i.name,baseUrl:s,envVariables:i.variables})}catch(i){b.error(`${r} failed to parse as a valid environment file.`),b.error(i),process.exit(1)}}b.info("Migrating tests");let t=pd("./momentic",b);for(let r of t){let o=Lr.join(...r.fullPathSegments),i=Lr.join(Lr.dirname(o),`${r.fileName.slice(0,-5)}.test.yaml`);b.info(`Moving test ${o} to ${i}`),kt.renameSync(o,i)}if(qi("momentic/modules")){b.info("Migrating modules");for(let r of kt.readdirSync("./momentic/modules")){if(!r.endsWith(".yaml"))continue;let o=Lr.resolve(Lr.join("./momentic/modules",r));if(!kt.readFileSync(o,"utf-8").includes("schemaVersion")){b.warn(`Skipping file ${o} since it does not have valid Momentic module contents`);continue}let s=`${o.slice(0,-5)}.module.yaml`;b.info(`Moving module ${o} to ${s}`),kt.renameSync(o,s)}}return b.info("Writing new project configuration file"),Ao(n,"momentic.config.yaml"),kt.rmSync("./momentic/environments",{recursive:!0,force:!0}),kt.rmSync("./momentic/fixtures",{recursive:!0,force:!0}),b.success("Migration succeeded!"),b.info("Going forward:"),b.info(` - You can store test and module files anywhere under the project root (${process.cwd()})`),b.info(" - Environment details and other common options are tracked in the root momentic.config.yaml file"),n}function DS(n,e,t=new Set){for(let r of n){let o=Lr.resolve(r),i=!1;try{i=kt.existsSync(o)&&kt.statSync(o).isDirectory()}catch(s){b.error({err:s},`Error reading path ${o} during collect paths`)}if(o&&i){let s=kt.readdirSync(o).map(a=>Lr.join(o,a));DS(s,e,t);continue}if(o.endsWith(".yaml")){try{if(!kt.existsSync(o)||!kt.statSync(o).isFile()){b.warn(`File not found or unreadable: ${o}`);continue}}catch(s){b.error({err:s},`Error reading file ${o} during collect paths`);continue}if(!e(o))continue;t.add(o)}}return t}function OP(n){return n.endsWith(".yaml")?kt.readFileSync(n,"utf8").includes("momentic/environment")?!0:(b.warn(`Skipping YAML that is not a Momentic environment: ${n}`),!1):!1}import{Argument as Ka,Option as Me}from"@commander-js/extra-typings";import{validateHeaderValue as kP}from"http";import{cpus as FS}from"os";import{parse as eoe}from"yaml";import{z as B}from"zod";var Ya=58888,tp=30*60*1e3,Jn=new Me("--api-key <key>","API key for authentication. If not supplied, attempts to read the MOMENTIC_API_KEY env var."),Or=new Me("--server <server>","Momentic server to use. Leave unchanged unless using Momentic on-premise."),Xn=new Me("-y, --yes","Skip all confirmation prompts."),np=new Me("-w, --wait","Wait for tests to finish running before exiting. Only applicable when running tests remotely").implies({remote:!0}),rp=new Me("--wait-timeout <waitTimeout>",`The maximum number of seconds to wait for tests to complete. Only applicable when the --wait option is specified. Defaults to ${tp/1e3} seconds.`),Ja=new Me("--custom-headers <customHeaders...>","Specify custom headers in the form HEADER=VALUE to be sent with each request during the test. Multiple entries can be provided."),op=new Me("--no-report","Skip reporting test results to Momentic Cloud when running with the --local flag.").implies({local:!0}),zS=new Me("--reporter <reporter>","Output report files in a standardized format to a local directory. See the --reporter-dir flag for information on the output directory.").choices(Object.values(As)),BS=new Me("--reporter-dir <reporterDir>","Output directory to store report files. Relative paths are resolved relative to the project root, which is defined by the detected momentic.config.yaml. Defaults to 'reports' if unset."),jS=new Me("--include <includePatterns...>","Only include tests that match the provided regex patterns. Multiple patterns can be provided. The patterns will be matched against the test file paths and the pattern only needs to match a part of the path for the test to be included."),$S=new Me("--exclude <excludePatterns...>","The inverted version of --include: a test that matches any of the provided exclusion patterns will be excluded from running."),ip=new Me("--pixel-ratio <pixelRatio>","Device pixel ratio of your screen or monitor. Mac OS Retina displays and machines marketed as 'HiDPI' should set this to 2. Visit https://www.mydevice.io/ to find your device's pixel ratio."),HS=new Me("--port <port>",`Port to run the app on. Defaults to ${Ya}.`),sp=new Me("--input-csv <inputCsv>","Path to a CSV file on disk where each row represents a set of inputs that will be made available to all tests that are ran. The first line of the CSV must be the input names."),Xa=new Me("--env <env>","Name of the environment to use when running tests."),Za=new Me("--url-override <urlOverride>","Fully qualified url (e.g. https://www.google.com) to start all tests from. Overrides any default starting url set from the test or environment."),WS=new Me("--shard-index <shardIndex>","The index of the shard to run tests for. Defaults to 1.").default(1).argParser(n=>parseInt(n,10)),kr=new Me("-c, --config <configPath>","Absolute or relative path to a Momentic configuration file (*.momentic.config.yaml)"),ap=new Me("-f, --filter <filter>","Run tests within the project that has a name equal to the filter provided. This option cannot be used together with file path or directory arguments, but substring matches are allowed."),GS=new Me("--shard-count <shardCount>","The number of shards that tests are being run on. Defaults to 1.").default(1).argParser(n=>parseInt(n,10)),VS=new Ka("<tests...>",`One or more test paths to queue on Momentic Cloud.
|
|
2983
2983
|
|
|
2984
2984
|
A test path is a lowercased version of your test name where spaces are replaced with dashes: 'npx momentic@latest pull hello-world'.`),qS=new Ka("<tests...>","One or more test file path or folders that exist on the local machine: 'npx momentic@latest run hello-world.test.yaml'.").argOptional(),KS=new Ka("<suites...>",`One or more suite paths that exist on Momentic Cloud.
|
|
2985
2985
|
|
|
@@ -2994,6 +2994,6 @@ ${n.map(p=>` - ${p}`).join(`
|
|
|
2994
2994
|
${n.map(p=>` - ${p}`).join(`
|
|
2995
2995
|
`)}`),Object.values(e.tests).forEach(p=>{n.some(u=>p.relativePath.includes(u))&&a.add(p.fullFilePath)}))}else{!r&&!await nt("No test paths or substrings were provided. Do you want to run all tests?")&&(b.error("Cancelled by user."),process.exit(1));let c=Object.values(e.tests);b.info(`Reading all ${c.length} tests in the project from local disk.`),c.forEach(d=>{a.add(d.fullFilePath)})}for(let c of a){let d=hp.relative(t.rootDir,c);o&&!o.some(p=>new RegExp(p).test(d))&&a.delete(c),i&&i.some(p=>new RegExp(p).test(d))&&a.delete(c)}let l=Array.from(a).map(async c=>{try{let d=await Sa(c,$,e);if(iL.gt(d.schemaVersion,ut)&&b.warn(`Test ${c} has schema version ${d.schemaVersion}, which is greater than what is currently supported by this SDK. Please update your momentic package version to avoid unexpected behavior.`),d.disabled)return null;if(s&&s.length>0){let p=d.labels||[];if(!s.some(m=>p.includes(m)))return null}return{...d,fullFilePath:c,relativeFilePath:hp.relative(t.rootDir,c)}}catch(d){b.error(`Failed to read and resolve test at '${c}': ${d}`),process.exit(1)}});return Promise.all(l).then(rL)}import{randomUUID as cL}from"crypto";import{cloneDeep as yb}from"lodash-es";async function ub({orgId:n,codeEvalTools:e,logger:t,outputDefinitions:r,testContext:o}){let i={};for(let s of r){let{name:a,value:l}=s;i[a]=await Pt({orgId:n,s:l,localTools:e,logger:t,context:o})}return i}async function mb({baseUrl:n,envName:e,devicePixelRatio:t,apiClient:r,test:o,storageClient:i,codeEvalTools:s,generator:a,orgId:l,variables:c,logger:d,customHeaders:p,testInputs:u,analytics:m,localBrowserConfigFromEnv:h,visualDiffScreenshotStorage:f}){let g=await oa({advanced:{...h,...o.advanced},customHeaders:p,envVariables:c,envName:e,baseUrl:n,logger:d,localTools:s,orgId:l}),y=await oo.init(l),v={baseUrl:r.baseUrl,apiKey:r.apiKey};g.browserType==="Google Chrome"&&await Nr(["chrome"]);let S;try{S=await Qt.init({baseUrl:n,logger:d,userBrowserSettings:g,storage:i,featureFlagStore:y,enricher:new xr(v),timeout:g.pageLoadTimeoutMs,contextArgs:{viewport:o.advanced.viewport??Yt,deviceScaleFactor:t}})}catch(E){let P=E.message;if(P.includes("Executable doesn't exist")||P.includes("install your dependencies"))b.error("The headless browser used by Momentic is not installed correctly. Re-installing the necessary dependencies before starting the test. If this issue persists, pleases contact Momentic Support."),await Nr(lp,!0),S=await Qt.init({baseUrl:n,logger:d,userBrowserSettings:g,storage:i,featureFlagStore:y,enricher:new xr(v),timeout:g.pageLoadTimeoutMs,contextArgs:{viewport:o.advanced.viewport??Yt,deviceScaleFactor:t}});else throw E}let T=new uo({browser:S,generator:a,logger:d,orgId:l,scratchPadId:void 0,storage:i,flagStore:y,localCodeEvalTools:s,visualDiffScreenshotStorage:f,analytics:m}),C=new wt({baseUrl:n,currentUrl:T.browser.url(),variablesFromEnvironment:c,envName:e});return o.parameters&&await Promise.all(o.parameters.map(async E=>{let{name:P,defaultValue:L,required:_}=E,K=u?.[P];_&&K===void 0&&(b.error(`Required parameter '${P}' is required by test '${o.name}' but not provided`),process.exit(1));let Z=await Pt({orgId:l,s:K??L,localTools:s,logger:d,context:wt.dummyContext(C.getEnvName())});C.setMomenticSystemVariable(P,Z)})),{controller:T,context:C,flagStore:y}}import{randomUUID as sL}from"crypto";import{diff as aL}from"deep-object-diff";import{cloneDeep as fb}from"lodash-es";import{debounce as lL}from"ts-debounce";async function hb({testId:n,apiClient:e,testAdvancedSettings:t,aiSettingsFromEnv:r,logger:o,noReport:i}){if(i)return o.debug("The CLI is not running in a CI environment or --no-report was explicitly passed"),!1;if(t.failureRecovery===!1||t.failureRecovery===void 0&&!r?.failureRecovery)return!1;let s;try{s=await e.getPastTestResults(n,{afterTime:Date.now()-7*24*60*60*1e3})}catch(l){return o.error({err:l},"Test is not eligible for recovery since we failed to fetch the recent test results"),!1}return s.some(l=>l.status==="PASSED")?!0:(o.debug({recentRuns:s},"Test is not eligible for recovery because there are only failures in the past 7 days"),!1)}async function gb({attemptInputs:n,attemptFixtures:e,attemptMetadata:t}){let{attemptNumber:r,orgId:o,runId:i,runAttemptId:s}=t,{controller:a,context:l,flagStore:c,analytics:d,codeEvalTools:p,storageClient:u,debugDataClient:m,logger:h,apiClient:f,billingReporter:g}=e,{test:y,orgSettings:v,noReport:S}=n;h.info(`Running test '${y.name}' locally${S?"":` and reporting results to https://app.momentic.ai/runs/${i}`}`);let T=fb({steps:y.steps,beforeSteps:y.beforeSteps,afterSteps:y.afterSteps}),C=async O=>{if(!(S||!i))try{if(O.results){let I=fb(O.results);Hs(I,h),O.results=I}await f.updateRun(i,{...O,updatedAt:new Date})}catch(I){h.warn({err:I},"Failed to update run data. You may see stale data on the Momentic Cloud Server.")}},E=lL(async O=>{S||await C(O)},1e4,{maxWait:3e4}),P=async O=>{try{await E(O)}catch{}},L={controller:a,storage:u,debugDataStorage:m,billingReporter:g,analytics:d,context:l,logger:h,codeEvalTools:p},_={orgId:o,runId:i||sL(),runAttemptId:s,testMetadata:y,steps:y.steps,beforeSteps:y.beforeSteps,afterSteps:y.afterSteps},K={collectDebugData:!0,reinitializeBrowser:!0,disableHealing:!await hb({noReport:S,currentAttempt:r,testId:y.id,flagStore:c,apiClient:f,testAdvancedSettings:y.advanced,aiSettingsFromEnv:v.ai,logger:h})},Z={step:{},test:{onTestComplete:async()=>{await a.browser.cleanup()},onSaveScreenshot:async O=>{if(S)return"";let{key:I}=await f.uploadScreenshot({screenshot:O.toString("base64")});return I},onUpdateRun:O=>{P(O)},onSaveFinalRunResults:async O=>{E.cancel(),await C(O)},onProposedTestSteps:async O=>f.uploadProposedSteps(O,h),onTestSuccess:async O=>{let I=aL(T,O);if(Object.keys(I).length!==0){h.debug({changes:I},"Updating steps post-run success in worker");try{let{cachesToSave:ne}=await It({stepLists:O,cacheCreationParams:{testId:y.id,orgId:o}});await f.updateStepCaches({testId:y.id,entries:ne})}catch(ne){h.error({err:ne},"Failed to save step caches after successful execution. This is not critical, but can impact future performance.")}}}}};return await g.reportBillableEvent(h,"test-run",{eventId:i,testId:y.id,testName:y.name}),await ra({fixtures:L,inputs:_,options:K,callbacks:Z})}async function Sb(n){let e=new Date,{testDefinition:t}=n;try{return await dL(n)}catch(r){let o="Fatal error running test";return b.error(`${o}: ${r.message}`),$.error({err:r},o),{parameters:n,failureReason:"UnknownError",failureDetails:{errorMessage:r.message,errorStack:r.stack},status:"FAILED",attempts:0,test:t,filePath:t.relativeFilePath,startedAt:e,finishedAt:new Date,outputs:{}}}}async function dL(n){let{testDefinition:e,project:t,apiClient:r,orgId:o,noReport:i,urlOverride:s,runGroupId:a,runSigIntHandlers:l}=n,c=new Zr(r,o),d=new Un({httpClient:new pn({baseUrl:r.baseUrl,apiKey:r.apiKey})}),p=e.steps,u=yb(e.steps);try{await c.resolveStepCacheEntries({organizationId:o,testId:e.id,steps:u,schemaVersion:e.schemaVersion,logger:$})}catch(v){throw $.error({err:v},"Failed to resolve step cache entries"),new Error(`Failed to resolve step cache entries. Please ensure you are running using a supported version of Momentic. If you believe this is an error, please contact Momentic Support with the following error: ${v}`)}let m=n.envName??uL(e),h,f={};if(m){try{h=Ri(m,t,$)}catch(v){let S=`Failed to resolve environment ${m} for test ${e.name}: ${v}`;throw new Error(S)}f=h.variables}let g=e.baseUrl;if(s)g=s;else if(!g){let v=f[be];typeof v=="string"&&(g=v)}if(!g){let v=`Cannot run test with no base URL and no ${be} variable defined in its environment`;throw new Error(v)}let y;if(!i)try{y=(await r.createRun({stepsSnapshot:p,runGroupId:a,testId:e.id,testName:e.name,trigger:"CLI",resolvedBaseUrl:g,environmentName:m,schemaVersion:e.schemaVersion})).id}catch(v){throw $.error({err:v,testId:e.id},"Error creating run on Momentic Cloud"),new Error(`Error creating run on Momentic Cloud. Please ensure Momentic is accessible from your environment.
|
|
2996
2996
|
If you believe this is an error, please contact Momentic Support with the following error message: ${v}`)}try{return l?.push(async()=>{!y||i||await r.updateRun(y,{status:"CANCELLED",updatedAt:new Date})}),pL({...n,variables:f,envName:m,runId:y,stepsWithCaches:u,resolvedEnv:h,baseUrl:g,storageClient:c,codeEvalTools:d})}finally{l?.pop()}}async function pL(n){let{testDefinition:e,stepsWithCaches:t,project:r,regenerateGoldenFiles:o,apiClient:i,generator:s,baseUrl:a,storageClient:l,codeEvalTools:c,runId:d,orgId:p,envName:u,urlOverride:m,customHeaders:h,testInputs:f,variables:g,analytics:y,resolvedEnv:v,noReport:S,retriesOverride:T,billingReporter:C,devicePixelRatio:E,logUpdate:P}=n,L=new Date,_=new Io(r,o),K={ai:r.config.ai},Z=new Jr(i,p),ke={envName:u,urlOverride:m,customHeaders:h,testInputs:f};d&&(g[lf]=d);let O=$.child({testId:e.id,runId:d,orgId:p}),I=y.child({test_id:e.id,test_name:e.name,label_names:e.labels,run_id:d});I.track({type:"execution:test_start"});let ne=async xe=>{if(!(S||!d))try{await i.updateRun(d,xe)}catch(Q){O.warn({err:Q},`Failed to update run status for test ${d}. You may see stale data on the Momentic Cloud Server.`)}},k,ve=Math.max(T??e.retries,0),le=[];O.info("Starting test run using CLI");for(let xe=0;xe<=ve;xe++){let Q=cL(),Se={...e,steps:yb(t)};if(!S&&d)try{Q=(await i.createRunAttempt(d)).id}catch(De){throw O.error({err:De,testId:Se.id,runId:d},"Error creating run attempt on Momentic Cloud"),new Error("Error creating run attempt on Momentic Cloud. Please ensure Momentic is accessible from your environment or pass the --no-report flag.")}xe!==0&&P("RETRY",`attempt ${xe+1}/${ve+1}`);let pt=async De=>{if(!(S||!d))try{await i.updateRunAttempt(d,Q,De)}catch(M){O.warn({err:M},`Failed to update run attempt for attempt ${Q}. You may see stale data on the Momentic Cloud Server.`)}};try{await ne({status:"RUNNING",attempts:xe+1});let{controller:De,context:M,flagStore:on}=await mb({baseUrl:a,envName:u,apiClient:i,devicePixelRatio:E,logger:O,storageClient:l,codeEvalTools:c,test:Se,generator:s,orgId:p,variables:g,customHeaders:h,testInputs:f,localBrowserConfigFromEnv:v?.browser,visualDiffScreenshotStorage:_,analytics:I});k=await gb({attemptMetadata:{attemptNumber:xe+1,orgId:p,runId:d,runAttemptId:Q},attemptFixtures:{logger:O,storageClient:l,billingReporter:C,analytics:I,debugDataClient:Z,codeEvalTools:c,flagStore:on,apiClient:i,context:M,controller:De},attemptInputs:{test:Se,orgSettings:K,noReport:S}}),await pt({status:k.status,finishedAt:new Date,results:k.results,beforeResults:k.beforeResults,afterResults:k.afterResults}),le.unshift(k.status);let pe=await ub({orgId:p,codeEvalTools:c,logger:O,outputDefinitions:e.outputs??[],testContext:M}),Be=new Date,Et=Iu(le),Ye=Be.getTime()-L.getTime(),sn=xe+1;if(k.status!=="FAILED")return k.status==="PASSED"&&I.track({type:"execution:test_success",attempt_count:sn,duration_ms:Ye,is_flake:Et}),await ne({status:k.status,finishedAt:Be,flake:Et}),{...k,parameters:ke,runId:d,test:Se,filePath:Se.relativeFilePath,startedAt:L,finishedAt:Be,attempts:sn,baseUrl:a,outputs:pe};let _r=k.failedStepResult,Kt=_r?.message||"Unknown failure",Do=_r?.failureReason??im(Kt)??"UnknownError",Qn=O.child({errResult:_r,failureReason:Do,errorMessage:Kt,numAttempts:ve+1,name:Se.name});if(xe<ve){Qn.warn(`Retrying failed execution attempt for run ${d}: ${Kt}`);continue}Qn.error(`Test failed after all exhausting attempts: ${Kt}`);let Fo={errorMessage:Kt};return await ne({status:"FAILED",finishedAt:Be,failureDetails:Fo,failureReason:Do}),I.track({type:"execution:test_fail",attempt_count:xe+1,duration_ms:Be.getTime()-L.getTime(),fail_reason:Fo.errorMessage}),{...k,parameters:ke,runId:d,failureDetails:Fo,failureReason:Do,test:Se,filePath:Se.relativeFilePath,startedAt:L,finishedAt:new Date,attempts:xe+1,baseUrl:a,outputs:pe}}catch(De){let M=`Encountered fatal platform error while running test '${Se.name}': ${De}`,on=new Date,pe=xe+1;O.error({err:De},M),b.error(M);let Be={errorMessage:De.message,errStack:De.stack},Et={status:"FAILED",failureDetails:Be,failureReason:"InternalPlatformError",finishedAt:on};return await Promise.all([pt(Et),ne(Et)]),I.track({type:"execution:test_fail",attempt_count:pe,duration_ms:on.getTime()-L.getTime(),fail_reason:Be.errorMessage}),{...Et,parameters:ke,runId:d,test:Se,filePath:Se.relativeFilePath,startedAt:L,finishedAt:new Date,attempts:pe,baseUrl:a,outputs:{}}}}throw new Error("This code should not be reachable")}function uL(n){for(let e of n.envs??[])if(e.default)return e.name}async function bb(n){let{tests:e,yes:t,start:r,waitOn:o,client:i,billingReporter:s,analytics:a,project:l,report:c,retriesOverride:d,urlOverride:p,envName:u,orgId:m,devicePixelRatio:h,customHeaders:f,testInputMatrix:g,reporter:y,include:v,exclude:S,labels:T,reporterDir:C="reports",waitOnTimeout:E=60,parallel:P=1,shardIndex:L=1,shardCount:_=1,regenerateGoldenFiles:K}=n;r&&($.info({orgId:m},`Executing start command: ${r}`),await TS(r,!1)),o&&($.info({orgId:m},`Waiting for url: ${o} with timeout: ${E} seconds.`),await hL({resources:[o],interval:2500,timeout:E*1e3,headers:{Accept:"*/*"},followRedirect:!0,verbose:!1,log:!0,strictSSL:!1}));let Z=new mo({baseUrl:i.baseUrl,apiKey:i.apiKey}),ke=tt(l,b),O=await pb({tests:e,momenticFiles:ke,yes:t,project:l,include:v,exclude:S,labels:T}),I=[];O.forEach((pe,Be)=>{g?g.forEach((Et,Ye)=>{I.push({testIndex:Be,inputs:Et,inputIndex:Ye})}):I.push({testIndex:Be,inputs:void 0,inputIndex:void 0})}),_&&_>1&&(I=fL(I,L,_));let ne=`Running ${I.length} tests with ${P} workers`;$.info({allTestsToRunWithInputs:I,shardCount:_,shardIndex:L,orgId:m},ne),b.dimmed(ne),I.forEach(pe=>{b.dimmed(` - ${[O[pe.testIndex].relativeFilePath]}${typeof pe.inputIndex=="number"?` with input set ${pe.inputIndex}`:""}`)}),b.log("");let k=[],ve=Date.now(),le=new Set,xe=()=>{let pe=i.getAppUrl(),Be=No({results:k,startTime:ve,onFailed:Ye=>{rl(Ye,Ye.filePath)},getDisplayLine:Ye=>{let sn=` - ${Ye.filePath}${Ye.proposedTest?" [AUTO-HEALED] ":""}`;return c&&Ye.runId&&(sn+=` (${pe}/runs/${Ye.runId})`),sn},entity:"test"}),Et=k.filter(Ye=>!!Ye.proposedTest);return Et.length>0&&b.warn(`${Et.length} tests passed with auto-healing. Please use the run links printed above to review proposed changes and apply them locally.`),Be},Q=await db(b),Se=a.child({commit_sha:Q?.gitCommitSha,commit_sha_short:Q?.gitCommitShaShort,branch_name:Q?.gitBranchName,origin_url:Q?.gitOriginUrl,commit_timestamp:Q?.gitCommitTimestamp,github_repository:Q?.githubRepository,gitlab_project_path:Q?.gitlabProjectPath,pipeline_id:Q?.pipelineId}),pt;c&&(pt=(await i.createRunGroup({...Q,trigger:Ut.CLI,startedAt:new Date,status:"RUNNING"})).id);let De=[],M=async()=>{b.warn("SIGINT received. Stopping tests and printing latest results..."),c&&pt&&await i.updateRunGroup(pt,{status:"CANCELLED",finishedAt:new Date}),xe(),await Promise.allSettled(De.map(pe=>pe())),process.exit(1)};process.on("SIGINT",M);let on={};for(let pe=0;pe<I.length;pe++){let Be=Object.values(on);Be.length===P&&await Promise.race(Be.map(sn=>sn.promise));let Et=I[pe],Ye=`test-${pe}`;on[Ye]={done:!1,promise:(async({testIndex:sn,inputs:_r})=>{let Kt=O[sn];le.add({testIndex:sn,inputs:_r});let Do=Kt.relativeFilePath.includes("..")?Kt.fullFilePath:Kt.relativeFilePath,Qn=(rt,Uo)=>{let Mr=(al,gp)=>{let Tb=Math.floor((gp-al.length)/2);return al.padStart(Tb+al.length).padEnd(gp)};rt=rt.toUpperCase();let vn=rt;rt.includes("FAIL")?vn=Mo.bgRed.white(Mr("FAIL",8)):rt.includes("PASS")?vn=Mo.bgGreen.white(Mr("PASS",8)):rt.includes("START")?vn=Mo.bgBlue.white(Mr("START",8)):rt.includes("CANCEL")?vn=Mo.bgYellow.white(Mr("CANCEL",8)):rt.includes("RETRY")?vn=Mo.bgYellow.white(Mr("RETRY",8)):rt.includes("RUN")||rt.includes("PROG")?vn=Mo.bgMagenta.white(Mr("RUNNING",8)):$.warn(`Unknown status tried to be logged in run test locally: ${rt}`),mL||(vn=`[${vn}]`),b.log(`${vn} ${Do} ${Uo?`${Uo} `:""}(${le.size}/${I.length})`)};Qn("START");let Fo=setInterval(()=>Qn("RUN"),5*60*1e3);try{let rt=await Sb({testDefinition:Kt,project:l,testInputs:_r,orgId:m,devicePixelRatio:h,apiClient:i,billingReporter:s,analytics:Se,generator:Z,retriesOverride:d,urlOverride:p,envName:u,noReport:!c,customHeaders:f,regenerateGoldenFiles:K,logUpdate:Qn,runGroupId:pt,runSigIntHandlers:c?De:void 0});Qn(rt.status),k.push(rt)}catch(rt){let Uo=`Encountered unexpected fatal error when running test '${Kt.name}': ${rt.message}`;b.error(Uo),$.error(Uo)}finally{clearInterval(Fo),on[Ye].done=!0,delete on[Ye]}})(Et)}}if(await Promise.allSettled(Object.values(on).map(pe=>pe.promise)),c&&pt){let pe="PASSED";k.some(Be=>Be.status==="FAILED")&&(pe="FAILED"),await i.updateRunGroup(pt,{status:pe,finishedAt:new Date})}return process.off("SIGINT",M),y&&await cb(y,{suiteName:`on-demand-suite-${ve}`,startedAt:new Date(ve),finishedAt:new Date,runs:k},C??"reports"),xe()}function fL(n,e,t){if(t>n.length&&(b.warn(`Shard count ${t} is greater than the number of tests ${n.length}! Some workers won't have any tests to run.`),t=Math.max(t,n.length),e>t))return[];let r=Math.floor((e-1)*(n.length/t)),o=Math.floor(e*(n.length/t));return n.sort().filter((s,a)=>a>=r&&a<o)}var wb=new Oo({platform:"cli"},{flushAt:1,flushInterval:0});cl||$.warn("Sentry is not enabled in this environment due to unsupported node version");var vL=process.argv.some(n=>n.includes("--log-level"))&&process.argv.some(n=>n.includes("debug")),fp=n=>{vL&&b.dimmed(n)},Ct=new gL;Ct.name("momentic").description("CLI").version(ko||"unknown");Ct.command("install-browsers").option("-f, --force","Force reinstallation even if the browser executables already exist on disk.").argument("[browsers...]","Browsers to install",["chromium"]).action(async(n,e)=>{await Nr(ZS(n),e.force)});Ct.addOption(new qt("--log-level <level>").choices(["debug","info","warn","error"]).default("info")).on("option:log-level",n=>{n==="debug"&&b.info("Enabling debug logging"),b.setMinLevel(n.toLowerCase())});Ct.addOption(new qt("--verbose","enable verbose logging")).on("option:verbose",()=>{$.enableConsoleLogs(),b.setMinLevel(0)});Ct.command("check-config").addOption(kr).action(async n=>{wn({configFilePath:n.config})});var xL=Ct.command("checks").alias("check").description("Perform various project checks");xL.command("duplicate-names").description("Checks if tests or modules with duplicate names or ids exist").addOption(kr).action(async n=>{let e=wn({configFilePath:n.config}),t=tt(e,b),r=Object.values(t.tests),o=await ga(t,$),i={},s={},a={},l={},c=new Set,d=new Set,p=new Set,u=new Set;for(let h of r)i[h.id]?a[h.id]?a[h.id].push(h.fullFilePath):a[h.id]=[i[h.id],h.fullFilePath]:i[h.id]=h.fullFilePath,s[h.name]?l[h.name]?l[h.name].push(h.fullFilePath):l[h.name]=[s[h.name],h.fullFilePath]:s[h.name]=h.fullFilePath;for(let h of o)u.has(h.moduleId)&&c.add(h.moduleId),p.has(h.name)&&d.add(h.name),u.add(h.moduleId),p.add(h.name);if(Object.entries(a).length>0||Object.entries(l).length>0||c.size>0||d.size>0){for(let[h,f]of Object.entries(a))for(let g of f)b.error(`Test ID ${h} is duplicated in ${g}`);for(let[h,f]of Object.entries(l))for(let g of f)b.error(`Test Name ${h} is duplicated in ${g}`);for(let h of c)b.error(`Module id ${h} is duplicated in your project`);for(let h of d)b.error(`Module name ${h} is duplicated in your project`);process.exit(1)}b.success("No duplicates detected. All test and module names and ids are unique."),process.exit(0)});var TL=Ct.command("migrate").description("Migrate and upgrade tooling");TL.command("v0-v1").addOption(Xn).addOption(Jn).action(async n=>{let e=await Zn(n);if(!e.yes&&!await nt("This command will migrate and then delete your previous Momentic files. All members of your team should transition to the V1 CLI at the same time. Please backup your local directory for safety before proceeding. Continue?",!0)&&process.exit(1),!MS().environments?.length&&await nt("In the V1 CLI, all environment configuration should be committed to a central `momentic.config.yaml` file, which you should commit to your source control repository. Sensitive data can be managed through `.env` files or by injecting the secret into the environment and then referencing them in `envVariables` with ${VAR} syntax. Would you like to pull the latest environments from Momentic Cloud into your `momentic.config.yaml` file?",!0)){let{apiKey:r,server:o}=e,i=wn({}),s=new lt({baseUrl:o,apiKey:r,logger:$});await qa({client:s,project:i,skipPrompts:e.yes}),b.success("Successfully imported environments from Momentic Cloud.")}});Ct.command("import-from-cloud").addOption(Jn).addOption(Or).addOption(kr).addOption(Xn).action(async n=>{let e=await Zn(n),{apiKey:t,server:r,config:o,yes:i}=e,s=wn({configFilePath:o}),a=new lt({baseUrl:r,apiKey:t,logger:$});await _S({client:a,project:s,skipPrompts:i}),process.exit(0)});Ct.command("init").description("Initialize an empty Momentic project in the current working directory").addOption(new qt("--name <name>","Name of the project")).action(async n=>{b.info(`Welcome to the Momentic project setup wizard! \u{1F680}
|
|
2997
|
-
`),b.info("This wizard will help you bootstrap a new Momentic project. If you need to import existing assets from Momentic Cloud, you can call the 'import-from-cloud' command after initialization."),vb.existsSync(Eo)&&(b.error("A momentic.config.yaml file already exists in this directory. Please rename or remove it to initialize a new project."),process.exit(1));let t={name:n.name??await IS("Choose an identifier for your project, such as a service, product, or team name (default: 'app'):","app"),include:Wi};Ao(t,Eo),b.success(`Initialized Momentic project file at ${sl.resolve(Eo)}`)});Ct.command("app").addOption(Jn).addOption(Or).addOption(Xn).addOption(ip).addOption(HS).addOption(kr).action(async n=>{let e=await Zn(n),{apiKey:t,port:r=Ya,yes:o,server:i,pixelRatio:s}=e,a=new lt({baseUrl:i,apiKey:t,logger:$});await cp({client:a,skipPrompts:o,installBrowsers:!0});let l=wL(import.meta.url),c=sl.dirname(l),d=sl.resolve(c,"..","static"),p=sl.resolve(c,"..","assets"),u=s??Jd();Xd(u),zo(),await wS({momenticServerUrl:i,apiKey:t,serverPort:r,appPort:r,staticDir:d,assetsDir:p,devicePixelRatio:u,version:"1.0.
|
|
2997
|
+
`),b.info("This wizard will help you bootstrap a new Momentic project. If you need to import existing assets from Momentic Cloud, you can call the 'import-from-cloud' command after initialization."),vb.existsSync(Eo)&&(b.error("A momentic.config.yaml file already exists in this directory. Please rename or remove it to initialize a new project."),process.exit(1));let t={name:n.name??await IS("Choose an identifier for your project, such as a service, product, or team name (default: 'app'):","app"),include:Wi};Ao(t,Eo),b.success(`Initialized Momentic project file at ${sl.resolve(Eo)}`)});Ct.command("app").addOption(Jn).addOption(Or).addOption(Xn).addOption(ip).addOption(HS).addOption(kr).action(async n=>{let e=await Zn(n),{apiKey:t,port:r=Ya,yes:o,server:i,pixelRatio:s}=e,a=new lt({baseUrl:i,apiKey:t,logger:$});await cp({client:a,skipPrompts:o,installBrowsers:!0});let l=wL(import.meta.url),c=sl.dirname(l),d=sl.resolve(c,"..","static"),p=sl.resolve(c,"..","assets"),u=s??Jd();Xd(u),zo(),await wS({momenticServerUrl:i,apiKey:t,serverPort:r,appPort:r,staticDir:d,assetsDir:p,devicePixelRatio:u,version:"1.0.83"});let m=`http://localhost:${r}`;await bL(m)});var xb=Ct.command("queue").description("Queue tests or suites to run on Momentic Cloud");xb.command("suites").description("Run one or more suites on Momentic Cloud").addOption(Jn).addOption(Or).addOption(np).addOption(rp).addOption(Xn).addArgument(KS).addOption(Za).addOption(Xa).addOption(Ja).action(async(n,e)=>{let{apiKey:t,server:r,wait:o,waitTimeout:i,env:s,urlOverride:a,customHeaders:l}=await Zn(e),c=new lt({baseUrl:r,apiKey:t,logger:$});(!n||!Array.isArray(n)||!n.length)&&(b.error("Must pass at least one suite to run."),process.exit(1));let{orgId:d}=await c.getAuthInfo();await nb({client:c,orgId:d,wait:o,suitePaths:n,waitTimeout:i,env:s,urlOverride:a,customHeaders:Qa(l)})});xb.command("tests").description("Run one or more tests on Momentic Cloud").addOption(Jn).addOption(Or).addOption(Xn).addOption(Ja).addOption(sp).addOption(Za).addOption(Xa).addOption(np).addOption(rp).addArgument(VS).action(async(n,e)=>{let t=await Zn(e),{all:r,apiKey:o,customHeaders:i,env:s,server:a,inputCsv:l,urlOverride:c,wait:d,waitTimeout:p,yes:u}=t,m=Qa(i);for(let y of n)(y.endsWith(".yaml")||vb.existsSync(y))&&b.warn("Are you trying to run a test on your local machine? If so, please use the 'run' command instead of the 'queue' command");let h=new lt({baseUrl:a,apiKey:o,logger:$}),{orgId:f}=await h.getAuthInfo(),g;l&&(g=await Zd(l)),await rb({client:h,orgId:f,tests:n,all:r,customHeaders:m,env:s,urlOverride:c,wait:d,waitTimeout:p,testInputMatrix:g,yes:u}),process.exit(0)});var CL=Ct.command("run").alias("test").description("Run tests on the local machine");CL.addOption(Jn).addOption(Or).addOption(kr).addOption(ap).addOption(Xn).addOption(Ja).addOption(sp).addOption(Xa).addOption(Za).addOption(op).addOption(ip).addOption(new qt("--start <start>","Arbitrary setup command that will run before Momentic steps begin.")).addOption(new qt("--wait-on <waitOn>","URL to wait to become accessible before Momentic tests begin.")).addOption(new qt("--wait-on-timeout <waitOnTimeout>","Max time in seconds to wait for the --wait-on URL to become accessible.")).addOption(new qt("--retries <retries>","Number of retries to attempt when running tests locally. Defaults to each test's own retry configuration.")).addOption(new qt("-p, --parallel <parallel>","When running with the --local flag, the number of tests to run in parallel. Defaults to 1.")).addOption(new qt("--labels <labels...>","Only run tests with the specified label(s).")).addOption(new qt("--update-golden-files","Update locally stored golden files for steps that this is enabled for.")).addOption(op).addOption(zS).addOption(BS).addOption(WS).addOption(GS).addOption(jS).addOption($S).addArgument(qS).action(async(n,e)=>{b.debug("Run tests invoked");let t=await Zn(e);b.debug(t,"Parsed CLI options");let r=Qa(t.customHeaders),o=wn({configFilePath:t.config,nameFilter:t.filter});b.debug({projectName:o.config.name},"Identified project config");let i=new lt({baseUrl:t.server,apiKey:t.apiKey,logger:$}),s=new zs(i),a;t.inputCsv&&(a=await Zd(t.inputCsv)),b.debug("Checking API key and dependencies");let{orgId:l,userId:c}=await cp({client:i,skipPrompts:t.yes,installBrowsers:!0});b.debug("API key check and browser installation complete");let d=t.pixelRatio??Jd();Xd(d);let p=wb.child({org_id:l,user_id:c,cli_version:ko,trigger:"CLI"});t.report||(p=new Ha);try{(await bb({...t,retriesOverride:t.retries,devicePixelRatio:d,tests:n,project:o,client:i,billingReporter:s,analytics:p,customHeaders:r,envName:t.env,orgId:l,testInputMatrix:a,regenerateGoldenFiles:t.updateGoldenFiles})).failed>0?process.exit(1):process.exit(0)}catch(u){b.error("Failed to run tests locally. Please check the error message below or run with the --verbose flag."),b.error(u),process.exit(1)}});var EL=Ct.command("apply").description("Apply an operation to local resources");EL.command("patch").addOption(Jn).addOption(Or).addOption(kr).addOption(ap).addOption(Xn).addOption(new qt("--from <from>","Name or ID of the patch to apply").makeOptionMandatory()).addOption(new qt("--to <to>","Name or ID of the test to apply the patch to").makeOptionMandatory()).action(async n=>{let e=await Zn(n),{apiKey:t,server:r,config:o,yes:i}=e,s=wn({configFilePath:o}),a=new lt({baseUrl:r,apiKey:t,logger:$}),l=tt(s,b),c=l.tests[n.to]??Object.values(l.tests).find(p=>Ee(p.name)===n.to.trim());c||(b.error(`No test matching '${n.to}' could be found in the current project.`),process.exit(1));let d=await a.fetchTestFragment(n.from);await PS({client:a,test:c,fragment:d,yes:i,entities:l,logger:$}),process.exit(0)});async function AL(){fp("Main program started"),await CS($),fp("CLI version check complete");try{await Ct.parseAsync(process.argv),zo()}catch(n){let e={};try{e.playwrightVersion=yL("npx playwright --version").toString()}catch(t){$.error({err:t},"Error fetching debug information")}$.error({err:n,debugInfo:e},"Uncaught error in CLI"),$.flush(),ll(n,e),b.error(n),zo(),process.exit(1)}}SL.setMaxListeners(50);process.on("warning",n=>{$.warn({err:n},`Node warning received on CLI: ${n.message}`)});fp("CLI parsing setup complete");AL();
|
|
2998
2998
|
//# sourceMappingURL=cli.js.map
|
|
2999
2999
|
//# debugId=4ae94a08-86a6-594f-84e1-1d3cb138fa15
|
package/package.json
CHANGED
|
@@ -637,7 +637,7 @@ ${r()}`)(...l)}}};const VOt=["$schema","$vocabulary","id","$id","$anchor","$ref"
|
|
|
637
637
|
* LICENSE.md file in the root directory of this source tree.
|
|
638
638
|
*
|
|
639
639
|
* @license MIT
|
|
640
|
-
*/function xI(e,t){return e?lTt(e)?_.createElement(e,t):e:null}function lTt(e){return cTt(e)||typeof e=="function"||uTt(e)}function cTt(e){return typeof e=="function"&&(()=>{const t=Object.getPrototypeOf(e);return t.prototype&&t.prototype.isReactComponent})()}function uTt(e){return typeof e=="object"&&typeof e.$$typeof=="symbol"&&["react.memo","react.forward_ref"].includes(e.$$typeof.description)}function fTt(e){const t={state:{},onStateChange:()=>{},renderFallbackValue:null,...e},[n]=_.useState(()=>({current:KEt(t)})),[r,i]=_.useState(()=>n.current.initialState);return n.current.setOptions(a=>({...a,...e,state:{...r,...e.state},onStateChange:o=>{i(o),e.onStateChange==null||e.onStateChange(o)}})),n.current}const AK=_.forwardRef(({className:e,...t},n)=>y.jsx("div",{className:"relative w-full overflow-auto",children:y.jsx("table",{ref:n,className:Ne("w-full caption-bottom text-sm",e),...t})}));AK.displayName="Table";const $K=_.forwardRef(({className:e,...t},n)=>y.jsx("thead",{ref:n,className:Ne("[&_tr]:border-b",e),...t}));$K.displayName="TableHeader";const PK=_.forwardRef(({className:e,...t},n)=>y.jsx("tbody",{ref:n,className:Ne("[&_tr:last-child]:border-0",e),...t}));PK.displayName="TableBody";const mRe=_.forwardRef(({className:e,...t},n)=>y.jsx("tfoot",{ref:n,className:Ne("bg-muted/50 border-t font-medium [&>tr]:last:border-b-0",e),...t}));mRe.displayName="TableFooter";const Dh=_.forwardRef(({className:e,...t},n)=>y.jsx("tr",{ref:n,className:Ne("hover:bg-muted/50 data-[state=selected]:bg-muted border-b transition-colors",e),...t}));Dh.displayName="TableRow";const LD=_.forwardRef(({className:e,...t},n)=>y.jsx("th",{ref:n,className:Ne("text-muted-foreground h-10 px-2 text-left align-middle font-medium [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",e),...t}));LD.displayName="TableHead";const qm=_.forwardRef(({className:e,...t},n)=>y.jsx("td",{ref:n,className:Ne("p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",e),...t}));qm.displayName="TableCell";const dTt=_.forwardRef(({className:e,...t},n)=>y.jsx("caption",{ref:n,className:Ne("text-muted-foreground mt-4 text-sm",e),...t}));dTt.displayName="TableCaption";function hTt({table:e}){return y.jsx("div",{className:"flex items-center justify-end px-2",children:y.jsxs("div",{className:"flex items-center space-x-6 lg:space-x-8",children:[y.jsxs("div",{className:"flex items-center space-x-2",children:[y.jsx("p",{className:"text-sm font-medium",children:"Rows per page"}),y.jsxs(zi,{value:`${e.getState().pagination.pageSize}`,onValueChange:t=>{e.setPageSize(Number(t))},children:[y.jsx($i,{className:"h-8 w-fit space-x-2",children:y.jsx(Wi,{placeholder:e.getState().pagination.pageSize})}),y.jsx(Pi,{side:"top",children:[10,20,30,40,50].map(t=>y.jsx(wr,{value:`${t}`,children:t},t))})]})]}),y.jsxs("div",{className:"flex w-[100px] items-center justify-center text-sm font-medium",children:["Page ",e.getState().pagination.pageIndex+1," of"," ",e.getPageCount()]}),y.jsxs("div",{className:"flex items-center space-x-2",children:[y.jsxs(bn,{variant:"outline",className:"hidden h-8 w-8 p-0 lg:flex",onClick:()=>e.setPageIndex(0),disabled:!e.getCanPreviousPage(),children:[y.jsx("span",{className:"sr-only",children:"Go to first page"}),y.jsx(Gat,{})]}),y.jsxs(bn,{variant:"outline",className:"h-8 w-8 p-0",onClick:()=>e.previousPage(),disabled:!e.getCanPreviousPage(),children:[y.jsx("span",{className:"sr-only",children:"Go to previous page"}),y.jsx(Wat,{})]}),y.jsxs(bn,{variant:"outline",className:"h-8 w-8 p-0",onClick:()=>e.nextPage(),disabled:!e.getCanNextPage(),children:[y.jsx("span",{className:"sr-only",children:"Go to next page"}),y.jsx(NP,{})]}),y.jsxs(bn,{variant:"outline",className:"hidden h-8 w-8 p-0 lg:flex",onClick:()=>e.setPageIndex(e.getPageCount()-1),disabled:!e.getCanNextPage(),children:[y.jsx("span",{className:"sr-only",children:"Go to last page"}),y.jsx(Zat,{})]})]})]})})}function pTt({table:e,children:t,className:n,onRowClick:r}){var s;const i=!!((s=e.getState().rowPinning.top)!=null&&s.length),a=i?e.getCenterRows():e.getRowModel().rows,o=i?e.getTopRows().length+a.length+e.getBottomRows().length:a.length;return y.jsxs("div",{className:"space-y-4",children:[t,y.jsx("div",{className:Ne("w-full overflow-auto rounded-md border",n),children:y.jsxs(AK,{children:[y.jsx($K,{children:e.getHeaderGroups().map(l=>y.jsx(Dh,{children:l.headers.map(c=>{var u;return y.jsx(LD,{className:(u=c.column.columnDef.meta)==null?void 0:u.className,children:c.isPlaceholder?null:xI(c.column.columnDef.header,c.getContext())},c.id)})},l.id))}),y.jsxs(PK,{children:[i?e.getTopRows().map(l=>y.jsx(Dh,{"data-state":l.getIsSelected()&&"selected",className:Ne("group h-[50px]",{"cursor-pointer":!!r}),onClick:()=>r==null?void 0:r(l.original),children:l.getVisibleCells().map(c=>{var u;return y.jsx(qm,{className:Ne("relative",(u=c.column.columnDef.meta)==null?void 0:u.className),children:xI(c.column.columnDef.cell,c.getContext())},c.id)})},l.id)):null,a.map(l=>y.jsx(Dh,{"data-state":l.getIsSelected()&&"selected",className:Ne("group h-[50px]",{"cursor-pointer":!!r}),onClick:()=>r==null?void 0:r(l.original),children:l.getVisibleCells().map(c=>{var u;return y.jsx(qm,{className:Ne("relative",(u=c.column.columnDef.meta)==null?void 0:u.className),children:xI(c.column.columnDef.cell,c.getContext())},c.id)})},l.id)),i?e.getBottomRows().map(l=>y.jsx(Dh,{"data-state":l.getIsSelected()&&"selected",className:Ne("group h-[50px]",{"cursor-pointer":!!r}),onClick:()=>r==null?void 0:r(l.original),children:l.getVisibleCells().map(c=>{var u;return y.jsx(qm,{className:Ne("relative",(u=c.column.columnDef.meta)==null?void 0:u.className),children:xI(c.column.columnDef.cell,c.getContext())},c.id)})},l.id)):null,o===0?y.jsx(Dh,{children:y.jsx(qm,{colSpan:e.getAllColumns().length,className:"h-24 text-center",children:"No results."})}):null]})]})}),y.jsx(hTt,{table:e})]})}const mTt=Sb("inline-flex items-center rounded-md border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground shadow hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground shadow hover:bg-destructive/80",outline:"text-foreground",plain:"border-transparent text-primary-foreground"}},defaultVariants:{variant:"default"}});function Kh({className:e,variant:t,...n}){return y.jsx("div",{className:Ne(mTt({variant:t}),e),...n})}var Tce=1,gTt=.9,vTt=.8,yTt=.17,pU=.1,mU=.999,bTt=.9999,OTt=.99,xTt=/[\\\/_+.#"@\[\(\{&]/,wTt=/[\\\/_+.#"@\[\(\{&]/g,STt=/[\s-]/,gRe=/[\s-]/g;function ZQ(e,t,n,r,i,a,o){if(a===t.length)return i===e.length?Tce:OTt;var s=`${i},${a}`;if(o[s]!==void 0)return o[s];for(var l=r.charAt(a),c=n.indexOf(l,i),u=0,f,d,h,p;c>=0;)f=ZQ(e,t,n,r,c+1,a+1,o),f>u&&(c===i?f*=Tce:xTt.test(e.charAt(c-1))?(f*=vTt,h=e.slice(i,c-1).match(wTt),h&&i>0&&(f*=Math.pow(mU,h.length))):STt.test(e.charAt(c-1))?(f*=gTt,p=e.slice(i,c-1).match(gRe),p&&i>0&&(f*=Math.pow(mU,p.length))):(f*=yTt,i>0&&(f*=Math.pow(mU,c-i))),e.charAt(c)!==t.charAt(a)&&(f*=bTt)),(f<pU&&n.charAt(c-1)===r.charAt(a+1)||r.charAt(a+1)===r.charAt(a)&&n.charAt(c-1)!==r.charAt(a))&&(d=ZQ(e,t,n,r,c+1,a+2,o),d*pU>f&&(f=d*pU)),f>u&&(u=f),c=n.indexOf(l,c+1);return o[s]=u,u}function Cce(e){return e.toLowerCase().replace(gRe," ")}function _Tt(e,t,n){return e=n&&n.length>0?`${e+" "+n.join(" ")}`:e,ZQ(e,t,Cce(e),Cce(t),0,0,{})}function wt(){return wt=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},wt.apply(this,arguments)}function Zx(e,t,{checkForDefaultPrevented:n=!0}={}){return function(i){if(e==null||e(i),n===!1||!i.defaultPrevented)return t==null?void 0:t(i)}}function ETt(e,t){typeof e=="function"?e(t):e!=null&&(e.current=t)}function vRe(...e){return t=>e.forEach(n=>ETt(n,t))}function ck(...e){return _.useCallback(vRe(...e),e)}function TTt(e,t=[]){let n=[];function r(a,o){const s=_.createContext(o),l=n.length;n=[...n,o];function c(f){const{scope:d,children:h,...p}=f,m=(d==null?void 0:d[e][l])||s,g=_.useMemo(()=>p,Object.values(p));return _.createElement(m.Provider,{value:g},h)}function u(f,d){const h=(d==null?void 0:d[e][l])||s,p=_.useContext(h);if(p)return p;if(o!==void 0)return o;throw new Error(`\`${f}\` must be used within \`${a}\``)}return c.displayName=a+"Provider",[c,u]}const i=()=>{const a=n.map(o=>_.createContext(o));return function(s){const l=(s==null?void 0:s[e])||a;return _.useMemo(()=>({[`__scope${e}`]:{...s,[e]:l}}),[s,l])}};return i.scopeName=e,[r,CTt(i,...t)]}function CTt(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(a){const o=r.reduce((s,{useScope:l,scopeName:c})=>{const f=l(a)[`__scope${c}`];return{...s,...f}},{});return _.useMemo(()=>({[`__scope${t.scopeName}`]:o}),[o])}};return n.scopeName=t.scopeName,n}const YQ=globalThis!=null&&globalThis.document?_.useLayoutEffect:()=>{},ATt=u0.useId||(()=>{});let $Tt=0;function gU(e){const[t,n]=_.useState(ATt());return YQ(()=>{e||n(r=>r??String($Tt++))},[e]),e||(t?`radix-${t}`:"")}function L0(e){const t=_.useRef(e);return _.useEffect(()=>{t.current=e}),_.useMemo(()=>(...n)=>{var r;return(r=t.current)===null||r===void 0?void 0:r.call(t,...n)},[])}function PTt({prop:e,defaultProp:t,onChange:n=()=>{}}){const[r,i]=kTt({defaultProp:t,onChange:n}),a=e!==void 0,o=a?e:r,s=L0(n),l=_.useCallback(c=>{if(a){const f=typeof c=="function"?c(e):c;f!==e&&s(f)}else i(c)},[a,e,i,s]);return[o,l]}function kTt({defaultProp:e,onChange:t}){const n=_.useState(e),[r]=n,i=_.useRef(r),a=L0(t);return _.useEffect(()=>{i.current!==r&&(a(r),i.current=r)},[r,i,a]),n}const kK=_.forwardRef((e,t)=>{const{children:n,...r}=e,i=_.Children.toArray(n),a=i.find(ITt);if(a){const o=a.props.children,s=i.map(l=>l===a?_.Children.count(o)>1?_.Children.only(null):_.isValidElement(o)?o.props.children:null:l);return _.createElement(XQ,wt({},r,{ref:t}),_.isValidElement(o)?_.cloneElement(o,void 0,s):null)}return _.createElement(XQ,wt({},r,{ref:t}),n)});kK.displayName="Slot";const XQ=_.forwardRef((e,t)=>{const{children:n,...r}=e;return _.isValidElement(n)?_.cloneElement(n,{...NTt(r,n.props),ref:t?vRe(t,n.ref):n.ref}):_.Children.count(n)>1?_.Children.only(null):null});XQ.displayName="SlotClone";const RTt=({children:e})=>_.createElement(_.Fragment,null,e);function ITt(e){return _.isValidElement(e)&&e.type===RTt}function NTt(e,t){const n={...t};for(const r in t){const i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...s)=>{a(...s),i(...s)}:i&&(n[r]=i):r==="style"?n[r]={...i,...a}:r==="className"&&(n[r]=[i,a].filter(Boolean).join(" "))}return{...e,...n}}const MTt=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],ju=MTt.reduce((e,t)=>{const n=_.forwardRef((r,i)=>{const{asChild:a,...o}=r,s=a?kK:t;return _.useEffect(()=>{window[Symbol.for("radix-ui")]=!0},[]),_.createElement(s,wt({},o,{ref:i}))});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{});function DTt(e,t){e&&Lf.flushSync(()=>e.dispatchEvent(t))}function LTt(e,t=globalThis==null?void 0:globalThis.document){const n=L0(e);_.useEffect(()=>{const r=i=>{i.key==="Escape"&&n(i)};return t.addEventListener("keydown",r),()=>t.removeEventListener("keydown",r)},[n,t])}const KQ="dismissableLayer.update",jTt="dismissableLayer.pointerDownOutside",FTt="dismissableLayer.focusOutside";let Ace;const UTt=_.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),BTt=_.forwardRef((e,t)=>{var n;const{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:i,onPointerDownOutside:a,onFocusOutside:o,onInteractOutside:s,onDismiss:l,...c}=e,u=_.useContext(UTt),[f,d]=_.useState(null),h=(n=f==null?void 0:f.ownerDocument)!==null&&n!==void 0?n:globalThis==null?void 0:globalThis.document,[,p]=_.useState({}),m=ck(t,P=>d(P)),g=Array.from(u.layers),[v]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),b=g.indexOf(v),O=f?g.indexOf(f):-1,x=u.layersWithOutsidePointerEventsDisabled.size>0,w=O>=b,S=VTt(P=>{const M=P.target,R=[...u.branches].some(C=>C.contains(M));!w||R||(a==null||a(P),s==null||s(P),P.defaultPrevented||l==null||l())},h),T=QTt(P=>{const M=P.target;[...u.branches].some(C=>C.contains(M))||(o==null||o(P),s==null||s(P),P.defaultPrevented||l==null||l())},h);return LTt(P=>{O===u.layers.size-1&&(i==null||i(P),!P.defaultPrevented&&l&&(P.preventDefault(),l()))},h),_.useEffect(()=>{if(f)return r&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(Ace=h.body.style.pointerEvents,h.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(f)),u.layers.add(f),$ce(),()=>{r&&u.layersWithOutsidePointerEventsDisabled.size===1&&(h.body.style.pointerEvents=Ace)}},[f,h,r,u]),_.useEffect(()=>()=>{f&&(u.layers.delete(f),u.layersWithOutsidePointerEventsDisabled.delete(f),$ce())},[f,u]),_.useEffect(()=>{const P=()=>p({});return document.addEventListener(KQ,P),()=>document.removeEventListener(KQ,P)},[]),_.createElement(ju.div,wt({},c,{ref:m,style:{pointerEvents:x?w?"auto":"none":void 0,...e.style},onFocusCapture:Zx(e.onFocusCapture,T.onFocusCapture),onBlurCapture:Zx(e.onBlurCapture,T.onBlurCapture),onPointerDownCapture:Zx(e.onPointerDownCapture,S.onPointerDownCapture)}))});function VTt(e,t=globalThis==null?void 0:globalThis.document){const n=L0(e),r=_.useRef(!1),i=_.useRef(()=>{});return _.useEffect(()=>{const a=s=>{if(s.target&&!r.current){let u=function(){yRe(jTt,n,c,{discrete:!0})};var l=u;const c={originalEvent:s};s.pointerType==="touch"?(t.removeEventListener("click",i.current),i.current=u,t.addEventListener("click",i.current,{once:!0})):u()}else t.removeEventListener("click",i.current);r.current=!1},o=window.setTimeout(()=>{t.addEventListener("pointerdown",a)},0);return()=>{window.clearTimeout(o),t.removeEventListener("pointerdown",a),t.removeEventListener("click",i.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function QTt(e,t=globalThis==null?void 0:globalThis.document){const n=L0(e),r=_.useRef(!1);return _.useEffect(()=>{const i=a=>{a.target&&!r.current&&yRe(FTt,n,{originalEvent:a},{discrete:!1})};return t.addEventListener("focusin",i),()=>t.removeEventListener("focusin",i)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function $ce(){const e=new CustomEvent(KQ);document.dispatchEvent(e)}function yRe(e,t,n,{discrete:r}){const i=n.originalEvent.target,a=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),r?DTt(i,a):i.dispatchEvent(a)}const vU="focusScope.autoFocusOnMount",yU="focusScope.autoFocusOnUnmount",Pce={bubbles:!1,cancelable:!0},zTt=_.forwardRef((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:i,onUnmountAutoFocus:a,...o}=e,[s,l]=_.useState(null),c=L0(i),u=L0(a),f=_.useRef(null),d=ck(t,m=>l(m)),h=_.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;_.useEffect(()=>{if(r){let b=function(S){if(h.paused||!s)return;const T=S.target;s.contains(T)?f.current=T:ym(f.current,{select:!0})},O=function(S){if(h.paused||!s)return;const T=S.relatedTarget;T!==null&&(s.contains(T)||ym(f.current,{select:!0}))},x=function(S){if(document.activeElement===document.body)for(const P of S)P.removedNodes.length>0&&ym(s)};var m=b,g=O,v=x;document.addEventListener("focusin",b),document.addEventListener("focusout",O);const w=new MutationObserver(x);return s&&w.observe(s,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",b),document.removeEventListener("focusout",O),w.disconnect()}}},[r,s,h.paused]),_.useEffect(()=>{if(s){Rce.add(h);const m=document.activeElement;if(!s.contains(m)){const v=new CustomEvent(vU,Pce);s.addEventListener(vU,c),s.dispatchEvent(v),v.defaultPrevented||(WTt(YTt(bRe(s)),{select:!0}),document.activeElement===m&&ym(s))}return()=>{s.removeEventListener(vU,c),setTimeout(()=>{const v=new CustomEvent(yU,Pce);s.addEventListener(yU,u),s.dispatchEvent(v),v.defaultPrevented||ym(m??document.body,{select:!0}),s.removeEventListener(yU,u),Rce.remove(h)},0)}}},[s,c,u,h]);const p=_.useCallback(m=>{if(!n&&!r||h.paused)return;const g=m.key==="Tab"&&!m.altKey&&!m.ctrlKey&&!m.metaKey,v=document.activeElement;if(g&&v){const b=m.currentTarget,[O,x]=HTt(b);O&&x?!m.shiftKey&&v===x?(m.preventDefault(),n&&ym(O,{select:!0})):m.shiftKey&&v===O&&(m.preventDefault(),n&&ym(x,{select:!0})):v===b&&m.preventDefault()}},[n,r,h.paused]);return _.createElement(ju.div,wt({tabIndex:-1},o,{ref:d,onKeyDown:p}))});function WTt(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(ym(r,{select:t}),document.activeElement!==n)return}function HTt(e){const t=bRe(e),n=kce(t,e),r=kce(t.reverse(),e);return[n,r]}function bRe(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const i=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||i?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function kce(e,t){for(const n of e)if(!qTt(n,{upTo:t}))return n}function qTt(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function GTt(e){return e instanceof HTMLInputElement&&"select"in e}function ym(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&>t(e)&&t&&e.select()}}const Rce=ZTt();function ZTt(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=Ice(e,t),e.unshift(t)},remove(t){var n;e=Ice(e,t),(n=e[0])===null||n===void 0||n.resume()}}}function Ice(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function YTt(e){return e.filter(t=>t.tagName!=="A")}const XTt=_.forwardRef((e,t)=>{var n;const{container:r=globalThis==null||(n=globalThis.document)===null||n===void 0?void 0:n.body,...i}=e;return r?Uh.createPortal(_.createElement(ju.div,wt({},i,{ref:t})),r):null});function KTt(e,t){return _.useReducer((n,r)=>{const i=t[n][r];return i??n},e)}const o3=e=>{const{present:t,children:n}=e,r=JTt(t),i=typeof n=="function"?n({present:r.isPresent}):_.Children.only(n),a=ck(r.ref,i.ref);return typeof n=="function"||r.isPresent?_.cloneElement(i,{ref:a}):null};o3.displayName="Presence";function JTt(e){const[t,n]=_.useState(),r=_.useRef({}),i=_.useRef(e),a=_.useRef("none"),o=e?"mounted":"unmounted",[s,l]=KTt(o,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return _.useEffect(()=>{const c=wI(r.current);a.current=s==="mounted"?c:"none"},[s]),YQ(()=>{const c=r.current,u=i.current;if(u!==e){const d=a.current,h=wI(c);e?l("MOUNT"):h==="none"||(c==null?void 0:c.display)==="none"?l("UNMOUNT"):l(u&&d!==h?"ANIMATION_OUT":"UNMOUNT"),i.current=e}},[e,l]),YQ(()=>{if(t){const c=f=>{const h=wI(r.current).includes(f.animationName);f.target===t&&h&&Lf.flushSync(()=>l("ANIMATION_END"))},u=f=>{f.target===t&&(a.current=wI(r.current))};return t.addEventListener("animationstart",u),t.addEventListener("animationcancel",c),t.addEventListener("animationend",c),()=>{t.removeEventListener("animationstart",u),t.removeEventListener("animationcancel",c),t.removeEventListener("animationend",c)}}else l("ANIMATION_END")},[t,l]),{isPresent:["mounted","unmountSuspended"].includes(s),ref:_.useCallback(c=>{c&&(r.current=getComputedStyle(c)),n(c)},[])}}function wI(e){return(e==null?void 0:e.animationName)||"none"}let bU=0;function eCt(){_.useEffect(()=>{var e,t;const n=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",(e=n[0])!==null&&e!==void 0?e:Nce()),document.body.insertAdjacentElement("beforeend",(t=n[1])!==null&&t!==void 0?t:Nce()),bU++,()=>{bU===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(r=>r.remove()),bU--}},[])}function Nce(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.cssText="outline: none; opacity: 0; position: fixed; pointer-events: none",e}var S2="right-scroll-bar-position",_2="width-before-scroll-bar",tCt="with-scroll-bars-hidden",nCt="--removed-body-scroll-bar-size",ORe=rTe(),OU=function(){},s3=_.forwardRef(function(e,t){var n=_.useRef(null),r=_.useState({onScrollCapture:OU,onWheelCapture:OU,onTouchMoveCapture:OU}),i=r[0],a=r[1],o=e.forwardProps,s=e.children,l=e.className,c=e.removeScrollBar,u=e.enabled,f=e.shards,d=e.sideCar,h=e.noIsolation,p=e.inert,m=e.allowPinchZoom,g=e.as,v=g===void 0?"div":g,b=vF(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noIsolation","inert","allowPinchZoom","as"]),O=d,x=nTe([n,t]),w=On(On({},b),i);return _.createElement(_.Fragment,null,u&&_.createElement(O,{sideCar:ORe,removeScrollBar:c,shards:f,noIsolation:h,inert:p,setCallbacks:a,allowPinchZoom:!!m,lockRef:n}),o?_.cloneElement(_.Children.only(s),On(On({},w),{ref:x})):_.createElement(v,On({},w,{className:l,ref:x}),s))});s3.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};s3.classNames={fullWidth:_2,zeroRight:S2};var rCt={left:0,top:0,right:0,gap:0},xU=function(e){return parseInt(e||"",10)||0},iCt=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],r=t[e==="padding"?"paddingTop":"marginTop"],i=t[e==="padding"?"paddingRight":"marginRight"];return[xU(n),xU(r),xU(i)]},aCt=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return rCt;var t=iCt(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},oCt=bF(),sCt=function(e,t,n,r){var i=e.left,a=e.top,o=e.right,s=e.gap;return n===void 0&&(n="margin"),`
|
|
640
|
+
*/function xI(e,t){return e?lTt(e)?_.createElement(e,t):e:null}function lTt(e){return cTt(e)||typeof e=="function"||uTt(e)}function cTt(e){return typeof e=="function"&&(()=>{const t=Object.getPrototypeOf(e);return t.prototype&&t.prototype.isReactComponent})()}function uTt(e){return typeof e=="object"&&typeof e.$$typeof=="symbol"&&["react.memo","react.forward_ref"].includes(e.$$typeof.description)}function fTt(e){const t={state:{},onStateChange:()=>{},renderFallbackValue:null,...e},[n]=_.useState(()=>({current:KEt(t)})),[r,i]=_.useState(()=>n.current.initialState);return n.current.setOptions(a=>({...a,...e,state:{...r,...e.state},onStateChange:o=>{i(o),e.onStateChange==null||e.onStateChange(o)}})),n.current}const AK=_.forwardRef(({className:e,...t},n)=>y.jsx("div",{className:"relative w-full overflow-auto",children:y.jsx("table",{ref:n,className:Ne("w-full caption-bottom text-sm",e),...t})}));AK.displayName="Table";const $K=_.forwardRef(({className:e,...t},n)=>y.jsx("thead",{ref:n,className:Ne("[&_tr]:border-b",e),...t}));$K.displayName="TableHeader";const PK=_.forwardRef(({className:e,...t},n)=>y.jsx("tbody",{ref:n,className:Ne("[&_tr:last-child]:border-0",e),...t}));PK.displayName="TableBody";const mRe=_.forwardRef(({className:e,...t},n)=>y.jsx("tfoot",{ref:n,className:Ne("bg-muted/50 border-t font-medium [&>tr]:last:border-b-0",e),...t}));mRe.displayName="TableFooter";const Dh=_.forwardRef(({className:e,...t},n)=>y.jsx("tr",{ref:n,className:Ne("hover:bg-muted/50 data-[state=selected]:bg-muted border-b transition-colors",e),...t}));Dh.displayName="TableRow";const LD=_.forwardRef(({className:e,...t},n)=>y.jsx("th",{ref:n,className:Ne("text-muted-foreground h-10 px-2 text-left align-middle font-medium [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",e),...t}));LD.displayName="TableHead";const qm=_.forwardRef(({className:e,...t},n)=>y.jsx("td",{ref:n,className:Ne("p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",e),...t}));qm.displayName="TableCell";const dTt=_.forwardRef(({className:e,...t},n)=>y.jsx("caption",{ref:n,className:Ne("text-muted-foreground mt-4 text-sm",e),...t}));dTt.displayName="TableCaption";function hTt({table:e}){return y.jsx("div",{className:"flex items-center justify-end px-2",children:y.jsxs("div",{className:"flex items-center space-x-6 lg:space-x-8",children:[y.jsxs("div",{className:"flex items-center space-x-2",children:[y.jsx("p",{className:"text-sm font-medium",children:"Rows per page"}),y.jsxs(zi,{value:`${e.getState().pagination.pageSize}`,onValueChange:t=>{e.setPageSize(Number(t))},children:[y.jsx($i,{className:"h-8 w-fit space-x-2",children:y.jsx(Wi,{placeholder:e.getState().pagination.pageSize})}),y.jsx(Pi,{side:"top",children:[10,20,30,40,50].map(t=>y.jsx(wr,{value:`${t}`,children:t},t))})]})]}),y.jsxs("div",{className:"flex w-[100px] items-center justify-center text-sm font-medium",children:["Page ",e.getState().pagination.pageIndex+1," of"," ",e.getPageCount()]}),y.jsxs("div",{className:"flex items-center space-x-2",children:[y.jsxs(bn,{variant:"outline",className:"hidden h-8 w-8 p-0 lg:flex",onClick:()=>e.setPageIndex(0),disabled:!e.getCanPreviousPage(),children:[y.jsx("span",{className:"sr-only",children:"Go to first page"}),y.jsx(Gat,{})]}),y.jsxs(bn,{variant:"outline",className:"h-8 w-8 p-0",onClick:()=>e.previousPage(),disabled:!e.getCanPreviousPage(),children:[y.jsx("span",{className:"sr-only",children:"Go to previous page"}),y.jsx(Wat,{})]}),y.jsxs(bn,{variant:"outline",className:"h-8 w-8 p-0",onClick:()=>e.nextPage(),disabled:!e.getCanNextPage(),children:[y.jsx("span",{className:"sr-only",children:"Go to next page"}),y.jsx(NP,{})]}),y.jsxs(bn,{variant:"outline",className:"hidden h-8 w-8 p-0 lg:flex",onClick:()=>e.setPageIndex(e.getPageCount()-1),disabled:!e.getCanNextPage(),children:[y.jsx("span",{className:"sr-only",children:"Go to last page"}),y.jsx(Zat,{})]})]})]})})}function pTt({table:e,children:t,className:n,onRowClick:r}){var l,c;const i=e.getState(),a=!!((l=i.rowPinning.top)!=null&&l.length)||!!((c=i.rowPinning.bottom)!=null&&c.length),o=a?e.getCenterRows():e.getRowModel().rows,s=a?e.getTopRows().length+o.length+e.getBottomRows().length:o.length;return y.jsxs("div",{className:"space-y-4",children:[t,y.jsx("div",{className:Ne("w-full overflow-auto rounded-md border",n),children:y.jsxs(AK,{children:[y.jsx($K,{children:e.getHeaderGroups().map(u=>y.jsx(Dh,{children:u.headers.map(f=>{var d;return y.jsx(LD,{className:(d=f.column.columnDef.meta)==null?void 0:d.className,children:f.isPlaceholder?null:xI(f.column.columnDef.header,f.getContext())},f.id)})},u.id))}),y.jsxs(PK,{children:[a?e.getTopRows().map(u=>y.jsx(Dh,{"data-state":u.getIsSelected()&&"selected",className:Ne("group h-[50px]",{"cursor-pointer":!!r}),onClick:()=>r==null?void 0:r(u.original),children:u.getVisibleCells().map(f=>{var d;return y.jsx(qm,{className:Ne("relative",(d=f.column.columnDef.meta)==null?void 0:d.className),children:xI(f.column.columnDef.cell,f.getContext())},f.id)})},u.id)):null,o.map(u=>y.jsx(Dh,{"data-state":u.getIsSelected()&&"selected",className:Ne("group h-[50px]",{"cursor-pointer":!!r}),onClick:()=>r==null?void 0:r(u.original),children:u.getVisibleCells().map(f=>{var d;return y.jsx(qm,{className:Ne("relative",(d=f.column.columnDef.meta)==null?void 0:d.className),children:xI(f.column.columnDef.cell,f.getContext())},f.id)})},u.id)),a?e.getBottomRows().map(u=>y.jsx(Dh,{"data-state":u.getIsSelected()&&"selected",className:Ne("group h-[50px]",{"cursor-pointer":!!r}),onClick:()=>r==null?void 0:r(u.original),children:u.getVisibleCells().map(f=>{var d;return y.jsx(qm,{className:Ne("relative",(d=f.column.columnDef.meta)==null?void 0:d.className),children:xI(f.column.columnDef.cell,f.getContext())},f.id)})},u.id)):null,s===0?y.jsx(Dh,{children:y.jsx(qm,{colSpan:e.getAllColumns().length,className:"h-24 text-center",children:"No results."})}):null]})]})}),y.jsx(hTt,{table:e})]})}const mTt=Sb("inline-flex items-center rounded-md border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground shadow hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground shadow hover:bg-destructive/80",outline:"text-foreground",plain:"border-transparent text-primary-foreground"}},defaultVariants:{variant:"default"}});function Kh({className:e,variant:t,...n}){return y.jsx("div",{className:Ne(mTt({variant:t}),e),...n})}var Tce=1,gTt=.9,vTt=.8,yTt=.17,pU=.1,mU=.999,bTt=.9999,OTt=.99,xTt=/[\\\/_+.#"@\[\(\{&]/,wTt=/[\\\/_+.#"@\[\(\{&]/g,STt=/[\s-]/,gRe=/[\s-]/g;function ZQ(e,t,n,r,i,a,o){if(a===t.length)return i===e.length?Tce:OTt;var s=`${i},${a}`;if(o[s]!==void 0)return o[s];for(var l=r.charAt(a),c=n.indexOf(l,i),u=0,f,d,h,p;c>=0;)f=ZQ(e,t,n,r,c+1,a+1,o),f>u&&(c===i?f*=Tce:xTt.test(e.charAt(c-1))?(f*=vTt,h=e.slice(i,c-1).match(wTt),h&&i>0&&(f*=Math.pow(mU,h.length))):STt.test(e.charAt(c-1))?(f*=gTt,p=e.slice(i,c-1).match(gRe),p&&i>0&&(f*=Math.pow(mU,p.length))):(f*=yTt,i>0&&(f*=Math.pow(mU,c-i))),e.charAt(c)!==t.charAt(a)&&(f*=bTt)),(f<pU&&n.charAt(c-1)===r.charAt(a+1)||r.charAt(a+1)===r.charAt(a)&&n.charAt(c-1)!==r.charAt(a))&&(d=ZQ(e,t,n,r,c+1,a+2,o),d*pU>f&&(f=d*pU)),f>u&&(u=f),c=n.indexOf(l,c+1);return o[s]=u,u}function Cce(e){return e.toLowerCase().replace(gRe," ")}function _Tt(e,t,n){return e=n&&n.length>0?`${e+" "+n.join(" ")}`:e,ZQ(e,t,Cce(e),Cce(t),0,0,{})}function wt(){return wt=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},wt.apply(this,arguments)}function Zx(e,t,{checkForDefaultPrevented:n=!0}={}){return function(i){if(e==null||e(i),n===!1||!i.defaultPrevented)return t==null?void 0:t(i)}}function ETt(e,t){typeof e=="function"?e(t):e!=null&&(e.current=t)}function vRe(...e){return t=>e.forEach(n=>ETt(n,t))}function ck(...e){return _.useCallback(vRe(...e),e)}function TTt(e,t=[]){let n=[];function r(a,o){const s=_.createContext(o),l=n.length;n=[...n,o];function c(f){const{scope:d,children:h,...p}=f,m=(d==null?void 0:d[e][l])||s,g=_.useMemo(()=>p,Object.values(p));return _.createElement(m.Provider,{value:g},h)}function u(f,d){const h=(d==null?void 0:d[e][l])||s,p=_.useContext(h);if(p)return p;if(o!==void 0)return o;throw new Error(`\`${f}\` must be used within \`${a}\``)}return c.displayName=a+"Provider",[c,u]}const i=()=>{const a=n.map(o=>_.createContext(o));return function(s){const l=(s==null?void 0:s[e])||a;return _.useMemo(()=>({[`__scope${e}`]:{...s,[e]:l}}),[s,l])}};return i.scopeName=e,[r,CTt(i,...t)]}function CTt(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(a){const o=r.reduce((s,{useScope:l,scopeName:c})=>{const f=l(a)[`__scope${c}`];return{...s,...f}},{});return _.useMemo(()=>({[`__scope${t.scopeName}`]:o}),[o])}};return n.scopeName=t.scopeName,n}const YQ=globalThis!=null&&globalThis.document?_.useLayoutEffect:()=>{},ATt=u0.useId||(()=>{});let $Tt=0;function gU(e){const[t,n]=_.useState(ATt());return YQ(()=>{e||n(r=>r??String($Tt++))},[e]),e||(t?`radix-${t}`:"")}function L0(e){const t=_.useRef(e);return _.useEffect(()=>{t.current=e}),_.useMemo(()=>(...n)=>{var r;return(r=t.current)===null||r===void 0?void 0:r.call(t,...n)},[])}function PTt({prop:e,defaultProp:t,onChange:n=()=>{}}){const[r,i]=kTt({defaultProp:t,onChange:n}),a=e!==void 0,o=a?e:r,s=L0(n),l=_.useCallback(c=>{if(a){const f=typeof c=="function"?c(e):c;f!==e&&s(f)}else i(c)},[a,e,i,s]);return[o,l]}function kTt({defaultProp:e,onChange:t}){const n=_.useState(e),[r]=n,i=_.useRef(r),a=L0(t);return _.useEffect(()=>{i.current!==r&&(a(r),i.current=r)},[r,i,a]),n}const kK=_.forwardRef((e,t)=>{const{children:n,...r}=e,i=_.Children.toArray(n),a=i.find(ITt);if(a){const o=a.props.children,s=i.map(l=>l===a?_.Children.count(o)>1?_.Children.only(null):_.isValidElement(o)?o.props.children:null:l);return _.createElement(XQ,wt({},r,{ref:t}),_.isValidElement(o)?_.cloneElement(o,void 0,s):null)}return _.createElement(XQ,wt({},r,{ref:t}),n)});kK.displayName="Slot";const XQ=_.forwardRef((e,t)=>{const{children:n,...r}=e;return _.isValidElement(n)?_.cloneElement(n,{...NTt(r,n.props),ref:t?vRe(t,n.ref):n.ref}):_.Children.count(n)>1?_.Children.only(null):null});XQ.displayName="SlotClone";const RTt=({children:e})=>_.createElement(_.Fragment,null,e);function ITt(e){return _.isValidElement(e)&&e.type===RTt}function NTt(e,t){const n={...t};for(const r in t){const i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...s)=>{a(...s),i(...s)}:i&&(n[r]=i):r==="style"?n[r]={...i,...a}:r==="className"&&(n[r]=[i,a].filter(Boolean).join(" "))}return{...e,...n}}const MTt=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],ju=MTt.reduce((e,t)=>{const n=_.forwardRef((r,i)=>{const{asChild:a,...o}=r,s=a?kK:t;return _.useEffect(()=>{window[Symbol.for("radix-ui")]=!0},[]),_.createElement(s,wt({},o,{ref:i}))});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{});function DTt(e,t){e&&Lf.flushSync(()=>e.dispatchEvent(t))}function LTt(e,t=globalThis==null?void 0:globalThis.document){const n=L0(e);_.useEffect(()=>{const r=i=>{i.key==="Escape"&&n(i)};return t.addEventListener("keydown",r),()=>t.removeEventListener("keydown",r)},[n,t])}const KQ="dismissableLayer.update",jTt="dismissableLayer.pointerDownOutside",FTt="dismissableLayer.focusOutside";let Ace;const UTt=_.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),BTt=_.forwardRef((e,t)=>{var n;const{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:i,onPointerDownOutside:a,onFocusOutside:o,onInteractOutside:s,onDismiss:l,...c}=e,u=_.useContext(UTt),[f,d]=_.useState(null),h=(n=f==null?void 0:f.ownerDocument)!==null&&n!==void 0?n:globalThis==null?void 0:globalThis.document,[,p]=_.useState({}),m=ck(t,P=>d(P)),g=Array.from(u.layers),[v]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),b=g.indexOf(v),O=f?g.indexOf(f):-1,x=u.layersWithOutsidePointerEventsDisabled.size>0,w=O>=b,S=VTt(P=>{const M=P.target,R=[...u.branches].some(C=>C.contains(M));!w||R||(a==null||a(P),s==null||s(P),P.defaultPrevented||l==null||l())},h),T=QTt(P=>{const M=P.target;[...u.branches].some(C=>C.contains(M))||(o==null||o(P),s==null||s(P),P.defaultPrevented||l==null||l())},h);return LTt(P=>{O===u.layers.size-1&&(i==null||i(P),!P.defaultPrevented&&l&&(P.preventDefault(),l()))},h),_.useEffect(()=>{if(f)return r&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(Ace=h.body.style.pointerEvents,h.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(f)),u.layers.add(f),$ce(),()=>{r&&u.layersWithOutsidePointerEventsDisabled.size===1&&(h.body.style.pointerEvents=Ace)}},[f,h,r,u]),_.useEffect(()=>()=>{f&&(u.layers.delete(f),u.layersWithOutsidePointerEventsDisabled.delete(f),$ce())},[f,u]),_.useEffect(()=>{const P=()=>p({});return document.addEventListener(KQ,P),()=>document.removeEventListener(KQ,P)},[]),_.createElement(ju.div,wt({},c,{ref:m,style:{pointerEvents:x?w?"auto":"none":void 0,...e.style},onFocusCapture:Zx(e.onFocusCapture,T.onFocusCapture),onBlurCapture:Zx(e.onBlurCapture,T.onBlurCapture),onPointerDownCapture:Zx(e.onPointerDownCapture,S.onPointerDownCapture)}))});function VTt(e,t=globalThis==null?void 0:globalThis.document){const n=L0(e),r=_.useRef(!1),i=_.useRef(()=>{});return _.useEffect(()=>{const a=s=>{if(s.target&&!r.current){let u=function(){yRe(jTt,n,c,{discrete:!0})};var l=u;const c={originalEvent:s};s.pointerType==="touch"?(t.removeEventListener("click",i.current),i.current=u,t.addEventListener("click",i.current,{once:!0})):u()}else t.removeEventListener("click",i.current);r.current=!1},o=window.setTimeout(()=>{t.addEventListener("pointerdown",a)},0);return()=>{window.clearTimeout(o),t.removeEventListener("pointerdown",a),t.removeEventListener("click",i.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function QTt(e,t=globalThis==null?void 0:globalThis.document){const n=L0(e),r=_.useRef(!1);return _.useEffect(()=>{const i=a=>{a.target&&!r.current&&yRe(FTt,n,{originalEvent:a},{discrete:!1})};return t.addEventListener("focusin",i),()=>t.removeEventListener("focusin",i)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function $ce(){const e=new CustomEvent(KQ);document.dispatchEvent(e)}function yRe(e,t,n,{discrete:r}){const i=n.originalEvent.target,a=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),r?DTt(i,a):i.dispatchEvent(a)}const vU="focusScope.autoFocusOnMount",yU="focusScope.autoFocusOnUnmount",Pce={bubbles:!1,cancelable:!0},zTt=_.forwardRef((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:i,onUnmountAutoFocus:a,...o}=e,[s,l]=_.useState(null),c=L0(i),u=L0(a),f=_.useRef(null),d=ck(t,m=>l(m)),h=_.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;_.useEffect(()=>{if(r){let b=function(S){if(h.paused||!s)return;const T=S.target;s.contains(T)?f.current=T:ym(f.current,{select:!0})},O=function(S){if(h.paused||!s)return;const T=S.relatedTarget;T!==null&&(s.contains(T)||ym(f.current,{select:!0}))},x=function(S){if(document.activeElement===document.body)for(const P of S)P.removedNodes.length>0&&ym(s)};var m=b,g=O,v=x;document.addEventListener("focusin",b),document.addEventListener("focusout",O);const w=new MutationObserver(x);return s&&w.observe(s,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",b),document.removeEventListener("focusout",O),w.disconnect()}}},[r,s,h.paused]),_.useEffect(()=>{if(s){Rce.add(h);const m=document.activeElement;if(!s.contains(m)){const v=new CustomEvent(vU,Pce);s.addEventListener(vU,c),s.dispatchEvent(v),v.defaultPrevented||(WTt(YTt(bRe(s)),{select:!0}),document.activeElement===m&&ym(s))}return()=>{s.removeEventListener(vU,c),setTimeout(()=>{const v=new CustomEvent(yU,Pce);s.addEventListener(yU,u),s.dispatchEvent(v),v.defaultPrevented||ym(m??document.body,{select:!0}),s.removeEventListener(yU,u),Rce.remove(h)},0)}}},[s,c,u,h]);const p=_.useCallback(m=>{if(!n&&!r||h.paused)return;const g=m.key==="Tab"&&!m.altKey&&!m.ctrlKey&&!m.metaKey,v=document.activeElement;if(g&&v){const b=m.currentTarget,[O,x]=HTt(b);O&&x?!m.shiftKey&&v===x?(m.preventDefault(),n&&ym(O,{select:!0})):m.shiftKey&&v===O&&(m.preventDefault(),n&&ym(x,{select:!0})):v===b&&m.preventDefault()}},[n,r,h.paused]);return _.createElement(ju.div,wt({tabIndex:-1},o,{ref:d,onKeyDown:p}))});function WTt(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(ym(r,{select:t}),document.activeElement!==n)return}function HTt(e){const t=bRe(e),n=kce(t,e),r=kce(t.reverse(),e);return[n,r]}function bRe(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const i=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||i?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function kce(e,t){for(const n of e)if(!qTt(n,{upTo:t}))return n}function qTt(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function GTt(e){return e instanceof HTMLInputElement&&"select"in e}function ym(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&>t(e)&&t&&e.select()}}const Rce=ZTt();function ZTt(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=Ice(e,t),e.unshift(t)},remove(t){var n;e=Ice(e,t),(n=e[0])===null||n===void 0||n.resume()}}}function Ice(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function YTt(e){return e.filter(t=>t.tagName!=="A")}const XTt=_.forwardRef((e,t)=>{var n;const{container:r=globalThis==null||(n=globalThis.document)===null||n===void 0?void 0:n.body,...i}=e;return r?Uh.createPortal(_.createElement(ju.div,wt({},i,{ref:t})),r):null});function KTt(e,t){return _.useReducer((n,r)=>{const i=t[n][r];return i??n},e)}const o3=e=>{const{present:t,children:n}=e,r=JTt(t),i=typeof n=="function"?n({present:r.isPresent}):_.Children.only(n),a=ck(r.ref,i.ref);return typeof n=="function"||r.isPresent?_.cloneElement(i,{ref:a}):null};o3.displayName="Presence";function JTt(e){const[t,n]=_.useState(),r=_.useRef({}),i=_.useRef(e),a=_.useRef("none"),o=e?"mounted":"unmounted",[s,l]=KTt(o,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return _.useEffect(()=>{const c=wI(r.current);a.current=s==="mounted"?c:"none"},[s]),YQ(()=>{const c=r.current,u=i.current;if(u!==e){const d=a.current,h=wI(c);e?l("MOUNT"):h==="none"||(c==null?void 0:c.display)==="none"?l("UNMOUNT"):l(u&&d!==h?"ANIMATION_OUT":"UNMOUNT"),i.current=e}},[e,l]),YQ(()=>{if(t){const c=f=>{const h=wI(r.current).includes(f.animationName);f.target===t&&h&&Lf.flushSync(()=>l("ANIMATION_END"))},u=f=>{f.target===t&&(a.current=wI(r.current))};return t.addEventListener("animationstart",u),t.addEventListener("animationcancel",c),t.addEventListener("animationend",c),()=>{t.removeEventListener("animationstart",u),t.removeEventListener("animationcancel",c),t.removeEventListener("animationend",c)}}else l("ANIMATION_END")},[t,l]),{isPresent:["mounted","unmountSuspended"].includes(s),ref:_.useCallback(c=>{c&&(r.current=getComputedStyle(c)),n(c)},[])}}function wI(e){return(e==null?void 0:e.animationName)||"none"}let bU=0;function eCt(){_.useEffect(()=>{var e,t;const n=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",(e=n[0])!==null&&e!==void 0?e:Nce()),document.body.insertAdjacentElement("beforeend",(t=n[1])!==null&&t!==void 0?t:Nce()),bU++,()=>{bU===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(r=>r.remove()),bU--}},[])}function Nce(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.cssText="outline: none; opacity: 0; position: fixed; pointer-events: none",e}var S2="right-scroll-bar-position",_2="width-before-scroll-bar",tCt="with-scroll-bars-hidden",nCt="--removed-body-scroll-bar-size",ORe=rTe(),OU=function(){},s3=_.forwardRef(function(e,t){var n=_.useRef(null),r=_.useState({onScrollCapture:OU,onWheelCapture:OU,onTouchMoveCapture:OU}),i=r[0],a=r[1],o=e.forwardProps,s=e.children,l=e.className,c=e.removeScrollBar,u=e.enabled,f=e.shards,d=e.sideCar,h=e.noIsolation,p=e.inert,m=e.allowPinchZoom,g=e.as,v=g===void 0?"div":g,b=vF(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noIsolation","inert","allowPinchZoom","as"]),O=d,x=nTe([n,t]),w=On(On({},b),i);return _.createElement(_.Fragment,null,u&&_.createElement(O,{sideCar:ORe,removeScrollBar:c,shards:f,noIsolation:h,inert:p,setCallbacks:a,allowPinchZoom:!!m,lockRef:n}),o?_.cloneElement(_.Children.only(s),On(On({},w),{ref:x})):_.createElement(v,On({},w,{className:l,ref:x}),s))});s3.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};s3.classNames={fullWidth:_2,zeroRight:S2};var rCt={left:0,top:0,right:0,gap:0},xU=function(e){return parseInt(e||"",10)||0},iCt=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],r=t[e==="padding"?"paddingTop":"marginTop"],i=t[e==="padding"?"paddingRight":"marginRight"];return[xU(n),xU(r),xU(i)]},aCt=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return rCt;var t=iCt(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},oCt=bF(),sCt=function(e,t,n,r){var i=e.left,a=e.top,o=e.right,s=e.gap;return n===void 0&&(n="margin"),`
|
|
641
641
|
.`.concat(tCt,` {
|
|
642
642
|
overflow: hidden `).concat(r,`;
|
|
643
643
|
padding-right: `).concat(s,"px ").concat(r,`;
|
package/static/index.html
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
7
7
|
|
|
8
8
|
<title>Momentic app</title>
|
|
9
|
-
<script type="module" crossorigin src="/assets/index-
|
|
9
|
+
<script type="module" crossorigin src="/assets/index-Vi57bXsG.js"></script>
|
|
10
10
|
<link rel="stylesheet" crossorigin href="/assets/index-oBpJV6By.css">
|
|
11
11
|
</head>
|
|
12
12
|
<body>
|