Debian Codegraph @

doc/resources/worker-base.js

raw
1 "no use strict";
2 (function(e) {
3 if (typeof e.window != "undefined" && e.document) return;
4 e.console = function() {
5 var e = Array.prototype.slice.call(arguments, 0);
6 postMessage({
7 type: "log",
8 data: e
9 })
10 }, e.console.error = e.console.warn = e.console.log = e.console.trace = e.console, e.window = e, e.ace = e, e.onerror = function(e, t, n, r, i) {
11 postMessage({
12 type: "error",
13 data: {
14 message: e,
15 file: t,
16 line: n,
17 col: r,
18 stack: i.stack
19 }
20 })
21 }, e.normalizeModule = function(t, n) {
22 if (n.indexOf("!") !== -1) {
23 var r = n.split("!");
24 return e.normalizeModule(t, r[0]) + "!" + e.normalizeModule(t, r[1])
25 }
26 if (n.charAt(0) == ".") {
27 var i = t.split("/")
28 .slice(0, -1)
29 .join("/");
30 n = (i ? i + "/" : "") + n;
31 while (n.indexOf(".") !== -1 && s != n) {
32 var s = n;
33 n = n.replace(/^\.\//, "")
34 .replace(/\/\.\//, "/")
35 .replace(/[^\/]+\/\.\.\//, "")
36 }
37 }
38 return n
39 }, e.require = function(t, n) {
40 n || (n = t, t = null);
41 if (!n.charAt) throw new Error("worker.js require() accepts only (parentId, id) as arguments");
42 n = e.normalizeModule(t, n);
43 var r = e.require.modules[n];
44 if (r) return r.initialized || (r.initialized = !0, r.exports = r.factory()
45 .exports), r.exports;
46 var i = n.split("/");
47 if (!e.require.tlns) return console.log("unable to load " + n);
48 i[0] = e.require.tlns[i[0]] || i[0];
49 var s = i.join("/") + ".js";
50 return e.require.id = n, importScripts(s), e.require(t, n)
51 }, e.require.modules = {}, e.require.tlns = {}, e.define = function(t, n, r) {
52 arguments.length == 2 ? (r = n, typeof t != "string" && (n = t, t = e.require.id)) : arguments.length == 1 && (r = t, n = [], t = e.require.id);
53 if (typeof r != "function") {
54 e.require.modules[t] = {
55 exports: r,
56 initialized: !0
57 };
58 return
59 }
60 n.length || (n = ["require", "exports", "module"]);
61 var i = function(n) {
62 return e.require(t, n)
63 };
64 e.require.modules[t] = {
65 exports: {},
66 factory: function() {
67 var e = this,
68 t = r.apply(this, n.map(function(t) {
69 switch (t) {
70 case "require":
71 return i;
72 case "exports":
73 return e.exports;
74 case "module":
75 return e;
76 default:
77 return i(t)
78 }
79 }));
80 return t && (e.exports = t), e
81 }
82 }
83 }, e.define.amd = {}, e.initBaseUrls = function(t) {
84 require.tlns = t
85 }, e.initSender = function() {
86 var n = e.require("ace/lib/event_emitter")
87 .EventEmitter,
88 r = e.require("ace/lib/oop"),
89 i = function() {};
90 return function() {
91 r.implement(this, n), this.callback = function(e, t) {
92 postMessage({
93 type: "call",
94 id: t,
95 data: e
96 })
97 }, this.emit = function(e, t) {
98 postMessage({
99 type: "event",
100 name: e,
101 data: t
102 })
103 }
104 }.call(i.prototype), new i
105 };
106 var t = e.main = null,
107 n = e.sender = null;
108 e.onmessage = function(r) {
109 var i = r.data;
110 if (i.command) {
111 if (!t[i.command]) throw new Error("Unknown command:" + i.command);
112 t[i.command].apply(t, i.args)
113 } else if (i.init) {
114 initBaseUrls(i.tlns), require("ace/lib/es5-shim"), n = e.sender = initSender();
115 var s = require(i.module)[i.classname];
116 t = e.main = new s(n)
117 } else i.event && n && n._signal(i.event, i.data)
118 }
119 })(this), ace.define("ace/lib/oop", ["require", "exports", "module"], function(e, t, n) {
120 "use strict";
121 t.inherits = function(e, t) {
122 e.super_ = t, e.prototype = Object.create(t.prototype, {
123 constructor: {
124 value: e,
125 enumerable: !1,
126 writable: !0,
127 configurable: !0
128 }
129 })
130 }, t.mixin = function(e, t) {
131 for (var n in t) e[n] = t[n];
132 return e
133 }, t.implement = function(e, n) {
134 t.mixin(e, n)
135 }
136 }), ace.define("ace/lib/event_emitter", ["require", "exports", "module"], function(e, t, n) {
137 "use strict";
138 var r = {},
139 i = function() {
140 this.propagationStopped = !0
141 },
142 s = function() {
143 this.defaultPrevented = !0
144 };
145 r._emit = r._dispatchEvent = function(e, t) {
146 this._eventRegistry || (this._eventRegistry = {}), this._defaultHandlers || (this._defaultHandlers = {});
147 var n = this._eventRegistry[e] || [],
148 r = this._defaultHandlers[e];
149 if (!n.length && !r) return;
150 if (typeof t != "object" || !t) t = {};
151 t.type || (t.type = e), t.stopPropagation || (t.stopPropagation = i), t.preventDefault || (t.preventDefault = s), n = n.slice();
152 for (var o = 0; o < n.length; o++) {
153 n[o](t, this);
154 if (t.propagationStopped) break
155 }
156 if (r && !t.defaultPrevented) return r(t, this)
157 }, r._signal = function(e, t) {
158 var n = (this._eventRegistry || {})[e];
159 if (!n) return;
160 n = n.slice();
161 for (var r = 0; r < n.length; r++) n[r](t, this)
162 }, r.once = function(e, t) {
163 var n = this;
164 t && this.addEventListener(e, function r() {
165 n.removeEventListener(e, r), t.apply(null, arguments)
166 })
167 }, r.setDefaultHandler = function(e, t) {
168 var n = this._defaultHandlers;
169 n || (n = this._defaultHandlers = {
170 _disabled_: {}
171 });
172 if (n[e]) {
173 var r = n[e],
174 i = n._disabled_[e];
175 i || (n._disabled_[e] = i = []), i.push(r);
176 var s = i.indexOf(t);
177 s != -1 && i.splice(s, 1)
178 }
179 n[e] = t
180 }, r.removeDefaultHandler = function(e, t) {
181 var n = this._defaultHandlers;
182 if (!n) return;
183 var r = n._disabled_[e];
184 if (n[e] == t) {
185 var i = n[e];
186 r && this.setDefaultHandler(e, r.pop())
187 } else if (r) {
188 var s = r.indexOf(t);
189 s != -1 && r.splice(s, 1)
190 }
191 }, r.on = r.addEventListener = function(e, t, n) {
192 this._eventRegistry = this._eventRegistry || {};
193 var r = this._eventRegistry[e];
194 return r || (r = this._eventRegistry[e] = []), r.indexOf(t) == -1 && r[n ? "unshift" : "push"](t), t
195 }, r.off = r.removeListener = r.removeEventListener = function(e, t) {
196 this._eventRegistry = this._eventRegistry || {};
197 var n = this._eventRegistry[e];
198 if (!n) return;
199 var r = n.indexOf(t);
200 r !== -1 && n.splice(r, 1)
201 }, r.removeAllListeners = function(e) {
202 this._eventRegistry && (this._eventRegistry[e] = [])
203 }, t.EventEmitter = r
204 }), ace.define("ace/range", ["require", "exports", "module"], function(e, t, n) {
205 "use strict";
206 var r = function(e, t) {
207 return e.row - t.row || e.column - t.column
208 },
209 i = function(e, t, n, r) {
210 this.start = {
211 row: e,
212 column: t
213 }, this.end = {
214 row: n,
215 column: r
216 }
217 };
218 (function() {
219 this.isEqual = function(e) {
220 return this.start.row === e.start.row && this.end.row === e.end.row && this.start.column === e.start.column && this.end.column === e.end.column
221 }, this.toString = function() {
222 return "Range: [" + this.start.row + "/" + this.start.column + "] -> [" + this.end.row + "/" + this.end.column + "]"
223 }, this.contains = function(e, t) {
224 return this.compare(e, t) == 0
225 }, this.compareRange = function(e) {
226 var t, n = e.end,
227 r = e.start;
228 return t = this.compare(n.row, n.column), t == 1 ? (t = this.compare(r.row, r.column), t == 1 ? 2 : t == 0 ? 1 : 0) : t == -1 ? -2 : (t = this.compare(r.row, r.column), t == -1 ? -1 : t == 1 ? 42 : 0)
229 }, this.comparePoint = function(e) {
230 return this.compare(e.row, e.column)
231 }, this.containsRange = function(e) {
232 return this.comparePoint(e.start) == 0 && this.comparePoint(e.end) == 0
233 }, this.intersects = function(e) {
234 var t = this.compareRange(e);
235 return t == -1 || t == 0 || t == 1
236 }, this.isEnd = function(e, t) {
237 return this.end.row == e && this.end.column == t
238 }, this.isStart = function(e, t) {
239 return this.start.row == e && this.start.column == t
240 }, this.setStart = function(e, t) {
241 typeof e == "object" ? (this.start.column = e.column, this.start.row = e.row) : (this.start.row = e, this.start.column = t)
242 }, this.setEnd = function(e, t) {
243 typeof e == "object" ? (this.end.column = e.column, this.end.row = e.row) : (this.end.row = e, this.end.column = t)
244 }, this.inside = function(e, t) {
245 return this.compare(e, t) == 0 ? this.isEnd(e, t) || this.isStart(e, t) ? !1 : !0 : !1
246 }, this.insideStart = function(e, t) {
247 return this.compare(e, t) == 0 ? this.isEnd(e, t) ? !1 : !0 : !1
248 }, this.insideEnd = function(e, t) {
249 return this.compare(e, t) == 0 ? this.isStart(e, t) ? !1 : !0 : !1
250 }, this.compare = function(e, t) {
251 return !this.isMultiLine() && e === this.start.row ? t < this.start.column ? -1 : t > this.end.column ? 1 : 0 : e < this.start.row ? -1 : e > this.end.row ? 1 : this.start.row === e ? t >= this.start.column ? 0 : -1 : this.end.row === e ? t <= this.end.column ? 0 : 1 : 0
252 }, this.compareStart = function(e, t) {
253 return this.start.row == e && this.start.column == t ? -1 : this.compare(e, t)
254 }, this.compareEnd = function(e, t) {
255 return this.end.row == e && this.end.column == t ? 1 : this.compare(e, t)
256 }, this.compareInside = function(e, t) {
257 return this.end.row == e && this.end.column == t ? 1 : this.start.row == e && this.start.column == t ? -1 : this.compare(e, t)
258 }, this.clipRows = function(e, t) {
259 if (this.end.row > t) var n = {
260 row: t + 1,
261 column: 0
262 };
263 else if (this.end.row < e) var n = {
264 row: e,
265 column: 0
266 };
267 if (this.start.row > t) var r = {
268 row: t + 1,
269 column: 0
270 };
271 else if (this.start.row < e) var r = {
272 row: e,
273 column: 0
274 };
275 return i.fromPoints(r || this.start, n || this.end)
276 }, this.extend = function(e, t) {
277 var n = this.compare(e, t);
278 if (n == 0) return this;
279 if (n == -1) var r = {
280 row: e,
281 column: t
282 };
283 else var s = {
284 row: e,
285 column: t
286 };
287 return i.fromPoints(r || this.start, s || this.end)
288 }, this.isEmpty = function() {
289 return this.start.row === this.end.row && this.start.column === this.end.column
290 }, this.isMultiLine = function() {
291 return this.start.row !== this.end.row
292 }, this.clone = function() {
293 return i.fromPoints(this.start, this.end)
294 }, this.collapseRows = function() {
295 return this.end.column == 0 ? new i(this.start.row, 0, Math.max(this.start.row, this.end.row - 1), 0) : new i(this.start.row, 0, this.end.row, 0)
296 }, this.toScreenRange = function(e) {
297 var t = e.documentToScreenPosition(this.start),
298 n = e.documentToScreenPosition(this.end);
299 return new i(t.row, t.column, n.row, n.column)
300 }, this.moveBy = function(e, t) {
301 this.start.row += e, this.start.column += t, this.end.row += e, this.end.column += t
302 }
303 })
304 .call(i.prototype), i.fromPoints = function(e, t) {
305 return new i(e.row, e.column, t.row, t.column)
306 }, i.comparePoints = r, i.comparePoints = function(e, t) {
307 return e.row - t.row || e.column - t.column
308 }, t.Range = i
309 }), ace.define("ace/anchor", ["require", "exports", "module", "ace/lib/oop", "ace/lib/event_emitter"], function(e, t, n) {
310 "use strict";
311 var r = e("./lib/oop"),
312 i = e("./lib/event_emitter")
313 .EventEmitter,
314 s = t.Anchor = function(e, t, n) {
315 this.$onChange = this.onChange.bind(this), this.attach(e), typeof n == "undefined" ? this.setPosition(t.row, t.column) : this.setPosition(t, n)
316 };
317 (function() {
318 r.implement(this, i), this.getPosition = function() {
319 return this.$clipPositionToDocument(this.row, this.column)
320 }, this.getDocument = function() {
321 return this.document
322 }, this.$insertRight = !1, this.onChange = function(e) {
323 var t = e.data,
324 n = t.range;
325 if (n.start.row == n.end.row && n.start.row != this.row) return;
326 if (n.start.row > this.row) return;
327 if (n.start.row == this.row && n.start.column > this.column) return;
328 var r = this.row,
329 i = this.column,
330 s = n.start,
331 o = n.end;
332 if (t.action === "insertText")
333 if (s.row === r && s.column <= i) {
334 if (s.column !== i || !this.$insertRight) s.row === o.row ? i += o.column - s.column : (i -= s.column, r += o.row - s.row)
335 } else s.row !== o.row && s.row < r && (r += o.row - s.row);
336 else t.action === "insertLines" ? (s.row !== r || i !== 0 || !this.$insertRight) && s.row <= r && (r += o.row - s.row) : t.action === "removeText" ? s.row === r && s.column < i ? o.column >= i ? i = s.column : i = Math.max(0, i - (o.column - s.column)) : s.row !== o.row && s.row < r ? (o.row === r && (i = Math.max(0, i - o.column) + s.column), r -= o.row - s.row) : o.row === r && (r -= o.row - s.row, i = Math.max(0, i - o.column) + s.column) : t.action == "removeLines" && s.row <= r && (o.row <= r ? r -= o.row - s.row : (r = s.row, i = 0));
337 this.setPosition(r, i, !0)
338 }, this.setPosition = function(e, t, n) {
339 var r;
340 n ? r = {
341 row: e,
342 column: t
343 } : r = this.$clipPositionToDocument(e, t);
344 if (this.row == r.row && this.column == r.column) return;
345 var i = {
346 row: this.row,
347 column: this.column
348 };
349 this.row = r.row, this.column = r.column, this._signal("change", {
350 old: i,
351 value: r
352 })
353 }, this.detach = function() {
354 this.document.removeEventListener("change", this.$onChange)
355 }, this.attach = function(e) {
356 this.document = e || this.document, this.document.on("change", this.$onChange)
357 }, this.$clipPositionToDocument = function(e, t) {
358 var n = {};
359 return e >= this.document.getLength() ? (n.row = Math.max(0, this.document.getLength() - 1), n.column = this.document.getLine(n.row)
360 .length) : e < 0 ? (n.row = 0, n.column = 0) : (n.row = e, n.column = Math.min(this.document.getLine(n.row)
361 .length, Math.max(0, t))), t < 0 && (n.column = 0), n
362 }
363 })
364 .call(s.prototype)
365 }), ace.define("ace/document", ["require", "exports", "module", "ace/lib/oop", "ace/lib/event_emitter", "ace/range", "ace/anchor"], function(e, t, n) {
366 "use strict";
367 var r = e("./lib/oop"),
368 i = e("./lib/event_emitter")
369 .EventEmitter,
370 s = e("./range")
371 .Range,
372 o = e("./anchor")
373 .Anchor,
374 u = function(e) {
375 this.$lines = [], e.length === 0 ? this.$lines = [""] : Array.isArray(e) ? this._insertLines(0, e) : this.insert({
376 row: 0,
377 column: 0
378 }, e)
379 };
380 (function() {
381 r.implement(this, i), this.setValue = function(e) {
382 var t = this.getLength();
383 this.remove(new s(0, 0, t, this.getLine(t - 1)
384 .length)), this.insert({
385 row: 0,
386 column: 0
387 }, e)
388 }, this.getValue = function() {
389 return this.getAllLines()
390 .join(this.getNewLineCharacter())
391 }, this.createAnchor = function(e, t) {
392 return new o(this, e, t)
393 }, "aaa".split(/a/)
394 .length === 0 ? this.$split = function(e) {
395 return e.replace(/\r\n|\r/g, "\n")
396 .split("\n")
397 } : this.$split = function(e) {
398 return e.split(/\r\n|\r|\n/)
399 }, this.$detectNewLine = function(e) {
400 var t = e.match(/^.*?(\r\n|\r|\n)/m);
401 this.$autoNewLine = t ? t[1] : "\n", this._signal("changeNewLineMode")
402 }, this.getNewLineCharacter = function() {
403 switch (this.$newLineMode) {
404 case "windows":
405 return "\r\n";
406 case "unix":
407 return "\n";
408 default:
409 return this.$autoNewLine || "\n"
410 }
411 }, this.$autoNewLine = "", this.$newLineMode = "auto", this.setNewLineMode = function(e) {
412 if (this.$newLineMode === e) return;
413 this.$newLineMode = e, this._signal("changeNewLineMode")
414 }, this.getNewLineMode = function() {
415 return this.$newLineMode
416 }, this.isNewLine = function(e) {
417 return e == "\r\n" || e == "\r" || e == "\n"
418 }, this.getLine = function(e) {
419 return this.$lines[e] || ""
420 }, this.getLines = function(e, t) {
421 return this.$lines.slice(e, t + 1)
422 }, this.getAllLines = function() {
423 return this.getLines(0, this.getLength())
424 }, this.getLength = function() {
425 return this.$lines.length
426 }, this.getTextRange = function(e) {
427 if (e.start.row == e.end.row) return this.getLine(e.start.row)
428 .substring(e.start.column, e.end.column);
429 var t = this.getLines(e.start.row, e.end.row);
430 t[0] = (t[0] || "")
431 .substring(e.start.column);
432 var n = t.length - 1;
433 return e.end.row - e.start.row == n && (t[n] = t[n].substring(0, e.end.column)), t.join(this.getNewLineCharacter())
434 }, this.$clipPosition = function(e) {
435 var t = this.getLength();
436 return e.row >= t ? (e.row = Math.max(0, t - 1), e.column = this.getLine(t - 1)
437 .length) : e.row < 0 && (e.row = 0), e
438 }, this.insert = function(e, t) {
439 if (!t || t.length === 0) return e;
440 e = this.$clipPosition(e), this.getLength() <= 1 && this.$detectNewLine(t);
441 var n = this.$split(t),
442 r = n.splice(0, 1)[0],
443 i = n.length == 0 ? null : n.splice(n.length - 1, 1)[0];
444 return e = this.insertInLine(e, r), i !== null && (e = this.insertNewLine(e), e = this._insertLines(e.row, n), e = this.insertInLine(e, i || "")), e
445 }, this.insertLines = function(e, t) {
446 return e >= this.getLength() ? this.insert({
447 row: e,
448 column: 0
449 }, "\n" + t.join("\n")) : this._insertLines(Math.max(e, 0), t)
450 }, this._insertLines = function(e, t) {
451 if (t.length == 0) return {
452 row: e,
453 column: 0
454 };
455 while (t.length > 2e4) {
456 var n = this._insertLines(e, t.slice(0, 2e4));
457 t = t.slice(2e4), e = n.row
458 }
459 var r = [e, 0];
460 r.push.apply(r, t), this.$lines.splice.apply(this.$lines, r);
461 var i = new s(e, 0, e + t.length, 0),
462 o = {
463 action: "insertLines",
464 range: i,
465 lines: t
466 };
467 return this._signal("change", {
468 data: o
469 }), i.end
470 }, this.insertNewLine = function(e) {
471 e = this.$clipPosition(e);
472 var t = this.$lines[e.row] || "";
473 this.$lines[e.row] = t.substring(0, e.column), this.$lines.splice(e.row + 1, 0, t.substring(e.column, t.length));
474 var n = {
475 row: e.row + 1,
476 column: 0
477 },
478 r = {
479 action: "insertText",
480 range: s.fromPoints(e, n),
481 text: this.getNewLineCharacter()
482 };
483 return this._signal("change", {
484 data: r
485 }), n
486 }, this.insertInLine = function(e, t) {
487 if (t.length == 0) return e;
488 var n = this.$lines[e.row] || "";
489 this.$lines[e.row] = n.substring(0, e.column) + t + n.substring(e.column);
490 var r = {
491 row: e.row,
492 column: e.column + t.length
493 },
494 i = {
495 action: "insertText",
496 range: s.fromPoints(e, r),
497 text: t
498 };
499 return this._signal("change", {
500 data: i
501 }), r
502 }, this.remove = function(e) {
503 e instanceof s || (e = s.fromPoints(e.start, e.end)), e.start = this.$clipPosition(e.start), e.end = this.$clipPosition(e.end);
504 if (e.isEmpty()) return e.start;
505 var t = e.start.row,
506 n = e.end.row;
507 if (e.isMultiLine()) {
508 var r = e.start.column == 0 ? t : t + 1,
509 i = n - 1;
510 e.end.column > 0 && this.removeInLine(n, 0, e.end.column), i >= r && this._removeLines(r, i), r != t && (this.removeInLine(t, e.start.column, this.getLine(t)
511 .length), this.removeNewLine(e.start.row))
512 } else this.removeInLine(t, e.start.column, e.end.column);
513 return e.start
514 }, this.removeInLine = function(e, t, n) {
515 if (t == n) return;
516 var r = new s(e, t, e, n),
517 i = this.getLine(e),
518 o = i.substring(t, n),
519 u = i.substring(0, t) + i.substring(n, i.length);
520 this.$lines.splice(e, 1, u);
521 var a = {
522 action: "removeText",
523 range: r,
524 text: o
525 };
526 return this._signal("change", {
527 data: a
528 }), r.start
529 }, this.removeLines = function(e, t) {
530 return e < 0 || t >= this.getLength() ? this.remove(new s(e, 0, t + 1, 0)) : this._removeLines(e, t)
531 }, this._removeLines = function(e, t) {
532 var n = new s(e, 0, t + 1, 0),
533 r = this.$lines.splice(e, t - e + 1),
534 i = {
535 action: "removeLines",
536 range: n,
537 nl: this.getNewLineCharacter(),
538 lines: r
539 };
540 return this._signal("change", {
541 data: i
542 }), r
543 }, this.removeNewLine = function(e) {
544 var t = this.getLine(e),
545 n = this.getLine(e + 1),
546 r = new s(e, t.length, e + 1, 0),
547 i = t + n;
548 this.$lines.splice(e, 2, i);
549 var o = {
550 action: "removeText",
551 range: r,
552 text: this.getNewLineCharacter()
553 };
554 this._signal("change", {
555 data: o
556 })
557 }, this.replace = function(e, t) {
558 e instanceof s || (e = s.fromPoints(e.start, e.end));
559 if (t.length == 0 && e.isEmpty()) return e.start;
560 if (t == this.getTextRange(e)) return e.end;
561 this.remove(e);
562 if (t) var n = this.insert(e.start, t);
563 else n = e.start;
564 return n
565 }, this.applyDeltas = function(e) {
566 for (var t = 0; t < e.length; t++) {
567 var n = e[t],
568 r = s.fromPoints(n.range.start, n.range.end);
569 n.action == "insertLines" ? this.insertLines(r.start.row, n.lines) : n.action == "insertText" ? this.insert(r.start, n.text) : n.action == "removeLines" ? this._removeLines(r.start.row, r.end.row - 1) : n.action == "removeText" && this.remove(r)
570 }
571 }, this.revertDeltas = function(e) {
572 for (var t = e.length - 1; t >= 0; t--) {
573 var n = e[t],
574 r = s.fromPoints(n.range.start, n.range.end);
575 n.action == "insertLines" ? this._removeLines(r.start.row, r.end.row - 1) : n.action == "insertText" ? this.remove(r) : n.action == "removeLines" ? this._insertLines(r.start.row, n.lines) : n.action == "removeText" && this.insert(r.start, n.text)
576 }
577 }, this.indexToPosition = function(e, t) {
578 var n = this.$lines || this.getAllLines(),
579 r = this.getNewLineCharacter()
580 .length;
581 for (var i = t || 0, s = n.length; i < s; i++) {
582 e -= n[i].length + r;
583 if (e < 0) return {
584 row: i,
585 column: e + n[i].length + r
586 }
587 }
588 return {
589 row: s - 1,
590 column: n[s - 1].length
591 }
592 }, this.positionToIndex = function(e, t) {
593 var n = this.$lines || this.getAllLines(),
594 r = this.getNewLineCharacter()
595 .length,
596 i = 0,
597 s = Math.min(e.row, n.length);
598 for (var o = t || 0; o < s; ++o) i += n[o].length + r;
599 return i + e.column
600 }
601 })
602 .call(u.prototype), t.Document = u
603 }), ace.define("ace/lib/lang", ["require", "exports", "module"], function(e, t, n) {
604 "use strict";
605 t.last = function(e) {
606 return e[e.length - 1]
607 }, t.stringReverse = function(e) {
608 return e.split("")
609 .reverse()
610 .join("")
611 }, t.stringRepeat = function(e, t) {
612 var n = "";
613 while (t > 0) {
614 t & 1 && (n += e);
615 if (t >>= 1) e += e
616 }
617 return n
618 };
619 var r = /^\s\s*/,
620 i = /\s\s*$/;
621 t.stringTrimLeft = function(e) {
622 return e.replace(r, "")
623 }, t.stringTrimRight = function(e) {
624 return e.replace(i, "")
625 }, t.copyObject = function(e) {
626 var t = {};
627 for (var n in e) t[n] = e[n];
628 return t
629 }, t.copyArray = function(e) {
630 var t = [];
631 for (var n = 0, r = e.length; n < r; n++) e[n] && typeof e[n] == "object" ? t[n] = this.copyObject(e[n]) : t[n] = e[n];
632 return t
633 }, t.deepCopy = function s(e) {
634 if (typeof e != "object" || !e) return e;
635 var t;
636 if (Array.isArray(e)) {
637 t = [];
638 for (var n = 0; n < e.length; n++) t[n] = s(e[n]);
639 return t
640 }
641 var r = e.constructor;
642 if (r === RegExp) return e;
643 t = r();
644 for (var n in e) t[n] = s(e[n]);
645 return t
646 }, t.arrayToMap = function(e) {
647 var t = {};
648 for (var n = 0; n < e.length; n++) t[e[n]] = 1;
649 return t
650 }, t.createMap = function(e) {
651 var t = Object.create(null);
652 for (var n in e) t[n] = e[n];
653 return t
654 }, t.arrayRemove = function(e, t) {
655 for (var n = 0; n <= e.length; n++) t === e[n] && e.splice(n, 1)
656 }, t.escapeRegExp = function(e) {
657 return e.replace(/([.*+?^${}()|[\]\/\\])/g, "\\$1")
658 }, t.escapeHTML = function(e) {
659 return e.replace(/&/g, "&#38;")
660 .replace(/"/g, "&#34;")
661 .replace(/'/g, "&#39;")
662 .replace(/</g, "&#60;")
663 }, t.getMatchOffsets = function(e, t) {
664 var n = [];
665 return e.replace(t, function(e) {
666 n.push({
667 offset: arguments[arguments.length - 2],
668 length: e.length
669 })
670 }), n
671 }, t.deferredCall = function(e) {
672 var t = null,
673 n = function() {
674 t = null, e()
675 },
676 r = function(e) {
677 return r.cancel(), t = setTimeout(n, e || 0), r
678 };
679 return r.schedule = r, r.call = function() {
680 return this.cancel(), e(), r
681 }, r.cancel = function() {
682 return clearTimeout(t), t = null, r
683 }, r.isPending = function() {
684 return t
685 }, r
686 }, t.delayedCall = function(e, t) {
687 var n = null,
688 r = function() {
689 n = null, e()
690 },
691 i = function(e) {
692 n == null && (n = setTimeout(r, e || t))
693 };
694 return i.delay = function(e) {
695 n && clearTimeout(n), n = setTimeout(r, e || t)
696 }, i.schedule = i, i.call = function() {
697 this.cancel(), e()
698 }, i.cancel = function() {
699 n && clearTimeout(n), n = null
700 }, i.isPending = function() {
701 return n
702 }, i
703 }
704 }), ace.define("ace/worker/mirror", ["require", "exports", "module", "ace/document", "ace/lib/lang"], function(e, t, n) {
705 "use strict";
706 var r = e("../document")
707 .Document,
708 i = e("../lib/lang"),
709 s = t.Mirror = function(e) {
710 this.sender = e;
711 var t = this.doc = new r(""),
712 n = this.deferredUpdate = i.delayedCall(this.onUpdate.bind(this)),
713 s = this;
714 e.on("change", function(e) {
715 t.applyDeltas(e.data);
716 if (s.$timeout) return n.schedule(s.$timeout);
717 s.onUpdate()
718 })
719 };
720 (function() {
721 this.$timeout = 500, this.setTimeout = function(e) {
722 this.$timeout = e
723 }, this.setValue = function(e) {
724 this.doc.setValue(e), this.deferredUpdate.schedule(this.$timeout)
725 }, this.getValue = function(e) {
726 this.sender.callback(this.doc.getValue(), e)
727 }, this.onUpdate = function() {}, this.isPending = function() {
728 return this.deferredUpdate.isPending()
729 }
730 })
731 .call(s.prototype)
732 }), ace.define("ace/lib/es5-shim", ["require", "exports", "module"], function(e, t, n) {
733 function r() {}
734
735 function w(e) {
736 try {
737 return Object.defineProperty(e, "sentinel", {}), "sentinel" in e
738 } catch (t) {}
739 }
740
741 function H(e) {
742 return e = +e, e !== e ? e = 0 : e !== 0 && e !== 1 / 0 && e !== -1 / 0 && (e = (e > 0 || -1) * Math.floor(Math.abs(e))), e
743 }
744
745 function B(e) {
746 var t = typeof e;
747 return e === null || t === "undefined" || t === "boolean" || t === "number" || t === "string"
748 }
749
750 function j(e) {
751 var t, n, r;
752 if (B(e)) return e;
753 n = e.valueOf;
754 if (typeof n == "function") {
755 t = n.call(e);
756 if (B(t)) return t
757 }
758 r = e.toString;
759 if (typeof r == "function") {
760 t = r.call(e);
761 if (B(t)) return t
762 }
763 throw new TypeError
764 }
765 Function.prototype.bind || (Function.prototype.bind = function(t) {
766 var n = this;
767 if (typeof n != "function") throw new TypeError("Function.prototype.bind called on incompatible " + n);
768 var i = u.call(arguments, 1),
769 s = function() {
770 if (this instanceof s) {
771 var e = n.apply(this, i.concat(u.call(arguments)));
772 return Object(e) === e ? e : this
773 }
774 return n.apply(t, i.concat(u.call(arguments)))
775 };
776 return n.prototype && (r.prototype = n.prototype, s.prototype = new r, r.prototype = null), s
777 });
778 var i = Function.prototype.call,
779 s = Array.prototype,
780 o = Object.prototype,
781 u = s.slice,
782 a = i.bind(o.toString),
783 f = i.bind(o.hasOwnProperty),
784 l, c, h, p, d;
785 if (d = f(o, "__defineGetter__")) l = i.bind(o.__defineGetter__), c = i.bind(o.__defineSetter__), h = i.bind(o.__lookupGetter__), p = i.bind(o.__lookupSetter__);
786 if ([1, 2].splice(0)
787 .length != 2)
788 if (! function() {
789 function e(e) {
790 var t = new Array(e + 2);
791 return t[0] = t[1] = 0, t
792 }
793 var t = [],
794 n;
795 t.splice.apply(t, e(20)), t.splice.apply(t, e(26)), n = t.length, t.splice(5, 0, "XXX"), n + 1 == t.length;
796 if (n + 1 == t.length) return !0
797 }()) Array.prototype.splice = function(e, t) {
798 var n = this.length;
799 e > 0 ? e > n && (e = n) : e == void 0 ? e = 0 : e < 0 && (e = Math.max(n + e, 0)), e + t < n || (t = n - e);
800 var r = this.slice(e, e + t),
801 i = u.call(arguments, 2),
802 s = i.length;
803 if (e === n) s && this.push.apply(this, i);
804 else {
805 var o = Math.min(t, n - e),
806 a = e + o,
807 f = a + s - o,
808 l = n - a,
809 c = n - o;
810 if (f < a)
811 for (var h = 0; h < l; ++h) this[f + h] = this[a + h];
812 else if (f > a)
813 for (h = l; h--;) this[f + h] = this[a + h];
814 if (s && e === c) this.length = c, this.push.apply(this, i);
815 else {
816 this.length = c + s;
817 for (h = 0; h < s; ++h) this[e + h] = i[h]
818 }
819 }
820 return r
821 };
822 else {
823 var v = Array.prototype.splice;
824 Array.prototype.splice = function(e, t) {
825 return arguments.length ? v.apply(this, [e === void 0 ? 0 : e, t === void 0 ? this.length - e : t].concat(u.call(arguments, 2))) : []
826 }
827 }
828 Array.isArray || (Array.isArray = function(t) {
829 return a(t) == "[object Array]"
830 });
831 var m = Object("a"),
832 g = m[0] != "a" || !(0 in m);
833 Array.prototype.forEach || (Array.prototype.forEach = function(t) {
834 var n = F(this),
835 r = g && a(this) == "[object String]" ? this.split("") : n,
836 i = arguments[1],
837 s = -1,
838 o = r.length >>> 0;
839 if (a(t) != "[object Function]") throw new TypeError;
840 while (++s < o) s in r && t.call(i, r[s], s, n)
841 }), Array.prototype.map || (Array.prototype.map = function(t) {
842 var n = F(this),
843 r = g && a(this) == "[object String]" ? this.split("") : n,
844 i = r.length >>> 0,
845 s = Array(i),
846 o = arguments[1];
847 if (a(t) != "[object Function]") throw new TypeError(t + " is not a function");
848 for (var u = 0; u < i; u++) u in r && (s[u] = t.call(o, r[u], u, n));
849 return s
850 }), Array.prototype.filter || (Array.prototype.filter = function(t) {
851 var n = F(this),
852 r = g && a(this) == "[object String]" ? this.split("") : n,
853 i = r.length >>> 0,
854 s = [],
855 o, u = arguments[1];
856 if (a(t) != "[object Function]") throw new TypeError(t + " is not a function");
857 for (var f = 0; f < i; f++) f in r && (o = r[f], t.call(u, o, f, n) && s.push(o));
858 return s
859 }), Array.prototype.every || (Array.prototype.every = function(t) {
860 var n = F(this),
861 r = g && a(this) == "[object String]" ? this.split("") : n,
862 i = r.length >>> 0,
863 s = arguments[1];
864 if (a(t) != "[object Function]") throw new TypeError(t + " is not a function");
865 for (var o = 0; o < i; o++)
866 if (o in r && !t.call(s, r[o], o, n)) return !1;
867 return !0
868 }), Array.prototype.some || (Array.prototype.some = function(t) {
869 var n = F(this),
870 r = g && a(this) == "[object String]" ? this.split("") : n,
871 i = r.length >>> 0,
872 s = arguments[1];
873 if (a(t) != "[object Function]") throw new TypeError(t + " is not a function");
874 for (var o = 0; o < i; o++)
875 if (o in r && t.call(s, r[o], o, n)) return !0;
876 return !1
877 }), Array.prototype.reduce || (Array.prototype.reduce = function(t) {
878 var n = F(this),
879 r = g && a(this) == "[object String]" ? this.split("") : n,
880 i = r.length >>> 0;
881 if (a(t) != "[object Function]") throw new TypeError(t + " is not a function");
882 if (!i && arguments.length == 1) throw new TypeError("reduce of empty array with no initial value");
883 var s = 0,
884 o;
885 if (arguments.length >= 2) o = arguments[1];
886 else
887 do {
888 if (s in r) {
889 o = r[s++];
890 break
891 }
892 if (++s >= i) throw new TypeError("reduce of empty array with no initial value")
893 } while (!0);
894 for (; s < i; s++) s in r && (o = t.call(void 0, o, r[s], s, n));
895 return o
896 }), Array.prototype.reduceRight || (Array.prototype.reduceRight = function(t) {
897 var n = F(this),
898 r = g && a(this) == "[object String]" ? this.split("") : n,
899 i = r.length >>> 0;
900 if (a(t) != "[object Function]") throw new TypeError(t + " is not a function");
901 if (!i && arguments.length == 1) throw new TypeError("reduceRight of empty array with no initial value");
902 var s, o = i - 1;
903 if (arguments.length >= 2) s = arguments[1];
904 else
905 do {
906 if (o in r) {
907 s = r[o--];
908 break
909 }
910 if (--o < 0) throw new TypeError("reduceRight of empty array with no initial value")
911 } while (!0);
912 do o in this && (s = t.call(void 0, s, r[o], o, n)); while (o--);
913 return s
914 });
915 if (!Array.prototype.indexOf || [0, 1].indexOf(1, 2) != -1) Array.prototype.indexOf = function(t) {
916 var n = g && a(this) == "[object String]" ? this.split("") : F(this),
917 r = n.length >>> 0;
918 if (!r) return -1;
919 var i = 0;
920 arguments.length > 1 && (i = H(arguments[1])), i = i >= 0 ? i : Math.max(0, r + i);
921 for (; i < r; i++)
922 if (i in n && n[i] === t) return i;
923 return -1
924 };
925 if (!Array.prototype.lastIndexOf || [0, 1].lastIndexOf(0, -3) != -1) Array.prototype.lastIndexOf = function(t) {
926 var n = g && a(this) == "[object String]" ? this.split("") : F(this),
927 r = n.length >>> 0;
928 if (!r) return -1;
929 var i = r - 1;
930 arguments.length > 1 && (i = Math.min(i, H(arguments[1]))), i = i >= 0 ? i : r - Math.abs(i);
931 for (; i >= 0; i--)
932 if (i in n && t === n[i]) return i;
933 return -1
934 };
935 Object.getPrototypeOf || (Object.getPrototypeOf = function(t) {
936 return t.__proto__ || (t.constructor ? t.constructor.prototype : o)
937 });
938 if (!Object.getOwnPropertyDescriptor) {
939 var y = "Object.getOwnPropertyDescriptor called on a non-object: ";
940 Object.getOwnPropertyDescriptor = function(t, n) {
941 if (typeof t != "object" && typeof t != "function" || t === null) throw new TypeError(y + t);
942 if (!f(t, n)) return;
943 var r, i, s;
944 r = {
945 enumerable: !0,
946 configurable: !0
947 };
948 if (d) {
949 var u = t.__proto__;
950 t.__proto__ = o;
951 var i = h(t, n),
952 s = p(t, n);
953 t.__proto__ = u;
954 if (i || s) return i && (r.get = i), s && (r.set = s), r
955 }
956 return r.value = t[n], r
957 }
958 }
959 Object.getOwnPropertyNames || (Object.getOwnPropertyNames = function(t) {
960 return Object.keys(t)
961 });
962 if (!Object.create) {
963 var b;
964 Object.prototype.__proto__ === null ? b = function() {
965 return {
966 __proto__: null
967 }
968 } : b = function() {
969 var e = {};
970 for (var t in e) e[t] = null;
971 return e.constructor = e.hasOwnProperty = e.propertyIsEnumerable = e.isPrototypeOf = e.toLocaleString = e.toString = e.valueOf = e.__proto__ = null, e
972 }, Object.create = function(t, n) {
973 var r;
974 if (t === null) r = b();
975 else {
976 if (typeof t != "object") throw new TypeError("typeof prototype[" + typeof t + "] != 'object'");
977 var i = function() {};
978 i.prototype = t, r = new i, r.__proto__ = t
979 }
980 return n !== void 0 && Object.defineProperties(r, n), r
981 }
982 }
983 if (Object.defineProperty) {
984 var E = w({}),
985 S = typeof document == "undefined" || w(document.createElement("div"));
986 if (!E || !S) var x = Object.defineProperty
987 }
988 if (!Object.defineProperty || x) {
989 var T = "Property description must be an object: ",
990 N = "Object.defineProperty called on non-object: ",
991 C = "getters & setters can not be defined on this javascript engine";
992 Object.defineProperty = function(t, n, r) {
993 if (typeof t != "object" && typeof t != "function" || t === null) throw new TypeError(N + t);
994 if (typeof r != "object" && typeof r != "function" || r === null) throw new TypeError(T + r);
995 if (x) try {
996 return x.call(Object, t, n, r)
997 } catch (i) {}
998 if (f(r, "value"))
999 if (d && (h(t, n) || p(t, n))) {
1000 var s = t.__proto__;
1001 t.__proto__ = o, delete t[n], t[n] = r.value, t.__proto__ = s
1002 } else t[n] = r.value;
1003 else {
1004 if (!d) throw new TypeError(C);
1005 f(r, "get") && l(t, n, r.get), f(r, "set") && c(t, n, r.set)
1006 }
1007 return t
1008 }
1009 }
1010 Object.defineProperties || (Object.defineProperties = function(t, n) {
1011 for (var r in n) f(n, r) && Object.defineProperty(t, r, n[r]);
1012 return t
1013 }), Object.seal || (Object.seal = function(t) {
1014 return t
1015 }), Object.freeze || (Object.freeze = function(t) {
1016 return t
1017 });
1018 try {
1019 Object.freeze(function() {})
1020 } catch (k) {
1021 Object.freeze = function(t) {
1022 return function(n) {
1023 return typeof n == "function" ? n : t(n)
1024 }
1025 }(Object.freeze)
1026 }
1027 Object.preventExtensions || (Object.preventExtensions = function(t) {
1028 return t
1029 }), Object.isSealed || (Object.isSealed = function(t) {
1030 return !1
1031 }), Object.isFrozen || (Object.isFrozen = function(t) {
1032 return !1
1033 }), Object.isExtensible || (Object.isExtensible = function(t) {
1034 if (Object(t) === t) throw new TypeError;
1035 var n = "";
1036 while (f(t, n)) n += "?";
1037 t[n] = !0;
1038 var r = f(t, n);
1039 return delete t[n], r
1040 });
1041 if (!Object.keys) {
1042 var L = !0,
1043 A = ["toString", "toLocaleString", "valueOf", "hasOwnProperty", "isPrototypeOf", "propertyIsEnumerable", "constructor"],
1044 O = A.length;
1045 for (var M in {
1046 toString: null
1047 }) L = !1;
1048 Object.keys = function I(e) {
1049 if (typeof e != "object" && typeof e != "function" || e === null) throw new TypeError("Object.keys called on a non-object");
1050 var I = [];
1051 for (var t in e) f(e, t) && I.push(t);
1052 if (L)
1053 for (var n = 0, r = O; n < r; n++) {
1054 var i = A[n];
1055 f(e, i) && I.push(i)
1056 }
1057 return I
1058 }
1059 }
1060 Date.now || (Date.now = function() {
1061 return (new Date)
1062 .getTime()
1063 });
1064 var _ = " \n \f\r \u00a0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029\ufeff";
1065 if (!String.prototype.trim || _.trim()) {
1066 _ = "[" + _ + "]";
1067 var D = new RegExp("^" + _ + _ + "*"),
1068 P = new RegExp(_ + _ + "*$");
1069 String.prototype.trim = function() {
1070 return String(this)
1071 .replace(D, "")
1072 .replace(P, "")
1073 }
1074 }
1075 var F = function(e) {
1076 if (e == null) throw new TypeError("can't convert " + e + " to object");
1077 return Object(e)
1078 }
1079 })