/* @ts-self-types="./server_debug.d.ts" */

export class MainThreadServerContext {
    __destroy_into_raw() {
        const ptr = this.__wbg_ptr;
        this.__wbg_ptr = 0;
        MainThreadServerContextFinalization.unregister(this);
        return ptr;
    }
    free() {
        const ptr = this.__destroy_into_raw();
        wasm.__wbg_mainthreadservercontext_free(ptr, 0);
    }
    /**
     * @param {number} element_id
     * @param {string} class_name
     */
    add_class(element_id, class_name) {
        const ptr0 = passStringToWasm0(class_name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
        const len0 = WASM_VECTOR_LEN;
        const ret = wasm.mainthreadservercontext_add_class(this.__wbg_ptr, element_id, ptr0, len0);
        if (ret[1]) {
            throw takeFromExternrefTable0(ret[0]);
        }
    }
    /**
     * @param {number} element_id
     * @param {string} key
     * @param {string | null} [value]
     */
    add_inline_style_raw_string_key(element_id, key, value) {
        const ptr0 = passStringToWasm0(key, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
        const len0 = WASM_VECTOR_LEN;
        var ptr1 = isLikeNone(value) ? 0 : passStringToWasm0(value, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
        var len1 = WASM_VECTOR_LEN;
        wasm.mainthreadservercontext_add_inline_style_raw_string_key(this.__wbg_ptr, element_id, ptr0, len0, ptr1, len1);
    }
    /**
     * @param {number} parent_id
     * @param {number} child_id
     */
    append_child(parent_id, child_id) {
        wasm.mainthreadservercontext_append_child(this.__wbg_ptr, parent_id, child_id);
    }
    /**
     * @param {string} tag_name
     * @param {number | null} [parent_component_unique_id]
     * @param {number | null} [css_id_opt]
     * @param {string | null} [component_id]
     * @returns {number}
     */
    create_element(tag_name, parent_component_unique_id, css_id_opt, component_id) {
        const ptr0 = passStringToWasm0(tag_name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
        const len0 = WASM_VECTOR_LEN;
        var ptr1 = isLikeNone(component_id) ? 0 : passStringToWasm0(component_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
        var len1 = WASM_VECTOR_LEN;
        const ret = wasm.mainthreadservercontext_create_element(this.__wbg_ptr, ptr0, len0, isLikeNone(parent_component_unique_id) ? 0x100000001 : (parent_component_unique_id) >>> 0, isLikeNone(css_id_opt) ? 0x100000001 : (css_id_opt) >> 0, ptr1, len1);
        return ret >>> 0;
    }
    /**
     * @param {number} element_id
     * @returns {string}
     */
    generate_html(element_id) {
        let deferred1_0;
        let deferred1_1;
        try {
            const ret = wasm.mainthreadservercontext_generate_html(this.__wbg_ptr, element_id);
            deferred1_0 = ret[0];
            deferred1_1 = ret[1];
            return getStringFromWasm0(ret[0], ret[1]);
        } finally {
            wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
        }
    }
    /**
     * @param {number} element_id
     * @param {string} key
     * @returns {string | undefined}
     */
    get_attribute(element_id, key) {
        const ptr0 = passStringToWasm0(key, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
        const len0 = WASM_VECTOR_LEN;
        const ret = wasm.mainthreadservercontext_get_attribute(this.__wbg_ptr, element_id, ptr0, len0);
        let v2;
        if (ret[0] !== 0) {
            v2 = getStringFromWasm0(ret[0], ret[1]).slice();
            wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
        }
        return v2;
    }
    /**
     * @param {number} element_id
     * @returns {object}
     */
    get_attributes(element_id) {
        const ret = wasm.mainthreadservercontext_get_attributes(this.__wbg_ptr, element_id);
        if (ret[2]) {
            throw takeFromExternrefTable0(ret[1]);
        }
        return takeFromExternrefTable0(ret[0]);
    }
    /**
     * @returns {string}
     */
    get_page_css() {
        let deferred1_0;
        let deferred1_1;
        try {
            const ret = wasm.mainthreadservercontext_get_page_css(this.__wbg_ptr);
            deferred1_0 = ret[0];
            deferred1_1 = ret[1];
            return getStringFromWasm0(ret[0], ret[1]);
        } finally {
            wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
        }
    }
    /**
     * @param {number} child_id
     * @returns {number | undefined}
     */
    get_parent(child_id) {
        const ret = wasm.mainthreadservercontext_get_parent(this.__wbg_ptr, child_id);
        return ret === 0x100000001 ? undefined : ret;
    }
    /**
     * @param {number} element_id
     * @returns {string | undefined}
     */
    get_tag(element_id) {
        const ret = wasm.mainthreadservercontext_get_tag(this.__wbg_ptr, element_id);
        let v1;
        if (ret[0] !== 0) {
            v1 = getStringFromWasm0(ret[0], ret[1]).slice();
            wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
        }
        return v1;
    }
    /**
     * @param {number} parent_id
     * @param {number} child_id
     * @param {number | null} [ref_id]
     */
    insert_before(parent_id, child_id, ref_id) {
        wasm.mainthreadservercontext_insert_before(this.__wbg_ptr, parent_id, child_id, isLikeNone(ref_id) ? 0x100000001 : (ref_id) >>> 0);
    }
    /**
     * @param {string} view_attributes
     * @param {boolean} enable_css_selector
     * @param {boolean} transform_vw
     * @param {boolean} transform_vh
     * @param {boolean} transform_rem
     */
    constructor(view_attributes, enable_css_selector, transform_vw, transform_vh, transform_rem) {
        const ptr0 = passStringToWasm0(view_attributes, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
        const len0 = WASM_VECTOR_LEN;
        const ret = wasm.mainthreadservercontext_new(ptr0, len0, enable_css_selector, transform_vw, transform_vh, transform_rem);
        this.__wbg_ptr = ret >>> 0;
        MainThreadServerContextFinalization.register(this, this.__wbg_ptr, this);
        return this;
    }
    /**
     * @param {StyleSheetResource} resource
     * @param {string | null} [entry_name]
     */
    push_style_sheet(resource, entry_name) {
        _assertClass(resource, StyleSheetResource);
        var ptr0 = isLikeNone(entry_name) ? 0 : passStringToWasm0(entry_name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
        var len0 = WASM_VECTOR_LEN;
        const ret = wasm.mainthreadservercontext_push_style_sheet(this.__wbg_ptr, resource.__wbg_ptr, ptr0, len0);
        if (ret[1]) {
            throw takeFromExternrefTable0(ret[0]);
        }
    }
    /**
     * @param {number} element_id
     * @param {string} key
     */
    remove_attribute(element_id, key) {
        const ptr0 = passStringToWasm0(key, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
        const len0 = WASM_VECTOR_LEN;
        wasm.mainthreadservercontext_remove_attribute(this.__wbg_ptr, element_id, ptr0, len0);
    }
    /**
     * @param {number} parent_id
     * @param {number} child_id
     */
    remove_child(parent_id, child_id) {
        wasm.mainthreadservercontext_remove_child(this.__wbg_ptr, parent_id, child_id);
    }
    /**
     * @param {number} new_child_id
     * @param {number} old_child_id
     */
    replace_element(new_child_id, old_child_id) {
        wasm.mainthreadservercontext_replace_element(this.__wbg_ptr, new_child_id, old_child_id);
    }
    /**
     * @param {number} parent_id
     * @param {Uint32Array} new_children_ids
     * @param {Uint32Array} old_children_ids
     */
    replace_elements(parent_id, new_children_ids, old_children_ids) {
        const ptr0 = passArray32ToWasm0(new_children_ids, wasm.__wbindgen_malloc);
        const len0 = WASM_VECTOR_LEN;
        const ptr1 = passArray32ToWasm0(old_children_ids, wasm.__wbindgen_malloc);
        const len1 = WASM_VECTOR_LEN;
        wasm.mainthreadservercontext_replace_elements(this.__wbg_ptr, parent_id, ptr0, len0, ptr1, len1);
    }
    /**
     * @param {number} element_id
     * @param {string} key
     * @param {string} value
     */
    set_attribute(element_id, key, value) {
        const ptr0 = passStringToWasm0(key, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
        const len0 = WASM_VECTOR_LEN;
        const ptr1 = passStringToWasm0(value, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
        const len1 = WASM_VECTOR_LEN;
        wasm.mainthreadservercontext_set_attribute(this.__wbg_ptr, element_id, ptr0, len0, ptr1, len1);
    }
    /**
     * @param {Uint32Array} elements_unique_id
     * @param {number} css_id
     * @param {string | null} [entry_name]
     */
    set_css_id(elements_unique_id, css_id, entry_name) {
        const ptr0 = passArray32ToWasm0(elements_unique_id, wasm.__wbindgen_malloc);
        const len0 = WASM_VECTOR_LEN;
        var ptr1 = isLikeNone(entry_name) ? 0 : passStringToWasm0(entry_name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
        var len1 = WASM_VECTOR_LEN;
        const ret = wasm.mainthreadservercontext_set_css_id(this.__wbg_ptr, ptr0, len0, css_id, ptr1, len1);
        if (ret[1]) {
            throw takeFromExternrefTable0(ret[0]);
        }
    }
    /**
     * @param {number} element_id
     * @param {string[]} k_v_vec
     */
    set_inline_styles_in_key_value_vec(element_id, k_v_vec) {
        const ptr0 = passArrayJsValueToWasm0(k_v_vec, wasm.__wbindgen_malloc);
        const len0 = WASM_VECTOR_LEN;
        wasm.mainthreadservercontext_set_inline_styles_in_key_value_vec(this.__wbg_ptr, element_id, ptr0, len0);
    }
    /**
     * @param {number} element_id
     * @param {string} styles
     * @returns {boolean}
     */
    set_inline_styles_in_str(element_id, styles) {
        const ptr0 = passStringToWasm0(styles, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
        const len0 = WASM_VECTOR_LEN;
        const ret = wasm.mainthreadservercontext_set_inline_styles_in_str(this.__wbg_ptr, element_id, ptr0, len0);
        return ret !== 0;
    }
    /**
     * @param {number} element_id
     * @param {number} key
     * @param {string | null} [value]
     */
    set_inline_styles_number_key(element_id, key, value) {
        var ptr0 = isLikeNone(value) ? 0 : passStringToWasm0(value, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
        var len0 = WASM_VECTOR_LEN;
        wasm.mainthreadservercontext_set_inline_styles_number_key(this.__wbg_ptr, element_id, key, ptr0, len0);
    }
    /**
     * @param {number} unique_id
     * @param {string | null} [entry_name]
     */
    update_css_og_style(unique_id, entry_name) {
        var ptr0 = isLikeNone(entry_name) ? 0 : passStringToWasm0(entry_name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
        var len0 = WASM_VECTOR_LEN;
        const ret = wasm.mainthreadservercontext_update_css_og_style(this.__wbg_ptr, unique_id, ptr0, len0);
        if (ret[1]) {
            throw takeFromExternrefTable0(ret[0]);
        }
    }
}
if (Symbol.dispose) MainThreadServerContext.prototype[Symbol.dispose] = MainThreadServerContext.prototype.free;

export class RawStyleInfo {
    __destroy_into_raw() {
        const ptr = this.__wbg_ptr;
        this.__wbg_ptr = 0;
        RawStyleInfoFinalization.unregister(this);
        return ptr;
    }
    free() {
        const ptr = this.__destroy_into_raw();
        wasm.__wbg_rawstyleinfo_free(ptr, 0);
    }
    /**
     *
     *   * Appends an import to the stylesheet identified by `css_id`.
     *   * If the stylesheet does not exist, it is created.
     *   * @param css_id - The ID of the CSS file.
     *   * @param import_css_id - The ID of the imported CSS file.
     *
     * @param {number} css_id
     * @param {number} import_css_id
     */
    append_import(css_id, import_css_id) {
        wasm.rawstyleinfo_append_import(this.__wbg_ptr, css_id, import_css_id);
    }
    constructor() {
        const ret = wasm.rawstyleinfo_new();
        this.__wbg_ptr = ret >>> 0;
        RawStyleInfoFinalization.register(this, this.__wbg_ptr, this);
        return this;
    }
    /**
     *
     *   * Pushes a rule to the stylesheet identified by `css_id`.
     *   * If the stylesheet does not exist, it is created.
     *   * @param css_id - The ID of the CSS file.
     *   * @param rule - The rule to append.
     *
     * @param {number} css_id
     * @param {Rule} rule
     */
    push_rule(css_id, rule) {
        _assertClass(rule, Rule);
        var ptr0 = rule.__destroy_into_raw();
        wasm.rawstyleinfo_push_rule(this.__wbg_ptr, css_id, ptr0);
    }
}
if (Symbol.dispose) RawStyleInfo.prototype[Symbol.dispose] = RawStyleInfo.prototype.free;

export class Rule {
    __destroy_into_raw() {
        const ptr = this.__wbg_ptr;
        this.__wbg_ptr = 0;
        RuleFinalization.unregister(this);
        return ptr;
    }
    free() {
        const ptr = this.__destroy_into_raw();
        wasm.__wbg_rule_free(ptr, 0);
    }
    /**
     *
     *   * Creates a new Rule with the specified type.
     *   * @param rule_type - The type of the rule (e.g., "StyleRule", "FontFaceRule", "KeyframesRule").
     *
     * @param {string} rule_type
     */
    constructor(rule_type) {
        const ptr0 = passStringToWasm0(rule_type, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
        const len0 = WASM_VECTOR_LEN;
        const ret = wasm.rule_new(ptr0, len0);
        if (ret[2]) {
            throw takeFromExternrefTable0(ret[1]);
        }
        this.__wbg_ptr = ret[0] >>> 0;
        RuleFinalization.register(this, this.__wbg_ptr, this);
        return this;
    }
    /**
     *
     *   * Pushes a declaration to the rule's declaration block.
     *   * LynxJS doesn't support !important
     *   * @param property_name - The property name.
     *   * @param value - The property value.
     *
     * @param {string} property_name
     * @param {string} value
     */
    push_declaration(property_name, value) {
        const ptr0 = passStringToWasm0(property_name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
        const len0 = WASM_VECTOR_LEN;
        const ptr1 = passStringToWasm0(value, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
        const len1 = WASM_VECTOR_LEN;
        wasm.rule_push_declaration(this.__wbg_ptr, ptr0, len0, ptr1, len1);
    }
    /**
     *
     *   * Pushes a nested rule to the rule.
     *   * @param rule - The nested rule to add.
     *
     * @param {Rule} rule
     */
    push_rule_children(rule) {
        _assertClass(rule, Rule);
        var ptr0 = rule.__destroy_into_raw();
        wasm.rule_push_rule_children(this.__wbg_ptr, ptr0);
    }
    /**
     *
     *   * Sets the prelude for the rule.
     *   * @param prelude - The prelude to set (SelectorList or KeyFramesPrelude).
     *
     * @param {RulePrelude} prelude
     */
    set_prelude(prelude) {
        _assertClass(prelude, RulePrelude);
        var ptr0 = prelude.__destroy_into_raw();
        wasm.rule_set_prelude(this.__wbg_ptr, ptr0);
    }
}
if (Symbol.dispose) Rule.prototype[Symbol.dispose] = Rule.prototype.free;

/**
 *
 * * Either SelectorList or KeyFramesPrelude
 * * Depending on the RuleType
 * * If it is SelectorList, then selectors is a list of Selector
 * * If it is KeyFramesPrelude, then selectors has only one selector which is Prelude text, its simple_selectors is empty
 * * If the parent is FontFace, then selectors is empty
 *
 */
export class RulePrelude {
    __destroy_into_raw() {
        const ptr = this.__wbg_ptr;
        this.__wbg_ptr = 0;
        RulePreludeFinalization.unregister(this);
        return ptr;
    }
    free() {
        const ptr = this.__destroy_into_raw();
        wasm.__wbg_ruleprelude_free(ptr, 0);
    }
    constructor() {
        const ret = wasm.ruleprelude_new();
        this.__wbg_ptr = ret >>> 0;
        RulePreludeFinalization.register(this, this.__wbg_ptr, this);
        return this;
    }
    /**
     *
     *   * Pushes a selector to the list.
     *   * @param selector - The selector to add.
     *
     * @param {Selector} selector
     */
    push_selector(selector) {
        _assertClass(selector, Selector);
        var ptr0 = selector.__destroy_into_raw();
        wasm.ruleprelude_push_selector(this.__wbg_ptr, ptr0);
    }
}
if (Symbol.dispose) RulePrelude.prototype[Symbol.dispose] = RulePrelude.prototype.free;

export class Selector {
    __destroy_into_raw() {
        const ptr = this.__wbg_ptr;
        this.__wbg_ptr = 0;
        SelectorFinalization.unregister(this);
        return ptr;
    }
    free() {
        const ptr = this.__destroy_into_raw();
        wasm.__wbg_selector_free(ptr, 0);
    }
    constructor() {
        const ret = wasm.ruleprelude_new();
        this.__wbg_ptr = ret >>> 0;
        SelectorFinalization.register(this, this.__wbg_ptr, this);
        return this;
    }
    /**
     *
     *   * Pushes a selector section to the selector.
     *   * @param selector_type - The type of the selector section (e.g., "ClassSelector", "IdSelector").
     *   * @param value - The value of the selector section.
     *
     * @param {string} selector_type
     * @param {string} value
     */
    push_one_selector_section(selector_type, value) {
        const ptr0 = passStringToWasm0(selector_type, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
        const len0 = WASM_VECTOR_LEN;
        const ptr1 = passStringToWasm0(value, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
        const len1 = WASM_VECTOR_LEN;
        const ret = wasm.selector_push_one_selector_section(this.__wbg_ptr, ptr0, len0, ptr1, len1);
        if (ret[1]) {
            throw takeFromExternrefTable0(ret[0]);
        }
    }
}
if (Symbol.dispose) Selector.prototype[Symbol.dispose] = Selector.prototype.free;

export class StyleSheetResource {
    __destroy_into_raw() {
        const ptr = this.__wbg_ptr;
        this.__wbg_ptr = 0;
        StyleSheetResourceFinalization.unregister(this);
        return ptr;
    }
    free() {
        const ptr = this.__destroy_into_raw();
        wasm.__wbg_stylesheetresource_free(ptr, 0);
    }
    /**
     * @param {Uint8Array} buffer
     * @param {any} _document
     */
    constructor(buffer, _document) {
        const ret = wasm.stylesheetresource_new(buffer, _document);
        if (ret[2]) {
            throw takeFromExternrefTable0(ret[1]);
        }
        this.__wbg_ptr = ret[0] >>> 0;
        StyleSheetResourceFinalization.register(this, this.__wbg_ptr, this);
        return this;
    }
}
if (Symbol.dispose) StyleSheetResource.prototype[Symbol.dispose] = StyleSheetResource.prototype.free;

/**
 * @param {Uint8Array} buffer
 * @param {string | null | undefined} entry_name
 * @param {boolean} config_enable_css_selector
 * @param {boolean} transform_vw
 * @param {boolean} transform_vh
 * @param {boolean} transform_rem
 * @returns {Uint8Array}
 */
export function decode_style_info(buffer, entry_name, config_enable_css_selector, transform_vw, transform_vh, transform_rem) {
    var ptr0 = isLikeNone(entry_name) ? 0 : passStringToWasm0(entry_name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
    var len0 = WASM_VECTOR_LEN;
    const ret = wasm.decode_style_info(buffer, ptr0, len0, config_enable_css_selector, transform_vw, transform_vh, transform_rem);
    if (ret[2]) {
        throw takeFromExternrefTable0(ret[1]);
    }
    return takeFromExternrefTable0(ret[0]);
}

/**
 * @param {RawStyleInfo} raw_style_info
 * @param {boolean} config_enable_css_selector
 * @param {string | null | undefined} entry_name
 * @param {boolean} transform_vw
 * @param {boolean} transform_vh
 * @param {boolean} transform_rem
 * @returns {Uint8Array}
 */
export function encode_legacy_json_generated_raw_style_info(raw_style_info, config_enable_css_selector, entry_name, transform_vw, transform_vh, transform_rem) {
    _assertClass(raw_style_info, RawStyleInfo);
    var ptr0 = raw_style_info.__destroy_into_raw();
    var ptr1 = isLikeNone(entry_name) ? 0 : passStringToWasm0(entry_name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
    var len1 = WASM_VECTOR_LEN;
    const ret = wasm.encode_legacy_json_generated_raw_style_info(ptr0, config_enable_css_selector, ptr1, len1, transform_vw, transform_vh, transform_rem);
    if (ret[2]) {
        throw takeFromExternrefTable0(ret[1]);
    }
    return takeFromExternrefTable0(ret[0]);
}

/**
 * @param {Uint8Array} buffer
 * @returns {string}
 */
export function get_font_face_content(buffer) {
    let deferred2_0;
    let deferred2_1;
    try {
        const ret = wasm.get_font_face_content(buffer);
        var ptr1 = ret[0];
        var len1 = ret[1];
        if (ret[3]) {
            ptr1 = 0; len1 = 0;
            throw takeFromExternrefTable0(ret[2]);
        }
        deferred2_0 = ptr1;
        deferred2_1 = len1;
        return getStringFromWasm0(ptr1, len1);
    } finally {
        wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
    }
}

/**
 * @param {Uint8Array} buffer
 * @returns {string}
 */
export function get_style_content(buffer) {
    let deferred2_0;
    let deferred2_1;
    try {
        const ret = wasm.get_style_content(buffer);
        var ptr1 = ret[0];
        var len1 = ret[1];
        if (ret[3]) {
            ptr1 = 0; len1 = 0;
            throw takeFromExternrefTable0(ret[2]);
        }
        deferred2_0 = ptr1;
        deferred2_1 = len1;
        return getStringFromWasm0(ptr1, len1);
    } finally {
        wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
    }
}

/**
 * @param {string} css
 */
export function init_server_in_shadow_css(css) {
    const ptr0 = passStringToWasm0(css, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
    const len0 = WASM_VECTOR_LEN;
    wasm.init_server_in_shadow_css(ptr0, len0);
}

function __wbg_get_imports() {
    const import0 = {
        __proto__: null,
        __wbg_Error_8c4e43fe74559d73: function(arg0, arg1) {
            const ret = Error(getStringFromWasm0(arg0, arg1));
            return ret;
        },
        __wbg___wbindgen_debug_string_0bc8482c6e3508ae: function(arg0, arg1) {
            const ret = debugString(arg1);
            const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
            const len1 = WASM_VECTOR_LEN;
            getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
            getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
        },
        __wbg___wbindgen_string_get_72fb696202c56729: function(arg0, arg1) {
            const obj = arg1;
            const ret = typeof(obj) === 'string' ? obj : undefined;
            var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
            var len1 = WASM_VECTOR_LEN;
            getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
            getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
        },
        __wbg___wbindgen_throw_be289d5034ed271b: function(arg0, arg1) {
            throw new Error(getStringFromWasm0(arg0, arg1));
        },
        __wbg_length_32ed9a279acd054c: function(arg0) {
            const ret = arg0.length;
            return ret;
        },
        __wbg_new_361308b2356cecd0: function() {
            const ret = new Object();
            return ret;
        },
        __wbg_new_from_slice_a3d2629dc1826784: function(arg0, arg1) {
            const ret = new Uint8Array(getArrayU8FromWasm0(arg0, arg1));
            return ret;
        },
        __wbg_prototypesetcall_bdcdcc5842e4d77d: function(arg0, arg1, arg2) {
            Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
        },
        __wbg_set_6cb8631f80447a67: function() { return handleError(function (arg0, arg1, arg2) {
            const ret = Reflect.set(arg0, arg1, arg2);
            return ret;
        }, arguments); },
        __wbindgen_cast_0000000000000001: function(arg0, arg1) {
            // Cast intrinsic for `Ref(String) -> Externref`.
            const ret = getStringFromWasm0(arg0, arg1);
            return ret;
        },
        __wbindgen_init_externref_table: function() {
            const table = wasm.__wbindgen_externrefs;
            const offset = table.grow(4);
            table.set(0, undefined);
            table.set(offset + 0, undefined);
            table.set(offset + 1, null);
            table.set(offset + 2, true);
            table.set(offset + 3, false);
        },
    };
    return {
        __proto__: null,
        "./server_debug_bg.js": import0,
    };
}

const MainThreadServerContextFinalization = (typeof FinalizationRegistry === 'undefined')
    ? { register: () => {}, unregister: () => {} }
    : new FinalizationRegistry(ptr => wasm.__wbg_mainthreadservercontext_free(ptr >>> 0, 1));
const RawStyleInfoFinalization = (typeof FinalizationRegistry === 'undefined')
    ? { register: () => {}, unregister: () => {} }
    : new FinalizationRegistry(ptr => wasm.__wbg_rawstyleinfo_free(ptr >>> 0, 1));
const RuleFinalization = (typeof FinalizationRegistry === 'undefined')
    ? { register: () => {}, unregister: () => {} }
    : new FinalizationRegistry(ptr => wasm.__wbg_rule_free(ptr >>> 0, 1));
const RulePreludeFinalization = (typeof FinalizationRegistry === 'undefined')
    ? { register: () => {}, unregister: () => {} }
    : new FinalizationRegistry(ptr => wasm.__wbg_ruleprelude_free(ptr >>> 0, 1));
const SelectorFinalization = (typeof FinalizationRegistry === 'undefined')
    ? { register: () => {}, unregister: () => {} }
    : new FinalizationRegistry(ptr => wasm.__wbg_selector_free(ptr >>> 0, 1));
const StyleSheetResourceFinalization = (typeof FinalizationRegistry === 'undefined')
    ? { register: () => {}, unregister: () => {} }
    : new FinalizationRegistry(ptr => wasm.__wbg_stylesheetresource_free(ptr >>> 0, 1));

function addToExternrefTable0(obj) {
    const idx = wasm.__externref_table_alloc();
    wasm.__wbindgen_externrefs.set(idx, obj);
    return idx;
}

function _assertClass(instance, klass) {
    if (!(instance instanceof klass)) {
        throw new Error(`expected instance of ${klass.name}`);
    }
}

function debugString(val) {
    // primitive types
    const type = typeof val;
    if (type == 'number' || type == 'boolean' || val == null) {
        return  `${val}`;
    }
    if (type == 'string') {
        return `"${val}"`;
    }
    if (type == 'symbol') {
        const description = val.description;
        if (description == null) {
            return 'Symbol';
        } else {
            return `Symbol(${description})`;
        }
    }
    if (type == 'function') {
        const name = val.name;
        if (typeof name == 'string' && name.length > 0) {
            return `Function(${name})`;
        } else {
            return 'Function';
        }
    }
    // objects
    if (Array.isArray(val)) {
        const length = val.length;
        let debug = '[';
        if (length > 0) {
            debug += debugString(val[0]);
        }
        for(let i = 1; i < length; i++) {
            debug += ', ' + debugString(val[i]);
        }
        debug += ']';
        return debug;
    }
    // Test for built-in
    const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
    let className;
    if (builtInMatches && builtInMatches.length > 1) {
        className = builtInMatches[1];
    } else {
        // Failed to match the standard '[object ClassName]'
        return toString.call(val);
    }
    if (className == 'Object') {
        // we're a user defined class or Object
        // JSON.stringify avoids problems with cycles, and is generally much
        // easier than looping through ownProperties of `val`.
        try {
            return 'Object(' + JSON.stringify(val) + ')';
        } catch (_) {
            return 'Object';
        }
    }
    // errors
    if (val instanceof Error) {
        return `${val.name}: ${val.message}\n${val.stack}`;
    }
    // TODO we could test for more things here, like `Set`s and `Map`s.
    return className;
}

function getArrayU8FromWasm0(ptr, len) {
    ptr = ptr >>> 0;
    return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
}

let cachedDataViewMemory0 = null;
function getDataViewMemory0() {
    if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
        cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
    }
    return cachedDataViewMemory0;
}

function getStringFromWasm0(ptr, len) {
    ptr = ptr >>> 0;
    return decodeText(ptr, len);
}

let cachedUint32ArrayMemory0 = null;
function getUint32ArrayMemory0() {
    if (cachedUint32ArrayMemory0 === null || cachedUint32ArrayMemory0.byteLength === 0) {
        cachedUint32ArrayMemory0 = new Uint32Array(wasm.memory.buffer);
    }
    return cachedUint32ArrayMemory0;
}

let cachedUint8ArrayMemory0 = null;
function getUint8ArrayMemory0() {
    if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
        cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
    }
    return cachedUint8ArrayMemory0;
}

function handleError(f, args) {
    try {
        return f.apply(this, args);
    } catch (e) {
        const idx = addToExternrefTable0(e);
        wasm.__wbindgen_exn_store(idx);
    }
}

function isLikeNone(x) {
    return x === undefined || x === null;
}

function passArray32ToWasm0(arg, malloc) {
    const ptr = malloc(arg.length * 4, 4) >>> 0;
    getUint32ArrayMemory0().set(arg, ptr / 4);
    WASM_VECTOR_LEN = arg.length;
    return ptr;
}

function passArrayJsValueToWasm0(array, malloc) {
    const ptr = malloc(array.length * 4, 4) >>> 0;
    for (let i = 0; i < array.length; i++) {
        const add = addToExternrefTable0(array[i]);
        getDataViewMemory0().setUint32(ptr + 4 * i, add, true);
    }
    WASM_VECTOR_LEN = array.length;
    return ptr;
}

function passStringToWasm0(arg, malloc, realloc) {
    if (realloc === undefined) {
        const buf = cachedTextEncoder.encode(arg);
        const ptr = malloc(buf.length, 1) >>> 0;
        getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
        WASM_VECTOR_LEN = buf.length;
        return ptr;
    }

    let len = arg.length;
    let ptr = malloc(len, 1) >>> 0;

    const mem = getUint8ArrayMemory0();

    let offset = 0;

    for (; offset < len; offset++) {
        const code = arg.charCodeAt(offset);
        if (code > 0x7F) break;
        mem[ptr + offset] = code;
    }
    if (offset !== len) {
        if (offset !== 0) {
            arg = arg.slice(offset);
        }
        ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
        const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
        const ret = cachedTextEncoder.encodeInto(arg, view);

        offset += ret.written;
        ptr = realloc(ptr, len, offset, 1) >>> 0;
    }

    WASM_VECTOR_LEN = offset;
    return ptr;
}

function takeFromExternrefTable0(idx) {
    const value = wasm.__wbindgen_externrefs.get(idx);
    wasm.__externref_table_dealloc(idx);
    return value;
}

let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
cachedTextDecoder.decode();
function decodeText(ptr, len) {
    return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
}

const cachedTextEncoder = new TextEncoder();

if (!('encodeInto' in cachedTextEncoder)) {
    cachedTextEncoder.encodeInto = function (arg, view) {
        const buf = cachedTextEncoder.encode(arg);
        view.set(buf);
        return {
            read: arg.length,
            written: buf.length
        };
    };
}

let WASM_VECTOR_LEN = 0;

import { readFileSync } from 'node:fs';
const wasmUrl = new URL('server_debug_bg.wasm', import.meta.url);
const wasmBytes = readFileSync(wasmUrl);
const wasmModule = new WebAssembly.Module(wasmBytes);
const wasm = new WebAssembly.Instance(wasmModule, __wbg_get_imports()).exports;
wasm.__wbindgen_start();
