{"version":3,"sources":["rendering.ts"],"sourcesContent":["import { Path } from \"datex-core-legacy/utils/path.ts\";\nimport { Datex } from \"datex-core-legacy\";\nimport {evaluateFilter, filter} from \"./route-filter.ts\";\nimport { Entrypoint, EntrypointRouteMap, RouteHandler, RouteManager, html_generator } from \"../providers/entrypoints.ts\"\n\nimport { CACHED_CONTENT, getOuterHTML } from \"../html/render.ts\";\nimport { HTTPStatus } from \"../html/http-status.ts\";\nimport { RenderPreset, RenderMethod } from \"../base/render-methods.ts\"\nimport { client_type } from \"datex-core-legacy/utils/constants.ts\";\nimport { createErrorHTML } from \"../html/errors.tsx\";\nimport { Context, ContextGenerator } from \"./context.ts\";\nimport { Component } from \"../components/Component.ts\";\nimport { logger } from \"../utils/global-values.ts\";\nimport { domContext } from \"../app/dom-context.ts\";\nimport { UIX } from \"../../uix.ts\";\nimport { convertToWebPath } from \"../app/convert-to-web-path.ts\";\nimport { FileHandle } from \"../providers/common.tsx\";\n\n// URLPattern polyfill\n// @ts-ignore\nif (!globalThis.URLPattern) { \n\tawait import(\"../lib/urlpattern-polyfill/index.js\" /*lazy*/);\n}\n\n\n\n\n/**\n * Render the current state of the element as HTML and cache for SSR\n * @param content\n * @param render_method \n * @returns \n */\nexport async function createSnapshot<T extends Element|DocumentFragment>(content:T, render_method = RenderMethod.HYBRID):Promise<T> {\n\tawait preloadElementOnBackend(content);\n\t// @ts-ignore\n\tcontent[CACHED_CONTENT] = getOuterHTML(content, {injectStandaloneJS:render_method!=RenderMethod.STATIC, injectStandaloneComponents:render_method!=RenderMethod.STATIC, lang:Datex.Runtime.ENV.LANG, includeShadowRoots: true});\n\treturn content;\n}\n\n\n\ntype match_path<C extends EntrypointRouteMap, P extends string & keyof C> = C[P];\n\ntype get_content<C extends Entrypoint, Path extends string = string> = \n\t// if C is EntrypointRouteMap -> return object value\n\tC extends EntrypointRouteMap ? get_content<match_path<C,Path>> : (\n\t\t// if C is RenderPreset -> return RenderPreset.__content\n\t\tC extends RenderPreset<infer R, infer T> ? get_content<T> : (\n\t\t\t// else if C is generator function\n\t\t\tC extends (...args:unknown[])=>infer T ? (\n\t\t\t\t// if generator returns preset -> return RenderPreset.content\n\t\t\t\tT extends RenderPreset<infer R, infer T2> ? get_content<T2> :\n\t\t\t\t// else return generator return value\n\t\t\t\tT\n\t\t\t) :\n\t\t\tC\n\t\t)\n\t)\n\ntype get_render_method<C extends Entrypoint, Path extends string = string> = \n\t// if C is EntrypointRouteMap -> get render method for property\n\tC extends EntrypointRouteMap ? get_render_method<match_path<C,Path>> : (\n\t\t// if C is RenderPreset -> return RenderPreset.__render_method\n\t\tC extends RenderPreset<infer R, infer T> ? R : (\n\t\t\t// else if C is generator function\n\t\t\tC extends (...args:unknown[])=>infer T ? (\n\t\t\t\t// if generator returns preset -> return RenderPreset.__render_method\n\t\t\t\tT extends RenderPreset<infer R, infer T2> ? R :\n\t\t\t\t// else return default RenderMethod.HYDRATION\n\t\t\t\tRenderMethod.HYBRID\n\t\t\t) :\n\t\t\tRenderMethod.HYBRID\n\t\t)\n\t);\n\n\ntype entrypointData<T extends Entrypoint = Entrypoint> = {\n\tentrypoint: T,\n\troute?:Path.Route, \n\tcontext?:ContextGenerator|Context, \n\tonly_return_static_content?: boolean\n\treturn_first_routing_handler?: boolean,\n\tprobe_no_side_effects?: boolean, // if true, only check if the route exists, if possible, but don' call function etc\n}\n\ntype resolvedEntrypointData<T extends Entrypoint = Entrypoint> = {\n\tcontent: get_content<T>,\n\trender_method: RenderMethod, // get_render_method<T>, \n\tstatus_code?: number, \n\tloaded: boolean, \n\tremaining_route?: Path.Route,\n\theaders?: Headers // additional response headers\n}\n\nfunction reconstructMatchedURLPart(input:string, partResult:URLPatternComponentResult) {\n\tfor (const [name,val] of Object.entries(partResult.groups)) {\n\t\tinput = input.replace(':'+name, val??'');\n\t}\n\treturn input\n}\n\n/**\n * replaces ':name' parts of url pattern with matched values to reconstruct a valid url (keeps *)\n * @param input \n * @param match \n * @returns \n */\nfunction reconstructMatchedURL(input:string, match:URLPatternResult) {\n\tinput = reconstructMatchedURLPart(input, match.protocol);\n\tinput = reconstructMatchedURLPart(input, match.username);\n\tinput = reconstructMatchedURLPart(input, match.password);\n\tinput = reconstructMatchedURLPart(input, match.hostname);\n\tinput = reconstructMatchedURLPart(input, match.pathname);\n\tinput = reconstructMatchedURLPart(input, match.hash);\n\tinput = reconstructMatchedURLPart(input, match.search);\n\treturn input\n}\n\nfunction resolveContext(entrypointData: entrypointData): asserts entrypointData is entrypointData & {context: Context} {\n\tif (typeof entrypointData.context == \"function\") entrypointData.context = entrypointData.context();\n\tif (!entrypointData.context) throw new Error(\"missing UIX context for generator function\")\n}\n\nasync function resolveGeneratorFunction(entrypointData: entrypointData<html_generator>): Promise<resolvedEntrypointData> {\n\tresolveContext(entrypointData)\n\n\tlet returnValue: Entrypoint|undefined;\n\tlet hasError = false;\n\ttry {\n\t\treturnValue = await entrypointData.entrypoint(entrypointData.context, (entrypointData.context).params);\n\t}\n\t// return error as response with HTTPStatus error 500\n\tcatch (e) {\n\t\t\n\t\tif (e instanceof Error) {\n\t\t\thasError = true;\n\t\t\treturnValue = e;\n\t\t}\n\t\telse if (e instanceof HTTPStatus) {\n\t\t\thasError = true;\n\t\t\treturnValue = e;\n\t\t}\n\t\t// TODO: fix instance check if transmitted via datex, currently just force converted to HTTPStatus\n\t\telse if (typeof e == \"object\" && \"code\" in e && \"content\" in e && Object.keys(e).length == 2) {\n\t\t\thasError = true;\n\t\t\treturnValue = new HTTPStatus(e.code, e.content);\n\t\t}\n\n\t\t// keep responses if they have an error code\n\t\telse if (e instanceof Response) {\n\t\t\tif (e.status >= 400) {\n\t\t\t\thasError = true;\n\t\t\t\treturnValue = e;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tlogger.warn(\"A Response with a non-error status code was thrown in a generator function. This is not recommended - when using throw, the response should always have a status code >= 400.\");\n\t\t\t}\n\t\t}\n\n\t\t// warn if URL was thrown\n\t\telse if (e instanceof URL) {\n\t\t\tlogger.warn(\"A URL indicating a redirect (302) was thrown in a generator function. This is not recommended - URLs should always be returned and not thrown.\");\n\t\t\thasError = true;\n\t\t\treturnValue = e;\n\t\t}\n\n\t\telse {\n\t\t\treturnValue = HTTPStatus.INTERNAL_SERVER_ERROR.with(e)\n\t\t}\n\t}\n\n\tconst resolved = await resolveEntrypointRoute({...entrypointData, entrypoint: returnValue})\n\tif (hasError) resolved.render_method = RenderMethod.BACKEND; // override: render errors as backend\n\n\treturn resolved;\n}\n\nasync function resolveRenderPreset(entrypointData: entrypointData<RenderPreset>): Promise<resolvedEntrypointData> {\n\t// handle cached response on server\n\tif (entrypointData.entrypoint.__render_method == RenderMethod.CACHED_RESPONSE) {\n\t\tif (!entrypointData.route) throw new Error(\"missing entrypoint route (required for cached response)\");\n\t\tconst response = await fetch(entrypointData.route, {\n\t\t\theaders: new Headers({ \"UIX-Cache-Token\": entrypointData.entrypoint.__content as string }),\n\t\t\tcredentials: \"include\"\n\t\t});\n\t\treturn {\n\t\t\tcontent: response,\n\t\t\trender_method: entrypointData.entrypoint.__render_method,\n\t\t\tstatus_code: response.status,\n\t\t\theaders: response.headers,\n\t\t\tloaded: true\n\t\t}\n\t}\n\t\n\tconst content = await entrypointData.entrypoint.__content;\n\tconst resolved = await resolveEntrypointRoute({...entrypointData, entrypoint: content});\n\tresolved.render_method = entrypointData.entrypoint.__render_method;\n\tif (entrypointData.entrypoint.__status_code != undefined) resolved.status_code = entrypointData.entrypoint.__status_code;\n\treturn resolved;\n}\n\nasync function resolveHTTPStatus(entrypointData: entrypointData<HTTPStatus>): Promise<resolvedEntrypointData> {\n\tconst content = await entrypointData.entrypoint.content;\n\tconst resolved = await resolveEntrypointRoute({...entrypointData, entrypoint: content});\n\tresolved.status_code = entrypointData.entrypoint.code;\n\treturn resolved;\n}\n\n\nasync function resolveRouteHandler(entrypointData: entrypointData<RouteHandler>): Promise<resolvedEntrypointData> {\n\tresolveContext(entrypointData)\n\tif (!entrypointData.route) throw new Error(\"missing entrypoint route (required for RouteHandler\")\n\tconst route2 = await entrypointData.entrypoint.getRoute(entrypointData.route, entrypointData.context);\n\tentrypointData.route = Path.Route(\"/\"); // route completely resolved by getRoute\n\treturn resolveEntrypointRoute({...entrypointData, entrypoint: route2})\n}\n\nfunction resolveModule(entrypointData: entrypointData<{default?:Entrypoint}>): Promise<resolvedEntrypointData> {\n\tif (!entrypointData.entrypoint.default) throw new Error(\"invalid module as entrypoint: no default export\")\n\tconst content = entrypointData.entrypoint.default\n\treturn resolveEntrypointRoute({...entrypointData, entrypoint: content});\n}\n\nfunction generateURLParamsObject(matches: URLPatternResult) {\n\tconst params:Record<string, string> = {};\n\tconst groups = {\n\t\t...matches.hash.groups??{},\n\t\t...matches.hostname.groups??{},\n\t\t...matches.password.groups??{},\n\t\t...matches.pathname.groups??{},\n\t\t...matches.port.groups??{},\n\t\t...matches.protocol.groups??{},\n\t\t...matches.search.groups??{},\n\t\t...matches.username.groups??{},\n\t}\n\tfor (const [key, val] of Object.entries(groups)) {\n\t\t// ignore number keys\n\t\tif (!isNaN(Number(key))) continue;\n\t\tparams[key] = val as string;\n\t}\n\treturn params;\n}\n\nasync function resolvePathMap(entrypointData: entrypointData<EntrypointRouteMap>): Promise<resolvedEntrypointData|undefined> {\n\tresolveContext(entrypointData)\n\n\t// find longest matching route\n\tlet closest_match_key:string|filter|null = null;\n\tlet closest_match_route:Path.Route|null = null;\n\n\tconst isBetterMatch = (potential_route_key: string) => {\n\t\t// compare length of current closest_match with potential_route, ignoring *\n\t\tif (!closest_match_route) return true;\n\t\treturn potential_route_key.replace(/\\*$/, '').length > closest_match_route.routename.replace(/\\*$/, '').length\n\t}\n\t// if true, the remaing '*' child routes are resolved in the next layer\n\tlet handle_children_separately = false;\n\n\t// handle symbol keys (request methods)\n\tlet matchingSymbol = false;\n\n\tfor (const potential_route_key of Object.keys(entrypointData.entrypoint)) {\n\t\tlet matchWith = entrypointData.route!;\n\n\t\tlet urlPattern:URLPattern;\n\t\t// url with http - match with base origin\n\t\tif (potential_route_key.startsWith(\"http://\") || potential_route_key.startsWith(\"https://\")) {\n\t\t\t// avoid confusion with http and https, allow both\n\t\t\tconst normalizedRouteKey = potential_route_key.replace(/^https?/, \"http{s}?\");\n\t\t\turlPattern = new URLPattern(normalizedRouteKey);\n\t\t\tmatchWith = entrypointData.context.request?.url ? new Path(entrypointData.context.request?.url) : new Path(entrypointData.route!.routename, globalThis.location?.href??'http:///unknown')\n\t\t}\n\t\t// just match a generic route\n\t\telse {\n\t\t\tlet normalized_route_key = potential_route_key;\n\t\t\tif (!potential_route_key.startsWith(\"/\")) normalized_route_key = \"/\" + potential_route_key\n\t\t\tconst [pathname, hash] = normalized_route_key.split(\"#\");\n\t\t\turlPattern = new URLPattern({pathname, hash})\n\t\t}\n\t\t\n\t\tlet match:URLPatternResult|null;\n\t\tif ((match=urlPattern.exec(matchWith.toString())) && isBetterMatch(potential_route_key)) {\n\t\t\tclosest_match_key = potential_route_key;\n\t\t\tclosest_match_route = Path.Route(reconstructMatchedURL(potential_route_key, match));\n\t\t\t// route ends with * -> allow child routes\n\t\t\thandle_children_separately = potential_route_key.endsWith(\"*\");\n\t\n\t\t\t// extend context with additional URL params\n\t\t\tentrypointData.context.params = {...entrypointData.context.params, ...generateURLParamsObject(match)};\n\t\t\tentrypointData.context.urlPattern = match;\t\n\t\t}\n\t}\n\t\n\n\t// check symbols if no match key found, or only default wildcard\n\tif (closest_match_key==null || closest_match_key == \"*\") {\n\t\tfor (const symbolKey of Object.getOwnPropertySymbols(entrypointData.entrypoint)) {\n\t\t\tif (await evaluateFilter(symbolKey as filter, entrypointData.context)) {\n\t\t\t\tmatchingSymbol = true;\n\t\t\t\tclosest_match_key = symbolKey as filter;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\t\n\t\n\tif (closest_match_key!==null) {\n\t\tlet val = <any> entrypointData.entrypoint.$ ? (<any>entrypointData.entrypoint.$)[closest_match_key] : (<EntrypointRouteMap>entrypointData.entrypoint)[closest_match_key];\n\t\tif (val instanceof Datex.ReactiveValue && !(val instanceof Datex.Pointer && val.is_js_primitive)) val = val.val; // only keep primitive pointer references\n\t\tval = await val;\n\t\t// only update route if a string key, symbol keys don't mutate the route\n\t\tconst new_path = matchingSymbol ? entrypointData.route : closest_match_route ? Path.Route(entrypointData.route!.routename.replace(closest_match_route.routename.replace(/\\*$/,\"\"), \"\") || \"/\") : Path.Route(\"/\");\n\t\t\n\t\tconst resolved = await resolveEntrypointRoute({...entrypointData, entrypoint: val, route: new_path});\n\t\tif (!handle_children_separately) resolved.remaining_route = Path.Route(\"/\");\n\t\treturn resolved;\n\t} \n\telse {\n\t\t// pass through if nothing found\n\t\treturn {\n\t\t\tstatus_code: undefined,\n\t\t\tcontent: null,\n\t\t\tloaded: true,\n\t\t\trender_method: RenderMethod.DYNAMIC\n\t\t}\n\t}\n}\n\n\nexport async function resolveEntrypointRoute<T extends Entrypoint>(entrypointData: entrypointData<T>): Promise<resolvedEntrypointData<Entrypoint>> {\n\n\t// init context if missing\n\tif (!entrypointData.context) {\n\t\tentrypointData.context = new Context()\n\t\tif (entrypointData.route) entrypointData.context.path = entrypointData.route.pathname\n\t}\n\t// init route if missing\n\tentrypointData.route ??= Path.Route();\n\n\t// make sure entrypoint Promise is awaited\n\tentrypointData.entrypoint = await entrypointData.entrypoint;\n\n\tlet resolved: resolvedEntrypointData = {\n\t\tcontent: undefined,\n\t\trender_method: RenderMethod.HYBRID,\n\t\tremaining_route: entrypointData.route,\n\t\tloaded: false,\n\t\tstatus_code: undefined\n\t}\n\n\t// handle only return static\n\tif (entrypointData.only_return_static_content && entrypointData.entrypoint && (<any> entrypointData.entrypoint).__render_method == RenderMethod.DYNAMIC) {\n\t\tresolved.remaining_route = Path.Route(\"/\");\n\t\tresolved.render_method = RenderMethod.DYNAMIC;\n\t\tresolved.content = \"\";\n\t}\n\n\t// handle generator functions (exclude class)\n\telse if (!entrypointData.probe_no_side_effects && typeof entrypointData.entrypoint == \"function\" && !/^\\s*class/.test(entrypointData.entrypoint.toString())) {\n\t\tresolved = await resolveGeneratorFunction(entrypointData as entrypointData<html_generator>);\n\t}\n\n\t// handle render presets\n\telse if (entrypointData.entrypoint instanceof RenderPreset || (entrypointData.entrypoint && typeof entrypointData.entrypoint == \"object\" && !(entrypointData.entrypoint instanceof domContext.Element) && '__content' in entrypointData.entrypoint)) {\n\t\tresolved = await resolveRenderPreset(entrypointData as entrypointData<RenderPreset>);\n\t}\n\n\t// handle RouteHandler TODO: better checks for interfaces? (not just 'getRoute')\n\telse if (!entrypointData.probe_no_side_effects && typeof (entrypointData.entrypoint as any)?.getRoute == \"function\") {\n\t\tresolved = await resolveRouteHandler(entrypointData as entrypointData<RouteHandler>);\n\t}\n\n\t// handle FsFile\n\telse if (client_type === \"deno\" && entrypointData.entrypoint instanceof Deno.FsFile) {\n\t\tresolved.content = new Response(entrypointData.entrypoint.readable)\n\t\t// TODO: get mime type from FsFile\n\t\tlogger.warn(\"Mime type cannot be determined for FsFile\");\n\t\t// cors headers (TODO: more general way to define cors behavior)\n\t\tresolved.content.headers.set(\"Access-Control-Allow-Origin\", \"*\");\n\t\tresolved.content.headers.set(\"Access-Control-Allow-Headers\", \"*\");\n\t}\n\n\t// handle FileHandle\n\telse if (client_type === \"deno\" && entrypointData.entrypoint instanceof FileHandle) {\n\t\ttry {\n\t\t\tconst file = await Deno.open(entrypointData.entrypoint.path.normal_pathname);\n\t\t\tconst { mime } = await import(\"https://deno.land/x/mimetypes@v1.0.0/mod.ts\");\n\t\t\tconst mimeType = mime.getType(entrypointData.entrypoint.path.name);\n\n\t\t\tresolved.content = new Response(file.readable)\n\t\t\t// cors headers (TODO: more general way to define cors behavior)\n\t\t\tresolved.content.headers.set(\"Access-Control-Allow-Origin\", \"*\");\n\t\t\tresolved.content.headers.set(\"Access-Control-Allow-Headers\", \"*\");\n\t\t\tif (mimeType) resolved.content.headers.set(\"Content-Type\", mimeType);\n\t\t}\n\t\tcatch {\n\t\t\tthrow HTTPStatus.NOT_FOUND\n\t\t}\n\t}\n\n\n\t// handle status code from HTTPStatus\n\telse if (entrypointData.entrypoint instanceof HTTPStatus) {\n\t\tresolved = await resolveHTTPStatus(entrypointData as entrypointData<HTTPStatus>);\n\t}\n\n\t// await Promise\n\telse if (entrypointData.entrypoint instanceof Promise) {\n\t\tresolved.content = await entrypointData.entrypoint;\n\t}\n\t\n\t// handle path object, not element/markdown/special_content\n\telse if (!(entrypointData.entrypoint instanceof domContext.Element || entrypointData.entrypoint instanceof Datex.Markdown || entrypointData.entrypoint instanceof URL || (client_type === \"deno\" && entrypointData.entrypoint instanceof globalThis.Deno.FsFile)) && entrypointData.entrypoint && typeof entrypointData.entrypoint == \"object\" && Object.getPrototypeOf(entrypointData.entrypoint) == Object.prototype) {\n\t\tresolved = await resolvePathMap(entrypointData as entrypointData<EntrypointRouteMap>) ?? resolved;\n\t}\n\n\t// handle module (prototype null) - get default value\n\telse if (typeof entrypointData.entrypoint == \"object\" && entrypointData.entrypoint && Object.getPrototypeOf(entrypointData.entrypoint) == null) {\n\t\tresolved = await resolveModule(entrypointData as entrypointData<{default?:Entrypoint}>);\n\t}\n\n\t// handle URL\n\telse if (entrypointData.entrypoint instanceof URL) {\n\t\tresolved.content = new Response(null, {\n\t\t\tstatus: 302,\n\t\t\theaders: new Headers({ location: convertToWebPath(entrypointData.entrypoint), \"Access-Control-Allow-Origin\": \"*\", \"Access-Control-Allow-Headers\": \"*\" })\n\t\t});\n\t}\n\n\t// handle Error\n\telse if (entrypointData.entrypoint instanceof Error) {\n\t\tconst [statusCode, html] = createErrorHTML('Routing failed: ' + entrypointData.entrypoint.message, entrypointData.entrypoint);\n\t\tresolved.content = html;\n\t\tresolved.status_code = statusCode;\n\t}\n\t\n\n\t// else just return current entrypoint\n\telse {\n\t\tresolved.content = entrypointData.entrypoint\n\t\t// if (entrypointData.entrypoint != null) {\n\t\t\t\n\t\t// }\n\t\t// else {\n\t\t// \tresolved = {\n\t\t// \t\tstatus_code: 404,\n\t\t// \t\tcontent: \"No Content\",\n\t\t// \t\tloaded: true,\n\t\t// \t\trender_method: RenderMethod.RAW_CONTENT\n\t\t// \t}\n\t\t// }\n\t\t\n\t\t\n\t}\n\n\t// @ts-ignore TODO: is this if condition required? currently commented out, because paths are overriden incorrectly\n\t// if (typeof entrypointData.entrypoint?.resolveRoute !== \"function\") \n\t// \tresolved.remaining_route = Path.Route(\"/\");\n\n\t// only load once in recursive calls when deepest level reached\n\tif (!resolved.loaded) {\n\t\t// preload in deno, TODO: better solution?\n\t\tif (UIX.context == \"backend\" && (entrypointData.entrypoint instanceof domContext.Element || entrypointData.entrypoint instanceof domContext.DocumentFragment)) {\n\t\t\tawait preloadElementOnBackend(entrypointData.entrypoint)\n\t\t}\n\n\t\t// routing handler?\n\t\t// @ts-ignore\n\t\tif (entrypointData.return_first_routing_handler && typeof resolved.content?.getInternalRoute == \"function\") {\n\t\t\t// return [<get_content<T>>collapsed, <any>render_method, status_code, loaded, remaining_route];\n\t\t}\n\n\t\t// @ts-ignore\n\t\telse if (entrypointData.route && typeof resolved.content?.resolveRoute == \"function\") {\n\n\t\t\t// wait until at least construct lifecycle finished\n\t\t\tif (entrypointData.entrypoint instanceof Component) await entrypointData.entrypoint.constructed\n\n\t\t\tif (!await resolveRouteForRouteManager(resolved.content as RouteManager, entrypointData.route, entrypointData.context)) {\n\t\t\t\tresolved.content = null; // reset content, route could not be resolved\n\t\t\t}\n\t\t}\n\n\t\tresolveContext(entrypointData)\n\t\tif ((entrypointData.context as any)._responseHeaders) resolved.headers = (entrypointData.context as any)._responseHeaders;\n\n\t\tresolved.loaded = true;\n\t}\n\n\treturn resolved;\n}\n\n\nexport async function preloadElementOnBackend(element:Element|DocumentFragment, parent?:Element|DocumentFragment) {\n\t// preload in deno, TODO: better solution?\n\tif (UIX.context == \"backend\") {\n\n\t\tconst promises = [];\n\n\t\t// fake dom append for UIX Component\n\t\tif (element instanceof Component) {\n\t\t\tlet resolved = false;\n\t\t\tconst timeoutSec = `${(element.CREATE_TIMEOUT/1000)}s`\n\t\t\tawait Promise.race([\n\t\t\t\telement.connectedCallback(),\n\t\t\t\telement.created,\n\t\t\t\tnew Promise<void>(resolve=>setTimeout(()=>{\n\t\t\t\t\tif (!resolved) {\n\t\t\t\t\t\tlogger.error(\"onCreate() method of \"+element.constructor.name+\" has not resolved after \"+timeoutSec+\", generating static snapshot for available state. Increase the CREATE_TIMEOUT for this component if the onCreate method is supposed to take longer than \"+timeoutSec+\".\");\n\t\t\t\t\t\tresolve()\n\t\t\t\t\t}\n\t\t\t\t},element.CREATE_TIMEOUT))\n\t\t\t])\n\t\t\tresolved = true;\n\t\t}\n\t\t\n\t\t// fake dom append for other elements with connectedCallback (e.g light-root)\n\t\telse if (typeof (element as any).connectedCallback == \"function\") {\n\t\t\t(element as any).connectedCallback();\n\t\t}\n\n\t\t// load shadow root\n\t\tif ((element as Element).shadowRoot) promises.push(preloadElementOnBackend((element as Element).shadowRoot!, element))\n\t\t// load children\n\t\tfor (const child of (element.childNodes as unknown as Element[])) {\n\t\t\tpromises.push(preloadElementOnBackend(child, element));\n\t\t}\n\n\t\tawait Promise.all(promises)\n\t}\n}\n\n/**\n * Resolve a route on a RouteManager\n * @param routeManager RouteManager impl\n * @param route array of route parts\n * @param context UIX context\n * @returns true if the route could be fully resolved\n */\nasync function resolveRouteForRouteManager(routeManager: RouteManager, route:Path.Route, context: Context|ContextGenerator) {\n\tif (typeof context == \"function\") context = await context();\n\tconst valid_route_part = <Path.route_representation> await Promise.race([\n\t\trouteManager.resolveRoute(route, context),\n\t\tnew Promise((_,reject) => setTimeout(()=>{\n\t\t\treject(new Error(\"Route Manager (\"+routeManager.constructor.name+\") did not resolve after 5s. There is probably a deadlock somehere. This can for example happen in a Component when awaiting defer() in the onRoute() handler.\"))\n\t\t}, 5000))\n\t])\n\treturn Path.routesAreEqual(route, valid_route_part);\n}\n\n/**\n * gets the part of the route that is calculated without internal routing (RouteManager). \n * Recalculate the current path from the inner Routing Handler if it exists\n * @param route \n * @param entrypoint \n * @param context \n * @returns \n */\nexport async function refetchRoute(route: Path.route_representation, entrypoint: Entrypoint, context?:Context) {\n\tconst route_path = Path.Route(route);\n\n\tconst {content: routing_handler, remaining_route} = await resolveEntrypointRoute({entrypoint, route: route_path, context, return_first_routing_handler: true});\n\n\t// resolve internal route in RouteManager\n\tif (routing_handler?.getInternalRoute) {\n\t\tif (!remaining_route) throw new Error(\"could not reconstruct route \" + route_path.routename);\n\t\n\t\t// valid part of route before potential RouteManager\n\t\tconst existing_route = Path.Route(route_path.routename.replace(remaining_route.routename,\"\"));\n\t\n\t\tconst combined_route = <Path.Route> existing_route.getChildRoute(Path.Route(await (<RouteManager>routing_handler).getInternalRoute()));\n\t\treturn combined_route;\n\t}\n\t// no internal routing, just return original route\n\telse return route_path;\n\t\n}"],"names":["Path","Datex","evaluateFilter","CACHED_CONTENT","getOuterHTML","HTTPStatus","RenderPreset","RenderMethod","client_type","createErrorHTML","Context","Component","logger","domContext","UIX","convertToWebPath","FileHandle","globalThis","URLPattern","createSnapshot","content","render_method","HYBRID","preloadElementOnBackend","injectStandaloneJS","STATIC","injectStandaloneComponents","lang","Runtime","ENV","LANG","includeShadowRoots","reconstructMatchedURLPart","input","partResult","name","val","Object","entries","groups","replace","reconstructMatchedURL","match","protocol","username","password","hostname","pathname","hash","search","resolveContext","entrypointData","context","Error","resolveGeneratorFunction","returnValue","hasError","entrypoint","params","e","keys","length","code","Response","status","warn","URL","INTERNAL_SERVER_ERROR","with","resolved","resolveEntrypointRoute","BACKEND","resolveRenderPreset","__render_method","CACHED_RESPONSE","route","response","fetch","headers","Headers","__content","credentials","status_code","loaded","undefined","__status_code","resolveHTTPStatus","resolveRouteHandler","route2","getRoute","Route","resolveModule","default","generateURLParamsObject","matches","key","port","isNaN","Number","resolvePathMap","closest_match_key","closest_match_route","isBetterMatch","potential_route_key","routename","handle_children_separately","matchingSymbol","urlPattern","matchWith","startsWith","request","url","location","href","normalized_route_key","split","exec","toString","endsWith","symbolKey","getOwnPropertySymbols","DYNAMIC","$","ReactiveValue","Pointer","is_js_primitive","new_path","remaining_route","path","only_return_static_content","probe_no_side_effects","test","Element","Deno","FsFile","readable","set","file","open","normal_pathname","mime","mimeType","getType","NOT_FOUND","Promise","Markdown","getPrototypeOf","prototype","statusCode","html","message","DocumentFragment","return_first_routing_handler","getInternalRoute","resolveRoute","constructed","resolveRouteForRouteManager","_responseHeaders","element","parent","promises","timeoutSec","CREATE_TIMEOUT","race","connectedCallback","created","resolve","setTimeout","error","constructor","child","shadowRoot","push","childNodes","all","routeManager","valid_route_part","_","reject","routesAreEqual","refetchRoute","route_path","routing_handler","existing_route","getChildRoute"],"mappings":"AAAA,SAASA,IAAI,QAAQ,kCAAkC;AACvD,SAASC,KAAK,QAAQ,oBAAoB;AAC1C,SAAQC,cAAc,QAAe,oBAAoB;AAGzD,SAASC,cAAc,EAAEC,YAAY,QAAQ,oBAAoB;AACjE,SAASC,UAAU,QAAQ,yBAAyB;AACpD,SAASC,YAAY,EAAEC,YAAY,QAAQ,4BAA2B;AACtE,SAASC,WAAW,QAAQ,uCAAuC;AACnE,SAASC,eAAe,QAAQ,qBAAqB;AACrD,SAASC,OAAO,QAA0B,eAAe;AACzD,SAASC,SAAS,QAAQ,6BAA6B;AACvD,SAASC,MAAM,QAAQ,4BAA4B;AACnD,SAASC,UAAU,QAAQ,wBAAwB;AACnD,SAASC,GAAG,QAAQ,eAAe;AACnC,SAASC,gBAAgB,QAAQ,gCAAgC;AACjE,SAASC,UAAU,QAAQ,0BAA0B;AAIhDC,WAAWC,UAAU,IACzB,MAAM,MAAM,CAAC;AAYd,OAAO,eAAeC,eAAmDC,OAAS,EAAEC,gBAAgBd,aAAae,MAAM;IAItH,OAHA,MAAMC,wBAAwBH,UAE9BA,OAAO,CAACjB,eAAe,GAAGC,aAAagB,SAAS;QAACI,oBAAmBH,iBAAed,aAAakB,MAAM;QAAEC,4BAA2BL,iBAAed,aAAakB,MAAM;QAAEE,MAAK1B,MAAM2B,OAAO,CAACC,G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