@pan-stack/test 0.0.7 → 0.0.8
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/bin/pan-test-doc.js +1279 -233
- package/bin/pan-test.js +1457 -415
- package/package.json +1 -1
package/bin/pan-test-doc.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire as __panCreateRequire } from 'node:module'; const require = __panCreateRequire(import.meta.url);
|
|
3
|
-
var
|
|
3
|
+
var Gg=Object.create;var aa=Object.defineProperty;var zg=Object.getOwnPropertyDescriptor;var Vg=Object.getOwnPropertyNames;var Xg=Object.getPrototypeOf,Yg=Object.prototype.hasOwnProperty;var Jr=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,n)=>(typeof require<"u"?require:t)[n]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var Ae=(e,t)=>()=>(e&&(t=e(e=0)),t);var B=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),oa=(e,t)=>{for(var n in t)aa(e,n,{get:t[n],enumerable:!0})},Jg=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Vg(t))!Yg.call(e,i)&&i!==n&&aa(e,i,{get:()=>t[i],enumerable:!(r=zg(t,i))||r.enumerable});return e};var Qg=(e,t,n)=>(n=e!=null?Gg(Xg(e)):{},Jg(t||!e||!e.__esModule?aa(n,"default",{value:e,enumerable:!0}):n,e));var R,S=Ae(()=>{R={"index.html":`<!doctype html>
|
|
4
4
|
<html lang="vi" data-theme="system">
|
|
5
5
|
<head>
|
|
6
6
|
<meta charset="utf-8">
|
|
@@ -291,6 +291,14 @@ var hg=Object.create;var zs=Object.defineProperty;var fg=Object.getOwnPropertyDe
|
|
|
291
291
|
.ptx-findings { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
|
|
292
292
|
.ptx-common { background: var(--pb-surface-2); }
|
|
293
293
|
.ptx-word { width: 100%; height: calc(100vh - 220px); min-height: 480px; border: 1px solid var(--pb-border); border-radius: var(--pb-radius); background: #e9ecef; }
|
|
294
|
+
.ptx-run { max-width: 820px; padding: 20px 22px; outline: none; }
|
|
295
|
+
.ptx-run:focus-visible { box-shadow: 0 0 0 3px var(--pb-primary-soft); }
|
|
296
|
+
.ptx-run__head { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 6px; }
|
|
297
|
+
.ptx-run__title { margin: 4px 0 12px; font-size: 18px; font-weight: 600; }
|
|
298
|
+
.ptx-run__block { margin: 0 0 12px; }
|
|
299
|
+
.ptx-run__text { white-space: pre-wrap; font-size: 15px; line-height: 1.6; }
|
|
300
|
+
.ptx-run__actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
|
|
301
|
+
.ptx-run__btn { gap: 8px; }
|
|
294
302
|
.ptx-check { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; cursor: pointer; }
|
|
295
303
|
</style>
|
|
296
304
|
<script src="ui/i18n.js"></script>
|
|
@@ -2438,7 +2446,8 @@ tr.pb-flash > td { animation: pb-flash 1.2s ease-out 1 both; }
|
|
|
2438
2446
|
{ id: 'giong-doc', label: 'Gi\u1ECDng \u0111\u1ECDc', desc: 'L\u1ED3ng ti\u1EBFng, k\u1ECBch b\u1EA3n \u0111\u1ECDc', ico: 'mic' },
|
|
2439
2447
|
{ id: 'ban-giao', label: 'B\xE0n giao', desc: 'T\xE0i li\u1EC7u b\xE0n giao, b\xECnh lu\u1EADn', ico: 'package' },
|
|
2440
2448
|
{ id: 'tai-lieu-ba', label: 'T\xE0i li\u1EC7u BA', desc: '\u0110\u1EB7c t\u1EA3, tham chi\u1EBFu, xu\u1EA5t DOCX/PDF', ico: 'file-text' },
|
|
2441
|
-
{ id: '
|
|
2449
|
+
{ id: 'test-docs', label: 'T\xE0i li\u1EC7u ki\u1EC3m th\u1EED', desc: 'K\u1ECBch b\u1EA3n ki\u1EC3m th\u1EED, k\u1EBFt qu\u1EA3, xu\u1EA5t b\xE0n giao', ico: 'check' },
|
|
2450
|
+
{ id: 'handover-docs', label: 'T\xE0i li\u1EC7u b\xE0n giao', desc: 'H\u01B0\u1EDBng d\u1EABn c\xE0i \u0111\u1EB7t, v\u1EADn h\xE0nh, s\u1EED d\u1EE5ng \u2014 xu\u1EA5t Word', ico: 'package' },
|
|
2442
2451
|
];
|
|
2443
2452
|
var ROLE_LABEL = { ba: 'BA', 'ba-lead': 'BA Lead', designer: 'Designer' };
|
|
2444
2453
|
var refs = {};
|
|
@@ -2493,7 +2502,7 @@ tr.pb-flash > td { animation: pb-flash 1.2s ease-out 1 both; }
|
|
|
2493
2502
|
if (cur) return;
|
|
2494
2503
|
// Nh\xFAng trong Pan Studio Desktop (?host=desktop): \xABStudio thi\u1EBFt k\u1EBF\xBB l\xE0 workspace Thi\u1EBFt k\u1EBF c\u1EE7a Desktop \u2014 b\xE1o c\u1EEDa s\u1ED5 cha chuy\u1EC3n.
|
|
2495
2504
|
var host = (W.location.search.match(/[?&]host=([a-z]+)/) || [])[1];
|
|
2496
|
-
if (host === 'desktop' && W.parent !== W && (w.id === 'studio' || w.id === 'tai-lieu-ba' || w.id === '
|
|
2505
|
+
if (host === 'desktop' && W.parent !== W && (w.id === 'studio' || w.id === 'tai-lieu-ba' || w.id === 'test-docs' || w.id === 'handover-docs')) { W.parent.postMessage({ panBa: 'workspace', id: w.id }, '*'); return; }
|
|
2497
2506
|
toast('\xAB' + w.label + '\xBB l\xE0 workspace c\u1EE7a Pan Studio \u2014 m\u1EDF tr\xEAn Pan Studio Desktop ho\u1EB7c studio.dev.pro.vn.', { kind: 'info' });
|
|
2498
2507
|
});
|
|
2499
2508
|
grid.appendChild(b);
|
|
@@ -3432,6 +3441,11 @@ tr.pb-flash > td { animation: pb-flash 1.2s ease-out 1 both; }
|
|
|
3432
3441
|
'\u0110\xF3ng panel': 'Close panel', 'M\u1EDF panel': 'Open panel', 'Kh\xF4ng c\xF3 th\xF4ng b\xE1o m\u1EDBi': 'No new notifications', '\u0110\xE1nh d\u1EA5u \u0111\xE3 \u0111\u1ECDc': 'Mark as read',
|
|
3433
3442
|
'G\xF5 m\xE3, t\xEAn ho\u1EB7c s\u1ED1 m\u1EE5c': 'Type a code, name or section number', 'Kh\xF4ng th\u1EA5y k\u1EBFt qu\u1EA3': 'No results',
|
|
3434
3443
|
};
|
|
3444
|
+
// nh\xE3n workspace (b\u1ED9 ch\u1ECDn workspace trong trang)
|
|
3445
|
+
Object.assign(EN, {"T\xE0i li\u1EC7u ki\u1EC3m th\u1EED": "Test documents", "K\u1ECBch b\u1EA3n ki\u1EC3m th\u1EED, k\u1EBFt qu\u1EA3, xu\u1EA5t b\xE0n giao": "Test scenarios, results, handover export", "T\xE0i li\u1EC7u b\xE0n giao": "Handover documents", "H\u01B0\u1EDBng d\u1EABn c\xE0i \u0111\u1EB7t, v\u1EADn h\xE0nh, s\u1EED d\u1EE5ng \u2014 xu\u1EA5t Word": "Installation, operation and user guides \u2014 Word export"});
|
|
3446
|
+
// Pan Test (app t\xE0i li\u1EC7u ki\u1EC3m th\u1EED) \u2014 ch\u1EEF ri\xEAng c\u1EE7a app.browser.js
|
|
3447
|
+
Object.assign(EN, {"Tr\u1EE3 l\xFD AI": "AI assistant", "AI l\xE0m vi\u1EC7c ngay trong repo t\xE0i li\u1EC7u ki\u1EC3m th\u1EED: th\xEAm / s\u1EEDa k\u1ECBch b\u1EA3n v\xE0 t\xECnh hu\u1ED1ng b\u1EB1ng l\u1EC7nh pan test (m\xE3 kh\xF4ng tr\xF9ng, k\u1EBFt qu\u1EA3 gi\u1EEF nguy\xEAn), t\u1EF1 ch\u1EA1y pan test check, kh\xF4ng commit. Xong b\u1EA1n xem thay \u0111\u1ED5i r\u1ED3i Gi\u1EEF ho\u1EB7c Ho\xE0n t\xE1c.": "The AI works right in this test document repo: it adds / edits suites and cases with pan test commands (unique codes, results kept), runs pan test check itself and never commits. Then review the changes and Keep or Undo.", "Ng\u1EEF c\u1EA3nh:": "Context:", "ph\xE2n h\u1EC7 {m}": "module {m}", "B\u1ED5 sung t\xECnh hu\u1ED1ng": "Add missing cases", "Vi\u1EBFt t\xECnh hu\u1ED1ng": "Write test cases", "R\xE0 so\xE1t": "Review", "K\u1ECBch b\u1EA3n c\xF2n thi\u1EBFu": "Missing suites", "S\u1EEDa l\u1ED7i ki\u1EC3m tra": "Fix check issues", "B\u1ED5 sung t\xECnh hu\u1ED1ng c\xF2n thi\u1EBFu cho k\u1ECBch b\u1EA3n {c} \xAB{t}\xBB (\u0111\u1ED1i chi\u1EBFu t\xE0i li\u1EC7u BA{v}).": "Add the missing test cases to suite {c} \xAB{t}\xBB (compare with the BA document{v}).", "Vi\u1EBFt c\xE1c t\xECnh hu\u1ED1ng ki\u1EC3m th\u1EED cho k\u1ECBch b\u1EA3n {c} \xAB{t}\xBB theo t\xE0i li\u1EC7u BA{v}.": "Write the test cases for suite {c} \xAB{t}\xBB from the BA document{v}.", "R\xE0 so\xE1t k\u1ECBch b\u1EA3n {c} \xAB{t}\xBB: b\u01B0\u1EDBc m\u01A1 h\u1ED3, k\u1EBFt qu\u1EA3 mong \u0111\u1EE3i kh\xF4ng ki\u1EC3m \u0111\u01B0\u1EE3c, tr\xF9ng l\u1EB7p \u2014 s\u1EEDa b\u1EB1ng l\u1EC7nh v\xE0 b\xE1o l\u1EA1i.": "Review suite {c} \xAB{t}\xBB: vague steps, unverifiable expected results, duplicates \u2014 fix with commands and report back.", "\u0110\u1ED1i chi\u1EBFu t\xE0i li\u1EC7u BA: ch\u1EE9c n\u0103ng n\xE0o c\u1EE7a ph\xE2n h\u1EC7 {m} ch\u01B0a c\xF3 k\u1ECBch b\u1EA3n? T\u1EA1o k\u1ECBch b\u1EA3n + t\xECnh hu\u1ED1ng cho c\xE1c ch\u1EE9c n\u0103ng \u0111\xF3.": "Compare with the BA document: which functions of module {m} have no suite? Create suites + cases for them.", "Ch\u1EA1y pan test check r\u1ED3i s\u1EEDa c\xE1c l\u1ED7i / c\u1EA3nh b\xE1o.": "Run pan test check, then fix the errors / warnings."});
|
|
3448
|
+
Object.assign(EN, { "B\u1EA3n b\xE0n giao \u2014 \u0111\xFAng m\u1EABu: T\xECnh hu\u1ED1ng | C\xE1c b\u01B0\u1EDBc | K\u1EBFt qu\u1EA3 mong \u0111\u1EE3i": "Handover copy \u2014 template columns: Test case | Steps | Expected result", "B\u1EA5m \xABTh\xEAm k\u1ECBch b\u1EA3n\xBB \u2014 m\u1ED7i k\u1ECBch b\u1EA3n \u1EE9ng v\u1EDBi m\u1ED9t ch\u1EE9c n\u0103ng / UC.": "Click \xABAdd test suite\xBB \u2014 one suite per function / use case.", "B\u1EA5m \xABTh\xEAm ph\xE2n h\u1EC7\xBB \u0111\u1EC3 b\u1EAFt \u0111\u1EA7u.": "Click \xABAdd module\xBB to start.", "B\u1EA5m \xABTh\xEAm ph\xE2n h\u1EC7\xBB \u0111\u1EC3 t\u1EA1o nh\xF3m ch\u1EE9c n\u0103ng \u0111\u1EA7u ti\xEAn.": "Click \xABAdd module\xBB to create the first function group.", "B\u1ECB ch\u1EB7n": "Blocked", "Cao": "High", "Ch\u01B0a c\xF3 k\u1ECBch b\u1EA3n": "No test suites yet", "Ch\u01B0a c\xF3 ph\xE2n h\u1EC7": "No modules yet", "Ch\u01B0a c\xF3 t\xECnh hu\u1ED1ng \u2014 b\u1EA5m \xABTh\xEAm t\xECnh hu\u1ED1ng\xBB.": "No test cases yet \u2014 click \xABAdd test case\xBB.", "Ch\u01B0a c\xF3 \u2014 b\u01B0\u1EDBc chu\u1EA9n b\u1ECB d\xF9ng chung cho m\u1ECDi k\u1ECBch b\u1EA3n c\u1EE7a ph\xE2n h\u1EC7 (\u0111\u0103ng nh\u1EADp, m\u1EDF c\xF4ng c\u1EE5\u2026).": "None yet \u2014 preparation shared by every suite of the module (sign in, open the tool\u2026).", "Ch\u01B0a ghi ch\u1EE9c n\u0103ng \u0111\u01B0\u1EE3c ki\u1EC3m": "No function linked yet", "Ch\u01B0a li\xEAn k\u1EBFt repo t\xE0i li\u1EC7u BA (kho\xE1 \xABba\xBB trong .pantest.yaml) \u2014 ch\u01B0a ki\u1EC3m \u0111\u01B0\u1EE3c \u0111\u1ED9 ph\u1EE7 ch\u1EE9c n\u0103ng.": "No BA document repo linked (\xABba\xBB in .pantest.yaml) \u2014 function coverage cannot be checked.", "Ch\u01B0a test": "Not run", "Ch\u1EA1y test": "Run tests", "Ch\u1ECDn k\u1EBFt qu\u1EA3 test": "Choose the test result", "Ch\u1ECDn m\u1ED9t k\u1ECBch b\u1EA3n \u0111\u1EC3 xem v\xE0 s\u1EEDa thu\u1ED9c t\xEDnh.": "Select a test suite to view and edit its properties.", "Ch\u1ECDn \xEDt nh\u1EA5t m\u1ED9t \u0111\u1ECBnh d\u1EA1ng.": "Choose at least one format.", "C\xE1c b\u01B0\u1EDBc th\u1EF1c hi\u1EC7n": "Steps", "C\xE1c b\u01B0\u1EDBc th\u1EF1c hi\u1EC7n chung": "Common steps", "C\xE1c b\u01B0\u1EDBc th\u1EF1c hi\u1EC7n chung \u2014 {m}": "Common steps \u2014 {m}", "D\xF9ng g\u1EA1ch \u0111\u1EA7u d\xF2ng \xAB- \xBB cho t\u1EEBng b\u01B0\u1EDBc.": "Use a \xAB- \xBB bullet for each step.", "Ghi k\u1EBFt qu\u1EA3 {t} t\xECnh hu\u1ED1ng: \u0111\u1EA1t {p}, kh\xF4ng \u0111\u1EA1t {f}.": "Recorded {t} test case results: {p} passed, {f} failed.", "G\xF5 m\xE3 ho\u1EB7c t\xEAn ch\u1EE9c n\u0103ng\u2026": "Type a function code or name\u2026", "Hi\u1EC7n m\xE3 t\xECnh hu\u1ED1ng (TC-\u2026)": "Show test case codes (TC-\u2026)", "H\u1EC7 th\u1ED1ng b\xE1o l\u1ED7i \u2026 / m\xE0n kh\xF4ng hi\u1EC7n \u2026": "The system shows error \u2026 / the screen does not open \u2026", "H\u1EC7 th\u1ED1ng \u2026": "The system \u2026", "Kh\xF4ng c\xF2n t\xECnh hu\u1ED1ng n\xE0o \u1EDF \u0111\xE2y.": "No test cases left here.", "Kh\xF4ng c\xF3 l\u1ED7i hay c\u1EA3nh b\xE1o.": "No errors or warnings.", "Kh\xF4ng c\xF3 t\xECnh hu\u1ED1ng \u1EDF tr\u1EA1ng th\xE1i n\xE0y.": "No test cases with this result.", "Kh\xF4ng ki\u1EC3m \u0111\u01B0\u1EE3c": "Could not run the checks", "Kh\xF4ng m\u1EDF \u0111\u01B0\u1EE3c t\xE0i li\u1EC7u ki\u1EC3m th\u1EED": "Could not open the test documents", "Kh\xF4ng th\xEAm \u0111\u01B0\u1EE3c": "Could not add", "Kh\xF4ng th\u1EA5y repo BA \xAB{p}\xBB \u2014 b\u1ECF qua ki\u1EC3m tham chi\u1EBFu v\xE0 \u0111\u1ED9 ph\u1EE7.": "BA repo \xAB{p}\xBB not found \u2014 reference and coverage checks skipped.", "Kh\xF4ng t\u1EA1o \u0111\u01B0\u1EE3c": "Could not create", "Kh\xF4ng \u0111\u1EA1t": "Failed", "Kh\xF4ng \u0111\u1EA1t: c\u1EA7n ghi k\u1EBFt qu\u1EA3 th\u1EF1c t\u1EBF.": "Failed: enter the actual result.", "Kh\xF4ng \u0111\u1ECDc \u0111\u01B0\u1EE3c repo t\xE0i li\u1EC7u ki\u1EC3m th\u1EED": "Could not read the test document repo", "Ki\u1EC3m tra t\xE0i li\u1EC7u ki\u1EC3m th\u1EED": "Check the test documents", "Ki\u1EC3u t\xE0i li\u1EC7u": "Document type", "K\xE8m k\u1EBFt qu\u1EA3 test": "With test results", "K\xE8m k\u1EBFt qu\u1EA3 test \u2014 th\xEAm c\u1ED9t K\u1EBFt qu\u1EA3, Ng\u01B0\u1EDDi test / ng\xE0y v\xE0 ph\u1EE5 l\u1EE5c t\u1ED5ng h\u1EE3p": "With test results \u2014 adds Result and Tester / date columns and a summary appendix", "K\u1EBFt qu\u1EA3 ch\u1EA1y t\u1EF1 \u0111\u1ED9ng (results.json)\u2026": "Automated run results (results.json)\u2026", "K\u1EBFt qu\u1EA3 mong \u0111\u1EE3i": "Expected result", "K\u1EBFt qu\u1EA3 th\u1EF1c t\u1EBF": "Actual result", "K\u1EBFt qu\u1EA3 th\u1EF1c t\u1EBF (b\u1EAFt bu\u1ED9c khi Kh\xF4ng \u0111\u1EA1t)": "Actual result (required when Failed)", "K\u1ECBch b\u1EA3n": "Test suite", "K\u1ECBch b\u1EA3n .feature (pan-test)\u2026": ".feature scenarios (pan-test)\u2026", "K\u1ECBch b\u1EA3n c\u1EA7n t\xEAn.": "The test suite needs a name.", "K\u1ECBch b\u1EA3n ki\u1EC3m th\u1EED": "Test scenario", "K\u1ECBch b\u1EA3n v\xE0 m\u1ECDi t\xECnh hu\u1ED1ng \u1EA9n kh\u1ECFi t\xE0i li\u1EC7u; t\u1EC7p v\xE0 m\xE3 gi\u1EEF l\u1EA1i.": "The suite and its test cases are hidden from the document; the file and codes are kept.", "Link l\u1ED7i": "Bug link", "L\u01B0u k\u1EBFt qu\u1EA3": "Save result", "L\u01B0u thu\u1ED9c t\xEDnh": "Save properties", "L\u1ECDc t\xECnh hu\u1ED1ng theo k\u1EBFt qu\u1EA3": "Filter test cases by result", "M\xE3 ch\u1EE9c n\u0103ng, c\xE1ch nhau b\u1EB1ng d\u1EA5u ph\u1EA9y": "Function codes, comma separated", "M\xE3 ph\xE2n h\u1EC7 (ch\u1EEF hoa / s\u1ED1, 2\u201312 k\xFD t\u1EF1)": "Module code (capitals / digits, 2\u201312 characters)", "M\xF4 t\u1EA3 / ghi ch\xFA": "Description / notes", "M\xF4 t\u1EA3 t\xECnh hu\u1ED1ng\u2026": "Describe the test case\u2026", "M\xF4i tr\u01B0\u1EDDng": "Environment", "M\u1ECDi ph\xE2n h\u1EC7": "All modules", "M\u1ECDi t\xECnh hu\u1ED1ng": "All test cases", "Ng\u01B0\u1EDDi t\u1EA1o": "Created by", "Phi ch\u1EE9c n\u0103ng": "Non-functional", "Ph\xE2n h\u1EC7 ch\u01B0a c\xF3 k\u1ECBch b\u1EA3n": "This module has no test suites yet", "Ph\xE2n h\u1EC7 \u0111ang ch\u1ECDn": "Current module", "Ph\u1EE7 ch\u1EE9c n\u0103ng (t\xE0i li\u1EC7u BA)": "Covered functions (BA documents)", "Ph\u1EE7:": "Covers:", "So\u1EA1n xong": "Done", "S\u1EEDa thu\u1ED9c t\xEDnh": "Edit properties", "Th\xEAm k\u1ECBch b\u1EA3n": "Add test suite", "Th\xEAm k\u1ECBch b\u1EA3n ki\u1EC3m th\u1EED": "Add a test suite", "Th\xEAm k\u1ECBch b\u1EA3n sau": "Add a test suite after", "Th\xEAm ph\xE2n h\u1EC7": "Add module", "Th\xEAm thao t\xE1c": "More actions", "Th\xEAm t\xECnh hu\u1ED1ng": "Add test case", "Th\u1EA5p": "Low", "Th\u1EF1c t\u1EBF:": "Actual:", "Trung b\xECnh": "Medium", "Tr\u01B0\u1EDBc": "Previous", "T\xE0i li\u1EC7u ki\u1EC3m th\u1EED": "Test documents", "T\xEAn ch\u1EE9c n\u0103ng / UC \u0111\u01B0\u1EE3c ki\u1EC3m": "Function / use case under test", "T\xEAn k\u1ECBch b\u1EA3n": "Suite name", "T\xEAn ph\xE2n h\u1EC7 / nh\xF3m ch\u1EE9c n\u0103ng": "Module / function group name", "T\xECnh hu\u1ED1ng": "Test case", "T\xECnh hu\u1ED1ng m\u1EDBi": "New test case", "T\xECnh hu\u1ED1ng \u1EA9n kh\u1ECFi t\xE0i li\u1EC7u; m\xE3 gi\u1EEF l\u1EA1i trong t\u1EC7p \u0111\u1EC3 kh\xF4ng b\u1ECB d\xF9ng l\u1EA1i.": "The test case is hidden from the document; its code stays in the file so it is never reused.", "T\u1EA1o": "Create", "T\u1ED5ng": "Total", "T\u1ED5ng h\u1EE3p": "Summary", "T\u1ED5ng h\u1EE3p k\u1EBFt qu\u1EA3 ki\u1EC3m th\u1EED": "Test results summary", "T\u1EF7 l\u1EC7 \u0111\u1EA1t": "Pass rate", "Xo\xE1": "Delete", "Xo\xE1 k\u1ECBch b\u1EA3n": "Delete test suite", "Xo\xE1 k\u1ECBch b\u1EA3n {code}?": "Delete test suite {code}?", "Xo\xE1 t\xECnh hu\u1ED1ng": "Delete test case", "Xo\xE1 t\xECnh hu\u1ED1ng {code}?": "Delete test case {code}?", "Xu\u1EA5t t\xE0i li\u1EC7u ki\u1EC3m th\u1EED": "Export the test documents", "Y\xEAu c\u1EA7u": "Requirement", "{m} t\xECnh hu\u1ED1ng kh\xF4ng c\xF2n trong t\u1EC7p \u2014 gi\u1EEF nguy\xEAn, xem l\u1EA1i.": "{m} test case(s) no longer in the file \u2014 kept, please review.", "{n} kh\xF4ng \u0111\u1EA1t": "{n} failed", "{n} tag ch\u01B0a c\xF3 trong t\xE0i li\u1EC7u.": "{n} tag(s) not in the documents yet.", "{p}/{t} \u0111\u1EA1t": "{p}/{t} passed", "{t} \xB7 \u0111\u1EA1t {p} \xB7 kh\xF4ng \u0111\u1EA1t {f} \xB7 ch\u01B0a test {n}": "{t} \xB7 {p} passed \xB7 {f} failed \xB7 {n} not run", "\u0110ang xu\u1EA5t\u2026": "Exporting\u2026", "\u0110i\u1EC1u ki\u1EC7n ti\xEAn quy\u1EBFt": "Preconditions", "\u0110i\u1EC1u ki\u1EC7n ti\xEAn quy\u1EBFt:": "Preconditions:", "\u0110\xE1nh d\u1EA5u so\u1EA1n xong": "Mark as done", "\u0110\xE1nh d\u1EA5u \u0111ang so\u1EA1n": "Mark as drafting", "\u0110\xE3 nh\u1EADp {f} t\u1EC7p: th\xEAm {a}, c\u1EADp nh\u1EADt {u} t\xECnh hu\u1ED1ng.": "Imported {f} file(s): {a} added, {u} updated test case(s).", "\u0110\xE3 test {d}/{t}": "Tested {d}/{t}", "\u0110\xE3 xu\u1EA5t:": "Exported:", "\u0110\u1EA1t": "Passed", "\u0110\u1EA1t / t\u1ED5ng t\xECnh hu\u1ED1ng": "Passed / total test cases", "\u0110\u1ED3ng b\u1ED9 d\u1EEF li\u1EC7u, Qu\u1EA3n tr\u1ECB\u2026": "Data sync, Administration\u2026", "\u0110\u1ED5i b\u1ED9 l\u1ECDc \u0111\u1EC3 xem l\u1EA1i c\xE1c t\xECnh hu\u1ED1ng kh\xE1c.": "Change the filter to see other test cases.", "\u0110\u1ED9 ph\u1EE7 ch\u1EE9c n\u0103ng t\xE0i li\u1EC7u BA: {c}/{f} ch\u1EE9c n\u0103ng c\xF3 k\u1ECBch b\u1EA3n.": "BA function coverage: {c}/{f} functions have test suites.", "\u01AFu ti\xEAn": "Priority", "\u01AFu ti\xEAn:": "Priority:", "B\u1ECF qua": "Skipped", "Sau": "Next", "K\u1ECBch b\u1EA3n ki\u1EC3m th\u1EED, k\u1EBFt qu\u1EA3, xu\u1EA5t b\xE0n giao": "Test scenarios, results, handover export", "K\u1ECBch b\u1EA3n ki\u1EC3m th\u1EED UAT": "UAT test scenarios" });
|
|
3435
3449
|
var PATTERNS = [
|
|
3436
3450
|
[/^(\\d{2}) \xB7 Kh\xF4ng gian ph\xE2n h\u1EC7$/, '$1 \xB7 Module workspace'], [/^(\\d{2}) \xB7 Ki\u1EC3m tra$/, '$1 \xB7 Checks'],
|
|
3437
3451
|
[/^D\u1EF1 \xE1n (.+), d\u1EF1 \xE1n con (.+)\\. \u0110\u1ED5i d\u1EF1 \xE1n con$/, 'Project $1, product $2. Switch product'], [/^Ph\xE2n h\u1EC7: (.+)\\. \u0110\u1ED5i ph\xE2n h\u1EC7$/, 'Module: $1. Switch module'],
|
|
@@ -3478,6 +3492,8 @@ tr.pb-flash > td { animation: pb-flash 1.2s ease-out 1 both; }
|
|
|
3478
3492
|
// quen tay: c\xE2y m\u1EE5c l\u1EE5c b\xEAn tr\xE1i, th\u1EBB k\u1ECBch b\u1EA3n \u1EDF gi\u1EEFa, panel Chi ti\u1EBFt b\xEAn ph\u1EA3i, l\u0103ng k\xEDnh T\xE0i li\u1EC7u / T\u1ED5ng h\u1EE3p / Ki\u1EC3m tra.
|
|
3479
3493
|
// M\u1ECDi thay \u0111\u1ED5i ghi qua API c\u1EE5c b\u1ED9 (src/doc/server.ts) \u2014 server ghi t\u1EC7p, app \u0111\u1ECDc l\u1EA1i.
|
|
3480
3494
|
|
|
3495
|
+
import { initAssist, mountAi, renderCtx, askAi } from './assist.js';
|
|
3496
|
+
|
|
3481
3497
|
const P = window.PanBA;
|
|
3482
3498
|
const h = P.h;
|
|
3483
3499
|
const T = (s, o) => window.PanBAi18n.T(s, o);
|
|
@@ -3485,7 +3501,7 @@ const TOKEN = (document.querySelector('meta[name="pantest-token"]') || {}).conte
|
|
|
3485
3501
|
|
|
3486
3502
|
/** D\u1EEF li\u1EC7u t\u1EEB /api/index: { root, me, config, modules, suites, ba, summary, readErrors }. */
|
|
3487
3503
|
let D = null;
|
|
3488
|
-
const ST = { mod: null, sel: null, lens: '
|
|
3504
|
+
const ST = { mod: null, sel: null, lens: 'document', filter: 'all' };
|
|
3489
3505
|
|
|
3490
3506
|
const STATUS = {
|
|
3491
3507
|
'not-run': { label: T('Ch\u01B0a test'), tone: 'neutral', ico: 'clock' },
|
|
@@ -3556,7 +3572,7 @@ const baTitle = (code) => { const it = (D.ba.items || []).find((i) => i.code ===
|
|
|
3556
3572
|
async function boot() {
|
|
3557
3573
|
await load();
|
|
3558
3574
|
window.PANBA_UI = {
|
|
3559
|
-
root: D.root, me: D.me, workspace: T('T\xE0i li\u1EC7u ki\u1EC3m th\u1EED'), wsId: '
|
|
3575
|
+
root: D.root, me: D.me, workspace: T('T\xE0i li\u1EC7u ki\u1EC3m th\u1EED'), wsId: 'test-docs', brand: 'Pan Test',
|
|
3560
3576
|
screens: [{ id: '02', file: './' + location.search, label: T('K\u1ECBch b\u1EA3n ki\u1EC3m th\u1EED'), ico: 'layers' }],
|
|
3561
3577
|
};
|
|
3562
3578
|
ST.mod = (D.modules[0] || {}).code || null;
|
|
@@ -3568,10 +3584,11 @@ async function boot() {
|
|
|
3568
3584
|
|
|
3569
3585
|
let UI = null; let lensTabs = null; const lensPanels = {};
|
|
3570
3586
|
const LENSES = [
|
|
3571
|
-
{ id: '
|
|
3572
|
-
{ id: '
|
|
3573
|
-
{ id: '
|
|
3574
|
-
{ id: '
|
|
3587
|
+
{ id: 'document', label: T('T\xE0i li\u1EC7u'), icon: 'file-text', testid: 'lens-document' },
|
|
3588
|
+
{ id: 'run', label: T('Ch\u1EA1y test'), icon: 'play', testid: 'lens-run' },
|
|
3589
|
+
{ id: 'word', label: T('Xem nh\u01B0 Word'), icon: 'book', testid: 'lens-word' },
|
|
3590
|
+
{ id: 'summary', label: T('T\u1ED5ng h\u1EE3p'), icon: 'table', testid: 'lens-summary' },
|
|
3591
|
+
{ id: 'check', label: T('Ki\u1EC3m tra'), icon: 'shield', testid: 'lens-check' },
|
|
3575
3592
|
];
|
|
3576
3593
|
|
|
3577
3594
|
function mountUi() {
|
|
@@ -3579,14 +3596,20 @@ function mountUi() {
|
|
|
3579
3596
|
id: '02', title: T('T\xE0i li\u1EC7u ki\u1EC3m th\u1EED'), module: ST.mod,
|
|
3580
3597
|
crumbs: [{ label: 'Pan Studio' }, { label: T('T\xE0i li\u1EC7u ki\u1EC3m th\u1EED') }, { label: D.config.title }],
|
|
3581
3598
|
actions: [
|
|
3582
|
-
{ id: '
|
|
3583
|
-
{ id: '
|
|
3584
|
-
{ id: '
|
|
3585
|
-
{ id: '
|
|
3599
|
+
{ id: 'add-suite', label: T('Th\xEAm k\u1ECBch b\u1EA3n'), icon: 'plus', kind: 'secondary', testid: 'add-suite', onClick: () => newSuiteDialog() },
|
|
3600
|
+
{ id: 'add-module', label: T('Th\xEAm ph\xE2n h\u1EC7'), icon: 'layers', kind: 'secondary', testid: 'add-module', onClick: () => newModuleDialog() },
|
|
3601
|
+
{ id: 'import', label: T('Nh\u1EADp'), icon: 'upload', kind: 'secondary', testid: 'import', onClick: (e) => importMenu(e && e.currentTarget) },
|
|
3602
|
+
{ id: 'export', label: T('Xu\u1EA5t'), icon: 'download', kind: 'secondary', testid: 'export', onClick: () => exportDialog() },
|
|
3603
|
+
{ id: 'reload', label: T('T\u1EA3i l\u1EA1i'), icon: 'refresh', kind: 'secondary', testid: 'reload', onClick: () => reload() },
|
|
3586
3604
|
],
|
|
3587
3605
|
left: true, stickyHead: true,
|
|
3588
|
-
right: { title: T('Chi ti\u1EBFt'), tabs: [{ id: '
|
|
3606
|
+
right: { title: T('Chi ti\u1EBFt'), tabs: [{ id: 'properties', label: T('Thu\u1ED9c t\xEDnh') }, { id: 'tro-ly', label: T('Tr\u1EE3 l\xFD AI'), testid: 'rtab-tro-ly' }] },
|
|
3589
3607
|
});
|
|
3608
|
+
// Tr\u1EE3 l\xFD AI: khung ch\xE9p nguy\xEAn t\u1EEB Pan BA (assist.js) \u2014 l\xF5i ch\u1EA1y qua \`pan ai-host\`, l\u1EDDi d\u1EB7n ri\xEAng Pan Test \u1EDF server
|
|
3609
|
+
initAssist({ P, h, D: () => D, M: () => ({ item: () => null, personName: () => '', rows: () => [] }), ST, PRODUCT: '', reload, select: (code) => goTo(code), rightTabs: UI.rightTabs, panel: UI.panel,
|
|
3610
|
+
aiHint: T('AI l\xE0m vi\u1EC7c ngay trong repo t\xE0i li\u1EC7u ki\u1EC3m th\u1EED: th\xEAm / s\u1EEDa k\u1ECBch b\u1EA3n v\xE0 t\xECnh hu\u1ED1ng b\u1EB1ng l\u1EC7nh pan test (m\xE3 kh\xF4ng tr\xF9ng, k\u1EBFt qu\u1EA3 gi\u1EEF nguy\xEAn), t\u1EF1 ch\u1EA1y pan test check, kh\xF4ng commit. Xong b\u1EA1n xem thay \u0111\u1ED5i r\u1ED3i Gi\u1EEF ho\u1EB7c Ho\xE0n t\xE1c.'),
|
|
3611
|
+
ctxView: aiContext });
|
|
3612
|
+
mountAi(UI.rightTabs.panels['tro-ly']).catch((e) => UI.rightTabs.panels['tro-ly'].appendChild(h('p', { class: 'pb-muted' }, String(e.message || e))));
|
|
3590
3613
|
LENSES.forEach((l, i) => { lensPanels[l.id] = h('div', { class: 'pb-tabpanel', 'data-testid': 'lp-' + l.id, hidden: i > 0 || null }); });
|
|
3591
3614
|
lensTabs = P.tabs(LENSES, { panels: lensPanels, label: T('L\u0103ng k\xEDnh'), onChange: (id) => { ST.lens = id; renderMain(); } });
|
|
3592
3615
|
const head = UI.headExtra || UI.main;
|
|
@@ -3597,7 +3620,7 @@ function mountUi() {
|
|
|
3597
3620
|
}
|
|
3598
3621
|
|
|
3599
3622
|
function filterSelect() {
|
|
3600
|
-
const sel = h('select', { class: 'pb-select ptx-filter', 'aria-label': T('L\u1ECDc t\xECnh hu\u1ED1ng theo k\u1EBFt qu\u1EA3'), 'data-testid': '
|
|
3623
|
+
const sel = h('select', { class: 'pb-select ptx-filter', 'aria-label': T('L\u1ECDc t\xECnh hu\u1ED1ng theo k\u1EBFt qu\u1EA3'), 'data-testid': 'result-filter' },
|
|
3601
3624
|
h('option', { value: 'all' }, T('M\u1ECDi t\xECnh hu\u1ED1ng')),
|
|
3602
3625
|
STATUS_ORDER.map((k) => h('option', { value: k }, STATUS[k].label)));
|
|
3603
3626
|
sel.addEventListener('change', () => { ST.filter = sel.value; renderMain(); });
|
|
@@ -3605,7 +3628,7 @@ function filterSelect() {
|
|
|
3605
3628
|
return h('span', { class: 'ptx-filterbox' }, sel);
|
|
3606
3629
|
}
|
|
3607
3630
|
|
|
3608
|
-
function renderAll() { renderTree(); renderMain(); renderRight(); }
|
|
3631
|
+
function renderAll() { renderTree(); renderMain(); renderRight(); renderCtx(); }
|
|
3609
3632
|
|
|
3610
3633
|
function fromHash() {
|
|
3611
3634
|
const code = decodeURIComponent(location.hash.slice(1));
|
|
@@ -3614,9 +3637,9 @@ function fromHash() {
|
|
|
3614
3637
|
if (!s) return;
|
|
3615
3638
|
if (s.module !== ST.mod) { ST.mod = s.module; P.module(s.module); }
|
|
3616
3639
|
ST.sel = s.code;
|
|
3617
|
-
if (ST.lens !== '
|
|
3640
|
+
if (ST.lens !== 'document') lensTabs.select('document');
|
|
3618
3641
|
renderAll();
|
|
3619
|
-
requestAnimationFrame(() => { const el = document.getElementById(code === s.code ? 'item-' + s.code : 'case-' + code); if (el) el.scrollIntoView({ block: 'start' }); });
|
|
3642
|
+
requestAnimationFrame(() => { lazy.now(document.getElementById('item-' + s.code)); const el = document.getElementById(code === s.code ? 'item-' + s.code : 'case-' + code); if (el) el.scrollIntoView({ block: 'start' }); });
|
|
3620
3643
|
}
|
|
3621
3644
|
|
|
3622
3645
|
function select(code) {
|
|
@@ -3624,13 +3647,13 @@ function select(code) {
|
|
|
3624
3647
|
UI.left.querySelectorAll('.pbx-node').forEach((b) => b.setAttribute('aria-current', String(b.dataset.code === code)));
|
|
3625
3648
|
document.querySelectorAll('.pbx-item.is-selected').forEach((c) => c.classList.remove('is-selected'));
|
|
3626
3649
|
const card = document.getElementById('item-' + code); if (card) card.classList.add('is-selected');
|
|
3627
|
-
renderRight();
|
|
3650
|
+
renderRight(); renderCtx();
|
|
3628
3651
|
}
|
|
3629
3652
|
function goTo(code) {
|
|
3630
3653
|
select(code);
|
|
3631
|
-
if (ST.lens !== '
|
|
3654
|
+
if (ST.lens !== 'document') { lensTabs.select('document'); }
|
|
3632
3655
|
const el = document.getElementById('item-' + code);
|
|
3633
|
-
if (el) el.scrollIntoView({ block: 'start'
|
|
3656
|
+
if (el) { lazy.now(el); el.scrollIntoView({ block: 'start' }); }
|
|
3634
3657
|
}
|
|
3635
3658
|
|
|
3636
3659
|
// ---------------------------------------------------------------- c\xE2y b\xEAn tr\xE1i
|
|
@@ -3669,12 +3692,13 @@ function renderTree() {
|
|
|
3669
3692
|
// ---------------------------------------------------------------- v\xF9ng gi\u1EEFa
|
|
3670
3693
|
function renderMain() {
|
|
3671
3694
|
const el = lensPanels[ST.lens]; if (!el) return;
|
|
3672
|
-
const f = document.querySelector('.ptx-filterbox'); if (f) f.hidden = ST.lens !== '
|
|
3695
|
+
const f = document.querySelector('.ptx-filterbox'); if (f) f.hidden = ST.lens !== 'document';
|
|
3673
3696
|
el.replaceChildren();
|
|
3674
|
-
if (ST.lens === '
|
|
3675
|
-
else if (ST.lens === '
|
|
3676
|
-
else if (ST.lens === '
|
|
3677
|
-
else if (ST.lens === '
|
|
3697
|
+
if (ST.lens === 'document') renderWork(el);
|
|
3698
|
+
else if (ST.lens === 'word') renderRead(el);
|
|
3699
|
+
else if (ST.lens === 'run') renderRun(el);
|
|
3700
|
+
else if (ST.lens === 'summary') renderSummary(el);
|
|
3701
|
+
else if (ST.lens === 'check') renderCheck(el).catch((e) => el.appendChild(h('p', { class: 'pb-muted' }, String(e.message || e))));
|
|
3678
3702
|
}
|
|
3679
3703
|
|
|
3680
3704
|
/** \u0110o\u1EA1n v\u0103n Markdown \u0111\u01A1n gi\u1EA3n: \u0111o\u1EA1n, g\u1EA1ch \u0111\u1EA7u d\xF2ng, \u0111\xE1nh s\u1ED1. */
|
|
@@ -3694,28 +3718,55 @@ function prose(text, testid) {
|
|
|
3694
3718
|
function renderWork(el) {
|
|
3695
3719
|
const m = D.modules.find((x) => x.code === ST.mod);
|
|
3696
3720
|
if (!m) { el.appendChild(h('div', { class: 'pb-empty' }, h('div', { class: 'pb-empty__title' }, T('Ch\u01B0a c\xF3 ph\xE2n h\u1EC7')), h('p', { class: 'pb-muted' }, T('B\u1EA5m \xABTh\xEAm ph\xE2n h\u1EC7\xBB \u0111\u1EC3 b\u1EAFt \u0111\u1EA7u.')))); return; }
|
|
3697
|
-
const editCommon = h('button', { type: 'button', class: 'pb-btn pb-btn--ghost', 'data-testid': '
|
|
3721
|
+
const editCommon = h('button', { type: 'button', class: 'pb-btn pb-btn--ghost', 'data-testid': 'edit-common-steps', html: P.icon('edit', { size: 16 }) + ' ' + T('S\u1EEDa') });
|
|
3698
3722
|
editCommon.addEventListener('click', () => commonStepsDialog(m));
|
|
3699
3723
|
el.appendChild(h('h2', { class: 'pbx-ch', 'data-testid': 'module-title' }, modIndex(m.code) + '. ' + m.title));
|
|
3700
|
-
el.appendChild(h('section', { class: 'pb-card pbx-item ptx-common', 'data-testid': '
|
|
3724
|
+
el.appendChild(h('section', { class: 'pb-card pbx-item ptx-common', 'data-testid': 'common-steps' },
|
|
3701
3725
|
h('div', { class: 'pbx-item__head' }, h('b', null, T('C\xE1c b\u01B0\u1EDBc th\u1EF1c hi\u1EC7n chung')), editCommon),
|
|
3702
|
-
prose(m.commonSteps, '
|
|
3726
|
+
prose(m.commonSteps, 'common-steps-body') || h('p', { class: 'pb-muted' }, T('Ch\u01B0a c\xF3 \u2014 b\u01B0\u1EDBc chu\u1EA9n b\u1ECB d\xF9ng chung cho m\u1ECDi k\u1ECBch b\u1EA3n c\u1EE7a ph\xE2n h\u1EC7 (\u0111\u0103ng nh\u1EADp, m\u1EDF c\xF4ng c\u1EE5\u2026).'))));
|
|
3703
3727
|
const suites = modSuites(m.code);
|
|
3704
|
-
if (!suites.length) el.appendChild(h('div', { class: 'pb-empty', 'data-testid': '
|
|
3705
|
-
|
|
3728
|
+
if (!suites.length) el.appendChild(h('div', { class: 'pb-empty', 'data-testid': 'no-suites' }, h('div', { class: 'pb-empty__title' }, T('Ph\xE2n h\u1EC7 ch\u01B0a c\xF3 k\u1ECBch b\u1EA3n')), h('p', { class: 'pb-muted' }, T('B\u1EA5m \xABTh\xEAm k\u1ECBch b\u1EA3n\xBB \u2014 m\u1ED7i k\u1ECBch b\u1EA3n \u1EE9ng v\u1EDBi m\u1ED9t ch\u1EE9c n\u0103ng / UC.'))));
|
|
3729
|
+
lazy.reset(el);
|
|
3730
|
+
for (const s of suites) el.appendChild(lazy.add(suiteCard(s, true), s));
|
|
3731
|
+
lazy.start();
|
|
3706
3732
|
}
|
|
3707
3733
|
|
|
3734
|
+
/** B\u1EA3ng t\xECnh hu\u1ED1ng d\u1EF1ng khi th\u1EBB s\u1EAFp v\xE0o khung nh\xECn (\xB1 1500 px), g\u1EE1 khi ra xa (\u2265 6000 px) \u2014 gi\u1EEF chi\u1EC1u cao \u0111\u1EC3 thanh cu\u1ED9n
|
|
3735
|
+
* kh\xF4ng nh\u1EA3y; th\u1EBB \u0111ang c\xF3 con tr\u1ECF kh\xF4ng b\u1ECB g\u1EE1. Ph\xE2n h\u1EC7 ngh\xECn t\xECnh hu\u1ED1ng kh\xF4ng d\u1EF1ng h\xE0ng ngh\xECn \xF4 s\u1EEDa m\u1ED9t l\xFAc. */
|
|
3736
|
+
const lazy = (() => {
|
|
3737
|
+
let near = null; let far = null; let cards = []; let host = null;
|
|
3738
|
+
const scrollerOf = (el) => { for (let e = el && el.parentElement; e && e !== document.body; e = e.parentElement) { const oy = getComputedStyle(e).overflowY; if (oy === 'auto' || oy === 'scroll') return e; } return null; };
|
|
3739
|
+
const fill = (card) => { if (card._filled || !card._fill) return; card._fill(); card._filled = true; card.style.minHeight = ''; };
|
|
3740
|
+
const empty = (card) => {
|
|
3741
|
+
if (!card._filled || card.contains(document.activeElement)) return;
|
|
3742
|
+
const hgt = card.getBoundingClientRect().height;
|
|
3743
|
+
card._unfill(); card._filled = false; card.style.minHeight = hgt + 'px';
|
|
3744
|
+
};
|
|
3745
|
+
return {
|
|
3746
|
+
reset(el) { if (near) near.disconnect(); if (far) far.disconnect(); cards = []; host = el; },
|
|
3747
|
+
add(card, s) { card.style.minHeight = (160 + liveCases(s).length * 120) + 'px'; cards.push(card); return card; },
|
|
3748
|
+
start() {
|
|
3749
|
+
if (!('IntersectionObserver' in window)) { cards.forEach(fill); return; }
|
|
3750
|
+
const root = scrollerOf(host);
|
|
3751
|
+
near = new IntersectionObserver((es) => es.forEach((e) => { if (e.isIntersecting) fill(e.target); }), { root, rootMargin: '1500px 0px' });
|
|
3752
|
+
far = new IntersectionObserver((es) => es.forEach((e) => { if (!e.isIntersecting) empty(e.target); }), { root, rootMargin: '6000px 0px' });
|
|
3753
|
+
cards.forEach((c) => { near.observe(c); far.observe(c); });
|
|
3754
|
+
},
|
|
3755
|
+
now(card) { if (card) fill(card); },
|
|
3756
|
+
};
|
|
3757
|
+
})();
|
|
3758
|
+
|
|
3708
3759
|
function statusBadge(st, extra) {
|
|
3709
3760
|
const s = STATUS[st] || STATUS['not-run'];
|
|
3710
3761
|
return h('span', Object.assign({ class: 'pb-badge', 'data-tone': s.tone, 'data-status': st }, extra || {}), P.iconEl(s.ico, { size: 14, stroke: 2 }), s.label);
|
|
3711
3762
|
}
|
|
3712
3763
|
|
|
3713
|
-
function suiteCard(s) {
|
|
3764
|
+
function suiteCard(s, deferBody) {
|
|
3714
3765
|
const cases = liveCases(s);
|
|
3715
3766
|
const c = countOf(cases);
|
|
3716
3767
|
const codeBtn = h('button', { type: 'button', class: 'pb-code pbx-item__code', 'data-testid': 'copy-code-' + s.code, title: T('B\u1EA5m \u0111\u1EC3 ch\xE9p m\xE3') }, s.code);
|
|
3717
3768
|
codeBtn.addEventListener('click', (e) => { e.stopPropagation(); void copyText(s.code, T('\u0110\xE3 ch\xE9p m\xE3 {code}.', { code: s.code })); });
|
|
3718
|
-
const add = h('button', { type: 'button', class: 'pb-btn pb-btn--ghost', 'data-testid': '
|
|
3769
|
+
const add = h('button', { type: 'button', class: 'pb-btn pb-btn--ghost', 'data-testid': 'add-case-' + s.code, html: P.icon('plus', { size: 16 }) + ' ' + T('Th\xEAm t\xECnh hu\u1ED1ng') });
|
|
3719
3770
|
add.addEventListener('click', (e) => { e.stopPropagation(); void addCase(s); });
|
|
3720
3771
|
const more = h('button', { type: 'button', class: 'pb-btn pb-btn--ghost pb-btn--icon', 'aria-label': T('Th\xEAm thao t\xE1c'), 'data-testid': 'menu-' + s.code, html: P.icon('more', { size: 16 }) });
|
|
3721
3772
|
more.addEventListener('click', (e) => { e.stopPropagation(); P.menu(more, [
|
|
@@ -3725,10 +3776,10 @@ function suiteCard(s) {
|
|
|
3725
3776
|
{ label: s.status === 'done' ? T('\u0110\xE1nh d\u1EA5u \u0111ang so\u1EA1n') : T('\u0110\xE1nh d\u1EA5u so\u1EA1n xong'), icon: 'check', testid: 'm-done', run: () => void saveSuite(s.code, { status: s.status === 'done' ? 'drafting' : 'done' }) },
|
|
3726
3777
|
{ label: T('Xo\xE1 k\u1ECBch b\u1EA3n'), icon: 'trash', testid: 'm-delete', run: () => confirmDelete(s) },
|
|
3727
3778
|
], { placement: 'bottom-end', testid: 'card-menu' }); });
|
|
3728
|
-
const prog = h('span', { class: 'ptx-prog', 'data-testid': '
|
|
3779
|
+
const prog = h('span', { class: 'ptx-prog', 'data-testid': 'progress-' + s.code, title: T('\u0110\u1EA1t / t\u1ED5ng t\xECnh hu\u1ED1ng') }, T('{p}/{t} \u0111\u1EA1t', { p: c.passed, t: c.total }), c.failed ? h('span', { class: 'ptx-prog__bad' }, ' \xB7 ' + T('{n} kh\xF4ng \u0111\u1EA1t', { n: c.failed })) : null);
|
|
3729
3780
|
const meta = h('div', { class: 'ptx-meta' },
|
|
3730
3781
|
s.kind === 'non-functional' ? h('span', { class: 'pb-badge', 'data-tone': 'violet' }, KIND['non-functional']) : null,
|
|
3731
|
-
s.covers.length ? h('span', { class: 'ptx-meta__item', 'data-testid': '
|
|
3782
|
+
s.covers.length ? h('span', { class: 'ptx-meta__item', 'data-testid': 'covers-' + s.code }, T('Ph\u1EE7:') + ' ', s.covers.map((x) => h('span', { class: 'pb-code', title: baTitle(x) || null }, x))) : (s.kind === 'functional' ? h('span', { class: 'ptx-meta__warn' }, T('Ch\u01B0a ghi ch\u1EE9c n\u0103ng \u0111\u01B0\u1EE3c ki\u1EC3m')) : null),
|
|
3732
3783
|
s.useCases.length ? h('span', { class: 'ptx-meta__item' }, 'UC: ' + s.useCases.join(', ')) : null,
|
|
3733
3784
|
s.priority ? h('span', { class: 'ptx-meta__item' }, T('\u01AFu ti\xEAn:') + ' ' + PRIORITY[s.priority]) : null,
|
|
3734
3785
|
s.status === 'done' ? h('span', { class: 'pb-badge', 'data-tone': 'ok' }, T('So\u1EA1n xong')) : null);
|
|
@@ -3736,8 +3787,11 @@ function suiteCard(s) {
|
|
|
3736
3787
|
h('div', { class: 'pbx-item__head' }, h('span', { class: 'pbx-item__num' }, suiteNum(s)), codeBtn, h('b', null, s.title), prog, h('span', { class: 'pbx-grow' }), add, more),
|
|
3737
3788
|
meta,
|
|
3738
3789
|
s.preconditions ? h('p', { class: 'ptx-pre' }, h('b', null, T('\u0110i\u1EC1u ki\u1EC7n ti\xEAn quy\u1EBFt:') + ' '), s.preconditions) : null,
|
|
3739
|
-
|
|
3740
|
-
|
|
3790
|
+
h('div', { class: 'ptx-suite-body' }));
|
|
3791
|
+
const bodyHost = card.lastChild;
|
|
3792
|
+
card._fill = () => { bodyHost.replaceChildren(...[prose(s.description, 'description-' + s.code), casesTable(s)].filter(Boolean)); };
|
|
3793
|
+
card._unfill = () => bodyHost.replaceChildren();
|
|
3794
|
+
if (!deferBody) { card._fill(); card._filled = true; }
|
|
3741
3795
|
card.addEventListener('click', (e) => { if (!e.target.closest('a,button,input,textarea,select')) select(s.code); });
|
|
3742
3796
|
return card;
|
|
3743
3797
|
}
|
|
@@ -3745,7 +3799,7 @@ function suiteCard(s) {
|
|
|
3745
3799
|
function casesTable(s) {
|
|
3746
3800
|
const nf = s.kind === 'non-functional';
|
|
3747
3801
|
const shown = liveCases(s).filter((c) => ST.filter === 'all' || statusOf(c) === ST.filter);
|
|
3748
|
-
if (!liveCases(s).length) return h('p', { class: 'pb-muted', 'data-testid': '
|
|
3802
|
+
if (!liveCases(s).length) return h('p', { class: 'pb-muted', 'data-testid': 'no-cases-' + s.code }, T('Ch\u01B0a c\xF3 t\xECnh hu\u1ED1ng \u2014 b\u1EA5m \xABTh\xEAm t\xECnh hu\u1ED1ng\xBB.'));
|
|
3749
3803
|
if (!shown.length) return h('p', { class: 'pb-muted' }, T('Kh\xF4ng c\xF3 t\xECnh hu\u1ED1ng \u1EDF tr\u1EA1ng th\xE1i n\xE0y.'));
|
|
3750
3804
|
const cols = nf ? [T('Y\xEAu c\u1EA7u'), T('K\u1ECBch b\u1EA3n ki\u1EC3m th\u1EED'), T('K\u1EBFt qu\u1EA3 mong \u0111\u1EE3i')] : [T('T\xECnh hu\u1ED1ng'), T('C\xE1c b\u01B0\u1EDBc th\u1EF1c hi\u1EC7n'), T('K\u1EBFt qu\u1EA3 mong \u0111\u1EE3i')];
|
|
3751
3805
|
const fields = nf ? ['requirement', 'steps', 'expected'] : ['case', 'steps', 'expected'];
|
|
@@ -3758,7 +3812,7 @@ function casesTable(s) {
|
|
|
3758
3812
|
h('td', { class: 'ptx-result' }, resultCell(c)));
|
|
3759
3813
|
return row;
|
|
3760
3814
|
}));
|
|
3761
|
-
return h('div', { class: 'pb-grid-wrap' }, h('table', { class: 'pb-grid ptx-cases', 'data-testid': '
|
|
3815
|
+
return h('div', { class: 'pb-grid-wrap' }, h('table', { class: 'pb-grid ptx-cases', 'data-testid': 'cases-table-' + s.code },
|
|
3762
3816
|
h('colgroup', null, h('col', { style: { width: '56px' } }), h('col', { style: { width: '27%' } }), h('col', { style: { width: '33%' } }), h('col', { style: { width: '27%' } }), h('col', { style: { width: '150px' } })),
|
|
3763
3817
|
h('thead', null, h('tr', null, h('th', null, '#'), cols.map((x) => h('th', null, x)), h('th', null, T('K\u1EBFt qu\u1EA3')))), body));
|
|
3764
3818
|
}
|
|
@@ -3793,21 +3847,21 @@ function caseTools(s, c, i, n) {
|
|
|
3793
3847
|
const code = h('button', { type: 'button', class: 'ptx-code', 'data-testid': 'copy-case-' + c.code, title: T('B\u1EA5m \u0111\u1EC3 ch\xE9p m\xE3') + ' ' + c.code }, c.code.slice(-6));
|
|
3794
3848
|
code.addEventListener('click', (e) => { e.stopPropagation(); void copyText(c.code, T('\u0110\xE3 ch\xE9p m\xE3 {code}.', { code: c.code })); });
|
|
3795
3849
|
return h('div', { class: 'ptx-tools' }, code,
|
|
3796
|
-
btn('chevron-up', T('D\u1EDDi l\xEAn'), '
|
|
3797
|
-
btn('chevron-down', T('D\u1EDDi xu\u1ED1ng'), '
|
|
3798
|
-
btn('trash', T('Xo\xE1 t\xECnh hu\u1ED1ng'), '
|
|
3850
|
+
btn('chevron-up', T('D\u1EDDi l\xEAn'), 'up-' + c.code, () => void moveCase(c, -1), i === 0),
|
|
3851
|
+
btn('chevron-down', T('D\u1EDDi xu\u1ED1ng'), 'down-' + c.code, () => void moveCase(c, 1), i === n - 1),
|
|
3852
|
+
btn('trash', T('Xo\xE1 t\xECnh hu\u1ED1ng'), 'delete-' + c.code, () => deleteCase(c)));
|
|
3799
3853
|
}
|
|
3800
3854
|
|
|
3801
3855
|
function resultCell(c) {
|
|
3802
3856
|
const st = statusOf(c);
|
|
3803
|
-
const btn = h('button', { type: 'button', class: 'ptx-status', 'data-testid': '
|
|
3857
|
+
const btn = h('button', { type: 'button', class: 'ptx-status', 'data-testid': 'result-' + c.code, 'aria-haspopup': 'menu', title: T('Ch\u1ECDn k\u1EBFt qu\u1EA3 test') }, statusBadge(st), P.iconEl('chevron-down', { size: 14 }));
|
|
3804
3858
|
btn.addEventListener('click', (e) => {
|
|
3805
3859
|
e.stopPropagation();
|
|
3806
|
-
P.menu(btn, STATUS_ORDER.map((k) => ({ label: STATUS[k].label, checked: k === st, testid: '
|
|
3860
|
+
P.menu(btn, STATUS_ORDER.map((k) => ({ label: STATUS[k].label, checked: k === st, testid: 'result-pick-' + k, run: () => void chooseResult(c, k) })), { placement: 'bottom-end', testid: 'result-menu' });
|
|
3807
3861
|
});
|
|
3808
3862
|
const r = c.result || {};
|
|
3809
3863
|
const info = r.by ? h('div', { class: 'ptx-by pb-small pb-muted' }, (r.by || '') + (r.at ? ' \xB7 ' + r.at : '') + (r.env ? ' \xB7 ' + r.env : '')) : null;
|
|
3810
|
-
const actual = r.actual ? h('div', { class: 'ptx-actual pb-small', 'data-testid': '
|
|
3864
|
+
const actual = r.actual ? h('div', { class: 'ptx-actual pb-small', 'data-testid': 'actual-' + c.code }, h('b', null, T('Th\u1EF1c t\u1EBF:') + ' '), r.actual) : null;
|
|
3811
3865
|
const bug = r.bug ? h('a', { class: 'pb-small', href: r.bug, target: '_blank', rel: 'noopener noreferrer' }, T('L\u1ED7i')) : null;
|
|
3812
3866
|
return h('div', null, btn, info, actual, bug);
|
|
3813
3867
|
}
|
|
@@ -3820,20 +3874,20 @@ async function chooseResult(c, status) {
|
|
|
3820
3874
|
|
|
3821
3875
|
function resultDialog(c, status) {
|
|
3822
3876
|
const r = c.result || {};
|
|
3823
|
-
const actual = h('textarea', { class: 'pb-textarea', rows: '3', 'data-testid': '
|
|
3877
|
+
const actual = h('textarea', { class: 'pb-textarea', rows: '3', 'data-testid': 'result-actual', placeholder: T('H\u1EC7 th\u1ED1ng b\xE1o l\u1ED7i \u2026 / m\xE0n kh\xF4ng hi\u1EC7n \u2026') });
|
|
3824
3878
|
actual.value = r.actual || '';
|
|
3825
|
-
const env = h('input', { class: 'pb-input', 'data-testid': '
|
|
3826
|
-
const bug = h('input', { class: 'pb-input', 'data-testid': '
|
|
3827
|
-
const err = h('p', { class: 'pb-small', style: { color: 'var(--pb-broken)' }, 'data-testid': '
|
|
3879
|
+
const env = h('input', { class: 'pb-input', 'data-testid': 'result-env', placeholder: 'UAT, SIT\u2026', value: r.env || '' });
|
|
3880
|
+
const bug = h('input', { class: 'pb-input', 'data-testid': 'result-bug', placeholder: 'https://\u2026', value: r.bug || '' });
|
|
3881
|
+
const err = h('p', { class: 'pb-small', style: { color: 'var(--pb-broken)' }, 'data-testid': 'result-error' });
|
|
3828
3882
|
P.dialog({
|
|
3829
|
-
title: STATUS[status].label + ' \xB7 ' + c.code, size: 'sm', testid: '
|
|
3883
|
+
title: STATUS[status].label + ' \xB7 ' + c.code, size: 'sm', testid: 'result-dialog',
|
|
3830
3884
|
body: h('div', { class: 'pb-stack' },
|
|
3831
3885
|
h('label', { class: 'pb-field' }, h('span', { class: 'pb-label' }, T('K\u1EBFt qu\u1EA3 th\u1EF1c t\u1EBF') + (status === 'failed' ? ' *' : '')), actual),
|
|
3832
3886
|
h('label', { class: 'pb-field' }, h('span', { class: 'pb-label' }, T('M\xF4i tr\u01B0\u1EDDng')), env),
|
|
3833
3887
|
h('label', { class: 'pb-field' }, h('span', { class: 'pb-label' }, T('Link l\u1ED7i')), bug), err),
|
|
3834
3888
|
actions: [
|
|
3835
3889
|
{ label: T('Hu\u1EF7'), kind: 'ghost' },
|
|
3836
|
-
{ label: T('L\u01B0u k\u1EBFt qu\u1EA3'), kind: 'primary', testid: '
|
|
3890
|
+
{ label: T('L\u01B0u k\u1EBFt qu\u1EA3'), kind: 'primary', testid: 'result-save', onClick: (_e, dlg) => {
|
|
3837
3891
|
if (status === 'failed' && !actual.value.trim()) { err.textContent = T('Kh\xF4ng \u0111\u1EA1t: c\u1EA7n ghi k\u1EBFt qu\u1EA3 th\u1EF1c t\u1EBF.'); actual.focus(); return false; }
|
|
3838
3892
|
void write('api/result', { code: c.code, status, actual: actual.value, env: env.value, bug: bug.value }).then((x) => { if (x) { patchCase(c, x); dlg.close(); } });
|
|
3839
3893
|
return false;
|
|
@@ -3851,7 +3905,7 @@ function patchCase(c, fresh) {
|
|
|
3851
3905
|
}
|
|
3852
3906
|
function redrawSuite(s) {
|
|
3853
3907
|
const old = document.getElementById('item-' + s.code);
|
|
3854
|
-
if (old && ST.lens === '
|
|
3908
|
+
if (old && ST.lens === 'document') old.replaceWith(suiteCard(s));
|
|
3855
3909
|
const cnt = UI.left.querySelector('[data-testid="tree-count-' + CSS.escape(s.code) + '"]');
|
|
3856
3910
|
if (cnt) { const c = countOf(liveCases(s)); cnt.textContent = ' ' + c.passed + '/' + c.total; }
|
|
3857
3911
|
if (ST.sel === s.code) renderRight();
|
|
@@ -3872,16 +3926,16 @@ async function moveCase(c, dir) {
|
|
|
3872
3926
|
}
|
|
3873
3927
|
function deleteCase(c) {
|
|
3874
3928
|
P.dialog({
|
|
3875
|
-
title: T('Xo\xE1 t\xECnh hu\u1ED1ng {code}?', { code: c.code }), size: 'sm', testid: '
|
|
3929
|
+
title: T('Xo\xE1 t\xECnh hu\u1ED1ng {code}?', { code: c.code }), size: 'sm', testid: 'delete-case-dialog',
|
|
3876
3930
|
body: h('p', null, T('T\xECnh hu\u1ED1ng \u1EA9n kh\u1ECFi t\xE0i li\u1EC7u; m\xE3 gi\u1EEF l\u1EA1i trong t\u1EC7p \u0111\u1EC3 kh\xF4ng b\u1ECB d\xF9ng l\u1EA1i.')),
|
|
3877
|
-
actions: [{ label: T('Hu\u1EF7'), kind: 'ghost' }, { label: T('Xo\xE1'), kind: 'danger', testid: '
|
|
3931
|
+
actions: [{ label: T('Hu\u1EF7'), kind: 'ghost' }, { label: T('Xo\xE1'), kind: 'danger', testid: 'delete-case-ok', onClick: () => { void write('api/case/delete', { code: c.code }).then((r) => { if (r) void reloadKeep(); }); } }],
|
|
3878
3932
|
});
|
|
3879
3933
|
}
|
|
3880
3934
|
function confirmDelete(s) {
|
|
3881
3935
|
P.dialog({
|
|
3882
|
-
title: T('Xo\xE1 k\u1ECBch b\u1EA3n {code}?', { code: s.code }), size: 'sm', testid: '
|
|
3936
|
+
title: T('Xo\xE1 k\u1ECBch b\u1EA3n {code}?', { code: s.code }), size: 'sm', testid: 'delete-suite-dialog',
|
|
3883
3937
|
body: h('p', null, T('K\u1ECBch b\u1EA3n v\xE0 m\u1ECDi t\xECnh hu\u1ED1ng \u1EA9n kh\u1ECFi t\xE0i li\u1EC7u; t\u1EC7p v\xE0 m\xE3 gi\u1EEF l\u1EA1i.')),
|
|
3884
|
-
actions: [{ label: T('Hu\u1EF7'), kind: 'ghost' }, { label: T('Xo\xE1'), kind: 'danger', testid: '
|
|
3938
|
+
actions: [{ label: T('Hu\u1EF7'), kind: 'ghost' }, { label: T('Xo\xE1'), kind: 'danger', testid: 'delete-suite-ok', onClick: () => { void saveSuite(s.code, { status: 'deleted' }).then(() => reloadKeep()); } }],
|
|
3885
3939
|
});
|
|
3886
3940
|
}
|
|
3887
3941
|
async function saveSuite(code, patch) {
|
|
@@ -3904,16 +3958,16 @@ async function reloadKeep() {
|
|
|
3904
3958
|
|
|
3905
3959
|
// ---------------------------------------------------------------- h\u1ED9p tho\u1EA1i t\u1EA1o
|
|
3906
3960
|
function newModuleDialog() {
|
|
3907
|
-
const code = h('input', { class: 'pb-input', 'data-testid': '
|
|
3908
|
-
const title = h('input', { class: 'pb-input', 'data-testid': '
|
|
3961
|
+
const code = h('input', { class: 'pb-input', 'data-testid': 'module-code', placeholder: 'VD: DB, QT, BC', maxlength: '12', autofocus: true });
|
|
3962
|
+
const title = h('input', { class: 'pb-input', 'data-testid': 'module-name', placeholder: T('\u0110\u1ED3ng b\u1ED9 d\u1EEF li\u1EC7u, Qu\u1EA3n tr\u1ECB\u2026') });
|
|
3909
3963
|
const err = h('p', { class: 'pb-small', style: { color: 'var(--pb-broken)' } });
|
|
3910
3964
|
code.addEventListener('input', () => { code.value = code.value.toUpperCase().replace(/[^A-Z0-9]/g, ''); });
|
|
3911
3965
|
P.dialog({
|
|
3912
|
-
title: T('Th\xEAm ph\xE2n h\u1EC7'), size: 'sm', testid: '
|
|
3966
|
+
title: T('Th\xEAm ph\xE2n h\u1EC7'), size: 'sm', testid: 'module-dialog',
|
|
3913
3967
|
body: h('div', { class: 'pb-stack' },
|
|
3914
3968
|
h('label', { class: 'pb-field' }, h('span', { class: 'pb-label' }, T('M\xE3 ph\xE2n h\u1EC7 (ch\u1EEF hoa / s\u1ED1, 2\u201312 k\xFD t\u1EF1)')), code),
|
|
3915
3969
|
h('label', { class: 'pb-field' }, h('span', { class: 'pb-label' }, T('T\xEAn ph\xE2n h\u1EC7 / nh\xF3m ch\u1EE9c n\u0103ng')), title), err),
|
|
3916
|
-
actions: [{ label: T('Hu\u1EF7'), kind: 'ghost' }, { label: T('Th\xEAm'), kind: 'primary', testid: '
|
|
3970
|
+
actions: [{ label: T('Hu\u1EF7'), kind: 'ghost' }, { label: T('Th\xEAm'), kind: 'primary', testid: 'module-ok', onClick: (_e, dlg) => {
|
|
3917
3971
|
void api('api/module/new', { code: code.value, title: title.value }).then(async (r) => {
|
|
3918
3972
|
if (!r.ok) { err.textContent = r.json.error || T('Kh\xF4ng th\xEAm \u0111\u01B0\u1EE3c'); return; }
|
|
3919
3973
|
dlg.close(); ST.mod = r.json.code; await reload(); P.module(r.json.code);
|
|
@@ -3925,17 +3979,17 @@ function newModuleDialog() {
|
|
|
3925
3979
|
|
|
3926
3980
|
function newSuiteDialog(after) {
|
|
3927
3981
|
if (!ST.mod) { newModuleDialog(); return; }
|
|
3928
|
-
const title = h('input', { class: 'pb-input', 'data-testid': '
|
|
3929
|
-
const kind = h('select', { class: 'pb-select', 'data-testid': '
|
|
3982
|
+
const title = h('input', { class: 'pb-input', 'data-testid': 'suite-title', placeholder: T('T\xEAn ch\u1EE9c n\u0103ng / UC \u0111\u01B0\u1EE3c ki\u1EC3m'), autofocus: true });
|
|
3983
|
+
const kind = h('select', { class: 'pb-select', 'data-testid': 'suite-kind' }, Object.keys(KIND).map((k) => h('option', { value: k }, KIND[k])));
|
|
3930
3984
|
const covers = coversPicker([]);
|
|
3931
3985
|
const err = h('p', { class: 'pb-small', style: { color: 'var(--pb-broken)' } });
|
|
3932
3986
|
P.dialog({
|
|
3933
|
-
title: T('Th\xEAm k\u1ECBch b\u1EA3n ki\u1EC3m th\u1EED'), size: 'md', testid: '
|
|
3987
|
+
title: T('Th\xEAm k\u1ECBch b\u1EA3n ki\u1EC3m th\u1EED'), size: 'md', testid: 'suite-dialog',
|
|
3934
3988
|
body: h('div', { class: 'pb-stack' },
|
|
3935
3989
|
h('label', { class: 'pb-field' }, h('span', { class: 'pb-label' }, T('T\xEAn k\u1ECBch b\u1EA3n')), title),
|
|
3936
3990
|
h('label', { class: 'pb-field' }, h('span', { class: 'pb-label' }, T('Lo\u1EA1i')), kind),
|
|
3937
3991
|
h('div', { class: 'pb-field' }, h('span', { class: 'pb-label' }, T('Ph\u1EE7 ch\u1EE9c n\u0103ng (t\xE0i li\u1EC7u BA)')), covers.el), err),
|
|
3938
|
-
actions: [{ label: T('Hu\u1EF7'), kind: 'ghost' }, { label: T('T\u1EA1o'), kind: 'primary', testid: '
|
|
3992
|
+
actions: [{ label: T('Hu\u1EF7'), kind: 'ghost' }, { label: T('T\u1EA1o'), kind: 'primary', testid: 'suite-ok', onClick: (_e, dlg) => {
|
|
3939
3993
|
if (!title.value.trim()) { err.textContent = T('K\u1ECBch b\u1EA3n c\u1EA7n t\xEAn.'); title.focus(); return false; }
|
|
3940
3994
|
void api('api/suite/new', { module: ST.mod, title: title.value, kind: kind.value, covers: covers.get(), after }).then(async (r) => {
|
|
3941
3995
|
if (!r.ok) { err.textContent = r.json.error || T('Kh\xF4ng t\u1EA1o \u0111\u01B0\u1EE3c'); return; }
|
|
@@ -3948,12 +4002,12 @@ function newSuiteDialog(after) {
|
|
|
3948
4002
|
}
|
|
3949
4003
|
|
|
3950
4004
|
function commonStepsDialog(m) {
|
|
3951
|
-
const ta = h('textarea', { class: 'pb-textarea', rows: '10', 'data-testid': '
|
|
4005
|
+
const ta = h('textarea', { class: 'pb-textarea', rows: '10', 'data-testid': 'common-steps-input', placeholder: '- B\u01B0\u1EDBc 1: \u2026\\n- B\u01B0\u1EDBc 2: \u2026' });
|
|
3952
4006
|
ta.value = m.commonSteps || '';
|
|
3953
4007
|
P.dialog({
|
|
3954
|
-
title: T('C\xE1c b\u01B0\u1EDBc th\u1EF1c hi\u1EC7n chung \u2014 {m}', { m: m.title }), size: 'md', testid: '
|
|
4008
|
+
title: T('C\xE1c b\u01B0\u1EDBc th\u1EF1c hi\u1EC7n chung \u2014 {m}', { m: m.title }), size: 'md', testid: 'common-steps-dialog',
|
|
3955
4009
|
body: h('div', { class: 'pb-stack' }, ta, h('p', { class: 'pb-small pb-muted' }, T('D\xF9ng g\u1EA1ch \u0111\u1EA7u d\xF2ng \xAB- \xBB cho t\u1EEBng b\u01B0\u1EDBc.'))),
|
|
3956
|
-
actions: [{ label: T('Hu\u1EF7'), kind: 'ghost' }, { label: T('L\u01B0u'), kind: 'primary', testid: '
|
|
4010
|
+
actions: [{ label: T('Hu\u1EF7'), kind: 'ghost' }, { label: T('L\u01B0u'), kind: 'primary', testid: 'common-steps-save', onClick: () => {
|
|
3957
4011
|
void write('api/module', { code: m.code, commonSteps: ta.value }).then((r) => { if (r) { Object.assign(m, r); renderMain(); } });
|
|
3958
4012
|
} }],
|
|
3959
4013
|
});
|
|
@@ -3962,8 +4016,8 @@ function commonStepsDialog(m) {
|
|
|
3962
4016
|
/** Ch\u1ECDn m\xE3 ch\u1EE9c n\u0103ng / m\xE0n c\u1EE7a repo BA (g\xF5 \u0111\u1EC3 l\u1ECDc); repo BA ch\u01B0a li\xEAn k\u1EBFt th\xEC g\xF5 m\xE3 t\u1EF1 do, c\xE1ch nhau b\u1EB1ng d\u1EA5u ph\u1EA9y. */
|
|
3963
4017
|
function coversPicker(initial) {
|
|
3964
4018
|
let cur = initial.slice();
|
|
3965
|
-
const chips = h('div', { class: 'ptx-chips', 'data-testid': '
|
|
3966
|
-
const input = h('input', { class: 'pb-input', 'data-testid': '
|
|
4019
|
+
const chips = h('div', { class: 'ptx-chips', 'data-testid': 'covers-chips' });
|
|
4020
|
+
const input = h('input', { class: 'pb-input', 'data-testid': 'covers-input', placeholder: D.ba.linked ? T('G\xF5 m\xE3 ho\u1EB7c t\xEAn ch\u1EE9c n\u0103ng\u2026') : T('M\xE3 ch\u1EE9c n\u0103ng, c\xE1ch nhau b\u1EB1ng d\u1EA5u ph\u1EA9y') });
|
|
3967
4021
|
const draw = () => chips.replaceChildren(...cur.map((code) => {
|
|
3968
4022
|
const x = h('button', { type: 'button', class: 'pb-btn pb-btn--ghost pb-btn--icon', 'aria-label': T('B\u1ECF') + ' ' + code, html: P.icon('x', { size: 12 }) });
|
|
3969
4023
|
x.addEventListener('click', () => { cur = cur.filter((c) => c !== code); draw(); });
|
|
@@ -3983,21 +4037,41 @@ function coversPicker(initial) {
|
|
|
3983
4037
|
return { el: h('div', { class: 'pb-stack' }, chips, input), get: () => { if (input.value.trim()) { input.value.split(',').forEach(addCode); input.value = ''; } return cur.slice(); } };
|
|
3984
4038
|
}
|
|
3985
4039
|
|
|
4040
|
+
// ---------------------------------------------------------------- Tr\u1EE3 l\xFD AI: ng\u1EEF c\u1EA3nh + vi\u1EC7c nhanh (m\xF3c ctxView c\u1EE7a khung Pan BA)
|
|
4041
|
+
function aiContext(ctxEl, quickEl, x) {
|
|
4042
|
+
const s = ST.sel && suiteBy(ST.sel);
|
|
4043
|
+
const m = D.modules.find((y) => y.code === ST.mod);
|
|
4044
|
+
ctxEl.replaceChildren(h('span', { class: 'pb-small pb-muted' }, T('Ng\u1EEF c\u1EA3nh:')), ' ',
|
|
4045
|
+
h('span', { class: 'pb-small', 'data-testid': 'ai-ctx-suite' }, s ? s.code + ' \xB7 ' + s.title : m ? T('ph\xE2n h\u1EC7 {m}', { m: m.code + ' \xB7 ' + m.title }) : '\u2014'));
|
|
4046
|
+
const ask = (text) => askAi('tu-do', { text });
|
|
4047
|
+
const q = [];
|
|
4048
|
+
if (s) {
|
|
4049
|
+
const n = liveCases(s).length;
|
|
4050
|
+
q.push(x.btn(n ? T('B\u1ED5 sung t\xECnh hu\u1ED1ng') : T('Vi\u1EBFt t\xECnh hu\u1ED1ng'), { kind: 'secondary', small: true, testid: 'ai-q-cases', onClick: () => ask(n
|
|
4051
|
+
? T('B\u1ED5 sung t\xECnh hu\u1ED1ng c\xF2n thi\u1EBFu cho k\u1ECBch b\u1EA3n {c} \xAB{t}\xBB (\u0111\u1ED1i chi\u1EBFu t\xE0i li\u1EC7u BA{v}).', { c: s.code, t: s.title, v: s.covers.length ? ' ' + s.covers.join(', ') : '' })
|
|
4052
|
+
: T('Vi\u1EBFt c\xE1c t\xECnh hu\u1ED1ng ki\u1EC3m th\u1EED cho k\u1ECBch b\u1EA3n {c} \xAB{t}\xBB theo t\xE0i li\u1EC7u BA{v}.', { c: s.code, t: s.title, v: s.covers.length ? ' ' + s.covers.join(', ') : '' })) }));
|
|
4053
|
+
if (n) q.push(x.btn(T('R\xE0 so\xE1t'), { kind: 'ghost', small: true, testid: 'ai-q-review', onClick: () => ask(T('R\xE0 so\xE1t k\u1ECBch b\u1EA3n {c} \xAB{t}\xBB: b\u01B0\u1EDBc m\u01A1 h\u1ED3, k\u1EBFt qu\u1EA3 mong \u0111\u1EE3i kh\xF4ng ki\u1EC3m \u0111\u01B0\u1EE3c, tr\xF9ng l\u1EB7p \u2014 s\u1EEDa b\u1EB1ng l\u1EC7nh v\xE0 b\xE1o l\u1EA1i.', { c: s.code, t: s.title })) }));
|
|
4054
|
+
}
|
|
4055
|
+
if (m && D.ba && D.ba.linked) q.push(x.btn(T('K\u1ECBch b\u1EA3n c\xF2n thi\u1EBFu'), { kind: 'ghost', small: true, testid: 'ai-q-missing', onClick: () => ask(T('\u0110\u1ED1i chi\u1EBFu t\xE0i li\u1EC7u BA: ch\u1EE9c n\u0103ng n\xE0o c\u1EE7a ph\xE2n h\u1EC7 {m} ch\u01B0a c\xF3 k\u1ECBch b\u1EA3n? T\u1EA1o k\u1ECBch b\u1EA3n + t\xECnh hu\u1ED1ng cho c\xE1c ch\u1EE9c n\u0103ng \u0111\xF3.', { m: m.code })) }));
|
|
4056
|
+
q.push(x.btn(T('S\u1EEDa l\u1ED7i ki\u1EC3m tra'), { kind: 'ghost', small: true, testid: 'ai-q-check', onClick: () => ask(T('Ch\u1EA1y pan test check r\u1ED3i s\u1EEDa c\xE1c l\u1ED7i / c\u1EA3nh b\xE1o.')) }));
|
|
4057
|
+
quickEl.replaceChildren(...q);
|
|
4058
|
+
}
|
|
4059
|
+
|
|
3986
4060
|
// ---------------------------------------------------------------- panel ph\u1EA3i: thu\u1ED9c t\xEDnh k\u1ECBch b\u1EA3n
|
|
3987
4061
|
function renderRight() {
|
|
3988
|
-
const el = UI.rightTabs && UI.rightTabs.panels['
|
|
4062
|
+
const el = UI.rightTabs && UI.rightTabs.panels['properties']; if (!el) return;
|
|
3989
4063
|
el.replaceChildren();
|
|
3990
4064
|
const s = ST.sel && suiteBy(ST.sel);
|
|
3991
4065
|
if (!s) { el.appendChild(h('p', { class: 'pb-muted' }, T('Ch\u1ECDn m\u1ED9t k\u1ECBch b\u1EA3n \u0111\u1EC3 xem v\xE0 s\u1EEDa thu\u1ED9c t\xEDnh.'))); return; }
|
|
3992
4066
|
const c = countOf(liveCases(s));
|
|
3993
|
-
const title = h('input', { class: 'pb-input', 'data-testid': '
|
|
3994
|
-
const kind = h('select', { class: 'pb-select', 'data-testid': '
|
|
3995
|
-
const pr = h('select', { class: 'pb-select', 'data-testid': '
|
|
3996
|
-
const uc = h('input', { class: 'pb-input', 'data-testid': '
|
|
3997
|
-
const pre = h('textarea', { class: 'pb-textarea', rows: '3', 'data-testid': '
|
|
3998
|
-
const desc = h('textarea', { class: 'pb-textarea', rows: '3', 'data-testid': '
|
|
4067
|
+
const title = h('input', { class: 'pb-input', 'data-testid': 'prop-title', value: s.title });
|
|
4068
|
+
const kind = h('select', { class: 'pb-select', 'data-testid': 'prop-kind' }, Object.keys(KIND).map((k) => h('option', { value: k, selected: k === s.kind || null }, KIND[k])));
|
|
4069
|
+
const pr = h('select', { class: 'pb-select', 'data-testid': 'prop-priority' }, h('option', { value: '' }, '\u2014'), Object.keys(PRIORITY).map((k) => h('option', { value: k, selected: k === s.priority || null }, PRIORITY[k])));
|
|
4070
|
+
const uc = h('input', { class: 'pb-input', 'data-testid': 'prop-use-cases', value: s.useCases.join(', '), placeholder: 'UC_F_3, \u2026' });
|
|
4071
|
+
const pre = h('textarea', { class: 'pb-textarea', rows: '3', 'data-testid': 'prop-preconditions' }); pre.value = s.preconditions || '';
|
|
4072
|
+
const desc = h('textarea', { class: 'pb-textarea', rows: '3', 'data-testid': 'prop-description' }); desc.value = s.description || '';
|
|
3999
4073
|
const covers = coversPicker(s.covers);
|
|
4000
|
-
const save = h('button', { type: 'button', class: 'pb-btn pb-btn--primary', 'data-testid': '
|
|
4074
|
+
const save = h('button', { type: 'button', class: 'pb-btn pb-btn--primary', 'data-testid': 'prop-save' }, T('L\u01B0u thu\u1ED9c t\xEDnh'));
|
|
4001
4075
|
save.addEventListener('click', () => void saveSuite(s.code, {
|
|
4002
4076
|
title: title.value, kind: kind.value, priority: pr.value, useCases: uc.value.split(',').map((x) => x.trim()).filter(Boolean),
|
|
4003
4077
|
preconditions: pre.value, description: desc.value, covers: covers.get(),
|
|
@@ -4008,7 +4082,7 @@ function renderRight() {
|
|
|
4008
4082
|
h('div', null, h('span', { class: 'pb-code' }, s.code), h('div', { class: 'pb-h3', style: { marginTop: '4px' } }, s.title)),
|
|
4009
4083
|
h('dl', { class: 'pb-dl' },
|
|
4010
4084
|
h('dt', null, T('S\u1ED1 m\u1EE5c')), h('dd', null, suiteNum(s)),
|
|
4011
|
-
h('dt', null, T('T\xECnh hu\u1ED1ng')), h('dd', { 'data-testid': '
|
|
4085
|
+
h('dt', null, T('T\xECnh hu\u1ED1ng')), h('dd', { 'data-testid': 'prop-total' }, T('{t} \xB7 \u0111\u1EA1t {p} \xB7 kh\xF4ng \u0111\u1EA1t {f} \xB7 ch\u01B0a test {n}', { t: c.total, p: c.passed, f: c.failed, n: c['not-run'] })),
|
|
4012
4086
|
h('dt', null, T('Ng\u01B0\u1EDDi t\u1EA1o')), h('dd', null, (s.created && s.created.by) || s.owner || '\u2014'),
|
|
4013
4087
|
h('dt', null, T('T\u1EC7p')), h('dd', { class: 'pb-small' }, s.file)),
|
|
4014
4088
|
field(T('T\xEAn k\u1ECBch b\u1EA3n'), title), field(T('Lo\u1EA1i'), kind), field(T('\u01AFu ti\xEAn'), pr),
|
|
@@ -4016,12 +4090,119 @@ function renderRight() {
|
|
|
4016
4090
|
field('Use case', uc), field(T('\u0110i\u1EC1u ki\u1EC7n ti\xEAn quy\u1EBFt'), pre), field(T('M\xF4 t\u1EA3 / ghi ch\xFA'), desc), save));
|
|
4017
4091
|
}
|
|
4018
4092
|
|
|
4093
|
+
// ---------------------------------------------------------------- Ch\u1EA1y test: \u0111i l\u1EA7n l\u01B0\u1EE3t t\u1EEBng t\xECnh hu\u1ED1ng nh\u01B0 checklist
|
|
4094
|
+
const RUN = { scope: 'mod', status: 'not-run', i: 0 };
|
|
4095
|
+
function runList() {
|
|
4096
|
+
const suites = RUN.scope === 'mod' ? modSuites(ST.mod) : D.modules.flatMap((m) => modSuites(m.code));
|
|
4097
|
+
const out = [];
|
|
4098
|
+
for (const s of suites) for (const c of liveCases(s)) if (RUN.status === 'all' || statusOf(c) === RUN.status) out.push({ s, c });
|
|
4099
|
+
return out;
|
|
4100
|
+
}
|
|
4101
|
+
function renderRun(el) {
|
|
4102
|
+
el.replaceChildren();
|
|
4103
|
+
const list = runList();
|
|
4104
|
+
if (RUN.i >= list.length) RUN.i = Math.max(0, list.length - 1);
|
|
4105
|
+
const sel = (testid, value, opts, on) => { const x = h('select', { class: 'pb-select', 'data-testid': testid }, opts.map(([v, l]) => h('option', { value: v, selected: v === value || null }, l))); x.addEventListener('change', () => { on(x.value); RUN.i = 0; renderRun(el); }); return h('span', { class: 'ptx-filterbox' }, x); };
|
|
4106
|
+
const allCases = (RUN.scope === 'mod' ? modSuites(ST.mod) : D.suites.filter((s) => s.status !== 'deleted')).flatMap(liveCases);
|
|
4107
|
+
const done = allCases.filter((c) => statusOf(c) !== 'not-run').length;
|
|
4108
|
+
el.appendChild(h('div', { class: 'pbx-bar' },
|
|
4109
|
+
h('div', { class: 'pbx-bar', style: { justifyContent: 'flex-start', marginBottom: '0' } },
|
|
4110
|
+
sel('run-scope', RUN.scope, [['mod', T('Ph\xE2n h\u1EC7 \u0111ang ch\u1ECDn')], ['all', T('M\u1ECDi ph\xE2n h\u1EC7')]], (v) => { RUN.scope = v; }),
|
|
4111
|
+
sel('run-filter', RUN.status, [['not-run', T('Ch\u01B0a test')], ['failed', T('Kh\xF4ng \u0111\u1EA1t')], ['blocked', T('B\u1ECB ch\u1EB7n')], ['all', T('M\u1ECDi t\xECnh hu\u1ED1ng')]], (v) => { RUN.status = v; })),
|
|
4112
|
+
h('span', { class: 'pb-small pb-muted', 'data-testid': 'run-progress' }, T('\u0110\xE3 test {d}/{t}', { d: done, t: allCases.length }))));
|
|
4113
|
+
if (!list.length) { el.appendChild(h('div', { class: 'pb-empty', 'data-testid': 'run-empty' }, h('div', { class: 'pb-empty__title' }, T('Kh\xF4ng c\xF2n t\xECnh hu\u1ED1ng n\xE0o \u1EDF \u0111\xE2y.')), h('p', { class: 'pb-muted' }, T('\u0110\u1ED5i b\u1ED9 l\u1ECDc \u0111\u1EC3 xem l\u1EA1i c\xE1c t\xECnh hu\u1ED1ng kh\xE1c.')))); return; }
|
|
4114
|
+
const { s, c } = list[RUN.i];
|
|
4115
|
+
const block = (label, text, testid) => h('div', { class: 'ptx-run__block' }, h('div', { class: 'pb-label' }, label), h('div', { class: 'ptx-run__text', 'data-testid': testid }, text || '\u2014'));
|
|
4116
|
+
const actual = h('textarea', { class: 'pb-textarea', rows: '3', 'data-testid': 'run-actual', placeholder: T('K\u1EBFt qu\u1EA3 th\u1EF1c t\u1EBF (b\u1EAFt bu\u1ED9c khi Kh\xF4ng \u0111\u1EA1t)') });
|
|
4117
|
+
actual.value = (c.result && c.result.actual) || '';
|
|
4118
|
+
const err = h('p', { class: 'pb-small', style: { color: 'var(--pb-broken)' }, 'data-testid': 'run-error' });
|
|
4119
|
+
const record = async (status) => {
|
|
4120
|
+
if (status === 'failed' && !actual.value.trim()) { err.textContent = T('Kh\xF4ng \u0111\u1EA1t: c\u1EA7n ghi k\u1EBFt qu\u1EA3 th\u1EF1c t\u1EBF.'); actual.focus(); return; }
|
|
4121
|
+
const r = await write('api/result', { code: c.code, status, ...(status === 'failed' || status === 'blocked' ? { actual: actual.value } : {}) });
|
|
4122
|
+
if (!r) return;
|
|
4123
|
+
patchCaseQuiet(c, r);
|
|
4124
|
+
// l\u1ECDc \xABCh\u01B0a test\xBB: t\xECnh hu\u1ED1ng v\u1EEBa ghi r\u1EDDi danh s\xE1ch \u21D2 gi\u1EEF nguy\xEAn ch\u1EC9 s\u1ED1 (sang t\xECnh hu\u1ED1ng k\u1EBF); l\u1ECDc kh\xE1c \u21D2 ti\u1EBFn m\u1ED9t
|
|
4125
|
+
if (RUN.status === 'all' || RUN.status === status) RUN.i += 1;
|
|
4126
|
+
renderRun(el);
|
|
4127
|
+
};
|
|
4128
|
+
const btn = (status, key) => { const b = h('button', { type: 'button', class: 'pb-btn ptx-run__btn', 'data-status': status, 'data-testid': 'run-' + status }, statusBadge(status), h('kbd', { class: 'pb-kbd' }, key)); b.addEventListener('click', () => void record(status)); return b; };
|
|
4129
|
+
const nav = (label, d, testid) => { const b = h('button', { type: 'button', class: 'pb-btn pb-btn--ghost', 'data-testid': testid, disabled: (d < 0 ? RUN.i === 0 : RUN.i >= list.length - 1) || null }, label); b.addEventListener('click', () => { RUN.i += d; renderRun(el); }); return b; };
|
|
4130
|
+
const card = h('section', { class: 'pb-card ptx-run', 'data-testid': 'run-card', tabindex: '0' },
|
|
4131
|
+
h('div', { class: 'ptx-run__head' },
|
|
4132
|
+
h('span', { class: 'pb-small pb-muted' }, (RUN.i + 1) + ' / ' + list.length + ' \xB7 ' + suiteNum(s) + ' ' + s.title),
|
|
4133
|
+
h('span', { class: 'pb-code' }, c.code), statusBadge(statusOf(c))),
|
|
4134
|
+
h('h3', { class: 'ptx-run__title', 'data-testid': 'run-case' }, s.kind === 'non-functional' ? (c.requirement || c.case) : c.case),
|
|
4135
|
+
s.preconditions ? block(T('\u0110i\u1EC1u ki\u1EC7n ti\xEAn quy\u1EBFt'), s.preconditions) : null,
|
|
4136
|
+
block(s.kind === 'non-functional' ? T('K\u1ECBch b\u1EA3n ki\u1EC3m th\u1EED') : T('C\xE1c b\u01B0\u1EDBc th\u1EF1c hi\u1EC7n'), c.steps, 'run-steps'),
|
|
4137
|
+
block(T('K\u1EBFt qu\u1EA3 mong \u0111\u1EE3i'), c.expected, 'run-expected'),
|
|
4138
|
+
actual, err,
|
|
4139
|
+
h('div', { class: 'ptx-run__actions' }, btn('passed', '1'), btn('failed', '2'), btn('blocked', '3'), btn('skipped', '4')),
|
|
4140
|
+
h('div', { class: 'pbx-bar', style: { marginTop: '8px', marginBottom: '0' } }, nav('\u2190 ' + T('Tr\u01B0\u1EDBc'), -1, 'run-prev'), nav(T('Sau') + ' \u2192', 1, 'run-next')));
|
|
4141
|
+
// ph\xEDm t\u1EAFt 1\u20134 khi con tr\u1ECF kh\xF4ng \u1EDF trong \xF4 ch\u1EEF
|
|
4142
|
+
card.addEventListener('keydown', (e) => {
|
|
4143
|
+
if (e.target.closest('textarea,input,select')) return;
|
|
4144
|
+
const k = { 1: 'passed', 2: 'failed', 3: 'blocked', 4: 'skipped' }[e.key];
|
|
4145
|
+
if (k) { e.preventDefault(); void record(k); }
|
|
4146
|
+
if (e.key === 'ArrowRight' && RUN.i < list.length - 1) { RUN.i += 1; renderRun(el); }
|
|
4147
|
+
if (e.key === 'ArrowLeft' && RUN.i > 0) { RUN.i -= 1; renderRun(el); }
|
|
4148
|
+
});
|
|
4149
|
+
el.appendChild(card);
|
|
4150
|
+
requestAnimationFrame(() => { if (!el.contains(document.activeElement)) card.focus({ preventScroll: true }); });
|
|
4151
|
+
}
|
|
4152
|
+
/** C\u1EADp nh\u1EADt d\u1EEF li\u1EC7u m\u1ED9t t\xECnh hu\u1ED1ng m\xE0 kh\xF4ng v\u1EBD l\u1EA1i l\u0103ng k\xEDnh T\xE0i li\u1EC7u (\u0111ang \u1EDF Ch\u1EA1y test); c\xE2y tr\xE1i v\u1EABn c\u1EADp nh\u1EADt s\u1ED1. */
|
|
4153
|
+
function patchCaseQuiet(c, fresh) {
|
|
4154
|
+
Object.keys(c).forEach((k) => { delete c[k]; });
|
|
4155
|
+
Object.assign(c, fresh);
|
|
4156
|
+
const s = D.suites.find((x) => x.cases.includes(c));
|
|
4157
|
+
if (!s) return;
|
|
4158
|
+
const cnt = UI.left.querySelector('[data-testid="tree-count-' + CSS.escape(s.code) + '"]');
|
|
4159
|
+
if (cnt) { const n = countOf(liveCases(s)); cnt.textContent = ' ' + n.passed + '/' + n.total; }
|
|
4160
|
+
}
|
|
4161
|
+
|
|
4162
|
+
// ---------------------------------------------------------------- Nh\u1EADp: .feature (pan-test) v\xE0 k\u1EBFt qu\u1EA3 ch\u1EA1y t\u1EF1 \u0111\u1ED9ng
|
|
4163
|
+
function pickFiles(accept, multiple) {
|
|
4164
|
+
return new Promise((resolve) => {
|
|
4165
|
+
const input = h('input', { type: 'file', accept, multiple: multiple || null, style: { display: 'none' }, 'data-testid': 'import-file' });
|
|
4166
|
+
input.addEventListener('change', async () => {
|
|
4167
|
+
const files = await Promise.all(Array.from(input.files || []).map(async (f) => ({ name: f.name, content: await f.text() })));
|
|
4168
|
+
input.remove(); resolve(files);
|
|
4169
|
+
});
|
|
4170
|
+
document.body.appendChild(input); input.click();
|
|
4171
|
+
});
|
|
4172
|
+
}
|
|
4173
|
+
function importMenu(anchor) {
|
|
4174
|
+
P.menu(anchor || document.querySelector('[data-testid="import"]'), [
|
|
4175
|
+
{ label: T('K\u1ECBch b\u1EA3n .feature (pan-test)\u2026'), icon: 'file-text', testid: 'import-feature', run: () => void importFeatures() },
|
|
4176
|
+
{ label: T('K\u1EBFt qu\u1EA3 ch\u1EA1y t\u1EF1 \u0111\u1ED9ng (results.json)\u2026'), icon: 'check', testid: 'import-results', run: () => void importResults() },
|
|
4177
|
+
], { placement: 'bottom-end', testid: 'import-menu' });
|
|
4178
|
+
}
|
|
4179
|
+
async function importFeatures() {
|
|
4180
|
+
if (!ST.mod) { newModuleDialog(); return; }
|
|
4181
|
+
const files = await pickFiles('.feature', true);
|
|
4182
|
+
if (!files.length) return;
|
|
4183
|
+
const r = await write('api/import/feature', { module: ST.mod, files });
|
|
4184
|
+
if (!r) return;
|
|
4185
|
+
await reload();
|
|
4186
|
+
const add = r.reports.reduce((n, x) => n + x.added.length, 0); const upd = r.reports.reduce((n, x) => n + x.updated.length, 0);
|
|
4187
|
+
const miss = r.reports.reduce((n, x) => n + x.missing.length, 0);
|
|
4188
|
+
P.toast(T('\u0110\xE3 nh\u1EADp {f} t\u1EC7p: th\xEAm {a}, c\u1EADp nh\u1EADt {u} t\xECnh hu\u1ED1ng.', { f: r.reports.length, a: add, u: upd }) + (miss ? ' ' + T('{m} t\xECnh hu\u1ED1ng kh\xF4ng c\xF2n trong t\u1EC7p \u2014 gi\u1EEF nguy\xEAn, xem l\u1EA1i.', { m: miss }) : ''), { kind: 'success' });
|
|
4189
|
+
}
|
|
4190
|
+
async function importResults() {
|
|
4191
|
+
const files = await pickFiles('.json,application/json', false);
|
|
4192
|
+
if (!files.length) return;
|
|
4193
|
+
const r = await write('api/results', { content: files[0].content });
|
|
4194
|
+
if (!r) return;
|
|
4195
|
+
await reload();
|
|
4196
|
+
const n = (st) => r.applied.filter((x) => x.status === st).length;
|
|
4197
|
+
P.toast(T('Ghi k\u1EBFt qu\u1EA3 {t} t\xECnh hu\u1ED1ng: \u0111\u1EA1t {p}, kh\xF4ng \u0111\u1EA1t {f}.', { t: r.applied.length, p: n('passed'), f: n('failed') }) + (r.unknownTags.length ? ' ' + T('{n} tag ch\u01B0a c\xF3 trong t\xE0i li\u1EC7u.', { n: r.unknownTags.length }) : ''), { kind: r.applied.length ? 'success' : 'warn' });
|
|
4198
|
+
}
|
|
4199
|
+
|
|
4019
4200
|
// ---------------------------------------------------------------- Xem nh\u01B0 Word + Xu\u1EA5t
|
|
4020
4201
|
let readResults = false;
|
|
4021
4202
|
function renderRead(el) {
|
|
4022
4203
|
const src = () => 'view/doc' + (readResults ? '?results=1' : '');
|
|
4023
4204
|
const frame = h('iframe', { class: 'ptx-word', src: src(), title: T('Xem nh\u01B0 Word'), 'data-testid': 'word-frame' });
|
|
4024
|
-
const toggle = h('label', { class: 'ptx-check' }, h('input', { type: 'checkbox', 'data-testid': 'word-
|
|
4205
|
+
const toggle = h('label', { class: 'ptx-check' }, h('input', { type: 'checkbox', 'data-testid': 'word-results', checked: readResults || null }), ' ' + T('K\xE8m k\u1EBFt qu\u1EA3 test'));
|
|
4025
4206
|
toggle.querySelector('input').addEventListener('change', (e) => { readResults = e.target.checked; frame.src = src(); });
|
|
4026
4207
|
const full = h('a', { class: 'pb-btn pb-btn--secondary', href: src(), target: '_blank', rel: 'noopener', 'data-testid': 'word-open' }, P.iconEl('external-link', { size: 16 }), ' ' + T('M\u1EDF to\xE0n trang'));
|
|
4027
4208
|
el.append(h('div', { class: 'pbx-bar' }, toggle, full), frame);
|
|
@@ -4029,28 +4210,28 @@ function renderRead(el) {
|
|
|
4029
4210
|
|
|
4030
4211
|
function exportDialog() {
|
|
4031
4212
|
const cb = (testid, label, on) => { const i = h('input', { type: 'checkbox', 'data-testid': testid, checked: on || null }); return { i, el: h('label', { class: 'ptx-check' }, i, ' ' + label) }; };
|
|
4032
|
-
const docx = cb('
|
|
4213
|
+
const docx = cb('export-docx', 'Word (.docx)', true); const html = cb('export-html', 'HTML', false);
|
|
4033
4214
|
const kind = h('div', { class: 'pb-stack', role: 'radiogroup' },
|
|
4034
|
-
h('label', { class: 'ptx-check' }, h('input', { type: 'radio', name: '
|
|
4035
|
-
h('label', { class: 'ptx-check' }, h('input', { type: 'radio', name: '
|
|
4036
|
-
const codes = cb('
|
|
4037
|
-
const status = h('div', { 'data-testid': '
|
|
4215
|
+
h('label', { class: 'ptx-check' }, h('input', { type: 'radio', name: 'export-kind', value: 'handover', checked: true, 'data-testid': 'export-handover' }), ' ' + T('B\u1EA3n b\xE0n giao \u2014 \u0111\xFAng m\u1EABu: T\xECnh hu\u1ED1ng | C\xE1c b\u01B0\u1EDBc | K\u1EBFt qu\u1EA3 mong \u0111\u1EE3i')),
|
|
4216
|
+
h('label', { class: 'ptx-check' }, h('input', { type: 'radio', name: 'export-kind', value: 'results', 'data-testid': 'export-results' }), ' ' + T('K\xE8m k\u1EBFt qu\u1EA3 test \u2014 th\xEAm c\u1ED9t K\u1EBFt qu\u1EA3, Ng\u01B0\u1EDDi test / ng\xE0y v\xE0 ph\u1EE5 l\u1EE5c t\u1ED5ng h\u1EE3p')));
|
|
4217
|
+
const codes = cb('export-codes', T('Hi\u1EC7n m\xE3 t\xECnh hu\u1ED1ng (TC-\u2026)'), false);
|
|
4218
|
+
const status = h('div', { 'data-testid': 'export-status', 'aria-live': 'polite' });
|
|
4038
4219
|
P.dialog({
|
|
4039
|
-
title: T('Xu\u1EA5t t\xE0i li\u1EC7u ki\u1EC3m th\u1EED'), size: 'md', testid: '
|
|
4220
|
+
title: T('Xu\u1EA5t t\xE0i li\u1EC7u ki\u1EC3m th\u1EED'), size: 'md', testid: 'export-dialog',
|
|
4040
4221
|
body: h('div', { class: 'pb-stack' }, h('div', { class: 'pb-label' }, T('Ki\u1EC3u t\xE0i li\u1EC7u')), kind,
|
|
4041
4222
|
h('div', { class: 'pb-label' }, T('\u0110\u1ECBnh d\u1EA1ng')), h('div', { class: 'pbx-bar', style: { justifyContent: 'flex-start' } }, docx.el, html.el), codes.el, status),
|
|
4042
4223
|
actions: [
|
|
4043
4224
|
{ label: T('\u0110\xF3ng'), kind: 'ghost' },
|
|
4044
|
-
{ label: T('Xu\u1EA5t'), kind: 'primary', testid: '
|
|
4225
|
+
{ label: T('Xu\u1EA5t'), kind: 'primary', testid: 'export-ok', onClick: () => {
|
|
4045
4226
|
const formats = [docx.i.checked && 'docx', html.i.checked && 'html'].filter(Boolean);
|
|
4046
4227
|
if (!formats.length) { status.textContent = T('Ch\u1ECDn \xEDt nh\u1EA5t m\u1ED9t \u0111\u1ECBnh d\u1EA1ng.'); return false; }
|
|
4047
|
-
const results = kind.querySelector('input:checked').value === '
|
|
4228
|
+
const results = kind.querySelector('input:checked').value === 'results';
|
|
4048
4229
|
status.replaceChildren(h('p', { class: 'pb-muted' }, T('\u0110ang xu\u1EA5t\u2026')));
|
|
4049
4230
|
void write('api/export', { formats, results, codes: codes.i.checked }).then((r) => {
|
|
4050
4231
|
if (!r) { status.textContent = ''; return; }
|
|
4051
|
-
const open = h('button', { type: 'button', class: 'pb-btn pb-btn--secondary', 'data-testid': '
|
|
4232
|
+
const open = h('button', { type: 'button', class: 'pb-btn pb-btn--secondary', 'data-testid': 'export-open-folder' }, P.iconEl('folder', { size: 16 }), ' ' + T('M\u1EDF th\u01B0 m\u1EE5c'));
|
|
4052
4233
|
open.addEventListener('click', () => void write('api/open', {}));
|
|
4053
|
-
status.replaceChildren(h('p', null, T('\u0110\xE3 xu\u1EA5t:')), h('ul', { 'data-testid': '
|
|
4234
|
+
status.replaceChildren(h('p', null, T('\u0110\xE3 xu\u1EA5t:')), h('ul', { 'data-testid': 'export-files' }, r.files.map((f) => h('li', { class: 'pb-small' }, f))), open);
|
|
4054
4235
|
});
|
|
4055
4236
|
return false;
|
|
4056
4237
|
} },
|
|
@@ -4072,14 +4253,14 @@ function renderSummary(el) {
|
|
|
4072
4253
|
const all = countOf(D.suites.filter((s) => s.status !== 'deleted').flatMap(liveCases));
|
|
4073
4254
|
const pct = (c) => (c.total ? Math.round(100 * (c.passed) / c.total) : 0) + '%';
|
|
4074
4255
|
el.appendChild(h('h2', { class: 'pbx-ch' }, T('T\u1ED5ng h\u1EE3p k\u1EBFt qu\u1EA3 ki\u1EC3m th\u1EED')));
|
|
4075
|
-
el.appendChild(h('div', { class: 'ptx-kpis', 'data-testid': '
|
|
4256
|
+
el.appendChild(h('div', { class: 'ptx-kpis', 'data-testid': 'summary-kpi' },
|
|
4076
4257
|
[['total', T('T\xECnh hu\u1ED1ng')], ['passed', T('\u0110\u1EA1t')], ['failed', T('Kh\xF4ng \u0111\u1EA1t')], ['blocked', T('B\u1ECB ch\u1EB7n')], ['not-run', T('Ch\u01B0a test')]].map(([k, label]) =>
|
|
4077
4258
|
h('div', { class: 'pb-card ptx-kpi', 'data-testid': 'kpi-' + k }, h('div', { class: 'ptx-kpi__n' }, String(all[k])), h('div', { class: 'pb-small pb-muted' }, label)))));
|
|
4078
|
-
if (D.summary.coverage) el.appendChild(h('p', { 'data-testid': '
|
|
4079
|
-
el.appendChild(h('div', { class: 'pb-grid-wrap' }, h('table', { class: 'pb-grid ptx-sum', 'data-testid': '
|
|
4259
|
+
if (D.summary.coverage) el.appendChild(h('p', { 'data-testid': 'coverage' }, T('\u0110\u1ED9 ph\u1EE7 ch\u1EE9c n\u0103ng t\xE0i li\u1EC7u BA: {c}/{f} ch\u1EE9c n\u0103ng c\xF3 k\u1ECBch b\u1EA3n.', { c: D.summary.coverage.covered, f: D.summary.coverage.functions })));
|
|
4260
|
+
el.appendChild(h('div', { class: 'pb-grid-wrap' }, h('table', { class: 'pb-grid ptx-sum', 'data-testid': 'summary-table' },
|
|
4080
4261
|
h('thead', null, h('tr', null, [T('Ph\xE2n h\u1EC7'), T('K\u1ECBch b\u1EA3n'), T('T\xECnh hu\u1ED1ng'), T('\u0110\u1EA1t'), T('Kh\xF4ng \u0111\u1EA1t'), T('B\u1ECB ch\u1EB7n'), T('B\u1ECF qua'), T('Ch\u01B0a test'), T('T\u1EF7 l\u1EC7 \u0111\u1EA1t')].map((x) => h('th', null, x)))),
|
|
4081
|
-
h('tbody', null, rows.map(({ m, suites, c }) => h('tr', { 'data-testid': '
|
|
4082
|
-
h('td', null, h('a', { href: '#', onclick: (e) => { e.preventDefault(); ST.mod = m.code; P.module(m.code); lensTabs.select('
|
|
4262
|
+
h('tbody', null, rows.map(({ m, suites, c }) => h('tr', { 'data-testid': 'summary-row-' + m.code },
|
|
4263
|
+
h('td', null, h('a', { href: '#', onclick: (e) => { e.preventDefault(); ST.mod = m.code; P.module(m.code); lensTabs.select('document'); } }, modIndex(m.code) + '. ' + m.title)),
|
|
4083
4264
|
h('td', null, String(suites)), h('td', null, String(c.total)), h('td', null, String(c.passed)), h('td', null, String(c.failed)), h('td', null, String(c.blocked)), h('td', null, String(c.skipped)), h('td', null, String(c['not-run'])),
|
|
4084
4265
|
h('td', { class: 'ptx-rate' }, pct(c), bar(c))))),
|
|
4085
4266
|
h('tfoot', null, h('tr', null, h('th', null, T('T\u1ED5ng')), h('th', null, String(D.suites.filter((s) => s.status !== 'deleted').length)), h('th', null, String(all.total)), h('th', null, String(all.passed)), h('th', null, String(all.failed)), h('th', null, String(all.blocked)), h('th', null, String(all.skipped)), h('th', null, String(all['not-run'])), h('th', { class: 'ptx-rate' }, pct(all), bar(all)))))));
|
|
@@ -4091,10 +4272,10 @@ async function renderCheck(el) {
|
|
|
4091
4272
|
const r = await api('api/check');
|
|
4092
4273
|
if (!r.ok) { el.appendChild(h('p', { class: 'pb-muted' }, r.json.error || T('Kh\xF4ng ki\u1EC3m \u0111\u01B0\u1EE3c'))); return; }
|
|
4093
4274
|
const list = r.json.findings || [];
|
|
4094
|
-
if (!D.ba.linked) el.appendChild(h('p', { class: 'pb-small pb-muted', 'data-testid': '
|
|
4095
|
-
if (!list.length) { el.appendChild(h('div', { class: 'pb-empty', 'data-testid': '
|
|
4275
|
+
if (!D.ba.linked) el.appendChild(h('p', { class: 'pb-small pb-muted', 'data-testid': 'ba-not-linked' }, D.ba.path ? T('Kh\xF4ng th\u1EA5y repo BA \xAB{p}\xBB \u2014 b\u1ECF qua ki\u1EC3m tham chi\u1EBFu v\xE0 \u0111\u1ED9 ph\u1EE7.', { p: D.ba.path }) : T('Ch\u01B0a li\xEAn k\u1EBFt repo t\xE0i li\u1EC7u BA (kho\xE1 \xABba\xBB trong .pantest.yaml) \u2014 ch\u01B0a ki\u1EC3m \u0111\u01B0\u1EE3c \u0111\u1ED9 ph\u1EE7 ch\u1EE9c n\u0103ng.')));
|
|
4276
|
+
if (!list.length) { el.appendChild(h('div', { class: 'pb-empty', 'data-testid': 'check-clean' }, h('div', { class: 'pb-empty__title' }, T('Kh\xF4ng c\xF3 l\u1ED7i hay c\u1EA3nh b\xE1o.')))); return; }
|
|
4096
4277
|
const tone = { error: 'error', warn: 'warn', info: 'info' };
|
|
4097
|
-
el.appendChild(h('ul', { class: 'ptx-findings', 'data-testid': '
|
|
4278
|
+
el.appendChild(h('ul', { class: 'ptx-findings', 'data-testid': 'check-list' }, list.map((f) => {
|
|
4098
4279
|
const go = f.code && (suiteBy(f.code) || D.suites.some((s) => s.cases.some((c) => c.code === f.code)));
|
|
4099
4280
|
return h('li', { 'data-rule': f.rule }, h('span', { class: 'pb-badge', 'data-tone': tone[f.severity] }, f.rule), ' ',
|
|
4100
4281
|
go ? h('a', { href: '#' + f.code }, f.message) : f.message);
|
|
@@ -4114,171 +4295,1002 @@ async function copyText(text, done) {
|
|
|
4114
4295
|
boot().catch((e) => {
|
|
4115
4296
|
document.body.replaceChildren(h('div', { class: 'pb-empty', style: { padding: '40px' } }, h('div', { class: 'pb-empty__title' }, T('Kh\xF4ng m\u1EDF \u0111\u01B0\u1EE3c t\xE0i li\u1EC7u ki\u1EC3m th\u1EED')), h('p', null, String(e.message || e))));
|
|
4116
4297
|
});
|
|
4117
|
-
|
|
4118
|
-
|
|
4119
|
-
|
|
4298
|
+
`,"assist.js":`// CH\xC9P NGUY\xCAN t\u1EEB Pan BA UI (@pan-stack/cli: tools/pan-ba/ui/assist.browser.js) \u0111\u1EC3 Tr\u1EE3 l\xFD AI c\u1EE7a Pan Test c\xF9ng UX v\u1EDBi Pan BA.
|
|
4299
|
+
// S\u1EEDa \u1EDF Pan BA r\u1ED3i ch\xE9p l\u1EA1i; \u0111\u1EEBng s\u1EEDa ri\xEAng \u1EDF \u0111\xE2y.
|
|
4300
|
+
// Pan BA UI \u2014 Tr\u1EE3 l\xFD AI + B\xECnh lu\u1EADn (07/11/2026). D\xF9ng chung cho \`pan ba ui\`, Pan Studio Desktop v\xE0 VS Code (c\xF9ng server).
|
|
4301
|
+
// \u2022 Tr\u1EE3 l\xFD AI: giao vi\u1EC7c BA cho CLI AI c\xF3 s\u1EB5n tr\xEAn m\xE1y (Claude Code / Codex / Cursor \u2014 t\xE0i kho\u1EA3n ng\u01B0\u1EDDi d\xF9ng, kh\xF4ng API key).
|
|
4302
|
+
// Vi\u1EC7c theo lu\u1ED3ng c\u1EE7a Pan BA (vi\u1EBFt \u0111\u1EB7c t\u1EA3, r\xE0 so\xE1t, s\u1EEDa l\u1ED7i ki\u1EC3m tra, m\u1EE5c ch\u1EDD, g\xF3p \xFD, b\xECnh lu\u1EADn, m\xE0n c\xF2n thi\u1EBFu) ho\u1EB7c nh\u1EAFn t\u1EF1
|
|
4303
|
+
// do; xem AI l\xE0m t\u1EEBng b\u01B0\u1EDBc; xong th\xEC xem thay \u0111\u1ED5i / Ho\xE0n t\xE1c / Gi\u1EEF. Nh\u1EAFn ti\u1EBFp l\xE0 c\xF9ng phi\xEAn (AI nh\u1EDB).
|
|
4304
|
+
// \u2022 B\xECnh lu\u1EADn: nh\u01B0 comment c\u1EE7a Word \u2014 ch\u1ECDn ch\u1EEF trong \xABXem nh\u01B0 Word\xBB \u2192 B\xECnh lu\u1EADn; tr\u1EA3 l\u1EDDi, \u0111\xF3ng lu\u1ED3ng; l\u01B0u trong repo;
|
|
4305
|
+
// \u0111\u1ED3ng b\u1ED9 v\u1EDBi ng\u01B0\u1EDDi xem tr\xEAn Pan Studio.
|
|
4306
|
+
import { api } from './edit.js';
|
|
4307
|
+
|
|
4308
|
+
const T = (s, o) => window.PanBAi18n.T(s, o);
|
|
4309
|
+
let C = null; // { P, h, D(), M(), ST, PRODUCT, reload(), select(code), rightTabs, panel }
|
|
4310
|
+
export function initAssist(ctx) { C = ctx; }
|
|
4311
|
+
|
|
4312
|
+
const anchorOf = (code) => 'R_' + String(code).replace(/[^A-Za-z0-9]/g, '_');
|
|
4313
|
+
function store(key, v) { try { if (v === undefined) return JSON.parse(localStorage.getItem(key) || 'null'); localStorage.setItem(key, JSON.stringify(v)); } catch { /* ch\u1EB7n localStorage */ } return null; }
|
|
4314
|
+
function btn(label, o) {
|
|
4315
|
+
const h = C.h; o = o || {};
|
|
4316
|
+
const b = h('button', { type: 'button', class: 'pb-btn pb-btn--' + (o.kind || 'secondary') + (o.icon && !label ? ' pb-btn--icon' : '') + (o.small ? ' pbx-btn-sm' : ''), title: o.title || null, 'aria-label': o.title || null, 'data-testid': o.testid || null, disabled: o.disabled || null },
|
|
4317
|
+
o.icon ? h('span', { html: C.P.icon(o.icon, { size: 16 }) }) : null, label || null);
|
|
4318
|
+
if (o.onClick) b.addEventListener('click', (e) => { e.stopPropagation(); o.onClick(e, b); });
|
|
4319
|
+
return b;
|
|
4320
|
+
}
|
|
4321
|
+
function failToast(r) { C.P.toast(r.json.error || T('Kh\xF4ng l\u01B0u \u0111\u01B0\u1EE3c ({s}).', { s: r.status }), { kind: 'error' }); }
|
|
4322
|
+
function openTab(id) {
|
|
4323
|
+
C.rightTabs.select(id);
|
|
4324
|
+
try { C.panel.toggle('right', true); } catch { /* khung kh\xF4ng c\xF3 panel ph\u1EA3i */ }
|
|
4325
|
+
}
|
|
4326
|
+
|
|
4327
|
+
// ================================================================ TR\u1EE2 L\xDD AI
|
|
4328
|
+
// Nhi\u1EC1u CU\u1ED8C tr\xF2 chuy\u1EC7n ch\u1EA1y SONG SONG (18/11/2026, c\xF9ng c\xE1ch v\u1EDBi Pan Studio Desktop): m\u1ED7i cu\u1ED9c m\u1ED9t tab, m\u1ED9t phi\xEAn CLI
|
|
4329
|
+
// (nh\u1EAFn ti\u1EBFp = resume), m\u1ED9t lu\u1ED3ng SSE; cu\u1ED9c \u0111ang ch\u1EA1y v\u1EABn ch\u1EA1y khi xem cu\u1ED9c kh\xE1c, xong th\xEC b\xE1o. G\u1EEDi khi cu\u1ED9c \u0111ang xem c\xF2n
|
|
4330
|
+
// ch\u1EA1y \u21D2 t\u1EF1 m\u1EDF cu\u1ED9c m\u1EDBi. Agent con (Claude tool Agent / Cursor task) hi\u1EC7n th\xE0nh th\u1EBB trong b\u1EA3n ghi; b\u1EA5m xem vi\u1EC7c \u0111\u01B0\u1EE3c giao,
|
|
4331
|
+
// c\xE1c b\u01B0\u1EDBc, k\u1EBFt qu\u1EA3. T\u1EA3i l\u1EA1i trang \u21D2 d\u1EF1ng l\u1EA1i tab cho c\xE1c l\u01B0\u1EE3t c\xF2n ch\u1EA1y (server gi\u1EEF l\u01B0\u1EE3t).
|
|
4332
|
+
const S = { engines: [], engine: '', model: '', effort: '', max: 4 };
|
|
4333
|
+
let el = null; // c\xE1c ph\u1EA7n t\u1EED c\u1EE7a panel
|
|
4334
|
+
let CONVS = [];
|
|
4335
|
+
let active = null;
|
|
4336
|
+
let seq = 0;
|
|
4337
|
+
const TOOL = { Read: '\u0110\u1ECDc', Edit: 'S\u1EEDa', MultiEdit: 'S\u1EEDa', Write: 'Ghi', Bash: 'Ch\u1EA1y', PowerShell: 'Ch\u1EA1y', Glob: 'T\xECm t\u1EC7p', Grep: 'T\xECm ch\u1EEF', TodoWrite: 'L\u1EADp vi\u1EC7c', edit: 'S\u1EEDa', read: '\u0110\u1ECDc', write: 'Ghi', shell: 'Ch\u1EA1y', glob: 'T\xECm t\u1EC7p', grep: 'T\xECm ch\u1EEF', ls: 'Xem th\u01B0 m\u1EE5c' };
|
|
4338
|
+
/** Bi\u1EC3u t\u01B0\u1EE3ng theo lo\u1EA1i c\xF4ng c\u1EE5 (Claude vi\u1EBFt hoa, Codex/Cursor vi\u1EBFt th\u01B0\u1EDDng). */
|
|
4339
|
+
function toolIcon(name) {
|
|
4340
|
+
const n = String(name || '').toLowerCase();
|
|
4341
|
+
return n === 'bash' || n === 'shell' || n === 'powershell' ? 'terminal' : n === 'read' || n === 'ls' ? 'eye' : n === 'glob' || n === 'grep' ? 'search' : 'edit';
|
|
4342
|
+
}
|
|
4343
|
+
const shortText = (s, n) => { const t = String(s || '').replace(/\\s+/g, ' ').trim(); return t.length > n ? t.slice(0, n - 1) + '\u2026' : t; };
|
|
4344
|
+
|
|
4345
|
+
function taskLabel(task, x) {
|
|
4346
|
+
const code = x.item || (C.ST.sel || '');
|
|
4347
|
+
if (task === 'viet-dac-ta') return T('Vi\u1EBFt \u0111\u1EB7c t\u1EA3 {c}', { c: code });
|
|
4348
|
+
if (task === 'ra-soat') return T('R\xE0 so\xE1t {c}', { c: code });
|
|
4349
|
+
if (task === 'sua-loi') return x.item ? T('S\u1EEDa l\u1ED7i ki\u1EC3m tra c\u1EE7a {c}', { c: x.item }) : T('S\u1EEDa l\u1ED7i ki\u1EC3m tra c\u1EE7a c\u1EA3 d\u1EF1 \xE1n con');
|
|
4350
|
+
if (task === 'muc-cho') return T('G\u1EE3i \xFD tr\u1EA3 l\u1EDDi m\u1EE5c ch\u1EDD {c}', { c: x.tbd });
|
|
4351
|
+
if (task === 'gop-y') return T('\u0110\xE1nh gi\xE1 g\xF3p \xFD {c}', { c: (x.feedback || {}).id });
|
|
4352
|
+
if (task === 'binh-luan') return T('X\u1EED l\xFD b\xECnh lu\u1EADn tr\xEAn {c}', { c: (x.comment || {}).item });
|
|
4353
|
+
if (task === 'man-con-thieu') return T('T\xECm m\xE0n c\xF2n thi\u1EBFu c\u1EE7a ph\xE2n h\u1EC7 {c}', { c: x.module || C.ST.mod });
|
|
4354
|
+
return x.text || '';
|
|
4355
|
+
}
|
|
4356
|
+
|
|
4357
|
+
/** Panel \u0111ang d\xF2 CLI AI (l\u1EA7n \u0111\u1EA7u v\xE0i gi\xE2y) \u2014 \xABNh\u1EDD AI\xBB b\u1EA5m s\u1EDBm th\xEC \u0111\u1EE3i ch\u1EE9 kh\xF4ng b\xE1o nh\u1EA7m \xABch\u01B0a c\xF3 CLI AI\xBB. */
|
|
4358
|
+
let aiReady = Promise.resolve();
|
|
4359
|
+
export function mountAi(panel) { aiReady = initAi(panel); return aiReady; }
|
|
4360
|
+
async function initAi(panel) {
|
|
4361
|
+
const h = C.h;
|
|
4362
|
+
el = {
|
|
4363
|
+
pick: h('div', { class: 'pbx-ai-pick' }), ctx: h('div', { class: 'pbx-ai-ctx', 'data-testid': 'ai-ctx' }), quick: h('div', { class: 'pbx-ai-quick' }),
|
|
4364
|
+
tabs: h('div', { class: 'pbx-ai-tabs', role: 'tablist', 'aria-label': T('C\xE1c cu\u1ED9c tr\xF2 chuy\u1EC7n AI'), 'data-testid': 'ai-tabs' }),
|
|
4365
|
+
logBox: h('div', { class: 'pbx-ai-logbox' }),
|
|
4366
|
+
input: h('textarea', { class: 'pb-textarea pbx-ai-input', rows: '3', 'data-testid': 'ai-input', placeholder: T('Nh\u1EAFn AI\u2026 (Ctrl+Enter \u0111\u1EC3 g\u1EEDi)') }),
|
|
4367
|
+
};
|
|
4368
|
+
el.send = btn(T('G\u1EEDi'), { kind: 'primary', icon: 'sparkles', testid: 'ai-send', onClick: () => sendFree() });
|
|
4369
|
+
el.stop = btn(T('D\u1EEBng'), { kind: 'danger', icon: 'x', testid: 'ai-stop', onClick: () => stop() });
|
|
4370
|
+
el.stop.hidden = true;
|
|
4371
|
+
el.fresh = btn(T('Cu\u1ED9c m\u1EDBi'), { kind: 'ghost', icon: 'plus', testid: 'ai-new', title: T('M\u1EDF cu\u1ED9c tr\xF2 chuy\u1EC7n m\u1EDBi \u2014 c\xE1c cu\u1ED9c \u0111ang ch\u1EA1y v\u1EABn ch\u1EA1y song song'), onClick: () => { const c = active && !active.run && !active.used ? active : newConv(); show(c); el.input.focus(); } });
|
|
4372
|
+
el.input.addEventListener('keydown', (e) => { if (e.key === 'Enter' && (e.ctrlKey || e.metaKey)) { e.preventDefault(); sendFree(); } });
|
|
4373
|
+
el.pick.appendChild(h('span', { class: 'pb-small pb-muted', 'data-testid': 'ai-detecting' }, T('\u0110ang t\xECm Claude Code / Codex / Cursor tr\xEAn m\xE1y\u2026')));
|
|
4374
|
+
panel.replaceChildren(h('div', { class: 'pbx-ai', 'data-testid': 'ai-panel' }, el.pick, el.ctx, el.quick, el.tabs, el.logBox,
|
|
4375
|
+
h('div', { class: 'pbx-ai-compose' }, el.input, h('div', { class: 'pb-row' }, el.fresh, h('span', { class: 'pbx-grow' }), el.stop, el.send))));
|
|
4376
|
+
const r = await api('api/ai');
|
|
4377
|
+
S.engines = r.json.engines || [];
|
|
4378
|
+
S.max = r.json.max || 4;
|
|
4379
|
+
const saved = store('panba.ai') || {};
|
|
4380
|
+
const eng = S.engines.find((e) => e.id === saved.engine) || S.engines[0];
|
|
4381
|
+
if (!eng) {
|
|
4382
|
+
el.pick.replaceChildren(h('div', { class: 'pb-empty', 'data-testid': 'ai-none' }, h('div', { class: 'pb-empty__title' }, T('M\xE1y ch\u01B0a c\xF3 CLI AI')),
|
|
4383
|
+
h('p', { class: 'pb-empty__text' }, T('C\xE0i v\xE0 \u0111\u0103ng nh\u1EADp m\u1ED9t trong: Claude Code (claude), Codex (codex), Cursor (cursor-agent). Kh\xF4ng c\u1EA7n API key \u2014 d\xF9ng t\xE0i kho\u1EA3n c\u1EE7a b\u1EA1n.')),
|
|
4384
|
+
h('p', { class: 'pb-empty__text' }, T('\u0110\xE3 c\xE0i m\xE0 v\u1EABn kh\xF4ng th\u1EA5y? Ch\xE9p nh\u1EADt k\xFD g\u1EEDi \u0111\u1ED9i ph\xE1t tri\u1EC3n:')), logButton()));
|
|
4385
|
+
el.send.disabled = true; el.input.disabled = true;
|
|
4386
|
+
return;
|
|
4387
|
+
}
|
|
4388
|
+
S.engine = eng.id;
|
|
4389
|
+
const m = eng.models.find((x) => x.id === saved.model);
|
|
4390
|
+
S.model = m ? m.id : eng.model;
|
|
4391
|
+
S.effort = saved.effort && effortsOf().includes(saved.effort) ? saved.effort : (effortsOf().includes(eng.effort) ? eng.effort : (effortsOf()[0] || ''));
|
|
4392
|
+
renderPick(); renderCtx();
|
|
4393
|
+
// D\u1EF1ng l\u1EA1i c\xE1c cu\u1ED9c (l\u1ECBch s\u1EED l\u01B0u tr\xEAn m\xE1y + l\u01B0\u1EE3t c\xF2n ch\u1EA1y): m\u1ED7i cu\u1ED9c m\u1ED9t tab, c\xE1c l\u01B0\u1EE3t theo th\u1EE9 t\u1EF1; l\u01B0\u1EE3t c\xF2n ch\u1EA1y th\xEC nghe
|
|
4394
|
+
// ti\u1EBFp. Nh\u1EAFn ti\u1EBFp v\xE0o cu\u1ED9c c\u0169 \u21D2 c\xF9ng m\xE3 cu\u1ED9c (c\xF9ng th\u01B0 m\u1EE5c l\u1ECBch s\u1EED) v\xE0 n\u1ED1i ti\u1EBFp phi\xEAn AI c\u0169.
|
|
4395
|
+
const groups = new Map();
|
|
4396
|
+
for (const x of (r.json.runs || []).slice().reverse()) { const k = x.conv || x.id; if (!groups.has(k)) groups.set(k, []); groups.get(k).push(x); }
|
|
4397
|
+
for (const [k, list] of groups) {
|
|
4398
|
+
const c = newConv(shortText(list[0].label, 40));
|
|
4399
|
+
c.id = k; c.used = true;
|
|
4400
|
+
for (const x of list) {
|
|
4401
|
+
bubble(c, 'user', x.say || x.label);
|
|
4402
|
+
Object.assign(c, { run: x.id, task: x.task, extra: {}, count: 0, cur: null, engine: x.engine, session: x.session || c.session, sessionEngine: x.engine });
|
|
4403
|
+
if (x.status === 'running') { c.status = 'running'; listen(c, x.id, 0); continue; }
|
|
4404
|
+
for (const e of x.events || []) { onEvent(c, e); c.count++; }
|
|
4405
|
+
finish(c, x.end || { t: 'end', status: x.status, files: [] }, { quiet: true });
|
|
4406
|
+
}
|
|
4407
|
+
}
|
|
4408
|
+
show(CONVS[CONVS.length - 1] || newConv());
|
|
4409
|
+
}
|
|
4410
|
+
const engineOf = () => S.engines.find((e) => e.id === S.engine) || {};
|
|
4411
|
+
function effortsOf() { const e = engineOf(); const m = (e.models || []).find((x) => x.id === S.model); return (m && m.efforts && m.efforts.length ? m.efforts : e.efforts) || []; }
|
|
4412
|
+
function renderPick() {
|
|
4413
|
+
const h = C.h; const e = engineOf();
|
|
4414
|
+
const sel = (opts, value, testid, label, on) => {
|
|
4415
|
+
const s = h('select', { class: 'pb-select pbx-ai-sel', 'data-testid': testid, 'aria-label': label }, opts.map(([v, l]) => h('option', { value: v, selected: v === value || null }, l)));
|
|
4416
|
+
s.addEventListener('change', () => on(s.value)); return s;
|
|
4417
|
+
};
|
|
4418
|
+
const save = () => store('panba.ai', { engine: S.engine, model: S.model, effort: S.effort });
|
|
4419
|
+
const efforts = effortsOf();
|
|
4420
|
+
// C\xF4ng c\u1EE5 kh\xF4ng c\xF3 m\u1EE9c suy ngh\u0129 (Cursor) \u21D2 b\u1ECF h\u1EB3n \xF4 th\u1EE9 ba; replaceChildren(null) s\u1EBD in ch\u1EEF \xABnull\xBB.
|
|
4421
|
+
el.pick.replaceChildren(...[
|
|
4422
|
+
sel(S.engines.map((x) => [x.id, x.label]), S.engine, 'ai-engine', T('C\xF4ng c\u1EE5 AI'), (v) => { S.engine = v; const ne = engineOf(); S.model = ne.model; S.effort = ne.effort; save(); renderPick(); }),
|
|
4423
|
+
sel((e.models || []).map((x) => [x.id, x.label]).concat((e.models || []).some((x) => x.id === S.model) || !S.model ? [] : [[S.model, S.model]]), S.model, 'ai-model', T('Model'), (v) => { S.model = v; if (!effortsOf().includes(S.effort)) S.effort = effortsOf().includes('medium') ? 'medium' : (effortsOf()[0] || ''); save(); renderPick(); }),
|
|
4424
|
+
efforts.length ? sel(efforts.map((x) => [x, x]), S.effort, 'ai-effort', T('M\u1EE9c suy ngh\u0129'), (v) => { S.effort = v; save(); }) : null,
|
|
4425
|
+
].filter(Boolean));
|
|
4426
|
+
}
|
|
4427
|
+
/** Ng\u1EEF c\u1EA3nh + vi\u1EC7c nhanh theo m\u1EE5c / ph\xE2n h\u1EC7 \u0111ang ch\u1ECDn \u2014 g\u1ECDi l\u1EA1i m\u1ED7i khi ch\u1ECDn m\u1EE5c kh\xE1c. */
|
|
4428
|
+
export function renderCtx() {
|
|
4429
|
+
if (!el) return;
|
|
4430
|
+
// C\xF4ng c\u1EE5 kh\xE1c d\xF9ng l\u1EA1i khung n\xE0y (t\xE0i li\u1EC7u b\xE0n giao, Pan Test): ng\u1EEF c\u1EA3nh + vi\u1EC7c nhanh c\u1EE7a ri\xEAng n\xF3
|
|
4431
|
+
if (C.ctxView) { C.ctxView(el.ctx, el.quick, { btn, ask }); return; }
|
|
4432
|
+
const h = C.h; const M = C.M(); const code = C.ST.sel; const it = code ? M.item(code) : null;
|
|
4433
|
+
const mod = (C.D().modules || []).find((m) => m.ma === C.ST.mod);
|
|
4434
|
+
el.ctx.replaceChildren(h('span', { class: 'pb-small pb-muted' }, T('Ng\u1EEF c\u1EA3nh:')), ' ',
|
|
4435
|
+
it ? C.P.chip(code, { docId: C.ST.doc, size: 'sm' }) : h('span', { class: 'pb-small' }, mod ? T('ph\xE2n h\u1EC7 {m}', { m: mod.ma + ' \xB7 ' + mod.ten }) : '\u2014'));
|
|
4436
|
+
const q = [];
|
|
4437
|
+
if (it) {
|
|
4438
|
+
q.push(btn(it.trangThai === 'du-kien' || it.trangThai === 'dang-viet' ? T('Vi\u1EBFt \u0111\u1EB7c t\u1EA3') : T('Vi\u1EBFt ti\u1EBFp \u0111\u1EB7c t\u1EA3'), { kind: 'secondary', small: true, testid: 'ai-q-viet', onClick: () => ask('viet-dac-ta', { item: code }) }));
|
|
4439
|
+
q.push(btn(T('R\xE0 so\xE1t'), { kind: 'ghost', small: true, testid: 'ai-q-rasoat', onClick: () => ask('ra-soat', { item: code }) }));
|
|
4440
|
+
q.push(btn(T('S\u1EEDa l\u1ED7i ki\u1EC3m tra'), { kind: 'ghost', small: true, testid: 'ai-q-sualoi', onClick: () => ask('sua-loi', { item: code }) }));
|
|
4441
|
+
}
|
|
4442
|
+
if (mod) q.push(btn(T('M\xE0n c\xF2n thi\u1EBFu'), { kind: 'ghost', small: true, testid: 'ai-q-man', onClick: () => ask('man-con-thieu', { module: mod.ma, item: null }) }));
|
|
4443
|
+
el.quick.replaceChildren(...q);
|
|
4444
|
+
}
|
|
4445
|
+
|
|
4446
|
+
// ---------------------------------------------------------------- cu\u1ED9c tr\xF2 chuy\u1EC7n (tab)
|
|
4447
|
+
function newConv(title) {
|
|
4448
|
+
const h = C.h;
|
|
4449
|
+
seq += 1;
|
|
4450
|
+
// m\xE3 cu\u1ED9c NG\u1EAAU NHI\xCAN: l\u1ECBch s\u1EED l\u01B0u theo cu\u1ED9c, m\u1EDF l\u1EA1i app kh\xF4ng tr\xF9ng m\xE3 cu\u1ED9c c\u0169
|
|
4451
|
+
const conv = { id: 'c' + Date.now().toString(36) + Math.random().toString(36).slice(2, 6), title: title || T('Cu\u1ED9c {n}', { n: seq }), used: false, engine: '', session: null, sessionEngine: '', run: null, task: null, extra: null, count: 0, cur: null, es: null, status: 'idle', agents: new Map(),
|
|
4452
|
+
log: h('div', { class: 'pbx-ai-log', 'data-testid': 'ai-log', 'aria-live': 'polite' }) };
|
|
4453
|
+
CONVS.push(conv);
|
|
4454
|
+
return conv;
|
|
4455
|
+
}
|
|
4456
|
+
function show(conv) {
|
|
4457
|
+
active = conv;
|
|
4458
|
+
if (!conv.log.children.length) hint(conv);
|
|
4459
|
+
el.logBox.replaceChildren(conv.log);
|
|
4460
|
+
conv.log.scrollTop = conv.log.scrollHeight;
|
|
4461
|
+
renderTabs(); running(!!conv.run);
|
|
4462
|
+
}
|
|
4463
|
+
function closeConv(conv) {
|
|
4464
|
+
if (conv.run) return;
|
|
4465
|
+
if (conv.es) conv.es.close();
|
|
4466
|
+
CONVS = CONVS.filter((c) => c !== conv);
|
|
4467
|
+
if (active === conv) show(CONVS[CONVS.length - 1] || newConv());
|
|
4468
|
+
else renderTabs();
|
|
4469
|
+
}
|
|
4470
|
+
const statusDot = (status) => C.h('span', { class: 'pbx-ai-dot', 'data-status': status, 'aria-hidden': 'true' });
|
|
4471
|
+
function renderTabs() {
|
|
4472
|
+
const h = C.h;
|
|
4473
|
+
el.tabs.hidden = CONVS.length < 2;
|
|
4474
|
+
el.tabs.replaceChildren(...CONVS.map((c) => {
|
|
4475
|
+
const tab = h('button', { type: 'button', role: 'tab', class: 'pbx-ai-tab' + (c === active ? ' is-on' : ''), 'aria-selected': String(c === active), 'data-testid': 'ai-tab', 'data-status': c.status, title: c.title }, statusDot(c.status), h('span', { class: 'pbx-ai-tab__t' }, c.title));
|
|
4476
|
+
tab.addEventListener('click', () => show(c));
|
|
4477
|
+
if (c.run) return tab;
|
|
4478
|
+
const x = h('button', { type: 'button', class: 'pbx-ai-tab__x', 'aria-label': T('\u0110\xF3ng cu\u1ED9c n\xE0y'), title: T('\u0110\xF3ng cu\u1ED9c n\xE0y'), html: C.P.icon('x', { size: 12 }) });
|
|
4479
|
+
x.addEventListener('click', (e) => { e.stopPropagation(); closeConv(c); });
|
|
4480
|
+
return h('span', { class: 'pbx-ai-tabwrap' }, tab, x);
|
|
4481
|
+
}));
|
|
4482
|
+
}
|
|
4483
|
+
function hint(conv) {
|
|
4484
|
+
if (conv.log.children.length) return;
|
|
4485
|
+
conv.log.appendChild(C.h('p', { class: 'pb-small pb-muted', 'data-testid': 'ai-hint' }, C.aiHint || T('AI l\xE0m vi\u1EC7c ngay trong repo BA theo lu\u1EADt c\u1EE7a Pan BA: t\u1EF1 ki\u1EC3m tra b\u1EB1ng pan ba check, kh\xF4ng commit. Xong b\u1EA1n xem thay \u0111\u1ED5i r\u1ED3i Gi\u1EEF ho\u1EB7c Ho\xE0n t\xE1c.')));
|
|
4486
|
+
}
|
|
4487
|
+
function bubble(conv, kind, text) {
|
|
4488
|
+
const h = C.h;
|
|
4489
|
+
const b = h('div', { class: 'pbx-ai-msg pbx-ai-msg--' + kind, 'data-testid': 'ai-msg-' + kind }, text || '');
|
|
4490
|
+
if (kind === 'error') b.appendChild(h('div', { class: 'pb-row' }, logButton())); // l\u1ED7i \u21D2 ch\xE9p nh\u1EADt k\xFD g\u1EEDi \u0111\u1ED9i ph\xE1t tri\u1EC3n
|
|
4491
|
+
const hintEl = conv.log.querySelector('[data-testid="ai-hint"]'); if (hintEl) hintEl.remove();
|
|
4492
|
+
conv.log.appendChild(b); scrollDown(conv);
|
|
4493
|
+
return b;
|
|
4494
|
+
}
|
|
4495
|
+
/** \xABAI \u0111ang nh\u1EADn vi\u1EC7c\u2026\xBB (ba ch\u1EA5m) t\u1EEB l\xFAc b\u1EA5m G\u1EEDi t\u1EDBi s\u1EF1 ki\u1EC7n \u0111\u1EA7u ti\xEAn c\u1EE7a l\u01B0\u1EE3t. */
|
|
4496
|
+
function typing(conv, on) {
|
|
4497
|
+
const old = conv.log.querySelector('[data-testid="ai-typing"]');
|
|
4498
|
+
if (!on) { if (old) old.remove(); return; }
|
|
4499
|
+
if (old) return;
|
|
4500
|
+
conv.log.appendChild(C.h('div', { class: 'pbx-ai-typing', 'data-testid': 'ai-typing', role: 'status' }, C.h('span', { class: 'pbx-dots', 'aria-hidden': 'true' }, C.h('i'), C.h('i'), C.h('i')), T('AI \u0111ang nh\u1EADn vi\u1EC7c\u2026')));
|
|
4501
|
+
scrollDown(conv);
|
|
4502
|
+
}
|
|
4503
|
+
function scrollDown(conv) { if (conv === active) conv.log.scrollTop = conv.log.scrollHeight; }
|
|
4504
|
+
function running(on) {
|
|
4505
|
+
el.stop.hidden = !on;
|
|
4506
|
+
if (!on || !el.stop.disabled) return;
|
|
4507
|
+
el.stop.disabled = false; el.stop.replaceChildren(C.h('span', { html: C.P.icon('x', { size: 16 }) }), T('D\u1EEBng'));
|
|
4508
|
+
}
|
|
4509
|
+
|
|
4510
|
+
/** Giao vi\u1EC7c cho AI t\u1EEB b\u1EA5t k\u1EF3 \u0111\xE2u trong UI (th\u1EBB m\u1EE5c, Ki\u1EC3m tra, m\u1EE5c ch\u1EDD, g\xF3p \xFD, b\xECnh lu\u1EADn). */
|
|
4511
|
+
/** N\xFAt \xABCh\xE9p nh\u1EADt k\xFD\xBB: ph\u1EA7n cu\u1ED1i ~/.pan/logs/pan-ba-ai.log (l\u1EC7nh th\u1EADt \u0111\xE3 g\u1ECDi, m\xE3 tho\xE1t, stderr) \u2014 d\xE1n g\u1EEDi \u0111\u1ED9i ph\xE1t tri\u1EC3n. */
|
|
4512
|
+
function logButton() {
|
|
4513
|
+
return btn(T('Ch\xE9p nh\u1EADt k\xFD'), { kind: 'ghost', small: true, icon: 'copy', testid: 'ai-log-copy', onClick: async () => {
|
|
4514
|
+
const r = await api('api/ai/log');
|
|
4515
|
+
const text = r.ok && r.json ? \`# \${r.json.file}\\n\${r.json.text}\` : '';
|
|
4516
|
+
if (!text.trim()) { C.P.toast(T('Ch\u01B0a c\xF3 nh\u1EADt k\xFD.'), { kind: 'info' }); return; }
|
|
4517
|
+
try { await navigator.clipboard.writeText(text); C.P.toast(T('\u0110\xE3 ch\xE9p nh\u1EADt k\xFD ({p}) \u2014 d\xE1n g\u1EEDi \u0111\u1ED9i ph\xE1t tri\u1EC3n.', { p: r.json.file }), { kind: 'success' }); }
|
|
4518
|
+
catch { C.P.dialog({ title: T('Nh\u1EADt k\xFD Tr\u1EE3 l\xFD AI'), size: 'lg', body: C.h('textarea', { class: 'pb-input', rows: 16, readonly: 'readonly', 'data-testid': 'ai-log-text' }, text), actions: [{ label: T('\u0110\xF3ng'), kind: 'ghost' }] }); }
|
|
4519
|
+
} });
|
|
4520
|
+
}
|
|
4521
|
+
export function askAi(task, extra) { return ask(task, extra || {}); }
|
|
4522
|
+
async function ask(task, extra) {
|
|
4523
|
+
openTab('tro-ly');
|
|
4524
|
+
await aiReady.catch(() => {});
|
|
4525
|
+
if (!S.engine) { C.P.toast(T('M\xE1y ch\u01B0a c\xF3 CLI AI'), { kind: 'warn' }); return; }
|
|
4526
|
+
// Cu\u1ED9c \u0111ang xem c\xF2n ch\u1EA1y (ho\u1EB7c \u0111ang ch\u1EDD m\xE1y ch\u1EE7 nh\u1EADn l\u01B0\u1EE3t \u2014 b\u1EA5m G\u1EEDi hai l\u1EA7n li\u1EC1n) \u21D2 m\u1EDF cu\u1ED9c m\u1EDBi ch\u1EA1y SONG SONG.
|
|
4527
|
+
const conv = active && !active.run && !active.pending ? active : newConv();
|
|
4528
|
+
conv.pending = true;
|
|
4529
|
+
const body = Object.assign({ task, engine: S.engine, model: S.model, effort: S.effort, doc: C.ST.doc, module: C.ST.mod, item: C.ST.sel || undefined }, extra);
|
|
4530
|
+
if (body.item === null) delete body.item;
|
|
4531
|
+
if (conv.session && conv.sessionEngine === S.engine) body.resume = conv.session;
|
|
4532
|
+
// l\u1EC7nh BA \u0111\xE3 \xABCho ph\xE9p\xBB trong cu\u1ED9c n\xE0y \u0111i k\xE8m m\u1ECDi l\u01B0\u1EE3t sau c\u1EE7a cu\u1ED9c
|
|
4533
|
+
const allow = [...new Set([...(conv.allow || []), ...(body.allow || [])])];
|
|
4534
|
+
if (allow.length) body.allow = allow; else delete body.allow;
|
|
4535
|
+
// Hi\u1EC7n c\xE2u c\u1EE7a ng\u01B0\u1EDDi d\xF9ng + \xABAI \u0111ang nh\u1EADn vi\u1EC7c\u2026\xBB NGAY khi b\u1EA5m G\u1EEDi (tr\u01B0\u1EDBc \u0111\xE2y ch\u1EDD m\xE1y ch\u1EE7 tr\u1EA3 l\u1EDDi 3\u20134 s m\u1EDBi hi\u1EC7n).
|
|
4536
|
+
const label = taskLabel(task, body);
|
|
4537
|
+
const say = label + (task !== 'tu-do' && body.text ? ' \u2014 ' + body.text : '');
|
|
4538
|
+
Object.assign(body, { conv: conv.id, say });
|
|
4539
|
+
const wasUsed = conv.used;
|
|
4540
|
+
if (!conv.used) conv.title = shortText(label, 40) || conv.title;
|
|
4541
|
+
conv.used = true;
|
|
4542
|
+
show(conv);
|
|
4543
|
+
bubble(conv, 'user', say);
|
|
4544
|
+
typing(conv, true);
|
|
4545
|
+
renderTabs(); running(true);
|
|
4546
|
+
const r = await api('api/ai/run', body).finally(() => { conv.pending = false; });
|
|
4547
|
+
if (!r.ok) {
|
|
4548
|
+
typing(conv, false);
|
|
4549
|
+
bubble(conv, 'error', (r.json && r.json.error) || T('Kh\xF4ng g\u1EEDi \u0111\u01B0\u1EE3c ({s}).', { s: r.status }));
|
|
4550
|
+
if (conv === active) running(false);
|
|
4551
|
+
if (!wasUsed) conv.used = true;
|
|
4552
|
+
return;
|
|
4553
|
+
}
|
|
4554
|
+
Object.assign(conv, { run: r.json.run, task, extra: body, count: 0, cur: null, status: 'running', engine: S.engine });
|
|
4555
|
+
renderTabs(); if (conv === active) running(true);
|
|
4556
|
+
listen(conv, conv.run, 0);
|
|
4557
|
+
if (conv.stopAsked) { conv.stopAsked = false; api('api/ai/stop', { run: conv.run }); } // b\u1EA5m D\u1EEBng l\xFAc m\xE1y ch\u1EE7 ch\u01B0a nh\u1EADn l\u01B0\u1EE3t
|
|
4558
|
+
}
|
|
4559
|
+
function sendFree() {
|
|
4560
|
+
const text = el.input.value.trim();
|
|
4561
|
+
if (!text) { el.input.focus(); return; }
|
|
4562
|
+
el.input.value = '';
|
|
4563
|
+
ask('tu-do', { text });
|
|
4564
|
+
}
|
|
4565
|
+
function listen(conv, id, since) {
|
|
4566
|
+
if (conv.es) conv.es.close();
|
|
4567
|
+
const es = new EventSource('api/ai/events?run=' + encodeURIComponent(id) + '&since=' + since);
|
|
4568
|
+
conv.es = es;
|
|
4569
|
+
es.onmessage = (m) => {
|
|
4570
|
+
const e = JSON.parse(m.data);
|
|
4571
|
+
if (e.t !== 'end') conv.count++;
|
|
4572
|
+
onEvent(conv, e);
|
|
4573
|
+
if (e.t === 'end') { es.close(); conv.es = null; }
|
|
4574
|
+
};
|
|
4575
|
+
es.onerror = () => { es.close(); conv.es = null; if (conv.run === id) setTimeout(() => { if (conv.run === id) listen(conv, id, conv.count); }, 1500); };
|
|
4576
|
+
}
|
|
4577
|
+
function toolRow(e) {
|
|
4578
|
+
const h = C.h;
|
|
4579
|
+
// nh\xE3n + bi\u1EC3u t\u01B0\u1EE3ng kh\xF4ng bao gi\u1EDD co (t\u1EEBng xu\u1ED1ng d\xF2ng t\u1EEBng ch\u1EEF \xAB\u0110 / \u1ECD / c\xBB); ch\u1EC9 ph\u1EA7n \u0111\u01B0\u1EDDng d\u1EABn c\u1EAFt \xAB\u2026\xBB, di chu\u1ED9t xem \u0111\u1EE7
|
|
4580
|
+
return h('div', { class: 'pbx-ai-tool', 'data-testid': 'ai-tool', title: e.detail || null },
|
|
4581
|
+
h('span', { class: 'pbx-ai-tool__ico', html: C.P.icon(toolIcon(e.name), { size: 14 }) }),
|
|
4582
|
+
h('b', { class: 'pbx-ai-tool__n' }, T(TOOL[e.name] || e.name)), h('span', { class: 'pbx-ai-tool__d' }, e.detail || ''));
|
|
4583
|
+
}
|
|
4584
|
+
function onEvent(conv, e) {
|
|
4585
|
+
typing(conv, false);
|
|
4586
|
+
if (e.t === 'session') { conv.session = e.id; conv.sessionEngine = conv.engine || S.engine; return; }
|
|
4587
|
+
if (e.t === 'agent-start') { agentStart(conv, e); return; }
|
|
4588
|
+
if (e.t === 'agent-progress' || e.t === 'agent-end') { agentUpdate(conv, e); return; }
|
|
4589
|
+
// Ch\u1EEF / b\u01B0\u1EDBc c\u1EE7a AGENT CON: v\xE0o b\u1EA3n ghi c\u1EE7a agent \u0111\xF3 (xem \u1EDF h\u1ED9p chi ti\u1EBFt), kh\xF4ng l\u1EABn v\xE0o b\u1EA3n ghi ch\xEDnh.
|
|
4590
|
+
if ((e.t === 'text' || e.t === 'tool') && e.agent) { agentStep(conv, e); return; }
|
|
4591
|
+
if (e.t === 'text') { if (!conv.cur) conv.cur = conv.lastAi = bubble(conv, 'ai', ''); conv.cur.textContent += e.text; scrollDown(conv); return; }
|
|
4592
|
+
if (e.t === 'tool') { conv.cur = null; conv.log.appendChild(toolRow(e)); scrollDown(conv); return; }
|
|
4593
|
+
if (e.t === 'error') { conv.cur = null; bubble(conv, 'error', e.message); return; }
|
|
4594
|
+
if (e.t === 'choices') { conv.cur = null; conv.log.appendChild(choiceCard(conv, e.question, e.options)); scrollDown(conv); return; }
|
|
4595
|
+
if (e.t === 'denied') { conv.cur = null; conv.log.appendChild(deniedCard(conv, e)); scrollDown(conv); return; }
|
|
4596
|
+
if (e.t === 'done') { if (!conv.cur && e.text) conv.lastAi = bubble(conv, 'ai', e.text); conv.cur = null; return; }
|
|
4597
|
+
if (e.t === 'end') finish(conv, e);
|
|
4598
|
+
}
|
|
4599
|
+
|
|
4600
|
+
// AI h\u1ECFi BA ch\u1ECDn: kh\u1ED1i \`\`\`pan-choices \u1EDF cu\u1ED1i c\xE2u tr\u1EA3 l\u1EDDi (m\u1ECDi CLI \u2014 lu\u1EADt trong system prompt) ho\u1EB7c AskUserQuestion c\u1EE7a Claude
|
|
4601
|
+
// Code (s\u1EF1 ki\u1EC7n \`choices\`). Hi\u1EC7n th\xE0nh n\xFAt; b\u1EA5m \u21D2 l\u01B0\u1EE3t sau c\u1EE7a cu\u1ED9c g\u1EEDi \u0111\xFAng l\u1EF1a ch\u1ECDn \u0111\xF3 (nh\u1EAFn ti\u1EBFp c\xF9ng phi\xEAn AI).
|
|
4602
|
+
export function parseChoices(text) {
|
|
4603
|
+
const m = /\`\`\`pan-choices[^\\n]*\\n([\\s\\S]*?)(?:\`\`\`|$)\\s*$/.exec(String(text || ''));
|
|
4604
|
+
if (!m) return null;
|
|
4605
|
+
let question = ''; const options = [];
|
|
4606
|
+
for (const raw of m[1].split('\\n')) {
|
|
4607
|
+
const l = raw.trim();
|
|
4608
|
+
if (l.startsWith('?')) question = l.slice(1).trim();
|
|
4609
|
+
else if (/^([-*\u2022]|\\d+[.)])\\s+/.test(l)) options.push(l.replace(/^([-*\u2022]|\\d+[.)])\\s+/, '').trim());
|
|
4610
|
+
}
|
|
4611
|
+
return options.length ? { text: String(text).slice(0, m.index).trimEnd(), question, options: options.slice(0, 8) } : null;
|
|
4612
|
+
}
|
|
4613
|
+
async function afterRun(conv) { if (conv.run) await new Promise((r) => (conv.waiters = conv.waiters || []).push(r)); }
|
|
4614
|
+
function choiceCard(conv, question, options) {
|
|
4615
|
+
const h = C.h;
|
|
4616
|
+
const card = h('div', { class: 'pbx-ai-result pbx-ai-choices', 'data-testid': 'ai-choices' }, question ? h('b', null, question) : null);
|
|
4617
|
+
const acts = h('div', { class: 'pbx-ai-choices__opts' });
|
|
4618
|
+
for (const opt of options) {
|
|
4619
|
+
acts.appendChild(btn(opt, { kind: 'secondary', small: true, testid: 'ai-choice', onClick: async () => {
|
|
4620
|
+
acts.replaceChildren(h('span', { class: 'pb-small pb-muted' }, T('\u0110\xE3 ch\u1ECDn: {o}', { o: opt })));
|
|
4621
|
+
await afterRun(conv);
|
|
4622
|
+
show(conv);
|
|
4623
|
+
await ask('tu-do', { text: opt });
|
|
4624
|
+
} }));
|
|
4625
|
+
}
|
|
4626
|
+
card.appendChild(acts);
|
|
4627
|
+
return card;
|
|
4628
|
+
}
|
|
4629
|
+
|
|
4630
|
+
// AI b\u1ECB ch\u1EB7n quy\u1EC1n (Claude Code ch\u1EA1y kh\xF4ng c\xF3 ai b\u1EA5m duy\u1EC7t): hi\u1EC7n l\u1EC7nh b\u1ECB ch\u1EB7n + n\xFAt cho ph\xE9p NGAY trong cu\u1ED9c. Ch\u1EC9 l\u1EC7nh shell
|
|
4631
|
+
// (\u0111\xFAng t\u1EEBng l\u1EC7nh) m\u1EDBi cho ph\xE9p \u0111\u01B0\u1EE3c; thao t\xE1c kh\xE1c (ghi ngo\xE0i repo, t\u1EC7p c\u1EA5u h\xECnh) Pan BA kh\xF4ng m\u1EDF cho AI.
|
|
4632
|
+
function deniedCard(conv, e) {
|
|
4633
|
+
const h = C.h;
|
|
4634
|
+
const tools = e.tools || [];
|
|
4635
|
+
const rules = [...new Set(tools.map((x) => x.rule).filter(Boolean))];
|
|
4636
|
+
const card = h('div', { class: 'pbx-ai-result pbx-ai-denied', 'data-testid': 'ai-denied' },
|
|
4637
|
+
h('b', null, T('AI c\u1EA7n quy\u1EC1n:')),
|
|
4638
|
+
h('ul', { class: 'pbx-ai-files' }, tools.map((x) => h('li', null, h('b', null, T(TOOL[x.name] || x.name)), ' ', h('code', { class: 'pbx-lintfile' }, x.detail || '')))));
|
|
4639
|
+
if (!rules.length) {
|
|
4640
|
+
card.appendChild(h('p', { class: 'pb-small pb-muted' }, T('Pan BA kh\xF4ng cho AI l\xE0m thao t\xE1c n\xE0y (ngo\xE0i repo ho\u1EB7c t\u1EC7p c\u1EA5u h\xECnh) \u2014 t\u1EF1 l\xE0m, ho\u1EB7c \u0111\u1ED5i y\xEAu c\u1EA7u.')));
|
|
4641
|
+
return card;
|
|
4642
|
+
}
|
|
4643
|
+
const acts = h('div', { class: 'pb-row' });
|
|
4644
|
+
const go = (always) => async () => {
|
|
4645
|
+
acts.replaceChildren(h('span', { class: 'pb-small pb-muted' }, always ? T('\u0110\xE3 lu\xF4n cho ph\xE9p (m\xE1y n\xE0y, repo n\xE0y) \u2014 AI l\xE0m ti\u1EBFp.') : T('\u0110\xE3 cho ph\xE9p trong cu\u1ED9c n\xE0y \u2014 AI l\xE0m ti\u1EBFp.')));
|
|
4646
|
+
conv.allow = [...new Set([...(conv.allow || []), ...rules])];
|
|
4647
|
+
await afterRun(conv); // l\u01B0\u1EE3t b\u1ECB ch\u1EB7n ch\u01B0a \u0111\xF3ng h\u1EB3n
|
|
4648
|
+
show(conv);
|
|
4649
|
+
const cmds = tools.filter((x) => x.rule).map((x) => x.detail).join('; ');
|
|
4650
|
+
await ask('tu-do', { text: T('\u0110\xE3 cho ph\xE9p: {c}. Ch\u1EA1y l\u1EA1i \u0111\xFAng l\u1EC7nh \u0111\xF3 r\u1ED3i l\xE0m ti\u1EBFp vi\u1EC7c \u0111ang d\u1EDF.', { c: cmds }), allow: rules, ...(always ? { allowAlways: true } : {}) });
|
|
4651
|
+
};
|
|
4652
|
+
acts.appendChild(btn(T('Cho ph\xE9p v\xE0 l\xE0m ti\u1EBFp'), { kind: 'primary', small: true, icon: 'check', testid: 'ai-allow', onClick: go(false) }));
|
|
4653
|
+
acts.appendChild(btn(T('Lu\xF4n cho ph\xE9p'), { kind: 'secondary', small: true, testid: 'ai-allow-always', onClick: go(true) }));
|
|
4654
|
+
card.appendChild(acts);
|
|
4655
|
+
card.appendChild(h('p', { class: 'pb-small pb-muted' }, T('\xABLu\xF4n cho ph\xE9p\xBB nh\u1EDB \u0111\xFAng c\xE1c l\u1EC7nh n\xE0y cho repo, ch\u1EC9 tr\xEAn m\xE1y n\xE0y.')));
|
|
4656
|
+
return card;
|
|
4657
|
+
}
|
|
4658
|
+
|
|
4659
|
+
// ---------------------------------------------------------------- agent con
|
|
4660
|
+
function agentStart(conv, e) {
|
|
4661
|
+
const h = C.h;
|
|
4662
|
+
conv.cur = null;
|
|
4663
|
+
const a = { id: e.agent, parent: e.parent, label: e.label || '', kind: e.kind || '', prompt: e.prompt || '', model: e.model || '', status: 'running', steps: [], tools: 0, tokens: 0, ms: 0, activity: '', summary: '', card: null };
|
|
4664
|
+
const card = h('button', { type: 'button', class: 'pbx-ai-agent', 'data-testid': 'ai-agent', 'data-status': 'running' });
|
|
4665
|
+
card.addEventListener('click', () => agentDialog(conv, a.id));
|
|
4666
|
+
a.card = card;
|
|
4667
|
+
conv.agents.set(a.id, a);
|
|
4668
|
+
const parent = conv.agents.get(e.parent);
|
|
4669
|
+
if (parent) { parent.steps.push({ agent: a.id }); paintAgent(parent); }
|
|
4670
|
+
else { conv.log.appendChild(card); scrollDown(conv); }
|
|
4671
|
+
paintAgent(a);
|
|
4672
|
+
}
|
|
4673
|
+
function agentUpdate(conv, e) {
|
|
4674
|
+
const a = conv.agents.get(e.agent);
|
|
4675
|
+
if (!a) return;
|
|
4676
|
+
if (e.t === 'agent-progress') { if (e.activity) a.activity = e.activity; if (e.tokens) a.tokens = e.tokens; if (e.ms) a.ms = e.ms; }
|
|
4677
|
+
else { a.status = e.status === 'error' ? 'error' : 'done'; if (e.summary) a.summary = e.summary; if (e.ms) a.ms = e.ms; a.activity = ''; }
|
|
4678
|
+
paintAgent(a);
|
|
4679
|
+
}
|
|
4680
|
+
function agentStep(conv, e) {
|
|
4681
|
+
const a = conv.agents.get(e.agent);
|
|
4682
|
+
if (!a) return;
|
|
4683
|
+
if (e.t === 'tool') { a.steps.push({ tool: e.name, detail: e.detail }); a.tools += 1; }
|
|
4684
|
+
else { const last = a.steps[a.steps.length - 1]; if (last && typeof last.text === 'string') last.text += e.text; else a.steps.push({ text: e.text }); }
|
|
4685
|
+
paintAgent(a);
|
|
4686
|
+
}
|
|
4687
|
+
const secs = (ms) => (ms ? (ms < 60000 ? Math.max(1, Math.round(ms / 1000)) + 's' : Math.floor(ms / 60000) + 'm' + String(Math.round((ms % 60000) / 1000)).padStart(2, '0') + 's') : '');
|
|
4688
|
+
function agentMeta(a) {
|
|
4689
|
+
return [secs(a.ms), a.tools ? T('{n} b\u01B0\u1EDBc', { n: a.tools }) : '', a.tokens ? T('{n} token', { n: a.tokens.toLocaleString() }) : ''].filter(Boolean).join(' \xB7 ');
|
|
4690
|
+
}
|
|
4691
|
+
function paintAgent(a) {
|
|
4692
|
+
const h = C.h;
|
|
4693
|
+
if (!a.card) return;
|
|
4694
|
+
a.card.setAttribute('data-status', a.status);
|
|
4695
|
+
// Khung Tr\u1EE3 l\xFD h\u1EB9p \u21D2 ba d\xF2ng: \xABAgent con \xB7 lo\u1EA1i\xBB / vi\u1EC7c \u0111\u01B0\u1EE3c giao (\u2264 2 d\xF2ng) / th\u1EDDi gian \xB7 b\u01B0\u1EDBc \xB7 token (+ \u0111ang l\xE0m g\xEC).
|
|
4696
|
+
// replaceChildren(null) in ch\u1EEF \xABnull\xBB \u21D2 l\u1ECDc ph\u1EA7n tr\u1ED1ng.
|
|
4697
|
+
const meta = [agentMeta(a), a.status === 'running' ? a.activity : ''].filter(Boolean).join(' \xB7 ');
|
|
4698
|
+
a.card.replaceChildren(...[
|
|
4699
|
+
h('span', { class: 'pbx-ai-agent__row' }, statusDot(a.status), h('b', null, T('Agent con')), a.kind ? h('span', { class: 'pb-badge' }, a.kind) : null),
|
|
4700
|
+
a.label ? h('span', { class: 'pbx-ai-agent__l' }, a.label) : null,
|
|
4701
|
+
meta ? h('span', { class: 'pb-small pb-muted pbx-ai-agent__act' }, meta) : null,
|
|
4702
|
+
].filter(Boolean));
|
|
4703
|
+
}
|
|
4704
|
+
function agentDialog(conv, id) {
|
|
4705
|
+
const h = C.h;
|
|
4706
|
+
const a = conv.agents.get(id);
|
|
4707
|
+
if (!a) return;
|
|
4708
|
+
const steps = h('div', { class: 'pbx-ai-agent__steps' }, a.steps.map((s) => {
|
|
4709
|
+
if (s.tool) return toolRow({ name: s.tool, detail: s.detail });
|
|
4710
|
+
if (s.agent) { const sub = conv.agents.get(s.agent); return sub ? h('div', { class: 'pb-small' }, statusDot(sub.status), ' ', T('Agent con'), ' \xB7 ', sub.kind, ' \xAB', sub.label, '\xBB') : null; }
|
|
4711
|
+
return h('div', { class: 'pbx-ai-msg pbx-ai-msg--ai' }, s.text);
|
|
4712
|
+
}).filter(Boolean));
|
|
4713
|
+
const body = h('div', { class: 'pb-stack', 'data-testid': 'ai-agent-body' },
|
|
4714
|
+
h('p', { class: 'pb-small pb-muted' }, [a.label, a.model, agentMeta(a)].filter(Boolean).join(' \xB7 ')),
|
|
4715
|
+
a.prompt ? h('div', null, h('b', null, T('Vi\u1EC7c \u0111\u01B0\u1EE3c giao')), h('div', { class: 'pbx-ai-msg pbx-ai-msg--user pbx-ai-agent__prompt' }, a.prompt)) : null,
|
|
4716
|
+
a.steps.length ? h('div', null, h('b', null, T('C\xE1c b\u01B0\u1EDBc')), steps) : null,
|
|
4717
|
+
a.summary ? h('div', null, h('b', null, T('K\u1EBFt qu\u1EA3')), h('div', { class: 'pbx-ai-msg pbx-ai-msg--ai' }, a.summary)) : null);
|
|
4718
|
+
C.P.dialog({ title: T('Agent con') + (a.kind ? ' \xB7 ' + a.kind : ''), size: 'lg', testid: 'ai-agent-dialog', body, actions: [{ label: T('\u0110\xF3ng') }] });
|
|
4719
|
+
}
|
|
4720
|
+
|
|
4721
|
+
function finish(conv, e, o = {}) {
|
|
4722
|
+
const h = C.h; const id = conv.run; const task = conv.task; const extra = conv.extra || {};
|
|
4723
|
+
conv.run = null; conv.cur = null; conv.status = e.status || 'done';
|
|
4724
|
+
const waiters = conv.waiters || []; conv.waiters = [];
|
|
4725
|
+
// c\xE2u tr\u1EA3 l\u1EDDi k\u1EBFt th\xFAc b\u1EB1ng kh\u1ED1i l\u1EF1a ch\u1ECDn \u21D2 b\u1ECF kh\u1ED1i kh\u1ECFi bong b\xF3ng, hi\u1EC7n n\xFAt (c\u1EA3 khi d\u1EF1ng l\u1EA1i l\u1ECBch s\u1EED)
|
|
4726
|
+
const aiEl = conv.lastAi; conv.lastAi = null;
|
|
4727
|
+
const pick = aiEl ? parseChoices(aiEl.textContent) : null;
|
|
4728
|
+
if (pick) { if (pick.text) aiEl.textContent = pick.text; else aiEl.remove(); }
|
|
4729
|
+
for (const a of conv.agents.values()) if (a.status === 'running') { a.status = e.status === 'done' ? 'done' : 'error'; paintAgent(a); }
|
|
4730
|
+
renderTabs();
|
|
4731
|
+
if (conv === active) running(false);
|
|
4732
|
+
else if (!o.quiet) C.P.toast(e.status === 'error' ? T('Cu\u1ED9c \xAB{t}\xBB g\u1EB7p l\u1ED7i.', { t: conv.title }) : T('Cu\u1ED9c \xAB{t}\xBB \u0111\xE3 xong.', { t: conv.title }), { kind: e.status === 'error' ? 'error' : 'success' });
|
|
4733
|
+
const files = e.files || [];
|
|
4734
|
+
const card = h('div', { class: 'pbx-ai-result', 'data-testid': 'ai-result', 'data-status': e.status });
|
|
4735
|
+
const head = e.status === 'stopped' ? T('\u0110\xE3 d\u1EEBng.') : e.status === 'error' ? T('AI g\u1EB7p l\u1ED7i.') : files.length ? T('\u0110\xE3 \u0111\u1ED5i {n} t\u1EC7p.', { n: files.length }) : T('Xong \u2014 kh\xF4ng \u0111\u1ED5i t\u1EC7p n\xE0o.');
|
|
4736
|
+
const lint = e.lint ? h('span', { class: 'pb-badge', 'data-tone': e.lint.errors ? 'error' : e.lint.warns ? 'warn' : 'ok', 'data-testid': 'ai-lint' }, e.lint.errors ? T('{n} l\u1ED7i', { n: e.lint.errors }) : e.lint.warns ? T('{n} c\u1EA3nh b\xE1o', { n: e.lint.warns }) : T('Ki\u1EC3m tra s\u1EA1ch')) : null;
|
|
4737
|
+
card.appendChild(h('div', { class: 'pb-row' }, h('b', null, head), lint));
|
|
4738
|
+
if (files.length) {
|
|
4739
|
+
card.appendChild(h('ul', { class: 'pbx-ai-files' }, files.map((f) => h('li', null, h('span', { class: 'pbx-lintfile' }, f)))));
|
|
4740
|
+
}
|
|
4741
|
+
// l\u01B0\u1EE3t t\u1EEB tr\u01B0\u1EDBc khi m\u1EDF l\u1EA1i app: kh\xF4ng c\xF2n b\u1EA3n ch\u1EE5p \u21D2 kh\xF4ng c\xF3 Xem thay \u0111\u1ED5i / Ho\xE0n t\xE1c (d\xF9ng git)
|
|
4742
|
+
if (files.length && e.restored) card.appendChild(h('p', { class: 'pb-small pb-muted' }, T('L\u01B0\u1EE3t tr\u01B0\u1EDBc khi m\u1EDF l\u1EA1i app \u2014 xem / tr\u1EA3 l\u1EA1i thay \u0111\u1ED5i b\u1EB1ng git.')));
|
|
4743
|
+
if (files.length && !e.restored) {
|
|
4744
|
+
const acts = h('div', { class: 'pb-row' });
|
|
4745
|
+
acts.appendChild(btn(T('Xem thay \u0111\u1ED5i'), { kind: 'secondary', small: true, icon: 'eye', testid: 'ai-diff', onClick: () => showDiff(id, files) }));
|
|
4746
|
+
const undo = btn(T('Ho\xE0n t\xE1c'), { kind: 'ghost', small: true, icon: 'history', testid: 'ai-undo', onClick: async (_ev, b) => {
|
|
4747
|
+
b.disabled = true;
|
|
4748
|
+
const r = await api('api/ai/undo', { run: id });
|
|
4749
|
+
if (!r.ok) { failToast(r); b.disabled = false; return; }
|
|
4750
|
+
const skipped = r.json.skipped || [];
|
|
4751
|
+
C.P.toast(T('\u0110\xE3 ho\xE0n t\xE1c {n} t\u1EC7p.', { n: r.json.files.length }), { kind: 'success' });
|
|
4752
|
+
if (skipped.length) C.P.toast(T('Kh\xF4ng ho\xE0n t\xE1c (t\u1EC7p \u0111\xE3 b\u1ECB s\u1EEDa ti\u1EBFp): {f}', { f: skipped.join(', ') }), { kind: 'warn' });
|
|
4753
|
+
acts.replaceChildren(h('span', { class: 'pb-small pb-muted' }, T('\u0110\xE3 ho\xE0n t\xE1c.')));
|
|
4754
|
+
await C.reload();
|
|
4755
|
+
} });
|
|
4756
|
+
acts.appendChild(undo);
|
|
4757
|
+
acts.appendChild(btn(T('Gi\u1EEF'), { kind: 'primary', small: true, icon: 'check', testid: 'ai-keep', onClick: () => { acts.replaceChildren(h('span', { class: 'pb-small pb-muted' }, T('\u0110\xE3 gi\u1EEF \u2014 nh\u1EDB commit \u1EDF thanh git.'))); } }));
|
|
4758
|
+
card.appendChild(acts);
|
|
4759
|
+
}
|
|
4760
|
+
if (e.answer && (task === 'binh-luan' || task === 'gop-y' || task === 'muc-cho')) {
|
|
4761
|
+
const row = h('div', { class: 'pb-row' });
|
|
4762
|
+
if (task === 'binh-luan' && extra.comment) row.appendChild(btn(T('\u0110\u0103ng l\xE0m tr\u1EA3 l\u1EDDi'), { kind: 'secondary', small: true, icon: 'message', testid: 'ai-post-reply', onClick: () => replyDialog(extra.comment, e.answer) }));
|
|
4763
|
+
row.appendChild(btn(T('Ch\xE9p c\xE2u tr\u1EA3 l\u1EDDi'), { kind: 'ghost', small: true, testid: 'ai-copy', onClick: () => { try { navigator.clipboard.writeText(e.answer); C.P.toast(T('\u0110\xE3 ch\xE9p.'), { kind: 'success' }); } catch { /* b\u1ECF qua */ } } }));
|
|
4764
|
+
card.appendChild(row);
|
|
4765
|
+
}
|
|
4766
|
+
conv.log.appendChild(card);
|
|
4767
|
+
if (pick) conv.log.appendChild(choiceCard(conv, pick.question, pick.options));
|
|
4768
|
+
scrollDown(conv);
|
|
4769
|
+
if (files.length) C.reload();
|
|
4770
|
+
for (const w of waiters) w(); // b\u1EA5m \xABCho ph\xE9p\xBB l\xFAc l\u01B0\u1EE3t ch\u01B0a \u0111\xF3ng \u21D2 g\u1EEDi l\u01B0\u1EE3t ti\u1EBFp khi \u0111\xE3 \u0111\xF3ng
|
|
4771
|
+
}
|
|
4772
|
+
// D\u1EEBng: n\xFAt \u0111\u1ED5i \xAB\u0110ang d\u1EEBng\u2026\xBB NGAY; m\xE1y ch\u1EE7 gi\u1EBFt c\u1EA3 c\xE2y ti\u1EBFn tr\xECnh v\xE0 \xE9p k\u1EBFt th\xFAc l\u01B0\u1EE3t n\u1EBFu CLI kh\xF4ng t\u1EF1 \u0111\xF3ng. L\u01B0\u1EE3t \u0111\xE3 xong tr\xEAn m\xE1y
|
|
4773
|
+
// ch\u1EE7 (404) \u21D2 k\u1EBFt th\xFAc t\u1EA1i ch\u1ED7, kh\xF4ng \u0111\u1EC3 n\xFAt treo.
|
|
4774
|
+
async function stop() {
|
|
4775
|
+
const conv = active; if (!conv) return;
|
|
4776
|
+
el.stop.disabled = true; el.stop.textContent = T('\u0110ang d\u1EEBng\u2026');
|
|
4777
|
+
if (!conv.run) { if (conv.pending) conv.stopAsked = true; return; } // m\xE1y ch\u1EE7 ch\u01B0a tr\u1EA3 m\xE3 l\u01B0\u1EE3t \u21D2 d\u1EEBng ngay khi c\xF3
|
|
4778
|
+
const r = await api('api/ai/stop', { run: conv.run });
|
|
4779
|
+
if (!r.ok && conv.run) { if (conv.es) { conv.es.close(); conv.es = null; } typing(conv, false); finish(conv, { t: 'end', status: 'stopped', files: [] }); }
|
|
4780
|
+
}
|
|
4781
|
+
async function showDiff(id, files) {
|
|
4782
|
+
const h = C.h;
|
|
4783
|
+
const body = h('div', { class: 'pb-stack', 'data-testid': 'ai-diff-body' });
|
|
4784
|
+
C.P.dialog({ title: T('Thay \u0111\u1ED5i c\u1EE7a AI'), size: 'lg', testid: 'ai-diff-dialog', body, actions: [{ label: T('\u0110\xF3ng') }] });
|
|
4785
|
+
for (const f of files) {
|
|
4786
|
+
const r = await api('api/ai/diff?run=' + encodeURIComponent(id) + '&file=' + encodeURIComponent(f));
|
|
4787
|
+
const pre = h('pre', { class: 'pbx-diff' });
|
|
4788
|
+
for (const line of String((r.json && r.json.diff) || T('(kh\xF4ng \u0111\u1ECDc \u0111\u01B0\u1EE3c diff)')).split('\\n')) {
|
|
4789
|
+
pre.appendChild(h('span', { class: line.startsWith('+') && !line.startsWith('+++') ? 'pbx-diff-add' : line.startsWith('-') && !line.startsWith('---') ? 'pbx-diff-del' : line.startsWith('@@') ? 'pbx-diff-hunk' : null }, line + '\\n'));
|
|
4790
|
+
}
|
|
4791
|
+
body.appendChild(h('div', null, h('div', { class: 'pbx-lintfile' }, f), pre));
|
|
4792
|
+
}
|
|
4793
|
+
}
|
|
4794
|
+
|
|
4795
|
+
// ================================================================ B\xCCNH LU\u1EACN
|
|
4796
|
+
const CM = { threads: [], counts: {}, studio: false, scope: 'item', filter: 'open', pending: null };
|
|
4797
|
+
let cel = null;
|
|
4798
|
+
export async function loadComments() {
|
|
4799
|
+
const r = await api('api/comments?product=' + encodeURIComponent(C.PRODUCT));
|
|
4800
|
+
CM.threads = r.json.threads || []; CM.counts = r.json.counts || {}; CM.studio = !!r.json.studio;
|
|
4801
|
+
const open = Object.values(CM.counts).reduce((a, b) => a + b, 0);
|
|
4802
|
+
if (open) C.rightTabs.setCount('binh-luan', open);
|
|
4803
|
+
else { const c = document.querySelector('[data-testid="rtab-binh-luan"] .pb-tab__count'); if (c) c.remove(); }
|
|
4804
|
+
return CM;
|
|
4805
|
+
}
|
|
4806
|
+
export const commentCount = (code) => CM.counts[code] || 0;
|
|
4807
|
+
export function mountComments(panel) {
|
|
4808
|
+
cel = panel; renderComments();
|
|
4809
|
+
try { C.rightTabs.querySelector('[data-testid="rtab-binh-luan"]').addEventListener('click', () => autoSync()); } catch { /* khung kh\xE1c */ }
|
|
4810
|
+
}
|
|
4811
|
+
let lastSync = 0;
|
|
4812
|
+
/** B\xECnh lu\u1EADn ng\u01B0\u1EDDi xem vi\u1EBFt tr\xEAn Studio v\u1EC1 t\u1EF1 \u0111\u1ED9ng khi m\u1EDF tab B\xECnh lu\u1EADn (t\u1ED1i \u0111a 2 ph\xFAt m\u1ED9t l\u1EA7n; l\u1ED7i th\xEC im l\u1EB7ng). */
|
|
4813
|
+
async function autoSync() {
|
|
4814
|
+
if (!CM.studio || Date.now() - lastSync < 120000) return;
|
|
4815
|
+
lastSync = Date.now();
|
|
4816
|
+
const r = await api('api/comments/sync', {});
|
|
4817
|
+
if (!r.ok) return;
|
|
4818
|
+
const x = r.json.report;
|
|
4819
|
+
if (x.pulled || x.statuses) { C.P.toast(T('Studio: c\xF3 {a} b\xECnh lu\u1EADn / tr\u1EA3 l\u1EDDi m\u1EDBi.', { a: x.pulled + x.statuses }), { kind: 'info' }); await refreshAll(); }
|
|
4820
|
+
}
|
|
4821
|
+
/** M\u1EDF tab B\xECnh lu\u1EADn cho m\u1ED9t m\u1EE5c (t\u1EEB huy hi\u1EC7u tr\xEAn th\u1EBB m\u1EE5c / l\u1EC1 Word). */
|
|
4822
|
+
export function openComments(code, pending) {
|
|
4823
|
+
if (code && code !== C.ST.sel) C.select(code, false);
|
|
4824
|
+
CM.scope = 'item';
|
|
4825
|
+
if (pending) CM.pending = pending;
|
|
4826
|
+
openTab('binh-luan');
|
|
4827
|
+
renderComments();
|
|
4828
|
+
const ta = cel && cel.querySelector('[data-testid="cm-text"]'); if (ta) ta.focus();
|
|
4829
|
+
}
|
|
4830
|
+
const who = (id, name) => name || C.M().personName(id) || id;
|
|
4831
|
+
export function renderComments() {
|
|
4832
|
+
if (!cel) return;
|
|
4833
|
+
const h = C.h; const code = C.ST.sel;
|
|
4834
|
+
const seg = (opts, cur, on, testid) => h('div', { class: 'pb-seg', role: 'radiogroup', 'data-testid': testid }, opts.map(([v, l]) => {
|
|
4835
|
+
const b = h('button', { type: 'button', role: 'radio', 'aria-checked': String(cur === v), 'data-testid': testid + '-' + v }, l);
|
|
4836
|
+
b.addEventListener('click', () => { on(v); renderComments(); }); return b;
|
|
4837
|
+
}));
|
|
4838
|
+
const sync = CM.studio ? btn(T('\u0110\u1ED3ng b\u1ED9 Studio'), { kind: 'ghost', small: true, icon: 'refresh', testid: 'cm-sync', onClick: (_e, b) => syncStudio(b) }) : null;
|
|
4839
|
+
const top = h('div', { class: 'pbx-cm-top' },
|
|
4840
|
+
seg([['item', T('M\u1EE5c n\xE0y')], ['all', T('C\u1EA3 d\u1EF1 \xE1n con')]], CM.scope, (v) => { CM.scope = v; }, 'cm-scope'),
|
|
4841
|
+
seg([['open', T('\u0110ang m\u1EDF')], ['all', T('T\u1EA5t c\u1EA3')]], CM.filter, (v) => { CM.filter = v; }, 'cm-filter'), sync);
|
|
4842
|
+
const parts = [top];
|
|
4843
|
+
if (code && CM.scope === 'item') parts.push(composer(code));
|
|
4844
|
+
else if (CM.scope === 'item') parts.push(h('p', { class: 'pb-muted pb-small' }, T('Ch\u1ECDn m\u1ED9t m\u1EE5c \u0111\u1EC3 b\xECnh lu\u1EADn \u2014 ho\u1EB7c b\xF4i ch\u1EEF trong \xABXem nh\u01B0 Word\xBB r\u1ED3i b\u1EA5m B\xECnh lu\u1EADn.')));
|
|
4845
|
+
const list = CM.threads.filter((t) => (CM.scope === 'all' || t.item === code) && (CM.filter === 'all' || t.status === 'open'));
|
|
4846
|
+
if (!list.length) parts.push(h('p', { class: 'pb-muted pb-small', 'data-testid': 'cm-empty' }, CM.filter === 'open' ? T('Kh\xF4ng c\xF3 b\xECnh lu\u1EADn \u0111ang m\u1EDF.') : T('Ch\u01B0a c\xF3 b\xECnh lu\u1EADn.')));
|
|
4847
|
+
for (const t of list) parts.push(threadCard(t));
|
|
4848
|
+
cel.replaceChildren(...parts);
|
|
4849
|
+
}
|
|
4850
|
+
function composer(code) {
|
|
4851
|
+
const h = C.h; const p = CM.pending && CM.pending.item === code ? CM.pending : null;
|
|
4852
|
+
const rows = [];
|
|
4853
|
+
for (const k of ['truong', 'thao-tac', 'quy-tac', 'buoc', 'tham-so']) for (const r of C.M().rows(code, k, 'current')) if (r.ma && !r.nhom) rows.push([r.ma, r.ma + ' \xB7 ' + (r.ten || r.noiDung || r.chuThich || '').slice(0, 40)]);
|
|
4854
|
+
const rowSel = h('select', { class: 'pb-select', 'data-testid': 'cm-row', 'aria-label': T('D\xF2ng') }, [['', T('C\u1EA3 m\u1EE5c')]].concat(rows).map(([v, l]) => h('option', { value: v, selected: (p && p.row === v) || null }, l)));
|
|
4855
|
+
const ta = h('textarea', { class: 'pb-textarea', rows: '3', 'data-testid': 'cm-text', placeholder: T('B\xECnh lu\u1EADn v\u1EC1 {c}\u2026 (Ctrl+Enter \u0111\u1EC3 g\u1EEDi)', { c: code }) });
|
|
4856
|
+
const quote = p && p.quote ? h('div', { class: 'pbx-cm-quote', 'data-testid': 'cm-quote' }, '\xAB' + p.quote + '\xBB', ' ', btn('', { kind: 'ghost', small: true, icon: 'x', title: T('B\u1ECF \u0111o\u1EA1n tr\xEDch'), onClick: () => { CM.pending = null; renderComments(); } })) : null;
|
|
4857
|
+
const send = async (b) => {
|
|
4858
|
+
const text = ta.value.trim(); if (!text) { ta.focus(); return; }
|
|
4859
|
+
b.disabled = true;
|
|
4860
|
+
const r = await api('api/comments/add', { item: code, row: rowSel.value || undefined, quote: p ? p.quote : undefined, text });
|
|
4861
|
+
b.disabled = false;
|
|
4862
|
+
if (!r.ok) { failToast(r); return; }
|
|
4863
|
+
CM.pending = null; ta.value = '';
|
|
4864
|
+
await refreshAll();
|
|
4865
|
+
};
|
|
4866
|
+
const go = btn(T('B\xECnh lu\u1EADn'), { kind: 'primary', small: true, icon: 'message', testid: 'cm-send', onClick: (_e, b) => send(b) });
|
|
4867
|
+
ta.addEventListener('keydown', (e) => { if (e.key === 'Enter' && (e.ctrlKey || e.metaKey)) { e.preventDefault(); send(go); } });
|
|
4868
|
+
return h('div', { class: 'pbx-cm-new', 'data-testid': 'cm-new' }, quote, rows.length ? rowSel : null, ta, h('div', { class: 'pb-row' }, h('span', { class: 'pbx-grow' }), go));
|
|
4869
|
+
}
|
|
4870
|
+
function threadCard(t) {
|
|
4871
|
+
const h = C.h; const me = C.me && C.me();
|
|
4872
|
+
const head = (a, name, at, extra) => h('div', { class: 'pbx-cm-head' }, C.P.avatar(a.startsWith('studio:') ? (name || a) : a, { size: 20 }), h('b', null, who(a, name)), h('span', { class: 'pb-small pb-muted' }, C.P.fmt.date(at)), extra || null);
|
|
4873
|
+
const studio = t.source === 'studio' || t.studio ? h('span', { class: 'pb-badge', 'data-tone': 'info', title: T('\u0110\u1ED3ng b\u1ED9 v\u1EDBi Pan Studio') }, 'Studio') : null;
|
|
4874
|
+
const card = h('div', { class: 'pbx-cm', 'data-testid': 'cm-' + t.id, 'data-status': t.status },
|
|
4875
|
+
head(t.author, t.author_name, t.at, studio),
|
|
4876
|
+
CM.scope === 'all' || t.row || t.quote ? h('div', { class: 'pb-row pbx-cm-where' }, CM.scope === 'all' ? C.P.chip(t.item, { docId: C.ST.doc, size: 'sm' }) : null, t.row ? h('span', { class: 'pb-code' }, t.row) : null, t.quote ? h('span', { class: 'pbx-cm-quote' }, '\xAB' + t.quote + '\xBB') : null) : null,
|
|
4877
|
+
h('div', { class: 'pbx-cm-text' }, t.text),
|
|
4878
|
+
...(t.replies || []).map((r) => h('div', { class: 'pbx-cm-reply', 'data-testid': 'cm-reply' }, head(r.author, r.author_name, r.at), h('div', { class: 'pbx-cm-text' }, r.text))));
|
|
4879
|
+
const replyBox = h('div', { class: 'pbx-cm-replybox', hidden: true });
|
|
4880
|
+
const ta = h('textarea', { class: 'pb-textarea', rows: '2', 'data-testid': 'cm-reply-text', placeholder: T('Tr\u1EA3 l\u1EDDi\u2026') });
|
|
4881
|
+
const sendReply = async (b) => {
|
|
4882
|
+
const text = ta.value.trim(); if (!text) { ta.focus(); return; }
|
|
4883
|
+
b.disabled = true;
|
|
4884
|
+
const r = await api('api/comments/reply', { item: t.item, id: t.id, text });
|
|
4885
|
+
b.disabled = false;
|
|
4886
|
+
if (!r.ok) { failToast(r); return; }
|
|
4887
|
+
await refreshAll();
|
|
4888
|
+
};
|
|
4889
|
+
const sendBtn = btn(T('G\u1EEDi'), { kind: 'primary', small: true, testid: 'cm-reply-send', onClick: (_e, b) => sendReply(b) });
|
|
4890
|
+
ta.addEventListener('keydown', (e) => { if (e.key === 'Enter' && (e.ctrlKey || e.metaKey)) { e.preventDefault(); sendReply(sendBtn); } });
|
|
4891
|
+
replyBox.append(ta, h('div', { class: 'pb-row' }, h('span', { class: 'pbx-grow' }), sendBtn));
|
|
4892
|
+
const status = async (s) => { const r = await api('api/comments/status', { item: t.item, id: t.id, status: s }); if (!r.ok) failToast(r); else await refreshAll(); };
|
|
4893
|
+
const acts = h('div', { class: 'pb-row pbx-cm-acts' },
|
|
4894
|
+
btn(T('Tr\u1EA3 l\u1EDDi'), { kind: 'ghost', small: true, icon: 'corner-down-left', testid: 'cm-reply-open', onClick: () => { replyBox.hidden = !replyBox.hidden; if (!replyBox.hidden) ta.focus(); } }),
|
|
4895
|
+
t.status === 'open' ? btn(T('\u0110\xF3ng lu\u1ED3ng'), { kind: 'ghost', small: true, icon: 'check', testid: 'cm-resolve', onClick: () => status('resolved') }) : btn(T('M\u1EDF l\u1EA1i'), { kind: 'ghost', small: true, icon: 'refresh', testid: 'cm-reopen', onClick: () => status('open') }),
|
|
4896
|
+
btn(T('Nh\u1EDD AI'), { kind: 'ghost', small: true, icon: 'sparkles', testid: 'cm-ai', onClick: () => askAi('binh-luan', { comment: { item: t.item, id: t.id }, item: t.item }) }),
|
|
4897
|
+
t.author === me && !t.studio ? btn('', { kind: 'ghost', small: true, icon: 'trash', title: T('Xo\xE1 b\xECnh lu\u1EADn'), testid: 'cm-delete', onClick: async () => { const r = await api('api/comments/delete', { item: t.item, id: t.id }); if (!r.ok) failToast(r); else await refreshAll(); } }) : null);
|
|
4898
|
+
card.append(acts, replyBox);
|
|
4899
|
+
if (t.status === 'resolved') card.appendChild(h('div', { class: 'pb-small pb-muted' }, T('\u0110\xE3 \u0111\xF3ng b\u1EDFi {p}', { p: who(t.resolved_by || '', '') })));
|
|
4900
|
+
return card;
|
|
4901
|
+
}
|
|
4902
|
+
function replyDialog(comment, text) {
|
|
4903
|
+
const h = C.h;
|
|
4904
|
+
const ta = h('textarea', { class: 'pb-textarea', rows: '5', 'data-testid': 'ai-reply-text' }); ta.value = text;
|
|
4905
|
+
C.P.dialog({ title: T('\u0110\u0103ng l\xE0m tr\u1EA3 l\u1EDDi'), size: 'sm', testid: 'ai-reply-dialog', body: ta, actions: [{ label: T('Hu\u1EF7') }, { label: T('\u0110\u0103ng'), kind: 'primary', testid: 'ai-reply-ok', close: false, onClick: async (_e, d) => {
|
|
4906
|
+
const r = await api('api/comments/reply', { item: comment.item, id: comment.id, text: ta.value });
|
|
4907
|
+
if (!r.ok) { failToast(r); return false; }
|
|
4908
|
+
d.close(); await refreshAll(); return false;
|
|
4909
|
+
} }] });
|
|
4910
|
+
}
|
|
4911
|
+
async function syncStudio(b) {
|
|
4912
|
+
b.disabled = true;
|
|
4913
|
+
const r = await api('api/comments/sync', {});
|
|
4914
|
+
b.disabled = false;
|
|
4915
|
+
if (!r.ok) { failToast(r); return; }
|
|
4916
|
+
const x = r.json.report;
|
|
4917
|
+
C.P.toast(T('Studio: k\xE9o v\u1EC1 {a}, \u0111\u1EA9y l\xEAn {b} b\xECnh lu\u1EADn, {c} tr\u1EA3 l\u1EDDi, {d} tr\u1EA1ng th\xE1i.', { a: x.pulled, b: x.pushed, c: x.replies, d: x.statuses }), { kind: 'success' });
|
|
4918
|
+
await refreshAll();
|
|
4919
|
+
}
|
|
4920
|
+
async function refreshAll() {
|
|
4921
|
+
await loadComments();
|
|
4922
|
+
renderComments();
|
|
4923
|
+
if (C.onComments) C.onComments();
|
|
4924
|
+
}
|
|
4925
|
+
|
|
4926
|
+
// ---------------------------------------------------------------- l\u1EC1 \xABXem nh\u01B0 Word\xBB: d\u1EA5u b\xECnh lu\u1EADn + b\xF4i ch\u1EEF \u0111\u1EC3 b\xECnh lu\u1EADn
|
|
4927
|
+
/** Trang Word \u1EDF khung c\xF9ng origin (CSP c\u1EE7a khung kh\xF4ng cho script ch\u1EA1y B\xCAN TRONG \u2014 m\xE3 n\xE0y ch\u1EA1y \u1EDF trang cha, ch\u1EC9 g\u1EAFn DOM). */
|
|
4928
|
+
export function decorateWord(frame) {
|
|
4929
|
+
const doc = frame && frame.contentDocument; if (!doc || !doc.body) return;
|
|
4930
|
+
const M = C.M();
|
|
4931
|
+
doc.querySelectorAll('.pbx-cm-mark,.pbx-cm-float').forEach((x) => x.remove());
|
|
4932
|
+
doc.querySelectorAll('.pbx-cm-row').forEach((x) => x.classList.remove('pbx-cm-row'));
|
|
4933
|
+
if (!doc.getElementById('pbx-cm-style')) {
|
|
4934
|
+
const st = doc.createElement('style'); st.id = 'pbx-cm-style';
|
|
4935
|
+
st.textContent = '.pbx-cm-mark{position:absolute;right:-64px;margin-top:-2px;display:inline-flex;align-items:center;gap:4px;padding:2px 8px;border-radius:999px;border:1px solid #f0c36d;background:#fff6db;color:#7a4b00;font:600 12px/1.6 system-ui,sans-serif;cursor:pointer}'
|
|
4936
|
+
+ '.pbx-cm-host{position:relative}.pbx-cm-row td{background:#fff6db!important}'
|
|
4937
|
+
+ '.pbx-cm-float{position:absolute;z-index:10;padding:6px 12px;border-radius:8px;border:0;background:#1f6feb;color:#fff;font:600 13px/1.4 system-ui,sans-serif;box-shadow:0 4px 14px rgba(0,0,0,.2);cursor:pointer}'
|
|
4938
|
+
+ '@media screen and (max-width:900px){.pbx-cm-mark{right:0;top:-22px}}';
|
|
4939
|
+
doc.head.appendChild(st);
|
|
4940
|
+
}
|
|
4941
|
+
for (const [code, n] of Object.entries(CM.counts)) {
|
|
4942
|
+
const hd = doc.getElementById(anchorOf(code)); if (!hd) continue;
|
|
4943
|
+
hd.classList.add('pbx-cm-host');
|
|
4944
|
+
const b = doc.createElement('button'); b.type = 'button'; b.className = 'pbx-cm-mark'; b.dataset.testid = 'word-cm-' + code;
|
|
4945
|
+
b.textContent = T('{n} b\xECnh lu\u1EADn', { n });
|
|
4946
|
+
b.addEventListener('click', (e) => { e.preventDefault(); openComments(code); });
|
|
4947
|
+
hd.appendChild(b);
|
|
4948
|
+
}
|
|
4949
|
+
for (const t of CM.threads) if (t.status === 'open' && t.row) { const tr = doc.getElementById(anchorOf(t.item + '_' + t.row)); if (tr) tr.classList.add('pbx-cm-row'); }
|
|
4950
|
+
if (frame.dataset.cmBound) return;
|
|
4951
|
+
frame.dataset.cmBound = '1';
|
|
4952
|
+
const byAnchor = new Map((C.D().items || []).map((it) => [anchorOf(it.ma), it.ma]));
|
|
4953
|
+
doc.addEventListener('mouseup', () => setTimeout(() => {
|
|
4954
|
+
doc.querySelectorAll('.pbx-cm-float').forEach((x) => x.remove());
|
|
4955
|
+
const sel = doc.getSelection(); const text = sel ? sel.toString().replace(/\\s+/g, ' ').trim() : '';
|
|
4956
|
+
if (!text || !sel.rangeCount) return;
|
|
4957
|
+
const range = sel.getRangeAt(0);
|
|
4958
|
+
// m\u1EE5c: ti\xEAu \u0111\u1EC1 c\xF3 id R_<m\xE3> g\u1EA7n nh\u1EA5t ph\xEDa tr\u01B0\u1EDBc; d\xF2ng: <tr id> ch\u1EE9a ch\u1ED7 ch\u1ECDn
|
|
4959
|
+
let code = null;
|
|
4960
|
+
for (const hd of doc.querySelectorAll('h1[id^="R_"],h2[id^="R_"],h3[id^="R_"],h4[id^="R_"],h5[id^="R_"],h6[id^="R_"]')) {
|
|
4961
|
+
if (!byAnchor.has(hd.id)) continue;
|
|
4962
|
+
if (hd.compareDocumentPosition(range.startContainer) & 4 /* FOLLOWING */ || hd.contains(range.startContainer)) code = byAnchor.get(hd.id); else break;
|
|
4963
|
+
}
|
|
4964
|
+
if (!code) return;
|
|
4965
|
+
const start = range.startContainer.nodeType === 1 ? range.startContainer : range.startContainer.parentElement;
|
|
4966
|
+
const tr = start && start.closest('tr[id^="R_"]');
|
|
4967
|
+
const pre = anchorOf(code) + '_';
|
|
4968
|
+
const row = tr && tr.id.startsWith(pre) ? tr.id.slice(pre.length) : undefined;
|
|
4969
|
+
const rect = range.getBoundingClientRect();
|
|
4970
|
+
const b = doc.createElement('button'); b.type = 'button'; b.className = 'pbx-cm-float'; b.dataset.testid = 'word-cm-add';
|
|
4971
|
+
b.textContent = T('B\xECnh lu\u1EADn');
|
|
4972
|
+
b.style.top = (rect.bottom + doc.defaultView.scrollY + 6) + 'px'; b.style.left = (rect.left + doc.defaultView.scrollX) + 'px';
|
|
4973
|
+
b.addEventListener('mousedown', (e) => e.preventDefault());
|
|
4974
|
+
b.addEventListener('click', (e) => { e.preventDefault(); b.remove(); openComments(code, { item: code, row, quote: text.slice(0, 300) }); });
|
|
4975
|
+
doc.body.appendChild(b);
|
|
4976
|
+
}, 0));
|
|
4977
|
+
}
|
|
4978
|
+
|
|
4979
|
+
// ================================================================ PH\xC1T H\xC0NH L\xCAN STUDIO
|
|
4980
|
+
// C\u1EA3 h\u1ED3 s\u01A1 ho\u1EB7c t\u1EEBng ph\xE2n h\u1EC7; ph\xE1t h\xE0nh l\u1EA1i = ghi \u0111\xE8 \u0111\xFAng t\xE0i li\u1EC7u (m\u1ED7i h\u1ED3 s\u01A1 m\u1ED9t th\u01B0 m\u1EE5c kho tr\xEAn Studio); g\u1EE1 = xo\xE1 c\u1EA3 th\u01B0 m\u1EE5c.
|
|
4981
|
+
const fmtBytes = (n) => (n >= 1048576 ? (n / 1048576).toFixed(1) + ' MB' : Math.max(1, Math.round(n / 1024)) + ' KB');
|
|
4982
|
+
export async function studioDialog() {
|
|
4983
|
+
const h = C.h;
|
|
4984
|
+
const body = h('div', { class: 'pb-stack pbx-st', 'data-testid': 'studio-body' }, C.P.skeleton(3));
|
|
4985
|
+
const dlg = C.P.dialog({ title: T('Ph\xE1t h\xE0nh l\xEAn Pan Studio'), size: 'lg', testid: 'studio-dialog', body, actions: [{ label: T('\u0110\xF3ng') }] });
|
|
4986
|
+
const load = async () => {
|
|
4987
|
+
const r = await api('api/studio?product=' + encodeURIComponent(C.PRODUCT));
|
|
4988
|
+
if (!r.ok) { body.replaceChildren(h('p', { class: 'pb-muted' }, r.json.error || T('Kh\xF4ng \u0111\u1ECDc \u0111\u01B0\u1EE3c tr\u1EA1ng th\xE1i Studio.'))); return; }
|
|
4989
|
+
render(r.json);
|
|
4990
|
+
};
|
|
4991
|
+
const render = (s) => {
|
|
4992
|
+
const head = h('div', { class: 'pbx-st-head' },
|
|
4993
|
+
h('p', { class: 'pb-small pb-muted', style: { margin: 0 } }, T('Ph\xE1t h\xE0nh l\u1EA1i l\xE0 GHI \u0110\xC8 \u0111\xFAng t\xE0i li\u1EC7u c\u0169 tr\xEAn Studio; m\u1ED7i h\u1ED3 s\u01A1 m\u1ED9t th\u01B0 m\u1EE5c kho ri\xEAng \u2014 g\u1EE1 l\xE0 xo\xE1 c\u1EA3 th\u01B0 m\u1EE5c. Ng\u01B0\u1EDDi xem \u0111\u1ECDc v\xE0 b\xECnh lu\u1EADn tr\xEAn studio.dev.pro.vn; b\xECnh lu\u1EADn \u0111\u1ED3ng b\u1ED9 v\u1EC1 \u0111\xE2y.')),
|
|
4994
|
+
h('div', { class: 'pb-row' },
|
|
4995
|
+
h('span', { class: 'pb-badge', 'data-tone': s.login ? 'ok' : 'warn', 'data-testid': 'studio-login' }, s.login ? T('\u0110\xE3 \u0111\u0103ng nh\u1EADp {u}', { u: String(s.apiUrl || '').replace(/^https?:\\/\\//, '') }) : T('Ch\u01B0a \u0111\u0103ng nh\u1EADp Pan Studio')),
|
|
4996
|
+
h('span', { class: 'pb-badge', 'data-tone': s.project ? 'info' : 'neutral', 'data-testid': 'studio-project' }, s.project ? T('G\u1EAFn d\u1EF1 \xE1n thi\u1EBFt k\u1EBF {p}', { p: String(s.project.id).slice(0, 8) }) : T('Ch\u01B0a g\u1EAFn d\u1EF1 \xE1n thi\u1EBFt k\u1EBF \u2014 t\xE0i li\u1EC7u r\u1EDDi'))));
|
|
4997
|
+
const parts = [head];
|
|
4998
|
+
if (!s.login) parts.push(h('p', { class: 'pb-small' }, T('\u0110\u0103ng nh\u1EADp tr\u01B0\u1EDBc: Pan Studio Desktop (g\xF3c tr\xEAn b\xEAn ph\u1EA3i) ho\u1EB7c \xABpan login\xBB. Kh\xF4ng g\u1EEDi g\xEC ra ngo\xE0i khi ch\u01B0a \u0111\u0103ng nh\u1EADp.')));
|
|
4999
|
+
if (s.error) parts.push(h('p', { class: 'pb-small pbx-overdue' }, s.error));
|
|
5000
|
+
if (!s.gate.ok) {
|
|
5001
|
+
const on = btn(T('B\u1EADt ph\xE1t h\xE0nh l\xEAn Studio cho d\u1EF1 \xE1n con n\xE0y'), { kind: 'secondary', icon: 'check', testid: 'studio-enable', onClick: () => {
|
|
5002
|
+
C.P.dialog({ title: T('B\u1EADt ph\xE1t h\xE0nh l\xEAn Studio?'), size: 'sm', testid: 'studio-enable-dialog',
|
|
5003
|
+
body: h('p', null, T('Ghi v\xE0o .panba.yaml (policy.studio: service v\xE0 studio c\u1EE7a d\u1EF1 \xE1n con) \u2014 \u0111\xE2y l\xE0 quy\u1EBFt \u0111\u1ECBnh c\u1EE7a BA Lead. Nh\u1EDB commit thay \u0111\u1ED5i n\xE0y.')),
|
|
5004
|
+
actions: [{ label: T('Hu\u1EF7') }, { label: T('B\u1EADt'), kind: 'primary', testid: 'studio-enable-ok', onClick: async () => { const r = await api('api/studio/enable', {}); if (!r.ok) failToast(r); else { C.P.toast(T('\u0110\xE3 b\u1EADt ph\xE1t h\xE0nh l\xEAn Studio.'), { kind: 'success' }); await load(); } } }] });
|
|
5005
|
+
} });
|
|
5006
|
+
parts.push(h('div', { class: 'pbx-aibanner', 'data-testid': 'studio-gate' }, h('span', null, s.gate.message), on));
|
|
5007
|
+
}
|
|
5008
|
+
for (const d of s.docs) parts.push(docCard(d, s));
|
|
5009
|
+
body.replaceChildren(...parts);
|
|
5010
|
+
};
|
|
5011
|
+
// K\u1EBFt qu\u1EA3 ph\xE1t h\xE0nh g\u1EA7n nh\u1EA5t theo h\u1ED3 s\u01A1: gi\u1EEF qua l\u1EA7n d\u1EF1ng l\u1EA1i th\u1EBB sau load() (tr\u01B0\u1EDBc \u0111\xE2y d\xF2ng \xAB\u0110\xE3 ph\xE1t h\xE0nh\u2026\xBB m\u1EA5t ngay khi t\u1EA3i l\u1EA1i tr\u1EA1ng th\xE1i).
|
|
5012
|
+
const results = new Map();
|
|
5013
|
+
const docCard = (d, s) => {
|
|
5014
|
+
const st = d.studio;
|
|
5015
|
+
const info = st
|
|
5016
|
+
? h('div', { class: 'pb-row pb-small', 'data-testid': 'studio-info-' + d.doc },
|
|
5017
|
+
h('span', { class: 'pb-badge', 'data-tone': 'ok' }, T('B\u1EA3n {r}', { r: st.revision })), h('span', null, T('{n} t\u1EC7p \xB7 {b}', { n: st.files, b: fmtBytes(st.bytes || 0) })),
|
|
5018
|
+
h('span', { class: 'pb-muted' }, T('c\u1EADp nh\u1EADt {w}', { w: C.P.fmt.date(st.updatedAt) }) + (st.syncedBy ? ' \xB7 ' + st.syncedBy : '')),
|
|
5019
|
+
st.openComments ? h('span', { class: 'pb-badge', 'data-tone': 'warn' }, T('{n} b\xECnh lu\u1EADn m\u1EDF', { n: st.openComments })) : null)
|
|
5020
|
+
: h('p', { class: 'pb-small pb-muted', 'data-testid': 'studio-info-' + d.doc }, T('Ch\u01B0a ph\xE1t h\xE0nh'));
|
|
5021
|
+
const scope = { all: true, modules: new Set() };
|
|
5022
|
+
const radios = h('div', { class: 'pb-seg', role: 'radiogroup', 'data-testid': 'studio-scope-' + d.doc });
|
|
5023
|
+
const modBox = h('div', { class: 'pbx-st-mods', hidden: true });
|
|
5024
|
+
const pdf = h('input', { type: 'checkbox', checked: true, 'data-testid': 'studio-pdf-' + d.doc });
|
|
5025
|
+
const pdfRow = h('label', { class: 'pb-row pb-small' }, pdf, T('K\xE8m b\u1EA3n PDF c\u1EE7a c\u1EA3 h\u1ED3 s\u01A1 (c\u1EA7n Chrome/Edge tr\xEAn m\xE1y)'));
|
|
5026
|
+
const setAll = (v) => {
|
|
5027
|
+
scope.all = v; modBox.hidden = v; pdfRow.hidden = !v;
|
|
5028
|
+
radios.querySelectorAll('button').forEach((b) => b.setAttribute('aria-checked', String((b.dataset.v === 'all') === v)));
|
|
5029
|
+
};
|
|
5030
|
+
for (const [v, l] of [['all', T('C\u1EA3 h\u1ED3 s\u01A1')], ['mods', T('Ch\u1ECDn ph\xE2n h\u1EC7')]]) {
|
|
5031
|
+
const b = h('button', { type: 'button', role: 'radio', 'aria-checked': String(v === 'all'), 'data-v': v, 'data-testid': 'studio-scope-' + d.doc + '-' + v }, l);
|
|
5032
|
+
b.addEventListener('click', () => setAll(v === 'all'));
|
|
5033
|
+
radios.appendChild(b);
|
|
5034
|
+
}
|
|
5035
|
+
for (const m of d.modules) {
|
|
5036
|
+
const cb = h('input', { type: 'checkbox', 'data-testid': 'studio-mod-' + d.doc + '-' + m.code });
|
|
5037
|
+
cb.addEventListener('change', () => { if (cb.checked) scope.modules.add(m.code); else scope.modules.delete(m.code); });
|
|
5038
|
+
modBox.appendChild(h('label', { class: 'pb-row pb-small' }, cb, h('span', { class: 'pb-code' }, m.code), m.name));
|
|
5039
|
+
}
|
|
5040
|
+
const result = results.get(d.doc) || h('div', { class: 'pb-small', 'data-testid': 'studio-result-' + d.doc });
|
|
5041
|
+
results.set(d.doc, result);
|
|
5042
|
+
const go = btn(T('Ph\xE1t h\xE0nh'), { kind: 'primary', icon: 'upload', testid: 'studio-publish-' + d.doc, disabled: !s.login || !s.gate.ok, onClick: async (_e, b) => {
|
|
5043
|
+
const modules = scope.all ? [] : [...scope.modules];
|
|
5044
|
+
if (!scope.all && !modules.length) { C.P.toast(T('Ch\u1ECDn \xEDt nh\u1EA5t m\u1ED9t ph\xE2n h\u1EC7.'), { kind: 'warn' }); return; }
|
|
5045
|
+
b.disabled = true;
|
|
5046
|
+
result.replaceChildren(h('span', { class: 'pb-muted' }, T('\u0110ang ph\xE1t h\xE0nh\u2026 (l\u1EA7n \u0111\u1EA7u t\u1EA3i l\xEAn h\u1EBFt; c\xE1c l\u1EA7n sau ch\u1EC9 t\u1EA3i t\u1EC7p \u0111\u1ED5i)')));
|
|
5047
|
+
const r = await api('api/studio/publish', { doc: d.doc, modules, pdf: scope.all && pdf.checked });
|
|
5048
|
+
b.disabled = false;
|
|
5049
|
+
if (!r.ok) { result.replaceChildren(h('span', { class: 'pbx-overdue' }, r.json.error || T('Kh\xF4ng ph\xE1t h\xE0nh \u0111\u01B0\u1EE3c.'))); return; }
|
|
5050
|
+
const x = r.json.result;
|
|
5051
|
+
result.replaceChildren(h('span', null, T('\u0110\xE3 ph\xE1t h\xE0nh b\u1EA3n {r}: t\u1EA3i l\xEAn {u} t\u1EC7p, gi\u1EEF {k} t\u1EC7p kh\xF4ng \u0111\u1ED5i.', { r: x.revision, u: x.uploaded, k: x.unchanged }) + (Array.isArray(x.scope) ? ' ' + T('Ph\xE2n h\u1EC7 {m}; gi\u1EEF {n} b\xE0i c\u1EE7a ph\xE2n h\u1EC7 kh\xE1c nh\u01B0 tr\xEAn Studio.', { m: x.scope.join(', '), n: x.kept }) : '')), ' ',
|
|
5052
|
+
h('a', { href: r.json.web, target: '_blank', rel: 'noopener', 'data-testid': 'studio-open-' + d.doc }, T('M\u1EDF tr\xEAn Studio')));
|
|
5053
|
+
C.P.toast(T('\u0110\xE3 ph\xE1t h\xE0nh {d} l\xEAn Studio.', { d: d.doc }), { kind: 'success' });
|
|
5054
|
+
await loadComments().catch(() => {}); renderComments();
|
|
5055
|
+
await load();
|
|
5056
|
+
} });
|
|
5057
|
+
const remove = st ? btn(T('G\u1EE1 kh\u1ECFi Studio'), { kind: 'ghost', icon: 'trash', testid: 'studio-remove-' + d.doc, onClick: () => {
|
|
5058
|
+
C.P.dialog({ title: T('G\u1EE1 {d} kh\u1ECFi Studio?', { d: d.doc }), size: 'sm', testid: 'studio-remove-dialog',
|
|
5059
|
+
body: h('p', null, T('Xo\xE1 t\xE0i li\u1EC7u tr\xEAn Studio c\xF9ng c\u1EA3 th\u01B0 m\u1EE5c kho c\u1EE7a n\xF3. B\xECnh lu\u1EADn tr\xEAn Studio m\u1EA5t theo \u2014 \u0111\u1ED3ng b\u1ED9 b\xECnh lu\u1EADn v\u1EC1 repo tr\u01B0\u1EDBc n\u1EBFu c\u1EA7n. Repo kh\xF4ng \u0111\u1ED5i.')),
|
|
5060
|
+
actions: [{ label: T('Hu\u1EF7') }, { label: T('G\u1EE1'), kind: 'danger', testid: 'studio-remove-ok', onClick: async () => { const r = await api('api/studio/remove', { doc: d.doc }); if (!r.ok) failToast(r); else { C.P.toast(T('\u0110\xE3 g\u1EE1 {d} ({n} t\u1EC7p).', { d: d.doc, n: r.json.result.objects }), { kind: 'success' }); await load(); } } }] });
|
|
5061
|
+
} }) : null;
|
|
5062
|
+
const open = d.web ? h('a', { class: 'pb-btn pb-btn--ghost', href: d.web, target: '_blank', rel: 'noopener', 'data-testid': 'studio-web-' + d.doc }, T('M\u1EDF tr\xEAn Studio')) : null;
|
|
5063
|
+
return h('section', { class: 'pb-card pbx-item', 'data-testid': 'studio-doc-' + d.doc },
|
|
5064
|
+
h('div', { class: 'pbx-item__head' }, h('span', { class: 'pb-code' }, d.doc), h('b', null, d.title), h('span', { class: 'pbx-grow' }), open, remove),
|
|
5065
|
+
info, h('div', { class: 'pb-row' }, radios), modBox, pdfRow, h('div', { class: 'pb-row' }, go), result);
|
|
5066
|
+
};
|
|
5067
|
+
await load();
|
|
5068
|
+
return dlg;
|
|
5069
|
+
}
|
|
5070
|
+
|
|
5071
|
+
// ================================================================ NH\u1EACP T\xC0I LI\u1EC6U WORD C\u0168 (kh\xF4ng c\u1EA7n d\xF2ng l\u1EC7nh)
|
|
5072
|
+
function fileB64(f) { return new Promise((ok, no) => { const r = new FileReader(); r.onload = () => ok(String(r.result).split(',')[1] || ''); r.onerror = () => no(r.error); r.readAsDataURL(f); }); }
|
|
5073
|
+
export function importDialog() {
|
|
5074
|
+
const h = C.h; const D = C.D();
|
|
5075
|
+
const file = h('input', { type: 'file', accept: '.docx', 'data-testid': 'imp-file' });
|
|
5076
|
+
const mods = (D.modules || []).filter((m) => m.ma !== 'CHUNG');
|
|
5077
|
+
const modSel = h('select', { class: 'pb-select', 'data-testid': 'imp-module' }, [h('option', { value: '' }, T('\u2014 Ch\u1ECDn ph\xE2n h\u1EC7 \u2014'))].concat(mods.map((m) => h('option', { value: m.ma, selected: m.ma === C.ST.mod || null }, m.ma + ' \xB7 ' + m.ten)), [h('option', { value: '__new' }, T('Ph\xE2n h\u1EC7 m\u1EDBi\u2026'))]));
|
|
5078
|
+
const newCode = h('input', { class: 'pb-input', placeholder: T('M\xE3 ph\xE2n h\u1EC7 (ch\u1EEF hoa, vd QLTS)'), 'data-testid': 'imp-new-code' });
|
|
5079
|
+
const newName = h('input', { class: 'pb-input', placeholder: T('T\xEAn ph\xE2n h\u1EC7'), 'data-testid': 'imp-new-name' });
|
|
5080
|
+
const newBox = h('div', { class: 'pb-row', hidden: true }, newCode, newName);
|
|
5081
|
+
modSel.addEventListener('change', () => { newBox.hidden = modSel.value !== '__new'; });
|
|
5082
|
+
const docSel = h('select', { class: 'pb-select', 'data-testid': 'imp-doc' }, [h('option', { value: '' }, T('Kh\xF4ng g\u1EAFn h\u1ED3 s\u01A1'))].concat((D.docs || []).map((d) => h('option', { value: d.ma, selected: d.ma === C.ST.doc || null }, d.ma))));
|
|
5083
|
+
const out = h('div', { class: 'pb-stack', 'data-testid': 'imp-report' });
|
|
5084
|
+
let last = null;
|
|
5085
|
+
const body = h('div', { class: 'pb-stack' },
|
|
5086
|
+
h('p', { class: 'pb-small pb-muted', style: { margin: 0 } }, T('\u0110\u1ECDc t\u1EC7p .docx (Word c\u0169 th\xEC L\u01B0u th\xE0nh .docx tr\u01B0\u1EDBc): nh\u1EADn d\u1EA1ng m\xE0n, ch\u1EE9c n\u0103ng, quy tr\xECnh, danh m\u1EE5c theo khu\xF4n; c\u1EA5p m\xE3 m\u1EDBi; \u0111\u1ED5i \xABm\u1EE5c x.y.z\xBB th\xE0nh [[M\xC3]]; comment Word th\xE0nh m\u1EE5c ch\u1EDD. M\u1ECDi m\u1EE5c \u1EDF tr\u1EA1ng th\xE1i \xABNh\u1EADp t\u1EEB Word\xBB \u0111\u1EC3 BA r\xE0 t\u1EEBng m\u1EE5c.')),
|
|
5087
|
+
h('label', { class: 'pb-field' }, h('span', { class: 'pb-label' }, T('T\u1EC7p Word')), file),
|
|
5088
|
+
h('label', { class: 'pb-field' }, h('span', { class: 'pb-label' }, T('V\xE0o ph\xE2n h\u1EC7')), modSel), newBox,
|
|
5089
|
+
h('label', { class: 'pb-field' }, h('span', { class: 'pb-label' }, T('G\u1EAFn v\xE0o h\u1ED3 s\u01A1 (\u0111\u1EC3 s\u1ED1 m\u1EE5c c\u0169 tra \u0111\u01B0\u1EE3c)')), docSel), out);
|
|
5090
|
+
const payload = async (dryRun) => {
|
|
5091
|
+
const f = file.files && file.files[0];
|
|
5092
|
+
if (!f) { C.P.toast(T('Ch\u1ECDn t\u1EC7p .docx.'), { kind: 'warn' }); return null; }
|
|
5093
|
+
const isNew = modSel.value === '__new';
|
|
5094
|
+
const module = isNew ? newCode.value.trim().toUpperCase() : modSel.value;
|
|
5095
|
+
if (!module) { C.P.toast(T('Ch\u1ECDn ph\xE2n h\u1EC7.'), { kind: 'warn' }); return null; }
|
|
5096
|
+
return { name: f.name, data: await fileB64(f), module, moduleName: isNew ? newName.value.trim() : undefined, doc: docSel.value || undefined, dryRun };
|
|
5097
|
+
};
|
|
5098
|
+
const show = (r) => {
|
|
5099
|
+
const x = r.report;
|
|
5100
|
+
const items = Object.entries(x.items || {}).map(([k, n]) => n + ' ' + k).join(', ') || '0';
|
|
5101
|
+
out.replaceChildren(
|
|
5102
|
+
h('div', { class: 'pbx-aibanner' }, h('span', null, (r.dryRun ? T('Xem tr\u01B0\u1EDBc: ') : T('\u0110\xE3 nh\u1EADp: ')) + T('{i} m\u1EE5c; tham chi\u1EBFu kh\u1EDBp {ok}, kh\xF4ng kh\u1EDBp {bad}; {c} comment \u2192 m\u1EE5c ch\u1EDD.', { i: items, ok: x.refs.matched, bad: x.refs.unmatched.length, c: x.comments || 0 }))),
|
|
5103
|
+
x.refs.unmatched.length ? h('div', { class: 'pb-small pb-muted' }, T('Kh\xF4ng kh\u1EDBp (r\xE0 \u1EDF Ki\u1EC3m tra W03): ') + x.refs.unmatched.slice(0, 8).join('; ')) : null,
|
|
5104
|
+
x.skipped && x.skipped.length ? h('div', { class: 'pb-small pb-muted' }, T('B\u1ECF qua: ') + x.skipped.slice(0, 6).join('; ')) : null,
|
|
5105
|
+
x.unscoped ? h('div', { class: 'pb-small pbx-overdue' }, T('Ph\xE2n h\u1EC7 ch\u01B0a thu\u1ED9c h\u1ED3 s\u01A1 n\xE0o \u2014 ch\u1ECDn h\u1ED3 s\u01A1 \u0111\u1EC3 m\u1EE5c c\xF3 s\u1ED1.')) : null);
|
|
5106
|
+
};
|
|
5107
|
+
C.P.dialog({ title: T('Nh\u1EADp t\xE0i li\u1EC7u Word c\u0169'), size: 'md', testid: 'import-dialog', body, actions: [
|
|
5108
|
+
{ label: T('\u0110\xF3ng') },
|
|
5109
|
+
{ label: T('Xem tr\u01B0\u1EDBc'), testid: 'imp-preview', close: false, onClick: async () => { const p = await payload(true); if (!p) return false; const r = await api('api/import', p); if (!r.ok) { failToast(r); return false; } last = p; show(r.json); return false; } },
|
|
5110
|
+
{ label: T('Nh\u1EADp'), kind: 'primary', testid: 'imp-run', close: false, onClick: async (_e, d) => {
|
|
5111
|
+
const p = await payload(false); if (!p) return false;
|
|
5112
|
+
if (!last) { const pre = await api('api/import', Object.assign({}, p, { dryRun: true })); if (!pre.ok) { failToast(pre); return false; } show(pre.json); last = p; return false; }
|
|
5113
|
+
const r = await api('api/import', p);
|
|
5114
|
+
if (!r.ok) { failToast(r); return false; }
|
|
5115
|
+
show(r.json); C.P.toast(T('\u0110\xE3 nh\u1EADp {n} t\u1EC7p \u2014 r\xE0 t\u1EEBng m\u1EE5c r\u1ED3i commit \u1EDF thanh git.', { n: r.json.files.length }), { kind: 'success' });
|
|
5116
|
+
await C.reload(); d.close(); return false;
|
|
5117
|
+
} },
|
|
5118
|
+
] });
|
|
5119
|
+
}
|
|
5120
|
+
`,"edit.js":`// Pan Test \u2014 \`api\` cho khung Tr\u1EE3 l\xFD ch\xE9p t\u1EEB Pan BA (assist.js import { api } from './edit.js'): token phi\xEAn c\u1EE7a Pan Test.
|
|
5121
|
+
const TOKEN = (document.querySelector('meta[name="pantest-token"]') || {}).content || '';
|
|
5122
|
+
export async function api(path, body) {
|
|
5123
|
+
const res = await fetch(path, body === undefined ? { headers: { accept: 'application/json' } }
|
|
5124
|
+
: { method: 'POST', headers: { 'content-type': 'application/json', 'x-pan-test-token': TOKEN }, body: JSON.stringify(body) });
|
|
5125
|
+
let json = {};
|
|
5126
|
+
try { json = await res.json(); } catch { /* kh\xF4ng ph\u1EA3i JSON */ }
|
|
5127
|
+
return { status: res.status, ok: res.ok && json.ok !== false, json };
|
|
5128
|
+
}
|
|
5129
|
+
`}});function dn(e,t={}){Hc&&!t.pin||(Uc=e==="en"?"en":"vi",t.pin&&(Hc=!0))}var Uc,Hc,j,Dn=Ae(()=>{"use strict";S();Uc="vi",Hc=!1;j=(e,t)=>Uc==="en"?t:e});var Je,jc,Wc,pn,Qr=Ae(()=>{"use strict";S();Je=["not-run","passed","failed","blocked","skipped"],jc=["functional","non-functional"],Wc=["drafting","done","deleted"],pn=["high","medium","low"]});function eb(){let e=globalThis.crypto;return e?.getRandomValues?e.getRandomValues(new Uint32Array(1))[0]/2**32:Math.random()}function un(e,t,n,r=eb){for(;;){let i="";for(let a=0;a<6;a++)i+=Kc[Math.floor(r()*Kc.length)];if(!/[A-Z]/.test(i))continue;let s=`${e}-${t}-${i}`;if(!n.has(s))return s}}var Kc,Zr,ei,ti,hn=Ae(()=>{"use strict";S();Kc="ABCDEFGHJKMNPQRSTUVWXYZ23456789",Zr=/^[A-Z][A-Z0-9]{1,11}$/,ei=/^KB-([A-Z][A-Z0-9]{1,11})-([A-Z0-9]{6})$/,ti=/^TC-([A-Z][A-Z0-9]{1,11})-([A-Z0-9]{6})$/});var V=B(xe=>{"use strict";S();var la=Symbol.for("yaml.alias"),Gc=Symbol.for("yaml.document"),ni=Symbol.for("yaml.map"),zc=Symbol.for("yaml.pair"),ca=Symbol.for("yaml.scalar"),ri=Symbol.for("yaml.seq"),pt=Symbol.for("yaml.node.type"),tb=e=>!!e&&typeof e=="object"&&e[pt]===la,nb=e=>!!e&&typeof e=="object"&&e[pt]===Gc,rb=e=>!!e&&typeof e=="object"&&e[pt]===ni,ib=e=>!!e&&typeof e=="object"&&e[pt]===zc,Vc=e=>!!e&&typeof e=="object"&&e[pt]===ca,sb=e=>!!e&&typeof e=="object"&&e[pt]===ri;function Xc(e){if(e&&typeof e=="object")switch(e[pt]){case ni:case ri:return!0}return!1}function ab(e){if(e&&typeof e=="object")switch(e[pt]){case la:case ni:case ca:case ri:return!0}return!1}var ob=e=>(Vc(e)||Xc(e))&&!!e.anchor;xe.ALIAS=la;xe.DOC=Gc;xe.MAP=ni;xe.NODE_TYPE=pt;xe.PAIR=zc;xe.SCALAR=ca;xe.SEQ=ri;xe.hasAnchor=ob;xe.isAlias=tb;xe.isCollection=Xc;xe.isDocument=nb;xe.isMap=rb;xe.isNode=ab;xe.isPair=ib;xe.isScalar=Vc;xe.isSeq=sb});var Bn=B(da=>{"use strict";S();var he=V(),Ne=Symbol("break visit"),Yc=Symbol("skip children"),Qe=Symbol("remove node");function ii(e,t){let n=Jc(t);he.isDocument(e)?mn(null,e.contents,n,Object.freeze([e]))===Qe&&(e.contents=null):mn(null,e,n,Object.freeze([]))}ii.BREAK=Ne;ii.SKIP=Yc;ii.REMOVE=Qe;function mn(e,t,n,r){let i=Qc(e,t,n,r);if(he.isNode(i)||he.isPair(i))return Zc(e,r,i),mn(e,i,n,r);if(typeof i!="symbol"){if(he.isCollection(t)){r=Object.freeze(r.concat(t));for(let s=0;s<t.items.length;++s){let a=mn(s,t.items[s],n,r);if(typeof a=="number")s=a-1;else{if(a===Ne)return Ne;a===Qe&&(t.items.splice(s,1),s-=1)}}}else if(he.isPair(t)){r=Object.freeze(r.concat(t));let s=mn("key",t.key,n,r);if(s===Ne)return Ne;s===Qe&&(t.key=null);let a=mn("value",t.value,n,r);if(a===Ne)return Ne;a===Qe&&(t.value=null)}}return i}async function si(e,t){let n=Jc(t);he.isDocument(e)?await fn(null,e.contents,n,Object.freeze([e]))===Qe&&(e.contents=null):await fn(null,e,n,Object.freeze([]))}si.BREAK=Ne;si.SKIP=Yc;si.REMOVE=Qe;async function fn(e,t,n,r){let i=await Qc(e,t,n,r);if(he.isNode(i)||he.isPair(i))return Zc(e,r,i),fn(e,i,n,r);if(typeof i!="symbol"){if(he.isCollection(t)){r=Object.freeze(r.concat(t));for(let s=0;s<t.items.length;++s){let a=await fn(s,t.items[s],n,r);if(typeof a=="number")s=a-1;else{if(a===Ne)return Ne;a===Qe&&(t.items.splice(s,1),s-=1)}}}else if(he.isPair(t)){r=Object.freeze(r.concat(t));let s=await fn("key",t.key,n,r);if(s===Ne)return Ne;s===Qe&&(t.key=null);let a=await fn("value",t.value,n,r);if(a===Ne)return Ne;a===Qe&&(t.value=null)}}return i}function Jc(e){return typeof e=="object"&&(e.Collection||e.Node||e.Value)?Object.assign({Alias:e.Node,Map:e.Node,Scalar:e.Node,Seq:e.Node},e.Value&&{Map:e.Value,Scalar:e.Value,Seq:e.Value},e.Collection&&{Map:e.Collection,Seq:e.Collection},e):e}function Qc(e,t,n,r){if(typeof n=="function")return n(e,t,r);if(he.isMap(t))return n.Map?.(e,t,r);if(he.isSeq(t))return n.Seq?.(e,t,r);if(he.isPair(t))return n.Pair?.(e,t,r);if(he.isScalar(t))return n.Scalar?.(e,t,r);if(he.isAlias(t))return n.Alias?.(e,t,r)}function Zc(e,t,n){let r=t[t.length-1];if(he.isCollection(r))r.items[e]=n;else if(he.isPair(r))e==="key"?r.key=n:r.value=n;else if(he.isDocument(r))r.contents=n;else{let i=he.isAlias(r)?"alias":"scalar";throw new Error(`Cannot replace node with ${i} parent`)}}da.visit=ii;da.visitAsync=si});var pa=B(td=>{"use strict";S();var ed=V(),lb=Bn(),cb={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},db=e=>e.replace(/[!,[\]{}]/g,t=>cb[t]),$n=class e{constructor(t,n){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},e.defaultYaml,t),this.tags=Object.assign({},e.defaultTags,n)}clone(){let t=new e(this.yaml,this.tags);return t.docStart=this.docStart,t}atDocument(){let t=new e(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:e.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},e.defaultTags);break}return t}add(t,n){this.atNextDocument&&(this.yaml={explicit:e.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},e.defaultTags),this.atNextDocument=!1);let r=t.trim().split(/[ \t]+/),i=r.shift();switch(i){case"%TAG":{if(r.length!==2&&(n(0,"%TAG directive should contain exactly two parts"),r.length<2))return!1;let[s,a]=r;return this.tags[s]=a,!0}case"%YAML":{if(this.yaml.explicit=!0,r.length!==1)return n(0,"%YAML directive should contain exactly one part"),!1;let[s]=r;if(s==="1.1"||s==="1.2")return this.yaml.version=s,!0;{let a=/^\d+\.\d+$/.test(s);return n(6,`Unsupported YAML version ${s}`,a),!1}}default:return n(0,`Unknown directive ${i}`,!0),!1}}tagName(t,n){if(t==="!")return"!";if(t[0]!=="!")return n(`Not a valid tag: ${t}`),null;if(t[1]==="<"){let a=t.slice(2,-1);return a==="!"||a==="!!"?(n(`Verbatim tags aren't resolved, so ${t} is invalid.`),null):(t[t.length-1]!==">"&&n("Verbatim tags must end with a >"),a)}let[,r,i]=t.match(/^(.*!)([^!]*)$/s);i||n(`The ${t} tag has no suffix`);let s=this.tags[r];if(s)try{return s+decodeURIComponent(i)}catch(a){return n(String(a)),null}return r==="!"?t:(n(`Could not resolve tag: ${t}`),null)}tagString(t){for(let[n,r]of Object.entries(this.tags))if(t.startsWith(r))return n+db(t.substring(r.length));return t[0]==="!"?t:`!<${t}>`}toString(t){let n=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],r=Object.entries(this.tags),i;if(t&&r.length>0&&ed.isNode(t.contents)){let s={};lb.visit(t.contents,(a,o)=>{ed.isNode(o)&&o.tag&&(s[o.tag]=!0)}),i=Object.keys(s)}else i=[];for(let[s,a]of r)s==="!!"&&a==="tag:yaml.org,2002:"||(!t||i.some(o=>o.startsWith(a)))&&n.push(`%TAG ${s} ${a}`);return n.join(`
|
|
5130
|
+
`)}};$n.defaultYaml={explicit:!1,version:"1.2"};$n.defaultTags={"!!":"tag:yaml.org,2002:"};td.Directives=$n});var ai=B(Fn=>{"use strict";S();var nd=V(),pb=Bn();function ub(e){if(/[\x00-\x19\s,[\]{}]/.test(e)){let n=`Anchor must not contain whitespace or control characters: ${JSON.stringify(e)}`;throw new Error(n)}return!0}function rd(e){let t=new Set;return pb.visit(e,{Value(n,r){r.anchor&&t.add(r.anchor)}}),t}function id(e,t){for(let n=1;;++n){let r=`${e}${n}`;if(!t.has(r))return r}}function hb(e,t){let n=[],r=new Map,i=null;return{onAnchor:s=>{n.push(s),i??(i=rd(e));let a=id(t,i);return i.add(a),a},setAnchors:()=>{for(let s of n){let a=r.get(s);if(typeof a=="object"&&a.anchor&&(nd.isScalar(a.node)||nd.isCollection(a.node)))a.node.anchor=a.anchor;else{let o=new Error("Failed to resolve repeated object (this should not happen)");throw o.source=s,o}}},sourceObjects:r}}Fn.anchorIsValid=ub;Fn.anchorNames=rd;Fn.createNodeAnchors=hb;Fn.findNewAnchor=id});var ua=B(sd=>{"use strict";S();function qn(e,t,n,r){if(r&&typeof r=="object")if(Array.isArray(r))for(let i=0,s=r.length;i<s;++i){let a=r[i],o=qn(e,r,String(i),a);o===void 0?delete r[i]:o!==a&&(r[i]=o)}else if(r instanceof Map)for(let i of Array.from(r.keys())){let s=r.get(i),a=qn(e,r,i,s);a===void 0?r.delete(i):a!==s&&r.set(i,a)}else if(r instanceof Set)for(let i of Array.from(r)){let s=qn(e,r,i,i);s===void 0?r.delete(i):s!==i&&(r.delete(i),r.add(s))}else for(let[i,s]of Object.entries(r)){let a=qn(e,r,i,s);a===void 0?delete r[i]:a!==s&&(r[i]=a)}return e.call(t,n,r)}sd.applyReviver=qn});var At=B(od=>{"use strict";S();var mb=V();function ad(e,t,n){if(Array.isArray(e))return e.map((r,i)=>ad(r,String(i),n));if(e&&typeof e.toJSON=="function"){if(!n||!mb.hasAnchor(e))return e.toJSON(t,n);let r={aliasCount:0,count:1,res:void 0};n.anchors.set(e,r),n.onCreate=s=>{r.res=s,delete n.onCreate};let i=e.toJSON(t,n);return n.onCreate&&n.onCreate(i),i}return typeof e=="bigint"&&!n?.keep?Number(e):e}od.toJS=ad});var oi=B(cd=>{"use strict";S();var fb=ua(),ld=V(),gb=At(),ha=class{constructor(t){Object.defineProperty(this,ld.NODE_TYPE,{value:t})}clone(){let t=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(t.range=this.range.slice()),t}toJS(t,{mapAsMap:n,maxAliasCount:r,onAnchor:i,reviver:s}={}){if(!ld.isDocument(t))throw new TypeError("A document argument is required");let a={anchors:new Map,doc:t,keep:!0,mapAsMap:n===!0,mapKeyWarned:!1,maxAliasCount:typeof r=="number"?r:100},o=gb.toJS(this,"",a);if(typeof i=="function")for(let{count:c,res:l}of a.anchors.values())i(l,c);return typeof s=="function"?fb.applyReviver(s,{"":o},"",o):o}};cd.NodeBase=ha});var Hn=B(dd=>{"use strict";S();var bb=ai(),vb=Bn(),gn=V(),wb=oi(),yb=At(),ma=class extends wb.NodeBase{constructor(t){super(gn.ALIAS),this.source=t,Object.defineProperty(this,"tag",{set(){throw new Error("Alias nodes cannot have tags")}})}resolve(t,n){if(n?.maxAliasCount===0)throw new ReferenceError("Alias resolution is disabled");let r;n?.aliasResolveCache?r=n.aliasResolveCache:(r=[],vb.visit(t,{Node:(s,a)=>{(gn.isAlias(a)||gn.hasAnchor(a))&&r.push(a)}}),n&&(n.aliasResolveCache=r));let i;for(let s of r){if(s===this)break;s.anchor===this.source&&(i=s)}return i}toJSON(t,n){if(!n)return{source:this.source};let{anchors:r,doc:i,maxAliasCount:s}=n,a=this.resolve(i,n);if(!a){let c=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new ReferenceError(c)}let o=r.get(a);if(o||(yb.toJS(a,null,n),o=r.get(a)),o?.res===void 0){let c="This should not happen: Alias anchor was not resolved?";throw new ReferenceError(c)}if(s>=0&&(o.count+=1,o.aliasCount===0&&(o.aliasCount=li(i,a,r)),o.count*o.aliasCount>s)){let c="Excessive alias count indicates a resource exhaustion attack";throw new ReferenceError(c)}return o.res}toString(t,n,r){let i=`*${this.source}`;if(t){if(bb.anchorIsValid(this.source),t.options.verifyAliasOrder&&!t.anchors.has(this.source)){let s=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new Error(s)}if(t.implicitKey)return`${i} `}return i}};function li(e,t,n){if(gn.isAlias(t)){let r=t.resolve(e),i=n&&r&&n.get(r);return i?i.count*i.aliasCount:0}else if(gn.isCollection(t)){let r=0;for(let i of t.items){let s=li(e,i,n);s>r&&(r=s)}return r}else if(gn.isPair(t)){let r=li(e,t.key,n),i=li(e,t.value,n);return Math.max(r,i)}return 1}dd.Alias=ma});var de=B(fa=>{"use strict";S();var xb=V(),kb=oi(),Tb=At(),Sb=e=>!e||typeof e!="function"&&typeof e!="object",_t=class extends kb.NodeBase{constructor(t){super(xb.SCALAR),this.value=t}toJSON(t,n){return n?.keep?this.value:Tb.toJS(this.value,t,n)}toString(){return String(this.value)}};_t.BLOCK_FOLDED="BLOCK_FOLDED";_t.BLOCK_LITERAL="BLOCK_LITERAL";_t.PLAIN="PLAIN";_t.QUOTE_DOUBLE="QUOTE_DOUBLE";_t.QUOTE_SINGLE="QUOTE_SINGLE";fa.Scalar=_t;fa.isScalarValue=Sb});var Un=B(ud=>{"use strict";S();var Cb=Hn(),Wt=V(),pd=de(),Eb="tag:yaml.org,2002:";function Ab(e,t,n){if(t){let r=n.filter(s=>s.tag===t),i=r.find(s=>!s.format)??r[0];if(!i)throw new Error(`Tag ${t} not found`);return i}return n.find(r=>r.identify?.(e)&&!r.format)}function _b(e,t,n){if(Wt.isDocument(e)&&(e=e.contents),Wt.isNode(e))return e;if(Wt.isPair(e)){let d=n.schema[Wt.MAP].createNode?.(n.schema,null,n);return d.items.push(e),d}(e instanceof String||e instanceof Number||e instanceof Boolean||typeof BigInt<"u"&&e instanceof BigInt)&&(e=e.valueOf());let{aliasDuplicateObjects:r,onAnchor:i,onTagObj:s,schema:a,sourceObjects:o}=n,c;if(r&&e&&typeof e=="object"){if(c=o.get(e),c)return c.anchor??(c.anchor=i(e)),new Cb.Alias(c.anchor);c={anchor:null,node:null},o.set(e,c)}t?.startsWith("!!")&&(t=Eb+t.slice(2));let l=Ab(e,t,a.tags);if(!l){if(e&&typeof e.toJSON=="function"&&(e=e.toJSON()),!e||typeof e!="object"){let d=new pd.Scalar(e);return c&&(c.node=d),d}l=e instanceof Map?a[Wt.MAP]:Symbol.iterator in Object(e)?a[Wt.SEQ]:a[Wt.MAP]}s&&(s(l),delete n.onTagObj);let u=l?.createNode?l.createNode(n.schema,e,n):typeof l?.nodeClass?.from=="function"?l.nodeClass.from(n.schema,e,n):new pd.Scalar(e);return t?u.tag=t:l.default||(u.tag=l.tag),c&&(c.node=u),u}ud.createNode=_b});var di=B(ci=>{"use strict";S();var Nb=Un(),Ze=V(),Ib=oi();function ga(e,t,n){let r=n;for(let i=t.length-1;i>=0;--i){let s=t[i];if(typeof s=="number"&&Number.isInteger(s)&&s>=0){let a=[];a[s]=r,r=a}else r=new Map([[s,r]])}return Nb.createNode(r,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw new Error("This should not happen, please report a bug.")},schema:e,sourceObjects:new Map})}var hd=e=>e==null||typeof e=="object"&&!!e[Symbol.iterator]().next().done,ba=class extends Ib.NodeBase{constructor(t,n){super(t),Object.defineProperty(this,"schema",{value:n,configurable:!0,enumerable:!1,writable:!0})}clone(t){let n=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return t&&(n.schema=t),n.items=n.items.map(r=>Ze.isNode(r)||Ze.isPair(r)?r.clone(t):r),this.range&&(n.range=this.range.slice()),n}addIn(t,n){if(hd(t))this.add(n);else{let[r,...i]=t,s=this.get(r,!0);if(Ze.isCollection(s))s.addIn(i,n);else if(s===void 0&&this.schema)this.set(r,ga(this.schema,i,n));else throw new Error(`Expected YAML collection at ${r}. Remaining path: ${i}`)}}deleteIn(t){let[n,...r]=t;if(r.length===0)return this.delete(n);let i=this.get(n,!0);if(Ze.isCollection(i))return i.deleteIn(r);throw new Error(`Expected YAML collection at ${n}. Remaining path: ${r}`)}getIn(t,n){let[r,...i]=t,s=this.get(r,!0);return i.length===0?!n&&Ze.isScalar(s)?s.value:s:Ze.isCollection(s)?s.getIn(i,n):void 0}hasAllNullValues(t){return this.items.every(n=>{if(!Ze.isPair(n))return!1;let r=n.value;return r==null||t&&Ze.isScalar(r)&&r.value==null&&!r.commentBefore&&!r.comment&&!r.tag})}hasIn(t){let[n,...r]=t;if(r.length===0)return this.has(n);let i=this.get(n,!0);return Ze.isCollection(i)?i.hasIn(r):!1}setIn(t,n){let[r,...i]=t;if(i.length===0)this.set(r,n);else{let s=this.get(r,!0);if(Ze.isCollection(s))s.setIn(i,n);else if(s===void 0&&this.schema)this.set(r,ga(this.schema,i,n));else throw new Error(`Expected YAML collection at ${r}. Remaining path: ${i}`)}}};ci.Collection=ba;ci.collectionFromPath=ga;ci.isEmptyPath=hd});var jn=B(pi=>{"use strict";S();var Pb=e=>e.replace(/^(?!$)(?: $)?/gm,"#");function va(e,t){return/^\n+$/.test(e)?e.substring(1):t?e.replace(/^(?! *$)/gm,t):e}var Ob=(e,t,n)=>e.endsWith(`
|
|
5131
|
+
`)?va(n,t):n.includes(`
|
|
4120
5132
|
`)?`
|
|
4121
|
-
`+
|
|
4122
|
-
`)n===
|
|
4123
|
-
`&&
|
|
4124
|
-
`&&
|
|
4125
|
-
${t}${e.slice(0,
|
|
4126
|
-
${t}${e.slice(
|
|
4127
|
-
`);r=t,i=t+1,s=e[i]}return r}
|
|
4128
|
-
`){if(s-a>r)return!0;if(a=s+1,i-a<=r)return!1}return!0}function
|
|
4129
|
-
|
|
4130
|
-
`;n[
|
|
4131
|
-
`,
|
|
4132
|
-
`)||/[ \t]\n|\n[ \t]/.test(e))return
|
|
4133
|
-
${n}`)+"'";return t.implicitKey?r:
|
|
5133
|
+
`+va(n,t):(e.endsWith(" ")?"":" ")+n;pi.indentComment=va;pi.lineComment=Ob;pi.stringifyComment=Pb});var fd=B(Wn=>{"use strict";S();var Rb="flow",wa="block",ui="quoted";function Lb(e,t,n="flow",{indentAtStart:r,lineWidth:i=80,minContentWidth:s=20,onFold:a,onOverflow:o}={}){if(!i||i<0)return e;i<s&&(s=0);let c=Math.max(1+s,1+i-t.length);if(e.length<=c)return e;let l=[],u={},d=i-t.length;typeof r=="number"&&(r>i-Math.max(2,s)?l.push(0):d=i-r);let p,m,f=!1,h=-1,g=-1,y=-1;n===wa&&(h=md(e,h,t.length),h!==-1&&(d=h+c));for(let b;b=e[h+=1];){if(n===ui&&b==="\\"){switch(g=h,e[h+1]){case"x":h+=3;break;case"u":h+=5;break;case"U":h+=9;break;default:h+=1}y=h}if(b===`
|
|
5134
|
+
`)n===wa&&(h=md(e,h,t.length)),d=h+t.length+c,p=void 0;else{if(b===" "&&m&&m!==" "&&m!==`
|
|
5135
|
+
`&&m!==" "){let E=e[h+1];E&&E!==" "&&E!==`
|
|
5136
|
+
`&&E!==" "&&(p=h)}if(h>=d)if(p)l.push(p),d=p+c,p=void 0;else if(n===ui){for(;m===" "||m===" ";)m=b,b=e[h+=1],f=!0;let E=h>y+1?h-2:g-1;if(u[E])return e;l.push(E),u[E]=!0,d=E+c,p=void 0}else f=!0}m=b}if(f&&o&&o(),l.length===0)return e;a&&a();let x=e.slice(0,l[0]);for(let b=0;b<l.length;++b){let E=l[b],_=l[b+1]||e.length;E===0?x=`
|
|
5137
|
+
${t}${e.slice(0,_)}`:(n===ui&&u[E]&&(x+=`${e[E]}\\`),x+=`
|
|
5138
|
+
${t}${e.slice(E+1,_)}`)}return x}function md(e,t,n){let r=t,i=t+1,s=e[i];for(;s===" "||s===" ";)if(t<i+n)s=e[++t];else{do s=e[++t];while(s&&s!==`
|
|
5139
|
+
`);r=t,i=t+1,s=e[i]}return r}Wn.FOLD_BLOCK=wa;Wn.FOLD_FLOW=Rb;Wn.FOLD_QUOTED=ui;Wn.foldFlowLines=Lb});var Gn=B(gd=>{"use strict";S();var je=de(),Nt=fd(),mi=(e,t)=>({indentAtStart:t?e.indent.length:e.indentAtStart,lineWidth:e.options.lineWidth,minContentWidth:e.options.minContentWidth}),fi=e=>/^(%|---|\.\.\.)/m.test(e);function Mb(e,t,n){if(!t||t<0)return!1;let r=t-n,i=e.length;if(i<=r)return!1;for(let s=0,a=0;s<i;++s)if(e[s]===`
|
|
5140
|
+
`){if(s-a>r)return!0;if(a=s+1,i-a<=r)return!1}return!0}function Kn(e,t){let n=JSON.stringify(e);if(t.options.doubleQuotedAsJSON)return n;let{implicitKey:r}=t,i=t.options.doubleQuotedMinMultiLineLength,s=t.indent||(fi(e)?" ":""),a="",o=0;for(let c=0,l=n[c];l;l=n[++c])if(l===" "&&n[c+1]==="\\"&&n[c+2]==="n"&&(a+=n.slice(o,c)+"\\ ",c+=1,o=c,l="\\"),l==="\\")switch(n[c+1]){case"u":{a+=n.slice(o,c);let u=n.substr(c+2,4);switch(u){case"0000":a+="\\0";break;case"0007":a+="\\a";break;case"000b":a+="\\v";break;case"001b":a+="\\e";break;case"0085":a+="\\N";break;case"00a0":a+="\\_";break;case"2028":a+="\\L";break;case"2029":a+="\\P";break;default:u.substr(0,2)==="00"?a+="\\x"+u.substr(2):a+=n.substr(c,6)}c+=5,o=c+1}break;case"n":if(r||n[c+2]==='"'||n.length<i)c+=1;else{for(a+=n.slice(o,c)+`
|
|
5141
|
+
|
|
5142
|
+
`;n[c+2]==="\\"&&n[c+3]==="n"&&n[c+4]!=='"';)a+=`
|
|
5143
|
+
`,c+=2;a+=s,n[c+2]===" "&&(a+="\\"),c+=1,o=c+1}break;default:c+=1}return a=o?a+n.slice(o):n,r?a:Nt.foldFlowLines(a,s,Nt.FOLD_QUOTED,mi(t,!1))}function ya(e,t){if(t.options.singleQuote===!1||t.implicitKey&&e.includes(`
|
|
5144
|
+
`)||/[ \t]\n|\n[ \t]/.test(e))return Kn(e,t);let n=t.indent||(fi(e)?" ":""),r="'"+e.replace(/'/g,"''").replace(/\n+/g,`$&
|
|
5145
|
+
${n}`)+"'";return t.implicitKey?r:Nt.foldFlowLines(r,n,Nt.FOLD_FLOW,mi(t,!1))}function bn(e,t){let{singleQuote:n}=t.options,r;if(n===!1)r=Kn;else{let i=e.includes('"'),s=e.includes("'");i&&!s?r=ya:s&&!i?r=Kn:r=n?ya:Kn}return r(e,t)}var xa;try{xa=new RegExp(`(^|(?<!
|
|
4134
5146
|
))
|
|
4135
5147
|
+(?!
|
|
4136
|
-
|$)`,"g")}catch{
|
|
5148
|
+
|$)`,"g")}catch{xa=/\n+(?!\n|$)/g}function hi({comment:e,type:t,value:n},r,i,s){let{blockQuote:a,commentString:o,lineWidth:c}=r.options;if(!a||/\n[\t ]+$/.test(n))return bn(n,r);let l=r.indent||(r.forceBlockIndent||fi(n)?" ":""),u=a==="literal"?!0:a==="folded"||t===je.Scalar.BLOCK_FOLDED?!1:t===je.Scalar.BLOCK_LITERAL?!0:!Mb(n,c,l.length);if(!n)return u?`|
|
|
4137
5149
|
`:`>
|
|
4138
|
-
`;let p
|
|
4139
|
-
`&&
|
|
4140
|
-
`);
|
|
4141
|
-
`&&(
|
|
4142
|
-
`)
|
|
4143
|
-
$&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${
|
|
4144
|
-
${
|
|
4145
|
-
${
|
|
4146
|
-
`)||
|
|
4147
|
-
`)?
|
|
4148
|
-
`))return
|
|
4149
|
-
${
|
|
4150
|
-
${t.indent}${o}`:o}
|
|
4151
|
-
${o}:`):(g=`${g}:`,
|
|
4152
|
-
`:"",
|
|
4153
|
-
${
|
|
4154
|
-
`&&b&&(
|
|
4155
|
-
|
|
4156
|
-
`):
|
|
4157
|
-
${n.indent}`}else if(!
|
|
4158
|
-
`),
|
|
4159
|
-
${n.indent}`)}}else(
|
|
4160
|
-
`)&&(
|
|
4161
|
-
${
|
|
4162
|
-
`}}return e?(
|
|
4163
|
-
`+
|
|
4164
|
-
`)),
|
|
5150
|
+
`;let d,p;for(p=n.length;p>0;--p){let _=n[p-1];if(_!==`
|
|
5151
|
+
`&&_!==" "&&_!==" ")break}let m=n.substring(p),f=m.indexOf(`
|
|
5152
|
+
`);f===-1?d="-":n===m||f!==m.length-1?(d="+",s&&s()):d="",m&&(n=n.slice(0,-m.length),m[m.length-1]===`
|
|
5153
|
+
`&&(m=m.slice(0,-1)),m=m.replace(xa,`$&${l}`));let h=!1,g,y=-1;for(g=0;g<n.length;++g){let _=n[g];if(_===" ")h=!0;else if(_===`
|
|
5154
|
+
`)y=g;else break}let x=n.substring(0,y<g?y+1:g);x&&(n=n.substring(x.length),x=x.replace(/\n+/g,`$&${l}`));let E=(h?l?"2":"1":"")+d;if(e&&(E+=" "+o(e.replace(/ ?[\r\n]+/g," ")),i&&i()),!u){let _=n.replace(/\n+/g,`
|
|
5155
|
+
$&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${l}`),v=!1,T=mi(r,!0);a!=="folded"&&t!==je.Scalar.BLOCK_FOLDED&&(T.onOverflow=()=>{v=!0});let w=Nt.foldFlowLines(`${x}${_}${m}`,l,Nt.FOLD_BLOCK,T);if(!v)return`>${E}
|
|
5156
|
+
${l}${w}`}return n=n.replace(/\n+/g,`$&${l}`),`|${E}
|
|
5157
|
+
${l}${x}${n}${m}`}function Db(e,t,n,r){let{type:i,value:s}=e,{actualString:a,implicitKey:o,indent:c,indentStep:l,inFlow:u}=t;if(o&&s.includes(`
|
|
5158
|
+
`)||u&&/[[\]{},]/.test(s))return bn(s,t);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(s))return o||u||!s.includes(`
|
|
5159
|
+
`)?bn(s,t):hi(e,t,n,r);if(!o&&!u&&i!==je.Scalar.PLAIN&&s.includes(`
|
|
5160
|
+
`))return hi(e,t,n,r);if(fi(s)){if(c==="")return t.forceBlockIndent=!0,hi(e,t,n,r);if(o&&c===l)return bn(s,t)}let d=s.replace(/\n+/g,`$&
|
|
5161
|
+
${c}`);if(a){let p=h=>h.default&&h.tag!=="tag:yaml.org,2002:str"&&h.test?.test(d),{compat:m,tags:f}=t.doc.schema;if(f.some(p)||m?.some(p))return bn(s,t)}return o?d:Nt.foldFlowLines(d,c,Nt.FOLD_FLOW,mi(t,!1))}function Bb(e,t,n,r){let{implicitKey:i,inFlow:s}=t,a=typeof e.value=="string"?e:Object.assign({},e,{value:String(e.value)}),{type:o}=e;o!==je.Scalar.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(a.value)&&(o=je.Scalar.QUOTE_DOUBLE);let c=u=>{switch(u){case je.Scalar.BLOCK_FOLDED:case je.Scalar.BLOCK_LITERAL:return i||s?bn(a.value,t):hi(a,t,n,r);case je.Scalar.QUOTE_DOUBLE:return Kn(a.value,t);case je.Scalar.QUOTE_SINGLE:return ya(a.value,t);case je.Scalar.PLAIN:return Db(a,t,n,r);default:return null}},l=c(o);if(l===null){let{defaultKeyType:u,defaultStringType:d}=t.options,p=i&&u||d;if(l=c(p),l===null)throw new Error(`Unsupported default string type ${p}`)}return l}gd.stringifyString=Bb});var zn=B(ka=>{"use strict";S();var $b=ai(),It=V(),Fb=jn(),qb=Gn();function Hb(e,t){let n=Object.assign({blockQuote:!0,commentString:Fb.stringifyComment,defaultKeyType:null,defaultStringType:"PLAIN",directives:null,doubleQuotedAsJSON:!1,doubleQuotedMinMultiLineLength:40,falseStr:"false",flowCollectionPadding:!0,indentSeq:!0,lineWidth:80,minContentWidth:20,nullStr:"null",simpleKeys:!1,singleQuote:null,trailingComma:!1,trueStr:"true",verifyAliasOrder:!0},e.schema.toStringOptions,t),r;switch(n.collectionStyle){case"block":r=!1;break;case"flow":r=!0;break;default:r=null}return{anchors:new Set,doc:e,flowCollectionPadding:n.flowCollectionPadding?" ":"",indent:"",indentStep:typeof n.indent=="number"?" ".repeat(n.indent):" ",inFlow:r,options:n}}function Ub(e,t){if(t.tag){let i=e.filter(s=>s.tag===t.tag);if(i.length>0)return i.find(s=>s.format===t.format)??i[0]}let n,r;if(It.isScalar(t)){r=t.value;let i=e.filter(s=>s.identify?.(r));if(i.length>1){let s=i.filter(a=>a.test);s.length>0&&(i=s)}n=i.find(s=>s.format===t.format)??i.find(s=>!s.format)}else r=t,n=e.find(i=>i.nodeClass&&r instanceof i.nodeClass);if(!n){let i=r?.constructor?.name??(r===null?"null":typeof r);throw new Error(`Tag not resolved for ${i} value`)}return n}function jb(e,t,{anchors:n,doc:r}){if(!r.directives)return"";let i=[],s=(It.isScalar(e)||It.isCollection(e))&&e.anchor;s&&$b.anchorIsValid(s)&&(n.add(s),i.push(`&${s}`));let a=e.tag??(t.default?null:t.tag);return a&&i.push(r.directives.tagString(a)),i.join(" ")}function Wb(e,t,n,r){if(It.isPair(e))return e.toString(t,n,r);if(It.isAlias(e)){if(t.doc.directives)return e.toString(t);if(t.resolvedAliases?.has(e))throw new TypeError("Cannot stringify circular structure without alias nodes");t.resolvedAliases?t.resolvedAliases.add(e):t.resolvedAliases=new Set([e]),e=e.resolve(t.doc)}let i,s=It.isNode(e)?e:t.doc.createNode(e,{onTagObj:c=>i=c});i??(i=Ub(t.doc.schema.tags,s));let a=jb(s,i,t);a.length>0&&(t.indentAtStart=(t.indentAtStart??0)+a.length+1);let o=typeof i.stringify=="function"?i.stringify(s,t,n,r):It.isScalar(s)?qb.stringifyString(s,t,n,r):s.toString(t,n,r);return a?It.isScalar(s)||o[0]==="{"||o[0]==="["?`${a} ${o}`:`${a}
|
|
5162
|
+
${t.indent}${o}`:o}ka.createStringifyContext=Hb;ka.stringify=Wb});var yd=B(wd=>{"use strict";S();var ut=V(),bd=de(),vd=zn(),Vn=jn();function Kb({key:e,value:t},n,r,i){let{allNullValues:s,doc:a,indent:o,indentStep:c,options:{commentString:l,indentSeq:u,simpleKeys:d}}=n,p=ut.isNode(e)&&e.comment||null;if(d){if(p)throw new Error("With simple keys, key nodes cannot have comments");if(ut.isCollection(e)||!ut.isNode(e)&&typeof e=="object"){let T="With simple keys, collection cannot be used as a key value";throw new Error(T)}}let m=!d&&(!e||p&&t==null&&!n.inFlow||ut.isCollection(e)||(ut.isScalar(e)?e.type===bd.Scalar.BLOCK_FOLDED||e.type===bd.Scalar.BLOCK_LITERAL:typeof e=="object"));n=Object.assign({},n,{allNullValues:!1,implicitKey:!m&&(d||!s),indent:o+c});let f=!1,h=!1,g=vd.stringify(e,n,()=>f=!0,()=>h=!0);if(!m&&!n.inFlow&&g.length>1024){if(d)throw new Error("With simple keys, single line scalar must not span more than 1024 characters");m=!0}if(n.inFlow){if(s||t==null)return f&&r&&r(),g===""?"?":m?`? ${g}`:g}else if(s&&!d||t==null&&m)return g=`? ${g}`,p&&!f?g+=Vn.lineComment(g,n.indent,l(p)):h&&i&&i(),g;f&&(p=null),m?(p&&(g+=Vn.lineComment(g,n.indent,l(p))),g=`? ${g}
|
|
5163
|
+
${o}:`):(g=`${g}:`,p&&(g+=Vn.lineComment(g,n.indent,l(p))));let y,x,b;ut.isNode(t)?(y=!!t.spaceBefore,x=t.commentBefore,b=t.comment):(y=!1,x=null,b=null,t&&typeof t=="object"&&(t=a.createNode(t))),n.implicitKey=!1,!m&&!p&&ut.isScalar(t)&&(n.indentAtStart=g.length+1),h=!1,!u&&c.length>=2&&!n.inFlow&&!m&&ut.isSeq(t)&&!t.flow&&!t.tag&&!t.anchor&&(n.indent=n.indent.substring(2));let E=!1,_=vd.stringify(t,n,()=>E=!0,()=>h=!0),v=" ";if(p||y||x){if(v=y?`
|
|
5164
|
+
`:"",x){let T=l(x);v+=`
|
|
5165
|
+
${Vn.indentComment(T,n.indent)}`}_===""&&!n.inFlow?v===`
|
|
5166
|
+
`&&b&&(v=`
|
|
5167
|
+
|
|
5168
|
+
`):v+=`
|
|
5169
|
+
${n.indent}`}else if(!m&&ut.isCollection(t)){let T=_[0],w=_.indexOf(`
|
|
5170
|
+
`),A=w!==-1,N=n.inFlow??t.flow??t.items.length===0;if(A||!N){let M=!1;if(A&&(T==="&"||T==="!")){let L=_.indexOf(" ");T==="&"&&L!==-1&&L<w&&_[L+1]==="!"&&(L=_.indexOf(" ",L+1)),(L===-1||w<L)&&(M=!0)}M||(v=`
|
|
5171
|
+
${n.indent}`)}}else(_===""||_[0]===`
|
|
5172
|
+
`)&&(v="");return g+=v+_,n.inFlow?E&&r&&r():b&&!E?g+=Vn.lineComment(g,n.indent,l(b)):h&&i&&i(),g}wd.stringifyPair=Kb});var Sa=B(Ta=>{"use strict";S();var xd=Jr("process");function Gb(e,...t){e==="debug"&&console.log(...t)}function zb(e,t){(e==="debug"||e==="warn")&&(typeof xd.emitWarning=="function"?xd.emitWarning(t):console.warn(t))}Ta.debug=Gb;Ta.warn=zb});var yi=B(wi=>{"use strict";S();var vi=V(),kd=de(),gi="<<",bi={identify:e=>e===gi||typeof e=="symbol"&&e.description===gi,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new kd.Scalar(Symbol(gi)),{addToJSMap:Td}),stringify:()=>gi},Vb=(e,t)=>(bi.identify(t)||vi.isScalar(t)&&(!t.type||t.type===kd.Scalar.PLAIN)&&bi.identify(t.value))&&e?.doc.schema.tags.some(n=>n.tag===bi.tag&&n.default);function Td(e,t,n){let r=Sd(e,n);if(vi.isSeq(r))for(let i of r.items)Ca(e,t,i);else if(Array.isArray(r))for(let i of r)Ca(e,t,i);else Ca(e,t,r)}function Ca(e,t,n){let r=Sd(e,n);if(!vi.isMap(r))throw new Error("Merge sources must be maps or map aliases");let i=r.toJSON(null,e,Map);for(let[s,a]of i)t instanceof Map?t.has(s)||t.set(s,a):t instanceof Set?t.add(s):Object.prototype.hasOwnProperty.call(t,s)||Object.defineProperty(t,s,{value:a,writable:!0,enumerable:!0,configurable:!0});return t}function Sd(e,t){return e&&vi.isAlias(t)?t.resolve(e.doc,e):t}wi.addMergeToJSMap=Td;wi.isMergeKey=Vb;wi.merge=bi});var Aa=B(Ad=>{"use strict";S();var Xb=Sa(),Cd=yi(),Yb=zn(),Ed=V(),Ea=At();function Jb(e,t,{key:n,value:r}){if(Ed.isNode(n)&&n.addToJSMap)n.addToJSMap(e,t,r);else if(Cd.isMergeKey(e,n))Cd.addMergeToJSMap(e,t,r);else{let i=Ea.toJS(n,"",e);if(t instanceof Map)t.set(i,Ea.toJS(r,i,e));else if(t instanceof Set)t.add(i);else{let s=Qb(n,i,e),a=Ea.toJS(r,s,e);s in t?Object.defineProperty(t,s,{value:a,writable:!0,enumerable:!0,configurable:!0}):t[s]=a}}return t}function Qb(e,t,n){if(t===null)return"";if(typeof t!="object")return String(t);if(Ed.isNode(e)&&n?.doc){let r=Yb.createStringifyContext(n.doc,{});r.anchors=new Set;for(let s of n.anchors.keys())r.anchors.add(s.anchor);r.inFlow=!0,r.inStringifyKey=!0;let i=e.toString(r);if(!n.mapKeyWarned){let s=JSON.stringify(i);s.length>40&&(s=s.substring(0,36)+'..."'),Xb.warn(n.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${s}. Set mapAsMap: true to use object keys.`),n.mapKeyWarned=!0}return i}return JSON.stringify(t)}Ad.addPairToJSMap=Jb});var Pt=B(_a=>{"use strict";S();var _d=Un(),Zb=yd(),ev=Aa(),xi=V();function tv(e,t,n){let r=_d.createNode(e,void 0,n),i=_d.createNode(t,void 0,n);return new ki(r,i)}var ki=class e{constructor(t,n=null){Object.defineProperty(this,xi.NODE_TYPE,{value:xi.PAIR}),this.key=t,this.value=n}clone(t){let{key:n,value:r}=this;return xi.isNode(n)&&(n=n.clone(t)),xi.isNode(r)&&(r=r.clone(t)),new e(n,r)}toJSON(t,n){let r=n?.mapAsMap?new Map:{};return ev.addPairToJSMap(n,r,this)}toString(t,n,r){return t?.doc?Zb.stringifyPair(this,t,n,r):JSON.stringify(this)}};_a.Pair=ki;_a.createPair=tv});var Na=B(Id=>{"use strict";S();var Kt=V(),Nd=zn(),Ti=jn();function nv(e,t,n){return(t.inFlow??e.flow?iv:rv)(e,t,n)}function rv({comment:e,items:t},n,{blockItemPrefix:r,flowChars:i,itemIndent:s,onChompKeep:a,onComment:o}){let{indent:c,options:{commentString:l}}=n,u=Object.assign({},n,{indent:s,type:null}),d=!1,p=[];for(let f=0;f<t.length;++f){let h=t[f],g=null;if(Kt.isNode(h))!d&&h.spaceBefore&&p.push(""),Si(n,p,h.commentBefore,d),h.comment&&(g=h.comment);else if(Kt.isPair(h)){let x=Kt.isNode(h.key)?h.key:null;x&&(!d&&x.spaceBefore&&p.push(""),Si(n,p,x.commentBefore,d))}d=!1;let y=Nd.stringify(h,u,()=>g=null,()=>d=!0);g&&(y+=Ti.lineComment(y,s,l(g))),d&&g&&(d=!1),p.push(r+y)}let m;if(p.length===0)m=i.start+i.end;else{m=p[0];for(let f=1;f<p.length;++f){let h=p[f];m+=h?`
|
|
5173
|
+
${c}${h}`:`
|
|
5174
|
+
`}}return e?(m+=`
|
|
5175
|
+
`+Ti.indentComment(l(e),c),o&&o()):d&&a&&a(),m}function iv({items:e},t,{flowChars:n,itemIndent:r}){let{indent:i,indentStep:s,flowCollectionPadding:a,options:{commentString:o}}=t;r+=s;let c=Object.assign({},t,{indent:r,inFlow:!0,type:null}),l=!1,u=0,d=[];for(let f=0;f<e.length;++f){let h=e[f],g=null;if(Kt.isNode(h))h.spaceBefore&&d.push(""),Si(t,d,h.commentBefore,!1),h.comment&&(g=h.comment);else if(Kt.isPair(h)){let x=Kt.isNode(h.key)?h.key:null;x&&(x.spaceBefore&&d.push(""),Si(t,d,x.commentBefore,!1),x.comment&&(l=!0));let b=Kt.isNode(h.value)?h.value:null;b?(b.comment&&(g=b.comment),b.commentBefore&&(l=!0)):h.value==null&&x?.comment&&(g=x.comment)}g&&(l=!0);let y=Nd.stringify(h,c,()=>g=null);l||(l=d.length>u||y.includes(`
|
|
5176
|
+
`)),f<e.length-1?y+=",":t.options.trailingComma&&(t.options.lineWidth>0&&(l||(l=d.reduce((x,b)=>x+b.length+2,2)+(y.length+2)>t.options.lineWidth)),l&&(y+=",")),g&&(y+=Ti.lineComment(y,r,o(g))),d.push(y),u=d.length}let{start:p,end:m}=n;if(d.length===0)return p+m;if(!l){let f=d.reduce((h,g)=>h+g.length+2,2);l=t.options.lineWidth>0&&f>t.options.lineWidth}if(l){let f=p;for(let h of d)f+=h?`
|
|
4165
5177
|
${s}${i}${h}`:`
|
|
4166
|
-
`;return`${
|
|
4167
|
-
${i}${
|
|
4168
|
-
`:" ")}return
|
|
5178
|
+
`;return`${f}
|
|
5179
|
+
${i}${m}`}else return`${p}${a}${d.join(" ")}${a}${m}`}function Si({indent:e,options:{commentString:t}},n,r,i){if(r&&i&&(r=r.replace(/^\n+/,"")),r){let s=Ti.indentComment(t(r),e);n.push(s.trimStart())}}Id.stringifyCollection=nv});var Rt=B(Pa=>{"use strict";S();var sv=Na(),av=Aa(),ov=di(),Ot=V(),Ci=Pt(),lv=de();function Xn(e,t){let n=Ot.isScalar(t)?t.value:t;for(let r of e)if(Ot.isPair(r)&&(r.key===t||r.key===n||Ot.isScalar(r.key)&&r.key.value===n))return r}var Ia=class extends ov.Collection{static get tagName(){return"tag:yaml.org,2002:map"}constructor(t){super(Ot.MAP,t),this.items=[]}static from(t,n,r){let{keepUndefined:i,replacer:s}=r,a=new this(t),o=(c,l)=>{if(typeof s=="function")l=s.call(n,c,l);else if(Array.isArray(s)&&!s.includes(c))return;(l!==void 0||i)&&a.items.push(Ci.createPair(c,l,r))};if(n instanceof Map)for(let[c,l]of n)o(c,l);else if(n&&typeof n=="object")for(let c of Object.keys(n))o(c,n[c]);return typeof t.sortMapEntries=="function"&&a.items.sort(t.sortMapEntries),a}add(t,n){let r;Ot.isPair(t)?r=t:!t||typeof t!="object"||!("key"in t)?r=new Ci.Pair(t,t?.value):r=new Ci.Pair(t.key,t.value);let i=Xn(this.items,r.key),s=this.schema?.sortMapEntries;if(i){if(!n)throw new Error(`Key ${r.key} already set`);Ot.isScalar(i.value)&&lv.isScalarValue(r.value)?i.value.value=r.value:i.value=r.value}else if(s){let a=this.items.findIndex(o=>s(r,o)<0);a===-1?this.items.push(r):this.items.splice(a,0,r)}else this.items.push(r)}delete(t){let n=Xn(this.items,t);return n?this.items.splice(this.items.indexOf(n),1).length>0:!1}get(t,n){let i=Xn(this.items,t)?.value;return(!n&&Ot.isScalar(i)?i.value:i)??void 0}has(t){return!!Xn(this.items,t)}set(t,n){this.add(new Ci.Pair(t,n),!0)}toJSON(t,n,r){let i=r?new r:n?.mapAsMap?new Map:{};n?.onCreate&&n.onCreate(i);for(let s of this.items)av.addPairToJSMap(n,i,s);return i}toString(t,n,r){if(!t)return JSON.stringify(this);for(let i of this.items)if(!Ot.isPair(i))throw new Error(`Map items must all be pairs; found ${JSON.stringify(i)} instead`);return!t.allNullValues&&this.hasAllNullValues(!1)&&(t=Object.assign({},t,{allNullValues:!0})),sv.stringifyCollection(this,t,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:t.indent||"",onChompKeep:r,onComment:n})}};Pa.YAMLMap=Ia;Pa.findPair=Xn});var vn=B(Od=>{"use strict";S();var cv=V(),Pd=Rt(),dv={collection:"map",default:!0,nodeClass:Pd.YAMLMap,tag:"tag:yaml.org,2002:map",resolve(e,t){return cv.isMap(e)||t("Expected a mapping for this tag"),e},createNode:(e,t,n)=>Pd.YAMLMap.from(e,t,n)};Od.map=dv});var Lt=B(Rd=>{"use strict";S();var pv=Un(),uv=Na(),hv=di(),Ai=V(),mv=de(),fv=At(),Oa=class extends hv.Collection{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(t){super(Ai.SEQ,t),this.items=[]}add(t){this.items.push(t)}delete(t){let n=Ei(t);return typeof n!="number"?!1:this.items.splice(n,1).length>0}get(t,n){let r=Ei(t);if(typeof r!="number")return;let i=this.items[r];return!n&&Ai.isScalar(i)?i.value:i}has(t){let n=Ei(t);return typeof n=="number"&&n<this.items.length}set(t,n){let r=Ei(t);if(typeof r!="number")throw new Error(`Expected a valid index, not ${t}.`);let i=this.items[r];Ai.isScalar(i)&&mv.isScalarValue(n)?i.value=n:this.items[r]=n}toJSON(t,n){let r=[];n?.onCreate&&n.onCreate(r);let i=0;for(let s of this.items)r.push(fv.toJS(s,String(i++),n));return r}toString(t,n,r){return t?uv.stringifyCollection(this,t,{blockItemPrefix:"- ",flowChars:{start:"[",end:"]"},itemIndent:(t.indent||"")+" ",onChompKeep:r,onComment:n}):JSON.stringify(this)}static from(t,n,r){let{replacer:i}=r,s=new this(t);if(n&&Symbol.iterator in Object(n)){let a=0;for(let o of n){if(typeof i=="function"){let c=n instanceof Set?o:String(a++);o=i.call(n,c,o)}s.items.push(pv.createNode(o,void 0,r))}}return s}};function Ei(e){let t=Ai.isScalar(e)?e.value:e;return t&&typeof t=="string"&&(t=Number(t)),typeof t=="number"&&Number.isInteger(t)&&t>=0?t:null}Rd.YAMLSeq=Oa});var wn=B(Md=>{"use strict";S();var gv=V(),Ld=Lt(),bv={collection:"seq",default:!0,nodeClass:Ld.YAMLSeq,tag:"tag:yaml.org,2002:seq",resolve(e,t){return gv.isSeq(e)||t("Expected a sequence for this tag"),e},createNode:(e,t,n)=>Ld.YAMLSeq.from(e,t,n)};Md.seq=bv});var Yn=B(Dd=>{"use strict";S();var vv=Gn(),wv={identify:e=>typeof e=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:e=>e,stringify(e,t,n,r){return t=Object.assign({actualString:!0},t),vv.stringifyString(e,t,n,r)}};Dd.string=wv});var _i=B(Fd=>{"use strict";S();var Bd=de(),$d={identify:e=>e==null,createNode:()=>new Bd.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new Bd.Scalar(null),stringify:({source:e},t)=>typeof e=="string"&&$d.test.test(e)?e:t.options.nullStr};Fd.nullTag=$d});var Ra=B(Hd=>{"use strict";S();var yv=de(),qd={identify:e=>typeof e=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:e=>new yv.Scalar(e[0]==="t"||e[0]==="T"),stringify({source:e,value:t},n){if(e&&qd.test.test(e)){let r=e[0]==="t"||e[0]==="T";if(t===r)return e}return t?n.options.trueStr:n.options.falseStr}};Hd.boolTag=qd});var yn=B(Ud=>{"use strict";S();function xv({format:e,minFractionDigits:t,tag:n,value:r}){if(typeof r=="bigint")return String(r);let i=typeof r=="number"?r:Number(r);if(!isFinite(i))return isNaN(i)?".nan":i<0?"-.inf":".inf";let s=Object.is(r,-0)?"-0":JSON.stringify(r);if(!e&&t&&(!n||n==="tag:yaml.org,2002:float")&&/^-?\d/.test(s)&&!s.includes("e")){let a=s.indexOf(".");a<0&&(a=s.length,s+=".");let o=t-(s.length-a-1);for(;o-- >0;)s+="0"}return s}Ud.stringifyNumber=xv});var Ma=B(Ni=>{"use strict";S();var kv=de(),La=yn(),Tv={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:e=>e.slice(-3).toLowerCase()==="nan"?NaN:e[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:La.stringifyNumber},Sv={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,resolve:e=>parseFloat(e),stringify(e){let t=Number(e.value);return isFinite(t)?t.toExponential():La.stringifyNumber(e)}},Cv={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve(e){let t=new kv.Scalar(parseFloat(e)),n=e.indexOf(".");return n!==-1&&e[e.length-1]==="0"&&(t.minFractionDigits=e.length-n-1),t},stringify:La.stringifyNumber};Ni.float=Cv;Ni.floatExp=Sv;Ni.floatNaN=Tv});var Ba=B(Pi=>{"use strict";S();var jd=yn(),Ii=e=>typeof e=="bigint"||Number.isInteger(e),Da=(e,t,n,{intAsBigInt:r})=>r?BigInt(e):parseInt(e.substring(t),n);function Wd(e,t,n){let{value:r}=e;return Ii(r)&&r>=0?n+r.toString(t):jd.stringifyNumber(e)}var Ev={identify:e=>Ii(e)&&e>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(e,t,n)=>Da(e,2,8,n),stringify:e=>Wd(e,8,"0o")},Av={identify:Ii,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(e,t,n)=>Da(e,0,10,n),stringify:jd.stringifyNumber},_v={identify:e=>Ii(e)&&e>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(e,t,n)=>Da(e,2,16,n),stringify:e=>Wd(e,16,"0x")};Pi.int=Av;Pi.intHex=_v;Pi.intOct=Ev});var Gd=B(Kd=>{"use strict";S();var Nv=vn(),Iv=_i(),Pv=wn(),Ov=Yn(),Rv=Ra(),$a=Ma(),Fa=Ba(),Lv=[Nv.map,Pv.seq,Ov.string,Iv.nullTag,Rv.boolTag,Fa.intOct,Fa.int,Fa.intHex,$a.floatNaN,$a.floatExp,$a.float];Kd.schema=Lv});var Xd=B(Vd=>{"use strict";S();var Mv=de(),Dv=vn(),Bv=wn();function zd(e){return typeof e=="bigint"||Number.isInteger(e)}var Oi=({value:e})=>JSON.stringify(e),$v=[{identify:e=>typeof e=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:e=>e,stringify:Oi},{identify:e=>e==null,createNode:()=>new Mv.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:Oi},{identify:e=>typeof e=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:e=>e==="true",stringify:Oi},{identify:zd,default:!0,tag:"tag:yaml.org,2002:int",test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(e,t,{intAsBigInt:n})=>n?BigInt(e):parseInt(e,10),stringify:({value:e})=>zd(e)?e.toString():JSON.stringify(e)},{identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:e=>parseFloat(e),stringify:Oi}],Fv={default:!0,tag:"",test:/^/,resolve(e,t){return t(`Unresolved plain scalar ${JSON.stringify(e)}`),e}},qv=[Dv.map,Bv.seq].concat($v,Fv);Vd.schema=qv});var Ha=B(Yd=>{"use strict";S();var Jn=Jr("buffer"),qa=de(),Hv=Gn(),Uv={identify:e=>e instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(e,t){if(typeof Jn.Buffer=="function")return Jn.Buffer.from(e,"base64");if(typeof atob=="function"){let n=atob(e.replace(/[\n\r]/g,"")),r=new Uint8Array(n.length);for(let i=0;i<n.length;++i)r[i]=n.charCodeAt(i);return r}else return t("This environment does not support reading binary tags; either Buffer or atob is required"),e},stringify({comment:e,type:t,value:n},r,i,s){if(!n)return"";let a=n,o;if(typeof Jn.Buffer=="function")o=a instanceof Jn.Buffer?a.toString("base64"):Jn.Buffer.from(a.buffer).toString("base64");else if(typeof btoa=="function"){let c="";for(let l=0;l<a.length;++l)c+=String.fromCharCode(a[l]);o=btoa(c)}else throw new Error("This environment does not support writing binary tags; either Buffer or btoa is required");if(t??(t=qa.Scalar.BLOCK_LITERAL),t!==qa.Scalar.QUOTE_DOUBLE){let c=Math.max(r.options.lineWidth-r.indent.length,r.options.minContentWidth),l=Math.ceil(o.length/c),u=new Array(l);for(let d=0,p=0;d<l;++d,p+=c)u[d]=o.substr(p,c);o=u.join(t===qa.Scalar.BLOCK_LITERAL?`
|
|
5180
|
+
`:" ")}return Hv.stringifyString({comment:e,type:t,value:o},r,i,s)}};Yd.binary=Uv});var Mi=B(Li=>{"use strict";S();var Ri=V(),Ua=Pt(),jv=de(),Wv=Lt();function Jd(e,t){if(Ri.isSeq(e))for(let n=0;n<e.items.length;++n){let r=e.items[n];if(!Ri.isPair(r)){if(Ri.isMap(r)){r.items.length>1&&t("Each pair must have its own sequence indicator");let i=r.items[0]||new Ua.Pair(new jv.Scalar(null));if(r.commentBefore&&(i.key.commentBefore=i.key.commentBefore?`${r.commentBefore}
|
|
4169
5181
|
${i.key.commentBefore}`:r.commentBefore),r.comment){let s=i.value??i.key;s.comment=s.comment?`${r.comment}
|
|
4170
|
-
${s.comment}`:r.comment}r=i}e.items[n]=ki.isPair(r)?r:new Na.Pair(r)}}else t("Expected a sequence for this tag");return e}function Pd(e,t,n){let{replacer:r}=n,i=new pv.YAMLSeq(e);i.tag="tag:yaml.org,2002:pairs";let s=0;if(t&&Symbol.iterator in Object(t))for(let a of t){typeof r=="function"&&(a=r.call(t,String(s++),a));let o,l;if(Array.isArray(a))if(a.length===2)o=a[0],l=a[1];else throw new TypeError(`Expected [key, value] tuple: ${a}`);else if(a&&a instanceof Object){let c=Object.keys(a);if(c.length===1)o=c[0],l=a[o];else throw new TypeError(`Expected tuple with one key, not ${c.length} keys`)}else o=a;i.items.push(Na.createPair(o,l,n))}return i}var uv={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:Id,createNode:Pd};Ti.createPairs=Pd;Ti.pairs=uv;Ti.resolvePairs=Id});var Oa=B(Pa=>{"use strict";E();var Od=q(),Ia=xt(),jn=_t(),hv=At(),Ld=Si(),Ut=class e extends hv.YAMLSeq{constructor(){super(),this.add=jn.YAMLMap.prototype.add.bind(this),this.delete=jn.YAMLMap.prototype.delete.bind(this),this.get=jn.YAMLMap.prototype.get.bind(this),this.has=jn.YAMLMap.prototype.has.bind(this),this.set=jn.YAMLMap.prototype.set.bind(this),this.tag=e.tag}toJSON(t,n){if(!n)return super.toJSON(t);let r=new Map;n?.onCreate&&n.onCreate(r);for(let i of this.items){let s,a;if(Od.isPair(i)?(s=Ia.toJS(i.key,"",n),a=Ia.toJS(i.value,s,n)):s=Ia.toJS(i,"",n),r.has(s))throw new Error("Ordered maps must not include duplicate keys");r.set(s,a)}return r}static from(t,n,r){let i=Ld.createPairs(t,n,r),s=new this;return s.items=i.items,s}};Ut.tag="tag:yaml.org,2002:omap";var fv={collection:"seq",identify:e=>e instanceof Map,nodeClass:Ut,default:!1,tag:"tag:yaml.org,2002:omap",resolve(e,t){let n=Ld.resolvePairs(e,t),r=[];for(let{key:i}of n.items)Od.isScalar(i)&&(r.includes(i.value)?t(`Ordered maps must not include duplicate keys: ${i.value}`):r.push(i.value));return Object.assign(new Ut,n)},createNode:(e,t,n)=>Ut.from(e,t,n)};Pa.YAMLOMap=Ut;Pa.omap=fv});var $d=B(La=>{"use strict";E();var Rd=ce();function Md({value:e,source:t},n){return t&&(e?Dd:Bd).test.test(t)?t:e?n.options.trueStr:n.options.falseStr}var Dd={identify:e=>e===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new Rd.Scalar(!0),stringify:Md},Bd={identify:e=>e===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new Rd.Scalar(!1),stringify:Md};La.falseTag=Bd;La.trueTag=Dd});var Fd=B(Ei=>{"use strict";E();var mv=ce(),Ra=pn(),gv={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:e=>e.slice(-3).toLowerCase()==="nan"?NaN:e[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:Ra.stringifyNumber},bv={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:e=>parseFloat(e.replace(/_/g,"")),stringify(e){let t=Number(e.value);return isFinite(t)?t.toExponential():Ra.stringifyNumber(e)}},vv={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(e){let t=new mv.Scalar(parseFloat(e.replace(/_/g,""))),n=e.indexOf(".");if(n!==-1){let r=e.substring(n+1).replace(/_/g,"");r[r.length-1]==="0"&&(t.minFractionDigits=r.length)}return t},stringify:Ra.stringifyNumber};Ei.float=vv;Ei.floatExp=bv;Ei.floatNaN=gv});var Ud=B(Gn=>{"use strict";E();var Hd=pn(),Kn=e=>typeof e=="bigint"||Number.isInteger(e);function Ci(e,t,n,{intAsBigInt:r}){let i=e[0];if((i==="-"||i==="+")&&(t+=1),e=e.substring(t).replace(/_/g,""),r){switch(n){case 2:e=`0b${e}`;break;case 8:e=`0o${e}`;break;case 16:e=`0x${e}`;break}let a=BigInt(e);return i==="-"?BigInt(-1)*a:a}let s=parseInt(e,n);return i==="-"?-1*s:s}function Ma(e,t,n){let{value:r}=e;if(Kn(r)){let i=r.toString(t);return r<0?"-"+n+i.substr(1):n+i}return Hd.stringifyNumber(e)}var wv={identify:Kn,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(e,t,n)=>Ci(e,2,2,n),stringify:e=>Ma(e,2,"0b")},yv={identify:Kn,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(e,t,n)=>Ci(e,1,8,n),stringify:e=>Ma(e,8,"0")},xv={identify:Kn,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(e,t,n)=>Ci(e,0,10,n),stringify:Hd.stringifyNumber},kv={identify:Kn,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(e,t,n)=>Ci(e,2,16,n),stringify:e=>Ma(e,16,"0x")};Gn.int=xv;Gn.intBin=wv;Gn.intHex=kv;Gn.intOct=yv});var Ba=B(Da=>{"use strict";E();var Ni=q(),_i=Et(),Ai=_t(),qt=class e extends Ai.YAMLMap{constructor(t){super(t),this.tag=e.tag}add(t){let n;Ni.isPair(t)?n=t:t&&typeof t=="object"&&"key"in t&&"value"in t&&t.value===null?n=new _i.Pair(t.key,null):n=new _i.Pair(t,null),Ai.findPair(this.items,n.key)||this.items.push(n)}get(t,n){let r=Ai.findPair(this.items,t);return!n&&Ni.isPair(r)?Ni.isScalar(r.key)?r.key.value:r.key:r}set(t,n){if(typeof n!="boolean")throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof n}`);let r=Ai.findPair(this.items,t);r&&!n?this.items.splice(this.items.indexOf(r),1):!r&&n&&this.items.push(new _i.Pair(t))}toJSON(t,n){return super.toJSON(t,n,Set)}toString(t,n,r){if(!t)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},t,{allNullValues:!0}),n,r);throw new Error("Set items must all have null values")}static from(t,n,r){let{replacer:i}=r,s=new this(t);if(n&&Symbol.iterator in Object(n))for(let a of n)typeof i=="function"&&(a=i.call(n,a,a)),s.items.push(_i.createPair(a,null,r));return s}};qt.tag="tag:yaml.org,2002:set";var Tv={collection:"map",identify:e=>e instanceof Set,nodeClass:qt,default:!1,tag:"tag:yaml.org,2002:set",createNode:(e,t,n)=>qt.from(e,t,n),resolve(e,t){if(Ni.isMap(e)){if(e.hasAllNullValues(!0))return Object.assign(new qt,e);t("Set items must all have null values")}else t("Expected a mapping for this tag");return e}};Da.YAMLSet=qt;Da.set=Tv});var Fa=B(Ii=>{"use strict";E();var Sv=pn();function $a(e,t){let n=e[0],r=n==="-"||n==="+"?e.substring(1):e,i=a=>t?BigInt(a):Number(a),s=r.replace(/_/g,"").split(":").reduce((a,o)=>a*i(60)+i(o),i(0));return n==="-"?i(-1)*s:s}function qd(e){let{value:t}=e,n=a=>a;if(typeof t=="bigint")n=a=>BigInt(a);else if(isNaN(t)||!isFinite(t))return Sv.stringifyNumber(e);let r="";t<0&&(r="-",t*=n(-1));let i=n(60),s=[t%i];return t<60?s.unshift(0):(t=(t-s[0])/i,s.unshift(t%i),t>=60&&(t=(t-s[0])/i,s.unshift(t))),r+s.map(a=>String(a).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}var Ev={identify:e=>typeof e=="bigint"||Number.isInteger(e),default:!0,tag:"tag:yaml.org,2002:int",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:(e,t,{intAsBigInt:n})=>$a(e,n),stringify:qd},Cv={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:e=>$a(e,!1),stringify:qd},Wd={identify:e=>e instanceof Date,default:!0,tag:"tag:yaml.org,2002:timestamp",test:RegExp("^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?$"),resolve(e){let t=e.match(Wd.test);if(!t)throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");let[,n,r,i,s,a,o]=t.map(Number),l=t[7]?Number((t[7]+"00").substr(1,3)):0,c=Date.UTC(n,r-1,i,s||0,a||0,o||0,l),d=t[8];if(d&&d!=="Z"){let p=$a(d,!1);Math.abs(p)<30&&(p*=60),c-=6e4*p}return new Date(c)},stringify:({value:e})=>e?.toISOString().replace(/(T00:00:00)?\.000Z$/,"")??""};Ii.floatTime=Cv;Ii.intTime=Ev;Ii.timestamp=Wd});var Gd=B(Kd=>{"use strict";E();var _v=cn(),Av=bi(),Nv=dn(),Iv=qn(),Pv=Aa(),jd=$d(),Ha=Fd(),Pi=Ud(),Ov=ci(),Lv=Oa(),Rv=Si(),Mv=Ba(),Ua=Fa(),Dv=[_v.map,Nv.seq,Iv.string,Av.nullTag,jd.trueTag,jd.falseTag,Pi.intBin,Pi.intOct,Pi.int,Pi.intHex,Ha.floatNaN,Ha.floatExp,Ha.float,Pv.binary,Ov.merge,Lv.omap,Rv.pairs,Mv.set,Ua.intTime,Ua.floatTime,Ua.timestamp];Kd.schema=Dv});var np=B(ja=>{"use strict";E();var Yd=cn(),Bv=bi(),Jd=dn(),$v=qn(),Fv=ya(),qa=ka(),Wa=Sa(),Hv=Ed(),Uv=Ad(),Qd=Aa(),zn=ci(),Zd=Oa(),ep=Si(),zd=Gd(),tp=Ba(),Oi=Fa(),Vd=new Map([["core",Hv.schema],["failsafe",[Yd.map,Jd.seq,$v.string]],["json",Uv.schema],["yaml11",zd.schema],["yaml-1.1",zd.schema]]),Xd={binary:Qd.binary,bool:Fv.boolTag,float:qa.float,floatExp:qa.floatExp,floatNaN:qa.floatNaN,floatTime:Oi.floatTime,int:Wa.int,intHex:Wa.intHex,intOct:Wa.intOct,intTime:Oi.intTime,map:Yd.map,merge:zn.merge,null:Bv.nullTag,omap:Zd.omap,pairs:ep.pairs,seq:Jd.seq,set:tp.set,timestamp:Oi.timestamp},qv={"tag:yaml.org,2002:binary":Qd.binary,"tag:yaml.org,2002:merge":zn.merge,"tag:yaml.org,2002:omap":Zd.omap,"tag:yaml.org,2002:pairs":ep.pairs,"tag:yaml.org,2002:set":tp.set,"tag:yaml.org,2002:timestamp":Oi.timestamp};function Wv(e,t,n){let r=Vd.get(t);if(r&&!e)return n&&!r.includes(zn.merge)?r.concat(zn.merge):r.slice();let i=r;if(!i)if(Array.isArray(e))i=[];else{let s=Array.from(Vd.keys()).filter(a=>a!=="yaml11").map(a=>JSON.stringify(a)).join(", ");throw new Error(`Unknown schema "${t}"; use one of ${s} or define customTags array`)}if(Array.isArray(e))for(let s of e)i=i.concat(s);else typeof e=="function"&&(i=e(i.slice()));return n&&(i=i.concat(zn.merge)),i.reduce((s,a)=>{let o=typeof a=="string"?Xd[a]:a;if(!o){let l=JSON.stringify(a),c=Object.keys(Xd).map(d=>JSON.stringify(d)).join(", ");throw new Error(`Unknown custom tag ${l}; use one of ${c}`)}return s.includes(o)||s.push(o),s},[])}ja.coreKnownTags=qv;ja.getTags=Wv});var za=B(rp=>{"use strict";E();var Ka=q(),jv=cn(),Kv=dn(),Gv=qn(),Li=np(),zv=(e,t)=>e.key<t.key?-1:e.key>t.key?1:0,Ga=class e{constructor({compat:t,customTags:n,merge:r,resolveKnownTags:i,schema:s,sortMapEntries:a,toStringDefaults:o}){this.compat=Array.isArray(t)?Li.getTags(t,"compat"):t?Li.getTags(null,t):null,this.name=typeof s=="string"&&s||"core",this.knownTags=i?Li.coreKnownTags:{},this.tags=Li.getTags(n,this.name,r),this.toStringOptions=o??null,Object.defineProperty(this,Ka.MAP,{value:jv.map}),Object.defineProperty(this,Ka.SCALAR,{value:Gv.string}),Object.defineProperty(this,Ka.SEQ,{value:Kv.seq}),this.sortMapEntries=typeof a=="function"?a:a===!0?zv:null}clone(){let t=Object.create(e.prototype,Object.getOwnPropertyDescriptors(this));return t.tags=this.tags.slice(),t}};rp.Schema=Ga});var sp=B(ip=>{"use strict";E();var Vv=q(),Va=Fn(),Vn=Mn();function Xv(e,t){let n=[],r=t.directives===!0;if(t.directives!==!1&&e.directives){let l=e.directives.toString(e);l?(n.push(l),r=!0):e.directives.docStart&&(r=!0)}r&&n.push("---");let i=Va.createStringifyContext(e,t),{commentString:s}=i.options;if(e.commentBefore){n.length!==1&&n.unshift("");let l=s(e.commentBefore);n.unshift(Vn.indentComment(l,""))}let a=!1,o=null;if(e.contents){if(Vv.isNode(e.contents)){if(e.contents.spaceBefore&&r&&n.push(""),e.contents.commentBefore){let d=s(e.contents.commentBefore);n.push(Vn.indentComment(d,""))}i.forceBlockIndent=!!e.comment,o=e.contents.comment}let l=o?void 0:()=>a=!0,c=Va.stringify(e.contents,i,()=>o=null,l);o&&(c+=Vn.lineComment(c,"",s(o))),(c[0]==="|"||c[0]===">")&&n[n.length-1]==="---"?n[n.length-1]=`--- ${c}`:n.push(c)}else n.push(Va.stringify(e.contents,i));if(e.directives?.docEnd)if(e.comment){let l=s(e.comment);l.includes(`
|
|
4171
|
-
`)?(n.push("..."),n.push(
|
|
5182
|
+
${s.comment}`:r.comment}r=i}e.items[n]=Ri.isPair(r)?r:new Ua.Pair(r)}}else t("Expected a sequence for this tag");return e}function Qd(e,t,n){let{replacer:r}=n,i=new Wv.YAMLSeq(e);i.tag="tag:yaml.org,2002:pairs";let s=0;if(t&&Symbol.iterator in Object(t))for(let a of t){typeof r=="function"&&(a=r.call(t,String(s++),a));let o,c;if(Array.isArray(a))if(a.length===2)o=a[0],c=a[1];else throw new TypeError(`Expected [key, value] tuple: ${a}`);else if(a&&a instanceof Object){let l=Object.keys(a);if(l.length===1)o=l[0],c=a[o];else throw new TypeError(`Expected tuple with one key, not ${l.length} keys`)}else o=a;i.items.push(Ua.createPair(o,c,n))}return i}var Kv={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:Jd,createNode:Qd};Li.createPairs=Qd;Li.pairs=Kv;Li.resolvePairs=Jd});var Ka=B(Wa=>{"use strict";S();var Zd=V(),ja=At(),Qn=Rt(),Gv=Lt(),ep=Mi(),Gt=class e extends Gv.YAMLSeq{constructor(){super(),this.add=Qn.YAMLMap.prototype.add.bind(this),this.delete=Qn.YAMLMap.prototype.delete.bind(this),this.get=Qn.YAMLMap.prototype.get.bind(this),this.has=Qn.YAMLMap.prototype.has.bind(this),this.set=Qn.YAMLMap.prototype.set.bind(this),this.tag=e.tag}toJSON(t,n){if(!n)return super.toJSON(t);let r=new Map;n?.onCreate&&n.onCreate(r);for(let i of this.items){let s,a;if(Zd.isPair(i)?(s=ja.toJS(i.key,"",n),a=ja.toJS(i.value,s,n)):s=ja.toJS(i,"",n),r.has(s))throw new Error("Ordered maps must not include duplicate keys");r.set(s,a)}return r}static from(t,n,r){let i=ep.createPairs(t,n,r),s=new this;return s.items=i.items,s}};Gt.tag="tag:yaml.org,2002:omap";var zv={collection:"seq",identify:e=>e instanceof Map,nodeClass:Gt,default:!1,tag:"tag:yaml.org,2002:omap",resolve(e,t){let n=ep.resolvePairs(e,t),r=[];for(let{key:i}of n.items)Zd.isScalar(i)&&(r.includes(i.value)?t(`Ordered maps must not include duplicate keys: ${i.value}`):r.push(i.value));return Object.assign(new Gt,n)},createNode:(e,t,n)=>Gt.from(e,t,n)};Wa.YAMLOMap=Gt;Wa.omap=zv});var sp=B(Ga=>{"use strict";S();var tp=de();function np({value:e,source:t},n){return t&&(e?rp:ip).test.test(t)?t:e?n.options.trueStr:n.options.falseStr}var rp={identify:e=>e===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new tp.Scalar(!0),stringify:np},ip={identify:e=>e===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new tp.Scalar(!1),stringify:np};Ga.falseTag=ip;Ga.trueTag=rp});var ap=B(Di=>{"use strict";S();var Vv=de(),za=yn(),Xv={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:e=>e.slice(-3).toLowerCase()==="nan"?NaN:e[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:za.stringifyNumber},Yv={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:e=>parseFloat(e.replace(/_/g,"")),stringify(e){let t=Number(e.value);return isFinite(t)?t.toExponential():za.stringifyNumber(e)}},Jv={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(e){let t=new Vv.Scalar(parseFloat(e.replace(/_/g,""))),n=e.indexOf(".");if(n!==-1){let r=e.substring(n+1).replace(/_/g,"");r[r.length-1]==="0"&&(t.minFractionDigits=r.length)}return t},stringify:za.stringifyNumber};Di.float=Jv;Di.floatExp=Yv;Di.floatNaN=Xv});var lp=B(er=>{"use strict";S();var op=yn(),Zn=e=>typeof e=="bigint"||Number.isInteger(e);function Bi(e,t,n,{intAsBigInt:r}){let i=e[0];if((i==="-"||i==="+")&&(t+=1),e=e.substring(t).replace(/_/g,""),r){switch(n){case 2:e=`0b${e}`;break;case 8:e=`0o${e}`;break;case 16:e=`0x${e}`;break}let a=BigInt(e);return i==="-"?BigInt(-1)*a:a}let s=parseInt(e,n);return i==="-"?-1*s:s}function Va(e,t,n){let{value:r}=e;if(Zn(r)){let i=r.toString(t);return r<0?"-"+n+i.substr(1):n+i}return op.stringifyNumber(e)}var Qv={identify:Zn,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(e,t,n)=>Bi(e,2,2,n),stringify:e=>Va(e,2,"0b")},Zv={identify:Zn,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(e,t,n)=>Bi(e,1,8,n),stringify:e=>Va(e,8,"0")},ew={identify:Zn,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(e,t,n)=>Bi(e,0,10,n),stringify:op.stringifyNumber},tw={identify:Zn,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(e,t,n)=>Bi(e,2,16,n),stringify:e=>Va(e,16,"0x")};er.int=ew;er.intBin=Qv;er.intHex=tw;er.intOct=Zv});var Ya=B(Xa=>{"use strict";S();var qi=V(),$i=Pt(),Fi=Rt(),zt=class e extends Fi.YAMLMap{constructor(t){super(t),this.tag=e.tag}add(t){let n;qi.isPair(t)?n=t:t&&typeof t=="object"&&"key"in t&&"value"in t&&t.value===null?n=new $i.Pair(t.key,null):n=new $i.Pair(t,null),Fi.findPair(this.items,n.key)||this.items.push(n)}get(t,n){let r=Fi.findPair(this.items,t);return!n&&qi.isPair(r)?qi.isScalar(r.key)?r.key.value:r.key:r}set(t,n){if(typeof n!="boolean")throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof n}`);let r=Fi.findPair(this.items,t);r&&!n?this.items.splice(this.items.indexOf(r),1):!r&&n&&this.items.push(new $i.Pair(t))}toJSON(t,n){return super.toJSON(t,n,Set)}toString(t,n,r){if(!t)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},t,{allNullValues:!0}),n,r);throw new Error("Set items must all have null values")}static from(t,n,r){let{replacer:i}=r,s=new this(t);if(n&&Symbol.iterator in Object(n))for(let a of n)typeof i=="function"&&(a=i.call(n,a,a)),s.items.push($i.createPair(a,null,r));return s}};zt.tag="tag:yaml.org,2002:set";var nw={collection:"map",identify:e=>e instanceof Set,nodeClass:zt,default:!1,tag:"tag:yaml.org,2002:set",createNode:(e,t,n)=>zt.from(e,t,n),resolve(e,t){if(qi.isMap(e)){if(e.hasAllNullValues(!0))return Object.assign(new zt,e);t("Set items must all have null values")}else t("Expected a mapping for this tag");return e}};Xa.YAMLSet=zt;Xa.set=nw});var Qa=B(Hi=>{"use strict";S();var rw=yn();function Ja(e,t){let n=e[0],r=n==="-"||n==="+"?e.substring(1):e,i=a=>t?BigInt(a):Number(a),s=r.replace(/_/g,"").split(":").reduce((a,o)=>a*i(60)+i(o),i(0));return n==="-"?i(-1)*s:s}function cp(e){let{value:t}=e,n=a=>a;if(typeof t=="bigint")n=a=>BigInt(a);else if(isNaN(t)||!isFinite(t))return rw.stringifyNumber(e);let r="";t<0&&(r="-",t*=n(-1));let i=n(60),s=[t%i];return t<60?s.unshift(0):(t=(t-s[0])/i,s.unshift(t%i),t>=60&&(t=(t-s[0])/i,s.unshift(t))),r+s.map(a=>String(a).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}var iw={identify:e=>typeof e=="bigint"||Number.isInteger(e),default:!0,tag:"tag:yaml.org,2002:int",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:(e,t,{intAsBigInt:n})=>Ja(e,n),stringify:cp},sw={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:e=>Ja(e,!1),stringify:cp},dp={identify:e=>e instanceof Date,default:!0,tag:"tag:yaml.org,2002:timestamp",test:RegExp("^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?$"),resolve(e){let t=e.match(dp.test);if(!t)throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");let[,n,r,i,s,a,o]=t.map(Number),c=t[7]?Number((t[7]+"00").substr(1,3)):0,l=Date.UTC(n,r-1,i,s||0,a||0,o||0,c),u=t[8];if(u&&u!=="Z"){let d=Ja(u,!1);Math.abs(d)<30&&(d*=60),l-=6e4*d}return new Date(l)},stringify:({value:e})=>e?.toISOString().replace(/(T00:00:00)?\.000Z$/,"")??""};Hi.floatTime=sw;Hi.intTime=iw;Hi.timestamp=dp});var hp=B(up=>{"use strict";S();var aw=vn(),ow=_i(),lw=wn(),cw=Yn(),dw=Ha(),pp=sp(),Za=ap(),Ui=lp(),pw=yi(),uw=Ka(),hw=Mi(),mw=Ya(),eo=Qa(),fw=[aw.map,lw.seq,cw.string,ow.nullTag,pp.trueTag,pp.falseTag,Ui.intBin,Ui.intOct,Ui.int,Ui.intHex,Za.floatNaN,Za.floatExp,Za.float,dw.binary,pw.merge,uw.omap,hw.pairs,mw.set,eo.intTime,eo.floatTime,eo.timestamp];up.schema=fw});var Tp=B(ro=>{"use strict";S();var bp=vn(),gw=_i(),vp=wn(),bw=Yn(),vw=Ra(),to=Ma(),no=Ba(),ww=Gd(),yw=Xd(),wp=Ha(),tr=yi(),yp=Ka(),xp=Mi(),mp=hp(),kp=Ya(),ji=Qa(),fp=new Map([["core",ww.schema],["failsafe",[bp.map,vp.seq,bw.string]],["json",yw.schema],["yaml11",mp.schema],["yaml-1.1",mp.schema]]),gp={binary:wp.binary,bool:vw.boolTag,float:to.float,floatExp:to.floatExp,floatNaN:to.floatNaN,floatTime:ji.floatTime,int:no.int,intHex:no.intHex,intOct:no.intOct,intTime:ji.intTime,map:bp.map,merge:tr.merge,null:gw.nullTag,omap:yp.omap,pairs:xp.pairs,seq:vp.seq,set:kp.set,timestamp:ji.timestamp},xw={"tag:yaml.org,2002:binary":wp.binary,"tag:yaml.org,2002:merge":tr.merge,"tag:yaml.org,2002:omap":yp.omap,"tag:yaml.org,2002:pairs":xp.pairs,"tag:yaml.org,2002:set":kp.set,"tag:yaml.org,2002:timestamp":ji.timestamp};function kw(e,t,n){let r=fp.get(t);if(r&&!e)return n&&!r.includes(tr.merge)?r.concat(tr.merge):r.slice();let i=r;if(!i)if(Array.isArray(e))i=[];else{let s=Array.from(fp.keys()).filter(a=>a!=="yaml11").map(a=>JSON.stringify(a)).join(", ");throw new Error(`Unknown schema "${t}"; use one of ${s} or define customTags array`)}if(Array.isArray(e))for(let s of e)i=i.concat(s);else typeof e=="function"&&(i=e(i.slice()));return n&&(i=i.concat(tr.merge)),i.reduce((s,a)=>{let o=typeof a=="string"?gp[a]:a;if(!o){let c=JSON.stringify(a),l=Object.keys(gp).map(u=>JSON.stringify(u)).join(", ");throw new Error(`Unknown custom tag ${c}; use one of ${l}`)}return s.includes(o)||s.push(o),s},[])}ro.coreKnownTags=xw;ro.getTags=kw});var ao=B(Sp=>{"use strict";S();var io=V(),Tw=vn(),Sw=wn(),Cw=Yn(),Wi=Tp(),Ew=(e,t)=>e.key<t.key?-1:e.key>t.key?1:0,so=class e{constructor({compat:t,customTags:n,merge:r,resolveKnownTags:i,schema:s,sortMapEntries:a,toStringDefaults:o}){this.compat=Array.isArray(t)?Wi.getTags(t,"compat"):t?Wi.getTags(null,t):null,this.name=typeof s=="string"&&s||"core",this.knownTags=i?Wi.coreKnownTags:{},this.tags=Wi.getTags(n,this.name,r),this.toStringOptions=o??null,Object.defineProperty(this,io.MAP,{value:Tw.map}),Object.defineProperty(this,io.SCALAR,{value:Cw.string}),Object.defineProperty(this,io.SEQ,{value:Sw.seq}),this.sortMapEntries=typeof a=="function"?a:a===!0?Ew:null}clone(){let t=Object.create(e.prototype,Object.getOwnPropertyDescriptors(this));return t.tags=this.tags.slice(),t}};Sp.Schema=so});var Ep=B(Cp=>{"use strict";S();var Aw=V(),oo=zn(),nr=jn();function _w(e,t){let n=[],r=t.directives===!0;if(t.directives!==!1&&e.directives){let c=e.directives.toString(e);c?(n.push(c),r=!0):e.directives.docStart&&(r=!0)}r&&n.push("---");let i=oo.createStringifyContext(e,t),{commentString:s}=i.options;if(e.commentBefore){n.length!==1&&n.unshift("");let c=s(e.commentBefore);n.unshift(nr.indentComment(c,""))}let a=!1,o=null;if(e.contents){if(Aw.isNode(e.contents)){if(e.contents.spaceBefore&&r&&n.push(""),e.contents.commentBefore){let u=s(e.contents.commentBefore);n.push(nr.indentComment(u,""))}i.forceBlockIndent=!!e.comment,o=e.contents.comment}let c=o?void 0:()=>a=!0,l=oo.stringify(e.contents,i,()=>o=null,c);o&&(l+=nr.lineComment(l,"",s(o))),(l[0]==="|"||l[0]===">")&&n[n.length-1]==="---"?n[n.length-1]=`--- ${l}`:n.push(l)}else n.push(oo.stringify(e.contents,i));if(e.directives?.docEnd)if(e.comment){let c=s(e.comment);c.includes(`
|
|
5183
|
+
`)?(n.push("..."),n.push(nr.indentComment(c,""))):n.push(`... ${c}`)}else n.push("...");else{let c=e.comment;c&&a&&(c=c.replace(/^\n+/,"")),c&&((!a||o)&&n[n.length-1]!==""&&n.push(""),n.push(nr.indentComment(s(c),"")))}return n.join(`
|
|
4172
5184
|
`)+`
|
|
4173
|
-
`}
|
|
4174
|
-
`),a=o+a}if(/[^ ]/.test(a)){let o=1,
|
|
5185
|
+
`}Cp.stringifyDocument=_w});var rr=B(Ap=>{"use strict";S();var Nw=Hn(),xn=di(),Me=V(),Iw=Pt(),Pw=At(),Ow=ao(),Rw=Ep(),lo=ai(),Lw=ua(),Mw=Un(),co=pa(),po=class e{constructor(t,n,r){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,Me.NODE_TYPE,{value:Me.DOC});let i=null;typeof n=="function"||Array.isArray(n)?i=n:r===void 0&&n&&(r=n,n=void 0);let s=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:"warn",prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:"1.2"},r);this.options=s;let{version:a}=s;r?._directives?(this.directives=r._directives.atDocument(),this.directives.yaml.explicit&&(a=this.directives.yaml.version)):this.directives=new co.Directives({version:a}),this.setSchema(a,r),this.contents=t===void 0?null:this.createNode(t,i,r)}clone(){let t=Object.create(e.prototype,{[Me.NODE_TYPE]:{value:Me.DOC}});return t.commentBefore=this.commentBefore,t.comment=this.comment,t.errors=this.errors.slice(),t.warnings=this.warnings.slice(),t.options=Object.assign({},this.options),this.directives&&(t.directives=this.directives.clone()),t.schema=this.schema.clone(),t.contents=Me.isNode(this.contents)?this.contents.clone(t.schema):this.contents,this.range&&(t.range=this.range.slice()),t}add(t){kn(this.contents)&&this.contents.add(t)}addIn(t,n){kn(this.contents)&&this.contents.addIn(t,n)}createAlias(t,n){if(!t.anchor){let r=lo.anchorNames(this);t.anchor=!n||r.has(n)?lo.findNewAnchor(n||"a",r):n}return new Nw.Alias(t.anchor)}createNode(t,n,r){let i;if(typeof n=="function")t=n.call({"":t},"",t),i=n;else if(Array.isArray(n)){let g=x=>typeof x=="number"||x instanceof String||x instanceof Number,y=n.filter(g).map(String);y.length>0&&(n=n.concat(y)),i=n}else r===void 0&&n&&(r=n,n=void 0);let{aliasDuplicateObjects:s,anchorPrefix:a,flow:o,keepUndefined:c,onTagObj:l,tag:u}=r??{},{onAnchor:d,setAnchors:p,sourceObjects:m}=lo.createNodeAnchors(this,a||"a"),f={aliasDuplicateObjects:s??!0,keepUndefined:c??!1,onAnchor:d,onTagObj:l,replacer:i,schema:this.schema,sourceObjects:m},h=Mw.createNode(t,u,f);return o&&Me.isCollection(h)&&(h.flow=!0),p(),h}createPair(t,n,r={}){let i=this.createNode(t,null,r),s=this.createNode(n,null,r);return new Iw.Pair(i,s)}delete(t){return kn(this.contents)?this.contents.delete(t):!1}deleteIn(t){return xn.isEmptyPath(t)?this.contents==null?!1:(this.contents=null,!0):kn(this.contents)?this.contents.deleteIn(t):!1}get(t,n){return Me.isCollection(this.contents)?this.contents.get(t,n):void 0}getIn(t,n){return xn.isEmptyPath(t)?!n&&Me.isScalar(this.contents)?this.contents.value:this.contents:Me.isCollection(this.contents)?this.contents.getIn(t,n):void 0}has(t){return Me.isCollection(this.contents)?this.contents.has(t):!1}hasIn(t){return xn.isEmptyPath(t)?this.contents!==void 0:Me.isCollection(this.contents)?this.contents.hasIn(t):!1}set(t,n){this.contents==null?this.contents=xn.collectionFromPath(this.schema,[t],n):kn(this.contents)&&this.contents.set(t,n)}setIn(t,n){xn.isEmptyPath(t)?this.contents=n:this.contents==null?this.contents=xn.collectionFromPath(this.schema,Array.from(t),n):kn(this.contents)&&this.contents.setIn(t,n)}setSchema(t,n={}){typeof t=="number"&&(t=String(t));let r;switch(t){case"1.1":this.directives?this.directives.yaml.version="1.1":this.directives=new co.Directives({version:"1.1"}),r={resolveKnownTags:!1,schema:"yaml-1.1"};break;case"1.2":case"next":this.directives?this.directives.yaml.version=t:this.directives=new co.Directives({version:t}),r={resolveKnownTags:!0,schema:"core"};break;case null:this.directives&&delete this.directives,r=null;break;default:{let i=JSON.stringify(t);throw new Error(`Expected '1.1', '1.2' or null as first argument, but found: ${i}`)}}if(n.schema instanceof Object)this.schema=n.schema;else if(r)this.schema=new Ow.Schema(Object.assign(r,n));else throw new Error("With a null YAML version, the { schema: Schema } option is required")}toJS({json:t,jsonArg:n,mapAsMap:r,maxAliasCount:i,onAnchor:s,reviver:a}={}){let o={anchors:new Map,doc:this,keep:!t,mapAsMap:r===!0,mapKeyWarned:!1,maxAliasCount:typeof i=="number"?i:100},c=Pw.toJS(this.contents,n??"",o);if(typeof s=="function")for(let{count:l,res:u}of o.anchors.values())s(u,l);return typeof a=="function"?Lw.applyReviver(a,{"":c},"",c):c}toJSON(t,n){return this.toJS({json:!0,jsonArg:t,mapAsMap:!1,onAnchor:n})}toString(t={}){if(this.errors.length>0)throw new Error("Document with errors cannot be stringified");if("indent"in t&&(!Number.isInteger(t.indent)||Number(t.indent)<=0)){let n=JSON.stringify(t.indent);throw new Error(`"indent" option must be a positive integer, not ${n}`)}return Rw.stringifyDocument(this,t)}};function kn(e){if(Me.isCollection(e))return!0;throw new Error("Expected a YAML collection as document contents")}Ap.Document=po});var ar=B(sr=>{"use strict";S();var ir=class extends Error{constructor(t,n,r,i){super(),this.name=t,this.code=r,this.message=i,this.pos=n}},uo=class extends ir{constructor(t,n,r){super("YAMLParseError",t,n,r)}},ho=class extends ir{constructor(t,n,r){super("YAMLWarning",t,n,r)}},Dw=(e,t)=>n=>{if(n.pos[0]===-1)return;n.linePos=n.pos.map(o=>t.linePos(o));let{line:r,col:i}=n.linePos[0];n.message+=` at line ${r}, column ${i}`;let s=i-1,a=e.substring(t.lineStarts[r-1],t.lineStarts[r]).replace(/[\n\r]+$/,"");if(s>=60&&a.length>80){let o=Math.min(s-39,a.length-79);a="\u2026"+a.substring(o),s-=o-1}if(a.length>80&&(a=a.substring(0,79)+"\u2026"),r>1&&/^ *$/.test(a.substring(0,s))){let o=e.substring(t.lineStarts[r-2],t.lineStarts[r-1]);o.length>80&&(o=o.substring(0,79)+`\u2026
|
|
5186
|
+
`),a=o+a}if(/[^ ]/.test(a)){let o=1,c=n.linePos[1];c?.line===r&&c.col>i&&(o=Math.max(1,Math.min(c.col-i,80-s)));let l=" ".repeat(s)+"^".repeat(o);n.message+=`:
|
|
4175
5187
|
|
|
4176
5188
|
${a}
|
|
4177
|
-
${
|
|
4178
|
-
`}};
|
|
4179
|
-
`))return!0;if(e.end){for(let t of e.end)if(t.type==="newline")return!0}return!1;case"flow-collection":for(let t of e.items){for(let n of t.start)if(n.type==="newline")return!0;if(t.sep){for(let n of t.sep)if(n.type==="newline")return!0}if(
|
|
4180
|
-
`+h.comment:o.comment=h.comment);continue}(h.newlineAfterProp||
|
|
4181
|
-
`+b.comment:
|
|
4182
|
-
`+
|
|
4183
|
-
`+T:
|
|
4184
|
-
`+
|
|
4185
|
-
`+g.comment:
|
|
4186
|
-
`.repeat(Math.max(1,a.length-1)):"",g=r+i.length;return t.source&&(g+=t.source.length),{value:h,type:s,comment:i.comment,range:[r,g,g]}}let
|
|
4187
|
-
`;for(let h=
|
|
4188
|
-
`):g.length>
|
|
4189
|
-
`:!
|
|
4190
|
-
`&&(
|
|
4191
|
-
|
|
4192
|
-
`),p
|
|
4193
|
-
`,
|
|
4194
|
-
`?
|
|
4195
|
-
`:
|
|
4196
|
-
`:(p
|
|
4197
|
-
`+a[h][0].slice(
|
|
4198
|
-
`&&(
|
|
4199
|
-
`);break;default:
|
|
4200
|
-
`}let
|
|
5189
|
+
${l}
|
|
5190
|
+
`}};sr.YAMLError=ir;sr.YAMLParseError=uo;sr.YAMLWarning=ho;sr.prettifyError=Dw});var or=B(_p=>{"use strict";S();function Bw(e,{flow:t,indicator:n,next:r,offset:i,onError:s,parentIndent:a,startOnNewline:o}){let c=!1,l=o,u=o,d="",p="",m=!1,f=!1,h=null,g=null,y=null,x=null,b=null,E=null,_=null;for(let w of e)switch(f&&(w.type!=="space"&&w.type!=="newline"&&w.type!=="comma"&&s(w.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),f=!1),h&&(l&&w.type!=="comment"&&w.type!=="newline"&&s(h,"TAB_AS_INDENT","Tabs are not allowed as indentation"),h=null),w.type){case"space":!t&&(n!=="doc-start"||r?.type!=="flow-collection")&&w.source.includes(" ")&&(h=w),u=!0;break;case"comment":{u||s(w,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let A=w.source.substring(1)||" ";d?d+=p+A:d=A,p="",l=!1;break}case"newline":l?d?d+=w.source:(!E||n!=="seq-item-ind")&&(c=!0):p+=w.source,l=!0,m=!0,(g||y)&&(x=w),u=!0;break;case"anchor":g&&s(w,"MULTIPLE_ANCHORS","A node can have at most one anchor"),w.source.endsWith(":")&&s(w.offset+w.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0),g=w,_??(_=w.offset),l=!1,u=!1,f=!0;break;case"tag":{y&&s(w,"MULTIPLE_TAGS","A node can have at most one tag"),y=w,_??(_=w.offset),l=!1,u=!1,f=!0;break}case n:(g||y)&&s(w,"BAD_PROP_ORDER",`Anchors and tags must be after the ${w.source} indicator`),E&&s(w,"UNEXPECTED_TOKEN",`Unexpected ${w.source} in ${t??"collection"}`),E=w,l=n==="seq-item-ind"||n==="explicit-key-ind",u=!1;break;case"comma":if(t){b&&s(w,"UNEXPECTED_TOKEN",`Unexpected , in ${t}`),b=w,l=!1,u=!1;break}default:s(w,"UNEXPECTED_TOKEN",`Unexpected ${w.type} token`),l=!1,u=!1}let v=e[e.length-1],T=v?v.offset+v.source.length:i;return f&&r&&r.type!=="space"&&r.type!=="newline"&&r.type!=="comma"&&(r.type!=="scalar"||r.source!=="")&&s(r.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),h&&(l&&h.indent<=a||r?.type==="block-map"||r?.type==="block-seq")&&s(h,"TAB_AS_INDENT","Tabs are not allowed as indentation"),{comma:b,found:E,spaceBefore:c,comment:d,hasNewline:m,anchor:g,tag:y,newlineAfterProp:x,end:T,start:_??T}}_p.resolveProps=Bw});var Ki=B(Np=>{"use strict";S();function mo(e){if(!e)return null;switch(e.type){case"alias":case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":if(e.source.includes(`
|
|
5191
|
+
`))return!0;if(e.end){for(let t of e.end)if(t.type==="newline")return!0}return!1;case"flow-collection":for(let t of e.items){for(let n of t.start)if(n.type==="newline")return!0;if(t.sep){for(let n of t.sep)if(n.type==="newline")return!0}if(mo(t.key)||mo(t.value))return!0}return!1;default:return!0}}Np.containsNewline=mo});var fo=B(Ip=>{"use strict";S();var $w=Ki();function Fw(e,t,n){if(t?.type==="flow-collection"){let r=t.end[0];r.indent===e&&(r.source==="]"||r.source==="}")&&$w.containsNewline(t)&&n(r,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}Ip.flowIndentCheck=Fw});var go=B(Op=>{"use strict";S();var Pp=V();function qw(e,t,n){let{uniqueKeys:r}=e.options;if(r===!1)return!1;let i=typeof r=="function"?r:(s,a)=>s===a||Pp.isScalar(s)&&Pp.isScalar(a)&&s.value===a.value;return t.some(s=>i(s.key,n))}Op.mapIncludes=qw});var $p=B(Bp=>{"use strict";S();var Rp=Pt(),Hw=Rt(),Lp=or(),Uw=Ki(),Mp=fo(),jw=go(),Dp="All mapping items must start at the same column";function Ww({composeNode:e,composeEmptyNode:t},n,r,i,s){let a=s?.nodeClass??Hw.YAMLMap,o=new a(n.schema);n.atRoot&&(n.atRoot=!1);let c=r.offset,l=null;for(let u of r.items){let{start:d,key:p,sep:m,value:f}=u,h=Lp.resolveProps(d,{indicator:"explicit-key-ind",next:p??m?.[0],offset:c,onError:i,parentIndent:r.indent,startOnNewline:!0}),g=!h.found;if(g){if(p&&(p.type==="block-seq"?i(c,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key"):"indent"in p&&p.indent!==r.indent&&i(c,"BAD_INDENT",Dp)),!h.anchor&&!h.tag&&!m){l=h.end,h.comment&&(o.comment?o.comment+=`
|
|
5192
|
+
`+h.comment:o.comment=h.comment);continue}(h.newlineAfterProp||Uw.containsNewline(p))&&i(p??d[d.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else h.found?.indent!==r.indent&&i(c,"BAD_INDENT",Dp);n.atKey=!0;let y=h.end,x=p?e(n,p,h,i):t(n,y,d,null,h,i);n.schema.compat&&Mp.flowIndentCheck(r.indent,p,i),n.atKey=!1,jw.mapIncludes(n,o.items,x)&&i(y,"DUPLICATE_KEY","Map keys must be unique");let b=Lp.resolveProps(m??[],{indicator:"map-value-ind",next:f,offset:x.range[2],onError:i,parentIndent:r.indent,startOnNewline:!p||p.type==="block-scalar"});if(c=b.end,b.found){g&&(f?.type==="block-map"&&!b.hasNewline&&i(c,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings"),n.options.strict&&h.start<b.found.offset-1024&&i(x.range,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit block mapping key"));let E=f?e(n,f,b,i):t(n,c,m,null,b,i);n.schema.compat&&Mp.flowIndentCheck(r.indent,f,i),c=E.range[2];let _=new Rp.Pair(x,E);n.options.keepSourceTokens&&(_.srcToken=u),o.items.push(_)}else{g&&i(x.range,"MISSING_CHAR","Implicit map keys need to be followed by map values"),b.comment&&(x.comment?x.comment+=`
|
|
5193
|
+
`+b.comment:x.comment=b.comment);let E=new Rp.Pair(x);n.options.keepSourceTokens&&(E.srcToken=u),o.items.push(E)}}return l&&l<c&&i(l,"IMPOSSIBLE","Map comment with trailing content"),o.range=[r.offset,c,l??c],o}Bp.resolveBlockMap=Ww});var qp=B(Fp=>{"use strict";S();var Kw=Lt(),Gw=or(),zw=fo();function Vw({composeNode:e,composeEmptyNode:t},n,r,i,s){let a=s?.nodeClass??Kw.YAMLSeq,o=new a(n.schema);n.atRoot&&(n.atRoot=!1),n.atKey&&(n.atKey=!1);let c=r.offset,l=null;for(let{start:u,value:d}of r.items){let p=Gw.resolveProps(u,{indicator:"seq-item-ind",next:d,offset:c,onError:i,parentIndent:r.indent,startOnNewline:!0});if(!p.found)if(p.anchor||p.tag||d)d?.type==="block-seq"?i(p.end,"BAD_INDENT","All sequence items must start at the same column"):i(c,"MISSING_CHAR","Sequence item without - indicator");else{l=p.end,p.comment&&(o.comment=p.comment);continue}let m=d?e(n,d,p,i):t(n,p.end,u,null,p,i);n.schema.compat&&zw.flowIndentCheck(r.indent,d,i),c=m.range[2],o.items.push(m)}return o.range=[r.offset,c,l??c],o}Fp.resolveBlockSeq=Vw});var Tn=B(Hp=>{"use strict";S();function Xw(e,t,n,r){let i="";if(e){let s=!1,a="";for(let o of e){let{source:c,type:l}=o;switch(l){case"space":s=!0;break;case"comment":{n&&!s&&r(o,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let u=c.substring(1)||" ";i?i+=a+u:i=u,a="";break}case"newline":i&&(a+=c),s=!0;break;default:r(o,"UNEXPECTED_TOKEN",`Unexpected ${l} at node end`)}t+=c.length}}return{comment:i,offset:t}}Hp.resolveEnd=Xw});var Kp=B(Wp=>{"use strict";S();var Yw=V(),Jw=Pt(),Up=Rt(),Qw=Lt(),Zw=Tn(),jp=or(),e0=Ki(),t0=go(),bo="Block collections are not allowed within flow collections",vo=e=>e&&(e.type==="block-map"||e.type==="block-seq");function n0({composeNode:e,composeEmptyNode:t},n,r,i,s){let a=r.start.source==="{",o=a?"flow map":"flow sequence",c=s?.nodeClass??(a?Up.YAMLMap:Qw.YAMLSeq),l=new c(n.schema);l.flow=!0;let u=n.atRoot;u&&(n.atRoot=!1),n.atKey&&(n.atKey=!1);let d=r.offset+r.start.source.length;for(let g=0;g<r.items.length;++g){let y=r.items[g],{start:x,key:b,sep:E,value:_}=y,v=jp.resolveProps(x,{flow:o,indicator:"explicit-key-ind",next:b??E?.[0],offset:d,onError:i,parentIndent:r.indent,startOnNewline:!1});if(!v.found){if(!v.anchor&&!v.tag&&!E&&!_){g===0&&v.comma?i(v.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${o}`):g<r.items.length-1&&i(v.start,"UNEXPECTED_TOKEN",`Unexpected empty item in ${o}`),v.comment&&(l.comment?l.comment+=`
|
|
5194
|
+
`+v.comment:l.comment=v.comment),d=v.end;continue}!a&&n.options.strict&&e0.containsNewline(b)&&i(b,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line")}if(g===0)v.comma&&i(v.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${o}`);else if(v.comma||i(v.start,"MISSING_CHAR",`Missing , between ${o} items`),v.comment){let T="";e:for(let w of x)switch(w.type){case"comma":case"space":break;case"comment":T=w.source.substring(1);break e;default:break e}if(T){let w=l.items[l.items.length-1];Yw.isPair(w)&&(w=w.value??w.key),w.comment?w.comment+=`
|
|
5195
|
+
`+T:w.comment=T,v.comment=v.comment.substring(T.length+1)}}if(!a&&!E&&!v.found){let T=_?e(n,_,v,i):t(n,v.end,E,null,v,i);l.items.push(T),d=T.range[2],vo(_)&&i(T.range,"BLOCK_IN_FLOW",bo)}else{n.atKey=!0;let T=v.end,w=b?e(n,b,v,i):t(n,T,x,null,v,i);vo(b)&&i(w.range,"BLOCK_IN_FLOW",bo),n.atKey=!1;let A=jp.resolveProps(E??[],{flow:o,indicator:"map-value-ind",next:_,offset:w.range[2],onError:i,parentIndent:r.indent,startOnNewline:!1});if(A.found){if(!a&&!v.found&&n.options.strict){if(E)for(let L of E){if(L===A.found)break;if(L.type==="newline"){i(L,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line");break}}v.start<A.found.offset-1024&&i(A.found,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit flow sequence key")}}else _&&("source"in _&&_.source?.[0]===":"?i(_,"MISSING_CHAR",`Missing space after : in ${o}`):i(A.start,"MISSING_CHAR",`Missing , or : between ${o} items`));let N=_?e(n,_,A,i):A.found?t(n,A.end,E,null,A,i):null;N?vo(_)&&i(N.range,"BLOCK_IN_FLOW",bo):A.comment&&(w.comment?w.comment+=`
|
|
5196
|
+
`+A.comment:w.comment=A.comment);let M=new Jw.Pair(w,N);if(n.options.keepSourceTokens&&(M.srcToken=y),a){let L=l;t0.mapIncludes(n,L.items,w)&&i(T,"DUPLICATE_KEY","Map keys must be unique"),L.items.push(M)}else{let L=new Up.YAMLMap(n.schema);L.flow=!0,L.items.push(M);let F=(N??w).range;L.range=[w.range[0],F[1],F[2]],l.items.push(L)}d=N?N.range[2]:A.end}}let p=a?"}":"]",[m,...f]=r.end,h=d;if(m?.source===p)h=m.offset+m.source.length;else{let g=o[0].toUpperCase()+o.substring(1),y=u?`${g} must end with a ${p}`:`${g} in block collection must be sufficiently indented and end with a ${p}`;i(d,u?"MISSING_CHAR":"BAD_INDENT",y),m&&m.source.length!==1&&f.unshift(m)}if(f.length>0){let g=Zw.resolveEnd(f,h,n.options.strict,i);g.comment&&(l.comment?l.comment+=`
|
|
5197
|
+
`+g.comment:l.comment=g.comment),l.range=[r.offset,h,g.offset]}else l.range=[r.offset,h,h];return l}Wp.resolveFlowCollection=n0});var zp=B(Gp=>{"use strict";S();var r0=V(),i0=de(),s0=Rt(),a0=Lt(),o0=$p(),l0=qp(),c0=Kp();function wo(e,t,n,r,i,s){let a=n.type==="block-map"?o0.resolveBlockMap(e,t,n,r,s):n.type==="block-seq"?l0.resolveBlockSeq(e,t,n,r,s):c0.resolveFlowCollection(e,t,n,r,s),o=a.constructor;return i==="!"||i===o.tagName?(a.tag=o.tagName,a):(i&&(a.tag=i),a)}function d0(e,t,n,r,i){let s=r.tag,a=s?t.directives.tagName(s.source,p=>i(s,"TAG_RESOLVE_FAILED",p)):null;if(n.type==="block-seq"){let{anchor:p,newlineAfterProp:m}=r,f=p&&s?p.offset>s.offset?p:s:p??s;f&&(!m||m.offset<f.offset)&&i(f,"MISSING_CHAR","Missing newline after block sequence props")}let o=n.type==="block-map"?"map":n.type==="block-seq"?"seq":n.start.source==="{"?"map":"seq";if(!s||!a||a==="!"||a===s0.YAMLMap.tagName&&o==="map"||a===a0.YAMLSeq.tagName&&o==="seq")return wo(e,t,n,i,a);let c=t.schema.tags.find(p=>p.tag===a&&p.collection===o);if(!c){let p=t.schema.knownTags[a];if(p?.collection===o)t.schema.tags.push(Object.assign({},p,{default:!1})),c=p;else return p?i(s,"BAD_COLLECTION_TYPE",`${p.tag} used for ${o} collection, but expects ${p.collection??"scalar"}`,!0):i(s,"TAG_RESOLVE_FAILED",`Unresolved tag: ${a}`,!0),wo(e,t,n,i,a)}let l=wo(e,t,n,i,a,c),u=c.resolve?.(l,p=>i(s,"TAG_RESOLVE_FAILED",p),t.options)??l,d=r0.isNode(u)?u:new i0.Scalar(u);return d.range=l.range,d.tag=a,c?.format&&(d.format=c.format),d}Gp.composeCollection=d0});var xo=B(Vp=>{"use strict";S();var yo=de();function p0(e,t,n){let r=t.offset,i=u0(t,e.options.strict,n);if(!i)return{value:"",type:null,comment:"",range:[r,r,r]};let s=i.mode===">"?yo.Scalar.BLOCK_FOLDED:yo.Scalar.BLOCK_LITERAL,a=t.source?h0(t.source):[],o=a.length;for(let h=a.length-1;h>=0;--h){let g=a[h][1];if(g===""||g==="\r")o=h;else break}if(o===0){let h=i.chomp==="+"&&a.length>0?`
|
|
5198
|
+
`.repeat(Math.max(1,a.length-1)):"",g=r+i.length;return t.source&&(g+=t.source.length),{value:h,type:s,comment:i.comment,range:[r,g,g]}}let c=t.indent+i.indent,l=t.offset+i.length,u=0;for(let h=0;h<o;++h){let[g,y]=a[h];if(y===""||y==="\r")i.indent===0&&g.length>c&&(c=g.length);else{g.length<c&&n(l+g.length,"MISSING_CHAR","Block scalars with more-indented leading empty lines must use an explicit indentation indicator"),i.indent===0&&(c=g.length),u=h,c===0&&!e.atRoot&&n(l,"BAD_INDENT","Block scalar values in collections must be indented");break}l+=g.length+y.length+1}for(let h=a.length-1;h>=o;--h)a[h][0].length>c&&(o=h+1);let d="",p="",m=!1;for(let h=0;h<u;++h)d+=a[h][0].slice(c)+`
|
|
5199
|
+
`;for(let h=u;h<o;++h){let[g,y]=a[h];l+=g.length+y.length+1;let x=y[y.length-1]==="\r";if(x&&(y=y.slice(0,-1)),y&&g.length<c){let E=`Block scalar lines must not be less indented than their ${i.indent?"explicit indentation indicator":"first line"}`;n(l-y.length-(x?2:1),"BAD_INDENT",E),g=""}s===yo.Scalar.BLOCK_LITERAL?(d+=p+g.slice(c)+y,p=`
|
|
5200
|
+
`):g.length>c||y[0]===" "?(p===" "?p=`
|
|
5201
|
+
`:!m&&p===`
|
|
5202
|
+
`&&(p=`
|
|
5203
|
+
|
|
5204
|
+
`),d+=p+g.slice(c)+y,p=`
|
|
5205
|
+
`,m=!0):y===""?p===`
|
|
5206
|
+
`?d+=`
|
|
5207
|
+
`:p=`
|
|
5208
|
+
`:(d+=p+y,p=" ",m=!1)}switch(i.chomp){case"-":break;case"+":for(let h=o;h<a.length;++h)d+=`
|
|
5209
|
+
`+a[h][0].slice(c);d[d.length-1]!==`
|
|
5210
|
+
`&&(d+=`
|
|
5211
|
+
`);break;default:d+=`
|
|
5212
|
+
`}let f=r+i.length+t.source.length;return{value:d,type:s,comment:i.comment,range:[r,f,f]}}function u0({offset:e,props:t},n,r){if(t[0].type!=="block-scalar-header")return r(t[0],"IMPOSSIBLE","Block scalar header not found"),null;let{source:i}=t[0],s=i[0],a=0,o="",c=-1;for(let p=1;p<i.length;++p){let m=i[p];if(!o&&(m==="-"||m==="+"))o=m;else{let f=Number(m);!a&&f?a=f:c===-1&&(c=e+p)}}c!==-1&&r(c,"UNEXPECTED_TOKEN",`Block scalar header includes extra characters: ${i}`);let l=!1,u="",d=i.length;for(let p=1;p<t.length;++p){let m=t[p];switch(m.type){case"space":l=!0;case"newline":d+=m.source.length;break;case"comment":n&&!l&&r(m,"MISSING_CHAR","Comments must be separated from other tokens by white space characters"),d+=m.source.length,u=m.source.substring(1);break;case"error":r(m,"UNEXPECTED_TOKEN",m.message),d+=m.source.length;break;default:{let f=`Unexpected token in block scalar header: ${m.type}`;r(m,"UNEXPECTED_TOKEN",f);let h=m.source;h&&typeof h=="string"&&(d+=h.length)}}}return{mode:s,indent:a,chomp:o,comment:u,length:d}}function h0(e){let t=e.split(/\n( *)/),n=t[0],r=n.match(/^( *)/),s=[r?.[1]?[r[1],n.slice(r[1].length)]:["",n]];for(let a=1;a<t.length;a+=2)s.push([t[a],t[a+1]]);return s}Vp.resolveBlockScalar=p0});var To=B(Yp=>{"use strict";S();var ko=de(),m0=Tn();function f0(e,t,n){let{offset:r,type:i,source:s,end:a}=e,o,c,l=(p,m,f)=>n(r+p,m,f);switch(i){case"scalar":o=ko.Scalar.PLAIN,c=g0(s,l);break;case"single-quoted-scalar":o=ko.Scalar.QUOTE_SINGLE,c=b0(s,l);break;case"double-quoted-scalar":o=ko.Scalar.QUOTE_DOUBLE,c=v0(s,l);break;default:return n(e,"UNEXPECTED_TOKEN",`Expected a flow scalar value, but found: ${i}`),{value:"",type:null,comment:"",range:[r,r+s.length,r+s.length]}}let u=r+s.length,d=m0.resolveEnd(a,u,t,n);return{value:c,type:o,comment:d.comment,range:[r,u,d.offset]}}function g0(e,t){let n="";switch(e[0]){case" ":n="a tab character";break;case",":n="flow indicator character ,";break;case"%":n="directive indicator character %";break;case"|":case">":{n=`block scalar indicator ${e[0]}`;break}case"@":case"`":{n=`reserved character ${e[0]}`;break}}return n&&t(0,"BAD_SCALAR_START",`Plain value cannot start with ${n}`),Xp(e)}function b0(e,t){return(e[e.length-1]!=="'"||e.length===1)&&t(e.length,"MISSING_CHAR","Missing closing 'quote"),Xp(e.slice(1,-1)).replace(/''/g,"'")}function Xp(e){let t,n;try{t=new RegExp(`(.*?)(?<![ ])[ ]*\r?
|
|
4201
5213
|
`,"sy"),n=new RegExp(`[ ]*(.*?)(?:(?<![ ])[ ]*)?\r?
|
|
4202
5214
|
`,"sy")}catch{t=/(.*?)[ \t]*\r?\n/sy,n=/[ \t]*(.*?)[ \t]*\r?\n/sy}let r=t.exec(e);if(!r)return e;let i=r[1],s=" ",a=t.lastIndex;for(n.lastIndex=a;r=n.exec(e);)r[1]===""?s===`
|
|
4203
5215
|
`?i+=s:s=`
|
|
4204
|
-
`:(i+=s+r[1],s=" "),a=n.lastIndex;let o=/[ \t]*(.*)/sy;return o.lastIndex=a,r=o.exec(e),i+s+(r?.[1]??"")}function
|
|
5216
|
+
`:(i+=s+r[1],s=" "),a=n.lastIndex;let o=/[ \t]*(.*)/sy;return o.lastIndex=a,r=o.exec(e),i+s+(r?.[1]??"")}function v0(e,t){let n="";for(let r=1;r<e.length-1;++r){let i=e[r];if(!(i==="\r"&&e[r+1]===`
|
|
4205
5217
|
`))if(i===`
|
|
4206
|
-
`){let{fold:s,offset:a}=
|
|
5218
|
+
`){let{fold:s,offset:a}=w0(e,r);n+=s,r=a}else if(i==="\\"){let s=e[++r],a=y0[s];if(a)n+=a;else if(s===`
|
|
4207
5219
|
`)for(s=e[r+1];s===" "||s===" ";)s=e[++r+1];else if(s==="\r"&&e[r+1]===`
|
|
4208
|
-
`)for(s=e[++r+1];s===" "||s===" ";)s=e[++r+1];else if(s==="x"||s==="u"||s==="U"){let o=s==="x"?2:s==="u"?4:8;n+=
|
|
5220
|
+
`)for(s=e[++r+1];s===" "||s===" ";)s=e[++r+1];else if(s==="x"||s==="u"||s==="U"){let o=s==="x"?2:s==="u"?4:8;n+=x0(e,r+1,o,t),r+=o}else{let o=e.substr(r-1,2);t(r-1,"BAD_DQ_ESCAPE",`Invalid escape sequence ${o}`),n+=o}}else if(i===" "||i===" "){let s=r,a=e[r+1];for(;a===" "||a===" ";)a=e[++r+1];a!==`
|
|
4209
5221
|
`&&!(a==="\r"&&e[r+2]===`
|
|
4210
|
-
`)&&(n+=r>s?e.slice(s,r+1):i)}else n+=i}return(e[e.length-1]!=='"'||e.length===1)&&t(e.length,"MISSING_CHAR",'Missing closing "quote'),n}function
|
|
5222
|
+
`)&&(n+=r>s?e.slice(s,r+1):i)}else n+=i}return(e[e.length-1]!=='"'||e.length===1)&&t(e.length,"MISSING_CHAR",'Missing closing "quote'),n}function w0(e,t){let n="",r=e[t+1];for(;(r===" "||r===" "||r===`
|
|
4211
5223
|
`||r==="\r")&&!(r==="\r"&&e[t+2]!==`
|
|
4212
5224
|
`);)r===`
|
|
4213
5225
|
`&&(n+=`
|
|
4214
|
-
`),t+=1,r=e[t+1];return n||(n=" "),{fold:n,offset:t}}var
|
|
4215
|
-
`,r:"\r",t:" ",v:"\v",N:"\x85",_:"\xA0",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\"," ":" "};function
|
|
5226
|
+
`),t+=1,r=e[t+1];return n||(n=" "),{fold:n,offset:t}}var y0={0:"\0",a:"\x07",b:"\b",e:"\x1B",f:"\f",n:`
|
|
5227
|
+
`,r:"\r",t:" ",v:"\v",N:"\x85",_:"\xA0",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\"," ":" "};function x0(e,t,n,r){let i=e.substr(t,n),a=i.length===n&&/^[0-9a-fA-F]+$/.test(i)?parseInt(i,16):NaN;try{return String.fromCodePoint(a)}catch{let o=e.substr(t-2,n+2);return r(t-2,"BAD_DQ_ESCAPE",`Invalid escape sequence ${o}`),o}}Yp.resolveFlowScalar=f0});var Zp=B(Qp=>{"use strict";S();var Vt=V(),Jp=de(),k0=xo(),T0=To();function S0(e,t,n,r){let{value:i,type:s,comment:a,range:o}=t.type==="block-scalar"?k0.resolveBlockScalar(e,t,r):T0.resolveFlowScalar(t,e.options.strict,r),c=n?e.directives.tagName(n.source,d=>r(n,"TAG_RESOLVE_FAILED",d)):null,l;e.options.stringKeys&&e.atKey?l=e.schema[Vt.SCALAR]:c?l=C0(e.schema,i,c,n,r):t.type==="scalar"?l=E0(e,i,t,r):l=e.schema[Vt.SCALAR];let u;try{let d=l.resolve(i,p=>r(n??t,"TAG_RESOLVE_FAILED",p),e.options);u=Vt.isScalar(d)?d:new Jp.Scalar(d)}catch(d){let p=d instanceof Error?d.message:String(d);r(n??t,"TAG_RESOLVE_FAILED",p),u=new Jp.Scalar(i)}return u.range=o,u.source=i,s&&(u.type=s),c&&(u.tag=c),l.format&&(u.format=l.format),a&&(u.comment=a),u}function C0(e,t,n,r,i){if(n==="!")return e[Vt.SCALAR];let s=[];for(let o of e.tags)if(!o.collection&&o.tag===n)if(o.default&&o.test)s.push(o);else return o;for(let o of s)if(o.test?.test(t))return o;let a=e.knownTags[n];return a&&!a.collection?(e.tags.push(Object.assign({},a,{default:!1,test:void 0})),a):(i(r,"TAG_RESOLVE_FAILED",`Unresolved tag: ${n}`,n!=="tag:yaml.org,2002:str"),e[Vt.SCALAR])}function E0({atKey:e,directives:t,schema:n},r,i,s){let a=n.tags.find(o=>(o.default===!0||e&&o.default==="key")&&o.test?.test(r))||n[Vt.SCALAR];if(n.compat){let o=n.compat.find(c=>c.default&&c.test?.test(r))??n[Vt.SCALAR];if(a.tag!==o.tag){let c=t.tagString(a.tag),l=t.tagString(o.tag),u=`Value may be parsed as either ${c} or ${l}`;s(i,"TAG_RESOLVE_FAILED",u,!0)}}return a}Qp.composeScalar=S0});var tu=B(eu=>{"use strict";S();function A0(e,t,n){if(t){n??(n=t.length);for(let r=n-1;r>=0;--r){let i=t[r];switch(i.type){case"space":case"comment":case"newline":e-=i.source.length;continue}for(i=t[++r];i?.type==="space";)e+=i.source.length,i=t[++r];break}}return e}eu.emptyScalarPosition=A0});var iu=B(Co=>{"use strict";S();var _0=Hn(),N0=V(),I0=zp(),nu=Zp(),P0=Tn(),O0=tu(),R0={composeNode:ru,composeEmptyNode:So};function ru(e,t,n,r){let i=e.atKey,{spaceBefore:s,comment:a,anchor:o,tag:c}=n,l,u=!0;switch(t.type){case"alias":l=L0(e,t,r),(o||c)&&r(t,"ALIAS_PROPS","An alias node must not specify any properties");break;case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"block-scalar":l=nu.composeScalar(e,t,c,r),o&&(l.anchor=o.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":try{l=I0.composeCollection(R0,e,t,n,r),o&&(l.anchor=o.source.substring(1))}catch(d){let p=d instanceof Error?d.message:String(d);r(t,"RESOURCE_EXHAUSTION",p)}break;default:{let d=t.type==="error"?t.message:`Unsupported token (type: ${t.type})`;r(t,"UNEXPECTED_TOKEN",d),u=!1}}return l??(l=So(e,t.offset,void 0,null,n,r)),o&&l.anchor===""&&r(o,"BAD_ALIAS","Anchor cannot be an empty string"),i&&e.options.stringKeys&&(!N0.isScalar(l)||typeof l.value!="string"||l.tag&&l.tag!=="tag:yaml.org,2002:str")&&r(c??t,"NON_STRING_KEY","With stringKeys, all keys must be strings"),s&&(l.spaceBefore=!0),a&&(t.type==="scalar"&&t.source===""?l.comment=a:l.commentBefore=a),e.options.keepSourceTokens&&u&&(l.srcToken=t),l}function So(e,t,n,r,{spaceBefore:i,comment:s,anchor:a,tag:o,end:c},l){let u={type:"scalar",offset:O0.emptyScalarPosition(t,n,r),indent:-1,source:""},d=nu.composeScalar(e,u,o,l);return a&&(d.anchor=a.source.substring(1),d.anchor===""&&l(a,"BAD_ALIAS","Anchor cannot be an empty string")),i&&(d.spaceBefore=!0),s&&(d.comment=s,d.range[2]=c),d}function L0({options:e},{offset:t,source:n,end:r},i){let s=new _0.Alias(n.substring(1));s.source===""&&i(t,"BAD_ALIAS","Alias cannot be an empty string"),s.source.endsWith(":")&&i(t+n.length-1,"BAD_ALIAS","Alias ending in : is ambiguous",!0);let a=t+n.length,o=P0.resolveEnd(r,a,e.strict,i);return s.range=[t,a,o.offset],o.comment&&(s.comment=o.comment),s}Co.composeEmptyNode=So;Co.composeNode=ru});var ou=B(au=>{"use strict";S();var M0=rr(),su=iu(),D0=Tn(),B0=or();function $0(e,t,{offset:n,start:r,value:i,end:s},a){let o=Object.assign({_directives:t},e),c=new M0.Document(void 0,o),l={atKey:!1,atRoot:!0,directives:c.directives,options:c.options,schema:c.schema},u=B0.resolveProps(r,{indicator:"doc-start",next:i??s?.[0],offset:n,onError:a,parentIndent:0,startOnNewline:!0});u.found&&(c.directives.docStart=!0,i&&(i.type==="block-map"||i.type==="block-seq")&&!u.hasNewline&&a(u.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")),c.contents=i?su.composeNode(l,i,u,a):su.composeEmptyNode(l,u.end,r,null,u,a);let d=c.contents.range[2],p=D0.resolveEnd(s,d,!1,a);return p.comment&&(c.comment=p.comment),c.range=[n,d,p.offset],c}au.composeDoc=$0});var Ao=B(du=>{"use strict";S();var F0=Jr("process"),q0=pa(),H0=rr(),lr=ar(),lu=V(),U0=ou(),j0=Tn();function cr(e){if(typeof e=="number")return[e,e+1];if(Array.isArray(e))return e.length===2?e:[e[0],e[1]];let{offset:t,source:n}=e;return[t,t+(typeof n=="string"?n.length:1)]}function cu(e){let t="",n=!1,r=!1;for(let i=0;i<e.length;++i){let s=e[i];switch(s[0]){case"#":t+=(t===""?"":r?`
|
|
4216
5228
|
|
|
4217
5229
|
`:`
|
|
4218
|
-
`)+(s.substring(1)||" "),n=!0,r=!1;break;case"%":e[i+1]?.[0]!=="#"&&(i+=1),n=!1;break;default:n||(r=!0),n=!1}}return{comment:t,afterEmptyLine:r}}var
|
|
4219
|
-
${r}`:r;else if(i||t.directives.docStart||!s)t.commentBefore=r;else if(
|
|
5230
|
+
`)+(s.substring(1)||" "),n=!0,r=!1;break;case"%":e[i+1]?.[0]!=="#"&&(i+=1),n=!1;break;default:n||(r=!0),n=!1}}return{comment:t,afterEmptyLine:r}}var Eo=class{constructor(t={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(n,r,i,s)=>{let a=cr(n);s?this.warnings.push(new lr.YAMLWarning(a,r,i)):this.errors.push(new lr.YAMLParseError(a,r,i))},this.directives=new q0.Directives({version:t.version||"1.2"}),this.options=t}decorate(t,n){let{comment:r,afterEmptyLine:i}=cu(this.prelude);if(r){let s=t.contents;if(n)t.comment=t.comment?`${t.comment}
|
|
5231
|
+
${r}`:r;else if(i||t.directives.docStart||!s)t.commentBefore=r;else if(lu.isCollection(s)&&!s.flow&&s.items.length>0){let a=s.items[0];lu.isPair(a)&&(a=a.key);let o=a.commentBefore;a.commentBefore=o?`${r}
|
|
4220
5232
|
${o}`:r}else{let a=s.commentBefore;s.commentBefore=a?`${r}
|
|
4221
|
-
${a}`:r}}if(n){for(let s=0;s<this.errors.length;++s)t.errors.push(this.errors[s]);for(let s=0;s<this.warnings.length;++s)t.warnings.push(this.warnings[s])}else t.errors=this.errors,t.warnings=this.warnings;this.prelude=[],this.errors=[],this.warnings=[]}streamInfo(){return{comment:
|
|
4222
|
-
${n.comment}`:n.comment}this.doc.range[2]=n.offset;break}default:this.errors.push(new
|
|
4223
|
-
`}];switch(o[0]){case"|":case">":{let
|
|
4224
|
-
`),
|
|
4225
|
-
`,
|
|
4226
|
-
`}),{type:"block-scalar",offset:s,indent:r,props:
|
|
5233
|
+
${a}`:r}}if(n){for(let s=0;s<this.errors.length;++s)t.errors.push(this.errors[s]);for(let s=0;s<this.warnings.length;++s)t.warnings.push(this.warnings[s])}else t.errors=this.errors,t.warnings=this.warnings;this.prelude=[],this.errors=[],this.warnings=[]}streamInfo(){return{comment:cu(this.prelude).comment,directives:this.directives,errors:this.errors,warnings:this.warnings}}*compose(t,n=!1,r=-1){for(let i of t)yield*this.next(i);yield*this.end(n,r)}*next(t){switch(F0.env.LOG_STREAM&&console.dir(t,{depth:null}),t.type){case"directive":this.directives.add(t.source,(n,r,i)=>{let s=cr(t);s[0]+=n,this.onError(s,"BAD_DIRECTIVE",r,i)}),this.prelude.push(t.source),this.atDirectives=!0;break;case"document":{let n=U0.composeDoc(this.options,this.directives,t,this.onError);this.atDirectives&&!n.directives.docStart&&this.onError(t,"MISSING_CHAR","Missing directives-end/doc-start indicator line"),this.decorate(n,!1),this.doc&&(yield this.doc),this.doc=n,this.atDirectives=!1;break}case"byte-order-mark":case"space":break;case"comment":case"newline":this.prelude.push(t.source);break;case"error":{let n=t.source?`${t.message}: ${JSON.stringify(t.source)}`:t.message,r=new lr.YAMLParseError(cr(t),"UNEXPECTED_TOKEN",n);this.atDirectives||!this.doc?this.errors.push(r):this.doc.errors.push(r);break}case"doc-end":{if(!this.doc){let r="Unexpected doc-end without preceding document";this.errors.push(new lr.YAMLParseError(cr(t),"UNEXPECTED_TOKEN",r));break}this.doc.directives.docEnd=!0;let n=j0.resolveEnd(t.end,t.offset+t.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),n.comment){let r=this.doc.comment;this.doc.comment=r?`${r}
|
|
5234
|
+
${n.comment}`:n.comment}this.doc.range[2]=n.offset;break}default:this.errors.push(new lr.YAMLParseError(cr(t),"UNEXPECTED_TOKEN",`Unsupported token ${t.type}`))}}*end(t=!1,n=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if(t){let r=Object.assign({_directives:this.directives},this.options),i=new H0.Document(void 0,r);this.atDirectives&&this.onError(n,"MISSING_CHAR","Missing directives-end indicator line"),i.range=[0,n,n],this.decorate(i,!1),yield i}}};du.Composer=Eo});var hu=B(Gi=>{"use strict";S();var W0=xo(),K0=To(),G0=ar(),pu=Gn();function z0(e,t=!0,n){if(e){let r=(i,s,a)=>{let o=typeof i=="number"?i:Array.isArray(i)?i[0]:i.offset;if(n)n(o,s,a);else throw new G0.YAMLParseError([o,o+1],s,a)};switch(e.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return K0.resolveFlowScalar(e,t,r);case"block-scalar":return W0.resolveBlockScalar({options:{strict:t}},e,r)}}return null}function V0(e,t){let{implicitKey:n=!1,indent:r,inFlow:i=!1,offset:s=-1,type:a="PLAIN"}=t,o=pu.stringifyString({type:a,value:e},{implicitKey:n,indent:r>0?" ".repeat(r):"",inFlow:i,options:{blockQuote:!0,lineWidth:-1}}),c=t.end??[{type:"newline",offset:-1,indent:r,source:`
|
|
5235
|
+
`}];switch(o[0]){case"|":case">":{let l=o.indexOf(`
|
|
5236
|
+
`),u=o.substring(0,l),d=o.substring(l+1)+`
|
|
5237
|
+
`,p=[{type:"block-scalar-header",offset:s,indent:r,source:u}];return uu(p,c)||p.push({type:"newline",offset:-1,indent:r,source:`
|
|
5238
|
+
`}),{type:"block-scalar",offset:s,indent:r,props:p,source:d}}case'"':return{type:"double-quoted-scalar",offset:s,indent:r,source:o,end:c};case"'":return{type:"single-quoted-scalar",offset:s,indent:r,source:o,end:c};default:return{type:"scalar",offset:s,indent:r,source:o,end:c}}}function X0(e,t,n={}){let{afterKey:r=!1,implicitKey:i=!1,inFlow:s=!1,type:a}=n,o="indent"in e?e.indent:null;if(r&&typeof o=="number"&&(o+=2),!a)switch(e.type){case"single-quoted-scalar":a="QUOTE_SINGLE";break;case"double-quoted-scalar":a="QUOTE_DOUBLE";break;case"block-scalar":{let l=e.props[0];if(l.type!=="block-scalar-header")throw new Error("Invalid block scalar header");a=l.source[0]===">"?"BLOCK_FOLDED":"BLOCK_LITERAL";break}default:a="PLAIN"}let c=pu.stringifyString({type:a,value:t},{implicitKey:i||o===null,indent:o!==null&&o>0?" ".repeat(o):"",inFlow:s,options:{blockQuote:!0,lineWidth:-1}});switch(c[0]){case"|":case">":Y0(e,c);break;case'"':_o(e,c,"double-quoted-scalar");break;case"'":_o(e,c,"single-quoted-scalar");break;default:_o(e,c,"scalar")}}function Y0(e,t){let n=t.indexOf(`
|
|
4227
5239
|
`),r=t.substring(0,n),i=t.substring(n+1)+`
|
|
4228
|
-
`;if(e.type==="block-scalar"){let s=e.props[0];if(s.type!=="block-scalar-header")throw new Error("Invalid block scalar header");s.source=r,e.source=i}else{let{offset:s}=e,a="indent"in e?e.indent:-1,o=[{type:"block-scalar-header",offset:s,indent:a,source:r}];
|
|
4229
|
-
`});for(let
|
|
4230
|
-
`};delete e.items,Object.assign(e,{type:n,source:t,end:[i]});break}default:{let r="indent"in e?e.indent:-1,i="end"in e&&Array.isArray(e.end)?e.end.filter(s=>s.type==="space"||s.type==="comment"||s.type==="newline"):[];for(let s of Object.keys(e))s!=="type"&&s!=="offset"&&delete e[s];Object.assign(e,{type:n,indent:r,source:t,end:i})}}}
|
|
5240
|
+
`;if(e.type==="block-scalar"){let s=e.props[0];if(s.type!=="block-scalar-header")throw new Error("Invalid block scalar header");s.source=r,e.source=i}else{let{offset:s}=e,a="indent"in e?e.indent:-1,o=[{type:"block-scalar-header",offset:s,indent:a,source:r}];uu(o,"end"in e?e.end:void 0)||o.push({type:"newline",offset:-1,indent:a,source:`
|
|
5241
|
+
`});for(let c of Object.keys(e))c!=="type"&&c!=="offset"&&delete e[c];Object.assign(e,{type:"block-scalar",indent:a,props:o,source:i})}}function uu(e,t){if(t)for(let n of t)switch(n.type){case"space":case"comment":e.push(n);break;case"newline":return e.push(n),!0}return!1}function _o(e,t,n){switch(e.type){case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":e.type=n,e.source=t;break;case"block-scalar":{let r=e.props.slice(1),i=t.length;e.props[0].type==="block-scalar-header"&&(i-=e.props[0].source.length);for(let s of r)s.offset+=i;delete e.props,Object.assign(e,{type:n,source:t,end:r});break}case"block-map":case"block-seq":{let i={type:"newline",offset:e.offset+t.length,indent:e.indent,source:`
|
|
5242
|
+
`};delete e.items,Object.assign(e,{type:n,source:t,end:[i]});break}default:{let r="indent"in e?e.indent:-1,i="end"in e&&Array.isArray(e.end)?e.end.filter(s=>s.type==="space"||s.type==="comment"||s.type==="newline"):[];for(let s of Object.keys(e))s!=="type"&&s!=="offset"&&delete e[s];Object.assign(e,{type:n,indent:r,source:t,end:i})}}}Gi.createScalarToken=V0;Gi.resolveAsScalar=z0;Gi.setScalarValue=X0});var fu=B(mu=>{"use strict";S();var J0=e=>"type"in e?Vi(e):zi(e);function Vi(e){switch(e.type){case"block-scalar":{let t="";for(let n of e.props)t+=Vi(n);return t+e.source}case"block-map":case"block-seq":{let t="";for(let n of e.items)t+=zi(n);return t}case"flow-collection":{let t=e.start.source;for(let n of e.items)t+=zi(n);for(let n of e.end)t+=n.source;return t}case"document":{let t=zi(e);if(e.end)for(let n of e.end)t+=n.source;return t}default:{let t=e.source;if("end"in e&&e.end)for(let n of e.end)t+=n.source;return t}}}function zi({start:e,key:t,sep:n,value:r}){let i="";for(let s of e)i+=s.source;if(t&&(i+=Vi(t)),n)for(let s of n)i+=s.source;return r&&(i+=Vi(r)),i}mu.stringify=J0});var wu=B(vu=>{"use strict";S();var No=Symbol("break visit"),Q0=Symbol("skip children"),gu=Symbol("remove item");function Xt(e,t){"type"in e&&e.type==="document"&&(e={start:e.start,value:e.value}),bu(Object.freeze([]),e,t)}Xt.BREAK=No;Xt.SKIP=Q0;Xt.REMOVE=gu;Xt.itemAtPath=(e,t)=>{let n=e;for(let[r,i]of t){let s=n?.[r];if(s&&"items"in s)n=s.items[i];else return}return n};Xt.parentCollection=(e,t)=>{let n=Xt.itemAtPath(e,t.slice(0,-1)),r=t[t.length-1][0],i=n?.[r];if(i&&"items"in i)return i;throw new Error("Parent collection not found")};function bu(e,t,n){let r=n(t,e);if(typeof r=="symbol")return r;for(let i of["key","value"]){let s=t[i];if(s&&"items"in s){for(let a=0;a<s.items.length;++a){let o=bu(Object.freeze(e.concat([[i,a]])),s.items[a],n);if(typeof o=="number")a=o-1;else{if(o===No)return No;o===gu&&(s.items.splice(a,1),a-=1)}}typeof r=="function"&&i==="key"&&(r=r(t,e))}}return typeof r=="function"?r(t,e):r}vu.visit=Xt});var Xi=B(Ie=>{"use strict";S();var Io=hu(),Z0=fu(),ey=wu(),Po="\uFEFF",Oo="",Ro="",Lo="",ty=e=>!!e&&"items"in e,ny=e=>!!e&&(e.type==="scalar"||e.type==="single-quoted-scalar"||e.type==="double-quoted-scalar"||e.type==="block-scalar");function ry(e){switch(e){case Po:return"<BOM>";case Oo:return"<DOC>";case Ro:return"<FLOW_END>";case Lo:return"<SCALAR>";default:return JSON.stringify(e)}}function iy(e){switch(e){case Po:return"byte-order-mark";case Oo:return"doc-mode";case Ro:return"flow-error-end";case Lo:return"scalar";case"---":return"doc-start";case"...":return"doc-end";case"":case`
|
|
4231
5243
|
`:case`\r
|
|
4232
|
-
`:return"newline";case"-":return"seq-item-ind";case"?":return"explicit-key-ind";case":":return"map-value-ind";case"{":return"flow-map-start";case"}":return"flow-map-end";case"[":return"flow-seq-start";case"]":return"flow-seq-end";case",":return"comma"}switch(e[0]){case" ":case" ":return"space";case"#":return"comment";case"%":return"directive-line";case"*":return"alias";case"&":return"anchor";case"!":return"tag";case"'":return"single-quoted-scalar";case'"':return"double-quoted-scalar";case"|":case">":return"block-scalar-header"}return null}
|
|
4233
|
-
`:case"\r":case" ":return!0;default:return!1}}var
|
|
4234
|
-
\r `),
|
|
5244
|
+
`:return"newline";case"-":return"seq-item-ind";case"?":return"explicit-key-ind";case":":return"map-value-ind";case"{":return"flow-map-start";case"}":return"flow-map-end";case"[":return"flow-seq-start";case"]":return"flow-seq-end";case",":return"comma"}switch(e[0]){case" ":case" ":return"space";case"#":return"comment";case"%":return"directive-line";case"*":return"alias";case"&":return"anchor";case"!":return"tag";case"'":return"single-quoted-scalar";case'"':return"double-quoted-scalar";case"|":case">":return"block-scalar-header"}return null}Ie.createScalarToken=Io.createScalarToken;Ie.resolveAsScalar=Io.resolveAsScalar;Ie.setScalarValue=Io.setScalarValue;Ie.stringify=Z0.stringify;Ie.visit=ey.visit;Ie.BOM=Po;Ie.DOCUMENT=Oo;Ie.FLOW_END=Ro;Ie.SCALAR=Lo;Ie.isCollection=ty;Ie.isScalar=ny;Ie.prettyToken=ry;Ie.tokenType=iy});var Bo=B(xu=>{"use strict";S();var dr=Xi();function We(e){switch(e){case void 0:case" ":case`
|
|
5245
|
+
`:case"\r":case" ":return!0;default:return!1}}var yu=new Set("0123456789ABCDEFabcdef"),sy=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),Yi=new Set(",[]{}"),ay=new Set(` ,[]{}
|
|
5246
|
+
\r `),Mo=e=>!e||ay.has(e),Do=class{constructor(){this.atEnd=!1,this.blockScalarIndent=-1,this.blockScalarKeep=!1,this.buffer="",this.flowKey=!1,this.flowLevel=0,this.indentNext=0,this.indentValue=0,this.lineEndPos=null,this.next=null,this.pos=0}*lex(t,n=!1){if(t){if(typeof t!="string")throw TypeError("source is not a string");this.buffer=this.buffer?this.buffer+t:t,this.lineEndPos=null}this.atEnd=!n;let r=this.next??"stream";for(;r&&(n||this.hasChars(1));)r=yield*this.parseNext(r)}atLineEnd(){let t=this.pos,n=this.buffer[t];for(;n===" "||n===" ";)n=this.buffer[++t];return!n||n==="#"||n===`
|
|
4235
5247
|
`?!0:n==="\r"?this.buffer[t+1]===`
|
|
4236
5248
|
`:!1}charAt(t){return this.buffer[this.pos+t]}continueScalar(t){let n=this.buffer[t];if(this.indentNext>0){let r=0;for(;n===" ";)n=this.buffer[++r+t];if(n==="\r"){let i=this.buffer[r+t+1];if(i===`
|
|
4237
5249
|
`||!i&&!this.atEnd)return t+r+1}return n===`
|
|
4238
|
-
`||r>=this.indentNext||!n&&!this.atEnd?t+r:-1}if(n==="-"||n==="."){let r=this.buffer.substr(t,3);if((r==="---"||r==="...")&&
|
|
4239
|
-
`,this.pos),this.lineEndPos=t),t===-1?this.atEnd?this.buffer.substring(this.pos):null:(this.buffer[t-1]==="\r"&&(t-=1),this.buffer.substring(this.pos,t))}hasChars(t){return this.pos+t<=this.buffer.length}setNext(t){return this.buffer=this.buffer.substring(this.pos),this.pos=0,this.lineEndPos=null,this.next=t,null}peek(t){return this.buffer.substr(this.pos,t)}*parseNext(t){switch(t){case"stream":return yield*this.parseStream();case"line-start":return yield*this.parseLineStart();case"block-start":return yield*this.parseBlockStart();case"doc":return yield*this.parseDocument();case"flow":return yield*this.parseFlowCollection();case"quoted-scalar":return yield*this.parseQuotedScalar();case"block-scalar":return yield*this.parseBlockScalar();case"plain-scalar":return yield*this.parsePlainScalar()}}*parseStream(){let t=this.getLine();if(t===null)return this.setNext("stream");if(t[0]===
|
|
5250
|
+
`||r>=this.indentNext||!n&&!this.atEnd?t+r:-1}if(n==="-"||n==="."){let r=this.buffer.substr(t,3);if((r==="---"||r==="...")&&We(this.buffer[t+3]))return-1}return t}getLine(){let t=this.lineEndPos;return(typeof t!="number"||t!==-1&&t<this.pos)&&(t=this.buffer.indexOf(`
|
|
5251
|
+
`,this.pos),this.lineEndPos=t),t===-1?this.atEnd?this.buffer.substring(this.pos):null:(this.buffer[t-1]==="\r"&&(t-=1),this.buffer.substring(this.pos,t))}hasChars(t){return this.pos+t<=this.buffer.length}setNext(t){return this.buffer=this.buffer.substring(this.pos),this.pos=0,this.lineEndPos=null,this.next=t,null}peek(t){return this.buffer.substr(this.pos,t)}*parseNext(t){switch(t){case"stream":return yield*this.parseStream();case"line-start":return yield*this.parseLineStart();case"block-start":return yield*this.parseBlockStart();case"doc":return yield*this.parseDocument();case"flow":return yield*this.parseFlowCollection();case"quoted-scalar":return yield*this.parseQuotedScalar();case"block-scalar":return yield*this.parseBlockScalar();case"plain-scalar":return yield*this.parsePlainScalar()}}*parseStream(){let t=this.getLine();if(t===null)return this.setNext("stream");if(t[0]===dr.BOM&&(yield*this.pushCount(1),t=t.substring(1)),t[0]==="%"){let n=t.length,r=t.indexOf("#");for(;r!==-1;){let s=t[r-1];if(s===" "||s===" "){n=r-1;break}else r=t.indexOf("#",r+1)}for(;;){let s=t[n-1];if(s===" "||s===" ")n-=1;else break}let i=(yield*this.pushCount(n))+(yield*this.pushSpaces(!0));return yield*this.pushCount(t.length-i),this.pushNewline(),"stream"}if(this.atLineEnd()){let n=yield*this.pushSpaces(!0);return yield*this.pushCount(t.length-n),yield*this.pushNewline(),"stream"}return yield dr.DOCUMENT,yield*this.parseLineStart()}*parseLineStart(){let t=this.charAt(0);if(!t&&!this.atEnd)return this.setNext("line-start");if(t==="-"||t==="."){if(!this.atEnd&&!this.hasChars(4))return this.setNext("line-start");let n=this.peek(3);if((n==="---"||n==="...")&&We(this.charAt(3)))return yield*this.pushCount(3),this.indentValue=0,this.indentNext=0,n==="---"?"doc":"stream"}return this.indentValue=yield*this.pushSpaces(!1),this.indentNext>this.indentValue&&!We(this.charAt(1))&&(this.indentNext=this.indentValue),yield*this.parseBlockStart()}*parseBlockStart(){let[t,n]=this.peek(2);if(!n&&!this.atEnd)return this.setNext("block-start");if((t==="-"||t==="?"||t===":")&&We(n)){let r=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=r,"block-start"}return"doc"}*parseDocument(){yield*this.pushSpaces(!0);let t=this.getLine();if(t===null)return this.setNext("doc");let n=yield*this.pushIndicators();switch(t[n]){case"#":yield*this.pushCount(t.length-n);case void 0:return yield*this.pushNewline(),yield*this.parseLineStart();case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel=1,"flow";case"}":case"]":return yield*this.pushCount(1),"doc";case"*":return yield*this.pushUntil(Mo),"doc";case'"':case"'":return yield*this.parseQuotedScalar();case"|":case">":return n+=yield*this.parseBlockScalarHeader(),n+=yield*this.pushSpaces(!0),yield*this.pushCount(t.length-n),yield*this.pushNewline(),yield*this.parseBlockScalar();default:return yield*this.parsePlainScalar()}}*parseFlowCollection(){let t,n,r=-1;do t=yield*this.pushNewline(),t>0?(n=yield*this.pushSpaces(!1),this.indentValue=r=n):n=0,n+=yield*this.pushSpaces(!0);while(t+n>0);let i=this.getLine();if(i===null)return this.setNext("flow");if((r!==-1&&r<this.indentNext&&i[0]!=="#"||r===0&&(i.startsWith("---")||i.startsWith("..."))&&We(i[3]))&&!(r===this.indentNext-1&&this.flowLevel===1&&(i[0]==="]"||i[0]==="}")))return this.flowLevel=0,yield dr.FLOW_END,yield*this.parseLineStart();let s=0;for(;i[s]===",";)s+=yield*this.pushCount(1),s+=yield*this.pushSpaces(!0),this.flowKey=!1;switch(s+=yield*this.pushIndicators(),i[s]){case void 0:return"flow";case"#":return yield*this.pushCount(i.length-s),"flow";case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel+=1,"flow";case"}":case"]":return yield*this.pushCount(1),this.flowKey=!0,this.flowLevel-=1,this.flowLevel?"flow":"doc";case"*":return yield*this.pushUntil(Mo),"flow";case'"':case"'":return this.flowKey=!0,yield*this.parseQuotedScalar();case":":{let a=this.charAt(1);if(this.flowKey||We(a)||a===",")return this.flowKey=!1,yield*this.pushCount(1),yield*this.pushSpaces(!0),"flow"}default:return this.flowKey=!1,yield*this.parsePlainScalar()}}*parseQuotedScalar(){let t=this.charAt(0),n=this.buffer.indexOf(t,this.pos+1);if(t==="'")for(;n!==-1&&this.buffer[n+1]==="'";)n=this.buffer.indexOf("'",n+2);else for(;n!==-1;){let s=0;for(;this.buffer[n-1-s]==="\\";)s+=1;if(s%2===0)break;n=this.buffer.indexOf('"',n+1)}let r=this.buffer.substring(0,n),i=r.indexOf(`
|
|
4240
5252
|
`,this.pos);if(i!==-1){for(;i!==-1;){let s=this.continueScalar(i+1);if(s===-1)break;i=r.indexOf(`
|
|
4241
|
-
`,s)}i!==-1&&(n=i-(r[i-1]==="\r"?2:1))}if(n===-1){if(!this.atEnd)return this.setNext("quoted-scalar");n=this.buffer.length}return yield*this.pushToIndex(n+1,!1),this.flowLevel?"flow":"doc"}*parseBlockScalarHeader(){this.blockScalarIndent=-1,this.blockScalarKeep=!1;let t=this.pos;for(;;){let n=this.buffer[++t];if(n==="+")this.blockScalarKeep=!0;else if(n>"0"&&n<="9")this.blockScalarIndent=Number(n)-1;else if(n!=="-")break}return yield*this.pushUntil(n=>
|
|
5253
|
+
`,s)}i!==-1&&(n=i-(r[i-1]==="\r"?2:1))}if(n===-1){if(!this.atEnd)return this.setNext("quoted-scalar");n=this.buffer.length}return yield*this.pushToIndex(n+1,!1),this.flowLevel?"flow":"doc"}*parseBlockScalarHeader(){this.blockScalarIndent=-1,this.blockScalarKeep=!1;let t=this.pos;for(;;){let n=this.buffer[++t];if(n==="+")this.blockScalarKeep=!0;else if(n>"0"&&n<="9")this.blockScalarIndent=Number(n)-1;else if(n!=="-")break}return yield*this.pushUntil(n=>We(n)||n==="#")}*parseBlockScalar(){let t=this.pos-1,n=0,r;e:for(let s=this.pos;r=this.buffer[s];++s)switch(r){case" ":n+=1;break;case`
|
|
4242
5254
|
`:t=s,n=0;break;case"\r":{let a=this.buffer[s+1];if(!a&&!this.atEnd)return this.setNext("block-scalar");if(a===`
|
|
4243
5255
|
`)break}default:break e}if(!r&&!this.atEnd)return this.setNext("block-scalar");if(n>=this.indentNext){this.blockScalarIndent===-1?this.indentNext=n:this.indentNext=this.blockScalarIndent+(this.indentNext===0?1:this.indentNext);do{let s=this.continueScalar(t+1);if(s===-1)break;t=this.buffer.indexOf(`
|
|
4244
5256
|
`,s)}while(t!==-1);if(t===-1){if(!this.atEnd)return this.setNext("block-scalar");t=this.buffer.length}}let i=t+1;for(r=this.buffer[i];r===" ";)r=this.buffer[++i];if(r===" "){for(;r===" "||r===" "||r==="\r"||r===`
|
|
4245
5257
|
`;)r=this.buffer[++i];t=i-1}else if(!this.blockScalarKeep)do{let s=t-1,a=this.buffer[s];a==="\r"&&(a=this.buffer[--s]);let o=s;for(;a===" ";)a=this.buffer[--s];if(a===`
|
|
4246
|
-
`&&s>=this.pos&&s+1+n>o)t=s;else break}while(!0);return yield
|
|
5258
|
+
`&&s>=this.pos&&s+1+n>o)t=s;else break}while(!0);return yield dr.SCALAR,yield*this.pushToIndex(t+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){let t=this.flowLevel>0,n=this.pos-1,r=this.pos-1,i;for(;i=this.buffer[++r];)if(i===":"){let s=this.buffer[r+1];if(We(s)||t&&Yi.has(s))break;n=r}else if(We(i)){let s=this.buffer[r+1];if(i==="\r"&&(s===`
|
|
4247
5259
|
`?(r+=1,i=`
|
|
4248
|
-
`,s=this.buffer[r+1]):n=r),s==="#"||t&&
|
|
4249
|
-
`){let a=this.continueScalar(r+1);if(a===-1)break;r=Math.max(r,a-2)}}else{if(t&&
|
|
5260
|
+
`,s=this.buffer[r+1]):n=r),s==="#"||t&&Yi.has(s))break;if(i===`
|
|
5261
|
+
`){let a=this.continueScalar(r+1);if(a===-1)break;r=Math.max(r,a-2)}}else{if(t&&Yi.has(i))break;n=r}return!i&&!this.atEnd?this.setNext("plain-scalar"):(yield dr.SCALAR,yield*this.pushToIndex(n+1,!0),t?"flow":"doc")}*pushCount(t){return t>0?(yield this.buffer.substr(this.pos,t),this.pos+=t,t):0}*pushToIndex(t,n){let r=this.buffer.slice(this.pos,t);return r?(yield r,this.pos+=r.length,r.length):(n&&(yield""),0)}*pushIndicators(){let t=0;e:for(;;){switch(this.charAt(0)){case"!":t+=yield*this.pushTag(),t+=yield*this.pushSpaces(!0);continue e;case"&":t+=yield*this.pushUntil(Mo),t+=yield*this.pushSpaces(!0);continue e;case"-":case"?":case":":{let n=this.flowLevel>0,r=this.charAt(1);if(We(r)||n&&Yi.has(r)){n?this.flowKey&&(this.flowKey=!1):this.indentNext=this.indentValue+1,t+=yield*this.pushCount(1),t+=yield*this.pushSpaces(!0);continue e}}}break e}return t}*pushTag(){if(this.charAt(1)==="<"){let t=this.pos+2,n=this.buffer[t];for(;!We(n)&&n!==">";)n=this.buffer[++t];return yield*this.pushToIndex(n===">"?t+1:t,!1)}else{let t=this.pos+1,n=this.buffer[t];for(;n;)if(sy.has(n))n=this.buffer[++t];else if(n==="%"&&yu.has(this.buffer[t+1])&&yu.has(this.buffer[t+2]))n=this.buffer[t+=3];else break;return yield*this.pushToIndex(t,!1)}}*pushNewline(){let t=this.buffer[this.pos];return t===`
|
|
4250
5262
|
`?yield*this.pushCount(1):t==="\r"&&this.charAt(1)===`
|
|
4251
|
-
`?yield*this.pushCount(2):0}*pushSpaces(t){let n=this.pos-1,r;do r=this.buffer[++n];while(r===" "||t&&r===" ");let i=n-this.pos;return i>0&&(yield this.buffer.substr(this.pos,i),this.pos=n),i}*pushUntil(t){let n=this.pos,r=this.buffer[n];for(;!t(r);)r=this.buffer[++n];return yield*this.pushToIndex(n,!1)}};
|
|
5263
|
+
`?yield*this.pushCount(2):0}*pushSpaces(t){let n=this.pos-1,r;do r=this.buffer[++n];while(r===" "||t&&r===" ");let i=n-this.pos;return i>0&&(yield this.buffer.substr(this.pos,i),this.pos=n),i}*pushUntil(t){let n=this.pos,r=this.buffer[n];for(;!t(r);)r=this.buffer[++n];return yield*this.pushToIndex(n,!1)}};xu.Lexer=Do});var Fo=B(ku=>{"use strict";S();var $o=class{constructor(){this.lineStarts=[],this.addNewLine=t=>this.lineStarts.push(t),this.linePos=t=>{let n=0,r=this.lineStarts.length;for(;n<r;){let s=n+r>>1;this.lineStarts[s]<t?n=s+1:r=s}if(this.lineStarts[n]===t)return{line:n+1,col:1};if(n===0)return{line:0,col:t};let i=this.lineStarts[n-1];return{line:n,col:t-i+1}}}};ku.LineCounter=$o});var Ho=B(Au=>{"use strict";S();var oy=Jr("process"),Tu=Xi(),ly=Bo();function Mt(e,t){for(let n=0;n<e.length;++n)if(e[n].type===t)return!0;return!1}function Su(e){for(let t=0;t<e.length;++t)switch(e[t].type){case"space":case"comment":case"newline":break;default:return t}return-1}function Eu(e){switch(e?.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"flow-collection":return!0;default:return!1}}function Ji(e){switch(e.type){case"document":return e.start;case"block-map":{let t=e.items[e.items.length-1];return t.sep??t.start}case"block-seq":return e.items[e.items.length-1].start;default:return[]}}function Sn(e){if(e.length===0)return[];let t=e.length;e:for(;--t>=0;)switch(e[t].type){case"doc-start":case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":case"newline":break e}for(;e[++t]?.type==="space";);return e.splice(t,e.length)}function Qi(e,t){if(t.length<1e5)Array.prototype.push.apply(e,t);else for(let n=0;n<t.length;++n)e.push(t[n])}function Cu(e){if(e.start.type==="flow-seq-start")for(let t of e.items)t.sep&&!t.value&&!Mt(t.start,"explicit-key-ind")&&!Mt(t.sep,"map-value-ind")&&(t.key&&(t.value=t.key),delete t.key,Eu(t.value)?t.value.end?Qi(t.value.end,t.sep):t.value.end=t.sep:Qi(t.start,t.sep),delete t.sep)}var qo=class{constructor(t){this.atNewLine=!0,this.atScalar=!1,this.indent=0,this.offset=0,this.onKeyLine=!1,this.stack=[],this.source="",this.type="",this.lexer=new ly.Lexer,this.onNewLine=t}*parse(t,n=!1){this.onNewLine&&this.offset===0&&this.onNewLine(0);for(let r of this.lexer.lex(t,n))yield*this.next(r);n||(yield*this.end())}*next(t){if(this.source=t,oy.env.LOG_TOKENS&&console.log("|",Tu.prettyToken(t)),this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=t.length;return}let n=Tu.tokenType(t);if(n)if(n==="scalar")this.atNewLine=!1,this.atScalar=!0,this.type="scalar";else{switch(this.type=n,yield*this.step(),n){case"newline":this.atNewLine=!0,this.indent=0,this.onNewLine&&this.onNewLine(this.offset+t.length);break;case"space":this.atNewLine&&t[0]===" "&&(this.indent+=t.length);break;case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":this.atNewLine&&(this.indent+=t.length);break;case"doc-mode":case"flow-error-end":return;default:this.atNewLine=!1}this.offset+=t.length}else{let r=`Not a YAML token: ${t}`;yield*this.pop({type:"error",offset:this.offset,message:r,source:t}),this.offset+=t.length}}*end(){for(;this.stack.length>0;)yield*this.pop()}get sourceToken(){return{type:this.type,offset:this.offset,indent:this.indent,source:this.source}}*step(){let t=this.peek(1);if(this.type==="doc-end"&&t?.type!=="doc-end"){for(;this.stack.length>0;)yield*this.pop();this.stack.push({type:"doc-end",offset:this.offset,source:this.source});return}if(!t)return yield*this.stream();switch(t.type){case"document":return yield*this.document(t);case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return yield*this.scalar(t);case"block-scalar":return yield*this.blockScalar(t);case"block-map":return yield*this.blockMap(t);case"block-seq":return yield*this.blockSequence(t);case"flow-collection":return yield*this.flowCollection(t);case"doc-end":return yield*this.documentEnd(t)}yield*this.pop()}peek(t){return this.stack[this.stack.length-t]}*pop(t){let n=t??this.stack.pop();if(!n)yield{type:"error",offset:this.offset,source:"",message:"Tried to pop an empty stack"};else if(this.stack.length===0)yield n;else{let r=this.peek(1);switch(n.type==="block-scalar"?n.indent="indent"in r?r.indent:0:n.type==="flow-collection"&&r.type==="document"&&(n.indent=0),n.type==="flow-collection"&&Cu(n),r.type){case"document":r.value=n;break;case"block-scalar":r.props.push(n);break;case"block-map":{let i=r.items[r.items.length-1];if(i.value){r.items.push({start:[],key:n,sep:[]}),this.onKeyLine=!0;return}else if(i.sep)i.value=n;else{Object.assign(i,{key:n,sep:[]}),this.onKeyLine=!i.explicitKey;return}break}case"block-seq":{let i=r.items[r.items.length-1];i.value?r.items.push({start:[],value:n}):i.value=n;break}case"flow-collection":{let i=r.items[r.items.length-1];!i||i.value?r.items.push({start:[],key:n,sep:[]}):i.sep?i.value=n:Object.assign(i,{key:n,sep:[]});return}default:yield*this.pop(),yield*this.pop(n)}if((r.type==="document"||r.type==="block-map"||r.type==="block-seq")&&(n.type==="block-map"||n.type==="block-seq")){let i=n.items[n.items.length-1];i&&!i.sep&&!i.value&&i.start.length>0&&Su(i.start)===-1&&(n.indent===0||i.start.every(s=>s.type!=="comment"||s.indent<n.indent))&&(r.type==="document"?r.end=i.start:r.items.push({start:i.start}),n.items.splice(-1,1))}}}*stream(){switch(this.type){case"directive-line":yield{type:"directive",offset:this.offset,source:this.source};return;case"byte-order-mark":case"space":case"comment":case"newline":yield this.sourceToken;return;case"doc-mode":case"doc-start":{let t={type:"document",offset:this.offset,start:[]};this.type==="doc-start"&&t.start.push(this.sourceToken),this.stack.push(t);return}}yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML stream`,source:this.source}}*document(t){if(t.value)return yield*this.lineEnd(t);switch(this.type){case"doc-start":{Su(t.start)!==-1?(yield*this.pop(),yield*this.step()):t.start.push(this.sourceToken);return}case"anchor":case"tag":case"space":case"comment":case"newline":t.start.push(this.sourceToken);return}let n=this.startBlockValue(t);n?this.stack.push(n):yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML document`,source:this.source}}*scalar(t){if(this.type==="map-value-ind"){let n=Ji(this.peek(2)),r=Sn(n),i;t.end?(i=t.end,i.push(this.sourceToken),delete t.end):i=[this.sourceToken];let s={type:"block-map",offset:t.offset,indent:t.indent,items:[{start:r,key:t,sep:i}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=s}else yield*this.lineEnd(t)}*blockScalar(t){switch(this.type){case"space":case"comment":case"newline":t.props.push(this.sourceToken);return;case"scalar":if(t.source=this.source,this.atNewLine=!0,this.indent=0,this.onNewLine){let n=this.source.indexOf(`
|
|
4252
5264
|
`)+1;for(;n!==0;)this.onNewLine(this.offset+n),n=this.source.indexOf(`
|
|
4253
|
-
`,n)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(t){let n=t.items[t.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,n.value){let r="end"in n.value?n.value.end:void 0;(Array.isArray(r)?r[r.length-1]:void 0)?.type==="comment"?r?.push(this.sourceToken):t.items.push({start:[this.sourceToken]})}else n.sep?n.sep.push(this.sourceToken):n.start.push(this.sourceToken);return;case"space":case"comment":if(n.value)t.items.push({start:[this.sourceToken]});else if(n.sep)n.sep.push(this.sourceToken);else{if(this.atIndentedComment(n.start,t.indent)){let i=t.items[t.items.length-2]?.value?.end;if(Array.isArray(i)){
|
|
5265
|
+
`,n)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(t){let n=t.items[t.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,n.value){let r="end"in n.value?n.value.end:void 0;(Array.isArray(r)?r[r.length-1]:void 0)?.type==="comment"?r?.push(this.sourceToken):t.items.push({start:[this.sourceToken]})}else n.sep?n.sep.push(this.sourceToken):n.start.push(this.sourceToken);return;case"space":case"comment":if(n.value)t.items.push({start:[this.sourceToken]});else if(n.sep)n.sep.push(this.sourceToken);else{if(this.atIndentedComment(n.start,t.indent)){let i=t.items[t.items.length-2]?.value?.end;if(Array.isArray(i)){Qi(i,n.start),i.push(this.sourceToken),t.items.pop();return}}n.start.push(this.sourceToken)}return}if(this.indent>=t.indent){let r=!this.onKeyLine&&this.indent===t.indent,i=r&&(n.sep||n.explicitKey)&&this.type!=="seq-item-ind",s=[];if(i&&n.sep&&!n.value){let a=[];for(let o=0;o<n.sep.length;++o){let c=n.sep[o];switch(c.type){case"newline":a.push(o);break;case"space":break;case"comment":c.indent>t.indent&&(a.length=0);break;default:a.length=0}}a.length>=2&&(s=n.sep.splice(a[1]))}switch(this.type){case"anchor":case"tag":i||n.value?(s.push(this.sourceToken),t.items.push({start:s}),this.onKeyLine=!0):n.sep?n.sep.push(this.sourceToken):n.start.push(this.sourceToken);return;case"explicit-key-ind":!n.sep&&!n.explicitKey?(n.start.push(this.sourceToken),n.explicitKey=!0):i||n.value?(s.push(this.sourceToken),t.items.push({start:s,explicitKey:!0})):this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken],explicitKey:!0}]}),this.onKeyLine=!0;return;case"map-value-ind":if(n.explicitKey)if(n.sep)if(n.value)t.items.push({start:[],key:null,sep:[this.sourceToken]});else if(Mt(n.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:s,key:null,sep:[this.sourceToken]}]});else if(Eu(n.key)&&!Mt(n.sep,"newline")){let a=Sn(n.start),o=n.key,c=n.sep;c.push(this.sourceToken),delete n.key,delete n.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:a,key:o,sep:c}]})}else s.length>0?n.sep=n.sep.concat(s,this.sourceToken):n.sep.push(this.sourceToken);else if(Mt(n.start,"newline"))Object.assign(n,{key:null,sep:[this.sourceToken]});else{let a=Sn(n.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:a,key:null,sep:[this.sourceToken]}]})}else n.sep?n.value||i?t.items.push({start:s,key:null,sep:[this.sourceToken]}):Mt(n.sep,"map-value-ind")?this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]}):n.sep.push(this.sourceToken):Object.assign(n,{key:null,sep:[this.sourceToken]});this.onKeyLine=!0;return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let a=this.flowScalar(this.type);i||n.value?(t.items.push({start:s,key:a,sep:[]}),this.onKeyLine=!0):n.sep?this.stack.push(a):(Object.assign(n,{key:a,sep:[]}),this.onKeyLine=!0);return}default:{let a=this.startBlockValue(t);if(a){if(a.type==="block-seq"){if(!n.explicitKey&&n.sep&&!Mt(n.sep,"newline")){yield*this.pop({type:"error",offset:this.offset,message:"Unexpected block-seq-ind on same line with key",source:this.source});return}}else r&&t.items.push({start:s});this.stack.push(a);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(t){let n=t.items[t.items.length-1];switch(this.type){case"newline":if(n.value){let r="end"in n.value?n.value.end:void 0;(Array.isArray(r)?r[r.length-1]:void 0)?.type==="comment"?r?.push(this.sourceToken):t.items.push({start:[this.sourceToken]})}else n.start.push(this.sourceToken);return;case"space":case"comment":if(n.value)t.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(n.start,t.indent)){let i=t.items[t.items.length-2]?.value?.end;if(Array.isArray(i)){Qi(i,n.start),i.push(this.sourceToken),t.items.pop();return}}n.start.push(this.sourceToken)}return;case"anchor":case"tag":if(n.value||this.indent<=t.indent)break;n.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==t.indent)break;n.value||Mt(n.start,"seq-item-ind")?t.items.push({start:[this.sourceToken]}):n.start.push(this.sourceToken);return}if(this.indent>t.indent){let r=this.startBlockValue(t);if(r){this.stack.push(r);return}}yield*this.pop(),yield*this.step()}*flowCollection(t){let n=t.items[t.items.length-1];if(this.type==="flow-error-end"){let r;do yield*this.pop(),r=this.peek(1);while(r?.type==="flow-collection")}else if(t.end.length===0){switch(this.type){case"comma":case"explicit-key-ind":!n||n.sep?t.items.push({start:[this.sourceToken]}):n.start.push(this.sourceToken);return;case"map-value-ind":!n||n.value?t.items.push({start:[],key:null,sep:[this.sourceToken]}):n.sep?n.sep.push(this.sourceToken):Object.assign(n,{key:null,sep:[this.sourceToken]});return;case"space":case"comment":case"newline":case"anchor":case"tag":!n||n.value?t.items.push({start:[this.sourceToken]}):n.sep?n.sep.push(this.sourceToken):n.start.push(this.sourceToken);return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let i=this.flowScalar(this.type);!n||n.value?t.items.push({start:[],key:i,sep:[]}):n.sep?this.stack.push(i):Object.assign(n,{key:i,sep:[]});return}case"flow-map-end":case"flow-seq-end":t.end.push(this.sourceToken);return}let r=this.startBlockValue(t);r?this.stack.push(r):(yield*this.pop(),yield*this.step())}else{let r=this.peek(2);if(r.type==="block-map"&&(this.type==="map-value-ind"&&r.indent===t.indent||this.type==="newline"&&!r.items[r.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type==="map-value-ind"&&r.type!=="flow-collection"){let i=Ji(r),s=Sn(i);Cu(t);let a=t.end.splice(1,t.end.length);a.push(this.sourceToken);let o={type:"block-map",offset:t.offset,indent:t.indent,items:[{start:s,key:t,sep:a}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=o}else yield*this.lineEnd(t)}}flowScalar(t){if(this.onNewLine){let n=this.source.indexOf(`
|
|
4254
5266
|
`)+1;for(;n!==0;)this.onNewLine(this.offset+n),n=this.source.indexOf(`
|
|
4255
|
-
`,n)+1}return{type:t,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(t){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;let n=
|
|
4256
|
-
`),n=/^---\n([\s\S]*?)\n---\n?/.exec(t);if(!n)return{front:{},body:t};let r=(0,
|
|
4257
|
-
${
|
|
5267
|
+
`,n)+1}return{type:t,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(t){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;let n=Ji(t),r=Sn(n);return r.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:r,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;let n=Ji(t),r=Sn(n);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:r,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(t,n){return this.type!=="comment"||this.indent<=n?!1:t.every(r=>r.type==="newline"||r.type==="space")}*documentEnd(t){this.type!=="doc-mode"&&(t.end?t.end.push(this.sourceToken):t.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop()))}*lineEnd(t){switch(this.type){case"comma":case"doc-start":case"doc-end":case"flow-seq-end":case"flow-map-end":case"map-value-ind":yield*this.pop(),yield*this.step();break;case"newline":this.onKeyLine=!1;case"space":case"comment":default:t.end?t.end.push(this.sourceToken):t.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop())}}};Au.Parser=qo});var Ou=B(ur=>{"use strict";S();var _u=Ao(),cy=rr(),pr=ar(),dy=Sa(),py=V(),uy=Fo(),Nu=Ho();function Iu(e){let t=e.prettyErrors!==!1;return{lineCounter:e.lineCounter||t&&new uy.LineCounter||null,prettyErrors:t}}function hy(e,t={}){let{lineCounter:n,prettyErrors:r}=Iu(t),i=new Nu.Parser(n?.addNewLine),s=new _u.Composer(t),a=Array.from(s.compose(i.parse(e)));if(r&&n)for(let o of a)o.errors.forEach(pr.prettifyError(e,n)),o.warnings.forEach(pr.prettifyError(e,n));return a.length>0?a:Object.assign([],{empty:!0},s.streamInfo())}function Pu(e,t={}){let{lineCounter:n,prettyErrors:r}=Iu(t),i=new Nu.Parser(n?.addNewLine),s=new _u.Composer(t),a=null;for(let o of s.compose(i.parse(e),!0,e.length))if(!a)a=o;else if(a.options.logLevel!=="silent"){a.errors.push(new pr.YAMLParseError(o.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return r&&n&&(a.errors.forEach(pr.prettifyError(e,n)),a.warnings.forEach(pr.prettifyError(e,n))),a}function my(e,t,n){let r;typeof t=="function"?r=t:n===void 0&&t&&typeof t=="object"&&(n=t);let i=Pu(e,n);if(!i)return null;if(i.warnings.forEach(s=>dy.warn(i.options.logLevel,s)),i.errors.length>0){if(i.options.logLevel!=="silent")throw i.errors[0];i.errors=[]}return i.toJS(Object.assign({reviver:r},n))}function fy(e,t,n){let r=null;if(typeof t=="function"||Array.isArray(t)?r=t:n===void 0&&t&&(n=t),typeof n=="string"&&(n=n.length),typeof n=="number"){let i=Math.round(n);n=i<1?void 0:i>8?{indent:8}:{indent:i}}if(e===void 0){let{keepUndefined:i}=n??t??{};if(!i)return}return py.isDocument(e)&&!r?e.toString(n):new cy.Document(e,r,n).toString(n)}ur.parse=my;ur.parseAllDocuments=hy;ur.parseDocument=Pu;ur.stringify=fy});var Lu=B(Q=>{"use strict";S();var gy=Ao(),by=rr(),vy=ao(),Uo=ar(),wy=Hn(),Dt=V(),yy=Pt(),xy=de(),ky=Rt(),Ty=Lt(),Sy=Xi(),Cy=Bo(),Ey=Fo(),Ay=Ho(),Zi=Ou(),Ru=Bn();Q.Composer=gy.Composer;Q.Document=by.Document;Q.Schema=vy.Schema;Q.YAMLError=Uo.YAMLError;Q.YAMLParseError=Uo.YAMLParseError;Q.YAMLWarning=Uo.YAMLWarning;Q.Alias=wy.Alias;Q.isAlias=Dt.isAlias;Q.isCollection=Dt.isCollection;Q.isDocument=Dt.isDocument;Q.isMap=Dt.isMap;Q.isNode=Dt.isNode;Q.isPair=Dt.isPair;Q.isScalar=Dt.isScalar;Q.isSeq=Dt.isSeq;Q.Pair=yy.Pair;Q.Scalar=xy.Scalar;Q.YAMLMap=ky.YAMLMap;Q.YAMLSeq=Ty.YAMLSeq;Q.CST=Sy;Q.Lexer=Cy.Lexer;Q.LineCounter=Ey.LineCounter;Q.Parser=Ay.Parser;Q.parse=Zi.parse;Q.parseAllDocuments=Zi.parseAllDocuments;Q.parseDocument=Zi.parseDocument;Q.stringify=Zi.stringify;Q.visit=Ru.visit;Q.visitAsync=Ru.visitAsync});import ht from"node:fs";import Pe from"node:path";function ts(e){let t=Pe.resolve(e);for(;;){if(ht.existsSync(Pe.join(t,Jt)))return t;let n=Pe.dirname(t);if(n===t)return null;t=n}}function ns(e){let t=e.replace(/^/,"").replace(/\r\n/g,`
|
|
5268
|
+
`),n=/^---\n([\s\S]*?)\n---\n?/.exec(t);if(!n)return{front:{},body:t};let r=(0,Cn.parse)(n[1]);if(r!==null&&(typeof r!="object"||Array.isArray(r)))throw new Error("frontmatter kh\xF4ng ph\u1EA3i b\u1EA3ng kho\xE1");return{front:r??{},body:t.slice(n[0].length)}}function es(e){return(0,Cn.stringify)(e,_y)}function mt(e){let t={};for(let[n,r]of Object.entries(e))r==null||r===""||Array.isArray(r)&&r.length===0||typeof r=="object"&&!Array.isArray(r)&&Object.keys(r).length===0||(t[n]=r);return t}function Ko(e,t,n){return t.includes(e)?e:n}function Du(e,t){return t.includes(e)?e:void 0}function Bu(e){if(!e||typeof e!="object")return;let t=e;return{by:G(t.by),at:G(t.at)}}function Ny(e){let t=(0,Cn.parse)(e)??{},n=Array.isArray(t.members)?t.members.map(s=>({id:G(s.id),name:G(s.name)||G(s.id),...s.role?{role:G(s.role)}:{}})):[],r=t.overview&&typeof t.overview=="object"?t.overview:null,i=r?mt({purpose:G(r.purpose).trimEnd(),scope:G(r.scope).trimEnd(),environment:G(r.environment).trimEnd(),references:G(r.references).trimEnd(),terms:Array.isArray(r.terms)?r.terms.map(s=>({term:G(s.term),desc:G(s.desc)})).filter(s=>s.term):void 0,owner:G(r.owner),contractor:G(r.contractor),docVersion:G(r.doc_version),place:G(r.place)}):void 0;return{version:Number(t.version??1),title:G(t.title),language:t.language==="en"?"en":"vi",...t.ba?{ba:G(t.ba)}:{},members:n,...i&&Object.keys(i).length?{overview:i}:{}}}function Iy(e){let t="# T\xE0i li\u1EC7u k\u1ECBch b\u1EA3n ki\u1EC3m th\u1EED (Pan Test). `ba`: repo t\xE0i li\u1EC7u BA \u0111\u1EC3 tham chi\u1EBFu [[CN-\u2026]] v\xE0 ki\u1EC3m \u0111\u1ED9 ph\u1EE7.\n",n=e.overview,r=n?mt({purpose:n.purpose,scope:n.scope,environment:n.environment,references:n.references,terms:n.terms,owner:n.owner,contractor:n.contractor,doc_version:n.docVersion,place:n.place}):void 0;return t+es(mt({version:e.version,title:e.title,language:e.language,ba:e.ba,members:e.members.map(i=>mt({...i})),overview:r}))}function Py(e,t){let{front:n,body:r}=ns(e),i=G(n.code);if(!Zr.test(i))throw new Error(`m\xE3 ph\xE2n h\u1EC7 \xAB${i}\xBB sai m\u1EABu`);return{code:i,title:G(n.title),order:Number(n.order??0),suites:Wo(n.suites),commonSteps:r.trim(),file:t}}function Oy(e){return`---
|
|
5269
|
+
${es(mt({code:e.code,title:e.title,order:e.order,suites:e.suites}))}---
|
|
4258
5270
|
${e.commonSteps.trim()?e.commonSteps.trim()+`
|
|
4259
|
-
`:""}`}function
|
|
4260
|
-
${
|
|
5271
|
+
`:""}`}function Ry(e){if(!e||typeof e!="object")return;let t=e;return{status:Ko(t.status,Je,"not-run"),...t.actual?{actual:G(t.actual)}:{},...t.by?{by:G(t.by)}:{},...t.at?{at:G(t.at)}:{},...t.env?{env:G(t.env)}:{},...t.bug?{bug:G(t.bug)}:{}}}function Ly(e){let t=Bu(e.deleted),n=Ry(e.result),r=Du(e.priority,pn);return{code:G(e.code),case:G(e.case).trimEnd(),...e.requirement?{requirement:G(e.requirement).trimEnd()}:{},steps:G(e.steps).trimEnd(),expected:G(e.expected).trimEnd(),...r?{priority:r}:{},...e.tag?{tag:G(e.tag)}:{},...n?{result:n}:{},...t?{deleted:{...t,...e.deleted.reason?{reason:G(e.deleted.reason)}:{}}}:{}}}function My(e,t){let{front:n,body:r}=ns(e),i=/^#\s+(\S+)\s*(?:·\s*(.*))?$/m.exec(r),s=i?.[1]??"",a=ei.exec(s);if(!a)throw new Error(`thi\u1EBFu ti\xEAu \u0111\u1EC1 \xAB# KB-<PH>-XXXXXX \xB7 T\xEAn\xBB ho\u1EB7c m\xE3 sai m\u1EABu (\xAB${s}\xBB)`);let o=r.slice((i?.index??0)+(i?.[0].length??0)),c=[],l=o.indexOf(jo);if(l>=0){let p=l+jo.length,m=o.indexOf("\n```",p);if(m<0)throw new Error("kh\u1ED1i ```yaml pt:cases``` kh\xF4ng c\xF3 d\u1EA5u \u0111\xF3ng");let f=(0,Cn.parse)(o.slice(p,m));if(f!==null&&!Array.isArray(f))throw new Error("kh\u1ED1i pt:cases ph\u1EA3i l\xE0 danh s\xE1ch");c=(f??[]).map(h=>Ly(h??{})),o=o.slice(0,l)+o.slice(m+4)}let u=Du(n.priority,pn),d=Bu(n.created);return{code:s,module:a[1],title:(i?.[2]??"").trim(),kind:Ko(n.kind,jc,"functional"),status:Ko(n.status,Wc,"drafting"),covers:Wo(n.covers),useCases:Wo(n.use_cases),...u?{priority:u}:{},...n.preconditions?{preconditions:G(n.preconditions).trimEnd()}:{},...n.owner?{owner:G(n.owner)}:{},...d?{created:d}:{},...n.source?{source:G(n.source)}:{},description:o.trim(),cases:c,file:t}}function Dy(e){return mt({code:e.code,case:e.case,requirement:e.requirement,steps:e.steps,expected:e.expected,priority:e.priority,tag:e.tag,result:e.result?mt({...e.result}):void 0,deleted:e.deleted?mt({...e.deleted}):void 0})}function By(e){let n=[`---
|
|
5272
|
+
${es(mt({kind:e.kind,status:e.status,covers:e.covers,use_cases:e.useCases,priority:e.priority,preconditions:e.preconditions,owner:e.owner,created:e.created,source:e.source}))}---
|
|
4261
5273
|
# ${e.code} \xB7 ${e.title}
|
|
4262
5274
|
`];return e.description.trim()&&n.push(`
|
|
4263
5275
|
${e.description.trim()}
|
|
4264
5276
|
`),n.push(`
|
|
4265
|
-
${
|
|
4266
|
-
${e.cases.length?
|
|
5277
|
+
${jo}
|
|
5278
|
+
${e.cases.length?es(e.cases.map(Dy)):`[]
|
|
4267
5279
|
`}\`\`\`
|
|
4268
|
-
`),n.join("")}function
|
|
4269
|
-
`).filter(Boolean);for(let r of n){let i=
|
|
4270
|
-
`)){let a=s.slice(s.lastIndexOf(":")+1).trim();a&&t.add(a)}}}catch{}return t}function
|
|
5280
|
+
`),n.join("")}function $y(e){return Pe.posix.join(Yt,e.module,`${e.code}.md`)}function Fy(e){return Pe.posix.join(Yt,e,Mu)}function Ke(e){let t=Ny(ht.readFileSync(Pe.join(e,Jt),"utf8")),n=[],r=[],i=[],s=Pe.join(e,Yt),a=ht.existsSync(s)?ht.readdirSync(s,{withFileTypes:!0}).filter(o=>o.isDirectory()).map(o=>o.name).sort():[];for(let o of a)for(let c of ht.readdirSync(Pe.join(s,o)).sort()){if(!c.endsWith(".md"))continue;let l=Pe.posix.join(Yt,o,c);try{let u=ht.readFileSync(Pe.join(e,l),"utf8");c===Mu?n.push(Py(u,l)):r.push(My(u,l))}catch(u){i.push({file:l,message:u.message})}}return n.sort((o,c)=>o.order-c.order||o.code.localeCompare(c.code)),{root:e,config:t,modules:n,suites:r,readErrors:i}}function Go(e,t){ht.mkdirSync(Pe.dirname(e),{recursive:!0});let n=`${e}.${process.pid}.tmp`;ht.writeFileSync(n,t),ht.renameSync(n,e)}function Ge(e,t){t.file=$y(t),Go(Pe.join(e,t.file),By(t))}function zo(e,t){t.file=Fy(t.code),Go(Pe.join(e,t.file),Oy(t))}function $u(e,t){Go(Pe.join(e,Jt),Iy(t))}var Cn,Jt,Yt,Mu,jo,_y,G,Wo,En=Ae(()=>{"use strict";S();Cn=Qg(Lu(),1);hn();Qr();Jt=".pantest.yaml",Yt="modules",Mu="_module.md",jo="```yaml pt:cases";_y={lineWidth:0,blockQuote:"literal"};G=e=>e==null?"":String(e),Wo=e=>Array.isArray(e)?e.map(t=>String(t)):e?[String(e)]:[]});import Vo from"node:fs";import rs from"node:path";function qu(e,t,n=0){if(n>8)return;let r;try{r=Vo.readdirSync(e,{withFileTypes:!0})}catch{return}for(let i of r)i.isDirectory()?!qy.has(i.name)&&!i.name.startsWith(".")&&qu(rs.join(e,i.name),t,n+1):Fu.test(i.name)&&t.push(rs.join(e,i.name))}function Qt(e){let t=new Map,n=[];qu(e,n);for(let r of n){let i=Fu.exec(rs.basename(r))[1];try{let{front:s,body:a}=ns(Vo.readFileSync(r,"utf8")),o=/^#\s+(\S+)\s*(?:·\s*(.*))?$/m.exec(a);if(o?.[1]!==i)continue;t.set(i,{code:i,title:(o[2]??"").trim(),type:String(s.type??""),deleted:s.status==="deleted"})}catch{}}return t}function ft(e,t){if(!t)return null;let n=rs.resolve(e,t);return Vo.existsSync(n)?n:null}var Fu,qy,hr=Ae(()=>{"use strict";S();En();Fu=/^([A-Z][A-Z0-9]*-[A-Z0-9]+-[A-Z0-9]+)\.md$/,qy=new Set([".git","node_modules",".pan-ba","dist","build"])});import{execFileSync as Xo}from"node:child_process";import mr from"node:fs";import is from"node:path";function gt(e){let t=process.env.PAN_TEST_ME?.trim();if(t)return t;try{let n=Xo("git",["-C",e,"config","user.name"],{encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim();if(n)return n}catch{}return process.env.USER??process.env.USERNAME??"unknown"}function ss(e,t=[]){let n=new Set(t);for(let r of e.suites){n.add(r.code);for(let i of r.cases)n.add(i.code)}return n}function Bt(e){let t=new Set;try{let n=Xo("git",["-C",e,"for-each-ref","--format=%(refname)","refs/heads","refs/remotes"],{encoding:"utf8",stdio:["ignore","pipe","ignore"]}).split(`
|
|
5281
|
+
`).filter(Boolean);for(let r of n){let i=Xo("git",["-C",e,"grep","-h","-o","-E","(KB|TC)-[A-Z][A-Z0-9]{1,11}-[A-Z0-9]{6}",r,"--",Yt],{encoding:"utf8",stdio:["ignore","pipe","ignore"],maxBuffer:67108864});for(let s of i.split(`
|
|
5282
|
+
`)){let a=s.slice(s.lastIndexOf(":")+1).trim();a&&t.add(a)}}}catch{}return t}function Uu(e,t){let n=is.resolve(e);if(mr.existsSync(is.join(n,Jt)))throw new K(j(`${n} \u0111\xE3 l\xE0 repo t\xE0i li\u1EC7u ki\u1EC3m th\u1EED (${Jt})`,`${n} is already a test document repo (${Jt})`));let r={version:1,title:t.title,language:t.language??"vi",...t.ba?{ba:t.ba}:{},members:t.me?[{id:t.me.id,name:t.me.name,role:"Tester"}]:[]};$u(n,r),mr.mkdirSync(is.join(n,Yt),{recursive:!0});let i=is.join(n,".gitignore"),s=mr.existsSync(i)?mr.readFileSync(i,"utf8"):"";return/^\/?exports\/?$/m.test(s)||mr.writeFileSync(i,s+(s&&!s.endsWith(`
|
|
4271
5283
|
`)?`
|
|
4272
5284
|
`:"")+`exports/
|
|
4273
|
-
`),r}function Xi(e,t,n){if(!qr.test(t))throw new z(`M\xE3 ph\xE2n h\u1EC7 \xAB${t}\xBB ph\u1EA3i l\xE0 ch\u1EEF hoa / s\u1ED1, 2\u201312 k\xFD t\u1EF1, b\u1EAFt \u0111\u1EA7u b\u1EB1ng ch\u1EEF.`);if(e.modules.some(i=>i.code===t))throw new z(`\u0110\xE3 c\xF3 ph\xE2n h\u1EC7 ${t}.`);let r={code:t,title:n,order:Math.max(0,...e.modules.map(i=>i.order))+1,suites:[],commonSteps:"",file:""};return Ro(e.root,r),e.modules.push(r),r}function Bo(e,t,n){let r=Tu(e,t);return Object.assign(r,n),Ro(e.root,r),r}function Tu(e,t){let n=e.modules.find(r=>r.code===t);if(!n)throw new z(`Kh\xF4ng c\xF3 ph\xE2n h\u1EC7 ${t}.`);return n}function or(e,t,{withDeleted:n=!1}={}){let r=e.modules.find(s=>s.code===t),i=new Map((r?.suites??[]).map((s,a)=>[s,a]));return e.suites.filter(s=>s.module===t&&(n||s.status!=="deleted")).sort((s,a)=>(i.get(s.code)??1e9)-(i.get(a.code)??1e9)||s.code.localeCompare(a.code))}function Yi(e,t){let n=Tu(e,t.module);if(!t.title.trim())throw new z("K\u1ECBch b\u1EA3n c\u1EA7n t\xEAn.");let r=t.by??Vt(e.root),i={code:Vs("KB",n.code,xu(e,t.avoid)),module:n.code,title:t.title.trim(),kind:t.kind??"functional",status:"drafting",covers:t.covers??[],useCases:t.useCases??[],...t.priority?{priority:t.priority}:{},...t.preconditions?{preconditions:t.preconditions}:{},owner:r,created:{by:r,at:yu()},description:"",cases:[],file:""};Pt(e.root,i),e.suites.push(i);let s=or(e,n.code).map(o=>o.code).filter(o=>o!==i.code),a=t.after?s.indexOf(t.after):-1;return s.splice(a>=0?a+1:s.length,0,i.code),Bo(e,n.code,{suites:s}),i}function Su(e,t){let n=e.suites.find(r=>r.code===t);if(!n)throw new z(`Kh\xF4ng c\xF3 k\u1ECBch b\u1EA3n ${t}.`);return n}function Eu(e,t,n){let r=Su(e,t);for(let[i,s]of Object.entries(n))s!==void 0&&(s===""&&(i==="priority"||i==="preconditions"||i==="owner")?delete r[i]:r[i]=s);return Pt(e.root,r),r}function Ji(e,t,n,r={}){let i=Su(e,t);if(!n.case.trim())throw new z("T\xECnh hu\u1ED1ng c\u1EA7n m\xF4 t\u1EA3.");let s={code:Vs("TC",i.module,xu(e,r.avoid)),case:n.case.trim(),...n.requirement?{requirement:n.requirement.trim()}:{},steps:(n.steps??"").trim(),expected:(n.expected??"").trim(),...n.priority?{priority:n.priority}:{},...n.tag?{tag:n.tag.trim()}:{}},a=r.after?i.cases.findIndex(o=>o.code===r.after):-1;return i.cases.splice(a>=0?a+1:i.cases.length,0,s),Pt(e.root,i),s}function Qi(e,t){if(!jr.test(t))throw new z(`M\xE3 t\xECnh hu\u1ED1ng \xAB${t}\xBB sai m\u1EABu (TC-<PH>-XXXXXX).`);for(let n of e.suites){let r=n.cases.find(i=>i.code===t);if(r)return{suite:n,tc:r}}throw new z(`Kh\xF4ng c\xF3 t\xECnh hu\u1ED1ng ${t}.`)}function Zi(e,t,n){let{suite:r,tc:i}=Qi(e,t);for(let[s,a]of Object.entries(n)){if(a===void 0)continue;let o=typeof a=="string"?a.trim():a;o===""&&(s==="requirement"||s==="priority"||s==="tag")?delete i[s]:i[s]=o}return Pt(e.root,r),i}function Cu(e,t,n){let{suite:r,tc:i}=Qi(e,t),s=r.cases.indexOf(i),a=s+n;return a<0||a>=r.cases.length||([r.cases[s],r.cases[a]]=[r.cases[a],r.cases[s]],Pt(e.root,r)),i}function es(e,t,n="",r){let{suite:i,tc:s}=Qi(e,t);return s.deleted={by:r??Vt(e.root),at:yu(),...n?{reason:n}:{}},Pt(e.root,i),s}function ts(e,t,n){if(!yt.includes(n.status))throw new z(`Tr\u1EA1ng th\xE1i \xAB${n.status}\xBB kh\xF4ng h\u1EE3p l\u1EC7 (${yt.join(" | ")}).`);let{suite:r,tc:i}=Qi(e,t);if(n.status==="failed"&&!(n.actual??"").trim())throw new z("Kh\xF4ng \u0111\u1EA1t: c\u1EA7n ghi k\u1EBFt qu\u1EA3 th\u1EF1c t\u1EBF.");if(n.status==="not-run")delete i.result;else{let s={status:n.status,by:n.by??Vt(e.root),at:n.at??dy()};n.actual?.trim()&&(s.actual=n.actual.trim()),n.env?.trim()&&(s.env=n.env.trim()),n.bug?.trim()&&(s.bug=n.bug.trim()),i.result=s}return Pt(e.root,r),i}var z,dy,yu,ns=ze(()=>{"use strict";E();An();sr();Ur();z=class extends Error{},dy=()=>new Date().toISOString().slice(0,10),yu=()=>new Date().toISOString().replace(/\.\d{3}Z$/,"Z")});function rs(e,t){let n=[];for(let l of e.readErrors)n.push({rule:"E03",severity:"error",file:l.file,message:`Kh\xF4ng \u0111\u1ECDc \u0111\u01B0\u1EE3c t\u1EC7p: ${l.message}`});let r=new Map,i=(l,c)=>{let d=r.get(l);d?n.push({rule:"E01",severity:"error",code:l,file:c,message:`Tr\xF9ng m\xE3 ${l} (\u0111\xE3 c\xF3 \u1EDF ${d}) \u2014 \u0111\u1ED5i m\xE3 m\u1ED9t b\xEAn (th\u01B0\u1EDDng do hai nh\xE1nh git c\xF9ng sinh).`}):r.set(l,c)},s=new Set(e.modules.map(l=>l.code)),a=new Set;for(let l of e.suites){i(l.code,l.file),Wr.exec(l.code)||n.push({rule:"E02",severity:"error",code:l.code,file:l.file,message:`M\xE3 k\u1ECBch b\u1EA3n \xAB${l.code}\xBB sai m\u1EABu.`}),s.has(l.module)||n.push({rule:"E04",severity:"error",code:l.code,file:l.file,message:`K\u1ECBch b\u1EA3n thu\u1ED9c ph\xE2n h\u1EC7 ${l.module} nh\u01B0ng ch\u01B0a c\xF3 modules/${l.module}/_module.md.`});for(let p of l.cases){i(p.code,l.file);let u=jr.exec(p.code);u?u[1]!==l.module&&!p.deleted&&n.push({rule:"E02",severity:"error",code:p.code,file:l.file,message:`T\xECnh hu\u1ED1ng ${p.code} mang m\xE3 ph\xE2n h\u1EC7 ${u[1]} nh\u01B0ng n\u1EB1m trong k\u1ECBch b\u1EA3n ${l.code}.`}):n.push({rule:"E02",severity:"error",code:p.code,file:l.file,message:`M\xE3 t\xECnh hu\u1ED1ng \xAB${p.code}\xBB sai m\u1EABu (TC-<PH>-XXXXXX).`})}if(l.status==="deleted")continue;for(let p of l.covers)a.add(p);let d=l.cases.filter(p=>!p.deleted);if(d.length===0&&n.push({rule:"T06",severity:"warn",code:l.code,file:l.file,message:`K\u1ECBch b\u1EA3n ${l.code} ch\u01B0a c\xF3 t\xECnh hu\u1ED1ng.`}),l.kind==="functional"&&l.covers.length===0&&n.push({rule:"T01",severity:"warn",code:l.code,file:l.file,message:`K\u1ECBch b\u1EA3n ${l.code} ch\u01B0a ghi ch\u1EE9c n\u0103ng n\xE0o \u0111\u01B0\u1EE3c ki\u1EC3m (covers).`}),t)for(let p of l.covers){let u=t.get(p);u?u.deleted&&n.push({rule:"T05",severity:"warn",code:l.code,file:l.file,message:`${l.code} ph\u1EE7 ${p} \u2014 m\u1EE5c n\xE0y \u0111\xE3 b\u1ECB xo\xE1 trong repo BA.`}):n.push({rule:"T05",severity:"warn",code:l.code,file:l.file,message:`${l.code} ph\u1EE7 ${p} nh\u01B0ng repo BA kh\xF4ng c\xF3 m\u1EE5c n\xE0y.`})}for(let p of d){let u=[!p.steps.trim()&&"c\xE1c b\u01B0\u1EDBc",!p.expected.trim()&&"k\u1EBFt qu\u1EA3 mong \u0111\u1EE3i"].filter(Boolean);u.length&&n.push({rule:"T03",severity:"warn",code:p.code,file:l.file,message:`T\xECnh hu\u1ED1ng ${p.code} thi\u1EBFu ${u.join(" v\xE0 ")}.`}),p.result?.status==="failed"&&!p.result.actual?.trim()&&n.push({rule:"T04",severity:"warn",code:p.code,file:l.file,message:`T\xECnh hu\u1ED1ng ${p.code} Kh\xF4ng \u0111\u1EA1t nh\u01B0ng ch\u01B0a ghi k\u1EBFt qu\u1EA3 th\u1EF1c t\u1EBF.`})}}if(t)for(let l of t.values())l.deleted||l.type!=="function"||a.has(l.code)||n.push({rule:"T02",severity:"info",code:l.code,message:`Ch\u1EE9c n\u0103ng ${l.code}${l.title?" \xAB"+l.title+"\xBB":""} ch\u01B0a c\xF3 k\u1ECBch b\u1EA3n ki\u1EC3m th\u1EED.`});let o={error:0,warn:1,info:2};return n.sort((l,c)=>o[l.severity]-o[c.severity]||l.rule.localeCompare(c.rule))}function lr(){return{total:0,"not-run":0,passed:0,failed:0,blocked:0,skipped:0}}function $o(e,t=lr()){for(let n of e.cases)n.deleted||(t.total++,t[n.result?.status??"not-run"]++);return t}function is(e,t){let n=lr(),r=e.modules.map(s=>{let a=e.suites.filter(l=>l.module===s.code&&l.status!=="deleted"),o=lr();for(let l of a)$o(l,o);for(let l of Object.keys(n))n[l]+=o[l];return{code:s.code,title:s.title,suites:a.length,count:o}}),i=null;if(t){let s=new Set(e.suites.filter(o=>o.status!=="deleted").flatMap(o=>o.covers)),a=[...t.values()].filter(o=>o.type==="function"&&!o.deleted);i={functions:a.length,covered:a.filter(o=>s.has(o.code)).length}}return{all:n,modules:r,coverage:i}}var ss=ze(()=>{"use strict";E();An()});function kr(e){"@babel/helpers - typeof";return kr=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},kr(e)}function uy(e,t){if(kr(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(kr(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function hy(e){var t=uy(e,"string");return kr(t)=="symbol"?t:t+""}function S(e,t,n){return(t=hy(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function _u(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function k(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?_u(Object(n),!0).forEach(function(r){S(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):_u(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function my(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.includes(r))continue;n[r]=e[r]}return n}function Dl(e,t){if(e==null)return{};var n,r,i=my(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(r=0;r<s.length;r++)n=s[r],t.includes(n)||{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function XS(e,t){return VS(e,t||{},0,0)}function YS(e,t){return WS(e,{i:2},t&&t.out,t&&t.dictionary)}function sh(e,t){if(t){for(var n=new ae(e.length),r=0;r<e.length;++r)n[r]=e.charCodeAt(r);return n}if(ih)return ih.encode(e);for(var i=e.length,s=new ae(e.length+(e.length>>1)),a=0,o=function(d){s[a++]=d},r=0;r<i;++r){if(a+5>s.length){var l=new ae(a+8+(i-r<<1));l.set(s),s=l}var c=e.charCodeAt(r);c<128||t?o(c):c<2048?(o(192|c>>6),o(128|c&63)):c>55295&&c<57344?(c=65536+(c&1047552)|e.charCodeAt(++r)&1023,o(240|c>>18),o(128|c>>12&63),o(128|c>>6&63),o(128|c&63)):(o(224|c>>12),o(128|c>>6&63),o(128|c&63))}return Mr(s,0,a)}function QS(e,t){if(t){for(var n="",r=0;r<e.length;r+=16384)n+=String.fromCharCode.apply(null,e.subarray(r,r+16384));return n}else{if(Sl)return Sl.decode(e);var i=JS(e),s=i.s,n=i.r;return n.length&&Se(8),s}}function r2(e,t){t||(t={});var n={},r=[];fm(e,"",n,t);var i=0,s=0;for(var a in n){var o=n[a],l=o[0],c=o[1],d=c.level==0?0:8,p=sh(a),u=p.length,f=c.comment,m=f&&sh(f),h=m&&m.length,g=El(c.extra);u>65535&&Se(11);var v=d?XS(l,c):l,w=v.length,b=zS();b.p(l),r.push(hm(c,{size:l.length,crc:b.d(),c:v,f:p,m,u:u!=a.length||m&&f.length!=h,o:i,compression:d})),i+=30+u+g+w,s+=76+2*(u+g)+(h||0)+w}for(var C=new ae(s+22),A=i,y=s-i,T=0;T<r.length;++T){var p=r[T];ah(C,p.o,p,p.f,p.u,p.c.length);var x=30+p.f.length+El(p.extra);C.set(p.c,p.o+x),ah(C,i,p,p.f,p.u,p.c.length,p.o,p.m),i+=16+x+(p.m?p.m.length:0)}return n2(C,i,r.length,y,A),C}function i2(e,t){for(var n={},r=e.length-22;Re(e,r)!=101010256;--r)(!r||e.length-r>65558)&&Se(13);var i=Qe(e,r+8);if(!i)return{};var s=Re(e,r+16),a=Re(e,r-20)==117853008;if(a){var o=Re(e,r-12);a=Re(e,o)==101075792,a&&(i=Re(e,o+32),s=Re(e,o+48))}for(var l=t&&t.filter,c=0;c<i;++c){var d=e2(e,s,a),p=d[0],u=d[1],f=d[2],m=d[3],h=d[4],g=d[5],v=ZS(e,g);s=h,(!l||l({name:m,size:u,originalSize:f,compression:p}))&&(p?p==8?n[m]=YS(e.subarray(v,v+u),{out:new ae(f)}):Se(14,"unknown compression type "+p):n[m]=Mr(e,v,v+u))}return n}function dh(e,t,n,r,i,s,a){try{var o=e[s](a),l=o.value}catch(c){n(c);return}o.done?t(l):Promise.resolve(l).then(r,i)}function Bt(e){return function(){var t=this,n=arguments;return new Promise(function(r,i){var s=e.apply(t,n);function a(l){dh(s,r,i,a,o,"next",l)}function o(l){dh(s,r,i,a,o,"throw",l)}a(void 0)})}}var py,Ir,Ah,As,fy,I,mt,H,Nh,Ce,gy,by,vy,Ih,us,wy,yy,Pr,xy,Ph,ys,ky,Fo,Oh,Lh,U,Rh,Mh,Ty,Bl,Sy,Ey,Cy,Dh,oe,Ns,Bh,Au,$l,_y,Ot,$h,Fh,Ze,Ay,be,Ny,Hh,Iy,Py,Oy,P,Ho,Uh,et,cr,br,Xt,O,de,qh,Fl,Wh,jh,Kh,Hl,Ly,Ry,My,Nu,Dy,Iu,By,$y,Fy,Hy,Pu,Uy,qy,Wy,Ul,jy,ql,Or,pe,Lr,Ky,Gy,zy,Vy,Is,Wl,mr,Gh,Xy,zh,Yy,Jt,Qt,Lt,Rt,Jy,Qy,Zy,ex,Ps,tx,$e,nx,rx,ix,sx,ax,ox,lx,cx,dx,px,Ye,LN,ux,hx,fx,Ou,We,En,mx,gx,bx,RN,vx,Vh,wx,yx,Cn,dr,Xh,xx,kx,Tx,Sx,Ex,Cx,Uo,Yh,_x,Ax,Jh,Nx,Zt,Ix,Px,Tr,as,Ox,Be,Ie,jl,Lx,Qh,Rx,Mx,Dx,Bx,$x,Fx,Hx,Kl,Zh,ef,Ux,qx,Wx,jx,Kx,tf,Gx,Sr,nf,zx,Vx,rf,sf,Xx,af,of,lf,Gl,Yx,Jx,nt,rt,Ke,Me,zl,Qx,cf,Zx,e1,t1,df,n1,r1,pf,uf,fl,Vl,hf,i1,ff,s1,a1,o1,l1,c1,d1,p1,u1,h1,f1,Xl,m1,ml,g1,b1,qo,Lu,Os,mf,v1,w1,Rr,y1,ge,x1,k1,Ru,T1,S1,E1,C1,_1,A1,N1,I1,P1,O1,L1,Ls,R1,M1,bf,D1,Tn,B1,Rs,gr,Mu,$1,F1,H1,os,U1,q1,Yl,W1,Jl,vf,j1,K1,G1,wf,xf,kf,z1,V1,X1,Y1,Tf,xs,ls,J1,Q1,Z1,ek,Sf,tk,nk,Wo,rk,ik,Sn,Du,J,sk,MN,Cf,ak,ok,kn,Bu,jo,lk,_f,ck,dk,$u,pk,uk,hk,fk,ks,mk,gk,bk,vk,Je,hs,gl,wk,Nf,De,Er,fs,If,Ql,yk,xk,Fu,kk,ms,Tk,Sk,Ek,Ck,_k,Ak,Nk,Ik,Pf,Pk,Ok,Lk,Rk,Mk,Of,Dk,Hu,Bk,$k,Lf,Fk,Cr,bl,wn,Hk,Rf,Ko,Uk,qk,Wk,jk,Mf,Kk,Gk,zk,Zl,Vk,Xk,Df,Yk,Ts,vr,Jk,Ms,Bf,Qk,Zk,eT,dt,me,tT,vl,Ds,nT,rT,Uu,iT,sT,aT,oT,lT,cT,dT,pT,uT,hT,fT,mT,Ff,gT,Hf,qu,Go,bT,Uf,vT,qf,Wf,wT,yT,xT,kT,TT,ST,jf,Wu,zo,ET,Kf,CT,_T,AT,NT,IT,Gf,pt,PT,OT,LT,RT,MT,DT,BT,$T,FT,HT,UT,Vo,qT,WT,ju,jT,KT,GT,zT,zf,Vf,VT,XT,Ku,Gu,YT,JT,zu,QT,ZT,eS,Vu,Xu,tS,nS,rS,Xf,iS,sS,aS,ec,gt,en,Dt,oS,lS,cS,dS,pS,uS,hS,fS,mS,gS,bS,Yf,Yu,ut,Jf,Qf,Zf,em,tm,nm,vS,wS,yS,wr,tc,Ju,Qu,wl,xS,kS,Xo,TS,SS,ES,CS,_S,AS,nc,Zu,rm,NS,Yo,IS,PS,eh,OS,im,gs,Jo,Qo,Zo,LS,RS,MS,Ge,sm,am,tn,rc,DS,ae,Oe,ic,Bs,$s,yl,om,lm,cm,xl,dm,BS,th,kl,ht,K,tt,Mt,K,K,K,K,_r,K,$S,FS,HS,US,el,je,tl,sc,Mr,qS,Se,WS,ft,pr,nl,Tl,nh,ur,pm,rh,jS,um,KS,GS,zS,VS,hm,Qe,Re,rl,xe,fm,ih,Sl,JS,ZS,e2,t2,El,ah,n2,s2,Ss,a2,oh,mm,il,bs,lh,Cl,o2,l2,c2,Ar,Dr,_l,yr,d2,p2,u2,h2,f2,m2,g2,gm,b2,v2,w2,bm,hr,sl,y2,x2,nn,vm,wm,k2,ym,T2,S2,al,E2,ac,C2,_2,ch,A2,N2,ph,uh,oc,xm,km,I2,P2,Fs,it,Tm,Sm,ke,Em,yn,O2,L2,R2,lc,Al,Nr,hh,M2,fh,mh,Nl,D2,gh,bh,B2,$2,F2,H2,U2,Il,cc,q2,Es,Cm,W2,j2,Te,K2,Hs,_m,vh,G2,z2,Pl,Ol,V2,X2,Y2,J2,Q2,Z2,eE,tE,Am,nE,cs,rE,iE,ds,Nm,sE,wh,aE,oE,ps,lE,cE,yh,dE,pE,uE,xh,hE,Ll,ol,fE,mE,gE,Im,vs,bE,vE,Pm,Cs,Br,wE,Om,yE,xE,kE,fr,Lm,ll,kh,Rm,dc,cl,TE,Th,SE,pc,EE,CE,_E,AE,NE,Rl,IE,PE,Mm,OE,dl,Sh,Yt,Dm,LE,RE,Bm,ME,DE,BE,pl,$E,xr,Ml,ws,Eh,FE,HE,UE,qE,WE,jE,KE,GE,$m,zE,VE,XE,YE,Fm,JE,QE,_s,ZE,Hm,eC,tC,Um,qm,nC,Wm,Ch,rC,iC,sC,_h,DN,aC,BN,ul,oC,jm=ze(()=>{E();py=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t,t.exports),e=null),t.exports);Ir=class{constructor(e){S(this,"rootKey",void 0),this.rootKey=e}get writtenAs(){}},Ah=e=>e instanceof Ir||typeof e=="object"&&e!==null&&typeof e.prepForXml=="function",As=e=>Ah(e)?e.rootKey:void 0,fy=Object.seal({}),I=class extends Ir{constructor(e){super(e),S(this,"root",void 0),this.root=new Array}prepForXml(e){var t;e.stack.push(this);let n=this.root.flatMap(r=>{if(Ah(r)){let i=r.writtenAs;return i?i.map(s=>s.prepForXml(e)):r.prepForXml(e)}return r}).filter(r=>r!==void 0);return e.stack.pop(),{[this.rootKey]:n.length?n.length===1&&(!((t=n[0])===null||t===void 0)&&t._attr)?n[0]:n:fy}}addChildElement(e){return this.root.push(e),this}},mt=class extends I{constructor(e,t){super(e),S(this,"includeIfEmpty",void 0),this.includeIfEmpty=t}prepForXml(e){let t=super.prepForXml(e);return this.includeIfEmpty||t&&(typeof t[this.rootKey]!="object"||Object.keys(t[this.rootKey]).length)?t:void 0}};H=class extends Ir{constructor(e){super("_attr"),S(this,"root",void 0),S(this,"xmlKeys",void 0),this.root=e}prepForXml(e){let t={};return Object.entries(this.root).forEach(([n,r])=>{if(r!==void 0){let i=this.xmlKeys&&this.xmlKeys[n]||n;t[i]=r}}),{_attr:t}}},Nh=class extends Ir{constructor(e){super("_attr"),S(this,"root",void 0),this.root=e}prepForXml(e){return{_attr:Object.values(this.root).filter(({value:t})=>t!==void 0).reduce((t,{key:n,value:r})=>k(k({},t),{},{[n]:r}),{})}}},Ce=class extends H{constructor(...e){super(...e),S(this,"xmlKeys",{val:"w:val",color:"w:color",fill:"w:fill",space:"w:space",sz:"w:sz",type:"w:type",rsidR:"w:rsidR",rsidRPr:"w:rsidRPr",rsidSect:"w:rsidSect",w:"w:w",h:"w:h",top:"w:top",right:"w:right",bottom:"w:bottom",left:"w:left",header:"w:header",footer:"w:footer",gutter:"w:gutter",linePitch:"w:linePitch",pos:"w:pos"})}};gy=["elements"],by=new Map([["amp","&"],["lt","<"],["gt",">"],["quot",'"'],["apos","'"]]),vy=/&([^;]*);?/g,Ih=e=>e.indexOf("&")===-1?e:e.replace(vy,(t,n)=>{if(!t.endsWith(";"))throw new Error(`Invalid XML: "&" that starts no entity, in "${e}"`);let r=by.get(n);if(r!==void 0)return r;let i=/^#x[0-9a-f]+$/i.test(n)?parseInt(n.slice(2),16):/^#[0-9]+$/.test(n)?parseInt(n.slice(1),10):NaN;if(!(i>0&&i<=1114111))throw new Error(`Invalid XML: unknown entity "${t}"`);return String.fromCodePoint(i)}),us=e=>e===" "||e===`
|
|
4274
|
-
`||e===" "||e==="\r",
|
|
4275
|
-
`:"");return o===0?
|
|
4276
|
-
`:""):
|
|
4277
|
-
`:"")},U=(e,{indent:t="",declaration:n}={})=>{let r=Array.isArray(e)?e:[e],i=t?1:0,s=n?.standalone?` standalone="${
|
|
4278
|
-
`:""}`)+r.map((a,o)=>Lh(Oh(a,t,i),t,o===r.length-1)).join("")},Rh=e=>Object.entries(e??{}).flatMap(([t,n])=>n==null?[]:[` ${t}="${ys(String(n))}"`]).join(""),Mh=e=>{switch(e.type){case"element":{var t,n;let r=(t=e.elements)!==null&&t!==void 0?t:[],i=`<${e.name}${Rh(e.attributes)}`;return r.length>0||((n=e.attributes)===null||n===void 0?void 0:n["xml:space"])==="preserve"?`${i}>${r.map(Mh).join("")}</${e.name}>`:`${i}/>`}case"text":return ky(String(e.text));case"cdata":return`<![CDATA[${String(e.cdata).replace(/\]\]>/g,"]]]]><![CDATA[>")}]]>`;case"comment":return`<!--${e.comment}-->`;case"doctype":return`<!DOCTYPE ${e.doctype}>`;case"instruction":return`<?${e.name}${e.instruction?` ${e.instruction}`:""}?>`;default:return""}},Ty=e=>{var t;return(e.declaration?`<?xml${Rh(e.declaration.attributes)}?>`:"")+((t=e.elements)!==null&&t!==void 0?t:[]).map(Mh).join("")},Bl=e=>{switch(e.type){case void 0:case"element":let t=new Ey(e.name,e.attributes),n=e.elements||[];for(let r of n){let i=Bl(r);i!==void 0&&t.push(i)}return t;case"text":return e.text;default:return}},Sy=class extends H{},Ey=class extends I{static fromXmlString(e){return Bl(Pr(e))}constructor(e,t){super(e),t&&this.root.push(new Sy(t))}push(e){this.root.push(e)}get writtenAs(){return this.rootKey===void 0?this.root.filter(e=>typeof e!="string"):void 0}prepForXml(e){let t=this.writtenAs;return t?.length===1?t[0].prepForXml(e):super.prepForXml(e)}},Cy=class extends I{constructor(e){super(""),S(this,"_attr",void 0),this._attr=e}prepForXml(e){return{_attr:this._attr}}},Dh=class extends I{constructor(e,t){super(e),t&&(this.root=t.root)}},oe=e=>{if(!Number.isFinite(e))throw new Error(`Invalid value '${e}' specified. Must be an integer.`);return Math.floor(e)},Ns=e=>{let t=oe(e);if(t<0)throw new Error(`Invalid value '${e}' specified. Must be a positive integer.`);return t},Bh=(e,t)=>{let n=t*2;if(e.length!==n||isNaN(+`0x${e}`))throw new Error(`Invalid hex value '${e}'. Expected ${n} digit hex value`);return e},Au=e=>Bh(e,1),$l=e=>{let t=e.slice(-2),n=e.substring(0,e.length-2);return`${Number(n)}${t}`},_y={in:1440,cm:1440/2.54,mm:1440/25.4,pt:20,pc:240,pi:240},Ot=e=>{if(typeof e=="number")return e;let t=e.slice(-2),n=Number(e.substring(0,e.length-2)),r=_y[t];if(r===void 0||Number.isNaN(n))throw new Error(`Invalid universal measure '${e}'. Expected a number followed by mm, cm, in, pt, pc or pi.`);return n*r},$h=e=>{let t=$l(e);if(parseFloat(t)<0)throw new Error(`Invalid value '${t}' specified. Expected a positive number.`);return t},Fh=e=>e==="auto"?e:Bh(e.charAt(0)==="#"?e.substring(1):e,3),Ze=e=>typeof e=="string"?$l(e):oe(e),Ay=e=>typeof e=="string"?$h(e):Ns(e),be=e=>typeof e=="string"?$h(e):Ns(e),Ny=e=>{let t=e.substring(0,e.length-1);return`${Number(t)}%`},Hh=e=>typeof e=="number"?oe(e):e.slice(-1)==="%"?Ny(e):$l(e),Iy=Ns,Py=Ns,Oy=e=>e.toISOString(),P=class extends I{constructor(e,t=!0){super(e),t!==!0&&this.root.push(new Ce({val:t}))}},Ho=class extends I{constructor(e,t){super(e),this.root.push(new Ce({val:Ay(t)}))}},Uh=class extends I{},et=class extends I{constructor(e,t){super(e),this.root.push(new Ce({val:t}))}},cr=(e,t)=>new O({name:e,attributes:{value:{key:"w:val",value:t}}}),br=class extends I{constructor(e,t){super(e),this.root.push(new Ce({val:t}))}},Xt=class extends I{constructor(e,t){super(e),this.root.push(t)}},O=class extends I{constructor({name:e,attributes:t,children:n}){super(e),t&&this.root.push(new Nh(t)),n&&this.root.push(...n)}},de={START:"start",CENTER:"center",END:"end",BOTH:"both",MEDIUM_KASHIDA:"mediumKashida",DISTRIBUTE:"distribute",NUM_TAB:"numTab",HIGH_KASHIDA:"highKashida",LOW_KASHIDA:"lowKashida",THAI_DISTRIBUTE:"thaiDistribute",LEFT:"left",RIGHT:"right",JUSTIFIED:"both"},qh=e=>new O({name:"w:jc",attributes:{val:{key:"w:val",value:e}}}),Fl={dark1:"dk1",light1:"lt1",dark2:"dk2",light2:"lt2",accent1:"accent1",accent2:"accent2",accent3:"accent3",accent4:"accent4",accent5:"accent5",accent6:"accent6",hyperlink:"hlink",followedHyperlink:"folHlink"},Wh={dark2:"44546A",light2:"E7E6E6",accent1:"4472C4",accent2:"ED7D31",accent3:"A5A5A5",accent4:"FFC000",accent5:"5B9BD5",accent6:"70AD47",hyperlink:"0563C1",followedHyperlink:"954F72"},jh={dark1:{value:"windowText",lastColor:"000000"},light1:{value:"window",lastColor:"FFFFFF"}},Kh=(e,t)=>{if(t==="auto")throw new Error(`Invalid theme color ${e} 'auto'. Expected 6 digit hex value`);return Fh(t)},Hl=(e={})=>Object.fromEntries(Object.keys(Fl).map(t=>{let n=e[t],r=t==="dark1"||t==="light1"?jh[t].lastColor:Wh[t];return[t,n===void 0?r:Kh(t,n)]})),Ly=(e,t)=>new O({name:"a:srgbClr",attributes:{value:{key:"val",value:Kh(e,t)}}}),Ry=(e,t)=>{let n=t[e],r=e==="dark1"||e==="light1"?jh[e]:void 0;return new O({name:`a:${Fl[e]}`,children:[n===void 0&&r?new O({name:"a:sysClr",attributes:{value:{key:"val",value:r.value},lastColor:{key:"lastClr",value:r.lastColor}}}):Ly(e,n??Wh[e])]})},My=(e,t={})=>new O({name:"a:clrScheme",attributes:{name:{key:"name",value:e}},children:Object.keys(Fl).map(n=>Ry(n,t))}),Nu=new Set(["dark1","light1","dark2","light2","accent1","accent2","accent3","accent4","accent5","accent6","hyperlink","followedHyperlink"]),Dy=new Map([["dk1","dark1"],["lt1","light1"],["dk2","dark2"],["lt2","light2"],["hlink","hyperlink"],["folHlink","followedHyperlink"],["text1","dark1"],["background1","light1"],["text2","dark2"],["background2","light2"]]),Iu=(e,t)=>{if(!(e>=0&&e<=100))throw new Error(`Invalid ${t} ${e}. Expected a number from 0 to 100`);return Math.round(255*(1-e/100))},By=({theme:e,lighter:t,darker:n})=>{if(!Nu.has(e)){let s=Dy.get(e);throw new Error(`Invalid theme color "${e}". ${s?`Did you mean "${s}"?`:`Expected one of ${[...Nu].join(", ")}`}`)}if(t!==void 0&&n!==void 0)throw new Error("Invalid theme color. Expected lighter or darker, not both");let r=t===void 0?void 0:Iu(t,"lighter"),i=n===void 0?void 0:Iu(n,"darker");return{tint:r===255?void 0:r,shade:i===255?void 0:i}},$y=e=>{let[t,n,r]=[0,2,4].map(l=>parseInt(e.slice(l,l+2),16)/255),i=Math.max(t,n,r),s=Math.min(t,n,r),a=(i+s)/2,o=i-s;return o===0?{hue:0,saturation:0,lightness:a}:{hue:(i===t?((n-r)/o+6)%6:i===n?(r-t)/o+2:(t-n)/o+4)*60,saturation:o/(1-Math.abs(2*a-1)),lightness:a}},Fy=({hue:e,saturation:t,lightness:n})=>{let r=(1-Math.abs(2*n-1))*t,i=r*(1-Math.abs(e/60%2-1)),[s,a,o]=e<60?[r,i,0]:e<120?[i,r,0]:e<180?[0,r,i]:e<240?[0,i,r]:e<300?[i,0,r]:[r,0,i],l=n-r/2;return[s,a,o].map(c=>Math.floor((c+l)*255+1e-9).toString(16).padStart(2,"0")).join("").toUpperCase()},Hy=(e,{tint:t,shade:n})=>{if(t===void 0&&n===void 0)return e;let r=$y(e),i=t===void 0?r.lightness*n/255:r.lightness*t/255+(1-t/255);return Fy(k(k({},r),{},{lightness:i}))},Pu=e=>e===void 0?void 0:e.toString(16).padStart(2,"0").toUpperCase(),Uy=e=>typeof e=="string"?{type:"hex",value:Fh(e)}:{type:"theme",color:e,change:By(e)},qy=(e,t)=>e.type==="hex"?{color:e.value}:{color:Hy(t[e.color.theme],e.change),theme:e.color.theme,tint:Pu(e.change.tint),shade:Pu(e.change.shade)},Wy=Hl(),Ul=class extends Ir{constructor(e){super("_attr"),S(this,"attributes",void 0),this.attributes=e.map(t=>"keys"in t?{keys:t.keys,color:t.color===void 0?void 0:Uy(t.color)}:t)}prepForXml(e){var t,n;let r=(t=(n=e.file)===null||n===void 0||(n=n.Theme)===null||n===void 0?void 0:n.Colors)!==null&&t!==void 0?t:Wy,i=this.attributes.flatMap(s=>{if(!("keys"in s))return[[s.key,s.value]];if(s.color===void 0)return[];let{keys:a}=s,o=qy(s.color,r);return[[a.color,o.color],[a.theme,o.theme],[a.tint,o.tint],[a.shade,o.shade]]});return{_attr:Object.fromEntries(i.filter(([,s])=>s!==void 0))}}},jy=class extends I{constructor(e,t){super(e),this.root.push(new Ul(t))}},ql=(e,t)=>new jy(e,t),Or={color:"w:color",theme:"w:themeColor",tint:"w:themeTint",shade:"w:themeShade"},pe=(e,{color:t,size:n,space:r,style:i})=>ql(e,[{key:"w:val",value:i},{keys:Or,color:t},{key:"w:sz",value:n===void 0?void 0:Iy(n)},{key:"w:space",value:r===void 0?void 0:Py(r)}]),Lr={SINGLE:"single",DASH_DOT_STROKED:"dashDotStroked",DASHED:"dashed",DASH_SMALL_GAP:"dashSmallGap",DOT_DASH:"dotDash",DOT_DOT_DASH:"dotDotDash",DOTTED:"dotted",DOUBLE:"double",DOUBLE_WAVE:"doubleWave",INSET:"inset",NIL:"nil",NONE:"none",OUTSET:"outset",THICK:"thick",THICK_THIN_LARGE_GAP:"thickThinLargeGap",THICK_THIN_MEDIUM_GAP:"thickThinMediumGap",THICK_THIN_SMALL_GAP:"thickThinSmallGap",THIN_THICK_LARGE_GAP:"thinThickLargeGap",THIN_THICK_MEDIUM_GAP:"thinThickMediumGap",THIN_THICK_SMALL_GAP:"thinThickSmallGap",THIN_THICK_THIN_LARGE_GAP:"thinThickThinLargeGap",THIN_THICK_THIN_MEDIUM_GAP:"thinThickThinMediumGap",THIN_THICK_THIN_SMALL_GAP:"thinThickThinSmallGap",THREE_D_EMBOSS:"threeDEmboss",THREE_D_ENGRAVE:"threeDEngrave",TRIPLE:"triple",WAVE:"wave"},Ky=class extends mt{constructor(e){super("w:pBdr"),e.top&&this.root.push(pe("w:top",e.top)),e.left&&this.root.push(pe("w:left",e.left)),e.bottom&&this.root.push(pe("w:bottom",e.bottom)),e.right&&this.root.push(pe("w:right",e.right)),e.between&&this.root.push(pe("w:between",e.between))}},Gy=class extends I{constructor(){super("w:pBdr");let e=pe("w:bottom",{color:"auto",space:1,style:Lr.SINGLE,size:6});this.root.push(e)}},zy=({start:e,end:t,left:n,right:r,hanging:i,firstLine:s,firstLineChars:a})=>new O({name:"w:ind",attributes:{start:{key:"w:start",value:e===void 0?void 0:Ze(e)},end:{key:"w:end",value:t===void 0?void 0:Ze(t)},left:{key:"w:left",value:n===void 0?void 0:Ze(n)},right:{key:"w:right",value:r===void 0?void 0:Ze(r)},hanging:{key:"w:hanging",value:i===void 0?void 0:be(i)},firstLine:{key:"w:firstLine",value:s===void 0?void 0:be(s)},firstLineChars:{key:"w:firstLineChars",value:a===void 0?void 0:oe(a)}}}),Vy=()=>new O({name:"w:br"}),Is={BEGIN:"begin",END:"end",SEPARATE:"separate"},Wl=(e,t,n)=>new O({name:"w:fldChar",attributes:{type:{key:"w:fldCharType",value:e},dirty:{key:"w:dirty",value:t},locked:{key:"w:fldLock",value:n}}}),mr=(e,t)=>Wl(Is.BEGIN,e,t),Gh=new WeakSet,Xy=class extends O{constructor(){super({name:"w:fldChar",attributes:{type:{key:"w:fldCharType",value:Is.BEGIN},dirty:{key:"w:dirty",value:!0}}})}prepForXml(e){let t=super.prepForXml(e);return Gh.add(t),t}},zh=()=>new Xy,Yy=e=>typeof e=="object"&&e!==null&&Gh.has(e),Jt=e=>Wl(Is.SEPARATE,e),Qt=e=>Wl(Is.END,e),Lt={DEFAULT:"default",PRESERVE:"preserve"},Rt=class extends H{constructor(...e){super(...e),S(this,"xmlKeys",{space:"xml:space"})}},Jy=class extends I{constructor(){super("w:instrText"),this.root.push(new Rt({space:Lt.PRESERVE})),this.root.push("PAGE")}},Qy=class extends I{constructor(){super("w:instrText"),this.root.push(new Rt({space:Lt.PRESERVE})),this.root.push("NUMPAGES")}},Zy=class extends I{constructor(){super("w:instrText"),this.root.push(new Rt({space:Lt.PRESERVE})),this.root.push("SECTIONPAGES")}},ex=class extends I{constructor(){super("w:instrText"),this.root.push(new Rt({space:Lt.PRESERVE})),this.root.push("SECTION")}},Ps=({fill:e,color:t,type:n})=>ql("w:shd",[{keys:{color:"w:fill",theme:"w:themeFill",tint:"w:themeFillTint",shade:"w:themeFillShade"},color:e},{keys:Or,color:t},{key:"w:val",value:n??tx.CLEAR}]),tx={CLEAR:"clear",DIAGONAL_CROSS:"diagCross",DIAGONAL_STRIPE:"diagStripe",HORIZONTAL_CROSS:"horzCross",HORIZONTAL_STRIPE:"horzStripe",NIL:"nil",PERCENT_5:"pct5",PERCENT_10:"pct10",PERCENT_12:"pct12",PERCENT_15:"pct15",PERCENT_20:"pct20",PERCENT_25:"pct25",PERCENT_30:"pct30",PERCENT_35:"pct35",PERCENT_37:"pct37",PERCENT_40:"pct40",PERCENT_45:"pct45",PERCENT_50:"pct50",PERCENT_55:"pct55",PERCENT_60:"pct60",PERCENT_62:"pct62",PERCENT_65:"pct65",PERCENT_70:"pct70",PERCENT_75:"pct75",PERCENT_80:"pct80",PERCENT_85:"pct85",PERCENT_87:"pct87",PERCENT_90:"pct90",PERCENT_95:"pct95",REVERSE_DIAGONAL_STRIPE:"reverseDiagStripe",SOLID:"solid",THIN_DIAGONAL_CROSS:"thinDiagCross",THIN_DIAGONAL_STRIPE:"thinDiagStripe",THIN_HORIZONTAL_CROSS:"thinHorzCross",THIN_REVERSE_DIAGONAL_STRIPE:"thinReverseDiagStripe",THIN_VERTICAL_STRIPE:"thinVertStripe",VERTICAL_STRIPE:"vertStripe"},$e=class extends H{constructor(...e){super(...e),S(this,"xmlKeys",{id:"w:id",author:"w:author",date:"w:date"})}},nx=class extends I{constructor(e){super("w:del"),this.root.push(new $e({id:e.id,author:e.author,date:e.date}))}},rx=class extends I{constructor(e){super("w:ins"),this.root.push(new $e({id:e.id,author:e.author,date:e.date}))}},ix=({twoLinesInOne:e,brackets:t,horizontalInVertical:n,fitToLine:r,group:i})=>new O({name:"w:eastAsianLayout",attributes:{id:{key:"w:id",value:i===void 0?void 0:oe(i)},combine:{key:"w:combine",value:e},combineBrackets:{key:"w:combineBrackets",value:t},vert:{key:"w:vert",value:n},vertCompress:{key:"w:vertCompress",value:r}}}),sx={DOT:"dot"},ax=(e=sx.DOT)=>new O({name:"w:em",attributes:{val:{key:"w:val",value:e}}}),ox="57X6y3wQZNzYjJB2L_10pxbackgroundhimselfUTF-8DEMOGRAPHICSVqvt4KW9",lx=(e,t=21)=>(n=t)=>{let r="",i=n|0;for(;i-- >0;)r+=e[Math.random()*e.length|0];return r},cx=(e=21)=>{let t="",n=e|0;for(;n-- >0;)t+=ox[Math.random()*64|0];return t},dx=e=>{let t=new Int32Array(Math.ceil((e.length+9)/64)*16);for(let n=0;n<e.length;n++)t[n>>2]|=e[n]<<24-(n&3)*8;return t[e.length>>2]|=128<<24-(e.length&3)*8,t[t.length-2]=Math.floor(e.length/536870912),t[t.length-1]=e.length*8,t},px=e=>{let t=new Uint8Array(e.length*4);for(let n=0;n<t.length;n++)t[n]=e[n>>2]>>>24-(n&3)*8;return t},Ye=(e,t)=>e>>>t|e<<32-t,LN=Int32Array.of(1518500249,1859775393,2400959708,3395469782),ux=Int32Array.of(1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298),hx=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],fx=new Int32Array(64),Ou=e=>{let t=dx(e),n=fx,[r,i,s,a,o,l,c,d]=hx;for(let p=0;p<t.length;p+=16){n.set(t.subarray(p,p+16));for(let C=16;C<64;C++){let A=n[C-15],y=n[C-2];n[C]=n[C-16]+(Ye(A,7)^Ye(A,18)^A>>>3)+n[C-7]+(Ye(y,17)^Ye(y,19)^y>>>10)}let[u,f,m,h,g,v,w,b]=[r,i,s,a,o,l,c,d];for(let C=0;C<64;C++){let A=b+(Ye(g,6)^Ye(g,11)^Ye(g,25))+(g&v^~g&w)+ux[C]+n[C]|0,y=(Ye(u,2)^Ye(u,13)^Ye(u,22))+(u&f^u&m^f&m)|0;b=w,w=v,v=g,g=h+A|0,h=m,m=f,f=u,u=A+y|0}[r,i,s,a,o,l,c,d]=[r+u|0,i+f|0,s+m|0,a+h|0,o+g|0,l+v|0,c+w|0,d+b|0]}return px([r,i,s,a,o,l,c,d])},We=e=>Math.floor(e*72*20),En=(e=0)=>{let t=e;return()=>++t},mx=()=>En(),gx=()=>En(1),bx=()=>En(),RN=bx(),vx=()=>En(),Vh=vx(),wx=En(),yx=()=>-wx(),Cn=()=>cx().toLowerCase(),dr=e=>lx("1234567890abcdef",e)(),Xh=()=>`${dr(8)}-${dr(4)}-${dr(4)}-${dr(4)}-${dr(12)}`,xx=e=>new Uint8Array(new TextEncoder().encode(e)),kx=({width:e,group:t})=>new O({name:"w:fitText",attributes:{val:{key:"w:val",value:Math.round(Ot(be(e)))},id:{key:"w:id",value:t===void 0?yx():oe(t)}}}),Tx=class extends I{constructor(e){super("w:spacing"),this.root.push(new Ce({val:Ze(e)}))}},Sx=class extends I{constructor(e){super("w:color"),this.root.push(new Ul([{keys:k(k({},Or),{},{color:"w:val"}),color:e}]))}},Ex=class extends I{constructor(e){super("w:highlight"),this.root.push(new Ce({val:e}))}},Cx=e=>new O({name:"w:lang",attributes:{value:{key:"w:val",value:e.value},eastAsia:{key:"w:eastAsia",value:e.eastAsia},bidirectional:{key:"w:bidi",value:e.bidirectional}}}),Uo=(e,t)=>{if(typeof e=="string"){let r=e;return new O({name:"w:rFonts",attributes:{ascii:{key:"w:ascii",value:r},cs:{key:"w:cs",value:r},eastAsia:{key:"w:eastAsia",value:r},hAnsi:{key:"w:hAnsi",value:r},hint:{key:"w:hint",value:t}}})}if("theme"in e){let r=e.theme==="headings"?"major":"minor";return new O({name:"w:rFonts",attributes:{ascii:{key:"w:asciiTheme",value:`${r}HAnsi`},eastAsia:{key:"w:eastAsiaTheme",value:`${r}EastAsia`},hAnsi:{key:"w:hAnsiTheme",value:`${r}HAnsi`},cs:{key:"w:cstheme",value:`${r}Bidi`}}})}let n=e;return new O({name:"w:rFonts",attributes:{ascii:{key:"w:ascii",value:n.ascii},cs:{key:"w:cs",value:n.cs},eastAsia:{key:"w:eastAsia",value:n.eastAsia},hAnsi:{key:"w:hAnsi",value:n.hAnsi},hint:{key:"w:hint",value:n.hint}}})},Yh=e=>new O({name:"w:vertAlign",attributes:{val:{key:"w:val",value:e}}}),_x=()=>Yh("superscript"),Ax=()=>Yh("subscript"),Jh={SINGLE:"single",WORDS:"words",DOUBLE:"double",THICK:"thick",DOTTED:"dotted",DOTTEDHEAVY:"dottedHeavy",DASH:"dash",DASHEDHEAVY:"dashedHeavy",DASHLONG:"dashLong",DASHLONGHEAVY:"dashLongHeavy",DOTDASH:"dotDash",DASHDOTHEAVY:"dashDotHeavy",DOTDOTDASH:"dotDotDash",DASHDOTDOTHEAVY:"dashDotDotHeavy",WAVE:"wave",WAVYHEAVY:"wavyHeavy",WAVYDOUBLE:"wavyDouble",NONE:"none"},Nx=(e=Jh.SINGLE,t)=>ql("w:u",[{key:"w:val",value:e},{keys:Or,color:t}]),Zt=class extends mt{constructor(e){if(super("w:rPr"),!e)return;if(e.style&&this.push(new et("w:rStyle",e.style)),e.font&&(typeof e.font=="string"?this.push(Uo(e.font)):"name"in e.font?this.push(Uo(e.font.name,e.font.hint)):this.push(Uo(e.font))),e.bold!==void 0&&this.push(new P("w:b",e.bold)),e.boldComplexScript===void 0&&e.bold!==void 0||e.boldComplexScript){var t;this.push(new P("w:bCs",(t=e.boldComplexScript)!==null&&t!==void 0?t:e.bold))}if(e.italics!==void 0&&this.push(new P("w:i",e.italics)),e.italicsComplexScript===void 0&&e.italics!==void 0||e.italicsComplexScript){var n;this.push(new P("w:iCs",(n=e.italicsComplexScript)!==null&&n!==void 0?n:e.italics))}e.smallCaps!==void 0?this.push(new P("w:smallCaps",e.smallCaps)):e.allCaps!==void 0&&this.push(new P("w:caps",e.allCaps)),e.strike!==void 0&&this.push(new P("w:strike",e.strike)),e.doubleStrike!==void 0&&this.push(new P("w:dstrike",e.doubleStrike)),e.emboss!==void 0&&this.push(new P("w:emboss",e.emboss)),e.imprint!==void 0&&this.push(new P("w:imprint",e.imprint)),e.noProof!==void 0&&this.push(new P("w:noProof",e.noProof)),e.snapToGrid!==void 0&&this.push(new P("w:snapToGrid",e.snapToGrid)),e.vanish!==void 0&&this.push(new P("w:vanish",e.vanish)),e.color&&this.push(new Sx(e.color)),e.characterSpacing&&this.push(new Tx(e.characterSpacing)),e.scale!==void 0&&this.push(new br("w:w",e.scale)),e.kern&&this.push(new Ho("w:kern",e.kern)),e.position&&this.push(new et("w:position",e.position)),e.size!==void 0&&this.push(new Ho("w:sz",e.size));let r=e.sizeComplexScript===void 0||e.sizeComplexScript===!0?e.size:e.sizeComplexScript;r&&this.push(new Ho("w:szCs",r)),e.highlight&&this.push(new Ex(e.highlight)),e.underline&&this.push(Nx(e.underline.type,e.underline.color)),e.effect&&this.push(new et("w:effect",e.effect)),e.border&&this.push(pe("w:bdr",e.border)),e.shading&&this.push(Ps(e.shading)),e.fitText&&this.push(kx(e.fitText)),e.subScript&&this.push(Ax()),e.superScript&&this.push(_x()),e.rightToLeft!==void 0&&this.push(new P("w:rtl",e.rightToLeft)),e.emphasisMark&&this.push(ax(e.emphasisMark.type)),e.language&&this.push(Cx(e.language)),e.eastAsianLayout&&this.push(ix(e.eastAsianLayout)),e.specVanish!==void 0&&this.push(new P("w:specVanish",e.specVanish)),e.math!==void 0&&this.push(new P("w:oMath",e.math)),e.revision&&this.push(new Px(e.revision))}push(e){this.root.push(e)}},Ix=class extends Zt{constructor(e){super(e),e?.insertion&&this.push(new rx(e.insertion)),e?.deletion&&this.push(new nx(e.deletion))}},Px=class extends I{constructor(e){super("w:rPrChange"),this.root.push(new $e({id:e.id,author:e.author,date:e.date})),this.addChildElement(new Zt(e))}},Tr=class extends I{constructor(e){if(super("w:t"),typeof e=="string")this.root.push(new Rt({space:Lt.PRESERVE})),this.root.push(e);else{var t;this.root.push(new Rt({space:(t=e.space)!==null&&t!==void 0?t:Lt.DEFAULT})),this.root.push(e.text)}}},as={CURRENT:"CURRENT",TOTAL_PAGES:"TOTAL_PAGES",TOTAL_PAGES_IN_SECTION:"TOTAL_PAGES_IN_SECTION",CURRENT_SECTION:"SECTION"},Ox=e=>{switch(e){case as.CURRENT:return[mr(),new Jy,Jt(),Qt()];case as.TOTAL_PAGES:return[mr(),new Qy,Jt(),Qt()];case as.TOTAL_PAGES_IN_SECTION:return[mr(),new Zy,Jt(),Qt()];case as.CURRENT_SECTION:return[mr(),new ex,Jt(),Qt()];default:return}},Be=class hl extends I{constructor(t){if(super("w:r"),S(this,"properties",void 0),S(this,"following",[]),this.properties=new Zt(t),this.root.push(this.properties),t.break)for(let n=0;n<t.break;n++)this.root.push(Vy());if(t.children)for(let[n,r]of t.children.entries()){if(As(r)==="w:r"){let i=t.children.slice(n+1);this.following=[r,...i.length>0?[new hl(k(k({},t),{},{break:void 0,children:i}))]:[]];break}if(typeof r=="string"){let i=Ox(r);if(i){let s=t.children.slice(n+1),a=c=>new hl(k(k({},t),{},{break:void 0,children:c})),o=this.root.length===1;o&&this.root.push(i[0]);let l=o?i.slice(1):i;this.following=[...l.map(c=>a([c])),...s.length>0?[a(s)]:[]];break}this.root.push(new Tr(r));continue}this.root.push(r)}else t.text!==void 0&&this.root.push(new Tr(t.text))}get writtenAs(){return this.following.length>0?[this,...this.following.flatMap(t=>{var n;return(n=t.writtenAs)!==null&&n!==void 0?n:t})]:void 0}},Ie=class extends Be{constructor(e){super(typeof e=="string"?{text:e}:e)}},jl={EXTERNAL:"External"},Lx=(e,t,n,r)=>new O({name:"Relationship",attributes:{id:{key:"Id",value:e},type:{key:"Type",value:t},target:{key:"Target",value:n},targetMode:{key:"TargetMode",value:r}}}),Qh=(e,t)=>new O({name:"a:hlinkClick",attributes:k(k({},t?{xmlns:{key:"xmlns:a",value:"http://schemas.openxmlformats.org/drawingml/2006/main"}}:{}),{},{id:{key:"r:id",value:`rId${e}`}})}),Rx=class{constructor(e){S(this,"link",void 0),S(this,"linkId",Cn()),S(this,"addedTo",new WeakSet),this.link=e}createClick(e){return Qh(this.linkId,e)}addRelationship(e){let t=e.viewWrapper.Relationships;this.addedTo.has(t)||(this.addedTo.add(t),t.addRelationship(this.linkId,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink",this.link,jl.EXTERNAL))}},Mx=32767,Dx=780,Bx=[[1e3,"M"],[900,"CM"],[500,"D"],[400,"CD"],[100,"C"],[90,"XC"],[50,"L"],[40,"XL"],[10,"X"],[9,"IX"],[5,"V"],[4,"IV"],[1,"I"]],$x=e=>e<=Mx?Bx.reduce(({rest:t,text:n},[r,i])=>({rest:t%r,text:n+i.repeat(Math.floor(t/r))}),{rest:e,text:""}).text:void 0,Fx=e=>e===0?"":e<=Dx?String.fromCharCode(65+(e-1)%26).repeat(Math.ceil(e/26)):void 0,Hx=e=>{var t;return`${e}${e%100>=11&&e%100<=13?"th":(t=["th","st","nd","rd"][e%10])!==null&&t!==void 0?t:"th"}`},Kl=e=>{let t=e.charAt(0)!==e.charAt(0).toUpperCase(),n=r=>i=>{var s;return t?(s=r(i))===null||s===void 0?void 0:s.toLowerCase():r(i)};switch(e.toLowerCase()){case"arabic":return String;case"roman":return n($x);case"alphabetic":return n(Fx);case"ordinal":return r=>r>0?Hx(r):void 0;case"arabicdash":return r=>`- ${r} -`;default:return}},Zh=new Set(["mergeformat","charformat","mergeformatinet"]),ef=new Set(["upper","lower","firstcap","caps"]),Ux=e=>/^[#0,]*[#0][#0,]*$/.test(e),qx=(e,t)=>{let n=[...t].filter(s=>s==="0").length,r=n+[...t].filter(s=>s==="#").length,i=String(e).padStart(n,"0");if(!(i.length<r||n===0&&e===0))return t.includes(",")?i.replace(/\B(?=(\d{3})+$)/g,","):i},Wx=(e,t)=>{switch(t){case"upper":return e.toUpperCase();case"lower":return e.toLowerCase();case"firstcap":return e.charAt(0).toUpperCase()+e.slice(1);default:return e}},jx=e=>{var t;let n=new RegExp("^\\s*(PAGEREF|NUMPAGES|SECTIONPAGES)\\b(.*)$","is").exec(e),r=n?.[1].toUpperCase()==="PAGEREF"?new RegExp('^\\s*("?)([^\\s"\\\\]+)\\1(.*)$',"s").exec(n[2]):void 0;if(!n||n[1].toUpperCase()==="PAGEREF"&&!r)return;let i=(t=(r?r[3]:n[2]).match(/"[^"]*"|\S+/g))!==null&&t!==void 0?t:[],s,a,o=[],l=!1,c=!0;for(let f=0;f<i.length;f++){let m=i[f],h=()=>{var g;return(m.length>2?m.slice(2):(g=i[++f])!==null&&g!==void 0?g:"").replace(/^"(.*)"$/,"$1")};if(/^\\p$/i.test(m))l=!0;else if(m.startsWith("\\#")){var d;let g=h();c&&(c=a===void 0&&Ux(g)),(d=a)!==null&&d!==void 0||(a=g)}else if(m.startsWith("\\*")){let g=h(),v=g.toLowerCase();if(ef.has(v))o.push(v);else if(g!==""&&!Zh.has(v)){var p;c&&(c=s===void 0&&Kl(g)!==void 0),(p=s)!==null&&p!==void 0||(s=g)}}}let u=k(k(k(k({},s===void 0?{}:{numberFormat:s}),a===void 0?{}:{picture:a}),o.length===0?{}:{capitals:o[0]}),{},{written:c&&o.length<=1&&o[0]!=="caps"&&(s===void 0||a===void 0)});return k(r?{type:"pageReference",bookmark:r[2],relative:l}:{type:"pageCount",scope:n[1].toUpperCase()==="NUMPAGES"?"document":"section"},u)},Kx=e=>new RegExp("^\\s*TOC\\b.*\\\\s\\b","is").test(e),tf=(e,{enclosing:t,within:n,inTextBox:r},{estimate:i,sectionPageCount:s,blank:a,relativeTo:o})=>{let l=jx(e);if(l===void 0)return;let{bookmarks:c,pageCount:d,bookmarkPageNumbers:p}=i,{numberFormat:u,picture:f,capitals:m,written:h}=l,g=u!==void 0||f!==void 0,v=C=>C===void 0?void 0:f===void 0?Kl(u??"arabic")(C):qx(C,f),w=l.type==="pageReference"&&l.relative&&n==="counted"&&!r?o?.(l.bookmark):void 0,b;return h?l.type==="pageCount"?b=v(l.scope==="document"?d:s):t.some(Kx)?b=void 0:g?b=v(p?.get(l.bookmark)):b=l.relative?w:c.get(l.bookmark):b=void 0,b===void 0?a?"":void 0:Wx(b,m)},Gx=(e,t)=>e==="mc:Fallback"||t==="fallback"?"fallback":e==="w:del"||e==="w:moveFrom"?"deleted":t,Sr=(e,t,n,r,i="counted",s=!1)=>{for(let c=0;c<t.length;c++){let d=t[c],p=e.nameOf(d);if(p===void 0)continue;let u=n[n.length-1];if(p==="w:fldChar"){let f=e.attributeOf(d,"w:fldCharType");f==="begin"?n.push({begin:d,instruction:"",inResult:!1}):f==="separate"&&u?(e.writeClean(u.begin,u.instruction),u.inResult=!0,u.result=r.resultOf(u.instruction,{within:i,enclosing:n.slice(0,-1).map(m=>m.instruction),inTextBox:s}),u.result!==void 0&&(t.splice(c+1,0,e.textElement(u.result)),c++)):f==="end"&&n.pop()}else if(p==="w:instrText"&&u&&!u.inResult)u.instruction+=e.textOf(d);else if((p==="w:t"||p==="w:tab"||p==="w:br"||p==="w:cr")&&u?.result!==void 0)t.splice(c,1),c--;else if(p==="w:fldSimple"){let f=r.resultOf(String(e.attributeOf(d,"w:instr")),{within:i,enclosing:n.map(m=>m.instruction),inTextBox:s});if(f===void 0){var a;Sr(e,(a=e.contentOf(d))!==null&&a!==void 0?a:[],[],r,i,s)}else e.setSimpleFieldResult(d,f)}else{var o;if(p==="w:p"){var l;(l=r.beforeParagraph)===null||l===void 0||l.call(r,d)}Sr(e,(o=e.contentOf(d))!==null&&o!==void 0?o:[],n,r,Gx(p,i),s||p==="w:txbxContent"),p==="w:p"&&r.afterParagraph(d)}}},nf=(e,t)=>t.flatMap(n=>{var r;let i=e.nameOf(n);return i===void 0?[]:i==="w:sectPr"?[n]:nf(e,(r=e.contentOf(n))!==null&&r!==void 0?r:[])}),zx=(e,t)=>{var n;return((n=e.contentOf(t))!==null&&n!==void 0?n:[]).some(r=>{var i;return e.nameOf(r)==="w:pPr"&&((i=e.contentOf(r))!==null&&i!==void 0?i:[]).some(s=>e.nameOf(s)==="w:sectPr")})},Vx=(e,t,n)=>{let r=nf(e,[t]).reduce((i,s)=>{var a,o;let l=((a=e.contentOf(s))!==null&&a!==void 0?a:[]).flatMap(c=>{let d=e.nameOf(c);return d==="w:headerReference"||d==="w:footerReference"?[[`${d} ${String(e.attributeOf(c,"w:type"))}`,String(e.attributeOf(c,"r:id"))]]:[]});return[...i,new Map([...(o=i[i.length-1])!==null&&o!==void 0?o:[],...l])]},[]).reduce((i,s,a)=>{for(let l of s.values()){var o;i.set(l,[...(o=i.get(l))!==null&&o!==void 0?o:[],n[a]])}return i},new Map);return new Map([...r].flatMap(([i,[s,...a]])=>s!==void 0&&a.every(o=>o===s)?[[i,s]]:[]))},rf=(e,t,n,{blank:r})=>{let{sectionPageCounts:i=[],relativePositions:s}=n,a=0,o=new Map,l=c=>{var d,p;let u=(d=o.get(c))!==null&&d!==void 0?d:0;return o.set(c,u+1),s==null||(p=s.get(c))===null||p===void 0?void 0:p[u]};return Sr(e,[t],[],{resultOf:(c,d)=>tf(c,d,{estimate:n,sectionPageCount:i[a],blank:r,relativeTo:l}),afterParagraph:c=>{a+=zx(e,c)?1:0}}),Vx(e,t,i)},sf=(e,t,n,{blank:r,sectionPageCount:i,notes:s=!1})=>{let a=o=>{let l=n.bookmarks.get(o);return l===void 0?void 0:`on page ${l}`};Sr(e,[t],[],{resultOf:(o,l)=>tf(o,l,k({estimate:n,sectionPageCount:i,blank:r},s?{relativeTo:a}:{})),afterParagraph:()=>{}})},Xx=(e,t,{beforeParagraph:n,resultOf:r})=>Sr(e,[t],[],{resultOf:(i,{within:s})=>r(i,s),beforeParagraph:n,afterParagraph:()=>{}}),af=class extends I{constructor(e={}){super("w:instrText"),S(this,"properties",void 0),this.properties=e,this.root.push(new Rt({space:Lt.PRESERVE}));let t="TOC";if(this.properties.captionLabel&&(t=`${t} \\a "${this.properties.captionLabel}"`),this.properties.entriesFromBookmark&&(t=`${t} \\b "${this.properties.entriesFromBookmark}"`),this.properties.captionLabelIncludingNumbers&&(t=`${t} \\c "${this.properties.captionLabelIncludingNumbers}"`),this.properties.sequenceAndPageNumbersSeparator&&(t=`${t} \\d "${this.properties.sequenceAndPageNumbersSeparator}"`),this.properties.tcFieldIdentifier&&(t=`${t} \\f "${this.properties.tcFieldIdentifier}"`),this.properties.hyperlink&&(t=`${t} \\h`),this.properties.tcFieldLevelRange&&(t=`${t} \\l "${this.properties.tcFieldLevelRange}"`),this.properties.pageNumbersEntryLevelsRange&&(t=`${t} \\n "${this.properties.pageNumbersEntryLevelsRange}"`),this.properties.headingStyleRange&&(t=`${t} \\o "${this.properties.headingStyleRange}"`),this.properties.entryAndPageNumberSeparator&&(t=`${t} \\p "${this.properties.entryAndPageNumberSeparator}"`),this.properties.seqFieldIdentifierForPrefix&&(t=`${t} \\s "${this.properties.seqFieldIdentifierForPrefix}"`),this.properties.stylesWithLevels&&this.properties.stylesWithLevels.length){let n=this.properties.stylesWithLevels.map(r=>`${r.styleName},${r.level}`).join(",");t=`${t} \\t "${n}"`}this.properties.useAppliedParagraphOutlineLevel&&(t=`${t} \\u`),this.properties.preserveTabInEntries&&(t=`${t} \\w`),this.properties.preserveNewLineInEntries&&(t=`${t} \\x`),this.properties.hideTabAndPageNumbersInWebView&&(t=`${t} \\z`),this.root.push(t)}},of=class extends I{constructor(){super("w:sdtContent")}},lf=e=>e===void 0?zh():mr(e),Gl=new WeakMap,Yx=(e,t)=>{Gl.set(e,t)},Jx=class{constructor(){S(this,"ids",[])}get(e){var t,n;return(n=(t=this.ids)[e])!==null&&n!==void 0||(t[e]=Vh()),this.ids[e]}},nt=e=>typeof e=="object"&&e!==null?Object.keys(e)[0]:void 0,rt=e=>{let t=nt(e),n=t===void 0?void 0:e[t];return Array.isArray(n)?n:n===void 0?[]:[n]},Ke=(e,t)=>rt(e).find(n=>nt(n)===t),Me=(e,t)=>{var n;return(n=Ke(e,"_attr"))===null||n===void 0||(n=n._attr)===null||n===void 0?void 0:n[t]},zl=(e,t)=>{let n=Me(e,t);return n===void 0?void 0:Number(n)},Qx=new Set(["w:tbl","w:tr","w:tc","w:sdt","w:sdtContent","w:customXml"]),cf=e=>e.flatMap(t=>{let n=nt(t);return n==="w:p"||Gl.has(t)?[t]:n!==void 0&&Qx.has(n)?cf(rt(t)):[]}),Zx=new Set(["w:r","w:hyperlink","w:ins","w:moveTo","w:smartTag","w:customXml","w:sdt","w:sdtContent","w:fldSimple","w:dir","w:bdo"]),e1=e=>{switch(nt(e)){case"w:t":return rt(e).filter(t=>typeof t=="string").join("");case"w:tab":return" ";case"w:br":return[void 0,"textWrapping"].includes(Me(e,"w:type"))?`
|
|
5285
|
+
`),r}function as(e,t,n){if(!Zr.test(t))throw new K(j(`M\xE3 ph\xE2n h\u1EC7 \xAB${t}\xBB ph\u1EA3i l\xE0 ch\u1EEF hoa / s\u1ED1, 2\u201312 k\xFD t\u1EF1, b\u1EAFt \u0111\u1EA7u b\u1EB1ng ch\u1EEF.`,`Module code \xAB${t}\xBB must be 2\u201312 capitals / digits starting with a letter.`));if(e.modules.some(i=>i.code===t))throw new K(j(`\u0110\xE3 c\xF3 ph\xE2n h\u1EC7 ${t}.`,`Module ${t} already exists.`));let r={code:t,title:n,order:Math.max(0,...e.modules.map(i=>i.order))+1,suites:[],commonSteps:"",file:""};return zo(e.root,r),e.modules.push(r),r}function fr(e,t,n){let r=os(e,t);return Object.assign(r,n),zo(e.root,r),r}function os(e,t){let n=e.modules.find(r=>r.code===t);if(!n)throw new K(j(`Kh\xF4ng c\xF3 ph\xE2n h\u1EC7 ${t}.`,`No module ${t}.`));return n}function Zt(e,t,{withDeleted:n=!1}={}){let r=e.modules.find(s=>s.code===t),i=new Map((r?.suites??[]).map((s,a)=>[s,a]));return e.suites.filter(s=>s.module===t&&(n||s.status!=="deleted")).sort((s,a)=>(i.get(s.code)??1e9)-(i.get(a.code)??1e9)||s.code.localeCompare(a.code))}function ls(e,t){let n=os(e,t.module);if(!t.title.trim())throw new K(j("K\u1ECBch b\u1EA3n c\u1EA7n t\xEAn.","The test suite needs a name."));let r=t.by??gt(e.root),i={code:un("KB",n.code,ss(e,t.avoid)),module:n.code,title:t.title.trim(),kind:t.kind??"functional",status:"drafting",covers:t.covers??[],useCases:t.useCases??[],...t.priority?{priority:t.priority}:{},...t.preconditions?{preconditions:t.preconditions}:{},owner:r,created:{by:r,at:Hu()},description:"",cases:[],file:""};Ge(e.root,i),e.suites.push(i);let s=Zt(e,n.code).map(o=>o.code).filter(o=>o!==i.code),a=t.after?s.indexOf(t.after):-1;return s.splice(a>=0?a+1:s.length,0,i.code),fr(e,n.code,{suites:s}),i}function ju(e,t){let n=e.suites.find(r=>r.code===t);if(!n)throw new K(j(`Kh\xF4ng c\xF3 k\u1ECBch b\u1EA3n ${t}.`,`No test suite ${t}.`));return n}function Wu(e,t,n){let r=ju(e,t);for(let[i,s]of Object.entries(n))s!==void 0&&(s===""&&(i==="priority"||i==="preconditions"||i==="owner")?delete r[i]:r[i]=s);return Ge(e.root,r),r}function cs(e,t,n,r={}){let i=ju(e,t);if(!n.case.trim())throw new K(j("T\xECnh hu\u1ED1ng c\u1EA7n m\xF4 t\u1EA3.","The test case needs a description."));let s={code:un("TC",i.module,ss(e,r.avoid)),case:n.case.trim(),...n.requirement?{requirement:n.requirement.trim()}:{},steps:(n.steps??"").trim(),expected:(n.expected??"").trim(),...n.priority?{priority:n.priority}:{},...n.tag?{tag:n.tag.trim()}:{}},a=r.after?i.cases.findIndex(o=>o.code===r.after):-1;return i.cases.splice(a>=0?a+1:i.cases.length,0,s),Ge(e.root,i),s}function ds(e,t){if(!ti.test(t))throw new K(j(`M\xE3 t\xECnh hu\u1ED1ng \xAB${t}\xBB sai m\u1EABu (TC-<PH>-XXXXXX).`,`Test case code \xAB${t}\xBB has the wrong format (TC-<MODULE>-XXXXXX).`));for(let n of e.suites){let r=n.cases.find(i=>i.code===t);if(r)return{suite:n,tc:r}}throw new K(j(`Kh\xF4ng c\xF3 t\xECnh hu\u1ED1ng ${t}.`,`No test case ${t}.`))}function ps(e,t,n){let{suite:r,tc:i}=ds(e,t);for(let[s,a]of Object.entries(n)){if(a===void 0)continue;let o=typeof a=="string"?a.trim():a;o===""&&(s==="requirement"||s==="priority"||s==="tag")?delete i[s]:i[s]=o}return Ge(e.root,r),i}function Ku(e,t,n){let{suite:r,tc:i}=ds(e,t),s=r.cases.indexOf(i),a=s+n;return a<0||a>=r.cases.length||([r.cases[s],r.cases[a]]=[r.cases[a],r.cases[s]],Ge(e.root,r)),i}function us(e,t,n="",r){let{suite:i,tc:s}=ds(e,t);return s.deleted={by:r??gt(e.root),at:Hu(),...n?{reason:n}:{}},Ge(e.root,i),s}function hs(e,t,n){if(!Je.includes(n.status))throw new K(j(`Tr\u1EA1ng th\xE1i \xAB${n.status}\xBB kh\xF4ng h\u1EE3p l\u1EC7 (${Je.join(" | ")}).`,`Invalid status \xAB${n.status}\xBB (${Je.join(" | ")}).`));let{suite:r,tc:i}=ds(e,t);if(n.status==="failed"&&!(n.actual??"").trim())throw new K(j("Kh\xF4ng \u0111\u1EA1t: c\u1EA7n ghi k\u1EBFt qu\u1EA3 th\u1EF1c t\u1EBF.","Failed: enter the actual result."));if(n.status==="not-run")delete i.result;else{let s={status:n.status,by:n.by??gt(e.root),at:n.at??Hy()};n.actual?.trim()&&(s.actual=n.actual.trim()),n.env?.trim()&&(s.env=n.env.trim()),n.bug?.trim()&&(s.bug=n.bug.trim()),i.result=s}return Ge(e.root,r),i}var K,Hy,Hu,gr=Ae(()=>{"use strict";S();Dn();hn();En();Qr();K=class extends Error{},Hy=()=>new Date().toISOString().slice(0,10),Hu=()=>new Date().toISOString().replace(/\.\d{3}Z$/,"Z")});function ms(e,t){let n=[],r=Uy[e.config.language==="en"?"en":"vi"];for(let l of e.readErrors)n.push({rule:"E03",severity:"error",file:l.file,message:r.E03(l.message)});let i=new Map,s=(l,u)=>{let d=i.get(l);d?n.push({rule:"E01",severity:"error",code:l,file:u,message:r.E01(l,d)}):i.set(l,u)},a=new Set(e.modules.map(l=>l.code)),o=new Set;for(let l of e.suites){s(l.code,l.file),ei.exec(l.code)||n.push({rule:"E02",severity:"error",code:l.code,file:l.file,message:r.E02suite(l.code)}),a.has(l.module)||n.push({rule:"E04",severity:"error",code:l.code,file:l.file,message:r.E04(l.module)});for(let p of l.cases){s(p.code,l.file);let m=ti.exec(p.code);m?m[1]!==l.module&&!p.deleted&&n.push({rule:"E02",severity:"error",code:p.code,file:l.file,message:r.E02mod(p.code,m[1],l.code)}):n.push({rule:"E02",severity:"error",code:p.code,file:l.file,message:r.E02case(p.code)})}if(l.status==="deleted")continue;for(let p of l.covers)o.add(p);let d=l.cases.filter(p=>!p.deleted);if(d.length===0&&n.push({rule:"T06",severity:"warn",code:l.code,file:l.file,message:r.T06(l.code)}),l.kind==="functional"&&l.covers.length===0&&n.push({rule:"T01",severity:"warn",code:l.code,file:l.file,message:r.T01(l.code)}),t)for(let p of l.covers){let m=t.get(p);m?m.deleted&&n.push({rule:"T05",severity:"warn",code:l.code,file:l.file,message:r.T05del(l.code,p)}):n.push({rule:"T05",severity:"warn",code:l.code,file:l.file,message:r.T05none(l.code,p)})}for(let p of d){let m=[!p.steps.trim()&&r.steps,!p.expected.trim()&&r.expected].filter(Boolean);m.length&&n.push({rule:"T03",severity:"warn",code:p.code,file:l.file,message:r.T03(p.code,m.join(r.and))}),p.result?.status==="failed"&&!p.result.actual?.trim()&&n.push({rule:"T04",severity:"warn",code:p.code,file:l.file,message:r.T04(p.code)})}}if(t)for(let l of t.values())l.deleted||l.type!=="function"||o.has(l.code)||n.push({rule:"T02",severity:"info",code:l.code,message:r.T02(l.code,l.title)});let c={error:0,warn:1,info:2};return n.sort((l,u)=>c[l.severity]-c[u.severity]||l.rule.localeCompare(u.rule))}function br(){return{total:0,"not-run":0,passed:0,failed:0,blocked:0,skipped:0}}function Qo(e,t=br()){for(let n of e.cases)n.deleted||(t.total++,t[n.result?.status??"not-run"]++);return t}function fs(e,t){let n=br(),r=e.modules.map(s=>{let a=e.suites.filter(c=>c.module===s.code&&c.status!=="deleted"),o=br();for(let c of a)Qo(c,o);for(let c of Object.keys(n))n[c]+=o[c];return{code:s.code,title:s.title,suites:a.length,count:o}}),i=null;if(t){let s=new Set(e.suites.filter(o=>o.status!=="deleted").flatMap(o=>o.covers)),a=[...t.values()].filter(o=>o.type==="function"&&!o.deleted);i={functions:a.length,covered:a.filter(o=>s.has(o.code)).length}}return{all:n,modules:r,coverage:i}}var Uy,gs=Ae(()=>{"use strict";S();hn();Uy={vi:{E03:e=>`Kh\xF4ng \u0111\u1ECDc \u0111\u01B0\u1EE3c t\u1EC7p: ${e}`,E01:(e,t)=>`Tr\xF9ng m\xE3 ${e} (\u0111\xE3 c\xF3 \u1EDF ${t}) \u2014 \u0111\u1ED5i m\xE3 m\u1ED9t b\xEAn (th\u01B0\u1EDDng do hai nh\xE1nh git c\xF9ng sinh).`,E02suite:e=>`M\xE3 k\u1ECBch b\u1EA3n \xAB${e}\xBB sai m\u1EABu.`,E04:e=>`K\u1ECBch b\u1EA3n thu\u1ED9c ph\xE2n h\u1EC7 ${e} nh\u01B0ng ch\u01B0a c\xF3 modules/${e}/_module.md.`,E02case:e=>`M\xE3 t\xECnh hu\u1ED1ng \xAB${e}\xBB sai m\u1EABu (TC-<PH>-XXXXXX).`,E02mod:(e,t,n)=>`T\xECnh hu\u1ED1ng ${e} mang m\xE3 ph\xE2n h\u1EC7 ${t} nh\u01B0ng n\u1EB1m trong k\u1ECBch b\u1EA3n ${n}.`,T06:e=>`K\u1ECBch b\u1EA3n ${e} ch\u01B0a c\xF3 t\xECnh hu\u1ED1ng.`,T01:e=>`K\u1ECBch b\u1EA3n ${e} ch\u01B0a ghi ch\u1EE9c n\u0103ng n\xE0o \u0111\u01B0\u1EE3c ki\u1EC3m (covers).`,T05none:(e,t)=>`${e} ph\u1EE7 ${t} nh\u01B0ng repo BA kh\xF4ng c\xF3 m\u1EE5c n\xE0y.`,T05del:(e,t)=>`${e} ph\u1EE7 ${t} \u2014 m\u1EE5c n\xE0y \u0111\xE3 b\u1ECB xo\xE1 trong repo BA.`,steps:"c\xE1c b\u01B0\u1EDBc",expected:"k\u1EBFt qu\u1EA3 mong \u0111\u1EE3i",and:" v\xE0 ",T03:(e,t)=>`T\xECnh hu\u1ED1ng ${e} thi\u1EBFu ${t}.`,T04:e=>`T\xECnh hu\u1ED1ng ${e} Kh\xF4ng \u0111\u1EA1t nh\u01B0ng ch\u01B0a ghi k\u1EBFt qu\u1EA3 th\u1EF1c t\u1EBF.`,T02:(e,t)=>`Ch\u1EE9c n\u0103ng ${e}${t?" \xAB"+t+"\xBB":""} ch\u01B0a c\xF3 k\u1ECBch b\u1EA3n ki\u1EC3m th\u1EED.`},en:{E03:e=>`Cannot read the file: ${e}`,E01:(e,t)=>`Duplicate code ${e} (already in ${t}) \u2014 change one of them (usually two git branches generated the same code).`,E02suite:e=>`Test suite code \xAB${e}\xBB has the wrong format.`,E04:e=>`The test suite belongs to module ${e}, but modules/${e}/_module.md does not exist.`,E02case:e=>`Test case code \xAB${e}\xBB has the wrong format (TC-<MODULE>-XXXXXX).`,E02mod:(e,t,n)=>`Test case ${e} has module code ${t} but is in test suite ${n}.`,T06:e=>`Test suite ${e} has no test cases yet.`,T01:e=>`Test suite ${e} does not name any function under test (covers).`,T05none:(e,t)=>`${e} covers ${t}, but the BA repo has no such item.`,T05del:(e,t)=>`${e} covers ${t} \u2014 that item was deleted in the BA repo.`,steps:"steps",expected:"expected result",and:" and ",T03:(e,t)=>`Test case ${e} has no ${t}.`,T04:e=>`Test case ${e} failed but has no actual result.`,T02:(e,t)=>`Function ${e}${t?" \xAB"+t+"\xBB":""} has no test suite yet.`}}});function Pr(e){"@babel/helpers - typeof";return Pr=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Pr(e)}function Wy(e,t){if(Pr(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(Pr(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Ky(e){var t=Wy(e,"string");return Pr(t)=="symbol"?t:t+""}function C(e,t,n){return(t=Ky(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Gu(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function k(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Gu(Object(n),!0).forEach(function(r){C(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Gu(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function zy(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.includes(r))continue;n[r]=e[r]}return n}function Yl(e,t){if(e==null)return{};var n,r,i=zy(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(r=0;r<s.length;r++)n=s[r],t.includes(n)||{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function AC(e,t){return EC(e,t||{},0,0)}function _C(e,t){return xC(e,{i:2},t&&t.out,t&&t.dictionary)}function Sh(e,t){if(t){for(var n=new oe(e.length),r=0;r<e.length;++r)n[r]=e.charCodeAt(r);return n}if(Th)return Th.encode(e);for(var i=e.length,s=new oe(e.length+(e.length>>1)),a=0,o=function(u){s[a++]=u},r=0;r<i;++r){if(a+5>s.length){var c=new oe(a+8+(i-r<<1));c.set(s),s=c}var l=e.charCodeAt(r);l<128||t?o(l):l<2048?(o(192|l>>6),o(128|l&63)):l>55295&&l<57344?(l=65536+(l&1047552)|e.charCodeAt(++r)&1023,o(240|l>>18),o(128|l>>12&63),o(128|l>>6&63),o(128|l&63)):(o(224|l>>12),o(128|l>>6&63),o(128|l&63))}return Wr(s,0,a)}function IC(e,t){if(t){for(var n="",r=0;r<e.length;r+=16384)n+=String.fromCharCode.apply(null,e.subarray(r,r+16384));return n}else{if($l)return $l.decode(e);var i=NC(e),s=i.s,n=i.r;return n.length&&Ce(8),s}}function MC(e,t){t||(t={});var n={},r=[];Rf(e,"",n,t);var i=0,s=0;for(var a in n){var o=n[a],c=o[0],l=o[1],u=l.level==0?0:8,d=Sh(a),p=d.length,m=l.comment,f=m&&Sh(m),h=f&&f.length,g=Fl(l.extra);p>65535&&Ce(11);var y=u?AC(c,l):c,x=y.length,b=CC();b.p(c),r.push(Of(l,{size:c.length,crc:b.d(),c:y,f:d,m:f,u:p!=a.length||f&&m.length!=h,o:i,compression:u})),i+=30+p+g+x,s+=76+2*(p+g)+(h||0)+x}for(var E=new oe(s+22),_=i,v=s-i,T=0;T<r.length;++T){var d=r[T];Ch(E,d.o,d,d.f,d.u,d.c.length);var w=30+d.f.length+Fl(d.extra);E.set(d.c,d.o+w),Ch(E,i,d,d.f,d.u,d.c.length,d.o,d.m),i+=16+w+(d.m?d.m.length:0)}return LC(E,i,r.length,v,_),E}function DC(e,t){for(var n={},r=e.length-22;De(e,r)!=101010256;--r)(!r||e.length-r>65558)&&Ce(13);var i=nt(e,r+8);if(!i)return{};var s=De(e,r+16),a=De(e,r-20)==117853008;if(a){var o=De(e,r-12);a=De(e,o)==101075792,a&&(i=De(e,o+32),s=De(e,o+48))}for(var c=t&&t.filter,l=0;l<i;++l){var u=OC(e,s,a),d=u[0],p=u[1],m=u[2],f=u[3],h=u[4],g=u[5],y=PC(e,g);s=h,(!c||c({name:f,size:p,originalSize:m,compression:d}))&&(d?d==8?n[f]=_C(e.subarray(y,y+p),{out:new oe(m)}):Ce(14,"unknown compression type "+d):n[f]=Wr(e,y,y+p))}return n}function Nh(e,t,n,r,i,s,a){try{var o=e[s](a),c=o.value}catch(l){n(l);return}o.done?t(c):Promise.resolve(c).then(r,i)}function jt(e){return function(){var t=this,n=arguments;return new Promise(function(r,i){var s=e.apply(t,n);function a(c){Nh(s,r,i,a,o,"next",c)}function o(c){Nh(s,r,i,a,o,"throw",c)}a(void 0)})}}var jy,Fr,zh,Fs,Gy,I,kt,H,Vh,_e,Vy,Xy,Yy,Xh,Ts,Jy,Qy,qr,Zy,Yh,Ps,ex,Zo,Jh,Qh,U,Zh,em,tx,Jl,nx,rx,ix,tm,le,qs,nm,zu,Ql,sx,$t,rm,im,rt,ax,ve,ox,sm,lx,cx,dx,P,el,am,it,vr,Er,en,O,pe,om,Zl,lm,cm,dm,ec,px,ux,hx,Vu,mx,Xu,fx,gx,bx,vx,Yu,wx,yx,xx,tc,kx,nc,Hr,ue,Ur,Tx,Sx,Cx,Ex,Hs,rc,Sr,pm,Ax,um,_x,nn,rn,Ft,qt,Nx,Ix,Px,Ox,Us,Rx,qe,Lx,Mx,Dx,Bx,$x,Fx,qx,Hx,Ux,jx,et,HI,Wx,Kx,Gx,Ju,ze,Rn,zx,Vx,Xx,UI,Yx,hm,Jx,Qx,Ln,wr,mm,Zx,ek,tk,nk,rk,ik,tl,fm,sk,ak,gm,ok,sn,lk,ck,Or,bs,dk,Fe,Oe,ic,pk,bm,uk,hk,mk,fk,gk,bk,vk,sc,vm,wm,wk,yk,xk,kk,Tk,ym,Sk,Rr,xm,Ck,Ek,km,Tm,Ak,Sm,Cm,Em,ac,_k,Nk,at,ot,Xe,Be,oc,Ik,Am,Pk,Ok,Rk,_m,Lk,Mk,Nm,Im,_l,lc,Pm,Dk,Om,Bk,$k,Fk,qk,Hk,Uk,jk,Wk,Kk,Gk,cc,zk,Nl,Vk,Xk,nl,Qu,js,Rm,Yk,Jk,jr,Qk,be,Zk,e1,Zu,t1,n1,r1,i1,s1,a1,o1,l1,c1,d1,p1,Ws,u1,h1,Mm,m1,Pn,f1,Ks,Cr,eh,g1,b1,v1,vs,w1,y1,dc,x1,pc,Dm,k1,T1,S1,Bm,Fm,qm,C1,E1,A1,_1,Hm,Os,ws,N1,I1,P1,O1,Um,R1,L1,rl,M1,D1,On,th,ne,B1,jI,Wm,$1,F1,In,nh,il,q1,Km,H1,U1,rh,j1,W1,K1,G1,Rs,z1,V1,X1,Y1,tt,Ss,Il,J1,zm,$e,Lr,Cs,Vm,uc,Q1,Z1,ih,eT,Es,tT,nT,rT,iT,sT,aT,oT,lT,Xm,cT,dT,pT,uT,hT,Ym,mT,sh,fT,gT,Jm,bT,Mr,Pl,An,vT,Qm,sl,wT,yT,xT,kT,Zm,TT,ST,CT,hc,ET,AT,ef,_T,Ls,Ar,NT,Gs,tf,IT,PT,OT,bt,ge,RT,Ol,zs,LT,MT,ah,DT,BT,$T,FT,qT,HT,UT,jT,WT,KT,GT,zT,rf,VT,sf,oh,al,XT,af,YT,of,lf,JT,QT,ZT,eS,tS,nS,cf,lh,ol,rS,df,iS,sS,aS,oS,lS,pf,vt,cS,dS,pS,uS,hS,mS,fS,gS,bS,vS,wS,ll,yS,xS,ch,kS,TS,SS,CS,uf,hf,ES,AS,dh,ph,_S,NS,uh,IS,PS,OS,hh,mh,RS,LS,MS,mf,DS,BS,$S,mc,Tt,an,Ut,FS,qS,HS,US,jS,WS,KS,GS,zS,VS,XS,ff,fh,wt,gf,bf,vf,wf,yf,xf,YS,JS,QS,_r,fc,gh,bh,Rl,ZS,eC,cl,tC,nC,rC,iC,sC,aC,gc,vh,kf,oC,dl,lC,cC,wh,dC,Tf,As,pl,ul,hl,pC,uC,hC,Ye,Sf,Cf,on,bc,mC,oe,Le,vc,Vs,Xs,Ll,Ef,Af,_f,Ml,Nf,fC,yh,Dl,yt,Y,st,Ht,Y,Y,Y,Y,Dr,Y,gC,bC,vC,wC,ml,Ve,fl,wc,Wr,yC,Ce,xC,xt,yr,gl,Bl,xh,xr,If,kh,kC,Pf,TC,SC,CC,EC,Of,nt,De,bl,ke,Rf,Th,$l,NC,PC,OC,RC,Fl,Ch,LC,BC,Ms,$C,Eh,Lf,vl,_s,Ah,ql,FC,qC,HC,Br,Kr,Hl,Nr,UC,jC,WC,KC,GC,zC,VC,Mf,XC,YC,JC,Df,kr,wl,QC,ZC,ln,Bf,$f,eE,Ff,tE,nE,yl,rE,yc,iE,sE,_h,aE,oE,Ih,Ph,xc,qf,Hf,lE,cE,Ys,lt,Uf,jf,Te,Wf,_n,dE,pE,uE,kc,Ul,$r,Oh,hE,Rh,Lh,jl,mE,Mh,Dh,fE,gE,bE,vE,wE,Wl,Tc,yE,Ds,Kf,xE,kE,Se,TE,Js,Gf,Bh,SE,CE,Kl,Gl,EE,AE,_E,NE,IE,PE,OE,RE,zf,LE,ys,ME,DE,xs,Vf,BE,$h,$E,FE,ks,qE,HE,Fh,UE,jE,WE,qh,KE,zl,xl,GE,zE,VE,Xf,Ns,XE,YE,Yf,Bs,Gr,JE,Jf,QE,ZE,e2,Tr,Qf,kl,Hh,Zf,Sc,Tl,t2,Uh,n2,Cc,r2,i2,s2,a2,o2,Vl,l2,c2,eg,d2,Sl,jh,tn,tg,p2,u2,ng,h2,m2,f2,Cl,g2,Ir,Xl,Is,Wh,b2,v2,w2,y2,x2,k2,T2,S2,rg,C2,E2,A2,_2,ig,N2,I2,$s,P2,sg,O2,R2,ag,og,L2,lg,Kh,M2,D2,B2,Gh,WI,$2,KI,El,F2,cg=Ae(()=>{S();jy=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t,t.exports),e=null),t.exports);Fr=class{constructor(e){C(this,"rootKey",void 0),this.rootKey=e}get writtenAs(){}},zh=e=>e instanceof Fr||typeof e=="object"&&e!==null&&typeof e.prepForXml=="function",Fs=e=>zh(e)?e.rootKey:void 0,Gy=Object.seal({}),I=class extends Fr{constructor(e){super(e),C(this,"root",void 0),this.root=new Array}prepForXml(e){var t;e.stack.push(this);let n=this.root.flatMap(r=>{if(zh(r)){let i=r.writtenAs;return i?i.map(s=>s.prepForXml(e)):r.prepForXml(e)}return r}).filter(r=>r!==void 0);return e.stack.pop(),{[this.rootKey]:n.length?n.length===1&&(!((t=n[0])===null||t===void 0)&&t._attr)?n[0]:n:Gy}}addChildElement(e){return this.root.push(e),this}},kt=class extends I{constructor(e,t){super(e),C(this,"includeIfEmpty",void 0),this.includeIfEmpty=t}prepForXml(e){let t=super.prepForXml(e);return this.includeIfEmpty||t&&(typeof t[this.rootKey]!="object"||Object.keys(t[this.rootKey]).length)?t:void 0}};H=class extends Fr{constructor(e){super("_attr"),C(this,"root",void 0),C(this,"xmlKeys",void 0),this.root=e}prepForXml(e){let t={};return Object.entries(this.root).forEach(([n,r])=>{if(r!==void 0){let i=this.xmlKeys&&this.xmlKeys[n]||n;t[i]=r}}),{_attr:t}}},Vh=class extends Fr{constructor(e){super("_attr"),C(this,"root",void 0),this.root=e}prepForXml(e){return{_attr:Object.values(this.root).filter(({value:t})=>t!==void 0).reduce((t,{key:n,value:r})=>k(k({},t),{},{[n]:r}),{})}}},_e=class extends H{constructor(...e){super(...e),C(this,"xmlKeys",{val:"w:val",color:"w:color",fill:"w:fill",space:"w:space",sz:"w:sz",type:"w:type",rsidR:"w:rsidR",rsidRPr:"w:rsidRPr",rsidSect:"w:rsidSect",w:"w:w",h:"w:h",top:"w:top",right:"w:right",bottom:"w:bottom",left:"w:left",header:"w:header",footer:"w:footer",gutter:"w:gutter",linePitch:"w:linePitch",pos:"w:pos"})}};Vy=["elements"],Xy=new Map([["amp","&"],["lt","<"],["gt",">"],["quot",'"'],["apos","'"]]),Yy=/&([^;]*);?/g,Xh=e=>e.indexOf("&")===-1?e:e.replace(Yy,(t,n)=>{if(!t.endsWith(";"))throw new Error(`Invalid XML: "&" that starts no entity, in "${e}"`);let r=Xy.get(n);if(r!==void 0)return r;let i=/^#x[0-9a-f]+$/i.test(n)?parseInt(n.slice(2),16):/^#[0-9]+$/.test(n)?parseInt(n.slice(1),10):NaN;if(!(i>0&&i<=1114111))throw new Error(`Invalid XML: unknown entity "${t}"`);return String.fromCodePoint(i)}),Ts=e=>e===" "||e===`
|
|
5286
|
+
`||e===" "||e==="\r",Jy=/([\w:-]+)\s*=\s*(?:"([^"]*)"|'([^']*)')/g,Qy=e=>Object.fromEntries([...e.matchAll(Jy)].map(([,t,n,r])=>[t,n??r])),qr=(e,{keepWhitespaceText:t=!1}={})=>{let n={},r=[],i=e.charCodeAt(0)===65279?1:0;for(;i<e.length&&Ts(e[i]);)i++;let s=d=>{var p;let m=r.length===0?n:r[r.length-1];((p=m.elements)!==null&&p!==void 0?p:m.elements=[]).push(d)},a=d=>{if(d.trim()===""){d!==""&&t&&s({type:"text",text:d});return}if(r.length===0)throw new Error(`Invalid XML: text outside of the root element, "${d.trim()}"`);s({type:"text",text:Xh(d)})},o=(d,p,m)=>{let f=e.indexOf(d,p);if(f===-1)throw new Error(`Invalid XML: ${m} that isn't closed`);return f};for(;i<e.length;){let d=e.indexOf("<",i);if(a(e.slice(i,d===-1?e.length:d)),d===-1)break;if(e.startsWith("<?",d)){let p=o("?>",d+2,"processing instruction"),m=e.slice(d+2,p),f=m.search(/\s/),h=f===-1?m:m.slice(0,f),g=f===-1?"":m.slice(f).trimStart();if(h.toLowerCase()==="xml"){let y=Qy(g);n.declaration=Object.keys(y).length>0?{attributes:y}:{}}else s({type:"instruction",name:h,instruction:g});i=p+2}else if(e.startsWith("<!--",d)){let p=o("-->",d+4,"comment"),m=e.slice(d+4,p);m!==""&&s({type:"comment",comment:m}),i=p+3}else if(e.startsWith("<![CDATA[",d)){let p=o("]]>",d+9,"CDATA section"),m=e.slice(d+9,p);m!==""&&s({type:"cdata",cdata:m}),i=p+3}else if(e.startsWith("<!DOCTYPE",d)){let p=d+9,m,f=!1;for(;p<e.length;p++){let h=e[p];if(m!==void 0)m=h===m?void 0:m;else if(h==='"'||h==="'")m=h;else if(h==="[")f=!0;else if(h==="]")f=!1;else if(h===">"&&!f)break}if(p===e.length)throw new Error("Invalid XML: DOCTYPE that isn't closed");s({type:"doctype",doctype:e.slice(d+9,p).replace(/^ /,"")}),i=p+1}else if(e.startsWith("</",d)){let p=o(">",d+2,"closing tag"),m=e.slice(d+2,p).trimEnd(),f=r.pop();if(f?.name!==m){var c;throw new Error(`Invalid XML: closing tag </${m}> doesn't match <${(c=f?.name)!==null&&c!==void 0?c:""}>`)}i=p+1}else i=Zy(e,d+1,(p,m)=>{s(p),m||r.push(p)})}if(r.length>0)throw new Error(`Invalid XML: <${r[r.length-1].name}> isn't closed`);let{elements:l}=n,u=Yl(n,Vy);return l===void 0?u:k(k({},u),{},{elements:l})},Zy=(e,t,n)=>{let r=t;for(;r<e.length&&!Ts(e[r])&&e[r]!=="/"&&e[r]!==">";)r++;let i=e.slice(t,r);if(i==="")throw new Error("Invalid XML: tag without a name");let s=[],a=r;for(;;){for(;a<e.length&&Ts(e[a]);)a++;if(a>=e.length)throw new Error(`Invalid XML: <${i}> that isn't closed`);if(e[a]===">"||e.startsWith("/>",a)){let p=e[a]==="/";return n(k({type:"element",name:i},s.length>0?{attributes:Object.fromEntries(s)}:{}),p),a+(p?2:1)}let o=e.indexOf("=",a),c=e.slice(a,o===-1?e.length:o).trimEnd();if(o===-1||c===""||/[\s/>]/.test(c))throw new Error(`Invalid XML: attribute of <${i}> without a value`);let l=o+1;for(;l<e.length&&Ts(e[l]);)l++;let u=e[l];if(u!=='"'&&u!=="'")throw new Error(`Invalid XML: value of ${c} on <${i}> isn't quoted`);let d=e.indexOf(u,l+1);if(d===-1)throw new Error(`Invalid XML: value of ${c} on <${i}> isn't closed`);s.some(([p])=>p===c)||s.push([c,Xh(e.slice(l+1,d))]),a=d+1}},Yh=new Map([["&","&"],['"',"""],["'","'"],["<","<"],[">",">"]]),Ps=e=>e.replace(/[&"'<>\x00-\x08\x0B\x0C\x0E-\x1F]/g,t=>{var n;return(n=Yh.get(t))!==null&&n!==void 0?n:""}),ex=e=>e.replace(/[&<>\x00-\x08\x0B\x0C\x0E-\x1F]/g,t=>{var n;return(n=Yh.get(t))!==null&&n!==void 0?n:""}),Zo=e=>typeof e=="string"?Ps(e):e,Jh=(e,t,n)=>{let r=Object.keys(e)[0],i=r===void 0?void 0:e[r],s=[],a=[],o=c=>{for(let[l,u]of Object.entries(c))s.push(`${l}="${String(Zo(u))}"`)};if(typeof i=="object"){if(i!==null){let{_attr:c,_cdata:l}=i;if(c&&o(c),l&&a.push(`<![CDATA[${l.replace(/\]\]>/g,"]]]]><![CDATA[>")}]]>`),Array.isArray(i)){let u=!1;a.push("");for(let d of i)typeof d=="object"?Object.keys(d)[0]==="_attr"?o(d._attr):a.push(Jh(d,t,n+1)):(a.pop(),u=!0,a.push(Zo(d)));u||a.push("")}}}else a.push(Zo(i));return{name:r,attributes:s,content:a,indents:n>1?t.repeat(n-1):""}},Qh=(e,t,n)=>{if(typeof e!="object")return String(e);let{name:r,attributes:i,content:s,indents:a}=e,{length:o}=s,c=a+(r?`<${r}`:"")+(i.length>0?` ${i.join(" ")}`:"")+(o>0?r?">":"":"/>")+(t&&o>1?`
|
|
5287
|
+
`:"");return o===0?c+(t?`
|
|
5288
|
+
`:""):c+s.map(l=>l===void 0?"":Qh(l,t,!1)).join("")+(o>1?a:"")+(r?`</${r}>`:"")+(t&&!n?`
|
|
5289
|
+
`:"")},U=(e,{indent:t="",declaration:n}={})=>{let r=Array.isArray(e)?e:[e],i=t?1:0,s=n?.standalone?` standalone="${Ps(n.standalone)}"`:"";return(n===void 0?"":`<?xml version="1.0" encoding="${Ps(n.encoding||"UTF-8")}"${s}?>${t?`
|
|
5290
|
+
`:""}`)+r.map((a,o)=>Qh(Jh(a,t,i),t,o===r.length-1)).join("")},Zh=e=>Object.entries(e??{}).flatMap(([t,n])=>n==null?[]:[` ${t}="${Ps(String(n))}"`]).join(""),em=e=>{switch(e.type){case"element":{var t,n;let r=(t=e.elements)!==null&&t!==void 0?t:[],i=`<${e.name}${Zh(e.attributes)}`;return r.length>0||((n=e.attributes)===null||n===void 0?void 0:n["xml:space"])==="preserve"?`${i}>${r.map(em).join("")}</${e.name}>`:`${i}/>`}case"text":return ex(String(e.text));case"cdata":return`<![CDATA[${String(e.cdata).replace(/\]\]>/g,"]]]]><![CDATA[>")}]]>`;case"comment":return`<!--${e.comment}-->`;case"doctype":return`<!DOCTYPE ${e.doctype}>`;case"instruction":return`<?${e.name}${e.instruction?` ${e.instruction}`:""}?>`;default:return""}},tx=e=>{var t;return(e.declaration?`<?xml${Zh(e.declaration.attributes)}?>`:"")+((t=e.elements)!==null&&t!==void 0?t:[]).map(em).join("")},Jl=e=>{switch(e.type){case void 0:case"element":let t=new rx(e.name,e.attributes),n=e.elements||[];for(let r of n){let i=Jl(r);i!==void 0&&t.push(i)}return t;case"text":return e.text;default:return}},nx=class extends H{},rx=class extends I{static fromXmlString(e){return Jl(qr(e))}constructor(e,t){super(e),t&&this.root.push(new nx(t))}push(e){this.root.push(e)}get writtenAs(){return this.rootKey===void 0?this.root.filter(e=>typeof e!="string"):void 0}prepForXml(e){let t=this.writtenAs;return t?.length===1?t[0].prepForXml(e):super.prepForXml(e)}},ix=class extends I{constructor(e){super(""),C(this,"_attr",void 0),this._attr=e}prepForXml(e){return{_attr:this._attr}}},tm=class extends I{constructor(e,t){super(e),t&&(this.root=t.root)}},le=e=>{if(!Number.isFinite(e))throw new Error(`Invalid value '${e}' specified. Must be an integer.`);return Math.floor(e)},qs=e=>{let t=le(e);if(t<0)throw new Error(`Invalid value '${e}' specified. Must be a positive integer.`);return t},nm=(e,t)=>{let n=t*2;if(e.length!==n||isNaN(+`0x${e}`))throw new Error(`Invalid hex value '${e}'. Expected ${n} digit hex value`);return e},zu=e=>nm(e,1),Ql=e=>{let t=e.slice(-2),n=e.substring(0,e.length-2);return`${Number(n)}${t}`},sx={in:1440,cm:1440/2.54,mm:1440/25.4,pt:20,pc:240,pi:240},$t=e=>{if(typeof e=="number")return e;let t=e.slice(-2),n=Number(e.substring(0,e.length-2)),r=sx[t];if(r===void 0||Number.isNaN(n))throw new Error(`Invalid universal measure '${e}'. Expected a number followed by mm, cm, in, pt, pc or pi.`);return n*r},rm=e=>{let t=Ql(e);if(parseFloat(t)<0)throw new Error(`Invalid value '${t}' specified. Expected a positive number.`);return t},im=e=>e==="auto"?e:nm(e.charAt(0)==="#"?e.substring(1):e,3),rt=e=>typeof e=="string"?Ql(e):le(e),ax=e=>typeof e=="string"?rm(e):qs(e),ve=e=>typeof e=="string"?rm(e):qs(e),ox=e=>{let t=e.substring(0,e.length-1);return`${Number(t)}%`},sm=e=>typeof e=="number"?le(e):e.slice(-1)==="%"?ox(e):Ql(e),lx=qs,cx=qs,dx=e=>e.toISOString(),P=class extends I{constructor(e,t=!0){super(e),t!==!0&&this.root.push(new _e({val:t}))}},el=class extends I{constructor(e,t){super(e),this.root.push(new _e({val:ax(t)}))}},am=class extends I{},it=class extends I{constructor(e,t){super(e),this.root.push(new _e({val:t}))}},vr=(e,t)=>new O({name:e,attributes:{value:{key:"w:val",value:t}}}),Er=class extends I{constructor(e,t){super(e),this.root.push(new _e({val:t}))}},en=class extends I{constructor(e,t){super(e),this.root.push(t)}},O=class extends I{constructor({name:e,attributes:t,children:n}){super(e),t&&this.root.push(new Vh(t)),n&&this.root.push(...n)}},pe={START:"start",CENTER:"center",END:"end",BOTH:"both",MEDIUM_KASHIDA:"mediumKashida",DISTRIBUTE:"distribute",NUM_TAB:"numTab",HIGH_KASHIDA:"highKashida",LOW_KASHIDA:"lowKashida",THAI_DISTRIBUTE:"thaiDistribute",LEFT:"left",RIGHT:"right",JUSTIFIED:"both"},om=e=>new O({name:"w:jc",attributes:{val:{key:"w:val",value:e}}}),Zl={dark1:"dk1",light1:"lt1",dark2:"dk2",light2:"lt2",accent1:"accent1",accent2:"accent2",accent3:"accent3",accent4:"accent4",accent5:"accent5",accent6:"accent6",hyperlink:"hlink",followedHyperlink:"folHlink"},lm={dark2:"44546A",light2:"E7E6E6",accent1:"4472C4",accent2:"ED7D31",accent3:"A5A5A5",accent4:"FFC000",accent5:"5B9BD5",accent6:"70AD47",hyperlink:"0563C1",followedHyperlink:"954F72"},cm={dark1:{value:"windowText",lastColor:"000000"},light1:{value:"window",lastColor:"FFFFFF"}},dm=(e,t)=>{if(t==="auto")throw new Error(`Invalid theme color ${e} 'auto'. Expected 6 digit hex value`);return im(t)},ec=(e={})=>Object.fromEntries(Object.keys(Zl).map(t=>{let n=e[t],r=t==="dark1"||t==="light1"?cm[t].lastColor:lm[t];return[t,n===void 0?r:dm(t,n)]})),px=(e,t)=>new O({name:"a:srgbClr",attributes:{value:{key:"val",value:dm(e,t)}}}),ux=(e,t)=>{let n=t[e],r=e==="dark1"||e==="light1"?cm[e]:void 0;return new O({name:`a:${Zl[e]}`,children:[n===void 0&&r?new O({name:"a:sysClr",attributes:{value:{key:"val",value:r.value},lastColor:{key:"lastClr",value:r.lastColor}}}):px(e,n??lm[e])]})},hx=(e,t={})=>new O({name:"a:clrScheme",attributes:{name:{key:"name",value:e}},children:Object.keys(Zl).map(n=>ux(n,t))}),Vu=new Set(["dark1","light1","dark2","light2","accent1","accent2","accent3","accent4","accent5","accent6","hyperlink","followedHyperlink"]),mx=new Map([["dk1","dark1"],["lt1","light1"],["dk2","dark2"],["lt2","light2"],["hlink","hyperlink"],["folHlink","followedHyperlink"],["text1","dark1"],["background1","light1"],["text2","dark2"],["background2","light2"]]),Xu=(e,t)=>{if(!(e>=0&&e<=100))throw new Error(`Invalid ${t} ${e}. Expected a number from 0 to 100`);return Math.round(255*(1-e/100))},fx=({theme:e,lighter:t,darker:n})=>{if(!Vu.has(e)){let s=mx.get(e);throw new Error(`Invalid theme color "${e}". ${s?`Did you mean "${s}"?`:`Expected one of ${[...Vu].join(", ")}`}`)}if(t!==void 0&&n!==void 0)throw new Error("Invalid theme color. Expected lighter or darker, not both");let r=t===void 0?void 0:Xu(t,"lighter"),i=n===void 0?void 0:Xu(n,"darker");return{tint:r===255?void 0:r,shade:i===255?void 0:i}},gx=e=>{let[t,n,r]=[0,2,4].map(c=>parseInt(e.slice(c,c+2),16)/255),i=Math.max(t,n,r),s=Math.min(t,n,r),a=(i+s)/2,o=i-s;return o===0?{hue:0,saturation:0,lightness:a}:{hue:(i===t?((n-r)/o+6)%6:i===n?(r-t)/o+2:(t-n)/o+4)*60,saturation:o/(1-Math.abs(2*a-1)),lightness:a}},bx=({hue:e,saturation:t,lightness:n})=>{let r=(1-Math.abs(2*n-1))*t,i=r*(1-Math.abs(e/60%2-1)),[s,a,o]=e<60?[r,i,0]:e<120?[i,r,0]:e<180?[0,r,i]:e<240?[0,i,r]:e<300?[i,0,r]:[r,0,i],c=n-r/2;return[s,a,o].map(l=>Math.floor((l+c)*255+1e-9).toString(16).padStart(2,"0")).join("").toUpperCase()},vx=(e,{tint:t,shade:n})=>{if(t===void 0&&n===void 0)return e;let r=gx(e),i=t===void 0?r.lightness*n/255:r.lightness*t/255+(1-t/255);return bx(k(k({},r),{},{lightness:i}))},Yu=e=>e===void 0?void 0:e.toString(16).padStart(2,"0").toUpperCase(),wx=e=>typeof e=="string"?{type:"hex",value:im(e)}:{type:"theme",color:e,change:fx(e)},yx=(e,t)=>e.type==="hex"?{color:e.value}:{color:vx(t[e.color.theme],e.change),theme:e.color.theme,tint:Yu(e.change.tint),shade:Yu(e.change.shade)},xx=ec(),tc=class extends Fr{constructor(e){super("_attr"),C(this,"attributes",void 0),this.attributes=e.map(t=>"keys"in t?{keys:t.keys,color:t.color===void 0?void 0:wx(t.color)}:t)}prepForXml(e){var t,n;let r=(t=(n=e.file)===null||n===void 0||(n=n.Theme)===null||n===void 0?void 0:n.Colors)!==null&&t!==void 0?t:xx,i=this.attributes.flatMap(s=>{if(!("keys"in s))return[[s.key,s.value]];if(s.color===void 0)return[];let{keys:a}=s,o=yx(s.color,r);return[[a.color,o.color],[a.theme,o.theme],[a.tint,o.tint],[a.shade,o.shade]]});return{_attr:Object.fromEntries(i.filter(([,s])=>s!==void 0))}}},kx=class extends I{constructor(e,t){super(e),this.root.push(new tc(t))}},nc=(e,t)=>new kx(e,t),Hr={color:"w:color",theme:"w:themeColor",tint:"w:themeTint",shade:"w:themeShade"},ue=(e,{color:t,size:n,space:r,style:i})=>nc(e,[{key:"w:val",value:i},{keys:Hr,color:t},{key:"w:sz",value:n===void 0?void 0:lx(n)},{key:"w:space",value:r===void 0?void 0:cx(r)}]),Ur={SINGLE:"single",DASH_DOT_STROKED:"dashDotStroked",DASHED:"dashed",DASH_SMALL_GAP:"dashSmallGap",DOT_DASH:"dotDash",DOT_DOT_DASH:"dotDotDash",DOTTED:"dotted",DOUBLE:"double",DOUBLE_WAVE:"doubleWave",INSET:"inset",NIL:"nil",NONE:"none",OUTSET:"outset",THICK:"thick",THICK_THIN_LARGE_GAP:"thickThinLargeGap",THICK_THIN_MEDIUM_GAP:"thickThinMediumGap",THICK_THIN_SMALL_GAP:"thickThinSmallGap",THIN_THICK_LARGE_GAP:"thinThickLargeGap",THIN_THICK_MEDIUM_GAP:"thinThickMediumGap",THIN_THICK_SMALL_GAP:"thinThickSmallGap",THIN_THICK_THIN_LARGE_GAP:"thinThickThinLargeGap",THIN_THICK_THIN_MEDIUM_GAP:"thinThickThinMediumGap",THIN_THICK_THIN_SMALL_GAP:"thinThickThinSmallGap",THREE_D_EMBOSS:"threeDEmboss",THREE_D_ENGRAVE:"threeDEngrave",TRIPLE:"triple",WAVE:"wave"},Tx=class extends kt{constructor(e){super("w:pBdr"),e.top&&this.root.push(ue("w:top",e.top)),e.left&&this.root.push(ue("w:left",e.left)),e.bottom&&this.root.push(ue("w:bottom",e.bottom)),e.right&&this.root.push(ue("w:right",e.right)),e.between&&this.root.push(ue("w:between",e.between))}},Sx=class extends I{constructor(){super("w:pBdr");let e=ue("w:bottom",{color:"auto",space:1,style:Ur.SINGLE,size:6});this.root.push(e)}},Cx=({start:e,end:t,left:n,right:r,hanging:i,firstLine:s,firstLineChars:a})=>new O({name:"w:ind",attributes:{start:{key:"w:start",value:e===void 0?void 0:rt(e)},end:{key:"w:end",value:t===void 0?void 0:rt(t)},left:{key:"w:left",value:n===void 0?void 0:rt(n)},right:{key:"w:right",value:r===void 0?void 0:rt(r)},hanging:{key:"w:hanging",value:i===void 0?void 0:ve(i)},firstLine:{key:"w:firstLine",value:s===void 0?void 0:ve(s)},firstLineChars:{key:"w:firstLineChars",value:a===void 0?void 0:le(a)}}}),Ex=()=>new O({name:"w:br"}),Hs={BEGIN:"begin",END:"end",SEPARATE:"separate"},rc=(e,t,n)=>new O({name:"w:fldChar",attributes:{type:{key:"w:fldCharType",value:e},dirty:{key:"w:dirty",value:t},locked:{key:"w:fldLock",value:n}}}),Sr=(e,t)=>rc(Hs.BEGIN,e,t),pm=new WeakSet,Ax=class extends O{constructor(){super({name:"w:fldChar",attributes:{type:{key:"w:fldCharType",value:Hs.BEGIN},dirty:{key:"w:dirty",value:!0}}})}prepForXml(e){let t=super.prepForXml(e);return pm.add(t),t}},um=()=>new Ax,_x=e=>typeof e=="object"&&e!==null&&pm.has(e),nn=e=>rc(Hs.SEPARATE,e),rn=e=>rc(Hs.END,e),Ft={DEFAULT:"default",PRESERVE:"preserve"},qt=class extends H{constructor(...e){super(...e),C(this,"xmlKeys",{space:"xml:space"})}},Nx=class extends I{constructor(){super("w:instrText"),this.root.push(new qt({space:Ft.PRESERVE})),this.root.push("PAGE")}},Ix=class extends I{constructor(){super("w:instrText"),this.root.push(new qt({space:Ft.PRESERVE})),this.root.push("NUMPAGES")}},Px=class extends I{constructor(){super("w:instrText"),this.root.push(new qt({space:Ft.PRESERVE})),this.root.push("SECTIONPAGES")}},Ox=class extends I{constructor(){super("w:instrText"),this.root.push(new qt({space:Ft.PRESERVE})),this.root.push("SECTION")}},Us=({fill:e,color:t,type:n})=>nc("w:shd",[{keys:{color:"w:fill",theme:"w:themeFill",tint:"w:themeFillTint",shade:"w:themeFillShade"},color:e},{keys:Hr,color:t},{key:"w:val",value:n??Rx.CLEAR}]),Rx={CLEAR:"clear",DIAGONAL_CROSS:"diagCross",DIAGONAL_STRIPE:"diagStripe",HORIZONTAL_CROSS:"horzCross",HORIZONTAL_STRIPE:"horzStripe",NIL:"nil",PERCENT_5:"pct5",PERCENT_10:"pct10",PERCENT_12:"pct12",PERCENT_15:"pct15",PERCENT_20:"pct20",PERCENT_25:"pct25",PERCENT_30:"pct30",PERCENT_35:"pct35",PERCENT_37:"pct37",PERCENT_40:"pct40",PERCENT_45:"pct45",PERCENT_50:"pct50",PERCENT_55:"pct55",PERCENT_60:"pct60",PERCENT_62:"pct62",PERCENT_65:"pct65",PERCENT_70:"pct70",PERCENT_75:"pct75",PERCENT_80:"pct80",PERCENT_85:"pct85",PERCENT_87:"pct87",PERCENT_90:"pct90",PERCENT_95:"pct95",REVERSE_DIAGONAL_STRIPE:"reverseDiagStripe",SOLID:"solid",THIN_DIAGONAL_CROSS:"thinDiagCross",THIN_DIAGONAL_STRIPE:"thinDiagStripe",THIN_HORIZONTAL_CROSS:"thinHorzCross",THIN_REVERSE_DIAGONAL_STRIPE:"thinReverseDiagStripe",THIN_VERTICAL_STRIPE:"thinVertStripe",VERTICAL_STRIPE:"vertStripe"},qe=class extends H{constructor(...e){super(...e),C(this,"xmlKeys",{id:"w:id",author:"w:author",date:"w:date"})}},Lx=class extends I{constructor(e){super("w:del"),this.root.push(new qe({id:e.id,author:e.author,date:e.date}))}},Mx=class extends I{constructor(e){super("w:ins"),this.root.push(new qe({id:e.id,author:e.author,date:e.date}))}},Dx=({twoLinesInOne:e,brackets:t,horizontalInVertical:n,fitToLine:r,group:i})=>new O({name:"w:eastAsianLayout",attributes:{id:{key:"w:id",value:i===void 0?void 0:le(i)},combine:{key:"w:combine",value:e},combineBrackets:{key:"w:combineBrackets",value:t},vert:{key:"w:vert",value:n},vertCompress:{key:"w:vertCompress",value:r}}}),Bx={DOT:"dot"},$x=(e=Bx.DOT)=>new O({name:"w:em",attributes:{val:{key:"w:val",value:e}}}),Fx="57X6y3wQZNzYjJB2L_10pxbackgroundhimselfUTF-8DEMOGRAPHICSVqvt4KW9",qx=(e,t=21)=>(n=t)=>{let r="",i=n|0;for(;i-- >0;)r+=e[Math.random()*e.length|0];return r},Hx=(e=21)=>{let t="",n=e|0;for(;n-- >0;)t+=Fx[Math.random()*64|0];return t},Ux=e=>{let t=new Int32Array(Math.ceil((e.length+9)/64)*16);for(let n=0;n<e.length;n++)t[n>>2]|=e[n]<<24-(n&3)*8;return t[e.length>>2]|=128<<24-(e.length&3)*8,t[t.length-2]=Math.floor(e.length/536870912),t[t.length-1]=e.length*8,t},jx=e=>{let t=new Uint8Array(e.length*4);for(let n=0;n<t.length;n++)t[n]=e[n>>2]>>>24-(n&3)*8;return t},et=(e,t)=>e>>>t|e<<32-t,HI=Int32Array.of(1518500249,1859775393,2400959708,3395469782),Wx=Int32Array.of(1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298),Kx=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],Gx=new Int32Array(64),Ju=e=>{let t=Ux(e),n=Gx,[r,i,s,a,o,c,l,u]=Kx;for(let d=0;d<t.length;d+=16){n.set(t.subarray(d,d+16));for(let E=16;E<64;E++){let _=n[E-15],v=n[E-2];n[E]=n[E-16]+(et(_,7)^et(_,18)^_>>>3)+n[E-7]+(et(v,17)^et(v,19)^v>>>10)}let[p,m,f,h,g,y,x,b]=[r,i,s,a,o,c,l,u];for(let E=0;E<64;E++){let _=b+(et(g,6)^et(g,11)^et(g,25))+(g&y^~g&x)+Wx[E]+n[E]|0,v=(et(p,2)^et(p,13)^et(p,22))+(p&m^p&f^m&f)|0;b=x,x=y,y=g,g=h+_|0,h=f,f=m,m=p,p=_+v|0}[r,i,s,a,o,c,l,u]=[r+p|0,i+m|0,s+f|0,a+h|0,o+g|0,c+y|0,l+x|0,u+b|0]}return jx([r,i,s,a,o,c,l,u])},ze=e=>Math.floor(e*72*20),Rn=(e=0)=>{let t=e;return()=>++t},zx=()=>Rn(),Vx=()=>Rn(1),Xx=()=>Rn(),UI=Xx(),Yx=()=>Rn(),hm=Yx(),Jx=Rn(),Qx=()=>-Jx(),Ln=()=>Hx().toLowerCase(),wr=e=>qx("1234567890abcdef",e)(),mm=()=>`${wr(8)}-${wr(4)}-${wr(4)}-${wr(4)}-${wr(12)}`,Zx=e=>new Uint8Array(new TextEncoder().encode(e)),ek=({width:e,group:t})=>new O({name:"w:fitText",attributes:{val:{key:"w:val",value:Math.round($t(ve(e)))},id:{key:"w:id",value:t===void 0?Qx():le(t)}}}),tk=class extends I{constructor(e){super("w:spacing"),this.root.push(new _e({val:rt(e)}))}},nk=class extends I{constructor(e){super("w:color"),this.root.push(new tc([{keys:k(k({},Hr),{},{color:"w:val"}),color:e}]))}},rk=class extends I{constructor(e){super("w:highlight"),this.root.push(new _e({val:e}))}},ik=e=>new O({name:"w:lang",attributes:{value:{key:"w:val",value:e.value},eastAsia:{key:"w:eastAsia",value:e.eastAsia},bidirectional:{key:"w:bidi",value:e.bidirectional}}}),tl=(e,t)=>{if(typeof e=="string"){let r=e;return new O({name:"w:rFonts",attributes:{ascii:{key:"w:ascii",value:r},cs:{key:"w:cs",value:r},eastAsia:{key:"w:eastAsia",value:r},hAnsi:{key:"w:hAnsi",value:r},hint:{key:"w:hint",value:t}}})}if("theme"in e){let r=e.theme==="headings"?"major":"minor";return new O({name:"w:rFonts",attributes:{ascii:{key:"w:asciiTheme",value:`${r}HAnsi`},eastAsia:{key:"w:eastAsiaTheme",value:`${r}EastAsia`},hAnsi:{key:"w:hAnsiTheme",value:`${r}HAnsi`},cs:{key:"w:cstheme",value:`${r}Bidi`}}})}let n=e;return new O({name:"w:rFonts",attributes:{ascii:{key:"w:ascii",value:n.ascii},cs:{key:"w:cs",value:n.cs},eastAsia:{key:"w:eastAsia",value:n.eastAsia},hAnsi:{key:"w:hAnsi",value:n.hAnsi},hint:{key:"w:hint",value:n.hint}}})},fm=e=>new O({name:"w:vertAlign",attributes:{val:{key:"w:val",value:e}}}),sk=()=>fm("superscript"),ak=()=>fm("subscript"),gm={SINGLE:"single",WORDS:"words",DOUBLE:"double",THICK:"thick",DOTTED:"dotted",DOTTEDHEAVY:"dottedHeavy",DASH:"dash",DASHEDHEAVY:"dashedHeavy",DASHLONG:"dashLong",DASHLONGHEAVY:"dashLongHeavy",DOTDASH:"dotDash",DASHDOTHEAVY:"dashDotHeavy",DOTDOTDASH:"dotDotDash",DASHDOTDOTHEAVY:"dashDotDotHeavy",WAVE:"wave",WAVYHEAVY:"wavyHeavy",WAVYDOUBLE:"wavyDouble",NONE:"none"},ok=(e=gm.SINGLE,t)=>nc("w:u",[{key:"w:val",value:e},{keys:Hr,color:t}]),sn=class extends kt{constructor(e){if(super("w:rPr"),!e)return;if(e.style&&this.push(new it("w:rStyle",e.style)),e.font&&(typeof e.font=="string"?this.push(tl(e.font)):"name"in e.font?this.push(tl(e.font.name,e.font.hint)):this.push(tl(e.font))),e.bold!==void 0&&this.push(new P("w:b",e.bold)),e.boldComplexScript===void 0&&e.bold!==void 0||e.boldComplexScript){var t;this.push(new P("w:bCs",(t=e.boldComplexScript)!==null&&t!==void 0?t:e.bold))}if(e.italics!==void 0&&this.push(new P("w:i",e.italics)),e.italicsComplexScript===void 0&&e.italics!==void 0||e.italicsComplexScript){var n;this.push(new P("w:iCs",(n=e.italicsComplexScript)!==null&&n!==void 0?n:e.italics))}e.smallCaps!==void 0?this.push(new P("w:smallCaps",e.smallCaps)):e.allCaps!==void 0&&this.push(new P("w:caps",e.allCaps)),e.strike!==void 0&&this.push(new P("w:strike",e.strike)),e.doubleStrike!==void 0&&this.push(new P("w:dstrike",e.doubleStrike)),e.emboss!==void 0&&this.push(new P("w:emboss",e.emboss)),e.imprint!==void 0&&this.push(new P("w:imprint",e.imprint)),e.noProof!==void 0&&this.push(new P("w:noProof",e.noProof)),e.snapToGrid!==void 0&&this.push(new P("w:snapToGrid",e.snapToGrid)),e.vanish!==void 0&&this.push(new P("w:vanish",e.vanish)),e.color&&this.push(new nk(e.color)),e.characterSpacing&&this.push(new tk(e.characterSpacing)),e.scale!==void 0&&this.push(new Er("w:w",e.scale)),e.kern&&this.push(new el("w:kern",e.kern)),e.position&&this.push(new it("w:position",e.position)),e.size!==void 0&&this.push(new el("w:sz",e.size));let r=e.sizeComplexScript===void 0||e.sizeComplexScript===!0?e.size:e.sizeComplexScript;r&&this.push(new el("w:szCs",r)),e.highlight&&this.push(new rk(e.highlight)),e.underline&&this.push(ok(e.underline.type,e.underline.color)),e.effect&&this.push(new it("w:effect",e.effect)),e.border&&this.push(ue("w:bdr",e.border)),e.shading&&this.push(Us(e.shading)),e.fitText&&this.push(ek(e.fitText)),e.subScript&&this.push(ak()),e.superScript&&this.push(sk()),e.rightToLeft!==void 0&&this.push(new P("w:rtl",e.rightToLeft)),e.emphasisMark&&this.push($x(e.emphasisMark.type)),e.language&&this.push(ik(e.language)),e.eastAsianLayout&&this.push(Dx(e.eastAsianLayout)),e.specVanish!==void 0&&this.push(new P("w:specVanish",e.specVanish)),e.math!==void 0&&this.push(new P("w:oMath",e.math)),e.revision&&this.push(new ck(e.revision))}push(e){this.root.push(e)}},lk=class extends sn{constructor(e){super(e),e?.insertion&&this.push(new Mx(e.insertion)),e?.deletion&&this.push(new Lx(e.deletion))}},ck=class extends I{constructor(e){super("w:rPrChange"),this.root.push(new qe({id:e.id,author:e.author,date:e.date})),this.addChildElement(new sn(e))}},Or=class extends I{constructor(e){if(super("w:t"),typeof e=="string")this.root.push(new qt({space:Ft.PRESERVE})),this.root.push(e);else{var t;this.root.push(new qt({space:(t=e.space)!==null&&t!==void 0?t:Ft.DEFAULT})),this.root.push(e.text)}}},bs={CURRENT:"CURRENT",TOTAL_PAGES:"TOTAL_PAGES",TOTAL_PAGES_IN_SECTION:"TOTAL_PAGES_IN_SECTION",CURRENT_SECTION:"SECTION"},dk=e=>{switch(e){case bs.CURRENT:return[Sr(),new Nx,nn(),rn()];case bs.TOTAL_PAGES:return[Sr(),new Ix,nn(),rn()];case bs.TOTAL_PAGES_IN_SECTION:return[Sr(),new Px,nn(),rn()];case bs.CURRENT_SECTION:return[Sr(),new Ox,nn(),rn()];default:return}},Fe=class Al extends I{constructor(t){if(super("w:r"),C(this,"properties",void 0),C(this,"following",[]),this.properties=new sn(t),this.root.push(this.properties),t.break)for(let n=0;n<t.break;n++)this.root.push(Ex());if(t.children)for(let[n,r]of t.children.entries()){if(Fs(r)==="w:r"){let i=t.children.slice(n+1);this.following=[r,...i.length>0?[new Al(k(k({},t),{},{break:void 0,children:i}))]:[]];break}if(typeof r=="string"){let i=dk(r);if(i){let s=t.children.slice(n+1),a=l=>new Al(k(k({},t),{},{break:void 0,children:l})),o=this.root.length===1;o&&this.root.push(i[0]);let c=o?i.slice(1):i;this.following=[...c.map(l=>a([l])),...s.length>0?[a(s)]:[]];break}this.root.push(new Or(r));continue}this.root.push(r)}else t.text!==void 0&&this.root.push(new Or(t.text))}get writtenAs(){return this.following.length>0?[this,...this.following.flatMap(t=>{var n;return(n=t.writtenAs)!==null&&n!==void 0?n:t})]:void 0}},Oe=class extends Fe{constructor(e){super(typeof e=="string"?{text:e}:e)}},ic={EXTERNAL:"External"},pk=(e,t,n,r)=>new O({name:"Relationship",attributes:{id:{key:"Id",value:e},type:{key:"Type",value:t},target:{key:"Target",value:n},targetMode:{key:"TargetMode",value:r}}}),bm=(e,t)=>new O({name:"a:hlinkClick",attributes:k(k({},t?{xmlns:{key:"xmlns:a",value:"http://schemas.openxmlformats.org/drawingml/2006/main"}}:{}),{},{id:{key:"r:id",value:`rId${e}`}})}),uk=class{constructor(e){C(this,"link",void 0),C(this,"linkId",Ln()),C(this,"addedTo",new WeakSet),this.link=e}createClick(e){return bm(this.linkId,e)}addRelationship(e){let t=e.viewWrapper.Relationships;this.addedTo.has(t)||(this.addedTo.add(t),t.addRelationship(this.linkId,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink",this.link,ic.EXTERNAL))}},hk=32767,mk=780,fk=[[1e3,"M"],[900,"CM"],[500,"D"],[400,"CD"],[100,"C"],[90,"XC"],[50,"L"],[40,"XL"],[10,"X"],[9,"IX"],[5,"V"],[4,"IV"],[1,"I"]],gk=e=>e<=hk?fk.reduce(({rest:t,text:n},[r,i])=>({rest:t%r,text:n+i.repeat(Math.floor(t/r))}),{rest:e,text:""}).text:void 0,bk=e=>e===0?"":e<=mk?String.fromCharCode(65+(e-1)%26).repeat(Math.ceil(e/26)):void 0,vk=e=>{var t;return`${e}${e%100>=11&&e%100<=13?"th":(t=["th","st","nd","rd"][e%10])!==null&&t!==void 0?t:"th"}`},sc=e=>{let t=e.charAt(0)!==e.charAt(0).toUpperCase(),n=r=>i=>{var s;return t?(s=r(i))===null||s===void 0?void 0:s.toLowerCase():r(i)};switch(e.toLowerCase()){case"arabic":return String;case"roman":return n(gk);case"alphabetic":return n(bk);case"ordinal":return r=>r>0?vk(r):void 0;case"arabicdash":return r=>`- ${r} -`;default:return}},vm=new Set(["mergeformat","charformat","mergeformatinet"]),wm=new Set(["upper","lower","firstcap","caps"]),wk=e=>/^[#0,]*[#0][#0,]*$/.test(e),yk=(e,t)=>{let n=[...t].filter(s=>s==="0").length,r=n+[...t].filter(s=>s==="#").length,i=String(e).padStart(n,"0");if(!(i.length<r||n===0&&e===0))return t.includes(",")?i.replace(/\B(?=(\d{3})+$)/g,","):i},xk=(e,t)=>{switch(t){case"upper":return e.toUpperCase();case"lower":return e.toLowerCase();case"firstcap":return e.charAt(0).toUpperCase()+e.slice(1);default:return e}},kk=e=>{var t;let n=new RegExp("^\\s*(PAGEREF|NUMPAGES|SECTIONPAGES)\\b(.*)$","is").exec(e),r=n?.[1].toUpperCase()==="PAGEREF"?new RegExp('^\\s*("?)([^\\s"\\\\]+)\\1(.*)$',"s").exec(n[2]):void 0;if(!n||n[1].toUpperCase()==="PAGEREF"&&!r)return;let i=(t=(r?r[3]:n[2]).match(/"[^"]*"|\S+/g))!==null&&t!==void 0?t:[],s,a,o=[],c=!1,l=!0;for(let m=0;m<i.length;m++){let f=i[m],h=()=>{var g;return(f.length>2?f.slice(2):(g=i[++m])!==null&&g!==void 0?g:"").replace(/^"(.*)"$/,"$1")};if(/^\\p$/i.test(f))c=!0;else if(f.startsWith("\\#")){var u;let g=h();l&&(l=a===void 0&&wk(g)),(u=a)!==null&&u!==void 0||(a=g)}else if(f.startsWith("\\*")){let g=h(),y=g.toLowerCase();if(wm.has(y))o.push(y);else if(g!==""&&!vm.has(y)){var d;l&&(l=s===void 0&&sc(g)!==void 0),(d=s)!==null&&d!==void 0||(s=g)}}}let p=k(k(k(k({},s===void 0?{}:{numberFormat:s}),a===void 0?{}:{picture:a}),o.length===0?{}:{capitals:o[0]}),{},{written:l&&o.length<=1&&o[0]!=="caps"&&(s===void 0||a===void 0)});return k(r?{type:"pageReference",bookmark:r[2],relative:c}:{type:"pageCount",scope:n[1].toUpperCase()==="NUMPAGES"?"document":"section"},p)},Tk=e=>new RegExp("^\\s*TOC\\b.*\\\\s\\b","is").test(e),ym=(e,{enclosing:t,within:n,inTextBox:r},{estimate:i,sectionPageCount:s,blank:a,relativeTo:o})=>{let c=kk(e);if(c===void 0)return;let{bookmarks:l,pageCount:u,bookmarkPageNumbers:d}=i,{numberFormat:p,picture:m,capitals:f,written:h}=c,g=p!==void 0||m!==void 0,y=E=>E===void 0?void 0:m===void 0?sc(p??"arabic")(E):yk(E,m),x=c.type==="pageReference"&&c.relative&&n==="counted"&&!r?o?.(c.bookmark):void 0,b;return h?c.type==="pageCount"?b=y(c.scope==="document"?u:s):t.some(Tk)?b=void 0:g?b=y(d?.get(c.bookmark)):b=c.relative?x:l.get(c.bookmark):b=void 0,b===void 0?a?"":void 0:xk(b,f)},Sk=(e,t)=>e==="mc:Fallback"||t==="fallback"?"fallback":e==="w:del"||e==="w:moveFrom"?"deleted":t,Rr=(e,t,n,r,i="counted",s=!1)=>{for(let l=0;l<t.length;l++){let u=t[l],d=e.nameOf(u);if(d===void 0)continue;let p=n[n.length-1];if(d==="w:fldChar"){let m=e.attributeOf(u,"w:fldCharType");m==="begin"?n.push({begin:u,instruction:"",inResult:!1}):m==="separate"&&p?(e.writeClean(p.begin,p.instruction),p.inResult=!0,p.result=r.resultOf(p.instruction,{within:i,enclosing:n.slice(0,-1).map(f=>f.instruction),inTextBox:s}),p.result!==void 0&&(t.splice(l+1,0,e.textElement(p.result)),l++)):m==="end"&&n.pop()}else if(d==="w:instrText"&&p&&!p.inResult)p.instruction+=e.textOf(u);else if((d==="w:t"||d==="w:tab"||d==="w:br"||d==="w:cr")&&p?.result!==void 0)t.splice(l,1),l--;else if(d==="w:fldSimple"){let m=r.resultOf(String(e.attributeOf(u,"w:instr")),{within:i,enclosing:n.map(f=>f.instruction),inTextBox:s});if(m===void 0){var a;Rr(e,(a=e.contentOf(u))!==null&&a!==void 0?a:[],[],r,i,s)}else e.setSimpleFieldResult(u,m)}else{var o;if(d==="w:p"){var c;(c=r.beforeParagraph)===null||c===void 0||c.call(r,u)}Rr(e,(o=e.contentOf(u))!==null&&o!==void 0?o:[],n,r,Sk(d,i),s||d==="w:txbxContent"),d==="w:p"&&r.afterParagraph(u)}}},xm=(e,t)=>t.flatMap(n=>{var r;let i=e.nameOf(n);return i===void 0?[]:i==="w:sectPr"?[n]:xm(e,(r=e.contentOf(n))!==null&&r!==void 0?r:[])}),Ck=(e,t)=>{var n;return((n=e.contentOf(t))!==null&&n!==void 0?n:[]).some(r=>{var i;return e.nameOf(r)==="w:pPr"&&((i=e.contentOf(r))!==null&&i!==void 0?i:[]).some(s=>e.nameOf(s)==="w:sectPr")})},Ek=(e,t,n)=>{let r=xm(e,[t]).reduce((i,s)=>{var a,o;let c=((a=e.contentOf(s))!==null&&a!==void 0?a:[]).flatMap(l=>{let u=e.nameOf(l);return u==="w:headerReference"||u==="w:footerReference"?[[`${u} ${String(e.attributeOf(l,"w:type"))}`,String(e.attributeOf(l,"r:id"))]]:[]});return[...i,new Map([...(o=i[i.length-1])!==null&&o!==void 0?o:[],...c])]},[]).reduce((i,s,a)=>{for(let c of s.values()){var o;i.set(c,[...(o=i.get(c))!==null&&o!==void 0?o:[],n[a]])}return i},new Map);return new Map([...r].flatMap(([i,[s,...a]])=>s!==void 0&&a.every(o=>o===s)?[[i,s]]:[]))},km=(e,t,n,{blank:r})=>{let{sectionPageCounts:i=[],relativePositions:s}=n,a=0,o=new Map,c=l=>{var u,d;let p=(u=o.get(l))!==null&&u!==void 0?u:0;return o.set(l,p+1),s==null||(d=s.get(l))===null||d===void 0?void 0:d[p]};return Rr(e,[t],[],{resultOf:(l,u)=>ym(l,u,{estimate:n,sectionPageCount:i[a],blank:r,relativeTo:c}),afterParagraph:l=>{a+=Ck(e,l)?1:0}}),Ek(e,t,i)},Tm=(e,t,n,{blank:r,sectionPageCount:i,notes:s=!1})=>{let a=o=>{let c=n.bookmarks.get(o);return c===void 0?void 0:`on page ${c}`};Rr(e,[t],[],{resultOf:(o,c)=>ym(o,c,k({estimate:n,sectionPageCount:i,blank:r},s?{relativeTo:a}:{})),afterParagraph:()=>{}})},Ak=(e,t,{beforeParagraph:n,resultOf:r})=>Rr(e,[t],[],{resultOf:(i,{within:s})=>r(i,s),beforeParagraph:n,afterParagraph:()=>{}}),Sm=class extends I{constructor(e={}){super("w:instrText"),C(this,"properties",void 0),this.properties=e,this.root.push(new qt({space:Ft.PRESERVE}));let t="TOC";if(this.properties.captionLabel&&(t=`${t} \\a "${this.properties.captionLabel}"`),this.properties.entriesFromBookmark&&(t=`${t} \\b "${this.properties.entriesFromBookmark}"`),this.properties.captionLabelIncludingNumbers&&(t=`${t} \\c "${this.properties.captionLabelIncludingNumbers}"`),this.properties.sequenceAndPageNumbersSeparator&&(t=`${t} \\d "${this.properties.sequenceAndPageNumbersSeparator}"`),this.properties.tcFieldIdentifier&&(t=`${t} \\f "${this.properties.tcFieldIdentifier}"`),this.properties.hyperlink&&(t=`${t} \\h`),this.properties.tcFieldLevelRange&&(t=`${t} \\l "${this.properties.tcFieldLevelRange}"`),this.properties.pageNumbersEntryLevelsRange&&(t=`${t} \\n "${this.properties.pageNumbersEntryLevelsRange}"`),this.properties.headingStyleRange&&(t=`${t} \\o "${this.properties.headingStyleRange}"`),this.properties.entryAndPageNumberSeparator&&(t=`${t} \\p "${this.properties.entryAndPageNumberSeparator}"`),this.properties.seqFieldIdentifierForPrefix&&(t=`${t} \\s "${this.properties.seqFieldIdentifierForPrefix}"`),this.properties.stylesWithLevels&&this.properties.stylesWithLevels.length){let n=this.properties.stylesWithLevels.map(r=>`${r.styleName},${r.level}`).join(",");t=`${t} \\t "${n}"`}this.properties.useAppliedParagraphOutlineLevel&&(t=`${t} \\u`),this.properties.preserveTabInEntries&&(t=`${t} \\w`),this.properties.preserveNewLineInEntries&&(t=`${t} \\x`),this.properties.hideTabAndPageNumbersInWebView&&(t=`${t} \\z`),this.root.push(t)}},Cm=class extends I{constructor(){super("w:sdtContent")}},Em=e=>e===void 0?um():Sr(e),ac=new WeakMap,_k=(e,t)=>{ac.set(e,t)},Nk=class{constructor(){C(this,"ids",[])}get(e){var t,n;return(n=(t=this.ids)[e])!==null&&n!==void 0||(t[e]=hm()),this.ids[e]}},at=e=>typeof e=="object"&&e!==null?Object.keys(e)[0]:void 0,ot=e=>{let t=at(e),n=t===void 0?void 0:e[t];return Array.isArray(n)?n:n===void 0?[]:[n]},Xe=(e,t)=>ot(e).find(n=>at(n)===t),Be=(e,t)=>{var n;return(n=Xe(e,"_attr"))===null||n===void 0||(n=n._attr)===null||n===void 0?void 0:n[t]},oc=(e,t)=>{let n=Be(e,t);return n===void 0?void 0:Number(n)},Ik=new Set(["w:tbl","w:tr","w:tc","w:sdt","w:sdtContent","w:customXml"]),Am=e=>e.flatMap(t=>{let n=at(t);return n==="w:p"||ac.has(t)?[t]:n!==void 0&&Ik.has(n)?Am(ot(t)):[]}),Pk=new Set(["w:r","w:hyperlink","w:ins","w:moveTo","w:smartTag","w:customXml","w:sdt","w:sdtContent","w:fldSimple","w:dir","w:bdo"]),Ok=e=>{switch(at(e)){case"w:t":return ot(e).filter(t=>typeof t=="string").join("");case"w:tab":return" ";case"w:br":return[void 0,"textWrapping"].includes(Be(e,"w:type"))?`
|
|
4279
5291
|
`:"";case"w:cr":return`
|
|
4280
|
-
`;case"w:noBreakHyphen":return"-";default:return""}},
|
|
4281
|
-
`):[n.replace(/\n/g," ")]).map((r,i)=>new Ie({break:i>0?1:void 0,children:r.split(" ").flatMap((s,a)=>[...a>0?[new Ls]:[],...s===""?[]:[s]])}))},o1=({text:e,separator:t})=>t==="tab"?[new Ie(e),new Ie({children:[new Ls]})]:[new Ie(`${e} `)],l1=(e,t)=>{let n=240*(e-1)+t+240;return n<=1920?Math.ceil(n/240)*240:Math.round(n)},c1=(e,t)=>{var n,r;return(n=(r=[...t].find(([,i])=>{var s;return((s=i.name)===null||s===void 0?void 0:s.toLowerCase())===`toc ${e}`}))===null||r===void 0?void 0:r[0])!==null&&n!==void 0?n:`TOC${e}`},d1=({properties:e,beginDirty:t,textWidth:n,tabLeader:r},i,s,a)=>{var o;let l=e.pageNumbersEntryLevelsRange?(o=uf(e.pageNumbersEntryLevelsRange))!==null&&o!==void 0?o:[1,9]:void 0,c=new of;return i.forEach((d,p)=>{var u;let f=l===void 0||!fl(d.level,l),m=[...d.listNumber?o1(d.listNumber):[],...a1(d.title,e),...f?[new Ie({children:[e.entryAndPageNumberSeparator||new Ls]}),new X1(d.bookmark,{hyperlink:e.hyperlink})]:[]];c.addChildElement(new J({style:c1(d.level,s),tabStops:[...((u=d.listNumber)===null||u===void 0?void 0:u.separator)==="tab"?[{type:"left",position:l1(d.level,d.listNumber.width)}]:[],{type:"right",position:n,leader:r}],children:[...p===0?[new Be({children:[lf(t),new af(e),Jt()]})]:[],...e.hyperlink?[new vf({anchor:d.bookmark,children:m})]:m]}))}),c.addChildElement(new J({children:[new Be({children:[Qt()]})]})),c.prepForXml(a)},p1=(e,t,n,r)=>{let i=rt(e),s=i.findIndex(a=>nt(a)==="w:pPr")+1;e["w:p"]=[...i.slice(0,s),new xf(t,n).prepForXml(r),...i.slice(s),new kf(n).prepForXml(r)]},u1=(e,t,n,r)=>{let i=cf(rt(e)),s=i.flatMap(d=>{let p=Gl.get(d);return p?[[d,p]]:[]});if(s.length===0)return;let a=pf(t),o=s.some(([,{properties:d}])=>!!d.entriesFromBookmark),l=r1(i.filter(d=>nt(d)==="w:p"),o).map(d=>({paragraph:d,levels:s.map(([,{properties:p}])=>s1(p,d,a))})).filter(({levels:d})=>d.some(p=>p!==void 0)).map((d,p)=>k(k({},d),{},{id:n.get(p)}));for(let{paragraph:d,id:p}of l)p1(d.element,`_Toc${p}`,p,t);let c=l.length>0?r?.(e):void 0;s.forEach(([d,p],u)=>{let f=l.flatMap(({paragraph:m,levels:h,id:g})=>{let v=h[u],w=c?.get(`_Toc${g}`);return v===void 0?[]:[k({title:m.text,level:v,bookmark:`_Toc${g}`},w?{listNumber:w}:{})]});f.length!==0&&(d["w:sdt"]=rt(d).map(m=>nt(m)==="w:sdtContent"?d1(p,f,a,t):m))})},h1=new RegExp("^\\p{L}[\\p{L}\\p{N}_]*$","u"),f1=e=>{var t,n;let r,i=!1,s,a=!1,o=!1;for(let p=0;p<e.length;p++){var l,c;let u=e[p],f=(l=e[p+1])!==null&&l!==void 0?l:"",m;if(p===0&&!u.startsWith("\\"))m={type:"bookmark"};else if(u==="\\c"||u==="\\n")m={type:u==="\\c"?"repeat":"next"};else if((u==="\\r"||u==="\\s")&&/^\d+$/.test(f))p++,m=u==="\\r"?{type:"reset",to:Number(f)}:{type:"heading",level:Number(f)};else if(u==="\\h")i=!0;else if(u==="\\#"&&p+1<e.length)p++,o=!0;else if(u==="\\*"&&p+1<e.length){let h=e[++p];if(ef.has(h.toLowerCase()))a=!0;else if(!Zh.has(h.toLowerCase())){if(s!==void 0)return;s=h}}else return;if(m&&r)return;r=(c=m)!==null&&c!==void 0?c:r}if(r?.type==="bookmark"&&e.length>1)return;let d=!o&&!(a&&s!==void 0&&s.toLowerCase()!=="arabic");return{step:(t=r)!==null&&t!==void 0?t:{type:"next"},hidden:i&&s===void 0,format:d?(n=s)!==null&&n!==void 0?n:"ARABIC":""}},Xl=e=>{var t;let n=new RegExp("^\\s*SEQ\\b(.*)$","is").exec(e);if(!n)return;let[r,...i]=(t=n[1].match(/"[^"]*"|\S+/g))!==null&&t!==void 0?t:[];if(r===void 0)return{};let s=r.replace(/^"(.*)"$/,"$1");return h1.test(s)?{identifier:s,sequence:f1(i)}:{identifier:s}},m1=e=>Xl(e)!==void 0,ml=e=>typeof e!="object"||e===null?[]:Array.isArray(e)?e.flatMap(ml):Object.entries(e).flatMap(([t,n])=>[...(t==="w:instrText"&&Array.isArray(n)?n:t==="_attr"?[n["w:instr"]]:[]).flatMap(r=>{let i=typeof r=="string"?Xl(r):void 0;return i?.identifier===void 0?[]:[i.identifier.toLowerCase()]}),...ml(n)]),g1=e=>{var t;let n=(t=e.file)===null||t===void 0?void 0:t.Comments;if(!n)return new Set;let r={View:n,Relationships:n.Relationships};return new Set(ml(n.prepForXml(k(k({},e),{},{viewWrapper:r,stack:[]}))))},b1=e=>{let t=i1(e),n=new Map,r=new Map,i=[],s=-1,a=-1,o,l=(c,d)=>{var p;let u=Math.max(-1,...i.slice(1,d+1).filter(h=>h!==void 0)),f=((p=r.get(c))!==null&&p!==void 0?p:[]).filter(h=>h.paragraph>=u),m=f.every(({step:h})=>h?.type==="next"||h?.type==="heading"&&h.level===d);return s>u||!m?void 0:f.length+1};return{startParagraph:c=>{a++;let d=t(c);d==="unclear"?s=a:d!==void 0&&(i[d]=a)},numberOf:(c,d)=>{var p,u,f;let{identifier:m,sequence:h}=Xl(c);if(m===void 0||d==="fallback")return;(p=o)!==null&&p!==void 0||(o=g1(e));let g=m.toLowerCase();if(h?.step.type==="bookmark"&&d==="counted"&&!o.has(g))return;let v=n.has(g)?n.get(g):0,w=o.has(g)||d==="deleted"?void 0:h?.step,b=w?.type==="reset"?w.to:w?.type==="repeat"?v:w?.type==="heading"?l(g,w.level):w?.type==="next"&&v!==void 0?v+1:void 0;return n.set(g,b),r.set(g,[...(u=r.get(g))!==null&&u!==void 0?u:[],k({paragraph:a},b===void 0?{}:{step:w})]),b===void 0||h===void 0?void 0:h.hidden?"":(f=Kl(h.format))===null||f===void 0?void 0:f(b)}}},qo=e=>{let t=typeof e=="object"&&e!==null&&!Array.isArray(e)?Object.keys(e)[0]:void 0;return t==="_attr"?void 0:t},Lu=e=>({"w:t":[{_attr:{"xml:space":"preserve"}},e]}),Os={nameOf:qo,contentOf:e=>{let t=e[qo(e)];return Array.isArray(t)?t:void 0},attributeOf:(e,t)=>{var n;let r=e[qo(e)],i=Array.isArray(r)?r.find(s=>typeof s=="object"&&s!==null&&"_attr"in s):r;return i==null||(n=i._attr)===null||n===void 0?void 0:n[t]},textOf:e=>Os.contentOf(e).filter(t=>typeof t=="string").join(""),textElement:Lu,writeClean:e=>{if(Yy(e)){let t=e["w:fldChar"]._attr;e["w:fldChar"]={_attr:Object.fromEntries(Object.entries(t).filter(([n])=>n!=="w:dirty"))}}},setSimpleFieldResult:(e,t)=>{let n=e["w:fldSimple"];e["w:fldSimple"]=[...(Array.isArray(n)?n:[n]).filter(r=>typeof r=="object"&&r!==null&&"_attr"in r),{"w:r":[Lu(t)]}]}},mf=new WeakMap,v1=(e,t)=>{let{startParagraph:n,numberOf:r}=b1(t);Xx(Os,e,{beforeParagraph:i=>n(i),resultOf:(i,s)=>m1(i)?r(i,s):void 0})},w1=(e,t,n)=>{let r=n(e,t),i=rf(Os,e,r,{blank:!1});t.file&&mf.set(t.file,{estimate:r,partPageCounts:i})},Rr=(e,t,n)=>{let r=t.file&&mf.get(t.file);if(!e||!r)return;let i=n===void 0?void 0:r.partPageCounts.get(`rId${n}`),s="w:footnotes"in e||"w:endnotes"in e;sf(Os,e,r.estimate,{blank:!1,sectionPageCount:i,notes:s})},y1=class extends H{constructor(...e){super(...e),S(this,"xmlKeys",{xmlns:"xmlns"})}},ge=class gf extends I{constructor(){super("Relationships"),this.root.push(new y1({xmlns:"http://schemas.openxmlformats.org/package/2006/relationships"}))}addRelationship(t,n,r,i){this.root.push(Lx(`rId${t}`,n,r,i))}static copy(t){let n=new gf;return n.root.push(...t.root.slice(1)),n}get RelationshipCount(){return this.root.length-1}},x1=class extends H{constructor(...e){super(...e),S(this,"xmlKeys",{id:"w:id",initials:"w:initials",author:"w:author",date:"w:date"})}},k1=class extends H{constructor(...e){super(...e),S(this,"xmlKeys",{"xmlns:wpc":"xmlns:wpc","xmlns:cx":"xmlns:cx","xmlns:cx1":"xmlns:cx1","xmlns:cx2":"xmlns:cx2","xmlns:cx3":"xmlns:cx3","xmlns:cx4":"xmlns:cx4","xmlns:cx5":"xmlns:cx5","xmlns:cx6":"xmlns:cx6","xmlns:cx7":"xmlns:cx7","xmlns:cx8":"xmlns:cx8","xmlns:mc":"xmlns:mc","xmlns:aink":"xmlns:aink","xmlns:am3d":"xmlns:am3d","xmlns:o":"xmlns:o","xmlns:r":"xmlns:r","xmlns:m":"xmlns:m","xmlns:v":"xmlns:v","xmlns:wp14":"xmlns:wp14","xmlns:wp":"xmlns:wp","xmlns:w10":"xmlns:w10","xmlns:w":"xmlns:w","xmlns:w14":"xmlns:w14","xmlns:w15":"xmlns:w15","xmlns:w16cex":"xmlns:w16cex","xmlns:w16cid":"xmlns:w16cid","xmlns:w16":"xmlns:w16","xmlns:w16sdtdh":"xmlns:w16sdtdh","xmlns:w16se":"xmlns:w16se","xmlns:wpg":"xmlns:wpg","xmlns:wpi":"xmlns:wpi","xmlns:wne":"xmlns:wne","xmlns:wps":"xmlns:wps","mc:Ignorable":"mc:Ignorable"})}},Ru=class extends I{constructor({id:e,initials:t,author:n,date:r=new Date,children:i},s){super("w:comment"),S(this,"paraId",void 0),this.paraId=s,this.root.push(new x1({id:e,initials:t,author:n,date:r.toISOString()}));for(let a of i)this.root.push(a)}prepForXml(e){let t=super.prepForXml(e);if(!t||!this.paraId)return t;let n=t["w:comment"];if(!Array.isArray(n))return t;for(let r=n.length-1;r>=0;r--){let i=n[r];if(i&&typeof i=="object"&&"w:p"in i){let s=i["w:p"];Array.isArray(s)&&s.unshift({_attr:{"w14:paraId":this.paraId,"w14:textId":this.paraId}});break}}return t}},T1=e=>(e+1).toString(16).toUpperCase().padStart(8,"0"),S1=class extends I{constructor({children:e}){super("w:comments"),S(this,"relationships",void 0),S(this,"threadData",void 0),S(this,"commentIdsData",void 0),S(this,"isEmpty",void 0),this.isEmpty=e.length===0,this.root.push(new k1({"xmlns:wpc":"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas","xmlns:cx":"http://schemas.microsoft.com/office/drawing/2014/chartex","xmlns:cx1":"http://schemas.microsoft.com/office/drawing/2015/9/8/chartex","xmlns:cx2":"http://schemas.microsoft.com/office/drawing/2015/10/21/chartex","xmlns:cx3":"http://schemas.microsoft.com/office/drawing/2016/5/9/chartex","xmlns:cx4":"http://schemas.microsoft.com/office/drawing/2016/5/10/chartex","xmlns:cx5":"http://schemas.microsoft.com/office/drawing/2016/5/11/chartex","xmlns:cx6":"http://schemas.microsoft.com/office/drawing/2016/5/12/chartex","xmlns:cx7":"http://schemas.microsoft.com/office/drawing/2016/5/13/chartex","xmlns:cx8":"http://schemas.microsoft.com/office/drawing/2016/5/14/chartex","xmlns:mc":"http://schemas.openxmlformats.org/markup-compatibility/2006","xmlns:aink":"http://schemas.microsoft.com/office/drawing/2016/ink","xmlns:am3d":"http://schemas.microsoft.com/office/drawing/2017/model3d","xmlns:o":"urn:schemas-microsoft-com:office:office","xmlns:r":"http://schemas.openxmlformats.org/officeDocument/2006/relationships","xmlns:m":"http://schemas.openxmlformats.org/officeDocument/2006/math","xmlns:v":"urn:schemas-microsoft-com:vml","xmlns:wp14":"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing","xmlns:wp":"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing","xmlns:w10":"urn:schemas-microsoft-com:office:word","xmlns:w":"http://schemas.openxmlformats.org/wordprocessingml/2006/main","xmlns:w14":"http://schemas.microsoft.com/office/word/2010/wordml","xmlns:w15":"http://schemas.microsoft.com/office/word/2012/wordml","xmlns:w16cex":"http://schemas.microsoft.com/office/word/2018/wordml/cex","xmlns:w16cid":"http://schemas.microsoft.com/office/word/2016/wordml/cid","xmlns:w16":"http://schemas.microsoft.com/office/word/2018/wordml","xmlns:w16sdtdh":"http://schemas.microsoft.com/office/word/2020/wordml/sdtdatahash","xmlns:w16se":"http://schemas.microsoft.com/office/word/2015/wordml/symex","xmlns:wpg":"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup","xmlns:wpi":"http://schemas.microsoft.com/office/word/2010/wordprocessingInk","xmlns:wne":"http://schemas.microsoft.com/office/word/2006/wordml","xmlns:wps":"http://schemas.microsoft.com/office/word/2010/wordprocessingShape","mc:Ignorable":"w14 w15 wp14"}));let t=e.some(r=>r.parentId!==void 0),n=e.some(r=>r.durableId!==void 0);if(t||n){let r=new Map(e.map(i=>[i.id,T1(i.id)]));for(let i of e)this.root.push(new Ru(i,r.get(i.id)));t&&(this.threadData=e.map(i=>({paraId:r.get(i.id),parentParaId:i.parentId!==void 0?r.get(i.parentId):void 0,done:i.resolved}))),n&&(this.commentIdsData=e.map(i=>{var s;return{paraId:r.get(i.id),durableId:(s=i.durableId)!==null&&s!==void 0?s:r.get(i.id)}}))}else for(let r of e)this.root.push(new Ru(r));this.relationships=new ge}get Relationships(){return this.relationships}get ThreadData(){return this.threadData}get CommentIdsData(){return this.commentIdsData}get IsEmpty(){return this.isEmpty}prepForXml(e){let t=super.prepForXml(e);return Rr(t,e),t}},E1=class extends H{constructor(...e){super(...e),S(this,"xmlKeys",{"xmlns:wpc":"xmlns:wpc","xmlns:mc":"xmlns:mc","xmlns:w15":"xmlns:w15","mc:Ignorable":"mc:Ignorable"})}},C1=class extends H{constructor(...e){super(...e),S(this,"xmlKeys",{paraId:"w15:paraId",paraIdParent:"w15:paraIdParent",done:"w15:done"})}},_1=class extends I{constructor(e){super("w15:commentEx"),this.root.push(new C1({paraId:e.paraId,paraIdParent:e.parentParaId,done:e.done!==void 0?e.done?"1":"0":void 0}))}},A1=class extends I{constructor(e){super("w15:commentsEx"),this.root.push(new E1({"xmlns:wpc":"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas","xmlns:mc":"http://schemas.openxmlformats.org/markup-compatibility/2006","xmlns:w15":"http://schemas.microsoft.com/office/word/2012/wordml","mc:Ignorable":"w15"}));for(let t of e)this.root.push(new _1(t))}},N1=class extends H{constructor(...e){super(...e),S(this,"xmlKeys",{paraId:"w16cid:paraId",durableId:"w16cid:durableId"})}},I1=class extends I{constructor(e){super("w16cid:commentId"),this.root.push(new N1({paraId:e.paraId,durableId:e.durableId}))}},P1=class extends H{constructor(...e){super(...e),S(this,"xmlKeys",{"xmlns:w16cid":"xmlns:w16cid","xmlns:mc":"xmlns:mc","mc:Ignorable":"mc:Ignorable"})}},O1=class extends I{constructor(e){super("w16cid:commentsIds"),this.root.push(new P1({"xmlns:w16cid":"http://schemas.microsoft.com/office/word/2016/wordml/cid","xmlns:mc":"http://schemas.openxmlformats.org/markup-compatibility/2006","mc:Ignorable":"w16cid"}));for(let t of e)this.root.push(new I1(t))}},L1=class extends Uh{constructor(){super("w:endnoteRef")}},Ls=class extends Uh{constructor(){super("w:tab")}},R1={COLUMN:"column",PAGE:"page"},M1=class extends I{constructor(e){super("w:br"),this.root.push(new Ce({type:e}))}},bf=class extends Be{constructor(){super({}),this.root.push(new M1(R1.PAGE))}},D1=class extends I{constructor(){super("w:pageBreakBefore")}},Tn={AT_LEAST:"atLeast",EXACTLY:"exactly",EXACT:"exact",AUTO:"auto"},B1=({after:e,before:t,line:n,lineRule:r,beforeAutoSpacing:i,afterAutoSpacing:s})=>new O({name:"w:spacing",attributes:{after:{key:"w:after",value:e},before:{key:"w:before",value:t},line:{key:"w:line",value:n},lineRule:{key:"w:lineRule",value:r},beforeAutoSpacing:{key:"w:beforeAutospacing",value:i},afterAutoSpacing:{key:"w:afterAutospacing",value:s}}}),Rs={HEADING_1:"Heading1",HEADING_2:"Heading2",HEADING_3:"Heading3",HEADING_4:"Heading4",HEADING_5:"Heading5",HEADING_6:"Heading6",TITLE:"Title"},gr=e=>new O({name:"w:pStyle",attributes:{val:{key:"w:val",value:e}}}),Mu={LEFT:"left",RIGHT:"right",CENTER:"center",BAR:"bar",CLEAR:"clear",DECIMAL:"decimal",END:"end",NUM:"num",START:"start"},$1={DOT:"dot",HYPHEN:"hyphen",MIDDLE_DOT:"middleDot",NONE:"none",UNDERSCORE:"underscore"},F1=({type:e,position:t,leader:n})=>new O({name:"w:tab",attributes:{val:{key:"w:val",value:e},pos:{key:"w:pos",value:Ze(t)},leader:{key:"w:leader",value:n}}}),H1=e=>new O({name:"w:tabs",children:e.map(t=>F1(t))}),os=class extends I{constructor(e,t){super("w:numPr"),this.root.push(new U1(t)),this.root.push(new q1(e))}},U1=class extends I{constructor(e){if(super("w:ilvl"),e>9)throw new Error("Level cannot be greater than 9. Read more here: https://answers.microsoft.com/en-us/msoffice/forum/all/does-word-support-more-than-9-list-levels/d130fdcd-1781-446d-8c84-c6c79124e4d7");this.root.push(new Ce({val:e}))}},q1=class extends I{constructor(e){super("w:numId"),this.root.push(new Ce({val:typeof e=="string"?`{${e}}`:e}))}},Yl=class extends I{constructor(...e){super(...e),S(this,"fileChild",Symbol())}},W1=class extends H{constructor(...e){super(...e),S(this,"xmlKeys",{id:"r:id",history:"w:history",anchor:"w:anchor"})}},Jl=class extends I{constructor(e,t,n,r){super("w:hyperlink"),S(this,"linkId",void 0),S(this,"drawingLink",void 0),this.linkId=t,this.drawingLink=n&&r!==void 0?new Rx(r):void 0;let i=new W1({history:1,anchor:n||void 0,id:!n||r!==void 0?`rId${this.linkId}`:void 0});this.root.push(i),e.forEach(s=>{this.root.push(s)})}createDrawingClick(e,t){return this.drawingLink?(this.drawingLink.addRelationship(e),this.drawingLink.createClick(t)):Qh(this.linkId,t)}},vf=class extends Jl{constructor(e){super(e.children,Cn(),e.anchor)}},j1=class extends I{constructor(e){super("w:externalHyperlink"),S(this,"options",void 0),this.options=e}},K1=class extends H{constructor(...e){super(...e),S(this,"xmlKeys",{id:"w:id",name:"w:name"})}},G1=class extends H{constructor(...e){super(...e),S(this,"xmlKeys",{id:"w:id"})}},wf=class yf{constructor(t){S(this,"start",void 0),S(this,"children",void 0),S(this,"end",void 0);let n=Vh();this.start=new xf(t.id,n),this.children=t.children,this.end=new kf(n)}get writtenAs(){return[this.start,...this.children.flatMap(t=>t instanceof yf?t.writtenAs:[t]),this.end]}},xf=class extends I{constructor(e,t){super("w:bookmarkStart");let n=new K1({name:e,id:t});this.root.push(n)}},kf=class extends I{constructor(e){super("w:bookmarkEnd");let t=new G1({id:e});this.root.push(t)}},z1=e=>new O({name:"w:outlineLvl",attributes:{val:{key:"w:val",value:e}}}),V1=class extends I{constructor(e,t={}){super("w:instrText"),this.root.push(new Rt({space:Lt.PRESERVE}));let n=`PAGEREF ${e}`;t.hyperlink&&(n=`${n} \\h`),t.useRelativePosition&&(n=`${n} \\p`),this.root.push(n)}},X1=class extends Be{constructor(e,t={}){super({children:[zh(),new V1(e,t),Jt(),Qt()]})}},Y1=255,Tf=e=>{let t=e.indexOf("#"),n=e.length-t-1;return t>0&&n>0&&n<=Y1?{target:e.slice(0,t),anchor:e.slice(t+1)}:{target:e}},xs=(e,t,n)=>n===void 0?`${e}-${t}`:`${e}-restart ${n}`,ls=({id:e,fontKey:t,subsetted:n},r)=>new O({name:r,attributes:k({id:{key:"r:id",value:e}},t?{fontKey:{key:"w:fontKey",value:`{${t.toUpperCase()}}`}}:{}),children:[...n?[new P("w:subsetted",n)]:[]]}),J1=({name:e,altName:t,panose1:n,charset:r,family:i,notTrueType:s,pitch:a,sig:o,embedRegular:l,embedBold:c,embedItalic:d,embedBoldItalic:p})=>new O({name:"w:font",attributes:{name:{key:"w:name",value:e}},children:[...t?[cr("w:altName",t)]:[],...n?[cr("w:panose1",n)]:[],...r?[cr("w:charset",r)]:[],...i?[cr("w:family",i)]:[],...s?[new P("w:notTrueType",s)]:[],...a?[cr("w:pitch",a)]:[],...o?[new O({name:"w:sig",attributes:{usb0:{key:"w:usb0",value:o.usb0},usb1:{key:"w:usb1",value:o.usb1},usb2:{key:"w:usb2",value:o.usb2},usb3:{key:"w:usb3",value:o.usb3},csb0:{key:"w:csb0",value:o.csb0},csb1:{key:"w:csb1",value:o.csb1}}})]:[],...l?[ls(l,"w:embedRegular")]:[],...c?[ls(c,"w:embedBold")]:[],...d?[ls(d,"w:embedItalic")]:[],...p?[ls(p,"w:embedBoldItalic")]:[]]}),Q1=({name:e,characterSet:t,embedRegular:n,embedBold:r,embedItalic:i,embedBoldItalic:s})=>J1({name:e,sig:{usb0:"E0002AFF",usb1:"C000247B",usb2:"00000009",usb3:"00000000",csb0:"000001FF",csb1:"00000000"},charset:t,family:"auto",pitch:"variable",embedRegular:n,embedBold:r,embedItalic:i,embedBoldItalic:s}),Z1=e=>new O({name:"w:fonts",attributes:{mc:{key:"xmlns:mc",value:"http://schemas.openxmlformats.org/markup-compatibility/2006"},r:{key:"xmlns:r",value:"http://schemas.openxmlformats.org/officeDocument/2006/relationships"},w:{key:"xmlns:w",value:"http://schemas.openxmlformats.org/wordprocessingml/2006/main"},w14:{key:"xmlns:w14",value:"http://schemas.microsoft.com/office/word/2010/wordml"},w15:{key:"xmlns:w15",value:"http://schemas.microsoft.com/office/word/2012/wordml"},w16cex:{key:"xmlns:w16cex",value:"http://schemas.microsoft.com/office/word/2018/wordml/cex"},w16cid:{key:"xmlns:w16cid",value:"http://schemas.microsoft.com/office/word/2016/wordml/cid"},w16:{key:"xmlns:w16",value:"http://schemas.microsoft.com/office/word/2018/wordml"},w16sdtdh:{key:"xmlns:w16sdtdh",value:"http://schemas.microsoft.com/office/word/2020/wordml/sdtdatahash"},w16se:{key:"xmlns:w16se",value:"http://schemas.microsoft.com/office/word/2015/wordml/symex"},Ignorable:{key:"mc:Ignorable",value:"w14 w15 w16se w16cid w16 w16cex w16sdtdh"}},children:e.map(Q1)}),ek=[{option:"data",element:"embedRegular",bold:!1,italic:!1},{option:"bold",element:"embedBold",bold:!0,italic:!1},{option:"italic",element:"embedItalic",bold:!1,italic:!0},{option:"boldItalic",element:"embedBoldItalic",bold:!0,italic:!0}],Sf=class{constructor(e){S(this,"options",void 0),S(this,"fontTable",void 0),S(this,"relationships",void 0),S(this,"fontOptionsWithKey",[]),S(this,"files",[]),this.options=e;let t=e.map(n=>ek.flatMap(({option:r,element:i,bold:s,italic:a})=>{let o=n[r];return o?[{element:i,file:{name:n.name,data:o,bold:s,italic:a,fontKey:Xh()}}]:[]}));this.files=t.flatMap(n=>n.map(({file:r})=>r)),this.fontOptionsWithKey=e.map((n,r)=>k(k({},n),{},{fontKey:t[r][0].file.fontKey})),this.fontTable=Z1(e.map((n,r)=>k({name:n.name,characterSet:n.characterSet},Object.fromEntries(t[r].map(({element:i,file:s})=>[i,{id:`rId${this.files.indexOf(s)+1}`,fontKey:s.fontKey}]))))),this.relationships=new ge;for(let n=0;n<this.files.length;n++)this.relationships.addRelationship(n+1,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/font",`fonts/font${n+1}.odttf`)}get View(){return this.fontTable}get Relationships(){return this.relationships}},tk=()=>new O({name:"w:wordWrap",attributes:{val:{key:"w:val",value:0}}}),nk=e=>{var t,n;return new O({name:"w:framePr",attributes:{anchorLock:{key:"w:anchorLock",value:e.anchorLock},dropCap:{key:"w:dropCap",value:e.dropCap},width:{key:"w:w",value:e.width},height:{key:"w:h",value:e.height},x:{key:"w:x",value:e.position?e.position.x:void 0},y:{key:"w:y",value:e.position?e.position.y:void 0},anchorHorizontal:{key:"w:hAnchor",value:e.anchor.horizontal},anchorVertical:{key:"w:vAnchor",value:e.anchor.vertical},spaceHorizontal:{key:"w:hSpace",value:(t=e.space)===null||t===void 0?void 0:t.horizontal},spaceVertical:{key:"w:vSpace",value:(n=e.space)===null||n===void 0?void 0:n.vertical},rule:{key:"w:hRule",value:e.rule},alignmentX:{key:"w:xAlign",value:e.alignment?e.alignment.x:void 0},alignmentY:{key:"w:yAlign",value:e.alignment?e.alignment.y:void 0},lines:{key:"w:lines",value:e.lines},wrap:{key:"w:wrap",value:e.wrap}}})},Wo=new WeakMap,rk=En(),ik={left:"right",right:"left"},Sn=class extends mt{constructor(e,{implicitListParagraphStyle:t=!0,inListOrder:n=!0}={}){if(super("w:pPr",e?.includeIfEmpty),S(this,"numbering",void 0),S(this,"numberProperties",void 0),!e)return this;if(e.heading&&this.push(gr(e.heading)),t&&(e.bullet&&this.push(gr("ListParagraph")),e.numbering&&!e.numbering.custom&&!e.style&&!e.heading&&this.push(gr("ListParagraph"))),e.style&&this.push(gr(e.style)),e.keepNext!==void 0&&this.push(new P("w:keepNext",e.keepNext)),e.keepLines!==void 0&&this.push(new P("w:keepLines",e.keepLines)),e.pageBreakBefore&&this.push(new D1),e.frame&&this.push(nk(e.frame)),e.widowControl!==void 0&&this.push(new P("w:widowControl",e.widowControl)),e.bullet&&this.push(new os(1,e.bullet.level)),e.numbering){let{reference:i,instance:s,level:a,restart:o}=e.numbering,l=typeof i=="string"?i:i.reference,c=new os(xs(l,s??0),a);this.numbering={reference:l,level:a,instance:s,restartedListId:o&&n&&s===void 0?rk():void 0,definition:typeof i=="string"?void 0:i},this.numberProperties=c,this.push(c)}else e.numbering===!1&&this.push(new os(0,0));e.border&&this.push(new Ky(e.border)),e.thematicBreak&&this.push(new Gy),e.shading&&this.push(Ps(e.shading)),e.wordWrap&&this.push(tk()),e.overflowPunctuation&&this.push(new P("w:overflowPunct",e.overflowPunctuation));let r=[...e.rightTabStop!==void 0?[{type:Mu.RIGHT,position:e.rightTabStop}]:[],...e.tabStops?e.tabStops:[],...e.leftTabStop!==void 0?[{type:Mu.LEFT,position:e.leftTabStop}]:[]];r.length>0&&this.push(H1(r)),e.bidirectional!==void 0&&this.push(new P("w:bidi",e.bidirectional)),e.spacing&&this.push(B1(e.spacing)),e.indent&&this.push(zy(e.indent)),e.contextualSpacing!==void 0&&this.push(new P("w:contextualSpacing",e.contextualSpacing)),e.alignment&&this.push(qh(e.bidirectional&&ik[e.alignment]||e.alignment)),e.outlineLevel!==void 0&&this.push(z1(e.outlineLevel)),e.suppressLineNumbers!==void 0&&this.push(new P("w:suppressLineNumbers",e.suppressLineNumbers)),e.autoSpaceEastAsianText!==void 0&&this.push(new P("w:autoSpaceDN",e.autoSpaceEastAsianText)),e.run&&this.push(new Ix(e.run)),e.revision&&this.push(new Du(e.revision))}push(e){this.root.push(e)}addSectionProperties(e){let t=this.root.findIndex(n=>n instanceof Du);if(t===-1){this.root.push(e);return}this.root.splice(t,0,e)}removeSectionProperties(e){let t=this.root.indexOf(e);t!==-1&&this.root.splice(t,1)}prepForXml(e){var t;if(this.numbering){var n,r;let{reference:a,level:o,instance:l=0,definition:c}=this.numbering,d=this.numbering.instance===void 0?(n=this.numbering.restartedListId)!==null&&n!==void 0?n:(r=Wo.get(e))===null||r===void 0?void 0:r.get(a):void 0;e.viewWrapper instanceof Sf||e.file.Numbering.createConcreteNumberingInstance(a,l,c,d);let p=new os(xs(a,l,d),o);this.root.splice(this.root.indexOf(this.numberProperties),1,p),this.numberProperties=p}let i=super.prepForXml(e);if(((t=this.numbering)===null||t===void 0?void 0:t.restartedListId)!==void 0){var s;Wo.set(e,new Map([...(s=Wo.get(e))!==null&&s!==void 0?s:[],[this.numbering.reference,this.numbering.restartedListId]]))}return i}},Du=class extends I{constructor(e){super("w:pPrChange"),this.root.push(new $e({id:e.id,author:e.author,date:e.date})),this.root.push(new Sn(k(k({},e),{},{includeIfEmpty:!0}),{inListOrder:!1}))}},J=class Ef extends Yl{constructor(t){if(super("w:p"),S(this,"options",void 0),S(this,"properties",void 0),S(this,"alignment",void 0),this.options=typeof t=="string"?{text:t}:t,typeof t=="string")return this.alignment={},this.properties=new Sn({}),this.root.push(this.properties),this.root.push(new Ie(t)),this;if(this.alignment={alignment:t.alignment,bidirectional:t.bidirectional},this.properties=new Sn(t),this.root.push(this.properties),t.text&&this.root.push(new Ie(t.text)),t.children)for(let n of t.children){if(n instanceof wf){this.root.push(...n.writtenAs);continue}this.root.push(n)}}prepForXml(t){for(let n of this.root)if(As(n)==="w:externalHyperlink"){let r=this.root.indexOf(n),{options:i}=n,{target:s,anchor:a}=Tf(i.link),o=new Jl(i.children,Cn(),a,i.link);t.viewWrapper.Relationships.addRelationship(o.linkId,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink",s,jl.EXTERNAL),this.root[r]=o}return super.prepForXml(t)}addSectionProperties(t){this.properties.addSectionProperties(t)}removeSectionProperties(t){this.properties.removeSectionProperties(t)}get Alignment(){return this.alignment}with(t){return new Ef(k(k({},this.options),t))}addRunToFront(t){return this.root.splice(1,0,t),this}},sk={TOP:"top",CENTER:"center",BOTTOM:"bottom"},MN=k(k({},sk),{},{BOTH:"both"}),Cf=e=>new O({name:"w:vAlign",attributes:{verticalAlign:{key:"w:val",value:e}}}),ak=({space:e,count:t,separate:n,equalWidth:r,children:i})=>new O({name:"w:cols",attributes:{space:{key:"w:space",value:e===void 0?void 0:be(e)},count:{key:"w:num",value:t===void 0?void 0:oe(t)},separate:{key:"w:sep",value:n},equalWidth:{key:"w:equalWidth",value:r}},children:!r&&i?i:void 0}),ok=({type:e,linePitch:t,charSpace:n})=>new O({name:"w:docGrid",attributes:{type:{key:"w:type",value:e},linePitch:{key:"w:linePitch",value:oe(t)},charSpace:{key:"w:charSpace",value:n?oe(n):void 0}}}),kn={DEFAULT:"default",FIRST:"first",EVEN:"even"},Bu={HEADER:"w:headerReference",FOOTER:"w:footerReference"},jo=(e,t)=>new O({name:e,attributes:{type:{key:"w:type",value:t.type||kn.DEFAULT},id:{key:"r:id",value:`rId${t.id}`}}}),lk=({countBy:e,start:t,restart:n,distance:r})=>new O({name:"w:lnNumType",attributes:{countBy:{key:"w:countBy",value:e===void 0?void 0:oe(e)},start:{key:"w:start",value:t===void 0?void 0:oe(t)},restart:{key:"w:restart",value:n},distance:{key:"w:distance",value:r===void 0?void 0:be(r)}}}),_f=({name:e,position:t,numberFormat:n,start:r,restart:i})=>new O({name:e,children:[...t===void 0?[]:[new O({name:"w:pos",attributes:{val:{key:"w:val",value:t}}})],...n?[new O({name:"w:numFmt",attributes:{val:{key:"w:val",value:n.type},format:{key:"w:format",value:n.format}}})]:[],...r===void 0?[]:[new O({name:"w:numStart",attributes:{val:{key:"w:val",value:oe(r)}}})],...i===void 0?[]:[new O({name:"w:numRestart",attributes:{val:{key:"w:val",value:i}}})]]}),ck=e=>_f(k({name:"w:footnotePr"},e)),dk=e=>_f(k({name:"w:endnotePr"},e)),$u=class extends H{constructor(...e){super(...e),S(this,"xmlKeys",{display:"w:display",offsetFrom:"w:offsetFrom",zOrder:"w:zOrder"})}},pk=class extends mt{constructor(e){if(super("w:pgBorders"),!e)return this;e.pageBorders?this.root.push(new $u({display:e.pageBorders.display,offsetFrom:e.pageBorders.offsetFrom,zOrder:e.pageBorders.zOrder})):this.root.push(new $u({})),e.pageBorderTop&&this.root.push(pe("w:top",e.pageBorderTop)),e.pageBorderLeft&&this.root.push(pe("w:left",e.pageBorderLeft)),e.pageBorderBottom&&this.root.push(pe("w:bottom",e.pageBorderBottom)),e.pageBorderRight&&this.root.push(pe("w:right",e.pageBorderRight))}},uk=(e,t,n,r,i,s,a)=>new O({name:"w:pgMar",attributes:{top:{key:"w:top",value:Ze(e)},right:{key:"w:right",value:be(t)},bottom:{key:"w:bottom",value:Ze(n)},left:{key:"w:left",value:be(r)},header:{key:"w:header",value:be(i)},footer:{key:"w:footer",value:be(s)},gutter:{key:"w:gutter",value:be(a)}}}),hk={HYPHEN:"hyphen",PERIOD:"period",COLON:"colon",EM_DASH:"emDash",EN_DASH:"endash"},fk=({start:e,formatType:t,separator:n,chapterHeadingLevel:r})=>new O({name:"w:pgNumType",attributes:{start:{key:"w:start",value:e===void 0?void 0:oe(e)},formatType:{key:"w:fmt",value:t},separator:{key:"w:chapSep",value:n===hk.EN_DASH?"enDash":n},chapterHeadingLevel:{key:"w:chapStyle",value:r===void 0?void 0:oe(r)}}}),ks={PORTRAIT:"portrait",LANDSCAPE:"landscape"},mk=({width:e,height:t,orientation:n,code:r})=>{let i=be(e),s=be(t);return new O({name:"w:pgSz",attributes:{width:{key:"w:w",value:n===ks.LANDSCAPE?s:i},height:{key:"w:h",value:n===ks.LANDSCAPE?i:s},orientation:{key:"w:orient",value:n},code:{key:"w:code",value:r}}})},gk=class extends H{constructor(...e){super(...e),S(this,"xmlKeys",{val:"w:val"})}},bk=class extends I{constructor(e){super("w:textDirection"),this.root.push(new gk({val:e}))}},vk=e=>new O({name:"w:type",attributes:{val:{key:"w:val",value:e}}}),Je={TOP:1440,RIGHT:1440,BOTTOM:1440,LEFT:1440,HEADER:708,FOOTER:708,GUTTER:0},hs={WIDTH:11906,HEIGHT:16838,ORIENTATION:ks.PORTRAIT},gl=class Af extends I{constructor({page:{size:{width:t=hs.WIDTH,height:n=hs.HEIGHT,orientation:r=hs.ORIENTATION,code:i}={},margin:{top:s=Je.TOP,right:a=Je.RIGHT,bottom:o=Je.BOTTOM,left:l=Je.LEFT,header:c=Je.HEADER,footer:d=Je.FOOTER,gutter:p=Je.GUTTER}={},pageNumbers:u={},borders:f,textDirection:m}={},grid:{linePitch:h=360,charSpace:g,type:v}={},headerWrapperGroup:w={},footerWrapperGroup:b={},lineNumbers:C,titlePage:A,verticalAlign:y,column:T,type:x,footnoteProperties:_,endnoteProperties:N,revision:M}={}){super("w:sectPr"),S(this,"availableTextWidth",void 0),this.availableTextWidth=Af.calculateAvailableTextWidth({pageWidth:r===ks.LANDSCAPE?n:t,left:l,right:a,gutter:p,column:T}),this.addHeaderFooterGroup(Bu.HEADER,w),this.addHeaderFooterGroup(Bu.FOOTER,b),_&&this.root.push(ck(_)),N&&this.root.push(dk(N)),x&&this.root.push(vk(x)),this.root.push(mk({width:t,height:n,orientation:r,code:i})),this.root.push(uk(s,a,o,l,c,d,p)),f&&this.root.push(new pk(f)),C&&this.root.push(lk(C)),this.root.push(fk(u)),T&&this.root.push(ak(T)),y&&this.root.push(Cf(y)),A!==void 0&&this.root.push(new P("w:titlePg",A)),m&&this.root.push(new bk(m)),this.root.push(ok({linePitch:h,charSpace:g,type:v})),M&&this.root.push(new wk(M))}get AvailableTextWidth(){return this.availableTextWidth}static calculateAvailableTextWidth({pageWidth:t,left:n,right:r,gutter:i,column:s}){var a,o;let l=Ot(t)-Ot(n)-Ot(r)-Ot(i),c=(a=s?.count)!==null&&a!==void 0?a:1;return c<=1?l:(l-Ot((o=s?.space)!==null&&o!==void 0?o:720)*(c-1))/c}addHeaderFooterGroup(t,n){n.default&&this.root.push(jo(t,{type:kn.DEFAULT,id:n.default.View.ReferenceId})),n.first&&this.root.push(jo(t,{type:kn.FIRST,id:n.first.View.ReferenceId})),n.even&&this.root.push(jo(t,{type:kn.EVEN,id:n.even.View.ReferenceId}))}},wk=class extends I{constructor(e){super("w:sectPrChange"),this.root.push(new $e({id:e.id,author:e.author,date:e.date})),this.root.push(new gl(e))}},Nf=class extends I{constructor({pageNumbers:e}={}){super("w:body"),S(this,"sections",[]),S(this,"sectionParagraphs",new Map),S(this,"headingBookmarkIds",new Jx),S(this,"pageNumbers",void 0),this.pageNumbers=e}getSectionPropertiesFor(e){let t=e?Math.max(this.root.indexOf(e),0):0;for(let n=t;n<this.root.length;n++){let r=this.root[n];if(r instanceof gl)return r;let i=this.sectionParagraphs.get(r);if(i)return i}return this.sections[this.sections.length-1]}addSection(e){let t=this.sections.pop(),n=this.lastParagraphOfSection();if(t&&n)this.sectionParagraphs.set(n,t);else{let r=this.createSectionParagraph();this.root.push(r),t&&this.sectionParagraphs.set(r,t)}this.sections.push(new gl(e))}prepForXml(e){var t;this.sections.length===1&&(this.root.splice(0,1),this.root.push(this.sections.pop()));for(let[i,s]of this.sectionParagraphs)i.addSectionProperties(s);let n;try{n=super.prepForXml(e)}finally{for(let[i,s]of this.sectionParagraphs)i.removeSectionProperties(s)}let r=(t=this.pageNumbers)===null||t===void 0?void 0:t.listNumbers;return u1(n,e,this.headingBookmarkIds,r&&(i=>r(i,e))),this.pageNumbers&&(v1(n,e),w1(n,e,this.pageNumbers)),n}push(e){let t=e instanceof J?this.sectionParagraphs.get(e):void 0;if(t){let n=this.createSectionParagraph();this.root.splice(this.root.indexOf(e)+1,0,n),this.sectionParagraphs.delete(e),this.sectionParagraphs.set(n,t)}this.root.push(e)}lastParagraphOfSection(){let e=this.root[this.root.length-1];return e instanceof J&&e!==this.root[0]&&!this.sectionParagraphs.has(e)&&this.root.indexOf(e)===this.root.length-1?e:void 0}createSectionParagraph(){return new J({})}},De={AUTO:"auto",DXA:"dxa",NIL:"nil",PERCENTAGE:"pct"},Er=(e,{type:t=De.AUTO,size:n})=>{let r=n;return t===De.PERCENTAGE&&typeof n=="number"&&(r=Math.round(n*50)),new O({name:e,attributes:{type:{key:"w:type",value:t},size:{key:"w:w",value:Hh(r)}}})},fs=hs.WIDTH-Je.LEFT-Je.RIGHT-Je.GUTTER,If=e=>e.options.columnSpan||1,Ql=(e,t)=>{if(!e)return;let{type:n=De.AUTO,size:r}=e;if(n!==De.PERCENTAGE&&n!==De.DXA)return;let i=typeof r=="number"?n===De.PERCENTAGE?r/100*t:r:r.endsWith("%")?Number(r.slice(0,-1))/100*t:Ot(r);return i>0?i:void 0},yk=(e,t)=>{var n;return(n=Ql(e,t))!==null&&n!==void 0?n:t},xk=e=>Math.max(0,...e.map(t=>t.cells.reduce((n,r)=>n+If(r),0))),Fu=({rows:e,width:t,availableWidth:n})=>{let r=xk(e);if(r===0)return[];let i=yk(t,n),s=Array.from({length:r},()=>{}),a=[];for(let d of e){let p=0;for(let u of d.cells){let f=If(u),m=Ql(u.options.width,i);if(m!==void 0)if(f===1){var o,l;(l=s[o=p])!==null&&l!==void 0||(s[o]=m)}else a.push({start:p,span:f,width:m});p+=f}}for(let{start:d,span:p,width:u}of a){let f=Array.from({length:p},(g,v)=>d+v).filter(g=>g<r),m=f.filter(g=>s[g]===void 0),h=u-f.reduce((g,v)=>{var w;return g+((w=s[v])!==null&&w!==void 0?w:0)},0);if(m.length>0&&h>0)for(let g of m)s[g]=h/m.length}let c=s.flatMap((d,p)=>d===void 0?[p]:[]);if(c.length>0){let d=i-s.reduce((u,f)=>u+(f??0),0),p=d>0?d/c.length:i/r;for(let u of c)s[u]=p}return s.map(d=>Math.round(d))},kk=e=>new O({name:"w:gridCol",attributes:e!==void 0?{width:{key:"w:w",value:be(e)}}:void 0}),ms=class extends I{constructor(e,t){super("w:tblGrid");for(let n of e)this.root.push(kk(n));t&&this.root.push(new Sk(t))}},Tk=class extends H{constructor(...e){super(...e),S(this,"xmlKeys",{id:"w:id"})}},Sk=class extends I{constructor(e){super("w:tblGridChange"),this.root.push(new Tk({id:e.id})),this.root.push(new ms(e.columnWidths))}},Ek=class extends I{constructor(e){super("w:ins"),this.root.push(new $e({id:e.id,author:e.author,date:e.date}))}},Ck=class extends I{constructor(e){super("w:del"),this.root.push(new $e({id:e.id,author:e.author,date:e.date}))}},_k=class extends I{constructor(e){super("w:cellIns"),this.root.push(new $e({id:e.id,author:e.author,date:e.date}))}},Ak=class extends I{constructor(e){super("w:cellDel"),this.root.push(new $e({id:e.id,author:e.author,date:e.date}))}},Nk=class extends H{constructor(...e){super(...e),S(this,"xmlKeys",{id:"w:id",author:"w:author",date:"w:date",verticalMerge:"w:vMerge",verticalMergeOriginal:"w:vMergeOrig"})}},Ik=class extends I{constructor(e){super("w:cellMerge"),this.root.push(new Nk(e))}},Pf=({marginUnitType:e=De.DXA,top:t,left:n,bottom:r,right:i})=>[{name:"w:top",size:t},{name:"w:left",size:n},{name:"w:bottom",size:r},{name:"w:right",size:i}].filter(s=>s.size!==void 0).map(({name:s,size:a})=>Er(s,{type:e,size:a})),Pk=e=>{let t=Pf(e);if(t.length!==0)return new O({name:"w:tblCellMar",children:t})},Ok=e=>{let t=Pf(e);if(t.length!==0)return new O({name:"w:tcMar",children:t})},Lk=class extends mt{constructor(e){super("w:tcBorders"),e.top&&this.root.push(pe("w:top",e.top)),e.start&&this.root.push(pe("w:start",e.start)),e.left&&this.root.push(pe("w:left",e.left)),e.bottom&&this.root.push(pe("w:bottom",e.bottom)),e.end&&this.root.push(pe("w:end",e.end)),e.right&&this.root.push(pe("w:right",e.right)),e.diagonalDown&&this.root.push(pe("w:tl2br",e.diagonalDown)),e.diagonalUp&&this.root.push(pe("w:tr2bl",e.diagonalUp))}},Rk=class extends H{constructor(...e){super(...e),S(this,"xmlKeys",{val:"w:val"})}},Mk=class extends I{constructor(e){super("w:gridSpan"),this.root.push(new Rk({val:oe(e)}))}},Of={CONTINUE:"continue",RESTART:"restart"},Dk=class extends H{constructor(...e){super(...e),S(this,"xmlKeys",{val:"w:val"})}},Hu=class extends I{constructor(e){super("w:vMerge"),this.root.push(new Dk({val:e}))}},Bk=class extends H{constructor(...e){super(...e),S(this,"xmlKeys",{val:"w:val"})}},$k=class extends I{constructor(e){super("w:textDirection"),this.root.push(new Bk({val:e}))}},Lf=class extends mt{constructor(e){if(super("w:tcPr",e.includeIfEmpty),S(this,"hasWidth",void 0),S(this,"hasColumnWidth",!1),this.hasWidth=e.width!==void 0,e.width&&this.root.push(Er("w:tcW",e.width)),e.columnSpan&&this.root.push(new Mk(e.columnSpan)),e.verticalMerge?this.root.push(new Hu(e.verticalMerge)):e.rowSpan&&e.rowSpan>1&&this.root.push(new Hu(Of.RESTART)),e.borders&&this.root.push(new Lk(e.borders)),e.shading&&this.root.push(Ps(e.shading)),e.margins){let t=Ok(e.margins);t&&this.root.push(t)}e.textDirection&&this.root.push(new $k(e.textDirection)),e.verticalAlign&&this.root.push(Cf(e.verticalAlign)),e.insertion&&this.root.push(new _k(e.insertion)),e.deletion&&this.root.push(new Ak(e.deletion)),e.cellMerge&&this.root.push(new Ik(e.cellMerge)),e.revision&&this.root.push(new Fk(e.revision))}setColumnWidth(e){this.hasWidth||(this.root.splice(0,this.hasColumnWidth?1:0,Er("w:tcW",{size:e,type:De.DXA})),this.hasColumnWidth=!0)}},Fk=class extends I{constructor(e){super("w:tcPrChange"),this.root.push(new $e({id:e.id,author:e.author,date:e.date})),this.root.push(new Lf(k(k({},e),{},{includeIfEmpty:!0})))}},Cr=class extends I{constructor(e){super("w:tc"),S(this,"options",void 0),S(this,"properties",void 0),this.options=e,this.properties=new Lf(e),this.root.push(this.properties);for(let t of e.children)this.root.push(t)}setColumnWidth(e){this.properties.setColumnWidth(e)}prepForXml(e){return As(this.root[this.root.length-1])!=="w:p"&&this.root.push(new J({})),super.prepForXml(e)}},bl=(e,t)=>t?new P(e):new et(e,"off"),wn={style:Lr.NONE,size:0,color:"auto"},Hk={style:Lr.SINGLE,size:4,color:"auto"},Rf=class extends mt{constructor(e,{fillMissingSides:t=!0}={}){super("w:tblBorders");let n=[["w:top",e.top],["w:left",e.left],["w:bottom",e.bottom],["w:right",e.right],["w:insideH",e.insideHorizontal],["w:insideV",e.insideVertical]];for(let[r,i]of n){let s=i??(t?Hk:void 0);s&&this.root.push(pe(r,s))}}};S(Rf,"NONE",{top:wn,bottom:wn,left:wn,right:wn,insideHorizontal:wn,insideVertical:wn});Ko={CENTER:"center",INSIDE:"inside",LEFT:"left",OUTSIDE:"outside",RIGHT:"right"},Uk={CENTER:"center",INSIDE:"inside",BOTTOM:"bottom",OUTSIDE:"outside",INLINE:"inline",TOP:"top"},qk=({horizontalAnchor:e,verticalAnchor:t,absoluteHorizontalPosition:n,relativeHorizontalPosition:r,absoluteVerticalPosition:i,relativeVerticalPosition:s,bottomFromText:a,topFromText:o,leftFromText:l,rightFromText:c})=>new O({name:"w:tblpPr",attributes:{leftFromText:{key:"w:leftFromText",value:l===void 0?void 0:be(l)},rightFromText:{key:"w:rightFromText",value:c===void 0?void 0:be(c)},topFromText:{key:"w:topFromText",value:o===void 0?void 0:be(o)},bottomFromText:{key:"w:bottomFromText",value:a===void 0?void 0:be(a)},absoluteHorizontalPosition:{key:"w:tblpX",value:n===void 0?void 0:Ze(n)},absoluteVerticalPosition:{key:"w:tblpY",value:i===void 0?void 0:Ze(i)},horizontalAnchor:{key:"w:horzAnchor",value:e},relativeHorizontalPosition:{key:"w:tblpXSpec",value:r},relativeVerticalPosition:{key:"w:tblpYSpec",value:s},verticalAnchor:{key:"w:vertAnchor",value:t}}}),Wk=e=>new O({name:"w:tblLayout",attributes:{type:{key:"w:type",value:e}}}),jk={DXA:"dxa",NIL:"nil"},Mf=({type:e=jk.DXA,value:t})=>new O({name:"w:tblCellSpacing",attributes:{type:{key:"w:type",value:e},value:{key:"w:w",value:Hh(t)}}}),Kk=({firstRow:e,lastRow:t,firstColumn:n,lastColumn:r,noHBand:i,noVBand:s})=>new O({name:"w:tblLook",attributes:{firstRow:{key:"w:firstRow",value:e},lastRow:{key:"w:lastRow",value:t},firstColumn:{key:"w:firstColumn",value:n},lastColumn:{key:"w:lastColumn",value:r},noHBand:{key:"w:noHBand",value:i},noVBand:{key:"w:noVBand",value:s}}}),Gk=e=>new O({name:"w:tblOverlap",attributes:{val:{key:"w:val",value:e}}}),zk={[Ko.LEFT]:de.LEFT,[Ko.CENTER]:de.CENTER,[Ko.RIGHT]:de.RIGHT},Zl=class extends mt{constructor(e){var t,n,r;super("w:tblPr",e.includeIfEmpty),e.style&&this.root.push(new et("w:tblStyle",e.style));let i=((t=e.float)===null||t===void 0?void 0:t.relativeVerticalPosition)===Uk.INLINE,s=i?void 0:e.float;s&&this.root.push(qk(s)),s?.overlap&&this.root.push(Gk(s.overlap)),e.visuallyRightToLeft!==void 0&&this.root.push(bl("w:bidiVisual",e.visuallyRightToLeft)),e.width&&this.root.push(Er("w:tblW",e.width));let a=(n=e.alignment)!==null&&n!==void 0?n:i&&(!((r=e.float)===null||r===void 0)&&r.relativeHorizontalPosition)?zk[e.float.relativeHorizontalPosition]:void 0;if(a&&this.root.push(qh(a)),e.cellSpacing&&this.root.push(Mf(e.cellSpacing)),e.indent&&this.root.push(Er("w:tblInd",e.indent)),e.borders&&this.root.push(new Rf(e.borders,{fillMissingSides:!e.style})),e.shading&&this.root.push(Ps(e.shading)),e.layout&&this.root.push(Wk(e.layout)),e.cellMargin){let o=Pk(e.cellMargin);o&&this.root.push(o)}e.tableLook&&this.root.push(Kk(e.tableLook)),e.revision&&this.root.push(new Vk(e.revision))}},Vk=class extends I{constructor(e){super("w:tblPrChange"),this.root.push(new $e({id:e.id,author:e.author,date:e.date})),this.root.push(new Zl(k(k({},e),{},{includeIfEmpty:!0})))}},Xk=(e,t)=>new O({name:"w:trHeight",attributes:{value:{key:"w:val",value:be(e)},rule:{key:"w:hRule",value:t}}}),Df=class extends mt{constructor(e){super("w:trPr",e.includeIfEmpty),e.cantSplit!==void 0&&this.root.push(bl("w:cantSplit",e.cantSplit)),e.tableHeader!==void 0&&this.root.push(bl("w:tblHeader",e.tableHeader)),e.height&&this.root.push(Xk(e.height.value,e.height.rule)),e.cellSpacing&&this.root.push(Mf(e.cellSpacing)),e.insertion&&this.root.push(new Ek(e.insertion)),e.deletion&&this.root.push(new Ck(e.deletion)),e.revision&&this.root.push(new Yk(e.revision))}},Yk=class extends I{constructor(e){super("w:trPrChange"),this.root.push(new $e({id:e.id,author:e.author,date:e.date})),this.root.push(new Df(k(k({},e),{},{includeIfEmpty:!0})))}},Ts=(e,t)=>{let n=e[t];return Array.isArray(n)?n:[]},vr=e=>Object.keys(e)[0],Jk=(e,t)=>{let n=Ts(e,"w:p"),r=n.find(o=>vr(o)==="w:pPr");if(!r)return{"w:p":[{"w:pPr":[t]},...n]};let i=Ts(r,"w:pPr");if(i.some(o=>vr(o)==="w:keepNext"))return e;let s=i.filter(o=>vr(o)==="w:pStyle").length,a={"w:pPr":[...i.slice(0,s),t,...i.slice(s)]};return{"w:p":n.map(o=>o===r?a:o)}},Ms=class extends I{constructor(e){super("w:tr"),S(this,"options",void 0),this.options=e,this.root.push(new Df(e));for(let t of e.children)this.root.push(t)}prepForXml(e){if(this.cells.length===0)return;let t=super.prepForXml(e);if(!t||this.options.keepNext===void 0)return t;let n=new P("w:keepNext",this.options.keepNext).prepForXml(e);return{"w:tr":Ts(t,"w:tr").map(r=>vr(r)==="w:tc"?{"w:tc":Ts(r,"w:tc").map(i=>vr(i)==="w:p"?Jk(i,n):i)}:r)}}get CellCount(){return this.options.children.length}get cells(){return this.root.filter(e=>As(e)==="w:tc")}addCellToIndex(e,t){this.root.splice(t+1,0,e)}addCellToColumnIndex(e,t){let n=this.columnIndexToRootIndex(t,!0);this.addCellToIndex(e,n-1)}rootIndexToColumnIndex(e){if(e<1||e>=this.root.length)throw new Error(`cell 'rootIndex' should between 1 to ${this.root.length-1}`);let t=0;for(let n=1;n<e;n++){let r=this.root[n];t+=r.options.columnSpan||1}return t}columnIndexToRootIndex(e,t=!1){if(e<0)throw new Error("cell 'columnIndex' should not less than zero");let n=0,r=1;for(;n<=e;){if(r>=this.root.length){if(t)return this.root.length;throw new Error(`cell 'columnIndex' should not great than ${n-1}`)}let i=this.root[r];r+=1,n+=i&&i.options.columnSpan||1}return r-1}},Bf=class $f extends Yl{constructor({rows:t,width:n,columnWidths:r,columnWidthsRevision:i,margins:s,indent:a,float:o,layout:l,style:c,borders:d,alignment:p,visuallyRightToLeft:u,tableLook:f,cellSpacing:m,revision:h}){super("w:tbl"),S(this,"rows",void 0),S(this,"width",void 0),S(this,"columnWidths",void 0),S(this,"columnWidthsRevision",void 0),S(this,"resolvedColumnWidths",void 0),this.rows=t,this.width=n??{size:100},this.columnWidths=r,this.columnWidthsRevision=i,t.forEach((g,v)=>{if(v===t.length-1)return;let w=0;g.cells.forEach(b=>{if(b.options.rowSpan&&b.options.rowSpan>1){let C=b.options.children[b.options.children.length-1],A=new Cr({rowSpan:b.options.rowSpan-1,columnSpan:b.options.columnSpan,width:b.options.width,borders:b.options.borders,shading:b.options.shading,margins:b.options.margins,textDirection:b.options.textDirection,verticalAlign:b.options.verticalAlign,children:C instanceof J?[new J(C.Alignment)]:[],verticalMerge:Of.CONTINUE});t[v+1].addCellToColumnIndex(A,w)}w+=b.options.columnSpan||1})}),this.setCellWidths(fs),this.resolvedColumnWidths=r??Fu({rows:t,width:this.width,availableWidth:fs}),this.root.push(new Zl({borders:c?d:d??{},width:this.width,indent:a,float:o,layout:l,style:c,alignment:p,cellMargin:s,visuallyRightToLeft:u,tableLook:f,cellSpacing:m,revision:h})),this.root.push(new ms(this.resolvedColumnWidths,i));for(let g of t)this.root.push(g)}get ColumnWidths(){return this.resolvedColumnWidths}getCellWidth(t,n){let{cells:r}=t,i=r.indexOf(n);if(i===-1)return;let s=r.slice(0,i).reduce((o,l)=>o+(l.options.columnSpan||1),0),a=this.resolvedColumnWidths.slice(s,s+(n.options.columnSpan||1));return a.length===0?void 0:a.reduce((o,l)=>o+l,0)}prepForXml(t){if(this.setCellWidths(this.resolveAvailableWidth(t)),this.columnWidths===void 0){this.resolvedColumnWidths=Fu({rows:this.rows,width:this.width,availableWidth:this.resolveAvailableWidth(t)});let n=this.root.findIndex(r=>r instanceof ms);this.root[n]=new ms(this.resolvedColumnWidths,this.columnWidthsRevision)}return super.prepForXml(t)}setCellWidths(t){var n;if(this.columnWidths===void 0)return;let r=this.columnWidths.reduce((a,o)=>a+o,0),i=(n=Ql(this.width,t))!==null&&n!==void 0?n:0,s=r>0&&i>r?i/r:1;for(let a of this.rows){let o=0;for(let l of a.cells){let c=l.options.columnSpan||1,d=this.columnWidths.slice(o,o+c),p=Math.round(d.reduce((u,f)=>u+f,0)*s);d.length===c&&p>0&&l.setColumnWidth(p),o+=c}}}resolveAvailableWidth(t){var n,r,i;let{stack:s}=t,a=s[s.length-1],o=s[s.length-2],l=s[s.length-3];if(a instanceof Cr&&o instanceof Ms&&l instanceof $f){let u=l.getCellWidth(o,a);if(u!==void 0)return u}let c=s.findIndex(u=>u instanceof Nf),d=(n=t.file)===null||n===void 0||(n=n.Document)===null||n===void 0?void 0:n.View.Body,p=c>=0?s[c].getSectionPropertiesFor((r=s[c+1])!==null&&r!==void 0?r:this):d?.getSectionPropertiesFor();return(i=p?.AvailableTextWidth)!==null&&i!==void 0?i:fs}},Qk=class extends H{constructor(...e){super(...e),S(this,"xmlKeys",{xmlns:"xmlns",vt:"xmlns:vt"})}},Zk=class extends I{constructor(){super("Properties"),this.root.push(new Qk({xmlns:"http://schemas.openxmlformats.org/officeDocument/2006/extended-properties",vt:"http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes"}))}},eT=class extends H{constructor(...e){super(...e),S(this,"xmlKeys",{xmlns:"xmlns"})}},dt=(e,t)=>new O({name:"Default",attributes:{contentType:{key:"ContentType",value:e},extension:{key:"Extension",value:t}}}),me=(e,t)=>new O({name:"Override",attributes:{contentType:{key:"ContentType",value:e},partName:{key:"PartName",value:t}}}),tT=class extends I{constructor({macros:e=!1}={}){super("Types"),this.root.push(new eT({xmlns:"http://schemas.openxmlformats.org/package/2006/content-types"})),this.root.push(dt("image/png","png")),this.root.push(dt("image/jpeg","jpeg")),this.root.push(dt("image/jpeg","jpg")),this.root.push(dt("image/bmp","bmp")),this.root.push(dt("image/gif","gif")),this.root.push(dt("image/svg+xml","svg")),this.root.push(dt("application/vnd.openxmlformats-package.relationships+xml","rels")),this.root.push(dt("application/xml","xml")),this.root.push(dt("application/vnd.openxmlformats-officedocument.obfuscatedFont","odttf")),this.root.push(me(e?"application/vnd.ms-word.document.macroEnabled.main+xml":"application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml","/word/document.xml")),this.root.push(me("application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml","/word/styles.xml")),this.root.push(me("application/vnd.openxmlformats-package.core-properties+xml","/docProps/core.xml")),this.root.push(me("application/vnd.openxmlformats-officedocument.custom-properties+xml","/docProps/custom.xml")),this.root.push(me("application/vnd.openxmlformats-officedocument.extended-properties+xml","/docProps/app.xml")),this.root.push(me("application/vnd.openxmlformats-officedocument.wordprocessingml.numbering+xml","/word/numbering.xml")),this.root.push(me("application/vnd.openxmlformats-officedocument.wordprocessingml.footnotes+xml","/word/footnotes.xml")),this.root.push(me("application/vnd.openxmlformats-officedocument.wordprocessingml.endnotes+xml","/word/endnotes.xml")),this.root.push(me("application/vnd.openxmlformats-officedocument.wordprocessingml.settings+xml","/word/settings.xml")),this.root.push(me("application/vnd.openxmlformats-officedocument.wordprocessingml.fontTable+xml","/word/fontTable.xml")),this.root.push(me("application/vnd.openxmlformats-officedocument.theme+xml","/word/theme/theme1.xml")),e&&this.root.push(me("application/vnd.ms-office.vbaProject","/word/vbaProject.bin"))}addComments(){this.root.push(me("application/vnd.openxmlformats-officedocument.wordprocessingml.comments+xml","/word/comments.xml"))}addCommentsExtended(){this.root.push(me("application/vnd.openxmlformats-officedocument.wordprocessingml.commentsExtended+xml","/word/commentsExtended.xml"))}addCommentsIds(){this.root.push(me("application/vnd.openxmlformats-officedocument.wordprocessingml.commentsIds+xml","/word/commentsIds.xml"))}addFooter(e){this.root.push(me("application/vnd.openxmlformats-officedocument.wordprocessingml.footer+xml",`/word/footer${e}.xml`))}addOverride(e,t){this.root.push(me(e,t))}addHeader(e){this.root.push(me("application/vnd.openxmlformats-officedocument.wordprocessingml.header+xml",`/word/header${e}.xml`))}},vl={wpc:"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas",mc:"http://schemas.openxmlformats.org/markup-compatibility/2006",o:"urn:schemas-microsoft-com:office:office",r:"http://schemas.openxmlformats.org/officeDocument/2006/relationships",m:"http://schemas.openxmlformats.org/officeDocument/2006/math",v:"urn:schemas-microsoft-com:vml",wp14:"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing",wp:"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing",w10:"urn:schemas-microsoft-com:office:word",w:"http://schemas.openxmlformats.org/wordprocessingml/2006/main",w14:"http://schemas.microsoft.com/office/word/2010/wordml",w15:"http://schemas.microsoft.com/office/word/2012/wordml",wpg:"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup",wpi:"http://schemas.microsoft.com/office/word/2010/wordprocessingInk",wne:"http://schemas.microsoft.com/office/word/2006/wordml",wps:"http://schemas.microsoft.com/office/word/2010/wordprocessingShape",cp:"http://schemas.openxmlformats.org/package/2006/metadata/core-properties",dc:"http://purl.org/dc/elements/1.1/",dcterms:"http://purl.org/dc/terms/",dcmitype:"http://purl.org/dc/dcmitype/",xsi:"http://www.w3.org/2001/XMLSchema-instance",cx:"http://schemas.microsoft.com/office/drawing/2014/chartex",cx1:"http://schemas.microsoft.com/office/drawing/2015/9/8/chartex",cx2:"http://schemas.microsoft.com/office/drawing/2015/10/21/chartex",cx3:"http://schemas.microsoft.com/office/drawing/2016/5/9/chartex",cx4:"http://schemas.microsoft.com/office/drawing/2016/5/10/chartex",cx5:"http://schemas.microsoft.com/office/drawing/2016/5/11/chartex",cx6:"http://schemas.microsoft.com/office/drawing/2016/5/12/chartex",cx7:"http://schemas.microsoft.com/office/drawing/2016/5/13/chartex",cx8:"http://schemas.microsoft.com/office/drawing/2016/5/14/chartex",aink:"http://schemas.microsoft.com/office/drawing/2016/ink",am3d:"http://schemas.microsoft.com/office/drawing/2017/model3d",w16cex:"http://schemas.microsoft.com/office/word/2018/wordml/cex",w16cid:"http://schemas.microsoft.com/office/word/2016/wordml/cid",w16:"http://schemas.microsoft.com/office/word/2018/wordml",w16sdtdh:"http://schemas.microsoft.com/office/word/2020/wordml/sdtdatahash",w16se:"http://schemas.microsoft.com/office/word/2015/wordml/symex"},Ds=class extends H{constructor(e,t){super(k({Ignorable:t},Object.fromEntries(e.map(n=>[n,vl[n]])))),S(this,"xmlKeys",k({Ignorable:"mc:Ignorable"},Object.fromEntries(Object.keys(vl).map(n=>[n,`xmlns:${n}`]))))}},nT=class extends I{constructor(e){super("cp:coreProperties"),this.root.push(new Ds(["cp","dc","dcterms","dcmitype","xsi"])),e.title&&this.root.push(new Xt("dc:title",e.title)),e.subject&&this.root.push(new Xt("dc:subject",e.subject)),e.creator&&this.root.push(new Xt("dc:creator",e.creator)),e.keywords&&this.root.push(new Xt("cp:keywords",e.keywords)),e.description&&this.root.push(new Xt("dc:description",e.description)),e.lastModifiedBy&&this.root.push(new Xt("cp:lastModifiedBy",e.lastModifiedBy)),e.revision&&this.root.push(new Xt("cp:revision",String(e.revision))),this.root.push(new Uu("dcterms:created")),this.root.push(new Uu("dcterms:modified"))}},rT=class extends H{constructor(...e){super(...e),S(this,"xmlKeys",{type:"xsi:type"})}},Uu=class extends I{constructor(e){super(e),this.root.push(new rT({type:"dcterms:W3CDTF"})),this.root.push(Oy(new Date))}},iT=class extends H{constructor(...e){super(...e),S(this,"xmlKeys",{xmlns:"xmlns",vt:"xmlns:vt"})}},sT=class extends H{constructor(...e){super(...e),S(this,"xmlKeys",{formatId:"fmtid",pid:"pid",name:"name"})}},aT=class extends I{constructor(e,t){super("property"),this.root.push(new sT({formatId:"{D5CDD505-2E9C-101B-9397-08002B2CF9AE}",pid:e.toString(),name:t.name})),this.root.push(new oT(t.value))}},oT=class extends I{constructor(e){super("vt:lpwstr"),this.root.push(e)}},lT=class extends I{constructor(e){super("Properties"),S(this,"nextId",void 0),S(this,"properties",[]),this.root.push(new iT({xmlns:"http://schemas.openxmlformats.org/officeDocument/2006/custom-properties",vt:"http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes"})),this.nextId=2;for(let t of e)this.addCustomProperty(t)}prepForXml(e){return this.root.splice(1,this.root.length-1,...this.properties),super.prepForXml(e)}addCustomProperty(e){this.properties.push(new aT(this.nextId++,e))}},cT=e=>new O({name:"ds:datastoreItem",attributes:{itemId:{key:"ds:itemID",value:e},namespace:{key:"xmlns:ds",value:"http://schemas.openxmlformats.org/officeDocument/2006/customXml"}},children:[new O({name:"ds:schemaRefs",children:[new O({name:"ds:schemaRef",attributes:{uri:{key:"ds:uri",value:"http://schemas.openxmlformats.org/officeDocument/2006/bibliography"}}})]})]}),dT={new:"wne:eventDocNew",open:"wne:eventDocOpen",close:"wne:eventDocClose",sync:"wne:eventDocSync",xmlAfterInsert:"wne:eventDocXmlAfterInsert",xmlBeforeDelete:"wne:eventDocXmlBeforeDelete",contentControlAfterAdd:"wne:eventDocContentControlAfterInsert",contentControlBeforeDelete:"wne:eventDocContentControlBeforeDelete",contentControlOnExit:"wne:eventDocContentControlOnExit",contentControlOnEnter:"wne:eventDocContentControlOnEnter",contentControlBeforeStoreUpdate:"wne:eventDocStoreUpdate",contentControlBeforeContentUpdate:"wne:eventDocContentControlContentUpdate",buildingBlockInsert:"wne:eventDocBuildingBlockAfterInsert"},pT=e=>new O({name:"wne:vbaSuppData",attributes:{namespace:{key:"xmlns:wne",value:"http://schemas.microsoft.com/office/word/2006/wordml"}},children:[new O({name:"wne:docEvents",children:Object.entries(dT).filter(([t])=>e.includes(t)).map(([,t])=>new O({name:t}))})]}),uT=class extends I{constructor({color:e,themeColor:t,themeShade:n,themeTint:r}){if(super("w:background"),typeof e=="object"&&(t!==void 0||n!==void 0||r!==void 0))throw new Error("Invalid background. Expected a theme color in color, or themeColor, themeShade and themeTint, not both");this.root.push(new Ul([{keys:Or,color:e},{key:"w:themeColor",value:t},{key:"w:themeShade",value:n===void 0?void 0:Au(n)},{key:"w:themeTint",value:r===void 0?void 0:Au(r)}]))}},hT=class extends I{constructor(e){super("w:document"),S(this,"body",void 0),this.root.push(new Ds(["wpc","mc","o","r","m","v","wp14","wp","w10","w","w14","w15","wpg","wpi","wne","wps","cx","cx1","cx2","cx3","cx4","cx5","cx6","cx7","cx8","aink","am3d","w16cex","w16cid","w16","w16sdtdh","w16se"],"w14 w15 wp14")),this.body=new Nf({pageNumbers:e.pageNumbers}),e.background&&this.root.push(new uT(e.background)),this.root.push(this.body)}add(e){return this.body.push(e),this}get Body(){return this.body}},fT=class{constructor(e){S(this,"document",void 0),S(this,"relationships",void 0),this.document=new hT(e),this.relationships=new ge}get View(){return this.document}get Relationships(){return this.relationships}},mT=class extends H{constructor(...e){super(...e),S(this,"xmlKeys",{wpc:"xmlns:wpc",mc:"xmlns:mc",o:"xmlns:o",r:"xmlns:r",m:"xmlns:m",v:"xmlns:v",wp14:"xmlns:wp14",wp:"xmlns:wp",w10:"xmlns:w10",w:"xmlns:w",w14:"xmlns:w14",w15:"xmlns:w15",wpg:"xmlns:wpg",wpi:"xmlns:wpi",wne:"xmlns:wne",wps:"xmlns:wps",Ignorable:"mc:Ignorable"})}},Ff=class extends I{constructor(e,t){super("w:p"),S(this,"paragraph",void 0),S(this,"mark",void 0),this.paragraph=e,this.mark=t}prepForXml(e){let t=this.paragraph.prepForXml(e)["w:p"],n=Array.isArray(t)?t:[],r=n.length>0&&"w:pPr"in n[0]?1:0;return{"w:p":[...n.slice(0,r),this.mark.prepForXml(e),...n.slice(r)]}}},gT=class extends H{constructor(...e){super(...e),S(this,"xmlKeys",{type:"w:type",id:"w:id"})}},Hf=class extends Be{constructor(){super({style:"EndnoteReference"}),this.root.push(new L1)}},qu={SEPARATOR:"separator",CONTINUATION_SEPARATOR:"continuationSeparator"},Go=class extends I{constructor(e){super("w:endnote"),this.root.push(new gT({type:e.type,id:e.id}));for(let[t,n]of e.children.entries())this.root.push(t===0?new Ff(n,new Hf):n)}},bT=class extends I{constructor(){super("w:continuationSeparator")}},Uf=class extends Be{constructor(){super({}),this.root.push(new bT)}},vT=class extends I{constructor(){super("w:separator")}},qf=class extends Be{constructor(){super({}),this.root.push(new vT)}},Wf=class extends I{constructor(){super("w:endnotes"),S(this,"ownNotes",new Map),S(this,"highestId",0),this.root.push(new mT({wpc:"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas",mc:"http://schemas.openxmlformats.org/markup-compatibility/2006",o:"urn:schemas-microsoft-com:office:office",r:"http://schemas.openxmlformats.org/officeDocument/2006/relationships",m:"http://schemas.openxmlformats.org/officeDocument/2006/math",v:"urn:schemas-microsoft-com:vml",wp14:"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing",wp:"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing",w10:"urn:schemas-microsoft-com:office:word",w:"http://schemas.openxmlformats.org/wordprocessingml/2006/main",w14:"http://schemas.microsoft.com/office/word/2010/wordml",w15:"http://schemas.microsoft.com/office/word/2012/wordml",wpg:"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup",wpi:"http://schemas.microsoft.com/office/word/2010/wordprocessingInk",wne:"http://schemas.microsoft.com/office/word/2006/wordml",wps:"http://schemas.microsoft.com/office/word/2010/wordprocessingShape",Ignorable:"w14 w15 wp14"}));let e=new Go({id:-1,type:qu.SEPARATOR,children:[new J({spacing:{after:0,line:240,lineRule:Tn.AUTO},children:[new qf]})]});this.root.push(e);let t=new Go({id:0,type:qu.CONTINUATION_SEPARATOR,children:[new J({spacing:{after:0,line:240,lineRule:Tn.AUTO},children:[new Uf]})]});this.root.push(t)}createEndnote(e,t){let n=new Go({id:e,children:t});this.root.push(n),Number.isFinite(e)&&(this.highestId=Math.max(this.highestId,Math.floor(e)))}idOf(e,t,n){if(n.viewWrapper!==n.file.Document)return;let r=this.ownNotes.get(e);if(r!==void 0)return r;let i=this.highestId+1;return this.createEndnote(i,t.children),this.ownNotes.set(e,i),i}prepForXml(e){let t=super.prepForXml(e);return Rr(t,e),t}},wT=class{constructor(){S(this,"endnotes",void 0),S(this,"relationships",void 0),this.endnotes=new Wf,this.relationships=new ge}get View(){return this.endnotes}get Relationships(){return this.relationships}},yT=class extends H{constructor(...e){super(...e),S(this,"xmlKeys",{wpc:"xmlns:wpc",mc:"xmlns:mc",o:"xmlns:o",r:"xmlns:r",m:"xmlns:m",v:"xmlns:v",wp14:"xmlns:wp14",wp:"xmlns:wp",w10:"xmlns:w10",w:"xmlns:w",w14:"xmlns:w14",w15:"xmlns:w15",wpg:"xmlns:wpg",wpi:"xmlns:wpi",wne:"xmlns:wne",wps:"xmlns:wps",cp:"xmlns:cp",dc:"xmlns:dc",dcterms:"xmlns:dcterms",dcmitype:"xmlns:dcmitype",xsi:"xmlns:xsi",type:"xsi:type"})}},xT=class extends Dh{constructor(e,t){super("w:ftr",t),S(this,"refId",void 0),this.refId=e,t||this.root.push(new yT({wpc:"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas",mc:"http://schemas.openxmlformats.org/markup-compatibility/2006",o:"urn:schemas-microsoft-com:office:office",r:"http://schemas.openxmlformats.org/officeDocument/2006/relationships",m:"http://schemas.openxmlformats.org/officeDocument/2006/math",v:"urn:schemas-microsoft-com:vml",wp14:"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing",wp:"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing",w10:"urn:schemas-microsoft-com:office:word",w:"http://schemas.openxmlformats.org/wordprocessingml/2006/main",w14:"http://schemas.microsoft.com/office/word/2010/wordml",w15:"http://schemas.microsoft.com/office/word/2012/wordml",wpg:"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup",wpi:"http://schemas.microsoft.com/office/word/2010/wordprocessingInk",wne:"http://schemas.microsoft.com/office/word/2006/wordml",wps:"http://schemas.microsoft.com/office/word/2010/wordprocessingShape"}))}get ReferenceId(){return this.refId}add(e){this.root.push(e)}prepForXml(e){let t=super.prepForXml(e);return Rr(t,e,this.refId),t}},kT=class{constructor(e,t,n){S(this,"media",void 0),S(this,"footer",void 0),S(this,"relationships",void 0),this.media=e,this.footer=new xT(t,n),this.relationships=new ge}add(e){this.footer.add(e)}addChildElement(e){this.footer.addChildElement(e)}get View(){return this.footer}get Relationships(){return this.relationships}get Media(){return this.media}},TT=class extends H{constructor(...e){super(...e),S(this,"xmlKeys",{type:"w:type",id:"w:id"})}},ST=class extends I{constructor(){super("w:footnoteRef")}},jf=class extends Be{constructor(){super({style:"FootnoteReference"}),this.root.push(new ST)}},Wu={SEPERATOR:"separator",CONTINUATION_SEPERATOR:"continuationSeparator"},zo=class extends I{constructor(e){super("w:footnote"),this.root.push(new TT({type:e.type,id:e.id}));for(let[t,n]of e.children.entries())this.root.push(t===0?new Ff(n,new jf):n)}},ET=class extends H{constructor(...e){super(...e),S(this,"xmlKeys",{wpc:"xmlns:wpc",mc:"xmlns:mc",o:"xmlns:o",r:"xmlns:r",m:"xmlns:m",v:"xmlns:v",wp14:"xmlns:wp14",wp:"xmlns:wp",w10:"xmlns:w10",w:"xmlns:w",w14:"xmlns:w14",w15:"xmlns:w15",wpg:"xmlns:wpg",wpi:"xmlns:wpi",wne:"xmlns:wne",wps:"xmlns:wps",Ignorable:"mc:Ignorable"})}},Kf=class extends I{constructor(){super("w:footnotes"),S(this,"ownNotes",new Map),S(this,"highestId",0),this.root.push(new ET({wpc:"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas",mc:"http://schemas.openxmlformats.org/markup-compatibility/2006",o:"urn:schemas-microsoft-com:office:office",r:"http://schemas.openxmlformats.org/officeDocument/2006/relationships",m:"http://schemas.openxmlformats.org/officeDocument/2006/math",v:"urn:schemas-microsoft-com:vml",wp14:"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing",wp:"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing",w10:"urn:schemas-microsoft-com:office:word",w:"http://schemas.openxmlformats.org/wordprocessingml/2006/main",w14:"http://schemas.microsoft.com/office/word/2010/wordml",w15:"http://schemas.microsoft.com/office/word/2012/wordml",wpg:"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup",wpi:"http://schemas.microsoft.com/office/word/2010/wordprocessingInk",wne:"http://schemas.microsoft.com/office/word/2006/wordml",wps:"http://schemas.microsoft.com/office/word/2010/wordprocessingShape",Ignorable:"w14 w15 wp14"}));let e=new zo({id:-1,type:Wu.SEPERATOR,children:[new J({spacing:{after:0,line:240,lineRule:Tn.AUTO},children:[new qf]})]});this.root.push(e);let t=new zo({id:0,type:Wu.CONTINUATION_SEPERATOR,children:[new J({spacing:{after:0,line:240,lineRule:Tn.AUTO},children:[new Uf]})]});this.root.push(t)}createFootNote(e,t){let n=new zo({id:e,children:t});this.root.push(n),Number.isFinite(e)&&(this.highestId=Math.max(this.highestId,Math.floor(e)))}idOf(e,t,n){if(n.viewWrapper!==n.file.Document)return;let r=this.ownNotes.get(e);if(r!==void 0)return r;let i=this.highestId+1;return this.createFootNote(i,t.children),this.ownNotes.set(e,i),i}prepForXml(e){let t=super.prepForXml(e);return Rr(t,e),t}},CT=class{constructor(){S(this,"footnotess",void 0),S(this,"relationships",void 0),this.footnotess=new Kf,this.relationships=new ge}get View(){return this.footnotess}get Relationships(){return this.relationships}},_T=class extends H{constructor(...e){super(...e),S(this,"xmlKeys",{wpc:"xmlns:wpc",mc:"xmlns:mc",o:"xmlns:o",r:"xmlns:r",m:"xmlns:m",v:"xmlns:v",wp14:"xmlns:wp14",wp:"xmlns:wp",w10:"xmlns:w10",w:"xmlns:w",w14:"xmlns:w14",w15:"xmlns:w15",wpg:"xmlns:wpg",wpi:"xmlns:wpi",wne:"xmlns:wne",wps:"xmlns:wps",cp:"xmlns:cp",dc:"xmlns:dc",dcterms:"xmlns:dcterms",dcmitype:"xmlns:dcmitype",xsi:"xmlns:xsi",type:"xsi:type",cx:"xmlns:cx",cx1:"xmlns:cx1",cx2:"xmlns:cx2",cx3:"xmlns:cx3",cx4:"xmlns:cx4",cx5:"xmlns:cx5",cx6:"xmlns:cx6",cx7:"xmlns:cx7",cx8:"xmlns:cx8",w16cid:"xmlns:w16cid",w16se:"xmlns:w16se"})}},AT=class extends Dh{constructor(e,t){super("w:hdr",t),S(this,"refId",void 0),this.refId=e,t||this.root.push(new _T({wpc:"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas",mc:"http://schemas.openxmlformats.org/markup-compatibility/2006",o:"urn:schemas-microsoft-com:office:office",r:"http://schemas.openxmlformats.org/officeDocument/2006/relationships",m:"http://schemas.openxmlformats.org/officeDocument/2006/math",v:"urn:schemas-microsoft-com:vml",wp14:"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing",wp:"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing",w10:"urn:schemas-microsoft-com:office:word",w:"http://schemas.openxmlformats.org/wordprocessingml/2006/main",w14:"http://schemas.microsoft.com/office/word/2010/wordml",w15:"http://schemas.microsoft.com/office/word/2012/wordml",wpg:"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup",wpi:"http://schemas.microsoft.com/office/word/2010/wordprocessingInk",wne:"http://schemas.microsoft.com/office/word/2006/wordml",wps:"http://schemas.microsoft.com/office/word/2010/wordprocessingShape",cx:"http://schemas.microsoft.com/office/drawing/2014/chartex",cx1:"http://schemas.microsoft.com/office/drawing/2015/9/8/chartex",cx2:"http://schemas.microsoft.com/office/drawing/2015/10/21/chartex",cx3:"http://schemas.microsoft.com/office/drawing/2016/5/9/chartex",cx4:"http://schemas.microsoft.com/office/drawing/2016/5/10/chartex",cx5:"http://schemas.microsoft.com/office/drawing/2016/5/11/chartex",cx6:"http://schemas.microsoft.com/office/drawing/2016/5/12/chartex",cx7:"http://schemas.microsoft.com/office/drawing/2016/5/13/chartex",cx8:"http://schemas.microsoft.com/office/drawing/2016/5/14/chartex",w16cid:"http://schemas.microsoft.com/office/word/2016/wordml/cid",w16se:"http://schemas.microsoft.com/office/word/2015/wordml/symex"}))}get ReferenceId(){return this.refId}add(e){this.root.push(e)}prepForXml(e){let t=super.prepForXml(e);return Rr(t,e,this.refId),t}},NT=class{constructor(e,t,n){S(this,"media",void 0),S(this,"header",void 0),S(this,"relationships",void 0),this.media=e,this.header=new AT(t,n),this.relationships=new ge}add(e){return this.header.add(e),this}addChildElement(e){this.header.addChildElement(e)}get View(){return this.header}get Relationships(){return this.relationships}get Media(){return this.media}},IT=()=>{let e=new Map;return t=>{var n;let r=((n=e.get(t))!==null&&n!==void 0?n:0)+1;return e.set(t,r),`media/image${r}.${t}`}},Gf=class{constructor(e=IT()){S(this,"map",new Map),S(this,"takePath",void 0),this.takePath=e}addImage(e,t){if(this.map.has(e))return;let n=this.takePath(t.type);this.map.set(e,k(k({},t),{},{fileName:n.slice(n.lastIndexOf("/")+1)}))}get Array(){return Array.from(this.map.values())}get Entries(){return Array.from(this.map.entries())}},pt={DECIMAL:"decimal",UPPER_ROMAN:"upperRoman",LOWER_ROMAN:"lowerRoman",UPPER_LETTER:"upperLetter",LOWER_LETTER:"lowerLetter",ORDINAL:"ordinal",CARDINAL_TEXT:"cardinalText",ORDINAL_TEXT:"ordinalText",HEX:"hex",CHICAGO:"chicago",IDEOGRAPH__DIGITAL:"ideographDigital",JAPANESE_COUNTING:"japaneseCounting",AIUEO:"aiueo",IROHA:"iroha",DECIMAL_FULL_WIDTH:"decimalFullWidth",DECIMAL_HALF_WIDTH:"decimalHalfWidth",JAPANESE_LEGAL:"japaneseLegal",JAPANESE_DIGITAL_TEN_THOUSAND:"japaneseDigitalTenThousand",DECIMAL_ENCLOSED_CIRCLE:"decimalEnclosedCircle",DECIMAL_FULL_WIDTH2:"decimalFullWidth2",AIUEO_FULL_WIDTH:"aiueoFullWidth",IROHA_FULL_WIDTH:"irohaFullWidth",DECIMAL_ZERO:"decimalZero",BULLET:"bullet",GANADA:"ganada",CHOSUNG:"chosung",DECIMAL_ENCLOSED_FULLSTOP:"decimalEnclosedFullstop",DECIMAL_ENCLOSED_PARENTHESES:"decimalEnclosedParen",DECIMAL_ENCLOSED_CIRCLE_CHINESE:"decimalEnclosedCircleChinese",IDEOGRAPH_ENCLOSED_CIRCLE:"ideographEnclosedCircle",IDEOGRAPH_TRADITIONAL:"ideographTraditional",IDEOGRAPH_ZODIAC:"ideographZodiac",IDEOGRAPH_ZODIAC_TRADITIONAL:"ideographZodiacTraditional",TAIWANESE_COUNTING:"taiwaneseCounting",IDEOGRAPH_LEGAL_TRADITIONAL:"ideographLegalTraditional",TAIWANESE_COUNTING_THOUSAND:"taiwaneseCountingThousand",TAIWANESE_DIGITAL:"taiwaneseDigital",CHINESE_COUNTING:"chineseCounting",CHINESE_LEGAL_SIMPLIFIED:"chineseLegalSimplified",CHINESE_COUNTING_THOUSAND:"chineseCountingThousand",KOREAN_DIGITAL:"koreanDigital",KOREAN_COUNTING:"koreanCounting",KOREAN_LEGAL:"koreanLegal",KOREAN_DIGITAL2:"koreanDigital2",VIETNAMESE_COUNTING:"vietnameseCounting",RUSSIAN_LOWER:"russianLower",RUSSIAN_UPPER:"russianUpper",NONE:"none",NUMBER_IN_DASH:"numberInDash",HEBREW1:"hebrew1",HEBREW2:"hebrew2",ARABIC_ALPHA:"arabicAlpha",ARABIC_ABJAD:"arabicAbjad",HINDI_VOWELS:"hindiVowels",HINDI_CONSONANTS:"hindiConsonants",HINDI_NUMBERS:"hindiNumbers",HINDI_COUNTING:"hindiCounting",THAI_LETTERS:"thaiLetters",THAI_NUMBERS:"thaiNumbers",THAI_COUNTING:"thaiCounting",BAHT_TEXT:"bahtText",DOLLAR_TEXT:"dollarText",CUSTOM:"custom"},PT=class extends H{constructor(...e){super(...e),S(this,"xmlKeys",{ilvl:"w:ilvl",tentative:"w:tentative"})}},OT=class extends I{constructor(e){super("w:numFmt"),this.root.push(new Ce({val:e}))}},LT=class extends I{constructor(e){super("w:lvlText"),this.root.push(new Ce({val:e}))}},RT=e=>{switch(e){case de.CENTER:return"center";case de.END:case de.RIGHT:return"right";default:return"left"}},MT=class extends I{constructor(e){super("w:lvlJc"),this.root.push(new Ce({val:RT(e)}))}},DT=class extends I{constructor(e){super("w:suff"),this.root.push(new Ce({val:e}))}},BT=class extends I{constructor(){super("w:isLgl")}},$T=class extends I{constructor({level:e,format:t,text:n,alignment:r=de.START,start:i=1,style:s,suffix:a,isLegalNumberingStyle:o}){if(super("w:lvl"),S(this,"paragraphProperties",void 0),S(this,"runProperties",void 0),this.root.push(new br("w:start",oe(i))),t&&this.root.push(new OT(t)),s?.style&&this.root.push(gr(s.style)),o&&this.root.push(new BT),a&&this.root.push(new DT(a)),n&&this.root.push(new LT(n)),this.root.push(new MT(r)),this.paragraphProperties=new Sn(s&&s.paragraph,{implicitListParagraphStyle:!1,inListOrder:!1}),this.runProperties=new Zt(s?.run&&k(k({},s.run),{},{highlight:void 0,math:void 0,revision:void 0})),this.root.push(this.paragraphProperties),this.root.push(this.runProperties),e>9)throw new Error("Level cannot be greater than 9. Read more here: https://answers.microsoft.com/en-us/msoffice/forum/all/does-word-support-more-than-9-list-levels/d130fdcd-1781-446d-8c84-c6c79124e4d7");this.root.push(new PT({ilvl:oe(e),tentative:1}))}},FT=class extends $T{},HT=class extends I{constructor(e){super("w:multiLevelType"),this.root.push(new Ce({val:e}))}},UT=class extends H{constructor(...e){super(...e),S(this,"xmlKeys",{abstractNumId:"w:abstractNumId",restartNumberingAfterBreak:"w15:restartNumberingAfterBreak"})}},Vo=class extends I{constructor(e,t){super("w:abstractNum"),S(this,"id",void 0),this.root.push(new UT({abstractNumId:oe(e),restartNumberingAfterBreak:0})),this.root.push(new HT("hybridMultilevel")),this.id=e;for(let n of t)this.root.push(new FT(n))}},qT=class extends I{constructor(e){super("w:abstractNumId"),this.root.push(new Ce({val:e}))}},WT=class extends H{constructor(...e){super(...e),S(this,"xmlKeys",{numId:"w:numId"})}},ju=class extends I{constructor(e){if(super("w:num"),S(this,"numId",void 0),S(this,"reference",void 0),S(this,"instance",void 0),S(this,"restartedListId",void 0),this.numId=e.numId,this.reference=e.reference,this.instance=e.instance,this.restartedListId=e.restartedListId,this.root.push(new WT({numId:oe(e.numId)})),this.root.push(new qT(oe(e.abstractNumId))),e.overrideLevels&&e.overrideLevels.length)for(let t of e.overrideLevels)this.root.push(new KT(t.num,t.start))}},jT=class extends H{constructor(...e){super(...e),S(this,"xmlKeys",{ilvl:"w:ilvl"})}},KT=class extends I{constructor(e,t){super("w:lvlOverride"),this.root.push(new jT({ilvl:e})),t!==void 0&&this.root.push(new zT(t))}},GT=class extends H{constructor(...e){super(...e),S(this,"xmlKeys",{val:"w:val"})}},zT=class extends I{constructor(e){super("w:startOverride"),this.root.push(new GT({val:e}))}},zf=class extends I{constructor(e){super("w:numbering"),S(this,"abstractNumberingMap",new Map),S(this,"concreteNumberingMap",new Map),S(this,"referenceConfigMap",new Map),S(this,"abstractNumUniqueNumericId",mx()),S(this,"concreteNumUniqueNumericId",gx()),this.root.push(new Ds(["wpc","mc","o","r","m","v","wp14","wp","w10","w","w14","w15","wpg","wpi","wne","wps"],"w14 w15 wp14"));let t=new Vo(this.abstractNumUniqueNumericId(),[{level:0,format:pt.BULLET,text:"\u25CF",alignment:de.LEFT,style:{paragraph:{indent:{left:We(.5),hanging:We(.25)}}}},{level:1,format:pt.BULLET,text:"\u25CB",alignment:de.LEFT,style:{paragraph:{indent:{left:We(1),hanging:We(.25)}}}},{level:2,format:pt.BULLET,text:"\u25A0",alignment:de.LEFT,style:{paragraph:{indent:{left:2160,hanging:We(.25)}}}},{level:3,format:pt.BULLET,text:"\u25CF",alignment:de.LEFT,style:{paragraph:{indent:{left:2880,hanging:We(.25)}}}},{level:4,format:pt.BULLET,text:"\u25CB",alignment:de.LEFT,style:{paragraph:{indent:{left:3600,hanging:We(.25)}}}},{level:5,format:pt.BULLET,text:"\u25A0",alignment:de.LEFT,style:{paragraph:{indent:{left:4320,hanging:We(.25)}}}},{level:6,format:pt.BULLET,text:"\u25CF",alignment:de.LEFT,style:{paragraph:{indent:{left:5040,hanging:We(.25)}}}},{level:7,format:pt.BULLET,text:"\u25CF",alignment:de.LEFT,style:{paragraph:{indent:{left:5760,hanging:We(.25)}}}},{level:8,format:pt.BULLET,text:"\u25CF",alignment:de.LEFT,style:{paragraph:{indent:{left:6480,hanging:We(.25)}}}}]);this.concreteNumberingMap.set("default-bullet-numbering",new ju({numId:1,abstractNumId:t.id,reference:"default-bullet-numbering",instance:0,overrideLevels:[{num:0,start:1}]})),this.abstractNumberingMap.set("default-bullet-numbering",t);for(let n of e.config)this.abstractNumberingMap.set(n.reference,new Vo(this.abstractNumUniqueNumericId(),n.levels)),this.referenceConfigMap.set(n.reference,n.levels)}prepForXml(e){return this.root.splice(1,this.root.length-1,...this.abstractNumberingMap.values(),...this.concreteNumberingMap.values()),super.prepForXml(e)}createConcreteNumberingInstance(e,t,n,r){var i;n&&!this.abstractNumberingMap.has(n.reference)&&(this.abstractNumberingMap.set(n.reference,new Vo(this.abstractNumUniqueNumericId(),n.levels)),this.referenceConfigMap.set(n.reference,n.levels));let s=this.abstractNumberingMap.get(e);if(!s)return;let a=xs(e,t,r);if(this.concreteNumberingMap.has(a))return;let o=(i=this.referenceConfigMap.get(e))!==null&&i!==void 0?i:[{level:0}],l={numId:this.concreteNumUniqueNumericId(),abstractNumId:s.id,reference:e,instance:t,restartedListId:r,overrideLevels:o.map(({level:c,start:d=1})=>({num:c,start:oe(d)}))};this.concreteNumberingMap.set(a,new ju(l))}get ConcreteNumbering(){return Array.from(this.concreteNumberingMap.values())}get ReferenceConfig(){return Array.from(this.referenceConfigMap.values())}},Vf=class{constructor(e,t=new Set){S(this,"contentTypes",void 0),S(this,"paths",new Map),S(this,"taken",void 0),S(this,"folders",new WeakMap),this.contentTypes=e,this.taken=new Set(t)}add(e){let t=this.paths.get(e);if(t!==void 0)return t;let{folder:n,name:r,extension:i,contentType:s}=e.options,a=this.takePath(n,r,i);return this.paths.set(e,a),this.contentTypes.addOverride(s,`/word/${a}`),a}takePath(e,t,n){let r=1;for(;this.taken.has(`${e}/${t}${r}.${n}`);)r++;let i=`${e}/${t}${r}.${n}`;return this.taken.add(i),i}get Array(){return[...this.paths].map(([e,t])=>({part:e,path:t}))}createRelationships(e){let t=new ge;return this.folders.set(t,e.slice(0,e.indexOf("/"))),t}getTarget(e,t){let n=this.folders.get(e);return n===void 0?t:t.startsWith(`${n}/`)?t.slice(n.length+1):`../${t}`}},VT=e=>new O({name:"w:compatSetting",attributes:{version:{key:"w:val",value:e},name:{key:"w:name",value:"compatibilityMode"},uri:{key:"w:uri",value:"http://schemas.microsoft.com/office/word"}}}),XT=class extends I{constructor(e){super("w:compat"),e.useSingleBorderforContiguousCells&&this.root.push(new P("w:useSingleBorderforContiguousCells",e.useSingleBorderforContiguousCells)),e.wordPerfectJustification&&this.root.push(new P("w:wpJustification",e.wordPerfectJustification)),e.noTabStopForHangingIndent&&this.root.push(new P("w:noTabHangInd",e.noTabStopForHangingIndent)),e.noLeading&&this.root.push(new P("w:noLeading",e.noLeading)),e.spaceForUnderline&&this.root.push(new P("w:spaceForUL",e.spaceForUnderline)),e.noColumnBalance&&this.root.push(new P("w:noColumnBalance",e.noColumnBalance)),e.balanceSingleByteDoubleByteWidth&&this.root.push(new P("w:balanceSingleByteDoubleByteWidth",e.balanceSingleByteDoubleByteWidth)),e.noExtraLineSpacing&&this.root.push(new P("w:noExtraLineSpacing",e.noExtraLineSpacing)),e.doNotLeaveBackslashAlone&&this.root.push(new P("w:doNotLeaveBackslashAlone",e.doNotLeaveBackslashAlone)),e.underlineTrailingSpaces&&this.root.push(new P("w:ulTrailSpace",e.underlineTrailingSpaces)),e.doNotExpandShiftReturn&&this.root.push(new P("w:doNotExpandShiftReturn",e.doNotExpandShiftReturn)),e.spacingInWholePoints&&this.root.push(new P("w:spacingInWholePoints",e.spacingInWholePoints)),e.lineWrapLikeWord6&&this.root.push(new P("w:lineWrapLikeWord6",e.lineWrapLikeWord6)),e.printBodyTextBeforeHeader&&this.root.push(new P("w:printBodyTextBeforeHeader",e.printBodyTextBeforeHeader)),e.printColorsBlack&&this.root.push(new P("w:printColBlack",e.printColorsBlack)),e.spaceWidth&&this.root.push(new P("w:wpSpaceWidth",e.spaceWidth)),e.showBreaksInFrames&&this.root.push(new P("w:showBreaksInFrames",e.showBreaksInFrames)),e.subFontBySize&&this.root.push(new P("w:subFontBySize",e.subFontBySize)),e.suppressBottomSpacing&&this.root.push(new P("w:suppressBottomSpacing",e.suppressBottomSpacing)),e.suppressTopSpacing&&this.root.push(new P("w:suppressTopSpacing",e.suppressTopSpacing)),e.suppressSpacingAtTopOfPage&&this.root.push(new P("w:suppressSpacingAtTopOfPage",e.suppressSpacingAtTopOfPage)),e.suppressTopSpacingWP&&this.root.push(new P("w:suppressTopSpacingWP",e.suppressTopSpacingWP)),e.suppressSpBfAfterPgBrk&&this.root.push(new P("w:suppressSpBfAfterPgBrk",e.suppressSpBfAfterPgBrk)),e.swapBordersFacingPages&&this.root.push(new P("w:swapBordersFacingPages",e.swapBordersFacingPages)),e.convertMailMergeEsc&&this.root.push(new P("w:convMailMergeEsc",e.convertMailMergeEsc)),e.truncateFontHeightsLikeWP6&&this.root.push(new P("w:truncateFontHeightsLikeWP6",e.truncateFontHeightsLikeWP6)),e.macWordSmallCaps&&this.root.push(new P("w:mwSmallCaps",e.macWordSmallCaps)),e.usePrinterMetrics&&this.root.push(new P("w:usePrinterMetrics",e.usePrinterMetrics)),e.doNotSuppressParagraphBorders&&this.root.push(new P("w:doNotSuppressParagraphBorders",e.doNotSuppressParagraphBorders)),e.wrapTrailSpaces&&this.root.push(new P("w:wrapTrailSpaces",e.wrapTrailSpaces)),e.footnoteLayoutLikeWW8&&this.root.push(new P("w:footnoteLayoutLikeWW8",e.footnoteLayoutLikeWW8)),e.shapeLayoutLikeWW8&&this.root.push(new P("w:shapeLayoutLikeWW8",e.shapeLayoutLikeWW8)),e.alignTablesRowByRow&&this.root.push(new P("w:alignTablesRowByRow",e.alignTablesRowByRow)),e.forgetLastTabAlignment&&this.root.push(new P("w:forgetLastTabAlignment",e.forgetLastTabAlignment)),e.adjustLineHeightInTable&&this.root.push(new P("w:adjustLineHeightInTable",e.adjustLineHeightInTable)),e.autoSpaceLikeWord95&&this.root.push(new P("w:autoSpaceLikeWord95",e.autoSpaceLikeWord95)),e.noSpaceRaiseLower&&this.root.push(new P("w:noSpaceRaiseLower",e.noSpaceRaiseLower)),e.doNotUseHTMLParagraphAutoSpacing&&this.root.push(new P("w:doNotUseHTMLParagraphAutoSpacing",e.doNotUseHTMLParagraphAutoSpacing)),e.layoutRawTableWidth&&this.root.push(new P("w:layoutRawTableWidth",e.layoutRawTableWidth)),e.layoutTableRowsApart&&this.root.push(new P("w:layoutTableRowsApart",e.layoutTableRowsApart)),e.useWord97LineBreakRules&&this.root.push(new P("w:useWord97LineBreakRules",e.useWord97LineBreakRules)),e.doNotBreakWrappedTables&&this.root.push(new P("w:doNotBreakWrappedTables",e.doNotBreakWrappedTables)),e.doNotSnapToGridInCell&&this.root.push(new P("w:doNotSnapToGridInCell",e.doNotSnapToGridInCell)),e.selectFieldWithFirstOrLastCharacter&&this.root.push(new P("w:selectFldWithFirstOrLastChar",e.selectFieldWithFirstOrLastCharacter)),e.applyBreakingRules&&this.root.push(new P("w:applyBreakingRules",e.applyBreakingRules)),e.doNotWrapTextWithPunctuation&&this.root.push(new P("w:doNotWrapTextWithPunct",e.doNotWrapTextWithPunctuation)),e.doNotUseEastAsianBreakRules&&this.root.push(new P("w:doNotUseEastAsianBreakRules",e.doNotUseEastAsianBreakRules)),e.useWord2002TableStyleRules&&this.root.push(new P("w:useWord2002TableStyleRules",e.useWord2002TableStyleRules)),e.growAutofit&&this.root.push(new P("w:growAutofit",e.growAutofit)),e.useFELayout&&this.root.push(new P("w:useFELayout",e.useFELayout)),e.useNormalStyleForList&&this.root.push(new P("w:useNormalStyleForList",e.useNormalStyleForList)),e.doNotUseIndentAsNumberingTabStop&&this.root.push(new P("w:doNotUseIndentAsNumberingTabStop",e.doNotUseIndentAsNumberingTabStop)),e.useAlternateEastAsianLineBreakRules&&this.root.push(new P("w:useAltKinsokuLineBreakRules",e.useAlternateEastAsianLineBreakRules)),e.allowSpaceOfSameStyleInTable&&this.root.push(new P("w:allowSpaceOfSameStyleInTable",e.allowSpaceOfSameStyleInTable)),e.doNotSuppressIndentation&&this.root.push(new P("w:doNotSuppressIndentation",e.doNotSuppressIndentation)),e.doNotAutofitConstrainedTables&&this.root.push(new P("w:doNotAutofitConstrainedTables",e.doNotAutofitConstrainedTables)),e.autofitToFirstFixedWidthCell&&this.root.push(new P("w:autofitToFirstFixedWidthCell",e.autofitToFirstFixedWidthCell)),e.underlineTabInNumberingList&&this.root.push(new P("w:underlineTabInNumList",e.underlineTabInNumberingList)),e.displayHangulFixedWidth&&this.root.push(new P("w:displayHangulFixedWidth",e.displayHangulFixedWidth)),e.splitPgBreakAndParaMark&&this.root.push(new P("w:splitPgBreakAndParaMark",e.splitPgBreakAndParaMark)),e.doNotVerticallyAlignCellWithSp&&this.root.push(new P("w:doNotVertAlignCellWithSp",e.doNotVerticallyAlignCellWithSp)),e.doNotBreakConstrainedForcedTable&&this.root.push(new P("w:doNotBreakConstrainedForcedTable",e.doNotBreakConstrainedForcedTable)),e.ignoreVerticalAlignmentInTextboxes&&this.root.push(new P("w:doNotVertAlignInTxbx",e.ignoreVerticalAlignmentInTextboxes)),e.useAnsiKerningPairs&&this.root.push(new P("w:useAnsiKerningPairs",e.useAnsiKerningPairs)),e.cachedColumnBalance&&this.root.push(new P("w:cachedColBalance",e.cachedColumnBalance)),e.version&&this.root.push(VT(e.version))}},Ku=1e5,Gu=15,YT=[57840,7439,52380,33984,4364,3600,61902,12606,6258,57657,54287,34041,10252,43370,20163],JT=[[44796,19929,39858,10053,20106,40212,10761],[31585,63170,64933,60267,50935,40399,11199],[17763,35526,1453,2906,5812,11624,23248],[885,1770,3540,7080,14160,28320,56640],[55369,41139,20807,41614,21821,43642,17621],[28485,56970,44341,19019,38038,14605,29210],[60195,50791,40175,10751,21502,43004,24537],[18387,36774,3949,7898,15796,31592,63184],[47201,24803,49606,37805,14203,28406,56812],[17824,35648,1697,3394,6788,13576,27152],[43601,17539,35078,557,1114,2228,4456],[30388,60776,51953,34243,7079,14158,28316],[14128,28256,56512,43425,17251,34502,7597],[13105,26210,52420,35241,883,1766,3532],[4129,8258,16516,33032,4657,9314,18628]],zu=e=>e>>14&1|e<<1&32767,QT=e=>{let t=e.slice(0,Gu).split("").map(i=>{let s=i.charCodeAt(0);return(s&255)!==0?s&255:s>>8&255}),n=t.reduce((i,s,a)=>JT[Gu-t.length+a].reduce((o,l,c)=>s>>c&1?o^l:o,i),YT[t.length-1]),r=(zu(t.reduceRight((i,s)=>zu(i)^s,0))^t.length^52811)&65535;return[r&255,r>>8,n&255,n>>8].map(i=>i.toString(16).toUpperCase().padStart(2,"0")).join("")},ZT=(e,t,n)=>{let r=[...QT(e)].flatMap(o=>[o.charCodeAt(0),0]),i=Ou(Uint8Array.from([...t,...r])),s=new Uint8Array(i.length+4),a=new DataView(s.buffer);for(let o=0;o<n;o++)s.set(i),a.setUint32(i.length,o,!0),i=Ou(s);return Array.from(i)},eS=e=>{var t;let n=new Uint8Array(e);return typeof((t=globalThis.crypto)===null||t===void 0?void 0:t.getRandomValues)=="function"?(globalThis.crypto.getRandomValues(n),[...n]):[...n].map(()=>Math.floor(Math.random()*256))},Vu=class extends H{constructor(...e){super(...e),S(this,"xmlKeys",{edit:"w:edit",enforcement:"w:enforcement",cryptProviderType:"w:cryptProviderType",cryptAlgorithmClass:"w:cryptAlgorithmClass",cryptAlgorithmType:"w:cryptAlgorithmType",cryptAlgorithmSid:"w:cryptAlgorithmSid",cryptSpinCount:"w:cryptSpinCount",hash:"w:hash",salt:"w:salt"})}},Xu=e=>btoa(String.fromCharCode(...e)),tS=class extends I{constructor({type:e,password:t}){if(super("w:documentProtection"),t===void 0||t===""){this.root.push(new Vu({edit:e,enforcement:!0}));return}let n=eS(16);this.root.push(new Vu({edit:e,enforcement:!0,cryptProviderType:"rsaAES",cryptAlgorithmClass:"hash",cryptAlgorithmType:"typeAny",cryptAlgorithmSid:12,cryptSpinCount:Ku,hash:Xu(ZT(t,n,Ku)),salt:Xu(n)}))}},nS=class extends H{constructor(...e){super(...e),S(this,"xmlKeys",{wpc:"xmlns:wpc",mc:"xmlns:mc",o:"xmlns:o",r:"xmlns:r",m:"xmlns:m",v:"xmlns:v",wp14:"xmlns:wp14",wp:"xmlns:wp",w10:"xmlns:w10",w:"xmlns:w",w14:"xmlns:w14",w15:"xmlns:w15",wpg:"xmlns:wpg",wpi:"xmlns:wpi",wne:"xmlns:wne",wps:"xmlns:wps",Ignorable:"mc:Ignorable"})}},rS=class extends I{constructor(e){var t,n,r,i,s,a,o,l,c;super("w:settings"),this.root.push(new nS({wpc:"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas",mc:"http://schemas.openxmlformats.org/markup-compatibility/2006",o:"urn:schemas-microsoft-com:office:office",r:"http://schemas.openxmlformats.org/officeDocument/2006/relationships",m:"http://schemas.openxmlformats.org/officeDocument/2006/math",v:"urn:schemas-microsoft-com:vml",wp14:"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing",wp:"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing",w10:"urn:schemas-microsoft-com:office:word",w:"http://schemas.openxmlformats.org/wordprocessingml/2006/main",w14:"http://schemas.microsoft.com/office/word/2010/wordml",w15:"http://schemas.microsoft.com/office/word/2012/wordml",wpg:"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup",wpi:"http://schemas.microsoft.com/office/word/2010/wordprocessingInk",wne:"http://schemas.microsoft.com/office/word/2006/wordml",wps:"http://schemas.microsoft.com/office/word/2010/wordprocessingShape",Ignorable:"w14 w15 wp14"})),this.root.push(new P("w:displayBackgroundShape",!0)),e.embedFonts!==void 0&&this.root.push(new P("w:embedTrueTypeFonts",e.embedFonts)),e.trackRevisions!==void 0&&this.root.push(new P("w:trackRevisions",e.trackRevisions)),e.protection!==void 0&&this.root.push(new tS(e.protection)),this.root.push(new br("w:defaultTabStop",(t=e.defaultTabStop)!==null&&t!==void 0?t:720)),((n=e.hyphenation)===null||n===void 0?void 0:n.autoHyphenation)!==void 0&&this.root.push(new P("w:autoHyphenation",e.hyphenation.autoHyphenation)),((r=e.hyphenation)===null||r===void 0?void 0:r.consecutiveHyphenLimit)!==void 0&&this.root.push(new br("w:consecutiveHyphenLimit",e.hyphenation.consecutiveHyphenLimit)),((i=e.hyphenation)===null||i===void 0?void 0:i.hyphenationZone)!==void 0&&this.root.push(new br("w:hyphenationZone",e.hyphenation.hyphenationZone)),((s=e.hyphenation)===null||s===void 0?void 0:s.doNotHyphenateCaps)!==void 0&&this.root.push(new P("w:doNotHyphenateCaps",e.hyphenation.doNotHyphenateCaps)),e.evenAndOddHeaders!==void 0&&this.root.push(new P("w:evenAndOddHeaders",e.evenAndOddHeaders)),e.updateFields!==void 0&&this.root.push(new P("w:updateFields",e.updateFields)),this.root.push(new XT(k(k({},(a=e.compatibility)!==null&&a!==void 0?a:{}),{},{version:(o=(l=(c=e.compatibility)===null||c===void 0?void 0:c.version)!==null&&l!==void 0?l:e.compatibilityModeVersion)!==null&&o!==void 0?o:15})))}},Xf=class extends H{constructor(...e){super(...e),S(this,"xmlKeys",{val:"w:val"})}},iS=class extends I{constructor(e){super("w:name"),this.root.push(new Xf({val:e}))}},sS=class extends I{constructor(e){super("w:uiPriority"),this.root.push(new Xf({val:oe(e)}))}},aS=class extends H{constructor(...e){super(...e),S(this,"xmlKeys",{type:"w:type",styleId:"w:styleId",default:"w:default",customStyle:"w:customStyle"})}},ec=class extends I{constructor(e,t){super("w:style"),this.root.push(new aS(e)),t.name&&this.root.push(new iS(t.name)),t.basedOn&&t.basedOn!==e.styleId&&this.root.push(new et("w:basedOn",t.basedOn)),t.next&&this.root.push(new et("w:next",t.next)),t.link&&this.root.push(new et("w:link",t.link)),t.uiPriority!==void 0&&this.root.push(new sS(t.uiPriority)),t.semiHidden!==void 0&&this.root.push(new P("w:semiHidden",t.semiHidden)),t.unhideWhenUsed!==void 0&&this.root.push(new P("w:unhideWhenUsed",t.unhideWhenUsed)),t.quickFormat!==void 0&&this.root.push(new P("w:qFormat",t.quickFormat))}},gt=class extends ec{constructor(e){super({type:"paragraph",styleId:e.id},e),S(this,"paragraphProperties",void 0),S(this,"runProperties",void 0),this.paragraphProperties=new Sn(e.paragraph,{implicitListParagraphStyle:!1,inListOrder:!1}),this.runProperties=new Zt(e.run),this.root.push(this.paragraphProperties),this.root.push(this.runProperties)}},en=class extends ec{constructor(e){super({type:"character",styleId:e.id},k({uiPriority:99,unhideWhenUsed:!0},e)),S(this,"runProperties",void 0),this.runProperties=new Zt(e.run),this.root.push(this.runProperties)}},Dt=class extends gt{constructor(e){super(k({basedOn:"Normal",next:"Normal",quickFormat:!0},e))}},oS=class extends Dt{constructor(e){super(k({id:"Title",name:"Title"},e))}},lS=class extends Dt{constructor(e){super(k({id:"Heading1",name:"Heading 1"},e))}},cS=class extends Dt{constructor(e){super(k({id:"Heading2",name:"Heading 2"},e))}},dS=class extends Dt{constructor(e){super(k({id:"Heading3",name:"Heading 3"},e))}},pS=class extends Dt{constructor(e){super(k({id:"Heading4",name:"Heading 4"},e))}},uS=class extends Dt{constructor(e){super(k({id:"Heading5",name:"Heading 5"},e))}},hS=class extends Dt{constructor(e){super(k({id:"Heading6",name:"Heading 6"},e))}},fS=class extends Dt{constructor(e){super(k({id:"Strong",name:"Strong"},e))}},mS=class extends gt{constructor(e){super(k({id:"ListParagraph",name:"List Paragraph",basedOn:"Normal",quickFormat:!0},e))}},gS=class extends gt{constructor(e){super(k({id:"Caption",name:"caption",basedOn:"Normal",next:"Normal",uiPriority:35,semiHidden:!0,unhideWhenUsed:!0,quickFormat:!0,paragraph:{spacing:{after:200}},run:{italics:!0,color:{theme:"dark2"},size:18}},e))}},bS=class extends gt{constructor(e){super(k({id:"Bibliography",name:"Bibliography",basedOn:"Normal",next:"Normal",uiPriority:37,unhideWhenUsed:!0},e))}},Yf=new WeakSet,Yu=e=>Yf.has(e),ut=class extends gt{constructor(e,t){super({id:`TOC${e}`,name:`toc ${e}`,basedOn:"Normal",next:"Normal",uiPriority:39,semiHidden:!0,unhideWhenUsed:!0,paragraph:k({spacing:{after:100}},e>1?{indent:{left:(e-1)*t}}:{})})}prepForXml(e){let t=super.prepForXml(e);return Yf.add(t),t}},Jf=class extends gt{constructor(e){super(k({id:"FootnoteText",name:"footnote text",link:"FootnoteTextChar",basedOn:"Normal",uiPriority:99,semiHidden:!0,unhideWhenUsed:!0,paragraph:{spacing:{after:0,line:240,lineRule:Tn.AUTO}},run:{size:20}},e))}},Qf=class extends en{constructor(e){super(k({id:"FootnoteReference",name:"footnote reference",basedOn:"DefaultParagraphFont",semiHidden:!0,run:{superScript:!0}},e))}},Zf=class extends en{constructor(e){super(k({id:"FootnoteTextChar",name:"Footnote Text Char",basedOn:"DefaultParagraphFont",link:"FootnoteText",semiHidden:!0,run:{size:20}},e))}},em=class extends gt{constructor(e){super(k({id:"EndnoteText",name:"endnote text",link:"EndnoteTextChar",basedOn:"Normal",uiPriority:99,semiHidden:!0,unhideWhenUsed:!0,paragraph:{spacing:{after:0,line:240,lineRule:Tn.AUTO}},run:{size:20}},e))}},tm=class extends en{constructor(e){super(k({id:"EndnoteReference",name:"endnote reference",basedOn:"DefaultParagraphFont",semiHidden:!0,run:{superScript:!0}},e))}},nm=class extends en{constructor(e){super(k({id:"EndnoteTextChar",name:"Endnote Text Char",basedOn:"DefaultParagraphFont",link:"EndnoteText",semiHidden:!0,run:{size:20}},e))}},vS=class extends en{constructor(e){super(k({id:"Hyperlink",name:"Hyperlink",basedOn:"DefaultParagraphFont",run:{color:"0563C1",underline:{type:Jh.SINGLE}}},e))}},wS=class extends en{constructor(e){super(k({id:"LineNumber",name:"line number",basedOn:"DefaultParagraphFont",semiHidden:!0},e))}},yS=class extends ec{constructor(){super({type:"table",styleId:"TableNormal",default:!0},{name:"Normal Table",uiPriority:99,semiHidden:!0,unhideWhenUsed:!0}),this.root.push(new Zl({indent:{size:0,type:De.DXA},cellMargin:{top:0,left:108,bottom:0,right:108}}))}},wr=e=>typeof e=="object"?Object.keys(e)[0]:void 0,tc=e=>{var t;return(t=[e["w:style"]].flat().find(n=>n._attr))===null||t===void 0?void 0:t._attr},Ju=e=>{var t;return(t=tc(e))===null||t===void 0?void 0:t["w:styleId"]},Qu=e=>{var t;let n=(t=[e["w:style"]].flat().find(r=>wr(r)==="w:name"))===null||t===void 0||(t=t["w:name"])===null||t===void 0||(t=t._attr)===null||t===void 0?void 0:t["w:val"];return n===void 0?void 0:String(n).toLowerCase()},wl=e=>{var t,n;return wr(e)==="w:style"&&((t=(n=tc(e))===null||n===void 0?void 0:n["w:type"])!==null&&t!==void 0?t:"paragraph")==="paragraph"},xS=e=>{let t=wl(e)?tc(e):void 0;return t?.["w:default"]!==void 0&&!["0","false","off"].includes(String(t["w:default"]))},kS=e=>({"w:style":[e["w:style"]].flat().map(t=>t._attr?{_attr:k(k({},t._attr),{},{"w:default":"1"})}:t)}),Xo=class extends I{constructor(e){if(super("w:styles"),e.initialStyles&&this.root.push(e.initialStyles),e.importedStyles)for(let t of e.importedStyles)this.root.push(t);if(e.paragraphStyles)for(let t of e.paragraphStyles)this.root.push(new gt(t));if(e.characterStyles)for(let t of e.characterStyles)this.root.push(new en(t))}prepForXml(e){let t=super.prepForXml(e),n=t["w:styles"];if(!Array.isArray(n))return t;let r=c=>n.filter(d=>wr(d)===c),i=n.map(c=>wr(c)==="w:style"?Ju(c):void 0),s=n.filter((c,d)=>!["_attr","w:docDefaults","w:latentStyles"].includes(wr(c))&&(i[d]===void 0||i.lastIndexOf(i[d])===d)),a=new Set(s.filter(c=>wl(c)&&!Yu(c)).map(Qu)),o=s.filter(c=>!Yu(c)||!a.has(Qu(c))),l=o.some(xS)?o:o.map(c=>wl(c)&&Ju(c)==="Normal"?kS(c):c);return{"w:styles":[...r("_attr"),...r("w:docDefaults").slice(-1),...r("w:latentStyles").slice(-1),...l]}}},TS=class extends I{constructor(e){super("w:pPrDefault"),this.root.push(new Sn(e,{implicitListParagraphStyle:!1,inListOrder:!1}))}},SS=class extends I{constructor(e){super("w:rPrDefault"),this.root.push(new Zt(e))}},ES=class extends I{constructor(e){super("w:docDefaults"),S(this,"runPropertiesDefaults",void 0),S(this,"paragraphPropertiesDefaults",void 0),this.runPropertiesDefaults=new SS(e.run),this.paragraphPropertiesDefaults=new TS(e.paragraph),this.root.push(this.runPropertiesDefaults),this.root.push(this.paragraphPropertiesDefaults)}},CS=class{newInstance(e){let t=Pr(e),n;for(let i of t.elements||[])i.name==="w:styles"&&(n=i);if(n===void 0)throw new Error("can not find styles element");let r=n.elements||[];return{initialStyles:new Cy(n.attributes),importedStyles:r.map(i=>Bl(i))}}},_S=e=>{var t;let n=(t=e.document)===null||t===void 0||(t=t.run)===null||t===void 0?void 0:t.size;return n===void 0?200:Math.round(typeof n=="number"?n*10:Ot(n))},AS=e=>({tableOfContents1:new ut(1,e),tableOfContents2:new ut(2,e),tableOfContents3:new ut(3,e),tableOfContents4:new ut(4,e),tableOfContents5:new ut(5,e),tableOfContents6:new ut(6,e),tableOfContents7:new ut(7,e),tableOfContents8:new ut(8,e),tableOfContents9:new ut(9,e)}),nc=(e={})=>{var t;return k(k({normal:new gt({id:"Normal",name:"Normal",quickFormat:!0}),normalTable:new yS,document:new ES((t=e.document)!==null&&t!==void 0?t:{}),title:new oS(k({run:{size:56}},e.title)),heading1:new lS(k({run:{color:"2E74B5",size:32}},e.heading1)),heading2:new cS(k({run:{color:"2E74B5",size:26}},e.heading2)),heading3:new dS(k({run:{color:"1F4D78",size:24}},e.heading3)),heading4:new pS(k({run:{color:"2E74B5",italics:!0}},e.heading4)),heading5:new uS(k({run:{color:"2E74B5"}},e.heading5)),heading6:new hS(k({run:{color:"1F4D78"}},e.heading6)),strong:new fS(k({run:{bold:!0}},e.strong)),listParagraph:new mS(e.listParagraph||{}),caption:new gS(e.caption||{}),bibliography:new bS(e.bibliography||{})},AS(_S(e))),{},{hyperlink:new vS(e.hyperlink||{}),footnoteReference:new Qf(e.footnoteReference||{}),footnoteText:new Jf(e.footnoteText||{}),footnoteTextChar:new Zf(e.footnoteTextChar||{}),endnoteReference:new tm(e.endnoteReference||{}),endnoteText:new em(e.endnoteText||{}),endnoteTextChar:new nm(e.endnoteTextChar||{}),lineNumber:new wS(e.lineNumber||{})})},Zu=class{newInstance(e={}){return{initialStyles:new Ds(["mc","r","w","w14","w15"],"w14 w15"),importedStyles:Object.values(nc(e))}}},rm={headings:{latin:"Calibri Light",panose:"020F0302020204030204"},body:{latin:"Calibri",panose:"020F0502020204030204"}},NS=[["Jpan","\u6E38\u30B4\u30B7\u30C3\u30AF Light","\u6E38\u660E\u671D"],["Hang","\uB9D1\uC740 \uACE0\uB515"],["Hans","\u7B49\u7EBF Light","\u7B49\u7EBF"],["Hant","\u65B0\u7D30\u660E\u9AD4"],["Arab","Times New Roman","Arial"],["Hebr","Times New Roman","Arial"],["Thai","Angsana New","Cordia New"],["Ethi","Nyala"],["Beng","Vrinda"],["Gujr","Shruti"],["Khmr","MoolBoran","DaunPenh"],["Knda","Tunga"],["Guru","Raavi"],["Cans","Euphemia"],["Cher","Plantagenet Cherokee"],["Yiii","Microsoft Yi Baiti"],["Tibt","Microsoft Himalaya"],["Thaa","MV Boli"],["Deva","Mangal"],["Telu","Gautami"],["Taml","Latha"],["Syrc","Estrangelo Edessa"],["Orya","Kalinga"],["Mlym","Kartika"],["Laoo","DokChampa"],["Sinh","Iskoola Pota"],["Mong","Mongolian Baiti"],["Viet","Times New Roman","Arial"],["Uigh","Microsoft Uighur"],["Geor","Sylfaen"],["Armn","Arial"],["Bugi","Leelawadee UI"],["Bopo","Microsoft JhengHei"],["Java","Javanese Text"],["Lisu","Segoe UI"],["Mymr","Myanmar Text"],["Nkoo","Ebrima"],["Olck","Nirmala UI"],["Osma","Ebrima"],["Phag","Phagspa"],["Syrn","Estrangelo Edessa"],["Syrj","Estrangelo Edessa"],["Syre","Estrangelo Edessa"],["Sora","Nirmala UI"],["Tale","Microsoft Tai Le"],["Talu","Microsoft New Tai Lue"],["Tfng","Ebrima"]],Yo=(e,t,n)=>new O({name:e,attributes:{typeface:{key:"typeface",value:t},panose:{key:"panose",value:n}}}),IS=(e,t)=>{let n=t[e],r=typeof n=="string"?n:n?.latin;return r??rm[e].latin},PS=(e,t={})=>{let n=NS.map(([i,s,a=s])=>{var o;return[i,(o=t[i])!==null&&o!==void 0?o:e==="headings"?s:a]}),r=new Set(n.map(([i])=>i));return[...n,...Object.entries(t).filter(([i])=>!r.has(i))]},eh=(e,t)=>{let n=t[e],{eastAsia:r="",complexScript:i="",scripts:s}=typeof n=="object"?n:{},a=IS(e,t),o=rm[e];return new O({name:e==="headings"?"a:majorFont":"a:minorFont",children:[Yo("a:latin",a,a===o.latin?o.panose:void 0),Yo("a:ea",r),Yo("a:cs",i),...PS(e,s).map(([l,c])=>new O({name:"a:font",attributes:{script:{key:"script",value:l},typeface:{key:"typeface",value:c}}}))]})},OS=(e,t={})=>new O({name:"a:fontScheme",attributes:{name:{key:"name",value:e}},children:[eh("headings",t),eh("body",t)]}),im=(e=[])=>new O({name:"a:schemeClr",attributes:{value:{key:"val",value:"phClr"}},children:e.map(([t,n])=>new O({name:`a:${t}`,attributes:{value:{key:"val",value:n}}}))}),gs=e=>new O({name:"a:solidFill",children:[im(e)]}),Jo=e=>new O({name:"a:gradFill",attributes:{rotateWithShape:{key:"rotWithShape",value:!0}},children:[new O({name:"a:gsLst",children:e.map((t,n)=>new O({name:"a:gs",attributes:{position:{key:"pos",value:n*5e4}},children:[im(t)]}))}),new O({name:"a:lin",attributes:{angle:{key:"ang",value:54e5},scaled:{key:"scaled",value:!1}}})]}),Qo=e=>new O({name:"a:ln",attributes:{width:{key:"w",value:e},cap:{key:"cap",value:"flat"},compound:{key:"cmpd",value:"sng"},alignment:{key:"algn",value:"ctr"}},children:[gs(),new O({name:"a:prstDash",attributes:{value:{key:"val",value:"solid"}}}),new O({name:"a:miter",attributes:{limit:{key:"lim",value:8e5}}})]}),Zo=e=>new O({name:"a:effectStyle",children:[new O({name:"a:effectLst",children:e})]}),LS=()=>new O({name:"a:outerShdw",attributes:{blurRadius:{key:"blurRad",value:57150},distance:{key:"dist",value:19050},direction:{key:"dir",value:54e5},alignment:{key:"algn",value:"ctr"},rotateWithShape:{key:"rotWithShape",value:!1}},children:[new O({name:"a:srgbClr",attributes:{value:{key:"val",value:"000000"}},children:[new O({name:"a:alpha",attributes:{value:{key:"val",value:63e3}}})]})]}),RS=()=>new O({name:"a:fmtScheme",attributes:{name:{key:"name",value:"Office"}},children:[new O({name:"a:fillStyleLst",children:[gs(),Jo([[["lumMod",11e4],["satMod",105e3],["tint",67e3]],[["lumMod",105e3],["satMod",103e3],["tint",73e3]],[["lumMod",105e3],["satMod",109e3],["tint",81e3]]]),Jo([[["satMod",103e3],["lumMod",102e3],["tint",94e3]],[["satMod",11e4],["lumMod",1e5],["shade",1e5]],[["lumMod",99e3],["satMod",12e4],["shade",78e3]]])]}),new O({name:"a:lnStyleLst",children:[Qo(6350),Qo(12700),Qo(19050)]}),new O({name:"a:effectStyleLst",children:[Zo([]),Zo([]),Zo([LS()])]}),new O({name:"a:bgFillStyleLst",children:[gs(),gs([["tint",95e3],["satMod",17e4]]),Jo([[["tint",93e3],["satMod",15e4],["shade",98e3],["lumMod",102e3]],[["tint",98e3],["satMod",13e4],["shade",9e4],["lumMod",103e3]],[["shade",63e3],["satMod",12e4]]])]})]}),MS=class extends I{constructor({name:e="Office Theme",colors:t,fonts:n}={}){super("a:theme"),S(this,"colors",void 0),this.colors=Hl(t),this.root.push(new Nh({namespace:{key:"xmlns:a",value:"http://schemas.openxmlformats.org/drawingml/2006/main"},name:{key:"name",value:e}})),this.root.push(new O({name:"a:themeElements",children:[My(t?e:"Office",t),OS(n?e:"Office",n),RS()]})),this.root.push(new O({name:"a:objectDefaults"})),this.root.push(new O({name:"a:extraClrSchemeLst"}))}get Colors(){return this.colors}},Ge=e=>{let t=e.lastIndexOf("/");return`${e.slice(0,t+1)}_rels/${e.slice(t+1)}.rels`},sm=e=>e.replace(/(^|\/)_rels\/([^/]*)\.rels$/,"$1$2"),am=e=>e.slice(0,e.lastIndexOf("/")+1),tn=(e,t)=>{let n=t.replace(/\\/g,"/");return(n.startsWith("/")?n:`${am(e)}${n}`).split("/").reduce((r,i)=>i===""||i==="."?r:i===".."?r.slice(0,-1):[...r,i],[]).join("/")},rc=(e,t)=>{let n=am(e).split("/").filter(Boolean),r=t.split("/"),i=n.findIndex((a,o)=>o>=r.length-1||r[o]!==a),s=i===-1?n.length:i;return[...n.slice(s).map(()=>".."),...r.slice(s)].join("/")},DS=(e,t)=>e.toLowerCase()===t.toLowerCase(),ae=Uint8Array,Oe=Uint16Array,ic=Int32Array,Bs=new ae([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),$s=new ae([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),yl=new ae([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),om=function(e,t){for(var n=new Oe(31),r=0;r<31;++r)n[r]=t+=1<<e[r-1];for(var i=new ic(n[30]),r=1;r<30;++r)for(var s=n[r];s<n[r+1];++s)i[s]=s-n[r]<<5|r;return{b:n,r:i}},lm=om(Bs,2),cm=lm.b,xl=lm.r;cm[28]=258,xl[258]=28;dm=om($s,0),BS=dm.b,th=dm.r,kl=new Oe(32768);for(K=0;K<32768;++K)ht=(K&43690)>>1|(K&21845)<<1,ht=(ht&52428)>>2|(ht&13107)<<2,ht=(ht&61680)>>4|(ht&3855)<<4,kl[K]=((ht&65280)>>8|(ht&255)<<8)>>1;tt=(function(e,t,n){for(var r=e.length,i=0,s=new Oe(t);i<r;++i)e[i]&&++s[e[i]-1];var a=new Oe(t);for(i=1;i<t;++i)a[i]=a[i-1]+s[i-1]<<1;var o;if(n){o=new Oe(1<<t);var l=15-t;for(i=0;i<r;++i)if(e[i])for(var c=i<<4|e[i],d=t-e[i],p=a[e[i]-1]++<<d,u=p|(1<<d)-1;p<=u;++p)o[kl[p]>>l]=c}else for(o=new Oe(r),i=0;i<r;++i)e[i]&&(o[i]=kl[a[e[i]-1]++]>>15-e[i]);return o}),Mt=new ae(288);for(K=0;K<144;++K)Mt[K]=8;for(K=144;K<256;++K)Mt[K]=9;for(K=256;K<280;++K)Mt[K]=7;for(K=280;K<288;++K)Mt[K]=8;_r=new ae(32);for(K=0;K<32;++K)_r[K]=5;$S=tt(Mt,9,0),FS=tt(Mt,9,1),HS=tt(_r,5,0),US=tt(_r,5,1),el=function(e){for(var t=e[0],n=1;n<e.length;++n)e[n]>t&&(t=e[n]);return t},je=function(e,t,n){var r=t/8|0;return(e[r]|e[r+1]<<8)>>(t&7)&n},tl=function(e,t){var n=t/8|0;return(e[n]|e[n+1]<<8|e[n+2]<<16)>>(t&7)},sc=function(e){return(e+7)/8|0},Mr=function(e,t,n){return(t==null||t<0)&&(t=0),(n==null||n>e.length)&&(n=e.length),new ae(e.subarray(t,n))},qS=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],Se=function(e,t,n){var r=new Error(t||qS[e]);if(r.code=e,Error.captureStackTrace&&Error.captureStackTrace(r,Se),!n)throw r;return r},WS=function(e,t,n,r){var i=e.length,s=r?r.length:0;if(!i||t.f&&!t.l)return n||new ae(0);var a=!n,o=a||t.i!=2,l=t.i;a&&(n=new ae(i*3));var c=function(se){var Y=n.length;if(se>Y){var Pe=new ae(Math.max(Y*2,se));Pe.set(n),n=Pe}},d=t.f||0,p=t.p||0,u=t.b||0,f=t.l,m=t.d,h=t.m,g=t.n,v=i*8;do{if(!f){d=je(e,p,1);var w=je(e,p+1,3);if(p+=3,w)if(w==1)f=FS,m=US,h=9,g=5;else if(w==2){var y=je(e,p,31)+257,T=je(e,p+10,15)+4,x=y+je(e,p+5,31)+1;p+=14;for(var _=new ae(x),N=new ae(19),M=0;M<T;++M)N[yl[M]]=je(e,p+M*3,7);p+=T*3;for(var D=el(N),V=(1<<D)-1,re=tt(N,D,1),M=0;M<x;){var ee=re[je(e,p,V)];p+=ee&15;var b=ee>>4;if(b<16)_[M++]=b;else{var te=0,X=0;for(b==16?(X=3+je(e,p,3),p+=2,te=_[M-1]):b==17?(X=3+je(e,p,7),p+=3):b==18&&(X=11+je(e,p,127),p+=7);X--;)_[M++]=te}}var fe=_.subarray(0,y),le=_.subarray(y);h=el(fe),g=el(le),f=tt(fe,h,1),m=tt(le,g,1)}else Se(1);else{var b=sc(p)+4,C=e[b-4]|e[b-3]<<8,A=b+C;if(A>i){l&&Se(0);break}o&&c(u+C),n.set(e.subarray(b,A),u),t.b=u+=C,t.p=p=A*8,t.f=d;continue}if(p>v){l&&Se(0);break}}o&&c(u+131072);for(var wt=(1<<h)-1,Ee=(1<<g)-1,Fe=p;;Fe=p){var te=f[tl(e,p)&wt],ve=te>>4;if(p+=te&15,p>v){l&&Se(0);break}if(te||Se(2),ve<256)n[u++]=ve;else if(ve==256){Fe=p,f=null;break}else{var we=ve-254;if(ve>264){var M=ve-257,Q=Bs[M];we=je(e,p,(1<<Q)-1)+cm[M],p+=Q}var R=m[tl(e,p)&Ee],$=R>>4;R||Se(3),p+=R&15;var le=BS[$];if($>3){var Q=$s[$];le+=tl(e,p)&(1<<Q)-1,p+=Q}if(p>v){l&&Se(0);break}o&&c(u+131072);var F=u+we;if(u<le){var Z=s-le,ie=Math.min(le,F);for(Z+u<0&&Se(3);u<ie;++u)n[u]=r[Z+u]}for(;u<F;++u)n[u]=n[u-le]}}t.l=f,t.p=Fe,t.b=u,t.f=d,f&&(d=1,t.m=h,t.d=m,t.n=g)}while(!d);return u!=n.length&&a?Mr(n,0,u):n.subarray(0,u)},ft=function(e,t,n){n<<=t&7;var r=t/8|0;e[r]|=n,e[r+1]|=n>>8},pr=function(e,t,n){n<<=t&7;var r=t/8|0;e[r]|=n,e[r+1]|=n>>8,e[r+2]|=n>>16},nl=function(e,t){for(var n=[],r=0;r<e.length;++r)e[r]&&n.push({s:r,f:e[r]});var i=n.length,s=n.slice();if(!i)return{t:um,l:0};if(i==1){var a=new ae(n[0].s+1);return a[n[0].s]=1,{t:a,l:1}}n.sort(function(A,y){return A.f-y.f}),n.push({s:-1,f:25001});var o=n[0],l=n[1],c=0,d=1,p=2;for(n[0]={s:-1,f:o.f+l.f,l:o,r:l};d!=i-1;)o=n[n[c].f<n[p].f?c++:p++],l=n[c!=d&&n[c].f<n[p].f?c++:p++],n[d++]={s:-1,f:o.f+l.f,l:o,r:l};for(var u=s[0].s,r=1;r<i;++r)s[r].s>u&&(u=s[r].s);var f=new Oe(u+1),m=Tl(n[d-1],f,0);if(m>t){var r=0,h=0,g=m-t,v=1<<g;for(s.sort(function(y,T){return f[T.s]-f[y.s]||y.f-T.f});r<i;++r){var w=s[r].s;if(f[w]>t)h+=v-(1<<m-f[w]),f[w]=t;else break}for(h>>=g;h>0;){var b=s[r].s;f[b]<t?h-=1<<t-f[b]++-1:++r}for(;r>=0&&h;--r){var C=s[r].s;f[C]==t&&(--f[C],++h)}m=t}return{t:new ae(f),l:m}},Tl=function(e,t,n){return e.s==-1?Math.max(Tl(e.l,t,n+1),Tl(e.r,t,n+1)):t[e.s]=n},nh=function(e){for(var t=e.length;t&&!e[--t];);for(var n=new Oe(++t),r=0,i=e[0],s=1,a=function(l){n[r++]=l},o=1;o<=t;++o)if(e[o]==i&&o!=t)++s;else{if(!i&&s>2){for(;s>138;s-=138)a(32754);s>2&&(a(s>10?s-11<<5|28690:s-3<<5|12305),s=0)}else if(s>3){for(a(i),--s;s>6;s-=6)a(8304);s>2&&(a(s-3<<5|8208),s=0)}for(;s--;)a(i);s=1,i=e[o]}return{c:n.subarray(0,r),n:t}},ur=function(e,t){for(var n=0,r=0;r<t.length;++r)n+=e[r]*t[r];return n},pm=function(e,t,n){var r=n.length,i=sc(t+2);e[i]=r&255,e[i+1]=r>>8,e[i+2]=e[i]^255,e[i+3]=e[i+1]^255;for(var s=0;s<r;++s)e[i+s+4]=n[s];return(i+4+r)*8},rh=function(e,t,n,r,i,s,a,o,l,c,d){ft(t,d++,n),++i[256];for(var p=nl(i,15),u=p.t,f=p.l,m=nl(s,15),h=m.t,g=m.l,v=nh(u),w=v.c,b=v.n,C=nh(h),A=C.c,y=C.n,T=new Oe(19),x=0;x<w.length;++x)++T[w[x]&31];for(var x=0;x<A.length;++x)++T[A[x]&31];for(var _=nl(T,7),N=_.t,M=_.l,D=19;D>4&&!N[yl[D-1]];--D);var V=c+5<<3,re=ur(i,Mt)+ur(s,_r)+a,ee=ur(i,u)+ur(s,h)+a+14+3*D+ur(T,N)+2*T[16]+3*T[17]+7*T[18];if(l>=0&&V<=re&&V<=ee)return pm(t,d,e.subarray(l,l+c));var te,X,fe,le;if(ft(t,d,1+(ee<re)),d+=2,ee<re){te=tt(u,f,0),X=u,fe=tt(h,g,0),le=h;var wt=tt(N,M,0);ft(t,d,b-257),ft(t,d+5,y-1),ft(t,d+10,D-4),d+=14;for(var x=0;x<D;++x)ft(t,d+3*x,N[yl[x]]);d+=3*D;for(var Ee=[w,A],Fe=0;Fe<2;++Fe)for(var ve=Ee[Fe],x=0;x<ve.length;++x){var we=ve[x]&31;ft(t,d,wt[we]),d+=N[we],we>15&&(ft(t,d,ve[x]>>5&127),d+=ve[x]>>12)}}else te=$S,X=Mt,fe=HS,le=_r;for(var x=0;x<o;++x){var Q=r[x];if(Q>255){var we=Q>>18&31;pr(t,d,te[we+257]),d+=X[we+257],we>7&&(ft(t,d,Q>>23&31),d+=Bs[we]);var R=Q&31;pr(t,d,fe[R]),d+=le[R],R>3&&(pr(t,d,Q>>5&8191),d+=$s[R])}else pr(t,d,te[Q]),d+=X[Q]}return pr(t,d,te[256]),d+X[256]},jS=new ic([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),um=new ae(0),KS=function(e,t,n,r,i,s){var a=s.z||e.length,o=new ae(r+a+5*(1+Math.ceil(a/7e3))+i),l=o.subarray(r,o.length-i),c=s.l,d=(s.r||0)&7;if(t){d&&(l[0]=s.r>>3);for(var p=jS[t-1],u=p>>13,f=p&8191,m=(1<<n)-1,h=s.p||new Oe(32768),g=s.h||new Oe(m+1),v=Math.ceil(n/3),w=2*v,b=function(Pe){return(e[Pe]^e[Pe+1]<<v^e[Pe+2]<<w)&m},C=new ic(25e3),A=new Oe(288),y=new Oe(32),T=0,x=0,_=s.i||0,N=0,M=s.w||0,D=0;_+2<a;++_){var V=b(_),re=_&32767,ee=g[V];if(h[re]=ee,g[V]=re,M<=_){var te=a-_;if((T>7e3||N>24576)&&(te>423||!c)){d=rh(e,l,0,C,A,y,x,N,D,_-D,d),N=T=x=0,D=_;for(var X=0;X<286;++X)A[X]=0;for(var X=0;X<30;++X)y[X]=0}var fe=2,le=0,wt=f,Ee=re-ee&32767;if(te>2&&V==b(_-Ee))for(var Fe=Math.min(u,te)-1,ve=Math.min(32767,_),we=Math.min(258,te);Ee<=ve&&--wt&&re!=ee;){if(e[_+fe]==e[_+fe-Ee]){for(var Q=0;Q<we&&e[_+Q]==e[_+Q-Ee];++Q);if(Q>fe){if(fe=Q,le=Ee,Q>Fe)break;for(var R=Math.min(Ee,Q-2),$=0,X=0;X<R;++X){var F=_-Ee+X&32767,Z=F-h[F]&32767;Z>$&&($=Z,ee=F)}}}re=ee,ee=h[re],Ee+=re-ee&32767}if(le){C[N++]=268435456|xl[fe]<<18|th[le];var ie=xl[fe]&31,se=th[le]&31;x+=Bs[ie]+$s[se],++A[257+ie],++y[se],M=_+fe,++T}else C[N++]=e[_],++A[e[_]]}}for(_=Math.max(_,M);_<a;++_)C[N++]=e[_],++A[e[_]];d=rh(e,l,c,C,A,y,x,N,D,_-D,d),c||(s.r=d&7|l[d/8|0]<<3,d-=7,s.h=g,s.p=h,s.i=_,s.w=M)}else{for(var _=s.w||0;_<a+c;_+=65535){var Y=_+65535;Y>=a&&(l[d/8|0]=c,Y=a),d=pm(l,d+1,e.subarray(_,Y))}s.i=a}return Mr(o,0,r+sc(d)+i)},GS=(function(){for(var e=new Int32Array(256),t=0;t<256;++t){for(var n=t,r=9;--r;)n=(n&1&&-306674912)^n>>>1;e[t]=n}return e})(),zS=function(){var e=-1;return{p:function(t){for(var n=e,r=0;r<t.length;++r)n=GS[n&255^t[r]]^n>>>8;e=n},d:function(){return~e}}},VS=function(e,t,n,r,i){if(!i&&(i={l:1},t.dictionary)){var s=t.dictionary.subarray(-32768),a=new ae(s.length+e.length);a.set(s),a.set(e,s.length),e=a,i.w=s.length}return KS(e,t.level==null?6:t.level,t.mem==null?i.l?Math.ceil(Math.max(8,Math.min(13,Math.log(e.length)))*1.5):20:12+t.mem,n,r,i)},hm=function(e,t){var n={};for(var r in e)n[r]=e[r];for(var r in t)n[r]=t[r];return n},Qe=function(e,t){return e[t]|e[t+1]<<8},Re=function(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0},rl=function(e,t){return Re(e,t)+Re(e,t+4)*4294967296},xe=function(e,t,n){for(;n;++t)e[t]=n,n>>>=8};fm=function(e,t,n,r){for(var i in e){var s=e[i],a=t+i,o=r;Array.isArray(s)&&(o=hm(r,s[1]),s=s[0]),ArrayBuffer.isView(s)?n[a]=[s,o]:(n[a+="/"]=[new ae(0),o],fm(s,a,n,r))}},ih=typeof TextEncoder<"u"&&new TextEncoder,Sl=typeof TextDecoder<"u"&&new TextDecoder;try{Sl.decode(um,{stream:!0})}catch{}JS=function(e){for(var t="",n=0;;){var r=e[n++],i=(r>127)+(r>223)+(r>239);if(n+i>e.length)return{s:t,r:Mr(e,n-1)};i?i==3?(r=((r&15)<<18|(e[n++]&63)<<12|(e[n++]&63)<<6|e[n++]&63)-65536,t+=String.fromCharCode(55296|r>>10,56320|r&1023)):i&1?t+=String.fromCharCode((r&31)<<6|e[n++]&63):t+=String.fromCharCode((r&15)<<12|(e[n++]&63)<<6|e[n++]&63):t+=String.fromCharCode(r)}};ZS=function(e,t){return t+30+Qe(e,t+26)+Qe(e,t+28)},e2=function(e,t,n){var r=Qe(e,t+28),i=Qe(e,t+30),s=QS(e.subarray(t+46,t+46+r),!(Qe(e,t+8)&2048)),a=t+46+r,o=t2(e,a,i,n,Re(e,t+20),Re(e,t+24),Re(e,t+42)),l=o[0],c=o[1],d=o[2];return[Qe(e,t+10),l,c,s,a+i+Qe(e,t+32),d]},t2=function(e,t,n,r,i,s,a){var o=i==4294967295,l=s==4294967295,c=a==4294967295,d=t+n,p=o+l+c;if(r&&p){for(;t+4<d;t+=4+Qe(e,t+2))if(Qe(e,t)==1)return[o?rl(e,t+4+8*l):i,l?rl(e,t+4):s,c?rl(e,t+4+8*(l+o)):a,1];r<2&&Se(13)}return[i,s,a,0]},El=function(e){var t=0;if(e)for(var n in e){var r=e[n].length;r>65535&&Se(9),t+=r+4}return t},ah=function(e,t,n,r,i,s,a,o){var l=r.length,c=n.extra,d=o&&o.length,p=El(c);xe(e,t,a!=null?33639248:67324752),t+=4,a!=null&&(e[t++]=20,e[t++]=n.os),e[t]=20,t+=2,e[t++]=n.flag<<1|(s<0&&8),e[t++]=i&&8,e[t++]=n.compression&255,e[t++]=n.compression>>8;var u=new Date(n.mtime==null?Date.now():n.mtime),f=u.getFullYear()-1980;if((f<0||f>119)&&Se(10),xe(e,t,f<<25|u.getMonth()+1<<21|u.getDate()<<16|u.getHours()<<11|u.getMinutes()<<5|u.getSeconds()>>1),t+=4,s!=-1&&(xe(e,t,n.crc),xe(e,t+4,s<0?-s-2:s),xe(e,t+8,n.size)),xe(e,t+12,l),xe(e,t+14,p),t+=16,a!=null&&(xe(e,t,d),xe(e,t+6,n.attrs),xe(e,t+10,a),t+=14),e.set(r,t),t+=l,p)for(var m in c){var h=c[m],g=h.length;xe(e,t,+m),xe(e,t+2,g),e.set(h,t+4),t+=4+g}return d&&(e.set(o,t),t+=d),t},n2=function(e,t,n,r,i){xe(e,t,101010256),xe(e,t+8,n),xe(e,t+10,n),xe(e,t+12,r),xe(e,t+16,i)};s2=e=>typeof e=="string"?xx(e):ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):new Uint8Array(e),Ss=e=>r2(Object.fromEntries([...e].map(([t,n])=>[t,s2(n)]))),a2=1032,oh=e=>new Error(`Corrupted zip: ${e} isn't the size the zip file gives it`),mm=(e,t=()=>!0)=>{let n=new Map,r=0,i=i2(e,{filter:({name:a,size:o,originalSize:l})=>{if(a.endsWith("/")||!t(a))return!1;if(r+=o,r>e.length||l>o*a2)throw oh(a);return n.set(a,l),!0}}),s=Object.entries(i).find(([a,o])=>o.length!==n.get(a));if(s!==void 0)throw oh(s[0]);return new Map(Object.entries(i))},il=e=>{let t="";for(let n=0;n<e.length;n+=32768)t+=String.fromCharCode(...e.subarray(n,n+32768));return t},bs=e=>new Error(`${e} is not supported by this platform`),lh={uint8array:e=>e,arraybuffer:e=>e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength),array:e=>Array.from(e),string:il,binarystring:il,base64:e=>btoa(il(e)),blob:(e,t)=>{if(typeof Blob>"u")throw bs("blob");return new Blob([e],{type:t})},nodebuffer:e=>{if(typeof Buffer>"u")throw bs("nodebuffer");return Buffer.from(e.buffer,e.byteOffset,e.byteLength)},text:()=>{throw bs("text")}},Cl=(e,t,n)=>{let r=Object.prototype.hasOwnProperty.call(lh,t.toLowerCase())?lh[t.toLowerCase()]:void 0;if(r===void 0)throw bs(t);return r(e,n)},o2=new Map([["dk1","dark1"],["lt1","light1"],["dk2","dark2"],["lt2","light2"],["accent1","accent1"],["accent2","accent2"],["accent3","accent3"],["accent4","accent4"],["accent5","accent5"],["accent6","accent6"],["hlink","hyperlink"],["folHlink","followedHyperlink"]]),l2=new Map([["dark1","windowText"],["light1","window"]]),c2=new Set(["http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme","http://purl.oclc.org/ooxml/officeDocument/relationships/theme"]),Ar=e=>{var t,n;return(t=e==null||(n=e.name)===null||n===void 0?void 0:n.slice(e.name.indexOf(":")+1))!==null&&t!==void 0?t:""},Dr=e=>{var t,n;return(t=e==null||(n=e.elements)===null||n===void 0?void 0:n.filter(r=>r.type==="element"))!==null&&t!==void 0?t:[]},_l=(e,t)=>Dr(e).find(n=>Ar(n)===t),yr=(e,t)=>{var n;let r=e==null||(n=e.attributes)===null||n===void 0?void 0:n[t];return r===void 0?void 0:String(r)},d2=e=>new TextDecoder(e[0]===255&&e[1]===254?"utf-16le":e[0]===254&&e[1]===255?"utf-16be":"utf-8").decode(e),p2=(e,t,n)=>{let r=e.get(Ge(t)),i=yr(r&&Dr(_l(Pr(d2(r)),"Relationships")).find(s=>{var a;return n.has((a=yr(s,"Type"))!==null&&a!==void 0?a:"")}),"Target");return i===void 0?void 0:tn(t,i)},u2=(e,t)=>p2(e,t,c2),h2=(e,t,n)=>{let[r]=Dr(t),i=Ar(r)==="srgbClr"?yr(r,"val"):Ar(r)==="sysClr"&&(n||yr(r,"val")!==l2.get(e))?yr(r,"lastClr"):void 0;return i!==void 0&&/^[0-9A-Fa-f]{6}$/.test(i)?i.toUpperCase():void 0},f2=(e,t=!1)=>Object.fromEntries(Dr(e).flatMap(n=>{let r=o2.get(Ar(n)),i=r&&h2(r,n,t);return r&&i?[[r,i]]:[]})),m2=e=>{let[t]=Dr(Pr(e)),n=Ar(t)==="theme"?_l(_l(t,"themeElements"),"clrScheme"):void 0;return n?f2(n,!0):{}},g2=[208,207,17,224,161,177,26,225],gm=class{constructor(e){var t,n,r,i,s,a,o,l,c,d,p,u,f,m;if(S(this,"currentRelationshipId",1),S(this,"documentWrapper",void 0),S(this,"headers",[]),S(this,"footers",[]),S(this,"coreProperties",void 0),S(this,"numbering",void 0),S(this,"media",void 0),S(this,"fileRelationships",void 0),S(this,"footnotesWrapper",void 0),S(this,"endnotesWrapper",void 0),S(this,"settings",void 0),S(this,"contentTypes",void 0),S(this,"customProperties",void 0),S(this,"appProperties",void 0),S(this,"styles",void 0),S(this,"comments",void 0),S(this,"commentsExtended",void 0),S(this,"commentsIds",void 0),S(this,"fontWrapper",void 0),S(this,"theme",void 0),S(this,"packageParts",void 0),S(this,"macros",void 0),S(this,"bibliography",void 0),e.macros!==void 0){let{project:b,events:C=[]}=e.macros,A=b instanceof Uint8Array?b:new Uint8Array(b);if(!g2.every((T,x)=>A[x]===T))throw new Error("macros.project isn't a VBA project. Use createMacros from docx/macros, or the word/vbaProject.bin in a .docm rather than the .docm itself");let y=new ge;C.length>0&&y.addRelationship(1,"http://schemas.microsoft.com/office/2006/relationships/wordVbaData","vbaData.xml"),this.macros={project:A,events:C.length>0?pT(C):void 0,relationships:y}}if(this.coreProperties=new nT(k(k({},e),{},{creator:(t=e.creator)!==null&&t!==void 0?t:"Un-named",revision:(n=e.revision)!==null&&n!==void 0?n:1,lastModifiedBy:(r=e.lastModifiedBy)!==null&&r!==void 0?r:"Un-named"})),this.numbering=new zf(e.numbering?e.numbering:{config:[]}),this.comments=new S1((i=e.comments)!==null&&i!==void 0?i:{children:[]}),this.comments.ThreadData&&(this.commentsExtended=new A1(this.comments.ThreadData)),this.comments.CommentIdsData&&(this.commentsIds=new O1(this.comments.CommentIdsData)),this.fileRelationships=new ge,this.customProperties=new lT((s=e.customProperties)!==null&&s!==void 0?s:[]),this.appProperties=new Zk,this.footnotesWrapper=new CT,this.endnotesWrapper=new wT,this.contentTypes=new tT({macros:this.macros!==void 0}),((a=this.macros)===null||a===void 0?void 0:a.events)!==void 0&&this.contentTypes.addOverride("application/vnd.ms-word.vbaData+xml","/word/vbaData.xml"),e.bibliography!==void 0){let b=new ge;b.addRelationship(1,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/customXmlProps","itemProps1.xml"),this.bibliography={sources:e.bibliography.sources,properties:cT(`{${Xh().toUpperCase()}}`),relationships:b},this.contentTypes.addOverride("application/vnd.openxmlformats-officedocument.customXmlProperties+xml","/customXml/itemProps1.xml")}if(this.packageParts=new Vf(this.contentTypes),this.documentWrapper=new fT({background:e.background,pageNumbers:e.pageNumbers}),this.settings=new rS({compatibilityModeVersion:e.compatabilityModeVersion,compatibility:e.compatibility,evenAndOddHeaders:!!e.evenAndOddHeaderAndFooters,trackRevisions:(o=e.features)===null||o===void 0?void 0:o.trackRevisions,updateFields:(l=e.features)===null||l===void 0?void 0:l.updateFields,embedFonts:!((c=e.fonts)===null||c===void 0)&&c.length?!0:void 0,defaultTabStop:e.defaultTabStop,protection:e.protection,hyphenation:{autoHyphenation:(d=e.hyphenation)===null||d===void 0?void 0:d.autoHyphenation,hyphenationZone:(p=e.hyphenation)===null||p===void 0?void 0:p.hyphenationZone,consecutiveHyphenLimit:(u=e.hyphenation)===null||u===void 0?void 0:u.consecutiveHyphenLimit,doNotHyphenateCaps:(f=e.hyphenation)===null||f===void 0?void 0:f.doNotHyphenateCaps}}),this.media=new Gf(b=>this.packageParts.takePath("media","image",b)),e.externalStyles!==void 0){var h,g,v,w;let b=(h=(g=e.styles)===null||g===void 0?void 0:g.default)!==null&&h!==void 0?h:{},C=Object.entries(nc(b)),A=([T])=>b[T]!==void 0,y=new CS().newInstance(e.externalStyles);this.styles=new Xo(k(k({},y),{},{paragraphStyles:(v=e.styles)===null||v===void 0?void 0:v.paragraphStyles,characterStyles:(w=e.styles)===null||w===void 0?void 0:w.characterStyles,importedStyles:[...C.filter(T=>!A(T)).map(([,T])=>T),...y.importedStyles,...C.filter(A).map(([,T])=>T)]}))}else if(e.styles){let b=new Zu().newInstance(e.styles.default);this.styles=new Xo(k(k({},b),e.styles))}else{let b=new Zu;this.styles=new Xo(b.newInstance())}this.addDefaultRelationships();for(let b of e.sections)this.addSection(b);if(e.footnotes)for(let b in e.footnotes)this.footnotesWrapper.View.createFootNote(parseFloat(b),e.footnotes[b].children);if(e.endnotes)for(let b in e.endnotes)this.endnotesWrapper.View.createEndnote(parseFloat(b),e.endnotes[b].children);this.fontWrapper=new Sf((m=e.fonts)!==null&&m!==void 0?m:[]),this.theme=new MS(e.theme),this.documentWrapper.Relationships.addRelationship(this.currentRelationshipId++,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme","theme/theme1.xml"),this.macros!==void 0&&this.documentWrapper.Relationships.addRelationship(this.currentRelationshipId++,"http://schemas.microsoft.com/office/2006/relationships/vbaProject","vbaProject.bin"),this.bibliography!==void 0&&this.documentWrapper.Relationships.addRelationship(this.currentRelationshipId++,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/customXml","../customXml/item1.xml")}addSection({headers:e={},footers:t={},children:n,properties:r}){this.documentWrapper.View.Body.addSection(k(k({},r),{},{headerWrapperGroup:{default:e.default?this.createHeader(e.default):void 0,first:e.first?this.createHeader(e.first):void 0,even:e.even?this.createHeader(e.even):void 0},footerWrapperGroup:{default:t.default?this.createFooter(t.default):void 0,first:t.first?this.createFooter(t.first):void 0,even:t.even?this.createFooter(t.even):void 0}}));for(let i of n)this.documentWrapper.View.add(i)}createHeader(e){let t=new NT(this.media,this.currentRelationshipId++);for(let n of e.options.children)t.add(n);return this.addHeaderToDocument(t),t}createFooter(e){let t=new kT(this.media,this.currentRelationshipId++);for(let n of e.options.children)t.add(n);return this.addFooterToDocument(t),t}addHeaderToDocument(e,t=kn.DEFAULT){this.headers.push({header:e,type:t}),this.documentWrapper.Relationships.addRelationship(e.View.ReferenceId,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/header",`header${this.headers.length}.xml`),this.contentTypes.addHeader(this.headers.length)}addFooterToDocument(e,t=kn.DEFAULT){this.footers.push({footer:e,type:t}),this.documentWrapper.Relationships.addRelationship(e.View.ReferenceId,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/footer",`footer${this.footers.length}.xml`),this.contentTypes.addFooter(this.footers.length)}addDefaultRelationships(){this.fileRelationships.addRelationship(1,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument","word/document.xml"),this.fileRelationships.addRelationship(2,"http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties","docProps/core.xml"),this.fileRelationships.addRelationship(3,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties","docProps/app.xml"),this.fileRelationships.addRelationship(4,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/custom-properties","docProps/custom.xml"),this.documentWrapper.Relationships.addRelationship(this.currentRelationshipId++,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles","styles.xml"),this.documentWrapper.Relationships.addRelationship(this.currentRelationshipId++,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/numbering","numbering.xml"),this.documentWrapper.Relationships.addRelationship(this.currentRelationshipId++,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/footnotes","footnotes.xml"),this.documentWrapper.Relationships.addRelationship(this.currentRelationshipId++,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/endnotes","endnotes.xml"),this.documentWrapper.Relationships.addRelationship(this.currentRelationshipId++,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/settings","settings.xml"),this.comments.IsEmpty||(this.documentWrapper.Relationships.addRelationship(this.currentRelationshipId++,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments","comments.xml"),this.contentTypes.addComments()),this.commentsExtended&&(this.documentWrapper.Relationships.addRelationship(this.currentRelationshipId++,"http://schemas.microsoft.com/office/2011/relationships/commentsExtended","commentsExtended.xml"),this.contentTypes.addCommentsExtended()),this.commentsIds&&(this.documentWrapper.Relationships.addRelationship(this.currentRelationshipId++,"http://schemas.microsoft.com/office/2016/09/relationships/commentsIds","commentsIds.xml"),this.contentTypes.addCommentsIds())}get Document(){return this.documentWrapper}get Styles(){return this.styles}get CoreProperties(){return this.coreProperties}get Numbering(){return this.numbering}get Media(){return this.media}get FileRelationships(){return this.fileRelationships}get Headers(){return this.headers.map(e=>e.header)}get Footers(){return this.footers.map(e=>e.footer)}get ContentTypes(){return this.contentTypes}get CustomProperties(){return this.customProperties}get AppProperties(){return this.appProperties}get FootNotes(){return this.footnotesWrapper}get Endnotes(){return this.endnotesWrapper}get Settings(){return this.settings}get Comments(){return this.comments}get CommentsExtended(){return this.commentsExtended}get CommentsIds(){return this.commentsIds}get FontTable(){return this.fontWrapper}get Theme(){return this.theme}get PackageParts(){return this.packageParts}get Macros(){return this.macros}get Bibliography(){return this.bibliography}},b2=class extends I{constructor(e){super("w:sdtPr"),e&&this.root.push(new et("w:alias",e))}},v2=e=>new O({name:"w:docPartObj",children:[new et("w:docPartGallery",e),new O({name:"w:docPartUnique"})]}),w2=["contentChildren","cachedEntries","beginDirty","tabLeader"],bm=class extends Yl{constructor(e="Table of Contents",t={}){let{contentChildren:n=[],cachedEntries:r=[],beginDirty:i,tabLeader:s=$1.DOT}=t,a=Dl(t,w2);super("w:sdt"),S(this,"fromHeadings",void 0);let o=new b2(e);o.addChildElement(v2("Table of Contents")),this.root.push(o);let l=new of,c=[new Be({children:[lf(i),new af(a),Jt()]})],d=[new Be({children:[Qt()]})];if(r!==void 0&&r.length>0){let{stylesWithLevels:p}=a,u=r.map((m,h)=>{var g,v;let w=this.buildCachedContentParagraphChild(m,a),b=(g=p==null||(v=p.find(A=>A.level===m.level))===null||v===void 0?void 0:v.styleName)!==null&&g!==void 0?g:`TOC${m.level}`,C=h===0?[...c,w]:h===r.length-1?[w,...d]:[w];return new J({style:b,tabStops:this.getTabStopsForLevel(m.level,s),children:C})}),f=u;r.length<=1&&(f=[...u,new J({children:d})]);for(let m of f)l.addChildElement(m)}else{let p=new J({children:c});l.addChildElement(p);for(let f of n)l.addChildElement(f);let u=new J({children:d});l.addChildElement(u),n.length===0&&(this.fromHeadings={properties:a,beginDirty:i,tabLeader:s})}this.root.push(l)}prepForXml(e){let t=super.prepForXml(e);return Yx(t,this.fromHeadings&&k(k({},this.fromHeadings),{},{textWidth:this.textWidthIn(e)})),t}textWidthIn(e){var t,n;return(t=(n=e.file)===null||n===void 0||(n=n.Document)===null||n===void 0||(n=n.View.Body.getSectionPropertiesFor(this))===null||n===void 0?void 0:n.AvailableTextWidth)!==null&&t!==void 0?t:fs}getTabStopsForLevel(e,t,n=9025){return[{type:"clear",position:n+1-(e-1)*240},{type:"right",position:n,leader:t}]}buildCachedContentRun(e,t){var n,r;return new Be({style:t?.hyperlink&&e.href!==void 0?"IndexLink":void 0,children:[new Tr({text:e.title}),new Ls,new Tr({text:(n=(r=e.page)===null||r===void 0?void 0:r.toString())!==null&&n!==void 0?n:""})]})}buildCachedContentParagraphChild(e,t){let n=this.buildCachedContentRun(e,t);return t?.hyperlink&&e.href!==void 0?new vf({anchor:e.href,children:[n]}):n}},hr=0,sl=32,y2=32,x2=(e,t)=>{let n=t.replace(/-/g,"");if(n.length!==y2)throw new Error(`Error: Cannot extract GUID from font filename: ${t}`);let r=n.replace(/(..)/g,"$1 ").trim().split(" ").map(a=>parseInt(a,16));r.reverse();let i=e.slice(hr,sl).map((a,o)=>a^r[o%r.length]),s=new Uint8Array(hr+i.length+Math.max(0,e.length-sl));return s.set(e.slice(0,hr)),s.set(i,hr),s.set(e.slice(sl),hr+i.length),s},nn=class{format(e,t={stack:[]}){let n=e.prepForXml(t);if(n)return n;throw Error("XMLComponent did not format correctly")}},vm=/\{([^{}]+)\}/g,wm=(e,t)=>t.size===0?e:e.replace(vm,(n,r)=>{var i;return(i=t.get(r))!==null&&i!==void 0?i:n}),k2=e=>new Set(Array.from(e.matchAll(vm),([,t])=>t)),ym=class{replace(e,t,n){return wm(e,new Map(t.map((r,i)=>[r.key,(n+i).toString()])))}getMediaData(e,t){let n=k2(e);return t.Entries.filter(([r])=>n.has(r)).map(([r,{fileName:i}])=>({key:r,fileName:i}))}},T2=class{replace(e,t){return wm(e,new Map(t.map(({reference:n,instance:r,restartedListId:i,numId:s})=>[xs(n,r,i),s.toString()])))}},S2=new nn,al=(e,t,n,r,i=!0)=>U(S2.format(t,{viewWrapper:{View:t,Relationships:r},file:e,stack:[]}),{indent:n,declaration:i?{standalone:"yes",encoding:"UTF-8"}:{encoding:"UTF-8"}}),E2=(e,t,n,r)=>{let{content:i}=t.options;if(i instanceof Uint8Array)return[{data:i,path:`word/${n}`}];if("files"in i)return[{data:Ss(i.files.map(({path:c,content:d})=>[c,d instanceof Uint8Array?d:al(e,d,r,new ge)])),path:`word/${n}`}];let s=e.PackageParts.createRelationships(n),a=al(e,i,r,s),o=n.slice(0,n.lastIndexOf("/")),l=n.slice(n.lastIndexOf("/")+1);return[{data:a,path:`word/${n}`},...s.RelationshipCount>0?[{data:al(e,s,r,s,!1),path:`word/${o}/_rels/${l}.rels`}]:[]]},ac=(e,t,n=0)=>{let r=e.PackageParts.Array.slice(n);return r.length===0?[]:[...r.flatMap(({part:i,path:s})=>E2(e,i,s,t)),...ac(e,t,n+r.length)]},C2=["PackageParts"],_2=class{constructor(){S(this,"formatter",void 0),S(this,"imageReplacer",void 0),S(this,"numberingReplacer",void 0),this.formatter=new nn,this.imageReplacer=new ym,this.numberingReplacer=new T2}compile(e,t,n=[]){let r=this.xmlifyFile(e,t),{PackageParts:i}=r,s=Dl(r,C2),a=Object.values(s).flatMap(o=>Array.isArray(o)?o:[o]);return new Map([...a.map(({path:o,data:l})=>[o,l]),...i.map(({path:o,data:l})=>[o,l]),...n.map(({path:o,data:l})=>[o,l]),...e.Macros===void 0?[]:[["word/vbaProject.bin",e.Macros.project]],...e.Media.Array.map(o=>[`word/media/${o.fileName}`,o.data]),...e.FontTable.files.map(({data:o,fontKey:l},c)=>[`word/fonts/font${c+1}.odttf`,x2(o,l)])])}xmlifyFile(e,t){var n;let r=U(this.formatter.format(e.Document.View,{viewWrapper:e.Document,file:e,stack:[]}),{indent:t,declaration:{standalone:"yes",encoding:"UTF-8"}}),i=U(this.formatter.format(e.Comments,{viewWrapper:{View:e.Comments,Relationships:e.Comments.Relationships},file:e,stack:[]}),{indent:t,declaration:{standalone:"yes",encoding:"UTF-8"}}),s=U(this.formatter.format(e.FootNotes.View,{viewWrapper:e.FootNotes,file:e,stack:[]}),{indent:t,declaration:{standalone:"yes",encoding:"UTF-8"}}),a=U(this.formatter.format(e.Endnotes.View,{viewWrapper:e.Endnotes,file:e,stack:[]}),{indent:t,declaration:{encoding:"UTF-8"}}),o=e.Document.Relationships.RelationshipCount+1,l=e.Comments.Relationships.RelationshipCount+1,c=e.FootNotes.Relationships.RelationshipCount+1,d=e.Endnotes.Relationships.RelationshipCount+1,p=this.imageReplacer.getMediaData(r,e.Media),u=this.imageReplacer.getMediaData(i,e.Media),f=this.imageReplacer.getMediaData(s,e.Media),m=this.imageReplacer.getMediaData(a,e.Media);return k(k(k(k(k(k({Relationships:{data:(()=>{let h=ge.copy(e.Document.Relationships);return p.forEach((g,v)=>{h.addRelationship(o+v,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image",`media/${g.fileName}`)}),h.addRelationship(h.RelationshipCount+1,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/fontTable","fontTable.xml"),U(this.formatter.format(h,{viewWrapper:e.Document,file:e,stack:[]}),{indent:t,declaration:{encoding:"UTF-8"}})})(),path:"word/_rels/document.xml.rels"},Document:{data:(()=>{let h=this.imageReplacer.replace(r,p,o);return this.numberingReplacer.replace(h,e.Numbering.ConcreteNumbering)})(),path:"word/document.xml"},Styles:{data:(()=>{let h=U(this.formatter.format(e.Styles,{viewWrapper:e.Document,file:e,stack:[]}),{indent:t,declaration:{standalone:"yes",encoding:"UTF-8"}});return this.numberingReplacer.replace(h,e.Numbering.ConcreteNumbering)})(),path:"word/styles.xml"},Properties:{data:U(this.formatter.format(e.CoreProperties,{viewWrapper:e.Document,file:e,stack:[]}),{indent:t,declaration:{standalone:"yes",encoding:"UTF-8"}}),path:"docProps/core.xml"},FileRelationships:{data:U(this.formatter.format(e.FileRelationships,{viewWrapper:e.Document,file:e,stack:[]}),{indent:t,declaration:{encoding:"UTF-8"}}),path:"_rels/.rels"},HeaderRelationships:e.Headers.map((h,g)=>{let v=U(this.formatter.format(h.View,{viewWrapper:h,file:e,stack:[]}),{indent:t,declaration:{encoding:"UTF-8"}}),w=this.imageReplacer.getMediaData(v,e.Media),b=ge.copy(h.Relationships);return w.forEach((C,A)=>{b.addRelationship(A,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image",`media/${C.fileName}`)}),{data:U(this.formatter.format(b,{viewWrapper:h,file:e,stack:[]}),{indent:t,declaration:{encoding:"UTF-8"}}),path:`word/_rels/header${g+1}.xml.rels`}}),FooterRelationships:e.Footers.map((h,g)=>{let v=U(this.formatter.format(h.View,{viewWrapper:h,file:e,stack:[]}),{indent:t,declaration:{encoding:"UTF-8"}}),w=this.imageReplacer.getMediaData(v,e.Media),b=ge.copy(h.Relationships);return w.forEach((C,A)=>{b.addRelationship(A,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image",`media/${C.fileName}`)}),{data:U(this.formatter.format(b,{viewWrapper:h,file:e,stack:[]}),{indent:t,declaration:{encoding:"UTF-8"}}),path:`word/_rels/footer${g+1}.xml.rels`}}),Headers:e.Headers.map((h,g)=>{let v=U(this.formatter.format(h.View,{viewWrapper:h,file:e,stack:[]}),{indent:t,declaration:{encoding:"UTF-8"}}),w=this.imageReplacer.getMediaData(v,e.Media),b=this.imageReplacer.replace(v,w,0);return{data:this.numberingReplacer.replace(b,e.Numbering.ConcreteNumbering),path:`word/header${g+1}.xml`}}),Footers:e.Footers.map((h,g)=>{let v=U(this.formatter.format(h.View,{viewWrapper:h,file:e,stack:[]}),{indent:t,declaration:{encoding:"UTF-8"}}),w=this.imageReplacer.getMediaData(v,e.Media),b=this.imageReplacer.replace(v,w,0);return{data:this.numberingReplacer.replace(b,e.Numbering.ConcreteNumbering),path:`word/footer${g+1}.xml`}}),CustomProperties:{data:U(this.formatter.format(e.CustomProperties,{viewWrapper:e.Document,file:e,stack:[]}),{indent:t,declaration:{standalone:"yes",encoding:"UTF-8"}}),path:"docProps/custom.xml"},AppProperties:{data:U(this.formatter.format(e.AppProperties,{viewWrapper:e.Document,file:e,stack:[]}),{indent:t,declaration:{standalone:"yes",encoding:"UTF-8"}}),path:"docProps/app.xml"},FootNotes:{data:(()=>{let h=this.imageReplacer.replace(s,f,c);return this.numberingReplacer.replace(h,e.Numbering.ConcreteNumbering)})(),path:"word/footnotes.xml"},FootNotesRelationships:{data:(()=>{let h=ge.copy(e.FootNotes.Relationships);return f.forEach((g,v)=>{h.addRelationship(c+v,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image",`media/${g.fileName}`)}),U(this.formatter.format(h,{viewWrapper:e.FootNotes,file:e,stack:[]}),{indent:t,declaration:{encoding:"UTF-8"}})})(),path:"word/_rels/footnotes.xml.rels"},Endnotes:{data:(()=>{let h=this.imageReplacer.replace(a,m,d);return this.numberingReplacer.replace(h,e.Numbering.ConcreteNumbering)})(),path:"word/endnotes.xml"},EndnotesRelationships:{data:(()=>{let h=ge.copy(e.Endnotes.Relationships);return m.forEach((g,v)=>{h.addRelationship(d+v,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image",`media/${g.fileName}`)}),U(this.formatter.format(h,{viewWrapper:e.Endnotes,file:e,stack:[]}),{indent:t,declaration:{encoding:"UTF-8"}})})(),path:"word/_rels/endnotes.xml.rels"},Settings:{data:U(this.formatter.format(e.Settings,{viewWrapper:e.Document,file:e,stack:[]}),{indent:t,declaration:{standalone:"yes",encoding:"UTF-8"}}),path:"word/settings.xml"}},e.Comments.IsEmpty?{}:{Comments:{data:(()=>{let h=this.imageReplacer.replace(i,u,l);return this.numberingReplacer.replace(h,e.Numbering.ConcreteNumbering)})(),path:"word/comments.xml"},CommentsRelationships:{data:(()=>{let h=ge.copy(e.Comments.Relationships);return u.forEach((g,v)=>{h.addRelationship(l+v,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image",`media/${g.fileName}`)}),U(this.formatter.format(h,{viewWrapper:{View:e.Comments,Relationships:e.Comments.Relationships},file:e,stack:[]}),{indent:t,declaration:{encoding:"UTF-8"}})})(),path:"word/_rels/comments.xml.rels"}}),e.CommentsExtended?{CommentsExtended:{data:U(this.formatter.format(e.CommentsExtended,{viewWrapper:{View:e.CommentsExtended,Relationships:e.Comments.Relationships},file:e,stack:[]}),{indent:t,declaration:{standalone:"yes",encoding:"UTF-8"}}),path:"word/commentsExtended.xml"}}:{}),e.CommentsIds?{CommentsIds:{data:U(this.formatter.format(e.CommentsIds,{viewWrapper:{View:e.CommentsIds,Relationships:e.Comments.Relationships},file:e,stack:[]}),{indent:t,declaration:{standalone:"yes",encoding:"UTF-8"}}),path:"word/commentsIds.xml"}}:{}),{},{FontTable:{data:U(this.formatter.format(e.FontTable.View,{viewWrapper:e.Document,file:e,stack:[]}),{indent:t,declaration:{standalone:"yes",encoding:"UTF-8"}}),path:"word/fontTable.xml"},FontTableRelationships:{data:U(this.formatter.format(e.FontTable.Relationships,{viewWrapper:e.Document,file:e,stack:[]}),{indent:t,declaration:{encoding:"UTF-8"}}),path:"word/_rels/fontTable.xml.rels"},Theme:{data:U(this.formatter.format(e.Theme,{viewWrapper:e.Document,file:e,stack:[]}),{indent:t,declaration:{standalone:"yes",encoding:"UTF-8"}}),path:"word/theme/theme1.xml"}},!((n=e.Macros)===null||n===void 0)&&n.events?{MacroEvents:{data:U(this.formatter.format(e.Macros.events,{viewWrapper:e.Document,file:e,stack:[]}),{indent:t,declaration:{standalone:"yes",encoding:"UTF-8"}}),path:"word/vbaData.xml"},MacroRelationships:{data:U(this.formatter.format(e.Macros.relationships,{viewWrapper:e.Document,file:e,stack:[]}),{indent:t,declaration:{encoding:"UTF-8"}}),path:"word/_rels/vbaProject.bin.rels"}}:{}),e.Bibliography?{BibliographySources:{data:U(this.formatter.format(e.Bibliography.sources,{viewWrapper:e.Document,file:e,stack:[]}),{indent:t,declaration:{standalone:"yes",encoding:"UTF-8"}}),path:"customXml/item1.xml"},BibliographySourcesProperties:{data:U(this.formatter.format(e.Bibliography.properties,{viewWrapper:e.Document,file:e,stack:[]}),{indent:t,declaration:{standalone:"no",encoding:"UTF-8"}}),path:"customXml/itemProps1.xml"},BibliographySourcesRelationships:{data:U(this.formatter.format(e.Bibliography.relationships,{viewWrapper:e.Document,file:e,stack:[]}),{indent:t,declaration:{standalone:"yes",encoding:"UTF-8"}}),path:"customXml/_rels/item1.xml.rels"}}:{}),{},{PackageParts:ac(e,t),Numbering:{data:U(this.formatter.format(e.Numbering,{viewWrapper:e.Document,file:e,stack:[]}),{indent:t,declaration:{standalone:"yes",encoding:"UTF-8"}}),path:"word/numbering.xml"},ContentTypes:{data:U(this.formatter.format(e.ContentTypes,{viewWrapper:e.Document,file:e,stack:[]}),{indent:t,declaration:{encoding:"UTF-8"}}),path:"[Content_Types].xml"}})}},ch=py(((e,t)=>{var n=typeof Reflect=="object"?Reflect:null,r=n&&typeof n.apply=="function"?n.apply:function(T,x,_){return Function.prototype.apply.call(T,x,_)},i;n&&typeof n.ownKeys=="function"?i=n.ownKeys:Object.getOwnPropertySymbols?i=function(T){return Object.getOwnPropertyNames(T).concat(Object.getOwnPropertySymbols(T))}:i=function(T){return Object.getOwnPropertyNames(T)};function s(y){console&&console.warn&&console.warn(y)}var a=Number.isNaN||function(T){return T!==T};function o(){o.init.call(this)}t.exports=o,t.exports.once=b,o.EventEmitter=o,o.prototype._events=void 0,o.prototype._eventsCount=0,o.prototype._maxListeners=void 0;var l=10;function c(y){if(typeof y!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof y)}Object.defineProperty(o,"defaultMaxListeners",{enumerable:!0,get:function(){return l},set:function(y){if(typeof y!="number"||y<0||a(y))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+y+".");l=y}}),o.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},o.prototype.setMaxListeners=function(T){if(typeof T!="number"||T<0||a(T))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+T+".");return this._maxListeners=T,this};function d(y){return y._maxListeners===void 0?o.defaultMaxListeners:y._maxListeners}o.prototype.getMaxListeners=function(){return d(this)},o.prototype.emit=function(T){for(var x=[],_=1;_<arguments.length;_++)x.push(arguments[_]);var N=T==="error",M=this._events;if(M!==void 0)N=N&&M.error===void 0;else if(!N)return!1;if(N){var D;if(x.length>0&&(D=x[0]),D instanceof Error)throw D;var V=new Error("Unhandled error."+(D?" ("+D.message+")":""));throw V.context=D,V}var re=M[T];if(re===void 0)return!1;if(typeof re=="function")r(re,this,x);else for(var ee=re.length,te=g(re,ee),_=0;_<ee;++_)r(te[_],this,x);return!0};function p(y,T,x,_){var N,M,D;if(c(x),M=y._events,M===void 0?(M=y._events=Object.create(null),y._eventsCount=0):(M.newListener!==void 0&&(y.emit("newListener",T,x.listener?x.listener:x),M=y._events),D=M[T]),D===void 0)D=M[T]=x,++y._eventsCount;else if(typeof D=="function"?D=M[T]=_?[x,D]:[D,x]:_?D.unshift(x):D.push(x),N=d(y),N>0&&D.length>N&&!D.warned){D.warned=!0;var V=new Error("Possible EventEmitter memory leak detected. "+D.length+" "+String(T)+" listeners added. Use emitter.setMaxListeners() to increase limit");V.name="MaxListenersExceededWarning",V.emitter=y,V.type=T,V.count=D.length,s(V)}return y}o.prototype.addListener=function(T,x){return p(this,T,x,!1)},o.prototype.on=o.prototype.addListener,o.prototype.prependListener=function(T,x){return p(this,T,x,!0)};function u(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function f(y,T,x){var _={fired:!1,wrapFn:void 0,target:y,type:T,listener:x},N=u.bind(_);return N.listener=x,_.wrapFn=N,N}o.prototype.once=function(T,x){return c(x),this.on(T,f(this,T,x)),this},o.prototype.prependOnceListener=function(T,x){return c(x),this.prependListener(T,f(this,T,x)),this},o.prototype.removeListener=function(T,x){var _,N,M,D,V;if(c(x),N=this._events,N===void 0)return this;if(_=N[T],_===void 0)return this;if(_===x||_.listener===x)--this._eventsCount===0?this._events=Object.create(null):(delete N[T],N.removeListener&&this.emit("removeListener",T,_.listener||x));else if(typeof _!="function"){for(M=-1,D=_.length-1;D>=0;D--)if(_[D]===x||_[D].listener===x){V=_[D].listener,M=D;break}if(M<0)return this;M===0?_.shift():v(_,M),_.length===1&&(N[T]=_[0]),N.removeListener!==void 0&&this.emit("removeListener",T,V||x)}return this},o.prototype.off=o.prototype.removeListener,o.prototype.removeAllListeners=function(T){var x,_=this._events,N;if(_===void 0)return this;if(_.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):_[T]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete _[T]),this;if(arguments.length===0){var M=Object.keys(_),D;for(N=0;N<M.length;++N)D=M[N],D!=="removeListener"&&this.removeAllListeners(D);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(x=_[T],typeof x=="function")this.removeListener(T,x);else if(x!==void 0)for(N=x.length-1;N>=0;N--)this.removeListener(T,x[N]);return this};function m(y,T,x){var _=y._events;if(_===void 0)return[];var N=_[T];return N===void 0?[]:typeof N=="function"?x?[N.listener||N]:[N]:x?w(N):g(N,N.length)}o.prototype.listeners=function(T){return m(this,T,!0)},o.prototype.rawListeners=function(T){return m(this,T,!1)},o.listenerCount=function(y,T){return typeof y.listenerCount=="function"?y.listenerCount(T):h.call(y,T)},o.prototype.listenerCount=h;function h(y){var T=this._events;if(T!==void 0){var x=T[y];if(typeof x=="function")return 1;if(x!==void 0)return x.length}return 0}o.prototype.eventNames=function(){return this._eventsCount>0?i(this._events):[]};function g(y,T){for(var x=new Array(T),_=0;_<T;++_)x[_]=y[_];return x}function v(y,T){for(;T+1<y.length;T++)y[T]=y[T+1];y.pop()}function w(y){for(var T=new Array(y.length),x=0;x<T.length;++x)T[x]=y[x].listener||y[x];return T}function b(y,T){return new Promise(function(x,_){function N(D){y.removeListener(T,M),_(D)}function M(){typeof y.removeListener=="function"&&y.removeListener("error",N),x([].slice.call(arguments))}A(y,T,M,{once:!0}),T!=="error"&&C(y,N,{once:!0})})}function C(y,T,x){typeof y.on=="function"&&A(y,"error",T,x)}function A(y,T,x,_){if(typeof y.on=="function")_.once?y.once(T,x):y.on(T,x);else if(typeof y.addEventListener=="function")y.addEventListener(T,function N(M){_.once&&y.removeEventListener(T,N),x(M)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof y)}}))();A2=class extends ch.EventEmitter{pipe(e,t){let n=this,r=e,i=p=>{r.writable&&r.write(p)===!1&&n.pause&&n.pause()};n.on("data",i);let s=()=>{n.readable&&n.resume&&n.resume()};r.on("drain",s),!r._isStdio&&(!t||t.end!==!1)&&(n.on("end",o),n.on("close",l));let a=!1;function o(){a||(a=!0,r.end())}function l(){a||(a=!0,typeof r.destroy=="function"&&r.destroy())}function c(p){if(d(),ch.EventEmitter.listenerCount(this,"error")===0)throw p}n.on("error",c),r.on("error",c);function d(){n.removeListener("data",i),r.removeListener("drain",s),n.removeListener("end",o),n.removeListener("close",l),n.removeListener("error",c),r.removeListener("error",c),n.removeListener("end",d),n.removeListener("close",d),r.removeListener("close",d)}return n.on("end",d),n.on("close",d),r.on("close",d),r.emit("pipe",n),r}};N2={NONE:"",WITH_2_BLANKS:" ",WITH_4_BLANKS:" ",WITH_TAB:" "},ph=e=>e===!0?N2.WITH_2_BLANKS:e===!1?void 0:e,uh=e=>e.Macros===void 0?"application/vnd.openxmlformats-officedocument.wordprocessingml.document":"application/vnd.ms-word.document.macroEnabled.12",oc=class xn{static pack(t,n,r){var i=this;return Bt(function*(s,a,o,l=[]){return Cl(Ss(i.compiler.compile(s,ph(o),l)),a,uh(s))}).apply(this,arguments)}static toString(t,n,r=[]){return xn.pack(t,"string",n,r)}static toBuffer(t,n,r=[]){return xn.pack(t,"nodebuffer",n,r)}static toBase64String(t,n,r=[]){return xn.pack(t,"base64",n,r)}static toBlob(t,n,r=[]){return xn.pack(t,"blob",n,r)}static toArrayBuffer(t,n,r=[]){return xn.pack(t,"arraybuffer",n,r)}static toStream(t,n,r=[]){let i=new A2,s=this.compiler.compile(t,ph(n),r);return new Promise(a=>setTimeout(a)).then(()=>Cl(Ss(s),"nodebuffer",uh(t))).then(a=>{i.emit("data",a),i.emit("end")},a=>i.emit("error",a)),i}};S(oc,"compiler",new _2);xm=e=>{var t;if(e.name!=="w:bookmarkStart"&&e.name!=="w:bookmarkEnd")return;let n=Number((t=e.attributes)===null||t===void 0?void 0:t["w:id"]);return Number.isInteger(n)?n:void 0},km=e=>{var t;let n=xm(e);return[...n===void 0?[]:[n],...((t=e.elements)!==null&&t!==void 0?t:[]).flatMap(km)]},I2=e=>{let t=new Set(e),n=new Map,r=e.reduce((a,o)=>Math.max(a,o),0),i=a=>{let o=n.get(a);if(o!==void 0)return o;let l=t.has(a)?r+1:a;return r=Math.max(r,l),t.add(l),n.set(a,l),l},s=a=>{let o=xm(a);return k(k(k({},a),o===void 0?{}:{attributes:k(k({},a.attributes),{},{"w:id":String(i(o))})}),a.elements===void 0?{}:{elements:a.elements.map(s)})};return a=>a.map(s)},P2=new nn,Fs=e=>new TextDecoder("utf-8",{ignoreBOM:!0}).decode(e),it=e=>Pr(e,{keepWhitespaceText:!0}),Tm=e=>{var t;return(t=it(U(P2.format(new Tr({text:e})))).elements[0].elements)!==null&&t!==void 0?t:[]},Sm=e=>k(k({},e),{},{attributes:{"xml:space":"preserve"}}),ke=(e,t)=>{var n,r;let i=(n=e.elements)===null||n===void 0?void 0:n.find(s=>s.name===t);return i===void 0?[]:((r=i.elements)!==null&&r!==void 0||(i.elements=[]),i.elements)},Em=e=>{if(!e?.start.trim()||!e?.end.trim())throw new Error("Both start and end delimiters must be non-empty strings.")},yn=(e,t,n)=>{let r=ke(e,"Types");r.some(i=>{var s,a;return i.type==="element"&&i.name==="Default"&&(i==null||(s=i.attributes)===null||s===void 0?void 0:s.ContentType)===t&&(i==null||(a=i.attributes)===null||a===void 0?void 0:a.Extension)===n})||r.push({attributes:{ContentType:t,Extension:n},name:"Default",type:"element"})},O2=(e,t,n)=>{let r=ke(e,"Types");r.some(i=>{var s;return i.type==="element"&&i.name==="Override"&&((s=i.attributes)===null||s===void 0?void 0:s.PartName)===n})||r.push({attributes:{ContentType:t,PartName:n},name:"Override",type:"element"})},L2=(e,t)=>{var n;let r=(n=e.elements)===null||n===void 0?void 0:n.find(i=>i.name==="Types");r?.elements!==void 0&&(r.elements=r.elements.filter(i=>{var s,a;return!(i.name==="Override"&&String((s=(a=i.attributes)===null||a===void 0?void 0:a.PartName)!==null&&s!==void 0?s:"").toLowerCase()===t.toLowerCase())}))},R2=e=>{let t=parseInt(e.substring(3),10);return isNaN(t)?0:t},lc=e=>ke(e,"Relationships").map(t=>{var n,r;return R2((n=(r=t.attributes)===null||r===void 0||(r=r.Id)===null||r===void 0?void 0:r.toString())!==null&&n!==void 0?n:"")}).reduce((t,n)=>Math.max(t,n),0)+1,Al=(e,t,n,r,i)=>{let s=ke(e,"Relationships");return s.push({attributes:{Id:`rId${t}`,Type:n,Target:r,TargetMode:i},name:"Relationship",type:"element"}),s},Nr=()=>({declaration:{attributes:{version:"1.0",encoding:"UTF-8",standalone:"yes"}},elements:[{type:"element",name:"Relationships",attributes:{xmlns:"http://schemas.openxmlformats.org/package/2006/relationships"},elements:[]}]}),hh="http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties",M2="application/vnd.openxmlformats-package.core-properties+xml",fh="_rels/.rels",mh="docProps/core.xml",Nl={cp:"http://schemas.openxmlformats.org/package/2006/metadata/core-properties",dc:"http://purl.org/dc/elements/1.1/"},D2={title:{namespace:"dc",name:"title"},subject:{namespace:"dc",name:"subject"},creator:{namespace:"dc",name:"creator"},keywords:{namespace:"cp",name:"keywords"},description:{namespace:"dc",name:"description"},lastModifiedBy:{namespace:"cp",name:"lastModifiedBy"},revision:{namespace:"cp",name:"revision"}},gh=e=>e===""?[]:[{type:"text",text:String(e)}],bh=e=>{var t;return(t=e.name)===null||t===void 0?void 0:t.slice(e.name.indexOf(":")+1)},B2=(e,t)=>{var n;let r=(n=Object.entries(k({},e.attributes)).find(([i,s])=>(i==="xmlns"||i.startsWith("xmlns:"))&&s===Nl[t]))===null||n===void 0?void 0:n[0];return r===void 0?(e.attributes=k(k({},e.attributes),{},{[`xmlns:${t}`]:Nl[t]}),`${t}:`):r==="xmlns"?"":`${r.slice(6)}:`},$2=e=>{let t=e[0]===255&&e[1]===254?"utf-16le":e[0]===254&&e[1]===255?"utf-16be":"utf-8";return new TextDecoder(t).decode(e)},F2=(e,t,n)=>{var r;let i=t.get(n);if(i===void 0)return e.get(n);let s=it($2(i));return!((r=s.declaration)===null||r===void 0)&&r.attributes&&(s.declaration.attributes.encoding="UTF-8"),t.delete(n),e.set(n,s),s},H2=e=>{var t,n;let r=(t=e.get(fh))!==null&&t!==void 0?t:Nr(),i=(n=ke(r,"Relationships").find(s=>{var a;return((a=s.attributes)===null||a===void 0?void 0:a.Type)===hh}))===null||n===void 0||(n=n.attributes)===null||n===void 0?void 0:n.Target;return typeof i=="string"?tn("",i):(Al(r,lc(r),hh,mh),e.set(fh,r),mh)},U2=(e,t,n,{addContentTypeOverride:r})=>{var i,s;let a=H2(e),o=F2(e,t,a),l=o??{declaration:{attributes:{version:"1.0",encoding:"UTF-8",standalone:"yes"}},elements:[{type:"element",name:"cp:coreProperties",attributes:{"xmlns:cp":Nl.cp},elements:[]}]};o===void 0&&(e.set(a,l),r(M2,`/${a}`));let c=(i=l.elements)===null||i===void 0?void 0:i.find(d=>bh(d)==="coreProperties");if(c===void 0)throw new Error(`Could not find the core properties in ${a}`);(s=c.elements)!==null&&s!==void 0||(c.elements=[]);for(let[d,{namespace:p,name:u}]of Object.entries(D2)){let f=n[d];if(f===void 0)continue;let m=c.elements.find(h=>bh(h)===u);m?m.elements=gh(f):c.elements.push({type:"element",name:`${B2(c,p)}${u}`,elements:gh(f)})}},Il=new Set(["wp:inline","wp:anchor"]),cc=new Set(["wp:docPr","wps:cNvPr","wpg:cNvPr"]),q2=new Set(["a:stCxn","a:endCxn"]),Es=(e,t)=>{var n,r;if(!t.has((n=e.name)!==null&&n!==void 0?n:""))return;let i=Number((r=e.attributes)===null||r===void 0?void 0:r.id);return Number.isInteger(i)?i:void 0},Cm=e=>{var t;let n=Es(e,cc);return[...n===void 0?[]:[n],...((t=e.elements)!==null&&t!==void 0?t:[]).flatMap(Cm)]},W2=e=>{let t=n=>{var r;let i=Es(n,cc);return[...i===void 0?[]:[i],...((r=n.elements)!==null&&r!==void 0?r:[]).flatMap(s=>{var a;return Il.has((a=s.name)!==null&&a!==void 0?a:"")?[]:t(s)})]};return t(e)},j2=e=>{let t=new Set(e),n=e.reduce((a,o)=>Math.max(a,o),0),r=a=>{let o=t.has(a)?n+1:a;return n=Math.max(n,o),t.add(o),o},i=a=>{let o=new Map([...new Set(W2(a))].map(c=>[c,r(c)])),l=c=>{var d,p;if(c!==a&&Il.has((d=c.name)!==null&&d!==void 0?d:""))return i(c);let u=(p=Es(c,cc))!==null&&p!==void 0?p:Es(c,q2),f=u===void 0?void 0:o.get(u);return k(k(k({},c),f===void 0?{}:{attributes:k(k({},c.attributes),{},{id:String(f)})}),c.elements===void 0?{}:{elements:c.elements.map(l)})};return l(a)},s=a=>{var o;return Il.has((o=a.name)!==null&&o!==void 0?o:"")?i(a):k(k({},a),a.elements===void 0?{}:{elements:a.elements.map(s)})};return a=>a.map(s)},Te={DOCUMENT:"file",PARAGRAPH:"paragraph",TABLE_ROWS:"tableRows",DRAWING:"drawing"},K2=new Map([["wp:inline","wp:docPr"],["wp:anchor","wp:docPr"],["wpg:graphicFrame","wpg:cNvPr"],["wpc:graphicFrame","wpg:cNvPr"]]),Hs=e=>{var t;return((t=e.elements)!==null&&t!==void 0?t:[]).flatMap(n=>{var r;let i=n.name===void 0?void 0:K2.get(n.name),s=i===void 0||(r=n.elements)===null||r===void 0?void 0:r.find(a=>a.name===i);return[...s?[{element:n,properties:s}]:[],...Hs(n)]})},_m=e=>{var t,n;return[(t=e.attributes)===null||t===void 0?void 0:t.descr,(n=e.attributes)===null||n===void 0?void 0:n.title].flatMap(r=>r===void 0?[]:[String(r)])},vh="[Content_Types].xml",G2=e=>{var t;if(!(!((t=e.elements)===null||t===void 0)&&t.some(r=>r.name==="Relationships"))){var n;e.elements=[...(n=e.elements)!==null&&n!==void 0?n:[],...Nr().elements]}return ke(e,"Relationships")},z2="http://schemas.openxmlformats.org/officeDocument/2006/relationships",Pl=e=>{var t,n;return new Set(["r",...Object.entries((t=e.attributes)!==null&&t!==void 0?t:{}).flatMap(([r,i])=>r.startsWith("xmlns:")&&i===z2?[r.slice(6)]:[]),...((n=e.elements)!==null&&n!==void 0?n:[]).flatMap(r=>[...Pl(r)])])},Ol=(e,t)=>{var n,r;return new Set([...Object.entries((n=e.attributes)!==null&&n!==void 0?n:{}).flatMap(([i,s])=>i.includes(":")&&t.has(i.slice(0,i.indexOf(":")))?[String(s)]:[]),...((r=e.elements)!==null&&r!==void 0?r:[]).flatMap(i=>[...Ol(i,t)])])},V2=(e,t)=>{let n=c=>e.has(c)||t.has(c),r=c=>{if(n(c))return c;let d=(()=>{try{return decodeURI(c)}catch{return}})();if(d!==void 0&&n(d))return d;let p=c.toLowerCase();return[...e.keys(),...t.keys()].find(u=>u.toLowerCase()===p)},i=(c,d)=>{let p=e.get(Ge(c));return p===void 0?void 0:ke(p,"Relationships").find(u=>{var f;return u.name==="Relationship"&&((f=u.attributes)===null||f===void 0?void 0:f.Id)===d})},s=(c,d)=>{var p,u;let f=(p=d.attributes)===null||p===void 0?void 0:p.Target;return((u=d.attributes)===null||u===void 0?void 0:u.TargetMode)==="External"||f===void 0?void 0:r(tn(c,String(f)))},a=c=>[...e].some(([d,p])=>d.endsWith(".rels")&&ke(p,"Relationships").some(u=>s(sm(d),u)===c)),o=(c,d)=>{if(d===void 0||d===c||d===vh||d.endsWith(".rels")||a(d))return;let p=e.get(Ge(d));e.delete(d),t.delete(d),e.delete(Ge(d));let u=e.get(vh);u!==void 0&&L2(u,`/${d}`);for(let f of p===void 0?[]:ke(p,"Relationships"))o(d,s(d,f))};return{findRelationship:i,pathOf:s,removeIfUnreferenced:o,removeRelationships:(c,d)=>{var p,u;let f=(p=e.get(Ge(c)))===null||p===void 0||(p=p.elements)===null||p===void 0?void 0:p.find(h=>h.name==="Relationships"),m=((u=f?.elements)!==null&&u!==void 0?u:[]).filter(h=>{var g;return h.name==="Relationship"&&d.has(String((g=h.attributes)===null||g===void 0?void 0:g.Id))});if(!(f===void 0||m.length===0)){f.elements=f.elements.filter(h=>!m.includes(h));for(let h of m)o(c,s(c,h))}}}},X2=(e,{findRelationship:t,pathOf:n,removeIfUnreferenced:r},i,s)=>{let a=new nn;return{getRelatedPart:(o,l)=>{let c=t(o.path,l),d=c===void 0?void 0:n(o.path,c);return d===void 0?void 0:{path:d,xml:e.get(d)}},replaceRelatedPart:(o,l,c)=>{let d=`word/${i.PackageParts.add(c)}`,{relationshipType:p}=c.options,u=rc(o.path,d),f=l===void 0?void 0:t(o.path,l);if(f===void 0){var m;let g=Ge(o.path),v=(m=e.get(g))!==null&&m!==void 0?m:Nr();e.set(g,v);let w=l??`rId${lc(v)}`;return G2(v).push({type:"element",name:"Relationship",attributes:{Id:w,Type:p,Target:u}}),w}let h=n(o.path,f);return f.attributes=k(k({},Object.fromEntries(Object.entries(f.attributes).filter(([g])=>g!=="TargetMode"))),{},{Type:p,Target:u}),r(o.path,h),String(f.attributes.Id)},format:o=>it(U(a.format(o,s))).elements[0]}},Y2=({parts:e,binaryParts:t,file:n,patches:r,delimiters:i},s)=>{let a=r.map(([c,d])=>({placeholder:`${i.start}${c}${i.end}`,patch:d})),o=[...e].filter(([c])=>c.startsWith("word/")&&!c.endsWith(".rels")).flatMap(([c,d])=>Hs(d).flatMap(p=>{let u=_m(p.properties),f=a.filter(({placeholder:g})=>u.some(v=>v.includes(g)));if(f.length>1){var m,h;throw new Error(`The drawing "${(m=(h=p.properties.attributes)===null||h===void 0?void 0:h.name)!==null&&m!==void 0?m:""}" in ${c} has the placeholders ${f.map(({placeholder:g})=>g).join(" and ")} in its alt text. A drawing can only be patched once`)}return f.map(({placeholder:g,patch:v})=>({drawing:k(k({placeholder:g},p),{},{part:{path:c,xml:d}}),patch:v}))})),l=V2(e,t);for(let{drawing:c,patch:d}of o){let p=Ol(c.element,Pl(c.part.xml));d.patch(c,X2(e,l,n,s(c.part.path)));let u=Ol(c.part.xml,Pl(c.part.xml));l.removeRelationships(c.part.path,new Set([...p].filter(f=>!u.has(f))))}},J2=e=>typeof e=="object"&&e!==null&&"on"in e&&typeof e.on=="function",Q2=e=>typeof e=="object"&&e!==null&&"generateAsync"in e&&typeof e.generateAsync=="function",Z2=e=>["[object Blob]","[object File]"].includes(Object.prototype.toString.call(e)),eE=e=>new Promise((t,n)=>{let r=[];e.on("data",i=>{ArrayBuffer.isView(i)?r.push(new Uint8Array(i.buffer,i.byteOffset,i.byteLength)):typeof i=="number"?r.push(i):n(new TypeError(`A template stream must give bytes, but it gave a ${typeof i}. A stream with an encoding set gives text, so do not set one.`))}),e.on("error",n),e.on("end",()=>{let i=new Uint8Array(r.reduce((s,a)=>s+(typeof a=="number"?1:a.length),0));r.reduce((s,a)=>typeof a=="number"?(i[s]=a,s+1):(i.set(a,s),s+a.length),0),t(i)})}),tE=(function(){var e=Bt(function*(t){return Q2(t)?t.generateAsync({type:"uint8array"}):J2(t)?eE(t):Z2(t)?new Uint8Array(yield t.arrayBuffer()):typeof t=="string"?Uint8Array.from({length:t.length},(n,r)=>t.charCodeAt(r)):Array.isArray(t)?Uint8Array.from(t):ArrayBuffer.isView(t)?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):new Uint8Array(t)});return function(n){return e.apply(this,arguments)}})(),Am=(function(){var e=Bt(function*(t,n){return mm(yield tE(t),n)});return function(n,r){return e.apply(this,arguments)}})(),nE=new nn,cs="word/document.xml",rE={path:"word/footnotes.xml",rootName:"w:footnotes",noteName:"w:footnote",referenceName:"w:footnoteReference",contentType:"application/vnd.openxmlformats-officedocument.wordprocessingml.footnotes+xml",relationshipType:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/footnotes",create:{part:()=>new Kf,mark:()=>new jf,styles:()=>[new Jf({}),new Zf({}),new Qf({})]}},iE={path:"word/endnotes.xml",rootName:"w:endnotes",noteName:"w:endnote",referenceName:"w:endnoteReference",contentType:"application/vnd.openxmlformats-officedocument.wordprocessingml.endnotes+xml",relationshipType:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/endnotes",create:{part:()=>new Wf,mark:()=>new Hf,styles:()=>[new em({}),new nm({}),new tm({})]}},ds=(e,t)=>it(U(nE.format(e,t))).elements[0],Nm=(e,t)=>{var n,r,i;let s=t.includes((n=e.name)!==null&&n!==void 0?n:"")?Number((r=e.attributes)===null||r===void 0?void 0:r["w:id"]):NaN;return[...Number.isInteger(s)?[s]:[],...((i=e.elements)!==null&&i!==void 0?i:[]).flatMap(a=>Nm(a,t))]},sE=(e,t)=>{var n,r;let i=(n=e.elements)!==null&&n!==void 0?n:[],s=((r=i[0])===null||r===void 0?void 0:r.name)==="w:pPr"?1:0;return k(k({},e),{},{elements:[...i.slice(0,s),t,...i.slice(s)]})},wh=(e,t,n,{createContext:r,addContentTypeOverride:i,renumberBookmarks:s,renumberDrawings:a,renumberLists:o,useStyles:l})=>{let c=new Map(Object.entries(t).map(([w,b])=>[Number(w),b])),d=new Map,p=[...c.keys()].filter(Number.isFinite).reduce((w,b)=>Math.max(w,Math.floor(b)),0),u=new Map,f,m=w=>{var b,C;let A=w.name===e.referenceName?c.get(Number((b=w.attributes)===null||b===void 0?void 0:b["w:id"])):void 0;return A===void 0?w.elements===void 0?w:k(k({},w),{},{elements:w.elements.map(m)}):(f=((C=f)!==null&&C!==void 0?C:[...n.values()].flatMap(y=>Nm(y,[e.noteName,e.referenceName])).reduce((y,T)=>Math.max(y,T),0))+1,u.set(f,A),k(k({},w),{},{attributes:k(k({},w.attributes),{},{"w:id":String(f)})}))},h=()=>{var w;let b=ke((w=n.get(Ge(cs)))!==null&&w!==void 0?w:{},"Relationships").find(A=>{var y;return((y=A.attributes)===null||y===void 0?void 0:y.Type)===e.relationshipType}),C=b?tn(cs,String(b.attributes.Target)):e.path;return n.has(C)||(n.set(C,{declaration:{attributes:{version:"1.0",encoding:"UTF-8",standalone:"yes"}},elements:[ds(e.create.part(),r(C))]}),i(e.contentType,`/${C}`)),b||r(cs).viewWrapper.Relationships.addRelationship(Cn(),e.relationshipType,rc(cs,C)),C};return{renumber:w=>w.map(m),write:()=>{if(u.size===0)return;let w=h(),b=r(w),C=new Map([...new Set(u.values())].map(y=>{let T=ds(e.create.mark(),b);return[y,l(o(s(y.children.map(x=>ds(x,b)).map((x,_)=>_===0?sE(x,T):x))))]}));ke(n.get(w),e.rootName).push(...[...u].map(([y,T])=>({type:"element",name:e.noteName,attributes:{"w:id":String(y)},elements:[...a(C.get(T))]})));let A=n.get("word/styles.xml");if(A){let y=ke(A,"w:styles"),T=new Set(y.map(x=>{var _;return(_=x.attributes)===null||_===void 0?void 0:_["w:styleId"]}));y.push(...e.create.styles().map(x=>ds(x,b)).filter(x=>{var _;return!T.has((_=x.attributes)===null||_===void 0?void 0:_["w:styleId"])}))}},carry:(w,b)=>{let C=d.get(w);return C!==void 0?C:(p++,c.set(p,b),d.set(w,p),p)}}},aE=({footnotes:e={},endnotes:t={}},n,r)=>{let i={footnotes:wh(rE,e,n,r),endnotes:wh(iE,t,n,r)};return{carry:(s,a,o)=>i[s].carry(a,o),renumber:s=>Object.values(i).reduce((a,o)=>o.renumber(a),s),write:()=>{for(let s of Object.values(i))s.write()}}},oE=new nn,ps="word/document.xml",lE="word/numbering.xml",cE="application/vnd.openxmlformats-officedocument.wordprocessingml.numbering+xml",yh="http://schemas.openxmlformats.org/officeDocument/2006/relationships/numbering",dE="default-bullet-numbering",pE="1",uE=(e,t)=>it(U(oE.format(e,t))).elements[0],xh=e=>e.reduce((t,n)=>Math.max(t,n),0),hE=(e,t,{createContext:n,addContentTypeOverride:r})=>{let i=new Map,s,a=()=>{var m;return ke((m=t.get(Ge(ps)))!==null&&m!==void 0?m:{},"Relationships").find(h=>{var g;return((g=h.attributes)===null||g===void 0?void 0:g.Type)===yh})},o=(m=a())=>m?tn(ps,String(m.attributes.Target)):lE,l=(m,h)=>{var g;return ke((g=t.get(o()))!==null&&g!==void 0?g:{},"w:numbering").filter(v=>v.name===m).map(v=>Number(v.attributes[h]))},c=m=>{if(m===pE)return e.ConcreteNumbering.find(({reference:g})=>g===dE);if(!m.startsWith("{"))return;let h=e.ConcreteNumbering.find(({reference:g,instance:v})=>m===`{${g}-${v}}`);if(!h){let g=m.slice(1,-1).replace(/-\d+$/,"");throw new Error(`A paragraph in a patch uses the numbering "${g}", which isn't in the numbering option of patchDocument. Add it there with its levels, as in a Document`)}return h},d=m=>{var h;let g=i.get(m.numId);return g!==void 0?g:(s=((h=s)!==null&&h!==void 0?h:xh(l("w:num","w:numId")))+1,i.set(m.numId,s),s)},p=m=>{let h=m.name==="w:numId"?c(String(m.attributes["w:val"])):void 0;return h===void 0?m.elements===void 0?m:k(k({},m),{},{elements:m.elements.map(p)}):k(k({},m),{},{attributes:k(k({},m.attributes),{},{"w:val":String(d(h))})})},u=m=>{let h=a(),g=o(h);return t.has(g)||(t.set(g,{declaration:{attributes:{version:"1.0",encoding:"UTF-8",standalone:"yes"}},elements:[k(k({},m),{},{elements:[]})]}),r(cE,`/${g}`)),h||n(ps).viewWrapper.Relationships.addRelationship(Cn(),yh,rc(ps,g)),g};return{renumber:m=>m.map(p),write:()=>{var m,h;if(i.size===0)return;let g=uE(e,n(o())),v=N=>Number(N.elements.find(M=>M.name==="w:abstractNumId").attributes["w:val"]),w=g.elements.filter(N=>N.name==="w:num"&&i.has(Number(N.attributes["w:numId"]))),b=xh(l("w:abstractNum","w:abstractNumId")),C=new Map([...new Set(w.map(v))].map((N,M)=>[N,b+M+1])),A=g.elements.flatMap(N=>{let M=N.name==="w:abstractNum"?C.get(Number(N.attributes["w:abstractNumId"])):void 0;return M===void 0?[]:[k(k({},N),{},{attributes:k(k({},N.attributes),{},{"w:abstractNumId":String(M)})})]}),y=u(g),T=t.get(y).elements.find(N=>N.name==="w:numbering");T.attributes=k(k(k({},Object.fromEntries(Object.entries(g.attributes).filter(([N])=>N.startsWith("xmlns:")))),T.attributes),{},{"mc:Ignorable":[...new Set([...String((m=(h=T.attributes)===null||h===void 0?void 0:h["mc:Ignorable"])!==null&&m!==void 0?m:"").split(" "),...String(g.attributes["mc:Ignorable"]).split(" ")])].filter(N=>N!=="").join(" ")});let x=ke(t.get(y),"w:numbering"),_=N=>{let M=x.findIndex(D=>N.includes(D.name));return M===-1?x.length:M};x.splice(_(["w:num","w:numIdMacAtCleanup"]),0,...A),x.splice(_(["w:numIdMacAtCleanup"]),0,...w.map(N=>k(k({},N),{},{attributes:k(k({},N.attributes),{},{"w:numId":String(i.get(Number(N.attributes["w:numId"])))}),elements:N.elements.map(M=>M.name==="w:abstractNumId"?k(k({},M),{},{attributes:{"w:val":String(C.get(v(N)))}}):M)})))}}},Ll={nameOf:e=>e.type==="element"?e.name:void 0,contentOf:e=>e.elements,attributeOf:(e,t)=>{var n;return(n=e.attributes)===null||n===void 0?void 0:n[t]},textOf:e=>{var t;return((t=e.elements)!==null&&t!==void 0?t:[]).filter(({type:n})=>n==="text").map(({text:n})=>String(n)).join("")},textElement:e=>({type:"element",name:"w:t",attributes:{"xml:space":"preserve"},elements:[{type:"text",text:e}]}),writeClean:(e,t)=>{var n;/^\s*(PAGEREF|TOC)\b/i.test(t)&&((n=e.attributes)===null||n===void 0?void 0:n["w:dirty"])!==void 0&&(e.attributes=Object.fromEntries(Object.entries(e.attributes).filter(([r])=>r!=="w:dirty")))},setSimpleFieldResult:(e,t)=>{e.elements=[{type:"element",name:"w:r",elements:[Ll.textElement(t)]}]}},ol="word/document.xml",fE="http://schemas.openxmlformats.org/officeDocument/2006/relationships/aFChunk",mE=[80,75,3,4],gE=(function(){var e=Bt(function*(t){if(mE.every((n,r)=>t[r]===n))try{let n=new Map,r=new Map;for(let[s,a]of mm(t))/\.(xml|rels)$/.test(s)?n.set(s,it(Fs(a))):r.set(s,a);let i=yield Im(n,r);return k({parts:n,binaryParts:r},i.size>0?{importedDocuments:i}:{})}catch{return}});return function(n){return e.apply(this,arguments)}})(),Im=(function(){var e=Bt(function*(t,n){let r=new Map;for(let[a,o]of t){var i,s;if(a.endsWith(".rels"))for(let{attributes:l={}}of(i=(s=vs(o))===null||s===void 0?void 0:s.elements)!==null&&i!==void 0?i:[]){let c=tn(sm(a),String(l.Target)),d=n.get(c),p=l.Type===fE&&l.TargetMode!=="External"&&d?yield gE(d):void 0;p&&r.set(c,p)}}return r});return function(n,r){return e.apply(this,arguments)}})(),vs=e=>{var t;return e==null||(t=e.elements)===null||t===void 0?void 0:t.find(({type:n})=>n==="element")},bE=(function(){var e=Bt(function*(t,n,r=new Map){var i,s;let a=vs(t.get(ol));if(!a)return;let o=yield Im(t,r),l=n(k({parts:t,binaryParts:r},o.size>0?{importedDocuments:o}:{})),c=rf(Ll,a,l,{blank:!0}),d=(i=(s=vs(t.get(Ge(ol))))===null||s===void 0?void 0:s.elements)!==null&&i!==void 0?i:[];for(let{attributes:p={}}of d){let u=/\/(header|footer)$/.test(String(p.Type))?vs(t.get(tn(ol,String(p.Target)))):void 0;u&&sf(Ll,u,l,{blank:!0,sectionPageCount:c.get(String(p.Id))})}});return function(n,r){return e.apply(this,arguments)}})(),vE=new Set(["w:hyperlink","w:sdt","w:sdtContent","w:ins","w:moveTo","w:smartTag","w:customXml","w:fldSimple","w:dir","w:bdo"]),Pm=(e,t)=>{var n;return((n=e.elements)!==null&&n!==void 0?n:[]).flatMap((r,i)=>{var s;return r.name==="w:r"?[{element:r,path:[...t,i]}]:vE.has((s=r.name)!==null&&s!==void 0?s:"")?Pm(r,[...t,i]):[]})},Cs=(e,t)=>t.reduce((n,r)=>n.elements[r],e),Br=e=>{if(e.element.name!=="w:p")throw new Error(`Invalid node type: ${e.element.name}`);if(!e.element.elements)return{text:"",runs:[],index:-1,pathToParagraph:[]};let t=0,n=Pm(e.element,[]).map(({element:r,path:i})=>{let s=wE(r,i,t);return t+=s.text.length,s});return{text:n.reduce((r,i)=>r+i.text,""),runs:n,index:e.index,pathToParagraph:Om(e)}},wE=(e,t,n)=>{if(!e.elements)return{text:"",parts:[],path:t,start:n,end:n};let r=n,i=e.elements.map((s,a)=>{var o,l;if(s.name!=="w:t"||!s.elements||s.elements.length===0)return;let c=(o=(l=s.elements[0].text)===null||l===void 0?void 0:l.toString())!==null&&o!==void 0?o:"",d=r;return r+=c.length,{text:c,index:a,start:d,end:d+c.length-1}}).filter(s=>!!s).map(s=>s);return{text:i.reduce((s,a)=>s+a.text,""),parts:i,path:t,start:n,end:i.length>0?i[i.length-1].end:n}},Om=e=>e.parent?[...Om(e.parent),e.index]:[e.index],yE=class extends Error{constructor(e){super(`Token ${e} not found`),this.name="TokenNotFoundError"}},xE=(e,t)=>{let n=Br({element:e,index:0,parent:void 0}).runs.find(({parts:r})=>r.some(({text:i})=>i.includes(t)));if(!n)throw new yE(t);return n.path},kE=(e,t)=>{var n,r;let i=-1,s=(n=(r=e.elements)===null||r===void 0?void 0:r.map((a,o)=>{if(i!==-1)return a;if(a.type==="element"&&a.name==="w:t"){var l,c;let d=((l=(c=a.elements)===null||c===void 0||(c=c[0])===null||c===void 0?void 0:c.text)!==null&&l!==void 0?l:"").split(t),p=d.map(u=>k(k(k({},a),Sm(a)),{},{elements:Tm(u)}));return d.length>1&&(i=o),p}else return a}).flat())!==null&&n!==void 0?n:[];return{left:k(k({},JSON.parse(JSON.stringify(e))),{},{elements:s.slice(0,i+1)}),right:k(k({},JSON.parse(JSON.stringify(e))),{},{elements:s.slice(i+1)})}},fr={START:0,MIDDLE:1,END:2},Lm=({paragraphElement:e,renderedParagraph:t,originalText:n,replacementText:r,fromIndex:i=0})=>{let s=t.text.indexOf(n,i),a=s+n.length-1,o=fr.START;for(let l of t.runs){let c=Cs(e,l.path);for(let{text:d,index:p,start:u,end:f}of l.parts)switch(o){case fr.START:if(s>=u&&s<=f){let m=s-u,h=Math.min(a,f)-u;if(d.substring(m,h+1)==="")continue;let g=d.substring(0,m)+r+d.substring(h+1);ll(c.elements[p],g),o=fr.MIDDLE;continue}break;case fr.MIDDLE:if(a<=f){let m=d.substring(a-u+1);ll(c.elements[p],m);let h=c.elements[p];c.elements[p]=Sm(h),o=fr.END}else ll(c.elements[p],"")}}return e},ll=(e,t)=>(e.elements=Tm(t),e),kh=e=>{var t,n;return(t=(n=e.element.elements)===null||n===void 0?void 0:n.map((r,i)=>({element:r,index:i,parent:e})))!==null&&t!==void 0?t:[]},Rm=e=>{let t=[],n=[...kh({element:e,index:0,parent:void 0})],r;for(;n.length>0;)r=n.shift(),r.element.name==="w:p"&&(t=[...t,Br(r)]),n.push(...kh(r));return t},dc=(e,t)=>Rm(e).filter(n=>n.text.includes(t)),cl="\uFFFF",TE=({json:e,patch:t,patchText:n,context:r,keepOriginalStyles:i=!0,recursive:s=!0,renumberIds:a=o=>o})=>{let o=dc(e,n);if(o.length===0)return{element:e,didFindOccurrence:!1};let l=[...o].reverse(),c=t.type===Te.DOCUMENT?RE(l):l,d,p=()=>{var f;return d=((f=d)!==null&&f!==void 0?f:Dm(e))+1,String(d)};for(let f of c)switch(t.type){case Te.DOCUMENT:{var u;let m=ME(e,f.pathToParagraph),h=DE(f.pathToParagraph),g=Th(t,r,a),v=m.name==="w:tc"&&h===m.elements.length-1&&((u=g[g.length-1])===null||u===void 0?void 0:u.name)!=="w:p"?[{type:"element",name:"w:p"}]:[];m.elements.splice(h,1,...g,...v);break}case Te.PARAGRAPH:default:{let m=Bm(e,f.pathToParagraph),h=f,g=0;do g=SE({paragraphElement:m,renderedParagraph:h,patchText:n,fromIndex:g,children:Th(t,r,a),keepOriginalStyles:i,newTrackedChangeId:p}),h=Br({element:m,index:f.index,parent:void 0});while(s&&h.text.includes(n,g));break}}return{element:e,didFindOccurrence:!0}},Th=(e,t,n)=>n(e.children.flatMap(r=>{var i;return(i=r.writtenAs)!==null&&i!==void 0?i:r}).flatMap(r=>{let i=r.prepForXml(t);return i?[it(U(i)).elements[0]]:[]})),SE=({paragraphElement:e,renderedParagraph:t,patchText:n,fromIndex:r,children:i,keepOriginalStyles:s,newTrackedChangeId:a})=>{let o=t.text.indexOf(n,r);Lm({paragraphElement:e,renderedParagraph:t,originalText:n,replacementText:cl,fromIndex:r});let l=xE(e,cl),c=l.slice(0,-1),d=Cs(e,c),p=l[l.length-1],u=c.map((A,y)=>Cs(e,c.slice(0,y+1))).filter(A=>A.name==="w:sdt"),f=[...u].reverse().find(EE),m=d.elements[p],{left:h,right:g}=kE(m,cl),v=m.elements.find(A=>A.type==="element"&&A.name==="w:rPr"),w=f?CE(f):v,b=s&&w?i.map(A=>Mm(A,w)):i,C=v?k(k({},g),{},{elements:[v,...g.elements]}):g;return d.elements.splice(p,1,h,...b,C),u.forEach(A=>NE(A,b)),PE(e,c,a),o+Br({element:{name:"w:p",elements:[...b]},index:0,parent:void 0}).text.length},pc=e=>{var t;return(t=e.elements)===null||t===void 0?void 0:t.find(n=>n.name==="w:sdtPr")},EE=e=>{var t;return!!(!((t=pc(e))===null||t===void 0||(t=t.elements)===null||t===void 0)&&t.some(n=>n.name==="w:showingPlcHdr"))},CE=e=>{var t;return(t=pc(e))===null||t===void 0||(t=t.elements)===null||t===void 0?void 0:t.find(n=>n.name==="w:rPr")},_E=new Set(["w:rPr","w:t","w:tab","w:br"]),AE=e=>e.name==="w:bookmarkStart"||e.name==="w:bookmarkEnd"||e.name==="w:r"&&Yt(e).every(t=>_E.has(t.name)),NE=(e,t)=>{let n=pc(e);if(!n?.elements)return;let r=n.elements.some(i=>i.name==="w:text")&&!t.every(AE);n.elements=n.elements.filter(i=>i.name!=="w:showingPlcHdr"&&i.name!=="w:dataBinding"&&!(r&&i.name==="w:text"))},Rl=new Set(["w:hyperlink","w:fldSimple","w:subDoc"]),IE=new Map([["w:ins",Rl],["w:moveTo",Rl],["w:hyperlink",new Set(["w:hyperlink"])]]),PE=(e,t,n)=>{for(let i=t.length;i>0;i--){var r;let s=Cs(e,t.slice(0,i-1)),a=t[i-1],o=s.elements[a],l=IE.get(o.name),c=g=>!!l?.has(g.name);if(!(!((r=o.elements)===null||r===void 0)&&r.some(c)))continue;let{elements:d}=o,p=d.flatMap((g,v)=>v===0||c(g)||c(d[v-1])?[v]:[]),u=p.map((g,v)=>d.slice(g,p[v+1])),f=l===Rl,m=!0,h=u.map(g=>{if(c(g[0]))return g[0];let v=f&&!m?k(k({},o.attributes),{},{"w:id":n()}):o.attributes;return m=!1,k(k({},o),{},{attributes:v,elements:[...g]})});s.elements.splice(a,1,...h)}},Mm=(e,t)=>e.name==="w:r"?OE(e,t):e.elements?k(k({},e),{},{elements:e.elements.map(n=>Mm(n,t))}):e,OE=(e,t)=>{let n=Yt(e).find(a=>a.type==="element"&&a.name==="w:rPr");if(!n)return k(k({},e),{},{elements:[t,...Yt(e)]});let r=new Set(Yt(n).map(a=>a.name)),i=[...Yt(t).filter(a=>!r.has(a.name)),...Yt(n)],s=k(k({},n),{},{elements:[...i].sort((a,o)=>Sh(a)-Sh(o))});return k(k({},e),{},{elements:Yt(e).map(a=>a===n?s:a)})},dl=["w:rStyle","w:rFonts","w:b","w:bCs","w:i","w:iCs","w:caps","w:smallCaps","w:strike","w:dstrike","w:outline","w:shadow","w:emboss","w:imprint","w:noProof","w:snapToGrid","w:vanish","w:webHidden","w:color","w:spacing","w:w","w:kern","w:position","w:sz","w:szCs","w:highlight","w:u","w:effect","w:bdr","w:shd","w:fitText","w:vertAlign","w:rtl","w:cs","w:em","w:lang","w:eastAsianLayout","w:specVanish","w:oMath","w14:glow","w14:shadow","w14:reflection","w14:textOutline","w14:textFill","w14:scene3d","w14:props3d","w14:ligatures","w14:numForm","w14:numSpacing","w14:stylisticSets","w14:cntxtAlts"],Sh=e=>{var t;if(e.name==="w:rPrChange")return dl.length+1;let n=dl.indexOf((t=e.name)!==null&&t!==void 0?t:"");return n===-1?dl.length:n},Yt=e=>{var t;return(t=e.elements)!==null&&t!==void 0?t:[]},Dm=e=>{var t,n;let r=Number((t=e.attributes)===null||t===void 0?void 0:t["w:id"]);return((n=e.elements)!==null&&n!==void 0?n:[]).reduce((i,s)=>Math.max(i,Dm(s)),Number.isInteger(r)?r:0)},LE=(e,t)=>e.length>t.length&&t.every((n,r)=>e[r]===n),RE=e=>e.filter(t=>!e.some(n=>LE(t.pathToParagraph,n.pathToParagraph))),Bm=(e,t)=>{let n=e;for(let r=1;r<t.length;r++){let i=t[r];n=n.elements[i]}return n},ME=(e,t)=>Bm(e,t.slice(0,t.length-1)),DE=e=>e[e.length-1],BE=new nn,pl="word/styles.xml",$E=new Set(["w:pStyle","w:rStyle","w:tblStyle","w:basedOn","w:next","w:link"]),xr=e=>{var t;return String((t=e.attributes)===null||t===void 0?void 0:t["w:styleId"])},Ml=e=>{var t;let n=(t=e.elements)===null||t===void 0||(t=t.find(r=>r.name==="w:name"))===null||t===void 0||(t=t.attributes)===null||t===void 0?void 0:t["w:val"];return n===void 0?void 0:String(n).toLowerCase()},ws=(e,t)=>{var n;return e==null||(n=e.elements)===null||n===void 0?void 0:n.find(r=>r.name===t)},Eh=e=>{var t;let n=Number((t=ws(e,"w:sz"))===null||t===void 0||(t=t.attributes)===null||t===void 0?void 0:t["w:val"]);return Number.isNaN(n)?void 0:n},FE=e=>{var t,n;let r=e.filter(a=>a.name==="w:style"),i=(t=r.find(a=>xr(a)==="Normal"))!==null&&t!==void 0?t:r.find(a=>{var o;return((o=a.attributes)===null||o===void 0?void 0:o["w:type"])==="paragraph"&&Ml(a)==="normal"}),s=e.find(a=>a.name==="w:docDefaults");return(n=Eh(ws(i,"w:rPr")))!==null&&n!==void 0?n:Eh(ws(ws(s,"w:rPrDefault"),"w:rPr"))},HE=(e,t)=>new Map(Object.values(nc({document:{run:{size:t}}})).map(n=>it(U(BE.format(n,e))).elements[0]).filter(n=>n.name==="w:style").map(n=>[xr(n),n])),UE=(e,t)=>{var n;let r=ke((n=e.get(pl))!==null&&n!==void 0?n:{},"w:styles"),i=r.filter(m=>m.name==="w:style"),s=new Set(i.map(xr)),a,o=m=>{var h;return(h=a)!==null&&h!==void 0||(a=HE(t(pl),FE(r))),a.get(m)},l=new Set,c=new Map,d=m=>{let h=s.has(m)?void 0:o(m);if(h===void 0)return m;let g=i.find(v=>{var w,b;return((w=v.attributes)===null||w===void 0?void 0:w["w:type"])===((b=h.attributes)===null||b===void 0?void 0:b["w:type"])&&Ml(v)===Ml(h)});return g!==void 0?xr(g):(l.add(m),m)},p=m=>(c.has(m)||c.set(m,d(m)),c.get(m)),u=m=>{var h;return $E.has((h=m.name)!==null&&h!==void 0?h:"")?k(k({},m),{},{attributes:k(k({},m.attributes),{},{"w:val":p(String(m.attributes["w:val"]))})}):m.elements===void 0?m:k(k({},m),{},{elements:m.elements.map(u)})};return{use:m=>m.map(u),write:()=>{let m=e.get(pl);if(!m)return;let h=ke(m,"w:styles"),g=new Set(h.map(xr));for(let v of l)g.has(v)||(g.add(v),h.push(u(o(v))))}}},qE={type:Te.PARAGRAPH,children:[]},WE=({json:e,key:t,patch:n,delimiters:{start:r,end:i},patchPlaceholder:s,renumberDrawings:a})=>{let o=`${r}${t}.`;for(let l of jE(e,o)){let c=zE(l.elements,o,i),d=n.rows.flatMap((p,u)=>{let f={type:"element",name:"w:tbl",elements:[...u===0?l.elements.map(VE):a(Fm(l.elements))]},m=new Map(Object.entries(p).flatMap(([h,g])=>g===void 0?[]:[[h,g]]));for(let[h,g]of m)s(f,`${t}.${h}`,g);for(let h of c.filter(g=>!m.has(g)))s(f,`${t}.${h}`,qE);return f.elements});l.parent.elements.splice(l.parent.elements.indexOf(l.elements[0]),l.elements.length,...d),l.table&&!$m(l.table.element)&&l.table.parent.elements.splice(l.table.parent.elements.indexOf(l.table.element),1)}},jE=(e,t)=>{let n=dc(e,t).flatMap(i=>{let s=KE(e,i.pathToParagraph);return s?[s]:[]}),r=n.filter(i=>!n.some(s=>GE(i.path,s.path))).filter((i,s,a)=>a.findIndex(o=>o.row===i.row)===s);return[...new Set(r.map(i=>i.parent))].flatMap(i=>{let s=i.elements.filter(l=>l.name==="w:tr"),a=r.filter(l=>l.parent===i).map(l=>s.indexOf(l.row)).sort((l,c)=>l-c),{table:o}=r.find(l=>l.parent===i);return a.reduce((l,c)=>{let d=l[l.length-1];return d?.[d.length-1]===c-1?[...l.slice(0,-1),[...d,c]]:[...l,[c]]},[]).map(l=>{let c=i.elements.indexOf(s[l[0]]),d=i.elements.indexOf(s[l[l.length-1]]);return{parent:i,table:o,elements:i.elements.slice(c,d+1)}})})},KE=(e,t)=>{let n=e,r,i;for(let s=1;s<t.length;s++){let a=n.elements[t[s]];a.name==="w:tbl"&&(i={element:a,parent:n}),a.name==="w:tr"&&(r={parent:n,table:i,row:a,path:t.slice(0,s+1)}),n=a}return r},GE=(e,t)=>e.length>t.length&&t.every((n,r)=>e[r]===n),$m=e=>{var t;return((t=e.elements)!==null&&t!==void 0?t:[]).some(n=>n.name==="w:tr"||n.name!=="w:tblPr"&&n.name!=="w:tblGrid"&&$m(n))},zE=(e,t,n)=>{let r=dc({elements:[...e]},t).flatMap(({text:i})=>i.split(t).slice(1).flatMap(s=>{let a=s.indexOf(n);return a>0?[s.slice(0,a)]:[]}));return[...new Set(r)]},VE=e=>JSON.parse(JSON.stringify(e)),XE=["w14:paraId","w14:textId"],YE=["w:bookmarkStart","w:bookmarkEnd"],Fm=(e,t)=>e.filter(n=>{var r;return!YE.includes((r=n.name)!==null&&r!==void 0?r:"")&&!(t?.name==="w:sdtPr"&&n.name==="w:id")}).map(n=>k(k(k({},n),n.attributes===void 0?{}:{attributes:Object.fromEntries(Object.entries(n.attributes).filter(([r])=>!XE.includes(r)))}),n.elements===void 0?{}:{elements:[...Fm(n.elements,n)]})),JE=e=>e[0]===255&&e[1]===254||e[0]===254&&e[1]===255,QE=e=>{var t;let n=u2(e,"word/document.xml"),r=n===void 0||(t=[...e].find(([i])=>DS(i,n)))===null||t===void 0?void 0:t[1];return r===void 0||JE(r)?void 0:Hl(m2(Fs(r)))},_s=(e,t,{start:n,end:r},i)=>{for(let s=e.indexOf(n,t);s!==-1;s=e.indexOf(n,s+1)){let a=e.indexOf(r,s+n.length);if(a===-1)return;let o=e.slice(s+n.length,a),l=o.trim();if(l!==o&&i(l))return{index:s,placeholder:e.slice(s,a+r.length),trimmed:`${n}${l}${r}`}}},ZE=(e,t,n)=>{let r=e;for(let i=_s(r,0,t,n);i!==void 0;i=_s(r,i.index+i.trimmed.length,t,n))r=`${r.slice(0,i.index)}${i.trimmed}${r.slice(i.index+i.placeholder.length)}`;return r},Hm=e=>{var t;return((t=e.elements)!==null&&t!==void 0?t:[]).flatMap(n=>[...n.name==="w:p"?[n]:[],...Hm(n)])},eC=(e,t,n)=>{let r=()=>Br({element:e,index:0,parent:void 0});for(let i=r(),s=_s(i.text,0,t,n);s!==void 0;i=r(),s=_s(i.text,s.index+s.trimmed.length,t,n))Lm({paragraphElement:e,renderedParagraph:i,originalText:s.placeholder,replacementText:s.trimmed,fromIndex:s.index})},tC=(e,{delimiters:t,textKeys:n,tableRowsKeys:r,drawingKeys:i})=>{let s=l=>n.has(l)||r.some(c=>l.startsWith(`${c}.`));for(let l of Hm(e))eC(l,t,s);let a=l=>i.has(l);for(let{properties:l}of Hs(e))for(let c of["descr","title"]){var o;let d=(o=l.attributes)===null||o===void 0?void 0:o[c];d!==void 0&&(l.attributes[c]=ZE(String(d),t,a))}},Um=e=>{var t;return e.name==="v:shapetype"&&((t=e.attributes)===null||t===void 0?void 0:t.id)!==void 0?String(e.attributes.id):void 0},qm=e=>{var t;let n=Um(e);return[...n===void 0?[]:[n],...((t=e.elements)!==null&&t!==void 0?t:[]).flatMap(qm)]},nC=e=>{let t=new Set(qm(e)),n=r=>{let i=Um(r);return i!==void 0?t.has(i)?[]:(t.add(i),[r]):[r.elements===void 0?r:k(k({},r),{},{elements:r.elements.flatMap(n)})]};return r=>r.flatMap(n)},Wm=(e,t,{inTableRow:n})=>{if(t?.type===Te.TABLE_ROWS&&Array.isArray(t.rows)){for(let r of t.rows){if(typeof r!="object"||r===null)throw new Error(`Invalid patch "${e}". Expected each of its rows to be an object of patches, by the name of their field`);for(let[i,s]of Object.entries(r))s!==void 0&&Wm(`${e}.${i}`,s,{inTableRow:!0})}return}if(!(t?.type===Te.DRAWING?!n&&typeof t.patch=="function":t?.type!==Te.TABLE_ROWS&&Array.isArray(t?.children)))throw new Error(`Invalid patch "${e}". Expected { type: PatchType.PARAGRAPH or PatchType.DOCUMENT, children: [...] }, ${n?"or { type: PatchType.TABLE_ROWS, rows: [...] }":"{ type: PatchType.TABLE_ROWS, rows: [...] }, or a drawing patch such as ImagePatch, or ChartDataPatch from docx/charts"}`)},Ch=new ym,rC=new Uint8Array([255,254]),iC=new Uint8Array([254,255]),sC=new Set(["w:document","w:hdr","w:ftr","w:footnotes","w:endnotes","w:comments"]),_h=(e,t)=>{if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0},DN=(function(){var e=Bt(function*({outputType:t,data:n,patches:r,keepOriginalStyles:i,placeholderDelimiters:s={start:"{{",end:"}}"},recursive:a=!0,trimPlaceholders:o=!1,footnotes:l,endnotes:c,numbering:d={config:[]},pageNumbers:p,properties:u}){let f=yield Am(n),m=new Map,h=QE(f),g=[],v=new Vf({addOverride:(R,$)=>g.push({contentType:R,partName:$})},new Set([...f.keys()].filter(R=>R.startsWith("word/")).map(R=>R.slice(5)))),w={Media:new Gf(R=>v.takePath("media","image",R)),Numbering:new zf(d),Theme:h&&{Colors:h},FootNotes:{View:{idOf:(R,$,F)=>wt("footnotes",R,$,F)}},Endnotes:{View:{idOf:(R,$,F)=>wt("endnotes",R,$,F)}},PackageParts:v},b=new Map,C=[],A=[],y=!1,T=new Map;Em(s);let{start:x,end:_}=s;for(let[R,$]of Object.entries(r))Wm(R,$,{inTableRow:!1});for(let[R,$]of f){var N;let F=$.slice(0,2);if(_h(F,rC)||_h(F,iC)){T.set(R,$);continue}if(!R.endsWith(".xml")&&!R.endsWith(".rels")){T.set(R,$);continue}let Z=it(Fs($)),ie=(N=Z.elements)===null||N===void 0?void 0:N.find(se=>{var Y;return sC.has((Y=se.name)!==null&&Y!==void 0?Y:"")});if(ie&&ie.attributes){for(let se of["mc","wp","r","w15","m","v","o"])ie.attributes[`xmlns:${se}`]=vl[se];ie.attributes["mc:Ignorable"]=`${ie.attributes["mc:Ignorable"]||""} w15`.trim()}b.set(R,Z)}let M=I2([...b.values()].flatMap(km)),D=j2([...b.values()].flatMap(Cm)),V=new Map,re=R=>{let $=V.get(R);if($)return $;let F={Relationships:{addRelationship:(Z,ie,se,Y)=>{A.push({key:R,id:Z,type:ie,target:se,targetMode:Y})}}};return V.set(R,F),F},ee=R=>({file:w,viewWrapper:re(R),stack:[]}),te=(R,$)=>{g.push({contentType:R,partName:$})},X=UE(b,ee),fe=hE(w.Numbering,b,{createContext:ee,addContentTypeOverride:te}),le=aE({footnotes:l,endnotes:c},b,{createContext:ee,addContentTypeOverride:te,renumberBookmarks:M,renumberDrawings:D,renumberLists:fe.renumber,useStyles:X.use}),wt=(R,$,F,Z)=>Z.viewWrapper===re("word/document.xml")?le.carry(R,$,F):void 0;if(o){let R=F=>Object.entries(r).flatMap(([Z,ie])=>F(ie.type)?[Z]:[]),$={delimiters:{start:x,end:_},textKeys:new Set(R(F=>F!==Te.TABLE_ROWS&&F!==Te.DRAWING)),tableRowsKeys:R(F=>F===Te.TABLE_ROWS),drawingKeys:new Set(R(F=>F===Te.DRAWING))};for(let[F,Z]of b)F.startsWith("word/")&&!F.endsWith(".rels")&&tC(Z,$)}Y2({parts:b,binaryParts:T,file:w,patches:Object.entries(r).flatMap(([R,$])=>$.type===Te.DRAWING?[[R,$]]:[]),delimiters:{start:x,end:_}},ee);let Ee=Object.entries(r).flatMap(([R,$])=>$.type===Te.DRAWING?[]:[[R,$]]),Fe=[...Ee.filter(([,R])=>R.type===Te.TABLE_ROWS),...Ee.filter(([,R])=>R.type!==Te.TABLE_ROWS)];for(let[R,$]of[...b]){if(!R.startsWith("word/")||R.endsWith(".xml.rels"))continue;let F=ee(R);m.set(R,F);let Z=nC($),ie=(se,Y,Pe)=>{if(Pe.type===Te.TABLE_ROWS){WE({json:se,key:Y,patch:Pe,delimiters:{start:x,end:_},patchPlaceholder:ie,renumberDrawings:D});return}let wc=[],{didFindOccurrence:dg}=TE({json:se,patch:k(k({},Pe),{},{children:Pe.children.flatMap(He=>He instanceof wf?He.writtenAs:[He]).map(He=>{if(He instanceof j1){let{target:pg,anchor:ug}=Tf(He.options.link),yc=new Jl(He.options.children,Cn(),ug,He.options.link);return wc.push({key:R,id:yc.linkId,type:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink",target:pg,targetMode:jl.EXTERNAL}),yc}else return He})}),patchText:`${x}${Y}${_}`,context:F,keepOriginalStyles:i,recursive:a,renumberIds:He=>X.use(fe.renumber(le.renumber(M(D(Z(He))))))});dg&&A.push(...wc)};for(let[se,Y]of Fe)ie($,se,Y)}le.write(),fe.write(),X.write();for(let[R,$]of b){if(!R.startsWith("word/")||R.endsWith(".xml.rels"))continue;let F=Ch.getMediaData(JSON.stringify($),w.Media);F.length>0&&(y=!0,C.push({key:R,mediaDatas:F}))}for(let{key:R,mediaDatas:$}of C){var ve;let F=Ge(R),Z=(ve=b.get(F))!==null&&ve!==void 0?ve:Nr();b.set(F,Z);let ie=lc(Z),se=Ch.replace(JSON.stringify(b.get(R)),$,ie);b.set(R,JSON.parse(se));for(let Y=0;Y<$.length;Y++){let{fileName:Pe}=$[Y];Al(Z,ie+Y,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image",`media/${Pe}`)}}for(let{key:R,id:$,type:F,target:Z,targetMode:ie}of A){var we;let se=Ge(R),Y=(we=b.get(se))!==null&&we!==void 0?we:Nr();b.set(se,Y),Al(Y,$,F,Z,ie)}p&&(yield bE(b,p,T)),u&&U2(b,T,u,{addContentTypeOverride:te});let Q=ac(w,void 0);if(y||g.length>0){let R=b.get("[Content_Types].xml");if(!R)throw new Error("Could not find content types file");y&&(yn(R,"image/png","png"),yn(R,"image/jpeg","jpeg"),yn(R,"image/jpeg","jpg"),yn(R,"image/bmp","bmp"),yn(R,"image/gif","gif"),yn(R,"image/svg+xml","svg"));for(let{contentType:$,partName:F}of g)O2(R,$,F)}return Cl(Ss([...[...b].map(([R,$])=>[R,Ty($)]),...T,...w.Media.Array.map(({data:R,fileName:$})=>[`word/media/${$}`,R]),...Q.map(({path:R,data:$})=>[R,$])]),t,"application/vnd.openxmlformats-officedocument.wordprocessingml.document")});return function(n){return e.apply(this,arguments)}})(),aC=e=>e.startsWith("word/")&&/\.(xml|rels)$/.test(e)&&!e.endsWith(".xml.rels"),BN=(function(){var e=Bt(function*({data:t,placeholderDelimiters:n={start:"{{",end:"}}"},trimPlaceholders:r=!1}){Em(n);let i=oC(n),s=yield Am(t,aC),a=new Set;for(let[,o]of s){let l=it(Fs(o));[...Rm(l).map(c=>c.text),...Hs(l).flatMap(({properties:c})=>_m(c))].flatMap(c=>{var d;return(d=c.match(i))!==null&&d!==void 0?d:[]}).map(c=>r?c.trim():c).filter(c=>c!=="").forEach(c=>a.add(c))}return Array.from(a)});return function(n){return e.apply(this,arguments)}})(),ul=e=>e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),oC=({start:e,end:t})=>new RegExp(`(?<=${ul(e)})(?:(?!${ul(e)}).)+?(?=${ul(t)})`,"gs")});var Qm={};xc(Qm,{EXPORT_DIR:()=>$r,FORMATS:()=>uc,buildIR:()=>Ws,exportDoc:()=>hc,irToDocx:()=>Jm,irToHtml:()=>js});import Km from"node:fs";import Gm from"node:path";function lC(e){return`${String(e.getDate()).padStart(2,"0")}/${String(e.getMonth()+1).padStart(2,"0")}/${e.getFullYear()}`}function dC(e){let t=e.result;if(!t)return[zm["not-run"]];let n=[zm[t.status]];return t.actual&&n.push("Th\u1EF1c t\u1EBF: "+t.actual),t.bug&&n.push("L\u1ED7i: "+t.bug),n}function pC(e,t){let n=e.kind==="non-functional",r=e.cases.filter(o=>!o.deleted),i=n?["STT","Y\xEAu c\u1EA7u","K\u1ECBch b\u1EA3n ki\u1EC3m th\u1EED","K\u1EBFt qu\u1EA3 mong \u0111\u1EE3i"]:["STT","T\xECnh hu\u1ED1ng","C\xE1c b\u01B0\u1EDBc th\u1EF1c hi\u1EC7n","K\u1EBFt qu\u1EA3 mong \u0111\u1EE3i"],s=[7,27,38,28];t.results&&(i.push("K\u1EBFt qu\u1EA3","Ng\u01B0\u1EDDi test / ng\xE0y"),s=[8,20,27,20,13,12]);let a=r.map((o,l)=>{let d=[[String(l+1),...t.codes?[o.code]:[]],qs(n&&o.requirement||o.case),qs(o.steps),qs(o.expected)];return t.results&&d.push(dC(o),o.result?[o.result.by??"",cC(o.result.at)].filter(Boolean):[]),d});return{head:i,widths:s,rows:a}}function Xm(e){let t=lr();for(let n of e)$o(n,t);return t}function Ws(e,t={}){let n=e.config,r=n.overview??{},i=t.date??new Date,s=[],a=v=>or(e,v),o=e.modules.filter(v=>a(v.code).some(w=>w.kind==="functional")),l=e.modules.filter(v=>a(v.code).some(w=>w.kind==="non-functional")),c=zt(e.root,n.ba),d=c?Gt(c):null;s.push({k:"cover",lines:[...r.owner?[{text:r.owner.toUpperCase(),bold:!0}]:[],{text:""},{text:"T\xC0I LI\u1EC6U",bold:!0,size:32},{text:"K\u1ECACH B\u1EA2N KI\u1EC2M TH\u1EEC (CH\u1EE8C N\u0102NG, PHI CH\u1EE8C N\u0102NG)",bold:!0,size:32},{text:n.title,bold:!0,size:28},{text:""},{text:"Phi\xEAn b\u1EA3n t\xE0i li\u1EC7u: "+(r.docVersion||"1.0")},...t.results?[{text:"B\u1EA3n k\xE8m k\u1EBFt qu\u1EA3 ki\u1EC3m th\u1EED"}]:[],{text:""},...r.owner?[{text:"\u0110\u01A1n v\u1ECB qu\u1EA3n l\xFD: "+r.owner}]:[],...r.contractor?[{text:"\u0110\u01A1n v\u1ECB th\u1EF1c hi\u1EC7n: "+r.contractor}]:[],{text:""},{text:(r.place?r.place+", ":"")+lC(i)}]}),s.push({k:"pagebreak"}),s.push({k:"p",text:"TRANG K\xDD",bold:!0});let p=n.members.length?n.members:[{id:"",name:"",role:""}];s.push({k:"table",head:["TT","Ng\xE0y","H\u1ECD t\xEAn","Vai tr\xF2","K\xFD t\xEAn"],widths:[6,16,30,28,20],rows:p.map((v,w)=>[[String(w+1)],[""],[v.name],[v.role??""],[""]])}),s.push({k:"pagebreak"}),s.push({k:"toc",title:"M\u1EE4C L\u1EE4C"}),s.push({k:"pagebreak"});let u=0;s.push({k:"h",level:1,text:`${Vm[u++]}. T\u1ED4NG QUAN`}),s.push({k:"h",level:2,text:"1. M\u1EE5c \u0111\xEDch t\xE0i li\u1EC7u"}),s.push({k:"p",text:r.purpose||`T\xE0i li\u1EC7u n\xE0y m\xF4 t\u1EA3 c\xE1c t\xECnh hu\u1ED1ng ki\u1EC3m th\u1EED ch\u1EE9c n\u0103ng v\xE0 phi ch\u1EE9c n\u0103ng c\u1EE7a ${n.title}, l\xE0m c\u0103n c\u1EE9 ki\u1EC3m th\u1EED ch\u1EA5p nh\u1EADn (UAT) v\xE0 b\xE0n giao.`}),s.push({k:"h",level:2,text:"2. Ph\u1EA1m vi"}),r.scope?s.push({k:"p",text:r.scope}):(s.push({k:"p",text:"T\xE0i li\u1EC7u ki\u1EC3m th\u1EED c\xE1c ch\u1EE9c n\u0103ng, th\u1ECFa m\xE3n c\xE1c \u0111\u1EA7u m\u1EE5c ch\xEDnh nh\u01B0 sau:"}),s.push({k:"list",items:e.modules.filter(v=>a(v.code).length).map(v=>v.title)})),s.push({k:"h",level:2,text:"3. Th\xF4ng tin m\xF4i tr\u01B0\u1EDDng ki\u1EC3m th\u1EED"}),s.push({k:"p",text:r.environment||"\u0110\u01B0\u1EDDng d\u1EABn / m\xE1y ch\u1EE7: (b\u1ED5 sung)"}),s.push({k:"h",level:2,text:"4. T\xE0i li\u1EC7u li\xEAn quan"}),s.push({k:"p",text:r.references||"T\xE0i li\u1EC7u n\xE0y \u0111\u01B0\u1EE3c x\xE2y d\u1EF1ng d\u1EF1a tr\xEAn c\xE1c t\xE0i li\u1EC7u:"}),r.references||s.push({k:"list",items:["T\xE0i li\u1EC7u \u0111\u1EB7c t\u1EA3 y\xEAu c\u1EA7u ph\u1EA7n m\u1EC1m;","T\xE0i li\u1EC7u thi\u1EBFt k\u1EBF chi ti\u1EBFt;","T\xE0i li\u1EC7u \u0111\u1EB7c t\u1EA3 chi ti\u1EBFt ch\u1EE9c n\u0103ng."]}),s.push({k:"h",level:2,text:"5. Thu\u1EADt ng\u1EEF v\xE0 \u0111\u1ECBnh ngh\u0129a"});let f=r.terms?.length?r.terms:[{term:"UAT",desc:"Ki\u1EC3m th\u1EED ch\u1EA5p nh\u1EADn ng\u01B0\u1EDDi d\xF9ng (User Acceptance Test)"},{term:"K\u1ECBch b\u1EA3n",desc:"T\u1EADp t\xECnh hu\u1ED1ng ki\u1EC3m th\u1EED cho m\u1ED9t ch\u1EE9c n\u0103ng / use case"},{term:"T\xECnh hu\u1ED1ng",desc:"M\u1ED9t tr\u01B0\u1EDDng h\u1EE3p ki\u1EC3m th\u1EED: c\xE1c b\u01B0\u1EDBc th\u1EF1c hi\u1EC7n v\xE0 k\u1EBFt qu\u1EA3 mong \u0111\u1EE3i"}];s.push({k:"table",head:["STT","Thu\u1EADt ng\u1EEF / vi\u1EBFt t\u1EAFt","M\xF4 t\u1EA3"],widths:[8,30,62],rows:f.map((v,w)=>[[String(w+1)],[v.term],[v.desc]])});let m=(v,w,b)=>{if(s.push({k:"pagebreak"}),s.push({k:"h",level:1,text:`${Vm[u++]}. ${v}`}),!w.length){s.push({k:"p",text:"(Ch\u01B0a c\xF3 k\u1ECBch b\u1EA3n.)",italic:!0});return}w.forEach((C,A)=>{s.push({k:"h",level:2,text:`${A+1}. ${C.title}`}),b==="functional"&&C.commonSteps.trim()&&(s.push({k:"p",text:"C\xE1c b\u01B0\u1EDBc th\u1EF1c hi\u1EC7n chung:",bold:!0}),s.push({k:"list",items:qs(C.commonSteps)})),a(C.code).filter(y=>y.kind===b).forEach((y,T)=>{s.push({k:"h",level:3,text:`${A+1}.${T+1}. ${y.title}`});let x=[y.useCases.length?"Use case: "+y.useCases.join(", "):"",y.covers.length?"Ch\u1EE9c n\u0103ng: "+y.covers.map(N=>d?.get(N)?.title?`${N} (${d.get(N).title})`:N).join("; "):""].filter(Boolean);if(x.length&&s.push({k:"p",text:x.join(" \xB7 "),italic:!0}),y.preconditions&&s.push({k:"p",text:"\u0110i\u1EC1u ki\u1EC7n ti\xEAn quy\u1EBFt: "+y.preconditions}),y.description.trim())for(let N of y.description.trim().split(/\n\s*\n/))s.push({k:"p",text:N.trim()});let _=pC(y,t);_.rows.length?s.push({k:"table",..._}):s.push({k:"p",text:"(Ch\u01B0a c\xF3 t\xECnh hu\u1ED1ng.)",italic:!0})})})};m("CHI TI\u1EBET T\xCCNH HU\u1ED0NG KI\u1EC2M TH\u1EEC Y\xCAU C\u1EA6U CH\u1EE8C N\u0102NG \u1EE8NG D\u1EE4NG",o,"functional"),m("CHI TI\u1EBET T\xCCNH HU\u1ED0NG KI\u1EC2M TH\u1EEC Y\xCAU C\u1EA6U PHI CH\u1EE8C N\u0102NG \u1EE8NG D\u1EE4NG",l,"non-functional");let h=[];t.results&&h.push(()=>{s.push({k:"h",level:2,text:"T\u1ED5ng h\u1EE3p k\u1EBFt qu\u1EA3 ki\u1EC3m th\u1EED"});let v=e.modules.map(C=>({m:C,c:Xm(a(C.code))})).filter(C=>C.c.total),w=Xm(e.modules.flatMap(C=>a(C.code))),b=C=>C.total?Math.round(100*C.passed/C.total)+"%":"\u2014";s.push({k:"table",head:["Ph\xE2n h\u1EC7","T\xECnh hu\u1ED1ng","\u0110\u1EA1t","Kh\xF4ng \u0111\u1EA1t","B\u1ECB ch\u1EB7n","B\u1ECF qua","Ch\u01B0a test","T\u1EF7 l\u1EC7 \u0111\u1EA1t"],widths:[30,10,8,10,9,9,11,13],rows:[...v.map(({m:C,c:A})=>[[C.title],[String(A.total)],[String(A.passed)],[String(A.failed)],[String(A.blocked)],[String(A.skipped)],[String(A["not-run"])],[b(A)]]),[["T\u1ED5ng"],[String(w.total)],[String(w.passed)],[String(w.failed)],[String(w.blocked)],[String(w.skipped)],[String(w["not-run"])],[b(w)]]]})});let g=e.suites.filter(v=>v.status!=="deleted"&&v.covers.length);if(g.length&&h.push(()=>{s.push({k:"h",level:2,text:"Ma tr\u1EADn ch\u1EE9c n\u0103ng \u2013 k\u1ECBch b\u1EA3n ki\u1EC3m th\u1EED"});let v=new Map;for(let w of g)for(let b of w.covers)v.set(b,[...v.get(b)??[],w.title]);s.push({k:"table",head:["STT","Ch\u1EE9c n\u0103ng / m\xE0n (t\xE0i li\u1EC7u BA)","K\u1ECBch b\u1EA3n ki\u1EC3m th\u1EED"],widths:[8,42,50],rows:[...v.entries()].sort((w,b)=>w[0].localeCompare(b[0])).map(([w,b],C)=>[[String(C+1)],[d?.get(w)?.title?`${w} \u2013 ${d.get(w).title}`:w],b])})}),h.length){s.push({k:"pagebreak"}),s.push({k:"h",level:1,text:"PH\u1EE4 L\u1EE4C"});for(let v of h)v()}return{title:n.title,results:!!t.results,nodes:s}}function js(e){let t=[],n=e.nodes.filter(s=>s.k==="h"),r=0;for(let s of e.nodes)if(s.k==="cover")t.push(`<section class="cover">${s.lines.map(a=>a.text?`<p class="${a.bold?"b":""}"${a.size?` style="font-size:${a.size/2}pt"`:""}>${bt(a.text)}</p>`:"<p> </p>").join("")}</section>`);else if(s.k==="h")t.push(`<h${s.level} id="h${r++}">${bt(s.text)}</h${s.level}>`);else if(s.k==="p")t.push(`<p${s.bold||s.italic?` class="${s.bold?"b":""} ${s.italic?"i":""}"`:""}>${bt(s.text).replace(/\n/g,"<br>")}</p>`);else if(s.k==="list")t.push(`<ul>${s.items.map(a=>`<li>${bt(a)}</li>`).join("")}</ul>`);else if(s.k==="toc")t.push(`<nav class="toc"><p class="b">${bt(s.title)}</p>${n.map((a,o)=>`<a class="l${a.level}" href="#h${o}">${bt(a.text)}</a>`).join("")}</nav>`);else if(s.k==="pagebreak")t.push('<div class="pb"></div>');else if(s.k==="table"){let a=s.widths?`<colgroup>${s.widths.map(o=>`<col style="width:${o}%">`).join("")}</colgroup>`:"";t.push(`<table>${a}<thead><tr>${s.head.map(o=>`<th>${bt(o)}</th>`).join("")}</tr></thead><tbody>${s.rows.map(o=>`<tr>${o.map(l=>`<td>${l.map(bt).join("<br>")}</td>`).join("")}</tr>`).join("")}</tbody></table>`)}return`<!doctype html><html lang="vi"><head><meta charset="utf-8"><title>${bt(e.title)}</title><style>body{background:#e9ecef;margin:0;font:12pt/1.45 "Times New Roman",serif;color:#111}
|
|
5292
|
+
`;case"w:noBreakHyphen":return"-";default:return""}},Rk=e=>{let t=[],n=r=>{let i=at(r);if(i!==void 0&&Pk.has(i))return ot(r).map(n).join("");if(i==="w:fldChar"){let s=Be(r,"w:fldCharType");return s==="begin"?t.push(!1):s==="separate"?t[t.length-1]=!0:t.pop(),""}return t.every(Boolean)?Ok(r):""};return ot(e).map(n).join("")},_m=e=>{let t=at(e);return t==="w:bookmarkStart"?[{start:!0,id:Be(e,"w:id"),name:Be(e,"w:name")}]:t==="w:bookmarkEnd"?[{start:!1,id:Be(e,"w:id")}]:t===void 0||t==="_attr"?[]:ot(e).flatMap(_m)},Lk=e=>{let t=new Map;return e.map(n=>{let r=_m(n),i=new Set([...t.values(),...r.flatMap(s=>s.start?[s.name]:[])]);for(let s of r)s.start?t.set(s.id,s.name):t.delete(s.id);return i})},Mk=(e,t)=>{let n=t?Lk(e):[];return e.map((r,i)=>{var s;let a=Xe(r,"w:pPr");return{element:r,styleId:Be(Xe(a,"w:pStyle"),"w:val"),outlineLevel:oc(Xe(a,"w:outlineLvl"),"w:val"),text:Rk(r),bookmarks:(s=n[i])!==null&&s!==void 0?s:new Set}})},Nm=e=>{var t;let n=(t=e.file)===null||t===void 0||(t=t.Styles)===null||t===void 0?void 0:t.prepForXml(e);return new Map(ot(n).filter(r=>at(r)==="w:style"&&["paragraph",void 0].includes(Be(r,"w:type"))).map(r=>[Be(r,"w:styleId"),{name:Be(Xe(r,"w:name"),"w:val"),basedOn:Be(Xe(r,"w:basedOn"),"w:val"),outlineLevel:oc(Xe(Xe(r,"w:pPr"),"w:outlineLvl"),"w:val")}]))},Im=e=>{let t=/^\s*(\d+)\s*-\s*(\d+)\s*$/.exec(e);return t?[Number(t[1]),Number(t[2])]:void 0},_l=(e,[t,n])=>e>=t&&e<=n,lc=(e,t)=>{var n,r;if(e===void 0)return;let i=/^heading ?([1-9])$/i.exec((n=(r=t.get(e))===null||r===void 0?void 0:r.name)!==null&&n!==void 0?n:e);return i?Number(i[1]):void 0},Pm=(e,t,n=0)=>{var r;if(e===void 0||n>t.size)return;let i=t.get(e),s=lc(e,t);return(r=i?.outlineLevel)!==null&&r!==void 0?r:s===void 0?Pm(i?.basedOn,t,n+1):s-1},Dk=e=>{let t=Nm(e);return n=>{let r=Xe(n,"w:pPr"),i=Be(Xe(r,"w:pStyle"),"w:val"),s=lc(i,t),a=Om({styleId:i,outlineLevel:oc(Xe(r,"w:outlineLvl"),"w:val")},t),o=a===void 0||a>=9?void 0:a+1;return s!==void 0&&(o===void 0||o===s)?s:o===void 0?void 0:"unclear"}},Om=(e,t)=>{var n;return(n=e.outlineLevel)!==null&&n!==void 0?n:Pm(e.styleId,t)},Bk=(e,t,n)=>{var r;let{entriesFromBookmark:i,headingStyleRange:s,stylesWithLevels:a=[],useAppliedParagraphOutlineLevel:o}=e;if(t.text.trim()===""||i&&!t.bookmarks.has(i))return;let c=[t.styleId,t.styleId===void 0||(r=n.get(t.styleId))===null||r===void 0?void 0:r.name].filter(f=>f!==void 0).map(f=>f.toLowerCase()),l=a.find(f=>c.includes(f.styleName.toLowerCase()));if(l)return l.level;let u=!!s||a.length>0||!!o||!!e.tcFieldIdentifier||!!e.tcFieldLevelRange||!!e.captionLabel||!!e.captionLabelIncludingNumbers,d=s?Im(s):u?void 0:[1,9],p=lc(t.styleId,n);if(d&&p!==void 0&&_l(p,d))return p;let m=o?Om(t,n):void 0;return m!==void 0&&_l(m+1,d??[1,9])?m+1:void 0},$k=(e,t)=>{let n=t.preserveTabInEntries?e:e.replace(/\t/g," ");return(t.preserveNewLineInEntries?n.split(`
|
|
5293
|
+
`):[n.replace(/\n/g," ")]).map((r,i)=>new Oe({break:i>0?1:void 0,children:r.split(" ").flatMap((s,a)=>[...a>0?[new Ws]:[],...s===""?[]:[s]])}))},Fk=({text:e,separator:t})=>t==="tab"?[new Oe(e),new Oe({children:[new Ws]})]:[new Oe(`${e} `)],qk=(e,t)=>{let n=240*(e-1)+t+240;return n<=1920?Math.ceil(n/240)*240:Math.round(n)},Hk=(e,t)=>{var n,r;return(n=(r=[...t].find(([,i])=>{var s;return((s=i.name)===null||s===void 0?void 0:s.toLowerCase())===`toc ${e}`}))===null||r===void 0?void 0:r[0])!==null&&n!==void 0?n:`TOC${e}`},Uk=({properties:e,beginDirty:t,textWidth:n,tabLeader:r},i,s,a)=>{var o;let c=e.pageNumbersEntryLevelsRange?(o=Im(e.pageNumbersEntryLevelsRange))!==null&&o!==void 0?o:[1,9]:void 0,l=new Cm;return i.forEach((u,d)=>{var p;let m=c===void 0||!_l(u.level,c),f=[...u.listNumber?Fk(u.listNumber):[],...$k(u.title,e),...m?[new Oe({children:[e.entryAndPageNumberSeparator||new Ws]}),new A1(u.bookmark,{hyperlink:e.hyperlink})]:[]];l.addChildElement(new ne({style:Hk(u.level,s),tabStops:[...((p=u.listNumber)===null||p===void 0?void 0:p.separator)==="tab"?[{type:"left",position:qk(u.level,u.listNumber.width)}]:[],{type:"right",position:n,leader:r}],children:[...d===0?[new Fe({children:[Em(t),new Sm(e),nn()]})]:[],...e.hyperlink?[new Dm({anchor:u.bookmark,children:f})]:f]}))}),l.addChildElement(new ne({children:[new Fe({children:[rn()]})]})),l.prepForXml(a)},jk=(e,t,n,r)=>{let i=ot(e),s=i.findIndex(a=>at(a)==="w:pPr")+1;e["w:p"]=[...i.slice(0,s),new Fm(t,n).prepForXml(r),...i.slice(s),new qm(n).prepForXml(r)]},Wk=(e,t,n,r)=>{let i=Am(ot(e)),s=i.flatMap(u=>{let d=ac.get(u);return d?[[u,d]]:[]});if(s.length===0)return;let a=Nm(t),o=s.some(([,{properties:u}])=>!!u.entriesFromBookmark),c=Mk(i.filter(u=>at(u)==="w:p"),o).map(u=>({paragraph:u,levels:s.map(([,{properties:d}])=>Bk(d,u,a))})).filter(({levels:u})=>u.some(d=>d!==void 0)).map((u,d)=>k(k({},u),{},{id:n.get(d)}));for(let{paragraph:u,id:d}of c)jk(u.element,`_Toc${d}`,d,t);let l=c.length>0?r?.(e):void 0;s.forEach(([u,d],p)=>{let m=c.flatMap(({paragraph:f,levels:h,id:g})=>{let y=h[p],x=l?.get(`_Toc${g}`);return y===void 0?[]:[k({title:f.text,level:y,bookmark:`_Toc${g}`},x?{listNumber:x}:{})]});m.length!==0&&(u["w:sdt"]=ot(u).map(f=>at(f)==="w:sdtContent"?Uk(d,m,a,t):f))})},Kk=new RegExp("^\\p{L}[\\p{L}\\p{N}_]*$","u"),Gk=e=>{var t,n;let r,i=!1,s,a=!1,o=!1;for(let d=0;d<e.length;d++){var c,l;let p=e[d],m=(c=e[d+1])!==null&&c!==void 0?c:"",f;if(d===0&&!p.startsWith("\\"))f={type:"bookmark"};else if(p==="\\c"||p==="\\n")f={type:p==="\\c"?"repeat":"next"};else if((p==="\\r"||p==="\\s")&&/^\d+$/.test(m))d++,f=p==="\\r"?{type:"reset",to:Number(m)}:{type:"heading",level:Number(m)};else if(p==="\\h")i=!0;else if(p==="\\#"&&d+1<e.length)d++,o=!0;else if(p==="\\*"&&d+1<e.length){let h=e[++d];if(wm.has(h.toLowerCase()))a=!0;else if(!vm.has(h.toLowerCase())){if(s!==void 0)return;s=h}}else return;if(f&&r)return;r=(l=f)!==null&&l!==void 0?l:r}if(r?.type==="bookmark"&&e.length>1)return;let u=!o&&!(a&&s!==void 0&&s.toLowerCase()!=="arabic");return{step:(t=r)!==null&&t!==void 0?t:{type:"next"},hidden:i&&s===void 0,format:u?(n=s)!==null&&n!==void 0?n:"ARABIC":""}},cc=e=>{var t;let n=new RegExp("^\\s*SEQ\\b(.*)$","is").exec(e);if(!n)return;let[r,...i]=(t=n[1].match(/"[^"]*"|\S+/g))!==null&&t!==void 0?t:[];if(r===void 0)return{};let s=r.replace(/^"(.*)"$/,"$1");return Kk.test(s)?{identifier:s,sequence:Gk(i)}:{identifier:s}},zk=e=>cc(e)!==void 0,Nl=e=>typeof e!="object"||e===null?[]:Array.isArray(e)?e.flatMap(Nl):Object.entries(e).flatMap(([t,n])=>[...(t==="w:instrText"&&Array.isArray(n)?n:t==="_attr"?[n["w:instr"]]:[]).flatMap(r=>{let i=typeof r=="string"?cc(r):void 0;return i?.identifier===void 0?[]:[i.identifier.toLowerCase()]}),...Nl(n)]),Vk=e=>{var t;let n=(t=e.file)===null||t===void 0?void 0:t.Comments;if(!n)return new Set;let r={View:n,Relationships:n.Relationships};return new Set(Nl(n.prepForXml(k(k({},e),{},{viewWrapper:r,stack:[]}))))},Xk=e=>{let t=Dk(e),n=new Map,r=new Map,i=[],s=-1,a=-1,o,c=(l,u)=>{var d;let p=Math.max(-1,...i.slice(1,u+1).filter(h=>h!==void 0)),m=((d=r.get(l))!==null&&d!==void 0?d:[]).filter(h=>h.paragraph>=p),f=m.every(({step:h})=>h?.type==="next"||h?.type==="heading"&&h.level===u);return s>p||!f?void 0:m.length+1};return{startParagraph:l=>{a++;let u=t(l);u==="unclear"?s=a:u!==void 0&&(i[u]=a)},numberOf:(l,u)=>{var d,p,m;let{identifier:f,sequence:h}=cc(l);if(f===void 0||u==="fallback")return;(d=o)!==null&&d!==void 0||(o=Vk(e));let g=f.toLowerCase();if(h?.step.type==="bookmark"&&u==="counted"&&!o.has(g))return;let y=n.has(g)?n.get(g):0,x=o.has(g)||u==="deleted"?void 0:h?.step,b=x?.type==="reset"?x.to:x?.type==="repeat"?y:x?.type==="heading"?c(g,x.level):x?.type==="next"&&y!==void 0?y+1:void 0;return n.set(g,b),r.set(g,[...(p=r.get(g))!==null&&p!==void 0?p:[],k({paragraph:a},b===void 0?{}:{step:x})]),b===void 0||h===void 0?void 0:h.hidden?"":(m=sc(h.format))===null||m===void 0?void 0:m(b)}}},nl=e=>{let t=typeof e=="object"&&e!==null&&!Array.isArray(e)?Object.keys(e)[0]:void 0;return t==="_attr"?void 0:t},Qu=e=>({"w:t":[{_attr:{"xml:space":"preserve"}},e]}),js={nameOf:nl,contentOf:e=>{let t=e[nl(e)];return Array.isArray(t)?t:void 0},attributeOf:(e,t)=>{var n;let r=e[nl(e)],i=Array.isArray(r)?r.find(s=>typeof s=="object"&&s!==null&&"_attr"in s):r;return i==null||(n=i._attr)===null||n===void 0?void 0:n[t]},textOf:e=>js.contentOf(e).filter(t=>typeof t=="string").join(""),textElement:Qu,writeClean:e=>{if(_x(e)){let t=e["w:fldChar"]._attr;e["w:fldChar"]={_attr:Object.fromEntries(Object.entries(t).filter(([n])=>n!=="w:dirty"))}}},setSimpleFieldResult:(e,t)=>{let n=e["w:fldSimple"];e["w:fldSimple"]=[...(Array.isArray(n)?n:[n]).filter(r=>typeof r=="object"&&r!==null&&"_attr"in r),{"w:r":[Qu(t)]}]}},Rm=new WeakMap,Yk=(e,t)=>{let{startParagraph:n,numberOf:r}=Xk(t);Ak(js,e,{beforeParagraph:i=>n(i),resultOf:(i,s)=>zk(i)?r(i,s):void 0})},Jk=(e,t,n)=>{let r=n(e,t),i=km(js,e,r,{blank:!1});t.file&&Rm.set(t.file,{estimate:r,partPageCounts:i})},jr=(e,t,n)=>{let r=t.file&&Rm.get(t.file);if(!e||!r)return;let i=n===void 0?void 0:r.partPageCounts.get(`rId${n}`),s="w:footnotes"in e||"w:endnotes"in e;Tm(js,e,r.estimate,{blank:!1,sectionPageCount:i,notes:s})},Qk=class extends H{constructor(...e){super(...e),C(this,"xmlKeys",{xmlns:"xmlns"})}},be=class Lm extends I{constructor(){super("Relationships"),this.root.push(new Qk({xmlns:"http://schemas.openxmlformats.org/package/2006/relationships"}))}addRelationship(t,n,r,i){this.root.push(pk(`rId${t}`,n,r,i))}static copy(t){let n=new Lm;return n.root.push(...t.root.slice(1)),n}get RelationshipCount(){return this.root.length-1}},Zk=class extends H{constructor(...e){super(...e),C(this,"xmlKeys",{id:"w:id",initials:"w:initials",author:"w:author",date:"w:date"})}},e1=class extends H{constructor(...e){super(...e),C(this,"xmlKeys",{"xmlns:wpc":"xmlns:wpc","xmlns:cx":"xmlns:cx","xmlns:cx1":"xmlns:cx1","xmlns:cx2":"xmlns:cx2","xmlns:cx3":"xmlns:cx3","xmlns:cx4":"xmlns:cx4","xmlns:cx5":"xmlns:cx5","xmlns:cx6":"xmlns:cx6","xmlns:cx7":"xmlns:cx7","xmlns:cx8":"xmlns:cx8","xmlns:mc":"xmlns:mc","xmlns:aink":"xmlns:aink","xmlns:am3d":"xmlns:am3d","xmlns:o":"xmlns:o","xmlns:r":"xmlns:r","xmlns:m":"xmlns:m","xmlns:v":"xmlns:v","xmlns:wp14":"xmlns:wp14","xmlns:wp":"xmlns:wp","xmlns:w10":"xmlns:w10","xmlns:w":"xmlns:w","xmlns:w14":"xmlns:w14","xmlns:w15":"xmlns:w15","xmlns:w16cex":"xmlns:w16cex","xmlns:w16cid":"xmlns:w16cid","xmlns:w16":"xmlns:w16","xmlns:w16sdtdh":"xmlns:w16sdtdh","xmlns:w16se":"xmlns:w16se","xmlns:wpg":"xmlns:wpg","xmlns:wpi":"xmlns:wpi","xmlns:wne":"xmlns:wne","xmlns:wps":"xmlns:wps","mc:Ignorable":"mc:Ignorable"})}},Zu=class extends I{constructor({id:e,initials:t,author:n,date:r=new Date,children:i},s){super("w:comment"),C(this,"paraId",void 0),this.paraId=s,this.root.push(new Zk({id:e,initials:t,author:n,date:r.toISOString()}));for(let a of i)this.root.push(a)}prepForXml(e){let t=super.prepForXml(e);if(!t||!this.paraId)return t;let n=t["w:comment"];if(!Array.isArray(n))return t;for(let r=n.length-1;r>=0;r--){let i=n[r];if(i&&typeof i=="object"&&"w:p"in i){let s=i["w:p"];Array.isArray(s)&&s.unshift({_attr:{"w14:paraId":this.paraId,"w14:textId":this.paraId}});break}}return t}},t1=e=>(e+1).toString(16).toUpperCase().padStart(8,"0"),n1=class extends I{constructor({children:e}){super("w:comments"),C(this,"relationships",void 0),C(this,"threadData",void 0),C(this,"commentIdsData",void 0),C(this,"isEmpty",void 0),this.isEmpty=e.length===0,this.root.push(new e1({"xmlns:wpc":"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas","xmlns:cx":"http://schemas.microsoft.com/office/drawing/2014/chartex","xmlns:cx1":"http://schemas.microsoft.com/office/drawing/2015/9/8/chartex","xmlns:cx2":"http://schemas.microsoft.com/office/drawing/2015/10/21/chartex","xmlns:cx3":"http://schemas.microsoft.com/office/drawing/2016/5/9/chartex","xmlns:cx4":"http://schemas.microsoft.com/office/drawing/2016/5/10/chartex","xmlns:cx5":"http://schemas.microsoft.com/office/drawing/2016/5/11/chartex","xmlns:cx6":"http://schemas.microsoft.com/office/drawing/2016/5/12/chartex","xmlns:cx7":"http://schemas.microsoft.com/office/drawing/2016/5/13/chartex","xmlns:cx8":"http://schemas.microsoft.com/office/drawing/2016/5/14/chartex","xmlns:mc":"http://schemas.openxmlformats.org/markup-compatibility/2006","xmlns:aink":"http://schemas.microsoft.com/office/drawing/2016/ink","xmlns:am3d":"http://schemas.microsoft.com/office/drawing/2017/model3d","xmlns:o":"urn:schemas-microsoft-com:office:office","xmlns:r":"http://schemas.openxmlformats.org/officeDocument/2006/relationships","xmlns:m":"http://schemas.openxmlformats.org/officeDocument/2006/math","xmlns:v":"urn:schemas-microsoft-com:vml","xmlns:wp14":"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing","xmlns:wp":"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing","xmlns:w10":"urn:schemas-microsoft-com:office:word","xmlns:w":"http://schemas.openxmlformats.org/wordprocessingml/2006/main","xmlns:w14":"http://schemas.microsoft.com/office/word/2010/wordml","xmlns:w15":"http://schemas.microsoft.com/office/word/2012/wordml","xmlns:w16cex":"http://schemas.microsoft.com/office/word/2018/wordml/cex","xmlns:w16cid":"http://schemas.microsoft.com/office/word/2016/wordml/cid","xmlns:w16":"http://schemas.microsoft.com/office/word/2018/wordml","xmlns:w16sdtdh":"http://schemas.microsoft.com/office/word/2020/wordml/sdtdatahash","xmlns:w16se":"http://schemas.microsoft.com/office/word/2015/wordml/symex","xmlns:wpg":"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup","xmlns:wpi":"http://schemas.microsoft.com/office/word/2010/wordprocessingInk","xmlns:wne":"http://schemas.microsoft.com/office/word/2006/wordml","xmlns:wps":"http://schemas.microsoft.com/office/word/2010/wordprocessingShape","mc:Ignorable":"w14 w15 wp14"}));let t=e.some(r=>r.parentId!==void 0),n=e.some(r=>r.durableId!==void 0);if(t||n){let r=new Map(e.map(i=>[i.id,t1(i.id)]));for(let i of e)this.root.push(new Zu(i,r.get(i.id)));t&&(this.threadData=e.map(i=>({paraId:r.get(i.id),parentParaId:i.parentId!==void 0?r.get(i.parentId):void 0,done:i.resolved}))),n&&(this.commentIdsData=e.map(i=>{var s;return{paraId:r.get(i.id),durableId:(s=i.durableId)!==null&&s!==void 0?s:r.get(i.id)}}))}else for(let r of e)this.root.push(new Zu(r));this.relationships=new be}get Relationships(){return this.relationships}get ThreadData(){return this.threadData}get CommentIdsData(){return this.commentIdsData}get IsEmpty(){return this.isEmpty}prepForXml(e){let t=super.prepForXml(e);return jr(t,e),t}},r1=class extends H{constructor(...e){super(...e),C(this,"xmlKeys",{"xmlns:wpc":"xmlns:wpc","xmlns:mc":"xmlns:mc","xmlns:w15":"xmlns:w15","mc:Ignorable":"mc:Ignorable"})}},i1=class extends H{constructor(...e){super(...e),C(this,"xmlKeys",{paraId:"w15:paraId",paraIdParent:"w15:paraIdParent",done:"w15:done"})}},s1=class extends I{constructor(e){super("w15:commentEx"),this.root.push(new i1({paraId:e.paraId,paraIdParent:e.parentParaId,done:e.done!==void 0?e.done?"1":"0":void 0}))}},a1=class extends I{constructor(e){super("w15:commentsEx"),this.root.push(new r1({"xmlns:wpc":"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas","xmlns:mc":"http://schemas.openxmlformats.org/markup-compatibility/2006","xmlns:w15":"http://schemas.microsoft.com/office/word/2012/wordml","mc:Ignorable":"w15"}));for(let t of e)this.root.push(new s1(t))}},o1=class extends H{constructor(...e){super(...e),C(this,"xmlKeys",{paraId:"w16cid:paraId",durableId:"w16cid:durableId"})}},l1=class extends I{constructor(e){super("w16cid:commentId"),this.root.push(new o1({paraId:e.paraId,durableId:e.durableId}))}},c1=class extends H{constructor(...e){super(...e),C(this,"xmlKeys",{"xmlns:w16cid":"xmlns:w16cid","xmlns:mc":"xmlns:mc","mc:Ignorable":"mc:Ignorable"})}},d1=class extends I{constructor(e){super("w16cid:commentsIds"),this.root.push(new c1({"xmlns:w16cid":"http://schemas.microsoft.com/office/word/2016/wordml/cid","xmlns:mc":"http://schemas.openxmlformats.org/markup-compatibility/2006","mc:Ignorable":"w16cid"}));for(let t of e)this.root.push(new l1(t))}},p1=class extends am{constructor(){super("w:endnoteRef")}},Ws=class extends am{constructor(){super("w:tab")}},u1={COLUMN:"column",PAGE:"page"},h1=class extends I{constructor(e){super("w:br"),this.root.push(new _e({type:e}))}},Mm=class extends Fe{constructor(){super({}),this.root.push(new h1(u1.PAGE))}},m1=class extends I{constructor(){super("w:pageBreakBefore")}},Pn={AT_LEAST:"atLeast",EXACTLY:"exactly",EXACT:"exact",AUTO:"auto"},f1=({after:e,before:t,line:n,lineRule:r,beforeAutoSpacing:i,afterAutoSpacing:s})=>new O({name:"w:spacing",attributes:{after:{key:"w:after",value:e},before:{key:"w:before",value:t},line:{key:"w:line",value:n},lineRule:{key:"w:lineRule",value:r},beforeAutoSpacing:{key:"w:beforeAutospacing",value:i},afterAutoSpacing:{key:"w:afterAutospacing",value:s}}}),Ks={HEADING_1:"Heading1",HEADING_2:"Heading2",HEADING_3:"Heading3",HEADING_4:"Heading4",HEADING_5:"Heading5",HEADING_6:"Heading6",TITLE:"Title"},Cr=e=>new O({name:"w:pStyle",attributes:{val:{key:"w:val",value:e}}}),eh={LEFT:"left",RIGHT:"right",CENTER:"center",BAR:"bar",CLEAR:"clear",DECIMAL:"decimal",END:"end",NUM:"num",START:"start"},g1={DOT:"dot",HYPHEN:"hyphen",MIDDLE_DOT:"middleDot",NONE:"none",UNDERSCORE:"underscore"},b1=({type:e,position:t,leader:n})=>new O({name:"w:tab",attributes:{val:{key:"w:val",value:e},pos:{key:"w:pos",value:rt(t)},leader:{key:"w:leader",value:n}}}),v1=e=>new O({name:"w:tabs",children:e.map(t=>b1(t))}),vs=class extends I{constructor(e,t){super("w:numPr"),this.root.push(new w1(t)),this.root.push(new y1(e))}},w1=class extends I{constructor(e){if(super("w:ilvl"),e>9)throw new Error("Level cannot be greater than 9. Read more here: https://answers.microsoft.com/en-us/msoffice/forum/all/does-word-support-more-than-9-list-levels/d130fdcd-1781-446d-8c84-c6c79124e4d7");this.root.push(new _e({val:e}))}},y1=class extends I{constructor(e){super("w:numId"),this.root.push(new _e({val:typeof e=="string"?`{${e}}`:e}))}},dc=class extends I{constructor(...e){super(...e),C(this,"fileChild",Symbol())}},x1=class extends H{constructor(...e){super(...e),C(this,"xmlKeys",{id:"r:id",history:"w:history",anchor:"w:anchor"})}},pc=class extends I{constructor(e,t,n,r){super("w:hyperlink"),C(this,"linkId",void 0),C(this,"drawingLink",void 0),this.linkId=t,this.drawingLink=n&&r!==void 0?new uk(r):void 0;let i=new x1({history:1,anchor:n||void 0,id:!n||r!==void 0?`rId${this.linkId}`:void 0});this.root.push(i),e.forEach(s=>{this.root.push(s)})}createDrawingClick(e,t){return this.drawingLink?(this.drawingLink.addRelationship(e),this.drawingLink.createClick(t)):bm(this.linkId,t)}},Dm=class extends pc{constructor(e){super(e.children,Ln(),e.anchor)}},k1=class extends I{constructor(e){super("w:externalHyperlink"),C(this,"options",void 0),this.options=e}},T1=class extends H{constructor(...e){super(...e),C(this,"xmlKeys",{id:"w:id",name:"w:name"})}},S1=class extends H{constructor(...e){super(...e),C(this,"xmlKeys",{id:"w:id"})}},Bm=class $m{constructor(t){C(this,"start",void 0),C(this,"children",void 0),C(this,"end",void 0);let n=hm();this.start=new Fm(t.id,n),this.children=t.children,this.end=new qm(n)}get writtenAs(){return[this.start,...this.children.flatMap(t=>t instanceof $m?t.writtenAs:[t]),this.end]}},Fm=class extends I{constructor(e,t){super("w:bookmarkStart");let n=new T1({name:e,id:t});this.root.push(n)}},qm=class extends I{constructor(e){super("w:bookmarkEnd");let t=new S1({id:e});this.root.push(t)}},C1=e=>new O({name:"w:outlineLvl",attributes:{val:{key:"w:val",value:e}}}),E1=class extends I{constructor(e,t={}){super("w:instrText"),this.root.push(new qt({space:Ft.PRESERVE}));let n=`PAGEREF ${e}`;t.hyperlink&&(n=`${n} \\h`),t.useRelativePosition&&(n=`${n} \\p`),this.root.push(n)}},A1=class extends Fe{constructor(e,t={}){super({children:[um(),new E1(e,t),nn(),rn()]})}},_1=255,Hm=e=>{let t=e.indexOf("#"),n=e.length-t-1;return t>0&&n>0&&n<=_1?{target:e.slice(0,t),anchor:e.slice(t+1)}:{target:e}},Os=(e,t,n)=>n===void 0?`${e}-${t}`:`${e}-restart ${n}`,ws=({id:e,fontKey:t,subsetted:n},r)=>new O({name:r,attributes:k({id:{key:"r:id",value:e}},t?{fontKey:{key:"w:fontKey",value:`{${t.toUpperCase()}}`}}:{}),children:[...n?[new P("w:subsetted",n)]:[]]}),N1=({name:e,altName:t,panose1:n,charset:r,family:i,notTrueType:s,pitch:a,sig:o,embedRegular:c,embedBold:l,embedItalic:u,embedBoldItalic:d})=>new O({name:"w:font",attributes:{name:{key:"w:name",value:e}},children:[...t?[vr("w:altName",t)]:[],...n?[vr("w:panose1",n)]:[],...r?[vr("w:charset",r)]:[],...i?[vr("w:family",i)]:[],...s?[new P("w:notTrueType",s)]:[],...a?[vr("w:pitch",a)]:[],...o?[new O({name:"w:sig",attributes:{usb0:{key:"w:usb0",value:o.usb0},usb1:{key:"w:usb1",value:o.usb1},usb2:{key:"w:usb2",value:o.usb2},usb3:{key:"w:usb3",value:o.usb3},csb0:{key:"w:csb0",value:o.csb0},csb1:{key:"w:csb1",value:o.csb1}}})]:[],...c?[ws(c,"w:embedRegular")]:[],...l?[ws(l,"w:embedBold")]:[],...u?[ws(u,"w:embedItalic")]:[],...d?[ws(d,"w:embedBoldItalic")]:[]]}),I1=({name:e,characterSet:t,embedRegular:n,embedBold:r,embedItalic:i,embedBoldItalic:s})=>N1({name:e,sig:{usb0:"E0002AFF",usb1:"C000247B",usb2:"00000009",usb3:"00000000",csb0:"000001FF",csb1:"00000000"},charset:t,family:"auto",pitch:"variable",embedRegular:n,embedBold:r,embedItalic:i,embedBoldItalic:s}),P1=e=>new O({name:"w:fonts",attributes:{mc:{key:"xmlns:mc",value:"http://schemas.openxmlformats.org/markup-compatibility/2006"},r:{key:"xmlns:r",value:"http://schemas.openxmlformats.org/officeDocument/2006/relationships"},w:{key:"xmlns:w",value:"http://schemas.openxmlformats.org/wordprocessingml/2006/main"},w14:{key:"xmlns:w14",value:"http://schemas.microsoft.com/office/word/2010/wordml"},w15:{key:"xmlns:w15",value:"http://schemas.microsoft.com/office/word/2012/wordml"},w16cex:{key:"xmlns:w16cex",value:"http://schemas.microsoft.com/office/word/2018/wordml/cex"},w16cid:{key:"xmlns:w16cid",value:"http://schemas.microsoft.com/office/word/2016/wordml/cid"},w16:{key:"xmlns:w16",value:"http://schemas.microsoft.com/office/word/2018/wordml"},w16sdtdh:{key:"xmlns:w16sdtdh",value:"http://schemas.microsoft.com/office/word/2020/wordml/sdtdatahash"},w16se:{key:"xmlns:w16se",value:"http://schemas.microsoft.com/office/word/2015/wordml/symex"},Ignorable:{key:"mc:Ignorable",value:"w14 w15 w16se w16cid w16 w16cex w16sdtdh"}},children:e.map(I1)}),O1=[{option:"data",element:"embedRegular",bold:!1,italic:!1},{option:"bold",element:"embedBold",bold:!0,italic:!1},{option:"italic",element:"embedItalic",bold:!1,italic:!0},{option:"boldItalic",element:"embedBoldItalic",bold:!0,italic:!0}],Um=class{constructor(e){C(this,"options",void 0),C(this,"fontTable",void 0),C(this,"relationships",void 0),C(this,"fontOptionsWithKey",[]),C(this,"files",[]),this.options=e;let t=e.map(n=>O1.flatMap(({option:r,element:i,bold:s,italic:a})=>{let o=n[r];return o?[{element:i,file:{name:n.name,data:o,bold:s,italic:a,fontKey:mm()}}]:[]}));this.files=t.flatMap(n=>n.map(({file:r})=>r)),this.fontOptionsWithKey=e.map((n,r)=>k(k({},n),{},{fontKey:t[r][0].file.fontKey})),this.fontTable=P1(e.map((n,r)=>k({name:n.name,characterSet:n.characterSet},Object.fromEntries(t[r].map(({element:i,file:s})=>[i,{id:`rId${this.files.indexOf(s)+1}`,fontKey:s.fontKey}]))))),this.relationships=new be;for(let n=0;n<this.files.length;n++)this.relationships.addRelationship(n+1,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/font",`fonts/font${n+1}.odttf`)}get View(){return this.fontTable}get Relationships(){return this.relationships}},R1=()=>new O({name:"w:wordWrap",attributes:{val:{key:"w:val",value:0}}}),L1=e=>{var t,n;return new O({name:"w:framePr",attributes:{anchorLock:{key:"w:anchorLock",value:e.anchorLock},dropCap:{key:"w:dropCap",value:e.dropCap},width:{key:"w:w",value:e.width},height:{key:"w:h",value:e.height},x:{key:"w:x",value:e.position?e.position.x:void 0},y:{key:"w:y",value:e.position?e.position.y:void 0},anchorHorizontal:{key:"w:hAnchor",value:e.anchor.horizontal},anchorVertical:{key:"w:vAnchor",value:e.anchor.vertical},spaceHorizontal:{key:"w:hSpace",value:(t=e.space)===null||t===void 0?void 0:t.horizontal},spaceVertical:{key:"w:vSpace",value:(n=e.space)===null||n===void 0?void 0:n.vertical},rule:{key:"w:hRule",value:e.rule},alignmentX:{key:"w:xAlign",value:e.alignment?e.alignment.x:void 0},alignmentY:{key:"w:yAlign",value:e.alignment?e.alignment.y:void 0},lines:{key:"w:lines",value:e.lines},wrap:{key:"w:wrap",value:e.wrap}}})},rl=new WeakMap,M1=Rn(),D1={left:"right",right:"left"},On=class extends kt{constructor(e,{implicitListParagraphStyle:t=!0,inListOrder:n=!0}={}){if(super("w:pPr",e?.includeIfEmpty),C(this,"numbering",void 0),C(this,"numberProperties",void 0),!e)return this;if(e.heading&&this.push(Cr(e.heading)),t&&(e.bullet&&this.push(Cr("ListParagraph")),e.numbering&&!e.numbering.custom&&!e.style&&!e.heading&&this.push(Cr("ListParagraph"))),e.style&&this.push(Cr(e.style)),e.keepNext!==void 0&&this.push(new P("w:keepNext",e.keepNext)),e.keepLines!==void 0&&this.push(new P("w:keepLines",e.keepLines)),e.pageBreakBefore&&this.push(new m1),e.frame&&this.push(L1(e.frame)),e.widowControl!==void 0&&this.push(new P("w:widowControl",e.widowControl)),e.bullet&&this.push(new vs(1,e.bullet.level)),e.numbering){let{reference:i,instance:s,level:a,restart:o}=e.numbering,c=typeof i=="string"?i:i.reference,l=new vs(Os(c,s??0),a);this.numbering={reference:c,level:a,instance:s,restartedListId:o&&n&&s===void 0?M1():void 0,definition:typeof i=="string"?void 0:i},this.numberProperties=l,this.push(l)}else e.numbering===!1&&this.push(new vs(0,0));e.border&&this.push(new Tx(e.border)),e.thematicBreak&&this.push(new Sx),e.shading&&this.push(Us(e.shading)),e.wordWrap&&this.push(R1()),e.overflowPunctuation&&this.push(new P("w:overflowPunct",e.overflowPunctuation));let r=[...e.rightTabStop!==void 0?[{type:eh.RIGHT,position:e.rightTabStop}]:[],...e.tabStops?e.tabStops:[],...e.leftTabStop!==void 0?[{type:eh.LEFT,position:e.leftTabStop}]:[]];r.length>0&&this.push(v1(r)),e.bidirectional!==void 0&&this.push(new P("w:bidi",e.bidirectional)),e.spacing&&this.push(f1(e.spacing)),e.indent&&this.push(Cx(e.indent)),e.contextualSpacing!==void 0&&this.push(new P("w:contextualSpacing",e.contextualSpacing)),e.alignment&&this.push(om(e.bidirectional&&D1[e.alignment]||e.alignment)),e.outlineLevel!==void 0&&this.push(C1(e.outlineLevel)),e.suppressLineNumbers!==void 0&&this.push(new P("w:suppressLineNumbers",e.suppressLineNumbers)),e.autoSpaceEastAsianText!==void 0&&this.push(new P("w:autoSpaceDN",e.autoSpaceEastAsianText)),e.run&&this.push(new lk(e.run)),e.revision&&this.push(new th(e.revision))}push(e){this.root.push(e)}addSectionProperties(e){let t=this.root.findIndex(n=>n instanceof th);if(t===-1){this.root.push(e);return}this.root.splice(t,0,e)}removeSectionProperties(e){let t=this.root.indexOf(e);t!==-1&&this.root.splice(t,1)}prepForXml(e){var t;if(this.numbering){var n,r;let{reference:a,level:o,instance:c=0,definition:l}=this.numbering,u=this.numbering.instance===void 0?(n=this.numbering.restartedListId)!==null&&n!==void 0?n:(r=rl.get(e))===null||r===void 0?void 0:r.get(a):void 0;e.viewWrapper instanceof Um||e.file.Numbering.createConcreteNumberingInstance(a,c,l,u);let d=new vs(Os(a,c,u),o);this.root.splice(this.root.indexOf(this.numberProperties),1,d),this.numberProperties=d}let i=super.prepForXml(e);if(((t=this.numbering)===null||t===void 0?void 0:t.restartedListId)!==void 0){var s;rl.set(e,new Map([...(s=rl.get(e))!==null&&s!==void 0?s:[],[this.numbering.reference,this.numbering.restartedListId]]))}return i}},th=class extends I{constructor(e){super("w:pPrChange"),this.root.push(new qe({id:e.id,author:e.author,date:e.date})),this.root.push(new On(k(k({},e),{},{includeIfEmpty:!0}),{inListOrder:!1}))}},ne=class jm extends dc{constructor(t){if(super("w:p"),C(this,"options",void 0),C(this,"properties",void 0),C(this,"alignment",void 0),this.options=typeof t=="string"?{text:t}:t,typeof t=="string")return this.alignment={},this.properties=new On({}),this.root.push(this.properties),this.root.push(new Oe(t)),this;if(this.alignment={alignment:t.alignment,bidirectional:t.bidirectional},this.properties=new On(t),this.root.push(this.properties),t.text&&this.root.push(new Oe(t.text)),t.children)for(let n of t.children){if(n instanceof Bm){this.root.push(...n.writtenAs);continue}this.root.push(n)}}prepForXml(t){for(let n of this.root)if(Fs(n)==="w:externalHyperlink"){let r=this.root.indexOf(n),{options:i}=n,{target:s,anchor:a}=Hm(i.link),o=new pc(i.children,Ln(),a,i.link);t.viewWrapper.Relationships.addRelationship(o.linkId,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink",s,ic.EXTERNAL),this.root[r]=o}return super.prepForXml(t)}addSectionProperties(t){this.properties.addSectionProperties(t)}removeSectionProperties(t){this.properties.removeSectionProperties(t)}get Alignment(){return this.alignment}with(t){return new jm(k(k({},this.options),t))}addRunToFront(t){return this.root.splice(1,0,t),this}},B1={TOP:"top",CENTER:"center",BOTTOM:"bottom"},jI=k(k({},B1),{},{BOTH:"both"}),Wm=e=>new O({name:"w:vAlign",attributes:{verticalAlign:{key:"w:val",value:e}}}),$1=({space:e,count:t,separate:n,equalWidth:r,children:i})=>new O({name:"w:cols",attributes:{space:{key:"w:space",value:e===void 0?void 0:ve(e)},count:{key:"w:num",value:t===void 0?void 0:le(t)},separate:{key:"w:sep",value:n},equalWidth:{key:"w:equalWidth",value:r}},children:!r&&i?i:void 0}),F1=({type:e,linePitch:t,charSpace:n})=>new O({name:"w:docGrid",attributes:{type:{key:"w:type",value:e},linePitch:{key:"w:linePitch",value:le(t)},charSpace:{key:"w:charSpace",value:n?le(n):void 0}}}),In={DEFAULT:"default",FIRST:"first",EVEN:"even"},nh={HEADER:"w:headerReference",FOOTER:"w:footerReference"},il=(e,t)=>new O({name:e,attributes:{type:{key:"w:type",value:t.type||In.DEFAULT},id:{key:"r:id",value:`rId${t.id}`}}}),q1=({countBy:e,start:t,restart:n,distance:r})=>new O({name:"w:lnNumType",attributes:{countBy:{key:"w:countBy",value:e===void 0?void 0:le(e)},start:{key:"w:start",value:t===void 0?void 0:le(t)},restart:{key:"w:restart",value:n},distance:{key:"w:distance",value:r===void 0?void 0:ve(r)}}}),Km=({name:e,position:t,numberFormat:n,start:r,restart:i})=>new O({name:e,children:[...t===void 0?[]:[new O({name:"w:pos",attributes:{val:{key:"w:val",value:t}}})],...n?[new O({name:"w:numFmt",attributes:{val:{key:"w:val",value:n.type},format:{key:"w:format",value:n.format}}})]:[],...r===void 0?[]:[new O({name:"w:numStart",attributes:{val:{key:"w:val",value:le(r)}}})],...i===void 0?[]:[new O({name:"w:numRestart",attributes:{val:{key:"w:val",value:i}}})]]}),H1=e=>Km(k({name:"w:footnotePr"},e)),U1=e=>Km(k({name:"w:endnotePr"},e)),rh=class extends H{constructor(...e){super(...e),C(this,"xmlKeys",{display:"w:display",offsetFrom:"w:offsetFrom",zOrder:"w:zOrder"})}},j1=class extends kt{constructor(e){if(super("w:pgBorders"),!e)return this;e.pageBorders?this.root.push(new rh({display:e.pageBorders.display,offsetFrom:e.pageBorders.offsetFrom,zOrder:e.pageBorders.zOrder})):this.root.push(new rh({})),e.pageBorderTop&&this.root.push(ue("w:top",e.pageBorderTop)),e.pageBorderLeft&&this.root.push(ue("w:left",e.pageBorderLeft)),e.pageBorderBottom&&this.root.push(ue("w:bottom",e.pageBorderBottom)),e.pageBorderRight&&this.root.push(ue("w:right",e.pageBorderRight))}},W1=(e,t,n,r,i,s,a)=>new O({name:"w:pgMar",attributes:{top:{key:"w:top",value:rt(e)},right:{key:"w:right",value:ve(t)},bottom:{key:"w:bottom",value:rt(n)},left:{key:"w:left",value:ve(r)},header:{key:"w:header",value:ve(i)},footer:{key:"w:footer",value:ve(s)},gutter:{key:"w:gutter",value:ve(a)}}}),K1={HYPHEN:"hyphen",PERIOD:"period",COLON:"colon",EM_DASH:"emDash",EN_DASH:"endash"},G1=({start:e,formatType:t,separator:n,chapterHeadingLevel:r})=>new O({name:"w:pgNumType",attributes:{start:{key:"w:start",value:e===void 0?void 0:le(e)},formatType:{key:"w:fmt",value:t},separator:{key:"w:chapSep",value:n===K1.EN_DASH?"enDash":n},chapterHeadingLevel:{key:"w:chapStyle",value:r===void 0?void 0:le(r)}}}),Rs={PORTRAIT:"portrait",LANDSCAPE:"landscape"},z1=({width:e,height:t,orientation:n,code:r})=>{let i=ve(e),s=ve(t);return new O({name:"w:pgSz",attributes:{width:{key:"w:w",value:n===Rs.LANDSCAPE?s:i},height:{key:"w:h",value:n===Rs.LANDSCAPE?i:s},orientation:{key:"w:orient",value:n},code:{key:"w:code",value:r}}})},V1=class extends H{constructor(...e){super(...e),C(this,"xmlKeys",{val:"w:val"})}},X1=class extends I{constructor(e){super("w:textDirection"),this.root.push(new V1({val:e}))}},Y1=e=>new O({name:"w:type",attributes:{val:{key:"w:val",value:e}}}),tt={TOP:1440,RIGHT:1440,BOTTOM:1440,LEFT:1440,HEADER:708,FOOTER:708,GUTTER:0},Ss={WIDTH:11906,HEIGHT:16838,ORIENTATION:Rs.PORTRAIT},Il=class Gm extends I{constructor({page:{size:{width:t=Ss.WIDTH,height:n=Ss.HEIGHT,orientation:r=Ss.ORIENTATION,code:i}={},margin:{top:s=tt.TOP,right:a=tt.RIGHT,bottom:o=tt.BOTTOM,left:c=tt.LEFT,header:l=tt.HEADER,footer:u=tt.FOOTER,gutter:d=tt.GUTTER}={},pageNumbers:p={},borders:m,textDirection:f}={},grid:{linePitch:h=360,charSpace:g,type:y}={},headerWrapperGroup:x={},footerWrapperGroup:b={},lineNumbers:E,titlePage:_,verticalAlign:v,column:T,type:w,footnoteProperties:A,endnoteProperties:N,revision:M}={}){super("w:sectPr"),C(this,"availableTextWidth",void 0),this.availableTextWidth=Gm.calculateAvailableTextWidth({pageWidth:r===Rs.LANDSCAPE?n:t,left:c,right:a,gutter:d,column:T}),this.addHeaderFooterGroup(nh.HEADER,x),this.addHeaderFooterGroup(nh.FOOTER,b),A&&this.root.push(H1(A)),N&&this.root.push(U1(N)),w&&this.root.push(Y1(w)),this.root.push(z1({width:t,height:n,orientation:r,code:i})),this.root.push(W1(s,a,o,c,l,u,d)),m&&this.root.push(new j1(m)),E&&this.root.push(q1(E)),this.root.push(G1(p)),T&&this.root.push($1(T)),v&&this.root.push(Wm(v)),_!==void 0&&this.root.push(new P("w:titlePg",_)),f&&this.root.push(new X1(f)),this.root.push(F1({linePitch:h,charSpace:g,type:y})),M&&this.root.push(new J1(M))}get AvailableTextWidth(){return this.availableTextWidth}static calculateAvailableTextWidth({pageWidth:t,left:n,right:r,gutter:i,column:s}){var a,o;let c=$t(t)-$t(n)-$t(r)-$t(i),l=(a=s?.count)!==null&&a!==void 0?a:1;return l<=1?c:(c-$t((o=s?.space)!==null&&o!==void 0?o:720)*(l-1))/l}addHeaderFooterGroup(t,n){n.default&&this.root.push(il(t,{type:In.DEFAULT,id:n.default.View.ReferenceId})),n.first&&this.root.push(il(t,{type:In.FIRST,id:n.first.View.ReferenceId})),n.even&&this.root.push(il(t,{type:In.EVEN,id:n.even.View.ReferenceId}))}},J1=class extends I{constructor(e){super("w:sectPrChange"),this.root.push(new qe({id:e.id,author:e.author,date:e.date})),this.root.push(new Il(e))}},zm=class extends I{constructor({pageNumbers:e}={}){super("w:body"),C(this,"sections",[]),C(this,"sectionParagraphs",new Map),C(this,"headingBookmarkIds",new Nk),C(this,"pageNumbers",void 0),this.pageNumbers=e}getSectionPropertiesFor(e){let t=e?Math.max(this.root.indexOf(e),0):0;for(let n=t;n<this.root.length;n++){let r=this.root[n];if(r instanceof Il)return r;let i=this.sectionParagraphs.get(r);if(i)return i}return this.sections[this.sections.length-1]}addSection(e){let t=this.sections.pop(),n=this.lastParagraphOfSection();if(t&&n)this.sectionParagraphs.set(n,t);else{let r=this.createSectionParagraph();this.root.push(r),t&&this.sectionParagraphs.set(r,t)}this.sections.push(new Il(e))}prepForXml(e){var t;this.sections.length===1&&(this.root.splice(0,1),this.root.push(this.sections.pop()));for(let[i,s]of this.sectionParagraphs)i.addSectionProperties(s);let n;try{n=super.prepForXml(e)}finally{for(let[i,s]of this.sectionParagraphs)i.removeSectionProperties(s)}let r=(t=this.pageNumbers)===null||t===void 0?void 0:t.listNumbers;return Wk(n,e,this.headingBookmarkIds,r&&(i=>r(i,e))),this.pageNumbers&&(Yk(n,e),Jk(n,e,this.pageNumbers)),n}push(e){let t=e instanceof ne?this.sectionParagraphs.get(e):void 0;if(t){let n=this.createSectionParagraph();this.root.splice(this.root.indexOf(e)+1,0,n),this.sectionParagraphs.delete(e),this.sectionParagraphs.set(n,t)}this.root.push(e)}lastParagraphOfSection(){let e=this.root[this.root.length-1];return e instanceof ne&&e!==this.root[0]&&!this.sectionParagraphs.has(e)&&this.root.indexOf(e)===this.root.length-1?e:void 0}createSectionParagraph(){return new ne({})}},$e={AUTO:"auto",DXA:"dxa",NIL:"nil",PERCENTAGE:"pct"},Lr=(e,{type:t=$e.AUTO,size:n})=>{let r=n;return t===$e.PERCENTAGE&&typeof n=="number"&&(r=Math.round(n*50)),new O({name:e,attributes:{type:{key:"w:type",value:t},size:{key:"w:w",value:sm(r)}}})},Cs=Ss.WIDTH-tt.LEFT-tt.RIGHT-tt.GUTTER,Vm=e=>e.options.columnSpan||1,uc=(e,t)=>{if(!e)return;let{type:n=$e.AUTO,size:r}=e;if(n!==$e.PERCENTAGE&&n!==$e.DXA)return;let i=typeof r=="number"?n===$e.PERCENTAGE?r/100*t:r:r.endsWith("%")?Number(r.slice(0,-1))/100*t:$t(r);return i>0?i:void 0},Q1=(e,t)=>{var n;return(n=uc(e,t))!==null&&n!==void 0?n:t},Z1=e=>Math.max(0,...e.map(t=>t.cells.reduce((n,r)=>n+Vm(r),0))),ih=({rows:e,width:t,availableWidth:n})=>{let r=Z1(e);if(r===0)return[];let i=Q1(t,n),s=Array.from({length:r},()=>{}),a=[];for(let u of e){let d=0;for(let p of u.cells){let m=Vm(p),f=uc(p.options.width,i);if(f!==void 0)if(m===1){var o,c;(c=s[o=d])!==null&&c!==void 0||(s[o]=f)}else a.push({start:d,span:m,width:f});d+=m}}for(let{start:u,span:d,width:p}of a){let m=Array.from({length:d},(g,y)=>u+y).filter(g=>g<r),f=m.filter(g=>s[g]===void 0),h=p-m.reduce((g,y)=>{var x;return g+((x=s[y])!==null&&x!==void 0?x:0)},0);if(f.length>0&&h>0)for(let g of f)s[g]=h/f.length}let l=s.flatMap((u,d)=>u===void 0?[d]:[]);if(l.length>0){let u=i-s.reduce((p,m)=>p+(m??0),0),d=u>0?u/l.length:i/r;for(let p of l)s[p]=d}return s.map(u=>Math.round(u))},eT=e=>new O({name:"w:gridCol",attributes:e!==void 0?{width:{key:"w:w",value:ve(e)}}:void 0}),Es=class extends I{constructor(e,t){super("w:tblGrid");for(let n of e)this.root.push(eT(n));t&&this.root.push(new nT(t))}},tT=class extends H{constructor(...e){super(...e),C(this,"xmlKeys",{id:"w:id"})}},nT=class extends I{constructor(e){super("w:tblGridChange"),this.root.push(new tT({id:e.id})),this.root.push(new Es(e.columnWidths))}},rT=class extends I{constructor(e){super("w:ins"),this.root.push(new qe({id:e.id,author:e.author,date:e.date}))}},iT=class extends I{constructor(e){super("w:del"),this.root.push(new qe({id:e.id,author:e.author,date:e.date}))}},sT=class extends I{constructor(e){super("w:cellIns"),this.root.push(new qe({id:e.id,author:e.author,date:e.date}))}},aT=class extends I{constructor(e){super("w:cellDel"),this.root.push(new qe({id:e.id,author:e.author,date:e.date}))}},oT=class extends H{constructor(...e){super(...e),C(this,"xmlKeys",{id:"w:id",author:"w:author",date:"w:date",verticalMerge:"w:vMerge",verticalMergeOriginal:"w:vMergeOrig"})}},lT=class extends I{constructor(e){super("w:cellMerge"),this.root.push(new oT(e))}},Xm=({marginUnitType:e=$e.DXA,top:t,left:n,bottom:r,right:i})=>[{name:"w:top",size:t},{name:"w:left",size:n},{name:"w:bottom",size:r},{name:"w:right",size:i}].filter(s=>s.size!==void 0).map(({name:s,size:a})=>Lr(s,{type:e,size:a})),cT=e=>{let t=Xm(e);if(t.length!==0)return new O({name:"w:tblCellMar",children:t})},dT=e=>{let t=Xm(e);if(t.length!==0)return new O({name:"w:tcMar",children:t})},pT=class extends kt{constructor(e){super("w:tcBorders"),e.top&&this.root.push(ue("w:top",e.top)),e.start&&this.root.push(ue("w:start",e.start)),e.left&&this.root.push(ue("w:left",e.left)),e.bottom&&this.root.push(ue("w:bottom",e.bottom)),e.end&&this.root.push(ue("w:end",e.end)),e.right&&this.root.push(ue("w:right",e.right)),e.diagonalDown&&this.root.push(ue("w:tl2br",e.diagonalDown)),e.diagonalUp&&this.root.push(ue("w:tr2bl",e.diagonalUp))}},uT=class extends H{constructor(...e){super(...e),C(this,"xmlKeys",{val:"w:val"})}},hT=class extends I{constructor(e){super("w:gridSpan"),this.root.push(new uT({val:le(e)}))}},Ym={CONTINUE:"continue",RESTART:"restart"},mT=class extends H{constructor(...e){super(...e),C(this,"xmlKeys",{val:"w:val"})}},sh=class extends I{constructor(e){super("w:vMerge"),this.root.push(new mT({val:e}))}},fT=class extends H{constructor(...e){super(...e),C(this,"xmlKeys",{val:"w:val"})}},gT=class extends I{constructor(e){super("w:textDirection"),this.root.push(new fT({val:e}))}},Jm=class extends kt{constructor(e){if(super("w:tcPr",e.includeIfEmpty),C(this,"hasWidth",void 0),C(this,"hasColumnWidth",!1),this.hasWidth=e.width!==void 0,e.width&&this.root.push(Lr("w:tcW",e.width)),e.columnSpan&&this.root.push(new hT(e.columnSpan)),e.verticalMerge?this.root.push(new sh(e.verticalMerge)):e.rowSpan&&e.rowSpan>1&&this.root.push(new sh(Ym.RESTART)),e.borders&&this.root.push(new pT(e.borders)),e.shading&&this.root.push(Us(e.shading)),e.margins){let t=dT(e.margins);t&&this.root.push(t)}e.textDirection&&this.root.push(new gT(e.textDirection)),e.verticalAlign&&this.root.push(Wm(e.verticalAlign)),e.insertion&&this.root.push(new sT(e.insertion)),e.deletion&&this.root.push(new aT(e.deletion)),e.cellMerge&&this.root.push(new lT(e.cellMerge)),e.revision&&this.root.push(new bT(e.revision))}setColumnWidth(e){this.hasWidth||(this.root.splice(0,this.hasColumnWidth?1:0,Lr("w:tcW",{size:e,type:$e.DXA})),this.hasColumnWidth=!0)}},bT=class extends I{constructor(e){super("w:tcPrChange"),this.root.push(new qe({id:e.id,author:e.author,date:e.date})),this.root.push(new Jm(k(k({},e),{},{includeIfEmpty:!0})))}},Mr=class extends I{constructor(e){super("w:tc"),C(this,"options",void 0),C(this,"properties",void 0),this.options=e,this.properties=new Jm(e),this.root.push(this.properties);for(let t of e.children)this.root.push(t)}setColumnWidth(e){this.properties.setColumnWidth(e)}prepForXml(e){return Fs(this.root[this.root.length-1])!=="w:p"&&this.root.push(new ne({})),super.prepForXml(e)}},Pl=(e,t)=>t?new P(e):new it(e,"off"),An={style:Ur.NONE,size:0,color:"auto"},vT={style:Ur.SINGLE,size:4,color:"auto"},Qm=class extends kt{constructor(e,{fillMissingSides:t=!0}={}){super("w:tblBorders");let n=[["w:top",e.top],["w:left",e.left],["w:bottom",e.bottom],["w:right",e.right],["w:insideH",e.insideHorizontal],["w:insideV",e.insideVertical]];for(let[r,i]of n){let s=i??(t?vT:void 0);s&&this.root.push(ue(r,s))}}};C(Qm,"NONE",{top:An,bottom:An,left:An,right:An,insideHorizontal:An,insideVertical:An});sl={CENTER:"center",INSIDE:"inside",LEFT:"left",OUTSIDE:"outside",RIGHT:"right"},wT={CENTER:"center",INSIDE:"inside",BOTTOM:"bottom",OUTSIDE:"outside",INLINE:"inline",TOP:"top"},yT=({horizontalAnchor:e,verticalAnchor:t,absoluteHorizontalPosition:n,relativeHorizontalPosition:r,absoluteVerticalPosition:i,relativeVerticalPosition:s,bottomFromText:a,topFromText:o,leftFromText:c,rightFromText:l})=>new O({name:"w:tblpPr",attributes:{leftFromText:{key:"w:leftFromText",value:c===void 0?void 0:ve(c)},rightFromText:{key:"w:rightFromText",value:l===void 0?void 0:ve(l)},topFromText:{key:"w:topFromText",value:o===void 0?void 0:ve(o)},bottomFromText:{key:"w:bottomFromText",value:a===void 0?void 0:ve(a)},absoluteHorizontalPosition:{key:"w:tblpX",value:n===void 0?void 0:rt(n)},absoluteVerticalPosition:{key:"w:tblpY",value:i===void 0?void 0:rt(i)},horizontalAnchor:{key:"w:horzAnchor",value:e},relativeHorizontalPosition:{key:"w:tblpXSpec",value:r},relativeVerticalPosition:{key:"w:tblpYSpec",value:s},verticalAnchor:{key:"w:vertAnchor",value:t}}}),xT=e=>new O({name:"w:tblLayout",attributes:{type:{key:"w:type",value:e}}}),kT={DXA:"dxa",NIL:"nil"},Zm=({type:e=kT.DXA,value:t})=>new O({name:"w:tblCellSpacing",attributes:{type:{key:"w:type",value:e},value:{key:"w:w",value:sm(t)}}}),TT=({firstRow:e,lastRow:t,firstColumn:n,lastColumn:r,noHBand:i,noVBand:s})=>new O({name:"w:tblLook",attributes:{firstRow:{key:"w:firstRow",value:e},lastRow:{key:"w:lastRow",value:t},firstColumn:{key:"w:firstColumn",value:n},lastColumn:{key:"w:lastColumn",value:r},noHBand:{key:"w:noHBand",value:i},noVBand:{key:"w:noVBand",value:s}}}),ST=e=>new O({name:"w:tblOverlap",attributes:{val:{key:"w:val",value:e}}}),CT={[sl.LEFT]:pe.LEFT,[sl.CENTER]:pe.CENTER,[sl.RIGHT]:pe.RIGHT},hc=class extends kt{constructor(e){var t,n,r;super("w:tblPr",e.includeIfEmpty),e.style&&this.root.push(new it("w:tblStyle",e.style));let i=((t=e.float)===null||t===void 0?void 0:t.relativeVerticalPosition)===wT.INLINE,s=i?void 0:e.float;s&&this.root.push(yT(s)),s?.overlap&&this.root.push(ST(s.overlap)),e.visuallyRightToLeft!==void 0&&this.root.push(Pl("w:bidiVisual",e.visuallyRightToLeft)),e.width&&this.root.push(Lr("w:tblW",e.width));let a=(n=e.alignment)!==null&&n!==void 0?n:i&&(!((r=e.float)===null||r===void 0)&&r.relativeHorizontalPosition)?CT[e.float.relativeHorizontalPosition]:void 0;if(a&&this.root.push(om(a)),e.cellSpacing&&this.root.push(Zm(e.cellSpacing)),e.indent&&this.root.push(Lr("w:tblInd",e.indent)),e.borders&&this.root.push(new Qm(e.borders,{fillMissingSides:!e.style})),e.shading&&this.root.push(Us(e.shading)),e.layout&&this.root.push(xT(e.layout)),e.cellMargin){let o=cT(e.cellMargin);o&&this.root.push(o)}e.tableLook&&this.root.push(TT(e.tableLook)),e.revision&&this.root.push(new ET(e.revision))}},ET=class extends I{constructor(e){super("w:tblPrChange"),this.root.push(new qe({id:e.id,author:e.author,date:e.date})),this.root.push(new hc(k(k({},e),{},{includeIfEmpty:!0})))}},AT=(e,t)=>new O({name:"w:trHeight",attributes:{value:{key:"w:val",value:ve(e)},rule:{key:"w:hRule",value:t}}}),ef=class extends kt{constructor(e){super("w:trPr",e.includeIfEmpty),e.cantSplit!==void 0&&this.root.push(Pl("w:cantSplit",e.cantSplit)),e.tableHeader!==void 0&&this.root.push(Pl("w:tblHeader",e.tableHeader)),e.height&&this.root.push(AT(e.height.value,e.height.rule)),e.cellSpacing&&this.root.push(Zm(e.cellSpacing)),e.insertion&&this.root.push(new rT(e.insertion)),e.deletion&&this.root.push(new iT(e.deletion)),e.revision&&this.root.push(new _T(e.revision))}},_T=class extends I{constructor(e){super("w:trPrChange"),this.root.push(new qe({id:e.id,author:e.author,date:e.date})),this.root.push(new ef(k(k({},e),{},{includeIfEmpty:!0})))}},Ls=(e,t)=>{let n=e[t];return Array.isArray(n)?n:[]},Ar=e=>Object.keys(e)[0],NT=(e,t)=>{let n=Ls(e,"w:p"),r=n.find(o=>Ar(o)==="w:pPr");if(!r)return{"w:p":[{"w:pPr":[t]},...n]};let i=Ls(r,"w:pPr");if(i.some(o=>Ar(o)==="w:keepNext"))return e;let s=i.filter(o=>Ar(o)==="w:pStyle").length,a={"w:pPr":[...i.slice(0,s),t,...i.slice(s)]};return{"w:p":n.map(o=>o===r?a:o)}},Gs=class extends I{constructor(e){super("w:tr"),C(this,"options",void 0),this.options=e,this.root.push(new ef(e));for(let t of e.children)this.root.push(t)}prepForXml(e){if(this.cells.length===0)return;let t=super.prepForXml(e);if(!t||this.options.keepNext===void 0)return t;let n=new P("w:keepNext",this.options.keepNext).prepForXml(e);return{"w:tr":Ls(t,"w:tr").map(r=>Ar(r)==="w:tc"?{"w:tc":Ls(r,"w:tc").map(i=>Ar(i)==="w:p"?NT(i,n):i)}:r)}}get CellCount(){return this.options.children.length}get cells(){return this.root.filter(e=>Fs(e)==="w:tc")}addCellToIndex(e,t){this.root.splice(t+1,0,e)}addCellToColumnIndex(e,t){let n=this.columnIndexToRootIndex(t,!0);this.addCellToIndex(e,n-1)}rootIndexToColumnIndex(e){if(e<1||e>=this.root.length)throw new Error(`cell 'rootIndex' should between 1 to ${this.root.length-1}`);let t=0;for(let n=1;n<e;n++){let r=this.root[n];t+=r.options.columnSpan||1}return t}columnIndexToRootIndex(e,t=!1){if(e<0)throw new Error("cell 'columnIndex' should not less than zero");let n=0,r=1;for(;n<=e;){if(r>=this.root.length){if(t)return this.root.length;throw new Error(`cell 'columnIndex' should not great than ${n-1}`)}let i=this.root[r];r+=1,n+=i&&i.options.columnSpan||1}return r-1}},tf=class nf extends dc{constructor({rows:t,width:n,columnWidths:r,columnWidthsRevision:i,margins:s,indent:a,float:o,layout:c,style:l,borders:u,alignment:d,visuallyRightToLeft:p,tableLook:m,cellSpacing:f,revision:h}){super("w:tbl"),C(this,"rows",void 0),C(this,"width",void 0),C(this,"columnWidths",void 0),C(this,"columnWidthsRevision",void 0),C(this,"resolvedColumnWidths",void 0),this.rows=t,this.width=n??{size:100},this.columnWidths=r,this.columnWidthsRevision=i,t.forEach((g,y)=>{if(y===t.length-1)return;let x=0;g.cells.forEach(b=>{if(b.options.rowSpan&&b.options.rowSpan>1){let E=b.options.children[b.options.children.length-1],_=new Mr({rowSpan:b.options.rowSpan-1,columnSpan:b.options.columnSpan,width:b.options.width,borders:b.options.borders,shading:b.options.shading,margins:b.options.margins,textDirection:b.options.textDirection,verticalAlign:b.options.verticalAlign,children:E instanceof ne?[new ne(E.Alignment)]:[],verticalMerge:Ym.CONTINUE});t[y+1].addCellToColumnIndex(_,x)}x+=b.options.columnSpan||1})}),this.setCellWidths(Cs),this.resolvedColumnWidths=r??ih({rows:t,width:this.width,availableWidth:Cs}),this.root.push(new hc({borders:l?u:u??{},width:this.width,indent:a,float:o,layout:c,style:l,alignment:d,cellMargin:s,visuallyRightToLeft:p,tableLook:m,cellSpacing:f,revision:h})),this.root.push(new Es(this.resolvedColumnWidths,i));for(let g of t)this.root.push(g)}get ColumnWidths(){return this.resolvedColumnWidths}getCellWidth(t,n){let{cells:r}=t,i=r.indexOf(n);if(i===-1)return;let s=r.slice(0,i).reduce((o,c)=>o+(c.options.columnSpan||1),0),a=this.resolvedColumnWidths.slice(s,s+(n.options.columnSpan||1));return a.length===0?void 0:a.reduce((o,c)=>o+c,0)}prepForXml(t){if(this.setCellWidths(this.resolveAvailableWidth(t)),this.columnWidths===void 0){this.resolvedColumnWidths=ih({rows:this.rows,width:this.width,availableWidth:this.resolveAvailableWidth(t)});let n=this.root.findIndex(r=>r instanceof Es);this.root[n]=new Es(this.resolvedColumnWidths,this.columnWidthsRevision)}return super.prepForXml(t)}setCellWidths(t){var n;if(this.columnWidths===void 0)return;let r=this.columnWidths.reduce((a,o)=>a+o,0),i=(n=uc(this.width,t))!==null&&n!==void 0?n:0,s=r>0&&i>r?i/r:1;for(let a of this.rows){let o=0;for(let c of a.cells){let l=c.options.columnSpan||1,u=this.columnWidths.slice(o,o+l),d=Math.round(u.reduce((p,m)=>p+m,0)*s);u.length===l&&d>0&&c.setColumnWidth(d),o+=l}}}resolveAvailableWidth(t){var n,r,i;let{stack:s}=t,a=s[s.length-1],o=s[s.length-2],c=s[s.length-3];if(a instanceof Mr&&o instanceof Gs&&c instanceof nf){let p=c.getCellWidth(o,a);if(p!==void 0)return p}let l=s.findIndex(p=>p instanceof zm),u=(n=t.file)===null||n===void 0||(n=n.Document)===null||n===void 0?void 0:n.View.Body,d=l>=0?s[l].getSectionPropertiesFor((r=s[l+1])!==null&&r!==void 0?r:this):u?.getSectionPropertiesFor();return(i=d?.AvailableTextWidth)!==null&&i!==void 0?i:Cs}},IT=class extends H{constructor(...e){super(...e),C(this,"xmlKeys",{xmlns:"xmlns",vt:"xmlns:vt"})}},PT=class extends I{constructor(){super("Properties"),this.root.push(new IT({xmlns:"http://schemas.openxmlformats.org/officeDocument/2006/extended-properties",vt:"http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes"}))}},OT=class extends H{constructor(...e){super(...e),C(this,"xmlKeys",{xmlns:"xmlns"})}},bt=(e,t)=>new O({name:"Default",attributes:{contentType:{key:"ContentType",value:e},extension:{key:"Extension",value:t}}}),ge=(e,t)=>new O({name:"Override",attributes:{contentType:{key:"ContentType",value:e},partName:{key:"PartName",value:t}}}),RT=class extends I{constructor({macros:e=!1}={}){super("Types"),this.root.push(new OT({xmlns:"http://schemas.openxmlformats.org/package/2006/content-types"})),this.root.push(bt("image/png","png")),this.root.push(bt("image/jpeg","jpeg")),this.root.push(bt("image/jpeg","jpg")),this.root.push(bt("image/bmp","bmp")),this.root.push(bt("image/gif","gif")),this.root.push(bt("image/svg+xml","svg")),this.root.push(bt("application/vnd.openxmlformats-package.relationships+xml","rels")),this.root.push(bt("application/xml","xml")),this.root.push(bt("application/vnd.openxmlformats-officedocument.obfuscatedFont","odttf")),this.root.push(ge(e?"application/vnd.ms-word.document.macroEnabled.main+xml":"application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml","/word/document.xml")),this.root.push(ge("application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml","/word/styles.xml")),this.root.push(ge("application/vnd.openxmlformats-package.core-properties+xml","/docProps/core.xml")),this.root.push(ge("application/vnd.openxmlformats-officedocument.custom-properties+xml","/docProps/custom.xml")),this.root.push(ge("application/vnd.openxmlformats-officedocument.extended-properties+xml","/docProps/app.xml")),this.root.push(ge("application/vnd.openxmlformats-officedocument.wordprocessingml.numbering+xml","/word/numbering.xml")),this.root.push(ge("application/vnd.openxmlformats-officedocument.wordprocessingml.footnotes+xml","/word/footnotes.xml")),this.root.push(ge("application/vnd.openxmlformats-officedocument.wordprocessingml.endnotes+xml","/word/endnotes.xml")),this.root.push(ge("application/vnd.openxmlformats-officedocument.wordprocessingml.settings+xml","/word/settings.xml")),this.root.push(ge("application/vnd.openxmlformats-officedocument.wordprocessingml.fontTable+xml","/word/fontTable.xml")),this.root.push(ge("application/vnd.openxmlformats-officedocument.theme+xml","/word/theme/theme1.xml")),e&&this.root.push(ge("application/vnd.ms-office.vbaProject","/word/vbaProject.bin"))}addComments(){this.root.push(ge("application/vnd.openxmlformats-officedocument.wordprocessingml.comments+xml","/word/comments.xml"))}addCommentsExtended(){this.root.push(ge("application/vnd.openxmlformats-officedocument.wordprocessingml.commentsExtended+xml","/word/commentsExtended.xml"))}addCommentsIds(){this.root.push(ge("application/vnd.openxmlformats-officedocument.wordprocessingml.commentsIds+xml","/word/commentsIds.xml"))}addFooter(e){this.root.push(ge("application/vnd.openxmlformats-officedocument.wordprocessingml.footer+xml",`/word/footer${e}.xml`))}addOverride(e,t){this.root.push(ge(e,t))}addHeader(e){this.root.push(ge("application/vnd.openxmlformats-officedocument.wordprocessingml.header+xml",`/word/header${e}.xml`))}},Ol={wpc:"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas",mc:"http://schemas.openxmlformats.org/markup-compatibility/2006",o:"urn:schemas-microsoft-com:office:office",r:"http://schemas.openxmlformats.org/officeDocument/2006/relationships",m:"http://schemas.openxmlformats.org/officeDocument/2006/math",v:"urn:schemas-microsoft-com:vml",wp14:"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing",wp:"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing",w10:"urn:schemas-microsoft-com:office:word",w:"http://schemas.openxmlformats.org/wordprocessingml/2006/main",w14:"http://schemas.microsoft.com/office/word/2010/wordml",w15:"http://schemas.microsoft.com/office/word/2012/wordml",wpg:"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup",wpi:"http://schemas.microsoft.com/office/word/2010/wordprocessingInk",wne:"http://schemas.microsoft.com/office/word/2006/wordml",wps:"http://schemas.microsoft.com/office/word/2010/wordprocessingShape",cp:"http://schemas.openxmlformats.org/package/2006/metadata/core-properties",dc:"http://purl.org/dc/elements/1.1/",dcterms:"http://purl.org/dc/terms/",dcmitype:"http://purl.org/dc/dcmitype/",xsi:"http://www.w3.org/2001/XMLSchema-instance",cx:"http://schemas.microsoft.com/office/drawing/2014/chartex",cx1:"http://schemas.microsoft.com/office/drawing/2015/9/8/chartex",cx2:"http://schemas.microsoft.com/office/drawing/2015/10/21/chartex",cx3:"http://schemas.microsoft.com/office/drawing/2016/5/9/chartex",cx4:"http://schemas.microsoft.com/office/drawing/2016/5/10/chartex",cx5:"http://schemas.microsoft.com/office/drawing/2016/5/11/chartex",cx6:"http://schemas.microsoft.com/office/drawing/2016/5/12/chartex",cx7:"http://schemas.microsoft.com/office/drawing/2016/5/13/chartex",cx8:"http://schemas.microsoft.com/office/drawing/2016/5/14/chartex",aink:"http://schemas.microsoft.com/office/drawing/2016/ink",am3d:"http://schemas.microsoft.com/office/drawing/2017/model3d",w16cex:"http://schemas.microsoft.com/office/word/2018/wordml/cex",w16cid:"http://schemas.microsoft.com/office/word/2016/wordml/cid",w16:"http://schemas.microsoft.com/office/word/2018/wordml",w16sdtdh:"http://schemas.microsoft.com/office/word/2020/wordml/sdtdatahash",w16se:"http://schemas.microsoft.com/office/word/2015/wordml/symex"},zs=class extends H{constructor(e,t){super(k({Ignorable:t},Object.fromEntries(e.map(n=>[n,Ol[n]])))),C(this,"xmlKeys",k({Ignorable:"mc:Ignorable"},Object.fromEntries(Object.keys(Ol).map(n=>[n,`xmlns:${n}`]))))}},LT=class extends I{constructor(e){super("cp:coreProperties"),this.root.push(new zs(["cp","dc","dcterms","dcmitype","xsi"])),e.title&&this.root.push(new en("dc:title",e.title)),e.subject&&this.root.push(new en("dc:subject",e.subject)),e.creator&&this.root.push(new en("dc:creator",e.creator)),e.keywords&&this.root.push(new en("cp:keywords",e.keywords)),e.description&&this.root.push(new en("dc:description",e.description)),e.lastModifiedBy&&this.root.push(new en("cp:lastModifiedBy",e.lastModifiedBy)),e.revision&&this.root.push(new en("cp:revision",String(e.revision))),this.root.push(new ah("dcterms:created")),this.root.push(new ah("dcterms:modified"))}},MT=class extends H{constructor(...e){super(...e),C(this,"xmlKeys",{type:"xsi:type"})}},ah=class extends I{constructor(e){super(e),this.root.push(new MT({type:"dcterms:W3CDTF"})),this.root.push(dx(new Date))}},DT=class extends H{constructor(...e){super(...e),C(this,"xmlKeys",{xmlns:"xmlns",vt:"xmlns:vt"})}},BT=class extends H{constructor(...e){super(...e),C(this,"xmlKeys",{formatId:"fmtid",pid:"pid",name:"name"})}},$T=class extends I{constructor(e,t){super("property"),this.root.push(new BT({formatId:"{D5CDD505-2E9C-101B-9397-08002B2CF9AE}",pid:e.toString(),name:t.name})),this.root.push(new FT(t.value))}},FT=class extends I{constructor(e){super("vt:lpwstr"),this.root.push(e)}},qT=class extends I{constructor(e){super("Properties"),C(this,"nextId",void 0),C(this,"properties",[]),this.root.push(new DT({xmlns:"http://schemas.openxmlformats.org/officeDocument/2006/custom-properties",vt:"http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes"})),this.nextId=2;for(let t of e)this.addCustomProperty(t)}prepForXml(e){return this.root.splice(1,this.root.length-1,...this.properties),super.prepForXml(e)}addCustomProperty(e){this.properties.push(new $T(this.nextId++,e))}},HT=e=>new O({name:"ds:datastoreItem",attributes:{itemId:{key:"ds:itemID",value:e},namespace:{key:"xmlns:ds",value:"http://schemas.openxmlformats.org/officeDocument/2006/customXml"}},children:[new O({name:"ds:schemaRefs",children:[new O({name:"ds:schemaRef",attributes:{uri:{key:"ds:uri",value:"http://schemas.openxmlformats.org/officeDocument/2006/bibliography"}}})]})]}),UT={new:"wne:eventDocNew",open:"wne:eventDocOpen",close:"wne:eventDocClose",sync:"wne:eventDocSync",xmlAfterInsert:"wne:eventDocXmlAfterInsert",xmlBeforeDelete:"wne:eventDocXmlBeforeDelete",contentControlAfterAdd:"wne:eventDocContentControlAfterInsert",contentControlBeforeDelete:"wne:eventDocContentControlBeforeDelete",contentControlOnExit:"wne:eventDocContentControlOnExit",contentControlOnEnter:"wne:eventDocContentControlOnEnter",contentControlBeforeStoreUpdate:"wne:eventDocStoreUpdate",contentControlBeforeContentUpdate:"wne:eventDocContentControlContentUpdate",buildingBlockInsert:"wne:eventDocBuildingBlockAfterInsert"},jT=e=>new O({name:"wne:vbaSuppData",attributes:{namespace:{key:"xmlns:wne",value:"http://schemas.microsoft.com/office/word/2006/wordml"}},children:[new O({name:"wne:docEvents",children:Object.entries(UT).filter(([t])=>e.includes(t)).map(([,t])=>new O({name:t}))})]}),WT=class extends I{constructor({color:e,themeColor:t,themeShade:n,themeTint:r}){if(super("w:background"),typeof e=="object"&&(t!==void 0||n!==void 0||r!==void 0))throw new Error("Invalid background. Expected a theme color in color, or themeColor, themeShade and themeTint, not both");this.root.push(new tc([{keys:Hr,color:e},{key:"w:themeColor",value:t},{key:"w:themeShade",value:n===void 0?void 0:zu(n)},{key:"w:themeTint",value:r===void 0?void 0:zu(r)}]))}},KT=class extends I{constructor(e){super("w:document"),C(this,"body",void 0),this.root.push(new zs(["wpc","mc","o","r","m","v","wp14","wp","w10","w","w14","w15","wpg","wpi","wne","wps","cx","cx1","cx2","cx3","cx4","cx5","cx6","cx7","cx8","aink","am3d","w16cex","w16cid","w16","w16sdtdh","w16se"],"w14 w15 wp14")),this.body=new zm({pageNumbers:e.pageNumbers}),e.background&&this.root.push(new WT(e.background)),this.root.push(this.body)}add(e){return this.body.push(e),this}get Body(){return this.body}},GT=class{constructor(e){C(this,"document",void 0),C(this,"relationships",void 0),this.document=new KT(e),this.relationships=new be}get View(){return this.document}get Relationships(){return this.relationships}},zT=class extends H{constructor(...e){super(...e),C(this,"xmlKeys",{wpc:"xmlns:wpc",mc:"xmlns:mc",o:"xmlns:o",r:"xmlns:r",m:"xmlns:m",v:"xmlns:v",wp14:"xmlns:wp14",wp:"xmlns:wp",w10:"xmlns:w10",w:"xmlns:w",w14:"xmlns:w14",w15:"xmlns:w15",wpg:"xmlns:wpg",wpi:"xmlns:wpi",wne:"xmlns:wne",wps:"xmlns:wps",Ignorable:"mc:Ignorable"})}},rf=class extends I{constructor(e,t){super("w:p"),C(this,"paragraph",void 0),C(this,"mark",void 0),this.paragraph=e,this.mark=t}prepForXml(e){let t=this.paragraph.prepForXml(e)["w:p"],n=Array.isArray(t)?t:[],r=n.length>0&&"w:pPr"in n[0]?1:0;return{"w:p":[...n.slice(0,r),this.mark.prepForXml(e),...n.slice(r)]}}},VT=class extends H{constructor(...e){super(...e),C(this,"xmlKeys",{type:"w:type",id:"w:id"})}},sf=class extends Fe{constructor(){super({style:"EndnoteReference"}),this.root.push(new p1)}},oh={SEPARATOR:"separator",CONTINUATION_SEPARATOR:"continuationSeparator"},al=class extends I{constructor(e){super("w:endnote"),this.root.push(new VT({type:e.type,id:e.id}));for(let[t,n]of e.children.entries())this.root.push(t===0?new rf(n,new sf):n)}},XT=class extends I{constructor(){super("w:continuationSeparator")}},af=class extends Fe{constructor(){super({}),this.root.push(new XT)}},YT=class extends I{constructor(){super("w:separator")}},of=class extends Fe{constructor(){super({}),this.root.push(new YT)}},lf=class extends I{constructor(){super("w:endnotes"),C(this,"ownNotes",new Map),C(this,"highestId",0),this.root.push(new zT({wpc:"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas",mc:"http://schemas.openxmlformats.org/markup-compatibility/2006",o:"urn:schemas-microsoft-com:office:office",r:"http://schemas.openxmlformats.org/officeDocument/2006/relationships",m:"http://schemas.openxmlformats.org/officeDocument/2006/math",v:"urn:schemas-microsoft-com:vml",wp14:"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing",wp:"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing",w10:"urn:schemas-microsoft-com:office:word",w:"http://schemas.openxmlformats.org/wordprocessingml/2006/main",w14:"http://schemas.microsoft.com/office/word/2010/wordml",w15:"http://schemas.microsoft.com/office/word/2012/wordml",wpg:"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup",wpi:"http://schemas.microsoft.com/office/word/2010/wordprocessingInk",wne:"http://schemas.microsoft.com/office/word/2006/wordml",wps:"http://schemas.microsoft.com/office/word/2010/wordprocessingShape",Ignorable:"w14 w15 wp14"}));let e=new al({id:-1,type:oh.SEPARATOR,children:[new ne({spacing:{after:0,line:240,lineRule:Pn.AUTO},children:[new of]})]});this.root.push(e);let t=new al({id:0,type:oh.CONTINUATION_SEPARATOR,children:[new ne({spacing:{after:0,line:240,lineRule:Pn.AUTO},children:[new af]})]});this.root.push(t)}createEndnote(e,t){let n=new al({id:e,children:t});this.root.push(n),Number.isFinite(e)&&(this.highestId=Math.max(this.highestId,Math.floor(e)))}idOf(e,t,n){if(n.viewWrapper!==n.file.Document)return;let r=this.ownNotes.get(e);if(r!==void 0)return r;let i=this.highestId+1;return this.createEndnote(i,t.children),this.ownNotes.set(e,i),i}prepForXml(e){let t=super.prepForXml(e);return jr(t,e),t}},JT=class{constructor(){C(this,"endnotes",void 0),C(this,"relationships",void 0),this.endnotes=new lf,this.relationships=new be}get View(){return this.endnotes}get Relationships(){return this.relationships}},QT=class extends H{constructor(...e){super(...e),C(this,"xmlKeys",{wpc:"xmlns:wpc",mc:"xmlns:mc",o:"xmlns:o",r:"xmlns:r",m:"xmlns:m",v:"xmlns:v",wp14:"xmlns:wp14",wp:"xmlns:wp",w10:"xmlns:w10",w:"xmlns:w",w14:"xmlns:w14",w15:"xmlns:w15",wpg:"xmlns:wpg",wpi:"xmlns:wpi",wne:"xmlns:wne",wps:"xmlns:wps",cp:"xmlns:cp",dc:"xmlns:dc",dcterms:"xmlns:dcterms",dcmitype:"xmlns:dcmitype",xsi:"xmlns:xsi",type:"xsi:type"})}},ZT=class extends tm{constructor(e,t){super("w:ftr",t),C(this,"refId",void 0),this.refId=e,t||this.root.push(new QT({wpc:"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas",mc:"http://schemas.openxmlformats.org/markup-compatibility/2006",o:"urn:schemas-microsoft-com:office:office",r:"http://schemas.openxmlformats.org/officeDocument/2006/relationships",m:"http://schemas.openxmlformats.org/officeDocument/2006/math",v:"urn:schemas-microsoft-com:vml",wp14:"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing",wp:"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing",w10:"urn:schemas-microsoft-com:office:word",w:"http://schemas.openxmlformats.org/wordprocessingml/2006/main",w14:"http://schemas.microsoft.com/office/word/2010/wordml",w15:"http://schemas.microsoft.com/office/word/2012/wordml",wpg:"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup",wpi:"http://schemas.microsoft.com/office/word/2010/wordprocessingInk",wne:"http://schemas.microsoft.com/office/word/2006/wordml",wps:"http://schemas.microsoft.com/office/word/2010/wordprocessingShape"}))}get ReferenceId(){return this.refId}add(e){this.root.push(e)}prepForXml(e){let t=super.prepForXml(e);return jr(t,e,this.refId),t}},eS=class{constructor(e,t,n){C(this,"media",void 0),C(this,"footer",void 0),C(this,"relationships",void 0),this.media=e,this.footer=new ZT(t,n),this.relationships=new be}add(e){this.footer.add(e)}addChildElement(e){this.footer.addChildElement(e)}get View(){return this.footer}get Relationships(){return this.relationships}get Media(){return this.media}},tS=class extends H{constructor(...e){super(...e),C(this,"xmlKeys",{type:"w:type",id:"w:id"})}},nS=class extends I{constructor(){super("w:footnoteRef")}},cf=class extends Fe{constructor(){super({style:"FootnoteReference"}),this.root.push(new nS)}},lh={SEPERATOR:"separator",CONTINUATION_SEPERATOR:"continuationSeparator"},ol=class extends I{constructor(e){super("w:footnote"),this.root.push(new tS({type:e.type,id:e.id}));for(let[t,n]of e.children.entries())this.root.push(t===0?new rf(n,new cf):n)}},rS=class extends H{constructor(...e){super(...e),C(this,"xmlKeys",{wpc:"xmlns:wpc",mc:"xmlns:mc",o:"xmlns:o",r:"xmlns:r",m:"xmlns:m",v:"xmlns:v",wp14:"xmlns:wp14",wp:"xmlns:wp",w10:"xmlns:w10",w:"xmlns:w",w14:"xmlns:w14",w15:"xmlns:w15",wpg:"xmlns:wpg",wpi:"xmlns:wpi",wne:"xmlns:wne",wps:"xmlns:wps",Ignorable:"mc:Ignorable"})}},df=class extends I{constructor(){super("w:footnotes"),C(this,"ownNotes",new Map),C(this,"highestId",0),this.root.push(new rS({wpc:"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas",mc:"http://schemas.openxmlformats.org/markup-compatibility/2006",o:"urn:schemas-microsoft-com:office:office",r:"http://schemas.openxmlformats.org/officeDocument/2006/relationships",m:"http://schemas.openxmlformats.org/officeDocument/2006/math",v:"urn:schemas-microsoft-com:vml",wp14:"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing",wp:"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing",w10:"urn:schemas-microsoft-com:office:word",w:"http://schemas.openxmlformats.org/wordprocessingml/2006/main",w14:"http://schemas.microsoft.com/office/word/2010/wordml",w15:"http://schemas.microsoft.com/office/word/2012/wordml",wpg:"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup",wpi:"http://schemas.microsoft.com/office/word/2010/wordprocessingInk",wne:"http://schemas.microsoft.com/office/word/2006/wordml",wps:"http://schemas.microsoft.com/office/word/2010/wordprocessingShape",Ignorable:"w14 w15 wp14"}));let e=new ol({id:-1,type:lh.SEPERATOR,children:[new ne({spacing:{after:0,line:240,lineRule:Pn.AUTO},children:[new of]})]});this.root.push(e);let t=new ol({id:0,type:lh.CONTINUATION_SEPERATOR,children:[new ne({spacing:{after:0,line:240,lineRule:Pn.AUTO},children:[new af]})]});this.root.push(t)}createFootNote(e,t){let n=new ol({id:e,children:t});this.root.push(n),Number.isFinite(e)&&(this.highestId=Math.max(this.highestId,Math.floor(e)))}idOf(e,t,n){if(n.viewWrapper!==n.file.Document)return;let r=this.ownNotes.get(e);if(r!==void 0)return r;let i=this.highestId+1;return this.createFootNote(i,t.children),this.ownNotes.set(e,i),i}prepForXml(e){let t=super.prepForXml(e);return jr(t,e),t}},iS=class{constructor(){C(this,"footnotess",void 0),C(this,"relationships",void 0),this.footnotess=new df,this.relationships=new be}get View(){return this.footnotess}get Relationships(){return this.relationships}},sS=class extends H{constructor(...e){super(...e),C(this,"xmlKeys",{wpc:"xmlns:wpc",mc:"xmlns:mc",o:"xmlns:o",r:"xmlns:r",m:"xmlns:m",v:"xmlns:v",wp14:"xmlns:wp14",wp:"xmlns:wp",w10:"xmlns:w10",w:"xmlns:w",w14:"xmlns:w14",w15:"xmlns:w15",wpg:"xmlns:wpg",wpi:"xmlns:wpi",wne:"xmlns:wne",wps:"xmlns:wps",cp:"xmlns:cp",dc:"xmlns:dc",dcterms:"xmlns:dcterms",dcmitype:"xmlns:dcmitype",xsi:"xmlns:xsi",type:"xsi:type",cx:"xmlns:cx",cx1:"xmlns:cx1",cx2:"xmlns:cx2",cx3:"xmlns:cx3",cx4:"xmlns:cx4",cx5:"xmlns:cx5",cx6:"xmlns:cx6",cx7:"xmlns:cx7",cx8:"xmlns:cx8",w16cid:"xmlns:w16cid",w16se:"xmlns:w16se"})}},aS=class extends tm{constructor(e,t){super("w:hdr",t),C(this,"refId",void 0),this.refId=e,t||this.root.push(new sS({wpc:"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas",mc:"http://schemas.openxmlformats.org/markup-compatibility/2006",o:"urn:schemas-microsoft-com:office:office",r:"http://schemas.openxmlformats.org/officeDocument/2006/relationships",m:"http://schemas.openxmlformats.org/officeDocument/2006/math",v:"urn:schemas-microsoft-com:vml",wp14:"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing",wp:"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing",w10:"urn:schemas-microsoft-com:office:word",w:"http://schemas.openxmlformats.org/wordprocessingml/2006/main",w14:"http://schemas.microsoft.com/office/word/2010/wordml",w15:"http://schemas.microsoft.com/office/word/2012/wordml",wpg:"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup",wpi:"http://schemas.microsoft.com/office/word/2010/wordprocessingInk",wne:"http://schemas.microsoft.com/office/word/2006/wordml",wps:"http://schemas.microsoft.com/office/word/2010/wordprocessingShape",cx:"http://schemas.microsoft.com/office/drawing/2014/chartex",cx1:"http://schemas.microsoft.com/office/drawing/2015/9/8/chartex",cx2:"http://schemas.microsoft.com/office/drawing/2015/10/21/chartex",cx3:"http://schemas.microsoft.com/office/drawing/2016/5/9/chartex",cx4:"http://schemas.microsoft.com/office/drawing/2016/5/10/chartex",cx5:"http://schemas.microsoft.com/office/drawing/2016/5/11/chartex",cx6:"http://schemas.microsoft.com/office/drawing/2016/5/12/chartex",cx7:"http://schemas.microsoft.com/office/drawing/2016/5/13/chartex",cx8:"http://schemas.microsoft.com/office/drawing/2016/5/14/chartex",w16cid:"http://schemas.microsoft.com/office/word/2016/wordml/cid",w16se:"http://schemas.microsoft.com/office/word/2015/wordml/symex"}))}get ReferenceId(){return this.refId}add(e){this.root.push(e)}prepForXml(e){let t=super.prepForXml(e);return jr(t,e,this.refId),t}},oS=class{constructor(e,t,n){C(this,"media",void 0),C(this,"header",void 0),C(this,"relationships",void 0),this.media=e,this.header=new aS(t,n),this.relationships=new be}add(e){return this.header.add(e),this}addChildElement(e){this.header.addChildElement(e)}get View(){return this.header}get Relationships(){return this.relationships}get Media(){return this.media}},lS=()=>{let e=new Map;return t=>{var n;let r=((n=e.get(t))!==null&&n!==void 0?n:0)+1;return e.set(t,r),`media/image${r}.${t}`}},pf=class{constructor(e=lS()){C(this,"map",new Map),C(this,"takePath",void 0),this.takePath=e}addImage(e,t){if(this.map.has(e))return;let n=this.takePath(t.type);this.map.set(e,k(k({},t),{},{fileName:n.slice(n.lastIndexOf("/")+1)}))}get Array(){return Array.from(this.map.values())}get Entries(){return Array.from(this.map.entries())}},vt={DECIMAL:"decimal",UPPER_ROMAN:"upperRoman",LOWER_ROMAN:"lowerRoman",UPPER_LETTER:"upperLetter",LOWER_LETTER:"lowerLetter",ORDINAL:"ordinal",CARDINAL_TEXT:"cardinalText",ORDINAL_TEXT:"ordinalText",HEX:"hex",CHICAGO:"chicago",IDEOGRAPH__DIGITAL:"ideographDigital",JAPANESE_COUNTING:"japaneseCounting",AIUEO:"aiueo",IROHA:"iroha",DECIMAL_FULL_WIDTH:"decimalFullWidth",DECIMAL_HALF_WIDTH:"decimalHalfWidth",JAPANESE_LEGAL:"japaneseLegal",JAPANESE_DIGITAL_TEN_THOUSAND:"japaneseDigitalTenThousand",DECIMAL_ENCLOSED_CIRCLE:"decimalEnclosedCircle",DECIMAL_FULL_WIDTH2:"decimalFullWidth2",AIUEO_FULL_WIDTH:"aiueoFullWidth",IROHA_FULL_WIDTH:"irohaFullWidth",DECIMAL_ZERO:"decimalZero",BULLET:"bullet",GANADA:"ganada",CHOSUNG:"chosung",DECIMAL_ENCLOSED_FULLSTOP:"decimalEnclosedFullstop",DECIMAL_ENCLOSED_PARENTHESES:"decimalEnclosedParen",DECIMAL_ENCLOSED_CIRCLE_CHINESE:"decimalEnclosedCircleChinese",IDEOGRAPH_ENCLOSED_CIRCLE:"ideographEnclosedCircle",IDEOGRAPH_TRADITIONAL:"ideographTraditional",IDEOGRAPH_ZODIAC:"ideographZodiac",IDEOGRAPH_ZODIAC_TRADITIONAL:"ideographZodiacTraditional",TAIWANESE_COUNTING:"taiwaneseCounting",IDEOGRAPH_LEGAL_TRADITIONAL:"ideographLegalTraditional",TAIWANESE_COUNTING_THOUSAND:"taiwaneseCountingThousand",TAIWANESE_DIGITAL:"taiwaneseDigital",CHINESE_COUNTING:"chineseCounting",CHINESE_LEGAL_SIMPLIFIED:"chineseLegalSimplified",CHINESE_COUNTING_THOUSAND:"chineseCountingThousand",KOREAN_DIGITAL:"koreanDigital",KOREAN_COUNTING:"koreanCounting",KOREAN_LEGAL:"koreanLegal",KOREAN_DIGITAL2:"koreanDigital2",VIETNAMESE_COUNTING:"vietnameseCounting",RUSSIAN_LOWER:"russianLower",RUSSIAN_UPPER:"russianUpper",NONE:"none",NUMBER_IN_DASH:"numberInDash",HEBREW1:"hebrew1",HEBREW2:"hebrew2",ARABIC_ALPHA:"arabicAlpha",ARABIC_ABJAD:"arabicAbjad",HINDI_VOWELS:"hindiVowels",HINDI_CONSONANTS:"hindiConsonants",HINDI_NUMBERS:"hindiNumbers",HINDI_COUNTING:"hindiCounting",THAI_LETTERS:"thaiLetters",THAI_NUMBERS:"thaiNumbers",THAI_COUNTING:"thaiCounting",BAHT_TEXT:"bahtText",DOLLAR_TEXT:"dollarText",CUSTOM:"custom"},cS=class extends H{constructor(...e){super(...e),C(this,"xmlKeys",{ilvl:"w:ilvl",tentative:"w:tentative"})}},dS=class extends I{constructor(e){super("w:numFmt"),this.root.push(new _e({val:e}))}},pS=class extends I{constructor(e){super("w:lvlText"),this.root.push(new _e({val:e}))}},uS=e=>{switch(e){case pe.CENTER:return"center";case pe.END:case pe.RIGHT:return"right";default:return"left"}},hS=class extends I{constructor(e){super("w:lvlJc"),this.root.push(new _e({val:uS(e)}))}},mS=class extends I{constructor(e){super("w:suff"),this.root.push(new _e({val:e}))}},fS=class extends I{constructor(){super("w:isLgl")}},gS=class extends I{constructor({level:e,format:t,text:n,alignment:r=pe.START,start:i=1,style:s,suffix:a,isLegalNumberingStyle:o}){if(super("w:lvl"),C(this,"paragraphProperties",void 0),C(this,"runProperties",void 0),this.root.push(new Er("w:start",le(i))),t&&this.root.push(new dS(t)),s?.style&&this.root.push(Cr(s.style)),o&&this.root.push(new fS),a&&this.root.push(new mS(a)),n&&this.root.push(new pS(n)),this.root.push(new hS(r)),this.paragraphProperties=new On(s&&s.paragraph,{implicitListParagraphStyle:!1,inListOrder:!1}),this.runProperties=new sn(s?.run&&k(k({},s.run),{},{highlight:void 0,math:void 0,revision:void 0})),this.root.push(this.paragraphProperties),this.root.push(this.runProperties),e>9)throw new Error("Level cannot be greater than 9. Read more here: https://answers.microsoft.com/en-us/msoffice/forum/all/does-word-support-more-than-9-list-levels/d130fdcd-1781-446d-8c84-c6c79124e4d7");this.root.push(new cS({ilvl:le(e),tentative:1}))}},bS=class extends gS{},vS=class extends I{constructor(e){super("w:multiLevelType"),this.root.push(new _e({val:e}))}},wS=class extends H{constructor(...e){super(...e),C(this,"xmlKeys",{abstractNumId:"w:abstractNumId",restartNumberingAfterBreak:"w15:restartNumberingAfterBreak"})}},ll=class extends I{constructor(e,t){super("w:abstractNum"),C(this,"id",void 0),this.root.push(new wS({abstractNumId:le(e),restartNumberingAfterBreak:0})),this.root.push(new vS("hybridMultilevel")),this.id=e;for(let n of t)this.root.push(new bS(n))}},yS=class extends I{constructor(e){super("w:abstractNumId"),this.root.push(new _e({val:e}))}},xS=class extends H{constructor(...e){super(...e),C(this,"xmlKeys",{numId:"w:numId"})}},ch=class extends I{constructor(e){if(super("w:num"),C(this,"numId",void 0),C(this,"reference",void 0),C(this,"instance",void 0),C(this,"restartedListId",void 0),this.numId=e.numId,this.reference=e.reference,this.instance=e.instance,this.restartedListId=e.restartedListId,this.root.push(new xS({numId:le(e.numId)})),this.root.push(new yS(le(e.abstractNumId))),e.overrideLevels&&e.overrideLevels.length)for(let t of e.overrideLevels)this.root.push(new TS(t.num,t.start))}},kS=class extends H{constructor(...e){super(...e),C(this,"xmlKeys",{ilvl:"w:ilvl"})}},TS=class extends I{constructor(e,t){super("w:lvlOverride"),this.root.push(new kS({ilvl:e})),t!==void 0&&this.root.push(new CS(t))}},SS=class extends H{constructor(...e){super(...e),C(this,"xmlKeys",{val:"w:val"})}},CS=class extends I{constructor(e){super("w:startOverride"),this.root.push(new SS({val:e}))}},uf=class extends I{constructor(e){super("w:numbering"),C(this,"abstractNumberingMap",new Map),C(this,"concreteNumberingMap",new Map),C(this,"referenceConfigMap",new Map),C(this,"abstractNumUniqueNumericId",zx()),C(this,"concreteNumUniqueNumericId",Vx()),this.root.push(new zs(["wpc","mc","o","r","m","v","wp14","wp","w10","w","w14","w15","wpg","wpi","wne","wps"],"w14 w15 wp14"));let t=new ll(this.abstractNumUniqueNumericId(),[{level:0,format:vt.BULLET,text:"\u25CF",alignment:pe.LEFT,style:{paragraph:{indent:{left:ze(.5),hanging:ze(.25)}}}},{level:1,format:vt.BULLET,text:"\u25CB",alignment:pe.LEFT,style:{paragraph:{indent:{left:ze(1),hanging:ze(.25)}}}},{level:2,format:vt.BULLET,text:"\u25A0",alignment:pe.LEFT,style:{paragraph:{indent:{left:2160,hanging:ze(.25)}}}},{level:3,format:vt.BULLET,text:"\u25CF",alignment:pe.LEFT,style:{paragraph:{indent:{left:2880,hanging:ze(.25)}}}},{level:4,format:vt.BULLET,text:"\u25CB",alignment:pe.LEFT,style:{paragraph:{indent:{left:3600,hanging:ze(.25)}}}},{level:5,format:vt.BULLET,text:"\u25A0",alignment:pe.LEFT,style:{paragraph:{indent:{left:4320,hanging:ze(.25)}}}},{level:6,format:vt.BULLET,text:"\u25CF",alignment:pe.LEFT,style:{paragraph:{indent:{left:5040,hanging:ze(.25)}}}},{level:7,format:vt.BULLET,text:"\u25CF",alignment:pe.LEFT,style:{paragraph:{indent:{left:5760,hanging:ze(.25)}}}},{level:8,format:vt.BULLET,text:"\u25CF",alignment:pe.LEFT,style:{paragraph:{indent:{left:6480,hanging:ze(.25)}}}}]);this.concreteNumberingMap.set("default-bullet-numbering",new ch({numId:1,abstractNumId:t.id,reference:"default-bullet-numbering",instance:0,overrideLevels:[{num:0,start:1}]})),this.abstractNumberingMap.set("default-bullet-numbering",t);for(let n of e.config)this.abstractNumberingMap.set(n.reference,new ll(this.abstractNumUniqueNumericId(),n.levels)),this.referenceConfigMap.set(n.reference,n.levels)}prepForXml(e){return this.root.splice(1,this.root.length-1,...this.abstractNumberingMap.values(),...this.concreteNumberingMap.values()),super.prepForXml(e)}createConcreteNumberingInstance(e,t,n,r){var i;n&&!this.abstractNumberingMap.has(n.reference)&&(this.abstractNumberingMap.set(n.reference,new ll(this.abstractNumUniqueNumericId(),n.levels)),this.referenceConfigMap.set(n.reference,n.levels));let s=this.abstractNumberingMap.get(e);if(!s)return;let a=Os(e,t,r);if(this.concreteNumberingMap.has(a))return;let o=(i=this.referenceConfigMap.get(e))!==null&&i!==void 0?i:[{level:0}],c={numId:this.concreteNumUniqueNumericId(),abstractNumId:s.id,reference:e,instance:t,restartedListId:r,overrideLevels:o.map(({level:l,start:u=1})=>({num:l,start:le(u)}))};this.concreteNumberingMap.set(a,new ch(c))}get ConcreteNumbering(){return Array.from(this.concreteNumberingMap.values())}get ReferenceConfig(){return Array.from(this.referenceConfigMap.values())}},hf=class{constructor(e,t=new Set){C(this,"contentTypes",void 0),C(this,"paths",new Map),C(this,"taken",void 0),C(this,"folders",new WeakMap),this.contentTypes=e,this.taken=new Set(t)}add(e){let t=this.paths.get(e);if(t!==void 0)return t;let{folder:n,name:r,extension:i,contentType:s}=e.options,a=this.takePath(n,r,i);return this.paths.set(e,a),this.contentTypes.addOverride(s,`/word/${a}`),a}takePath(e,t,n){let r=1;for(;this.taken.has(`${e}/${t}${r}.${n}`);)r++;let i=`${e}/${t}${r}.${n}`;return this.taken.add(i),i}get Array(){return[...this.paths].map(([e,t])=>({part:e,path:t}))}createRelationships(e){let t=new be;return this.folders.set(t,e.slice(0,e.indexOf("/"))),t}getTarget(e,t){let n=this.folders.get(e);return n===void 0?t:t.startsWith(`${n}/`)?t.slice(n.length+1):`../${t}`}},ES=e=>new O({name:"w:compatSetting",attributes:{version:{key:"w:val",value:e},name:{key:"w:name",value:"compatibilityMode"},uri:{key:"w:uri",value:"http://schemas.microsoft.com/office/word"}}}),AS=class extends I{constructor(e){super("w:compat"),e.useSingleBorderforContiguousCells&&this.root.push(new P("w:useSingleBorderforContiguousCells",e.useSingleBorderforContiguousCells)),e.wordPerfectJustification&&this.root.push(new P("w:wpJustification",e.wordPerfectJustification)),e.noTabStopForHangingIndent&&this.root.push(new P("w:noTabHangInd",e.noTabStopForHangingIndent)),e.noLeading&&this.root.push(new P("w:noLeading",e.noLeading)),e.spaceForUnderline&&this.root.push(new P("w:spaceForUL",e.spaceForUnderline)),e.noColumnBalance&&this.root.push(new P("w:noColumnBalance",e.noColumnBalance)),e.balanceSingleByteDoubleByteWidth&&this.root.push(new P("w:balanceSingleByteDoubleByteWidth",e.balanceSingleByteDoubleByteWidth)),e.noExtraLineSpacing&&this.root.push(new P("w:noExtraLineSpacing",e.noExtraLineSpacing)),e.doNotLeaveBackslashAlone&&this.root.push(new P("w:doNotLeaveBackslashAlone",e.doNotLeaveBackslashAlone)),e.underlineTrailingSpaces&&this.root.push(new P("w:ulTrailSpace",e.underlineTrailingSpaces)),e.doNotExpandShiftReturn&&this.root.push(new P("w:doNotExpandShiftReturn",e.doNotExpandShiftReturn)),e.spacingInWholePoints&&this.root.push(new P("w:spacingInWholePoints",e.spacingInWholePoints)),e.lineWrapLikeWord6&&this.root.push(new P("w:lineWrapLikeWord6",e.lineWrapLikeWord6)),e.printBodyTextBeforeHeader&&this.root.push(new P("w:printBodyTextBeforeHeader",e.printBodyTextBeforeHeader)),e.printColorsBlack&&this.root.push(new P("w:printColBlack",e.printColorsBlack)),e.spaceWidth&&this.root.push(new P("w:wpSpaceWidth",e.spaceWidth)),e.showBreaksInFrames&&this.root.push(new P("w:showBreaksInFrames",e.showBreaksInFrames)),e.subFontBySize&&this.root.push(new P("w:subFontBySize",e.subFontBySize)),e.suppressBottomSpacing&&this.root.push(new P("w:suppressBottomSpacing",e.suppressBottomSpacing)),e.suppressTopSpacing&&this.root.push(new P("w:suppressTopSpacing",e.suppressTopSpacing)),e.suppressSpacingAtTopOfPage&&this.root.push(new P("w:suppressSpacingAtTopOfPage",e.suppressSpacingAtTopOfPage)),e.suppressTopSpacingWP&&this.root.push(new P("w:suppressTopSpacingWP",e.suppressTopSpacingWP)),e.suppressSpBfAfterPgBrk&&this.root.push(new P("w:suppressSpBfAfterPgBrk",e.suppressSpBfAfterPgBrk)),e.swapBordersFacingPages&&this.root.push(new P("w:swapBordersFacingPages",e.swapBordersFacingPages)),e.convertMailMergeEsc&&this.root.push(new P("w:convMailMergeEsc",e.convertMailMergeEsc)),e.truncateFontHeightsLikeWP6&&this.root.push(new P("w:truncateFontHeightsLikeWP6",e.truncateFontHeightsLikeWP6)),e.macWordSmallCaps&&this.root.push(new P("w:mwSmallCaps",e.macWordSmallCaps)),e.usePrinterMetrics&&this.root.push(new P("w:usePrinterMetrics",e.usePrinterMetrics)),e.doNotSuppressParagraphBorders&&this.root.push(new P("w:doNotSuppressParagraphBorders",e.doNotSuppressParagraphBorders)),e.wrapTrailSpaces&&this.root.push(new P("w:wrapTrailSpaces",e.wrapTrailSpaces)),e.footnoteLayoutLikeWW8&&this.root.push(new P("w:footnoteLayoutLikeWW8",e.footnoteLayoutLikeWW8)),e.shapeLayoutLikeWW8&&this.root.push(new P("w:shapeLayoutLikeWW8",e.shapeLayoutLikeWW8)),e.alignTablesRowByRow&&this.root.push(new P("w:alignTablesRowByRow",e.alignTablesRowByRow)),e.forgetLastTabAlignment&&this.root.push(new P("w:forgetLastTabAlignment",e.forgetLastTabAlignment)),e.adjustLineHeightInTable&&this.root.push(new P("w:adjustLineHeightInTable",e.adjustLineHeightInTable)),e.autoSpaceLikeWord95&&this.root.push(new P("w:autoSpaceLikeWord95",e.autoSpaceLikeWord95)),e.noSpaceRaiseLower&&this.root.push(new P("w:noSpaceRaiseLower",e.noSpaceRaiseLower)),e.doNotUseHTMLParagraphAutoSpacing&&this.root.push(new P("w:doNotUseHTMLParagraphAutoSpacing",e.doNotUseHTMLParagraphAutoSpacing)),e.layoutRawTableWidth&&this.root.push(new P("w:layoutRawTableWidth",e.layoutRawTableWidth)),e.layoutTableRowsApart&&this.root.push(new P("w:layoutTableRowsApart",e.layoutTableRowsApart)),e.useWord97LineBreakRules&&this.root.push(new P("w:useWord97LineBreakRules",e.useWord97LineBreakRules)),e.doNotBreakWrappedTables&&this.root.push(new P("w:doNotBreakWrappedTables",e.doNotBreakWrappedTables)),e.doNotSnapToGridInCell&&this.root.push(new P("w:doNotSnapToGridInCell",e.doNotSnapToGridInCell)),e.selectFieldWithFirstOrLastCharacter&&this.root.push(new P("w:selectFldWithFirstOrLastChar",e.selectFieldWithFirstOrLastCharacter)),e.applyBreakingRules&&this.root.push(new P("w:applyBreakingRules",e.applyBreakingRules)),e.doNotWrapTextWithPunctuation&&this.root.push(new P("w:doNotWrapTextWithPunct",e.doNotWrapTextWithPunctuation)),e.doNotUseEastAsianBreakRules&&this.root.push(new P("w:doNotUseEastAsianBreakRules",e.doNotUseEastAsianBreakRules)),e.useWord2002TableStyleRules&&this.root.push(new P("w:useWord2002TableStyleRules",e.useWord2002TableStyleRules)),e.growAutofit&&this.root.push(new P("w:growAutofit",e.growAutofit)),e.useFELayout&&this.root.push(new P("w:useFELayout",e.useFELayout)),e.useNormalStyleForList&&this.root.push(new P("w:useNormalStyleForList",e.useNormalStyleForList)),e.doNotUseIndentAsNumberingTabStop&&this.root.push(new P("w:doNotUseIndentAsNumberingTabStop",e.doNotUseIndentAsNumberingTabStop)),e.useAlternateEastAsianLineBreakRules&&this.root.push(new P("w:useAltKinsokuLineBreakRules",e.useAlternateEastAsianLineBreakRules)),e.allowSpaceOfSameStyleInTable&&this.root.push(new P("w:allowSpaceOfSameStyleInTable",e.allowSpaceOfSameStyleInTable)),e.doNotSuppressIndentation&&this.root.push(new P("w:doNotSuppressIndentation",e.doNotSuppressIndentation)),e.doNotAutofitConstrainedTables&&this.root.push(new P("w:doNotAutofitConstrainedTables",e.doNotAutofitConstrainedTables)),e.autofitToFirstFixedWidthCell&&this.root.push(new P("w:autofitToFirstFixedWidthCell",e.autofitToFirstFixedWidthCell)),e.underlineTabInNumberingList&&this.root.push(new P("w:underlineTabInNumList",e.underlineTabInNumberingList)),e.displayHangulFixedWidth&&this.root.push(new P("w:displayHangulFixedWidth",e.displayHangulFixedWidth)),e.splitPgBreakAndParaMark&&this.root.push(new P("w:splitPgBreakAndParaMark",e.splitPgBreakAndParaMark)),e.doNotVerticallyAlignCellWithSp&&this.root.push(new P("w:doNotVertAlignCellWithSp",e.doNotVerticallyAlignCellWithSp)),e.doNotBreakConstrainedForcedTable&&this.root.push(new P("w:doNotBreakConstrainedForcedTable",e.doNotBreakConstrainedForcedTable)),e.ignoreVerticalAlignmentInTextboxes&&this.root.push(new P("w:doNotVertAlignInTxbx",e.ignoreVerticalAlignmentInTextboxes)),e.useAnsiKerningPairs&&this.root.push(new P("w:useAnsiKerningPairs",e.useAnsiKerningPairs)),e.cachedColumnBalance&&this.root.push(new P("w:cachedColBalance",e.cachedColumnBalance)),e.version&&this.root.push(ES(e.version))}},dh=1e5,ph=15,_S=[57840,7439,52380,33984,4364,3600,61902,12606,6258,57657,54287,34041,10252,43370,20163],NS=[[44796,19929,39858,10053,20106,40212,10761],[31585,63170,64933,60267,50935,40399,11199],[17763,35526,1453,2906,5812,11624,23248],[885,1770,3540,7080,14160,28320,56640],[55369,41139,20807,41614,21821,43642,17621],[28485,56970,44341,19019,38038,14605,29210],[60195,50791,40175,10751,21502,43004,24537],[18387,36774,3949,7898,15796,31592,63184],[47201,24803,49606,37805,14203,28406,56812],[17824,35648,1697,3394,6788,13576,27152],[43601,17539,35078,557,1114,2228,4456],[30388,60776,51953,34243,7079,14158,28316],[14128,28256,56512,43425,17251,34502,7597],[13105,26210,52420,35241,883,1766,3532],[4129,8258,16516,33032,4657,9314,18628]],uh=e=>e>>14&1|e<<1&32767,IS=e=>{let t=e.slice(0,ph).split("").map(i=>{let s=i.charCodeAt(0);return(s&255)!==0?s&255:s>>8&255}),n=t.reduce((i,s,a)=>NS[ph-t.length+a].reduce((o,c,l)=>s>>l&1?o^c:o,i),_S[t.length-1]),r=(uh(t.reduceRight((i,s)=>uh(i)^s,0))^t.length^52811)&65535;return[r&255,r>>8,n&255,n>>8].map(i=>i.toString(16).toUpperCase().padStart(2,"0")).join("")},PS=(e,t,n)=>{let r=[...IS(e)].flatMap(o=>[o.charCodeAt(0),0]),i=Ju(Uint8Array.from([...t,...r])),s=new Uint8Array(i.length+4),a=new DataView(s.buffer);for(let o=0;o<n;o++)s.set(i),a.setUint32(i.length,o,!0),i=Ju(s);return Array.from(i)},OS=e=>{var t;let n=new Uint8Array(e);return typeof((t=globalThis.crypto)===null||t===void 0?void 0:t.getRandomValues)=="function"?(globalThis.crypto.getRandomValues(n),[...n]):[...n].map(()=>Math.floor(Math.random()*256))},hh=class extends H{constructor(...e){super(...e),C(this,"xmlKeys",{edit:"w:edit",enforcement:"w:enforcement",cryptProviderType:"w:cryptProviderType",cryptAlgorithmClass:"w:cryptAlgorithmClass",cryptAlgorithmType:"w:cryptAlgorithmType",cryptAlgorithmSid:"w:cryptAlgorithmSid",cryptSpinCount:"w:cryptSpinCount",hash:"w:hash",salt:"w:salt"})}},mh=e=>btoa(String.fromCharCode(...e)),RS=class extends I{constructor({type:e,password:t}){if(super("w:documentProtection"),t===void 0||t===""){this.root.push(new hh({edit:e,enforcement:!0}));return}let n=OS(16);this.root.push(new hh({edit:e,enforcement:!0,cryptProviderType:"rsaAES",cryptAlgorithmClass:"hash",cryptAlgorithmType:"typeAny",cryptAlgorithmSid:12,cryptSpinCount:dh,hash:mh(PS(t,n,dh)),salt:mh(n)}))}},LS=class extends H{constructor(...e){super(...e),C(this,"xmlKeys",{wpc:"xmlns:wpc",mc:"xmlns:mc",o:"xmlns:o",r:"xmlns:r",m:"xmlns:m",v:"xmlns:v",wp14:"xmlns:wp14",wp:"xmlns:wp",w10:"xmlns:w10",w:"xmlns:w",w14:"xmlns:w14",w15:"xmlns:w15",wpg:"xmlns:wpg",wpi:"xmlns:wpi",wne:"xmlns:wne",wps:"xmlns:wps",Ignorable:"mc:Ignorable"})}},MS=class extends I{constructor(e){var t,n,r,i,s,a,o,c,l;super("w:settings"),this.root.push(new LS({wpc:"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas",mc:"http://schemas.openxmlformats.org/markup-compatibility/2006",o:"urn:schemas-microsoft-com:office:office",r:"http://schemas.openxmlformats.org/officeDocument/2006/relationships",m:"http://schemas.openxmlformats.org/officeDocument/2006/math",v:"urn:schemas-microsoft-com:vml",wp14:"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing",wp:"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing",w10:"urn:schemas-microsoft-com:office:word",w:"http://schemas.openxmlformats.org/wordprocessingml/2006/main",w14:"http://schemas.microsoft.com/office/word/2010/wordml",w15:"http://schemas.microsoft.com/office/word/2012/wordml",wpg:"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup",wpi:"http://schemas.microsoft.com/office/word/2010/wordprocessingInk",wne:"http://schemas.microsoft.com/office/word/2006/wordml",wps:"http://schemas.microsoft.com/office/word/2010/wordprocessingShape",Ignorable:"w14 w15 wp14"})),this.root.push(new P("w:displayBackgroundShape",!0)),e.embedFonts!==void 0&&this.root.push(new P("w:embedTrueTypeFonts",e.embedFonts)),e.trackRevisions!==void 0&&this.root.push(new P("w:trackRevisions",e.trackRevisions)),e.protection!==void 0&&this.root.push(new RS(e.protection)),this.root.push(new Er("w:defaultTabStop",(t=e.defaultTabStop)!==null&&t!==void 0?t:720)),((n=e.hyphenation)===null||n===void 0?void 0:n.autoHyphenation)!==void 0&&this.root.push(new P("w:autoHyphenation",e.hyphenation.autoHyphenation)),((r=e.hyphenation)===null||r===void 0?void 0:r.consecutiveHyphenLimit)!==void 0&&this.root.push(new Er("w:consecutiveHyphenLimit",e.hyphenation.consecutiveHyphenLimit)),((i=e.hyphenation)===null||i===void 0?void 0:i.hyphenationZone)!==void 0&&this.root.push(new Er("w:hyphenationZone",e.hyphenation.hyphenationZone)),((s=e.hyphenation)===null||s===void 0?void 0:s.doNotHyphenateCaps)!==void 0&&this.root.push(new P("w:doNotHyphenateCaps",e.hyphenation.doNotHyphenateCaps)),e.evenAndOddHeaders!==void 0&&this.root.push(new P("w:evenAndOddHeaders",e.evenAndOddHeaders)),e.updateFields!==void 0&&this.root.push(new P("w:updateFields",e.updateFields)),this.root.push(new AS(k(k({},(a=e.compatibility)!==null&&a!==void 0?a:{}),{},{version:(o=(c=(l=e.compatibility)===null||l===void 0?void 0:l.version)!==null&&c!==void 0?c:e.compatibilityModeVersion)!==null&&o!==void 0?o:15})))}},mf=class extends H{constructor(...e){super(...e),C(this,"xmlKeys",{val:"w:val"})}},DS=class extends I{constructor(e){super("w:name"),this.root.push(new mf({val:e}))}},BS=class extends I{constructor(e){super("w:uiPriority"),this.root.push(new mf({val:le(e)}))}},$S=class extends H{constructor(...e){super(...e),C(this,"xmlKeys",{type:"w:type",styleId:"w:styleId",default:"w:default",customStyle:"w:customStyle"})}},mc=class extends I{constructor(e,t){super("w:style"),this.root.push(new $S(e)),t.name&&this.root.push(new DS(t.name)),t.basedOn&&t.basedOn!==e.styleId&&this.root.push(new it("w:basedOn",t.basedOn)),t.next&&this.root.push(new it("w:next",t.next)),t.link&&this.root.push(new it("w:link",t.link)),t.uiPriority!==void 0&&this.root.push(new BS(t.uiPriority)),t.semiHidden!==void 0&&this.root.push(new P("w:semiHidden",t.semiHidden)),t.unhideWhenUsed!==void 0&&this.root.push(new P("w:unhideWhenUsed",t.unhideWhenUsed)),t.quickFormat!==void 0&&this.root.push(new P("w:qFormat",t.quickFormat))}},Tt=class extends mc{constructor(e){super({type:"paragraph",styleId:e.id},e),C(this,"paragraphProperties",void 0),C(this,"runProperties",void 0),this.paragraphProperties=new On(e.paragraph,{implicitListParagraphStyle:!1,inListOrder:!1}),this.runProperties=new sn(e.run),this.root.push(this.paragraphProperties),this.root.push(this.runProperties)}},an=class extends mc{constructor(e){super({type:"character",styleId:e.id},k({uiPriority:99,unhideWhenUsed:!0},e)),C(this,"runProperties",void 0),this.runProperties=new sn(e.run),this.root.push(this.runProperties)}},Ut=class extends Tt{constructor(e){super(k({basedOn:"Normal",next:"Normal",quickFormat:!0},e))}},FS=class extends Ut{constructor(e){super(k({id:"Title",name:"Title"},e))}},qS=class extends Ut{constructor(e){super(k({id:"Heading1",name:"Heading 1"},e))}},HS=class extends Ut{constructor(e){super(k({id:"Heading2",name:"Heading 2"},e))}},US=class extends Ut{constructor(e){super(k({id:"Heading3",name:"Heading 3"},e))}},jS=class extends Ut{constructor(e){super(k({id:"Heading4",name:"Heading 4"},e))}},WS=class extends Ut{constructor(e){super(k({id:"Heading5",name:"Heading 5"},e))}},KS=class extends Ut{constructor(e){super(k({id:"Heading6",name:"Heading 6"},e))}},GS=class extends Ut{constructor(e){super(k({id:"Strong",name:"Strong"},e))}},zS=class extends Tt{constructor(e){super(k({id:"ListParagraph",name:"List Paragraph",basedOn:"Normal",quickFormat:!0},e))}},VS=class extends Tt{constructor(e){super(k({id:"Caption",name:"caption",basedOn:"Normal",next:"Normal",uiPriority:35,semiHidden:!0,unhideWhenUsed:!0,quickFormat:!0,paragraph:{spacing:{after:200}},run:{italics:!0,color:{theme:"dark2"},size:18}},e))}},XS=class extends Tt{constructor(e){super(k({id:"Bibliography",name:"Bibliography",basedOn:"Normal",next:"Normal",uiPriority:37,unhideWhenUsed:!0},e))}},ff=new WeakSet,fh=e=>ff.has(e),wt=class extends Tt{constructor(e,t){super({id:`TOC${e}`,name:`toc ${e}`,basedOn:"Normal",next:"Normal",uiPriority:39,semiHidden:!0,unhideWhenUsed:!0,paragraph:k({spacing:{after:100}},e>1?{indent:{left:(e-1)*t}}:{})})}prepForXml(e){let t=super.prepForXml(e);return ff.add(t),t}},gf=class extends Tt{constructor(e){super(k({id:"FootnoteText",name:"footnote text",link:"FootnoteTextChar",basedOn:"Normal",uiPriority:99,semiHidden:!0,unhideWhenUsed:!0,paragraph:{spacing:{after:0,line:240,lineRule:Pn.AUTO}},run:{size:20}},e))}},bf=class extends an{constructor(e){super(k({id:"FootnoteReference",name:"footnote reference",basedOn:"DefaultParagraphFont",semiHidden:!0,run:{superScript:!0}},e))}},vf=class extends an{constructor(e){super(k({id:"FootnoteTextChar",name:"Footnote Text Char",basedOn:"DefaultParagraphFont",link:"FootnoteText",semiHidden:!0,run:{size:20}},e))}},wf=class extends Tt{constructor(e){super(k({id:"EndnoteText",name:"endnote text",link:"EndnoteTextChar",basedOn:"Normal",uiPriority:99,semiHidden:!0,unhideWhenUsed:!0,paragraph:{spacing:{after:0,line:240,lineRule:Pn.AUTO}},run:{size:20}},e))}},yf=class extends an{constructor(e){super(k({id:"EndnoteReference",name:"endnote reference",basedOn:"DefaultParagraphFont",semiHidden:!0,run:{superScript:!0}},e))}},xf=class extends an{constructor(e){super(k({id:"EndnoteTextChar",name:"Endnote Text Char",basedOn:"DefaultParagraphFont",link:"EndnoteText",semiHidden:!0,run:{size:20}},e))}},YS=class extends an{constructor(e){super(k({id:"Hyperlink",name:"Hyperlink",basedOn:"DefaultParagraphFont",run:{color:"0563C1",underline:{type:gm.SINGLE}}},e))}},JS=class extends an{constructor(e){super(k({id:"LineNumber",name:"line number",basedOn:"DefaultParagraphFont",semiHidden:!0},e))}},QS=class extends mc{constructor(){super({type:"table",styleId:"TableNormal",default:!0},{name:"Normal Table",uiPriority:99,semiHidden:!0,unhideWhenUsed:!0}),this.root.push(new hc({indent:{size:0,type:$e.DXA},cellMargin:{top:0,left:108,bottom:0,right:108}}))}},_r=e=>typeof e=="object"?Object.keys(e)[0]:void 0,fc=e=>{var t;return(t=[e["w:style"]].flat().find(n=>n._attr))===null||t===void 0?void 0:t._attr},gh=e=>{var t;return(t=fc(e))===null||t===void 0?void 0:t["w:styleId"]},bh=e=>{var t;let n=(t=[e["w:style"]].flat().find(r=>_r(r)==="w:name"))===null||t===void 0||(t=t["w:name"])===null||t===void 0||(t=t._attr)===null||t===void 0?void 0:t["w:val"];return n===void 0?void 0:String(n).toLowerCase()},Rl=e=>{var t,n;return _r(e)==="w:style"&&((t=(n=fc(e))===null||n===void 0?void 0:n["w:type"])!==null&&t!==void 0?t:"paragraph")==="paragraph"},ZS=e=>{let t=Rl(e)?fc(e):void 0;return t?.["w:default"]!==void 0&&!["0","false","off"].includes(String(t["w:default"]))},eC=e=>({"w:style":[e["w:style"]].flat().map(t=>t._attr?{_attr:k(k({},t._attr),{},{"w:default":"1"})}:t)}),cl=class extends I{constructor(e){if(super("w:styles"),e.initialStyles&&this.root.push(e.initialStyles),e.importedStyles)for(let t of e.importedStyles)this.root.push(t);if(e.paragraphStyles)for(let t of e.paragraphStyles)this.root.push(new Tt(t));if(e.characterStyles)for(let t of e.characterStyles)this.root.push(new an(t))}prepForXml(e){let t=super.prepForXml(e),n=t["w:styles"];if(!Array.isArray(n))return t;let r=l=>n.filter(u=>_r(u)===l),i=n.map(l=>_r(l)==="w:style"?gh(l):void 0),s=n.filter((l,u)=>!["_attr","w:docDefaults","w:latentStyles"].includes(_r(l))&&(i[u]===void 0||i.lastIndexOf(i[u])===u)),a=new Set(s.filter(l=>Rl(l)&&!fh(l)).map(bh)),o=s.filter(l=>!fh(l)||!a.has(bh(l))),c=o.some(ZS)?o:o.map(l=>Rl(l)&&gh(l)==="Normal"?eC(l):l);return{"w:styles":[...r("_attr"),...r("w:docDefaults").slice(-1),...r("w:latentStyles").slice(-1),...c]}}},tC=class extends I{constructor(e){super("w:pPrDefault"),this.root.push(new On(e,{implicitListParagraphStyle:!1,inListOrder:!1}))}},nC=class extends I{constructor(e){super("w:rPrDefault"),this.root.push(new sn(e))}},rC=class extends I{constructor(e){super("w:docDefaults"),C(this,"runPropertiesDefaults",void 0),C(this,"paragraphPropertiesDefaults",void 0),this.runPropertiesDefaults=new nC(e.run),this.paragraphPropertiesDefaults=new tC(e.paragraph),this.root.push(this.runPropertiesDefaults),this.root.push(this.paragraphPropertiesDefaults)}},iC=class{newInstance(e){let t=qr(e),n;for(let i of t.elements||[])i.name==="w:styles"&&(n=i);if(n===void 0)throw new Error("can not find styles element");let r=n.elements||[];return{initialStyles:new ix(n.attributes),importedStyles:r.map(i=>Jl(i))}}},sC=e=>{var t;let n=(t=e.document)===null||t===void 0||(t=t.run)===null||t===void 0?void 0:t.size;return n===void 0?200:Math.round(typeof n=="number"?n*10:$t(n))},aC=e=>({tableOfContents1:new wt(1,e),tableOfContents2:new wt(2,e),tableOfContents3:new wt(3,e),tableOfContents4:new wt(4,e),tableOfContents5:new wt(5,e),tableOfContents6:new wt(6,e),tableOfContents7:new wt(7,e),tableOfContents8:new wt(8,e),tableOfContents9:new wt(9,e)}),gc=(e={})=>{var t;return k(k({normal:new Tt({id:"Normal",name:"Normal",quickFormat:!0}),normalTable:new QS,document:new rC((t=e.document)!==null&&t!==void 0?t:{}),title:new FS(k({run:{size:56}},e.title)),heading1:new qS(k({run:{color:"2E74B5",size:32}},e.heading1)),heading2:new HS(k({run:{color:"2E74B5",size:26}},e.heading2)),heading3:new US(k({run:{color:"1F4D78",size:24}},e.heading3)),heading4:new jS(k({run:{color:"2E74B5",italics:!0}},e.heading4)),heading5:new WS(k({run:{color:"2E74B5"}},e.heading5)),heading6:new KS(k({run:{color:"1F4D78"}},e.heading6)),strong:new GS(k({run:{bold:!0}},e.strong)),listParagraph:new zS(e.listParagraph||{}),caption:new VS(e.caption||{}),bibliography:new XS(e.bibliography||{})},aC(sC(e))),{},{hyperlink:new YS(e.hyperlink||{}),footnoteReference:new bf(e.footnoteReference||{}),footnoteText:new gf(e.footnoteText||{}),footnoteTextChar:new vf(e.footnoteTextChar||{}),endnoteReference:new yf(e.endnoteReference||{}),endnoteText:new wf(e.endnoteText||{}),endnoteTextChar:new xf(e.endnoteTextChar||{}),lineNumber:new JS(e.lineNumber||{})})},vh=class{newInstance(e={}){return{initialStyles:new zs(["mc","r","w","w14","w15"],"w14 w15"),importedStyles:Object.values(gc(e))}}},kf={headings:{latin:"Calibri Light",panose:"020F0302020204030204"},body:{latin:"Calibri",panose:"020F0502020204030204"}},oC=[["Jpan","\u6E38\u30B4\u30B7\u30C3\u30AF Light","\u6E38\u660E\u671D"],["Hang","\uB9D1\uC740 \uACE0\uB515"],["Hans","\u7B49\u7EBF Light","\u7B49\u7EBF"],["Hant","\u65B0\u7D30\u660E\u9AD4"],["Arab","Times New Roman","Arial"],["Hebr","Times New Roman","Arial"],["Thai","Angsana New","Cordia New"],["Ethi","Nyala"],["Beng","Vrinda"],["Gujr","Shruti"],["Khmr","MoolBoran","DaunPenh"],["Knda","Tunga"],["Guru","Raavi"],["Cans","Euphemia"],["Cher","Plantagenet Cherokee"],["Yiii","Microsoft Yi Baiti"],["Tibt","Microsoft Himalaya"],["Thaa","MV Boli"],["Deva","Mangal"],["Telu","Gautami"],["Taml","Latha"],["Syrc","Estrangelo Edessa"],["Orya","Kalinga"],["Mlym","Kartika"],["Laoo","DokChampa"],["Sinh","Iskoola Pota"],["Mong","Mongolian Baiti"],["Viet","Times New Roman","Arial"],["Uigh","Microsoft Uighur"],["Geor","Sylfaen"],["Armn","Arial"],["Bugi","Leelawadee UI"],["Bopo","Microsoft JhengHei"],["Java","Javanese Text"],["Lisu","Segoe UI"],["Mymr","Myanmar Text"],["Nkoo","Ebrima"],["Olck","Nirmala UI"],["Osma","Ebrima"],["Phag","Phagspa"],["Syrn","Estrangelo Edessa"],["Syrj","Estrangelo Edessa"],["Syre","Estrangelo Edessa"],["Sora","Nirmala UI"],["Tale","Microsoft Tai Le"],["Talu","Microsoft New Tai Lue"],["Tfng","Ebrima"]],dl=(e,t,n)=>new O({name:e,attributes:{typeface:{key:"typeface",value:t},panose:{key:"panose",value:n}}}),lC=(e,t)=>{let n=t[e],r=typeof n=="string"?n:n?.latin;return r??kf[e].latin},cC=(e,t={})=>{let n=oC.map(([i,s,a=s])=>{var o;return[i,(o=t[i])!==null&&o!==void 0?o:e==="headings"?s:a]}),r=new Set(n.map(([i])=>i));return[...n,...Object.entries(t).filter(([i])=>!r.has(i))]},wh=(e,t)=>{let n=t[e],{eastAsia:r="",complexScript:i="",scripts:s}=typeof n=="object"?n:{},a=lC(e,t),o=kf[e];return new O({name:e==="headings"?"a:majorFont":"a:minorFont",children:[dl("a:latin",a,a===o.latin?o.panose:void 0),dl("a:ea",r),dl("a:cs",i),...cC(e,s).map(([c,l])=>new O({name:"a:font",attributes:{script:{key:"script",value:c},typeface:{key:"typeface",value:l}}}))]})},dC=(e,t={})=>new O({name:"a:fontScheme",attributes:{name:{key:"name",value:e}},children:[wh("headings",t),wh("body",t)]}),Tf=(e=[])=>new O({name:"a:schemeClr",attributes:{value:{key:"val",value:"phClr"}},children:e.map(([t,n])=>new O({name:`a:${t}`,attributes:{value:{key:"val",value:n}}}))}),As=e=>new O({name:"a:solidFill",children:[Tf(e)]}),pl=e=>new O({name:"a:gradFill",attributes:{rotateWithShape:{key:"rotWithShape",value:!0}},children:[new O({name:"a:gsLst",children:e.map((t,n)=>new O({name:"a:gs",attributes:{position:{key:"pos",value:n*5e4}},children:[Tf(t)]}))}),new O({name:"a:lin",attributes:{angle:{key:"ang",value:54e5},scaled:{key:"scaled",value:!1}}})]}),ul=e=>new O({name:"a:ln",attributes:{width:{key:"w",value:e},cap:{key:"cap",value:"flat"},compound:{key:"cmpd",value:"sng"},alignment:{key:"algn",value:"ctr"}},children:[As(),new O({name:"a:prstDash",attributes:{value:{key:"val",value:"solid"}}}),new O({name:"a:miter",attributes:{limit:{key:"lim",value:8e5}}})]}),hl=e=>new O({name:"a:effectStyle",children:[new O({name:"a:effectLst",children:e})]}),pC=()=>new O({name:"a:outerShdw",attributes:{blurRadius:{key:"blurRad",value:57150},distance:{key:"dist",value:19050},direction:{key:"dir",value:54e5},alignment:{key:"algn",value:"ctr"},rotateWithShape:{key:"rotWithShape",value:!1}},children:[new O({name:"a:srgbClr",attributes:{value:{key:"val",value:"000000"}},children:[new O({name:"a:alpha",attributes:{value:{key:"val",value:63e3}}})]})]}),uC=()=>new O({name:"a:fmtScheme",attributes:{name:{key:"name",value:"Office"}},children:[new O({name:"a:fillStyleLst",children:[As(),pl([[["lumMod",11e4],["satMod",105e3],["tint",67e3]],[["lumMod",105e3],["satMod",103e3],["tint",73e3]],[["lumMod",105e3],["satMod",109e3],["tint",81e3]]]),pl([[["satMod",103e3],["lumMod",102e3],["tint",94e3]],[["satMod",11e4],["lumMod",1e5],["shade",1e5]],[["lumMod",99e3],["satMod",12e4],["shade",78e3]]])]}),new O({name:"a:lnStyleLst",children:[ul(6350),ul(12700),ul(19050)]}),new O({name:"a:effectStyleLst",children:[hl([]),hl([]),hl([pC()])]}),new O({name:"a:bgFillStyleLst",children:[As(),As([["tint",95e3],["satMod",17e4]]),pl([[["tint",93e3],["satMod",15e4],["shade",98e3],["lumMod",102e3]],[["tint",98e3],["satMod",13e4],["shade",9e4],["lumMod",103e3]],[["shade",63e3],["satMod",12e4]]])]})]}),hC=class extends I{constructor({name:e="Office Theme",colors:t,fonts:n}={}){super("a:theme"),C(this,"colors",void 0),this.colors=ec(t),this.root.push(new Vh({namespace:{key:"xmlns:a",value:"http://schemas.openxmlformats.org/drawingml/2006/main"},name:{key:"name",value:e}})),this.root.push(new O({name:"a:themeElements",children:[hx(t?e:"Office",t),dC(n?e:"Office",n),uC()]})),this.root.push(new O({name:"a:objectDefaults"})),this.root.push(new O({name:"a:extraClrSchemeLst"}))}get Colors(){return this.colors}},Ye=e=>{let t=e.lastIndexOf("/");return`${e.slice(0,t+1)}_rels/${e.slice(t+1)}.rels`},Sf=e=>e.replace(/(^|\/)_rels\/([^/]*)\.rels$/,"$1$2"),Cf=e=>e.slice(0,e.lastIndexOf("/")+1),on=(e,t)=>{let n=t.replace(/\\/g,"/");return(n.startsWith("/")?n:`${Cf(e)}${n}`).split("/").reduce((r,i)=>i===""||i==="."?r:i===".."?r.slice(0,-1):[...r,i],[]).join("/")},bc=(e,t)=>{let n=Cf(e).split("/").filter(Boolean),r=t.split("/"),i=n.findIndex((a,o)=>o>=r.length-1||r[o]!==a),s=i===-1?n.length:i;return[...n.slice(s).map(()=>".."),...r.slice(s)].join("/")},mC=(e,t)=>e.toLowerCase()===t.toLowerCase(),oe=Uint8Array,Le=Uint16Array,vc=Int32Array,Vs=new oe([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),Xs=new oe([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),Ll=new oe([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Ef=function(e,t){for(var n=new Le(31),r=0;r<31;++r)n[r]=t+=1<<e[r-1];for(var i=new vc(n[30]),r=1;r<30;++r)for(var s=n[r];s<n[r+1];++s)i[s]=s-n[r]<<5|r;return{b:n,r:i}},Af=Ef(Vs,2),_f=Af.b,Ml=Af.r;_f[28]=258,Ml[258]=28;Nf=Ef(Xs,0),fC=Nf.b,yh=Nf.r,Dl=new Le(32768);for(Y=0;Y<32768;++Y)yt=(Y&43690)>>1|(Y&21845)<<1,yt=(yt&52428)>>2|(yt&13107)<<2,yt=(yt&61680)>>4|(yt&3855)<<4,Dl[Y]=((yt&65280)>>8|(yt&255)<<8)>>1;st=(function(e,t,n){for(var r=e.length,i=0,s=new Le(t);i<r;++i)e[i]&&++s[e[i]-1];var a=new Le(t);for(i=1;i<t;++i)a[i]=a[i-1]+s[i-1]<<1;var o;if(n){o=new Le(1<<t);var c=15-t;for(i=0;i<r;++i)if(e[i])for(var l=i<<4|e[i],u=t-e[i],d=a[e[i]-1]++<<u,p=d|(1<<u)-1;d<=p;++d)o[Dl[d]>>c]=l}else for(o=new Le(r),i=0;i<r;++i)e[i]&&(o[i]=Dl[a[e[i]-1]++]>>15-e[i]);return o}),Ht=new oe(288);for(Y=0;Y<144;++Y)Ht[Y]=8;for(Y=144;Y<256;++Y)Ht[Y]=9;for(Y=256;Y<280;++Y)Ht[Y]=7;for(Y=280;Y<288;++Y)Ht[Y]=8;Dr=new oe(32);for(Y=0;Y<32;++Y)Dr[Y]=5;gC=st(Ht,9,0),bC=st(Ht,9,1),vC=st(Dr,5,0),wC=st(Dr,5,1),ml=function(e){for(var t=e[0],n=1;n<e.length;++n)e[n]>t&&(t=e[n]);return t},Ve=function(e,t,n){var r=t/8|0;return(e[r]|e[r+1]<<8)>>(t&7)&n},fl=function(e,t){var n=t/8|0;return(e[n]|e[n+1]<<8|e[n+2]<<16)>>(t&7)},wc=function(e){return(e+7)/8|0},Wr=function(e,t,n){return(t==null||t<0)&&(t=0),(n==null||n>e.length)&&(n=e.length),new oe(e.subarray(t,n))},yC=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],Ce=function(e,t,n){var r=new Error(t||yC[e]);if(r.code=e,Error.captureStackTrace&&Error.captureStackTrace(r,Ce),!n)throw r;return r},xC=function(e,t,n,r){var i=e.length,s=r?r.length:0;if(!i||t.f&&!t.l)return n||new oe(0);var a=!n,o=a||t.i!=2,c=t.i;a&&(n=new oe(i*3));var l=function(ae){var te=n.length;if(ae>te){var Re=new oe(Math.max(te*2,ae));Re.set(n),n=Re}},u=t.f||0,d=t.p||0,p=t.b||0,m=t.l,f=t.d,h=t.m,g=t.n,y=i*8;do{if(!m){u=Ve(e,d,1);var x=Ve(e,d+1,3);if(d+=3,x)if(x==1)m=bC,f=wC,h=9,g=5;else if(x==2){var v=Ve(e,d,31)+257,T=Ve(e,d+10,15)+4,w=v+Ve(e,d+5,31)+1;d+=14;for(var A=new oe(w),N=new oe(19),M=0;M<T;++M)N[Ll[M]]=Ve(e,d+M*3,7);d+=T*3;for(var L=ml(N),F=(1<<L)-1,J=st(N,L,1),M=0;M<w;){var z=J[Ve(e,d,F)];d+=z&15;var b=z>>4;if(b<16)A[M++]=b;else{var X=0,Z=0;for(b==16?(Z=3+Ve(e,d,3),d+=2,X=A[M-1]):b==17?(Z=3+Ve(e,d,7),d+=3):b==18&&(Z=11+Ve(e,d,127),d+=7);Z--;)A[M++]=X}}var fe=A.subarray(0,v),ce=A.subarray(v);h=ml(fe),g=ml(ce),m=st(fe,h,1),f=st(ce,g,1)}else Ce(1);else{var b=wc(d)+4,E=e[b-4]|e[b-3]<<8,_=b+E;if(_>i){c&&Ce(0);break}o&&l(p+E),n.set(e.subarray(b,_),p),t.b=p+=E,t.p=d=_*8,t.f=u;continue}if(d>y){c&&Ce(0);break}}o&&l(p+131072);for(var Et=(1<<h)-1,Ee=(1<<g)-1,He=d;;He=d){var X=m[fl(e,d)&Et],we=X>>4;if(d+=X&15,d>y){c&&Ce(0);break}if(X||Ce(2),we<256)n[p++]=we;else if(we==256){He=d,m=null;break}else{var ye=we-254;if(we>264){var M=we-257,re=Vs[M];ye=Ve(e,d,(1<<re)-1)+_f[M],d+=re}var D=f[fl(e,d)&Ee],$=D>>4;D||Ce(3),d+=D&15;var ce=fC[$];if($>3){var re=Xs[$];ce+=fl(e,d)&(1<<re)-1,d+=re}if(d>y){c&&Ce(0);break}o&&l(p+131072);var q=p+ye;if(p<ce){var ie=s-ce,se=Math.min(ce,q);for(ie+p<0&&Ce(3);p<se;++p)n[p]=r[ie+p]}for(;p<q;++p)n[p]=n[p-ce]}}t.l=m,t.p=He,t.b=p,t.f=u,m&&(u=1,t.m=h,t.d=f,t.n=g)}while(!u);return p!=n.length&&a?Wr(n,0,p):n.subarray(0,p)},xt=function(e,t,n){n<<=t&7;var r=t/8|0;e[r]|=n,e[r+1]|=n>>8},yr=function(e,t,n){n<<=t&7;var r=t/8|0;e[r]|=n,e[r+1]|=n>>8,e[r+2]|=n>>16},gl=function(e,t){for(var n=[],r=0;r<e.length;++r)e[r]&&n.push({s:r,f:e[r]});var i=n.length,s=n.slice();if(!i)return{t:Pf,l:0};if(i==1){var a=new oe(n[0].s+1);return a[n[0].s]=1,{t:a,l:1}}n.sort(function(_,v){return _.f-v.f}),n.push({s:-1,f:25001});var o=n[0],c=n[1],l=0,u=1,d=2;for(n[0]={s:-1,f:o.f+c.f,l:o,r:c};u!=i-1;)o=n[n[l].f<n[d].f?l++:d++],c=n[l!=u&&n[l].f<n[d].f?l++:d++],n[u++]={s:-1,f:o.f+c.f,l:o,r:c};for(var p=s[0].s,r=1;r<i;++r)s[r].s>p&&(p=s[r].s);var m=new Le(p+1),f=Bl(n[u-1],m,0);if(f>t){var r=0,h=0,g=f-t,y=1<<g;for(s.sort(function(v,T){return m[T.s]-m[v.s]||v.f-T.f});r<i;++r){var x=s[r].s;if(m[x]>t)h+=y-(1<<f-m[x]),m[x]=t;else break}for(h>>=g;h>0;){var b=s[r].s;m[b]<t?h-=1<<t-m[b]++-1:++r}for(;r>=0&&h;--r){var E=s[r].s;m[E]==t&&(--m[E],++h)}f=t}return{t:new oe(m),l:f}},Bl=function(e,t,n){return e.s==-1?Math.max(Bl(e.l,t,n+1),Bl(e.r,t,n+1)):t[e.s]=n},xh=function(e){for(var t=e.length;t&&!e[--t];);for(var n=new Le(++t),r=0,i=e[0],s=1,a=function(c){n[r++]=c},o=1;o<=t;++o)if(e[o]==i&&o!=t)++s;else{if(!i&&s>2){for(;s>138;s-=138)a(32754);s>2&&(a(s>10?s-11<<5|28690:s-3<<5|12305),s=0)}else if(s>3){for(a(i),--s;s>6;s-=6)a(8304);s>2&&(a(s-3<<5|8208),s=0)}for(;s--;)a(i);s=1,i=e[o]}return{c:n.subarray(0,r),n:t}},xr=function(e,t){for(var n=0,r=0;r<t.length;++r)n+=e[r]*t[r];return n},If=function(e,t,n){var r=n.length,i=wc(t+2);e[i]=r&255,e[i+1]=r>>8,e[i+2]=e[i]^255,e[i+3]=e[i+1]^255;for(var s=0;s<r;++s)e[i+s+4]=n[s];return(i+4+r)*8},kh=function(e,t,n,r,i,s,a,o,c,l,u){xt(t,u++,n),++i[256];for(var d=gl(i,15),p=d.t,m=d.l,f=gl(s,15),h=f.t,g=f.l,y=xh(p),x=y.c,b=y.n,E=xh(h),_=E.c,v=E.n,T=new Le(19),w=0;w<x.length;++w)++T[x[w]&31];for(var w=0;w<_.length;++w)++T[_[w]&31];for(var A=gl(T,7),N=A.t,M=A.l,L=19;L>4&&!N[Ll[L-1]];--L);var F=l+5<<3,J=xr(i,Ht)+xr(s,Dr)+a,z=xr(i,p)+xr(s,h)+a+14+3*L+xr(T,N)+2*T[16]+3*T[17]+7*T[18];if(c>=0&&F<=J&&F<=z)return If(t,u,e.subarray(c,c+l));var X,Z,fe,ce;if(xt(t,u,1+(z<J)),u+=2,z<J){X=st(p,m,0),Z=p,fe=st(h,g,0),ce=h;var Et=st(N,M,0);xt(t,u,b-257),xt(t,u+5,v-1),xt(t,u+10,L-4),u+=14;for(var w=0;w<L;++w)xt(t,u+3*w,N[Ll[w]]);u+=3*L;for(var Ee=[x,_],He=0;He<2;++He)for(var we=Ee[He],w=0;w<we.length;++w){var ye=we[w]&31;xt(t,u,Et[ye]),u+=N[ye],ye>15&&(xt(t,u,we[w]>>5&127),u+=we[w]>>12)}}else X=gC,Z=Ht,fe=vC,ce=Dr;for(var w=0;w<o;++w){var re=r[w];if(re>255){var ye=re>>18&31;yr(t,u,X[ye+257]),u+=Z[ye+257],ye>7&&(xt(t,u,re>>23&31),u+=Vs[ye]);var D=re&31;yr(t,u,fe[D]),u+=ce[D],D>3&&(yr(t,u,re>>5&8191),u+=Xs[D])}else yr(t,u,X[re]),u+=Z[re]}return yr(t,u,X[256]),u+Z[256]},kC=new vc([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Pf=new oe(0),TC=function(e,t,n,r,i,s){var a=s.z||e.length,o=new oe(r+a+5*(1+Math.ceil(a/7e3))+i),c=o.subarray(r,o.length-i),l=s.l,u=(s.r||0)&7;if(t){u&&(c[0]=s.r>>3);for(var d=kC[t-1],p=d>>13,m=d&8191,f=(1<<n)-1,h=s.p||new Le(32768),g=s.h||new Le(f+1),y=Math.ceil(n/3),x=2*y,b=function(Re){return(e[Re]^e[Re+1]<<y^e[Re+2]<<x)&f},E=new vc(25e3),_=new Le(288),v=new Le(32),T=0,w=0,A=s.i||0,N=0,M=s.w||0,L=0;A+2<a;++A){var F=b(A),J=A&32767,z=g[F];if(h[J]=z,g[F]=J,M<=A){var X=a-A;if((T>7e3||N>24576)&&(X>423||!l)){u=kh(e,c,0,E,_,v,w,N,L,A-L,u),N=T=w=0,L=A;for(var Z=0;Z<286;++Z)_[Z]=0;for(var Z=0;Z<30;++Z)v[Z]=0}var fe=2,ce=0,Et=m,Ee=J-z&32767;if(X>2&&F==b(A-Ee))for(var He=Math.min(p,X)-1,we=Math.min(32767,A),ye=Math.min(258,X);Ee<=we&&--Et&&J!=z;){if(e[A+fe]==e[A+fe-Ee]){for(var re=0;re<ye&&e[A+re]==e[A+re-Ee];++re);if(re>fe){if(fe=re,ce=Ee,re>He)break;for(var D=Math.min(Ee,re-2),$=0,Z=0;Z<D;++Z){var q=A-Ee+Z&32767,ie=q-h[q]&32767;ie>$&&($=ie,z=q)}}}J=z,z=h[J],Ee+=J-z&32767}if(ce){E[N++]=268435456|Ml[fe]<<18|yh[ce];var se=Ml[fe]&31,ae=yh[ce]&31;w+=Vs[se]+Xs[ae],++_[257+se],++v[ae],M=A+fe,++T}else E[N++]=e[A],++_[e[A]]}}for(A=Math.max(A,M);A<a;++A)E[N++]=e[A],++_[e[A]];u=kh(e,c,l,E,_,v,w,N,L,A-L,u),l||(s.r=u&7|c[u/8|0]<<3,u-=7,s.h=g,s.p=h,s.i=A,s.w=M)}else{for(var A=s.w||0;A<a+l;A+=65535){var te=A+65535;te>=a&&(c[u/8|0]=l,te=a),u=If(c,u+1,e.subarray(A,te))}s.i=a}return Wr(o,0,r+wc(u)+i)},SC=(function(){for(var e=new Int32Array(256),t=0;t<256;++t){for(var n=t,r=9;--r;)n=(n&1&&-306674912)^n>>>1;e[t]=n}return e})(),CC=function(){var e=-1;return{p:function(t){for(var n=e,r=0;r<t.length;++r)n=SC[n&255^t[r]]^n>>>8;e=n},d:function(){return~e}}},EC=function(e,t,n,r,i){if(!i&&(i={l:1},t.dictionary)){var s=t.dictionary.subarray(-32768),a=new oe(s.length+e.length);a.set(s),a.set(e,s.length),e=a,i.w=s.length}return TC(e,t.level==null?6:t.level,t.mem==null?i.l?Math.ceil(Math.max(8,Math.min(13,Math.log(e.length)))*1.5):20:12+t.mem,n,r,i)},Of=function(e,t){var n={};for(var r in e)n[r]=e[r];for(var r in t)n[r]=t[r];return n},nt=function(e,t){return e[t]|e[t+1]<<8},De=function(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0},bl=function(e,t){return De(e,t)+De(e,t+4)*4294967296},ke=function(e,t,n){for(;n;++t)e[t]=n,n>>>=8};Rf=function(e,t,n,r){for(var i in e){var s=e[i],a=t+i,o=r;Array.isArray(s)&&(o=Of(r,s[1]),s=s[0]),ArrayBuffer.isView(s)?n[a]=[s,o]:(n[a+="/"]=[new oe(0),o],Rf(s,a,n,r))}},Th=typeof TextEncoder<"u"&&new TextEncoder,$l=typeof TextDecoder<"u"&&new TextDecoder;try{$l.decode(Pf,{stream:!0})}catch{}NC=function(e){for(var t="",n=0;;){var r=e[n++],i=(r>127)+(r>223)+(r>239);if(n+i>e.length)return{s:t,r:Wr(e,n-1)};i?i==3?(r=((r&15)<<18|(e[n++]&63)<<12|(e[n++]&63)<<6|e[n++]&63)-65536,t+=String.fromCharCode(55296|r>>10,56320|r&1023)):i&1?t+=String.fromCharCode((r&31)<<6|e[n++]&63):t+=String.fromCharCode((r&15)<<12|(e[n++]&63)<<6|e[n++]&63):t+=String.fromCharCode(r)}};PC=function(e,t){return t+30+nt(e,t+26)+nt(e,t+28)},OC=function(e,t,n){var r=nt(e,t+28),i=nt(e,t+30),s=IC(e.subarray(t+46,t+46+r),!(nt(e,t+8)&2048)),a=t+46+r,o=RC(e,a,i,n,De(e,t+20),De(e,t+24),De(e,t+42)),c=o[0],l=o[1],u=o[2];return[nt(e,t+10),c,l,s,a+i+nt(e,t+32),u]},RC=function(e,t,n,r,i,s,a){var o=i==4294967295,c=s==4294967295,l=a==4294967295,u=t+n,d=o+c+l;if(r&&d){for(;t+4<u;t+=4+nt(e,t+2))if(nt(e,t)==1)return[o?bl(e,t+4+8*c):i,c?bl(e,t+4):s,l?bl(e,t+4+8*(c+o)):a,1];r<2&&Ce(13)}return[i,s,a,0]},Fl=function(e){var t=0;if(e)for(var n in e){var r=e[n].length;r>65535&&Ce(9),t+=r+4}return t},Ch=function(e,t,n,r,i,s,a,o){var c=r.length,l=n.extra,u=o&&o.length,d=Fl(l);ke(e,t,a!=null?33639248:67324752),t+=4,a!=null&&(e[t++]=20,e[t++]=n.os),e[t]=20,t+=2,e[t++]=n.flag<<1|(s<0&&8),e[t++]=i&&8,e[t++]=n.compression&255,e[t++]=n.compression>>8;var p=new Date(n.mtime==null?Date.now():n.mtime),m=p.getFullYear()-1980;if((m<0||m>119)&&Ce(10),ke(e,t,m<<25|p.getMonth()+1<<21|p.getDate()<<16|p.getHours()<<11|p.getMinutes()<<5|p.getSeconds()>>1),t+=4,s!=-1&&(ke(e,t,n.crc),ke(e,t+4,s<0?-s-2:s),ke(e,t+8,n.size)),ke(e,t+12,c),ke(e,t+14,d),t+=16,a!=null&&(ke(e,t,u),ke(e,t+6,n.attrs),ke(e,t+10,a),t+=14),e.set(r,t),t+=c,d)for(var f in l){var h=l[f],g=h.length;ke(e,t,+f),ke(e,t+2,g),e.set(h,t+4),t+=4+g}return u&&(e.set(o,t),t+=u),t},LC=function(e,t,n,r,i){ke(e,t,101010256),ke(e,t+8,n),ke(e,t+10,n),ke(e,t+12,r),ke(e,t+16,i)};BC=e=>typeof e=="string"?Zx(e):ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):new Uint8Array(e),Ms=e=>MC(Object.fromEntries([...e].map(([t,n])=>[t,BC(n)]))),$C=1032,Eh=e=>new Error(`Corrupted zip: ${e} isn't the size the zip file gives it`),Lf=(e,t=()=>!0)=>{let n=new Map,r=0,i=DC(e,{filter:({name:a,size:o,originalSize:c})=>{if(a.endsWith("/")||!t(a))return!1;if(r+=o,r>e.length||c>o*$C)throw Eh(a);return n.set(a,c),!0}}),s=Object.entries(i).find(([a,o])=>o.length!==n.get(a));if(s!==void 0)throw Eh(s[0]);return new Map(Object.entries(i))},vl=e=>{let t="";for(let n=0;n<e.length;n+=32768)t+=String.fromCharCode(...e.subarray(n,n+32768));return t},_s=e=>new Error(`${e} is not supported by this platform`),Ah={uint8array:e=>e,arraybuffer:e=>e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength),array:e=>Array.from(e),string:vl,binarystring:vl,base64:e=>btoa(vl(e)),blob:(e,t)=>{if(typeof Blob>"u")throw _s("blob");return new Blob([e],{type:t})},nodebuffer:e=>{if(typeof Buffer>"u")throw _s("nodebuffer");return Buffer.from(e.buffer,e.byteOffset,e.byteLength)},text:()=>{throw _s("text")}},ql=(e,t,n)=>{let r=Object.prototype.hasOwnProperty.call(Ah,t.toLowerCase())?Ah[t.toLowerCase()]:void 0;if(r===void 0)throw _s(t);return r(e,n)},FC=new Map([["dk1","dark1"],["lt1","light1"],["dk2","dark2"],["lt2","light2"],["accent1","accent1"],["accent2","accent2"],["accent3","accent3"],["accent4","accent4"],["accent5","accent5"],["accent6","accent6"],["hlink","hyperlink"],["folHlink","followedHyperlink"]]),qC=new Map([["dark1","windowText"],["light1","window"]]),HC=new Set(["http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme","http://purl.oclc.org/ooxml/officeDocument/relationships/theme"]),Br=e=>{var t,n;return(t=e==null||(n=e.name)===null||n===void 0?void 0:n.slice(e.name.indexOf(":")+1))!==null&&t!==void 0?t:""},Kr=e=>{var t,n;return(t=e==null||(n=e.elements)===null||n===void 0?void 0:n.filter(r=>r.type==="element"))!==null&&t!==void 0?t:[]},Hl=(e,t)=>Kr(e).find(n=>Br(n)===t),Nr=(e,t)=>{var n;let r=e==null||(n=e.attributes)===null||n===void 0?void 0:n[t];return r===void 0?void 0:String(r)},UC=e=>new TextDecoder(e[0]===255&&e[1]===254?"utf-16le":e[0]===254&&e[1]===255?"utf-16be":"utf-8").decode(e),jC=(e,t,n)=>{let r=e.get(Ye(t)),i=Nr(r&&Kr(Hl(qr(UC(r)),"Relationships")).find(s=>{var a;return n.has((a=Nr(s,"Type"))!==null&&a!==void 0?a:"")}),"Target");return i===void 0?void 0:on(t,i)},WC=(e,t)=>jC(e,t,HC),KC=(e,t,n)=>{let[r]=Kr(t),i=Br(r)==="srgbClr"?Nr(r,"val"):Br(r)==="sysClr"&&(n||Nr(r,"val")!==qC.get(e))?Nr(r,"lastClr"):void 0;return i!==void 0&&/^[0-9A-Fa-f]{6}$/.test(i)?i.toUpperCase():void 0},GC=(e,t=!1)=>Object.fromEntries(Kr(e).flatMap(n=>{let r=FC.get(Br(n)),i=r&&KC(r,n,t);return r&&i?[[r,i]]:[]})),zC=e=>{let[t]=Kr(qr(e)),n=Br(t)==="theme"?Hl(Hl(t,"themeElements"),"clrScheme"):void 0;return n?GC(n,!0):{}},VC=[208,207,17,224,161,177,26,225],Mf=class{constructor(e){var t,n,r,i,s,a,o,c,l,u,d,p,m,f;if(C(this,"currentRelationshipId",1),C(this,"documentWrapper",void 0),C(this,"headers",[]),C(this,"footers",[]),C(this,"coreProperties",void 0),C(this,"numbering",void 0),C(this,"media",void 0),C(this,"fileRelationships",void 0),C(this,"footnotesWrapper",void 0),C(this,"endnotesWrapper",void 0),C(this,"settings",void 0),C(this,"contentTypes",void 0),C(this,"customProperties",void 0),C(this,"appProperties",void 0),C(this,"styles",void 0),C(this,"comments",void 0),C(this,"commentsExtended",void 0),C(this,"commentsIds",void 0),C(this,"fontWrapper",void 0),C(this,"theme",void 0),C(this,"packageParts",void 0),C(this,"macros",void 0),C(this,"bibliography",void 0),e.macros!==void 0){let{project:b,events:E=[]}=e.macros,_=b instanceof Uint8Array?b:new Uint8Array(b);if(!VC.every((T,w)=>_[w]===T))throw new Error("macros.project isn't a VBA project. Use createMacros from docx/macros, or the word/vbaProject.bin in a .docm rather than the .docm itself");let v=new be;E.length>0&&v.addRelationship(1,"http://schemas.microsoft.com/office/2006/relationships/wordVbaData","vbaData.xml"),this.macros={project:_,events:E.length>0?jT(E):void 0,relationships:v}}if(this.coreProperties=new LT(k(k({},e),{},{creator:(t=e.creator)!==null&&t!==void 0?t:"Un-named",revision:(n=e.revision)!==null&&n!==void 0?n:1,lastModifiedBy:(r=e.lastModifiedBy)!==null&&r!==void 0?r:"Un-named"})),this.numbering=new uf(e.numbering?e.numbering:{config:[]}),this.comments=new n1((i=e.comments)!==null&&i!==void 0?i:{children:[]}),this.comments.ThreadData&&(this.commentsExtended=new a1(this.comments.ThreadData)),this.comments.CommentIdsData&&(this.commentsIds=new d1(this.comments.CommentIdsData)),this.fileRelationships=new be,this.customProperties=new qT((s=e.customProperties)!==null&&s!==void 0?s:[]),this.appProperties=new PT,this.footnotesWrapper=new iS,this.endnotesWrapper=new JT,this.contentTypes=new RT({macros:this.macros!==void 0}),((a=this.macros)===null||a===void 0?void 0:a.events)!==void 0&&this.contentTypes.addOverride("application/vnd.ms-word.vbaData+xml","/word/vbaData.xml"),e.bibliography!==void 0){let b=new be;b.addRelationship(1,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/customXmlProps","itemProps1.xml"),this.bibliography={sources:e.bibliography.sources,properties:HT(`{${mm().toUpperCase()}}`),relationships:b},this.contentTypes.addOverride("application/vnd.openxmlformats-officedocument.customXmlProperties+xml","/customXml/itemProps1.xml")}if(this.packageParts=new hf(this.contentTypes),this.documentWrapper=new GT({background:e.background,pageNumbers:e.pageNumbers}),this.settings=new MS({compatibilityModeVersion:e.compatabilityModeVersion,compatibility:e.compatibility,evenAndOddHeaders:!!e.evenAndOddHeaderAndFooters,trackRevisions:(o=e.features)===null||o===void 0?void 0:o.trackRevisions,updateFields:(c=e.features)===null||c===void 0?void 0:c.updateFields,embedFonts:!((l=e.fonts)===null||l===void 0)&&l.length?!0:void 0,defaultTabStop:e.defaultTabStop,protection:e.protection,hyphenation:{autoHyphenation:(u=e.hyphenation)===null||u===void 0?void 0:u.autoHyphenation,hyphenationZone:(d=e.hyphenation)===null||d===void 0?void 0:d.hyphenationZone,consecutiveHyphenLimit:(p=e.hyphenation)===null||p===void 0?void 0:p.consecutiveHyphenLimit,doNotHyphenateCaps:(m=e.hyphenation)===null||m===void 0?void 0:m.doNotHyphenateCaps}}),this.media=new pf(b=>this.packageParts.takePath("media","image",b)),e.externalStyles!==void 0){var h,g,y,x;let b=(h=(g=e.styles)===null||g===void 0?void 0:g.default)!==null&&h!==void 0?h:{},E=Object.entries(gc(b)),_=([T])=>b[T]!==void 0,v=new iC().newInstance(e.externalStyles);this.styles=new cl(k(k({},v),{},{paragraphStyles:(y=e.styles)===null||y===void 0?void 0:y.paragraphStyles,characterStyles:(x=e.styles)===null||x===void 0?void 0:x.characterStyles,importedStyles:[...E.filter(T=>!_(T)).map(([,T])=>T),...v.importedStyles,...E.filter(_).map(([,T])=>T)]}))}else if(e.styles){let b=new vh().newInstance(e.styles.default);this.styles=new cl(k(k({},b),e.styles))}else{let b=new vh;this.styles=new cl(b.newInstance())}this.addDefaultRelationships();for(let b of e.sections)this.addSection(b);if(e.footnotes)for(let b in e.footnotes)this.footnotesWrapper.View.createFootNote(parseFloat(b),e.footnotes[b].children);if(e.endnotes)for(let b in e.endnotes)this.endnotesWrapper.View.createEndnote(parseFloat(b),e.endnotes[b].children);this.fontWrapper=new Um((f=e.fonts)!==null&&f!==void 0?f:[]),this.theme=new hC(e.theme),this.documentWrapper.Relationships.addRelationship(this.currentRelationshipId++,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme","theme/theme1.xml"),this.macros!==void 0&&this.documentWrapper.Relationships.addRelationship(this.currentRelationshipId++,"http://schemas.microsoft.com/office/2006/relationships/vbaProject","vbaProject.bin"),this.bibliography!==void 0&&this.documentWrapper.Relationships.addRelationship(this.currentRelationshipId++,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/customXml","../customXml/item1.xml")}addSection({headers:e={},footers:t={},children:n,properties:r}){this.documentWrapper.View.Body.addSection(k(k({},r),{},{headerWrapperGroup:{default:e.default?this.createHeader(e.default):void 0,first:e.first?this.createHeader(e.first):void 0,even:e.even?this.createHeader(e.even):void 0},footerWrapperGroup:{default:t.default?this.createFooter(t.default):void 0,first:t.first?this.createFooter(t.first):void 0,even:t.even?this.createFooter(t.even):void 0}}));for(let i of n)this.documentWrapper.View.add(i)}createHeader(e){let t=new oS(this.media,this.currentRelationshipId++);for(let n of e.options.children)t.add(n);return this.addHeaderToDocument(t),t}createFooter(e){let t=new eS(this.media,this.currentRelationshipId++);for(let n of e.options.children)t.add(n);return this.addFooterToDocument(t),t}addHeaderToDocument(e,t=In.DEFAULT){this.headers.push({header:e,type:t}),this.documentWrapper.Relationships.addRelationship(e.View.ReferenceId,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/header",`header${this.headers.length}.xml`),this.contentTypes.addHeader(this.headers.length)}addFooterToDocument(e,t=In.DEFAULT){this.footers.push({footer:e,type:t}),this.documentWrapper.Relationships.addRelationship(e.View.ReferenceId,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/footer",`footer${this.footers.length}.xml`),this.contentTypes.addFooter(this.footers.length)}addDefaultRelationships(){this.fileRelationships.addRelationship(1,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument","word/document.xml"),this.fileRelationships.addRelationship(2,"http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties","docProps/core.xml"),this.fileRelationships.addRelationship(3,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties","docProps/app.xml"),this.fileRelationships.addRelationship(4,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/custom-properties","docProps/custom.xml"),this.documentWrapper.Relationships.addRelationship(this.currentRelationshipId++,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles","styles.xml"),this.documentWrapper.Relationships.addRelationship(this.currentRelationshipId++,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/numbering","numbering.xml"),this.documentWrapper.Relationships.addRelationship(this.currentRelationshipId++,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/footnotes","footnotes.xml"),this.documentWrapper.Relationships.addRelationship(this.currentRelationshipId++,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/endnotes","endnotes.xml"),this.documentWrapper.Relationships.addRelationship(this.currentRelationshipId++,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/settings","settings.xml"),this.comments.IsEmpty||(this.documentWrapper.Relationships.addRelationship(this.currentRelationshipId++,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments","comments.xml"),this.contentTypes.addComments()),this.commentsExtended&&(this.documentWrapper.Relationships.addRelationship(this.currentRelationshipId++,"http://schemas.microsoft.com/office/2011/relationships/commentsExtended","commentsExtended.xml"),this.contentTypes.addCommentsExtended()),this.commentsIds&&(this.documentWrapper.Relationships.addRelationship(this.currentRelationshipId++,"http://schemas.microsoft.com/office/2016/09/relationships/commentsIds","commentsIds.xml"),this.contentTypes.addCommentsIds())}get Document(){return this.documentWrapper}get Styles(){return this.styles}get CoreProperties(){return this.coreProperties}get Numbering(){return this.numbering}get Media(){return this.media}get FileRelationships(){return this.fileRelationships}get Headers(){return this.headers.map(e=>e.header)}get Footers(){return this.footers.map(e=>e.footer)}get ContentTypes(){return this.contentTypes}get CustomProperties(){return this.customProperties}get AppProperties(){return this.appProperties}get FootNotes(){return this.footnotesWrapper}get Endnotes(){return this.endnotesWrapper}get Settings(){return this.settings}get Comments(){return this.comments}get CommentsExtended(){return this.commentsExtended}get CommentsIds(){return this.commentsIds}get FontTable(){return this.fontWrapper}get Theme(){return this.theme}get PackageParts(){return this.packageParts}get Macros(){return this.macros}get Bibliography(){return this.bibliography}},XC=class extends I{constructor(e){super("w:sdtPr"),e&&this.root.push(new it("w:alias",e))}},YC=e=>new O({name:"w:docPartObj",children:[new it("w:docPartGallery",e),new O({name:"w:docPartUnique"})]}),JC=["contentChildren","cachedEntries","beginDirty","tabLeader"],Df=class extends dc{constructor(e="Table of Contents",t={}){let{contentChildren:n=[],cachedEntries:r=[],beginDirty:i,tabLeader:s=g1.DOT}=t,a=Yl(t,JC);super("w:sdt"),C(this,"fromHeadings",void 0);let o=new XC(e);o.addChildElement(YC("Table of Contents")),this.root.push(o);let c=new Cm,l=[new Fe({children:[Em(i),new Sm(a),nn()]})],u=[new Fe({children:[rn()]})];if(r!==void 0&&r.length>0){let{stylesWithLevels:d}=a,p=r.map((f,h)=>{var g,y;let x=this.buildCachedContentParagraphChild(f,a),b=(g=d==null||(y=d.find(_=>_.level===f.level))===null||y===void 0?void 0:y.styleName)!==null&&g!==void 0?g:`TOC${f.level}`,E=h===0?[...l,x]:h===r.length-1?[x,...u]:[x];return new ne({style:b,tabStops:this.getTabStopsForLevel(f.level,s),children:E})}),m=p;r.length<=1&&(m=[...p,new ne({children:u})]);for(let f of m)c.addChildElement(f)}else{let d=new ne({children:l});c.addChildElement(d);for(let m of n)c.addChildElement(m);let p=new ne({children:u});c.addChildElement(p),n.length===0&&(this.fromHeadings={properties:a,beginDirty:i,tabLeader:s})}this.root.push(c)}prepForXml(e){let t=super.prepForXml(e);return _k(t,this.fromHeadings&&k(k({},this.fromHeadings),{},{textWidth:this.textWidthIn(e)})),t}textWidthIn(e){var t,n;return(t=(n=e.file)===null||n===void 0||(n=n.Document)===null||n===void 0||(n=n.View.Body.getSectionPropertiesFor(this))===null||n===void 0?void 0:n.AvailableTextWidth)!==null&&t!==void 0?t:Cs}getTabStopsForLevel(e,t,n=9025){return[{type:"clear",position:n+1-(e-1)*240},{type:"right",position:n,leader:t}]}buildCachedContentRun(e,t){var n,r;return new Fe({style:t?.hyperlink&&e.href!==void 0?"IndexLink":void 0,children:[new Or({text:e.title}),new Ws,new Or({text:(n=(r=e.page)===null||r===void 0?void 0:r.toString())!==null&&n!==void 0?n:""})]})}buildCachedContentParagraphChild(e,t){let n=this.buildCachedContentRun(e,t);return t?.hyperlink&&e.href!==void 0?new Dm({anchor:e.href,children:[n]}):n}},kr=0,wl=32,QC=32,ZC=(e,t)=>{let n=t.replace(/-/g,"");if(n.length!==QC)throw new Error(`Error: Cannot extract GUID from font filename: ${t}`);let r=n.replace(/(..)/g,"$1 ").trim().split(" ").map(a=>parseInt(a,16));r.reverse();let i=e.slice(kr,wl).map((a,o)=>a^r[o%r.length]),s=new Uint8Array(kr+i.length+Math.max(0,e.length-wl));return s.set(e.slice(0,kr)),s.set(i,kr),s.set(e.slice(wl),kr+i.length),s},ln=class{format(e,t={stack:[]}){let n=e.prepForXml(t);if(n)return n;throw Error("XMLComponent did not format correctly")}},Bf=/\{([^{}]+)\}/g,$f=(e,t)=>t.size===0?e:e.replace(Bf,(n,r)=>{var i;return(i=t.get(r))!==null&&i!==void 0?i:n}),eE=e=>new Set(Array.from(e.matchAll(Bf),([,t])=>t)),Ff=class{replace(e,t,n){return $f(e,new Map(t.map((r,i)=>[r.key,(n+i).toString()])))}getMediaData(e,t){let n=eE(e);return t.Entries.filter(([r])=>n.has(r)).map(([r,{fileName:i}])=>({key:r,fileName:i}))}},tE=class{replace(e,t){return $f(e,new Map(t.map(({reference:n,instance:r,restartedListId:i,numId:s})=>[Os(n,r,i),s.toString()])))}},nE=new ln,yl=(e,t,n,r,i=!0)=>U(nE.format(t,{viewWrapper:{View:t,Relationships:r},file:e,stack:[]}),{indent:n,declaration:i?{standalone:"yes",encoding:"UTF-8"}:{encoding:"UTF-8"}}),rE=(e,t,n,r)=>{let{content:i}=t.options;if(i instanceof Uint8Array)return[{data:i,path:`word/${n}`}];if("files"in i)return[{data:Ms(i.files.map(({path:l,content:u})=>[l,u instanceof Uint8Array?u:yl(e,u,r,new be)])),path:`word/${n}`}];let s=e.PackageParts.createRelationships(n),a=yl(e,i,r,s),o=n.slice(0,n.lastIndexOf("/")),c=n.slice(n.lastIndexOf("/")+1);return[{data:a,path:`word/${n}`},...s.RelationshipCount>0?[{data:yl(e,s,r,s,!1),path:`word/${o}/_rels/${c}.rels`}]:[]]},yc=(e,t,n=0)=>{let r=e.PackageParts.Array.slice(n);return r.length===0?[]:[...r.flatMap(({part:i,path:s})=>rE(e,i,s,t)),...yc(e,t,n+r.length)]},iE=["PackageParts"],sE=class{constructor(){C(this,"formatter",void 0),C(this,"imageReplacer",void 0),C(this,"numberingReplacer",void 0),this.formatter=new ln,this.imageReplacer=new Ff,this.numberingReplacer=new tE}compile(e,t,n=[]){let r=this.xmlifyFile(e,t),{PackageParts:i}=r,s=Yl(r,iE),a=Object.values(s).flatMap(o=>Array.isArray(o)?o:[o]);return new Map([...a.map(({path:o,data:c})=>[o,c]),...i.map(({path:o,data:c})=>[o,c]),...n.map(({path:o,data:c})=>[o,c]),...e.Macros===void 0?[]:[["word/vbaProject.bin",e.Macros.project]],...e.Media.Array.map(o=>[`word/media/${o.fileName}`,o.data]),...e.FontTable.files.map(({data:o,fontKey:c},l)=>[`word/fonts/font${l+1}.odttf`,ZC(o,c)])])}xmlifyFile(e,t){var n;let r=U(this.formatter.format(e.Document.View,{viewWrapper:e.Document,file:e,stack:[]}),{indent:t,declaration:{standalone:"yes",encoding:"UTF-8"}}),i=U(this.formatter.format(e.Comments,{viewWrapper:{View:e.Comments,Relationships:e.Comments.Relationships},file:e,stack:[]}),{indent:t,declaration:{standalone:"yes",encoding:"UTF-8"}}),s=U(this.formatter.format(e.FootNotes.View,{viewWrapper:e.FootNotes,file:e,stack:[]}),{indent:t,declaration:{standalone:"yes",encoding:"UTF-8"}}),a=U(this.formatter.format(e.Endnotes.View,{viewWrapper:e.Endnotes,file:e,stack:[]}),{indent:t,declaration:{encoding:"UTF-8"}}),o=e.Document.Relationships.RelationshipCount+1,c=e.Comments.Relationships.RelationshipCount+1,l=e.FootNotes.Relationships.RelationshipCount+1,u=e.Endnotes.Relationships.RelationshipCount+1,d=this.imageReplacer.getMediaData(r,e.Media),p=this.imageReplacer.getMediaData(i,e.Media),m=this.imageReplacer.getMediaData(s,e.Media),f=this.imageReplacer.getMediaData(a,e.Media);return k(k(k(k(k(k({Relationships:{data:(()=>{let h=be.copy(e.Document.Relationships);return d.forEach((g,y)=>{h.addRelationship(o+y,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image",`media/${g.fileName}`)}),h.addRelationship(h.RelationshipCount+1,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/fontTable","fontTable.xml"),U(this.formatter.format(h,{viewWrapper:e.Document,file:e,stack:[]}),{indent:t,declaration:{encoding:"UTF-8"}})})(),path:"word/_rels/document.xml.rels"},Document:{data:(()=>{let h=this.imageReplacer.replace(r,d,o);return this.numberingReplacer.replace(h,e.Numbering.ConcreteNumbering)})(),path:"word/document.xml"},Styles:{data:(()=>{let h=U(this.formatter.format(e.Styles,{viewWrapper:e.Document,file:e,stack:[]}),{indent:t,declaration:{standalone:"yes",encoding:"UTF-8"}});return this.numberingReplacer.replace(h,e.Numbering.ConcreteNumbering)})(),path:"word/styles.xml"},Properties:{data:U(this.formatter.format(e.CoreProperties,{viewWrapper:e.Document,file:e,stack:[]}),{indent:t,declaration:{standalone:"yes",encoding:"UTF-8"}}),path:"docProps/core.xml"},FileRelationships:{data:U(this.formatter.format(e.FileRelationships,{viewWrapper:e.Document,file:e,stack:[]}),{indent:t,declaration:{encoding:"UTF-8"}}),path:"_rels/.rels"},HeaderRelationships:e.Headers.map((h,g)=>{let y=U(this.formatter.format(h.View,{viewWrapper:h,file:e,stack:[]}),{indent:t,declaration:{encoding:"UTF-8"}}),x=this.imageReplacer.getMediaData(y,e.Media),b=be.copy(h.Relationships);return x.forEach((E,_)=>{b.addRelationship(_,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image",`media/${E.fileName}`)}),{data:U(this.formatter.format(b,{viewWrapper:h,file:e,stack:[]}),{indent:t,declaration:{encoding:"UTF-8"}}),path:`word/_rels/header${g+1}.xml.rels`}}),FooterRelationships:e.Footers.map((h,g)=>{let y=U(this.formatter.format(h.View,{viewWrapper:h,file:e,stack:[]}),{indent:t,declaration:{encoding:"UTF-8"}}),x=this.imageReplacer.getMediaData(y,e.Media),b=be.copy(h.Relationships);return x.forEach((E,_)=>{b.addRelationship(_,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image",`media/${E.fileName}`)}),{data:U(this.formatter.format(b,{viewWrapper:h,file:e,stack:[]}),{indent:t,declaration:{encoding:"UTF-8"}}),path:`word/_rels/footer${g+1}.xml.rels`}}),Headers:e.Headers.map((h,g)=>{let y=U(this.formatter.format(h.View,{viewWrapper:h,file:e,stack:[]}),{indent:t,declaration:{encoding:"UTF-8"}}),x=this.imageReplacer.getMediaData(y,e.Media),b=this.imageReplacer.replace(y,x,0);return{data:this.numberingReplacer.replace(b,e.Numbering.ConcreteNumbering),path:`word/header${g+1}.xml`}}),Footers:e.Footers.map((h,g)=>{let y=U(this.formatter.format(h.View,{viewWrapper:h,file:e,stack:[]}),{indent:t,declaration:{encoding:"UTF-8"}}),x=this.imageReplacer.getMediaData(y,e.Media),b=this.imageReplacer.replace(y,x,0);return{data:this.numberingReplacer.replace(b,e.Numbering.ConcreteNumbering),path:`word/footer${g+1}.xml`}}),CustomProperties:{data:U(this.formatter.format(e.CustomProperties,{viewWrapper:e.Document,file:e,stack:[]}),{indent:t,declaration:{standalone:"yes",encoding:"UTF-8"}}),path:"docProps/custom.xml"},AppProperties:{data:U(this.formatter.format(e.AppProperties,{viewWrapper:e.Document,file:e,stack:[]}),{indent:t,declaration:{standalone:"yes",encoding:"UTF-8"}}),path:"docProps/app.xml"},FootNotes:{data:(()=>{let h=this.imageReplacer.replace(s,m,l);return this.numberingReplacer.replace(h,e.Numbering.ConcreteNumbering)})(),path:"word/footnotes.xml"},FootNotesRelationships:{data:(()=>{let h=be.copy(e.FootNotes.Relationships);return m.forEach((g,y)=>{h.addRelationship(l+y,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image",`media/${g.fileName}`)}),U(this.formatter.format(h,{viewWrapper:e.FootNotes,file:e,stack:[]}),{indent:t,declaration:{encoding:"UTF-8"}})})(),path:"word/_rels/footnotes.xml.rels"},Endnotes:{data:(()=>{let h=this.imageReplacer.replace(a,f,u);return this.numberingReplacer.replace(h,e.Numbering.ConcreteNumbering)})(),path:"word/endnotes.xml"},EndnotesRelationships:{data:(()=>{let h=be.copy(e.Endnotes.Relationships);return f.forEach((g,y)=>{h.addRelationship(u+y,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image",`media/${g.fileName}`)}),U(this.formatter.format(h,{viewWrapper:e.Endnotes,file:e,stack:[]}),{indent:t,declaration:{encoding:"UTF-8"}})})(),path:"word/_rels/endnotes.xml.rels"},Settings:{data:U(this.formatter.format(e.Settings,{viewWrapper:e.Document,file:e,stack:[]}),{indent:t,declaration:{standalone:"yes",encoding:"UTF-8"}}),path:"word/settings.xml"}},e.Comments.IsEmpty?{}:{Comments:{data:(()=>{let h=this.imageReplacer.replace(i,p,c);return this.numberingReplacer.replace(h,e.Numbering.ConcreteNumbering)})(),path:"word/comments.xml"},CommentsRelationships:{data:(()=>{let h=be.copy(e.Comments.Relationships);return p.forEach((g,y)=>{h.addRelationship(c+y,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image",`media/${g.fileName}`)}),U(this.formatter.format(h,{viewWrapper:{View:e.Comments,Relationships:e.Comments.Relationships},file:e,stack:[]}),{indent:t,declaration:{encoding:"UTF-8"}})})(),path:"word/_rels/comments.xml.rels"}}),e.CommentsExtended?{CommentsExtended:{data:U(this.formatter.format(e.CommentsExtended,{viewWrapper:{View:e.CommentsExtended,Relationships:e.Comments.Relationships},file:e,stack:[]}),{indent:t,declaration:{standalone:"yes",encoding:"UTF-8"}}),path:"word/commentsExtended.xml"}}:{}),e.CommentsIds?{CommentsIds:{data:U(this.formatter.format(e.CommentsIds,{viewWrapper:{View:e.CommentsIds,Relationships:e.Comments.Relationships},file:e,stack:[]}),{indent:t,declaration:{standalone:"yes",encoding:"UTF-8"}}),path:"word/commentsIds.xml"}}:{}),{},{FontTable:{data:U(this.formatter.format(e.FontTable.View,{viewWrapper:e.Document,file:e,stack:[]}),{indent:t,declaration:{standalone:"yes",encoding:"UTF-8"}}),path:"word/fontTable.xml"},FontTableRelationships:{data:U(this.formatter.format(e.FontTable.Relationships,{viewWrapper:e.Document,file:e,stack:[]}),{indent:t,declaration:{encoding:"UTF-8"}}),path:"word/_rels/fontTable.xml.rels"},Theme:{data:U(this.formatter.format(e.Theme,{viewWrapper:e.Document,file:e,stack:[]}),{indent:t,declaration:{standalone:"yes",encoding:"UTF-8"}}),path:"word/theme/theme1.xml"}},!((n=e.Macros)===null||n===void 0)&&n.events?{MacroEvents:{data:U(this.formatter.format(e.Macros.events,{viewWrapper:e.Document,file:e,stack:[]}),{indent:t,declaration:{standalone:"yes",encoding:"UTF-8"}}),path:"word/vbaData.xml"},MacroRelationships:{data:U(this.formatter.format(e.Macros.relationships,{viewWrapper:e.Document,file:e,stack:[]}),{indent:t,declaration:{encoding:"UTF-8"}}),path:"word/_rels/vbaProject.bin.rels"}}:{}),e.Bibliography?{BibliographySources:{data:U(this.formatter.format(e.Bibliography.sources,{viewWrapper:e.Document,file:e,stack:[]}),{indent:t,declaration:{standalone:"yes",encoding:"UTF-8"}}),path:"customXml/item1.xml"},BibliographySourcesProperties:{data:U(this.formatter.format(e.Bibliography.properties,{viewWrapper:e.Document,file:e,stack:[]}),{indent:t,declaration:{standalone:"no",encoding:"UTF-8"}}),path:"customXml/itemProps1.xml"},BibliographySourcesRelationships:{data:U(this.formatter.format(e.Bibliography.relationships,{viewWrapper:e.Document,file:e,stack:[]}),{indent:t,declaration:{standalone:"yes",encoding:"UTF-8"}}),path:"customXml/_rels/item1.xml.rels"}}:{}),{},{PackageParts:yc(e,t),Numbering:{data:U(this.formatter.format(e.Numbering,{viewWrapper:e.Document,file:e,stack:[]}),{indent:t,declaration:{standalone:"yes",encoding:"UTF-8"}}),path:"word/numbering.xml"},ContentTypes:{data:U(this.formatter.format(e.ContentTypes,{viewWrapper:e.Document,file:e,stack:[]}),{indent:t,declaration:{encoding:"UTF-8"}}),path:"[Content_Types].xml"}})}},_h=jy(((e,t)=>{var n=typeof Reflect=="object"?Reflect:null,r=n&&typeof n.apply=="function"?n.apply:function(T,w,A){return Function.prototype.apply.call(T,w,A)},i;n&&typeof n.ownKeys=="function"?i=n.ownKeys:Object.getOwnPropertySymbols?i=function(T){return Object.getOwnPropertyNames(T).concat(Object.getOwnPropertySymbols(T))}:i=function(T){return Object.getOwnPropertyNames(T)};function s(v){console&&console.warn&&console.warn(v)}var a=Number.isNaN||function(T){return T!==T};function o(){o.init.call(this)}t.exports=o,t.exports.once=b,o.EventEmitter=o,o.prototype._events=void 0,o.prototype._eventsCount=0,o.prototype._maxListeners=void 0;var c=10;function l(v){if(typeof v!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof v)}Object.defineProperty(o,"defaultMaxListeners",{enumerable:!0,get:function(){return c},set:function(v){if(typeof v!="number"||v<0||a(v))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+v+".");c=v}}),o.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},o.prototype.setMaxListeners=function(T){if(typeof T!="number"||T<0||a(T))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+T+".");return this._maxListeners=T,this};function u(v){return v._maxListeners===void 0?o.defaultMaxListeners:v._maxListeners}o.prototype.getMaxListeners=function(){return u(this)},o.prototype.emit=function(T){for(var w=[],A=1;A<arguments.length;A++)w.push(arguments[A]);var N=T==="error",M=this._events;if(M!==void 0)N=N&&M.error===void 0;else if(!N)return!1;if(N){var L;if(w.length>0&&(L=w[0]),L instanceof Error)throw L;var F=new Error("Unhandled error."+(L?" ("+L.message+")":""));throw F.context=L,F}var J=M[T];if(J===void 0)return!1;if(typeof J=="function")r(J,this,w);else for(var z=J.length,X=g(J,z),A=0;A<z;++A)r(X[A],this,w);return!0};function d(v,T,w,A){var N,M,L;if(l(w),M=v._events,M===void 0?(M=v._events=Object.create(null),v._eventsCount=0):(M.newListener!==void 0&&(v.emit("newListener",T,w.listener?w.listener:w),M=v._events),L=M[T]),L===void 0)L=M[T]=w,++v._eventsCount;else if(typeof L=="function"?L=M[T]=A?[w,L]:[L,w]:A?L.unshift(w):L.push(w),N=u(v),N>0&&L.length>N&&!L.warned){L.warned=!0;var F=new Error("Possible EventEmitter memory leak detected. "+L.length+" "+String(T)+" listeners added. Use emitter.setMaxListeners() to increase limit");F.name="MaxListenersExceededWarning",F.emitter=v,F.type=T,F.count=L.length,s(F)}return v}o.prototype.addListener=function(T,w){return d(this,T,w,!1)},o.prototype.on=o.prototype.addListener,o.prototype.prependListener=function(T,w){return d(this,T,w,!0)};function p(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function m(v,T,w){var A={fired:!1,wrapFn:void 0,target:v,type:T,listener:w},N=p.bind(A);return N.listener=w,A.wrapFn=N,N}o.prototype.once=function(T,w){return l(w),this.on(T,m(this,T,w)),this},o.prototype.prependOnceListener=function(T,w){return l(w),this.prependListener(T,m(this,T,w)),this},o.prototype.removeListener=function(T,w){var A,N,M,L,F;if(l(w),N=this._events,N===void 0)return this;if(A=N[T],A===void 0)return this;if(A===w||A.listener===w)--this._eventsCount===0?this._events=Object.create(null):(delete N[T],N.removeListener&&this.emit("removeListener",T,A.listener||w));else if(typeof A!="function"){for(M=-1,L=A.length-1;L>=0;L--)if(A[L]===w||A[L].listener===w){F=A[L].listener,M=L;break}if(M<0)return this;M===0?A.shift():y(A,M),A.length===1&&(N[T]=A[0]),N.removeListener!==void 0&&this.emit("removeListener",T,F||w)}return this},o.prototype.off=o.prototype.removeListener,o.prototype.removeAllListeners=function(T){var w,A=this._events,N;if(A===void 0)return this;if(A.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):A[T]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete A[T]),this;if(arguments.length===0){var M=Object.keys(A),L;for(N=0;N<M.length;++N)L=M[N],L!=="removeListener"&&this.removeAllListeners(L);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(w=A[T],typeof w=="function")this.removeListener(T,w);else if(w!==void 0)for(N=w.length-1;N>=0;N--)this.removeListener(T,w[N]);return this};function f(v,T,w){var A=v._events;if(A===void 0)return[];var N=A[T];return N===void 0?[]:typeof N=="function"?w?[N.listener||N]:[N]:w?x(N):g(N,N.length)}o.prototype.listeners=function(T){return f(this,T,!0)},o.prototype.rawListeners=function(T){return f(this,T,!1)},o.listenerCount=function(v,T){return typeof v.listenerCount=="function"?v.listenerCount(T):h.call(v,T)},o.prototype.listenerCount=h;function h(v){var T=this._events;if(T!==void 0){var w=T[v];if(typeof w=="function")return 1;if(w!==void 0)return w.length}return 0}o.prototype.eventNames=function(){return this._eventsCount>0?i(this._events):[]};function g(v,T){for(var w=new Array(T),A=0;A<T;++A)w[A]=v[A];return w}function y(v,T){for(;T+1<v.length;T++)v[T]=v[T+1];v.pop()}function x(v){for(var T=new Array(v.length),w=0;w<T.length;++w)T[w]=v[w].listener||v[w];return T}function b(v,T){return new Promise(function(w,A){function N(L){v.removeListener(T,M),A(L)}function M(){typeof v.removeListener=="function"&&v.removeListener("error",N),w([].slice.call(arguments))}_(v,T,M,{once:!0}),T!=="error"&&E(v,N,{once:!0})})}function E(v,T,w){typeof v.on=="function"&&_(v,"error",T,w)}function _(v,T,w,A){if(typeof v.on=="function")A.once?v.once(T,w):v.on(T,w);else if(typeof v.addEventListener=="function")v.addEventListener(T,function N(M){A.once&&v.removeEventListener(T,N),w(M)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof v)}}))();aE=class extends _h.EventEmitter{pipe(e,t){let n=this,r=e,i=d=>{r.writable&&r.write(d)===!1&&n.pause&&n.pause()};n.on("data",i);let s=()=>{n.readable&&n.resume&&n.resume()};r.on("drain",s),!r._isStdio&&(!t||t.end!==!1)&&(n.on("end",o),n.on("close",c));let a=!1;function o(){a||(a=!0,r.end())}function c(){a||(a=!0,typeof r.destroy=="function"&&r.destroy())}function l(d){if(u(),_h.EventEmitter.listenerCount(this,"error")===0)throw d}n.on("error",l),r.on("error",l);function u(){n.removeListener("data",i),r.removeListener("drain",s),n.removeListener("end",o),n.removeListener("close",c),n.removeListener("error",l),r.removeListener("error",l),n.removeListener("end",u),n.removeListener("close",u),r.removeListener("close",u)}return n.on("end",u),n.on("close",u),r.on("close",u),r.emit("pipe",n),r}};oE={NONE:"",WITH_2_BLANKS:" ",WITH_4_BLANKS:" ",WITH_TAB:" "},Ih=e=>e===!0?oE.WITH_2_BLANKS:e===!1?void 0:e,Ph=e=>e.Macros===void 0?"application/vnd.openxmlformats-officedocument.wordprocessingml.document":"application/vnd.ms-word.document.macroEnabled.12",xc=class Nn{static pack(t,n,r){var i=this;return jt(function*(s,a,o,c=[]){return ql(Ms(i.compiler.compile(s,Ih(o),c)),a,Ph(s))}).apply(this,arguments)}static toString(t,n,r=[]){return Nn.pack(t,"string",n,r)}static toBuffer(t,n,r=[]){return Nn.pack(t,"nodebuffer",n,r)}static toBase64String(t,n,r=[]){return Nn.pack(t,"base64",n,r)}static toBlob(t,n,r=[]){return Nn.pack(t,"blob",n,r)}static toArrayBuffer(t,n,r=[]){return Nn.pack(t,"arraybuffer",n,r)}static toStream(t,n,r=[]){let i=new aE,s=this.compiler.compile(t,Ih(n),r);return new Promise(a=>setTimeout(a)).then(()=>ql(Ms(s),"nodebuffer",Ph(t))).then(a=>{i.emit("data",a),i.emit("end")},a=>i.emit("error",a)),i}};C(xc,"compiler",new sE);qf=e=>{var t;if(e.name!=="w:bookmarkStart"&&e.name!=="w:bookmarkEnd")return;let n=Number((t=e.attributes)===null||t===void 0?void 0:t["w:id"]);return Number.isInteger(n)?n:void 0},Hf=e=>{var t;let n=qf(e);return[...n===void 0?[]:[n],...((t=e.elements)!==null&&t!==void 0?t:[]).flatMap(Hf)]},lE=e=>{let t=new Set(e),n=new Map,r=e.reduce((a,o)=>Math.max(a,o),0),i=a=>{let o=n.get(a);if(o!==void 0)return o;let c=t.has(a)?r+1:a;return r=Math.max(r,c),t.add(c),n.set(a,c),c},s=a=>{let o=qf(a);return k(k(k({},a),o===void 0?{}:{attributes:k(k({},a.attributes),{},{"w:id":String(i(o))})}),a.elements===void 0?{}:{elements:a.elements.map(s)})};return a=>a.map(s)},cE=new ln,Ys=e=>new TextDecoder("utf-8",{ignoreBOM:!0}).decode(e),lt=e=>qr(e,{keepWhitespaceText:!0}),Uf=e=>{var t;return(t=lt(U(cE.format(new Or({text:e})))).elements[0].elements)!==null&&t!==void 0?t:[]},jf=e=>k(k({},e),{},{attributes:{"xml:space":"preserve"}}),Te=(e,t)=>{var n,r;let i=(n=e.elements)===null||n===void 0?void 0:n.find(s=>s.name===t);return i===void 0?[]:((r=i.elements)!==null&&r!==void 0||(i.elements=[]),i.elements)},Wf=e=>{if(!e?.start.trim()||!e?.end.trim())throw new Error("Both start and end delimiters must be non-empty strings.")},_n=(e,t,n)=>{let r=Te(e,"Types");r.some(i=>{var s,a;return i.type==="element"&&i.name==="Default"&&(i==null||(s=i.attributes)===null||s===void 0?void 0:s.ContentType)===t&&(i==null||(a=i.attributes)===null||a===void 0?void 0:a.Extension)===n})||r.push({attributes:{ContentType:t,Extension:n},name:"Default",type:"element"})},dE=(e,t,n)=>{let r=Te(e,"Types");r.some(i=>{var s;return i.type==="element"&&i.name==="Override"&&((s=i.attributes)===null||s===void 0?void 0:s.PartName)===n})||r.push({attributes:{ContentType:t,PartName:n},name:"Override",type:"element"})},pE=(e,t)=>{var n;let r=(n=e.elements)===null||n===void 0?void 0:n.find(i=>i.name==="Types");r?.elements!==void 0&&(r.elements=r.elements.filter(i=>{var s,a;return!(i.name==="Override"&&String((s=(a=i.attributes)===null||a===void 0?void 0:a.PartName)!==null&&s!==void 0?s:"").toLowerCase()===t.toLowerCase())}))},uE=e=>{let t=parseInt(e.substring(3),10);return isNaN(t)?0:t},kc=e=>Te(e,"Relationships").map(t=>{var n,r;return uE((n=(r=t.attributes)===null||r===void 0||(r=r.Id)===null||r===void 0?void 0:r.toString())!==null&&n!==void 0?n:"")}).reduce((t,n)=>Math.max(t,n),0)+1,Ul=(e,t,n,r,i)=>{let s=Te(e,"Relationships");return s.push({attributes:{Id:`rId${t}`,Type:n,Target:r,TargetMode:i},name:"Relationship",type:"element"}),s},$r=()=>({declaration:{attributes:{version:"1.0",encoding:"UTF-8",standalone:"yes"}},elements:[{type:"element",name:"Relationships",attributes:{xmlns:"http://schemas.openxmlformats.org/package/2006/relationships"},elements:[]}]}),Oh="http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties",hE="application/vnd.openxmlformats-package.core-properties+xml",Rh="_rels/.rels",Lh="docProps/core.xml",jl={cp:"http://schemas.openxmlformats.org/package/2006/metadata/core-properties",dc:"http://purl.org/dc/elements/1.1/"},mE={title:{namespace:"dc",name:"title"},subject:{namespace:"dc",name:"subject"},creator:{namespace:"dc",name:"creator"},keywords:{namespace:"cp",name:"keywords"},description:{namespace:"dc",name:"description"},lastModifiedBy:{namespace:"cp",name:"lastModifiedBy"},revision:{namespace:"cp",name:"revision"}},Mh=e=>e===""?[]:[{type:"text",text:String(e)}],Dh=e=>{var t;return(t=e.name)===null||t===void 0?void 0:t.slice(e.name.indexOf(":")+1)},fE=(e,t)=>{var n;let r=(n=Object.entries(k({},e.attributes)).find(([i,s])=>(i==="xmlns"||i.startsWith("xmlns:"))&&s===jl[t]))===null||n===void 0?void 0:n[0];return r===void 0?(e.attributes=k(k({},e.attributes),{},{[`xmlns:${t}`]:jl[t]}),`${t}:`):r==="xmlns"?"":`${r.slice(6)}:`},gE=e=>{let t=e[0]===255&&e[1]===254?"utf-16le":e[0]===254&&e[1]===255?"utf-16be":"utf-8";return new TextDecoder(t).decode(e)},bE=(e,t,n)=>{var r;let i=t.get(n);if(i===void 0)return e.get(n);let s=lt(gE(i));return!((r=s.declaration)===null||r===void 0)&&r.attributes&&(s.declaration.attributes.encoding="UTF-8"),t.delete(n),e.set(n,s),s},vE=e=>{var t,n;let r=(t=e.get(Rh))!==null&&t!==void 0?t:$r(),i=(n=Te(r,"Relationships").find(s=>{var a;return((a=s.attributes)===null||a===void 0?void 0:a.Type)===Oh}))===null||n===void 0||(n=n.attributes)===null||n===void 0?void 0:n.Target;return typeof i=="string"?on("",i):(Ul(r,kc(r),Oh,Lh),e.set(Rh,r),Lh)},wE=(e,t,n,{addContentTypeOverride:r})=>{var i,s;let a=vE(e),o=bE(e,t,a),c=o??{declaration:{attributes:{version:"1.0",encoding:"UTF-8",standalone:"yes"}},elements:[{type:"element",name:"cp:coreProperties",attributes:{"xmlns:cp":jl.cp},elements:[]}]};o===void 0&&(e.set(a,c),r(hE,`/${a}`));let l=(i=c.elements)===null||i===void 0?void 0:i.find(u=>Dh(u)==="coreProperties");if(l===void 0)throw new Error(`Could not find the core properties in ${a}`);(s=l.elements)!==null&&s!==void 0||(l.elements=[]);for(let[u,{namespace:d,name:p}]of Object.entries(mE)){let m=n[u];if(m===void 0)continue;let f=l.elements.find(h=>Dh(h)===p);f?f.elements=Mh(m):l.elements.push({type:"element",name:`${fE(l,d)}${p}`,elements:Mh(m)})}},Wl=new Set(["wp:inline","wp:anchor"]),Tc=new Set(["wp:docPr","wps:cNvPr","wpg:cNvPr"]),yE=new Set(["a:stCxn","a:endCxn"]),Ds=(e,t)=>{var n,r;if(!t.has((n=e.name)!==null&&n!==void 0?n:""))return;let i=Number((r=e.attributes)===null||r===void 0?void 0:r.id);return Number.isInteger(i)?i:void 0},Kf=e=>{var t;let n=Ds(e,Tc);return[...n===void 0?[]:[n],...((t=e.elements)!==null&&t!==void 0?t:[]).flatMap(Kf)]},xE=e=>{let t=n=>{var r;let i=Ds(n,Tc);return[...i===void 0?[]:[i],...((r=n.elements)!==null&&r!==void 0?r:[]).flatMap(s=>{var a;return Wl.has((a=s.name)!==null&&a!==void 0?a:"")?[]:t(s)})]};return t(e)},kE=e=>{let t=new Set(e),n=e.reduce((a,o)=>Math.max(a,o),0),r=a=>{let o=t.has(a)?n+1:a;return n=Math.max(n,o),t.add(o),o},i=a=>{let o=new Map([...new Set(xE(a))].map(l=>[l,r(l)])),c=l=>{var u,d;if(l!==a&&Wl.has((u=l.name)!==null&&u!==void 0?u:""))return i(l);let p=(d=Ds(l,Tc))!==null&&d!==void 0?d:Ds(l,yE),m=p===void 0?void 0:o.get(p);return k(k(k({},l),m===void 0?{}:{attributes:k(k({},l.attributes),{},{id:String(m)})}),l.elements===void 0?{}:{elements:l.elements.map(c)})};return c(a)},s=a=>{var o;return Wl.has((o=a.name)!==null&&o!==void 0?o:"")?i(a):k(k({},a),a.elements===void 0?{}:{elements:a.elements.map(s)})};return a=>a.map(s)},Se={DOCUMENT:"file",PARAGRAPH:"paragraph",TABLE_ROWS:"tableRows",DRAWING:"drawing"},TE=new Map([["wp:inline","wp:docPr"],["wp:anchor","wp:docPr"],["wpg:graphicFrame","wpg:cNvPr"],["wpc:graphicFrame","wpg:cNvPr"]]),Js=e=>{var t;return((t=e.elements)!==null&&t!==void 0?t:[]).flatMap(n=>{var r;let i=n.name===void 0?void 0:TE.get(n.name),s=i===void 0||(r=n.elements)===null||r===void 0?void 0:r.find(a=>a.name===i);return[...s?[{element:n,properties:s}]:[],...Js(n)]})},Gf=e=>{var t,n;return[(t=e.attributes)===null||t===void 0?void 0:t.descr,(n=e.attributes)===null||n===void 0?void 0:n.title].flatMap(r=>r===void 0?[]:[String(r)])},Bh="[Content_Types].xml",SE=e=>{var t;if(!(!((t=e.elements)===null||t===void 0)&&t.some(r=>r.name==="Relationships"))){var n;e.elements=[...(n=e.elements)!==null&&n!==void 0?n:[],...$r().elements]}return Te(e,"Relationships")},CE="http://schemas.openxmlformats.org/officeDocument/2006/relationships",Kl=e=>{var t,n;return new Set(["r",...Object.entries((t=e.attributes)!==null&&t!==void 0?t:{}).flatMap(([r,i])=>r.startsWith("xmlns:")&&i===CE?[r.slice(6)]:[]),...((n=e.elements)!==null&&n!==void 0?n:[]).flatMap(r=>[...Kl(r)])])},Gl=(e,t)=>{var n,r;return new Set([...Object.entries((n=e.attributes)!==null&&n!==void 0?n:{}).flatMap(([i,s])=>i.includes(":")&&t.has(i.slice(0,i.indexOf(":")))?[String(s)]:[]),...((r=e.elements)!==null&&r!==void 0?r:[]).flatMap(i=>[...Gl(i,t)])])},EE=(e,t)=>{let n=l=>e.has(l)||t.has(l),r=l=>{if(n(l))return l;let u=(()=>{try{return decodeURI(l)}catch{return}})();if(u!==void 0&&n(u))return u;let d=l.toLowerCase();return[...e.keys(),...t.keys()].find(p=>p.toLowerCase()===d)},i=(l,u)=>{let d=e.get(Ye(l));return d===void 0?void 0:Te(d,"Relationships").find(p=>{var m;return p.name==="Relationship"&&((m=p.attributes)===null||m===void 0?void 0:m.Id)===u})},s=(l,u)=>{var d,p;let m=(d=u.attributes)===null||d===void 0?void 0:d.Target;return((p=u.attributes)===null||p===void 0?void 0:p.TargetMode)==="External"||m===void 0?void 0:r(on(l,String(m)))},a=l=>[...e].some(([u,d])=>u.endsWith(".rels")&&Te(d,"Relationships").some(p=>s(Sf(u),p)===l)),o=(l,u)=>{if(u===void 0||u===l||u===Bh||u.endsWith(".rels")||a(u))return;let d=e.get(Ye(u));e.delete(u),t.delete(u),e.delete(Ye(u));let p=e.get(Bh);p!==void 0&&pE(p,`/${u}`);for(let m of d===void 0?[]:Te(d,"Relationships"))o(u,s(u,m))};return{findRelationship:i,pathOf:s,removeIfUnreferenced:o,removeRelationships:(l,u)=>{var d,p;let m=(d=e.get(Ye(l)))===null||d===void 0||(d=d.elements)===null||d===void 0?void 0:d.find(h=>h.name==="Relationships"),f=((p=m?.elements)!==null&&p!==void 0?p:[]).filter(h=>{var g;return h.name==="Relationship"&&u.has(String((g=h.attributes)===null||g===void 0?void 0:g.Id))});if(!(m===void 0||f.length===0)){m.elements=m.elements.filter(h=>!f.includes(h));for(let h of f)o(l,s(l,h))}}}},AE=(e,{findRelationship:t,pathOf:n,removeIfUnreferenced:r},i,s)=>{let a=new ln;return{getRelatedPart:(o,c)=>{let l=t(o.path,c),u=l===void 0?void 0:n(o.path,l);return u===void 0?void 0:{path:u,xml:e.get(u)}},replaceRelatedPart:(o,c,l)=>{let u=`word/${i.PackageParts.add(l)}`,{relationshipType:d}=l.options,p=bc(o.path,u),m=c===void 0?void 0:t(o.path,c);if(m===void 0){var f;let g=Ye(o.path),y=(f=e.get(g))!==null&&f!==void 0?f:$r();e.set(g,y);let x=c??`rId${kc(y)}`;return SE(y).push({type:"element",name:"Relationship",attributes:{Id:x,Type:d,Target:p}}),x}let h=n(o.path,m);return m.attributes=k(k({},Object.fromEntries(Object.entries(m.attributes).filter(([g])=>g!=="TargetMode"))),{},{Type:d,Target:p}),r(o.path,h),String(m.attributes.Id)},format:o=>lt(U(a.format(o,s))).elements[0]}},_E=({parts:e,binaryParts:t,file:n,patches:r,delimiters:i},s)=>{let a=r.map(([l,u])=>({placeholder:`${i.start}${l}${i.end}`,patch:u})),o=[...e].filter(([l])=>l.startsWith("word/")&&!l.endsWith(".rels")).flatMap(([l,u])=>Js(u).flatMap(d=>{let p=Gf(d.properties),m=a.filter(({placeholder:g})=>p.some(y=>y.includes(g)));if(m.length>1){var f,h;throw new Error(`The drawing "${(f=(h=d.properties.attributes)===null||h===void 0?void 0:h.name)!==null&&f!==void 0?f:""}" in ${l} has the placeholders ${m.map(({placeholder:g})=>g).join(" and ")} in its alt text. A drawing can only be patched once`)}return m.map(({placeholder:g,patch:y})=>({drawing:k(k({placeholder:g},d),{},{part:{path:l,xml:u}}),patch:y}))})),c=EE(e,t);for(let{drawing:l,patch:u}of o){let d=Gl(l.element,Kl(l.part.xml));u.patch(l,AE(e,c,n,s(l.part.path)));let p=Gl(l.part.xml,Kl(l.part.xml));c.removeRelationships(l.part.path,new Set([...d].filter(m=>!p.has(m))))}},NE=e=>typeof e=="object"&&e!==null&&"on"in e&&typeof e.on=="function",IE=e=>typeof e=="object"&&e!==null&&"generateAsync"in e&&typeof e.generateAsync=="function",PE=e=>["[object Blob]","[object File]"].includes(Object.prototype.toString.call(e)),OE=e=>new Promise((t,n)=>{let r=[];e.on("data",i=>{ArrayBuffer.isView(i)?r.push(new Uint8Array(i.buffer,i.byteOffset,i.byteLength)):typeof i=="number"?r.push(i):n(new TypeError(`A template stream must give bytes, but it gave a ${typeof i}. A stream with an encoding set gives text, so do not set one.`))}),e.on("error",n),e.on("end",()=>{let i=new Uint8Array(r.reduce((s,a)=>s+(typeof a=="number"?1:a.length),0));r.reduce((s,a)=>typeof a=="number"?(i[s]=a,s+1):(i.set(a,s),s+a.length),0),t(i)})}),RE=(function(){var e=jt(function*(t){return IE(t)?t.generateAsync({type:"uint8array"}):NE(t)?OE(t):PE(t)?new Uint8Array(yield t.arrayBuffer()):typeof t=="string"?Uint8Array.from({length:t.length},(n,r)=>t.charCodeAt(r)):Array.isArray(t)?Uint8Array.from(t):ArrayBuffer.isView(t)?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):new Uint8Array(t)});return function(n){return e.apply(this,arguments)}})(),zf=(function(){var e=jt(function*(t,n){return Lf(yield RE(t),n)});return function(n,r){return e.apply(this,arguments)}})(),LE=new ln,ys="word/document.xml",ME={path:"word/footnotes.xml",rootName:"w:footnotes",noteName:"w:footnote",referenceName:"w:footnoteReference",contentType:"application/vnd.openxmlformats-officedocument.wordprocessingml.footnotes+xml",relationshipType:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/footnotes",create:{part:()=>new df,mark:()=>new cf,styles:()=>[new gf({}),new vf({}),new bf({})]}},DE={path:"word/endnotes.xml",rootName:"w:endnotes",noteName:"w:endnote",referenceName:"w:endnoteReference",contentType:"application/vnd.openxmlformats-officedocument.wordprocessingml.endnotes+xml",relationshipType:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/endnotes",create:{part:()=>new lf,mark:()=>new sf,styles:()=>[new wf({}),new xf({}),new yf({})]}},xs=(e,t)=>lt(U(LE.format(e,t))).elements[0],Vf=(e,t)=>{var n,r,i;let s=t.includes((n=e.name)!==null&&n!==void 0?n:"")?Number((r=e.attributes)===null||r===void 0?void 0:r["w:id"]):NaN;return[...Number.isInteger(s)?[s]:[],...((i=e.elements)!==null&&i!==void 0?i:[]).flatMap(a=>Vf(a,t))]},BE=(e,t)=>{var n,r;let i=(n=e.elements)!==null&&n!==void 0?n:[],s=((r=i[0])===null||r===void 0?void 0:r.name)==="w:pPr"?1:0;return k(k({},e),{},{elements:[...i.slice(0,s),t,...i.slice(s)]})},$h=(e,t,n,{createContext:r,addContentTypeOverride:i,renumberBookmarks:s,renumberDrawings:a,renumberLists:o,useStyles:c})=>{let l=new Map(Object.entries(t).map(([x,b])=>[Number(x),b])),u=new Map,d=[...l.keys()].filter(Number.isFinite).reduce((x,b)=>Math.max(x,Math.floor(b)),0),p=new Map,m,f=x=>{var b,E;let _=x.name===e.referenceName?l.get(Number((b=x.attributes)===null||b===void 0?void 0:b["w:id"])):void 0;return _===void 0?x.elements===void 0?x:k(k({},x),{},{elements:x.elements.map(f)}):(m=((E=m)!==null&&E!==void 0?E:[...n.values()].flatMap(v=>Vf(v,[e.noteName,e.referenceName])).reduce((v,T)=>Math.max(v,T),0))+1,p.set(m,_),k(k({},x),{},{attributes:k(k({},x.attributes),{},{"w:id":String(m)})}))},h=()=>{var x;let b=Te((x=n.get(Ye(ys)))!==null&&x!==void 0?x:{},"Relationships").find(_=>{var v;return((v=_.attributes)===null||v===void 0?void 0:v.Type)===e.relationshipType}),E=b?on(ys,String(b.attributes.Target)):e.path;return n.has(E)||(n.set(E,{declaration:{attributes:{version:"1.0",encoding:"UTF-8",standalone:"yes"}},elements:[xs(e.create.part(),r(E))]}),i(e.contentType,`/${E}`)),b||r(ys).viewWrapper.Relationships.addRelationship(Ln(),e.relationshipType,bc(ys,E)),E};return{renumber:x=>x.map(f),write:()=>{if(p.size===0)return;let x=h(),b=r(x),E=new Map([...new Set(p.values())].map(v=>{let T=xs(e.create.mark(),b);return[v,c(o(s(v.children.map(w=>xs(w,b)).map((w,A)=>A===0?BE(w,T):w))))]}));Te(n.get(x),e.rootName).push(...[...p].map(([v,T])=>({type:"element",name:e.noteName,attributes:{"w:id":String(v)},elements:[...a(E.get(T))]})));let _=n.get("word/styles.xml");if(_){let v=Te(_,"w:styles"),T=new Set(v.map(w=>{var A;return(A=w.attributes)===null||A===void 0?void 0:A["w:styleId"]}));v.push(...e.create.styles().map(w=>xs(w,b)).filter(w=>{var A;return!T.has((A=w.attributes)===null||A===void 0?void 0:A["w:styleId"])}))}},carry:(x,b)=>{let E=u.get(x);return E!==void 0?E:(d++,l.set(d,b),u.set(x,d),d)}}},$E=({footnotes:e={},endnotes:t={}},n,r)=>{let i={footnotes:$h(ME,e,n,r),endnotes:$h(DE,t,n,r)};return{carry:(s,a,o)=>i[s].carry(a,o),renumber:s=>Object.values(i).reduce((a,o)=>o.renumber(a),s),write:()=>{for(let s of Object.values(i))s.write()}}},FE=new ln,ks="word/document.xml",qE="word/numbering.xml",HE="application/vnd.openxmlformats-officedocument.wordprocessingml.numbering+xml",Fh="http://schemas.openxmlformats.org/officeDocument/2006/relationships/numbering",UE="default-bullet-numbering",jE="1",WE=(e,t)=>lt(U(FE.format(e,t))).elements[0],qh=e=>e.reduce((t,n)=>Math.max(t,n),0),KE=(e,t,{createContext:n,addContentTypeOverride:r})=>{let i=new Map,s,a=()=>{var f;return Te((f=t.get(Ye(ks)))!==null&&f!==void 0?f:{},"Relationships").find(h=>{var g;return((g=h.attributes)===null||g===void 0?void 0:g.Type)===Fh})},o=(f=a())=>f?on(ks,String(f.attributes.Target)):qE,c=(f,h)=>{var g;return Te((g=t.get(o()))!==null&&g!==void 0?g:{},"w:numbering").filter(y=>y.name===f).map(y=>Number(y.attributes[h]))},l=f=>{if(f===jE)return e.ConcreteNumbering.find(({reference:g})=>g===UE);if(!f.startsWith("{"))return;let h=e.ConcreteNumbering.find(({reference:g,instance:y})=>f===`{${g}-${y}}`);if(!h){let g=f.slice(1,-1).replace(/-\d+$/,"");throw new Error(`A paragraph in a patch uses the numbering "${g}", which isn't in the numbering option of patchDocument. Add it there with its levels, as in a Document`)}return h},u=f=>{var h;let g=i.get(f.numId);return g!==void 0?g:(s=((h=s)!==null&&h!==void 0?h:qh(c("w:num","w:numId")))+1,i.set(f.numId,s),s)},d=f=>{let h=f.name==="w:numId"?l(String(f.attributes["w:val"])):void 0;return h===void 0?f.elements===void 0?f:k(k({},f),{},{elements:f.elements.map(d)}):k(k({},f),{},{attributes:k(k({},f.attributes),{},{"w:val":String(u(h))})})},p=f=>{let h=a(),g=o(h);return t.has(g)||(t.set(g,{declaration:{attributes:{version:"1.0",encoding:"UTF-8",standalone:"yes"}},elements:[k(k({},f),{},{elements:[]})]}),r(HE,`/${g}`)),h||n(ks).viewWrapper.Relationships.addRelationship(Ln(),Fh,bc(ks,g)),g};return{renumber:f=>f.map(d),write:()=>{var f,h;if(i.size===0)return;let g=WE(e,n(o())),y=N=>Number(N.elements.find(M=>M.name==="w:abstractNumId").attributes["w:val"]),x=g.elements.filter(N=>N.name==="w:num"&&i.has(Number(N.attributes["w:numId"]))),b=qh(c("w:abstractNum","w:abstractNumId")),E=new Map([...new Set(x.map(y))].map((N,M)=>[N,b+M+1])),_=g.elements.flatMap(N=>{let M=N.name==="w:abstractNum"?E.get(Number(N.attributes["w:abstractNumId"])):void 0;return M===void 0?[]:[k(k({},N),{},{attributes:k(k({},N.attributes),{},{"w:abstractNumId":String(M)})})]}),v=p(g),T=t.get(v).elements.find(N=>N.name==="w:numbering");T.attributes=k(k(k({},Object.fromEntries(Object.entries(g.attributes).filter(([N])=>N.startsWith("xmlns:")))),T.attributes),{},{"mc:Ignorable":[...new Set([...String((f=(h=T.attributes)===null||h===void 0?void 0:h["mc:Ignorable"])!==null&&f!==void 0?f:"").split(" "),...String(g.attributes["mc:Ignorable"]).split(" ")])].filter(N=>N!=="").join(" ")});let w=Te(t.get(v),"w:numbering"),A=N=>{let M=w.findIndex(L=>N.includes(L.name));return M===-1?w.length:M};w.splice(A(["w:num","w:numIdMacAtCleanup"]),0,..._),w.splice(A(["w:numIdMacAtCleanup"]),0,...x.map(N=>k(k({},N),{},{attributes:k(k({},N.attributes),{},{"w:numId":String(i.get(Number(N.attributes["w:numId"])))}),elements:N.elements.map(M=>M.name==="w:abstractNumId"?k(k({},M),{},{attributes:{"w:val":String(E.get(y(N)))}}):M)})))}}},zl={nameOf:e=>e.type==="element"?e.name:void 0,contentOf:e=>e.elements,attributeOf:(e,t)=>{var n;return(n=e.attributes)===null||n===void 0?void 0:n[t]},textOf:e=>{var t;return((t=e.elements)!==null&&t!==void 0?t:[]).filter(({type:n})=>n==="text").map(({text:n})=>String(n)).join("")},textElement:e=>({type:"element",name:"w:t",attributes:{"xml:space":"preserve"},elements:[{type:"text",text:e}]}),writeClean:(e,t)=>{var n;/^\s*(PAGEREF|TOC)\b/i.test(t)&&((n=e.attributes)===null||n===void 0?void 0:n["w:dirty"])!==void 0&&(e.attributes=Object.fromEntries(Object.entries(e.attributes).filter(([r])=>r!=="w:dirty")))},setSimpleFieldResult:(e,t)=>{e.elements=[{type:"element",name:"w:r",elements:[zl.textElement(t)]}]}},xl="word/document.xml",GE="http://schemas.openxmlformats.org/officeDocument/2006/relationships/aFChunk",zE=[80,75,3,4],VE=(function(){var e=jt(function*(t){if(zE.every((n,r)=>t[r]===n))try{let n=new Map,r=new Map;for(let[s,a]of Lf(t))/\.(xml|rels)$/.test(s)?n.set(s,lt(Ys(a))):r.set(s,a);let i=yield Xf(n,r);return k({parts:n,binaryParts:r},i.size>0?{importedDocuments:i}:{})}catch{return}});return function(n){return e.apply(this,arguments)}})(),Xf=(function(){var e=jt(function*(t,n){let r=new Map;for(let[a,o]of t){var i,s;if(a.endsWith(".rels"))for(let{attributes:c={}}of(i=(s=Ns(o))===null||s===void 0?void 0:s.elements)!==null&&i!==void 0?i:[]){let l=on(Sf(a),String(c.Target)),u=n.get(l),d=c.Type===GE&&c.TargetMode!=="External"&&u?yield VE(u):void 0;d&&r.set(l,d)}}return r});return function(n,r){return e.apply(this,arguments)}})(),Ns=e=>{var t;return e==null||(t=e.elements)===null||t===void 0?void 0:t.find(({type:n})=>n==="element")},XE=(function(){var e=jt(function*(t,n,r=new Map){var i,s;let a=Ns(t.get(xl));if(!a)return;let o=yield Xf(t,r),c=n(k({parts:t,binaryParts:r},o.size>0?{importedDocuments:o}:{})),l=km(zl,a,c,{blank:!0}),u=(i=(s=Ns(t.get(Ye(xl))))===null||s===void 0?void 0:s.elements)!==null&&i!==void 0?i:[];for(let{attributes:d={}}of u){let p=/\/(header|footer)$/.test(String(d.Type))?Ns(t.get(on(xl,String(d.Target)))):void 0;p&&Tm(zl,p,c,{blank:!0,sectionPageCount:l.get(String(d.Id))})}});return function(n,r){return e.apply(this,arguments)}})(),YE=new Set(["w:hyperlink","w:sdt","w:sdtContent","w:ins","w:moveTo","w:smartTag","w:customXml","w:fldSimple","w:dir","w:bdo"]),Yf=(e,t)=>{var n;return((n=e.elements)!==null&&n!==void 0?n:[]).flatMap((r,i)=>{var s;return r.name==="w:r"?[{element:r,path:[...t,i]}]:YE.has((s=r.name)!==null&&s!==void 0?s:"")?Yf(r,[...t,i]):[]})},Bs=(e,t)=>t.reduce((n,r)=>n.elements[r],e),Gr=e=>{if(e.element.name!=="w:p")throw new Error(`Invalid node type: ${e.element.name}`);if(!e.element.elements)return{text:"",runs:[],index:-1,pathToParagraph:[]};let t=0,n=Yf(e.element,[]).map(({element:r,path:i})=>{let s=JE(r,i,t);return t+=s.text.length,s});return{text:n.reduce((r,i)=>r+i.text,""),runs:n,index:e.index,pathToParagraph:Jf(e)}},JE=(e,t,n)=>{if(!e.elements)return{text:"",parts:[],path:t,start:n,end:n};let r=n,i=e.elements.map((s,a)=>{var o,c;if(s.name!=="w:t"||!s.elements||s.elements.length===0)return;let l=(o=(c=s.elements[0].text)===null||c===void 0?void 0:c.toString())!==null&&o!==void 0?o:"",u=r;return r+=l.length,{text:l,index:a,start:u,end:u+l.length-1}}).filter(s=>!!s).map(s=>s);return{text:i.reduce((s,a)=>s+a.text,""),parts:i,path:t,start:n,end:i.length>0?i[i.length-1].end:n}},Jf=e=>e.parent?[...Jf(e.parent),e.index]:[e.index],QE=class extends Error{constructor(e){super(`Token ${e} not found`),this.name="TokenNotFoundError"}},ZE=(e,t)=>{let n=Gr({element:e,index:0,parent:void 0}).runs.find(({parts:r})=>r.some(({text:i})=>i.includes(t)));if(!n)throw new QE(t);return n.path},e2=(e,t)=>{var n,r;let i=-1,s=(n=(r=e.elements)===null||r===void 0?void 0:r.map((a,o)=>{if(i!==-1)return a;if(a.type==="element"&&a.name==="w:t"){var c,l;let u=((c=(l=a.elements)===null||l===void 0||(l=l[0])===null||l===void 0?void 0:l.text)!==null&&c!==void 0?c:"").split(t),d=u.map(p=>k(k(k({},a),jf(a)),{},{elements:Uf(p)}));return u.length>1&&(i=o),d}else return a}).flat())!==null&&n!==void 0?n:[];return{left:k(k({},JSON.parse(JSON.stringify(e))),{},{elements:s.slice(0,i+1)}),right:k(k({},JSON.parse(JSON.stringify(e))),{},{elements:s.slice(i+1)})}},Tr={START:0,MIDDLE:1,END:2},Qf=({paragraphElement:e,renderedParagraph:t,originalText:n,replacementText:r,fromIndex:i=0})=>{let s=t.text.indexOf(n,i),a=s+n.length-1,o=Tr.START;for(let c of t.runs){let l=Bs(e,c.path);for(let{text:u,index:d,start:p,end:m}of c.parts)switch(o){case Tr.START:if(s>=p&&s<=m){let f=s-p,h=Math.min(a,m)-p;if(u.substring(f,h+1)==="")continue;let g=u.substring(0,f)+r+u.substring(h+1);kl(l.elements[d],g),o=Tr.MIDDLE;continue}break;case Tr.MIDDLE:if(a<=m){let f=u.substring(a-p+1);kl(l.elements[d],f);let h=l.elements[d];l.elements[d]=jf(h),o=Tr.END}else kl(l.elements[d],"")}}return e},kl=(e,t)=>(e.elements=Uf(t),e),Hh=e=>{var t,n;return(t=(n=e.element.elements)===null||n===void 0?void 0:n.map((r,i)=>({element:r,index:i,parent:e})))!==null&&t!==void 0?t:[]},Zf=e=>{let t=[],n=[...Hh({element:e,index:0,parent:void 0})],r;for(;n.length>0;)r=n.shift(),r.element.name==="w:p"&&(t=[...t,Gr(r)]),n.push(...Hh(r));return t},Sc=(e,t)=>Zf(e).filter(n=>n.text.includes(t)),Tl="\uFFFF",t2=({json:e,patch:t,patchText:n,context:r,keepOriginalStyles:i=!0,recursive:s=!0,renumberIds:a=o=>o})=>{let o=Sc(e,n);if(o.length===0)return{element:e,didFindOccurrence:!1};let c=[...o].reverse(),l=t.type===Se.DOCUMENT?u2(c):c,u,d=()=>{var m;return u=((m=u)!==null&&m!==void 0?m:tg(e))+1,String(u)};for(let m of l)switch(t.type){case Se.DOCUMENT:{var p;let f=h2(e,m.pathToParagraph),h=m2(m.pathToParagraph),g=Uh(t,r,a),y=f.name==="w:tc"&&h===f.elements.length-1&&((p=g[g.length-1])===null||p===void 0?void 0:p.name)!=="w:p"?[{type:"element",name:"w:p"}]:[];f.elements.splice(h,1,...g,...y);break}case Se.PARAGRAPH:default:{let f=ng(e,m.pathToParagraph),h=m,g=0;do g=n2({paragraphElement:f,renderedParagraph:h,patchText:n,fromIndex:g,children:Uh(t,r,a),keepOriginalStyles:i,newTrackedChangeId:d}),h=Gr({element:f,index:m.index,parent:void 0});while(s&&h.text.includes(n,g));break}}return{element:e,didFindOccurrence:!0}},Uh=(e,t,n)=>n(e.children.flatMap(r=>{var i;return(i=r.writtenAs)!==null&&i!==void 0?i:r}).flatMap(r=>{let i=r.prepForXml(t);return i?[lt(U(i)).elements[0]]:[]})),n2=({paragraphElement:e,renderedParagraph:t,patchText:n,fromIndex:r,children:i,keepOriginalStyles:s,newTrackedChangeId:a})=>{let o=t.text.indexOf(n,r);Qf({paragraphElement:e,renderedParagraph:t,originalText:n,replacementText:Tl,fromIndex:r});let c=ZE(e,Tl),l=c.slice(0,-1),u=Bs(e,l),d=c[c.length-1],p=l.map((_,v)=>Bs(e,l.slice(0,v+1))).filter(_=>_.name==="w:sdt"),m=[...p].reverse().find(r2),f=u.elements[d],{left:h,right:g}=e2(f,Tl),y=f.elements.find(_=>_.type==="element"&&_.name==="w:rPr"),x=m?i2(m):y,b=s&&x?i.map(_=>eg(_,x)):i,E=y?k(k({},g),{},{elements:[y,...g.elements]}):g;return u.elements.splice(d,1,h,...b,E),p.forEach(_=>o2(_,b)),c2(e,l,a),o+Gr({element:{name:"w:p",elements:[...b]},index:0,parent:void 0}).text.length},Cc=e=>{var t;return(t=e.elements)===null||t===void 0?void 0:t.find(n=>n.name==="w:sdtPr")},r2=e=>{var t;return!!(!((t=Cc(e))===null||t===void 0||(t=t.elements)===null||t===void 0)&&t.some(n=>n.name==="w:showingPlcHdr"))},i2=e=>{var t;return(t=Cc(e))===null||t===void 0||(t=t.elements)===null||t===void 0?void 0:t.find(n=>n.name==="w:rPr")},s2=new Set(["w:rPr","w:t","w:tab","w:br"]),a2=e=>e.name==="w:bookmarkStart"||e.name==="w:bookmarkEnd"||e.name==="w:r"&&tn(e).every(t=>s2.has(t.name)),o2=(e,t)=>{let n=Cc(e);if(!n?.elements)return;let r=n.elements.some(i=>i.name==="w:text")&&!t.every(a2);n.elements=n.elements.filter(i=>i.name!=="w:showingPlcHdr"&&i.name!=="w:dataBinding"&&!(r&&i.name==="w:text"))},Vl=new Set(["w:hyperlink","w:fldSimple","w:subDoc"]),l2=new Map([["w:ins",Vl],["w:moveTo",Vl],["w:hyperlink",new Set(["w:hyperlink"])]]),c2=(e,t,n)=>{for(let i=t.length;i>0;i--){var r;let s=Bs(e,t.slice(0,i-1)),a=t[i-1],o=s.elements[a],c=l2.get(o.name),l=g=>!!c?.has(g.name);if(!(!((r=o.elements)===null||r===void 0)&&r.some(l)))continue;let{elements:u}=o,d=u.flatMap((g,y)=>y===0||l(g)||l(u[y-1])?[y]:[]),p=d.map((g,y)=>u.slice(g,d[y+1])),m=c===Vl,f=!0,h=p.map(g=>{if(l(g[0]))return g[0];let y=m&&!f?k(k({},o.attributes),{},{"w:id":n()}):o.attributes;return f=!1,k(k({},o),{},{attributes:y,elements:[...g]})});s.elements.splice(a,1,...h)}},eg=(e,t)=>e.name==="w:r"?d2(e,t):e.elements?k(k({},e),{},{elements:e.elements.map(n=>eg(n,t))}):e,d2=(e,t)=>{let n=tn(e).find(a=>a.type==="element"&&a.name==="w:rPr");if(!n)return k(k({},e),{},{elements:[t,...tn(e)]});let r=new Set(tn(n).map(a=>a.name)),i=[...tn(t).filter(a=>!r.has(a.name)),...tn(n)],s=k(k({},n),{},{elements:[...i].sort((a,o)=>jh(a)-jh(o))});return k(k({},e),{},{elements:tn(e).map(a=>a===n?s:a)})},Sl=["w:rStyle","w:rFonts","w:b","w:bCs","w:i","w:iCs","w:caps","w:smallCaps","w:strike","w:dstrike","w:outline","w:shadow","w:emboss","w:imprint","w:noProof","w:snapToGrid","w:vanish","w:webHidden","w:color","w:spacing","w:w","w:kern","w:position","w:sz","w:szCs","w:highlight","w:u","w:effect","w:bdr","w:shd","w:fitText","w:vertAlign","w:rtl","w:cs","w:em","w:lang","w:eastAsianLayout","w:specVanish","w:oMath","w14:glow","w14:shadow","w14:reflection","w14:textOutline","w14:textFill","w14:scene3d","w14:props3d","w14:ligatures","w14:numForm","w14:numSpacing","w14:stylisticSets","w14:cntxtAlts"],jh=e=>{var t;if(e.name==="w:rPrChange")return Sl.length+1;let n=Sl.indexOf((t=e.name)!==null&&t!==void 0?t:"");return n===-1?Sl.length:n},tn=e=>{var t;return(t=e.elements)!==null&&t!==void 0?t:[]},tg=e=>{var t,n;let r=Number((t=e.attributes)===null||t===void 0?void 0:t["w:id"]);return((n=e.elements)!==null&&n!==void 0?n:[]).reduce((i,s)=>Math.max(i,tg(s)),Number.isInteger(r)?r:0)},p2=(e,t)=>e.length>t.length&&t.every((n,r)=>e[r]===n),u2=e=>e.filter(t=>!e.some(n=>p2(t.pathToParagraph,n.pathToParagraph))),ng=(e,t)=>{let n=e;for(let r=1;r<t.length;r++){let i=t[r];n=n.elements[i]}return n},h2=(e,t)=>ng(e,t.slice(0,t.length-1)),m2=e=>e[e.length-1],f2=new ln,Cl="word/styles.xml",g2=new Set(["w:pStyle","w:rStyle","w:tblStyle","w:basedOn","w:next","w:link"]),Ir=e=>{var t;return String((t=e.attributes)===null||t===void 0?void 0:t["w:styleId"])},Xl=e=>{var t;let n=(t=e.elements)===null||t===void 0||(t=t.find(r=>r.name==="w:name"))===null||t===void 0||(t=t.attributes)===null||t===void 0?void 0:t["w:val"];return n===void 0?void 0:String(n).toLowerCase()},Is=(e,t)=>{var n;return e==null||(n=e.elements)===null||n===void 0?void 0:n.find(r=>r.name===t)},Wh=e=>{var t;let n=Number((t=Is(e,"w:sz"))===null||t===void 0||(t=t.attributes)===null||t===void 0?void 0:t["w:val"]);return Number.isNaN(n)?void 0:n},b2=e=>{var t,n;let r=e.filter(a=>a.name==="w:style"),i=(t=r.find(a=>Ir(a)==="Normal"))!==null&&t!==void 0?t:r.find(a=>{var o;return((o=a.attributes)===null||o===void 0?void 0:o["w:type"])==="paragraph"&&Xl(a)==="normal"}),s=e.find(a=>a.name==="w:docDefaults");return(n=Wh(Is(i,"w:rPr")))!==null&&n!==void 0?n:Wh(Is(Is(s,"w:rPrDefault"),"w:rPr"))},v2=(e,t)=>new Map(Object.values(gc({document:{run:{size:t}}})).map(n=>lt(U(f2.format(n,e))).elements[0]).filter(n=>n.name==="w:style").map(n=>[Ir(n),n])),w2=(e,t)=>{var n;let r=Te((n=e.get(Cl))!==null&&n!==void 0?n:{},"w:styles"),i=r.filter(f=>f.name==="w:style"),s=new Set(i.map(Ir)),a,o=f=>{var h;return(h=a)!==null&&h!==void 0||(a=v2(t(Cl),b2(r))),a.get(f)},c=new Set,l=new Map,u=f=>{let h=s.has(f)?void 0:o(f);if(h===void 0)return f;let g=i.find(y=>{var x,b;return((x=y.attributes)===null||x===void 0?void 0:x["w:type"])===((b=h.attributes)===null||b===void 0?void 0:b["w:type"])&&Xl(y)===Xl(h)});return g!==void 0?Ir(g):(c.add(f),f)},d=f=>(l.has(f)||l.set(f,u(f)),l.get(f)),p=f=>{var h;return g2.has((h=f.name)!==null&&h!==void 0?h:"")?k(k({},f),{},{attributes:k(k({},f.attributes),{},{"w:val":d(String(f.attributes["w:val"]))})}):f.elements===void 0?f:k(k({},f),{},{elements:f.elements.map(p)})};return{use:f=>f.map(p),write:()=>{let f=e.get(Cl);if(!f)return;let h=Te(f,"w:styles"),g=new Set(h.map(Ir));for(let y of c)g.has(y)||(g.add(y),h.push(p(o(y))))}}},y2={type:Se.PARAGRAPH,children:[]},x2=({json:e,key:t,patch:n,delimiters:{start:r,end:i},patchPlaceholder:s,renumberDrawings:a})=>{let o=`${r}${t}.`;for(let c of k2(e,o)){let l=C2(c.elements,o,i),u=n.rows.flatMap((d,p)=>{let m={type:"element",name:"w:tbl",elements:[...p===0?c.elements.map(E2):a(ig(c.elements))]},f=new Map(Object.entries(d).flatMap(([h,g])=>g===void 0?[]:[[h,g]]));for(let[h,g]of f)s(m,`${t}.${h}`,g);for(let h of l.filter(g=>!f.has(g)))s(m,`${t}.${h}`,y2);return m.elements});c.parent.elements.splice(c.parent.elements.indexOf(c.elements[0]),c.elements.length,...u),c.table&&!rg(c.table.element)&&c.table.parent.elements.splice(c.table.parent.elements.indexOf(c.table.element),1)}},k2=(e,t)=>{let n=Sc(e,t).flatMap(i=>{let s=T2(e,i.pathToParagraph);return s?[s]:[]}),r=n.filter(i=>!n.some(s=>S2(i.path,s.path))).filter((i,s,a)=>a.findIndex(o=>o.row===i.row)===s);return[...new Set(r.map(i=>i.parent))].flatMap(i=>{let s=i.elements.filter(c=>c.name==="w:tr"),a=r.filter(c=>c.parent===i).map(c=>s.indexOf(c.row)).sort((c,l)=>c-l),{table:o}=r.find(c=>c.parent===i);return a.reduce((c,l)=>{let u=c[c.length-1];return u?.[u.length-1]===l-1?[...c.slice(0,-1),[...u,l]]:[...c,[l]]},[]).map(c=>{let l=i.elements.indexOf(s[c[0]]),u=i.elements.indexOf(s[c[c.length-1]]);return{parent:i,table:o,elements:i.elements.slice(l,u+1)}})})},T2=(e,t)=>{let n=e,r,i;for(let s=1;s<t.length;s++){let a=n.elements[t[s]];a.name==="w:tbl"&&(i={element:a,parent:n}),a.name==="w:tr"&&(r={parent:n,table:i,row:a,path:t.slice(0,s+1)}),n=a}return r},S2=(e,t)=>e.length>t.length&&t.every((n,r)=>e[r]===n),rg=e=>{var t;return((t=e.elements)!==null&&t!==void 0?t:[]).some(n=>n.name==="w:tr"||n.name!=="w:tblPr"&&n.name!=="w:tblGrid"&&rg(n))},C2=(e,t,n)=>{let r=Sc({elements:[...e]},t).flatMap(({text:i})=>i.split(t).slice(1).flatMap(s=>{let a=s.indexOf(n);return a>0?[s.slice(0,a)]:[]}));return[...new Set(r)]},E2=e=>JSON.parse(JSON.stringify(e)),A2=["w14:paraId","w14:textId"],_2=["w:bookmarkStart","w:bookmarkEnd"],ig=(e,t)=>e.filter(n=>{var r;return!_2.includes((r=n.name)!==null&&r!==void 0?r:"")&&!(t?.name==="w:sdtPr"&&n.name==="w:id")}).map(n=>k(k(k({},n),n.attributes===void 0?{}:{attributes:Object.fromEntries(Object.entries(n.attributes).filter(([r])=>!A2.includes(r)))}),n.elements===void 0?{}:{elements:[...ig(n.elements,n)]})),N2=e=>e[0]===255&&e[1]===254||e[0]===254&&e[1]===255,I2=e=>{var t;let n=WC(e,"word/document.xml"),r=n===void 0||(t=[...e].find(([i])=>mC(i,n)))===null||t===void 0?void 0:t[1];return r===void 0||N2(r)?void 0:ec(zC(Ys(r)))},$s=(e,t,{start:n,end:r},i)=>{for(let s=e.indexOf(n,t);s!==-1;s=e.indexOf(n,s+1)){let a=e.indexOf(r,s+n.length);if(a===-1)return;let o=e.slice(s+n.length,a),c=o.trim();if(c!==o&&i(c))return{index:s,placeholder:e.slice(s,a+r.length),trimmed:`${n}${c}${r}`}}},P2=(e,t,n)=>{let r=e;for(let i=$s(r,0,t,n);i!==void 0;i=$s(r,i.index+i.trimmed.length,t,n))r=`${r.slice(0,i.index)}${i.trimmed}${r.slice(i.index+i.placeholder.length)}`;return r},sg=e=>{var t;return((t=e.elements)!==null&&t!==void 0?t:[]).flatMap(n=>[...n.name==="w:p"?[n]:[],...sg(n)])},O2=(e,t,n)=>{let r=()=>Gr({element:e,index:0,parent:void 0});for(let i=r(),s=$s(i.text,0,t,n);s!==void 0;i=r(),s=$s(i.text,s.index+s.trimmed.length,t,n))Qf({paragraphElement:e,renderedParagraph:i,originalText:s.placeholder,replacementText:s.trimmed,fromIndex:s.index})},R2=(e,{delimiters:t,textKeys:n,tableRowsKeys:r,drawingKeys:i})=>{let s=c=>n.has(c)||r.some(l=>c.startsWith(`${l}.`));for(let c of sg(e))O2(c,t,s);let a=c=>i.has(c);for(let{properties:c}of Js(e))for(let l of["descr","title"]){var o;let u=(o=c.attributes)===null||o===void 0?void 0:o[l];u!==void 0&&(c.attributes[l]=P2(String(u),t,a))}},ag=e=>{var t;return e.name==="v:shapetype"&&((t=e.attributes)===null||t===void 0?void 0:t.id)!==void 0?String(e.attributes.id):void 0},og=e=>{var t;let n=ag(e);return[...n===void 0?[]:[n],...((t=e.elements)!==null&&t!==void 0?t:[]).flatMap(og)]},L2=e=>{let t=new Set(og(e)),n=r=>{let i=ag(r);return i!==void 0?t.has(i)?[]:(t.add(i),[r]):[r.elements===void 0?r:k(k({},r),{},{elements:r.elements.flatMap(n)})]};return r=>r.flatMap(n)},lg=(e,t,{inTableRow:n})=>{if(t?.type===Se.TABLE_ROWS&&Array.isArray(t.rows)){for(let r of t.rows){if(typeof r!="object"||r===null)throw new Error(`Invalid patch "${e}". Expected each of its rows to be an object of patches, by the name of their field`);for(let[i,s]of Object.entries(r))s!==void 0&&lg(`${e}.${i}`,s,{inTableRow:!0})}return}if(!(t?.type===Se.DRAWING?!n&&typeof t.patch=="function":t?.type!==Se.TABLE_ROWS&&Array.isArray(t?.children)))throw new Error(`Invalid patch "${e}". Expected { type: PatchType.PARAGRAPH or PatchType.DOCUMENT, children: [...] }, ${n?"or { type: PatchType.TABLE_ROWS, rows: [...] }":"{ type: PatchType.TABLE_ROWS, rows: [...] }, or a drawing patch such as ImagePatch, or ChartDataPatch from docx/charts"}`)},Kh=new Ff,M2=new Uint8Array([255,254]),D2=new Uint8Array([254,255]),B2=new Set(["w:document","w:hdr","w:ftr","w:footnotes","w:endnotes","w:comments"]),Gh=(e,t)=>{if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0},WI=(function(){var e=jt(function*({outputType:t,data:n,patches:r,keepOriginalStyles:i,placeholderDelimiters:s={start:"{{",end:"}}"},recursive:a=!0,trimPlaceholders:o=!1,footnotes:c,endnotes:l,numbering:u={config:[]},pageNumbers:d,properties:p}){let m=yield zf(n),f=new Map,h=I2(m),g=[],y=new hf({addOverride:(D,$)=>g.push({contentType:D,partName:$})},new Set([...m.keys()].filter(D=>D.startsWith("word/")).map(D=>D.slice(5)))),x={Media:new pf(D=>y.takePath("media","image",D)),Numbering:new uf(u),Theme:h&&{Colors:h},FootNotes:{View:{idOf:(D,$,q)=>Et("footnotes",D,$,q)}},Endnotes:{View:{idOf:(D,$,q)=>Et("endnotes",D,$,q)}},PackageParts:y},b=new Map,E=[],_=[],v=!1,T=new Map;Wf(s);let{start:w,end:A}=s;for(let[D,$]of Object.entries(r))lg(D,$,{inTableRow:!1});for(let[D,$]of m){var N;let q=$.slice(0,2);if(Gh(q,M2)||Gh(q,D2)){T.set(D,$);continue}if(!D.endsWith(".xml")&&!D.endsWith(".rels")){T.set(D,$);continue}let ie=lt(Ys($)),se=(N=ie.elements)===null||N===void 0?void 0:N.find(ae=>{var te;return B2.has((te=ae.name)!==null&&te!==void 0?te:"")});if(se&&se.attributes){for(let ae of["mc","wp","r","w15","m","v","o"])se.attributes[`xmlns:${ae}`]=Ol[ae];se.attributes["mc:Ignorable"]=`${se.attributes["mc:Ignorable"]||""} w15`.trim()}b.set(D,ie)}let M=lE([...b.values()].flatMap(Hf)),L=kE([...b.values()].flatMap(Kf)),F=new Map,J=D=>{let $=F.get(D);if($)return $;let q={Relationships:{addRelationship:(ie,se,ae,te)=>{_.push({key:D,id:ie,type:se,target:ae,targetMode:te})}}};return F.set(D,q),q},z=D=>({file:x,viewWrapper:J(D),stack:[]}),X=(D,$)=>{g.push({contentType:D,partName:$})},Z=w2(b,z),fe=KE(x.Numbering,b,{createContext:z,addContentTypeOverride:X}),ce=$E({footnotes:c,endnotes:l},b,{createContext:z,addContentTypeOverride:X,renumberBookmarks:M,renumberDrawings:L,renumberLists:fe.renumber,useStyles:Z.use}),Et=(D,$,q,ie)=>ie.viewWrapper===J("word/document.xml")?ce.carry(D,$,q):void 0;if(o){let D=q=>Object.entries(r).flatMap(([ie,se])=>q(se.type)?[ie]:[]),$={delimiters:{start:w,end:A},textKeys:new Set(D(q=>q!==Se.TABLE_ROWS&&q!==Se.DRAWING)),tableRowsKeys:D(q=>q===Se.TABLE_ROWS),drawingKeys:new Set(D(q=>q===Se.DRAWING))};for(let[q,ie]of b)q.startsWith("word/")&&!q.endsWith(".rels")&&R2(ie,$)}_E({parts:b,binaryParts:T,file:x,patches:Object.entries(r).flatMap(([D,$])=>$.type===Se.DRAWING?[[D,$]]:[]),delimiters:{start:w,end:A}},z);let Ee=Object.entries(r).flatMap(([D,$])=>$.type===Se.DRAWING?[]:[[D,$]]),He=[...Ee.filter(([,D])=>D.type===Se.TABLE_ROWS),...Ee.filter(([,D])=>D.type!==Se.TABLE_ROWS)];for(let[D,$]of[...b]){if(!D.startsWith("word/")||D.endsWith(".xml.rels"))continue;let q=z(D);f.set(D,q);let ie=L2($),se=(ae,te,Re)=>{if(Re.type===Se.TABLE_ROWS){x2({json:ae,key:te,patch:Re,delimiters:{start:w,end:A},patchPlaceholder:se,renumberDrawings:L});return}let Fc=[],{didFindOccurrence:jg}=t2({json:ae,patch:k(k({},Re),{},{children:Re.children.flatMap(Ue=>Ue instanceof Bm?Ue.writtenAs:[Ue]).map(Ue=>{if(Ue instanceof k1){let{target:Wg,anchor:Kg}=Hm(Ue.options.link),qc=new pc(Ue.options.children,Ln(),Kg,Ue.options.link);return Fc.push({key:D,id:qc.linkId,type:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink",target:Wg,targetMode:ic.EXTERNAL}),qc}else return Ue})}),patchText:`${w}${te}${A}`,context:q,keepOriginalStyles:i,recursive:a,renumberIds:Ue=>Z.use(fe.renumber(ce.renumber(M(L(ie(Ue))))))});jg&&_.push(...Fc)};for(let[ae,te]of He)se($,ae,te)}ce.write(),fe.write(),Z.write();for(let[D,$]of b){if(!D.startsWith("word/")||D.endsWith(".xml.rels"))continue;let q=Kh.getMediaData(JSON.stringify($),x.Media);q.length>0&&(v=!0,E.push({key:D,mediaDatas:q}))}for(let{key:D,mediaDatas:$}of E){var we;let q=Ye(D),ie=(we=b.get(q))!==null&&we!==void 0?we:$r();b.set(q,ie);let se=kc(ie),ae=Kh.replace(JSON.stringify(b.get(D)),$,se);b.set(D,JSON.parse(ae));for(let te=0;te<$.length;te++){let{fileName:Re}=$[te];Ul(ie,se+te,"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image",`media/${Re}`)}}for(let{key:D,id:$,type:q,target:ie,targetMode:se}of _){var ye;let ae=Ye(D),te=(ye=b.get(ae))!==null&&ye!==void 0?ye:$r();b.set(ae,te),Ul(te,$,q,ie,se)}d&&(yield XE(b,d,T)),p&&wE(b,T,p,{addContentTypeOverride:X});let re=yc(x,void 0);if(v||g.length>0){let D=b.get("[Content_Types].xml");if(!D)throw new Error("Could not find content types file");v&&(_n(D,"image/png","png"),_n(D,"image/jpeg","jpeg"),_n(D,"image/jpeg","jpg"),_n(D,"image/bmp","bmp"),_n(D,"image/gif","gif"),_n(D,"image/svg+xml","svg"));for(let{contentType:$,partName:q}of g)dE(D,$,q)}return ql(Ms([...[...b].map(([D,$])=>[D,tx($)]),...T,...x.Media.Array.map(({data:D,fileName:$})=>[`word/media/${$}`,D]),...re.map(({path:D,data:$})=>[D,$])]),t,"application/vnd.openxmlformats-officedocument.wordprocessingml.document")});return function(n){return e.apply(this,arguments)}})(),$2=e=>e.startsWith("word/")&&/\.(xml|rels)$/.test(e)&&!e.endsWith(".xml.rels"),KI=(function(){var e=jt(function*({data:t,placeholderDelimiters:n={start:"{{",end:"}}"},trimPlaceholders:r=!1}){Wf(n);let i=F2(n),s=yield zf(t,$2),a=new Set;for(let[,o]of s){let c=lt(Ys(o));[...Zf(c).map(l=>l.text),...Js(c).flatMap(({properties:l})=>Gf(l))].flatMap(l=>{var u;return(u=l.match(i))!==null&&u!==void 0?u:[]}).map(l=>r?l.trim():l).filter(l=>l!=="").forEach(l=>a.add(l))}return Array.from(a)});return function(n){return e.apply(this,arguments)}})(),El=e=>e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),F2=({start:e,end:t})=>new RegExp(`(?<=${El(e)})(?:(?!${El(e)}).)+?(?=${El(t)})`,"gs")});var gg={};oa(gg,{EXPORT_DIR:()=>zr,FORMATS:()=>Ec,buildIR:()=>ea,exportDoc:()=>Ac,irToDocx:()=>fg,irToHtml:()=>ta});import dg from"node:fs";import pg from"node:path";function H2(e){return`${String(e.getDate()).padStart(2,"0")}/${String(e.getMonth()+1).padStart(2,"0")}/${e.getFullYear()}`}function j2(e,t){let n=e.result;if(!n)return[t.status["not-run"]];let r=[t.status[n.status]];return n.actual&&r.push(t.actual+n.actual),n.bug&&r.push(t.bug+n.bug),r}function W2(e,t,n,r){let i=e.kind==="non-functional",s=e.cases.filter(l=>!l.deleted),a=[...i?n.headNf:n.headFn],o=[7,27,38,28];t.results&&(a.push(...n.headResult),o=[8,20,27,20,13,12]);let c=s.map((l,u)=>{let p=[[String(u+1),...t.codes?[l.code]:[]],Zs(i&&l.requirement||l.case),Zs(l.steps),Zs(l.expected)];return t.results&&p.push(j2(l,n),l.result?[l.result.by??"",U2(l.result.at,r)].filter(Boolean):[]),p});return{head:a,widths:o,rows:c}}function hg(e){let t=br();for(let n of e)Qo(n,t);return t}function ea(e,t={}){let n=e.config,r=n.overview??{},i=t.date??new Date,s=n.language==="en"?"en":"vi",a=q2[s],o=[],c=b=>Zt(e,b),l=e.modules.filter(b=>c(b.code).some(E=>E.kind==="functional")),u=e.modules.filter(b=>c(b.code).some(E=>E.kind==="non-functional")),d=ft(e.root,n.ba),p=d?Qt(d):null;o.push({k:"cover",lines:[...r.owner?[{text:r.owner.toUpperCase(),bold:!0}]:[],{text:""},{text:a.coverDoc,bold:!0,size:32},{text:a.coverTitle,bold:!0,size:32},{text:n.title,bold:!0,size:28},{text:""},{text:a.docVersion+(r.docVersion||"1.0")},...t.results?[{text:a.withResults}]:[],{text:""},...r.owner?[{text:a.owner+r.owner}]:[],...r.contractor?[{text:a.contractor+r.contractor}]:[],{text:""},{text:(r.place?r.place+", ":"")+(s==="vi"?H2(i):i.toISOString().slice(0,10))}]}),o.push({k:"pagebreak"}),o.push({k:"p",text:a.signPage,bold:!0});let m=n.members.length?n.members:[{id:"",name:"",role:""}];o.push({k:"table",head:a.signHead,widths:[6,16,30,28,20],rows:m.map((b,E)=>[[String(E+1)],[""],[b.name],[b.role??""],[""]])}),o.push({k:"pagebreak"}),o.push({k:"toc",title:a.toc}),o.push({k:"pagebreak"});let f=0;o.push({k:"h",level:1,text:`${ug[f++]}. ${a.overview}`}),o.push({k:"h",level:2,text:a.purpose}),o.push({k:"p",text:r.purpose||a.purposeText(n.title)}),o.push({k:"h",level:2,text:a.scope}),r.scope?o.push({k:"p",text:r.scope}):(o.push({k:"p",text:a.scopeIntro}),o.push({k:"list",items:e.modules.filter(b=>c(b.code).length).map(b=>b.title)})),o.push({k:"h",level:2,text:a.env}),o.push({k:"p",text:r.environment||a.envDefault}),o.push({k:"h",level:2,text:a.refs}),o.push({k:"p",text:r.references||a.refsIntro}),r.references||o.push({k:"list",items:a.refsList}),o.push({k:"h",level:2,text:a.terms});let h=r.terms?.length?r.terms:a.termsDefault;o.push({k:"table",head:a.termsHead,widths:[8,30,62],rows:h.map((b,E)=>[[String(E+1)],[b.term],[b.desc]])});let g=(b,E,_)=>{if(o.push({k:"pagebreak"}),o.push({k:"h",level:1,text:`${ug[f++]}. ${b}`}),!E.length){o.push({k:"p",text:a.noSuites,italic:!0});return}E.forEach((v,T)=>{o.push({k:"h",level:2,text:`${T+1}. ${v.title}`}),_==="functional"&&v.commonSteps.trim()&&(o.push({k:"p",text:a.commonSteps,bold:!0}),o.push({k:"list",items:Zs(v.commonSteps)})),c(v.code).filter(w=>w.kind===_).forEach((w,A)=>{o.push({k:"h",level:3,text:`${T+1}.${A+1}. ${w.title}`});let N=[w.useCases.length?a.useCase+w.useCases.join(", "):"",w.covers.length?a.functions+w.covers.map(L=>p?.get(L)?.title?`${L} (${p.get(L).title})`:L).join("; "):""].filter(Boolean);if(N.length&&o.push({k:"p",text:N.join(" \xB7 "),italic:!0}),w.preconditions&&o.push({k:"p",text:a.pre+w.preconditions}),w.description.trim())for(let L of w.description.trim().split(/\n\s*\n/))o.push({k:"p",text:L.trim()});let M=W2(w,t,a,s);M.rows.length?o.push({k:"table",...M}):o.push({k:"p",text:a.noCases,italic:!0})})})};g(a.chFn,l,"functional"),g(a.chNf,u,"non-functional");let y=[];t.results&&y.push(()=>{o.push({k:"h",level:2,text:a.sumTitle});let b=e.modules.map(v=>({m:v,c:hg(c(v.code))})).filter(v=>v.c.total),E=hg(e.modules.flatMap(v=>c(v.code))),_=v=>v.total?Math.round(100*v.passed/v.total)+"%":"\u2014";o.push({k:"table",head:a.sumHead,widths:[30,10,8,10,9,9,11,13],rows:[...b.map(({m:v,c:T})=>[[v.title],[String(T.total)],[String(T.passed)],[String(T.failed)],[String(T.blocked)],[String(T.skipped)],[String(T["not-run"])],[_(T)]]),[[a.total],[String(E.total)],[String(E.passed)],[String(E.failed)],[String(E.blocked)],[String(E.skipped)],[String(E["not-run"])],[_(E)]]]})});let x=e.suites.filter(b=>b.status!=="deleted"&&b.covers.length);if(x.length&&y.push(()=>{o.push({k:"h",level:2,text:a.matrix});let b=new Map;for(let E of x)for(let _ of E.covers)b.set(_,[...b.get(_)??[],E.title]);o.push({k:"table",head:a.matrixHead,widths:[8,42,50],rows:[...b.entries()].sort((E,_)=>E[0].localeCompare(_[0])).map(([E,_],v)=>[[String(v+1)],[p?.get(E)?.title?`${E} \u2013 ${p.get(E).title}`:E],_])})}),y.length){o.push({k:"pagebreak"}),o.push({k:"h",level:1,text:a.appendix});for(let b of y)b()}return{title:n.title,lang:s,results:!!t.results,nodes:o}}function ta(e){let t=[],n=e.nodes.filter(s=>s.k==="h"),r=0;for(let s of e.nodes)if(s.k==="cover")t.push(`<section class="cover">${s.lines.map(a=>a.text?`<p class="${a.bold?"b":""}"${a.size?` style="font-size:${a.size/2}pt"`:""}>${St(a.text)}</p>`:"<p> </p>").join("")}</section>`);else if(s.k==="h")t.push(`<h${s.level} id="h${r++}">${St(s.text)}</h${s.level}>`);else if(s.k==="p")t.push(`<p${s.bold||s.italic?` class="${s.bold?"b":""} ${s.italic?"i":""}"`:""}>${St(s.text).replace(/\n/g,"<br>")}</p>`);else if(s.k==="list")t.push(`<ul>${s.items.map(a=>`<li>${St(a)}</li>`).join("")}</ul>`);else if(s.k==="toc")t.push(`<nav class="toc"><p class="b">${St(s.title)}</p>${n.map((a,o)=>`<a class="l${a.level}" href="#h${o}">${St(a.text)}</a>`).join("")}</nav>`);else if(s.k==="pagebreak")t.push('<div class="pb"></div>');else if(s.k==="table"){let a=s.widths?`<colgroup>${s.widths.map(o=>`<col style="width:${o}%">`).join("")}</colgroup>`:"";t.push(`<table>${a}<thead><tr>${s.head.map(o=>`<th>${St(o)}</th>`).join("")}</tr></thead><tbody>${s.rows.map(o=>`<tr>${o.map(c=>`<td>${c.map(St).join("<br>")}</td>`).join("")}</tr>`).join("")}</tbody></table>`)}return`<!doctype html><html lang="${e.lang}"><head><meta charset="utf-8"><title>${St(e.title)}</title><style>body{background:#e9ecef;margin:0;font:12pt/1.45 "Times New Roman",serif;color:#111}
|
|
4282
5294
|
main{background:#fff;max-width:794px;margin:24px auto;padding:72px 64px;box-shadow:0 1px 4px rgba(0,0,0,.15)}
|
|
4283
5295
|
.cover{text-align:center;min-height:900px;display:flex;flex-direction:column;justify-content:center}.cover p{margin:4px 0}
|
|
4284
5296
|
.b{font-weight:700}.i{font-style:italic}h1{font-size:14pt;margin:24px 0 10px}h2{font-size:13pt;margin:18px 0 8px}h3{font-size:12pt;margin:14px 0 6px}
|
|
@@ -4286,9 +5298,20 @@ p{margin:6px 0;text-align:justify}table{width:100%;border-collapse:collapse;marg
|
|
|
4286
5298
|
th,td{border:1px solid #555;padding:4px 6px;vertical-align:top;text-align:left;overflow-wrap:break-word}th{background:#f1f3f5;overflow-wrap:normal;word-break:keep-all}
|
|
4287
5299
|
.pb{height:0;border-top:1px dashed #ccc;margin:36px -64px;page-break-after:always}.toc a{display:block;color:#111;text-decoration:none;padding:2px 0}
|
|
4288
5300
|
.toc .l2{padding-left:18px}.toc .l3{padding-left:36px;font-size:11pt}@media print{body{background:#fff}main{box-shadow:none;margin:0;padding:0}.pb{border:0;margin:0}}</style></head><body><main>${t.join(`
|
|
4289
|
-
`)}</main></body></html>`}async function
|
|
4290
|
-
`).map((s,a)=>new
|
|
4291
|
-
`).map(t=>t.replace(/^\s*[-*+]\s+/,"").trimEnd()).filter(t=>t.trim());
|
|
5301
|
+
`)}</main></body></html>`}async function fg(e){let t=[],n=(i,s=!1)=>(i.length?i:[""]).map(a=>new ne({children:[new Oe({text:a,bold:s})]}));for(let i of e.nodes)if(i.k==="cover")for(let s of i.lines)t.push(new ne({alignment:pe.CENTER,spacing:{after:120},children:[new Oe({text:s.text,bold:!!s.bold,...s.size?{size:s.size}:{}})]}));else if(i.k==="h")t.push(new ne({heading:K2[Math.min(i.level,3)-1],keepNext:!0,children:[new Oe({text:i.text})]}));else if(i.k==="p")t.push(new ne({alignment:pe.JUSTIFIED,children:i.text.split(`
|
|
5302
|
+
`).map((s,a)=>new Oe({text:s,bold:!!i.bold,italics:!!i.italic,...a?{break:1}:{}}))}));else if(i.k==="list")for(let s of i.items)t.push(new ne({bullet:{level:0},children:[new Oe({text:s})]}));else if(i.k==="toc")t.push(new ne({alignment:pe.CENTER,children:[new Oe({text:i.title,bold:!0})]})),t.push(new Df(i.title,{hyperlink:!0,headingStyleRange:"1-3"}));else if(i.k==="pagebreak")t.push(new ne({children:[new Mm]}));else if(i.k==="table"){let s=c=>i.widths?.[c]?{width:{size:i.widths[c],type:$e.PERCENTAGE}}:{},a=new Gs({tableHeader:!0,cantSplit:!0,children:i.head.map((c,l)=>new Mr({borders:mg,shading:{fill:"F1F3F5"},...s(l),children:n([c],!0)}))}),o=i.rows.map(c=>new Gs({cantSplit:!1,children:c.map((l,u)=>new Mr({borders:mg,...s(u),children:n(l)}))}));t.push(new tf({width:{size:100,type:$e.PERCENTAGE},rows:[a,...o]})),t.push(new ne({children:[]}))}let r=new Mf({creator:"Pan Test",title:e.title,features:{updateFields:!0},styles:{default:{document:{run:{font:"Times New Roman",size:26}}}},sections:[{properties:{page:{margin:{top:1134,bottom:1134,left:1701,right:1134}}},children:t}]});return xc.toBuffer(r)}async function Ac(e,t={}){let n=ea(e,t),r=pg.resolve(e.root,t.out??zr);dg.mkdirSync(r,{recursive:!0});let i=t.date??new Date,s=pg.join(r,`${G2(e.config.title)}${t.results?"-ket-qua":""}-${i.toISOString().slice(0,10)}`),a=[];for(let o of t.formats??["docx"]){let c=`${s}.${o}`;dg.writeFileSync(c,o==="docx"?await fg(n):ta(n)),a.push(c)}return a}var q2,ug,Zs,U2,St,Qs,mg,K2,zr,Ec,G2,na=Ae(()=>{"use strict";S();cg();hr();gs();gr();q2={vi:{status:{"not-run":"Ch\u01B0a test",passed:"\u0110\u1EA1t",failed:"Kh\xF4ng \u0111\u1EA1t",blocked:"B\u1ECB ch\u1EB7n",skipped:"B\u1ECF qua"},actual:"Th\u1EF1c t\u1EBF: ",bug:"L\u1ED7i: ",headFn:["STT","T\xECnh hu\u1ED1ng","C\xE1c b\u01B0\u1EDBc th\u1EF1c hi\u1EC7n","K\u1EBFt qu\u1EA3 mong \u0111\u1EE3i"],headNf:["STT","Y\xEAu c\u1EA7u","K\u1ECBch b\u1EA3n ki\u1EC3m th\u1EED","K\u1EBFt qu\u1EA3 mong \u0111\u1EE3i"],headResult:["K\u1EBFt qu\u1EA3","Ng\u01B0\u1EDDi test / ng\xE0y"],coverDoc:"T\xC0I LI\u1EC6U",coverTitle:"K\u1ECACH B\u1EA2N KI\u1EC2M TH\u1EEC (CH\u1EE8C N\u0102NG, PHI CH\u1EE8C N\u0102NG)",docVersion:"Phi\xEAn b\u1EA3n t\xE0i li\u1EC7u: ",withResults:"B\u1EA3n k\xE8m k\u1EBFt qu\u1EA3 ki\u1EC3m th\u1EED",owner:"\u0110\u01A1n v\u1ECB qu\u1EA3n l\xFD: ",contractor:"\u0110\u01A1n v\u1ECB th\u1EF1c hi\u1EC7n: ",signPage:"TRANG K\xDD",signHead:["TT","Ng\xE0y","H\u1ECD t\xEAn","Vai tr\xF2","K\xFD t\xEAn"],toc:"M\u1EE4C L\u1EE4C",overview:"T\u1ED4NG QUAN",purpose:"1. M\u1EE5c \u0111\xEDch t\xE0i li\u1EC7u",purposeText:e=>`T\xE0i li\u1EC7u n\xE0y m\xF4 t\u1EA3 c\xE1c t\xECnh hu\u1ED1ng ki\u1EC3m th\u1EED ch\u1EE9c n\u0103ng v\xE0 phi ch\u1EE9c n\u0103ng c\u1EE7a ${e}, l\xE0m c\u0103n c\u1EE9 ki\u1EC3m th\u1EED ch\u1EA5p nh\u1EADn (UAT) v\xE0 b\xE0n giao.`,scope:"2. Ph\u1EA1m vi",scopeIntro:"T\xE0i li\u1EC7u ki\u1EC3m th\u1EED c\xE1c ch\u1EE9c n\u0103ng, th\u1ECFa m\xE3n c\xE1c \u0111\u1EA7u m\u1EE5c ch\xEDnh nh\u01B0 sau:",env:"3. Th\xF4ng tin m\xF4i tr\u01B0\u1EDDng ki\u1EC3m th\u1EED",envDefault:"\u0110\u01B0\u1EDDng d\u1EABn / m\xE1y ch\u1EE7: (b\u1ED5 sung)",refs:"4. T\xE0i li\u1EC7u li\xEAn quan",refsIntro:"T\xE0i li\u1EC7u n\xE0y \u0111\u01B0\u1EE3c x\xE2y d\u1EF1ng d\u1EF1a tr\xEAn c\xE1c t\xE0i li\u1EC7u:",refsList:["T\xE0i li\u1EC7u \u0111\u1EB7c t\u1EA3 y\xEAu c\u1EA7u ph\u1EA7n m\u1EC1m;","T\xE0i li\u1EC7u thi\u1EBFt k\u1EBF chi ti\u1EBFt;","T\xE0i li\u1EC7u \u0111\u1EB7c t\u1EA3 chi ti\u1EBFt ch\u1EE9c n\u0103ng."],terms:"5. Thu\u1EADt ng\u1EEF v\xE0 \u0111\u1ECBnh ngh\u0129a",termsHead:["STT","Thu\u1EADt ng\u1EEF / vi\u1EBFt t\u1EAFt","M\xF4 t\u1EA3"],termsDefault:[{term:"UAT",desc:"Ki\u1EC3m th\u1EED ch\u1EA5p nh\u1EADn ng\u01B0\u1EDDi d\xF9ng (User Acceptance Test)"},{term:"K\u1ECBch b\u1EA3n",desc:"T\u1EADp t\xECnh hu\u1ED1ng ki\u1EC3m th\u1EED cho m\u1ED9t ch\u1EE9c n\u0103ng / use case"},{term:"T\xECnh hu\u1ED1ng",desc:"M\u1ED9t tr\u01B0\u1EDDng h\u1EE3p ki\u1EC3m th\u1EED: c\xE1c b\u01B0\u1EDBc th\u1EF1c hi\u1EC7n v\xE0 k\u1EBFt qu\u1EA3 mong \u0111\u1EE3i"}],chFn:"CHI TI\u1EBET T\xCCNH HU\u1ED0NG KI\u1EC2M TH\u1EEC Y\xCAU C\u1EA6U CH\u1EE8C N\u0102NG \u1EE8NG D\u1EE4NG",chNf:"CHI TI\u1EBET T\xCCNH HU\u1ED0NG KI\u1EC2M TH\u1EEC Y\xCAU C\u1EA6U PHI CH\u1EE8C N\u0102NG \u1EE8NG D\u1EE4NG",noSuites:"(Ch\u01B0a c\xF3 k\u1ECBch b\u1EA3n.)",noCases:"(Ch\u01B0a c\xF3 t\xECnh hu\u1ED1ng.)",commonSteps:"C\xE1c b\u01B0\u1EDBc th\u1EF1c hi\u1EC7n chung:",useCase:"Use case: ",functions:"Ch\u1EE9c n\u0103ng: ",pre:"\u0110i\u1EC1u ki\u1EC7n ti\xEAn quy\u1EBFt: ",appendix:"PH\u1EE4 L\u1EE4C",sumTitle:"T\u1ED5ng h\u1EE3p k\u1EBFt qu\u1EA3 ki\u1EC3m th\u1EED",sumHead:["Ph\xE2n h\u1EC7","T\xECnh hu\u1ED1ng","\u0110\u1EA1t","Kh\xF4ng \u0111\u1EA1t","B\u1ECB ch\u1EB7n","B\u1ECF qua","Ch\u01B0a test","T\u1EF7 l\u1EC7 \u0111\u1EA1t"],total:"T\u1ED5ng",matrix:"Ma tr\u1EADn ch\u1EE9c n\u0103ng \u2013 k\u1ECBch b\u1EA3n ki\u1EC3m th\u1EED",matrixHead:["STT","Ch\u1EE9c n\u0103ng / m\xE0n (t\xE0i li\u1EC7u BA)","K\u1ECBch b\u1EA3n ki\u1EC3m th\u1EED"]},en:{status:{"not-run":"Not run",passed:"Passed",failed:"Failed",blocked:"Blocked",skipped:"Skipped"},actual:"Actual: ",bug:"Bug: ",headFn:["No.","Test case","Steps","Expected result"],headNf:["No.","Requirement","Test scenario","Expected result"],headResult:["Result","Tester / date"],coverDoc:"DOCUMENT",coverTitle:"TEST SCENARIOS (FUNCTIONAL, NON-FUNCTIONAL)",docVersion:"Document version: ",withResults:"With test results",owner:"Owner: ",contractor:"Contractor: ",signPage:"SIGN-OFF",signHead:["No.","Date","Full name","Role","Signature"],toc:"TABLE OF CONTENTS",overview:"OVERVIEW",purpose:"1. Purpose",purposeText:e=>`This document describes the functional and non-functional test scenarios of ${e}, used for user acceptance testing (UAT) and handover.`,scope:"2. Scope",scopeIntro:"The document covers the following main areas:",env:"3. Test environment",envDefault:"URL / server: (to be added)",refs:"4. Related documents",refsIntro:"This document is based on:",refsList:["Software requirements specification;","Detailed design;","Detailed functional specification."],terms:"5. Terms and definitions",termsHead:["No.","Term / abbreviation","Description"],termsDefault:[{term:"UAT",desc:"User Acceptance Test"},{term:"Test suite",desc:"The test cases of one function / use case"},{term:"Test case",desc:"One check: steps to perform and the expected result"}],chFn:"FUNCTIONAL TEST SCENARIOS",chNf:"NON-FUNCTIONAL TEST SCENARIOS",noSuites:"(No test suites yet.)",noCases:"(No test cases yet.)",commonSteps:"Common steps:",useCase:"Use case: ",functions:"Functions: ",pre:"Preconditions: ",appendix:"APPENDIX",sumTitle:"Test results summary",sumHead:["Module","Test cases","Passed","Failed","Blocked","Skipped","Not run","Pass rate"],total:"Total",matrix:"Function \u2013 test suite matrix",matrixHead:["No.","Function / screen (BA document)","Test suite"]}},ug=["I","II","III","IV","V","VI"],Zs=e=>String(e??"").split(`
|
|
5303
|
+
`).map(t=>t.replace(/^\s*[-*+]\s+/,"").trimEnd()).filter(t=>t.trim());U2=(e,t)=>{let n=/^(\d{4})-(\d{2})-(\d{2})/.exec(e??"");return n&&t==="vi"?`${n[3]}/${n[2]}/${n[1]}`:e??""};St=e=>e.replace(/[&<>"]/g,t=>({"&":"&","<":"<",">":">",'"':"""})[t]);Qs={style:Ur.SINGLE,size:4,color:"555555"},mg={top:Qs,bottom:Qs,left:Qs,right:Qs},K2=[Ks.HEADING_1,Ks.HEADING_2,Ks.HEADING_3];zr="exports",Ec=["docx","html"],G2=e=>e.normalize("NFD").replace(/[̀-ͯ]/g,"").replace(/đ/g,"d").replace(/Đ/g,"D").replace(/[^A-Za-z0-9]+/g,"-").replace(/^-|-$/g,"").slice(0,60)||"tai-lieu-kiem-thu"});function wg(e){return e==="mixed"?["vi","en"]:[e]}function _c(e){let t=[];for(let n of wg(e))for(let r of z2)for(let i of vg[n][r])t.push({kind:r,keyword:i});return t.sort((n,r)=>r.keyword.length-n.keyword.length)}function Nc(e){let t=[X2];for(let n of wg(e))for(let r of V2)t.push(...vg[n][r]);return t.sort((n,r)=>r.length-n.length)}function Z2(e,t){for(let{kind:n,keyword:r}of t){let i=`${r}:`;if(e.startsWith(i))return{kind:n,keyword:r,title:e.slice(i.length).trim()}}return null}function eA(e,t){for(let n of t){let r=`${n} `;if(!e.startsWith(r))continue;let i=e.slice(r.length).trim();if(i)return{keyword:n,text:i}}return null}function tA(e){return e.trim().split(/\s+/).filter(t=>t.startsWith("@"))}function nA(e,t){let n=e.find(s=>s.trim()!=="");if(!n)return"mixed";let r=n.trim().match(Y2);if(!r)return"mixed";let i=r[1].toLowerCase();if(i!=="vi"&&i!=="en")throw new Error(`Unsupported Gherkin language "${r[1]}" in ${t} (supported: vi, en)`);return i}function bg(e){if(!e.startsWith("|"))return null;let t=e.split("|");return t.length<2?null:t.slice(1,t.at(-1)?.trim()===""?-1:void 0).map(r=>r.trim())}function yg(e){return e.length>0?e[e.length-1]:null}function rA(e,t){let n=yg(e);n&&(n.dataTable||(n.dataTable=[]),n.dataTable.push(t))}function iA(e,t){let n=yg(e);n&&(n.docString=t)}function sA(e,t){let{scenario:n,startLine:r,endLine:i}=e;return n.lineRange={start:r,end:i},n.rawBlock=t.slice(r-1,i).join(`
|
|
5304
|
+
`),n}function xg(e,t){let n=e.split(/\r?\n/),r=nA(n,t),i=J2[r],s=Q2[r],a=[],o="",c=[],l=[],u=[],d=0,p=null,m="none",f,h=[],g=!1,y=[],x=null;function b(){return m==="background"?c:m==="ruleBackground"?h:p&&m==="scenario"?p.scenario.ownSteps:null}let E=new Map;function _(){if(!p)return;let v=sA(p,n);E.set(v,[...p.ruleBackgroundSteps]),l.push(v),p=null}for(let v=0;v<n.length;v+=1){let T=n[v],w=v+1,A=T.trim();if(!A)continue;if(g){A==='"""'?(x&&iA(x,y.join(`
|
|
5305
|
+
`)),g=!1,y=[],x=null):y.push(T),p&&(p.endLine=w);continue}if(A.startsWith("@")){u.length===0&&(d=w),u.push(...tA(T));continue}if(A.startsWith("#"))continue;let N=Z2(A,i);if(N){switch(N.kind){case"feature":_(),a=[...u],o=N.title,f=void 0,h=[],m="none";break;case"background":_(),m=f!==void 0?"ruleBackground":"background";break;case"rule":_(),f=N.title,h=[],m="none";break;case"scenario":case"scenarioOutline":{_();let F=u.length>0?d:w;p={startLine:F,endLine:w,ruleBackgroundSteps:[...h],scenario:{tags:[...u],title:N.title,keyword:N.keyword,isOutline:N.kind==="scenarioOutline",rule:f,steps:[],ownSteps:[],examples:[],rawBlock:"",lineRange:{start:F,end:w}}},m="scenario";break}case"examples":p&&(p.scenario.examples.push({keyword:N.keyword,headers:[],rows:[]}),p.endLine=w,m="examples");break}u=[];continue}let M=eA(A,s);if(M){m==="background"?c.push(M):m==="ruleBackground"?h.push(M):p&&(p.scenario.ownSteps.push(M),p.endLine=w,m="scenario");continue}if(m==="examples"&&p){let F=bg(A);if(F){let J=p.scenario.examples[p.scenario.examples.length-1];J.headers.length===0?J.headers=F:J.rows.push(F),p.endLine=w;continue}}if(A==='"""'){let F=b();if(F&&F.length>0){g=!0,y=[],x=F,p&&(p.endLine=w);continue}}let L=bg(A);if(L){let F=b();if(F){rA(F,L),p&&(p.endLine=w);continue}}p&&(p.endLine=w)}_();for(let v of l){let T=E.get(v)??[];v.steps=[...c,...T,...v.ownSteps]}return{filePath:t,language:r,featureTags:a,featureTitle:o,backgroundSteps:c,scenarios:l}}var vg,z2,V2,X2,Y2,J2,Q2,kg=Ae(()=>{"use strict";S();vg={vi:{feature:["T\xEDnh n\u0103ng"],background:["B\u1ED1i c\u1EA3nh"],rule:["Quy t\u1EAFc"],scenario:["T\xECnh hu\u1ED1ng","K\u1ECBch b\u1EA3n"],scenarioOutline:["Khung t\xECnh hu\u1ED1ng","Khung k\u1ECBch b\u1EA3n","K\u1ECBch b\u1EA3n m\u1EABu"],examples:["D\u1EEF li\u1EC7u","V\xED d\u1EE5"],given:["Bi\u1EBFt","Cho"],when:["Khi"],then:["Th\xEC"],and:["V\xE0"],but:["Nh\u01B0ng"]},en:{feature:["Feature"],background:["Background"],rule:["Rule"],scenario:["Scenario","Example"],scenarioOutline:["Scenario Outline","Scenario Template"],examples:["Examples","Scenarios"],given:["Given"],when:["When"],then:["Then"],and:["And"],but:["But"]}},z2=["feature","background","rule","scenario","scenarioOutline","examples"],V2=["given","when","then","and","but"],X2="*",Y2=/^#\s*language\s*:\s*(.+?)\s*$/;J2={vi:_c("vi"),en:_c("en"),mixed:_c("mixed")},Q2={vi:Nc("vi"),en:Nc("en"),mixed:Nc("mixed")}});function Tg(e){let t=[];Sg(e.suites??[],t);let n=0,r=0,i=0,s=0;for(let a of t)a.status==="skipped"?s++:a.flaky?i++:a.status==="passed"?n++:r++;return{passed:n,failed:r,flaky:i,skipped:s,specs:t}}function Sg(e,t,n=""){for(let r of e){let i=r.file??n;for(let s of r.specs??[])t.push(aA(s,s.file??i));r.suites&&Sg(r.suites,t,i)}}function aA(e,t){let n=e.tests??[],r="skipped",i=!1,s=0,a;for(let o of n){let c=o.results??[];for(let u of c)s+=Number(u.duration??0)||0;let l=o.status;if(l==="flaky")i=!0,r="passed";else if(l==="expected")r="passed";else if(l==="unexpected")r="failed";else if(l==="skipped")r="skipped";else{let u=c[c.length-1]?.status;r=u==="passed"?"passed":u==="skipped"?"skipped":u?"failed":r}if(!a){let u=c.find(p=>p.error?.message||p.errors&&p.errors[0]?.message),d=u?.error?.message??u?.errors?.[0]?.message;d&&(a=oA(d).split(`
|
|
5306
|
+
`).slice(0,4).join(`
|
|
5307
|
+
`))}}return{title:e.title??"(untitled)",file:t,tags:(e.tags??[]).map(o=>o.startsWith("@")?o:`@${o}`),status:r,flaky:i,durationMs:s,errorText:a}}function oA(e){return e.replace(/\u001b\[[0-9;]*[a-zA-Z]/g,"")}var Cg=Ae(()=>{"use strict";S()});var Rc={};oa(Rc,{applyRunResults:()=>Oc,featureFiles:()=>pA,importFeature:()=>Pc,parseRunResults:()=>ra,readRunResults:()=>uA,scenarioTag:()=>Eg,scenarioToCase:()=>_g});import Vr from"node:fs";import Ic from"node:path";function Eg(e,t=[]){let n=new Set(t.map(r=>r.toLowerCase()));return e.find(r=>!/^@p\d+$/i.test(r)&&!/^@domain-/i.test(r)&&!n.has(r.toLowerCase())&&!/^@(guide-video|flake|skip|wip|manual)$/i.test(r))}function Ag(e){let t=e.text;return e.dataTable?.length&&(t+=" "+e.dataTable.map(n=>n.join(" | ")).join("; ")),e.docString&&(t+=" \xAB"+e.docString.trim().replace(/\s+/g," ").slice(0,200)+"\xBB"),t}function _g(e){let t=[],n=[],r="do";for(let a of e.ownSteps){let o=a.keyword.trim();dA.test(o)?r="expect":(lA.test(o)||cA.test(o))&&(r="do"),(r==="expect"?n:t).push(Ag(a))}let i=t.map((a,o)=>`B${o+1}: ${a}`),s=e.examples.reduce((a,o)=>a+o.rows.length,0);return e.isOutline&&s&&i.push(`(Ch\u1EA1y v\u1EDBi ${s} b\u1ED9 d\u1EEF li\u1EC7u: ${e.examples[0].headers.join(", ")})`),{steps:i.join(`
|
|
5308
|
+
`),expected:n.join(`
|
|
5309
|
+
`)}}function Pc(e,t,n){let r=os(e,n.module),i=xg(t,n.file);if(!i.featureTitle&&!i.scenarios.length)throw new K(j(`${n.file}: kh\xF4ng th\u1EA5y \xABT\xEDnh n\u0103ng:\xBB / \xABFeature:\xBB hay k\u1ECBch b\u1EA3n n\xE0o.`,`${n.file}: no \xABFeature:\xBB / \xABT\xEDnh n\u0103ng:\xBB or scenarios found.`));let s=n.by??gt(e.root),a=ss(e,n.avoid),o=e.suites.find(d=>d.source===n.file&&d.status!=="deleted"),c=!o;if(o)i.featureTitle&&(o.title=i.featureTitle);else{let d=un("KB",r.code,a);a.add(d),o={code:d,module:r.code,title:i.featureTitle||Ic.basename(n.file,".feature"),kind:"functional",status:"drafting",covers:[],useCases:[],owner:s,created:{by:s,at:new Date().toISOString().replace(/\.\d{3}Z$/,"Z")},source:n.file,description:"",cases:[],file:""},e.suites.push(o)}i.backgroundSteps.length&&(o.preconditions=i.backgroundSteps.map(Ag).join("; "));let l={suite:o.code,created:c,added:[],updated:[],missing:[],untagged:0},u=new Set;for(let d of i.scenarios){let p=Eg(d.tags,i.featureTags);p||l.untagged++;let{steps:m,expected:f}=_g(d),h=o.cases.filter(y=>!y.deleted),g=p?h.find(y=>y.tag?.toLowerCase()===p.toLowerCase()):h.find(y=>!y.tag&&y.case===d.title);if(g)g.case=d.title,g.steps=m,g.expected=f,u.add(g.code),l.updated.push(g.code);else{let y=un("TC",r.code,a);a.add(y);let x={code:y,case:d.title,steps:m,expected:f,...p?{tag:p}:{}};o.cases.push(x),u.add(y),l.added.push(y)}}return l.missing=o.cases.filter(d=>!d.deleted&&d.tag&&!u.has(d.code)).map(d=>d.code),Ge(e.root,o),c&&fr(e,r.code,{suites:[...Zt(e,r.code).map(d=>d.code).filter(d=>d!==o.code),o.code]}),l}function pA(e){let t=[],n=r=>{for(let i of Vr.readdirSync(r,{withFileTypes:!0})){if(i.name.startsWith(".")||i.name==="node_modules")continue;let s=Ic.join(r,i.name);i.isDirectory()?n(s):i.name.endsWith(".feature")&&t.push(s)}};return n(e),t.sort()}function uA(e){let t=Vr.existsSync(e)&&Vr.statSync(e).isDirectory()?Ic.join(e,"results.json"):e;if(!Vr.existsSync(t))throw new K(j(`Kh\xF4ng th\u1EA5y ${t} \u2014 c\u1EA7n results.json c\u1EE7a l\u1EA7n ch\u1EA1y pan-test (Playwright JSON reporter).`,`${t} not found \u2014 need the results.json of a pan-test run (Playwright JSON reporter).`));return ra(Vr.readFileSync(t,"utf8"))}function ra(e){let t;try{t=JSON.parse(e)}catch{throw new K(j("results.json kh\xF4ng ph\u1EA3i JSON h\u1EE3p l\u1EC7.","results.json is not valid JSON."))}return Tg(t).specs}function Oc(e,t,n={}){let r=new Map;for(let c of t)for(let l of c.tags)r.set(l.toLowerCase(),[...r.get(l.toLowerCase())??[],c]);let i={applied:[],notRun:[],unknownTags:[]},s=new Set,a=n.at??new Date().toISOString().slice(0,10);for(let c of e.suites){if(c.status==="deleted")continue;let l=!1;for(let u of c.cases){if(u.deleted||!u.tag)continue;let d=u.tag.toLowerCase();s.add(d);let p=r.get(d);if(!p?.length){i.notRun.push(u.code);continue}let m=p.filter(g=>g.status==="failed"),f=m.length?"failed":p.every(g=>g.status==="skipped")?"skipped":"passed",h=m.length?(m.map(g=>g.errorText).find(Boolean)??"K\u1ECBch b\u1EA3n t\u1EF1 \u0111\u1ED9ng kh\xF4ng \u0111\u1EA1t.").slice(0,600):void 0;u.result={status:f,by:n.by??"pan-test",at:a,...h?{actual:h}:{},...n.env?{env:n.env}:{}},i.applied.push({code:u.code,status:f}),l=!0}l&&Ge(e.root,c)}let o=/^@(p\d+|domain-.*|guide-video|flake|skip|wip)$/i;return i.unknownTags=[...r.keys()].filter(c=>!s.has(c)&&!o.test(c)).sort(),i}var lA,cA,dA,Xr=Ae(()=>{"use strict";S();Dn();kg();Cg();hn();gr();En();lA=/^(given|cho|biết)$/i,cA=/^(when|khi)$/i,dA=/^(then|thì)$/i});import{spawn as hA}from"node:child_process";import mA from"node:http";import fA from"node:path";function gA(e,t){let n=["ai-host","--dir",e,"--lang",t,"--lifeline"],r=process.env.PAN_CLI_JS?.trim();return r?{file:process.execPath,args:[r,...n],shell:!1}:{file:"pan",args:n,shell:process.platform==="win32"}}function bA(e,t){let n=cn.get(e);if(n)return n;let r=new Promise((i,s)=>{let a=gA(e,t),o=hA(a.file,a.args,{cwd:e,env:process.env,stdio:["pipe","pipe","pipe"],shell:a.shell,windowsHide:!0}),c="",l="",u=setTimeout(()=>{o.kill(),s(new Error("PAN_AI_HOST_TIMEOUT"))},3e4);o.stdout.on("data",d=>{c+=d.toString("utf8");for(let p of c.split(`
|
|
5310
|
+
`))if(p.trim().startsWith("{"))try{let m=JSON.parse(p);if(m.event==="listening"&&m.url&&m.token){clearTimeout(u),i({url:new URL(m.url),token:m.token,child:o});return}}catch{}}),o.stderr.on("data",d=>{l=(l+d.toString("utf8")).slice(-2e3)}),o.on("error",d=>{clearTimeout(u),cn.delete(e),s(d)}),o.on("exit",d=>{clearTimeout(u),cn.delete(e),s(new Error(`PAN_AI_HOST_EXIT ${d} ${l.slice(-400)}`))})});return cn.set(e,r),r.catch(()=>cn.delete(e)),r}function Ng(){for(let e of cn.values())e.then(t=>{try{t.child.stdin.end()}catch{}}).catch(()=>{});cn.clear()}function Ig(e,t){let n=e.config.language==="en",r=ft(e.root,e.config.ba),i=t?e.suites.find(c=>c.code===t||c.cases.some(l=>l.code===t)):void 0,s=t&&i?i.cases.find(c=>c.code===t):void 0,a=n?["You are an assistant working DIRECTLY in a test-case document repo (Pan Test, `.pantest.yaml`) in the current folder \u2014 the tester has the app open.","Rules:","- Change content ONLY through commands so codes stay unique and results are kept: `pan test module add`, `pan test new <MOD> --title \u2026 --covers CN-\u2026,SCR-\u2026`, `pan test case add <KB-\u2026> --case \u2026 --steps \u2026 --expected \u2026`, `pan test case edit <TC-\u2026> \u2026`, `pan test case rm <TC-\u2026> --reason \u2026`. Never hand-edit the ```yaml pt:cases``` blocks; never invent or renumber codes.","- Test cases: happy path first, then validation (each required field, formats, limits), permissions, edge cases from the business rules. Steps = user actions on the screen (\xABB1: \u2026\xBB, \xABB2: \u2026\xBB); expected = what the user sees (quote message text from the BA doc).","- Read the BA document (read-only) for the covered functions / screens. Do NOT invent behaviour it does not state \u2014 write \xAB[To confirm]\xBB.","- Do NOT set results (`pan test result`) unless the user says the test was run.","- When done run `pan test check`; fix errors. No commit, no push. Keys and enum values stay English.","- If the user must choose: end the answer with a ```pan-choices block (\xAB? question\xBB, then \xAB- option\xBB lines, max 5).","- Answer SHORT in English: what you added / changed (by code), what still needs a decision."]:["B\u1EA1n l\xE0 tr\u1EE3 l\xFD l\xE0m vi\u1EC7c TR\u1EF0C TI\u1EBEP trong repo t\xE0i li\u1EC7u k\u1ECBch b\u1EA3n ki\u1EC3m th\u1EED (Pan Test, `.pantest.yaml`) \u1EDF th\u01B0 m\u1EE5c hi\u1EC7n t\u1EA1i \u2014 tester \u0111ang m\u1EDF app.","Lu\u1EADt:","- S\u1EEDa n\u1ED9i dung CH\u1EC8 b\u1EB1ng l\u1EC7nh \u0111\u1EC3 m\xE3 kh\xF4ng tr\xF9ng v\xE0 k\u1EBFt qu\u1EA3 kh\xF4ng m\u1EA5t: `pan test module add`, `pan test new <PH> --title \u2026 --covers CN-\u2026,SCR-\u2026`, `pan test case add <KB-\u2026> --case \u2026 --steps \u2026 --expected \u2026`, `pan test case edit <TC-\u2026> \u2026`, `pan test case rm <TC-\u2026> --reason \u2026`. Kh\xF4ng s\u1EEDa tay kh\u1ED1i ```yaml pt:cases```; kh\xF4ng b\u1ECBa / \u0111\xE1nh l\u1EA1i m\xE3.","- T\xECnh hu\u1ED1ng: lu\u1ED3ng \u0111\xFAng tr\u01B0\u1EDBc, r\u1ED3i ki\u1EC3m tra d\u1EEF li\u1EC7u (t\u1EEBng tr\u01B0\u1EDDng b\u1EAFt bu\u1ED9c, \u0111\u1ECBnh d\u1EA1ng, gi\u1EDBi h\u1EA1n), ph\xE2n quy\u1EC1n, tr\u01B0\u1EDDng h\u1EE3p bi\xEAn theo quy t\u1EAFc nghi\u1EC7p v\u1EE5. C\xE1c b\u01B0\u1EDBc = thao t\xE1c ng\u01B0\u1EDDi d\xF9ng tr\xEAn m\xE0n (\xABB1: \u2026\xBB, \xABB2: \u2026\xBB); k\u1EBFt qu\u1EA3 mong \u0111\u1EE3i = \u0111i\u1EC1u ng\u01B0\u1EDDi d\xF9ng th\u1EA5y (th\xF4ng b\xE1o tr\xEDch nguy\xEAn v\u0103n t\xE0i li\u1EC7u BA trong \xAB\u2026\xBB).","- \u0110\u1ECDc t\xE0i li\u1EC7u BA (ch\u1EC9 \u0111\u1ECDc) cho ch\u1EE9c n\u0103ng / m\xE0n \u0111\u01B0\u1EE3c ph\u1EE7. KH\xD4NG b\u1ECBa nghi\u1EC7p v\u1EE5 t\xE0i li\u1EC7u BA kh\xF4ng n\xF3i \u2014 ghi \xAB[C\u1EA7n x\xE1c nh\u1EADn]\xBB.","- KH\xD4NG ghi k\u1EBFt qu\u1EA3 (`pan test result`) tr\u1EEB khi ng\u01B0\u1EDDi d\xF9ng n\xF3i \u0111\xE3 ch\u1EA1y test.","- Xong ch\u1EA1y `pan test check`; c\xF2n l\u1ED7i th\xEC s\u1EEDa. Kh\xF4ng commit, kh\xF4ng push. Kho\xE1 v\xE0 gi\xE1 tr\u1ECB enum gi\u1EEF ti\u1EBFng Anh.","- C\u1EA7n ng\u01B0\u1EDDi d\xF9ng ch\u1ECDn: k\u1EBFt th\xFAc c\xE2u tr\u1EA3 l\u1EDDi b\u1EB1ng kh\u1ED1i ```pan-choices (d\xF2ng \u0111\u1EA7u \xAB? c\xE2u h\u1ECFi\xBB, m\u1ED7i l\u1EF1a ch\u1ECDn m\u1ED9t d\xF2ng \xAB- \u2026\xBB, t\u1ED1i \u0111a 5).","- Tr\u1EA3 l\u1EDDi NG\u1EAEN b\u1EB1ng ti\u1EBFng Vi\u1EC7t: \u0111\xE3 th\xEAm / s\u1EEDa g\xEC (theo m\xE3), c\xF2n g\xEC c\u1EA7n quy\u1EBFt."],o=[`${n?"Document":"T\xE0i li\u1EC7u"}: \xAB${e.config.title}\xBB (${e.suites.length} ${n?"suites":"k\u1ECBch b\u1EA3n"}, ${e.suites.reduce((c,l)=>c+l.cases.length,0)} ${n?"cases":"t\xECnh hu\u1ED1ng"})`,r?`${n?"BA document repo (read-only)":"Repo t\xE0i li\u1EC7u BA (ch\u1EC9 \u0111\u1ECDc)"}: ${r}`:"",i?`${n?"Selected suite":"K\u1ECBch b\u1EA3n \u0111ang ch\u1ECDn"}: ${i.code} \xAB${i.title}\xBB${i.covers.length?` (covers ${i.covers.join(", ")})`:""} \u2014 ${i.file}`:"",s?`${n?"Selected case":"T\xECnh hu\u1ED1ng \u0111ang ch\u1ECDn"}: ${s.code} \xAB${s.case}\xBB`:""].filter(Boolean).join(`
|
|
5311
|
+
`);return{system:[...a,"",(n?`Context:
|
|
5312
|
+
`:`Ng\u1EEF c\u1EA3nh:
|
|
5313
|
+
`)+o].join(`
|
|
5314
|
+
`),addDirs:r?[fA.resolve(r)]:[]}}async function Lc(e,t,n,r,i,s){let a=await bA(e,t),o=s===void 0?void 0:Buffer.from(JSON.stringify(s));await new Promise((c,l)=>{let u=mA.request({host:a.url.hostname,port:a.url.port,path:i,method:s===void 0?"GET":"POST",headers:{"x-pan-ai-token":a.token,...o?{"content-type":"application/json","content-length":String(o.length)}:{}}},d=>{r.writeHead(d.statusCode??502,{"Content-Type":String(d.headers["content-type"]||"application/json; charset=utf-8"),"Cache-Control":"no-store","X-Content-Type-Options":"nosniff"}),d.pipe(r),d.on("end",c)});u.on("error",l),n.on("close",()=>u.destroy()),u.end(o)})}var cn,Pg=Ae(()=>{"use strict";S();hr();cn=new Map});var $g={};oa($g,{CSP:()=>Bc,VIEW_CSP:()=>Dc,createDocServer:()=>TA,embedSources:()=>Dg});import{randomBytes as vA,timingSafeEqual as wA}from"node:crypto";import Mc from"node:fs";import yA from"node:http";import ct from"node:path";import{fileURLToPath as xA}from"node:url";function Rg(e){if(typeof R<"u"&&R[e]!==void 0)return R[e];for(let t of[ct.join(Og,"ui"),ct.join(Og,"..","..","src","doc","ui")]){let n=ct.join(t,ia[e].file);if(Mc.existsSync(n))return Mc.readFileSync(n,"utf8")}throw new Error(`Thi\u1EBFu t\u1EC7p giao di\u1EC7n ${e}`)}function Bg(e){let t=ft(e.root,e.config.ba);return t?Qt(t):null}function kA(e){let t=Bg(e);return{root:e.root,me:gt(e.root),config:e.config,modules:e.modules,suites:e.suites,readErrors:e.readErrors,ba:t?{linked:!0,items:[...t.values()].filter(n=>!n.deleted&&(n.type==="function"||n.type==="screen")).map(n=>({code:n.code,title:n.title,type:n.type}))}:{linked:!1,path:e.config.ba??null,items:[]},summary:fs(e,t)}}function Mg(e){let t={};for(let n of["case","steps","expected","requirement","tag"])ee(e[n])!==void 0&&(t[n]=ee(e[n]));return ee(e.priority)!==void 0&&(t.priority=ee(e.priority)),t}function TA(e){let t=ts(e.start);if(!t)throw new K(j(`Kh\xF4ng th\u1EA5y repo t\xE0i li\u1EC7u ki\u1EC3m th\u1EED (.pantest.yaml) t\u1EEB ${ct.resolve(e.start)}. T\u1EA1o b\u1EB1ng: pan-test doc init`,`No test document repo (.pantest.yaml) found from ${ct.resolve(e.start)}. Create one with: pan-test doc init`));let n=e.token??vA(24).toString("hex"),r=Dg(e.embed),i=r.length?Bc.replace("frame-ancestors 'none'",`frame-ancestors ${r.join(" ")}`):Bc,s=d=>({status:200,body:d}),a=r.length?Dc.replace("frame-ancestors 'self'",`frame-ancestors 'self' ${r.join(" ")}`):Dc,o={"/api/export":async(d,p)=>{let m=(Array.isArray(d.formats)?d.formats:["docx"]).map(String).filter(h=>Ec.includes(h)),f=await Ac(p,{formats:m.length?m:["docx"],results:d.results===!0,codes:d.codes===!0});return s({ok:!0,dir:ct.join(p.root,zr),files:f.map(h=>ct.relative(p.root,h).split(ct.sep).join("/"))})},"/api/open":async(d,p)=>{let m=ct.join(p.root,zr);Mc.mkdirSync(m,{recursive:!0});let{spawn:f}=await import("node:child_process"),h=process.platform==="darwin"?"open":process.platform==="win32"?"explorer":"xdg-open";try{f(h,[m],{stdio:"ignore",detached:!0,windowsHide:!0}).unref()}catch{}return s({ok:!0,dir:m})}},c={"/api/module/new":(d,p)=>s(as(p,String(d.code??"").trim().toUpperCase(),String(d.title??"").trim())),"/api/module":(d,p)=>s(fr(p,String(d.code),{...ee(d.title)!==void 0?{title:ee(d.title)}:{},...ee(d.commonSteps)!==void 0?{commonSteps:ee(d.commonSteps)}:{}})),"/api/suite/new":(d,p)=>s(ls(p,{module:String(d.module),title:String(d.title??""),...d.kind==="non-functional"?{kind:"non-functional"}:{},...Mn(d.covers)?{covers:Mn(d.covers)}:{},...ee(d.after)?{after:ee(d.after)}:{},avoid:Bt(p.root)})),"/api/suite":(d,p)=>{let m={};for(let f of["title","preconditions","description","owner"])ee(d[f])!==void 0&&(m[f]=ee(d[f]));return(d.kind==="functional"||d.kind==="non-functional")&&(m.kind=d.kind),(d.status==="drafting"||d.status==="done"||d.status==="deleted")&&(m.status=d.status),ee(d.priority)!==void 0&&(m.priority=ee(d.priority)),Mn(d.covers)&&(m.covers=Mn(d.covers)),Mn(d.useCases)&&(m.useCases=Mn(d.useCases)),s(Wu(p,String(d.code),m))},"/api/case/new":(d,p)=>s(cs(p,String(d.suite),{case:"",...Mg(d)},{...ee(d.after)?{after:ee(d.after)}:{},avoid:Bt(p.root)})),"/api/case":(d,p)=>s(ps(p,String(d.code),Mg(d))),"/api/import/feature":(d,p)=>{let m=Array.isArray(d.files)?d.files:[];if(!m.length)throw new K(j("Ch\u01B0a ch\u1ECDn t\u1EC7p .feature n\xE0o.","No .feature file selected."));let f=Bt(p.root);return s({ok:!0,reports:m.map(h=>({name:String(h.name??""),...Pc(p,String(h.content??""),{file:String(h.name??"feature.feature"),module:String(d.module),avoid:f})}))})},"/api/results":(d,p)=>s({ok:!0,...Oc(p,ra(String(d.content??"")),{...ee(d.env)?{env:ee(d.env)}:{}})}),"/api/case/move":(d,p)=>s(Ku(p,String(d.code),d.dir===-1?-1:1)),"/api/case/delete":(d,p)=>s(us(p,String(d.code),ee(d.reason)??"")),"/api/result":(d,p)=>s(hs(p,String(d.code),{status:String(d.status),...ee(d.actual)!==void 0?{actual:ee(d.actual)}:{},...ee(d.env)!==void 0?{env:ee(d.env)}:{},...ee(d.bug)!==void 0?{bug:ee(d.bug)}:{}}))},l=()=>({status:404,body:{}}),u=yA.createServer((d,p)=>{let m=(x,b,E)=>{p.writeHead(x,{"Content-Type":E,"X-Content-Type-Options":"nosniff","Referrer-Policy":"no-referrer","Cache-Control":"no-store","Content-Security-Policy":i}),p.end(d.method==="HEAD"?void 0:b)},f=(x,b)=>m(x,JSON.stringify(b),"application/json; charset=utf-8"),h=x=>f(x instanceof K?400:500,{ok:!1,error:x.message}),g=x=>{if(p.headersSent){p.end();return}let b=j("C\u1EA7n Pan CLI (@pan-stack/cli \u2265 0.3.90) \u0111\u1EC3 d\xF9ng Tr\u1EE3 l\xFD AI: ","Pan CLI (@pan-stack/cli \u2265 0.3.90) is needed for the AI assistant: ")+x.message;y==="/api/ai"?f(200,{engines:[],max:0,runs:[],error:b}):f(503,{ok:!1,error:b})},y=(()=>{try{return new URL(d.url||"/","http://x").pathname}catch{return""}})();try{let x=u.address()?.port,b=String(d.headers.host||""),E=[`127.0.0.1:${x}`,`localhost:${x}`];if(!E.includes(b))return f(403,{error:"Host kh\xF4ng h\u1EE3p l\u1EC7"});let _=new URL(d.url||"/",`http://${b}`),v=_.pathname,T=v==="/api/ai"||v.startsWith("/api/ai/");if(d.method==="POST"){let A=c[v]??o[v]??(T?l:void 0);if(!A)return f(404,{error:"Kh\xF4ng c\xF3"});let N=String(d.headers.origin||"");if(N&&!E.some(z=>N===`http://${z}`))return f(403,{error:"Origin kh\xF4ng h\u1EE3p l\u1EC7"});let M=Buffer.from(String(d.headers["x-pan-test-token"]||"")),L=Buffer.from(n);if(M.length!==L.length||!wA(M,L))return f(403,{error:"Thi\u1EBFu token phi\xEAn"});if(!String(d.headers["content-type"]||"").startsWith("application/json"))return f(415,{error:"C\u1EA7n application/json"});let F=[],J=0;d.on("data",z=>{J+=z.length,J>Lg?(f(413,{error:"Qu\xE1 l\u1EDBn"}),d.destroy()):F.push(z)}),d.on("end",()=>{if(J>Lg)return;let z;try{z=JSON.parse(Buffer.concat(F).toString("utf8")||"{}")}catch{return f(400,{error:"JSON sai"})}if(A===l){let X=Ke(t),Z=v==="/api/ai/run"?{...z,...Ig(X,ee(z.item))}:z;Lc(t,X.config.language,d,p,v,Z).catch(g);return}Promise.resolve().then(()=>{let X=Ke(t);return dn(X.config.language),A(z,X)}).then(X=>f(X.status,X.body)).catch(h)});return}if(d.method!=="GET"&&d.method!=="HEAD")return f(405,{error:"Ch\u1EC9 cho GET/POST"});if(T){let A=Ke(t);Lc(t,A.config.language,d,p,v+_.search).catch(g);return}if(v==="/"||v==="/index.html"){let A=_.searchParams.get("lang")||e.lang||Ke(t).config.language,N=Rg("index.html").replace(/<head[^>]*>/,M=>`${M}<meta name="pantest-token" content="${n}"><meta name="panba-lang" content="${A==="en"?"en":"vi"}">`);return m(200,N,ia["index.html"].type)}let w=/^\/ui\/([a-z0-9.]+)$/.exec(v);if(w&&ia[w[1]])return m(200,Rg(w[1]),ia[w[1]].type);if(v==="/favicon.ico")return m(204,"","image/x-icon");if(v==="/api/index")return f(200,kA(Ke(t)));if(v==="/view/doc"){let A=ta(ea(Ke(t),{results:_.searchParams.get("results")==="1",codes:_.searchParams.get("codes")==="1"}));return p.writeHead(200,{"Content-Type":"text/html; charset=utf-8","X-Content-Type-Options":"nosniff","Referrer-Policy":"no-referrer","Cache-Control":"no-store","Content-Security-Policy":a}),p.end(d.method==="HEAD"?void 0:A)}if(v==="/api/check"){let A=Ke(t);return f(200,{findings:ms(A,Bg(A))})}return f(404,{error:"Kh\xF4ng c\xF3"})}catch(x){return h(x)}});return u.on("close",()=>Ng()),Object.assign(u,{token:n,root:t})}var Og,ia,Dc,Bc,Lg,Dg,ee,Mn,Fg=Ae(()=>{"use strict";S();Dn();hr();gs();gr();Xr();na();En();Pg();Og=ct.dirname(xA(import.meta.url)),ia={"index.html":{file:"index.html",type:"text/html; charset=utf-8"},"tokens.css":{file:"tokens.css",type:"text/css; charset=utf-8"},"shell.js":{file:"shell.browser.js",type:"text/javascript; charset=utf-8"},"i18n.js":{file:"i18n.browser.js",type:"text/javascript; charset=utf-8"},"app.js":{file:"app.browser.js",type:"text/javascript; charset=utf-8"},"assist.js":{file:"assist.browser.js",type:"text/javascript; charset=utf-8"},"edit.js":{file:"edit.browser.js",type:"text/javascript; charset=utf-8"}};Dc="default-src 'none'; style-src 'unsafe-inline'; img-src 'self' data:; base-uri 'none'; form-action 'none'; frame-ancestors 'self'",Bc="default-src 'none'; script-src 'self'; style-src 'self' 'unsafe-inline'; img-src 'self' data: blob:; connect-src 'self'; font-src 'self'; frame-src 'self'; base-uri 'none'; form-action 'none'; frame-ancestors 'none'",Lg=24*1024*1024,Dg=e=>(e??[]).filter(t=>/^[a-z][a-z0-9+.-]*:$/.test(t)||/^https?:\/\/[A-Za-z0-9.-]+(:\d+)?$/.test(t)),ee=e=>typeof e=="string"?e:void 0,Mn=e=>Array.isArray(e)?e.map(String).map(t=>t.trim()).filter(Boolean):void 0});S();S();Dn();import sa from"node:fs";import Ct from"node:path";S();Qr();hn();En();hr();gr();gs();na();Xr();var SA=`pan-test doc \u2014 t\xE0i li\u1EC7u k\u1ECBch b\u1EA3n ki\u1EC3m th\u1EED
|
|
4292
5315
|
|
|
4293
5316
|
doc init [th\u01B0 m\u1EE5c] --title <t\xEAn> [--ba <\u0111\u01B0\u1EDDng d\u1EABn repo BA>] [--lang vi|en]
|
|
4294
5317
|
doc module add <PH> --title <t\xEAn>
|
|
@@ -4298,25 +5321,48 @@ th,td{border:1px solid #555;padding:4px 6px;vertical-align:top;text-align:left;o
|
|
|
4298
5321
|
[--requirement <y\xEAu c\u1EA7u>] [--priority \u2026] [--tag <@tag>] [--after <TC-\u2026>]
|
|
4299
5322
|
doc case edit <TC-\u2026> [--case \u2026] [--steps \u2026] [--expected \u2026] [--requirement \u2026] [--priority \u2026] [--tag \u2026]
|
|
4300
5323
|
doc case rm <TC-\u2026> [--reason <l\xFD do>]
|
|
4301
|
-
doc result <TC-\u2026> <${
|
|
5324
|
+
doc result <TC-\u2026> <${Je.join("|")}> [--actual <k\u1EBFt qu\u1EA3 th\u1EF1c t\u1EBF>] [--env <m\xF4i tr\u01B0\u1EDDng>] [--bug <link>]
|
|
4302
5325
|
doc list [--json] m\u1EE5c l\u1EE5c: ph\xE2n h\u1EC7 \u2192 k\u1ECBch b\u1EA3n \u2192 s\u1ED1 t\xECnh hu\u1ED1ng / k\u1EBFt qu\u1EA3
|
|
4303
5326
|
doc check [--json] ki\u1EC3m l\u1ED7i (E01\u2013E04) v\xE0 c\u1EA3nh b\xE1o (T01\u2013T06)
|
|
4304
5327
|
doc summary [--json] t\u1ED5ng h\u1EE3p k\u1EBFt qu\u1EA3 theo ph\xE2n h\u1EC7 + \u0111\u1ED9 ph\u1EE7 ch\u1EE9c n\u0103ng BA
|
|
5328
|
+
doc import <t\u1EC7p.feature | th\u01B0 m\u1EE5c> --module <PH> nh\u1EADp k\u1ECBch b\u1EA3n Gherkin (pan-test); nh\u1EADp l\u1EA1i th\xEC c\u1EADp nh\u1EADt theo tag
|
|
5329
|
+
doc results <results.json | th\u01B0 m\u1EE5c b\xE1o c\xE1o> [--env <m\xF4i tr\u01B0\u1EDDng>] ghi k\u1EBFt qu\u1EA3 l\u1EA7n ch\u1EA1y t\u1EF1 \u0111\u1ED9ng theo tag
|
|
4305
5330
|
doc export [--format docx,html] [--results] [--codes] [--out <th\u01B0 m\u1EE5c>]
|
|
4306
5331
|
xu\u1EA5t t\xE0i li\u1EC7u (m\u1EB7c \u0111\u1ECBnh: b\u1EA3n b\xE0n giao DOCX v\xE0o exports/); --results k\xE8m k\u1EBFt qu\u1EA3 test
|
|
4307
5332
|
doc ui [--port <n>] [--no-open] [--json] [--lang vi|en] m\u1EDF app so\u1EA1n t\xE0i li\u1EC7u ki\u1EC3m th\u1EED tr\xEAn tr\xECnh duy\u1EC7t
|
|
4308
5333
|
|
|
4309
|
-
Chung: --dir <repo> (m\u1EB7c \u0111\u1ECBnh: th\u01B0 m\u1EE5c hi\u1EC7n t\u1EA1i, d\xF2 ng\u01B0\u1EE3c l\xEAn t\u1EDBi .pantest.yaml)
|
|
4310
|
-
|
|
4311
|
-
repo
|
|
4312
|
-
|
|
4313
|
-
|
|
4314
|
-
|
|
4315
|
-
|
|
5334
|
+
Chung: --dir <repo> (m\u1EB7c \u0111\u1ECBnh: th\u01B0 m\u1EE5c hi\u1EC7n t\u1EA1i, d\xF2 ng\u01B0\u1EE3c l\xEAn t\u1EDBi .pantest.yaml)`,CA=`pan-test doc \u2014 test case documents
|
|
5335
|
+
|
|
5336
|
+
doc init [dir] --title <name> [--ba <BA repo path>] [--lang vi|en]
|
|
5337
|
+
doc module add <MOD> --title <name>
|
|
5338
|
+
doc new <MOD> --title <name> [--covers CN-\u2026,SCR-\u2026] [--uc UC1,UC2] [--kind functional|non-functional]
|
|
5339
|
+
[--priority high|medium|low] [--preconditions <text>] [--after <KB-\u2026>]
|
|
5340
|
+
doc case add <KB-\u2026> --case <test case> [--steps <steps>] [--expected <expected result>]
|
|
5341
|
+
[--requirement <requirement>] [--priority \u2026] [--tag <@tag>] [--after <TC-\u2026>]
|
|
5342
|
+
doc case edit <TC-\u2026> [--case \u2026] [--steps \u2026] [--expected \u2026] [--requirement \u2026] [--priority \u2026] [--tag \u2026]
|
|
5343
|
+
doc case rm <TC-\u2026> [--reason <reason>]
|
|
5344
|
+
doc result <TC-\u2026> <${Je.join("|")}> [--actual <actual result>] [--env <environment>] [--bug <link>]
|
|
5345
|
+
doc import <file.feature | dir> --module <MOD> import Gherkin scenarios (pan-test); re-import updates by tag
|
|
5346
|
+
doc results <results.json | report dir> [--env <environment>] record an automated run by tag
|
|
5347
|
+
doc export [--format docx,html] [--results] [--codes] [--out <dir>]
|
|
5348
|
+
doc list [--json] \xB7 doc check [--json] \xB7 doc summary [--json]
|
|
5349
|
+
doc ui [--port <n>] [--no-open] [--json] [--lang vi|en] open the test document app
|
|
5350
|
+
|
|
5351
|
+
Common: --dir <repo> (default: current folder, searching up to .pantest.yaml)`,qg=()=>j(SA,CA);function EA(e){let t=[],n={};for(let r=0;r<e.length;r++){let i=e[r];if(i.startsWith("--")){let s=i.indexOf("=");if(s>0)n[i.slice(2,s)]=i.slice(s+1);else{let a=e[r+1];a!==void 0&&!a.startsWith("--")?(n[i.slice(2)]=a,r++):n[i.slice(2)]=!0}}else t.push(i)}return{pos:t,opt:n}}var W=e=>typeof e=="string"?e:void 0,Yr=e=>W(e)?.split(",").map(t=>t.trim()).filter(Boolean),me=e=>W(e)?.replace(/\\n/g,`
|
|
5352
|
+
`);function $c(e){let t=W(e);if(t!==void 0){if(!pn.includes(t))throw new K(`--priority ph\u1EA3i l\xE0 ${pn.join(" | ")}.`);return t}}function dt(e){let t=W(e.dir)??process.cwd(),n=ts(t);if(!n)throw new K(j(`Kh\xF4ng th\u1EA5y repo t\xE0i li\u1EC7u ki\u1EC3m th\u1EED (.pantest.yaml) t\u1EEB ${Ct.resolve(t)}. T\u1EA1o b\u1EB1ng: pan-test doc init`,`No test document repo (.pantest.yaml) found from ${Ct.resolve(t)}. Create one with: pan-test doc init`));let r=Ke(n);return dn(r.config.language),r}var AA={"not-run":"Ch\u01B0a test",passed:"\u0110\u1EA1t",failed:"Kh\xF4ng \u0111\u1EA1t",blocked:"B\u1ECB ch\u1EB7n",skipped:"B\u1ECF qua"};function Hg(e){return j(`${e.total} t\xECnh hu\u1ED1ng \xB7 \u0111\u1EA1t ${e.passed} \xB7 kh\xF4ng \u0111\u1EA1t ${e.failed} \xB7 b\u1ECB ch\u1EB7n ${e.blocked} \xB7 b\u1ECF qua ${e.skipped} \xB7 ch\u01B0a test ${e["not-run"]}`,`${e.total} test case(s) \xB7 ${e.passed} passed \xB7 ${e.failed} failed \xB7 ${e.blocked} blocked \xB7 ${e.skipped} skipped \xB7 ${e["not-run"]} not run`)}async function Ug(e){let{pos:t,opt:n}=EA(e);typeof n.lang=="string"?dn(n.lang,{pin:!0}):process.env.PANAUTO_LANG&&dn(process.env.PANAUTO_LANG,{pin:!0});let[r,i,s]=t,a=n.json===!0,o=(c,l)=>console.log(a?JSON.stringify(c,null,2):l);try{switch(r){case void 0:case"help":return console.log(qg()),r?0:1;case"ui":{let{createDocServer:c}=await Promise.resolve().then(()=>(Fg(),$g)),l=W(n.embed)?.split(",").map(f=>f.trim()).filter(Boolean),u=c({start:W(n.dir)??process.cwd(),...W(n.lang)??process.env.PANAUTO_LANG?{lang:W(n.lang)??process.env.PANAUTO_LANG}:{},...l?{embed:l}:{}}),d=Number(W(n.port)??0)||0;await new Promise((f,h)=>{u.once("error",h),u.listen(d,"127.0.0.1",()=>f())});let m=`http://127.0.0.1:${u.address().port}/`;if(console.log(a?JSON.stringify({event:"listening",url:m,root:u.root}):`Pan Test \u2014 t\xE0i li\u1EC7u ki\u1EC3m th\u1EED: ${m}
|
|
5353
|
+
repo: ${u.root}
|
|
5354
|
+
Ctrl+C \u0111\u1EC3 d\u1EEBng.`),n["no-open"]!==!0&&!a){let{spawn:f}=await import("node:child_process"),h=process.platform==="darwin"?"open":process.platform==="win32"?"cmd":"xdg-open",g=process.platform==="win32"?["/c","start","",m]:[m];try{f(h,g,{stdio:"ignore",detached:!0}).unref()}catch{}}return n.lifeline===!0&&process.stdin.on("end",()=>process.exit(0)).resume(),await new Promise(()=>{}),0}case"init":{let c=Ct.resolve(i??W(n.dir)??"."),l=W(n.title)??Ct.basename(c),u=(W(n.lang)??process.env.PANAUTO_LANG)==="en"?"en":"vi",d=gt(sa.existsSync(c)?c:process.cwd()),p=Uu(c,{title:l,language:u,...W(n.ba)?{ba:W(n.ba)}:{},me:{id:d,name:d}});return o(p,j(`\u2713 \u0110\xE3 t\u1EA1o repo t\xE0i li\u1EC7u ki\u1EC3m th\u1EED \xAB${p.title}\xBB \u1EDF ${c}${p.ba?` (repo BA: ${p.ba})`:""}.
|
|
5355
|
+
Ti\u1EBFp: pan-test doc module add <PH> --title <t\xEAn ph\xE2n h\u1EC7>`,`\u2713 Created test document repo \xAB${p.title}\xBB in ${c}${p.ba?` (BA repo: ${p.ba})`:""}.
|
|
5356
|
+
Next: pan-test doc module add <MOD> --title <module name>`)),0}case"module":{if(i!=="add"||!s)throw new K("D\xF9ng: pan-test doc module add <PH> --title <t\xEAn>");let c=dt(n),l=as(c,s,W(n.title)??s);return o(l,j(`\u2713 \u0110\xE3 th\xEAm ph\xE2n h\u1EC7 ${l.code} \xB7 ${l.title}`,`\u2713 Added module ${l.code} \xB7 ${l.title}`)),0}case"new":{if(!i)throw new K("D\xF9ng: pan-test doc new <PH> --title <t\xEAn k\u1ECBch b\u1EA3n>");let c=dt(n),l=W(n.kind);if(l&&l!=="functional"&&l!=="non-functional")throw new K("--kind ph\u1EA3i l\xE0 functional | non-functional.");let u=$c(n.priority),d=ls(c,{module:i,title:W(n.title)??"",...l?{kind:l}:{},...Yr(n.covers)?{covers:Yr(n.covers)}:{},...Yr(n.uc)?{useCases:Yr(n.uc)}:{},...u?{priority:u}:{},...me(n.preconditions)?{preconditions:me(n.preconditions)}:{},...W(n.after)?{after:W(n.after)}:{},avoid:Bt(c.root)});return o(d,j(`\u2713 \u0110\xE3 t\u1EA1o k\u1ECBch b\u1EA3n ${d.code} \xB7 ${d.title} (${d.file})`,`\u2713 Created test suite ${d.code} \xB7 ${d.title} (${d.file})`)),0}case"case":{let c=dt(n);if(i==="add"&&s){let l=$c(n.priority),u=cs(c,s,{case:me(n.case)??"",...me(n.steps)?{steps:me(n.steps)}:{},...me(n.expected)?{expected:me(n.expected)}:{},...me(n.requirement)?{requirement:me(n.requirement)}:{},...l?{priority:l}:{},...W(n.tag)?{tag:W(n.tag)}:{}},{...W(n.after)?{after:W(n.after)}:{},avoid:Bt(c.root)});return o(u,j(`\u2713 \u0110\xE3 th\xEAm t\xECnh hu\u1ED1ng ${u.code} v\xE0o ${s}`,`\u2713 Added test case ${u.code} to ${s}`)),0}if(i==="edit"&&s){let l=$c(n.priority),u=ps(c,s,{...me(n.case)!==void 0?{case:me(n.case)}:{},...me(n.steps)!==void 0?{steps:me(n.steps)}:{},...me(n.expected)!==void 0?{expected:me(n.expected)}:{},...me(n.requirement)!==void 0?{requirement:me(n.requirement)}:{},...l?{priority:l}:{},...W(n.tag)!==void 0?{tag:W(n.tag)}:{}});return o(u,j(`\u2713 \u0110\xE3 s\u1EEDa t\xECnh hu\u1ED1ng ${u.code}`,`\u2713 Updated test case ${u.code}`)),0}if(i==="rm"&&s){let l=us(c,s,W(n.reason)??"");return o(l,j(`\u2713 \u0110\xE3 xo\xE1 (m\u1EC1m) t\xECnh hu\u1ED1ng ${l.code} \u2014 m\xE3 gi\u1EEF l\u1EA1i, kh\xF4ng d\xF9ng l\u1EA1i.`,`\u2713 Soft-deleted test case ${l.code} \u2014 the code is kept and never reused.`)),0}throw new K("D\xF9ng: pan-test doc case add <KB-\u2026> | edit <TC-\u2026> | rm <TC-\u2026>")}case"result":{if(!i||!s)throw new K(`D\xF9ng: pan-test doc result <TC-\u2026> <${Je.join("|")}>`);let c=dt(n),l=hs(c,i,{status:s,...me(n.actual)?{actual:me(n.actual)}:{},...W(n.env)?{env:W(n.env)}:{},...W(n.bug)?{bug:W(n.bug)}:{},...W(n.by)?{by:W(n.by)}:{}});return o(l,`\u2713 ${l.code}: ${j(AA[l.result?.status??"not-run"],l.result?.status??"not-run")}`),0}case"export":{let{exportDoc:c,FORMATS:l}=await Promise.resolve().then(()=>(na(),gg)),u=dt(n),d=Yr(n.format)??["docx"];if(d.filter(f=>!l.includes(f)).length)throw new K(`--format ch\u1EC9 nh\u1EADn ${l.join(", ")}.`);let m=await c(u,{formats:d,results:n.results===!0,codes:n.codes===!0,...W(n.out)?{out:W(n.out)}:{}});return o({files:m},m.map(f=>`\u2713 ${f}`).join(`
|
|
5357
|
+
`)),0}case"import":{if(!i||!W(n.module))throw new K("D\xF9ng: pan-test doc import <t\u1EC7p.feature | th\u01B0 m\u1EE5c> --module <PH> [--json]");let{featureFiles:c,importFeature:l}=await Promise.resolve().then(()=>(Xr(),Rc)),u=dt(n),d=Ct.resolve(i);if(!sa.existsSync(d))throw new K(`Kh\xF4ng th\u1EA5y ${d}.`);let p=sa.statSync(d).isDirectory()?c(d):[d];if(!p.length)throw new K(`Kh\xF4ng c\xF3 t\u1EC7p .feature n\xE0o trong ${d}.`);let m=Bt(u.root),f=p.map(h=>({file:h,...l(u,sa.readFileSync(h,"utf8"),{file:Ct.relative(u.root,h).split(Ct.sep).join("/"),module:W(n.module),avoid:m})}));return o(f,f.map(h=>`\u2713 ${Ct.relative(process.cwd(),h.file)} \u2192 ${h.suite}${h.created?" (m\u1EDBi)":""}: th\xEAm ${h.added.length}, c\u1EADp nh\u1EADt ${h.updated.length}${h.missing.length?`, ${h.missing.length} t\xECnh hu\u1ED1ng kh\xF4ng c\xF2n trong t\u1EC7p (gi\u1EEF nguy\xEAn, xem l\u1EA1i)`:""}${h.untagged?`, ${h.untagged} k\u1ECBch b\u1EA3n kh\xF4ng c\xF3 tag \u0111\u1ECBnh danh (kh\u1EDBp theo t\xEAn)`:""}`).join(`
|
|
5358
|
+
`)),0}case"results":{if(!i)throw new K("D\xF9ng: pan-test doc results <results.json | th\u01B0 m\u1EE5c b\xE1o c\xE1o> [--env UAT] [--json]");let{applyRunResults:c,readRunResults:l}=await Promise.resolve().then(()=>(Xr(),Rc)),u=dt(n),d=c(u,l(Ct.resolve(i)),{...W(n.env)?{env:W(n.env)}:{}}),p=m=>d.applied.filter(f=>f.status===m).length;return o(d,j(`\u2713 Ghi k\u1EBFt qu\u1EA3 ${d.applied.length} t\xECnh hu\u1ED1ng: \u0111\u1EA1t ${p("passed")}, kh\xF4ng \u0111\u1EA1t ${p("failed")}, b\u1ECF qua ${p("skipped")}.`,`\u2713 Recorded ${d.applied.length} result(s): ${p("passed")} passed, ${p("failed")} failed, ${p("skipped")} skipped.`)+(d.notRun.length?`
|
|
5359
|
+
${d.notRun.length} t\xECnh hu\u1ED1ng c\xF3 tag nh\u01B0ng l\u1EA7n ch\u1EA1y kh\xF4ng c\xF3: ${d.notRun.slice(0,10).join(", ")}${d.notRun.length>10?"\u2026":""}`:"")+(d.unknownTags.length?`
|
|
5360
|
+
Tag trong l\u1EA7n ch\u1EA1y ch\u01B0a c\xF3 trong t\xE0i li\u1EC7u: ${d.unknownTags.slice(0,10).join(", ")}${d.unknownTags.length>10?"\u2026":""}`:"")),0}case"list":{let c=dt(n),l=c.modules.map(d=>({code:d.code,title:d.title,suites:Zt(c,d.code).map(p=>({code:p.code,title:p.title,kind:p.kind,cases:p.cases.filter(m=>!m.deleted).map(m=>({code:m.code,case:m.case,status:m.result?.status??"not-run"}))}))})),u=[`${c.config.title}`];return l.forEach((d,p)=>{u.push(`${p+1}. ${d.code} \xB7 ${d.title}`),d.suites.forEach((m,f)=>{let h=m.cases.filter(g=>g.status==="passed").length;u.push(` ${p+1}.${f+1} ${m.code} \xB7 ${m.title} [${h}/${m.cases.length} ${j("\u0111\u1EA1t","passed")}]`)})}),o(l,u.join(`
|
|
5361
|
+
`)),0}case"check":{let c=dt(n),l=ft(c.root,c.config.ba),u=ms(c,l?Qt(l):null),d=u.filter(f=>f.severity==="error").length,p=u.filter(f=>f.severity==="warn").length,m=u.length?u.map(f=>`${f.severity==="error"?"\u2717":f.severity==="warn"?"!":"i"} ${f.rule} ${f.message}${f.file?` (${f.file})`:""}`).join(`
|
|
4316
5362
|
`)+`
|
|
4317
5363
|
|
|
4318
|
-
${
|
|
4319
|
-
`:"")+
|
|
4320
|
-
`)),0}default:throw new
|
|
5364
|
+
${j(`${d} l\u1ED7i \xB7 ${p} c\u1EA3nh b\xE1o`,`${d} error(s) \xB7 ${p} warning(s)`)}`:j("\u2713 Kh\xF4ng c\xF3 l\u1ED7i.","\u2713 No errors.");return o({errors:d,warnings:p,findings:u},(c.config.ba&&!l?`! Kh\xF4ng th\u1EA5y repo BA \xAB${c.config.ba}\xBB \u2014 b\u1ECF qua ki\u1EC3m tham chi\u1EBFu.
|
|
5365
|
+
`:"")+m),d?2:0}case"summary":{let c=dt(n),l=ft(c.root,c.config.ba),u=fs(c,l?Qt(l):null),d=[`${j("T\u1ED5ng","Total")}: ${Hg(u.all)}`,...u.modules.map(p=>` ${p.code} \xB7 ${p.title}: ${p.suites} ${j("k\u1ECBch b\u1EA3n","suite(s)")} \xB7 ${Hg(p.count)}`)];return u.coverage&&d.push(`${j("\u0110\u1ED9 ph\u1EE7 ch\u1EE9c n\u0103ng BA","BA function coverage")}: ${u.coverage.covered}/${u.coverage.functions}`),o(u,d.join(`
|
|
5366
|
+
`)),0}default:throw new K(`Kh\xF4ng c\xF3 l\u1EC7nh \xABdoc ${r}\xBB.
|
|
4321
5367
|
|
|
4322
|
-
${
|
|
5368
|
+
${qg()}`)}}catch(c){if(c instanceof K)return console.error(`\u2717 ${c.message}`),1;throw c}}Ug(process.argv.slice(2)).then(e=>process.exit(e)).catch(e=>{console.error(e),process.exit(1)});
|