@office-open/docx 0.5.2 → 0.5.3
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/index.d.mts +1161 -1040
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +595 -179
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
package/dist/index.mjs
CHANGED
|
@@ -4722,155 +4722,6 @@ var init_group_chr = __esmMin((() => {
|
|
|
4722
4722
|
init_math_group_chr_properties();
|
|
4723
4723
|
}));
|
|
4724
4724
|
//#endregion
|
|
4725
|
-
//#region src/file/paragraph/math/math.ts
|
|
4726
|
-
var Math$1;
|
|
4727
|
-
var init_math$1 = __esmMin((() => {
|
|
4728
|
-
init_xml_components();
|
|
4729
|
-
Math$1 = class extends XmlComponent {
|
|
4730
|
-
constructor(options) {
|
|
4731
|
-
super("m:oMath");
|
|
4732
|
-
for (const child of options.children) this.root.push(child);
|
|
4733
|
-
}
|
|
4734
|
-
};
|
|
4735
|
-
}));
|
|
4736
|
-
//#endregion
|
|
4737
|
-
//#region src/file/paragraph/math/math-component.ts
|
|
4738
|
-
var WORKAROUND4;
|
|
4739
|
-
var init_math_component = __esmMin((() => {
|
|
4740
|
-
WORKAROUND4 = "";
|
|
4741
|
-
}));
|
|
4742
|
-
//#endregion
|
|
4743
|
-
//#region src/file/paragraph/math/math-para.ts
|
|
4744
|
-
var createMathParagraphProperties, MathParagraph;
|
|
4745
|
-
var init_math_para = __esmMin((() => {
|
|
4746
|
-
init_xml_components();
|
|
4747
|
-
init_math$1();
|
|
4748
|
-
createMathParagraphProperties = (justification) => new BuilderElement({
|
|
4749
|
-
children: [new BuilderElement({
|
|
4750
|
-
attributes: { val: {
|
|
4751
|
-
key: "m:val",
|
|
4752
|
-
value: justification
|
|
4753
|
-
} },
|
|
4754
|
-
name: "m:jc"
|
|
4755
|
-
})],
|
|
4756
|
-
name: "m:oMathParaPr"
|
|
4757
|
-
});
|
|
4758
|
-
MathParagraph = class extends XmlComponent {
|
|
4759
|
-
constructor(options) {
|
|
4760
|
-
super("m:oMathPara");
|
|
4761
|
-
if (options.justification) this.root.push(createMathParagraphProperties(options.justification));
|
|
4762
|
-
for (const child of options.children) this.root.push(new Math$1(child));
|
|
4763
|
-
}
|
|
4764
|
-
};
|
|
4765
|
-
}));
|
|
4766
|
-
//#endregion
|
|
4767
|
-
//#region src/file/paragraph/math/math-pr.ts
|
|
4768
|
-
var createMathProperties;
|
|
4769
|
-
var init_math_pr = __esmMin((() => {
|
|
4770
|
-
init_xml_components();
|
|
4771
|
-
createMathProperties = (options) => {
|
|
4772
|
-
const children = [];
|
|
4773
|
-
if (options.mathFont !== void 0) children.push(new BuilderElement({
|
|
4774
|
-
attributes: { val: {
|
|
4775
|
-
key: "m:val",
|
|
4776
|
-
value: options.mathFont
|
|
4777
|
-
} },
|
|
4778
|
-
name: "m:mathFont"
|
|
4779
|
-
}));
|
|
4780
|
-
if (options.breakBin !== void 0) children.push(new BuilderElement({
|
|
4781
|
-
attributes: { val: {
|
|
4782
|
-
key: "m:val",
|
|
4783
|
-
value: options.breakBin
|
|
4784
|
-
} },
|
|
4785
|
-
name: "m:brkBin"
|
|
4786
|
-
}));
|
|
4787
|
-
if (options.breakBinSub !== void 0) children.push(new BuilderElement({
|
|
4788
|
-
attributes: { val: {
|
|
4789
|
-
key: "m:val",
|
|
4790
|
-
value: options.breakBinSub
|
|
4791
|
-
} },
|
|
4792
|
-
name: "m:brkBinSub"
|
|
4793
|
-
}));
|
|
4794
|
-
if (options.smallFrac !== void 0) children.push(new OnOffElement("m:smallFrac", options.smallFrac));
|
|
4795
|
-
if (options.displayDefault !== void 0) children.push(new OnOffElement("m:dispDef", options.displayDefault));
|
|
4796
|
-
if (options.leftMargin !== void 0) children.push(new BuilderElement({
|
|
4797
|
-
attributes: { val: {
|
|
4798
|
-
key: "m:val",
|
|
4799
|
-
value: options.leftMargin.toString()
|
|
4800
|
-
} },
|
|
4801
|
-
name: "m:lMargin"
|
|
4802
|
-
}));
|
|
4803
|
-
if (options.rightMargin !== void 0) children.push(new BuilderElement({
|
|
4804
|
-
attributes: { val: {
|
|
4805
|
-
key: "m:val",
|
|
4806
|
-
value: options.rightMargin.toString()
|
|
4807
|
-
} },
|
|
4808
|
-
name: "m:rMargin"
|
|
4809
|
-
}));
|
|
4810
|
-
if (options.defaultJustification !== void 0) children.push(new BuilderElement({
|
|
4811
|
-
attributes: { val: {
|
|
4812
|
-
key: "m:val",
|
|
4813
|
-
value: options.defaultJustification
|
|
4814
|
-
} },
|
|
4815
|
-
name: "m:defJc"
|
|
4816
|
-
}));
|
|
4817
|
-
if (options.preSpacing !== void 0) children.push(new BuilderElement({
|
|
4818
|
-
attributes: { val: {
|
|
4819
|
-
key: "m:val",
|
|
4820
|
-
value: options.preSpacing.toString()
|
|
4821
|
-
} },
|
|
4822
|
-
name: "m:preSp"
|
|
4823
|
-
}));
|
|
4824
|
-
if (options.postSpacing !== void 0) children.push(new BuilderElement({
|
|
4825
|
-
attributes: { val: {
|
|
4826
|
-
key: "m:val",
|
|
4827
|
-
value: options.postSpacing.toString()
|
|
4828
|
-
} },
|
|
4829
|
-
name: "m:postSp"
|
|
4830
|
-
}));
|
|
4831
|
-
if (options.interSpacing !== void 0) children.push(new BuilderElement({
|
|
4832
|
-
attributes: { val: {
|
|
4833
|
-
key: "m:val",
|
|
4834
|
-
value: options.interSpacing.toString()
|
|
4835
|
-
} },
|
|
4836
|
-
name: "m:interSp"
|
|
4837
|
-
}));
|
|
4838
|
-
if (options.intraSpacing !== void 0) children.push(new BuilderElement({
|
|
4839
|
-
attributes: { val: {
|
|
4840
|
-
key: "m:val",
|
|
4841
|
-
value: options.intraSpacing.toString()
|
|
4842
|
-
} },
|
|
4843
|
-
name: "m:intraSp"
|
|
4844
|
-
}));
|
|
4845
|
-
if (options.wrapIndent !== void 0) children.push(new BuilderElement({
|
|
4846
|
-
attributes: { val: {
|
|
4847
|
-
key: "m:val",
|
|
4848
|
-
value: options.wrapIndent.toString()
|
|
4849
|
-
} },
|
|
4850
|
-
name: "m:wrapIndent"
|
|
4851
|
-
}));
|
|
4852
|
-
if (options.wrapRight !== void 0) children.push(new OnOffElement("m:wrapRight", options.wrapRight));
|
|
4853
|
-
if (options.integralLimitLocation !== void 0) children.push(new BuilderElement({
|
|
4854
|
-
attributes: { val: {
|
|
4855
|
-
key: "m:val",
|
|
4856
|
-
value: options.integralLimitLocation
|
|
4857
|
-
} },
|
|
4858
|
-
name: "m:intLim"
|
|
4859
|
-
}));
|
|
4860
|
-
if (options.naryLimitLocation !== void 0) children.push(new BuilderElement({
|
|
4861
|
-
attributes: { val: {
|
|
4862
|
-
key: "m:val",
|
|
4863
|
-
value: options.naryLimitLocation
|
|
4864
|
-
} },
|
|
4865
|
-
name: "m:naryLim"
|
|
4866
|
-
}));
|
|
4867
|
-
return new BuilderElement({
|
|
4868
|
-
children,
|
|
4869
|
-
name: "m:mathPr"
|
|
4870
|
-
});
|
|
4871
|
-
};
|
|
4872
|
-
}));
|
|
4873
|
-
//#endregion
|
|
4874
4725
|
//#region src/file/paragraph/math/math-run-properties.ts
|
|
4875
4726
|
var createMathRunProperties;
|
|
4876
4727
|
var init_math_run_properties = __esmMin((() => {
|
|
@@ -5012,12 +4863,6 @@ var init_math_matrix = __esmMin((() => {
|
|
|
5012
4863
|
};
|
|
5013
4864
|
}));
|
|
5014
4865
|
//#endregion
|
|
5015
|
-
//#region src/file/paragraph/math/matrix/index.ts
|
|
5016
|
-
var init_matrix = __esmMin((() => {
|
|
5017
|
-
init_math_matrix();
|
|
5018
|
-
init_math_matrix_properties();
|
|
5019
|
-
}));
|
|
5020
|
-
//#endregion
|
|
5021
4866
|
//#region src/file/paragraph/math/phant/math-phant-properties.ts
|
|
5022
4867
|
var createMathPhantProperties;
|
|
5023
4868
|
var init_math_phant_properties = __esmMin((() => {
|
|
@@ -5051,12 +4896,6 @@ var init_math_phant = __esmMin((() => {
|
|
|
5051
4896
|
};
|
|
5052
4897
|
}));
|
|
5053
4898
|
//#endregion
|
|
5054
|
-
//#region src/file/paragraph/math/phant/index.ts
|
|
5055
|
-
var init_phant = __esmMin((() => {
|
|
5056
|
-
init_math_phant();
|
|
5057
|
-
init_math_phant_properties();
|
|
5058
|
-
}));
|
|
5059
|
-
//#endregion
|
|
5060
4899
|
//#region src/file/paragraph/math/radical/math-degree.ts
|
|
5061
4900
|
var MathDegree;
|
|
5062
4901
|
var init_math_degree = __esmMin((() => {
|
|
@@ -5114,13 +4953,6 @@ var init_math_radical = __esmMin((() => {
|
|
|
5114
4953
|
};
|
|
5115
4954
|
}));
|
|
5116
4955
|
//#endregion
|
|
5117
|
-
//#region src/file/paragraph/math/radical/index.ts
|
|
5118
|
-
var init_radical = __esmMin((() => {
|
|
5119
|
-
init_math_degree();
|
|
5120
|
-
init_math_radical();
|
|
5121
|
-
init_math_radical_properties();
|
|
5122
|
-
}));
|
|
5123
|
-
//#endregion
|
|
5124
4956
|
//#region src/file/paragraph/math/script/super-script/math-super-script-function-properties.ts
|
|
5125
4957
|
var createMathSuperScriptProperties;
|
|
5126
4958
|
var init_math_super_script_function_properties = __esmMin((() => {
|
|
@@ -5258,6 +5090,583 @@ var init_script = __esmMin((() => {
|
|
|
5258
5090
|
init_pre_sub_super_script();
|
|
5259
5091
|
}));
|
|
5260
5092
|
//#endregion
|
|
5093
|
+
//#region src/file/paragraph/math/math-coerce.ts
|
|
5094
|
+
/** Coerce an array of MathJson values to MathComponent instances. */
|
|
5095
|
+
function coerceArray(items) {
|
|
5096
|
+
if (!items) return [];
|
|
5097
|
+
return items.map((v) => coerceMathJson(v));
|
|
5098
|
+
}
|
|
5099
|
+
/** Coerce bracket shorthand to children array. */
|
|
5100
|
+
function bracketChildren(v) {
|
|
5101
|
+
if (Array.isArray(v)) return coerceArray(v);
|
|
5102
|
+
return coerceArray(v.children);
|
|
5103
|
+
}
|
|
5104
|
+
/**
|
|
5105
|
+
* Coerce a MathJson value to an XmlComponent instance.
|
|
5106
|
+
*
|
|
5107
|
+
* Handles string → MathRun, class instances pass-through, and recursive
|
|
5108
|
+
* conversion of all discriminated JSON object types.
|
|
5109
|
+
*/
|
|
5110
|
+
function coerceMathJson(value) {
|
|
5111
|
+
if (typeof value === "string") return new MathRun(value);
|
|
5112
|
+
if (value instanceof XmlComponent) return value;
|
|
5113
|
+
if ("subSuperScript" in value) {
|
|
5114
|
+
const opts = value.subSuperScript;
|
|
5115
|
+
return new MathSubSuperScript({
|
|
5116
|
+
children: coerceArray(opts.children),
|
|
5117
|
+
subScript: coerceArray(opts.subScript),
|
|
5118
|
+
superScript: coerceArray(opts.superScript)
|
|
5119
|
+
});
|
|
5120
|
+
}
|
|
5121
|
+
if ("superScript" in value) {
|
|
5122
|
+
const opts = value.superScript;
|
|
5123
|
+
return new MathSuperScript({
|
|
5124
|
+
children: coerceArray(opts.children),
|
|
5125
|
+
superScript: coerceArray(opts.superScript)
|
|
5126
|
+
});
|
|
5127
|
+
}
|
|
5128
|
+
if ("subScript" in value) {
|
|
5129
|
+
const opts = value.subScript;
|
|
5130
|
+
return new MathSubScript({
|
|
5131
|
+
children: coerceArray(opts.children),
|
|
5132
|
+
subScript: coerceArray(opts.subScript)
|
|
5133
|
+
});
|
|
5134
|
+
}
|
|
5135
|
+
if ("fraction" in value) {
|
|
5136
|
+
const opts = value.fraction;
|
|
5137
|
+
return new MathFraction({
|
|
5138
|
+
numerator: coerceArray(opts.numerator),
|
|
5139
|
+
denominator: coerceArray(opts.denominator),
|
|
5140
|
+
...opts.fractionType ? { fractionType: opts.fractionType } : {}
|
|
5141
|
+
});
|
|
5142
|
+
}
|
|
5143
|
+
if ("radical" in value) {
|
|
5144
|
+
const opts = value.radical;
|
|
5145
|
+
return new MathRadical({
|
|
5146
|
+
children: coerceArray(opts.children),
|
|
5147
|
+
...opts.degree ? { degree: coerceArray(opts.degree) } : {}
|
|
5148
|
+
});
|
|
5149
|
+
}
|
|
5150
|
+
if ("sum" in value) {
|
|
5151
|
+
const opts = value.sum;
|
|
5152
|
+
return new MathSum({
|
|
5153
|
+
children: coerceArray(opts.children),
|
|
5154
|
+
...opts.subScript ? { subScript: coerceArray(opts.subScript) } : {},
|
|
5155
|
+
...opts.superScript ? { superScript: coerceArray(opts.superScript) } : {}
|
|
5156
|
+
});
|
|
5157
|
+
}
|
|
5158
|
+
if ("integral" in value) {
|
|
5159
|
+
const opts = value.integral;
|
|
5160
|
+
return new MathIntegral({
|
|
5161
|
+
children: coerceArray(opts.children),
|
|
5162
|
+
...opts.subScript ? { subScript: coerceArray(opts.subScript) } : {},
|
|
5163
|
+
...opts.superScript ? { superScript: coerceArray(opts.superScript) } : {}
|
|
5164
|
+
});
|
|
5165
|
+
}
|
|
5166
|
+
if ("limitLower" in value) {
|
|
5167
|
+
const opts = value.limitLower;
|
|
5168
|
+
return new MathLimitLower({
|
|
5169
|
+
children: coerceArray(opts.children),
|
|
5170
|
+
limit: coerceArray(opts.limit),
|
|
5171
|
+
...opts.properties ? { properties: opts.properties } : {}
|
|
5172
|
+
});
|
|
5173
|
+
}
|
|
5174
|
+
if ("limitUpper" in value) {
|
|
5175
|
+
const opts = value.limitUpper;
|
|
5176
|
+
return new MathLimitUpper({
|
|
5177
|
+
children: coerceArray(opts.children),
|
|
5178
|
+
limit: coerceArray(opts.limit),
|
|
5179
|
+
...opts.properties ? { properties: opts.properties } : {}
|
|
5180
|
+
});
|
|
5181
|
+
}
|
|
5182
|
+
if ("function" in value) {
|
|
5183
|
+
const opts = value.function;
|
|
5184
|
+
return new MathFunction({
|
|
5185
|
+
children: coerceArray(opts.children),
|
|
5186
|
+
name: coerceArray(opts.name),
|
|
5187
|
+
...opts.properties ? { properties: opts.properties } : {}
|
|
5188
|
+
});
|
|
5189
|
+
}
|
|
5190
|
+
if ("matrix" in value) {
|
|
5191
|
+
const opts = value.matrix;
|
|
5192
|
+
return new MathMatrix({
|
|
5193
|
+
rows: opts.rows.map((row) => coerceArray(row)),
|
|
5194
|
+
...opts.properties ? { properties: opts.properties } : {}
|
|
5195
|
+
});
|
|
5196
|
+
}
|
|
5197
|
+
if ("roundBrackets" in value) return new MathRoundBrackets({ children: bracketChildren(value.roundBrackets) });
|
|
5198
|
+
if ("curlyBrackets" in value) return new MathCurlyBrackets({ children: bracketChildren(value.curlyBrackets) });
|
|
5199
|
+
if ("angledBrackets" in value) return new MathAngledBrackets({ children: bracketChildren(value.angledBrackets) });
|
|
5200
|
+
if ("squareBrackets" in value) return new MathSquareBrackets({ children: bracketChildren(value.squareBrackets) });
|
|
5201
|
+
if ("borderBox" in value) {
|
|
5202
|
+
const opts = value.borderBox;
|
|
5203
|
+
return new MathBorderBox({
|
|
5204
|
+
children: coerceArray(opts.children),
|
|
5205
|
+
...opts.properties ? { properties: opts.properties } : {}
|
|
5206
|
+
});
|
|
5207
|
+
}
|
|
5208
|
+
if ("box" in value) {
|
|
5209
|
+
const opts = value.box;
|
|
5210
|
+
return new MathBox({
|
|
5211
|
+
children: coerceArray(opts.children),
|
|
5212
|
+
...opts.properties ? { properties: opts.properties } : {}
|
|
5213
|
+
});
|
|
5214
|
+
}
|
|
5215
|
+
if ("groupChr" in value) {
|
|
5216
|
+
const opts = value.groupChr;
|
|
5217
|
+
return new MathGroupChr({
|
|
5218
|
+
children: coerceArray(opts.children),
|
|
5219
|
+
...opts.properties ? { properties: opts.properties } : {}
|
|
5220
|
+
});
|
|
5221
|
+
}
|
|
5222
|
+
if ("phant" in value) {
|
|
5223
|
+
const opts = value.phant;
|
|
5224
|
+
return new MathPhant({
|
|
5225
|
+
children: coerceArray(opts.children),
|
|
5226
|
+
...opts.properties ? { properties: opts.properties } : {}
|
|
5227
|
+
});
|
|
5228
|
+
}
|
|
5229
|
+
if ("eqArr" in value) {
|
|
5230
|
+
const opts = value.eqArr;
|
|
5231
|
+
return new MathEqArr({
|
|
5232
|
+
rows: opts.rows.map((row) => coerceArray(row)),
|
|
5233
|
+
...opts.properties ? { properties: opts.properties } : {}
|
|
5234
|
+
});
|
|
5235
|
+
}
|
|
5236
|
+
if ("accent" in value) {
|
|
5237
|
+
const opts = value.accent;
|
|
5238
|
+
return createMathAccent({
|
|
5239
|
+
children: coerceArray(opts.children),
|
|
5240
|
+
...opts.accentCharacter ? { accentCharacter: opts.accentCharacter } : {}
|
|
5241
|
+
});
|
|
5242
|
+
}
|
|
5243
|
+
if ("bar" in value) {
|
|
5244
|
+
const opts = value.bar;
|
|
5245
|
+
return createMathBar({
|
|
5246
|
+
children: coerceArray(opts.children),
|
|
5247
|
+
type: opts.type
|
|
5248
|
+
});
|
|
5249
|
+
}
|
|
5250
|
+
return new MathRun({
|
|
5251
|
+
text: value.text,
|
|
5252
|
+
properties: value.properties
|
|
5253
|
+
});
|
|
5254
|
+
}
|
|
5255
|
+
var init_math_coerce = __esmMin((() => {
|
|
5256
|
+
init_xml_components();
|
|
5257
|
+
init_math_accent();
|
|
5258
|
+
init_math_bar();
|
|
5259
|
+
init_math_border_box();
|
|
5260
|
+
init_math_box();
|
|
5261
|
+
init_brackets();
|
|
5262
|
+
init_math_eq_arr();
|
|
5263
|
+
init_math_fraction();
|
|
5264
|
+
init_math_function();
|
|
5265
|
+
init_math_group_chr();
|
|
5266
|
+
init_math_run();
|
|
5267
|
+
init_math_matrix();
|
|
5268
|
+
init_n_ary();
|
|
5269
|
+
init_math_phant();
|
|
5270
|
+
init_math_radical();
|
|
5271
|
+
init_script();
|
|
5272
|
+
}));
|
|
5273
|
+
//#endregion
|
|
5274
|
+
//#region src/file/paragraph/math/math.ts
|
|
5275
|
+
var Math$1;
|
|
5276
|
+
var init_math$1 = __esmMin((() => {
|
|
5277
|
+
init_xml_components();
|
|
5278
|
+
Math$1 = class extends XmlComponent {
|
|
5279
|
+
constructor(options) {
|
|
5280
|
+
super("m:oMath");
|
|
5281
|
+
for (const child of options.children) this.root.push(child);
|
|
5282
|
+
}
|
|
5283
|
+
};
|
|
5284
|
+
}));
|
|
5285
|
+
//#endregion
|
|
5286
|
+
//#region src/file/paragraph/math/math-parse.ts
|
|
5287
|
+
/**
|
|
5288
|
+
* OMML XML parser for math components.
|
|
5289
|
+
*
|
|
5290
|
+
* Parses m:oMath Element trees into MathJson format for round-trip support.
|
|
5291
|
+
*
|
|
5292
|
+
* @module
|
|
5293
|
+
*/
|
|
5294
|
+
/**
|
|
5295
|
+
* Parse all math children from an m:oMath (or similar container) element.
|
|
5296
|
+
*
|
|
5297
|
+
* Iterates over child elements and dispatches to specific parsers based on
|
|
5298
|
+
* element name. Unknown elements are returned as-is for passthrough.
|
|
5299
|
+
*/
|
|
5300
|
+
function parseMathChildren(el) {
|
|
5301
|
+
const result = [];
|
|
5302
|
+
for (const child of el.elements ?? []) {
|
|
5303
|
+
const parsed = parseMathElement(child);
|
|
5304
|
+
if (parsed !== void 0) result.push(parsed);
|
|
5305
|
+
}
|
|
5306
|
+
return result;
|
|
5307
|
+
}
|
|
5308
|
+
/**
|
|
5309
|
+
* Parse a single math element into its MathJson representation.
|
|
5310
|
+
*
|
|
5311
|
+
* Returns `undefined` for property elements (m:*Pr) that are not standalone content.
|
|
5312
|
+
*/
|
|
5313
|
+
function parseMathElement(el) {
|
|
5314
|
+
switch (el.name) {
|
|
5315
|
+
case "m:r": return parseMathRun(el);
|
|
5316
|
+
case "m:f": return parseMathFraction(el);
|
|
5317
|
+
case "m:rad": return parseMathRadical(el);
|
|
5318
|
+
case "m:sSup": return parseMathSuperScript(el);
|
|
5319
|
+
case "m:sSub": return parseMathSubScript(el);
|
|
5320
|
+
case "m:sSubSup": return parseMathSubSuperScript(el);
|
|
5321
|
+
case "m:nary": return parseMathNAry(el);
|
|
5322
|
+
case "m:func": return parseMathFunction(el);
|
|
5323
|
+
case "m:d": return parseMathDelimiter(el);
|
|
5324
|
+
case "m:m": return parseMathMatrix(el);
|
|
5325
|
+
case "m:acc": return parseMathAccent(el);
|
|
5326
|
+
case "m:bar": return parseMathBar(el);
|
|
5327
|
+
case "m:borderBox": return { borderBox: { children: parseMathArg(el, "m:e") } };
|
|
5328
|
+
case "m:box": return { box: { children: parseMathArg(el, "m:e") } };
|
|
5329
|
+
case "m:groupChr": return { groupChr: { children: parseMathArg(el, "m:e") } };
|
|
5330
|
+
case "m:phant": return { phant: { children: parseMathArg(el, "m:e") } };
|
|
5331
|
+
case "m:eqArr": return parseMathEqArr(el);
|
|
5332
|
+
case "m:limLow": return parseMathLimitLower(el);
|
|
5333
|
+
case "m:limUpp": return parseMathLimitUpper(el);
|
|
5334
|
+
case "m:rPr":
|
|
5335
|
+
case "m:fPr":
|
|
5336
|
+
case "m:radPr":
|
|
5337
|
+
case "m:sSupPr":
|
|
5338
|
+
case "m:sSubPr":
|
|
5339
|
+
case "m:sSubSupPr":
|
|
5340
|
+
case "m:naryPr":
|
|
5341
|
+
case "m:funcPr":
|
|
5342
|
+
case "m:dPr":
|
|
5343
|
+
case "m:mPr":
|
|
5344
|
+
case "m:accPr":
|
|
5345
|
+
case "m:barPr":
|
|
5346
|
+
case "m:borderBoxPr":
|
|
5347
|
+
case "m:boxPr":
|
|
5348
|
+
case "m:groupChrPr":
|
|
5349
|
+
case "m:phantPr":
|
|
5350
|
+
case "m:eqArrPr":
|
|
5351
|
+
case "m:limLowPr":
|
|
5352
|
+
case "m:limUppPr":
|
|
5353
|
+
case "m:ctrlPr": return;
|
|
5354
|
+
default: return;
|
|
5355
|
+
}
|
|
5356
|
+
}
|
|
5357
|
+
/** Parse m:r → string or { text } */
|
|
5358
|
+
function parseMathRun(el) {
|
|
5359
|
+
const text = textOf(findChild(el, "m:t"));
|
|
5360
|
+
if (text) return text;
|
|
5361
|
+
return text;
|
|
5362
|
+
}
|
|
5363
|
+
/** Parse m:f → { fraction: { numerator, denominator } } */
|
|
5364
|
+
function parseMathFraction(el) {
|
|
5365
|
+
return { fraction: {
|
|
5366
|
+
numerator: parseMathArg(el, "m:num"),
|
|
5367
|
+
denominator: parseMathArg(el, "m:den")
|
|
5368
|
+
} };
|
|
5369
|
+
}
|
|
5370
|
+
/** Parse m:rad → { radical: { children, degree? } } */
|
|
5371
|
+
function parseMathRadical(el) {
|
|
5372
|
+
const degree = parseMathArg(el, "m:deg");
|
|
5373
|
+
return { radical: {
|
|
5374
|
+
children: parseMathArg(el, "m:e"),
|
|
5375
|
+
...degree.length > 0 ? { degree } : {}
|
|
5376
|
+
} };
|
|
5377
|
+
}
|
|
5378
|
+
/** Parse m:sSup → { superScript: { children, superScript } } */
|
|
5379
|
+
function parseMathSuperScript(el) {
|
|
5380
|
+
return { superScript: {
|
|
5381
|
+
children: parseMathArg(el, "m:e"),
|
|
5382
|
+
superScript: parseMathArg(el, "m:sup")
|
|
5383
|
+
} };
|
|
5384
|
+
}
|
|
5385
|
+
/** Parse m:sSub → { subScript: { children, subScript } } */
|
|
5386
|
+
function parseMathSubScript(el) {
|
|
5387
|
+
return { subScript: {
|
|
5388
|
+
children: parseMathArg(el, "m:e"),
|
|
5389
|
+
subScript: parseMathArg(el, "m:sub")
|
|
5390
|
+
} };
|
|
5391
|
+
}
|
|
5392
|
+
/** Parse m:sSubSup → { subSuperScript: { children, subScript, superScript } } */
|
|
5393
|
+
function parseMathSubSuperScript(el) {
|
|
5394
|
+
return { subSuperScript: {
|
|
5395
|
+
children: parseMathArg(el, "m:e"),
|
|
5396
|
+
subScript: parseMathArg(el, "m:sub"),
|
|
5397
|
+
superScript: parseMathArg(el, "m:sup")
|
|
5398
|
+
} };
|
|
5399
|
+
}
|
|
5400
|
+
/**
|
|
5401
|
+
* Parse m:nary → { sum: ... } | { integral: ... }
|
|
5402
|
+
*
|
|
5403
|
+
* Distinguishes between sum and integral based on m:naryPr/m:chr/@m:val:
|
|
5404
|
+
* - "∑" → sum
|
|
5405
|
+
* - "∫" or empty → integral
|
|
5406
|
+
*/
|
|
5407
|
+
function parseMathNAry(el) {
|
|
5408
|
+
const naryPr = findChild(el, "m:naryPr");
|
|
5409
|
+
const chrEl = naryPr ? findChild(naryPr, "m:chr") : void 0;
|
|
5410
|
+
const chrVal = chrEl ? attr(chrEl, "m:val") : void 0;
|
|
5411
|
+
const baseChildren = parseMathArg(el, "m:e");
|
|
5412
|
+
const sub = parseMathArg(el, "m:sub");
|
|
5413
|
+
const sup = parseMathArg(el, "m:sup");
|
|
5414
|
+
const common = {
|
|
5415
|
+
children: baseChildren,
|
|
5416
|
+
...sub.length > 0 ? { subScript: sub } : {},
|
|
5417
|
+
...sup.length > 0 ? { superScript: sup } : {}
|
|
5418
|
+
};
|
|
5419
|
+
if (chrVal === "∑") return { sum: common };
|
|
5420
|
+
return { integral: common };
|
|
5421
|
+
}
|
|
5422
|
+
/** Parse m:func → { function: { name, children } } */
|
|
5423
|
+
function parseMathFunction(el) {
|
|
5424
|
+
return { function: {
|
|
5425
|
+
name: parseMathArg(el, "m:fName"),
|
|
5426
|
+
children: parseMathArg(el, "m:e")
|
|
5427
|
+
} };
|
|
5428
|
+
}
|
|
5429
|
+
/**
|
|
5430
|
+
* Parse m:d → { roundBrackets | squareBrackets | curlyBrackets | angledBrackets }
|
|
5431
|
+
*
|
|
5432
|
+
* Determines bracket type from m:dPr/m:begChr/@m:val:
|
|
5433
|
+
* - "(" → roundBrackets
|
|
5434
|
+
* - "[" → squareBrackets
|
|
5435
|
+
* - "{" → curlyBrackets
|
|
5436
|
+
* - default → roundBrackets (parentheses are the default delimiter)
|
|
5437
|
+
*/
|
|
5438
|
+
function parseMathDelimiter(el) {
|
|
5439
|
+
const dPr = findChild(el, "m:dPr");
|
|
5440
|
+
const begChrEl = dPr ? findChild(dPr, "m:begChr") : void 0;
|
|
5441
|
+
const begChr = begChrEl ? attr(begChrEl, "m:val") : "(";
|
|
5442
|
+
const mathChildren = parseMathArg(el, "m:e");
|
|
5443
|
+
switch (begChr) {
|
|
5444
|
+
case "[": return { squareBrackets: mathChildren };
|
|
5445
|
+
case "{": return { curlyBrackets: mathChildren };
|
|
5446
|
+
case "<":
|
|
5447
|
+
case "⟨": return { angledBrackets: mathChildren };
|
|
5448
|
+
default: return { roundBrackets: mathChildren };
|
|
5449
|
+
}
|
|
5450
|
+
}
|
|
5451
|
+
/** Parse m:m → { matrix: { rows } } */
|
|
5452
|
+
function parseMathMatrix(el) {
|
|
5453
|
+
const rows = [];
|
|
5454
|
+
for (const mr of children(el, "m:mr")) rows.push(parseMathArg(mr, "m:e"));
|
|
5455
|
+
return { matrix: { rows } };
|
|
5456
|
+
}
|
|
5457
|
+
/**
|
|
5458
|
+
* Parse m:acc → { accent: { children, accentCharacter? } }
|
|
5459
|
+
*
|
|
5460
|
+
* Reads accent character from m:accPr/m:chr/@m:val.
|
|
5461
|
+
*/
|
|
5462
|
+
function parseMathAccent(el) {
|
|
5463
|
+
const accPr = findChild(el, "m:accPr");
|
|
5464
|
+
const chrEl = accPr ? findChild(accPr, "m:chr") : void 0;
|
|
5465
|
+
const accentChar = chrEl ? attr(chrEl, "m:val") : void 0;
|
|
5466
|
+
return { accent: {
|
|
5467
|
+
children: parseMathArg(el, "m:e"),
|
|
5468
|
+
...accentChar ? { accentCharacter: accentChar } : {}
|
|
5469
|
+
} };
|
|
5470
|
+
}
|
|
5471
|
+
/** Parse m:bar → { bar: { children, type } } */
|
|
5472
|
+
function parseMathBar(el) {
|
|
5473
|
+
const barPr = findChild(el, "m:barPr");
|
|
5474
|
+
const posEl = barPr ? findChild(barPr, "m:pos") : void 0;
|
|
5475
|
+
const pos = posEl ? attr(posEl, "m:val") : "top";
|
|
5476
|
+
return { bar: {
|
|
5477
|
+
children: parseMathArg(el, "m:e"),
|
|
5478
|
+
type: pos ?? "top"
|
|
5479
|
+
} };
|
|
5480
|
+
}
|
|
5481
|
+
/** Parse m:eqArr → { eqArr: { rows } } */
|
|
5482
|
+
function parseMathEqArr(el) {
|
|
5483
|
+
const rows = [];
|
|
5484
|
+
for (const e of children(el, "m:e")) rows.push(parseMathChildren(e));
|
|
5485
|
+
return { eqArr: { rows } };
|
|
5486
|
+
}
|
|
5487
|
+
/** Parse m:limLow → { limitLower: { children, limit } } */
|
|
5488
|
+
function parseMathLimitLower(el) {
|
|
5489
|
+
return { limitLower: {
|
|
5490
|
+
children: parseMathArg(el, "m:e"),
|
|
5491
|
+
limit: parseMathArg(el, "m:lim")
|
|
5492
|
+
} };
|
|
5493
|
+
}
|
|
5494
|
+
/** Parse m:limUpp → { limitUpper: { children, limit } } */
|
|
5495
|
+
function parseMathLimitUpper(el) {
|
|
5496
|
+
return { limitUpper: {
|
|
5497
|
+
children: parseMathArg(el, "m:e"),
|
|
5498
|
+
limit: parseMathArg(el, "m:lim")
|
|
5499
|
+
} };
|
|
5500
|
+
}
|
|
5501
|
+
/**
|
|
5502
|
+
* Parse a container element's math children.
|
|
5503
|
+
*
|
|
5504
|
+
* Used for m:e, m:num, m:den, m:sub, m:sup, m:lim, m:fName, m:deg
|
|
5505
|
+
* — all of which are CT_OMathArg containers that hold math child elements.
|
|
5506
|
+
*/
|
|
5507
|
+
function parseMathArg(parent, childName) {
|
|
5508
|
+
const container = findChild(parent, childName);
|
|
5509
|
+
if (!container) return [];
|
|
5510
|
+
return parseMathChildren(container);
|
|
5511
|
+
}
|
|
5512
|
+
var init_math_parse = __esmMin((() => {}));
|
|
5513
|
+
//#endregion
|
|
5514
|
+
//#region src/file/paragraph/math/math-component.ts
|
|
5515
|
+
var WORKAROUND4;
|
|
5516
|
+
var init_math_component = __esmMin((() => {
|
|
5517
|
+
WORKAROUND4 = "";
|
|
5518
|
+
}));
|
|
5519
|
+
//#endregion
|
|
5520
|
+
//#region src/file/paragraph/math/math-para.ts
|
|
5521
|
+
var createMathParagraphProperties, MathParagraph;
|
|
5522
|
+
var init_math_para = __esmMin((() => {
|
|
5523
|
+
init_xml_components();
|
|
5524
|
+
init_math$1();
|
|
5525
|
+
createMathParagraphProperties = (justification) => new BuilderElement({
|
|
5526
|
+
children: [new BuilderElement({
|
|
5527
|
+
attributes: { val: {
|
|
5528
|
+
key: "m:val",
|
|
5529
|
+
value: justification
|
|
5530
|
+
} },
|
|
5531
|
+
name: "m:jc"
|
|
5532
|
+
})],
|
|
5533
|
+
name: "m:oMathParaPr"
|
|
5534
|
+
});
|
|
5535
|
+
MathParagraph = class extends XmlComponent {
|
|
5536
|
+
constructor(options) {
|
|
5537
|
+
super("m:oMathPara");
|
|
5538
|
+
if (options.justification) this.root.push(createMathParagraphProperties(options.justification));
|
|
5539
|
+
for (const child of options.children) this.root.push(new Math$1(child));
|
|
5540
|
+
}
|
|
5541
|
+
};
|
|
5542
|
+
}));
|
|
5543
|
+
//#endregion
|
|
5544
|
+
//#region src/file/paragraph/math/math-pr.ts
|
|
5545
|
+
var createMathProperties;
|
|
5546
|
+
var init_math_pr = __esmMin((() => {
|
|
5547
|
+
init_xml_components();
|
|
5548
|
+
createMathProperties = (options) => {
|
|
5549
|
+
const children = [];
|
|
5550
|
+
if (options.mathFont !== void 0) children.push(new BuilderElement({
|
|
5551
|
+
attributes: { val: {
|
|
5552
|
+
key: "m:val",
|
|
5553
|
+
value: options.mathFont
|
|
5554
|
+
} },
|
|
5555
|
+
name: "m:mathFont"
|
|
5556
|
+
}));
|
|
5557
|
+
if (options.breakBin !== void 0) children.push(new BuilderElement({
|
|
5558
|
+
attributes: { val: {
|
|
5559
|
+
key: "m:val",
|
|
5560
|
+
value: options.breakBin
|
|
5561
|
+
} },
|
|
5562
|
+
name: "m:brkBin"
|
|
5563
|
+
}));
|
|
5564
|
+
if (options.breakBinSub !== void 0) children.push(new BuilderElement({
|
|
5565
|
+
attributes: { val: {
|
|
5566
|
+
key: "m:val",
|
|
5567
|
+
value: options.breakBinSub
|
|
5568
|
+
} },
|
|
5569
|
+
name: "m:brkBinSub"
|
|
5570
|
+
}));
|
|
5571
|
+
if (options.smallFrac !== void 0) children.push(new OnOffElement("m:smallFrac", options.smallFrac));
|
|
5572
|
+
if (options.displayDefault !== void 0) children.push(new OnOffElement("m:dispDef", options.displayDefault));
|
|
5573
|
+
if (options.leftMargin !== void 0) children.push(new BuilderElement({
|
|
5574
|
+
attributes: { val: {
|
|
5575
|
+
key: "m:val",
|
|
5576
|
+
value: options.leftMargin.toString()
|
|
5577
|
+
} },
|
|
5578
|
+
name: "m:lMargin"
|
|
5579
|
+
}));
|
|
5580
|
+
if (options.rightMargin !== void 0) children.push(new BuilderElement({
|
|
5581
|
+
attributes: { val: {
|
|
5582
|
+
key: "m:val",
|
|
5583
|
+
value: options.rightMargin.toString()
|
|
5584
|
+
} },
|
|
5585
|
+
name: "m:rMargin"
|
|
5586
|
+
}));
|
|
5587
|
+
if (options.defaultJustification !== void 0) children.push(new BuilderElement({
|
|
5588
|
+
attributes: { val: {
|
|
5589
|
+
key: "m:val",
|
|
5590
|
+
value: options.defaultJustification
|
|
5591
|
+
} },
|
|
5592
|
+
name: "m:defJc"
|
|
5593
|
+
}));
|
|
5594
|
+
if (options.preSpacing !== void 0) children.push(new BuilderElement({
|
|
5595
|
+
attributes: { val: {
|
|
5596
|
+
key: "m:val",
|
|
5597
|
+
value: options.preSpacing.toString()
|
|
5598
|
+
} },
|
|
5599
|
+
name: "m:preSp"
|
|
5600
|
+
}));
|
|
5601
|
+
if (options.postSpacing !== void 0) children.push(new BuilderElement({
|
|
5602
|
+
attributes: { val: {
|
|
5603
|
+
key: "m:val",
|
|
5604
|
+
value: options.postSpacing.toString()
|
|
5605
|
+
} },
|
|
5606
|
+
name: "m:postSp"
|
|
5607
|
+
}));
|
|
5608
|
+
if (options.interSpacing !== void 0) children.push(new BuilderElement({
|
|
5609
|
+
attributes: { val: {
|
|
5610
|
+
key: "m:val",
|
|
5611
|
+
value: options.interSpacing.toString()
|
|
5612
|
+
} },
|
|
5613
|
+
name: "m:interSp"
|
|
5614
|
+
}));
|
|
5615
|
+
if (options.intraSpacing !== void 0) children.push(new BuilderElement({
|
|
5616
|
+
attributes: { val: {
|
|
5617
|
+
key: "m:val",
|
|
5618
|
+
value: options.intraSpacing.toString()
|
|
5619
|
+
} },
|
|
5620
|
+
name: "m:intraSp"
|
|
5621
|
+
}));
|
|
5622
|
+
if (options.wrapIndent !== void 0) children.push(new BuilderElement({
|
|
5623
|
+
attributes: { val: {
|
|
5624
|
+
key: "m:val",
|
|
5625
|
+
value: options.wrapIndent.toString()
|
|
5626
|
+
} },
|
|
5627
|
+
name: "m:wrapIndent"
|
|
5628
|
+
}));
|
|
5629
|
+
if (options.wrapRight !== void 0) children.push(new OnOffElement("m:wrapRight", options.wrapRight));
|
|
5630
|
+
if (options.integralLimitLocation !== void 0) children.push(new BuilderElement({
|
|
5631
|
+
attributes: { val: {
|
|
5632
|
+
key: "m:val",
|
|
5633
|
+
value: options.integralLimitLocation
|
|
5634
|
+
} },
|
|
5635
|
+
name: "m:intLim"
|
|
5636
|
+
}));
|
|
5637
|
+
if (options.naryLimitLocation !== void 0) children.push(new BuilderElement({
|
|
5638
|
+
attributes: { val: {
|
|
5639
|
+
key: "m:val",
|
|
5640
|
+
value: options.naryLimitLocation
|
|
5641
|
+
} },
|
|
5642
|
+
name: "m:naryLim"
|
|
5643
|
+
}));
|
|
5644
|
+
return new BuilderElement({
|
|
5645
|
+
children,
|
|
5646
|
+
name: "m:mathPr"
|
|
5647
|
+
});
|
|
5648
|
+
};
|
|
5649
|
+
}));
|
|
5650
|
+
//#endregion
|
|
5651
|
+
//#region src/file/paragraph/math/matrix/index.ts
|
|
5652
|
+
var init_matrix = __esmMin((() => {
|
|
5653
|
+
init_math_matrix();
|
|
5654
|
+
init_math_matrix_properties();
|
|
5655
|
+
}));
|
|
5656
|
+
//#endregion
|
|
5657
|
+
//#region src/file/paragraph/math/phant/index.ts
|
|
5658
|
+
var init_phant = __esmMin((() => {
|
|
5659
|
+
init_math_phant();
|
|
5660
|
+
init_math_phant_properties();
|
|
5661
|
+
}));
|
|
5662
|
+
//#endregion
|
|
5663
|
+
//#region src/file/paragraph/math/radical/index.ts
|
|
5664
|
+
var init_radical = __esmMin((() => {
|
|
5665
|
+
init_math_degree();
|
|
5666
|
+
init_math_radical();
|
|
5667
|
+
init_math_radical_properties();
|
|
5668
|
+
}));
|
|
5669
|
+
//#endregion
|
|
5261
5670
|
//#region src/file/paragraph/math/index.ts
|
|
5262
5671
|
var init_math = __esmMin((() => {
|
|
5263
5672
|
init_accent();
|
|
@@ -5269,7 +5678,9 @@ var init_math = __esmMin((() => {
|
|
|
5269
5678
|
init_fraction();
|
|
5270
5679
|
init_function();
|
|
5271
5680
|
init_group_chr();
|
|
5681
|
+
init_math_coerce();
|
|
5272
5682
|
init_math$1();
|
|
5683
|
+
init_math_parse();
|
|
5273
5684
|
init_math_component();
|
|
5274
5685
|
init_math_control_properties();
|
|
5275
5686
|
init_math_para();
|
|
@@ -6015,7 +6426,7 @@ var init_paragraph$1 = __esmMin((() => {
|
|
|
6015
6426
|
init_break();
|
|
6016
6427
|
init_links();
|
|
6017
6428
|
init_math();
|
|
6018
|
-
|
|
6429
|
+
init_math_coerce();
|
|
6019
6430
|
init_reference_run$1();
|
|
6020
6431
|
init_reference_run();
|
|
6021
6432
|
init_properties();
|
|
@@ -6097,12 +6508,7 @@ var init_paragraph$1 = __esmMin((() => {
|
|
|
6097
6508
|
}
|
|
6098
6509
|
continue;
|
|
6099
6510
|
} else if ("math" in rawChild && typeof rawChild === "object" && rawChild !== null && typeof rawChild.math === "object" && rawChild.math !== null) {
|
|
6100
|
-
const coercedChildren = rawChild.math.children?.map(
|
|
6101
|
-
if (c instanceof BaseXmlComponent) return c;
|
|
6102
|
-
if (typeof c === "string") return new MathRun(c);
|
|
6103
|
-
if (typeof c === "object" && c !== null) return new MathRun(c);
|
|
6104
|
-
return c;
|
|
6105
|
-
});
|
|
6511
|
+
const coercedChildren = rawChild.math.children?.map(coerceMathJson);
|
|
6106
6512
|
child = new Math$1(coercedChildren ? { children: coercedChildren } : { children: [] });
|
|
6107
6513
|
} else if ("symbolRun" in rawChild) child = new SymbolRun(rawChild.symbolRun);
|
|
6108
6514
|
else if ("footnoteReference" in rawChild) child = new FootnoteReferenceRun(rawChild.footnoteReference);
|
|
@@ -14303,6 +14709,7 @@ var file_exports = /* @__PURE__ */ __exportAll({
|
|
|
14303
14709
|
buildDocumentAttributes: () => buildDocumentAttributes,
|
|
14304
14710
|
buildRunProperties: () => buildRunProperties,
|
|
14305
14711
|
chartAttr: () => chartAttr,
|
|
14712
|
+
coerceMathJson: () => coerceMathJson,
|
|
14306
14713
|
coerceSectionChild: () => coerceSectionChild,
|
|
14307
14714
|
convertToXmlComponent: () => convertToXmlComponent,
|
|
14308
14715
|
createAlignment: () => createAlignment,
|
|
@@ -14381,6 +14788,7 @@ var file_exports = /* @__PURE__ */ __exportAll({
|
|
|
14381
14788
|
getColorXml: () => getColorXml,
|
|
14382
14789
|
getLayoutXml: () => getLayoutXml,
|
|
14383
14790
|
getStyleXml: () => getStyleXml,
|
|
14791
|
+
parseMathChildren: () => parseMathChildren,
|
|
14384
14792
|
sectionMarginDefaults: () => sectionMarginDefaults,
|
|
14385
14793
|
sectionPageSizeDefaults: () => sectionPageSizeDefaults,
|
|
14386
14794
|
wrapEl: () => wrapEl
|
|
@@ -17781,7 +18189,7 @@ var Compiler = class {
|
|
|
17781
18189
|
data: (() => {
|
|
17782
18190
|
let xmlData = documentMediaDatas.length > 0 ? replaceImagePlaceholders(documentXmlData, documentMediaDatas, documentRelationshipCount, "rId") : documentXmlData;
|
|
17783
18191
|
if (hasPlaceholders(xmlData)) {
|
|
17784
|
-
xmlData = replaceChartPlaceholders(xmlData, file.Charts.Array.map((c) => c.key), documentRelationshipCount, "rId");
|
|
18192
|
+
xmlData = replaceChartPlaceholders(xmlData, file.Charts.Array.map((c) => c.key), documentRelationshipCount + documentMediaDatas.length, "rId");
|
|
17785
18193
|
const smartArtDataOffset = documentRelationshipCount + documentMediaDatas.length + file.Charts.Array.length;
|
|
17786
18194
|
xmlData = replaceSmartArtPlaceholders(xmlData, file.SmartArts.Array.map((s) => s.key), smartArtDataOffset, "rId");
|
|
17787
18195
|
}
|
|
@@ -19168,7 +19576,7 @@ function imageTypeFromPath(path) {
|
|
|
19168
19576
|
}
|
|
19169
19577
|
}
|
|
19170
19578
|
/**
|
|
19171
|
-
* Parse a w:drawing element and return
|
|
19579
|
+
* Parse a w:drawing element and return image data wrapped in { image: ... }.
|
|
19172
19580
|
*/
|
|
19173
19581
|
function parseImageRun(el, ctx) {
|
|
19174
19582
|
const inline = findDeep(el, "wp:inline")[0];
|
|
@@ -19237,7 +19645,7 @@ function parseImageRun(el, ctx) {
|
|
|
19237
19645
|
if (attrBool(anchor, "behindDoc")) floating.behindDocument = true;
|
|
19238
19646
|
if (Object.keys(floating).length > 0) imageOpts.floating = floating;
|
|
19239
19647
|
}
|
|
19240
|
-
return imageOpts;
|
|
19648
|
+
return { image: imageOpts };
|
|
19241
19649
|
}
|
|
19242
19650
|
function getDrawingExtent(el) {
|
|
19243
19651
|
const inline = findDeep(el, "wp:inline")[0];
|
|
@@ -19746,6 +20154,7 @@ function parsedRunToOptions(parsed) {
|
|
|
19746
20154
|
* @module
|
|
19747
20155
|
*/
|
|
19748
20156
|
init_style();
|
|
20157
|
+
init_math_parse();
|
|
19749
20158
|
const HEADING_MAP = {
|
|
19750
20159
|
Heading1: HeadingLevel.HEADING_1,
|
|
19751
20160
|
Heading2: HeadingLevel.HEADING_2,
|
|
@@ -19973,6 +20382,11 @@ function parseParagraph(el, ctx) {
|
|
|
19973
20382
|
if (id !== void 0) childList.push({ commentReference: id });
|
|
19974
20383
|
break;
|
|
19975
20384
|
}
|
|
20385
|
+
case "m:oMath": {
|
|
20386
|
+
const mathChildren = parseMathChildren(child);
|
|
20387
|
+
childList.push({ math: { children: mathChildren } });
|
|
20388
|
+
break;
|
|
20389
|
+
}
|
|
19976
20390
|
default:
|
|
19977
20391
|
if (child.name && child.elements && child.elements.length > 0) childList.push(new RawPassthrough(child));
|
|
19978
20392
|
break;
|
|
@@ -21246,6 +21660,7 @@ var src_exports = /* @__PURE__ */ __exportAll({
|
|
|
21246
21660
|
buildDocumentAttributes: () => buildDocumentAttributes,
|
|
21247
21661
|
buildRunProperties: () => buildRunProperties,
|
|
21248
21662
|
chartAttr: () => chartAttr,
|
|
21663
|
+
coerceMathJson: () => coerceMathJson,
|
|
21249
21664
|
coerceSectionChild: () => coerceSectionChild,
|
|
21250
21665
|
concreteNumUniqueNumericIdGen: () => concreteNumUniqueNumericIdGen,
|
|
21251
21666
|
convertInchesToTwip: () => convertInchesToTwip,
|
|
@@ -21332,6 +21747,7 @@ var src_exports = /* @__PURE__ */ __exportAll({
|
|
|
21332
21747
|
parseArchive: () => parseArchive,
|
|
21333
21748
|
parseDocument: () => parseDocument,
|
|
21334
21749
|
parseDocx: () => parseDocx,
|
|
21750
|
+
parseMathChildren: () => parseMathChildren,
|
|
21335
21751
|
patchDetector: () => patchDetector,
|
|
21336
21752
|
patchDocument: () => patchDocument,
|
|
21337
21753
|
sectionMarginDefaults: () => sectionMarginDefaults,
|
|
@@ -21344,6 +21760,6 @@ var src_exports = /* @__PURE__ */ __exportAll({
|
|
|
21344
21760
|
__reExport(src_exports, file_exports);
|
|
21345
21761
|
__reExport(src_exports, util_exports);
|
|
21346
21762
|
//#endregion
|
|
21347
|
-
export { AbstractNumbering, AlignmentType, AltChunk, AltChunkCollection, AnnotationReference, Attributes, BaseXmlComponent, Bdo, Bibliography, Body, Bookmark, BookmarkEnd, BookmarkStart, Border, BorderStyle, BuilderElement, COLOR_CATEGORIES, CarriageReturn, CellMerge, CellMergeAttributes, CharacterSet, ChartCollection, ChartRun, ChartSpace, CheckBox, CheckBoxSymbolElement, CheckBoxUtil, Column, ColumnBreak, Comment, CommentRangeEnd, CommentRangeStart, CommentReference, Comments, ConcreteHyperlink, ConcreteNumbering, ContinuationSeparator, DEFAULT_DRAWING_XML, DayLong, DayShort, DeletedTableCell, DeletedTableRow, DeletedTextRun, Dir, File as Document, File, DocumentAttributeNamespaces, DocumentBackground, DocumentBackgroundAttributes, DocumentDefaults, DocumentGridType, Drawing, DropCapType, EMPTY_OBJECT, EditGroupType, EmphasisMarkType, EmptyElement, EndnoteIdReference, EndnoteReference, EndnoteReferenceRun, EndnoteReferenceRunAttributes, Endnotes, ExternalHyperlink, FootNoteReferenceRunAttributes, FootNotes, Footer, FooterWrapper, FootnoteReference, FootnoteReferenceElement, FootnoteReferenceRun, FormFieldTextType, FractionType, FrameAnchorType, FrameWrap, GridSpan, Header, HeaderFooterReferenceType, HeaderFooterType, HeaderWrapper, HeadingLevel, HeightRule, HighlightColor, HorizontalPositionAlign, HorizontalPositionRelativeFrom, HpsMeasureElement, HyperlinkType, IgnoreIfEmptyXmlComponent, ImageRun, ImportedRootElementAttributes, ImportedXmlComponent, InitializableXmlComponent, InsertedTableCell, InsertedTableRow, InsertedTextRun, InternalHyperlink, LAYOUT_CATEGORIES, LastRenderedPageBreak, LeaderType, Level, LevelBase, LevelForOverride, LevelFormat, LevelOverride, LevelSuffix, LineNumberRestartFormat, LineRuleType, Math$1 as Math, MathAngledBrackets, MathBorderBox, MathBox, MathCurlyBrackets, MathDegree, MathDenominator, MathEqArr, MathFraction, MathFunction, MathFunctionName, MathGroupChr, MathIntegral, MathLimit, MathLimitLower, MathLimitUpper, MathMatrix, MathNumerator, MathParagraph, MathPhant, MathPreSubSuperScript, MathRadical, MathRadicalProperties, MathRoundBrackets, MathRun, MathSquareBrackets, MathSubScript, MathSubSuperScript, MathSum, MathSuperScript, Media, MonthLong, MonthShort, MoveFromRangeEnd, MoveFromRangeStart, MoveToRangeEnd, MoveToRangeStart, MovedFromTextRun, MovedToTextRun, NextAttributeComponent, NoBreakHyphen, NumberFormat, NumberProperties, NumberValueElement, NumberedItemReference, NumberedItemReferenceFormat, Numbering, OnOffElement, OverlapType, Packer, PageBorderDisplay, PageBorderOffsetFrom, PageBorderZOrder, PageBorders, PageBreak, PageBreakBefore, PageNumber, PageNumberElement, PageNumberSeparator, PageOrientation, PageReference, PageTextDirection, PageTextDirectionType, Paragraph, ParagraphProperties, ParagraphPropertiesChange, ParagraphPropertiesDefaults, ParagraphRunProperties, PatchType, PermEnd, PermStart, PositionalTab, PositionalTabAlignment, PositionalTabLeader, PositionalTabRelativeTo, PrettifyType, RelativeHorizontalPosition, RelativeVerticalPosition, RubyAlign, Run, RunProperties, RunPropertiesChange, RunPropertiesDefaults, STYLE_CATEGORIES, SdtDateMappingType, SdtLock, SectionProperties, SectionPropertiesChange, SectionType, Separator, SequentialIdentifier, ShadingType, SimpleField, SimpleMailMergeField, SmartArtCollection, SmartArtRun, SoftHyphen, SpaceType, StringContainer, StringEnumValueElement, StringValueElement, StructuredDocumentTagBlock, StructuredDocumentTagCell, StructuredDocumentTagContent, StructuredDocumentTagProperties, StructuredDocumentTagRow, StructuredDocumentTagRun, StyleForCharacter, StyleForParagraph, StyleLevel, Styles, SubDoc, SubDocCollection, SymbolRun, TDirection, Tab, TabStopPosition, TabStopType, Table, TableAnchorType, TableBorders, TableCell, TableCellBorders, TableLayoutType, TableOfContents, TableProperties, TablePropertyExceptions, TableRow, TableRowProperties, TableRowPropertiesChange, TextAlignmentType, TextBodyWrappingType, TextDirection, TextEffect, TextHorzOverflowType, TextRun, TextVertOverflowType, TextVerticalType, TextWrappingSide, TextWrappingType, Textbox, TextboxTightWrapType, ThematicBreak, UnderlineType, VerticalAlign, VerticalAlignSection, VerticalAlignTable, VerticalAnchor, VerticalMerge, VerticalMergeRevisionType, VerticalMergeType, VerticalPositionAlign, VerticalPositionRelativeFrom, WORKAROUND2, WORKAROUND4, WidthType, WpgGroupRun, WpsShapeRun, XmlAttributeComponent, XmlComponent, YearLong, YearShort, abstractNumUniqueNumericIdGen, bookmarkUniqueNumericIdGen, buildDocumentAttributes, buildRunProperties, chartAttr, coerceSectionChild, concreteNumUniqueNumericIdGen, convertInchesToTwip, convertMillimetersToTwip, convertToXmlComponent, createAlignment, createBodyProperties, createBorderElement, createBreak, createCnfStyle, createColumns, createDataModel, createDivId, createDocumentGrid, createDotEmphasisMark, createEmphasisMark, createFormFieldData, createFrameProperties, createHeaderFooterReference, createHorizontalPosition, createIndent, createLineNumberType, createMathAccent, createMathAccentCharacter, createMathAccentProperties, createMathBar, createMathBarProperties, createMathBase, createMathBorderBoxProperties, createMathBoxProperties, createMathControlProperties, createMathEqArrProperties, createMathFractionProperties, createMathFunctionProperties, createMathGroupChrProperties, createMathLimitLocation, createMathLimitLowProperties, createMathLimitUpperProperties, createMathMatrixProperties, createMathNAryProperties, createMathPhantProperties, createMathPreSubSuperScriptProperties, createMathProperties, createMathRunProperties, createMathSubScriptElement, createMathSubScriptProperties, createMathSubSuperScriptProperties, createMathSuperScriptElement, createMathSuperScriptProperties, createOutlineLevel, createPageMargin, createPageNumberType, createPageSize, createParagraphStyle, createRuby, createRunFonts, createSectionType, createShading, createSimplePos, createSpacing, createStringElement, createTabStop, createTabStopItem, createTableFloatProperties, createTableLayout, createTableLook, createTableOverlap, createTableRowHeight, createTableWidthElement, createTransformation, createUnderline, createVerticalAlign, createVerticalPosition, createWrapNone, createWrapSquare, createWrapThrough, createWrapTight, createWrapTopAndBottom, docPropertiesUniqueNumericIdGen, getColorXml, getLayoutXml, getStyleXml, hashedId, parseArchive, parseDocument, parseDocx, patchDetector, patchDocument, sectionMarginDefaults, sectionPageSizeDefaults, uniqueId, uniqueNumericIdCreator, uniqueUuid, wrapEl };
|
|
21763
|
+
export { AbstractNumbering, AlignmentType, AltChunk, AltChunkCollection, AnnotationReference, Attributes, BaseXmlComponent, Bdo, Bibliography, Body, Bookmark, BookmarkEnd, BookmarkStart, Border, BorderStyle, BuilderElement, COLOR_CATEGORIES, CarriageReturn, CellMerge, CellMergeAttributes, CharacterSet, ChartCollection, ChartRun, ChartSpace, CheckBox, CheckBoxSymbolElement, CheckBoxUtil, Column, ColumnBreak, Comment, CommentRangeEnd, CommentRangeStart, CommentReference, Comments, ConcreteHyperlink, ConcreteNumbering, ContinuationSeparator, DEFAULT_DRAWING_XML, DayLong, DayShort, DeletedTableCell, DeletedTableRow, DeletedTextRun, Dir, File as Document, File, DocumentAttributeNamespaces, DocumentBackground, DocumentBackgroundAttributes, DocumentDefaults, DocumentGridType, Drawing, DropCapType, EMPTY_OBJECT, EditGroupType, EmphasisMarkType, EmptyElement, EndnoteIdReference, EndnoteReference, EndnoteReferenceRun, EndnoteReferenceRunAttributes, Endnotes, ExternalHyperlink, FootNoteReferenceRunAttributes, FootNotes, Footer, FooterWrapper, FootnoteReference, FootnoteReferenceElement, FootnoteReferenceRun, FormFieldTextType, FractionType, FrameAnchorType, FrameWrap, GridSpan, Header, HeaderFooterReferenceType, HeaderFooterType, HeaderWrapper, HeadingLevel, HeightRule, HighlightColor, HorizontalPositionAlign, HorizontalPositionRelativeFrom, HpsMeasureElement, HyperlinkType, IgnoreIfEmptyXmlComponent, ImageRun, ImportedRootElementAttributes, ImportedXmlComponent, InitializableXmlComponent, InsertedTableCell, InsertedTableRow, InsertedTextRun, InternalHyperlink, LAYOUT_CATEGORIES, LastRenderedPageBreak, LeaderType, Level, LevelBase, LevelForOverride, LevelFormat, LevelOverride, LevelSuffix, LineNumberRestartFormat, LineRuleType, Math$1 as Math, MathAngledBrackets, MathBorderBox, MathBox, MathCurlyBrackets, MathDegree, MathDenominator, MathEqArr, MathFraction, MathFunction, MathFunctionName, MathGroupChr, MathIntegral, MathLimit, MathLimitLower, MathLimitUpper, MathMatrix, MathNumerator, MathParagraph, MathPhant, MathPreSubSuperScript, MathRadical, MathRadicalProperties, MathRoundBrackets, MathRun, MathSquareBrackets, MathSubScript, MathSubSuperScript, MathSum, MathSuperScript, Media, MonthLong, MonthShort, MoveFromRangeEnd, MoveFromRangeStart, MoveToRangeEnd, MoveToRangeStart, MovedFromTextRun, MovedToTextRun, NextAttributeComponent, NoBreakHyphen, NumberFormat, NumberProperties, NumberValueElement, NumberedItemReference, NumberedItemReferenceFormat, Numbering, OnOffElement, OverlapType, Packer, PageBorderDisplay, PageBorderOffsetFrom, PageBorderZOrder, PageBorders, PageBreak, PageBreakBefore, PageNumber, PageNumberElement, PageNumberSeparator, PageOrientation, PageReference, PageTextDirection, PageTextDirectionType, Paragraph, ParagraphProperties, ParagraphPropertiesChange, ParagraphPropertiesDefaults, ParagraphRunProperties, PatchType, PermEnd, PermStart, PositionalTab, PositionalTabAlignment, PositionalTabLeader, PositionalTabRelativeTo, PrettifyType, RelativeHorizontalPosition, RelativeVerticalPosition, RubyAlign, Run, RunProperties, RunPropertiesChange, RunPropertiesDefaults, STYLE_CATEGORIES, SdtDateMappingType, SdtLock, SectionProperties, SectionPropertiesChange, SectionType, Separator, SequentialIdentifier, ShadingType, SimpleField, SimpleMailMergeField, SmartArtCollection, SmartArtRun, SoftHyphen, SpaceType, StringContainer, StringEnumValueElement, StringValueElement, StructuredDocumentTagBlock, StructuredDocumentTagCell, StructuredDocumentTagContent, StructuredDocumentTagProperties, StructuredDocumentTagRow, StructuredDocumentTagRun, StyleForCharacter, StyleForParagraph, StyleLevel, Styles, SubDoc, SubDocCollection, SymbolRun, TDirection, Tab, TabStopPosition, TabStopType, Table, TableAnchorType, TableBorders, TableCell, TableCellBorders, TableLayoutType, TableOfContents, TableProperties, TablePropertyExceptions, TableRow, TableRowProperties, TableRowPropertiesChange, TextAlignmentType, TextBodyWrappingType, TextDirection, TextEffect, TextHorzOverflowType, TextRun, TextVertOverflowType, TextVerticalType, TextWrappingSide, TextWrappingType, Textbox, TextboxTightWrapType, ThematicBreak, UnderlineType, VerticalAlign, VerticalAlignSection, VerticalAlignTable, VerticalAnchor, VerticalMerge, VerticalMergeRevisionType, VerticalMergeType, VerticalPositionAlign, VerticalPositionRelativeFrom, WORKAROUND2, WORKAROUND4, WidthType, WpgGroupRun, WpsShapeRun, XmlAttributeComponent, XmlComponent, YearLong, YearShort, abstractNumUniqueNumericIdGen, bookmarkUniqueNumericIdGen, buildDocumentAttributes, buildRunProperties, chartAttr, coerceMathJson, coerceSectionChild, concreteNumUniqueNumericIdGen, convertInchesToTwip, convertMillimetersToTwip, convertToXmlComponent, createAlignment, createBodyProperties, createBorderElement, createBreak, createCnfStyle, createColumns, createDataModel, createDivId, createDocumentGrid, createDotEmphasisMark, createEmphasisMark, createFormFieldData, createFrameProperties, createHeaderFooterReference, createHorizontalPosition, createIndent, createLineNumberType, createMathAccent, createMathAccentCharacter, createMathAccentProperties, createMathBar, createMathBarProperties, createMathBase, createMathBorderBoxProperties, createMathBoxProperties, createMathControlProperties, createMathEqArrProperties, createMathFractionProperties, createMathFunctionProperties, createMathGroupChrProperties, createMathLimitLocation, createMathLimitLowProperties, createMathLimitUpperProperties, createMathMatrixProperties, createMathNAryProperties, createMathPhantProperties, createMathPreSubSuperScriptProperties, createMathProperties, createMathRunProperties, createMathSubScriptElement, createMathSubScriptProperties, createMathSubSuperScriptProperties, createMathSuperScriptElement, createMathSuperScriptProperties, createOutlineLevel, createPageMargin, createPageNumberType, createPageSize, createParagraphStyle, createRuby, createRunFonts, createSectionType, createShading, createSimplePos, createSpacing, createStringElement, createTabStop, createTabStopItem, createTableFloatProperties, createTableLayout, createTableLook, createTableOverlap, createTableRowHeight, createTableWidthElement, createTransformation, createUnderline, createVerticalAlign, createVerticalPosition, createWrapNone, createWrapSquare, createWrapThrough, createWrapTight, createWrapTopAndBottom, docPropertiesUniqueNumericIdGen, getColorXml, getLayoutXml, getStyleXml, hashedId, parseArchive, parseDocument, parseDocx, parseMathChildren, patchDetector, patchDocument, sectionMarginDefaults, sectionPageSizeDefaults, uniqueId, uniqueNumericIdCreator, uniqueUuid, wrapEl };
|
|
21348
21764
|
|
|
21349
21765
|
//# sourceMappingURL=index.mjs.map
|