solve-engine 2.27.0 → 2.28.0
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/dist/{EngineError-C-kBwYlN.d.cts → EngineError-CA2tiVaI.d.cts} +2 -0
- package/dist/{EngineError-C-kBwYlN.d.ts → EngineError-CA2tiVaI.d.ts} +2 -0
- package/dist/{Lexer-DqtnZMC5.d.ts → Lexer-B62Hn9I-.d.ts} +1 -1
- package/dist/{Lexer-DhGhoAa2.d.cts → Lexer-DOXatsjO.d.cts} +1 -1
- package/dist/{PackageCompatibility-fj_f7uqC.d.ts → PackageCompatibility-DT1IPlQx.d.ts} +1 -1
- package/dist/{PackageCompatibility-CNiTtC6S.d.cts → PackageCompatibility-DW18LqED.d.cts} +1 -1
- package/dist/{PackageRegistry-BHBCFswo.d.cts → PackageRegistry-CevYUzRn.d.cts} +3 -3
- package/dist/{PackageRegistry-CNZUwWHJ.d.ts → PackageRegistry-Dl9kNP14.d.ts} +3 -3
- package/dist/{VMBuiltins-kv4rr0y5.d.cts → VMBuiltins-AIivGl0a.d.cts} +1 -1
- package/dist/{VMBuiltins-CZiZRKn-.d.ts → VMBuiltins-CbuFfIgQ.d.ts} +1 -1
- package/dist/{VMCheckpoints-yun4ocSv.d.cts → VMCheckpoints-BVrJwfZY.d.cts} +1 -1
- package/dist/{VMCheckpoints-DXze6ypg.d.ts → VMCheckpoints-DFCl63K5.d.ts} +1 -1
- package/dist/{WorkerError-CfBJYueR.d.ts → WorkerError-BuO9MrRr.d.ts} +1 -1
- package/dist/{WorkerError-BLZyNq6M.d.cts → WorkerError-DDtwl4oH.d.cts} +1 -1
- package/dist/{chunk-GVL3ZMS7.cjs → chunk-2G3AW6OQ.cjs} +2 -2
- package/dist/{chunk-GVL3ZMS7.cjs.map → chunk-2G3AW6OQ.cjs.map} +1 -1
- package/dist/{chunk-BCR53EIL.js → chunk-2RLNVS6G.js} +2 -2
- package/dist/{chunk-BCR53EIL.js.map → chunk-2RLNVS6G.js.map} +1 -1
- package/dist/{chunk-TMQ37JQY.cjs → chunk-2YNRIT2L.cjs} +3 -3
- package/dist/{chunk-TMQ37JQY.cjs.map → chunk-2YNRIT2L.cjs.map} +1 -1
- package/dist/chunk-3LWK33TJ.js +3 -0
- package/dist/chunk-3LWK33TJ.js.map +1 -0
- package/dist/{chunk-TPPM4QSS.cjs → chunk-5J2XDCSV.cjs} +2 -2
- package/dist/{chunk-TPPM4QSS.cjs.map → chunk-5J2XDCSV.cjs.map} +1 -1
- package/dist/chunk-5NQE5JMU.cjs +2 -0
- package/dist/{chunk-QQHHZPEW.cjs.map → chunk-5NQE5JMU.cjs.map} +1 -1
- package/dist/{chunk-LTUYWJGO.js → chunk-6T5HPIZX.js} +2 -2
- package/dist/{chunk-LTUYWJGO.js.map → chunk-6T5HPIZX.js.map} +1 -1
- package/dist/{chunk-S3ODNMJS.js → chunk-7ASISMXA.js} +2 -2
- package/dist/{chunk-S3ODNMJS.js.map → chunk-7ASISMXA.js.map} +1 -1
- package/dist/{chunk-YG7UWQFV.js → chunk-7ZYYWSLT.js} +2 -2
- package/dist/{chunk-YG7UWQFV.js.map → chunk-7ZYYWSLT.js.map} +1 -1
- package/dist/{chunk-BLJ6E577.js → chunk-A7RRWNLE.js} +2 -2
- package/dist/{chunk-BLJ6E577.js.map → chunk-A7RRWNLE.js.map} +1 -1
- package/dist/{chunk-BCY2WY5P.js → chunk-APU5LON7.js} +3 -3
- package/dist/{chunk-BCY2WY5P.js.map → chunk-APU5LON7.js.map} +1 -1
- package/dist/{chunk-ESZNJQ2C.js → chunk-DDVDRWCK.js} +3 -3
- package/dist/{chunk-ESZNJQ2C.js.map → chunk-DDVDRWCK.js.map} +1 -1
- package/dist/{chunk-ZPHUTCJ5.cjs → chunk-FSNBYRNA.cjs} +3 -3
- package/dist/{chunk-ZPHUTCJ5.cjs.map → chunk-FSNBYRNA.cjs.map} +1 -1
- package/dist/{chunk-2SYYKQ4Q.cjs → chunk-GWEINEJG.cjs} +2 -2
- package/dist/{chunk-2SYYKQ4Q.cjs.map → chunk-GWEINEJG.cjs.map} +1 -1
- package/dist/{chunk-GXO7TSXQ.cjs → chunk-HTAT4MGN.cjs} +3 -3
- package/dist/chunk-HTAT4MGN.cjs.map +1 -0
- package/dist/{chunk-D4VBWPWN.js → chunk-I6WGOM3C.js} +2 -2
- package/dist/{chunk-D4VBWPWN.js.map → chunk-I6WGOM3C.js.map} +1 -1
- package/dist/{chunk-CL7DM2FX.js → chunk-IAL64FCP.js} +2 -2
- package/dist/{chunk-CL7DM2FX.js.map → chunk-IAL64FCP.js.map} +1 -1
- package/dist/{chunk-TC23XEAV.js → chunk-IEBWLNI5.js} +2 -2
- package/dist/{chunk-TC23XEAV.js.map → chunk-IEBWLNI5.js.map} +1 -1
- package/dist/{chunk-YSHWNCDH.cjs → chunk-IIBR4LVH.cjs} +4 -4
- package/dist/{chunk-YSHWNCDH.cjs.map → chunk-IIBR4LVH.cjs.map} +1 -1
- package/dist/{chunk-UVHD7BBC.js → chunk-JHHSQ2YR.js} +3 -3
- package/dist/{chunk-UVHD7BBC.js.map → chunk-JHHSQ2YR.js.map} +1 -1
- package/dist/{chunk-G2V33LFM.cjs → chunk-KYE5BWPN.cjs} +2 -2
- package/dist/{chunk-G2V33LFM.cjs.map → chunk-KYE5BWPN.cjs.map} +1 -1
- package/dist/{chunk-LQIRBP4Q.js → chunk-LV7PJ2MU.js} +2 -2
- package/dist/{chunk-LQIRBP4Q.js.map → chunk-LV7PJ2MU.js.map} +1 -1
- package/dist/{chunk-SE6ZCGZ5.cjs → chunk-MKBB7IVN.cjs} +2 -2
- package/dist/{chunk-SE6ZCGZ5.cjs.map → chunk-MKBB7IVN.cjs.map} +1 -1
- package/dist/{chunk-LE6WZLJ4.js → chunk-MONPHAHO.js} +2 -2
- package/dist/{chunk-LE6WZLJ4.js.map → chunk-MONPHAHO.js.map} +1 -1
- package/dist/{chunk-ZC2NPRLO.js → chunk-N22D5ZD4.js} +3 -3
- package/dist/{chunk-ZC2NPRLO.js.map → chunk-N22D5ZD4.js.map} +1 -1
- package/dist/{chunk-GJZIJK2Q.cjs → chunk-O5ZLOZPH.cjs} +2 -2
- package/dist/{chunk-GJZIJK2Q.cjs.map → chunk-O5ZLOZPH.cjs.map} +1 -1
- package/dist/{chunk-Y7XRA2EV.js → chunk-OKSAUK5C.js} +2 -2
- package/dist/{chunk-Y7XRA2EV.js.map → chunk-OKSAUK5C.js.map} +1 -1
- package/dist/{chunk-RRUGQ6DM.js → chunk-OLATJABN.js} +2 -2
- package/dist/{chunk-RRUGQ6DM.js.map → chunk-OLATJABN.js.map} +1 -1
- package/dist/{chunk-REZQFPVX.js → chunk-POIHAKBX.js} +2 -2
- package/dist/{chunk-REZQFPVX.js.map → chunk-POIHAKBX.js.map} +1 -1
- package/dist/{chunk-AZX4NTYN.cjs → chunk-QXGKONTZ.cjs} +3 -3
- package/dist/{chunk-AZX4NTYN.cjs.map → chunk-QXGKONTZ.cjs.map} +1 -1
- package/dist/{chunk-VQO54ZMA.js → chunk-RRJ77SF6.js} +2 -2
- package/dist/{chunk-VQO54ZMA.js.map → chunk-RRJ77SF6.js.map} +1 -1
- package/dist/{chunk-O5PO4D2A.cjs → chunk-RVNW627Y.cjs} +2 -2
- package/dist/{chunk-O5PO4D2A.cjs.map → chunk-RVNW627Y.cjs.map} +1 -1
- package/dist/{chunk-CQLCTKMX.cjs → chunk-TTHCH7V2.cjs} +2 -2
- package/dist/{chunk-CQLCTKMX.cjs.map → chunk-TTHCH7V2.cjs.map} +1 -1
- package/dist/{chunk-6EYKVQT3.cjs → chunk-U7CNADCJ.cjs} +2 -2
- package/dist/{chunk-6EYKVQT3.cjs.map → chunk-U7CNADCJ.cjs.map} +1 -1
- package/dist/{chunk-FDKTESBC.cjs → chunk-UBKWHRFL.cjs} +2 -2
- package/dist/{chunk-FDKTESBC.cjs.map → chunk-UBKWHRFL.cjs.map} +1 -1
- package/dist/{chunk-ZSLVLMO5.cjs → chunk-UMW5PO42.cjs} +2 -2
- package/dist/{chunk-ZSLVLMO5.cjs.map → chunk-UMW5PO42.cjs.map} +1 -1
- package/dist/{chunk-7RC6RBS6.cjs → chunk-W5BBKLNS.cjs} +2 -2
- package/dist/{chunk-7RC6RBS6.cjs.map → chunk-W5BBKLNS.cjs.map} +1 -1
- package/dist/{chunk-ZDJTDFTR.cjs → chunk-WXOJ3DS3.cjs} +2 -2
- package/dist/{chunk-ZDJTDFTR.cjs.map → chunk-WXOJ3DS3.cjs.map} +1 -1
- package/dist/chunk-YIXCPLCN.cjs +3 -0
- package/dist/chunk-YIXCPLCN.cjs.map +1 -0
- package/dist/{chunk-ZE5KKMBV.cjs → chunk-YLTNXYA7.cjs} +2 -2
- package/dist/{chunk-ZE5KKMBV.cjs.map → chunk-YLTNXYA7.cjs.map} +1 -1
- package/dist/{chunk-VB6QMU2W.js → chunk-Z5DA5UXY.js} +3 -3
- package/dist/chunk-Z5DA5UXY.js.map +1 -0
- package/dist/{chunk-HANGBVEE.js → chunk-Z5VBXZ4A.js} +2 -2
- package/dist/{chunk-HANGBVEE.js.map → chunk-Z5VBXZ4A.js.map} +1 -1
- package/dist/constants.cjs +1 -1
- package/dist/constants.js +1 -1
- package/dist/engine.cjs +1 -1
- package/dist/engine.d.cts +6 -6
- package/dist/engine.d.ts +6 -6
- package/dist/engine.js +1 -1
- package/dist/errors.cjs +1 -1
- package/dist/errors.d.cts +3 -3
- package/dist/errors.d.ts +3 -3
- package/dist/errors.js +1 -1
- package/dist/format.cjs +1 -1
- package/dist/format.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +6 -6
- package/dist/index.d.ts +6 -6
- package/dist/index.js +1 -1
- package/dist/language.d.cts +5 -5
- package/dist/language.d.ts +5 -5
- package/dist/lexer.cjs +1 -1
- package/dist/lexer.d.cts +3 -3
- package/dist/lexer.d.ts +3 -3
- package/dist/lexer.js +1 -1
- package/dist/normalizer.cjs +1 -1
- package/dist/normalizer.js +1 -1
- package/dist/packages.cjs +1 -1
- package/dist/packages.d.cts +4 -4
- package/dist/packages.d.ts +4 -4
- package/dist/packages.js +1 -1
- package/dist/parser.cjs +1 -1
- package/dist/parser.js +1 -1
- package/dist/temporal.cjs +1 -1
- package/dist/temporal.js +1 -1
- package/dist/testing.cjs +2 -2
- package/dist/testing.d.cts +5 -5
- package/dist/testing.d.ts +5 -5
- package/dist/testing.js +1 -1
- package/dist/uom.cjs +1 -1
- package/dist/uom.js +1 -1
- package/dist/vm.cjs +1 -1
- package/dist/vm.d.cts +3 -3
- package/dist/vm.d.ts +3 -3
- package/dist/vm.js +1 -1
- package/dist/worker.cjs +2 -2
- package/dist/worker.d.cts +5 -5
- package/dist/worker.d.ts +5 -5
- package/dist/worker.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-DFMAZ6XM.cjs +0 -3
- package/dist/chunk-DFMAZ6XM.cjs.map +0 -1
- package/dist/chunk-GXO7TSXQ.cjs.map +0 -1
- package/dist/chunk-PQFI55AC.js +0 -3
- package/dist/chunk-PQFI55AC.js.map +0 -1
- package/dist/chunk-QQHHZPEW.cjs +0 -2
- package/dist/chunk-VB6QMU2W.js.map +0 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
'use strict';var chunkE4HAKNBQ_cjs=require('./chunk-E4HAKNBQ.cjs'),
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
'use strict';var chunkE4HAKNBQ_cjs=require('./chunk-E4HAKNBQ.cjs'),chunkHTAT4MGN_cjs=require('./chunk-HTAT4MGN.cjs');var s=class{now(){return Date.now()}fields(t){let e=new Date(t);return {year:e.getFullYear(),month0:e.getMonth(),day:e.getDate(),weekday:e.getDay(),hour:e.getHours(),minute:e.getMinutes(),second:e.getSeconds(),millisecond:e.getMilliseconds()}}localMidnight(t,e,n){return new Date(t,e,n).getTime()}localWallClock(t,e,n,r){let a=new Date(t,e,n,0,0,0,0);return a.setMinutes(r),a.getTime()}addDays(t,e){let n=new Date(t);return n.setDate(n.getDate()+e),n.getTime()}addMonths(t,e){let n=new Date(t),r=n.getDate();return n.setDate(1),n.setMonth(n.getMonth()+e),n.setDate(Math.min(r,chunkE4HAKNBQ_cjs.b(n.getFullYear(),n.getMonth()))),n.getTime()}utcOffsetMinutes(t){return 0-new Date(t).getTimezoneOffset()}parseIso8601(t){return new Date(t).getTime()}formatLongDate(t,e){return new Date(t).toLocaleDateString(e,{weekday:"long",year:"numeric",month:"long",day:"numeric"})}formatTimeOfDay(t,e){return new Date(t).toLocaleTimeString(e)}zoneOffsetMinutes(t,e){let n=chunkE4HAKNBQ_cjs.l(t,e);return Math.round((chunkE4HAKNBQ_cjs.a(n.year,n.month0,n.day,n.hour,n.minute,n.second)-e)/6e4)||0}fieldsInZone(t,e){return chunkE4HAKNBQ_cjs.l(t,e)}formatTimeInZone(t,e){return chunkE4HAKNBQ_cjs.m(t,e)}formatDateInZone(t,e){return chunkE4HAKNBQ_cjs.n(t,e)}},k=new s;function L(o){return o?.calendar??k}var O=/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})(?::(\d{2})(?:\.(\d+))?)?$/,l=class extends s{constructor(e){super();this.namedZone=e;}zone(){return this.namedZone}fields(e){let n=chunkE4HAKNBQ_cjs.l(this.namedZone,e),r=((chunkE4HAKNBQ_cjs.c(n.year,n.month0,n.day)+4)%7+7)%7;return {year:n.year,month0:n.month0,day:n.day,weekday:r,hour:n.hour,minute:n.minute,second:n.second,millisecond:(e%1e3+1e3)%1e3}}localMidnight(e,n,r){return chunkE4HAKNBQ_cjs.j(e,n,r,0,0,this.namedZone,this)}localWallClock(e,n,r,a){return chunkE4HAKNBQ_cjs.j(e,n,r,0,a,this.namedZone,this)}addDays(e,n){let r=chunkE4HAKNBQ_cjs.l(this.namedZone,e);return this.reanchor(r,r.day+n,e)}addMonths(e,n){let r=chunkE4HAKNBQ_cjs.l(this.namedZone,e),a=new Date(Date.UTC(r.year,r.month0+n,1)),i=Math.min(r.day,chunkE4HAKNBQ_cjs.b(a.getUTCFullYear(),a.getUTCMonth()));return chunkE4HAKNBQ_cjs.j(a.getUTCFullYear(),a.getUTCMonth(),i,r.hour,r.minute,this.namedZone,this)+r.second*1e3+(e%1e3+1e3)%1e3}utcOffsetMinutes(e){return this.zoneOffsetMinutes(this.namedZone,e)}parseIso8601(e){let n=O.exec(e.trim());if(n===null)return super.parseIso8601(e);let[,r,a,i,w,p,c,b]=n,I=b===void 0?0:Number(b.slice(0,3).padEnd(3,"0"));return chunkE4HAKNBQ_cjs.j(Number(r),Number(a)-1,Number(i),Number(w),Number(p),this.namedZone,this)+(c===void 0?0:Number(c))*1e3+I}formatLongDate(e,n){return chunkE4HAKNBQ_cjs.o(this.namedZone,e,n)}formatTimeOfDay(e,n){return chunkE4HAKNBQ_cjs.p(this.namedZone,e,n)}reanchor(e,n,r){return chunkE4HAKNBQ_cjs.j(e.year,e.month0,n,e.hour,e.minute,this.namedZone,this)+e.second*1e3+(r%1e3+1e3)%1e3}};function U(o){if(!chunkE4HAKNBQ_cjs.k(o))throw chunkHTAT4MGN_cjs.c.config(chunkHTAT4MGN_cjs.s.DATE_ZONE_UNKNOWN,`dateCalendarInZone("${o}") is not a time zone this runtime knows.`);return new l(o)}exports.a=s;exports.b=k;exports.c=L;exports.d=U;//# sourceMappingURL=chunk-5J2XDCSV.cjs.map
|
|
2
|
+
//# sourceMappingURL=chunk-5J2XDCSV.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/calendar/DateCalendar.ts"],"names":["DateCalendar","epochMs","d","year","month0","day","minutesPastMidnight","anchored","days","date","months","dayOfMonth","daysInMonth","text","locale","zone","f","zonedFields","utcMs","timeInZone","dateInZone","DATE_CALENDAR","calendarOf","context","ISO_LOCAL_DATE_TIME","ZonedDateCalendar","namedZone","weekday","dayNumber","zonedWallClockToUtcMs","target","clampedDay","matched","month","hour","minute","second","fraction","millisecond","longDateInZone","timeOfDayInZone","dateCalendarInZone","isSupportedZone","ErrorFactory","DatetimeErrorCod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W,CAAAA,CAAE,KAAMA,CAAAA,CAAE,MAAA,CAAQ,IAAA,CAAK,SAAA,CAAW,IAAI,CAAA,CACvFA,CAAAA,CAAE,MAAA,CAAS,GAAA,CAAA,CAAUf,EAAU,GAAA,CAAQ,GAAA,EAAQ,GACnD,CACD,CAAA,CA6BO,SAASwC,CAAAA,CAAmB1B,CAAAA,CAA+B,CACjE,GAAI,CAAC2B,mBAAAA,CAAgB3B,CAAI,CAAA,CACxB,MAAM4B,oBAAa,MAAA,CAClBC,mBAAAA,CAAmB,iBAAA,CACnB,CAAA,oBAAA,EAAuB7B,CAAI,CAAA,yCAAA,CAC5B,CAAA,CAED,OAAO,IAAIU,CAAAA,CAAkBV,CAAI,CAClC","file":"chunk-TPPM4QSS.cjs","sourcesContent":["import { ErrorFactory } from \"@solve-js/errors/UnifiedErrorFramework\";\nimport { DatetimeErrorCodes } from \"@solve-js/errors/ErrorCode\";\nimport type { CalendarBackend, CalendarFields, ZonedFields } from \"./CalendarBackend\";\nimport { dayNumber, daysInMonth, utcMs } from \"./Gregorian\";\nimport { dateInZone, isSupportedZone, longDateInZone, timeInZone, timeOfDayInZone, zonedFields, zonedWallClockToUtcMs } from \"./IntlZone\";\n\n/**\n * The default {@link CalendarBackend}: the JavaScript `Date` object, read in\n * the host process's time zone, with `Intl.DateTimeFormat` for named zones.\n *\n * This is the calendar code the engine has always run, moved behind the\n * interface method by method rather than rewritten, so a host that configures\n * nothing sees the same instants and the same strings it did before the\n * backend existed. Where `Date` has a quirk (a two-digit year in a\n * constructor maps to the 1900s, an out-of-range instant answers `NaN`), the\n * quirk is kept here deliberately: the point of this backend is to be the\n * behaviour the `Temporal` backend is measured against, not to improve on it.\n *\n * It stays the default because it is the one calendar every supported runtime\n * has. `Temporal` ships unflagged in Node 26 and in current Chrome, Firefox\n * and Deno, but not in Safari or in the Node 22 and 24 the engine supports,\n * and the smallest polyfill adds about twenty kilobytes gzipped to a bundle\n * that a host doing plain arithmetic never needs. A host that wants\n * `Temporal` opts in through the engine's `calendar` option with the backend\n * from `solve-engine/temporal`, and pays for it only then.\n */\nexport class DateCalendar implements CalendarBackend {\n\tnow(): number {\n\t\treturn Date.now();\n\t}\n\n\tfields(epochMs: number): CalendarFields {\n\t\tconst d = new Date(epochMs);\n\t\treturn {\n\t\t\tyear: d.getFullYear(),\n\t\t\tmonth0: d.getMonth(),\n\t\t\tday: d.getDate(),\n\t\t\tweekday: d.getDay(),\n\t\t\thour: d.getHours(),\n\t\t\tminute: d.getMinutes(),\n\t\t\tsecond: d.getSeconds(),\n\t\t\tmillisecond: d.getMilliseconds(),\n\t\t};\n\t}\n\n\tlocalMidnight(year: number, month0: number, day: number): number {\n\t\treturn new Date(year, month0, day).getTime();\n\t}\n\n\tlocalWallClock(year: number, month0: number, day: number, minutesPastMidnight: number): number {\n\t\t// Anchored at midnight and then moved by the minutes FIELD, so the\n\t\t// result is the wall-clock reading asked for whatever the day's length.\n\t\tconst anchored = new Date(year, month0, day, 0, 0, 0, 0);\n\t\tanchored.setMinutes(minutesPastMidnight);\n\t\treturn anchored.getTime();\n\t}\n\n\taddDays(epochMs: number, days: number): number {\n\t\tconst date = new Date(epochMs);\n\t\tdate.setDate(date.getDate() + days);\n\t\treturn date.getTime();\n\t}\n\n\taddMonths(epochMs: number, months: number): number {\n\t\tconst date = new Date(epochMs);\n\t\tconst dayOfMonth = date.getDate();\n\t\t// Parked on the 1st before the month field moves: `setMonth()` keeps\n\t\t// the day number, so a 31st aimed at a 30-day month would overflow\n\t\t// into the month after it. Clamping afterwards is what keeps the month\n\t\t// the caller asked for.\n\t\tdate.setDate(1);\n\t\tdate.setMonth(date.getMonth() + months);\n\t\tdate.setDate(Math.min(dayOfMonth, daysInMonth(date.getFullYear(), date.getMonth())));\n\t\treturn date.getTime();\n\t}\n\n\tutcOffsetMinutes(epochMs: number): number {\n\t\t// `getTimezoneOffset()` is (UTC minus local), so its sign is inverted\n\t\t// relative to the \"+HH:MM ahead of UTC\" reading every caller wants.\n\t\t// Subtracted from zero rather than negated, so a zero offset is 0 and\n\t\t// not -0, which a second backend could not be expected to reproduce.\n\t\treturn 0 - new Date(epochMs).getTimezoneOffset();\n\t}\n\n\tparseIso8601(text: string): number {\n\t\treturn new Date(text).getTime();\n\t}\n\n\tformatLongDate(epochMs: number, locale: string): string {\n\t\treturn new Date(epochMs).toLocaleDateString(locale, { weekday: \"long\", year: \"numeric\", month: \"long\", day: \"numeric\" });\n\t}\n\n\tformatTimeOfDay(epochMs: number, locale: string): string {\n\t\treturn new Date(epochMs).toLocaleTimeString(locale);\n\t}\n\n\tzoneOffsetMinutes(zone: string, epochMs: number): number {\n\t\t// The `Intl` round trip: read the instant as the zone's wall-clock\n\t\t// fields, re-read those fields as if they were UTC, and the difference\n\t\t// from the instant is the zone's offset then, daylight saving included.\n\t\tconst f = zonedFields(zone, epochMs);\n\t\t// `|| 0` folds the -0 a negative sub-minute difference rounds to.\n\t\treturn Math.round((utcMs(f.year, f.month0, f.day, f.hour, f.minute, f.second) - epochMs) / 60000) || 0;\n\t}\n\n\tfieldsInZone(zone: string, epochMs: number): ZonedFields {\n\t\treturn zonedFields(zone, epochMs);\n\t}\n\n\tformatTimeInZone(zone: string, epochMs: number): string {\n\t\treturn timeInZone(zone, epochMs);\n\t}\n\n\tformatDateInZone(zone: string, epochMs: number): string {\n\t\treturn dateInZone(zone, epochMs);\n\t}\n}\n\n/**\n * The one `Date` backend, shared by every engine that configures no other.\n *\n * Stateless, so sharing is safe: it holds no zone of its own and reads the\n * process's. It is also what the sites with no engine in hand use (the\n * normaliser rules that fuse a literal, `days in <period>`, the stocks and\n * historical-currency date phrases, and `formatValue`), which is why an\n * engine's own backend is the default here rather than a second copy.\n */\nexport const DATE_CALENDAR: CalendarBackend = new DateCalendar();\n\n/**\n * The backend a plugin function or converter should compute with: the one\n * on its execution context, or the `Date` backend when the handler was\n * called with no context (a direct call from a test, or an `as` converter\n * invoked outside the VM).\n *\n * @param context - The execution context the handler received, if any.\n * @returns The engine's backend when the context carries one, else {@link DATE_CALENDAR}.\n */\nexport function calendarOf(context?: { readonly calendar?: CalendarBackend }): CalendarBackend {\n\treturn context?.calendar ?? DATE_CALENDAR;\n}\n\n/**\n * The `Date` backend, computing in a named IANA zone instead of the host\n * process's.\n *\n * Every zone-free answer is inherited unchanged from {@link DateCalendar}:\n * `now()` is still the clock, `parseIso8601` still reads the two ECMAScript\n * spellings, and the four named-zone methods already took the zone as an\n * argument. What changes is what \"local\" means, which is exactly the set of\n * questions {@link CalendarBackend} says depends on a zone: which day an\n * instant falls on, what a wall-clock reading names, what a day or a month\n * later is, and what the offset from UTC is.\n *\n * Those are answered through `Intl`, the same data the base class already\n * reads named zones with, so the accuracy is the same and nothing new is\n * bundled. The one place it is a simplification is a wall clock that a\n * daylight-saving transition made ambiguous or non-existent (01:30 on a\n * spring-forward morning): {@link zonedWallClockToUtcMs} resolves it one way,\n * and a `Temporal` backend's `disambiguation: 'compatible'` may resolve it an\n * hour differently.\n */\n/**\n * An ISO 8601 date-time with a time of day and NO offset and no `Z`: the one\n * spelling whose instant depends on which zone reads it. Anchored at both\n * ends, so a date-only string and anything carrying an offset fall through to\n * the base class untouched.\n */\nconst ISO_LOCAL_DATE_TIME = /^(\\d{4})-(\\d{2})-(\\d{2})T(\\d{2}):(\\d{2})(?::(\\d{2})(?:\\.(\\d+))?)?$/;\n\nclass ZonedDateCalendar extends DateCalendar {\n\t/**\n\t * @param namedZone - An IANA zone name `Intl` accepts.\n\t */\n\tconstructor(private readonly namedZone: string) {\n\t\tsuper();\n\t}\n\n\tzone(): string {\n\t\treturn this.namedZone;\n\t}\n\n\tfields(epochMs: number): CalendarFields {\n\t\tconst f = zonedFields(this.namedZone, epochMs);\n\t\t// `zonedFields` answers no weekday and no millisecond: the weekday is a\n\t\t// pure function of the zoned date (`Gregorian.dayNumber`, counting from a\n\t\t// Thursday), and the millisecond is the instant's own, which no zone\n\t\t// offset in use is fractional enough to move.\n\t\tconst weekday = (((dayNumber(f.year, f.month0, f.day) + 4) % 7) + 7) % 7;\n\t\treturn {\n\t\t\tyear: f.year, month0: f.month0, day: f.day, weekday,\n\t\t\thour: f.hour, minute: f.minute, second: f.second,\n\t\t\tmillisecond: ((epochMs % 1000) + 1000) % 1000,\n\t\t};\n\t}\n\n\tlocalMidnight(year: number, month0: number, day: number): number {\n\t\treturn zonedWallClockToUtcMs(year, month0, day, 0, 0, this.namedZone, this);\n\t}\n\n\tlocalWallClock(year: number, month0: number, day: number, minutesPastMidnight: number): number {\n\t\t// The minutes go in as the MINUTE field, not as elapsed time, so a\n\t\t// reading of 540 is 09:00 on that date even on a 23-hour day. `Date.UTC`\n\t\t// rolls a minute field past 59 into the hour, which is what makes one\n\t\t// argument enough.\n\t\treturn zonedWallClockToUtcMs(year, month0, day, 0, minutesPastMidnight, this.namedZone, this);\n\t}\n\n\taddDays(epochMs: number, days: number): number {\n\t\tconst f = zonedFields(this.namedZone, epochMs);\n\t\treturn this.reanchor(f, f.day + days, epochMs);\n\t}\n\n\taddMonths(epochMs: number, months: number): number {\n\t\tconst f = zonedFields(this.namedZone, epochMs);\n\t\tconst target = new Date(Date.UTC(f.year, f.month0 + months, 1));\n\t\tconst clampedDay = Math.min(f.day, daysInMonth(target.getUTCFullYear(), target.getUTCMonth()));\n\t\treturn zonedWallClockToUtcMs(\n\t\t\ttarget.getUTCFullYear(), target.getUTCMonth(), clampedDay,\n\t\t\tf.hour, f.minute, this.namedZone, this,\n\t\t) + f.second * 1000 + (((epochMs % 1000) + 1000) % 1000);\n\t}\n\n\tutcOffsetMinutes(epochMs: number): number {\n\t\treturn this.zoneOffsetMinutes(this.namedZone, epochMs);\n\t}\n\n\tparseIso8601(text: string): number {\n\t\t// The one reading in that contract that depends on a zone: a date-time\n\t\t// with no offset and no `Z` is LOCAL time, and local here is the named\n\t\t// zone. Without this the backend contradicted itself, computing\n\t\t// `2026-04-03` at New York midnight while reading `2026-04-03T09:30` as\n\t\t// half past nine in the host process's zone. It is also what the\n\t\t// `Temporal` backend already does (`TemporalCalendar.parseIso8601`\n\t\t// resolves a bare wall clock in its own zone), so the two agree.\n\t\t//\n\t\t// Everything else is the base class byte for byte: a date-only string is\n\t\t// still UTC midnight and an explicit offset is still subtracted, both\n\t\t// frozen by the interface's contract.\n\t\tconst matched = ISO_LOCAL_DATE_TIME.exec(text.trim());\n\t\tif (matched === null) return super.parseIso8601(text);\n\t\tconst [, year, month, day, hour, minute, second, fraction] = matched;\n\t\tconst millisecond = fraction === undefined ? 0 : Number(fraction.slice(0, 3).padEnd(3, \"0\"));\n\t\treturn zonedWallClockToUtcMs(Number(year), Number(month) - 1, Number(day), Number(hour), Number(minute), this.namedZone, this)\n\t\t\t+ (second === undefined ? 0 : Number(second)) * 1000 + millisecond;\n\t}\n\n\tformatLongDate(epochMs: number, locale: string): string {\n\t\treturn longDateInZone(this.namedZone, epochMs, locale);\n\t}\n\n\tformatTimeOfDay(epochMs: number, locale: string): string {\n\t\treturn timeOfDayInZone(this.namedZone, epochMs, locale);\n\t}\n\n\t/** Rebuild an instant on a (possibly overflowed) day, holding its wall clock down to the millisecond. */\n\tprivate reanchor(f: ZonedFields, day: number, epochMs: number): number {\n\t\treturn zonedWallClockToUtcMs(f.year, f.month0, day, f.hour, f.minute, this.namedZone, this)\n\t\t\t+ f.second * 1000 + (((epochMs % 1000) + 1000) % 1000);\n\t}\n}\n\n/**\n * A `Date` backend that computes in a named time zone rather than the host\n * process's.\n *\n * This is how a host pins the zone the engine reads dates in, and it is the\n * only knob for it: the zone belongs to the calendar backend, which already\n * owns what \"local\" means, so there is deliberately no `date.zone` config\n * field to drift against it.\n *\n * ```ts\n * import { createEngine, dateCalendarInZone } from \"solve-engine\";\n * const engine = createEngine({ calendar: dateCalendarInZone(\"Asia/Tokyo\") });\n * ```\n *\n * It ships on the `Date` backend on purpose. `Temporal` is undefined on Node\n * 24 and in Safari, so \"pass a `Temporal` backend\" would put the zone out of\n * reach for most hosts today; `Temporal` stays an accuracy upgrade for the\n * ambiguous wall clocks around a daylight-saving transition, never a\n * prerequisite for naming a zone at all.\n *\n * @param zone - An IANA zone name, e.g. `\"Asia/Tokyo\"`.\n * @returns A backend whose local zone is that one.\n * @throws A `DATE_ZONE_UNKNOWN` config error when this runtime's `Intl` does\n * not know the zone. Refused here rather than per line, because a backend\n * that cannot compute in the zone it was asked for must not quietly answer\n * in another one.\n */\nexport function dateCalendarInZone(zone: string): CalendarBackend {\n\tif (!isSupportedZone(zone)) {\n\t\tthrow ErrorFactory.config(\n\t\t\tDatetimeErrorCodes.DATE_ZONE_UNKNOWN,\n\t\t\t`dateCalendarInZone(\"${zone}\") is not a time zone this runtime knows.`,\n\t\t);\n\t}\n\treturn new ZonedDateCalendar(zone);\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/calendar/DateCalendar.ts"],"names":["DateCalendar","epochMs","d","year","month0","day","minutesPastMidnight","anchored","days","date","months","dayOfMonth","daysInMonth","text","locale","zone","f","zonedFields","utcMs","timeInZone","dateInZone","DATE_CALENDAR","calendarOf","context","ISO_LOCAL_DATE_TIME","ZonedDateCalendar","namedZone","weekday","dayNumber","zonedWallClockToUtcMs","target","clampedDay","matched","month","hour","minute","second","fraction","millisecond","longDateInZone","timeOfDayInZone","dateCalendarInZone","isSupportedZone","ErrorFactory","DatetimeErrorCodes"],"mappings":"qHA0BO,IAAMA,EAAN,KAA8C,CACpD,GAAA,EAAc,CACb,OAAO,IAAA,CAAK,GAAA,EACb,CAEA,OAAOC,CAAAA,CAAiC,CACvC,IAAMC,CAAAA,CAAI,IAAI,IAAA,CAAKD,CAAO,CAAA,CAC1B,OAAO,CACN,IAAA,CAAMC,CAAAA,CAAE,WAAA,EAAY,CACpB,OAAQA,CAAAA,CAAE,QAAA,EAAS,CACnB,GAAA,CAAKA,EAAE,OAAA,EAAQ,CACf,QAASA,CAAAA,CAAE,MAAA,GACX,IAAA,CAAMA,CAAAA,CAAE,QAAA,EAAS,CACjB,OAAQA,CAAAA,CAAE,UAAA,EAAW,CACrB,MAAA,CAAQA,E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AClC","file":"chunk-5J2XDCSV.cjs","sourcesContent":["import { ErrorFactory } from \"@solve-js/errors/UnifiedErrorFramework\";\nimport { DatetimeErrorCodes } from \"@solve-js/errors/ErrorCode\";\nimport type { CalendarBackend, CalendarFields, ZonedFields } from \"./CalendarBackend\";\nimport { dayNumber, daysInMonth, utcMs } from \"./Gregorian\";\nimport { dateInZone, isSupportedZone, longDateInZone, timeInZone, timeOfDayInZone, zonedFields, zonedWallClockToUtcMs } from \"./IntlZone\";\n\n/**\n * The default {@link CalendarBackend}: the JavaScript `Date` object, read in\n * the host process's time zone, with `Intl.DateTimeFormat` for named zones.\n *\n * This is the calendar code the engine has always run, moved behind the\n * interface method by method rather than rewritten, so a host that configures\n * nothing sees the same instants and the same strings it did before the\n * backend existed. Where `Date` has a quirk (a two-digit year in a\n * constructor maps to the 1900s, an out-of-range instant answers `NaN`), the\n * quirk is kept here deliberately: the point of this backend is to be the\n * behaviour the `Temporal` backend is measured against, not to improve on it.\n *\n * It stays the default because it is the one calendar every supported runtime\n * has. `Temporal` ships unflagged in Node 26 and in current Chrome, Firefox\n * and Deno, but not in Safari or in the Node 22 and 24 the engine supports,\n * and the smallest polyfill adds about twenty kilobytes gzipped to a bundle\n * that a host doing plain arithmetic never needs. A host that wants\n * `Temporal` opts in through the engine's `calendar` option with the backend\n * from `solve-engine/temporal`, and pays for it only then.\n */\nexport class DateCalendar implements CalendarBackend {\n\tnow(): number {\n\t\treturn Date.now();\n\t}\n\n\tfields(epochMs: number): CalendarFields {\n\t\tconst d = new Date(epochMs);\n\t\treturn {\n\t\t\tyear: d.getFullYear(),\n\t\t\tmonth0: d.getMonth(),\n\t\t\tday: d.getDate(),\n\t\t\tweekday: d.getDay(),\n\t\t\thour: d.getHours(),\n\t\t\tminute: d.getMinutes(),\n\t\t\tsecond: d.getSeconds(),\n\t\t\tmillisecond: d.getMilliseconds(),\n\t\t};\n\t}\n\n\tlocalMidnight(year: number, month0: number, day: number): number {\n\t\treturn new Date(year, month0, day).getTime();\n\t}\n\n\tlocalWallClock(year: number, month0: number, day: number, minutesPastMidnight: number): number {\n\t\t// Anchored at midnight and then moved by the minutes FIELD, so the\n\t\t// result is the wall-clock reading asked for whatever the day's length.\n\t\tconst anchored = new Date(year, month0, day, 0, 0, 0, 0);\n\t\tanchored.setMinutes(minutesPastMidnight);\n\t\treturn anchored.getTime();\n\t}\n\n\taddDays(epochMs: number, days: number): number {\n\t\tconst date = new Date(epochMs);\n\t\tdate.setDate(date.getDate() + days);\n\t\treturn date.getTime();\n\t}\n\n\taddMonths(epochMs: number, months: number): number {\n\t\tconst date = new Date(epochMs);\n\t\tconst dayOfMonth = date.getDate();\n\t\t// Parked on the 1st before the month field moves: `setMonth()` keeps\n\t\t// the day number, so a 31st aimed at a 30-day month would overflow\n\t\t// into the month after it. Clamping afterwards is what keeps the month\n\t\t// the caller asked for.\n\t\tdate.setDate(1);\n\t\tdate.setMonth(date.getMonth() + months);\n\t\tdate.setDate(Math.min(dayOfMonth, daysInMonth(date.getFullYear(), date.getMonth())));\n\t\treturn date.getTime();\n\t}\n\n\tutcOffsetMinutes(epochMs: number): number {\n\t\t// `getTimezoneOffset()` is (UTC minus local), so its sign is inverted\n\t\t// relative to the \"+HH:MM ahead of UTC\" reading every caller wants.\n\t\t// Subtracted from zero rather than negated, so a zero offset is 0 and\n\t\t// not -0, which a second backend could not be expected to reproduce.\n\t\treturn 0 - new Date(epochMs).getTimezoneOffset();\n\t}\n\n\tparseIso8601(text: string): number {\n\t\treturn new Date(text).getTime();\n\t}\n\n\tformatLongDate(epochMs: number, locale: string): string {\n\t\treturn new Date(epochMs).toLocaleDateString(locale, { weekday: \"long\", year: \"numeric\", month: \"long\", day: \"numeric\" });\n\t}\n\n\tformatTimeOfDay(epochMs: number, locale: string): string {\n\t\treturn new Date(epochMs).toLocaleTimeString(locale);\n\t}\n\n\tzoneOffsetMinutes(zone: string, epochMs: number): number {\n\t\t// The `Intl` round trip: read the instant as the zone's wall-clock\n\t\t// fields, re-read those fields as if they were UTC, and the difference\n\t\t// from the instant is the zone's offset then, daylight saving included.\n\t\tconst f = zonedFields(zone, epochMs);\n\t\t// `|| 0` folds the -0 a negative sub-minute difference rounds to.\n\t\treturn Math.round((utcMs(f.year, f.month0, f.day, f.hour, f.minute, f.second) - epochMs) / 60000) || 0;\n\t}\n\n\tfieldsInZone(zone: string, epochMs: number): ZonedFields {\n\t\treturn zonedFields(zone, epochMs);\n\t}\n\n\tformatTimeInZone(zone: string, epochMs: number): string {\n\t\treturn timeInZone(zone, epochMs);\n\t}\n\n\tformatDateInZone(zone: string, epochMs: number): string {\n\t\treturn dateInZone(zone, epochMs);\n\t}\n}\n\n/**\n * The one `Date` backend, shared by every engine that configures no other.\n *\n * Stateless, so sharing is safe: it holds no zone of its own and reads the\n * process's. It is also what the sites with no engine in hand use (the\n * normaliser rules that fuse a literal, `days in <period>`, the stocks and\n * historical-currency date phrases, and `formatValue`), which is why an\n * engine's own backend is the default here rather than a second copy.\n */\nexport const DATE_CALENDAR: CalendarBackend = new DateCalendar();\n\n/**\n * The backend a plugin function or converter should compute with: the one\n * on its execution context, or the `Date` backend when the handler was\n * called with no context (a direct call from a test, or an `as` converter\n * invoked outside the VM).\n *\n * @param context - The execution context the handler received, if any.\n * @returns The engine's backend when the context carries one, else {@link DATE_CALENDAR}.\n */\nexport function calendarOf(context?: { readonly calendar?: CalendarBackend }): CalendarBackend {\n\treturn context?.calendar ?? DATE_CALENDAR;\n}\n\n/**\n * The `Date` backend, computing in a named IANA zone instead of the host\n * process's.\n *\n * Every zone-free answer is inherited unchanged from {@link DateCalendar}:\n * `now()` is still the clock, `parseIso8601` still reads the two ECMAScript\n * spellings, and the four named-zone methods already took the zone as an\n * argument. What changes is what \"local\" means, which is exactly the set of\n * questions {@link CalendarBackend} says depends on a zone: which day an\n * instant falls on, what a wall-clock reading names, what a day or a month\n * later is, and what the offset from UTC is.\n *\n * Those are answered through `Intl`, the same data the base class already\n * reads named zones with, so the accuracy is the same and nothing new is\n * bundled. The one place it is a simplification is a wall clock that a\n * daylight-saving transition made ambiguous or non-existent (01:30 on a\n * spring-forward morning): {@link zonedWallClockToUtcMs} resolves it one way,\n * and a `Temporal` backend's `disambiguation: 'compatible'` may resolve it an\n * hour differently.\n */\n/**\n * An ISO 8601 date-time with a time of day and NO offset and no `Z`: the one\n * spelling whose instant depends on which zone reads it. Anchored at both\n * ends, so a date-only string and anything carrying an offset fall through to\n * the base class untouched.\n */\nconst ISO_LOCAL_DATE_TIME = /^(\\d{4})-(\\d{2})-(\\d{2})T(\\d{2}):(\\d{2})(?::(\\d{2})(?:\\.(\\d+))?)?$/;\n\nclass ZonedDateCalendar extends DateCalendar {\n\t/**\n\t * @param namedZone - An IANA zone name `Intl` accepts.\n\t */\n\tconstructor(private readonly namedZone: string) {\n\t\tsuper();\n\t}\n\n\tzone(): string {\n\t\treturn this.namedZone;\n\t}\n\n\tfields(epochMs: number): CalendarFields {\n\t\tconst f = zonedFields(this.namedZone, epochMs);\n\t\t// `zonedFields` answers no weekday and no millisecond: the weekday is a\n\t\t// pure function of the zoned date (`Gregorian.dayNumber`, counting from a\n\t\t// Thursday), and the millisecond is the instant's own, which no zone\n\t\t// offset in use is fractional enough to move.\n\t\tconst weekday = (((dayNumber(f.year, f.month0, f.day) + 4) % 7) + 7) % 7;\n\t\treturn {\n\t\t\tyear: f.year, month0: f.month0, day: f.day, weekday,\n\t\t\thour: f.hour, minute: f.minute, second: f.second,\n\t\t\tmillisecond: ((epochMs % 1000) + 1000) % 1000,\n\t\t};\n\t}\n\n\tlocalMidnight(year: number, month0: number, day: number): number {\n\t\treturn zonedWallClockToUtcMs(year, month0, day, 0, 0, this.namedZone, this);\n\t}\n\n\tlocalWallClock(year: number, month0: number, day: number, minutesPastMidnight: number): number {\n\t\t// The minutes go in as the MINUTE field, not as elapsed time, so a\n\t\t// reading of 540 is 09:00 on that date even on a 23-hour day. `Date.UTC`\n\t\t// rolls a minute field past 59 into the hour, which is what makes one\n\t\t// argument enough.\n\t\treturn zonedWallClockToUtcMs(year, month0, day, 0, minutesPastMidnight, this.namedZone, this);\n\t}\n\n\taddDays(epochMs: number, days: number): number {\n\t\tconst f = zonedFields(this.namedZone, epochMs);\n\t\treturn this.reanchor(f, f.day + days, epochMs);\n\t}\n\n\taddMonths(epochMs: number, months: number): number {\n\t\tconst f = zonedFields(this.namedZone, epochMs);\n\t\tconst target = new Date(Date.UTC(f.year, f.month0 + months, 1));\n\t\tconst clampedDay = Math.min(f.day, daysInMonth(target.getUTCFullYear(), target.getUTCMonth()));\n\t\treturn zonedWallClockToUtcMs(\n\t\t\ttarget.getUTCFullYear(), target.getUTCMonth(), clampedDay,\n\t\t\tf.hour, f.minute, this.namedZone, this,\n\t\t) + f.second * 1000 + (((epochMs % 1000) + 1000) % 1000);\n\t}\n\n\tutcOffsetMinutes(epochMs: number): number {\n\t\treturn this.zoneOffsetMinutes(this.namedZone, epochMs);\n\t}\n\n\tparseIso8601(text: string): number {\n\t\t// The one reading in that contract that depends on a zone: a date-time\n\t\t// with no offset and no `Z` is LOCAL time, and local here is the named\n\t\t// zone. Without this the backend contradicted itself, computing\n\t\t// `2026-04-03` at New York midnight while reading `2026-04-03T09:30` as\n\t\t// half past nine in the host process's zone. It is also what the\n\t\t// `Temporal` backend already does (`TemporalCalendar.parseIso8601`\n\t\t// resolves a bare wall clock in its own zone), so the two agree.\n\t\t//\n\t\t// Everything else is the base class byte for byte: a date-only string is\n\t\t// still UTC midnight and an explicit offset is still subtracted, both\n\t\t// frozen by the interface's contract.\n\t\tconst matched = ISO_LOCAL_DATE_TIME.exec(text.trim());\n\t\tif (matched === null) return super.parseIso8601(text);\n\t\tconst [, year, month, day, hour, minute, second, fraction] = matched;\n\t\tconst millisecond = fraction === undefined ? 0 : Number(fraction.slice(0, 3).padEnd(3, \"0\"));\n\t\treturn zonedWallClockToUtcMs(Number(year), Number(month) - 1, Number(day), Number(hour), Number(minute), this.namedZone, this)\n\t\t\t+ (second === undefined ? 0 : Number(second)) * 1000 + millisecond;\n\t}\n\n\tformatLongDate(epochMs: number, locale: string): string {\n\t\treturn longDateInZone(this.namedZone, epochMs, locale);\n\t}\n\n\tformatTimeOfDay(epochMs: number, locale: string): string {\n\t\treturn timeOfDayInZone(this.namedZone, epochMs, locale);\n\t}\n\n\t/** Rebuild an instant on a (possibly overflowed) day, holding its wall clock down to the millisecond. */\n\tprivate reanchor(f: ZonedFields, day: number, epochMs: number): number {\n\t\treturn zonedWallClockToUtcMs(f.year, f.month0, day, f.hour, f.minute, this.namedZone, this)\n\t\t\t+ f.second * 1000 + (((epochMs % 1000) + 1000) % 1000);\n\t}\n}\n\n/**\n * A `Date` backend that computes in a named time zone rather than the host\n * process's.\n *\n * This is how a host pins the zone the engine reads dates in, and it is the\n * only knob for it: the zone belongs to the calendar backend, which already\n * owns what \"local\" means, so there is deliberately no `date.zone` config\n * field to drift against it.\n *\n * ```ts\n * import { createEngine, dateCalendarInZone } from \"solve-engine\";\n * const engine = createEngine({ calendar: dateCalendarInZone(\"Asia/Tokyo\") });\n * ```\n *\n * It ships on the `Date` backend on purpose. `Temporal` is undefined on Node\n * 24 and in Safari, so \"pass a `Temporal` backend\" would put the zone out of\n * reach for most hosts today; `Temporal` stays an accuracy upgrade for the\n * ambiguous wall clocks around a daylight-saving transition, never a\n * prerequisite for naming a zone at all.\n *\n * @param zone - An IANA zone name, e.g. `\"Asia/Tokyo\"`.\n * @returns A backend whose local zone is that one.\n * @throws A `DATE_ZONE_UNKNOWN` config error when this runtime's `Intl` does\n * not know the zone. Refused here rather than per line, because a backend\n * that cannot compute in the zone it was asked for must not quietly answer\n * in another one.\n */\nexport function dateCalendarInZone(zone: string): CalendarBackend {\n\tif (!isSupportedZone(zone)) {\n\t\tthrow ErrorFactory.config(\n\t\t\tDatetimeErrorCodes.DATE_ZONE_UNKNOWN,\n\t\t\t`dateCalendarInZone(\"${zone}\") is not a time zone this runtime knows.`,\n\t\t);\n\t}\n\treturn new ZonedDateCalendar(zone);\n}\n"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
'use strict';var chunkYLTNXYA7_cjs=require('./chunk-YLTNXYA7.cjs'),chunk2YNRIT2L_cjs=require('./chunk-2YNRIT2L.cjs'),chunkUBKWHRFL_cjs=require('./chunk-UBKWHRFL.cjs'),chunk5J2XDCSV_cjs=require('./chunk-5J2XDCSV.cjs'),chunkO5ZLOZPH_cjs=require('./chunk-O5ZLOZPH.cjs'),chunkZKFCKAIX_cjs=require('./chunk-ZKFCKAIX.cjs'),chunkEZKR44MA_cjs=require('./chunk-EZKR44MA.cjs'),chunkHTAT4MGN_cjs=require('./chunk-HTAT4MGN.cjs');function Xt(e,t){let n=t===2?chunkUBKWHRFL_cjs.L:chunkUBKWHRFL_cjs.M,o=n(e.n),r=n(e.d);return o===null||r===null?null:{n:o,d:r}}function Zt(e,t){let n=chunkUBKWHRFL_cjs.y(e),o=new Map;for(let[r,i]of n){if(i%t!==0)return null;o.set(r,i/t);}return chunkUBKWHRFL_cjs.x(o)}function Wn(e,t){let n=chunkUBKWHRFL_cjs.y(e);for(let[o,r]of chunkUBKWHRFL_cjs.y(t))n.set(o,(n.get(o)??0)+r);return chunkUBKWHRFL_cjs.x(n)}function Ht(e,t){let n=chunkUBKWHRFL_cjs.y(e);for(let[o,r]of chunkUBKWHRFL_cjs.y(t)){let i=(n.get(o)??0)-r;i<=0?n.delete(o):n.set(o,i);}return chunkUBKWHRFL_cjs.x(n)}function Qn(e,t){let n=chunkUBKWHRFL_cjs.y(e),o=new Map;for(let[r,i]of chunkUBKWHRFL_cjs.y(t)){let a=n.get(r);a!==void 0&&o.set(r,Math.min(a,i));}return chunkUBKWHRFL_cjs.x(o)}function zn(e){let t=new Set;for(let n of e)for(let o of chunkUBKWHRFL_cjs.y(n).keys())t.add(o);return [...t].sort()}function Q(e){let t=new Map;for(let n of e)t.set(n.key,n.coefficient);return chunkUBKWHRFL_cjs.E({terms:t,vars:zn(e.map(n=>n.key))})}function We(e){let t=e[0];for(let n=1;n<e.length;n++)t={kind:"mul",left:t,right:e[n]};return t}function Jn(e){return [...e.terms].map(([n,o])=>({key:n,coefficient:o})).sort((n,o)=>chunkUBKWHRFL_cjs.D(n.key,o.key,e.vars))}function zt(e){if(e.vars.length<2)return null;let t=Jn(e);return t.length===2?eo(t[0],t[1]):t.length===3?to(t):t.length===4?no(t):null}function eo(e,t){let n=e.coefficient.n>0n,o=t.coefficient.n>0n;if(!n)return null;let r=Qe(e,t,2);if(r!==null&&!o)return We([Q([r.a,Te(r.b)]),Q([r.a,r.b])]);let i=Qe(e,t,3);if(i===null)return null;let a=Q(o?[i.a,i.b]:[i.a,Te(i.b)]),u=o?Te(Ve(i.a,i.b)):Ve(i.a,i.b);return We([a,Q([Wt(i.a),u,Wt(i.b)])])}function Qe(e,t,n){let o=t.coefficient.n<0n?chunkUBKWHRFL_cjs.j(t.coefficient):t.coefficient,r=Xt(e.coefficient,n),i=Xt(o,n);if(r===null||i===null)return null;let a=Zt(e.key,n),u=Zt(t.key,n);return a===null||u===null?null:{a:{key:a,coefficient:r},b:{key:u,coefficient:i}}}function Te(e){return {key:e.key,coefficient:chunkUBKWHRFL_cjs.j(e.coefficient)}}function Ve(e,t){return {key:Wn(e.key,t.key),coefficient:chunkUBKWHRFL_cjs.h(e.coefficient,t.coefficient)}}function Wt(e){return Ve(e,e)}function to(e){let[t,n,o]=e;if(t.coefficient.n<0n||o.coefficient.n<0n)return null;let r=Qe(t,o,2);if(r===null)return null;let i=Ve(r.a,r.b);if(i.key!==n.key)return null;let a=chunkUBKWHRFL_cjs.h(i.coefficient,{n:2n,d:1n}),u=n.coefficient.n<0n,l=u?chunkUBKWHRFL_cjs.j(n.coefficient):n.coefficient;return chunkUBKWHRFL_cjs.m(chunkUBKWHRFL_cjs.i(l,a))?{kind:"pow",base:Q([r.a,u?Te(r.b):r.b]),exponent:chunkUBKWHRFL_cjs.p(2)}:null}function no(e){let t=[[[0,1],[2,3]],[[0,2],[1,3]],[[0,3],[1,2]]];for(let n of t){let o=Qt(e[n[0][0]],e[n[0][1]]),r=Qt(e[n[1][0]],e[n[1][1]]);if(!(o===null||r===null)&&oo(o.cofactor,r.cofactor))return We([Q([o.common,r.common]),Q(o.cofactor)])}return null}function Qt(e,t){let n=Qn(e.key,t.key),o={key:n,coefficient:e.coefficient},r=[{key:Ht(e.key,n),coefficient:{n:1n,d:1n}},{key:Ht(t.key,n),coefficient:chunkUBKWHRFL_cjs.i(t.coefficient,e.coefficient)}];return r[0].key===r[1].key?null:{common:o,cofactor:r}}function oo(e,t){return e.length!==t.length?false:e.every((n,o)=>n.key===t[o].key&&n.coefficient.n===t[o].coefficient.n&&n.coefficient.d===t[o].coefficient.d)}var ro=12,we=4096;function Oe(e,t){let n=e<0n?-e:e,o=t<0n?-t:t;for(;o!==0n;){let r=n%o;n=o,o=r;}return n}function en(e,t){return e===0n||t===0n?0n:e/Oe(e,t)*t}function Jt(e){let t=e<0n?-e:e;if(t===0n)return null;let n=[];for(let o=1n;o*o<=t;o++){if(t%o!==0n)continue;n.push(o);let r=t/o;if(r!==o&&n.push(r),n.length>we)return null}return n}function tn(e,t){let n=chunkUBKWHRFL_cjs.a;for(let o of e)n=chunkUBKWHRFL_cjs.f(chunkUBKWHRFL_cjs.h(n,t),o);return n}function io(e,t){let n=[e[0]];for(let o=1;o<e.length-1;o++)n.push(chunkUBKWHRFL_cjs.f(e[o],chunkUBKWHRFL_cjs.h(n[o-1],t)));return n}function ue(e){if(e.length<2)return [];let t=1n;for(let s of e)t=en(t,s.d);let n=e.map(s=>s.n*t/s.d),o=n[0],r=n[n.length-1];if(r===0n)return [];let i=Jt(r),a=Jt(o);if(i===null||a===null)throw chunkHTAT4MGN_cjs.c.execution("SYMBOLIC_FACTOR_LIMIT_EXCEEDED","This polynomial's coefficients have too many divisors to search for rational roots.",{limit:we});if(i.length*a.length>we)throw chunkHTAT4MGN_cjs.c.execution("SYMBOLIC_FACTOR_LIMIT_EXCEEDED","This polynomial has too many candidate rational roots to test.",{limit:we});let u=[],l=new Set;for(let s of i)for(let p of a)for(let h of [1n,-1n]){let x={n:h*s/Oe(s,p),d:p/Oe(s,p)},T=`${x.n}/${x.d}`;l.has(T)||(l.add(T),chunkUBKWHRFL_cjs.l(tn(e,x))&&u.push(x));}return u}function ao(e,t){return chunkUBKWHRFL_cjs.l(t)?chunkUBKWHRFL_cjs.q(e):t.n>0n?{kind:"sub",left:chunkUBKWHRFL_cjs.q(e),right:chunkUBKWHRFL_cjs.p(t)}:{kind:"add",left:chunkUBKWHRFL_cjs.q(e),right:chunkUBKWHRFL_cjs.p(chunkUBKWHRFL_cjs.j(t))}}function uo(e,t){let n=e.length-1,o=new Map;return e.forEach((r,i)=>{if(chunkUBKWHRFL_cjs.l(r))return;let a=n-i;o.set(a===0?"":a===1?t:`${t}^${a}`,r);}),chunkUBKWHRFL_cjs.E({terms:o,vars:o.size>0?[t]:[]})}function Je(e,t){let n=[],o=[...e],r=ue(o);for(;r.length>0&&o.length>2;){for(let a of r){let u=0;for(;o.length>1&&chunkUBKWHRFL_cjs.l(tn(o,a));)o=io(o,a),u++;u>0&&n.push({base:ao(t,a),power:u});}r=o.length>2?ue(o):[];}return o.length-1>=1?(n.push({base:uo(o,t),power:1}),{content:chunkUBKWHRFL_cjs.b,factors:n}):{content:o.length===1?o[0]:chunkUBKWHRFL_cjs.b,factors:n}}function lo(e){let t=[];chunkUBKWHRFL_cjs.m(e.content)||t.push(chunkUBKWHRFL_cjs.p(e.content));for(let o of e.factors)t.push(o.power===1?o.base:chunkUBKWHRFL_cjs.r(o.base,chunkUBKWHRFL_cjs.p({n:BigInt(o.power),d:1n})));if(t.length===0)return chunkUBKWHRFL_cjs.p(chunkUBKWHRFL_cjs.b);let n=t[0];for(let o=1;o<t.length;o++)n={kind:"mul",left:n,right:t[o]};return n}function so(e){let t=0n,n=1n;for(let o of e.terms.values())t=Oe(t,o.n),n=en(n,o.d);return t===0n?chunkUBKWHRFL_cjs.b:{n:t,d:n}}function co(e){let t=new Map;for(let r of e.vars){let i=1/0;for(let a of e.terms.keys()){let u=mo(a,r);u<i&&(i=u);}i>0&&i!==1/0&&t.set(r,i);}if(t.size===0)return {monomial:t,reduced:e};let n=new Map;for(let[r,i]of e.terms){let a=ze(r);for(let[u,l]of t)a.set(u,(a.get(u)??0)-l);n.set(fo(a),i);}let o=new Set;for(let r of n.keys())for(let i of ze(r).keys())o.add(i);return {monomial:t,reduced:{terms:n,vars:[...o].sort()}}}function mo(e,t){return ze(e).get(t)??0}function ze(e){let t=new Map;if(e==="")return t;for(let n of e.split("*")){let o=n.indexOf("^");o===-1?t.set(n,1):t.set(n.slice(0,o),Number(n.slice(o+1)));}return t}function fo(e){return [...e.keys()].filter(n=>(e.get(n)??0)>0).sort().map(n=>e.get(n)===1?n:`${n}^${e.get(n)}`).join("*")}function po(e){let t=[...e.keys()].sort(),n=null;for(let o of t){let r=e.get(o),i=r===1?chunkUBKWHRFL_cjs.q(o):chunkUBKWHRFL_cjs.r(chunkUBKWHRFL_cjs.q(o),chunkUBKWHRFL_cjs.p({n:BigInt(r),d:1n}));n=n===null?i:{kind:"mul",left:n,right:i};}return n}function nn(e){let t=chunkUBKWHRFL_cjs.C(e);if(t===null||t.terms.size===0||chunkUBKWHRFL_cjs.z(t)>ro||t.vars.length===0)return e;let n=so(t),o=chunkUBKWHRFL_cjs.m(n)?t:bo(t,chunkUBKWHRFL_cjs.i(chunkUBKWHRFL_cjs.b,n)),{monomial:r,reduced:i}=co(o),a=po(r),u=chunkUBKWHRFL_cjs.A(i);if(u===null){let te=zt(i);return te!==null?yo(n,a,te):ho(n,a,i)??e}let l=[...chunkUBKWHRFL_cjs.B(i,u)].reverse(),s=Je(l,u),p=chunkUBKWHRFL_cjs.h(n,s.content);if(s.factors.length<=1&&(s.factors[0]?.power??1)===1&&a===null&&chunkUBKWHRFL_cjs.m(p))return e;let x=[];chunkUBKWHRFL_cjs.m(p)||x.push(chunkUBKWHRFL_cjs.p(p)),a!==null&&x.push(a),x.push(lo({content:chunkUBKWHRFL_cjs.b,factors:s.factors}));let T=x[0];for(let te=1;te<x.length;te++)T={kind:"mul",left:T,right:x[te]};return T}function bo(e,t){let n=new Map;for(let[o,r]of e.terms)n.set(o,chunkUBKWHRFL_cjs.h(r,t));return {terms:n,vars:e.vars}}function yo(e,t,n){let o=[];chunkUBKWHRFL_cjs.m(e)||o.push(chunkUBKWHRFL_cjs.p(e)),t!==null&&o.push(t),o.push(n);let r=o[0];for(let i=1;i<o.length;i++)r={kind:"mul",left:r,right:o[i]};return r}function ho(e,t,n){if(t===null&&chunkUBKWHRFL_cjs.m(e))return null;let o=[];chunkUBKWHRFL_cjs.m(e)||o.push(chunkUBKWHRFL_cjs.p(e)),t!==null&&o.push(t),o.push(chunkUBKWHRFL_cjs.E(n));let r=o[0];for(let i=1;i<o.length;i++)r={kind:"mul",left:r,right:o[i]};return r}var _={n:2n,d:1n},B={n:3n,d:1n},be={n:4n,d:1n};function No(e,t,n,o){let r=chunkUBKWHRFL_cjs.j(chunkUBKWHRFL_cjs.i(t,chunkUBKWHRFL_cjs.h(B,e))),i=chunkUBKWHRFL_cjs.i(chunkUBKWHRFL_cjs.g(chunkUBKWHRFL_cjs.h(B,chunkUBKWHRFL_cjs.h(e,n)),chunkUBKWHRFL_cjs.h(t,t)),chunkUBKWHRFL_cjs.h(B,chunkUBKWHRFL_cjs.h(e,e))),a=chunkUBKWHRFL_cjs.h(_,chunkUBKWHRFL_cjs.h(t,chunkUBKWHRFL_cjs.h(t,t))),u=chunkUBKWHRFL_cjs.h({n:9n,d:1n},chunkUBKWHRFL_cjs.h(e,chunkUBKWHRFL_cjs.h(t,n))),l=chunkUBKWHRFL_cjs.h({n:27n,d:1n},chunkUBKWHRFL_cjs.h(chunkUBKWHRFL_cjs.h(e,e),o)),s=chunkUBKWHRFL_cjs.i(chunkUBKWHRFL_cjs.f(chunkUBKWHRFL_cjs.g(a,u),l),chunkUBKWHRFL_cjs.h({n:27n,d:1n},chunkUBKWHRFL_cjs.h(e,chunkUBKWHRFL_cjs.h(e,e))));return {p:i,q:s,shift:r}}function rn(e,t,n,o){let{p:r,q:i,shift:a}=No(e,t,n,o),u=chunkUBKWHRFL_cjs.j(chunkUBKWHRFL_cjs.f(chunkUBKWHRFL_cjs.h(be,chunkUBKWHRFL_cjs.h(r,chunkUBKWHRFL_cjs.h(r,r))),chunkUBKWHRFL_cjs.h({n:27n,d:1n},chunkUBKWHRFL_cjs.h(i,i))));return chunkUBKWHRFL_cjs.k(u,chunkUBKWHRFL_cjs.a)>0?{exact:[],approximate:Ao(r,i,a)}:chunkUBKWHRFL_cjs.l(u)?{exact:go(r,i,a),approximate:[]}:{exact:Ro(r,i,a),approximate:[]}}function go(e,t,n){if(chunkUBKWHRFL_cjs.l(e))return [chunkUBKWHRFL_cjs.p(n)];let o=chunkUBKWHRFL_cjs.f(chunkUBKWHRFL_cjs.i(chunkUBKWHRFL_cjs.h(B,t),e),n),r=chunkUBKWHRFL_cjs.f(chunkUBKWHRFL_cjs.j(chunkUBKWHRFL_cjs.i(chunkUBKWHRFL_cjs.h(B,t),chunkUBKWHRFL_cjs.h(_,e))),n);return [o,r].sort(chunkUBKWHRFL_cjs.k).map(chunkUBKWHRFL_cjs.p)}function Ro(e,t,n){let o=chunkUBKWHRFL_cjs.j(chunkUBKWHRFL_cjs.i(t,_)),r=chunkUBKWHRFL_cjs.f(chunkUBKWHRFL_cjs.h(chunkUBKWHRFL_cjs.i(t,_),chunkUBKWHRFL_cjs.i(t,_)),chunkUBKWHRFL_cjs.h(chunkUBKWHRFL_cjs.i(e,B),chunkUBKWHRFL_cjs.h(chunkUBKWHRFL_cjs.i(e,B),chunkUBKWHRFL_cjs.i(e,B)))),i=chunkUBKWHRFL_cjs.O(r),a={kind:"call",name:"cbrt",args:[{kind:"add",left:chunkUBKWHRFL_cjs.p(o),right:i}]},u={kind:"call",name:"cbrt",args:[{kind:"sub",left:chunkUBKWHRFL_cjs.p(o),right:i}]},l={kind:"add",left:a,right:u},s={kind:"sub",left:a,right:u},p={kind:"add",left:chunkUBKWHRFL_cjs.p(n),right:{kind:"div",left:{kind:"neg",operand:l},right:chunkUBKWHRFL_cjs.p(_)}},h={kind:"mul",left:{kind:"div",left:{kind:"mul",left:s,right:chunkUBKWHRFL_cjs.O(B)},right:chunkUBKWHRFL_cjs.p(_)},right:chunkUBKWHRFL_cjs.w(chunkUBKWHRFL_cjs.n)};return [{kind:"add",left:chunkUBKWHRFL_cjs.p(n),right:l},{kind:"sub",left:p,right:h},{kind:"add",left:p,right:h}]}function Ao(e,t,n){let o=chunkUBKWHRFL_cjs.e(e),r=chunkUBKWHRFL_cjs.e(t),i=chunkUBKWHRFL_cjs.e(n),a=2*Math.sqrt(-o/3),u=3*r/(2*o)*Math.sqrt(-3/o),l=Math.acos(Math.min(1,Math.max(-1,u)))/3;return [0,1,2].map(s=>a*Math.cos(l-2*Math.PI*s/3)+i).sort((s,p)=>s-p)}function xo(e,t,n,o){let r=chunkUBKWHRFL_cjs.j(chunkUBKWHRFL_cjs.i(e,be)),i=chunkUBKWHRFL_cjs.h(e,e),a=chunkUBKWHRFL_cjs.g(t,chunkUBKWHRFL_cjs.i(chunkUBKWHRFL_cjs.h(B,i),{n:8n,d:1n})),u=chunkUBKWHRFL_cjs.f(chunkUBKWHRFL_cjs.g(n,chunkUBKWHRFL_cjs.i(chunkUBKWHRFL_cjs.h(e,t),_)),chunkUBKWHRFL_cjs.i(chunkUBKWHRFL_cjs.h(i,e),{n:8n,d:1n})),l=chunkUBKWHRFL_cjs.g(chunkUBKWHRFL_cjs.f(chunkUBKWHRFL_cjs.g(o,chunkUBKWHRFL_cjs.i(chunkUBKWHRFL_cjs.h(e,n),be)),chunkUBKWHRFL_cjs.i(chunkUBKWHRFL_cjs.h(i,t),{n:16n,d:1n})),chunkUBKWHRFL_cjs.i(chunkUBKWHRFL_cjs.h(B,chunkUBKWHRFL_cjs.h(i,i)),{n:256n,d:1n}));return {p:a,q:u,r:l,shift:r}}function an(e,t,n,o,r,i){let a=T=>chunkUBKWHRFL_cjs.i(T,e),{p:u,q:l,r:s,shift:p}=xo(a(t),a(n),a(o),a(r)),h=chunkUBKWHRFL_cjs.l(l)?Mo(u,s):ko(u,l,s,i);if(h===null)return null;let x=chunkUBKWHRFL_cjs.l(p)?h:h.map(T=>({kind:"add",left:chunkUBKWHRFL_cjs.p(p),right:T}));return {exact:vo(x),approximate:[]}}function vo(e){let t=new Set,n=[];for(let o of e){let r=chunkUBKWHRFL_cjs.t(chunkUBKWHRFL_cjs.Q(o));t.has(r)||(t.add(r),n.push(o));}return n}function Mo(e,t){let n=chunkUBKWHRFL_cjs.g(chunkUBKWHRFL_cjs.h(e,e),chunkUBKWHRFL_cjs.h(be,t));if(chunkUBKWHRFL_cjs.k(n,chunkUBKWHRFL_cjs.a)<0)return So(e,t);let o=chunkUBKWHRFL_cjs.N(n);return o!==null?Io(chunkUBKWHRFL_cjs.j(e),o,chunkUBKWHRFL_cjs.l(n)):Eo(e,t,n)}function Io(e,t,n){let o=n?[chunkUBKWHRFL_cjs.i(e,_)]:[chunkUBKWHRFL_cjs.i(chunkUBKWHRFL_cjs.f(e,t),_),chunkUBKWHRFL_cjs.i(chunkUBKWHRFL_cjs.g(e,t),_)],r=[];for(let i of o){if(chunkUBKWHRFL_cjs.l(i)){r.push(chunkUBKWHRFL_cjs.p(chunkUBKWHRFL_cjs.a));continue}let a=chunkUBKWHRFL_cjs.P(i);r.push({kind:"neg",operand:a},a);}return r}function Eo(e,t,n){let o=chunkUBKWHRFL_cjs.p(chunkUBKWHRFL_cjs.j(e)),r=chunkUBKWHRFL_cjs.O(n),i=chunkUBKWHRFL_cjs.k(e,chunkUBKWHRFL_cjs.a)<=0,a=[{node:et({kind:"add",left:o,right:r}),positive:i||chunkUBKWHRFL_cjs.k(t,chunkUBKWHRFL_cjs.a)<=0},{node:et({kind:"sub",left:o,right:r}),positive:i&&chunkUBKWHRFL_cjs.k(t,chunkUBKWHRFL_cjs.a)>=0}],u=[];for(let{node:l,positive:s}of a){let h={kind:"call",name:"sqrt",args:[s?l:{kind:"neg",operand:l}]},x=s?h:{kind:"mul",left:h,right:chunkUBKWHRFL_cjs.w(chunkUBKWHRFL_cjs.n)};u.push({kind:"neg",operand:x},x);}return u}function et(e){return {kind:"div",left:e,right:chunkUBKWHRFL_cjs.p(_)}}function So(e,t){let n=chunkUBKWHRFL_cjs.i(chunkUBKWHRFL_cjs.j(e),_),o=chunkUBKWHRFL_cjs.N(t),r=o===null?on(chunkUBKWHRFL_cjs.O(t),n):chunkUBKWHRFL_cjs.O(chunkUBKWHRFL_cjs.i(chunkUBKWHRFL_cjs.f(o,n),_)),a={kind:"mul",left:o===null?on(chunkUBKWHRFL_cjs.O(t),chunkUBKWHRFL_cjs.j(n)):chunkUBKWHRFL_cjs.O(chunkUBKWHRFL_cjs.i(chunkUBKWHRFL_cjs.g(o,n),_)),right:chunkUBKWHRFL_cjs.w(chunkUBKWHRFL_cjs.n)},u={kind:"add",left:r,right:a},l={kind:"sub",left:r,right:a};return [{kind:"neg",operand:u},{kind:"neg",operand:l},l,u]}function on(e,t){let n=t.n>=0n?{kind:"add",left:e,right:chunkUBKWHRFL_cjs.p(t)}:{kind:"sub",left:e,right:chunkUBKWHRFL_cjs.p(chunkUBKWHRFL_cjs.j(t))};return {kind:"call",name:"sqrt",args:[et(n)]}}function ko(e,t,n,o){let r=[{n:1n,d:1n},chunkUBKWHRFL_cjs.h(_,e),chunkUBKWHRFL_cjs.g(chunkUBKWHRFL_cjs.h(e,e),chunkUBKWHRFL_cjs.h(be,n)),chunkUBKWHRFL_cjs.j(chunkUBKWHRFL_cjs.h(t,t))];for(let i of ue(r)){if(chunkUBKWHRFL_cjs.k(i,chunkUBKWHRFL_cjs.a)<=0)continue;let a=chunkUBKWHRFL_cjs.N(i);if(a===null)continue;let u=chunkUBKWHRFL_cjs.f(e,i),l=chunkUBKWHRFL_cjs.i(t,a),s=chunkUBKWHRFL_cjs.i(chunkUBKWHRFL_cjs.g(u,l),_),p=chunkUBKWHRFL_cjs.i(chunkUBKWHRFL_cjs.f(u,l),_),h={n:1n,d:1n};return [...o(h,a,s),...o(h,chunkUBKWHRFL_cjs.j(a),p)]}return null}var _o=200,To=1e-14,Vo=1e-10,wo=1e-10,un=1e-9,Oo=1e-8,Co=4;function ye(e,t){return {re:e.re-t.re,im:e.im-t.im}}function Do(e,t){return {re:e.re*t.re-e.im*t.im,im:e.re*t.im+e.im*t.re}}function sn(e,t){if(Math.abs(t.re)>=Math.abs(t.im)){let r=t.im/t.re,i=t.re+t.im*r;return {re:(e.re+e.im*r)/i,im:(e.im-e.re*r)/i}}let n=t.re/t.im,o=t.re*n+t.im;return {re:(e.re*n+e.im)/o,im:(e.im*n-e.re)/o}}function K(e){return Math.hypot(e.re,e.im)}function Ce(e,t){let n=0,o=0;for(let r of e){let i=n*t.re-o*t.im+r;o=n*t.im+o*t.re,n=i;}return {re:n,im:o}}function Po(e,t){let n=K(t),o=0;for(let r of e)o=o*n+Math.abs(r);return o}function Lo(e){let t=e.length-1,n=[];for(let o=0;o<t;o++)n.push(e[o]*(t-o));return n}function Fo(e){let t=[...e].reverse(),o=[...chunkUBKWHRFL_cjs.K(t)].reverse().map(chunkUBKWHRFL_cjs.e);return o.some(r=>!Number.isFinite(r))?null:o}function Uo(e){let t=e.length-1,n=0;for(let a=1;a<e.length;a++)n=Math.max(n,Math.abs(e[a]));let o=1+n,r=-e[1]/t,i=[];for(let a=0;a<t;a++){let u=2*Math.PI*a/t+Math.PI/(2*t);i.push({re:r+o*Math.cos(u),im:o*Math.sin(u)});}return i}function $o(e){let t=e.length-1,n=Uo(e);for(let o=0;o<_o;o++){let r=0,i=1;for(let a=0;a<t;a++){let u={re:1,im:0};for(let s=0;s<t;s++)a!==s&&(u=Do(u,ye(n[a],n[s])));if(u.re===0&&u.im===0){n[a]={re:n[a].re+1e-6*(a+1),im:n[a].im+1e-6};continue}let l=sn(Ce(e,n[a]),u);if(!Number.isFinite(l.re)||!Number.isFinite(l.im))return null;n[a]=ye(n[a],l),r=Math.max(r,K(l)),i=Math.max(i,K(n[a]));}if(r<=To*i)return n}return null}function ln(e,t,n){let o=n;for(let r=0;r<Co;r++){let i=Ce(t,o);if(i.re===0&&i.im===0)break;let a=ye(o,sn(Ce(e,o),i));if(!Number.isFinite(a.re)||!Number.isFinite(a.im))break;o=a;}return o}function Bo(e,t,n){let o=Math.max(1,K(n));if(n.im!==0&&Math.abs(n.im)<=un*o){let r=ln(e,t,{re:n.re,im:0});if(tt(e,r))return {re:r.re,im:0}}if(n.re!==0&&Math.abs(n.re)<=un*o){let r=ln(e,t,{re:0,im:n.im});if(tt(e,r))return {re:0,im:r.im}}return n}function tt(e,t){return !Number.isFinite(t.re)||!Number.isFinite(t.im)?false:K(Ce(e,t))<=Vo*Po(e,t)}function qo(e){let t=[...e],n=t.map(o=>o.im===0);for(let o=0;o<t.length;o++){if(n[o])continue;let r={re:t[o].re,im:-t[o].im},i=-1,a=Number.POSITIVE_INFINITY;for(let p=o+1;p<t.length;p++){if(n[p])continue;let h=K(ye(t[p],r));h<a&&(a=h,i=p);}if(i===-1||a>Oo*Math.max(1,K(t[o])))continue;let u=(t[o].re+t[i].re)/2,l=(Math.abs(t[o].im)+Math.abs(t[i].im))/2,s=t[o].im<0?-1:1;t[o]={re:u,im:s*l},t[i]={re:u,im:-s*l},n[o]=true,n[i]=true;}return t}function Yo(e){for(let t=0;t<e.length;t++)for(let n=t+1;n<e.length;n++){let o=Math.max(1,K(e[t]),K(e[n]));if(K(ye(e[t],e[n]))<=wo*o)return false}return true}function cn(e){let t=Fo(e);if(t===null)return null;if(t.length<2)return [];let n=$o(t);if(n===null)return null;let o=Lo(t),r=qo(n).map(i=>Bo(t,o,i));for(let i of r)if(!tt(t,i))return null;return Yo(r)?[...r].sort((i,a)=>i.re-a.re||i.im-a.im):null}var mn=8;function Go(e,t){let n=chunkUBKWHRFL_cjs.a;for(let o of e)n=chunkUBKWHRFL_cjs.f(chunkUBKWHRFL_cjs.h(n,t),o);return n}function jo(e,t){let n=[e[0]];for(let o=1;o<e.length-1;o++)n.push(chunkUBKWHRFL_cjs.f(e[o],chunkUBKWHRFL_cjs.h(n[o-1],t)));return n}function fn(e,t,n){let o=chunkUBKWHRFL_cjs.g(chunkUBKWHRFL_cjs.h(t,t),chunkUBKWHRFL_cjs.h(Zo(),chunkUBKWHRFL_cjs.h(e,n))),r=chunkUBKWHRFL_cjs.h(Xo(),e);if(chunkUBKWHRFL_cjs.k(o,chunkUBKWHRFL_cjs.a)<0)return Ko(chunkUBKWHRFL_cjs.j(t),o,r);if(chunkUBKWHRFL_cjs.l(o))return [chunkUBKWHRFL_cjs.p(chunkUBKWHRFL_cjs.i(chunkUBKWHRFL_cjs.j(t),r))];let i=chunkUBKWHRFL_cjs.L(o.n),a=chunkUBKWHRFL_cjs.L(o.d);if(i!==null&&a!==null){let h={n:i,d:a},x=chunkUBKWHRFL_cjs.i(chunkUBKWHRFL_cjs.f(chunkUBKWHRFL_cjs.j(t),h),r),T=chunkUBKWHRFL_cjs.i(chunkUBKWHRFL_cjs.g(chunkUBKWHRFL_cjs.j(t),h),r);return chunkUBKWHRFL_cjs.k(T,x)<=0?[chunkUBKWHRFL_cjs.p(T),chunkUBKWHRFL_cjs.p(x)]:[chunkUBKWHRFL_cjs.p(x),chunkUBKWHRFL_cjs.p(T)]}let u=chunkUBKWHRFL_cjs.O(o),l=chunkUBKWHRFL_cjs.k(r,chunkUBKWHRFL_cjs.a)>0,s={kind:"div",left:{kind:"sub",left:chunkUBKWHRFL_cjs.p(chunkUBKWHRFL_cjs.j(t)),right:u},right:chunkUBKWHRFL_cjs.p(r)},p={kind:"div",left:{kind:"add",left:chunkUBKWHRFL_cjs.p(chunkUBKWHRFL_cjs.j(t)),right:u},right:chunkUBKWHRFL_cjs.p(r)};return l?[s,p]:[p,s]}function Ko(e,t,n){let o=chunkUBKWHRFL_cjs.j(t),r=chunkUBKWHRFL_cjs.L(o.n),i=chunkUBKWHRFL_cjs.L(o.d);if(r!==null&&i!==null){let s=chunkUBKWHRFL_cjs.i({n:r,d:i},n),p=chunkUBKWHRFL_cjs.i(e,n);return [chunkUBKWHRFL_cjs.w(chunkUBKWHRFL_cjs.o(p,chunkUBKWHRFL_cjs.j(s))),chunkUBKWHRFL_cjs.w(chunkUBKWHRFL_cjs.o(p,s))]}let a=chunkUBKWHRFL_cjs.i(e,n),u=chunkUBKWHRFL_cjs.i(o,chunkUBKWHRFL_cjs.h(n,n)),l={kind:"mul",left:chunkUBKWHRFL_cjs.O(u),right:chunkUBKWHRFL_cjs.w(chunkUBKWHRFL_cjs.n)};return chunkUBKWHRFL_cjs.l(a)?[{kind:"neg",operand:l},l]:[{kind:"sub",left:chunkUBKWHRFL_cjs.p(a),right:l},{kind:"add",left:chunkUBKWHRFL_cjs.p(a),right:l}]}function Xo(){return {n:2n,d:1n}}function Zo(){return {n:4n,d:1n}}function Ho(e){return {re:e,im:0}}function dn(e,t,n){let o=chunkUBKWHRFL_cjs.C({kind:"sub",left:e,right:t});if(o===null)return {kind:"unsupported",reason:"this is not a polynomial equation (it divides by an unknown, or calls a function of one)"};let r=o.vars.filter(u=>u!==n),i=chunkUBKWHRFL_cjs.z(o,n);if(r.length>0)return i!==1?{kind:"unsupported",reason:`solving for "${n}" needs the equation to be linear in it when other unknowns (${r.join(", ")}) are present`}:Wo(o,n);if(i===0)return o.terms.size===0?{kind:"identity"}:{kind:"contradiction"};if(i>mn)return {kind:"unsupported",reason:`degree ${i} is above the supported maximum of ${mn}`};let a=[...chunkUBKWHRFL_cjs.B(o,n)].reverse();return Jo(a)}function Wo(e,t){let n=new Map,o=new Map;for(let[u,l]of e.terms){let s=u.split("*").filter(h=>h.length>0),p=s.indexOf(t);p===-1?o.set(u,l):(s.splice(p,1),n.set(s.join("*"),l));}let r=u=>{let l=new Set;for(let s of u.keys())for(let p of s.split("*"))p.length>0&&l.add(p.split("^")[0]);return [...l].sort()},i=chunkUBKWHRFL_cjs.E({terms:n,vars:r(n)});return {kind:"roots",exact:[{kind:"div",left:{kind:"neg",operand:chunkUBKWHRFL_cjs.E({terms:o,vars:r(o)})},right:i}],approximate:[]}}function Qo(e){return e.length===4?rn(e[0],e[1],e[2],e[3]):e.length===5?an(e[0],e[1],e[2],e[3],e[4],fn):null}function zo(e){let t=[],n=[...e],o=0;for(;n.length>1&&chunkUBKWHRFL_cjs.l(n[n.length-1]);)n=n.slice(0,-1),o++;for(o>0&&t.push(chunkUBKWHRFL_cjs.a);n.length>1;){let r=ue(n);if(r.length===0)break;for(let i of r){let a=0;for(;n.length>1&&chunkUBKWHRFL_cjs.l(Go(n,i));)n=jo(n,i),a++;a>0&&t.push(i);}}return {roots:t.sort(chunkUBKWHRFL_cjs.k),remaining:n}}function Jo(e){let{roots:t,remaining:n}=zo(e),o=t.map(chunkUBKWHRFL_cjs.p),r=[],i=n.length-1,a=e.length-n.length;if(i<=0)return le(o,r,a,0,"");if(i===1)return o.push(chunkUBKWHRFL_cjs.p(chunkUBKWHRFL_cjs.i(chunkUBKWHRFL_cjs.j(n[1]),n[0]))),le(o,r,a+1,0,"");if(i===2)return o.push(...fn(n[0],n[1],n[2])),le(o,r,a+2,0,"");let u=Qo(n);if(u!==null)return o.push(...u.exact),r.push(...u.approximate.map(Ho)),le(o,r,a+i,0,"");let l=cn(n);return l!==null?(r.push(...l),le(o,r,a+i,0,"")):le(o,r,a,i,`a degree-${i} factor of it has no exact solution here and the numerical method did not converge on that factor`)}function le(e,t,n,o,r){let i=e.length+t.length,a=n>=1&&(i<1||i>n);return o>0||a?{kind:"incomplete",exact:e,approximate:t,missing:a?Math.max(1,n+o-i):o,reason:a?`${i} root${i===1?"":"s"} were produced for a degree-${n+o} equation, which does not add up`:r}:{kind:"roots",exact:e,approximate:t}}var pn={0:"sqrt",1:"abs",2:"sin",3:"cos",4:"tan",5:"log",6:"ceil",7:"floor",8:"round",11:"asin",12:"acos",13:"atan",14:"atan2",15:"sinh",16:"cosh",17:"tanh",18:"asinh",19:"acosh",20:"atanh",21:"cbrt",23:"expm1",24:"exp",26:"hypot",28:"log10",29:"log1p",30:"log2",33:"sign",34:"trunc",35:"degtorad",36:"radtodeg",61:"root",62:"fact"},er=31,ki=new Set([67,68,69,70,71,72,73,74,75,76,77,78,79]);function V(e){if(e.type===9)return e.value;if(e.type===13||e.type===12)return null;let t=e.toNumber();return Number.isFinite(t)?chunkUBKWHRFL_cjs.p(chunkUBKWHRFL_cjs.d(t)):null}function w(e){let t=chunkUBKWHRFL_cjs.Q(e);return t.kind==="const"?chunkO5ZLOZPH_cjs.n(chunkUBKWHRFL_cjs.e(t.value)):chunkO5ZLOZPH_cjs.K(t)}function De(e){return chunkO5ZLOZPH_cjs.P("SYMBOLIC_UNSUPPORTED_FUNCTION",`"${e}" cannot be applied to an expression that still contains an unknown.`)}function _i(e,t){let n=V(e),o=V(t);return n===null||o===null?De("^"):w(chunkUBKWHRFL_cjs.r(n,o))}function Ti(e){let t=V(e);return t===null?De("-"):w({kind:"neg",operand:t})}function Vi(e,t){let n=[];for(let r of t){let i=chunkO5ZLOZPH_cjs.Q(r);if(i)return i;let a=V(r);if(a===null)return De(pn[e]??`builtin ${e}`);n.push(a);}if(e===er&&n.length===2)return w(chunkUBKWHRFL_cjs.r(n[0],n[1]));let o=pn[e];return o===void 0?De(`builtin ${e}`):w(chunkUBKWHRFL_cjs.s(o,n))}function tr(e){let t=w(e);return t.type===0&&!Number.isInteger(t.toNumber())?chunkO5ZLOZPH_cjs.K(e):t}function nr(e){return e.im===0?chunkO5ZLOZPH_cjs.n(e.re):chunkO5ZLOZPH_cjs.K(chunkUBKWHRFL_cjs.w(chunkUBKWHRFL_cjs.o(chunkUBKWHRFL_cjs.d(e.re),chunkUBKWHRFL_cjs.d(e.im))))}function or(e){switch(e.kind){case "identity":return chunkO5ZLOZPH_cjs.t("true for every value");case "contradiction":return chunkO5ZLOZPH_cjs.t("no solution");case "unsupported":return chunkO5ZLOZPH_cjs.P("SYMBOLIC_SOLVE_UNSUPPORTED",`Cannot solve this equation: ${e.reason}.`);case "incomplete":{let t=e.exact.length+e.approximate.length;return chunkO5ZLOZPH_cjs.P("SYMBOLIC_SOLVE_INCOMPLETE",`Only ${t} of this equation's ${t+e.missing} roots could be found: ${e.reason}.`)}case "roots":{let t=e.exact.map(tr);for(let n of e.approximate)t.push(nr(n));return t.length===0?chunkO5ZLOZPH_cjs.t("no solution"):t.length===1?t[0]:chunkO5ZLOZPH_cjs.C(1,t.length,t.map(n=>n.type===9?n.value:n.toNumber()))}}}function yn(e,t,n){let o=V(e),r=V(t);return o===null||r===null?chunkO5ZLOZPH_cjs.P("SYMBOLIC_NONFINITE_OPERAND","An equation side has no exact value to solve with."):or(dn(o,r,n))}function he(e,t){if(e.type===6&&t.type===6){if(e.unit===t.unit)return {lv:e.toNumber(),rv:t.toNumber(),unit:e.unit,sameMeasure:true};let n=chunkZKFCKAIX_cjs.c(e.unit),o=chunkZKFCKAIX_cjs.c(t.unit),r=chunk2YNRIT2L_cjs.c.isCurrency(e.unit)&&chunk2YNRIT2L_cjs.c.isCurrency(t.unit);if(n&&n===o){let i=chunkZKFCKAIX_cjs.e(t.toNumber(),t.unit,e.unit);return {lv:e.toNumber(),rv:i,unit:e.unit,sameMeasure:true}}if(r){let i=chunk2YNRIT2L_cjs.c.convertSync(t.toNumber(),t.unit,e.unit);if(i!==null)return {lv:e.toNumber(),rv:i,unit:e.unit,sameMeasure:true}}return {lv:e.toNumber(),rv:t.toNumber(),unit:void 0,sameMeasure:false}}return e.type===6?{lv:e.toNumber(),rv:t.toNumber(),unit:e.unit,sameMeasure:true}:t.type===6?{lv:e.toNumber(),rv:t.toNumber(),unit:t.unit,sameMeasure:true}:{lv:e.toNumber(),rv:t.toNumber(),unit:void 0,sameMeasure:true}}var rr=1e-12;function ir(e,t,n){let o=0;return Number.isFinite(e)&&Math.abs(e)>o&&(o=Math.abs(e)),Number.isFinite(t)&&Math.abs(t)>o&&(o=Math.abs(t)),Number.isFinite(n)&&Math.abs(n)>o&&(o=Math.abs(n)),o}function qi(e,t){let{lv:n,rv:o,sameMeasure:r}=he(e,t);if(!r)return {lv:n,rv:o,equal:false,sameMeasure:false};if(e.type===6&&t.type===6&&e.unit!==void 0&&e.unit===t.unit&&e.exact!==void 0&&t.exact!==void 0&&chunk2YNRIT2L_cjs.c.isCurrency(e.unit))return {lv:n,rv:o,equal:chunkUBKWHRFL_cjs.qa(e.exact,t.exact)===0,sameMeasure:true};if(n===o)return {lv:n,rv:o,equal:true,sameMeasure:true};if(!Number.isFinite(n)||!Number.isFinite(o))return {lv:n,rv:o,equal:false,sameMeasure:true};let i=ir(n,o,t.toNumber());return {lv:n,rv:o,equal:Math.abs(n-o)<=i*rr,sameMeasure:true}}var ar={time:"duration",luminousIntensity:"luminous intensity"},ur=new Set(["money","data"]),lr={add:"added",sub:"subtracted",mul:"multiplied",div:"divided"};function Pe(e){if(chunk2YNRIT2L_cjs.c.isCurrency(e))return "money";let t=chunkZKFCKAIX_cjs.c(e);if(t!==void 0)return ar[t]??t}function hn(e){return ur.has(e)?e:/^[aeiou]/.test(e)?`an ${e}`:`a ${e}`}function Fe(e,t,n){let o=e===void 0?void 0:Pe(e),r=t===void 0?void 0:Pe(t);if(o!==void 0&&r!==void 0&&o!==r)return `${o} and ${r} cannot be ${n}`}function sr(e){return e!==void 0?lr[e]??"combined":"combined"}function Yi(e,t){let n=Pe(e),o=Pe(t);if(n!==void 0&&o!==void 0&&n!==o)return `${hn(n)} cannot be converted to ${hn(o)}`}function Gi(e,t){let n=e.type===6?e.unit:void 0,o=t.type===6?t.unit:void 0,r=Fe(n,o,"compared");return chunkO5ZLOZPH_cjs.P("INCOMPATIBLE_UNITS",r??`Cannot compare incompatible units: ${n??"?"} and ${o??"?"}`)}function Nn(e){if(e.type===2)return e.value;let t=e.toNumber();if(!Number.isInteger(t)){let n=Number.isNaN(t)?"NaN":String(t);throw chunkHTAT4MGN_cjs.c.execution("BIGINT_INEXACT_OPERAND",`A whole-number (n) value can only be combined with another whole number, and ${n} is not one`,{operand:n})}return BigInt(t)}function ji(){return chunkHTAT4MGN_cjs.c.execution("BIGINT_DIVISION_BY_ZERO","Division by zero: a whole-number (n) division is exact integer division, which has no answer at zero, unlike 1 / 0 which is Infinity")}function Ki(e,t){let n=gn(e),o=gn(t);return n===null||o===null?null:n<o?-1:n>o?1:0}function gn(e){if(e.type===2)return e.value;let t=e.toNumber();return Number.isInteger(t)?BigInt(t):null}function nt(e,t){return Number.isFinite(t)?Math.pow(e,t):e===1||e===-1&&!Number.isNaN(t)?1:Math.pow(e,t)}function Rn(e){return e.exact!==void 0?e.exact:chunkUBKWHRFL_cjs.ha(e.toNumber())}function cr(e,t,n){let o=e.type===6&&e.unit!==void 0&&e.exact!==void 0&&chunk2YNRIT2L_cjs.c.isCurrency(e.unit),r=t.type===6&&t.unit!==void 0&&t.exact!==void 0&&chunk2YNRIT2L_cjs.c.isCurrency(t.unit);if(!o&&!r)return null;let i,a,u;if(o&&r){if(e.unit!==t.unit||n==="div")return null;i=e.exact,a=t.exact,u=e.unit;}else if(o&&t.type!==6)i=e.exact,u=e.unit,a=Rn(t);else if(r&&e.type!==6)a=t.exact,u=t.unit,i=Rn(e);else return null;if(i===null||a===null)return null;let l;switch(n){case "add":l=chunkUBKWHRFL_cjs.ja(i,a);break;case "sub":l=chunkUBKWHRFL_cjs.ka(i,a);break;case "mul":l=chunkUBKWHRFL_cjs.la(i,a);break;case "div":if(chunkUBKWHRFL_cjs.na(a))return null;l=chunkUBKWHRFL_cjs.pa(i,a);break}return chunkO5ZLOZPH_cjs.v(chunkUBKWHRFL_cjs.ra(l),u,l)}function Le(e){return e.rational!==void 0?e.rational:(e.type===0||e.type===1)&&typeof e.value=="number"&&Number.isInteger(e.value)?chunkUBKWHRFL_cjs.c(BigInt(e.value)):null}function Xi(e,t,n){let o=Le(e);if(o===null)return null;let r=Le(t);if(r===null||n==="div"&&chunkUBKWHRFL_cjs.l(r))return null;let i;try{switch(n){case "add":i=chunkUBKWHRFL_cjs.f(o,r);break;case "sub":i=chunkUBKWHRFL_cjs.g(o,r);break;case "mul":i=chunkUBKWHRFL_cjs.h(o,r);break;case "div":i=chunkUBKWHRFL_cjs.i(o,r);break}}catch{return null}return chunkO5ZLOZPH_cjs.p(chunkUBKWHRFL_cjs.e(i),i)}function Zi(e,t,n){if(e.type!==0||t.type!==0)return null;let o=e.value,r=t.value,i=e.uncertainty??0,a=t.uncertainty??0,u,l;switch(n){case "add":u=o+r,l=Math.hypot(i,a);break;case "sub":u=o-r,l=Math.hypot(i,a);break;case "mul":u=o*r,l=Math.hypot(r*i,o*a);break;case "div":u=o/r,l=Math.hypot(i/r,o*a/(r*r));break}return chunkO5ZLOZPH_cjs.q(u,l)}function Hi(e,t){let n=Le(e);if(n===null)return null;let o=Le(t);return o===null?null:chunkUBKWHRFL_cjs.k(n,o)}function Wi(e,t,n,o,r){if(e.type===13)return e;if(t.type===13)return t;if(e.type===12)return e;if(t.type===12)return t;if(r&&(e.type===9||t.type===9)){let i=V(e),a=V(t);return i===null||a===null?chunkO5ZLOZPH_cjs.P("SYMBOLIC_NONFINITE_OPERAND","A symbolic expression cannot combine with a value that has no exact number (NaN or infinity)."):chunkO5ZLOZPH_cjs.K(chunkUBKWHRFL_cjs.Q({kind:r,left:i,right:a}))}if(e.type===0&&t.type===0)return chunkO5ZLOZPH_cjs.n(n(e.value,t.value));if(e.type===2||t.type===2){let i=Nn(e),a=Nn(t);return o?chunkO5ZLOZPH_cjs.s(o(i,a)):chunkO5ZLOZPH_cjs.s(i+a)}if(e.type===6||t.type===6){if(r){let s=cr(e,t,r);if(s)return s}let{lv:i,rv:a,unit:u,sameMeasure:l}=he(e,t);if(!l){let s=e.type===6?e.unit:void 0,p=t.type===6?t.unit:void 0,h=Fe(s,p,sr(r));return chunkO5ZLOZPH_cjs.P("INCOMPATIBLE_UNITS",h??`Cannot combine incompatible units: ${s??"?"} and ${p??"?"}`)}return chunkO5ZLOZPH_cjs.u(n(i,a),u)}if(e.type===7&&t.type===7){let i=e.value,a=t.value;if(!chunkUBKWHRFL_cjs.V(i,a))return chunkO5ZLOZPH_cjs.P("DIMENSION_MISMATCH",`Cannot combine matrices of different shapes: ${i.rows}x${i.cols} and ${a.rows}x${a.cols}`);let u=new Array(i.data.length);for(let l=0;l<i.data.length;l++)u[l]=n(i.data[l],a.data[l]);return chunkO5ZLOZPH_cjs.C(i.rows,i.cols,u)}if(e.type===7){let i=e.value,a=t.toNumber(),u=i.data.map(l=>n(l,a));return chunkO5ZLOZPH_cjs.C(i.rows,i.cols,u)}if(t.type===7){let i=t.value,a=e.toNumber(),u=i.data.map(l=>n(a,l));return chunkO5ZLOZPH_cjs.C(i.rows,i.cols,u)}return chunkO5ZLOZPH_cjs.n(n(e.toNumber(),t.toNumber()))}var An=254,xn=200,Ne=class{constructor(){this.handlers=new Map;this.nextOpcode=xn+1;}register(t){this.handlers.set(t.opcode,t.handler);}unregister(t){this.handlers.delete(t);}get(t){return this.handlers.get(t)}has(t){return this.handlers.has(t)}allocateOpcode(){if(this.nextOpcode>An)throw chunkHTAT4MGN_cjs.c.config("OPCODE_POOL_EXHAUSTED",`OpRegistry: dynamic opcode pool exhausted (max ${An-xn} allocations).`);return this.nextOpcode++}},Ji=new Ne;var Mn=chunkUBKWHRFL_cjs.ga(1);function ge(e,t){return chunk2YNRIT2L_cjs.c.isCurrency(t)?e.exact??chunkUBKWHRFL_cjs.ha(e.toNumber()):null}function ot(e){if(!Number.isFinite(e))return null;if(Number.isInteger(e))return chunkUBKWHRFL_cjs.ga(BigInt(e));let t=String(e);return /^-?\d+\.\d+$/.test(t)?chunkUBKWHRFL_cjs.ia(t):null}function In(e,t,n){let o=ge(e,n),r=ot(t);if(o!==null&&r!==null){let i=chunkUBKWHRFL_cjs.la(o,r);return chunkO5ZLOZPH_cjs.v(chunkUBKWHRFL_cjs.ra(i),n,i)}return chunkO5ZLOZPH_cjs.u(e.toNumber()*t,n)}function En(e,t,n,o){let r=ge(e,t),i=ot(n);if(r!==null&&i!==null){let a=chunkUBKWHRFL_cjs.ja(Mn,o===1?i:chunkUBKWHRFL_cjs.ma(i)),u=chunkUBKWHRFL_cjs.la(r,a);return chunkO5ZLOZPH_cjs.v(chunkUBKWHRFL_cjs.ra(u),t,u)}return chunkO5ZLOZPH_cjs.u(e.toNumber()*(1+o*n),t)}function Sn(e){let t=ot(e);return t===null?null:chunkUBKWHRFL_cjs.ja(Mn,t)}function kn(e,t,n){let o=ge(e,t),r=Sn(n);if(o===null||r===null||chunkUBKWHRFL_cjs.na(r))return null;let i=chunkUBKWHRFL_cjs.pa(o,r);return chunkO5ZLOZPH_cjs.v(chunkUBKWHRFL_cjs.ra(i),t,i)}function _n(e,t,n){let o=ge(e,t),r=Sn(n);if(o===null||r===null||chunkUBKWHRFL_cjs.na(r))return null;let i=chunkUBKWHRFL_cjs.ka(o,chunkUBKWHRFL_cjs.pa(o,r));return chunkO5ZLOZPH_cjs.v(chunkUBKWHRFL_cjs.ra(i),t,i)}function Tn(e,t){let n=e.unit,o=n!==void 0&&chunk2YNRIT2L_cjs.c.isCurrency(n)?mr(e,n):null;if(o===null)return {unit:n,shares:[{value:e.toNumber()/t,count:t}]};let r=BigInt(t),i=o/r,a=o-i*r,u=Number(a<0n?-a:a),l=o<0n?-1n:1n,s=vn(i,t-u);return u===0?{unit:n,shares:[s]}:{unit:n,shares:[s,vn(i+l,u)]}}function vn(e,t){let n=chunkUBKWHRFL_cjs.fa(e,2);return {value:chunkUBKWHRFL_cjs.ra(n),exact:n,count:t}}function mr(e,t){let n=ge(e,t);return n===null?null:chunkUBKWHRFL_cjs.oa(n,2).coef}var fr=12;function Vn(e,t){if(e.length===0||t.length===0)return [];let n=new Array(e.length+t.length-1).fill(chunkUBKWHRFL_cjs.a);return e.forEach((o,r)=>{t.forEach((i,a)=>{n[r+a]=chunkUBKWHRFL_cjs.f(n[r+a],chunkUBKWHRFL_cjs.h(o,i));});}),n}function dr(e,t){let n=[chunkUBKWHRFL_cjs.b];for(let o=0;o<t;o++)n=Vn(n,e);return n}function rt(e,t){return e.map(n=>chunkUBKWHRFL_cjs.i(n,t))}function pr(e,t){let n=[],o=0;for(;o<e.length&&chunkUBKWHRFL_cjs.l(e[o]);)o++;o>0&&n.push({base:[chunkUBKWHRFL_cjs.a,chunkUBKWHRFL_cjs.b],power:o});let r=e.slice(o);if(r.length>1){let i=Je([...r].reverse(),t);for(let a of i.factors){let u=chunkUBKWHRFL_cjs.C(a.base);if(u===null)return null;n.push({base:[...chunkUBKWHRFL_cjs.B(u,t)],power:a.power});}}return n.length>0?n:null}function br(e){let t=[];return e.forEach((n,o)=>{let r=n.base.length-1;for(let i=1;i<=n.power;i++)for(let a=0;a<r;a++)t.push({factor:o,power:i,degree:a});}),t}function yr(e,t,n){let o=dr(t[e.factor].base,e.power),{quotient:r,remainder:i}=chunkUBKWHRFL_cjs.H(n,o);if(!chunkUBKWHRFL_cjs.G(i))return null;let a=new Array(e.degree).fill(chunkUBKWHRFL_cjs.a);return a.push(chunkUBKWHRFL_cjs.b),Vn(r,a)}function hr(e,t){let n=t.length;for(let o=0;o<n;o++){let r=-1;for(let i=o;i<n;i++)if(!chunkUBKWHRFL_cjs.l(e[i][o])){r=i;break}if(r===-1)return null;[e[o],e[r]]=[e[r],e[o]],[t[o],t[r]]=[t[r],t[o]];for(let i=0;i<n;i++){if(i===o||chunkUBKWHRFL_cjs.l(e[i][o]))continue;let a=chunkUBKWHRFL_cjs.i(e[i][o],e[o][o]);for(let u=o;u<n;u++)e[i][u]=chunkUBKWHRFL_cjs.g(e[i][u],chunkUBKWHRFL_cjs.h(a,e[o][u]));t[i]=chunkUBKWHRFL_cjs.g(t[i],chunkUBKWHRFL_cjs.h(a,t[o]));}}return t.map((o,r)=>chunkUBKWHRFL_cjs.i(o,e[r][r]))}function it(e,t,n){if(t.length<2||t.length-1>fr)return null;let o=chunkUBKWHRFL_cjs.I(e,t),r=o.length>1?chunkUBKWHRFL_cjs.H(e,o).quotient:[...e],i=o.length>1?chunkUBKWHRFL_cjs.H(t,o).quotient:[...t];if(i.length===1)return {polynomial:rt(r,i[0]),terms:[]};if(i.length===0)return null;let a=i[i.length-1],u=rt(i,a),l=rt(r,a),{quotient:s,remainder:p}=chunkUBKWHRFL_cjs.H(l,u);if(chunkUBKWHRFL_cjs.G(p))return {polynomial:s,terms:[]};let h=pr(u,n);if(h===null)return null;let x=Nr(h,u,p);return x===null?null:{polynomial:s,terms:x}}function Nr(e,t,n){let o=br(e),r=t.length-1;if(o.length!==r)return null;let i=[];for(let s of o){let p=yr(s,e,t);if(p===null)return null;i.push(p);}let a=[];for(let s=0;s<r;s++)a.push(i.map(p=>p[s]??chunkUBKWHRFL_cjs.a));let u=[];for(let s=0;s<r;s++)u.push(n[s]??chunkUBKWHRFL_cjs.a);let l=hr(a,u);return l===null?null:gr(o,l,e)}function gr(e,t,n){let o=new Map;e.forEach((i,a)=>{let u=`${i.factor}:${i.power}`,l=o.get(u)??[];l[i.degree]=t[a],o.set(u,l);});let r=[];for(let[i,a]of o){let[u,l]=i.split(":").map(Number),s=[...a].map(p=>p??chunkUBKWHRFL_cjs.a);s.every(chunkUBKWHRFL_cjs.l)||r.push({numerator:s,base:n[u].base,power:l});}return r}function Re(e,t){let n=new Map;return e.forEach((o,r)=>{chunkUBKWHRFL_cjs.l(o)||n.set(r===0?"":r===1?t:`${t}^${r}`,o);}),n.size===0?chunkUBKWHRFL_cjs.p(chunkUBKWHRFL_cjs.a):chunkUBKWHRFL_cjs.E({terms:n,vars:e.length>1?[t]:[]})}function wn(e){let t=at(e);if(t===null)return e;let n=it(t.numerator,t.denominator,t.variable);if(n===null||n.terms.length===0)return e;let o=n.polynomial.length>0?Re(n.polynomial,t.variable):null;for(let r of n.terms){let i=Re(r.base,t.variable),a=r.power===1?i:chunkUBKWHRFL_cjs.r(i,chunkUBKWHRFL_cjs.p({n:BigInt(r.power),d:1n})),u=Rr(r.numerator),l=u?r.numerator.map(p=>chunkUBKWHRFL_cjs.j(p)):r.numerator,s={kind:"div",left:Re(l,t.variable),right:a};o===null?o=u?{kind:"neg",operand:s}:s:o={kind:u?"sub":"add",left:o,right:s};}return o===null?e:chunkUBKWHRFL_cjs.Q(o)}function Rr(e){return e.some(t=>t.n<0n)&&e.every(t=>t.n<=0n)}function at(e){if(e.kind!=="div")return null;let t=chunkUBKWHRFL_cjs.C(e.left),n=chunkUBKWHRFL_cjs.C(e.right);if(t===null||n===null)return null;let o=chunkUBKWHRFL_cjs.A(n);return o===null||t.vars.some(r=>r!==o)?null:{numerator:chunkUBKWHRFL_cjs.B(t,o),denominator:chunkUBKWHRFL_cjs.B(n,o),variable:o}}var ut=16;function On(){return chunkUBKWHRFL_cjs.p(chunkUBKWHRFL_cjs.a)}function X(){return chunkUBKWHRFL_cjs.p(chunkUBKWHRFL_cjs.b)}function Ar(e,t){switch(e){case "sin":return chunkUBKWHRFL_cjs.s("cos",[t]);case "cos":return {kind:"neg",operand:chunkUBKWHRFL_cjs.s("sin",[t])};case "tan":return {kind:"div",left:X(),right:chunkUBKWHRFL_cjs.r(chunkUBKWHRFL_cjs.s("cos",[t]),chunkUBKWHRFL_cjs.p(2))};case "exp":return chunkUBKWHRFL_cjs.s("exp",[t]);case "log":return {kind:"div",left:X(),right:t};case "sqrt":return {kind:"div",left:X(),right:{kind:"mul",left:chunkUBKWHRFL_cjs.p(2),right:chunkUBKWHRFL_cjs.s("sqrt",[t])}};case "asin":return {kind:"div",left:X(),right:chunkUBKWHRFL_cjs.s("sqrt",[Cn(t)])};case "acos":return {kind:"neg",operand:{kind:"div",left:X(),right:chunkUBKWHRFL_cjs.s("sqrt",[Cn(t)])}};case "atan":return {kind:"div",left:X(),right:xr(t)};case "sinh":return chunkUBKWHRFL_cjs.s("cosh",[t]);case "cosh":return chunkUBKWHRFL_cjs.s("sinh",[t]);case "tanh":return {kind:"div",left:X(),right:chunkUBKWHRFL_cjs.r(chunkUBKWHRFL_cjs.s("cosh",[t]),chunkUBKWHRFL_cjs.p(2))};case "abs":return chunkUBKWHRFL_cjs.s("sign",[t]);default:return null}}function Cn(e){return {kind:"sub",left:X(),right:chunkUBKWHRFL_cjs.r(e,chunkUBKWHRFL_cjs.p(2))}}function xr(e){return {kind:"add",left:X(),right:chunkUBKWHRFL_cjs.r(e,chunkUBKWHRFL_cjs.p(2))}}function Ae(e,t,n=1){if(n<0||!Number.isInteger(n))throw chunkHTAT4MGN_cjs.c.execution("SYMBOLIC_DERIVATIVE_ORDER_LIMIT","A derivative order must be a whole number, at least zero.");if(n>ut)throw chunkHTAT4MGN_cjs.c.execution("SYMBOLIC_DERIVATIVE_ORDER_LIMIT",`A derivative order above ${ut} is not supported.`,{limit:ut});let o=chunkUBKWHRFL_cjs.Q(e);for(let r=0;r<n;r++)o=chunkUBKWHRFL_cjs.Q(P(o,t));return o}function P(e,t){switch(e.kind){case "const":case "complex":return On();case "var":return e.name===t?X():On();case "add":return {kind:"add",left:P(e.left,t),right:P(e.right,t)};case "sub":return {kind:"sub",left:P(e.left,t),right:P(e.right,t)};case "neg":return {kind:"neg",operand:P(e.operand,t)};case "mul":return {kind:"add",left:{kind:"mul",left:P(e.left,t),right:e.right},right:{kind:"mul",left:e.left,right:P(e.right,t)}};case "div":return {kind:"div",left:{kind:"sub",left:{kind:"mul",left:P(e.left,t),right:e.right},right:{kind:"mul",left:e.left,right:P(e.right,t)}},right:chunkUBKWHRFL_cjs.r(e.right,chunkUBKWHRFL_cjs.p(2))};case "pow":return vr(e,t);case "call":{if(e.args.length!==1)return lt(e,t);let n=Ar(e.name,e.args[0]);return n===null?lt(e,t):{kind:"mul",left:n,right:P(e.args[0],t)}}}}function vr(e,t){if(e.exponent.kind==="const"){let n=chunkUBKWHRFL_cjs.p(chunkUBKWHRFL_cjs.g(e.exponent.value,chunkUBKWHRFL_cjs.b));return {kind:"mul",left:{kind:"mul",left:e.exponent,right:chunkUBKWHRFL_cjs.r(e.base,n)},right:P(e.base,t)}}return e.base.kind==="const"&&e.base.value.n>0n?{kind:"mul",left:{kind:"mul",left:e,right:chunkUBKWHRFL_cjs.s("log",[e.base])},right:P(e.exponent,t)}:lt(e,t)}function lt(e,t){return chunkUBKWHRFL_cjs.s("der",[e,chunkUBKWHRFL_cjs.q(t)])}function Dn(e,t){let n=chunkUBKWHRFL_cjs.C(e);if(n===null||n.vars.filter(u=>u!==t).length>0||chunkUBKWHRFL_cjs.z(n,t)>1)return null;let r=chunkUBKWHRFL_cjs.B(n,t),i=r[0]??{n:0n,d:1n},a=r[1]??{n:0n,d:1n};return chunkUBKWHRFL_cjs.l(a)?null:{slope:a,intercept:i}}function Mr(e,t){let n=chunkUBKWHRFL_cjs.C(e);if(n===null)return null;let o=n.vars.filter(a=>a!==t);if(o.length>0)return {ok:false,reason:`it involves more than one unknown (${o.join(", ")})`};let r=chunkUBKWHRFL_cjs.B(n,t),i=chunkUBKWHRFL_cjs.p(0);return r.forEach((a,u)=>{if(chunkUBKWHRFL_cjs.l(a))return;let l=u+1,s=chunkUBKWHRFL_cjs.i(a,{n:BigInt(l),d:1n}),p={kind:"mul",left:chunkUBKWHRFL_cjs.p(s),right:l===1?chunkUBKWHRFL_cjs.q(t):chunkUBKWHRFL_cjs.r(chunkUBKWHRFL_cjs.q(t),chunkUBKWHRFL_cjs.p(l))};i={kind:"add",left:i,right:p};}),{ok:true,value:chunkUBKWHRFL_cjs.Q(i)}}function Ir(e,t){if(e.kind!=="call"||e.args.length!==1)return null;let n=Dn(e.args[0],t);if(n===null)return null;let o=e.args[0],r=i=>chunkUBKWHRFL_cjs.Q({kind:"div",left:i,right:chunkUBKWHRFL_cjs.p(n.slope)});switch(e.name){case "exp":return {ok:true,value:r(chunkUBKWHRFL_cjs.s("exp",[o]))};case "sin":return {ok:true,value:r({kind:"neg",operand:chunkUBKWHRFL_cjs.s("cos",[o])})};case "cos":return {ok:true,value:r(chunkUBKWHRFL_cjs.s("sin",[o]))};case "log":return {ok:true,value:r({kind:"sub",left:{kind:"mul",left:o,right:chunkUBKWHRFL_cjs.s("log",[o])},right:o})};default:return null}}function Er(e,t){if(e.kind!=="div"||e.left.kind!=="const"||!st(e.left.value))return null;let n=Dn(e.right,t);if(n!==null)return {ok:true,value:chunkUBKWHRFL_cjs.Q({kind:"div",left:chunkUBKWHRFL_cjs.s("log",[e.right]),right:chunkUBKWHRFL_cjs.p(n.slope)})};let o=chunkUBKWHRFL_cjs.C(e.right);if(o!==null&&o.vars.length===1&&o.vars[0]===t){let r=chunkUBKWHRFL_cjs.B(o,t);if(r.length===3&&st(r[0])&&chunkUBKWHRFL_cjs.l(r[1])&&st(r[2]))return {ok:true,value:chunkUBKWHRFL_cjs.s("atan",[chunkUBKWHRFL_cjs.q(t)])}}return null}function st(e){return e.n===1n&&e.d===1n}function Sr(e,t){let n=at(e);if(n===null||n.variable!==t)return null;let o=it(n.numerator,n.denominator,t);if(o===null)return null;let r=o.polynomial.length>0?Tr(o.polynomial,t):chunkUBKWHRFL_cjs.p(0);for(let i of o.terms){let a=kr(i,t);if(a===null)return {ok:false,reason:"its denominator has a repeated irreducible quadratic factor, which needs a reduction formula this does not have"};r={kind:"add",left:r,right:a};}return {ok:true,value:chunkUBKWHRFL_cjs.Q(r)}}function kr(e,t){let n=e.base.length-1,o=Re(e.base,t);if(n===1){let r=e.numerator[0]??chunkUBKWHRFL_cjs.a;if(e.power===1)return {kind:"mul",left:chunkUBKWHRFL_cjs.p(r),right:chunkUBKWHRFL_cjs.s("log",[o])};let i=e.power-1,a=chunkUBKWHRFL_cjs.i(r,{n:BigInt(-i),d:1n});return {kind:"div",left:chunkUBKWHRFL_cjs.p(a),right:chunkUBKWHRFL_cjs.r(o,chunkUBKWHRFL_cjs.p({n:BigInt(i),d:1n}))}}return n!==2||e.power!==1?null:_r(e,t,o)}function _r(e,t,n){let o=e.numerator[0]??chunkUBKWHRFL_cjs.a,r=e.numerator[1]??chunkUBKWHRFL_cjs.a,[i,a]=e.base,u={n:1n,d:2n},l=chunkUBKWHRFL_cjs.h(a,u),s={kind:"mul",left:chunkUBKWHRFL_cjs.p(chunkUBKWHRFL_cjs.h(r,u)),right:chunkUBKWHRFL_cjs.s("log",[n])},p=chunkUBKWHRFL_cjs.g(o,chunkUBKWHRFL_cjs.h(r,l));if(chunkUBKWHRFL_cjs.l(p))return s;let h=chunkUBKWHRFL_cjs.O(chunkUBKWHRFL_cjs.g(i,chunkUBKWHRFL_cjs.h(l,l))),x={kind:"add",left:chunkUBKWHRFL_cjs.q(t),right:chunkUBKWHRFL_cjs.p(l)},T={kind:"mul",left:{kind:"div",left:chunkUBKWHRFL_cjs.p(p),right:h},right:chunkUBKWHRFL_cjs.s("atan",[{kind:"div",left:x,right:h}])};return chunkUBKWHRFL_cjs.l(r)?T:{kind:"add",left:s,right:T}}function Tr(e,t){let n=chunkUBKWHRFL_cjs.p(0);return e.forEach((o,r)=>{if(chunkUBKWHRFL_cjs.l(o))return;let i=r+1,a=chunkUBKWHRFL_cjs.i(o,{n:BigInt(i),d:1n}),u={kind:"mul",left:chunkUBKWHRFL_cjs.p(a),right:i===1?chunkUBKWHRFL_cjs.q(t):chunkUBKWHRFL_cjs.r(chunkUBKWHRFL_cjs.q(t),chunkUBKWHRFL_cjs.p(i))};n={kind:"add",left:n,right:u};}),n}function xe(e,t){let n=chunkUBKWHRFL_cjs.Q(e);if(!chunkUBKWHRFL_cjs.u(n).has(t))return {ok:true,value:chunkUBKWHRFL_cjs.Q({kind:"mul",left:n,right:chunkUBKWHRFL_cjs.q(t)})};let o=Mr(n,t);if(o!==null)return o;let r=Ir(n,t);if(r!==null)return r;let i=Er(n,t);if(i!==null)return i;let a=Sr(n,t);if(a!==null)return a;if(n.kind==="add"||n.kind==="sub"){let u=xe(n.left,t);if(!u.ok)return u;let l=xe(n.right,t);return l.ok?{ok:true,value:chunkUBKWHRFL_cjs.Q({kind:n.kind,left:u.value,right:l.value})}:l}if(n.kind==="mul"&&n.left.kind==="const"){let u=xe(n.right,t);return u.ok?{ok:true,value:chunkUBKWHRFL_cjs.Q({kind:"mul",left:n.left,right:u.value})}:u}return {ok:false,reason:"no elementary antiderivative is known for this expression"}}var ct=16;function Pn(e,t,n,o){if(o<0||!Number.isInteger(o)||o>ct)throw chunkHTAT4MGN_cjs.c.execution("SYMBOLIC_TAYLOR_DEGREE_LIMIT",`A Taylor degree must be a whole number from 0 to ${ct}.`,{limit:ct});let r=chunkUBKWHRFL_cjs.p(n),i=1n,a=chunkUBKWHRFL_cjs.p(chunkUBKWHRFL_cjs.a);for(let u=0;u<=o;u++){u>0&&(i*=BigInt(u));let l=Ae(e,t,u),s=chunkUBKWHRFL_cjs.Q(chunkUBKWHRFL_cjs.v(l,t,r));if(s.kind!=="const")throw chunkHTAT4MGN_cjs.c.execution("SYMBOLIC_TAYLOR_INEXACT",`The derivative of order ${u} does not reduce to an exact number at the expansion point, so this series cannot be computed exactly.`,{order:u});let p=chunkUBKWHRFL_cjs.i(s.value,{n:i,d:1n});if(chunkUBKWHRFL_cjs.l(p))continue;let h=chunkUBKWHRFL_cjs.l(n)?chunkUBKWHRFL_cjs.q(t):{kind:"sub",left:chunkUBKWHRFL_cjs.q(t),right:r},x=u===0?chunkUBKWHRFL_cjs.p(1):u===1?h:chunkUBKWHRFL_cjs.r(h,chunkUBKWHRFL_cjs.p(u));a={kind:"add",left:a,right:{kind:"mul",left:chunkUBKWHRFL_cjs.p(p),right:x}};}return chunkUBKWHRFL_cjs.Q(a)}function Ln(e,t){return e.map(n=>t.map(o=>Ae(n,o)))}function Vr(){let e=globalThis.Temporal;return e??void 0}function Fn(e){if(e!==void 0&&typeof e!="string")return e;if(e==="date")return chunk5J2XDCSV_cjs.b;let t=Vr();if(e==="temporal"){if(t===void 0)throw chunkHTAT4MGN_cjs.c.config("CALENDAR_TEMPORAL_UNAVAILABLE",'calendar: "temporal" was asked for, but this runtime has no Temporal. Node ships it from 26 (24 behind --harmony-temporal), and Chrome, Edge, Firefox and Opera ship it; Safari does not. Pass a polyfill-backed backend from "solve-engine/temporal", or use calendar: "auto" to compute on Date where Temporal is absent.');return chunkYLTNXYA7_cjs.b(t)}return t===void 0?chunk5J2XDCSV_cjs.b:chunkYLTNXYA7_cjs.b(t)}function wr(e={}){return {pluginFunctions:{},opRegistry:new Ne,pluginFunctionOwners:{},networkEnabled:e.networkEnabled??true,calendar:Fn(e.calendar)}}var Un=wr();var Or={1970:38.8,1971:40.5,1972:41.8,1973:44.4,1974:49.3,1975:53.8,1976:56.9,1977:60.6,1978:65.2,1979:72.6,1980:82.4,1981:90.9,1982:96.5,1983:99.6,1984:103.9,1985:107.6,1986:109.6,1987:113.6,1988:118.3,1989:124,1990:130.7,1991:136.2,1992:140.3,1993:144.5,1994:148.2,1995:152.4,1996:156.9,1997:160.5,1998:163,1999:166.6,2e3:172.2,2001:177.1,2002:179.9,2003:184,2004:188.9,2005:195.3,2006:201.6,2007:207.3,2008:215.3,2009:214.5,2010:218.1,2011:224.9,2012:229.6,2013:233,2014:236.7,2015:237,2016:240,2017:245.1,2018:251.1,2019:255.7,2020:258.8,2021:271,2022:292.7,2023:304.7,2024:313.7,2025:322.2,2026:332.7},Bn=1970,qn=2026;function $n(e){return Or[Math.trunc(e)]}function mt(e,t){let n=$n(e),o=$n(t);if(!(n===void 0||o===void 0||n===0))return o/n}function Fa(e,t,n){let o=mt(t,n);if(o!==void 0)return e*o}function Cr(e){let t=Math.abs(e);return t<60?chunkO5ZLOZPH_cjs.u(e,"s"):t<3600?chunkO5ZLOZPH_cjs.u(e/60,"min"):t<86400?chunkO5ZLOZPH_cjs.u(e/3600,"h"):chunkO5ZLOZPH_cjs.u(e/86400,"d")}var Dr=0;function ft(e){if(e.type===6&&e.unit!==void 0){let t=chunkEZKR44MA_cjs.a[e.unit.toLowerCase()];if(t!==void 0&&t[0]===Dr)return e.toNumber()*t[1]}return e.toNumber()}function Pr(e,t){if(t===1)return e;let n=`${e}s`;return chunkEZKR44MA_cjs.a[n.toLowerCase()]===void 0?e:n}function Yn(e,t){let n,o=false;for(let r of e){if(Number.isNaN(r.toNumber())){o=true;continue}if(n===void 0){n=r;continue}let{lv:i,rv:a,sameMeasure:u}=he(n,r);if(!u){let l=n.type===6?n.unit:void 0,s=r.type===6?r.unit:void 0,p=Fe(l,s,"compared");return chunkO5ZLOZPH_cjs.P("INCOMPATIBLE_UNITS",p??`Cannot compare incompatible units: ${l??"?"} and ${s??"?"}`)}(t?a>i:a<i)&&(n=r);}return o?chunkO5ZLOZPH_cjs.n(NaN):n===void 0?chunkO5ZLOZPH_cjs.n(t?-1/0:1/0):n.type===6?n:chunkO5ZLOZPH_cjs.n(n.toNumber())}function Ue(e,t){return e.type===6&&e.unit!==void 0?chunkO5ZLOZPH_cjs.u(t,e.unit):chunkO5ZLOZPH_cjs.n(t)}function Gn(e,t){let n=Number.isFinite(t)?Math.min(100,Math.max(0,Math.trunc(t))):0;if(e.exact!==void 0){let a=chunkUBKWHRFL_cjs.oa(e.exact,n);return $e(e,chunkUBKWHRFL_cjs.ra(a),n,a)}let o=e.toNumber();if(!Number.isFinite(o))return $e(e,o,n);let r=Math.pow(10,n),i=o*r;return !Number.isFinite(i)||Math.abs(i)>Number.MAX_SAFE_INTEGER?$e(e,o,n):$e(e,Math.round(i)/r,n)}function $e(e,t,n,o){let r=e.type===6&&e.unit!==void 0?chunkO5ZLOZPH_cjs.u(t,e.unit):chunkO5ZLOZPH_cjs.n(t);return r.decimalPlaces=n,o!==void 0&&(r.exact=o),r}function jn(e,t,n){if(Number.isFinite(e)&&Number.isFinite(t))return null;let o=Number.isFinite(e)?t:e;return chunkO5ZLOZPH_cjs.P("INVALID_INTEGER_OPERAND",`${n} needs two whole numbers, and ${Number.isNaN(o)?"one of them has no value":"one of them is infinite"}`)}function Kn(e,t){let n=e,o=t;for(;o!==0;){let r=o;o=n%o,n=r;}return n}function Lr(e){let t=e.length;if(t===0)return 0;let n=e.reduce((o,r)=>o+r,0)/t;return e.reduce((o,r)=>o+(r-n)*(r-n),0)}function Be(e,t){let n=e.length;if(n===0)return 0;let o=t?n-1:n;return o<=0?0:Lr(e)/o}var uu={0:e=>{let t=e[0].toNumber();return t>=0?chunkO5ZLOZPH_cjs.n(Math.sqrt(t)):w(chunkUBKWHRFL_cjs.s("sqrt",[chunkUBKWHRFL_cjs.p(t)]))},1:e=>e[0].type===7?chunkUBKWHRFL_cjs.ca(e[0].value):Ue(e[0],Math.abs(e[0].toNumber())),2:e=>chunkO5ZLOZPH_cjs.n(Math.sin(ft(e[0]))),3:e=>chunkO5ZLOZPH_cjs.n(Math.cos(ft(e[0]))),4:e=>chunkO5ZLOZPH_cjs.n(Math.tan(ft(e[0]))),5:e=>chunkO5ZLOZPH_cjs.n(Math.log(e[0].toNumber())),6:e=>Ue(e[0],Math.ceil(e[0].toNumber())),7:e=>Ue(e[0],Math.floor(e[0].toNumber())),8:e=>e.length>=2?Gn(e[0],e[1].toNumber()):Ue(e[0],Math.round(e[0].toNumber())),9:e=>Yn(e,false),10:e=>Yn(e,true),11:e=>chunkO5ZLOZPH_cjs.n(Math.asin(e[0].toNumber())),12:e=>chunkO5ZLOZPH_cjs.n(Math.acos(e[0].toNumber())),13:e=>chunkO5ZLOZPH_cjs.n(Math.atan(e[0].toNumber())),14:e=>chunkO5ZLOZPH_cjs.n(Math.atan2(e[0].toNumber(),e[1].toNumber())),15:e=>chunkO5ZLOZPH_cjs.n(Math.sinh(e[0].toNumber())),16:e=>chunkO5ZLOZPH_cjs.n(Math.cosh(e[0].toNumber())),17:e=>chunkO5ZLOZPH_cjs.n(Math.tanh(e[0].toNumber())),18:e=>chunkO5ZLOZPH_cjs.n(Math.asinh(e[0].toNumber())),19:e=>chunkO5ZLOZPH_cjs.n(Math.acosh(e[0].toNumber())),20:e=>chunkO5ZLOZPH_cjs.n(Math.atanh(e[0].toNumber())),21:e=>chunkO5ZLOZPH_cjs.n(Math.cbrt(e[0].toNumber())),22:e=>chunkO5ZLOZPH_cjs.n(Math.clz32(e[0].toNumber())),23:e=>chunkO5ZLOZPH_cjs.n(Math.expm1(e[0].toNumber())),24:e=>chunkO5ZLOZPH_cjs.n(Math.exp(e[0].toNumber())),25:e=>chunkO5ZLOZPH_cjs.n(Math.fround(e[0].toNumber())),26:e=>chunkO5ZLOZPH_cjs.n(Math.hypot(...e.map(t=>t.toNumber()))),27:e=>chunkO5ZLOZPH_cjs.n(Math.imul(e[0].toNumber(),e[1].toNumber())),28:e=>chunkO5ZLOZPH_cjs.n(Math.log10(e[0].toNumber())),29:e=>chunkO5ZLOZPH_cjs.n(Math.log1p(e[0].toNumber())),30:e=>chunkO5ZLOZPH_cjs.n(Math.log2(e[0].toNumber())),31:e=>e[0].type===7?e[1].type!==0?chunkO5ZLOZPH_cjs.P("MATRIX_POWER_UNSUPPORTED",`pow: a matrix's exponent must be a whole number, as in "pow([1,2;3,4], 2)".`):chunkUBKWHRFL_cjs.$(e[0].value,e[1].value):e[1].type===7?chunkO5ZLOZPH_cjs.P("MATRIX_POWER_UNSUPPORTED",'pow: a matrix may only be the base, as in "pow([1,2;3,4], 2)".'):chunkO5ZLOZPH_cjs.n(nt(e[0].toNumber(),e[1].toNumber())),32:()=>chunkO5ZLOZPH_cjs.n(Math.random()),33:e=>chunkO5ZLOZPH_cjs.n(Math.sign(e[0].toNumber())),34:e=>chunkO5ZLOZPH_cjs.n(Math.trunc(e[0].toNumber())),35:e=>chunkO5ZLOZPH_cjs.n(e[0].toNumber()*Math.PI/180),36:e=>chunkO5ZLOZPH_cjs.n(e[0].toNumber()*180/Math.PI),37:e=>{let t=e[0].toNumber(),n=e[1].toNumber();return t>n?chunkO5ZLOZPH_cjs.P("INVALID_RANGE",`roll: invalid range, ${t} is greater than ${n}`):chunkO5ZLOZPH_cjs.n(Math.floor(Math.random()*(n-t+1))+t)},38:e=>{let t=Math.trunc(Math.abs(e[0].toNumber())),n=Math.trunc(Math.abs(e[1].toNumber())),o=jn(t,n,"gcd");return o||chunkO5ZLOZPH_cjs.n(Kn(t,n))},39:e=>{let t=Math.trunc(Math.abs(e[0].toNumber())),n=Math.trunc(Math.abs(e[1].toNumber())),o=jn(t,n,"lcm");return o||(t===0||n===0?chunkO5ZLOZPH_cjs.n(0):chunkO5ZLOZPH_cjs.n(t/Kn(t,n)*n))},40:e=>{let t=Math.trunc(e[0].toNumber()),n=Math.trunc(e[1].toNumber());if(t<0||n<0||n>t)return chunkO5ZLOZPH_cjs.P("INVALID_RANGE",`permutation: invalid n=${t}, r=${n} (require 0 <= r <= n)`);let o=1;for(let r=0;r<n;r++)if(o*=t-r,!Number.isFinite(o))return chunkO5ZLOZPH_cjs.P("PERMUTATION_OVERFLOW",`permutation: P(${t}, ${n}) exceeds the maximum representable double (it passed it after ${r+1} of ${n} factors)`);return chunkO5ZLOZPH_cjs.n(o)},41:e=>{let t=Math.trunc(e[0].toNumber()),n=Math.trunc(e[1].toNumber());if(t<0||n<0||n>t)return chunkO5ZLOZPH_cjs.P("INVALID_RANGE",`combination: invalid n=${t}, r=${n} (require 0 <= r <= n)`);let o=Math.min(n,t-n),r=1;for(let i=0;i<o;i++)if(r=r*(t-i)/(i+1),!Number.isFinite(r))return chunkO5ZLOZPH_cjs.P("COMBINATION_OVERFLOW",`combination: C(${t}, ${n}) exceeds the maximum representable double (it passed it after ${i+1} of ${o} steps)`);return chunkO5ZLOZPH_cjs.n(Math.round(r))},42:e=>{if(e.length===0)return chunkO5ZLOZPH_cjs.n(0);let t=e.reduce((n,o)=>n+o.toNumber(),0);return chunkO5ZLOZPH_cjs.n(t/e.length)},43:e=>{if(e.length===0)return chunkO5ZLOZPH_cjs.n(0);let t=e.map(o=>o.toNumber()).sort((o,r)=>o-r),n=Math.floor(t.length/2);return chunkO5ZLOZPH_cjs.n(t.length%2===0?(t[n-1]+t[n])/2:t[n])},44:e=>chunkO5ZLOZPH_cjs.n(e.reduce((t,n)=>t+n.toNumber(),0)),45:e=>chunkO5ZLOZPH_cjs.n(e.length),46:e=>{let[t,n,o]=e,{lv:r,rv:i}=he(t,n);if(r===0)return chunkO5ZLOZPH_cjs.P("PROPORTION_DIVIDE_BY_ZERO",`Cannot compute proportion: "${t.value}" is zero`);let a=o.toNumber()*(i/r);return o.type===6?chunkO5ZLOZPH_cjs.u(a,o.unit):chunkO5ZLOZPH_cjs.n(a)},47:e=>{let t=e[0].toNumber(),n=e[1].toNumber(),o=e[2].toNumber();return n>o?chunkO5ZLOZPH_cjs.P("INVALID_RANGE",`clamp: invalid range, ${n} is greater than ${o}`):chunkO5ZLOZPH_cjs.n(Math.min(Math.max(t,n),o))},48:e=>chunkO5ZLOZPH_cjs.r(e[0].toNumber()),49:e=>chunkO5ZLOZPH_cjs.r(e[0].toNumber(),"bin"),50:e=>chunkO5ZLOZPH_cjs.n(Math.trunc(e[0].toNumber())),51:e=>{let t=e[0].toNumber(),n=e[1].toNumber(),o=e[2].toNumber();if(1+n<=0)return chunkO5ZLOZPH_cjs.P("INVALID_RATE",`compoundInterest: rate ${n} makes (1 + rate) non-positive`);let r=t*Math.pow(1+n,o);return e[0].type===6?chunkO5ZLOZPH_cjs.u(r,e[0].unit):chunkO5ZLOZPH_cjs.n(r)},52:e=>{let t=e[0].toNumber(),n=e[1].toNumber(),o=e[2].toNumber();if(1+n<=0)return chunkO5ZLOZPH_cjs.P("INVALID_RATE",`interestEarned: rate ${n} makes (1 + rate) non-positive`);let r=t*(Math.pow(1+n,o)-1);return e[0].type===6?chunkO5ZLOZPH_cjs.u(r,e[0].unit):chunkO5ZLOZPH_cjs.n(r)},53:e=>{let t=e[0].toNumber(),n=e[1].toNumber(),o=e[2].toNumber();return t<=0||n<=0?chunkO5ZLOZPH_cjs.P("INVALID_RANGE","compoundInterestRate: principal and futureValue must both be positive"):o<=0?chunkO5ZLOZPH_cjs.P("INVALID_RANGE","compoundInterestRate: years must be greater than 0"):chunkO5ZLOZPH_cjs.n(Math.pow(n/t,1/o)-1)},54:e=>{let t=e[0].toNumber(),n=e[1].toNumber(),o=e[2].toNumber();return t<=0||n<=0?chunkO5ZLOZPH_cjs.P("INVALID_RANGE","compoundInterestYears: principal and futureValue must both be positive"):1+o<=0||o===0?chunkO5ZLOZPH_cjs.P("INVALID_RATE",`compoundInterestYears: rate ${o} is not usable (must be > -1 and not 0)`):chunkO5ZLOZPH_cjs.n(Math.log(n/t)/Math.log(1+o))},55:e=>{let t=e[0].toNumber(),n=e[1].toNumber(),o=e[2].toNumber(),r=e[3].toNumber();if(t<=0)return chunkO5ZLOZPH_cjs.P("INVALID_RANGE","loanRepayment: principal must be positive");if(o<=0)return chunkO5ZLOZPH_cjs.P("INVALID_RANGE","loanRepayment: years must be positive");if(n<0)return chunkO5ZLOZPH_cjs.P("INVALID_RATE","loanRepayment: rate must not be negative");if(r<0)return chunkO5ZLOZPH_cjs.P("INVALID_RANGE","loanRepayment: periodsPerYear must not be negative");let{totalRepayment:i}=bt(t,n,o),a=r===0?i:i/(o*r);return e[0].type===6?chunkO5ZLOZPH_cjs.u(a,e[0].unit):chunkO5ZLOZPH_cjs.n(a)},56:e=>{let t=e[0].toNumber(),n=e[1].toNumber(),o=e[2].toNumber(),r=e[3].toNumber();if(t<=0)return chunkO5ZLOZPH_cjs.P("INVALID_RANGE","loanInterest: principal must be positive");if(o<=0)return chunkO5ZLOZPH_cjs.P("INVALID_RANGE","loanInterest: years must be positive");if(n<0)return chunkO5ZLOZPH_cjs.P("INVALID_RATE","loanInterest: rate must not be negative");if(r<0)return chunkO5ZLOZPH_cjs.P("INVALID_RANGE","loanInterest: periodsPerYear must not be negative");let{totalInterest:i}=bt(t,n,o),a=r===0?i:i/(o*r);return e[0].type===6?chunkO5ZLOZPH_cjs.u(a,e[0].unit):chunkO5ZLOZPH_cjs.n(a)},57:e=>{let t=e[0].toNumber(),n=e[1].toNumber(),o=e[2].toNumber();if(t<=0)return chunkO5ZLOZPH_cjs.P("INVALID_RANGE","monthlyPayment: principal must be positive");if(o<=0)return chunkO5ZLOZPH_cjs.P("INVALID_RANGE","monthlyPayment: years must be positive");if(n<0)return chunkO5ZLOZPH_cjs.P("INVALID_RATE","monthlyPayment: rate must not be negative");let{monthlyPayment:r}=bt(t,n,o);return e[0].type===6?chunkO5ZLOZPH_cjs.u(r,e[0].unit):chunkO5ZLOZPH_cjs.n(r)},58:e=>{let t=e[0].toNumber(),n=e[1].toNumber();return e[0].type===6?En(e[0],e[0].unit,n,1):chunkO5ZLOZPH_cjs.n(t*(1+n))},59:e=>{let t=e[0].toNumber(),n=e[1].toNumber();return 1+n<=0?chunkO5ZLOZPH_cjs.P("INVALID_RATE",`taxRemove: rate ${n} makes (1 + rate) non-positive`):e[0].type===6?kn(e[0],e[0].unit,n)??chunkO5ZLOZPH_cjs.u(t/(1+n),e[0].unit):chunkO5ZLOZPH_cjs.n(t/(1+n))},60:e=>{let t=e[0].toNumber(),n=e[1].toNumber(),o=e[2].toNumber(),r=mt(n,o);if(r===void 0)return chunkO5ZLOZPH_cjs.P("INFLATION_YEAR_OUT_OF_RANGE",`inflationAdjust: fromYear ${n} or toYear ${o} is outside the bundled CPI table's range (${Bn}-${qn})`);let i=t*r;return e[0].type===6?chunkO5ZLOZPH_cjs.u(i,e[0].unit):chunkO5ZLOZPH_cjs.n(i)},61:e=>{let t=e[0].toNumber(),n=e[1].toNumber();return chunkO5ZLOZPH_cjs.n(nt(n,1/t))},62:e=>{let t=e[0].toNumber();if(!Number.isInteger(t)||t<0)return chunkO5ZLOZPH_cjs.P("INVALID_FACTORIAL_INPUT",`fact: ${t} is not a non-negative integer`);if(t>170)return chunkO5ZLOZPH_cjs.P("FACTORIAL_OVERFLOW",`fact: ${t}! exceeds the maximum representable double (170! is the largest finite factorial)`);let n=1;for(let o=2;o<=t;o++)n*=o;return chunkO5ZLOZPH_cjs.n(n)},63:e=>e[0].type===7?chunkUBKWHRFL_cjs.ba(e[0].value):e[0],64:e=>e[0].type===7?chunkUBKWHRFL_cjs.ca(e[0].value):chunkO5ZLOZPH_cjs.n(e[0].toNumber()),65:e=>e[0].type===7?chunkUBKWHRFL_cjs.da(e[0].value):chunkO5ZLOZPH_cjs.n(1/e[0].toNumber()),66:e=>{let[t,n]=e;if(t.type===0&&n.type===0)return chunkO5ZLOZPH_cjs.n(t.toNumber()*n.toNumber());let o=r=>r.type===7?r.value:{rows:1,cols:1,data:[r.toNumber()],hasSymbolic:false};return chunkUBKWHRFL_cjs._(o(t),o(n))},67:e=>{let[t]=e;return t.type!==9?t:w(chunkUBKWHRFL_cjs.F(t.value))},68:e=>{let[t]=e;return t.type!==9?t:w(nn(t.value))},69:e=>{let[t,n,o]=e;return o?.type!==3?chunkO5ZLOZPH_cjs.P("SOLVE_REQUIRES_VARIABLE_NAME","solve's second argument must be the name of the unknown."):yn(t,n,o.value)},70:e=>{let[t,n,o]=e,r=pt(n,"der");if(typeof r!="string")return r;let i=V(t);return i===null?chunkO5ZLOZPH_cjs.P("SYMBOLIC_NONFINITE_OPERAND","der needs an expression with an exact value."):w(Ae(i,r,o?.toNumber()??1))},71:e=>{let[t,n]=e,o=pt(n,"integral");if(typeof o!="string")return o;let r=V(t);if(r===null)return chunkO5ZLOZPH_cjs.P("SYMBOLIC_NONFINITE_OPERAND","integral needs an expression with an exact value.");let i=xe(r,o);return i.ok?w(i.value):chunkO5ZLOZPH_cjs.P("SYMBOLIC_INTEGRAL_UNSUPPORTED",`Cannot integrate this: ${i.reason}.`)},72:e=>{let[t,n,o,r]=e,i=pt(n,"taylor");if(typeof i!="string")return i;let a=V(t),u=V(o);return a===null||u===null||u.kind!=="const"?chunkO5ZLOZPH_cjs.P("SYMBOLIC_NONFINITE_OPERAND","taylor needs an expression and an exact expansion point."):w(Pn(a,i,u.value,r.toNumber()))},73:e=>{let t=[];for(let a of e){let u=V(a);if(u===null)return chunkO5ZLOZPH_cjs.P("SYMBOLIC_NONFINITE_OPERAND","jacobian needs expressions with exact values.");t.push(u);}let n=new Set;for(let a of t)for(let u of chunkUBKWHRFL_cjs.u(a))n.add(u);let o=[...n].sort();if(o.length===0)return chunkO5ZLOZPH_cjs.P("SYMBOLIC_JACOBIAN_NO_VARIABLES","jacobian needs at least one unknown to differentiate against.");let r=Ln(t,o),i=[];for(let a of r)for(let u of a)i.push(chunkUBKWHRFL_cjs.W(u));return chunkO5ZLOZPH_cjs.C(r.length,o.length,chunkUBKWHRFL_cjs.Y(r.length,o.length,i))},74:e=>w(chunkUBKWHRFL_cjs.w(chunkUBKWHRFL_cjs.o(chunkUBKWHRFL_cjs.a,chunkUBKWHRFL_cjs.d(e[0].toNumber())))),75:e=>dt("conj",e[0]),76:e=>dt("re",e[0]),77:e=>dt("im",e[0]),78:e=>{let t=e[0];return t.type!==9?t:w(chunkUBKWHRFL_cjs.J(t.value))},79:e=>{let t=e[0];return t.type!==9?t:w(wn(t.value))},85:e=>{let t=e[0].toNumber(),n=e[1].toNumber();if(1+n<=0)return chunkO5ZLOZPH_cjs.P("INVALID_RATE",`taxIn: rate ${n} makes (1 + rate) non-positive`);let o=t-t/(1+n);return e[0].type===6?_n(e[0],e[0].unit,n)??chunkO5ZLOZPH_cjs.u(o,e[0].unit):chunkO5ZLOZPH_cjs.n(o)},86:e=>{let t=e[0].toNumber(),n=e[1].toNumber();return e[0].type===6?In(e[0],n,e[0].unit):chunkO5ZLOZPH_cjs.n(t*n)},87:e=>chunkO5ZLOZPH_cjs.n(Math.sin(e[0].toNumber()*Math.PI/180)),88:e=>chunkO5ZLOZPH_cjs.n(Math.cos(e[0].toNumber()*Math.PI/180)),89:e=>chunkO5ZLOZPH_cjs.n(Math.tan(e[0].toNumber()*Math.PI/180)),90:e=>chunkO5ZLOZPH_cjs.n(Math.asin(e[0].toNumber())*180/Math.PI),91:e=>chunkO5ZLOZPH_cjs.n(Math.acos(e[0].toNumber())*180/Math.PI),92:e=>chunkO5ZLOZPH_cjs.n(Math.atan(e[0].toNumber())*180/Math.PI),93:e=>chunkO5ZLOZPH_cjs.u(e[0].toNumber(),"days"),94:e=>{let t=typeof e[1]?.value=="string"?e[1].value:void 0,n=typeof e[2]?.value=="string"?e[2].value:void 0;if(t===void 0||n===void 0)return chunkO5ZLOZPH_cjs.P("UNKNOWN_UNIT",'both units have to be named, as in "12.5 minutes in minutes and seconds"');let o=chunkEZKR44MA_cjs.a[t.toLowerCase()],r=chunkEZKR44MA_cjs.a[n.toLowerCase()];if(o===void 0||r===void 0)return chunkO5ZLOZPH_cjs.P("UNKNOWN_UNIT",`${t} and ${n}: one of these is not a unit`);if(o[0]!==r[0])return chunkO5ZLOZPH_cjs.P("INCOMPATIBLE_UNITS",`${t} and ${n} measure different things`);if(r[1]>=o[1])return chunkO5ZLOZPH_cjs.P("INCOMPATIBLE_UNITS",`${t} and ${n}: name the larger unit first`);let i=e[0],a=i.type===6&&i.unit!==void 0?chunkEZKR44MA_cjs.a[i.unit.toLowerCase()]:void 0,u=i.toNumber()*(a?.[1]??o[1]),l=Math.floor(u/o[1]),s=Math.round((u-l*o[1])/r[1]*1e3)/1e3;return chunkO5ZLOZPH_cjs.t(`${l} ${t} ${s} ${n}`)},95:e=>{let t=e[0],n=String(e[1].value),o=t.type===6&&t.unit!==void 0?t.unit:"";return o.includes("/")?chunkO5ZLOZPH_cjs.P("INVALID_RATE_UNIT",`${o}/${n}: that is already a rate`):chunkO5ZLOZPH_cjs.u(t.toNumber(),`${o}/${n}`)},96:e=>{let t=e[0],n=e[1];if(n.type===6&&t.type===6&&chunkZKFCKAIX_cjs.i(n.unit)){let s=chunkZKFCKAIX_cjs.j(t.toNumber(),t.unit,n.toNumber(),n.unit);if(s!==null)return Cr(s)}if(n.type!==6||n.unit===void 0||!n.unit.includes("/"))return chunkO5ZLOZPH_cjs.P("INVALID_RATE",'at: the right-hand side has to be a rate, as in "$30/hour"');let o=n.unit.indexOf("/"),r=n.unit.slice(0,o),i=n.unit.slice(o+1),a=t.type===6?t.unit:void 0,u=chunkEZKR44MA_cjs.a[i.toLowerCase()],l=a===void 0?void 0:chunkEZKR44MA_cjs.a[a.toLowerCase()];if(l!==void 0&&u!==void 0&&l[0]===u[0]){let p=t.toNumber()*l[1]/u[1]*n.toNumber();return r===""?chunkO5ZLOZPH_cjs.n(p):chunkO5ZLOZPH_cjs.u(p,r)}if(a!==void 0&&a===r){let s=t.toNumber()/n.toNumber();return chunkO5ZLOZPH_cjs.u(s,Pr(i,s))}if(a===void 0){let s=t.toNumber()*n.toNumber();return r===""?chunkO5ZLOZPH_cjs.n(s):chunkO5ZLOZPH_cjs.u(s,r)}return chunkO5ZLOZPH_cjs.P("INCOMPATIBLE_UNITS",`at: ${a} matches neither side of ${n.unit}`)},80:e=>{let t=e[0].toNumber(),n=e[1].toNumber(),o=e[2].toNumber(),r=e[3].toNumber();if(r<=0)return chunkO5ZLOZPH_cjs.P("INVALID_RATE",`compounding: ${r} periods per year is not a period`);if(1+n/r<=0)return chunkO5ZLOZPH_cjs.P("INVALID_RATE",`compounding: rate ${n} makes each period non-positive`);let i=t*Math.pow(1+n/r,r*o);return e[0].type===6?chunkO5ZLOZPH_cjs.u(i,e[0].unit):chunkO5ZLOZPH_cjs.n(i)},81:e=>{let t=e[0].toNumber(),n=e[1].toNumber(),o=e[2].toNumber(),r=e[3].toNumber();if(r<=0||1+n/r<=0)return chunkO5ZLOZPH_cjs.P("INVALID_RATE",`compounding: rate ${n} over ${r} periods per year is not usable`);let i=t*(Math.pow(1+n/r,r*o)-1);return e[0].type===6?chunkO5ZLOZPH_cjs.u(i,e[0].unit):chunkO5ZLOZPH_cjs.n(i)},82:e=>{let t=e[0].toNumber(),n=e[1].toNumber(),o=e[2].toNumber();if(1+n<=0)return chunkO5ZLOZPH_cjs.P("INVALID_RATE",`presentValue: rate ${n} makes (1 + rate) non-positive`);let r=t/Math.pow(1+n,o);return e[0].type===6?chunkO5ZLOZPH_cjs.u(r,e[0].unit):chunkO5ZLOZPH_cjs.n(r)},83:e=>{let t=e[0].toNumber(),n=e[1].toNumber();return t===0?chunkO5ZLOZPH_cjs.P("INVALID_RATE","roi: nothing was invested, so there is no return on it"):chunkO5ZLOZPH_cjs.n((n-t)/t)},84:e=>{let t=e[0].toNumber(),n=e[1].toNumber(),o=e[2].toNumber();return t<=0?chunkO5ZLOZPH_cjs.P("INVALID_RATE","annual return: the amount invested must be positive"):o<=0?chunkO5ZLOZPH_cjs.P("INVALID_RATE","annual return: the period must be longer than zero"):n<=0?chunkO5ZLOZPH_cjs.P("INVALID_RATE","annual return: nothing was returned, so there is no annual rate"):chunkO5ZLOZPH_cjs.N(Math.pow(n/t,1/o)-1)},97:e=>Gn(e[0],e[1].toNumber()),98:e=>{let t=e[1].toNumber();return !Number.isInteger(t)||t<1?chunkO5ZLOZPH_cjs.P("INVALID_RANGE",`split: the number of shares must be a whole number of at least 1, not ${e[1].toNumber()}.`):chunkO5ZLOZPH_cjs.H(Tn(e[0],t))},99:e=>{let t=e[0].toNumber(),n=Fr(e[1]),o=e[2].toNumber();if(n===null)return chunkO5ZLOZPH_cjs.P("INVALID_RANGE",'savings goal: the duration must be in months or years, e.g. "in 2 years".');if(t<=0)return chunkO5ZLOZPH_cjs.P("INVALID_RANGE","savings goal: the target must be positive.");if(n<=0)return chunkO5ZLOZPH_cjs.P("INVALID_RANGE","savings goal: the duration must be positive.");if(o<0)return chunkO5ZLOZPH_cjs.P("INVALID_RATE","savings goal: the rate must not be negative.");let r=Ur(t,o/12,n);return e[0].type===6?chunkO5ZLOZPH_cjs.u(r,e[0].unit):chunkO5ZLOZPH_cjs.n(r)},100:e=>{let t=e[0].toNumber(),n=e[1].toNumber(),o=e[2].toNumber(),r=e[3].toNumber(),i=typeof e[4]?.value=="string"?e[4].value:"periods";if(t<=0)return chunkO5ZLOZPH_cjs.P("INVALID_RANGE","savings goal: the target must be positive.");if(n<=0)return chunkO5ZLOZPH_cjs.P("INVALID_RANGE","savings goal: the contribution must be positive.");if(r<0)return chunkO5ZLOZPH_cjs.P("INVALID_RATE","savings goal: the rate must not be negative.");let a=$r(t,n,r/o);return chunkO5ZLOZPH_cjs.u(a,i)},101:e=>chunkO5ZLOZPH_cjs.n(Math.sqrt(Be(e.map(t=>t.toNumber()),false))),102:e=>chunkO5ZLOZPH_cjs.n(Math.sqrt(Be(e.map(t=>t.toNumber()),true))),103:e=>chunkO5ZLOZPH_cjs.n(Be(e.map(t=>t.toNumber()),false)),104:e=>chunkO5ZLOZPH_cjs.n(Be(e.map(t=>t.toNumber()),true)),105:e=>{if(e.length===0)return chunkO5ZLOZPH_cjs.n(0);let t=e.map(n=>n.toNumber());return chunkO5ZLOZPH_cjs.n(Math.max(...t)-Math.min(...t))},106:e=>{if(e.length===0)return chunkO5ZLOZPH_cjs.n(0);let t=new Map,n=e[0].toNumber(),o=0;for(let r of e){let i=r.toNumber(),a=(t.get(i)??0)+1;t.set(i,a),a>o&&(o=a,n=i);}return chunkO5ZLOZPH_cjs.n(n)},107:e=>{let t=0,n=0;for(let o=0;o+1<e.length;o+=2){let r=e[o].toNumber(),i=e[o+1].toNumber();t+=r*i,n+=i;}return n===0?chunkO5ZLOZPH_cjs.P("WEIGHTED_AVERAGE_ZERO_WEIGHT","weighted average: the weights sum to zero, so there is nothing to divide by"):chunkO5ZLOZPH_cjs.n(t/n)}};function Fr(e){if(e.type!==6)return null;let t=e.unit;return t==="months"||t==="month"?e.toNumber():t==="years"||t==="year"?e.toNumber()*12:null}function Ur(e,t,n){return t===0?e/n:e*t/(Math.pow(1+t,n)-1)}function $r(e,t,n){let o=n===0?e/t:Math.log(1+e*n/t)/Math.log(1+n);return Math.ceil(o-1e-9)}function dt(e,t){let n=V(t);return n===null?chunkO5ZLOZPH_cjs.P("SYMBOLIC_NONFINITE_OPERAND",e+" needs a value with an exact number."):w(chunkUBKWHRFL_cjs.s(e,[n]))}function pt(e,t){return e?.type!==3?chunkO5ZLOZPH_cjs.P("SYMBOLIC_REQUIRES_VARIABLE_NAME",`${t} needs the name of an unknown.`):e.value}function bt(e,t,n){let o=n*12,r=t/12,i=r===0?e/o:e*r/(1-Math.pow(1+r,-o)),a=i*o,u=a-e;return {monthlyPayment:i,totalRepayment:a,totalInterest:u}}var lu=Un.pluginFunctions,Xn=65535,Zn=0;function Br(){if(Zn>Xn)throw chunkHTAT4MGN_cjs.c.config("PLUGIN_FUNCTION_INDEX_POOL_EXHAUSTED",`allocatePluginFunctionIndex: pool exhausted (max ${Xn+1} allocations).`);return Zn++}var Hn=new Map;function su(e){let t=Hn.get(e);return t===void 0&&(t=Br(),Hn.set(e,t)),t}var yt=new Map;function cu(e,t){let n=e.toLowerCase(),o=yt.get(n);o&&o!==t&&console.warn(`[asConverterRegistry] Converter name "${n}" is already registered \u2014 overwriting.`),yt.set(n,t);}function mu(e){yt.delete(e.toLowerCase());}var qe=class qe{constructor(){this.values=new Map;this.listeners=new Set;this.notifyDepth=0;}get(t){return this.values.get(t)}has(t){return this.values.has(t)}set(t,n){let o=this.values.get(t);this.values.set(t,n),!(o!==void 0&&qr(o,n))&&this.notify(t,n);}notify(t,n){if(!(this.notifyDepth>=qe.MAX_NOTIFY_DEPTH)){this.notifyDepth++;try{for(let o of this.listeners)o(t,n);}finally{this.notifyDepth--;}}}subscribe(t){return this.listeners.add(t),()=>{this.listeners.delete(t);}}clear(){this.values.clear(),this.listeners.clear(),this.notifyDepth=0;}};qe.MAX_NOTIFY_DEPTH=64;var ht=qe;function qr(e,t){if(e.type!==t.type||e.unit!==t.unit||(e.timedOut??false)!==(t.timedOut??false))return false;let n=e.value,o=t.value;if(Array.isArray(n)||Array.isArray(o)){if(!Array.isArray(n)||!Array.isArray(o)||n.length!==o.length)return false;for(let r=0;r<n.length;r++)if(!Object.is(n[r],o[r]))return false;return true}return Object.is(n,o)}var du=new ht;function pu(e){return `global:${e}`}var Yr={sydney:"Australia/Sydney",melbourne:"Australia/Melbourne",brisbane:"Australia/Brisbane",perth:"Australia/Perth",adelaide:"Australia/Adelaide",canberra:"Australia/Sydney",auckland:"Pacific/Auckland",wellington:"Pacific/Auckland",fiji:"Pacific/Fiji",chicago:"America/Chicago",seattle:"America/Los_Angeles",denver:"America/Denver",phoenix:"America/Phoenix",toronto:"America/Toronto",montreal:"America/Toronto",vancouver:"America/Vancouver",ottawa:"America/Toronto",honolulu:"Pacific/Honolulu",anchorage:"America/Anchorage",miami:"America/New_York",boston:"America/New_York",atlanta:"America/New_York",dallas:"America/Chicago",houston:"America/Chicago",lima:"America/Lima",bogota:"America/Bogota",caracas:"America/Caracas",santiago:"America/Santiago",montevideo:"America/Montevideo",quito:"America/Guayaquil",london:"Europe/London",paris:"Europe/Paris",berlin:"Europe/Berlin",madrid:"Europe/Madrid",rome:"Europe/Rome",amsterdam:"Europe/Amsterdam",dublin:"Europe/Dublin",lisbon:"Europe/Lisbon",vienna:"Europe/Vienna",zurich:"Europe/Zurich",geneva:"Europe/Zurich",moscow:"Europe/Moscow",istanbul:"Europe/Istanbul",athens:"Europe/Athens",stockholm:"Europe/Stockholm",oslo:"Europe/Oslo",helsinki:"Europe/Helsinki",warsaw:"Europe/Warsaw",prague:"Europe/Prague",budapest:"Europe/Budapest",brussels:"Europe/Brussels",copenhagen:"Europe/Copenhagen",reykjavik:"Atlantic/Reykjavik",kiev:"Europe/Kyiv",kyiv:"Europe/Kyiv",tokyo:"Asia/Tokyo",osaka:"Asia/Tokyo",beijing:"Asia/Shanghai",shanghai:"Asia/Shanghai",seoul:"Asia/Seoul",singapore:"Asia/Singapore",bangkok:"Asia/Bangkok",jakarta:"Asia/Jakarta",manila:"Asia/Manila",mumbai:"Asia/Kolkata",delhi:"Asia/Kolkata",bangalore:"Asia/Kolkata",dubai:"Asia/Dubai",abudhabi:"Asia/Dubai",karachi:"Asia/Karachi",dhaka:"Asia/Dhaka",hanoi:"Asia/Ho_Chi_Minh",taipei:"Asia/Taipei",islamabad:"Asia/Karachi",riyadh:"Asia/Riyadh",telaviv:"Asia/Jerusalem",jerusalem:"Asia/Jerusalem",cairo:"Africa/Cairo",lagos:"Africa/Lagos",nairobi:"Africa/Nairobi",johannesburg:"Africa/Johannesburg",casablanca:"Africa/Casablanca",accra:"Africa/Accra",tunis:"Africa/Tunis",addisababa:"Africa/Addis_Ababa",france:"Europe/Paris",germany:"Europe/Berlin",spain:"Europe/Madrid",italy:"Europe/Rome",japan:"Asia/Tokyo",china:"Asia/Shanghai",india:"Asia/Kolkata",brazil:"America/Sao_Paulo",russia:"Europe/Moscow",australia:"Australia/Sydney",canada:"America/Toronto",mexico:"America/Mexico_City",uk:"Europe/London",usa:"America/New_York",ireland:"Europe/Dublin",netherlands:"Europe/Amsterdam",sweden:"Europe/Stockholm",norway:"Europe/Oslo",poland:"Europe/Warsaw",turkey:"Europe/Istanbul",egypt:"Africa/Cairo",nigeria:"Africa/Lagos"},Gr={"new york":"America/New_York","los angeles":"America/Los_Angeles","san francisco":"America/Los_Angeles","las vegas":"America/Los_Angeles","mexico city":"America/Mexico_City","hong kong":"Asia/Hong_Kong","kuala lumpur":"Asia/Kuala_Lumpur","sao paulo":"America/Sao_Paulo","buenos aires":"America/Argentina/Buenos_Aires","rio de janeiro":"America/Sao_Paulo","cape town":"Africa/Johannesburg","new delhi":"Asia/Kolkata","united kingdom":"Europe/London","united states":"America/New_York","south africa":"Africa/Johannesburg"},jr={pst:"America/Los_Angeles",pdt:"America/Los_Angeles",est:"America/New_York",edt:"America/New_York",cst:"America/Chicago",cdt:"America/Chicago",mst:"America/Denver",mdt:"America/Denver",hst:"Pacific/Honolulu",bst:"Europe/London",cet:"Europe/Paris",cest:"Europe/Paris",jst:"Asia/Tokyo",ist:"Asia/Kolkata",aest:"Australia/Sydney",aedt:"Australia/Sydney"},Kr={...Yr,...Gr,...jr};function yu(e){let t=e.trim().toLowerCase();return t==="utc"||t==="gmt"?"UTC":Kr[t]??null}exports.A=qn;exports.B=Fa;exports.C=uu;exports.D=lu;exports.E=Br;exports.F=su;exports.G=yt;exports.H=cu;exports.I=mu;exports.J=du;exports.K=pu;exports.L=Gr;exports.M=Kr;exports.N=yu;exports.a=ge;exports.b=In;exports.c=En;exports.d=dn;exports.e=ki;exports.f=_i;exports.g=Ti;exports.h=Vi;exports.i=yn;exports.j=he;exports.k=qi;exports.l=Yi;exports.m=Gi;exports.n=Nn;exports.o=ji;exports.p=Ki;exports.q=nt;exports.r=Xi;exports.s=Zi;exports.t=Hi;exports.u=Wi;exports.v=Ne;exports.w=Ji;exports.x=wr;exports.y=Un;exports.z=Bn;//# sourceMappingURL=chunk-5NQE5JMU.cjs.map
|
|
2
|
+
//# sourceMappingURL=chunk-5NQE5JMU.cjs.map
|