@khanacademy/perseus 19.1.7 → 19.1.9
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.
- package/dist/es/index.js +358 -497
- package/dist/es/index.js.map +1 -1
- package/dist/index.js +357 -497
- package/dist/index.js.map +1 -1
- package/dist/strings.js +4 -0
- package/dist/util/graphie.d.ts +23 -7
- package/package.json +3 -3
package/dist/es/index.js
CHANGED
|
@@ -4215,22 +4215,13 @@ function _classPrivateFieldKey(name) {
|
|
|
4215
4215
|
return "__private_" + id$1++ + "_" + name;
|
|
4216
4216
|
}
|
|
4217
4217
|
|
|
4218
|
-
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
4219
|
-
|
|
4220
|
-
function getDefaultExportFromCjs (x) {
|
|
4221
|
-
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
4222
|
-
}
|
|
4223
|
-
|
|
4224
|
-
var raphael = {exports: {}};
|
|
4225
|
-
|
|
4226
4218
|
/*!
|
|
4227
4219
|
* Raphael 1.5.2 - JavaScript Vector Library
|
|
4228
4220
|
*
|
|
4229
4221
|
* Copyright (c) 2010 Dmitry Baranovskiy (http://raphaeljs.com)
|
|
4230
4222
|
* Licensed under the MIT (http://raphaeljs.com/license.html) license.
|
|
4231
4223
|
*/
|
|
4232
|
-
|
|
4233
|
-
(function () {
|
|
4224
|
+
var Raphael$1 = (function () {
|
|
4234
4225
|
var setAttr;
|
|
4235
4226
|
if ("".trim) {
|
|
4236
4227
|
setAttr = function (node, att, value) {
|
|
@@ -8407,7 +8398,7 @@ var raphael = {exports: {}};
|
|
|
8407
8398
|
};
|
|
8408
8399
|
R.el = elproto;
|
|
8409
8400
|
R.st = Set[proto];
|
|
8410
|
-
|
|
8401
|
+
return R;
|
|
8411
8402
|
})();
|
|
8412
8403
|
|
|
8413
8404
|
/**
|
|
@@ -8694,7 +8685,12 @@ class Graphie$1 {
|
|
|
8694
8685
|
writable: true,
|
|
8695
8686
|
value: void 0
|
|
8696
8687
|
});
|
|
8688
|
+
// The primary drawing layer
|
|
8697
8689
|
this.raphael = void 0;
|
|
8690
|
+
// The layer that all visuals with mouse handlers are drawn into
|
|
8691
|
+
this.mouselayer = void 0;
|
|
8692
|
+
this._mouselayerWrapper = void 0;
|
|
8693
|
+
this._visiblelayerWrapper = void 0;
|
|
8698
8694
|
this.isMobile = false;
|
|
8699
8695
|
// Set up some reasonable defaults
|
|
8700
8696
|
this.currentStyle = {
|
|
@@ -8864,7 +8860,7 @@ class Graphie$1 {
|
|
|
8864
8860
|
};
|
|
8865
8861
|
this.el = el;
|
|
8866
8862
|
$(el).css("position", "relative");
|
|
8867
|
-
this.raphael =
|
|
8863
|
+
this.raphael = Raphael$1(el);
|
|
8868
8864
|
|
|
8869
8865
|
// For a sometimes-reproducible IE8 bug; doesn't affect SVG browsers at all
|
|
8870
8866
|
$(el).children("div").css("position", "absolute");
|
|
@@ -9221,7 +9217,7 @@ class Graphie$1 {
|
|
|
9221
9217
|
// wrapper.setAttribute("data-graphie-type", "ellipse");
|
|
9222
9218
|
|
|
9223
9219
|
// Create Raphael canvas
|
|
9224
|
-
const localRaphael =
|
|
9220
|
+
const localRaphael = Raphael$1(wrapper, width, height);
|
|
9225
9221
|
const visibleShape = localRaphael.ellipse(width / 2, height / 2, scaledRadii[0], scaledRadii[1]);
|
|
9226
9222
|
return {
|
|
9227
9223
|
wrapper: wrapper,
|
|
@@ -9288,7 +9284,7 @@ class Graphie$1 {
|
|
|
9288
9284
|
});
|
|
9289
9285
|
|
|
9290
9286
|
// Create Raphael canvas
|
|
9291
|
-
const localRaphael =
|
|
9287
|
+
const localRaphael = Raphael$1(wrapper, width, height);
|
|
9292
9288
|
|
|
9293
9289
|
// Calculate path
|
|
9294
9290
|
const visibleShape = localRaphael.path(createPath(points));
|
|
@@ -9351,7 +9347,7 @@ class Graphie$1 {
|
|
|
9351
9347
|
});
|
|
9352
9348
|
|
|
9353
9349
|
// Create Raphael canvas
|
|
9354
|
-
const localRaphael =
|
|
9350
|
+
const localRaphael = Raphael$1(wrapper, width, height);
|
|
9355
9351
|
|
|
9356
9352
|
// Calculate path
|
|
9357
9353
|
const path = "M" + start[0] + " " + start[1] + " " + "L" + end[0] + " " + end[1];
|
|
@@ -9435,7 +9431,7 @@ class Graphie$1 {
|
|
|
9435
9431
|
postprocessDrawingResult(result) {
|
|
9436
9432
|
// Bad heuristic for recognizing Raphael elements and sets
|
|
9437
9433
|
const type = result.constructor.prototype;
|
|
9438
|
-
if (type ===
|
|
9434
|
+
if (type === Raphael$1.el || type === Raphael$1.st) {
|
|
9439
9435
|
result.attr(this.currentStyle);
|
|
9440
9436
|
if (this.currentStyle.arrows) {
|
|
9441
9437
|
result = this.addArrowheads(result);
|
|
@@ -9450,7 +9446,7 @@ class Graphie$1 {
|
|
|
9450
9446
|
}
|
|
9451
9447
|
addArrowheads(path) {
|
|
9452
9448
|
const type = path.constructor.prototype;
|
|
9453
|
-
if (type ===
|
|
9449
|
+
if (type === Raphael$1.el) {
|
|
9454
9450
|
if (path.type === "path" && typeof path.arrowheadsDrawn === "undefined") {
|
|
9455
9451
|
const w = path.attr("stroke-width");
|
|
9456
9452
|
const s = 0.6 + 0.4 * w;
|
|
@@ -9478,7 +9474,7 @@ class Graphie$1 {
|
|
|
9478
9474
|
set.push(head);
|
|
9479
9475
|
return set;
|
|
9480
9476
|
}
|
|
9481
|
-
} else if (type ===
|
|
9477
|
+
} else if (type === Raphael$1.st) {
|
|
9482
9478
|
for (let i = 0, l = path.items.length; i < l; i++) {
|
|
9483
9479
|
this.addArrowheads(path.items[i]);
|
|
9484
9480
|
}
|
|
@@ -9535,13 +9531,126 @@ class Graphie$1 {
|
|
|
9535
9531
|
return processed;
|
|
9536
9532
|
}
|
|
9537
9533
|
|
|
9538
|
-
//
|
|
9539
|
-
|
|
9540
|
-
|
|
9534
|
+
// Graphie puts text spans on top of the SVG, which looks good, but gets
|
|
9535
|
+
// in the way of mouse events. This adds another SVG element on top
|
|
9536
|
+
// of everything else where we can add invisible shapes with mouse
|
|
9537
|
+
// handlers wherever we want.
|
|
9538
|
+
addMouseLayer(options) {
|
|
9539
|
+
const localOptions = _extends({
|
|
9540
|
+
allowScratchpad: false,
|
|
9541
|
+
setDrawingAreaAvailable: function () {}
|
|
9542
|
+
}, options);
|
|
9543
|
+
const mouselayerZIndex = 2;
|
|
9544
|
+
this.mouselayer = Raphael$1(this.el, this.xpixels, this.ypixels);
|
|
9545
|
+
$(this.mouselayer.canvas).css("z-index", mouselayerZIndex);
|
|
9546
|
+
if (localOptions.onClick || localOptions.onMouseDown || localOptions.onMouseMove || localOptions.onMouseOver || localOptions.onMouseOut) {
|
|
9547
|
+
const canvasClickTarget = this.mouselayer.rect(0, 0, this.xpixels, this.ypixels).attr({
|
|
9548
|
+
fill: "#000",
|
|
9549
|
+
opacity: 0
|
|
9550
|
+
});
|
|
9551
|
+
let isClickingCanvas = false;
|
|
9552
|
+
$(this.mouselayer.canvas).on("vmousedown", e => {
|
|
9553
|
+
if (e.target === canvasClickTarget[0]) {
|
|
9554
|
+
if (localOptions.onMouseDown) {
|
|
9555
|
+
localOptions.onMouseDown(this.getMouseCoord(e));
|
|
9556
|
+
}
|
|
9557
|
+
isClickingCanvas = true;
|
|
9558
|
+
if (localOptions.onMouseMove) {
|
|
9559
|
+
const handler = localOptions.onMouseMove;
|
|
9560
|
+
$(document).bind("vmousemove.mouseLayer", e => {
|
|
9561
|
+
if (isClickingCanvas) {
|
|
9562
|
+
e.preventDefault();
|
|
9563
|
+
handler(this.getMouseCoord(e));
|
|
9564
|
+
}
|
|
9565
|
+
});
|
|
9566
|
+
}
|
|
9567
|
+
$(document).bind("vmouseup.mouseLayer", e => {
|
|
9568
|
+
$(document).unbind(".mouseLayer");
|
|
9569
|
+
|
|
9570
|
+
// Only register clicks that started on the canvas,
|
|
9571
|
+
// and not on another mouseLayer target
|
|
9572
|
+
if (isClickingCanvas && localOptions.onClick) {
|
|
9573
|
+
localOptions.onClick(this.getMouseCoord(e));
|
|
9574
|
+
}
|
|
9575
|
+
isClickingCanvas = false;
|
|
9576
|
+
});
|
|
9577
|
+
}
|
|
9578
|
+
});
|
|
9579
|
+
if (localOptions.onMouseOver) {
|
|
9580
|
+
const handler = localOptions.onMouseOver;
|
|
9581
|
+
$(this.mouselayer.canvas).on("vmouseover", e => {
|
|
9582
|
+
handler(this.getMouseCoord(e));
|
|
9583
|
+
});
|
|
9584
|
+
}
|
|
9585
|
+
if (localOptions.onMouseOut) {
|
|
9586
|
+
const handler = localOptions.onMouseOut;
|
|
9587
|
+
$(this.mouselayer.canvas).on("vmouseout", e => {
|
|
9588
|
+
handler(this.getMouseCoord(e));
|
|
9589
|
+
});
|
|
9590
|
+
}
|
|
9591
|
+
}
|
|
9592
|
+
if (!localOptions.allowScratchpad) {
|
|
9593
|
+
localOptions.setDrawingAreaAvailable == null || localOptions.setDrawingAreaAvailable(false);
|
|
9594
|
+
}
|
|
9595
|
+
|
|
9596
|
+
// Add mouse and visible wrapper layers for DOM-node-wrapped movables
|
|
9597
|
+
this._mouselayerWrapper = document.createElement("div");
|
|
9598
|
+
$(this._mouselayerWrapper).css({
|
|
9599
|
+
position: "absolute",
|
|
9600
|
+
left: 0,
|
|
9601
|
+
top: 0,
|
|
9602
|
+
zIndex: mouselayerZIndex
|
|
9603
|
+
});
|
|
9604
|
+
this._visiblelayerWrapper = document.createElement("div");
|
|
9605
|
+
$(this._visiblelayerWrapper).css({
|
|
9606
|
+
position: "absolute",
|
|
9607
|
+
left: 0,
|
|
9608
|
+
top: 0
|
|
9609
|
+
});
|
|
9610
|
+
const el = this.el;
|
|
9611
|
+
el.appendChild(this._visiblelayerWrapper);
|
|
9612
|
+
el.appendChild(this._mouselayerWrapper);
|
|
9613
|
+
|
|
9614
|
+
// Add functions for adding to wrappers
|
|
9615
|
+
this.addToMouseLayerWrapper = el => {
|
|
9616
|
+
var _this$_mouselayerWrap;
|
|
9617
|
+
(_this$_mouselayerWrap = this._mouselayerWrapper) == null || _this$_mouselayerWrap.appendChild(el);
|
|
9618
|
+
};
|
|
9619
|
+
this.addToVisibleLayerWrapper = el => {
|
|
9620
|
+
var _this$_visiblelayerWr;
|
|
9621
|
+
(_this$_visiblelayerWr = this._visiblelayerWrapper) == null || _this$_visiblelayerWr.appendChild(el);
|
|
9622
|
+
};
|
|
9623
|
+
}
|
|
9624
|
+
addToMouseLayerWrapper(el) {
|
|
9625
|
+
throw new Error("addToMouseLayerWrapper is not ready. Call addMouseLayer() first.");
|
|
9626
|
+
}
|
|
9627
|
+
addToVisibleLayerWrapper(el) {
|
|
9628
|
+
throw new Error("addToVisibleLayerWrapper is not ready. Call addMouseLayer() first.");
|
|
9629
|
+
}
|
|
9630
|
+
/**
|
|
9631
|
+
* Get mouse coordinates in pixels
|
|
9632
|
+
*/
|
|
9633
|
+
getMousePx(event) {
|
|
9634
|
+
const offset = $(this.el).offset();
|
|
9635
|
+
const mouseX =
|
|
9636
|
+
// @ts-expect-error - TS18048 - 'event.pageX' is possibly 'undefined'.
|
|
9637
|
+
event.pageX -
|
|
9638
|
+
// @ts-expect-error - TS2532 - Object is possibly 'undefined'.
|
|
9639
|
+
offset.left;
|
|
9640
|
+
const mouseY =
|
|
9641
|
+
// @ts-expect-error - TS18048 - 'event.pageY' is possibly 'undefined'.
|
|
9642
|
+
event.pageY -
|
|
9643
|
+
// @ts-expect-error - TS2532 - Object is possibly 'undefined'.
|
|
9644
|
+
offset.top;
|
|
9645
|
+
return [mouseX, mouseY];
|
|
9541
9646
|
}
|
|
9542
9647
|
|
|
9543
|
-
|
|
9544
|
-
|
|
9648
|
+
/**
|
|
9649
|
+
* Get mouse coordinates in graph coordinates
|
|
9650
|
+
*/
|
|
9651
|
+
getMouseCoord(event) {
|
|
9652
|
+
return this.unscalePoint(this.getMousePx(event));
|
|
9653
|
+
}
|
|
9545
9654
|
}
|
|
9546
9655
|
const labelDirections = {
|
|
9547
9656
|
center: [-0.5, -0.5],
|
|
@@ -10641,114 +10750,6 @@ const InteractiveUtils = {
|
|
|
10641
10750
|
}
|
|
10642
10751
|
};
|
|
10643
10752
|
_.extend(GraphUtils.Graphie.prototype, {
|
|
10644
|
-
// graphie puts text spans on top of the SVG, which looks good, but gets
|
|
10645
|
-
// in the way of mouse events. This adds another SVG element on top
|
|
10646
|
-
// of everything else where we can add invisible shapes with mouse
|
|
10647
|
-
// handlers wherever we want.
|
|
10648
|
-
addMouseLayer: function (options) {
|
|
10649
|
-
const graph = this;
|
|
10650
|
-
options = _.extend({
|
|
10651
|
-
allowScratchpad: false,
|
|
10652
|
-
setDrawingAreaAvailable: function () {}
|
|
10653
|
-
}, options);
|
|
10654
|
-
const mouselayerZIndex = 2;
|
|
10655
|
-
graph.mouselayer = raphael.exports(graph.raphael.canvas.parentNode, graph.xpixels, graph.ypixels);
|
|
10656
|
-
$(graph.mouselayer.canvas).css("z-index", mouselayerZIndex);
|
|
10657
|
-
if (options.onClick || options.onMouseDown || options.onMouseMove || options.onMouseOver || options.onMouseOut) {
|
|
10658
|
-
const canvasClickTarget = graph.mouselayer.rect(0, 0, graph.xpixels, graph.ypixels).attr({
|
|
10659
|
-
fill: "#000",
|
|
10660
|
-
opacity: 0
|
|
10661
|
-
});
|
|
10662
|
-
let isClickingCanvas = false;
|
|
10663
|
-
$(graph.mouselayer.canvas).on("vmousedown", function (e) {
|
|
10664
|
-
if (e.target === canvasClickTarget[0]) {
|
|
10665
|
-
if (options.onMouseDown) {
|
|
10666
|
-
options.onMouseDown(graph.getMouseCoord(e));
|
|
10667
|
-
}
|
|
10668
|
-
isClickingCanvas = true;
|
|
10669
|
-
if (options.onMouseMove) {
|
|
10670
|
-
const handler = options.onMouseMove;
|
|
10671
|
-
$(document).bind("vmousemove.mouseLayer", function (e) {
|
|
10672
|
-
if (isClickingCanvas) {
|
|
10673
|
-
e.preventDefault();
|
|
10674
|
-
handler(graph.getMouseCoord(e));
|
|
10675
|
-
}
|
|
10676
|
-
});
|
|
10677
|
-
}
|
|
10678
|
-
$(document).bind("vmouseup.mouseLayer", function (e) {
|
|
10679
|
-
$(document).unbind(".mouseLayer");
|
|
10680
|
-
|
|
10681
|
-
// Only register clicks that started on the canvas,
|
|
10682
|
-
// and not on another mouseLayer target
|
|
10683
|
-
if (isClickingCanvas && options.onClick) {
|
|
10684
|
-
options.onClick(graph.getMouseCoord(e));
|
|
10685
|
-
}
|
|
10686
|
-
isClickingCanvas = false;
|
|
10687
|
-
});
|
|
10688
|
-
}
|
|
10689
|
-
});
|
|
10690
|
-
if (options.onMouseOver) {
|
|
10691
|
-
const handler = options.onMouseOver;
|
|
10692
|
-
$(graph.mouselayer.canvas).on("vmouseover", function (e) {
|
|
10693
|
-
handler(graph.getMouseCoord(e));
|
|
10694
|
-
});
|
|
10695
|
-
}
|
|
10696
|
-
if (options.onMouseOut) {
|
|
10697
|
-
const handler = options.onMouseOut;
|
|
10698
|
-
$(graph.mouselayer.canvas).on("vmouseout", function (e) {
|
|
10699
|
-
handler(graph.getMouseCoord(e));
|
|
10700
|
-
});
|
|
10701
|
-
}
|
|
10702
|
-
}
|
|
10703
|
-
if (!options.allowScratchpad) {
|
|
10704
|
-
options.setDrawingAreaAvailable == null || options.setDrawingAreaAvailable(false);
|
|
10705
|
-
}
|
|
10706
|
-
|
|
10707
|
-
// Add mouse and visible wrapper layers for DOM-node-wrapped movables
|
|
10708
|
-
graph._mouselayerWrapper = document.createElement("div");
|
|
10709
|
-
$(graph._mouselayerWrapper).css({
|
|
10710
|
-
position: "absolute",
|
|
10711
|
-
left: 0,
|
|
10712
|
-
top: 0,
|
|
10713
|
-
zIndex: mouselayerZIndex
|
|
10714
|
-
});
|
|
10715
|
-
graph._visiblelayerWrapper = document.createElement("div");
|
|
10716
|
-
$(graph._visiblelayerWrapper).css({
|
|
10717
|
-
position: "absolute",
|
|
10718
|
-
left: 0,
|
|
10719
|
-
top: 0
|
|
10720
|
-
});
|
|
10721
|
-
const el = graph.raphael.canvas.parentNode;
|
|
10722
|
-
el.appendChild(graph._visiblelayerWrapper);
|
|
10723
|
-
el.appendChild(graph._mouselayerWrapper);
|
|
10724
|
-
|
|
10725
|
-
// Add functions for adding to wrappers
|
|
10726
|
-
graph.addToMouseLayerWrapper = function (el) {
|
|
10727
|
-
this._mouselayerWrapper.appendChild(el);
|
|
10728
|
-
};
|
|
10729
|
-
graph.addToVisibleLayerWrapper = function (el) {
|
|
10730
|
-
this._visiblelayerWrapper.appendChild(el);
|
|
10731
|
-
};
|
|
10732
|
-
},
|
|
10733
|
-
/**
|
|
10734
|
-
* Get mouse coordinates in pixels
|
|
10735
|
-
*/
|
|
10736
|
-
getMousePx: function (event) {
|
|
10737
|
-
const graphie = this;
|
|
10738
|
-
const mouseX =
|
|
10739
|
-
// @ts-expect-error - TS2532 - Object is possibly 'undefined'.
|
|
10740
|
-
event.pageX - $(graphie.raphael.canvas.parentNode).offset().left;
|
|
10741
|
-
const mouseY =
|
|
10742
|
-
// @ts-expect-error - TS2532 - Object is possibly 'undefined'.
|
|
10743
|
-
event.pageY - $(graphie.raphael.canvas.parentNode).offset().top;
|
|
10744
|
-
return [mouseX, mouseY];
|
|
10745
|
-
},
|
|
10746
|
-
/**
|
|
10747
|
-
* Get mouse coordinates in graph coordinates
|
|
10748
|
-
*/
|
|
10749
|
-
getMouseCoord: function (event) {
|
|
10750
|
-
return this.unscalePoint(this.getMousePx(event));
|
|
10751
|
-
},
|
|
10752
10753
|
/**
|
|
10753
10754
|
* Unlike all other Graphie-related code, the following three functions use
|
|
10754
10755
|
* a lot of scaled coordinates (so that labels appear the same size
|
|
@@ -23235,14 +23236,16 @@ const Choice = function Choice(props) {
|
|
|
23235
23236
|
content: ({
|
|
23236
23237
|
close
|
|
23237
23238
|
}) => /*#__PURE__*/React.createElement(PopoverContent, {
|
|
23238
|
-
title: "Cross out",
|
|
23239
|
-
content: "Cross out option",
|
|
23239
|
+
title: i18n._("Cross out"),
|
|
23240
|
+
content: i18n._("Cross out option"),
|
|
23240
23241
|
closeButtonVisible: true,
|
|
23241
23242
|
actions: /*#__PURE__*/React.createElement(View, null, /*#__PURE__*/React.createElement(Strut, {
|
|
23242
23243
|
size: Spacing.medium_16
|
|
23243
23244
|
}), /*#__PURE__*/React.createElement(Button, {
|
|
23244
23245
|
kind: "primary",
|
|
23245
|
-
"aria-label":
|
|
23246
|
+
"aria-label": i18n._("Cross out Choice %(letter)s", {
|
|
23247
|
+
letter: getChoiceLetter(pos)
|
|
23248
|
+
}),
|
|
23246
23249
|
disabled: apiOptions.readOnly || reviewMode,
|
|
23247
23250
|
onClick: () => {
|
|
23248
23251
|
if (!crossedOut) {
|
|
@@ -23261,13 +23264,15 @@ const Choice = function Choice(props) {
|
|
|
23261
23264
|
}
|
|
23262
23265
|
close();
|
|
23263
23266
|
}
|
|
23264
|
-
}, crossedOut ? "Bring back" : "Cross out"))
|
|
23267
|
+
}, crossedOut ? i18n._("Bring back") : i18n._("Cross out")))
|
|
23265
23268
|
})
|
|
23266
23269
|
}, ({
|
|
23267
23270
|
open
|
|
23268
23271
|
}) => /*#__PURE__*/React.createElement(Clickable, {
|
|
23269
23272
|
onClick: open,
|
|
23270
|
-
"aria-label": `Open menu for Choice
|
|
23273
|
+
"aria-label": i18n._(`Open menu for Choice %(letter)s`, {
|
|
23274
|
+
letter: getChoiceLetter(pos)
|
|
23275
|
+
}),
|
|
23271
23276
|
style: {
|
|
23272
23277
|
alignSelf: "center",
|
|
23273
23278
|
padding: "5px",
|
|
@@ -40445,366 +40450,222 @@ var Table$1 = {
|
|
|
40445
40450
|
isLintable: true
|
|
40446
40451
|
};
|
|
40447
40452
|
|
|
40448
|
-
var
|
|
40449
|
-
|
|
40450
|
-
|
|
40451
|
-
|
|
40452
|
-
|
|
40453
|
-
|
|
40454
|
-
|
|
40455
|
-
|
|
40456
|
-
|
|
40457
|
-
|
|
40458
|
-
|
|
40459
|
-
|
|
40460
|
-
|
|
40461
|
-
|
|
40462
|
-
|
|
40463
|
-
|
|
40464
|
-
|
|
40465
|
-
|
|
40466
|
-
|
|
40467
|
-
|
|
40468
|
-
|
|
40469
|
-
|
|
40470
|
-
|
|
40471
|
-
|
|
40472
|
-
|
|
40473
|
-
|
|
40474
|
-
|
|
40475
|
-
|
|
40476
|
-
|
|
40477
|
-
|
|
40478
|
-
|
|
40479
|
-
|
|
40480
|
-
|
|
40481
|
-
|
|
40482
|
-
|
|
40483
|
-
|
|
40484
|
-
|
|
40485
|
-
|
|
40486
|
-
|
|
40487
|
-
|
|
40488
|
-
|
|
40489
|
-
|
|
40490
|
-
|
|
40491
|
-
|
|
40492
|
-
|
|
40493
|
-
|
|
40494
|
-
|
|
40495
|
-
|
|
40496
|
-
|
|
40497
|
-
|
|
40498
|
-
|
|
40499
|
-
|
|
40500
|
-
|
|
40501
|
-
|
|
40502
|
-
|
|
40503
|
-
|
|
40504
|
-
|
|
40505
|
-
|
|
40506
|
-
|
|
40507
|
-
|
|
40508
|
-
|
|
40509
|
-
|
|
40510
|
-
|
|
40511
|
-
|
|
40512
|
-
|
|
40513
|
-
|
|
40514
|
-
|
|
40515
|
-
|
|
40516
|
-
|
|
40517
|
-
|
|
40518
|
-
|
|
40519
|
-
|
|
40520
|
-
|
|
40521
|
-
|
|
40522
|
-
|
|
40523
|
-
|
|
40524
|
-
|
|
40525
|
-
|
|
40526
|
-
|
|
40527
|
-
|
|
40528
|
-
|
|
40529
|
-
|
|
40530
|
-
|
|
40531
|
-
|
|
40532
|
-
|
|
40533
|
-
|
|
40534
|
-
|
|
40535
|
-
|
|
40536
|
-
|
|
40537
|
-
|
|
40538
|
-
|
|
40539
|
-
|
|
40540
|
-
|
|
40541
|
-
|
|
40542
|
-
|
|
40543
|
-
|
|
40544
|
-
|
|
40545
|
-
|
|
40546
|
-
|
|
40547
|
-
|
|
40548
|
-
|
|
40549
|
-
|
|
40550
|
-
|
|
40551
|
-
|
|
40552
|
-
|
|
40553
|
-
|
|
40554
|
-
|
|
40555
|
-
|
|
40556
|
-
|
|
40557
|
-
|
|
40558
|
-
|
|
40559
|
-
|
|
40560
|
-
|
|
40561
|
-
|
|
40562
|
-
|
|
40563
|
-
|
|
40564
|
-
|
|
40565
|
-
|
|
40566
|
-
|
|
40567
|
-
|
|
40568
|
-
|
|
40569
|
-
|
|
40570
|
-
|
|
40571
|
-
|
|
40572
|
-
|
|
40573
|
-
|
|
40574
|
-
|
|
40575
|
-
|
|
40576
|
-
|
|
40577
|
-
|
|
40578
|
-
|
|
40579
|
-
|
|
40580
|
-
|
|
40581
|
-
|
|
40582
|
-
|
|
40583
|
-
|
|
40584
|
-
|
|
40585
|
-
|
|
40586
|
-
|
|
40587
|
-
|
|
40588
|
-
|
|
40589
|
-
|
|
40590
|
-
|
|
40591
|
-
|
|
40592
|
-
|
|
40593
|
-
|
|
40594
|
-
|
|
40595
|
-
|
|
40596
|
-
|
|
40597
|
-
|
|
40598
|
-
|
|
40599
|
-
|
|
40600
|
-
|
|
40601
|
-
|
|
40602
|
-
|
|
40603
|
-
|
|
40604
|
-
|
|
40605
|
-
|
|
40606
|
-
|
|
40607
|
-
|
|
40608
|
-
|
|
40609
|
-
|
|
40610
|
-
|
|
40611
|
-
|
|
40612
|
-
|
|
40613
|
-
|
|
40614
|
-
|
|
40615
|
-
|
|
40616
|
-
|
|
40617
|
-
|
|
40618
|
-
|
|
40619
|
-
|
|
40620
|
-
|
|
40621
|
-
|
|
40622
|
-
|
|
40623
|
-
|
|
40624
|
-
|
|
40625
|
-
|
|
40626
|
-
|
|
40627
|
-
|
|
40628
|
-
|
|
40629
|
-
|
|
40630
|
-
|
|
40631
|
-
|
|
40632
|
-
|
|
40633
|
-
|
|
40634
|
-
|
|
40635
|
-
|
|
40636
|
-
|
|
40637
|
-
|
|
40638
|
-
|
|
40639
|
-
|
|
40640
|
-
|
|
40641
|
-
|
|
40642
|
-
|
|
40643
|
-
|
|
40644
|
-
|
|
40645
|
-
|
|
40646
|
-
|
|
40647
|
-
|
|
40648
|
-
|
|
40649
|
-
|
|
40650
|
-
|
|
40651
|
-
|
|
40652
|
-
|
|
40653
|
-
|
|
40654
|
-
|
|
40655
|
-
|
|
40656
|
-
|
|
40657
|
-
|
|
40658
|
-
|
|
40659
|
-
|
|
40660
|
-
|
|
40661
|
-
|
|
40662
|
-
|
|
40663
|
-
|
|
40664
|
-
lens.prototype.merge = function (lensArr, props) {
|
|
40665
|
-
this._wrapped = lens(this._wrapped).mod(lensArr, function (oldProps) {
|
|
40666
|
-
return merge(oldProps, props);
|
|
40667
|
-
}).freeze();
|
|
40668
|
-
return this;
|
|
40669
|
-
};
|
|
40670
|
-
|
|
40671
|
-
// Lens must have length >= 1 or there would be nothing to return
|
|
40672
|
-
lens.prototype.del = function (lensArr) {
|
|
40673
|
-
var obj = this._wrapped;
|
|
40674
|
-
var ops = dispatch(obj);
|
|
40675
|
-
if (lensArr.length === 1) {
|
|
40676
|
-
this._wrapped = ops.del(obj, lensArr[0]);
|
|
40677
|
-
} else {
|
|
40678
|
-
var monocle = lensArr[0];
|
|
40679
|
-
var shortLens = lensArr.slice(1);
|
|
40680
|
-
var newObj = clone(obj);
|
|
40681
|
-
newObj[monocle] = lens(obj[monocle]).del(shortLens).freeze();
|
|
40682
|
-
this._wrapped = newObj;
|
|
40683
|
-
}
|
|
40684
|
-
return this;
|
|
40685
|
-
};
|
|
40686
|
-
lens.prototype.set = function (lensArr, set) {
|
|
40687
|
-
return this.mod(lensArr, function () {
|
|
40688
|
-
return set;
|
|
40689
|
-
});
|
|
40690
|
-
};
|
|
40691
|
-
module.exports = lens;
|
|
40692
|
-
|
|
40693
|
-
/***/
|
|
40694
|
-
}, /* 2 */
|
|
40695
|
-
/***/function (module, exports) {
|
|
40696
|
-
var get = function get(arr, monocle) {
|
|
40697
|
-
return arr[monocle];
|
|
40698
|
-
};
|
|
40699
|
-
var set = function set(arr, monocle, val) {
|
|
40700
|
-
var newArr = arr.splice();
|
|
40701
|
-
newArr[monocle] = val;
|
|
40702
|
-
return newArr;
|
|
40703
|
-
};
|
|
40704
|
-
var mod = function mod(arr, monocle, f) {
|
|
40705
|
-
var newArr = arr.slice();
|
|
40706
|
-
newArr[monocle] = f(arr[monocle]);
|
|
40707
|
-
return newArr;
|
|
40708
|
-
};
|
|
40709
|
-
var del = function del(arr, monocle) {
|
|
40710
|
-
var newArr = arr.slice();
|
|
40711
|
-
newArr.splice(monocle, 1);
|
|
40712
|
-
return newArr;
|
|
40713
|
-
};
|
|
40714
|
-
|
|
40715
|
-
/*
|
|
40716
|
-
// Lens must point to a member of an array. We'll insert into that array.
|
|
40717
|
-
lens.prototype.insertAt = function(lensArr, toInsert) {
|
|
40718
|
-
var obj = this._wrapped;
|
|
40719
|
-
|
|
40720
|
-
var arrLens = lensArr.slice(0, -1);
|
|
40721
|
-
var arr = lens(obj).get(arrLens).slice(); // slice to copy
|
|
40722
|
-
|
|
40723
|
-
var arrIdx = lensArr[lensArr.length-1];
|
|
40724
|
-
arr.splice(arrIdx, 0, toInsert);
|
|
40725
|
-
return lens(obj).set(arrLens, arr);
|
|
40726
|
-
};
|
|
40727
|
-
|
|
40728
|
-
lens.prototype.insertBefore = lens.prototype.insertAt;
|
|
40729
|
-
lens.prototype.insertAfter = function(lensArr, toInsert) {
|
|
40730
|
-
var newLens = lensArr.slice();
|
|
40731
|
-
newLens[newLens.length-1] += 1;
|
|
40732
|
-
return lens(this._wrapped).insertAt(newLens, toInsert);
|
|
40733
|
-
};
|
|
40734
|
-
*/
|
|
40735
|
-
|
|
40736
|
-
module.exports = {
|
|
40737
|
-
get: get,
|
|
40738
|
-
set: set,
|
|
40739
|
-
mod: mod,
|
|
40740
|
-
del: del
|
|
40741
|
-
};
|
|
40742
|
-
|
|
40743
|
-
/***/
|
|
40744
|
-
}, /* 3 */
|
|
40745
|
-
/***/function (module, exports, __webpack_require__) {
|
|
40746
|
-
var clone = __webpack_require__(0).clone;
|
|
40747
|
-
var get = function get(obj, monocle) {
|
|
40748
|
-
return obj[monocle];
|
|
40749
|
-
};
|
|
40750
|
-
var set = function set(obj, monocle, val) {
|
|
40751
|
-
var newObj = clone(obj);
|
|
40752
|
-
newObj[monocle] = val;
|
|
40753
|
-
return newObj;
|
|
40754
|
-
};
|
|
40755
|
-
var mod = function mod(obj, monocle, f) {
|
|
40756
|
-
var newObj = clone(obj);
|
|
40757
|
-
newObj[monocle] = f(obj[monocle]);
|
|
40758
|
-
return newObj;
|
|
40759
|
-
};
|
|
40760
|
-
var del = function del(obj, monocle) {
|
|
40761
|
-
var newObj = clone(obj);
|
|
40762
|
-
delete newObj[monocle];
|
|
40763
|
-
return newObj;
|
|
40764
|
-
};
|
|
40765
|
-
module.exports = {
|
|
40766
|
-
get: get,
|
|
40767
|
-
set: set,
|
|
40768
|
-
mod: mod,
|
|
40769
|
-
del: del
|
|
40770
|
-
};
|
|
40771
|
-
|
|
40772
|
-
/***/
|
|
40773
|
-
}, /* 4 */
|
|
40774
|
-
/***/function (module, exports) {
|
|
40775
|
-
var get = function get(arr, monocle) {
|
|
40776
|
-
return arr[monocle];
|
|
40777
|
-
};
|
|
40778
|
-
var set = function set(arr, monocle, val) {
|
|
40779
|
-
var newArr = arr.splice();
|
|
40780
|
-
newArr[monocle] = val;
|
|
40781
|
-
return newArr;
|
|
40782
|
-
};
|
|
40783
|
-
var mod = function mod(arr, monocle, f) {
|
|
40784
|
-
var newArr = arr.splice();
|
|
40785
|
-
newArr[monocle] = f(arr[monocle]);
|
|
40786
|
-
return newArr;
|
|
40787
|
-
};
|
|
40788
|
-
var del = function del(arr, monocle) {
|
|
40789
|
-
var newArr = arr.slice();
|
|
40790
|
-
newArr.splice(monocle);
|
|
40791
|
-
return newArr;
|
|
40792
|
-
};
|
|
40793
|
-
module.exports = {
|
|
40794
|
-
get: get,
|
|
40795
|
-
set: set,
|
|
40796
|
-
mod: mod,
|
|
40797
|
-
del: del
|
|
40798
|
-
};
|
|
40799
|
-
|
|
40800
|
-
/***/
|
|
40801
|
-
}
|
|
40802
|
-
/******/])
|
|
40803
|
-
);
|
|
40804
|
-
});
|
|
40805
|
-
} (hubble));
|
|
40806
|
-
|
|
40807
|
-
var lens = /*@__PURE__*/getDefaultExportFromCjs(hubble.exports);
|
|
40453
|
+
var isObject = function isObject(obj) {
|
|
40454
|
+
return obj === Object(obj);
|
|
40455
|
+
};
|
|
40456
|
+
var merge = function merge() {
|
|
40457
|
+
var obj = {};
|
|
40458
|
+
for (var i = 0; i < arguments.length; i++) {
|
|
40459
|
+
var source = arguments[i];
|
|
40460
|
+
if (source) {
|
|
40461
|
+
for (var prop in source) {
|
|
40462
|
+
obj[prop] = source[prop];
|
|
40463
|
+
}
|
|
40464
|
+
}
|
|
40465
|
+
}
|
|
40466
|
+
return obj;
|
|
40467
|
+
};
|
|
40468
|
+
var clone = function clone(obj) {
|
|
40469
|
+
if (!isObject(obj)) {
|
|
40470
|
+
return obj;
|
|
40471
|
+
}
|
|
40472
|
+
return Array.isArray(obj) ? obj.slice() : merge(obj);
|
|
40473
|
+
};
|
|
40474
|
+
|
|
40475
|
+
/* TODO batch *all* mutations
|
|
40476
|
+
* idea: freeze / thaw implementations for all types
|
|
40477
|
+
* lens constructor thaws, freeze delegates to type's freeze
|
|
40478
|
+
*/
|
|
40479
|
+
|
|
40480
|
+
// equivalents, without requiring it
|
|
40481
|
+
// find the implementation to use for a given object
|
|
40482
|
+
var dispatch = function dispatch(x) {
|
|
40483
|
+
if (Array.isArray(x)) {
|
|
40484
|
+
return arr;
|
|
40485
|
+
} else if (isObject(x)) {
|
|
40486
|
+
return obj;
|
|
40487
|
+
} else if (typeof x === "string") {
|
|
40488
|
+
return str;
|
|
40489
|
+
}
|
|
40490
|
+
};
|
|
40491
|
+
|
|
40492
|
+
// This is underscore with a different name
|
|
40493
|
+
var lens = function lens(obj) {
|
|
40494
|
+
if (obj instanceof lens) {
|
|
40495
|
+
return obj;
|
|
40496
|
+
}
|
|
40497
|
+
if (!(this instanceof lens)) {
|
|
40498
|
+
return new lens(obj);
|
|
40499
|
+
}
|
|
40500
|
+
var ops = dispatch(obj);
|
|
40501
|
+
this._wrapped = ops.thaw ? ops.thaw(obj) : obj;
|
|
40502
|
+
};
|
|
40503
|
+
lens.prototype.freeze = function () {
|
|
40504
|
+
var obj = this._wrapped;
|
|
40505
|
+
var ops = dispatch(obj);
|
|
40506
|
+
return ops.freeze ? ops.freeze(obj) : obj;
|
|
40507
|
+
};
|
|
40508
|
+
lens.prototype.zoom = function (lensArr) {
|
|
40509
|
+
if (this._zoomStack === undefined) {
|
|
40510
|
+
this._zoomStack = [];
|
|
40511
|
+
}
|
|
40512
|
+
this._zoomStack.push({
|
|
40513
|
+
zoom: lensArr,
|
|
40514
|
+
wrapped: this._wrapped
|
|
40515
|
+
});
|
|
40516
|
+
this._wrapped = lens(this._wrapped).get(lensArr);
|
|
40517
|
+
return this;
|
|
40518
|
+
};
|
|
40519
|
+
lens.prototype.deZoom = function () {
|
|
40520
|
+
var frame = this._zoomStack.pop();
|
|
40521
|
+
this._wrapped = lens(frame.wrapped).set(frame.zoom, this._wrapped).freeze();
|
|
40522
|
+
return this;
|
|
40523
|
+
};
|
|
40524
|
+
lens.prototype.get = function (lensArr) {
|
|
40525
|
+
var obj = this._wrapped;
|
|
40526
|
+
for (var i = 0; i < lensArr.length; i++) {
|
|
40527
|
+
obj = dispatch(obj).get(obj, lensArr[i]);
|
|
40528
|
+
}
|
|
40529
|
+
return obj;
|
|
40530
|
+
};
|
|
40531
|
+
lens.prototype.mod = function (lensArr, f) {
|
|
40532
|
+
var obj = this._wrapped;
|
|
40533
|
+
var newObj = clone(obj);
|
|
40534
|
+
var ops = dispatch(obj);
|
|
40535
|
+
if (lensArr.length === 0) {
|
|
40536
|
+
this._wrapped = f(this._wrapped);
|
|
40537
|
+
} else if (lensArr.length === 1) {
|
|
40538
|
+
this._wrapped = ops.mod(newObj, lensArr[0], f);
|
|
40539
|
+
} else {
|
|
40540
|
+
var monocle = lensArr[0];
|
|
40541
|
+
var shortLens = lensArr.slice(1);
|
|
40542
|
+
|
|
40543
|
+
// newObj = ops.mod(obj[monocle], shortLens, f);
|
|
40544
|
+
|
|
40545
|
+
newObj[monocle] = lens(obj[monocle]).mod(shortLens, f).freeze();
|
|
40546
|
+
this._wrapped = newObj;
|
|
40547
|
+
}
|
|
40548
|
+
return this;
|
|
40549
|
+
};
|
|
40550
|
+
|
|
40551
|
+
// TODO - move to individual files
|
|
40552
|
+
lens.prototype.merge = function (lensArr, props) {
|
|
40553
|
+
this._wrapped = lens(this._wrapped).mod(lensArr, function (oldProps) {
|
|
40554
|
+
return merge(oldProps, props);
|
|
40555
|
+
}).freeze();
|
|
40556
|
+
return this;
|
|
40557
|
+
};
|
|
40558
|
+
|
|
40559
|
+
// Lens must have length >= 1 or there would be nothing to return
|
|
40560
|
+
lens.prototype.del = function (lensArr) {
|
|
40561
|
+
var obj = this._wrapped;
|
|
40562
|
+
var ops = dispatch(obj);
|
|
40563
|
+
if (lensArr.length === 1) {
|
|
40564
|
+
this._wrapped = ops.del(obj, lensArr[0]);
|
|
40565
|
+
} else {
|
|
40566
|
+
var monocle = lensArr[0];
|
|
40567
|
+
var shortLens = lensArr.slice(1);
|
|
40568
|
+
var newObj = clone(obj);
|
|
40569
|
+
newObj[monocle] = lens(obj[monocle]).del(shortLens).freeze();
|
|
40570
|
+
this._wrapped = newObj;
|
|
40571
|
+
}
|
|
40572
|
+
return this;
|
|
40573
|
+
};
|
|
40574
|
+
lens.prototype.set = function (lensArr, set) {
|
|
40575
|
+
return this.mod(lensArr, function () {
|
|
40576
|
+
return set;
|
|
40577
|
+
});
|
|
40578
|
+
};
|
|
40579
|
+
|
|
40580
|
+
// ARRAY FUNCTIONS
|
|
40581
|
+
|
|
40582
|
+
const arr = {
|
|
40583
|
+
get: function (arr, monocle) {
|
|
40584
|
+
return arr[monocle];
|
|
40585
|
+
},
|
|
40586
|
+
set: function (arr, monocle, val) {
|
|
40587
|
+
var newArr = arr.splice();
|
|
40588
|
+
newArr[monocle] = val;
|
|
40589
|
+
return newArr;
|
|
40590
|
+
},
|
|
40591
|
+
mod: function (arr, monocle, f) {
|
|
40592
|
+
var newArr = arr.slice();
|
|
40593
|
+
newArr[monocle] = f(arr[monocle]);
|
|
40594
|
+
return newArr;
|
|
40595
|
+
},
|
|
40596
|
+
del: function (arr, monocle) {
|
|
40597
|
+
var newArr = arr.slice();
|
|
40598
|
+
newArr.splice(monocle, 1);
|
|
40599
|
+
return newArr;
|
|
40600
|
+
}
|
|
40601
|
+
};
|
|
40602
|
+
|
|
40603
|
+
/*
|
|
40604
|
+
// Lens must point to a member of an array. We'll insert into that array.
|
|
40605
|
+
lens.prototype.insertAt = function(lensArr, toInsert) {
|
|
40606
|
+
var obj = this._wrapped;
|
|
40607
|
+
|
|
40608
|
+
var arrLens = lensArr.slice(0, -1);
|
|
40609
|
+
var arr = lens(obj).get(arrLens).slice(); // slice to copy
|
|
40610
|
+
|
|
40611
|
+
var arrIdx = lensArr[lensArr.length-1];
|
|
40612
|
+
arr.splice(arrIdx, 0, toInsert);
|
|
40613
|
+
return lens(obj).set(arrLens, arr);
|
|
40614
|
+
};
|
|
40615
|
+
|
|
40616
|
+
lens.prototype.insertBefore = lens.prototype.insertAt;
|
|
40617
|
+
lens.prototype.insertAfter = function(lensArr, toInsert) {
|
|
40618
|
+
var newLens = lensArr.slice();
|
|
40619
|
+
newLens[newLens.length-1] += 1;
|
|
40620
|
+
return lens(this._wrapped).insertAt(newLens, toInsert);
|
|
40621
|
+
};
|
|
40622
|
+
*/
|
|
40623
|
+
|
|
40624
|
+
// OBJECT FUNCTIONS
|
|
40625
|
+
|
|
40626
|
+
const obj = {
|
|
40627
|
+
get: function (obj, monocle) {
|
|
40628
|
+
return obj[monocle];
|
|
40629
|
+
},
|
|
40630
|
+
set: function (obj, monocle, val) {
|
|
40631
|
+
var newObj = clone(obj);
|
|
40632
|
+
newObj[monocle] = val;
|
|
40633
|
+
return newObj;
|
|
40634
|
+
},
|
|
40635
|
+
mod: function (obj, monocle, f) {
|
|
40636
|
+
var newObj = clone(obj);
|
|
40637
|
+
newObj[monocle] = f(obj[monocle]);
|
|
40638
|
+
return newObj;
|
|
40639
|
+
},
|
|
40640
|
+
del: function (obj, monocle) {
|
|
40641
|
+
var newObj = clone(obj);
|
|
40642
|
+
delete newObj[monocle];
|
|
40643
|
+
return newObj;
|
|
40644
|
+
}
|
|
40645
|
+
};
|
|
40646
|
+
|
|
40647
|
+
// STRING FUNCTIONS
|
|
40648
|
+
|
|
40649
|
+
const str = {
|
|
40650
|
+
get: function (arr, monocle) {
|
|
40651
|
+
return arr[monocle];
|
|
40652
|
+
},
|
|
40653
|
+
set: function (arr, monocle, val) {
|
|
40654
|
+
var newArr = arr.splice();
|
|
40655
|
+
newArr[monocle] = val;
|
|
40656
|
+
return newArr;
|
|
40657
|
+
},
|
|
40658
|
+
mod: function (arr, monocle, f) {
|
|
40659
|
+
var newArr = arr.splice();
|
|
40660
|
+
newArr[monocle] = f(arr[monocle]);
|
|
40661
|
+
return newArr;
|
|
40662
|
+
},
|
|
40663
|
+
del: function (arr, monocle) {
|
|
40664
|
+
var newArr = arr.slice();
|
|
40665
|
+
newArr.splice(monocle);
|
|
40666
|
+
return newArr;
|
|
40667
|
+
}
|
|
40668
|
+
};
|
|
40808
40669
|
|
|
40809
40670
|
/* eslint-disable eqeqeq, @typescript-eslint/no-unused-vars */
|
|
40810
40671
|
/*
|
|
@@ -41707,7 +41568,7 @@ const init = function init(options) {
|
|
|
41707
41568
|
|
|
41708
41569
|
// This file is processed by a Rollup plugin (replace) to inject the production
|
|
41709
41570
|
const libName = "@khanacademy/perseus";
|
|
41710
|
-
const libVersion = "19.1.
|
|
41571
|
+
const libVersion = "19.1.9";
|
|
41711
41572
|
addLibraryVersionToPerseusDebug(libName, libVersion);
|
|
41712
41573
|
|
|
41713
41574
|
const apiVersion = {
|