yoichiro/chrome_mysql_admin

View on GitHub
app/scripts/lib/mysql_js_driver_2.1.0.min.js

Summary

Maintainability
A
0 mins
Test Coverage
/*! MySQL JavaScript Driver 2.1.0 Copyright (c) 2019 Yoichiro Tanaka. Apache License Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0) */

!function(){"use strict";var t={};"undefined"==typeof module?window.MySQL=t:module.exports=t}(),function(){"use strict";var t=function(){this.errorCodeMap={"-1":"IO_PENDING","-2":"FAILED","-3":"ABORTED","-4":"INVALID_ARGUMENT","-5":"INVALID_HANDLE","-6":"FILE_NOT_FOUND","-7":"TIMED_OUT","-8":"FILE_TOO_BIG","-9":"UNEXPECTED","-10":"ACCESS_DENIED","-11":"NOT_IMPLEMENTED","-12":"INSUFFICIENT_RESOURCES","-13":"OUT_OF_MEMORY","-14":"UPLOAD_FILE_CHANGED","-15":"SOCKET_NOT_CONNECTED","-16":"FILE_EXISTS","-17":"FILE_PATH_TOO_LONG","-18":"FILE_NO_SPACE","-19":"FILE_VIRUS_INFECTED","-20":"BLOCKED_BY_CLIENT","-21":"NETWORK_CHANGED","-22":"BLOCKED_BY_ADMINISTRATOR","-23":"SOCKET_IS_CONNECTED","-100":"CONNECTION_CLOSED","-101":"CONNECTION_RESET","-102":"CONNECTION_REFUSED","-103":"CONNECTION_ABORTED","-104":"CONNECTION_FAILED","-105":"NAME_NOT_RESOLVED","-106":"INTERNET_DISCONNECTED","-107":"SSL_PROTOCOL_ERROR","-108":"ADDRESS_INVALID","-109":"ADDRESS_UNREACHABLE","-110":"SSL_CLIENT_AUTH_CERT_NEEDED","-111":"TUNNEL_CONNECTION_FAILED","-112":"NO_SSL_VERSIONS_ENABLED","-113":"SSL_VERSION_OR_CIPHER_MISMATCH","-114":"SSL_RENEGOTIATION_REQUESTED","-115":"PROXY_AUTH_UNSUPPORTED","-116":"CERT_ERROR_IN_SSL_RENEGOTIATION","-117":"BAD_SSL_CLIENT_AUTH_CERT","-118":"CONNECTION_TIMED_OUT","-119":"HOST_RESOLVER_QUEUE_TOO_LARGE","-120":"SOCKS_CONNECTION_FAILED","-121":"SOCKS_CONNECTION_HOST_UNREACHABLE","-122":"NPN_NEGOTIATION_FAILED","-123":"SSL_NO_RENEGOTIATION","-124":"WINSOCK_UNEXPECTED_WRITTEN_BYTES","-125":"SSL_DECOMPRESSION_FAILURE_ALERT","-126":"SSL_BAD_RECORD_MAC_ALERT","-127":"PROXY_AUTH_REQUESTED","-128":"SSL_UNSAFE_NEGOTIATION","-129":"SSL_WEAK_SERVER_EPHEMERAL_DH_KEY","-130":"PROXY_CONNECTION_FAILED","-131":"MANDATORY_PROXY_CONFIGURATION_FAILED","-133":"PRECONNECT_MAX_SOCKET_LIMIT","-134":"SSL_CLIENT_AUTH_PRIVATE_KEY_ACCESS_DENIED","-135":"SSL_CLIENT_AUTH_CERT_NO_PRIVATE_KEY","-136":"PROXY_CERTIFICATE_INVALID","-137":"NAME_RESOLUTION_FAILED","-138":"NETWORK_ACCESS_DENIED","-139":"TEMPORARILY_THROTTLED","-140":"HTTPS_PROXY_TUNNEL_RESPONSE","-141":"SSL_CLIENT_AUTH_SIGNATURE_FAILED","-142":"MSG_TOO_BIG","-143":"SPDY_SESSION_ALREADY_EXISTS","-145":"WS_PROTOCOL_ERROR","-146":"PROTOCOL_SWITCHED","-147":"ADDRESS_IN_USE","-148":"SSL_HANDSHAKE_NOT_COMPLETED","-149":"SSL_BAD_PEER_PUBLIC_KEY","-150":"SSL_PINNED_KEY_NOT_IN_CERT_CHAIN","-151":"CLIENT_AUTH_CERT_TYPE_UNSUPPORTED","-152":"ORIGIN_BOUND_CERT_GENERATION_TYPE_MISMATCH","-153":"SSL_DECRYPT_ERROR_ALERT","-154":"WS_THROTTLE_QUEUE_TOO_LARGE","-155":"TOO_MANY_SOCKET_STREAMS","-156":"SSL_SERVER_CERT_CHANGED","-157":"SSL_INAPPROPRIATE_FALLBACK","-158":"CT_NO_SCTS_VERIFIED_OK","-159":"SSL_UNRECOGNIZED_NAME_ALERT","-200":"CERT_COMMON_NAME_INVALID","-201":"CERT_DATE_INVALID","-202":"CERT_AUTHORITY_INVALID","-203":"CERT_CONTAINS_ERRORS","-204":"CERT_NO_REVOCATION_MECHANISM","-205":"CERT_UNABLE_TO_CHECK_REVOCATION","-206":"CERT_REVOKED","-207":"CERT_INVALID","-208":"CERT_WEAK_SIGNATURE_ALGORITHM","-210":"CERT_NON_UNIQUE_NAME","-211":"CERT_WEAK_KEY","-212":"CERT_NAME_CONSTRAINT_VIOLATION","-213":"CERT_END","-300":"INVALID_URL","-301":"DISALLOWED_URL_SCHEME","-302":"UNKNOWN_URL_SCHEME","-310":"TOO_MANY_REDIRECTS","-311":"UNSAFE_REDIRECT","-312":"UNSAFE_PORT","-320":"INVALID_RESPONSE","-321":"INVALID_CHUNKED_ENCODING","-322":"METHOD_NOT_SUPPORTED","-323":"UNEXPECTED_PROXY_AUTH","-324":"EMPTY_RESPONSE","-325":"RESPONSE_HEADERS_TOO_BIG","-326":"PAC_STATUS_NOT_OK","-327":"PAC_SCRIPT_FAILED","-328":"REQUEST_RANGE_NOT_SATISFIABLE","-329":"MALFORMED_IDENTITY","-330":"CONTENT_DECODING_FAILED","-331":"NETWORK_IO_SUSPENDED","-332":"SYN_REPLY_NOT_RECEIVED","-333":"ENCODING_CONVERSION_FAILED","-334":"UNRECOGNIZED_FTP_DIRECTORY_LISTING_FORMAT","-335":"INVALID_SPDY_STREAM","-336":"NO_SUPPORTED_PROXIES","-337":"SPDY_PROTOCOL_ERROR","-338":"INVALID_AUTH_CREDENTIALS","-339":"UNSUPPORTED_AUTH_SCHEME","-340":"ENCODING_DETECTION_FAILED","-341":"MISSING_AUTH_CREDENTIALS","-342":"UNEXPECTED_SECURITY_LIBRARY_STATUS","-343":"MISCONFIGURED_AUTH_ENVIRONMENT","-344":"UNDOCUMENTED_SECURITY_LIBRARY_STATUS","-345":"RESPONSE_BODY_TOO_BIG_TO_DRAIN","-346":"RESPONSE_HEADERS_MULTIPLE_CONTENT_LENGTH","-347":"INCOMPLETE_SPDY_HEADERS","-348":"PAC_NOT_IN_DHCP","-349":"RESPONSE_HEADERS_MULTIPLE_CONTENT_DISPOSITION","-350":"RESPONSE_HEADERS_MULTIPLE_LOCATION","-351":"SPDY_SERVER_REFUSED_STREAM","-352":"SPDY_PING_FAILED","-353":"PIPELINE_EVICTION","-354":"CONTENT_LENGTH_MISMATCH","-355":"INCOMPLETE_CHUNKED_ENCODING","-356":"QUIC_PROTOCOL_ERROR","-357":"RESPONSE_HEADERS_TRUNCATED","-358":"QUIC_HANDSHAKE_FAILED","-400":"CACHE_MISS","-401":"CACHE_READ_FAILURE","-402":"CACHE_WRITE_FAILURE","-403":"CACHE_OPERATION_NOT_SUPPORTED","-404":"CACHE_OPEN_FAILURE","-405":"CACHE_CREATE_FAILURE","-406":"CACHE_RACE","-407":"CACHE_CHECKSUM_READ_FAILURE","-408":"CACHE_CHECKSUM_MISMATCH","-501":"INSECURE_RESPONSE","-502":"NO_PRIVATE_KEY_FOR_CERT","-503":"ADD_USER_CERT_FAILED","-601":"FTP_FAILED","-602":"FTP_SERVICE_UNAVAILABLE","-603":"FTP_TRANSFER_ABORTED","-604":"FTP_FILE_BUSY","-605":"FTP_SYNTAX_ERROR","-606":"FTP_COMMAND_NOT_SUPPORTED","-607":"FTP_BAD_COMMAND_SEQUENCE","-701":"PKCS12_IMPORT_BAD_PASSWORD","-702":"PKCS12_IMPORT_FAILED","-703":"IMPORT_CA_CERT_NOT_CA","-704":"IMPORT_CERT_ALREADY_EXISTS","-705":"IMPORT_CA_CERT_FAILED","-706":"IMPORT_SERVER_CERT_FAILED","-707":"PKCS12_IMPORT_INVALID_MAC","-708":"PKCS12_IMPORT_INVALID_FILE","-709":"PKCS12_IMPORT_UNSUPPORTED","-710":"KEY_GENERATION_FAILED","-711":"ORIGIN_BOUND_CERT_GENERATION_FAILED","-712":"PRIVATE_KEY_EXPORT_FAILED","-713":"SELF_SIGNED_CERT_GENERATION_FAILED","-714":"CERT_DATABASE_CHANGED","-800":"DNS_MALFORMED_RESPONSE","-801":"DNS_SERVER_REQUIRES_TCP","-802":"DNS_SERVER_FAILED","-803":"DNS_TIMED_OUT","-804":"DNS_CACHE_MISS","-805":"DNS_SEARCH_EMPTY","-806":"DNS_SORT_ERROR"}};t.prototype.getErrorMessage=function(t){return this.errorCodeMap[String(t)]},MySQL.NetworkErrorCode=t}(),function(){"use strict";var t=function(){};t.prototype.sha1ToWordArray=function(t){return CryptoJS.SHA1(t)},t.prototype.sha1ToUint8Array=function(t){var e=this.sha1ToWordArray(t);return this.wordArrayToUnit8Array(e)},t.prototype.sha1Uint8ArrayToUint8Array=function(t){var e=this.uint8ArrayToWords(t),n=CryptoJS.lib.WordArray.create(e,t.length);return this.sha1ToUint8Array(n)},t.prototype.uint8ArrayToWords=function(t){for(var e=t.length,n=[],i=0;i<e;i++)n[i>>>2]|=t[i]<<24-i%4*8;return n},t.prototype.wordArrayToUnit8Array=function(t){for(var e=new ArrayBuffer(t.sigBytes),n=new DataView(e,0,e.byteLength),i=0;i<t.words.length;i++)n.setInt32(4*i,t.words[i],!1);return new Uint8Array(e)},MySQL.Hasher=t}(),function(){"use strict";var t=function(){this.encoding="utf-8"};t.prototype.arrayBufferToString=function(t){var e=new Uint8Array(t);return new TextDecoder(this.encoding).decode(e)},t.prototype.stringToArrayBuffer=function(t){for(var e=new TextEncoder(this.encoding).encode(t),n=new ArrayBuffer(e.length),i=new DataView(n),r=0;r<e.length;r++)i.setInt8(r,e[r]);return n},t.prototype.createUint8Array=function(t){var e=new ArrayBuffer(t);return new Uint8Array(e)},MySQL.BinaryUtils=t}(),function(t){"use strict";var e=function(){this.binaryUtils=new MySQL.BinaryUtils};e.prototype.createFixedLengthInteger=function(t,e){var n=new ArrayBuffer(4);return new DataView(n).setUint32(0,t,!0),new Uint8Array(n).subarray(0,e)},e.prototype.createLengthEncodedString=function(t){var e=this.binaryUtils.stringToArrayBuffer(t),n=new Uint8Array(e),i=n.length,r=this.createLengthEncodedInteger(i),s=new Uint8Array(r.length+n.length);return s.set(r,0),s.set(n,r.length),s},e.prototype.createNullEndValue=function(t){var e=new Uint8Array(t),n=new Uint8Array(e.length+1);return n.set(e,0),n},e.prototype.createLengthEncodedInteger=function(t){var e=null,n=0;if(null===t)return(e=new Uint8Array(1))[0]=251,e;if(0<=t&&t<=250)return(e=new Uint8Array(1))[0]=t,e;var i=new ArrayBuffer(4);new DataView(i).setUint32(0,t,!1);var r=new Uint8Array(i),s=4;for(n=0;n<r.length;n++)if(0!==r[n]){s-=n;break}if(251<=t&&2==s){for((e=new Uint8Array(3))[0]=252,n=0;n<s;n++)e[n+1]=r[r.length-1-n];return e}if(3==s){for((e=new Uint8Array(4))[0]=253,n=0;n<s;n++)e[n+1]=r[r.length-1-n];return e}for((e=new Uint8Array(9))[0]=254,n=0;n<s;n++)e[n+1]=r[r.length-1-n];return e},e.prototype.createNullEndString=function(t){var e=this.binaryUtils.stringToArrayBuffer(t);return this.createNullEndValue(e)},e.prototype.getNullEndString=function(t,e){for(var n=new Uint8Array(t),i=e;i<n.length&&0!==n[i];i++);var r=new Uint8Array(n.subarray(e,i));return{result:this.binaryUtils.arrayBufferToString(r.buffer),nextPosition:i+1}},e.prototype.getFixedLengthString=function(t,e,n){var i=new Uint8Array(t),r=new Uint8Array(i.subarray(e,e+n));return this.binaryUtils.arrayBufferToString(r.buffer)},e.prototype.getLengthEncodedString=function(t,e){var n=this.getLengthEncodedInteger(t,e);return null===n.result?{result:null,nextPosition:n.nextPosition}:{result:this.getFixedLengthString(t,n.nextPosition,n.result),nextPosition:n.nextPosition+n.result}},e.prototype.getFixedLengthInteger=function(t,e,n){var i=new Uint8Array(t).subarray(e,e+n),r=new Uint8Array(4);return r.set(i,0),new DataView(r.buffer,0,4).getUint32(0,!0)},e.prototype.getLengthEncodedInteger=function(t,e){var n=new Uint8Array(t),i=n[e];if(251==i)return{result:null,nextPosition:e+1};if(i<=250)return{result:i,nextPosition:e+1};var r=0;r=252==i?2:253==i?3:8;for(var s=n.subarray(e+1,e+1+r),o=new ArrayBuffer(8),a=new Uint8Array(o),u=0;u<s.length;u++)a[u]=s[u];return{result:new DataView(o).getInt32(0,!0),nextPosition:e+1+r}},MySQL.Types=e}(MySQL.BinaryUtils),function(n){"use strict";var t=function(t,e){this.mySQLTypes=new n,this.sequenceNumber=t,this.data=e,this.dataLength=e.byteLength};t.prototype._outputUint8Array=function(t){for(var e="",n="",i="",r=0;r<t.length;r++){var s=Number(t[r]).toString(16).toUpperCase();1===s.length&&(s="0"+s),n+=s,r%2!=0&&(n+=" "),32<=t[r]&&t[r]<=126?i+=String.fromCharCode(t[r]):i+=".",(r+1)%16==0&&(e+=n+" "+i+"\n",i=n="")}n&&(e+=n+" "+i+"\n"),console.log(e)},t.prototype.getArrayBuffer=function(){var t=new ArrayBuffer(4+this.dataLength),e=this.mySQLTypes.createFixedLengthInteger(this.dataLength,3),n=new Uint8Array(t);return n.set(e,0),n[3]=this.sequenceNumber,n.set(new Uint8Array(this.data),4),t},t.prototype.outputForDebug=function(){console.log("sequenceNumber:",this.sequenceNumber),console.log("dataLength:",this.dataLength),this._outputUint8Array(new Uint8Array(this.data))},MySQL.Packet=t}(MySQL.Types),function(){"use strict";MySQL.InitialHandshakeRequest=function(t,e,n,i,r,s,o,a,u,h,c){this.protocolVersion=t,this.serverVersion=e,this.connectionId=n,this.authPluginDataPart1=i,this.capabilityFlag1=r,this.characterSet=s,this.statusFlags=o,this.capabilityFlag2=a,this.authPluginDataLen=u,this.authPluginDataPart2=h,this.authPluginName=c}}(),function(){"use strict";MySQL.StatusFlags={SERVER_STATUS_IN_TRANS:1,SERVER_STATUS_AUTOCOMMIT:2,SERVER_MORE_RESULTS_EXISTS:8,SERVER_STATUS_NO_GOOD_INDEX_USED:16,SERVER_STATUS_NO_INDEX_USED:32,SERVER_STATUS_CURSOR_EXISTS:64,SERVER_STATUS_LAST_ROW_SENT:128,SERVER_STATUS_DB_DROPPED:256,SERVER_STATUS_NO_BACKSLASH_ESCAPES:512,SERVER_STATUS_METADATA_CHANGED:1024,SERVER_QUERY_WAS_SLOW:2048,SERVER_PS_OUT_PARAMS:4096}}(),function(t){"use strict";var e=function(t,e,n,i,r){this.affectedRows=t,this.lastInsertId=e,this.statusFlags=n,this.warnings=i,this.info=r};e.prototype.isSuccess=function(){return!0},e.prototype.isAuthSwitchRequest=function(){return!1},e.prototype.hasResultset=function(){return!1},e.prototype.isStatusInTrans=function(){return 0!=(this.statusFlags&t.SERVER_STATUS_IN_TRANS)},e.prototype.isAutoCommit=function(){return 0!=(this.statusFlags&t.SERVER_STATUS_AUTOCOMMIT)},e.prototype.isMoreResultsExists=function(){return 0!=(this.statusFlags&t.SERVER_MORE_RESULTS_EXISTS)},e.prototype.isNoGoodIndexUsed=function(){return 0!=(this.statusFlags&t.SERVER_STATUS_NO_GOOD_INDEX_USED)},e.prototype.isNoIndexUsed=function(){return 0!=(this.statusFlags&t.SERVER_STATUS_NO_INDEX_USED)},e.prototype.isCursorExists=function(){return 0!=(this.statusFlags&t.SERVER_STATUS_CURSOR_EXISTS)},e.prototype.isLastRowSent=function(){return 0!=(this.statusFlags&t.SERVER_STATUS_LAST_ROW_SENT)},e.prototype.isDbDropped=function(){return 0!=(this.statusFlags&t.SERVER_STATUS_DB_DROPPED)},e.prototype.isNoBackslashEscapes=function(){return 0!=(this.statusFlags&t.SERVER_STATUS_NO_BACKSLASH_ESCAPES)},e.prototype.isMetadataChanged=function(){return 0!=(this.statusFlags&t.SERVER_STATUS_METADATA_CHANGED)},e.prototype.isQueryWasSlow=function(){return 0!=(this.statusFlags&t.SERVER_QUERY_WAS_SLOW)},e.prototype.isPsOutParams=function(){return 0!=(this.statusFlags&t.SERVER_PS_OUT_PARAMS)},MySQL.OkResult=e}(MySQL.StatusFlags),function(){"use strict";var t=function(t,e,n,i){this.errorCode=t,this.sqlStateMarker=e,this.sqlState=n,this.errorMessage=i};t.prototype.isSuccess=function(){return!1},t.prototype.isAuthSwitchRequest=function(){return!1},MySQL.ErrResult=t}(),function(){"use strict";var t=function(t,e){this.authMethodName=t,this.authMethodData=e};t.prototype.isAuthSwitchRequest=function(){return!0},MySQL.AuthSwitchRequest=t}(),function(){"use strict";MySQL.AuthSwitchResponse=function(t){this.data=t}}(),function(){"use strict";var t=function(t){this.columnCount=t};t.prototype.isSuccess=function(){return!0},t.prototype.hasResultset=function(){return!0},MySQL.QueryResult=t}(),function(){"use strict";MySQL.FieldFlags={NOT_NULL:1,PRIMARY_KEY:2,UNIQUE:4,INDEX:8,BLOB:16,UNSIGNED:32,ZEROFILL:64,BINARY:128,AUTO_INCREMENT:512,ENUM:256,SET:2048,NO_DEFAULT_VALUE:4096}}(),function(t){"use strict";var e=function(t,e,n,i,r,s,o,a,u,h,c,l){this.catalog=t,this.schema=e,this.table=n,this.orgTable=i,this.name=r,this.orgName=s,this.nextLength=o,this.characterSet=a,this.columnLength=u,this.columnType=h,this.flags=c,this.decimals=l};e.prototype.isNotNull=function(){return 0!=(this.flags&t.NOT_NULL)},e.prototype.isPrimaryKey=function(){return 0!=(this.flags&t.PRIMARY_KEY)},e.prototype.isUnique=function(){return 0!=(this.flags&t.UNIQUE)},e.prototype.isIndex=function(){return 0!=(this.flags&t.INDEX)},e.prototype.isBlob=function(){return 0!=(this.flags&t.BLOB)},e.prototype.isUnsigned=function(){return 0!=(this.flags&t.UNSIGNED)},e.prototype.isZeroFill=function(){return 0!=(this.flags&t.ZEROFILL)},e.prototype.isBinary=function(){return 0!=(this.flags&t.BINARY)},e.prototype.isAutoIncrement=function(){return 0!=(this.flags&t.AUTO_INCREMENT)},e.prototype.isEnum=function(){return 0!=(this.flags&t.ENUM)},e.prototype.isSet=function(){return 0!=(this.flags&t.SET)},e.prototype.isNoDefaultValue=function(){return 0!=(this.flags&t.NO_DEFAULT_VALUE)},MySQL.ColumnDefinition=e}(MySQL.FieldFlags),function(){"use strict";MySQL.ResultsetRow=function(t){this.values=t}}(),function(t){"use strict";var e=function(t,e){this.warningCount=t,this.statusFlags=e};e.prototype.isStatusInTrans=function(){return 0!=(this.statusFlags&t.SERVER_STATUS_IN_TRANS)},e.prototype.isAutoCommit=function(){return 0!=(this.statusFlags&t.SERVER_STATUS_AUTOCOMMIT)},e.prototype.isMoreResultsExists=function(){return 0!=(this.statusFlags&t.SERVER_MORE_RESULTS_EXISTS)},e.prototype.isNoGoodIndexUsed=function(){return 0!=(this.statusFlags&t.SERVER_STATUS_NO_GOOD_INDEX_USED)},e.prototype.isNoIndexUsed=function(){return 0!=(this.statusFlags&t.SERVER_STATUS_NO_INDEX_USED)},e.prototype.isCursorExists=function(){return 0!=(this.statusFlags&t.SERVER_STATUS_CURSOR_EXISTS)},e.prototype.isLastRowSent=function(){return 0!=(this.statusFlags&t.SERVER_STATUS_LAST_ROW_SENT)},e.prototype.isDbDropped=function(){return 0!=(this.statusFlags&t.SERVER_STATUS_DB_DROPPED)},e.prototype.isNoBackslashEscapes=function(){return 0!=(this.statusFlags&t.SERVER_STATUS_NO_BACKSLASH_ESCAPES)},e.prototype.isMetadataChanged=function(){return 0!=(this.statusFlags&t.SERVER_STATUS_METADATA_CHANGED)},e.prototype.isQueryWasSlow=function(){return 0!=(this.statusFlags&t.SERVER_QUERY_WAS_SLOW)},e.prototype.isPsOutParams=function(){return 0!=(this.statusFlags&t.SERVER_PS_OUT_PARAMS)},MySQL.EofResult=e}(MySQL.StatusFlags),function(){"use strict";MySQL.ColumnTypes={DECIMAL:0,TINY:1,SHORT:2,LONG:3,FLOAT:4,DOUBLE:5,NULL:6,TIMESTAMP:7,LONGLONG:8,INT24:9,DATE:10,TIME:11,DATETIME:12,YEAR:13,VARCHAR:15,BIT:16,NEWDECIMAL:246,ENUM:247,SET:248,TINY_BLOB:249,MEDIUM_BLOB:250,LONG_BLOB:251,BLOB:252,VAR_STRING:253,STRING:254,GEOMETRY:255}}(),function(t,e,n,s,l,u,r,f,_,o,a){"use strict";var i=function(){this.binaryUtils=new t,this.mySQLTypes=new e,this.hasher=new n},h=function(t,e,n){var i=this.mySQLTypes.getLengthEncodedInteger(t,e),r=i.result,s=this.mySQLTypes.getLengthEncodedInteger(t,i.nextPosition),o=s.result,a=this.mySQLTypes.getFixedLengthInteger(t,s.nextPosition,2),u=this.mySQLTypes.getFixedLengthInteger(t,s.nextPosition+2,2),h="";if(n>s.nextPosition+4){var c=n-s.nextPosition+4;h=this.mySQLTypes.getFixedLengthString(t,s.nextPosition+4,c)}return new l(r,o,a,u,h)},c=function(t,e,n){var i=this.mySQLTypes.getFixedLengthInteger(t,e,2),r=this.mySQLTypes.getFixedLengthString(t,e+2,1),s=this.mySQLTypes.getFixedLengthString(t,e+3,5),o=n-e-8,a=this.mySQLTypes.getFixedLengthString(t,e+8,o);return new u(i,r,s,a)};i.prototype.generateStatisticsRequest=function(){var t=new ArrayBuffer(1),e=new Uint8Array(t);return e[0]=9,e},i.prototype.generateQueryRequest=function(t){var e=this.binaryUtils.stringToArrayBuffer(t),n=new Uint8Array(e),i=this.binaryUtils.createUint8Array(1+n.length);return i[0]=3,i.set(n,1),i},i.prototype.generateInitDBRequest=function(t){var e=this.binaryUtils.stringToArrayBuffer(t),n=new Uint8Array(e),i=this.binaryUtils.createUint8Array(1+n.length);return i[0]=2,i.set(n,1),i},i.prototype.generateSSLRequest=function(t,e){var n=559617;e&&(n|=65536,n|=131072);var i=this.mySQLTypes.createFixedLengthInteger(n,4),r=this.mySQLTypes.createFixedLengthInteger(16777215,4),s=this.mySQLTypes.createLengthEncodedInteger(33),o=i.length+r.length+s.length+23,a=new ArrayBuffer(o),u=new Uint8Array(a),h=0;return u.set(i,h),h+=i.length,u.set(r,h),h+=r.length,u.set(s,h),u},i.prototype.generateAuthSwitchResponse=function(t){return t},i.prototype.generateHandshakeResponse=function(t,e,n,i){var r=557569;i&&(r|=65536,r|=131072);var s,o=this.mySQLTypes.createFixedLengthInteger(r,4),a=this.mySQLTypes.createFixedLengthInteger(16777215,4),u=this.mySQLTypes.createLengthEncodedInteger(33),h=this.mySQLTypes.createNullEndString(e);s=null===n?0:this.mySQLTypes.createLengthEncodedInteger(n.length);var c=this.mySQLTypes.createNullEndString(t.authPluginName),l=o.length+a.length+u.length+23+h.length+c.length;l+=null===n?1:s.length+n.length;var S=new ArrayBuffer(l),E=new Uint8Array(S),y=0;return E.set(o,y),y+=o.length,E.set(a,y),y+=a.length,E.set(u,y),y+=u.length,y+=23,E.set(h,y),y+=h.length,null===n?(E.set([0],y),y+=1):(E.set(s,y),y+=s.length,E.set(n,y),y+=n.length),E.set(c,y),E},i.prototype.generatePasswordHash=function(t,e){var n=this.hasher.sha1ToUint8Array(e),i=this.hasher.sha1Uint8ArrayToUint8Array(n),r=t.authPluginDataPart1,s=t.authPluginDataPart2,o=new ArrayBuffer(r.length+s.length+i.length),a=new Uint8Array(o);a.set(r,0),a.set(s,r.length),a.set(i,r.length+s.length);for(var u=this.hasher.sha1Uint8ArrayToUint8Array(a),h=new Uint8Array(n.length),c=0;c<h.length;c++)h[c]=n[c]^u[c];return h},i.prototype.generatePasswordHashForAuthSwitch=function(t,e){var n=this.hasher.sha1ToUint8Array(e),i=this.hasher.sha1Uint8ArrayToUint8Array(n),r=new ArrayBuffer(t.length+i.length),s=new Uint8Array(r);s.set(t,0),s.set(i,t.length);for(var o=this.hasher.sha1Uint8ArrayToUint8Array(s),a=new Uint8Array(n.length),u=0;u<a.length;u++)a[u]=n[u]^o[u];return a},i.prototype.generatePingRequest=function(){var t=this.binaryUtils.createUint8Array(1);return t[0]=14,t},i.prototype.parseQueryResultPacket=function(t,e){var n=t.data,i=this.mySQLTypes.getFixedLengthInteger(n,0,1);if(0===i)e(h.call(this,n,1,t.dataLength));else if(255==i){e(c.call(this,n,1,t.dataLength))}else{var r=this.mySQLTypes.getLengthEncodedInteger(n,0);e(new s(r.result))}},i.prototype.parseOkErrResultPacket=function(t){var e=t.data,n=this.mySQLTypes.getFixedLengthInteger(e,0,1);return 0===n?h.call(this,e,1,t.dataLength):255==n?c.call(this,e,1,t.dataLength):254==n?function(t,e,n){var i=this.mySQLTypes.getNullEndString(t,e),r=i.result;e=i.nextPosition;var s=new Uint8Array(t,e,n-e-1);return new a(r,s)}.call(this,e,1,t.dataLength):null},i.prototype.parseEofPacket=function(t){var e=t.data;if(254!=this.mySQLTypes.getFixedLengthInteger(e,0,1))return null;var n=this.mySQLTypes.getFixedLengthInteger(e,1,2),i=this.mySQLTypes.getFixedLengthInteger(e,3,2);return new r(n,i)},i.prototype.parseInitialHandshakePacket=function(t){var e=t.data,n=0,i=this.mySQLTypes.getFixedLengthInteger(e,n++,1),r=this.mySQLTypes.getNullEndString(e,n),s=r.result;n=r.nextPosition;var o=this.mySQLTypes.getFixedLengthInteger(e,n,4);n+=4;var a=new Uint8Array(e,n,8);n+=9;var u=this.mySQLTypes.getFixedLengthInteger(e,n,2);n+=2;var h=this.mySQLTypes.getFixedLengthInteger(e,n++,1),c=this.mySQLTypes.getFixedLengthInteger(e,n,2);n+=2;var l=this.mySQLTypes.getFixedLengthInteger(e,n,2);n+=2;var S=this.mySQLTypes.getFixedLengthInteger(e,n++,1);n+=10;var E=new Uint8Array(e,n,12);n+=13;var y=this.mySQLTypes.getNullEndString(e,n).result;return new f(i,s,o,a,u,h,c,l,S,E,y)},i.prototype.parseColumnDefinitionPacket=function(t){var e=t.data,n=this.mySQLTypes.getLengthEncodedString(e,0),i=this.mySQLTypes.getLengthEncodedString(e,n.nextPosition),r=this.mySQLTypes.getLengthEncodedString(e,i.nextPosition),s=this.mySQLTypes.getLengthEncodedString(e,r.nextPosition),o=this.mySQLTypes.getLengthEncodedString(e,s.nextPosition),a=this.mySQLTypes.getLengthEncodedString(e,o.nextPosition),u=this.mySQLTypes.getLengthEncodedInteger(e,a.nextPosition),h=u.nextPosition,c=this.mySQLTypes.getFixedLengthInteger(e,h,2);h+=2;var l=this.mySQLTypes.getFixedLengthInteger(e,h,4);h+=4;var S=this.mySQLTypes.getFixedLengthInteger(e,h,1);h+=1;var E=this.mySQLTypes.getFixedLengthInteger(e,h,2);h+=2;var y=this.mySQLTypes.getFixedLengthInteger(e,h,1);return new _(n.result,i.result,r.result,s.result,o.result,a.result,u.result,c,l,S,E,y)},i.prototype.parseResultsetRowPacket=function(t){for(var e=t.data,n=0,i=[];n<t.dataLength;){var r=this.mySQLTypes.getLengthEncodedString(e,n);i.push(r.result),n=r.nextPosition}return new o(i)},i.prototype.parseStatisticsResultPacket=function(t){var e=t.data,n=t.dataLength;return this.mySQLTypes.getFixedLengthString(e,0,n)},MySQL.Protocol=i}(MySQL.BinaryUtils,MySQL.Types,MySQL.Hasher,MySQL.QueryResult,MySQL.OkResult,MySQL.ErrResult,MySQL.EofResult,MySQL.InitialHandshakeRequest,MySQL.ColumnDefinition,MySQL.ResultsetRow,MySQL.AuthSwitchRequest),function(r,t){"use strict";var e=function(){this.mySQLTypes=new t,this.nextSequenceNumber=0,this.socketImpl=null},o=function(e,n,i,r,s){this.readPacket(function(t){i.push(t),(e+=1)<n?o.call(this,e,n,i,r,s):r(i)}.bind(this),s)},n=function(n,i,t){s.call(this,n,function(t){var e=this.mySQLTypes.getFixedLengthInteger(t.data,0,n);i(e)}.bind(this),t)},s=function(t,e,n){this.socketImpl.read(t,e,n)};e.prototype.setSocketImpl=function(t){this.socketImpl=t},e.prototype.connect=function(t,e,n){this.socketImpl.connect(t,e,n)},e.prototype.disconnect=function(t){this.socketImpl.disconnect(t)},e.prototype.isConnected=function(){return this.socketImpl.isConnected()},e.prototype.readPacket=function(i,e){n.call(this,3,function(t){n.call(this,1,function(n){this.incrementSequenceNumber(n),s.call(this,t,function(t){var e=new r(n,t.data);i(e)}.bind(this),e)}.bind(this),e)}.bind(this),e)},e.prototype.readPluralPackets=function(t,e,n){o.call(this,0,t,[],e,n)},e.prototype.writePacket=function(t,e,n){this.socketImpl.write(t,e,n)},e.prototype.incrementSequenceNumber=function(t){this.nextSequenceNumber=t+1,255<this.nextSequenceNumber&&(this.nextSequenceNumber=0)},e.prototype.createPacket=function(t){return new r(this.nextSequenceNumber,t)},e.prototype.resetSequenceNumber=function(){this.nextSequenceNumber=0},e.prototype.establishTls=function(t,e,n,i){this.socketImpl.establishTls(t,e,n,i)},MySQL.Communication=e}(MySQL.Packet,MySQL.Types),function(t,e,n){"use strict";var i=function(){this.mySQLCommunication=new t,this.mySQLProtocol=new e,this.networkErrorCode=new n},l=function(r,t,s,e,o,a){var u;u=s?this.mySQLProtocol.generatePasswordHash(r,s):null;var n=this.mySQLProtocol.generateHandshakeResponse(r,t,u,e),i=this.mySQLCommunication.createPacket(n.buffer);this.mySQLCommunication.writePacket(i,function(t){this.mySQLCommunication.readPacket(function(t){var e=this.mySQLProtocol.parseOkErrResultPacket(t);if(e.isAuthSwitchRequest()){u=this.mySQLProtocol.generatePasswordHashForAuthSwitch(e.authMethodData,s);var n=this.mySQLProtocol.generateAuthSwitchResponse(u),i=this.mySQLCommunication.createPacket(n.buffer);this.mySQLCommunication.writePacket(i,function(t){this.mySQLCommunication.readPacket(function(t){e=this.mySQLProtocol.parseOkErrResultPacket(t),o(r,e)}.bind(this),a)}.bind(this),a)}else o(r,e)}.bind(this),a)}.bind(this),a)},u=function(r,s,o,a){this.mySQLCommunication.readPacket(function(t){var e=this.mySQLProtocol.parseEofPacket(t),n=this.mySQLProtocol.parseOkErrResultPacket(t);if(e)s(r,e);else if(n&&!n.isSuccess())o(n);else{var i=this.mySQLProtocol.parseResultsetRowPacket(t);r.push(i),u.call(this,r,s,o,a)}}.bind(this),a)},a=function(n,i,r,s){this.mySQLCommunication.readPacket(function(t){this.mySQLProtocol.parseQueryResultPacket(t,function(t){if(t.isSuccess()&&t.hasResultset()){var e=t.columnCount;(function(t,i,e,r,s){this.mySQLCommunication.readPluralPackets(t,function(t){for(var n=[],e=0;e<t.length;e++)n.push(this.mySQLProtocol.parseColumnDefinitionPacket(t[e]));this.mySQLCommunication.readPacket(function(t){this.mySQLProtocol.parseEofPacket(t),u.call(this,[],function(t,e){i(n,t,e)}.bind(this),r,s)}.bind(this),s)}.bind(this),s)}).call(this,e,n,i,r,s)}else t.isSuccess()&&!t.hasResultset()?i(t):r(t)}.bind(this))}.bind(this),s)};i.prototype.setSocketImpl=function(t){this.mySQLCommunication.setSocketImpl(t)},i.prototype.login=function(t,e,n,i,r,s,o,a){this.mySQLCommunication.connect(t,e,function(t){0<=t?function(n,i,r,s,o){this.mySQLCommunication.readPacket(function(t){var e=this.mySQLProtocol.parseInitialHandshakePacket(t);l.call(this,e,n,i,r,s,o)}.bind(this),o)}.call(this,n,i,r,s,a):o(t+"("+this.networkErrorCode.getErrorMessage(t)+")")}.bind(this))},i.prototype.loginWithSSL=function(t,e,n,i,r,s,o,a,u,h){this.mySQLCommunication.connect(t,e,function(t){0<=t?function(r,s,o,a,u,h,c){this.mySQLCommunication.readPacket(function(t){var e=this.mySQLProtocol.parseInitialHandshakePacket(t),n=this.mySQLProtocol.generateSSLRequest(e,u),i=this.mySQLCommunication.createPacket(n.buffer);this.mySQLCommunication.writePacket(i,function(t){this.mySQLCommunication.establishTls(r,s,function(){this.mySQLCommunication.incrementSequenceNumber(i.sequenceNumber),l.call(this,e,o,a,u,h,c)}.bind(this),c)}.bind(this),c)}.bind(this),c)}.call(this,s,o,n,i,r,a,h):u(t+"("+this.networkErrorCode.getErrorMessage(t)+")")}.bind(this))},i.prototype.logout=function(t){this.mySQLCommunication.disconnect(t)},i.prototype.query=function(t,e,n,i,r){this.mySQLCommunication.isConnected()?(this.mySQLCommunication.resetSequenceNumber(),function(t,e,n,i,r){var s=this.mySQLProtocol.generateQueryRequest(t),o=this.mySQLCommunication.createPacket(s.buffer);this.mySQLCommunication.writePacket(o,function(t){a.call(this,e,n,i,r)}.bind(this),r)}.call(this,t,e,n,i,r)):r("Not connected.")},i.prototype.getNextQueryResult=function(t,e,n,i){this.mySQLCommunication.isConnected()?a.call(this,t,e,n,i):i("Not connected.")},i.prototype.getDatabases=function(r,e,t){this.mySQLCommunication.isConnected()?this.query("SHOW DATABASES",function(t,e){for(var n=[],i=0;i<e.length;i++)n.push(e[i].values[0]);r(n)}.bind(this),function(t){console.log("This callback function never be called.")}.bind(this),function(t){e(t)}.bind(this),t):t("Not connected.")},i.prototype.initDB=function(t,n,e){if(this.mySQLCommunication.isConnected()){this.mySQLCommunication.resetSequenceNumber();var i=this.mySQLProtocol.generateInitDBRequest(t),r=this.mySQLCommunication.createPacket(i.buffer);this.mySQLCommunication.writePacket(r,function(t){this.mySQLCommunication.readPacket(function(t){var e=this.mySQLProtocol.parseOkErrResultPacket(t);n(e)}.bind(this),e)}.bind(this),e)}else e("Not connected.")},i.prototype.getStatistics=function(n,e){if(this.mySQLCommunication.isConnected()){this.mySQLCommunication.resetSequenceNumber();var t=this.mySQLProtocol.generateStatisticsRequest(),i=this.mySQLCommunication.createPacket(t);this.mySQLCommunication.writePacket(i,function(t){this.mySQLCommunication.readPacket(function(t){var e=this.mySQLProtocol.parseStatisticsResultPacket(t);n(e)}.bind(this),e)}.bind(this),e)}else e("Not connected.")},i.prototype.ping=function(n,e){if(this.mySQLCommunication.isConnected()){this.mySQLCommunication.resetSequenceNumber();var t=this.mySQLProtocol.generatePingRequest(),i=this.mySQLCommunication.createPacket(t);this.mySQLCommunication.writePacket(i,function(t){this.mySQLCommunication.readPacket(function(t){var e=this.mySQLProtocol.parseOkErrResultPacket(t);n(e)}.bind(this),e)}.bind(this),e)}else e("Not connected.")},i.prototype.isConnected=function(){return this.mySQLCommunication.isConnected()},MySQL.Client=i}(MySQL.Communication,MySQL.Protocol,MySQL.NetworkErrorCode),function(){var t=function(){console.log("Deprecated: You should use MySQL.ChromeSocket2."),this.socketId=null};t.prototype.connect=function(e,n,i){var r=null;chrome.socket.create("tcp",{},function(t){r=t.socketId,chrome.socket.connect(r,e,n,function(t){this.socketId=0<=t?r:null,i(t)}.bind(this))}.bind(this))},t.prototype.isConnected=function(){return null!==this.socketId},t.prototype.disconnect=function(t){this.socketId&&(chrome.socket.disconnect(this.socketId),chrome.socket.destroy(this.socketId)),this.socketId=null,t&&t()},t.prototype.write=function(t,n,i){chrome.socket.write(this.socketId,t.getArrayBuffer(),function(t){var e=t.bytesWritten;0<e?n(t):(console.log("Error: writeInfo.bytesWritten="+e),i("Sending packet failed: "+e))}.bind(this))},t.prototype.read=function(t,n,i){chrome.socket.read(this.socketId,t,function(t){var e=t.resultCode;0<e?n(t):(console.log("Error: readInfo.resultCode="+e+" data="+t.data),i("Reading packet failed: "+e))}.bind(this))},MySQL.ChromeSocket=t}(),function(){var t=function(){this.socketId=null,this.initialize(),this.callbacks=[],this.buffer=new ArrayBuffer(0),e.call(this),this.host=null,this.ca=null,this.checkCommonName=!1},e=function(){this.tlsRequiredByteLength=0,this.tlsBuffer="",this.tls={open:!1},this.tlsSendCallback=null,this.tlsSendErrorCallback=null},i=function(t){var e=this.buffer.byteLength+t.byteLength,n=new ArrayBuffer(e),i=new Uint8Array(n,0,e);i.set(new Uint8Array(this.buffer,0,this.buffer.byteLength),0),i.set(new Uint8Array(t,0,t.byteLength),this.buffer.byteLength),this.buffer=n,this.fetch()},r=function(t,e){for(var n=new ArrayBuffer(t.length),i=new Uint8Array(n),r=0;r<t.length;r++)i[r]=t.charCodeAt(r);e(n)},s=function(t,e){for(var n=new Uint8Array(t),i="",r=0;r<n.length;r+=65536)i+=String.fromCharCode.apply(null,n.subarray(r,Math.min(r+65536,n.length)));e(i)},o=function(t,n,i){chrome.sockets.tcp.send(this.socketId,t,function(t){var e=t.resultCode;0===e?n(t):(console.log("Error: writeInfo.resultCode="+e),i("Sending data failed: "+e))}.bind(this))};t.prototype.initialize=function(){chrome.sockets.tcp.onReceive.addListener(function(t){this.socketId===t.socketId&&this.onReceive(t)}.bind(this)),chrome.sockets.tcp.onReceiveError.addListener(function(t){this.socketId===t.socketId&&this.onReceiveError(t)}.bind(this))},t.prototype.onReceive=function(t){var e=t.data;this.tls.open?function(t){s.call(this,t,function(t){this.tlsBuffer+=t,this.tlsBuffer.length>=this.tlsRequiredByteLength&&(this.tlsRequiredByteLength=this.tls.process(this.tlsBuffer),this.tlsBuffer="")}.bind(this))}.call(this,e):i.call(this,e)},t.prototype.onReceiveError=function(t){this.raiseError(t)},t.prototype.raiseError=function(t){0<this.callbacks.length&&(this.callbacks[0].fatalCallback("Network error occurred: "+t.resultCode),this.callbacks=this.callbacks.slice(1))},t.prototype.fetch=function(){if(0<this.callbacks.length){var t,e,n,i,r=this.callbacks[0];if(0<r.length){if(this.buffer.byteLength>=r.length){t=new ArrayBuffer(r.length),e=new Uint8Array(t,0,t.byteLength),n=new Uint8Array(this.buffer,0,this.buffer.byteLength),e.set(n.subarray(0,r.length));var s=new ArrayBuffer(this.buffer.byteLength-r.length);new Uint8Array(s,0,s.byteLength).set(n.subarray(r.length,n.byteLength),0),this.buffer=s,this.callbacks=this.callbacks.slice(1),i={resultCode:0,data:t},r.callback(i),this.fetch()}}else-1===r.length?(t=new ArrayBuffer(this.buffer.byteLength),e=new Uint8Array(t,0,t.byteLength),n=new Uint8Array(this.buffer,0,this.buffer.byteLength),e.set(n.subarray(0,this.buffer.byteLength)),this.buffer=new ArrayBuffer(0),this.callbacks=this.callbacks.slice(1),i={resultCode:0,data:t},r.callback(i),this.fetch()):console.log("Invalid data.length: "+r.length)}},t.prototype.connect=function(e,n,i){var r=null;chrome.sockets.tcp.create({bufferSize:16777215},function(t){r=t.socketId,chrome.sockets.tcp.connect(r,e,n,function(t){this.host=0<=t?(this.socketId=r,e):this.socketId=null,this.ca=null,i(t)}.bind(this))}.bind(this))},t.prototype.isConnected=function(){return null!==this.socketId},t.prototype.disconnect=function(t){this.socketId&&(this.tls.open&&this.tls.close(),chrome.sockets.tcp.disconnect(this.socketId),chrome.sockets.tcp.close(this.socketId)),this.socketId=null,this.host=null,this.ca=null,this.callbacks=[],this.buffer=new ArrayBuffer(0),e.call(this),t&&t()},t.prototype.write=function(t,e,n){this.tls.open?s.call(this,t.getArrayBuffer(),function(t){this.tlsSendCallback=e,this.tlsSendErrorCallback=n,this.tls.prepare(t)}.bind(this)):o.call(this,t.getArrayBuffer(),e,n)},t.prototype.read=function(t,e,n){this.callbacks.push({length:t,callback:e,fatalCallback:n})},t.prototype.establishTls=function(t,e,n,i){this.ca=t,this.checkCommonName=e,h.call(this,n,i),chrome.sockets.tcp.setPaused(this.socketId,!0,function(){this.tls.handshake(),chrome.sockets.tcp.setPaused(this.socketId,!1)}.bind(this))};var a=function(t,e){var n=t.subject.getField("CN");if(n&&n.value&&u.call(this,n,e))return!0;var i=t.getExtension({name:"subjectAltName"});if(!i||!i.altNames)return!1;for(var r=i.altNames,s=r.length-1;0<=s;s--)if(r[s]&&r[s].value&&u.call(this,r[s],e))return!0;return!1},u=function(t,e){return!this.checkCommonName||new RegExp(t.value.replace(/\./g,"\\.").replace(/\*/g,".*"),"i").test(e)},h=function(e,n){this.tls=forge.tls.createConnection({server:!1,sessionId:null,caStore:[],sessionCache:null,cipherSuites:[forge.tls.CipherSuites.TLS_RSA_WITH_AES_128_CBC_SHA,forge.tls.CipherSuites.TLS_RSA_WITH_AES_256_CBC_SHA],virtualHost:null,verify:function(t,e,n,i){return function(t,e,n,i){if(!i||!i[0])return!1;if(!a.call(this,i[0],this.host))return!1;if(!this.ca)return!0;var r=forge.pki.certificateFromPem(this.ca);return!(!a.call(this,r,this.host)||!r.verify(i[0])&&forge.pki.getPublicKeyFingerprint(r.publicKey,{encoding:"hex"})!==forge.pki.getPublicKeyFingerprint(i[0].publicKey,{encoding:"hex"}))}.call(this,t,e,n,i)}.bind(this),getCertificate:null,getPrivateKey:null,getSignature:null,deflate:null,inflate:null,connected:function(t){e()},tlsDataReady:function(t){var e=t.tlsData.getBytes();0<e.length&&r.call(this,e,function(t){o.call(this,t,function(t){var e=this.tlsSendCallback;this.tlsSendCallback=null,e&&e(t)}.bind(this),function(t){var e=this.tlsSendErrorCallback;this.tlsSendErrorCallback=null,e&&e(t)}.bind(this))}.bind(this))}.bind(this),dataReady:function(t){r.call(this,t.data.getBytes(),function(t){i.call(this,t)}.bind(this))}.bind(this),closed:function(t){}.bind(this),error:function(t,e){console.log(e),n(e.message)}.bind(this)})};MySQL.ChromeSocket2=t}(),function(){"use strict";var t=function(t){this.message=t};(t.prototype=new Error).name="ParseError",MySQL.ParseError=t}(),function(i){var r=!1,s="delimiter ",t=function(){this.result=[],this.stateMap={query:this.query.bind(this),lineStart:this.lineStart.bind(this),escapedQuery:this.escapedQuery.bind(this),sharpComment:this.sharpComment.bind(this),maybeDashComment:this.maybeDashComment.bind(this),dashComment:this.dashComment.bind(this),maybeInlineCommentStart:this.maybeInlineCommentStart.bind(this),inlineComment:this.inlineComment.bind(this),maybeInlineCommentEnd:this.maybeInlineCommentEnd.bind(this),maybeDelimiterDef:this.maybeDelimiterDef.bind(this),delimiterDef:this.delimiterDef.bind(this),delimiterDefEnd:this.delimiterDefEnd.bind(this),maybeDelimiter:this.maybeDelimiter.bind(this),singleStringLeteral:this.singleStringLeteral.bind(this),escapedSingleStringLeteral:this.escapedSingleStringLeteral.bind(this),maybeSingleStringLeteralEnd:this.maybeSingleStringLeteralEnd.bind(this),doubleStringLeteral:this.doubleStringLeteral.bind(this),escapedDoubleStringLeteral:this.escapedDoubleStringLeteral.bind(this),maybeDoubleStringLeteralEnd:this.maybeDoubleStringLeteralEnd.bind(this)},this.currentState=this.stateMap.lineStart,this.buffer=[],this.maybeDashCommentCount=0,this.maybeDelimiterDefBuffer=[],this.maybeDelimiterDefCount=0,this.delimiterDefCandidate=[],this.delimiter=";",this.maybeDelimiterCount=0,this.skipDelimiterCheck=!1},o=function(){var t=this.buffer.join("");e.call(this,t)&&this.result.push(t),this.buffer=[]},e=function(t){return t.replace(/^[  \t\r\n]+|[  \t\r\n]+$/g,"")};t.prototype.parse=function(t){try{return this.evaluate(t),o.call(this),this.result[this.result.length-1]+=this.maybeDelimiterDefBuffer.join(""),{success:!0,result:this.result}}catch(t){if(t instanceof i)return{success:!1,error:t};throw t}},t.prototype.evaluate=function(t){for(var e=0;e<t.length;){var n=t.charAt(e);e+=this.currentState(t,n,e)}},t.prototype.lineStart=function(t,e,n){return r&&console.log("lineStart: "+e)," "===e?(this.buffer.push(e),1):"d"===e||"D"===e?(this.currentState=this.stateMap.maybeDelimiterDef,this.maybeDelimiterDefBuffer=[e],this.maybeDelimiterDefCount=0,1):(this.currentState=this.stateMap.query,0)},t.prototype.query=function(t,e,n){r&&console.log("query: "+e+" [delimiter="+this.delimiter+"]");var i=this.skipDelimiterCheck;return this.skipDelimiterCheck=!1,"\\"===e?(this.buffer.push(e),this.currentState=this.stateMap.escapedQuery):i||e!==this.delimiter.charAt(0)||1!==this.delimiter.length?i||e!==this.delimiter.charAt(0)?"#"===e?(this.buffer.push(e),this.currentState=this.stateMap.sharpComment):"-"===e?(this.buffer.push(e),this.currentState=this.stateMap.maybeDashComment,this.maybeDashCommentCount=0):"/"===e?(this.buffer.push(e),this.currentState=this.stateMap.maybeInlineCommentStart):"\n"===e?(this.buffer.push(e),this.currentState=this.stateMap.lineStart):"'"===e?(this.buffer.push(e),this.currentState=this.stateMap.singleStringLeteral):'"'===e?(this.buffer.push(e),this.currentState=this.stateMap.doubleStringLeteral):this.buffer.push(e):(this.currentState=this.stateMap.maybeDelimiter,this.maybeDelimiterCount=0):o.call(this),1},t.prototype.escapedQuery=function(t,e,n){return r&&console.log("escapedQuery: "+e),this.buffer.push(e),this.currentState=this.stateMap.query,1},t.prototype.sharpComment=function(t,e,n){return r&&console.log("sharpComment: "+e),"\n"===e?(this.buffer.push(e),this.currentState=this.stateMap.lineStart):this.buffer.push(e),1},t.prototype.maybeDashComment=function(t,e,n){return r&&console.log("maybeDashComment: "+e),0===this.maybeDashCommentCount&&"-"===e?(this.buffer.push(e),this.maybeDashCommentCount++):1===this.maybeDashCommentCount&&" "===e?(this.buffer.push(e),this.currentState=this.stateMap.dashComment):1===this.maybeDashCommentCount&&"\n"===e?(this.buffer.push(e),this.currentState=this.stateMap.lineStart):(this.buffer.push(e),this.currentState=this.stateMap.query),1},t.prototype.dashComment=function(t,e,n){return r&&console.log("dashComment: "+e),"\n"===e?(this.buffer.push(e),this.currentState=this.stateMap.lineStart):this.buffer.push(e),1},t.prototype.maybeInlineCommentStart=function(t,e,n){return r&&console.log("maybeInlineCommentStart: "+e),this.currentState="*"===e?(this.buffer.push(e),this.stateMap.inlineComment):(this.buffer.push(e),this.stateMap.query),1},t.prototype.inlineComment=function(t,e,n){return r&&console.log("inlineComment: "+e),"*"===e?(this.buffer.push(e),this.currentState=this.stateMap.maybeInlineCommentEnd):this.buffer.push(e),1},t.prototype.maybeInlineCommentEnd=function(t,e,n){return r&&console.log("maybeInlineCommentEnd: "+e),"*"===e?this.buffer.push(e):this.currentState="/"===e?(this.buffer.push(e),this.stateMap.query):(this.buffer.push(e),this.stateMap.inlineComment),1},t.prototype.maybeDelimiterDef=function(t,e,n){return r&&console.log("maybeDelimiterDef: "+e),this.maybeDelimiterDefCount++,e.toLowerCase()===s.charAt(this.maybeDelimiterDefCount).toLowerCase()?this.maybeDelimiterDefCount+1===s.length?(this.currentState=this.stateMap.delimiterDef,this.delimiterDefCandidate=[],this.maybeDelimiterDefBuffer=[]):this.maybeDelimiterDefBuffer.push(e):(this.buffer=this.buffer.concat(this.maybeDelimiterDefBuffer),this.buffer.push(e),this.maybeDelimiterDefBuffer=[],this.currentState=this.stateMap.query),1},t.prototype.delimiterDef=function(t,e,n){if(r&&console.log("delimiterDef: "+e)," "===e)return 0===this.delimiterDefCandidate.length||(this.delimiter=this.delimiterDefCandidate.join(""),this.currentState=this.stateMap.delimiterDefEnd,o.call(this)),1;if("\n"!==e)return this.delimiterDefCandidate.push(e),1;if(0===this.delimiterDefCandidate.length)throw new i("Delimiter not defined at "+n);return this.delimiter=this.delimiterDefCandidate.join(""),this.currentState=this.stateMap.lineStart,o.call(this),1},t.prototype.delimiterDefEnd=function(t,e,n){return r&&console.log("delimiterEnd: "+e),"\n"===e&&(this.currentState=this.stateMap.lineStart),1},t.prototype.maybeDelimiter=function(t,e,n){return r&&console.log("maybeDelimiter: "+e),this.maybeDelimiterCount++,e===this.delimiter.charAt(this.maybeDelimiterCount)?(this.maybeDelimiterCount+1===this.delimiter.length&&(o.call(this),this.currentState=this.stateMap.query),1):(this.currentState=this.stateMap.query,this.skipDelimiterCheck=!0,-1*this.maybeDelimiterCount)},t.prototype.singleStringLeteral=function(t,e,n){return r&&console.log("singleStringLeteral: "+e),"\\"===e?(this.buffer.push(e),this.currentState=this.stateMap.escapedSingleStringLeteral):"'"===e?(this.buffer.push(e),this.currentState=this.stateMap.maybeSingleStringLeteralEnd):this.buffer.push(e),1},t.prototype.maybeSingleStringLeteralEnd=function(t,e,n){return r&&console.log("maybeSingleStringLeteralEnd: "+e),"'"===e?(this.buffer.push(e),this.currentState=this.stateMap.singleStringLeteral,1):(this.currentState=this.stateMap.query,0)},t.prototype.escapedSingleStringLeteral=function(t,e,n){return r&&console.log("escapedSingleStringLeteral: "+e),this.buffer.push(e),this.currentState=this.stateMap.singleStringLeteral,1},t.prototype.doubleStringLeteral=function(t,e,n){return r&&console.log("doubleStringLeteral: "+e),"\\"===e?(this.buffer.push(e),this.currentState=this.stateMap.escapedDoubleStringLeteral):'"'===e?(this.buffer.push(e),this.currentState=this.stateMap.maybeDoubleStringLeteralEnd):this.buffer.push(e),1},t.prototype.maybeDoubleStringLeteralEnd=function(t,e,n){return r&&console.log("maybeDoubleStringLeteralEnd: "+e),'"'===e?(this.buffer.push(e),this.currentState=this.stateMap.doubleStringLeteral,1):(this.currentState=this.stateMap.query,0)},t.prototype.escapedDoubleStringLeteral=function(t,e,n){return r&&console.log("escapedDoubleStringLeteral: "+e),this.buffer.push(e),this.currentState=this.stateMap.doubleStringLeteral,1},t.prototype.setDebug=function(t){r=t},MySQL.QueryDivider=t}(MySQL.ParseError),function(){"use strict";var t=function(){this.typeMap={0:"DECIMAL",1:"TINY",2:"SHORT",3:"LONG",4:"FLOAT",5:"DOUBLE",6:"NULL",7:"TIMESTAMP",8:"LONGLONG",9:"INT24",10:"DATE",11:"TIME",12:"DATETIME",13:"YEAR",14:"NEWDATE",15:"VARCHAR",16:"BIT",17:"TIMESTAMP2",18:"DATETIME2",19:"TIME2",246:"NEWDECIMAL",247:"ENUM",248:"SET",249:"TINY_BLOB",250:"MEDIUM_BLOB",251:"LONG_BLOB",252:"BLOB",253:"VAR_STRING",254:"STRING",255:"GEOMETRY"}};t.prototype.getColumnTypeName=function(t){return this.typeMap[String(t)]},MySQL.columnType=new t}();