@silurus/ooxml 0.72.2 → 0.73.1
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/chunk-DmhlhrBa.js +11 -0
- package/dist/docx-Bq1YykqO.js +25085 -0
- package/dist/docx.mjs +2 -2
- package/dist/docx_parser_bg.wasm +0 -0
- package/dist/{find-cursor-DBifiZop.js → find-cursor-CaGrVs7z.js} +1534 -1488
- package/dist/highlight-rect-DZn1OD1x.js +988 -0
- package/dist/index.mjs +3 -3
- package/dist/math.mjs +1 -1
- package/dist/{mathjax-Dk_JzbFj.js → mathjax-BPjQ2C_j.js} +2 -2
- package/dist/{pptx-D3L4FQfI.js → pptx-BVDbKJFr.js} +1176 -1278
- package/dist/pptx.mjs +2 -2
- package/dist/pptx_parser_bg.wasm +0 -0
- package/dist/render-worker-host-BASlxY40.js +27 -0
- package/dist/{render-worker-host-BzhGwe0I.js → render-worker-host-Bz0flu1p.js} +1 -1
- package/dist/{render-worker-host-Cg60RAG_.js → render-worker-host-Custze53.js} +1 -1
- package/dist/types/docx.d.ts +3968 -4040
- package/dist/types/index.d.ts +8183 -8602
- package/dist/types/math.d.ts +41 -38
- package/dist/types/pptx.d.ts +3629 -3704
- package/dist/types/xlsx.d.ts +3218 -3301
- package/dist/{visible-index-DSN5XPnm.js → visible-index-CyuaF_ZP.js} +11 -11
- package/dist/{xlsx-BWEqRZ25.js → xlsx-z4Bs4HLQ.js} +732 -725
- package/dist/xlsx.mjs +2 -2
- package/dist/xlsx_parser_bg.wasm +0 -0
- package/package.json +16 -6
- package/dist/docx-wLLJuetI.js +0 -10654
- package/dist/highlight-rect-DTgfiJgA.js +0 -881
- package/dist/render-worker-host-B5esxBj-.js +0 -27
- package/dist/segments--0hIQLXB.js +0 -7
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { a as
|
|
3
|
-
import { t as
|
|
4
|
-
import { t as
|
|
1
|
+
import { t as e } from "./chunk-DmhlhrBa.js";
|
|
2
|
+
import { At as t, B as n, Bt as r, C as i, D as a, Dt as o, E as s, Et as c, F as l, Ft as u, G as d, H as f, Ht as p, It as m, J as h, Jt as g, K as _, L as v, Lt as y, M as b, Mt as x, N as S, Nt as C, Ot as w, P as T, Pt as E, R as D, Rt as O, S as ee, T as k, Tt as A, U as j, Ut as te, V as M, W as N, Y as P, Yt as F, _ as I, _t as L, at as R, b as z, d as B, et as V, f as H, h as U, i as ne, jt as W, k as re, kt as ie, l as ae, lt as oe, m as se, mt as ce, n as le, nt as ue, o as G, p as de, q as fe, qt as K, r as pe, rt as me, t as he, ut as q, v as ge, vt as _e, w as ve, x as ye, xt as J, zt as be } from "./find-cursor-CaGrVs7z.js";
|
|
3
|
+
import { a as xe, i as Se, n as Ce, r as we, t as Te } from "./visible-index-CyuaF_ZP.js";
|
|
4
|
+
import { t as Ee } from "./mathjax-BPjQ2C_j.js";
|
|
5
5
|
//#region packages/core/src/sparkline/renderer.ts
|
|
6
|
-
function
|
|
6
|
+
function De(e, t, n) {
|
|
7
7
|
let { values: r } = n;
|
|
8
8
|
if (r.length === 0 || t.w <= 0 || t.h <= 0) return;
|
|
9
9
|
let i = n.colorSeries ?? "#5B9BD5", a = Math.min(2, t.w * .08), o = Math.max(2, t.h * .2), s = t.x + a, c = t.y + o, l = Math.max(1, t.w - a * 2), u = Math.max(1, t.h - o * 2), d = r.filter((e) => typeof e == "number");
|
|
@@ -12,11 +12,11 @@ function Oe(e, t, n) {
|
|
|
12
12
|
m === h && (h = m + 1, --m);
|
|
13
13
|
let g = h - m, _ = (e) => c + u - (e - m) / g * u;
|
|
14
14
|
if (n.kind === "stem") {
|
|
15
|
-
|
|
15
|
+
Ae(e, n, s, c, l, u);
|
|
16
16
|
return;
|
|
17
17
|
}
|
|
18
18
|
if (n.kind === "column") {
|
|
19
|
-
|
|
19
|
+
ke(e, n, r, s, c, l, u, m, h);
|
|
20
20
|
return;
|
|
21
21
|
}
|
|
22
22
|
if (n.displayXAxis && m < 0 && h > 0) {
|
|
@@ -25,30 +25,30 @@ function Oe(e, t, n) {
|
|
|
25
25
|
e.moveTo(s, t), e.lineTo(s + l, t), e.stroke(), e.restore();
|
|
26
26
|
}
|
|
27
27
|
let v = r.length, y = (e) => v === 1 ? s + l / 2 : s + e / (v - 1) * l;
|
|
28
|
-
e.save(), e.strokeStyle = i, e.lineCap = "round", e.lineJoin = "round", e.lineWidth = (n.lineWeight ?? .75) *
|
|
29
|
-
let b = !1,
|
|
28
|
+
e.save(), e.strokeStyle = i, e.lineCap = "round", e.lineJoin = "round", e.lineWidth = (n.lineWeight ?? .75) * x, e.beginPath();
|
|
29
|
+
let b = !1, S = n.displayEmptyCellsAs ?? "gap";
|
|
30
30
|
for (let t = 0; t < v; t++) {
|
|
31
31
|
let n = r[t];
|
|
32
32
|
if (n == null) {
|
|
33
|
-
if (
|
|
33
|
+
if (S === "zero") {
|
|
34
34
|
let n = y(t), r = _(0);
|
|
35
35
|
b ? e.lineTo(n, r) : (e.moveTo(n, r), b = !0);
|
|
36
|
-
} else
|
|
36
|
+
} else S === "gap" && (b = !1);
|
|
37
37
|
continue;
|
|
38
38
|
}
|
|
39
39
|
let i = y(t), a = _(n);
|
|
40
40
|
b ? e.lineTo(i, a) : (e.moveTo(i, a), b = !0);
|
|
41
41
|
}
|
|
42
42
|
e.stroke(), e.restore();
|
|
43
|
-
let
|
|
43
|
+
let C = Math.max(1, Math.min(2.5, u * .12)), w = Oe(r, n);
|
|
44
44
|
for (let t = 0; t < v; t++) {
|
|
45
45
|
let a = r[t];
|
|
46
46
|
if (a == null) continue;
|
|
47
|
-
let o =
|
|
48
|
-
(n.markers || o != null) && (e.save(), e.fillStyle = o ?? n.colorMarkers ?? i, e.beginPath(), e.arc(y(t), _(a),
|
|
47
|
+
let o = w[t];
|
|
48
|
+
(n.markers || o != null) && (e.save(), e.fillStyle = o ?? n.colorMarkers ?? i, e.beginPath(), e.arc(y(t), _(a), C, 0, Math.PI * 2), e.fill(), e.restore());
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
|
-
function
|
|
51
|
+
function Oe(e, t) {
|
|
52
52
|
let n = e.map(() => null), r = e.map((e) => typeof e == "number" ? e : null), i = r.findIndex((e) => e != null), a = -1;
|
|
53
53
|
for (let e = r.length - 1; e >= 0; e--) if (r[e] != null) {
|
|
54
54
|
a = e;
|
|
@@ -63,10 +63,10 @@ function ke(e, t) {
|
|
|
63
63
|
if (t.low && t.colorLow && !Number.isNaN(c)) for (let e = 0; e < r.length; e++) r[e] === c && (n[e] = t.colorLow);
|
|
64
64
|
return n;
|
|
65
65
|
}
|
|
66
|
-
function
|
|
66
|
+
function ke(e, t, n, r, i, a, o, s, c) {
|
|
67
67
|
let l = n.length;
|
|
68
68
|
if (l === 0) return;
|
|
69
|
-
let u = s < 0 && c > 0 ? 0 : s, d = c - s, f = (e) => i + o - (e - s) / d * o, p = f(u), m = a / l, h = Math.min(1.5, m * .15), g =
|
|
69
|
+
let u = s < 0 && c > 0 ? 0 : s, d = c - s, f = (e) => i + o - (e - s) / d * o, p = f(u), m = a / l, h = Math.min(1.5, m * .15), g = Oe(n, t);
|
|
70
70
|
for (let i = 0; i < l; i++) {
|
|
71
71
|
let a = n[i];
|
|
72
72
|
if (a == null) continue;
|
|
@@ -74,10 +74,10 @@ function Ae(e, t, n, r, i, a, o, s, c) {
|
|
|
74
74
|
e.save(), e.fillStyle = o, e.fillRect(c, Math.min(p, s), l, Math.abs(p - s)), e.restore();
|
|
75
75
|
}
|
|
76
76
|
}
|
|
77
|
-
function
|
|
77
|
+
function Ae(e, t, n, r, i, a) {
|
|
78
78
|
let o = t.values.length;
|
|
79
79
|
if (o === 0) return;
|
|
80
|
-
let s = r + a / 2, c = a / 2, l = i / o, u = Math.min(1.5, l * .15), d =
|
|
80
|
+
let s = r + a / 2, c = a / 2, l = i / o, u = Math.min(1.5, l * .15), d = Oe(t.values, t);
|
|
81
81
|
for (let r = 0; r < o; r++) {
|
|
82
82
|
let i = t.values[r];
|
|
83
83
|
if (i == null || i === 0) continue;
|
|
@@ -86,6 +86,11 @@ function je(e, t, n, r, i, a) {
|
|
|
86
86
|
}
|
|
87
87
|
}
|
|
88
88
|
//#endregion
|
|
89
|
+
//#region packages/core/src/text/bidi/segments.ts
|
|
90
|
+
function je(e, t) {
|
|
91
|
+
return e === !0 ? "rtl" : e === !1 ? "ltr" : f().computeLevels(t, "auto").paragraphLevel === 1 ? "rtl" : "ltr";
|
|
92
|
+
}
|
|
93
|
+
//#endregion
|
|
89
94
|
//#region packages/xlsx/src/worker.ts?worker&inline
|
|
90
95
|
var Me = "var e=class{__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,n.unregister(this),e}free(){let e=this.__destroy_into_raw();y.__wbg_xlsxarchive_free(e,0)}extract_image(e){let t=f(e,y.__wbindgen_malloc,y.__wbindgen_realloc),n=v,r=y.xlsxarchive_extract_image(this.__wbg_ptr,t,n);if(r[3])throw p(r[2]);var a=i(r[0],r[1]).slice();return y.__wbindgen_free(r[0],r[1]*1,1),a}constructor(e,t){let r=d(e,y.__wbindgen_malloc),i=v,a=y.xlsxarchive_new(r,i,!u(t),u(t)?BigInt(0):t);if(a[2])throw p(a[1]);return this.__wbg_ptr=a[0]>>>0,n.register(this,this.__wbg_ptr,this),this}parse(){let e=y.xlsxarchive_parse(this.__wbg_ptr);if(e[3])throw p(e[2]);var t=i(e[0],e[1]).slice();return y.__wbindgen_free(e[0],e[1]*1,1),t}parse_sheet(e,t){let n=f(t,y.__wbindgen_malloc,y.__wbindgen_realloc),r=v,a=y.xlsxarchive_parse_sheet(this.__wbg_ptr,e,n,r);if(a[3])throw p(a[2]);var o=i(a[0],a[1]).slice();return y.__wbindgen_free(a[0],a[1]*1,1),o}to_markdown(){let e,t;try{let i=y.xlsxarchive_to_markdown(this.__wbg_ptr);var n=i[0],r=i[1];if(i[3])throw n=0,r=0,p(i[2]);return e=n,t=r,s(n,r)}finally{y.__wbindgen_free(e,t,1)}}};Symbol.dispose&&(e.prototype[Symbol.dispose]=e.prototype.free);function t(){return{__proto__:null,\"./xlsx_parser_bg.js\":{__proto__:null,__wbg___wbindgen_debug_string_ab4b34d23d6778bd:function(e,t){let n=f(r(t),y.__wbindgen_malloc,y.__wbindgen_realloc),i=v;o().setInt32(e+4,i,!0),o().setInt32(e+0,n,!0)},__wbg___wbindgen_string_get_7ed5322991caaec5:function(e,t){let n=t,r=typeof n==`string`?n:void 0;var i=u(r)?0:f(r,y.__wbindgen_malloc,y.__wbindgen_realloc),a=v;o().setInt32(e+4,a,!0),o().setInt32(e+0,i,!0)},__wbg___wbindgen_throw_6b64449b9b9ed33c:function(e,t){throw Error(s(e,t))},__wbg_error_a6fa202b58aa1cd3:function(e,t){let n,r;try{n=e,r=t,console.error(s(e,t))}finally{y.__wbindgen_free(n,r,1)}},__wbg_new_227d7c05414eb861:function(){return Error()},__wbg_stack_3b0d974bbf31e44f:function(e,t){let n=t.stack,r=f(n,y.__wbindgen_malloc,y.__wbindgen_realloc),i=v;o().setInt32(e+4,i,!0),o().setInt32(e+0,r,!0)},__wbindgen_cast_0000000000000001:function(e,t){return s(e,t)},__wbindgen_init_externref_table:function(){let e=y.__wbindgen_externrefs,t=e.grow(4);e.set(0,void 0),e.set(t+0,void 0),e.set(t+1,null),e.set(t+2,!0),e.set(t+3,!1)}}}}const n=typeof FinalizationRegistry>`u`?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>y.__wbg_xlsxarchive_free(e>>>0,1));function r(e){let t=typeof e;if(t==`number`||t==`boolean`||e==null)return`${e}`;if(t==`string`)return`\"${e}\"`;if(t==`symbol`){let t=e.description;return t==null?`Symbol`:`Symbol(${t})`}if(t==`function`){let t=e.name;return typeof t==`string`&&t.length>0?`Function(${t})`:`Function`}if(Array.isArray(e)){let t=e.length,n=`[`;t>0&&(n+=r(e[0]));for(let i=1;i<t;i++)n+=`, `+r(e[i]);return n+=`]`,n}let n=/\\[object ([^\\]]+)\\]/.exec(toString.call(e)),i;if(n&&n.length>1)i=n[1];else return toString.call(e);if(i==`Object`)try{return`Object(`+JSON.stringify(e)+`)`}catch{return`Object`}return e instanceof Error?`${e.name}: ${e.message}\\n${e.stack}`:i}function i(e,t){return e>>>=0,l().subarray(e/1,e/1+t)}let a=null;function o(){return(a===null||a.buffer.detached===!0||a.buffer.detached===void 0&&a.buffer!==y.memory.buffer)&&(a=new DataView(y.memory.buffer)),a}function s(e,t){return e>>>=0,g(e,t)}let c=null;function l(){return(c===null||c.byteLength===0)&&(c=new Uint8Array(y.memory.buffer)),c}function u(e){return e==null}function d(e,t){let n=t(e.length*1,1)>>>0;return l().set(e,n/1),v=e.length,n}function f(e,t,n){if(n===void 0){let n=_.encode(e),r=t(n.length,1)>>>0;return l().subarray(r,r+n.length).set(n),v=n.length,r}let r=e.length,i=t(r,1)>>>0,a=l(),o=0;for(;o<r;o++){let t=e.charCodeAt(o);if(t>127)break;a[i+o]=t}if(o!==r){o!==0&&(e=e.slice(o)),i=n(i,r,r=o+e.length*3,1)>>>0;let t=l().subarray(i+o,i+r),a=_.encodeInto(e,t);o+=a.written,i=n(i,r,o,1)>>>0}return v=o,i}function p(e){let t=y.__wbindgen_externrefs.get(e);return y.__externref_table_dealloc(e),t}let m=new TextDecoder(`utf-8`,{ignoreBOM:!0,fatal:!0});m.decode();let h=0;function g(e,t){return h+=t,h>=2146435072&&(m=new TextDecoder(`utf-8`,{ignoreBOM:!0,fatal:!0}),m.decode(),h=t),m.decode(l().subarray(e,e+t))}const _=new TextEncoder;`encodeInto`in _||(_.encodeInto=function(e,t){let n=_.encode(e);return t.set(n),{read:e.length,written:n.length}});let v=0,y;function b(e,t){return y=e.exports,a=null,c=null,y.__wbindgen_start(),y}async function x(e,t){if(typeof Response==`function`&&e instanceof Response){if(typeof WebAssembly.instantiateStreaming==`function`)try{return await WebAssembly.instantiateStreaming(e,t)}catch(t){if(e.ok&&n(e.type)&&e.headers.get(`Content-Type`)!==`application/wasm`)console.warn(\"`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\\n\",t);else throw t}let r=await e.arrayBuffer();return await WebAssembly.instantiate(r,t)}else{let n=await WebAssembly.instantiate(e,t);return n instanceof WebAssembly.Instance?{instance:n,module:e}:n}function n(e){switch(e){case`basic`:case`cors`:case`default`:return!0}return!1}}async function S(e){if(y!==void 0)return y;e!==void 0&&(Object.getPrototypeOf(e)===Object.prototype?{module_or_path:e}=e:console.warn(`using deprecated parameters for the initialization function; pass a single object instead`));let n=t();(typeof e==`string`||typeof Request==`function`&&e instanceof Request||typeof URL==`function`&&e instanceof URL)&&(e=fetch(e));let{instance:r,module:i}=await x(await e,n);return b(r,i)}async function C(e){return y=void 0,a=null,c=null,S(e)}function w(e){if(!e.startsWith(`data:`))return null;let t=e.indexOf(`,`);if(t===-1)return null;let n=atob(e.slice(t+1)),r=new Uint8Array(n.length);for(let e=0;e<n.length;e++)r[e]=n.charCodeAt(e);return r.buffer}var T=class e extends Error{code=`parser-crashed`;constructor(t){super(t),this.name=`WasmTrapError`,Object.setPrototypeOf(this,e.prototype)}};function E(e){let t=globalThis.WebAssembly?.RuntimeError;if(t&&e instanceof t||e instanceof RangeError)return!0;if(e instanceof Error){let t=e.name;if(t===`RuntimeError`||t===`CompileError`||t===`LinkError`)return!0}return!1}const D=new class{_init;_opts;_wasmInput=null;_initPromise=null;_poisoned=!1;_archive=null;constructor(e,t={}){this._init=e,this._opts=t}setWasmUrl(e){this._wasmInput=e,this._poisoned=!1,this._initPromise=this._init(e)}get archive(){return this._archive}setArchive(e){this._freeArchive(),this._archive=e}disposeArchive(){this._freeArchive()}_freeArchive(){this._archive!=null&&this._opts.freeArchive&&this._opts.freeArchive(this._archive),this._archive=null}get poisoned(){return this._poisoned}async ensureReady(){if(this._poisoned){if(this._wasmInput===null)throw Error(`WasmParserHost: setWasmUrl was never called`);let e=(this._opts.reinit??this._init)(this._wasmInput);this._initPromise=e,await e,this._poisoned=!1;return}if(this._initPromise===null)throw Error(`WasmParserHost: setWasmUrl was never called`);await this._initPromise}run(e){try{return e()}catch(e){throw E(e)?(this._poison(),new T(`WASM parser trapped and was recycled: ${e instanceof Error?e.message:String(e)}`)):e}}poison(){this._poison()}_poison(){if(this._poisoned=!0,this._initPromise=null,this._archive!=null&&this._opts.freeArchive)try{this._opts.freeArchive(this._archive)}catch{}this._archive=null}}(S,{freeArchive:e=>e.free(),reinit:C});self.onmessage=async t=>{let n=t.data;if(n.type===`init`){D.setWasmUrl(w(n.wasmUrl)??n.wasmUrl);return}let r=n.id;try{if(await D.ensureReady(),n.type===`parse`){let t=typeof n.maxZipEntryBytes==`number`&&n.maxZipEntryBytes>0?BigInt(n.maxZipEntryBytes):void 0,i=new Uint8Array(n.data),a=D.run(()=>{let n=new e(i,t);return D.setArchive(n),n.parse()}).buffer,o={type:`parsed`,id:r,workbookJson:a};self.postMessage(o,[a]);return}let t=D.archive;if(n.type===`parseSheet`){if(!t)throw Error(`parseSheet before parse: no archive retained`);let e=D.run(()=>t.parse_sheet(n.sheetIndex,n.sheetName)).buffer,i={type:`parsedSheet`,id:r,worksheetJson:e};self.postMessage(i,[e]);return}if(n.type===`extractImage`){if(!t)throw Error(`No xlsx loaded`);let e=D.run(()=>t.extract_image(n.path).buffer),i={type:`imageExtracted`,id:r,bytes:e};self.postMessage(i,[e]);return}if(n.type===`toMarkdown`){if(!t)throw Error(`No xlsx loaded`);let e={type:`markdownRendered`,id:r,markdown:D.run(()=>t.to_markdown())};self.postMessage(e);return}}catch(e){let t={type:`error`,id:r,message:String(e)};self.postMessage(t)}};", Ne = typeof self < "u" && self.Blob && new Blob(["URL.revokeObjectURL(import.meta.url);", Me], { type: "text/javascript;charset=utf-8" });
|
|
91
96
|
function Pe(e) {
|
|
@@ -633,16 +638,16 @@ function pt(e) {
|
|
|
633
638
|
}
|
|
634
639
|
function mt() {
|
|
635
640
|
let e = /* @__PURE__ */ new Date();
|
|
636
|
-
return
|
|
641
|
+
return ie(new Date(Date.UTC(e.getFullYear(), e.getMonth(), e.getDate())), !1);
|
|
637
642
|
}
|
|
638
643
|
function ht() {
|
|
639
|
-
return
|
|
644
|
+
return ie(new Date(Date.now()), !1);
|
|
640
645
|
}
|
|
641
646
|
function gt(e, t, n) {
|
|
642
|
-
return Math.floor(
|
|
647
|
+
return Math.floor(ie(new Date(Date.UTC(e, t - 1, n)), !1));
|
|
643
648
|
}
|
|
644
649
|
function _t(e) {
|
|
645
|
-
return
|
|
650
|
+
return w(Math.floor(e), !1);
|
|
646
651
|
}
|
|
647
652
|
function vt(e) {
|
|
648
653
|
let t = _t(e);
|
|
@@ -813,69 +818,69 @@ function At(e) {
|
|
|
813
818
|
};
|
|
814
819
|
}
|
|
815
820
|
function jt(e, t, n = !1) {
|
|
816
|
-
let r =
|
|
817
|
-
for (;
|
|
818
|
-
let t =
|
|
821
|
+
let r = w(e, n), i = r.getUTCFullYear(), a = r.getUTCMonth() + 1, o = r.getUTCDate(), s = r.getUTCDay(), c = r.getUTCHours(), l = r.getUTCMinutes(), u = r.getUTCSeconds(), d = t.split(";")[0], f = /am\/pm|a\/p/i.test(d), p = null, m = () => p ??= At(r), h = "", g = 0, _ = !1;
|
|
822
|
+
for (; g < d.length;) {
|
|
823
|
+
let t = d[g];
|
|
819
824
|
if (t === "\"") {
|
|
820
|
-
for (
|
|
821
|
-
|
|
825
|
+
for (g++; g < d.length && d[g] !== "\"";) h += d[g++];
|
|
826
|
+
g < d.length && g++, _ = !1;
|
|
822
827
|
} else if (t === "[") {
|
|
823
|
-
let t =
|
|
828
|
+
let t = d.indexOf("]", g), n = t > g ? d.slice(g + 1, t) : "", r = n.match(/^([hms])\1*$/i);
|
|
824
829
|
if (r) {
|
|
825
830
|
let i = r[1].toLowerCase(), a = e < 0 ? "-" : "", o = Math.floor(Math.abs(e) * 86400), s;
|
|
826
831
|
s = i === "h" ? Math.floor(o / 3600) : i === "m" ? Math.floor(o / 60) : o;
|
|
827
832
|
let c = n.length >= 2 ? String(s).padStart(n.length, "0") : String(s);
|
|
828
|
-
|
|
833
|
+
h += a + c, g = t + 1, _ = i === "h";
|
|
829
834
|
} else {
|
|
830
|
-
for (;
|
|
831
|
-
|
|
835
|
+
for (; g < d.length && d[g] !== "]";) g++;
|
|
836
|
+
g < d.length && g++;
|
|
832
837
|
}
|
|
833
|
-
} else if (t === "_")
|
|
834
|
-
else if (t === "*")
|
|
835
|
-
else if (t === "\\")
|
|
838
|
+
} else if (t === "_") g += 2;
|
|
839
|
+
else if (t === "*") g += 2;
|
|
840
|
+
else if (t === "\\") g + 1 < d.length && (h += d[g + 1]), g += 2, _ = !1;
|
|
836
841
|
else if (t === "y" || t === "Y") {
|
|
837
842
|
let e = 0;
|
|
838
|
-
for (;
|
|
839
|
-
|
|
843
|
+
for (; g < d.length && d[g].toLowerCase() === "y";) e++, g++;
|
|
844
|
+
h += e <= 2 ? String(i).slice(-2) : String(i).padStart(4, "0"), _ = !1;
|
|
840
845
|
} else if (t === "m" || t === "M") {
|
|
841
846
|
let e = 0;
|
|
842
|
-
for (;
|
|
843
|
-
let t =
|
|
844
|
-
|
|
847
|
+
for (; g < d.length && d[g].toLowerCase() === "m";) e++, g++;
|
|
848
|
+
let t = d.slice(g).replace(/\[[^\]]*\]/g, "");
|
|
849
|
+
_ || /^:s/i.test(t) ? h += e >= 2 ? String(l).padStart(2, "0") : String(l) : e === 1 ? h += String(a) : e === 2 ? h += String(a).padStart(2, "0") : e === 3 ? h += Tt[a - 1].slice(0, 3) : e === 4 ? h += Tt[a - 1] : h += Tt[a - 1][0], _ = !1;
|
|
845
850
|
} else if (t === "d" || t === "D") {
|
|
846
851
|
let e = 0;
|
|
847
|
-
for (;
|
|
848
|
-
e === 1 ?
|
|
852
|
+
for (; g < d.length && d[g].toLowerCase() === "d";) e++, g++;
|
|
853
|
+
e === 1 ? h += String(o) : e === 2 ? h += String(o).padStart(2, "0") : e === 3 ? h += Et[s].slice(0, 3) : h += Et[s], _ = !1;
|
|
849
854
|
} else if (t === "h" || t === "H") {
|
|
850
855
|
let e = 0;
|
|
851
|
-
for (;
|
|
852
|
-
let t =
|
|
853
|
-
|
|
856
|
+
for (; g < d.length && d[g].toLowerCase() === "h";) e++, g++;
|
|
857
|
+
let t = f ? c % 12 || 12 : c;
|
|
858
|
+
h += e >= 2 ? String(t).padStart(2, "0") : String(t), _ = !0;
|
|
854
859
|
} else if (t === "s" || t === "S") {
|
|
855
860
|
let e = 0;
|
|
856
|
-
for (;
|
|
857
|
-
|
|
861
|
+
for (; g < d.length && d[g].toLowerCase() === "s";) e++, g++;
|
|
862
|
+
h += e >= 2 ? String(u).padStart(2, "0") : String(u), _ = !1;
|
|
858
863
|
} else if (t === "g" || t === "G") {
|
|
859
864
|
let e = 0;
|
|
860
|
-
for (;
|
|
861
|
-
let t =
|
|
862
|
-
e === 1 ?
|
|
865
|
+
for (; g < d.length && d[g].toLowerCase() === "g";) e++, g++;
|
|
866
|
+
let t = m();
|
|
867
|
+
e === 1 ? h += t.abbr : e === 2 ? h += t.short : h += t.long, _ = !1;
|
|
863
868
|
} else if (t === "e" || t === "E") {
|
|
864
869
|
let e = 0;
|
|
865
|
-
for (;
|
|
866
|
-
let t =
|
|
867
|
-
|
|
870
|
+
for (; g < d.length && d[g].toLowerCase() === "e";) e++, g++;
|
|
871
|
+
let t = m().year;
|
|
872
|
+
h += e >= 2 ? String(t).padStart(2, "0") : String(t), _ = !1;
|
|
868
873
|
} else if (t === "r" || t === "R") {
|
|
869
874
|
let e = 0;
|
|
870
|
-
for (;
|
|
871
|
-
let t =
|
|
872
|
-
|
|
875
|
+
for (; g < d.length && d[g].toLowerCase() === "r";) e++, g++;
|
|
876
|
+
let t = m().year;
|
|
877
|
+
h += e >= 2 ? String(t).padStart(2, "0") : String(t), _ = !1;
|
|
873
878
|
} else if (t === "A" || t === "a") {
|
|
874
|
-
let e =
|
|
875
|
-
e.startsWith("AAAA") ? (
|
|
876
|
-
} else
|
|
879
|
+
let e = d.slice(g).toUpperCase();
|
|
880
|
+
e.startsWith("AAAA") ? (h += Ot[s], g += 4) : e.startsWith("AAA") ? (h += Dt[s], g += 3) : e.startsWith("AM/PM") ? (h += c < 12 ? "AM" : "PM", g += 5) : e.startsWith("A/P") ? (h += c < 12 ? "A" : "P", g += 3) : (h += t, g++), _ = !1;
|
|
881
|
+
} else h += t, g++, t !== ":" && t !== "/" && t !== "-" && t !== "." && t !== " " && (_ = !1);
|
|
877
882
|
}
|
|
878
|
-
return
|
|
883
|
+
return h;
|
|
879
884
|
}
|
|
880
885
|
function Mt(e) {
|
|
881
886
|
if (/\[[hms]+\]/i.test(e)) return !0;
|
|
@@ -1104,9 +1109,9 @@ function Yt(e, t, n) {
|
|
|
1104
1109
|
function Xt(e, t, n) {
|
|
1105
1110
|
let r = Gt(t), i = n ? Math.abs(e) : e;
|
|
1106
1111
|
r.hasPercent && (i *= 100), r.commaScale > 0 && (i /= 1e3 ** r.commaScale);
|
|
1107
|
-
let a = i < 0 ? "-" : "",
|
|
1112
|
+
let a = i < 0 ? "-" : "", s = Math.abs(i);
|
|
1108
1113
|
if (r.fraction) {
|
|
1109
|
-
let e = Math.floor(
|
|
1114
|
+
let e = Math.floor(s), t = s - e, { wholeSpec: n, numSpec: i, denSpec: o, fixedDen: c } = r.fraction, l = n.length > 0, [u, d] = Yt(t, o.length, c), f = (e, t) => {
|
|
1110
1115
|
let n = String(e), r = t.includes("0") ? "0" : " ";
|
|
1111
1116
|
for (; n.length < t.length;) n = r + n;
|
|
1112
1117
|
return n;
|
|
@@ -1118,25 +1123,25 @@ function Xt(e, t, n) {
|
|
|
1118
1123
|
if (l) {
|
|
1119
1124
|
let t = e > 0 ? String(e) : n.includes("0") ? "0" : "";
|
|
1120
1125
|
if (u === 0) {
|
|
1121
|
-
let e = c === null ?
|
|
1126
|
+
let e = c === null ? o.length || 1 : String(c).length;
|
|
1122
1127
|
m += t + " ".repeat(1 + i.length + 1 + e);
|
|
1123
1128
|
} else {
|
|
1124
|
-
let e = c === null ? p(d,
|
|
1129
|
+
let e = c === null ? p(d, o) : String(c);
|
|
1125
1130
|
m += t + " " + f(u, i) + "/" + e;
|
|
1126
1131
|
}
|
|
1127
1132
|
} else {
|
|
1128
|
-
let t = u + e * d, n = c === null ? p(d,
|
|
1133
|
+
let t = u + e * d, n = c === null ? p(d, o) : String(c);
|
|
1129
1134
|
m += f(t, i) + "/" + n;
|
|
1130
1135
|
}
|
|
1131
1136
|
return m;
|
|
1132
1137
|
}
|
|
1133
1138
|
if (r.exp) {
|
|
1134
1139
|
let e = Math.max(r.intSpec.length, 1), t = r.fracSpec.length, n = 0, i = 0;
|
|
1135
|
-
|
|
1136
|
-
let [c, l = ""] =
|
|
1140
|
+
s !== 0 && (i = Math.floor(Math.log10(s)), i = Math.floor(i / e) * e, n = s / 10 ** i, parseFloat(o(n, t)) >= 10 ** e && (i += e, n = s / 10 ** i));
|
|
1141
|
+
let [c, l = ""] = o(n, t).split(".");
|
|
1137
1142
|
return a + Zt(r, qt(c, r.intSpec, !1), Jt(l, r.fracSpec), "E" + (i < 0 ? "-" : r.exp.plus ? "+" : "") + String(Math.abs(i)).padStart(r.exp.width, "0"));
|
|
1138
1143
|
}
|
|
1139
|
-
let c = r.fracSpec.length, [l, u = ""] = s
|
|
1144
|
+
let c = r.fracSpec.length, [l, u = ""] = o(s, c).split("."), d = l.replace(/^0+/, ""), f = /[0]/.test(r.intSpec) || r.intSpec === "" && !1;
|
|
1140
1145
|
return d === "" && f && (d = "0"), a + Zt(r, qt(d, r.intSpec, r.grouping), Jt(u, r.fracSpec), "");
|
|
1141
1146
|
}
|
|
1142
1147
|
function Zt(e, t, n, r) {
|
|
@@ -1390,36 +1395,36 @@ function fn(e, t, n, r, i) {
|
|
|
1390
1395
|
//#endregion
|
|
1391
1396
|
//#region packages/xlsx/src/bidi-line.ts
|
|
1392
1397
|
function pn(e, t) {
|
|
1393
|
-
return e === 2 ? !0 : e === 1 ? !1 :
|
|
1398
|
+
return e === 2 ? !0 : e === 1 ? !1 : je(void 0, t) === "rtl";
|
|
1394
1399
|
}
|
|
1395
1400
|
var mn = (e) => {
|
|
1396
1401
|
let t = e.text;
|
|
1397
1402
|
return typeof t == "string" ? t : void 0;
|
|
1398
1403
|
};
|
|
1399
1404
|
function hn(e, t) {
|
|
1400
|
-
let
|
|
1405
|
+
let n = e === 2 || M(t);
|
|
1401
1406
|
return {
|
|
1402
|
-
needBidi:
|
|
1403
|
-
baseRtl:
|
|
1407
|
+
needBidi: n,
|
|
1408
|
+
baseRtl: n && pn(e, t)
|
|
1404
1409
|
};
|
|
1405
1410
|
}
|
|
1406
1411
|
function gn(e, t) {
|
|
1407
|
-
let
|
|
1408
|
-
if (
|
|
1412
|
+
let r = e.length;
|
|
1413
|
+
if (r === 0) return {
|
|
1409
1414
|
order: [],
|
|
1410
1415
|
rtl: []
|
|
1411
1416
|
};
|
|
1412
|
-
let
|
|
1413
|
-
for (let t = 0; t <
|
|
1414
|
-
|
|
1417
|
+
let i = "", a = Array(r);
|
|
1418
|
+
for (let t = 0; t < r; t++) {
|
|
1419
|
+
a[t] = i.length;
|
|
1415
1420
|
let n = mn(e[t]) ?? "";
|
|
1416
|
-
|
|
1421
|
+
i += n.length > 0 ? n : "";
|
|
1417
1422
|
}
|
|
1418
|
-
let { levels:
|
|
1419
|
-
for (let e = 0; e <
|
|
1423
|
+
let { levels: o, paragraphLevel: s } = f().computeLevels(i, t ? "rtl" : "ltr"), { order: c, segLevels: l } = n(o, s, a), u = Array(r);
|
|
1424
|
+
for (let e = 0; e < r; e++) u[e] = (l[e] & 1) == 1;
|
|
1420
1425
|
return {
|
|
1421
|
-
order:
|
|
1422
|
-
rtl:
|
|
1426
|
+
order: c,
|
|
1427
|
+
rtl: u
|
|
1423
1428
|
};
|
|
1424
1429
|
}
|
|
1425
1430
|
//#endregion
|
|
@@ -1445,25 +1450,25 @@ function vn(e, t) {
|
|
|
1445
1450
|
//#endregion
|
|
1446
1451
|
//#region packages/xlsx/src/vertical-text.ts
|
|
1447
1452
|
function yn(e, t, n, r, a, o = !1) {
|
|
1448
|
-
let s = t.codePointAt(0) ?? 0, c =
|
|
1449
|
-
if (o &&
|
|
1450
|
-
e.save(), e.translate(n, r + a / 2), e.textAlign = "center", e.textBaseline = "middle",
|
|
1453
|
+
let s = t.codePointAt(0) ?? 0, c = ee(s);
|
|
1454
|
+
if (o && i(s)) {
|
|
1455
|
+
e.save(), e.translate(n, r + a / 2), e.textAlign = "center", e.textBaseline = "middle", ge(e, () => e.fillText(t, 0, 0)), e.restore();
|
|
1451
1456
|
return;
|
|
1452
1457
|
}
|
|
1453
1458
|
if (c === "Tr") {
|
|
1454
|
-
let
|
|
1455
|
-
if (
|
|
1456
|
-
e.fillText(String.fromCodePoint(
|
|
1459
|
+
let i = z(s);
|
|
1460
|
+
if (i !== null) {
|
|
1461
|
+
e.fillText(String.fromCodePoint(i), n, r);
|
|
1457
1462
|
return;
|
|
1458
1463
|
}
|
|
1459
|
-
if (
|
|
1464
|
+
if (ve(s)) {
|
|
1460
1465
|
e.fillText(t, n, r);
|
|
1461
1466
|
return;
|
|
1462
1467
|
}
|
|
1463
1468
|
e.save(), e.translate(n, r + a / 2), e.rotate(Math.PI / 2), e.textAlign = "center", e.textBaseline = "middle", e.fillText(t, 0, 0), e.restore();
|
|
1464
1469
|
return;
|
|
1465
1470
|
}
|
|
1466
|
-
let l = c === "Tu" ?
|
|
1471
|
+
let l = c === "Tu" ? ye(s) : null;
|
|
1467
1472
|
e.fillText(l === null ? t : String.fromCodePoint(l), n, r);
|
|
1468
1473
|
}
|
|
1469
1474
|
//#endregion
|
|
@@ -1471,12 +1476,12 @@ function yn(e, t, n, r, a, o = !1) {
|
|
|
1471
1476
|
function bn(e, t) {
|
|
1472
1477
|
return t ? `${e}|duo:${t.clr1}:${t.clr2}` : e;
|
|
1473
1478
|
}
|
|
1474
|
-
var xn =
|
|
1479
|
+
var xn = C.map((e) => `"${e}"`).join(", "), Sn = E.map((e) => `"${e}"`).join(", "), Cn = `"Calibri", "Carlito", "Cambria", "Caladea", Arial, "Noto Naskh Arabic", "Noto Sans Arabic", ${xn}, sans-serif`, wn = `"Cambria", "Caladea", "Times New Roman", "Liberation Serif", "Noto Naskh Arabic", "Noto Sans Arabic", ${Sn}, serif`, Tn = "\"Courier New\", \"Liberation Mono\", monospace";
|
|
1475
1480
|
function En(e) {
|
|
1476
|
-
let t = e ?
|
|
1481
|
+
let t = e ? y(e) : null, n = O(e);
|
|
1477
1482
|
if (!t) return n === "serif" ? wn : n === "mono" ? Tn : Cn;
|
|
1478
1483
|
let r = n === "serif";
|
|
1479
|
-
return `${
|
|
1484
|
+
return `${m(t, r ? "serif" : "sans").map((e) => `"${e}"`).join(", ")}, "Calibri", "Carlito", "Cambria", "Caladea", Arial, "Noto Naskh Arabic", "Noto Sans Arabic", ${r ? Sn : xn}, ${r ? "serif" : "sans-serif"}`;
|
|
1480
1485
|
}
|
|
1481
1486
|
function Dn(e) {
|
|
1482
1487
|
return e ? `"${e}", ${En(e)}` : Cn;
|
|
@@ -1503,7 +1508,7 @@ function Fn(e, t) {
|
|
|
1503
1508
|
if (r !== void 0) return r;
|
|
1504
1509
|
let i = Pn[e.toLowerCase()]?.[Math.round(t)];
|
|
1505
1510
|
if (i !== void 0) return Nn.set(n, i), i;
|
|
1506
|
-
let a = t *
|
|
1511
|
+
let a = t * x, o = typeof OffscreenCanvas < "u" ? new OffscreenCanvas(1, 1) : typeof document < "u" ? document.createElement("canvas") : null;
|
|
1507
1512
|
if (!o) return kn;
|
|
1508
1513
|
let s = o.getContext("2d");
|
|
1509
1514
|
if (!s) return kn;
|
|
@@ -1526,17 +1531,17 @@ function In(e, t = kn) {
|
|
|
1526
1531
|
return e / t;
|
|
1527
1532
|
}
|
|
1528
1533
|
function $(e) {
|
|
1529
|
-
return Math.round(e *
|
|
1534
|
+
return Math.round(e * x);
|
|
1530
1535
|
}
|
|
1531
1536
|
function Ln(e) {
|
|
1532
|
-
return e /
|
|
1537
|
+
return e / x;
|
|
1533
1538
|
}
|
|
1534
1539
|
function Rn(e, t, n, r, i, a, o) {
|
|
1535
1540
|
if (!(i <= 0 || a <= 0)) {
|
|
1536
1541
|
if (o) {
|
|
1537
1542
|
let a = e.createLinearGradient(n, r, n + i, r);
|
|
1538
|
-
a.addColorStop(0,
|
|
1539
|
-
} else e.fillStyle =
|
|
1543
|
+
a.addColorStop(0, J(t, .85)), a.addColorStop(1, J(t, .15)), e.fillStyle = a;
|
|
1544
|
+
} else e.fillStyle = J(t);
|
|
1540
1545
|
e.fillRect(n, r, i, a);
|
|
1541
1546
|
}
|
|
1542
1547
|
}
|
|
@@ -1728,35 +1733,35 @@ var Bn = /* @__PURE__ */ new Map(), Vn = {
|
|
|
1728
1733
|
function Hn(e, t, n, r) {
|
|
1729
1734
|
let i = e.getTransform(), a = Math.max(1, Math.round(Math.hypot(i.a, i.b))), o = Math.max(1, Math.round(Math.hypot(i.c, i.d))), s = `${t}|${n}|${r}|${a}|${o}`;
|
|
1730
1735
|
if (Bn.has(s)) return Bn.get(s);
|
|
1731
|
-
let
|
|
1732
|
-
if (!
|
|
1733
|
-
let
|
|
1734
|
-
if (!u) return Bn.set(s, null), null;
|
|
1735
|
-
let d = u.getContext("2d");
|
|
1736
|
+
let l = Vn[t];
|
|
1737
|
+
if (!l) return Bn.set(s, null), null;
|
|
1738
|
+
let u = l.length, d = c(u, u);
|
|
1736
1739
|
if (!d) return Bn.set(s, null), null;
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1740
|
+
let f = d.getContext("2d");
|
|
1741
|
+
if (!f) return Bn.set(s, null), null;
|
|
1742
|
+
f.fillStyle = J(r), f.fillRect(0, 0, u, u), f.fillStyle = J(n);
|
|
1743
|
+
for (let e = 0; e < u; e++) {
|
|
1744
|
+
let t = l[e];
|
|
1745
|
+
for (let n = 0; n < u; n++) t & 1 << u - 1 - n && f.fillRect(n, e, 1, 1);
|
|
1746
|
+
}
|
|
1747
|
+
let p = e.createPattern(d, "repeat");
|
|
1748
|
+
if (p && typeof DOMMatrix < "u" && (a >= 2 || o >= 2)) {
|
|
1744
1749
|
let e = new DOMMatrix();
|
|
1745
|
-
e.scaleSelf(1 / a, 1 / o),
|
|
1750
|
+
e.scaleSelf(1 / a, 1 / o), p.setTransform(e);
|
|
1746
1751
|
}
|
|
1747
|
-
return Bn.set(s,
|
|
1752
|
+
return Bn.set(s, p), p;
|
|
1748
1753
|
}
|
|
1749
1754
|
function Un(e, t, n, r, i, a) {
|
|
1750
1755
|
if (t.gradient && t.gradient.stops.length > 0) return e.fillStyle = Wn(e, t.gradient, n, r, i, a), e.fillRect(n, r, i, a), !0;
|
|
1751
1756
|
let o = t.patternType;
|
|
1752
1757
|
if (!o || o === "none") return !1;
|
|
1753
1758
|
let s = t.fgColor ?? "000000", c = t.bgColor ?? "FFFFFF";
|
|
1754
|
-
if (o === "solid") return e.fillStyle =
|
|
1759
|
+
if (o === "solid") return e.fillStyle = J(s), e.fillRect(n, r, i, a), !0;
|
|
1755
1760
|
let l = Hn(e, o, s, c);
|
|
1756
1761
|
if (l) e.fillStyle = l;
|
|
1757
1762
|
else {
|
|
1758
1763
|
let t = zn(o);
|
|
1759
|
-
e.fillStyle = t >= 1 ?
|
|
1764
|
+
e.fillStyle = t >= 1 ? J(s) : qn(s, c, t);
|
|
1760
1765
|
}
|
|
1761
1766
|
return e.fillRect(n, r, i, a), !0;
|
|
1762
1767
|
}
|
|
@@ -1771,7 +1776,7 @@ function Wn(e, t, n, r, i, a) {
|
|
|
1771
1776
|
}
|
|
1772
1777
|
for (let e of t.stops) {
|
|
1773
1778
|
let t = Math.min(1, Math.max(0, e.position));
|
|
1774
|
-
o.addColorStop(t,
|
|
1779
|
+
o.addColorStop(t, J(e.color));
|
|
1775
1780
|
}
|
|
1776
1781
|
return o;
|
|
1777
1782
|
}
|
|
@@ -1785,11 +1790,11 @@ function qn(e, t, n) {
|
|
|
1785
1790
|
return `rgb(${Math.round(a * d + c * (1 - d))},${Math.round(o * d + l * (1 - d))},${Math.round(s * d + u * (1 - d))})`;
|
|
1786
1791
|
}
|
|
1787
1792
|
function Jn(e, t, n = 1, r) {
|
|
1788
|
-
let i = Math.round(e *
|
|
1789
|
-
return r ? Math.max(i, Math.round(
|
|
1793
|
+
let i = Math.round(e * x * n * t);
|
|
1794
|
+
return r ? Math.max(i, Math.round(G(r, e * x * t))) : i;
|
|
1790
1795
|
}
|
|
1791
1796
|
function Yn(e, t = 1) {
|
|
1792
|
-
return `${e.italic ? "italic " : ""}${e.bold ? "bold " : ""}${Math.max(1, Math.round(e.size *
|
|
1797
|
+
return `${e.italic ? "italic " : ""}${e.bold ? "bold " : ""}${Math.max(1, Math.round(e.size * x * t))}px ${Dn(e.name)}`;
|
|
1793
1798
|
}
|
|
1794
1799
|
function Xn(e, t, n, r, i, a, o, s, c, l) {
|
|
1795
1800
|
if (t.length === 0) return;
|
|
@@ -1828,10 +1833,10 @@ function Zn(e, t, n) {
|
|
|
1828
1833
|
}
|
|
1829
1834
|
function Qn(e, t, n, r, i, a, o = 1) {
|
|
1830
1835
|
if (e.save(), e.strokeStyle = i, e.lineWidth = .5, e.beginPath(), a) {
|
|
1831
|
-
let i = r - 1, a = r + 1, s = i +
|
|
1836
|
+
let i = r - 1, a = r + 1, s = i + d(i, .5, o), c = a + d(a, .5, o);
|
|
1832
1837
|
e.moveTo(t, s), e.lineTo(n, s), e.moveTo(t, c), e.lineTo(n, c);
|
|
1833
1838
|
} else {
|
|
1834
|
-
let i = r +
|
|
1839
|
+
let i = r + d(r, .5, o);
|
|
1835
1840
|
e.moveTo(t, i), e.lineTo(n, i);
|
|
1836
1841
|
}
|
|
1837
1842
|
e.stroke(), e.restore();
|
|
@@ -1892,13 +1897,13 @@ function tr(e, t, n) {
|
|
|
1892
1897
|
function nr(e, t) {
|
|
1893
1898
|
if (e.length === 0 || t.length === 0) return 0;
|
|
1894
1899
|
let n = [...e, ...t], r = e.length;
|
|
1895
|
-
return r -
|
|
1900
|
+
return r - v(n, r, D, 1);
|
|
1896
1901
|
}
|
|
1897
1902
|
function rr(e, t) {
|
|
1898
1903
|
let n = t;
|
|
1899
1904
|
for (; n < e.length;) {
|
|
1900
1905
|
let t = e[e.length - n - 1], r = e[e.length - n], i = t?.codePointAt(0), a = r?.codePointAt(0);
|
|
1901
|
-
if (i !== void 0 && a !== void 0 &&
|
|
1906
|
+
if (i !== void 0 && a !== void 0 && l(i) && l(a)) n++;
|
|
1902
1907
|
else break;
|
|
1903
1908
|
}
|
|
1904
1909
|
return n >= e.length ? t : n;
|
|
@@ -1906,10 +1911,10 @@ function rr(e, t) {
|
|
|
1906
1911
|
function ir(e, t) {
|
|
1907
1912
|
if (e.length === 0 || t.length === 0) return 0;
|
|
1908
1913
|
let n = t[0].codePointAt(0), r = e.length - 1, i = e[r].codePointAt(0);
|
|
1909
|
-
if (i === void 0 || n === void 0 || i === 8203 || n === 8203 || !
|
|
1914
|
+
if (i === void 0 || n === void 0 || i === 8203 || n === 8203 || !S(i, n)) return 0;
|
|
1910
1915
|
for (; r > 0;) {
|
|
1911
1916
|
let t = e[r - 1].codePointAt(0), n = e[r].codePointAt(0);
|
|
1912
|
-
if (t === void 0 || n === void 0 || !
|
|
1917
|
+
if (t === void 0 || n === void 0 || !S(t, n)) break;
|
|
1913
1918
|
r--;
|
|
1914
1919
|
}
|
|
1915
1920
|
return r === 0 ? 0 : e.length - r;
|
|
@@ -1918,7 +1923,7 @@ function ar(e, t, n) {
|
|
|
1918
1923
|
let r = [], i = [], a = 0;
|
|
1919
1924
|
for (; a < t.length;) {
|
|
1920
1925
|
let e = t[a], n = e.codePointAt(0) ?? 0;
|
|
1921
|
-
if (
|
|
1926
|
+
if (T(n)) i.push(e), a += n > 65535 ? 2 : 1;
|
|
1922
1927
|
else if (e === " ") {
|
|
1923
1928
|
let e = a;
|
|
1924
1929
|
for (; e < t.length && t[e] === " ";) e++;
|
|
@@ -1927,10 +1932,10 @@ function ar(e, t, n) {
|
|
|
1927
1932
|
let e = a;
|
|
1928
1933
|
for (; e < t.length;) {
|
|
1929
1934
|
let n = t[e], r = n.codePointAt(0) ?? 0;
|
|
1930
|
-
if (n === " " ||
|
|
1935
|
+
if (n === " " || T(r)) break;
|
|
1931
1936
|
e += r > 65535 ? 2 : 1;
|
|
1932
1937
|
}
|
|
1933
|
-
let n = t.slice(a, e), r =
|
|
1938
|
+
let n = t.slice(a, e), r = k(n) ? b(n) : null;
|
|
1934
1939
|
if (r && r.length > 0) {
|
|
1935
1940
|
let e = 0;
|
|
1936
1941
|
for (let t of r) i.push(n.slice(e, t)), e = t;
|
|
@@ -1960,37 +1965,37 @@ function ar(e, t, n) {
|
|
|
1960
1965
|
return r.push(o), r;
|
|
1961
1966
|
}
|
|
1962
1967
|
function or(e, t, n, r, i) {
|
|
1963
|
-
let
|
|
1964
|
-
|
|
1965
|
-
segments:
|
|
1966
|
-
maxFontSize:
|
|
1967
|
-
maxFontFamily:
|
|
1968
|
-
para:
|
|
1969
|
-
}),
|
|
1970
|
-
},
|
|
1971
|
-
if (
|
|
1972
|
-
|
|
1968
|
+
let o = [], c = [], l = 0, u = 0, d = null, f = n.size, p = n.name, m = 0, h = () => {
|
|
1969
|
+
c.length !== 0 && (o.push({
|
|
1970
|
+
segments: c,
|
|
1971
|
+
maxFontSize: u,
|
|
1972
|
+
maxFontFamily: d,
|
|
1973
|
+
para: m
|
|
1974
|
+
}), c = [], l = 0, u = 0, d = null);
|
|
1975
|
+
}, g = () => {
|
|
1976
|
+
if (c.length === 0) {
|
|
1977
|
+
o.push({
|
|
1973
1978
|
segments: [],
|
|
1974
|
-
maxFontSize:
|
|
1975
|
-
maxFontFamily:
|
|
1976
|
-
para:
|
|
1979
|
+
maxFontSize: f || On,
|
|
1980
|
+
maxFontFamily: p,
|
|
1981
|
+
para: m
|
|
1977
1982
|
});
|
|
1978
1983
|
return;
|
|
1979
1984
|
}
|
|
1980
|
-
|
|
1981
|
-
},
|
|
1985
|
+
h();
|
|
1986
|
+
}, _ = (t, n) => {
|
|
1982
1987
|
if (!t) return;
|
|
1983
|
-
|
|
1988
|
+
f = n.size, p = n.name, e.font = Yn(cr(n), r);
|
|
1984
1989
|
let a = e.measureText(t).width;
|
|
1985
|
-
if (
|
|
1986
|
-
let i =
|
|
1987
|
-
a > 0 ? a = rr(i, a) : !
|
|
1988
|
-
let o =
|
|
1989
|
-
a >
|
|
1990
|
+
if (c.length > 0 && l + a > i) {
|
|
1991
|
+
let i = c.flatMap((e) => [...e.text]), a = nr(i, [...t]);
|
|
1992
|
+
a > 0 ? a = rr(i, a) : !k(t) && !k(c[c.length - 1]?.text ?? "") && !/^\s/u.test(t) && !/\s$/u.test(i.at(-1) ?? "") && (a = ir(i, [...t]));
|
|
1993
|
+
let o = c[c.length - 1], s = [...o.text];
|
|
1994
|
+
a > s.length && (a = s.length);
|
|
1990
1995
|
let f = null;
|
|
1991
1996
|
if (a > 0) {
|
|
1992
|
-
let t =
|
|
1993
|
-
if (e.font = Yn(cr(o.font), r), t.length === 0)
|
|
1997
|
+
let t = s.slice(0, s.length - a), n = s.slice(s.length - a);
|
|
1998
|
+
if (e.font = Yn(cr(o.font), r), t.length === 0) c.pop();
|
|
1994
1999
|
else {
|
|
1995
2000
|
let n = t.join("");
|
|
1996
2001
|
o.text = n, o.width = e.measureText(n).width;
|
|
@@ -2002,32 +2007,32 @@ function or(e, t, n, r, i) {
|
|
|
2002
2007
|
width: e.measureText(i).width
|
|
2003
2008
|
};
|
|
2004
2009
|
}
|
|
2005
|
-
|
|
2010
|
+
h(), f && (c.push(f), l += f.width, f.font.size > u && (u = f.font.size, d = f.font.name)), e.font = Yn(cr(n), r);
|
|
2006
2011
|
}
|
|
2007
|
-
|
|
2012
|
+
c.push({
|
|
2008
2013
|
text: t,
|
|
2009
2014
|
font: n,
|
|
2010
2015
|
width: a
|
|
2011
|
-
}),
|
|
2012
|
-
},
|
|
2013
|
-
let
|
|
2014
|
-
if (
|
|
2015
|
-
|
|
2016
|
+
}), l += a, n.size > u && (u = n.size, d = n.name);
|
|
2017
|
+
}, v = (t, n) => {
|
|
2018
|
+
let o = b(t);
|
|
2019
|
+
if (o.length === 0) {
|
|
2020
|
+
_(t, n);
|
|
2016
2021
|
return;
|
|
2017
2022
|
}
|
|
2018
2023
|
e.font = Yn(cr(n), r);
|
|
2019
|
-
let
|
|
2020
|
-
for (;
|
|
2021
|
-
let e = i -
|
|
2022
|
-
if (r <=
|
|
2023
|
-
if (
|
|
2024
|
-
|
|
2024
|
+
let c = (t) => e.measureText(t).width, u = re(t), d = t.length, f = 0;
|
|
2025
|
+
for (; f < d;) {
|
|
2026
|
+
let e = i - l, r = s(t, o, f, e, c, u);
|
|
2027
|
+
if (r <= f) {
|
|
2028
|
+
if (l > 0) {
|
|
2029
|
+
h();
|
|
2025
2030
|
continue;
|
|
2026
2031
|
}
|
|
2027
|
-
let n =
|
|
2028
|
-
|
|
2032
|
+
let n = o.find((e) => e > f) ?? d, i = t.slice(f, n), p = a(i), m = s(i, p, 0, e, c, u);
|
|
2033
|
+
m <= 0 && (m = p.length > 0 ? p[0] : i.length), r = f + m;
|
|
2029
2034
|
}
|
|
2030
|
-
|
|
2035
|
+
_(t.slice(f, r), n), f = r, f < d && h();
|
|
2031
2036
|
}
|
|
2032
2037
|
};
|
|
2033
2038
|
for (let e of t) {
|
|
@@ -2035,7 +2040,7 @@ function or(e, t, n, r, i) {
|
|
|
2035
2040
|
for (; i < e.text.length;) {
|
|
2036
2041
|
let t = e.text[i], n = t.codePointAt(0) ?? 0;
|
|
2037
2042
|
if (n === 10) r.push("\n"), i += 1;
|
|
2038
|
-
else if (
|
|
2043
|
+
else if (T(n)) r.push(t), i += n > 65535 ? 2 : 1;
|
|
2039
2044
|
else if (t === " ") {
|
|
2040
2045
|
let t = i;
|
|
2041
2046
|
for (; t < e.text.length && e.text[t] === " ";) t++;
|
|
@@ -2044,15 +2049,15 @@ function or(e, t, n, r, i) {
|
|
|
2044
2049
|
let t = i;
|
|
2045
2050
|
for (; t < e.text.length;) {
|
|
2046
2051
|
let n = e.text[t], r = n.codePointAt(0) ?? 0;
|
|
2047
|
-
if (n === " " || n === "\n" ||
|
|
2052
|
+
if (n === " " || n === "\n" || T(r)) break;
|
|
2048
2053
|
t += r > 65535 ? 2 : 1;
|
|
2049
2054
|
}
|
|
2050
2055
|
r.push(e.text.slice(i, t)), i = t;
|
|
2051
2056
|
}
|
|
2052
2057
|
}
|
|
2053
|
-
for (let e of r) e === "\n" ? (
|
|
2058
|
+
for (let e of r) e === "\n" ? (g(), m++) : k(e) ? v(e, t) : _(e, t);
|
|
2054
2059
|
}
|
|
2055
|
-
return (
|
|
2060
|
+
return (c.length > 0 || o.length > 0) && g(), o;
|
|
2056
2061
|
}
|
|
2057
2062
|
function sr(e, t, n) {
|
|
2058
2063
|
return e === "middle" ? {
|
|
@@ -2076,29 +2081,29 @@ function lr(e, t, n, r, i, a, o, s) {
|
|
|
2076
2081
|
e.textAlign = "left", e.textBaseline = i;
|
|
2077
2082
|
let c = s.needBidi ? gn(t, s.baseRtl ?? !1) : null, l = e, u = n;
|
|
2078
2083
|
for (let n = 0; n < t.length; n++) {
|
|
2079
|
-
let
|
|
2084
|
+
let f = c ? c.order[n] : n;
|
|
2080
2085
|
if (c) try {
|
|
2081
|
-
l.direction = c.rtl[
|
|
2086
|
+
l.direction = c.rtl[f] ? "rtl" : "ltr";
|
|
2082
2087
|
} catch {}
|
|
2083
|
-
let
|
|
2084
|
-
e.font = Yn(
|
|
2085
|
-
let
|
|
2086
|
-
e.fillStyle =
|
|
2087
|
-
let
|
|
2088
|
-
|
|
2089
|
-
let
|
|
2090
|
-
if (
|
|
2091
|
-
let t = sr(i, r,
|
|
2092
|
-
if (
|
|
2093
|
-
let n =
|
|
2094
|
-
Qn(e, u, u +
|
|
2088
|
+
let p = t[f], m = cr(p.font);
|
|
2089
|
+
e.font = Yn(m, a);
|
|
2090
|
+
let h = s.fontColor ?? p.font.color;
|
|
2091
|
+
e.fillStyle = h ? J(h) : "#000000";
|
|
2092
|
+
let g = Jn(p.font.size, a), _ = 0;
|
|
2093
|
+
p.font.vertAlign === "superscript" ? _ = -Math.round(g * .35) : p.font.vertAlign === "subscript" && (_ = Math.round(g * .1)), e.fillText(p.text, u, r + _);
|
|
2094
|
+
let v = Jn(m.size, a);
|
|
2095
|
+
if (p.font.underline || p.font.strike) {
|
|
2096
|
+
let t = sr(i, r, v);
|
|
2097
|
+
if (p.font.underline) {
|
|
2098
|
+
let n = h ? J(h) : "#000000", r = p.font.underlineStyle === "double" || p.font.underlineStyle === "doubleAccounting";
|
|
2099
|
+
Qn(e, u, u + p.width, t.underline + _, n, r, o);
|
|
2095
2100
|
}
|
|
2096
|
-
if (
|
|
2097
|
-
let n = t.strike +
|
|
2098
|
-
e.save(), e.strokeStyle =
|
|
2101
|
+
if (p.font.strike) {
|
|
2102
|
+
let n = t.strike + _, r = n + d(n, .5, o);
|
|
2103
|
+
e.save(), e.strokeStyle = h ? J(h) : "#000000", e.lineWidth = .5, e.beginPath(), e.moveTo(u, r), e.lineTo(u + p.width, r), e.stroke(), e.restore();
|
|
2099
2104
|
}
|
|
2100
2105
|
}
|
|
2101
|
-
u +=
|
|
2106
|
+
u += p.width;
|
|
2102
2107
|
}
|
|
2103
2108
|
if (c) try {
|
|
2104
2109
|
l.direction = "ltr";
|
|
@@ -2304,272 +2309,272 @@ function wr(e) {
|
|
|
2304
2309
|
let n = parseInt(t.slice(0, 2), 16), r = parseInt(t.slice(2, 4), 16), i = parseInt(t.slice(4, 6), 16), a = (e) => Math.round(e * .2 + 255 * .8), o = (e) => e.toString(16).padStart(2, "0").toUpperCase();
|
|
2305
2310
|
return `#${o(a(n))}${o(a(r))}${o(a(i))}`;
|
|
2306
2311
|
}
|
|
2307
|
-
function Tr(e, t, n, r,
|
|
2308
|
-
if (
|
|
2309
|
-
let { styles:
|
|
2310
|
-
for (let e = 0; e <
|
|
2311
|
-
let
|
|
2312
|
-
for (let e = 0; e <
|
|
2313
|
-
e.save(), e.beginPath(), e.rect(
|
|
2312
|
+
function Tr(e, t, n, r, a, o, s, c, l, u, f, p, m, h) {
|
|
2313
|
+
if (m <= 0 || h <= 0) return;
|
|
2314
|
+
let { styles: g, cellMap: _, mergeAnchorMap: v, mergeSkipSet: y, cfContext: b, cs: x, dpr: S } = t, C = a.length, w = o.length, T = (e, n) => t.rtl ? An(e, n, t.canvasW) : e, E = [], D = -s;
|
|
2315
|
+
for (let e = 0; e < C; e++) E.push(D), D += a[e];
|
|
2316
|
+
let O = [], ee = -c;
|
|
2317
|
+
for (let e = 0; e < w; e++) O.push(ee), ee += o[e];
|
|
2318
|
+
e.save(), e.beginPath(), e.rect(T(f, m), p, m, h), e.clip();
|
|
2314
2319
|
let k = [], A = [], j = [];
|
|
2315
2320
|
for (let i of t.worksheet.mergeCells ?? []) {
|
|
2316
|
-
let a = i.top,
|
|
2317
|
-
if (a >= n && a < n +
|
|
2318
|
-
let d = t.mergeAnchorMap.get(`${a}:${
|
|
2321
|
+
let a = i.top, o = i.left;
|
|
2322
|
+
if (a >= n && a < n + w && o >= r && o < r + C || i.bottom < n || i.top >= n + w || i.right < r || i.left >= r + C) continue;
|
|
2323
|
+
let d = t.mergeAnchorMap.get(`${a}:${o}`);
|
|
2319
2324
|
if (!d) continue;
|
|
2320
2325
|
let f;
|
|
2321
|
-
if (
|
|
2326
|
+
if (o >= r) f = l + E[o - r];
|
|
2322
2327
|
else {
|
|
2323
2328
|
let e = 0;
|
|
2324
|
-
for (let n =
|
|
2325
|
-
f =
|
|
2329
|
+
for (let n = o; n < r; n++) e += Math.round(Q(t.worksheet.colWidths[n] ?? t.worksheet.defaultColWidth, t.mdw) * x);
|
|
2330
|
+
f = l - s - e;
|
|
2326
2331
|
}
|
|
2327
2332
|
let p;
|
|
2328
|
-
if (a >= n) p =
|
|
2333
|
+
if (a >= n) p = u + O[a - n];
|
|
2329
2334
|
else {
|
|
2330
2335
|
let e = 0;
|
|
2331
|
-
for (let r = a; r < n; r++) e += Math.round($(t.worksheet.rowHeights[r] ?? t.worksheet.defaultRowHeight) *
|
|
2332
|
-
p =
|
|
2333
|
-
}
|
|
2334
|
-
let
|
|
2335
|
-
f =
|
|
2336
|
-
let _ = `${a}:${
|
|
2337
|
-
if (Un(e,
|
|
2338
|
-
let t = Math.max(0, (
|
|
2339
|
-
Rn(e,
|
|
2340
|
-
}
|
|
2341
|
-
let
|
|
2342
|
-
if (A.push(() => qr(e,
|
|
2343
|
-
let
|
|
2344
|
-
if (!
|
|
2345
|
-
let
|
|
2346
|
-
...
|
|
2347
|
-
bold:
|
|
2348
|
-
italic:
|
|
2349
|
-
underline:
|
|
2350
|
-
strike:
|
|
2351
|
-
} :
|
|
2352
|
-
e.font = Yn(
|
|
2353
|
-
let
|
|
2354
|
-
e.fillStyle =
|
|
2355
|
-
let
|
|
2356
|
-
e.save(), e.beginPath(), e.rect(f, p,
|
|
2357
|
-
let
|
|
2358
|
-
|
|
2359
|
-
let re =
|
|
2360
|
-
if (
|
|
2361
|
-
alignH:
|
|
2362
|
-
alignV:
|
|
2336
|
+
for (let r = a; r < n; r++) e += Math.round($(t.worksheet.rowHeights[r] ?? t.worksheet.defaultRowHeight) * x);
|
|
2337
|
+
p = u - c - e;
|
|
2338
|
+
}
|
|
2339
|
+
let m = d.totalW, h = d.totalH;
|
|
2340
|
+
f = T(f, m);
|
|
2341
|
+
let _ = `${a}:${o}`, v = t.cellMap.get(_), { font: y, fill: D, border: ee, xf: k } = er(g, v?.styleIndex ?? 0), j = fn(v, a, o, b, g.dxfs ?? []);
|
|
2342
|
+
if (Un(e, j.fill ?? D, f, p, m, h), j.dataBar && j.dataBar.ratio > 0) {
|
|
2343
|
+
let t = Math.max(0, (m - 4) * j.dataBar.ratio);
|
|
2344
|
+
Rn(e, j.dataBar.color, f + 2, p + 2, t, h - 4, j.dataBar.gradient);
|
|
2345
|
+
}
|
|
2346
|
+
let te = Kr(Gr(ee, a, o, d.right, d.bottom, t.cellMap, g), j.border);
|
|
2347
|
+
if (A.push(() => qr(e, te, f, p, m, h, S)), !v) continue;
|
|
2348
|
+
let M = xt(v, g, j.numFmt, t.worksheet.date1904), N = M.text;
|
|
2349
|
+
if (!N || N === "0" && t.worksheet.showZeros === !1) continue;
|
|
2350
|
+
let P = y.bold || !!j.fontBold, F = y.italic || !!j.fontItalic, I = y.underline || !!j.fontUnderline, L = y.strike || !!j.fontStrike, R = P !== y.bold || F !== y.italic || I !== y.underline || L !== y.strike ? {
|
|
2351
|
+
...y,
|
|
2352
|
+
bold: P,
|
|
2353
|
+
italic: F,
|
|
2354
|
+
underline: I,
|
|
2355
|
+
strike: L
|
|
2356
|
+
} : y;
|
|
2357
|
+
e.font = Yn(R, x);
|
|
2358
|
+
let z = t.hyperlinkMap.get(_) ? "#0563C1" : j.fontColor ?? M.color ?? y.color;
|
|
2359
|
+
e.fillStyle = z ? J(z) : "#000000";
|
|
2360
|
+
let B = v.value.type === "number", V = k.alignH ?? (B ? "right" : "left"), H = k.alignV ?? "bottom", U = k.indent ? Math.round(k.indent * 3 * t.mdw) : 0, ne = 3 + (V === "left" || !k.alignH ? U : 0);
|
|
2361
|
+
e.save(), e.beginPath(), e.rect(f, p, m, h), e.clip();
|
|
2362
|
+
let W;
|
|
2363
|
+
V === "right" ? (W = f + m - 3, e.textAlign = "right") : V === "center" ? (W = f + m / 2, e.textAlign = "center") : (W = f + ne, e.textAlign = "left");
|
|
2364
|
+
let re = v.value.type === "text" ? v.value.runs : void 0, ie = re && re.length > 0;
|
|
2365
|
+
if (k.wrapText && ie) mr(e, re, R, {
|
|
2366
|
+
alignH: V,
|
|
2367
|
+
alignV: H,
|
|
2363
2368
|
cx: f,
|
|
2364
2369
|
cy: p,
|
|
2365
|
-
cellW:
|
|
2366
|
-
cellH:
|
|
2370
|
+
cellW: m,
|
|
2371
|
+
cellH: h,
|
|
2367
2372
|
leftPad: ne,
|
|
2368
2373
|
paddingX: 3,
|
|
2369
2374
|
paddingY: 2
|
|
2370
|
-
},
|
|
2371
|
-
fontColor:
|
|
2372
|
-
readingOrder:
|
|
2375
|
+
}, x, S, {
|
|
2376
|
+
fontColor: j.fontColor,
|
|
2377
|
+
readingOrder: k.readingOrder
|
|
2373
2378
|
});
|
|
2374
|
-
else if (
|
|
2375
|
-
let t = tr(e,
|
|
2376
|
-
i =
|
|
2377
|
-
for (let r = 0; r < t.length; r++) e.fillText(t[r],
|
|
2378
|
-
} else if (ie) pr(e, re,
|
|
2379
|
-
alignH:
|
|
2380
|
-
alignV:
|
|
2379
|
+
else if (k.wrapText) {
|
|
2380
|
+
let t = tr(e, N, m - ne - 3), n = Jn(y.size, x, 1.2, y.name ?? void 0), r = t.length * n, i;
|
|
2381
|
+
i = H === "top" ? p + 2 : H === "center" ? p + (h - r) / 2 : p + h - r - 2, e.textBaseline = "top";
|
|
2382
|
+
for (let r = 0; r < t.length; r++) e.fillText(t[r], W, i + r * n);
|
|
2383
|
+
} else if (ie) pr(e, re, R, {
|
|
2384
|
+
alignH: V,
|
|
2385
|
+
alignV: H,
|
|
2381
2386
|
cx: f,
|
|
2382
2387
|
cy: p,
|
|
2383
|
-
cellW:
|
|
2384
|
-
cellH:
|
|
2388
|
+
cellW: m,
|
|
2389
|
+
cellH: h,
|
|
2385
2390
|
leftPad: ne,
|
|
2386
2391
|
paddingX: 3,
|
|
2387
2392
|
paddingY: 2
|
|
2388
|
-
},
|
|
2389
|
-
fontColor:
|
|
2390
|
-
readingOrder:
|
|
2393
|
+
}, x, S, {
|
|
2394
|
+
fontColor: j.fontColor,
|
|
2395
|
+
readingOrder: k.readingOrder
|
|
2391
2396
|
});
|
|
2392
2397
|
else {
|
|
2393
2398
|
let t;
|
|
2394
|
-
|
|
2399
|
+
H === "top" ? (e.textBaseline = "top", t = p + 2) : H === "center" ? (e.textBaseline = "middle", t = p + h / 2) : (e.textBaseline = "bottom", t = p + h - 2), e.fillText(N, W, t);
|
|
2395
2400
|
}
|
|
2396
2401
|
e.restore();
|
|
2397
2402
|
}
|
|
2398
|
-
for (let
|
|
2399
|
-
let
|
|
2400
|
-
if (
|
|
2401
|
-
let
|
|
2402
|
-
if (
|
|
2403
|
-
for (let t =
|
|
2404
|
-
for (let t =
|
|
2403
|
+
for (let s = 0; s < w; s++) {
|
|
2404
|
+
let c = n + s, w = u + O[s], D = o[s];
|
|
2405
|
+
if (w + D <= p || w >= p + h) continue;
|
|
2406
|
+
let ee = /* @__PURE__ */ new Set(), te = /* @__PURE__ */ new Set(), M = -1, N = (e) => {
|
|
2407
|
+
if (M >= 0 && e - M >= 2) {
|
|
2408
|
+
for (let t = M; t < e - 1; t++) ee.add(t);
|
|
2409
|
+
for (let t = M + 1; t < e; t++) te.add(t);
|
|
2405
2410
|
}
|
|
2406
|
-
|
|
2411
|
+
M = -1;
|
|
2407
2412
|
};
|
|
2408
|
-
for (let e = 0; e <=
|
|
2413
|
+
for (let e = 0; e <= C; e++) {
|
|
2409
2414
|
let t = !1, n = !1;
|
|
2410
|
-
if (e <
|
|
2411
|
-
let i = `${
|
|
2412
|
-
if (!
|
|
2413
|
-
let e =
|
|
2414
|
-
t = er(
|
|
2415
|
+
if (e < C) {
|
|
2416
|
+
let i = `${c}:${r + e}`;
|
|
2417
|
+
if (!y.has(i) && !v.has(i)) {
|
|
2418
|
+
let e = _.get(i);
|
|
2419
|
+
t = er(g, e?.styleIndex ?? 0).xf.alignH === "centerContinuous", n = !!(e && e.value && e.value.type !== "empty");
|
|
2415
2420
|
}
|
|
2416
2421
|
}
|
|
2417
|
-
t ? n &&
|
|
2418
|
-
}
|
|
2419
|
-
for (let n = 0; n <
|
|
2420
|
-
let
|
|
2421
|
-
if (
|
|
2422
|
-
let
|
|
2423
|
-
if (
|
|
2424
|
-
let
|
|
2425
|
-
if (Un(e,
|
|
2426
|
-
let t = Math.max(0, (
|
|
2427
|
-
Rn(e,
|
|
2422
|
+
t ? n && M >= 0 && e > M ? (N(e), M = e) : M < 0 && (M = e) : N(e);
|
|
2423
|
+
}
|
|
2424
|
+
for (let n = 0; n < C; n++) {
|
|
2425
|
+
let o = r + n, u = l + E[n], p = a[n];
|
|
2426
|
+
if (u + p <= f || u >= f + m) continue;
|
|
2427
|
+
let h = `${c}:${o}`;
|
|
2428
|
+
if (y.has(h)) continue;
|
|
2429
|
+
let O = v.get(h), M = O ? O.totalW : p, N = O ? O.totalH : D, P = T(u, M), F = _.get(h), { font: L, fill: R, border: z, xf: B } = er(g, F?.styleIndex ?? 0), V = fn(F, c, o, b, g.dxfs ?? []), H = V.fill ?? R, U = t.tableStyleMap.get(h), ne = g.dxfs ?? [], W = (e) => e == null ? void 0 : ne[e], re = W(U?.wholeTableDxf), ie = W(U?.headerRowDxf), ae = W(U?.totalRowDxf), oe = W(U?.firstColumnDxf), se = W(U?.lastColumnDxf), ce = W(U?.stripeDxf), le = U?.isHeader && ie?.fill?.fgColor ? ie : U?.isTotals && ae?.fill?.fgColor ? ae : U?.isLastCol && se?.fill?.fgColor ? se : U?.isFirstCol && oe?.fill?.fgColor ? oe : ce?.fill?.fgColor ? ce : !U?.isHeader && !U?.isTotals && re?.fill?.fgColor ? re : void 0;
|
|
2430
|
+
if (Un(e, H, P, w, M, N) || (U && le?.fill?.fgColor ? (e.fillStyle = J(le.fill.fgColor), e.fillRect(P, w, M, N)) : U && !U.isCustom && U.isBanded && (e.fillStyle = wr(U.accent), e.fillRect(P, w, M, N))), t.commentCells.has(h) && Kn(e, P, w, M, N), V.dataBar && V.dataBar.ratio > 0) {
|
|
2431
|
+
let t = Math.max(0, (M - 4) * V.dataBar.ratio);
|
|
2432
|
+
Rn(e, V.dataBar.color, P + 2, w + 2, t, N - 4, V.dataBar.gradient);
|
|
2428
2433
|
}
|
|
2429
|
-
let ue = t.sparklineMap.get(
|
|
2430
|
-
if (ue &&
|
|
2431
|
-
x:
|
|
2432
|
-
y:
|
|
2433
|
-
w:
|
|
2434
|
-
h:
|
|
2434
|
+
let ue = t.sparklineMap.get(h);
|
|
2435
|
+
if (ue && De(e, {
|
|
2436
|
+
x: P,
|
|
2437
|
+
y: w,
|
|
2438
|
+
w: M,
|
|
2439
|
+
h: N
|
|
2435
2440
|
}, ue), t.worksheet.showGridlines !== !1) {
|
|
2436
|
-
if (e.strokeStyle = "#d0d0d0", e.lineWidth = .5, e.beginPath(), !
|
|
2437
|
-
let t =
|
|
2438
|
-
e.moveTo(t,
|
|
2441
|
+
if (e.strokeStyle = "#d0d0d0", e.lineWidth = .5, e.beginPath(), !ee.has(n)) {
|
|
2442
|
+
let t = P + M + d(P + M, .5, S);
|
|
2443
|
+
e.moveTo(t, w), e.lineTo(t, w + N);
|
|
2439
2444
|
}
|
|
2440
|
-
let t =
|
|
2441
|
-
if (e.moveTo(
|
|
2442
|
-
let t =
|
|
2443
|
-
e.moveTo(
|
|
2445
|
+
let t = w + N + d(w + N, .5, S);
|
|
2446
|
+
if (e.moveTo(P, t), e.lineTo(P + M, t), s === 0) {
|
|
2447
|
+
let t = w + d(w, .5, S);
|
|
2448
|
+
e.moveTo(P, t), e.lineTo(P + M, t);
|
|
2444
2449
|
}
|
|
2445
2450
|
if (n === 0) {
|
|
2446
|
-
let t =
|
|
2447
|
-
e.moveTo(t,
|
|
2451
|
+
let t = P + d(P, .5, S);
|
|
2452
|
+
e.moveTo(t, w), e.lineTo(t, w + N);
|
|
2448
2453
|
}
|
|
2449
2454
|
e.stroke();
|
|
2450
2455
|
}
|
|
2451
|
-
let
|
|
2452
|
-
(
|
|
2453
|
-
...
|
|
2454
|
-
left:
|
|
2455
|
-
right:
|
|
2456
|
+
let G = Kr(O ? Gr(z, c, o, O.right, O.bottom, _, g) : z, V.border);
|
|
2457
|
+
(ee.has(n) || te.has(n)) && (G = {
|
|
2458
|
+
...G,
|
|
2459
|
+
left: te.has(n) ? null : G.left,
|
|
2460
|
+
right: ee.has(n) ? null : G.right
|
|
2456
2461
|
});
|
|
2457
|
-
let de =
|
|
2458
|
-
if (fe?.style && (
|
|
2459
|
-
...
|
|
2460
|
-
top: Zr(
|
|
2461
|
-
}), !
|
|
2462
|
-
let e =
|
|
2463
|
-
t?.style && (n === 0 ||
|
|
2464
|
-
...
|
|
2465
|
-
left: Zr(
|
|
2462
|
+
let de = _.get(`${c - 1}:${o}`), fe = de ? er(g, de.styleIndex ?? 0).border.bottom : null;
|
|
2463
|
+
if (fe?.style && (s === 0 || G.top?.style) && (G = {
|
|
2464
|
+
...G,
|
|
2465
|
+
top: Zr(G.top, fe)
|
|
2466
|
+
}), !te.has(n)) {
|
|
2467
|
+
let e = _.get(`${c}:${o - 1}`), t = e ? er(g, e.styleIndex ?? 0).border.right : null;
|
|
2468
|
+
t?.style && (n === 0 || G.left?.style) && (G = {
|
|
2469
|
+
...G,
|
|
2470
|
+
left: Zr(G.left, t)
|
|
2466
2471
|
});
|
|
2467
2472
|
}
|
|
2468
|
-
let
|
|
2469
|
-
if (
|
|
2470
|
-
if (
|
|
2471
|
-
else if (
|
|
2472
|
-
let t = .5 /
|
|
2473
|
-
if (e.strokeStyle =
|
|
2474
|
-
let t =
|
|
2475
|
-
e.moveTo(
|
|
2473
|
+
let K = U ? Sr(U, re, ie, o) : null, pe = t.autoFilterCells.has(h), me = () => {
|
|
2474
|
+
if (K) {
|
|
2475
|
+
if (K.kind === "dxf") qr(e, K.border, P, w, M, N, S);
|
|
2476
|
+
else if (K.kind === "accent") {
|
|
2477
|
+
let t = .5 / S;
|
|
2478
|
+
if (e.strokeStyle = K.color, e.lineWidth = K.lineWidth, e.beginPath(), e.moveTo(P, w + N - t), e.lineTo(P + M, w + N - t), K.topEdge) {
|
|
2479
|
+
let t = w + d(w, K.lineWidth, S);
|
|
2480
|
+
e.moveTo(P, t), e.lineTo(P + M, t);
|
|
2476
2481
|
}
|
|
2477
2482
|
e.stroke();
|
|
2478
2483
|
}
|
|
2479
2484
|
}
|
|
2480
|
-
pe && br(e,
|
|
2485
|
+
pe && br(e, P, w, p, N);
|
|
2481
2486
|
};
|
|
2482
|
-
if (
|
|
2483
|
-
let t =
|
|
2484
|
-
A.push(() => qr(e, t,
|
|
2487
|
+
if (O) {
|
|
2488
|
+
let t = G;
|
|
2489
|
+
A.push(() => qr(e, t, P, w, M, N, S)), me();
|
|
2485
2490
|
} else {
|
|
2486
|
-
let t =
|
|
2491
|
+
let t = G;
|
|
2487
2492
|
j.push(() => {
|
|
2488
|
-
qr(e, t,
|
|
2493
|
+
qr(e, t, P, w, M, N, S), me();
|
|
2489
2494
|
});
|
|
2490
2495
|
}
|
|
2491
|
-
if (!
|
|
2492
|
-
let he = xt(
|
|
2493
|
-
!
|
|
2494
|
-
let
|
|
2495
|
-
...
|
|
2496
|
-
bold:
|
|
2497
|
-
italic:
|
|
2498
|
-
underline:
|
|
2499
|
-
strike:
|
|
2500
|
-
} :
|
|
2501
|
-
e.font = Yn(
|
|
2502
|
-
let
|
|
2503
|
-
e.fillStyle =
|
|
2504
|
-
let
|
|
2505
|
-
if (k === "centerContinuous" && !
|
|
2506
|
-
let t = `${
|
|
2507
|
-
if (
|
|
2508
|
-
let n =
|
|
2509
|
-
if (n && n.value.type !== "empty" || er(
|
|
2510
|
-
|
|
2496
|
+
if (!F) continue;
|
|
2497
|
+
let he = xt(F, g, V.numFmt, t.worksheet.date1904), q = he.text;
|
|
2498
|
+
!q || q === "0" && t.worksheet.showZeros === !1 || k.push(() => {
|
|
2499
|
+
let s = U?.isHeader ? ie : U?.isTotals ? ae : U?.isLastCol && se ? se : U?.isFirstCol && oe ? oe : ce || (U ? re : void 0), l = U ? U.isCustom ? !!s?.font?.bold : U.isHeader || U.isTotals : !1, u = L.bold || !!V.fontBold || l, f = L.italic || !!V.fontItalic, p = L.underline || !!V.fontUnderline, m = L.strike || !!V.fontStrike, b = u !== L.bold || f !== L.italic || p !== L.underline || m !== L.strike ? {
|
|
2500
|
+
...L,
|
|
2501
|
+
bold: u,
|
|
2502
|
+
italic: f,
|
|
2503
|
+
underline: p,
|
|
2504
|
+
strike: m
|
|
2505
|
+
} : L;
|
|
2506
|
+
e.font = Yn(b, x);
|
|
2507
|
+
let T = t.hyperlinkMap.get(h), E = s?.font?.color ?? null, D = T ? "#0563C1" : V.fontColor ?? he.color ?? E ?? L.color;
|
|
2508
|
+
e.fillStyle = D ? J(D) : "#000000";
|
|
2509
|
+
let ee = F.value.type === "number", k = B.alignH ?? (ee ? "right" : "left"), A = B.alignV ?? "bottom", j = B.indent ? Math.round(B.indent * 3 * t.mdw) : 0, te = V.iconSet ? Math.max(8, Math.round(Math.min(M, N) * .55)) : 0, R = te > 0 ? te + 4 : 0, z = 3 + (k === "left" || !B.alignH ? j : 0) + R, H = M, ne = P, W = n;
|
|
2510
|
+
if (k === "centerContinuous" && !O) for (let e = n + 1; e < C; e++) {
|
|
2511
|
+
let t = `${c}:${r + e}`;
|
|
2512
|
+
if (y.has(t) || v.has(t)) break;
|
|
2513
|
+
let n = _.get(t);
|
|
2514
|
+
if (n && n.value.type !== "empty" || er(g, n?.styleIndex ?? 0).xf.alignH !== "centerContinuous") break;
|
|
2515
|
+
H += a[e], W = e;
|
|
2511
2516
|
}
|
|
2512
|
-
let le = k === "centerContinuous" ? ne :
|
|
2513
|
-
if (!
|
|
2514
|
-
let t = e.measureText(
|
|
2515
|
-
if (o >
|
|
2516
|
-
let e = o -
|
|
2517
|
-
if (k === "right" ? l = e : k === "center" ||
|
|
2518
|
-
let e = t, o =
|
|
2519
|
-
for (let t = o; t <
|
|
2520
|
-
let n = `${
|
|
2521
|
-
if (
|
|
2522
|
-
let
|
|
2523
|
-
if (
|
|
2524
|
-
ue +=
|
|
2517
|
+
let le = k === "centerContinuous" ? ne : P, ue = k === "centerContinuous" ? H : M, G = q.includes("\n");
|
|
2518
|
+
if (!O && !B.wrapText && !B.textRotation && !ee && !G) {
|
|
2519
|
+
let t = e.measureText(q).width, i = k === "centerContinuous", o = i ? t + 6 : t + z + 3, s = i ? H : M;
|
|
2520
|
+
if (o > s) {
|
|
2521
|
+
let e = o - s, t = 0, l = 0;
|
|
2522
|
+
if (k === "right" ? l = e : k === "center" || i ? (l = e / 2, t = e / 2) : t = e, t > 0) {
|
|
2523
|
+
let e = t, o = i ? W + 1 : n + 1;
|
|
2524
|
+
for (let t = o; t < C && e > 0; t++) {
|
|
2525
|
+
let n = `${c}:${r + t}`;
|
|
2526
|
+
if (y.has(n) || v.has(n)) break;
|
|
2527
|
+
let i = _.get(n);
|
|
2528
|
+
if (i && i.value.type !== "empty") break;
|
|
2529
|
+
ue += a[t], e -= a[t];
|
|
2525
2530
|
}
|
|
2526
2531
|
}
|
|
2527
2532
|
if (l > 0) {
|
|
2528
2533
|
let e = l;
|
|
2529
2534
|
for (let t = n - 1; t >= 0 && e > 0; t--) {
|
|
2530
|
-
let n = `${
|
|
2531
|
-
if (
|
|
2532
|
-
let
|
|
2533
|
-
if (
|
|
2534
|
-
le -=
|
|
2535
|
+
let n = `${c}:${r + t}`;
|
|
2536
|
+
if (y.has(n) || v.has(n)) break;
|
|
2537
|
+
let i = _.get(n);
|
|
2538
|
+
if (i && i.value.type !== "empty") break;
|
|
2539
|
+
le -= a[t], ue += a[t], e -= a[t];
|
|
2535
2540
|
}
|
|
2536
2541
|
}
|
|
2537
2542
|
}
|
|
2538
2543
|
}
|
|
2539
|
-
let de =
|
|
2540
|
-
if (k === "fill" && !
|
|
2541
|
-
let t = Math.max(1,
|
|
2544
|
+
let de = q, fe = 0;
|
|
2545
|
+
if (k === "fill" && !ee && q.length > 0) {
|
|
2546
|
+
let t = Math.max(1, M - 6), n = e.measureText(q).width;
|
|
2542
2547
|
if (n > 0 && n < t) {
|
|
2543
2548
|
let e = Math.max(1, Math.floor(t / n));
|
|
2544
|
-
de =
|
|
2549
|
+
de = q.repeat(e);
|
|
2545
2550
|
}
|
|
2546
2551
|
}
|
|
2547
|
-
if (k === "distributed" || k === "justify" && !
|
|
2548
|
-
let t = Math.max(1,
|
|
2552
|
+
if (k === "distributed" || k === "justify" && !B.wrapText && !G) {
|
|
2553
|
+
let t = Math.max(1, M - 6), n = e.measureText(de).width, r = Math.max(1, [...de].length - 1);
|
|
2549
2554
|
n < t && (fe = Math.max(0, (t - n) / r));
|
|
2550
2555
|
}
|
|
2551
|
-
let
|
|
2552
|
-
k === "right" ? (
|
|
2553
|
-
let me =
|
|
2554
|
-
if (
|
|
2555
|
-
let t = Jn(
|
|
2556
|
+
let K, pe;
|
|
2557
|
+
k === "right" ? (K = P + M - 3, pe = "right") : k === "center" ? (K = P + M / 2, pe = "center") : k === "centerContinuous" ? (K = ne + H / 2, pe = "center") : k === "distributed" || k === "justify" && !B.wrapText && !G ? (K = P + 3, pe = "left") : (K = P + z, pe = "left");
|
|
2558
|
+
let me = B.textRotation ?? 0, ge = me === 255, _e = me > 0 && me !== 255;
|
|
2559
|
+
if (V.iconSet && te > 0 && (e.save(), e.beginPath(), e.rect(P, w, M, N), e.clip(), yr(e, V.iconSet.name, V.iconSet.index, P + 2, w + (N - te) / 2, te), e.restore()), e.save(), e.beginPath(), e.rect(le, w, ue, N), e.clip(), ge) {
|
|
2560
|
+
let t = Jn(L.size, x, 1.1), n = [...q].length * t, r = A === "top" ? w + 2 : A === "center" ? w + (N - n) / 2 : w + N - n - 2;
|
|
2556
2561
|
e.textAlign = "center", e.textBaseline = "top";
|
|
2557
|
-
for (let n of
|
|
2558
|
-
let
|
|
2559
|
-
yn(e, n,
|
|
2562
|
+
for (let n of q) {
|
|
2563
|
+
let a = n.codePointAt(0) ?? 0, o = i(a) && I(e, a);
|
|
2564
|
+
yn(e, n, P + M / 2, r, t, o), r += t;
|
|
2560
2565
|
}
|
|
2561
2566
|
e.restore();
|
|
2562
2567
|
return;
|
|
2563
2568
|
}
|
|
2564
2569
|
if (_e) {
|
|
2565
2570
|
let t = me <= 90 ? -(me * Math.PI / 180) : (me - 90) * Math.PI / 180;
|
|
2566
|
-
e.translate(
|
|
2571
|
+
e.translate(P + M / 2, w + N / 2), e.rotate(t), e.textAlign = "center", e.textBaseline = "middle", e.fillText(q, 0, 0), e.restore();
|
|
2567
2572
|
return;
|
|
2568
2573
|
}
|
|
2569
|
-
if (
|
|
2570
|
-
let t = e.measureText(
|
|
2574
|
+
if (B.shrinkToFit) {
|
|
2575
|
+
let t = e.measureText(q).width, n = M - z - 3;
|
|
2571
2576
|
if (t > n && t > 0) {
|
|
2572
|
-
let r = n / t, i = k === "right" ?
|
|
2577
|
+
let r = n / t, i = k === "right" ? P + M - 3 : k === "center" ? P + M / 2 : P + z;
|
|
2573
2578
|
e.transform(r, 0, 0, 1, i * (1 - r), 0);
|
|
2574
2579
|
}
|
|
2575
2580
|
}
|
|
@@ -2577,88 +2582,90 @@ function Tr(e, t, n, r, i, a, o, s, c, l, u, d, f, p) {
|
|
|
2577
2582
|
e.letterSpacing = `${fe}px`;
|
|
2578
2583
|
} catch {}
|
|
2579
2584
|
try {
|
|
2580
|
-
e.direction = pn(
|
|
2585
|
+
e.direction = pn(B.readingOrder, q) ? "rtl" : "ltr";
|
|
2581
2586
|
} catch {}
|
|
2582
|
-
let ve =
|
|
2583
|
-
if (
|
|
2587
|
+
let ve = F.value.type === "text" ? F.value.runs : void 0, ye = ve && ve.length > 0;
|
|
2588
|
+
if (B.wrapText && ye) mr(e, ve, b, {
|
|
2584
2589
|
alignH: k,
|
|
2585
2590
|
alignV: A,
|
|
2586
|
-
cx:
|
|
2587
|
-
cy:
|
|
2588
|
-
cellW:
|
|
2589
|
-
cellH:
|
|
2590
|
-
leftPad:
|
|
2591
|
+
cx: P,
|
|
2592
|
+
cy: w,
|
|
2593
|
+
cellW: M,
|
|
2594
|
+
cellH: N,
|
|
2595
|
+
leftPad: z,
|
|
2591
2596
|
paddingX: 3,
|
|
2592
2597
|
paddingY: 2
|
|
2593
|
-
},
|
|
2594
|
-
fontColor:
|
|
2595
|
-
readingOrder:
|
|
2598
|
+
}, x, S, {
|
|
2599
|
+
fontColor: V.fontColor,
|
|
2600
|
+
readingOrder: B.readingOrder
|
|
2596
2601
|
});
|
|
2597
|
-
else if (
|
|
2598
|
-
let t = tr(e,
|
|
2599
|
-
A === "top" ? (i =
|
|
2600
|
-
for (let r = 0; r < t.length; r++) e.fillText(t[r],
|
|
2601
|
-
} else if (ye) pr(e, ve,
|
|
2602
|
+
else if (B.wrapText) {
|
|
2603
|
+
let t = tr(e, q, M - z - 3), n = Jn(L.size, x, 1.2, L.name ?? void 0), r = t.length * n, i;
|
|
2604
|
+
A === "top" ? (i = w + 2, e.textBaseline = "top") : A === "center" ? (i = w + (N - r) / 2, e.textBaseline = "top") : (i = w + N - r - 2, e.textBaseline = "top");
|
|
2605
|
+
for (let r = 0; r < t.length; r++) e.fillText(t[r], K, i + r * n);
|
|
2606
|
+
} else if (ye) pr(e, ve, b, {
|
|
2602
2607
|
alignH: k,
|
|
2603
2608
|
alignV: A,
|
|
2604
|
-
cx:
|
|
2605
|
-
cy:
|
|
2606
|
-
cellW:
|
|
2607
|
-
cellH:
|
|
2608
|
-
leftPad:
|
|
2609
|
+
cx: P,
|
|
2610
|
+
cy: w,
|
|
2611
|
+
cellW: M,
|
|
2612
|
+
cellH: N,
|
|
2613
|
+
leftPad: z,
|
|
2609
2614
|
paddingX: 3,
|
|
2610
2615
|
paddingY: 2
|
|
2611
|
-
},
|
|
2612
|
-
fontColor:
|
|
2613
|
-
readingOrder:
|
|
2616
|
+
}, x, S, {
|
|
2617
|
+
fontColor: V.fontColor,
|
|
2618
|
+
readingOrder: B.readingOrder
|
|
2614
2619
|
});
|
|
2615
2620
|
else {
|
|
2616
|
-
let t =
|
|
2621
|
+
let t = b.vertAlign, n = Jn(L.size, x), r = 0;
|
|
2617
2622
|
t === "superscript" ? r = -Math.round(n * .35) : t === "subscript" && (r = Math.round(n * .1));
|
|
2618
2623
|
let i = t ? {
|
|
2619
|
-
...
|
|
2620
|
-
size:
|
|
2621
|
-
} :
|
|
2622
|
-
t && (e.font = Yn(i,
|
|
2623
|
-
let a = null, o = () => a ??= e.measureText(
|
|
2624
|
-
let e = Math.min(o().width, ue -
|
|
2624
|
+
...b,
|
|
2625
|
+
size: b.size * .65
|
|
2626
|
+
} : b;
|
|
2627
|
+
t && (e.font = Yn(i, x));
|
|
2628
|
+
let a = null, o = () => a ??= e.measureText(q), s = () => {
|
|
2629
|
+
let e = Math.min(o().width, ue - z - 3);
|
|
2625
2630
|
return {
|
|
2626
|
-
x: k === "right" ?
|
|
2631
|
+
x: k === "right" ? P + M - 3 - e : k === "center" ? P + M / 2 - e / 2 : P + z,
|
|
2627
2632
|
width: e
|
|
2628
2633
|
};
|
|
2629
|
-
}, c = Jn(i.size,
|
|
2630
|
-
if (
|
|
2631
|
-
let { x: t, width: n } = s(), i = (A === "top" ?
|
|
2632
|
-
Qn(e, t, t + n, i, a, o,
|
|
2634
|
+
}, c = Jn(i.size, x);
|
|
2635
|
+
if (b.underline || T) {
|
|
2636
|
+
let { x: t, width: n } = s(), i = (A === "top" ? w + 2 + c + 1 : A === "center" ? w + N / 2 + Math.round(c * .55) : w + N - 2 + 1) + r, a = T ? "#0563C1" : D ? J(D) : "#000000", o = b.underlineStyle === "double" || b.underlineStyle === "doubleAccounting";
|
|
2637
|
+
Qn(e, t, t + n, i, a, o, S);
|
|
2633
2638
|
}
|
|
2634
|
-
if (
|
|
2635
|
-
let { x: t, width: n } = s(), i = (A === "top" ?
|
|
2636
|
-
e.save(), e.strokeStyle =
|
|
2639
|
+
if (b.strike) {
|
|
2640
|
+
let { x: t, width: n } = s(), i = (A === "top" ? w + 2 + Math.round(c * .5) : A === "center" ? w + N / 2 : w + N - 2 - Math.round(c * .35)) + r, a = i + d(i, .5, S);
|
|
2641
|
+
e.save(), e.strokeStyle = D ? J(D) : "#000000", e.lineWidth = .5, e.beginPath(), e.moveTo(t, a), e.lineTo(t + n, a), e.stroke(), e.restore();
|
|
2637
2642
|
}
|
|
2638
|
-
if (
|
|
2639
|
-
let t =
|
|
2640
|
-
A === "top" ? (a =
|
|
2641
|
-
for (let i = 0; i < t.length; i++) e.fillText(t[i],
|
|
2643
|
+
if (q.includes("\n")) {
|
|
2644
|
+
let t = q.split("\n"), n = Jn(L.size, x, 1.2, L.name ?? void 0), i = t.length * n, a;
|
|
2645
|
+
A === "top" ? (a = w + 2, e.textBaseline = "top") : A === "center" ? (a = w + (N - i) / 2, e.textBaseline = "top") : (a = w + N - i - 2, e.textBaseline = "top");
|
|
2646
|
+
for (let i = 0; i < t.length; i++) e.fillText(t[i], K, a + i * n + r);
|
|
2642
2647
|
} else {
|
|
2643
2648
|
let t;
|
|
2644
|
-
A === "top" ? (e.textBaseline = "top", t =
|
|
2649
|
+
A === "top" ? (e.textBaseline = "top", t = w + 2) : A === "center" ? (e.textBaseline = "middle", t = w + N / 2) : (e.textBaseline = "bottom", t = w + N - 2), e.fillText(de, K, t + r);
|
|
2645
2650
|
}
|
|
2646
2651
|
}
|
|
2647
|
-
let be =
|
|
2648
|
-
if (
|
|
2649
|
-
let t = Yn(
|
|
2650
|
-
r = k === "right" ?
|
|
2651
|
-
let i =
|
|
2652
|
-
Xn(e, be,
|
|
2652
|
+
let be = F.value.type === "text" ? F.value.phoneticRuns : void 0;
|
|
2653
|
+
if (F.showPhonetic && be && be.length > 0 && !q.includes("\n")) {
|
|
2654
|
+
let t = Yn(b, x), n = Zn(e, q, t), r;
|
|
2655
|
+
r = k === "right" ? P + M - 3 - n : k === "center" ? P + M / 2 - n / 2 : P + z;
|
|
2656
|
+
let i = D ? J(D) : "#000000";
|
|
2657
|
+
Xn(e, be, F.value.type === "text" ? F.value.phoneticPr : void 0, q, t, g, r, w, x, i);
|
|
2653
2658
|
}
|
|
2654
|
-
e.restore(),
|
|
2655
|
-
|
|
2656
|
-
|
|
2657
|
-
|
|
2658
|
-
|
|
2659
|
-
|
|
2660
|
-
|
|
2661
|
-
|
|
2659
|
+
e.restore(), q && t.onTextRun && t.onTextRun({
|
|
2660
|
+
sheetName: t.worksheet.name,
|
|
2661
|
+
cellRef: vn(c, o),
|
|
2662
|
+
text: q,
|
|
2663
|
+
x: P,
|
|
2664
|
+
y: w,
|
|
2665
|
+
width: M,
|
|
2666
|
+
height: N,
|
|
2667
|
+
row: c,
|
|
2668
|
+
col: o
|
|
2662
2669
|
});
|
|
2663
2670
|
});
|
|
2664
2671
|
}
|
|
@@ -2703,108 +2710,108 @@ function Dr(e) {
|
|
|
2703
2710
|
function Or(e, t, n, r, i = {}) {
|
|
2704
2711
|
let a = i.dpr ?? 1, o = i.cellScale ?? 1, s = Z(t), c = e.canvas.width / a, l = e.canvas.height / a;
|
|
2705
2712
|
e.clearRect(0, 0, c, l), e.fillStyle = "#ffffff", e.fillRect(0, 0, c, l);
|
|
2706
|
-
let u = (e) => Math.round(e * o),
|
|
2707
|
-
for (let e = 1; e <=
|
|
2708
|
-
let
|
|
2709
|
-
for (let e = 1; e <=
|
|
2710
|
-
let
|
|
2711
|
-
for (let e =
|
|
2712
|
-
let
|
|
2713
|
-
for (let e =
|
|
2714
|
-
let { cellMap:
|
|
2713
|
+
let u = (e) => Math.round(e * o), f = u(50), p = u(22), { row: m, col: h, rows: g, cols: _ } = r, v = (i.scrollOffsetX ?? 0) * o, y = (i.scrollOffsetY ?? 0) * o, b = i.freezeRows ?? 0, x = i.freezeCols ?? 0, S = [];
|
|
2714
|
+
for (let e = 1; e <= x; e++) S.push(u(Q(t.colWidths[e] ?? t.defaultColWidth, s)));
|
|
2715
|
+
let C = [];
|
|
2716
|
+
for (let e = 1; e <= b; e++) C.push(u($(t.rowHeights[e] ?? t.defaultRowHeight)));
|
|
2717
|
+
let w = S.reduce((e, t) => e + t, 0), T = C.reduce((e, t) => e + t, 0), E = [];
|
|
2718
|
+
for (let e = h; e < h + _; e++) E.push(u(Q(t.colWidths[e] ?? t.defaultColWidth, s)));
|
|
2719
|
+
let D = [];
|
|
2720
|
+
for (let e = m; e < m + g; e++) D.push(u($(t.rowHeights[e] ?? t.defaultRowHeight)));
|
|
2721
|
+
let { cellMap: O, cfContext: ee, mergeSkipSet: k, autoFilterCells: A, hyperlinkMap: j, commentCells: te, tableStyleMap: M, sparklineMap: N } = Dr(t), P = /* @__PURE__ */ new Map();
|
|
2715
2722
|
for (let e of t.mergeCells ?? []) {
|
|
2716
2723
|
let n = 0;
|
|
2717
2724
|
for (let r = e.left; r <= e.right; r++) n += u(Q(t.colWidths[r] ?? t.defaultColWidth, s));
|
|
2718
2725
|
let r = 0;
|
|
2719
2726
|
for (let n = e.top; n <= e.bottom; n++) r += u($(t.rowHeights[n] ?? t.defaultRowHeight));
|
|
2720
|
-
|
|
2727
|
+
P.set(`${e.top}:${e.left}`, {
|
|
2721
2728
|
totalW: n,
|
|
2722
2729
|
totalH: r,
|
|
2723
2730
|
right: e.right,
|
|
2724
2731
|
bottom: e.bottom
|
|
2725
2732
|
});
|
|
2726
2733
|
}
|
|
2727
|
-
let
|
|
2734
|
+
let F = {
|
|
2728
2735
|
worksheet: t,
|
|
2729
2736
|
styles: n,
|
|
2730
|
-
cellMap:
|
|
2731
|
-
mergeAnchorMap:
|
|
2737
|
+
cellMap: O,
|
|
2738
|
+
mergeAnchorMap: P,
|
|
2732
2739
|
mergeSkipSet: k,
|
|
2733
|
-
cfContext:
|
|
2734
|
-
colWidths:
|
|
2735
|
-
rowHeights:
|
|
2736
|
-
frozenColWidths:
|
|
2737
|
-
frozenRowHeights:
|
|
2738
|
-
frozenW:
|
|
2739
|
-
frozenH:
|
|
2740
|
-
startRow:
|
|
2741
|
-
startCol:
|
|
2740
|
+
cfContext: ee,
|
|
2741
|
+
colWidths: E,
|
|
2742
|
+
rowHeights: D,
|
|
2743
|
+
frozenColWidths: S,
|
|
2744
|
+
frozenRowHeights: C,
|
|
2745
|
+
frozenW: w,
|
|
2746
|
+
frozenH: T,
|
|
2747
|
+
startRow: m,
|
|
2748
|
+
startCol: h,
|
|
2742
2749
|
cs: o,
|
|
2743
2750
|
dpr: a,
|
|
2744
2751
|
autoFilterCells: A,
|
|
2745
2752
|
hyperlinkMap: j,
|
|
2746
|
-
commentCells:
|
|
2747
|
-
tableStyleMap:
|
|
2748
|
-
sparklineMap:
|
|
2753
|
+
commentCells: te,
|
|
2754
|
+
tableStyleMap: M,
|
|
2755
|
+
sparklineMap: N,
|
|
2749
2756
|
mdw: s,
|
|
2750
2757
|
onTextRun: i.onTextRun,
|
|
2751
2758
|
rtl: t.rightToLeft === !0,
|
|
2752
2759
|
canvasW: c
|
|
2753
|
-
},
|
|
2754
|
-
|
|
2755
|
-
let
|
|
2756
|
-
if (
|
|
2760
|
+
}, I = f, L = p, R = I + w, z = L + T, B = Math.max(0, c - R), V = Math.max(0, l - z);
|
|
2761
|
+
b > 0 && x > 0 && Tr(e, F, 1, 1, S, C, 0, 0, I, L, I, L, w, T), b > 0 && Tr(e, F, 1, h, E, C, v, 0, R, L, R, L, B, T), x > 0 && Tr(e, F, m, 1, S, D, 0, y, I, z, I, z, w, V), Tr(e, F, m, h, E, D, v, y, R, z, R, z, B, V), t.images && t.images.length > 0 && i.loadedImages && Mr(e, t, i.loadedImages, o, m, h, v, y, R, z, B, V, t.rightToLeft === !0, c), t.shapeGroups && t.shapeGroups.length > 0 && Nr(e, t, o, m, h, v, y, R, z, B, V, i.loadedImages, t.rightToLeft === !0, c), t.charts && t.charts.length > 0 && Qr(e, t, o, m, h, v, y, R, z, B, V, t.rightToLeft === !0, c), t.slicers && t.slicers.length > 0 && di(e, t, o, m, h, v, y, R, z, B, V, t.rightToLeft === !0, c), kr(e, c, l, m, h, g, _, E, D, v, y, S, C, w, T, f, p, o, a, i.selectedRowRange ?? null, i.selectedColRange ?? null, t.rightToLeft === !0);
|
|
2762
|
+
let H = t.rightToLeft === !0;
|
|
2763
|
+
if (b > 0) {
|
|
2757
2764
|
e.save(), e.strokeStyle = Mn, e.lineWidth = .5, e.beginPath();
|
|
2758
|
-
let t =
|
|
2759
|
-
|
|
2765
|
+
let t = z + d(z, .5, a);
|
|
2766
|
+
H ? (e.moveTo(0, t), e.lineTo(c - f, t)) : (e.moveTo(f, t), e.lineTo(c, t)), e.stroke(), e.restore();
|
|
2760
2767
|
}
|
|
2761
|
-
if (
|
|
2768
|
+
if (x > 0) {
|
|
2762
2769
|
e.save(), e.strokeStyle = Mn, e.lineWidth = .5, e.beginPath();
|
|
2763
|
-
let t =
|
|
2764
|
-
e.moveTo(n,
|
|
2765
|
-
}
|
|
2766
|
-
}
|
|
2767
|
-
function kr(e, t, n, r, i, a, o, s, c, l, u,
|
|
2768
|
-
let
|
|
2769
|
-
e.fillStyle =
|
|
2770
|
-
let
|
|
2771
|
-
e.moveTo(
|
|
2772
|
-
let
|
|
2773
|
-
let i =
|
|
2774
|
-
e.fillStyle =
|
|
2775
|
-
let a = i +
|
|
2776
|
-
e.moveTo(a, 0), e.lineTo(a,
|
|
2777
|
-
},
|
|
2778
|
-
let i =
|
|
2779
|
-
e.fillStyle = A(t), e.fillRect(i, n,
|
|
2780
|
-
let a = n +
|
|
2781
|
-
e.moveTo(i +
|
|
2782
|
-
let s = Math.max(2, Math.round(4 *
|
|
2783
|
-
|
|
2770
|
+
let t = H ? c - R : R, n = t + d(t, .5, a);
|
|
2771
|
+
e.moveTo(n, p), e.lineTo(n, l), e.stroke(), e.restore();
|
|
2772
|
+
}
|
|
2773
|
+
}
|
|
2774
|
+
function kr(e, t, n, r, i, a, o, s, c, l, u, f, p, m, h, g, _, v, y, b, x, S) {
|
|
2775
|
+
let C = "#f8f9fa", w = "#e8eaed", T = "#caddf6", E = "#c8ccd0", D = "#5b9bd5", O = "#444", ee = (e) => !x || e < x.start || e > x.end ? C : x.strong ? T : w, k = (e) => !x || e < x.start || e > x.end ? E : x.strong ? D : E, A = (e) => !b || e < b.start || e > b.end ? C : b.strong ? T : w, j = (e) => !b || e < b.start || e > b.end ? E : b.strong ? D : E, te = `${Math.max(1, Math.round(11 * v))}px ${Cn}`, M = g + m, N = _ + h, P = .5 / y, F = (e, n) => S ? An(e, n, t) : e, I = S ? t - g : 0;
|
|
2776
|
+
e.fillStyle = C, e.fillRect(I, 0, g, _), e.strokeStyle = E, e.lineWidth = .5, e.beginPath();
|
|
2777
|
+
let L = I + d(I, .5, y), R = d(0, .5, y);
|
|
2778
|
+
e.moveTo(L, 0), e.lineTo(L, _), e.moveTo(I, R), e.lineTo(I + g, R), e.moveTo(I + g - P, 0), e.lineTo(I + g - P, _), e.moveTo(I, _ - P), e.lineTo(I + g, _ - P), e.stroke(), e.font = te, e.fillStyle = O;
|
|
2779
|
+
let z = (t, n, r) => {
|
|
2780
|
+
let i = F(n, r);
|
|
2781
|
+
e.fillStyle = ee(t), e.fillRect(i, 0, r, _), e.strokeStyle = k(t), e.lineWidth = .5, e.beginPath();
|
|
2782
|
+
let a = i + d(i, .5, y), o = d(0, .5, y);
|
|
2783
|
+
e.moveTo(a, 0), e.lineTo(a, _), e.moveTo(i, _ - P), e.lineTo(i + r, _ - P), e.moveTo(i, o), e.lineTo(i + r, o), e.stroke(), e.fillStyle = O, e.textAlign = "center", e.textBaseline = "middle", e.fillText(hr(t), i + r / 2, _ / 2);
|
|
2784
|
+
}, B = (t, n, r) => {
|
|
2785
|
+
let i = I;
|
|
2786
|
+
e.fillStyle = A(t), e.fillRect(i, n, g, r), e.strokeStyle = j(t), e.lineWidth = .5, e.beginPath();
|
|
2787
|
+
let a = n + d(n, .5, y), o = i + d(i, .5, y);
|
|
2788
|
+
e.moveTo(i + g - P, n), e.lineTo(i + g - P, n + r), e.moveTo(i, a), e.lineTo(i + g, a), e.moveTo(o, n), e.lineTo(o, n + r), e.stroke(), e.fillStyle = O, e.textBaseline = "middle";
|
|
2789
|
+
let s = Math.max(2, Math.round(4 * v));
|
|
2790
|
+
S ? (e.textAlign = "left", e.fillText(String(t), i + s, n + r / 2)) : (e.textAlign = "right", e.fillText(String(t), i + g - s, n + r / 2));
|
|
2784
2791
|
};
|
|
2785
|
-
if (
|
|
2786
|
-
e.save(), e.beginPath(), e.rect(
|
|
2787
|
-
let t =
|
|
2788
|
-
for (let e = 0; e <
|
|
2792
|
+
if (f.length > 0) {
|
|
2793
|
+
e.save(), e.beginPath(), e.rect(F(g, m), 0, m, _), e.clip();
|
|
2794
|
+
let t = g;
|
|
2795
|
+
for (let e = 0; e < f.length; e++) z(e + 1, t, f[e]), t += f[e];
|
|
2789
2796
|
e.restore();
|
|
2790
2797
|
}
|
|
2791
|
-
e.save(), e.beginPath(), e.rect(
|
|
2792
|
-
let
|
|
2798
|
+
e.save(), e.beginPath(), e.rect(F(M, t - M), 0, t - M, _), e.clip();
|
|
2799
|
+
let V = M - l;
|
|
2793
2800
|
for (let e = 0; e < s.length; e++) {
|
|
2794
2801
|
let n = s[e];
|
|
2795
|
-
|
|
2802
|
+
V + n > M && V < t && z(i + e, V, n), V += n;
|
|
2796
2803
|
}
|
|
2797
|
-
if (e.restore(),
|
|
2798
|
-
e.save(), e.beginPath(), e.rect(
|
|
2799
|
-
let t =
|
|
2800
|
-
for (let e = 0; e <
|
|
2804
|
+
if (e.restore(), p.length > 0) {
|
|
2805
|
+
e.save(), e.beginPath(), e.rect(I, _, g, h), e.clip();
|
|
2806
|
+
let t = _;
|
|
2807
|
+
for (let e = 0; e < p.length; e++) B(e + 1, t, p[e]), t += p[e];
|
|
2801
2808
|
e.restore();
|
|
2802
2809
|
}
|
|
2803
|
-
e.save(), e.beginPath(), e.rect(
|
|
2804
|
-
let
|
|
2810
|
+
e.save(), e.beginPath(), e.rect(I, N, g, n - N), e.clip();
|
|
2811
|
+
let H = N - u;
|
|
2805
2812
|
for (let e = 0; e < c.length; e++) {
|
|
2806
2813
|
let t = c[e];
|
|
2807
|
-
|
|
2814
|
+
H + t > N && H < n && B(r + e, H, t), H += t;
|
|
2808
2815
|
}
|
|
2809
2816
|
e.restore();
|
|
2810
2817
|
}
|
|
@@ -2818,104 +2825,104 @@ function jr(e, t, n) {
|
|
|
2818
2825
|
for (let i = 1; i < t; i++) r += Math.round($(e.rowHeights[i] ?? e.defaultRowHeight) * n);
|
|
2819
2826
|
return r;
|
|
2820
2827
|
}
|
|
2821
|
-
function Mr(n, r, i, a, o, s, c, l, u, d, f, p
|
|
2822
|
-
if (
|
|
2823
|
-
let
|
|
2824
|
-
|
|
2825
|
-
let
|
|
2826
|
-
|
|
2827
|
-
for (let
|
|
2828
|
-
let
|
|
2829
|
-
if (!
|
|
2830
|
-
let
|
|
2831
|
-
if (
|
|
2828
|
+
function Mr(e, t, n, r, i, a, o, s, c, l, u, d, f, p) {
|
|
2829
|
+
if (u <= 0 || d <= 0) return;
|
|
2830
|
+
let m = Ar(t, a, r), h = jr(t, i, r);
|
|
2831
|
+
e.save(), e.beginPath();
|
|
2832
|
+
let g = jn(c, u, p, f);
|
|
2833
|
+
e.rect(g, l, u, d), e.clip();
|
|
2834
|
+
for (let i of t.images) {
|
|
2835
|
+
let a = n.get(bn(i.imagePath, i.duotone));
|
|
2836
|
+
if (!a) continue;
|
|
2837
|
+
let _ = i.fromCol + 1, v = i.fromRow + 1, y = Ar(t, _, r) + i.fromColOff * r / W, b = jr(t, v, r) + i.fromRowOff * r / W, x, S;
|
|
2838
|
+
if (i.editAs === "oneCell" && i.nativeExtCx > 0 && i.nativeExtCy > 0) x = i.nativeExtCx * r / W, S = i.nativeExtCy * r / W;
|
|
2832
2839
|
else {
|
|
2833
|
-
let e =
|
|
2834
|
-
|
|
2840
|
+
let e = i.toCol + 1, n = i.toRow + 1, a = Ar(t, e, r) + i.toColOff * r / W, o = jr(t, n, r) + i.toRowOff * r / W;
|
|
2841
|
+
x = a - y, S = o - b;
|
|
2835
2842
|
}
|
|
2836
|
-
if (
|
|
2837
|
-
let
|
|
2838
|
-
|
|
2843
|
+
if (x <= 0 || S <= 0) continue;
|
|
2844
|
+
let C = jn(c + (y - m) - o, x, p, f), w = l + (b - h) - s;
|
|
2845
|
+
C + x < g || C > g + u || w + S < l || w > l + d || (i.alpha != null && i.alpha < 1 ? (e.save(), e.globalAlpha = i.alpha, V(e, a, i.srcRect, C, w, x, S), e.restore()) : V(e, a, i.srcRect, C, w, x, S));
|
|
2839
2846
|
}
|
|
2840
|
-
|
|
2847
|
+
e.restore();
|
|
2841
2848
|
}
|
|
2842
|
-
function Nr(e, n, r, i, a, o, s, c, l, u, d, f, p
|
|
2843
|
-
if (
|
|
2844
|
-
let
|
|
2845
|
-
if (!
|
|
2846
|
-
let
|
|
2849
|
+
function Nr(e, t, n, r, i, a, o, s, c, l, u, d, f, p) {
|
|
2850
|
+
if (l <= 0 || u <= 0) return;
|
|
2851
|
+
let m = t.shapeGroups;
|
|
2852
|
+
if (!m || m.length === 0) return;
|
|
2853
|
+
let h = Ar(t, i, n), g = jr(t, r, n);
|
|
2847
2854
|
e.save(), e.beginPath();
|
|
2848
|
-
let
|
|
2849
|
-
e.rect(
|
|
2850
|
-
for (let
|
|
2851
|
-
let
|
|
2852
|
-
if (
|
|
2855
|
+
let _ = jn(s, l, p, f);
|
|
2856
|
+
e.rect(_, c, l, u), e.clip();
|
|
2857
|
+
for (let r of m) {
|
|
2858
|
+
let i = r.fromCol + 1, m = r.fromRow + 1, v = Ar(t, i, n) + r.fromColOff * n / W, y = jr(t, m, n) + r.fromRowOff * n / W, b, x;
|
|
2859
|
+
if (r.editAs === "oneCell" && r.nativeExtCx > 0 && r.nativeExtCy > 0) b = r.nativeExtCx * n / W, x = r.nativeExtCy * n / W;
|
|
2853
2860
|
else {
|
|
2854
|
-
let e =
|
|
2855
|
-
|
|
2861
|
+
let e = r.toCol + 1, i = r.toRow + 1, a = Ar(t, e, n) + r.toColOff * n / W, o = jr(t, i, n) + r.toRowOff * n / W;
|
|
2862
|
+
b = a - v, x = o - y;
|
|
2856
2863
|
}
|
|
2857
|
-
if (
|
|
2858
|
-
let
|
|
2859
|
-
if (!(
|
|
2860
|
-
let
|
|
2861
|
-
a <= 0 || o <= 0 || Pr(e, t,
|
|
2864
|
+
if (b <= 0 || x <= 0) continue;
|
|
2865
|
+
let S = jn(s + (v - h) - a, b, p, f), C = c + (y - g) - o;
|
|
2866
|
+
if (!(S + b < _ || S > _ + l) && !(C + x < c || C > c + u)) for (let t of r.shapes) {
|
|
2867
|
+
let r = S + t.x * b, i = C + t.y * x, a = t.w * b, o = t.h * x;
|
|
2868
|
+
a <= 0 || o <= 0 || Pr(e, t, r, i, a, o, n, d);
|
|
2862
2869
|
}
|
|
2863
2870
|
}
|
|
2864
2871
|
e.restore();
|
|
2865
2872
|
}
|
|
2866
|
-
function Pr(n, r, i, a, o, s
|
|
2867
|
-
if (
|
|
2868
|
-
if (
|
|
2869
|
-
let
|
|
2870
|
-
|
|
2871
|
-
let
|
|
2872
|
-
for (let
|
|
2873
|
+
function Pr(e, t, n, r, i, a, o, s) {
|
|
2874
|
+
if (e.save(), t.rot !== 0 || t.flipH || t.flipV ? (e.translate(n + i / 2, r + a / 2), e.rotate(t.rot * Math.PI / 180), e.scale(t.flipH ? -1 : 1, t.flipV ? -1 : 1), e.translate(-i / 2, -a / 2)) : e.translate(n, r), t.geom.type === "custom") for (let n of t.geom.paths) {
|
|
2875
|
+
if (n.w <= 0 || n.h <= 0) continue;
|
|
2876
|
+
let r = i / n.w, o = a / n.h;
|
|
2877
|
+
e.beginPath();
|
|
2878
|
+
let s = 0, c = 0, l = 0, u = 0;
|
|
2879
|
+
for (let t of n.commands) switch (t.op) {
|
|
2873
2880
|
case "moveTo": {
|
|
2874
|
-
let
|
|
2875
|
-
|
|
2881
|
+
let n = t.x * r, i = t.y * o;
|
|
2882
|
+
e.moveTo(n, i), s = l = n, c = u = i;
|
|
2876
2883
|
break;
|
|
2877
2884
|
}
|
|
2878
2885
|
case "lineTo": {
|
|
2879
|
-
let
|
|
2880
|
-
|
|
2886
|
+
let n = t.x * r, i = t.y * o;
|
|
2887
|
+
e.lineTo(n, i), s = n, c = i;
|
|
2881
2888
|
break;
|
|
2882
2889
|
}
|
|
2883
2890
|
case "cubicBezTo": {
|
|
2884
|
-
let
|
|
2885
|
-
|
|
2891
|
+
let n = t.x3 * r, i = t.y3 * o;
|
|
2892
|
+
e.bezierCurveTo(t.x1 * r, t.y1 * o, t.x2 * r, t.y2 * o, n, i), s = n, c = i;
|
|
2886
2893
|
break;
|
|
2887
2894
|
}
|
|
2888
2895
|
case "quadBezTo": {
|
|
2889
|
-
let
|
|
2890
|
-
|
|
2896
|
+
let n = t.x2 * r, i = t.y2 * o;
|
|
2897
|
+
e.quadraticCurveTo(t.x1 * r, t.y1 * o, n, i), s = n, c = i;
|
|
2891
2898
|
break;
|
|
2892
2899
|
}
|
|
2893
2900
|
case "arcTo": {
|
|
2894
|
-
let
|
|
2895
|
-
if (
|
|
2896
|
-
let
|
|
2897
|
-
|
|
2901
|
+
let n = t.wr * r, i = t.hr * o;
|
|
2902
|
+
if (n <= 0 || i <= 0) break;
|
|
2903
|
+
let a = t.stAng / 6e4 * (Math.PI / 180), l = t.swAng / 6e4 * (Math.PI / 180), u = s - Math.cos(a) * n, d = c - Math.sin(a) * i, f = a + l;
|
|
2904
|
+
e.ellipse(u, d, n, i, 0, a, f, l < 0), s = u + Math.cos(f) * n, c = d + Math.sin(f) * i;
|
|
2898
2905
|
break;
|
|
2899
2906
|
}
|
|
2900
2907
|
case "close":
|
|
2901
|
-
|
|
2908
|
+
e.closePath(), s = l, c = u;
|
|
2902
2909
|
break;
|
|
2903
2910
|
}
|
|
2904
|
-
Wr(
|
|
2911
|
+
Wr(e, t);
|
|
2905
2912
|
}
|
|
2906
|
-
else if (
|
|
2907
|
-
let
|
|
2908
|
-
|
|
2913
|
+
else if (t.geom.type === "preset") {
|
|
2914
|
+
let n = t.fillColor ?? null, r = t.strokeColor && t.strokeWidth > 0 ? () => {
|
|
2915
|
+
e.strokeStyle = t.strokeColor, e.lineWidth = Math.max(.5, t.strokeWidth / W), e.stroke();
|
|
2909
2916
|
} : null;
|
|
2910
|
-
|
|
2911
|
-
} else if (
|
|
2912
|
-
let
|
|
2913
|
-
if (
|
|
2914
|
-
let
|
|
2915
|
-
|
|
2917
|
+
ce(e, t.geom.name, 0, 0, i, a, t.geom.adj ?? [], n, r, () => {}) || (e.beginPath(), e.rect(0, 0, i, a), Wr(e, t));
|
|
2918
|
+
} else if (t.geom.type === "image") {
|
|
2919
|
+
let n = s?.get(bn(t.geom.imagePath, t.geom.duotone));
|
|
2920
|
+
if (n) {
|
|
2921
|
+
let r = t.geom.alpha;
|
|
2922
|
+
r != null && r < 1 ? (e.save(), e.globalAlpha = r, V(e, n, t.geom.srcRect, 0, 0, i, a), e.restore()) : V(e, n, t.geom.srcRect, 0, 0, i, a);
|
|
2916
2923
|
}
|
|
2917
2924
|
}
|
|
2918
|
-
|
|
2925
|
+
t.text && Ur(e, t.text, i, a, o), e.restore();
|
|
2919
2926
|
}
|
|
2920
2927
|
var Fr = /* @__PURE__ */ new WeakMap();
|
|
2921
2928
|
function Ir(e, t) {
|
|
@@ -2954,7 +2961,7 @@ async function Hr(e, t) {
|
|
|
2954
2961
|
if (n.length !== 0) {
|
|
2955
2962
|
await t.loadMathJax();
|
|
2956
2963
|
for (let e of n) if (!Fr.has(e.nodes)) try {
|
|
2957
|
-
let n = await t.mathMLToSvg(
|
|
2964
|
+
let n = await t.mathMLToSvg(h(e.nodes, e.display)), r = await Lr(zr(Ee(n.svg, "#000000"), n.widthEm, n.ascentEm + n.descentEm));
|
|
2958
2965
|
Fr.set(e.nodes, {
|
|
2959
2966
|
img: r,
|
|
2960
2967
|
widthEm: n.widthEm,
|
|
@@ -2965,42 +2972,42 @@ async function Hr(e, t) {
|
|
|
2965
2972
|
} catch {}
|
|
2966
2973
|
}
|
|
2967
2974
|
}
|
|
2968
|
-
function Ur(e, n, r, i
|
|
2969
|
-
if (
|
|
2970
|
-
let
|
|
2971
|
-
if (
|
|
2972
|
-
let
|
|
2973
|
-
let t = (e.size > 0 ? e.size : On) *
|
|
2975
|
+
function Ur(e, t, n, r, i) {
|
|
2976
|
+
if (n <= 0 || r <= 0 || t.paragraphs.length === 0) return;
|
|
2977
|
+
let a = t.lIns / W * i, o = t.rIns / W * i, s = t.tIns / W * i, c = t.bIns / W * i, l = Math.max(0, n - a - o), u = Math.max(0, r - s - c);
|
|
2978
|
+
if (l <= 0 || u <= 0) return;
|
|
2979
|
+
let d = (e) => {
|
|
2980
|
+
let t = (e.size > 0 ? e.size : On) * x * i, n = Dn(e.fontFace);
|
|
2974
2981
|
return {
|
|
2975
2982
|
font: `${e.italic ? "italic " : ""}${e.bold ? "bold " : ""}${t}px ${n}`,
|
|
2976
2983
|
px: t
|
|
2977
2984
|
};
|
|
2978
|
-
},
|
|
2985
|
+
}, f = (t, n) => {
|
|
2979
2986
|
let r = e.font;
|
|
2980
2987
|
e.font = t;
|
|
2981
2988
|
let i = e.measureText("M").actualBoundingBoxAscent;
|
|
2982
2989
|
return e.font = r, i > 0 ? i : n * .85;
|
|
2983
|
-
},
|
|
2984
|
-
for (let
|
|
2985
|
-
let
|
|
2986
|
-
let
|
|
2987
|
-
return
|
|
2990
|
+
}, p = t.wrap !== "none", m = [];
|
|
2991
|
+
for (let n of t.paragraphs) {
|
|
2992
|
+
let r = n.align || "l", a = (n.marL ?? 0) / W * i, o = (n.marR ?? 0) / W * i, s = (n.indent ?? 0) / W * i, c = Math.max(0, s), u = Math.max(0, l - a - o), h = !1, g = () => h ? a : a + c, _ = () => h ? u : u - c, v = [], y = 0, b = 0, S = 0, C = !1, w = (e) => {
|
|
2993
|
+
let r = e;
|
|
2994
|
+
return n.spaceLine && (n.spaceLine.type === "pct" ? r *= n.spaceLine.val / 1e5 : r = n.spaceLine.val * x * i), t.autoFit === "norm" && t.lnSpcReduction != null && n.spaceLine?.type !== "pts" && (r *= 1 - t.lnSpcReduction), r;
|
|
2988
2995
|
}, T = () => {
|
|
2989
|
-
if (
|
|
2990
|
-
let e = (E || On) *
|
|
2991
|
-
|
|
2996
|
+
if (b === 0) {
|
|
2997
|
+
let e = (E || On) * x * i, t = Math.max(G(D, e), G(O, e));
|
|
2998
|
+
b = Math.max(e * 1.2, t), S = f(`${e}px ${Dn(D)}`, e);
|
|
2992
2999
|
}
|
|
2993
|
-
|
|
2994
|
-
segs:
|
|
2995
|
-
align:
|
|
2996
|
-
height:
|
|
3000
|
+
b = w(b), m.push({
|
|
3001
|
+
segs: v,
|
|
3002
|
+
align: r,
|
|
3003
|
+
height: b,
|
|
2997
3004
|
ascent: S,
|
|
2998
3005
|
hasMath: C,
|
|
2999
|
-
leftInset:
|
|
3000
|
-
availW:
|
|
3001
|
-
}),
|
|
3006
|
+
leftInset: g(),
|
|
3007
|
+
availW: _()
|
|
3008
|
+
}), h = !0, v = [], y = 0, b = 0, S = 0, C = !1;
|
|
3002
3009
|
}, E = 0, D, O;
|
|
3003
|
-
for (let t of
|
|
3010
|
+
for (let t of n.runs) {
|
|
3004
3011
|
if (t.type === "break") {
|
|
3005
3012
|
T();
|
|
3006
3013
|
continue;
|
|
@@ -3008,94 +3015,94 @@ function Ur(e, n, r, i, a) {
|
|
|
3008
3015
|
if (t.type === "math") {
|
|
3009
3016
|
let e = Fr.get(t.nodes);
|
|
3010
3017
|
if (!e) continue;
|
|
3011
|
-
let n = (t.fontSize ?? (E || On)) *
|
|
3018
|
+
let n = (t.fontSize ?? (E || On)) * x * i, o = e.widthEm * n, s = e.ascentEm * n, c = e.descentEm * n, l = t.color ?? "#000000";
|
|
3012
3019
|
if (t.display) {
|
|
3013
|
-
T(),
|
|
3020
|
+
T(), m.push({
|
|
3014
3021
|
segs: [{
|
|
3015
3022
|
kind: "math",
|
|
3016
3023
|
render: e,
|
|
3017
3024
|
color: l,
|
|
3018
|
-
w:
|
|
3025
|
+
w: o,
|
|
3019
3026
|
ascent: s,
|
|
3020
3027
|
descent: c
|
|
3021
3028
|
}],
|
|
3022
|
-
align:
|
|
3029
|
+
align: r,
|
|
3023
3030
|
height: w(s + c),
|
|
3024
3031
|
ascent: s,
|
|
3025
3032
|
hasMath: !0,
|
|
3026
|
-
leftInset:
|
|
3027
|
-
availW:
|
|
3028
|
-
}),
|
|
3033
|
+
leftInset: a,
|
|
3034
|
+
availW: u
|
|
3035
|
+
}), h = !0;
|
|
3029
3036
|
continue;
|
|
3030
3037
|
}
|
|
3031
|
-
|
|
3038
|
+
p && y + o > _() && v.length > 0 && T(), v.push({
|
|
3032
3039
|
kind: "math",
|
|
3033
3040
|
render: e,
|
|
3034
3041
|
color: l,
|
|
3035
|
-
w:
|
|
3042
|
+
w: o,
|
|
3036
3043
|
ascent: s,
|
|
3037
3044
|
descent: c
|
|
3038
|
-
}),
|
|
3045
|
+
}), y += o, b = Math.max(b, s + c), S = Math.max(S, s), C = !0;
|
|
3039
3046
|
continue;
|
|
3040
3047
|
}
|
|
3041
3048
|
E = t.size > 0 ? t.size : On, D = t.fontFace, O = t.fontFaceEa;
|
|
3042
|
-
let { font: n, px:
|
|
3043
|
-
|
|
3044
|
-
let
|
|
3045
|
-
for (let t = 0; t <
|
|
3049
|
+
let { font: n, px: o } = d(t), s = t.color ?? "#000000", c = Math.max(G(t.fontFace, o), G(t.fontFaceEa, o)), l = Math.max(o * 1.2, c);
|
|
3050
|
+
b = Math.max(b, l), S = Math.max(S, f(n, o)), e.font = n;
|
|
3051
|
+
let g = t.text.split("\n");
|
|
3052
|
+
for (let t = 0; t < g.length; t++) {
|
|
3046
3053
|
t > 0 && T();
|
|
3047
|
-
let
|
|
3048
|
-
if (!
|
|
3049
|
-
if (!
|
|
3050
|
-
let t = e.measureText(
|
|
3051
|
-
|
|
3054
|
+
let r = g[t];
|
|
3055
|
+
if (!r) continue;
|
|
3056
|
+
if (!p) {
|
|
3057
|
+
let t = e.measureText(r).width;
|
|
3058
|
+
v.push({
|
|
3052
3059
|
kind: "text",
|
|
3053
|
-
text:
|
|
3060
|
+
text: r,
|
|
3054
3061
|
font: n,
|
|
3055
3062
|
color: s,
|
|
3056
3063
|
w: t
|
|
3057
|
-
}),
|
|
3064
|
+
}), y += t;
|
|
3058
3065
|
continue;
|
|
3059
3066
|
}
|
|
3060
|
-
let
|
|
3061
|
-
for (let t of
|
|
3062
|
-
let
|
|
3063
|
-
if (
|
|
3064
|
-
if (
|
|
3065
|
-
let t = e.measureText(
|
|
3066
|
-
|
|
3067
|
+
let i = "";
|
|
3068
|
+
for (let t of r) {
|
|
3069
|
+
let r = i + t, a = e.measureText(r).width;
|
|
3070
|
+
if (y + a > _() && (i.length > 0 || v.length > 0)) {
|
|
3071
|
+
if (i) {
|
|
3072
|
+
let t = e.measureText(i).width;
|
|
3073
|
+
v.push({
|
|
3067
3074
|
kind: "text",
|
|
3068
|
-
text:
|
|
3075
|
+
text: i,
|
|
3069
3076
|
font: n,
|
|
3070
3077
|
color: s,
|
|
3071
3078
|
w: t
|
|
3072
|
-
}),
|
|
3079
|
+
}), y += t;
|
|
3073
3080
|
}
|
|
3074
|
-
T(),
|
|
3075
|
-
} else
|
|
3081
|
+
T(), i = t, e.font = n, b = Math.max(b, l), S = Math.max(S, f(n, o));
|
|
3082
|
+
} else i = r;
|
|
3076
3083
|
}
|
|
3077
|
-
if (
|
|
3078
|
-
let t = e.measureText(
|
|
3079
|
-
|
|
3084
|
+
if (i) {
|
|
3085
|
+
let t = e.measureText(i).width;
|
|
3086
|
+
v.push({
|
|
3080
3087
|
kind: "text",
|
|
3081
|
-
text:
|
|
3088
|
+
text: i,
|
|
3082
3089
|
font: n,
|
|
3083
3090
|
color: s,
|
|
3084
3091
|
w: t
|
|
3085
|
-
}),
|
|
3092
|
+
}), y += t;
|
|
3086
3093
|
}
|
|
3087
3094
|
}
|
|
3088
3095
|
}
|
|
3089
3096
|
T();
|
|
3090
3097
|
}
|
|
3091
|
-
let
|
|
3092
|
-
|
|
3093
|
-
let
|
|
3094
|
-
for (let t of
|
|
3095
|
-
let n = t.segs.reduce((e, t) => e + t.w, 0), r =
|
|
3098
|
+
let h = m.reduce((e, t) => e + t.height, 0), g = s;
|
|
3099
|
+
t.anchor === "ctr" ? g = s + (u - h) / 2 : t.anchor === "b" && (g = s + Math.max(0, u - h));
|
|
3100
|
+
let _ = g;
|
|
3101
|
+
for (let t of m) {
|
|
3102
|
+
let n = t.segs.reduce((e, t) => e + t.w, 0), r = a + t.leftInset, i = r;
|
|
3096
3103
|
if (t.align === "ctr" ? i = r + Math.max(0, (t.availW - n) / 2) : t.align === "r" && (i = r + Math.max(0, t.availW - n)), t.hasMath) {
|
|
3097
3104
|
e.textBaseline = "alphabetic";
|
|
3098
|
-
let n =
|
|
3105
|
+
let n = _ + t.ascent;
|
|
3099
3106
|
for (let r of t.segs) {
|
|
3100
3107
|
if (r.kind === "text") e.font = r.font, e.fillStyle = r.color, e.fillText(r.text, i, n);
|
|
3101
3108
|
else {
|
|
@@ -3106,14 +3113,14 @@ function Ur(e, n, r, i, a) {
|
|
|
3106
3113
|
}
|
|
3107
3114
|
} else {
|
|
3108
3115
|
e.textBaseline = "middle";
|
|
3109
|
-
let n =
|
|
3116
|
+
let n = _ + t.height / 2;
|
|
3110
3117
|
for (let r of t.segs) r.kind === "text" && (e.font = r.font, e.fillStyle = r.color, e.fillText(r.text, i, n)), i += r.w;
|
|
3111
3118
|
}
|
|
3112
|
-
|
|
3119
|
+
_ += t.height;
|
|
3113
3120
|
}
|
|
3114
3121
|
}
|
|
3115
|
-
function Wr(e,
|
|
3116
|
-
|
|
3122
|
+
function Wr(e, t) {
|
|
3123
|
+
t.fillColor && (e.fillStyle = t.fillColor, e.fill()), t.strokeColor && t.strokeWidth > 0 && (e.strokeStyle = t.strokeColor, e.lineWidth = Math.max(.5, t.strokeWidth / W), e.stroke());
|
|
3117
3124
|
}
|
|
3118
3125
|
function Gr(e, t, n, r, i, a, o) {
|
|
3119
3126
|
if (r === n && i === t) return e;
|
|
@@ -3198,17 +3205,17 @@ function qr(e, t, n, r, i, a, o = 1) {
|
|
|
3198
3205
|
kind: "d"
|
|
3199
3206
|
}
|
|
3200
3207
|
];
|
|
3201
|
-
for (let { edge: t, x1: c, y1: l, x2: u, y2:
|
|
3208
|
+
for (let { edge: t, x1: c, y1: l, x2: u, y2: f, kind: p } of s) {
|
|
3202
3209
|
if (!t || !t.style || t.style === "none") continue;
|
|
3203
|
-
let s = t.color ?
|
|
3204
|
-
if (t.style === "double" &&
|
|
3210
|
+
let s = t.color ? J(t.color) : "#000000";
|
|
3211
|
+
if (t.style === "double" && p === "d") {
|
|
3205
3212
|
e.strokeStyle = s, e.lineWidth = 1, e.setLineDash([]);
|
|
3206
|
-
let t = u - c, n =
|
|
3207
|
-
e.beginPath(), e.moveTo(c + i, l + a), e.lineTo(u + i,
|
|
3213
|
+
let t = u - c, n = f - l, r = Math.hypot(t, n), i = -n / r * 1, a = t / r * 1;
|
|
3214
|
+
e.beginPath(), e.moveTo(c + i, l + a), e.lineTo(u + i, f + a), e.moveTo(c - i, l - a), e.lineTo(u - i, f - a), e.stroke();
|
|
3208
3215
|
continue;
|
|
3209
3216
|
}
|
|
3210
|
-
if (t.style === "double" &&
|
|
3211
|
-
if (e.strokeStyle = s, e.lineWidth = 1, e.setLineDash([]), e.beginPath(),
|
|
3217
|
+
if (t.style === "double" && p !== "d") {
|
|
3218
|
+
if (e.strokeStyle = s, e.lineWidth = 1, e.setLineDash([]), e.beginPath(), p === "h") {
|
|
3212
3219
|
let t = l === r, o = t ? r - 1 : r + a + 1, s = t ? r + 1 : r + a - 1;
|
|
3213
3220
|
e.moveTo(n - 1, o), e.lineTo(n + i + 1, o), e.moveTo(n + 1, s), e.lineTo(n + i - 1, s);
|
|
3214
3221
|
} else {
|
|
@@ -3219,12 +3226,12 @@ function qr(e, t, n, r, i, a, o = 1) {
|
|
|
3219
3226
|
continue;
|
|
3220
3227
|
}
|
|
3221
3228
|
e.beginPath(), e.strokeStyle = s;
|
|
3222
|
-
let
|
|
3223
|
-
e.lineWidth =
|
|
3224
|
-
let
|
|
3225
|
-
e.setLineDash(
|
|
3226
|
-
let
|
|
3227
|
-
e.moveTo(c +
|
|
3229
|
+
let m = Jr(t.style);
|
|
3230
|
+
e.lineWidth = m;
|
|
3231
|
+
let h = Yr(t.style);
|
|
3232
|
+
e.setLineDash(h);
|
|
3233
|
+
let g = p === "v" ? d(c, m, o) : 0, _ = p === "h" ? d(l, m, o) : 0;
|
|
3234
|
+
e.moveTo(c + g, l + _), e.lineTo(u + g, f + _), e.stroke(), e.setLineDash([]);
|
|
3228
3235
|
}
|
|
3229
3236
|
}
|
|
3230
3237
|
function Jr(e) {
|
|
@@ -3240,7 +3247,7 @@ function Jr(e) {
|
|
|
3240
3247
|
}
|
|
3241
3248
|
}
|
|
3242
3249
|
function Yr(e) {
|
|
3243
|
-
return
|
|
3250
|
+
return A(e);
|
|
3244
3251
|
}
|
|
3245
3252
|
function Xr(e) {
|
|
3246
3253
|
switch (e) {
|
|
@@ -3264,17 +3271,17 @@ function Zr(e, t) {
|
|
|
3264
3271
|
let n = Xr(e?.style), r = Xr(t?.style);
|
|
3265
3272
|
return n === 0 && r === 0 ? null : n >= r ? e ?? null : t ?? null;
|
|
3266
3273
|
}
|
|
3267
|
-
function Qr(e, n, r, i, a, o, s, c, l, u, d, f
|
|
3268
|
-
if (
|
|
3269
|
-
let
|
|
3270
|
-
for (let
|
|
3271
|
-
let
|
|
3274
|
+
function Qr(e, t, n, r, i, a, o, s, c, l, u, d, f) {
|
|
3275
|
+
if (l <= 0 || u <= 0) return;
|
|
3276
|
+
let p = Ar(t, i, n), m = jr(t, r, n), h = jn(s, l, f, d);
|
|
3277
|
+
for (let r of t.charts) {
|
|
3278
|
+
let i = r.fromCol + 1, g = r.fromRow + 1, _ = r.toCol + 1, v = r.toRow + 1, y = Ar(t, i, n) + r.fromColOff * n / W, b = jr(t, g, n) + r.fromRowOff * n / W, S = Ar(t, _, n) + r.toColOff * n / W, C = jr(t, v, n) + r.toRowOff * n / W, w = S - y, T = C - b;
|
|
3272
3279
|
if (w <= 0 || T <= 0) continue;
|
|
3273
|
-
let E = jn(
|
|
3274
|
-
if (E + w <
|
|
3275
|
-
e.save(), e.beginPath(), e.rect(
|
|
3276
|
-
let O =
|
|
3277
|
-
|
|
3280
|
+
let E = jn(s + (y - p) - a, w, f, d), D = c + (b - m) - o;
|
|
3281
|
+
if (E + w < h || E > h + l || D + T < c || D > c + u) continue;
|
|
3282
|
+
e.save(), e.beginPath(), e.rect(h, c, l, u), e.clip();
|
|
3283
|
+
let O = x * n;
|
|
3284
|
+
_e(e, r.chart, {
|
|
3278
3285
|
x: E,
|
|
3279
3286
|
y: D,
|
|
3280
3287
|
w,
|
|
@@ -3283,16 +3290,16 @@ function Qr(e, n, r, i, a, o, s, c, l, u, d, f, p) {
|
|
|
3283
3290
|
}
|
|
3284
3291
|
}
|
|
3285
3292
|
var $r = "600 12px \"Meiryo UI\", \"Segoe UI\", sans-serif", ei = "11px \"Meiryo UI\", \"Segoe UI\", sans-serif", ti = "#FFFFFF", ni = "#BFBFBF", ri = "#F2F2F2", ii = "#404040", ai = "#FFFFFF", oi = "#000000", si = "#A5A5A5", ci = "#E7E6E6", li = "#A6A6A6", ui = "#C6C6C6";
|
|
3286
|
-
function di(e, n, r, i, a, o, s, c, l, u, d, f
|
|
3287
|
-
if (
|
|
3288
|
-
let
|
|
3289
|
-
if (!
|
|
3290
|
-
let
|
|
3291
|
-
for (let
|
|
3292
|
-
let
|
|
3293
|
-
if (
|
|
3294
|
-
let
|
|
3295
|
-
|
|
3293
|
+
function di(e, t, n, r, i, a, o, s, c, l, u, d, f) {
|
|
3294
|
+
if (l <= 0 || u <= 0) return;
|
|
3295
|
+
let p = t.slicers;
|
|
3296
|
+
if (!p) return;
|
|
3297
|
+
let m = Ar(t, i, n), h = jr(t, r, n), g = jn(s, l, f, d);
|
|
3298
|
+
for (let r of p) {
|
|
3299
|
+
let i = r.fromCol + 1, p = r.fromRow + 1, _ = r.toCol + 1, v = r.toRow + 1, y = Ar(t, i, n) + r.fromColOff * n / W, b = jr(t, p, n) + r.fromRowOff * n / W, x = Ar(t, _, n) + r.toColOff * n / W, S = jr(t, v, n) + r.toRowOff * n / W, C = x - y, w = S - b;
|
|
3300
|
+
if (C <= 0 || w <= 0) continue;
|
|
3301
|
+
let T = jn(s + (y - m) - a, C, f, d), E = c + (b - h) - o;
|
|
3302
|
+
T + C < g || T > g + l || E + w < c || E > c + u || (e.save(), e.beginPath(), e.rect(g, c, l, u), e.clip(), fi(e, r.caption, r.items, T, E, C, w, n), e.restore());
|
|
3296
3303
|
}
|
|
3297
3304
|
}
|
|
3298
3305
|
function fi(e, t, n, r, i, a, o, s) {
|
|
@@ -3327,7 +3334,7 @@ function mi(e, t, n, r, i) {
|
|
|
3327
3334
|
//#endregion
|
|
3328
3335
|
//#region packages/xlsx/src/render-orchestrator.ts
|
|
3329
3336
|
async function hi(e, t, n, r, i = 0, a = 0, o = null, s = null, c) {
|
|
3330
|
-
let l = t === "image/svg+xml", u =
|
|
3337
|
+
let l = t === "image/svg+xml", u = ue(t, o, i, a), d = () => xe(e, t, s, r, {
|
|
3331
3338
|
widthPt: u.widthPt,
|
|
3332
3339
|
heightPt: u.heightPt,
|
|
3333
3340
|
offscreenFactory: c
|
|
@@ -3335,45 +3342,45 @@ async function hi(e, t, n, r, i = 0, a = 0, o = null, s = null, c) {
|
|
|
3335
3342
|
svgImagePath: n,
|
|
3336
3343
|
srcRect: o
|
|
3337
3344
|
};
|
|
3338
|
-
if (
|
|
3339
|
-
return await
|
|
3345
|
+
if (P(f)) try {
|
|
3346
|
+
return await q(f.svgImagePath, r);
|
|
3340
3347
|
} catch {
|
|
3341
|
-
return l ?
|
|
3342
|
-
}
|
|
3343
|
-
return l ?
|
|
3344
|
-
}
|
|
3345
|
-
async function gi(e,
|
|
3346
|
-
if (!
|
|
3347
|
-
let
|
|
3348
|
-
if (e.images) for (let
|
|
3349
|
-
imagePath:
|
|
3350
|
-
mimeType:
|
|
3351
|
-
svgImagePath:
|
|
3352
|
-
widthPt:
|
|
3353
|
-
heightPt:
|
|
3354
|
-
srcRect:
|
|
3355
|
-
duotone:
|
|
3348
|
+
return l ? q(e, r) : d();
|
|
3349
|
+
}
|
|
3350
|
+
return l ? q(e, r) : d();
|
|
3351
|
+
}
|
|
3352
|
+
async function gi(e, n, r, i) {
|
|
3353
|
+
if (!r) return;
|
|
3354
|
+
let a = r, o = /* @__PURE__ */ new Map();
|
|
3355
|
+
if (e.images) for (let n of e.images) o.set(bn(n.imagePath, n.duotone), {
|
|
3356
|
+
imagePath: n.imagePath,
|
|
3357
|
+
mimeType: n.mimeType,
|
|
3358
|
+
svgImagePath: n.svgImagePath,
|
|
3359
|
+
widthPt: n.nativeExtCx > 0 ? n.nativeExtCx / t : 0,
|
|
3360
|
+
heightPt: n.nativeExtCy > 0 ? n.nativeExtCy / t : 0,
|
|
3361
|
+
srcRect: n.srcRect ?? null,
|
|
3362
|
+
duotone: n.duotone ?? null
|
|
3356
3363
|
});
|
|
3357
|
-
if (e.shapeGroups) for (let
|
|
3364
|
+
if (e.shapeGroups) for (let n of e.shapeGroups) for (let e of n.shapes) e.geom.type === "image" && o.set(bn(e.geom.imagePath, e.geom.duotone), {
|
|
3358
3365
|
imagePath: e.geom.imagePath,
|
|
3359
3366
|
mimeType: e.geom.mimeType,
|
|
3360
3367
|
svgImagePath: e.geom.svgImagePath,
|
|
3361
|
-
widthPt:
|
|
3362
|
-
heightPt:
|
|
3368
|
+
widthPt: n.nativeExtCx > 0 ? n.nativeExtCx * e.w / t : 0,
|
|
3369
|
+
heightPt: n.nativeExtCy > 0 ? n.nativeExtCy * e.h / t : 0,
|
|
3363
3370
|
srcRect: e.geom.srcRect ?? null,
|
|
3364
3371
|
duotone: e.geom.duotone ?? null
|
|
3365
3372
|
});
|
|
3366
|
-
|
|
3373
|
+
o.size !== 0 && await Promise.all([...o.entries()].map(async ([e, t]) => {
|
|
3367
3374
|
try {
|
|
3368
|
-
let
|
|
3369
|
-
|
|
3375
|
+
let r = await hi(t.imagePath, t.mimeType, t.svgImagePath, a, t.widthPt, t.heightPt, t.srcRect, t.duotone, i?.offscreenFactory);
|
|
3376
|
+
n.set(e, r);
|
|
3370
3377
|
} catch {
|
|
3371
|
-
|
|
3378
|
+
n.delete(e);
|
|
3372
3379
|
}
|
|
3373
3380
|
}));
|
|
3374
3381
|
}
|
|
3375
3382
|
async function _i(e, t, n, r = {}) {
|
|
3376
|
-
let i = r.fetchImage ?
|
|
3383
|
+
let i = r.fetchImage ? me(r.fetchImage) : void 0;
|
|
3377
3384
|
try {
|
|
3378
3385
|
await vi(e, t, n, r);
|
|
3379
3386
|
} finally {
|
|
@@ -3383,19 +3390,19 @@ async function _i(e, t, n, r = {}) {
|
|
|
3383
3390
|
async function vi(e, t, n, r = {}) {
|
|
3384
3391
|
let { ws: i, styles: a, imageCache: o } = e;
|
|
3385
3392
|
await gi(i, o, r.fetchImage), e.math && Vr(i) && await Hr(i, e.math);
|
|
3386
|
-
let s = r.dpr ??
|
|
3387
|
-
if (t.width !==
|
|
3388
|
-
let e = `${
|
|
3393
|
+
let s = r.dpr ?? _(), c = fe(t) ? t.clientWidth || 800 : t.width, l = fe(t) ? t.clientHeight || 600 : t.height, u = r.width ?? c, d = r.height ?? l, f = N(u * s, d * s), p = f.clamped ? s * f.scale : s, m = f.width, h = f.height;
|
|
3394
|
+
if (t.width !== m && (t.width = m), t.height !== h && (t.height = h), fe(t)) {
|
|
3395
|
+
let e = `${u}px`, n = `${d}px`;
|
|
3389
3396
|
t.style.width !== e && (t.style.width = e), t.style.height !== n && (t.style.height = n);
|
|
3390
3397
|
}
|
|
3391
|
-
let
|
|
3392
|
-
if (
|
|
3393
|
-
yi(
|
|
3398
|
+
let g = t.getContext("2d");
|
|
3399
|
+
if (g.setTransform(p, 0, 0, p, 0, 0), i.parseError) {
|
|
3400
|
+
yi(g, u, d, i.name, i.parseError);
|
|
3394
3401
|
return;
|
|
3395
3402
|
}
|
|
3396
|
-
Or(
|
|
3403
|
+
Or(g, i, a, n, {
|
|
3397
3404
|
...r,
|
|
3398
|
-
dpr:
|
|
3405
|
+
dpr: p,
|
|
3399
3406
|
loadedImages: o
|
|
3400
3407
|
});
|
|
3401
3408
|
}
|
|
@@ -3421,7 +3428,7 @@ function yi(e, t, n, r, i) {
|
|
|
3421
3428
|
//#region packages/xlsx/src/google-fonts.ts
|
|
3422
3429
|
var bi = {
|
|
3423
3430
|
...r,
|
|
3424
|
-
...
|
|
3431
|
+
...u
|
|
3425
3432
|
};
|
|
3426
3433
|
function* xi(e) {
|
|
3427
3434
|
for (let t of e?.sharedStrings ?? []) if (t.runs && t.runs.length > 0) for (let e of t.runs) yield e.text;
|
|
@@ -3429,7 +3436,7 @@ function* xi(e) {
|
|
|
3429
3436
|
}
|
|
3430
3437
|
function Si(e) {
|
|
3431
3438
|
let t = /* @__PURE__ */ new Set(), n = null;
|
|
3432
|
-
for (let r of e?.styles?.fonts ?? []) r.name && (t.add(r.name), n ??=
|
|
3439
|
+
for (let r of e?.styles?.fonts ?? []) r.name && (t.add(r.name), n ??= y(r.name));
|
|
3433
3440
|
for (let r of be(xi(e), n)) t.add(r);
|
|
3434
3441
|
return t;
|
|
3435
3442
|
}
|
|
@@ -3537,7 +3544,7 @@ var Di = class e {
|
|
|
3537
3544
|
googleFontFaces = [];
|
|
3538
3545
|
_mode = "main";
|
|
3539
3546
|
constructor(e, t, n) {
|
|
3540
|
-
this.worker = e, this._mode = t, this.bridge = new
|
|
3547
|
+
this.worker = e, this._mode = t, this.bridge = new j(this.worker, {
|
|
3541
3548
|
correlate: (e) => e.id,
|
|
3542
3549
|
toError: (e) => e.type === "error" ? e.message : void 0
|
|
3543
3550
|
});
|
|
@@ -3556,8 +3563,8 @@ var Di = class e {
|
|
|
3556
3563
|
if (!e.ok) throw Error(`Failed to fetch: ${e.status} ${e.statusText}`);
|
|
3557
3564
|
i = await e.arrayBuffer();
|
|
3558
3565
|
} else i = t;
|
|
3559
|
-
i =
|
|
3560
|
-
let a = new e(r === "worker" ? (await import("./render-worker-host-
|
|
3566
|
+
i = g(await K(i, n.password));
|
|
3567
|
+
let a = new e(r === "worker" ? (await import("./render-worker-host-Custze53.js")).createRenderWorker() : new Pe(), r, n.wasmUrl);
|
|
3561
3568
|
return await a._load(i, n), a;
|
|
3562
3569
|
}
|
|
3563
3570
|
async _load(e, t = {}) {
|
|
@@ -3580,7 +3587,7 @@ var Di = class e {
|
|
|
3580
3587
|
this.parsedWorkbook = JSON.parse(new TextDecoder().decode(new Uint8Array(e)));
|
|
3581
3588
|
}
|
|
3582
3589
|
let r = this.parsedWorkbook?.workbook.parseError;
|
|
3583
|
-
r && console.warn(`[ooxml] xlsx opened with a degraded part: ${r}`), this._mode === "main" && t.useGoogleFonts && (this.googleFontFaces = await
|
|
3590
|
+
r && console.warn(`[ooxml] xlsx opened with a degraded part: ${r}`), this._mode === "main" && t.useGoogleFonts && (this.googleFontFaces = await p(Si(this.parsedWorkbook), bi));
|
|
3584
3591
|
}
|
|
3585
3592
|
get sheetNames() {
|
|
3586
3593
|
return this.parsedWorkbook?.workbook.sheets.map((e) => e.name) ?? [];
|
|
@@ -3675,7 +3682,7 @@ var Di = class e {
|
|
|
3675
3682
|
async renderViewportToBitmap(e, t, n) {
|
|
3676
3683
|
let r = {
|
|
3677
3684
|
...n,
|
|
3678
|
-
dpr: n.dpr ??
|
|
3685
|
+
dpr: n.dpr ?? _()
|
|
3679
3686
|
};
|
|
3680
3687
|
if (this._mode === "worker") {
|
|
3681
3688
|
if (!Number.isInteger(e) || e < 0 || e >= this.sheetCount) throw Error(`Sheet index ${e} out of range (count: ${this.sheetCount})`);
|
|
@@ -3691,7 +3698,7 @@ var Di = class e {
|
|
|
3691
3698
|
return await this.renderViewport(i, e, t, r), i.transferToImageBitmap();
|
|
3692
3699
|
}
|
|
3693
3700
|
destroy() {
|
|
3694
|
-
this.bridge.terminate(), this.parsedWorkbook = null, this.sheetCache.clear(), this.googleFontFaces.length > 0 && (
|
|
3701
|
+
this.bridge.terminate(), this.parsedWorkbook = null, this.sheetCache.clear(), this.googleFontFaces.length > 0 && (te(this.googleFontFaces), this.googleFontFaces = []), this.imageCache.clear(), R(this._fetchImage), Se(this._fetchImage), oe(this._fetchImage), this.imageBlobCache.clear(), this.rawData = null;
|
|
3695
3702
|
}
|
|
3696
3703
|
};
|
|
3697
3704
|
//#endregion
|
|
@@ -3770,7 +3777,7 @@ var Ai = class {
|
|
|
3770
3777
|
for (let r = 0; r < n; r++) {
|
|
3771
3778
|
let n = await this._collectSheetCells(r), i = this._sheetName(r);
|
|
3772
3779
|
for (let a of n) {
|
|
3773
|
-
let n =
|
|
3780
|
+
let n = ne(pe([{ text: a.text }]), e, t);
|
|
3774
3781
|
for (let e of n) {
|
|
3775
3782
|
let t = e.slices[0], n = a.text.slice(t.start, t.end);
|
|
3776
3783
|
this._matches.push({
|
|
@@ -3786,10 +3793,10 @@ var Ai = class {
|
|
|
3786
3793
|
return this.matches();
|
|
3787
3794
|
}
|
|
3788
3795
|
next() {
|
|
3789
|
-
return this._active =
|
|
3796
|
+
return this._active = he(this._active, this._matches.length), this._activePublic();
|
|
3790
3797
|
}
|
|
3791
3798
|
prev() {
|
|
3792
|
-
return this._active =
|
|
3799
|
+
return this._active = le(this._active, this._matches.length), this._activePublic();
|
|
3793
3800
|
}
|
|
3794
3801
|
_activePublic() {
|
|
3795
3802
|
let e = this._locationAt(this._active);
|
|
@@ -4779,7 +4786,7 @@ var oa = class {
|
|
|
4779
4786
|
};
|
|
4780
4787
|
else return !1;
|
|
4781
4788
|
let r = this.opts.onHyperlinkClick;
|
|
4782
|
-
return r ? (r(n), !0) : (n.kind === "external" ?
|
|
4789
|
+
return r ? (r(n), !0) : (n.kind === "external" ? ae(n.url) : this.navigateInternalHyperlink(n.ref), !0);
|
|
4783
4790
|
}
|
|
4784
4791
|
navigateInternalHyperlink(e) {
|
|
4785
4792
|
let t = e.lastIndexOf("!");
|
|
@@ -5041,7 +5048,7 @@ var oa = class {
|
|
|
5041
5048
|
r.style.cssText = "display:flex;align-items:center;flex-shrink:0;gap:2px;padding:0 10px;height:100%;color:#555;font-size:12px;user-select:none;";
|
|
5042
5049
|
let i = (e, t, n) => {
|
|
5043
5050
|
let r = document.createElement("button");
|
|
5044
|
-
return r.textContent = e, r.setAttribute("aria-label", t), r.title = t, r.style.cssText = "width:18px;height:18px;padding:0;border:none;background:transparent;color:#555;font-size:14px;line-height:1;cursor:pointer;border-radius:3px;", r.addEventListener("click", n), r;
|
|
5051
|
+
return r.type = "button", r.textContent = e, r.setAttribute("aria-label", t), r.title = t, r.style.cssText = "width:18px;height:18px;padding:0;border:none;background:transparent;color:#555;font-size:14px;line-height:1;cursor:pointer;border-radius:3px;", r.addEventListener("click", n), r;
|
|
5045
5052
|
}, a = document.createElement("input");
|
|
5046
5053
|
a.type = "range", a.min = "0", a.max = "100", a.step = "any", a.value = String(this.zoomScaleToPos(n, e, t)), a.setAttribute("aria-label", "Zoom"), a.title = "Zoom", a.classList.add("xlsx-zoom-slider"), a.style.cssText = "width:90px;cursor:pointer;", a.addEventListener("input", () => this.setScale(this.zoomPosToScale(Number(a.value), e, t)));
|
|
5047
5054
|
let o = document.createElement("span");
|
|
@@ -5061,8 +5068,8 @@ var oa = class {
|
|
|
5061
5068
|
let e = this.effectiveScrollLeft, t = this.scrollHost.scrollTop;
|
|
5062
5069
|
if (this.layoutGutters(), this.updateSpacerSize(this.currentWorksheet), o) {
|
|
5063
5070
|
let n = Math.max(0, this.scrollHost.scrollHeight - this.scrollHost.clientHeight);
|
|
5064
|
-
this.scrollHost.scrollTop =
|
|
5065
|
-
let r = this.screenX(o.x, 0), s = this.maxScrollLeft, c =
|
|
5071
|
+
this.scrollHost.scrollTop = se(t, o.y, a, i, { maxScroll: n });
|
|
5072
|
+
let r = this.screenX(o.x, 0), s = this.maxScrollLeft, c = se(e, r, a, i, { maxScroll: s });
|
|
5066
5073
|
this.effectiveH = c, this.scrollHost.scrollLeft = this.isRtl ? Math.max(0, s - c) : c;
|
|
5067
5074
|
} else this.effectiveH = e, this.isRtl && (this.scrollHost.scrollLeft = Math.max(0, this.maxScrollLeft - e));
|
|
5068
5075
|
}
|
|
@@ -5073,10 +5080,10 @@ var oa = class {
|
|
|
5073
5080
|
return this.opts.cellScale ?? 1;
|
|
5074
5081
|
}
|
|
5075
5082
|
zoomIn() {
|
|
5076
|
-
this.setScale(
|
|
5083
|
+
this.setScale(H(this.getScale()));
|
|
5077
5084
|
}
|
|
5078
5085
|
zoomOut() {
|
|
5079
|
-
this.setScale(
|
|
5086
|
+
this.setScale(de(this.getScale()));
|
|
5080
5087
|
}
|
|
5081
5088
|
fitWidth() {
|
|
5082
5089
|
this._fit("width");
|
|
@@ -5264,12 +5271,12 @@ var oa = class {
|
|
|
5264
5271
|
destroy() {
|
|
5265
5272
|
this._destroyed = !0, this._loadGen++, this.resizeObserver?.disconnect(), this._rafId !== null && typeof cancelAnimationFrame == "function" && (cancelAnimationFrame(this._rafId), this._rafId = null), this._renderSeq++, this.hideCommentPopup(), this.hideValidationPanel(), this.keydownHandler && document.removeEventListener("keydown", this.keydownHandler), this._find.invalidate(), this.wb?.destroy(), this.wrapper.remove();
|
|
5266
5273
|
}
|
|
5267
|
-
}, sa = /* @__PURE__ */
|
|
5274
|
+
}, sa = /* @__PURE__ */ e({
|
|
5268
5275
|
OoxmlError: () => F,
|
|
5269
5276
|
XlsxViewer: () => oa,
|
|
5270
5277
|
XlsxWorkbook: () => Di,
|
|
5271
|
-
autoResize: () =>
|
|
5272
|
-
openExternalHyperlink: () =>
|
|
5278
|
+
autoResize: () => L,
|
|
5279
|
+
openExternalHyperlink: () => ae,
|
|
5273
5280
|
resolveSharedStrings: () => Ci
|
|
5274
5281
|
});
|
|
5275
5282
|
//#endregion
|