{"version":3,"sources":["common.tsx"],"sourcesContent":["import { Datex } from \"datex-core-legacy\";\nimport { resolveEntrypointRoute } from \"../routing/rendering.ts\";\nimport { Context } from \"../routing/context.ts\";\nimport { convertANSIToHTML } from \"../utils/ansi-to-html.ts\";\nimport { Path } from \"datex-core-legacy/utils/path.ts\";\nimport { getCallerFile } from \"datex-core-legacy/utils/caller_metadata.ts\";\nimport { setCookie, Cookie } from \"../lib/cookie/cookie.ts\";\nimport { ALLOWED_ENTRYPOINT_FILE_NAMES, app } from \"../app/app.ts\";\nimport { Entrypoint, RouteHandler, html_generator } from \"./entrypoints.ts\";\nimport { client_type } from \"datex-core-legacy/utils/constants.ts\";\nimport { HTTPStatus } from \"../html/http-status.ts\";\nimport { createErrorHTML } from \"../html/errors.tsx\";\nimport { HTTPError } from \"../html/http-error.ts\";\nimport { convertToWebPath } from \"../app/convert-to-web-path.ts\";\nimport { getJSONCompatibleSerializedValue } from \"../utils/serialize-js.ts\";\n\nconst fileServer = client_type === \"deno\" ? (await import(\"https://deno.land/std@0.164.0/http/file_server.ts\")) : null;\n\ntype mime_type = `${'text'|'image'|'application'|'video'|'audio'}/${string}`;\ntype json_mime_type = `application/${string}+json`;\n\nexport function lazy<T extends html_generator>(generator: T): T {\n\tlet result:Awaited<ReturnType<T>>|undefined;\n\tlet loaded = false;\n\treturn (async function(ctx: Context) {\n\t\tif (loaded) return result;\n\t\telse {\n\t\t\tresult = await generator(ctx, ctx.params) as any;\n\t\t\tloaded = true;\n\t\t\treturn result;\n\t\t}\n\t}) as any\n}\n\n// TODO: remove, deprecated\n/**\n * @deprecated, use lazy instead\n */\nexport const once = lazy\n\n/**\n * serve a value as raw content (DX, DXB, JSON format)\n * @param value any JS value (must be JSON compatible if JSON is used as the content type)\n * @param options optional options:\n * \ttype: Datex.FILE_TYPE (DX, DXB, JSON)\n *  formatted: boolean if true, the DX/JSON is formatted with newlines/spaces\n *  mimeType: custom mime type if type is JSON\n * @returns blob containing DATEX/JSON encoded value\n */\nexport async function provideValue(value:unknown, options?:{type?:Datex.DATEX_FILE_TYPE, formatted?:boolean, mockPointers?:boolean, mimeType?: json_mime_type}) {\n\tif (options?.type == Datex.FILE_TYPE.DATEX_BINARY) {\n\t\treturn provideContent(await Datex.Compiler.compile(\"?\", [value]) as ArrayBuffer, options.type[0])\n\t}\n\telse if (options?.type == Datex.FILE_TYPE.JSON) {\n\t\tif (options?.mockPointers) value = getJSONCompatibleSerializedValue(value);\n\t\treturn provideContent(JSON.stringify(value??null, null, options?.formatted ? '    ' : undefined), options.mimeType ?? options.type[0])\n\t}\n\telse {\n\t\treturn provideContent(Datex.Runtime.valueToDatexStringExperimental(value, options?.formatted), (options?.type ?? Datex.FILE_TYPE.DATEX_SCRIPT)[0])\n\t}\n}\n\n/**\n * serve a value as JSON\n * @param value any JSON compatible value\n * @param options optional options:\n *  formatted: boolean if true, the DX/JSON is formatted with newlines/spaces\n *  mimeType: custom mime type (e.g. \"application/geo+json\")\n * @returns blob containing DATEX/JSON encoded value\n */\nexport function provideJSON(value:unknown, options?:{formatted?:boolean, mimeType?: json_mime_type}) {\n\treturn provideValue(value, {formatted: options?.formatted, type: Datex.FILE_TYPE.JSON, mimeType:options?.mimeType})\n}\n\n\n\n/**\n * Show an interactive value view in the browser, including syntax highlighting\n * @param value \n */\nexport function provideValueDebugView(value: unknown) {\n \tconst dxString = Datex.Runtime.valueToDatexStringExperimental(value, true, true, true, true);\n\tconst html = `<html style=\"color: white;background: #111111;padding: 10px;line-height: 1.2rem;\">\n\t\t<head>\t\n\t\t\t<meta charset=\"UTF-8\">\n\t\t\t<style>\n\t\t\t\tbody span {\n\t\t\t\t\tline-height: 1.2rem!important;\n\t\t\t\t}\n\t\t\t</style>\n\t\t</head>\n\t\t${convertANSIToHTML(dxString)}\n\t</html>`\n\treturn provideResponse(html, \"text/html;charset=utf-8\");\n}\n// export function provideValueDebugView(value: unknown) {\n// \tconst dxString = Datex.Runtime.valueToDatexStringExperimental(value);\n// \tconst page = `\n// \t<!DOCTYPE html>\n// \t<html lang=\"en\">\n// \t\t<head>\n// \t\t\t<meta charset=\"UTF-8\">\n// \t\t\t<meta name=\"viewport\" content=\"viewport-fit=cover, width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no\"/>\n// \t\t\t<title>UXI Value Debug View</title>\n// \t\t\t<link rel=\"icon\" href=\"https://dev.cdn.unyt.org/unyt_core/assets/square_dark.png\">\n// \t\t\t<script type=\"importmap\">\n\t\t\t\t\n// \t\t\t{\n// \t\t\t\t\"imports\": {\n// \t\t\t\t\t\"unyt_core\": \"https://dev.cdn.unyt.org/unyt_core/datex.ts\",\n// \t\t\t\t\t\"uix\": \"https://dev.cdn.unyt.org/uix/uix.ts\",\n// \t\t\t\t\t\"unyt_core/\": \"https://dev.cdn.unyt.org/unyt_core/\",\n// \t\t\t\t\t\"uix/\": \"https://dev.cdn.unyt.org/uix/\",\n// \t\t\t\t\t\"uix_std/\": \"https://dev.cdn.unyt.org/uix/uix_std/\",\n// \t\t\t\t\t\"unyt_tests/\": \"https://dev.cdn.unyt.org/unyt_tests/\",\n// \t\t\t\t\t\"unyt_web/\": \"https://dev.cdn.unyt.org/unyt_web/\",\n// \t\t\t\t\t\"unyt_node/\": \"https://dev.cdn.unyt.org/unyt_node/\",\n// \t\t\t\t\t\"unyt_cli/\": \"https://dev.cdn.unyt.org/unyt_cli/\",\n// \t\t\t\t\t\"supranet/\": \"https://portal.unyt.org/ts_module_resolver/\",\n// \t\t\t\t\t\"uix/jsx-runtime\": \"https://dev.cdn.unyt.org/uix/jsx-runtime/jsx.ts\",\n// \t\t\t\t\t\"backend/\": \"/@uix/src/backend/\",\n// \t\t\t\t\t\"common/\": \"/@uix/src/common/\",\n// \t\t\t\t\t\"frontend/\": \"/@uix/src/frontend/\"\n// \t\t\t\t}\n// \t\t\t}\n\t\t\t\n// \t\t\t</script>\n// \t\t\t<script type=\"module\">\n// \t\t\t\timport { datex, Datex } from \"datex-core-legacy\";\n// \t\t\t\timport { DatexValueTreeView } from \"uix_std/datex/value_tree_view.ts\"\n// \t\t\t\timport { dx_value_manager } from \"uix_std/datex/resource_manager.ts\";\n\n// \t\t\t\tawait Datex.Supranet.connect();\n// \t\t\t\tconst value = await datex \\`${dxString}\\`;\n\n// \t\t\t\tconsole.log(\"${dxString}\", value);\n// \t\t\t\tconst tree_view = new DatexValueTreeView({\n// \t\t\t\t\troot_resource_path:(await dx_value_manager.getResourceForValue(value)).path,\n// \t\t\t\t\theader:false, \n// \t\t\t\t\tenable_drop:false,\n// \t\t\t\t\tdisplay_root: true\n// \t\t\t\t}, {dynamic_size:false});\n// \t\t\t\tdocument.body.append(tree_view)\n// \t\t\t</script>\n// \t\t</head>\n// \t</html>\t\n// \t`\n// \treturn provideResponse(page, \"text/html\");\n// }\n\n\n\nexport function provideResponse(content:ReadableStream | XMLHttpRequestBodyInit, type:mime_type, status = 200, cookies?:Cookie[], headers:Record<string, string> = {}, cors = false) {\n\tif (cors) Object.assign(headers, {\"Access-Control-Allow-Origin\": \"*\", \"Access-Control-Allow-Headers\": \"*\"});\n\tObject.assign(headers, {\"Content-Type\": type});\n\tconst res = new Response(content, {headers, status});\n\tif (cookies) {\n\t\tfor (const cookie of cookies) setCookie!(res.headers, cookie);\n\t}\n\treturn res;\n}\n\n/**\n * serve a string/ArrayBuffer with a specific mime type\n * @param content 'file' content\n * @param type mime type\n * @returns content blob\n */\nexport async function provideContent(content:string|ArrayBuffer, type:mime_type = \"text/plain;charset=utf-8\", status?:number) {\n\tconst blob = new Blob([content], {type});\n\tawait Datex.Runtime.cacheValue(blob);\n\treturn provideResponse(blob, type, status);\n}\n\nexport class FileHandle {\n\tconstructor(public path: Path) {}\n}\n\n\n/**\n * serve a file\n * @param path local file path\n * @returns content FSFile\n */\nexport function provideFile(path: string | URL) {\n\tconst resolvedPath = new Path(path, getCallerFile());\n\treturn new FileHandle(resolvedPath);\n}\n\n/**\n * Just returns a URL, which is interpreted as redirect by the entrypoint resolver\n * @param path local file path or URL\n * @returns resolved URL\n */\nexport function provideRedirect(path:string|URL) {\n\tif (path instanceof URL) return path;\n\telse if (path.startsWith(\"/\")) return Path.Route(path);\n\telse return new Path(path, getCallerFile());\n}\n\n/**\n * Similar to provideRedirect/returning a URL, but no redirect on the client - the\n * content is just served for the current URL\n * uses the internal UIX server to resolve a url to a response\n * @param path local file path or URL\n * @returns redirect response\n */\nexport function provideVirtualRedirect(path:string|URL) {\n\tconst resolvedPath = path instanceof URL ? path : new Path(path, getCallerFile());\n\tconst webPath = convertToWebPath(resolvedPath);\n\n\treturn (ctx: Context) => {\n\t\t// a URL is required, the domain is not really relevant, but copied from request origin\n\t\tconst origin = new URL(ctx.request?.url??'https://_virtual_redirect.unyt.org').origin\n\t\t// request headers also copied from request\n\t\tconst request = new Request(new URL(origin + webPath), {headers:ctx.request?.headers})\n\t\treturn app.defaultServer!.getResponse(request)\n\t}\n}\n\nconst matchURL = /\\b((https?|file):\\/\\/[^\\s]+(\\:\\d+)?(\\:\\d+)?\\b)/g;\n\n\n/**\n * Creates an Error View\n * @param message error title\n * @param status http status code or error\n * @returns\n */\nexport function provideError(title: string, error?: Error|number|HTTPStatus<number,string>|string) {\n\tconst [statusCode, html] = createErrorHTML(title, error);\n\treturn new HTTPStatus(statusCode, html)\n}\n\n// /**\n//  * @deprecated return/throw a new HTTPError or an Error instead\n//  * serve an errror with a status code and message\n//  * @param message error message\n//  * @param status http status code\n//  * @returns content blob\n//  */\n// export function provideError(message: string, status:number|HTTPStatus = 500) {\n// \tstatus = typeof status == \"number\" ? status : status.code;\n// \tconst content = indent `\n// \t<html>\n// \t\t<head>\n// \t\t\t<meta charset=\"UTF-8\">\n// \t\t\t<meta name=\"viewport\" content=\"viewport-fit=cover, width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no\"/>\n// \t\t</head>\n\t\n// \t\t<body>\n// \t\t\t<div style=\"\n// \t\t\t\twidth: 100%;\n// \t\t\t\theight: 100%;\n// \t\t\t\tdisplay: flex;\n// \t\t\t\tjustify-content: center;\n// \t\t\t\talign-items: center;\n// \t\t\t\tfont-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;\n// \t\t\t\tfont-size: 1.5em;\n// \t\t\t\tcolor: var(--text_highlight);\">\n// \t\t\t\t<div style=\"text-align:center; word-break: break-word;\">\n// \t\t\t\t\t<h2 style=\"margin-bottom:0; background: #ea2b51; -webkit-background-clip: text; -webkit-text-fill-color: transparent;\">Error ${status}</h2>\n// \t\t\t\t\t<div>${message}</div>\n// \t\t\t\t</div>\n// \t\t\t</div>\n// \t\t</body>\n// \t</html>\n// \t`;\n// \treturn provideContent(content, \"text/html\", status);\n// }\n\n\n\n/**\n * Provide static files, backend only\n */\nexport class FileProvider implements RouteHandler {\n\n\t#path: Path\n\n\tget path() {return this.#path}\n\n\tconstructor(path:Path.representation, public resolveIndexHTML = true, public allowHTMLWithoutExtension = true) {\n\t\tthis.#path = new Path(path, getCallerFile());\n\t\tif (this.#path.fs_is_dir) this.#path = this.#path.asDir()\n\t}\n\n\tgetRoute(route:Path.route_representation|string, context: Context) {\n\t\tif (!context.request) return provideError(\"Cannot serve file\");\n\n\t\tlet path = this.#path.getChildPath(route);\n\t\t\n\t\t// dir path -> index.html\n\t\tif (path.fs_is_dir && this.resolveIndexHTML) {\n\t\t\tpath = path.getChildPath(\"index.html\");\n\t\t}\n\n\t\t// file not found\n\t\tif (!path.fs_exists) {\n\t\t\t// .html?\n\t\t\tif (this.allowHTMLWithoutExtension && path.getWithFileExtension(\"html\").fs_exists) {\n\t\t\t\tpath = path.getWithFileExtension(\"html\");\n\t\t\t}\n\t\t\telse return new HTTPError(HTTPStatus.NOT_FOUND)\n\t\t}\n\n\t\treturn fileServer!.serveFile(context.request, path.normal_pathname);\n\t}\n}\n\nexport const KEEP_CONTENT = Symbol(\"KEEP_CONTENT\")\n\n\nexport class PageProvider implements RouteHandler {\n\n\tpath!: Path\n\tuseDirective?: string\n\n\t/**\n\t * \n\t * @param path \n\t * @param useDirective optional use directive required for a entrypoint to be loaded (e.g. \"use backend\")\n\t *\tIf a use directive is present in an entrypoint file, but not useDirective value is set, the entrypoint is not loaded.\n\t */\n\tconstructor(path:Path.representation, useDirective?: string) {\n\t\tthis.useDirective = useDirective;\n\t\tthis.path = new Path(path, getCallerFile());\n\t\tif (this.path.fs_is_dir) this.path = this.path.asDir()\n\t}\n\n\tgetRoute(route: Path.route_representation, context: Context): Entrypoint|Promise<Entrypoint> {\n\t\tif (!this.path) return KEEP_CONTENT // loaded a PageProvider from backend, path not known, cannot resolve (TODO)\n\t\treturn this.#findValidEntrypoint(\n\t\t\tthis.path.getChildPath(route).asDir(), \n\t\t\tALLOWED_ENTRYPOINT_FILE_NAMES\n\t\t) \n\t}\n\n\tasync #findValidEntrypoint(parentDir: Path, names: string[], redirectRoute:string[] = []): Promise<Entrypoint|null> {\n\t\tfor (const name of names) {\n\t\t\ttry {\n\t\t\t\tconst url = parentDir.getChildPath(name);\n\t\t\t\t// make sure use directive matches\n\t\t\t\t\n\t\t\t\t// browser: fetch file only if useDirective is present in file, otherwise not found is returned\n\t\t\t\tif (client_type == \"browser\") url.searchParams.append(\"useDirective\", this.useDirective??\"\")\n\t\t\t\t// deno: read file and check if use directive matches, otherwise return null\n\t\t\t\telse {\n\t\t\t\t\tif (await url.fsExists() && !await PageProvider.useDirectiveMatchesForFile(url, this.useDirective)) {\n\t\t\t\t\t\t// console.log(\"use directive '\" + (this.useDirective??'') + \"' does not match for \" + url)\n\t\t\t\t\t\treturn null;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\n\t\t\t\t// make sure another directive\n\n\t\t\t\t\n\t\t\t\tconst entrypoint = (await datex.get<any>(url))!.default as Entrypoint;\n\t\t\t\t// resolve route for entrypoint\n\t\t\t\tif (redirectRoute.length) {\n\t\t\t\t\t// TODO: #14\n\t\t\t\t\tconst { content } = await resolveEntrypointRoute({entrypoint, route: Path.Route(redirectRoute)});\n\t\t\t\t\treturn content as Entrypoint;\n\t\t\t\t}\n\t\t\t\t// return entrypoint directly\n\t\t\t\treturn entrypoint;\n\t\t\t}\n\t\t\tcatch (e){\n\t\t\t\t// Error 406, because the use directive of the file does not match\n\t\t\t\t// -> don't go up further in the file tree, just stop here and return null content\n\t\t\t\t// TODO: better way?\n\t\t\t\tif (e.message.endsWith(\"(406)\")) return null;\n\t\t\t\t// Any other unexpected error besides 404/not found, throw error\n\t\t\t\tif (!e.message.endsWith(\"(404)\") && !e.message.includes(\"No such file or directory\")) throw e;\n\t\t\t}\n\t\t}\n\n\t\t// no entrypoint in directory, find entrypoint in parent directory\n\t\tif (parentDir.parent_dir.toString() !== parentDir.toString()) {\n\t\t\tredirectRoute.unshift(parentDir.name);\n\t\t\treturn this.#findValidEntrypoint(parentDir.parent_dir, names, redirectRoute)\n\t\t}\n\t}\n\n\tstatic async useDirectiveMatchesForFile(path: Path, directive?:string) {\n\t\tconst file = (await Deno.readTextFile(path.normal_pathname)).trimStart();\n\t\tif (directive) {\n\t\t\t// does not have the required use directive\n\t\t\tif (!file.startsWith(`\"use ${directive}\"`)) return false;\n\t\t} \n\t\telse {\n\t\t\t// has a use directive, although know use directive should be present\n\t\t\tif (file.match(/^\"use [\\w-]+\"/)) return false;\n\t\t}\n\t\treturn true;\n\t}\n\t\t\n}"],"names":["Datex","resolveEntrypointRoute","convertANSIToHTML","Path","getCallerFile","setCookie","ALLOWED_ENTRYPOINT_FILE_NAMES","app","client_type","HTTPStatus","createErrorHTML","HTTPError","convertToWebPath","getJSONCompatibleSerializedValue","fileServer","lazy","generator","result","loaded","ctx","params","once","provideValue","value","options","type","FILE_TYPE","DATEX_BINARY","provideContent","Compiler","compile","JSON","mockPointers","stringify","formatted","undefined","mimeType","Runtime","valueToDatexStringExperimental","DATEX_SCRIPT","provideJSON","provideValueDebugView","dxString","provideResponse","content","status","cookies","headers","cors","Object","assign","res","Response","cookie","blob","Blob","cacheValue","FileHandle","constructor","path","provideFile","provideRedirect","URL","startsWith","Route","provideVirtualRedirect","webPath","origin","request","url","Request","defaultServer","getResponse","provideError","title","error","statusCode","html","FileProvider","resolveIndexHTML","allowHTMLWithoutExtension","fs_is_dir","asDir","getRoute","route","context","getChildPath","fs_exists","getWithFileExtension","NOT_FOUND","serveFile","normal_pathname","KEEP_CONTENT","Symbol","PageProvider","useDirective","parentDir","names","redirectRoute","name","searchParams","append","fsExists","useDirectiveMatchesForFile","entrypoint","datex","get","default","length","e","message","endsWith","includes","parent_dir","toString","unshift","directive","file","Deno","readTextFile","trimStart","match"],"mappings":"AAAA,SAASA,KAAK,QAAQ,oBAAoB;AAC1C,SAASC,sBAAsB,QAAQ,0BAA0B;AAEjE,SAASC,iBAAiB,QAAQ,2BAA2B;AAC7D,SAASC,IAAI,QAAQ,kCAAkC;AACvD,SAASC,aAAa,QAAQ,6CAA6C;AAC3E,SAASC,SAAS,QAAgB,0BAA0B;AAC5D,SAASC,6BAA6B,EAAEC,GAAG,QAAQ,gBAAgB;AAEnE,SAASC,WAAW,QAAQ,uCAAuC;AACnE,SAASC,UAAU,QAAQ,yBAAyB;AACpD,SAASC,eAAe,QAAQ,qBAAqB;AACrD,SAASC,SAAS,QAAQ,wBAAwB;AAClD,SAASC,gBAAgB,QAAQ,gCAAgC;AACjE,SAASC,gCAAgC,QAAQ,2BAA2B;AAE5E,IAAMC,aAAaN,AAAgB,WAAhBA,cAA0B,MAAM,MAAM,CAAC,uDAAwD;AAKlH,OAAO,SAASO,KAA+BC,SAAY;QACtDC;IACJ,IAAIC,SAAS,CAAA;IACb,OAAQ,eAAeC,GAAY;eAC9BD,WAEHD,SAAS,MAAMD,UAAUG,KAAKA,IAAIC,MAAM,GACxCF,SAAS,CAAA,IAHSD;IAMpB;AACD;AAMA,OAAO,MAAMI,OAAON,KAAI;AAWxB,OAAO,eAAeO,aAAaC,KAAa,EAAEC,OAA4G;WAC7J,AAAIA,SAASC,QAAQzB,MAAM0B,SAAS,CAACC,YAAY,G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