{"version":3,"file":"piniaIntegration.js","sources":["../../../src/client/piniaIntegration.ts"],"sourcesContent":["import type { IntegrationFn } from '@sentry/core';\nimport { consoleSandbox, defineIntegration } from '@sentry/core';\nimport { createSentryPiniaPlugin } from '@sentry/vue';\n\nconst INTEGRATION_NAME = 'Pinia';\n\ntype Pinia = { use: (plugin: ReturnType) => void };\n\nconst _piniaIntegration = ((\n // `unknown` here as well because usePinia declares this type: `export declare const usePinia: () => unknown;`\n pinia: unknown | Pinia,\n options: Parameters[0] = {},\n) => {\n return {\n name: INTEGRATION_NAME,\n setup() {\n if (!pinia || (typeof pinia === 'object' && !('use' in pinia))) {\n consoleSandbox(() => {\n // eslint-disable-next-line no-console\n console.warn(\n '[Sentry] The Pinia integration was added, but the passed parameter `pinia` has the wrong value. Make sure to enable Pinia by adding `\"@pinia/nuxt\"` to the Nuxt modules array and pass pinia to Sentry with `piniaIntegration(usePinia())`. Current value of `pinia`:',\n pinia,\n );\n });\n } else {\n (pinia as Pinia).use(createSentryPiniaPlugin(options));\n }\n },\n };\n}) satisfies IntegrationFn;\n\n/**\n * Monitor an existing Pinia store.\n *\n * This only works if \"@pinia/nuxt\" is added to the `modules` array.\n */\nexport const piniaIntegration = defineIntegration(_piniaIntegration);\n"],"names":[],"mappings":";;;AAIA,MAAM,gBAAA,GAAmB,OAAA;AAIzB,MAAM,iBAAA,IAAqB,CAEzB,KAAA,EACA,OAAA,GAAyD,EAAC,KACvD;AACH,EAAA,OAAO;AAAA,IACL,IAAA,EAAM,gBAAA;AAAA,IACN,KAAA,GAAQ;AACN,MAAA,IAAI,CAAC,KAAA,IAAU,OAAO,UAAU,QAAA,IAAY,EAAE,SAAS,KAAA,CAAA,EAAS;AAC9D,QAAA,cAAA,CAAe,MAAM;AAEnB,UAAA,OAAA,CAAQ,IAAA;AAAA,YACN,uQAAA;AAAA,YACA;AAAA,WACF;AAAA,QACF,CAAC,CAAA;AAAA,MACH,CAAA,MAAO;AACL,QAAC,KAAA,CAAgB,GAAA,CAAI,uBAAA,CAAwB,OAAO,CAAC,CAAA;AAAA,MACvD;AAAA,IACF;AAAA,GACF;AACF,CAAA,CAAA;AAOO,MAAM,gBAAA,GAAmB,kBAAkB,iBAAiB;;;;"}