{"version":3,"file":"NcDateTime-enXYuwj8-fJ1V3Ixk.chunk.mjs","sources":["../node_modules/@nextcloud/vue/dist/chunks/NcDateTime-enXYuwj8.mjs"],"sourcesContent":["import { computed, toRef } from \"vue\";\nimport { useFormatTime, useFormatRelativeTime } from \"../Composables/useFormatDateTime.mjs\";\nimport { n as normalizeComponent } from \"./_plugin-vue2_normalizer-DU4iP6Vu.mjs\";\nconst _sfc_main = {\n  name: \"NcDateTime\",\n  props: {\n    /**\n     * The timestamp to display, either an unix timestamp (in milliseconds) or a Date object\n     */\n    timestamp: {\n      type: [Date, Number],\n      required: true\n    },\n    /**\n     * The format used for displaying, or if relative time is used the format used for the title (optional)\n     *\n     * @type {Intl.DateTimeFormatOptions}\n     */\n    format: {\n      type: Object,\n      default: () => ({ timeStyle: \"medium\", dateStyle: \"short\" })\n    },\n    /**\n     * Wether to display the timestamp as time from now (optional)\n     *\n     * - `false`: Disable relative time\n     * - `'long'`: Long text, like *2 seconds ago* (default)\n     * - `'short'`: Short text, like *2 sec. ago*\n     * - `'narrow'`: Even shorter text (same as `'short'` on some languages)\n     */\n    relativeTime: {\n      type: [Boolean, String],\n      default: \"long\",\n      validator: (v) => v === false || [\"long\", \"short\", \"narrow\"].includes(v)\n    },\n    /**\n     * Ignore seconds when displaying the relative time and just show `a few seconds ago`\n     */\n    ignoreSeconds: {\n      type: Boolean,\n      default: false\n    }\n  },\n  setup(props) {\n    const timeOptions = computed(() => ({ format: props.format }));\n    const relativeTimeOptions = computed(() => ({\n      ignoreSeconds: props.ignoreSeconds,\n      relativeTime: props.relativeTime || \"long\",\n      update: props.relativeTime !== false\n    }));\n    const title = useFormatTime(toRef(props, \"timestamp\"), timeOptions);\n    const relativeTime = useFormatRelativeTime(toRef(props, \"timestamp\"), relativeTimeOptions);\n    const formattedTime = computed(() => props.relativeTime ? relativeTime.value : title.value);\n    return {\n      formattedTime,\n      title\n    };\n  }\n};\nvar _sfc_render = function render() {\n  var _vm = this, _c = _vm._self._c;\n  return _c(\"span\", { staticClass: \"nc-datetime\", attrs: { \"dir\": \"auto\", \"data-timestamp\": _vm.timestamp, \"title\": _vm.title }, domProps: { \"textContent\": _vm._s(_vm.formattedTime) } });\n};\nvar _sfc_staticRenderFns = [];\nvar __component__ = /* @__PURE__ */ normalizeComponent(\n  _sfc_main,\n  _sfc_render,\n  _sfc_staticRenderFns,\n  false,\n  null,\n  null\n);\nconst NcDateTime = __component__.exports;\nexport {\n  NcDateTime as N\n};\n//# sourceMappingURL=NcDateTime-enXYuwj8.mjs.map\n"],"names":["_sfc_main","v","props","timeOptions","computed","relativeTimeOptions","title","useFormatTime","toRef","relativeTime","useFormatRelativeTime","_sfc_render","_vm","_c","_sfc_staticRenderFns","__component__","normalizeComponent","NcDateTime"],"mappings":"gLAGA,MAAMA,EAAY,CAChB,KAAM,aACN,MAAO,CAIL,UAAW,CACT,KAAM,CAAC,KAAM,MAAM,EACnB,SAAU,EAChB,EAMI,OAAQ,CACN,KAAM,OACN,QAAS,KAAO,CAAE,UAAW,SAAU,UAAW,OAAO,EAC/D,EASI,aAAc,CACZ,KAAM,CAAC,QAAS,MAAM,EACtB,QAAS,OACT,UAAYC,GAAMA,IAAM,IAAS,CAAC,OAAQ,QAAS,QAAQ,EAAE,SAASA,CAAC,CAC7E,EAII,cAAe,CACb,KAAM,QACN,QAAS,EACf,CACA,EACE,MAAMC,EAAO,CACX,MAAMC,EAAcC,EAAS,KAAO,CAAE,OAAQF,EAAM,MAAM,EAAG,EACvDG,EAAsBD,EAAS,KAAO,CAC1C,cAAeF,EAAM,cACrB,aAAcA,EAAM,cAAgB,OACpC,OAAQA,EAAM,eAAiB,EACrC,EAAM,EACII,EAAQC,EAAcC,EAAMN,EAAO,WAAW,EAAGC,CAAW,EAC5DM,EAAeC,EAAsBF,EAAMN,EAAO,WAAW,EAAGG,CAAmB,EAEzF,MAAO,CACL,cAFoBD,EAAS,IAAMF,EAAM,aAAeO,EAAa,MAAQH,EAAM,KAAK,EAGxF,MAAAA,CACN,CACE,CACF,EACA,IAAIK,EAAc,UAAkB,CAClC,IAAIC,EAAM,KAAMC,EAAKD,EAAI,MAAM,GAC/B,OAAOC,EAAG,OAAQ,CAAE,YAAa,cAAe,MAAO,CAAE,IAAO,OAAQ,iBAAkBD,EAAI,UAAW,MAASA,EAAI,OAAS,SAAU,CAAE,YAAeA,EAAI,GAAGA,EAAI,aAAa,CAAC,CAAE,CAAE,CACzL,EACIE,EAAuB,CAAA,EACvBC,EAAgCC,EAClChB,EACAW,EACAG,EACA,GACA,KACA,IACF,EACK,MAACG,EAAaF,EAAc","x_google_ignoreList":[0]}