(function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
'use strict';

/****************************************************************************
 Copyright (c) 2018 Xiamen Yaji Software Co., Ltd.

 http://www.cocos.com

 Permission is hereby granted, free of charge, to any person obtaining a copy
 of this software and associated engine source code (the "Software"), a limited,
  worldwide, royalty-free, non-assignable, revocable and non-exclusive license
 to use Cocos Creator solely to develop games on your target platforms. You shall
  not use Cocos Creator software for developing other software or tools that's
  used for developing games. You are not granted to publish, distribute,
  sublicense, and/or sell copies of Cocos Creator.

 The software or tools in this License Agreement are licensed, not sold.
 Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.

 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 THE SOFTWARE.
 ****************************************************************************/
require('./rt-feature-premut-alpha.js');
require('./rt-sys.js');
require('./rt_input.js');
require('./rt-loadSubpackage.js');
require('./rt-game.js');
require('./rt-jsb.js');
require('./rt-websocket.js');

require('./jsb-node.js');
require('./jsb-audio.js');
require('./jsb-loader.js');
require('./jsb-editbox.js');

},{"./jsb-audio.js":2,"./jsb-editbox.js":3,"./jsb-loader.js":5,"./jsb-node.js":6,"./rt-feature-premut-alpha.js":7,"./rt-game.js":8,"./rt-jsb.js":9,"./rt-loadSubpackage.js":10,"./rt-sys.js":11,"./rt-websocket.js":12,"./rt_input.js":13}],2:[function(require,module,exports){
/****************************************************************************
 Copyright (c) 2013-2016 Chukong Technologies Inc.
 Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.

 http://www.cocos.com

 Permission is hereby granted, free of charge, to any person obtaining a copy
 of this software and associated engine source code (the "Software"), a limited,
 worldwide, royalty-free, non-assignable, revocable and  non-exclusive license
 to use Cocos Creator solely to develop games on your target platforms. You shall
 not use Cocos Creator software for developing other software or tools that's
 used for developing games. You are not granted to publish, distribute,
 sublicense, and/or sell copies of Cocos Creator.

 The software or tools in this License Agreement are licensed, not sold.
 Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.

 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 THE SOFTWARE.
 ****************************************************************************/
'use strict';

cc.Audio = function (src) {
    this.src = src;
    this.volume = 1;
    this.loop = false;
    this.id = -1;
};

var rt = loadRuntime();
jsb.AudioEngine = rt.AudioEngine;

(function (proto, audioEngine) {
    // Using the new audioEngine
    cc.audioEngine = audioEngine;

    audioEngine.setMaxWebAudioSize = function () {};

    cc.Audio.State = audioEngine.AudioState;

    var handleVolume = function handleVolume(volume) {
        if (volume === undefined) {
            // set default volume as 1
            volume = 1;
        } else if (typeof volume === 'string') {
            volume = Number.parseFloat(volume);
        }
        return volume;
    };

    proto.play = function () {
        audioEngine.stop(this.id);
        var clip = this.src;

        if (clip.loaded) {
            this.id = audioEngine.play2d(clip._nativeAsset, this.loop, this.volume);
        } else {
            var self = this;
            cc.loader.load({
                url: clip.nativeUrl,
                // For audio, we should skip loader otherwise it will load a new audioClip.
                skips: ['Loader']
            }, function (err, audioNativeAsset) {
                if (err) {
                    cc.error(err);
                    return;
                }

                if (!clip.loaded) {
                    clip._nativeAsset = audioNativeAsset;
                    self.id = audioEngine.play2d(audioNativeAsset, self.loop, self.volume);
                }
            });
        }
    };

    proto.pause = function () {
        audioEngine.pause(this.id);
    };

    proto.resume = function () {
        audioEngine.resume(this.id);
    };

    proto.stop = function () {
        audioEngine.stop(this.id);
    };

    proto.destroy = function () {};

    proto.setLoop = function (loop) {
        this.loop = loop;
        audioEngine.setLoop(this.id, loop);
    };

    proto.getLoop = function () {
        return this.loop;
    };

    proto.setVolume = function (volume) {
        volume = handleVolume(volume);
        this.volume = volume;
        return audioEngine.setVolume(this.id, volume);
    };

    proto.getVolume = function () {
        return this.volume;
    };

    proto.setCurrentTime = function (time) {
        audioEngine.setCurrentTime(this.id, time);
    };

    proto.getCurrentTime = function () {
        return audioEngine.getCurrentTime(this.id);
    };

    proto.getDuration = function () {
        return audioEngine.getDuration(this.id);
    };

    proto.getState = function () {
        return audioEngine.getState(this.id);
    };

    // polyfill audioEngine

    var _music = {
        id: -1,
        clip: '',
        loop: false,
        volume: 1
    };
    var _effect = {
        volume: 1
    };

    audioEngine.play = function (clip, loop, volume) {
        if (typeof volume !== 'number') {
            volume = 1;
        }
        if (typeof clip === 'string') {
            // backward compatibility since 1.10
            cc.warnID(8401, 'cc.audioEngine', 'cc.AudioClip', 'AudioClip', 'cc.AudioClip', 'audio');
            var path = clip;
            var md5Pipe = cc.loader.md5Pipe;
            if (md5Pipe) {
                path = md5Pipe.transformURL(path);
            }
            return audioEngine.play2d(path, loop, volume);
        } else {
            if (!clip) {
                return;
            }
            if (clip.loaded) {
                return audioEngine.play2d(clip._nativeAsset, loop, volume);
            } else {
                cc.loader.load({
                    url: clip.nativeUrl,
                    // For audio, we should skip loader otherwise it will load a new audioClip.
                    skips: ['Loader']
                }, function (err, audioNativeAsset) {
                    if (err) {
                        cc.error(err);
                        return;
                    }
                    if (!clip.loaded) {
                        clip._nativeAsset = audioNativeAsset;
                        audioEngine.play2d(audioNativeAsset, loop, volume);
                    }
                });
                // Deffered loading return audioID -1
                return -1;
            }
        }
    };
    audioEngine.playMusic = function (clip, loop) {
        audioEngine.stop(_music.id);
        _music.id = audioEngine.play(clip, loop, _music.volume);
        _music.loop = loop;
        _music.clip = clip;
        return _music.id;
    };
    audioEngine.stopMusic = function () {
        audioEngine.stop(_music.id);
    };
    audioEngine.pauseMusic = function () {
        audioEngine.pause(_music.id);
        return _music.id;
    };
    audioEngine.resumeMusic = function () {
        audioEngine.resume(_music.id);
        return _music.id;
    };
    audioEngine.getMusicVolume = function () {
        return _music.volume;
    };
    audioEngine.setMusicVolume = function (volume) {
        _music.volume = handleVolume(volume);
        audioEngine.setVolume(_music.id, _music.volume);
        return volume;
    };
    audioEngine.isMusicPlaying = function () {
        return audioEngine.getState(_music.id) === audioEngine.AudioState.PLAYING;
    };
    audioEngine.playEffect = function (filePath, loop) {
        return audioEngine.play(filePath, loop || false, _effect.volume);
    };
    audioEngine.setEffectsVolume = function (volume) {
        _effect.volume = handleVolume(volume);
    };
    audioEngine.getEffectsVolume = function () {
        return _effect.volume;
    };
    audioEngine.pauseEffect = function (audioID) {
        return audioEngine.pause(audioID);
    };
    audioEngine.pauseAllEffects = function () {
        var musicPlay = audioEngine.getState(_music.id) === audioEngine.AudioState.PLAYING;
        audioEngine.pauseAll();
        if (musicPlay) {
            audioEngine.resume(_music.id);
        }
    };
    audioEngine.resumeEffect = function (id) {
        audioEngine.resume(id);
    };
    audioEngine.resumeAllEffects = function () {
        var musicPaused = audioEngine.getState(_music.id) === audioEngine.AudioState.PAUSED;
        audioEngine.resumeAll();
        if (musicPaused && audioEngine.getState(_music.id) === audioEngine.AudioState.PLAYING) {
            audioEngine.pause(_music.id);
        }
    };
    audioEngine.stopEffect = function (id) {
        return audioEngine.stop(id);
    };
    audioEngine.stopAllEffects = function () {
        var musicPlaying = audioEngine.getState(_music.id) === audioEngine.AudioState.PLAYING;
        var currentTime = audioEngine.getCurrentTime(_music.id);
        audioEngine.stopAll();
        if (musicPlaying) {
            _music.id = audioEngine.play(_music.clip, _music.loop);
            audioEngine.setCurrentTime(_music.id, currentTime);
        }
    };

    // incompatible implementation for game pause & resume
    audioEngine._break = audioEngine.pauseAll;
    audioEngine._restore = audioEngine.resumeAll;

    // deprecated

    audioEngine._uncache = audioEngine.uncache;
    audioEngine.uncache = function (clip) {
        var path;
        if (typeof clip === 'string') {
            // backward compatibility since 1.10
            cc.warnID(8401, 'cc.audioEngine', 'cc.AudioClip', 'AudioClip', 'cc.AudioClip', 'audio');
            path = clip;
        } else {
            if (!clip) {
                return;
            }
            path = clip._nativeAsset;
        }
        audioEngine._uncache(path);
    };

    audioEngine._preload = audioEngine.preload;
    audioEngine.preload = function (filePath, callback) {
        cc.warn('`cc.audioEngine.preload` is deprecated, use `cc.loader.loadRes(url, cc.AudioClip)` instead please.');
        audioEngine._preload(filePath, callback);
    };
})(cc.Audio.prototype, jsb.AudioEngine);

},{}],3:[function(require,module,exports){
'use strict';

/****************************************************************************
 Copyright (c) 2018 Xiamen Yaji Software Co., Ltd.

 http://www.cocos.com

 Permission is hereby granted, free of charge, to any person obtaining a copy
 of this software and associated engine source code (the "Software"), a limited,
  worldwide, royalty-free, non-assignable, revocable and non-exclusive license
 to use Cocos Creator solely to develop games on your target platforms. You shall
  not use Cocos Creator software for developing other software or tools that's
  used for developing games. You are not granted to publish, distribute,
  sublicense, and/or sell copies of Cocos Creator.

 The software or tools in this License Agreement are licensed, not sold.
 Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.

 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 THE SOFTWARE.
 ****************************************************************************/

(function () {
	if (!(cc && cc.EditBox)) {
		return;
	}

	if (typeof cc.EditBox._EditBoxImpl !== "undefined") {
		//support 2.0.7+ && 2.1.0
		require('./jsb-editbox2.0.js');
		return;
	}

	////support 2.1.1+
	var EditBox = cc.EditBox;
	var js = cc.js;
	var KeyboardReturnType = EditBox.KeyboardReturnType;
	var InputMode = EditBox.InputMode;
	var InputFlag = EditBox.InputFlag;

	function getInputType(type) {
		switch (type) {
			case InputMode.EMAIL_ADDR:
				return 'email';
			case InputMode.NUMERIC:
			case InputMode.DECIMAL:
				return 'number';
			case InputMode.PHONE_NUMBER:
				return 'phone';
			case InputMode.URL:
				return 'url';
			case InputMode.SINGLE_LINE:
			case InputMode.ANY:
			default:
				return 'text';
		}
	}

	function getKeyboardReturnType(type) {
		switch (type) {
			case KeyboardReturnType.DEFAULT:
			case KeyboardReturnType.DONE:
				return 'done';
			case KeyboardReturnType.SEND:
				return 'send';
			case KeyboardReturnType.SEARCH:
				return 'search';
			case KeyboardReturnType.GO:
				return 'go';
			case KeyboardReturnType.NEXT:
				return 'next';
		}
		return 'done';
	}

	function JsbEditBoxImpl() {
		this._delegate = null;
		this._editing = false;
	}

	js.extend(JsbEditBoxImpl, EditBox._ImplClass);
	EditBox._ImplClass = JsbEditBoxImpl;

	Object.assign(JsbEditBoxImpl.prototype, {
		init: function init(delegate) {
			if (!delegate) {
				cc.error('EditBox init failed');
				return;
			}
			this._delegate = delegate;
		},
		setFocus: function setFocus(value) {
			if (value) {
				this.beginEditing();
			} else {
				this.endEditing();
			}
		},
		isFocused: function isFocused() {
			return this._editing;
		},
		beginEditing: function beginEditing() {
			var self = this;
			var delegate = this._delegate;
			var multiline = delegate.inputMode === InputMode.ANY;
			var rect = this._getRect();

			var inputTypeString = getInputType(delegate.inputMode);
			if (delegate.inputFlag === InputFlag.PASSWORD) {
				inputTypeString = 'password';
			}

			function onConfirm(res) {
				delegate.editBoxEditingReturn();
			}

			function onInput(res) {
				if (res.value.length > delegate.maxLength) {
					res.value = res.value.slice(0, delegate.maxLength);
				}
				if (delegate._string !== res.value) {
					delegate.editBoxTextChanged(res.value);
				}
			}

			function onComplete(res) {
				self.endEditing();
				jsb.inputBox.offConfirm(onConfirm);
				jsb.inputBox.offInput(onInput);
				jsb.inputBox.offComplete(onComplete);
			}

			jsb.inputBox.onInput(onInput);
			jsb.inputBox.onConfirm(onConfirm);
			jsb.inputBox.onComplete(onComplete);

			jsb.inputBox.show({
				defaultValue: delegate._string,
				maxLength: delegate.maxLength,
				multiple: multiline,
				confirmHold: false,
				confirmType: getKeyboardReturnType(delegate.returnType),
				inputType: inputTypeString,
				originX: rect.x,
				originY: rect.y,
				width: rect.width,
				height: rect.height
			});
			this._editing = true;
			delegate.editBoxEditingDidBegan();
		},
		endEditing: function endEditing() {
			this._editing = false;
			jsb.inputBox.hide();
			this._delegate.editBoxEditingDidEnded();
		},
		_getRect: function _getRect() {
			var node = this._delegate.node,
			    scaleX = cc.view._scaleX,
			    scaleY = cc.view._scaleY;
			var dpr = cc.view._devicePixelRatio;

			var math = cc.vmath;
			var matrix = math.mat4.create();
			node.getWorldMatrix(matrix);
			var contentSize = node._contentSize;
			var vec3 = cc.v3();
			vec3.x = -node._anchorPoint.x * contentSize.width;
			vec3.y = -node._anchorPoint.y * contentSize.height;

			math.mat4.translate(matrix, matrix, vec3);

			scaleX /= dpr;
			scaleY /= dpr;

			var finalScaleX = matrix.m00 * scaleX;
			var finaleScaleY = matrix.m05 * scaleY;

			return {
				x: matrix.m12 * finalScaleX,
				y: matrix.m13 * finaleScaleY,
				width: contentSize.width * finalScaleX,
				height: contentSize.height * finaleScaleY
			};
		}
	});
})();

},{"./jsb-editbox2.0.js":4}],4:[function(require,module,exports){
'use strict';

/****************************************************************************
 Copyright (c) 2018 Xiamen Yaji Software Co., Ltd.

 http://www.cocos.com

 Permission is hereby granted, free of charge, to any person obtaining a copy
 of this software and associated engine source code (the "Software"), a limited,
  worldwide, royalty-free, non-assignable, revocable and non-exclusive license
 to use Cocos Creator solely to develop games on your target platforms. You shall
  not use Cocos Creator software for developing other software or tools that's
  used for developing games. You are not granted to publish, distribute,
  sublicense, and/or sell copies of Cocos Creator.

 The software or tools in this License Agreement are licensed, not sold.
 Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.

 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 THE SOFTWARE.
 ****************************************************************************/

(function () {
    if (!(cc && cc.EditBox)) {
        return;
    }

    var KeyboardReturnType = cc.EditBox.KeyboardReturnType;
    var InputMode = cc.EditBox.InputMode;
    var InputFlag = cc.EditBox.InputFlag;
    var _p = cc.EditBox._EditBoxImpl.prototype;

    function getInputType(type) {
        switch (type) {
            case InputMode.EMAIL_ADDR:
                return 'email';
            case InputMode.NUMERIC:
            case InputMode.DECIMAL:
                return 'number';
            case InputMode.PHONE_NUMBER:
                return 'phone';
            case InputMode.URL:
                return 'url';
            case InputMode.SINGLE_LINE:
            case InputMode.ANY:
            default:
                return 'text';
        }
    }

    function getKeyboardReturnType(type) {
        switch (type) {
            case KeyboardReturnType.DEFAULT:
            case KeyboardReturnType.DONE:
                return 'done';
            case KeyboardReturnType.SEND:
                return 'send';
            case KeyboardReturnType.SEARCH:
                return 'search';
            case KeyboardReturnType.GO:
                return 'go';
            case KeyboardReturnType.NEXT:
                return 'next';
        }
        return 'done';
    }

    function updateLabelsInvisible(editBox) {
        var placeholderLabel = editBox._placeholderLabel;
        var textLabel = editBox._textLabel;
        var displayText = editBox._impl._text;

        placeholderLabel.node.active = displayText === '';
        textLabel.node.active = displayText !== '';
    }

    cc.EditBox.prototype.editBoxEditingDidBegan = function () {
        cc.Component.EventHandler.emitEvents(this.editingDidBegan, this);
        this.node.emit('editing-did-began', this);
    };

    cc.EditBox.prototype.editBoxEditingDidEnded = function () {
        cc.Component.EventHandler.emitEvents(this.editingDidEnded, this);
        this.node.emit('editing-did-ended', this);
    };

    cc.EditBox.prototype._updateStayOnTop = function () {
        // jsb not support
    };

    _p.createInput = function () {
        var editBoxImpl = this;
        editBoxImpl._editing = true;

        var multiline = this._inputMode === InputMode.ANY;
        var inputTypeString = getInputType(editBoxImpl._inputMode);
        if (editBoxImpl._inputFlag === InputFlag.PASSWORD) inputTypeString = 'password';

        var rect = this._getRect();

        jsb.inputBox.show({
            defaultValue: editBoxImpl._text,
            maxLength: editBoxImpl._maxLength,
            multiple: multiline,
            confirmHold: false,
            confirmType: getKeyboardReturnType(editBoxImpl._returnType),
            inputType: inputTypeString,
            originX: rect.x,
            originY: rect.y,
            width: rect.width,
            height: rect.height
        });
        if (this._delegate) {
            var editBox = this._delegate;
            cc.Component.EventHandler.emitEvents(editBox.editingDidBegan, editBox);
            editBox.node.emit('editing-did-began', editBox);
            updateLabelsInvisible(editBox);
        }

        function onConfirm(res) {
            editBoxImpl._delegate && editBoxImpl._delegate.editBoxEditingReturn && editBoxImpl._delegate.editBoxEditingReturn();
        }
        jsb.inputBox.onConfirm(onConfirm);

        function onInput(res) {
            if (res.value.length > editBoxImpl._maxLength) {
                res.value = res.value.slice(0, editBoxImpl._maxLength);
            }
            if (editBoxImpl._delegate && editBoxImpl._delegate.editBoxTextChanged) {
                if (editBoxImpl._text !== res.value) {
                    editBoxImpl._text = res.value;
                    editBoxImpl._delegate.editBoxTextChanged(editBoxImpl._text);
                }
            }
        }
        jsb.inputBox.onInput(onInput);

        function onComplete(res) {
            editBoxImpl._endEditing();
            jsb.inputBox.offConfirm(onConfirm);
            jsb.inputBox.offInput(onInput);
            jsb.inputBox.offComplete(onComplete);
        }
        jsb.inputBox.onComplete(onComplete);
    };

    _p.setTabIndex = function (index) {
        // jsb not support
    };

    _p.setFocus = function () {
        this._beginEditing();
    };

    _p.isFocused = function () {
        return this._editing;
    }, _p.stayOnTop = function (flag) {
        // jsb not support
    };

    _p._updateMatrix = function () {
        // jsb not support
    };

    _p._updateSize = function (newWidth, newHeight) {
        // jsb not support
    };

    _p._getRect = function () {
        var node = this._node,
            scaleX = cc.view._scaleX,
            scaleY = cc.view._scaleY;
        var dpr = cc.view._devicePixelRatio;

        var math = cc.vmath;
        var matrix = math.mat4.create();
        node.getWorldMatrix(matrix);
        var contentSize = node._contentSize;
        var vec3 = cc.v3();
        vec3.x = -node._anchorPoint.x * contentSize.width;
        vec3.y = -node._anchorPoint.y * contentSize.height;

        math.mat4.translate(matrix, matrix, vec3);

        scaleX /= dpr;
        scaleY /= dpr;

        var finalScaleX = matrix.m00 * scaleX;
        var finaleScaleY = matrix.m05 * scaleY;

        return {
            x: matrix.m12 * finalScaleX,
            y: matrix.m13 * finaleScaleY,
            width: contentSize.width * finalScaleX,
            height: contentSize.height * finaleScaleY
        };
    };

    _p.setMaxLength = function (maxLength) {
        if (!isNaN(maxLength)) {
            if (maxLength < 0) {
                //we can't set Number.MAX_VALUE to input's maxLength property
                //so we use a magic number here, it should works at most use cases.
                maxLength = 65535;
            }
            this._maxLength = maxLength;
        }
    };

    _p.setString = function (text) {
        this._text = text;
        this._updateInput();
        updateLabelsInvisible(this._delegate);
    };

    _p._updateInput = function () {
        var tmpText = this._text;
        if (this._inputFlag === InputFlag.PASSWORD) {
            tmpText = tmpText.replace(/./g, '*');
        }
        this._delegate._textLabel.string = tmpText;
    };

    _p.setFontSize = function (fontSize) {
        this._edFontSize = fontSize || this._edFontSize;
        this._delegate._textLabel.fontSize = this._edFontSize;
    };

    _p.setFontColor = function (color) {
        this._textColor = color;
        this._delegate._textLabel.fontColor = this._textColor;
    };

    _p.setInputMode = function (inputMode) {
        this._inputMode = inputMode;
    };

    _p.setInputFlag = function (inputFlag) {
        this._inputFlag = inputFlag;
    };

    _p.setReturnType = function (returnType) {
        this._returnType = returnType;
    };

    _p._beginEditing = function () {
        this.createInput();
    };

    _p._endEditing = function () {
        var self = this;
        if (this._editing) {
            self._endEditingOnMobile();
            if (self._delegate && self._delegate.editBoxEditingDidEnded) {
                self._delegate.editBoxEditingDidEnded();
            }
        }
        this._editing = false;
    };

    _p.clear = function () {
        this._node = null;
        this.setDelegate(null);
    };
})();

},{}],5:[function(require,module,exports){
/****************************************************************************
 Copyright (c) 2013-2016 Chukong Technologies Inc.
 Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.

 http://www.cocos.com

 Permission is hereby granted, free of charge, to any person obtaining a copy
 of this software and associated engine source code (the "Software"), a limited,
  worldwide, royalty-free, non-assignable, revocable and  non-exclusive license
 to use Cocos Creator solely to develop games on your target platforms. You shall
  not use Cocos Creator software for developing other software or tools that's
  used for developing games. You are not granted to publish, distribute,
  sublicense, and/or sell copies of Cocos Creator.

 The software or tools in this License Agreement are licensed, not sold.
 Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.

 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 THE SOFTWARE.
 ****************************************************************************/
'use strict';

function downloadScript(item, callback) {
    require(item.url);
    return null;
}

function downloadAudio(item) {
    return item.url;
}

function loadAudio(item, callback) {
    var loadByDeserializedAsset = item._owner instanceof cc.AudioClip;
    if (loadByDeserializedAsset) {
        return item.url;
    } else {
        var audioClip = new cc.AudioClip();
        // obtain user url through nativeUrl
        audioClip._setRawAsset(item.rawUrl, false);
        // obtain download url through _nativeAsset
        audioClip._nativeAsset = item.url;
        return audioClip;
    }
}

function downloadImage(item, callback) {
    var img = new Image();
    img.src = item.url;
    img.onload = function (info) {
        callback(null, img);
    };
    // Don't return anything to use async loading.
}

function _getFontFamily(fontHandle) {
    var ttfIndex = fontHandle.lastIndexOf(".ttf");
    if (ttfIndex === -1) return fontHandle;

    var slashPos = fontHandle.lastIndexOf("/");
    var fontFamilyName;
    if (slashPos === -1) {
        fontFamilyName = fontHandle.substring(0, ttfIndex) + "_LABEL";
    } else {
        fontFamilyName = fontHandle.substring(slashPos + 1, ttfIndex) + "_LABEL";
    }
    if (fontFamilyName.indexOf(' ') !== -1) {
        fontFamilyName = '"' + fontFamilyName + '"';
    }
    return fontFamilyName;
}

var downloadBinary = void 0,
    downloadText = void 0,
    loadFont = void 0;
downloadText = function downloadText(item) {
    var url = item.url;

    var result = jsb.fileUtils.getStringFromFile(url);
    if (typeof result === 'string' && result) {
        return result;
    } else {
        return new Error('Download text failed: ' + url);
    }
};

downloadBinary = function downloadBinary(item) {
    var url = item.url;

    var result = jsb.fileUtils.getDataFromFile(url);
    if (result) {
        return result;
    } else {
        return new Error('Download binary file failed: ' + url);
    }
};

loadFont = function loadFont(item) {
    var url = item.url;
    var fontFamilyName = _getFontFamily(url);

    // load from local font
    var localPath = "url('" + url + "')";
    jsb.loadFont(fontFamilyName, localPath);
    return fontFamilyName;
};
function loadCompressedTex(item) {
    return item.content;
}

cc.loader.addDownloadHandlers({
    // JS
    'js': downloadScript,
    'jsc': downloadScript,

    // Images
    'png': downloadImage,
    'jpg': downloadImage,
    'bmp': downloadImage,
    'jpeg': downloadImage,
    'gif': downloadImage,
    'ico': downloadImage,
    'tiff': downloadImage,
    'webp': downloadImage,
    'image': downloadImage,
    'pvr': downloadImage,
    'pkm': downloadImage,

    // Audio
    'mp3': downloadAudio,
    'ogg': downloadAudio,
    'wav': downloadAudio,
    'mp4': downloadAudio,
    'm4a': downloadAudio,

    // Text
    'txt': downloadText,
    'xml': downloadText,
    'vsh': downloadText,
    'fsh': downloadText,
    'atlas': downloadText,

    'tmx': downloadText,
    'tsx': downloadText,

    'json': downloadText,
    'ExportJson': downloadText,
    'plist': downloadText,

    'fnt': downloadText,

    'binary': downloadBinary,
    'bin': downloadBinary,
    'dbbin': downloadBinary,

    'default': downloadText
});

cc.loader.addLoadHandlers({
    // Font
    'font': loadFont,
    'eot': loadFont,
    'ttf': loadFont,
    'woff': loadFont,
    'svg': loadFont,
    'ttc': loadFont,

    // Audio
    'mp3': loadAudio,
    'ogg': loadAudio,
    'wav': loadAudio,
    'mp4': loadAudio,
    'm4a': loadAudio,
    // compressed texture
    'pvr': loadCompressedTex,
    'pkm': loadCompressedTex
});

},{}],6:[function(require,module,exports){
/****************************************************************************
 Copyright (c) 2013-2016 Chukong Technologies Inc.
 Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.

 http://www.cocos.com

 Permission is hereby granted, free of charge, to any person obtaining a copy
 of this software and associated engine source code (the "Software"), a limited,
  worldwide, royalty-free, non-assignable, revocable and  non-exclusive license
 to use Cocos Creator solely to develop games on your target platforms. You shall
  not use Cocos Creator software for developing other software or tools that's
  used for developing games. You are not granted to publish, distribute,
  sublicense, and/or sell copies of Cocos Creator.

 The software or tools in this License Agreement are licensed, not sold.
 Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.

 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 THE SOFTWARE.
 ****************************************************************************/
'use strict';

var math = cc.vmath;

var _typedArray_temp = new Float32Array(16);
var _mat4_temp = math.mat4.create();

function _mat4ToArray(typedArray, mat4) {
  typedArray[0] = mat4.m00;
  typedArray[1] = mat4.m01;
  typedArray[2] = mat4.m02;
  typedArray[3] = mat4.m03;
  typedArray[4] = mat4.m04;
  typedArray[5] = mat4.m05;
  typedArray[6] = mat4.m06;
  typedArray[7] = mat4.m07;
  typedArray[8] = mat4.m08;
  typedArray[9] = mat4.m09;
  typedArray[10] = mat4.m10;
  typedArray[11] = mat4.m11;
  typedArray[12] = mat4.m12;
  typedArray[13] = mat4.m13;
  typedArray[14] = mat4.m14;
  typedArray[15] = mat4.m15;
}

cc.Node.prototype.getWorldRTInAB = function () {
  this.getWorldRT(_mat4_temp);
  _mat4ToArray(_typedArray_temp, _mat4_temp);
  return _typedArray_temp;
};

cc.Node.prototype.getWorldMatrixInAB = function () {
  this._updateWorldMatrix();
  _mat4ToArray(_typedArray_temp, this._worldMatrix);
  return _typedArray_temp;
};

},{}],7:[function(require,module,exports){
'use strict';

// Please go to :
// https://github.com/cocos-creator-packages/jsb-adapter/pull/130
// to see more information about function clamp and unpremutAlpha

var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };

var _clamp = function _clamp(value) {
    value = Math.round(value);
    return value < 0 ? 0 : value < 255 ? value : 255;
};

// Because the blend factor is modified to SRC_ALPHA, here must perform unpremult alpha.
var _premultAlpha = function _premultAlpha(data, premult) {
    var alpha = void 0;
    if (premult) {
        for (var i = 0, len = data._data.length; i < len; i += 4) {
            alpha = data._data[i + 3] / 255;
            if (alpha > 0 && alpha < 255) {
                data._data[i + 0] = clamp(data._data[i + 0] * alpha);
                data._data[i + 1] = clamp(data._data[i + 1] * alpha);
                data._data[i + 2] = clamp(data._data[i + 2] * alpha);
            }
        }
    } else {
        for (var _i = 0, _len = data._data.length; _i < _len; _i += 4) {
            alpha = 255 / data._data[_i + 3];
            if (alpha > 0 && alpha < 255) {
                data._data[_i + 0] = _clamp(data._data[_i + 0] * alpha);
                data._data[_i + 1] = _clamp(data._data[_i + 1] * alpha);
                data._data[_i + 2] = _clamp(data._data[_i + 2] * alpha);
            }
        }
    }
};

var _loop = function _loop() {
    var rt = window["qg"];
    if ((typeof rt === "undefined" ? "undefined" : _typeof(rt)) != "object") {
        console.error("not runtime platform");
        return "break";
    }
    if ((typeof cc === "undefined" ? "undefined" : _typeof(cc)) !== "object") {
        console.error("can not get cocos creator version");
        return "break";
    }
    // Judge version，is newer than 2.0.9
    var versionJudge = "2.0.9";
    var engineVersion = cc.ENGINE_VERSION;
    var versionJudgeNum = versionJudge.replace(/[a-zA-Z]/g, function (match, i) {
        return match.charCodeAt();
    }).replace(/[^\d]/g, '') - 0;
    var engineVersionNum = engineVersion.replace(/[a-zA-Z]/g, function (match, i) {
        return match.charCodeAt();
    }).replace(/[^\d]/g, '') - 0;
    var isEngineVersionNew = engineVersionNum >= versionJudgeNum;
    var isRTSupportFeature = typeof rt.getFeature == "function" && typeof rt.setFeature === "function";
    var featureName = "canvas.context2d.premultiply_image_data";

    var shouldPremult = false;
    if (!isEngineVersionNew && !isRTSupportFeature) {
        // old creator old runtime
        return "break";
    }
    if (!isEngineVersionNew) {
        shouldPremult = true;
    }
    if (isRTSupportFeature) {
        rt.setFeature(featureName, shouldPremult);
        if (rt.getFeature(featureName) === shouldPremult) {
            return "break";
        }
    }
    // set feature fail
    var dataDescriptor = Object.getOwnPropertyDescriptor(HTMLCanvasElement.prototype, "_data");
    var dataGetter = void 0;
    // get old getter
    if ((typeof dataDescriptor === "undefined" ? "undefined" : _typeof(dataDescriptor)) === "object") {
        dataGetter = dataDescriptor["get"];
    }
    // delete old runtime version _data property
    delete HTMLCanvasElement.prototype._data;
    var _newDataGetter = function _newDataGetter() {
        var data = void 0;
        if (typeof dataGetter === "function") {
            data = dataGetter.bind(this)();
        } else {
            // old runtime version
            data = this._dataInner;
        }
        if (data === null) {
            return null;
        }
        var premultHandled = data["_premultHandled"];
        if (premultHandled === true) {
            return data;
        }
        _premultAlpha(data, shouldPremult);
        data["_premultHandled"] = true;
        return data;
    };
    Object.defineProperty(HTMLCanvasElement.prototype, "_data", {
        get: _newDataGetter,
        set: function set(params) {
            this._dataInner = params;
        }
    });
};

do {
    var _ret = _loop();

    if (_ret === "break") break;
} while (false);

},{}],8:[function(require,module,exports){
"use strict";

cc.game.restart = function () {
    cc.sys.restartVM();
};

loadRuntime().onHide(function () {
    cc.game.emit(cc.game.EVENT_HIDE);
});

loadRuntime().onShow(function () {
    cc.game.emit(cc.game.EVENT_SHOW);
});

},{}],9:[function(require,module,exports){
/****************************************************************************
 Copyright (c) 2013-2016 Chukong Technologies Inc.
 Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.

 http://www.cocos.com

 Permission is hereby granted, free of charge, to any person obtaining a copy
 of this software and associated engine source code (the "Software"), a limited,
  worldwide, royalty-free, non-assignable, revocable and  non-exclusive license
 to use Cocos Creator solely to develop games on your target platforms. You shall
  not use Cocos Creator software for developing other software or tools that's
  used for developing games. You are not granted to publish, distribute,
  sublicense, and/or sell copies of Cocos Creator.

 The software or tools in this License Agreement are licensed, not sold.
 Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.

 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 THE SOFTWARE.
 ****************************************************************************/
'use strict';

var rt = loadRuntime();
jsb.fileUtils = {
    getStringFromFile: function getStringFromFile(url) {
        var result;
        try {
            result = rt.getFileSystemManager().readFileSync(url, "utf8");
        } catch (error) {
            cc.error(error);
        }
        return result;
    },

    getDataFromFile: function getDataFromFile(url) {
        var result;
        try {
            result = rt.getFileSystemManager().readFileSync(url);
        } catch (error) {
            cc.error(error);
        }
        return result;
    },

    getWritablePath: function getWritablePath() {
        return rt.env.USER_DATA_PATH + "/";
    },

    writeToFile: function writeToFile(map, url) {
        var str = JSON.stringify(map);
        var result = false;
        try {
            rt.getFileSystemManager().writeFileSync(url, str, "utf8");
            result = true;
        } catch (error) {
            cc.error(error);
        }
        return result;
    },

    getValueMapFromFile: function getValueMapFromFile(url) {
        var map_object = {};
        var read;
        try {
            read = rt.getFileSystemManager().readFileSync(url, "utf8");
        } catch (error) {
            cc.error(error);
        }
        if (!read) {
            return map_object;
        }
        map_object = JSON.parse(read);
        return map_object;
    }
};

if (typeof jsb.saveImageData === 'undefined') {
    jsb.saveImageData = function (data, width, height, filePath) {
        var index = filePath.lastIndexOf(".");
        if (index === -1) {
            return false;
        }
        var fileType = filePath.substr(index + 1);
        var tempFilePath = rt.saveImageTempSync({
            'data': data,
            'width': width,
            'height': height,
            'fileType': fileType
        });
        if (tempFilePath === '') {
            return false;
        }
        var savedFilePath = rt.getFileSystemManager().saveFileSync(tempFilePath, filePath);
        if (savedFilePath === filePath) {
            return true;
        }
        return false;
    };
}

if (typeof jsb.setPreferredFramesPerSecond === 'undefined' && typeof rt.setPreferredFramesPerSecond !== 'undefined') {
    jsb.setPreferredFramesPerSecond = rt.setPreferredFramesPerSecond;
} else {
    jsb.setPreferredFramesPerSecond = function () {
        console.error("The jsb.setPreferredFramesPerSecond is not define!");
    };
}

if (jsb.device && !jsb.device.getDeviceMotionValue) {
    var _tempX = 0,
        _tempY = 0,
        _tempZ = 0;

    var _tempGravitySenceArray = undefined;

    jsb.device.setAccelerometerEnabled = function (enabled) {
        if (_tempGravitySenceArray !== undefined === enabled) return;
        if (!enabled) {
            qg.stopAccelerometer();
            _tempX = 0;
            _tempY = 0;
            _tempZ = 0;
            _tempGravitySenceArray = undefined;
            return;
        }
        _tempGravitySenceArray = new Array(6).fill(0);
        qg.onAccelerometerChange(function (obj) {
            _tempGravitySenceArray[3] = 1.25 * obj.x + _tempX;
            _tempGravitySenceArray[4] = 1.25 * obj.y + _tempY;
            _tempGravitySenceArray[5] = 1.25 * obj.z + _tempZ;
            _tempX = 0.8 * _tempX + 0.2 * _tempGravitySenceArray[3];
            _tempY = 0.8 * _tempY + 0.2 * _tempGravitySenceArray[4];
            _tempZ = 0.8 * _tempZ + 0.2 * _tempGravitySenceArray[5];
        });
    };

    jsb.device.getDeviceMotionValue = function () {
        if (_tempGravitySenceArray === undefined) {
            return undefined;
        }
        return _tempGravitySenceArray.slice();
    };
}

},{}],10:[function(require,module,exports){
"use strict";

cc.loader.downloader.loadSubpackage = function (name, completeCallback) {
    var rt = loadRuntime();
    rt.loadSubpackage({
        name: name, //fileName,
        success: function success() {
            if (completeCallback) completeCallback();
        },
        fail: function fail() {
            if (completeCallback) completeCallback(new Error("Failed to load subpackage " + name));
        }
    });
};

if (cc.Pipeline.SubPackPipe && cc.Pipeline.SubPackPipe.prototype && cc.Pipeline.SubPackPipe.prototype.transformURL) {
    var _tempTransformUrl = cc.Pipeline.SubPackPipe.prototype.transformURL;
    cc.Pipeline.SubPackPipe.prototype.transformURL = function (url) {
        var url = _tempTransformUrl(url);
        return url.replace("subpackages/", "");
    };
}

},{}],11:[function(require,module,exports){
/****************************************************************************
 Copyright (c) 2013-2016 Chukong Technologies Inc.
 Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.

 http://www.cocos.com

 Permission is hereby granted, free of charge, to any person obtaining a copy
 of this software and associated engine source code (the "Software"), a limited,
  worldwide, royalty-free, non-assignable, revocable and  non-exclusive license
 to use Cocos Creator solely to develop games on your target platforms. You shall
  not use Cocos Creator software for developing other software or tools that's
  used for developing games. You are not granted to publish, distribute,
  sublicense, and/or sell copies of Cocos Creator.

 The software or tools in this License Agreement are licensed, not sold.
 Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.

 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 THE SOFTWARE.
 ****************************************************************************/
'use strict';

var sys = cc.sys;

if (typeof loadRuntime === 'function') {
    var rt = loadRuntime();
    sys.getNetworkType = rt.getNetworkType;
    sys.getBatteryLevel = rt.getBatteryLevel;
    sys.garbageCollect = rt.triggerGC;
}
if (typeof __restartVM !== 'undefined') {
    sys.restartVM = __restartVM;
} else {
    sys.restartVM = function () {
        console.error("The restartVM is not define!");
    };
}
if (typeof __isObjectValid !== 'undefined') {
    sys.isObjectValid = __isObjectValid;
} else {
    sys.isObjectValid = function () {
        console.error("The sys.isObjectValid is not define!");
    };
}

},{}],12:[function(require,module,exports){
"use strict";

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }

var RTWebSocket = function (_window$WebSocket) {
    _inherits(RTWebSocket, _window$WebSocket);

    function RTWebSocket(wss, protocols, certificatePath) {
        _classCallCheck(this, RTWebSocket);

        do {
            if (typeof certificatePath !== 'string') {
                break;
            }

            //md5
            var md5Pipe = cc.loader.md5Pipe;
            if (md5Pipe) {
                certificatePath = md5Pipe.transformURL(certificatePath);
            }

            // tiny package
            if (typeof window.rtAdapter === "undefined" || typeof window.rtAdapter.REMOTE_SERVER_ROOT === "undefined") {
                break;
            }
            var cachedPath = rtAdapter.getCacheName(certificatePath);
            var url = rtAdapter.cacheDir + '/' + cachedPath;
            try {
                qg.getFileSystemManager().accessSync(url);
            } catch (error) {
                console.warn("use default certificate .certificatePath is not exist in: ", url);
                certificatePath = undefined;
                break;
            }
            certificatePath = url;
        } while (0);
        return _possibleConstructorReturn(this, (RTWebSocket.__proto__ || Object.getPrototypeOf(RTWebSocket)).call(this, wss, protocols, certificatePath));
    }

    return RTWebSocket;
}(window.WebSocket);

delete window.WebSocket;
window.WebSocket = RTWebSocket;
delete window.RTWebSocket;

},{}],13:[function(require,module,exports){
"use strict";

/****************************************************************************
 Copyright (c) 2018 Xiamen Yaji Software Co., Ltd.

 http://www.cocos.com

 Permission is hereby granted, free of charge, to any person obtaining a copy
 of this software and associated engine source code (the "Software"), a limited,
  worldwide, royalty-free, non-assignable, revocable and non-exclusive license
 to use Cocos Creator solely to develop games on your target platforms. You shall
  not use Cocos Creator software for developing other software or tools that's
  used for developing games. You are not granted to publish, distribute,
  sublicense, and/or sell copies of Cocos Creator.

 The software or tools in this License Agreement are licensed, not sold.
 Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.

 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 THE SOFTWARE.
 ****************************************************************************/
var rt = loadRuntime();

jsb.inputBox = {
  onConfirm: function onConfirm(cb) {
    rt.onKeyboardConfirm(cb);
  },
  offConfirm: function offConfirm(cb) {
    rt.offKeyboardConfirm(cb);
  },

  onComplete: function onComplete(cb) {
    rt.onKeyboardComplete(cb);
  },
  offComplete: function offComplete(cb) {
    rt.offKeyboardComplete(cb);
  },

  onInput: function onInput(cb) {
    rt.onKeyboardInput(cb);
  },
  offInput: function offInput(cb) {
    rt.offKeyboardInput(cb);
  },

  /**
   * @param {string}		options.defaultValue
   * @param {number}		options.maxLength
   * @param {bool}        options.multiple
   * @param {bool}        options.confirmHold
   * @param {string}      options.confirmType
   * @param {string}      options.inputType
   * 
   * Values of options.confirmType can be [done|next|search|go|send].
   * Values of options.inputType can be [text|email|number|phone|password].
   */
  show: function show(options) {
    rt.showKeyboard(options);
  },
  hide: function hide() {
    rt.hideKeyboard();
  }
};

},{}]},{},[1]);
