2017-07-04 01:23:32 +08:00
/ * !
* jsoneditor . js
*
* @ brief
* JSONEditor is a web - based tool to view , edit , format , and validate JSON .
* It has various modes such as a tree editor , a code editor , and a plain text
* editor .
*
* Supported browsers : Chrome , Firefox , Safari , Opera , Internet Explorer 8 +
*
* @ license
* Licensed under the Apache License , Version 2.0 ( the "License" ) ; you may not
* use this file except in compliance with the License . You may obtain a copy
* of the License at
*
* http : //www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing , software
* distributed under the License is distributed on an "AS IS" BASIS , WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND , either express or implied . See the
* License for the specific language governing permissions and limitations under
* the License .
*
* Copyright ( c ) 2011 - 2017 Jos de Jong , http : //jsoneditoronline.org
*
* @ author Jos de Jong , < wjosdejong @ gmail . com >
2018-05-02 16:42:47 +08:00
* @ version 5.15 . 0
* @ date 2018 - 05 - 02
2017-07-04 01:23:32 +08:00
* /
2018-05-02 16:42:47 +08:00
! function ( e , t ) { "object" == typeof exports && "object" == typeof module ? module . exports = t ( ) : "function" == typeof define && define . amd ? define ( [ ] , t ) : "object" == typeof exports ? exports . JSONEditor = t ( ) : e . JSONEditor = t ( ) } ( this , function ( ) { return function ( e ) { function t ( n ) { if ( i [ n ] ) return i [ n ] . exports ; var r = i [ n ] = { exports : { } , id : n , loaded : ! 1 } ; return e [ n ] . call ( r . exports , r , r . exports , t ) , r . loaded = ! 0 , r . exports } var i = { } ; return t . m = e , t . c = i , t . p = "" , t ( 0 ) } ( [ function ( e , t , i ) { "use strict" ; function n ( e , t , i ) { if ( ! ( this instanceof n ) ) throw new Error ( 'JSONEditor constructor called without "new".' ) ; var r = a . getInternetExplorerVersion ( ) ; if ( - 1 != r && r < 9 ) throw new Error ( "Unsupported browser, IE9 or newer required. Please install the newest version of your browser." ) ; if ( t && ( t . error && ( console . warn ( 'Option "error" has been renamed to "onError"' ) , t . onError = t . error , delete t . error ) , t . change && ( console . warn ( 'Option "change" has been renamed to "onChange"' ) , t . onChange = t . change , delete t . change ) , t . editable && ( console . warn ( 'Option "editable" has been renamed to "onEditable"' ) , t . onEditable = t . editable , delete t . editable ) , t ) ) { var o = [ "ajv" , "schema" , "schemaRefs" , "templates" , "ace" , "theme" , "autocomplete" , "onChange" , "onEditable" , "onError" , "onModeChange" , "onSelectionChange" , "onTextSelectionChange" , "escapeUnicode" , "history" , "search" , "mode" , "modes" , "name" , "indentation" , "sortObjectKeys" , "navigationBar" , "statusBar" , "languages" , "language" ] ; Object . keys ( t ) . forEach ( function ( e ) { - 1 === o . indexOf ( e ) && console . warn ( 'Unknown option "' + e + '". This option will be ignored' ) } ) } arguments . length && this . _create ( e , t , i ) } var r ; try { r = i ( 1 ) } catch ( e ) { } var o = i ( 51 ) , s = i ( 65 ) , a = i ( 54 ) ; n . modes = { } , n . prototype . DEBOUNCE _INTERVAL = 150 , n . prototype . _create = function ( e , t , i ) { this . container = e , this . options = t || { } , this . json = i || { } ; var n = this . options . mode || this . options . modes && this . options . modes [ 0 ] || "tree" ; this . setMode ( n ) } , n . prototype . destroy = function ( ) { } , n . prototype . set = function ( e ) { this . json = e } , n . prototype . get = function ( ) { return this . json } , n . prototype . setText = function ( e ) { this . json = a . parse ( e ) } , n . prototype . getText = function ( ) { return JSON . stringify ( this . json ) } , n . prototype . setName = function ( e ) { this . options || ( this . options = { } ) , this . options . name = e } , n . prototype . getName = function ( ) { return this . options && this . options . name } , n . prototype . setMode = function ( e ) { var t , i , r = this . container , o = a . extend ( { } , this . options ) , s = o . mode ; o . mode = e ; var l = n . modes [ e ] ; if ( ! l ) throw new Error ( 'Unknown mode "' + o . mode + '"' ) ; try { var c = "text" == l . data ; if ( i = this . getName ( ) , t = this [ c ? "getText" : "get" ] ( ) , this . destroy ( ) , a . clear ( this ) , a . extend ( this , l . mixin ) , this . create ( r , o ) , this . setName ( i ) , this [ c ? "setText" : "set" ] ( t ) , "function" == typeof l . load ) try { l . load . call ( this ) } catch ( e ) { console . error ( e ) } if ( "function" == typeof o . onModeChange && e !== s ) try { o . onModeChange ( e , s ) } catch ( e ) { console . error ( e ) } } catch ( e ) { this . _onError ( e ) } } , n . prototype . getMode = function ( ) { return this . options . mode } , n . prototype . _onError = function ( e ) { if ( ! this . options || "function" != typeof this . options . onError ) throw e ; this . options . onError ( e ) } , n . prototype . setSchema = function ( e , t ) { if ( e ) { var i ; try { i = this . options . ajv || r ( { allErrors : ! 0 , verbose : ! 0 } ) } catch ( e ) { console . warn ( "Failed to create an instance of Ajv, JSON Schema validation is not available. Please use a JSONEditor bundle including Ajv, or pass an instance of Ajv as via the configuration option `ajv`." ) } if ( i ) { if ( t ) { for ( var n in t ) i . removeSchema ( n ) , t [ n ] && i . addSchema ( t [ n ] , n ) ; this . options . schemaRefs = t } this . validateSchema = i . compile ( e ) , this . options . schema = e , this . validate ( ) } this . refresh ( ) } else this . validateSchema = null , this . options . schema = null , this . options . schemaRefs = null , this . validate ( ) , this . refresh ( ) } , n . prototype . validate = function ( ) { } , n . prototype . refresh = function ( ) { } , n . registerMode = function ( e ) { var t , i ; if ( a . isArray ( e ) ) for ( t = 0 ; t < e . length ; t ++ ) n . registerMode ( e [ t ] ) ; else { if ( ! ( "mode" in e ) ) throw new Error ( 'Property "mode" missing' ) ; if ( ! ( "mixin" in e ) ) throw new Error ( 'Property "mixin" missing' ) ; if ( ! ( "data" in e ) ) throw new Error ( 'Property "data" missing' ) ; var r = e . mode ; if ( r in n . modes ) throw new Error ( 'Mode "' + r + '" already registered' ) ; if ( "function" != typeof e . mixin . create ) throw new Error ( 'Required function "create" missing on mixin' )
; for ( var C in g ) if ( y = g [ C ] , y . length ) { if ( n += " if ( " + h + e . util . getProperty ( C ) + " !== undefined " , v && ( n += " && Object.prototype.hasOwnProperty.call(" + h + ", '" + e . util . escapeQuotes ( C ) + "') " ) , c ) { n += " && ( " ; var E = y ; if ( E ) for ( var b , F = - 1 , x = E . length - 1 ; F < x ; ) { b = E [ F += 1 ] , F && ( n += " || " ) ; var S = e . util . getProperty ( b ) , $ = h + S ; n += " ( ( " + $ + " === undefined " , v && ( n += " || ! Object.prototype.hasOwnProperty.call(" + h + ", '" + e . util . escapeQuotes ( b ) + "') " ) , n += ") && (missing" + r + " = " + e . util . toQuotedString ( e . opts . jsonPointers ? b : S ) + ") ) " } n += ")) { " ; var D = "missing" + r , k = "' + " + D + " + '" ; e . opts . _errorDataPathProperty && ( e . errorPath = e . opts . jsonPointers ? e . util . getPathExpr ( A , D , ! 0 ) : A + " + " + D ) ; var B = B || [ ] ; B . push ( n ) , n = "" , ! 1 !== e . createErrors ? ( n += " { keyword: 'dependencies' , dataPath: (dataPath || '') + " + e . errorPath + " , schemaPath: " + e . util . toQuotedString ( l ) + " , params: { property: '" + e . util . escapeQuotes ( C ) + "', missingProperty: '" + k + "', depsCount: " + y . length + ", deps: '" + e . util . escapeQuotes ( 1 == y . length ? y [ 0 ] : y . join ( ", " ) ) + "' } " , ! 1 !== e . opts . messages && ( n += " , message: 'should have " , 1 == y . length ? n += "property " + e . util . escapeQuotes ( y [ 0 ] ) : n += "properties " + e . util . escapeQuotes ( y . join ( ", " ) ) , n += " when property " + e . util . escapeQuotes ( C ) + " is present' " ) , e . opts . verbose && ( n += " , schema: validate.schema" + a + " , parentSchema: validate.schema" + e . schemaPath + " , data: " + h + " " ) , n += " } " ) : n += " {} " ; var _ = n ; n = B . pop ( ) , ! e . compositeRule && c ? e . async ? n += " throw new ValidationError([" + _ + "]); " : n += " validate.errors = [" + _ + "]; return false; " : n += " var err = " + _ + "; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; " } else { n += " ) { " ; var L = y ; if ( L ) for ( var b , R = - 1 , T = L . length - 1 ; R < T ; ) { b = L [ R += 1 ] ; var S = e . util . getProperty ( b ) , k = e . util . escapeQuotes ( b ) , $ = h + S ; e . opts . _errorDataPathProperty && ( e . errorPath = e . util . getPath ( A , b , e . opts . jsonPointers ) ) , n += " if ( " + $ + " === undefined " , v && ( n += " || ! Object.prototype.hasOwnProperty.call(" + h + ", '" + e . util . escapeQuotes ( b ) + "') " ) , n += ") { var err = " , ! 1 !== e . createErrors ? ( n += " { keyword: 'dependencies' , dataPath: (dataPath || '') + " + e . errorPath + " , schemaPath: " + e . util . toQuotedString ( l ) + " , params: { property: '" + e . util . escapeQuotes ( C ) + "', missingProperty: '" + k + "', depsCount: " + y . length + ", deps: '" + e . util . escapeQuotes ( 1 == y . length ? y [ 0 ] : y . join ( ", " ) ) + "' } " , ! 1 !== e . opts . messages && ( n += " , message: 'should have " , 1 == y . length ? n += "property " + e . util . escapeQuotes ( y [ 0 ] ) : n += "properties " + e . util . escapeQuotes ( y . join ( ", " ) ) , n += " when property " + e . util . escapeQuotes ( C ) + " is present' " ) , e . opts . verbose && ( n += " , schema: validate.schema" + a + " , parentSchema: validate.schema" + e . schemaPath + " , data: " + h + " " ) , n += " } " ) : n += " {} " , n += "; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } " } } n += " } " , c && ( f += "}" , n += " else { " ) } e . errorPath = A ; var P = u . baseId ; for ( var C in m ) { var w = m [ C ] ; e . util . schemaHasRules ( w , e . RULES . all ) && ( n += " " + p + " = true; if ( " + h + e . util . getProperty ( C ) + " !== undefined " , v && ( n += " && Object.prototype.hasOwnProperty.call(" + h + ", '" + e . util . escapeQuotes ( C ) + "') " ) , n += ") { " , u . schema = w , u . schemaPath = a + e . util . getProperty ( C ) , u . errSchemaPath = l + "/" + e . util . escapeFragment ( C ) , n += " " + e . validate ( u ) + " " , u . baseId = P , n += " } " , c && ( n += " if (" + p + ") { " , f += "}" ) ) } return c && ( n += " " + f + " if (" + d + " == errors) {" ) , n = e . util . cleanUpCode ( n ) } } , function ( e , t ) { "use strict" ; e . exports = function ( e , t , i ) { var n = " " , r = e . level , o = e . dataLevel , s = e . schema [ t ] , a = e . schemaPath + e . util . getProperty ( t ) , l = e . errSchemaPath + "/" + t , c = ! e . opts . allErrors , h = "data" + ( o || "" ) , d = "valid" + r , u = e . opts . $data && s && s . $data ; u && ( n += " var schema" + r + " = " + e . util . getData ( s . $data , o , e . dataPathArr ) + "; " ) ; var f = "i" + r , p = "schema" + r ; u || ( n += " var " + p + " = validate.schema" + a + ";" ) , n += "var " + d + ";" , u && ( n += " if (schema" + r + " === undefined) " + d + " = true; else if (!Array.isArray(schema" + r + ")) " + d + " = false; else {" ) , n += d + " = false;for (var " + f + "=0; " + f + "<" + p + ".length; " + f + "++) if (equal(" + h + ", " + p + "[" + f + "])) { " + d + " = true; break; }" , u && ( n += " } " ) , n += " if (!" + d + ") { " ; var m = m || [ ] ; m . push ( n ) , n = "" , ! 1 !== e . createErrors ? ( n += " { keyword: 'enum' , dataPath: (dataPath || '') + " + e . errorPath + " , schemaPath: " + e . util . toQuotedString ( l ) + " , param
m . _onMultiSelect = function ( e ) { if ( e . preventDefault ( ) , this . _updateDragDistance ( e ) , e . hasMoved ) { var t = l . getNodeFromTarget ( e . target ) ; t && ( null == this . multiselection . start && ( this . multiselection . start = t ) , this . multiselection . end = t ) , this . deselect ( ) ; var i = this . multiselection . start , n = this . multiselection . end || this . multiselection . start ; if ( i && n ) { if ( this . multiselection . nodes = this . _findTopLevelNodes ( i , n ) , this . multiselection . nodes && this . multiselection . nodes . length ) { var r = this . multiselection . nodes [ 0 ] ; this . multiselection . start === r || this . multiselection . start . isDescendantOf ( r ) ? this . multiselection . direction = "down" : this . multiselection . direction = "up" } this . select ( this . multiselection . nodes ) } } } , m . _onMultiSelectEnd = function ( e ) { this . multiselection . nodes [ 0 ] && this . multiselection . nodes [ 0 ] . dom . menu . focus ( ) , this . multiselection . start = null , this . multiselection . end = null , this . mousemove && ( h . removeEventListener ( window , "mousemove" , this . mousemove ) , delete this . mousemove ) , this . mouseup && ( h . removeEventListener ( window , "mouseup" , this . mouseup ) , delete this . mouseup ) } , m . deselect = function ( e ) { var t = ! ! this . multiselection . nodes . length ; this . multiselection . nodes . forEach ( function ( e ) { e . setSelected ( ! 1 ) } ) , this . multiselection . nodes = [ ] , e && ( this . multiselection . start = null , this . multiselection . end = null ) , t && this . _selectionChangedHandler && this . _selectionChangedHandler ( ) } , m . select = function ( e ) { if ( ! Array . isArray ( e ) ) return this . select ( [ e ] ) ; if ( e ) { this . deselect ( ) , this . multiselection . nodes = e . slice ( 0 ) ; var t = e [ 0 ] ; if ( e . forEach ( function ( e ) { e . setSelected ( ! 0 , e === t ) } ) , this . _selectionChangedHandler ) { var i = this . getSelection ( ) ; this . _selectionChangedHandler ( i . start , i . end ) } } } , m . _findTopLevelNodes = function ( e , t ) { for ( var i = e . getNodePath ( ) , n = t . getNodePath ( ) , r = 0 ; r < i . length && i [ r ] === n [ r ] ; ) r ++ ; var o = i [ r - 1 ] , s = i [ r ] , a = n [ r ] ; if ( s && a || ( o . parent ? ( s = o , a = o , o = o . parent ) : ( s = o . childs [ 0 ] , a = o . childs [ o . childs . length - 1 ] ) ) , o && s && a ) { var l = o . childs . indexOf ( s ) , c = o . childs . indexOf ( a ) , h = Math . min ( l , c ) , d = Math . max ( l , c ) ; return o . childs . slice ( h , d + 1 ) } return [ ] } , m . _onKeyDown = function ( e ) { var t = e . which || e . keyCode , i = e . altKey , n = e . ctrlKey , r = e . metaKey , o = e . shiftKey , s = ! 1 ; if ( 9 == t ) { var a = this ; setTimeout ( function ( ) { h . selectContentEditable ( a . focusTarget ) } , 0 ) } if ( this . searchBox ) if ( n && 70 == t ) this . searchBox . dom . search . focus ( ) , this . searchBox . dom . search . select ( ) , s = ! 0 ; else if ( 114 == t || n && 71 == t ) { o ? this . searchBox . previous ( ! 0 ) : this . searchBox . next ( ! 0 ) , s = ! 0 } if ( this . history && ( n && ! o && 90 == t ? ( this . _onUndo ( ) , s = ! 0 ) : n && o && 90 == t && ( this . _onRedo ( ) , s = ! 0 ) ) , this . options . autocomplete && ! s && ! ( n || i || r || 1 != e . key . length && 8 != t && 46 != t ) ) { s = ! 1 ; var c = "" ; e . target . className . indexOf ( "jsoneditor-value" ) >= 0 && ( c = "value" ) , e . target . className . indexOf ( "jsoneditor-field" ) >= 0 && ( c = "field" ) ; var d = l . getNodeFromTarget ( e . target ) ; setTimeout ( function ( e , t ) { if ( t . innerText . length > 0 ) { var i = this . options . autocomplete . getOptions ( t . innerText , e . getPath ( ) , c , e . editor ) ; null === i ? this . autocomplete . hideDropDown ( ) : "function" == typeof i . then ? i . then ( function ( e ) { null === e ? this . autocomplete . hideDropDown ( ) : e . options ? this . autocomplete . show ( t , e . startFrom , e . options ) : this . autocomplete . show ( t , 0 , e ) } . bind ( this ) ) : i . options ? this . autocomplete . show ( t , i . startFrom , i . options ) : this . autocomplete . show ( t , 0 , i ) } else this . autocomplete . hideDropDown ( ) } . bind ( this , d , e . target ) , 50 ) } s && ( e . preventDefault ( ) , e . stopPropagation ( ) ) } , m . _createTable = function ( ) { var e = document . createElement ( "div" ) ; e . className = "jsoneditor-outer" , this . options . navigationBar && h . addClassName ( e , "has-nav-bar" ) , this . contentOuter = e , this . content = document . createElement ( "div" ) , this . content . className = "jsoneditor-tree" , e . appendChild ( this . content ) , this . table = document . createElement ( "table" ) , this . table . className = "jsoneditor-tree" , this . content . appendChild ( this . table ) ; var t ; this . colgroupContent = document . createElement ( "colgroup" ) , "tree" === this . options . mode && ( t = document . createElement ( "col" ) , t . width = "24px" , this . colgroupContent . appendChild ( t ) ) , t = document . createElement ( "col" ) , t . width = "24px" , this . colgroupContent . appendChild ( t ) , t = document . createElement ( "col" ) , this . colgroupContent . appendChild ( t ) , this . table . appendChild ( this . colgroupContent ) , this . tbody = document . createElement ( "tbody" ) , this . table . appendChild ( this . tbody ) , this
; var t = e . oneOf || e . anyOf || e . allOf ; if ( t ) { var i = t . filter ( function ( e ) { return e . enum } ) ; if ( i . length > 0 ) return i [ 0 ] . enum } return null } , n . _findSchema = function ( e , t ) { var i = e , r = i , o = e . oneOf || e . anyOf || e . allOf ; o || ( o = [ e ] ) ; for ( var s = 0 ; s < o . length ; s ++ ) { i = o [ s ] ; for ( var a = 0 ; a < t . length && i ; a ++ ) { var l = t [ a ] ; if ( "string" == typeof l && i . patternProperties && a == t . length - 1 ) for ( var c in i . patternProperties ) r = n . _findSchema ( i . patternProperties [ c ] , t . slice ( a , t . length ) ) ; else i . items && i . items . properties ? ( i = i . items . properties [ l ] ) && ( r = n . _findSchema ( i , t . slice ( a , t . length ) ) ) : "string" == typeof l && i . properties ? ( i = i . properties [ l ] || null ) && ( r = n . _findSchema ( i , t . slice ( a , t . length ) ) ) : "number" == typeof l && i . items && ( i = i . items ) && ( r = n . _findSchema ( i , t . slice ( a , t . length ) ) ) } } return r } , n . prototype . _updateDomIndexes = function ( ) { var e = this . dom . value , t = this . childs ; e && t && ( "array" == this . type ? t . forEach ( function ( e , t ) { e . index = t ; var i = e . dom . field ; i && ( i . innerHTML = t ) } ) : "object" == this . type && t . forEach ( function ( e ) { void 0 != e . index && ( delete e . index , void 0 == e . field && ( e . field = "" ) ) } ) ) } , n . prototype . _createDomValue = function ( ) { var e ; return "array" == this . type ? ( e = document . createElement ( "div" ) , e . innerHTML = "[...]" ) : "object" == this . type ? ( e = document . createElement ( "div" ) , e . innerHTML = "{...}" ) : ! this . editable . value && a . isUrl ( this . value ) ? ( e = document . createElement ( "a" ) , e . href = this . value , e . innerHTML = this . _escapeHTML ( this . value ) ) : ( e = document . createElement ( "div" ) , e . contentEditable = this . editable . value , e . spellcheck = ! 1 , e . innerHTML = this . _escapeHTML ( this . value ) ) , e } , n . prototype . _createDomExpandButton = function ( ) { var e = document . createElement ( "button" ) ; return e . type = "button" , this . _hasChilds ( ) ? ( e . className = this . expanded ? "jsoneditor-expanded" : "jsoneditor-collapsed" , e . title = l ( "expandTitle" ) ) : ( e . className = "jsoneditor-invisible" , e . title = "" ) , e } , n . prototype . _createDomTree = function ( ) { var e = this . dom , t = document . createElement ( "table" ) , i = document . createElement ( "tbody" ) ; t . style . borderCollapse = "collapse" , t . className = "jsoneditor-values" , t . appendChild ( i ) ; var n = document . createElement ( "tr" ) ; i . appendChild ( n ) ; var r = document . createElement ( "td" ) ; r . className = "jsoneditor-tree" , n . appendChild ( r ) , e . expand = this . _createDomExpandButton ( ) , r . appendChild ( e . expand ) , e . tdExpand = r ; var o = document . createElement ( "td" ) ; o . className = "jsoneditor-tree" , n . appendChild ( o ) , e . field = this . _createDomField ( ) , o . appendChild ( e . field ) , e . tdField = o ; var s = document . createElement ( "td" ) ; s . className = "jsoneditor-tree" , n . appendChild ( s ) , "object" != this . type && "array" != this . type && ( s . appendChild ( document . createTextNode ( ":" ) ) , s . className = "jsoneditor-separator" ) , e . tdSeparator = s ; var a = document . createElement ( "td" ) ; return a . className = "jsoneditor-tree" , n . appendChild ( a ) , e . value = this . _createDomValue ( ) , a . appendChild ( e . value ) , e . tdValue = a , t } , n . prototype . onEvent = function ( e ) { var t = e . type , i = e . target || e . srcElement , n = this . dom , r = this , o = this . _hasChilds ( ) ; if ( i != n . drag && i != n . menu || ( "mouseover" == t ? this . editor . highlighter . highlight ( this ) : "mouseout" == t && this . editor . highlighter . unhighlight ( ) ) , "click" == t && i == n . menu ) { var s = r . editor . highlighter ; s . highlight ( r ) , s . lock ( ) , a . addClassName ( n . menu , "jsoneditor-selected" ) , this . showContextMenu ( n . menu , function ( ) { a . removeClassName ( n . menu , "jsoneditor-selected" ) , s . unlock ( ) , s . unhighlight ( ) } ) } if ( "click" == t && ( i == n . expand || ( "view" === r . editor . options . mode || "form" === r . editor . options . mode ) && "DIV" === i . nodeName ) && o ) { var l = e . ctrlKey ; this . _onExpand ( l ) } "change" == t && i == n . checkbox && ( this . dom . value . innerHTML = ! this . value , this . _getDomValue ( ) ) , "change" == t && i == n . select && ( this . dom . value . innerHTML = n . select . value , this . _getDomValue ( ) , this . _updateDomValue ( ) ) ; var c = n . value ; if ( i == c ) switch ( t ) { case "blur" : case "change" : this . _getDomValue ( ! 0 ) , this . _updateDomValue ( ) , this . value && ( c . innerHTML = this . _escapeHTML ( this . value ) ) ; break ; case "input" : this . _getDomValue ( ! 0 ) , this . _updateDomValue ( ) ; break ; case "keydown" : case "mousedown" : this . editor . selection = this . editor . getDomSelection ( ) ; break ; case "click" : e . ctrlKey && this . editable . value && a . isUrl ( this . value ) && ( e . preventDefault ( ) , window . open ( this . value , "_blank" ) ) ; break ; case "keyup" : this . _getDomValue ( ! 0 ) , this . _updateDomValue ( ) ; break ; case "cut" : case "paste" : setTimeout ( function ( ) { r . _getDomValue ( ! 0 ) , r . _update
t . nextFrame ? t . nextFrame = t . nextFrame . bind ( window ) : t . nextFrame = function ( e ) { setTimeout ( e , 17 ) } } ) , ace . define ( "ace/lib/lang" , [ "require" , "exports" , "module" ] , function ( e , t , i ) { "use strict" ; t . last = function ( e ) { return e [ e . length - 1 ] } , t . stringReverse = function ( e ) { return e . split ( "" ) . reverse ( ) . join ( "" ) } , t . stringRepeat = function ( e , t ) { for ( var i = "" ; t > 0 ; ) 1 & t && ( i += e ) , ( t >>= 1 ) && ( e += e ) ; return i } ; t . stringTrimLeft = function ( e ) { return e . replace ( /^\s\s*/ , "" ) } , t . stringTrimRight = function ( e ) { return e . replace ( /\s\s*$/ , "" ) } , t . copyObject = function ( e ) { var t = { } ; for ( var i in e ) t [ i ] = e [ i ] ; return t } , t . copyArray = function ( e ) { for ( var t = [ ] , i = 0 , n = e . length ; i < n ; i ++ ) e [ i ] && "object" == typeof e [ i ] ? t [ i ] = this . copyObject ( e [ i ] ) : t [ i ] = e [ i ] ; return t } , t . deepCopy = function e ( t ) { if ( "object" != typeof t || ! t ) return t ; var i ; if ( Array . isArray ( t ) ) { i = [ ] ; for ( var n = 0 ; n < t . length ; n ++ ) i [ n ] = e ( t [ n ] ) ; return i } if ( "[object Object]" !== Object . prototype . toString . call ( t ) ) return t ; i = { } ; for ( var n in t ) i [ n ] = e ( t [ n ] ) ; return i } , t . arrayToMap = function ( e ) { for ( var t = { } , i = 0 ; i < e . length ; i ++ ) t [ e [ i ] ] = 1 ; return t } , t . createMap = function ( e ) { var t = Object . create ( null ) ; for ( var i in e ) t [ i ] = e [ i ] ; return t } , t . arrayRemove = function ( e , t ) { for ( var i = 0 ; i <= e . length ; i ++ ) t === e [ i ] && e . splice ( i , 1 ) } , t . escapeRegExp = function ( e ) { return e . replace ( /([.*+?^${}()|[\]\/\\])/g , "\\$1" ) } , t . escapeHTML = function ( e ) { return e . replace ( /&/g , "&" ) . replace ( /"/g , """ ) . replace ( /'/g , "'" ) . replace ( /</g , "<" ) } , t . getMatchOffsets = function ( e , t ) { var i = [ ] ; return e . replace ( t , function ( e ) { i . push ( { offset : arguments [ arguments . length - 2 ] , length : e . length } ) } ) , i } , t . deferredCall = function ( e ) { var t = null , i = function ( ) { t = null , e ( ) } , n = function ( e ) { return n . cancel ( ) , t = setTimeout ( i , e || 0 ) , n } ; return n . schedule = n , n . call = function ( ) { return this . cancel ( ) , e ( ) , n } , n . cancel = function ( ) { return clearTimeout ( t ) , t = null , n } , n . isPending = function ( ) { return t } , n } , t . delayedCall = function ( e , t ) { var i = null , n = function ( ) { i = null , e ( ) } , r = function ( e ) { null == i && ( i = setTimeout ( n , e || t ) ) } ; return r . delay = function ( e ) { i && clearTimeout ( i ) , i = setTimeout ( n , e || t ) } , r . schedule = r , r . call = function ( ) { this . cancel ( ) , e ( ) } , r . cancel = function ( ) { i && clearTimeout ( i ) , i = null } , r . isPending = function ( ) { return i } , r } } ) , ace . define ( "ace/keyboard/textinput_ios" , [ "require" , "exports" , "module" , "ace/lib/event" , "ace/lib/useragent" , "ace/lib/dom" , "ace/lib/lang" , "ace/lib/keys" ] , function ( e , t , i ) { "use strict" ; var n = e ( "../lib/event" ) , r = e ( "../lib/useragent" ) , o = e ( "../lib/dom" ) , s = e ( "../lib/lang" ) , a = e ( "../lib/keys" ) , l = a . KEY _MODS , c = r . isChrome < 18 , h = r . isIE , d = function ( e , t ) { function i ( e ) { if ( ! w ) { if ( w = ! 0 , S ) t = 0 , i = e ? 0 : f . value . length - 1 ; else var t = 4 , i = 5 ; try { f . setSelectionRange ( t , i ) } catch ( e ) { } w = ! 1 } } function d ( ) { w || ( f . value = p , r . isWebKit && b . schedule ( ) ) } function u ( ) { clearTimeout ( N ) , N = setTimeout ( function ( ) { y && ( f . style . cssText = y , y = "" ) , null == t . renderer . $keepTextAreaAtCursor && ( t . renderer . $keepTextAreaAtCursor = ! 0 , t . renderer . $moveTextAreaToCursor ( ) ) } , 0 ) } var f = o . createElement ( "textarea" ) ; f . className = r . isIOS ? "ace_text-input ace_text-input-ios" : "ace_text-input" , r . isTouchPad && f . setAttribute ( "x-palm-disable-auto-cap" , ! 0 ) , f . setAttribute ( "wrap" , "off" ) , f . setAttribute ( "autocorrect" , "off" ) , f . setAttribute ( "autocapitalize" , "off" ) , f . setAttribute ( "spellcheck" , ! 1 ) , f . style . opacity = "0" , e . insertBefore ( f , e . firstChild ) ; var p = "\n aaaa a\n" , m = ! 1 , g = ! 1 , v = ! 1 , w = ! 1 , y = "" , A = ! 0 ; try { var C = document . activeElement === f } catch ( e ) { } n . addListener ( f , "blur" , function ( e ) { t . onBlur ( e ) , C = ! 1 } ) , n . addListener ( f , "focus" , function ( e ) { C = ! 0 , t . onFocus ( e ) , i ( ) } ) , this . focus = function ( ) { if ( y ) return f . focus ( ) ; f . style . position = "fixed" , f . focus ( ) } , this . blur = function ( ) { f . blur ( ) } , this . isFocused = function ( ) { return C } ; var E = s . delayedCall ( function ( ) { C && i ( A ) } ) , b = s . delayedCall ( function ( ) { w || ( f . value = p , C && i ( ) ) } ) ; r . isWebKit || t . addEventListener ( "changeSelection" , function ( ) { t . selection . isEmpty ( ) != A && ( A = ! A , E . schedule ( ) ) } ) , d ( ) , C && t . onFocus ( ) ; var F = function ( e ) { return 0 === e . selectionStart && e . selectionEnd === e . value . length } , x = function ( e ) { F ( f ) ? ( t . selectAll ( ) , i ( ) ) : S && i ( t . selection . isEmpty ( ) ) } , S = null ; this . setInputHandler = function ( e ) { S = e } , this . getInputHandler = function ( ) { return S } ; var $ = ! 1 , D = function ( e ) { 4 === f . selectionStart && 5 === f . selectionEnd || ( S && ( e = S ( e ) , S = null ) , v ? ( i ( ) , e && t . onPa
for ( ; ( t = e [ i ] ) && n . test ( t ) ; ) i ++ ; if ( i < 1 ) for ( r . lastIndex = 0 ; ( t = e [ i ] ) && ! r . test ( t ) ; ) if ( r . lastIndex = 0 , i ++ , n . test ( t ) ) { if ( i > 2 ) { i -- ; break } for ( ; ( t = e [ i ] ) && n . test ( t ) ; ) i ++ ; if ( i > 2 ) break } } return r . lastIndex = 0 , i } , this . moveCursorShortWordRight = function ( ) { var e = this . lead . row , t = this . lead . column , i = this . doc . getLine ( e ) , n = i . substring ( t ) , r = this . session . getFoldAt ( e , t , 1 ) ; if ( r ) return this . moveCursorTo ( r . end . row , r . end . column ) ; if ( t == i . length ) { var o = this . doc . getLength ( ) ; do { e ++ , n = this . doc . getLine ( e ) } while ( e < o && /^\s*$/ . test ( n ) ) ; /^\s+/ . test ( n ) || ( n = "" ) , t = 0 } var s = this . $shortWordEndIndex ( n ) ; this . moveCursorTo ( e , t + s ) } , this . moveCursorShortWordLeft = function ( ) { var e , t = this . lead . row , i = this . lead . column ; if ( e = this . session . getFoldAt ( t , i , - 1 ) ) return this . moveCursorTo ( e . start . row , e . start . column ) ; var n = this . session . getLine ( t ) . substring ( 0 , i ) ; if ( 0 === i ) { do { t -- , n = this . doc . getLine ( t ) } while ( t > 0 && /^\s*$/ . test ( n ) ) ; i = n . length , /\s+$/ . test ( n ) || ( n = "" ) } var o = r . stringReverse ( n ) , s = this . $shortWordEndIndex ( o ) ; return this . moveCursorTo ( t , i - s ) } , this . moveCursorWordRight = function ( ) { this . session . $selectLongWords ? this . moveCursorLongWordRight ( ) : this . moveCursorShortWordRight ( ) } , this . moveCursorWordLeft = function ( ) { this . session . $selectLongWords ? this . moveCursorLongWordLeft ( ) : this . moveCursorShortWordLeft ( ) } , this . moveCursorBy = function ( e , t ) { var i , n = this . session . documentToScreenPosition ( this . lead . row , this . lead . column ) ; 0 === t && ( 0 !== e && ( this . session . $bidiHandler . isBidiRow ( n . row , this . lead . row ) ? ( i = this . session . $bidiHandler . getPosLeft ( n . column ) , n . column = Math . round ( i / this . session . $bidiHandler . charWidths [ 0 ] ) ) : i = n . column * this . session . $bidiHandler . charWidths [ 0 ] ) , this . $desiredColumn ? n . column = this . $desiredColumn : this . $desiredColumn = n . column ) ; var r = this . session . screenToDocumentPosition ( n . row + e , n . column , i ) ; 0 !== e && 0 === t && r . row === this . lead . row && r . column === this . lead . column && this . session . lineWidgets && this . session . lineWidgets [ r . row ] && ( r . row > 0 || e > 0 ) && r . row ++ , this . moveCursorTo ( r . row , r . column + t , 0 === t ) } , this . moveCursorToPosition = function ( e ) { this . moveCursorTo ( e . row , e . column ) } , this . moveCursorTo = function ( e , t , i ) { var n = this . session . getFoldAt ( e , t , 1 ) ; n && ( e = n . start . row , t = n . start . column ) , this . $keepDesiredColumnOnChange = ! 0 ; var r = this . session . getLine ( e ) ; /[\uDC00-\uDFFF]/ . test ( r . charAt ( t ) ) && r . charAt ( t - 1 ) && ( this . lead . row == e && this . lead . column == t + 1 ? t -= 1 : t += 1 ) , this . lead . setPosition ( e , t ) , this . $keepDesiredColumnOnChange = ! 1 , i || ( this . $desiredColumn = null ) } , this . moveCursorToScreen = function ( e , t , i ) { var n = this . session . screenToDocumentPosition ( e , t ) ; this . moveCursorTo ( n . row , n . column , i ) } , this . detach = function ( ) { this . lead . detach ( ) , this . anchor . detach ( ) , this . session = this . doc = null } , this . fromOrientedRange = function ( e ) { this . setSelectionRange ( e , e . cursor == e . start ) , this . $desiredColumn = e . desiredColumn || this . $desiredColumn } , this . toOrientedRange = function ( e ) { var t = this . getRange ( ) ; return e ? ( e . start . column = t . start . column , e . start . row = t . start . row , e . end . column = t . end . column , e . end . row = t . end . row ) : e = t , e . cursor = this . isBackwards ( ) ? e . start : e . end , e . desiredColumn = this . $desiredColumn , e } , this . getRangeOfMovements = function ( e ) { var t = this . getCursor ( ) ; try { e ( this ) ; var i = this . getCursor ( ) ; return s . fromPoints ( t , i ) } catch ( e ) { return s . fromPoints ( t , t ) } finally { this . moveCursorToPosition ( t ) } } , this . toJSON = function ( ) { if ( this . rangeCount ) var e = this . ranges . map ( function ( e ) { var t = e . clone ( ) ; return t . isBackwards = e . cursor == e . start , t } ) ; else { var e = this . getRange ( ) ; e . isBackwards = this . isBackwards ( ) } return e } , this . fromJSON = function ( e ) { if ( void 0 == e . start ) { if ( this . rangeList ) { this . toSingleRange ( e [ 0 ] ) ; for ( var t = e . length ; t -- ; ) { var i = s . fromPoints ( e [ t ] . start , e [ t ] . end ) ; e [ t ] . isBackwards && ( i . cursor = i . start ) , this . addRange ( i , ! 0 ) } return } e = e [ 0 ] } this . rangeList && this . toSingleRange ( e ) , this . setSelectionRange ( e , e . isBackwards ) } , this . isEqual = function ( e ) { if ( ( e . length || this . rangeCount ) && e . length != this . rangeCount ) return ! 1 ; if ( ! e . length || ! this . ranges ) return this . getRange ( ) . isEqual ( e ) ; for ( var t = this . ranges . length ; t -- ; ) if ( ! this . ranges [ t ] . isEqual ( e [ t ] ) ) return ! 1 ; return ! 0 } } ) . call ( a . prototype ) , t . Selection = a } ) , ace . define ( "ace/tokenizer" , [ "require" , "exports" , "module" , "ace/config" ] , function ( e , t , i ) { "use strict" ; var n = e ( "./config" ) , r = 2e3 , o = function ( e ) { t
- 1 == ( r = n . range . compareStart ( t , i ) ) ) return void e ( null , t , i , s , l ) ; if ( o = e ( null , n . start . row , n . start . column , s , l ) , ( o = ! o && e ( n . placeholder , n . start . row , n . start . column , s ) ) || 0 === r ) return ; l = ! n . sameRow , s = n . end . column } e ( null , t , i , s , l ) } , this . getNextFoldTo = function ( e , t ) { for ( var i , n , r = 0 ; r < this . folds . length ; r ++ ) { if ( i = this . folds [ r ] , - 1 == ( n = i . range . compareEnd ( e , t ) ) ) return { fold : i , kind : "after" } ; if ( 0 === n ) return { fold : i , kind : "inside" } } return null } , this . addRemoveChars = function ( e , t , i ) { var n , r , o = this . getNextFoldTo ( e , t ) ; if ( o ) if ( n = o . fold , "inside" == o . kind && n . start . column != t && n . start . row != e ) window . console && window . console . log ( e , t , n ) ; else if ( n . start . row == e ) { r = this . folds ; var s = r . indexOf ( n ) ; for ( 0 === s && ( this . start . column += i ) , s ; s < r . length ; s ++ ) { if ( n = r [ s ] , n . start . column += i , ! n . sameRow ) return ; n . end . column += i } this . end . column += i } } , this . split = function ( e , t ) { var i = this . getNextFoldTo ( e , t ) ; if ( ! i || "inside" == i . kind ) return null ; var r = i . fold , o = this . folds , s = this . foldData , a = o . indexOf ( r ) , l = o [ a - 1 ] ; this . end . row = l . end . row , this . end . column = l . end . column , o = o . splice ( a , o . length - a ) ; var c = new n ( s , o ) ; return s . splice ( s . indexOf ( this ) + 1 , 0 , c ) , c } , this . merge = function ( e ) { for ( var t = e . folds , i = 0 ; i < t . length ; i ++ ) this . addFold ( t [ i ] ) ; var n = this . foldData ; n . splice ( n . indexOf ( e ) , 1 ) } , this . toString = function ( ) { var e = [ this . range . toString ( ) + ": [" ] ; return this . folds . forEach ( function ( t ) { e . push ( " " + t . toString ( ) ) } ) , e . push ( "]" ) , e . join ( "\n" ) } , this . idxToPosition = function ( e ) { for ( var t = 0 , i = 0 ; i < this . folds . length ; i ++ ) { var n = this . folds [ i ] ; if ( ( e -= n . start . column - t ) < 0 ) return { row : n . start . row , column : n . start . column + e } ; if ( ( e -= n . placeholder . length ) < 0 ) return n . start ; t = n . end . column } return { row : this . end . row , column : this . end . column + e } } } ) . call ( n . prototype ) , t . FoldLine = n } ) , ace . define ( "ace/range_list" , [ "require" , "exports" , "module" , "ace/range" ] , function ( e , t , i ) { "use strict" ; var n = e ( "./range" ) . Range , r = n . comparePoints , o = function ( ) { this . ranges = [ ] } ; ( function ( ) { this . comparePoints = r , this . pointIndex = function ( e , t , i ) { for ( var n = this . ranges , o = i || 0 ; o < n . length ; o ++ ) { var s = n [ o ] , a = r ( e , s . end ) ; if ( ! ( a > 0 ) ) { var l = r ( e , s . start ) ; return 0 === a ? t && 0 !== l ? - o - 2 : o : l > 0 || 0 === l && ! t ? o : - o - 1 } } return - o - 1 } , this . add = function ( e ) { var t = ! e . isEmpty ( ) , i = this . pointIndex ( e . start , t ) ; i < 0 && ( i = - i - 1 ) ; var n = this . pointIndex ( e . end , t , i ) ; return n < 0 ? n = - n - 1 : n ++ , this . ranges . splice ( i , n - i , e ) } , this . addList = function ( e ) { for ( var t = [ ] , i = e . length ; i -- ; ) t . push . apply ( t , this . add ( e [ i ] ) ) ; return t } , this . substractPoint = function ( e ) { var t = this . pointIndex ( e ) ; if ( t >= 0 ) return this . ranges . splice ( t , 1 ) } , this . merge = function ( ) { var e = [ ] , t = this . ranges ; t = t . sort ( function ( e , t ) { return r ( e . start , t . start ) } ) ; for ( var i , n = t [ 0 ] , o = 1 ; o < t . length ; o ++ ) { i = n , n = t [ o ] ; var s = r ( i . end , n . start ) ; s < 0 || ( 0 != s || i . isEmpty ( ) || n . isEmpty ( ) ) && ( r ( i . end , n . end ) < 0 && ( i . end . row = n . end . row , i . end . column = n . end . column ) , t . splice ( o , 1 ) , e . push ( n ) , n = i , o -- ) } return this . ranges = t , e } , this . contains = function ( e , t ) { return this . pointIndex ( { row : e , column : t } ) >= 0 } , this . containsPoint = function ( e ) { return this . pointIndex ( e ) >= 0 } , this . rangeAtPoint = function ( e ) { var t = this . pointIndex ( e ) ; if ( t >= 0 ) return this . ranges [ t ] } , this . clipRows = function ( e , t ) { var i = this . ranges ; if ( i [ 0 ] . start . row > t || i [ i . length - 1 ] . start . row < e ) return [ ] ; var n = this . pointIndex ( { row : e , column : 0 } ) ; n < 0 && ( n = - n - 1 ) ; var r = this . pointIndex ( { row : t , column : 0 } , n ) ; r < 0 && ( r = - r - 1 ) ; for ( var o = [ ] , s = n ; s < r ; s ++ ) o . push ( i [ s ] ) ; return o } , this . removeAll = function ( ) { return this . ranges . splice ( 0 , this . ranges . length ) } , this . attach = function ( e ) { this . session && this . detach ( ) , this . session = e , this . onChange = this . $onChange . bind ( this ) , this . session . on ( "change" , this . onChange ) } , this . detach = function ( ) { this . session && ( this . session . removeListener ( "change" , this . onChange ) , this . session = null ) } , this . $onChange = function ( e ) { if ( "insert" == e . action ) var t = e . start , i = e . end ; else var i = e . start , t = e . end ; for ( var n = t . row , r = i . row , o = r - n , s = - t . column + i . column , a = this . ranges , l = 0 , c = a . length ; l < c ; l ++ ) { var h = a [ l ] ; if ( ! ( h . end . row < n ) ) { if ( h . start . row > n ) break ; if ( h . start . row == n && h . start . column >= t . column && ( h . start . column == t . column && this . $insertRight || ( h . start . column += s , h . start . row += o ) ) , h . end . row == n && h . end . column >= t . column ) { if ( h . end . column == t . column && this . $insertRight ) continue ; h . end . column == t . column && s > 0 && l < c - 1 && h . end . column > h . sta
scrollIntoView : "selection" , multiSelectAction : "forEachLine" } , { name : "togglecomment" , bindKey : n ( "Ctrl-/" , "Command-/" ) , exec : function ( e ) { e . toggleCommentLines ( ) } , multiSelectAction : "forEachLine" , scrollIntoView : "selectionPart" } , { name : "toggleBlockComment" , bindKey : n ( "Ctrl-Shift-/" , "Command-Shift-/" ) , exec : function ( e ) { e . toggleBlockComment ( ) } , multiSelectAction : "forEach" , scrollIntoView : "selectionPart" } , { name : "modifyNumberUp" , bindKey : n ( "Ctrl-Shift-Up" , "Alt-Shift-Up" ) , exec : function ( e ) { e . modifyNumber ( 1 ) } , scrollIntoView : "cursor" , multiSelectAction : "forEach" } , { name : "modifyNumberDown" , bindKey : n ( "Ctrl-Shift-Down" , "Alt-Shift-Down" ) , exec : function ( e ) { e . modifyNumber ( - 1 ) } , scrollIntoView : "cursor" , multiSelectAction : "forEach" } , { name : "replace" , bindKey : n ( "Ctrl-H" , "Command-Option-F" ) , exec : function ( e ) { o . loadModule ( "ace/ext/searchbox" , function ( t ) { t . Search ( e , ! 0 ) } ) } } , { name : "undo" , bindKey : n ( "Ctrl-Z" , "Command-Z" ) , exec : function ( e ) { e . undo ( ) } } , { name : "redo" , bindKey : n ( "Ctrl-Shift-Z|Ctrl-Y" , "Command-Shift-Z|Command-Y" ) , exec : function ( e ) { e . redo ( ) } } , { name : "copylinesup" , bindKey : n ( "Alt-Shift-Up" , "Command-Option-Up" ) , exec : function ( e ) { e . copyLinesUp ( ) } , scrollIntoView : "cursor" } , { name : "movelinesup" , bindKey : n ( "Alt-Up" , "Option-Up" ) , exec : function ( e ) { e . moveLinesUp ( ) } , scrollIntoView : "cursor" } , { name : "copylinesdown" , bindKey : n ( "Alt-Shift-Down" , "Command-Option-Down" ) , exec : function ( e ) { e . copyLinesDown ( ) } , scrollIntoView : "cursor" } , { name : "movelinesdown" , bindKey : n ( "Alt-Down" , "Option-Down" ) , exec : function ( e ) { e . moveLinesDown ( ) } , scrollIntoView : "cursor" } , { name : "del" , bindKey : n ( "Delete" , "Delete|Ctrl-D|Shift-Delete" ) , exec : function ( e ) { e . remove ( "right" ) } , multiSelectAction : "forEach" , scrollIntoView : "cursor" } , { name : "backspace" , bindKey : n ( "Shift-Backspace|Backspace" , "Ctrl-Backspace|Shift-Backspace|Backspace|Ctrl-H" ) , exec : function ( e ) { e . remove ( "left" ) } , multiSelectAction : "forEach" , scrollIntoView : "cursor" } , { name : "cut_or_delete" , bindKey : n ( "Shift-Delete" , null ) , exec : function ( e ) { if ( ! e . selection . isEmpty ( ) ) return ! 1 ; e . remove ( "left" ) } , multiSelectAction : "forEach" , scrollIntoView : "cursor" } , { name : "removetolinestart" , bindKey : n ( "Alt-Backspace" , "Command-Backspace" ) , exec : function ( e ) { e . removeToLineStart ( ) } , multiSelectAction : "forEach" , scrollIntoView : "cursor" } , { name : "removetolineend" , bindKey : n ( "Alt-Delete" , "Ctrl-K|Command-Delete" ) , exec : function ( e ) { e . removeToLineEnd ( ) } , multiSelectAction : "forEach" , scrollIntoView : "cursor" } , { name : "removetolinestarthard" , bindKey : n ( "Ctrl-Shift-Backspace" , null ) , exec : function ( e ) { var t = e . selection . getRange ( ) ; t . start . column = 0 , e . session . remove ( t ) } , multiSelectAction : "forEach" , scrollIntoView : "cursor" } , { name : "removetolineendhard" , bindKey : n ( "Ctrl-Shift-Delete" , null ) , exec : function ( e ) { var t = e . selection . getRange ( ) ; t . end . column = Number . MAX _VALUE , e . session . remove ( t ) } , multiSelectAction : "forEach" , scrollIntoView : "cursor" } , { name : "removewordleft" , bindKey : n ( "Ctrl-Backspace" , "Alt-Backspace|Ctrl-Alt-Backspace" ) , exec : function ( e ) { e . removeWordLeft ( ) } , multiSelectAction : "forEach" , scrollIntoView : "cursor" } , { name : "removewordright" , bindKey : n ( "Ctrl-Delete" , "Alt-Delete" ) , exec : function ( e ) { e . removeWordRight ( ) } , multiSelectAction : "forEach" , scrollIntoView : "cursor" } , { name : "outdent" , bindKey : n ( "Shift-Tab" , "Shift-Tab" ) , exec : function ( e ) { e . blockOutdent ( ) } , multiSelectAction : "forEach" , scrollIntoView : "selectionPart" } , { name : "indent" , bindKey : n ( "Tab" , "Tab" ) , exec : function ( e ) { e . indent ( ) } , multiSelectAction : "forEach" , scrollIntoView : "selectionPart" } , { name : "blockoutdent" , bindKey : n ( "Ctrl-[" , "Ctrl-[" ) , exec : function ( e ) { e . blockOutdent ( ) } , multiSelectAction : "forEachLine" , scrollIntoView : "selectionPart" } , { name : "blockindent" , bindKey : n ( "Ctrl-]" , "Ctrl-]" ) , exec : function ( e ) { e . blockIndent ( ) } , multiSelectAction : "forEachLine" , scrollIntoView : "selectionPart" } , { name : "insertstring" , exec : function ( e , t ) { e . insert ( t ) } , multiSelectAction : "forEach" , scrollIntoView : "cursor" } , { name : "inserttext" , exec : function ( e , t ) { e . insert ( r . stringRepeat ( t . text || "" , t . times || 1 ) ) } , multiSelectAction : "forEach" , scrollIntoView : "cursor" } , { name : "splitline" , bindKey : n ( null , "Ctrl-O" ) , exec : function ( e ) { e . splitLine ( ) } , multiSelectAction : "forEach" , scrollIntoView : "cursor" } , { name : "transposeletters" , bindKey : n ( "Alt-Shift-X"
this . isVisible = ! 0 , r . removeCssClass ( this . element , "ace_hidden-cursors" ) , this . restartTimer ( ) } , this . restartTimer = function ( ) { var e = this . $updateCursors ; if ( clearInterval ( this . intervalId ) , clearTimeout ( this . timeoutId ) , this . smoothBlinking && r . removeCssClass ( this . element , "ace_smooth-blinking" ) , e ( ! 0 ) , this . isBlinking && this . blinkInterval && this . isVisible ) { this . smoothBlinking && setTimeout ( function ( ) { r . addCssClass ( this . element , "ace_smooth-blinking" ) } . bind ( this ) ) ; var t = function ( ) { this . timeoutId = setTimeout ( function ( ) { e ( ! 1 ) } , . 6 * this . blinkInterval ) } . bind ( this ) ; this . intervalId = setInterval ( function ( ) { e ( ! 0 ) , t ( ) } , this . blinkInterval ) , t ( ) } } , this . getPixelPosition = function ( e , t ) { if ( ! this . config || ! this . session ) return { left : 0 , top : 0 } ; e || ( e = this . session . selection . getCursor ( ) ) ; var i = this . session . documentToScreenPosition ( e ) ; return { left : this . $padding + ( this . session . $bidiHandler . isBidiRow ( i . row , e . row ) ? this . session . $bidiHandler . getPosLeft ( i . column ) : i . column * this . config . characterWidth ) , top : ( i . row - ( t ? this . config . firstRowScreen : 0 ) ) * this . config . lineHeight } } , this . update = function ( e ) { this . config = e ; var t = this . session . $selectionMarkers , i = 0 , n = 0 ; void 0 !== t && 0 !== t . length || ( t = [ { cursor : null } ] ) ; for ( var i = 0 , r = t . length ; i < r ; i ++ ) { var o = this . getPixelPosition ( t [ i ] . cursor , ! 0 ) ; if ( ! ( ( o . top > e . height + e . offset || o . top < 0 ) && i > 1 ) ) { var s = ( this . cursors [ n ++ ] || this . addCursor ( ) ) . style ; this . drawCursor ? this . drawCursor ( s , o , e , t [ i ] , this . session ) : ( s . left = o . left + "px" , s . top = o . top + "px" , s . width = e . characterWidth + "px" , s . height = e . lineHeight + "px" ) } } for ( ; this . cursors . length > n ; ) this . removeCursor ( ) ; var a = this . session . getOverwrite ( ) ; this . $setOverwrite ( a ) , this . $pixelPos = o , this . restartTimer ( ) } , this . drawCursor = null , this . $setOverwrite = function ( e ) { e != this . overwrite && ( this . overwrite = e , e ? r . addCssClass ( this . element , "ace_overwrite-cursors" ) : r . removeCssClass ( this . element , "ace_overwrite-cursors" ) ) } , this . destroy = function ( ) { clearInterval ( this . intervalId ) , clearTimeout ( this . timeoutId ) } } ) . call ( o . prototype ) , t . Cursor = o } ) , ace . define ( "ace/scrollbar" , [ "require" , "exports" , "module" , "ace/lib/oop" , "ace/lib/dom" , "ace/lib/event" , "ace/lib/event_emitter" ] , function ( e , t , i ) { "use strict" ; var n = e ( "./lib/oop" ) , r = e ( "./lib/dom" ) , o = e ( "./lib/event" ) , s = e ( "./lib/event_emitter" ) . EventEmitter , a = function ( e ) { this . element = r . createElement ( "div" ) , this . element . className = "ace_scrollbar ace_scrollbar" + this . classSuffix , this . inner = r . createElement ( "div" ) , this . inner . className = "ace_scrollbar-inner" , this . element . appendChild ( this . inner ) , e . appendChild ( this . element ) , this . setVisible ( ! 1 ) , this . skipEvent = ! 1 , o . addListener ( this . element , "scroll" , this . onScroll . bind ( this ) ) , o . addListener ( this . element , "mousedown" , o . preventDefault ) } ; ( function ( ) { n . implement ( this , s ) , this . setVisible = function ( e ) { this . element . style . display = e ? "" : "none" , this . isVisible = e , this . coeff = 1 } } ) . call ( a . prototype ) ; var l = function ( e , t ) { a . call ( this , e ) , this . scrollTop = 0 , this . scrollHeight = 0 , t . $scrollbarWidth = this . width = r . scrollbarWidth ( e . ownerDocument ) , this . inner . style . width = this . element . style . width = ( this . width || 15 ) + 5 + "px" , this . $minWidth = 0 } ; n . inherits ( l , a ) , function ( ) { this . classSuffix = "-v" , this . onScroll = function ( ) { if ( ! this . skipEvent ) { if ( this . scrollTop = this . element . scrollTop , 1 != this . coeff ) { var e = this . element . clientHeight / this . scrollHeight ; this . scrollTop = this . scrollTop * ( 1 - e ) / ( this . coeff - e ) } this . _emit ( "scroll" , { data : this . scrollTop } ) } this . skipEvent = ! 1 } , this . getWidth = function ( ) { return Math . max ( this . isVisible ? this . width : 0 , this . $minWidth || 0 ) } , this . setHeight = function ( e ) { this . element . style . height = e + "px" } , this . setInnerHeight = this . setScrollHeight = function ( e ) { this . scrollHeight = e , e > 32768 ? ( this . coeff = 32768 / e , e = 32768 ) : 1 != this . coeff && ( this . coeff = 1 ) , this . inner . style . height = e + "px" } , this . setScrollTop = function ( e ) { this . scrollTop != e && ( this . skipEvent = ! 0 , this . scrollTop = e , this . element . scrollTop = e * this . coeff ) } } . call ( l . prototype ) ; var c = function ( e , t ) { a . call ( this , e ) , this . scrollLeft = 0 , this . height = t . $scrollbarWidth , this . inner . style . height = this . element . style . height = ( this . height || 15 ) + 5 + "px" } ; n . inherits ( c , a ) , function ( ) { this . classSuffix = "-h" , this . onScroll = function ( ) { this . skipEvent || ( this . scrollLeft = this . element . scrollLeft , this . _emit ( "scroll" , { data : this . scrollLe
for ( var i = e . length ; i -- ; ) { var n = this . ranges . indexOf ( e [ i ] ) ; this . ranges . splice ( n , 1 ) } this . _signal ( "removeRange" , { ranges : e } ) , 0 === this . rangeCount && this . inMultiSelectMode && ( this . inMultiSelectMode = ! 1 , this . _signal ( "singleSelect" ) , this . session . $undoSelect = ! 0 , this . rangeList . detach ( this . session ) ) , ( t = t || this . ranges [ 0 ] ) && ! t . isEqual ( this . getRange ( ) ) && this . fromOrientedRange ( t ) } , this . $initRangeList = function ( ) { this . rangeList || ( this . rangeList = new a , this . ranges = [ ] , this . rangeCount = 0 ) } , this . getAllRanges = function ( ) { return this . rangeCount ? this . rangeList . ranges . concat ( ) : [ this . getRange ( ) ] } , this . splitIntoLines = function ( ) { if ( this . rangeCount > 1 ) { var e = this . rangeList . ranges , t = e [ e . length - 1 ] , i = l . fromPoints ( e [ 0 ] . start , t . end ) ; this . toSingleRange ( ) , this . setSelectionRange ( i , t . cursor == t . start ) } else { var i = this . getRange ( ) , n = this . isBackwards ( ) , r = i . start . row , o = i . end . row ; if ( r == o ) { if ( n ) var s = i . end , a = i . start ; else var s = i . start , a = i . end ; return this . addRange ( l . fromPoints ( a , a ) ) , void this . addRange ( l . fromPoints ( s , s ) ) } var c = [ ] , h = this . getLineRange ( r , ! 0 ) ; h . start . column = i . start . column , c . push ( h ) ; for ( var d = r + 1 ; d < o ; d ++ ) c . push ( this . getLineRange ( d , ! 0 ) ) ; h = this . getLineRange ( o , ! 0 ) , h . end . column = i . end . column , c . push ( h ) , c . forEach ( this . addRange , this ) } } , this . toggleBlockSelection = function ( ) { if ( this . rangeCount > 1 ) { var e = this . rangeList . ranges , t = e [ e . length - 1 ] , i = l . fromPoints ( e [ 0 ] . start , t . end ) ; this . toSingleRange ( ) , this . setSelectionRange ( i , t . cursor == t . start ) } else { var n = this . session . documentToScreenPosition ( this . selectionLead ) , r = this . session . documentToScreenPosition ( this . selectionAnchor ) ; this . rectangularRangeBlock ( n , r ) . forEach ( this . addRange , this ) } } , this . rectangularRangeBlock = function ( e , t , i ) { var n = [ ] , o = e . column < t . column ; if ( o ) var s = e . column , a = t . column , c = e . offsetX , h = t . offsetX ; else var s = t . column , a = e . column , c = t . offsetX , h = e . offsetX ; var d = e . row < t . row ; if ( d ) var u = e . row , f = t . row ; else var u = t . row , f = e . row ; s < 0 && ( s = 0 ) , u < 0 && ( u = 0 ) , u == f && ( i = ! 0 ) ; for ( var p = u ; p <= f ; p ++ ) { var m = l . fromPoints ( this . session . screenToDocumentPosition ( p , s , c ) , this . session . screenToDocumentPosition ( p , a , h ) ) ; if ( m . isEmpty ( ) ) { if ( g && r ( m . end , g ) ) break ; var g = m . end } m . cursor = o ? m . start : m . end , n . push ( m ) } if ( d && n . reverse ( ) , ! i ) { for ( var v = n . length - 1 ; n [ v ] . isEmpty ( ) && v > 0 ; ) v -- ; if ( v > 0 ) for ( var w = 0 ; n [ w ] . isEmpty ( ) ; ) w ++ ; for ( var y = v ; y >= w ; y -- ) n [ y ] . isEmpty ( ) && n . splice ( y , 1 ) } return n } } . call ( c . prototype ) ; var v = e ( "./editor" ) . Editor ; ( function ( ) { this . updateSelectionMarkers = function ( ) { this . renderer . updateCursor ( ) , this . renderer . updateBackMarkers ( ) } , this . addSelectionMarker = function ( e ) { e . cursor || ( e . cursor = e . end ) ; var t = this . getSelectionStyle ( ) ; return e . marker = this . session . addMarker ( e , "ace_selection" , t ) , this . session . $selectionMarkers . push ( e ) , this . session . selectionMarkerCount = this . session . $selectionMarkers . length , e } , this . removeSelectionMarker = function ( e ) { if ( e . marker ) { this . session . removeMarker ( e . marker ) ; var t = this . session . $selectionMarkers . indexOf ( e ) ; - 1 != t && this . session . $selectionMarkers . splice ( t , 1 ) , this . session . selectionMarkerCount = this . session . $selectionMarkers . length } } , this . removeSelectionMarkers = function ( e ) { for ( var t = this . session . $selectionMarkers , i = e . length ; i -- ; ) { var n = e [ i ] ; if ( n . marker ) { this . session . removeMarker ( n . marker ) ; var r = t . indexOf ( n ) ; - 1 != r && t . splice ( r , 1 ) } } this . session . selectionMarkerCount = t . length } , this . $onAddRange = function ( e ) { this . addSelectionMarker ( e . range ) , this . renderer . updateCursor ( ) , this . renderer . updateBackMarkers ( ) } , this . $onRemoveRange = function ( e ) { this . removeSelectionMarkers ( e . ranges ) , this . renderer . updateCursor ( ) , this . renderer . updateBackMarkers ( ) } , this . $onMultiSelect = function ( e ) { this . inMultiSelectMode || ( this . inMultiSelectMode = ! 0 , this . setStyle ( "ace_multiselect" ) , this . keyBinding . addKeyboardHandler ( f . keyboardHandler ) , this . commands . setDefaultHandler ( "exec" , this . $onMultiSelectExec ) , this . renderer . updateCursor ( ) , this . renderer . updateBackMarkers ( ) ) } , this . $onSingleSelect = function ( e ) { this . session . multiSelect . inVirtualMode || ( this . inMultiSelectMode = ! 1 , this . unsetStyle ( "ace_multiselect" ) , this . keyBinding . removeKeyboardHandler ( f . keyboardHandler ) , this . commands . removeDefaultHandler ( "exec" , this . $onMultiSelectExec ) , this . renderer . updateCursor ( ) , this . renderer . updateBackMarkers ( ) , this . _emit ( " c
2018-01-19 03:48:31 +08:00
e . exports . src = ' "no use strict" ; ! function ( window ) { function resolveModuleId ( id , paths ) { for ( var testPath = id , tail = "" ; testPath ; ) { var alias = paths [ testPath ] ; if ( "string" == typeof alias ) return alias + tail ; if ( alias ) return alias . location . replace ( /\\/ * $ / , "/" ) + ( tail || alias . main || alias . name ) ; if ( alias === ! 1 ) return "" ; var i = testPath . lastIndexOf ( "/" ) ; if ( - 1 === i ) break ; tail = testPath . substr ( i ) + tail , testPath = testPath . slice ( 0 , i ) } return id } if ( ! ( void 0 !== window . window && window . document || window . acequire && window . define ) ) { window . console || ( window . console = function ( ) { var msgs = Array . prototype . slice . call ( arguments , 0 ) ; postMessage ( { type : "log" , data : msgs } ) } , window . console . error = window . console . warn = window . console . log = window . console . trace = window . console ) , window . window = window , window . ace = window , window . onerror = function ( message , file , line , col , err ) { postMessage ( { type : "error" , data : { message : message , data : err . data , file : file , line : line , col : col , stack : err . stack } } ) } , window . normalizeModule = function ( parentId , moduleName ) { if ( - 1 !== moduleName . indexOf ( "!" ) ) { var chunks = moduleName . split ( "!" ) ; return window . normalizeModule ( parentId , chunks [ 0 ] ) + "!" + window . normalizeModule ( parentId , chunks [ 1 ] ) } if ( "." == moduleName . charAt ( 0 ) ) { var base = parentId . split ( "/" ) . slice ( 0 , - 1 ) . join ( "/" ) ; for ( moduleName = ( base ? base + "/" : "" ) + moduleName ; - 1 !== moduleName . indexOf ( "." ) && previous != moduleName ; ) { var previous = moduleName ; moduleName = moduleName . replace ( /^\\.\\/ / , "" ) . replace ( /\\/ \ \ . \ \ //,"/").replace(/[^\\/]+\\/\\.\\.\\//,"")}}return moduleName},window.acequire=function acequire(parentId,id){if(id||(id=parentId,parentId=null),!id.charAt)throw Error("worker.js acequire() accepts only (parentId, id) as arguments");id=window.normalizeModule(parentId,id);var module=window.acequire.modules[id];if(module)return module.initialized||(module.initialized=!0,module.exports=module.factory().exports),module.exports;if(!window.acequire.tlns)return console.log("unable to load "+id);var path=resolveModuleId(id,window.acequire.tlns);return".js"!=path.slice(-3)&&(path+=".js"),window.acequire.id=id,window.acequire.modules[id]={},importScripts(path),window.acequire(parentId,id)},window.acequire.modules={},window.acequire.tlns={},window.define=function(id,deps,factory){if(2==arguments.length?(factory=deps,"string"!=typeof id&&(deps=id,id=window.acequire.id)):1==arguments.length&&(factory=id,deps=[],id=window.acequire.id),"function"!=typeof factory)return window.acequire.modules[id]={exports:factory,initialized:!0},void 0;deps.length||(deps=["require","exports","module"]);var req=function(childId){return window.acequire(id,childId)};window.acequire.modules[id]={exports:{},factory:function(){var module=this,returnExports=factory.apply(this,deps.map(function(dep){switch(dep){case"require":return req;case"exports":return module.exports;case"module":return module;default:return req(dep)}}));return returnExports&&(module.exports=returnExports),module}}},window.define.amd={},acequire.tlns={},window.initBaseUrls=function(topLevelNamespaces){for(var i in topLevelNamespaces)acequire.tlns[i]=topLevelNamespaces[i]},window.initSender=function(){var EventEmitter=window.acequire("ace/lib/event_emitter").EventEmitter,oop=window.acequire("ace/lib/oop"),Sender=function(){};return function(){oop.implement(this,EventEmitter),this.callback=function(data,callbackId){postMessage({type:"call",id:callbackId,data:data})},this.emit=function(name,data){postMessage({type:"event",name:name,data:data})}}.call(Sender.prototype),new Sender};var main=window.main=null,sender=window.sender=null;window.onmessage=function(e){var msg=e.data;if(msg.event&&sender)sender._signal(msg.event,msg.data);else if(msg.command)if(main[msg.command])main[msg.command].apply(main,msg.args);else{if(!window[msg.command])throw Error("Unknown command:"+msg.command);window[msg.command].apply(window,msg.args)}else if(msg.init){window.initBaseUrls(msg.tlns),acequire("ace/lib/es5-shim"),sender=window.sender=window.initSender();var clazz=acequire(msg.module)[msg.classname];main=window.main=new clazz(sender)}}}}(this),ace.define("ace/lib/oop",["require","exports","module"],function(acequire,exports){"use strict"
2017-07-04 01:23:32 +08:00
//# sourceMappingURL=jsoneditor.map