sf-git-merge-driver 1.7.0 → 1.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/bin/merge-driver.cjs +28 -28
- package/lib/adapter/TxmlXmlParser.d.ts +13 -0
- package/lib/adapter/TxmlXmlParser.js +315 -0
- package/lib/adapter/TxmlXmlParser.js.map +1 -0
- package/lib/adapter/XmlParser.d.ts +4 -2
- package/lib/adapter/XmlSerializer.d.ts +2 -1
- package/lib/adapter/writer/XmlStreamWriter.d.ts +9 -0
- package/lib/adapter/writer/XmlStreamWriter.js +373 -0
- package/lib/adapter/writer/XmlStreamWriter.js.map +1 -0
- package/lib/bin/driver.js +3 -0
- package/lib/bin/driver.js.map +1 -1
- package/lib/constant/parserConstant.d.ts +0 -1
- package/lib/constant/parserConstant.js +0 -1
- package/lib/constant/parserConstant.js.map +1 -1
- package/lib/driver/MergeDriver.js +68 -23
- package/lib/driver/MergeDriver.js.map +1 -1
- package/lib/merger/XmlMerger.d.ts +4 -4
- package/lib/merger/XmlMerger.js +25 -17
- package/lib/merger/XmlMerger.js.map +1 -1
- package/lib/service/GitAttributesPlanner.d.ts +4 -3
- package/lib/utils/gitAttributesFile.d.ts +5 -4
- package/lib/utils/peekEol.d.ts +1 -0
- package/lib/utils/peekEol.js +32 -0
- package/lib/utils/peekEol.js.map +1 -0
- package/npm-shrinkwrap.json +838 -1361
- package/oclif.manifest.json +1 -1
- package/package.json +31 -15
- package/lib/adapter/FlxXmlParser.d.ts +0 -5
- package/lib/adapter/FlxXmlParser.js +0 -62
- package/lib/adapter/FlxXmlParser.js.map +0 -1
- package/lib/adapter/FxpXmlSerializer.d.ts +0 -10
- package/lib/adapter/FxpXmlSerializer.js +0 -140
- package/lib/adapter/FxpXmlSerializer.js.map +0 -1
- package/lib/merger/ConflictMarkerFormatter.d.ts +0 -14
- package/lib/merger/ConflictMarkerFormatter.js +0 -39
- package/lib/merger/ConflictMarkerFormatter.js.map +0 -1
package/README.md
CHANGED
|
@@ -452,7 +452,7 @@ EXAMPLES
|
|
|
452
452
|
$ sf git merge driver install --force
|
|
453
453
|
```
|
|
454
454
|
|
|
455
|
-
_See code: [src/commands/git/merge/driver/install.ts](https://github.com/scolladon/sf-git-merge-driver/blob/v1.
|
|
455
|
+
_See code: [src/commands/git/merge/driver/install.ts](https://github.com/scolladon/sf-git-merge-driver/blob/v1.8.0/src/commands/git/merge/driver/install.ts)_
|
|
456
456
|
|
|
457
457
|
## `sf git merge driver run`
|
|
458
458
|
|
|
@@ -499,7 +499,7 @@ EXAMPLES
|
|
|
499
499
|
- output-file is the path to the file where the merged content will be written
|
|
500
500
|
```
|
|
501
501
|
|
|
502
|
-
_See code: [src/commands/git/merge/driver/run.ts](https://github.com/scolladon/sf-git-merge-driver/blob/v1.
|
|
502
|
+
_See code: [src/commands/git/merge/driver/run.ts](https://github.com/scolladon/sf-git-merge-driver/blob/v1.8.0/src/commands/git/merge/driver/run.ts)_
|
|
503
503
|
|
|
504
504
|
## `sf git merge driver uninstall`
|
|
505
505
|
|
|
@@ -539,7 +539,7 @@ EXAMPLES
|
|
|
539
539
|
$ sf git merge driver uninstall --dry-run
|
|
540
540
|
```
|
|
541
541
|
|
|
542
|
-
_See code: [src/commands/git/merge/driver/uninstall.ts](https://github.com/scolladon/sf-git-merge-driver/blob/v1.
|
|
542
|
+
_See code: [src/commands/git/merge/driver/uninstall.ts](https://github.com/scolladon/sf-git-merge-driver/blob/v1.8.0/src/commands/git/merge/driver/uninstall.ts)_
|
|
543
543
|
<!-- commandsstop -->
|
|
544
544
|
|
|
545
545
|
## Changelog
|
package/bin/merge-driver.cjs
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
try { const v = process.versions.node.split(".").map(Number); if (v[0] > 22 || (v[0] === 22 && v[1] >= 8)) require("node:module").enableCompileCache(); } catch {}
|
|
3
|
-
"use strict";var We=Object.defineProperty;var Wr=Object.getOwnPropertyDescriptor;var Jr=Object.getOwnPropertyNames;var Zr=Object.prototype.hasOwnProperty;var Qr=(t,e)=>{for(var r in e)We(t,r,{get:e[r],enumerable:!0})},es=(t,e,r,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of Jr(e))!Zr.call(t,n)&&n!==r&&We(t,n,{get:()=>e[n],enumerable:!(s=Wr(e,n))||s.enumerable});return t};var ts=t=>es(We({},"__esModule",{value:!0}),t);var kn={};Qr(kn,{assertNodeVersion:()=>zr,main:()=>Hr,parseArgs:()=>qr});module.exports=ts(kn);var Je="base",Ze="ours",Qe="theirs";function Y(t,e,r,s){var n=arguments.length,i=n<3?e:s===null?s=Object.getOwnPropertyDescriptor(e,r):s,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,r,s);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(i=(n<3?o(i):n>3?o(e,r,i):o(e,r))||i);return n>3&&i&&Object.defineProperty(e,r,i),i}var Ne=require("node:fs/promises"),qe=require("node:path");var rs={nameFor:{text:"#text",comment:"",cdata:""},skip:{declaration:!1,pi:!1,attributes:!0,cdata:!1,comment:!1,nsPrefix:!1,tags:!1},tags:{valueParsers:[],stopNodes:[]},attributes:{prefix:"@_",suffix:"",groupBy:"",valueParsers:[]}},ss=["trim","number","boolean","entity"],ns=["trim","number","boolean","entity"];function zt(t){let e=et(rs);return(!t||t.tags?.valueParsers===void 0)&&(e.tags.valueParsers=[...ss]),(!t||t.attributes?.valueParsers===void 0)&&(e.attributes.valueParsers=[...ns]),t&&qt(e,t),e}function et(t){if(t===null||typeof t!="object")return t;if(Array.isArray(t))return t.map(et);let e={};for(let r of Object.keys(t))e[r]=et(t[r]);return e}function qt(t,e){for(let r of Object.keys(e))r==="__proto__"||r==="constructor"||r==="prototype"||(typeof e[r]=="function"||Array.isArray(e[r])?t[r]=e[r]:typeof e[r]=="object"&&e[r]!==null?((typeof t[r]!="object"||t[r]===null)&&(t[r]={}),qt(t[r],e[r])):t[r]=e[r])}var is=/^[-+]?0x[a-fA-F0-9]+$/,os=/^([\-\+])?(0*)([0-9]*(\.[0-9]*)?)$/,as={hex:!0,leadingZeros:!0,decimalPoint:".",eNotation:!0,infinity:"original"};function tt(t,e={}){if(e=Object.assign({},as,e),!t||typeof t!="string")return t;let r=t.trim();if(r.length===0)return t;if(e.skipLike!==void 0&&e.skipLike.test(r))return t;if(r==="0")return 0;if(e.hex&&is.test(r))return hs(r,16);if(isFinite(r)){if(r.includes("e")||r.includes("E"))return cs(t,r,e);{let s=os.exec(r);if(s){let n=s[1]||"",i=s[2],o=us(s[3]),a=n?t[i.length+1]===".":t[i.length]===".";if(!e.leadingZeros&&(i.length>1||i.length===1&&!a))return t;{let l=Number(r),c=String(l);if(l===0)return l;if(c.search(/[eE]/)!==-1)return e.eNotation?l:t;if(r.indexOf(".")!==-1)return c==="0"||c===o||c===`${n}${o}`?l:t;let u=i?o:r;return i?u===c||n+u===c?l:t:u===c||u===n+c?l:t}}else return t}}else return fs(t,Number(r),e)}var ls=/^([-+])?(0*)(\d*(\.\d*)?[eE][-\+]?\d+)$/;function cs(t,e,r){if(!r.eNotation)return t;let s=e.match(ls);if(s){let n=s[1]||"",i=s[3].indexOf("e")===-1?"E":"e",o=s[2],a=n?t[o.length+1]===i:t[o.length]===i;return o.length>1&&a?t:o.length===1&&(s[3].startsWith(`.${i}`)||s[3][0]===i)?Number(e):o.length>0?r.leadingZeros&&!a?(e=(s[1]||"")+s[3],Number(e)):t:Number(e)}else return t}function us(t){return t&&t.indexOf(".")!==-1&&(t=t.replace(/0+$/,""),t==="."?t="0":t[0]==="."?t="0"+t:t[t.length-1]==="."&&(t=t.substring(0,t.length-1))),t}function hs(t,e){if(parseInt)return parseInt(t,e);if(Number.parseInt)return Number.parseInt(t,e);if(window&&window.parseInt)return window.parseInt(t,e);throw new Error("parseInt, Number.parseInt, window.parseInt are not supported")}function fs(t,e,r){let s=e===1/0;switch(r.infinity.toLowerCase()){case"null":return null;case"infinity":return e;case"string":return s?"Infinity":"-Infinity";default:return t}}var ds={amp:"&",AMP:"&",lt:"<",LT:"<",gt:">",GT:">",quot:'"',QUOT:'"',apos:"'",lsquo:"\u2018",rsquo:"\u2019",ldquo:"\u201C",rdquo:"\u201D",lsquor:"\u201A",rsquor:"\u2019",ldquor:"\u201E",bdquo:"\u201E",comma:",",period:".",colon:":",semi:";",excl:"!",quest:"?",num:"#",dollar:"$",percent:"%",amp:"&",ast:"*",commat:"@",lowbar:"_",verbar:"|",vert:"|",sol:"/",bsol:"\\",lbrace:"{",rbrace:"}",lbrack:"[",rbrack:"]",lpar:"(",rpar:")",nbsp:"\xA0",iexcl:"\xA1",cent:"\xA2",pound:"\xA3",curren:"\xA4",yen:"\xA5",brvbar:"\xA6",sect:"\xA7",uml:"\xA8",copy:"\xA9",COPY:"\xA9",ordf:"\xAA",laquo:"\xAB",not:"\xAC",shy:"\xAD",reg:"\xAE",REG:"\xAE",macr:"\xAF",deg:"\xB0",plusmn:"\xB1",sup2:"\xB2",sup3:"\xB3",acute:"\xB4",micro:"\xB5",para:"\xB6",middot:"\xB7",cedil:"\xB8",sup1:"\xB9",ordm:"\xBA",raquo:"\xBB",frac14:"\xBC",frac12:"\xBD",half:"\xBD",frac34:"\xBE",iquest:"\xBF",times:"\xD7",div:"\xF7",divide:"\xF7"},ps={Agrave:"\xC0",agrave:"\xE0",Aacute:"\xC1",aacute:"\xE1",Acirc:"\xC2",acirc:"\xE2",Atilde:"\xC3",atilde:"\xE3",Auml:"\xC4",auml:"\xE4",Aring:"\xC5",aring:"\xE5",AElig:"\xC6",aelig:"\xE6",Ccedil:"\xC7",ccedil:"\xE7",Egrave:"\xC8",egrave:"\xE8",Eacute:"\xC9",eacute:"\xE9",Ecirc:"\xCA",ecirc:"\xEA",Euml:"\xCB",euml:"\xEB",Igrave:"\xCC",igrave:"\xEC",Iacute:"\xCD",iacute:"\xED",Icirc:"\xCE",icirc:"\xEE",Iuml:"\xCF",iuml:"\xEF",ETH:"\xD0",eth:"\xF0",Ntilde:"\xD1",ntilde:"\xF1",Ograve:"\xD2",ograve:"\xF2",Oacute:"\xD3",oacute:"\xF3",Ocirc:"\xD4",ocirc:"\xF4",Otilde:"\xD5",otilde:"\xF5",Ouml:"\xD6",ouml:"\xF6",Oslash:"\xD8",oslash:"\xF8",Ugrave:"\xD9",ugrave:"\xF9",Uacute:"\xDA",uacute:"\xFA",Ucirc:"\xDB",ucirc:"\xFB",Uuml:"\xDC",uuml:"\xFC",Yacute:"\xDD",yacute:"\xFD",THORN:"\xDE",thorn:"\xFE",szlig:"\xDF",yuml:"\xFF",Yuml:"\u0178"},ms={Amacr:"\u0100",amacr:"\u0101",Abreve:"\u0102",abreve:"\u0103",Aogon:"\u0104",aogon:"\u0105",Cacute:"\u0106",cacute:"\u0107",Ccirc:"\u0108",ccirc:"\u0109",Cdot:"\u010A",cdot:"\u010B",Ccaron:"\u010C",ccaron:"\u010D",Dcaron:"\u010E",dcaron:"\u010F",Dstrok:"\u0110",dstrok:"\u0111",Emacr:"\u0112",emacr:"\u0113",Ecaron:"\u011A",ecaron:"\u011B",Edot:"\u0116",edot:"\u0117",Eogon:"\u0118",eogon:"\u0119",Gcirc:"\u011C",gcirc:"\u011D",Gbreve:"\u011E",gbreve:"\u011F",Gdot:"\u0120",gdot:"\u0121",Gcedil:"\u0122",Hcirc:"\u0124",hcirc:"\u0125",Hstrok:"\u0126",hstrok:"\u0127",Itilde:"\u0128",itilde:"\u0129",Imacr:"\u012A",imacr:"\u012B",Iogon:"\u012E",iogon:"\u012F",Idot:"\u0130",IJlig:"\u0132",ijlig:"\u0133",Jcirc:"\u0134",jcirc:"\u0135",Kcedil:"\u0136",kcedil:"\u0137",kgreen:"\u0138",Lacute:"\u0139",lacute:"\u013A",Lcedil:"\u013B",lcedil:"\u013C",Lcaron:"\u013D",lcaron:"\u013E",Lmidot:"\u013F",lmidot:"\u0140",Lstrok:"\u0141",lstrok:"\u0142",Nacute:"\u0143",nacute:"\u0144",Ncaron:"\u0147",ncaron:"\u0148",Ncedil:"\u0145",ncedil:"\u0146",ENG:"\u014A",eng:"\u014B",Omacr:"\u014C",omacr:"\u014D",Odblac:"\u0150",odblac:"\u0151",OElig:"\u0152",oelig:"\u0153",Racute:"\u0154",racute:"\u0155",Rcaron:"\u0158",rcaron:"\u0159",Rcedil:"\u0156",rcedil:"\u0157",Sacute:"\u015A",sacute:"\u015B",Scirc:"\u015C",scirc:"\u015D",Scedil:"\u015E",scedil:"\u015F",Scaron:"\u0160",scaron:"\u0161",Tcedil:"\u0162",tcedil:"\u0163",Tcaron:"\u0164",tcaron:"\u0165",Tstrok:"\u0166",tstrok:"\u0167",Utilde:"\u0168",utilde:"\u0169",Umacr:"\u016A",umacr:"\u016B",Ubreve:"\u016C",ubreve:"\u016D",Uring:"\u016E",uring:"\u016F",Udblac:"\u0170",udblac:"\u0171",Uogon:"\u0172",uogon:"\u0173",Wcirc:"\u0174",wcirc:"\u0175",Ycirc:"\u0176",ycirc:"\u0177",Zacute:"\u0179",zacute:"\u017A",Zdot:"\u017B",zdot:"\u017C",Zcaron:"\u017D",zcaron:"\u017E"},gs={Alpha:"\u0391",alpha:"\u03B1",Beta:"\u0392",beta:"\u03B2",Gamma:"\u0393",gamma:"\u03B3",Delta:"\u0394",delta:"\u03B4",Epsilon:"\u0395",epsilon:"\u03B5",epsiv:"\u03F5",varepsilon:"\u03F5",Zeta:"\u0396",zeta:"\u03B6",Eta:"\u0397",eta:"\u03B7",Theta:"\u0398",theta:"\u03B8",thetasym:"\u03D1",vartheta:"\u03D1",Iota:"\u0399",iota:"\u03B9",Kappa:"\u039A",kappa:"\u03BA",kappav:"\u03F0",varkappa:"\u03F0",Lambda:"\u039B",lambda:"\u03BB",Mu:"\u039C",mu:"\u03BC",Nu:"\u039D",nu:"\u03BD",Xi:"\u039E",xi:"\u03BE",Omicron:"\u039F",omicron:"\u03BF",Pi:"\u03A0",pi:"\u03C0",piv:"\u03D6",varpi:"\u03D6",Rho:"\u03A1",rho:"\u03C1",rhov:"\u03F1",varrho:"\u03F1",Sigma:"\u03A3",sigma:"\u03C3",sigmaf:"\u03C2",sigmav:"\u03C2",varsigma:"\u03C2",Tau:"\u03A4",tau:"\u03C4",Upsilon:"\u03A5",upsilon:"\u03C5",upsi:"\u03C5",Upsi:"\u03D2",upsih:"\u03D2",Phi:"\u03A6",phi:"\u03C6",phiv:"\u03D5",varphi:"\u03D5",Chi:"\u03A7",chi:"\u03C7",Psi:"\u03A8",psi:"\u03C8",Omega:"\u03A9",omega:"\u03C9",ohm:"\u03A9",Gammad:"\u03DC",gammad:"\u03DD",digamma:"\u03DD"},Es={Afr:"\u{1D504}",afr:"\u{1D51E}",Acy:"\u0410",acy:"\u0430",Bcy:"\u0411",bcy:"\u0431",Vcy:"\u0412",vcy:"\u0432",Gcy:"\u0413",gcy:"\u0433",Dcy:"\u0414",dcy:"\u0434",IEcy:"\u0415",iecy:"\u0435",IOcy:"\u0401",iocy:"\u0451",ZHcy:"\u0416",zhcy:"\u0436",Zcy:"\u0417",zcy:"\u0437",Icy:"\u0418",icy:"\u0438",Jcy:"\u0419",jcy:"\u0439",Kcy:"\u041A",kcy:"\u043A",Lcy:"\u041B",lcy:"\u043B",Mcy:"\u041C",mcy:"\u043C",Ncy:"\u041D",ncy:"\u043D",Ocy:"\u041E",ocy:"\u043E",Pcy:"\u041F",pcy:"\u043F",Rcy:"\u0420",rcy:"\u0440",Scy:"\u0421",scy:"\u0441",Tcy:"\u0422",tcy:"\u0442",Ucy:"\u0423",ucy:"\u0443",Fcy:"\u0424",fcy:"\u0444",KHcy:"\u0425",khcy:"\u0445",TScy:"\u0426",tscy:"\u0446",CHcy:"\u0427",chcy:"\u0447",SHcy:"\u0428",shcy:"\u0448",SHCHcy:"\u0429",shchcy:"\u0449",HARDcy:"\u042A",hardcy:"\u044A",Ycy:"\u042B",ycy:"\u044B",SOFTcy:"\u042C",softcy:"\u044C",Ecy:"\u042D",ecy:"\u044D",YUcy:"\u042E",yucy:"\u044E",YAcy:"\u042F",yacy:"\u044F",DJcy:"\u0402",djcy:"\u0452",GJcy:"\u0403",gjcy:"\u0453",Jukcy:"\u0404",jukcy:"\u0454",DScy:"\u0405",dscy:"\u0455",Iukcy:"\u0406",iukcy:"\u0456",YIcy:"\u0407",yicy:"\u0457",Jsercy:"\u0408",jsercy:"\u0458",LJcy:"\u0409",ljcy:"\u0459",NJcy:"\u040A",njcy:"\u045A",TSHcy:"\u040B",tshcy:"\u045B",KJcy:"\u040C",kjcy:"\u045C",Ubrcy:"\u040E",ubrcy:"\u045E",DZcy:"\u040F",dzcy:"\u045F"},_s={plus:"+",minus:"\u2212",mnplus:"\u2213",mp:"\u2213",pm:"\xB1",times:"\xD7",div:"\xF7",divide:"\xF7",sdot:"\u22C5",star:"\u2606",starf:"\u2605",bigstar:"\u2605",lowast:"\u2217",ast:"*",midast:"*",compfn:"\u2218",smallcircle:"\u2218",bullet:"\u2022",bull:"\u2022",nbsp:"\xA0",hellip:"\u2026",mldr:"\u2026",prime:"\u2032",Prime:"\u2033",tprime:"\u2034",bprime:"\u2035",backprime:"\u2035",minus:"\u2212",minusd:"\u2238",dotminus:"\u2238",plusdo:"\u2214",dotplus:"\u2214",plusmn:"\xB1",minusplus:"\u2213",mnplus:"\u2213",mp:"\u2213",setminus:"\u2216",smallsetminus:"\u2216",Backslash:"\u2216",setmn:"\u2216",ssetmn:"\u2216",lowbar:"_",verbar:"|",vert:"|",VerticalLine:"|",colon:":",Colon:"\u2237",Proportion:"\u2237",ratio:"\u2236",equals:"=",ne:"\u2260",nequiv:"\u2262",equiv:"\u2261",Congruent:"\u2261",sim:"\u223C",thicksim:"\u223C",thksim:"\u223C",sime:"\u2243",simeq:"\u2243",TildeEqual:"\u2243",asymp:"\u2248",approx:"\u2248",thickapprox:"\u2248",thkap:"\u2248",TildeTilde:"\u2248",ncong:"\u2247",cong:"\u2245",TildeFullEqual:"\u2245",asympeq:"\u224D",CupCap:"\u224D",bump:"\u224E",Bumpeq:"\u224E",HumpDownHump:"\u224E",bumpe:"\u224F",bumpeq:"\u224F",HumpEqual:"\u224F",dotminus:"\u2238",minusd:"\u2238",plusdo:"\u2214",dotplus:"\u2214",le:"\u2264",LessEqual:"\u2264",ge:"\u2265",GreaterEqual:"\u2265",lesseqgtr:"\u22DA",lesseqqgtr:"\u2A8B",greater:">",less:"<"},ys={alefsym:"\u2135",aleph:"\u2135",beth:"\u2136",gimel:"\u2137",daleth:"\u2138",forall:"\u2200",ForAll:"\u2200",part:"\u2202",PartialD:"\u2202",exist:"\u2203",Exists:"\u2203",nexist:"\u2204",nexists:"\u2204",empty:"\u2205",emptyset:"\u2205",emptyv:"\u2205",varnothing:"\u2205",nabla:"\u2207",Del:"\u2207",isin:"\u2208",isinv:"\u2208",in:"\u2208",Element:"\u2208",notin:"\u2209",notinva:"\u2209",ni:"\u220B",niv:"\u220B",SuchThat:"\u220B",ReverseElement:"\u220B",notni:"\u220C",notniva:"\u220C",prod:"\u220F",Product:"\u220F",coprod:"\u2210",Coproduct:"\u2210",sum:"\u2211",Sum:"\u2211",minus:"\u2212",mp:"\u2213",plusdo:"\u2214",dotplus:"\u2214",setminus:"\u2216",lowast:"\u2217",radic:"\u221A",Sqrt:"\u221A",prop:"\u221D",propto:"\u221D",Proportional:"\u221D",varpropto:"\u221D",infin:"\u221E",infintie:"\u29DD",ang:"\u2220",angle:"\u2220",angmsd:"\u2221",measuredangle:"\u2221",angsph:"\u2222",mid:"\u2223",VerticalBar:"\u2223",nmid:"\u2224",nsmid:"\u2224",npar:"\u2226",parallel:"\u2225",spar:"\u2225",nparallel:"\u2226",nspar:"\u2226",and:"\u2227",wedge:"\u2227",or:"\u2228",vee:"\u2228",cap:"\u2229",cup:"\u222A",int:"\u222B",Integral:"\u222B",conint:"\u222E",ContourIntegral:"\u222E",Conint:"\u222F",DoubleContourIntegral:"\u222F",Cconint:"\u2230",there4:"\u2234",therefore:"\u2234",Therefore:"\u2234",becaus:"\u2235",because:"\u2235",Because:"\u2235",ratio:"\u2236",Proportion:"\u2237",minusd:"\u2238",dotminus:"\u2238",mDDot:"\u223A",homtht:"\u223B",sim:"\u223C",bsimg:"\u223D",backsim:"\u223D",ac:"\u223E",mstpos:"\u223E",acd:"\u223F",VerticalTilde:"\u2240",wr:"\u2240",wreath:"\u2240",nsime:"\u2244",nsimeq:"\u2244",nsimeq:"\u2244",ncong:"\u2247",simne:"\u2246",ncongdot:"\u2A6D\u0338",ngsim:"\u2275",nsim:"\u2241",napprox:"\u2249",nap:"\u2249",ngeq:"\u2271",nge:"\u2271",nleq:"\u2270",nle:"\u2270",ngtr:"\u226F",ngt:"\u226F",nless:"\u226E",nlt:"\u226E",nprec:"\u2280",npr:"\u2280",nsucc:"\u2281",nsc:"\u2281"},xs={larr:"\u2190",leftarrow:"\u2190",LeftArrow:"\u2190",uarr:"\u2191",uparrow:"\u2191",UpArrow:"\u2191",rarr:"\u2192",rightarrow:"\u2192",RightArrow:"\u2192",darr:"\u2193",downarrow:"\u2193",DownArrow:"\u2193",harr:"\u2194",leftrightarrow:"\u2194",LeftRightArrow:"\u2194",varr:"\u2195",updownarrow:"\u2195",UpDownArrow:"\u2195",nwarr:"\u2196",nwarrow:"\u2196",UpperLeftArrow:"\u2196",nearr:"\u2197",nearrow:"\u2197",UpperRightArrow:"\u2197",searr:"\u2198",searrow:"\u2198",LowerRightArrow:"\u2198",swarr:"\u2199",swarrow:"\u2199",LowerLeftArrow:"\u2199",lArr:"\u21D0",Leftarrow:"\u21D0",uArr:"\u21D1",Uparrow:"\u21D1",rArr:"\u21D2",Rightarrow:"\u21D2",dArr:"\u21D3",Downarrow:"\u21D3",hArr:"\u21D4",Leftrightarrow:"\u21D4",iff:"\u21D4",vArr:"\u21D5",Updownarrow:"\u21D5",lAarr:"\u21DA",Lleftarrow:"\u21DA",rAarr:"\u21DB",Rrightarrow:"\u21DB",lrarr:"\u21C6",leftrightarrows:"\u21C6",rlarr:"\u21C4",rightleftarrows:"\u21C4",lrhar:"\u21CB",leftrightharpoons:"\u21CB",ReverseEquilibrium:"\u21CB",rlhar:"\u21CC",rightleftharpoons:"\u21CC",Equilibrium:"\u21CC",udarr:"\u21C5",UpArrowDownArrow:"\u21C5",duarr:"\u21F5",DownArrowUpArrow:"\u21F5",llarr:"\u21C7",leftleftarrows:"\u21C7",rrarr:"\u21C9",rightrightarrows:"\u21C9",ddarr:"\u21CA",downdownarrows:"\u21CA",har:"\u21BD",lhard:"\u21BD",leftharpoondown:"\u21BD",lharu:"\u21BC",leftharpoonup:"\u21BC",rhard:"\u21C1",rightharpoondown:"\u21C1",rharu:"\u21C0",rightharpoonup:"\u21C0",lsh:"\u21B0",Lsh:"\u21B0",rsh:"\u21B1",Rsh:"\u21B1",ldsh:"\u21B2",rdsh:"\u21B3",hookleftarrow:"\u21A9",hookrightarrow:"\u21AA",mapstoleft:"\u21A4",mapstoup:"\u21A5",map:"\u21A6",mapsto:"\u21A6",mapstodown:"\u21A7",crarr:"\u21B5",nwarrow:"\u2196",nearrow:"\u2197",searrow:"\u2198",swarrow:"\u2199",nleftarrow:"\u219A",nleftrightarrow:"\u21AE",nrightarrow:"\u219B",nrarr:"\u219B",larrtl:"\u21A2",rarrtl:"\u21A3",leftarrowtail:"\u21A2",rightarrowtail:"\u21A3",twoheadleftarrow:"\u219E",twoheadrightarrow:"\u21A0",Larr:"\u219E",Rarr:"\u21A0",larrhk:"\u21A9",rarrhk:"\u21AA",larrlp:"\u21AB",looparrowleft:"\u21AB",rarrlp:"\u21AC",looparrowright:"\u21AC",harrw:"\u21AD",leftrightsquigarrow:"\u21AD",nrarrw:"\u219D\u0338",rarrw:"\u219D",rightsquigarrow:"\u219D",larrbfs:"\u291F",rarrbfs:"\u2920",nvHarr:"\u2904",nvlArr:"\u2902",nvrArr:"\u2903",larrfs:"\u291D",rarrfs:"\u291E",Map:"\u2905",larrsim:"\u2973",rarrsim:"\u2974",harrcir:"\u2948",Uarrocir:"\u2949",lurdshar:"\u294A",ldrdhar:"\u2967",ldrushar:"\u294B",rdldhar:"\u2969",lrhard:"\u296D",rlhar:"\u21CC",uharr:"\u21BE",uharl:"\u21BF",dharr:"\u21C2",dharl:"\u21C3",Uarr:"\u219F",Darr:"\u21A1",zigrarr:"\u21DD",nwArr:"\u21D6",neArr:"\u21D7",seArr:"\u21D8",swArr:"\u21D9",nharr:"\u21AE",nhArr:"\u21CE",nlarr:"\u219A",nlArr:"\u21CD",nrarr:"\u219B",nrArr:"\u21CF",larrb:"\u21E4",LeftArrowBar:"\u21E4",rarrb:"\u21E5",RightArrowBar:"\u21E5"},Ts={square:"\u25A1",Square:"\u25A1",squ:"\u25A1",squf:"\u25AA",squarf:"\u25AA",blacksquar:"\u25AA",blacksquare:"\u25AA",FilledVerySmallSquare:"\u25AA",blk34:"\u2593",blk12:"\u2592",blk14:"\u2591",block:"\u2588",srect:"\u25AD",rect:"\u25AD",sdot:"\u22C5",sdotb:"\u22A1",dotsquare:"\u22A1",triangle:"\u25B5",tri:"\u25B5",trine:"\u25B5",utri:"\u25B5",triangledown:"\u25BF",dtri:"\u25BF",tridown:"\u25BF",triangleleft:"\u25C3",ltri:"\u25C3",triangleright:"\u25B9",rtri:"\u25B9",blacktriangle:"\u25B4",utrif:"\u25B4",blacktriangledown:"\u25BE",dtrif:"\u25BE",blacktriangleleft:"\u25C2",ltrif:"\u25C2",blacktriangleright:"\u25B8",rtrif:"\u25B8",loz:"\u25CA",lozenge:"\u25CA",blacklozenge:"\u29EB",lozf:"\u29EB",bigcirc:"\u25EF",xcirc:"\u25EF",circ:"\u02C6",Circle:"\u25CB",cir:"\u25CB",o:"\u25CB",bullet:"\u2022",bull:"\u2022",hellip:"\u2026",mldr:"\u2026",nldr:"\u2025",boxh:"\u2500",HorizontalLine:"\u2500",boxv:"\u2502",boxdr:"\u250C",boxdl:"\u2510",boxur:"\u2514",boxul:"\u2518",boxvr:"\u251C",boxvl:"\u2524",boxhd:"\u252C",boxhu:"\u2534",boxvh:"\u253C",boxH:"\u2550",boxV:"\u2551",boxdR:"\u2552",boxDr:"\u2553",boxDR:"\u2554",boxDl:"\u2555",boxdL:"\u2556",boxDL:"\u2557",boxuR:"\u2558",boxUr:"\u2559",boxUR:"\u255A",boxUl:"\u255C",boxuL:"\u255B",boxUL:"\u255D",boxvR:"\u255E",boxVr:"\u255F",boxVR:"\u2560",boxVl:"\u2562",boxvL:"\u2561",boxVL:"\u2563",boxHd:"\u2564",boxhD:"\u2565",boxHD:"\u2566",boxHu:"\u2567",boxhU:"\u2568",boxHU:"\u2569",boxvH:"\u256A",boxVh:"\u256B",boxVH:"\u256C"},Ns={excl:"!",iexcl:"\xA1",brvbar:"\xA6",sect:"\xA7",uml:"\xA8",copy:"\xA9",ordf:"\xAA",laquo:"\xAB",not:"\xAC",shy:"\xAD",reg:"\xAE",macr:"\xAF",deg:"\xB0",plusmn:"\xB1",sup2:"\xB2",sup3:"\xB3",acute:"\xB4",micro:"\xB5",para:"\xB6",middot:"\xB7",cedil:"\xB8",sup1:"\xB9",ordm:"\xBA",raquo:"\xBB",frac14:"\xBC",frac12:"\xBD",frac34:"\xBE",iquest:"\xBF",nbsp:"\xA0",comma:",",period:".",colon:":",semi:";",vert:"|",Verbar:"\u2016",verbar:"|",dblac:"\u02DD",circ:"\u02C6",caron:"\u02C7",breve:"\u02D8",dot:"\u02D9",ring:"\u02DA",ogon:"\u02DB",tilde:"\u02DC",DiacriticalGrave:"`",DiacriticalAcute:"\xB4",DiacriticalTilde:"\u02DC",DiacriticalDot:"\u02D9",DiacriticalDoubleAcute:"\u02DD",grave:"`",acute:"\xB4"},ws={cent:"\xA2",pound:"\xA3",curren:"\xA4",yen:"\xA5",euro:"\u20AC",dollar:"$",euro:"\u20AC",fnof:"\u0192",inr:"\u20B9",af:"\u060B",birr:"\u1265\u122D",peso:"\u20B1",rub:"\u20BD",won:"\u20A9",yuan:"\xA5",cedil:"\xB8"},bs={frac12:"\xBD",half:"\xBD",frac13:"\u2153",frac14:"\xBC",frac15:"\u2155",frac16:"\u2159",frac18:"\u215B",frac23:"\u2154",frac25:"\u2156",frac34:"\xBE",frac35:"\u2157",frac38:"\u215C",frac45:"\u2158",frac56:"\u215A",frac58:"\u215D",frac78:"\u215E",frasl:"\u2044"},As={trade:"\u2122",TRADE:"\u2122",telrec:"\u2315",target:"\u2316",ulcorn:"\u231C",ulcorner:"\u231C",urcorn:"\u231D",urcorner:"\u231D",dlcorn:"\u231E",llcorner:"\u231E",drcorn:"\u231F",lrcorner:"\u231F",intercal:"\u22BA",intcal:"\u22BA",oplus:"\u2295",CirclePlus:"\u2295",ominus:"\u2296",CircleMinus:"\u2296",otimes:"\u2297",CircleTimes:"\u2297",osol:"\u2298",odot:"\u2299",CircleDot:"\u2299",oast:"\u229B",circledast:"\u229B",odash:"\u229D",circleddash:"\u229D",ocirc:"\u229A",circledcirc:"\u229A",boxplus:"\u229E",plusb:"\u229E",boxminus:"\u229F",minusb:"\u229F",boxtimes:"\u22A0",timesb:"\u22A0",boxdot:"\u22A1",sdotb:"\u22A1",veebar:"\u22BB",vee:"\u2228",barvee:"\u22BD",and:"\u2227",wedge:"\u2227",Cap:"\u22D2",Cup:"\u22D3",Fork:"\u22D4",pitchfork:"\u22D4",epar:"\u22D5",ltlarr:"\u2976",nvap:"\u224D\u20D2",nvsim:"\u223C\u20D2",nvge:"\u2265\u20D2",nvle:"\u2264\u20D2",nvlt:"<\u20D2",nvgt:">\u20D2",nvltrie:"\u22B4\u20D2",nvrtrie:"\u22B5\u20D2",Vdash:"\u22A9",dashv:"\u22A3",vDash:"\u22A8",Vdash:"\u22A9",Vvdash:"\u22AA",nvdash:"\u22AC",nvDash:"\u22AD",nVdash:"\u22AE",nVDash:"\u22AF"},Vn={...ds,...ps,...ms,...gs,...Es,..._s,...ys,...xs,...Ts,...Ns,...ws,...bs,...As},Ht={amp:"&",apos:"'",gt:">",lt:"<",quot:'"'};var Cs=new Set("!?\\\\/[]$%{}^&*()<>|+");function Wt(t){if(t[0]==="#")throw new Error(`[EntityReplacer] Invalid character '#' in entity name: "${t}"`);for(let e of t)if(Cs.has(e))throw new Error(`[EntityReplacer] Invalid character '${e}' in entity name: "${t}"`);return t}function rt(...t){let e=Object.create(null);for(let r of t)if(r)for(let s of Object.keys(r)){let n=r[s];if(typeof n=="string")e[s]=n;else if(n&&typeof n=="object"&&n.val!==void 0){let i=n.val;typeof i=="string"&&(e[s]=i)}}return e}var V="external",Ae="base",st="all";function Is(t){return!t||t===V?new Set([V]):t===st?new Set([st]):t===Ae?new Set([Ae]):Array.isArray(t)?new Set(t):new Set([V])}var w=Object.freeze({allow:0,leave:1,remove:2,throw:3}),Ss=new Set([9,10,13]);function Os(t){if(!t)return{xmlVersion:1,onLevel:w.allow,nullLevel:w.remove};let e=t.xmlVersion===1.1?1.1:1,r=w[t.onNCR]??w.allow,s=w[t.nullNCR]??w.remove,n=Math.max(s,w.remove);return{xmlVersion:e,onLevel:r,nullLevel:n}}var K=class{constructor(e={}){this._limit=e.limit||{},this._maxTotalExpansions=this._limit.maxTotalExpansions||0,this._maxExpandedLength=this._limit.maxExpandedLength||0,this._postCheck=typeof e.postCheck=="function"?e.postCheck:s=>s,this._limitTiers=Is(this._limit.applyLimitsTo??V),this._numericAllowed=e.numericAllowed??!0,this._baseMap=rt(Ht,e.namedEntities||null),this._externalMap=Object.create(null),this._inputMap=Object.create(null),this._totalExpansions=0,this._expandedLength=0,this._removeSet=new Set(e.remove&&Array.isArray(e.remove)?e.remove:[]),this._leaveSet=new Set(e.leave&&Array.isArray(e.leave)?e.leave:[]);let r=Os(e.ncr);this._ncrXmlVersion=r.xmlVersion,this._ncrOnLevel=r.onLevel,this._ncrNullLevel=r.nullLevel}setExternalEntities(e){if(e)for(let r of Object.keys(e))Wt(r);this._externalMap=rt(e)}addExternalEntity(e,r){Wt(e),typeof r=="string"&&r.indexOf("&")===-1&&(this._externalMap[e]=r)}addInputEntities(e){this._totalExpansions=0,this._expandedLength=0,this._inputMap=rt(e)}reset(){return this._inputMap=Object.create(null),this._totalExpansions=0,this._expandedLength=0,this}setXmlVersion(e){this._ncrXmlVersion=e===1.1?1.1:1}decode(e){if(typeof e!="string"||e.length===0)return e;let r=e,s=[],n=e.length,i=0,o=0,a=this._maxTotalExpansions>0,l=this._maxExpandedLength>0,c=a||l;for(;o<n;){if(e.charCodeAt(o)!==38){o++;continue}let m=o+1;for(;m<n&&e.charCodeAt(m)!==59&&m-o<=32;)m++;if(m>=n||e.charCodeAt(m)!==59){o++;continue}let p=e.slice(o+1,m);if(p.length===0){o++;continue}let g,_;if(this._removeSet.has(p))g="",_===void 0&&(_=V);else if(this._leaveSet.has(p)){o++;continue}else if(p.charCodeAt(0)===35){let x=this._resolveNCR(p);if(x===void 0){o++;continue}g=x,_=Ae}else{let x=this._resolveName(p);g=x?.value,_=x?.tier}if(g===void 0){o++;continue}if(o>i&&s.push(e.slice(i,o)),s.push(g),i=m+1,o=i,c&&this._tierCounts(_)){if(a&&(this._totalExpansions++,this._totalExpansions>this._maxTotalExpansions))throw new Error(`[EntityReplacer] Entity expansion count limit exceeded: ${this._totalExpansions} > ${this._maxTotalExpansions}`);if(l){let x=g.length-(p.length+2);if(x>0&&(this._expandedLength+=x,this._expandedLength>this._maxExpandedLength))throw new Error(`[EntityReplacer] Expanded content length limit exceeded: ${this._expandedLength} > ${this._maxExpandedLength}`)}}}i<n&&s.push(e.slice(i));let u=s.length===0?e:s.join("");return this._postCheck(u,r)}_tierCounts(e){return this._limitTiers.has(st)?!0:this._limitTiers.has(e)}_resolveName(e){if(e in this._inputMap)return{value:this._inputMap[e],tier:V};if(e in this._externalMap)return{value:this._externalMap[e],tier:V};if(e in this._baseMap)return{value:this._baseMap[e],tier:Ae}}_classifyNCR(e){return e===0?this._ncrNullLevel:e>=55296&&e<=57343||this._ncrXmlVersion===1&&e>=1&&e<=31&&!Ss.has(e)?w.remove:-1}_applyNCRAction(e,r,s){switch(e){case w.allow:return String.fromCodePoint(s);case w.remove:return"";case w.leave:return;case w.throw:throw new Error(`[EntityDecoder] Prohibited numeric character reference &${r}; (U+${s.toString(16).toUpperCase().padStart(4,"0")})`);default:return String.fromCodePoint(s)}}_resolveNCR(e){let r=e.charCodeAt(1),s;if(r===120||r===88?s=parseInt(e.slice(2),16):s=parseInt(e.slice(1),10),Number.isNaN(s)||s<0||s>1114111)return;let n=this._classifyNCR(s);if(!this._numericAllowed&&n<w.remove)return;let i=n===-1?this._ncrOnLevel:Math.max(this._ncrOnLevel,n);return this._applyNCRAction(i,e,s)}};var re=class extends K{constructor(e){super(e)}parse(e){return typeof e=="string"&&(e=this.decode(e)),e}};var z=class{parse(e){return typeof e=="string"?e.trim():e}};var q=class{constructor(e,r){e?this.trueList=e:this.trueList=["true"],r?this.falseList=r:this.falseList=["false"]}parse(e){if(typeof e=="string"){let r=e.toLowerCase();if(this.trueList.indexOf(r)!==-1)return!0;if(this.falseList.indexOf(r)!==-1)return!1}return e}};var H=class{constructor(e){this.options=e||{}}parse(e){return typeof e=="string"&&(e=tt(e,this.options)),e}};var Jt={maxLength:200},Ps={$:"en-US","\u20AC":"de-DE","\xA3":"en-GB","\xA5":"ja-JP","\u20B9":"en-IN"};var Ds=/^\s*(?:-|\+)?(?:\d+|\d{1,3}(?:,\d{3})+)?(?:\.\d{1,2})?\s*(?:\$|€|¥|₹)?\s*$/u,B=class{constructor(e){this.options=e||Jt}parse(e){if(typeof e=="string"&&e.length<=this.options.maxLength&&e.indexOf(",,")!==-1&&e.indexOf(!0)){let r=e.match(Ds);if(r){let s=this.options.locale||Ps[r[2]||r[5]||"\u20B9"],n=new Intl.NumberFormat(s);e=e.replace(/[^0-9,.]/g,"").trim(),e=Number(e.replace(n.format(1e3)[1],""))}}return e}};B.defaultOptions=Jt;var Ce=Object.freeze({ELEMENT:"ELEMENT",ATTRIBUTE:"ATTRIBUTE"}),F=class{constructor(e){this.matcher=e||null,this._rootName="^"}addAttribute(e,r,s){e==="version"&&this.tagName===this._rootName&&Zt(this.registeredValParsers,"setXmlVersion",+r);let n=this.options.attributes.prefix+e+this.options.attributes.suffix,i={elementName:e,elementValue:r,elementType:Ce.ATTRIBUTE,matcher:s,isLeafNode:!0};this.attributes[n]=this.parseValue(r,this.options.attributes.valueParsers,i)}parseValue(e,r,s){for(let n=0;n<r.length;n++){let i=r[n];typeof i=="string"&&(i=this.registeredValParsers[i]),i&&(e=i.parse(e,s))}return e}_addChild(e,r){}addComment(e){this.options.skip.comment||this.options.nameFor.comment&&this._addChild(this.options.nameFor.comment,e)}addLiteral(e){this.options.skip.cdata||(this.options.nameFor.cdata?this._addChild(this.options.nameFor.cdata,e):this.addRawValue(e||""))}addRawValue(e){this.addValue(e)}addInputEntities(e){Zt(this.registeredValParsers,"addInputEntities",e)}addDeclaration(e){this.addInstruction(e)}addInstruction(e){}onExit(e){}};function Zt(t,e,r){for(let s of Object.values(t))typeof s[e]=="function"&&s[e](r)}function nt(){return{entity:new re,trim:new z,boolean:new q,number:new H({hex:!0,leadingZeros:!0,eNotation:!0}),currency:new B}}var W=class{constructor(){this.commonValParsers=nt()}registerValueParser(e,r){this.commonValParsers[e]=r}getInstance(e,r){return this.resetValueParsers(),new F(e,r,this.commonValParsers)}resetValueParsers(){for(let e of Object.values(this.commonValParsers))e&&e.reset&&e.reset()}};var T=class{constructor(e,r={},s){this.pattern=e,this.separator=r.separator||".",this.segments=this._parse(e),this.data=s,this._hasDeepWildcard=this.segments.some(n=>n.type==="deep-wildcard"),this._hasAttributeCondition=this.segments.some(n=>n.attrName!==void 0),this._hasPositionSelector=this.segments.some(n=>n.position!==void 0)}_parse(e){let r=[],s=0,n="";for(;s<e.length;)e[s]===this.separator?s+1<e.length&&e[s+1]===this.separator?(n.trim()&&(r.push(this._parseSegment(n.trim())),n=""),r.push({type:"deep-wildcard"}),s+=2):(n.trim()&&r.push(this._parseSegment(n.trim())),n="",s++):(n+=e[s],s++);return n.trim()&&r.push(this._parseSegment(n.trim())),r}_parseSegment(e){let r={type:"tag"},s=null,n=e,i=e.match(/^([^\[]+)(\[[^\]]*\])(.*)$/);if(i&&(n=i[1]+i[3],i[2])){let u=i[2].slice(1,-1);u&&(s=u)}let o,a=n;if(n.includes("::")){let u=n.indexOf("::");if(o=n.substring(0,u).trim(),a=n.substring(u+2).trim(),!o)throw new Error(`Invalid namespace in pattern: ${e}`)}let l,c=null;if(a.includes(":")){let u=a.lastIndexOf(":"),m=a.substring(0,u).trim(),p=a.substring(u+1).trim();["first","last","odd","even"].includes(p)||/^nth\(\d+\)$/.test(p)?(l=m,c=p):l=a}else l=a;if(!l)throw new Error(`Invalid segment pattern: ${e}`);if(r.tag=l,o&&(r.namespace=o),s)if(s.includes("=")){let u=s.indexOf("=");r.attrName=s.substring(0,u).trim(),r.attrValue=s.substring(u+1).trim()}else r.attrName=s.trim();if(c){let u=c.match(/^nth\((\d+)\)$/);u?(r.position="nth",r.positionValue=parseInt(u[1],10)):r.position=c}return r}get length(){return this.segments.length}hasDeepWildcard(){return this._hasDeepWildcard}hasAttributeCondition(){return this._hasAttributeCondition}hasPositionSelector(){return this._hasPositionSelector}toString(){return this.pattern}};var D=class{constructor(){this._byDepthAndTag=new Map,this._wildcardByDepth=new Map,this._deepWildcards=[],this._patterns=new Set,this._sealed=!1}add(e){if(this._sealed)throw new TypeError("ExpressionSet is sealed. Create a new ExpressionSet to add more expressions.");if(this._patterns.has(e.pattern))return this;if(this._patterns.add(e.pattern),e.hasDeepWildcard())return this._deepWildcards.push(e),this;let r=e.length,n=e.segments[e.segments.length-1]?.tag;if(!n||n==="*")this._wildcardByDepth.has(r)||this._wildcardByDepth.set(r,[]),this._wildcardByDepth.get(r).push(e);else{let i=`${r}:${n}`;this._byDepthAndTag.has(i)||this._byDepthAndTag.set(i,[]),this._byDepthAndTag.get(i).push(e)}return this}addAll(e){for(let r of e)this.add(r);return this}has(e){return this._patterns.has(e.pattern)}get size(){return this._patterns.size}seal(){return this._sealed=!0,this}get isSealed(){return this._sealed}matchesAny(e){return this.findMatch(e)!==null}findMatch(e){let r=e.getDepth(),s=e.getCurrentTag(),n=`${r}:${s}`,i=this._byDepthAndTag.get(n);if(i){for(let a=0;a<i.length;a++)if(e.matches(i[a]))return i[a]}let o=this._wildcardByDepth.get(r);if(o){for(let a=0;a<o.length;a++)if(e.matches(o[a]))return o[a]}for(let a=0;a<this._deepWildcards.length;a++)if(e.matches(this._deepWildcards[a]))return this._deepWildcards[a];return null}};var it=class{constructor(e){this._matcher=e}get separator(){return this._matcher.separator}getCurrentTag(){let e=this._matcher.path;return e.length>0?e[e.length-1].tag:void 0}getCurrentNamespace(){let e=this._matcher.path;return e.length>0?e[e.length-1].namespace:void 0}getAttrValue(e){let r=this._matcher.path;if(r.length!==0)return r[r.length-1].values?.[e]}hasAttr(e){let r=this._matcher.path;if(r.length===0)return!1;let s=r[r.length-1];return s.values!==void 0&&e in s.values}getPosition(){let e=this._matcher.path;return e.length===0?-1:e[e.length-1].position??0}getCounter(){let e=this._matcher.path;return e.length===0?-1:e[e.length-1].counter??0}getIndex(){return this.getPosition()}getDepth(){return this._matcher.path.length}toString(e,r=!0){return this._matcher.toString(e,r)}toArray(){return this._matcher.path.map(e=>e.tag)}matches(e){return this._matcher.matches(e)}matchesAny(e){return e.matchesAny(this._matcher)}},P=class{constructor(e={}){this.separator=e.separator||".",this.path=[],this.siblingStacks=[],this._pathStringCache=null,this._view=new it(this)}push(e,r=null,s=null){this._pathStringCache=null,this.path.length>0&&(this.path[this.path.length-1].values=void 0);let n=this.path.length;this.siblingStacks[n]||(this.siblingStacks[n]=new Map);let i=this.siblingStacks[n],o=s?`${s}:${e}`:e,a=i.get(o)||0,l=0;for(let u of i.values())l+=u;i.set(o,a+1);let c={tag:e,position:l,counter:a};s!=null&&(c.namespace=s),r!=null&&(c.values=r),this.path.push(c)}pop(){if(this.path.length===0)return;this._pathStringCache=null;let e=this.path.pop();return this.siblingStacks.length>this.path.length+1&&(this.siblingStacks.length=this.path.length+1),e}updateCurrent(e){if(this.path.length>0){let r=this.path[this.path.length-1];e!=null&&(r.values=e)}}getCurrentTag(){return this.path.length>0?this.path[this.path.length-1].tag:void 0}getCurrentNamespace(){return this.path.length>0?this.path[this.path.length-1].namespace:void 0}getAttrValue(e){if(this.path.length!==0)return this.path[this.path.length-1].values?.[e]}hasAttr(e){if(this.path.length===0)return!1;let r=this.path[this.path.length-1];return r.values!==void 0&&e in r.values}getPosition(){return this.path.length===0?-1:this.path[this.path.length-1].position??0}getCounter(){return this.path.length===0?-1:this.path[this.path.length-1].counter??0}getIndex(){return this.getPosition()}getDepth(){return this.path.length}toString(e,r=!0){let s=e||this.separator;if(s===this.separator&&r===!0){if(this._pathStringCache!==null)return this._pathStringCache;let i=this.path.map(o=>o.namespace?`${o.namespace}:${o.tag}`:o.tag).join(s);return this._pathStringCache=i,i}return this.path.map(i=>r&&i.namespace?`${i.namespace}:${i.tag}`:i.tag).join(s)}toArray(){return this.path.map(e=>e.tag)}reset(){this._pathStringCache=null,this.path=[],this.siblingStacks=[]}matches(e){let r=e.segments;return r.length===0?!1:e.hasDeepWildcard()?this._matchWithDeepWildcard(r):this._matchSimple(r)}_matchSimple(e){if(this.path.length!==e.length)return!1;for(let r=0;r<e.length;r++)if(!this._matchSegment(e[r],this.path[r],r===this.path.length-1))return!1;return!0}_matchWithDeepWildcard(e){let r=this.path.length-1,s=e.length-1;for(;s>=0&&r>=0;){let n=e[s];if(n.type==="deep-wildcard"){if(s--,s<0)return!0;let i=e[s],o=!1;for(let a=r;a>=0;a--)if(this._matchSegment(i,this.path[a],a===this.path.length-1)){r=a-1,s--,o=!0;break}if(!o)return!1}else{if(!this._matchSegment(n,this.path[r],r===this.path.length-1))return!1;r--,s--}}return s<0}_matchSegment(e,r,s){if(e.tag!=="*"&&e.tag!==r.tag||e.namespace!==void 0&&e.namespace!=="*"&&e.namespace!==r.namespace||e.attrName!==void 0&&(!s||!r.values||!(e.attrName in r.values)||e.attrValue!==void 0&&String(r.values[e.attrName])!==String(e.attrValue)))return!1;if(e.position!==void 0){if(!s)return!1;let n=r.counter??0;if(e.position==="first"&&n!==0)return!1;if(e.position==="odd"&&n%2!==1)return!1;if(e.position==="even"&&n%2!==0)return!1;if(e.position==="nth"&&n!==e.positionValue)return!1}return!0}matchesAny(e){return e.matchesAny(this)}snapshot(){return{path:this.path.map(e=>({...e})),siblingStacks:this.siblingStacks.map(e=>new Map(e))}}restore(e){this._pathStringCache=null,this.path=e.path.map(r=>({...r})),this.siblingStacks=e.siblingStacks.map(r=>new Map(r))}readOnly(){return this._view}};var J=class extends W{constructor(e){super(),this.options=zt(e),this.options.alwaysArray&&(this.options.alwaysArray=this.options.alwaysArray.map(r=>typeof r=="string"?new T(r):r))}getInstance(e,r){this.resetValueParsers();let s={...this.commonValParsers};return new Ie(e,this.options,s,r)}},Ie=class extends F{constructor(e,r,s,n){super(n),this.tagsStack=[],this.options={...r,...e,skip:{...r.skip,...e.skip},nameFor:{...r.nameFor,...e.nameFor},tags:{...r.tags,...e.tags},attributes:{...r.attributes,...e.attributes},textJoint:r.textJoint||"",forceArray:r?.forceArray||null,alwaysArray:r?.alwaysArray||[],forceTextNode:r?.forceTextNode??!1},this.registeredValParsers=s,this.root={},this.parent=this.root,this.tagName=this._rootName,this.value={},this.textValue="",this.attributes={}}addElement(e){let r="";se(this.attributes)||(this.options.attributes.groupBy?r={[this.options.attributes.groupBy]:this.attributes}:r=this.attributes),this.tagsStack.push([this.tagName,this.textValue,this.value]),this.tagName=e.name,this.value=r,this.textValue="",this.attributes={}}onStopNode(e,r){typeof this.options.onStopNode=="function"&&this.options.onStopNode(e,r,this.matcher)}_resolveForceArray(e){let r;this.options.alwaysArray.some(o=>this.matcher.matches(o))&&(r=!0);let i;if(typeof this.options.forceArray=="function"){let o=this.options.forceArray(this.matcher,e);o===!0?i=!0:o===!1&&(i=!1)}return r===!1||i===!1?!1:r===!0||i===!0}closeElement(){let e=this.tagName,r=this.value,s=this.textValue,n;if(typeof r!="object"||Array.isArray(r))n=!0;else if(se(r))n=!0;else{let u=this.options.attributes.prefix,m=this.options.attributes.groupBy;m?n=Object.keys(r).length===1&&r.hasOwnProperty(m):n=Object.keys(r).every(p=>p.startsWith(u))}let i={elementName:e,elementValue:s,elementType:Ce.ELEMENT,matcher:this.matcher,isLeafNode:n};if(n){let u=this.parseValue(s,this.options.tags.valueParsers,i);this.options.forceTextNode?typeof r=="object"&&!se(r)?r[this.options.nameFor.text]=u:r={[this.options.nameFor.text]:u}:typeof r=="object"&&!se(r)?r[this.options.nameFor.text]=u:r=u}else if(s.length>0||this.options.forceTextNode){let u=this.parseValue(s,this.options.tags.valueParsers,i);r[this.options.nameFor.text]=u}let o={tagName:e,value:r};if(this.options.onTagClose!==void 0&&(o=this.options.onTagClose(e,r,s,this.matcher),!o))return;let a=this.tagsStack.pop(),l=a[2],c=this._resolveForceArray(n);l=this._addChildTo(o.tagName,o.value,l,c),this.tagName=a[0],this.textValue=a[1],this.value=l}_addChild(e,r){typeof this.value=="string"&&(this.value={[this.options.nameFor.text]:this.value}),this._addChildTo(e,r,this.value,!1),this.attributes={}}_addChildTo(e,r,s,n){return typeof s=="string"&&(s={}),Object.prototype.hasOwnProperty.call(s,e)?(Array.isArray(s[e])||(s[e]=[s[e]]),s[e].push(r)):n?s[e]=[r]:s[e]=r,s}addValue(e){this.textValue.length>0?this.textValue+=this.options.textJoint+e:this.textValue=e}onExit(e){}addInstruction(e){let r="";se(this.attributes)||(this.options.attributes.groupBy?r={[this.options.attributes.groupBy]:this.attributes}:r=this.attributes),this._addChild(e,r),this.attributes={}}getOutput(){return this.value}};function se(t){return Object.keys(t).length===0}var f=class extends Error{constructor(e,r,s={}){super(e),this.name="ParseError",this.code=r,this.line=s.line??void 0,this.col=s.col??void 0,this.index=s.index??void 0}toString(){let e=this._posStr();return e?`${this.name} [${this.code}] at ${e}: ${this.message}`:`${this.name} [${this.code}]: ${this.message}`}_posStr(){return this.line!==void 0&&this.col!==void 0?`line ${this.line}, col ${this.col}`:this.index!==void 0?`index ${this.index}`:null}},h=Object.freeze({INVALID_INPUT:"INVALID_INPUT",INVALID_STREAM:"INVALID_STREAM",ALREADY_STREAMING:"ALREADY_STREAMING",NOT_STREAMING:"NOT_STREAMING",DATA_MUST_BE_STRING:"DATA_MUST_BE_STRING",UNEXPECTED_END:"UNEXPECTED_END",UNEXPECTED_CLOSE_TAG:"UNEXPECTED_CLOSE_TAG",MISMATCHED_CLOSE_TAG:"MISMATCHED_CLOSE_TAG",UNEXPECTED_TRAILING_DATA:"UNEXPECTED_TRAILING_DATA",INVALID_TAG:"INVALID_TAG",UNCLOSED_QUOTE:"UNCLOSED_QUOTE",MULTIPLE_NAMESPACES:"MULTIPLE_NAMESPACES",SECURITY_PROTOTYPE_POLLUTION:"SECURITY_PROTOTYPE_POLLUTION",SECURITY_RESERVED_OPTION:"SECURITY_RESERVED_OPTION",SECURITY_RESTRICTED_NAME:"SECURITY_RESTRICTED_NAME",LIMIT_MAX_NESTED_TAGS:"LIMIT_MAX_NESTED_TAGS",LIMIT_MAX_ATTRIBUTES:"LIMIT_MAX_ATTRIBUTES",ENTITY_MAX_COUNT:"ENTITY_MAX_COUNT",ENTITY_MAX_SIZE:"ENTITY_MAX_SIZE",ENTITY_MAX_EXPANSIONS:"ENTITY_MAX_EXPANSIONS",ENTITY_MAX_EXPANDED_LENGTH:"ENTITY_MAX_EXPANDED_LENGTH",ENTITY_INVALID_KEY:"ENTITY_INVALID_KEY",ENTITY_INVALID_VALUE:"ENTITY_INVALID_VALUE"});var Qt=":A-Za-z_\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD",Ls=Qt+"\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040",Rs="["+Qt+"]["+Ls+"]*",ks=new RegExp("^"+Rs+"$");var j=function(t){let e=ks.exec(t);return!(e===null||typeof e>"u")};var ne=["hasOwnProperty","toString","valueOf","__defineGetter__","__defineSetter__","__lookupGetter__","__lookupSetter__","toLocaleString","isPrototypeOf","propertyIsEnumerable"],Se=["__proto__","constructor","prototype"];var tr=t=>ne.includes(t)?"__"+t:t,Ms={skip:{declaration:!1,pi:!1,attributes:!0,cdata:!1,comment:!1,nsPrefix:!1,tags:[]},nameFor:{text:"#text",cdata:"",comment:""},attributes:{booleanType:!1,groupBy:"",prefix:"@_",suffix:""},tags:{unpaired:[],stopNodes:[]},strictReservedNames:!1,onDangerousProperty:tr,only:[],doctypeOptions:{enabled:!1,maxEntityCount:100,maxEntitySize:1e4},autoClose:null,limits:{maxNestedTags:null,maxAttributesPerTag:null},feedable:{maxBufferSize:10*1024*1024,autoFlush:!0,flushThreshold:1024},exitIf:null,OutputBuilder:null},vs=new Set([...Se,...ne]);function ie(t,e){if(!(typeof t!="string"||t==="")&&vs.has(t))throw new f(`SECURITY: '${t}' is a reserved JavaScript keyword and cannot be used as ${e}`,h.SECURITY_RESERVED_OPTION)}var rr=function(t){if(t&&(t.nameFor?.text&&ie(t.nameFor.text,"nameFor.text"),t.nameFor?.cdata&&ie(t.nameFor.cdata,"nameFor.cdata"),t.nameFor?.comment&&ie(t.nameFor.comment,"nameFor.comment"),t.attributes?.prefix&&ie(t.attributes.prefix,"attributes.prefix"),t.attributes?.groupBy&&ie(t.attributes.groupBy,"attributes.groupBy"),t.limits!==void 0&&t.limits!==null)){if(typeof t.limits!="object")throw new f(`'limits' must be an object, got ${typeof t.limits}`,h.INVALID_INPUT);let{maxNestedTags:r,maxAttributesPerTag:s}=t.limits;if(r!=null&&(typeof r!="number"||!Number.isInteger(r)||r<1))throw new f(`'limits.maxNestedTags' must be a positive integer, got ${r}`,h.INVALID_INPUT);if(s!=null&&(typeof s!="number"||!Number.isInteger(s)||s<0))throw new f(`'limits.maxAttributesPerTag' must be a non-negative integer, got ${s}`,h.INVALID_INPUT)}let e=ot(Ms);if(t&&sr(e,t),e.OutputBuilder||(e.OutputBuilder=new J),Array.isArray(e.tags?.stopNodes)){let r=new D;e.tags.stopNodes=e.tags.stopNodes.map(s=>er(s,"stopNodes",r)),r.seal(),e.tags.stopNodesSet=r}if(Array.isArray(e.skip?.tags)){let r=new D;e.skip.tags=e.skip.tags.map(s=>er(s,"skip.tags",r)),r.seal(),e.skip.tagsSet=r}if(e.onDangerousProperty===null&&(e.onDangerousProperty=tr),e.exitIf!==null&&e.exitIf!==void 0&&typeof e.exitIf!="function")throw new f(`'exitIf' must be a function, got ${typeof e.exitIf}`,h.INVALID_INPUT);return e.autoClose=Fs(e.autoClose,e),e},Us=["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"];function Fs(t,e){if(!t)return null;if(t==="html"){let r=e.tags.unpaired||[],s=[...new Set([...r,...Us])];return e.tags={...e.tags,unpaired:s},{onEof:"closeAll",onMismatch:"discard",collectErrors:!0}}return typeof t=="string"?{onEof:t,onMismatch:"throw",collectErrors:!1}:typeof t=="object"?{onEof:t.onEof||"throw",onMismatch:t.onMismatch||"throw",collectErrors:t.collectErrors||!1}:null}function er(t,e,r){let s,n,i;if(typeof t=="string"){if(t.length===0)throw new f(`${e} expression cannot be empty`,h.INVALID_INPUT);s=t,n=!1,i=[]}else if(t instanceof T)s=t.toString(),n=t.data?.nested??!1,i=t.data?.skipEnclosures??[];else if(t&&typeof t=="object"&&t.expression!==void 0){let a=t.expression;if(typeof a=="string"){if(a.length===0)throw new f(`${e} expression cannot be empty`,h.INVALID_INPUT);s=a}else if(a instanceof T)s=a.toString();else throw new f(`${e} expression must be a string or Expression instance`,h.INVALID_INPUT);n=t.nested===!0,i=Array.isArray(t.skipEnclosures)?t.skipEnclosures:[]}else throw new f(`Invalid ${e} entry: expected a string, Expression, or { expression, nested?, skipEnclosures? } object.`,h.INVALID_INPUT);let o=new T(s,{},{nested:n,skipEnclosures:i});return r.add(o),o}function ot(t){if(t===null||typeof t!="object")return t;if(Array.isArray(t))return t.map(ot);if(t instanceof RegExp||t instanceof T)return t;let e={};for(let r of Object.keys(t))e[r]=typeof t[r]=="function"?t[r]:ot(t[r]);return e}function sr(t,e){for(let r of Object.keys(e))r==="__proto__"||r==="constructor"||r==="prototype"||(r==="OutputBuilder"||typeof e[r]=="function"||e[r]instanceof RegExp||Array.isArray(e[r])?t[r]=e[r]:typeof e[r]=="object"&&e[r]!==null?((typeof t[r]!="object"||t[r]===null)&&(t[r]={}),sr(t[r],e[r])):t[r]=e[r])}var oe=class{constructor(e,r={}){this.line=1,this.cols=0,this.buffer=e,this.startIndex=0,this.autoFlush=r.autoFlush!==!1,this.flushThreshold=r.flushThreshold??1024,this._marks=[-1,-1]}markTokenStart(e=0){this._marks[e]=this.startIndex}rewindToMark(){}clearMark(){this._marks[0]=-1,this._marks[1]=-1}flush(){let e=this.startIndex;for(let r of this._marks)r>=0&&r<e&&(e=r);if(e>0){this.buffer=this.buffer.substring(e);let r=this._marks.length;for(let s=0;s<r;s++)this._marks[s]>=0&&(this._marks[s]-=e);this.startIndex-=e}}readCh(){return this.buffer[this.startIndex++]}readChAt(e){return this.buffer[this.startIndex+e]}readStr(e,r){return typeof r>"u"&&(r=this.startIndex),this.buffer.substring(r,r+e)}readUpto(e){let r=this.buffer.length,s=e.length;for(let n=this.startIndex;n<r;n++){let i=!0;for(let o=0;o<s;o++)if(this.buffer[n+o]!==e[o]){i=!1;break}if(i){let o=this.buffer.substring(this.startIndex,n);return this.startIndex=n+s,o}}throw new f(`Unexpected end of source reading '${e}'`,h.UNEXPECTED_END)}readUptoChar(e){let r=this.buffer.indexOf(e,this.startIndex);if(r===-1)throw new f(`Unexpected end of source reading '${e}'`,h.UNEXPECTED_END);let s=this.buffer.substring(this.startIndex,r);return this.startIndex=r+1,s}readUptoCloseTag(e){let r=this.buffer.length,s=e.length,n=-1,i=0;for(let o=this.startIndex;o<r;o++){if(i===1){let a=this.buffer[o];if(a===" "||a===" ")continue;a===">"?i=2:(i=0,n=-1)}else{let a=!0;for(let l=0;l<s;l++)if(this.buffer[o+l]!==e[l]){a=!1;break}a&&(i=1,n=o,o+=s-1)}if(i===2){let a=this.buffer.substring(this.startIndex,n);return this.startIndex=o+1,a}}throw new f(`Unexpected end of source reading '${e}'`,h.UNEXPECTED_END)}readFromBuffer(e,r){let s=e===1?this.buffer[this.startIndex]:this.buffer.substring(this.startIndex,this.startIndex+e);return r&&this.updateBufferBoundary(e),s}updateBufferBoundary(e=1){this.startIndex+=e;let r=this._marks[0]>=0||this._marks[1]>=0;this.autoFlush&&this.startIndex>=this.flushThreshold&&!r&&this.flush()}canRead(e){return e=e!==void 0?e:this.startIndex,this.buffer.length-e>0}};var nr={space:32,tab:9},ae=class{constructor(e,r={}){this.line=1,this.cols=0,this.buffer=e,this.startIndex=0,this.autoFlush=r.autoFlush!==!1,this.flushThreshold=r.flushThreshold??1024,this._tokenStart=-1}markTokenStart(){this._tokenStart=this.startIndex}rewindToMark(){}flush(){let e=this._tokenStart>=0?this._tokenStart:this.startIndex;e>0&&(this.buffer=Buffer.from(this.buffer.subarray(e)),this._tokenStart>=0?(this.startIndex-=e,this._tokenStart=0):this.startIndex=0)}readCh(){return String.fromCharCode(this.buffer[this.startIndex++])}readChAt(e){return String.fromCharCode(this.buffer[this.startIndex+e])}readStr(e,r){return typeof r>"u"&&(r=this.startIndex),this.buffer.slice(r,r+e).toString()}readUpto(e){let r=this.buffer.length,s=e.length,n=Buffer.from(e);for(let i=this.startIndex;i<r;i++){let o=!0;for(let a=0;a<s;a++)if(this.buffer[i+a]!==n[a]){o=!1;break}if(o){let a=this.buffer.slice(this.startIndex,i).toString();return this.startIndex=i+s,a}}throw new f(`Unexpected end of source reading '${e}'`,h.UNEXPECTED_END)}readUptoChar(e){let r=e.charCodeAt(0),s=this.buffer,n=s.length;for(let i=this.startIndex;i<n;i++)if(s[i]===r){let o=s.slice(this.startIndex,i).toString();return this.startIndex=i+1,o}throw new f(`Unexpected end of source reading '${e}'`,h.UNEXPECTED_END)}readUptoCloseTag(e){let r=this.buffer.length,s=e.length,n=Buffer.from(e),i=62,o=-1,a=0;for(let l=this.startIndex;l<r;l++){if(a===1){let c=this.buffer[l];if(c===nr.space||c===nr.tab)continue;c===i?a=2:(a=0,o=-1)}else{let c=!0;for(let u=0;u<s;u++)if(this.buffer[l+u]!==n[u]){c=!1;break}c&&(a=1,o=l,l+=s-1)}if(a===2){let c=this.buffer.slice(this.startIndex,o).toString();return this.startIndex=l+1,c}}throw new f(`Unexpected end of source reading '${e}'`,h.UNEXPECTED_END)}readFromBuffer(e,r){let s;return e===1?(s=this.buffer[this.startIndex],s===10?(this.line++,this.cols=1):this.cols++,s=String.fromCharCode(s)):(this.cols+=e,s=this.buffer.slice(this.startIndex,this.startIndex+e).toString()),r&&this.updateBufferBoundary(e),s}updateBufferBoundary(e=1){this.startIndex+=e,this.autoFlush&&this.startIndex>=this.flushThreshold&&this._tokenStart<0&&this.flush()}canRead(e){return e=e!==void 0?e:this.startIndex,this.buffer.length-e>0}};var ir=new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`,"gm");function or(t,e,r){if(!t||t.length===0)return;let s=ar(t,ir),n=s.length,i=0;for(let o=0;o<n;o++){if(e.processAttrName(s[o][1])===!1)continue;i++;let l=s[o][4];r.rawAttributes[s[o][1]]=l!==void 0?l:!0}r.rawAttributesLen=i}function le(t,e){if(!t||t.length===0)return;let r=ar(t,ir),s=r.length,n=e.options.limits?.maxAttributesPerTag;if(n!=null&&s>n){let i=e.currentTagDetail?.name??"(unknown)";throw new f(`Tag '${i}' has ${s} attributes, exceeding limit of ${n}`,h.LIMIT_MAX_ATTRIBUTES,{line:e.source.line,col:e.source.cols,index:e.source.startIndex})}for(let i=0;i<s;i++){let o=e.processAttrName(r[i][1]);if(o===!1)continue;let a=r[i][4],l=a!==void 0?a:!0;e.outputBuilder.addAttribute(o,l,e.readonlyMatcher)}}function ar(t,e){e.lastIndex=0;let r=[],s=e.exec(t);for(;s;){let n=[];n.startIndex=e.lastIndex-s[0].length;let i=s.length;for(let o=0;o<i;o++)n.push(s[o]);r.push(n),s=e.exec(t)}return r}function lr(t){t.markTokenStart(1);let e=0,r=t.startIndex;for(;t.canRead();)if(t.readCh()===">"){let i=t.readStr(e,r);return i?i.trimEnd():""}else e++;let s=t.readStr(e,r);throw t.updateBufferBoundary(e),new f(`Unexpected end of source reading closing tag '</${s}'`,h.UNEXPECTED_END)}function at(t){t.source.markTokenStart(1);let e=!1,r=!1,s,n=!1;for(s=0;t.source.canRead(s);s++){let o=t.source.readChAt(s);if(o==="'"&&!r)e=!e;else if(o==='"'&&!e)r=!r;else if(o===">"&&!e&&!r){n=!0;break}}if(n){if(e||r)throw new f("Invalid attribute expression. Quote is not properly closed",h.UNCLOSED_QUOTE)}else throw new f("Unexpected closing of source waiting for '>'",h.UNEXPECTED_END);let i=t.source.readStr(s);return t.source.updateBufferBoundary(s+1),ur(i,t)}function cr(t){t.source.markTokenStart(1);let e=!1,r=!1,s,n=!1;for(s=0;t.source.canRead(s);s++){let o=t.source.readChAt(s),a=t.source.readChAt(s+1);if(o==="'"&&!r?e=!e:o==='"'&&!e&&(r=!r),!e&&!r&&o==="?"&&a===">"){n=!0;break}}if(n){if(e||r)throw new f("Invalid attribute expression. Quote is not properly closed in PI tag expression",h.UNCLOSED_QUOTE)}else throw new f("Unexpected closing of source waiting for '?>'",h.UNEXPECTED_END);t.options.skip.attributes;let i=t.source.readStr(s);return t.source.updateBufferBoundary(s+2),ur(i,t)}function ur(t,e){let r={tagName:"",selfClosing:!1,rawAttributes:Object.create(null),_attrsExp:""},s=t.length;t[s-1]==="/"&&(r.selfClosing=!0,t=t.slice(0,-1));let n="",i=0;for(;i<s;i++)if(t[i]===" "){r.tagName=t.substring(0,i),n=t.substring(i+1);break}if(r.tagName.length===0&&i===s&&(r.tagName=t),r.tagName=r.tagName.trimEnd(),r._attrsExp=n,!j(r.tagName))throw new f("Invalid tag name",h.INVALID_TAG_NAME);return!e.options.skip.attributes&&n.length>0&&or(n,e,r),r}var ce=class{constructor(e,{nested:r=!1,skipEnclosures:s=[]}={}){this._tagName=e,this._nested=r,this._enclosures=s,this._content="",this._depth=1,this._active=!1}isActive(){return this._active}activate(){this._active=!0,this._content="",this._depth=1}resumeAfterOpenTag(){this._content="",this._depth=1}collect(e){e.markTokenStart(1);let r=this._enclosures.length;return!this._nested&&r===0?this._collectPlain(e):this._nested&&r===0?this._collectDepthOnly(e):!this._nested&&r>0?this._collectEnclosureOnly(e):this._collectFull(e)}_collectPlain(e){let r="</"+this._tagName;for(;e.canRead();){if(e.readChAt(0)!=="<"){this._content+=e.readCh();continue}if(this._peekMatch(e,r)){let n=r.length,i=!1;for(;;){let o=e.readChAt(n);if(o===">"){i=!0;break}if(o===" "||o===" "||o===`
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
`&&e!=="\r")break;t.updateBufferBoundary(1)}}function mr(t){if(j(t))return t;throw new f(`Invalid entity name "${t}"`,h.ENTITY_INVALID_KEY,{})}var ue=Object.freeze({UNCLOSED_EOF:"unclosed-eof",MISMATCHED_CLOSE:"mismatched-close",PHANTOM_CLOSE:"phantom-close",PARTIAL_TAG:"partial-tag"}),he=class{constructor(e){this.onEof=e.onEof||"throw",this.onMismatch=e.onMismatch||"throw",this.collectErrors=e.collectErrors||!1,this.errors=[]}handleEof(e){if(this.onEof==="throw")throw new f("Unexpected data in the end of document",h.UNEXPECTED_TRAILING_DATA);let{addTextNode:r,popTag:s}=e,n=e.currentTagDetail;for(;n&&!n.root;)this._recordError(ue.UNCLOSED_EOF,{tag:n.name,expected:null,line:n.line,col:n.col,index:n.index}),r(),s(),n=e.currentTagDetail}handleMismatch(e,r){let{tagsStack:s,currentTagDetail:n,source:i,addTextNode:o}=r;if(this.onMismatch==="throw")throw new f(`Unexpected closing tag '${e}' expecting '${n.name}'`,h.MISMATCHED_CLOSE_TAG,{line:i?i.line:void 0,col:i?i.cols:void 0,index:i?i.startIndex:void 0});if(this.onMismatch==="discard")return this._recordError(ue.MISMATCHED_CLOSE,{tag:e,expected:n.name,line:i?i.line:null,col:i?i.cols:null,index:i?i.startIndex:null}),{action:"discard"};let a=[...s,n],l=-1,c=a.length;for(let m=c-1;m>=0;m--)if(a[m].name===e){l=m;break}if(l===-1)return this._recordError(ue.PHANTOM_CLOSE,{tag:e,expected:n.name,line:i?i.line:null,col:i?i.cols:null,index:i?i.startIndex:null}),{action:"discard"};let u=c-1-l;for(let m=0;m<u;m++){let p=a[c-1-m];this._recordError(ue.MISMATCHED_CLOSE,{tag:p.name,expected:e,line:p.line,col:p.col,index:p.index}),o(),r.popTag()}return r.currentTagDetail=a[l],{action:"close-matched"}}handlePartialTag(e,r){this._recordError(ue.PARTIAL_TAG,{tag:Xs(e),expected:null,line:r.source?r.source.line:null,col:r.source?r.source.cols:null,index:r.source?r.source.startIndex:null}),r.tagTextData="",this.handleEof(r)}getErrors(){return this.errors.slice()}reset(){this.errors=[]}_recordError(e,r){this.collectErrors&&this.errors.push({type:e,...r})}};function Xs(t){if(!t)return null;let r=(typeof t.message=="string"?t.message:String(t)).match(/[Rr]eading closing tag '<\/([^']*)/);return r&&r[1]||null}var lt=class{constructor(e,r=0,s=0,n=0){this.name=e,this.line=r,this.col=s,this.index=n}},fe=class{constructor(e){this.options=e,this.currentTagDetail=null,this.tagTextData="",this.tagsStack=[],this.matcher=new P,this.readonlyMatcher=this.matcher.readOnly(),this.autoCloseHandler=e.autoClose?new he(e.autoClose):null,this._unpairedSet=new Set(this.options.tags.unpaired),this.stopNodeExpressionsSet=this.options.tags.stopNodesSet??new D,this.skipTagExpressionsSet=this.options.skip.tagsSet??new D,this._exitIf=typeof e.exitIf=="function"?e.exitIf:null}initializeParser(){this.tagTextData="",this.tagsStack=[],this._stopNodeProcessor=null,this._exitIfTriggered=!1,this.matcher||(this.matcher=new P,this.readonlyMatcher=this.matcher.readOnly()),this.outputBuilder=this._createOutputBuilder(),this.root={root:!0,name:""},this.currentTagDetail=this.root}_createOutputBuilder(){return this.options.OutputBuilder.getInstance(this.options,this.readonlyMatcher)}wasExited(){return this._exitIfTriggered===!0}parse(e){return this.source=new oe(e),this.initializeParser(),this._parseAndFinalize(),this.outputBuilder.getOutput()}parseBytesArr(e){return this.source=new ae(e),this.initializeParser(),this._parseAndFinalize(),this.outputBuilder.getOutput()}parseXml(){for(;this.source.canRead()&&!this._exitIfTriggered;){this.source.markTokenStart(0);let e=this.source.readCh();if(e===void 0||e==="")break;if(e==="<"){let r=this.source.readChAt(0);if(r==="")throw new f("Unexpected end of source after '<'",h.UNEXPECTED_END,{line:this.source.line,col:this.source.cols,index:this.source.startIndex});r==="!"||r==="?"?(this.source.updateBufferBoundary(),this.addTextNode(),this.readSpecialTag(r)):r==="/"?(this.source.updateBufferBoundary(),this.readClosingTag()):this.readOpeningTag()}else{let r=0;for(;;){let s=this.source.readChAt(r);if(s==="<"||s===void 0||s==="")break;r++}r>0?(this.tagTextData+=e+this.source.readStr(r,this.source.startIndex),this.source.updateBufferBoundary(r)):this.tagTextData+=e}}}finalizeXml(){if(this._exitIfTriggered)return;let e=this.tagsStack.length>0||this.currentTagDetail&&!this.currentTagDetail.root,r=!e&&this.tagTextData!==void 0&&this.tagTextData.trimEnd().length>0;if(e||r)if(this.autoCloseHandler&&e&&!r)this.autoCloseHandler.handleEof(this._parserState());else throw new f("Unexpected data in the end of document",h.UNEXPECTED_TRAILING_DATA)}_parseAndFinalize(){let e=null;this.autoCloseHandler&&this.autoCloseHandler.reset();try{this.parseXml()}catch(r){if(this.autoCloseHandler&&Gs(r))e=r;else throw r}if(e){this.autoCloseHandler.handlePartialTag(e,this._parserState());return}this.finalizeXml()}readClosingTag(){let e=this.processTagName(lr(this.source));if(this.isUnpaired(e)||this.isStopNode())throw new f(`Unexpected closing tag '${e}'`,h.UNEXPECTED_CLOSE_TAG,{line:this.source.line,col:this.source.cols,index:this.source.startIndex});if(e!==this.currentTagDetail.name){if(!this.autoCloseHandler)throw new f(`Unexpected closing tag '${e}' expecting '${this.currentTagDetail.name}'`,h.MISMATCHED_CLOSE_TAG,{line:this.source.line,col:this.source.cols,index:this.source.startIndex});if(this.autoCloseHandler.handleMismatch(e,this._parserState()).action==="discard")return}this.currentTagDetail.root||this.addTextNode(),this.popTag()}readOpeningTag(){let e=this.options;if(this.addTextNode(),this._stopNodeProcessor&&this._stopNodeProcessor.isActive()){let{tagDetail:u,isSkip:m}=this._stopNodeProcessorMeta;this._stopNodeProcessor.resumeAfterOpenTag(),at(this);let p=this._stopNodeProcessor.collect(this.source);m||(this.outputBuilder.addElement(u,this.readonlyMatcher),this.outputBuilder.onStopNode?.(u,p,this.readonlyMatcher),this.outputBuilder.addValue(p,this.readonlyMatcher),this.outputBuilder.closeElement(this.readonlyMatcher)),this.matcher.pop(),this._stopNodeProcessor=null,this._stopNodeProcessorMeta=null;return}let r=at(this),s=this.processTagName(r.tagName),n=new lt(s,this.source.line,this.source.cols,this.source.startIndex),i=e.limits?.maxNestedTags;if(i!=null){let u=this.tagsStack.length+1;if(u>i)throw new f(`Nesting depth ${u} exceeds limit of ${i} (tag: '${s}')`,h.LIMIT_MAX_NESTED_TAGS,{line:n.line,col:n.col,index:n.index})}let o={},a=0;r.rawAttributes&&(o=r.rawAttributes,a=r.rawAttributesLen),this.matcher.push(s,{}),a>0&&this.matcher.updateCurrent(o);let l=this.isStopNode(),c=l?null:this.isSkipTag();if(!e.skip.attributes&&!c&&le(r._attrsExp,this),this.isUnpaired(s))this.outputBuilder.addElement(n,this.readonlyMatcher),this.outputBuilder.closeElement(this.readonlyMatcher),this.matcher.pop();else if(r.selfClosing)c||(this.outputBuilder.addElement(n,this.readonlyMatcher),this.outputBuilder.closeElement(this.readonlyMatcher)),this.matcher.pop();else if(l){this._stopNodeProcessor=new ce(s,{nested:l.nested,skipEnclosures:l.skipEnclosures}),this._stopNodeProcessorMeta={tagDetail:n,isSkip:!1},this._stopNodeProcessor.activate();let u=this._stopNodeProcessor.collect(this.source);this.outputBuilder.addElement(n,this.readonlyMatcher),this.outputBuilder.onStopNode?.(n,u,this.readonlyMatcher),this.outputBuilder.addValue(u,this.readonlyMatcher),this.outputBuilder.closeElement(this.readonlyMatcher),this.matcher.pop(),this._stopNodeProcessor=null,this._stopNodeProcessorMeta=null}else if(c)this._stopNodeProcessor=new ce(s,{nested:c.nested,skipEnclosures:c.skipEnclosures}),this._stopNodeProcessorMeta={tagDetail:n,isSkip:!0},this._stopNodeProcessor.activate(),this._stopNodeProcessor.collect(this.source),this.matcher.pop(),this._stopNodeProcessor=null,this._stopNodeProcessorMeta=null;else if(this._exitIf&&this._exitIf(this.readonlyMatcher)){let u=this.tagsStack.length;for(this.matcher.pop();this.currentTagDetail&&!this.currentTagDetail.root;)this.addTextNode(),this.popTag();typeof this.outputBuilder.onExit=="function"&&this.outputBuilder.onExit({tagDetail:n,matcher:this.readonlyMatcher,depth:u}),this._exitIfTriggered=!0}else this.pushTag(n)}pushTag(e){this.tagsStack.push(this.currentTagDetail),this.outputBuilder.addElement(e,this.readonlyMatcher),this.currentTagDetail=e}popTag(){this.outputBuilder.closeElement(this.readonlyMatcher),this.matcher.pop(),this.currentTagDetail=this.tagsStack.pop()}readSpecialTag(e){if(e==="!"){let r=this.source.readCh();if(r==null)throw new f("Unexpected end of source after '<!'",h.UNEXPECTED_END,{line:this.source.line,col:this.source.cols,index:this.source.startIndex});if(r==="-")dr(this);else if(r==="[")hr(this);else if(r==="D"){let s=pr(this);this.options.doctypeOptions.enabled&&s&&Object.keys(s).length>0&&this.outputBuilder.addInputEntities(s)}}else if(e==="?")fr(this);else throw new f(`Invalid tag '<${e}'`,h.INVALID_TAG,{line:this.source.line,col:this.source.cols,index:this.source.startIndex})}addTextNode(){this.tagTextData!==void 0&&this.tagTextData!==""&&(this.tagTextData.trim().length>0&&this.outputBuilder.addValue(this.tagTextData,this.readonlyMatcher),this.tagTextData="")}processAttrName(e){let r=this.options;if(e=gr(e,r.skip.nsPrefix),!j(e))throw new f(`Invalid attribute name: ${e}`,h.INVALID_ATTRIBUTE_NAME);if(e=Er(e,r.onDangerousProperty),r.strictReservedNames&&e===r.attributes.groupBy)throw new f(`Restricted attribute name: ${e}`,h.SECURITY_RESTRICTED_NAME);return e}processTagName(e){let r=this.options,s=r.nameFor;if(e=gr(e,r.skip.nsPrefix),e=Er(e,r.onDangerousProperty),r.strictReservedNames&&(e===s.comment||e===s.cdata||e===s.text))throw new f(`Restricted tag name: ${e}`,h.SECURITY_RESTRICTED_NAME);return e}isUnpaired(e){return this._unpairedSet.has(e)}isStopNode(){if(this.stopNodeExpressionsSet.size===0)return null;let e=this.stopNodeExpressionsSet.findMatch(this.matcher);return e?e.data:null}isSkipTag(){if(this.skipTagExpressionsSet.size===0)return null;let e=this.skipTagExpressionsSet.findMatch(this.matcher);return e?e.data:null}_parserState(){let e=this;return{get tagsStack(){return e.tagsStack},get currentTagDetail(){return e.currentTagDetail},set currentTagDetail(r){e.currentTagDetail=r},get outputBuilder(){return e.outputBuilder},get readonlyMatcher(){return e.readonlyMatcher},get matcher(){return e.matcher},get source(){return e.source},get tagTextData(){return e.tagTextData},set tagTextData(r){e.tagTextData=r},addTextNode:e.addTextNode.bind(e),popTag:e.popTag.bind(e)}}};function gr(t,e){if(e){let r=t.split(":");if(r.length===2)return r[0]==="xmlns"?!1:r[1];if(r.length>2)throw new f(`Multiple namespaces in name: ${t}`,h.MULTIPLE_NAMESPACES)}return t}function Er(t,e){if(Se.includes(t))throw new f(`[SECURITY] Invalid name: "${t}" is a reserved JavaScript keyword that could cause prototype pollution`,h.SECURITY_PROTOTYPE_POLLUTION);return ne.includes(t)?e(t):t}function Gs(t){return t instanceof f?t.code===h.UNEXPECTED_END:t.message.startsWith("Unexpected end of source")||t.message.startsWith("Unexpected closing of source")}var X=class{constructor(e={}){this.line=1,this.cols=0,this.buffer="",this.startIndex=0,this.isComplete=!1,this.maxBufferSize=e.maxBufferSize||10*1024*1024,this.autoFlush=e.autoFlush!==!1,this.flushThreshold=e.flushThreshold||1024,this._marks=[-1,-1]}feed(e){let r=typeof e=="string"?e:e.toString(),s=this.buffer.length-this.startIndex;if(s+r.length>this.maxBufferSize)throw new f(`Buffer size limit exceeded (${s+r.length} > ${this.maxBufferSize}). Increase feedable.maxBufferSize or reduce chunk size.`,h.INVALID_INPUT);this.buffer+=r}end(){this.isComplete=!0}canRead(e=0){return this.startIndex+e<this.buffer.length}markTokenStart(e=0){this._marks[e]=this.startIndex}rewindToMark(){this._marks[0]>=0&&(this.startIndex=this._marks[0]),this._marks[0]=-1,this._marks[1]=-1}clearMark(){this._marks[0]=-1,this._marks[1]=-1}readCh(){let e=this.buffer[this.startIndex++];return e===`
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
`}]:o.flatMap(a=>Re(a)?s(a):Me(a)?i(a):{[L]:a}),s=o=>{let a=`${`
|
|
18
|
-
`
|
|
19
|
-
`;mn();try{(0,Ue.appendFileSync)(gn(),n)}catch{}fn&&process.stderr.write(n)}function me(t,e,r){t<Pr||En(t,String(un(e)),r)}var v={trace(t,e){me(M.trace,t,e)},debug(t,e){me(M.debug,t,e)},info(t,e){me(M.info,t,e)},warn(t,e){me(M.warn,t,e)},error(t,e){me(M.error,t,e)}};var _n=Dr(Lr.trace);function Q(t){return function(e,r,s){if(!_n)return;let n=s.value;s.value=function(...i){v.trace(Z`${t}.${r}: entry`);let o=()=>n.call(this,...i);if(n.constructor.name==="AsyncFunction")return o().then(a=>(v.trace(Z`${t}.${r}: exit`),a),a=>{throw v.trace(Z`${t}.${r}: exit (error)`),a});try{let a=o();return v.trace(Z`${t}.${r}: exit`),a}catch(a){throw v.trace(Z`${t}.${r}: exit (error)`),a}}}}var C=t=>Array.isArray(t)?{}:t;var yn=[],xn={output:yn,hasConflict:!1},I=t=>{if(t.length===1)return t[0];let e=[],r=!1;for(let s of t)k(e,s.output),r=r||s.hasConflict;return{output:e,hasConflict:r}},E=t=>t.length===0?xn:{output:t,hasConflict:!1},N=t=>({output:t,hasConflict:!0});var ge=(t,e)=>t.output.length>0?{output:[{[e]:t.output}],hasConflict:t.hasConflict}:E([{[e]:[]}]),Ee=(t,e)=>{let r=t==null?[]:Array.isArray(t)?t:[t];return E(e?[{[e]:r}]:r)};var y;(function(t){t[t.NONE=0]="NONE",t[t.OTHER_ONLY=1]="OTHER_ONLY",t[t.LOCAL_ONLY=2]="LOCAL_ONLY",t[t.LOCAL_AND_OTHER=3]="LOCAL_AND_OTHER",t[t.ANCESTOR_ONLY=4]="ANCESTOR_ONLY",t[t.ANCESTOR_AND_OTHER=5]="ANCESTOR_AND_OTHER",t[t.ANCESTOR_AND_LOCAL=6]="ANCESTOR_AND_LOCAL",t[t.ALL=7]="ALL"})(y||(y={}));var _t=t=>t==null?!1:typeof t=="string"||Array.isArray(t)?t.length>0:typeof t=="object"?Object.keys(t).length>0:!0,$e=(t,e,r)=>{let s=y.NONE;return _t(t)&&(s|=y.ANCESTOR_ONLY),_t(e)&&(s|=y.LOCAL_ONLY),_t(r)&&(s|=y.OTHER_ONLY),s};var _e=class{static getKeyFieldExtractor(e){return e in kr?kr[e]:void 0}static isOrderedAttribute(e){return Tn.has(e)}},Tn=new Set(["customValue","standardValue","value","values","filterItems","summaryFilterItems"]),d=(t,e)=>String(t[e]),yt=t=>{let e=d(t,"field"),r=d(t,"operation"),s=d(t,"value"),n=d(t,"valueField");return[e,r,s,n].filter(i=>i!==String(void 0)).join(".")},kr={labels:t=>d(t,"fullName"),applicationVisibilities:t=>d(t,"application"),categoryGroupVisibilities:t=>d(t,"dataCategoryGroup"),classAccesses:t=>d(t,"apexClass"),customMetadataTypeAccesses:t=>d(t,"name"),customPermissions:t=>d(t,"name"),customSettingAccesses:t=>d(t,"name"),externalDataSourceAccesses:t=>d(t,"externalDataSource"),fieldPermissions:t=>d(t,"field"),flowAccesses:t=>d(t,"flow"),layoutAssignments:t=>{let e=d(t,"layout"),r=d(t,"recordType");return[e,r].filter(s=>s!==String(void 0)).join(".")},loginFlows:t=>d(t,"friendlyname"),loginHours:t=>typeof t=="object"&&t!==null?Object.keys(t).join(","):"",loginIpRanges:t=>{let e=d(t,"startAddress"),r=d(t,"endAddress");return`${e}-${r}`},objectPermissions:t=>d(t,"object"),pageAccesses:t=>d(t,"apexPage"),profileActionOverrides:t=>d(t,"actionName"),recordTypeVisibilities:t=>d(t,"recordType"),tabVisibilities:t=>d(t,"tab"),userPermissions:t=>d(t,"name"),dataspaceScopes:t=>d(t,"dataspaceScope"),emailRoutingAddressAccesses:t=>d(t,"name"),externalCredentialPrincipalAccesses:t=>d(t,"externalCredentialPrincipal"),sharingCriteriaRules:t=>d(t,"fullName"),sharingGuestRules:t=>d(t,"fullName"),sharingOwnerRules:t=>d(t,"fullName"),sharingTerritoryRules:t=>d(t,"fullName"),criteriaItems:yt,filterItems:yt,summaryFilterItems:yt,valueSettings:t=>d(t,"valueName"),alerts:t=>d(t,"fullName"),recipients:t=>d(t,"type"),fieldUpdates:t=>d(t,"fullName"),flowActions:t=>d(t,"fullName"),flowInputs:t=>d(t,"name"),flowAutomation:t=>d(t,"fullName"),knowledgePublishes:t=>d(t,"fullName"),outboundMessages:t=>d(t,"fullName"),rules:t=>d(t,"fullName"),actions:t=>d(t,"name"),send:t=>d(t,"fullName"),tasks:t=>d(t,"fullName"),assignmentRule:t=>d(t,"fullName"),autoResponseRule:t=>d(t,"fullName"),escalationRule:t=>d(t,"fullName"),marketingAppExtActions:t=>d(t,"apiName"),marketingAppExtActivities:t=>d(t,"fullName"),matchingRules:t=>d(t,"fullName"),matchingRuleItems:t=>{let e=d(t,"fieldName"),r=d(t,"matchingMethod");return`${e}-${r}`},customValue:t=>d(t,"fullName"),standardValue:t=>d(t,"fullName"),valueTranslation:t=>d(t,"masterLabel"),botBlocks:t=>d(t,"fullName"),botBlockVersions:t=>d(t,"fullName"),botDialogs:t=>d(t,"developerName"),botSteps:t=>d(t,"stepIdentifier"),botMessages:t=>d(t,"messageIdentifier"),botVariableOperation:t=>d(t,"variableOperationIdentifier"),botTemplates:t=>d(t,"fullName"),bots:t=>d(t,"fullName"),botVersions:t=>d(t,"fullName"),conversationMessageDefinitions:t=>d(t,"name"),constantValueTranslations:t=>d(t,"name"),customApplications:t=>d(t,"name"),customLabels:t=>d(t,"name"),customPageWebLinks:t=>d(t,"name"),customTabs:t=>d(t,"name"),desFieldTemplateMessages:t=>d(t,"name"),flowDefinitions:t=>d(t,"fullName"),flows:t=>d(t,"fullName"),identityVerificationCustomFieldLabels:t=>d(t,"name"),pipelineInspMetricConfigs:t=>d(t,"name"),prompts:t=>d(t,"name"),promptVersions:t=>d(t,"name"),quickActions:t=>d(t,"name"),reportTypes:t=>d(t,"name"),sections:t=>{let e=d(t,"name"),r=d(t,"section");return[e,r].filter(s=>s!==String(void 0))[0]},columns:t=>d(t,"name"),scontrols:t=>d(t,"name"),caseValues:t=>{let e=d(t,"article"),r=d(t,"caseType"),s=d(t,"plural"),n=d(t,"possessive");return[e,r,s,n].filter(i=>i!==String(void 0)).join(".")},fieldSets:t=>d(t,"name"),fields:t=>d(t,"name"),picklistValues:t=>d(t,"masterLabel"),values:t=>d(t,"fullName"),value:t=>d(t,"fullName"),layouts:t=>d(t,"layout"),quickActionParametersTranslation:t=>d(t,"name"),recordTypes:t=>d(t,"name"),sharingReasons:t=>d(t,"name"),standardFields:t=>d(t,"name"),validationRules:t=>d(t,"name"),webLinks:t=>d(t,"name"),workflowTasks:t=>d(t,"name"),types:t=>d(t,"name")};var xt=t=>Array.isArray(t)?t.length===0:Object.keys(t).length===0,A=(t,e,r)=>{let s=xt(t)?{}:t,n=xt(e)?{}:e,i=xt(r)?{}:r;return br(s,n,i)};var Ve=(t,e)=>{let r=new Map;for(let s of t){let n=e(s);r.set(n,s)}return r},Mr=(t,e,r,s)=>{let n=new Set,i=new Map,o=new Map,a=new Map,l=(c,u)=>{for(let m of c){let p=m,g=s(p);u.set(g,p),n.add(g)}};return l(t,i),l(e,o),l(r,a),{keyedAncestor:i,keyedLocal:o,keyedOther:a,allKeys:n}};function S(t,e){let r=[[t,e]];for(;r.length>0;){let[s,n]=r.pop();if(s===n)continue;if(s===null||n===null||typeof s!="object"||typeof n!="object")return!1;if(Array.isArray(s)){if(!Array.isArray(n)||s.length!==n.length)return!1;for(let l=s.length-1;l>=0;l--)r.push([s[l],n[l]]);continue}if(Array.isArray(n))return!1;let i=s,o=n,a=Object.keys(i);if(a.length!==Object.keys(o).length)return!1;for(let l of a){if(!(l in o))return!1;r.push([i[l],o[l]])}}return!0}var vr=(t,e)=>{if(t.size!==e.size)return!1;for(let r of t)if(!e.has(r))return!1;return!0},Tt=(t,e)=>{for(let r of t)if(e.has(r))return!0;return!1};var Nn=(t,e,r)=>{let s=new Set(t),n=new Set(e),i=new Set(r);return{localDeleted:new Set(t.filter(o=>!n.has(o))),otherDeleted:new Set(t.filter(o=>!i.has(o))),localAdded:new Set(e.filter(o=>!s.has(o))),otherAdded:new Set(r.filter(o=>!s.has(o))),allKeys:new Set([...t,...e,...r])}},Be=class{ancestor;local;other;attribute;keyField;constructor(e,r,s,n,i){this.ancestor=e,this.local=r,this.other=s,this.attribute=n,this.keyField=i}merge(e){let r=this.buildArrayMergeState(),s=this.analyzeOrderings(r);return s.canMerge?s.localMoved.size>0||s.otherMoved.size>0?this.processDivergedOrderings(e,r,s):this.processWithSpine(e,r):this.buildFullArrayConflict(e,r)}buildArrayMergeState(){let e=this.ancestor.map(n=>this.keyField(n)),r=this.local.map(n=>this.keyField(n)),s=this.other.map(n=>this.keyField(n));return{ancestorKeys:e,localKeys:r,otherKeys:s,ancestorMap:Ve(this.ancestor,this.keyField),localMap:Ve(this.local,this.keyField),otherMap:Ve(this.other,this.keyField),ancestorPos:new Map(e.map((n,i)=>[n,i])),localPos:new Map(r.map((n,i)=>[n,i])),otherPos:new Map(s.map((n,i)=>[n,i])),ancestorSet:new Set(e)}}analyzeOrderings(e){if(Ar(e.localKeys,e.otherKeys))return{canMerge:!0,localMoved:new Set,otherMoved:new Set};let r=this.getMovedElements(e,e.localPos),s=this.getMovedElements(e,e.otherPos);return Tt(r,s)?{canMerge:!1,localMoved:r,otherMoved:s}:r.size===0&&s.size===0?{canMerge:!1,localMoved:r,otherMoved:s}:{canMerge:!0,localMoved:r,otherMoved:s}}getMovedElements(e,r){let s=new Set;for(let n=0;n<e.ancestorKeys.length;n++){let i=e.ancestorKeys[n],o=r.get(i);if(o!==void 0)for(let a=n+1;a<e.ancestorKeys.length;a++){let l=e.ancestorKeys[a],c=r.get(l);c!==void 0&&o>c&&(s.add(i),s.add(l))}}return s}processDivergedOrderings(e,r,s){let n=this.computeMergedKeyOrder(r,s);return n===null?this.buildFullArrayConflict(e,r):this.processKeyOrder(e,r,n)}computeMergedKeyOrder(e,r){let{localMoved:s,otherMoved:n}=r,i=e.localKeys.filter(p=>s.has(p)),o=e.otherKeys.filter(p=>n.has(p)),a=e.localKeys.filter(p=>!s.has(p)&&!e.ancestorSet.has(p)),l=e.otherKeys.filter(p=>!n.has(p)&&!e.ancestorSet.has(p)&&!e.localMap.has(p));if(a.length>0&&l.length>0)return null;let c=[],u=!1,m=!1;for(let p of e.ancestorKeys)s.has(p)?u||(k(c,i),u=!0):n.has(p)?m||(k(c,o),m=!0):c.push(p);return k(c,a,l),c}processWithSpine(e,r){let s=ke(ke(r.ancestorKeys,r.localKeys),ke(r.ancestorKeys,r.otherKeys));return this.processSpine(e,s,r)}processKeyOrder(e,r,s){let n=[];for(let i of s){let o=this.mergeElementWithPresenceCheck(e,i,r);o&&o.output.length>0&&n.push(o)}return I(n)}mergeElementWithPresenceCheck(e,r,s){let n=s.ancestorMap.has(r),i=s.localMap.has(r),o=s.otherMap.has(r);return n&&i&&o?this.mergeElement(e,r,s):this.mergeGapElement(e,r,s)}wrapKeys(e,r){return e.map(s=>({[this.attribute]:r.get(s)}))}buildFullArrayConflict(e,r){return N([A(this.wrapKeys(r.localKeys,r.localMap),this.wrapKeys(r.ancestorKeys,r.ancestorMap),this.wrapKeys(r.otherKeys,r.otherMap))])}processSpine(e,r,s){let n=[],i=0,o=0,a=0;for(let c of r){let u=s.ancestorPos.get(c),m=s.localPos.get(c),p=s.otherPos.get(c),g={ancestor:s.ancestorKeys.slice(i,u),local:s.localKeys.slice(o,m),other:s.otherKeys.slice(a,p)};n.push(this.mergeGap(e,g,s)),n.push(this.mergeElement(e,c,s)),i=u+1,o=m+1,a=p+1}let l={ancestor:s.ancestorKeys.slice(i),local:s.localKeys.slice(o),other:s.otherKeys.slice(a)};return n.push(this.mergeGap(e,l,s)),I(n)}mergeGap(e,r,s){let n=Nn(r.ancestor,r.local,r.other),i=this.detectGapConflict(e,r,n,s);return i||this.mergeGapElements(e,n,s)}detectGapConflict(e,r,s,n){let{localDeleted:i,otherDeleted:o,localAdded:a,otherAdded:l}=s,c=i.size>0&&o.size>0&&!vr(i,o),u=a.size>0&&l.size>0&&!Tt(a,l);return c||u?this.buildGapConflict(e,r,n):null}buildGapConflict(e,r,s){return N([A(this.wrapKeys(r.local,s.localMap),this.wrapKeys(r.ancestor,s.ancestorMap),this.wrapKeys(r.other,s.otherMap))])}mergeGapElements(e,r,s){let n=[];for(let i of r.allKeys){let o=this.mergeGapElement(e,i,s);o&&n.push(o)}return I(n)}mergeGapElement(e,r,s){let n=s.ancestorMap.get(r),i=s.localMap.get(r),o=s.otherMap.get(r);return n!==void 0?i===void 0?o===void 0||S(n,o)?null:this.buildElementConflict(e,null,n,o):S(n,i)?null:this.buildElementConflict(e,i,n,null):i!==void 0&&o!==void 0?S(i,o)?E([this.wrapElement(i)]):this.buildElementConflict(e,i,null,o):E([this.wrapElement(i??o)])}wrapElement(e){return{[this.attribute]:e}}mergeElement(e,r,s){let n=s.ancestorMap.get(r),i=s.localMap.get(r),o=s.otherMap.get(r);return S(n,o)&&i?E([this.wrapElement(i)]):S(n,i)&&o?E([this.wrapElement(o)]):S(i,o)?E([this.wrapElement(i)]):this.buildElementConflict(e,i,n,o)}buildElementConflict(e,r,s,n){let i=o=>o?this.wrapElement(o):{};return N([A(i(r),i(s),i(n))])}};var Nt=class{ancestor;local;other;attribute;constructor(e,r,s,n){this.ancestor=e,this.local=r,this.other=s,this.attribute=n}merge(e){return N([A({[this.attribute]:this.local},{[this.attribute]:this.ancestor},{[this.attribute]:this.other})])}},wt=class{ancestor;local;other;attribute;keyField;constructor(e,r,s,n,i){this.ancestor=e,this.local=r,this.other=s,this.attribute=n,this.keyField=i}merge(e){let{keyedAncestor:r,keyedLocal:s,keyedOther:n,allKeys:i}=Mr(this.ancestor,this.local,this.other,this.keyField),o=[],a=new U(e,$);for(let l of Array.from(i).sort()){let c=a.merge(r.get(l)??{},s.get(l)??{},n.get(l)??{},this.attribute);c.output.length>0&&o.push({output:[{[this.attribute]:c.output}],hasConflict:c.hasConflict})}return I(o)}},je=class{ancestor;local;other;attribute;keyField;isOrdered;constructor(e,r,s,n,i,o){this.ancestor=e,this.local=r,this.other=s,this.attribute=n,this.keyField=i,this.isOrdered=o}merge(e){return this.keyField?(this.isOrdered?new Be(this.ancestor,this.local,this.other,this.attribute,this.keyField):new wt(this.ancestor,this.local,this.other,this.attribute,this.keyField)).merge(e):new Nt(this.ancestor,this.local,this.other,this.attribute).merge(e)}};var ee=(...t)=>{let e=new Set;for(let r of t)if(r!=null)for(let s of Object.keys(r))e.add(s);return[...e].sort()};var Xe=class{ancestor;local;other;attribute;constructor(e,r,s,n){this.ancestor=e,this.local=r,this.other=s,this.attribute=n}merge(e){let r=C(this.ancestor),s=C(this.local),n=C(this.other),i=ee(this.ancestor,this.local,this.other),o=[];for(let l of i){let u=$.createNode(r[l],s[l],n[l],l).merge(e);o.push(u)}let a=I(o);return a.output.length===0?E([]):ge(a,this.attribute)}};var wn=(t,e)=>String(t).localeCompare(String(e)),Ge=class{ancestor;local;other;attribute;constructor(e,r,s,n){this.ancestor=e,this.local=r,this.other=s,this.attribute=n}merge(e){let r=new Set(this.local),s=new Set(this.other),n=new Set(this.ancestor),i=new Set;for(let a of this.ancestor)r.has(a)&&s.has(a)&&i.add(a);for(let a of this.local)n.has(a)||i.add(a);for(let a of this.other)n.has(a)||i.add(a);let o=[...i].sort(wn).map(a=>a==null?{}:{[this.attribute]:a});return E(o)}};var bt=class{handle({objOther:e}){return E([e])}},At=class{handle({objLocal:e}){return E([e])}},Ct=class{handle({objLocal:e,objOther:r,local:s,other:n}){return s===n?E([e]):N([A(e,{},r)])}},It=class{handle({objAncestor:e,objOther:r,ancestor:s,other:n}){return s!==n?N([A({},e,r)]):E([])}},St=class{handle({objAncestor:e,objLocal:r,ancestor:s,local:n}){return s!==n?N([A(r,e,{})]):E([])}},Ot=class{handle({objAncestor:e,objLocal:r,objOther:s,ancestor:n,local:i,other:o}){return n===i?E([s]):n===o?E([r]):i===o?E([r]):N([A(r,e,s)])}},Pt=class{handle(){return E([])}},Dt=class{handle(){return E([])}},bn={[y.NONE]:new Dt,[y.OTHER_ONLY]:new bt,[y.LOCAL_ONLY]:new At,[y.LOCAL_AND_OTHER]:new Ct,[y.ANCESTOR_AND_OTHER]:new It,[y.ANCESTOR_AND_LOCAL]:new St,[y.ALL]:new Ot,[y.ANCESTOR_ONLY]:new Pt},Ur=t=>bn[t];var Lt=(t,e)=>t==null?{}:{[e]:t},Ye=class{ancestor;local;other;attribute;constructor(e,r,s,n){this.ancestor=e,this.local=r,this.other=s,this.attribute=n}merge(e){let r=Lt(this.ancestor,this.attribute),s=Lt(this.local,this.attribute),n=Lt(this.other,this.attribute),i=$e(r,s,n);return Ur(i).handle({config:e,objAncestor:r,objLocal:s,objOther:n,ancestor:this.ancestor,local:this.local,other:this.other})}};var Fr=t=>t==null?[]:Array.isArray(t)?t:[t],$r=t=>typeof t=="object"&&t!==null,An=(...t)=>t.some($r),Cn=(...t)=>t.some(e=>Array.isArray(e)&&e.every(r=>typeof r=="string")),In=t=>$r(t)&&!Array.isArray(t),Sn=(t,e)=>{let r=t.some(In),s=t.some(Array.isArray);return!e&&r&&!s},Rt=class{createNode(e,r,s,n){if(Cn(e,r,s)){let[o,a,l]=[e,r,s].map(Fr);return new Ge(o,a,l,n)}let i=_e.getKeyFieldExtractor(n);if(Sn([e,r,s],i!==void 0))return new Xe(e,r,s,n);if(An(e,r,s)){let[o,a,l]=[e,r,s].map(Fr);return new je(o,a,l,n,i,_e.isOrderedAttribute(n))}return new Ye(e,r,s,n)}},$=new Rt;var Ke=class{mergeChildren(e,r){let s=e.local,n=e.other,i=C(s),o=C(n),a=r===void 0?void 0:C(r),l=ee(r??{},s,n),c=[];for(let m of l){let g=e.nodeFactory.createNode(a===void 0?void 0:a[m],i[m],o[m],m).merge(e.config);c.push(g)}let u=I(c);return e.rootKey?ge(u,e.rootKey.name):u}},ze=class{execute(e){let r=this.getTarget(e),s=S(e.ancestor,r);return e.rootKey?this.executeWithRootKey(e,e.rootKey,r,s):this.executeWithoutRootKey(e,r,s)}executeWithRootKey(e,r,s,n){let{name:i}=r,o=this.getExistsInSecondary(r);if(!o&&n)return E([]);if(!o){let a={[i]:s},l={[i]:e.ancestor};return N(this.buildConflict(e,a,l))}return ge(this.executeNested(e),i)}executeWithoutRootKey(e,r,s){return s?E([]):e.attribute?this.executeWithAttribute(e,e.attribute):N(this.buildConflict(e,r,e.ancestor))}executeNested(e){return new U(e.config,e.nodeFactory).merge(e.ancestor,e.local,e.other)}executeWithAttribute(e,r){let s=new U(e.config,e.nodeFactory),n=this.mergeTarget(s,e),i=s.merge({},e.ancestor,{},void 0),o={[r]:n.output},a={[r]:i.output};return N(this.buildConflict(e,o,a))}},kt=class{execute(e){return E([])}},Mt=class{execute(e){return Ee(e.other,e.rootKey?.name)}},vt=class{execute(e){return Ee(e.local,e.rootKey?.name)}},Ut=class extends Ke{execute(e){let r=e.local,s=e.other;return S(r,s)?Ee(r,e.rootKey?.name):this.mergeChildren(e,void 0)}},Ft=class{execute(e){if(e.rootKey){let{name:r,existsInLocal:s,existsInOther:n}=e.rootKey;return s||n?E([{[r]:[]}]):E([])}return E([])}},$t=class extends ze{getTarget(e){return e.local}getExistsInSecondary(e){return e.existsInOther}buildConflict(e,r,s){return[A(r,s,{})]}mergeTarget(e,r){return e.merge({},r.local,{},void 0)}},Vt=class extends ze{getTarget(e){return e.other}getExistsInSecondary(e){return e.existsInLocal}buildConflict(e,r,s){return[A({},s,r)]}mergeTarget(e,r){return e.merge({},{},r.other,void 0)}},Bt=class extends Ke{execute(e){return S(e.ancestor,e.local)&&S(e.local,e.other)?Ee(e.local,e.rootKey?.name):this.mergeChildren(e,e.ancestor)}},On={[y.ALL]:new Bt,[y.ANCESTOR_AND_LOCAL]:new $t,[y.ANCESTOR_AND_OTHER]:new Vt,[y.ANCESTOR_ONLY]:new Ft,[y.LOCAL_AND_OTHER]:new Ut,[y.LOCAL_ONLY]:new vt,[y.NONE]:new kt,[y.OTHER_ONLY]:new Mt},Vr=t=>On[t];var U=class{config;nodeFactory;constructor(e,r=$){this.config=e,this.nodeFactory=r}merge(e,r,s,n,i){let o=$e(e,r,s),a=Vr(o),l={config:this.config,ancestor:e,local:r,other:s,attribute:n,nodeFactory:this.nodeFactory,rootKey:i};return a.execute(l)}};var ye=class{orchestrator;constructor(e){this.orchestrator=new U(e,$)}mergeThreeWay(e,r,s){let n=C(e),i=C(r),o=C(s),a=[],l=ee(e,r,s);for(let u of l){let m=this.orchestrator.merge(n[u],i[u],o[u],void 0,{name:u,existsInLocal:u in i,existsInOther:u in o});a.push(m)}let c=I(a);return{output:c.output,hasConflict:c.hasConflict}}};Y([Q("JsonMerger")],ye.prototype,"mergeThreeWay",null);var Pn=(...t)=>Object.assign({},...t),xe=class{parser;serializer;jsonMerger;constructor(e){this.parser=new De,this.serializer=new ve(e),this.jsonMerger=new ye(e)}mergeThreeWay(e,r,s){let n=this.parser.parse(e),i=this.parser.parse(r),o=this.parser.parse(s),a=Pn(n.namespaces,i.namespaces,o.namespaces),l=this.jsonMerger.mergeThreeWay(n.content,i.content,o.content);return{output:l.output.length?this.serializer.serialize(l.output,a):"",hasConflict:l.hasConflict}}};Y([Q("XmlMerger")],xe.prototype,"mergeThreeWay",null);var Te=require("os"),Br="\r",jt=`
|
|
20
|
-
`,
|
|
3
|
+
"use strict";var Ee=Object.defineProperty;var ur=Object.getOwnPropertyDescriptor;var fr=Object.getOwnPropertyNames;var hr=Object.prototype.hasOwnProperty;var pr=(e,t)=>{for(var r in t)Ee(e,r,{get:t[r],enumerable:!0})},dr=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of fr(t))!hr.call(e,o)&&o!==r&&Ee(e,o,{get:()=>t[o],enumerable:!(n=ur(t,o))||n.enumerable});return e};var mr=e=>dr(Ee({},"__esModule",{value:!0}),e);var mn={};pr(mn,{assertNodeVersion:()=>rr,main:()=>or,parseArgs:()=>nr});module.exports=mr(mn);var Oe="base",Ce="ours",Te="theirs";function I(e,t,r,n){var o=arguments.length,s=o<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,r):n,i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(e,t,r,n);else for(var a=e.length-1;a>=0;a--)(i=e[a])&&(s=(o<3?i(s):o>3?i(t,r,s):i(t,r))||s);return o>3&&s&&Object.defineProperty(t,r,s),s}var ge=require("node:fs"),ye=require("node:fs/promises"),it=require("node:path"),Qt=require("node:stream/promises");function dt(e,t){"txml";t=t||{};var r=t.pos||0,n=!!t.keepComments,o=!!t.keepWhitespace,s="<",i=60,a=">",l=62,u=45,h=47,p=33,f=39,m=34,y=91,x=93;function ft(w){for(var b=[];e[r];)if(e.charCodeAt(r)==i){if(e.charCodeAt(r+1)===h){var P=r+2;r=e.indexOf(a,r);var k=e.substring(P,r);if(k.indexOf(w)==-1){var V=e.substring(0,r).split(`
|
|
4
|
+
`);throw new Error(`Unexpected close tag
|
|
5
|
+
Line: `+(V.length-1)+`
|
|
6
|
+
Column: `+(V[V.length-1].length+1)+`
|
|
7
|
+
Char: `+e[r])}return r+1&&(r+=1),b}else if(e.charCodeAt(r+1)===p){if(e.charCodeAt(r+2)==u){let Ae=r;for(;r!==-1&&!(e.charCodeAt(r)===l&&e.charCodeAt(r-1)==u&&e.charCodeAt(r-2)==u&&r!=-1);)r=e.indexOf(a,r+1);r===-1&&(r=e.length),n&&b.push(e.substring(Ae,r+1))}else if(e.charCodeAt(r+2)===y&&e.charCodeAt(r+8)===y&&e.substr(r+3,5).toLowerCase()==="cdata"){var _=e.indexOf("]]>",r);_==-1?(b.push(e.substr(r+9)),r=e.length):(b.push(e.substring(r+9,_)),r=_+3);continue}else{let Ae=r+1;r+=2;for(var F=!1;(e.charCodeAt(r)!==l||F===!0)&&e[r];)e.charCodeAt(r)===y?F=!0:F===!0&&e.charCodeAt(r)===x&&(F=!1),r++;b.push(e.substring(Ae,r))}r++;continue}var S=be();b.push(S),S.tagName[0]==="?"&&(b.push(...S.children),S.children=[])}else{var _e=sr();if(o)_e.length>0&&b.push(_e);else{var pt=_e.trim();pt.length>0&&b.push(pt)}r++}return b}function sr(){var w=r;return r=e.indexOf(s,r)-1,r===-2&&(r=e.length),e.slice(w,r+1)}var ir=`\r
|
|
8
|
+
>/= `;function ht(){for(var w=r;ir.indexOf(e[r])===-1&&e[r];)r++;return e.slice(w,r)}var ar=t.noChildNodes||["img","br","input","meta","link","hr"];function be(){r++;let w=ht(),b={},P=[];for(;e.charCodeAt(r)!==l&&e[r];){var k=e.charCodeAt(r);if(k>64&&k<91||k>96&&k<123){for(var V=ht(),_=e.charCodeAt(r);_&&_!==f&&_!==m&&!(_>64&&_<91||_>96&&_<123)&&_!==l;)r++,_=e.charCodeAt(r);if(_===f||_===m){var F=cr();if(r===-1)return{tagName:w,attributes:b,children:P}}else F=null,r--;b[V]=F}r++}if(e.charCodeAt(r-1)!==h)if(w=="script"){var S=r+1;r=e.indexOf("</script>",r),P=[e.slice(S,r)],r+=9}else if(w=="style"){var S=r+1;r=e.indexOf("</style>",r),P=[e.slice(S,r)],r+=8}else ar.indexOf(w)===-1?(r++,P=ft(w)):r++;else r++;return{tagName:w,attributes:b,children:P}}function cr(){var w=e[r],b=r+1;return r=e.indexOf(w,b),e.slice(b,r)}function lr(){var w=new RegExp("\\s"+t.attrName+`\\s*=['"]`+t.attrValue+`['"]`).exec(e);return w?w.index:-1}var N=null;if(t.attrValue!==void 0){t.attrName=t.attrName||"id";for(var N=[];(r=lr())!==-1;)r=e.lastIndexOf("<",r),r!==-1&&N.push(be()),e=e.substr(r),r=0}else t.parseNode?N=be():N=ft("");return t.filter&&(N=gt(N,t.filter)),t.simplify?mt(Array.isArray(N)?N:[N]):(t.setPos&&(N.pos=r),N)}function mt(e){var t={};if(!e.length)return"";if(e.length===1&&typeof e[0]=="string")return e[0];e.forEach(function(n){if(typeof n=="object"){t[n.tagName]||(t[n.tagName]=[]);var o=mt(n.children);t[n.tagName].push(o),Object.keys(n.attributes).length&&typeof o!="string"&&(o._attributes=n.attributes)}});for(var r in t)t[r].length==1&&(t[r]=t[r][0]);return t}function gt(e,t,r=0,n=""){var o=[];return e.forEach(function(s,i){if(typeof s=="object"&&t(s,i,r,n)&&o.push(s),s.children){var a=gt(s.children,t,r+1,(n?n+".":"")+i+"."+s.tagName);o=o.concat(a)}}),o}var yt=`<?xml version="1.0" encoding="UTF-8"?>
|
|
9
|
+
`,W="#xml__comment",B="__cdata",wt=" ";var gr=dt,At="@_",Z="#text",yr=/^xmlns(?::.+)?$/,wr=/^<!--([\s\S]*?)-->$/,Ne="\0cdata\0",br=/<!\[CDATA\[([\s\S]*?)\]\]>/g,_r=e=>e.replace(br,(t,r)=>{let n=r.replace(/&/g,"&").replace(/</g,"<");return`<${Ne}>${n}</${Ne}>`}),Ar=e=>e.replace(/</g,"<").replace(/&/g,"&"),bt=(e,t)=>{let r=null;for(let n=t;n<e.length;n++){let o=e[n];if(r!==null){o===r&&(r=null);continue}if(o==='"'||o==="'"){r=o;continue}if(o===">")return n}return-1},Er=e=>{let t=0,r=0;for(;r<e.length;){let n=e.indexOf("<",r);if(n<0)break;if(e.startsWith("<!--",n)){let i=e.indexOf("-->",n+4);if(i<0)throw new Error("XML parse error: unterminated comment");r=i+3;continue}if(e.startsWith("<!",n)){let i=bt(e,n+2);if(i<0)throw new Error("XML parse error: unterminated <! ... >");r=i+1;continue}if(e.startsWith("<?",n)){let i=e.indexOf("?>",n+2);if(i<0)throw new Error("XML parse error: unterminated <? ?>");r=i+2;continue}let o=bt(e,n+1);if(o<0)throw new Error("XML parse error: unterminated tag");let s=e.slice(n+1,o);s.startsWith("/")?t--:s.endsWith("/")||t++,r=o+1}if(t!==0)throw new Error(`XML parse error: tags unbalanced (final depth ${t.toString()})`)},Or=e=>{let t="",r=new Map,n=(o,s)=>{let i=r.get(o);i?i.push(s):r.set(o,[s])};for(let o of e){if(typeof o=="string"){let s=o.match(wr);if(s!==null){n(W,s[1]);continue}t+=o;continue}if(o.tagName===Ne){n(B,Ar(Cr(o)));continue}n(o.tagName,Et(o))}return{textBuf:t,grouped:r}},Cr=e=>{let t="";for(let r of e.children)typeof r=="string"&&(t+=r);return t},Tr=e=>{let t=Object.keys(e);return t.length===1&&t[0]===Z?e[Z]:e},Et=e=>{let t=e.children.length===0,r=Object.keys(e.attributes).length===0;if(t&&r)return"";let{textBuf:n,grouped:o}=Or(e.children),s={};for(let[i,a]of Object.entries(e.attributes))s[`${At}${i}`]=a;for(let[i,a]of o)s[i]=a.length===1?a[0]:a;return n.trim().length>0&&(s[Z]=n),t&&!r&&(s[Z]=""),Tr(s)},Nr=e=>{for(let t of e)if(typeof t!="string"&&t.tagName!=="?xml")return t},Lr=e=>{let t={},r={};for(let[n,o]of Object.entries(e.attributes))yr.test(n)?r[`${At}${n}`]=o:t[n]=o;return{rootAttrs:t,namespaces:r}},vr=e=>{if(!Array.isArray(e))throw new Error(`txml.parse: expected an array of nodes, got ${typeof e}`);return e},_t=e=>{let t=_r(e);Er(t);let r=vr(gr(t,{keepComments:!0})),n=Nr(r);if(n===void 0)return{content:{},namespaces:{}};let{rootAttrs:o,namespaces:s}=Lr(n),i={tagName:n.tagName,attributes:o,children:n.children};return{content:{[n.tagName]:Et(i)},namespaces:s}},Rr=async e=>{let t=[];for await(let r of e)t.push(typeof r=="string"?Buffer.from(r,"utf8"):r);return Buffer.concat(t).toString("utf8")},Q=class{parseString(t){return _t(t)}async parseStream(t){return _t(await Rr(t))}};var Se=require("node:events");var ee=e=>typeof e=="object"&&e!==null&&!Array.isArray(e)&&"__conflict"in e&&e.__conflict===!0,Ot=(e,t,r)=>({__conflict:!0,local:Array.isArray(e)?e:[e],ancestor:Array.isArray(t)?t:[t],other:Array.isArray(r)?r:[r]});var Mt="#text",Me="@_",jt=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),Mr=e=>e.replace(/--/g,"- -").replace(/-$/,"- "),jr=e=>e.replace(/\]\]>/g,"]]]]><![CDATA[>"),Le=e=>{let t="";for(let r=0;r<e.length;r++){let n=e[r];t+=` ${n[0]}="${n[1]}"`}return t},xr=e=>{let t=e.conflictMarkerSize;return{local:`${`
|
|
10
|
+
`}${"<".repeat(t)} ${e.localConflictTag}`,ancestor:`${"|".repeat(t)} ${e.ancestorConflictTag}`,separator:"=".repeat(t),other:`${">".repeat(t)} ${e.otherConflictTag}`}},M=(e,t)=>{e.buf+=e.endedWithGt?`${re(e.depth)}${t}`:t,e.endedWithGt=!1},Pr=(e,t)=>{e.buf+=e.endedWithGt?`${re(e.depth)}<![CDATA[${t}]]>`:`<![CDATA[${t}]]>`,e.endedWithGt=!0},Fr=(e,t)=>{e.buf+=`<!--${t}-->`,e.endedWithGt=!0},kr=(e,t,r)=>ee(t)?(Pe(e,t,r),!0):jt(t)?!1:(M(e,String(t)),!0),ve=(e,t,r)=>{if(t.length===0){M(e,`
|
|
11
|
+
`);return}xt(e,t,r)},Pe=(e,t,r)=>{M(e,r.local),ve(e,t.local,r),M(e,r.ancestor),ve(e,t.ancestor,r),M(e,r.separator),ve(e,t.other,r),M(e,r.other)},te=[],Ir=(e,t,r,n)=>{e.buf+=yt;let o=!0;for(let s=0;s<t.length;s++){let i=t[s];if(kr(e,i,n))continue;let a=i,l=Object.keys(a).sort();for(let u=0;u<l.length;u++){let h=l[u];if(h===":@")continue;let p=te;if(o){let f=Object.keys(r).sort(),m=new Array(f.length);for(let y=0;y<f.length;y++){let x=f[y];m[y]=[x.slice(Me.length),String(r[x])]}p=m,o=!1}je(e,h,a[h],p,n)}}},je=(e,t,r,n,o)=>{if(t===Mt){M(e,String(r));return}if(t===W){Fr(e,Mr(String(r)));return}if(t===B){let h=Array.isArray(r)?r.join(""):String(r);Pr(e,jr(h));return}if(r!==null&&typeof r=="object"&&!Array.isArray(r)&&ee(r)){Pe(e,r,o);return}let{attrs:s,children:i}=Dr(r),a=n===te?Le(s):Le(n)+Le(s);e.isFirstTopLevelAfterDecl?(e.buf+=`<${t}${a}>`,e.isFirstTopLevelAfterDecl=!1):e.buf+=`${re(e.depth)}<${t}${a}>`;let l=e.depth;e.depth=l+1;let u=e.endedWithGt;e.endedWithGt=!1,xt(e,i,o),e.endedWithGt?e.buf+=`${re(l)}</${t}>`:e.buf+=`</${t}>`,e.depth=l,e.endedWithGt=!0},xt=(e,t,r)=>{for(let n=0;n<t.length;n++){let o=t[n];if(ee(o)){Pe(e,o,r);continue}if(!jt(o)){M(e,String(o));continue}let s=Object.keys(o);if(s.length===1){let i=s[0];je(e,i,o[i],te,r);continue}s.sort();for(let i=0;i<s.length;i++){let a=s[i];je(e,a,o[a],te,r)}}},Dr=e=>{if(e==null)return{attrs:[],children:[]};if(typeof e!="object")return{attrs:[],children:[{[Mt]:e}]};if(Array.isArray(e))return{attrs:[],children:e};let t=[],r=[];for(let n of Object.keys(e).sort()){let o=e[n];if(n.startsWith(Me))t.push([n.slice(Me.length),String(o)]);else if(Array.isArray(o)&&n!==B&&n!==W)for(let s of o)r.push({[n]:s});else r.push({[n]:o})}return{attrs:t,children:r}},Ct=[],re=e=>{let t=Ct[e];return t===void 0&&(t=`
|
|
12
|
+
${wt.repeat(e)}`,Ct[e]=t),t},xe=class{buf="";markers;constructor(t){this.markers=["<".repeat(t.conflictMarkerSize),"|".repeat(t.conflictMarkerSize),"=".repeat(t.conflictMarkerSize),">".repeat(t.conflictMarkerSize)]}push(t){let r=[],n=t;for(;;){let o=n.indexOf(`
|
|
13
|
+
`);if(o<0){this.buf+=n;break}this.buf+=n.slice(0,o),this.flushLine(r,!0),n=n.slice(o+1)}return r.join("")}end(){let t=[];return this.flushLine(t,!1),t.join("")}flushLine(t,r){let n=this.buf;this.buf="";let o=/^([ \t]+)(.*)$/.exec(n);o!==null&&this.markers.some(s=>o[2].startsWith(s))&&(n=o[2]),!/^[ \t]*$/.test(n)&&t.push(r?`${n}
|
|
14
|
+
`:n)}},Tt=(e,t)=>t===`
|
|
15
|
+
`?e:e.replace(/\r?\n/g,t),Re=16*1024,ne=class{config;constructor(t){this.config=t}async writeTo(t,r,n,o=`
|
|
16
|
+
`,s=!0){if(r.length===0)return;let i=xr(this.config),a={buf:"",depth:0,endedWithGt:!1,isFirstTopLevelAfterDecl:!0};if(Ir(a,r,n,i),!s){let p=Tt(a.buf,o);t.write(p)||await(0,Se.once)(t,"drain");return}let l=new xe(this.config),u="",h=async()=>{let p=Tt(u,o);u="",t.write(p)||await(0,Se.once)(t,"drain")};for(let p=0;p<a.buf.length;p+=Re)u+=l.push(a.buf.slice(p,p+Re)),u.length>=Re&&await h();u+=l.end(),await h()}};var oe=require("node:fs"),se=require("node:os"),Fe=require("node:path");var Pt="sf-git-merge-driver";function Kr(e){return typeof e=="function"?e():e}function D(e,...t){let r=t.map(n=>typeof n=="function"?n:()=>n);return()=>e.reduce((n,o,s)=>n+o+(s<r.length?r[s]():""),"")}var L={trace:10,debug:20,info:30,warn:40,error:50,fatal:60},Ft=L.warn;function $r(e){if(!e)return Ft;let t=Number(e);if(Number.isInteger(t)&&t>=0)return t;let r=e.toLowerCase();return r in L?L[r]:Ft}var It=$r(process.env.SF_LOG_LEVEL??process.env.SFDX_LOG_LEVEL),Dt=e=>e>=It,Kt=L,Gr=process.env.SF_LOG_STDERR==="true",Vr=(0,se.hostname)(),Wr=process.pid,$t=(0,Fe.join)((0,se.homedir)(),".sf"),kt=!1;function Br(){if(!kt){kt=!0;try{(0,oe.mkdirSync)($t,{recursive:!0})}catch{}}}function Xr(){let e=new Date,t=e.getFullYear(),r=String(e.getMonth()+1).padStart(2,"0"),n=String(e.getDate()).padStart(2,"0");return(0,Fe.join)($t,`sf-${t}-${r}-${n}.log`)}function Ur(e,t,r){let n={level:e,time:Date.now(),pid:Wr,hostname:Vr,name:Pt,msg:t};r!==void 0&&(n.meta=r);let o=`${JSON.stringify(n)}
|
|
17
|
+
`;Br();try{(0,oe.appendFileSync)(Xr(),o)}catch{}Gr&&process.stderr.write(o)}function X(e,t,r){e<It||Ur(e,String(Kr(t)),r)}var v={trace(e,t){X(L.trace,e,t)},debug(e,t){X(L.debug,e,t)},info(e,t){X(L.info,e,t)},warn(e,t){X(L.warn,e,t)},error(e,t){X(L.error,e,t)}};var Yr=Dt(Kt.trace);function K(e){return function(t,r,n){if(!Yr)return;let o=n.value;n.value=function(...s){v.trace(D`${e}.${r}: entry`);let i=()=>o.call(this,...s);if(o.constructor.name==="AsyncFunction")return i().then(a=>(v.trace(D`${e}.${r}: exit`),a),a=>{throw v.trace(D`${e}.${r}: exit (error)`),a});try{let a=i();return v.trace(D`${e}.${r}: exit`),a}catch(a){throw v.trace(D`${e}.${r}: exit (error)`),a}}}}var O=e=>Array.isArray(e)?{}:e;var $=(e,...t)=>{for(let r of t)for(let n of r)e.push(n)},Gt=(e,t)=>{let r=new Set(t),n=e.filter(i=>r.has(i)),o=new Set(e),s=t.filter(i=>o.has(i));if(n.length!==s.length)return!1;for(let i=0;i<n.length;i++)if(n[i]!==s[i])return!1;return!0},ie=(e,t)=>{let r=e.length,n=t.length;if(r===0||n===0)return[];let o=n+1,s=new Int32Array((r+1)*o);for(let u=1;u<=r;u++){let h=(u-1)*o,p=u*o;for(let f=1;f<=n;f++)if(e[u-1]===t[f-1])s[p+f]=s[h+(f-1)]+1;else{let m=s[h+f],y=s[p+(f-1)];s[p+f]=m>=y?m:y}}let i=[],a=r,l=n;for(;a>0&&l>0;)e[a-1]===t[l-1]?(i.push(e[a-1]),a--,l--):s[(a-1)*o+l]>s[a*o+(l-1)]?a--:l--;return i.reverse(),i};var zr=[],Hr={output:zr,hasConflict:!1},C=e=>{if(e.length===1)return e[0];let t=[],r=!1;for(let n of e)$(t,n.output),r=r||n.hasConflict;return{output:t,hasConflict:r}},d=e=>e.length===0?Hr:{output:e,hasConflict:!1},A=e=>({output:e,hasConflict:!0});var U=(e,t)=>e.output.length>0?{output:[{[t]:e.output}],hasConflict:e.hasConflict}:d([{[t]:[]}]),Y=(e,t)=>{let r=e==null?[]:Array.isArray(e)?e:[e];return d(t?[{[t]:r}]:r)};var g;(function(e){e[e.NONE=0]="NONE",e[e.OTHER_ONLY=1]="OTHER_ONLY",e[e.LOCAL_ONLY=2]="LOCAL_ONLY",e[e.LOCAL_AND_OTHER=3]="LOCAL_AND_OTHER",e[e.ANCESTOR_ONLY=4]="ANCESTOR_ONLY",e[e.ANCESTOR_AND_OTHER=5]="ANCESTOR_AND_OTHER",e[e.ANCESTOR_AND_LOCAL=6]="ANCESTOR_AND_LOCAL",e[e.ALL=7]="ALL"})(g||(g={}));var ke=e=>e==null?!1:typeof e=="string"||Array.isArray(e)?e.length>0:typeof e=="object"?Object.keys(e).length>0:!0,ae=(e,t,r)=>{let n=g.NONE;return ke(e)&&(n|=g.ANCESTOR_ONLY),ke(t)&&(n|=g.LOCAL_ONLY),ke(r)&&(n|=g.OTHER_ONLY),n};var z=class{static getKeyFieldExtractor(t){return t in Vt?Vt[t]:void 0}static isOrderedAttribute(t){return qr.has(t)}},qr=new Set(["customValue","standardValue","value","values","filterItems","summaryFilterItems"]),c=(e,t)=>String(e[t]),Ie=e=>{let t=c(e,"field"),r=c(e,"operation"),n=c(e,"value"),o=c(e,"valueField");return[t,r,n,o].filter(s=>s!==String(void 0)).join(".")},Vt={labels:e=>c(e,"fullName"),applicationVisibilities:e=>c(e,"application"),categoryGroupVisibilities:e=>c(e,"dataCategoryGroup"),classAccesses:e=>c(e,"apexClass"),customMetadataTypeAccesses:e=>c(e,"name"),customPermissions:e=>c(e,"name"),customSettingAccesses:e=>c(e,"name"),externalDataSourceAccesses:e=>c(e,"externalDataSource"),fieldPermissions:e=>c(e,"field"),flowAccesses:e=>c(e,"flow"),layoutAssignments:e=>{let t=c(e,"layout"),r=c(e,"recordType");return[t,r].filter(n=>n!==String(void 0)).join(".")},loginFlows:e=>c(e,"friendlyname"),loginHours:e=>typeof e=="object"&&e!==null?Object.keys(e).join(","):"",loginIpRanges:e=>{let t=c(e,"startAddress"),r=c(e,"endAddress");return`${t}-${r}`},objectPermissions:e=>c(e,"object"),pageAccesses:e=>c(e,"apexPage"),profileActionOverrides:e=>c(e,"actionName"),recordTypeVisibilities:e=>c(e,"recordType"),tabVisibilities:e=>c(e,"tab"),userPermissions:e=>c(e,"name"),dataspaceScopes:e=>c(e,"dataspaceScope"),emailRoutingAddressAccesses:e=>c(e,"name"),externalCredentialPrincipalAccesses:e=>c(e,"externalCredentialPrincipal"),sharingCriteriaRules:e=>c(e,"fullName"),sharingGuestRules:e=>c(e,"fullName"),sharingOwnerRules:e=>c(e,"fullName"),sharingTerritoryRules:e=>c(e,"fullName"),criteriaItems:Ie,filterItems:Ie,summaryFilterItems:Ie,valueSettings:e=>c(e,"valueName"),alerts:e=>c(e,"fullName"),recipients:e=>c(e,"type"),fieldUpdates:e=>c(e,"fullName"),flowActions:e=>c(e,"fullName"),flowInputs:e=>c(e,"name"),flowAutomation:e=>c(e,"fullName"),knowledgePublishes:e=>c(e,"fullName"),outboundMessages:e=>c(e,"fullName"),rules:e=>c(e,"fullName"),actions:e=>c(e,"name"),send:e=>c(e,"fullName"),tasks:e=>c(e,"fullName"),assignmentRule:e=>c(e,"fullName"),autoResponseRule:e=>c(e,"fullName"),escalationRule:e=>c(e,"fullName"),marketingAppExtActions:e=>c(e,"apiName"),marketingAppExtActivities:e=>c(e,"fullName"),matchingRules:e=>c(e,"fullName"),matchingRuleItems:e=>{let t=c(e,"fieldName"),r=c(e,"matchingMethod");return`${t}-${r}`},customValue:e=>c(e,"fullName"),standardValue:e=>c(e,"fullName"),valueTranslation:e=>c(e,"masterLabel"),botBlocks:e=>c(e,"fullName"),botBlockVersions:e=>c(e,"fullName"),botDialogs:e=>c(e,"developerName"),botSteps:e=>c(e,"stepIdentifier"),botMessages:e=>c(e,"messageIdentifier"),botVariableOperation:e=>c(e,"variableOperationIdentifier"),botTemplates:e=>c(e,"fullName"),bots:e=>c(e,"fullName"),botVersions:e=>c(e,"fullName"),conversationMessageDefinitions:e=>c(e,"name"),constantValueTranslations:e=>c(e,"name"),customApplications:e=>c(e,"name"),customLabels:e=>c(e,"name"),customPageWebLinks:e=>c(e,"name"),customTabs:e=>c(e,"name"),desFieldTemplateMessages:e=>c(e,"name"),flowDefinitions:e=>c(e,"fullName"),flows:e=>c(e,"fullName"),identityVerificationCustomFieldLabels:e=>c(e,"name"),pipelineInspMetricConfigs:e=>c(e,"name"),prompts:e=>c(e,"name"),promptVersions:e=>c(e,"name"),quickActions:e=>c(e,"name"),reportTypes:e=>c(e,"name"),sections:e=>{let t=c(e,"name"),r=c(e,"section");return[t,r].filter(n=>n!==String(void 0))[0]},columns:e=>c(e,"name"),scontrols:e=>c(e,"name"),caseValues:e=>{let t=c(e,"article"),r=c(e,"caseType"),n=c(e,"plural"),o=c(e,"possessive");return[t,r,n,o].filter(s=>s!==String(void 0)).join(".")},fieldSets:e=>c(e,"name"),fields:e=>c(e,"name"),picklistValues:e=>c(e,"masterLabel"),values:e=>c(e,"fullName"),value:e=>c(e,"fullName"),layouts:e=>c(e,"layout"),quickActionParametersTranslation:e=>c(e,"name"),recordTypes:e=>c(e,"name"),sharingReasons:e=>c(e,"name"),standardFields:e=>c(e,"name"),validationRules:e=>c(e,"name"),webLinks:e=>c(e,"name"),workflowTasks:e=>c(e,"name"),types:e=>c(e,"name")};var De=e=>Array.isArray(e)?e.length===0:Object.keys(e).length===0,E=(e,t,r)=>{let n=De(e)?{}:e,o=De(t)?{}:t,s=De(r)?{}:r;return Ot(n,o,s)};var ce=(e,t)=>{let r=new Map;for(let n of e){let o=t(n);r.set(o,n)}return r},Wt=(e,t,r,n)=>{let o=new Set,s=new Map,i=new Map,a=new Map,l=(u,h)=>{for(let p of u){let f=p,m=n(f);h.set(m,f),o.add(m)}};return l(e,s),l(t,i),l(r,a),{keyedAncestor:s,keyedLocal:i,keyedOther:a,allKeys:o}};function T(e,t){let r=[[e,t]];for(;r.length>0;){let[n,o]=r.pop();if(n===o)continue;if(n===null||o===null||typeof n!="object"||typeof o!="object")return!1;if(Array.isArray(n)){if(!Array.isArray(o)||n.length!==o.length)return!1;for(let l=n.length-1;l>=0;l--)r.push([n[l],o[l]]);continue}if(Array.isArray(o))return!1;let s=n,i=o,a=Object.keys(s);if(a.length!==Object.keys(i).length)return!1;for(let l of a){if(!(l in i))return!1;r.push([s[l],i[l]])}}return!0}var Bt=(e,t)=>{if(e.size!==t.size)return!1;for(let r of e)if(!t.has(r))return!1;return!0},Ke=(e,t)=>{for(let r of e)if(t.has(r))return!0;return!1};var Jr=(e,t,r)=>{let n=new Set(e),o=new Set(t),s=new Set(r);return{localDeleted:new Set(e.filter(i=>!o.has(i))),otherDeleted:new Set(e.filter(i=>!s.has(i))),localAdded:new Set(t.filter(i=>!n.has(i))),otherAdded:new Set(r.filter(i=>!n.has(i))),allKeys:new Set([...e,...t,...r])}},le=class{ancestor;local;other;attribute;keyField;constructor(t,r,n,o,s){this.ancestor=t,this.local=r,this.other=n,this.attribute=o,this.keyField=s}merge(t){let r=this.buildArrayMergeState(),n=this.analyzeOrderings(r);return n.canMerge?n.localMoved.size>0||n.otherMoved.size>0?this.processDivergedOrderings(t,r,n):this.processWithSpine(t,r):this.buildFullArrayConflict(t,r)}buildArrayMergeState(){let t=this.ancestor.map(o=>this.keyField(o)),r=this.local.map(o=>this.keyField(o)),n=this.other.map(o=>this.keyField(o));return{ancestorKeys:t,localKeys:r,otherKeys:n,ancestorMap:ce(this.ancestor,this.keyField),localMap:ce(this.local,this.keyField),otherMap:ce(this.other,this.keyField),ancestorPos:new Map(t.map((o,s)=>[o,s])),localPos:new Map(r.map((o,s)=>[o,s])),otherPos:new Map(n.map((o,s)=>[o,s])),ancestorSet:new Set(t)}}analyzeOrderings(t){if(Gt(t.localKeys,t.otherKeys))return{canMerge:!0,localMoved:new Set,otherMoved:new Set};let r=this.getMovedElements(t,t.localPos),n=this.getMovedElements(t,t.otherPos);return Ke(r,n)?{canMerge:!1,localMoved:r,otherMoved:n}:r.size===0&&n.size===0?{canMerge:!1,localMoved:r,otherMoved:n}:{canMerge:!0,localMoved:r,otherMoved:n}}getMovedElements(t,r){let n=new Set;for(let o=0;o<t.ancestorKeys.length;o++){let s=t.ancestorKeys[o],i=r.get(s);if(i!==void 0)for(let a=o+1;a<t.ancestorKeys.length;a++){let l=t.ancestorKeys[a],u=r.get(l);u!==void 0&&i>u&&(n.add(s),n.add(l))}}return n}processDivergedOrderings(t,r,n){let o=this.computeMergedKeyOrder(r,n);return o===null?this.buildFullArrayConflict(t,r):this.processKeyOrder(t,r,o)}computeMergedKeyOrder(t,r){let{localMoved:n,otherMoved:o}=r,s=t.localKeys.filter(f=>n.has(f)),i=t.otherKeys.filter(f=>o.has(f)),a=t.localKeys.filter(f=>!n.has(f)&&!t.ancestorSet.has(f)),l=t.otherKeys.filter(f=>!o.has(f)&&!t.ancestorSet.has(f)&&!t.localMap.has(f));if(a.length>0&&l.length>0)return null;let u=[],h=!1,p=!1;for(let f of t.ancestorKeys)n.has(f)?h||($(u,s),h=!0):o.has(f)?p||($(u,i),p=!0):u.push(f);return $(u,a,l),u}processWithSpine(t,r){let n=ie(ie(r.ancestorKeys,r.localKeys),ie(r.ancestorKeys,r.otherKeys));return this.processSpine(t,n,r)}processKeyOrder(t,r,n){let o=[];for(let s of n){let i=this.mergeElementWithPresenceCheck(t,s,r);i&&i.output.length>0&&o.push(i)}return C(o)}mergeElementWithPresenceCheck(t,r,n){let o=n.ancestorMap.has(r),s=n.localMap.has(r),i=n.otherMap.has(r);return o&&s&&i?this.mergeElement(t,r,n):this.mergeGapElement(t,r,n)}wrapKeys(t,r){return t.map(n=>({[this.attribute]:r.get(n)}))}buildFullArrayConflict(t,r){return A([E(this.wrapKeys(r.localKeys,r.localMap),this.wrapKeys(r.ancestorKeys,r.ancestorMap),this.wrapKeys(r.otherKeys,r.otherMap))])}processSpine(t,r,n){let o=[],s=0,i=0,a=0;for(let u of r){let h=n.ancestorPos.get(u),p=n.localPos.get(u),f=n.otherPos.get(u),m={ancestor:n.ancestorKeys.slice(s,h),local:n.localKeys.slice(i,p),other:n.otherKeys.slice(a,f)};o.push(this.mergeGap(t,m,n)),o.push(this.mergeElement(t,u,n)),s=h+1,i=p+1,a=f+1}let l={ancestor:n.ancestorKeys.slice(s),local:n.localKeys.slice(i),other:n.otherKeys.slice(a)};return o.push(this.mergeGap(t,l,n)),C(o)}mergeGap(t,r,n){let o=Jr(r.ancestor,r.local,r.other),s=this.detectGapConflict(t,r,o,n);return s||this.mergeGapElements(t,o,n)}detectGapConflict(t,r,n,o){let{localDeleted:s,otherDeleted:i,localAdded:a,otherAdded:l}=n,u=s.size>0&&i.size>0&&!Bt(s,i),h=a.size>0&&l.size>0&&!Ke(a,l);return u||h?this.buildGapConflict(t,r,o):null}buildGapConflict(t,r,n){return A([E(this.wrapKeys(r.local,n.localMap),this.wrapKeys(r.ancestor,n.ancestorMap),this.wrapKeys(r.other,n.otherMap))])}mergeGapElements(t,r,n){let o=[];for(let s of r.allKeys){let i=this.mergeGapElement(t,s,n);i&&o.push(i)}return C(o)}mergeGapElement(t,r,n){let o=n.ancestorMap.get(r),s=n.localMap.get(r),i=n.otherMap.get(r);return o!==void 0?s===void 0?i===void 0||T(o,i)?null:this.buildElementConflict(t,null,o,i):T(o,s)?null:this.buildElementConflict(t,s,o,null):s!==void 0&&i!==void 0?T(s,i)?d([this.wrapElement(s)]):this.buildElementConflict(t,s,null,i):d([this.wrapElement(s??i)])}wrapElement(t){return{[this.attribute]:t}}mergeElement(t,r,n){let o=n.ancestorMap.get(r),s=n.localMap.get(r),i=n.otherMap.get(r);return T(o,i)&&s?d([this.wrapElement(s)]):T(o,s)&&i?d([this.wrapElement(i)]):T(s,i)?d([this.wrapElement(s)]):this.buildElementConflict(t,s,o,i)}buildElementConflict(t,r,n,o){let s=i=>i?this.wrapElement(i):{};return A([E(s(r),s(n),s(o))])}};var $e=class{ancestor;local;other;attribute;constructor(t,r,n,o){this.ancestor=t,this.local=r,this.other=n,this.attribute=o}merge(t){return A([E({[this.attribute]:this.local},{[this.attribute]:this.ancestor},{[this.attribute]:this.other})])}},Ge=class{ancestor;local;other;attribute;keyField;constructor(t,r,n,o,s){this.ancestor=t,this.local=r,this.other=n,this.attribute=o,this.keyField=s}merge(t){let{keyedAncestor:r,keyedLocal:n,keyedOther:o,allKeys:s}=Wt(this.ancestor,this.local,this.other,this.keyField),i=[],a=new R(t,j);for(let l of Array.from(s).sort()){let u=a.merge(r.get(l)??{},n.get(l)??{},o.get(l)??{},this.attribute);u.output.length>0&&i.push({output:[{[this.attribute]:u.output}],hasConflict:u.hasConflict})}return C(i)}},ue=class{ancestor;local;other;attribute;keyField;isOrdered;constructor(t,r,n,o,s,i){this.ancestor=t,this.local=r,this.other=n,this.attribute=o,this.keyField=s,this.isOrdered=i}merge(t){return this.keyField?(this.isOrdered?new le(this.ancestor,this.local,this.other,this.attribute,this.keyField):new Ge(this.ancestor,this.local,this.other,this.attribute,this.keyField)).merge(t):new $e(this.ancestor,this.local,this.other,this.attribute).merge(t)}};var G=(...e)=>{let t=new Set;for(let r of e)if(r!=null)for(let n of Object.keys(r))t.add(n);return[...t].sort()};var fe=class{ancestor;local;other;attribute;constructor(t,r,n,o){this.ancestor=t,this.local=r,this.other=n,this.attribute=o}merge(t){let r=O(this.ancestor),n=O(this.local),o=O(this.other),s=G(this.ancestor,this.local,this.other),i=[];for(let l of s){let h=j.createNode(r[l],n[l],o[l],l).merge(t);i.push(h)}let a=C(i);return a.output.length===0?d([]):U(a,this.attribute)}};var Zr=(e,t)=>String(e).localeCompare(String(t)),he=class{ancestor;local;other;attribute;constructor(t,r,n,o){this.ancestor=t,this.local=r,this.other=n,this.attribute=o}merge(t){let r=new Set(this.local),n=new Set(this.other),o=new Set(this.ancestor),s=new Set;for(let a of this.ancestor)r.has(a)&&n.has(a)&&s.add(a);for(let a of this.local)o.has(a)||s.add(a);for(let a of this.other)o.has(a)||s.add(a);let i=[...s].sort(Zr).map(a=>a==null?{}:{[this.attribute]:a});return d(i)}};var Ve=class{handle({objOther:t}){return d([t])}},We=class{handle({objLocal:t}){return d([t])}},Be=class{handle({objLocal:t,objOther:r,local:n,other:o}){return n===o?d([t]):A([E(t,{},r)])}},Xe=class{handle({objAncestor:t,objOther:r,ancestor:n,other:o}){return n!==o?A([E({},t,r)]):d([])}},Ue=class{handle({objAncestor:t,objLocal:r,ancestor:n,local:o}){return n!==o?A([E(r,t,{})]):d([])}},Ye=class{handle({objAncestor:t,objLocal:r,objOther:n,ancestor:o,local:s,other:i}){return o===s?d([n]):o===i?d([r]):s===i?d([r]):A([E(r,t,n)])}},ze=class{handle(){return d([])}},He=class{handle(){return d([])}},Qr={[g.NONE]:new He,[g.OTHER_ONLY]:new Ve,[g.LOCAL_ONLY]:new We,[g.LOCAL_AND_OTHER]:new Be,[g.ANCESTOR_AND_OTHER]:new Xe,[g.ANCESTOR_AND_LOCAL]:new Ue,[g.ALL]:new Ye,[g.ANCESTOR_ONLY]:new ze},Xt=e=>Qr[e];var qe=(e,t)=>e==null?{}:{[t]:e},pe=class{ancestor;local;other;attribute;constructor(t,r,n,o){this.ancestor=t,this.local=r,this.other=n,this.attribute=o}merge(t){let r=qe(this.ancestor,this.attribute),n=qe(this.local,this.attribute),o=qe(this.other,this.attribute),s=ae(r,n,o);return Xt(s).handle({config:t,objAncestor:r,objLocal:n,objOther:o,ancestor:this.ancestor,local:this.local,other:this.other})}};var Ut=e=>e==null?[]:Array.isArray(e)?e:[e],Yt=e=>typeof e=="object"&&e!==null,en=(...e)=>e.some(Yt),tn=(...e)=>e.some(t=>Array.isArray(t)&&t.every(r=>typeof r=="string")),rn=e=>Yt(e)&&!Array.isArray(e),nn=(e,t)=>{let r=e.some(rn),n=e.some(Array.isArray);return!t&&r&&!n},Je=class{createNode(t,r,n,o){if(tn(t,r,n)){let[i,a,l]=[t,r,n].map(Ut);return new he(i,a,l,o)}let s=z.getKeyFieldExtractor(o);if(nn([t,r,n],s!==void 0))return new fe(t,r,n,o);if(en(t,r,n)){let[i,a,l]=[t,r,n].map(Ut);return new ue(i,a,l,o,s,z.isOrderedAttribute(o))}return new pe(t,r,n,o)}},j=new Je;var de=class{mergeChildren(t,r){let n=t.local,o=t.other,s=O(n),i=O(o),a=r===void 0?void 0:O(r),l=G(r??{},n,o),u=[];for(let p of l){let m=t.nodeFactory.createNode(a===void 0?void 0:a[p],s[p],i[p],p).merge(t.config);u.push(m)}let h=C(u);return t.rootKey?U(h,t.rootKey.name):h}},me=class{execute(t){let r=this.getTarget(t),n=T(t.ancestor,r);return t.rootKey?this.executeWithRootKey(t,t.rootKey,r,n):this.executeWithoutRootKey(t,r,n)}executeWithRootKey(t,r,n,o){let{name:s}=r,i=this.getExistsInSecondary(r);if(!i&&o)return d([]);if(!i){let a={[s]:n},l={[s]:t.ancestor};return A(this.buildConflict(t,a,l))}return U(this.executeNested(t),s)}executeWithoutRootKey(t,r,n){return n?d([]):t.attribute?this.executeWithAttribute(t,t.attribute):A(this.buildConflict(t,r,t.ancestor))}executeNested(t){return new R(t.config,t.nodeFactory).merge(t.ancestor,t.local,t.other)}executeWithAttribute(t,r){let n=new R(t.config,t.nodeFactory),o=this.mergeTarget(n,t),s=n.merge({},t.ancestor,{},void 0),i={[r]:o.output},a={[r]:s.output};return A(this.buildConflict(t,i,a))}},Ze=class{execute(t){return d([])}},Qe=class{execute(t){return Y(t.other,t.rootKey?.name)}},et=class{execute(t){return Y(t.local,t.rootKey?.name)}},tt=class extends de{execute(t){let r=t.local,n=t.other;return T(r,n)?Y(r,t.rootKey?.name):this.mergeChildren(t,void 0)}},rt=class{execute(t){if(t.rootKey){let{name:r,existsInLocal:n,existsInOther:o}=t.rootKey;return n||o?d([{[r]:[]}]):d([])}return d([])}},nt=class extends me{getTarget(t){return t.local}getExistsInSecondary(t){return t.existsInOther}buildConflict(t,r,n){return[E(r,n,{})]}mergeTarget(t,r){return t.merge({},r.local,{},void 0)}},ot=class extends me{getTarget(t){return t.other}getExistsInSecondary(t){return t.existsInLocal}buildConflict(t,r,n){return[E({},n,r)]}mergeTarget(t,r){return t.merge({},{},r.other,void 0)}},st=class extends de{execute(t){return T(t.ancestor,t.local)&&T(t.local,t.other)?Y(t.local,t.rootKey?.name):this.mergeChildren(t,t.ancestor)}},on={[g.ALL]:new st,[g.ANCESTOR_AND_LOCAL]:new nt,[g.ANCESTOR_AND_OTHER]:new ot,[g.ANCESTOR_ONLY]:new rt,[g.LOCAL_AND_OTHER]:new tt,[g.LOCAL_ONLY]:new et,[g.NONE]:new Ze,[g.OTHER_ONLY]:new Qe},zt=e=>on[e];var R=class{config;nodeFactory;constructor(t,r=j){this.config=t,this.nodeFactory=r}merge(t,r,n,o,s){let i=ae(t,r,n),a=zt(i),l={config:this.config,ancestor:t,local:r,other:n,attribute:o,nodeFactory:this.nodeFactory,rootKey:s};return a.execute(l)}};var H=class{orchestrator;constructor(t){this.orchestrator=new R(t,j)}mergeThreeWay(t,r,n){let o=O(t),s=O(r),i=O(n),a=[],l=G(t,r,n);for(let h of l){let p=this.orchestrator.merge(o[h],s[h],i[h],void 0,{name:h,existsInLocal:h in s,existsInOther:h in i});a.push(p)}let u=C(a);return{output:u.output,hasConflict:u.hasConflict}}};I([K("JsonMerger")],H.prototype,"mergeThreeWay",null);var sn=(...e)=>Object.assign({},...e),q=class{parser;writer;jsonMerger;constructor(t){this.parser=new Q,this.writer=new ne(t),this.jsonMerger=new H(t)}async mergeThreeWay(t,r,n,o,s=`
|
|
18
|
+
`){let i=await Promise.allSettled([this.parser.parseStream(t),this.parser.parseStream(r),this.parser.parseStream(n)]),a=i.find(m=>m.status==="rejected");if(a)throw a.reason;let[l,u,h]=i.map(m=>m.value),p=sn(l.namespaces,u.namespaces,h.namespaces),f=this.jsonMerger.mergeThreeWay(l.content,u.content,h.content);return f.output.length&&await this.writer.writeTo(o,f.output,p,s,f.hasConflict),{hasConflict:f.hasConflict}}};I([K("XmlMerger")],q.prototype,"mergeThreeWay",null);var qt=require("node:fs/promises"),an=`\r
|
|
19
|
+
`,cn=`
|
|
20
|
+
`,Ht=4096,ln=10,un=13,Jt=async e=>{let t=await(0,qt.open)(e,"r");try{let r=Buffer.alloc(Ht),{bytesRead:n}=await t.read(r,0,Ht,0),o=r.subarray(0,n),s=o.indexOf(ln);return s>0&&o[s-1]===un?an:cn}finally{await t.close()}};var fn=".sf-merge-tmp",hn="1.8.0",Zt=()=>{},pn=async e=>{try{await(0,ye.unlink)(e)}catch{}},J=class{config;constructor(t){this.config=t}async mergeFiles(t,r,n){let o=(0,it.normalize)(r),s=o+fn,i=[],a;v.info(`pipeline=streaming v=${hn}`);try{let l=await Jt(o),[u,h,p]=[t,r,n].map(it.normalize).map(y=>{let x=(0,ge.createReadStream)(y);return x.on("error",Zt),x});i.push(u,h,p),a=(0,ge.createWriteStream)(s),a.on("error",Zt);let f=new q(this.config),{hasConflict:m}=await f.mergeThreeWay(u,h,p,a,l);return a.end(),await(0,Qt.finished)(a),await(0,ye.rename)(s,o),m}catch(l){if(l!==null&&typeof l=="object"&&l.code==="ENOENT")throw l;return v.error("Merge failed; leaving ours unchanged",l),!0}finally{for(let l of i)l.destroy();a?.destroy(),await pn(s)}}};I([K("MergeDriver")],J.prototype,"mergeFiles",null);var dn=`Usage: sf-git-merge-driver -O <ancestor> -A <local> -B <other> -P <output> [-L n] [-S tag] [-X tag] [-Y tag]
|
|
21
21
|
|
|
22
22
|
Flags:
|
|
23
23
|
-O ancestor file (required, must exist)
|
|
@@ -25,15 +25,15 @@ Flags:
|
|
|
25
25
|
-B other/theirs file (required, must exist)
|
|
26
26
|
-P output file (required, must exist; accepted per git contract)
|
|
27
27
|
-L conflict marker size (integer 1-${100}, default ${7})
|
|
28
|
-
-S ancestor conflict tag (default ${
|
|
29
|
-
-X local conflict tag (default ${
|
|
30
|
-
-Y other conflict tag (default ${
|
|
28
|
+
-S ancestor conflict tag (default ${Oe})
|
|
29
|
+
-X local conflict tag (default ${Ce})
|
|
30
|
+
-Y other conflict tag (default ${Te})
|
|
31
31
|
--version Print version and exit
|
|
32
32
|
--help Show this message and exit
|
|
33
|
-
`,
|
|
34
|
-
`),process.exit(
|
|
35
|
-
`),
|
|
36
|
-
`),
|
|
37
|
-
`),
|
|
38
|
-
`),
|
|
39
|
-
`),process.exit(
|
|
33
|
+
`,lt=2,ut=1,at=0;function rr(e){Number(e.split(".")[0])<20&&(process.stderr.write(`sf-git-merge-driver requires Node.js >= 20 (got ${e})
|
|
34
|
+
`),process.exit(lt))}var we=e=>e instanceof Error?e.message:String(e),er=new Set(["-O","-A","-B","-P","-L","-S","-X","-Y"]);function nr(e){let t={},r=0;for(;r<e.length;){let f=e[r];if(!er.has(f))throw new Error(`unknown argument: ${f}`);let m=e[r+1];if(m===void 0||er.has(m))throw new Error(`missing value for ${f}`);t[f]=m,r+=2}let n=f=>{let m=t[f];if(m===void 0)throw new Error(`missing required flag: ${f}`);return m},o=(f,m)=>{let y=t[f];return y===void 0||y===""?m:y},s=n("-O"),i=n("-A"),a=n("-B"),l=n("-P"),u=t["-L"],h=7;if(u!==void 0&&u!==""){let f=Number(u);if(!Number.isInteger(f)||f<1||f>100)throw new Error(`-L must be an integer 1-${100} (got '${u}')`);h=f}let p={conflictMarkerSize:h,ancestorConflictTag:o("-S",Oe),localConflictTag:o("-X",Ce),otherConflictTag:o("-Y",Te)};return{ancestorFile:s,localFile:i,otherFile:a,outputFile:l,config:p}}async function or(e){if(e.includes("--version"))return process.stdout.write(`1.8.0
|
|
35
|
+
`),at;if(e.includes("--help"))return process.stdout.write(dn),at;let t;try{t=nr(e)}catch(r){return process.stderr.write(`sf-git-merge-driver: ${we(r)}
|
|
36
|
+
`),lt}try{return await new J(t.config).mergeFiles(t.ancestorFile,t.localFile,t.otherFile)?ut:at}catch(r){return r&&typeof r=="object"&&r.code==="ENOENT"?(process.stderr.write(`sf-git-merge-driver: ${we(r)}
|
|
37
|
+
`),lt):(process.stderr.write(`sf-git-merge-driver: ${we(r)}
|
|
38
|
+
`),ut)}}rr(process.versions.node),or(process.argv.slice(2)).then(e=>process.exit(e),e=>{process.stderr.write(`sf-git-merge-driver: ${we(e)}
|
|
39
|
+
`),process.exit(ut)});0&&(module.exports={assertNodeVersion,main,parseArgs});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Readable } from 'node:stream';
|
|
2
|
+
import type { NormalisedParseResult, XmlParser } from './XmlParser.js';
|
|
3
|
+
export interface TNode {
|
|
4
|
+
readonly tagName: string;
|
|
5
|
+
readonly attributes: Readonly<Record<string, string>>;
|
|
6
|
+
readonly children: ReadonlyArray<TNode | string>;
|
|
7
|
+
}
|
|
8
|
+
export declare const sentinelTextOf: (node: TNode) => string;
|
|
9
|
+
export declare const parsedToTNodes: (raw: unknown) => ReadonlyArray<TNode | string>;
|
|
10
|
+
export declare class TxmlXmlParser implements XmlParser {
|
|
11
|
+
parseString(xml: string): NormalisedParseResult;
|
|
12
|
+
parseStream(source: Readable): Promise<NormalisedParseResult>;
|
|
13
|
+
}
|