{"_id":"sweph-wasm","_rev":"4-713937305fce465f5e953a884a56bf0b","name":"sweph-wasm","dist-tags":{"latest":"2.6.9"},"versions":{"1.2.12":{"name":"sweph-wasm","version":"1.2.12","keywords":["swiss-ephemeris","astronomy","astrology","ephemeris","planetary-positions","house-systems","eclipses","fixed-stars","celestial-mechanics","astronomical-calculations","astrological-calculations","julian-day","coordinate-transformations","heliacal-events","nodes-apsides","sidereal-time","typescript","webassembly","wasm","emscripten","browser","nodejs","typesafe","high-precision"],"author":{"url":"https://github.com/ptprashanttripathi","name":"Pt. Prashant Tripathi"},"license":"AGPL-3.0-or-later","_id":"sweph-wasm@1.2.12","maintainers":[{"name":"ptprashanttripathi","email":"ptprashanttripathi@outlook.com"}],"homepage":"https://github.com/ptprashanttripathi/sweph-wasm","bugs":{"url":"https://github.com/ptprashanttripathi/sweph-wasm/issues"},"dist":{"shasum":"0b339c246c5934cceac74223d51c522b82c16531","tarball":"https://registry.npmjs.org/sweph-wasm/-/sweph-wasm-1.2.12.tgz","fileCount":11,"integrity":"sha512-JF1A9rP585UIxcjf/XHrGZUeC1qS4x1WRGA5CUuRVsxhKmGvs3DYxnhcBrOO6tIDFKewb2iRcXn2GjcEDcDOAg==","signatures":[{"sig":"MEUCIQCAVrm/0HPNmQuLvuBZLNivC6iO3xAv3Szel8a+m79Z5wIgQiQKV3U+O3w5tL7oGB+pexjJiAX03fvY6aDTUpbwmxg=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":1041614},"main":"src/index.ts","type":"module","engines":{"node":">=22"},"funding":{"url":"https://github.com/sponsors/ptprashanttripathi","type":"github"},"gitHead":"c5088c9d936f8dfb555da7cc03dadf440e57d40a","scripts":{"dev":"tsc --watch","lint":"eslint . --fix","test":"vitest run","build":"npm run clean && npm run build:ts && cp src/wasm/index.d.ts dist/wasm/index.d.ts","clean":"rm -rf dist coverage","format":"prettier --write \"**/*.{ts,js,json,md,yml}\"","test:ui":"vitest --ui","build:ts":"tsc","typecheck":"tsc --noEmit","build:wasm":"python3 build && npm run format","lint:check":"eslint .","test:watch":"vitest --watch","format:check":"prettier --check \"**/*.{ts,js,json,md,yml}\"","test:coverage":"vitest run --coverage"},"_npmUser":{"name":"ptprashanttripathi","email":"ptprashanttripathi@outlook.com"},"repository":{"url":"git+https://github.com/ptprashanttripathi/sweph-wasm.git","type":"git"},"_npmVersion":"11.5.1","description":"High-precision Swiss Ephemeris WebAssembly bindings for TypeScript — comprehensive astronomical calculations including planetary positions, house systems, eclipses, fixed stars, and astrological computations with modern JS/TS support.","directories":{},"_nodeVersion":"24.6.0","browserslist":["defaults","supports webassembly"],"dependencies":{"wasp-lib":"latest","fixed-len-array":"latest"},"_hasShrinkwrap":false,"devDependencies":{"eslint":"latest","vitest":"latest","globals":"latest","prettier":"latest","@eslint/js":"latest","@vitest/ui":"latest","typescript":"latest","@types/emscripten":"latest","typescript-eslint":"latest","@vitest/coverage-v8":"latest","prettier-plugin-jsdoc":"latest","eslint-config-prettier":"latest","@typescript-eslint/parser":"latest","eslint-plugin-unused-imports":"latest","eslint-plugin-simple-import-sort":"latest"},"typeScriptVersion":"latest","_npmOperationalInternal":{"tmp":"tmp/sweph-wasm_1.2.12_1755723833131_0.4948408682866703","host":"s3://npm-registry-packages-npm-production"}},"2.1.12":{"name":"sweph-wasm","version":"2.1.12","keywords":["swiss-ephemeris","astronomy","astrology","ephemeris","planetary-positions","house-systems","eclipses","fixed-stars","celestial-mechanics","astronomical-calculations","astrological-calculations","julian-day","coordinate-transformations","heliacal-events","nodes-apsides","sidereal-time","typescript","webassembly","wasm","emscripten","browser","nodejs","typesafe","high-precision"],"author":{"url":"https://github.com/ptprashanttripathi","name":"Pt. Prashant Tripathi"},"license":"AGPL-3.0-or-later","_id":"sweph-wasm@2.1.12","maintainers":[{"name":"ptprashanttripathi","email":"ptprashanttripathi@outlook.com"}],"homepage":"https://github.com/ptprashanttripathi/sweph-wasm","bugs":{"url":"https://github.com/ptprashanttripathi/sweph-wasm/issues"},"dist":{"shasum":"71ea996db51e4473f581498bcf2a68ccfb7a23dd","tarball":"https://registry.npmjs.org/sweph-wasm/-/sweph-wasm-2.1.12.tgz","fileCount":19,"integrity":"sha512-FDRqAZJ3G0EW+2dBw+Rhj58aCsLmpaYZtXlquHe6BsaMRoqLP0hnj6AsX1Jp0Ka/fpJ/srHoopoRgzinfSo7jQ==","signatures":[{"sig":"MEQCIHvHZTb5LFkeWqKoIkcSRdPvJuIhw78D4XL26RhJE0w7AiBZdtOrvGePGzzWdSshirMUV0dKjmdkj8odlhrpl1ERbA==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":3140828},"main":"./dist/index.cjs","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","browser":"./dist/index.umd.js","engines":{"node":">=22"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","browser":"./dist/index.js","require":"./dist/index.cjs"}},"funding":{"url":"https://github.com/sponsors/ptprashanttripathi","type":"github"},"gitHead":"d792a0f65316c2d752687514654c97f25c13a959","scripts":{"lint":"eslint . --fix","test":"vitest run","build":"npm run clean && rollup -c","clean":"rm -rf dist coverage","format":"prettier --write \"**/*.{ts,js,json,md,yml}\"","test:ui":"vitest --ui","typecheck":"tsc --noEmit","build:wasm":"python3 -m build_tool && npm run format","lint:check":"eslint .","test:watch":"vitest --watch","format:check":"prettier --check \"**/*.{ts,js,json,md,yml}\"","test:coverage":"vitest run --coverage"},"_npmUser":{"name":"ptprashanttripathi","email":"ptprashanttripathi@outlook.com"},"repository":{"url":"git+https://github.com/ptprashanttripathi/sweph-wasm.git","type":"git"},"_npmVersion":"11.5.1","description":"High-precision Swiss Ephemeris WebAssembly bindings for TypeScript — comprehensive astronomical calculations including planetary positions, house systems, eclipses, fixed stars, and astrological computations with modern JS/TS support.","directories":{},"_nodeVersion":"24.6.0","browserslist":["defaults","supports webassembly"],"dependencies":{"wasp-lib":"latest","fixed-len-array":"latest"},"_hasShrinkwrap":false,"devDependencies":{"tslib":"latest","eslint":"latest","rollup":"latest","vitest":"latest","globals":"latest","prettier":"latest","@eslint/js":"latest","@vitest/ui":"latest","typescript":"latest","@types/emscripten":"latest","typescript-eslint":"latest","@rollup/plugin-url":"latest","rollup-plugin-copy":"latest","@vitest/coverage-v8":"latest","@rollup/plugin-terser":"latest","prettier-plugin-jsdoc":"latest","eslint-config-prettier":"latest","@rollup/plugin-commonjs":"latest","@rollup/plugin-typescript":"latest","@rollup/plugin-node-resolve":"latest","eslint-plugin-unused-imports":"latest","eslint-plugin-simple-import-sort":"latest"},"typeScriptVersion":"latest","_npmOperationalInternal":{"tmp":"tmp/sweph-wasm_2.1.12_1756137722139_0.06985800141391851","host":"s3://npm-registry-packages-npm-production"}},"2.5.9":{"name":"sweph-wasm","version":"2.5.9","keywords":["swiss-ephemeris","astronomy","astrology","ephemeris","planetary-positions","house-systems","eclipses","fixed-stars","celestial-mechanics","astronomical-calculations","astrological-calculations","julian-day","coordinate-transformations","heliacal-events","nodes-apsides","sidereal-time","typescript","webassembly","wasm","emscripten","browser","nodejs","typesafe","high-precision"],"author":{"url":"https://github.com/ptprashanttripathi","name":"Pt. Prashant Tripathi"},"license":"AGPL-3.0-or-later","_id":"sweph-wasm@2.5.9","maintainers":[{"name":"ptprashanttripathi","email":"ptprashanttripathi@outlook.com"}],"homepage":"https://github.com/ptprashanttripathi/sweph-wasm","bugs":{"url":"https://github.com/ptprashanttripathi/sweph-wasm/issues"},"dist":{"shasum":"688458da028ce93b593afd9966ea1796c19f5b80","tarball":"https://registry.npmjs.org/sweph-wasm/-/sweph-wasm-2.5.9.tgz","fileCount":19,"integrity":"sha512-XXjnaCjm5kHius+NjZJzbC2ahqG6H2X7jXiyhP5xTojc9ljTNsU3qdIOxKlokGJMPJDUkPXWkXuIw/R2vLfEhg==","signatures":[{"sig":"MEUCIQCvQ8+aW5OlZo1zSLDso85EN8eWD3iwyJdwTkPRplu53QIgH3/gL3/IRzyNpvvieK7zyhMXDB3D+gOfQfH9MF7Ll08=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":3134753},"main":"./dist/index.cjs","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","browser":"./dist/index.umd.js","engines":{"node":">=22"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","browser":"./dist/index.js","require":"./dist/index.cjs"}},"funding":{"url":"https://github.com/sponsors/ptprashanttripathi","type":"github"},"gitHead":"c88da76f940fbb74ec5b5e247fdfaa91b9ae8b1c","scripts":{"lint":"eslint . --fix","test":"vitest run","build":"npm run clean && rollup -c","clean":"rm -rf dist coverage","format":"prettier --write \"**/*.{ts,js,json,md,yml}\"","test:ui":"vitest --ui","typecheck":"tsc --noEmit","build:wasm":"python3 -m build_tool && npm run format","lint:check":"eslint .","test:watch":"vitest --watch","format:check":"prettier --check \"**/*.{ts,js,json,md,yml}\"","test:coverage":"vitest run --coverage"},"_npmUser":{"name":"ptprashanttripathi","email":"ptprashanttripathi@outlook.com"},"repository":{"url":"git+https://github.com/ptprashanttripathi/sweph-wasm.git","type":"git"},"_npmVersion":"11.5.1","description":"High-precision Swiss Ephemeris WebAssembly bindings for TypeScript — comprehensive astronomical calculations including planetary positions, house systems, eclipses, fixed stars, and astrological computations with modern JS/TS support.","directories":{},"_nodeVersion":"24.7.0","browserslist":["defaults","supports webassembly"],"dependencies":{"wasp-lib":"latest","fixed-len-array":"latest"},"_hasShrinkwrap":false,"devDependencies":{"tslib":"latest","eslint":"latest","rollup":"latest","vitest":"latest","globals":"latest","prettier":"latest","@eslint/js":"latest","@vitest/ui":"latest","typescript":"latest","@types/emscripten":"latest","typescript-eslint":"latest","@rollup/plugin-url":"latest","rollup-plugin-copy":"latest","@vitest/coverage-v8":"latest","@rollup/plugin-terser":"latest","prettier-plugin-jsdoc":"latest","eslint-config-prettier":"latest","@rollup/plugin-commonjs":"latest","@rollup/plugin-typescript":"latest","@rollup/plugin-node-resolve":"latest","eslint-plugin-unused-imports":"latest","eslint-plugin-simple-import-sort":"latest"},"typeScriptVersion":"latest","_npmOperationalInternal":{"tmp":"tmp/sweph-wasm_2.5.9_1757340173026_0.42915944368888015","host":"s3://npm-registry-packages-npm-production"}},"2.6.9":{"name":"sweph-wasm","version":"2.6.9","description":"High-precision Swiss Ephemeris WebAssembly bindings for TypeScript — comprehensive astronomical calculations including planetary positions, house systems, eclipses, fixed stars, and astrological computations with modern JS/TS support.","keywords":["swiss-ephemeris","astronomy","astrology","ephemeris","planetary-positions","house-systems","eclipses","fixed-stars","celestial-mechanics","astronomical-calculations","astrological-calculations","julian-day","coordinate-transformations","heliacal-events","nodes-apsides","sidereal-time","typescript","webassembly","wasm","emscripten","browser","nodejs","typesafe","high-precision"],"homepage":"https://github.com/ptprashanttripathi/sweph-wasm","bugs":{"url":"https://github.com/ptprashanttripathi/sweph-wasm/issues"},"repository":{"type":"git","url":"git+https://github.com/ptprashanttripathi/sweph-wasm.git"},"funding":{"type":"github","url":"https://github.com/sponsors/ptprashanttripathi"},"license":"AGPL-3.0-or-later","author":{"name":"Pt. Prashant Tripathi","url":"https://github.com/ptprashanttripathi"},"type":"module","exports":{".":{"require":"./dist/index.cjs","browser":"./dist/index.js","types":"./dist/index.d.ts","import":"./dist/index.js"},"./wasm/swisseph":{"require":"./dist/wasm/swisseph.cjs","browser":"./dist/wasm/swisseph.js","types":"./dist/wasm/swisseph.d.ts","import":"./dist/wasm/swisseph.js"}},"main":"./dist/index.cjs","module":"./dist/index.js","browser":"./dist/index.js","types":"./dist/index.d.ts","scripts":{"build":"npm run clean && rollup -c","build:wasm":"python3 -m build_tool && npm run format","clean":"rm -rf dist coverage","format":"prettier --write \"**/*.{ts,js,json,md,yml}\"","format:check":"prettier --check \"**/*.{ts,js,json,md,yml}\"","lint":"eslint . --fix","lint:check":"eslint .","test":"vitest run","test:coverage":"vitest run --coverage","test:ui":"vitest --ui","test:watch":"vitest --watch","typecheck":"tsc --noEmit"},"browserslist":["defaults","supports webassembly"],"dependencies":{"fixed-len-array":"latest","wasp-lib":"latest"},"devDependencies":{"@eslint/js":"latest","@rollup/plugin-node-resolve":"latest","@rollup/plugin-terser":"latest","@rollup/plugin-typescript":"latest","@types/emscripten":"latest","@vitest/coverage-v8":"latest","@vitest/ui":"latest","eslint":"latest","eslint-config-prettier":"latest","eslint-plugin-simple-import-sort":"latest","eslint-plugin-unused-imports":"latest","globals":"latest","prettier":"latest","prettier-plugin-jsdoc":"latest","rollup":"latest","rollup-plugin-copy":"latest","tslib":"latest","typescript":"latest","typescript-eslint":"latest","vitest":"latest"},"engines":{"node":">=22"},"typeScriptVersion":"latest","_id":"sweph-wasm@2.6.9","gitHead":"0583463e4c4f4791e19f2a9f1962d2d965e021ab","_nodeVersion":"24.7.0","_npmVersion":"11.5.1","dist":{"integrity":"sha512-SNM+XiujTAlgyU07M7onZWYNk/XsFmaWWm9QphMRkaNzXVMx9sRLBzxs7ubO9kBbXEPgJSm2SP/xyzOZ8Vp1mA==","shasum":"fea7be99303a1834267c988439e67fdffc6d6894","tarball":"https://registry.npmjs.org/sweph-wasm/-/sweph-wasm-2.6.9.tgz","fileCount":167,"unpackedSize":110593195,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQCR1NSvBlCPGRylZTSKXT1yzlAFrsA6BwE4eVo9wPFCuwIhAP6+b+9enmZzf2fZs7QNWwYNZ2Trn5IZefgDhyU5G/gR"}]},"_npmUser":{"name":"ptprashanttripathi","email":"ptprashanttripathi@outlook.com"},"directories":{},"maintainers":[{"name":"ptprashanttripathi","email":"ptprashanttripathi@outlook.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/sweph-wasm_2.6.9_1757418685958_0.4431248838614388"},"_hasShrinkwrap":false}},"time":{"created":"2025-08-20T21:03:53.062Z","modified":"2025-09-09T11:51:27.582Z","1.2.12":"2025-08-20T21:03:53.488Z","2.1.12":"2025-08-25T16:02:02.401Z","2.5.9":"2025-09-08T14:02:53.381Z","2.6.9":"2025-09-09T11:51:27.377Z"},"bugs":{"url":"https://github.com/ptprashanttripathi/sweph-wasm/issues"},"author":{"name":"Pt. Prashant Tripathi","url":"https://github.com/ptprashanttripathi"},"license":"AGPL-3.0-or-later","homepage":"https://github.com/ptprashanttripathi/sweph-wasm","keywords":["swiss-ephemeris","astronomy","astrology","ephemeris","planetary-positions","house-systems","eclipses","fixed-stars","celestial-mechanics","astronomical-calculations","astrological-calculations","julian-day","coordinate-transformations","heliacal-events","nodes-apsides","sidereal-time","typescript","webassembly","wasm","emscripten","browser","nodejs","typesafe","high-precision"],"repository":{"type":"git","url":"git+https://github.com/ptprashanttripathi/sweph-wasm.git"},"description":"High-precision Swiss Ephemeris WebAssembly bindings for TypeScript — comprehensive astronomical calculations including planetary positions, house systems, eclipses, fixed stars, and astrological computations with modern JS/TS support.","maintainers":[{"name":"ptprashanttripathi","email":"ptprashanttripathi@outlook.com"}],"readme":"<div align=\"center\">\n  <h3><em>Swiss Ephemeris WebAssembly</em></h3>\n\n  <p><strong>A comprehensive TypeScript/JavaScript wrapper for the Swiss Ephemeris astronomical calculation library compiled to WebAssembly. This library provides high-precision calculations for planetary positions, house systems, eclipses, and various astronomical phenomena.</strong></p>\n\n  <p>\n    <a href=\"https://www.npmjs.com/package/sweph-wasm\"><img src=\"https://img.shields.io/npm/v/sweph-wasm.svg\" alt=\"NPM Version\"/></a>\n    <a href=\"https://github.com/ptprashanttripathi/sweph-wasm/actions\"><img src=\"https://img.shields.io/github/actions/workflow/status/ptprashanttripathi/sweph-wasm/npm-publish.yml?branch=main\" alt=\"Build Status\"/></a>\n    <a href=\"https://github.com/ptprashanttripathi/sweph-wasm/blob/main/LICENSE\"><img src=\"https://img.shields.io/npm/l/sweph-wasm.svg\" alt=\"MIT License\"/></a>\n    <a href=\"https://www.typescriptlang.org/\"><img src=\"https://img.shields.io/badge/TypeScript-Ready-blue.svg\" alt=\"TypeScript Ready\"/></a>\n    <a href=\"https://github.com/ptprashanttripathi/sweph-wasm/blob/main/docs\"><img src=\"https://img.shields.io/badge/docs-available-brightgreen.svg\" alt=\"Documentation\"/></a>\n  </p>\n</div>\n\n## Features\n\n- **Planetary Calculations**: Calculate positions of planets, moon, sun, and\n  asteroids\n- **House Systems**: Support for 25+ house systems including Placidus, Koch,\n  Equal House, etc.\n- **Eclipse Calculations**: Solar and lunar eclipses with detailed timing and\n  visibility\n- **Coordinate Transformations**: Convert between different coordinate systems\n- **Fixed Stars**: Calculate positions and magnitudes of fixed stars\n- **Heliacal Events**: Rising and setting calculations for celestial objects\n- **High Precision**: Based on the renowned Swiss Ephemeris library\n- **WebAssembly Performance**: Fast calculations in the browser or Node.js\n\n## Installation\n\n```bash\nnpm install sweph-wasm\n```\n\n## Quick Start\n\n```typescript\nimport SwissEPH from \"sweph-wasm\";\n\n// Initialize the library\nconst swe = await SwissEPH.init();\n\n// Set ephemeris files path (optional, downloads from CDN by default)\nawait swe.swe_set_ephe_path();\n\n// Calculate planetary positions\nconst julianDay = swe.swe_julday(2024, 1, 1, 12.0, 1); // Jan 1, 2024, noon\nconst sunPosition = swe.swe_calc_ut(julianDay, 0, 0); // Sun position\n\nconsole.log(`Sun longitude: ${sunPosition[0]}°`);\nconsole.log(`Sun latitude: ${sunPosition[1]}°`);\nconsole.log(`Sun distance: ${sunPosition[2]} AU`);\n\n// Calculate houses\nconst houses = swe.swe_houses(julianDay, 40.7128, -74.006, \"P\"); // New York, Placidus\nconsole.log(\"House cusps:\", houses.cusps);\nconsole.log(\"Ascendant:\", houses.ascmc[0]);\n```\n\n## Core Methods\n\n### Initialization\n\n#### `SwissEPH.init(): Promise<SwissEPH>`\n\nInitializes the Swiss Ephemeris WebAssembly module.\n\n#### `swe_set_ephe_path(epheUrl?, fileNames?): Promise<void>`\n\nDownloads and sets up ephemeris files.\n\n- `epheUrl`: URL to ephemeris files (default: Swiss Ephemeris CDN)\n- `fileNames`: Array of specific files to download\n\n### Planetary Calculations\n\n#### `swe_calc_ut(tjd_ut, ipl, iflag): CelestialCoordinatesAdvance`\n\nCalculate planetary positions in Universal Time.\n\n- `tjd_ut`: Julian Day in Universal Time\n- `ipl`: Planet ID (0=Sun, 1=Moon, 2=Mercury, etc.)\n- `iflag`: Calculation flags\n\n#### `swe_calc(tjd_et, ipl, iflag): CelestialCoordinatesAdvance`\n\nCalculate planetary positions in Ephemeris Time.\n\n### House Systems\n\n#### `swe_houses(tjd_ut, geolat, geolon, hsys): Houses`\n\nCalculate house cusps and angles.\n\n- `tjd_ut`: Julian Day UT\n- `geolat`: Geographic latitude in degrees\n- `geolon`: Geographic longitude in degrees\n- `hsys`: House system ('P'=Placidus, 'K'=Koch, 'E'=Equal, etc.)\n\nSupported house systems:\n\n- **A**: Equal (Asc)\n- **B**: Alcabitus\n- **C**: Campanus\n- **D**: Equal (MC)\n- **E**: Equal\n- **F**: Carter poli-equatorial\n- **G**: Gauquelin sectors (36)\n- **H**: Azimuthal/Horizontal\n- **I**: Sunshine\n- **K**: Koch\n- **L**: Pullen SD\n- **M**: Morinus\n- **N**: Equal/1=Aries\n- **O**: Porphyrius\n- **P**: Placidus\n- **Q**: Pullen SR\n- **R**: Regiomontanus\n- **S**: Sripati\n- **T**: Polich/Page\n- **U**: Krusinski-Pisa-Goelzer\n- **V**: Equal/Vehlow\n- **W**: Equal/Whole Sign\n- **X**: Axial rotation system/Meridian houses\n- **Y**: APC houses\n\n### Date/Time Utilities\n\n#### `swe_julday(year, month, day, hour, gregflag): number`\n\nConvert calendar date to Julian Day.\n\n#### `swe_revjul(tjd, gregflag): DateTimeObject`\n\nConvert Julian Day to calendar date.\n\n#### `swe_utc_to_jd(iyear, imonth, iday, ihour, imin, dsec, gregflag): [et, ut]`\n\nConvert UTC time to Julian Day.\n\n### Eclipse Calculations\n\n#### `swe_sol_eclipse_when_loc(tjd_start, ifl, geopos, backwards): EclipseData`\n\nCalculate local solar eclipse times.\n\n#### `swe_lun_eclipse_when_loc(tjd_start, ifl, geopos, backwards): EclipseData`\n\nCalculate local lunar eclipse times.\n\n### Fixed Stars\n\n#### `swe_fixstar_ut(star, tjd_ut, iflag): FixstarResult`\n\nCalculate fixed star positions.\n\n#### `swe_fixstar_mag(star): FixstarMagnitude`\n\nGet fixed star magnitude.\n\n## Planet Constants\n\n```typescript\nconst PLANETS = {\n    SUN: 0,\n    MOON: 1,\n    MERCURY: 2,\n    VENUS: 3,\n    MARS: 4,\n    JUPITER: 5,\n    SATURN: 6,\n    URANUS: 7,\n    NEPTUNE: 8,\n    PLUTO: 9,\n    MEAN_NODE: 10,\n    TRUE_NODE: 11,\n    MEAN_APOG: 12,\n    OSCU_APOG: 13,\n    EARTH: 14,\n    CHIRON: 15,\n    PHOLUS: 16,\n    CERES: 17,\n    PALLAS: 18,\n    JUNO: 19,\n    VESTA: 20,\n};\n```\n\n## Calculation Flags\n\nCommon calculation flags that can be combined:\n\n- `SEFLG_JPLEPH`: Use JPL ephemeris\n- `SEFLG_SWIEPH`: Use Swiss Ephemeris (default)\n- `SEFLG_MOSEPH`: Use Moshier ephemeris\n- `SEFLG_HELCTR`: Heliocentric positions\n- `SEFLG_TRUEPOS`: True positions (not apparent)\n- `SEFLG_J2000`: J2000 coordinates\n- `SEFLG_NONUT`: No nutation\n- `SEFLG_SPEED`: Calculate speeds\n- `SEFLG_NOGDEFL`: No gravitational deflection\n- `SEFLG_NOABERR`: No aberration\n- `SEFLG_ASTROMETRIC`: Astrometric positions\n- `SEFLG_EQUATORIAL`: Equatorial coordinates\n- `SEFLG_XYZ`: Cartesian coordinates\n- `SEFLG_RADIANS`: Return values in radians\n- `SEFLG_BARYCTR`: Barycentric positions\n- `SEFLG_TOPOCTR`: Topocentric positions\n- `SEFLG_ORBEL_AA`: Osculating orbital elements\n- `SEFLG_TROPICAL`: Tropical zodiac (default)\n- `SEFLG_SIDEREAL`: Sidereal zodiac\n- `SEFLG_ICRS`: ICRS reference system\n\n## Advanced Features\n\n### Coordinate Transformations\n\n```typescript\n// Convert ecliptic to equatorial coordinates\nconst equatorialCoords = swe.swe_cotrans(eclipticCoords, obliquity);\n\n// Convert horizontal to ecliptic coordinates\nconst eclipticCoords = swe.swe_azalt_rev(tjd_ut, calc_flag, geopos, [\n    azimuth,\n    altitude,\n]);\n```\n\n### Atmospheric Refraction\n\n```typescript\n// Calculate atmospheric refraction\nconst refraction = swe.swe_refrac(altitude, pressure, temperature, calc_flag);\n\n// Extended refraction calculation\nconst refractionData = swe.swe_refrac_extended(\n    altitude,\n    geo_altitude,\n    pressure,\n    temperature,\n    lapse_rate,\n    calc_flag\n);\n```\n\n### Heliacal Events\n\n```typescript\n// Calculate heliacal rising/setting\nconst heliacalEvent = swe.swe_heliacal_ut(\n    tjd_ut,\n    geographic_pos,\n    atmospheric_conditions,\n    observer_conditions,\n    object_name,\n    event_type,\n    heliacal_flag\n);\n```\n\n## Error Handling\n\nThe library throws `SWEerror` exceptions for calculation errors:\n\n```typescript\ntry {\n    const result = swe.swe_calc_ut(julianDay, planetId, flags);\n} catch (error) {\n    if (error instanceof SWEerror) {\n        console.error(\n            \"Swiss Ephemeris error:\",\n            error.message,\n            \"Code:\",\n            error.code\n        );\n    }\n}\n```\n\n## Type Definitions\n\nThe library includes comprehensive TypeScript definitions:\n\n- `CelestialCoordinates2D`: [longitude, latitude]\n- `CelestialCoordinates3D`: [longitude, latitude, distance]\n- `CelestialCoordinatesAdvance`: [lon, lat, dist, lonSpeed, latSpeed, distSpeed]\n- `Houses<N>`: House cusps and angles\n- `DateTimeObject`: Year, month, day, hour, minute, second\n- `EclipseData`: Eclipse timing and characteristics\n- `FixstarResult`: Fixed star name and coordinates\n\n## Browser Compatibility\n\n- Modern browsers with WebAssembly support\n- Node.js 14+ with WebAssembly support\n- TypeScript 4.0+\n\n## Performance Tips\n\n1. **Reuse instances**: Initialize SwissEPH once and reuse\n2. **Cache ephemeris files**: Files are cached in browser memory\n3. **Batch calculations**: Calculate multiple planets in sequence\n4. **Use appropriate flags**: Only request needed precision/features\n5. **Close when done**: Call `swe_close()` to free resources\n\n## Examples\n\n### Birth Chart Calculation\n\n```typescript\nconst swe = await SwissEPH.init();\nawait swe.swe_set_ephe_path();\n\nconst birthDate = { year: 1990, month: 6, day: 15, hour: 14.5 };\nconst birthPlace = { lat: 40.7128, lon: -74.006 }; // New York\n\nconst jd = swe.swe_julday(\n    birthDate.year,\n    birthDate.month,\n    birthDate.day,\n    birthDate.hour,\n    1\n);\n\n// Calculate all planets\nconst planets = [];\nfor (let i = 0; i <= 9; i++) {\n    const position = swe.swe_calc_ut(jd, i, 0);\n    planets.push({\n        id: i,\n        longitude: position[0],\n        latitude: position[1],\n        distance: position[2],\n    });\n}\n\n// Calculate houses\nconst houses = swe.swe_houses(jd, birthPlace.lat, birthPlace.lon, \"P\");\n\nconsole.log(\"Planets:\", planets);\nconsole.log(\"House cusps:\", houses.cusps);\nconsole.log(\"Ascendant:\", houses.ascmc[0]);\n```\n\n### Eclipse Calculation\n\n```typescript\nconst swe = await SwissEPH.init();\n\nconst startDate = swe.swe_julday(2024, 1, 1, 0, 1);\nconst location = [0, 0, 0]; // Greenwich\n\n// Find next solar eclipse\nconst eclipse = swe.swe_sol_eclipse_when_loc(startDate, 0, location, false);\n\nconsole.log(\n    \"Eclipse maximum:\",\n    new Date((eclipse.eclipseContactTimes[0] - 2440587.5) * 86400000)\n);\n```\n\n## 🤝 Contributing\n\nWe welcome contributions! Please see our [Contributing Guide](CONTRIBUTING.md)\nfor details.\n\n## License\n\nThis project is licensed under the same terms as the Swiss Ephemeris library.\nPlease refer to the Swiss Ephemeris documentation for licensing details.\n\n## Credits\n\n- Swiss Ephemeris by Astrodienst AG\n- WebAssembly compilation and TypeScript wrapper\n- Community contributors\n\n## Support\n\nFor issues and questions:\n\n- GitHub Issues for bug reports\n- Documentation for API reference\n- Swiss Ephemeris official documentation for calculation details\n\n### Development Setup\n\n```bash\n# Clone repository\ngit clone https://github.com/ptprashanttripathi/sweph-wasm.git\ncd sweph-wasm\n\n# Install dependencies\nnpm install\n\n# Build TypeScript\nnpm run build\n\n# Build WASM test module\nnpm run build:wasm\n\n# Run tests\nnpm test\n\n# Generate documentation\nnpm run build:docs\n```\n\n## 📄 License\n\nThis project is [MIT](LICENSE) licensed.\n\n## 🙏 Acknowledgments\n\n- **Emscripten Team** - For making WebAssembly accessible\n- **TypeScript Team** - For excellent type system support\n- **WebAssembly Community** - For pushing the boundaries of web performance\n\n---\n\n<div align=\"center\">\n<p>Made with ❤️ by <a href=\"https://github.com/ptprashanttripathi\">Pt. Prashant Tripathi</a></p>\n<p>⭐ Star this repo if you find it helpful!</p>\n</div>\n","readmeFilename":"README.md"}