mapomodule
Version:
Mapo is a nuxt module that helps in the creation of Administration Panels.
1,459 lines (1,412 loc) • 80.1 kB
JavaScript
import process from 'node:process';globalThis._importMeta_={url:import.meta.url,env:process.env};import { tmpdir } from 'node:os';
import { defineEventHandler, handleCacheHeaders, splitCookiesString, createEvent, fetchWithEvent, isEvent, eventHandler, setHeaders, sendRedirect, proxyRequest, getRequestHeader, setResponseHeaders, setResponseStatus, send, getRequestHeaders, setResponseHeader, getRequestURL, getResponseHeader, getQuery as getQuery$1, readBody, createApp, createRouter as createRouter$1, toNodeListener, lazyEventHandler, getResponseStatus, createError, getRouterParam, getResponseStatusText } from 'file:///Volumes/Development/Lotrek/Projects/mapo/node_modules/.pnpm/h3@1.15.3/node_modules/h3/dist/index.mjs';
import { Server } from 'node:http';
import { resolve, dirname, join } from 'node:path';
import nodeCrypto from 'node:crypto';
import { parentPort, threadId } from 'node:worker_threads';
import { escapeHtml } from 'file:///Volumes/Development/Lotrek/Projects/mapo/node_modules/.pnpm/@vue+shared@3.5.16/node_modules/@vue/shared/dist/shared.cjs.js';
import { createRenderer, getRequestDependencies, getPreloadLinks, getPrefetchLinks } from 'file:///Volumes/Development/Lotrek/Projects/mapo/node_modules/.pnpm/vue-bundle-renderer@2.1.1/node_modules/vue-bundle-renderer/dist/runtime.mjs';
import { renderToString } from 'file:///Volumes/Development/Lotrek/Projects/mapo/node_modules/.pnpm/vue@3.5.16_typescript@5.8.3/node_modules/vue/server-renderer/index.mjs';
import destr, { destr as destr$1 } from 'file:///Volumes/Development/Lotrek/Projects/mapo/node_modules/.pnpm/destr@2.0.5/node_modules/destr/dist/index.mjs';
import { createHooks } from 'file:///Volumes/Development/Lotrek/Projects/mapo/node_modules/.pnpm/hookable@5.5.3/node_modules/hookable/dist/index.mjs';
import { createFetch, Headers as Headers$1 } from 'file:///Volumes/Development/Lotrek/Projects/mapo/node_modules/.pnpm/ofetch@1.4.1/node_modules/ofetch/dist/node.mjs';
import { fetchNodeRequestHandler, callNodeRequestHandler } from 'file:///Volumes/Development/Lotrek/Projects/mapo/node_modules/.pnpm/node-mock-http@1.0.0/node_modules/node-mock-http/dist/index.mjs';
import { createStorage, prefixStorage } from 'file:///Volumes/Development/Lotrek/Projects/mapo/node_modules/.pnpm/unstorage@1.16.0_db0@0.3.2_ioredis@5.6.1/node_modules/unstorage/dist/index.mjs';
import unstorage_47drivers_47fs from 'file:///Volumes/Development/Lotrek/Projects/mapo/node_modules/.pnpm/unstorage@1.16.0_db0@0.3.2_ioredis@5.6.1/node_modules/unstorage/drivers/fs.mjs';
import { digest } from 'file:///Volumes/Development/Lotrek/Projects/mapo/node_modules/.pnpm/ohash@2.0.11/node_modules/ohash/dist/index.mjs';
import { klona } from 'file:///Volumes/Development/Lotrek/Projects/mapo/node_modules/.pnpm/klona@2.0.6/node_modules/klona/dist/index.mjs';
import defu, { defuFn } from 'file:///Volumes/Development/Lotrek/Projects/mapo/node_modules/.pnpm/defu@6.1.4/node_modules/defu/dist/defu.mjs';
import { snakeCase } from 'file:///Volumes/Development/Lotrek/Projects/mapo/node_modules/.pnpm/scule@1.3.0/node_modules/scule/dist/index.mjs';
import { getContext } from 'file:///Volumes/Development/Lotrek/Projects/mapo/node_modules/.pnpm/unctx@2.4.1/node_modules/unctx/dist/index.mjs';
import { toRouteMatcher, createRouter } from 'file:///Volumes/Development/Lotrek/Projects/mapo/node_modules/.pnpm/radix3@1.1.2/node_modules/radix3/dist/index.mjs';
import { readFile } from 'node:fs/promises';
import consola, { consola as consola$1 } from 'file:///Volumes/Development/Lotrek/Projects/mapo/node_modules/.pnpm/consola@3.4.2/node_modules/consola/dist/index.mjs';
import { ErrorParser } from 'file:///Volumes/Development/Lotrek/Projects/mapo/node_modules/.pnpm/youch-core@0.3.2/node_modules/youch-core/build/index.js';
import { Youch } from 'file:///Volumes/Development/Lotrek/Projects/mapo/node_modules/.pnpm/youch@4.1.0-beta.8/node_modules/youch/build/index.js';
import { SourceMapConsumer } from 'file:///Volumes/Development/Lotrek/Projects/mapo/node_modules/.pnpm/source-map@0.7.4/node_modules/source-map/source-map.js';
import { AsyncLocalStorage } from 'node:async_hooks';
import { stringify, uneval } from 'file:///Volumes/Development/Lotrek/Projects/mapo/node_modules/.pnpm/devalue@5.1.1/node_modules/devalue/index.js';
import { captureRawStackTrace, parseRawStackTrace } from 'file:///Volumes/Development/Lotrek/Projects/mapo/node_modules/.pnpm/errx@0.1.0/node_modules/errx/dist/index.js';
import { isVNode, toValue, isRef } from 'file:///Volumes/Development/Lotrek/Projects/mapo/node_modules/.pnpm/vue@3.5.16_typescript@5.8.3/node_modules/vue/index.mjs';
import { createHead as createHead$1, propsToString, renderSSRHead } from 'file:///Volumes/Development/Lotrek/Projects/mapo/node_modules/.pnpm/unhead@2.0.10/node_modules/unhead/dist/server.mjs';
import { DeprecationsPlugin, PromisesPlugin, TemplateParamsPlugin, AliasSortingPlugin } from 'file:///Volumes/Development/Lotrek/Projects/mapo/node_modules/.pnpm/unhead@2.0.10/node_modules/unhead/dist/plugins.mjs';
import { walkResolver } from 'file:///Volumes/Development/Lotrek/Projects/mapo/node_modules/.pnpm/unhead@2.0.10/node_modules/unhead/dist/utils.mjs';
const HASH_RE = /#/g;
const AMPERSAND_RE = /&/g;
const SLASH_RE = /\//g;
const EQUAL_RE = /=/g;
const PLUS_RE = /\+/g;
const ENC_CARET_RE = /%5e/gi;
const ENC_BACKTICK_RE = /%60/gi;
const ENC_PIPE_RE = /%7c/gi;
const ENC_SPACE_RE = /%20/gi;
function encode(text) {
return encodeURI("" + text).replace(ENC_PIPE_RE, "|");
}
function encodeQueryValue(input) {
return encode(typeof input === "string" ? input : JSON.stringify(input)).replace(PLUS_RE, "%2B").replace(ENC_SPACE_RE, "+").replace(HASH_RE, "%23").replace(AMPERSAND_RE, "%26").replace(ENC_BACKTICK_RE, "`").replace(ENC_CARET_RE, "^").replace(SLASH_RE, "%2F");
}
function encodeQueryKey(text) {
return encodeQueryValue(text).replace(EQUAL_RE, "%3D");
}
function decode(text = "") {
try {
return decodeURIComponent("" + text);
} catch {
return "" + text;
}
}
function decodeQueryKey(text) {
return decode(text.replace(PLUS_RE, " "));
}
function decodeQueryValue(text) {
return decode(text.replace(PLUS_RE, " "));
}
function parseQuery(parametersString = "") {
const object = /* @__PURE__ */ Object.create(null);
if (parametersString[0] === "?") {
parametersString = parametersString.slice(1);
}
for (const parameter of parametersString.split("&")) {
const s = parameter.match(/([^=]+)=?(.*)/) || [];
if (s.length < 2) {
continue;
}
const key = decodeQueryKey(s[1]);
if (key === "__proto__" || key === "constructor") {
continue;
}
const value = decodeQueryValue(s[2] || "");
if (object[key] === void 0) {
object[key] = value;
} else if (Array.isArray(object[key])) {
object[key].push(value);
} else {
object[key] = [object[key], value];
}
}
return object;
}
function encodeQueryItem(key, value) {
if (typeof value === "number" || typeof value === "boolean") {
value = String(value);
}
if (!value) {
return encodeQueryKey(key);
}
if (Array.isArray(value)) {
return value.map(
(_value) => `${encodeQueryKey(key)}=${encodeQueryValue(_value)}`
).join("&");
}
return `${encodeQueryKey(key)}=${encodeQueryValue(value)}`;
}
function stringifyQuery(query) {
return Object.keys(query).filter((k) => query[k] !== void 0).map((k) => encodeQueryItem(k, query[k])).filter(Boolean).join("&");
}
const PROTOCOL_STRICT_REGEX = /^[\s\w\0+.-]{2,}:([/\\]{1,2})/;
const PROTOCOL_REGEX = /^[\s\w\0+.-]{2,}:([/\\]{2})?/;
const PROTOCOL_RELATIVE_REGEX = /^([/\\]\s*){2,}[^/\\]/;
const JOIN_LEADING_SLASH_RE = /^\.?\//;
function hasProtocol(inputString, opts = {}) {
if (typeof opts === "boolean") {
opts = { acceptRelative: opts };
}
if (opts.strict) {
return PROTOCOL_STRICT_REGEX.test(inputString);
}
return PROTOCOL_REGEX.test(inputString) || (opts.acceptRelative ? PROTOCOL_RELATIVE_REGEX.test(inputString) : false);
}
function hasTrailingSlash(input = "", respectQueryAndFragment) {
{
return input.endsWith("/");
}
}
function withoutTrailingSlash(input = "", respectQueryAndFragment) {
{
return (hasTrailingSlash(input) ? input.slice(0, -1) : input) || "/";
}
}
function withTrailingSlash(input = "", respectQueryAndFragment) {
{
return input.endsWith("/") ? input : input + "/";
}
}
function withoutBase(input, base) {
if (isEmptyURL(base)) {
return input;
}
const _base = withoutTrailingSlash(base);
if (!input.startsWith(_base)) {
return input;
}
const trimmed = input.slice(_base.length);
return trimmed[0] === "/" ? trimmed : "/" + trimmed;
}
function withQuery(input, query) {
const parsed = parseURL(input);
const mergedQuery = { ...parseQuery(parsed.search), ...query };
parsed.search = stringifyQuery(mergedQuery);
return stringifyParsedURL(parsed);
}
function getQuery(input) {
return parseQuery(parseURL(input).search);
}
function isEmptyURL(url) {
return !url || url === "/";
}
function isNonEmptyURL(url) {
return url && url !== "/";
}
function joinURL(base, ...input) {
let url = base || "";
for (const segment of input.filter((url2) => isNonEmptyURL(url2))) {
if (url) {
const _segment = segment.replace(JOIN_LEADING_SLASH_RE, "");
url = withTrailingSlash(url) + _segment;
} else {
url = segment;
}
}
return url;
}
function joinRelativeURL(..._input) {
const JOIN_SEGMENT_SPLIT_RE = /\/(?!\/)/;
const input = _input.filter(Boolean);
const segments = [];
let segmentsDepth = 0;
for (const i of input) {
if (!i || i === "/") {
continue;
}
for (const [sindex, s] of i.split(JOIN_SEGMENT_SPLIT_RE).entries()) {
if (!s || s === ".") {
continue;
}
if (s === "..") {
if (segments.length === 1 && hasProtocol(segments[0])) {
continue;
}
segments.pop();
segmentsDepth--;
continue;
}
if (sindex === 1 && segments[segments.length - 1]?.endsWith(":/")) {
segments[segments.length - 1] += "/" + s;
continue;
}
segments.push(s);
segmentsDepth++;
}
}
let url = segments.join("/");
if (segmentsDepth >= 0) {
if (input[0]?.startsWith("/") && !url.startsWith("/")) {
url = "/" + url;
} else if (input[0]?.startsWith("./") && !url.startsWith("./")) {
url = "./" + url;
}
} else {
url = "../".repeat(-1 * segmentsDepth) + url;
}
if (input[input.length - 1]?.endsWith("/") && !url.endsWith("/")) {
url += "/";
}
return url;
}
const protocolRelative = Symbol.for("ufo:protocolRelative");
function parseURL(input = "", defaultProto) {
const _specialProtoMatch = input.match(
/^[\s\0]*(blob:|data:|javascript:|vbscript:)(.*)/i
);
if (_specialProtoMatch) {
const [, _proto, _pathname = ""] = _specialProtoMatch;
return {
protocol: _proto.toLowerCase(),
pathname: _pathname,
href: _proto + _pathname,
auth: "",
host: "",
search: "",
hash: ""
};
}
if (!hasProtocol(input, { acceptRelative: true })) {
return parsePath(input);
}
const [, protocol = "", auth, hostAndPath = ""] = input.replace(/\\/g, "/").match(/^[\s\0]*([\w+.-]{2,}:)?\/\/([^/@]+@)?(.*)/) || [];
let [, host = "", path = ""] = hostAndPath.match(/([^#/?]*)(.*)?/) || [];
if (protocol === "file:") {
path = path.replace(/\/(?=[A-Za-z]:)/, "");
}
const { pathname, search, hash } = parsePath(path);
return {
protocol: protocol.toLowerCase(),
auth: auth ? auth.slice(0, Math.max(0, auth.length - 1)) : "",
host,
pathname,
search,
hash,
[protocolRelative]: !protocol
};
}
function parsePath(input = "") {
const [pathname = "", search = "", hash = ""] = (input.match(/([^#?]*)(\?[^#]*)?(#.*)?/) || []).splice(1);
return {
pathname,
search,
hash
};
}
function stringifyParsedURL(parsed) {
const pathname = parsed.pathname || "";
const search = parsed.search ? (parsed.search.startsWith("?") ? "" : "?") + parsed.search : "";
const hash = parsed.hash || "";
const auth = parsed.auth ? parsed.auth + "@" : "";
const host = parsed.host || "";
const proto = parsed.protocol || parsed[protocolRelative] ? (parsed.protocol || "") + "//" : "";
return proto + auth + host + pathname + search + hash;
}
const serverAssets = [{"baseName":"server","dir":"/Volumes/Development/Lotrek/Projects/mapo/packages/mapomodule/server/assets"}];
const assets = createStorage();
for (const asset of serverAssets) {
assets.mount(asset.baseName, unstorage_47drivers_47fs({ base: asset.dir, ignore: (asset?.ignore || []) }));
}
const storage = createStorage({});
storage.mount('/assets', assets);
storage.mount('root', unstorage_47drivers_47fs({"driver":"fs","readOnly":true,"base":"/Volumes/Development/Lotrek/Projects/mapo/packages/mapomodule","watchOptions":{"ignored":[null]}}));
storage.mount('src', unstorage_47drivers_47fs({"driver":"fs","readOnly":true,"base":"/Volumes/Development/Lotrek/Projects/mapo/packages/mapomodule/server","watchOptions":{"ignored":[null]}}));
storage.mount('build', unstorage_47drivers_47fs({"driver":"fs","readOnly":false,"base":"/Volumes/Development/Lotrek/Projects/mapo/packages/mapomodule/.nuxt"}));
storage.mount('cache', unstorage_47drivers_47fs({"driver":"fs","readOnly":false,"base":"/Volumes/Development/Lotrek/Projects/mapo/packages/mapomodule/.nuxt/cache"}));
storage.mount('data', unstorage_47drivers_47fs({"driver":"fs","base":"/Volumes/Development/Lotrek/Projects/mapo/packages/mapomodule/.data/kv"}));
function useStorage(base = "") {
return base ? prefixStorage(storage, base) : storage;
}
const Hasher = /* @__PURE__ */ (() => {
class Hasher2 {
buff = "";
#context = /* @__PURE__ */ new Map();
write(str) {
this.buff += str;
}
dispatch(value) {
const type = value === null ? "null" : typeof value;
return this[type](value);
}
object(object) {
if (object && typeof object.toJSON === "function") {
return this.object(object.toJSON());
}
const objString = Object.prototype.toString.call(object);
let objType = "";
const objectLength = objString.length;
objType = objectLength < 10 ? "unknown:[" + objString + "]" : objString.slice(8, objectLength - 1);
objType = objType.toLowerCase();
let objectNumber = null;
if ((objectNumber = this.#context.get(object)) === void 0) {
this.#context.set(object, this.#context.size);
} else {
return this.dispatch("[CIRCULAR:" + objectNumber + "]");
}
if (typeof Buffer !== "undefined" && Buffer.isBuffer && Buffer.isBuffer(object)) {
this.write("buffer:");
return this.write(object.toString("utf8"));
}
if (objType !== "object" && objType !== "function" && objType !== "asyncfunction") {
if (this[objType]) {
this[objType](object);
} else {
this.unknown(object, objType);
}
} else {
const keys = Object.keys(object).sort();
const extraKeys = [];
this.write("object:" + (keys.length + extraKeys.length) + ":");
const dispatchForKey = (key) => {
this.dispatch(key);
this.write(":");
this.dispatch(object[key]);
this.write(",");
};
for (const key of keys) {
dispatchForKey(key);
}
for (const key of extraKeys) {
dispatchForKey(key);
}
}
}
array(arr, unordered) {
unordered = unordered === void 0 ? false : unordered;
this.write("array:" + arr.length + ":");
if (!unordered || arr.length <= 1) {
for (const entry of arr) {
this.dispatch(entry);
}
return;
}
const contextAdditions = /* @__PURE__ */ new Map();
const entries = arr.map((entry) => {
const hasher = new Hasher2();
hasher.dispatch(entry);
for (const [key, value] of hasher.#context) {
contextAdditions.set(key, value);
}
return hasher.toString();
});
this.#context = contextAdditions;
entries.sort();
return this.array(entries, false);
}
date(date) {
return this.write("date:" + date.toJSON());
}
symbol(sym) {
return this.write("symbol:" + sym.toString());
}
unknown(value, type) {
this.write(type);
if (!value) {
return;
}
this.write(":");
if (value && typeof value.entries === "function") {
return this.array(
[...value.entries()],
true
/* ordered */
);
}
}
error(err) {
return this.write("error:" + err.toString());
}
boolean(bool) {
return this.write("bool:" + bool);
}
string(string) {
this.write("string:" + string.length + ":");
this.write(string);
}
function(fn) {
this.write("fn:");
if (isNativeFunction(fn)) {
this.dispatch("[native]");
} else {
this.dispatch(fn.toString());
}
}
number(number) {
return this.write("number:" + number);
}
null() {
return this.write("Null");
}
undefined() {
return this.write("Undefined");
}
regexp(regex) {
return this.write("regex:" + regex.toString());
}
arraybuffer(arr) {
this.write("arraybuffer:");
return this.dispatch(new Uint8Array(arr));
}
url(url) {
return this.write("url:" + url.toString());
}
map(map) {
this.write("map:");
const arr = [...map];
return this.array(arr, false);
}
set(set) {
this.write("set:");
const arr = [...set];
return this.array(arr, false);
}
bigint(number) {
return this.write("bigint:" + number.toString());
}
}
for (const type of [
"uint8array",
"uint8clampedarray",
"unt8array",
"uint16array",
"unt16array",
"uint32array",
"unt32array",
"float32array",
"float64array"
]) {
Hasher2.prototype[type] = function(arr) {
this.write(type + ":");
return this.array([...arr], false);
};
}
function isNativeFunction(f) {
if (typeof f !== "function") {
return false;
}
return Function.prototype.toString.call(f).slice(
-15
/* "[native code] }".length */
) === "[native code] }";
}
return Hasher2;
})();
function serialize(object) {
const hasher = new Hasher();
hasher.dispatch(object);
return hasher.buff;
}
function hash(value) {
return digest(typeof value === "string" ? value : serialize(value)).replace(/[-_]/g, "").slice(0, 10);
}
function defaultCacheOptions() {
return {
name: "_",
base: "/cache",
swr: true,
maxAge: 1
};
}
function defineCachedFunction(fn, opts = {}) {
opts = { ...defaultCacheOptions(), ...opts };
const pending = {};
const group = opts.group || "nitro/functions";
const name = opts.name || fn.name || "_";
const integrity = opts.integrity || hash([fn, opts]);
const validate = opts.validate || ((entry) => entry.value !== void 0);
async function get(key, resolver, shouldInvalidateCache, event) {
const cacheKey = [opts.base, group, name, key + ".json"].filter(Boolean).join(":").replace(/:\/$/, ":index");
let entry = await useStorage().getItem(cacheKey).catch((error) => {
console.error(`[cache] Cache read error.`, error);
useNitroApp().captureError(error, { event, tags: ["cache"] });
}) || {};
if (typeof entry !== "object") {
entry = {};
const error = new Error("Malformed data read from cache.");
console.error("[cache]", error);
useNitroApp().captureError(error, { event, tags: ["cache"] });
}
const ttl = (opts.maxAge ?? 0) * 1e3;
if (ttl) {
entry.expires = Date.now() + ttl;
}
const expired = shouldInvalidateCache || entry.integrity !== integrity || ttl && Date.now() - (entry.mtime || 0) > ttl || validate(entry) === false;
const _resolve = async () => {
const isPending = pending[key];
if (!isPending) {
if (entry.value !== void 0 && (opts.staleMaxAge || 0) >= 0 && opts.swr === false) {
entry.value = void 0;
entry.integrity = void 0;
entry.mtime = void 0;
entry.expires = void 0;
}
pending[key] = Promise.resolve(resolver());
}
try {
entry.value = await pending[key];
} catch (error) {
if (!isPending) {
delete pending[key];
}
throw error;
}
if (!isPending) {
entry.mtime = Date.now();
entry.integrity = integrity;
delete pending[key];
if (validate(entry) !== false) {
let setOpts;
if (opts.maxAge && !opts.swr) {
setOpts = { ttl: opts.maxAge };
}
const promise = useStorage().setItem(cacheKey, entry, setOpts).catch((error) => {
console.error(`[cache] Cache write error.`, error);
useNitroApp().captureError(error, { event, tags: ["cache"] });
});
if (event?.waitUntil) {
event.waitUntil(promise);
}
}
}
};
const _resolvePromise = expired ? _resolve() : Promise.resolve();
if (entry.value === void 0) {
await _resolvePromise;
} else if (expired && event && event.waitUntil) {
event.waitUntil(_resolvePromise);
}
if (opts.swr && validate(entry) !== false) {
_resolvePromise.catch((error) => {
console.error(`[cache] SWR handler error.`, error);
useNitroApp().captureError(error, { event, tags: ["cache"] });
});
return entry;
}
return _resolvePromise.then(() => entry);
}
return async (...args) => {
const shouldBypassCache = await opts.shouldBypassCache?.(...args);
if (shouldBypassCache) {
return fn(...args);
}
const key = await (opts.getKey || getKey)(...args);
const shouldInvalidateCache = await opts.shouldInvalidateCache?.(...args);
const entry = await get(
key,
() => fn(...args),
shouldInvalidateCache,
args[0] && isEvent(args[0]) ? args[0] : void 0
);
let value = entry.value;
if (opts.transform) {
value = await opts.transform(entry, ...args) || value;
}
return value;
};
}
function cachedFunction(fn, opts = {}) {
return defineCachedFunction(fn, opts);
}
function getKey(...args) {
return args.length > 0 ? hash(args) : "";
}
function escapeKey(key) {
return String(key).replace(/\W/g, "");
}
function defineCachedEventHandler(handler, opts = defaultCacheOptions()) {
const variableHeaderNames = (opts.varies || []).filter(Boolean).map((h) => h.toLowerCase()).sort();
const _opts = {
...opts,
getKey: async (event) => {
const customKey = await opts.getKey?.(event);
if (customKey) {
return escapeKey(customKey);
}
const _path = event.node.req.originalUrl || event.node.req.url || event.path;
let _pathname;
try {
_pathname = escapeKey(decodeURI(parseURL(_path).pathname)).slice(0, 16) || "index";
} catch {
_pathname = "-";
}
const _hashedPath = `${_pathname}.${hash(_path)}`;
const _headers = variableHeaderNames.map((header) => [header, event.node.req.headers[header]]).map(([name, value]) => `${escapeKey(name)}.${hash(value)}`);
return [_hashedPath, ..._headers].join(":");
},
validate: (entry) => {
if (!entry.value) {
return false;
}
if (entry.value.code >= 400) {
return false;
}
if (entry.value.body === void 0) {
return false;
}
if (entry.value.headers.etag === "undefined" || entry.value.headers["last-modified"] === "undefined") {
return false;
}
return true;
},
group: opts.group || "nitro/handlers",
integrity: opts.integrity || hash([handler, opts])
};
const _cachedHandler = cachedFunction(
async (incomingEvent) => {
const variableHeaders = {};
for (const header of variableHeaderNames) {
const value = incomingEvent.node.req.headers[header];
if (value !== void 0) {
variableHeaders[header] = value;
}
}
const reqProxy = cloneWithProxy(incomingEvent.node.req, {
headers: variableHeaders
});
const resHeaders = {};
let _resSendBody;
const resProxy = cloneWithProxy(incomingEvent.node.res, {
statusCode: 200,
writableEnded: false,
writableFinished: false,
headersSent: false,
closed: false,
getHeader(name) {
return resHeaders[name];
},
setHeader(name, value) {
resHeaders[name] = value;
return this;
},
getHeaderNames() {
return Object.keys(resHeaders);
},
hasHeader(name) {
return name in resHeaders;
},
removeHeader(name) {
delete resHeaders[name];
},
getHeaders() {
return resHeaders;
},
end(chunk, arg2, arg3) {
if (typeof chunk === "string") {
_resSendBody = chunk;
}
if (typeof arg2 === "function") {
arg2();
}
if (typeof arg3 === "function") {
arg3();
}
return this;
},
write(chunk, arg2, arg3) {
if (typeof chunk === "string") {
_resSendBody = chunk;
}
if (typeof arg2 === "function") {
arg2(void 0);
}
if (typeof arg3 === "function") {
arg3();
}
return true;
},
writeHead(statusCode, headers2) {
this.statusCode = statusCode;
if (headers2) {
if (Array.isArray(headers2) || typeof headers2 === "string") {
throw new TypeError("Raw headers is not supported.");
}
for (const header in headers2) {
const value = headers2[header];
if (value !== void 0) {
this.setHeader(
header,
value
);
}
}
}
return this;
}
});
const event = createEvent(reqProxy, resProxy);
event.fetch = (url, fetchOptions) => fetchWithEvent(event, url, fetchOptions, {
fetch: useNitroApp().localFetch
});
event.$fetch = (url, fetchOptions) => fetchWithEvent(event, url, fetchOptions, {
fetch: globalThis.$fetch
});
event.waitUntil = incomingEvent.waitUntil;
event.context = incomingEvent.context;
event.context.cache = {
options: _opts
};
const body = await handler(event) || _resSendBody;
const headers = event.node.res.getHeaders();
headers.etag = String(
headers.Etag || headers.etag || `W/"${hash(body)}"`
);
headers["last-modified"] = String(
headers["Last-Modified"] || headers["last-modified"] || (/* @__PURE__ */ new Date()).toUTCString()
);
const cacheControl = [];
if (opts.swr) {
if (opts.maxAge) {
cacheControl.push(`s-maxage=${opts.maxAge}`);
}
if (opts.staleMaxAge) {
cacheControl.push(`stale-while-revalidate=${opts.staleMaxAge}`);
} else {
cacheControl.push("stale-while-revalidate");
}
} else if (opts.maxAge) {
cacheControl.push(`max-age=${opts.maxAge}`);
}
if (cacheControl.length > 0) {
headers["cache-control"] = cacheControl.join(", ");
}
const cacheEntry = {
code: event.node.res.statusCode,
headers,
body
};
return cacheEntry;
},
_opts
);
return defineEventHandler(async (event) => {
if (opts.headersOnly) {
if (handleCacheHeaders(event, { maxAge: opts.maxAge })) {
return;
}
return handler(event);
}
const response = await _cachedHandler(
event
);
if (event.node.res.headersSent || event.node.res.writableEnded) {
return response.body;
}
if (handleCacheHeaders(event, {
modifiedTime: new Date(response.headers["last-modified"]),
etag: response.headers.etag,
maxAge: opts.maxAge
})) {
return;
}
event.node.res.statusCode = response.code;
for (const name in response.headers) {
const value = response.headers[name];
if (name === "set-cookie") {
event.node.res.appendHeader(
name,
splitCookiesString(value)
);
} else {
if (value !== void 0) {
event.node.res.setHeader(name, value);
}
}
}
return response.body;
});
}
function cloneWithProxy(obj, overrides) {
return new Proxy(obj, {
get(target, property, receiver) {
if (property in overrides) {
return overrides[property];
}
return Reflect.get(target, property, receiver);
},
set(target, property, value, receiver) {
if (property in overrides) {
overrides[property] = value;
return true;
}
return Reflect.set(target, property, value, receiver);
}
});
}
const cachedEventHandler = defineCachedEventHandler;
const inlineAppConfig = {
"nuxt": {}
};
const appConfig = defuFn(inlineAppConfig);
function getEnv(key, opts) {
const envKey = snakeCase(key).toUpperCase();
return destr(
process.env[opts.prefix + envKey] ?? process.env[opts.altPrefix + envKey]
);
}
function _isObject(input) {
return typeof input === "object" && !Array.isArray(input);
}
function applyEnv(obj, opts, parentKey = "") {
for (const key in obj) {
const subKey = parentKey ? `${parentKey}_${key}` : key;
const envValue = getEnv(subKey, opts);
if (_isObject(obj[key])) {
if (_isObject(envValue)) {
obj[key] = { ...obj[key], ...envValue };
applyEnv(obj[key], opts, subKey);
} else if (envValue === void 0) {
applyEnv(obj[key], opts, subKey);
} else {
obj[key] = envValue ?? obj[key];
}
} else {
obj[key] = envValue ?? obj[key];
}
if (opts.envExpansion && typeof obj[key] === "string") {
obj[key] = _expandFromEnv(obj[key]);
}
}
return obj;
}
const envExpandRx = /\{\{([^{}]*)\}\}/g;
function _expandFromEnv(value) {
return value.replace(envExpandRx, (match, key) => {
return process.env[key] || match;
});
}
const _inlineRuntimeConfig = {
"app": {
"baseURL": "/",
"buildId": "dev",
"buildAssetsDir": "/_nuxt/",
"cdnURL": ""
},
"nitro": {
"envPrefix": "NUXT_",
"routeRules": {
"/__nuxt_error": {
"cache": false
}
}
},
"public": {
"i18n": {
"baseUrl": "",
"defaultLocale": "en",
"defaultDirection": "ltr",
"strategy": "no_prefix",
"lazy": true,
"rootRedirect": "",
"routesNameSeparator": "___",
"defaultLocaleRouteNameSuffix": "default",
"skipSettingLocaleOnNavigate": false,
"differentDomains": false,
"trailingSlash": false,
"locales": [
{
"code": "en",
"name": "English",
"iso": "en-US",
"files": [
"/Volumes/Development/Lotrek/Projects/mapo/packages/@mapomodule/uikit/i18n/locales/en-US.ts"
]
},
{
"code": "it",
"name": "Italiano",
"iso": "it-IT",
"files": [
"/Volumes/Development/Lotrek/Projects/mapo/packages/@mapomodule/uikit/i18n/locales/it-IT.ts"
]
}
],
"detectBrowserLanguage": {
"alwaysRedirect": false,
"cookieCrossOrigin": false,
"cookieDomain": "",
"cookieKey": "i18n_redirected",
"cookieSecure": false,
"fallbackLocale": "",
"redirectOn": "root",
"useCookie": true
},
"experimental": {
"localeDetector": "",
"switchLocalePathLinkSSR": false,
"autoImportTranslationFunctions": false,
"typedPages": true,
"typedOptionsAndMessages": false,
"generatedLocaleFilePathFormat": "absolute",
"alternateLinkCanonicalQueries": false,
"hmr": true
},
"multiDomainLocales": false
}
}
};
const envOptions = {
prefix: "NITRO_",
altPrefix: _inlineRuntimeConfig.nitro.envPrefix ?? process.env.NITRO_ENV_PREFIX ?? "_",
envExpansion: _inlineRuntimeConfig.nitro.envExpansion ?? process.env.NITRO_ENV_EXPANSION ?? false
};
const _sharedRuntimeConfig = _deepFreeze(
applyEnv(klona(_inlineRuntimeConfig), envOptions)
);
function useRuntimeConfig(event) {
if (!event) {
return _sharedRuntimeConfig;
}
if (event.context.nitro.runtimeConfig) {
return event.context.nitro.runtimeConfig;
}
const runtimeConfig = klona(_inlineRuntimeConfig);
applyEnv(runtimeConfig, envOptions);
event.context.nitro.runtimeConfig = runtimeConfig;
return runtimeConfig;
}
_deepFreeze(klona(appConfig));
function _deepFreeze(object) {
const propNames = Object.getOwnPropertyNames(object);
for (const name of propNames) {
const value = object[name];
if (value && typeof value === "object") {
_deepFreeze(value);
}
}
return Object.freeze(object);
}
new Proxy(/* @__PURE__ */ Object.create(null), {
get: (_, prop) => {
console.warn(
"Please use `useRuntimeConfig()` instead of accessing config directly."
);
const runtimeConfig = useRuntimeConfig();
if (prop in runtimeConfig) {
return runtimeConfig[prop];
}
return void 0;
}
});
getContext("nitro-app", {
asyncContext: false,
AsyncLocalStorage: void 0
});
const config = useRuntimeConfig();
const _routeRulesMatcher = toRouteMatcher(
createRouter({ routes: config.nitro.routeRules })
);
function createRouteRulesHandler(ctx) {
return eventHandler((event) => {
const routeRules = getRouteRules(event);
if (routeRules.headers) {
setHeaders(event, routeRules.headers);
}
if (routeRules.redirect) {
let target = routeRules.redirect.to;
if (target.endsWith("/**")) {
let targetPath = event.path;
const strpBase = routeRules.redirect._redirectStripBase;
if (strpBase) {
targetPath = withoutBase(targetPath, strpBase);
}
target = joinURL(target.slice(0, -3), targetPath);
} else if (event.path.includes("?")) {
const query = getQuery(event.path);
target = withQuery(target, query);
}
return sendRedirect(event, target, routeRules.redirect.statusCode);
}
if (routeRules.proxy) {
let target = routeRules.proxy.to;
if (target.endsWith("/**")) {
let targetPath = event.path;
const strpBase = routeRules.proxy._proxyStripBase;
if (strpBase) {
targetPath = withoutBase(targetPath, strpBase);
}
target = joinURL(target.slice(0, -3), targetPath);
} else if (event.path.includes("?")) {
const query = getQuery(event.path);
target = withQuery(target, query);
}
return proxyRequest(event, target, {
fetch: ctx.localFetch,
...routeRules.proxy
});
}
});
}
function getRouteRules(event) {
event.context._nitro = event.context._nitro || {};
if (!event.context._nitro.routeRules) {
event.context._nitro.routeRules = getRouteRulesForPath(
withoutBase(event.path.split("?")[0], useRuntimeConfig().app.baseURL)
);
}
return event.context._nitro.routeRules;
}
function getRouteRulesForPath(path) {
return defu({}, ..._routeRulesMatcher.matchAll(path).reverse());
}
function _captureError(error, type) {
console.error(`[${type}]`, error);
useNitroApp().captureError(error, { tags: [type] });
}
function trapUnhandledNodeErrors() {
process.on(
"unhandledRejection",
(error) => _captureError(error, "unhandledRejection")
);
process.on(
"uncaughtException",
(error) => _captureError(error, "uncaughtException")
);
}
function joinHeaders(value) {
return Array.isArray(value) ? value.join(", ") : String(value);
}
function normalizeFetchResponse(response) {
if (!response.headers.has("set-cookie")) {
return response;
}
return new Response(response.body, {
status: response.status,
statusText: response.statusText,
headers: normalizeCookieHeaders(response.headers)
});
}
function normalizeCookieHeader(header = "") {
return splitCookiesString(joinHeaders(header));
}
function normalizeCookieHeaders(headers) {
const outgoingHeaders = new Headers();
for (const [name, header] of headers) {
if (name === "set-cookie") {
for (const cookie of normalizeCookieHeader(header)) {
outgoingHeaders.append("set-cookie", cookie);
}
} else {
outgoingHeaders.set(name, joinHeaders(header));
}
}
return outgoingHeaders;
}
function isJsonRequest(event) {
if (hasReqHeader(event, "accept", "text/html")) {
return false;
}
return hasReqHeader(event, "accept", "application/json") || hasReqHeader(event, "user-agent", "curl/") || hasReqHeader(event, "user-agent", "httpie/") || hasReqHeader(event, "sec-fetch-mode", "cors") || event.path.startsWith("/api/") || event.path.endsWith(".json");
}
function hasReqHeader(event, name, includes) {
const value = getRequestHeader(event, name);
return value && typeof value === "string" && value.toLowerCase().includes(includes);
}
const errorHandler$0 = (async function errorhandler(error, event, { defaultHandler }) {
if (event.handled || isJsonRequest(event)) {
return;
}
const defaultRes = await defaultHandler(error, event, { json: true });
const statusCode = error.statusCode || 500;
if (statusCode === 404 && defaultRes.status === 302) {
setResponseHeaders(event, defaultRes.headers);
setResponseStatus(event, defaultRes.status, defaultRes.statusText);
return send(event, JSON.stringify(defaultRes.body, null, 2));
}
if (typeof defaultRes.body !== "string" && Array.isArray(defaultRes.body.stack)) {
defaultRes.body.stack = defaultRes.body.stack.join("\n");
}
const errorObject = defaultRes.body;
const url = new URL(errorObject.url);
errorObject.url = withoutBase(url.pathname, useRuntimeConfig(event).app.baseURL) + url.search + url.hash;
errorObject.message ||= "Server Error";
errorObject.data ||= error.data;
errorObject.statusMessage ||= error.statusMessage;
delete defaultRes.headers["content-type"];
delete defaultRes.headers["content-security-policy"];
setResponseHeaders(event, defaultRes.headers);
const reqHeaders = getRequestHeaders(event);
const isRenderingError = event.path.startsWith("/__nuxt_error") || !!reqHeaders["x-nuxt-error"];
const res = isRenderingError ? null : await useNitroApp().localFetch(
withQuery(joinURL(useRuntimeConfig(event).app.baseURL, "/__nuxt_error"), errorObject),
{
headers: { ...reqHeaders, "x-nuxt-error": "true" },
redirect: "manual"
}
).catch(() => null);
if (event.handled) {
return;
}
if (!res) {
const { template } = await Promise.resolve().then(function () { return errorDev; }) ;
{
errorObject.description = errorObject.message;
}
setResponseHeader(event, "Content-Type", "text/html;charset=UTF-8");
return send(event, template(errorObject));
}
const html = await res.text();
for (const [header, value] of res.headers.entries()) {
setResponseHeader(event, header, value);
}
setResponseStatus(event, res.status && res.status !== 200 ? res.status : defaultRes.status, res.statusText || defaultRes.statusText);
return send(event, html);
});
function defineNitroErrorHandler(handler) {
return handler;
}
const errorHandler$1 = defineNitroErrorHandler(
async function defaultNitroErrorHandler(error, event) {
const res = await defaultHandler(error, event);
if (!event.node?.res.headersSent) {
setResponseHeaders(event, res.headers);
}
setResponseStatus(event, res.status, res.statusText);
return send(
event,
typeof res.body === "string" ? res.body : JSON.stringify(res.body, null, 2)
);
}
);
async function defaultHandler(error, event, opts) {
const isSensitive = error.unhandled || error.fatal;
const statusCode = error.statusCode || 500;
const statusMessage = error.statusMessage || "Server Error";
const url = getRequestURL(event, { xForwardedHost: true, xForwardedProto: true });
if (statusCode === 404) {
const baseURL = "/";
if (/^\/[^/]/.test(baseURL) && !url.pathname.startsWith(baseURL)) {
const redirectTo = `${baseURL}${url.pathname.slice(1)}${url.search}`;
return {
status: 302,
statusText: "Found",
headers: { location: redirectTo },
body: `Redirecting...`
};
}
}
await loadStackTrace(error).catch(consola.error);
const youch = new Youch();
if (isSensitive && !opts?.silent) {
const tags = [error.unhandled && "[unhandled]", error.fatal && "[fatal]"].filter(Boolean).join(" ");
const ansiError = await (await youch.toANSI(error)).replaceAll(process.cwd(), ".");
consola.error(
`[request error] ${tags} [${event.method}] ${url}
`,
ansiError
);
}
const useJSON = opts?.json || !getRequestHeader(event, "accept")?.includes("text/html");
const headers = {
"content-type": useJSON ? "application/json" : "text/html",
// Prevent browser from guessing the MIME types of resources.
"x-content-type-options": "nosniff",
// Prevent error page from being embedded in an iframe
"x-frame-options": "DENY",
// Prevent browsers from sending the Referer header
"referrer-policy": "no-referrer",
// Disable the execution of any js
"content-security-policy": "script-src 'self' 'unsafe-inline'; object-src 'none'; base-uri 'self';"
};
if (statusCode === 404 || !getResponseHeader(event, "cache-control")) {
headers["cache-control"] = "no-cache";
}
const body = useJSON ? {
error: true,
url,
statusCode,
statusMessage,
message: error.message,
data: error.data,
stack: error.stack?.split("\n").map((line) => line.trim())
} : await youch.toHTML(error, {
request: {
url: url.href,
method: event.method,
headers: getRequestHeaders(event)
}
});
return {
status: statusCode,
statusText: statusMessage,
headers,
body
};
}
async function loadStackTrace(error) {
if (!(error instanceof Error)) {
return;
}
const parsed = await new ErrorParser().defineSourceLoader(sourceLoader).parse(error);
const stack = error.message + "\n" + parsed.frames.map((frame) => fmtFrame(frame)).join("\n");
Object.defineProperty(error, "stack", { value: stack });
if (error.cause) {
await loadStackTrace(error.cause).catch(consola.error);
}
}
async function sourceLoader(frame) {
if (!frame.fileName || frame.fileType !== "fs" || frame.type === "native") {
return;
}
if (frame.type === "app") {
const rawSourceMap = await readFile(`${frame.fileName}.map`, "utf8").catch(() => {
});
if (rawSourceMap) {
const consumer = await new SourceMapConsumer(rawSourceMap);
const originalPosition = consumer.originalPositionFor({ line: frame.lineNumber, column: frame.columnNumber });
if (originalPosition.source && originalPosition.line) {
frame.fileName = resolve(dirname(frame.fileName), originalPosition.source);
frame.lineNumber = originalPosition.line;
frame.columnNumber = originalPosition.column || 0;
}
}
}
const contents = await readFile(frame.fileName, "utf8").catch(() => {
});
return contents ? { contents } : void 0;
}
function fmtFrame(frame) {
if (frame.type === "native") {
return frame.raw;
}
const src = `${frame.fileName || ""}:${frame.lineNumber}:${frame.columnNumber})`;
return frame.functionName ? `at ${frame.functionName} (${src}` : `at ${src}`;
}
const errorHandlers = [errorHandler$0, errorHandler$1];
async function errorHandler(error, event) {
for (const handler of errorHandlers) {
try {
await handler(error, event, { defaultHandler });
if (event.handled) {
return; // Response handled
}
} catch(error) {
// Handler itself thrown, log and continue
console.error(error);
}
}
// H3 will handle fallback
}
const script = `
if (!window.__NUXT_DEVTOOLS_TIME_METRIC__) {
Object.defineProperty(window, '__NUXT_DEVTOOLS_TIME_METRIC__', {
value: {},
enumerable: false,
configurable: true,
})
}
window.__NUXT_DEVTOOLS_TIME_METRIC__.appInit = Date.now()
`;
const _yajFGiX8skDovnI5iDQnPqZ2oQtcYr27GmTd3wik120 = (function(nitro) {
nitro.hooks.hook("render:html", (htmlContext) => {
htmlContext.head.push(`<script>${script}<\/script>`);
});
});
const rootDir = "/Volumes/Development/Lotrek/Projects/mapo/packages/mapomodule";
const appHead = {"meta":[{"name":"viewport","content":"width=device-width, initial-scale=1"},{"charset":"utf-8"}],"link":[{"key":"mdi","rel":"stylesheet","href":"https://cdn.jsdelivr.net/npm/@mdi/font@5.x/css/materialdesignicons.min.css","type":"text/css","crossorigin":"anonymous"}],"style":[],"script":[],"noscript":[]};
const appRootTag = "div";
const appRootAttrs = {"id":"__nuxt"};
const appTeleportTag = "div";
const appTeleportAttrs = {"id":"teleports"};
const appId = "nuxt-app";
const devReducers = {
VNode: (data) => isVNode(data) ? { type: data.type, props: data.props } : void 0,
URL: (data) => data instanceof URL ? data.toString() : void 0
};
const asyncContext = getContext("nuxt-dev", { asyncContext: true, AsyncLocalStorage });
const _PejS63RTf2m4v0XYgNLlCeOKdJwEriWcs7hohQOAwBQ = (nitroApp) => {
const handler = nitroApp.h3App.handler;
nitroApp.h3App.handler = (event) => {
return asyncContext.callAsync({ logs: [], event }, () => handler(event));
};
onConsoleLog((_log) => {
const ctx = asyncContext.tryUse();
if (!ctx) {
return;
}
const rawStack = captureRawStackTrace();
if (!rawStack || rawStack.includes("runtime/vite-node.mjs")) {
return;
}
const trace = [];
let filename = "";
for (const entry of parseRawStackTrace(rawStack)) {
if (entry.source === globalThis._importMeta_.url) {
continue;
}
if (EXCLUDE_TRACE_RE.test(entry.source)) {
continue;
}
filename ||= entry.source.replace(withTrailingSlash(rootDir), "");
trace.push({
...entry,
source: entry.source.startsWith("file://") ? entry.source.replace("file://", "") : entry.source
});
}
const log = {
..._log,
// Pass along filename to allow the client to display more info about where log comes from
filename,
// Clean up file names in stack trace
stack: trace
};
ctx.logs.push(log);
});
nitroApp.hooks.hook("afterResponse", () => {
const ctx = asyncContext.tryUse();
if (!ctx) {
return;
}
return nitroApp.hooks.callHook("dev:ssr-logs", { logs: ctx.logs, path: ctx.event.path });
});
nitroApp.hooks.hook("render:html", (htmlContext) => {
const ctx = asyncContext.tryUse();
if (!ctx) {
return;
}
try {
const reducers = Object.assign(/* @__PURE__ */ Object.create(null), devReducers, ctx.event.context._payloadReducers);
htmlContext.bodyAppend.unshift(`<script type="application/json" data-nuxt-logs="${appId}">${stringify(ctx.logs, reducers)}<\/script>`);
} catch (e) {
const shortError = e instanceof Error && "toString" in e ? ` Received \`${e.toString()}\`.` : "";
console.warn(`[nuxt] Failed to stringify dev server logs.${shortError} You can define your own reducer/reviver for rich types following the instructions in https://nuxt.com/docs/api/composables/use-nuxt-app#payload.`);
}
});
};
const EXCLUDE_TRACE_RE = /\/node_modules\/(?:.*\/)?(?:nuxt|nuxt-nightly|nuxt-edge|nuxt3|consola|@vue)\/|core\/runtime\/nitro/;
function onConsoleLog(callback) {
consola$1.addReporter({
log(logObj) {
callback(logObj);
}
});
consola$1.wrapConsole();
}
const plugins = [
_yajFGiX8skDovnI5iDQnPqZ2oQtcYr27GmTd3wik120,
_PejS63RTf2m4v0XYgNLlCeOKdJwEriWcs7hohQOAwBQ
];
const VueResolver = (_, value) => {
return isRef(value) ? toValue(value) : value;
};
const headSymbol = "usehead";
function vueInstall(head) {
const plugin = {
install(app) {
app.config.globalProperties.$unhead = head;
app.config.globalProperties.$head = head;
app.provide(headSymbol, head);
}
};
return plugin.install;
}
function resolveUnrefHeadInput(input) {
return walkResolver(input, VueResolver);
}
function createHead(options = {}) {
const head = createHead$1({
...options,
propResolvers: [VueResolver]
});
head.install = vueInstall(head);
return head;
}
const unheadOptions = {
disableDefaults: true,
disableCapoSorting: false,
plugins: [DeprecationsPlugin, PromisesPlugin, TemplateParamsPlugin, AliasSortingPlugin],
};
function createSSRContext(event) {
const ssrContext = {
url: event.path,
event,
runtimeConfig: useRuntimeConfig(event),
noSSR: event.context.nuxt?.noSSR || (false),
head: createHead(unheadOptions),
error: false,
nuxt: void 0,
/* NuxtApp */
payload: {},
_payloadReducers: /* @__PURE__ */ Object.create(null),
modules: /* @__PURE__ */ new Set()
};
return ssrContext;
}
function setSSRError(ssrContext, error) {
ssrContext.error = true;
ssrContext.payload = { error };
ssrContext.url = error.url;
}
function buildAssetsDir() {
return useRuntimeConfig().app.buildAssetsDir;
}
function buildAssetsURL(...path) {
return joinRelativeURL(publicAssetsURL(), buildAssetsDir(), ...path);
}
function publicAssetsURL(...path) {
const app = useRuntimeConfig().app;
const publicBase = app.c