import { Property, View, booleanConverter, PseudoClassHandler, CSSType, Builder, Label } from "@nativescript/core";
// Enums
export var AutoCompleteDisplayMode;
(function (AutoCompleteDisplayMode) {
    AutoCompleteDisplayMode["Tokens"] = "Tokens";
    AutoCompleteDisplayMode["Plain"] = "Plain";
})(AutoCompleteDisplayMode || (AutoCompleteDisplayMode = {}));
export var AutoCompleteSuggestMode;
(function (AutoCompleteSuggestMode) {
    AutoCompleteSuggestMode["Suggest"] = "Suggest";
    AutoCompleteSuggestMode["Append"] = "Append";
    AutoCompleteSuggestMode["SuggestAppend"] = "SuggestAppend";
})(AutoCompleteSuggestMode || (AutoCompleteSuggestMode = {}));
export var AutoCompleteLayoutMode;
(function (AutoCompleteLayoutMode) {
    AutoCompleteLayoutMode["Horizontal"] = "Horizontal";
    AutoCompleteLayoutMode["Wrap"] = "Wrap";
})(AutoCompleteLayoutMode || (AutoCompleteLayoutMode = {}));
export var AutoCompleteCompletionMode;
(function (AutoCompleteCompletionMode) {
    AutoCompleteCompletionMode["StartsWith"] = "StartsWith";
    AutoCompleteCompletionMode["Contains"] = "Contains";
})(AutoCompleteCompletionMode || (AutoCompleteCompletionMode = {}));
export var AutoCompleteViewType;
(function (AutoCompleteViewType) {
    AutoCompleteViewType["ItemView"] = "ItemView";
})(AutoCompleteViewType || (AutoCompleteViewType = {}));
// AutoComplete object classes
let SuggestionView = class SuggestionView extends View {
    constructor() {
        super();
    }
    // @ts-ignore
    get android() {
        return undefined;
    }
    get _nativeView() {
        return undefined;
    }
    get owner() {
        return this._owner;
    }
    set owner(value) {
        this._owner = value;
    }
    updateView() {
    }
    onSuggestionViewHeightPropertyChanged(oldValue, newValue) {
        this.onSuggestionViewHeightChanged(oldValue, newValue);
    }
    onSuggestionViewHeightChanged(oldValue, newValue) {
    }
    onSuggestionItemTemplatePropertyChanged(oldValue, newValue) {
        this.onSuggestionItemTemplateChanged(oldValue, newValue);
    }
    onSuggestionItemTemplateChanged(oldValue, newValue) {
    }
};
SuggestionView.suggestionViewHeightProperty = new Property({
    name: "suggestionViewHeight",
    defaultValue: undefined,
    valueConverter: (value) => {
        if (typeof value === "string") {
            return parseInt(value);
        }
        return value;
    },
    valueChanged: (target, oldValue, newValue) => {
        target.onSuggestionViewHeightPropertyChanged(oldValue, newValue);
    },
});
SuggestionView.suggestionItemTemplateProperty = new Property({
    name: "suggestionItemTemplate",
    defaultValue: undefined,
    valueChanged: (target, oldValue, newValue) => {
        target.onSuggestionItemTemplatePropertyChanged(oldValue, newValue);
    },
});
SuggestionView = __decorate([
    CSSType("SuggestionView"),
    __metadata("design:paramtypes", [])
], SuggestionView);
export { SuggestionView };
SuggestionView.suggestionViewHeightProperty.register(SuggestionView);
SuggestionView.suggestionItemTemplateProperty.register(SuggestionView);
// TokenModel
export class TokenModel {
    constructor(text, image) {
        this.text = text;
        this.image = image;
    }
    get android() {
        return undefined;
    }
    get ios() {
        return undefined;
    }
    toString() {
        return this.text;
    }
}
let ClearButton = class ClearButton extends View {
};
ClearButton = __decorate([
    CSSType("ClearButton")
], ClearButton);
export { ClearButton };
let TokenClearButton = class TokenClearButton extends View {
};
TokenClearButton = __decorate([
    CSSType("TokenClearButton")
], TokenClearButton);
export { TokenClearButton };
let Token = class Token extends View {
    get clearButton() {
        return undefined;
    }
};
Token = __decorate([
    CSSType("Token")
], Token);
export { Token };
let NoResultsLabel = class NoResultsLabel extends View {
};
NoResultsLabel = __decorate([
    CSSType("NoResultsLabel")
], NoResultsLabel);
export { NoResultsLabel };
export class CollectionViewEventData {
    constructor() {
    }
    get android() {
        return this._android;
    }
    set android(value) {
        this._android = value;
    }
    get ios() {
        return this._ios;
    }
    set ios(value) {
        this._ios = value;
    }
    get eventName() {
        return this._eventName;
    }
    set eventName(value) {
        this._eventName = value;
    }
    get object() {
        return this._object;
    }
    set object(value) {
        this._object = value;
    }
    get index() {
        return this._index;
    }
    set index(value) {
        this._index = value;
    }
    get groupIndex() {
        return this._groupIndex;
    }
    set groupIndex(value) {
        this._groupIndex = value;
    }
    get data() {
        return this._data;
    }
    set data(value) {
        this._data = value;
    }
    get returnValue() {
        return this._returnValue;
    }
    set returnValue(value) {
        this._returnValue = value;
    }
    get view() {
        return this._view;
    }
    set view(value) {
        this._view = value;
    }
}
// Event object
export class AutoCompleteEventData {
    constructor(object, eventName, text, token) {
        this._object = object;
        this._eventName = eventName;
        this._token = token;
        this._text = text;
    }
    get eventName() {
        return this._eventName;
    }
    set eventName(value) {
        this._eventName = value;
    }
    get text() {
        return this._text;
    }
    set text(value) {
        this._text = value;
    }
    get token() {
        return this._token;
    }
    set token(value) {
        this._token = value;
    }
    get object() {
        return this._object;
    }
    set object(value) {
        this._object = value;
    }
}
// RadAutoComplete impl
let RadAutoCompleteTextView = class RadAutoCompleteTextView extends View {
    constructor() {
        super();
        this._tokens = new Array();
        this._autoCompleteFocusHandler = () => this._goToVisualState("focus");
        this._autoCompleteBlurHandler = () => this._goToVisualState("blur");
    }
    // properties
    get itemViewLoader() {
        return this._itemViewLoader;
    }
    get filteredItems() {
        return undefined;
    }
    get selectedTokens() {
        return undefined;
    }
    get clearButton() {
        return undefined;
    }
    get noResultsLabel() {
        return undefined;
    }
    set itemViewLoader(value) {
        if (this._itemViewLoader !== value) {
            this._itemViewLoader = value;
            this.onItemViewLoaderChanged();
        }
    }
    _updateAutoCompleteFocusBlurHandlers(subscribe) {
        const method = subscribe ? "on" : "off";
        this[method]("focus", this._autoCompleteFocusHandler);
        this[method]("blur", this._autoCompleteBlurHandler);
    }
    onLoadSuggestionsAsyncPropertyChanged(oldValue, newValue) {
        this.onLoadSuggestionsAsyncChanged(oldValue, newValue);
    }
    onLoadSuggestionsAsyncChanged(oldValue, newValue) {
    }
    onItemViewLoaderChanged() {
    }
    resolveTemplateView(template) {
        return Builder.parse(template, this);
    }
    _getDefaultItemContent() {
        let lbl = new Label();
        lbl.bind({
            targetProperty: "text",
            sourceProperty: "text"
        });
        lbl.padding = 16;
        return lbl;
    }
    getViewForViewType(viewType) {
        let newView = undefined;
        if (this._itemViewLoader !== undefined) {
            newView = this._itemViewLoader(viewType);
        }
        if (newView) {
            return newView;
        }
        let templateString = undefined;
        switch (viewType) {
            case AutoCompleteViewType.ItemView:
                if (this.suggestionView) {
                    templateString = this.suggestionView.suggestionItemTemplate;
                }
                break;
        }
        return templateString === undefined ?
            this._getDefaultItemContent() :
            this.resolveTemplateView(templateString);
    }
    onItemsPropertyChanged(oldValue, newValue) {
        this.onItemsChanged(oldValue, newValue);
    }
    onItemsChanged(oldValue, newValue) {
    }
    onSuggestionViewPropertyChanged(oldValue, newValue) {
        this.onSuggestionViewChanged(oldValue, newValue);
    }
    onSuggestionViewChanged(oldValue, newValue) {
    }
    onDisplayModePropertyChanged(oldValue, newValue) {
        this.onDisplayModeChanged(oldValue, newValue);
    }
    onDisplayModeChanged(oldValue, newValue) {
    }
    onCompletionModePropertyChanged(oldValue, newValue) {
        this.onCompletionModeChanged(oldValue, newValue);
    }
    onCompletionModeChanged(oldValue, newValue) {
    }
    onLayoutModePropertyChanged(oldValue, newValue) {
        this.onLayoutModeChanged(oldValue, newValue);
    }
    onLayoutModeChanged(oldValue, newValue) {
    }
    onSuggestModePropertyChanged(oldValue, newValue) {
        this.onSuggestModeChanged(oldValue, newValue);
    }
    onSuggestModeChanged(oldValue, newValue) {
    }
    onHintPropertyChanged(oldValue, newValue) {
        this.onHintChanged(oldValue, newValue);
    }
    onHintChanged(oldValue, newValue) {
    }
    onTextPropertyChanged(oldValue, newValue) {
        this.onTextChanged(oldValue, newValue);
    }
    onTextChanged(oldValue, newValue) {
    }
    onMinimumCharactersToSearchPropertyChanged(oldValue, newValue) {
        this.onMinimumCharactersToSearchChanged(oldValue, newValue);
    }
    onMinimumCharactersToSearchChanged(oldValue, newValue) {
    }
    onTokenItemSpacingPropertyChanged(oldValue, newValue) {
        this.onTokenItemSpacingChanged(oldValue, newValue);
    }
    onTokenItemSpacingChanged(oldValue, newValue) {
    }
    onNoResultsTextPropertyChanged(oldValue, newValue) {
        this.onNoResultsTextChanged(oldValue, newValue);
    }
    onNoResultsTextChanged(oldValue, newValue) {
    }
    onShowCloseButtonPropertyChanged(oldValue, newValue) {
        this.onShowCloseButtonChanged(oldValue, newValue);
    }
    onShowCloseButtonChanged(oldValue, newValue) {
    }
    onCloseButtonImageSrcPropertyChanged(oldValue, newValue) {
        this.onCloseButtonImageSrcChanged(oldValue, newValue);
    }
    onCloseButtonImageSrcChanged(oldValue, newValue) {
    }
    onReadOnlyPropertyChanged(oldValue, newValue) {
        this.onReadOnlyChanged(oldValue, newValue);
    }
    onReadOnlyChanged(oldValue, newValue) {
    }
    // Methods
    resetAutoComplete() {
    }
    addToken(token) {
    }
    insertTokenAtIndex(token, index) {
    }
    removeToken(token) {
    }
    removeTokenAtIndex(index) {
    }
    removeAllTokens() {
    }
    tokens() {
    }
    tokenAtIndex(index) {
    }
    findSuggestions() {
    }
    eachChild(callback) {
        if (this.clearButton) {
            callback(this.clearButton);
        }
        if (this.noResultsLabel) {
            callback(this.noResultsLabel);
        }
        if (this.suggestionView) {
            callback(this.suggestionView);
        }
        const tokenCount = this._tokens.length;
        for (let i = 0; i < tokenCount; i++) {
            callback(this._tokens[i]);
        }
    }
};
RadAutoCompleteTextView.textChangedEvent = "textChanged";
RadAutoCompleteTextView.tokenRemovedEvent = "tokenRemoved";
RadAutoCompleteTextView.tokenAddedEvent = "tokenAdded";
RadAutoCompleteTextView.tokenSelectedEvent = "tokenSelected";
RadAutoCompleteTextView.tokenDeselectedEvent = "tokenDeselected";
RadAutoCompleteTextView.didAutoCompleteEvent = "didAutoComplete";
RadAutoCompleteTextView.suggestionViewBecameVisibleEvent = "suggestionViewBecameVisible";
RadAutoCompleteTextView.itemLoadingEvent = "itemLoading";
RadAutoCompleteTextView.loadSuggestionsAsyncProperty = new Property({
    name: "loadSuggestionsAsync",
    defaultValue: undefined,
    valueChanged: (target, oldValue, newValue) => {
        target.onLoadSuggestionsAsyncPropertyChanged(oldValue, newValue);
    },
});
RadAutoCompleteTextView.itemsProperty = new Property({
    name: "items",
    defaultValue: undefined,
    valueChanged: (target, oldValue, newValue) => {
        target.onItemsPropertyChanged(oldValue, newValue);
    },
});
// SuggestionView
RadAutoCompleteTextView.suggestionViewProperty = new Property({
    name: "suggestionView",
    defaultValue: undefined,
    valueChanged: (target, oldValue, newValue) => {
        target.onSuggestionViewPropertyChanged(oldValue, newValue);
    },
});
// Display mode
RadAutoCompleteTextView.displayModeProperty = new Property({
    name: "displayMode",
    defaultValue: AutoCompleteDisplayMode.Plain,
    valueConverter: (value) => AutoCompleteDisplayMode[toPascalCase(value)],
    valueChanged: (target, oldValue, newValue) => {
        target.onDisplayModePropertyChanged(oldValue, newValue);
    },
});
// Completion Mode
RadAutoCompleteTextView.completionModeProperty = new Property({
    name: "completionMode",
    defaultValue: AutoCompleteCompletionMode.StartsWith,
    valueConverter: (value) => AutoCompleteCompletionMode[toPascalCase(value)],
    valueChanged: (target, oldValue, newValue) => {
        target.onCompletionModePropertyChanged(oldValue, newValue);
    },
});
// Layout mode
RadAutoCompleteTextView.layoutModeProperty = new Property({
    name: "layoutMode",
    defaultValue: AutoCompleteLayoutMode.Wrap,
    valueConverter: (value) => AutoCompleteLayoutMode[toPascalCase(value)],
    valueChanged: (target, oldValue, newValue) => {
        target.onLayoutModePropertyChanged(oldValue, newValue);
    },
});
// Suggest Mode
RadAutoCompleteTextView.suggestModeProperty = new Property({
    name: "suggestMode",
    defaultValue: AutoCompleteSuggestMode.Suggest,
    valueConverter: (value) => AutoCompleteSuggestMode[toPascalCase(value)],
    valueChanged: (target, oldValue, newValue) => {
        target.onSuggestModePropertyChanged(oldValue, newValue);
    },
});
// Hint
RadAutoCompleteTextView.hintProperty = new Property({
    name: "hint",
    defaultValue: undefined,
    valueChanged: (target, oldValue, newValue) => {
        target.onHintPropertyChanged(oldValue, newValue);
    },
});
// Text
RadAutoCompleteTextView.textProperty = new Property({
    name: "text",
    defaultValue: "",
    valueChanged: (target, oldValue, newValue) => {
        target.onTextPropertyChanged(oldValue, newValue);
    },
});
// MinimumCharactersToSearch
RadAutoCompleteTextView.minimumCharactersToSearchProperty = new Property({
    name: "minimumCharactersToSearch",
    defaultValue: 1,
    valueConverter: parseInt,
    valueChanged: (target, oldValue, newValue) => {
        target.onMinimumCharactersToSearchPropertyChanged(oldValue, newValue);
    },
});
RadAutoCompleteTextView.tokenItemSpacingProperty = new Property({
    name: "tokenItemSpacing",
    defaultValue: 3,
    valueConverter: parseInt,
    valueChanged: (target, oldValue, newValue) => {
        target.onTokenItemSpacingPropertyChanged(oldValue, newValue);
    },
});
RadAutoCompleteTextView.noResultsTextProperty = new Property({
    name: "noResultsText",
    defaultValue: undefined,
    valueChanged: (target, oldValue, newValue) => {
        target.onNoResultsTextPropertyChanged(oldValue, newValue);
    },
});
RadAutoCompleteTextView.showCloseButtonProperty = new Property({
    name: "showCloseButton",
    defaultValue: true,
    valueConverter: booleanConverter,
    valueChanged: (target, oldValue, newValue) => {
        target.onShowCloseButtonPropertyChanged(oldValue, newValue);
    },
});
RadAutoCompleteTextView.closeButtonImageSrcProperty = new Property({
    name: "closeButtonImageSrc",
    defaultValue: undefined,
    valueChanged: (target, oldValue, newValue) => {
        target.onCloseButtonImageSrcPropertyChanged(oldValue, newValue);
    },
});
RadAutoCompleteTextView.readOnlyProperty = new Property({
    name: "readOnly",
    defaultValue: false,
    valueConverter: booleanConverter,
    valueChanged: (target, oldValue, newValue) => {
        target.onReadOnlyPropertyChanged(oldValue, newValue);
    },
});
__decorate([
    PseudoClassHandler("focus", "blur"),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Boolean]),
    __metadata("design:returntype", void 0)
], RadAutoCompleteTextView.prototype, "_updateAutoCompleteFocusBlurHandlers", null);
RadAutoCompleteTextView = __decorate([
    CSSType("RadAutoCompleteTextView"),
    __metadata("design:paramtypes", [])
], RadAutoCompleteTextView);
export { RadAutoCompleteTextView };
export function setupCssScope(scopedView, unscopedView) {
    const ngKey = scopedView._ngKey;
    if (ngKey) {
        let ngValue = scopedView[ngKey];
        unscopedView[ngKey] = ngValue;
    }
    const vueKey = scopedView._vueKey;
    if (vueKey) {
        let vueValue = scopedView[vueKey];
        unscopedView[vueKey] = vueValue;
    }
}
function toPascalCase(value) {
    if (!value) {
        return value;
    }
    const words = value.split('-');
    const upperCaseWords = words.map((word) => word.charAt(0).toUpperCase() + word.slice(1));
    return upperCaseWords.join('');
}
RadAutoCompleteTextView.loadSuggestionsAsyncProperty.register(RadAutoCompleteTextView);
RadAutoCompleteTextView.itemsProperty.register(RadAutoCompleteTextView);
RadAutoCompleteTextView.suggestionViewProperty.register(RadAutoCompleteTextView);
RadAutoCompleteTextView.displayModeProperty.register(RadAutoCompleteTextView);
RadAutoCompleteTextView.completionModeProperty.register(RadAutoCompleteTextView);
RadAutoCompleteTextView.layoutModeProperty.register(RadAutoCompleteTextView);
RadAutoCompleteTextView.suggestModeProperty.register(RadAutoCompleteTextView);
RadAutoCompleteTextView.hintProperty.register(RadAutoCompleteTextView);
RadAutoCompleteTextView.textProperty.register(RadAutoCompleteTextView);
RadAutoCompleteTextView.minimumCharactersToSearchProperty.register(RadAutoCompleteTextView);
RadAutoCompleteTextView.tokenItemSpacingProperty.register(RadAutoCompleteTextView);
RadAutoCompleteTextView.noResultsTextProperty.register(RadAutoCompleteTextView);
RadAutoCompleteTextView.showCloseButtonProperty.register(RadAutoCompleteTextView);
RadAutoCompleteTextView.closeButtonImageSrcProperty.register(RadAutoCompleteTextView);
RadAutoCompleteTextView.readOnlyProperty.register(RadAutoCompleteTextView);
//# sourceMappingURL=common.js.map