{"version":3,"file":"bespunky-angular-cdk-timeline-shared.mjs","sources":["../../../../libs/angular-cdk/timeline/shared/src/tools/unfucked-date.ts","../../../../libs/angular-cdk/timeline/shared/src/tools/date-consts.ts","../../../../libs/angular-cdk/timeline/shared/src/tools/date-functions.ts","../../../../libs/angular-cdk/timeline/shared/src/services/location/timeline-location-utils.ts","../../../../libs/angular-cdk/timeline/shared/src/bespunky-angular-cdk-timeline-shared.ts"],"sourcesContent":["import { subYears } from 'date-fns';\n\nexport class UnfuckedDate extends Date\n{\n    constructor(y: number, m: number = 0, d: number = 1, h: number = 0, mm: number = 0, s: number = 0, ms: number = 0)\n    {\n        super(Date.UTC(y, m, d, h, mm, s, ms));\n\n        // If the Date object fucked me with the years, compensate. Otherwise, return the date as created.\n        return 0 <= y && y <= 99 ? subYears(this, 1900) : this;\n    }\n}","import { UnfuckedDate } from './unfucked-date';\n\nexport const MillisecondsInADay       = 24 * 60 * 60 * 1000;\nexport const YearZeroJanuaryFirst     = new UnfuckedDate(0);\nexport const YearZeroJanuaryFirstInMs = YearZeroJanuaryFirst.getTime();\n\n/**\n * The largest value of milliseconds an ECMAScript Date object can work with.\n * See https://262.ecma-international.org/5.1/#sec-15.9.1.1\n */\nexport const MaxDateInMs = 8_640_000_000_000_000;\n/**\n * The lowest value of milliseconds an ECMAScript Date object can work with.\n * See https://262.ecma-international.org/5.1/#sec-15.9.1.1\n */\nexport const MinDateInMs = -MaxDateInMs;","import { MillisecondsInADay, YearZeroJanuaryFirstInMs } from './date-consts';\nimport { UnfuckedDate                                 } from './unfucked-date';\n\nexport function daysSinceYearZero(yOrDate: number | Date, m?: number, d?: number, h?: number, mm?: number, s?: number, ms?: number)\n{\n    const date = yOrDate instanceof Date ? yOrDate : new UnfuckedDate(yOrDate, m, d, h, mm, s, ms);\n\n    return (date.getTime() - YearZeroJanuaryFirstInMs) / MillisecondsInADay;\n}\n","/**\n * Provides functions for orientation on the timeline.\n * \n * These functions take into account that:\n * - All dates and positions are relative to 1/1/0000 00:00, which is pixel 0 of the timeline drawing.\n * - The width (in pixels) of a day is the base unit for positioning and rendering on the timeline.\n * \n * See `TimelineCamera` service for usage within components.\n */\n\nimport { MillisecondsInADay, YearZeroJanuaryFirstInMs, MinDateInMs, MaxDateInMs } from '../../tools/date-consts';\nimport { daysSinceYearZero                                                      } from '../../tools/date-functions';\n\n/**\n * Determines the date that a position on the timeline (in pixels) refers to.\n *\n * @param {number} dayWidth The width (in pixels) of a single day on the timeline.\n * @param {number} position The position for which to calculate the date.\n * @returns {Date} The date corresponding to the position.\n */\nexport function positionToDate(dayWidth: number, position: number): Date\n{\n    let positionInMs = position * MillisecondsInADay / dayWidth + YearZeroJanuaryFirstInMs;\n\n    if      (positionInMs > MaxDateInMs) positionInMs = MaxDateInMs;\n    else if (positionInMs < MinDateInMs) positionInMs = MinDateInMs;\n\n    return new Date(positionInMs);\n}\n\n/**\n * Determines the position on the timeline (in pixels) that corresponds to a specific date.\n *\n * @param {number} dayWidth The width (in pixels) of a single day on the timeline.\n * @param {number} y The year part of the date.\n * @param {number} [m] (Optional) The month part of the date. Default is 0 (January).\n * @param {number} [d] (Optional) The day part of the date. Default is 1.\n * @param {number} [h] (Optional) The hourpart of the date. Default is 0.\n * @param {number} [mm] (Optional) The minute part of the date. Default is 0.\n * @param {number} [s] (Optional) The second part of the date. Default is 0.\n * @param {number} [ms] (Optional) The millisecond part of the date. Default is 0.\n * @returns The position (in pixels) corresponding to the specified date.\n */\nexport function dateToPosition(dayWidth: number, y: number, m?: number, d?: number, h?: number, mm?: number, s?: number, ms?: number): number;\n/**\n * Determines the position on the timeline (in pixels) that corresponds to a specific date.\n *\n * @param {number} dayWidth The width (in pixels) of a single day on the timeline.\n * @param {Date} date The date to convert to position.\n * @returns The position (in pixels) corresponding to the specified date.\n */\nexport function dateToPosition(dayWidth: number, date: Date): number;\n/**\n * Determines the position on the timeline (in pixels) that corresponds to a specific date.\n *\n * @param {number} dayWidth The width (in pixels) of a single day on the timeline.\n * @param {(number | Date)} yOrDate \n * @param {number} [m] (Optional) The month part of the date. Default is 0 (January).\n * @param {number} [d] (Optional) The day part of the date. Default is 1.\n * @param {number} [h] (Optional) The hourpart of the date. Default is 0.\n * @param {number} [mm] (Optional) The minute part of the date. Default is 0.\n * @param {number} [s] (Optional) The second part of the date. Default is 0.\n * @param {number} [ms] (Optional) The millisecond part of the date. Default is 0.\n * @returns The position (in pixels) corresponding to the specified date.\n */\nexport function dateToPosition(\n    dayWidth: number,\n    yOrDate: number | Date, m?: number, d?: number, h?: number, mm?: number, s?: number, ms?: number\n): number;\nexport function dateToPosition(\n    dayWidth: number,\n    yOrDate: number | Date, m?: number, d?: number, h?: number, mm?: number, s?: number, ms?: number\n): number\n{\n    return daysSinceYearZero(yOrDate, m, d, h, mm, s, ms) * dayWidth;\n}\n\nexport function positionToScreenPosition(position: number, viewStart: number): number\n{\n    return position - viewStart;\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;AAEM,MAAO,YAAa,SAAQ,IAAI,CAAA;AAElC,IAAA,WAAA,CAAY,CAAS,EAAE,CAAA,GAAY,CAAC,EAAE,CAAA,GAAY,CAAC,EAAE,CAAA,GAAY,CAAC,EAAE,KAAa,CAAC,EAAE,IAAY,CAAC,EAAE,KAAa,CAAC,EAAA;QAE7G,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC;;QAGvC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC,GAAG,IAAI,CAAC;KAC1D;AACJ;;ACTY,MAAA,kBAAkB,GAAS,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,KAAK;MAC/C,oBAAoB,GAAO,IAAI,YAAY,CAAC,CAAC,EAAE;MAC/C,wBAAwB,GAAG,oBA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