44 lines
1.4 KiB
JavaScript
44 lines
1.4 KiB
JavaScript
// Metro module 8640 (f8641).
|
|
import { Platform } from "react-native";
|
|
import { Buffer } from "./Buffer";
|
|
let decodeBase64Image;
|
|
let _fetchUriData = function _fetchUriData() {
|
|
const r8 = async (c26251_0) => {
|
|
let c29957_1;
|
|
let c29957_0 = c26251_0;
|
|
c29957_1 = void 0;
|
|
const r37 = await fetch(c26251_0);
|
|
L9: {
|
|
c29957_1 = r37;
|
|
if (!c29957_1.ok) {
|
|
if (c29957_1.status === 0 && c29957_0.startsWith("file://")) {
|
|
break L9;
|
|
}
|
|
throw new Error(`Fetching ${c29957_0} failed with status ${c29957_1.status}`);
|
|
}
|
|
}
|
|
return await c29957_1.text();
|
|
};
|
|
_fetchUriData = r8;
|
|
return r8.apply(this, arguments);
|
|
};
|
|
Platform;
|
|
decodeBase64Image = (a0) => {
|
|
const r13 = decodeURIComponent(a0).split(";")[1].split(",");
|
|
const r14 = r13[0];
|
|
return Buffer.from(r13.slice(1).join(","), r14).toString("utf-8");
|
|
};
|
|
export async function fetchText(c26250_0) {
|
|
return c26250_0 ? c26250_0.startsWith("data:image/svg+xml;utf8") ? (function dataUriToXml(a0) {
|
|
let r17;
|
|
try {
|
|
r17 = decodeURIComponent(a0).split(",").slice(1).join(",");
|
|
} catch ($e) {
|
|
throw new Error(`Decoding ${a0} failed with error: ${$e}`);
|
|
}
|
|
return r17;
|
|
})(c26250_0) : c26250_0.startsWith("data:image/svg+xml;base64") ? decodeBase64Image(c26250_0) : (function fetchUriData(a0) {
|
|
return _fetchUriData.apply(this, arguments);
|
|
})(c26250_0) : null;
|
|
}
|