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AC/D,CAAC;AAED,cAAc;AACd;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,gBAAgB,CAAC,UAA4B,EAAE;IACnE,OAAO,MAAM,aAAa,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC;AACvD,CAAC","sourcesContent":["import { UnavailabilityError } from 'expo-modules-core';\nimport { Platform } from 'react-native';\n\nimport ExponentPrint from './ExponentPrint';\nimport {\n FilePrintOptions,\n FilePrintResult,\n OrientationType,\n PrintOptions,\n Printer,\n} from './Print.types';\n\nexport { FilePrintOptions, FilePrintResult, OrientationType, PrintOptions, Printer };\n\n// @needsAudit @docsMissing\n/**\n * The orientation of the printed content.\n */\nexport const Orientation: OrientationType = ExponentPrint.Orientation;\n\n// @needsAudit\n/**\n * Prints a document or HTML, on web this prints the HTML from the page.\n * > Note: On iOS, printing from HTML source doesn't support local asset URLs (due to `WKWebView`\n * > limitations). As a workaround you can use inlined base64-encoded strings.\n * > See [this comment](https://github.com/expo/expo/issues/7940#issuecomment-657111033) for more details.\n * @param options A map defining what should be printed.\n * @return Resolves to an empty `Promise` if printing started.\n */\nexport async function printAsync(options: PrintOptions): Promise<void> {\n if (Platform.OS === 'web') {\n return await ExponentPrint.print(options);\n }\n if (!options.uri && !options.html && Platform.OS === 'ios' && !options.markupFormatterIOS) {\n throw new Error('Must provide either `html` or `uri` to print');\n }\n if (options.uri && options.html) {\n throw new Error('Must provide exactly one of `html` and `uri` but both were specified');\n }\n if (options.markupFormatterIOS !== undefined) {\n console.warn('The markupFormatterIOS option is deprecated. Use useMarkupFormatter instead.');\n }\n return await ExponentPrint.print(options);\n}\n\n// @needsAudit\n/**\n * **Available on iOS only.** Chooses a printer that can be later used in `printAsync`\n * @return A promise which fulfils with an object containing `name` and `url` of the selected printer.\n */\nexport async function selectPrinterAsync(): Promise<Printer> {\n if (ExponentPrint.selectPrinter) {\n return await ExponentPrint.selectPrinter();\n }\n\n throw new UnavailabilityError('Print', 'selectPrinterAsync');\n}\n\n// @needsAudit\n/**\n * Prints HTML to PDF file and saves it to [app's cache directory](./filesystem/#filesystemcachedirectory).\n * On Web this method opens the print dialog.\n * @param options A map of print options.\n */\nexport async function printToFileAsync(options: FilePrintOptions = {}): Promise<FilePrintResult> {\n return await ExponentPrint.printToFileAsync(options);\n}\n"]}
\No newline at end of file