{"version":3,"file":"endowments.mjs","sourceRoot":"","sources":["../src/endowments.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAMH,OAAO,sBAAsB,wCAAoC;AACjE,OAAO,aAAa,wCAAoC;AAExD,gEAAgE;AAChE,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,wCAAoC;AACjE,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,yCAAqC;AACnE,OAAO,EAAE,OAAO,IAAI,IAAI,EAAE,qCAAiC;AAC3D,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,4CAAwC;AACzE,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,4CAAwC;AACzE,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,uCAAmC;AAC/D,OAAO,EAAE,OAAO,IAAI,IAAI,EAAE,qCAAiC;AAgB3D;;;GAGG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAGzB,sBAAsB,CAAC;AAE3B;;;GAGG;AACH,MAAM,CAAC,MAAM,OAAO,GAGhB,aAAa,CAAC;AAElB,yCAAyC;AACzC,OAAO,EAAE,OAAO,IAAI,qBAAqB,EAAE,uDAAmD","sourcesContent":["/**\n * Public endowment factory exports for use outside the Snaps ecosystem.\n *\n * **Prerequisite**: These factories call the SES `harden()` global internally.\n * The consuming environment must have loaded SES and called `lockdown()` before\n * invoking any factory function.\n *\n * Each module provides a `names` array and a `factory` function. Call\n * `factory()` to obtain hardened endowment values (and an optional\n * `teardownFunction` for stateful endowments that manage resources).\n *\n * @example\n * ```ts\n * import { timeout, date } from '@metamask/snaps-execution-environments/endowments';\n *\n * const timers = timeout.factory();\n * // { setTimeout, clearTimeout, teardownFunction }\n *\n * const dateEndowment = date.factory();\n * // { Date } (with attenuated Date.now)\n * ```\n *\n * @module endowments\n */\n\nimport type {\n  EndowmentFactoryOptions,\n  EndowmentFactoryResult,\n} from './common/endowments/commonEndowmentFactory';\nimport consoleEndowmentModule from './common/endowments/console';\nimport networkModule from './common/endowments/network';\n\n// Individual endowment factory modules with no required options\nexport { default as timeout } from './common/endowments/timeout';\nexport { default as interval } from './common/endowments/interval';\nexport { default as date } from './common/endowments/date';\nexport { default as textEncoder } from './common/endowments/textEncoder';\nexport { default as textDecoder } from './common/endowments/textDecoder';\nexport { default as crypto } from './common/endowments/crypto';\nexport { default as math } from './common/endowments/math';\n\n/**\n * Options required by the console endowment factory.\n */\nexport type ConsoleEndowmentOptions = Required<\n  Pick<EndowmentFactoryOptions, 'sourceLabel'>\n>;\n\n/**\n * Options required by the network endowment factory.\n */\nexport type NetworkEndowmentOptions = Required<\n  Pick<EndowmentFactoryOptions, 'notify'>\n>;\n\n/**\n * The console endowment factory. Produces an attenuated `console` object that\n * prefixes output with the provided source label.\n */\nexport const consoleEndowment: {\n  readonly names: readonly ['console'];\n  factory: (options: ConsoleEndowmentOptions) => EndowmentFactoryResult;\n} = consoleEndowmentModule;\n\n/**\n * The network endowment factory. Produces a wrapped `fetch` function and\n * related types with teardown support.\n */\nexport const network: {\n  readonly names: readonly ['fetch', 'Request', 'Headers', 'Response'];\n  factory: (options: NetworkEndowmentOptions) => EndowmentFactoryResult;\n} = networkModule;\n\n// Consolidated factory builder and types\nexport { default as buildCommonEndowments } from './common/endowments/commonEndowmentFactory';\nexport type {\n  NotifyFunction,\n  EndowmentFactoryOptions,\n  EndowmentFactoryResult,\n  EndowmentFactory,\n} from './common/endowments/commonEndowmentFactory';\n"]}