var __extends = (this && this.__extends) || function (d, b) {
    for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
    function __() { this.constructor = d; }
    d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
define("ADORE", ["require", "exports"], function (require, exports) {
    "use strict";
    (function (ADORE) {
        ADORE[ADORE["LEFT"] = 2] = "LEFT";
        ADORE[ADORE["RIGHT"] = 4] = "RIGHT";
        ADORE[ADORE["CENTER"] = 8] = "CENTER";
        ADORE[ADORE["Close"] = 16] = "Close";
        ADORE[ADORE["Normal"] = 0] = "Normal";
        ADORE[ADORE["Nav"] = 32] = "Nav";
        ADORE[ADORE["Footer"] = 64] = "Footer";
        ADORE[ADORE["Control"] = 262144] = "Control";
        ADORE[ADORE["Scrollable"] = 524288] = "Scrollable";
        ADORE[ADORE["CardPanel"] = 1048576] = "CardPanel";
        ADORE[ADORE["Password"] = 128] = "Password";
        ADORE[ADORE["Float"] = 256] = "Float";
        ADORE[ADORE["Flat"] = 512] = "Flat";
        ADORE[ADORE["Large"] = 1024] = "Large";
        ADORE[ADORE["Zoom"] = 32] = "Zoom";
        ADORE[ADORE["Switch"] = 33] = "Switch";
        ADORE[ADORE["ProductShowNoIncome"] = 34] = "ProductShowNoIncome";
        ADORE[ADORE["INFORMATION"] = 134217728] = "INFORMATION";
        ADORE[ADORE["CONFIRM"] = 268435456] = "CONFIRM";
        ADORE[ADORE["QUESTION"] = 536870912] = "QUESTION";
        ADORE[ADORE["MODAL"] = 1073741824] = "MODAL";
        ADORE[ADORE["Horizontal"] = 68] = "Horizontal";
        ADORE[ADORE["Vertical"] = 69] = "Vertical";
        ADORE[ADORE["Arrow"] = 73] = "Arrow";
        ADORE[ADORE["Graphics"] = 81] = "Graphics";
    })(exports.ADORE || (exports.ADORE = {}));
    var ADORE = exports.ADORE;
});
define("event/MessageType", ["require", "exports"], function (require, exports) {
    "use strict";
    (function (MessageType) {
        MessageType[MessageType["INIT"] = 6] = "INIT";
        MessageType[MessageType["WIDGET"] = 22] = "WIDGET";
        MessageType[MessageType["GPS"] = 24] = "GPS";
        MessageType[MessageType["FINISH"] = 38] = "FINISH";
        MessageType[MessageType["ERROR"] = 54] = "ERROR";
        MessageType[MessageType["ACTIVE_ELEMENT"] = 55] = "ACTIVE_ELEMENT";
        MessageType[MessageType["DISPLAY_FILTER"] = 56] = "DISPLAY_FILTER";
        MessageType[MessageType["DISPLAY"] = 58] = "DISPLAY";
    })(exports.MessageType || (exports.MessageType = {}));
    var MessageType = exports.MessageType;
});
define("Config", ["require", "exports"], function (require, exports) {
    "use strict";
    var Config = (function () {
        function Config() {
        }
        Config.init = function (args) {
            if (args.themePath) {
                $("head").find("#adoreTheme").remove();
                $("<link type='text/css' rel='stylesheet'>").attr({
                    "id": "adoreTheme", "href": args.themePath
                }).appendTo(document.head);
            }
        };
        return Config;
    }());
    exports.Config = Config;
});
define("event/EventHub", ["require", "exports", "event/MessageType"], function (require, exports, MessageType_1) {
    "use strict";
    var EventHub = (function () {
        function EventHub() {
        }
        EventHub.dispatchEvent = function (msgType, attrs) {
            var evtObj = {
                msgType: msgType,
                attributes: attrs
            };
            var msg = JSON.stringify(evtObj);
            if (window["eventdispatch"]) {
                return window["eventdispatch"].dispatch(msg);
            }
            else if (window["cefQuery"]) {
                if (msgType === MessageType_1.MessageType.INIT || msgType === MessageType_1.MessageType.FINISH) {
                    return window["cefQuery"]({
                        request: msg,
                        onSuccess: function (response) {
                        },
                        onFailure: function (error_code, error_message) {
                        }
                    });
                }
                else {
                    try {
                        EventHub.xmlHttpRequest.open("get", "adore://message?msg=" + msg +
                            "&timestamp=" + new Date().valueOf(), false);
                        EventHub.xmlHttpRequest.send();
                        return "true" === EventHub.xmlHttpRequest.responseText;
                    }
                    catch (e) {
                        console.error(e);
                        return false;
                    }
                }
            }
            else if (window["dispatch"]) {
                return window["dispatch"](msg);
            }
            else {
                return confirm("adore://" + msg);
            }
        };
        EventHub.xmlHttpRequest = new XMLHttpRequest();
        return EventHub;
    }());
    exports.EventHub = EventHub;
});
define("event/Event", ["require", "exports"], function (require, exports) {
    "use strict";
    (function (Event) {
        Event[Event["DISPOSED"] = 12] = "DISPOSED";
        Event[Event["MOUSE_UP"] = 36] = "MOUSE_UP";
        Event[Event["MOUSE_DOWN"] = 37] = "MOUSE_DOWN";
        Event[Event["CLICK"] = 38] = "CLICK";
        Event[Event["MODIFY"] = 39] = "MODIFY";
        Event[Event["ON_CHANGE"] = 40] = "ON_CHANGE";
        Event[Event["BROWSER_EVENT"] = 41] = "BROWSER_EVENT";
        Event[Event["ON_FOCUS"] = 42] = "ON_FOCUS";
        Event[Event["KEY_UP"] = 43] = "KEY_UP";
        Event[Event["KEY_DONW"] = 44] = "KEY_DONW";
        Event[Event["SELECTION"] = 45] = "SELECTION";
        Event[Event["TOUCH_MOVE"] = 46] = "TOUCH_MOVE";
        Event[Event["LOOK_OVER"] = 47] = "LOOK_OVER";
        Event[Event["ON_SLIDING"] = 48] = "ON_SLIDING";
        Event[Event["ON_CLOSE"] = 49] = "ON_CLOSE";
        Event[Event["DOUBLE_CLICK"] = 50] = "DOUBLE_CLICK";
    })(exports.Event || (exports.Event = {}));
    var Event = exports.Event;
});
define("util/Map", ["require", "exports"], function (require, exports) {
    "use strict";
    var Map = (function () {
        function Map() {
            this.elements = new Array();
        }
        Map.prototype.put = function (key, value) {
            this.elements.push({ key: key, value: value });
        };
        Map.prototype.containsKey = function (key) {
            if (this.elements.length === 0) {
                return false;
            }
            else {
                for (var i = 0; i < this.elements.length; i++) {
                    var element = this.elements[i];
                    if (element.key === key) {
                        return true;
                    }
                }
                return false;
            }
        };
        Map.prototype.containsValue = function (value) {
            for (var i = 0; i < this.elements.length; i++) {
                var element = this.elements[i];
                if (element.value === value) {
                    return true;
                }
                return false;
            }
        };
        Map.prototype.remove = function (key) {
            for (var i = 0; i < this.elements.length; i++) {
                var element = this.elements[i];
                if (element.key === key) {
                    return this.elements.splice(i, 1);
                }
            }
            return null;
        };
        Map.prototype.getValue = function (key) {
            for (var i = 0; i < this.elements.length; i++) {
                var element = this.elements[i];
                if (element.key === key) {
                    return element.value;
                }
            }
            return null;
        };
        Map.prototype.size = function () {
            return this.elements.length;
        };
        Map.prototype.clear = function () {
            this.elements.splice(0, this.size());
        };
        return Map;
    }());
    exports.Map = Map;
});
define("hotkey/Keys", ["require", "exports"], function (require, exports) {
    "use strict";
    (function (Keys) {
        Keys[Keys["BACKSPACE"] = 8] = "BACKSPACE";
        Keys[Keys["TAB"] = 9] = "TAB";
        Keys[Keys["CLEAR"] = 12] = "CLEAR";
        Keys[Keys["ENTER"] = 13] = "ENTER";
        Keys[Keys["SHIFT"] = 16] = "SHIFT";
        Keys[Keys["CTRL"] = 17] = "CTRL";
        Keys[Keys["ALT"] = 18] = "ALT";
        Keys[Keys["META"] = 91] = "META";
        Keys[Keys["PAUSE"] = 19] = "PAUSE";
        Keys[Keys["CAPS_LOCK"] = 20] = "CAPS_LOCK";
        Keys[Keys["ESCAPE"] = 27] = "ESCAPE";
        Keys[Keys["SPACE"] = 32] = "SPACE";
        Keys[Keys["PAGE_UP"] = 33] = "PAGE_UP";
        Keys[Keys["PAGE_DOWN"] = 34] = "PAGE_DOWN";
        Keys[Keys["END"] = 35] = "END";
        Keys[Keys["HOME"] = 36] = "HOME";
        Keys[Keys["LEFT_ARROW"] = 37] = "LEFT_ARROW";
        Keys[Keys["UP_ARROW"] = 38] = "UP_ARROW";
        Keys[Keys["RIGHT_ARROW"] = 39] = "RIGHT_ARROW";
        Keys[Keys["DOWN_ARROW"] = 40] = "DOWN_ARROW";
        Keys[Keys["INSERT"] = 45] = "INSERT";
        Keys[Keys["DELETE"] = 46] = "DELETE";
        Keys[Keys["HELP"] = 47] = "HELP";
        Keys[Keys["NUM_0"] = 48] = "NUM_0";
        Keys[Keys["NUM_1"] = 49] = "NUM_1";
        Keys[Keys["NUM_2"] = 50] = "NUM_2";
        Keys[Keys["NUM_3"] = 51] = "NUM_3";
        Keys[Keys["NUM_4"] = 52] = "NUM_4";
        Keys[Keys["NUM_5"] = 53] = "NUM_5";
        Keys[Keys["NUM_6"] = 54] = "NUM_6";
        Keys[Keys["NUM_7"] = 55] = "NUM_7";
        Keys[Keys["NUM_8"] = 56] = "NUM_8";
        Keys[Keys["NUM_9"] = 57] = "NUM_9";
        Keys[Keys["CHAR_A"] = 65] = "CHAR_A";
        Keys[Keys["CHAR_B"] = 66] = "CHAR_B";
        Keys[Keys["CHAR_C"] = 67] = "CHAR_C";
        Keys[Keys["CHAR_D"] = 68] = "CHAR_D";
        Keys[Keys["CHAR_E"] = 69] = "CHAR_E";
        Keys[Keys["CHAR_F"] = 70] = "CHAR_F";
        Keys[Keys["CHAR_G"] = 71] = "CHAR_G";
        Keys[Keys["CHAR_H"] = 72] = "CHAR_H";
        Keys[Keys["CHAR_I"] = 73] = "CHAR_I";
        Keys[Keys["CHAR_J"] = 74] = "CHAR_J";
        Keys[Keys["CHAR_K"] = 75] = "CHAR_K";
        Keys[Keys["CHAR_L"] = 76] = "CHAR_L";
        Keys[Keys["CHAR_M"] = 77] = "CHAR_M";
        Keys[Keys["CHAR_N"] = 78] = "CHAR_N";
        Keys[Keys["CHAR_O"] = 79] = "CHAR_O";
        Keys[Keys["CHAR_P"] = 80] = "CHAR_P";
        Keys[Keys["CHAR_Q"] = 81] = "CHAR_Q";
        Keys[Keys["CHAR_R"] = 82] = "CHAR_R";
        Keys[Keys["CHAR_S"] = 83] = "CHAR_S";
        Keys[Keys["CHAR_T"] = 84] = "CHAR_T";
        Keys[Keys["CHAR_U"] = 85] = "CHAR_U";
        Keys[Keys["CHAR_V"] = 86] = "CHAR_V";
        Keys[Keys["CHAR_W"] = 87] = "CHAR_W";
        Keys[Keys["CHAR_X"] = 88] = "CHAR_X";
        Keys[Keys["CHAR_Y"] = 89] = "CHAR_Y";
        Keys[Keys["CHAR_Z"] = 90] = "CHAR_Z";
        Keys[Keys["LEFT_WINDOW"] = 91] = "LEFT_WINDOW";
        Keys[Keys["RIGHT_WINDOW"] = 92] = "RIGHT_WINDOW";
        Keys[Keys["SELECT"] = 93] = "SELECT";
        Keys[Keys["NUMPAD_0"] = 96] = "NUMPAD_0";
        Keys[Keys["NUMPAD_1"] = 97] = "NUMPAD_1";
        Keys[Keys["NUMPAD_2"] = 98] = "NUMPAD_2";
        Keys[Keys["NUMPAD_3"] = 99] = "NUMPAD_3";
        Keys[Keys["NUMPAD_4"] = 100] = "NUMPAD_4";
        Keys[Keys["NUMPAD_5"] = 101] = "NUMPAD_5";
        Keys[Keys["NUMPAD_6"] = 102] = "NUMPAD_6";
        Keys[Keys["NUMPAD_7"] = 103] = "NUMPAD_7";
        Keys[Keys["NUMPAD_8"] = 104] = "NUMPAD_8";
        Keys[Keys["NUMPAD_9"] = 105] = "NUMPAD_9";
        Keys[Keys["NUMPAD_MULTIPLY"] = 106] = "NUMPAD_MULTIPLY";
        Keys[Keys["NUMPAD_PLUS"] = 107] = "NUMPAD_PLUS";
        Keys[Keys["NUMPAD_ENTER"] = 108] = "NUMPAD_ENTER";
        Keys[Keys["NUMPAD_MINUS"] = 109] = "NUMPAD_MINUS";
        Keys[Keys["NUMPAD_PERIOD"] = 110] = "NUMPAD_PERIOD";
        Keys[Keys["NUMPAD_DIVIDE"] = 111] = "NUMPAD_DIVIDE";
        Keys[Keys["F1"] = 112] = "F1";
        Keys[Keys["F2"] = 113] = "F2";
        Keys[Keys["F3"] = 114] = "F3";
        Keys[Keys["F4"] = 115] = "F4";
        Keys[Keys["F5"] = 116] = "F5";
        Keys[Keys["F6"] = 117] = "F6";
        Keys[Keys["F7"] = 118] = "F7";
        Keys[Keys["F8"] = 119] = "F8";
        Keys[Keys["F9"] = 120] = "F9";
        Keys[Keys["F10"] = 121] = "F10";
        Keys[Keys["F11"] = 122] = "F11";
        Keys[Keys["F12"] = 123] = "F12";
        Keys[Keys["F13"] = 124] = "F13";
        Keys[Keys["F14"] = 125] = "F14";
        Keys[Keys["F15"] = 126] = "F15";
        Keys[Keys["NUM_LOCK"] = 144] = "NUM_LOCK";
        Keys[Keys["SCROLL_LOCK"] = 145] = "SCROLL_LOCK";
        Keys[Keys["UP_DPAD"] = 175] = "UP_DPAD";
        Keys[Keys["DOWN_DPAD"] = 176] = "DOWN_DPAD";
        Keys[Keys["LEFT_DPAD"] = 177] = "LEFT_DPAD";
        Keys[Keys["RIGHT_DPAD"] = 178] = "RIGHT_DPAD";
        Keys[Keys["SLASH"] = 191] = "SLASH";
    })(exports.Keys || (exports.Keys = {}));
    var Keys = exports.Keys;
});
define("widget/MessageDialog", ["require", "exports", "widget/Widget", "event/EventHub", "event/Event", "event/MessageType", "util/WidgetUtil", "hotkey/Keys"], function (require, exports, Widget_1, EventHub_1, Event_1, MessageType_2, WidgetUtil_1, Keys_1) {
    "use strict";
    var MessageDialog = (function (_super) {
        __extends(MessageDialog, _super);
        function MessageDialog(parentId, id, style) {
            _super.call(this, parentId, id, style);
            this.modal = true;
            this.$thisNode = $(MessageDialog.Template).attr("id", this.id);
            this.$wrapMessage = $(MessageDialog.TemplateWrap).attr("id", this.id + "_wrap");
            this.$titleNode = this.$thisNode.find("h4");
            this.$contentNode = this.$thisNode.find("pre").attr("id", this.id + "_p");
            this.$footerNode = this.$thisNode.find("div.modal-footer");
        }
        MessageDialog.prototype.setFocus = function () {
        };
        MessageDialog.prototype.setTitle = function (args) {
            this.$titleNode.text(args.title);
        };
        MessageDialog.prototype.setMessage = function (args) {
            this.$contentNode[0].innerHTML = args.message.replace(/</g, "&lt;").replace(/>/g, "&gt;");
        };
        MessageDialog.prototype.createBtnNode = function (btnLabel, code) {
            var _this = this;
            var $btnNode = $(MessageDialog.TemplateButton);
            $btnNode.text(btnLabel);
            $btnNode.appendTo(this.$footerNode);
            var own = this;
            $btnNode.on("click", function (e) {
                if (own.type === 2) {
                    if (code === 0) {
                        var value = own.$thisNode.find("input").val();
                        EventHub_1.EventHub.dispatchEvent(MessageType_2.MessageType.WIDGET, { id: own.id, evtType: Event_1.Event.CLICK, inputText: value });
                    }
                    else {
                        EventHub_1.EventHub.dispatchEvent(MessageType_2.MessageType.WIDGET, { id: own.id, evtType: Event_1.Event.CLICK, inputText: "" });
                    }
                }
                else if (own.type === 1) {
                    if (code === 0) {
                        var text = own.$thisNode.find("select").val();
                        EventHub_1.EventHub.dispatchEvent(MessageType_2.MessageType.WIDGET, { id: own.id, evtType: Event_1.Event.CLICK, inputText: text });
                    }
                    else {
                        EventHub_1.EventHub.dispatchEvent(MessageType_2.MessageType.WIDGET, { id: own.id, evtType: Event_1.Event.CLICK, inputText: "" });
                    }
                }
                else {
                    EventHub_1.EventHub.dispatchEvent(MessageType_2.MessageType.WIDGET, { id: _this.id, evtType: Event_1.Event.CLICK, returnCode: code });
                }
            });
            $btnNode.on("focus", function (e) {
                _this.setCurrentFocusIndex(code);
            });
        };
        MessageDialog.prototype.setCurrentFocusIndex = function (index) {
            this.currentFocusIndex = index;
        };
        MessageDialog.prototype.setMessageType = function (args) {
            this.$footerNode.find("a").remove();
            var type = args.messageType;
            var tmpId = this.id;
            if (type === "confirm") {
                this.createBtnNode("Cancel", 1);
                this.createBtnNode("Ok", 0);
            }
            else if (type === "question") {
                this.createBtnNode("No", 1);
                this.createBtnNode("Yes", 0);
            }
            else if (type === "information") {
                this.createBtnNode("Ok", 0);
            }
            else if (type === "close") {
                this.createBtnNode("Cancel", 1);
                this.createBtnNode("Ok", 0);
                var closeIcon = $(MessageDialog.TemplateCloseButton);
                var $titleBlock = this.$thisNode.find(".adore_dialog_title");
                $titleBlock.append(closeIcon);
            }
        };
        MessageDialog.prototype.setButtonTexts = function (args) {
            this.$footerNode.find("a").remove();
            var btnLabels = args.buttonTexts;
            var btnLabelArr = btnLabels.split("<!-- split -->");
            var len = btnLabelArr.length;
            for (var i = len - 1; i >= 0; i--) {
                this.createBtnNode(btnLabelArr[i], i);
            }
        };
        MessageDialog.prototype.setModal = function (args) {
            this.modal = args.modal;
        };
        MessageDialog.prototype.show = function () {
            this.$thisNode.appendTo(this.$wrapMessage.find(".messageWrap"));
            this.$wrapMessage.appendTo(document.body);
            var own = this;
            var btns = $("#" + this.id).find("div.modal-footer").find("a").reverse();
            this.currentFocusIndex = 0;
            var index = this.currentFocusIndex;
            this.$thisNode.css({
                display: "block",
                opacity: 0,
                scaleX: "0.7"
            });
            this.$thisNode.velocity({ opacity: 1, scaleX: "1" }, {
                duration: 320,
                queue: false,
                ease: "easeOutCubic"
            });
            own.wrapBlockLocation();
            this.resizeListener = function () {
                own.wrapBlockLocation();
            };
            $(window).on("resize", this.resizeListener);
            if (window.innerWidth <= 600) {
                if (this.resetDialogSize("adore_dialog_mobile_size_level_1", "adore_dialog_mobile_size_level_2")) {
                    this.resetDialogSize("adore_dialog_mobile_size_level_2", "adore_dialog_mobile_size_level_3");
                }
            }
            else {
                if (this.resetDialogSize("adore_dialog_size_level_1", "adore_dialog_size_level_2")) {
                    this.resetDialogSize("adore_dialog_size_level_2", "adore_dialog_size_level_3");
                }
            }
            $(MessageDialog.TemplateOverlay).attr("id", this.id + "_overlay").appendTo(document.body);
            WidgetUtil_1.WidgetUtil.refreshDialogZIndex(this.$thisNode[0]);
            if (btns.length !== 0) {
                $(btns[index]).focus();
            }
            this.clickListener = function (e) {
                own.handleClick(e);
            };
            $(document).on("click", this.clickListener);
        };
        MessageDialog.prototype.handleKeydown = function (e) {
            var btns = this.$thisNode.find("div.modal-footer").find("a").reverse();
            if (e.keyCode === Keys_1.Keys.TAB || e.keyCode === Keys_1.Keys.DOWN_ARROW || e.keyCode === Keys_1.Keys.RIGHT_ARROW) {
                this.currentFocusIndex++;
                if (this.currentFocusIndex >= btns.length) {
                    this.currentFocusIndex = 0;
                }
                $(btns[this.currentFocusIndex]).focus();
                e.preventDefault();
            }
            else if (e.keyCode === Keys_1.Keys.LEFT_ARROW || e.keyCode === Keys_1.Keys.UP_ARROW) {
                this.currentFocusIndex--;
                if (this.currentFocusIndex < 0) {
                    this.currentFocusIndex = btns.length - 1;
                }
                $(btns[this.currentFocusIndex]).focus();
                e.preventDefault();
            }
            else if (e.keyCode === Keys_1.Keys.ENTER) {
                if (this.currentFocusIndex >= 0 && this.currentFocusIndex < btns.length) {
                    $(btns[this.currentFocusIndex]).click();
                }
                e.preventDefault();
            }
        };
        MessageDialog.prototype.handleClick = function (e) {
            var btns = this.$thisNode.find("div.modal-footer").find("a");
            if (!btns.is(this)) {
                this.currentFocusIndex = -1;
            }
        };
        MessageDialog.prototype.wrapBlockLocation = function () {
            this.$wrapMessage.find(".myclass").css({
                "width": this.$thisNode.width(),
                "height": this.$thisNode.height(),
                "left": this.$thisNode.offset().left,
                "top": this.$thisNode.offset().top
            });
        };
        MessageDialog.prototype.resetDialogSize = function (removeClass, addClass) {
            var titleH = this.$thisNode.find("div.adore_dialog_title").height();
            var footerH = this.$footerNode.height();
            var contentH = this.$contentNode.height();
            var totalH = $("#" + this.id).height();
            var contentCanUseH = totalH - titleH - footerH;
            if (contentH >= contentCanUseH) {
                this.$thisNode.removeClass(removeClass).addClass(addClass);
                return true;
            }
            return false;
        };
        MessageDialog.prototype.dispose = function () {
            $("#" + this.id + "_overlay").remove();
            if (this.clickListener) {
                $(document).off("click", this.clickListener);
            }
            if (this.resizeListener) {
                $(window).off("resize", this.resizeListener);
            }
            _super.prototype.dispose.call(this);
            this.$wrapMessage.remove();
        };
        MessageDialog.prototype.handleKeyUpEvent = function (e) {
        };
        MessageDialog.prototype.handleKeyDownEvent = function (e, hasFilter) {
            this.handleKeydown(e);
        };
        MessageDialog.prototype.setInputType = function (args) {
            this.type = 2;
            var initialText = args.initialText;
            var $modalContent = this.$contentNode.parent();
            var $input = $("<input></input>");
            $input.val(initialText + "");
            $input.appendTo($modalContent);
        };
        MessageDialog.prototype.setComboType = function (args) {
            this.type = 1;
            var data = args.combo;
            var initialText = data.initialText;
            var comboArr = data.comboArr;
            if (!comboArr || comboArr.length === 0) {
                return;
            }
            var $t = $("<select></select>");
            for (var i = 0; i < comboArr.length; i++) {
                var option = $("<option></option>").text(comboArr[i] + "");
                if (initialText === comboArr[i]) {
                    option.prop("selected", true);
                }
                option.appendTo($t);
            }
            $t.appendTo(this.$contentNode.parent());
        };
        MessageDialog.Template = "\n        <div class=\"modal modal-fixed-footer adore_dialog adore_dialog_size_level_1\">\n            <div class=\"adore_dialog_title\">\n                <h4 class=\"adore_dialog_title_content\"></h4>\n            </div>\n            <div class=\"modal-content adore_dialog_message\">\n                <pre class=\"adore_dialog_message_content\"></pre>\n            </div>\n            <div class=\"modal-footer\"></div>\n        </div>";
        MessageDialog.TemplateWrap = "\n\t    <div class=\"messageWrap\">\n\t    <iframe class=\"myclass\"></iframe><div class=\"messageWrap\"></div>\n    </div>";
        MessageDialog.TemplateButton = "<a href=\"#\" class=\"waves-effect btn-flat modal-action modal-close adore_dialog_btn\">Ok</a>";
        MessageDialog.TemplateOverlay = "<div class=\"adore_lean_overlay\"></div>";
        MessageDialog.TemplateCloseButton = "\n     <a href=\"#\" class=\"waves-effect btn-flat modal-action modal-close adore_dialog_btn adore_dialog_cancel_icon large mdi-content-clear\">\n     </a>\n    ";
        return MessageDialog;
    }(Widget_1.Widget));
    exports.MessageDialog = MessageDialog;
});
define("layout/Layout", ["require", "exports"], function (require, exports) {
    "use strict";
    var Layout = (function () {
        function Layout(composite) {
            this.composite = composite;
        }
        Layout.prototype.dispose = function () { };
        return Layout;
    }());
    exports.Layout = Layout;
});
define("layout/HeaderFooterLayoutData", ["require", "exports"], function (require, exports) {
    "use strict";
    var HeaderFooterLayoutData = (function () {
        function HeaderFooterLayoutData(args) {
            this.style = args.style;
            this.height = args.height;
        }
        HeaderFooterLayoutData.Style = {
            HEADER: 1,
            FOOTER: 2,
            BODY: 3
        };
        return HeaderFooterLayoutData;
    }());
    exports.HeaderFooterLayoutData = HeaderFooterLayoutData;
});
define("layout/HeaderFooterLayout", ["require", "exports", "widget/Composite", "layout/Layout", "layout/HeaderFooterLayoutData"], function (require, exports, Composite_1, Layout_1, HeaderFooterLayoutData_1) {
    "use strict";
    var HeaderFooterLayout = (function (_super) {
        __extends(HeaderFooterLayout, _super);
        function HeaderFooterLayout(composite, layoutOrientation, hiddenFooter) {
            _super.call(this, composite);
            this.layoutOrientation = HeaderFooterLayout.LayoutOrientation.VERTICAL;
            this.hiddenFooter = false;
            this.layoutOrientation = layoutOrientation;
            this.hiddenFooter = hiddenFooter;
        }
        HeaderFooterLayout.prototype.selectChildren = function () {
            for (var _i = 0, _a = this.composite.children; _i < _a.length; _i++) {
                var child = _a[_i];
                if (child.getId().indexOf("FloatPanelComposite") !== -1) {
                    child.append();
                    continue;
                }
                if (!(child instanceof Composite_1.Composite) || !(child.layoutData instanceof HeaderFooterLayoutData_1.HeaderFooterLayoutData)) {
                    continue;
                }
                var layoutData = child.layoutData;
                if (!this.header && layoutData.style === HeaderFooterLayoutData_1.HeaderFooterLayoutData.Style.HEADER) {
                    this.header = child;
                }
                else if (!this.footer && layoutData.style === HeaderFooterLayoutData_1.HeaderFooterLayoutData.Style.FOOTER) {
                    this.footer = child;
                }
                else if (!this.body && layoutData.style === HeaderFooterLayoutData_1.HeaderFooterLayoutData.Style.BODY) {
                    this.body = child;
                }
            }
        };
        HeaderFooterLayout.prototype.horizontalLayout = function () {
            var own = this;
            var headerWidth = 0;
            var footerWidth = 0;
            if (this.header) {
                headerWidth = this.header.layoutData.height;
                this.header.$thisNode.css({
                    position: "absolute",
                    height: "100%",
                    width: headerWidth + "px"
                });
                this.header.append();
            }
            if (this.footer) {
                footerWidth = this.footer.layoutData.height;
                this.footer.$thisNode.css({
                    position: "absolute",
                    height: "100%",
                    width: footerWidth + "px",
                    bottom: "0px",
                    top: "0px",
                    right: "0px",
                    transition: "width 0.4s"
                });
                this.footer.append();
            }
            if (this.body) {
                this.body.$thisNode.css({
                    position: "absolute",
                    top: 0,
                    bottom: 0,
                    left: headerWidth + "px",
                    right: footerWidth + "px",
                    transition: "width 0.4s"
                });
                this.body.append();
            }
            own.horizontalSizeChangeListener = function () {
                own.body.$thisNode.css({
                    width: own.composite.$thisNode.get(0).clientWidth - own.header.$thisNode.get(0).clientWidth
                        - own.footer.$thisNode.get(0).clientWidth + "px"
                });
            };
            $(window).on("resize", own.horizontalSizeChangeListener);
        };
        HeaderFooterLayout.prototype.verticalLayout = function () {
            var own = this;
            var headerHeight = 0;
            var footerHeight = 0;
            if (this.header) {
                headerHeight = this.header.layoutData.height;
                this.header.$thisNode.css({
                    position: "absolute",
                    width: "100%",
                    height: headerHeight + "px"
                });
                this.header.append();
            }
            if (this.footer) {
                footerHeight = this.footer.layoutData.height;
                this.footer.$thisNode.css({
                    position: "absolute",
                    width: "100%",
                    height: footerHeight + "px",
                    bottom: "0px",
                    left: "0px",
                    right: "0px",
                    transition: "height 0.4s"
                });
                this.footer.append();
            }
            if (this.body) {
                this.body.$thisNode.css({
                    position: "absolute",
                    left: 0,
                    right: 0,
                    top: headerHeight + "px",
                    bottom: footerHeight + "px",
                    transition: "height 0.4s"
                });
                this.body.append();
            }
        };
        HeaderFooterLayout.prototype.layout = function () {
            var css = this.composite.$thisNode.get(0).style;
            if (!css.position || css.position === "" || css.position === "static") {
                css.position = "relative";
            }
            this.selectChildren();
            if (this.layoutOrientation === HeaderFooterLayout.LayoutOrientation.HORIZONTAL) {
                this.horizontalLayout();
            }
            else {
                this.verticalLayout();
            }
            this.handleHiddenFooter();
        };
        HeaderFooterLayout.prototype.dispose = function () {
            if (this.headerMutationObserver) {
                this.headerMutationObserver.disconnect();
            }
            if (this.footerMutationObserver) {
                this.footerMutationObserver.disconnect();
            }
            $(window).off("resize", this.horizontalSizeChangeListener);
        };
        HeaderFooterLayout.prototype.toString = function () {
            return "HeaderFooterLayout";
        };
        HeaderFooterLayout.prototype.handleHiddenFooter = function () {
            if (this.hiddenFooter && this.footer && this.body) {
                var hideFooterButton_1 = $("<div class='adore_footer_hide_button waves-effect waves-light large mdi-content-clear'></div>");
                var showFooterButton_1 = $("<img src='images/layout/showFooterIcon.png' class='adore_footer_show_button waves-effect waves-light'></img>");
                var isVertical_1 = true;
                if (this.layoutOrientation === HeaderFooterLayout.LayoutOrientation.HORIZONTAL) {
                    isVertical_1 = false;
                }
                hideFooterButton_1.css({
                    transition: "opacity 0.2s,visibility 0.2s"
                });
                showFooterButton_1.css({
                    transition: "opacity 0.2s,visibility 0.2s"
                });
                var own_1 = this;
                hideFooterButton_1.on("click", function () {
                    own_1.hideFooter(hideFooterButton_1, showFooterButton_1, isVertical_1);
                });
                showFooterButton_1.on("click", function () {
                    own_1.showFooter(hideFooterButton_1, showFooterButton_1, isVertical_1);
                });
                this.footer.$thisNode.append(hideFooterButton_1);
                this.composite.$thisNode.append(showFooterButton_1);
                this.hideFooter(hideFooterButton_1, showFooterButton_1, isVertical_1);
            }
        };
        HeaderFooterLayout.prototype.hideFooter = function (hideFooterButton, showFooterButton, isVertical) {
            hideFooterButton.css({
                visibility: "hidden",
                opacity: 0
            });
            showFooterButton.css({
                visibility: "visible",
                opacity: 1
            });
            var footerWidthOrHeight = this.footer.layoutData.height;
            if (isVertical) {
                this.footer.$thisNode.css({
                    height: 0
                });
                this.body.$thisNode.css({
                    height: this.composite.$thisNode.get(0).clientHeight - this.header.$thisNode.get(0).clientHeight + "px"
                });
            }
            else {
                this.footer.$thisNode.css({
                    width: 0
                });
                this.body.$thisNode.css({
                    width: this.composite.$thisNode.get(0).clientWidth - this.header.$thisNode.get(0).clientWidth + "px"
                });
            }
        };
        HeaderFooterLayout.prototype.showFooter = function (hideFooterButton, showFooterButton, isVertical) {
            hideFooterButton.css({
                visibility: "visible",
                opacity: 1
            });
            showFooterButton.css({
                visibility: "hidden",
                opacity: 0
            });
            var footerWidthOrHeight = this.footer.layoutData.height;
            if (isVertical) {
                this.footer.$thisNode.css({
                    height: footerWidthOrHeight + "px"
                });
                this.body.$thisNode.css({
                    height: this.composite.$thisNode.get(0).clientHeight - this.header.$thisNode.get(0).clientHeight -
                        footerWidthOrHeight + "px"
                });
            }
            else {
                this.footer.$thisNode.css({
                    width: footerWidthOrHeight + "px"
                });
                this.body.$thisNode.css({
                    width: this.composite.$thisNode.get(0).clientWidth - this.header.$thisNode.get(0).clientWidth -
                        footerWidthOrHeight + "px"
                });
            }
        };
        HeaderFooterLayout.LayoutOrientation = {
            VERTICAL: 0,
            HORIZONTAL: 1
        };
        return HeaderFooterLayout;
    }(Layout_1.Layout));
    exports.HeaderFooterLayout = HeaderFooterLayout;
});
define("layout/RowGridLayoutData", ["require", "exports"], function (require, exports) {
    "use strict";
    var RowGridLayoutData = (function () {
        function RowGridLayoutData(args) {
            this.s = args.s;
            this.m = args.m;
            this.l = args.l;
            this.os = args.os;
            this.om = args.om;
            this.ol = args.ol;
            this.row = args.row;
        }
        RowGridLayoutData.prototype.getColumn = function () {
            return "s" + this.s + " m" + this.m + " l" + this.l;
        };
        RowGridLayoutData.prototype.getOffset = function () {
            return "offset-s" + this.os + " offset-m" + this.om + " offset-l" + this.ol;
        };
        return RowGridLayoutData;
    }());
    exports.RowGridLayoutData = RowGridLayoutData;
});
define("layout/RowGridLayout", ["require", "exports", "widget/Composite", "layout/Layout", "layout/RowGridLayoutData"], function (require, exports, Composite_2, Layout_2, RowGridLayoutData_1) {
    "use strict";
    var RowGridLayout = (function (_super) {
        __extends(RowGridLayout, _super);
        function RowGridLayout(composite) {
            _super.call(this, composite);
        }
        RowGridLayout.prototype.toString = function () {
            return "RowGridLayout";
        };
        RowGridLayout.prototype.layout = function () {
            var rowCount = 0;
            for (var _i = 0, _a = this.composite.children; _i < _a.length; _i++) {
                var child = _a[_i];
                var layoutData = child.layoutData;
                if (layoutData instanceof RowGridLayoutData_1.RowGridLayoutData) {
                    if (layoutData.row > rowCount) {
                        rowCount = layoutData.row;
                    }
                }
            }
            var $curRowDivs = [];
            for (var i = 0; i <= rowCount; i++) {
                var rowDiv = $("<div class='row'></div>");
                rowDiv.css("position", "relative");
                $curRowDivs.push(rowDiv);
            }
            $curRowDivs[rowCount].css("marginBottom", "0px");
            for (var _b = 0, _c = this.composite.children; _b < _c.length; _b++) {
                var child = _c[_b];
                var layoutData = child.layoutData;
                if (layoutData instanceof RowGridLayoutData_1.RowGridLayoutData) {
                    if (child.getId().indexOf("FloatPanelComposite") !== -1) {
                        child.append();
                        continue;
                    }
                    var column = layoutData.getColumn();
                    var offset = layoutData.getOffset();
                    var row = layoutData.row;
                    var style = column + " col " + offset;
                    child.$thisNode.addClass(style);
                    if (child instanceof Composite_2.Composite) {
                        child.$thisNode.css({
                            position: "relative"
                        });
                    }
                    child.$thisNode.appendTo($curRowDivs[row]);
                }
            }
            if (this.$rowDivs) {
                for (var _d = 0, _e = this.$rowDivs; _d < _e.length; _d++) {
                    var $rowDiv = _e[_d];
                    $rowDiv.remove();
                }
            }
            this.$rowDivs = $curRowDivs;
            for (var i = 0; i <= rowCount; i++) {
                this.$rowDivs[i].appendTo(this.composite.$attachNode);
            }
        };
        return RowGridLayout;
    }(Layout_2.Layout));
    exports.RowGridLayout = RowGridLayout;
});
define("layout/FillLayout", ["require", "exports", "layout/Layout"], function (require, exports, Layout_3) {
    "use strict";
    var FillLayout = (function (_super) {
        __extends(FillLayout, _super);
        function FillLayout(composite) {
            _super.call(this, composite);
        }
        FillLayout.prototype.layout = function () {
            for (var _i = 0, _a = this.composite.children; _i < _a.length; _i++) {
                var child = _a[_i];
                child.$thisNode.css({
                    position: "absolute",
                    top: 0,
                    bottom: 0,
                    left: 0,
                    right: 0
                });
                child.append();
            }
        };
        FillLayout.prototype.toString = function () {
            return "FillLayout";
        };
        return FillLayout;
    }(Layout_3.Layout));
    exports.FillLayout = FillLayout;
});
define("widget/CollapseButton", ["require", "exports", "widget/Widget", "util/WidgetManager"], function (require, exports, Widget_2, WidgetManager_1) {
    "use strict";
    var CollapseButton = (function (_super) {
        __extends(CollapseButton, _super);
        function CollapseButton(parentId, id, style) {
            _super.call(this, parentId, id, style);
            this.$thisNode = $(CollapseButton.Template).attr("id", id);
        }
        CollapseButton.prototype.bindSideNav = function (args) {
            var sideNavComposite = WidgetManager_1.WidgetManager.byId(args.sideNavId);
            var parentComposite = sideNavComposite.parent;
            var sideNavLayout = parentComposite.layout_;
            sideNavLayout.setCollapseButton(this);
        };
        CollapseButton.Template = "<a href=\"#\" class=\"button-collapse\"><i class=\"mdi-navigation-menu\" style=\"font-size:3rem;\"></i></a>";
        return CollapseButton;
    }(Widget_2.Widget));
    exports.CollapseButton = CollapseButton;
});
define("layout/SideNav", ["require", "exports"], function (require, exports) {
    "use strict";
    var SideNav = (function () {
        function SideNav() {
            this.panning = false;
            this.menuOut = false;
        }
        SideNav.prototype.removeMenu = function (restoreNav) {
            var _this = this;
            this.panning = false;
            this.menuOut = false;
            $("body").css({
                overflow: "",
                width: ""
            });
            $("#sidenav-overlay").velocity({ opacity: 0 }, {
                duration: 200,
                queue: false, easing: "easeOutQuad",
                complete: function () {
                    $(this).remove();
                }
            });
            if (this.options.edge === "left") {
                this.$dragTarget.css({ width: "", right: "", left: "0" });
                this.$nav.velocity({ "translateX": "-100%" }, {
                    duration: 200,
                    queue: false,
                    easing: "easeOutCubic",
                    complete: function () {
                        if (restoreNav === true) {
                            _this.$nav.removeAttr("style");
                            _this.$nav.css("width", _this.options.width);
                        }
                    }
                });
            }
            else {
                this.$dragTarget.css({ width: "", right: "0", left: "" });
                this.$nav.velocity({ "translateX": "100%" }, {
                    duration: 200,
                    queue: false,
                    easing: "easeOutCubic",
                    complete: function () {
                        if (restoreNav === true) {
                            _this.$nav.removeAttr("style");
                            _this.$nav.css({
                                "position": "absolute",
                                "left": "calc(100% - " + _this.options.width + "px)",
                                "right": 0, "width": _this.options.width
                            });
                        }
                    }
                });
            }
        };
        SideNav.prototype.onPan = function (e) {
            if (e.gesture.pointerType === "touch") {
                var direction = e.gesture.direction;
                var x = e.gesture.center.x;
                var y = e.gesture.center.y;
                var velocityX = e.gesture.velocityX;
                var $body = $("body");
                var oldWidth = $body.innerWidth();
                $body.css("overflow", "hidden");
                $body.width(oldWidth);
                if ($("#sidenav-overlay").length === 0) {
                    var overlay = $("<div id=\"sidenav-overlay\"></div>");
                    overlay.css("opacity", 0).click(function () {
                        this.removeMenu(false);
                    });
                    $("body").append(overlay);
                }
                if (this.options.edge === "left") {
                    if (x > this.options.width) {
                        x = this.options.width;
                    }
                    else if (x < 0) {
                        x = 0;
                    }
                }
                if (this.options.edge === "left") {
                    if (x < (this.options.width / 2)) {
                        this.menuOut = false;
                    }
                    else if (x >= (this.options.width / 2)) {
                        this.menuOut = true;
                    }
                    this.$nav.css("transform", "translateX(" + (x - this.options.width) + "px)");
                }
                else {
                    if (x < (window.innerWidth - this.options.width / 2)) {
                        this.menuOut = true;
                    }
                    else if (x >= (window.innerWidth - this.options.width / 2)) {
                        this.menuOut = false;
                    }
                    var rightPos = (x - this.options.width / 2);
                    if (rightPos < 0) {
                        rightPos = 0;
                    }
                    this.$nav.css("transform", "translateX(" + rightPos + "px)");
                }
                var overlayPerc = void 0;
                if (this.options.edge === "left") {
                    overlayPerc = x / this.options.width;
                    $("#sidenav-overlay").velocity({ opacity: overlayPerc }, { duration: 10, queue: false, easing: "easeOutQuad" });
                }
                else {
                    overlayPerc = Math.abs((x - window.innerWidth) / this.options.width);
                    $("#sidenav-overlay").velocity({ opacity: overlayPerc }, { duration: 10, queue: false, easing: "easeOutQuad" });
                }
            }
        };
        SideNav.prototype.onPanend = function (e) {
            if (e.gesture.pointerType === "touch") {
                var velocityX = e.gesture.velocityX;
                var x = e.gesture.center.x;
                var leftPos = x - this.options.width;
                var rightPos = x - this.options.width / 2;
                if (leftPos > 0) {
                    leftPos = 0;
                }
                if (rightPos < 0) {
                    rightPos = 0;
                }
                this.panning = false;
                if (this.options.edge === "left") {
                    if ((this.menuOut && velocityX <= 0.3) || velocityX < -0.5) {
                        if (leftPos !== 0) {
                            this.$nav.velocity({ "translateX": [0, leftPos] }, { duration: 300, queue: false, easing: "easeOutQuad" });
                        }
                        $("#sidenav-overlay").velocity({ opacity: 1 }, { duration: 50, queue: false, easing: "easeOutQuad" });
                        this.$dragTarget.css({ width: "50%", right: 0, left: "" });
                    }
                    else if (!this.menuOut || velocityX > 0.3) {
                        $("body").css({
                            overflow: "",
                            width: ""
                        });
                        this.$nav.velocity({ "translateX": [-1 * this.options.width - 10, leftPos] }, { duration: 200, queue: false, easing: "easeOutQuad" });
                        $("#sidenav-overlay").velocity({ opacity: 0 }, {
                            duration: 200, queue: false, easing: "easeOutQuad",
                            complete: function () {
                                $(this).remove();
                            }
                        });
                        this.$dragTarget.css({ width: "10px", right: "", left: 0 });
                    }
                }
                else {
                    if ((this.menuOut && velocityX >= -0.3) || velocityX > 0.5) {
                        this.$nav.velocity({ "translateX": [0, rightPos] }, { duration: 300, queue: false, easing: "easeOutQuad" });
                        $("#sidenav-overlay").velocity({ opacity: 1 }, { duration: 50, queue: false, easing: "easeOutQuad" });
                        this.$dragTarget.css({ width: "50%", right: "", left: 0 });
                    }
                    else if (!this.menuOut || velocityX < -0.3) {
                        $("body").css({
                            overflow: "",
                            width: ""
                        });
                        this.$nav.velocity({ "translateX": [this.options.width + 10, rightPos] }, { duration: 200, queue: false, easing: "easeOutQuad" });
                        $("#sidenav-overlay").velocity({ opacity: 0 }, {
                            duration: 200, queue: false, easing: "easeOutQuad",
                            complete: function () {
                                $(this).remove();
                            }
                        });
                        this.$dragTarget.css({ width: "10px", right: 0, left: "" });
                    }
                }
            }
        };
        SideNav.prototype.onResize = function (e) {
            if (window.innerWidth > 992) {
                if ($("#sidenav-overlay").length !== 0 && this.menuOut) {
                    this.removeMenu(true);
                }
                else {
                    this.$nav.css("transform", "translateX(0%)");
                }
            }
            else if (this.menuOut === false) {
                if (this.options.edge === "left") {
                    this.$nav.css("transform", "translateX(-100%)");
                }
                else {
                    this.$nav.css("transform", "translateX(100%)");
                }
            }
            this.refreshCollapseButton();
        };
        SideNav.prototype.init = function (nav_id, options) {
            var _this = this;
            var defaults = {
                width: 240,
                edge: "left",
                closeOnClick: false
            };
            this.options = $.extend(defaults, options);
            this.$nav = $("#" + nav_id);
            this.$dragTarget = $("<div class=\"drag-target\"></div>");
            $("body").append(this.$dragTarget);
            if (options.edge === "left") {
                this.$nav.css("transform", "translateX(-100%)");
                this.$dragTarget.css({ "left": 0 });
            }
            else {
                this.$nav.css({
                    "transform": "translateX(100%)", "position": "absolute",
                    "left": "calc(100% - " + this.options.width + "px)",
                    "right": 0
                });
                this.$dragTarget.css({ "right": 0 });
            }
            if (this.$nav.hasClass("fixed")) {
                if (window.innerWidth > 992) {
                    this.$nav.css("transform", "translateX(0)");
                }
            }
            this.refreshCollapseButton();
            if (this.$nav.hasClass("fixed")) {
                this.onResizeListener = function (e) { return _this.onResize(e); };
                $(window).on("resize", this.onResizeListener);
            }
            if (options.closeOnClick === true) {
                this.$nav.on("click.itemclick", "a:not(.collapsible-header)", function () { return _this.removeMenu(false); });
            }
            this.$dragTarget.on("click", function () { return _this.removeMenu(false); });
            this.$dragTarget.hammer({
                prevent_default: false
            }).bind("pan", function (e) { return _this.onPan(e); }).bind("panend", function (e) { return _this.onPanend(e); });
        };
        SideNav.prototype.show = function () {
            var _this = this;
            if (this.menuOut === true) {
                this.menuOut = false;
                this.panning = false;
                this.removeMenu(false);
            }
            else {
                var $body = $("body");
                var oldWidth = $body.innerWidth();
                $body.css("overflow", "hidden");
                $body.width(oldWidth);
                $("body").append(this.$dragTarget);
                if (this.options.edge === "left") {
                    this.$dragTarget.css({ width: "50%", right: 0, left: "" });
                    this.$nav.velocity({ "translateX": [0, -1 * this.options.width] }, { duration: 300, queue: false, easing: "easeOutQuad" });
                }
                else {
                    this.$dragTarget.css({ width: "50%", right: "", left: 0 });
                    this.$nav.velocity({ "translateX": [0, this.options.width] }, { duration: 300, queue: false, easing: "easeOutQuad" });
                }
                var overlay_1 = $("<div id=\"sidenav-overlay\"></div>");
                overlay_1.css("opacity", 0);
                overlay_1.click(function () {
                    _this.menuOut = false;
                    _this.panning = false;
                    _this.removeMenu(false);
                    overlay_1.velocity({ opacity: 0 }, {
                        duration: 300, queue: false, easing: "easeOutQuad",
                        complete: function () {
                            overlay_1.remove();
                            overlay_1 = null;
                        }
                    });
                });
                $("body").append(overlay_1);
                overlay_1.velocity({ opacity: 1 }, {
                    duration: 300, queue: false, easing: "easeOutQuad",
                    complete: function () {
                        _this.menuOut = true;
                        _this.panning = false;
                    }
                });
            }
        };
        SideNav.prototype.hide = function () {
            $("#sidenav-overlay").trigger("click");
        };
        SideNav.prototype.bind = function ($button) {
            var _this = this;
            this.$button = $button;
            this.$button.click(function () {
                _this.show();
                return false;
            });
            this.refreshCollapseButton();
        };
        SideNav.prototype.refreshCollapseButton = function () {
            if (this.$button) {
                if (window.innerWidth > 992) {
                    this.$button.css({ "visibility": "hidden", "opacity": "0" });
                }
                else {
                    this.$button.css({ "visibility": "visible", "opacity": "1" });
                }
            }
        };
        SideNav.prototype.dispose = function () {
            if (this.onResizeListener) {
                $(window).off("resize", this.onResizeListener);
            }
            if (this.$dragTarget) {
                this.$dragTarget.remove();
                if (this.$dragTarget.data("hammer")) {
                    this.$dragTarget.data("hammer").destroy();
                }
            }
            $("#sidenav-overlay").remove();
        };
        return SideNav;
    }());
    exports.SideNav = SideNav;
});
define("layout/SideNavLayoutData", ["require", "exports"], function (require, exports) {
    "use strict";
    var SideNavLayoutData = (function () {
        function SideNavLayoutData(args) {
            this.direction = args.direction;
            this.width = args.width;
            this.collapseButtonId = args.collapseButtonId;
        }
        SideNavLayoutData.NONE = 0;
        SideNavLayoutData.LEFT = 1;
        SideNavLayoutData.RIGHT = 2;
        return SideNavLayoutData;
    }());
    exports.SideNavLayoutData = SideNavLayoutData;
});
define("layout/SideNavLayout", ["require", "exports", "layout/Layout", "layout/SideNav", "layout/SideNavLayoutData"], function (require, exports, Layout_4, SideNav_1, SideNavLayoutData_1) {
    "use strict";
    var SideNavLayout = (function (_super) {
        __extends(SideNavLayout, _super);
        function SideNavLayout(composite) {
            _super.call(this, composite);
            this.hadBindedCollapse = false;
        }
        SideNavLayout.prototype.setCollapseButton = function (collapseButton) {
            this.collapseButton = collapseButton;
            this.bindCollapseButton();
        };
        SideNavLayout.prototype.bindCollapseButton = function () {
            if (!this.hadBindedCollapse && this.sideNav && this.collapseButton) {
                this.sideNav.bind(this.collapseButton.$thisNode);
                this.hadBindedCollapse = true;
            }
        };
        SideNavLayout.prototype.layout = function () {
            var navChild = null;
            var contentChild = null;
            var navLayoutData = null;
            for (var _i = 0, _a = this.composite.children; _i < _a.length; _i++) {
                var child = _a[_i];
                var direction = child.layoutData.direction;
                if (!navChild && direction !== SideNavLayoutData_1.SideNavLayoutData.NONE) {
                    navChild = child;
                    navLayoutData = child.layoutData;
                }
                else if (!contentChild && direction === SideNavLayoutData_1.SideNavLayoutData.NONE) {
                    contentChild = child;
                }
            }
            contentChild.$thisNode.css({
                position: "absolute",
                left: 0,
                right: 0,
                top: 0,
                bottom: 0
            });
            this.$nav = $("<div class=\"side-nav fixed\" id=\"slide-out\"></div>");
            this.$nav.css("width", navLayoutData.width);
            this.$content = $("<div></div>");
            this.$content.css({
                position: "absolute",
                left: 0,
                right: 0,
                top: 0,
                bottom: 0
            });
            navChild.$thisNode.appendTo(this.$nav);
            contentChild.$thisNode.appendTo(this.$content);
            this.$nav.appendTo(this.composite.$attachNode);
            this.$content.appendTo(this.composite.$attachNode);
            this.sideNav = new SideNav_1.SideNav();
            this.bindCollapseButton();
            this.sideNav.init("slide-out", {
                width: navLayoutData.width,
                edge: navLayoutData.direction === SideNavLayoutData_1.SideNavLayoutData.LEFT ? "left" : "right"
            });
            this.mediaQueryList = window.matchMedia("only screen and (max-width : 992px)");
            var own = this;
            this.mediaQueryListener = function (mql) {
                if (mql.matches) {
                    if (navLayoutData.direction === SideNavLayoutData_1.SideNavLayoutData.LEFT) {
                        own.$content.css("left", 0);
                    }
                    else {
                        own.$content.css("right", 0);
                    }
                }
                else {
                    if (navLayoutData.direction === SideNavLayoutData_1.SideNavLayoutData.LEFT) {
                        own.$content.css("left", navLayoutData.width + "px");
                    }
                    else {
                        own.$content.css("right", navLayoutData.width + "px");
                    }
                }
            };
            this.mediaQueryList.addListener(this.mediaQueryListener);
            this.mediaQueryListener(this.mediaQueryList);
        };
        SideNavLayout.prototype.toString = function () {
            return "SideNavLayout";
        };
        SideNavLayout.prototype.dispose = function () {
            if (this.mediaQueryList && this.mediaQueryListener) {
                this.mediaQueryList.removeListener(this.mediaQueryListener);
            }
            if (this.sideNav) {
                this.sideNav.dispose();
            }
            if (this.$nav) {
                this.$nav.remove();
            }
            if (this.$content) {
                this.$content.remove();
            }
        };
        return SideNavLayout;
    }(Layout_4.Layout));
    exports.SideNavLayout = SideNavLayout;
});
define("widget/Composite", ["require", "exports", "widget/Widget", "layout/HeaderFooterLayout", "layout/RowGridLayout", "layout/FillLayout", "layout/SideNavLayout", "ADORE"], function (require, exports, Widget_3, HeaderFooterLayout_1, RowGridLayout_1, FillLayout_1, SideNavLayout_1, ADORE_1) {
    "use strict";
    var Composite = (function (_super) {
        __extends(Composite, _super);
        function Composite(parentId, id, style) {
            _super.call(this, parentId, id, style);
            this.children = new Array();
            this.$thisNode = $("<div>").attr("id", this.id);
            this.$attachNode = this.$thisNode;
            if ((this.style & ADORE_1.ADORE.Control) === ADORE_1.ADORE.Control)
                this.$thisNode.css({
                    position: "absolute",
                    top: "48px",
                    bottom: "0px",
                    overflow: "hidden",
                    right: "0",
                    left: "0"
                });
            if ((this.style & ADORE_1.ADORE.CardPanel) === ADORE_1.ADORE.CardPanel) {
                this.$thisNode.addClass("card-panel");
            }
            if ((this.style & ADORE_1.ADORE.Scrollable) === ADORE_1.ADORE.Scrollable) {
                this.$thisNode.css("overflow", "auto");
            }
        }
        Composite.prototype.setFocus = function () {
        };
        Composite.prototype.setLayout = function (args) {
            if (this.layout_) {
                return;
            }
            var layout = args.layout;
            var type = layout.type;
            if (type === "RowGridLayout") {
                this.layout_ = new RowGridLayout_1.RowGridLayout(this);
            }
            else if (type === "HeaderFooterLayout") {
                this.layout_ = new HeaderFooterLayout_1.HeaderFooterLayout(this, layout.layoutOrientation, layout.hiddenFooter);
            }
            else if (type === "FillLayout") {
                this.layout_ = new FillLayout_1.FillLayout(this);
            }
            else if (type === "SideNavLayout") {
                this.layout_ = new SideNavLayout_1.SideNavLayout(this);
            }
        };
        Composite.prototype.layout = function () {
            this.doLayout();
            if (this.content) {
                this.setContentView({ content: this.content, script: this.script });
            }
        };
        Composite.prototype.doLayout = function () {
            if (!this.parent) {
                if (this.id.indexOf("Composite") !== -1) {
                    this.$thisNode.css({
                        "height": "100vh",
                        "width": "100vw"
                    });
                }
                this.$thisNode.appendTo(document.body);
            }
            if (!this.layout_) {
                return;
            }
            this.layout_.layout();
            for (var _i = 0, _a = this.children; _i < _a.length; _i++) {
                var child = _a[_i];
                child.postLayout();
            }
        };
        Composite.prototype.setBackgroundImage = function (args) {
            this.backgroundImage = args.src;
            this.$thisNode.find("#" + this.id + "_img").remove();
            $("<img>").addClass("adore_background_image").attr({
                src: this.backgroundImage,
                id: this.id + "_img"
            }).prependTo(this.$thisNode);
            if (this.imageZIndex === 0 || this.imageZIndex) {
                this.setBackgroundImageZIndex({ "imageZIndex": this.imageZIndex });
            }
        };
        Composite.prototype.setBackgroundImageZIndex = function (args) {
            this.imageZIndex = args.imageZIndex;
            this.$thisNode.find("#" + this.id + "_img").css("z-index", this.imageZIndex);
        };
        Composite.prototype.setImageInDiv = function (args) {
            this.divImage = args.divImageSrc;
            if (this.$thisNode) {
                this.$thisNode.css("background-image", "url(" + this.divImage + ")");
                this.$thisNode.css("background-repeat", "round");
            }
        };
        Composite.prototype.setContentView = function (args) {
            var _this = this;
            this.content = args.content;
            this.script = args.script;
            if (this.$attachNode) {
                if (this.script && this.script.trim()) {
                    var scriptArr = this.script.trim().split("\n");
                    require(scriptArr, function () {
                        _this.$attachNode.html(args.content);
                    });
                }
                else {
                    this.$attachNode.html(args.content);
                }
            }
        };
        Composite.prototype.addChild = function (child) {
            this.children.push(child);
        };
        Composite.prototype.dispose = function () {
            if (this.layout_) {
                this.layout_.dispose();
            }
            _super.prototype.dispose.call(this);
        };
        Composite.prototype.handleMouseDownEvent = function (e) {
        };
        Composite.prototype.handleMouseUpEvent = function (e) {
        };
        return Composite;
    }(Widget_3.Widget));
    exports.Composite = Composite;
});
define("hotkey/KeystrokeGenerator", ["require", "exports", "hotkey/Keys"], function (require, exports, Keys_2) {
    "use strict";
    var KeystrokeGenerator = (function () {
        function KeystrokeGenerator() {
        }
        KeystrokeGenerator.generateKeyStroke = function (e) {
            var stroke = "";
            var ctrlKey = e.ctrlKey;
            stroke = ctrlKey ? stroke + "CTRL+" : stroke;
            var shiftKey = e.shiftKey;
            stroke = shiftKey ? stroke + "SHIFT+" : stroke;
            var altKey = e.altKey;
            stroke = altKey ? stroke + "ALT+" : stroke;
            switch (e.keyCode) {
                case Keys_2.Keys.BACKSPACE:
                    stroke = stroke + "BS";
                    break;
                case Keys_2.Keys.TAB:
                    stroke = stroke + "TAB";
                    break;
                case Keys_2.Keys.CLEAR:
                    stroke = stroke + "CLEAR";
                    break;
                case Keys_2.Keys.ENTER:
                    stroke = stroke + "CR";
                    break;
                case Keys_2.Keys.CAPS_LOCK:
                    stroke = stroke + "CAPS";
                    break;
                case Keys_2.Keys.ESCAPE:
                    stroke = stroke + "ESC";
                    break;
                case Keys_2.Keys.SPACE:
                    stroke = stroke + "SPACE";
                    break;
                case Keys_2.Keys.PAGE_UP:
                    stroke = stroke + "PAGE_UP";
                    break;
                case Keys_2.Keys.PAGE_DOWN:
                    stroke = stroke + "PAGE_DOWN";
                    break;
                case Keys_2.Keys.END:
                    stroke = stroke + "END";
                    break;
                case Keys_2.Keys.HOME:
                    stroke = stroke + "HOME";
                    break;
                case Keys_2.Keys.LEFT_ARROW:
                    stroke = stroke + "ARROW_LEFT";
                    break;
                case Keys_2.Keys.UP_ARROW:
                    stroke = stroke + "ARROW_UP";
                    break;
                case Keys_2.Keys.RIGHT_ARROW:
                    stroke = stroke + "ARROW_RIGHT";
                    break;
                case Keys_2.Keys.DOWN_ARROW:
                    stroke = stroke + "ARROW_DOWN";
                    break;
                case Keys_2.Keys.INSERT:
                    stroke = stroke + "INS";
                    break;
                case Keys_2.Keys.DELETE:
                    stroke = stroke + "DEL";
                    break;
                case Keys_2.Keys.HELP:
                    stroke = stroke + "HELP";
                    break;
                case Keys_2.Keys.LEFT_WINDOW:
                    stroke = stroke + "LEFT_WINDOW";
                    break;
                case Keys_2.Keys.RIGHT_WINDOW:
                    stroke = stroke + "RIGHT_WINDOW";
                    break;
                case Keys_2.Keys.SELECT:
                    stroke = stroke + "SELECT";
                    break;
                case Keys_2.Keys.NUMPAD_0:
                    stroke = stroke + "NUMPAD_0";
                    break;
                case Keys_2.Keys.NUMPAD_1:
                    stroke = stroke + "NUMPAD_1";
                    break;
                case Keys_2.Keys.NUMPAD_2:
                    stroke = stroke + "NUMPAD_2";
                    break;
                case Keys_2.Keys.NUMPAD_3:
                    stroke = stroke + "NUMPAD_3";
                    break;
                case Keys_2.Keys.NUMPAD_4:
                    stroke = stroke + "NUMPAD_4";
                    break;
                case Keys_2.Keys.NUMPAD_5:
                    stroke = stroke + "NUMPAD_5";
                    break;
                case Keys_2.Keys.NUMPAD_6:
                    stroke = stroke + "NUMPAD_6";
                    break;
                case Keys_2.Keys.NUMPAD_7:
                    stroke = stroke + "NUMPAD_7";
                    break;
                case Keys_2.Keys.NUMPAD_8:
                    stroke = stroke + "NUMPAD_8";
                    break;
                case Keys_2.Keys.NUMPAD_9:
                    stroke = stroke + "NUMPAD_9";
                    break;
                case Keys_2.Keys.NUMPAD_MULTIPLY:
                    stroke = stroke + "NUMPAD_MULTIPLY";
                    break;
                case Keys_2.Keys.NUMPAD_PLUS:
                    stroke = stroke + "NUMPAD_PLUS";
                    break;
                case Keys_2.Keys.NUMPAD_ENTER:
                    stroke = stroke + "CR";
                    break;
                case Keys_2.Keys.NUMPAD_MINUS:
                    stroke = stroke + "NUMPAD_MINUS";
                    break;
                case Keys_2.Keys.NUMPAD_PERIOD:
                    stroke = stroke + "NUMPAD_PERIOD";
                    break;
                case Keys_2.Keys.NUMPAD_DIVIDE:
                    stroke = stroke + "NUMPAD_DIVIDE";
                    break;
                case Keys_2.Keys.F1:
                    stroke = stroke + "F1";
                    break;
                case Keys_2.Keys.F2:
                    stroke = stroke + "F2";
                    break;
                case Keys_2.Keys.F3:
                    stroke = stroke + "F3";
                    break;
                case Keys_2.Keys.F4:
                    stroke = stroke + "F4";
                    break;
                case Keys_2.Keys.F5:
                    stroke = stroke + "F5";
                    break;
                case Keys_2.Keys.F6:
                    stroke = stroke + "F6";
                    break;
                case Keys_2.Keys.F7:
                    stroke = stroke + "F7";
                    break;
                case Keys_2.Keys.F8:
                    stroke = stroke + "F8";
                    break;
                case Keys_2.Keys.F9:
                    stroke = stroke + "F9";
                    break;
                case Keys_2.Keys.F10:
                    stroke = stroke + "F10";
                    break;
                case Keys_2.Keys.F11:
                    stroke = stroke + "F11";
                    break;
                case Keys_2.Keys.F12:
                    stroke = stroke + "F12";
                    break;
                case Keys_2.Keys.F13:
                    stroke = stroke + "F13";
                    break;
                case Keys_2.Keys.F14:
                    stroke = stroke + "F14";
                    break;
                case Keys_2.Keys.F15:
                    stroke = stroke + "F15";
                    break;
                case Keys_2.Keys.NUM_LOCK:
                    stroke = stroke + "NUM_LOCK";
                    break;
                case Keys_2.Keys.SCROLL_LOCK:
                    stroke = stroke + "SCROLL_LOCK";
                    break;
                case Keys_2.Keys.UP_DPAD:
                    stroke = stroke + "UP_DPAD";
                    break;
                case Keys_2.Keys.DOWN_DPAD:
                    stroke = stroke + "DOWN_DPAD";
                    break;
                case Keys_2.Keys.LEFT_DPAD:
                    stroke = stroke + "LEFT_DPAD";
                    break;
                case Keys_2.Keys.RIGHT_DPAD:
                    stroke = stroke + "RIGHT_DPAD";
                    break;
                case Keys_2.Keys.NUM_0:
                    stroke = stroke + "0";
                    break;
                case Keys_2.Keys.NUM_1:
                    stroke = stroke + "1";
                    break;
                case Keys_2.Keys.NUM_2:
                    stroke = stroke + "2";
                    break;
                case Keys_2.Keys.NUM_3:
                    stroke = stroke + "3";
                    break;
                case Keys_2.Keys.NUM_4:
                    stroke = stroke + "4";
                    break;
                case Keys_2.Keys.NUM_5:
                    stroke = stroke + "5";
                    break;
                case Keys_2.Keys.NUM_6:
                    stroke = stroke + "6";
                    break;
                case Keys_2.Keys.NUM_7:
                    stroke = stroke + "7";
                    break;
                case Keys_2.Keys.NUM_8:
                    stroke = stroke + "8";
                    break;
                case Keys_2.Keys.NUM_9:
                    stroke = stroke + "9";
                    break;
                case Keys_2.Keys.CHAR_A:
                    stroke = stroke + "A";
                    break;
                case Keys_2.Keys.CHAR_B:
                    stroke = stroke + "B";
                    break;
                case Keys_2.Keys.CHAR_C:
                    stroke = stroke + "C";
                    break;
                case Keys_2.Keys.CHAR_D:
                    stroke = stroke + "D";
                    break;
                case Keys_2.Keys.CHAR_E:
                    stroke = stroke + "E";
                    break;
                case Keys_2.Keys.CHAR_F:
                    stroke = stroke + "F";
                    break;
                case Keys_2.Keys.CHAR_G:
                    stroke = stroke + "G";
                    break;
                case Keys_2.Keys.CHAR_H:
                    stroke = stroke + "H";
                    break;
                case Keys_2.Keys.CHAR_I:
                    stroke = stroke + "I";
                    break;
                case Keys_2.Keys.CHAR_J:
                    stroke = stroke + "J";
                    break;
                case Keys_2.Keys.CHAR_K:
                    stroke = stroke + "K";
                    break;
                case Keys_2.Keys.CHAR_L:
                    stroke = stroke + "L";
                    break;
                case Keys_2.Keys.CHAR_M:
                    stroke = stroke + "M";
                    break;
                case Keys_2.Keys.CHAR_N:
                    stroke = stroke + "N";
                    break;
                case Keys_2.Keys.CHAR_O:
                    stroke = stroke + "O";
                    break;
                case Keys_2.Keys.CHAR_P:
                    stroke = stroke + "P";
                    break;
                case Keys_2.Keys.CHAR_Q:
                    stroke = stroke + "Q";
                    break;
                case Keys_2.Keys.CHAR_R:
                    stroke = stroke + "R";
                    break;
                case Keys_2.Keys.CHAR_S:
                    stroke = stroke + "S";
                    break;
                case Keys_2.Keys.CHAR_T:
                    stroke = stroke + "T";
                    break;
                case Keys_2.Keys.CHAR_U:
                    stroke = stroke + "U";
                    break;
                case Keys_2.Keys.CHAR_V:
                    stroke = stroke + "V";
                    break;
                case Keys_2.Keys.CHAR_W:
                    stroke = stroke + "W";
                    break;
                case Keys_2.Keys.CHAR_X:
                    stroke = stroke + "X";
                    break;
                case Keys_2.Keys.CHAR_Y:
                    stroke = stroke + "Y";
                    break;
                case Keys_2.Keys.CHAR_Z:
                    stroke = stroke + "Z";
                    break;
                case Keys_2.Keys.SLASH:
                    stroke = stroke + "/";
                    break;
                default:
            }
            return stroke;
        };
        return KeystrokeGenerator;
    }());
    exports.KeystrokeGenerator = KeystrokeGenerator;
});
define("widget/Widget", ["require", "exports", "util/WidgetManager", "event/EventHub", "event/MessageType", "event/Event", "hotkey/Keys", "hotkey/KeystrokeGenerator", "layout/HeaderFooterLayoutData", "layout/RowGridLayoutData", "layout/SideNavLayoutData"], function (require, exports, WidgetManager_2, EventHub_2, MessageType_3, Event_2, Keys_3, KeystrokeGenerator_1, HeaderFooterLayoutData_2, RowGridLayoutData_2, SideNavLayoutData_2) {
    "use strict";
    var Widget = (function () {
        function Widget(parentId, id, style) {
            this.cssStyle = {};
            this.enabled = true;
            this.visible = true;
            this.id = id;
            this.style = style;
            WidgetManager_2.WidgetManager.register(this);
            if (parentId) {
                this.parent = parentId ? WidgetManager_2.WidgetManager.byId(parentId) : null;
                this.parent.addChild(this);
            }
        }
        Widget.prototype.getId = function () {
            return this.id;
        };
        Widget.prototype.sendFocusGain = function () {
            if (this.enabled) {
                EventHub_2.EventHub.dispatchEvent(MessageType_3.MessageType.WIDGET, { id: this.id, evtType: Event_2.Event.ON_FOCUS });
            }
        };
        Widget.prototype.append = function () {
            if (this.parent) {
                this.$thisNode.appendTo(this.parent.$attachNode);
            }
            else {
                this.$thisNode.appendTo(document.body);
            }
        };
        Widget.prototype.handleMouseDownEvent = function (e) {
            EventHub_2.EventHub.dispatchEvent(MessageType_3.MessageType.WIDGET, {
                id: this.id,
                evtType: Event_2.Event.MOUSE_DOWN,
                button: e.button
            });
        };
        Widget.prototype.handleMouseUpEvent = function (e) {
            EventHub_2.EventHub.dispatchEvent(MessageType_3.MessageType.WIDGET, {
                id: this.id,
                evtType: Event_2.Event.MOUSE_UP,
                button: e.button
            });
        };
        Widget.prototype.handleKeyDownEvent = function (e, hasFilter) {
            var filter = false;
            var keyStroke = KeystrokeGenerator_1.KeystrokeGenerator.generateKeyStroke(e);
            var keyEventObj = {
                id: this.id,
                evtType: Event_2.Event.KEY_DONW,
                altKey: e.altKey,
                shiftKey: e.shiftKey,
                ctrlKey: e.ctrlKey,
                keyCode: e.keyCode,
                keyStroke: keyStroke
            };
            if (e.keyCode === Keys_3.Keys.TAB) {
                e.preventDefault();
            }
            if (hasFilter) {
                filter = EventHub_2.EventHub.dispatchEvent(MessageType_3.MessageType.DISPLAY_FILTER, keyEventObj);
            }
            if (!filter) {
                EventHub_2.EventHub.dispatchEvent(MessageType_3.MessageType.WIDGET, keyEventObj);
            }
            else {
                e.preventDefault();
                e.stopPropagation();
            }
        };
        Widget.prototype.handleKeyUpEvent = function (e) {
            var keyStroke = KeystrokeGenerator_1.KeystrokeGenerator.generateKeyStroke(e);
            var keyEventObj = {
                id: this.id,
                evtType: Event_2.Event.KEY_UP,
                altKey: e.altKey,
                shiftKey: e.shiftKey,
                ctrlKey: e.ctrlKey,
                keyCode: e.keyCode,
                keyStroke: keyStroke
            };
            EventHub_2.EventHub.dispatchEvent(MessageType_3.MessageType.WIDGET, keyEventObj);
        };
        Widget.prototype.setEnabled = function (args) {
            this.enabled = args.enabled;
            if (this.enabled) {
                this.$thisNode.removeAttr("disabled");
            }
            else {
                this.$thisNode.attr("disabled", "disabled");
            }
        };
        Widget.prototype.isEnabled = function () {
            return this.enabled;
        };
        Widget.prototype.setVisible = function (args) {
            this.visible = args.visible;
            if (this.visible) {
                this.css({ cssStyle: { "display": "block" } });
            }
            else {
                this.css({ cssStyle: { "display": "none" } });
            }
        };
        Widget.prototype.isVisible = function () {
            return this.visible;
        };
        Widget.prototype.dispose = function () {
            WidgetManager_2.WidgetManager.unregister(this.id);
            this.$thisNode.remove();
            if (this.parent) {
                var index = this.parent.children.indexOf(this);
                this.parent.children.splice(index, 1);
            }
        };
        Widget.prototype.setFocus = function () {
        };
        ;
        Widget.prototype.setLayoutData = function (args) {
            var layout = this.parent ? this.parent.layout_ : undefined;
            if (layout) {
                var layoutData = args.layoutData;
                var layoutType = layout.toString();
                if (layoutType === "HeaderFooterLayout") {
                    this.layoutData = new HeaderFooterLayoutData_2.HeaderFooterLayoutData(layoutData);
                }
                else if (layoutType === "RowGridLayout") {
                    this.layoutData = new RowGridLayoutData_2.RowGridLayoutData(layoutData);
                }
                else if (layoutType === "SideNavLayout") {
                    this.layoutData = new SideNavLayoutData_2.SideNavLayoutData(layoutData);
                }
            }
        };
        Widget.prototype.setBackgroundColor = function (attrs) {
        };
        Widget.prototype.css = function (args) {
            if (this.$thisNode) {
                this.$thisNode.css(args.cssStyle);
            }
            else {
                this.cssStyle = $.extend(this.cssStyle, args.cssStyle);
            }
        };
        Widget.prototype.toString = function () {
            return "Widget";
        };
        Widget.prototype.postLayout = function () {
            if (this.cssStyle) {
                this.$thisNode.css(this.cssStyle);
                this.cssStyle = null;
            }
        };
        Widget.prototype.initEvents = function (args) {
            var _this = this;
            setTimeout(function () {
                if (!_this.$thisNode) {
                    _this.$thisNode = $("#" + _this.id);
                }
                for (var i = 0; i < args.events.length; i++) {
                    switch (args.events[i]) {
                        case Event_2.Event.CLICK:
                            _this.$thisNode.on("click", function (e) {
                                EventHub_2.EventHub.dispatchEvent(MessageType_3.MessageType.WIDGET, { id: _this.id, evtType: Event_2.Event.CLICK });
                            });
                            break;
                        case Event_2.Event.MODIFY:
                            _this.$thisNode.on("input", function (e) {
                                EventHub_2.EventHub.dispatchEvent(MessageType_3.MessageType.WIDGET, {
                                    id: _this.id,
                                    text: $(_this).val(),
                                    evtType: Event_2.Event.MODIFY
                                });
                            });
                            break;
                        case Event_2.Event.ON_CHANGE:
                            break;
                    }
                }
            }, 800);
        };
        return Widget;
    }());
    exports.Widget = Widget;
});
define("util/WidgetManager", ["require", "exports", "util/Map"], function (require, exports, Map_1) {
    "use strict";
    var WidgetManager = (function () {
        function WidgetManager() {
        }
        WidgetManager.register = function (widget) {
            this.map.put(widget.getId(), widget);
        };
        WidgetManager.unregister = function (id) {
            this.map.remove(id);
        };
        WidgetManager.byId = function (id) {
            var widget = this.map.getValue(id);
            return widget;
        };
        WidgetManager.size = function () {
            return this.map.size();
        };
        WidgetManager.map = new Map_1.Map();
        return WidgetManager;
    }());
    exports.WidgetManager = WidgetManager;
});
define("util/WidgetUtil", ["require", "exports", "util/WidgetManager"], function (require, exports, WidgetManager_3) {
    "use strict";
    var WidgetUtil = (function () {
        function WidgetUtil() {
        }
        WidgetUtil.refreshDialogZIndex = function (htmlElement) {
            var thisZIndex = parseInt(htmlElement.style.zIndex);
            var maxZIndex = -1;
            var dialogNodes = $("div.adore_dialog");
            var i, tempZIndex;
            for (i = 0; i < dialogNodes.length; i++) {
                if (dialogNodes[i].id === htmlElement.id) {
                    continue;
                }
                tempZIndex = parseInt(dialogNodes[i].style.zIndex);
                maxZIndex = tempZIndex > maxZIndex ? tempZIndex : maxZIndex;
            }
            var adoreShellNodes = $("div.adore_shell");
            for (i = 0; i < adoreShellNodes.length; i++) {
                if (adoreShellNodes[i].id === htmlElement.id) {
                    continue;
                }
                tempZIndex = parseInt(adoreShellNodes[i].style.zIndex);
                maxZIndex = tempZIndex > maxZIndex ? tempZIndex : maxZIndex;
            }
            if (maxZIndex >= thisZIndex) {
                $(htmlElement).css("z-index", maxZIndex + 1);
            }
        };
        WidgetUtil.findWidgetByTarget = function (target) {
            if (!target) {
                return null;
            }
            var widget = WidgetManager_3.WidgetManager.byId(target.id);
            if (widget) {
                return widget;
            }
            else {
                return WidgetUtil.findWidgetByTarget(target.parentNode);
            }
        };
        WidgetUtil.elementExists = function (id) {
            if (id) {
                var $node = $("#" + id);
                if ($node.length !== 0) {
                    return true;
                }
            }
            return false;
        };
        return WidgetUtil;
    }());
    exports.WidgetUtil = WidgetUtil;
});
define("event/DocumentEventInterceptor", ["require", "exports", "event/EventHub", "event/Event", "event/MessageType", "util/WidgetUtil"], function (require, exports, EventHub_3, Event_3, MessageType_4, WidgetUtil_2) {
    "use strict";
    var DocumentEventInterceptor = (function () {
        function DocumentEventInterceptor() {
        }
        DocumentEventInterceptor.addFilter = function (eventType) {
            this.eventTypeMap.push(eventType);
        };
        DocumentEventInterceptor.addDisplayEvent = function (eventType) {
            if (this.displayEvents.indexOf(eventType) === -1) {
                this.displayEvents.push(eventType);
            }
        };
        DocumentEventInterceptor.removeDisplayEvent = function (eventType) {
            for (var i = 0; i < this.displayEvents.length; i++) {
                if (eventType === this.displayEvents[i]) {
                    this.displayEvents.splice(i, 1);
                }
            }
        };
        DocumentEventInterceptor.sendDisplayEvent = function (eventType) {
            if (this.displayEvents.indexOf(eventType) !== -1) {
                EventHub_3.EventHub.dispatchEvent(MessageType_4.MessageType.DISPLAY, { evtType: eventType });
            }
        };
        DocumentEventInterceptor.initInterceptor = function () {
            var _this = this;
            $(document).on("keydown", function (e) {
                var widget = WidgetUtil_2.WidgetUtil.findWidgetByTarget(e.target);
                if (widget && widget.isEnabled()) {
                    if (_this.eventTypeMap.indexOf(Event_3.Event.KEY_DONW) !== -1) {
                        widget.handleKeyDownEvent(e, true);
                    }
                    else {
                        widget.handleKeyDownEvent(e, false);
                    }
                }
                DocumentEventInterceptor.sendDisplayEvent(Event_3.Event.KEY_DONW);
            }).on("keyup", function (e) {
                var widget = WidgetUtil_2.WidgetUtil.findWidgetByTarget(e.target);
                if (widget && widget.isEnabled()) {
                    widget.handleKeyUpEvent(e);
                }
                DocumentEventInterceptor.sendDisplayEvent(Event_3.Event.KEY_UP);
            }).on("mousedown", function (e) {
                var widget = WidgetUtil_2.WidgetUtil.findWidgetByTarget(e.target);
                if (widget && widget.isEnabled()) {
                    widget.handleMouseDownEvent(e);
                }
                DocumentEventInterceptor.sendDisplayEvent(Event_3.Event.MOUSE_DOWN);
            }).on("mouseup", function (e, touchToClick) {
                var widget = WidgetUtil_2.WidgetUtil.findWidgetByTarget(e.target);
                if (widget && widget.isEnabled()) {
                    if (touchToClick) {
                        e.button = 0;
                    }
                    widget.handleMouseUpEvent(e);
                }
                DocumentEventInterceptor.sendDisplayEvent(Event_3.Event.MOUSE_UP);
            }).on("touchmove", function (e) {
                DocumentEventInterceptor.sendDisplayEvent(Event_3.Event.TOUCH_MOVE);
            });
            window.addEventListener("touchstart", function (e) {
                DocumentEventInterceptor.touchStartTimeStamp = e.timeStamp;
                DocumentEventInterceptor.touchStartTarget = e.target;
                DocumentEventInterceptor.touchHadMoved = false;
                DocumentEventInterceptor.touchStartY = e.changedTouches[0].pageY;
                DocumentEventInterceptor.touchStartX = e.changedTouches[0].pageX;
            });
            window.addEventListener("touchmove", function (e) {
                _this.touchHadMoved = true;
            });
            window.addEventListener("touchend", function (e) {
                if (!_this.touchHadMoved || e.target !== _this.touchStartTarget) {
                    return;
                }
                var changeY = e.changedTouches[0].pageY - DocumentEventInterceptor.touchStartY;
                var changeX = e.changedTouches[0].pageX - DocumentEventInterceptor.touchStartX;
                changeX = changeX < 0 ? changeX * -1 : changeX;
                changeY = changeY < 0 ? changeY * -1 : changeY;
                var isClick = false;
                var touchTime = e.timeStamp - DocumentEventInterceptor.touchStartTimeStamp;
                if (touchTime <= 900 && changeX <= 80 && changeY <= 80) {
                    isClick = true;
                }
                if (isClick) {
                    var widget = WidgetUtil_2.WidgetUtil.findWidgetByTarget(e.target);
                    if (widget) {
                        var id = widget.getId();
                        if (id.indexOf("TreeItem", 0) !== -1 || id.indexOf("TabItem", 0) !== -1
                            || id.indexOf("MessageDialog", 0) !== -1) {
                            $(e.target).click();
                        }
                        else {
                            $(e.target).trigger("mouseup", "true");
                        }
                    }
                    else {
                        $(e.target).click();
                    }
                }
            });
        };
        DocumentEventInterceptor.eventTypeMap = new Array();
        DocumentEventInterceptor.displayEvents = new Array();
        DocumentEventInterceptor.touchStartTimeStamp = 0;
        DocumentEventInterceptor.touchStartY = 0;
        DocumentEventInterceptor.touchStartX = 0;
        DocumentEventInterceptor.touchHadMoved = false;
        return DocumentEventInterceptor;
    }());
    exports.DocumentEventInterceptor = DocumentEventInterceptor;
});
define("App", ["require", "exports", "event/EventHub", "event/MessageType", "event/DocumentEventInterceptor"], function (require, exports, EventHub_4, MessageType_5, DocumentEventInterceptor_1) {
    "use strict";
    EventHub_4.EventHub.dispatchEvent(MessageType_5.MessageType.INIT, {});
    DocumentEventInterceptor_1.DocumentEventInterceptor.initInterceptor();
});
define("event/ExecutorEvent", ["require", "exports", "event/EventHub", "event/MessageType"], function (require, exports, EventHub_5, MessageType_6) {
    "use strict";
    var ExecutorEvent = (function () {
        function ExecutorEvent() {
        }
        ExecutorEvent.finish = function (id, args) {
            EventHub_5.EventHub.dispatchEvent(MessageType_6.MessageType.FINISH, { id: id, result: args });
        };
        ExecutorEvent.error = function (id, e) {
            EventHub_5.EventHub.dispatchEvent(MessageType_6.MessageType.ERROR, { id: id, error: e });
        };
        return ExecutorEvent;
    }());
    exports.ExecutorEvent = ExecutorEvent;
});
define("util/RequisiteUtil", ["require", "exports"], function (require, exports) {
    "use strict";
    var RequisiteUtil = (function () {
        function RequisiteUtil() {
        }
        RequisiteUtil.checkRequisite = function (isRequisite, widget, editable, value, msg) {
            if (isRequisite) {
                if (!widget.isEnabled() || !editable || value) {
                    RequisiteUtil.removeRequisite(widget);
                }
                else {
                    RequisiteUtil.addRequisite(widget);
                    if (msg) {
                        RequisiteUtil.showSpan(widget, msg);
                    }
                }
            }
        };
        RequisiteUtil.addRequisite = function (widget) {
            widget.$thisNode.find("input").addClass("adore_InputRequisite");
            widget.$thisNode.find("textarea").addClass("adore_InputRequisite");
            widget.$thisNode.find("label").addClass("adore_requisiteColor");
            widget.$thisNode.find("i").addClass("adore_requisiteColor");
        };
        RequisiteUtil.removeRequisite = function (widget) {
            widget.$thisNode.find("input").removeClass("adore_InputRequisite");
            widget.$thisNode.find("textarea").removeClass("adore_InputRequisite");
            widget.$thisNode.find("label").removeClass("adore_requisiteColor");
            widget.$thisNode.find("i").removeClass("adore_requisiteColor");
            RequisiteUtil.hideSpan(widget);
        };
        RequisiteUtil.showSpan = function (widget, msg) {
            if (widget.$thisNode.find('span').css("display") === "none") {
                widget.$thisNode.find('span').html(msg).show().delay(2000).fadeOut(300);
            }
        };
        RequisiteUtil.hideSpan = function (widget) {
            widget.$thisNode.find("span").css("display", "none");
        };
        return RequisiteUtil;
    }());
    exports.RequisiteUtil = RequisiteUtil;
});
define("widget/validator/MaxLengthValidator", ["require", "exports"], function (require, exports) {
    "use strict";
    var MaxLengthValidator = (function () {
        function MaxLengthValidator(id, textNode, maxLength) {
            this.id = id;
            this.textNode = textNode;
            this.maxLength = maxLength;
        }
        MaxLengthValidator.prototype.setMaxLength = function (maxLength) {
            this.maxLength = maxLength;
        };
        MaxLengthValidator.prototype.handleModifyEvent = function () {
            if (this.maxLength < 0) {
                return;
            }
            var count = 0;
            for (var i = 0; i < this.textNode.value.length; i++) {
                var c = this.textNode.value.charCodeAt(i);
                if ((c >= 0x0001 && c <= 0x007e) || (0xff60 <= c && c <= 0xff9f)) {
                    count++;
                }
                else {
                    count += 2;
                }
                if (count > this.maxLength) {
                    var selectionStart = this.textNode.selectionStart;
                    var selectionEnd = this.textNode.selectionEnd;
                    this.textNode.value = this.textNode.value.substr(0, i);
                    if (selectionEnd <= i) {
                        this.textNode.selectionStart = selectionStart;
                        this.textNode.selectionEnd = selectionEnd;
                    }
                    break;
                }
                else if (count === this.maxLength) {
                }
            }
        };
        return MaxLengthValidator;
    }());
    exports.MaxLengthValidator = MaxLengthValidator;
});
define("widget/validator/PictureValidator", ["require", "exports", "hotkey/Keys"], function (require, exports, Keys_4) {
    "use strict";
    var PictureValidator = (function () {
        function PictureValidator(id, textNode, picture, adoreText) {
            this.leftAlignment = false;
            this.length = 0;
            this.cursorIndex = -1;
            this.id = id;
            this.textNode = textNode;
            this.startWithZeroReg = new RegExp("^0\\d+\\..*");
            this.startWithZeroMinusReg = new RegExp("^-0\\d+\\..*");
            this.startWithMinusReg = new RegExp("^-\\..*");
            var tmpPicture = picture;
            if (tmpPicture.indexOf("-") === 0) {
                this.leftAlignment = true;
                tmpPicture = tmpPicture.substring(1);
            }
            var newPictureBuffer = new Array();
            var singleQuotedBuffer = new Array();
            var inQuote = false;
            var num = 0;
            for (var index = 0; index < tmpPicture.length; index++) {
                var c = tmpPicture.charAt(index);
                if (c === "\"") {
                    if (!inQuote) {
                        singleQuotedBuffer.length = 0;
                        inQuote = true;
                    }
                    else {
                        if (num === 0) {
                            num = 1;
                        }
                        for (var i = 0; i < num; i++) {
                            var temp = singleQuotedBuffer[0];
                            var savedString = newPictureBuffer.pop();
                            var saveString = savedString ? temp + savedString : temp;
                            newPictureBuffer.push(saveString);
                        }
                        num = 0;
                        singleQuotedBuffer.length = 0;
                        inQuote = false;
                    }
                }
                else {
                    if (!inQuote) {
                        if (c < "0" || c > "9") {
                            console.error(this.id + " --> picture init error: " + picture);
                        }
                        num = num * 10 + parseInt(c);
                    }
                    else {
                        var char = singleQuotedBuffer.length === 0 ? c : singleQuotedBuffer.pop() + c;
                        singleQuotedBuffer.push(char);
                    }
                }
            }
            for (var i = 0; i < num; i++) {
                newPictureBuffer.push("X");
            }
            tmpPicture = newPictureBuffer[0];
            while (tmpPicture.indexOf(".") !== tmpPicture.lastIndexOf(".")) {
                var lastDotIndex = tmpPicture.lastIndexOf(".");
                tmpPicture = tmpPicture.substring(0, lastDotIndex)
                    + tmpPicture.substring(lastDotIndex + 1);
            }
            this.length = tmpPicture.length;
            adoreText.setMaxLength(this.length);
            if (tmpPicture.charAt(0) === "0" || tmpPicture.charAt(0) === "C!") {
            }
            this.picture = tmpPicture;
        }
        PictureValidator.prototype.handleKeyDownEvent = function (e) {
            var textValue = this.textNode.value;
            if (this.length > 1) {
                var start = this.textNode.selectionStart;
                var end = this.textNode.selectionEnd;
                if (start === end) {
                    if (e.keyCode === Keys_4.Keys.BACKSPACE) {
                        if (PictureValidator.KNOWN_FLAGS.indexOf(this.picture.charAt(this.length
                            - this.textNode.value.length + start - 1)) === -1) {
                            this.textNode.selectionStart = --start;
                            this.textNode.selectionEnd = --end;
                        }
                        if (this.textNode.value.indexOf("-0.") === 0 && start === 2) {
                            this.textNode.value = this.textNode.value.substring(1);
                            this.textNode.selectionStart = 1;
                            this.textNode.selectionEnd = 1;
                            e.preventDefault();
                        }
                    }
                    if (e.keyCode === 127) {
                        if (PictureValidator.KNOWN_FLAGS.indexOf(this.picture.charAt(this.picture.length
                            - this.textNode.value.length + start)) === -1) {
                            this.textNode.selectionStart = ++start;
                        }
                    }
                }
            }
            if (this.length > 0) {
                var byteLength = 0;
                for (var i = 0; i < this.textNode.value.length; i++) {
                    var c = this.textNode.value.charCodeAt(i);
                    if ((c >= 0x0001 && c <= 0x007e) || (0xff60 <= c && c <= 0xff9f)) {
                        byteLength++;
                    }
                    else {
                        byteLength += 2;
                    }
                }
                if (textValue != null
                    && byteLength >= this.length
                    && (this.textNode.selectionEnd - this.textNode.selectionStart) === 0) {
                    if (e.keyCode !== 8 && e.keyCode !== 127
                        && e.keyCode !== Keys_4.Keys.RIGHT_ARROW
                        && e.keyCode !== Keys_4.Keys.LEFT_ARROW) {
                        if (this.picture.length > 0
                            && this.picture.charAt(0) === "$") {
                            return;
                        }
                        if (this.picture.indexOf(".") === -1) {
                            e.preventDefault();
                        }
                        else {
                            if (this.textNode.selectionStart <= this.textNode.value
                                .indexOf(".") && e.char !== ".") {
                                e.preventDefault();
                            }
                        }
                    }
                }
            }
        };
        PictureValidator.prototype.handleModifyEvent = function () {
            this.cursorIndex = this.textNode.selectionEnd;
            var textValue = this.textNode.value;
            if (this.picture.charAt(0) === "$") {
                while (textValue.indexOf("$") === 0) {
                    textValue = textValue.substring(1, textValue.length - 1);
                    this.cursorIndex--;
                }
                this.cursorIndex = Math.max(this.cursorIndex, 0);
            }
            textValue = this.removeUnknownFlags(textValue, this.picture, true);
            var refinedPicture = this.removeUnknownFlags(this.picture, this.picture, false);
            if (textValue.lastIndexOf("-") > 0) {
                var otherFlag = refinedPicture.replace(/[90\\.]/g, "");
                if (otherFlag.length === 0) {
                    var index = -1;
                    while ((index = textValue.indexOf("-")) > -1) {
                        if (index < (this.cursorIndex - 1)) {
                            this.cursorIndex--;
                            textValue = textValue.replace("-", "");
                        }
                        else {
                            textValue = textValue.replace(/-/g, "");
                            break;
                        }
                    }
                    textValue = "-" + textValue;
                }
            }
            if (refinedPicture.indexOf(".") !== -1) {
                while (textValue.indexOf(".") !== textValue.lastIndexOf(".")) {
                    textValue = textValue.substring(0, textValue.lastIndexOf("."))
                        + textValue.substring(textValue.lastIndexOf(".") + 1);
                    this.cursorIndex = textValue.indexOf(".") + 1;
                }
                if (textValue.indexOf(".") === -1) {
                    textValue = textValue.substring(0, this.cursorIndex) + "."
                        + textValue.substring(this.cursorIndex);
                }
                if (textValue.indexOf(".") === 0) {
                    textValue = "0" + textValue;
                    this.cursorIndex++;
                }
                else if (this.startWithZeroReg.test(textValue)) {
                    textValue = textValue.substring(1);
                    this.cursorIndex--;
                }
                else if (this.startWithZeroMinusReg.test(textValue)) {
                    textValue = textValue.substring(0, 1) + textValue.substring(2);
                    this.cursorIndex--;
                }
                if (this.startWithMinusReg.test(textValue)) {
                    textValue = "-0" + textValue.substring(1);
                    this.cursorIndex++;
                }
                var pictureSuffixLength = refinedPicture.length - 1
                    - refinedPicture.indexOf(".");
                var strSuffixLength = textValue.length - 1 - textValue.indexOf(".");
                if (strSuffixLength > pictureSuffixLength) {
                    var newLength = textValue.length - strSuffixLength
                        + pictureSuffixLength;
                    textValue = textValue.substring(0, newLength);
                    this.cursorIndex = Math.min(textValue.length, this.cursorIndex);
                }
                for (var i = 0; i < pictureSuffixLength - strSuffixLength; i++) {
                    textValue += "0";
                }
            }
            if (textValue.length > refinedPicture.length) {
                if (this.leftAlignment) {
                    textValue = textValue.substring(0, refinedPicture.length);
                }
                else {
                    textValue = textValue.substring(textValue.length - refinedPicture.length);
                }
            }
            for (var i = 0; i < textValue.length;) {
                if (refinedPicture.charAt(refinedPicture.length - textValue.length
                    + i) === "^") {
                    textValue = textValue.substring(0, i) + textValue.charAt(i).toUpperCase()
                        + textValue.substring(i + 1);
                }
                if (!this.checkFormat(refinedPicture.charAt(refinedPicture.length
                    - textValue.length + i), textValue.charAt(i), i)) {
                    textValue = textValue.substring(0, i) + textValue.substring(i + 1);
                    this.cursorIndex = i;
                }
                else {
                    i++;
                }
            }
            var startWithMinus = false;
            if (textValue.indexOf("-") === 0) {
                textValue = textValue.substring(1);
                startWithMinus = true;
            }
            textValue = this.addUnknownFlags(textValue, this.picture);
            if (this.picture.charAt(0) === "$") {
                while (textValue.length < this.length) {
                    textValue = "$" + textValue;
                    this.cursorIndex++;
                }
            }
            if (startWithMinus) {
                textValue = "-" + textValue;
            }
            this.textNode.value = textValue;
            this.textNode.selectionStart = this.cursorIndex;
            this.textNode.selectionEnd = this.cursorIndex;
        };
        PictureValidator.prototype.removeUnknownFlags = function (textValue, picture, modifyCursorIndex) {
            var unknownFlags = "";
            for (var i = 0; i < picture.length; i++) {
                if (PictureValidator.KNOWN_FLAGS.indexOf(picture.charAt(i)) === -1) {
                    unknownFlags += picture.charAt(i);
                }
            }
            for (var i = 0; i < unknownFlags.length; i++) {
                var j = textValue.indexOf(unknownFlags.charAt(i));
                if (j !== -1) {
                    textValue = textValue.substring(0, j) + textValue.substring(j + 1);
                    if (modifyCursorIndex && this.cursorIndex > j) {
                        this.cursorIndex--;
                    }
                }
            }
            return textValue;
        };
        PictureValidator.prototype.checkFormat = function (format, c, index) {
            switch (format) {
                case "$":
                    if (c === "$") {
                        for (var i = 0; i < index; i++) {
                            if (this.textNode.value.charAt(i) !== "$")
                                return false;
                        }
                    }
                    if ((c < "0" || c > "9") && c !== "-") {
                        return false;
                    }
                    if (c === "-" && index === 0)
                        return true;
                    if (c === "-") {
                        for (var i = 0; i < index; i++) {
                            if (this.textNode.value.charAt(i) !== "$")
                                return false;
                        }
                    }
                    break;
                case "9":
                    if ((c < "0" || c > "9") && c !== "-") {
                        return false;
                    }
                    if (c === "-" && index !== 0)
                        return false;
                    break;
                case "0":
                    if (c < "0" || c > "9") {
                        return false;
                    }
                    break;
                case "A":
                    if ((c < "a" || c > "z") && (c < "A" || c > "Z")) {
                        return false;
                    }
                    break;
                case "N":
                case "!":
                    if ((c < "a" || c > "z") && (c < "A" || c > "Z")
                        && (c < "0" || c > "9")) {
                        return false;
                    }
                    break;
                case "C":
                    if (c.charCodeAt(0) < 0x3400) {
                        return false;
                    }
                    break;
                case "^":
                    break;
                case "c":
                    if (c.charCodeAt(0) >= 0x3400)
                        return false;
                    break;
                case "F":
                    if (c.charCodeAt(0) < 256) {
                        return false;
                    }
                    break;
                case "X":
                    break;
                default:
                    if (c === format)
                        return true;
                    if (c === "-" && index === 0)
                        return true;
                    return false;
            }
            return true;
        };
        PictureValidator.prototype.addUnknownFlags = function (s, picture) {
            for (var i = 0; i < s.length; i++) {
                if (PictureValidator.KNOWN_FLAGS.indexOf(picture.charAt(picture.length - 1 - i)) === -1) {
                    s = s.substring(0, s.length - i)
                        + picture.charAt(picture.length - 1 - i)
                        + s.substring(s.length - i);
                    if (this.cursorIndex > s.length - 1 - i) {
                        this.cursorIndex++;
                    }
                }
            }
            return s;
        };
        PictureValidator.KNOWN_FLAGS = "90^$AN!CcFX.";
        return PictureValidator;
    }());
    exports.PictureValidator = PictureValidator;
});
define("widget/Text", ["require", "exports", "widget/Widget", "ADORE", "event/EventHub", "event/MessageType", "event/Event", "widget/validator/MaxLengthValidator", "widget/validator/PictureValidator", "util/SoftwareKeyboardUtil", "util/RequisiteUtil"], function (require, exports, Widget_4, ADORE_2, EventHub_6, MessageType_7, Event_4, MaxLengthValidator_1, PictureValidator_1, SoftwareKeyboardUtil_1, RequisiteUtil_1) {
    "use strict";
    var Text = (function (_super) {
        __extends(Text, _super);
        function Text(parentId, id, style) {
            _super.call(this, parentId, id, style);
            this.editable = true;
            this.requisite = false;
            this.maxLength = -1;
            var own = this;
            this.$thisNode = $(Text.Template).attr({
                id: this.id + "_containerNode"
            });
            this.$inputNode = this.$thisNode.find("input");
            this.$inputNode.attr("id", this.id).on("input", function (e) {
                if ($(this).prop('comStart'))
                    return;
                own.handleOnInput();
                EventHub_6.EventHub.dispatchEvent(MessageType_7.MessageType.WIDGET, {
                    id: id,
                    text: $(this).val(),
                    evtType: Event_4.Event.MODIFY,
                    syncAttrName: "text"
                });
            }).on("focus", function () {
                own.sendFocusGain();
                SoftwareKeyboardUtil_1.SoftwareKeyboardUtil.refresh();
            }).on("blur", function () {
                RequisiteUtil_1.RequisiteUtil.checkRequisite(own.requisite, own, own.editable, own.$inputNode.val(), "请输入数据!");
            }).on('compositionstart', function () {
                $(this).prop('comStart', true);
            }).on('compositionend', function () {
                $(this).prop('comStart', false);
            });
            this.$thisNode.find("label").attr("for", this.id);
            if ((this.style & ADORE_2.ADORE.Password) === ADORE_2.ADORE.Password) {
                this.$inputNode.attr("type", "password");
            }
        }
        Text.prototype.handleOnInput = function () {
            this.maxLengthValidator.handleModifyEvent();
            if (this.pictureValidator)
                this.pictureValidator.handleModifyEvent();
            RequisiteUtil_1.RequisiteUtil.checkRequisite(this.requisite, this, this.editable, this.$inputNode.val(), "请输入数据!");
        };
        Text.prototype.setRequisite = function (args) {
            this.requisite = args.requisite;
            RequisiteUtil_1.RequisiteUtil.checkRequisite(this.requisite, this, this.editable, this.$inputNode.val(), "");
        };
        Text.prototype.setEnabled = function (args) {
            this.enabled = args.enabled;
            if (this.enabled) {
                this.$inputNode.removeAttr("disabled");
                this.$thisNode.find("i").removeClass("icon_disabled");
            }
            else {
                this.$inputNode.attr("disabled", "disabled");
                this.$thisNode.find("i").addClass("icon_disabled");
            }
            RequisiteUtil_1.RequisiteUtil.checkRequisite(this.requisite, this, this.editable, this.$inputNode.val(), "");
        };
        Text.prototype.setFocus = function () {
            if (document.activeElement !== this.$inputNode[0]) {
                this.$inputNode.focus();
            }
            RequisiteUtil_1.RequisiteUtil.checkRequisite(this.requisite, this, this.editable, this.$inputNode.val(), "请输入数据!");
        };
        Text.prototype.setText = function (args) {
            this.$inputNode.val(args.text);
            if (args.text.length > 0) {
                this.$inputNode.siblings("label, i").addClass("active");
            }
            else {
                this.$inputNode.siblings("label, i").removeClass("active");
            }
            RequisiteUtil_1.RequisiteUtil.checkRequisite(this.requisite, this, this.editable, this.$inputNode.val(), "");
        };
        Text.prototype.setIcon = function (args) {
            this.$thisNode.find("i").addClass(args.icon);
            if (this.$inputNode.val().length > 0)
                this.$inputNode.siblings("label, i").addClass("active");
            this.$thisNode.find("span").addClass("span_prefix");
        };
        Text.prototype.setName = function (args) {
            this.$thisNode.find("label").text(args.name);
        };
        Text.prototype.setPicture = function (args) {
            this.picture = args.picture;
        };
        Text.prototype.handleKeyDownEvent = function (e, hasFilter) {
            if (this.pictureValidator)
                this.pictureValidator.handleKeyDownEvent(e);
            _super.prototype.handleKeyDownEvent.call(this, e, hasFilter);
        };
        Text.prototype.handleMaxLength = function () {
            this.maxLengthValidator = new MaxLengthValidator_1.MaxLengthValidator(this.id, this.$inputNode[0], this.maxLength);
        };
        Text.prototype.setMaxLength = function (maxLength) {
            if (this.maxLengthValidator)
                this.maxLengthValidator.setMaxLength(maxLength);
        };
        Text.prototype.handlePicture = function (picture) {
            if (picture.length > 0 && picture.indexOf("\"") < 0) {
                if (picture.indexOf(",") >= 0 || picture.indexOf(".") >= 0) {
                    console.error("非法的picutre:" + picture);
                    picture = "";
                }
                var allNum = true;
                for (var i = 0; i < picture.length; i++) {
                    var c = picture.charAt(i);
                    if (c < "0" || c > "9") {
                        allNum = false;
                        break;
                    }
                }
                if (allNum && picture.length > 2) {
                    console.error("非法的picture:" + picture);
                    picture = "";
                }
            }
            this.pictureValidator = new PictureValidator_1.PictureValidator(this.id, this.$inputNode[0], picture, this);
        };
        Text.prototype.setmaxLength = function (args) {
            this.maxLength = args.maxLength;
        };
        Text.prototype.postLayout = function () {
            this.handleMaxLength();
            if (this.picture)
                this.handlePicture(this.picture);
        };
        Text.prototype.setPanelID = function (args) {
            this.panelID = args.panelID;
        };
        Text.prototype.setEditable = function (args) {
            this.editable = args.editable;
            if (this.editable) {
                this.$inputNode.removeAttr("readOnly");
            }
            else {
                this.$inputNode.attr("readOnly", "readOnly");
            }
            RequisiteUtil_1.RequisiteUtil.checkRequisite(this.requisite, this, this.editable, this.$inputNode.val(), "");
        };
        Text.prototype.toString = function () {
            return "Text";
        };
        Text.prototype.setTooltip = function (args) {
            this.$inputNode.tooltip('remove');
            if (args.tooltip !== "") {
                this.$inputNode.attr("data-position", "right");
                this.$inputNode.attr("data-tooltip", args.tooltip);
                this.$inputNode.tooltip({ delay: 50 });
            }
        };
        Text.Template = "\n            <div class=\"input-field\">\n                <i class=\"icon_normal\"></i>\n                <input type=\"text\">\n                <label></label>\n                <span class=\"span_base\"></span>\n            </div>\n    ";
        return Text;
    }(Widget_4.Widget));
    exports.Text = Text;
});
define("util/SoftwareKeyboardUtil", ["require", "exports", "util/WidgetUtil"], function (require, exports, WidgetUtil_3) {
    "use strict";
    var SoftwareKeyboardUtil = (function () {
        function SoftwareKeyboardUtil() {
        }
        SoftwareKeyboardUtil.handleSoftwareKeyboardShow = function (args) {
            this.keyboardShowed = true;
            this.proportion = args.proportion;
            this.refresh();
        };
        SoftwareKeyboardUtil.refresh = function () {
            if (this.keyboardShowed === true) {
                var keyboardHeightProportion = this.proportion;
                var element = document.activeElement;
                var widget = WidgetUtil_3.WidgetUtil.findWidgetByTarget(element);
                if (widget && widget.toString() === "Text") {
                    var softKeyboardHeight = keyboardHeightProportion * window.innerHeight;
                    var textWidget = widget;
                    this.scroll(textWidget.panelID, widget.$thisNode[0], softKeyboardHeight);
                }
            }
        };
        SoftwareKeyboardUtil.refreshKeyboardHide = function () {
            $("#softKeyboardDiv").remove();
            if (this.lastPanelID) {
                $("#" + this.lastPanelID).css({ "overflow-y": this.lastOverflowYValue, "display": this.lastDisplayValue });
                this.lastPanelID = null;
            }
        };
        SoftwareKeyboardUtil.handleSoftwareKeyboardHide = function () {
            this.keyboardShowed = false;
            this.refreshKeyboardHide();
        };
        SoftwareKeyboardUtil.scroll = function (panelID, textNode, softKeyboardHeight) {
            if (this.lastPanelID !== panelID) {
                this.refreshKeyboardHide();
            }
            var top = this.getElementViewBottom(textNode);
            var i;
            if (softKeyboardHeight - top >= 1) {
                var containerNode = $("#" + panelID);
                this.lastPanelID = panelID;
                if ($("div.adore_shell_content").length !== 0) {
                    var adoreShells = $("div.adore_shell_content");
                    for (i = 0; i < adoreShells.length; i++) {
                        if ($(adoreShells[i]).find("#" + panelID).length !== 0) {
                            containerNode = $(adoreShells[i]);
                            break;
                        }
                    }
                }
                var container = containerNode[0];
                this.lastOverflowYValue = containerNode.css("overflow-y");
                this.lastDisplayValue = containerNode.css("display");
                containerNode.css({ "overflow-y": "auto", "display": "block" });
                container.scrollTop = container.scrollTop + (softKeyboardHeight - top);
                var afterTop = this.getElementViewBottom(textNode);
                if (softKeyboardHeight - afterTop >= 1) {
                    var tempDivNode = $("<div></div>").css({
                        height: softKeyboardHeight + "px",
                        width: "1px"
                    }).attr({ id: "softKeyboardDiv" });
                    if (containerNode.css("position") === "absolute") {
                        var children = containerNode.children();
                        var totalHeight = 0;
                        for (i = 0; i < children.length; i++) {
                            totalHeight += children[i].offsetHeight;
                        }
                        var tempDivTop = container.offsetHeight >= totalHeight ? container.offsetHeight : totalHeight;
                        tempDivNode.css({
                            position: "absolute",
                            top: tempDivTop + "px"
                        });
                    }
                    tempDivNode.appendTo(container);
                    container.scrollTop = container.scrollTop + (softKeyboardHeight - afterTop);
                }
            }
        };
        SoftwareKeyboardUtil.getElementViewBottom = function (element) {
            var top = element.getBoundingClientRect().top;
            return window.innerHeight - top - element.offsetHeight;
        };
        return SoftwareKeyboardUtil;
    }());
    exports.SoftwareKeyboardUtil = SoftwareKeyboardUtil;
});
define("util/TabUtil", ["require", "exports", "event/EventHub", "event/Event", "event/MessageType"], function (require, exports, EventHub_7, Event_5, MessageType_8) {
    "use strict";
    var TabUtil = (function () {
        function TabUtil() {
        }
        TabUtil.handleTabLeftMoveClick = function (tabFolderId) {
            var tabs = $("#" + tabFolderId);
            var indexs = this.getBlockIndexs(tabs);
            var blockBegin = indexs[0], blockEnd = indexs[1];
            if (blockBegin <= 0) {
                return;
            }
            var lis = tabs.find("li.adore_tab");
            var count = this.tabLeftMove(tabs, lis, blockBegin);
            if (count <= 1) {
                this.tabLeftMove(tabs, lis, blockBegin - 1);
            }
            this.resetMovingIcon(tabs, lis);
            this.resetIndicator(tabs, lis);
        };
        TabUtil.handleTabRightMoveClick = function (tabFolderId) {
            var tabs = $("#" + tabFolderId);
            var indexs = this.getBlockIndexs(tabs);
            var blockBegin = indexs[0], blockEnd = indexs[1];
            var lis = tabs.find("li.adore_tab");
            if (this.isEndRight(tabs, lis)) {
                return;
            }
            var count = this.tabRightMove(tabs, lis, blockEnd);
            if (count <= 1) {
                this.tabRightMove(tabs, lis, blockEnd + 1);
            }
            this.resetMovingIcon(tabs, lis);
            this.resetIndicator(tabs, lis);
        };
        TabUtil.isEndRight = function (tabs, lis) {
            var indexs = this.getBlockIndexs(tabs);
            var endRight = false;
            if (indexs[1] === lis.length - 1) {
                var w = $(lis[indexs[1]]).width();
                this.resetAndGetRealWidth(tabs);
                var realW = $(lis[indexs[1]]).width();
                $(lis[indexs[1]]).width(w + "px");
                if (w === realW) {
                    endRight = true;
                }
            }
            if (indexs[0] === indexs[1]) {
                endRight = true;
            }
            return endRight;
        };
        TabUtil.resetMovingIcon = function (tabs, lis) {
            if (tabs.find("li.tab_left_move").css("display") === "none") {
                return;
            }
            var indexs = this.getBlockIndexs(tabs);
            var endRight = this.isEndRight(tabs, lis);
            var arrowRight = tabs.find("li.tab_right_move").find("div");
            var arrowLeft = tabs.find("li.tab_left_move").find("div");
            arrowLeft.removeClass("arrow_not_active").removeClass("arrow_active");
            arrowRight.removeClass("arrow_not_active").removeClass("arrow_active");
            if (endRight) {
                arrowRight.addClass("arrow_not_active");
            }
            else {
                arrowRight.addClass("arrow_active");
            }
            if (indexs[0] === 0) {
                arrowLeft.addClass("arrow_not_active");
            }
            else {
                arrowLeft.addClass("arrow_active");
            }
        };
        TabUtil.tabLeftMove = function (tabs, lis, blockBegin) {
            lis.removeClass("tab_visible").addClass("tab_not_visible");
            var canUseWidth = tabs.width() - this.movingIconWidth - this.totalWidthPrefix;
            var usedWidth = 0;
            var i;
            this.resetAndGetRealWidth(tabs);
            for (i = blockBegin; i >= 0 && usedWidth < canUseWidth; i--) {
                $(lis[i]).addClass("tab_visible").removeClass("tab_not_visible");
                usedWidth += $(lis[i]).width();
            }
            for (i = blockBegin + 1; i < lis.length && usedWidth < canUseWidth; i++) {
                $(lis[i]).addClass("tab_visible").removeClass("tab_not_visible");
                usedWidth += $(lis[i]).width();
            }
            var tempIndexs = this.getBlockIndexs(tabs);
            var end = tempIndexs[1];
            if (usedWidth > canUseWidth) {
                $(lis[end]).width($(lis[end]).width() - (usedWidth - canUseWidth) + "px");
            }
            return tempIndexs[1] - tempIndexs[0] + 1;
        };
        TabUtil.tabRightMove = function (tabs, lis, blockEnd) {
            lis.removeClass("tab_visible").addClass("tab_not_visible");
            var canUseWidth = tabs.width() - this.movingIconWidth - this.totalWidthPrefix;
            var usedWidth = 0;
            var i;
            this.resetAndGetRealWidth(tabs);
            for (i = blockEnd; i < lis.length && usedWidth < canUseWidth; i++) {
                $(lis[i]).addClass("tab_visible").removeClass("tab_not_visible");
                usedWidth += $(lis[i]).width();
            }
            for (i = blockEnd - 1; i >= 0 && usedWidth < canUseWidth; i--) {
                $(lis[i]).addClass("tab_visible").removeClass("tab_not_visible");
                usedWidth += $(lis[i]).width();
            }
            var tempIndexs = this.getBlockIndexs(tabs);
            var end = tempIndexs[1], begin = tempIndexs[0];
            if (usedWidth > canUseWidth) {
                if (end === lis.length - 1 && end != begin) {
                    $(lis[begin]).removeClass("tab_visible").addClass("tab_not_visible");
                }
                else {
                    $(lis[end]).width($(lis[end]).width() - (usedWidth - canUseWidth) + "px");
                }
            }
            tempIndexs = this.getBlockIndexs(tabs);
            return tempIndexs[1] - tempIndexs[0] + 1;
        };
        TabUtil.getBlockIndexs = function (tabs) {
            var tabList = tabs.find("li.adore_tab");
            var blockBegin = 0, blockEnd = 0, i;
            for (i = 0; i < tabList.length; i++) {
                if ($(tabList[i]).css("display") === "block") {
                    blockBegin = i;
                    break;
                }
            }
            for (i = tabList.length - 1; i >= 0; i--) {
                if ($(tabList[i]).css("display") === "block") {
                    blockEnd = i;
                    break;
                }
            }
            return [blockBegin, blockEnd];
        };
        TabUtil.getPreTabIndex = function (tabs) {
            var preIndex = 0;
            var activeHref = tabs.find("a.active").attr("href");
            var tabList = tabs.find("li.adore_tab");
            var tmpHref;
            for (var i = 0; i < tabList.length; i++) {
                tmpHref = $(tabList[i]).find("a").attr("href");
                if (activeHref === tmpHref) {
                    preIndex = i;
                    break;
                }
            }
            var blockIndexs = this.getBlockIndexs(tabs);
            if (preIndex < blockIndexs[0]) {
                return -1;
            }
            if (preIndex > blockIndexs[1]) {
                return -2;
            }
            return preIndex - blockIndexs[0];
        };
        TabUtil.handleTabClick = function (e, currentTab, tabFolderId) {
            var tabs = $("#" + tabFolderId);
            var tabList = tabs.find("li.tab_visible");
            var currentIndex = 0;
            var currentHref = currentTab.attr("href");
            var tmpHref;
            for (var i = 0; i < tabList.length; i++) {
                tmpHref = $(tabList[i]).find("a").attr("href");
                if (currentHref === tmpHref) {
                    currentIndex = i;
                    break;
                }
            }
            var lis = tabs.find("li.adore_tab");
            var preIndex = this.getPreTabIndex(tabs);
            var activeHref = tabs.find("a.active").attr("href");
            $(activeHref).removeClass("tab_control_visible").addClass("tab_control_not_visible");
            tabs.find("a.active").removeClass("active");
            currentTab.addClass("active");
            $(currentHref).removeClass("tab_control_not_visible").addClass("tab_control_visible");
            var $tab_width = $(tabList[currentIndex]).width();
            var $indivatorLeft = this.getIndicatorLeftWidth(tabs, lis);
            var $indicator = tabs.find("div.my_indicator");
            if (preIndex === -2 || preIndex === -1) {
                $indicator.width(this.$tab_min_width + "px");
            }
            $indicator.velocity({ "left": $indivatorLeft, "width": $tab_width + "px" }, {
                duration: 300,
                queue: false,
                easing: 'easeOutQuad'
            });
        };
        TabUtil.resetAndGetRealWidth = function (tabs) {
            var lis = tabs.find("li.adore_tab");
            var tabRealWidth = 0;
            for (var i = 0; i < lis.length; i++) {
                var a = $(lis[i]).find("a");
                var text = a.text();
                var fontSize = a.css("font-size");
                var letterSpacing = a.css("letter-spacing");
                fontSize = parseFloat(fontSize.replace("px", ""));
                letterSpacing = parseFloat(letterSpacing.replace("px", ""));
                var t = (fontSize + letterSpacing) * text.length + this.$tab_min_width / 2;
                t = t > this.$tab_min_width ? t : this.$tab_min_width;
                tabRealWidth += t;
                $(lis[i]).width(t + "px");
            }
            return tabRealWidth;
        };
        TabUtil.refreshTabs = function (tabs) {
            var totalWidth = tabs.width() - this.totalWidthPrefix;
            var lis = tabs.find("li.adore_tab");
            var activeIndex = this.getActiveIndex(lis);
            lis.removeClass("tab_visible");
            lis.addClass("tab_not_visible");
            tabs.find("li.tab_left_move").css("display", "none");
            tabs.find("li.tab_right_move").css("display", "none");
            this.movingIconWidth = tabs.find("li.tab_left_move").width() + tabs.find("li.tab_right_move").width() + 10;
            var tabRealWidth = this.resetAndGetRealWidth(tabs);
            tabs.find("li.adore_tab_space").css("display", "none");
            if (tabRealWidth > totalWidth) {
                tabs.find("li.tab_left_move").css("display", "block");
                tabs.find("li.tab_right_move").css("display", "block");
                this.tabRightMove(tabs, lis, activeIndex);
            }
            else {
                lis.removeClass("tab_not_visible").addClass("tab_visible");
                tabs.find("li.adore_tab_space").css("display", "block");
            }
            tabs.find("div.indicator").remove();
            tabs.find("div.my_indicator").remove();
            var indicator = $("<div></div>").addClass("my_indicator");
            indicator.appendTo(tabs);
            this.resetIndicator(tabs, lis);
            this.resetMovingIcon(tabs, lis);
        };
        TabUtil.getActiveIndex = function (lis) {
            var activeIndex = 0;
            for (var i = 0; i < lis.length; i++) {
                if ($(lis[i]).find("a.active").length != 0) {
                    activeIndex = i;
                    break;
                }
            }
            return activeIndex;
        };
        TabUtil.resetIndicator = function (tabs, lis) {
            var indicatorLeft = this.getIndicatorLeftWidth(tabs, lis);
            var indicator = tabs.find("div.my_indicator");
            if (indicatorLeft === -1) {
                indicator.width(0);
                return;
            }
            var index = this.getActiveIndex(lis);
            indicator.width($(lis[index]).width() + "px");
            indicator.css("left", indicatorLeft + "px");
        };
        TabUtil.getIndicatorLeftWidth = function (tabs, lis) {
            var indexs = this.getBlockIndexs(tabs), activeIndex = this.getActiveIndex(lis), indicatorLeft = 0;
            if (activeIndex < indexs[0] || activeIndex > indexs[1]) {
                return -1;
            }
            if (tabs.find("li.tab_left_move").css("display") === "block") {
                indicatorLeft += this.movingLeftIconWidth;
            }
            else {
                indicatorLeft += this.totalWidthPrefix;
            }
            for (var i = indexs[0]; i < activeIndex; i++) {
                indicatorLeft += $(lis[i]).width();
            }
            return indicatorLeft;
        };
        TabUtil.init = function (tabs) {
            tabs.each(function () {
                var $this = $(this);
                var tabsId = $this.attr("id");
                var ownId = tabsId;
                if (ownId) {
                    ownId = ownId.substring(0, ownId.length - 5);
                }
                $this.width('100%');
                var $active, $content, $links = $this.find('li.adore_tab a'), $tabs_width = $this.width(), $tab_width = $this.find('li').first().outerWidth(), $index = 0;
                $active = $($links.filter('[href="' + location.hash + '"]'));
                if ($active.length === 0) {
                    $active = $(this).find('li.adore_tab a.active').first();
                }
                if ($active.length === 0) {
                    $active = $(this).find('li.adore_tab a').first();
                }
                $active.addClass('active');
                $index = $links.index($active);
                if ($index < 0) {
                    $index = 0;
                }
                $content = $($active[0].hash);
                $this.append("<div class=\"indicator\"></div>");
                var $indicator = $this.find('.indicator');
                if ($this.is(":visible")) {
                    $indicator.css({ "right": $tabs_width - (($index + 1) * $tab_width) });
                    $indicator.css({ "left": $index * $tab_width });
                }
                var resizeListener = tabs.data("resize_listener");
                if (!resizeListener) {
                    resizeListener = function () {
                        $tabs_width = $this.width();
                        $tab_width = $this.find('li').first().outerWidth();
                        if ($index < 0) {
                            $index = 0;
                        }
                        if ($tab_width !== 0 && $tabs_width !== 0) {
                            $indicator.css({ "right": $tabs_width - (($index + 1) * $tab_width) });
                            $indicator.css({ "left": $index * $tab_width });
                        }
                    };
                    tabs.data("resize_listener", resizeListener);
                    $(window).on("resize", resizeListener);
                }
                $links.not($active).each(function () {
                    $(this.hash).removeClass("tab_control_visible").addClass("tab_control_not_visible");
                });
                var clickListener = $this.data("click_listener");
                if (!clickListener) {
                    clickListener = function (e) {
                        if ($(this).parent().hasClass('disabled')) {
                            e.preventDefault();
                            return;
                        }
                        $tabs_width = $this.width();
                        $tab_width = $this.find('li').first().outerWidth();
                        $active.removeClass('active');
                        $content.removeClass("tab_control_visible").addClass("tab_control_not_visible");
                        $active = $(this);
                        $content = $(this.hash);
                        $links = $this.find('li.adore_tab a');
                        $active.addClass('active');
                        var $prev_index = $index;
                        $index = $links.index($(this));
                        if ($index < 0) {
                            $index = 0;
                        }
                        $content.removeClass("tab_control_not_visible").addClass("tab_control_visible");
                        if (($index - $prev_index) >= 0) {
                            $indicator.velocity({ "right": $tabs_width - (($index + 1) * $tab_width) }, {
                                duration: 300,
                                queue: false,
                                easing: 'easeOutQuad'
                            });
                            $indicator.velocity({ "left": $index * $tab_width }, {
                                duration: 300,
                                queue: false,
                                easing: 'easeOutQuad',
                                delay: 90
                            });
                        }
                        else {
                            $indicator.velocity({ "left": $index * $tab_width }, {
                                duration: 300,
                                queue: false,
                                easing: 'easeOutQuad'
                            });
                            $indicator.velocity({ "right": $tabs_width - (($index + 1) * $tab_width) }, {
                                duration: 300,
                                queue: false,
                                easing: 'easeOutQuad',
                                delay: 90
                            });
                        }
                        if ($index !== $prev_index) {
                            EventHub_7.EventHub.dispatchEvent(MessageType_8.MessageType.WIDGET, {
                                id: ownId,
                                selectedIndex: $index + "",
                                evtType: Event_5.Event.ON_CHANGE
                            });
                        }
                        e.preventDefault();
                    };
                    $this.data("click_listener", clickListener);
                    $this.on('click', 'a', clickListener);
                }
            });
        };
        TabUtil.tabsSwitch = function (tabs) {
            this.init(tabs);
        };
        TabUtil.$tab_min_width = 60;
        TabUtil.movingIconWidth = 70;
        TabUtil.movingLeftIconWidth = 40;
        TabUtil.totalWidthPrefix = 30;
        return TabUtil;
    }());
    exports.TabUtil = TabUtil;
});
define("util/VisibilityChangeUtil", ["require", "exports"], function (require, exports) {
    "use strict";
    var VisibilityChangeUtil = (function () {
        function VisibilityChangeUtil() {
        }
        VisibilityChangeUtil.findValue = function (id) {
            for (var i = 0; i < VisibilityChangeUtil.visibilityListener.length; i++) {
                if (VisibilityChangeUtil.visibilityListener[i].key === id) {
                    return VisibilityChangeUtil.visibilityListener[i];
                }
            }
            return null;
        };
        VisibilityChangeUtil.refresh = function () {
            if (VisibilityChangeUtil.visibilityRunning) {
                if (VisibilityChangeUtil.visibilityListener.length === 0) {
                    VisibilityChangeUtil.visibilityRunning = false;
                }
            }
            else {
                if (VisibilityChangeUtil.visibilityListener.length !== 0) {
                    VisibilityChangeUtil.visibilityRunning = true;
                    setTimeout(VisibilityChangeUtil.handleVisibilityChanged, VisibilityChangeUtil.frequency);
                }
            }
        };
        VisibilityChangeUtil.handleVisibilityChanged = function () {
            if (VisibilityChangeUtil.visibilityRunning) {
                var copyVisibilityListener = VisibilityChangeUtil.visibilityListener.slice(0, VisibilityChangeUtil.visibilityListener.length);
                for (var i = 0; i < copyVisibilityListener.length; i++) {
                    var oldVisible = copyVisibilityListener[i].visible;
                    var element = $("#" + copyVisibilityListener[i].key);
                    if (element.length === 0) {
                        VisibilityChangeUtil.removeVisibilityListener($("<div></div>").attr("id", copyVisibilityListener[i].key));
                        continue;
                    }
                    var visible = element.is(":visible");
                    if (visible !== oldVisible) {
                        copyVisibilityListener[i].visible = visible;
                        for (var j = 0; j < copyVisibilityListener[i].callbacks.length; j++) {
                            copyVisibilityListener[i].callbacks[j](visible);
                        }
                    }
                }
                setTimeout(VisibilityChangeUtil.handleVisibilityChanged, VisibilityChangeUtil.frequency);
            }
        };
        VisibilityChangeUtil.addVisibilityListener = function (element, callback) {
            var id = element.attr("id");
            if (id) {
                var value = VisibilityChangeUtil.findValue(id);
                if (!value) {
                    VisibilityChangeUtil.visibilityListener.push({
                        key: id,
                        callbacks: [callback],
                        visible: element.is(":visible")
                    });
                    VisibilityChangeUtil.refresh();
                }
                else {
                    value.callbacks.push(callback);
                }
            }
        };
        VisibilityChangeUtil.removeVisibilityListener = function (element) {
            var id = element.attr("id");
            if (id) {
                var value = VisibilityChangeUtil.findValue(id);
                if (value) {
                    VisibilityChangeUtil.visibilityListener.splice(VisibilityChangeUtil.visibilityListener.indexOf(value), 1);
                    VisibilityChangeUtil.refresh();
                }
            }
        };
        VisibilityChangeUtil.visibilityListener = new Array();
        VisibilityChangeUtil.visibilityRunning = false;
        VisibilityChangeUtil.frequency = 400;
        return VisibilityChangeUtil;
    }());
    exports.VisibilityChangeUtil = VisibilityChangeUtil;
});
define("widget/AdoreLoading", ["require", "exports"], function (require, exports) {
    "use strict";
    var AdoreLoading = (function () {
        function AdoreLoading() {
        }
        AdoreLoading.show = function (args) {
            var parentId = args.parentId;
            var parentNode = $("#" + parentId);
            if (parentNode.length === 0) {
                return;
            }
            if (parentNode.children("div.adore-loading").length !== 0) {
                return;
            }
            var $templateNode = $(AdoreLoading.Template);
            $templateNode.attr("id", "AdoreLoading_" + parentId);
            $templateNode.appendTo(parentNode);
            $templateNode.height(parentNode[0].scrollHeight);
            var p = this.getPosition(parentNode[0]);
            var top = (parentNode.height() / 2 + p[0]).toFixed(0) + "px";
            var left = (parentNode.width() / 2 + p[1]).toFixed(0) + "px";
            $templateNode.find(".preloader-wrapper").css({ top: top, left: left });
            $("#AdoreLoading_" + parentId).on("click keyup keydown mouseup mousedown", function (e) {
                e.stopPropagation();
            });
        };
        AdoreLoading.destroy = function (attrs) {
            $("#" + attrs.parentId).children("div.adore-loading").remove();
        };
        AdoreLoading.getPosition = function (obj) {
            var pos = [0, 0];
            if (obj && obj.offsetParent) {
                while (obj && obj.offsetParent) {
                    pos[0] += obj.offsetTop;
                    pos[1] += obj.offsetLeft;
                    obj = obj.offsetParent;
                }
            }
            return pos;
        };
        AdoreLoading.Template = "\n    <div class=\"adore-loading\">\n        <div class=\"preloader-wrapper small active\">\n            <div class=\"spinner-layer\">\n                <div class=\"circle-clipper left\">\n                    <div class=\"circle\"></div>\n                </div>\n                <div class=\"gap-patch\">\n                    <div class=\"circle\"></div>\n                    </div>\n                    <div class=\"circle-clipper right\">\n                    <div class=\"circle\"></div>\n                </div>\n            </div>\n        </div>\n    </div>";
        return AdoreLoading;
    }());
    exports.AdoreLoading = AdoreLoading;
});
define("widget/AdoreShell", ["require", "exports", "widget/Composite", "ADORE", "event/EventHub", "event/MessageType", "event/Event", "util/WidgetUtil"], function (require, exports, Composite_3, ADORE_3, EventHub_8, MessageType_9, Event_6, WidgetUtil_4) {
    "use strict";
    var AdoreShell = (function (_super) {
        __extends(AdoreShell, _super);
        function AdoreShell(parentId, id, style) {
            _super.call(this, parentId, id, style);
            this.$thisNode = $(AdoreShell.TemplateNormal).attr("id", this.id);
            this.$attachNode = this.$thisNode.find("div.modal-content");
            if ((this.style & ADORE_3.ADORE.Close) === ADORE_3.ADORE.Close) {
                var own_2 = this;
                var $cancleIconNode = $(AdoreShell.TemplateClose);
                $cancleIconNode.appendTo(this.$thisNode.find("div.adore_shell_title"));
                $cancleIconNode.bind("click", function () {
                    EventHub_8.EventHub.dispatchEvent(MessageType_9.MessageType.WIDGET, { "id": own_2.id, evtType: Event_6.Event.ON_CLOSE });
                });
            }
        }
        AdoreShell.prototype.setTitle = function (args) {
            var text = args.title;
            this.$thisNode.find("h4")[0].innerHTML = text;
        };
        AdoreShell.prototype.show = function () {
            this.$thisNode.find(".adore_shell").css({
                display: "block",
                opacity: 0,
                scaleX: "0.7"
            });
            this.$thisNode.find(".adore_shell").velocity({ opacity: 1, scaleX: "1" }, {
                duration: 320,
                queue: false,
                ease: "easeOutCubic"
            });
            this.$thisNode.find(".myclass").css({
                "width": this.$thisNode.find(".adore_shell").width(),
                "height": this.$thisNode.find(".adore_shell").height(),
                "left": this.$thisNode.find(".adore_shell").offset().left,
                "top": this.$thisNode.find(".adore_shell").offset().top
            });
            if (this.cssStyle) {
                this.$thisNode.find(".adore_shell").css(this.cssStyle);
                this.cssStyle = null;
            }
            $(AdoreShell.TemplateOverlay).attr("id", this.id + "_overlay").appendTo(document.body);
            WidgetUtil_4.WidgetUtil.refreshDialogZIndex(this.$thisNode.find(".adore_shell")[0]);
            var width = this.$thisNode.find(".adore_shell").css("width");
            var height = this.$thisNode.find(".adore_shell").css("height");
            if ((width && width.indexOf("%") === -1) || (height && height.indexOf("%") === -1)) {
                this.originWidth = width;
                this.originHeight = height;
                this.refreshSize();
                var own_3 = this;
                this.resizeListener = function (e) {
                    own_3.refreshSize();
                };
                $(window).on("resize", this.resizeListener);
            }
            if (height && height.indexOf("%") !== -1) {
                height = height.replace(/%/, "");
                if (height >= 90) {
                    this.$thisNode.find(".adore_shell").addClass("adore_shell_max_height");
                }
            }
        };
        AdoreShell.prototype.refreshSize = function () {
            var css = {};
            var totalW = window.innerWidth;
            var totalH = window.innerHeight;
            if (this.originWidth && this.originWidth.indexOf("%") === -1) {
                var width = this.originWidth.replace(/px/g, "");
                if (width >= totalW) {
                    css = $.extend(css, { width: "100%" });
                }
                else {
                    css = $.extend(css, { width: (width / (totalW * 0.01)) + "%" });
                }
            }
            if (this.originHeight && this.originHeight.indexOf("%") === -1) {
                var height = this.originHeight.replace(/px/g, "");
                var hProportion = 0;
                if (height >= totalH) {
                    hProportion = 100;
                    css = $.extend(css, { height: "100%" });
                }
                else {
                    hProportion = height / (totalH * 0.01);
                    css = $.extend(css, {
                        height: hProportion + "%"
                    });
                }
                if (hProportion >= 90) {
                    this.$thisNode.find(".adore_shell").addClass("adore_shell_max_height");
                }
                else {
                    this.$thisNode.find(".adore_shell").removeClass("adore_shell_max_height");
                }
            }
            this.$thisNode.find(".adore_shell").css(css);
            this.$thisNode.find(".myclass").css({
                "width": this.$thisNode.find(".adore_shell").width(),
                "height": this.$thisNode.find(".adore_shell").height(),
                "left": this.$thisNode.find(".adore_shell").offset().left,
                "top": this.$thisNode.find(".adore_shell").offset().top
            });
        };
        AdoreShell.prototype.dispose = function () {
            $("#" + this.id + "_overlay").remove();
            if (this.resizeListener) {
                $(window).off("resize", this.resizeListener);
            }
            _super.prototype.dispose.call(this);
        };
        AdoreShell.prototype.postLayout = function () {
            _super.prototype.postLayout.call(this);
        };
        AdoreShell.TemplateNormal = "<div class=\"wrap_modal\"><iframe class=\"myclass\"></iframe>\n    <div>\n        <div class=\"modal modal-fixed-footer adore_shell\">\n            <div class=\"adore_shell_title\">\n                <h4 class=\"adore_shell_title_content\"></h4>\n            </div>\n            <div class=\"modal-content adore_shell_content\"></div>\n        </div></div></div>";
        AdoreShell.TemplateOverlay = "<div class=\"adore_lean_overlay\"></div>";
        AdoreShell.TemplateClose = "<div class=\"adore_shell_exit_button waves-effect waves-light large mdi-content-clear\"></div>";
        return AdoreShell;
    }(Composite_3.Composite));
    exports.AdoreShell = AdoreShell;
});
define("widget/Audio", ["require", "exports", "widget/Widget"], function (require, exports, Widget_5) {
    "use strict";
    var Audio = (function (_super) {
        __extends(Audio, _super);
        function Audio(parentId, id, style) {
            _super.call(this, parentId, id, style);
            this.$thisNode = $(Audio.Template).attr("id", this.id);
            this.$audioNode = this.$thisNode.find("audio");
            var audio = this.$audioNode.get(0);
            var own = this;
            audio.onended = function () {
                own.$thisNode.remove();
            };
        }
        Audio.prototype.setAudioPath = function (args) {
            var src = args.src;
            this.$audioNode.attr("src", src);
        };
        Audio.prototype.start = function () {
            var audio = this.$audioNode.get(0);
            if (audio.paused) {
                audio.play();
            }
        };
        Audio.prototype.stop = function () {
            var audio = this.$audioNode.get(0);
            if (!audio.paused) {
                audio.pause();
                audio.currentTime = 0;
            }
        };
        Audio.prototype.layout = function () {
            this.append();
        };
        Audio.Template = "<div><audio></audio></div>";
        return Audio;
    }(Widget_5.Widget));
    exports.Audio = Audio;
});
define("widget/Button", ["require", "exports", "widget/Widget", "ADORE", "event/EventHub", "event/MessageType", "event/Event"], function (require, exports, Widget_6, ADORE_4, EventHub_9, MessageType_10, Event_7) {
    "use strict";
    var Button = (function (_super) {
        __extends(Button, _super);
        function Button(parentId, id, style) {
            var _this = this;
            _super.call(this, parentId, id, style);
            this.isFloat = false;
            this.isLarge = false;
            if ((this.style & ADORE_4.ADORE.Float) === ADORE_4.ADORE.Float) {
                this.$thisNode = $(Button.TemplateFloat).attr({ id: this.id });
                this.$btnNode = this.$thisNode.find("a").attr({ id: this.id });
                this.isFloat = true;
            }
            else if ((this.style & ADORE_4.ADORE.Flat) === ADORE_4.ADORE.Flat) {
                this.$thisNode = $(Button.TemplateFlat).attr({ id: this.id });
                this.$btnNode = this.$thisNode;
            }
            else if ((this.style & ADORE_4.ADORE.Normal) === ADORE_4.ADORE.Normal) {
                this.$thisNode = $(Button.TemplateNormal).attr({ id: this.id });
                this.$btnNode = this.$thisNode;
            }
            if ((this.style & ADORE_4.ADORE.Large) === ADORE_4.ADORE.Large) {
                this.$btnNode.addClass("btn-large");
                this.isLarge = true;
            }
            var own = this;
            this.$btnNode.on("click", function (e) {
                if (_this.enabled) {
                    EventHub_9.EventHub.dispatchEvent(MessageType_10.MessageType.WIDGET, { id: _this.id, evtType: Event_7.Event.CLICK });
                }
            }).on("focus", function (e) {
                if (_this.enabled) {
                    _this.sendFocusGain();
                }
            });
        }
        Button.prototype.setFocus = function () {
            if (document.activeElement !== this.$btnNode[0]) {
                this.$btnNode.focus();
            }
        };
        Button.prototype.setTooltip = function (args) {
            this.tooltip = args.tooltip;
            this.$thisNode.attr("data-tooltip", this.tooltip);
            this.$thisNode.tooltip({ delay: 50 });
        };
        Button.prototype.setEnabled = function (args) {
            _super.prototype.setEnabled.call(this, args);
            if (this.enabled) {
                this.$thisNode.removeClass("disabled");
            }
            else {
                this.$thisNode.addClass("disabled");
            }
        };
        Button.prototype.setText = function (args) {
            this.text = args.text;
            this.$btnNode.find("span").text(this.text);
            this.adjustInternalLayout();
        };
        Button.prototype.setIcon = function (args) {
            this.icon = args.icon;
            this.$btnNode.find("i").attr("class", this.icon);
            if (this.isLarge) {
                this.$btnNode.find("i").css("font-size", "3rem");
            }
            this.adjustInternalLayout();
        };
        Button.prototype.adjustInternalLayout = function () {
            if (this.icon && this.text) {
                this.$btnNode.find("span").addClass("adore_button_span");
                this.$btnNode.find("i").addClass("adore_button_icon");
            }
            else {
                this.$btnNode.find("span").removeClass("adore_button_span");
                this.$btnNode.find("i").removeClass("adore_button_icon");
            }
        };
        Button.prototype.postLayout = function () {
            window.Waves.displayEffect({ id: this.id });
        };
        Button.prototype.css = function (args) {
            if (this.isFloat) {
                this.$btnNode.css(args.cssStyle);
            }
            else {
                _super.prototype.css.call(this, args);
            }
        };
        Button.prototype.refreshToolbar = function (children) {
            children.postLayout();
            var childCls = children.$btnNode[1].className
                .replace("waves-effect btn-flat adore_button adore_button_flat btn-large", "");
            children.$btnNode.removeClass(childCls).addClass("adore_toolbar_color");
        };
        Button.TemplateNormal = "\n        <div class=\"waves-effect waves-light btn adore_button\" tabindex=\"-1\" data-position=\"top\" data-delay=\"50\">\n            <span></span>\n            <i></i>\n        </div>";
        Button.TemplateFloat = "\n        <div>\n            <a class=\"btn-floating waves-effect waves-light adore_button\" tabindex=\"-1\" data-position=\"top\" data-delay=\"50\"><span></span><i></i></a>\n        </div>";
        Button.TemplateFlat = "<a class=\"waves-effect btn-flat adore_button adore_button_flat\" tabindex=\"-1\" data-position=\"top\" data-delay=\"50\"><i></i><span></span></a>";
        return Button;
    }(Widget_6.Widget));
    exports.Button = Button;
});
define("widget/CalendarCombo", ["require", "exports", "widget/Widget", "event/EventHub", "event/MessageType", "event/Event"], function (require, exports, Widget_7, EventHub_10, MessageType_11, Event_8) {
    "use strict";
    var CalendarCombo = (function (_super) {
        __extends(CalendarCombo, _super);
        function CalendarCombo(parentId, id, style) {
            _super.call(this, parentId, id, style);
            this.defaultPattern = "yyyymmmmdd";
            this.$thisNode = $(CalendarCombo.template).attr("id", this.id);
            this.$dateNode = this.$thisNode.find("input");
            this.dateElement = this.$dateNode.get(0);
            var own = this;
            this.dateElement.readOnly = true;
            this.$dateNode.on("change", function (e) {
                own.handleInput();
            });
            this.$dateNode.on("focus", function (e) {
                if (!own.isHadFocusGain()) {
                    own.setHadFocusGain(true);
                    own.sendFocusGain();
                }
                else {
                    e.preventDefault();
                }
                own.handleFocus();
            });
            this.$thisNode.on("blur", function (e) {
                own.setHadFocusGain(false);
                own.handleBlur();
            });
            this.$dateNode.attr("id", this.id + "_date");
            this.$thisNode.find("label").attr("for", this.id + "_date");
            this.hadFocusGain = false;
            this.isLayout = false;
            this.enabled = true;
            this.hadCloseDatePicker = true;
            this.pattern = this.defaultPattern;
        }
        CalendarCombo.prototype.handleInput = function () {
            var date;
            var charNum;
            var charIndexOfMonthIcon;
            charIndexOfMonthIcon = this.dateElement.value.indexOf("月");
            date = this.dateElement.value.replace("月", "");
            charNum = date.length;
            if (charNum % 2 === 1) {
                var leftPartOfDate = date.slice(0, charIndexOfMonthIcon - 1);
                var rightPartOfDate = date.slice(charIndexOfMonthIcon - 1);
                date = leftPartOfDate + "0" + rightPartOfDate;
            }
            this.setText({ text: date });
            EventHub_10.EventHub.dispatchEvent(MessageType_11.MessageType.WIDGET, {
                id: this.id,
                text: date,
                evtType: Event_8.Event.MODIFY,
                syncAttrName: "text"
            });
        };
        CalendarCombo.prototype.postLayout = function () {
            var tmp = this.pattern;
            this.$dateNode.pickadate({
                selectMonths: true,
                selectYears: 30,
                format: tmp,
                monthsFull: ["1月", "2月", "3月", "4月", "5月", "6月", "7月", "8月", "9月", "10月", "11月", "12月"],
                monthsShort: ["一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"],
                weekdaysFull: ["星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"],
                today: "今天",
                clear: "清除",
                close: "关闭"
            });
            this.isLayout = true;
            this.setText({ text: this.text });
            var own = this;
            this.$dateNode.on("close", function () {
                own.handleFocus();
                own.handleClose();
                own.setHadFocusGain(true);
            });
            this.$dateNode.on("open", function () {
                own.handleOpen();
                own.setHadFocusGain(true);
            });
        };
        CalendarCombo.prototype.isHadFocusGain = function () {
            return this.hadFocusGain;
        };
        CalendarCombo.prototype.setHadFocusGain = function (hadFocusGain) {
            this.hadFocusGain = hadFocusGain;
        };
        CalendarCombo.prototype.handleFocus = function () {
            this.$dateNode.addClass("adore_calendar_combo_focus");
            this.$dateNode.siblings("label").addClass("adore_calendar_combo_label_focus");
            this.$dateNode.siblings("label, i").addClass("active");
            this.$thisNode.focus();
            this.setText({ text: this.text });
        };
        CalendarCombo.prototype.handleClose = function () {
            this.hadCloseDatePicker = true;
        };
        CalendarCombo.prototype.handleOpen = function () {
            this.hadCloseDatePicker = false;
        };
        CalendarCombo.prototype.handleBlur = function () {
            this.$dateNode.removeClass("adore_calendar_combo_focus");
            this.$dateNode.siblings("label").removeClass("adore_calendar_combo_label_focus");
            var val = this.$dateNode.val();
            this.setText({ text: val });
        };
        CalendarCombo.prototype.setText = function (args) {
            this.text = args.text;
            if (this.isLayout) {
                this.dateElement.value = this.text;
                if (this.text && this.text.length > 0) {
                    this.$dateNode.siblings("label,i").addClass("active");
                }
                else {
                    this.$dateNode.siblings("label, i").removeClass("active");
                }
            }
            if (this.requisite) {
                if (args.text === null || args.text === "") {
                    this.addRequisite();
                }
                else {
                    this.removeRequisite();
                }
            }
        };
        CalendarCombo.prototype.setRequisite = function (args) {
            this.requisite = args.requisite;
            var tempText = this.text;
            this.setText({ text: tempText });
        };
        CalendarCombo.prototype.setIcon = function (args) {
            this.$thisNode.find("i").attr("class", args.icon);
        };
        CalendarCombo.prototype.setName = function (args) {
            this.$thisNode.find("label").text(args.name);
        };
        CalendarCombo.prototype.setEnabled = function (args) {
            this.enabled = args.enabled;
            if (this.enabled) {
                this.$thisNode.find("input").removeAttr("disabled");
                this.$thisNode.find("i").removeClass("icon_disabled");
                this.$thisNode.find("label").removeClass("adore_calendar_combo_label_disable");
            }
            else {
                this.$thisNode.find("input").attr("disabled", "disabled");
                this.$thisNode.find("i").addClass("icon_disabled");
                this.$thisNode.find("label").addClass("adore_calendar_combo_label_disable");
            }
        };
        CalendarCombo.prototype.setPattern = function (args) {
            this.pattern = args.pattern;
            this.pattern = this.pattern.replace("MM", "mmmm");
            if (this.pattern.length !== 12 && this.pattern.length !== 10) {
                this.pattern = this.defaultPattern;
            }
            else if (this.pattern.replace("yyyy", "").replace("mmmm", "").replace("dd", "").length !== 0 &&
                this.pattern.replace("yyyy", "").replace("mmmm", "").replace("dd", "").length !== 2) {
                this.pattern = this.defaultPattern;
            }
            var tmp = this.pattern;
            if (this.isLayout) {
                this.$dateNode.pickadate({
                    format: tmp
                });
            }
        };
        CalendarCombo.prototype.setFocus = function () {
            if (this.hadFocusGain) {
                return;
            }
            if (this.hadCloseDatePicker && document.activeElement !== this.$dateNode[0]) {
                this.$dateNode.focus();
            }
        };
        CalendarCombo.prototype.handleKeyDownEvent = function (e, hasFilter) {
            if (this.hadCloseDatePicker) {
                _super.prototype.handleKeyDownEvent.call(this, e, hasFilter);
            }
        };
        CalendarCombo.prototype.handleKeyUpEvent = function (e) {
            if (this.hadCloseDatePicker) {
                _super.prototype.handleKeyUpEvent.call(this, e);
            }
        };
        CalendarCombo.prototype.addRequisite = function () {
            if (this.enabled) {
                this.$dateNode.addClass("adore_InputRequisite");
                this.$dateNode.siblings("label").addClass("adore_requisiteColor");
                this.$dateNode.siblings("i").addClass("adore_requisiteColor");
                this.$dateNode.removeClass("adore_calendar_combo_focus");
                this.$dateNode.siblings("label").removeClass("adore_calendar_combo_label_focus");
            }
        };
        CalendarCombo.prototype.removeRequisite = function () {
            this.$dateNode.removeClass("adore_InputRequisite");
            this.$dateNode.siblings("label").removeClass("adore_requisiteColor");
            this.$dateNode.siblings("i").removeClass("adore_requisiteColor");
            if (this.enabled && this.hadFocusGain) {
                this.$dateNode.addClass("adore_calendar_combo_focus");
                this.$dateNode.siblings("label").addClass("adore_calendar_combo_label_focus");
            }
        };
        CalendarCombo.template = "\n    <div class=\"input-field adore_calendar_combo\" tabIndex=\"-1\">\n        <i></i>\n        <input type=\"date\" class=\"datepicker\" tabIndex=\"-1\">\n        <label></label>\n    </div>\n    ";
        return CalendarCombo;
    }(Widget_7.Widget));
    exports.CalendarCombo = CalendarCombo;
});
define("widget/cef/ACefNativeWindow", ["require", "exports", "widget/Widget"], function (require, exports, Widget_8) {
    "use strict";
    var ACefNativeWindow = (function (_super) {
        __extends(ACefNativeWindow, _super);
        function ACefNativeWindow(parentId, id, style) {
            _super.call(this, parentId, id, style);
            this.hadWindowHandle = false;
            this.$thisNode = $(ACefNativeWindow.Template).attr({ id: this.id });
            this.$plugin = this.$thisNode.find("embed");
        }
        ACefNativeWindow.prototype.setHandle = function (args) {
            this.windowHandle = args.handle;
            if ($("#" + this.id).length !== 0) {
                if (this.windowHandle === 0 || this.windowHandle) {
                    try {
                        this.$plugin[0].setHandle(this.windowHandle);
                        this.hadWindowHandle = true;
                    }
                    catch (e) {
                        console.error(e);
                    }
                }
            }
        };
        ACefNativeWindow.prototype.postLayout = function () {
            _super.prototype.postLayout.call(this);
            if ((this.windowHandle === 0 || this.windowHandle) && !this.hadWindowHandle) {
                if ($("#" + this.id).length !== 0) {
                    setTimeout(this.setHandle({ handle: this.windowHandle }), 300);
                }
                else {
                    var count_1 = 0;
                    var own_4 = this;
                    var func_1 = function () {
                        if ($("#" + own_4.id).length !== 0) {
                            own_4.setHandle({ handle: own_4.windowHandle });
                        }
                        else {
                            count_1++;
                            if (count_1 < 5) {
                                setTimeout(func_1(), 500);
                            }
                        }
                    };
                    setTimeout(func_1, 300);
                }
            }
        };
        ACefNativeWindow.Template = "\n           <div>\n               <embed width=\"100%\" height=\"100%\" type=\"application/x-nativewindow\"></embed>\n           </div>";
        return ACefNativeWindow;
    }(Widget_8.Widget));
    exports.ACefNativeWindow = ACefNativeWindow;
});
define("widget/CheckButton", ["require", "exports", "widget/Widget", "ADORE", "event/EventHub", "event/MessageType", "event/Event", "hotkey/Keys"], function (require, exports, Widget_9, ADORE_5, EventHub_11, MessageType_12, Event_9, Keys_5) {
    "use strict";
    var CheckButton = (function (_super) {
        __extends(CheckButton, _super);
        function CheckButton(parentId, id, style) {
            _super.call(this, parentId, id, style);
            this.isSwitch = false;
            if ((ADORE_5.ADORE.Switch & style) === ADORE_5.ADORE.Switch) {
                this.$thisNode = $(CheckButton.template1).attr("id", this.id);
                this.isSwitch = true;
            }
            else {
                this.$thisNode = $(CheckButton.template0).attr("id", this.id);
            }
            var tmpId = this.id;
            this.$thisNode.find("input[type=checkbox]").attr("id", this.id + "_checkbox").on("change", function (e) {
                EventHub_11.EventHub.dispatchEvent(MessageType_12.MessageType.WIDGET, {
                    id: tmpId,
                    checked: this.checked + "",
                    evtType: Event_9.Event.ON_CHANGE,
                    syncAttrName: this.checked
                });
            });
            if (this.isSwitch === false) {
                this.$thisNode.find("label").attr("for", this.id + "_checkbox");
            }
            var own = this;
            this.$thisNode.find("input").on("focus", function (e) {
                own.sendFocusGain();
            }).on("blur", function (e) {
                own.handleBlur();
            });
        }
        CheckButton.prototype.setName = function (args) {
            if (this.isSwitch === false) {
                this.$thisNode.find("label").text(args.name);
            }
        };
        CheckButton.prototype.setGroupName = function (args) {
            this.groupName = args.group;
            this.$thisNode.find("input").attr("name", this.groupName);
        };
        CheckButton.prototype.setChecked = function (args) {
            var isChecked = args.isChecked;
            var checked = this.$thisNode.find("input")[0].checked;
            if (isChecked !== checked) {
                if (this.enabled === false) {
                    this.$thisNode.find("input").removeAttr("disabled");
                    this.$thisNode.find("input").click();
                    this.$thisNode.find("input").attr("disabled", "disabled");
                }
                else {
                    this.$thisNode.find("input").click();
                }
            }
        };
        CheckButton.prototype.setEnabled = function (args) {
            this.enabled = args.enabled;
            if (this.enabled) {
                this.$thisNode.find("input").removeAttr("disabled");
            }
            else {
                this.$thisNode.find("input").attr("disabled", "disabled");
            }
        };
        CheckButton.prototype.handleBlur = function () {
            this.$thisNode.find("label").removeClass("adore_check_button_focus_label");
        };
        CheckButton.prototype.setFocus = function () {
            var inputNode = this.$thisNode.find("input");
            if (document.activeElement !== inputNode[0]) {
                inputNode.focus();
            }
            this.$thisNode.find("label").addClass("adore_check_button_focus_label");
        };
        CheckButton.prototype.handleKeyDownEvent = function (e, hasFilter) {
            if (e.keyCode === Keys_5.Keys.SPACE || e.keyCode === Keys_5.Keys.ENTER || e.keyCode === Keys_5.Keys.NUMPAD_ENTER) {
                this.$thisNode.find("input").click();
                e.preventDefault();
                return;
            }
            _super.prototype.handleKeyDownEvent.call(this, e, hasFilter);
        };
        CheckButton.prototype.handleKeyUpEvent = function (e) {
            if (e.keyCode === Keys_5.Keys.SPACE || e.keyCode === Keys_5.Keys.ENTER || e.keyCode === Keys_5.Keys.NUMPAD_ENTER) {
                return;
            }
            _super.prototype.handleKeyUpEvent.call(this, e);
        };
        CheckButton.template0 = "<div class=\"adore_check_button\">\n    <input type=\"checkbox\" tabindex=\"-1\"/>\n    <label></label>\n    </div>";
        CheckButton.template1 = "<div class=\"switch\">\n    <label>\n        <input type=\"checkbox\" tabindex=\"-1\">\n        <span class=\"lever\"></span>\n    </label>\n    </div>";
        return CheckButton;
    }(Widget_9.Widget));
    exports.CheckButton = CheckButton;
});
define("widget/Clock", ["require", "exports", "widget/Widget", "ADORE"], function (require, exports, Widget_10, ADORE_6) {
    "use strict";
    var Clock = (function (_super) {
        __extends(Clock, _super);
        function Clock(parentId, id, style) {
            _super.call(this, parentId, id, style);
            this.clockHeight = 300;
            this.DefaultClockSideLengthGS = 300;
            if (style === ADORE_6.ADORE.Normal) {
                this.$thisNode = $(Clock.ClockTemplateLS).attr({ id: this.id });
                this.$clockNode = this.$thisNode.find("nobr");
                this.setFontSize = this.setFontSizeLS;
                this.setAlignment = this.setAlignmentLS;
                this.startRedrawClock = this.startRedrawClockLS;
                this.setClockHeight = function (args) { };
                this.startRedrawClock();
            }
            else if ((style & ADORE_6.ADORE.Graphics) === ADORE_6.ADORE.Graphics) {
                this.$thisNode = $(Clock.ClockTemplateGS).attr({ id: this.id });
                this.setFontSize = function (args) { };
                this.setAlignment = function (args) { };
                this.startRedrawClock = function () { };
                this.setClockHeight = this.setClockHeightGS;
            }
            this.dispose = this.disposeClock;
        }
        Clock.prototype.setFontSizeLS = function (args) {
            this.$clockNode.css({ fontSize: args.fontSize });
        };
        Clock.prototype.setAlignmentLS = function (args) {
            this.$clockNode.css({ textAlign: args.alignment });
        };
        Clock.prototype.startRedrawClockLS = function () {
            var own = this;
            this.intervalId = setInterval(function () { own.redrawClockOnceLS(own); }, 1000);
        };
        Clock.prototype.redrawClockOnceLS = function (own) {
            var currentDate = new Date();
            var clockText;
            clockText = currentDate.getFullYear() + "-" + (+currentDate.getMonth() + 1) + "-" + currentDate.getDate() + " " + currentDate.getHours() + ":" + currentDate.getMinutes() + ":" + currentDate.getSeconds();
            own.$clockNode.get(0).innerHTML = clockText;
        };
        Clock.prototype.createClockPanelGS = function () {
            var mainGS = this.$thisNode.find(".clock-GS-main");
            var bodyGS = this.$thisNode.find(".clock-GS-body");
            var panelGS = this.$thisNode.find(".clock-GS-panel");
            var own = this;
            this.$thisNode.css("height", this.clockHeight + "px");
            var shortSideLength = Math.min(this.$thisNode.get(0).clientWidth, this.$thisNode.get(0).clientHeight);
            mainGS.css({ width: this.DefaultClockSideLengthGS + "px", height: this.DefaultClockSideLengthGS + "px" });
            mainGS.css("transform", "scale(" + (shortSideLength / this.DefaultClockSideLengthGS) + ")");
            var createMinuteLine = function (angle) {
                var anchor = $("<div>").add("clock-GS-anchor");
                var minuteLine = $("<div>").addClass("clock-GS-minuteLine");
                var radius = own.DefaultClockSideLengthGS / 2 * 0.8;
                anchor.css("transform", "rotate(" + angle + "deg)");
                minuteLine.css("transform", "translate(-50%,-100%) translateY(-" + radius + "px)");
                anchor.append(minuteLine);
                panelGS.append(anchor);
            };
            var createMinuteText = function (angle) {
                var minuteText = $("<div>").addClass("clock-GS-minuteText");
                var radius = own.DefaultClockSideLengthGS / 2 * 0.84;
                var topOffset = 0 - Math.cos(angle * Math.PI / 180) * radius;
                var leftOffset = Math.sin(angle * Math.PI / 180) * radius;
                minuteText.get(0).innerHTML = "" + angle / 6;
                minuteText.css({ top: topOffset + "px", left: leftOffset + "px" });
                panelGS.append(minuteText);
            };
            var createHourText = function (angle) {
                var hourText = $("<div>").addClass("clock-GS-hourText clock-GS-hour" + angle / 30);
                var radius = own.DefaultClockSideLengthGS / 2 * 0.65;
                var topOffset = 0 - Math.cos(angle * Math.PI / 180) * radius;
                var leftOffset = Math.sin(angle * Math.PI / 180) * radius;
                hourText.get(0).innerHTML = "" + angle / 30;
                hourText.css({ top: topOffset + "px", left: leftOffset + "px" });
                panelGS.append(hourText);
            };
            for (var angle = 1; angle <= 360; angle++) {
                if (angle % 6 === 0) {
                    if (angle % 30 === 0) {
                        createMinuteText(angle);
                        createHourText(angle);
                    }
                    else {
                        createMinuteLine(angle);
                    }
                }
            }
        };
        Clock.prototype.createClockAnchorGS = function () {
            var hourAnchor = this.$thisNode.find(".clock-GS-hour-anchor");
            var minuterAnchor = this.$thisNode.find(".clock-GS-minute-anchor");
            var secondAnchor = this.$thisNode.find(".clock-GS-second-anchor");
            var now = new Date();
            var seconds = (now.getHours() >= 12 ? now.getHours() - 12 : now.getHours()) * 3600 + now.getMinutes() * 60 + now.getSeconds();
            var hourRotateAngle = seconds / 120;
            var minuteRotateAngle = (seconds / 10) % 360;
            var secondRotateAngle = (seconds * 6) % 360;
            hourAnchor.css("transform", "rotate(" + hourRotateAngle + "deg)");
            minuterAnchor.css("transform", "rotate(" + minuteRotateAngle + "deg)");
            secondAnchor.css("transform", "rotate(" + secondRotateAngle + "deg)");
        };
        Clock.prototype.setClockHeightGS = function (args) {
            this.clockHeight = args.height;
            this.$thisNode.css("height", this.clockHeight + "px");
            var shortSideLength = Math.min(this.$thisNode.get(0).clientWidth, this.$thisNode.get(0).clientHeight);
            if (shortSideLength !== 0) {
                this.$thisNode.find(".clock-GS-panel").css("transform", "scale(" + shortSideLength / this.DefaultClockSideLengthGS + ")");
            }
        };
        Clock.prototype.postLayout = function () {
            this.createClockPanelGS();
            this.createClockAnchorGS();
        };
        Clock.prototype.disposeClock = function () {
            if (this.intervalId) {
                clearInterval(this.intervalId);
            }
            _super.prototype.dispose.call(this);
        };
        Clock.ClockTemplateLS = "\n    <div style=\"display: flex;align-items: center;justify-content: center;width: 100%\">\n        <nobr class=\"adore_label\" style=\"width:100%\"></nobr>\n    </div>\n    ";
        Clock.ClockTemplateGS = "\n    <div style=\"display: flex;align-items: center;justify-content: center;width: 100%\">\n        <div class=\"clock-GS-main\">\n            <div class=\"clock-GS-body\">\n                 <div class=\"clock-GS-panel\"></div>\n                 <div class=\"clock-GS-hour-anchor\">\n                    <div class=\"clock-GS-hour-rotate\">\n                          <div class=\"clock-GS-hour-thinhand\"></div>\n                          <div class=\"clock-GS-hour-fathand\"></div>\n                    </div>\n                 </div>\n                 <div class=\"clock-GS-minute-anchor\">\n                    <div class=\"clock-GS-minute-rotate\">\n                         <div class=\"clock-GS-minute-thinhand\"></div>\n                         <div class=\"clock-GS-minute-fathand\"></div>\n                    </div>\n                 </div>\n                 <div class=\"clock-GS-second-anchor\">\n                    <div class=\"clock-GS-second-rotate\">\n                        <div class=\"clock-GS-second-hand\"></div>\n                    </div>\n                 </div>\n            </div>\n        </div>\n    </div>\n    ";
        return Clock;
    }(Widget_10.Widget));
    exports.Clock = Clock;
});
define("widget/DateText", ["require", "exports", "widget/Widget", "widget/validator/MaxLengthValidator", "event/EventHub", "event/MessageType", "event/Event", "util/SoftwareKeyboardUtil", "hotkey/Keys"], function (require, exports, Widget_11, MaxLengthValidator_2, EventHub_12, MessageType_13, Event_10, SoftwareKeyboardUtil_2, Keys_6) {
    "use strict";
    var DateText = (function (_super) {
        __extends(DateText, _super);
        function DateText(parentId, id, style) {
            _super.call(this, parentId, id, style);
            this.$thisNode = $(DateText.TemplateCotainer).attr({ id: this.id + "_containerNode" });
            var own = this;
            this.maxLength = 8;
            this.$thisNode.find("input").attr("id", this.id).on("input", function (e) {
                own.handleOnInput();
                EventHub_12.EventHub.dispatchEvent(MessageType_13.MessageType.WIDGET, {
                    id: id,
                    text: $(this).val(),
                    evtType: Event_10.Event.MODIFY,
                    syncAttrName: "text"
                });
            }).on('focus', function () {
                own.sendFocusGain();
                SoftwareKeyboardUtil_2.SoftwareKeyboardUtil.refresh();
            }).on('blur', function () {
                own.checkRequisite();
                own.handleOnBlur();
            });
        }
        DateText.prototype.handleOnInput = function () {
            this.maxLengthValidator.handleModifyEvent();
            this.checkRequisite();
            if (!this.format) {
                this.format = "yyyy-MM-dd";
            }
            var content = this.$thisNode.find("input").val();
            if (content.length === 8) {
                var year = content.substr(0, 4);
                var month = content.substr(4, 2);
                var day = content.substr(6, 2);
                var date = new Date(year + "," + month + "," + day);
                if (date.toString().indexOf("Invalid") === -1) {
                    var format_date = this.format;
                    format_date = format_date.replace(/yyyy/, year).replace(/MM/, month).replace(/dd/, day);
                    this.$thisNode.find("input").val(format_date);
                    this.maxLengthValidator.setMaxLength(this.format.length);
                }
            }
        };
        DateText.prototype.handleOnBlur = function () {
            var $inputNode = this.$thisNode.find("input");
            if (!this.format) {
                this.format = "yyyy-MM-dd";
            }
            var content = $inputNode.val();
            if (content !== null) {
                if (content === "19000101" || content === "") {
                    return;
                }
                else if (content.length >= 8) {
                    var year = void 0, month = void 0, day = void 0;
                    if (content.indexOf("-") !== -1) {
                        var dateArray1 = content.split("-");
                        year = dateArray1[0];
                        month = dateArray1[1];
                        day = dateArray1[2];
                    }
                    else if (content.indexOf("/") !== -1) {
                        var dateArray2 = content.split("/");
                        year = dateArray2[0];
                        month = dateArray2[1];
                        day = dateArray2[2];
                    }
                    else if (content.indexOf(".") === -1) {
                        year = content.substr(0, 4);
                        month = content.substr(4, 2);
                        day = content.substr(6, 2);
                    }
                    var date = new Date(year + "," + month + "," + day);
                    if (year !== "" && month !== "" && day !== "" && date.toString().indexOf("Invalid") === -1) {
                        var format_date = this.format;
                        format_date = format_date.replace(/yyyy/, year).replace(/MM/, month).replace(/dd/, day);
                        $inputNode.val(format_date);
                        return;
                    }
                }
            }
            this.showSpan("输入有误，请重新输入！");
            this.$thisNode.find("input").focus();
        };
        DateText.prototype.checkRequisite = function () {
            if (this.requisite) {
                var inputSelector = this.$thisNode.find("input");
                var value = inputSelector.val();
                if (value) {
                    this.removeRequisite();
                }
                else {
                    this.addRequisite();
                    this.showSpan("请输入数据！");
                }
            }
        };
        DateText.prototype.setRequisite = function (args) {
            this.requisite = args.requisite;
            if (this.requisite) {
                if (this.$thisNode.find("input").val()) {
                    this.removeRequisite();
                }
                else {
                    this.addRequisite();
                }
            }
        };
        DateText.prototype.setEnabled = function (args) {
            var enabled = args.enabled;
            var input = this.$thisNode.find("input");
            if (enabled) {
                input.removeAttr("disabled");
                this.$thisNode.find("i").removeClass("icon_disabled");
                if (this.requisite) {
                    if (input.val() === null || input.val() === "") {
                        this.addRequisite();
                    }
                }
            }
            else {
                this.$thisNode.find("input").attr("disabled", "disabled");
                if (this.requisite) {
                    this.removeRequisite();
                }
                this.$thisNode.find("i").addClass("icon_disabled");
            }
        };
        DateText.prototype.addRequisite = function () {
            this.$thisNode.find("input").addClass("adore_InputRequisite");
            this.$thisNode.find("label").addClass("adore_requisiteColor");
            this.$thisNode.find("i").addClass("adore_requisiteColor");
        };
        DateText.prototype.removeRequisite = function () {
            this.$thisNode.find("input").removeClass("adore_InputRequisite");
            this.$thisNode.find("label").removeClass("adore_requisiteColor");
            this.$thisNode.find("i").removeClass("adore_requisiteColor");
        };
        DateText.prototype.handleKeyDownEvent = function (e, hasFilter) {
            if (e.keyCode !== Keys_6.Keys.SHIFT && e.keyCode !== Keys_6.Keys.TAB
                && e.keyCode !== Keys_6.Keys.ENTER && e.keyCode !== Keys_6.Keys.LEFT_ARROW
                && e.keyCode !== Keys_6.Keys.UP_ARROW && e.keyCode !== Keys_6.Keys.RIGHT_ARROW
                && e.keyCode !== Keys_6.Keys.DOWN_ARROW && e.keyCode !== Keys_6.Keys.BACKSPACE && (e.keyCode < Keys_6.Keys.NUM_0 || e.keyCode > Keys_6.Keys.NUM_9)
                && (e.keyCode < Keys_6.Keys.NUMPAD_0 || e.keyCode > Keys_6.Keys.NUMPAD_9)) {
                e.preventDefault();
            }
            var value = this.$thisNode.find("input").val();
            if (value.length > 8 && e.keyCode === Keys_6.Keys.BACKSPACE) {
                value = value.replace(/-/g, "").replace(/\//g, "");
                this.$thisNode.find("input").val(value);
                this.maxLengthValidator.setMaxLength(this.maxLength);
            }
            _super.prototype.handleKeyDownEvent.call(this, e, hasFilter);
        };
        DateText.prototype.setMaxLength = function (args) {
            this.maxLength = args.maxLength;
        };
        DateText.prototype.handleMaxLength = function () {
            var textNode = this.$thisNode.find("input")[0];
            this.maxLengthValidator = new MaxLengthValidator_2.MaxLengthValidator(this.id, textNode, this.maxLength);
        };
        DateText.prototype.setText = function (args) {
            var inputNode = this.$thisNode.find("input");
            inputNode.val(args.text);
            if (args.text.length > 0) {
                inputNode.siblings('label, i').addClass('active');
            }
            else {
                inputNode.siblings('label, i').removeClass('active');
            }
        };
        DateText.prototype.showSpan = function (msg) {
            if (this.$thisNode.find("span").css("display") === "none") {
                this.$thisNode.find("span").html(msg).show().delay(2000).fadeOut(300);
            }
        };
        DateText.prototype.setIcon = function (args) {
            this.$thisNode.find("i").addClass(args.icon);
            if (this.$thisNode.find("input").val().length > 0) {
                this.$thisNode.find("input").siblings("label, i").addClass("active");
            }
            this.$thisNode.find("span").addClass("span_prefix");
        };
        DateText.prototype.setFocus = function () {
            if (document.activeElement !== this.$thisNode.find("input")[0]) {
                this.$thisNode.find("input").focus();
            }
        };
        DateText.prototype.setName = function (args) {
            this.$thisNode.find("label").text(args.name);
        };
        DateText.prototype.setFormat = function (args) {
            this.format = args.format;
        };
        DateText.prototype.postLayout = function () {
            _super.prototype.postLayout.call(this);
            this.handleMaxLength();
        };
        DateText.TemplateCotainer = "\n            <div class=\"input-field\">\n                <input type=\"text\">\n                <label></label>\n                <span class=\"span_base\"></span>\n            </div>\n            ";
        return DateText;
    }(Widget_11.Widget));
    exports.DateText = DateText;
});
define("widget/DrawerMenu", ["require", "exports", "widget/Widget", "event/EventHub", "event/MessageType", "event/Event"], function (require, exports, Widget_12, EventHub_13, MessageType_14, Event_11) {
    "use strict";
    var DrawerMenu = (function (_super) {
        __extends(DrawerMenu, _super);
        function DrawerMenu(parentId, id, style) {
            _super.call(this, parentId, id, style);
            this.$thisNode = $(DrawerMenu.Template).attr("id", this.id);
            this.contentOne = new Array();
            this.contentTwo = new Array();
            this.contentThree = new Array();
            this.contentFour = new Array();
        }
        DrawerMenu.prototype.setContents = function (args) {
            var data = JSON.parse(args.attribute);
            for (var key in data) {
                var cutKey;
                var location;
                var m;
                var n;
                var k;
                var h;
                var belongTo = key.length - key.replace(/,/g, "").length;
                switch (belongTo) {
                    case 0:
                        this.contentOne[parseInt(key)] = data[key];
                        this.contentTwo[parseInt(key)] = new Array();
                        this.contentThree[parseInt(key)] = new Array();
                        this.contentFour[parseInt(key)] = new Array();
                        break;
                    case 1:
                        cutKey = key.substr(1, key.length - 2);
                        location = cutKey.split(",");
                        m = Number(location[0]);
                        n = Number(location[1]);
                        this.contentTwo[m][n] = data[key];
                        this.contentThree[m][n] = new Array();
                        this.contentFour[m][n] = new Array();
                        break;
                    case 2:
                        cutKey = key.substr(1, key.length - 2);
                        location = cutKey.split(",");
                        var m = Number(location[0]);
                        var n = Number(location[1]);
                        var k = Number(location[2]);
                        this.contentThree[m][n][k] = data[key];
                        this.contentFour[m][n][k] = new Array();
                        break;
                    case 3:
                        cutKey = key.substr(1, key.length - 2);
                        location = cutKey.split(",");
                        var m = Number(location[0]);
                        var n = Number(location[1]);
                        var k = Number(location[2]);
                        var h = Number(location[3]);
                        this.contentFour[m][n][k][h] = data[key];
                        break;
                    default:
                        console.log("data error");
                        break;
                }
            }
        };
        DrawerMenu.prototype.setIconPaths = function (args) {
            var pathData = JSON.parse(args.iconPaths);
            for (var key in pathData) {
                var path = pathData[key];
                if (path.indexOf("file:") === 0)
                    path = path.replace(/\\/g, "\\\\");
                this.$thisNode.find("li:eq(" + parseInt(key) + ") a i.svg_icon").css({
                    "background-image": "url(" + path + ")",
                    "width": "1em",
                    "height": "1em"
                });
            }
        };
        DrawerMenu.prototype.initDropdown = function () {
            var Index1 = 0, Index2 = 0, Index3 = 0, Index4 = 0;
            var flagTwo = false, flagThree = false, flagFour = false;
            var content = "";
            var own = this;
            var block_height = 48;
            var wrapperTwoNode = $("");
            var wrapperThreeNode = $("");
            var wrapperFourNode = $("");
            var drawerMenu_deg_twoNode = $("");
            var drawerMenu_deg_threeNode = $("");
            var drawerMenu_deg_fourNode = $("");
            for (var i = 0; i < this.contentTwo.length; i++) {
                if (this.contentTwo[i].length > 0) {
                    flagTwo = true;
                    break;
                }
            }
            for (var i = 0; i < this.contentThree.length; i++) {
                for (var j = 0; j < this.contentThree[i].length; j++) {
                    if (this.contentThree[i][j].length > 0) {
                        flagThree = true;
                        break;
                    }
                }
                if (flagThree) {
                    break;
                }
            }
            for (var i = 0; i < this.contentFour.length; i++) {
                for (var j = 0; j < this.contentFour[i].length; j++) {
                    for (var m = 0; m < this.contentFour[i][j].length; m++) {
                        if (this.contentFour[i][j].length > 0) {
                            flagFour = true;
                            break;
                        }
                    }
                    if (flagFour) {
                        break;
                    }
                }
                if (flagFour) {
                    break;
                }
            }
            if (this.$thisNode.find("li").length > 0) {
                this.$thisNode.empty();
                $("#" + this.id + "wrapperTwo").remove();
                $("#" + this.id + "wrapperThree").remove();
                $("#" + this.id + "wrapperFour").remove();
            }
            for (var i_1 = 0, z = this.contentOne.length; i_1 < z; i_1++) {
                if (this.contentTwo[i_1].length > 0) {
                    this.$thisNode.append($("<li><a href='###'><i class='svg_icon'></i>" + this.contentOne[i_1] + "<i class='fold'></i></a></li>"));
                }
                else {
                    this.$thisNode.append($("<li><a href='###'><i class='svg_icon'></i>" + this.contentOne[i_1] + "</a></li>"));
                }
            }
            if (flagTwo) {
                wrapperTwoNode = $("<div><iframe class='myclass'></iframe><div><i class='triangle'></i><ul class='drawerMenu_deg_two dropdown-content show_drawerMenu'></ul></div></div>").attr("id", this.id + "wrapperTwo");
                wrapperTwoNode.appendTo("body");
                drawerMenu_deg_twoNode = wrapperTwoNode.find(".dropdown-content");
            }
            if (flagThree) {
                wrapperThreeNode = $("<div><iframe class='myclass'></iframe><div><i class='triangle'></i><ul class='drawerMenu_deg_three dropdown-content show_drawerMenu'></ul></div></div>").attr("id", this.id + "wrapperThree");
                wrapperThreeNode.appendTo("body");
                drawerMenu_deg_threeNode = wrapperThreeNode.find(".dropdown-content");
            }
            if (flagFour) {
                wrapperFourNode = $("<div><iframe class='myclass'></iframe><div><i class='triangle'></i><ul class='drawerMenu_deg_four dropdown-content show_drawerMenu'></ul></div></div>").attr("id", this.id + "wrapperFour");
                wrapperFourNode.appendTo("body");
                drawerMenu_deg_fourNode = wrapperFourNode.find(".dropdown-content");
            }
            this.$thisNode.on("mouseenter", "li", {
                contentTwo: this.contentTwo,
                contentThree: this.contentThree
            }, function (event) {
                drawerMenu_deg_twoNode.empty();
                wrapperTwoNode.find(".myclass").hide();
                wrapperTwoNode.find(".triangle").hide();
                drawerMenu_deg_threeNode.empty();
                wrapperThreeNode.find(".myclass").hide();
                wrapperThreeNode.find(".triangle").hide();
                Index1 = own.$thisNode.find("li").index($(this));
                own.$thisNode.find("li a i.fold").css({
                    "background-image": "url(images/drawer_menu/icon_normal_arrow.png)"
                });
                own.$thisNode.find("li:eq(" + Index1 + ") a i.fold").css({
                    "background-image": "url(images/drawer_menu/icon_pressed_arrow.png)"
                });
                for (var i = 0, z = event.data.contentTwo[Index1].length; i < z; i++) {
                    if (event.data.contentThree[Index1][i].length > 0) {
                        drawerMenu_deg_twoNode.append($("<li><a href='###'>" + event.data.contentTwo[Index1][i] + "<i class='fold'></i></a></li>"));
                    }
                    else {
                        drawerMenu_deg_twoNode.append($("<li><a href='###'>" + event.data.contentTwo[Index1][i] + "</a></li>"));
                    }
                }
                if (drawerMenu_deg_twoNode.find("li").length > 0) {
                    var two_height = drawerMenu_deg_twoNode.height();
                    var primate_height = $(this).offset().top;
                    var screen_height = $(window).height();
                    var aa = screen_height - primate_height - block_height;
                    if (two_height + primate_height >= screen_height) {
                        drawerMenu_deg_twoNode.css({
                            "bottom": aa,
                            "display": "block",
                            "left": $(this).parent().outerWidth() + $(this).parent().offset().left + 12,
                            "top": "auto"
                        });
                        drawerMenu_deg_twoNode.css({
                            "max-height": near(screen_height - aa)
                        });
                        wrapperTwoNode.find(".myclass").css({
                            "width": drawerMenu_deg_twoNode.width(),
                            "height": drawerMenu_deg_twoNode.height(),
                            "left": drawerMenu_deg_twoNode.css("left"),
                            "bottom": drawerMenu_deg_twoNode.css("bottom"),
                            "display": "block",
                            "top": "auto"
                        });
                        wrapperTwoNode.find(".triangle").css({
                            "left": parseInt(drawerMenu_deg_twoNode.css("left")) - 8,
                            "bottom": parseInt(drawerMenu_deg_twoNode.css("bottom")) + 24,
                            "display": "block",
                            "top": "auto"
                        });
                    }
                    else {
                        drawerMenu_deg_twoNode.css({
                            "top": primate_height,
                            "display": "block",
                            "left": $(this).parent().outerWidth() + $(this).parent().offset().left + 12,
                            "bottom": "auto"
                        });
                        drawerMenu_deg_twoNode.css({
                            "max-height": near($(window).height() - $(this).offset().top)
                        });
                        wrapperTwoNode.find(".myclass").css({
                            "width": drawerMenu_deg_twoNode.width(),
                            "height": drawerMenu_deg_twoNode.height(),
                            "left": drawerMenu_deg_twoNode.css("left"),
                            "top": drawerMenu_deg_twoNode.css("top"),
                            "display": "block",
                            "bottom": "auto"
                        });
                        wrapperTwoNode.find(".triangle").css({
                            "left": parseInt(drawerMenu_deg_twoNode.css("left")) - 8,
                            "top": parseInt(drawerMenu_deg_twoNode.css("top")) + 24,
                            "display": "block",
                            "bottom": "auto"
                        });
                    }
                }
            });
            this.$thisNode.on("mouseleave", "li", function (event) {
                var x = event.clientX;
                var y = event.clientY;
                if (drawerMenu_deg_twoNode.offset()) {
                    var borderX = drawerMenu_deg_twoNode.offset().left + drawerMenu_deg_twoNode.width();
                    var borderY = drawerMenu_deg_twoNode.offset().top + drawerMenu_deg_twoNode.height();
                    if ((x >= drawerMenu_deg_twoNode.offset().left - 18) && (x <= borderX) && (y >= drawerMenu_deg_twoNode.offset().top + 10) && (y <= borderY)) {
                        drawerMenu_deg_twoNode.show();
                        wrapperTwoNode.find(".myclass").show();
                    }
                    else {
                        $("#" + own.id + " li ").removeClass("block_fontcolor");
                        cleanBlock();
                    }
                }
            });
            this.$thisNode.on("click", "li", function (event) {
                var apple = $("#" + own.id + " li").index($(this));
                content = "" + apple;
                EventHub_13.EventHub.dispatchEvent(MessageType_14.MessageType.WIDGET, {
                    id: own.id,
                    degree: "1",
                    location: content,
                    evtType: Event_11.Event.CLICK
                });
            });
            drawerMenu_deg_twoNode.on("mouseenter", "li", {
                contentThree: this.contentThree,
                contentFour: this.contentFour
            }, function (event) {
                drawerMenu_deg_threeNode.empty();
                wrapperThreeNode.find(".myclass").hide();
                wrapperThreeNode.find(".triangle").hide();
                drawerMenu_deg_fourNode.empty();
                wrapperFourNode.find(".myclass").hide();
                wrapperFourNode.find(".triangle").hide();
                Index2 = drawerMenu_deg_twoNode.find("li").index($(this));
                drawerMenu_deg_twoNode.find(".fold").css({
                    "background-image": "url(images/drawer_menu/icon_normal_arrow.png)"
                });
                drawerMenu_deg_twoNode.find("li:eq(" + Index2 + ") a i.fold").css({
                    "background-image": "url(images/drawer_menu/icon_pressed_arrow.png)"
                });
                $(this).addClass("block_fontcolor").siblings().removeClass("block_fontcolor");
                for (var i = 0, z = event.data.contentThree[Index1][Index2].length; i < z; i++) {
                    if (event.data.contentFour[Index1][Index2][i].length > 0) {
                        drawerMenu_deg_threeNode.append($("<li><a href='###'>" + event.data.contentThree[Index1][Index2][i] + "<i class='fold'></i></a></li>"));
                    }
                    else {
                        drawerMenu_deg_threeNode.append($("<li><a href='###'>" + event.data.contentThree[Index1][Index2][i] + "</a></li>"));
                    }
                }
                if (drawerMenu_deg_threeNode.find("li").length > 0) {
                    var three_height = drawerMenu_deg_threeNode.height();
                    var primate_height = $(this).offset().top;
                    var screen_height = $(window).height();
                    var aa = screen_height - primate_height - block_height;
                    if (primate_height > aa) {
                        drawerMenu_deg_threeNode.css({
                            "top": "auto",
                            "left": drawerMenu_deg_twoNode.offset().left + drawerMenu_deg_twoNode.width() + 12,
                            "display": "block",
                            "bottom": aa
                        });
                        drawerMenu_deg_threeNode.css({
                            "max-height": near(screen_height - aa)
                        });
                        wrapperThreeNode.find(".myclass").css({
                            "width": drawerMenu_deg_threeNode.width(),
                            "height": drawerMenu_deg_threeNode.height(),
                            "top": drawerMenu_deg_threeNode.css("top"),
                            "left": drawerMenu_deg_threeNode.css("left"),
                            "display": "block",
                            "bottom": drawerMenu_deg_threeNode.css("bottom")
                        });
                        wrapperThreeNode.find(".triangle").css({
                            "left": parseInt(drawerMenu_deg_threeNode.css("left")) - 8,
                            "bottom": parseInt(drawerMenu_deg_threeNode.css("bottom")) + 24,
                            "display": "block",
                            "top": "auto"
                        });
                    }
                    else {
                        drawerMenu_deg_threeNode.css({
                            "top": $(this).offset().top,
                            "left": drawerMenu_deg_twoNode.offset().left + drawerMenu_deg_twoNode.width() + 12,
                            "display": "block",
                            "bottom": "auto"
                        });
                        drawerMenu_deg_threeNode.css({
                            "max-height": near($(window).height() - $(this).offset().top)
                        });
                        wrapperThreeNode.find(".myclass").css({
                            "width": drawerMenu_deg_threeNode.width(),
                            "height": drawerMenu_deg_threeNode.height(),
                            "top": drawerMenu_deg_threeNode.css("top"),
                            "left": drawerMenu_deg_threeNode.css("left"),
                            "display": "block",
                            "bottom": drawerMenu_deg_threeNode.css("bottom")
                        });
                        wrapperThreeNode.find(".triangle").css({
                            "left": parseInt(drawerMenu_deg_threeNode.css("left")) - 8,
                            "top": parseInt(drawerMenu_deg_threeNode.css("top")) + 24,
                            "display": "block",
                            "bottom": "auto"
                        });
                    }
                }
            });
            drawerMenu_deg_twoNode.on("mouseleave", function (event) {
                var x = event.clientX;
                var y = event.clientY;
                if (drawerMenu_deg_threeNode.offset()) {
                    var borderX = drawerMenu_deg_threeNode.offset().left + drawerMenu_deg_threeNode.width();
                    var borderY = drawerMenu_deg_threeNode.offset().top + drawerMenu_deg_threeNode.height();
                    if ((x >= drawerMenu_deg_threeNode.offset().left - 18) && (x <= borderX) && (y >= drawerMenu_deg_threeNode.offset().top + 10) && (y <= borderY)) {
                        drawerMenu_deg_threeNode.show();
                        wrapperThreeNode.find(".myclass").show();
                    }
                    else {
                        $("#" + own.id + " li").removeClass("block_fontcolor");
                        cleanBlock();
                    }
                }
            });
            drawerMenu_deg_twoNode.on("click", "li", function () {
                var apple = drawerMenu_deg_twoNode.find("li").index($(this));
                content = '[' + Index1 + ',' + apple + ']';
                EventHub_13.EventHub.dispatchEvent(MessageType_14.MessageType.WIDGET, {
                    id: own.id,
                    degree: "2",
                    location: content,
                    evtType: Event_11.Event.CLICK
                });
                if (drawerMenu_deg_threeNode.find("li").length == 0) {
                    cleanBlock();
                }
            });
            drawerMenu_deg_threeNode.on("mouseenter", "li", {
                contentFour: this.contentFour
            }, function (event) {
                drawerMenu_deg_fourNode.empty();
                wrapperFourNode.find(".myclass").hide();
                wrapperFourNode.find(".triangle").hide();
                Index3 = drawerMenu_deg_threeNode.find("li").index($(this));
                drawerMenu_deg_threeNode.find(".fold").css({
                    "background-image": "url(images/drawer_menu/icon_normal_arrow.png)"
                });
                drawerMenu_deg_threeNode.find("li:eq(" + Index3 + ") a i.fold").css({
                    "background-image": "url(images/drawer_menu/icon_pressed_arrow.png)"
                });
                $(this).addClass("block_fontcolor").siblings().removeClass("block_fontcolor");
                for (var i = 0, z = event.data.contentFour[Index1][Index2][Index3].length; i < z; i++) {
                    drawerMenu_deg_fourNode.append($("<li><a href='###'>" + event.data.contentFour[Index1][Index2][Index3][i] + "</a></li>"));
                }
                if (drawerMenu_deg_fourNode.find("li").length > 0) {
                    var four_height = drawerMenu_deg_fourNode.height();
                    var primate_height = $(this).offset().top;
                    var screen_height = $(window).height();
                    var aa = screen_height - primate_height - block_height;
                    if (primate_height > aa) {
                        drawerMenu_deg_fourNode.css({
                            "top": "auto",
                            "left": drawerMenu_deg_threeNode.offset().left + drawerMenu_deg_threeNode.width() + 12,
                            "display": "block",
                            "bottom": aa
                        });
                        drawerMenu_deg_fourNode.css({
                            "max-height": near(screen_height - aa)
                        });
                        wrapperFourNode.find(".myclass").css({
                            "width": drawerMenu_deg_fourNode.width(),
                            "height": drawerMenu_deg_fourNode.height(),
                            "top": drawerMenu_deg_fourNode.css("top"),
                            "left": drawerMenu_deg_fourNode.css("left"),
                            "display": "block",
                            "bottom": drawerMenu_deg_fourNode.css("bottom")
                        });
                        wrapperFourNode.find(".triangle").css({
                            "left": parseInt(drawerMenu_deg_fourNode.css("left")) - 8,
                            "bottom": parseInt(drawerMenu_deg_fourNode.css("bottom")) + 24,
                            "display": "block",
                            "top": "auto"
                        });
                    }
                    else {
                        drawerMenu_deg_fourNode.css({
                            "top": $(this).offset().top,
                            "left": drawerMenu_deg_threeNode.offset().left + drawerMenu_deg_threeNode.width() + 12,
                            "display": "block",
                            "bottom": "auto"
                        });
                        drawerMenu_deg_fourNode.css({
                            "max-height": near($(window).height() - $(this).offset().top)
                        });
                        wrapperFourNode.find(".myclass").css({
                            "width": drawerMenu_deg_fourNode.width(),
                            "height": drawerMenu_deg_fourNode.height(),
                            "top": drawerMenu_deg_fourNode.css("top"),
                            "left": drawerMenu_deg_fourNode.css("left"),
                            "display": "block",
                            "bottom": drawerMenu_deg_fourNode.css("bottom")
                        });
                        wrapperFourNode.find(".triangle").css({
                            "left": parseInt(drawerMenu_deg_fourNode.css("left")) - 8,
                            "bottom": "auto",
                            "display": "block",
                            "top": parseInt(drawerMenu_deg_fourNode.css("top")) + 24
                        });
                    }
                }
            });
            drawerMenu_deg_threeNode.on("mouseleave", function (event) {
                var x = event.clientX;
                var y = event.clientY;
                if (drawerMenu_deg_fourNode.offset()) {
                    var borderX = drawerMenu_deg_fourNode.offset().left + drawerMenu_deg_fourNode.width();
                    var borderY = drawerMenu_deg_fourNode.offset().top + drawerMenu_deg_fourNode.height();
                    if ((x >= drawerMenu_deg_fourNode.offset().left - 18) && (x <= borderX) && (y >= drawerMenu_deg_fourNode.offset().top + 10) && (y <= borderY)) {
                        drawerMenu_deg_fourNode.show();
                        wrapperFourNode.find(".myclass").show();
                    }
                    else {
                        $("#" + own.id + " li").removeClass("block_fontcolor");
                        cleanBlock();
                    }
                }
            });
            drawerMenu_deg_threeNode.on("click", "li", function (event) {
                Index3 = drawerMenu_deg_threeNode.find("li").index($(this));
                content = '[' + Index1 + ',' + Index2 + ',' + Index3 + ']';
                EventHub_13.EventHub.dispatchEvent(MessageType_14.MessageType.WIDGET, {
                    id: own.id,
                    degree: "3",
                    location: content,
                    evtType: Event_11.Event.CLICK
                });
                if (drawerMenu_deg_fourNode.find("li").length == 0) {
                    cleanBlock();
                }
            });
            drawerMenu_deg_fourNode.on("mouseleave", "li", function (event) {
                var x = event.clientX;
                var y = event.clientY;
                var borderX = drawerMenu_deg_threeNode.offset().left + drawerMenu_deg_threeNode.width();
                var borderY = drawerMenu_deg_threeNode.offset().top + drawerMenu_deg_threeNode.height();
                var borderXX = drawerMenu_deg_fourNode.offset().left + drawerMenu_deg_fourNode.width();
                var borderYY = drawerMenu_deg_fourNode.offset().top + drawerMenu_deg_fourNode.height();
                if ((y <= drawerMenu_deg_fourNode.offset().top) || (x >= borderXX) || (y >= borderYY)) {
                    cleanBlock();
                }
                if ((x < borderX) && (y > borderY)) {
                    cleanBlock();
                }
            });
            drawerMenu_deg_fourNode.on("click", "li", function (event) {
                Index4 = drawerMenu_deg_fourNode.find("li").index($(this));
                content = '[' + Index1 + ',' + Index2 + ',' + Index3 + ',' + Index4 + ']';
                EventHub_13.EventHub.dispatchEvent(MessageType_14.MessageType.WIDGET, {
                    id: own.id,
                    degree: "4",
                    location: content,
                    evtType: Event_11.Event.CLICK
                });
                cleanBlock();
            });
            function cleanBlock() {
                drawerMenu_deg_fourNode.empty();
                drawerMenu_deg_fourNode.hide();
                drawerMenu_deg_threeNode.empty();
                drawerMenu_deg_threeNode.hide();
                drawerMenu_deg_twoNode.empty();
                drawerMenu_deg_twoNode.hide();
                wrapperTwoNode.find(".myclass").hide();
                wrapperThreeNode.find(".myclass").hide();
                wrapperFourNode.find(".myclass").hide();
                wrapperTwoNode.find(".triangle").hide();
                wrapperThreeNode.find(".triangle").hide();
                wrapperFourNode.find(".triangle").hide();
                own.$thisNode.find("li:eq(" + Index1 + ") a i.fold").css({
                    "background-image": "url(images/drawer_menu/icon_normal_arrow.png)"
                });
                drawerMenu_deg_twoNode.css("max-height", "none");
                drawerMenu_deg_threeNode.css("max-height", "none");
                drawerMenu_deg_fourNode.css("max-height", "none");
                $("#" + own.id + " li").removeClass("block_fontcolor");
                drawerMenu_deg_twoNode.find("li").removeClass("block_fontcolor");
                drawerMenu_deg_threeNode.find("li").removeClass("block_fontcolor");
                drawerMenu_deg_fourNode.find("li").removeClass("block_fontcolor");
            }
            function near(numb) {
                var left, right, num;
                var block_height = 48;
                left = numb % block_height;
                num = numb - left;
                if (num < block_height) {
                    num = block_height;
                }
                return num;
            }
        };
        DrawerMenu.prototype.dispose = function () {
            _super.prototype.dispose.call(this);
            $("#" + this.id + "wrapperTwo").remove();
            $("#" + this.id + "wrapperThree").remove();
        };
        DrawerMenu.Template = "<ul class='dropdown-content adore_drawerMenu adore-hidden-scrollbar'></ul>";
        return DrawerMenu;
    }(Widget_12.Widget));
    exports.DrawerMenu = DrawerMenu;
});
define("widget/echart/EChart", ["require", "exports", "widget/Widget", "util/VisibilityChangeUtil"], function (require, exports, Widget_13, VisibilityChangeUtil_1) {
    "use strict";
    var EChart = (function (_super) {
        __extends(EChart, _super);
        function EChart(parentId, id, style) {
            _super.call(this, parentId, id, style);
            this.option = {};
            this.hadVisibilityListener = false;
            var own = this;
            this.$thisNode = $(EChart.template).attr({ id: this.id });
            this.$chartNode = this.$thisNode.find("div");
            this.resizeFunction = function () {
                if (own.echart) {
                    if (own.$thisNode.is(":visible")) {
                        setTimeout(function () {
                            own.echart.resize();
                        }, 380);
                    }
                    else {
                        if (!own.hadVisibilityListener) {
                            VisibilityChangeUtil_1.VisibilityChangeUtil.addVisibilityListener(own.$thisNode, function (visible) {
                                if (visible) {
                                    own.echart.resize();
                                    VisibilityChangeUtil_1.VisibilityChangeUtil.removeVisibilityListener(own.$thisNode);
                                    own.hadVisibilityListener = false;
                                }
                            });
                            own.hadVisibilityListener = true;
                        }
                    }
                }
            };
            $(window).on("resize", this.resizeFunction);
        }
        EChart.prototype.addOption = function (args) {
            var option = JSON.parse(args.option);
            $.extend(true, this.option, option);
            if (this.echart) {
                this.echart.setOption(this.option);
            }
        };
        EChart.prototype.setOption = function (args) {
            var option = JSON.parse(args.option);
            if (this.echart) {
                this.option = option;
                this.echart.setOption(option);
            }
            else {
                this.option = option;
            }
        };
        EChart.prototype.dispose = function () {
            $(window).off("resize", this.resizeFunction);
            _super.prototype.dispose.call(this);
        };
        EChart.prototype.postLayout = function () {
            _super.prototype.postLayout.call(this);
            if (!this.echart) {
                this.echart = echarts.init(this.$chartNode.get(0));
                if (this.option) {
                    this.echart.setOption(this.option);
                }
            }
            this.echart.resize();
        };
        EChart.prototype.clear = function () {
            if (this.echart) {
                this.echart.clear();
            }
            this.option = {};
        };
        EChart.template = "\n    <div>\n    <div style=\"width:100%;height:100%\"></div>\n    <div>\n    ";
        return EChart;
    }(Widget_13.Widget));
    exports.EChart = EChart;
});
define("widget/echart/BarChart", ["require", "exports", "widget/echart/EChart"], function (require, exports, EChart_1) {
    "use strict";
    var BarChart = (function (_super) {
        __extends(BarChart, _super);
        function BarChart() {
            _super.apply(this, arguments);
            this.data = new Array();
            this.title = "unset";
            this.subTitle = "";
            this.align = "horizontal";
            this.axisLabel = { categoryAxisLabel: "", dataAxisLabel: "" };
            this.categories = [];
        }
        BarChart.prototype.setTitle = function (args) {
            this.title = args.titles.title;
            this.subTitle = args.titles.subTitle;
        };
        BarChart.prototype.setData = function (args) {
            this.data = args.data;
        };
        BarChart.prototype.setAxisLabel = function (args) {
            this.axisLabel = { categoryAxisLabel: args.axisLabelInfo.categoryAxisLabel, dataAxisLabel: args.axisLabelInfo.dataAxisLabel };
        };
        BarChart.prototype.setAlign = function (args) {
            this.align = args.align;
        };
        BarChart.prototype.setCategories = function (args) {
            this.categories = args.categories;
        };
        BarChart.prototype.postLayout = function () {
            if (this.data) {
                this.redrawChart();
            }
            _super.prototype.postLayout.call(this);
        };
        BarChart.prototype.redrawChart = function () {
            var xAxisContent = {};
            var yAxisContent = {};
            if (this.align === "horizontal") {
                xAxisContent = {
                    data: this.categories,
                    name: this.axisLabel.categoryAxisLabel,
                    silent: false,
                    splitLine: {
                        show: false
                    }
                };
                yAxisContent = {
                    name: this.axisLabel.dataAxisLabel
                };
            }
            else if (this.align === "vertical") {
                yAxisContent = {
                    data: this.categories,
                    name: this.axisLabel.categoryAxisLabel,
                    silent: false,
                    splitLine: {
                        show: false
                    }
                };
                xAxisContent = {
                    name: this.axisLabel.dataAxisLabel
                };
            }
            ;
            var dataName = [];
            for (var _i = 0, _a = this.data; _i < _a.length; _i++) {
                var dataEntry = _a[_i];
                dataName.push(dataEntry.entryName);
            }
            var seriesContent = [];
            var i = 0;
            for (var _b = 0, _c = this.data; _b < _c.length; _b++) {
                var dataEntry = _c[_b];
                var dataTemplate = {
                    "name": dataEntry.entryName,
                    "type": "bar",
                    "data": dataEntry.entryData
                };
                seriesContent.push(dataTemplate);
                i++;
            }
            var barOption = {
                title: {
                    text: this.title,
                    subtext: this.subTitle,
                    left: "center"
                },
                legend: {
                    data: dataName,
                    align: "left",
                    left: "left"
                },
                toolbox: {
                    feature: {
                        magicType: {
                            type: ["stack", "tiled"]
                        }
                    }
                },
                tooltip: {},
                xAxis: xAxisContent,
                yAxis: yAxisContent,
                series: seriesContent
            };
            this.option = barOption;
            if (this.echart) {
                this.echart.setOption(this.option);
                this.echart.resize();
            }
        };
        return BarChart;
    }(EChart_1.EChart));
    exports.BarChart = BarChart;
});
define("widget/echart/PieChart", ["require", "exports", "widget/echart/EChart"], function (require, exports, EChart_2) {
    "use strict";
    var PieChart = (function (_super) {
        __extends(PieChart, _super);
        function PieChart() {
            _super.apply(this, arguments);
            this.data = new Array();
            this.dataName = "";
            this.title = "unset";
            this.subTitle = "";
        }
        PieChart.prototype.setData = function (args) {
            this.data = args.data;
        };
        PieChart.prototype.setDataName = function (args) {
            this.dataName = args.dataName;
        };
        PieChart.prototype.setTitle = function (args) {
            this.title = args.titles.title;
            this.subTitle = args.titles.subTitle;
        };
        PieChart.prototype.postLayout = function () {
            if (this.data) {
                this.redrawChart();
            }
            _super.prototype.postLayout.call(this);
        };
        PieChart.prototype.redrawChart = function () {
            var dataNameList = new Array();
            for (var _i = 0, _a = this.data; _i < _a.length; _i++) {
                var dataEntry = _a[_i];
                dataNameList.push(dataEntry.name);
            }
            var dataList = new Array();
            for (var _b = 0, _c = this.data; _b < _c.length; _b++) {
                var dataEntry = _c[_b];
                var dataTemplate = {
                    value: dataEntry.value,
                    name: dataEntry.name
                };
                dataList.push(dataTemplate);
            }
            var pieOption = {
                title: {
                    text: this.title,
                    subtext: this.subTitle,
                    x: "center"
                },
                tooltip: {
                    trigger: "item",
                    formatter: "{a} <br/>{b} : {c} ({d}%)"
                },
                legend: {
                    orient: "vertical",
                    left: "left",
                    data: dataNameList
                },
                series: [
                    {
                        name: this.dataName,
                        type: "pie",
                        radius: "70%",
                        center: ["50%", "50%"],
                        data: dataList,
                        itemStyle: {
                            emphasis: {
                                shadowBlur: 10,
                                shadowOffsetX: 0,
                                shadowColor: "rgba(0, 0, 0, 0.5)"
                            }
                        }
                    }
                ]
            };
            this.option = pieOption;
            if (this.echart) {
                this.echart.setOption(this.option);
                this.echart.resize();
            }
        };
        return PieChart;
    }(EChart_2.EChart));
    exports.PieChart = PieChart;
});
define("widget/echart/RadarChart", ["require", "exports", "widget/echart/EChart"], function (require, exports, EChart_3) {
    "use strict";
    var RadarChart = (function (_super) {
        __extends(RadarChart, _super);
        function RadarChart() {
            _super.apply(this, arguments);
            this.data = new Array();
            this.indicators = new Array();
            this.title = "unset";
            this.subTitle = "";
        }
        RadarChart.prototype.setData = function (args) {
            this.data = args.data;
        };
        RadarChart.prototype.setIndicators = function (args) {
            this.indicators = args.indicators;
        };
        RadarChart.prototype.setTitle = function (args) {
            this.title = args.titles.title;
            this.subTitle = args.titles.subTitle;
        };
        RadarChart.prototype.postLayout = function () {
            if (this.data) {
                this.redrawChart();
            }
            _super.prototype.postLayout.call(this);
        };
        RadarChart.prototype.redrawChart = function () {
            var indicatorsContent = new Array();
            for (var _i = 0, _a = this.indicators; _i < _a.length; _i++) {
                var indicator = _a[_i];
                var template = void 0;
                if (indicator.max) {
                    template = {
                        name: indicator.name, max: indicator.max
                    };
                }
                else {
                    template = {
                        name: indicator.name
                    };
                }
                indicatorsContent.push(template);
            }
            var legendData = new Array();
            var dataContent = [];
            for (var _b = 0, _c = this.data; _b < _c.length; _b++) {
                var dataEntry = _c[_b];
                var subDataTemplate = {
                    value: dataEntry.value,
                    name: dataEntry.name
                };
                legendData.push(dataEntry.name);
                dataContent.push(subDataTemplate);
            }
            var radarOption = {
                title: {
                    text: this.title,
                    subtext: this.subTitle,
                    x: "center"
                },
                tooltip: {},
                legend: {
                    data: legendData,
                    x: "left",
                    orient: "vertical"
                },
                radar: {
                    radius: "70%",
                    center: ["50%", "50%"],
                    indicator: indicatorsContent
                },
                series: [{
                        name: "",
                        type: "radar",
                        areaStyle: { normal: {} },
                        data: dataContent
                    }]
            };
            this.option = radarOption;
            if (this.echart) {
                this.echart.setOption(this.option);
                this.echart.resize();
            }
        };
        return RadarChart;
    }(EChart_3.EChart));
    exports.RadarChart = RadarChart;
});
define("widget/ExpandableText", ["require", "exports", "widget/Widget", "event/EventHub", "event/MessageType", "event/Event", "hotkey/Keys"], function (require, exports, Widget_14, EventHub_14, MessageType_15, Event_12, Keys_7) {
    "use strict";
    var ExpandableText = (function (_super) {
        __extends(ExpandableText, _super);
        function ExpandableText(parentId, id, style) {
            var _this = this;
            _super.call(this, parentId, id, style);
            this.maxShowItems = 5;
            this.currentIndex = -1;
            this.datas = [];
            this.maxShowItems = 5;
            this.expandableTextId = this.id;
            this.$thisNode = $(ExpandableText.TemplateNormal).attr("id", this.id);
            this.$attachNode = this.$thisNode;
            this.$textCode = this.$thisNode.find("input").attr("id", this.id + "_input");
            this.$thisNode.find("label").attr("for", this.id);
            var own = this;
            this.$textCode.on("input", function (e) {
                own.handleInput(e, _this.$textCode.val());
            });
            this.$textCode.on("keydown", function (e) {
                own.handleKeyDown(e);
            });
            this.$textCode.on("blur", function (e) {
                own.handleBlur(e);
            });
            this.$textCode.on("focus", function (e) {
                own.sendFocusGain();
            });
        }
        ExpandableText.prototype.setText = function (args) {
            this.$textCode.val(args.text);
        };
        ExpandableText.prototype.setName = function (args) {
            this.$thisNode.find("label").text(args.name);
        };
        ExpandableText.prototype.setItems = function (args) {
            this.datas = args.items;
        };
        ExpandableText.prototype.dispose = function () {
            _super.prototype.dispose.call(this);
            $("#" + this.expandableTextId + "_dropDown").remove();
        };
        ExpandableText.prototype.setFocus = function () {
            var $dropDownNode = $("#" + this.id + "_dropDown");
            if ($dropDownNode.css("display") !== "block" && document.activeElement !== this.$textCode[0]) {
                this.$textCode.focus();
            }
        };
        ExpandableText.prototype.setEnabled = function (args) {
            this.enabled = args.enabled;
            if (this.enabled) {
                this.$thisNode.find("input").removeAttr("disabled");
            }
            else {
                this.$thisNode.find("input").attr("disabled", "disabled");
            }
        };
        ExpandableText.prototype.setPlaceholder = function (args) {
            this.$thisNode.find("input").attr("placeholder", args.placeholder);
        };
        ExpandableText.prototype.handleKeyDown = function (e) {
            var dropDown = $("#" + this.expandableTextId + "_dropDown");
            var dis = dropDown.css("display");
            if (!dis || dis === "none") {
                if (e.keyCode === Keys_7.Keys.DOWN_ARROW) {
                    this.showDropDown(e, "", true);
                }
                return;
            }
            var items = dropDown.find("li");
            if (items.length === 0) {
                return;
            }
            if (e.keyCode === Keys_7.Keys.UP_ARROW) {
                if (this.currentIndex === -1) {
                    this.currentIndex = items.length - 1;
                }
                else {
                    this.currentIndex--;
                }
                items.css("background-color", "#FFFFFF");
                if (this.currentIndex < 0) {
                    this.currentIndex = -1;
                }
                else {
                    $(items[this.currentIndex]).css("background-color", "#BEBEBE");
                    this.$textCode.val($(items[this.currentIndex]).find("a").text().split(" ")[0]);
                }
                this.refreshScroll(dropDown, this.currentIndex);
                e.preventDefault();
                return;
            }
            else if (e.keyCode === Keys_7.Keys.DOWN_ARROW) {
                this.currentIndex++;
                items.css("background-color", "#FFFFFF");
                if (this.currentIndex >= items.length) {
                    this.currentIndex = -1;
                }
                else {
                    $(items[this.currentIndex]).css("background-color", "#BEBEBE");
                    this.$textCode.val($(items[this.currentIndex]).find("a").text().split(" ")[0]);
                }
                this.refreshScroll(dropDown, this.currentIndex);
                e.preventDefault();
                return;
            }
            else if (e.keyCode === Keys_7.Keys.ENTER || e.keyCode === Keys_7.Keys.NUMPAD_ENTER) {
                dropDown.css("display", "none");
                if (this.currentIndex >= 0 && this.currentIndex < items.length) {
                    var text = $(items[this.currentIndex]).find("a").text();
                    var val = text.split(" ")[0];
                    this.$textCode.val(val);
                    EventHub_14.EventHub.dispatchEvent(MessageType_15.MessageType.WIDGET, { id: this.id, text: val, evtType: Event_12.Event.MODIFY });
                    EventHub_14.EventHub.dispatchEvent(MessageType_15.MessageType.WIDGET, { id: this.id, evtType: Event_12.Event.CLICK });
                }
            }
        };
        ExpandableText.prototype.showDropDown = function (e, value, showAll) {
            var height = this.$textCode.height();
            this.scrollIndexs = [0, this.maxShowItems - 1];
            var pos = this.getPosition(this.$textCode[0]);
            var tmpHeight = height + pos[0] + 14;
            $("#" + this.expandableTextId + "_dropDown").remove();
            var $dropDown = $(ExpandableText.Template1).attr("id", this.expandableTextId + "_dropDown");
            $dropDown.attr({ mouseOn: "false" });
            $dropDown.appendTo(document.body);
            $dropDown.css("top", tmpHeight);
            $dropDown.css("left", pos[1]);
            $dropDown.css("background-color", "#FFFFFF");
            this.currentIndex = -1;
            var $liNode;
            if (this.datas) {
                if (showAll === true && value === "") {
                    for (var i = 0; i < this.datas.length; i++) {
                        $liNode = $(ExpandableText.Template2);
                        $liNode.find("a").text(this.datas[i]);
                        $liNode.appendTo($dropDown);
                    }
                }
                else if (value != "") {
                    for (var i = 0; i < this.datas.length; i++) {
                        if (this.datas[i].toLocaleLowerCase().indexOf(value) >= 0) {
                            $liNode = $(ExpandableText.Template2);
                            $liNode.find("a").text(this.datas[i]);
                            $liNode.appendTo($dropDown);
                        }
                    }
                }
            }
            var len = $dropDown.find("li").length;
            var inputNode = this.$textCode;
            var tmpId = this.expandableTextId;
            if (len > 0) {
                $dropDown.find("li").find("a").on("click", function (e) {
                    var value = $(this).text();
                    var newValue = value.split(" ")[0];
                    $("#" + tmpId + "_input").val(newValue);
                    $("#" + tmpId + "_dropDown").css("display", "none");
                    EventHub_14.EventHub.dispatchEvent(MessageType_15.MessageType.WIDGET, { id: tmpId, text: newValue, evtType: Event_12.Event.MODIFY });
                    EventHub_14.EventHub.dispatchEvent(MessageType_15.MessageType.WIDGET, { id: tmpId, evtType: Event_12.Event.CLICK });
                });
                $dropDown.on("mouseover", function (e) {
                    $dropDown.attr("mouseOn", "true");
                });
                $dropDown.on("mouseout", function (e) {
                    $dropDown.attr("mouseOn", "false");
                });
                $dropDown.css("display", "block");
                if (len > this.maxShowItems) {
                    var h = $($dropDown.find("li")[0]).height();
                    var maxHeight = h * this.maxShowItems;
                    $dropDown.css("height", maxHeight);
                }
                var own = this;
                $(document).bind('click.' + this.expandableTextId + "_dropDown", function (e) {
                    if ((!$dropDown.is(e.target) && !inputNode.is(e.target)) || $dropDown.css("display") === "none") {
                        $dropDown.css("display", "none");
                        $(document).unbind('click.' + tmpId + "_dropDown");
                    }
                });
            }
            else {
                $dropDown.css("display", "none");
            }
        };
        ExpandableText.prototype.getPosition = function (obj) {
            var pos = [0, 0];
            if (obj && obj.offsetParent) {
                while (obj && obj.offsetParent) {
                    pos[0] += obj.offsetTop;
                    pos[1] += obj.offsetLeft;
                    obj = obj.offsetParent;
                }
            }
            return pos;
        };
        ExpandableText.prototype.refreshScroll = function ($dropDown, currentIndex) {
            if (currentIndex === -1) {
                return;
            }
            var count = $dropDown.find("li").length - 1;
            var needRefresh = false;
            if (currentIndex < this.scrollIndexs[0]) {
                var endIndex = currentIndex + this.maxShowItems - 1;
                endIndex = endIndex > count ? count : endIndex;
                this.scrollIndexs = [currentIndex, endIndex];
                needRefresh = true;
            }
            else if (currentIndex > this.scrollIndexs[1]) {
                var beginIndex = currentIndex - this.maxShowItems + 1;
                beginIndex = beginIndex < 0 ? 0 : beginIndex;
                this.scrollIndexs = [beginIndex, currentIndex];
                needRefresh = true;
            }
            if (needRefresh) {
                var h = $dropDown.find("li").height();
                $dropDown[0].scrollTop = h * this.scrollIndexs[0];
            }
        };
        ExpandableText.prototype.handleInput = function (e, value) {
            var tmpId = this.expandableTextId;
            EventHub_14.EventHub.dispatchEvent(MessageType_15.MessageType.WIDGET, { id: tmpId, text: value, evtType: Event_12.Event.MODIFY });
            this.showDropDown(e, value.toLocaleLowerCase(), false);
        };
        ExpandableText.prototype.handleBlur = function (e) {
            var mouseOn = $("#" + this.expandableTextId + "_dropDown").attr("mouseOn");
            if (mouseOn === "false") {
                $("#" + this.expandableTextId + "_dropDown").css("display", "none");
            }
        };
        ExpandableText.prototype.handleKeyDownEvent = function (e, hasFilter) {
            if ($("#" + this.expandableTextId + "_dropDown").css("display") === "block") {
                if (e.keyCode === Keys_7.Keys.ENTER || e.keyCode === Keys_7.Keys.NUMPAD_ENTER || e.keyCode === Keys_7.Keys.DOWN_ARROW
                    || e.keyCode === Keys_7.Keys.UP_ARROW) {
                    return;
                }
            }
            if (e.keyCode === Keys_7.Keys.LEFT_ARROW
                || e.keyCode === Keys_7.Keys.RIGHT_ARROW) {
                return;
            }
            _super.prototype.handleKeyDownEvent.call(this, e, hasFilter);
        };
        ExpandableText.prototype.handleKeyUpEvent = function (e) {
            if ($("#" + this.expandableTextId + "_dropDown").css("display") === "block") {
                if (e.keyCode === Keys_7.Keys.ENTER || e.keyCode === Keys_7.Keys.NUMPAD_ENTER || e.keyCode === Keys_7.Keys.DOWN_ARROW
                    || e.keyCode === Keys_7.Keys.UP_ARROW) {
                    return;
                }
            }
            if (e.keyCode === Keys_7.Keys.LEFT_ARROW
                || e.keyCode === Keys_7.Keys.RIGHT_ARROW) {
                return;
            }
            _super.prototype.handleKeyUpEvent.call(this, e);
        };
        ExpandableText.TemplateNormal = "\n        <div class=\"input-field\">\n            <i></i>\n            <input type=\"text\">\n            <label></label>\n        </div>";
        ExpandableText.Template1 = "\n        <ul class=\"adore_dropDown dropdown-content\" style=\"opacity:1;\">\n        </ul>";
        ExpandableText.Template2 = "\n        <li>\n            <a href='#!' style=\" \"></a>\n        </li>";
        return ExpandableText;
    }(Widget_14.Widget));
    exports.ExpandableText = ExpandableText;
});
define("widget/FlatTree", ["require", "exports", "widget/Widget", "event/EventHub", "event/MessageType", "event/Event"], function (require, exports, Widget_15, EventHub_15, MessageType_16, Event_13) {
    "use strict";
    var FlatTree = (function (_super) {
        __extends(FlatTree, _super);
        function FlatTree(parentId, id, style) {
            _super.call(this, parentId, id, style);
            this.$thisNode = $(FlatTree.Template).attr("id", this.id);
            this.oneDegree = this.$thisNode.find(".wrap_flatTree:eq(0)").attr("id", "one_" + this.id);
            this.twoDegree = this.$thisNode.find(".wrap_flatTree:eq(1)").attr("id", "two_" + this.id);
            this.threeDegree = this.$thisNode.find(".wrap_flatTree:eq(2)").attr("id", "three_" + this.id);
            this.fourDegree = this.$thisNode.find(".wrap_flatTree:eq(3)").attr("id", "four_" + this.id);
            this.contentOne = new Array();
            this.contentTwo = new Array();
            this.contentThree = new Array();
            this.contentFour = new Array();
        }
        FlatTree.prototype.setContents = function (args) {
            var data = JSON.parse(args.attribute);
            for (var key in data) {
                var cutKey;
                var location;
                var m;
                var n;
                var k;
                var h;
                var belongTo = key.length - key.replace(/,/g, "").length;
                switch (belongTo) {
                    case 0:
                        this.contentOne[parseInt(key)] = data[key];
                        this.contentTwo[parseInt(key)] = new Array();
                        this.contentThree[parseInt(key)] = new Array();
                        this.contentFour[parseInt(key)] = new Array();
                        break;
                    case 1:
                        cutKey = key.substr(1, key.length - 2);
                        location = cutKey.split(",");
                        m = Number(location[0]);
                        n = Number(location[1]);
                        this.contentTwo[m][n] = data[key];
                        this.contentThree[m][n] = new Array();
                        this.contentFour[m][n] = new Array();
                        break;
                    case 2:
                        cutKey = key.substr(1, key.length - 2);
                        location = cutKey.split(",");
                        var m = Number(location[0]);
                        var n = Number(location[1]);
                        var k = Number(location[2]);
                        this.contentThree[m][n][k] = data[key];
                        this.contentFour[m][n][k] = new Array();
                        break;
                    case 3:
                        cutKey = key.substr(1, key.length - 2);
                        location = cutKey.split(",");
                        var m = Number(location[0]);
                        var n = Number(location[1]);
                        var k = Number(location[2]);
                        var h = Number(location[3]);
                        this.contentFour[m][n][k][h] = data[key];
                        break;
                    default:
                        console.log("data error");
                        break;
                }
            }
        };
        FlatTree.prototype.setIconPaths = function (args) {
            var pathData = JSON.parse(args.iconPaths);
            for (var key in pathData) {
                var path = pathData[key].replace(/\\/g, "\\\\");
                this.oneDegree.find("img:eq(" + parseInt(key) + ")").attr("src", path);
            }
        };
        FlatTree.prototype.setRootTitle = function (args) {
            this.$thisNode.find(".breadCumb a:eq(0)").html(args.rootTitle);
        };
        FlatTree.prototype.initFlatTree = function () {
            var Index1 = 0;
            var Index2 = 0;
            var Index3 = 0;
            var Index4 = 0;
            var own = this;
            this.$thisNode.find(".breadCumb a:eq(0)").html("全部菜单");
            for (var i = 0, z = this.contentOne.length; i < z; i++) {
                $(FlatTree.TemplateOneItem).appendTo(this.oneDegree);
                this.oneDegree.find("span:eq(" + i + ")").text(this.contentOne[i]);
                this.oneDegree.show();
            }
            this.oneDegree.on("click", "a", {
                contentTwo: this.contentTwo,
                contentThree: this.contentThree
            }, function (event) {
                Index1 = own.oneDegree.find("a").index($(this));
                if (event.data.contentTwo[Index1].length > 0) {
                    for (var i = 0, z = event.data.contentTwo[Index1].length; i < z; i++) {
                        $(FlatTree.TemplateOtherItem).appendTo(own.twoDegree);
                        own.twoDegree.find("span:eq(" + i + ")").text(event.data.contentTwo[Index1][i]);
                        if (event.data.contentThree[Index1][i].length > 0) {
                            own.twoDegree.find("img:eq(" + i + ")").attr("src", "images/flat_tree/u235.png");
                        }
                        else {
                            own.twoDegree.find("img:eq(" + i + ")").attr("src", "images/flat_tree/u88.png");
                        }
                    }
                    own.$thisNode.find(".breadCumb a:eq(1)").html($(this).find("span").html());
                    own.$thisNode.find(".breadCumb div:eq(0)").css("display", "inline-block");
                    own.oneDegree.hide();
                    own.twoDegree.show();
                }
                var content = "" + Index1;
                EventHub_15.EventHub.dispatchEvent(MessageType_16.MessageType.WIDGET, {
                    id: own.id,
                    location: content,
                    evtType: Event_13.Event.CLICK
                });
            });
            this.twoDegree.on("click", "a", {
                contentThree: this.contentThree,
                contentFour: this.contentFour
            }, function (event) {
                Index2 = own.twoDegree.find("a").index($(this));
                if (event.data.contentThree[Index1][Index2].length > 0) {
                    for (var i = 0, z = event.data.contentThree[Index1][Index2].length; i < z; i++) {
                        $(FlatTree.TemplateOtherItem).appendTo(own.threeDegree);
                        own.threeDegree.find("span:eq(" + i + ")").text(event.data.contentThree[Index1][Index2][i]);
                        if (event.data.contentFour[Index1][Index2][i].length > 0) {
                            own.threeDegree.find("img:eq(" + i + ")").attr("src", "images/flat_tree/u235.png");
                        }
                        else {
                            own.threeDegree.find("img:eq(" + i + ")").attr("src", "images/flat_tree/u88.png");
                        }
                    }
                    own.$thisNode.find(".breadCumb a:eq(2)").html($(this).find("span").html());
                    own.$thisNode.find(".breadCumb div:eq(1)").css("display", "inline-block");
                    own.twoDegree.hide();
                    own.threeDegree.show();
                }
                var content = '[' + Index1 + ',' + Index2 + ']';
                EventHub_15.EventHub.dispatchEvent(MessageType_16.MessageType.WIDGET, {
                    id: own.id,
                    location: content,
                    evtType: Event_13.Event.CLICK
                });
            });
            this.threeDegree.on("click", "a", {
                contentFour: this.contentFour
            }, function (event) {
                Index3 = own.threeDegree.find("a").index($(this));
                if (event.data.contentFour[Index1][Index2][Index3].length > 0) {
                    for (var i = 0, z = event.data.contentFour[Index1][Index2][Index3].length; i < z; i++) {
                        $(FlatTree.TemplateOtherItem).appendTo(own.fourDegree);
                        own.fourDegree.find("span:eq(" + i + ")").text(event.data.contentFour[Index1][Index2][Index3][i]);
                        own.fourDegree.find("img:eq(" + i + ")").attr("src", "images/flat_tree/u88.png");
                    }
                    own.$thisNode.find(".breadCumb a:eq(3)").html($(this).find("span").html());
                    own.$thisNode.find(".breadCumb div:eq(2)").css("display", "inline-block");
                    own.threeDegree.hide();
                    own.fourDegree.show();
                }
                var content = '[' + Index1 + ',' + Index2 + ',' + Index3 + ']';
                EventHub_15.EventHub.dispatchEvent(MessageType_16.MessageType.WIDGET, {
                    id: own.id,
                    location: content,
                    evtType: Event_13.Event.CLICK
                });
            });
            this.fourDegree.on("click", "a", function (event) {
                Index4 = own.fourDegree.find("a").index($(this));
                var content = '[' + Index1 + ',' + Index2 + ',' + Index3 + ',' + Index4 + ']';
                EventHub_15.EventHub.dispatchEvent(MessageType_16.MessageType.WIDGET, {
                    id: own.id,
                    location: content,
                    evtType: Event_13.Event.CLICK
                });
            });
            own.$thisNode.find(".breadCumb a").on("click", function () {
                var index_bread = own.$thisNode.find(".breadCumb a").index($(this));
                own.$thisNode.find(".wrap_flatTree:eq(" + index_bread + ")").show().siblings(".wrap_flatTree").hide();
                own.$thisNode.find(".wrap_flatTree:eq(" + index_bread + ")").nextAll().empty();
                if (index_bread > 0) {
                    $(this).parent("div").nextAll("div").hide();
                }
                else {
                    $(this).nextAll("div").hide();
                }
            });
        };
        FlatTree.prototype.dispose = function () {
            _super.prototype.dispose.call(this);
        };
        FlatTree.Template = "\n        <div class=\"adore_flatTree\">\n            <div class=\"breadCumb\">\n                <!-- \u6839\u76EE\u5F55 -->\n                <a href=\"javascript:void(0)\"></a>\n                <div>\n                    <span>&gt;</span>\n                    <a href=\"javascript:void(0)\"></a>\n                </div>\n                <div>\n                    <span>&gt;</span>\n                    <a href=\"javascript:void(0)\"></a>\n                </div>\n                <div>\n                    <span>&gt;</span>\n                    <a href=\"javascript:void(0)\"></a>\n                </div>\n            </div>\n            <div class=\"wrap_flatTree\">\n            </div>\n            <div class=\"wrap_flatTree\">\n            </div>\n            <div class=\"wrap_flatTree\">\n            </div>\n            <div class=\"wrap_flatTree\">\n            </div>\n        </div>";
        FlatTree.TemplateOneItem = "\n        <a class=\"oneItem\" href=\"javascript:void(0)\">\n          <img class=\"img \" src=\"images/flat_tree/u152.png\">\n          <span></span>\n        </a>";
        FlatTree.TemplateOtherItem = "\n        <a class=\"otherItem\" href=\"javascript:void(0)\">\n          <img class=\"img \" src=\"\">\n          <span></span>\n        </a>";
        return FlatTree;
    }(Widget_15.Widget));
    exports.FlatTree = FlatTree;
});
define("widget/FloatPanelButton", ["require", "exports", "widget/Widget"], function (require, exports, Widget_16) {
    "use strict";
    var FloatPanelButton = (function (_super) {
        __extends(FloatPanelButton, _super);
        function FloatPanelButton(parentId, id, style) {
            _super.call(this, parentId, id, style);
            this.$thisNode = $(FloatPanelButton.TemplateCotainer).attr({ id: this.id });
        }
        FloatPanelButton.prototype.setText = function (args) {
            var text = args.text;
            this.$thisNode.find(".personal_info_name").text(text);
        };
        FloatPanelButton.prototype.setImagePath = function (args) {
            var imagePath = args.imagePath;
            this.$thisNode.find("img.info_image").attr("src", imagePath);
        };
        FloatPanelButton.TemplateCotainer = "\n            <div class=\"personal_info\">\n                <img class=\"info_image\"/>\n                <span class=\"personal_info_name\"></span><i class=\"mdi-navigation-arrow-drop-down personal_info_arrow\"></i>\n            </div>\n            ";
        return FloatPanelButton;
    }(Widget_16.Widget));
    exports.FloatPanelButton = FloatPanelButton;
});
define("widget/FloatPanelComposite", ["require", "exports", "widget/Composite", "util/WidgetManager", "widget/CheckButton"], function (require, exports, Composite_4, WidgetManager_4, CheckButton_1) {
    "use strict";
    var FloatPanelComposite = (function (_super) {
        __extends(FloatPanelComposite, _super);
        function FloatPanelComposite(parentId, id, style) {
            _super.call(this, parentId, id, style);
            this.bindClickCount = 0;
            this.$wrapNode = $(FloatPanelComposite.TemplateWrapper).attr("id", this.id + "wrapper");
            this.$thisNode = $(FloatPanelComposite.TemplateCotainer).attr("id", this.id);
            this.$attachNode = this.$thisNode;
            this.$arrowNode = $(FloatPanelComposite.TemplateArrow).attr("id", "arrow" + this.id);
            var own = this;
            this.resizeListener = function () {
                if (own.$thisNode.css("display") === "block") {
                    own.$thisNode.css("display", "none");
                    own.$arrowNode.hide();
                    $(".float_panel_iframe").hide();
                    $(document).find(".personal_info_arrow").removeClass("mdi-navigation-arrow-drop-up").addClass("mdi-navigation-arrow-drop-down");
                }
            };
            $(window).on("resize", this.resizeListener);
        }
        FloatPanelComposite.prototype.getPosition = function (obj) {
            var pos = [0, 0];
            if (obj && obj.offsetParent) {
                while (obj && obj.offsetParent) {
                    pos[0] += obj.offsetTop;
                    pos[1] += obj.offsetLeft;
                    obj = obj.offsetParent;
                }
            }
            return pos;
        };
        FloatPanelComposite.prototype.addDocumentBind = function (wid) {
            var own = this;
            $(document).bind('click.' + wid + "_dropDown", function (e) {
                var $source = $(document).find("#" + wid);
                var isSource = false;
                var sourceParent = e.target;
                while (sourceParent) {
                    if ($source.is(sourceParent)) {
                        isSource = true;
                        break;
                    }
                    sourceParent = sourceParent.parentElement;
                }
                if (!isSource) {
                    var isHide = true;
                    if (own.$thisNode.css("display") !== "none") {
                        var targetParent = e.target;
                        while (targetParent) {
                            if (own.$thisNode.is(targetParent)) {
                                isHide = false;
                                break;
                            }
                            targetParent = targetParent.parentElement;
                        }
                        if (isHide) {
                            own.$thisNode.css("display", "none");
                            own.$arrowNode.hide();
                            $(".float_panel_iframe").hide();
                            $source.find(".personal_info_arrow").removeClass("mdi-navigation-arrow-drop-up").addClass("mdi-navigation-arrow-drop-down");
                            $(document).unbind('click.' + wid + "_dropDown");
                        }
                    }
                    else {
                        $(document).unbind('click.' + wid + "_dropDown");
                    }
                }
            });
        };
        FloatPanelComposite.prototype.setLocation = function (target, isUp) {
            var pos = this.getPosition(target[0]);
            var height = target.height();
            var tmpHeight;
            var iframeTop;
            if (isUp) {
                tmpHeight = pos[0] - this.$thisNode.height() - 5;
                this.$arrowNode.css("top", pos[0] - 21);
                this.$arrowNode.removeClass("mdi-navigation-arrow-drop-up").addClass("mdi-navigation-arrow-drop-down");
                iframeTop = tmpHeight;
            }
            else {
                tmpHeight = height + pos[0] + 5;
                this.$arrowNode.css("top", tmpHeight - 19);
                iframeTop = this.$arrowNode.css("top");
            }
            this.$thisNode.css("top", tmpHeight);
            this.$thisNode.css("left", pos[1]);
            var width = this.$thisNode.width();
            var limitWidth = document.body.clientWidth - pos[1];
            if (width > limitWidth) {
                this.$thisNode.css("left", document.body.clientWidth - width - 2);
            }
            this.$arrowNode.css("left", pos[1] + this.$thisNode.width() / 3 * 2);
            $(".float_panel_content > div").css({
                "position": "static"
            });
            $(".float_panel_iframe").css({
                "width": this.$thisNode.width(),
                "height": this.$thisNode.height() + 20,
                "top": iframeTop,
                "left": this.$thisNode.css("left"),
                "display": "block"
            });
        };
        FloatPanelComposite.prototype.bindClick = function (args) {
            var wid = args.item.wid;
            var bindWidget = WidgetManager_4.WidgetManager.byId(wid);
            var own = this;
            if (bindWidget) {
                var $bindNode = bindWidget.$thisNode;
                if (bindWidget instanceof CheckButton_1.CheckButton) {
                    $bindNode = $bindNode.find("input");
                }
                $bindNode.on("click", function (e) {
                    if (own.$thisNode.css("display") === "none") {
                        own.$thisNode.css("display", "block");
                        own.$arrowNode.show();
                        own.setLocation(bindWidget.$thisNode, args.item.isUp);
                        own.addDocumentBind(wid);
                        $(this).find(".personal_info_arrow").removeClass("mdi-navigation-arrow-drop-down").addClass("mdi-navigation-arrow-drop-up");
                    }
                    else {
                        own.$thisNode.css("display", "none");
                        own.$arrowNode.hide();
                        $(".float_panel_iframe").hide();
                        $(this).find(".personal_info_arrow").removeClass("mdi-navigation-arrow-drop-up").addClass("mdi-navigation-arrow-drop-down");
                    }
                });
            }
            else {
                this.bindClickCount++;
                if (this.bindClickCount > 5) {
                    return;
                }
                setTimeout(function () {
                    own.bindClick(args);
                }, 300);
            }
        };
        FloatPanelComposite.prototype.dispose = function () {
            $(window).off("resize", this.resizeListener);
            _super.prototype.dispose.call(this);
            this.$wrapNode.remove();
        };
        FloatPanelComposite.prototype.setEnabled = function (args) {
            var enabled = args.enabled;
            if (!enabled) {
                if (this.$thisNode.css("display") !== "none") {
                    this.$wrapNode.css("display", "none");
                    this.$thisNode.css("display", "none");
                }
            }
        };
        FloatPanelComposite.prototype.setVisible = function (args) {
            var visible = args.visible;
            if (visible) {
                this.$wrapNode.css("display", "block");
                this.$thisNode.css("display", "block");
            }
            else {
                this.$wrapNode.css("display", "none");
                this.$thisNode.css("display", "none");
            }
        };
        FloatPanelComposite.prototype.append = function () {
            this.$thisNode.appendTo(this.$wrapNode.find(".content_wrap"));
            this.$arrowNode.appendTo(this.$wrapNode.find(".content_wrap"));
            this.$wrapNode.appendTo(document.body);
        };
        FloatPanelComposite.TemplateWrapper = "\n           <div>\n\t            <iframe class=\"float_panel_iframe\"></iframe>\n\t            <div class=\"content_wrap\">\n\t            </div>\n            </div>\n            ";
        FloatPanelComposite.TemplateCotainer = "<div class=\"float_panel_content adore-hidden-scrollbar\"></div>";
        FloatPanelComposite.TemplateArrow = "<i class=\"float_panel_arrow mdi-navigation-arrow-drop-up\"></i>";
        return FloatPanelComposite;
    }(Composite_4.Composite));
    exports.FloatPanelComposite = FloatPanelComposite;
});
define("widget/Group", ["require", "exports", "widget/Composite"], function (require, exports, Composite_5) {
    "use strict";
    var Group = (function (_super) {
        __extends(Group, _super);
        function Group(parentId, id, style) {
            _super.call(this, parentId, id, style);
        }
        Group.prototype.layout = function () {
            _super.prototype.layout.call(this);
            this.$thisNode.addClass("adore_group");
            $("<div class='adore_group_topCuttingLine'>").insertBefore(this.$thisNode);
            $("<div class='adore_group_bottomCuttingLine'>").insertBefore(this.$thisNode);
        };
        Group.prototype.toString = function () {
            return "Group";
        };
        Group.prototype.setFocus = function () {
        };
        return Group;
    }(Composite_5.Composite));
    exports.Group = Group;
});
define("widget/HTMLFragment", ["require", "exports", "widget/Widget"], function (require, exports, Widget_17) {
    "use strict";
    var HTMLFragment = (function (_super) {
        __extends(HTMLFragment, _super);
        function HTMLFragment(parentId, id, style) {
            _super.call(this, parentId, id, style);
            this.cssPaths = [];
            this.$thisNode = $(HTMLFragment.Template).attr({ id: this.id });
        }
        HTMLFragment.prototype.html = function (args) {
            if (args.html) {
                this.$thisNode.html(args.html);
            }
        };
        HTMLFragment.prototype.setHtmlFragments = function (args) {
            var htmls = args.htmlFragments;
            if (htmls && htmls.length > 0) {
                var tempArr = new Array();
                for (var i = 0; i < htmls.length; i++) {
                    var fragmentNode = this.$thisNode.find("#" + htmls[i].fragmentID);
                    if (fragmentNode.length > 0) {
                        fragmentNode.html(htmls[i].html);
                    }
                    else {
                        tempArr.push(htmls[i]);
                    }
                }
                var count = args.count ? 0 : args.count;
                if (tempArr.length > 0 && count <= 2) {
                    setTimeout(this.setHtmlFragments({ htmlFragments: tempArr, count: (count + 1) }), 200);
                }
            }
        };
        HTMLFragment.prototype.setImages = function (args) {
            var images = args.images;
            if (images && images.length > 0) {
                var tempArr = new Array();
                for (var i = 0; i < images.length; i++) {
                    var imageNode = this.$thisNode.find("#" + images[i].imageID);
                    if (imageNode.length > 0) {
                        imageNode.attr("src", images[i].imagePath);
                    }
                    else {
                        tempArr.push(images[i]);
                    }
                }
                var count = args.count ? 0 : args.count;
                if (tempArr.length > 0 && count <= 2) {
                    setTimeout(this.setImages({ images: tempArr, count: (count + 1) }), 200);
                }
            }
        };
        HTMLFragment.prototype.setTexts = function (args) {
            var texts = args.texts;
            if (texts && texts.length > 0) {
                var tempArr = new Array();
                for (var i = 0; i < texts.length; i++) {
                    var textNode = this.$thisNode.find("#" + texts[i].textID);
                    if (textNode.length > 0) {
                        textNode.text(texts[i].text);
                    }
                    else {
                        tempArr.push(texts[i]);
                    }
                }
                var count = args.count ? 0 : args.count;
                if (tempArr.length > 0 && count <= 2) {
                    setTimeout(this.setTexts({ texts: tempArr, count: (count + 1) }), 200);
                }
            }
        };
        HTMLFragment.prototype.setCssPaths = function (args) {
            var cssPaths = args.cssPaths;
            if (cssPaths && cssPaths.length > 0) {
                var $headNode = $("head");
                for (var i = 0; i < cssPaths.length; i++) {
                    if ($headNode.find("#" + cssPaths[i].cssID).length === 0) {
                        $("<link href='" + cssPaths[i].cssPath + "' type='text/css' rel='stylesheet'>").attr("id", cssPaths[i].cssID).appendTo($headNode);
                        this.cssPaths.push(cssPaths[i].cssID);
                    }
                }
            }
        };
        HTMLFragment.prototype.dispose = function () {
            _super.prototype.dispose.call(this);
            var $headNode = $("head");
            for (var i = 0; i < this.cssPaths.length; i++) {
                $headNode.find("#" + this.cssPaths[i]).remove();
            }
            this.cssPaths.splice(0, this.cssPaths.length);
        };
        HTMLFragment.Template = "<div></div>";
        return HTMLFragment;
    }(Widget_17.Widget));
    exports.HTMLFragment = HTMLFragment;
});
define("widget/IFrame", ["require", "exports", "widget/Widget"], function (require, exports, Widget_18) {
    "use strict";
    var IFrame = (function (_super) {
        __extends(IFrame, _super);
        function IFrame(parentId, id, style) {
            _super.call(this, parentId, id, style);
            this.$thisNode = $(IFrame.Template).attr({ id: this.id });
            var frameId = this.id;
            this.$thisNode.find("iframe").attr({ width: "100%", height: "100%" }).on("load", function () {
            });
        }
        IFrame.prototype.setURL = function (args) {
            var src = args.url;
            this.$thisNode.find("iframe").attr("src", src);
        };
        IFrame.prototype.setHighDpi = function (args) {
            var viewPortMeta = $("meta[name=viewport]");
            if (args.highDpi) {
                viewPortMeta.attr("content", "user-scalable=no, initial-scale=0.5, maximum-scale=0.5, minimum-scale=0.5, width=device-width, height=device-height, target-densitydpi=device-dpi");
            }
            else {
                viewPortMeta.attr("content", "width=device-width, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no");
            }
        };
        IFrame.prototype.execute = function (args) {
            var script = args.script;
            var myFrame = this.$thisNode.find("iframe")[0];
            if (myFrame.contentDocument) {
                var myDocument = myFrame.contentDocument;
                script = script.replace(/document/g, "myDocument");
                eval(script);
            }
            else {
                console.error("iframe.contentDocument not found!");
            }
        };
        IFrame.Template = "\n        <div>\n            <iFrame></iFrame>\n        </div>";
        return IFrame;
    }(Widget_18.Widget));
    exports.IFrame = IFrame;
});
define("widget/Image", ["require", "exports", "widget/Widget", "ADORE"], function (require, exports, Widget_19, ADORE_7) {
    "use strict";
    var Image = (function (_super) {
        __extends(Image, _super);
        function Image(parentId, id, style) {
            _super.call(this, parentId, id, style);
            this.isLayout = false;
            this.isZoom = false;
            var tmpTemplate = Image.TemplateNormal;
            var isFloat = false;
            if ((style & ADORE_7.ADORE.Zoom) === ADORE_7.ADORE.Zoom) {
                tmpTemplate = Image.TemplateZoom;
                this.isZoom = true;
            }
            else if ((style & ADORE_7.ADORE.Float) === ADORE_7.ADORE.Float) {
                tmpTemplate = Image.TemplateFloat;
                isFloat = true;
            }
            this.$thisNode = $(tmpTemplate).attr({ id: this.id });
            if (isFloat) {
                this.$imgNode = this.$thisNode.find("img");
            }
            else {
                this.$imgNode = this.$thisNode;
            }
            this.$imgNode.attr({ alt: "图片不存在" });
        }
        Image.prototype.setSrc = function (args) {
            var path = args.src;
            this.$imgNode.attr("src", path);
            if (this.isLayout && this.isZoom) {
                this.$imgNode.materialbox();
            }
        };
        Image.prototype.setFocus = function () {
        };
        Image.prototype.postLayout = function () {
            if (this.isZoom) {
                this.$imgNode.materialbox();
            }
            this.isLayout = true;
        };
        Image.TemplateNormal = "<img class=\"responsive-img\">";
        Image.TemplateFloat = "\n    <div>\n     <img class=\"circle responsive-img\">\n    </div>";
        Image.TemplateZoom = "<img class=\"materialboxed responsive-img\">";
        return Image;
    }(Widget_19.Widget));
    exports.Image = Image;
});
define("widget/ImageViewer", ["require", "exports", "widget/Widget", "event/EventHub", "event/MessageType", "event/Event"], function (require, exports, Widget_20, EventHub_16, MessageType_17, Event_14) {
    "use strict";
    var ImageViewer = (function (_super) {
        __extends(ImageViewer, _super);
        function ImageViewer(parentId, id, style) {
            _super.call(this, parentId, id, style);
            this.$thisNode = $(ImageViewer.Template).attr("id", this.id);
            this.$pictureList = this.$thisNode.find(".picture_list");
            this.$btnBig = this.$thisNode.find(".adore_picture_blowup");
            this.$btnSmall = this.$thisNode.find(".adore_picture_reduce");
            this.$btnReset = this.$thisNode.find(".adore_picture_reset");
        }
        ImageViewer.prototype.blowup = function () {
            this.imgWidth = $(".adore_picture_preview_img").width();
            this.imgHeight = $(".adore_picture_preview_img").height();
            if ((this.imgHeight <= this.imgHeight * 2) || (this.imgWidth <= this.imgWidth * 2)) {
                this.imgHeight = this.imgHeight + 20;
                this.imgWidth = this.imgWidth + 20;
                $(".adore_picture_preview_img").css("width", this.imgWidth + "px");
                $(".adore_picture_preview_img").css("height", this.imgHeight + "px");
            }
        };
        ImageViewer.prototype.reduce = function () {
            this.imgWidth = $(".adore_picture_preview_img").width();
            this.imgHeight = $(".adore_picture_preview_img").height();
            if ((this.imgHeight > 200) && (this.imgWidth > 200)) {
                this.imgHeight = this.imgHeight - 20;
                this.imgWidth = this.imgWidth - 20;
                $(".adore_picture_preview_img").css("width", this.imgWidth + "px");
                $(".adore_picture_preview_img").css("height", this.imgHeight + "px");
            }
        };
        ImageViewer.prototype.setImages = function (args) {
            this.imgs = args.imgs;
            if (this.imgs.length <= 0) {
                return;
            }
            var own = this;
            for (var i = 0; i < own.imgs.length; i++) {
                var flag = own.imgs[i].replace(/\//g, "v");
                flag = flag.replace(/\\/g, "v");
                flag = flag.replace(/\:/g, "v");
                flag = flag.replace(/\./g, "v");
                if (own.$pictureList.find("#" + flag).length <= 0) {
                    own.$pictureList.append("<li id=\"" + flag + "\"><div style=\"float: left\"><input type='checkbox' value=\"" + own.imgs[i] + "\" name=\"choose\" class=\"adore_picture_checkbox\"/></div><img src=\"" + own.imgs[i] + "\" class=\"adore_picture_list_img\"/></li>");
                }
            }
            this.$btnBig.click(function () {
                if (own.$thisNode.find(".adore_picture_preview_img").length > 0) {
                    own.blowup();
                }
            });
            this.$btnSmall.click(function () {
                if (own.$thisNode.find(".adore_picture_preview_img").length > 0) {
                    own.reduce();
                }
            });
            this.$btnReset.click(function () {
                if (own.$thisNode.find(".adore_picture_preview_img").length > 0) {
                    $(".adore_picture_preview_img").css("width", own.width + "px");
                    $(".adore_picture_preview_img").css("height", own.height + "px");
                }
            });
            this.$pictureList.click(function (event) {
                var $li = $(this).children();
                var cur = event.target;
                var imgSrc;
                own.$thisNode.find(".adore_picture_preview_img").remove();
                if ($(cur).is($li)) {
                    $(cur).addClass("picture_select_current");
                    $(cur).siblings().removeClass("picture_select_current");
                }
                else if ($(cur).is("img")) {
                    $(cur).parent().addClass("picture_select_current");
                    $(cur).parent().siblings().removeClass("picture_select_current");
                }
                var $pictureli = own.$thisNode.find(".picture_select_current");
                var $thisPicture = $pictureli.find(".adore_picture_list_img");
                imgSrc = $thisPicture.attr("src");
                if (imgSrc != null && imgSrc.length > 0) {
                    own.$thisNode.find(".adore_picture_preview").append("<img src=\"" + imgSrc + "\" class=\"adore_picture_preview_img\"/>");
                    own.width = $(".adore_picture_preview_img").width();
                    own.height = $(".adore_picture_preview_img").height();
                }
            });
            var $checked = this.$thisNode.find("input[type='checkbox']");
            for (var i = 0; i < $checked.length; i++) {
                $checked.eq(i).click(function () {
                    if ($(this).is(":checked")) {
                        var result = $(this).val() + "";
                        EventHub_16.EventHub.dispatchEvent(MessageType_17.MessageType.WIDGET, {
                            id: own.id,
                            selectedImage: result,
                            evtType: Event_14.Event.CLICK
                        });
                    }
                });
            }
        };
        ImageViewer.prototype.removeImages = function (args) {
            var rImgs = args.removeImgs;
            for (var i = 0; i < rImgs.length; i++) {
                var result = rImgs[i].replace(/\//g, "v");
                result = result.replace(/\\/g, "v");
                result = result.replace(/\:/g, "v");
                result = result.replace(/\./g, "v");
                this.$thisNode.find("#" + result).remove();
            }
        };
        ImageViewer.Template = "\n    <div class=\"adore_picture\">\n    <div class=\"adore_picture_left\">\n        <div class=\"adore_picture_text\">\u56FE\u7247\u5217\u8868</div>\n        <!-- \u56FE\u7247\u5217\u8868-->\n        <div class=\"adore_picture_list\">\n            <ul class=\"picture_list\">\n               \n            </ul>\n        </div>\n    </div>\n    <div class=\"adore_picture_right\">\n        <div class=\"adore_picture_text\">\u56FE\u7247\u9884\u89C8</div>\n        <!-- \u653E\u5927\u7F29\u5C0F\u6309\u94AE-->\n        <div style=\"display: inline-block;width: 100%\">\n            <img src=\"images/image_viewer/icon_blow_up.png\" class=\"adore_picture_blowup\" value=\"\u653E\u5927\" style=\"margin-right: 15px;float: right\"/>\n            <img src=\"images/image_viewer/icon_reset.png\" class=\"adore_picture_reset\" value=\"\u8FD8\u539F\" style=\"margin-right: 15px;float: right\"/>\n            <img src=\"images/image_viewer/icon_reduce.png\" class=\"adore_picture_reduce\" value=\"\u7F29\u5C0F\" style=\"margin-right: 15px;float: right\"/>\n        </div>\n        <!-- \u5927\u56FE\u9884\u89C8-->\n        <div class=\"adore_picture_preview\">\n            \n        </div>\n    </div>\n    </div>";
        return ImageViewer;
    }(Widget_20.Widget));
    exports.ImageViewer = ImageViewer;
});
define("widget/integration/AbstractContainer", ["require", "exports", "widget/Composite"], function (require, exports, Composite_6) {
    "use strict";
    var AbstractContainer = (function (_super) {
        __extends(AbstractContainer, _super);
        function AbstractContainer(parentId, id, style) {
            _super.call(this, parentId, id, style);
            this.reinitCount = 0;
            AbstractContainer._this = this;
            this.$thisNode = $("#" + id);
            if (this.$thisNode.length === 0) {
                setTimeout(AbstractContainer._this.reinit, 200);
            }
            else {
                this.reset();
            }
        }
        AbstractContainer.prototype.reinit = function () {
            var own = AbstractContainer._this;
            own.$thisNode = $("#" + own.id);
            if (own.$thisNode.length === 0) {
                if (own.reinitCount < 10) {
                    own.reinitCount++;
                    setTimeout(own.reinit, 200);
                }
                else {
                    console.error("not found element[" + own.id + "]");
                }
            }
            else {
                own.reset();
            }
        };
        AbstractContainer.prototype.toString = function () {
            return "AbstractContainer";
        };
        AbstractContainer.prototype.dispose = function () {
            _super.prototype.dispose.call(this);
            AbstractContainer._this = null;
        };
        AbstractContainer.prototype.append = function () {
        };
        AbstractContainer.prototype.layout = function () {
        };
        AbstractContainer.prototype.setLayoutData = function (args) {
        };
        return AbstractContainer;
    }(Composite_6.Composite));
    exports.AbstractContainer = AbstractContainer;
});
define("widget/integration/AbstractIntegration", ["require", "exports", "widget/Widget"], function (require, exports, Widget_21) {
    "use strict";
    var AbstractIntegration = (function (_super) {
        __extends(AbstractIntegration, _super);
        function AbstractIntegration(parentId, id, style) {
            _super.call(this, null, id, style);
            this.reinitCount = 0;
            this.$thisNode = $("#" + id);
            AbstractIntegration._this = this;
            if (this.$thisNode.length === 0) {
                setTimeout(AbstractIntegration._this.reinit, 200);
            }
            else {
                this.reset();
            }
        }
        AbstractIntegration.prototype.reinit = function () {
            var own = AbstractIntegration._this;
            own.$thisNode = $("#" + own.id);
            if (own.$thisNode.length === 0) {
                if (own.reinitCount < 10) {
                    own.reinitCount++;
                    setTimeout(own.reinit, 200);
                }
                else {
                    console.error("not found element[" + own.id + "]");
                }
            }
            else {
                own.reset();
            }
        };
        AbstractIntegration.prototype.toString = function () {
            return "AbstractIntegration";
        };
        AbstractIntegration.prototype.dispose = function () {
            _super.prototype.dispose.call(this);
            AbstractIntegration._this = null;
        };
        AbstractIntegration.prototype.append = function () {
        };
        AbstractIntegration.prototype.layout = function () {
        };
        AbstractIntegration.prototype.setLayoutData = function (args) {
        };
        return AbstractIntegration;
    }(Widget_21.Widget));
    exports.AbstractIntegration = AbstractIntegration;
});
define("widget/integration/Button$", ["require", "exports", "widget/integration/AbstractIntegration", "event/EventHub", "event/MessageType", "event/Event"], function (require, exports, AbstractIntegration_1, EventHub_17, MessageType_18, Event_15) {
    "use strict";
    var Button$ = (function (_super) {
        __extends(Button$, _super);
        function Button$(parentId, id, style) {
            _super.call(this, parentId, id, style);
        }
        Button$.prototype.reset = function () {
            var _this = this;
            this.$thisNode.on("click", function (e) {
                if (_this.enabled) {
                    EventHub_17.EventHub.dispatchEvent(MessageType_18.MessageType.WIDGET, { id: _this.id, evtType: Event_15.Event.CLICK });
                }
            });
            if (this.text) {
                this.setText({ text: this.text });
            }
        };
        Button$.prototype.setText = function (args) {
            this.text = args.text;
            this.$thisNode.find("span[text]").html(args.text);
        };
        return Button$;
    }(AbstractIntegration_1.AbstractIntegration));
    exports.Button$ = Button$;
});
define("widget/integration/Composite$", ["require", "exports", "widget/integration/AbstractContainer"], function (require, exports, AbstractContainer_1) {
    "use strict";
    var Composite$ = (function (_super) {
        __extends(Composite$, _super);
        function Composite$(parentId, id, style) {
            _super.call(this, parentId, id, style);
        }
        Composite$.prototype.reset = function () {
            this.$attachNode = this.$thisNode;
        };
        return Composite$;
    }(AbstractContainer_1.AbstractContainer));
    exports.Composite$ = Composite$;
});
define("widget/integration/Label$", ["require", "exports", "widget/integration/AbstractIntegration"], function (require, exports, AbstractIntegration_2) {
    "use strict";
    var Label$ = (function (_super) {
        __extends(Label$, _super);
        function Label$(parentId, id, style) {
            _super.call(this, parentId, id, style);
        }
        Label$.prototype.reset = function () {
            if (this.text) {
                this.setText({ text: this.text });
            }
        };
        Label$.prototype.setText = function (args) {
            this.$thisNode[0].innerHTML = args.text;
        };
        return Label$;
    }(AbstractIntegration_2.AbstractIntegration));
    exports.Label$ = Label$;
});
define("widget/integration/Text$", ["require", "exports", "widget/integration/AbstractIntegration", "ADORE", "event/EventHub", "event/MessageType", "event/Event"], function (require, exports, AbstractIntegration_3, ADORE_8, EventHub_18, MessageType_19, Event_16) {
    "use strict";
    var Text$ = (function (_super) {
        __extends(Text$, _super);
        function Text$(parentId, id, style) {
            _super.call(this, parentId, id, style);
        }
        Text$.prototype.reset = function () {
            if ((this.style & ADORE_8.ADORE.Password) === ADORE_8.ADORE.Password) {
                this.$thisNode.find("input").attr("type", "password");
            }
            var id = this.id;
            this.$thisNode.find("input").attr("id", this.id).on("input", function (e) {
                EventHub_18.EventHub.dispatchEvent(MessageType_19.MessageType.WIDGET, {
                    id: id,
                    text: $(this).val(),
                    evtType: Event_16.Event.MODIFY,
                    syncAttrName: "text"
                });
            });
            if (this.text) {
                this.setText({ text: this.text });
            }
            if (this.editable) {
                this.setEditable({ editable: this.editable });
            }
        };
        Text$.prototype.setText = function (args) {
            this.text = args.text;
            this.$thisNode.find("input").val(args.text);
        };
        Text$.prototype.setEditable = function (args) {
            this.editable = args.editable;
            if (args.editable) {
                this.$thisNode.find("input").removeAttr("readOnly");
            }
            else {
                this.$thisNode.find("input").attr("readOnly", "readOnly");
            }
        };
        return Text$;
    }(AbstractIntegration_3.AbstractIntegration));
    exports.Text$ = Text$;
});
define("widget/Label", ["require", "exports", "widget/Widget"], function (require, exports, Widget_22) {
    "use strict";
    var Label = (function (_super) {
        __extends(Label, _super);
        function Label(parentId, id, style) {
            _super.call(this, parentId, id, style);
            this.$thisNode = $(Label.TemplateLabel).attr({ id: this.id });
        }
        Label.prototype.setText = function (args) {
            var text = args.text;
            this.$thisNode[0].innerHTML = text;
        };
        Label.prototype.setFontSize = function (args) {
            this.$thisNode.css({ fontSize: args.fontSize });
        };
        Label.prototype.setAlignment = function (args) {
            this.$thisNode.css({ textAlign: args.alignment });
        };
        Label.prototype.setFocus = function () {
        };
        Label.TemplateLabel = "<nobr class=\"adore_label\"></nobr>";
        return Label;
    }(Widget_22.Widget));
    exports.Label = Label;
});
define("widget/List", ["require", "exports", "widget/Widget", "ADORE", "event/EventHub", "event/MessageType", "event/Event"], function (require, exports, Widget_23, ADORE_9, EventHub_19, MessageType_20, Event_17) {
    "use strict";
    var List = (function (_super) {
        __extends(List, _super);
        function List(parentId, id, style) {
            _super.call(this, parentId, id, style);
            this.$thisNode = $(List.TemplateCotainer).attr("id", this.id);
            this.itemTemplate = List.TemplateHorizontal;
            this.isHorizontal = true;
            if ((this.style & ADORE_9.ADORE.Vertical) === ADORE_9.ADORE.Vertical) {
                this.isHorizontal = false;
                this.itemTemplate = List.TemplateVertical;
            }
        }
        List.prototype.addItems = function (args) {
            var items = args.items;
            var $father = this.$thisNode.parent();
            this.$thisNode.detach();
            if (!items || items.length === 0) {
                return;
            }
            for (var i = 0; i < items.length; i++) {
                if (items[i].name) {
                    if (this.$thisNode.find("#" + items[i].name).length !== 0) {
                        this.setItem(items[i]);
                    }
                    else {
                        this.addItem(items[i]);
                    }
                }
            }
            if (this.fontSize) {
                this.$thisNode.find("span").css({ fontSize: this.fontSize });
            }
            this.$thisNode.appendTo($father);
        };
        List.prototype.setItem = function (item) {
            var $itemNode = this.$thisNode.find("#" + item.name);
            this.setItemAttr($itemNode, item);
        };
        List.prototype.addItem = function (item) {
            var $itemNode = $(this.itemTemplate).attr({ id: item.name });
            $itemNode.appendTo(this.$thisNode);
            this.setItemAttr($itemNode, item);
            var own = this;
            $itemNode.find("a").on("click", function (e) {
                if (!own.enabled) {
                    return;
                }
                $("a.adore_list_li_a_selected").removeClass("adore_list_li_a_selected");
                $(this).addClass("adore_list_li_a_selected");
                var itemIndex = own.indexOf($itemNode[0]);
                e.preventDefault();
                EventHub_19.EventHub.dispatchEvent(MessageType_20.MessageType.WIDGET, {
                    id: own.id,
                    selectIndex: itemIndex,
                    evtType: Event_17.Event.ON_CHANGE
                });
            });
        };
        List.prototype.setItemAttr = function ($itemNode, item) {
            $itemNode.find("a").find("span").text(item.name);
            if (item.imagePath) {
                $itemNode.find("img").attr("src", item.imagePath);
                if (this.isHorizontal) {
                    $itemNode.find("img").css({ width: "18px", height: "18px" });
                }
                else {
                    $itemNode.find(".adore_list_span").css("margin-top", "-5px");
                }
            }
            if (item.msgNum) {
                var $msgNode = $itemNode.find(".adore_list_message");
                if ($msgNode.length === 0) {
                    $msgNode = $(List.TemplateSpan);
                    $itemNode.prepend($msgNode);
                    if (this.isHorizontal) {
                        $msgNode.addClass("adore_list_message_horizontal");
                    }
                    else {
                        $msgNode.addClass("adore_list_message_vertical");
                    }
                }
            }
            else {
                $itemNode.find(".adore_list_message").remove();
            }
        };
        List.prototype.setItems = function (args) {
            var items = args.items;
            this.clear();
            this.addItems({ items: items });
        };
        List.prototype.setFontSize = function (args) {
            this.fontSize = args.fontSize;
            if (this.$thisNode) {
                this.$thisNode.find("span").css({ fontSize: args.fontSize });
            }
        };
        List.prototype.indexOf = function (item) {
            var $items = this.$thisNode.find("li");
            for (var i = 0; i < $items.length; i++) {
                if (item === $items[i]) {
                    return i;
                }
            }
            return -1;
        };
        List.prototype.select = function (args) {
            var index = args.index;
            var allA = this.$thisNode.find("a");
            if (index < 0 || index >= allA.length) {
                return;
            }
            $(allA[index]).trigger("click");
        };
        List.prototype.removeItem = function (args) {
            var ids = args.itemIds;
            if (ids && ids.length > 0) {
                for (var i = 0; i < ids.length; i++) {
                    this.$thisNode.find("#" + ids[i]).remove();
                }
            }
        };
        List.prototype.clear = function () {
            this.$thisNode.find("li").remove();
        };
        List.prototype.setFocus = function () {
        };
        List.TemplateCotainer = "\n    <ul class=\"adore_list\">\n    </ul>";
        List.TemplateHorizontal = "\n    <li class=\"adore_list_li_horizontal\">\n    <a href=\"#\" class=\"adore_list_li_a waves-effect\">\n        <img class=\"adore_list_img_horizontal\">\n        <span class=\"adore_list_span adore_list_span_horizontal\"></span>\n    </a>\n    </li> ";
        List.TemplateVertical = "\n    <li class=\"adore_list_li_vertical\">\n    <a href=\"#\" class=\"adore_list_li_a waves-effect\">\n        <img>\n\n        <div class=\"adore_list_span\">\n            <span></span>\n        </div>\n    </a>\n    </li>";
        List.TemplateSpan = "\n    <span class=\"adore_list_message\"></span>";
        return List;
    }(Widget_23.Widget));
    exports.List = List;
});
define("widget/MessageList", ["require", "exports", "widget/Widget"], function (require, exports, Widget_24) {
    "use strict";
    var MessageList = (function (_super) {
        __extends(MessageList, _super);
        function MessageList(parentId, id, style) {
            _super.call(this, parentId, id, style);
            this.$thisNode = $(MessageList.Template).attr("id", this.id);
        }
        MessageList.prototype.sendMessages = function (args) {
            var messages = args.messages;
            var currentTime;
            if (!this.userName || this.userName.length === 0) {
                return;
            }
            for (var i = 0; i < messages.length; i++) {
                if (messages[i].source === this.userName) {
                    if (!this.isShow || messages[i].time === currentTime) {
                        this.$thisNode.append("<div class=\"message clearfix\"><div class=\"message_blank\"></div><span class=\"triangle_right\"> </span><div class=\"article_right\">" + messages[i].message + "</div></div> ");
                    }
                    else {
                        this.$thisNode.append("<div class=\"message clearfix\"><div class=\"message_list_time\">" + messages[i].time + "</div><span class=\"triangle_right\"></span><div class=\"article_right\">" + messages[i].message + "</div></div> ");
                        currentTime = messages[i].time;
                    }
                }
                else if (messages[i].target === this.userName) {
                    if (!this.isShow || messages[i].time === currentTime) {
                        this.$thisNode.append("<div class=\"message clearfix\"><span class=\"triangle_left\"></span><div class=\"article_left\">" + messages[i].message + "</div></div>");
                    }
                    else {
                        this.$thisNode.append("<div class=\"message clearfix\"><div class=\"message_list_time\">" + messages[i].time + "</div><span class=\"triangle_left\"></span><div class=\"article_left\">" + messages[i].message + "</div></div>");
                        currentTime = messages[i].time;
                    }
                }
            }
        };
        MessageList.prototype.setUserName = function (args) {
            this.userName = args.userName;
        };
        MessageList.prototype.isShowTime = function (args) {
            this.isShow = args.isShow;
        };
        MessageList.prototype.setFocus = function () {
        };
        MessageList.Template = "<div class=\"adore_message_list\"></div>";
        return MessageList;
    }(Widget_24.Widget));
    exports.MessageList = MessageList;
});
define("widget/other/CustCollection", ["require", "exports", "widget/Widget", "event/EventHub", "event/MessageType", "event/Event"], function (require, exports, Widget_25, EventHub_20, MessageType_21, Event_18) {
    "use strict";
    var CustCollection = (function (_super) {
        __extends(CustCollection, _super);
        function CustCollection(parentId, id, style) {
            _super.call(this, parentId, id, style);
            this.$thisNode = $(CustCollection.TemplateBody).attr("id", this.id);
            this.itemHeaderTemplate = CustCollection.TemplateHeader;
            this.itemTemplate = CustCollection.TemplateContent;
            this.itemIconTemplate = CustCollection.TemplateImage;
            this.contentOne = new Array();
            this.contentTwo = new Array();
        }
        CustCollection.prototype.postLayout = function () {
            $(".collapsible").collapsible({
                accordion: false
            });
        };
        CustCollection.prototype.setContents = function (args) {
            var data = JSON.parse(args.attribute);
            for (var key in data) {
                var belongTo = key.length - key.replace(/,/g, "").length;
                switch (belongTo) {
                    case 0:
                        this.contentOne[parseInt(key)] = data[key];
                        this.contentTwo[parseInt(key)] = new Array();
                        break;
                    case 1:
                        var cutKey = key.substr(1, key.length - 2);
                        var location_1 = cutKey.split(",");
                        var m = Number(location_1[0]);
                        var n = Number(location_1[1]);
                        this.contentTwo[m][n] = data[key];
                        break;
                    default:
                        console.log("data error");
                        break;
                }
            }
        };
        CustCollection.prototype.initCollection = function () {
            var own = this;
            var flag = false;
            for (var i = 0; i < this.contentTwo.length; i++) {
                if (this.contentTwo[i].length > 0) {
                    flag = true;
                    break;
                }
            }
            if (flag) {
                for (var i = 0; i < this.contentOne.length; i++) {
                    var itemHeaderNode = $(this.itemHeaderTemplate);
                    itemHeaderNode.find("#itemHeader").text(this.contentOne[i]);
                    this.$thisNode.find("#itemHeaderBody").append(itemHeaderNode);
                    for (var j = 0; j < this.contentTwo[i].length; j++) {
                        var itemNode = $(this.itemTemplate);
                        var contentId = i + "_" + j;
                        var itemContentNode = itemNode.find("#itemContent").attr("id", contentId);
                        itemContentNode.text(this.contentTwo[i][j]);
                        itemContentNode.append(this.itemIconTemplate);
                        itemContentNode.on("click", function (event) {
                            var tempAttr = this.id.split("_");
                            $(this).children("img").remove();
                            var indexString = "[" + tempAttr[0] + "," + tempAttr[1] + "]";
                            EventHub_20.EventHub.dispatchEvent(MessageType_21.MessageType.WIDGET, {
                                id: own.id,
                                location: indexString,
                                evtType: Event_18.Event.CLICK
                            });
                        });
                        itemHeaderNode.find("#itemBody").append(itemNode);
                    }
                }
            }
        };
        CustCollection.TemplateBody = "\n    <div class=\"adore-hidden-scrollbar\" style=\"overflow: auto\">\n    <ul id=\"itemHeaderBody\" class=\"collapsible\" data-collapsible=\"expandable\" style=\"background-color: #f5f5f5\">\n    </ul>\n    </div>";
        CustCollection.TemplateHeader = "\n    <li style=\"width: 100%\">\n    <div id=\"itemHeader\" class=\"collapsible-header\" style=\"color: #6e7888;background-color: #e6e6e6\"></div>\n    <div class=\"collapsible-body\">\n        <div id=\"itemBody\" class=\"collection\">\n        </div>\n    </div>\n    </li>";
        CustCollection.TemplateContent = "\n    <a href=\"#!\" class=\"collection-item active waves-effect\">\n    <div id=\"itemContent\"></div>\n    </a>";
        CustCollection.TemplateImage = "\n    <img src=\"images/cust_collection/new.jpg\"\n     alt=\"\"\n     class=\"circle\"\n     style=\"width: 6%;float:left;margin-top: 2%;margin-left: -8%\">";
        return CustCollection;
    }(Widget_25.Widget));
    exports.CustCollection = CustCollection;
});
define("widget/Palette", ["require", "exports", "widget/Composite", "event/EventHub", "event/MessageType", "event/Event"], function (require, exports, Composite_7, EventHub_21, MessageType_22, Event_19) {
    "use strict";
    var Palette = (function (_super) {
        __extends(Palette, _super);
        function Palette(parentId, id, style) {
            _super.call(this, parentId, id, style);
            this.$thisNode = $(Palette.Template).attr("id", this.id);
            this.$leftBox = this.$thisNode.find(".select-box-left");
            this.$buttonUL = this.$thisNode.find("input[type='button']");
            this.$boxItem = this.$thisNode.find(".select-box-data");
        }
        Palette.prototype.setItems = function (args) {
            var items = args.items;
            this.addItems(items);
            var own = this;
            this.$buttonUL.click(function () {
                var i = $(this).index();
                var move = "";
                var targ = "";
                var direction = "";
                if (i === 0) {
                    move = ".select-box-left li.select-current";
                    targ = ".select-box-right";
                    direction = "0";
                }
                if (i === 1) {
                    move = "li.select-current";
                    direction = "1";
                }
                if (i === 2) {
                    move = ".select-box-right li.select-current";
                    targ = ".select-box-left";
                    direction = "2";
                }
                if (i === 3) {
                    move = "li.select-current";
                    direction = "3";
                }
                own.moveSelectBox(move, targ, direction);
            });
            this.$boxItem.click(function (event) {
                var $li = $(this).children();
                var cur = event.target;
                if ($(cur).is($li)) {
                    $(cur).addClass("select-current");
                    $(cur).siblings().removeClass("select-current");
                }
            });
        };
        Palette.prototype.addItems = function (items) {
            if (!items || items.length === 0) {
                return;
            }
            for (var i = 0; i < items.length; i++) {
                this.$leftBox.append("<li>" + items[i].name + "</li>");
            }
        };
        Palette.prototype.moveSelectBox = function (moveClass, targetClass, direction) {
            if ($(moveClass).length === 0) {
                return;
            }
            else {
                var own = this;
                if (direction === "0") {
                    var removeItemText_1 = "";
                    $.each($(moveClass), function () {
                        $(this).remove().appendTo(targetClass + "");
                        $(this).text($(this).text());
                        removeItemText_1 = $(this).text();
                    });
                    $(targetClass + " .select-current").removeClass("select-current");
                    EventHub_21.EventHub.dispatchEvent(MessageType_22.MessageType.WIDGET, {
                        id: own.id,
                        removeItemText: removeItemText_1,
                        direction: direction,
                        evtType: Event_19.Event.CLICK
                    });
                }
                if (direction === "1") {
                    moveClass = ".select-box-right li.select-current";
                    if ($(moveClass).length === 0) {
                        moveClass = ".select-box-left li.select-current";
                    }
                    $.each($(moveClass), function () {
                        if ($(this).prev()) {
                            $(this).prev().before($(this));
                        }
                    });
                    $(moveClass).removeClass("select-current");
                }
                if (direction === "2") {
                    var removeItemText = "";
                    $.each($(moveClass), function () {
                        $(this).remove().appendTo(targetClass + "");
                        $(this).text($(this).text());
                    });
                    $(targetClass + " .select-current").removeClass("select-current");
                    EventHub_21.EventHub.dispatchEvent(MessageType_22.MessageType.WIDGET, {
                        id: own.id,
                        removeItemText: removeItemText,
                        direction: direction,
                        evtType: Event_19.Event.CLICK
                    });
                }
                if (direction === "3") {
                    moveClass = ".select-box-right li.select-current";
                    if ($(moveClass).length === 0) {
                        moveClass = ".select-box-left li.select-current";
                    }
                    $.each($(moveClass), function () {
                        if ($(this).next()) {
                            $(this).next().after($(this));
                        }
                    });
                    $(moveClass).removeClass("select-current");
                }
            }
        };
        Palette.prototype.setFocus = function () {
        };
        Palette.Template = "\n    <div class=\"adore_palette\">\n    <!-- \u5DE6\u4FA7-->\n    <div class=\"select-box col s5 m5 l5\">\n        <ul class=\"select-box-data select-box-left\">\n        </ul>\n    </div>\n    <!-- \u4E2D\u95F4-->\n    <div class=\"select-btn col s2 m2 l2\">\n        <div >\n            <input type=\"button\" value=\"&gt;\">\n            <input type=\"button\" value=\"&and;\">\n            <input type=\"button\" value=\"&lt;\">\n            <input type=\"button\" value=\"&or;\">\n        </div>\n    </div>\n    <!-- \u53F3\u4FA7-->\n    <div class=\"select-box col s5 m5 l5\">\n        <ul class=\"select-box-data select-box-right\"></ul>\n    </div>\n</div>";
        return Palette;
    }(Composite_7.Composite));
    exports.Palette = Palette;
});
define("widget/PatternLock", ["require", "exports", "widget/Widget", "event/EventHub", "event/MessageType", "event/Event"], function (require, exports, Widget_26, EventHub_22, MessageType_23, Event_20) {
    "use strict";
    var PatternLock = (function (_super) {
        __extends(PatternLock, _super);
        function PatternLock(parentId, id, style) {
            _super.call(this, parentId, id, style);
            this.count = 1;
            this.$thisNode = $(PatternLock.Template).attr({ id: id });
        }
        PatternLock.prototype.setOptions = function (args) {
            this.options = args.options;
        };
        PatternLock.prototype.setArgs = function (args) {
            this.arg = args.arg;
        };
        PatternLock.prototype.setCount = function (args) {
            this.count = args.count;
        };
        PatternLock.prototype.layout = function () {
            this.append();
            this.$thisNode.GesturePasswd(this.options, this.arg);
        };
        PatternLock.prototype.show = function () {
            var own = this;
            var oldPwd = "-1";
            var flag = true;
            var count1 = 0;
            this.$thisNode.on("hasPasswd", function (e, passwd) {
                if (count1 === own.count - 1) {
                    if (oldPwd === "-1") {
                        own.$thisNode.trigger("passwdRight");
                        EventHub_22.EventHub.dispatchEvent(MessageType_23.MessageType.WIDGET, { id: own.id, evtType: Event_20.Event.ON_SLIDING, password: passwd });
                        own.$thisNode.closeModal();
                    }
                    else if (oldPwd !== passwd) {
                        own.$thisNode.trigger("passwdWrong");
                        EventHub_22.EventHub.dispatchEvent(MessageType_23.MessageType.WIDGET, { id: own.id, evtType: Event_20.Event.ON_SLIDING, password: "-1" });
                        own.$thisNode.closeModal();
                    }
                    else {
                        own.$thisNode.trigger("passwdWrong");
                        EventHub_22.EventHub.dispatchEvent(MessageType_23.MessageType.WIDGET, { id: own.id, evtType: Event_20.Event.ON_SLIDING, password: passwd });
                        own.$thisNode.closeModal();
                    }
                }
                else if (count1 === 0) {
                    own.$thisNode.trigger("passwdRight");
                    oldPwd = passwd;
                    count1 = count1 + 1;
                }
                else {
                    if (oldPwd === passwd) {
                        own.$thisNode.trigger("passwdRight");
                        count1 = count1 + 1;
                    }
                    else {
                        own.$thisNode.trigger("passwdWrong");
                        EventHub_22.EventHub.dispatchEvent(MessageType_23.MessageType.WIDGET, { id: own.id, evtType: Event_20.Event.ON_SLIDING, password: "-1" });
                        own.$thisNode.closeModal();
                    }
                }
            });
            this.$thisNode.openModal({
                dismissible: false,
                opacity: .5,
                in_duration: 300,
                out_duration: 200
            });
        };
        PatternLock.prototype.dispose = function () {
            $(".lean-overlay").remove();
            $("#" + this.id + "_lean_overlay").remove();
            _super.prototype.dispose.call(this);
        };
        PatternLock.Template = "<div class=\"modal adore_patternlock\"></div>";
        return PatternLock;
    }(Widget_26.Widget));
    exports.PatternLock = PatternLock;
    var GesturePasswd = (function () {
        function GesturePasswd(element, option, arg) {
            this.$element = $(element);
            this.options = option;
            var that = this;
            this.pr = option.pointRadii;
            this.rr = option.roundRadii;
            this.o = option.space;
            this.color = option.color;
            this.$element.css({
                "position": "relation",
                "width": this.options.width,
                "height": this.options.height,
                "background-color": option.backgroundColor,
                "overflow": "hidden",
                "cursor": "default"
            });
            if (!$(element).attr("id")) {
                $(element).attr("id", (Math.random() * 65535).toString());
            }
            this.id = "#" + $(element).attr("id");
            this.result = "";
            this.pList = [];
            this.sList = [];
            this.tP = new Point(0, 0);
            this.$element.append("<canvas class='main-c' width=" + this.options.width + " height=" + this.options.height + ">");
            this.$c = $(this.id + " .main-c")[0];
            this.$ctx = this.$c.getContext("2d");
            this.initDraw();
            this.touched = false;
            $(this.id).on("mousedown touchstart", { that: that }, function (e) {
                e.data.that.touched = true;
            });
            $(this.id).on("mouseup touchend", { that: that }, function (e) {
                e.data.that.touched = false;
                that.$ctx.clearRect(0, 0, that.options.width, that.options.height);
                that.$ctx.beginPath();
                that.$ctx.putImageData(e.data.that.initImg, 0, 0);
                that.allDraw(that.options.lineColor);
                for (var p in that.sList) {
                    if (e.data.that.pointInList(that.sList[p], e.data.that.pList)) {
                        e.data.that.result = e.data.that.result + (e.data.that.pointInList(that.sList[p], e.data.that.pList)).toString();
                    }
                }
                $(element).trigger("hasPasswd", that.result);
            });
            $(this.id).on("touchmove mousemove", { that: that }, function (e) {
                if (e.data.that.touched) {
                    var x = e.pageX || e.originalEvent.targetTouches[0].pageX;
                    var y = e.pageY || e.originalEvent.targetTouches[0].pageY;
                    x = x - that.$element.offset().left;
                    y = y - that.$element.offset().top;
                    var p = e.data.that.isIn(x, y);
                    console.log(x);
                    if (p !== 0) {
                        if (!e.data.that.pointInList(p, e.data.that.sList)) {
                            e.data.that.sList.push(p);
                        }
                    }
                    console.log(e.data.that.sList);
                    e.data.that.draw(x, y);
                }
            });
            $(this.id).on("passwdWrong", { that: that }, function (e) {
                that.$ctx.clearRect(0, 0, that.options.width, that.options.height);
                that.$ctx.beginPath();
                that.$ctx.putImageData(that.initImg, 0, 0);
                that.allDraw("#cc1c21");
                that.result = "";
                that.pList = [];
                that.sList = [];
                setTimeout(function () {
                    that.$ctx.clearRect(0, 0, that.options.width, that.options.height);
                    that.$ctx.beginPath();
                    that.initDraw();
                }, 500);
            });
            $(this.id).on("passwdRight", { that: that }, function (e) {
                that.$ctx.clearRect(0, 0, that.options.width, that.options.height);
                that.$ctx.beginPath();
                that.$ctx.putImageData(that.initImg, 0, 0);
                that.allDraw("#00a254");
                that.result = "";
                that.pList = [];
                that.sList = [];
                setTimeout(function () {
                    that.$ctx.clearRect(0, 0, that.options.width, that.options.height);
                    that.$ctx.beginPath();
                    that.initDraw();
                }, 500);
            });
        }
        GesturePasswd.prototype.initDraw = function () {
            this.$ctx.strokeStyle = this.color;
            this.$ctx.lineWidth = 2;
            for (var j = 0; j < 3; j++) {
                for (var i = 0; i < 3; i++) {
                    this.$ctx.moveTo(this.o / 2 + this.rr * 2 + i * (this.o + 2 * this.rr), this.o / 2 + this.rr + j * (this.o + 2 * this.rr));
                    this.$ctx.arc(this.o / 2 + this.rr + i * (this.o + 2 * this.rr), this.o / 2 + this.rr + j * (this.o + 2 * this.rr), this.rr, 0, 2 * Math.PI);
                    var tem = new Point(this.o / 2 + this.rr + i * (this.o + 2 * this.rr), this.o / 2 + this.rr + j * (this.o + 2 * this.rr));
                    if (this.pList.length < 9)
                        this.pList.push(tem);
                }
            }
            this.$ctx.stroke();
            this.initImg = this.$ctx.getImageData(0, 0, this.options.width, this.options.height);
        };
        GesturePasswd.prototype.isIn = function (x, y) {
            for (var p in this.pList) {
                if ((Math.pow((x - this.pList[p]["x"]), 2) + Math.pow((y - this.pList[p]["y"]), 2)) < Math.pow(this.rr, 2)) {
                    return this.pList[p];
                }
            }
            return 0;
        };
        GesturePasswd.prototype.pointDraw = function (c) {
            if (arguments.length > 0) {
                this.$ctx.strokeStyle = c;
                this.$ctx.fillStyle = c;
            }
            for (var p in this.sList) {
                this.$ctx.moveTo(this.sList[p]["x"] + this.pr, this.sList[p]["y"]);
                this.$ctx.arc(this.sList[p]["x"], this.sList[p]["y"], this.pr, 0, 2 * Math.PI);
                this.$ctx.fill();
            }
        };
        GesturePasswd.prototype.lineDraw = function (c) {
            if (arguments.length > 0) {
                this.$ctx.strokeStyle = c;
                this.$ctx.fillStyle = c;
            }
            if (this.sList.length > 0) {
                for (var p in this.sList) {
                    if (p === "0") {
                        console.log(this.sList[p]["x"], this.sList[p]["y"]);
                        this.$ctx.moveTo(this.sList[p]["x"], this.sList[p]["y"]);
                        continue;
                    }
                    this.$ctx.lineTo(this.sList[p]["x"], this.sList[p]["y"]);
                    console.log(this.sList[p]["x"], this.sList[p]["y"]);
                }
            }
        };
        GesturePasswd.prototype.allDraw = function (c) {
            if (arguments.length > 0) {
                this.pointDraw(c);
                this.lineDraw(c);
                this.$ctx.stroke();
            }
            else {
                this.pointDraw();
                this.lineDraw();
            }
        };
        ;
        GesturePasswd.prototype.draw = function (x, y) {
            this.$ctx.clearRect(0, 0, this.options.width, this.options.height);
            this.$ctx.beginPath();
            this.$ctx.putImageData(this.initImg, 0, 0);
            this.$ctx.lineWidth = 4;
            this.pointDraw(this.options.lineColor);
            this.lineDraw(this.options.lineColor);
            this.$ctx.lineTo(x, y);
            this.$ctx.stroke();
        };
        GesturePasswd.prototype.pointInList = function (poi, list) {
            for (var p in list) {
                if (poi["x"] === list[p]["x"] && poi["y"] === list[p]["y"]) {
                    var i = parseInt(p);
                    return ++i;
                }
            }
            return false;
        };
        GesturePasswd.PatternLockDefaultOptions = {
            zindex: 100,
            roundRadii: 25,
            pointRadii: 6,
            space: 30,
            width: 240,
            height: 240,
            lineColor: "#00aec7",
            backgroundColor: "#252736",
            color: "#FFFFFF"
        };
        return GesturePasswd;
    }());
    exports.GesturePasswd = GesturePasswd;
    var Point = (function () {
        function Point(x, y) {
            this.x = x;
            this.y = y;
        }
        return Point;
    }());
    exports.Point = Point;
    ;
    (function ($) {
        function Plugin(option, arg) {
            this.each(function () {
                var $this = $(this);
                var options = $.extend({}, GesturePasswd.PatternLockDefaultOptions, typeof option === "object" && option);
                var data = $this.data("GesturePasswd");
                var action = typeof option === "string" ? option : NaN;
                if (!data)
                    $this.data("danmu", (data = new GesturePasswd(this, options)));
                if (action)
                    data[action](arg);
            });
        }
        $.fn.GesturePasswd = Plugin;
    })(jQuery);
});
define("widget/PictureList", ["require", "exports", "widget/Widget", "event/EventHub", "event/MessageType", "event/Event"], function (require, exports, Widget_27, EventHub_23, MessageType_24, Event_21) {
    "use strict";
    var PictureList = (function (_super) {
        __extends(PictureList, _super);
        function PictureList(parentId, id, style) {
            _super.call(this, parentId, id, style);
            this.$thisNode = $(PictureList.Template0).attr({ id: id });
        }
        PictureList.prototype.addItems = function (args) {
            var items = args.items;
            if (!items || items.length === 0) {
                return;
            }
            var $father = this.$thisNode.parent();
            if ($father.length !== 0) {
                this.$thisNode.detach();
            }
            for (var i = 0; i < items.length; i++) {
                if (items[i].id) {
                    if (this.$thisNode.find("#" + items[i].id).length !== 0) {
                        this.setItem(items[i]);
                    }
                    else {
                        this.addItem(items[i]);
                    }
                }
                else {
                    this.addItem(items[i]);
                }
            }
            if ($father.length !== 0) {
                this.$thisNode.appendTo($father);
            }
        };
        PictureList.prototype.setItems = function (args) {
            var items = args.items;
            this.clear();
            this.addItems({ items: items });
        };
        PictureList.prototype.addItem = function (args) {
            var itemNode = args.id ? $(PictureList.Template1).attr({ id: args.id }) : $(PictureList.Template1);
            itemNode.appendTo(this.$thisNode);
            this.setItemAttr(itemNode, args);
            var own = this;
            itemNode.find("img").on("click", function (e) {
                var index = own.indexOf(itemNode[0]);
                var itemID = itemNode.attr("id");
                EventHub_23.EventHub.dispatchEvent(MessageType_24.MessageType.WIDGET, {
                    id: own.id,
                    evtType: Event_21.Event.CLICK,
                    index: index,
                    itemID: itemID
                });
            });
        };
        PictureList.prototype.indexOf = function (item) {
            var items = this.$thisNode.find("div.adore-picture-list-img");
            for (var i = 0; i < items.length; i++) {
                if (item === items[i]) {
                    return i;
                }
            }
            return -1;
        };
        PictureList.prototype.setItem = function (args) {
            var itemNode = this.$thisNode.find("#" + args.id);
            this.setItemAttr(itemNode, args);
        };
        PictureList.prototype.setItemAttr = function (itemNode, args) {
            itemNode.find("img").attr("src", args.imagePath);
        };
        PictureList.prototype.removeItem = function (args) {
            var ids = args.itemIds;
            if (ids && ids.length > 0) {
                for (var i = 0; i < ids.length; i++) {
                    this.$thisNode.find("#" + ids[i]).remove();
                }
            }
        };
        PictureList.prototype.clear = function () {
            this.$thisNode.find("div.adore-picture-list-img").remove();
        };
        PictureList.prototype.setFocus = function () {
        };
        PictureList.Template0 = " <div class=\"row\"></div>";
        PictureList.Template1 = "<div class=\"adore-picture-list-img col s4 m3 l2 waves-effect\"><img class=\"responsive-img\"></div>";
        return PictureList;
    }(Widget_27.Widget));
    exports.PictureList = PictureList;
});
define("widget/RadioButton", ["require", "exports", "widget/Widget", "event/EventHub", "event/MessageType", "event/Event", "hotkey/Keys"], function (require, exports, Widget_28, EventHub_24, MessageType_25, Event_22, Keys_8) {
    "use strict";
    var RadioButton = (function (_super) {
        __extends(RadioButton, _super);
        function RadioButton(parentId, id, style) {
            _super.call(this, parentId, id, style);
            this.$thisNode = $(RadioButton.TemplateRadioButton).attr({ id: this.id });
            var tmpId = this.id;
            var own = this;
            this.$thisNode.find("input[type=radio]").attr("id", this.id + "_radio").on("change", function (e, options) {
                own.triggerOtherChangeEvent(this, options);
                EventHub_24.EventHub.dispatchEvent(MessageType_25.MessageType.WIDGET, {
                    id: tmpId,
                    checked: this.checked + "",
                    evtType: Event_22.Event.ON_CHANGE,
                    syncAttrName: this.checked
                });
            }).on("focus", function (e) {
                own.sendFocusGain();
            }).on("blur", function (e) {
                own.handleBlur();
            });
            this.$thisNode.find("label").attr("for", this.id + "_radio");
        }
        RadioButton.prototype.triggerOtherChangeEvent = function (thisGroup, options) {
            if (options === "setChecked") {
                return;
            }
            var $radioGroup = $("input[name='" + this.groupName + "']");
            for (var i = 0; i < $radioGroup.length; i++) {
                if ($($radioGroup[i]).attr("checked") === "checked") {
                    $radioGroup[i].checked = false;
                    $($radioGroup[i]).removeAttr("checked");
                    $($radioGroup[i]).trigger("change", ["setChecked"]);
                    break;
                }
            }
            $(thisGroup).attr("checked", "checked");
        };
        RadioButton.prototype.setName = function (args) {
            this.$thisNode.find("label").text(args.name);
        };
        RadioButton.prototype.setGroupName = function (args) {
            this.groupName = args.group;
            this.$thisNode.find("input").attr("name", this.groupName);
        };
        RadioButton.prototype.setChecked = function (args) {
            if (args.isChecked) {
                this.reset((this.$thisNode.find("input[type]")[0]));
            }
        };
        RadioButton.prototype.reset = function (thisGroup) {
            if (thisGroup.checked) {
                return;
            }
            var $radioGroup = $("input[name='" + this.groupName + "']");
            for (var i = 0; i < $radioGroup.length; i++) {
                if ($($radioGroup[i]).attr("checked") === "checked") {
                    $radioGroup[i].checked = false;
                    $($radioGroup[i]).removeAttr("checked");
                    $($radioGroup[i]).trigger("change", ["setChecked"]);
                    break;
                }
            }
            $(thisGroup).attr("checked", "checked");
            thisGroup.checked = true;
            $(thisGroup).trigger("change", ["setChecked"]);
        };
        RadioButton.prototype.setEnabled = function (args) {
            this.enabled = args.enabled;
            if (this.enabled) {
                this.$thisNode.find("input").removeAttr("disabled");
            }
            else {
                this.$thisNode.find("input").attr("disabled", "disabled");
            }
        };
        RadioButton.prototype.setFocus = function () {
            var inputNode = this.$thisNode.find("input");
            if (document.activeElement !== inputNode[0]) {
                inputNode.focus();
            }
            this.$thisNode.find("label").addClass("adore_check_button_focus_label");
        };
        RadioButton.prototype.handleBlur = function () {
            this.$thisNode.find("label").removeClass("adore_check_button_focus_label");
        };
        RadioButton.prototype.handleKeyDownEvent = function (e, hasFilter) {
            if (e.keyCode === Keys_8.Keys.SPACE || e.keyCode === Keys_8.Keys.ENTER || e.keyCode === Keys_8.Keys.NUMPAD_ENTER) {
                this.$thisNode.find("input").click();
                return;
            }
            _super.prototype.handleKeyDownEvent.call(this, e, hasFilter);
        };
        RadioButton.prototype.handleKeyUpEvent = function (e) {
            if (e.keyCode === Keys_8.Keys.SPACE || e.keyCode === Keys_8.Keys.ENTER || e.keyCode === Keys_8.Keys.NUMPAD_ENTER) {
                return;
            }
            _super.prototype.handleKeyUpEvent.call(this, e);
        };
        RadioButton.TemplateRadioButton = "<p>\n    <input name=\"group1\" type=\"radio\"/>\n    <label></label>\n    </p>";
        return RadioButton;
    }(Widget_28.Widget));
    exports.RadioButton = RadioButton;
});
define("widget/RollingLabel", ["require", "exports", "widget/Widget"], function (require, exports, Widget_29) {
    "use strict";
    var RollingLabel = (function (_super) {
        __extends(RollingLabel, _super);
        function RollingLabel(parentId, id, style) {
            _super.call(this, parentId, id, style);
            this.$thisNode = $(RollingLabel.Template).attr("id", this.id);
        }
        RollingLabel.prototype.setText = function (args) {
            var text = args.text;
            this.$thisNode.text(text);
        };
        RollingLabel.prototype.setFocus = function () {
        };
        RollingLabel.Template = "<marquee class=\"adore_label\" scrollamount=\"5\"></marquee>";
        return RollingLabel;
    }(Widget_29.Widget));
    exports.RollingLabel = RollingLabel;
});
define("widget/Select", ["require", "exports", "widget/Widget", "event/Event", "event/MessageType", "event/EventHub", "hotkey/Keys"], function (require, exports, Widget_30, Event_23, MessageType_26, EventHub_25, Keys_9) {
    "use strict";
    var Select = (function (_super) {
        __extends(Select, _super);
        function Select(parentId, id, style) {
            _super.call(this, parentId, id, style);
            this.isLayout = false;
            this.hadIcon = false;
            this.maxShowItems = 6;
            this.focusLostFromText_DropDownShow_ArrowFocus = false;
            this.focusLostFromText_DropDownShow = false;
            this.$thisNode = $(Select.Template).attr("id", this.id);
            this.$iconNode = this.$thisNode.find("i:first").attr("id", this.id + "_icon");
            this.$dropDownArrow = this.$thisNode.find("i.mdi-navigation-arrow-drop-down").attr("id", this.id + "_arrow");
            this.$textCode = this.$thisNode.find("input").attr("id", this.id + "_input");
            this.$thisNode.find("label").attr("for", this.id + "_input");
            this.datas = [];
            this.selectDatas = new Array();
            this.maxShowItems = 6;
            this.scrollIndexs = [0, this.maxShowItems - 1];
            var own = this;
            var widgetId = this.id;
            this.$dropDownArrow.on("click", function (e) {
                var show = !own.isDropDownShow();
                if (show) {
                    own.$textCode.focus();
                }
                own.showDropDown(widgetId, show, !show);
            });
            this.$textCode.on("keydown", function (e) {
                own.handleKeyDown(e, own.id);
            });
            this.$textCode.on("blur", function (e) {
                if (!own.focusLostFromText_DropDownShow) {
                    own.handleOnBlur();
                }
            });
            this.$textCode.on("focus", function (e) {
                own.$textCode.select();
                own.sendFocusGain();
            });
            this.$textCode.on("input", function (e) {
                own.handleInput(e);
            });
        }
        Select.prototype.setItems = function (args) {
            this.datas = args.items;
            this.selectDatas.splice(0, this.selectDatas.length);
            for (var i = 0; i < this.datas.length; i++) {
                this.selectDatas.push(this.datas[i]);
            }
        };
        Select.prototype.handleMouseDownEvent = function (e) {
            this.focusLostFromText_DropDownShow = null;
            if (document.activeElement === this.$textCode.get(0) && this.isDropDownShow()) {
                this.focusLostFromText_DropDownShow = true;
            }
            else {
                this.focusLostFromText_DropDownShow = false;
            }
            _super.prototype.handleMouseDownEvent.call(this, e);
        };
        Select.prototype.handleMouseUpEvent = function (e) {
            this.focusLostFromText_DropDownShow = false;
            _super.prototype.handleMouseUpEvent.call(this, e);
        };
        Select.prototype.handleInput = function (e) {
            var value = this.$textCode.val();
            this.filterItems(value);
            this.showDropDown(this.id, true, false);
        };
        Select.prototype.handleOnBlur = function () {
            var value = this.$textCode.val();
            this.setText({ text: value });
            this.checkRequisite();
            var mouseOn = $("#" + this.id + "_dropDown").attr("mouseOn");
            if (mouseOn === "false") {
                this.showDropDown(this.id, false, false);
            }
        };
        Select.prototype.setName = function (args) {
            var name = args.name;
            this.$thisNode.find("label").text(name);
        };
        Select.prototype.setEnabled = function (args) {
            _super.prototype.setEnabled.call(this, args);
            var input = this.$thisNode.find("input");
            if (this.enabled) {
                input.removeAttr("disabled");
                this.$thisNode.find("i").removeClass("icon_disabled");
                if (this.requisite) {
                    if (input.val() == null || input.val() === "") {
                        this.addRequisite();
                    }
                }
            }
            else {
                this.$thisNode.find("input").attr("disabled", "disabled");
                if (this.requisite) {
                    this.removeRequisite();
                }
                this.$thisNode.find("i").addClass("icon_disabled");
            }
        };
        Select.prototype.postLayout = function () {
            this.isLayout = true;
            if (this.requisite) {
                this.setRequisite({ requisite: true });
            }
        };
        Select.prototype.setText = function (args) {
            var inputNode = this.$thisNode.find("input");
            inputNode.val(args.text);
            if (args.text.length > 0) {
                inputNode.siblings('label').addClass('active');
                this.$iconNode.addClass("active");
            }
            else {
                inputNode.siblings('label').removeClass('active');
                this.$iconNode.removeClass("active");
            }
            if ((args.text == null || args.text === "") && this.requisite) {
                this.addRequisite();
            }
            else {
                this.removeRequisite();
            }
        };
        Select.prototype.checkRequisite = function () {
            if (this.requisite) {
                var inputSelector = this.$thisNode.find('input');
                var value = inputSelector.val();
                if (value) {
                    this.removeRequisite();
                }
                else {
                    this.addRequisite();
                    this.showSpan('请输入数据!');
                }
            }
        };
        Select.prototype.showSpan = function (msg) {
            if (this.$thisNode.find('span').css("display") === "none") {
                this.$thisNode.find('span').html(msg).show().delay(2000).fadeOut(300);
            }
            $("#" + this.id + "_dropDown").css("margin-top", "-21px");
        };
        Select.prototype.setRequisite = function (args) {
            this.requisite = args.requisite;
            if (!this.isLayout) {
                return;
            }
            if (this.requisite) {
                if (this.$thisNode.find('input').val()) {
                    this.removeRequisite();
                }
                else {
                    this.addRequisite();
                }
            }
        };
        Select.prototype.removeRequisite = function () {
            this.$thisNode.find('input').removeClass('adore_InputRequisite');
            this.$thisNode.find("label").removeClass('adore_requisiteColor');
            this.$iconNode.removeClass('adore_requisiteColor');
            this.hideSpan();
        };
        Select.prototype.hideSpan = function () {
            this.$thisNode.find('span').css('display', 'none');
        };
        Select.prototype.addRequisite = function () {
            this.$thisNode.find('input').addClass('adore_InputRequisite');
            this.$thisNode.find("label").addClass('adore_requisiteColor');
            this.$iconNode.addClass('adore_requisiteColor');
        };
        Select.prototype.setFocus = function () {
            var dropDownNode = $("#" + this.id + "_dropDown");
            if (this.$thisNode.find("input")[0] !== document.activeElement && dropDownNode.css("display") !== "block") {
                this.$thisNode.find("input").focus();
            }
        };
        Select.prototype.setIcon = function (args) {
            this.$iconNode.addClass(args.icon);
            if (args.icon) {
                this.hadIcon = true;
            }
            else {
                this.hadIcon = false;
            }
            if (this.$thisNode.find("input").val().length > 0) {
                this.$thisNode.find("input").siblings('label').addClass('active');
                this.$iconNode.addClass("active");
            }
            this.$thisNode.find('span').addClass('span_prefix');
        };
        Select.prototype.dispose = function () {
            $(document).unbind("click." + this.id);
            _super.prototype.dispose.call(this);
            $("#" + this.id + "_dropDown").remove();
        };
        Select.prototype.handleKeyDown = function (e, widgetId) {
            var dropDown = $("#" + widgetId + "_dropDown");
            var dis = dropDown.css("display");
            if (e.keyCode === Keys_9.Keys.BACKSPACE) {
                return;
            }
            if ((!dis || dis === "none") && e.keyCode !== Keys_9.Keys.ENTER) {
                if (e.keyCode === Keys_9.Keys.DOWN_ARROW || e.keyCode === Keys_9.Keys.SPACE) {
                    this.showDropDown(widgetId, true, false);
                    e.preventDefault();
                    e.stopPropagation();
                }
                return;
            }
            var items = dropDown.find("li");
            var currentIndex = parseInt(dropDown.attr("currentIndex"));
            if (e.keyCode === Keys_9.Keys.UP_ARROW) {
                if (currentIndex === -1) {
                    currentIndex = items.length - 1;
                }
                else {
                    currentIndex--;
                }
                items.css("background-color", "#FFFFFF");
                if (currentIndex < 0) {
                    currentIndex = -1;
                }
                else {
                    $(items[currentIndex]).css("background-color", "#BEBEBE");
                    this.setText({ text: this.selectDatas[currentIndex] });
                }
                this.refreshScroll(dropDown, currentIndex);
                e.preventDefault();
            }
            else if (e.keyCode === Keys_9.Keys.DOWN_ARROW) {
                currentIndex++;
                items.css("background-color", "#FFFFFF");
                if (currentIndex >= items.length) {
                    currentIndex = -1;
                }
                else {
                    $(items[currentIndex]).css("background-color", "#BEBEBE");
                    this.setText({ text: this.selectDatas[currentIndex] });
                }
                this.refreshScroll(dropDown, currentIndex);
                e.preventDefault();
            }
            else if (e.keyCode === Keys_9.Keys.ENTER) {
                if (currentIndex >= 0 && currentIndex < items.length) {
                    this.setText({ text: $(items[currentIndex]).text().trim() });
                    this.checkRequisite();
                }
                this.showDropDown(this.id, false, true);
                e.preventDefault();
                e.stopPropagation();
            }
            dropDown.attr("currentIndex", currentIndex + "");
        };
        Select.prototype.refreshScroll = function (dropDown, currentIndex) {
            if (currentIndex === -1) {
                return;
            }
            var count = dropDown.find("li").length - 1;
            var needRefresh = false;
            if (currentIndex < this.scrollIndexs[0]) {
                var endIndex = currentIndex + this.maxShowItems - 1;
                endIndex = endIndex > count ? count : endIndex;
                this.scrollIndexs = [currentIndex, endIndex];
                needRefresh = true;
            }
            else if (currentIndex > this.scrollIndexs[1]) {
                var beginIndex = currentIndex - this.maxShowItems + 1;
                beginIndex = beginIndex < 0 ? 0 : beginIndex;
                this.scrollIndexs = [beginIndex, currentIndex];
                needRefresh = true;
            }
            if (needRefresh) {
                var h = dropDown.find("li").height();
                dropDown[0].scrollTop = h * this.scrollIndexs[0];
            }
        };
        Select.prototype.showDropDown = function (widgetId, show, changedFocus) {
            if (this.$thisNode.find("input").attr("disabled")) {
                return;
            }
            var isDropDownShow = this.isDropDownShow();
            if (!show) {
                $("#" + widgetId + "_dropDown").css("display", "none");
                this.handleModify(changedFocus);
                return;
            }
            var textCode = $("#" + widgetId + "_input");
            var width = textCode.width();
            var height = textCode.height();
            $("#" + widgetId + "_dropDown").remove();
            var dropDown = $(Select.TemplateDropdown).attr("id", widgetId + "_dropDown");
            dropDown.attr({ mouseOn: "false" });
            dropDown.appendTo(this.$thisNode);
            dropDown.attr("currentIndex", "-1");
            dropDown.attr("currentIndex", "-1");
            if (this.hadIcon) {
                dropDown.css("margin-left", " 3rem");
            }
            var liNode;
            if (this.selectDatas) {
                for (var i = 0; i < this.selectDatas.length; i++) {
                    liNode = $(Select.TemplateLi).attr("index", i + "");
                    liNode.find("a").text(this.selectDatas[i]);
                    liNode.appendTo(dropDown);
                }
            }
            var len = dropDown.find("li").length;
            if (len > 0) {
                var tmpId_1 = widgetId;
                var own_5 = this;
                dropDown.find("li").find("a").on("click", function (e) {
                    var value = $(this).text().trim();
                    own_5.setText({ text: value });
                    own_5.checkRequisite();
                    own_5.showDropDown(tmpId_1, false, true);
                });
                dropDown.on("mouseover", function (e) {
                    dropDown.attr("mouseOn", "true");
                });
                dropDown.on("mouseout", function (e) {
                    dropDown.attr("mouseOn", "false");
                });
                dropDown.css("display", "block");
                dropDown.css("width", "135px");
                if (dropDown.width() < width) {
                    dropDown.css("width", width);
                }
                if (this.$thisNode.find('span').css("display") === "block") {
                    dropDown.css("margin-top", "-21px");
                }
                if (len > this.maxShowItems) {
                    var h = $(dropDown.find("li")[0]).height();
                    var maxHeight = h * this.maxShowItems;
                    dropDown.css("height", maxHeight);
                }
                var dropdown_offsetTop = 0;
                var container_offsetTop = 0;
                var container_height = 0;
                var limit_height = 0;
                var $node = this.$thisNode;
                dropdown_offsetTop = dropDown.offset().top + 15;
                dropDown.addClass("adore_dropDown_show");
                while (1) {
                    var tagname = $node.get(0).tagName;
                    if (tagname.match("BODY") !== null) {
                        container_height = $node.height();
                        break;
                    }
                    var id_str = $node.attr("id");
                    if (typeof (id_str) !== "undefined") {
                        if (id_str.match("AdoreShell") !== null) {
                            container_offsetTop = $node.offset().top;
                            container_height = $node.height();
                            break;
                        }
                    }
                    $node = $node.parent();
                }
                limit_height = container_height + container_offsetTop - dropdown_offsetTop;
                if (dropDown.height() > limit_height) {
                    var top_length = dropDown.height() - limit_height + 25;
                    var str_length = "-" + top_length + "px";
                    dropDown.css("margin-top", str_length);
                }
            }
            else {
                dropDown.css("display", "none");
            }
        };
        Select.prototype.handleKeyDownEvent = function (e, hasFilter) {
            if (this.handleKeyEvent(e)) {
                _super.prototype.handleKeyDownEvent.call(this, e, hasFilter);
            }
        };
        Select.prototype.handleKeyUpEvent = function (e) {
            if (this.handleKeyEvent(e)) {
                _super.prototype.handleKeyUpEvent.call(this, e);
            }
        };
        Select.prototype.handleKeyEvent = function (e) {
            if ($("#" + this.id + "_dropDown").css("display") === "block") {
                return false;
            }
            if (e.keyCode === Keys_9.Keys.DOWN_ARROW) {
                return false;
            }
            return true;
        };
        Select.prototype.getSelectedIndex = function (selectedText) {
            if (!selectedText || selectedText === "") {
                return -1;
            }
            else {
                for (var i = 0; i < this.datas.length; i++) {
                    if (this.datas[i].indexOf(selectedText) != -1) {
                        return i;
                    }
                }
                return -1;
            }
        };
        Select.prototype.handleModify = function (changedFocus) {
            var selectedText = this.$textCode.val();
            var selectedIndex = this.getSelectedIndex(selectedText);
            if (selectedIndex >= 0) {
                this.setText({ text: this.datas[selectedIndex] });
            }
            else {
                this.setText({ text: "" });
            }
            EventHub_25.EventHub.dispatchEvent(MessageType_26.MessageType.WIDGET, {
                id: this.id,
                selectedIndex: selectedIndex + "",
                changedFocus: changedFocus + "",
                evtType: Event_23.Event.ON_CHANGE
            });
            this.reset();
        };
        Select.prototype.isDropDownShow = function () {
            var $dropDownNode = $("#" + this.id + "_dropDown");
            if ($dropDownNode) {
                var dis = $dropDownNode.css("display");
                if (dis) {
                    if (dis === "block")
                        return true;
                }
            }
            return false;
        };
        Select.prototype.refreshDropDownItemBGC = function (selectedIndex) {
            var $dropDown = $("#" + this.id + "_dropDown");
            var $items = $dropDown.find("li");
            $items.css("background-color", "#FFFFFF");
            if (selectedIndex < 0) {
            }
            else {
                $($items[selectedIndex]).css("background-color", "#BEBEBE");
            }
        };
        Select.prototype.filterItems = function (filterText) {
            this.selectDatas.splice(0, this.selectDatas.length);
            for (var i = 0; i < this.datas.length; i++) {
                if (this.datas[i].indexOf(filterText) != -1) {
                    this.selectDatas.push(this.datas[i]);
                }
            }
        };
        Select.prototype.reset = function () {
            this.selectDatas.splice(0, this.selectDatas.length);
            for (var i = 0; i < this.datas.length; i++) {
                this.selectDatas.push(this.datas[i]);
            }
        };
        Select.Template = "\n    <div class=\"input-field\">\n        <i class=\"icon_normal\"></i>\n        <i class=\"mdi-navigation-arrow-drop-down adore_select_arrow\"></i>\n        <input type=\"text\">\n        <label></label>\n        <span class=\"span_base\"></span>\n    </div>";
        Select.TemplateDropdown = "<ul class= \"adore_dropDown dropdown-content\"></ul>";
        Select.TemplateLi = "\n        <li>\n            <a href='#!' class=\"waves-effect\"></a>\n        </li>";
        return Select;
    }(Widget_30.Widget));
    exports.Select = Select;
});
define("widget/Slider", ["require", "exports", "widget/Widget", "event/EventHub", "event/MessageType", "event/Event"], function (require, exports, Widget_31, EventHub_26, MessageType_27, Event_24) {
    "use strict";
    var Slider = (function (_super) {
        __extends(Slider, _super);
        function Slider(parentId, id, style) {
            _super.call(this, parentId, id, style);
            this.$thisNode = $(Slider.Template).attr("id", this.id);
            this.slider = this.$thisNode[0];
            this.step = 1;
            this.min = 0;
            this.max = 100;
            this.startValue = 0;
            this.value = this.startValue;
        }
        Slider.prototype.setStep = function (args) {
            this.step = args.step;
            if (this.isLayout) {
                var own = this;
                this.slider.noUiSlider.updateOptions({
                    step: own.step,
                    range: {
                        "min": own.min,
                        "max": own.max
                    }
                });
            }
        };
        Slider.prototype.setRange = function (args) {
            this.max = args.max;
            this.min = args.min;
            if (this.isLayout) {
                var own = this;
                this.slider.noUiSlider.updateOptions({
                    range: {
                        "min": own.min,
                        "max": own.max
                    }
                });
            }
        };
        Slider.prototype.setValue = function (args) {
            this.value = args.value;
            if (this.isLayout) {
                this.slider.noUiSlider.set(this.value);
            }
        };
        Slider.prototype.postLayout = function () {
            this.isLayout = true;
            var own = this;
            noUiSlider.create(this.slider, {
                start: this.min,
                step: own.step,
                connect: "lower",
                tooltips: [true],
                range: {
                    "min": own.min,
                    "max": own.max
                }
            });
            $(this.slider).find("div.noUi-tooltip").css({ display: "none" });
            this.slider.noUiSlider.on("start", function () {
                $(own.slider).find("div.noUi-tooltip").css({ display: "block" });
                own.startValue = own.slider.noUiSlider.get();
            });
            this.slider.noUiSlider.on("end", function () {
                $(own.slider).find("div.noUi-tooltip").css({ display: "none" });
                var endValue = own.slider.noUiSlider.get();
                if (own.startValue !== endValue) {
                    EventHub_26.EventHub.dispatchEvent(MessageType_27.MessageType.WIDGET, {
                        id: own.id,
                        evtType: Event_24.Event.ON_CHANGE,
                        value: endValue
                    });
                }
            });
        };
        Slider.Template = "<div class=\"adore-slider\"></div>";
        return Slider;
    }(Widget_31.Widget));
    exports.Slider = Slider;
});
define("widget/tabfolder/TabFolder", ["require", "exports", "widget/Composite", "util/TabUtil"], function (require, exports, Composite_8, TabUtil_1) {
    "use strict";
    var TabFolder = (function (_super) {
        __extends(TabFolder, _super);
        function TabFolder(parentId, id, style) {
            _super.call(this, parentId, id, style);
            this.$thisNode = $(TabFolder.TemplateNormal).attr("id", this.id);
            var tmpTab = this.$thisNode.find(".adore_tabs");
            this.$tabs = tmpTab.attr("id", this.id + "_tabs");
            this.$attachNode = this.$thisNode;
            var tabFolderId = this.id + "_tabs";
            this.$tabs.find("li.tab_left_move").on("click", function (e) {
                TabUtil_1.TabUtil.handleTabLeftMoveClick(tabFolderId);
            });
            this.$tabs.find("li.tab_right_move").on("click", function (e) {
                TabUtil_1.TabUtil.handleTabRightMoveClick(tabFolderId);
            });
            this.originalWidth = window.innerWidth;
            var own = this;
            this.resizeListener = function () {
                if (window.innerWidth !== own.originalWidth) {
                    own.originalWidth = window.innerWidth;
                    var tabs = $("#" + tabFolderId);
                    if (tabs.find("li.adore_tab").length !== 0) {
                        TabUtil_1.TabUtil.tabsSwitch(tabs);
                        TabUtil_1.TabUtil.refreshTabs(tabs);
                    }
                }
            };
            $(window).on("resize", this.resizeListener);
        }
        TabFolder.prototype.addChild = function (child) {
            this.children.push(child);
        };
        TabFolder.prototype.layout = function () {
            if (!document.getElementById(this.id)) {
                this.$thisNode.appendTo(this.parent.$attachNode);
            }
        };
        TabFolder.prototype.dispose = function () {
            $(window).off("resize", this.resizeListener);
            var listener = this.$tabs.data("resize_listener");
            if (listener) {
                $(window).off("resize", listener);
            }
            _super.prototype.dispose.call(this);
        };
        TabFolder.TemplateNormal = "\n        <div>\n            <ul class=\"adore_tabs\">\n                <li class=\"adore_tab_space col\"></li>\n                <li class=\"tab_left_move col\"><div class=\"arrow_left\"/></li>\n                <li class=\"tab_right_move\"><div class=\"arrow_right\"/></li>\n            </ul>\n        </div>";
        return TabFolder;
    }(Composite_8.Composite));
    exports.TabFolder = TabFolder;
});
define("widget/tabfolder/TabItem", ["require", "exports", "widget/Widget", "event/EventHub", "event/MessageType", "event/Event", "ADORE", "util/WidgetManager", "util/TabUtil", "widget/tabfolder/TabFolder"], function (require, exports, Widget_32, EventHub_27, MessageType_28, Event_25, ADORE_10, WidgetManager_5, TabUtil_2, TabFolder_1) {
    "use strict";
    var TabItem = (function (_super) {
        __extends(TabItem, _super);
        function TabItem(parentId, id, style) {
            _super.call(this, parentId, id, style);
            if (style == ADORE_10.ADORE.Close) {
                this.$thisNode = $(TabItem.TemplateClose).attr("id", this.id);
            }
            else {
                this.$thisNode = $(TabItem.TemplateNormal).attr("id", this.id);
            }
            this.$a = this.$thisNode.find("a");
            this.$i = this.$thisNode.find("i");
            var tabId = this.parent.getId();
            this.isLayout = false;
            var own = this;
            var parentTabsId = tabId + "_tabs";
            this.$a.on("click", function (e) {
                $("#" + parentTabsId).find("a").removeClass("tab_selected").addClass("tab_not_selected");
                $(this).removeClass("tab_not_selected").addClass("tab_selected");
                TabUtil_2.TabUtil.handleTabClick(e, $(this), parentTabsId);
            });
            this.$i.on("click", function () {
                EventHub_27.EventHub.dispatchEvent(MessageType_28.MessageType.WIDGET, {
                    id: own.id,
                    evtType: Event_25.Event.ON_CLOSE
                });
            });
        }
        TabItem.prototype.setText = function (args) {
            var text = args.text;
            this.$a.text(text);
        };
        TabItem.prototype.setControl = function (args) {
            this.$a.attr("href", "#" + args.control);
            this.relatedControlId = args.control;
        };
        TabItem.prototype.append = function () {
            if (this.parent && this.parent instanceof TabFolder_1.TabFolder) {
                var tempParent = this.parent;
                var lis = tempParent.$tabs.find("li.adore_tab");
                if (lis.length === 0) {
                    this.$thisNode.insertAfter(tempParent.$tabs.find("li.tab_left_move"));
                }
                else {
                    this.$thisNode.insertAfter($(lis[lis.length - 1]));
                }
            }
            else {
                this.$thisNode.appendTo(document.body);
            }
        };
        TabItem.prototype.layout = function () {
            if (this.relatedControlId) {
                var widget = WidgetManager_5.WidgetManager.byId(this.relatedControlId);
                if (widget) {
                    widget.$thisNode.appendTo(this.parent.$attachNode);
                }
            }
            this.append();
            this.isLayout = true;
            if (this.isSelected === true) {
                this.selected(this.$thisNode);
            }
            else {
                var tabItemNodes = this.parent.$tabs.find(".adore_tab");
                if (tabItemNodes.length !== 0) {
                    this.selected($(tabItemNodes[0]));
                }
            }
        };
        TabItem.prototype.dispose = function () {
            var tabs = this.parent.$tabs;
            var lis = tabs.find("li.adore_tab");
            var currentIndex = -1;
            var i;
            for (i = 0; i < lis.length; i++) {
                if ($(lis[i]).find("a").attr("href") === this.$a.attr("href")) {
                    $(lis[i]).find("a").removeClass("active");
                    currentIndex = i;
                    break;
                }
            }
            if (currentIndex >= 0 && this.parent && this.parent instanceof TabFolder_1.TabFolder) {
                if (tabs.find("a.active").length <= 0) {
                    var showIndex = void 0;
                    if (currentIndex <= 0) {
                        showIndex = currentIndex + 1;
                    }
                    else {
                        showIndex = currentIndex - 1;
                    }
                    if (showIndex >= 0 && showIndex < lis.length) {
                        var tmpA = $(lis[showIndex]).find("a");
                        tmpA.addClass("active");
                        $(tmpA.attr("href")).removeClass("tab_control_not_visible").addClass("tab_control_visible");
                        tabs.find("a").removeClass("tab_selected").addClass("tab_not_selected");
                        tmpA.removeClass("tab_not_selected").addClass("tab_selected");
                    }
                }
            }
            _super.prototype.dispose.call(this);
            if (tabs.find(".adore_tab").length > 0) {
                TabUtil_2.TabUtil.tabsSwitch(tabs);
                TabUtil_2.TabUtil.refreshTabs(tabs);
            }
            else {
                tabs.find("div.my_indicator").remove();
            }
        };
        TabItem.prototype.setSelected = function () {
            this.isSelected = true;
            if (this.isLayout) {
                this.selected(this.$thisNode);
            }
        };
        TabItem.prototype.selected = function (selectTabItem) {
            var tabs = this.parent.$tabs;
            var a_active = tabs.find("a.active");
            var activeControl = a_active.attr("href");
            $(activeControl).removeClass("tab_control_visible").addClass("tab_control_not_visible");
            a_active.removeClass("active");
            var selectTabItemA = selectTabItem.find("a").addClass("active");
            var activeDiv = selectTabItemA.attr("href");
            $(activeDiv).removeClass("tab_control_not_visible").addClass("tab_control_visible");
            tabs.find("a").removeClass("tab_selected").addClass("tab_not_selected");
            selectTabItemA.removeClass("tab_not_selected").addClass("tab_selected");
            if (tabs.find(".adore_tab").length > 0) {
                TabUtil_2.TabUtil.tabsSwitch(tabs);
                TabUtil_2.TabUtil.refreshTabs(tabs);
            }
        };
        TabItem.TemplateNormal = "\n       <li class=\"col adore_tab\">\n            <a class=\"waves-effect\"></a>\n       </li>";
        TabItem.TemplateClose = "\n     <li class=\"tab col adore_tab\" style=\"position:relative;\">\n        <i class=\"tab_icon_close\"></i>\n        <a class=\"waves-effect\" style=\"position:absolute;\"></a>\n     </li>";
        return TabItem;
    }(Widget_32.Widget));
    exports.TabItem = TabItem;
});
define("widget/table/TableConstants", ["require", "exports"], function (require, exports) {
    "use strict";
    var TableConstants = (function () {
        function TableConstants() {
        }
        TableConstants.CELL_TYPE_NULL = "null";
        TableConstants.CELL_TYPE_TEXT = "text";
        TableConstants.CELL_TYPE_COMBO = "combo";
        TableConstants.CELL_TYPE_CHECK = "check";
        TableConstants.CELL_TYPE_BUTTON = "button";
        return TableConstants;
    }());
    exports.TableConstants = TableConstants;
});
define("widget/table/TableColumn", ["require", "exports", "widget/Widget", "event/EventHub", "event/MessageType", "event/Event", "ADORE", "widget/table/TableConstants"], function (require, exports, Widget_33, EventHub_28, MessageType_29, Event_26, ADORE_11, TableConstants_1) {
    "use strict";
    var TableColumn = (function (_super) {
        __extends(TableColumn, _super);
        function TableColumn(parentId, id, style) {
            _super.call(this, parentId, id, style);
            this.width = -1;
            this.colIndex = -1;
            this.$thisNode = $(TableColumn.TemplateNormal).attr("id", this.id);
            this.$attachNode = this.$thisNode;
            this.$textNode = this.$attachNode;
            this.type = TableConstants_1.TableConstants.CELL_TYPE_NULL;
            this.visible = true;
            var that = this;
            var tableColumnId = this.id;
            this.$thisNode.on("click", function () {
                if (that.parent.isSortable === true) {
                    var thisIndex = that.parent.columns.indexOf(that);
                    var dataType = that.parent.columns[thisIndex].type;
                    EventHub_28.EventHub.dispatchEvent(MessageType_29.MessageType.WIDGET, {
                        id: tableColumnId,
                        col: thisIndex,
                        dataType: dataType,
                        evtType: Event_26.Event.MODIFY
                    });
                }
            });
        }
        TableColumn.prototype.setText = function (args) {
            this.$textNode.text(args.text);
        };
        TableColumn.prototype.layout = function () {
            this.doLayout();
        };
        TableColumn.prototype.doLayout = function () {
            this.append();
            if (this.parent) {
                this.parent.refreshColumnsWidth();
            }
        };
        TableColumn.prototype.setType = function (args) {
            this.type = args.type;
            this.changeStyleToCheck();
        };
        TableColumn.prototype.setOptions = function (args) {
            this.options = args.options;
        };
        TableColumn.prototype.append = function () {
            if (this.parent && this.parent.getId()) {
                if (this.parent.$tHead) {
                    if (this.colIndex >= 0 && this.colIndex < (this.parent.columns.length - 1)) {
                        var index = this.parent.columns.indexOf(this);
                        this.parent.columns.splice(index, 1);
                        this.$attachNode.insertBefore(this.parent.columns[this.colIndex].$attachNode.eq(0));
                        this.parent.columns.splice(this.colIndex, 0, this);
                        this.addTableColumnCell(this.colIndex);
                        this.colIndex = -1;
                    }
                    else {
                        var tempStyle = this.$thisNode.html();
                        this.$thisNode.appendTo(this.parent.$tHead);
                    }
                }
                else {
                    this.$thisNode.appendTo(this.parent.$attachNode);
                }
            }
            else {
                this.$thisNode.appendTo(document.body);
            }
        };
        TableColumn.prototype.setAlignment = function (args) {
            this.alignment = args.alignment;
            this.alignmentContent = "left";
            if (args.alignment === ADORE_11.ADORE.RIGHT) {
                this.alignmentContent = "right";
            }
            else if (args.alignment === ADORE_11.ADORE.CENTER) {
                this.alignmentContent = "center";
            }
            this.$thisNode.css("text-align", this.alignmentContent);
            var index = this.parent.columns.indexOf(this);
            var tableItems = this.parent.$tBody.find("tr");
            for (var i = 0; i < tableItems.length; i++) {
                $($(tableItems[i]).find("td")[index]).css({ "text-align": this.alignmentContent });
            }
        };
        TableColumn.prototype.setVisible = function (args) {
            _super.prototype.setVisible.call(this, args);
            this.visible = args.visible;
            var index = this.parent.columns.indexOf(this);
            var tableItems = this.parent.$tBody.find("tr");
            var i;
            if (this.visible) {
                for (i = 0; i < tableItems.length; i++) {
                    $($(tableItems[i]).find("td")[index]).css({ "display": "block" });
                }
            }
            else {
                for (i = 0; i < tableItems.length; i++) {
                    $($(tableItems[i]).find("td")[index]).css({ "display": "none" });
                }
            }
            if (this.parent) {
                this.parent.refreshColumnsWidth();
            }
        };
        TableColumn.prototype.setEnabled = function (args) {
            _super.prototype.setEnabled.call(this, args);
            if (this.type === TableConstants_1.TableConstants.CELL_TYPE_NULL) {
                return;
            }
            var index = this.parent.columns.indexOf(this);
            var tableItems = this.parent.$tBody.find("tr");
            var i;
            var typeCell = "input";
            if (this.type === TableConstants_1.TableConstants.CELL_TYPE_BUTTON) {
                typeCell = "a";
            }
            else if (this.type === TableConstants_1.TableConstants.CELL_TYPE_COMBO) {
                typeCell = "select";
            }
            if (this.enabled) {
                for (i = 0; i < tableItems.length; i++) {
                    $($(tableItems[i]).find("td")[index]).find(typeCell).removeAttr("disabled");
                }
            }
            else {
                for (i = 0; i < tableItems.length; i++) {
                    $($(tableItems[i]).find("td")[index]).find(typeCell).attr("disabled", "disabled");
                }
            }
        };
        TableColumn.prototype.dispose = function () {
            _super.prototype.dispose.call(this);
            if (this.parent) {
                var index = this.parent.columns.indexOf(this);
                this.parent.columns.splice(index, 1);
            }
        };
        TableColumn.prototype.setFocus = function () {
        };
        TableColumn.prototype.changeStyleToCheck = function () {
            if (this.type === TableConstants_1.TableConstants.CELL_TYPE_CHECK) {
                var tempStyle = this.$attachNode.attr("style");
                this.$attachNode.remove();
                this.$attachNode = $(TableColumn.TemplateCheck).attr("id", this.id);
                this.$thisNode = this.$attachNode;
                this.$attachNode.find("input").attr("id", this.id + "demo");
                this.$textNode = this.$attachNode.find("label");
                this.$textNode.attr("for", this.id + "demo");
                this.$attachNode.attr("style", tempStyle);
                var that_1 = this;
                this.$attachNode.find("input").on("click", function () {
                    var checked = $(this).prop("checked");
                    var index = that_1.parent.columns.indexOf(that_1);
                    var size = that_1.parent.items.length;
                    for (var i = 0; i < size; i++) {
                        that_1.parent.items[i].setCheckboxState(index, checked);
                    }
                    EventHub_28.EventHub.dispatchEvent(MessageType_29.MessageType.WIDGET, {
                        id: that_1.id,
                        col: that_1.parent.columns.indexOf(that_1),
                        data: this.checked + "",
                        type: "handleChecked",
                        evtType: Event_26.Event.MODIFY
                    });
                });
            }
        };
        TableColumn.prototype.setWidth = function (args) {
            this.width = args.width;
            var index = this.parent.columns.indexOf(this);
            this.$attachNode.css("width", this.width + "px");
            var tableItems = this.parent.$tBody.find("tr");
            var i;
            for (i = 0; i < tableItems.length; i++) {
                $($(tableItems[i]).find("td")[index]).css("width", this.width + "px");
            }
        };
        TableColumn.prototype.setRowNumCol = function (args) {
            if (args.rowNumCol) {
                var index = this.parent.columns.indexOf(this);
                this.parent.columns.splice(index, 1);
                this.parent.rowNumCol = this;
                this.$thisNode.unbind("click");
            }
        };
        TableColumn.prototype.refreshRowNumCol = function (index) {
            var tableItems = this.parent.$tBody.find("tr");
            for (var i = index; i < tableItems.length; i++) {
                $(tableItems[i]).find("td").eq(0).text((i + 1) + "");
            }
        };
        TableColumn.prototype.setColIndex = function (args) {
            this.colIndex = args.colIndex;
        };
        TableColumn.prototype.setFillData = function (args) {
            this.fillData = args.fillData;
        };
        TableColumn.prototype.addTableColumnCell = function (index) {
            this.parent.addTableColumnCell(index, this.fillData);
        };
        TableColumn.TemplateNormal = "<th></th>";
        TableColumn.TemplateCheck = "\n        <th>\n            <p tabindex=\"-1\">\n                <input type=\"checkbox\" id=\"\" tabindex=\"-1\" class=\"filled-in\"/>\n                <label for=\"\" style=\"margin-top: 9px\"></label>\n            </p>\n        </th>";
        return TableColumn;
    }(Widget_33.Widget));
    exports.TableColumn = TableColumn;
});
define("widget/table/TableItem", ["require", "exports", "widget/Widget", "event/EventHub", "event/MessageType", "event/Event", "hotkey/Keys", "widget/table/TableConstants"], function (require, exports, Widget_34, EventHub_29, MessageType_30, Event_27, Keys_10, TableConstants_2) {
    "use strict";
    var TableItem = (function (_super) {
        __extends(TableItem, _super);
        function TableItem(parentId, id, style) {
            _super.call(this, parentId, id, style);
            this.isComboFocus = false;
            this.isTextFocus = false;
            this.rowIndex = -1;
            this.tdNodeArray = new Array();
            this.$thisNode = $(TableItem.TemplateTr).attr("id", this.id);
            this.$attachNode = this.$thisNode;
            var tableId = this.parent.getId();
            var itemId = this.id;
            var own = this;
            this.$thisNode.on("click", function (e) {
                var preTr = $("#" + tableId).find("tr[hadSelected]");
                if (preTr.length > 0 && preTr[0] === e.currentTarget) {
                    return;
                }
                var th = $(this).find("th");
                if (th.length > 0) {
                    return;
                }
                preTr.removeClass("adore_table_item_selected");
                preTr.removeAttr("hadSelected");
                $(this).addClass("adore_table_item_selected");
                $(this).attr("hadSelected", "true");
                EventHub_29.EventHub.dispatchEvent(MessageType_30.MessageType.WIDGET, {
                    id: tableId,
                    itemId: itemId,
                    evtType: Event_27.Event.CLICK
                });
            });
        }
        TableItem.prototype.setDatas = function (args) {
            var itemId = this.id;
            var datas = args.datas;
            var columns = this.parent.columns;
            var i, j, data, tdNode, id, comboNode, optionNode, cellText;
            this.$thisNode.find("td").html("<div style='display:none;'></div>");
            this.$thisNode.find("td").remove();
            this.tdNodeArray.splice(0, this.tdNodeArray.length);
            var own = this;
            this.addCellRowNum();
            for (i = 0; i < columns.length; i++) {
                this.addCell(i, datas[i]);
            }
        };
        TableItem.prototype.sendFocusGain = function () {
            var id = this.parent.getId;
            EventHub_29.EventHub.dispatchEvent(MessageType_30.MessageType.WIDGET, { id: id, evtType: Event_27.Event.ON_FOCUS });
        };
        TableItem.prototype.append = function () {
            if (this.parent) {
                if (this.parent.$tBody) {
                    if (this.rowIndex >= 0 && this.rowIndex < (this.parent.items.length - 1)) {
                        var index = this.parent.items.indexOf(this);
                        this.parent.items.splice(index, 1);
                        this.$attachNode.insertBefore(this.parent.items[this.rowIndex].$attachNode.eq(0));
                        this.parent.items.splice(this.rowIndex, 0, this);
                        this.parent.refreshCellRowNum();
                        this.rowIndex = -1;
                    }
                    else {
                        this.$thisNode.appendTo(this.parent.$tBody);
                    }
                }
                else {
                    this.$thisNode.appendTo(this.parent.$attachNode);
                }
            }
            else {
                this.$thisNode.appendTo(document.body);
            }
        };
        TableItem.prototype.layout = function () {
            this.append();
        };
        TableItem.prototype.clearSelection = function () {
            this.$thisNode.removeClass("adore_table_item_selected");
            this.$thisNode.removeAttr("hadSelected");
        };
        TableItem.prototype.setSelection = function () {
            this.$thisNode.addClass("adore_table_item_selected");
            this.$thisNode.attr("hadSelected", "true");
        };
        TableItem.prototype.setColor = function (args) {
            this.$thisNode.css("color", args.color);
        };
        TableItem.prototype.setEnabled = function (args) {
        };
        TableItem.prototype.setVisible = function (args) {
        };
        TableItem.prototype.dispose = function () {
            _super.prototype.dispose.call(this);
            if (this.parent) {
                var index = this.parent.items.indexOf(this);
                this.parent.items.splice(index, 1);
                if (this.parent.containRowNum) {
                    this.parent.rowNumCol.refreshRowNumCol(index);
                }
            }
        };
        TableItem.prototype.handleKeyDownEvent = function (e, hasFilter) {
            if (e.keyCode == Keys_10.Keys.RIGHT_ARROW || e.keyCode == Keys_10.Keys.LEFT_ARROW) {
                if (!this.isTextFocus) {
                    e.preventDefault();
                    this.parent.handleKeyDownEvent(e, hasFilter);
                }
                else if (this.isComboFocus) {
                    e.preventDefault();
                    this.parent.handleKeyDownEvent(e, hasFilter);
                }
            }
            else if (e.keyCode == Keys_10.Keys.UP_ARROW || e.keyCode == Keys_10.Keys.DOWN_ARROW) {
                if (this.isComboFocus) {
                    e.preventDefault();
                    this.parent.handleKeyDownEvent(e, hasFilter);
                }
                else {
                    this.parent.handleKeyDownEvent(e, hasFilter);
                }
            }
            else {
                this.parent.handleKeyDownEvent(e, hasFilter);
            }
        };
        TableItem.prototype.setCellSelection = function (args) {
            var colIndex = args.colIndex;
            var type = this.parent.columns[colIndex].type;
            var $tdNode = this.tdNodeArray[colIndex];
            switch (type) {
                case TableConstants_2.TableConstants.CELL_TYPE_TEXT:
                    if (document.activeElement !== $tdNode.find("input")[0]) {
                        $tdNode.find("input").focus();
                    }
                    break;
                case TableConstants_2.TableConstants.CELL_TYPE_COMBO:
                    if (document.activeElement !== $tdNode.find("select")[0]) {
                        $tdNode.find("select").focus();
                    }
                    break;
                case TableConstants_2.TableConstants.CELL_TYPE_CHECK:
                    if (document.activeElement !== $tdNode.find("p")[0]) {
                        $tdNode.find("p").focus();
                    }
                    break;
                case TableConstants_2.TableConstants.CELL_TYPE_BUTTON:
                    if (document.activeElement !== $tdNode.find("a")[0]) {
                        $tdNode.find("div").focus();
                    }
                    break;
                default:
                    break;
            }
        };
        TableItem.prototype.setCheckValue = function (args) {
            var colIndex = args.colIndex;
            var $checkNode = this.tdNodeArray[colIndex].find("input");
            var value = $checkNode.prop("checked");
            $checkNode.prop("checked", !value);
        };
        TableItem.prototype.openSelect = function (args) {
            var colIndex = args.colIndex;
            var elem = this.tdNodeArray[colIndex].find("select");
            if (document.createEvent) {
                var e = document.createEvent("MouseEvents");
                e.initMouseEvent("mousedown");
                elem[0].dispatchEvent(e);
            }
            else if (elem[0].fireEvent) {
                elem[0].fireEvent("onmousedown");
            }
        };
        TableItem.prototype.setFocus = function () {
        };
        TableItem.prototype.setCheckboxState = function (index, checkboxState) {
            var $checkboxNode = this.tdNodeArray[index];
            $checkboxNode.find("input:checkbox").eq(0).prop("checked", checkboxState);
            $checkboxNode.find("input:checkbox").eq(0).prop("indeterminate", false);
        };
        TableItem.prototype.refreshHeadCheckboxState = function (index) {
            var $checkboxNode = this.tdNodeArray[index];
            var currentChecked = $checkboxNode.find("input").eq(0).prop("checked");
            var column = this.parent.columns[index];
            var $headCheckNode = column.$thisNode.find("input").eq(0);
            var size = this.parent.items.length;
            var state = -1;
            for (var i = 0; i < size; i++) {
                var tmpChecked = this.parent.items[i].getCheckboxState(index);
                if (tmpChecked) {
                    if (state == -1) {
                        state = 0;
                    }
                    else if (state != 0) {
                        state = 2;
                        break;
                    }
                }
                else {
                    if (state == -1) {
                        state = 1;
                    }
                    else if (state != 1) {
                        state = 2;
                        break;
                    }
                }
            }
            if (state == 0) {
                $headCheckNode.prop("checked", true);
                $headCheckNode.prop("indeterminate", false);
            }
            else if (state == 1) {
                $headCheckNode.prop("checked", false);
                $headCheckNode.prop("indeterminate", false);
            }
            else {
                $headCheckNode.prop("checked", false);
                $headCheckNode.prop("indeterminate", true);
            }
        };
        TableItem.prototype.getCheckboxState = function (index) {
            var $checkboxNode = this.tdNodeArray[index];
            return $checkboxNode.find("input").eq(0).prop("checked");
        };
        TableItem.prototype.addCellRowNum = function () {
            if (this.parent.containRowNum) {
                var index = this.parent.items.indexOf(this);
                var $tdNode = $(TableItem.TemplateNone);
                $tdNode.attr("title", (index + 1) + "");
                $tdNode.text((index + 1) + "");
                $tdNode.appendTo(this.$attachNode);
                $tdNode.css("text-align", "center");
                this.$rowNumNode = $tdNode;
            }
        };
        TableItem.prototype.refreshCellRowNum = function (index) {
            if (this.parent.containRowNum) {
                if (this.$rowNumNode) {
                    this.$rowNumNode.text((index + 1) + "");
                }
            }
        };
        TableItem.prototype.addCell = function (colIndex, data) {
            var columns = this.parent.columns;
            var $tdNode, $comboNode, $optionNode, id, cellText;
            var own = this;
            var itemId = this.id;
            var tableId = this.parent.getId();
            var i = colIndex;
            cellText = TableConstants_2.TableConstants.CELL_TYPE_NULL;
            if (columns[i].type === TableConstants_2.TableConstants.CELL_TYPE_NULL) {
                $tdNode = $(TableItem.TemplateNone);
                $tdNode.attr("title", data);
                $tdNode.text(data);
            }
            else if (columns[i].type === TableConstants_2.TableConstants.CELL_TYPE_TEXT) {
                $tdNode = $(TableItem.TemplateText);
                $tdNode.find("input").val(data);
                cellText = "input";
                $tdNode.find("input").attr("col", i).on("input", function (e) {
                    EventHub_29.EventHub.dispatchEvent(MessageType_30.MessageType.WIDGET, {
                        id: itemId,
                        col: own.getColIndex($tdNode),
                        data: this.value,
                        evtType: Event_27.Event.MODIFY
                    });
                }).on("focus", function (e) {
                    console.log("focus in : TEXT");
                    own.isTextFocus = true;
                    own.parent.isCellFocus = true;
                    own.parent.sendFocusGain();
                    EventHub_29.EventHub.dispatchEvent(MessageType_30.MessageType.WIDGET, {
                        id: tableId,
                        itemId: itemId,
                        col: own.getColIndex($tdNode),
                        evtType: Event_27.Event.CLICK
                    });
                }).on("blur", function () {
                    console.log("focus out : TEXT");
                    own.isTextFocus = false;
                    own.parent.isCellFocus = false;
                });
            }
            else if (columns[i].type === TableConstants_2.TableConstants.CELL_TYPE_CHECK) {
                $tdNode = $(TableItem.TemplateCheck);
                id = columns[i].id + "_" + this.id;
                $tdNode.find("input").attr("id", id);
                $tdNode.find("label").attr("for", id);
                cellText = "input";
                if (data === "true") {
                    $tdNode.find("input").prop("checked", true);
                }
                $tdNode.find("input").attr("col", i).on("change", function (e) {
                    EventHub_29.EventHub.dispatchEvent(MessageType_30.MessageType.WIDGET, {
                        id: itemId,
                        col: own.getColIndex($tdNode),
                        data: this.checked + "",
                        evtType: Event_27.Event.MODIFY
                    });
                });
                $tdNode.find("input").attr("col", i).on("click", function (e) {
                    var colIndex = own.getColIndex($tdNode);
                    own.refreshHeadCheckboxState(parseInt(colIndex));
                });
                $tdNode.find("p").on("focus", function (e) {
                    console.log("focus in : CHECK");
                    own.parent.isCellFocus = true;
                    own.parent.sendFocusGain();
                    EventHub_29.EventHub.dispatchEvent(MessageType_30.MessageType.WIDGET, {
                        id: tableId,
                        itemId: itemId,
                        col: own.getColIndex($tdNode),
                        evtType: Event_27.Event.CLICK
                    });
                }).on("blur", function () {
                    own.parent.isCellFocus = false;
                });
            }
            else if (columns[i].type === TableConstants_2.TableConstants.CELL_TYPE_COMBO) {
                $tdNode = $(TableItem.TemplateCombo);
                cellText = "select";
                if (columns[i].options) {
                    $comboNode = $tdNode.find("select");
                    for (var j = 0; j < columns[i].options.length; j++) {
                        $optionNode = $(TableItem.TemplateOption).text(columns[i].options[j]);
                        if (columns[i].options[j] === data) {
                            $optionNode.prop("selected", true);
                        }
                        $optionNode.appendTo($comboNode);
                    }
                    $comboNode.attr("col", i + "").on("change", function (e) {
                        EventHub_29.EventHub.dispatchEvent(MessageType_30.MessageType.WIDGET, {
                            id: itemId,
                            col: own.getColIndex($tdNode),
                            data: this.value,
                            evtType: Event_27.Event.MODIFY
                        });
                    }).on("focus", function (e) {
                        console.log("focus in : COMBO");
                        own.parent.isCellFocus = true;
                        own.isComboFocus = true;
                        own.parent.sendFocusGain();
                        EventHub_29.EventHub.dispatchEvent(MessageType_30.MessageType.WIDGET, {
                            id: tableId,
                            itemId: itemId,
                            col: own.getColIndex($tdNode),
                            evtType: Event_27.Event.CLICK
                        });
                    }).on("blur", function (e) {
                        console.log("focus out : COMBO");
                        own.isComboFocus = false;
                        own.parent.isCellFocus = false;
                    });
                    $comboNode.on("click mousedown", function () {
                        own.parent.isCellFocus = true;
                        own.isComboFocus = true;
                        EventHub_29.EventHub.dispatchEvent(MessageType_30.MessageType.WIDGET, {
                            id: tableId,
                            itemId: itemId,
                            col: own.getColIndex($tdNode),
                            evtType: Event_27.Event.CLICK
                        });
                    });
                }
            }
            else if (columns[i].type === TableConstants_2.TableConstants.CELL_TYPE_BUTTON) {
                $tdNode = $(TableItem.TemplateButton);
                var begin = data.indexOf("${");
                var end = data.indexOf("}");
                cellText = "a";
                if (begin !== -1 && end > begin) {
                    var clazz = data.substring(begin + 2, end);
                    if (clazz.indexOf("-") !== -1) {
                        $tdNode.find("span").addClass(clazz);
                    }
                    else {
                        $tdNode.find("span").addClass("adr-" + clazz);
                    }
                }
                else {
                    $tdNode.find("span").text(data);
                }
                $tdNode.find("div").attr("col", i + "").on("click", function (e) {
                    EventHub_29.EventHub.dispatchEvent(MessageType_30.MessageType.WIDGET, {
                        id: itemId,
                        col: own.getColIndex($tdNode),
                        data: data,
                        evtType: Event_27.Event.MODIFY
                    });
                }).on("focus", function (e) {
                    own.parent.isCellFocus = true;
                    own.parent.sendFocusGain();
                    EventHub_29.EventHub.dispatchEvent(MessageType_30.MessageType.WIDGET, {
                        id: tableId,
                        itemId: itemId,
                        col: own.getColIndex($tdNode),
                        evtType: Event_27.Event.CLICK
                    });
                }).on("blur", function () {
                    own.parent.isCellFocus = false;
                });
            }
            if (colIndex < this.tdNodeArray.length) {
                var $tempNode = this.tdNodeArray[colIndex];
                $tdNode.insertBefore($tempNode.eq(0));
                this.tdNodeArray.splice(colIndex, 0, $tdNode);
            }
            else {
                $tdNode.appendTo(this.$attachNode);
                this.tdNodeArray.push($tdNode);
            }
            if (columns[i].type === TableConstants_2.TableConstants.CELL_TYPE_CHECK) {
                this.refreshHeadCheckboxState(i);
            }
            if (columns[i].visible === false) {
                $tdNode.css("display", "none");
            }
            if (columns[i].enabled === false && cellText !== TableConstants_2.TableConstants.CELL_TYPE_NULL) {
                $tdNode.find(cellText).attr("disabled", "disabled");
            }
            if (columns[i].alignmentContent) {
                $tdNode.css("text-align", columns[i].alignmentContent);
            }
        };
        TableItem.prototype.getColIndex = function (tdNode) {
            return this.tdNodeArray.indexOf(tdNode) + "";
        };
        TableItem.prototype.setRowIndex = function (args) {
            this.rowIndex = args.rowIndex;
        };
        TableItem.TemplateTr = "<tr></tr>";
        TableItem.TemplateNone = "<td></td>";
        TableItem.TemplateText = "\n        <td>\n            <input type=\"text\" style=\"border: none;text-align: inherit;width: 100%;font-size: 1rem;\"/>\n        </td>";
        TableItem.TemplateCheck = "\n        <td>\n            <p tabindex=\"-1\">\n                <input type=\"checkbox\" id=\"\" class=\"filled-in\"/>\n                <label for=\"\" style=\"margin-top: 9px\"></label>\n            </p>\n        </td>";
        TableItem.TemplateCombo = "\n        <td>\n            <select class=\"browser-default\" style=\"display:inline;width: 100%;height:36px;\">\n            </select>\n        </td>";
        TableItem.TemplateButton = "\n        <td>\n            <div class=\"waves-effect waves-light btn adore_button\" style=\"background: #17D1C8;\" tabindex=\"-1\" data-position=\"top\" data-delay=\"50\"><span></span><i></i></div>\n        </td>";
        TableItem.TemplateOption = "<option></option>";
        return TableItem;
    }(Widget_34.Widget));
    exports.TableItem = TableItem;
});
define("widget/table/Table", ["require", "exports", "event/EventHub", "event/MessageType", "event/Event", "widget/table/TableColumn", "widget/table/TableItem", "widget/Composite"], function (require, exports, EventHub_30, MessageType_31, Event_28, TableColumn_1, TableItem_1, Composite_9) {
    "use strict";
    var Table = (function (_super) {
        __extends(Table, _super);
        function Table(parentId, id, style) {
            _super.call(this, parentId, id, style);
            this.columns = new Array();
            this.items = new Array();
            this.isSortable = true;
            this.isCellFocus = false;
            this.sortable = true;
            this.containRowNum = false;
            this.children = new Array();
            this.columns = new Array();
            this.items = new Array();
            this.$thisNode = $(Table.TemplateNormal).attr("id", this.id);
            this.$attachNode = this.$thisNode;
            this.$tHead = this.$thisNode.find("tr");
            this.$tBody = this.$thisNode.find("tbody");
            var own = this;
            this.isFocus = false;
            this.$thisNode.find("table").on("focus", function (e) {
                console.log("table focus in");
                own.sendFocusGain();
                own.isFocus = true;
            }).on("blur", function (e) {
                own.isFocus = false;
            });
            this.$thisNode.find("table").on("dblclick", function (e) {
                if (e.target.localName && e.target.localName === "th") {
                    EventHub_30.EventHub.dispatchEvent(MessageType_31.MessageType.WIDGET, {
                        id: own.id,
                        evtType: Event_28.Event.DOUBLE_CLICK,
                        header: true
                    });
                }
                else {
                    EventHub_30.EventHub.dispatchEvent(MessageType_31.MessageType.WIDGET, {
                        id: own.id,
                        evtType: Event_28.Event.DOUBLE_CLICK
                    });
                }
            });
        }
        Table.prototype.addChild = function (child) {
            _super.prototype.addChild.call(this, child);
            if (child instanceof TableColumn_1.TableColumn) {
                this.columns.push(child);
            }
            else if (child instanceof TableItem_1.TableItem) {
                this.items.push(child);
            }
        };
        Table.prototype.sendFocusGain = function () {
            _super.prototype.sendFocusGain.call(this);
            this.isFocus = true;
        };
        Table.prototype.setFocus = function () {
            console.log("table setFocus");
            if (!this.isFocus) {
                this.sendFocusGain();
            }
        };
        Table.prototype.layout = function () {
            _super.prototype.layout.call(this);
        };
        Table.prototype.refreshColumnsWidth = function () {
        };
        Table.prototype.handleKeyDownEvent = function (e, hasFilter) {
            _super.prototype.handleKeyDownEvent.call(this, e, hasFilter);
        };
        Table.prototype.setSortable = function (args) {
            this.isSortable = args.isSortable;
        };
        Table.prototype.addRowNum = function (args) {
            this.containRowNum = args.containRowNum;
        };
        Table.prototype.addTableColumnCell = function (index, defaultData) {
            var itemSize = this.items.length;
            for (var i = 0; i < itemSize; i++) {
                this.items[i].addCell(index, defaultData);
            }
        };
        Table.prototype.reorder = function (args) {
            var reorderIndexed = args.reorderIndexes;
            var newItems = new Array();
            for (var i = 0; i < reorderIndexed.length; i++) {
                newItems[i] = this.items[reorderIndexed[i]];
                newItems[i].$thisNode.detach();
            }
            this.items = newItems;
            this.refreshCellRowNum();
            for (var i = 0; i < this.items.length; i++) {
                newItems[i].$thisNode.appendTo(this.$tBody);
            }
        };
        Table.prototype.refreshCellRowNum = function () {
            for (var i = 0; i < this.items.length; i++) {
                this.items[i].refreshCellRowNum(i);
            }
        };
        Table.TemplateNormal = "\n        <div style=\"overflow: auto; outline: 0;\">\n            <table style=\"outline: 0;\" class=\"adore_table\" tabindex=\"-1\">\n                <thead>\n                <tr style=\"color:#000\"> \n                </tr>\n                </thead>\n                <tbody>\n                </tbody>\n            </table>\n        </div>";
        return Table;
    }(Composite_9.Composite));
    exports.Table = Table;
});
define("widget/TextArea", ["require", "exports", "event/EventHub", "event/MessageType", "event/Event", "widget/Text", "util/RequisiteUtil"], function (require, exports, EventHub_31, MessageType_32, Event_29, Text_1, RequisiteUtil_2) {
    "use strict";
    var TextArea = (function (_super) {
        __extends(TextArea, _super);
        function TextArea(parentId, id, style) {
            _super.call(this, parentId, id, style);
            var own = this;
            this.$thisNode = $(TextArea.TemplateNormal).attr({
                id: this.id + "_containerNode"
            });
            this.$inputNode = this.$thisNode.find("textarea");
            this.$inputNode.attr("id", this.id).on("input", function (e) {
                if ($(this).prop("comStart"))
                    return;
                own.handleOnInput();
                EventHub_31.EventHub.dispatchEvent(MessageType_32.MessageType.WIDGET, {
                    id: id,
                    text: $(this).val(),
                    evtType: Event_29.Event.MODIFY,
                    syncAttrName: "text"
                });
            }).on("focus", function () {
                own.sendFocusGain();
            }).on("blur", function () {
                RequisiteUtil_2.RequisiteUtil.checkRequisite(own.requisite, own, own.editable, own.$inputNode.val(), "请输入数据!");
            }).on("compositionstart", function () {
                $(this).prop("comStart", true);
            }).on('compositionend', function () {
                $(this).prop("comStart", false);
            });
            this.$thisNode.find("label").attr("for", this.id);
        }
        TextArea.TemplateNormal = "\n        <div class=\"input-field\">\n            <i class=\"icon_normal\"></i>\n            <textarea class=\"materialize-textarea\"></textarea>\n            <label></label>\n            <span class=\"span_base\"></span>\n        </div>";
        return TextArea;
    }(Text_1.Text));
    exports.TextArea = TextArea;
});
define("widget/toast/Toast", ["require", "exports", "widget/Widget", "event/EventHub", "event/MessageType", "event/Event"], function (require, exports, Widget_35, EventHub_32, MessageType_33, Event_30) {
    "use strict";
    var Toast = (function (_super) {
        __extends(Toast, _super);
        function Toast(parentId, id, style) {
            _super.call(this, parentId, id, style);
            this.$thisNode = $(Toast.TemplateToast).attr("id", this.id);
            this.buttonClickEventDispatch();
        }
        Toast.prototype.setContent = function (args) {
            this.$thisNode.find("span").eq(1).html(args.content.toastName);
            this.$thisNode.find("span").eq(2).html(args.content.receiveTime);
        };
        Toast.prototype.resetShowTime = function (args) {
            var own = this;
            if (own.timeoutSign) {
                clearTimeout(own.timeoutSign);
            }
            own.timeoutSign = setTimeout(function () {
                own.$thisNode.get(0).addEventListener("webkitAnimationEnd", function () {
                    EventHub_32.EventHub.dispatchEvent(MessageType_33.MessageType.WIDGET, { id: own.id, evtType: Event_30.Event.ON_CLOSE });
                });
                own.$thisNode.addClass("removing");
            }, args.time * 1000);
        };
        Toast.prototype.buttonClickEventDispatch = function () {
            var own = this;
            var showButton = this.$thisNode.find(".showButton");
            var closeButton = this.$thisNode.find(".closeButton");
            showButton.on("click", function () {
                EventHub_32.EventHub.dispatchEvent(MessageType_33.MessageType.WIDGET, { id: own.id, evtType: Event_30.Event.CLICK });
            });
            closeButton.on("click", function () {
                own.$thisNode.get(0).addEventListener("webkitAnimationEnd", function () {
                    EventHub_32.EventHub.dispatchEvent(MessageType_33.MessageType.WIDGET, { id: own.id, evtType: Event_30.Event.ON_CLOSE });
                });
                own.$thisNode.addClass("removing");
            });
        };
        Toast.TemplateToast = "\n    <div class=\"adore_toast\">\n        <span>\u6211\u7684\u4EFB\u52A1</span>\n        <span></span>\n        <span></span>\n        <div class=\"showButton waves-effect waves-light large\">\u67E5\u770B</div>\n        <div class=\"closeButton waves-effect waves-light large mdi-content-clear\"></div>\n    </div>\n    ";
        return Toast;
    }(Widget_35.Widget));
    exports.Toast = Toast;
});
define("widget/toast/ToastList", ["require", "exports", "widget/Composite"], function (require, exports, Composite_10) {
    "use strict";
    var ToastList = (function (_super) {
        __extends(ToastList, _super);
        function ToastList(parentId, id, style) {
            _super.call(this, parentId, id, style);
            this.$thisNode = $(ToastList.TemplateToastList).attr("id", this.id);
            this.$attachNode = this.$thisNode;
        }
        ToastList.prototype.layout = function () {
            this.$thisNode.appendTo($("body"));
            for (var _i = 0, _a = this.children; _i < _a.length; _i++) {
                var child = _a[_i];
                child.$thisNode.appendTo(this.$thisNode);
            }
        };
        ToastList.prototype.setPosition = function (args) {
            this.$thisNode.css({
                "margin-top": args.position.top + "px",
                "margin-left": args.position.left + "px"
            });
        };
        ToastList.TemplateToastList = "\n        <div class=\"adore_toast_list\"></div>\n    ";
        return ToastList;
    }(Composite_10.Composite));
    exports.ToastList = ToastList;
});
define("widget/Toolbar", ["require", "exports", "widget/Composite", "widget/Button"], function (require, exports, Composite_11, Button_1) {
    "use strict";
    var Toolbar = (function (_super) {
        __extends(Toolbar, _super);
        function Toolbar(parentId, id, style) {
            _super.call(this, parentId, id, style);
            this.typeFlag = "";
            this.instance = "Toolbar";
        }
        Toolbar.prototype.toString = function () {
            return this.typeFlag;
        };
        Toolbar.prototype.createDropDownBox = function () {
            var own = this;
            var dropDownListWidth = 108;
            this.$ulNode = $("<ul>").addClass("card-panel adore_toolbar_dropDownList")
                .insertAfter(this.$thisNode)
                .css({ width: dropDownListWidth, display: "none", height: 0, padding: 0 })
                .on("click", function () {
                $(this).attr("popup", "true").css({ height: 0, display: "none" });
            });
            this.$dropDownBtn = $(Toolbar.Template)
                .appendTo(this.$attachNode).on("click", function () {
                if (parseInt(own.$ulNode.css("height").replace("px", "")) === 0) {
                    own.$ulNode.attr("popup", "true").css({ height: own.children.length * 54, display: "block" });
                }
                else {
                    own.$ulNode.attr("popup", "true").css({ height: 0, display: "none" });
                }
            });
            this.$attachNode = this.$ulNode;
        };
        Toolbar.prototype.layout = function () {
            _super.prototype.layout.call(this);
            var own = this;
            var originAttachNode = this.$attachNode;
            var dropDownListWidth = 108;
            if (parseInt(this.$thisNode.css("width").replace("px", "")) < dropDownListWidth) {
                this.typeFlag = "ToolBar";
                this.createDropDownBox();
            }
            $(window).resize(function () {
                if (parseInt(own.$thisNode.css("width").replace("px", "")) < dropDownListWidth) {
                    if (own.$attachNode === originAttachNode) {
                        if (own.$ulNode) {
                            own.$attachNode = own.$ulNode;
                            own.$ulNode.css({ display: "none", height: 0 });
                            own.$dropDownBtn.css({ display: "block" });
                        }
                        else {
                            own.createDropDownBox();
                        }
                        own.typeFlag = "ToolBar";
                        for (var i = 0; i < own.children.length; i++) {
                            if (own.children[i] instanceof Button_1.Button) {
                                own.children[i].refreshToolbar(own.children[i]);
                            }
                        }
                    }
                    else {
                    }
                }
                else {
                    if (own.$attachNode === originAttachNode) {
                    }
                    else {
                        own.$attachNode = originAttachNode;
                        own.typeFlag = "";
                        own.$dropDownBtn.css("display", "none");
                        own.$ulNode.css({ display: "none", height: 0 });
                        for (var i = 0; i < own.children.length; i++) {
                            own.children[i].postLayout();
                        }
                    }
                }
            });
        };
        Toolbar.TemplateToolbar = "\n    <nav class=\"top-nav adore_header\">\n    <div></div>\n    </nav>";
        Toolbar.Template = "\n    <a class=\"waves-effect btn-flat adore_button adore_button_flat btn-large\" style=\"color:white\" tabindex=\"-1\">\n    <i style=\"position: absolute;right: 10px;font-size: 2.4em\" class=\"mdi-navigation-more-vert\">\n    </i>\n    <span>\n    </span>\n    </a>\n    ";
        return Toolbar;
    }(Composite_11.Composite));
    exports.Toolbar = Toolbar;
});
define("widget/transfernetwork/AppointmentQueue", ["require", "exports", "widget/Widget", "event/EventHub", "event/MessageType", "event/Event"], function (require, exports, Widget_36, EventHub_33, MessageType_34, Event_31) {
    "use strict";
    var AppointmentQueue = (function (_super) {
        __extends(AppointmentQueue, _super);
        function AppointmentQueue(parentId, id, style) {
            _super.call(this, parentId, id, style);
            this.$thisNode = $(AppointmentQueue.TemplateCotainer).attr({ id: this.id });
        }
        AppointmentQueue.prototype.addItems = function (args) {
            var items = args.items;
            if (!items || items.length === 0) {
                return;
            }
            for (var i = 0; i < items.length; i++) {
                if (items[i].id) {
                    if (this.$thisNode.find("#" + items[i].id).length !== 0) {
                        this.setItem(items[i]);
                    }
                    else {
                        this.addItem(items[i]);
                    }
                }
            }
        };
        AppointmentQueue.prototype.addItem = function (item) {
            var $itemNode = $(AppointmentQueue.TemplateQueue).attr({ id: item.id });
            $itemNode.appendTo(this.$thisNode);
            this.setWindowAttr($itemNode, item);
            var own = this;
            $itemNode.find(".appointment_queue_delete").on("click", function (e) {
                EventHub_33.EventHub.dispatchEvent(MessageType_34.MessageType.WIDGET, {
                    id: own.id,
                    removeId: item.id,
                    evtType: Event_31.Event.MODIFY
                });
            });
        };
        AppointmentQueue.prototype.setWindowAttr = function ($itemNode, item) {
            var temp = item.id.split("k");
            if (item.id) {
                var $idNode = $itemNode.find(".appointment_queue_id");
                $idNode.text("预约编号：" + item.id);
            }
            if (item.mediumType) {
                var $mtNode = $itemNode.find(".appointment_queue_body_mediumtype");
                $mtNode.text("介质类型：" + item.mediumType);
                var $mtImg = $(AppointmentQueue.TemplateImage).appendTo($mtNode);
                $mtImg.attr("src", "images/appointment_queue/cardType.png");
            }
            if (item.mediumNum) {
                var $mnNode = $itemNode.find(".appointment_queue_body_mediumnum");
                var begin_mediumNum = item.mediumNum.substring(0, 6);
                var end_mediumNum = item.mediumNum.substring(11);
                var new_mediumNum = begin_mediumNum + "*****" + end_mediumNum;
                $mnNode.text("介质号码：" + new_mediumNum);
                var $mnImg = $(AppointmentQueue.TemplateImage).appendTo($mnNode);
                $mnImg.attr("src", "images/appointment_queue/jizhiNum.png");
            }
            if (temp[2]) {
                var $pnNode = $itemNode.find(".appointment_queue_body_phonenum");
                var begin_phoneNum = temp[2].substring(0, 3);
                var end_phoneNum = temp[2].substring(7);
                var new_phoneNum = begin_phoneNum + "****" + end_phoneNum;
                $pnNode.text("手机号码：" + new_phoneNum);
                var $pnImg = $(AppointmentQueue.TemplateImage).appendTo($pnNode);
                $pnImg.attr("src", "images/appointment_queue/phoneNum.png");
            }
            if (temp[0] && item.appointmentTime) {
                var s = temp[0].split("-");
                var str = s[0] + "年" + s[1] + "月" + s[2] + "日";
                var $atNode = $itemNode.find(".appointment_queue_body_appointmenttime");
                $atNode.text("预约时间：" + str + " " + item.appointmentTime);
                var $atImg = $(AppointmentQueue.TemplateImage).appendTo($atNode);
                $atImg.attr("src", "images/appointment_queue/time.png");
            }
        };
        AppointmentQueue.prototype.setItem = function (item) {
            var $itemNode = this.$thisNode.find("#" + item.id);
            this.setWindowAttr($itemNode, item);
        };
        AppointmentQueue.prototype.removeItems = function (args) {
            var ids = args.itemIds;
            if (ids && ids.length > 0) {
                for (var i = 0; i < ids.length; i++) {
                    var $node = this.$thisNode.find("#" + ids[i]);
                    $node.remove();
                }
            }
        };
        AppointmentQueue.prototype.clean = function () {
            this.$thisNode.find(".appointment_queue").remove();
        };
        AppointmentQueue.prototype.setFocus = function () {
        };
        AppointmentQueue.TemplateCotainer = "<div class=\"row\"></div>";
        AppointmentQueue.TemplateQueue = "\n            <div class=\"col s6 m6 l5 appointment_queue\">\n                <div class=\"appointment_queue_shadow\">\n                    <div class=\"appointment_queue_header\">\n                        <div class=\"appointment_queue_id\"></div>\n                        <input class=\"appointment_queue_delete\" type=\"image\" src=\"images/appointment_queue/del.png\"/>\n                    </div>\n                    <div class=\"appointment_queue_body\">\n                        <p class=\"appointment_queue_body_content appointment_queue_body_mediumtype\"><img class=\"appointment_queue_body_img\" src=\"images/appointment_queue/cardType.png\"/>\u4ECB\u8D28\u7C7B\u578B\uFF1A</p>\n\n                        <p class=\"appointment_queue_body_content appointment_queue_body_mediumnum\"><img class=\"appointment_queue_body_img\" src=\"images/appointment_queue/jizhiNum.png\"/>\u4ECB\u8D28\u53F7\u7801\uFF1A</p>\n\n                        <p class=\"appointment_queue_body_content appointment_queue_body_phonenum\"><img class=\"appointment_queue_body_img\" src=\"images/appointment_queue/phoneNum.png\"/>\u624B\u673A\u53F7\u7801\uFF1A</p>\n\n                        <p class=\"appointment_queue_body_content appointment_queue_body_appointmenttime\"><img class=\"appointment_queue_body_img\" src=\"images/appointment_queue/time.png\"/>\u9884\u7EA6\u65F6\u95F4\uFF1A</p>\n                    </div>\n                </div>\n            </div>\n            ";
        AppointmentQueue.TemplateImage = "<img/>";
        return AppointmentQueue;
    }(Widget_36.Widget));
    exports.AppointmentQueue = AppointmentQueue;
});
define("widget/transfernetwork/AppointmentTable", ["require", "exports", "widget/Widget"], function (require, exports, Widget_37) {
    "use strict";
    var AppointmentTable = (function (_super) {
        __extends(AppointmentTable, _super);
        function AppointmentTable(parentId, id, style) {
            _super.call(this, parentId, id, style);
            this.$thisNode = $(AppointmentTable.TemplateTime).attr("id", this.id);
        }
        AppointmentTable.prototype.addItems = function (args) {
            var items = args.items;
            if (!items || items.length === 0) {
                return;
            }
            for (var i = 0; i < items.length; i++) {
                if (items[i].id) {
                    if (this.$thisNode.find("#" + items[i].id).length !== 0) {
                        this.setItem(items[i]);
                    }
                    else {
                        this.addItem(items[i]);
                    }
                }
            }
        };
        AppointmentTable.prototype.addItem = function (item) {
            var $trNode = $(AppointmentTable.Template);
            var $table_containerNode = this.$thisNode.find(".appointment_table_scrollbar");
            if ($table_containerNode.find("table").length === 0) {
                var $first_tableNode = $(AppointmentTable.TemplateLeft).attr("id", item.id);
                $first_tableNode.appendTo($table_containerNode);
                $trNode.appendTo($first_tableNode);
                $trNode.find("td").text(item.id);
                $table_containerNode.css("width", "280px");
                for (var i = 0; i < Number(item.rowNum); i++) {
                    if (i === Number(item.handle_appointmentTime) - 1) {
                        $trNode = $(AppointmentTable.TemplateDate);
                        $trNode.appendTo($first_tableNode);
                        $trNode.find(".appointment_table_data_yes").attr("style", "width: " + 1 / Number(item.limitNum) * 100 + "%");
                        $trNode.find(".appointment_table_data_yes").attr("title", "1");
                    }
                    else {
                        $trNode = $(AppointmentTable.Template);
                        $trNode.appendTo($first_tableNode);
                    }
                }
            }
            else {
                var $tableNode = $(AppointmentTable.TemplateContent).attr("id", item.id);
                var item_year = Number(item.id.split("-")[0]);
                var item_month = Number(item.id.split("-")[1]);
                var item_date = Number(item.id.split("-")[2]);
                var i = 0;
                while ($table_containerNode.find("table").get(i)) {
                    var table_id = $table_containerNode.find("table").get(i).id;
                    var table_year = Number(table_id.split("-")[0]);
                    var table_month = Number(table_id.split("-")[1]);
                    var table_date = Number(table_id.split("-")[2]);
                    if (item_year < table_year) {
                        $tableNode.insertBefore($("#" + table_id));
                        break;
                    }
                    else if (item_year === table_year) {
                        if (item_month < table_month) {
                            $tableNode.insertBefore($("#" + table_id));
                            break;
                        }
                        else if (item_month === table_month) {
                            if (item_date < table_date) {
                                $tableNode.insertBefore($("#" + table_id));
                                break;
                            }
                        }
                    }
                    i++;
                    if (i === $table_containerNode.find("table").length) {
                        $tableNode.appendTo($table_containerNode);
                    }
                }
                if ($table_containerNode.find(".appointment_table_border_left")) {
                    $table_containerNode.find(".appointment_table_border_left").removeClass("appointment_table_border_left");
                }
                $("#" + $table_containerNode.find("table").get(0).id).addClass("appointment_table_border_left");
                $trNode.appendTo($tableNode);
                $trNode.find("td").text(item.id);
                var arr_width = $table_containerNode.css("width").split("px");
                var num_width = Number(arr_width[0]) + 280;
                var str_width = num_width + "px";
                $table_containerNode.css("width", str_width);
                for (var i_2 = 0; i_2 < Number(item.rowNum); i_2++) {
                    if (i_2 === Number(item.handle_appointmentTime) - 1) {
                        $trNode = $(AppointmentTable.TemplateDate);
                        $trNode.appendTo($tableNode);
                        $trNode.find(".appointment_table_data_yes").attr("style", "width: " + 1 / Number(item.limitNum) * 100 + "%");
                        $trNode.find(".appointment_table_data_yes").attr("title", "1");
                    }
                    else {
                        $trNode = $(AppointmentTable.Template);
                        $trNode.appendTo($tableNode);
                    }
                }
            }
        };
        AppointmentTable.prototype.setItem = function (item) {
            if (item.handle_appointmentTime !== null && item.handle_appointmentTime.length !== 0) {
                var $tableNode = this.$thisNode.find("#" + item.id);
                var $trNode = $tableNode.find("tr").eq(Number(item.handle_appointmentTime));
                if ($trNode.find("div").length === 0) {
                    if ($trNode.find("td").css("background-color") === "rgb(244, 247, 249)") {
                        alert("此时间段不开放预约！");
                    }
                    else {
                        var $new_trNode = $(AppointmentTable.TemplateDate);
                        $trNode.replaceWith($new_trNode);
                        $new_trNode.find(".appointment_table_data_yes").attr("style", "width: " + 1 / Number(item.limitNum) * 100 + "%");
                        $new_trNode.find(".appointment_table_data_yes").attr("title", "1");
                    }
                }
                else {
                    if ($trNode.find(".appointment_table_data_yes").length !== 0) {
                        var appointNum = Number($trNode.find(".appointment_table_data_yes").attr("title"));
                        var arr_width = $trNode.find(".appointment_table_data_yes").css("width").split("px");
                        var num_width = Number(arr_width[0]) / appointNum + Number(arr_width[0]);
                        var str_width = num_width + "px";
                        $trNode.find(".appointment_table_data_yes").css("width", str_width);
                        appointNum = appointNum + 1;
                        $trNode.find(".appointment_table_data_yes").attr("title", String(appointNum));
                        $trNode.find(".appointment_table_text").text("已预约" + appointNum + "人");
                        if (appointNum === Number(item.limitNum)) {
                            $trNode.find(".appointment_table_data_yes").addClass("appointment_table_data_full")
                                .removeClass("appointment_table_data_yes").css("width", "100%");
                            $trNode.find(".appointment_table_text").text("已约满");
                        }
                    }
                    else {
                        if ($trNode.find(".appointment_table_data_full").length !== 0) {
                            alert(item.id + "存在超出预约人数，请检查");
                        }
                    }
                }
            }
        };
        AppointmentTable.prototype.changeTimeTable = function (args) {
            var $timeNode = this.$thisNode.find(".appointment_table_tabletime table");
            $timeNode.empty();
            var time = args.time;
            var $first_timeNode = $(AppointmentTable.Template);
            $first_timeNode.appendTo($timeNode);
            $first_timeNode.find("td").text("全天");
            var origin_time = time[0];
            var timeNum = time[1];
            for (var i = 0; i <= timeNum; i++) {
                var $item_timeNode = $(AppointmentTable.Template);
                $item_timeNode.appendTo($timeNode);
                $item_timeNode.find("td").text(origin_time + ":00");
                origin_time = origin_time + 1;
            }
        };
        AppointmentTable.prototype.setDisallowAppoint = function (args) {
            var items = args.items;
            if (!items || items.length === 0) {
                return;
            }
            for (var i = 0; i < items.length; i++) {
                if (items[i].date) {
                    if (this.$thisNode.find("#" + items[i].date).length !== 0) {
                        var $tableNode = this.$thisNode.find("#" + items[i].date);
                        var $trNode = $tableNode.find("tr").eq(Number(items[i].disallowTime));
                        $trNode.find("td").css("background-color", "#f4f7f9");
                    }
                    else {
                        break;
                    }
                }
            }
        };
        AppointmentTable.prototype.removeItem = function (args) {
            var items = args.items;
            if (!items || items.length === 0) {
                return;
            }
            for (var i = 0; i < items.length; i++) {
                if (items[i].id) {
                    if (this.$thisNode.find("#" + items[i].id).length !== 0) {
                        var $tableNode = this.$thisNode.find("#" + items[i].id);
                        var $trNode = $tableNode.find("tr").eq(Number(items[i].removeTime));
                        if ($trNode.find(".appointment_table_data_yes").length !== 0) {
                            var appointNum = Number($trNode.find(".appointment_table_data_yes").attr("title")) - 1;
                            if (appointNum === 0) {
                                $trNode.find("td").empty();
                            }
                            else {
                                $trNode.find(".appointment_table_data_yes").attr("style", "width: " + appointNum / Number(items[i].limitNum) * 100 + "%");
                                $trNode.find(".appointment_table_data_yes").attr("title", String(appointNum));
                                $trNode.find(".appointment_table_text").text("已预约" + appointNum + "人");
                            }
                        }
                        else {
                            if ($trNode.find(".appointment_table_data_full").length !== 0) {
                                var appointNum = Number($trNode.find(".appointment_table_data_full").attr("title")) - 1;
                                $trNode.find(".appointment_table_data_full").addClass("appointment_table_data_yes").removeClass("appointment_table_data_full");
                                $trNode.find(".appointment_table_data_yes").attr("style", "width: " + appointNum / Number(items[i].limitNum) * 100 + "%");
                                $trNode.find(".appointment_table_data_yes").attr("title", String(appointNum));
                                $trNode.find(".appointment_table_text").text("已预约" + appointNum + "人");
                            }
                        }
                    }
                    else {
                        break;
                    }
                }
            }
        };
        AppointmentTable.prototype.removeTable = function (args) {
            var itemIds = args.itemIds;
            if (!itemIds || itemIds.length === 0) {
                return;
            }
            for (var i = 0; i < itemIds.length; i++) {
                if (itemIds[i]) {
                    if (this.$thisNode.find("#" + itemIds[i]).length !== 0) {
                        this.$thisNode.find("#" + itemIds[i]).remove();
                    }
                }
            }
            if (this.$thisNode.find(".appointment_table_scrollbar").find("table").length !== 0) {
                if (this.$thisNode.find(".appointment_table_border_left").length === 0) {
                    this.$thisNode.find(".appointment_table_scrollbar").find("table").eq(0).addClass("appointment_table_border_left");
                }
            }
        };
        AppointmentTable.prototype.clear = function () {
            this.$thisNode.find(".appointment_table_scrollbar").empty();
        };
        AppointmentTable.TemplateTime = "\n    <div>\n    <div class=\"appointment_table_tabletime\">\n        <table>\n            <tr><td>\u5168\u5929</td></tr>\n            <tr><td>9:00</td></tr>\n            <tr><td>10:00</td></tr>\n            <tr><td>11:00</td></tr>\n            <tr><td>12:00</td></tr>\n            <tr><td>13:00</td></tr>\n            <tr><td>14:00</td></tr>\n            <tr><td>15:00</td></tr>\n            <tr><td>16:00</td></tr>\n            <tr><td>17:00</td></tr>\n        </table>\n    </div>\n    <div class=\"appointment_table_line\">\n        <span class=\"appointment_table_color_gray_small\"></span>\n        <span class=\"appointment_table_line_font\" >\u4E0D\u5F00\u653E\u9884\u7EA6</span>\n        <span class=\"appointment_table_color_white_small\"></span>\n        <span class=\"appointment_table_line_font\">\u65E0\u9884\u7EA6\u8BB0\u5F55</span>\n        <span class=\"appointment_table_color_blue_small\"></span>\n        <span class=\"appointment_table_line_font\">\u6709\u9884\u7EA6\u8BB0\u5F55\u4E14\u672A\u6EE1</span>\n        <span class=\"appointment_table_color_red_small\"></span>\n        <span class=\"appointment_table_line_font\">\u5DF2\u7EA6\u6EE1</span>\n    </div>\n    <div class=\"appointment_table\">\n        <div class=\"appointment_table_scrollbar\">\n        </div>\n    </div>\n</div>";
        AppointmentTable.TemplateLeft = "\n<table class=\"appointment_table_tablecontent appointment_table_border_left\">\n</table>";
        AppointmentTable.TemplateContent = "\n    <table class=\"appointment_table_tablecontent\">\n</table>";
        AppointmentTable.Template = "<tr><td></td></tr>";
        AppointmentTable.TemplateDate = "\n    <tr><td><div class=\"appointment_table_data_yes\"><div class=\"appointment_table_text\">\u5DF2\u9884\u7EA61\u4EBA</div></div></td></tr>\n";
        return AppointmentTable;
    }(Widget_37.Widget));
    exports.AppointmentTable = AppointmentTable;
});
define("widget/transfernetwork/BarGraph", ["require", "exports", "widget/Widget"], function (require, exports, Widget_38) {
    "use strict";
    var BarGraph = (function (_super) {
        __extends(BarGraph, _super);
        function BarGraph(parentId, id, style) {
            _super.call(this, parentId, id, style);
            this.data = new Array();
            this.option = {};
            var own = this;
            this.$thisNode = $(BarGraph.Template).attr("id", this.id);
            this.$graphNode = this.$thisNode.children("div");
            this.resizeFunction = function () {
                own.echart.resize();
            };
            $(window).on("resize", this.resizeFunction);
        }
        BarGraph.prototype.setData = function (args) {
            this.data = args.data;
        };
        BarGraph.prototype.clear = function () {
            this.data = [];
            this.option = [];
            this.echart.clear();
        };
        BarGraph.prototype.clearData = function () {
            this.data = [];
            var graphOption = {
                title: {
                    text: "等待时间队列",
                    subtext: "",
                    x: "center"
                },
                tooltip: {
                    trigger: "axis",
                    axisPointer: {
                        type: "line"
                    }
                },
                legend: {
                    data: ["预警内已等待时间", "距离预警时间", "超出预警时间"],
                    orient: "vertical",
                    x: "left"
                },
                grid: {
                    top: "103px",
                    left: "3%",
                    right: "10%",
                    bottom: "3%",
                    containLabel: true
                },
                xAxis: {
                    type: "category",
                    name: "客户名称",
                    data: [""],
                    axisTick: {
                        alignWithLabel: true
                    }
                },
                yAxis: {
                    type: "value",
                    name: "时间/分"
                }
            };
            this.option = graphOption;
            if (this.echart) {
                this.echart.clear();
                this.echart.setOption(this.option);
            }
        };
        BarGraph.prototype.postLayout = function () {
            var own = this;
            if (this.data.length > 0) {
                this.redrawGraph();
            }
            if (!this.echart) {
                this.echart = echarts.init(this.$graphNode.get(0));
                if (this.option) {
                    this.echart.setOption(this.option);
                }
            }
        };
        BarGraph.prototype.dispose = function () {
            $(window).off("resize", this.resizeFunction);
            _super.prototype.dispose.call(this);
        };
        BarGraph.prototype.redrawGraph = function () {
            var nameList = new Array();
            var blueValueList = new Array();
            var whiteValueList = new Array();
            var redValueList = new Array();
            var dValueList = new Array();
            for (var _i = 0, _a = this.data; _i < _a.length; _i++) {
                var entry = _a[_i];
                var dValue = entry.value - entry.alertValue;
                dValueList.push(dValue);
                var blueValue = void 0;
                var whiteValue = void 0;
                var redValue = void 0;
                if (dValue === 0) {
                    blueValue = entry.value + "";
                    whiteValue = "";
                    redValue = "";
                }
                else if (dValue > 0) {
                    blueValue = entry.alertValue + "";
                    whiteValue = "";
                    redValue = dValue + "";
                }
                else if (dValue < 0) {
                    blueValue = entry.value + "";
                    whiteValue = 0 - dValue + "";
                    redValue = "";
                }
                blueValue = blueValue === "0" ? "" : blueValue;
                whiteValue = whiteValue === "0" ? "" : whiteValue;
                redValue = redValue === "0" ? "" : redValue;
                nameList.push(entry.name);
                blueValueList.push(blueValue);
                whiteValueList.push(whiteValue);
                redValueList.push(redValue);
            }
            var tempDValueList = dValueList.concat();
            tempDValueList.sort(function (a, b) {
                return a - b;
            });
            var signWhiteValue = tempDValueList[0];
            var signWhiteX = dValueList.indexOf(signWhiteValue);
            var signWhiteY = this.data[signWhiteX].alertValue;
            signWhiteValue = 0 - tempDValueList[0];
            var signRedValue = tempDValueList[tempDValueList.length - 1];
            var signRedX = dValueList.lastIndexOf(signRedValue);
            var signRedY = this.data[signRedX].value;
            var graphOption = {
                title: {
                    text: "等待时间队列",
                    subtext: "",
                    x: "center"
                },
                tooltip: {
                    trigger: "axis",
                    axisPointer: {
                        type: "line"
                    }
                },
                legend: {
                    data: ["预警内已等待时间", "距离预警时间", "超出预警时间"],
                    orient: "vertical",
                    x: "left"
                },
                grid: {
                    top: "103px",
                    left: "3%",
                    right: "10%",
                    bottom: "3%",
                    containLabel: true
                },
                xAxis: {
                    type: "category",
                    name: "客户名称",
                    data: nameList,
                    axisTick: {
                        alignWithLabel: true
                    }
                },
                yAxis: {
                    type: "value",
                    name: "时间/分"
                },
                series: [
                    {
                        name: "预警内已等待时间",
                        type: "bar",
                        stack: "等待时间",
                        label: {
                            normal: {
                                show: true,
                                position: "inside"
                            }
                        },
                        itemStyle: {
                            normal: {
                                color: "#004B97",
                                borderColor: "#004B97"
                            }
                        },
                        data: blueValueList
                    },
                    {
                        name: "距离预警时间",
                        type: "bar",
                        stack: "等待时间",
                        label: {
                            normal: {
                                show: true,
                                position: "inside",
                                textStyle: {
                                    color: "#009100"
                                }
                            }
                        },
                        itemStyle: {
                            normal: {
                                color: "#FCFCFC",
                                borderColor: "#004B97"
                            }
                        },
                        data: whiteValueList
                    },
                    {
                        name: "超出预警时间",
                        type: "bar",
                        stack: "等待时间",
                        label: {
                            normal: {
                                show: true,
                                position: "inside"
                            }
                        },
                        itemStyle: {
                            normal: {
                                color: "#CE0000",
                                borderColor: "#CE0000"
                            }
                        },
                        data: redValueList
                    }
                ]
            };
            this.option = graphOption;
            if (this.echart) {
                this.echart.setOption(this.option);
            }
        };
        BarGraph.Template = "\n    <div>\n        <div style=\"width:100%;height:100%\"></div>\n    </div>\n    ";
        return BarGraph;
    }(Widget_38.Widget));
    exports.BarGraph = BarGraph;
});
define("widget/transfernetwork/BranchChart", ["require", "exports", "widget/echart/EChart"], function (require, exports, EChart_4) {
    "use strict";
    var BranchChart = (function (_super) {
        __extends(BranchChart, _super);
        function BranchChart() {
            _super.apply(this, arguments);
            this.netPointList = new Array();
            this.title = "unset";
            this.subTitle = "";
        }
        BranchChart.prototype.setData = function (args) {
            this.netPointList = new Array();
            this.netPointList.push({ pointName: "当前网点", distance: 0, walkTime: 0 });
            this.netPointList = this.netPointList.concat(args.netPointList);
        };
        BranchChart.prototype.setTitle = function (args) {
            this.title = args.titles.title;
            this.subTitle = args.titles.subTitle;
        };
        BranchChart.prototype.postLayout = function () {
            if (this.netPointList.length > 0) {
                this.redrawChart();
            }
            _super.prototype.postLayout.call(this);
        };
        BranchChart.prototype.getFormat = function (netPoint) {
            var $assistNode = $("<div>");
            var tableBlock = $("<div></div>").addClass("branchChart-table responsive-table");
            var table = $("<table class='centered'></table>");
            var tableTheadTemplate = "\n        <thead>\n            <tr>\n                <th data-field=\"name\" style=\"width:50%\">\u9879\u76EE\u540D\u79F0</th>\n                <th data-field=\"name\" style=\"width:50%\">\u63CF\u8FF0/\u503C</th>\n            </tr>\n        </thead>\n        ";
            var tableThead = $(tableTheadTemplate);
            var tableBody = $("<tbody></tbody>");
            var createRow = function (name, content) {
                var row = $("<tr>");
                var nameEntry = $("<td style='padding:5px 5px;width:50%'></td>").html(name);
                var contentEntry = $("<td style=\"padding:5px 5px;width:50%;overflow:auto\"></td>").html(content);
                row.append(nameEntry).append(contentEntry);
                return row;
            };
            tableBody.append(createRow("网点名称", netPoint.pointName));
            tableBody.append(createRow("和当前网点距离", netPoint.distance + "米"));
            tableBody.append(createRow("步行需要时间", netPoint.walkTime + "分钟"));
            if (netPoint.description && netPoint.description.length > 0) {
                for (var _i = 0, _a = netPoint.description; _i < _a.length; _i++) {
                    var d = _a[_i];
                    tableBody.append(createRow(d.descriptionName, d.descriptionContent));
                }
            }
            table.append(tableThead);
            table.append(tableBody);
            tableBlock.append(table);
            var showNumberTable = $("\n        <table class=\"centered\" style=\"width:70%;margin-left:15%;\">\n            <thead>\n                <tr>\n                    <th data-field=\"name\" style=\"width:50%\">\u7F51\u70B9\u7A97\u53E3\u6570\u91CF</th>\n                    <th data-field=\"name\" style=\"width:50%\">\u5F53\u524D\u7B49\u5F85\u4EBA\u6570</th>\n                </tr>\n            </thead>\n            <tbody>\n                <tr></tr>\n            </tbody>\n        </table>\n        ");
            if (netPoint.windowNumber && netPoint.waitInLineNumber) {
                var showNumberRow = showNumberTable.find("tbody").find("tr");
                showNumberRow.append(createRow(netPoint.windowNumber + "", netPoint.waitInLineNumber + ""));
                tableBlock.append(showNumberTable);
            }
            var othersTable = $("\n        <table class=\"centered\">\n            <thead>\n                <tr>\n                    <th data-field=\"name\" style=\"width:50%\">\u5176\u4ED6\u6570\u636E\u540D\u79F0</th>\n                    <th data-field=\"name\" style=\"width:50%\">\u5176\u4ED6\u6570\u636E\u6570\u503C</th>\n                </tr>\n            </thead>\n            <tbody>\n                <tr></tr>\n            </tbody>\n        </table>\n        ");
            if (netPoint.othersInfo && netPoint.othersInfo.length > 0) {
                var othersRow = othersTable.find("tbody").find("tr");
                var othersList = netPoint.othersInfo;
                for (var _b = 0, othersList_1 = othersList; _b < othersList_1.length; _b++) {
                    var other = othersList_1[_b];
                    othersRow.append(createRow(other.otherName, other.otherContent));
                }
                tableBlock.append(othersTable);
            }
            $assistNode.append(tableBlock);
            return $assistNode.html();
        };
        BranchChart.prototype.getMaxLength = function () {
            var distanceList = new Array();
            for (var _i = 0, _a = this.netPointList; _i < _a.length; _i++) {
                var netPoint = _a[_i];
                distanceList.push(netPoint.distance);
            }
            distanceList.sort(function (a, b) {
                return a - b;
            });
            return distanceList[distanceList.length - 1];
        };
        BranchChart.prototype.redrawChart = function () {
            var own = this;
            var maxLength = 1.1 * this.getMaxLength();
            var indicatorContent = new Array();
            for (var i = 0; i < this.netPointList.length; i++) {
                var indicatorEntry = {
                    name: i > 0 ? this.netPointList[i].pointName + " \u6B65\u884C\u8DDD\u79BB:" + this.netPointList[i].distance + "\u7C73" : "",
                    max: maxLength
                };
                indicatorContent.push(indicatorEntry);
            }
            var createDataEntry = function (index, value, length) {
                var valueList = new Array();
                for (var i = 0; i < length; i++) {
                    valueList.push("");
                }
                valueList[index] = value.toString();
                var dataEntryTemplate = {
                    value: valueList,
                    name: index.toString(),
                    symbol: "circle",
                    symbolSize: 8
                };
                return dataEntryTemplate;
            };
            var dataContent = new Array();
            for (var i = 0; i < this.netPointList.length; i++) {
                dataContent.push(createDataEntry(i, this.netPointList[i].distance, this.netPointList.length));
            }
            var branchOption = {
                title: {
                    text: this.title,
                    subtext: this.subTitle,
                    x: "center"
                },
                legend: {},
                tooltip: {
                    formatter: function (params, ticket, callback) {
                        var netPoint = own.netPointList[params.dataIndex];
                        return own.getFormat(netPoint);
                    },
                    enterable: true,
                    backgroundColor: "transparent",
                    transitionDuration: 0.4,
                    textStyle: {
                        color: "black"
                    },
                    hideDelay: 50,
                    position: function (point, params, dom) {
                        var x = point[0];
                        var y = point[1];
                        var width = own.$thisNode.get(0).clientWidth;
                        var height = own.$thisNode.get(0).clientHeight;
                        var rX = x;
                        var rY = y;
                        if (x + 150 > width && x - 150 < 0) {
                            return "inside";
                        }
                        else if (x + 150 > width) {
                            rX = width - 150;
                        }
                        else if (x - 150 < 0) {
                            rX = 150;
                        }
                        if (y + 200 > height && y - 200 < 0) {
                            return "inside";
                        }
                        else if (y + 200 > height) {
                            rY = height - 200;
                        }
                        else if (y - 200 < 0) {
                            rY = 200;
                        }
                        return [rX - 150, rY - 200];
                    }
                },
                radar: [
                    {
                        indicator: indicatorContent,
                        center: ["50%", "50%"],
                        radius: "70%",
                        startAngle: 90,
                        splitNumber: 5,
                        shape: "circle",
                        name: {
                            textStyle: {
                                color: "#003D79",
                                fontSize: "13"
                            }
                        },
                        splitArea: {
                            areaStyle: {
                                color: ["rgba(114, 172, 209, 1)",
                                    "rgba(114, 172, 209, 0.8)", "rgba(114, 172, 209, 0.6)",
                                    "rgba(114, 172, 209, 0.4)", "rgba(114, 172, 209, 0.2)"],
                                shadowColor: "rgba(0, 0, 0, 0.3)",
                                shadowBlur: 10
                            }
                        },
                        axisLine: {
                            lineStyle: {
                                color: "rgba(114, 172, 209, 0.1)"
                            }
                        },
                        splitLine: {
                            lineStyle: {
                                color: "rgba(114, 172, 209, 0.5)"
                            }
                        }
                    }
                ],
                series: [
                    {
                        name: "雷达图",
                        type: "radar",
                        itemStyle: {
                            normal: {
                                shadowColor: "black",
                                shadowBlur: 10,
                                color: "white"
                            }
                        },
                        data: dataContent
                    }
                ]
            };
            this.option = branchOption;
            if (this.echart) {
                this.echart.setOption(this.option);
            }
        };
        return BranchChart;
    }(EChart_4.EChart));
    exports.BranchChart = BranchChart;
});
define("widget/transfernetwork/CustomQueue", ["require", "exports", "widget/Widget", "event/EventHub", "event/MessageType", "event/Event"], function (require, exports, Widget_39, EventHub_34, MessageType_35, Event_32) {
    "use strict";
    var CustomQueue = (function (_super) {
        __extends(CustomQueue, _super);
        function CustomQueue(parentId, id, style) {
            _super.call(this, parentId, id, style);
            this.isSelected = false;
            this.movingControlPositions = new Array();
            this.checkDistance = 60;
            this.$thisNode = $(CustomQueue.TemplateCotainer).attr({ id: this.id });
        }
        CustomQueue.prototype.addItems = function (args) {
            var items = args.items;
            if (!items || items.length === 0) {
                return;
            }
            for (var i = 0; i < items.length; i++) {
                if (items[i].queue_num) {
                    if (this.$thisNode.find("#" + items[i].queue_num).length !== 0) {
                        this.setItem(items[i]);
                    }
                    else {
                        this.addItem(items[i]);
                    }
                }
            }
            this.setListeners();
        };
        CustomQueue.prototype.setItems = function (args) {
            var items = args.items;
            this.clear();
            this.addItems({ items: items });
            this.setListeners();
        };
        CustomQueue.prototype.setItem = function (item) {
            var itemNode = this.$thisNode.find("#" + item.queue_num);
            this.setCustomAttr(itemNode, item);
        };
        CustomQueue.prototype.addItem = function (item) {
            var itemNode = $(CustomQueue.TemplateQueue).attr({ id: item.queue_num });
            itemNode.appendTo(this.$thisNode);
            this.setCustomAttr(itemNode, item);
            var own = this;
            itemNode.find("p.custom_queue_footer").on("click", function (e) {
                var index = own.indexOf(itemNode[0]);
                var queueNO = itemNode.attr("id");
                EventHub_34.EventHub.dispatchEvent(MessageType_35.MessageType.WIDGET, {
                    id: own.id,
                    evtType: Event_32.Event.CLICK,
                    index: index,
                    queue_num: queueNO
                });
            });
            itemNode.find("div[lookOver]").on("click", function (e) {
                var index = own.indexOf(itemNode[0]);
                var queueNO = itemNode.attr("id");
                EventHub_34.EventHub.dispatchEvent(MessageType_35.MessageType.WIDGET, {
                    id: own.id,
                    evtType: Event_32.Event.LOOK_OVER,
                    index: index,
                    queue_num: queueNO
                });
            });
        };
        CustomQueue.prototype.indexOf = function (item) {
            var items = this.$thisNode.find("div.custom_queue_container");
            for (var i = 0; i < items.length; i++) {
                if (item === items[i]) {
                    return i;
                }
            }
            return -1;
        };
        CustomQueue.prototype.setCustomAttr = function (itemNode, item) {
            itemNode.find(".custom_queue_id").text(item.queue_num);
            itemNode.find(".custom_queue_wait_time").text(item.waitting + "分钟");
            if (item.en_queue_time) {
                itemNode.find(".custom_queue_get_no_time").text(item.en_queue_time);
            }
            var customNameNode = itemNode.find(".custom_queue_name");
            if (item.name) {
                customNameNode.text(item.name);
            }
            if (item.sex) {
                var customSex = $(CustomQueue.TemplateImage).appendTo(customNameNode);
                customSex.css({ marginTop: "-5px" });
                if (item.sex === "男" || item.sex === "man" || item.sex === "1") {
                    customSex.attr("src", "images/custom_queue/man.png");
                }
                else {
                    customSex.attr("src", "images/custom_queue/woman.png");
                }
            }
            if (item.customLevel) {
                var customLevelNode = itemNode.find(".custom_queue_custom_level");
                customLevelNode.text("客户等级：" + item.customLevel);
                var customLevelImg = $(CustomQueue.TemplateImage).appendTo(customLevelNode);
                if (item.customLevel === "黄金客户") {
                    customLevelImg.attr("src", "images/custom_queue/custom_level/huangjin.png");
                }
                else if (item.customLevel === "白金客户") {
                    customLevelImg.attr("src", "images/custom_queue/custom_level/baijin.png");
                }
                else if (item.customLevel === "钻石客户") {
                    customLevelImg.attr("src", "images/custom_queue/custom_level/zuanshi.png");
                }
                else {
                    customLevelImg.attr("src", "images/custom_queue/custom_level/putong.png");
                }
            }
            if (item.businessFlag) {
                var imgArr = item.businessFlag.split(",");
                if (imgArr.length > 0) {
                    var businessFlagNode = itemNode.find(".custom_queue_business_flag");
                    businessFlagNode.find("img").remove();
                    for (var i = 0; i < imgArr.length; i++) {
                        $(CustomQueue.TemplateImage).attr("src", "images/custom_queue/business_flag/" + imgArr[i] + ".png").appendTo(businessFlagNode);
                    }
                }
            }
        };
        CustomQueue.prototype.removeItem = function (args) {
            var ids = args.itemIds;
            if (ids && ids.length > 0) {
                for (var i = 0; i < ids.length; i++) {
                    this.$thisNode.find("#" + ids[i]).remove();
                }
            }
            this.setListeners();
        };
        CustomQueue.prototype.clear = function () {
            this.$thisNode.find(".custom_queue_container").remove();
            this.setListeners();
        };
        CustomQueue.prototype.postLayout = function () {
            this.setListeners();
        };
        CustomQueue.prototype.dispose = function () {
            $(window).off("resize", this.resizeFunction);
            _super.prototype.dispose.call(this);
        };
        CustomQueue.prototype.setListeners = function () {
            var own = this;
            own.isSelected = false;
            own.selectedIndex = null;
            own.selectedUnitWidth = null;
            own.selectedUnit = null;
            own.targetIndex = null;
            own.movingControlPositions = new Array();
            own.animationUnit = null;
            own.resizeFunction = function () {
                own.setListeners();
            };
            $(window).on("resize", own.resizeFunction);
            if (this.$thisNode.find(".custom_queue_container").length === 0) {
                return;
            }
            var $units = this.$thisNode.find("div.custom_queue_container");
            var $unitsContainer = this.$thisNode;
            $units.each(function (index, elem) {
                var $elemNode = $(elem);
                var position = own.getUnitCenterPosition(elem);
                if ($elemNode.next().length < 0) {
                    position.x = position.x + elem.clientWidth;
                }
                own.movingControlPositions.push(position);
            });
            var moveControl = function (e) {
                if (own.isSelected) {
                    if (own.selectedUnit.style.position !== "absolute") {
                        $(own.selectedUnit).addClass("selected");
                    }
                    own.selectedUnit.style.width = own.selectedUnitWidth + "px";
                    own.selectedUnit.style.left = e.clientX - $unitsContainer.get(0).clientLeft
                        - own.selectedUnit.clientWidth / 2 + "px";
                    own.selectedUnit.style.top = e.clientY - $unitsContainer.get(0).clientTop
                        - own.selectedUnit.clientHeight / 2 + "px";
                }
            };
            $units.each(function (index, elem) {
                elem.onmousedown = function (e) {
                    if (!own.isSelected) {
                        own.isSelected = true;
                        own.selectedIndex = index;
                        own.selectedUnit = elem;
                        own.selectedUnitWidth = elem.clientWidth;
                        moveControl(e);
                        own.animationUnit = $(elem).next();
                        if (own.animationUnit.length > 0) {
                            own.animationUnit.removeClass("moveToLeft").addClass("moveToRight");
                        }
                        elem.onmouseup = function () {
                            if (own.targetIndex === -1) {
                                $units.removeClass("moveToLeft").removeClass("moveToRight").
                                    removeClass("selected").removeClass("inPosition");
                            }
                            else if (own.targetIndex > -1) {
                                $units.removeClass("moveToLeft").removeClass("moveToRight").
                                    removeClass("selected").removeClass("inPosition");
                                var $tempNode = $(own.selectedUnit);
                                if (own.targetIndex > 0) {
                                    $units.eq(own.targetIndex - 1).after($tempNode);
                                }
                                else if (own.targetIndex === 0) {
                                    $units.eq(0).before($tempNode);
                                }
                                EventHub_34.EventHub.dispatchEvent(MessageType_35.MessageType.WIDGET, {
                                    id: own.id,
                                    evtType: Event_32.Event.ON_CHANGE,
                                    originIndex: own.selectedIndex,
                                    finalIndex: own.targetIndex
                                });
                            }
                            $units.css({
                                "width": "",
                                "left": "",
                                "top": ""
                            });
                            own.setListeners();
                            e.preventDefault();
                        };
                        e.preventDefault();
                    }
                };
            });
            $unitsContainer.get(0).onmousemove = function (e) {
                moveControl(e);
                if (own.isSelected) {
                    var targetIndex = own.getTargetIndex(e, own.checkDistance);
                    if (targetIndex >= own.selectedIndex) {
                        targetIndex++;
                    }
                    if (own.targetIndex === undefined) {
                        own.targetIndex = targetIndex;
                    }
                    if (own.targetIndex === -1 && targetIndex > -1) {
                        own.animationUnit = $units.eq(targetIndex);
                        $(own.selectedUnit).addClass("inPosition");
                        own.animationUnit.removeClass("moveToLeft").addClass("moveToRight");
                    }
                    else if (own.targetIndex > -1 && targetIndex === -1) {
                        $(own.selectedUnit).removeClass("inPosition");
                        own.animationUnit.removeClass("moveToRight").addClass("moveToLeft");
                    }
                    own.targetIndex = targetIndex;
                }
                e.preventDefault();
            };
        };
        CustomQueue.prototype.getTargetIndex = function (event, checkDistance) {
            var own = this;
            var minDistance = checkDistance;
            var index = 0;
            var rIndex = -1;
            for (var _i = 0, _a = this.movingControlPositions; _i < _a.length; _i++) {
                var position = _a[_i];
                var dX = event.clientX - position.x;
                var dY = event.clientY - position.y;
                var dDistance = Math.sqrt(Math.pow(dX, 2) + Math.pow(dY, 2));
                if (dDistance < checkDistance) {
                    if (dDistance < minDistance) {
                        minDistance = dDistance;
                        rIndex = index;
                    }
                }
                index++;
            }
            return rIndex;
        };
        CustomQueue.prototype.getUnitCenterPosition = function (elem) {
            var startX = elem.offsetLeft;
            var startY = elem.offsetTop;
            var width = elem.clientWidth;
            var height = elem.clientHeight;
            var centerPosition = { x: startX + width / 2, y: startY + height / 2 };
            return centerPosition;
        };
        CustomQueue.TemplateCotainer = "<div class=\"row\"></div>";
        CustomQueue.TemplateQueue = "\n            <div class=\"col s6 m4 l3 custom_queue_container\">\n                <div class=\"custom_queue_container_second\">\n                    <p class=\"custom_queue_id\"><!--A001--></p>\n\n                    <div class=\"custom_queue_roundness\" lookOver>\n                        <p class=\"custom_queue_roundness_header_p\">\u5DF2\u7B49\u5F85\u65F6\u95F4</p>\n\n                        <p class=\"custom_queue_roundness_header_p custom_queue_wait_time\"><!--x\u5206\u949F--></p>\n\n                        <div class=\"custom_queue_roundness_middle_div\">\n                        </div>\n\n                        <p class=\"custom_queue_roundness_footer_p\">\u53D6\u53F7\u65F6\u95F4</p>\n\n                        <p class=\"custom_queue_roundness_footer_p custom_queue_get_no_time\"><!--12:09:11--></p>\n                    </div>\n\n                    <div class=\"custom_queue_body\" lookOver>\n                        <p class=\"custom_queue_name\"><!--\u9A6C\u5FD7<img src=\"images/custom_queue/man.png\"\n                                                style=\"margin-top:-5px;\"/>--></p>\n                    </div>\n                    <p class=\"custom_queue_custom_level\">\u5BA2\u6237\u7B49\u7EA7\uFF1A\u666E\u901A\u5BA2\u6237<img\n                        src=\"images/custom_queue/custom_level/putong.png\"/></p>\n\n                    <div class=\"custom_queue_business_flag\">\n                    </div>\n\n                    <p class=\"custom_queue_footer\"><img src=\"images/custom_queue/tiaozheng.png\"/>\u8C03\u6574</p>\n                </div>\n            </div>";
        CustomQueue.TemplateImage = "<img/>";
        return CustomQueue;
    }(Widget_39.Widget));
    exports.CustomQueue = CustomQueue;
});
define("widget/transfernetwork/ProductShow", ["require", "exports", "widget/Widget", "ADORE", "event/EventHub", "event/MessageType", "event/Event"], function (require, exports, Widget_40, ADORE_12, EventHub_35, MessageType_36, Event_33) {
    "use strict";
    var ProductShow = (function (_super) {
        __extends(ProductShow, _super);
        function ProductShow(parentId, id, style) {
            _super.call(this, parentId, id, style);
            this.$thisNode = $(ProductShow.TemplateRow).attr({ id: this.id });
            this.noIncome = false;
            var result = ADORE_12.ADORE.ProductShowNoIncome & style;
            if (result === ADORE_12.ADORE.ProductShowNoIncome) {
                this.noIncome = true;
            }
        }
        ProductShow.prototype.addItems = function (args) {
            var items = args.items;
            if (!items || items.length === 0) {
                return;
            }
            var $father = this.$thisNode.parent();
            this.$thisNode.detach();
            for (var i = 0; i < items.length; i++) {
                if (this.$thisNode.find("#" + items[i].id).length !== 0) {
                    this.setItem(items[i]);
                }
                else {
                    this.addItem(items[i]);
                }
            }
            this.$thisNode.appendTo($father);
        };
        ProductShow.prototype.setItems = function (args) {
            var items = args.items;
            this.clear();
            this.addItems({ items: items });
        };
        ProductShow.prototype.addItem = function (item) {
            var itemNode = $(ProductShow.TemplateShow).attr({ id: item.id });
            itemNode.appendTo(this.$thisNode);
            this.setItemAttr(itemNode, item);
            var own = this;
            itemNode.find("div.product-show-button").on("click", function (e) {
                var index = own.indexOf(itemNode[0]);
                var productID = itemNode.attr("id");
                EventHub_35.EventHub.dispatchEvent(MessageType_36.MessageType.WIDGET, {
                    id: own.id,
                    evtType: Event_33.Event.CLICK,
                    index: index,
                    itemID: productID
                });
            });
        };
        ProductShow.prototype.indexOf = function (item) {
            var items = this.$thisNode.find("div.product-show");
            for (var i = 0; i < items.length; i++) {
                if (item === items[i]) {
                    return i;
                }
            }
            return -1;
        };
        ProductShow.prototype.setItem = function (item) {
            var itemNode = this.$thisNode.find("#" + item.id);
            this.setItemAttr(itemNode, item);
        };
        ProductShow.prototype.setItemAttr = function (itemNode, item) {
            itemNode.find("div.product-show-title").find("p").html(this.parseText(item.title));
            if (this.noIncome) {
                itemNode.find("div.product-show-income").css("display", "none");
                itemNode.find("div.product-show-subtitle").css("display", "none");
                itemNode.find("div.product-show-image").css("margin-top", "10px");
                itemNode.css("height", "408px");
            }
            else {
                itemNode.find("div.product-show-subtitle").find("p").html(this.parseText(item.subTitle));
                itemNode.find("div.product-show-income").find("p").text(item.income);
            }
            if (item.image) {
                itemNode.find("div.product-show-image").find("img").attr("src", item.image);
            }
            else {
                itemNode.find("div.product-show-image").find("img").attr("src", "../www/images/product_show/product-image.png");
            }
            itemNode.find("div.product-show-details").find("p").html(this.parseText(item.details));
            itemNode.find("div.product-show-button").find("p").text(item.btnText);
        };
        ProductShow.prototype.parseText = function (text) {
            if (text) {
                return text.replace(/\n/g, "<br>");
            }
            return "";
        };
        ProductShow.prototype.removeItem = function (args) {
            var ids = args.itemIds;
            if (ids && ids.length > 0) {
                for (var i = 0; i < ids.length; i++) {
                    this.$thisNode.find("#" + ids[i]).remove();
                }
            }
        };
        ProductShow.prototype.clear = function () {
            this.$thisNode.find("div.product-show").remove();
        };
        ProductShow.TemplateRow = "<div class=\"row\"> </div>";
        ProductShow.TemplateShow = "\n    <div class=\"col s6 m6 l4 product-show\">\n    <div class=\"product-show-container\">\n        <img class=\"product-show-container-img\" src=\"../www/images/product_show/hot-sell.png\">\n\n        <div class=\"product-show-container-prefix\">\n            <div class=\"product-show-title\">\n                <p></p>\n            </div>\n            <div class=\"product-show-second-container\">\n                <div class=\"product-show-subtitle\">\n                    <p></p>\n                </div>\n                <div class=\"product-show-income\">\n                    <p></p>\n                </div>\n                <div class=\"product-show-image\">\n                    <img style=\"max-width: 100%;max-height: 100%;\">\n                </div>\n                <div class=\"product-show-details\">\n                    <p class=\"product-show-details-content\">\n                        \n                    </p>\n                </div>\n                <div class=\"product-show-button\">\n                    <p></p>\n                </div>\n            </div>\n        </div>\n    </div>\n</div> ";
        return ProductShow;
    }(Widget_40.Widget));
    exports.ProductShow = ProductShow;
});
define("widget/transfernetwork/WindowQueue", ["require", "exports", "widget/Widget", "event/EventHub", "event/MessageType", "event/Event"], function (require, exports, Widget_41, EventHub_36, MessageType_37, Event_34) {
    "use strict";
    var WindowQueue = (function (_super) {
        __extends(WindowQueue, _super);
        function WindowQueue(parentId, id, style) {
            _super.call(this, parentId, id, style);
            this.$thisNode = $(WindowQueue.Template0).attr({ id: id });
        }
        WindowQueue.prototype.addItems = function (args) {
            var items = args.items;
            if (!items || items.length === 0) {
                return;
            }
            var $father = this.$thisNode.parent();
            if ($father.length !== 0) {
                this.$thisNode.detach();
            }
            for (var i = 0; i < items.length; i++) {
                if (items[i].win_num) {
                    if (this.$thisNode.find("#" + items[i].win_num).length !== 0) {
                        this.setItem(items[i]);
                    }
                    else {
                        this.addItem(items[i]);
                    }
                }
            }
            if ($father.length !== 0) {
                this.$thisNode.appendTo($father);
            }
        };
        WindowQueue.prototype.setItems = function (args) {
            var items = args.items;
            this.clear();
            this.addItems({ items: items });
        };
        WindowQueue.prototype.addItem = function (item) {
            var $itemNode = $(WindowQueue.Template1).attr({ id: item.win_num });
            $itemNode.appendTo(this.$thisNode);
            this.setWindowAttr($itemNode, item);
            var own = this;
            $itemNode.find("div.window_queue_body").on("click", function (e) {
                var index = own.indexOf($itemNode[0]);
                var win_num = $itemNode.attr("id");
                EventHub_36.EventHub.dispatchEvent(MessageType_37.MessageType.WIDGET, {
                    id: own.id,
                    evtType: Event_34.Event.LOOK_OVER,
                    index: index,
                    win_num: win_num
                });
            });
        };
        WindowQueue.prototype.setItem = function (item) {
            var $itemNode = this.$thisNode.find("#" + item.win_num);
            this.setWindowAttr($itemNode, item);
        };
        WindowQueue.prototype.setWindowAttr = function ($itemNode, item) {
            $itemNode.find(".window_queue_id")[0].innerHTML = WindowQueue.Template3 + item.win_num;
            if (item.status) {
                var windowQueueBody = $itemNode.find(".window_queue_body");
                windowQueueBody.removeClass("window_queue_body_border_style1").removeClass("window_queue_body_border_style2").removeClass("window_queue_body_border_style3");
                var $statusNode = $itemNode.find(".window_queue_status");
                $statusNode.text(item.status);
                var $statusImgNode = $(WindowQueue.Template2).appendTo($statusNode);
                if (item.status === "空闲") {
                    $statusImgNode.attr("src", "images/window_queue/kongxian.png");
                    windowQueueBody.addClass("window_queue_body_border_style1");
                }
                else if (item.status === "服务中") {
                    $statusImgNode.attr("src", "images/window_queue/fuwuzhong.png");
                    windowQueueBody.addClass("window_queue_body_border_style2");
                }
                else if (item.status === "离线") {
                    $statusImgNode.attr("src", "images/window_queue/lixian.png");
                    windowQueueBody.addClass("window_queue_body_border_style3");
                }
                else {
                    $statusImgNode.attr("src", "images/window_queue/weizhi.png");
                    windowQueueBody.addClass("window_queue_body_border_style3");
                }
            }
            if (item.tellerNo) {
                $itemNode.find(".window_queue_body_teller_no").text("柜员：" + item.tellerNo);
            }
            if (item.tellerName) {
                $itemNode.find(".window_queue_body_teller_name").text("姓名：" + item.tellerName);
            }
            if (item.queue_num) {
                $itemNode.find(".window_queue_body_service_custom").text("当前服务客户：" + item.queue_num);
            }
            if (item.serviceCustomLevel) {
                $itemNode.find(".window_queue_body_custom_level").text("客户等级：" + item.serviceCustomLevel);
                var customLevelNode = $itemNode.find(".window_queue_body_custom");
                customLevelNode.find("img").remove();
                var customLevelImg = $(WindowQueue.Template2).addClass("window_queue_body_custom_level_img").appendTo(customLevelNode);
                if (item.serviceCustomLevel === "黄金客户") {
                    customLevelImg.attr("src", "images/custom_queue/custom_level/huangjin.png");
                }
                else if (item.serviceCustomLevel === "白金客户") {
                    customLevelImg.attr("src", "images/custom_queue/custom_level/baijin.png");
                }
                else if (item.serviceCustomLevel === "钻石客户") {
                    customLevelImg.attr("src", "images/custom_queue/custom_level/zuanshi.png");
                }
                else {
                    customLevelImg.attr("src", "images/custom_queue/custom_level/putong.png");
                }
            }
            if (item.windowInfo) {
                $itemNode.find(".window_queue_body_footer_p").text(item.windowInfo);
            }
        };
        WindowQueue.prototype.removeItem = function (args) {
            var ids = args.itemIds;
            if (ids && ids.length > 0) {
                for (var i = 0; i < ids.length; i++) {
                    this.$thisNode.find("#" + ids[i]).remove();
                }
            }
        };
        WindowQueue.prototype.indexOf = function (item) {
            var $items = this.$thisNode.find("div.window_queue_container");
            for (var i = 0; i < $items.length; i++) {
                if (item === $items[i]) {
                    return i;
                }
            }
            return -1;
        };
        WindowQueue.prototype.clear = function () {
            this.$thisNode.find(".window_queue_container").remove();
        };
        WindowQueue.Template0 = "<div class=\"row\"></div>";
        WindowQueue.Template1 = "<div class=\"col s6 m4 l3 window_queue_container\">\n    <div>\n        <div class=\"window_queue_header\">\n            <p class=\"window_queue_id\"><!--\u7A97\u53E31-1-->\n            </p>\n\n            <p class=\"window_queue_status\">\u7A7A\u95F2<img src=\"images/window_queue/kongxian.png\"/></p>\n        </div>\n        <div class=\"window_queue_body\">\n            <p class=\"window_queue_body_teller_info window_queue_body_teller_no\">\u67DC\u5458\uFF1A\u6682\u65E0</p>\n\n            <p class=\"window_queue_body_teller_info window_queue_body_teller_name\">\u59D3\u540D\uFF1A\u6682\u65E0</p>\n            <img class=\"window_queue_body_img\" src=\"images/window_queue/guiyuan.png\"/>\n\n            <div class=\"window_queue_body_line\"></div>\n            <p class=\"window_queue_body_service_custom\">\u5F53\u524D\u670D\u52A1\u5BA2\u6237\uFF1A\u6682\u65E0</p>\n\n            <div class=\"window_queue_body_middle\"></div>\n            <div class=\"window_queue_body_custom\">\n                <p class=\"window_queue_body_custom_level\">\u5BA2\u6237\u7B49\u7EA7\uFF1A\u6682\u65E0</p>\n            </div>\n            <div class=\"window_queue_body_line\"></div>\n\n            <div class=\"window_queue_body_footer\">\n                <p class=\"window_queue_body_footer_p\">\u6682\u65E0\u6B64\u7A97\u53E3\u8BE6\u7EC6\u6570\u636E......</p>\n            </div>\n        </div>\n    </div>\n   </div>";
        WindowQueue.Template2 = "<img/>";
        WindowQueue.Template3 = "<img src=\"images/window_queue/window.png\"/>";
        return WindowQueue;
    }(Widget_41.Widget));
    exports.WindowQueue = WindowQueue;
});
define("widget/tree/TreeItem", ["require", "exports", "event/EventHub", "event/MessageType", "event/Event", "widget/tree/Tree", "widget/Composite"], function (require, exports, EventHub_37, MessageType_38, Event_35, Tree_1, Composite_12) {
    "use strict";
    var TreeItem = (function (_super) {
        __extends(TreeItem, _super);
        function TreeItem(parentId, id, style) {
            _super.call(this, parentId, id, style);
            this.children = new Array();
            this.children = new Array();
            this.$thisNode = $(TreeItem.TemplateNormal).attr("id", this.id);
            this.$attachNode = this.$thisNode;
            this.$a = this.$thisNode.find("a");
            this.hadChildren = false;
            this.isTreeItem = true;
            if (this.parent) {
                this.treeId = this.parent.treeId;
            }
            var itemId = this.id;
            var own = this;
            this.$a.on("click", function (e) {
                clearTimeout(own.timeoutFunc);
                own.timeoutFunc = setTimeout(function () {
                    own.handleClick(itemId, own.$attachNode);
                }, 300);
            });
            this.$a.on("dblclick", function (e) {
                clearTimeout(own.timeoutFunc);
                own.handleDBClick(itemId, $(this.parentNode));
            });
            this.$checkboxNode = this.$attachNode.find("div").eq(0);
            this.checkboxId = "";
            var tmpId = this.treeId;
            this.$checkboxNode.find("input").eq(0).on("click", function (e) {
                own.refreshCheckState();
                EventHub_37.EventHub.dispatchEvent(MessageType_38.MessageType.WIDGET, {
                    id: own.treeId,
                    evtType: Event_35.Event.ON_CHANGE,
                    cid: own.id,
                    checked: own.$checkboxNode.find("input").eq(0).prop("checked")
                });
            });
        }
        TreeItem.prototype.addChild = function (child) {
            this.children.push(child);
        };
        TreeItem.prototype.layout = function () {
            this.append();
            if (this.parent) {
                var treeNode = this.parent.$thisNode.find(".collapsible");
                if (treeNode) {
                    treeNode.collapsible();
                }
            }
        };
        TreeItem.prototype.handleDBClick = function (itemId, $itemNode) {
            this.clickCircle(itemId, $itemNode);
            EventHub_37.EventHub.dispatchEvent(MessageType_38.MessageType.WIDGET, { id: itemId, treeId: this.treeId, evtType: Event_35.Event.DOUBLE_CLICK });
        };
        TreeItem.prototype.clickCircle = function (itemId, $itemNode) {
            var tmpId = this.treeId;
            var tree = $("#" + tmpId);
            tree.find("li.bold").removeClass("adore_tree_node_selected");
            $itemNode.addClass("adore_tree_node_selected");
            var treeNodeCircle = $itemNode.find("div.adore_tree_node_circle").first();
            if (treeNodeCircle.length !== 0) {
                var arrowSpan = $itemNode.find("span.adore_tree_node_arrow").first();
                var circleDiv = treeNodeCircle.find("div");
                if (treeNodeCircle.attr("expand") === "false") {
                    treeNodeCircle.attr("expand", "true");
                    treeNodeCircle.removeClass("adore_circle").addClass("adore_mincircle");
                    circleDiv.text("-");
                    circleDiv.removeClass("adore_addcharpan").addClass("adore_mincharpan");
                    arrowSpan.addClass("adore_tree_node_arrow_click");
                }
                else {
                    treeNodeCircle.attr("expand", "false");
                    treeNodeCircle.removeClass("adore_mincircle").addClass("adore_circle");
                    circleDiv.text("+");
                    circleDiv.removeClass("adore_mincharpan").addClass("adore_addcharpan");
                    arrowSpan.removeClass("adore_tree_node_arrow_click");
                }
            }
        };
        TreeItem.prototype.handleClick = function (itemId, $itemNode) {
            this.clickCircle(itemId, $itemNode);
            EventHub_37.EventHub.dispatchEvent(MessageType_38.MessageType.WIDGET, { id: itemId, treeId: this.treeId, evtType: Event_35.Event.CLICK });
        };
        TreeItem.prototype.changeParentStyle = function () {
            var parent = this.parent;
            if (!parent.hadChildren) {
                parent.$thisNode.remove();
                parent.$thisNode = $(TreeItem.TemplateComplex).attr("id", parent.id);
                parent.$attachNode = parent.$thisNode;
                parent.$a = parent.$thisNode.find("a");
                var own_6 = parent;
                var itemId_1 = parent.id;
                parent.$circleNode = parent.$attachNode.find("div.adore_tree_node_circle").first();
                parent.$a.on("click", function (e) {
                    clearTimeout(own_6.timeoutFunc);
                    own_6.timeoutFunc = setTimeout(function () {
                        own_6.handleClick(itemId_1, parent.$attachNode);
                    });
                });
                parent.$a.on("dblclick", function (e) {
                    clearTimeout(own_6.timeoutFunc);
                    own_6.handleDBClick(itemId_1, parent.$attachNode);
                });
                parent.$circleNode.on("click", function (e) {
                    own_6.$a.click();
                });
                parent.$ul = parent.$thisNode.find("ul.collapsible").find("ul");
                parent.hadChildren = true;
                if (parent.text) {
                    parent.setText({ text: parent.text });
                }
                var display = parent.$checkboxNode.css("display");
                parent.$checkboxNode = $(this.parent.$attachNode.find("div").get(2));
                parent.refreshCheckId(this.parent.checkboxId);
                parent.$checkboxNode.css("display", display);
                var tempParent = this.parent;
                var tmpId = this.treeId;
                parent.$checkboxNode.find("input").eq(0).on("click", function (e) {
                    tempParent.refreshCheckState();
                    EventHub_37.EventHub.dispatchEvent(MessageType_38.MessageType.WIDGET, {
                        id: tmpId,
                        evtType: Event_35.Event.ON_CHANGE,
                        cid: own_6.id,
                        checked: tempParent.$checkboxNode.find("input").eq(0).prop("checked")
                    });
                });
                if (this.parent.parent) {
                    if (this.parent.parent instanceof Tree_1.Tree) {
                        this.parent.$thisNode.appendTo(this.parent.parent.$attachNode);
                    }
                    else if (this.parent.parent instanceof TreeItem) {
                        var $liChildNodes = this.parent.parent.$ul.children("li");
                        var size = $liChildNodes.length;
                        var index = this.parent.parent.children.indexOf(this.parent);
                        if (index < size) {
                            this.parent.$thisNode.insertBefore($liChildNodes.eq(index));
                        }
                        else {
                            this.parent.$thisNode.appendTo(this.parent.parent.$ul);
                        }
                    }
                }
                else {
                    this.parent.$thisNode.appendTo(document.body);
                }
            }
        };
        TreeItem.prototype.append = function () {
            if (this.parent) {
                if (this.parent.isTreeItem) {
                    this.changeParentStyle();
                    this.$thisNode.appendTo(this.parent.$ul);
                }
                else {
                    this.$thisNode.appendTo(this.parent.$attachNode);
                }
            }
            else {
                this.$thisNode.appendTo(document.body);
            }
        };
        TreeItem.prototype.setText = function (args) {
            this.text = args.text;
            this.$a.find("span").first().text(this.text);
        };
        TreeItem.prototype.setCheckboxId = function (args) {
            this.checkboxId = args.checkboxId;
            this.refreshCheckId(this.checkboxId);
        };
        TreeItem.prototype.refreshCheckId = function (checkboxId) {
            this.$checkboxNode.find("input").attr("id", checkboxId);
            this.$checkboxNode.find("label").attr("for", checkboxId);
        };
        TreeItem.prototype.viewCheckbox = function (args) {
            this.refreshViewCheckbox(args.viewCheckbox);
        };
        TreeItem.prototype.refreshViewCheckbox = function (viewCheckbox) {
            if (viewCheckbox) {
                this.$checkboxNode.css("display", "block");
            }
            else {
                this.$checkboxNode.css("display", "none");
            }
        };
        TreeItem.prototype.refreshCheckState = function () {
            var $checkbox = this.$checkboxNode.find("input").eq(0);
            var checked = $checkbox.prop("checked");
            this.$attachNode.find("input").prop("checked", checked);
            this.$attachNode.find("input").prop("indeterminate", false);
            var father = this.parent;
            while (father && father instanceof TreeItem) {
                var state = -1;
                var $checkboxes = father.$attachNode.find("input");
                var checkboxSize = $checkboxes.length;
                for (var i = 1; i < checkboxSize; i++) {
                    var checkedTmp = $checkboxes.eq(i).prop("checked");
                    if (checkedTmp) {
                        if (state == -1) {
                            state = 0;
                        }
                        else if (state != 0) {
                            state = 2;
                            break;
                        }
                    }
                    else {
                        if (state == -1) {
                            state = 1;
                        }
                        else if (state != 1) {
                            state = 2;
                            break;
                        }
                    }
                }
                var $checoboxTmp = father.$attachNode.find("input").eq(0);
                if (state == 0) {
                    $checoboxTmp.prop("checked", true);
                    $checoboxTmp.prop("indeterminate", false);
                }
                else if (state == 1) {
                    $checoboxTmp.prop("checked", false);
                    $checoboxTmp.prop("indeterminate", false);
                }
                else {
                    $checoboxTmp.prop("checked", false);
                    $checoboxTmp.prop("indeterminate", true);
                }
                father = father.parent;
            }
        };
        TreeItem.prototype.setCheckboxState = function (checkboxState) {
            this.$checkboxNode.find("input").eq(0).prop("checked", checkboxState);
            this.$checkboxNode.find("input").eq(0).prop("indeterminate", false);
        };
        TreeItem.prototype.needRedForground = function (args) {
            var needRedForground = args.needRedForground;
            if (needRedForground) {
                this.$a.css("color", "red");
            }
            else {
                this.$a.css("color", "#444");
            }
        };
        TreeItem.TemplateNormal = "\n        <li class=\"bold adore_tree\" >\n            <div class=\"adore_tree_node_checkbox_simple\">\t\n                <input type=\"checkbox\" class=\"filled-in\">\t\n                <label style=\"font-size: 0;line-height: 16px;\"></label>\n            </div>\n            <a href=\"#\" class=\"waves-effect adore_tree_a adore_tree_simple_a\">\n                <span></span>\n            </a>\n        </li>";
        TreeItem.TemplateComplex = "\n        <li class=\"no-padding adore_tree\">\n            <ul class=\"collapsible collapsible-accordion adore_tree\">\n                <li class=\"bold adore_tree\">\n\n                    <div class=\"adore_tree_node_circle adore_circle waves-effect\" expand=\"false\"><div class=\"adore_addcharpan\">+</div></div>\n\n                    <div class=\"adore_tree_node_checkbox_complex\">\n                        <input type=\"checkbox\" class=\"filled-in\">\n                        <label style=\"font-size: 0;line-height: 16px;\"></label>\n                    </div>\n                    \n                    <a class=\"collapsible-header waves-effect adore_tree_a adore_tree_complex_a\">\n                        <span></span>\n                        <span class=\"adore_tree_node_arrow\">></span>\n                    </a>\n\n                    <div class=\"collapsible-body adore_tree adore_tree_ul_div\">\n                        <ul>\n\n                        </ul>\n                    </div>\n                </li>\n            </ul>\n        </li>";
        return TreeItem;
    }(Composite_12.Composite));
    exports.TreeItem = TreeItem;
});
define("widget/tree/Tree", ["require", "exports", "widget/Composite", "util/WidgetManager"], function (require, exports, Composite_13, WidgetManager_6) {
    "use strict";
    var Tree = (function (_super) {
        __extends(Tree, _super);
        function Tree(parentId, id, style) {
            _super.call(this, parentId, id, style);
            this.children = new Array();
            this.candragAndDrop = false;
            this.indrag = false;
            this.children = new Array();
            this.$thisNode = $(Tree.TemplateNormal).attr("id", this.id);
            this.$attachNode = this.$thisNode.find("ul");
            this.treeId = this.id;
            var own = this;
            this.$thisNode.find("ul").on("focus", function (e) {
                console.log("tree focus in");
                own.sendFocusGain();
            }).on("blur", function (e) {
            });
        }
        Tree.prototype.addChild = function (child) {
            this.children.push(child);
        };
        Tree.prototype.removeItem = function (args) {
            var itemId = args.itemId;
            if (itemId != null) {
                this.$delectNode = this.$thisNode.find("#" + itemId);
                this.$delectNode.remove();
            }
        };
        Tree.prototype.dragAndDrop = function (args) {
            this.candragAndDrop = args.candragAndDrop;
            if (this.candragAndDrop === true) {
                this.initTree(this.treeId);
            }
        };
        Tree.prototype.initTree = function (id) {
            var root = document.getElementById(id);
            if (root === null) {
                return false;
            }
            this.initEv();
        };
        Tree.prototype.initEv = function () {
            var own = this;
        };
        Tree.prototype.layout = function () {
        };
        Tree.prototype.viewCheckbox = function (args) {
            var viewCheckbox = args.viewCheckbox;
            var $checkboxNodes = this.$attachNode.find("div input:checkbox").parent();
            if (viewCheckbox) {
                $checkboxNodes.css("display", "block");
            }
            else {
                $checkboxNodes.css("display", "none");
            }
        };
        Tree.prototype.setCheckBoxState = function (args) {
            var stateData = JSON.parse(args.checkBoxState);
            var z = this.$attachNode.find("label").length;
            for (var key in stateData) {
                var treeItem = WidgetManager_6.WidgetManager.byId(key);
                if (treeItem) {
                    var checked = treeItem.$checkboxNode.find("input:checkbox").eq(0).prop("checked");
                    if (checked !== stateData[key]) {
                        treeItem.setCheckboxState(stateData[key]);
                        treeItem.refreshCheckState();
                    }
                }
            }
        };
        Tree.prototype.changeLeafLocation = function (args) {
            var treeItem = WidgetManager_6.WidgetManager.byId(args.treeItemId);
            var index = args.index;
            var size = treeItem.parent.children.length;
            if (index < 0 || index >= size) {
                index = size - 1;
            }
            var treeItemIndex = treeItem.parent.children.indexOf(treeItem);
            if (treeItemIndex === index) {
                return;
            }
            var afterTreeItem = treeItem.$attachNode.siblings().eq(args.index);
            treeItem.$attachNode.detach();
            treeItem.$attachNode.insertBefore(afterTreeItem);
        };
        Tree.prototype.moveNode = function (args) {
            var currentItem = WidgetManager_6.WidgetManager.byId(args.currentNodeId);
            currentItem.$attachNode.detach();
            if (currentItem.parent) {
                var index = currentItem.parent.children.indexOf(currentItem);
                currentItem.parent.children.splice(index, 1);
            }
            var targetItem = WidgetManager_6.WidgetManager.byId(args.targetNodeId);
            currentItem.parent = targetItem;
            targetItem.children.push(currentItem);
            currentItem.append();
            if (currentItem.parent) {
                var treeNode = currentItem.parent.$attachNode.find(".collapsible");
                if (treeNode) {
                    treeNode.collapsible();
                }
            }
        };
        Tree.prototype.sendFocusGain = function () {
            _super.prototype.sendFocusGain.call(this);
        };
        Tree.prototype.setFocus = function () {
            this.sendFocusGain();
        };
        Tree.TemplateNormal = "\n        <div style=\"overflow:auto;\">\n            <ul tabindex=\"-1\" class=\"side-nav adore_tree adore_root_tree\" style=\"left:0px;width:100%; position: inherit;webkit-box-shadow:none;box-shadow:none;transform:none;\">\n            </ul>\n        </div>";
        return Tree;
    }(Composite_13.Composite));
    exports.Tree = Tree;
});
define("widget/Video", ["require", "exports", "widget/Widget"], function (require, exports, Widget_42) {
    "use strict";
    var Video = (function (_super) {
        __extends(Video, _super);
        function Video(parentId, id, style) {
            _super.call(this, parentId, id, style);
            this.autoplay = false;
            this.$thisNode = $(Video.template).attr({ id: this.id });
            this.$videoNode = this.$thisNode.find("video").attr("id", this.id + "-content");
            this.videoElement = this.$videoNode.get(0);
            this.sourceElement = this.$thisNode.find("source")[0];
            var own = this;
            this.resizeListener = function () {
                own.refreshVideoWidth();
            };
            $(window).on("resize", this.resizeListener);
        }
        Video.prototype.playVideo = function () {
            this.videoElement.play();
        };
        Video.prototype.pauseVideo = function () {
            this.videoElement.pause();
        };
        Video.prototype.setVideoPath = function (args) {
            if (!args.path) {
                return;
            }
            var type = "ogg";
            var index = args.path.lastIndexOf(".");
            if (index !== -1) {
                type = args.path.substring(index + 1, args.path.length);
            }
            this.sourceElement.type = "video/" + type;
            this.sourceElement.src = args.path;
            this.videoElement.load();
            this.refreshVideoWidth();
        };
        Video.prototype.setAutoPlay = function (args) {
            if (args.autoPlay) {
                this.$videoNode.attr("autoplay", "autoplay");
            }
            else {
                this.$videoNode.removeAttr("autoplay");
            }
        };
        Video.prototype.postLayout = function () {
            _super.prototype.postLayout.call(this);
            this.refreshVideoWidth();
        };
        Video.prototype.refreshVideoWidth = function () {
            var w = this.$thisNode.css("width");
            if (w.indexOf("px") !== -1 || w.indexOf("%") !== -1 || w.indexOf("rem") !== -1) {
                this.$videoNode.css("width", w);
            }
            else {
                this.$videoNode.css("width", w + "px");
            }
        };
        Video.prototype.dispose = function () {
            $(window).off("resize", this.resizeListener);
            _super.prototype.dispose.call(this);
        };
        Video.template = "\n    <div>\n       <video controls=\"controls\">\n         <source>\n       </video>\n    </div>\n    ";
        return Video;
    }(Widget_42.Widget));
    exports.Video = Video;
});
define("widget/Wizard", ["require", "exports", "widget/Widget", "ADORE"], function (require, exports, Widget_43, ADORE_13) {
    "use strict";
    var Wizard = (function (_super) {
        __extends(Wizard, _super);
        function Wizard(parentId, id, style) {
            _super.call(this, parentId, id, style);
            this.$thisNode = $(Wizard.mainTemplate).attr("id", this.id);
            if (style === ADORE_13.ADORE.Normal) {
                this.setAllBlocks = this.setAllCircleBlocks;
                this.$thisNode.css({
                    "background-color": Wizard.NORMAL_STYLE_COLOR
                });
            }
            else if (style === ADORE_13.ADORE.Arrow) {
                this.setAllBlocks = this.setAllArrowBlocks;
                this.$thisNode.css({
                    "background-color": Wizard.ARROR_STYLE_COLOR
                });
            }
        }
        Wizard.prototype.setAllCircleBlocks = function (args) {
            var bs = args.blockStates;
            this.$thisNode.children().remove();
            for (var index = 1; index <= bs.length; index++) {
                var $blockNode = $(Wizard.circleBlockTemplate);
                var $outCircleNode = $blockNode.find(".wizard_CT_outCircle");
                var $circleTextNode = $blockNode.find(".wizard_CT_circleText");
                var $textNode = $blockNode.find(".wizard_CT_text");
                this.changeState($outCircleNode, bs[index - 1].state);
                $circleTextNode.html(index.toString());
                $textNode.html(bs[index - 1].text);
                this.$thisNode.append($blockNode);
            }
        };
        Wizard.prototype.setAllArrowBlocks = function (args) {
            var bs = args.blockStates;
            this.$thisNode.children().remove();
            for (var index = 1; index <= bs.length; index++) {
                var $blockNode = $(Wizard.arrowBlockTemplate);
                var $textNode = $blockNode.find(".wizard_AT_text_part");
                this.changeState($blockNode, bs[index - 1].state);
                $textNode.html(bs[index - 1].text);
                this.$thisNode.append($blockNode);
            }
        };
        Wizard.prototype.changeState = function ($node, state) {
            var own = this;
            if ($node.children().length > 0) {
                $node.removeClass("finished").removeClass("handling").
                    removeClass("unreached").removeClass("unreachable").addClass(state);
                $node.children().each(function (index, e) {
                    own.changeState($(e), state);
                });
            }
            else {
                $node.removeClass("finished").removeClass("handling").
                    removeClass("unreached").removeClass("unreachable").addClass(state);
            }
        };
        Wizard.NORMAL_STYLE_COLOR = "#57668E";
        Wizard.ARROR_STYLE_COLOR = "#E4DEDE";
        Wizard.mainTemplate = "\n     <div class=\"wizard\"></div>\n    ";
        Wizard.circleBlockTemplate = "\n     <div class=\"wizard_CT_block\">\n        <div class=\"wizard_CT_line_block\">\n            <hr class=\"wizard_CT_left_line\"/>\n        </div>\n        <div class=\"wizard_CT_index_block\">\n            <div class=\"wizard_CT_outCircle unreached\">\n                <div class=\"wizard_CT_inCircle unreached\">\n                    <span class=\"wizard_CT_circleText unreached\">1</span>\n\n                    <div class=\"wizard_CT_left_tick unreached\"></div>\n                    <div class=\"wizard_CT_right_tick unreached\"></div>\n                </div>\n            </div>\n        </div>\n        <div class=\"wizard_CT_line_block\">\n            <hr class=\"wizard_CT_right_line\"/>\n        </div>\n        <div class=\"wizard_CT_text_block\">\n            <span class=\"wizard_CT_text\"></span>\n        </div>\n    </div>\n    ";
        Wizard.arrowBlockTemplate = "\n    <div class=\"wizard_AT_block\">\n        <div class=\"wizard_AT_left_part unreached\"></div>\n        <div class=\"wizard_AT_center_block unreached\">\n              <span class=\"wizard_AT_text_part unreached\"></span>\n        </div>\n        <div class=\"wizard_AT_right_part unreached\"></div>\n    </div>\n    ";
        return Wizard;
    }(Widget_43.Widget));
    exports.Wizard = Wizard;
});
//# sourceMappingURL=adore.js.map