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EAAE;QAC3B,MAAM,IAAI,mBAAmB,CAAC,wBAAwB,EAAE,QAAQ,CAAC,CAAC;KACnE;IACD,eAAe,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;AACrC,CAAC;AAED,MAAM,UAAU,oBAAoB,CAAC,KAAa,EAAE,UAAkC;IACpF,IAAI,CAAC,eAAe,CAAC,oBAAoB,EAAE;QACzC,MAAM,IAAI,mBAAmB,CAAC,wBAAwB,EAAE,sBAAsB,CAAC,CAAC;KACjF;IACD,eAAe,CAAC,oBAAoB,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC;AAC1D,CAAC;AAED,MAAM,UAAU,KAAK;IACnB,IAAI,CAAC,eAAe,CAAC,KAAK,EAAE;QAC1B,MAAM,IAAI,mBAAmB,CAAC,wBAAwB,EAAE,OAAO,CAAC,CAAC;KAClE;IACD,eAAe,CAAC,KAAK,EAAE,CAAC;AAC1B,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,eAAe;IACnC,IAAI,CAAC,eAAe,CAAC,eAAe,EAAE;QACpC,MAAM,IAAI,mBAAmB,CAAC,wBAAwB,EAAE,iBAAiB,CAAC,CAAC;KAC5E;IACD,MAAM,eAAe,GAAG,MAAM,eAAe,CAAC,eAAe,EAAE,CAAC;IAChE,OAAO,CAAC,CAAC,eAAe,CAAC;AAC3B,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,eAAe,CAAC,OAAgB;IACpD,IAAI,CAAC,eAAe,CAAC,eAAe,EAAE;QACpC,MAAM,IAAI,mBAAmB,CAAC,wBAAwB,EAAE,iBAAiB,CAAC,CAAC;KAC5E;IACD,MAAM,eAAe,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC;AACjD,CAAC","sourcesContent":["import { Platform } from 'react-native';\nimport { UnavailabilityError } from '@unimodules/core';\n\nimport ExponentSegment from './ExponentSegment';\n\nexport type SegmentOptions = {\n androidWriteKey?: string;\n iosWriteKey?: string;\n};\n\nexport function initialize(options: SegmentOptions): void {\n if (Platform.OS === 'android') {\n ExponentSegment.initializeAndroid(options.androidWriteKey);\n } else if (Platform.OS === 'ios') {\n ExponentSegment.initializeIOS(options.iosWriteKey);\n } else {\n throw new UnavailabilityError('expo-analytics-segment', 'initialize');\n }\n}\n\nexport function identify(userId: string): void {\n if (!ExponentSegment.identify) {\n throw new UnavailabilityError('expo-analytics-segment', 'identify');\n }\n ExponentSegment.identify(userId);\n}\n\nexport function identifyWithTraits(userId: string, traits: { [key: string]: any }): void {\n if (!ExponentSegment.identifyWithTraits) {\n throw new UnavailabilityError('expo-analytics-segment', 'identifyWithTraits');\n }\n ExponentSegment.identifyWithTraits(userId, traits);\n}\n\nexport function group(groupId: string): void {\n if (!ExponentSegment.group) {\n throw new UnavailabilityError('expo-analytics-segment', 'group');\n }\n ExponentSegment.group(groupId);\n}\n\nexport function groupWithTraits(groupId: string, traits: { [key: string]: any }): void {\n if (!ExponentSegment.groupWithTraits) {\n throw new UnavailabilityError('expo-analytics-segment', 'groupWithTraits');\n }\n ExponentSegment.groupWithTraits(groupId, traits);\n}\n\nexport async function alias(newId: string, options?: { [key: string]: any }): Promise<boolean> {\n if (!ExponentSegment.alias) {\n throw new UnavailabilityError('expo-analytics-segment', 'alias');\n }\n return await ExponentSegment.alias(newId, options);\n}\n\nexport function reset(): void {\n if (!ExponentSegment.reset) {\n throw new UnavailabilityError('expo-analytics-segment', 'reset');\n }\n ExponentSegment.reset();\n}\n\nexport function track(event: string): void {\n if (!ExponentSegment.track) {\n throw new UnavailabilityError('expo-analytics-segment', 'track');\n }\n ExponentSegment.track(event);\n}\n\nexport function trackWithProperties(event: string, properties: { [key: string]: any }): void {\n if (!ExponentSegment.trackWithProperties) {\n throw new UnavailabilityError('expo-analytics-segment', 'trackWithProperties');\n }\n ExponentSegment.trackWithProperties(event, properties);\n}\n\nexport function screen(screenName: string): void {\n if (!ExponentSegment.screen) {\n throw new UnavailabilityError('expo-analytics-segment', 'screen');\n }\n ExponentSegment.screen(screenName);\n}\n\nexport function screenWithProperties(event: string, properties: { [key: string]: any }): void {\n if (!ExponentSegment.screenWithProperties) {\n throw new UnavailabilityError('expo-analytics-segment', 'screenWithProperties');\n }\n ExponentSegment.screenWithProperties(event, properties);\n}\n\nexport function flush(): void {\n if (!ExponentSegment.flush) {\n throw new UnavailabilityError('expo-analytics-segment', 'flush');\n }\n ExponentSegment.flush();\n}\n\nexport async function getEnabledAsync(): Promise<boolean> {\n if (!ExponentSegment.getEnabledAsync) {\n throw new UnavailabilityError('expo-analytics-segment', 'getEnabledAsync');\n }\n const isEnabledNumber = await ExponentSegment.getEnabledAsync();\n return !!isEnabledNumber;\n}\n\nexport async function setEnabledAsync(enabled: boolean): Promise<void> {\n if (!ExponentSegment.setEnabledAsync) {\n throw new UnavailabilityError('expo-analytics-segment', 'setEnabledAsync');\n }\n await ExponentSegment.setEnabledAsync(enabled);\n}\n"]}
\No newline at end of file