@wiris/mathtype-ckeditor5 8.12.0 → 8.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,11 +1,11 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('ckeditor5')) :
3
- typeof define === 'function' && define.amd ? define(['ckeditor5'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global["@wiris/mathtype-ckeditor5"] = factory(global.CKEDITOR));
5
- })(this, (function (ckeditor5) { 'use strict';
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('ckeditor5')) :
3
+ typeof define === 'function' && define.amd ? define(['exports', 'ckeditor5'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["@wiris/mathtype-ckeditor5"] = {}, global.CKEDITOR));
5
+ })(this, (function (exports, ckeditor5) { 'use strict';
6
6
 
7
7
  var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
8
- /*! @license DOMPurify 3.2.3 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.2.3/LICENSE */
8
+ /*! @license DOMPurify 3.2.4 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.2.4/LICENSE */
9
9
 
10
10
  const {
11
11
  entries,
@@ -44,8 +44,10 @@
44
44
  };
45
45
  }
46
46
  const arrayForEach = unapply(Array.prototype.forEach);
47
+ const arrayLastIndexOf = unapply(Array.prototype.lastIndexOf);
47
48
  const arrayPop = unapply(Array.prototype.pop);
48
49
  const arrayPush = unapply(Array.prototype.push);
50
+ const arraySplice = unapply(Array.prototype.splice);
49
51
  const stringToLowerCase = unapply(String.prototype.toLowerCase);
50
52
  const stringToString = unapply(String.prototype.toString);
51
53
  const stringMatch = unapply(String.prototype.match);
@@ -201,7 +203,7 @@
201
203
  // eslint-disable-next-line unicorn/better-regex
202
204
  const MUSTACHE_EXPR = seal(/\{\{[\w\W]*|[\w\W]*\}\}/gm); // Specify template detection regex for SAFE_FOR_TEMPLATES mode
203
205
  const ERB_EXPR = seal(/<%[\w\W]*|[\w\W]*%>/gm);
204
- const TMPLIT_EXPR = seal(/\$\{[\w\W]*}/gm); // eslint-disable-line unicorn/better-regex
206
+ const TMPLIT_EXPR = seal(/\$\{[\w\W]*/gm); // eslint-disable-line unicorn/better-regex
205
207
  const DATA_ATTR = seal(/^data-[\-\w.\u00B7-\uFFFF]+$/); // eslint-disable-line no-useless-escape
206
208
  const ARIA_ATTR = seal(/^aria-[\-\w]+$/); // eslint-disable-line no-useless-escape
207
209
  const IS_ALLOWED_URI = seal(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i // eslint-disable-line no-useless-escape
@@ -230,20 +232,11 @@
230
232
  // https://developer.mozilla.org/en-US/docs/Web/API/Node/nodeType
231
233
  const NODE_TYPE = {
232
234
  element: 1,
233
- attribute: 2,
234
235
  text: 3,
235
- cdataSection: 4,
236
- entityReference: 5,
237
- // Deprecated
238
- entityNode: 6,
239
236
  // Deprecated
240
237
  progressingInstruction: 7,
241
238
  comment: 8,
242
- document: 9,
243
- documentType: 10,
244
- documentFragment: 11,
245
- notation: 12 // Deprecated
246
- };
239
+ document: 9};
247
240
  const getGlobal = function getGlobal() {
248
241
  return typeof window === 'undefined' ? null : window;
249
242
  };
@@ -301,9 +294,9 @@
301
294
  function createDOMPurify() {
302
295
  let window = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : getGlobal();
303
296
  const DOMPurify = root => createDOMPurify(root);
304
- DOMPurify.version = '3.2.3';
297
+ DOMPurify.version = '3.2.4';
305
298
  DOMPurify.removed = [];
306
- if (!window || !window.document || window.document.nodeType !== NODE_TYPE.document) {
299
+ if (!window || !window.document || window.document.nodeType !== NODE_TYPE.document || !window.Element) {
307
300
  // Not running in a browser, provide a factory function
308
301
  // so that you can pass your own Window
309
302
  DOMPurify.isSupported = false;
@@ -1322,7 +1315,11 @@
1322
1315
  }
1323
1316
  arrayPush(hooks[entryPoint], hookFunction);
1324
1317
  };
1325
- DOMPurify.removeHook = function (entryPoint) {
1318
+ DOMPurify.removeHook = function (entryPoint, hookFunction) {
1319
+ if (hookFunction !== undefined) {
1320
+ const index = arrayLastIndexOf(hooks[entryPoint], hookFunction);
1321
+ return index === -1 ? undefined : arraySplice(hooks[entryPoint], index, 1)[0];
1322
+ }
1326
1323
  return arrayPop(hooks[entryPoint]);
1327
1324
  };
1328
1325
  DOMPurify.removeHooks = function (entryPoint) {
@@ -1575,7 +1572,8 @@
1575
1572
  // Otherwise without the space
1576
1573
  if (mathml.indexOf(` class="wrs_${customEditor}"`) !== -1) {
1577
1574
  return mathml.replace(` class="wrs_${customEditor}"`, "");
1578
- } else if (mathml.indexOf(`class="wrs_${customEditor}"`) !== -1) {
1575
+ }
1576
+ if (mathml.indexOf(`class="wrs_${customEditor}"`) !== -1) {
1579
1577
  return mathml.replace(`class="wrs_${customEditor}"`, "");
1580
1578
  }
1581
1579
  // Non Trivial case: class attribute contains editor name.
@@ -3744,9 +3742,9 @@
3744
3742
  * @returns {string} html sanitized.
3745
3743
  * @static
3746
3744
  */ static htmlSanitize(html) {
3747
- let annotationRegex = /\<annotation.+\<\/annotation\>/;
3745
+ const annotationRegex = /\<annotation.+\<\/annotation\>/;
3748
3746
  // Get all the annotation content including the tags.
3749
- let annotation = html.match(annotationRegex);
3747
+ const annotation = html.match(annotationRegex);
3750
3748
  // Sanitize html code without removing our supported MathML tags and attributes.
3751
3749
  html = purify.sanitize(html, {
3752
3750
  ADD_TAGS: [
@@ -4097,9 +4095,10 @@
4097
4095
  if (position !== 0 && node.childNodes[position - 1].localName === "span" && node.childNodes[position].classList?.contains("Wirisformula")) {
4098
4096
  node.childNodes[position - 1].remove();
4099
4097
  return Util.getSelectedItem(target, isIframe, forceGetSelection);
4100
- } else if (node.childNodes[position].classList?.contains("Wirisformula")) {
4098
+ }
4099
+ if (node.childNodes[position].classList?.contains("Wirisformula")) {
4101
4100
  if (position > 0 && node.childNodes[position - 1].classList?.contains("Wirisformula") || position === 0) {
4102
- var emptySpan = document.createElement("span");
4101
+ const emptySpan = document.createElement("span");
4103
4102
  node.insertBefore(emptySpan, node.childNodes[position]);
4104
4103
  return {
4105
4104
  node: node.childNodes[position]
@@ -4525,7 +4524,7 @@
4525
4524
  processImg(img);
4526
4525
  // if it does contain a blob, then read that, replace the src with the decoded content, and process it
4527
4526
  } else {
4528
- let reader = new FileReader();
4527
+ const reader = new FileReader();
4529
4528
  reader.onload = function() {
4530
4529
  img.setAttribute("src", reader.result);
4531
4530
  processImg(img);
@@ -6133,7 +6132,7 @@
6133
6132
  */ static async finish() {
6134
6133
  if (!this.telemeter) return;
6135
6134
  try {
6136
- let local_telemeter = this.telemeter;
6135
+ const local_telemeter = this.telemeter;
6137
6136
  this.telemeter = undefined;
6138
6137
  await local_telemeter.finish();
6139
6138
  } catch (e) {
@@ -6515,7 +6514,7 @@
6515
6514
  } else {
6516
6515
  this.setMathML(this.mathML);
6517
6516
  }
6518
- let toolbar = this.updateToolbar();
6517
+ const toolbar = this.updateToolbar();
6519
6518
  this.onFocus();
6520
6519
  if (this.deviceProperties.isIOS) {
6521
6520
  const zoom = document.documentElement.clientWidth / window.innerWidth;
@@ -6524,12 +6523,12 @@
6524
6523
  this.setKeyboardMode();
6525
6524
  }
6526
6525
  }
6527
- let trigger = this.dbclick ? "formula" : "button";
6526
+ const trigger = this.dbclick ? "formula" : "button";
6528
6527
  // Call Telemetry service to track the event.
6529
6528
  try {
6530
6529
  Telemeter.telemeter.track("OPENED_MTCT_EDITOR", {
6531
- toolbar: toolbar,
6532
- trigger: trigger
6530
+ toolbar,
6531
+ trigger
6533
6532
  });
6534
6533
  } catch (error) {
6535
6534
  console.error("Error tracking OPENED_MTCT_EDITOR", error);
@@ -6730,14 +6729,12 @@
6730
6729
  this.modalDialogInstance.closeDiv.focus();
6731
6730
  keyboardEvent.stopPropagation();
6732
6731
  keyboardEvent.preventDefault();
6733
- } else {
6734
- if (document.activeElement === this.modalDialogInstance.minimizeDiv) {
6735
- // Focus on cancel button.
6736
- if (!(this.modalDialogInstance.properties.state === "minimized")) {
6737
- this.modalDialogInstance.cancelButton.focus();
6738
- keyboardEvent.stopPropagation();
6739
- keyboardEvent.preventDefault();
6740
- }
6732
+ } else if (document.activeElement === this.modalDialogInstance.minimizeDiv) {
6733
+ // Focus on cancel button.
6734
+ if (!(this.modalDialogInstance.properties.state === "minimized")) {
6735
+ this.modalDialogInstance.cancelButton.focus();
6736
+ keyboardEvent.stopPropagation();
6737
+ keyboardEvent.preventDefault();
6741
6738
  }
6742
6739
  }
6743
6740
  } else if (keyboardEvent.key === "Tab") {
@@ -7528,7 +7525,7 @@
7528
7525
  try {
7529
7526
  await Telemeter.telemeter.track("CLOSED_MTCT_EDITOR", {
7530
7527
  toolbar: this.contentManager.toolbar,
7531
- trigger: trigger
7528
+ trigger
7532
7529
  });
7533
7530
  } catch (error) {
7534
7531
  console.error("Error tracking CLOSED_MTCT_EDITOR", error);
@@ -7896,27 +7893,27 @@
7896
7893
  this.stackDiv.addEventListener("click", this.stack.bind(this), true);
7897
7894
  this.minimizeDiv.addEventListener("click", this.minimize.bind(this), true);
7898
7895
  this.closeDiv.addEventListener("click", this.cancelAction.bind(this));
7899
- this.maximizeDiv.addEventListener("keypress", function(e) {
7896
+ this.maximizeDiv.addEventListener("keypress", (e)=>{
7900
7897
  if (e.key === "Enter" || e.key === " " || e.keyCode === 13 || e.keyCode === 32) {
7901
7898
  // Handle enter and space.
7902
7899
  e.target.click();
7903
7900
  }
7904
7901
  }, true);
7905
- this.stackDiv.addEventListener("keypress", function(e) {
7902
+ this.stackDiv.addEventListener("keypress", (e)=>{
7906
7903
  if (e.key === "Enter" || e.key === " " || e.keyCode === 13 || e.keyCode === 32) {
7907
7904
  // Handle enter and space.
7908
7905
  e.target.click();
7909
7906
  e.preventDefault();
7910
7907
  }
7911
7908
  }, true);
7912
- this.minimizeDiv.addEventListener("keypress", function(e) {
7909
+ this.minimizeDiv.addEventListener("keypress", (e)=>{
7913
7910
  if (e.key === "Enter" || e.key === " " || e.keyCode === 13 || e.keyCode === 32) {
7914
7911
  // Handle enter and space.
7915
7912
  e.target.click();
7916
7913
  e.preventDefault();
7917
7914
  }
7918
7915
  }, true);
7919
- this.closeDiv.addEventListener("keypress", function(e) {
7916
+ this.closeDiv.addEventListener("keypress", (e)=>{
7920
7917
  if (e.key === "Enter" || e.key === " " || e.keyCode === 13 || e.keyCode === 32) {
7921
7918
  // Handle enter and space.
7922
7919
  e.target.click();
@@ -8926,7 +8923,7 @@
8926
8923
  }
8927
8924
  // Build the telemeter payload separated to delete null/undefined entries.
8928
8925
  const mathml = element?.dataset?.mathml;
8929
- let payload = {
8926
+ const payload = {
8930
8927
  mathml_origin: mathmlOrigin ? MathML.safeXmlDecode(mathmlOrigin) : mathmlOrigin,
8931
8928
  mathml: mathml ? MathML.safeXmlDecode(mathml) : mathml,
8932
8929
  elapsed_time: Date.now() - this.editionProperties.editionStartTime,
@@ -9285,7 +9282,7 @@
9285
9282
  attributes = {};
9286
9283
  attributes.class = "wrs_modal_offline_warn";
9287
9284
  this.offlineModalWarn = Util.createElement("span", attributes);
9288
- let generalStyle = `background-image: url(data:image/svg+xml;base64,${window.btoa(warnIcon)})`;
9285
+ const generalStyle = `background-image: url(data:image/svg+xml;base64,${window.btoa(warnIcon)})`;
9289
9286
  this.offlineModalWarn.setAttribute("style", generalStyle);
9290
9287
  attributes = {};
9291
9288
  attributes.class = "wrs_modal_offline_text_container";
@@ -9298,7 +9295,7 @@
9298
9295
  attributes.class = "wrs_modal_offline_text";
9299
9296
  this.offlineModalMessage2 = Util.createElement("p", attributes);
9300
9297
  this.offlineModalMessage2.innerHTML = `Thank you for using MathType. We have detected you are disconnected from the network. We remind you that you'll need to be connected to use MathType. <br /><br />Please refresh the page if this message continues appearing.`;
9301
- //Append offline modal elements
9298
+ // Append offline modal elements
9302
9299
  this.offlineModalContent.appendChild(this.offlineModalClose);
9303
9300
  this.offlineModalMessage.appendChild(this.offlineModalMessage1);
9304
9301
  this.offlineModalMessage.appendChild(this.offlineModalMessage2);
@@ -9306,8 +9303,8 @@
9306
9303
  this.offlineModalContent.appendChild(this.offlineModalWarn);
9307
9304
  this.offlineModal.appendChild(this.offlineModalContent);
9308
9305
  document.body.appendChild(this.offlineModal);
9309
- let modal = document.getElementById("wrs_modal_offline");
9310
- this.offlineModalClose.addEventListener("click", function() {
9306
+ const modal = document.getElementById("wrs_modal_offline");
9307
+ this.offlineModalClose.addEventListener("click", ()=>{
9311
9308
  modal.style.display = "none";
9312
9309
  });
9313
9310
  // Store editor name for telemetry purposes.
@@ -9317,7 +9314,8 @@
9317
9314
  if (editorName.includes("Generic")) editorName = "Generic"; // Remove version from Generic editor.
9318
9315
  let solutionTelemeter = editorName;
9319
9316
  // If moodle, add information to hosts and solution.
9320
- let isMoodle = !!(typeof M === "object" && M !== null), lms;
9317
+ const isMoodle = !!(typeof M === "object" && M !== null);
9318
+ let lms;
9321
9319
  if (isMoodle) {
9322
9320
  solutionTelemeter = "Moodle";
9323
9321
  lms = {
@@ -9332,9 +9330,9 @@
9332
9330
  }
9333
9331
  }
9334
9332
  // Get the OS and its version.
9335
- let OSData = this.getOS();
9333
+ const OSData = this.getOS();
9336
9334
  // Get the broswer and its version.
9337
- let broswerData = this.getBrowser();
9335
+ const broswerData = this.getBrowser();
9338
9336
  // Create list of hosts to send to telemetry.
9339
9337
  let hosts = [
9340
9338
  {
@@ -9359,17 +9357,17 @@
9359
9357
  lms
9360
9358
  ];
9361
9359
  // Filter hosts to remove empty objects and empty keys.
9362
- hosts = hosts.filter(function(element) {
9360
+ hosts = hosts.filter((element)=>{
9363
9361
  if (element) Object.keys(element).forEach((key)=>element[key] === "unknown" ? delete element[key] : {});
9364
9362
  return element !== undefined;
9365
9363
  });
9366
9364
  // Initialize telemeter
9367
9365
  Telemeter.init({
9368
9366
  solution: {
9369
- name: "MathType for " + solutionTelemeter,
9367
+ name: `MathType for ${solutionTelemeter}`,
9370
9368
  version: this.version
9371
9369
  },
9372
- hosts: hosts,
9370
+ hosts,
9373
9371
  config: {
9374
9372
  test: false,
9375
9373
  debug: false,
@@ -9385,24 +9383,25 @@
9385
9383
  * versionBrowser = Operating System version.
9386
9384
  */ getBrowser() {
9387
9385
  // default value for OS just in case nothing is detected
9388
- let detectedBrowser = "unknown", versionBrowser = "unknown";
9389
- let userAgent = window.navigator.userAgent;
9386
+ let detectedBrowser = "unknown";
9387
+ let versionBrowser = "unknown";
9388
+ const userAgent = window.navigator.userAgent;
9390
9389
  if (/Brave/.test(userAgent)) {
9391
9390
  detectedBrowser = "brave";
9392
9391
  if (userAgent.indexOf("Brave/")) {
9393
- let start = userAgent.indexOf("Brave") + 6;
9392
+ const start = userAgent.indexOf("Brave") + 6;
9394
9393
  let end = userAgent.substring(start).indexOf(" ");
9395
9394
  end = end === -1 ? userAgent.lastIndexOf("") : end;
9396
9395
  versionBrowser = userAgent.substring(start, end + start).replace("_", ".").replace(/[^\d.-]/g, "");
9397
9396
  }
9398
9397
  } else if (userAgent.indexOf("Edg/") !== -1) {
9399
9398
  detectedBrowser = "edge_chromium";
9400
- let start = userAgent.indexOf("Edg/") + 4;
9399
+ const start = userAgent.indexOf("Edg/") + 4;
9401
9400
  versionBrowser = userAgent.substring(start).replace("_", ".").replace(/[^\d.-]/g, "");
9402
9401
  } else if (/Edg/.test(userAgent)) {
9403
9402
  detectedBrowser = "edge";
9404
9403
  let start = userAgent.indexOf("Edg") + 3;
9405
- start = start + userAgent.substring(start).indexOf("/");
9404
+ start += userAgent.substring(start).indexOf("/");
9406
9405
  let end = userAgent.substring(start).indexOf(" ");
9407
9406
  end = end === -1 ? userAgent.lastIndexOf("") : end;
9408
9407
  versionBrowser = userAgent.substring(start, end + start).replace("_", ".").replace(/[^\d.-]/g, "");
@@ -9416,7 +9415,7 @@
9416
9415
  versionBrowser = userAgent.substring(start, end + start).replace("_", ".");
9417
9416
  } else if (/OPR/.test(userAgent)) {
9418
9417
  detectedBrowser = "opera";
9419
- let start = userAgent.indexOf("OPR/") + 4;
9418
+ const start = userAgent.indexOf("OPR/") + 4;
9420
9419
  let end = userAgent.substring(start).indexOf(" ");
9421
9420
  end = end === -1 ? userAgent.lastIndexOf("") : end;
9422
9421
  versionBrowser = userAgent.substring(start, end + start).replace("_", ".").replace(/[^\d.-]/g, "");
@@ -9447,19 +9446,24 @@
9447
9446
  * versionOS = Operating System version.
9448
9447
  */ getOS() {
9449
9448
  // default value for OS just in case nothing is detected
9450
- let detectedOS = "unknown", versionOS = "unknown";
9449
+ let detectedOS = "unknown";
9450
+ let versionOS = "unknown";
9451
9451
  // Retrieve properties to easily detect the OS
9452
- let userAgent = window.navigator.userAgent, platform = window.navigator.platform, macosPlatforms = [
9452
+ const userAgent = window.navigator.userAgent;
9453
+ const platform = window.navigator.platform;
9454
+ const macosPlatforms = [
9453
9455
  "Macintosh",
9454
9456
  "MacIntel",
9455
9457
  "MacPPC",
9456
9458
  "Mac68K"
9457
- ], windowsPlatforms = [
9459
+ ];
9460
+ const windowsPlatforms = [
9458
9461
  "Win32",
9459
9462
  "Win64",
9460
9463
  "Windows",
9461
9464
  "WinCE"
9462
- ], iosPlatforms = [
9465
+ ];
9466
+ const iosPlatforms = [
9463
9467
  "iPhone",
9464
9468
  "iPad",
9465
9469
  "iPod"
@@ -9468,20 +9472,20 @@
9468
9472
  if (macosPlatforms.indexOf(platform) !== -1) {
9469
9473
  detectedOS = "macos";
9470
9474
  if (userAgent.indexOf("OS X") !== -1) {
9471
- let start = userAgent.indexOf("OS X") + 5;
9472
- let end = userAgent.substring(start).indexOf(" ");
9475
+ const start = userAgent.indexOf("OS X") + 5;
9476
+ const end = userAgent.substring(start).indexOf(" ");
9473
9477
  versionOS = userAgent.substring(start, end + start).replace("_", ".").replace(/[^\d.-]/g, "");
9474
9478
  }
9475
9479
  } else if (iosPlatforms.indexOf(platform) !== -1) {
9476
9480
  detectedOS = "ios";
9477
9481
  if (userAgent.indexOf("OS ") !== -1) {
9478
- let start = userAgent.indexOf("OS ") + 3;
9479
- let end = userAgent.substring(start).indexOf(")");
9482
+ const start = userAgent.indexOf("OS ") + 3;
9483
+ const end = userAgent.substring(start).indexOf(")");
9480
9484
  versionOS = userAgent.substring(start, end + start).replace("_", ".").replace(/[^\d.-]/g, "");
9481
9485
  }
9482
9486
  } else if (windowsPlatforms.indexOf(platform) !== -1) {
9483
9487
  detectedOS = "windows";
9484
- let start = userAgent.indexOf("Windows");
9488
+ const start = userAgent.indexOf("Windows");
9485
9489
  let end = userAgent.substring(start).indexOf(";");
9486
9490
  if (end === -1) {
9487
9491
  end = userAgent.substring(start).indexOf(")");
@@ -9489,7 +9493,7 @@
9489
9493
  versionOS = userAgent.substring(start, end + start).replace("_", ".").replace(/[^\d.-]/g, "");
9490
9494
  } else if (/Android/.test(userAgent)) {
9491
9495
  detectedOS = "android";
9492
- let start = userAgent.indexOf("Android");
9496
+ const start = userAgent.indexOf("Android");
9493
9497
  let end = userAgent.substring(start).indexOf(";");
9494
9498
  if (end === -1) {
9495
9499
  end = userAgent.substring(start).indexOf(")");
@@ -9498,8 +9502,8 @@
9498
9502
  } else if (/CrOS/.test(userAgent)) {
9499
9503
  detectedOS = "chromeos";
9500
9504
  let start = userAgent.indexOf("CrOS ") + 5;
9501
- start = start + userAgent.substring(start).indexOf(" ");
9502
- let end = userAgent.substring(start).indexOf(")");
9505
+ start += userAgent.substring(start).indexOf(" ");
9506
+ const end = userAgent.substring(start).indexOf(")");
9503
9507
  versionOS = userAgent.substring(start, end + start).replace("_", ".").replace(/[^\d.-]/g, "");
9504
9508
  } else if (detectedOS === "unknown" && /Linux/.test(platform)) {
9505
9509
  detectedOS = "linux";
@@ -9573,7 +9577,7 @@
9573
9577
  this.core.editionProperties.isNewElement = true;
9574
9578
  this.core.openModalDialog(this.target, this.isIframe);
9575
9579
  } else {
9576
- let modal = document.getElementById("wrs_modal_offline");
9580
+ const modal = document.getElementById("wrs_modal_offline");
9577
9581
  modal.style.display = "block";
9578
9582
  }
9579
9583
  }
@@ -9585,7 +9589,7 @@
9585
9589
  this.core.editionProperties.isNewElement = false;
9586
9590
  this.core.openModalDialog(this.target, this.isIframe);
9587
9591
  } else {
9588
- let modal = document.getElementById("wrs_modal_offline");
9592
+ const modal = document.getElementById("wrs_modal_offline");
9589
9593
  modal.style.display = "block";
9590
9594
  }
9591
9595
  }
@@ -9827,6 +9831,1145 @@
9827
9831
  "editorParameters"
9828
9832
  ];
9829
9833
 
9834
+ (function() {
9835
+ var HxOverrides = function() {};
9836
+ HxOverrides.__name__ = true;
9837
+ HxOverrides.dateStr = function(date) {
9838
+ var m = date.getMonth() + 1;
9839
+ var d = date.getDate();
9840
+ var h = date.getHours();
9841
+ var mi = date.getMinutes();
9842
+ var s = date.getSeconds();
9843
+ return date.getFullYear() + "-" + (m < 10 ? "0" + m : "" + m) + "-" + (d < 10 ? "0" + d : "" + d) + " " + (h < 10 ? "0" + h : "" + h) + ":" + (mi < 10 ? "0" + mi : "" + mi) + ":" + (s < 10 ? "0" + s : "" + s);
9844
+ };
9845
+ HxOverrides.strDate = function(s) {
9846
+ switch(s.length){
9847
+ case 8:
9848
+ var k = s.split(":");
9849
+ var d = new Date();
9850
+ d.setTime(0);
9851
+ d.setUTCHours(k[0]);
9852
+ d.setUTCMinutes(k[1]);
9853
+ d.setUTCSeconds(k[2]);
9854
+ return d;
9855
+ case 10:
9856
+ var k = s.split("-");
9857
+ return new Date(k[0], k[1] - 1, k[2], 0, 0, 0);
9858
+ case 19:
9859
+ var k = s.split(" ");
9860
+ var y = k[0].split("-");
9861
+ var t = k[1].split(":");
9862
+ return new Date(y[0], y[1] - 1, y[2], t[0], t[1], t[2]);
9863
+ default:
9864
+ throw "Invalid date format : " + s;
9865
+ }
9866
+ };
9867
+ HxOverrides.cca = function(s, index) {
9868
+ var x = s.charCodeAt(index);
9869
+ if (x != x) return undefined;
9870
+ return x;
9871
+ };
9872
+ HxOverrides.substr = function(s, pos, len) {
9873
+ if (pos != null && pos != 0 && len != null && len < 0) return "";
9874
+ if (len == null) len = s.length;
9875
+ if (pos < 0) {
9876
+ pos = s.length + pos;
9877
+ if (pos < 0) pos = 0;
9878
+ } else if (len < 0) len = s.length + len - pos;
9879
+ return s.substr(pos, len);
9880
+ };
9881
+ HxOverrides.remove = function(a, obj) {
9882
+ var i = 0;
9883
+ var l = a.length;
9884
+ while(i < l){
9885
+ if (a[i] == obj) {
9886
+ a.splice(i, 1);
9887
+ return true;
9888
+ }
9889
+ i++;
9890
+ }
9891
+ return false;
9892
+ };
9893
+ HxOverrides.iter = function(a) {
9894
+ return {
9895
+ cur: 0,
9896
+ arr: a,
9897
+ hasNext: function() {
9898
+ return this.cur < this.arr.length;
9899
+ },
9900
+ next: function() {
9901
+ return this.arr[this.cur++];
9902
+ }
9903
+ };
9904
+ };
9905
+ var IntIter = function(min, max) {
9906
+ this.min = min;
9907
+ this.max = max;
9908
+ };
9909
+ IntIter.__name__ = true;
9910
+ IntIter.prototype = {
9911
+ next: function() {
9912
+ return this.min++;
9913
+ },
9914
+ hasNext: function() {
9915
+ return this.min < this.max;
9916
+ },
9917
+ __class__: IntIter
9918
+ };
9919
+ var Std = function() {};
9920
+ Std.__name__ = true;
9921
+ Std["is"] = function(v, t) {
9922
+ return js.Boot.__instanceof(v, t);
9923
+ };
9924
+ Std.string = function(s) {
9925
+ return js.Boot.__string_rec(s, "");
9926
+ };
9927
+ Std["int"] = function(x) {
9928
+ return x | 0;
9929
+ };
9930
+ Std.parseInt = function(x) {
9931
+ var v = parseInt(x, 10);
9932
+ if (v == 0 && (HxOverrides.cca(x, 1) == 120 || HxOverrides.cca(x, 1) == 88)) v = parseInt(x);
9933
+ if (isNaN(v)) return null;
9934
+ return v;
9935
+ };
9936
+ Std.parseFloat = function(x) {
9937
+ return parseFloat(x);
9938
+ };
9939
+ Std.random = function(x) {
9940
+ return Math.floor(Math.random() * x);
9941
+ };
9942
+ var com = com || {};
9943
+ if (!com.wiris) com.wiris = {};
9944
+ if (!com.wiris.js) com.wiris.js = {};
9945
+ com.wiris.js.JsPluginTools = function() {
9946
+ this.tryReady();
9947
+ };
9948
+ com.wiris.js.JsPluginTools.__name__ = true;
9949
+ com.wiris.js.JsPluginTools.main = function() {
9950
+ var ev;
9951
+ ev = com.wiris.js.JsPluginTools.getInstance();
9952
+ haxe.Timer.delay($bind(ev, ev.tryReady), 100);
9953
+ };
9954
+ com.wiris.js.JsPluginTools.getInstance = function() {
9955
+ if (com.wiris.js.JsPluginTools.instance == null) com.wiris.js.JsPluginTools.instance = new com.wiris.js.JsPluginTools();
9956
+ return com.wiris.js.JsPluginTools.instance;
9957
+ };
9958
+ com.wiris.js.JsPluginTools.bypassEncapsulation = function() {
9959
+ if (window.com == null) window.com = {};
9960
+ if (window.com.wiris == null) window.com.wiris = {};
9961
+ if (window.com.wiris.js == null) window.com.wiris.js = {};
9962
+ if (window.com.wiris.js.JsPluginTools == null) window.com.wiris.js.JsPluginTools = com.wiris.js.JsPluginTools.getInstance();
9963
+ };
9964
+ com.wiris.js.JsPluginTools.prototype = {
9965
+ md5encode: function(content) {
9966
+ return haxe.Md5.encode(content);
9967
+ },
9968
+ doLoad: function() {
9969
+ this.ready = true;
9970
+ com.wiris.js.JsPluginTools.instance = this;
9971
+ com.wiris.js.JsPluginTools.bypassEncapsulation();
9972
+ },
9973
+ tryReady: function() {
9974
+ this.ready = false;
9975
+ if (js.Lib.document.readyState) {
9976
+ this.doLoad();
9977
+ this.ready = true;
9978
+ }
9979
+ if (!this.ready) haxe.Timer.delay($bind(this, this.tryReady), 100);
9980
+ },
9981
+ __class__: com.wiris.js.JsPluginTools
9982
+ };
9983
+ var haxe = haxe || {};
9984
+ haxe.Log = function() {};
9985
+ haxe.Log.__name__ = true;
9986
+ haxe.Log.trace = function(v, infos) {
9987
+ js.Boot.__trace(v, infos);
9988
+ };
9989
+ haxe.Log.clear = function() {
9990
+ js.Boot.__clear_trace();
9991
+ };
9992
+ haxe.Md5 = function() {};
9993
+ haxe.Md5.__name__ = true;
9994
+ haxe.Md5.encode = function(s) {
9995
+ return new haxe.Md5().doEncode(s);
9996
+ };
9997
+ haxe.Md5.prototype = {
9998
+ doEncode: function(str) {
9999
+ var x = this.str2blks(str);
10000
+ var a = 1732584193;
10001
+ var b = -271733879;
10002
+ var c = -1732584194;
10003
+ var d = 271733878;
10004
+ var i = 0;
10005
+ while(i < x.length){
10006
+ var olda = a;
10007
+ var oldb = b;
10008
+ var oldc = c;
10009
+ var oldd = d;
10010
+ a = this.ff(a, b, c, d, x[i], 7, -680876936);
10011
+ d = this.ff(d, a, b, c, x[i + 1], 12, -389564586);
10012
+ c = this.ff(c, d, a, b, x[i + 2], 17, 606105819);
10013
+ b = this.ff(b, c, d, a, x[i + 3], 22, -1044525330);
10014
+ a = this.ff(a, b, c, d, x[i + 4], 7, -176418897);
10015
+ d = this.ff(d, a, b, c, x[i + 5], 12, 1200080426);
10016
+ c = this.ff(c, d, a, b, x[i + 6], 17, -1473231341);
10017
+ b = this.ff(b, c, d, a, x[i + 7], 22, -45705983);
10018
+ a = this.ff(a, b, c, d, x[i + 8], 7, 1770035416);
10019
+ d = this.ff(d, a, b, c, x[i + 9], 12, -1958414417);
10020
+ c = this.ff(c, d, a, b, x[i + 10], 17, -42063);
10021
+ b = this.ff(b, c, d, a, x[i + 11], 22, -1990404162);
10022
+ a = this.ff(a, b, c, d, x[i + 12], 7, 1804603682);
10023
+ d = this.ff(d, a, b, c, x[i + 13], 12, -40341101);
10024
+ c = this.ff(c, d, a, b, x[i + 14], 17, -1502002290);
10025
+ b = this.ff(b, c, d, a, x[i + 15], 22, 1236535329);
10026
+ a = this.gg(a, b, c, d, x[i + 1], 5, -165796510);
10027
+ d = this.gg(d, a, b, c, x[i + 6], 9, -1069501632);
10028
+ c = this.gg(c, d, a, b, x[i + 11], 14, 643717713);
10029
+ b = this.gg(b, c, d, a, x[i], 20, -373897302);
10030
+ a = this.gg(a, b, c, d, x[i + 5], 5, -701558691);
10031
+ d = this.gg(d, a, b, c, x[i + 10], 9, 38016083);
10032
+ c = this.gg(c, d, a, b, x[i + 15], 14, -660478335);
10033
+ b = this.gg(b, c, d, a, x[i + 4], 20, -405537848);
10034
+ a = this.gg(a, b, c, d, x[i + 9], 5, 568446438);
10035
+ d = this.gg(d, a, b, c, x[i + 14], 9, -1019803690);
10036
+ c = this.gg(c, d, a, b, x[i + 3], 14, -187363961);
10037
+ b = this.gg(b, c, d, a, x[i + 8], 20, 1163531501);
10038
+ a = this.gg(a, b, c, d, x[i + 13], 5, -1444681467);
10039
+ d = this.gg(d, a, b, c, x[i + 2], 9, -51403784);
10040
+ c = this.gg(c, d, a, b, x[i + 7], 14, 1735328473);
10041
+ b = this.gg(b, c, d, a, x[i + 12], 20, -1926607734);
10042
+ a = this.hh(a, b, c, d, x[i + 5], 4, -378558);
10043
+ d = this.hh(d, a, b, c, x[i + 8], 11, -2022574463);
10044
+ c = this.hh(c, d, a, b, x[i + 11], 16, 1839030562);
10045
+ b = this.hh(b, c, d, a, x[i + 14], 23, -35309556);
10046
+ a = this.hh(a, b, c, d, x[i + 1], 4, -1530992060);
10047
+ d = this.hh(d, a, b, c, x[i + 4], 11, 1272893353);
10048
+ c = this.hh(c, d, a, b, x[i + 7], 16, -155497632);
10049
+ b = this.hh(b, c, d, a, x[i + 10], 23, -1094730640);
10050
+ a = this.hh(a, b, c, d, x[i + 13], 4, 681279174);
10051
+ d = this.hh(d, a, b, c, x[i], 11, -358537222);
10052
+ c = this.hh(c, d, a, b, x[i + 3], 16, -722521979);
10053
+ b = this.hh(b, c, d, a, x[i + 6], 23, 76029189);
10054
+ a = this.hh(a, b, c, d, x[i + 9], 4, -640364487);
10055
+ d = this.hh(d, a, b, c, x[i + 12], 11, -421815835);
10056
+ c = this.hh(c, d, a, b, x[i + 15], 16, 530742520);
10057
+ b = this.hh(b, c, d, a, x[i + 2], 23, -995338651);
10058
+ a = this.ii(a, b, c, d, x[i], 6, -198630844);
10059
+ d = this.ii(d, a, b, c, x[i + 7], 10, 1126891415);
10060
+ c = this.ii(c, d, a, b, x[i + 14], 15, -1416354905);
10061
+ b = this.ii(b, c, d, a, x[i + 5], 21, -57434055);
10062
+ a = this.ii(a, b, c, d, x[i + 12], 6, 1700485571);
10063
+ d = this.ii(d, a, b, c, x[i + 3], 10, -1894986606);
10064
+ c = this.ii(c, d, a, b, x[i + 10], 15, -1051523);
10065
+ b = this.ii(b, c, d, a, x[i + 1], 21, -2054922799);
10066
+ a = this.ii(a, b, c, d, x[i + 8], 6, 1873313359);
10067
+ d = this.ii(d, a, b, c, x[i + 15], 10, -30611744);
10068
+ c = this.ii(c, d, a, b, x[i + 6], 15, -1560198380);
10069
+ b = this.ii(b, c, d, a, x[i + 13], 21, 1309151649);
10070
+ a = this.ii(a, b, c, d, x[i + 4], 6, -145523070);
10071
+ d = this.ii(d, a, b, c, x[i + 11], 10, -1120210379);
10072
+ c = this.ii(c, d, a, b, x[i + 2], 15, 718787259);
10073
+ b = this.ii(b, c, d, a, x[i + 9], 21, -343485551);
10074
+ a = this.addme(a, olda);
10075
+ b = this.addme(b, oldb);
10076
+ c = this.addme(c, oldc);
10077
+ d = this.addme(d, oldd);
10078
+ i += 16;
10079
+ }
10080
+ return this.rhex(a) + this.rhex(b) + this.rhex(c) + this.rhex(d);
10081
+ },
10082
+ ii: function(a, b, c, d, x, s, t) {
10083
+ return this.cmn(this.bitXOR(c, this.bitOR(b, ~d)), a, b, x, s, t);
10084
+ },
10085
+ hh: function(a, b, c, d, x, s, t) {
10086
+ return this.cmn(this.bitXOR(this.bitXOR(b, c), d), a, b, x, s, t);
10087
+ },
10088
+ gg: function(a, b, c, d, x, s, t) {
10089
+ return this.cmn(this.bitOR(this.bitAND(b, d), this.bitAND(c, ~d)), a, b, x, s, t);
10090
+ },
10091
+ ff: function(a, b, c, d, x, s, t) {
10092
+ return this.cmn(this.bitOR(this.bitAND(b, c), this.bitAND(~b, d)), a, b, x, s, t);
10093
+ },
10094
+ cmn: function(q, a, b, x, s, t) {
10095
+ return this.addme(this.rol(this.addme(this.addme(a, q), this.addme(x, t)), s), b);
10096
+ },
10097
+ rol: function(num, cnt) {
10098
+ return num << cnt | num >>> 32 - cnt;
10099
+ },
10100
+ str2blks: function(str) {
10101
+ var nblk = (str.length + 8 >> 6) + 1;
10102
+ var blks = new Array();
10103
+ var _g1 = 0, _g = nblk * 16;
10104
+ while(_g1 < _g){
10105
+ var i = _g1++;
10106
+ blks[i] = 0;
10107
+ }
10108
+ var i = 0;
10109
+ while(i < str.length){
10110
+ blks[i >> 2] |= HxOverrides.cca(str, i) << (str.length * 8 + i) % 4 * 8;
10111
+ i++;
10112
+ }
10113
+ blks[i >> 2] |= 128 << (str.length * 8 + i) % 4 * 8;
10114
+ var l = str.length * 8;
10115
+ var k = nblk * 16 - 2;
10116
+ blks[k] = l & 255;
10117
+ blks[k] |= (l >>> 8 & 255) << 8;
10118
+ blks[k] |= (l >>> 16 & 255) << 16;
10119
+ blks[k] |= (l >>> 24 & 255) << 24;
10120
+ return blks;
10121
+ },
10122
+ rhex: function(num) {
10123
+ var str = "";
10124
+ var hex_chr = "0123456789abcdef";
10125
+ var _g = 0;
10126
+ while(_g < 4){
10127
+ var j = _g++;
10128
+ str += hex_chr.charAt(num >> j * 8 + 4 & 15) + hex_chr.charAt(num >> j * 8 & 15);
10129
+ }
10130
+ return str;
10131
+ },
10132
+ addme: function(x, y) {
10133
+ var lsw = (x & 65535) + (y & 65535);
10134
+ var msw = (x >> 16) + (y >> 16) + (lsw >> 16);
10135
+ return msw << 16 | lsw & 65535;
10136
+ },
10137
+ bitAND: function(a, b) {
10138
+ var lsb = a & 1 & (b & 1);
10139
+ var msb31 = a >>> 1 & b >>> 1;
10140
+ return msb31 << 1 | lsb;
10141
+ },
10142
+ bitXOR: function(a, b) {
10143
+ var lsb = a & 1 ^ b & 1;
10144
+ var msb31 = a >>> 1 ^ b >>> 1;
10145
+ return msb31 << 1 | lsb;
10146
+ },
10147
+ bitOR: function(a, b) {
10148
+ var lsb = a & 1 | b & 1;
10149
+ var msb31 = a >>> 1 | b >>> 1;
10150
+ return msb31 << 1 | lsb;
10151
+ },
10152
+ __class__: haxe.Md5
10153
+ };
10154
+ haxe.Timer = function(time_ms) {
10155
+ var me = this;
10156
+ this.id = window.setInterval(function() {
10157
+ me.run();
10158
+ }, time_ms);
10159
+ };
10160
+ haxe.Timer.__name__ = true;
10161
+ haxe.Timer.delay = function(f, time_ms) {
10162
+ var t = new haxe.Timer(time_ms);
10163
+ t.run = function() {
10164
+ t.stop();
10165
+ f();
10166
+ };
10167
+ return t;
10168
+ };
10169
+ haxe.Timer.measure = function(f, pos) {
10170
+ var t0 = haxe.Timer.stamp();
10171
+ var r = f();
10172
+ haxe.Log.trace(haxe.Timer.stamp() - t0 + "s", pos);
10173
+ return r;
10174
+ };
10175
+ haxe.Timer.stamp = function() {
10176
+ return new Date().getTime() / 1000;
10177
+ };
10178
+ haxe.Timer.prototype = {
10179
+ run: function() {},
10180
+ stop: function() {
10181
+ if (this.id == null) return;
10182
+ window.clearInterval(this.id);
10183
+ this.id = null;
10184
+ },
10185
+ __class__: haxe.Timer
10186
+ };
10187
+ var js = js || {};
10188
+ js.Boot = function() {};
10189
+ js.Boot.__name__ = true;
10190
+ js.Boot.__unhtml = function(s) {
10191
+ return s.split("&").join("&amp;").split("<").join("&lt;").split(">").join("&gt;");
10192
+ };
10193
+ js.Boot.__trace = function(v, i) {
10194
+ var msg = i != null ? i.fileName + ":" + i.lineNumber + ": " : "";
10195
+ msg += js.Boot.__string_rec(v, "");
10196
+ var d;
10197
+ if (typeof document != "undefined" && (d = document.getElementById("haxe:trace")) != null) d.innerHTML += js.Boot.__unhtml(msg) + "<br/>";
10198
+ else if (typeof console != "undefined" && console.log != null) console.log(msg);
10199
+ };
10200
+ js.Boot.__clear_trace = function() {
10201
+ var d = document.getElementById("haxe:trace");
10202
+ if (d != null) d.innerHTML = "";
10203
+ };
10204
+ js.Boot.isClass = function(o) {
10205
+ return o.__name__;
10206
+ };
10207
+ js.Boot.isEnum = function(e) {
10208
+ return e.__ename__;
10209
+ };
10210
+ js.Boot.getClass = function(o) {
10211
+ return o.__class__;
10212
+ };
10213
+ js.Boot.__string_rec = function(o, s) {
10214
+ if (o == null) return "null";
10215
+ if (s.length >= 5) return "<...>";
10216
+ var t = typeof o;
10217
+ if (t == "function" && (o.__name__ || o.__ename__)) t = "object";
10218
+ switch(t){
10219
+ case "object":
10220
+ if (o instanceof Array) {
10221
+ if (o.__enum__) {
10222
+ if (o.length == 2) return o[0];
10223
+ var str = o[0] + "(";
10224
+ s += "\t";
10225
+ var _g1 = 2, _g = o.length;
10226
+ while(_g1 < _g){
10227
+ var i = _g1++;
10228
+ if (i != 2) str += "," + js.Boot.__string_rec(o[i], s);
10229
+ else str += js.Boot.__string_rec(o[i], s);
10230
+ }
10231
+ return str + ")";
10232
+ }
10233
+ var l = o.length;
10234
+ var i;
10235
+ var str = "[";
10236
+ s += "\t";
10237
+ var _g = 0;
10238
+ while(_g < l){
10239
+ var i1 = _g++;
10240
+ str += (i1 > 0 ? "," : "") + js.Boot.__string_rec(o[i1], s);
10241
+ }
10242
+ str += "]";
10243
+ return str;
10244
+ }
10245
+ var tostr;
10246
+ try {
10247
+ tostr = o.toString;
10248
+ } catch (e) {
10249
+ return "???";
10250
+ }
10251
+ if (tostr != null && tostr != Object.toString) {
10252
+ var s2 = o.toString();
10253
+ if (s2 != "[object Object]") return s2;
10254
+ }
10255
+ var k = null;
10256
+ var str = "{\n";
10257
+ s += "\t";
10258
+ var hasp = o.hasOwnProperty != null;
10259
+ for(var k in o){
10260
+ if (hasp && !o.hasOwnProperty(k)) {
10261
+ continue;
10262
+ }
10263
+ if (k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") {
10264
+ continue;
10265
+ }
10266
+ if (str.length != 2) str += ", \n";
10267
+ str += s + k + " : " + js.Boot.__string_rec(o[k], s);
10268
+ }
10269
+ s = s.substring(1);
10270
+ str += "\n" + s + "}";
10271
+ return str;
10272
+ case "function":
10273
+ return "<function>";
10274
+ case "string":
10275
+ return o;
10276
+ default:
10277
+ return String(o);
10278
+ }
10279
+ };
10280
+ js.Boot.__interfLoop = function(cc, cl) {
10281
+ if (cc == null) return false;
10282
+ if (cc == cl) return true;
10283
+ var intf = cc.__interfaces__;
10284
+ if (intf != null) {
10285
+ var _g1 = 0, _g = intf.length;
10286
+ while(_g1 < _g){
10287
+ var i = _g1++;
10288
+ var i1 = intf[i];
10289
+ if (i1 == cl || js.Boot.__interfLoop(i1, cl)) return true;
10290
+ }
10291
+ }
10292
+ return js.Boot.__interfLoop(cc.__super__, cl);
10293
+ };
10294
+ js.Boot.__instanceof = function(o, cl) {
10295
+ try {
10296
+ if (o instanceof cl) {
10297
+ if (cl == Array) return o.__enum__ == null;
10298
+ return true;
10299
+ }
10300
+ if (js.Boot.__interfLoop(o.__class__, cl)) return true;
10301
+ } catch (e) {
10302
+ if (cl == null) return false;
10303
+ }
10304
+ switch(cl){
10305
+ case Int:
10306
+ return Math.ceil(o % 2147483648.0) === o;
10307
+ case Float:
10308
+ return typeof o == "number";
10309
+ case Bool:
10310
+ return o === true || o === false;
10311
+ case String:
10312
+ return typeof o == "string";
10313
+ case Dynamic:
10314
+ return true;
10315
+ default:
10316
+ if (o == null) return false;
10317
+ if (cl == Class && o.__name__ != null) return true;
10318
+ if (cl == Enum && o.__ename__ != null) return true;
10319
+ return o.__enum__ == cl;
10320
+ }
10321
+ };
10322
+ js.Boot.__cast = function(o, t) {
10323
+ if (js.Boot.__instanceof(o, t)) return o;
10324
+ else throw "Cannot cast " + Std.string(o) + " to " + Std.string(t);
10325
+ };
10326
+ js.Lib = function() {};
10327
+ js.Lib.__name__ = true;
10328
+ js.Lib.debug = function() {
10329
+ debugger;
10330
+ };
10331
+ js.Lib.alert = function(v) {
10332
+ alert(js.Boot.__string_rec(v, ""));
10333
+ };
10334
+ js.Lib.eval = function(code) {
10335
+ return eval(code);
10336
+ };
10337
+ js.Lib.setErrorHandler = function(f) {
10338
+ js.Lib.onerror = f;
10339
+ };
10340
+ function $bind(o, m) {
10341
+ var f = function() {
10342
+ return f.method.apply(f.scope, arguments);
10343
+ };
10344
+ f.scope = o;
10345
+ f.method = m;
10346
+ return f;
10347
+ }
10348
+ if (Array.prototype.indexOf) HxOverrides.remove = function(a, o) {
10349
+ var i = a.indexOf(o);
10350
+ if (i == -1) return false;
10351
+ a.splice(i, 1);
10352
+ return true;
10353
+ };
10354
+ Math.__name__ = [
10355
+ "Math"
10356
+ ];
10357
+ Math.NaN = Number.NaN;
10358
+ Math.NEGATIVE_INFINITY = Number.NEGATIVE_INFINITY;
10359
+ Math.POSITIVE_INFINITY = Number.POSITIVE_INFINITY;
10360
+ Math.isFinite = function(i) {
10361
+ return isFinite(i);
10362
+ };
10363
+ Math.isNaN = function(i) {
10364
+ return isNaN(i);
10365
+ };
10366
+ String.prototype.__class__ = String;
10367
+ String.__name__ = true;
10368
+ Array.prototype.__class__ = Array;
10369
+ Array.__name__ = true;
10370
+ Date.prototype.__class__ = Date;
10371
+ Date.__name__ = [
10372
+ "Date"
10373
+ ];
10374
+ var Int = {
10375
+ };
10376
+ var Dynamic = {
10377
+ };
10378
+ var Float = Number;
10379
+ Float.__name__ = [
10380
+ "Float"
10381
+ ];
10382
+ var Bool = Boolean;
10383
+ Bool.__ename__ = [
10384
+ "Bool"
10385
+ ];
10386
+ var Class = {
10387
+ };
10388
+ var Enum = {};
10389
+ if (typeof document != "undefined") js.Lib.document = document;
10390
+ if (typeof window != "undefined") {
10391
+ js.Lib.window = window;
10392
+ js.Lib.window.onerror = function(msg, url, line) {
10393
+ var f = js.Lib.onerror;
10394
+ if (f == null) return false;
10395
+ return f(msg, [
10396
+ url + ":" + line
10397
+ ]);
10398
+ };
10399
+ }
10400
+ com.wiris.js.JsPluginTools.main();
10401
+ delete Array.prototype.__class__;
10402
+ })();
10403
+ (function() {
10404
+ var HxOverrides = function() {};
10405
+ HxOverrides.__name__ = true;
10406
+ HxOverrides.dateStr = function(date) {
10407
+ var m = date.getMonth() + 1;
10408
+ var d = date.getDate();
10409
+ var h = date.getHours();
10410
+ var mi = date.getMinutes();
10411
+ var s = date.getSeconds();
10412
+ return date.getFullYear() + "-" + (m < 10 ? "0" + m : "" + m) + "-" + (d < 10 ? "0" + d : "" + d) + " " + (h < 10 ? "0" + h : "" + h) + ":" + (mi < 10 ? "0" + mi : "" + mi) + ":" + (s < 10 ? "0" + s : "" + s);
10413
+ };
10414
+ HxOverrides.strDate = function(s) {
10415
+ switch(s.length){
10416
+ case 8:
10417
+ var k = s.split(":");
10418
+ var d = new Date();
10419
+ d.setTime(0);
10420
+ d.setUTCHours(k[0]);
10421
+ d.setUTCMinutes(k[1]);
10422
+ d.setUTCSeconds(k[2]);
10423
+ return d;
10424
+ case 10:
10425
+ var k = s.split("-");
10426
+ return new Date(k[0], k[1] - 1, k[2], 0, 0, 0);
10427
+ case 19:
10428
+ var k = s.split(" ");
10429
+ var y = k[0].split("-");
10430
+ var t = k[1].split(":");
10431
+ return new Date(y[0], y[1] - 1, y[2], t[0], t[1], t[2]);
10432
+ default:
10433
+ throw "Invalid date format : " + s;
10434
+ }
10435
+ };
10436
+ HxOverrides.cca = function(s, index) {
10437
+ var x = s.charCodeAt(index);
10438
+ if (x != x) return undefined;
10439
+ return x;
10440
+ };
10441
+ HxOverrides.substr = function(s, pos, len) {
10442
+ if (pos != null && pos != 0 && len != null && len < 0) return "";
10443
+ if (len == null) len = s.length;
10444
+ if (pos < 0) {
10445
+ pos = s.length + pos;
10446
+ if (pos < 0) pos = 0;
10447
+ } else if (len < 0) len = s.length + len - pos;
10448
+ return s.substr(pos, len);
10449
+ };
10450
+ HxOverrides.remove = function(a, obj) {
10451
+ var i = 0;
10452
+ var l = a.length;
10453
+ while(i < l){
10454
+ if (a[i] == obj) {
10455
+ a.splice(i, 1);
10456
+ return true;
10457
+ }
10458
+ i++;
10459
+ }
10460
+ return false;
10461
+ };
10462
+ HxOverrides.iter = function(a) {
10463
+ return {
10464
+ cur: 0,
10465
+ arr: a,
10466
+ hasNext: function() {
10467
+ return this.cur < this.arr.length;
10468
+ },
10469
+ next: function() {
10470
+ return this.arr[this.cur++];
10471
+ }
10472
+ };
10473
+ };
10474
+ var IntIter = function(min, max) {
10475
+ this.min = min;
10476
+ this.max = max;
10477
+ };
10478
+ IntIter.__name__ = true;
10479
+ IntIter.prototype = {
10480
+ next: function() {
10481
+ return this.min++;
10482
+ },
10483
+ hasNext: function() {
10484
+ return this.min < this.max;
10485
+ },
10486
+ __class__: IntIter
10487
+ };
10488
+ var Std = function() {};
10489
+ Std.__name__ = true;
10490
+ Std["is"] = function(v, t) {
10491
+ return js.Boot.__instanceof(v, t);
10492
+ };
10493
+ Std.string = function(s) {
10494
+ return js.Boot.__string_rec(s, "");
10495
+ };
10496
+ Std["int"] = function(x) {
10497
+ return x | 0;
10498
+ };
10499
+ Std.parseInt = function(x) {
10500
+ var v = parseInt(x, 10);
10501
+ if (v == 0 && (HxOverrides.cca(x, 1) == 120 || HxOverrides.cca(x, 1) == 88)) v = parseInt(x);
10502
+ if (isNaN(v)) return null;
10503
+ return v;
10504
+ };
10505
+ Std.parseFloat = function(x) {
10506
+ return parseFloat(x);
10507
+ };
10508
+ Std.random = function(x) {
10509
+ return Math.floor(Math.random() * x);
10510
+ };
10511
+ var com = com || {};
10512
+ if (!com.wiris) com.wiris = {};
10513
+ if (!com.wiris.js) com.wiris.js = {};
10514
+ com.wiris.js.JsPluginTools = function() {
10515
+ this.tryReady();
10516
+ };
10517
+ com.wiris.js.JsPluginTools.__name__ = true;
10518
+ com.wiris.js.JsPluginTools.main = function() {
10519
+ var ev;
10520
+ ev = com.wiris.js.JsPluginTools.getInstance();
10521
+ haxe.Timer.delay($bind(ev, ev.tryReady), 100);
10522
+ };
10523
+ com.wiris.js.JsPluginTools.getInstance = function() {
10524
+ if (com.wiris.js.JsPluginTools.instance == null) com.wiris.js.JsPluginTools.instance = new com.wiris.js.JsPluginTools();
10525
+ return com.wiris.js.JsPluginTools.instance;
10526
+ };
10527
+ com.wiris.js.JsPluginTools.bypassEncapsulation = function() {
10528
+ if (window.com == null) window.com = {};
10529
+ if (window.com.wiris == null) window.com.wiris = {};
10530
+ if (window.com.wiris.js == null) window.com.wiris.js = {};
10531
+ if (window.com.wiris.js.JsPluginTools == null) window.com.wiris.js.JsPluginTools = com.wiris.js.JsPluginTools.getInstance();
10532
+ };
10533
+ com.wiris.js.JsPluginTools.prototype = {
10534
+ md5encode: function(content) {
10535
+ return haxe.Md5.encode(content);
10536
+ },
10537
+ doLoad: function() {
10538
+ this.ready = true;
10539
+ com.wiris.js.JsPluginTools.instance = this;
10540
+ com.wiris.js.JsPluginTools.bypassEncapsulation();
10541
+ },
10542
+ tryReady: function() {
10543
+ this.ready = false;
10544
+ if (js.Lib.document.readyState) {
10545
+ this.doLoad();
10546
+ this.ready = true;
10547
+ }
10548
+ if (!this.ready) haxe.Timer.delay($bind(this, this.tryReady), 100);
10549
+ },
10550
+ __class__: com.wiris.js.JsPluginTools
10551
+ };
10552
+ var haxe = haxe || {};
10553
+ haxe.Log = function() {};
10554
+ haxe.Log.__name__ = true;
10555
+ haxe.Log.trace = function(v, infos) {
10556
+ js.Boot.__trace(v, infos);
10557
+ };
10558
+ haxe.Log.clear = function() {
10559
+ js.Boot.__clear_trace();
10560
+ };
10561
+ haxe.Md5 = function() {};
10562
+ haxe.Md5.__name__ = true;
10563
+ haxe.Md5.encode = function(s) {
10564
+ return new haxe.Md5().doEncode(s);
10565
+ };
10566
+ haxe.Md5.prototype = {
10567
+ doEncode: function(str) {
10568
+ var x = this.str2blks(str);
10569
+ var a = 1732584193;
10570
+ var b = -271733879;
10571
+ var c = -1732584194;
10572
+ var d = 271733878;
10573
+ var i = 0;
10574
+ while(i < x.length){
10575
+ var olda = a;
10576
+ var oldb = b;
10577
+ var oldc = c;
10578
+ var oldd = d;
10579
+ a = this.ff(a, b, c, d, x[i], 7, -680876936);
10580
+ d = this.ff(d, a, b, c, x[i + 1], 12, -389564586);
10581
+ c = this.ff(c, d, a, b, x[i + 2], 17, 606105819);
10582
+ b = this.ff(b, c, d, a, x[i + 3], 22, -1044525330);
10583
+ a = this.ff(a, b, c, d, x[i + 4], 7, -176418897);
10584
+ d = this.ff(d, a, b, c, x[i + 5], 12, 1200080426);
10585
+ c = this.ff(c, d, a, b, x[i + 6], 17, -1473231341);
10586
+ b = this.ff(b, c, d, a, x[i + 7], 22, -45705983);
10587
+ a = this.ff(a, b, c, d, x[i + 8], 7, 1770035416);
10588
+ d = this.ff(d, a, b, c, x[i + 9], 12, -1958414417);
10589
+ c = this.ff(c, d, a, b, x[i + 10], 17, -42063);
10590
+ b = this.ff(b, c, d, a, x[i + 11], 22, -1990404162);
10591
+ a = this.ff(a, b, c, d, x[i + 12], 7, 1804603682);
10592
+ d = this.ff(d, a, b, c, x[i + 13], 12, -40341101);
10593
+ c = this.ff(c, d, a, b, x[i + 14], 17, -1502002290);
10594
+ b = this.ff(b, c, d, a, x[i + 15], 22, 1236535329);
10595
+ a = this.gg(a, b, c, d, x[i + 1], 5, -165796510);
10596
+ d = this.gg(d, a, b, c, x[i + 6], 9, -1069501632);
10597
+ c = this.gg(c, d, a, b, x[i + 11], 14, 643717713);
10598
+ b = this.gg(b, c, d, a, x[i], 20, -373897302);
10599
+ a = this.gg(a, b, c, d, x[i + 5], 5, -701558691);
10600
+ d = this.gg(d, a, b, c, x[i + 10], 9, 38016083);
10601
+ c = this.gg(c, d, a, b, x[i + 15], 14, -660478335);
10602
+ b = this.gg(b, c, d, a, x[i + 4], 20, -405537848);
10603
+ a = this.gg(a, b, c, d, x[i + 9], 5, 568446438);
10604
+ d = this.gg(d, a, b, c, x[i + 14], 9, -1019803690);
10605
+ c = this.gg(c, d, a, b, x[i + 3], 14, -187363961);
10606
+ b = this.gg(b, c, d, a, x[i + 8], 20, 1163531501);
10607
+ a = this.gg(a, b, c, d, x[i + 13], 5, -1444681467);
10608
+ d = this.gg(d, a, b, c, x[i + 2], 9, -51403784);
10609
+ c = this.gg(c, d, a, b, x[i + 7], 14, 1735328473);
10610
+ b = this.gg(b, c, d, a, x[i + 12], 20, -1926607734);
10611
+ a = this.hh(a, b, c, d, x[i + 5], 4, -378558);
10612
+ d = this.hh(d, a, b, c, x[i + 8], 11, -2022574463);
10613
+ c = this.hh(c, d, a, b, x[i + 11], 16, 1839030562);
10614
+ b = this.hh(b, c, d, a, x[i + 14], 23, -35309556);
10615
+ a = this.hh(a, b, c, d, x[i + 1], 4, -1530992060);
10616
+ d = this.hh(d, a, b, c, x[i + 4], 11, 1272893353);
10617
+ c = this.hh(c, d, a, b, x[i + 7], 16, -155497632);
10618
+ b = this.hh(b, c, d, a, x[i + 10], 23, -1094730640);
10619
+ a = this.hh(a, b, c, d, x[i + 13], 4, 681279174);
10620
+ d = this.hh(d, a, b, c, x[i], 11, -358537222);
10621
+ c = this.hh(c, d, a, b, x[i + 3], 16, -722521979);
10622
+ b = this.hh(b, c, d, a, x[i + 6], 23, 76029189);
10623
+ a = this.hh(a, b, c, d, x[i + 9], 4, -640364487);
10624
+ d = this.hh(d, a, b, c, x[i + 12], 11, -421815835);
10625
+ c = this.hh(c, d, a, b, x[i + 15], 16, 530742520);
10626
+ b = this.hh(b, c, d, a, x[i + 2], 23, -995338651);
10627
+ a = this.ii(a, b, c, d, x[i], 6, -198630844);
10628
+ d = this.ii(d, a, b, c, x[i + 7], 10, 1126891415);
10629
+ c = this.ii(c, d, a, b, x[i + 14], 15, -1416354905);
10630
+ b = this.ii(b, c, d, a, x[i + 5], 21, -57434055);
10631
+ a = this.ii(a, b, c, d, x[i + 12], 6, 1700485571);
10632
+ d = this.ii(d, a, b, c, x[i + 3], 10, -1894986606);
10633
+ c = this.ii(c, d, a, b, x[i + 10], 15, -1051523);
10634
+ b = this.ii(b, c, d, a, x[i + 1], 21, -2054922799);
10635
+ a = this.ii(a, b, c, d, x[i + 8], 6, 1873313359);
10636
+ d = this.ii(d, a, b, c, x[i + 15], 10, -30611744);
10637
+ c = this.ii(c, d, a, b, x[i + 6], 15, -1560198380);
10638
+ b = this.ii(b, c, d, a, x[i + 13], 21, 1309151649);
10639
+ a = this.ii(a, b, c, d, x[i + 4], 6, -145523070);
10640
+ d = this.ii(d, a, b, c, x[i + 11], 10, -1120210379);
10641
+ c = this.ii(c, d, a, b, x[i + 2], 15, 718787259);
10642
+ b = this.ii(b, c, d, a, x[i + 9], 21, -343485551);
10643
+ a = this.addme(a, olda);
10644
+ b = this.addme(b, oldb);
10645
+ c = this.addme(c, oldc);
10646
+ d = this.addme(d, oldd);
10647
+ i += 16;
10648
+ }
10649
+ return this.rhex(a) + this.rhex(b) + this.rhex(c) + this.rhex(d);
10650
+ },
10651
+ ii: function(a, b, c, d, x, s, t) {
10652
+ return this.cmn(this.bitXOR(c, this.bitOR(b, ~d)), a, b, x, s, t);
10653
+ },
10654
+ hh: function(a, b, c, d, x, s, t) {
10655
+ return this.cmn(this.bitXOR(this.bitXOR(b, c), d), a, b, x, s, t);
10656
+ },
10657
+ gg: function(a, b, c, d, x, s, t) {
10658
+ return this.cmn(this.bitOR(this.bitAND(b, d), this.bitAND(c, ~d)), a, b, x, s, t);
10659
+ },
10660
+ ff: function(a, b, c, d, x, s, t) {
10661
+ return this.cmn(this.bitOR(this.bitAND(b, c), this.bitAND(~b, d)), a, b, x, s, t);
10662
+ },
10663
+ cmn: function(q, a, b, x, s, t) {
10664
+ return this.addme(this.rol(this.addme(this.addme(a, q), this.addme(x, t)), s), b);
10665
+ },
10666
+ rol: function(num, cnt) {
10667
+ return num << cnt | num >>> 32 - cnt;
10668
+ },
10669
+ str2blks: function(str) {
10670
+ var nblk = (str.length + 8 >> 6) + 1;
10671
+ var blks = new Array();
10672
+ var _g1 = 0, _g = nblk * 16;
10673
+ while(_g1 < _g){
10674
+ var i = _g1++;
10675
+ blks[i] = 0;
10676
+ }
10677
+ var i = 0;
10678
+ while(i < str.length){
10679
+ blks[i >> 2] |= HxOverrides.cca(str, i) << (str.length * 8 + i) % 4 * 8;
10680
+ i++;
10681
+ }
10682
+ blks[i >> 2] |= 128 << (str.length * 8 + i) % 4 * 8;
10683
+ var l = str.length * 8;
10684
+ var k = nblk * 16 - 2;
10685
+ blks[k] = l & 255;
10686
+ blks[k] |= (l >>> 8 & 255) << 8;
10687
+ blks[k] |= (l >>> 16 & 255) << 16;
10688
+ blks[k] |= (l >>> 24 & 255) << 24;
10689
+ return blks;
10690
+ },
10691
+ rhex: function(num) {
10692
+ var str = "";
10693
+ var hex_chr = "0123456789abcdef";
10694
+ var _g = 0;
10695
+ while(_g < 4){
10696
+ var j = _g++;
10697
+ str += hex_chr.charAt(num >> j * 8 + 4 & 15) + hex_chr.charAt(num >> j * 8 & 15);
10698
+ }
10699
+ return str;
10700
+ },
10701
+ addme: function(x, y) {
10702
+ var lsw = (x & 65535) + (y & 65535);
10703
+ var msw = (x >> 16) + (y >> 16) + (lsw >> 16);
10704
+ return msw << 16 | lsw & 65535;
10705
+ },
10706
+ bitAND: function(a, b) {
10707
+ var lsb = a & 1 & (b & 1);
10708
+ var msb31 = a >>> 1 & b >>> 1;
10709
+ return msb31 << 1 | lsb;
10710
+ },
10711
+ bitXOR: function(a, b) {
10712
+ var lsb = a & 1 ^ b & 1;
10713
+ var msb31 = a >>> 1 ^ b >>> 1;
10714
+ return msb31 << 1 | lsb;
10715
+ },
10716
+ bitOR: function(a, b) {
10717
+ var lsb = a & 1 | b & 1;
10718
+ var msb31 = a >>> 1 | b >>> 1;
10719
+ return msb31 << 1 | lsb;
10720
+ },
10721
+ __class__: haxe.Md5
10722
+ };
10723
+ haxe.Timer = function(time_ms) {
10724
+ var me = this;
10725
+ this.id = window.setInterval(function() {
10726
+ me.run();
10727
+ }, time_ms);
10728
+ };
10729
+ haxe.Timer.__name__ = true;
10730
+ haxe.Timer.delay = function(f, time_ms) {
10731
+ var t = new haxe.Timer(time_ms);
10732
+ t.run = function() {
10733
+ t.stop();
10734
+ f();
10735
+ };
10736
+ return t;
10737
+ };
10738
+ haxe.Timer.measure = function(f, pos) {
10739
+ var t0 = haxe.Timer.stamp();
10740
+ var r = f();
10741
+ haxe.Log.trace(haxe.Timer.stamp() - t0 + "s", pos);
10742
+ return r;
10743
+ };
10744
+ haxe.Timer.stamp = function() {
10745
+ return new Date().getTime() / 1000;
10746
+ };
10747
+ haxe.Timer.prototype = {
10748
+ run: function() {},
10749
+ stop: function() {
10750
+ if (this.id == null) return;
10751
+ window.clearInterval(this.id);
10752
+ this.id = null;
10753
+ },
10754
+ __class__: haxe.Timer
10755
+ };
10756
+ var js = js || {};
10757
+ js.Boot = function() {};
10758
+ js.Boot.__name__ = true;
10759
+ js.Boot.__unhtml = function(s) {
10760
+ return s.split("&").join("&amp;").split("<").join("&lt;").split(">").join("&gt;");
10761
+ };
10762
+ js.Boot.__trace = function(v, i) {
10763
+ var msg = i != null ? i.fileName + ":" + i.lineNumber + ": " : "";
10764
+ msg += js.Boot.__string_rec(v, "");
10765
+ var d;
10766
+ if (typeof document != "undefined" && (d = document.getElementById("haxe:trace")) != null) d.innerHTML += js.Boot.__unhtml(msg) + "<br/>";
10767
+ else if (typeof console != "undefined" && console.log != null) console.log(msg);
10768
+ };
10769
+ js.Boot.__clear_trace = function() {
10770
+ var d = document.getElementById("haxe:trace");
10771
+ if (d != null) d.innerHTML = "";
10772
+ };
10773
+ js.Boot.isClass = function(o) {
10774
+ return o.__name__;
10775
+ };
10776
+ js.Boot.isEnum = function(e) {
10777
+ return e.__ename__;
10778
+ };
10779
+ js.Boot.getClass = function(o) {
10780
+ return o.__class__;
10781
+ };
10782
+ js.Boot.__string_rec = function(o, s) {
10783
+ if (o == null) return "null";
10784
+ if (s.length >= 5) return "<...>";
10785
+ var t = typeof o;
10786
+ if (t == "function" && (o.__name__ || o.__ename__)) t = "object";
10787
+ switch(t){
10788
+ case "object":
10789
+ if (o instanceof Array) {
10790
+ if (o.__enum__) {
10791
+ if (o.length == 2) return o[0];
10792
+ var str = o[0] + "(";
10793
+ s += "\t";
10794
+ var _g1 = 2, _g = o.length;
10795
+ while(_g1 < _g){
10796
+ var i = _g1++;
10797
+ if (i != 2) str += "," + js.Boot.__string_rec(o[i], s);
10798
+ else str += js.Boot.__string_rec(o[i], s);
10799
+ }
10800
+ return str + ")";
10801
+ }
10802
+ var l = o.length;
10803
+ var i;
10804
+ var str = "[";
10805
+ s += "\t";
10806
+ var _g = 0;
10807
+ while(_g < l){
10808
+ var i1 = _g++;
10809
+ str += (i1 > 0 ? "," : "") + js.Boot.__string_rec(o[i1], s);
10810
+ }
10811
+ str += "]";
10812
+ return str;
10813
+ }
10814
+ var tostr;
10815
+ try {
10816
+ tostr = o.toString;
10817
+ } catch (e) {
10818
+ return "???";
10819
+ }
10820
+ if (tostr != null && tostr != Object.toString) {
10821
+ var s2 = o.toString();
10822
+ if (s2 != "[object Object]") return s2;
10823
+ }
10824
+ var k = null;
10825
+ var str = "{\n";
10826
+ s += "\t";
10827
+ var hasp = o.hasOwnProperty != null;
10828
+ for(var k in o){
10829
+ if (hasp && !o.hasOwnProperty(k)) {
10830
+ continue;
10831
+ }
10832
+ if (k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") {
10833
+ continue;
10834
+ }
10835
+ if (str.length != 2) str += ", \n";
10836
+ str += s + k + " : " + js.Boot.__string_rec(o[k], s);
10837
+ }
10838
+ s = s.substring(1);
10839
+ str += "\n" + s + "}";
10840
+ return str;
10841
+ case "function":
10842
+ return "<function>";
10843
+ case "string":
10844
+ return o;
10845
+ default:
10846
+ return String(o);
10847
+ }
10848
+ };
10849
+ js.Boot.__interfLoop = function(cc, cl) {
10850
+ if (cc == null) return false;
10851
+ if (cc == cl) return true;
10852
+ var intf = cc.__interfaces__;
10853
+ if (intf != null) {
10854
+ var _g1 = 0, _g = intf.length;
10855
+ while(_g1 < _g){
10856
+ var i = _g1++;
10857
+ var i1 = intf[i];
10858
+ if (i1 == cl || js.Boot.__interfLoop(i1, cl)) return true;
10859
+ }
10860
+ }
10861
+ return js.Boot.__interfLoop(cc.__super__, cl);
10862
+ };
10863
+ js.Boot.__instanceof = function(o, cl) {
10864
+ try {
10865
+ if (o instanceof cl) {
10866
+ if (cl == Array) return o.__enum__ == null;
10867
+ return true;
10868
+ }
10869
+ if (js.Boot.__interfLoop(o.__class__, cl)) return true;
10870
+ } catch (e) {
10871
+ if (cl == null) return false;
10872
+ }
10873
+ switch(cl){
10874
+ case Int:
10875
+ return Math.ceil(o % 2147483648.0) === o;
10876
+ case Float:
10877
+ return typeof o == "number";
10878
+ case Bool:
10879
+ return o === true || o === false;
10880
+ case String:
10881
+ return typeof o == "string";
10882
+ case Dynamic:
10883
+ return true;
10884
+ default:
10885
+ if (o == null) return false;
10886
+ if (cl == Class && o.__name__ != null) return true;
10887
+ if (cl == Enum && o.__ename__ != null) return true;
10888
+ return o.__enum__ == cl;
10889
+ }
10890
+ };
10891
+ js.Boot.__cast = function(o, t) {
10892
+ if (js.Boot.__instanceof(o, t)) return o;
10893
+ else throw "Cannot cast " + Std.string(o) + " to " + Std.string(t);
10894
+ };
10895
+ js.Lib = function() {};
10896
+ js.Lib.__name__ = true;
10897
+ js.Lib.debug = function() {
10898
+ debugger;
10899
+ };
10900
+ js.Lib.alert = function(v) {
10901
+ alert(js.Boot.__string_rec(v, ""));
10902
+ };
10903
+ js.Lib.eval = function(code) {
10904
+ return eval(code);
10905
+ };
10906
+ js.Lib.setErrorHandler = function(f) {
10907
+ js.Lib.onerror = f;
10908
+ };
10909
+ function $bind(o, m) {
10910
+ var f = function() {
10911
+ return f.method.apply(f.scope, arguments);
10912
+ };
10913
+ f.scope = o;
10914
+ f.method = m;
10915
+ return f;
10916
+ }
10917
+ if (Array.prototype.indexOf) HxOverrides.remove = function(a, o) {
10918
+ var i = a.indexOf(o);
10919
+ if (i == -1) return false;
10920
+ a.splice(i, 1);
10921
+ return true;
10922
+ };
10923
+ Math.__name__ = [
10924
+ "Math"
10925
+ ];
10926
+ Math.NaN = Number.NaN;
10927
+ Math.NEGATIVE_INFINITY = Number.NEGATIVE_INFINITY;
10928
+ Math.POSITIVE_INFINITY = Number.POSITIVE_INFINITY;
10929
+ Math.isFinite = function(i) {
10930
+ return isFinite(i);
10931
+ };
10932
+ Math.isNaN = function(i) {
10933
+ return isNaN(i);
10934
+ };
10935
+ String.prototype.__class__ = String;
10936
+ String.__name__ = true;
10937
+ Array.prototype.__class__ = Array;
10938
+ Array.__name__ = true;
10939
+ Date.prototype.__class__ = Date;
10940
+ Date.__name__ = [
10941
+ "Date"
10942
+ ];
10943
+ var Int = {
10944
+ };
10945
+ var Dynamic = {
10946
+ };
10947
+ var Float = Number;
10948
+ Float.__name__ = [
10949
+ "Float"
10950
+ ];
10951
+ var Bool = Boolean;
10952
+ Bool.__ename__ = [
10953
+ "Bool"
10954
+ ];
10955
+ var Class = {
10956
+ };
10957
+ var Enum = {};
10958
+ if (typeof document != "undefined") js.Lib.document = document;
10959
+ if (typeof window != "undefined") {
10960
+ js.Lib.window = window;
10961
+ js.Lib.window.onerror = function(msg, url, line) {
10962
+ var f = js.Lib.onerror;
10963
+ if (f == null) return false;
10964
+ return f(msg, [
10965
+ url + ":" + line
10966
+ ]);
10967
+ };
10968
+ }
10969
+ com.wiris.js.JsPluginTools.main();
10970
+ })();
10971
+ delete Array.prototype.__class__; // @codingStandardsIgnoreEnd
10972
+
9830
10973
  /**
9831
10974
  * This class represents the MathType integration for CKEditor5.
9832
10975
  * @extends {IntegrationModel}
@@ -10031,15 +11174,15 @@
10031
11174
  // When Latex is next to image/formula.
10032
11175
  if (latexRange.startContainer.nodeType === 3 && latexRange.startContainer.previousSibling?.nodeType === 1) {
10033
11176
  // Get the position of the latex to be replaced.
10034
- let latexEdited = "$$" + Latex.getLatexFromMathML(MathML.safeXmlDecode(this.core.editionProperties.temporalImage.dataset.mathml)) + "$$";
11177
+ const latexEdited = `$$${Latex.getLatexFromMathML(MathML.safeXmlDecode(this.core.editionProperties.temporalImage.dataset.mathml))}$$`;
10035
11178
  let data = latexRange.startContainer.data;
10036
11179
  // Remove invisible characters.
10037
11180
  data = data.replaceAll(String.fromCharCode(8288), "");
10038
11181
  // Get to the start of the latex we are editing.
10039
- let offset = data.indexOf(latexEdited);
10040
- let dataOffset = data.substring(offset);
10041
- let second$ = dataOffset.substring(2).indexOf("$$") + 4;
10042
- let substring = dataOffset.substr(0, second$);
11182
+ const offset = data.indexOf(latexEdited);
11183
+ const dataOffset = data.substring(offset);
11184
+ const second$ = dataOffset.substring(2).indexOf("$$") + 4;
11185
+ const substring = dataOffset.substr(0, second$);
10043
11186
  data = data.replace(substring, "");
10044
11187
  if (!data) {
10045
11188
  startPosition = writer.createPositionBefore(startNode);
@@ -10065,7 +11208,7 @@
10065
11208
  }
10066
11209
  }
10067
11210
  // Build the telemeter payload separated to delete null/undefined entries.
10068
- let payload = {
11211
+ const payload = {
10069
11212
  mathml_origin: mathmlOrigin ? MathML.safeXmlDecode(mathmlOrigin) : mathmlOrigin,
10070
11213
  mathml: mathml ? MathML.safeXmlDecode(mathml) : mathml,
10071
11214
  elapsed_time: Date.now() - this.core.editionProperties.editionStartTime,
@@ -10171,82 +11314,9 @@
10171
11314
 
10172
11315
  var chemIcon = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!-- Generator: Adobe Illustrator 22.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->\n<svg version=\"1.1\" id=\"Layer_1\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" x=\"0px\" y=\"0px\"\n\t viewBox=\"0 0 40.3 49.5\" style=\"enable-background:new 0 0 40.3 49.5;\" xml:space=\"preserve\">\n<style type=\"text/css\">\n\t.st0{fill:#A4CF61;}\n</style>\n<path class=\"st0\" d=\"M39.2,12.1c0-1.9-1.1-3.6-2.7-4.4L24.5,0.9l0,0c-0.7-0.4-1.5-0.6-2.4-0.6c-0.9,0-1.7,0.2-2.4,0.6l0,0L2.3,10.8\n\tl0,0C0.9,11.7,0,13.2,0,14.9h0v19.6h0c0,1.7,0.9,3.3,2.3,4.1l0,0l17.4,9.9l0,0c0.7,0.4,1.5,0.6,2.4,0.6c0.9,0,1.7-0.2,2.4-0.6l0,0\n\tl12.2-6.9h0c1.5-0.8,2.6-2.5,2.6-4.3c0-2.7-2.2-4.9-4.9-4.9c-0.9,0-1.8,0.3-2.5,0.7l0,0l-9.7,5.6l-12.3-7V17.8l12.3-7l9.9,5.7l0,0\n\tc0.7,0.4,1.5,0.6,2.4,0.6C37,17,39.2,14.8,39.2,12.1\"/>\n</svg>\n";
10173
11316
 
10174
- var name = "@wiris/mathtype-ckeditor5";
10175
- var version = "8.12.0";
10176
- var description = "MathType Web for CKEditor5 editor";
10177
- var keywords = [
10178
- "chem",
10179
- "chemistry",
10180
- "chemtype",
10181
- "ckeditor",
10182
- "ckeditor5",
10183
- "editor",
10184
- "equation",
10185
- "latex",
10186
- "math",
10187
- "mathml",
10188
- "maths",
10189
- "mathtype",
10190
- "wiris"
10191
- ];
10192
- var repository = "https://github.com/wiris/html-integrations/tree/master/packages/ckeditor5";
10193
- var homepage = "https://www.wiris.com/";
10194
- var bugs = {
10195
- email: "support@wiris.com"
10196
- };
10197
- var license = "MIT";
10198
- var author = "WIRIS Team (http://www.wiris.com)";
10199
- var files = [
10200
- "dist",
10201
- "src",
10202
- "icons",
10203
- "theme",
10204
- "lang"
10205
- ];
10206
- var main = "src/plugin.js";
10207
- var type = "module";
10208
- var exports$1 = {
10209
- ".": "./src/plugin.js",
10210
- "./dist/*": "./dist/*",
10211
- "./browser/*": null,
10212
- "./src/*": "./src/*",
10213
- "./theme/*": "./theme/*",
10214
- "./package.json": "./package.json"
10215
- };
10216
- var scripts = {
10217
- build: "node ./scripts/build-dist.mjs",
10218
- "build:dist": "node ./scripts/build-dist.mjs",
10219
- prepare: "npm run build:dist"
10220
- };
10221
- var dependencies = {
10222
- "@wiris/mathtype-html-integration-devkit": "1.17.6"
10223
- };
10224
- var devDependencies = {
10225
- "@ckeditor/ckeditor5-dev-build-tools": "^42.1.0",
10226
- ckeditor5: ">=43.0.0"
10227
- };
10228
- var peerDependencies = {
10229
- ckeditor5: ">=43.0.0"
10230
- };
11317
+ var version = "8.13.0";
10231
11318
  var packageInfo = {
10232
- name: name,
10233
- version: version,
10234
- description: description,
10235
- keywords: keywords,
10236
- repository: repository,
10237
- homepage: homepage,
10238
- bugs: bugs,
10239
- license: license,
10240
- author: author,
10241
- files: files,
10242
- main: main,
10243
- type: type,
10244
- exports: exports$1,
10245
- scripts: scripts,
10246
- dependencies: dependencies,
10247
- devDependencies: devDependencies,
10248
- peerDependencies: peerDependencies
10249
- };
11319
+ version: version};
10250
11320
 
10251
11321
  // CKEditor imports
10252
11322
  let currentInstance = null; // eslint-disable-line import/no-mutable-exports
@@ -10278,7 +11348,7 @@
10278
11348
  * Inherited from Plugin class: Executed when CKEditor5 is destroyed
10279
11349
  */ destroy() {
10280
11350
  // eslint-disable-line class-methods-use-this
10281
- currentInstance.destroy();
11351
+ currentInstance?.destroy();
10282
11352
  }
10283
11353
  /**
10284
11354
  * Create the MathType API Integration object
@@ -10484,7 +11554,7 @@
10484
11554
  const mathAttributes = [
10485
11555
  ...viewItem.getAttributes()
10486
11556
  ].map(([key, value])=>` ${key}="${value}"`).join("");
10487
- let htmlContent = Util.htmlSanitize(`<img${mathAttributes}>`);
11557
+ const htmlContent = Util.htmlSanitize(`<img${mathAttributes}>`);
10488
11558
  const modelNode = writer.createElement("mathml", {
10489
11559
  htmlContent
10490
11560
  });
@@ -10605,18 +11675,18 @@
10605
11675
  function createDataString(modelItem, { writer: viewWriter }) {
10606
11676
  const htmlDataProcessor = new ckeditor5.HtmlDataProcessor(viewWriter.document);
10607
11677
  // Load img element
10608
- let mathString = modelItem.getAttribute("htmlContent") || Parser.endParseSaveMode(modelItem.getAttribute("formula"));
11678
+ const mathString = modelItem.getAttribute("htmlContent") || Parser.endParseSaveMode(modelItem.getAttribute("formula"));
10609
11679
  const sourceMathElement = htmlDataProcessor.toView(mathString).getChild(0);
10610
11680
  return clone(viewWriter, sourceMathElement);
10611
11681
  }
10612
11682
  // This stops the view selection getting into the <span>s and messing up caret movement
10613
11683
  editor.editing.mapper.on("viewToModelPosition", ckeditor5.viewToModelPositionOutsideModelElement(editor.model, (viewElement)=>viewElement.hasClass("ck-math-widget")));
10614
11684
  // Keep a reference to the original get and set function.
10615
- editor.data;
11685
+ const { get, set } = editor.data;
10616
11686
  /**
10617
11687
  * Hack to transform $$latex$$ into <math> in editor.getData()'s output.
10618
11688
  */ editor.data.on("get", (e)=>{
10619
- let output = e.return;
11689
+ const output = e.return;
10620
11690
  const parsedResult = Parser.endParse(output);
10621
11691
  // Cleans all the semantics tag for safexml
10622
11692
  // including the handwritten data points
@@ -10641,14 +11711,14 @@
10641
11711
  formulas.forEach((formula)=>{
10642
11712
  if (formula.includes('encoding="LaTeX"')) {
10643
11713
  // LaTeX found.
10644
- let latex = "$$$" + Latex.getLatexFromMathML(formula) + "$$$"; // We add $$$ instead of $$ because the replace function ignores one $.
11714
+ const latex = `$$$${Latex.getLatexFromMathML(formula)}$$$`; // We add $$$ instead of $$ because the replace function ignores one $.
10645
11715
  modifiedData = modifiedData.replace(formula, latex);
10646
11716
  } else if (formula.includes("<img")) {
10647
11717
  // If we found a formula image, we should find MathML data, and then substitute the entire image.
10648
11718
  const regexp = /«math\b[^»]*»(.*?)«\/math»/g;
10649
11719
  const safexml = formula.match(regexp);
10650
11720
  if (safexml !== null) {
10651
- let decodeXML = MathML.safeXmlDecode(safexml[0]);
11721
+ const decodeXML = MathML.safeXmlDecode(safexml[0]);
10652
11722
  modifiedData = modifiedData.replace(formula, decodeXML);
10653
11723
  }
10654
11724
  }
@@ -10677,7 +11747,12 @@
10677
11747
  }
10678
11748
  }
10679
11749
 
10680
- return MathType;
11750
+ exports.CKEditor5Integration = CKEditor5Integration;
11751
+ exports.ChemTypeCommand = ChemTypeCommand;
11752
+ exports.MathTypeCommand = MathTypeCommand;
11753
+ exports.default = MathType;
11754
+
11755
+ Object.defineProperty(exports, '__esModule', { value: true });
10681
11756
 
10682
11757
  }));
10683
11758
  //# sourceMappingURL=index.umd.js.map