// Path: x-gwt-essential/src/main/java/com/github/spirylics/xgwt/essential/Error.java
// @JsType(isNative = true, namespace = JsPackage.GLOBAL)
// public interface Error {
//     @JsProperty
//     String getCode();
// 
//     @JsProperty
//     String getMessage();
// }


import com.github.spirylics.xgwt.essential.*;
import com.github.spirylics.xgwt.essential.Error;
import com.google.gwt.event.shared.HandlerRegistration;
import com.google.gwt.query.client.js.JsUtils;
import jsinterop.annotations.JsOverlay;
import jsinterop.annotations.JsProperty;
import jsinterop.annotations.JsType;
import java.util.Arrays;
import java.util.function.Predicate;
import java.util.stream.Stream;
package com.github.spirylics.xgwt.polymer;



@JsType(isNative = true)
public interface PolymerElement extends GQueryElement, Base {

    @JsProperty
    Lifecycle getLifecycle();

    @SuppressWarnings("unusable-by-js")
    @JsProperty
    void setLifecycle(Lifecycle lifecycle);

    @JsOverlay
    default Lifecycle lifecycle() {
        if (getLifecycle() == null) {
            setLifecycle(new Lifecycle(this));
        }
        return getLifecycle();
    }

    @JsOverlay
    default <T> T call(final String method, final Object... args) {
        return JsUtils.jsni(this.el(), method, args);
    }

    @JsOverlay
    default <S, E, T> Promise<T, E> callWhen(Promise<S, E> promise, final String method, final Object... args) {
        return promise.then(new Fn.ArgRet<S, T>() {
            @Override
            public T e(S arg) {
                return call(method, args);
            }
        });
    }

    @JsOverlay
// Path: x-gwt-essential/src/main/java/com/github/spirylics/xgwt/essential/Error.java
// @JsType(isNative = true, namespace = JsPackage.GLOBAL)
// public interface Error {
//     @JsProperty
//     String getCode();
// 
//     @JsProperty
//     String getMessage();
// }


// Path: x-gwt-polymer/src/main/java/com/github/spirylics/xgwt/polymer/PolymerElement.java
import com.github.spirylics.xgwt.essential.*;
import com.github.spirylics.xgwt.essential.Error;
import com.google.gwt.event.shared.HandlerRegistration;
import com.google.gwt.query.client.js.JsUtils;
import jsinterop.annotations.JsOverlay;
import jsinterop.annotations.JsProperty;
import jsinterop.annotations.JsType;
import java.util.Arrays;
import java.util.function.Predicate;
import java.util.stream.Stream;

package com.github.spirylics.xgwt.polymer;



@JsType(isNative = true)
public interface PolymerElement extends GQueryElement, Base {

    @JsProperty
    Lifecycle getLifecycle();

    @SuppressWarnings("unusable-by-js")
    @JsProperty
    void setLifecycle(Lifecycle lifecycle);

    @JsOverlay
    default Lifecycle lifecycle() {
        if (getLifecycle() == null) {
            setLifecycle(new Lifecycle(this));
        }
        return getLifecycle();
    }

    @JsOverlay
    default <T> T call(final String method, final Object... args) {
        return JsUtils.jsni(this.el(), method, args);
    }

    @JsOverlay
    default <S, E, T> Promise<T, E> callWhen(Promise<S, E> promise, final String method, final Object... args) {
        return promise.then(new Fn.ArgRet<S, T>() {
            @Override
            public T e(S arg) {
                return call(method, args);
            }
        });
    }

    @JsOverlay
    default <T> Promise<T, Error> callWhen(Lifecycle.State state, final String method, final Object... args) {