{
  "version": 3,
  "sources": ["../../src/document/components/chrome/siteSettings/RelativeTime.tsx"],
  "sourcesContent": ["import { parseISO } from \"date-fns\"\nimport { startTransition, useEffect } from \"react\"\nimport { useForceUpdate } from \"utils/useForceUpdate.ts\"\nimport { formatDate } from \"web/lib/Project.ts\"\nimport { formatDistanceToNowShort } from \"web/pages/project/lib/formatDistanceToNowShort.ts\"\n\ninterface Props {\n\ttimestamp: number | string | Date\n\t/** Hide the native browser tooltip with the full date. Defaults to `true` (tooltip shown). */\n\tshowTooltip?: boolean\n\t/** Append a relative suffix, e.g. \"3 hours ago\". Defaults to `true`. */\n\taddSuffix?: boolean\n\tclassName?: string\n}\n\nexport function RelativeTime({ timestamp, showTooltip = true, addSuffix = true, className }: Props) {\n\tconst forceUpdate = useForceUpdate()\n\n\tuseEffect(() => {\n\t\tconst interval = setInterval(() => {\n\t\t\tstartTransition(() => forceUpdate())\n\t\t}, 5000)\n\n\t\treturn () => clearInterval(interval)\n\t}, [forceUpdate])\n\n\tconst date = toDate(timestamp)\n\treturn (\n\t\t<time dateTime={date.toISOString()} title={showTooltip ? formatDate(date) : undefined} className={className}>\n\t\t\t{formatDistanceToNowShort(date, { addSuffix })}\n\t\t</time>\n\t)\n}\n\nfunction toDate(timestamp: number | string | Date): Date {\n\tif (timestamp instanceof Date) return timestamp\n\tif (typeof timestamp === \"string\") return parseISO(timestamp)\n\treturn new Date(timestamp)\n}\n"],
  "mappings": ";;;;;;;;;;;;;;;;;;;;;;;AACA,mBAA2C;AA2BzC;AAbK,SAAS,aAAa,EAAE,WAAW,cAAc,MAAM,YAAY,MAAM,UAAU,GAAU;AACnG,QAAM,cAAc,eAAe;AAEnC,8BAAU,MAAM;AACf,UAAM,WAAW,YAAY,MAAM;AAClC,wCAAgB,MAAM,YAAY,CAAC;AAAA,IACpC,GAAG,GAAI;AAEP,WAAO,MAAM,cAAc,QAAQ;AAAA,EACpC,GAAG,CAAC,WAAW,CAAC;AAEhB,QAAM,OAAO,OAAO,SAAS;AAC7B,SACC,4CAAC,UAAK,UAAU,KAAK,YAAY,GAAG,OAAO,cAAc,WAAW,IAAI,IAAI,QAAW,WACrF,mCAAyB,MAAM,EAAE,UAAU,CAAC,GAC9C;AAEF;AAEA,SAAS,OAAO,WAAyC;AACxD,MAAI,qBAAqB,KAAM,QAAO;AACtC,MAAI,OAAO,cAAc,SAAU,QAAO,SAAS,SAAS;AAC5D,SAAO,IAAI,KAAK,SAAS;AAC1B;",
  "names": []
}
