{"version":3,"sources":["Component.ts"],"sourcesContent":["// deno-lint-ignore-file no-async-promise-executor\nimport { Datex, property, get} from \"datex-core-legacy\"\nimport { logger } from \"../utils/global-values.ts\"\nimport { Class, Logger, METADATA, ValueError } from \"datex-core-legacy/datex_all.ts\"\nimport { CHILD_PROPS, CONTENT_PROPS, ID_PROPS, IMPORT_PROPS, LAYOUT_PROPS, ORIGIN_PROPS, STANDALONE_PROPS } from \"../base/decorators.ts\";\nimport { Path } from \"datex-core-legacy/utils/path.ts\";\nimport { RouteManager } from \"../providers/entrypoints.ts\";\nimport { Context } from \"../routing/context.ts\";\nimport { makeScrollContainer, scrollContext, scrollToBottom, scrollToTop, updateScrollPosition } from \"../standalone/scroll_container.ts\";\nimport { OpenGraphInformation, OpenGraphPreviewImageGenerator, OPEN_GRAPH } from \"../base/open-graph.ts\";\nimport { bindContentProperties } from \"../standalone/bound_content_properties.ts\";\nimport { DX_IGNORE, DX_TYPE, DX_ROOT, INIT_PROPS } from \"datex-core-legacy/runtime/constants.ts\"\nimport { PlaceholderCSSStyleDeclaration, addGlobalStyleSheetLink, addStyleSheetLink } from \"../utils/css-style-compat.ts\";\nimport { indent } from \"datex-core-legacy/utils/indent.ts\"\nimport { serializeJSValue } from \"../utils/serialize-js.ts\";\nimport { BOUND_TO_ORIGIN, bindToOrigin, getValueInitializer } from \"../app/datex-over-http.ts\"\nimport type { DynamicCSSStyleSheet } from \"../utils/css-template-strings.ts\";\nimport { addCSSScopeSelector } from \"../utils/css-scoping.ts\"\nimport { jsxInputGenerator } from \"../html/template.ts\";\nimport { domContext, domUtils } from \"../app/dom-context.ts\";\nimport { UIX } from \"../../uix.ts\";\nimport { convertToWebPath } from \"../app/convert-to-web-path.ts\";\nimport { client_type } from \"datex-core-legacy/utils/constants.ts\";\nimport { app } from \"../app/app.ts\";\nimport { fileExists } from \"../utils/files.ts\";\nimport { DISPOSE_BOUND_PROTOTYPE } from \"../standalone/get_prototype_properties.ts\";\nimport { getDeclaredExternalVariables, getDeclaredExternalVariablesAsync } from \"datex-core-legacy/types/function-utils.ts\";\nimport { JSTransferableFunction } from \"datex-core-legacy/types/js-function.ts\";\nimport { MappedProps } from \"../html/template-types.ts\";\nexport { template } from \"../html/template.ts\";\nexport { style } from \"../html/style.ts\";\n\nexport type propInit = {datex?:boolean};\nexport type standaloneContentPropertyData = {type:'id'|'content'|'layout'|'child',id:string};\nexport type standalonePropertyData = {type:'prop'}\nexport type standaloneProperties = Record<string, (standaloneContentPropertyData | standalonePropertyData) & {init?:propInit }>;\n\n// deno-lint-ignore no-empty-interface\ninterface DefaultProps {}\n\n// @template(\"uix:component\") \nexport abstract class Component<Props extends DefaultProps = DefaultProps, ChildElement = JSX.singleOrMultipleChildren> extends domContext.HTMLElement implements RouteManager {\n\n    /************************************ STATIC ***************************************/\n\n    protected static stylesheets:string[] =  []\n\n    protected static shadow_stylesheets:string[] =  [\n        // global base style\n        new URL('../style/base.css', import.meta.url).toString()\n    ]\n    \n\n    static CLONE_OPTION_KEYS: Set<string> // list of all default option keys that need to be cloned when options are initialized (non-primitive options)\n\n    // guessing module stylesheets, get added to normal stylesheets array after successful fetch\n    private static _dx_files:string[] = []\n\n\n    protected static _module:string\n    protected static _use_resources: boolean;\n\n    declare static [METADATA]:any\n    declare static [Datex.DX_TYPE]?: Datex.Type\n\n    \n    /**\n     * find the x.dx file matching the x.ts module file of this component (if specified)\n     */\n    private static findModuleBoundDatexScripts(){\n        if (this._use_resources) {\n            const dx_url = this._module.replace(/\\.m?(ts|js)x?$/, '.dx');\n            this._dx_files = [...this._dx_files]; // create new dx module array are for this class\n            this._dx_files.unshift(dx_url)\n        }\n    }\n\n    private static _dx_loaded_resolve?:Function\n    private static _dx_loaded_promise?:Promise<void>\n\n    private static async loadModuleDatexImports(){\n\n        // return promise if loaded / loading\n        if (Object.hasOwn(this, '_dx_loaded_promise') && this._dx_loaded_promise) return this._dx_loaded_promise;\n        this._dx_loaded_promise = new Promise(resolve=>this._dx_loaded_resolve=resolve);\n\n        this.findModuleBoundDatexScripts();\n\n        const valid_dx_files:string[] = [];\n        const dx_file_values = new Map<string,[any,Set<string>]>();\n\n        for (const path of this._dx_files) {\n            try {\n                // deno local file\n                if (path.startsWith(\"file://\")) {\n                    if (new Path(path).fs_exists) await this.loadDatexModuleContents(path, valid_dx_files, dx_file_values)\n                }\n                // web path\n                else {\n                    if (await fileExists(path)) await this.loadDatexModuleContents(path, valid_dx_files, dx_file_values)\n                }\n            }\n            catch (e) {\n                if (path.startsWith(\"file://\")) throw e\n                \n                // TODO: weird fix, fetch again if error\n                else {\n                    try {\n                        await this.loadDatexModuleContents(path, valid_dx_files, dx_file_values)\n                    }\n                    catch {}\n                }\n            }\n        }\n\n        // inherit\n        this.virtualDatexPrototype = Object.create(this.virtualDatexPrototype)\n\n        await this.loadDatexImports(this, valid_dx_files, dx_file_values);\n\n        this._dx_loaded_resolve?.();\n    }\n\n    private static async loadDatexModuleContents(path: string, valid_dx_files:string[], dx_file_values:Map<string, [any, Set<string>]>) {\n        valid_dx_files.push(path);\n        try {\n            dx_file_values.set(path, [<any>await get(path, undefined, this._module), new Set()])\n            logger.debug(\"loaded DATEX module script: \" + path)    \n        }\n        catch (e) {\n            throw new Error(\"Error loading DATEX module script '\" + path + \"': \" + e?.stack)\n        }\n    }\n\n    // used as workaround to simulate prototype inheritence of datex properties bound with @include\n    private static virtualDatexPrototype:Record<string,unknown> = {}\n\n    private static async loadDatexImports(target:Component|typeof Component, valid_dx_files:string[], dx_file_values:Map<string,[any,Set<string>]>){\n        const allowed_imports:Record<string,[string, string]> = target[METADATA]?.[IMPORT_PROPS]?.public\n        \n        // try to resolve imports\n        for (const [prop, [location, exprt]] of Object.entries(allowed_imports??{})) {\n            // try to get from module dx files\n            if (location == undefined) {\n                let found = false;\n\n                if (!valid_dx_files.length) {\n                    if (!this._use_resources) throw new Error(`Could not load export '${exprt}' for component class '${this.name}' - external resources are disabled. Either remove the @NoResources decorator and create a corresponding DATEX file next to the TypeScript module file, or specifiy a different resource location in the @include decorator.`)\n                    else if (!this._module) throw new Error(`Could not load export '${exprt}' for component class '${this.name}'. The component module could not be initialized correctly (missing @template decorator?)`);  // this.module could not be set for whatever reason\n                    else throw new Error(`No corresponding DATEX module file found for export '${exprt}' in component class '${this.name}'. Please create a DATEX file '${this._module.replace(/\\.m?(ts|js)x?$/, '.dx')} or specifiy a resource location in the @include decorator.`)\n                }\n\n                for (const file_data of dx_file_values.values()) {\n                    const file_val = file_data[0];\n                    if (exprt == \"*\") {\n                        this.virtualDatexPrototype[prop] = file_val;\n                        found = true;\n                        file_data[1].add(exprt); // remember that export was used\n                        logger.debug(`using DATEX export '${exprt}' ${exprt!=prop?`as '${prop}' `:''}in '${this.name}'`);\n                    }\n                    else if (Datex.DatexObject.has(file_val, exprt)) {\n                        this.virtualDatexPrototype[prop] = Datex.DatexObject.get(file_val, exprt);\n                        found = true;\n                        file_data[1].add(exprt); // remember that export was used\n                        logger.debug(`using DATEX export '${exprt}' ${exprt!=prop?`as '${prop}' `:''}in '${this.name}'`);\n                        break;\n                    }\n                }\n                if (!found) {\n                    throw new Error(`'${exprt}' is not exported in ` + valid_dx_files.join(\" or \"))\n                }\n            }\n            \n            else {\n                let err:Error|undefined;\n                try {\n                    const res = await get(location, undefined, this._module);\n                    if (exprt == \"*\") {\n                        this.virtualDatexPrototype[prop] = res;\n                    }\n                    else {\n                        if (Datex.DatexObject.has(<Record<string | symbol, unknown>>res, exprt)) { \n                            this.virtualDatexPrototype[prop] = Datex.DatexObject.get(<Record<string | symbol, unknown>>res, exprt);\n                        }\n                        else err = new Error(`Could not load export '${exprt}' for component class '${this.name}': Not exported from location '${location}'`)\n                    }\n                   \n                }\n                catch (e) {\n                    throw new Error(`Error loading export '${exprt}' for component class '${this.name}' from location '${location}: ${e?.stack}`)\n                }\n\n                if (err) throw err; // throw inner error\n               \n            }\n\n        }\n    }\n\n    private static standalone_loaded = new Set<typeof Component>();\n    private static standalone_class_code = new Map<typeof Component,string>();\n\n    private static async loadStandaloneProps() {\n        if (this.standalone_loaded.has(this)) return;\n        this.standalone_loaded.add(this);\n\n        this.standaloneMethods = {};\n        this.standaloneProperties = {};\n\n        const props:Record<string, string> = this[METADATA]?.[STANDALONE_PROPS]?.public;\n        const originProps:Record<string, propInit> = this[METADATA]?.[ORIGIN_PROPS]?.public;\n        const idProps:Record<string,string> = this[METADATA]?.[ID_PROPS]?.public;\n        const layoutProps:Record<string,string> = this[METADATA]?.[LAYOUT_PROPS]?.public;\n        const contentProps:Record<string,string> = this[METADATA]?.[CONTENT_PROPS]?.public;\n        const childProps:Record<string,string> = this[METADATA]?.[CHILD_PROPS]?.public;\n\n        const allStandaloneProps = {...props, ...idProps, ...layoutProps, ...contentProps, ...childProps};\n        \n        // TODO: required? workaround: if [STANDALONE_PROPS] from parent isn't overriden, skip this:\n        for (const name of Object.keys(allStandaloneProps)) {\n            const desc = Object.getOwnPropertyDescriptor(this.prototype, name)\n            // is method\n            if (!desc?.get && !desc?.set && (this.prototype as any)[name]) {\n                // also bound to origin\n                if (originProps?.[name]) {\n                    this.addStandaloneProperty(name, originProps?.[name]);\n                } else this.addStandaloneMethod(name, (this.prototype as any)[name]);\n            }\n            // otherwise, instance property\n            else this.addStandaloneProperty(name, originProps?.[name]);\n        }\n      \n        const type = Datex.Type.getClassDatexType(this as any)!\n\n        // check if prototype methods include use() statement\n        for (const name of Object.getOwnPropertyNames(this.prototype)) {\n            const desc = Object.getOwnPropertyDescriptor(this.prototype, name)\n            if (desc?.get || desc?.set) continue;\n            if (name == \"constructor\") continue;\n            const method = (this.prototype as any)[name];\n            const useDeclaration = JSTransferableFunction.functionIsAsync(method) ? await getDeclaredExternalVariablesAsync(method) : getDeclaredExternalVariables(method);\n            // just standalone, no external variables\n            if (useDeclaration.flags?.includes(\"standalone\") && !Object.keys(useDeclaration.vars).length) {\n                this.addStandaloneMethod(name, method);\n            }\n            // (standalone) transferable function\n            else if (Object.keys(useDeclaration.vars).length) {\n                (this.prototype as any)[name] = $(JSTransferableFunction.create(method, undefined, useDeclaration)); \n                if (useDeclaration.flags?.includes(\"standalone\")) this.addStandaloneMethod(name, (this.prototype as any)[name]);\n                // also override type template to add overridden transferable function as datex property\n                type.template[name] = Datex.Type.js.TransferableFunction;\n                type.setTemplate(type.template);\n            }\n        }\n    }\n\n    private static inferredStandaloneMethods:Record<string,string[]> = {\n        'onRoute': ['resolveRoute']\n    }\n\n    // add methods that run in standalone mode\n    private static standaloneMethods:Record<string, Function> = {};\n    protected static addStandaloneMethod(name: string, value: Function) {\n        this.standaloneMethods[name] = value;\n        // add inferred methods\n        for (const method of this.inferredStandaloneMethods[name]??[]) this.addStandaloneMethod(method, this.prototype[<keyof typeof this.prototype>method]);\n    }\n\n    protected isStandaloneProperty(name:string) {\n        return !! (this[METADATA]?.[STANDALONE_PROPS]?.public?.[name])\n    }\n\n    // add instance properties that are loaded in standalone mode\n    protected static standaloneProperties:standaloneProperties = {};\n    protected static addStandaloneProperty(name: string, init?:propInit) {\n        if (name in (this[METADATA]?.[ID_PROPS]?.public??{})) {\n            const id = this[METADATA]?.[ID_PROPS]?.public[name];\n            // // extract initializer from class source code\n            // const classCode = this.toString().replace(/.*{/, '');\n            // const propertyCode = classCode.match(new RegExp(String.raw`\\b${name}\\s*=\\s*([^;]*)\\;`))?.[1];\n            // if (!propertyCode) {\n            //     console.log(classCode)\n            //     throw new Error(\"Could not create @standalone property \\\"\"+name+\"\\\". Make sure you add a semicolon (;) at the end of the property initialization.\")\n            // }\n            this.standaloneProperties[name] = {type:'id', id, init};\n        }\n        else if (name in (this[METADATA]?.[CONTENT_PROPS]?.public??{})) {\n            const id = this[METADATA]?.[CONTENT_PROPS]?.public[name] ?? this[METADATA]?.[ID_PROPS]?.public[name];\n            this.standaloneProperties[name] = {type:'content', id, init};\n        }\n        else if (name in (this[METADATA]?.[LAYOUT_PROPS]?.public??{})) {\n            const id = this[METADATA]?.[LAYOUT_PROPS]?.public[name] ?? this[METADATA]?.[ID_PROPS]?.public[name];\n            this.standaloneProperties[name] = {type:'layout', id, init};\n        }\n        else if (name in (this[METADATA]?.[CHILD_PROPS]?.public??{})) {\n            const id = this[METADATA]?.[CHILD_PROPS]?.public[name] ?? this[METADATA]?.[ID_PROPS]?.public[name];\n            this.standaloneProperties[name] = {type:'child', id, init};\n        }\n        // normal property\n        else {\n            this.standaloneProperties[name] = {type:'prop', init};\n        }\n    }\n\n    /**\n     * returns a pseudo class that is used in standalone mode (only generated if standalone methods exist)\n     */\n    public static getStandalonePseudoClass() {\n        // get from cache\n        if (this.standalone_class_code.has(this)) {\n            return this.standalone_class_code.get(this);\n        }\n\n        const parent = this.getParentClass();\n\n        let js_code = `class ${this.name}${parent ? ` extends globalThis.UIX_Standalone.${parent.name}`:''} {${Object.values(this.standaloneMethods).length?'\\n':''}`;\n        js_code += this.getStandaloneConstructor();\n        for (const [_name, content] of Object.entries(this.standaloneMethods)) {\n            js_code += this.getStandaloneMethodContentWithMappedImports(content) + '\\n';\n            if (content instanceof JSTransferableFunction && content.deps) {\n                // TODO:\n                throw new Error(\"Injecting variable with use('standalone') is currently not supported for component methods.\")\n            }\n        }\n        js_code += '}'\n\n        // save static class code in cache\n        this.standalone_class_code.set(this,js_code);\n        return js_code;\n    }\n\n    /**\n     * returns the parent class if not Component\n     */\n    public static getParentClass(): typeof Component {\n        return Object.getPrototypeOf(this) != domContext.HTMLElement ? Object.getPrototypeOf(this) : null;\n    }\n\n    /**\n     * maps file import paths (datex.get or import) in JS source code to web paths\n     */\n    private static getStandaloneMethodContentWithMappedImports(method:Function, name?: string){\n        const content = method.toString().replace(/(import|datex\\.get) *\\((?:'((?:\\.(\\.)?\\/).*)'|\"((?:\\.(\\.)?\\/).*)\")\\)/g, (m,g1,g2,g3,g4)=>{\n            const relImport = g2 ?? g4;\n            const absImport = new Path(relImport, this._module);\n\n            return `${g1}(\"${convertToWebPath(absImport)}\")`\n        })\n        // transferable funciton\n        if (method instanceof JSTransferableFunction) \n            return content.replace(/^(async )?function/, '');\n        \n        if (name)\n            return content.replace(\"function\", name);\n\n        return content;\n    }\n\n    protected static standaloneEnabled() {\n        return !! (\n            Object.keys(this.standaloneMethods).length || \n            Object.keys(this.standaloneProperties).length ||\n            Object.getPrototypeOf(Object.getPrototypeOf(this)).standaloneEnabled?.()\n        )\n    }\n\n\n    protected static getStandaloneConstructor() {\n        if (this.name === Component.name) return indent(4) `\n            _standalone_construct() {\n                this.standalone = true;\n            }\n        `\n        else {\n            const propInit = this.generatePropertySelectorCode();\n            if (propInit) {\n                return indent(4) `\n                _standalone_construct() {\n                    ${propInit};\n                    super._standalone_construct();\n                }\n                `\n            }\n            else return \"\";\n        }\n    }\n\n    protected static generatePropertySelectorCode() {\n        let js_code = \"\";\n\n        // bind content properties\n        const idProps:Record<string,string> = {};\n        const contentProps:Record<string,string> = {};\n        const layoutProps:Record<string,string> = {};\n        const childProps:Record<string,string> = {};\n\n        let has_content_prop = false;\n        for (const [name, data] of Object.entries(this.standaloneProperties)) {\n            if (data.type == \"id\") {idProps[name] = data.id; has_content_prop=true;}\n            else if (data.type == \"content\") {contentProps[name] = data.id; has_content_prop=true;}\n            else if (data.type == \"layout\") {layoutProps[name] = data.id; has_content_prop=true;}\n            else if (data.type == \"child\") {childProps[name] = data.id; has_content_prop=true;}\n        }\n        if (has_content_prop) {\n            js_code += `bindContentProperties(this, ${JSON.stringify(idProps)}, ${JSON.stringify(contentProps)}, ${JSON.stringify(layoutProps)}, ${JSON.stringify(childProps)}, true, false);\\n`\n        }\n\n        for (const [name, data] of Object.entries(this.standaloneProperties)) {\n            // normal property init\n            if (data.type == \"prop\") {\n                // js_code += `this[\"${name}\"] = ${data.init};\\n`\n            }\n            // check if already in DOM, otherwise create (TODO: improve)\n            else if (data.type == \"id\") {\n                js_code += `this[\"${name}\"] = ${this.getSelectorCode(data, 'this')};\\n`\n            }\n            // @content, @child, @layout - find with selector\n            else {\n                js_code += `this[\"${name}\"] = ${this.getSelectorCode(data, 'this')};\\n`;\n            } \n        }\n        return js_code;\n    }\n\n    protected static getSelectorCode(propData:standaloneContentPropertyData, self:string) {\n        // direct child, never in shadow root\n        if (propData.type == \"child\") return `${self}.querySelector(\"#${propData.id}\")`;\n        // others might be in shadow root\n        else return `${self}.shadowRoot?.querySelector(\"#${propData.id}\") ?? ${self}.querySelector(\"#${propData.id}\")`;\n    }\n\n    /** wait until static (css) and dx module files loaded */\n    public static async init() {\n        // init all parent components up the prototype chain (static super.init())\n        const parent = Object.getPrototypeOf(this)\n        if (parent !== Component) await Component.init.call(Object.getPrototypeOf(parent));\n        await this.loadModuleDatexImports();\n    }\n\n\n    private static module_stylesheets:string[] = []\n    private static style_sheets_by_url = new Map<string, CSSStyleSheet|false>()\n    private static style_sheets_loaders = new Map<string, Promise<CSSStyleSheet|false>>()\n\n    /**\n     * Get a stylesheet from an url or from cache\n     * @param url URL or url string to css file\n     * @returns the created stylesheet\n     */\n    private static getURLStyleSheet(url:string|URL, allow_fail = false):Promise<CSSStyleSheet|false>|CSSStyleSheet|false {\n        const url_string = url.toString();\n\n        // already loaded\n        if (this.style_sheets_by_url.has(url_string)) {\n            return this.style_sheets_by_url.get(url_string)!;\n        } \n        // there's already an active loader - await\n        else if (this.style_sheets_loaders.has(url_string)) {\n            return this.style_sheets_loaders.get(url_string)!;\n        }\n        // create new (fetch stylesheet)\n        else {\n            const loader = new Promise<CSSStyleSheet|false>(async resolve=>{\n                const stylesheet = await this.loadURLStyleSheet(url_string, allow_fail);\n                resolve(stylesheet);\n                this.style_sheets_loaders.delete(url_string); // remove loader\n            })\n            this.style_sheets_loaders.set(url_string, loader);\n            return loader;\n        }\n    }\n\n    /**\n     * Load a stylesheet URL to a CSSStyleSheet and save in Component class cache\n     * @param url css file url\n     * @returns the constructed stylesheet\n     */\n     private static async loadURLStyleSheet(url:string, allow_fail = false){\n\n        if (!await fileExists(url)) {\n            this.style_sheets_by_url.set(url, false) // save invalid stylesheet\n            if (!allow_fail) {\n                logger.error(\"could not load css stylesheet: \" + url);\n            }\n            return false;\n        }\n\n        let res:Response;\n        try {\n            res = await fetch(url);\n        } \n        catch (e) {\n            if (!allow_fail) logger.error(\"could not load css stylesheet: \" + url);\n            return false;\n        }\n\n        // response was okay\n        if (res.ok) {\n            const stylesheet = <CSSStyleSheet> new globalThis.CSSStyleSheet();\n            const style = await res.text();\n            await stylesheet.replace(style);\n    \n            this.style_sheets_by_url.set(url, stylesheet) // save\n            logger.debug(\"css stylesheet loaded: \" + url)\n\n            return stylesheet;\n        }\n\n        else {\n            this.style_sheets_by_url.set(url, false) // save invalid stylesheet\n            if (!allow_fail) {\n                logger.error(\"could not load css stylesheet: \" + url);\n            }\n            return false;\n        }\n\n    }\n\n    /**\n     * Preload the required stylesheets for this component (fetch URLs and save in cache as CSSStyleSheets)\n     * @returns all CSSStyleSheets\n     */\n    public static preloadStylesheets():Promise<(CSSStyleSheet|false)[]> {\n        // clone this.stylesheets for current class if not already cloned\n        this.stylesheets = [...this.stylesheets];\n        this.shadow_stylesheets = [...this.shadow_stylesheets];\n        // find matching .css and .dx files by name\n        this.addPotentialModuleStylesheet(); \n\n        const loaders:Promise<CSSStyleSheet|false>[] = [];\n\n        for (const url of [...this.stylesheets, ...this.shadow_stylesheets]) {\n            // add to loaders if not already loading/loaded\n            if (!this.style_sheets_by_url.has(url) && !this.style_sheets_loaders.has(url)) {\n                loaders.push(<Promise<CSSStyleSheet|false>>this.getURLStyleSheet(url, this.module_stylesheets.includes(url)))\n            }\n        }\n\n        return Promise.all(loaders)\n    }\n\n    /**\n     * find the x.css file matching the x.ts module file of this component (if specified)\n     */\n    private static addPotentialModuleStylesheet(){\n        if (this._use_resources) {\n            const css_url = this._module.replace(/\\.m?(ts|js)x?$/, '.css');\n            \n            this.module_stylesheets = [...this.module_stylesheets]; // create new module stylesheets are for this class\n            this.module_stylesheets.push(css_url); // remember as module stylesheets\n            const url_string = new URL(css_url).toString();\n            if (!this.stylesheets.includes(url_string)) {\n                this.stylesheets.push(url_string) // add to normal stylesheets\n            }\n            if (!this.shadow_stylesheets.includes(url_string)) {\n                this.shadow_stylesheets.push(url_string) // add to shadow stylesheets\n            }\n        }\n    }\n\n\n\n\n\n    /************************************ END STATIC ***************************************/\n\n    // options\n    /**\n     * @deprecated use props instead\n     */\n    get options() {\n        return this.props;\n    }; \n\n    private readonly props!: Readonly<MappedProps<Props> & {children?:ChildElement|ChildElement[]} & JSX._IntrinsicAttributes<this>>\n\n    public get properties(): Readonly<Props> {\n        return this.props\n    }\n\n    declare $:Datex.Proxy$<this> // reference to value (might generate pointer property, if no underlying pointer reference)\n    declare $$:Datex.PropertyProxy$<this> // always returns a pointer property reference\n\n    declare [METADATA]:any\n    declare [OPEN_GRAPH]?:OpenGraphInformation\n\n    declare public readonly childNodes: NodeListOf<ChildElement extends ChildNode ? ChildElement : ChildNode> & Iterable<ChildElement extends ChildNode ? ChildElement : ChildNode>;\n    declare public readonly children: Iterable<ChildElement extends ChildNode ? ChildElement : ChildNode> & HTMLCollection;\n\n    /**\n     * true if component is in standalone mode (UIX library not loaded)\n     */\n    public standalone = false;\n\n    protected openGraphImageGenerator?: OpenGraphPreviewImageGenerator; // set the custom preview image generator for open graph cards\n\n    protected is_skeleton = false // true if component not yet fully initialized, still displayed as skeleton and not associated with DATEX object\n\n    protected reconstructed_from_dom = false\n\n    constructor()\n    constructor(props?:Props)\n    constructor(props?:Props) {\n        // constructor arguments handlded by DATEX @constructor, constructor declaration only for IDE / typescript\n        super()\n\n\n        // pre-init options before other DATEX state is initialized \n        // (this should not happen when reconstructing, because options are undefined or have [INIT_PROPS])\n        if (props && !props[INIT_PROPS]) this.initProps(props);\n\n        // handle special case: was created from DOM\n        if (!Datex.Type.isConstructing(this)) {\n            // @ts-ignore preemptive [INIT_PROPS], because construct is called - normally handled by js interface (TODO: better solution?)\n            if (props?.[INIT_PROPS]) props[INIT_PROPS](this);\n\n            const classType = Datex.Type.getClassDatexType(this.constructor as typeof Component);\n            if (classType.name !== \"uix\") {\n                console.log(this.constructor);\n                logger.error(\"cannot construct UIX element from DOM because DATEX type could not be found (\"+this.constructor.name+\")\")\n                return;\n            }\n            this.reconstructed_from_dom = true;\n\n            // ignore if currently hydrating static element\n            if (this.hasAttribute(\"uix-static\") || this.hasAttribute(\"uix-dry\")) {\n                this.is_skeleton = true;\n                logger.debug(\"hydrating component \" + classType);\n                // throw error if option properties are access during class instance member initialization (can't know options at this point)\n                this.props = new Proxy({}, {\n                    get: (target, prop) => {\n                        throw new Error(`Tried to access uninitialized option property '${String(prop)}' during class instance member initialization of hydrated component. Please put the property initialization in the onConstruct() method.`)\n                    }\n                })\n            }\n            else {\n                // logger.debug(\"creating \" + this.constructor[Datex.DX_TYPE] + \" component from DOM\");\n                return (<Datex.Type>classType).construct(this, [], true, true);\n            }\n        }\n\n    }\n\n    override attachShadow(init:ShadowRootInit) {\n        const shadowRoot = super.attachShadow(init);\n        this.initShadowRootStyle();\n        return shadowRoot!;\n    }\n\n    /**\n     * don't send shadow root over datex, not part of component state like for default html elements with custom shadow dom\n     */\n    private disableShadowForDATEX(){\n        (<any>this.shadowRoot)![DX_IGNORE] = true;\n    }\n\n    private initShadowRootStyle() {\n        // TODO: still required?\n        // this.addStyleSheet(UIX.Theme.stylesheet);\n        for (const url of (<typeof Component>this.constructor).shadow_stylesheets??[]) this.addStyleSheet(url);\n        // this.disableShadowForDATEX();\n    }\n\n    // apply css properties to this element\n    public css(property:string, value?:Datex.RefOrValue<string|number>):this\n    public css(properties:{[property:string]:Datex.RefOrValue<string|number>}):this\n    public css(properties_object_or_property:{[property:string]:Datex.RefOrValue<string|number>}|string, value?:Datex.CompatValue<string|number>):this {\n        if (typeof properties_object_or_property == \"string\") return domUtils.setCSS(this, properties_object_or_property, value)\n        else return domUtils.setCSS(this, properties_object_or_property)\n    }\n\n    // add css classes\n    public cssClass(classes:Datex.RefOrValue<string[]>):this\n    public cssClass(...classes:string[]):this\n    public cssClass(...classes:(Datex.RefOrValue<string[]>|string)[]):this {\n        return domUtils.setCssClass(this, ...<string[]>classes);\n    }\n\n    private handleIdProps(constructed=false){\n        const constructorList = [this.constructor] \n        while (true) {\n            const _constructor = Object.getPrototypeOf(Object.getPrototypeOf(constructorList.at(-1)!));\n            if (_constructor === domContext.HTMLElement || _constructor === domContext.Element || _constructor === Object)\n                break;\n            constructorList.push(_constructor);\n        }\n        for (const constr of constructorList.toReversed()) {\n            const id_props:Record<string,string> = (constr as any)[METADATA]?.[ID_PROPS]?.public;\n            const content_props:Record<string,string> = (constr as any)[METADATA]?.[CONTENT_PROPS]?.public;\n            const layout_props:Record<string,string> = (constr as any)[METADATA]?.[LAYOUT_PROPS]?.public;\n            // only add children when constructing component, otherwise they are added twice\n            const child_props:Record<string,string> = constructed ? (constr as any)[METADATA]?.[CHILD_PROPS]?.public : undefined;\n            bindContentProperties(this, id_props, content_props, layout_props, child_props);\n        }\n    }\n\n\n    #datex_lifecycle_ready_resolve?:Function\n    #datex_lifecycle_ready = new Promise((resolve)=>this.#datex_lifecycle_ready_resolve = resolve)\n\n    #create_lifecycle_ready_resolve?:Function\n    #create_lifecycle_ready = new Promise((resolve)=>this.#create_lifecycle_ready_resolve = resolve)\n\n    #anchor_lifecycle_ready_resolve?:Function\n    #anchor_lifecycle_ready = new Promise((resolve)=>this.#anchor_lifecycle_ready_resolve = resolve)\n\n    private static template?:jsxInputGenerator<HTMLElement,any,any,any>\n    private static style_templates?:Set<jsxInputGenerator<DynamicCSSStyleSheet|URL,any,any,any>>\n\n    /**\n     * Promise that resolves after onConstruct is finished\n     */\n    get constructed() {\n        return this.#datex_lifecycle_ready\n    }\n\n    /**\n     * Promise that resolves after onCreate is finished (resolves immediately after component was removed and re-anchored)\n     */\n    get created() {\n        return this.#create_lifecycle_ready\n    }\n\n    /**\n     * Promise that resolves when anchored to the DOM (can be used again after component was removed and re-anchored)\n     */\n    get anchored() {\n        return this.#anchor_lifecycle_ready\n    }\n\n    /**\n     * Only executed after component was added to DOM and onCreate was called\n     * @param handler function to execute\n     */\n    async defer(handler:(...args:unknown[])=>unknown):Promise<void> {\n        await this.anchored;\n        await handler(); \n    }\n\n    // default constructor\n    async construct(options?:Datex.DatexObjectInit<Props>): Promise<void> {\n        // options already handled in constructor\n\n        await sleep(0); // TODO: fix: makes sure constructor is finished?!, otherwise correct 'this' not yet available in Component.init\n \n        if (!((<typeof Component>this.constructor).prototype instanceof Component)) {\n            logger.warn(\"Cannot initialize standalone component as normal UIX component (<\"+this.tagName.toLowerCase()+\">)\")\n            return;\n        }\n\n\n        // make sure static component data (e.g. datex module imports) is loaded\n        await (<typeof Component>this.constructor).init();\n        this.inheritDatexProperties();\n\n        if (!this.reconstructed_from_dom) await this.loadTemplate();\n        else this.logger.debug(\"Reconstructed from DOM, not creating new template content\")\n        this.loadDefaultStyle()\n        await this.init(true);\n        await this.onConstructed?.();\n\n        this.#datex_lifecycle_ready_resolve?.(); // onCreate can be called (required because of async)\n    }\n\n    // called when created from saved state\n    async replicate() {\n        await sleep(0); // TODO: fix: makes sure constructor is finished?!, otherwise correct 'this' not yet available in child class init\n        // make sure static component data (e.g. datex module imports) is loaded\n        await (<typeof Component>this.constructor).init();\n        this.inheritDatexProperties();\n\n        this.loadDefaultStyle()\n        await this.init();\n        this.#datex_lifecycle_ready_resolve?.(); // onCreate can be called (required because of async)\n    }\n\n    /**\n     * load template (@UIX.template)\n     */\n    private async loadTemplate() {\n        if ((<typeof Component> this.constructor).template) {\n            const templateFn = (<typeof Component> this.constructor).template!;\n            const template = await templateFn(this.props, this);\n            domUtils.append(this, template);\n        }\n    }\n\n    /**\n     * load stylesheet from @style\n     */\n    private loadDefaultStyle() {\n        for (const templateFn of (<typeof Component> this.constructor).style_templates??[]) {\n            const stylesheet = templateFn(this.props, this)\n            const stylesheets = stylesheet instanceof Array ? stylesheet : [stylesheet];\n            for (const stylesheet of stylesheets) {\n                // invalid scoped stylesheet\n                if (stylesheet.scope && stylesheet.scope !== this.tagName.toLowerCase()) throw new Error(`Stylesheet uses multiple component scopes (<${stylesheet.scope.toLowerCase()}>, <${this.tagName.toLowerCase()}>). Make sure you don't use the same stylesheet for multiple components.`)\n                // inject css scoping if component has no shadow root\n                if (stylesheet instanceof CSSStyleSheet && !this.shadowRoot && !stylesheet.scope) {\n                    const css = stylesheet._cached_css ?? [...(stylesheet.cssRules as any)].map(r=>r.cssText).join(\"\\n\");\n                    const scopedCSS = addCSSScopeSelector(css, this.tagName.toLowerCase())\n                    stylesheet.replaceSync(scopedCSS)\n                    stylesheet.scope = this.tagName.toLowerCase();\n                }\n                if (stylesheet instanceof CSSStyleSheet && stylesheet.activate) {\n                    stylesheet.activate(this.shadowRoot??document);\n                    this.activatedScopedStyles.add(stylesheet)\n                }\n                else if (stylesheet instanceof CSSStyleSheet) this.addStyleSheet(stylesheet)\n                else this.addStyleSheet(stylesheet)\n            }\n        }\n    }\n\n    private initProps(props?: Props){\n        if (this.props) {\n            console.log(\"already has props\");\n            return;\n        }\n\n        // get options from html attributes\n        if (!props) props = <Props>{}; \n        for (let i=0; i < this.attributes.length; i++) {\n            const name = this.attributes[i].name;\n            // don't override provided options object\n            if (!(name in props)) {\n                // json (number, array, ...) - for attributes written in html (strings by default, must be converted to the right type)\n                try {\n                    props[<keyof typeof props>name] = JSON.parse(this.attributes[i].value);\n                } \n                // string\n                catch {\n                    props[<keyof typeof props>name] = <Datex.RefOrValue<Props>> this.attributes[i].value;\n                }\n            }\n        }\n\n        // assign default options as prototype\n        this.props = props;\n    }\n\n    /**\n     * bind datex properties from virtualDatexPrototype to this instance\n     */\n    private inheritDatexProperties() {\n        Object.assign(this, (<typeof Component>this.constructor).virtualDatexPrototype);\n    }\n\n\n    // init for base element (and every element)\n    protected async init(constructed = false) {\n        // handle shadow root setup\n        if (this.shadowRoot) this.initShadowRootStyle();\n\n        // Component style sheets\n        const loaders = []\n        for (const url of (<typeof Component>this.constructor).stylesheets??[]) loaders.push(this.addStyleSheet(url));\n    \n        let standaloneOnDisplayWasTriggered = false\n        if ((this as any)[DISPOSE_BOUND_PROTOTYPE]) {\n            standaloneOnDisplayWasTriggered = (this as any)[DISPOSE_BOUND_PROTOTYPE]();\n        }\n\n        this.onCreateLayout?.(); // custom layout extensions\n\n        // @id, @content, @layout\n        this.handleIdProps(constructed);\n   \n        // @standlone props only relevant for backend\n        if (UIX.context == \"backend\") await this.loadStandaloneProps();\n\n        Datex.Pointer.onPointerForValueCreated(this, () => {\n            const pointer = Datex.Pointer.getByValue(this)!\n            if (!this.hasAttribute(\"uix-ptr\") && client_type == \"deno\") this.setAttribute(\"uix-ptr\", pointer.id);\n\n            if (this.is_skeleton && UIX.context == \"frontend\") {\n                this.logger.debug(\"hybrid initialization\")\n                if (!standaloneOnDisplayWasTriggered) this.onDisplay?.();\n            }\n            // TODO: required? should probably not be called by default\n            // bindObserver(this)\n        })\n\n        if (constructed) await this.onConstruct?.();\n        // this.bindOriginMethods();\n\n        await this.onInit?.() // element was constructed, not fully loaded / added to DOM!\n        // this.enableDefaultOpenGraphGenerator();\n\n        //await Promise.all(loaders); // TODO: await stylesheet loading? leads to errors\n    }\n\n    // load standalone props recursively, including all parent classes\n    private async loadStandaloneProps() {\n        let clss = <any>this.constructor;\n        do {\n            await (<typeof Component>clss).loadStandaloneProps();\n        } while ((clss=Object.getPrototypeOf(Object.getPrototypeOf(clss))) && clss != domContext.HTMLElement && clss != domContext.Element && clss != Object); //  prototype chain, skip proxies inbetween\n    }\n\n    private enableDefaultOpenGraphGenerator() {\n        if (this[OPEN_GRAPH]) return; // already overridden\n        Object.defineProperty(this, OPEN_GRAPH, {\n            get() {return new OpenGraphInformation({\n                title: this.getAttribute(\"title\") ?? app.options?.name,\n                description: app.options?.description\n            }, this.openGraphImageGenerator)}\n        })\n    }\n\n    // clone self as DATEX value\n    public async clone(){\n        return await Datex.Runtime.deepCloneValue(this);\n    }\n\n    // used in render.ts\n    protected standaloneEnabled() {\n        return !! (\n            (<typeof Component>this.constructor).standaloneEnabled() ||\n            this.standalone_handlers.size\n        )\n    }\n\n\n    // add function for this instance that is immediately invoked in standalone mode\n    private standalone_handlers = new Set<Function>()\n    protected addStandaloneHandler(handler:Function) {\n        this.standalone_handlers.add(handler);\n    }\n\n    // get instance specific standalone js code that is immediately executed\n    public getStandaloneInit() {\n        let js_code = '';\n \n        js_code += `const self = querySelector(\"[uix-ptr='${this.getAttribute(\"uix-ptr\")}']\");\\n`\n        js_code += `bindPrototype(self, globalThis.UIX_Standalone.${this.constructor.name});\\n`\n\n        const scope = this.constructor as any;\n        const originProps:Record<string, propInit>|undefined = scope[METADATA]?.[ORIGIN_PROPS]?.public;\n\n        // init props with current values\n        for (const [name, data] of Object.entries((this.constructor as typeof Component).standaloneProperties)) {\n            // check if prop is method\n            if (typeof this[<keyof this>name] === \"function\") {\n                if (originProps?.[name] && !(this[<keyof this>name] as any)[BOUND_TO_ORIGIN]) {\n                    // @ts-ignore $\n                    this[<keyof this>name] = bindToOrigin(this[<keyof this>name], this, null, originProps[name].datex);\n                }\n                js_code += `self[\"${name}\"] = ${Component.getStandaloneMethodContentWithMappedImports(this[<keyof this>name] as Function)};\\n`;\n            }\n            \n            // init from origin context (via datex)\n            else if (data.init) {\n                js_code += `self[\"${name}\"] = ${getValueInitializer(this[<keyof this>name], data.init.datex)};\\n`\n            }\n            // normal property init\n            else if (data.type == \"prop\") {\n                js_code += `self[\"${name}\"] = ${serializeJSValue(this[<keyof this>name])};\\n`\n            }\n        }\n\n        // call custom standalone handlers\n        for (const handler of this.standalone_handlers) {\n            // workaround to always set 'this' context to UIX component, even when handler is an arrow function\n            js_code += `await (function (){return (${(<typeof Component>this.constructor).getStandaloneMethodContentWithMappedImports(handler)})()}).apply(self);\\n`;\n        }\n        \n        // standalone constructor + lifecycle\n        js_code += `self._standalone_construct();\\n`\n        js_code += `self.onDisplay?.();`\n        return js_code;\n    }\n\n\n    #focusable = false;\n\n    public get focusable(){\n        return this.#focusable;\n    }\n    public set focusable(focusable:boolean){\n        this.#focusable = focusable;\n        if (this.#focusable) this.setAttribute(\"tabindex\", \"-1\")\n        else this.removeAttribute(\"tabindex\")\n    }\n\n    // is element the current top parent (root) element\n    public get is_root_element(){\n        return this.parentElement == document.body || (this.parentElement instanceof Component && this.parentElement.isChildPseudoRootElement(this));\n    }\n    \n    #created = false; // set to true if onCreate has been called\n\n    // get parent element if type matches, else throw error\n    assertParent<P extends HTMLElement>(parent: Class<P>): P {\n        if (this.parentElement instanceof parent) return <P> this.parentElement;\n        else if (!parent) new ValueError(`Component should have a parent of type ${Datex.Type.getClassDatexType(parent)}, but has none`);\n        else throw new ValueError(`Component parent has type ${Datex.Type.ofValue(this.parentElement)}, but should be ${Datex.Type.getClassDatexType(parent)}`);\n        // workaround: only for ts - never reached\n        return <P><unknown>null;\n    }\n\n    // get any parent element (recursive), return first match\n    assertNextParent<P extends HTMLElement>(parent: Class<P>):P {\n        if (this.parentElement) {\n            try {\n                return this.assertParent(parent);\n            }\n            catch {\n                if (this.parentElement instanceof Component) return this.parentElement.assertNextParent(parent);\n                else throw \"\";\n            }\n        }\n        else throw new ValueError(`Now matching parent component of type ${Datex.Type.getClassDatexType(parent)} found`);\n    }\n\n\n    // component becomes full-featured uix component, no longer a skeleton\n    public unSkeletonize() {\n        if (!this.is_skeleton) return;\n\n        this.is_skeleton = false;\n        this.removeAttribute(\"uix-static\");\n        this.removeAttribute(\"uix-dry\");\n\n        // continue component lifecycle\n        const type = Datex.Type.ofValue(this);\n        type.initProperties(this, {options:$({})});\n        // trigger UIX lifecycle (onReplicate)\n        type.construct(this, undefined, false, true);\n\n        // await this.replicate();\n        //this.updateResponsive();\n\n        // if (this instanceof Group) {\n        //     for (let child of this.elements) {\n        //         child.connectedCallback();\n        //     }\n        // }\n       \n    }\n\n    /**\n     * Only executed after all components were fully constructed (DATEX initialized)\n     * @param handler function to execute\n     */\n    static async deferConstructed(components:Component[], handler:(...args:unknown[])=>unknown):Promise<void> {\n        await Promise.all(components.map(c => c.constructed))\n        await handler(); \n    }\n\n    disconnectedCallback() {\n\n        // reset anchor lifecycle\n        this.#anchor_lifecycle_ready = new Promise((resolve)=>this.#anchor_lifecycle_ready_resolve = resolve)\n        \n        // assume next route as new initial route\n        this.route_initialized = false;\n\n        // handle child on parent\n        if (this.parentElement instanceof Component) {\n            Component.deferConstructed([this, this.parentElement], ()=>{\n                (this.parentElement as Component).onChildRemoved(this)\n            })\n        }\n    \n        this.onDetach?.();\n    }\n\n    bindOriginMethods() {\n        const scope = this.constructor.prototype;\n        const originProps:Record<string, propInit> = scope[METADATA]?.[ORIGIN_PROPS]?.public;\n\n        for (const [name, content] of Object.entries((this.constructor as typeof Component).standaloneMethods)) {\n            console.log(\"bind to origin\", name, originProps?.[name])\n            if (originProps?.[name]) {\n                // @ts-ignore\n                this[name as keyof typeof scope] = bindToOrigin(scope[<keyof typeof scope>name], this, name, originProps[name].datex);\n                // @ts-ignore\n                console.log(this[name as keyof typeof scope]?.toString?.(), \"<--- name\")\n            }\n        }\n    }\n    \n    // called when added to DOM\n    connectedCallback() {\n        // hybrid rendered, ignore, onDisplay() is called somewhere else\n        if (this.is_skeleton) return;\n\n        // handle child on parent\n        if (this.parentElement instanceof Component) {\n            Component.deferConstructed([this, this.parentElement], ()=>{\n                if (this.parentElement instanceof Component) (this.parentElement as Component).onChildAdded(this)\n            })\n        }\n        \n        // call onAnchor, init with options dialog, etc.; async\n        return this.connectedCallbackAsync();\n    }\n\n    private async connectedCallbackAsync(){\n\n        await this.#datex_lifecycle_ready; // wait for onConstruct, init\n\n        const new_create = !this.#created;\n        this.#created = true;\n\n        // call onCreate\n        if (new_create) {\n            try {\n                await this.onCreate?.();\n            } catch (e) { logger.error(\"Error calling onCreate on element\"); console.error(e)}\n        }\n        else {\n            await this.created;\n        }\n\n        // call onAnchor\n        try {await this.onAnchor?.()}\n        catch (e) { logger.error(\"Error calling onAnchor on element: ?\", e)}\n        await new Promise((r) => setTimeout(r, 0)); // dom changes\n\n        await new Promise((r) => setTimeout(r, 0)); // dom changes\n        if (UIX.context == \"frontend\") await this.onDisplay?.();\n        await new Promise((r) => setTimeout(r, 0)); // dom changes\n\n        this.#create_lifecycle_ready_resolve?.();\n        this.#anchor_lifecycle_ready_resolve?.();\n    }\n\n    private route_initialized = false;\n\n    // implements resolveRoute by default, can be overriden for more custom routing behavior\n    public async resolveRoute(route:Path.Route, context:Context):Promise<Path.route_representation> {\n        const {Path} = await import(\"uix/utils/path.ts\");\n\n        const delegate = this.routeDelegate??this;\n\n        if (!route?.route) return []; // TODO: should not happen?\n\n        // ignore if route is already up to date\n        if (this.route_initialized && Path.routesAreEqual(route, delegate.getInternalRoute())) return route;\n        const initial_route = !this.route_initialized;\n        this.route_initialized = true;\n\n        const child = await (<Component<Props, ChildElement>>delegate).onRoute?.(route.route[0]??\"\", initial_route);\n\n        if (child == false) return []; // route not valid\n        else if (typeof (<any>child)?.focus == \"function\") {\n            (<any>child).focus() // bring child to foreground\n        }\n        // end of route reached / handled in component without redirecting to children, all ok\n        if (route.route.length == 1 || !(child instanceof Element) || (typeof child?.resolveRoute !== \"function\")) return route; \n        // recursively follow route\n        else {\n            const child_route = await child.resolveRoute(Path.Route(route.route.slice(1)), context);\n            return [route.route[0], ...(child_route instanceof Path ? child_route.route : child_route)];\n        }\n    }\n\n\n    #logger?:Logger\n    protected get logger(): Logger {\n        this.#logger ??= new Logger(this);\n        return this.#logger;\n    }\n\n    #scroll_context?:scrollContext\n    \n    protected makeScrollContainer(element:HTMLElement, scroll_x = true, scroll_y = true) {\n        // TODO: save scroll state\n        this.#scroll_context = {};\n        return makeScrollContainer(element, scroll_x, scroll_y, this.#scroll_context);\n    }\n\n    /** handle the scroll position updates **/\n\n    public updateScrollPosition(x?:number, y?:number) {\n        if (!this.#scroll_context) return;\n        return updateScrollPosition(this.#scroll_context, x, y);\n    }\n\n    public scrollToBottom(force_scroll = false){\n        if (!this.#scroll_context) return;\n        return scrollToBottom(this.#scroll_context, force_scroll);\n    }\n\n    public scrollToTop(){\n        if (!this.#scroll_context) return;\n        return scrollToTop(this.#scroll_context);\n    }\n\n    override remove() {\n        logger.debug(\"remove element ?\", this.id || this.constructor.name);\n        super.remove();\n    }\n\n    protected style_sheets_urls:string[] = [];\n\n    /**\n     * add a custom stylesheet as a <link> or adopted stylesheet to this component\n     * @param url_or_style_sheet url to css file, css text or CSSStyleSheet\n     * @param adopt if true, the style is added to the shadow root adoptedStyleSheets, otherwise (if an url is provided), the style is added as a <link>\n     */\n    public addStyleSheet(url:string|URL, adopt?:boolean):Promise<void>|void\n    public addStyleSheet(style_sheet:CSSStyleSheet):Promise<void>|void\n    public addStyleSheet(url_or_style_sheet:string|CSSStyleSheet|URL, adopt = true):Promise<void>|void {\n\n        if (typeof url_or_style_sheet == \"string\" || url_or_style_sheet instanceof URL) {\n            let url = new URL(url_or_style_sheet, (<typeof Component>this.constructor)._module);\n            if (this.style_sheets_urls.includes(url.toString())) return; // stylesheet already added\n\n            // allow fail if only potential module stylesheet\n            const allow_fail = (<typeof Component>this.constructor).module_stylesheets.includes(url.toString());    \n\n            // scope url\n            if (!this.shadowRoot) {\n                url = new URL(url + '?scope=' + this.tagName.toLowerCase()); // add scope query parameter\n            }\n\n            // adopt CSSStylesheet (works if css does not use @import and shadowRoot exists, otherwise use <link>)\n            if (adopt && this.shadowRoot) {\n                const stylesheet = Component.getURLStyleSheet(url, allow_fail);\n\n                // is sync\n                if (stylesheet instanceof <typeof CSSStyleSheet>globalThis.CSSStyleSheet) {\n                    this.adoptStyle(stylesheet, false, url);\n                }\n                else if (stylesheet) return new Promise<void>(async resolve=>{\n                    const s = await stylesheet;\n                    if (s) this.adoptStyle(s, false, url);\n                    resolve();\n                })\n                // stylesheet might be false, no stylesheet, ignore (error is logged)\n            }\n            // insert <link>\n            else return (async ()=>{\n                try {\n                    await this.insertStyleSheetLink(url, allow_fail);\n                } catch (e) {\n                    //console.debug(e);\n                    if (!allow_fail) throw e;\n                }\n            })()\n        }\n\n        else if (url_or_style_sheet instanceof <typeof CSSStyleSheet>globalThis.CSSStyleSheet){\n            this.adoptStyle(url_or_style_sheet)\n        }\n    }\n\n    protected async insertStyleSheetLink(url:URL, allow_fail = false) {\n        if (allow_fail && !await fileExists(url)) return; // style sheet file does not exist\n        if (this.shadowRoot) await addStyleSheetLink(this.shadowRoot, url);\n        else if (client_type == \"browser\") await addGlobalStyleSheetLink(url);\n        this.style_sheets_urls.push(url.toString());\n    }\n\n    /** shadow dom specific methods */\n    /**\n     * add a default adopted CSSStyleSheet which is referenced by this.shadowStyle\n     */\n    private addBaseStyle(){\n        this.adoptStyle(\":host:host {}\", true); // use ':host:host' for higher specificity (should behave like inline style)\n    }\n\n    // returns style of this element, if shadowRoot not yet attached to a document (styleSheets not available, see https://github.com/WICG/webcomponents/issues/526)\n    public get shadowStyle(): CSSStyleDeclaration {\n        if (!this.#style_sheets.length) this.addBaseStyle();\n        // init this.#adopted_root_style after style was adopted\n        if (!this.#adopted_root_style && (<CSSStyleRule>this.#style_sheets[0]?.cssRules?.[0])?.style) {\n            const stylesheet = this.#style_sheets[0];\n\n            // is using polyfill which does not correctly propagate updates -> propagate updates via proxy\n            // @ts-ignore CSSStyleSheet\n\n            // safari compat\n            if (globalThis.CSSStyleSheet.name == \"ConstructedStyleSheet\") {\n                this.#adopted_root_style = new Proxy((<CSSStyleRule>stylesheet.cssRules[0]).style, {\n                    set(target, p, value) {\n                        (<any>target)[p] = value;\n                        // refresh style\n                        stylesheet.replaceSync(`:host:host {${target.cssText}}`); // stylesheet.cssRules[0].cssText not working?\n                        return true;\n                    },\n                    // for correct binding of getProperty/setProperty\n                    get: (target, prop) => {\n                        if (prop in target && (<string>prop)[0] !== '_') {\n                            if (typeof (<any>target)[prop] === 'function') {\n                                return (<any>target)[prop].bind(target);\n                            } else {\n                                return (<any>target)[prop];\n                            }\n                        } else {\n                            throw new Error('problem');\n                        }\n                    }\n                })\n            }\n\n            // deno server compat, just use normal CSSStyleDeclaration\n            // @ts-ignore\n            else if (globalThis.CSSStyleSheet.IS_COMPAT) {\n                this.#adopted_root_style = new CSSStyleDeclaration();\n            }\n\n            // normal\n            else this.#adopted_root_style = (<CSSStyleRule>stylesheet.cssRules[0]).style;\n        }\n\n        // return adopted_root_style or pseudo style placeholder\n        return this.#adopted_root_style ?? <CSSStyleDeclaration>this.#pseudo_style;\n    }\n\n    // adopted constructed stylesheet for shadow root\n    #adopted_root_style?:CSSStyleDeclaration \n\n    /**\n     * Add a style to the shadow root adoptedStyleSheets\n     * @param style style text or CSSStyleSheet\n     */\n    protected adoptStyle(style:string|CSSStyleSheet, __pass_through = false, url?: URL) {\n        if (!this.shadowRoot) throw new Error(\"Cannot adopt style on Component - no shadow root\");\n\n        // first add base style (this.style)\n        if (!__pass_through && !this.#style_sheets.length) this.addBaseStyle();\n        \n        let stylesheet:CSSStyleSheet;\n\n        // add to component style sheets list\n        if (url) this.style_sheets_urls.push(url.toString());\n\n        if (style instanceof globalThis.CSSStyleSheet) stylesheet = style;\n        else {\n            stylesheet = new globalThis.CSSStyleSheet();\n            stylesheet.replaceSync(style);\n        }\n        this.#style_sheets.push(stylesheet);\n        this.shadowRoot.adoptedStyleSheets = [...this.#style_sheets]; // this.#style_sheets\n\n        return stylesheet;\n    }\n\n\n    // list of all adopted stylesheets for this element / shadow DOM\n    #style_sheets:CSSStyleSheet[] = [];\n    #pseudo_style = PlaceholderCSSStyleDeclaration.create();\n\n    // contains all styles used for this component that are scoped and adopted on the document\n    activatedScopedStyles = new Set<DynamicCSSStyleSheet>()\n\n    // return rendered HTML for stylesheets used in this component\n    public getRenderedStyle() {\n        let html = \"\";\n\n        // links\n\t\tfor (let url of this.style_sheets_urls) {\n            if (url.toString().startsWith(\"file://\")) {\n                // relative web path (@...)\n                url = convertToWebPath(url);\n            }\n            html += `<link rel=\"stylesheet\" href=\"${url}\">`;\n        }\n\n        // noscript fallback style\n        html += `<noscript><link rel=\"stylesheet\" href=\"https://dev.cdn.unyt.org/uix/style/noscript.css\"></noscript>`\n   \n        if (this.#adopted_root_style) {\n            html += `<style>${this.#adopted_root_style.cssText}</style>`\n        }\n        else if (this.#pseudo_style) {\n            html += `<style>:host:host{${this.#pseudo_style.cssText}}</style>`\n        }\n\n        // add theme classes\n        html += `<style>${UIX.Theme.getThemesCSS().replaceAll(\"\\n\",\"\")}</style>`\n\n        return html;\n    }\n    \n    /** end - shadow dom specific methods */\n\n\n    // @implement child is on top edge of parent, let header behave as if child was actual root element\n    protected isChildPseudoRootElement(child: ChildElement){\n        return false;\n    }\n\n    protected routeDelegate?: Component; // delegate that handles all routes for this component\n    /** called to get the current route of the component (child route) */\n    getInternalRoute():string[] {\n        const identifier = this.getRouteIdentifier();\n        if (typeof identifier == \"string\") return [identifier]\n        else return [];\n    }\n\n    protected getRouteIdentifier():string|undefined|void {}\n\n    /** called when a route is requested from the component, return element matching the route identifier or true if route was handled */\n    protected onRoute?(identifier:string, is_initial_route:boolean):Promise<void|Component|boolean>|void|Component|boolean\n\n    /** \n     * called when a new child is appended - currently only working for child components\n     * @deprecated\n     */\n    protected onChildAdded(child:ChildElement){}\n\n    /** \n     * called when a child is removed - currently only working for child components\n     * @deprecated\n     */\n    protected onChildRemoved(child:ChildElement){}\n\n    /** called when a child is focused */\n    protected onChildFocused(child:ChildElement){}\n    \n    /** called after added to an other Element */\n    protected onAnchor?():void|Promise<void>\n\n    /** timeout (ms) after which onCreate is no longer awaited, snapshot is taken */\n    CREATE_TIMEOUT = 10_000;\n\n    /** called after options loaded, element content can be created */\n    protected onCreate?():void|Promise<void>\n\n    /** called when anchored in a frontend environment (supports @standalone) */\n    protected onDisplay?():void|Promise<void>\n\n    /** called after removed from DOM (not moved) */\n    protected onDetach?():void\n\n    /** called after constructor */\n    protected onConstruct?():Promise<void>|void\n\n    /** called after constructor and after init */\n    protected onConstructed?():Promise<void>|void\n\n    /** called after constructor or replicator (before onConstructed, after onConstruct) */\n    protected onInit?():Promise<void>|void\n\n    /** generate custom element base layout (content_element, style) */\n    protected onCreateLayout?():void\n\n}\n\n// construct pseudo @sync class\nconst type = Datex.Type.get(\"uixcomponent\")\nComponent[DX_TYPE] = type;\nComponent[DX_ROOT] = true\n\n// get object-like keys that need to be cloned from the prototype\nexport function getCloneKeys(object:any):Set<string> {\n    const clone_keys = new Set<string>();\n    for (const [key, value] of Object.entries(object)) {\n        if (value && typeof value == \"object\") clone_keys.add(key);\n    }\n    return clone_keys;\n}"],"names":["Datex","get","logger","Logger","METADATA","ValueError","CHILD_PROPS","CONTENT_PROPS","ID_PROPS","IMPORT_PROPS","LAYOUT_PROPS","ORIGIN_PROPS","STANDALONE_PROPS","Path","makeScrollContainer","scrollToBottom","scrollToTop","updateScrollPosition","OpenGraphInformation","OPEN_GRAPH","bindContentProperties","DX_IGNORE","DX_TYPE","DX_ROOT","INIT_PROPS","PlaceholderCSSStyleDeclaration","addGlobalStyleSheetLink","addStyleSheetLink","indent","serializeJSValue","BOUND_TO_ORIGIN","bindToOrigin","getValueInitializer","addCSSScopeSelector","domContext","domUtils","UIX","convertToWebPath","client_type","app","fileExists","DISPOSE_BOUND_PROTOTYPE","getDeclaredExternalVariables","getDeclaredExternalVariablesAsync","JSTransferableFunction","template","style","Component","HTMLElement","stylesheets","shadow_stylesheets","URL","url","toString","CLONE_OPTION_KEYS","_dx_files","_module","_use_resources","findModuleBoundDatexScripts","dx_url","replace","unshift","_dx_loaded_resolve","_dx_loaded_promise","loadModuleDatexImports","Object","hasOwn","Promise","resolve","valid_dx_files","dx_file_values","Map","path","startsWith","fs_exists","loadDatexModuleContents","e","virtualDatexPrototype","create","loadDatexImports","push","set","undefined","Set","debug","Error","stack","target","prop","location","exprt","entries","allowed_imports","public","found","length","name","file_data","values","file_val","add","DatexObject","has","join","err","res","standalone_loaded","standalone_class_code","loadStandaloneProps","standaloneMethods","standaloneProperties","props","originProps","idProps","layoutProps","contentProps","childProps","keys","desc","getOwnPropertyDescriptor","prototype","addStandaloneProperty","addStandaloneMethod","type","Type","getClassDatexType","getOwnPropertyNames","method","useDeclaration","functionIsAsync","flags","includes","vars","$","js","TransferableFunction","setTemplate","inferredStandaloneMethods","value","isStandaloneProperty","init","id","getStandalonePseudoClass","parent","getParentClass","js_code","_name","content","getStandaloneConstructor","getStandaloneMethodContentWithMappedImports","deps","getPrototypeOf","m","g1","g2","g3","g4","absImport","standaloneEnabled","propInit","generatePropertySelectorCode","has_content_prop","data","JSON","stringify","getSelectorCode","propData","self","call","module_stylesheets","style_sheets_by_url","style_sheets_loaders","getURLStyleSheet","allow_fail","url_string","loader","loadURLStyleSheet","delete","error","fetch","ok","stylesheet","globalThis","CSSStyleSheet","text","preloadStylesheets","addPotentialModuleStylesheet","loaders","all","css_url","options","properties","standalone","openGraphImageGenerator","is_skeleton","reconstructed_from_dom","constructor","initProps","isConstructing","classType","console","log","hasAttribute","construct","Proxy","String","attachShadow","shadowRoot","initShadowRootStyle","disableShadowForDATEX","addStyleSheet","css","properties_object_or_property","setCSS","cssClass","classes","setCssClass","handleIdProps","constructed","constructorList","_constructor","at","Element","constr","toReversed","id_props","style_templates","created","anchored","defer","handler","sleep","warn","tagName","toLowerCase","inheritDatexProperties","loadTemplate","loadDefaultStyle","onConstructed","replicate","templateFn","append","Array","scope","scopedCSS","_cached_css","cssRules","map","r","cssText","replaceSync","activate","document","activatedScopedStyles","i","attributes","parse","assign","standaloneOnDisplayWasTriggered","onCreateLayout","context","Pointer","onPointerForValueCreated","pointer","getByValue","setAttribute","onDisplay","onConstruct","onInit","clss","enableDefaultOpenGraphGenerator","defineProperty","title","getAttribute","description","clone","Runtime","deepCloneValue","standalone_handlers","size","addStandaloneHandler","getStandaloneInit","datex","focusable","removeAttribute","is_root_element","parentElement","body","isChildPseudoRootElement","assertParent","ofValue","assertNextParent","unSkeletonize","initProperties","deferConstructed","components","c","disconnectedCallback","route_initialized","onChildRemoved","onDetach","bindOriginMethods","connectedCallback","onChildAdded","connectedCallbackAsync","new_create","onCreate","onAnchor","setTimeout","resolveRoute","route","delegate","routeDelegate","routesAreEqual","getInternalRoute","initial_route","child","onRoute","focus","child_route","Route","slice","element","scroll_x","scroll_y","x","y","force_scroll","remove","style_sheets_urls","url_or_style_sheet","adopt","insertStyleSheetLink","adoptStyle","s","addBaseStyle","shadowStyle","p","bind","IS_COMPAT","CSSStyleDeclaration","__pass_through","adoptedStyleSheets","getRenderedStyle","html","Theme","getThemesCSS","replaceAll","identifier","getRouteIdentifier","onChildFocused","CREATE_TIMEOUT","getCloneKeys","object","clone_keys","key"],"mappings":"AACA,SAASA,KAAK,EAAYC,GAAG,QAAO,oBAAmB;AACvD,SAASC,MAAM,QAAQ,4BAA2B;AAClD,SAAgBC,MAAM,EAAEC,QAAQ,EAAEC,UAAU,QAAQ,iCAAgC;AACpF,SAASC,WAAW,EAAEC,aAAa,EAAEC,QAAQ,EAAEC,YAAY,EAAEC,YAAY,EAAEC,YAAY,EAAEC,gBAAgB,QAAQ,wBAAwB;AACzI,SAASC,IAAI,QAAQ,kCAAkC;AAGvD,SAASC,mBAAmB,EAAiBC,cAAc,EAAEC,WAAW,EAAEC,oBAAoB,QAAQ,oCAAoC;AAC1I,SAASC,oBAAoB,EAAkCC,UAAU,QAAQ,wBAAwB;AACzG,SAASC,qBAAqB,QAAQ,4CAA4C;AAClF,SAASC,SAAS,EAAEC,OAAO,EAAEC,OAAO,EAAEC,UAAU,QAAQ,yCAAwC;AAChG,SAASC,8BAA8B,EAAEC,uBAAuB,EAAEC,iBAAiB,QAAQ,+BAA+B;AAC1H,SAASC,MAAM,QAAQ,oCAAmC;AAC1D,SAASC,gBAAgB,QAAQ,2BAA2B;AAC5D,SAASC,eAAe,EAAEC,YAAY,EAAEC,mBAAmB,QAAQ,4BAA2B;AAE9F,SAASC,mBAAmB,QAAQ,0BAAyB;AAE7D,SAASC,UAAU,EAAEC,QAAQ,QAAQ,wBAAwB;AAC7D,SAASC,GAAG,QAAQ,eAAe;AACnC,SAASC,gBAAgB,QAAQ,gCAAgC;AACjE,SAASC,WAAW,QAAQ,uCAAuC;AACnE,SAASC,GAAG,QAAQ,gBAAgB;AACpC,SAASC,UAAU,QAAQ,oBAAoB;AAC/C,SAASC,uBAAuB,QAAQ,4CAA4C;AACpF,SAASC,4BAA4B,EAA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