{"version":3,"file":"useFormId.cjs","sources":["../../src/useFormId.ts"],"sourcesContent":["import * as Vue from 'vue'\nimport { uuid } from '@tanstack/form-core'\n\n/**\n * `useId` was added in vue@3.5, but this package supports `vue@^3.4.0`. It is\n * read off the namespace, typed as optional, rather than imported by name: a\n * named import would make bundlers fail to resolve it on 3.4.\n * Read more: https://github.com/webpack/webpack/issues/14814\n */\nconst vueUseId: { useId?: () => string } = Vue\n\n/**\n * Returns an SSR-safe id for the form, so the server-rendered markup and the\n * client hydration agree on it. Falls back to a random uuid when `useId` is\n * unavailable, or when called outside of a component instance, where `useId`\n * cannot produce a stable value.\n */\nexport function useFormId(): string {\n  const useId = vueUseId.useId\n  if (useId && Vue.getCurrentInstance()) {\n    return useId()\n  }\n  return uuid()\n}\n"],"names":["Vue","uuid"],"mappings":";;;;;;;;;;;;;;;;;;;;;AASA,MAAM,WAAqCA;AAQpC,SAAS,YAAoB;AAClC,QAAM,QAAQ,SAAS;AACvB,MAAI,SAASA,eAAI,sBAAsB;AACrC,WAAO,MAAA;AAAA,EACT;AACA,SAAOC,cAAA;AACT;;"}