Files
blockcatcher/ios/App/App/public/assets/index-CTla4gm7.js
metacryst 637c9e4674 init
2026-01-09 11:14:27 -06:00

960 lines
31 KiB
JavaScript

(function polyfill() {
const relList = document.createElement("link").relList;
if (relList && relList.supports && relList.supports("modulepreload")) {
return;
}
for (const link of document.querySelectorAll('link[rel="modulepreload"]')) {
processPreload(link);
}
new MutationObserver((mutations) => {
for (const mutation of mutations) {
if (mutation.type !== "childList") {
continue;
}
for (const node of mutation.addedNodes) {
if (node.tagName === "LINK" && node.rel === "modulepreload")
processPreload(node);
}
}
}).observe(document, { childList: true, subtree: true });
function getFetchOpts(link) {
const fetchOpts = {};
if (link.integrity) fetchOpts.integrity = link.integrity;
if (link.referrerPolicy) fetchOpts.referrerPolicy = link.referrerPolicy;
if (link.crossOrigin === "use-credentials")
fetchOpts.credentials = "include";
else if (link.crossOrigin === "anonymous") fetchOpts.credentials = "omit";
else fetchOpts.credentials = "same-origin";
return fetchOpts;
}
function processPreload(link) {
if (link.ep)
return;
link.ep = true;
const fetchOpts = getFetchOpts(link);
fetch(link.href, fetchOpts);
}
})();
const scriptRel = "modulepreload";
const assetsURL = function(dep) {
return "/" + dep;
};
const seen = {};
const __vitePreload = function preload(baseModule, deps, importerUrl) {
let promise = Promise.resolve();
if (deps && deps.length > 0) {
document.getElementsByTagName("link");
const cspNonceMeta = document.querySelector(
"meta[property=csp-nonce]"
);
const cspNonce = (cspNonceMeta == null ? void 0 : cspNonceMeta.nonce) || (cspNonceMeta == null ? void 0 : cspNonceMeta.getAttribute("nonce"));
promise = Promise.allSettled(
deps.map((dep) => {
dep = assetsURL(dep);
if (dep in seen) return;
seen[dep] = true;
const isCss = dep.endsWith(".css");
const cssSelector = isCss ? '[rel="stylesheet"]' : "";
if (document.querySelector(`link[href="${dep}"]${cssSelector}`)) {
return;
}
const link = document.createElement("link");
link.rel = isCss ? "stylesheet" : scriptRel;
if (!isCss) {
link.as = "script";
}
link.crossOrigin = "";
link.href = dep;
if (cspNonce) {
link.setAttribute("nonce", cspNonce);
}
document.head.appendChild(link);
if (isCss) {
return new Promise((res, rej) => {
link.addEventListener("load", res);
link.addEventListener(
"error",
() => rej(new Error(`Unable to preload CSS for ${dep}`))
);
});
}
})
);
}
function handlePreloadError(err) {
const e = new Event("vite:preloadError", {
cancelable: true
});
e.payload = err;
window.dispatchEvent(e);
if (!e.defaultPrevented) {
throw err;
}
}
return promise.then((res) => {
for (const item of res || []) {
if (item.status !== "rejected") continue;
handlePreloadError(item.reason);
}
return baseModule().catch(handlePreloadError);
});
};
/*! Capacitor: https://capacitorjs.com/ - MIT License */
var ExceptionCode;
(function(ExceptionCode2) {
ExceptionCode2["Unimplemented"] = "UNIMPLEMENTED";
ExceptionCode2["Unavailable"] = "UNAVAILABLE";
})(ExceptionCode || (ExceptionCode = {}));
class CapacitorException extends Error {
constructor(message, code, data) {
super(message);
this.message = message;
this.code = code;
this.data = data;
}
}
const getPlatformId = (win) => {
var _a, _b;
if (win === null || win === void 0 ? void 0 : win.androidBridge) {
return "android";
} else if ((_b = (_a = win === null || win === void 0 ? void 0 : win.webkit) === null || _a === void 0 ? void 0 : _a.messageHandlers) === null || _b === void 0 ? void 0 : _b.bridge) {
return "ios";
} else {
return "web";
}
};
const createCapacitor = (win) => {
const capCustomPlatform = win.CapacitorCustomPlatform || null;
const cap = win.Capacitor || {};
const Plugins = cap.Plugins = cap.Plugins || {};
const getPlatform = () => {
return capCustomPlatform !== null ? capCustomPlatform.name : getPlatformId(win);
};
const isNativePlatform = () => getPlatform() !== "web";
const isPluginAvailable = (pluginName) => {
const plugin = registeredPlugins.get(pluginName);
if (plugin === null || plugin === void 0 ? void 0 : plugin.platforms.has(getPlatform())) {
return true;
}
if (getPluginHeader(pluginName)) {
return true;
}
return false;
};
const getPluginHeader = (pluginName) => {
var _a;
return (_a = cap.PluginHeaders) === null || _a === void 0 ? void 0 : _a.find((h) => h.name === pluginName);
};
const handleError = (err) => win.console.error(err);
const registeredPlugins = /* @__PURE__ */ new Map();
const registerPlugin2 = (pluginName, jsImplementations = {}) => {
const registeredPlugin = registeredPlugins.get(pluginName);
if (registeredPlugin) {
console.warn(`Capacitor plugin "${pluginName}" already registered. Cannot register plugins twice.`);
return registeredPlugin.proxy;
}
const platform = getPlatform();
const pluginHeader = getPluginHeader(pluginName);
let jsImplementation;
const loadPluginImplementation = async () => {
if (!jsImplementation && platform in jsImplementations) {
jsImplementation = typeof jsImplementations[platform] === "function" ? jsImplementation = await jsImplementations[platform]() : jsImplementation = jsImplementations[platform];
} else if (capCustomPlatform !== null && !jsImplementation && "web" in jsImplementations) {
jsImplementation = typeof jsImplementations["web"] === "function" ? jsImplementation = await jsImplementations["web"]() : jsImplementation = jsImplementations["web"];
}
return jsImplementation;
};
const createPluginMethod = (impl, prop) => {
var _a, _b;
if (pluginHeader) {
const methodHeader = pluginHeader === null || pluginHeader === void 0 ? void 0 : pluginHeader.methods.find((m) => prop === m.name);
if (methodHeader) {
if (methodHeader.rtype === "promise") {
return (options) => cap.nativePromise(pluginName, prop.toString(), options);
} else {
return (options, callback) => cap.nativeCallback(pluginName, prop.toString(), options, callback);
}
} else if (impl) {
return (_a = impl[prop]) === null || _a === void 0 ? void 0 : _a.bind(impl);
}
} else if (impl) {
return (_b = impl[prop]) === null || _b === void 0 ? void 0 : _b.bind(impl);
} else {
throw new CapacitorException(`"${pluginName}" plugin is not implemented on ${platform}`, ExceptionCode.Unimplemented);
}
};
const createPluginMethodWrapper = (prop) => {
let remove;
const wrapper = (...args) => {
const p = loadPluginImplementation().then((impl) => {
const fn = createPluginMethod(impl, prop);
if (fn) {
const p2 = fn(...args);
remove = p2 === null || p2 === void 0 ? void 0 : p2.remove;
return p2;
} else {
throw new CapacitorException(`"${pluginName}.${prop}()" is not implemented on ${platform}`, ExceptionCode.Unimplemented);
}
});
if (prop === "addListener") {
p.remove = async () => remove();
}
return p;
};
wrapper.toString = () => `${prop.toString()}() { [capacitor code] }`;
Object.defineProperty(wrapper, "name", {
value: prop,
writable: false,
configurable: false
});
return wrapper;
};
const addListener = createPluginMethodWrapper("addListener");
const removeListener = createPluginMethodWrapper("removeListener");
const addListenerNative = (eventName, callback) => {
const call = addListener({ eventName }, callback);
const remove = async () => {
const callbackId = await call;
removeListener({
eventName,
callbackId
}, callback);
};
const p = new Promise((resolve) => call.then(() => resolve({ remove })));
p.remove = async () => {
console.warn(`Using addListener() without 'await' is deprecated.`);
await remove();
};
return p;
};
const proxy = new Proxy({}, {
get(_, prop) {
switch (prop) {
case "$$typeof":
return void 0;
case "toJSON":
return () => ({});
case "addListener":
return pluginHeader ? addListenerNative : addListener;
case "removeListener":
return removeListener;
default:
return createPluginMethodWrapper(prop);
}
}
});
Plugins[pluginName] = proxy;
registeredPlugins.set(pluginName, {
name: pluginName,
proxy,
platforms: /* @__PURE__ */ new Set([...Object.keys(jsImplementations), ...pluginHeader ? [platform] : []])
});
return proxy;
};
if (!cap.convertFileSrc) {
cap.convertFileSrc = (filePath) => filePath;
}
cap.getPlatform = getPlatform;
cap.handleError = handleError;
cap.isNativePlatform = isNativePlatform;
cap.isPluginAvailable = isPluginAvailable;
cap.registerPlugin = registerPlugin2;
cap.Exception = CapacitorException;
cap.DEBUG = !!cap.DEBUG;
cap.isLoggingEnabled = !!cap.isLoggingEnabled;
return cap;
};
const initCapacitorGlobal = (win) => win.Capacitor = createCapacitor(win);
const Capacitor = /* @__PURE__ */ initCapacitorGlobal(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : {});
const registerPlugin = Capacitor.registerPlugin;
class WebPlugin {
constructor() {
this.listeners = {};
this.retainedEventArguments = {};
this.windowListeners = {};
}
addListener(eventName, listenerFunc) {
let firstListener = false;
const listeners = this.listeners[eventName];
if (!listeners) {
this.listeners[eventName] = [];
firstListener = true;
}
this.listeners[eventName].push(listenerFunc);
const windowListener = this.windowListeners[eventName];
if (windowListener && !windowListener.registered) {
this.addWindowListener(windowListener);
}
if (firstListener) {
this.sendRetainedArgumentsForEvent(eventName);
}
const remove = async () => this.removeListener(eventName, listenerFunc);
const p = Promise.resolve({ remove });
return p;
}
async removeAllListeners() {
this.listeners = {};
for (const listener in this.windowListeners) {
this.removeWindowListener(this.windowListeners[listener]);
}
this.windowListeners = {};
}
notifyListeners(eventName, data, retainUntilConsumed) {
const listeners = this.listeners[eventName];
if (!listeners) {
if (retainUntilConsumed) {
let args = this.retainedEventArguments[eventName];
if (!args) {
args = [];
}
args.push(data);
this.retainedEventArguments[eventName] = args;
}
return;
}
listeners.forEach((listener) => listener(data));
}
hasListeners(eventName) {
var _a;
return !!((_a = this.listeners[eventName]) === null || _a === void 0 ? void 0 : _a.length);
}
registerWindowListener(windowEventName, pluginEventName) {
this.windowListeners[pluginEventName] = {
registered: false,
windowEventName,
pluginEventName,
handler: (event) => {
this.notifyListeners(pluginEventName, event);
}
};
}
unimplemented(msg = "not implemented") {
return new Capacitor.Exception(msg, ExceptionCode.Unimplemented);
}
unavailable(msg = "not available") {
return new Capacitor.Exception(msg, ExceptionCode.Unavailable);
}
async removeListener(eventName, listenerFunc) {
const listeners = this.listeners[eventName];
if (!listeners) {
return;
}
const index = listeners.indexOf(listenerFunc);
this.listeners[eventName].splice(index, 1);
if (!this.listeners[eventName].length) {
this.removeWindowListener(this.windowListeners[eventName]);
}
}
addWindowListener(handle) {
window.addEventListener(handle.windowEventName, handle.handler);
handle.registered = true;
}
removeWindowListener(handle) {
if (!handle) {
return;
}
window.removeEventListener(handle.windowEventName, handle.handler);
handle.registered = false;
}
sendRetainedArgumentsForEvent(eventName) {
const args = this.retainedEventArguments[eventName];
if (!args) {
return;
}
delete this.retainedEventArguments[eventName];
args.forEach((arg) => {
this.notifyListeners(eventName, arg);
});
}
}
const encode = (str) => encodeURIComponent(str).replace(/%(2[346B]|5E|60|7C)/g, decodeURIComponent).replace(/[()]/g, escape);
const decode = (str) => str.replace(/(%[\dA-F]{2})+/gi, decodeURIComponent);
class CapacitorCookiesPluginWeb extends WebPlugin {
async getCookies() {
const cookies = document.cookie;
const cookieMap = {};
cookies.split(";").forEach((cookie) => {
if (cookie.length <= 0)
return;
let [key, value] = cookie.replace(/=/, "CAP_COOKIE").split("CAP_COOKIE");
key = decode(key).trim();
value = decode(value).trim();
cookieMap[key] = value;
});
return cookieMap;
}
async setCookie(options) {
try {
const encodedKey = encode(options.key);
const encodedValue = encode(options.value);
const expires = `; expires=${(options.expires || "").replace("expires=", "")}`;
const path = (options.path || "/").replace("path=", "");
const domain = options.url != null && options.url.length > 0 ? `domain=${options.url}` : "";
document.cookie = `${encodedKey}=${encodedValue || ""}${expires}; path=${path}; ${domain};`;
} catch (error) {
return Promise.reject(error);
}
}
async deleteCookie(options) {
try {
document.cookie = `${options.key}=; Max-Age=0`;
} catch (error) {
return Promise.reject(error);
}
}
async clearCookies() {
try {
const cookies = document.cookie.split(";") || [];
for (const cookie of cookies) {
document.cookie = cookie.replace(/^ +/, "").replace(/=.*/, `=;expires=${(/* @__PURE__ */ new Date()).toUTCString()};path=/`);
}
} catch (error) {
return Promise.reject(error);
}
}
async clearAllCookies() {
try {
await this.clearCookies();
} catch (error) {
return Promise.reject(error);
}
}
}
registerPlugin("CapacitorCookies", {
web: () => new CapacitorCookiesPluginWeb()
});
const readBlobAsBase64 = async (blob) => new Promise((resolve, reject) => {
const reader = new FileReader();
reader.onload = () => {
const base64String = reader.result;
resolve(base64String.indexOf(",") >= 0 ? base64String.split(",")[1] : base64String);
};
reader.onerror = (error) => reject(error);
reader.readAsDataURL(blob);
});
const normalizeHttpHeaders = (headers = {}) => {
const originalKeys = Object.keys(headers);
const loweredKeys = Object.keys(headers).map((k) => k.toLocaleLowerCase());
const normalized = loweredKeys.reduce((acc, key, index) => {
acc[key] = headers[originalKeys[index]];
return acc;
}, {});
return normalized;
};
const buildUrlParams = (params, shouldEncode = true) => {
if (!params)
return null;
const output = Object.entries(params).reduce((accumulator, entry) => {
const [key, value] = entry;
let encodedValue;
let item;
if (Array.isArray(value)) {
item = "";
value.forEach((str) => {
encodedValue = shouldEncode ? encodeURIComponent(str) : str;
item += `${key}=${encodedValue}&`;
});
item.slice(0, -1);
} else {
encodedValue = shouldEncode ? encodeURIComponent(value) : value;
item = `${key}=${encodedValue}`;
}
return `${accumulator}&${item}`;
}, "");
return output.substr(1);
};
const buildRequestInit = (options, extra = {}) => {
const output = Object.assign({ method: options.method || "GET", headers: options.headers }, extra);
const headers = normalizeHttpHeaders(options.headers);
const type = headers["content-type"] || "";
if (typeof options.data === "string") {
output.body = options.data;
} else if (type.includes("application/x-www-form-urlencoded")) {
const params = new URLSearchParams();
for (const [key, value] of Object.entries(options.data || {})) {
params.set(key, value);
}
output.body = params.toString();
} else if (type.includes("multipart/form-data") || options.data instanceof FormData) {
const form = new FormData();
if (options.data instanceof FormData) {
options.data.forEach((value, key) => {
form.append(key, value);
});
} else {
for (const key of Object.keys(options.data)) {
form.append(key, options.data[key]);
}
}
output.body = form;
const headers2 = new Headers(output.headers);
headers2.delete("content-type");
output.headers = headers2;
} else if (type.includes("application/json") || typeof options.data === "object") {
output.body = JSON.stringify(options.data);
}
return output;
};
class CapacitorHttpPluginWeb extends WebPlugin {
/**
* Perform an Http request given a set of options
* @param options Options to build the HTTP request
*/
async request(options) {
const requestInit = buildRequestInit(options, options.webFetchExtra);
const urlParams = buildUrlParams(options.params, options.shouldEncodeUrlParams);
const url = urlParams ? `${options.url}?${urlParams}` : options.url;
const response = await fetch(url, requestInit);
const contentType = response.headers.get("content-type") || "";
let { responseType = "text" } = response.ok ? options : {};
if (contentType.includes("application/json")) {
responseType = "json";
}
let data;
let blob;
switch (responseType) {
case "arraybuffer":
case "blob":
blob = await response.blob();
data = await readBlobAsBase64(blob);
break;
case "json":
data = await response.json();
break;
case "document":
case "text":
default:
data = await response.text();
}
const headers = {};
response.headers.forEach((value, key) => {
headers[key] = value;
});
return {
data,
headers,
status: response.status,
url: response.url
};
}
/**
* Perform an Http GET request given a set of options
* @param options Options to build the HTTP request
*/
async get(options) {
return this.request(Object.assign(Object.assign({}, options), { method: "GET" }));
}
/**
* Perform an Http POST request given a set of options
* @param options Options to build the HTTP request
*/
async post(options) {
return this.request(Object.assign(Object.assign({}, options), { method: "POST" }));
}
/**
* Perform an Http PUT request given a set of options
* @param options Options to build the HTTP request
*/
async put(options) {
return this.request(Object.assign(Object.assign({}, options), { method: "PUT" }));
}
/**
* Perform an Http PATCH request given a set of options
* @param options Options to build the HTTP request
*/
async patch(options) {
return this.request(Object.assign(Object.assign({}, options), { method: "PATCH" }));
}
/**
* Perform an Http DELETE request given a set of options
* @param options Options to build the HTTP request
*/
async delete(options) {
return this.request(Object.assign(Object.assign({}, options), { method: "DELETE" }));
}
}
registerPlugin("CapacitorHttp", {
web: () => new CapacitorHttpPluginWeb()
});
const SplashScreen = registerPlugin("SplashScreen", {
web: () => __vitePreload(() => import("./web-Ce2qnWf_.js"), true ? [] : void 0).then((m) => new m.SplashScreenWeb())
});
var CameraSource;
(function(CameraSource2) {
CameraSource2["Prompt"] = "PROMPT";
CameraSource2["Camera"] = "CAMERA";
CameraSource2["Photos"] = "PHOTOS";
})(CameraSource || (CameraSource = {}));
var CameraDirection;
(function(CameraDirection2) {
CameraDirection2["Rear"] = "REAR";
CameraDirection2["Front"] = "FRONT";
})(CameraDirection || (CameraDirection = {}));
var CameraResultType;
(function(CameraResultType2) {
CameraResultType2["Uri"] = "uri";
CameraResultType2["Base64"] = "base64";
CameraResultType2["DataUrl"] = "dataUrl";
})(CameraResultType || (CameraResultType = {}));
class CameraWeb extends WebPlugin {
async getPhoto(options) {
return new Promise(async (resolve, reject) => {
if (options.webUseInput || options.source === CameraSource.Photos) {
this.fileInputExperience(options, resolve, reject);
} else if (options.source === CameraSource.Prompt) {
let actionSheet = document.querySelector("pwa-action-sheet");
if (!actionSheet) {
actionSheet = document.createElement("pwa-action-sheet");
document.body.appendChild(actionSheet);
}
actionSheet.header = options.promptLabelHeader || "Photo";
actionSheet.cancelable = false;
actionSheet.options = [
{ title: options.promptLabelPhoto || "From Photos" },
{ title: options.promptLabelPicture || "Take Picture" }
];
actionSheet.addEventListener("onSelection", async (e) => {
const selection = e.detail;
if (selection === 0) {
this.fileInputExperience(options, resolve, reject);
} else {
this.cameraExperience(options, resolve, reject);
}
});
} else {
this.cameraExperience(options, resolve, reject);
}
});
}
async pickImages(_options) {
return new Promise(async (resolve, reject) => {
this.multipleFileInputExperience(resolve, reject);
});
}
async cameraExperience(options, resolve, reject) {
if (customElements.get("pwa-camera-modal")) {
const cameraModal = document.createElement("pwa-camera-modal");
cameraModal.facingMode = options.direction === CameraDirection.Front ? "user" : "environment";
document.body.appendChild(cameraModal);
try {
await cameraModal.componentOnReady();
cameraModal.addEventListener("onPhoto", async (e) => {
const photo = e.detail;
if (photo === null) {
reject(new CapacitorException("User cancelled photos app"));
} else if (photo instanceof Error) {
reject(photo);
} else {
resolve(await this._getCameraPhoto(photo, options));
}
cameraModal.dismiss();
document.body.removeChild(cameraModal);
});
cameraModal.present();
} catch (e) {
this.fileInputExperience(options, resolve, reject);
}
} else {
console.error(`Unable to load PWA Element 'pwa-camera-modal'. See the docs: https://capacitorjs.com/docs/web/pwa-elements.`);
this.fileInputExperience(options, resolve, reject);
}
}
fileInputExperience(options, resolve, reject) {
let input = document.querySelector("#_capacitor-camera-input");
const cleanup = () => {
var _a;
(_a = input.parentNode) === null || _a === void 0 ? void 0 : _a.removeChild(input);
};
if (!input) {
input = document.createElement("input");
input.id = "_capacitor-camera-input";
input.type = "file";
input.hidden = true;
document.body.appendChild(input);
input.addEventListener("change", (_e) => {
const file = input.files[0];
let format = "jpeg";
if (file.type === "image/png") {
format = "png";
} else if (file.type === "image/gif") {
format = "gif";
}
if (options.resultType === "dataUrl" || options.resultType === "base64") {
const reader = new FileReader();
reader.addEventListener("load", () => {
if (options.resultType === "dataUrl") {
resolve({
dataUrl: reader.result,
format
});
} else if (options.resultType === "base64") {
const b64 = reader.result.split(",")[1];
resolve({
base64String: b64,
format
});
}
cleanup();
});
reader.readAsDataURL(file);
} else {
resolve({
webPath: URL.createObjectURL(file),
format
});
cleanup();
}
});
input.addEventListener("cancel", (_e) => {
reject(new CapacitorException("User cancelled photos app"));
cleanup();
});
}
input.accept = "image/*";
input.capture = true;
if (options.source === CameraSource.Photos || options.source === CameraSource.Prompt) {
input.removeAttribute("capture");
} else if (options.direction === CameraDirection.Front) {
input.capture = "user";
} else if (options.direction === CameraDirection.Rear) {
input.capture = "environment";
}
input.click();
}
multipleFileInputExperience(resolve, reject) {
let input = document.querySelector("#_capacitor-camera-input-multiple");
const cleanup = () => {
var _a;
(_a = input.parentNode) === null || _a === void 0 ? void 0 : _a.removeChild(input);
};
if (!input) {
input = document.createElement("input");
input.id = "_capacitor-camera-input-multiple";
input.type = "file";
input.hidden = true;
input.multiple = true;
document.body.appendChild(input);
input.addEventListener("change", (_e) => {
const photos = [];
for (let i = 0; i < input.files.length; i++) {
const file = input.files[i];
let format = "jpeg";
if (file.type === "image/png") {
format = "png";
} else if (file.type === "image/gif") {
format = "gif";
}
photos.push({
webPath: URL.createObjectURL(file),
format
});
}
resolve({ photos });
cleanup();
});
input.addEventListener("cancel", (_e) => {
reject(new CapacitorException("User cancelled photos app"));
cleanup();
});
}
input.accept = "image/*";
input.click();
}
_getCameraPhoto(photo, options) {
return new Promise((resolve, reject) => {
const reader = new FileReader();
const format = photo.type.split("/")[1];
if (options.resultType === "uri") {
resolve({
webPath: URL.createObjectURL(photo),
format,
saved: false
});
} else {
reader.readAsDataURL(photo);
reader.onloadend = () => {
const r = reader.result;
if (options.resultType === "dataUrl") {
resolve({
dataUrl: r,
format,
saved: false
});
} else {
resolve({
base64String: r.split(",")[1],
format,
saved: false
});
}
};
reader.onerror = (e) => {
reject(e);
};
}
});
}
async checkPermissions() {
if (typeof navigator === "undefined" || !navigator.permissions) {
throw this.unavailable("Permissions API not available in this browser");
}
try {
const permission = await window.navigator.permissions.query({
name: "camera"
});
return {
camera: permission.state,
photos: "granted"
};
} catch (_a) {
throw this.unavailable("Camera permissions are not available in this browser");
}
}
async requestPermissions() {
throw this.unimplemented("Not implemented on web.");
}
async pickLimitedLibraryPhotos() {
throw this.unavailable("Not implemented on web.");
}
async getLimitedLibraryPhotos() {
throw this.unavailable("Not implemented on web.");
}
}
const Camera = registerPlugin("Camera", {
web: () => new CameraWeb()
});
window.customElements.define(
"capacitor-welcome",
class extends HTMLElement {
constructor() {
super();
SplashScreen.hide();
const root = this.attachShadow({ mode: "open" });
root.innerHTML = `
<style>
:host {
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
display: block;
width: 100%;
height: 100%;
}
h1, h2, h3, h4, h5 {
text-transform: uppercase;
}
.button {
display: inline-block;
padding: 10px;
background-color: #b71b1bff;
color: #fff;
font-size: 0.9em;
border: 0;
border-radius: 3px;
text-decoration: none;
cursor: pointer;
}
main {
padding: 15px;
}
main hr { height: 1px; background-color: #eee; border: 0; }
main h1 {
font-size: 1.4em;
text-transform: uppercase;
letter-spacing: 1px;
}
main h2 {
font-size: 1.1em;
}
main h3 {
font-size: 0.9em;
}
main p {
color: #333;
}
main pre {
white-space: pre-line;
}
</style>
<div>
<capacitor-welcome-titlebar>
<h1>Capacitor</h1>
</capacitor-welcome-titlebar>
<main>
<p>
Capacitor makes it easy to build powerful apps for the app stores, mobile web (Progressive Web Apps), and desktop, all
with a single code base.
</p>
<h2>Getting Started</h2>
<p>
You'll probably need a UI framework to build a full-featured app. Might we recommend
<a target="_blank" href="http://ionicframework.com/">Ionic</a>?
</p>
<p>
Visit <a href="https://capacitorjs.com">capacitorjs.com</a> for information
on using native features, building plugins, and more.
</p>
<a href="https://capacitorjs.com" target="_blank" class="button">Read more</a>
<h2>Tiny Demo</h2>
<p>
This demo shows how to call Capacitor plugins. Say cheese!
</p>
<p>
<button class="button" id="take-photo">Take Photo</button>
</p>
<p>
<img id="image" style="max-width: 100%">
</p>
</main>
</div>
`;
}
connectedCallback() {
const self2 = this;
self2.shadowRoot.querySelector("#take-photo").addEventListener("click", async function(e) {
try {
const photo = await Camera.getPhoto({
resultType: "uri"
});
const image = self2.shadowRoot.querySelector("#image");
if (!image) {
return;
}
image.src = photo.webPath;
} catch (e2) {
console.warn("User cancelled", e2);
}
});
}
}
);
window.customElements.define(
"capacitor-welcome-titlebar",
class extends HTMLElement {
constructor() {
super();
const root = this.attachShadow({ mode: "open" });
root.innerHTML = `
<style>
:host {
position: relative;
display: block;
padding: 15px 15px 15px 15px;
text-align: center;
background-color: #73B5F6;
}
::slotted(h1) {
margin: 0;
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
font-size: 0.9em;
font-weight: 600;
color: #fff;
}
</style>
<slot></slot>
`;
}
}
);
export {
WebPlugin as W
};