{"version":3,"file":"core-CuZGUfsl.cjs","sources":["../src/core.ts"],"sourcesContent":["export type MarqyDirection = 'left' | 'right' | 'up' | 'down'\n\nexport interface MarqyDimensions {\n  width: number\n  height: number\n}\n\nexport function calcReps(containerSize: number, itemSize: number): number {\n  return itemSize > 0 ? Math.ceil(containerSize / itemSize) : 1\n}\n\nexport function calcAnimationDuration(\n  itemDimension: number,\n  reps: number,\n  speed: number\n): string {\n  return `${((itemDimension ?? 0) * reps) / (100 * speed)}s`\n}\n\nexport function createResizeObserver(\n  node: Element,\n  callback: (dims: MarqyDimensions) => void\n): () => void {\n  const ro = new ResizeObserver(([entry]) =>\n    callback({\n      width: entry.contentRect.width,\n      height: entry.contentRect.height,\n    })\n  )\n  ro.observe(node)\n  return () => ro.disconnect()\n}\n"],"names":["calcReps","containerSize","itemSize","calcAnimationDuration","itemDimension","reps","speed","createResizeObserver","node","callback","ro","entry"],"mappings":"aAOO,SAASA,EAASC,EAAuBC,EAA0B,CACxE,OAAOA,EAAW,EAAI,KAAK,KAAKD,EAAgBC,CAAQ,EAAI,CAC9D,CAEO,SAASC,EACdC,EACAC,EACAC,EACQ,CACR,MAAO,IAAKF,GAAiB,GAAKC,GAAS,IAAMC,EAAM,GACzD,CAEO,SAASC,EACdC,EACAC,EACY,CACZ,MAAMC,EAAK,IAAI,eAAe,CAAC,CAACC,CAAK,IACnCF,EAAS,CACP,MAAOE,EAAM,YAAY,MACzB,OAAQA,EAAM,YAAY,MAAA,CAC3B,CAAA,EAEH,OAAAD,EAAG,QAAQF,CAAI,EACR,IAAME,EAAG,WAAA,CAClB"}