{"version":3,"file":"calculatePositionSpecifier.cjs","sources":["../../../../src/core/mixins/utils/calculatePositionSpecifier.ts"],"sourcesContent":["import { type PointData, type Size } from 'pixi.js';\nimport { type ComputedLayout, type NumberValue, type PositionKeyword, type PositionSpecifier } from '../../types';\nimport { calculateWithDoubleValue } from './position/calculateWithDoubleValue';\nimport { calculateWithQuadValue } from './position/calculateWithQuadValue';\nimport { calculateWithSingleValue } from './position/calculateWithSingleValue';\n\n/**\n * Represents a single position token which can be either a numeric value or a keyword\n * Examples: \"center\", \"left\", \"50%\", \"10px\"\n */\nexport type ObjectPositionValue = NumberValue | PositionKeyword;\n\n/**\n * Calculates the position of content within its bounds based on PositionSpecifier value\n * Implements CSS-like object-position/transform-origin behavior for flexible content positioning\n *\n * The function supports multiple formats:\n * - Single value: \"center\", \"top\", \"50%\"\n * - Double value: \"top left\", \"center 20%\", \"10px 30px\"\n * - Quad value: \"top 10px right 20%\"\n *\n * @param value - The value from layout style\n * @param computedLayout - The computed layout dimensions from Yoga\n * @param visualBounds - The visual bounds of the content being positioned\n * @returns Calculated x,y coordinates for content positioning\n */\nexport function calculatePositionSpecifier(\n    value: PositionSpecifier | undefined,\n    computedLayout: ComputedLayout,\n    visualBounds: Size,\n): PointData {\n    if (!value) return { x: 0, y: 0 };\n\n    const tokens: PositionSpecifier[] =\n        typeof value === 'string' ? (value.split(' ') as PositionSpecifier[]) : ([value] as PositionSpecifier[]);\n\n    switch (tokens.length) {\n        case 1:\n            return calculateWithSingleValue(tokens, computedLayout, visualBounds);\n        case 2:\n            return calculateWithDoubleValue(tokens, computedLayout, visualBounds);\n        case 4:\n            return calculateWithQuadValue(tokens, computedLayout, visualBounds);\n        default:\n            throw new Error('Invalid objectPosition value: must have 1, 2, or 4 values');\n    }\n}\n"],"names":["calculateWithSingleValue","calculateWithDoubleValue","calculateWithQuadValue"],"mappings":";;;;;AA0BgB,SAAA,2BACZ,OACA,gBACA,cACS;AACT,MAAI,CAAC,MAAO,QAAO,EAAE,GAAG,GAAG,GAAG,EAAE;AAE1B,QAAA,SACF,OAAO,UAAU,WAAY,MAAM,MAAM,GAAG,IAA6B,CAAC,KAAK;AAEnF,UAAQ,OAAO,QAAQ;AAAA,IACnB,KAAK;AACM,aAAAA,kDAAyB,QAAQ,gBAAgB,YAAY;AAAA,IACxE,KAAK;AACM,aAAAC,kDAAyB,QAAQ,gBAAgB,YAAY;AAAA,IACxE,KAAK;AACM,aAAAC,8CAAuB,QAAQ,gBAAgB,YAAY;AAAA,IACtE;AACU,YAAA,IAAI,MAAM,2DAA2D;AAAA,EAAA;AAEvF;;"}