File size: 5,108 Bytes
020c337
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
ace.define(
	'ace/split',
	[
		'require',
		'exports',
		'module',
		'ace/lib/oop',
		'ace/lib/lang',
		'ace/lib/event_emitter',
		'ace/editor',
		'ace/virtual_renderer',
		'ace/edit_session',
	],
	function (e, t, n) {
		'use strict'
		var r = e('./lib/oop'),
			i = e('./lib/lang'),
			s = e('./lib/event_emitter').EventEmitter,
			o = e('./editor').Editor,
			u = e('./virtual_renderer').VirtualRenderer,
			a = e('./edit_session').EditSession,
			f = function (e, t, n) {
				;(this.BELOW = 1),
					(this.BESIDE = 0),
					(this.$container = e),
					(this.$theme = t),
					(this.$splits = 0),
					(this.$editorCSS = ''),
					(this.$editors = []),
					(this.$orientation = this.BESIDE),
					this.setSplits(n || 1),
					(this.$cEditor = this.$editors[0]),
					this.on(
						'focus',
						function (e) {
							this.$cEditor = e
						}.bind(this)
					)
			}
		;(function () {
			r.implement(this, s),
				(this.$createEditor = function () {
					var e = document.createElement('div')
					;(e.className = this.$editorCSS),
						(e.style.cssText = 'position: absolute; top:0px; bottom:0px'),
						this.$container.appendChild(e)
					var t = new o(new u(e, this.$theme))
					return (
						t.on(
							'focus',
							function () {
								this._emit('focus', t)
							}.bind(this)
						),
						this.$editors.push(t),
						t.setFontSize(this.$fontSize),
						t
					)
				}),
				(this.setSplits = function (e) {
					var t
					if (e < 1) throw 'The number of splits have to be > 0!'
					if (e == this.$splits) return
					if (e > this.$splits) {
						while (this.$splits < this.$editors.length && this.$splits < e)
							(t = this.$editors[this.$splits]),
								this.$container.appendChild(t.container),
								t.setFontSize(this.$fontSize),
								this.$splits++
						while (this.$splits < e) this.$createEditor(), this.$splits++
					} else
						while (this.$splits > e)
							(t = this.$editors[this.$splits - 1]),
								this.$container.removeChild(t.container),
								this.$splits--
					this.resize()
				}),
				(this.getSplits = function () {
					return this.$splits
				}),
				(this.getEditor = function (e) {
					return this.$editors[e]
				}),
				(this.getCurrentEditor = function () {
					return this.$cEditor
				}),
				(this.focus = function () {
					this.$cEditor.focus()
				}),
				(this.blur = function () {
					this.$cEditor.blur()
				}),
				(this.setTheme = function (e) {
					this.$editors.forEach(function (t) {
						t.setTheme(e)
					})
				}),
				(this.setKeyboardHandler = function (e) {
					this.$editors.forEach(function (t) {
						t.setKeyboardHandler(e)
					})
				}),
				(this.forEach = function (e, t) {
					this.$editors.forEach(e, t)
				}),
				(this.$fontSize = ''),
				(this.setFontSize = function (e) {
					;(this.$fontSize = e),
						this.forEach(function (t) {
							t.setFontSize(e)
						})
				}),
				(this.$cloneSession = function (e) {
					var t = new a(e.getDocument(), e.getMode()),
						n = e.getUndoManager()
					return (
						t.setUndoManager(n),
						t.setTabSize(e.getTabSize()),
						t.setUseSoftTabs(e.getUseSoftTabs()),
						t.setOverwrite(e.getOverwrite()),
						t.setBreakpoints(e.getBreakpoints()),
						t.setUseWrapMode(e.getUseWrapMode()),
						t.setUseWorker(e.getUseWorker()),
						t.setWrapLimitRange(e.$wrapLimitRange.min, e.$wrapLimitRange.max),
						(t.$foldData = e.$cloneFoldData()),
						t
					)
				}),
				(this.setSession = function (e, t) {
					var n
					t == null ? (n = this.$cEditor) : (n = this.$editors[t])
					var r = this.$editors.some(function (t) {
						return t.session === e
					})
					return r && (e = this.$cloneSession(e)), n.setSession(e), e
				}),
				(this.getOrientation = function () {
					return this.$orientation
				}),
				(this.setOrientation = function (e) {
					if (this.$orientation == e) return
					;(this.$orientation = e), this.resize()
				}),
				(this.resize = function () {
					var e = this.$container.clientWidth,
						t = this.$container.clientHeight,
						n
					if (this.$orientation == this.BESIDE) {
						var r = e / this.$splits
						for (var i = 0; i < this.$splits; i++)
							(n = this.$editors[i]),
								(n.container.style.width = r + 'px'),
								(n.container.style.top = '0px'),
								(n.container.style.left = i * r + 'px'),
								(n.container.style.height = t + 'px'),
								n.resize()
					} else {
						var s = t / this.$splits
						for (var i = 0; i < this.$splits; i++)
							(n = this.$editors[i]),
								(n.container.style.width = e + 'px'),
								(n.container.style.top = i * s + 'px'),
								(n.container.style.left = '0px'),
								(n.container.style.height = s + 'px'),
								n.resize()
					}
				})
		}).call(f.prototype),
			(t.Split = f)
	}
),
	ace.define('ace/ext/split', ['require', 'exports', 'module', 'ace/split'], function (e, t, n) {
		'use strict'
		n.exports = e('../split')
	})
;(function () {
	ace.require(['ace/ext/split'], function (m) {
		if (typeof module == 'object' && typeof exports == 'object' && module) {
			module.exports = m
		}
	})
})()