{"version":3,"sources":["jsdelivr-header.js","/npm/react-native-file-viewer-mod@2.1.5/index.js"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA,OCNS,mBAAoB,cAAe,aAAgB,eAE5D,MAAM,aAAE,cAAiB,cACnB,aAAe,IAAI,mBAAmB,cAE5C,IAAI,OAAS,EAEb,SAAS,KAAK,EAAM,EAAU,CAAC,GAC7B,MAAM,EACe,iBAAZ,EAAuB,CAAE,YAAa,GAAY,GACrD,UAAE,KAAc,GAAkB,EAExC,MAAK,CAAC,UAAW,OAAO,SAAS,SAAS,IAInC,IAAI,SAAQ,CAAC,EAAS,KAC3B,MAAM,IAAc,OAEd,EAAmB,aAAa,YACpC,uBACA,EAAG,KAAI,YACL,GAAI,IAAO,EAET,OADA,EAAiB,SACV,EAAQ,EAAO,IAAI,MAAM,IAAU,GAC5C,IAGE,EAAsB,aAAa,YACvC,0BACA,EAAG,SACG,IAAO,IACT,EAAoB,SACpB,GAAa,IACf,IAIJ,aAAa,KAAK,UAAU,GAAO,EAAW,EAAc,IAzBrD,aAAa,KAAK,EAAM,EA2BnC,CAEA,SAAS,UAAU,GACjB,GAAoB,QAAhB,SAAS,IAAgC,YAAhB,SAAS,GAAkB,CACtD,MAAM,EAAa,UACnB,GAAI,EAAK,WAAW,GAAa,CAC/B,EAAO,EAAK,UAAU,EAAW,QACjC,IACE,EAAO,UAAU,EACnB,CAAE,MAAO,GAAI,CACf,CACF,CACA,OAAO,CACT,eAEe,CAAE,kBACR","file":"/npm/react-native-file-viewer-mod@2.1.5/index.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/react-native-file-viewer-mod@2.1.5/index.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","import { NativeEventEmitter, NativeModules, Platform } from \"react-native\";\n\nconst { RNFileViewer } = NativeModules;\nconst eventEmitter = new NativeEventEmitter(RNFileViewer);\n\nlet lastId = 0;\n\nfunction open(path, options = {}) {\n  const _options =\n    typeof options === \"string\" ? { displayName: options } : options;\n  const { onDismiss, ...nativeOptions } = _options;\n\n  if (![\"android\", \"ios\"].includes(Platform.OS)) {\n    return RNFileViewer.open(path, nativeOptions);\n  }\n\n  return new Promise((resolve, reject) => {\n    const currentId = ++lastId;\n\n    const openSubscription = eventEmitter.addListener(\n      \"RNFileViewerDidOpen\",\n      ({ id, error }) => {\n        if (id === currentId) {\n          openSubscription.remove();\n          return error ? reject(new Error(error)) : resolve();\n        }\n      }\n    );\n    const dismissSubscription = eventEmitter.addListener(\n      \"RNFileViewerDidDismiss\",\n      ({ id }) => {\n        if (id === currentId) {\n          dismissSubscription.remove();\n          onDismiss && onDismiss();\n        }\n      }\n    );\n\n    RNFileViewer.open(normalize(path), currentId, nativeOptions);\n  });\n}\n\nfunction normalize(path) {\n  if (Platform.OS === \"ios\" || Platform.OS === \"android\") {\n    const filePrefix = \"file://\";\n    if (path.startsWith(filePrefix)) {\n      path = path.substring(filePrefix.length);\n      try {\n        path = decodeURI(path);\n      } catch (e) {}\n    }\n  }\n  return path;\n}\n\nexport default { open };\nexport { open };\n"]}