{"version":3,"sources":["../src/reducers/activities/sort/property/ReceivedAt.ts","../src/reducers/activities/sort/property/SendStatus.ts"],"sourcesContent":["import { number, object, parse, safeParse, type InferOutput } from 'valibot';\nimport type { Activity } from '../types';\n\nconst ReceivedAtSchema = number();\n\ntype ReceivedAt = InferOutput<typeof ReceivedAtSchema>;\n\nconst ActivityWithReceivedAtSchema = object({\n  channelData: object({\n    'webchat:internal:received-at': ReceivedAtSchema\n  })\n});\n\nfunction getReceivedAtFromActivity(activity: Readonly<Activity>): ReceivedAt {\n  return parse(ActivityWithReceivedAtSchema, activity).channelData['webchat:internal:received-at'];\n}\n\nfunction queryReceivedAtFromActivity(activity: Readonly<Activity>): ReceivedAt | undefined {\n  const result = safeParse(ActivityWithReceivedAtSchema, activity);\n\n  return result.success ? result.output.channelData['webchat:internal:received-at'] : undefined;\n}\n\nfunction setReceivedAtInActivity(activity: Readonly<Activity>, value: ReceivedAt | undefined): Activity {\n  const nextChannelData = { ...activity.channelData };\n\n  if (typeof value === 'undefined') {\n    delete (nextChannelData as any)['webchat:internal:received-at'];\n  } else {\n    nextChannelData['webchat:internal:received-at'] = parse(ReceivedAtSchema, value);\n  }\n\n  return {\n    ...activity,\n    channelData: nextChannelData as any\n  };\n}\n\nexport {\n  getReceivedAtFromActivity,\n  queryReceivedAtFromActivity,\n  ReceivedAtSchema,\n  setReceivedAtInActivity,\n  type ReceivedAt\n};\n","import { object, parse, picklist, safeParse, type InferOutput } from 'valibot';\nimport type { Activity } from '../types';\n\nconst SendStatusSchema = picklist(\n  ['sending', 'send failed', 'sent'],\n  'Send status must be either \"sending\", \"send failed\" or \"sent\"'\n);\n\ntype SendStatus = InferOutput<typeof SendStatusSchema>;\n\nconst OutgoingActivityWithSendStatusSchema = object({\n  channelData: object(\n    {\n      'webchat:send-status': SendStatusSchema\n    },\n    '\"channelData\" must be an object'\n  )\n});\n\nfunction getSendStatusFromOutgoingActivity(activity: Activity): SendStatus {\n  return parse(OutgoingActivityWithSendStatusSchema, activity).channelData['webchat:send-status'];\n}\n\nfunction querySendStatusFromOutgoingActivity(activity: Activity): SendStatus | undefined {\n  const result = safeParse(OutgoingActivityWithSendStatusSchema, activity);\n\n  return result.success ? result.output.channelData['webchat:send-status'] : undefined;\n}\n\nfunction setSendStatusInOutgoingActivity(activity: Activity, value: SendStatus | undefined): Activity {\n  const nextChannelData = { ...activity.channelData };\n\n  if (typeof value === 'undefined') {\n    delete (nextChannelData as any)['webchat:send-status'];\n  } else {\n    nextChannelData['webchat:send-status'] = value;\n  }\n\n  return {\n    ...activity,\n    channelData: nextChannelData as any\n  };\n}\n\nexport {\n  getSendStatusFromOutgoingActivity,\n  querySendStatusFromOutgoingActivity,\n  SendStatusSchema,\n  setSendStatusInOutgoingActivity,\n  type SendStatus\n};\n"],"mappings":"AAAA,OAAS,UAAAA,EAAQ,UAAAC,EAAQ,SAAAC,EAAO,aAAAC,MAAmC,UAGnE,IAAMC,EAAmBJ,EAAO,EAI1BK,EAA+BJ,EAAO,CAC1C,YAAaA,EAAO,CAClB,+BAAgCG,CAClC,CAAC,CACH,CAAC,EAED,SAASE,EAA0BC,EAA0C,CAC3E,OAAOL,EAAMG,EAA8BE,CAAQ,EAAE,YAAY,8BAA8B,CACjG,CAEA,SAASC,EAA4BD,EAAsD,CACzF,IAAME,EAASN,EAAUE,EAA8BE,CAAQ,EAE/D,OAAOE,EAAO,QAAUA,EAAO,OAAO,YAAY,8BAA8B,EAAI,MACtF,CAEA,SAASC,EAAwBH,EAA8BI,EAAyC,CACtG,IAAMC,EAAkB,CAAE,GAAGL,EAAS,WAAY,EAElD,OAAI,OAAOI,EAAU,IACnB,OAAQC,EAAwB,8BAA8B,EAE9DA,EAAgB,8BAA8B,EAAIV,EAAME,EAAkBO,CAAK,EAG1E,CACL,GAAGJ,EACH,YAAaK,CACf,CACF,CCpCA,OAAS,UAAAC,EAAQ,SAAAC,EAAO,YAAAC,EAAU,aAAAC,MAAmC,UAGrE,IAAMC,EAAmBF,EACvB,CAAC,UAAW,cAAe,MAAM,EACjC,+DACF,EAIMG,EAAuCL,EAAO,CAClD,YAAaA,EACX,CACE,sBAAuBI,CACzB,EACA,iCACF,CACF,CAAC,EAED,SAASE,EAAkCC,EAAgC,CACzE,OAAON,EAAMI,EAAsCE,CAAQ,EAAE,YAAY,qBAAqB,CAChG,CAEA,SAASC,EAAoCD,EAA4C,CACvF,IAAME,EAASN,EAAUE,EAAsCE,CAAQ,EAEvE,OAAOE,EAAO,QAAUA,EAAO,OAAO,YAAY,qBAAqB,EAAI,MAC7E,CAEA,SAASC,EAAgCH,EAAoBI,EAAyC,CACpG,IAAMC,EAAkB,CAAE,GAAGL,EAAS,WAAY,EAElD,OAAI,OAAOI,EAAU,IACnB,OAAQC,EAAwB,qBAAqB,EAErDA,EAAgB,qBAAqB,EAAID,EAGpC,CACL,GAAGJ,EACH,YAAaK,CACf,CACF","names":["number","object","parse","safeParse","ReceivedAtSchema","ActivityWithReceivedAtSchema","getReceivedAtFromActivity","activity","queryReceivedAtFromActivity","result","setReceivedAtInActivity","value","nextChannelData","object","parse","picklist","safeParse","SendStatusSchema","OutgoingActivityWithSendStatusSchema","getSendStatusFromOutgoingActivity","activity","querySendStatusFromOutgoingActivity","result","setSendStatusInOutgoingActivity","value","nextChannelData"]}