{"code":"import { FetchTransport, StitchAppClientConfiguration } from \"mongodb-stitch-core-sdk\";\r\nimport LocalStorage from \"./internal/common/LocalStorage\";\r\nimport StitchAppClientImpl from \"./internal/StitchAppClientImpl\";\r\nvar DEFAULT_BASE_URL = \"https://stitch.mongodb.com\";\r\nvar appClients = {};\r\nvar Stitch = (function () {\r\n    function Stitch() {\r\n    }\r\n    Object.defineProperty(Stitch, \"defaultAppClient\", {\r\n        get: function () {\r\n            if (Stitch.defaultClientAppId === undefined) {\r\n                throw new Error(\"default app client has not yet been initialized/set\");\r\n            }\r\n            return appClients[Stitch.defaultClientAppId];\r\n        },\r\n        enumerable: true,\r\n        configurable: true\r\n    });\r\n    Stitch.getAppClient = function (clientAppId) {\r\n        if (appClients[clientAppId] !== undefined) {\r\n            throw new Error(\"client for app '\" + clientAppId + \"' has not yet been initialized\");\r\n        }\r\n        return appClients[clientAppId];\r\n    };\r\n    Stitch.hasAppClient = function (clientAppId) {\r\n        return appClients[clientAppId] !== undefined;\r\n    };\r\n    Stitch.initializeDefaultAppClient = function (clientAppId, config) {\r\n        if (config === void 0) { config = new StitchAppClientConfiguration.Builder().build(); }\r\n        if (clientAppId === undefined || clientAppId === \"\") {\r\n            throw new Error(\"clientAppId must be set to a non-empty string\");\r\n        }\r\n        if (Stitch.defaultClientAppId !== undefined) {\r\n            throw new Error(\"default app can only be set once; currently set to '\" + Stitch.defaultClientAppId + \"'\");\r\n        }\r\n        var client = Stitch.initializeAppClient(clientAppId, config);\r\n        Stitch.defaultClientAppId = clientAppId;\r\n        return client;\r\n    };\r\n    Stitch.initializeAppClient = function (clientAppId, config) {\r\n        if (config === void 0) { config = new StitchAppClientConfiguration.Builder().build(); }\r\n        if (clientAppId === undefined || clientAppId === \"\") {\r\n            throw new Error(\"clientAppId must be set to a non-empty string\");\r\n        }\r\n        if (appClients[clientAppId] !== undefined) {\r\n            throw new Error(\"client for app '\" + clientAppId + \"' has already been initialized\");\r\n        }\r\n        var builder = config.builder();\r\n        if (builder.storage === undefined) {\r\n            builder.withStorage(new LocalStorage(clientAppId));\r\n        }\r\n        if (builder.transport === undefined) {\r\n            builder.withTransport(new FetchTransport());\r\n        }\r\n        if (builder.baseUrl === undefined || builder.baseUrl === \"\") {\r\n            builder.withBaseUrl(DEFAULT_BASE_URL);\r\n        }\r\n        if (builder.localAppName === undefined || builder.localAppName === \"\") {\r\n            builder.withLocalAppName(Stitch.localAppName);\r\n        }\r\n        if (builder.localAppVersion === undefined ||\r\n            builder.localAppVersion === \"\") {\r\n            builder.withLocalAppVersion(Stitch.localAppVersion);\r\n        }\r\n        var client = new StitchAppClientImpl(clientAppId, builder.build());\r\n        appClients[clientAppId] = client;\r\n        return client;\r\n    };\r\n    return Stitch;\r\n}());\r\nexport default Stitch;\r\n//# sourceMappingURL=Stitch.js.map","map":"{\"version\":3,\"file\":\"Stitch.js\",\"sourceRoot\":\"\",\"sources\":[\"../../../src/core/Stitch.ts\"],\"names\":[],\"mappings\":\"AAgBA,OAAO,EACL,cAAc,EACd,4BAA4B,EAC7B,MAAM,yBAAyB,CAAC;AACjC,OAAO,YAAY,MAAM,gCAAgC,CAAC;AAC1D,OAAO,mBAAmB,MAAM,gCAAgC,CAAC;AAGjE,IAAM,gBAAgB,GAAG,4BAA4B,CAAC;AACtD,IAAM,UAAU,GAA2C,EAAE,CAAC;AAM9D;IAAA;IA4GA,CAAC;IAxGC,sBAAkB,0BAAgB;aAAlC;YACE,IAAI,MAAM,CAAC,kBAAkB,KAAK,SAAS,EAAE;gBAC3C,MAAM,IAAI,KAAK,CAAC,qDAAqD,CAAC,CAAC;aACxE;YACD,OAAO,UAAU,CAAC,MAAM,CAAC,kBAAkB,CAAC,CAAC;QAC/C,CAAC;;;OAAA;IAMa,mBAAY,GAA1B,UAA2B,WAAmB;QAC5C,IAAI,UAAU,CAAC,WAAW,CAAC,KAAK,SAAS,EAAE;YACzC,MAAM,IAAI,KAAK,CACb,qBAAmB,WAAW,mCAAgC,CAC/D,CAAC;SACH;QACD,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,IAAI,OAAO,CAAC,SAAS,KAAK,SAAS,EAAE;YACnC,OAAO,CAAC,aAAa,CAAC,IAAI,cAAc,EAAE,CAAC,CAAC;SAC7C;QACD,IAAI,OAAO,CAAC,OAAO,KAAK,SAAS,IAAI,OAAO,CAAC,OAAO,KAAK,EAAE,EAAE;YAC3D,OAAO,CAAC,WAAW,CAAC,gBAAgB,CAAC,CAAC;SACvC;QACD,IAAI,OAAO,CAAC,YAAY,KAAK,SAAS,IAAI,OAAO,CAAC,YAAY,KAAK,EAAE,EAAE;YACrE,OAAO,CAAC,gBAAgB,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;SAC/C;QACD,IACE,OAAO,CAAC,eAAe,KAAK,SAAS;YACrC,OAAO,CAAC,eAAe,KAAK,EAAE,EAC9B;YACA,OAAO,CAAC,mBAAmB,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC;SACrD;QAED,IAAM,MAAM,GAAG,IAAI,mBAAmB,CAAC,WAAW,EAAE,OAAO,CAAC,KAAK,EAAE,CAAC,CAAC;QACrE,UAAU,CAAC,WAAW,CAAC,GAAG,MAAM,CAAC;QACjC,OAAO,MAAM,CAAC;IAChB,CAAC;IAKH,aAAC;AAAD,CAAC,AA5GD,IA4GC\"}","dts":{"name":"/Users/eric/stitch/stitch-js-sdk/packages/browser/core/.rpt2_cache/placeholder/core/Stitch.d.ts","text":"import { StitchAppClientConfiguration } from \"mongodb-stitch-core-sdk\";\r\nimport StitchAppClient from \"./StitchAppClient\";\r\nexport default class Stitch {\r\n    static readonly defaultAppClient: StitchAppClient;\r\n    static getAppClient(clientAppId: string): StitchAppClient;\r\n    static hasAppClient(clientAppId: string): boolean;\r\n    static initializeDefaultAppClient(clientAppId: string, config?: StitchAppClientConfiguration): StitchAppClient;\r\n    static initializeAppClient(clientAppId: string, config?: StitchAppClientConfiguration): StitchAppClient;\r\n    private static localAppVersion;\r\n    private static defaultClientAppId;\r\n    private static localAppName;\r\n}\r\n"}}
