{"version":3,"file":"assign-event-rows.mjs","names":[],"sources":["../../../../src/components/WeekView/get-week-view-events/assign-event-rows.ts"],"sourcesContent":["import { ScheduleEventData, WeekPositionedEventData } from '../../../types';\nimport { isEventsOverlap } from '../../../utils';\n\nexport function assignEventRows(events: WeekPositionedEventData[]): Map<ScheduleEventData, number> {\n  const eventRows = new Map<ScheduleEventData, number>();\n\n  for (const event of events) {\n    let row = 0;\n\n    while (true) {\n      let hasConflict = false;\n\n      for (const [otherEvent, otherRow] of eventRows.entries()) {\n        if (otherRow === row && isEventsOverlap(event, otherEvent)) {\n          hasConflict = true;\n          break;\n        }\n      }\n\n      if (!hasConflict) {\n        break;\n      }\n\n      row++;\n    }\n\n    eventRows.set(event, row);\n  }\n\n  return eventRows;\n}\n"],"mappings":";;;AAGA,SAAgB,gBAAgB,QAAmE;CACjG,MAAM,4BAAY,IAAI,IAA+B;CAErD,KAAK,MAAM,SAAS,QAAQ;EAC1B,IAAI,MAAM;EAEV,OAAO,MAAM;GACX,IAAI,cAAc;GAElB,KAAK,MAAM,CAAC,YAAY,aAAa,UAAU,QAAQ,GACrD,IAAI,aAAa,OAAO,gBAAgB,OAAO,UAAU,GAAG;IAC1D,cAAc;IACd;GACF;GAGF,IAAI,CAAC,aACH;GAGF;EACF;EAEA,UAAU,IAAI,OAAO,GAAG;CAC1B;CAEA,OAAO;AACT"}