{"version":3,"file":"helpers.mjs","names":["bias","val","c","x","Math","abs","sign","calculateUpdatedOffset","_ref","selectedElement","containerSize","contentSize","isRtl","currentScrollOffset","isHorizontal","clientSize","clientWidth","clientHeight","offsetStart","offsetLeft","offsetTop","adjustedOffsetStart","totalSize","itemOffset","additionalOffset","max","min","calculateCenteredOffset","_ref2","offsetCentered"],"sources":["../../../src/components/VSlideGroup/helpers.ts"],"sourcesContent":["export function bias (val: number) {\n const c = 0.501\n const x = Math.abs(val)\n return Math.sign(val) * (x / ((1 / c - 2) * (1 - x) + 1))\n}\n\nexport function calculateUpdatedOffset ({\n selectedElement,\n containerSize,\n contentSize,\n isRtl,\n currentScrollOffset,\n isHorizontal,\n}: {\n selectedElement: HTMLElement\n containerSize: number\n contentSize: number\n isRtl: boolean\n currentScrollOffset: number\n isHorizontal: boolean\n}): number {\n const clientSize = isHorizontal ? selectedElement.clientWidth : selectedElement.clientHeight\n const offsetStart = isHorizontal ? selectedElement.offsetLeft : selectedElement.offsetTop\n const adjustedOffsetStart = isRtl && isHorizontal ? (contentSize - offsetStart - clientSize) : offsetStart\n\n const totalSize = containerSize + currentScrollOffset\n const itemOffset = clientSize + adjustedOffsetStart\n const additionalOffset = clientSize * 0.4\n\n if (adjustedOffsetStart <= currentScrollOffset) {\n currentScrollOffset = Math.max(adjustedOffsetStart - additionalOffset, 0)\n } else if (totalSize <= itemOffset) {\n currentScrollOffset = Math.min(currentScrollOffset - (totalSize - itemOffset - additionalOffset), contentSize - containerSize)\n }\n\n return currentScrollOffset\n}\n\nexport function calculateCenteredOffset ({\n selectedElement,\n containerSize,\n contentSize,\n isRtl,\n isHorizontal,\n}: {\n selectedElement: HTMLElement\n containerSize: number\n contentSize: number\n isRtl: boolean\n isHorizontal: boolean\n}): number {\n const clientSize = isHorizontal ? selectedElement.clientWidth : selectedElement.clientHeight\n const offsetStart = isHorizontal ? selectedElement.offsetLeft : selectedElement.offsetTop\n\n const offsetCentered = isRtl && isHorizontal\n ? contentSize - offsetStart - clientSize / 2 - containerSize / 2\n : offsetStart + clientSize / 2 - containerSize / 2\n\n return Math.min(contentSize - containerSize, Math.max(0, offsetCentered))\n}\n"],"mappings":"AAAA,OAAO,SAASA,IAAIA,CAAEC,GAAW,EAAE;EACjC,MAAMC,CAAC,GAAG,KAAK;EACf,MAAMC,CAAC,GAAGC,IAAI,CAACC,GAAG,CAACJ,GAAG,CAAC;EACvB,OAAOG,IAAI,CAACE,IAAI,CAACL,GAAG,CAAC,IAAIE,CAAC,IAAI,CAAC,CAAC,GAAGD,CAAC,GAAG,CAAC,KAAK,CAAC,GAAGC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;AAC3D;AAEA,OAAO,SAASI,sBAAsBA,CAAAC,IAAA,EAc3B;EAAA,IAd6B;IACtCC,eAAe;IACfC,aAAa;IACbC,WAAW;IACXC,KAAK;IACLC,mBAAmB;IACnBC;EAQF,CAAC,GAAAN,IAAA;EACC,MAAMO,UAAU,GAAGD,YAAY,GAAGL,eAAe,CAACO,WAAW,GAAGP,eAAe,CAACQ,YAAY;EAC5F,MAAMC,WAAW,GAAGJ,YAAY,GAAGL,eAAe,CAACU,UAAU,GAAGV,eAAe,CAACW,SAAS;EACzF,MAAMC,mBAAmB,GAAGT,KAAK,IAAIE,YAAY,GAAIH,WAAW,GAAGO,WAAW,GAAGH,UAAU,GAAIG,WAAW;EAE1G,MAAMI,SAAS,GAAGZ,aAAa,GAAGG,mBAAmB;EACrD,MAAMU,UAAU,GAAGR,UAAU,GAAGM,mBAAmB;EACnD,MAAMG,gBAAgB,GAAGT,UAAU,GAAG,GAAG;EAEzC,IAAIM,mBAAmB,IAAIR,mBAAmB,EAAE;IAC9CA,mBAAmB,GAAGT,IAAI,CAACqB,GAAG,CAACJ,mBAAmB,GAAGG,gBAAgB,EAAE,CAAC,CAAC;EAC3E,CAAC,MAAM,IAAIF,SAAS,IAAIC,UAAU,EAAE;IAClCV,mBAAmB,GAAGT,IAAI,CAACsB,GAAG,CAACb,mBAA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