chrome-tools 1.2.1 → 1.2.2
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 +4 -2
- package/dist/cli.js +40 -40
- package/dist/index.js +16 -16
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -40,8 +40,10 @@ stderr. Library readers accept an `onDiagnostic` callback with the profile,
|
|
|
40
40
|
store, issue code, and message.
|
|
41
41
|
|
|
42
42
|
Windows App-Bound Encryption can make protected values unavailable to the
|
|
43
|
-
bundled helper.
|
|
44
|
-
|
|
43
|
+
bundled helper. If decryption fails from the package directory, the tool tries
|
|
44
|
+
a temporary copy of the helper under an accessible browser installation.
|
|
45
|
+
If the service still rejects it, the tool reports a placeholder and a
|
|
46
|
+
diagnostic when requested.
|
|
45
47
|
|
|
46
48
|
## Development
|
|
47
49
|
|
package/dist/cli.js
CHANGED
|
@@ -1,41 +1,41 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
var Ri=Object.create;var Jt=Object.defineProperty;var Ti=Object.getOwnPropertyDescriptor;var Li=Object.getOwnPropertyNames;var Pi=Object.getPrototypeOf,Ii=Object.prototype.hasOwnProperty;var Xt=(n=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(n,{get:(e,t)=>(typeof require<"u"?require:e)[t]}):n)(function(n){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+n+'" is not supported')});var A=(n,e)=>()=>(e||n((e={exports:{}}).exports,e),e.exports);var Ni=(n,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Li(e))!Ii.call(n,i)&&i!==t&&Jt(n,i,{get:()=>e[i],enumerable:!(r=Ti(e,i))||r.enumerable});return n};var Mi=(n,e,t)=>(t=n!=null?Ri(Pi(n)):{},Ni(e||!n||!n.__esModule?Jt(t,"default",{value:n,enumerable:!0}):t,n));var Ye=A((Sa,hr)=>{"use strict";var bt=[],pr=0,M=(n,e)=>{pr>=e&&bt.push(n)};M.WARN=1;M.INFO=2;M.DEBUG=3;M.reset=()=>{bt=[]};M.setDebugLevel=n=>{pr=n};M.warn=n=>M(n,M.WARN);M.info=n=>M(n,M.INFO);M.debug=n=>M(n,M.DEBUG);M.debugMessages=()=>bt;hr.exports=M});var Dr=A((Aa,mr)=>{"use strict";mr.exports=({onlyFirst:n=!1}={})=>{let e=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))"].join("|");return new RegExp(e,n?void 0:"g")}});var yr=A((Oa,gr)=>{"use strict";var ao=Dr();gr.exports=n=>typeof n=="string"?n.replace(ao(),""):n});var Er=A((va,wt)=>{"use strict";var Cr=n=>Number.isNaN(n)?!1:n>=4352&&(n<=4447||n===9001||n===9002||11904<=n&&n<=12871&&n!==12351||12880<=n&&n<=19903||19968<=n&&n<=42182||43360<=n&&n<=43388||44032<=n&&n<=55203||63744<=n&&n<=64255||65040<=n&&n<=65049||65072<=n&&n<=65131||65281<=n&&n<=65376||65504<=n&&n<=65510||110592<=n&&n<=110593||127488<=n&&n<=127569||131072<=n&&n<=262141);wt.exports=Cr;wt.exports.default=Cr});var wr=A((ka,br)=>{"use strict";br.exports=function(){return/\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F|\uD83D\uDC68(?:\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68\uD83C\uDFFB|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|[\u2695\u2696\u2708]\uFE0F|\uD83D[\uDC66\uDC67]|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708])\uFE0F|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C[\uDFFB-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)\uD83C\uDFFB|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB\uDFFC])|\uD83D\uDC69(?:\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB-\uDFFD])|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|(?:(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)\uFE0F|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDD])(?:(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\u200D[\u2640\u2642])|\uD83C\uDFF4\u200D\u2620)\uFE0F|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC15\u200D\uD83E\uDDBA|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF4\uD83C\uDDF2|\uD83C\uDDF6\uD83C\uDDE6|[#\*0-9]\uFE0F\u20E3|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83D\uDC69(?:\uD83C[\uDFFB-\uDFFF])|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83C\uDDE6(?:\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF])|\uD83C\uDDF0(?:\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF])|\uD83C\uDDED(?:\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA])|\uD83C\uDDE9(?:\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF])|\uD83C\uDDFE(?:\uD83C[\uDDEA\uDDF9])|\uD83C\uDDEC(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE])|\uD83C\uDDF8(?:\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF])|\uD83C\uDDEB(?:\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7])|\uD83C\uDDF5(?:\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE])|\uD83C\uDDFB(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA])|\uD83C\uDDF3(?:\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF])|\uD83C\uDDE8(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF])|\uD83C\uDDF1(?:\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE])|\uD83C\uDDFF(?:\uD83C[\uDDE6\uDDF2\uDDFC])|\uD83C\uDDFC(?:\uD83C[\uDDEB\uDDF8])|\uD83C\uDDFA(?:\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270A-\u270D]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC70\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDCAA\uDD74\uDD7A\uDD90\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD36\uDDB5\uDDB6\uDDBB\uDDD2-\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDED5\uDEEB\uDEEC\uDEF4-\uDEFA\uDFE0-\uDFEB]|\uD83E[\uDD0D-\uDD3A\uDD3C-\uDD45\uDD47-\uDD71\uDD73-\uDD76\uDD7A-\uDDA2\uDDA5-\uDDAA\uDDAE-\uDDCA\uDDCD-\uDDFF\uDE70-\uDE73\uDE78-\uDE7A\uDE80-\uDE82\uDE90-\uDE95])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFA\uDFE0-\uDFEB]|\uD83E[\uDD0D-\uDD3A\uDD3C-\uDD45\uDD47-\uDD71\uDD73-\uDD76\uDD7A-\uDDA2\uDDA5-\uDDAA\uDDAE-\uDDCA\uDDCD-\uDDFF\uDE70-\uDE73\uDE78-\uDE7A\uDE80-\uDE82\uDE90-\uDE95])\uFE0F|(?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDC8F\uDC91\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD0F\uDD18-\uDD1F\uDD26\uDD30-\uDD39\uDD3C-\uDD3E\uDDB5\uDDB6\uDDB8\uDDB9\uDDBB\uDDCD-\uDDCF\uDDD1-\uDDDD])/g}});var Fr=A((Ra,_t)=>{"use strict";var lo=yr(),co=Er(),fo=wr(),_r=n=>{if(typeof n!="string"||n.length===0||(n=lo(n),n.length===0))return 0;n=n.replace(fo()," ");let e=0;for(let t=0;t<n.length;t++){let r=n.codePointAt(t);r<=31||r>=127&&r<=159||r>=768&&r<=879||(r>65535&&t++,e+=co(r)?2:1)}return e};_t.exports=_r;_t.exports.default=_r});var Ft=A((Ta,Ar)=>{"use strict";var Br=Fr();function Je(n){return n?/\u001b\[((?:\d*;){0,5}\d*)m/g:/\u001b\[(?:\d*;){0,5}\d*m/g}function z(n){let e=Je();return(""+n).replace(e,"").split(`
|
|
3
|
-
`).reduce(function(i,o){return Br(o)>i?Br(o):i},0)}function
|
|
4
|
-
`);let i=t?
|
|
5
|
-
`)!=-1,r=this._styles,i=r.length;i--;){var o=ue[r[i]];e=o.open+e.replace(o.closeRe,o.open)+o.close,t&&(e=e.replace(
|
|
6
|
-
`))}wrapLines(e){let t=W.colorizeLines(e);return this.href?t.map(r=>W.hyperlink(this.href,r)):t}init(e){let t=this.x,r=this.y;this.widths=e.colWidths.slice(t,t+this.colSpan),this.heights=e.rowHeights.slice(r,r+this.rowSpan),this.width=this.widths.reduce(on,-1),this.height=this.heights.reduce(on,-1),this.hAlign=this.options.hAlign||e.colAligns[t],this.vAlign=this.options.vAlign||e.rowAligns[r],this.drawRight=t+this.colSpan==e.colWidths.length}draw(e,t){if(e=="top")return this.drawTop(this.drawRight);if(e=="bottom")return this.drawBottom(this.drawRight);let r=W.truncate(this.content,10,this.truncate);e
|
|
2
|
+
var Ti=Object.create;var Jt=Object.defineProperty;var Li=Object.getOwnPropertyDescriptor;var Pi=Object.getOwnPropertyNames;var Ii=Object.getPrototypeOf,Ni=Object.prototype.hasOwnProperty;var Xt=(n=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(n,{get:(e,t)=>(typeof require<"u"?require:e)[t]}):n)(function(n){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+n+'" is not supported')});var A=(n,e)=>()=>(e||n((e={exports:{}}).exports,e),e.exports);var Mi=(n,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Pi(e))!Ni.call(n,i)&&i!==t&&Jt(n,i,{get:()=>e[i],enumerable:!(r=Li(e,i))||r.enumerable});return n};var $i=(n,e,t)=>(t=n!=null?Ti(Ii(n)):{},Mi(e||!n||!n.__esModule?Jt(t,"default",{value:n,enumerable:!0}):t,n));var Ye=A((La,hr)=>{"use strict";var bt=[],pr=0,M=(n,e)=>{pr>=e&&bt.push(n)};M.WARN=1;M.INFO=2;M.DEBUG=3;M.reset=()=>{bt=[]};M.setDebugLevel=n=>{pr=n};M.warn=n=>M(n,M.WARN);M.info=n=>M(n,M.INFO);M.debug=n=>M(n,M.DEBUG);M.debugMessages=()=>bt;hr.exports=M});var Dr=A((Pa,mr)=>{"use strict";mr.exports=({onlyFirst:n=!1}={})=>{let e=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))"].join("|");return new RegExp(e,n?void 0:"g")}});var yr=A((Ia,gr)=>{"use strict";var lo=Dr();gr.exports=n=>typeof n=="string"?n.replace(lo(),""):n});var Er=A((Na,wt)=>{"use strict";var Cr=n=>Number.isNaN(n)?!1:n>=4352&&(n<=4447||n===9001||n===9002||11904<=n&&n<=12871&&n!==12351||12880<=n&&n<=19903||19968<=n&&n<=42182||43360<=n&&n<=43388||44032<=n&&n<=55203||63744<=n&&n<=64255||65040<=n&&n<=65049||65072<=n&&n<=65131||65281<=n&&n<=65376||65504<=n&&n<=65510||110592<=n&&n<=110593||127488<=n&&n<=127569||131072<=n&&n<=262141);wt.exports=Cr;wt.exports.default=Cr});var wr=A((Ma,br)=>{"use strict";br.exports=function(){return/\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F|\uD83D\uDC68(?:\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68\uD83C\uDFFB|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|[\u2695\u2696\u2708]\uFE0F|\uD83D[\uDC66\uDC67]|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708])\uFE0F|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C[\uDFFB-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)\uD83C\uDFFB|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB\uDFFC])|\uD83D\uDC69(?:\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB-\uDFFD])|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|(?:(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)\uFE0F|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDD])(?:(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\u200D[\u2640\u2642])|\uD83C\uDFF4\u200D\u2620)\uFE0F|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC15\u200D\uD83E\uDDBA|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF4\uD83C\uDDF2|\uD83C\uDDF6\uD83C\uDDE6|[#\*0-9]\uFE0F\u20E3|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83D\uDC69(?:\uD83C[\uDFFB-\uDFFF])|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83C\uDDE6(?:\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF])|\uD83C\uDDF0(?:\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF])|\uD83C\uDDED(?:\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA])|\uD83C\uDDE9(?:\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF])|\uD83C\uDDFE(?:\uD83C[\uDDEA\uDDF9])|\uD83C\uDDEC(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE])|\uD83C\uDDF8(?:\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF])|\uD83C\uDDEB(?:\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7])|\uD83C\uDDF5(?:\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE])|\uD83C\uDDFB(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA])|\uD83C\uDDF3(?:\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF])|\uD83C\uDDE8(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF])|\uD83C\uDDF1(?:\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE])|\uD83C\uDDFF(?:\uD83C[\uDDE6\uDDF2\uDDFC])|\uD83C\uDDFC(?:\uD83C[\uDDEB\uDDF8])|\uD83C\uDDFA(?:\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270A-\u270D]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC70\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDCAA\uDD74\uDD7A\uDD90\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD36\uDDB5\uDDB6\uDDBB\uDDD2-\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDED5\uDEEB\uDEEC\uDEF4-\uDEFA\uDFE0-\uDFEB]|\uD83E[\uDD0D-\uDD3A\uDD3C-\uDD45\uDD47-\uDD71\uDD73-\uDD76\uDD7A-\uDDA2\uDDA5-\uDDAA\uDDAE-\uDDCA\uDDCD-\uDDFF\uDE70-\uDE73\uDE78-\uDE7A\uDE80-\uDE82\uDE90-\uDE95])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFA\uDFE0-\uDFEB]|\uD83E[\uDD0D-\uDD3A\uDD3C-\uDD45\uDD47-\uDD71\uDD73-\uDD76\uDD7A-\uDDA2\uDDA5-\uDDAA\uDDAE-\uDDCA\uDDCD-\uDDFF\uDE70-\uDE73\uDE78-\uDE7A\uDE80-\uDE82\uDE90-\uDE95])\uFE0F|(?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDC8F\uDC91\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD0F\uDD18-\uDD1F\uDD26\uDD30-\uDD39\uDD3C-\uDD3E\uDDB5\uDDB6\uDDB8\uDDB9\uDDBB\uDDCD-\uDDCF\uDDD1-\uDDDD])/g}});var Fr=A(($a,_t)=>{"use strict";var co=yr(),fo=Er(),po=wr(),_r=n=>{if(typeof n!="string"||n.length===0||(n=co(n),n.length===0))return 0;n=n.replace(po()," ");let e=0;for(let t=0;t<n.length;t++){let r=n.codePointAt(t);r<=31||r>=127&&r<=159||r>=768&&r<=879||(r>65535&&t++,e+=fo(r)?2:1)}return e};_t.exports=_r;_t.exports.default=_r});var Ft=A((ja,Ar)=>{"use strict";var Br=Fr();function Je(n){return n?/\u001b\[((?:\d*;){0,5}\d*)m/g:/\u001b\[(?:\d*;){0,5}\d*m/g}function Y(n){let e=Je();return(""+n).replace(e,"").split(`
|
|
3
|
+
`).reduce(function(i,o){return Br(o)>i?Br(o):i},0)}function Re(n,e){return Array(e+1).join(n)}function ho(n,e,t,r){let i=Y(n);if(e+1>=i){let o=e-i;switch(r){case"right":{n=Re(t,o)+n;break}case"center":{let s=Math.ceil(o/2),a=o-s;n=Re(t,a)+n+Re(t,s);break}default:{n=n+Re(t,o);break}}}return n}var de={};function Te(n,e,t){e="\x1B["+e+"m",t="\x1B["+t+"m",de[e]={set:n,to:!0},de[t]={set:n,to:!1},de[n]={on:e,off:t}}Te("bold",1,22);Te("italics",3,23);Te("underline",4,24);Te("inverse",7,27);Te("strikethrough",9,29);function xr(n,e){let t=e[1]?parseInt(e[1].split(";")[0]):0;if(t>=30&&t<=39||t>=90&&t<=97){n.lastForegroundAdded=e[0];return}if(t>=40&&t<=49||t>=100&&t<=107){n.lastBackgroundAdded=e[0];return}if(t===0){for(let i in n)Object.prototype.hasOwnProperty.call(n,i)&&delete n[i];return}let r=de[e[0]];r&&(n[r.set]=r.to)}function mo(n){let e=Je(!0),t=e.exec(n),r={};for(;t!==null;)xr(r,t),t=e.exec(n);return r}function Sr(n,e){let t=n.lastBackgroundAdded,r=n.lastForegroundAdded;return delete n.lastBackgroundAdded,delete n.lastForegroundAdded,Object.keys(n).forEach(function(i){n[i]&&(e+=de[i].off)}),t&&t!="\x1B[49m"&&(e+="\x1B[49m"),r&&r!="\x1B[39m"&&(e+="\x1B[39m"),e}function Do(n,e){let t=n.lastBackgroundAdded,r=n.lastForegroundAdded;return delete n.lastBackgroundAdded,delete n.lastForegroundAdded,Object.keys(n).forEach(function(i){n[i]&&(e=de[i].on+e)}),t&&t!="\x1B[49m"&&(e=t+e),r&&r!="\x1B[39m"&&(e=r+e),e}function go(n,e){if(n.length===Y(n))return n.substr(0,e);for(;Y(n)>e;)n=n.slice(0,-1);return n}function yo(n,e){let t=Je(!0),r=n.split(Je()),i=0,o=0,s="",a,u={};for(;o<e;){a=t.exec(n);let c=r[i];if(i++,o+Y(c)>e&&(c=go(c,e-o)),s+=c,o+=Y(c),o<e){if(!a)break;s+=a[0],xr(u,a)}}return Sr(u,s)}function Co(n,e,t){if(t=t||"\u2026",Y(n)<=e)return n;e-=Y(t);let i=yo(n,e);i+=t;let o="\x1B]8;;\x07";return n.includes(o)&&!i.includes(o)&&(i+=o),i}function Eo(){return{chars:{top:"\u2500","top-mid":"\u252C","top-left":"\u250C","top-right":"\u2510",bottom:"\u2500","bottom-mid":"\u2534","bottom-left":"\u2514","bottom-right":"\u2518",left:"\u2502","left-mid":"\u251C",mid:"\u2500","mid-mid":"\u253C",right:"\u2502","right-mid":"\u2524",middle:"\u2502"},truncate:"\u2026",colWidths:[],rowHeights:[],colAligns:[],rowAligns:[],style:{"padding-left":1,"padding-right":1,head:["red"],border:["grey"],compact:!1},head:[]}}function bo(n,e){n=n||{},e=e||Eo();let t=Object.assign({},e,n);return t.chars=Object.assign({},e.chars,n.chars),t.style=Object.assign({},e.style,n.style),t}function wo(n,e){let t=[],r=e.split(/(\s+)/g),i=[],o=0,s;for(let a=0;a<r.length;a+=2){let u=r[a],c=o+Y(u);o>0&&s&&(c+=s.length),c>n?(o!==0&&t.push(i.join("")),i=[u],o=Y(u)):(i.push(s||"",u),o=c),s=r[a+1]}return o&&t.push(i.join("")),t}function _o(n,e){let t=[],r="";function i(s,a){for(r.length&&a&&(r+=a),r+=s;r.length>n;)t.push(r.slice(0,n)),r=r.slice(n)}let o=e.split(/(\s+)/g);for(let s=0;s<o.length;s+=2)i(o[s],s&&o[s-1]);return r.length&&t.push(r),t}function Fo(n,e,t=!0){let r=[];e=e.split(`
|
|
4
|
+
`);let i=t?wo:_o;for(let o=0;o<e.length;o++)r.push.apply(r,i(n,e[o]));return r}function Bo(n){let e={},t=[];for(let r=0;r<n.length;r++){let i=Do(e,n[r]);e=mo(i);let o=Object.assign({},e);t.push(Sr(o,i))}return t}function xo(n,e){return["\x1B]","8",";",";",n||e,"\x07",e,"\x1B]","8",";",";","\x07"].join("")}Ar.exports={strlen:Y,repeat:Re,pad:ho,truncate:Co,mergeOptions:bo,wordWrap:Fo,colorizeLines:Bo,hyperlink:xo}});var Rr=A((Ha,kr)=>{"use strict";var vr={};kr.exports=vr;var Or={reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],inverse:[7,27],hidden:[8,28],strikethrough:[9,29],black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],gray:[90,39],grey:[90,39],brightRed:[91,39],brightGreen:[92,39],brightYellow:[93,39],brightBlue:[94,39],brightMagenta:[95,39],brightCyan:[96,39],brightWhite:[97,39],bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgGray:[100,49],bgGrey:[100,49],bgBrightRed:[101,49],bgBrightGreen:[102,49],bgBrightYellow:[103,49],bgBrightBlue:[104,49],bgBrightMagenta:[105,49],bgBrightCyan:[106,49],bgBrightWhite:[107,49],blackBG:[40,49],redBG:[41,49],greenBG:[42,49],yellowBG:[43,49],blueBG:[44,49],magentaBG:[45,49],cyanBG:[46,49],whiteBG:[47,49]};Object.keys(Or).forEach(function(n){var e=Or[n],t=vr[n]=[];t.open="\x1B["+e[0]+"m",t.close="\x1B["+e[1]+"m"})});var Lr=A((Wa,Tr)=>{"use strict";Tr.exports=function(n,e){e=e||process.argv;var t=e.indexOf("--"),r=/^-{1,2}/.test(n)?"":"--",i=e.indexOf(r+n);return i!==-1&&(t===-1?!0:i<t)}});var Ir=A((Va,Pr)=>{"use strict";var So=Xt("os"),K=Lr(),j=process.env,pe=void 0;K("no-color")||K("no-colors")||K("color=false")?pe=!1:(K("color")||K("colors")||K("color=true")||K("color=always"))&&(pe=!0);"FORCE_COLOR"in j&&(pe=j.FORCE_COLOR.length===0||parseInt(j.FORCE_COLOR,10)!==0);function Ao(n){return n===0?!1:{level:n,hasBasic:!0,has256:n>=2,has16m:n>=3}}function Oo(n){if(pe===!1)return 0;if(K("color=16m")||K("color=full")||K("color=truecolor"))return 3;if(K("color=256"))return 2;if(n&&!n.isTTY&&pe!==!0)return 0;var e=pe?1:0;if(process.platform==="win32"){var t=So.release().split(".");return Number(process.versions.node.split(".")[0])>=8&&Number(t[0])>=10&&Number(t[2])>=10586?Number(t[2])>=14931?3:2:1}if("CI"in j)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI"].some(function(i){return i in j})||j.CI_NAME==="codeship"?1:e;if("TEAMCITY_VERSION"in j)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(j.TEAMCITY_VERSION)?1:0;if("TERM_PROGRAM"in j){var r=parseInt((j.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(j.TERM_PROGRAM){case"iTerm.app":return r>=3?3:2;case"Hyper":return 3;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(j.TERM)?2:/^screen|^xterm|^vt100|^rxvt|color|ansi|cygwin|linux/i.test(j.TERM)||"COLORTERM"in j?1:(j.TERM==="dumb",e)}function Bt(n){var e=Oo(n);return Ao(e)}Pr.exports={supportsColor:Bt,stdout:Bt(process.stdout),stderr:Bt(process.stderr)}});var Mr=A((Ga,Nr)=>{"use strict";Nr.exports=function(e,t){var r="";e=e||"Run the trap, drop the bass",e=e.split("");var i={a:["@","\u0104","\u023A","\u0245","\u0394","\u039B","\u0414"],b:["\xDF","\u0181","\u0243","\u026E","\u03B2","\u0E3F"],c:["\xA9","\u023B","\u03FE"],d:["\xD0","\u018A","\u0500","\u0501","\u0502","\u0503"],e:["\xCB","\u0115","\u018E","\u0258","\u03A3","\u03BE","\u04BC","\u0A6C"],f:["\u04FA"],g:["\u0262"],h:["\u0126","\u0195","\u04A2","\u04BA","\u04C7","\u050A"],i:["\u0F0F"],j:["\u0134"],k:["\u0138","\u04A0","\u04C3","\u051E"],l:["\u0139"],m:["\u028D","\u04CD","\u04CE","\u0520","\u0521","\u0D69"],n:["\xD1","\u014B","\u019D","\u0376","\u03A0","\u048A"],o:["\xD8","\xF5","\xF8","\u01FE","\u0298","\u047A","\u05DD","\u06DD","\u0E4F"],p:["\u01F7","\u048E"],q:["\u09CD"],r:["\xAE","\u01A6","\u0210","\u024C","\u0280","\u042F"],s:["\xA7","\u03DE","\u03DF","\u03E8"],t:["\u0141","\u0166","\u0373"],u:["\u01B1","\u054D"],v:["\u05D8"],w:["\u0428","\u0460","\u047C","\u0D70"],x:["\u04B2","\u04FE","\u04FC","\u04FD"],y:["\xA5","\u04B0","\u04CB"],z:["\u01B5","\u0240"]};return e.forEach(function(o){o=o.toLowerCase();var s=i[o]||[" "],a=Math.floor(Math.random()*s.length);typeof i[o]<"u"?r+=i[o][a]:r+=o}),r}});var jr=A((Ua,$r)=>{"use strict";$r.exports=function(e,t){e=e||" he is here ";var r={up:["\u030D","\u030E","\u0304","\u0305","\u033F","\u0311","\u0306","\u0310","\u0352","\u0357","\u0351","\u0307","\u0308","\u030A","\u0342","\u0313","\u0308","\u034A","\u034B","\u034C","\u0303","\u0302","\u030C","\u0350","\u0300","\u0301","\u030B","\u030F","\u0312","\u0313","\u0314","\u033D","\u0309","\u0363","\u0364","\u0365","\u0366","\u0367","\u0368","\u0369","\u036A","\u036B","\u036C","\u036D","\u036E","\u036F","\u033E","\u035B","\u0346","\u031A"],down:["\u0316","\u0317","\u0318","\u0319","\u031C","\u031D","\u031E","\u031F","\u0320","\u0324","\u0325","\u0326","\u0329","\u032A","\u032B","\u032C","\u032D","\u032E","\u032F","\u0330","\u0331","\u0332","\u0333","\u0339","\u033A","\u033B","\u033C","\u0345","\u0347","\u0348","\u0349","\u034D","\u034E","\u0353","\u0354","\u0355","\u0356","\u0359","\u035A","\u0323"],mid:["\u0315","\u031B","\u0300","\u0301","\u0358","\u0321","\u0322","\u0327","\u0328","\u0334","\u0335","\u0336","\u035C","\u035D","\u035E","\u035F","\u0360","\u0362","\u0338","\u0337","\u0361"," \u0489"]},i=[].concat(r.up,r.down,r.mid);function o(u){var c=Math.floor(Math.random()*u);return c}function s(u){var c=!1;return i.filter(function(l){c=l===u}),c}function a(u,c){var l="",f,d;c=c||{},c.up=typeof c.up<"u"?c.up:!0,c.mid=typeof c.mid<"u"?c.mid:!0,c.down=typeof c.down<"u"?c.down:!0,c.size=typeof c.size<"u"?c.size:"maxi",u=u.split("");for(d in u)if(!s(d)){switch(l=l+u[d],f={up:0,down:0,mid:0},c.size){case"mini":f.up=o(8),f.mid=o(2),f.down=o(8);break;case"maxi":f.up=o(16)+3,f.mid=o(4)+1,f.down=o(64)+3;break;default:f.up=o(8)+1,f.mid=o(6)/2,f.down=o(8)+1;break}var D=["up","mid","down"];for(var p in D)for(var h=D[p],g=0;g<=f[h];g++)c[h]&&(l=l+r[h][o(r[h].length)])}return l}return a(e,t)}});var Wr=A((Ka,Hr)=>{"use strict";Hr.exports=function(n){return function(e,t,r){if(e===" ")return e;switch(t%3){case 0:return n.red(e);case 1:return n.white(e);case 2:return n.blue(e)}}}});var Gr=A((qa,Vr)=>{"use strict";Vr.exports=function(n){return function(e,t,r){return t%2===0?e:n.inverse(e)}}});var Kr=A((za,Ur)=>{"use strict";Ur.exports=function(n){var e=["red","yellow","green","blue","magenta"];return function(t,r,i){return t===" "?t:n[e[r++%e.length]](t)}}});var zr=A((Ya,qr)=>{"use strict";qr.exports=function(n){var e=["underline","inverse","grey","yellow","red","green","blue","white","cyan","magenta","brightYellow","brightRed","brightGreen","brightBlue","brightWhite","brightCyan","brightMagenta"];return function(t,r,i){return t===" "?t:n[e[Math.round(Math.random()*(e.length-2))]](t)}}});var en=A((Xa,Zr)=>{"use strict";var E={};Zr.exports=E;E.themes={};var vo=Xt("util"),ue=E.styles=Rr(),Jr=Object.defineProperties,ko=new RegExp(/[\r\n]+/g);E.supportsColor=Ir().supportsColor;typeof E.enabled>"u"&&(E.enabled=E.supportsColor()!==!1);E.enable=function(){E.enabled=!0};E.disable=function(){E.enabled=!1};E.stripColors=E.strip=function(n){return(""+n).replace(/\x1B\[\d+m/g,"")};var Ja=E.stylize=function(e,t){if(!E.enabled)return e+"";var r=ue[t];return!r&&t in E?E[t](e):r.open+e+r.close},Ro=/[|\\{}()[\]^$+*?.]/g,To=function(n){if(typeof n!="string")throw new TypeError("Expected a string");return n.replace(Ro,"\\$&")};function Xr(n){var e=function t(){return Po.apply(t,arguments)};return e._styles=n,e.__proto__=Lo,e}var Qr=(function(){var n={};return ue.grey=ue.gray,Object.keys(ue).forEach(function(e){ue[e].closeRe=new RegExp(To(ue[e].close),"g"),n[e]={get:function(){return Xr(this._styles.concat(e))}}}),n})(),Lo=Jr(function(){},Qr);function Po(){var n=Array.prototype.slice.call(arguments),e=n.map(function(s){return s!=null&&s.constructor===String?s:vo.inspect(s)}).join(" ");if(!E.enabled||!e)return e;for(var t=e.indexOf(`
|
|
5
|
+
`)!=-1,r=this._styles,i=r.length;i--;){var o=ue[r[i]];e=o.open+e.replace(o.closeRe,o.open)+o.close,t&&(e=e.replace(ko,function(s){return o.close+s+o.open}))}return e}E.setTheme=function(n){if(typeof n=="string"){console.log("colors.setTheme now only accepts an object, not a string. If you are trying to set a theme from a file, it is now your (the caller's) responsibility to require the file. The old syntax looked like colors.setTheme(__dirname + '/../themes/generic-logging.js'); The new syntax looks like colors.setTheme(require(__dirname + '/../themes/generic-logging.js'));");return}for(var e in n)(function(t){E[t]=function(r){if(typeof n[t]=="object"){var i=r;for(var o in n[t])i=E[n[t][o]](i);return i}return E[n[t]](r)}})(e)};function Io(){var n={};return Object.keys(Qr).forEach(function(e){n[e]={get:function(){return Xr([e])}}}),n}var No=function(e,t){var r=t.split("");return r=r.map(e),r.join("")};E.trap=Mr();E.zalgo=jr();E.maps={};E.maps.america=Wr()(E);E.maps.zebra=Gr()(E);E.maps.rainbow=Kr()(E);E.maps.random=zr()(E);for(Yr in E.maps)(function(n){E[n]=function(e){return No(E.maps[n],e)}})(Yr);var Yr;Jr(E,Io())});var rn=A((Qa,tn)=>{"use strict";var Mo=en();tn.exports=Mo});var un=A((Za,Xe)=>{"use strict";var{info:$o,debug:sn}=Ye(),W=Ft(),St=class n{constructor(e){this.setOptions(e),this.x=null,this.y=null}setOptions(e){["boolean","number","bigint","string"].indexOf(typeof e)!==-1&&(e={content:""+e}),e=e||{},this.options=e;let t=e.content;if(["boolean","number","bigint","string"].indexOf(typeof t)!==-1)this.content=String(t);else if(!t)this.content=this.options.href||"";else throw new Error("Content needs to be a primitive, got: "+typeof t);this.colSpan=e.colSpan||1,this.rowSpan=e.rowSpan||1,this.options.href&&Object.defineProperty(this,"href",{get(){return this.options.href}})}mergeTableOptions(e,t){this.cells=t;let r=this.options.chars||{},i=e.chars,o=this.chars={};Ho.forEach(function(u){xt(r,i,u,o)}),this.truncate=this.options.truncate||e.truncate;let s=this.options.style=this.options.style||{},a=e.style;xt(s,a,"padding-left",this),xt(s,a,"padding-right",this),this.head=s.head||a.head,this.border=s.border||a.border,this.fixedWidth=e.colWidths[this.x],this.lines=this.computeLines(e),this.desiredWidth=W.strlen(this.content)+this.paddingLeft+this.paddingRight,this.desiredHeight=this.lines.length}computeLines(e){let t=e.wordWrap||e.textWrap,{wordWrap:r=t}=this.options;if(this.fixedWidth&&r){if(this.fixedWidth-=this.paddingLeft+this.paddingRight,this.colSpan){let s=1;for(;s<this.colSpan;)this.fixedWidth+=e.colWidths[this.x+s],s++}let{wrapOnWordBoundary:i=!0}=e,{wrapOnWordBoundary:o=i}=this.options;return this.wrapLines(W.wordWrap(this.fixedWidth,this.content,o))}return this.wrapLines(this.content.split(`
|
|
6
|
+
`))}wrapLines(e){let t=W.colorizeLines(e);return this.href?t.map(r=>W.hyperlink(this.href,r)):t}init(e){let t=this.x,r=this.y;this.widths=e.colWidths.slice(t,t+this.colSpan),this.heights=e.rowHeights.slice(r,r+this.rowSpan),this.width=this.widths.reduce(on,-1),this.height=this.heights.reduce(on,-1),this.hAlign=this.options.hAlign||e.colAligns[t],this.vAlign=this.options.vAlign||e.rowAligns[r],this.drawRight=t+this.colSpan==e.colWidths.length}draw(e,t){if(e=="top")return this.drawTop(this.drawRight);if(e=="bottom")return this.drawBottom(this.drawRight);let r=W.truncate(this.content,10,this.truncate);e||$o(`${this.y}-${this.x}: ${this.rowSpan-e}x${this.colSpan} Cell ${r}`);let i=Math.max(this.height-this.lines.length,0),o;switch(this.vAlign){case"center":o=Math.ceil(i/2);break;case"bottom":o=i;break;default:o=0}if(e<o||e>=o+this.lines.length)return this.drawEmpty(this.drawRight,t);let s=this.lines.length>this.height&&e+1>=this.height;return this.drawLine(e-o,this.drawRight,s,t)}drawTop(e){let t=[];return this.cells?this.widths.forEach(function(r,i){t.push(this._topLeftChar(i)),t.push(W.repeat(this.chars[this.y==0?"top":"mid"],r))},this):(t.push(this._topLeftChar(0)),t.push(W.repeat(this.chars[this.y==0?"top":"mid"],this.width))),e&&t.push(this.chars[this.y==0?"topRight":"rightMid"]),this.wrapWithStyleColors("border",t.join(""))}_topLeftChar(e){let t=this.x+e,r;if(this.y==0)r=t==0?"topLeft":e==0?"topMid":"top";else if(t==0)r="leftMid";else if(r=e==0?"midMid":"bottomMid",this.cells&&(this.cells[this.y-1][t]instanceof n.ColSpanCell&&(r=e==0?"topMid":"mid"),e==0)){let o=1;for(;this.cells[this.y][t-o]instanceof n.ColSpanCell;)o++;this.cells[this.y][t-o]instanceof n.RowSpanCell&&(r="leftMid")}return this.chars[r]}wrapWithStyleColors(e,t){if(this[e]&&this[e].length)try{let r=rn();for(let i=this[e].length-1;i>=0;i--)r=r[this[e][i]];return r(t)}catch{return t}else return t}drawLine(e,t,r,i){let o=this.chars[this.x==0?"left":"middle"];if(this.x&&i&&this.cells){let d=this.cells[this.y+i][this.x-1];for(;d instanceof Le;)d=this.cells[d.y][d.x-1];d instanceof Pe||(o=this.chars.rightMid)}let s=W.repeat(" ",this.paddingLeft),a=t?this.chars.right:"",u=W.repeat(" ",this.paddingRight),c=this.lines[e],l=this.width-(this.paddingLeft+this.paddingRight);r&&(c+=this.truncate||"\u2026");let f=W.truncate(c,l,this.truncate);return f=W.pad(f,l," ",this.hAlign),f=s+f+u,this.stylizeLine(o,f,a)}stylizeLine(e,t,r){return e=this.wrapWithStyleColors("border",e),r=this.wrapWithStyleColors("border",r),this.y===0&&(t=this.wrapWithStyleColors("head",t)),e+t+r}drawBottom(e){let t=this.chars[this.x==0?"bottomLeft":"bottomMid"],r=W.repeat(this.chars.bottom,this.width),i=e?this.chars.bottomRight:"";return this.wrapWithStyleColors("border",t+r+i)}drawEmpty(e,t){let r=this.chars[this.x==0?"left":"middle"];if(this.x&&t&&this.cells){let s=this.cells[this.y+t][this.x-1];for(;s instanceof Le;)s=this.cells[s.y][s.x-1];s instanceof Pe||(r=this.chars.rightMid)}let i=e?this.chars.right:"",o=W.repeat(" ",this.width);return this.stylizeLine(r,o,i)}},Le=class{constructor(){}draw(e){return typeof e=="number"&&sn(`${this.y}-${this.x}: 1x1 ColSpanCell`),""}init(){}mergeTableOptions(){}},Pe=class{constructor(e){this.originalCell=e}init(e){let t=this.y,r=this.originalCell.y;this.cellOffset=t-r,this.offset=jo(e.rowHeights,r,this.cellOffset)}draw(e){return e=="top"?this.originalCell.draw(this.offset,this.cellOffset):e=="bottom"?this.originalCell.draw("bottom"):(sn(`${this.y}-${this.x}: 1x${this.colSpan} RowSpanCell for ${this.originalCell.content}`),this.originalCell.draw(this.offset+1+e))}mergeTableOptions(){}};function nn(...n){return n.filter(e=>e!=null).shift()}function xt(n,e,t,r){let i=t.split("-");i.length>1?(i[1]=i[1].charAt(0).toUpperCase()+i[1].substr(1),i=i.join(""),r[i]=nn(n[i],n[t],e[i],e[t])):r[t]=nn(n[t],e[t])}function jo(n,e,t){let r=n[e];for(let i=1;i<t;i++)r+=1+n[e+i];return r}function on(n,e){return n+e+1}var Ho=["top","top-mid","top-left","top-right","bottom","bottom-mid","bottom-left","bottom-right","left","left-mid","mid","mid-mid","right","right-mid","middle"];Xe.exports=St;Xe.exports.ColSpanCell=Le;Xe.exports.RowSpanCell=Pe});var cn=A((el,ln)=>{"use strict";var{warn:Wo,debug:Vo}=Ye(),At=un(),{ColSpanCell:Go,RowSpanCell:Uo}=At;(function(){function n(D,p){return D[p]>0?n(D,p+1):p}function e(D){let p={};D.forEach(function(h,g){let y=0;h.forEach(function(C){C.y=g,C.x=g?n(p,y):y;let T=C.rowSpan||1,_=C.colSpan||1;if(T>1)for(let k=0;k<_;k++)p[C.x+k]=T;y=C.x+_}),Object.keys(p).forEach(C=>{p[C]--,p[C]<1&&delete p[C]})})}function t(D){let p=0;return D.forEach(function(h){h.forEach(function(g){p=Math.max(p,g.x+(g.colSpan||1))})}),p}function r(D){return D.length}function i(D,p){let h=D.y,g=D.y-1+(D.rowSpan||1),y=p.y,C=p.y-1+(p.rowSpan||1),T=!(h>C||y>g),_=D.x,k=D.x-1+(D.colSpan||1),Q=p.x,pt=p.x-1+(p.colSpan||1),v=!(_>pt||Q>k);return T&&v}function o(D,p,h){let g=Math.min(D.length-1,h),y={x:p,y:h};for(let C=0;C<=g;C++){let T=D[C];for(let _=0;_<T.length;_++)if(i(y,T[_]))return!0}return!1}function s(D,p,h,g){for(let y=h;y<g;y++)if(o(D,y,p))return!1;return!0}function a(D){D.forEach(function(p,h){p.forEach(function(g){for(let y=1;y<g.rowSpan;y++){let C=new Uo(g);C.x=g.x,C.y=g.y+y,C.colSpan=g.colSpan,c(C,D[h+y])}})})}function u(D){for(let p=D.length-1;p>=0;p--){let h=D[p];for(let g=0;g<h.length;g++){let y=h[g];for(let C=1;C<y.colSpan;C++){let T=new Go;T.x=y.x+C,T.y=y.y,h.splice(g+1,0,T)}}}}function c(D,p){let h=0;for(;h<p.length&&p[h].x<D.x;)h++;p.splice(h,0,D)}function l(D){let p=r(D),h=t(D);Vo(`Max rows: ${p}; Max cols: ${h}`);for(let g=0;g<p;g++)for(let y=0;y<h;y++)if(!o(D,y,g)){let C={x:y,y:g,colSpan:1,rowSpan:1};for(y++;y<h&&!o(D,y,g);)C.colSpan++,y++;let T=g+1;for(;T<p&&s(D,T,C.x,C.x+C.colSpan);)C.rowSpan++,T++;let _=new At(C);_.x=C.x,_.y=C.y,Wo(`Missing cell at ${_.y}-${_.x}.`),c(_,D[g])}}function f(D){return D.map(function(p){if(!Array.isArray(p)){let h=Object.keys(p)[0];p=p[h],Array.isArray(p)?(p=p.slice(),p.unshift(h)):p=[h,p]}return p.map(function(h){return new At(h)})})}function d(D){let p=f(D);return e(p),l(p),a(p),u(p),p}ln.exports={makeTableLayout:d,layoutTable:e,addRowSpanCells:a,maxWidth:t,fillInTable:l,computeWidths:an("colSpan","desiredWidth","x",1),computeHeights:an("rowSpan","desiredHeight","y",1)}})();function an(n,e,t,r){return function(i,o){let s=[],a=[],u={};o.forEach(function(c){c.forEach(function(l){(l[n]||1)>1?a.push(l):s[l[t]]=Math.max(s[l[t]]||0,l[e]||0,r)})}),i.forEach(function(c,l){typeof c=="number"&&(s[l]=c)});for(let c=a.length-1;c>=0;c--){let l=a[c],f=l[n],d=l[t],D=s[d],p=typeof i[d]=="number"?0:1;if(typeof D=="number")for(let h=1;h<f;h++)D+=1+s[d+h],typeof i[d+h]!="number"&&p++;else D=e==="desiredWidth"?l.desiredWidth-1:1,(!u[d]||u[d]<D)&&(u[d]=D);if(l[e]>D){let h=0;for(;p>0&&l[e]>D;){if(typeof i[d+h]!="number"){let g=Math.round((l[e]-D)/p);D+=g,s[d+h]+=g,p--}h++}}}Object.assign(i,s,u);for(let c=0;c<i.length;c++)i[c]=Math.max(r,i[c]||0)}}});var dn=A((tl,fn)=>{"use strict";var te=Ye(),Ko=Ft(),Ot=cn(),Qe=class extends Array{constructor(e){super();let t=Ko.mergeOptions(e);if(Object.defineProperty(this,"options",{value:t,enumerable:t.debug}),t.debug){switch(typeof t.debug){case"boolean":te.setDebugLevel(te.WARN);break;case"number":te.setDebugLevel(t.debug);break;case"string":te.setDebugLevel(parseInt(t.debug,10));break;default:te.setDebugLevel(te.WARN),te.warn(`Debug option is expected to be boolean, number, or string. Received a ${typeof t.debug}`)}Object.defineProperty(this,"messages",{get(){return te.debugMessages()}})}}toString(){let e=this,t=this.options.head&&this.options.head.length;t?(e=[this.options.head],this.length&&e.push.apply(e,this)):this.options.style.head=[];let r=Ot.makeTableLayout(e);r.forEach(function(o){o.forEach(function(s){s.mergeTableOptions(this.options,r)},this)},this),Ot.computeWidths(this.options.colWidths,r),Ot.computeHeights(this.options.rowHeights,r),r.forEach(function(o){o.forEach(function(s){s.init(this.options)},this)},this);let i=[];for(let o=0;o<r.length;o++){let s=r[o],a=this.options.rowHeights[o];(o===0||!this.options.style.compact||o==1&&t)&&vt(s,"top",i);for(let u=0;u<a;u++)vt(s,u,i);o+1==r.length&&vt(s,"bottom",i)}return i.join(`
|
|
7
7
|
`)}get width(){return this.toString().split(`
|
|
8
|
-
`)[0].length}};Qe.reset=()=>
|
|
9
|
-
`)}displayWidth(e){return
|
|
8
|
+
`)[0].length}};Qe.reset=()=>te.reset();function vt(n,e,t){let r=[];n.forEach(function(o){r.push(o.draw(e))});let i=r.join("");i.length&&t.push(i)}fn.exports=Qe});var hn=A((rl,pn)=>{"use strict";pn.exports=dn()});var Qt={name:"chrome-tools",version:"1.2.2",description:"CLI & Node.js library for chrome",type:"module",main:"./dist/index.js",types:"./dist/index.d.ts",exports:{".":{types:"./dist/index.d.ts",import:"./dist/index.js"},"./passwords":{types:"./dist/index.d.ts",import:"./dist/index.js"},"./bookmarks":{types:"./dist/index.d.ts",import:"./dist/index.js"},"./history":{types:"./dist/index.d.ts",import:"./dist/index.js"},"./cookies":{types:"./dist/index.d.ts",import:"./dist/index.js"},"./local-storage":{types:"./dist/index.d.ts",import:"./dist/index.js"},"./autofill":{types:"./dist/index.d.ts",import:"./dist/index.js"},"./downloads":{types:"./dist/index.d.ts",import:"./dist/index.js"},"./extensions":{types:"./dist/index.d.ts",import:"./dist/index.js"},"./search-engines":{types:"./dist/index.d.ts",import:"./dist/index.js"},"./top-sites":{types:"./dist/index.d.ts",import:"./dist/index.js"}},bin:{"chrome-tools":"dist/cli.js"},files:["dist"],scripts:{build:"node scripts/clean.mjs && tsup && tsc -p tsconfig.types.json && node scripts/finalize.mjs && node scripts/verify-dist.mjs",typecheck:"tsc --noEmit",lint:"oxlint --deny-warnings .",start:"node dist/cli.js",test:"npm run build && npm run typecheck && node scripts/test-unit.mjs && node dist/cli.js --help","test:chrome":"node test/compatibility/chrome.mjs","test:package":"node test/compatibility/package.mjs",release:"node scripts/release.mjs"},keywords:["chrome","bookmarks","history","cookies","autofill","browser","macos","windows","linux","cross-platform","keychain","dpapi","cli"],author:"",license:"MIT",packageManager:"pnpm@11.9.0",engines:{node:">=22.16.0"},devDependencies:{"@types/node":"^26.6.6",chalk:"^6.0.1","cli-table3":"^0.6.5",commander:"^15.1.0",oxlint:"1.77.0",tsup:"^8.5.1",tsx:"^4.23.15",typescript:"^7.0.2"}};var ne=class extends Error{constructor(e,t,r){super(r),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=t,this.exitCode=e,this.nestedError=void 0}},Z=class extends ne{constructor(e){super(1,"commander.invalidArgument",e),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};var xe=class{constructor(e,t){switch(this.description=t||"",this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,e[0]){case"<":this.required=!0,this._name=e.slice(1,-1);break;case"[":this.required=!1,this._name=e.slice(1,-1);break;default:this.required=!0,this._name=e;break}this._name.endsWith("...")&&(this.variadic=!0,this._name=this._name.slice(0,-3))}name(){return this._name}_collectValue(e,t){return t===this.defaultValue||!Array.isArray(t)?[e]:(t.push(e),t)}default(e,t){return this.defaultValue=e,this.defaultValueDescription=t,this}argParser(e){return this.parseArg=e,this}choices(e){return this.argChoices=e.slice(),this.parseArg=(t,r)=>{if(!this.argChoices.includes(t))throw new Z(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._collectValue(t,r):t},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}};function Ve(n){let e=n.name()+(n.variadic===!0?"...":"");return n.required?"<"+e+">":"["+e+"]"}import{EventEmitter as Gi}from"node:events";import mt from"node:child_process";import ee from"node:path";import Ue from"node:fs";import b from"node:process";import{stripVTControlCharacters as Ui}from"node:util";import{stripVTControlCharacters as Hi}from"node:util";var Se=class{constructor(){this.helpWidth=void 0,this.minWidthToWrap=40,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}prepareContext(e){this.helpWidth=this.helpWidth??e.helpWidth??80}visibleCommands(e){let t=e.commands.filter(i=>!i._hidden),r=e._getHelpCommand();return r&&!r._hidden&&t.push(r),this.sortSubcommands&&t.sort((i,o)=>i.name().localeCompare(o.name())),t}compareOptions(e,t){let r=i=>i.short?i.short.replace(/^-/,""):i.long.replace(/^--/,"");return r(e).localeCompare(r(t))}visibleOptions(e){let t=e.options.filter(i=>!i.hidden),r=e._getHelpOption();if(r&&!r.hidden){let i=r.short&&e._findOption(r.short),o=r.long&&e._findOption(r.long);!i&&!o?t.push(r):r.long&&!o?t.push(e.createOption(r.long,r.description).helpGroup(r.helpGroupHeading)):r.short&&!i&&t.push(e.createOption(r.short,r.description).helpGroup(r.helpGroupHeading))}return this.sortOptions&&t.sort(this.compareOptions),t}visibleGlobalOptions(e){if(!this.showGlobalOptions)return[];let t=[];for(let r=e.parent;r;r=r.parent){let i=r.options.filter(o=>!o.hidden);t.push(...i)}return this.sortOptions&&t.sort(this.compareOptions),t}visibleArguments(e){return e._argsDescription&&e.registeredArguments.forEach(t=>{t.description=t.description||e._argsDescription[t.name()]||""}),e.registeredArguments.find(t=>t.description)?e.registeredArguments:[]}subcommandTerm(e){let t=e.registeredArguments.map(r=>Ve(r)).join(" ");return e._name+(e._aliases[0]?"|"+e._aliases[0]:"")+(e.options.length?" [options]":"")+(t?" "+t:"")}optionTerm(e){return e.flags}argumentTerm(e){return e.name()}longestSubcommandTermLength(e,t){return t.visibleCommands(e).reduce((r,i)=>Math.max(r,this.displayWidth(t.styleSubcommandTerm(t.subcommandTerm(i)))),0)}longestOptionTermLength(e,t){return t.visibleOptions(e).reduce((r,i)=>Math.max(r,this.displayWidth(t.styleOptionTerm(t.optionTerm(i)))),0)}longestGlobalOptionTermLength(e,t){return t.visibleGlobalOptions(e).reduce((r,i)=>Math.max(r,this.displayWidth(t.styleOptionTerm(t.optionTerm(i)))),0)}longestArgumentTermLength(e,t){return t.visibleArguments(e).reduce((r,i)=>Math.max(r,this.displayWidth(t.styleArgumentTerm(t.argumentTerm(i)))),0)}commandUsage(e){let t=e._name;e._aliases[0]&&(t=t+"|"+e._aliases[0]);let r="";for(let i=e.parent;i;i=i.parent)r=i.name()+" "+r;return r+t+" "+e.usage()}commandDescription(e){return e.description()}subcommandDescription(e){return e.summary()||e.description()}optionDescription(e){let t=[];if(e.argChoices&&t.push(`choices: ${e.argChoices.map(r=>JSON.stringify(r)).join(", ")}`),e.defaultValue!==void 0&&(e.required||e.optional||e.isBoolean()&&typeof e.defaultValue=="boolean")&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),e.presetArg!==void 0&&e.optional&&t.push(`preset: ${JSON.stringify(e.presetArg)}`),e.envVar!==void 0&&t.push(`env: ${e.envVar}`),t.length>0){let r=`(${t.join(", ")})`;return e.description?`${e.description} ${r}`:r}return e.description}argumentDescription(e){let t=[];if(e.argChoices&&t.push(`choices: ${e.argChoices.map(r=>JSON.stringify(r)).join(", ")}`),e.defaultValue!==void 0&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),t.length>0){let r=`(${t.join(", ")})`;return e.description?`${e.description} ${r}`:r}return e.description}formatItemList(e,t,r){return t.length===0?[]:[r.styleTitle(e),...t,""]}groupItems(e,t,r){let i=new Map;return e.forEach(o=>{let s=r(o);i.has(s)||i.set(s,[])}),t.forEach(o=>{let s=r(o);i.has(s)||i.set(s,[]),i.get(s).push(o)}),i}formatHelp(e,t){let r=t.padWidth(e,t),i=t.helpWidth??80;function o(f,d){return t.formatItem(f,r,d,t)}let s=[`${t.styleTitle("Usage:")} ${t.styleUsage(t.commandUsage(e))}`,""],a=t.commandDescription(e);a.length>0&&(s=s.concat([t.boxWrap(t.styleCommandDescription(a),i),""]));let u=t.visibleArguments(e).map(f=>o(t.styleArgumentTerm(t.argumentTerm(f)),t.styleArgumentDescription(t.argumentDescription(f))));if(s=s.concat(this.formatItemList("Arguments:",u,t)),this.groupItems(e.options,t.visibleOptions(e),f=>f.helpGroupHeading??"Options:").forEach((f,d)=>{let D=f.map(p=>o(t.styleOptionTerm(t.optionTerm(p)),t.styleOptionDescription(t.optionDescription(p))));s=s.concat(this.formatItemList(d,D,t))}),t.showGlobalOptions){let f=t.visibleGlobalOptions(e).map(d=>o(t.styleOptionTerm(t.optionTerm(d)),t.styleOptionDescription(t.optionDescription(d))));s=s.concat(this.formatItemList("Global Options:",f,t))}return this.groupItems(e.commands,t.visibleCommands(e),f=>f.helpGroup()||"Commands:").forEach((f,d)=>{let D=f.map(p=>o(t.styleSubcommandTerm(t.subcommandTerm(p)),t.styleSubcommandDescription(t.subcommandDescription(p))));s=s.concat(this.formatItemList(d,D,t))}),s.join(`
|
|
9
|
+
`)}displayWidth(e){return Hi(e).length}styleTitle(e){return e}styleUsage(e){return e.split(" ").map(t=>t==="[options]"?this.styleOptionText(t):t==="[command]"?this.styleSubcommandText(t):t[0]==="["||t[0]==="<"?this.styleArgumentText(t):this.styleCommandText(t)).join(" ")}styleCommandDescription(e){return this.styleDescriptionText(e)}styleOptionDescription(e){return this.styleDescriptionText(e)}styleSubcommandDescription(e){return this.styleDescriptionText(e)}styleArgumentDescription(e){return this.styleDescriptionText(e)}styleDescriptionText(e){return e}styleOptionTerm(e){return this.styleOptionText(e)}styleSubcommandTerm(e){return e.split(" ").map(t=>t==="[options]"?this.styleOptionText(t):t[0]==="["||t[0]==="<"?this.styleArgumentText(t):this.styleSubcommandText(t)).join(" ")}styleArgumentTerm(e){return this.styleArgumentText(e)}styleOptionText(e){return e}styleArgumentText(e){return e}styleSubcommandText(e){return e}styleCommandText(e){return e}padWidth(e,t){return Math.max(t.longestOptionTermLength(e,t),t.longestGlobalOptionTermLength(e,t),t.longestSubcommandTermLength(e,t),t.longestArgumentTermLength(e,t))}preformatted(e){return/\n[^\S\r\n]/.test(e)}formatItem(e,t,r,i){let s=" ".repeat(2);if(!r)return s+e;let a=e.padEnd(t+e.length-i.displayWidth(e)),u=2,l=(this.helpWidth??80)-t-u-2,f;return l<this.minWidthToWrap||i.preformatted(r)?f=r:f=i.boxWrap(r,l).replace(/\n/g,`
|
|
10
10
|
`+" ".repeat(t+u)),s+a+" ".repeat(u)+f.replace(/\n/g,`
|
|
11
11
|
${s}`)}boxWrap(e,t){if(t<this.minWidthToWrap)return e;let r=e.split(/\r\n|\n/),i=/[\s]*[^\s]+/g,o=[];return r.forEach(s=>{let a=s.match(i);if(a===null){o.push("");return}let u=[a.shift()],c=this.displayWidth(u[0]);a.forEach(l=>{let f=this.displayWidth(l);if(c+f<=t){u.push(l),c+=f;return}o.push(u.join(""));let d=l.trimStart();u=[d],c=this.displayWidth(d)}),o.push(u.join(""))}),o.join(`
|
|
12
|
-
`)}};var ce=class{constructor(e,t){this.flags=e,this.description=t||"",this.required=e.includes("<"),this.optional=e.includes("["),this.variadic=new RegExp("\\p{ID_Continue}\\.\\.\\.[>\\]]$","u").test(e),this.mandatory=!1;let r=
|
|
12
|
+
`)}};var ce=class{constructor(e,t){this.flags=e,this.description=t||"",this.required=e.includes("<"),this.optional=e.includes("["),this.variadic=new RegExp("\\p{ID_Continue}\\.\\.\\.[>\\]]$","u").test(e),this.mandatory=!1;let r=Wi(e);this.short=r.shortFlag,this.long=r.longFlag,this.negate=!1,this.long&&(this.negate=this.long.startsWith("--no-")),this.defaultValue=void 0,this.defaultValueDescription=void 0,this.presetArg=void 0,this.envVar=void 0,this.parseArg=void 0,this.hidden=!1,this.argChoices=void 0,this.conflictsWith=[],this.implied=void 0,this.helpGroupHeading=void 0}default(e,t){return this.defaultValue=e,this.defaultValueDescription=t,this}preset(e){return this.presetArg=e,this}conflicts(e){return this.conflictsWith=this.conflictsWith.concat(e),this}implies(e){let t=e;return typeof e=="string"&&(t={[e]:!0}),this.implied=Object.assign(this.implied||{},t),this}env(e){return this.envVar=e,this}argParser(e){return this.parseArg=e,this}makeOptionMandatory(e=!0){return this.mandatory=!!e,this}hideHelp(e=!0){return this.hidden=!!e,this}_collectValue(e,t){return t===this.defaultValue||!Array.isArray(t)?[e]:(t.push(e),t)}choices(e){return this.argChoices=e.slice(),this.parseArg=(t,r)=>{if(!this.argChoices.includes(t))throw new Z(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._collectValue(t,r):t},this}name(){return this.long?this.long.replace(/^--/,""):this.short.replace(/^-/,"")}attributeName(){return this.negate?Zt(this.name().replace(/^no-/,"")):Zt(this.name())}helpGroup(e){return this.helpGroupHeading=e,this}is(e){return this.short===e||this.long===e}isBoolean(){return!this.required&&!this.optional&&!this.negate}},Ge=class{constructor(e){this.positiveOptions=new Map,this.negativeOptions=new Map,this.dualOptions=new Set,e.forEach(t=>{t.negate?this.negativeOptions.set(t.attributeName(),t):this.positiveOptions.set(t.attributeName(),t)}),this.negativeOptions.forEach((t,r)=>{this.positiveOptions.has(r)&&this.dualOptions.add(r)})}valueFromOption(e,t){let r=t.attributeName();if(!this.dualOptions.has(r))return!0;let i=this.negativeOptions.get(r).presetArg,o=i!==void 0?i:!1;return t.negate===(o===e)}};function Zt(n){return n.split("-").reduce((e,t)=>e+t[0].toUpperCase()+t.slice(1))}function Wi(n){let e,t,r=/^-[^-]$/,i=/^--[^-]/,o=n.split(/[ |,]+/).concat("guard");if(r.test(o[0])&&(e=o.shift()),i.test(o[0])&&(t=o.shift()),!e&&r.test(o[0])&&(e=o.shift()),!e&&i.test(o[0])&&(e=t,t=o.shift()),o[0].startsWith("-")){let s=o[0],a=`option creation failed due to '${s}' in option flags '${n}'`;throw/^-[^-][^-]/.test(s)?new Error(`${a}
|
|
13
13
|
- a short flag is a single dash and a single character
|
|
14
14
|
- either use a single dash and a single character (for a short flag)
|
|
15
15
|
- or use a double dash for a long option (and can have two, like '--ws, --workspace')`):r.test(s)?new Error(`${a}
|
|
16
16
|
- too many short flags`):i.test(s)?new Error(`${a}
|
|
17
17
|
- too many long flags`):new Error(`${a}
|
|
18
|
-
- unrecognised flag format`)}if(e===void 0&&t===void 0)throw new Error(`option creation failed due to no flags found in '${n}'.`);return{shortFlag:e,longFlag:t}}function
|
|
18
|
+
- unrecognised flag format`)}if(e===void 0&&t===void 0)throw new Error(`option creation failed due to no flags found in '${n}'.`);return{shortFlag:e,longFlag:t}}function Vi(n,e){if(Math.abs(n.length-e.length)>3)return Math.max(n.length,e.length);let t=[];for(let r=0;r<=n.length;r++)t[r]=[r];for(let r=0;r<=e.length;r++)t[0][r]=r;for(let r=1;r<=e.length;r++)for(let i=1;i<=n.length;i++){let o;n[i-1]===e[r-1]?o=0:o=1,t[i][r]=Math.min(t[i-1][r]+1,t[i][r-1]+1,t[i-1][r-1]+o),i>1&&r>1&&n[i-1]===e[r-2]&&n[i-2]===e[r-1]&&(t[i][r]=Math.min(t[i][r],t[i-2][r-2]+1))}return t[n.length][e.length]}function ht(n,e){if(!e||e.length===0)return"";e=Array.from(new Set(e));let t=n.startsWith("--");t&&(n=n.slice(2),e=e.map(s=>s.slice(2)));let r=[],i=3,o=.4;return e.forEach(s=>{if(s.length<=1)return;let a=Vi(n,s),u=Math.max(n.length,s.length);(u-a)/u>o&&(a<i?(i=a,r=[s]):a===i&&r.push(s))}),r.sort((s,a)=>s.localeCompare(a)),t&&(r=r.map(s=>`--${s}`)),r.length>1?`
|
|
19
19
|
(Did you mean one of ${r.join(", ")}?)`:r.length===1?`
|
|
20
|
-
(Did you mean ${r[0]}?)`:""}var fe=class n extends
|
|
21
|
-
- specify the name in Command constructor or using .name()`);return t=t||{},t.isDefault&&(this._defaultCommandName=e._name),(t.noHelp||t.hidden)&&(e._hidden=!0),this._registerCommand(e),e.parent=this,e._checkForBrokenPassThrough(),this}createArgument(e,t){return new
|
|
20
|
+
(Did you mean ${r[0]}?)`:""}var fe=class n extends Gi{constructor(e){super(),this.commands=[],this.options=[],this.parent=null,this._allowUnknownOption=!1,this._allowExcessArguments=!1,this.registeredArguments=[],this._args=this.registeredArguments,this.args=[],this.rawArgs=[],this.processedArgs=[],this._scriptPath=null,this._name=e||"",this._optionValues={},this._optionValueSources={},this._storeOptionsAsProperties=!1,this._actionHandler=null,this._executableHandler=!1,this._executableFile=null,this._executableDir=null,this._defaultCommandName=null,this._exitCallback=null,this._aliases=[],this._combineFlagAndOptionalValue=!0,this._description="",this._summary="",this._argsDescription=void 0,this._enablePositionalOptions=!1,this._passThroughOptions=!1,this._lifeCycleHooks={},this._showHelpAfterError=!1,this._showSuggestionAfterError=!0,this._savedState=null,this._outputConfiguration={writeOut:t=>b.stdout.write(t),writeErr:t=>b.stderr.write(t),outputError:(t,r)=>r(t),getOutHelpWidth:()=>b.stdout.isTTY?b.stdout.columns:void 0,getErrHelpWidth:()=>b.stderr.isTTY?b.stderr.columns:void 0,getOutHasColors:()=>tr()??(b.stdout.isTTY&&b.stdout.hasColors?.()),getErrHasColors:()=>tr()??(b.stderr.isTTY&&b.stderr.hasColors?.()),stripColor:t=>Ui(t)},this._hidden=!1,this._helpOption=void 0,this._addImplicitHelpCommand=void 0,this._helpCommand=void 0,this._helpConfiguration={},this._helpGroupHeading=void 0,this._defaultCommandGroup=void 0,this._defaultOptionGroup=void 0}copyInheritedSettings(e){return this._outputConfiguration=e._outputConfiguration,this._helpOption=e._helpOption,this._helpCommand=e._helpCommand,this._helpConfiguration=e._helpConfiguration,this._exitCallback=e._exitCallback,this._storeOptionsAsProperties=e._storeOptionsAsProperties,this._combineFlagAndOptionalValue=e._combineFlagAndOptionalValue,this._allowExcessArguments=e._allowExcessArguments,this._enablePositionalOptions=e._enablePositionalOptions,this._showHelpAfterError=e._showHelpAfterError,this._showSuggestionAfterError=e._showSuggestionAfterError,this}_getCommandAndAncestors(){let e=[];for(let t=this;t;t=t.parent)e.push(t);return e}command(e,t,r){let i=t,o=r;typeof i=="object"&&i!==null&&(o=i,i=null),o=o||{};let[,s,a]=e.match(/([^ ]+) *(.*)/),u=this.createCommand(s);return i&&(u.description(i),u._executableHandler=!0),o.isDefault&&(this._defaultCommandName=u._name),u._hidden=!!(o.noHelp||o.hidden),u._executableFile=o.executableFile||null,a&&u.arguments(a),this._registerCommand(u),u.parent=this,u.copyInheritedSettings(this),i?this:u}createCommand(e){return new n(e)}createHelp(){return Object.assign(new Se,this.configureHelp())}configureHelp(e){return e===void 0?this._helpConfiguration:(this._helpConfiguration=e,this)}configureOutput(e){return e===void 0?this._outputConfiguration:(this._outputConfiguration={...this._outputConfiguration,...e},this)}showHelpAfterError(e=!0){return typeof e!="string"&&(e=!!e),this._showHelpAfterError=e,this}showSuggestionAfterError(e=!0){return this._showSuggestionAfterError=!!e,this}addCommand(e,t){if(!e._name)throw new Error(`Command passed to .addCommand() must have a name
|
|
21
|
+
- specify the name in Command constructor or using .name()`);return t=t||{},t.isDefault&&(this._defaultCommandName=e._name),(t.noHelp||t.hidden)&&(e._hidden=!0),this._registerCommand(e),e.parent=this,e._checkForBrokenPassThrough(),this}createArgument(e,t){return new xe(e,t)}argument(e,t,r,i){let o=this.createArgument(e,t);return typeof r=="function"?o.default(i).argParser(r):o.default(r),this.addArgument(o),this}arguments(e){return e.trim().split(/ +/).forEach(t=>{this.argument(t)}),this}addArgument(e){let t=this.registeredArguments.slice(-1)[0];if(t?.variadic)throw new Error(`only the last argument can be variadic '${t.name()}'`);if(e.required&&e.defaultValue!==void 0&&e.parseArg===void 0)throw new Error(`a default value for a required argument is never used: '${e.name()}'`);return this.registeredArguments.push(e),this}helpCommand(e,t){if(typeof e=="boolean")return this._addImplicitHelpCommand=e,e&&this._defaultCommandGroup&&this._initCommandGroup(this._getHelpCommand()),this;let r=e??"help [command]",[,i,o]=r.match(/([^ ]+) *(.*)/),s=t??"display help for command",a=this.createCommand(i);return a.helpOption(!1),o&&a.arguments(o),s&&a.description(s),this._addImplicitHelpCommand=!0,this._helpCommand=a,(e||t)&&this._initCommandGroup(a),this}addHelpCommand(e,t){return typeof e!="object"?(this.helpCommand(e,t),this):(this._addImplicitHelpCommand=!0,this._helpCommand=e,this._initCommandGroup(e),this)}_getHelpCommand(){return this._addImplicitHelpCommand??(this.commands.length&&!this._actionHandler&&!this._findCommand("help"))?(this._helpCommand===void 0&&this.helpCommand(void 0,void 0),this._helpCommand):null}hook(e,t){let r=["preSubcommand","preAction","postAction"];if(!r.includes(e))throw new Error(`Unexpected value for event passed to hook : '${e}'.
|
|
22
22
|
Expecting one of '${r.join("', '")}'`);return this._lifeCycleHooks[e]?this._lifeCycleHooks[e].push(t):this._lifeCycleHooks[e]=[t],this}exitOverride(e){return e?this._exitCallback=e:this._exitCallback=t=>{if(t.code!=="commander.executeSubCommandAsync")throw t},this}_exit(e,t,r){this._exitCallback&&this._exitCallback(new ne(e,t,r)),b.exit(e)}action(e){let t=r=>{let i=this.registeredArguments.length,o=r.slice(0,i);return this._storeOptionsAsProperties?o[i]=this:o[i]=this.opts(),o.push(this),e.apply(this,o)};return this._actionHandler=t,this}createOption(e,t){return new ce(e,t)}_callParseArg(e,t,r,i){try{return e.parseArg(t,r)}catch(o){if(o.code==="commander.invalidArgument"){let s=`${i} ${o.message}`;this.error(s,{exitCode:o.exitCode,code:o.code})}throw o}}_registerOption(e){let t=e.short&&this._findOption(e.short)||e.long&&this._findOption(e.long);if(t){let r=e.long&&this._findOption(e.long)?e.long:e.short;throw new Error(`Cannot add option '${e.flags}'${this._name&&` to command '${this._name}'`} due to conflicting flag '${r}'
|
|
23
23
|
- already used by option '${t.flags}'`)}this._initOptionGroup(e),this.options.push(e)}_registerCommand(e){let t=i=>[i.name()].concat(i.aliases()),r=t(e).find(i=>this._findCommand(i));if(r){let i=t(this._findCommand(r)).join("|"),o=t(e).join("|");throw new Error(`cannot add command '${o}' as already have command '${i}'`)}this._initCommandGroup(e),this.commands.push(e)}addOption(e){this._registerOption(e);let t=e.name(),r=e.attributeName();e.defaultValue!==void 0&&this.setOptionValueWithSource(r,e.defaultValue,"default");let i=(o,s,a)=>{o==null&&e.presetArg!==void 0&&(o=e.presetArg);let u=this.getOptionValue(r);o!==null&&e.parseArg?o=this._callParseArg(e,o,u,s):o!==null&&e.variadic&&(o=e._collectValue(o,u)),o==null&&(e.negate?o=!1:e.isBoolean()||e.optional?o=!0:o=""),this.setOptionValueWithSource(r,o,a)};return this.on("option:"+t,o=>{let s=`error: option '${e.flags}' argument '${o}' is invalid.`;i(o,s,"cli")}),e.envVar&&this.on("optionEnv:"+t,o=>{let s=`error: option '${e.flags}' value '${o}' from env '${e.envVar}' is invalid.`;i(o,s,"env")}),this}_optionEx(e,t,r,i,o){if(typeof t=="object"&&t instanceof ce)throw new Error("To add an Option object use addOption() instead of option() or requiredOption()");let s=this.createOption(t,r);if(s.makeOptionMandatory(!!e.mandatory),typeof i=="function")s.default(o).argParser(i);else if(i instanceof RegExp){let a=i;i=(u,c)=>{let l=a.exec(u);return l?l[0]:c},s.default(o).argParser(i)}else s.default(i);return this.addOption(s)}option(e,t,r,i){return this._optionEx({},e,t,r,i)}requiredOption(e,t,r,i){return this._optionEx({mandatory:!0},e,t,r,i)}combineFlagAndOptionalValue(e=!0){return this._combineFlagAndOptionalValue=!!e,this}allowUnknownOption(e=!0){return this._allowUnknownOption=!!e,this}allowExcessArguments(e=!0){return this._allowExcessArguments=!!e,this}enablePositionalOptions(e=!0){return this._enablePositionalOptions=!!e,this}passThroughOptions(e=!0){return this._passThroughOptions=!!e,this._checkForBrokenPassThrough(),this}_checkForBrokenPassThrough(){if(this.parent&&this._passThroughOptions&&!this.parent._enablePositionalOptions)throw new Error(`passThroughOptions cannot be used for '${this._name}' without turning on enablePositionalOptions for parent command(s)`)}storeOptionsAsProperties(e=!0){if(this.options.length)throw new Error("call .storeOptionsAsProperties() before adding options");if(Object.keys(this._optionValues).length)throw new Error("call .storeOptionsAsProperties() before setting option values");return this._storeOptionsAsProperties=!!e,this}getOptionValue(e){return this._storeOptionsAsProperties?this[e]:this._optionValues[e]}setOptionValue(e,t){return this.setOptionValueWithSource(e,t,void 0)}setOptionValueWithSource(e,t,r){return this._storeOptionsAsProperties?this[e]=t:this._optionValues[e]=t,this._optionValueSources[e]=r,this}getOptionValueSource(e){return this._optionValueSources[e]}getOptionValueSourceWithGlobals(e){let t;return this._getCommandAndAncestors().forEach(r=>{Object.hasOwn(r._optionValueSources,e)&&(t=r.getOptionValueSource(e))}),t}_prepareUserArgs(e,t){if(e!==void 0&&!Array.isArray(e))throw new Error("first parameter to parse must be array or undefined");if(t=t||{},e===void 0&&t.from===void 0){b.versions?.electron&&(t.from="electron");let i=b.execArgv??[];(i.includes("-e")||i.includes("--eval")||i.includes("-p")||i.includes("--print"))&&(t.from="eval")}e===void 0&&(e=b.argv),this.rawArgs=e.slice();let r;switch(t.from){case void 0:case"node":this._scriptPath=e[1],r=e.slice(2);break;case"electron":b.defaultApp?(this._scriptPath=e[1],r=e.slice(2)):r=e.slice(1);break;case"user":r=e.slice(0);break;case"eval":r=e.slice(1);break;default:throw new Error(`unexpected parse option { from: '${t.from}' }`)}return!this._name&&this._scriptPath&&this.nameFromFilename(this._scriptPath),this._name=this._name||"program",r}parse(e,t){this._prepareForParse();let r=this._prepareUserArgs(e,t);return this._parseCommand([],r),this}async parseAsync(e,t){this._prepareForParse();let r=this._prepareUserArgs(e,t);return await this._parseCommand([],r),this}_prepareForParse(){this._savedState===null?(this.options.filter(e=>e.negate&&e.defaultValue===void 0&&this.getOptionValue(e.attributeName())===void 0).forEach(e=>{let t=e.long.replace(/^--no-/,"--");this._findOption(t)||this.setOptionValueWithSource(e.attributeName(),!0,"default")}),this.saveStateBeforeParse()):this.restoreStateBeforeParse()}saveStateBeforeParse(){this._savedState={_name:this._name,_optionValues:{...this._optionValues},_optionValueSources:{...this._optionValueSources}}}restoreStateBeforeParse(){if(this._storeOptionsAsProperties)throw new Error(`Can not call parse again when storeOptionsAsProperties is true.
|
|
24
24
|
- either make a new Command for each call to parse, or stop storing options as properties`);this._name=this._savedState._name,this._scriptPath=null,this.rawArgs=[],this._optionValues={...this._savedState._optionValues},this._optionValueSources={...this._savedState._optionValueSources},this.args=[],this.processedArgs=[]}_checkForMissingExecutable(e,t,r){if(Ue.existsSync(e))return;let i=t?`searched for local subcommand relative to directory '${t}'`:"no directory for search for local subcommand, use .executableDir() to supply a custom directory",o=`'${e}' does not exist
|
|
25
25
|
- if '${r}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead
|
|
26
26
|
- if the default executable name is not suitable, use the executableFile option to supply a custom name or path
|
|
27
|
-
- ${i}`;throw new Error(o)}_executeSubCommand(e,t){t=t.slice();let r=[".js",".ts",".tsx",".mjs",".cjs"];function i(l,f){let d=
|
|
27
|
+
- ${i}`;throw new Error(o)}_executeSubCommand(e,t){t=t.slice();let r=[".js",".ts",".tsx",".mjs",".cjs"];function i(l,f){let d=ee.resolve(l,f);if(Ue.existsSync(d))return d;if(r.includes(ee.extname(f)))return;let D=r.find(p=>Ue.existsSync(`${d}${p}`));if(D)return`${d}${D}`}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let o=e._executableFile||`${this._name}-${e._name}`,s=this._executableDir||"";if(this._scriptPath){let l;try{l=Ue.realpathSync(this._scriptPath)}catch{l=this._scriptPath}s=ee.resolve(ee.dirname(l),s)}if(s){let l=i(s,o);if(!l&&!e._executableFile&&this._scriptPath){let f=ee.basename(this._scriptPath,ee.extname(this._scriptPath));f!==this._name&&(l=i(s,`${f}-${e._name}`))}o=l||o}let a=r.includes(ee.extname(o)),u;b.platform!=="win32"?a?(t.unshift(o),t=er(b.execArgv).concat(t),u=mt.spawn(b.argv[0],t,{stdio:"inherit"})):u=mt.spawn(o,t,{stdio:"inherit"}):(this._checkForMissingExecutable(o,s,e._name),t.unshift(o),t=er(b.execArgv).concat(t),u=mt.spawn(b.execPath,t,{stdio:"inherit"})),u.killed||["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach(f=>{b.on(f,()=>{u.killed===!1&&u.exitCode===null&&u.kill(f)})});let c=this._exitCallback;u.on("close",l=>{l=l??1,c?c(new ne(l,"commander.executeSubCommandAsync","(close)")):b.exit(l)}),u.on("error",l=>{if(l.code==="ENOENT")this._checkForMissingExecutable(o,s,e._name);else if(l.code==="EACCES")throw new Error(`'${o}' not executable`);if(!c)b.exit(1);else{let f=new ne(1,"commander.executeSubCommandAsync","(error)");f.nestedError=l,c(f)}}),this.runningCommand=u}_dispatchSubcommand(e,t,r){let i=this._findCommand(e);i||this.help({error:!0}),i._prepareForParse();let o;return o=this._chainOrCallSubCommandHook(o,i,"preSubcommand"),o=this._chainOrCall(o,()=>{if(i._executableHandler)this._executeSubCommand(i,t.concat(r));else return i._parseCommand(t,r)}),o}_dispatchHelpCommand(e){e||this.help();let t=this._findCommand(e);return t&&!t._executableHandler&&t.help(),this._dispatchSubcommand(e,[],[this._getHelpOption()?.long??this._getHelpOption()?.short??"--help"])}_checkNumberOfArguments(){this.registeredArguments.forEach((e,t)=>{e.required&&this.args[t]==null&&this.missingArgument(e.name())}),!(this.registeredArguments.length>0&&this.registeredArguments[this.registeredArguments.length-1].variadic)&&this.args.length>this.registeredArguments.length&&this._excessArguments(this.args)}_processArguments(){let e=(r,i,o)=>{let s=i;if(i!==null&&r.parseArg){let a=`error: command-argument value '${i}' is invalid for argument '${r.name()}'.`;s=this._callParseArg(r,i,o,a)}return s};this._checkNumberOfArguments();let t=[];this.registeredArguments.forEach((r,i)=>{let o=r.defaultValue;r.variadic?i<this.args.length?(o=this.args.slice(i),r.parseArg&&(o=o.reduce((s,a)=>e(r,a,s),r.defaultValue))):o===void 0&&(o=[]):i<this.args.length&&(o=this.args[i],r.parseArg&&(o=e(r,o,r.defaultValue))),t[i]=o}),this.processedArgs=t}_chainOrCall(e,t){return e?.then&&typeof e.then=="function"?e.then(()=>t()):t()}_chainOrCallHooks(e,t){let r=e,i=[];return this._getCommandAndAncestors().reverse().filter(o=>o._lifeCycleHooks[t]!==void 0).forEach(o=>{o._lifeCycleHooks[t].forEach(s=>{i.push({hookedCommand:o,callback:s})})}),t==="postAction"&&i.reverse(),i.forEach(o=>{r=this._chainOrCall(r,()=>o.callback(o.hookedCommand,this))}),r}_chainOrCallSubCommandHook(e,t,r){let i=e;return this._lifeCycleHooks[r]!==void 0&&this._lifeCycleHooks[r].forEach(o=>{i=this._chainOrCall(i,()=>o(this,t))}),i}_parseCommand(e,t){let r=this.parseOptions(t);if(this._parseOptionsEnv(),this._parseOptionsImplied(),e=e.concat(r.operands),t=r.unknown,this.args=e.concat(t),e&&this._findCommand(e[0]))return this._dispatchSubcommand(e[0],e.slice(1),t);if(this._getHelpCommand()&&e[0]===this._getHelpCommand().name())return this._dispatchHelpCommand(e[1]);if(this._defaultCommandName)return this._outputHelpIfRequested(t),this._dispatchSubcommand(this._defaultCommandName,e,t);this.commands.length&&this.args.length===0&&!this._actionHandler&&!this._defaultCommandName&&this.help({error:!0}),this._outputHelpIfRequested(r.unknown),this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let i=()=>{r.unknown.length>0&&this.unknownOption(r.unknown[0])},o=`command:${this.name()}`;if(this._actionHandler){i(),this._processArguments();let s;return s=this._chainOrCallHooks(s,"preAction"),s=this._chainOrCall(s,()=>this._actionHandler(this.processedArgs)),this.parent&&(s=this._chainOrCall(s,()=>{this.parent.emit(o,e,t)})),s=this._chainOrCallHooks(s,"postAction"),s}if(this.parent?.listenerCount(o))i(),this._processArguments(),this.parent.emit(o,e,t);else if(e.length){if(this._findCommand("*"))return this._dispatchSubcommand("*",e,t);this.listenerCount("command:*")?this.emit("command:*",e,t):this.commands.length?this.unknownCommand():(i(),this._processArguments())}else this.commands.length?(i(),this.help({error:!0})):(i(),this._processArguments())}_findCommand(e){if(e)return this.commands.find(t=>t._name===e||t._aliases.includes(e))}_findOption(e){return this.options.find(t=>t.is(e))}_checkForMissingMandatoryOptions(){this._getCommandAndAncestors().forEach(e=>{e.options.forEach(t=>{t.mandatory&&e.getOptionValue(t.attributeName())===void 0&&e.missingMandatoryOptionValue(t)})})}_checkForConflictingLocalOptions(){let e=this.options.filter(r=>{let i=r.attributeName();return this.getOptionValue(i)===void 0?!1:this.getOptionValueSource(i)!=="default"});e.filter(r=>r.conflictsWith.length>0).forEach(r=>{let i=e.find(o=>r.conflictsWith.includes(o.attributeName()));i&&this._conflictingOption(r,i)})}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach(e=>{e._checkForConflictingLocalOptions()})}parseOptions(e){let t=[],r=[],i=t;function o(l){return l.length>1&&l[0]==="-"}let s=l=>/^-(\d+|\d*\.\d+)([eE][+-]?\d+)?$/.test(l)?!this._getCommandAndAncestors().some(f=>f.options.map(d=>d.short).some(d=>/^-\d$/.test(d))):!1,a=null,u=null,c=0;for(;c<e.length||u;){let l=u??e[c++];if(u=null,l==="--"){i===r&&i.push(l),i.push(...e.slice(c));break}if(a&&(!o(l)||s(l))){this.emit(`option:${a.name()}`,l);continue}if(a=null,o(l)){let f=this._findOption(l);if(f){if(f.required){let d=e[c++];d===void 0&&this.optionMissingArgument(f),this.emit(`option:${f.name()}`,d)}else if(f.optional){let d=null;c<e.length&&(!o(e[c])||s(e[c]))&&(d=e[c++]),this.emit(`option:${f.name()}`,d)}else this.emit(`option:${f.name()}`);a=f.variadic?f:null;continue}}if(l.length>2&&l[0]==="-"&&l[1]!=="-"){let f=this._findOption(`-${l[1]}`);if(f){f.required||f.optional&&this._combineFlagAndOptionalValue?this.emit(`option:${f.name()}`,l.slice(2)):(this.emit(`option:${f.name()}`),u=`-${l.slice(2)}`);continue}}if(/^--[^=]+=/.test(l)){let f=l.indexOf("="),d=this._findOption(l.slice(0,f));if(d&&(d.required||d.optional)){this.emit(`option:${d.name()}`,l.slice(f+1));continue}}if(i===t&&o(l)&&!(this.commands.length===0&&s(l))&&(i=r),(this._enablePositionalOptions||this._passThroughOptions)&&t.length===0&&r.length===0){if(this._findCommand(l)){t.push(l),r.push(...e.slice(c));break}else if(this._getHelpCommand()&&l===this._getHelpCommand().name()){t.push(l,...e.slice(c));break}else if(this._defaultCommandName){r.push(l,...e.slice(c));break}}if(this._passThroughOptions){i.push(l,...e.slice(c));break}i.push(l)}return{operands:t,unknown:r}}opts(){if(this._storeOptionsAsProperties){let e={},t=this.options.length;for(let r=0;r<t;r++){let i=this.options[r].attributeName();e[i]=i===this._versionOptionName?this._version:this[i]}return e}return this._optionValues}optsWithGlobals(){return this._getCommandAndAncestors().reduce((e,t)=>Object.assign(e,t.opts()),{})}error(e,t){this._outputConfiguration.outputError(`${e}
|
|
28
28
|
`,this._outputConfiguration.writeErr),typeof this._showHelpAfterError=="string"?this._outputConfiguration.writeErr(`${this._showHelpAfterError}
|
|
29
29
|
`):this._showHelpAfterError&&(this._outputConfiguration.writeErr(`
|
|
30
30
|
`),this.outputHelp({error:!0}));let r=t||{},i=r.exitCode||1,o=r.code||"commander.error";this._exit(i,o,e)}_parseOptionsEnv(){this.options.forEach(e=>{if(e.envVar&&e.envVar in b.env){let t=e.attributeName();(this.getOptionValue(t)===void 0||["default","config","env"].includes(this.getOptionValueSource(t)))&&(e.required||e.optional?this.emit(`optionEnv:${e.name()}`,b.env[e.envVar]):this.emit(`optionEnv:${e.name()}`))}})}_parseOptionsImplied(){let e=new Ge(this.options),t=r=>this.getOptionValue(r)!==void 0&&!["default","implied"].includes(this.getOptionValueSource(r));this.options.filter(r=>r.implied!==void 0&&t(r.attributeName())&&e.valueFromOption(this.getOptionValue(r.attributeName()),r)).forEach(r=>{Object.keys(r.implied).filter(i=>!t(i)).forEach(i=>{this.setOptionValueWithSource(i,r.implied[i],"implied")})})}missingArgument(e){let t=`error: missing required argument '${e}'`;this.error(t,{code:"commander.missingArgument"})}optionMissingArgument(e){let t=`error: option '${e.flags}' argument missing`;this.error(t,{code:"commander.optionMissingArgument"})}missingMandatoryOptionValue(e){let t=`error: required option '${e.flags}' not specified`;this.error(t,{code:"commander.missingMandatoryOptionValue"})}_conflictingOption(e,t){let r=s=>{let a=s.attributeName(),u=this.getOptionValue(a),c=this.options.find(f=>f.negate&&a===f.attributeName()),l=this.options.find(f=>!f.negate&&a===f.attributeName());return c&&(c.presetArg===void 0&&u===!1||c.presetArg!==void 0&&u===c.presetArg)?c:l||s},i=s=>{let a=r(s),u=a.attributeName();return this.getOptionValueSource(u)==="env"?`environment variable '${a.envVar}'`:`option '${a.flags}'`},o=`error: ${i(e)} cannot be used with ${i(t)}`;this.error(o,{code:"commander.conflictingOption"})}unknownOption(e){if(this._allowUnknownOption)return;let t="";if(e.startsWith("--")&&this._showSuggestionAfterError){let i=[],o=this;do{let s=o.createHelp().visibleOptions(o).filter(a=>a.long).map(a=>a.long);i=i.concat(s),o=o.parent}while(o&&!o._enablePositionalOptions);t=ht(e,i)}let r=`error: unknown option '${e}'${t}`;this.error(r,{code:"commander.unknownOption"})}_excessArguments(e){if(this._allowExcessArguments)return;let t=this.registeredArguments.length,r=t===1?"":"s",i=e.length,o=this.parent?` for '${this.name()}'`:"",s=e.join(", "),a=`error: too many arguments${o}. Expected ${t} argument${r} but got ${i}: ${s}.`;this.error(a,{code:"commander.excessArguments"})}unknownCommand(){let e=this.args[0],t="";if(this._showSuggestionAfterError){let i=[];this.createHelp().visibleCommands(this).forEach(o=>{i.push(o.name()),o.alias()&&i.push(o.alias())}),t=ht(e,i)}let r=`error: unknown command '${e}'${t}`;this.error(r,{code:"commander.unknownCommand"})}version(e,t,r){if(e===void 0)return this._version;this._version=e,t=t||"-V, --version",r=r||"output the version number";let i=this.createOption(t,r);return this._versionOptionName=i.attributeName(),this._registerOption(i),this.on("option:"+i.name(),()=>{this._outputConfiguration.writeOut(`${e}
|
|
31
|
-
`),this._exit(0,"commander.version",e)}),this}description(e,t){return e===void 0&&t===void 0?this._description:(this._description=e,t&&(this._argsDescription=t),this)}summary(e){return e===void 0?this._summary:(this._summary=e,this)}alias(e){if(e===void 0)return this._aliases[0];let t=this;if(this.commands.length!==0&&this.commands[this.commands.length-1]._executableHandler&&(t=this.commands[this.commands.length-1]),e===t._name)throw new Error("Command alias can't be the same as its name");let r=this.parent?._findCommand(e);if(r){let i=[r.name()].concat(r.aliases()).join("|");throw new Error(`cannot add alias '${e}' to command '${this.name()}' as already have command '${i}'`)}return t._aliases.push(e),this}aliases(e){return e===void 0?this._aliases:(e.forEach(t=>this.alias(t)),this)}usage(e){if(e===void 0){if(this._usage)return this._usage;let t=this.registeredArguments.map(r=>Ve(r));return[].concat(this.options.length||this._helpOption!==null?"[options]":[],this.commands.length?"[command]":[],this.registeredArguments.length?t:[]).join(" ")}return this._usage=e,this}name(e){return e===void 0?this._name:(this._name=e,this)}helpGroup(e){return e===void 0?this._helpGroupHeading??"":(this._helpGroupHeading=e,this)}commandsGroup(e){return e===void 0?this._defaultCommandGroup??"":(this._defaultCommandGroup=e,this)}optionsGroup(e){return e===void 0?this._defaultOptionGroup??"":(this._defaultOptionGroup=e,this)}_initOptionGroup(e){this._defaultOptionGroup&&!e.helpGroupHeading&&e.helpGroup(this._defaultOptionGroup)}_initCommandGroup(e){this._defaultCommandGroup&&!e.helpGroup()&&e.helpGroup(this._defaultCommandGroup)}nameFromFilename(e){return this._name=
|
|
31
|
+
`),this._exit(0,"commander.version",e)}),this}description(e,t){return e===void 0&&t===void 0?this._description:(this._description=e,t&&(this._argsDescription=t),this)}summary(e){return e===void 0?this._summary:(this._summary=e,this)}alias(e){if(e===void 0)return this._aliases[0];let t=this;if(this.commands.length!==0&&this.commands[this.commands.length-1]._executableHandler&&(t=this.commands[this.commands.length-1]),e===t._name)throw new Error("Command alias can't be the same as its name");let r=this.parent?._findCommand(e);if(r){let i=[r.name()].concat(r.aliases()).join("|");throw new Error(`cannot add alias '${e}' to command '${this.name()}' as already have command '${i}'`)}return t._aliases.push(e),this}aliases(e){return e===void 0?this._aliases:(e.forEach(t=>this.alias(t)),this)}usage(e){if(e===void 0){if(this._usage)return this._usage;let t=this.registeredArguments.map(r=>Ve(r));return[].concat(this.options.length||this._helpOption!==null?"[options]":[],this.commands.length?"[command]":[],this.registeredArguments.length?t:[]).join(" ")}return this._usage=e,this}name(e){return e===void 0?this._name:(this._name=e,this)}helpGroup(e){return e===void 0?this._helpGroupHeading??"":(this._helpGroupHeading=e,this)}commandsGroup(e){return e===void 0?this._defaultCommandGroup??"":(this._defaultCommandGroup=e,this)}optionsGroup(e){return e===void 0?this._defaultOptionGroup??"":(this._defaultOptionGroup=e,this)}_initOptionGroup(e){this._defaultOptionGroup&&!e.helpGroupHeading&&e.helpGroup(this._defaultOptionGroup)}_initCommandGroup(e){this._defaultCommandGroup&&!e.helpGroup()&&e.helpGroup(this._defaultCommandGroup)}nameFromFilename(e){return this._name=ee.basename(e,ee.extname(e)),this}executableDir(e){return e===void 0?this._executableDir:(this._executableDir=e,this)}helpInformation(e){let t=this.createHelp(),r=this._getOutputContext(e);t.prepareContext({error:r.error,helpWidth:r.helpWidth,outputHasColors:r.hasColors});let i=t.formatHelp(this,t);return r.hasColors?i:this._outputConfiguration.stripColor(i)}_getOutputContext(e){e=e||{};let t=!!e.error,r,i,o;return t?(r=a=>this._outputConfiguration.writeErr(a),i=this._outputConfiguration.getErrHasColors(),o=this._outputConfiguration.getErrHelpWidth()):(r=a=>this._outputConfiguration.writeOut(a),i=this._outputConfiguration.getOutHasColors(),o=this._outputConfiguration.getOutHelpWidth()),{error:t,write:a=>(i||(a=this._outputConfiguration.stripColor(a)),r(a)),hasColors:i,helpWidth:o}}outputHelp(e){let t;typeof e=="function"&&(t=e,e=void 0);let r=this._getOutputContext(e),i={error:r.error,write:r.write,command:this};this._getCommandAndAncestors().reverse().forEach(s=>s.emit("beforeAllHelp",i)),this.emit("beforeHelp",i);let o=this.helpInformation({error:r.error});if(t&&(o=t(o),typeof o!="string"&&!Buffer.isBuffer(o)))throw new Error("outputHelp callback must return a string or a Buffer");r.write(o),this._getHelpOption()?.long&&this.emit(this._getHelpOption().long),this.emit("afterHelp",i),this._getCommandAndAncestors().forEach(s=>s.emit("afterAllHelp",i))}helpOption(e,t){return typeof e=="boolean"?(e?(this._helpOption===null&&(this._helpOption=void 0),this._defaultOptionGroup&&this._initOptionGroup(this._getHelpOption())):this._helpOption=null,this):(this._helpOption=this.createOption(e??"-h, --help",t??"display help for command"),(e||t)&&this._initOptionGroup(this._helpOption),this)}_getHelpOption(){return this._helpOption===void 0&&this.helpOption(void 0,void 0),this._helpOption}addHelpOption(e){return this._helpOption=e,this._initOptionGroup(e),this}help(e){this.outputHelp(e);let t=Number(b.exitCode??0);t===0&&e&&typeof e!="function"&&e.error&&(t=1),this._exit(t,"commander.help","(outputHelp)")}addHelpText(e,t){let r=["beforeAll","before","after","afterAll"];if(!r.includes(e))throw new Error(`Unexpected value for position to addHelpText.
|
|
32
32
|
Expecting one of '${r.join("', '")}'`);let i=`${e}Help`;return this.on(i,o=>{let s;typeof t=="function"?s=t({error:o.error,command:o.command}):s=t,s&&o.write(`${s}
|
|
33
|
-
`)}),this}_outputHelpIfRequested(e){let t=this._getHelpOption();t&&e.find(i=>t.is(i))&&(this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)"))}};function er(n){return n.map(e=>{if(!e.startsWith("--inspect"))return e;let t,r="127.0.0.1",i="9229",o;return(o=e.match(/^(--inspect(-brk|-wait)?)$/))!==null?t=o[1]:(o=e.match(/^(--inspect(-brk|-port|-wait)?)=(\[[^\]]+\]|[^:]+)$/))!==null?(t=o[1],/^\d+$/.test(o[3])?i=o[3]:r=o[3]):(o=e.match(/^(--inspect(-brk|-port|-wait)?)=(\[[^\]]+\]|[^:]+):(\d+)$/))!==null&&(t=o[1],r=o[3],i=o[4]),t&&i!=="0"?`${t}=${r}:${parseInt(i)+1}`:e})}function tr(){if(b.env.NO_COLOR||b.env.FORCE_COLOR==="0"||b.env.FORCE_COLOR==="false")return!1;if(b.env.FORCE_COLOR||b.env.CLICOLOR_FORCE!==void 0)return!0}var
|
|
33
|
+
`)}),this}_outputHelpIfRequested(e){let t=this._getHelpOption();t&&e.find(i=>t.is(i))&&(this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)"))}};function er(n){return n.map(e=>{if(!e.startsWith("--inspect"))return e;let t,r="127.0.0.1",i="9229",o;return(o=e.match(/^(--inspect(-brk|-wait)?)$/))!==null?t=o[1]:(o=e.match(/^(--inspect(-brk|-port|-wait)?)=(\[[^\]]+\]|[^:]+)$/))!==null?(t=o[1],/^\d+$/.test(o[3])?i=o[3]:r=o[3]):(o=e.match(/^(--inspect(-brk|-port|-wait)?)=(\[[^\]]+\]|[^:]+):(\d+)$/))!==null&&(t=o[1],r=o[3],i=o[4]),t&&i!=="0"?`${t}=${r}:${parseInt(i)+1}`:e})}function tr(){if(b.env.NO_COLOR||b.env.FORCE_COLOR==="0"||b.env.FORCE_COLOR==="false")return!1;if(b.env.FORCE_COLOR||b.env.CLICOLOR_FORCE!==void 0)return!0}var ya=new fe;function rr(n,e,t){let r=n.indexOf(e);if(r===-1)return n;let i=e.length,o=0,s="";do s+=n.slice(o,r)+e+t,o=r+i,r=n.indexOf(e,o);while(r!==-1);return s+=n.slice(o),s}function nr(n,e,t,r){let i=0,o="";do{let s=n[r-1]==="\r";o+=n.slice(i,s?r-1:r)+e+(s?`\r
|
|
34
34
|
`:`
|
|
35
35
|
`)+t,i=r+1,r=n.indexOf(`
|
|
36
|
-
`,i)}while(r!==-1);return o+=n.slice(i),o}var ir=(n=0)=>e=>`\x1B[${e+n}m`,Dt=(n=0)=>e=>`\x1B[${38+n};5;${e}m`,gt=(n=0)=>(e,t,r)=>`\x1B[${38+n};2;${e};${t};${r}m`,
|
|
37
|
-
`);return o!==-1&&(e=nr(e,i,r,o)),r+e+i};Object.defineProperties(
|
|
38
|
-
Run this browser at least once on this machine so it creates the key.`):e===Rt.INTERACTION_NOT_ALLOWED||/interaction.*not allowed/i.test(t)?(i="access-denied",o="The Keychain needs a GUI authorization prompt that can't be shown here "+(
|
|
36
|
+
`,i)}while(r!==-1);return o+=n.slice(i),o}var ir=(n=0)=>e=>`\x1B[${e+n}m`,Dt=(n=0)=>e=>`\x1B[${38+n};5;${e}m`,gt=(n=0)=>(e,t,r)=>`\x1B[${38+n};2;${e};${t};${r}m`,Ki=n=>`\x1B[58;5;${n<90?n-30:n-90+8}m`,w={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],underlineDouble:["4:2",24],underlineCurly:["4:3",24],underlineDotted:["4:4",24],underlineDashed:["4:5",24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],gray:[90,39],grey:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]},underlineColor:{underlineBlack:["58;5;0",59],underlineRed:["58;5;1",59],underlineGreen:["58;5;2",59],underlineYellow:["58;5;3",59],underlineBlue:["58;5;4",59],underlineMagenta:["58;5;5",59],underlineCyan:["58;5;6",59],underlineWhite:["58;5;7",59],underlineBlackBright:["58;5;8",59],underlineGray:["58;5;8",59],underlineGrey:["58;5;8",59],underlineRedBright:["58;5;9",59],underlineGreenBright:["58;5;10",59],underlineYellowBright:["58;5;11",59],underlineBlueBright:["58;5;12",59],underlineMagentaBright:["58;5;13",59],underlineCyanBright:["58;5;14",59],underlineWhiteBright:["58;5;15",59]}},ba=Object.keys(w.modifier),qi=Object.keys(w.color),zi=Object.keys(w.bgColor),wa=Object.keys(w.underlineColor),_a=[...qi,...zi];function Yi(){let n=new Map;for(let[e,t]of Object.entries(w)){for(let[r,i]of Object.entries(t))w[r]={open:`\x1B[${i[0]}m`,close:`\x1B[${i[1]}m`},t[r]=w[r],n.set(Number.parseInt(i[0],10),i[1]);Object.defineProperty(w,e,{value:t,enumerable:!1})}return Object.defineProperty(w,"codes",{value:n,enumerable:!1}),w.color.close="\x1B[39m",w.bgColor.close="\x1B[49m",w.underlineColor.close="\x1B[59m",w.color.ansi=ir(),w.color.ansi256=Dt(),w.color.ansi16m=gt(),w.bgColor.ansi=ir(10),w.bgColor.ansi256=Dt(10),w.bgColor.ansi16m=gt(10),w.underlineColor.ansi=Ki,w.underlineColor.ansi256=Dt(20),w.underlineColor.ansi16m=gt(20),Object.defineProperties(w,{rgbToAnsi256:{value(e,t,r){return e===t&&t===r?e<8?16:e>248?231:Math.round((e-8)/247*24)+232:16+36*Math.round(e/255*5)+6*Math.round(t/255*5)+Math.round(r/255*5)},enumerable:!1},hexToRgb:{value(e){let t=/[\da-f]{6}|[\da-f]{3}/i.exec(e.toString(16));if(!t)return[0,0,0];let[r]=t;r.length===3&&(r=[...r].map(o=>o+o).join(""));let i=Number.parseInt(r,16);return[i>>16&255,i>>8&255,i&255]},enumerable:!1},hexToAnsi256:{value:e=>w.rgbToAnsi256(...w.hexToRgb(e)),enumerable:!1},ansi256ToAnsi:{value(e){if(e<8)return 30+e;if(e<16)return 90+(e-8);let t,r,i;if(e>=232)t=((e-232)*10+8)/255,r=t,i=t;else{e-=16;let a=e%36;t=Math.floor(e/36)/5,r=Math.floor(a/6)/5,i=a%6/5}let o=Math.max(t,r,i)*2;if(o===0)return 30;let s=30+(Math.round(i)<<2|Math.round(r)<<1|Math.round(t));return o===2&&(s+=60),s},enumerable:!1},rgbToAnsi:{value:(e,t,r)=>w.ansi256ToAnsi(w.rgbToAnsi256(e,t,r)),enumerable:!1},hexToAnsi:{value:e=>w.ansi256ToAnsi(w.hexToAnsi256(e)),enumerable:!1}}),w}var Ji=Yi(),z=Ji;import yt from"node:process";import Xi from"node:os";import or from"node:tty";function G(n,e=globalThis.Deno?globalThis.Deno.args:yt.argv){let t=n.startsWith("-")?"":n.length===1?"-":"--",r=e.indexOf(t+n),i=e.indexOf("--");return r!==-1&&(i===-1||r<i)}var{env:x}=yt,Ke;G("no-color")||G("no-colors")||G("color=false")||G("color=never")?Ke=0:(G("color")||G("colors")||G("color=true")||G("color=always"))&&(Ke=1);function ur(){return/^\d+$/.test(x.FORCE_COLOR)}function Qi(){if("FORCE_COLOR"in x){if(x.FORCE_COLOR==="false")return 0;if(x.FORCE_COLOR==="true"||x.FORCE_COLOR.length===0)return 1;if(ur())return Math.min(Number.parseInt(x.FORCE_COLOR,10),3)}}function Zi(n){return n===0?!1:{level:n,hasBasic:!0,has256:n>=2,has16m:n>=3}}function eo(n,{streamIsTTY:e,sniffFlags:t=!0}={}){let r=Qi();r!==void 0&&(Ke=r);let i=t?Ke:r;if(i===0)return 0;if(t){if(G("color=16m")||G("color=full")||G("color=truecolor"))return 3;if(G("color=256"))return 2}if(i!==void 0&&ur())return i;if("TF_BUILD"in x&&"AGENT_NAME"in x)return 1;if(n&&!e&&i===void 0)return 0;let o=i||0;if(x.TERM==="dumb")return o;if(yt.platform==="win32"){let s=Xi.release().split(".");return Number(s[0])>=10&&Number(s[2])>=10586?Number(s[2])>=14931?3:2:1}if("CI"in x)return["GITHUB_ACTIONS","GITEA_ACTIONS","CIRCLECI"].some(s=>s in x)?3:["TRAVIS","APPVEYOR","GITLAB_CI","BUILDKITE","DRONE"].some(s=>s in x)||x.CI_NAME==="codeship"?1:o;if("TEAMCITY_VERSION"in x)return/^(?:9\.0*[1-9]\d*\.|\d{2,}\.)/.test(x.TEAMCITY_VERSION)?1:0;if(x.COLORTERM==="truecolor"||x.TERM==="xterm-kitty"||x.TERM==="xterm-ghostty"||x.TERM==="wezterm")return 3;if("TERM_PROGRAM"in x){let s=Number.parseInt((x.TERM_PROGRAM_VERSION||"").split(".",1)[0],10);switch(x.TERM_PROGRAM){case"iTerm.app":return s>=3?3:2;case"Apple_Terminal":return 2}}return/-256(?:color)?$/i.test(x.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(x.TERM)||"COLORTERM"in x?1:o}function sr(n,e={}){let t=eo(n,{streamIsTTY:n&&n.isTTY,...e});return Zi(t)}var to={stdout:sr({isTTY:or.isatty(1)}),stderr:sr({isTTY:or.isatty(2)})},ar=to;var{stdout:lr,stderr:cr}=ar,Ae=Symbol("GENERATOR"),Oe=Symbol("STYLER"),ze=Symbol("IS_EMPTY"),qe=Symbol("LEVEL"),ve=Object.create(null),fr=n=>{if(!Number.isSafeInteger(n)||n<0||n>3)throw new Error("The `level` should be an integer from 0 to 3")},ro={enumerable:!0,get(){return this[qe]},set(n){fr(n),this[qe]=n}},no=(n,e={})=>{e.level!==void 0&&fr(e.level);let t=lr?lr.level:0;n[qe]=e.level===void 0?t:e.level};var io=n=>{let e=(...t)=>t.join(" ");return no(e,n),Object.setPrototypeOf(e,ke.prototype),e};function ke(n){return io(n)}Object.setPrototypeOf(ke.prototype,Function.prototype);for(let[n,e]of Object.entries(z))ve[n]={get(){let t=Et(this,dr(e.open,e.close,this[Oe]),this[ze]);return Object.defineProperty(this,n,{value:t}),t}};ve.visible={get(){let n=Et(this,this[Oe],!0);return Object.defineProperty(this,"visible",{value:n}),n}};var oo=(n,e)=>{let t=z[e];if(n==="rgb"){let i=(s,a,u)=>t.ansi(z.rgbToAnsi(s,a,u));return[i,i,(s,a,u)=>t.ansi256(z.rgbToAnsi256(s,a,u)),t.ansi16m]}if(n==="hex"){let i=s=>t.ansi(z.hexToAnsi(s));return[i,i,s=>t.ansi256(z.hexToAnsi256(s)),s=>t.ansi16m(...z.hexToRgb(s))]}let r=i=>t.ansi(z.ansi256ToAnsi(i));return[r,r,t.ansi256,t.ansi256]},so=["rgb","hex","ansi256"];for(let n of so){let e=n[0].toUpperCase()+n.slice(1);for(let[t,r]of[[n,"color"],["bg"+e,"bgColor"],["underline"+e,"underlineColor"]]){let{close:i}=z[r],o=oo(n,r);ve[t]={get(){let s=function(a,u,c){let l=o[this.level](a,u,c);return Et(this,dr(l,i,this[Oe]),this[ze])};return Object.defineProperty(this,t,{value:s}),s}}}}var uo=Object.defineProperties(()=>{},{...ve,level:{enumerable:!0,get(){return this[Ae].level},set(n){this[Ae].level=n}}}),dr=(n,e,t)=>{let r,i;return t===void 0?(r=n,i=e):(r=t.openAll+n,i=e+t.closeAll),{open:n,close:e,openAll:r,closeAll:i,parent:t}},Et=(n,e,t)=>{let r=(...i)=>i.length===1?Ct(r,""+i[0]):i.length===2?Ct(r,`${i[0]??""} ${i[1]??""}`):Ct(r,i.join(" "));return Object.setPrototypeOf(r,uo),r[Ae]=n[Ae]??n,r[Oe]=e,r[ze]=t,r},Ct=(n,e)=>{if(n[Ae][qe]<=0||!e)return n[ze]?"":e;let t=n[Oe];if(t===void 0)return e;let{openAll:r,closeAll:i}=t;if(e.includes("\x1B"))for(;t!==void 0;)e=rr(e,t.close,t.open),t=t.parent;let o=e.indexOf(`
|
|
37
|
+
`);return o!==-1&&(e=nr(e,i,r,o)),r+e+i};Object.defineProperties(ke.prototype,{...ve,level:ro});var ao=ke(),Ra=ke({level:cr?cr.level:0});var m=ao;var Fi=$i(hn(),1);import{existsSync as J,readdirSync as Pn,readFileSync as _s,statSync as Fs}from"node:fs";import{basename as Bs,join as re}from"node:path";import{createDecipheriv as kt}from"node:crypto";var qo=Buffer.alloc(16," "),he=12,me=16;function Ze(n,e){if(!n||n.length===0)return Buffer.alloc(0);let t=Buffer.isBuffer(n)?n:Buffer.from(n),r=t.subarray(0,3).toString("utf-8");if(r!=="v10"&&r!=="v11")return"<unsupported encryption format>";let i=t.subarray(3);try{let o=kt("aes-128-cbc",e,qo),s=o.update(i);return s=Buffer.concat([s,o.final()]),s}catch{return"<decryption failed>"}}function mn(n,e){if(!n||n.length===0)return Buffer.alloc(0);let t=Buffer.isBuffer(n)?n:Buffer.from(n),r=t.subarray(0,3).toString("utf-8");if(r!=="v10"&&r!=="v11")return"<unsupported encryption format>";if(t.length<3+he+me)return"<decryption failed>";let i=t.subarray(3,3+he),o=t.subarray(t.length-me),s=t.subarray(3+he,t.length-me);try{let a=kt("aes-256-gcm",e,i);return a.setAuthTag(o),Buffer.concat([a.update(s),a.final()])}catch{return"<decryption failed>"}}function et(n,e){if(!n||n.length===0)return Buffer.alloc(0);let t=Buffer.isBuffer(n)?n:Buffer.from(n);if(t.subarray(0,3).toString("utf-8")!=="v20")return"<unsupported encryption format>";if(t.length<3+he+me)return"<decryption failed>";let i=t.subarray(3,3+he),o=t.subarray(t.length-me),s=t.subarray(3+he,t.length-me);try{let a=kt("aes-256-gcm",e,i);return a.setAuthTag(o),Buffer.concat([a.update(s),a.final()])}catch{return"<decryption failed>"}}function R(n){if(n==null)return"N/A";try{let e=BigInt(n);if(e===0n)return"N/A";let t=e-11644473600000000n,r=Number(t/1000n),i=new Date(r);return isNaN(i.getTime())?"N/A":i.toLocaleString()}catch{return"N/A"}}var F=class extends Error{constructor(t,r,i){super(r,i);this.code=t}code};function B(n,e,t,r){if(!n)return;let i=r instanceof F?r.code:r?.code==="ENOENT"?"missing_store":"unreadable";n({profile:e,store:t,code:i,message:r instanceof Error?r.message:String(r)})}import{homedir as ns}from"node:os";import{join as is}from"node:path";import{execFileSync as zo}from"node:child_process";import{pbkdf2Sync as Yo}from"node:crypto";var Jo=1003,Xo=16,Qo=Buffer.from("saltysalt"),Dn="Chrome Safe Storage",Rt={ITEM_NOT_FOUND:44,INTERACTION_NOT_ALLOWED:36,AUTH_FAILED:45,USER_CANCELED:128},De=class extends Error{service;kind;constructor(e,t,r){super(e),this.name="KeychainAccessError",this.service=t,this.kind=r}get isAccessDenied(){return this.kind==="access-denied"}};function tt(n){return n instanceof De&&n.isAccessDenied}var Tt=new Map,Lt=new Map;function Zo(){return!!(process.env.SSH_CONNECTION||process.env.SSH_TTY)||!process.env.TERM_PROGRAM}function es(n){let e=n;return{status:typeof e?.status=="number"?e.status:null,stderr:(e?.stderr??"").toString().trim()}}function ts(n,e,t){let r="See docs/remote-keychain-access.md for non-interactive / SSH setup.",i,o;e===Rt.ITEM_NOT_FOUND||/could not be found/i.test(t)?(i="not-found",o=`No '${n}' item found in the Keychain.
|
|
38
|
+
Run this browser at least once on this machine so it creates the key.`):e===Rt.INTERACTION_NOT_ALLOWED||/interaction.*not allowed/i.test(t)?(i="access-denied",o="The Keychain needs a GUI authorization prompt that can't be shown here "+(Zo()?`(you appear to be on a remote/SSH session).
|
|
39
39
|
`:`.
|
|
40
40
|
`)+`Authorize once from a GUI Terminal (click "Always Allow"), then unlock the
|
|
41
41
|
keychain in this session:
|
|
@@ -47,34 +47,34 @@ Re-run the command and click "Allow" (or "Always Allow"), or authorize once with
|
|
|
47
47
|
security find-generic-password -w -s "${n}"
|
|
48
48
|
${r}`);let s=[e!==null?`exit ${e}`:null,t||null].filter(Boolean).join(": ");return new De(`Could not retrieve ${n} key from macOS Keychain.
|
|
49
49
|
${o}`+(s?`
|
|
50
|
-
(security: ${s})`:""),n,i)}var Pt=null;function gn(){return Pt}function
|
|
51
|
-
The item may exist with no password. Re-run the browser to recreate it.`,n,"empty");return Tt.set(n,t),t}function yn(n=Dn,e){let t=Lt.get(n);if(t!==void 0)return t;let r=e||
|
|
50
|
+
(security: ${s})`:""),n,i)}var Pt=null;function gn(){return Pt}function rs(n=Dn){let e=Tt.get(n);if(e!==void 0)return e;let t;if(Pt)t=Pt(n);else try{t=zo("security",["find-generic-password","-w","-s",n],{encoding:"utf-8",stdio:["pipe","pipe","pipe"]}).trim()}catch(r){let{status:i,stderr:o}=es(r);throw ts(n,i,o)}if(!t)throw new De(`Keychain returned an empty ${n} key.
|
|
51
|
+
The item may exist with no password. Re-run the browser to recreate it.`,n,"empty");return Tt.set(n,t),t}function yn(n=Dn,e){let t=Lt.get(n);if(t!==void 0)return t;let r=e||rs(n);if(!r)throw new Error("Keychain password cannot be empty for key derivation.");let i=Yo(r,Qo,Jo,Xo,"sha1");return Lt.set(n,i),i}function Cn(){Tt.clear(),Lt.clear()}var rt={chrome:{id:"chrome",name:"Google Chrome",aliases:["google-chrome","google chrome"],safeStorageLabel:"Chrome Safe Storage",linuxSecretApp:"chrome",dirs:{darwin:"Google/Chrome",win32:"Google/Chrome/User Data",linux:"google-chrome"}},"chrome-beta":{id:"chrome-beta",name:"Google Chrome Beta",safeStorageLabel:"Chrome Safe Storage",linuxSecretApp:"chrome",dirs:{darwin:"Google/Chrome Beta",win32:"Google/Chrome Beta/User Data",linux:"google-chrome-beta"}},"chrome-canary":{id:"chrome-canary",name:"Google Chrome Canary",aliases:["canary"],safeStorageLabel:"Chrome Safe Storage",linuxSecretApp:"chrome",dirs:{darwin:"Google/Chrome Canary",win32:"Google/Chrome SxS/User Data",linux:"google-chrome-unstable"}},chromium:{id:"chromium",name:"Chromium",safeStorageLabel:"Chromium Safe Storage",linuxSecretApp:"chromium",dirs:{darwin:"Chromium",win32:"Chromium/User Data",linux:"chromium"}},edge:{id:"edge",name:"Microsoft Edge",aliases:["msedge","microsoft-edge","microsoft edge"],safeStorageLabel:"Microsoft Edge Safe Storage",linuxSecretApp:"chromium",dirs:{darwin:"Microsoft Edge",win32:"Microsoft/Edge/User Data",linux:"microsoft-edge"}},brave:{id:"brave",name:"Brave",aliases:["brave-browser"],safeStorageLabel:"Brave Safe Storage",linuxSecretApp:"chrome",dirs:{darwin:"BraveSoftware/Brave-Browser",win32:"BraveSoftware/Brave-Browser/User Data",linux:"BraveSoftware/Brave-Browser"}},comet:{id:"comet",name:"Comet",aliases:["perplexity","perplexity-comet"],safeStorageLabel:"Comet Safe Storage",linuxSecretApp:"chromium",dirs:{darwin:"Comet",win32:"Perplexity/Comet/User Data",linux:"comet"}},vivaldi:{id:"vivaldi",name:"Vivaldi",safeStorageLabel:"Chrome Safe Storage",linuxSecretApp:"chrome",dirs:{darwin:"Vivaldi",win32:"Vivaldi/User Data",linux:"vivaldi"}},opera:{id:"opera",name:"Opera",safeStorageLabel:"Opera Safe Storage",linuxSecretApp:"chromium",dirs:{darwin:"com.operasoftware.Opera",win32:"Opera Software/Opera Stable",win32Base:"roaming",linux:"opera"}}},En="chrome";function Ne(){return Object.values(rt)}function bn(n){if(!n)return null;let e=n.trim().toLowerCase();for(let t of Ne())if(t.id.toLowerCase()===e||t.name.toLowerCase()===e||t.aliases?.some(r=>r.toLowerCase()===e))return t;return null}function ge(n){let e=bn(n);if(e)return e;throw new Error(`Unknown browser "${n}". Supported: ${Ne().map(t=>t.id).join(", ")}.`)}var Ie=rt[En];function O(){return Ie}function Me(n){return!n||!n.trim()?(Ie=rt[En],Ie):(Ie=ge(n),Ie)}var wn={name:"darwin",getDefaultChromeDir(n=O()){return is(ns(),"Library","Application Support",...n.dirs.darwin.split("/"))},getDecryptionKey(n,e=O()){return yn(e.safeStorageLabel)},decrypt(n,e){return Ze(n,e)},clearCache(){Cn()}};import{execFileSync as xn}from"node:child_process";import{randomUUID as os}from"node:crypto";import{constants as ss,copyFileSync as us,existsSync as ye,mkdirSync as as,readFileSync as _n,rmSync as ls,rmdirSync as cs}from"node:fs";import{dirname as Sn,join as V,resolve as fs}from"node:path";var It=Buffer.from("DPAPI","ascii"),Nt=Buffer.from("APPB","ascii"),Mt=new Map,$t=new Map,jt=new WeakMap,ds=new Set(["chrome","chrome-beta","brave","edge"]);function ps(n){let e=["$ErrorActionPreference='Stop';","Add-Type -AssemblyName System.Security;","$b=[Console]::In.ReadToEnd().Trim();","$enc=[Convert]::FromBase64String($b);","$dec=[System.Security.Cryptography.ProtectedData]::Unprotect($enc,$null,[System.Security.Cryptography.DataProtectionScope]::CurrentUser);","[Console]::Out.Write([Convert]::ToBase64String($dec));"].join(" "),t;try{t=xn("powershell.exe",["-NoProfile","-NonInteractive","-Command",e],{input:n.toString("base64"),encoding:"utf-8"})}catch(r){throw new Error(`DPAPI decryption via PowerShell failed.
|
|
52
52
|
The encrypted_key can only be unprotected by the same Windows user that created it. Run as that user on the same machine.
|
|
53
|
-
(powershell: ${r?.message??r})`)}return Buffer.from(t.trim(),"base64")}function Fn(n){let e=
|
|
53
|
+
(powershell: ${r?.message??r})`)}return Buffer.from(t.trim(),"base64")}function Fn(n){let e=fs(n),t=Sn(e);return ye(V(e,"Local State"))?e:t!==e&&ye(V(t,"Local State"))?t:e}function Bn(n,e,t){try{let r=xn(n,[t],{input:e.toString("base64"),encoding:"utf8",timeout:1e4,windowsHide:!0,stdio:["pipe","pipe","pipe"],cwd:Sn(n)}),i=Buffer.from(r.trim(),"base64");return i.length===32?i:void 0}catch{return}}function hs(n,e){if(!ds.has(e.id))return;let t=import.meta.dirname,r=[V(t,"chrome_abe_decrypt.exe"),V(t,"../../native/windows/chrome_abe_decrypt.exe")].find(ye);if(!r)return;let i=Bn(r,n,e.id);if(i)return i;let o=e.dirs.win32.split("/").slice(0,-1),s=e.id==="edge"?"msedge.exe":e.id==="brave"?"brave.exe":"chrome.exe",a=new Set([process.env.ProgramW6432,process.env.ProgramFiles,process.env["ProgramFiles(x86)"],process.env.LOCALAPPDATA]);for(let u of a){if(!u)continue;let c=V(u,...o);if(!ye(V(c,"Application",s)))continue;let l=V(c,"Temp"),f=V(l,`chrome-tools-${os()}.exe`),d=!1,D=!1;try{d=as(l,{recursive:!0})!==void 0,us(r,f,ss.COPYFILE_EXCL),D=!0;let p=Bn(f,n,e.id);if(p)return p}catch{}finally{if(D)try{ls(f)}catch{}if(d)try{cs(l)}catch{}}}}var An={name:"win32",getDefaultChromeDir(n=O()){let t=n.dirs.win32Base==="roaming"?process.env.APPDATA||(process.env.USERPROFILE?V(process.env.USERPROFILE,"AppData","Roaming"):""):process.env.LOCALAPPDATA||(process.env.USERPROFILE?V(process.env.USERPROFILE,"AppData","Local"):"");if(!t)throw new Error("Could not resolve the Windows application-data directory.");return V(t,...n.dirs.win32.split("/"))},getDecryptionKey(n,e=O()){let t=n||this.getDefaultChromeDir(e),r=Fn(t),i=JSON.stringify([r,e.id]),o=Mt.get(i);if(o)return o;let s=V(r,"Local State");if(!ye(s))throw new Error(`Could not find Chrome's "Local State" at ${s}.
|
|
54
54
|
Run Google Chrome at least once so it creates the encryption key.`);let a;try{let l=_n(s,"utf-8");a=JSON.parse(l)?.os_crypt?.encrypted_key}catch(l){throw new Error(`Failed to read os_crypt.encrypted_key from Local State: ${l.message}`)}if(!a)throw new Error(`No os_crypt.encrypted_key found in Local State.
|
|
55
|
-
This profile may predate Chrome's encrypted-key scheme.`);let u=Buffer.from(a,"base64");if(!u.subarray(0,It.length).equals(It))throw new Error('Unexpected encrypted_key format (missing "DPAPI" prefix).');let c=
|
|
56
|
-
FROM logins ORDER BY origin_url`);for(let k of _){if(f&&!(k.origin_url&&k.origin_url.toLowerCase().includes(f))&&!(k.username_value&&k.username_value.toLowerCase().includes(f)))continue;let
|
|
55
|
+
This profile may predate Chrome's encrypted-key scheme.`);let u=Buffer.from(a,"base64");if(!u.subarray(0,It.length).equals(It))throw new Error('Unexpected encrypted_key format (missing "DPAPI" prefix).');let c=ps(u.subarray(It.length));return Mt.set(i,c),jt.set(c,{chromeDir:r,browser:e}),c},getAppBoundKey(n,e=O()){let t=Fn(n||this.getDefaultChromeDir(e)),r=JSON.stringify([t,e.id]),i=$t.get(r);if(i)return i;let o=V(t,"Local State");if(!ye(o))return;let s;try{let c=_n(o,"utf-8");s=JSON.parse(c)?.os_crypt?.app_bound_encrypted_key}catch{return}if(!s)return;let a=Buffer.from(s,"base64");if(!a.subarray(0,Nt.length).equals(Nt))return;let u=hs(a.subarray(Nt.length),e);if(u)return $t.set(r,u),u},decrypt(n,e){if(n.subarray(0,3).toString()==="v20"){let t=jt.get(e),r=t&&this.getAppBoundKey?.(t.chromeDir,t.browser);return r?et(n,r):"<app-bound encryption unavailable>"}return mn(n,e)},clearCache(){Mt.clear(),$t.clear(),jt=new WeakMap}};import{execFileSync as ms}from"node:child_process";import{homedir as Ds}from"node:os";import{join as On}from"node:path";import{pbkdf2Sync as gs}from"node:crypto";var ys=1,Cs=16,Es=Buffer.from("saltysalt"),bs="peanuts",Ht=new Map;function ws(n){let e=gn();if(e)return e(n);try{let t=ms("secret-tool",["lookup","application",n],{encoding:"utf-8",stdio:["pipe","pipe","pipe"]}).trim();if(t)return t}catch{}return bs}var vn={name:"linux",getDefaultChromeDir(n=O()){let e=process.env.XDG_CONFIG_HOME||On(Ds(),".config");return On(e,...n.dirs.linux.split("/"))},getDecryptionKey(n,e=O()){let t=e.linuxSecretApp||"chrome",r=Ht.get(t);if(r!==void 0)return r;let i=gs(ws(t),Es,ys,Cs,"sha1");return Ht.set(t,i),i},decrypt(n,e){return Ze(n,e)},clearCache(){Ht.clear()}};var Ce=null;function kn(){if(Ce)return Ce;switch(process.platform){case"darwin":Ce=wn;break;case"win32":Ce=An;break;case"linux":Ce=vn;break;default:throw new Error(`Unsupported platform: ${process.platform}. chrome-tools supports macOS, Windows, and Linux.`)}return Ce}function Rn(n){return kn().getDefaultChromeDir(Tn(n))}function Tn(n){return n?typeof n=="string"?ge(n):n:O()}function Ee(n,e,t,r,i,o){let s=Tn(e),a=t,u,c=new Set;return l=>{let f;try{let d=kn();d.getAppBoundKey&&l.subarray(0,3).toString()==="v20"?(u===void 0&&(u=d.getAppBoundKey(n,s)??null),f=u?et(l,u):"<app-bound encryption unavailable>"):(a??=d.getDecryptionKey(n,s),f=d.decrypt(l,a))}catch(d){throw new F("decryption_unavailable",d instanceof Error?d.message:String(d),{cause:d})}return typeof f=="string"&&!c.has(f)&&(c.add(f),B(r,i,o,new F("decryption_unavailable",f))),f}}var In=["Login Data","History","Bookmarks","Cookies","Web Data","Local Storage","LocalStorage","Preferences"];function nt(n){let e=re(n,"Network","Cookies");return J(e)?e:re(n,"Cookies")}function Ln(n){return In.some(e=>J(re(n,e)))||J(nt(n))}function $e(n){return Rn(n)}function Wt({includeMissing:n=!1}={}){let e=[];for(let t of Ne()){let r=$e(t),i=J(r);!i&&!n||e.push({browser:t,chromeDir:r,installed:i,profileCount:i?ae(r).length:0})}return e}function ae(n,{reportAccessDenied:e=!1}={}){let t=n||$e();if(!t)return[];try{let r=Pn(t,{withFileTypes:!0}),i=[];for(let o of r){if(!o.isDirectory()||o.name==="Network")continue;let s=re(t,o.name);Ln(s)&&i.push({name:o.name,path:s})}if(i.length===0&&Ln(t)){let o=Bs(t)||"Default";i.push({name:o,path:t})}return i}catch(r){let i=r.code;if(e&&(i==="EACCES"||i==="EPERM")){let o=process.platform==="darwin"?" Try Terminal.app if it already has access, or review the current app's permissions in System Settings \u2192 Privacy & Security.":" Check that your user has permission to read this directory.";throw new Error(`Permission denied reading the browser profile directory "${t}" (${i}).${o}`,{cause:r})}return[]}}function Vt(n){let e=n||$e(),t=re(e,"Local State");if(!J(t))return[];try{let r=_s(t,"utf-8"),o=JSON.parse(r)?.profile?.info_cache;return!o||typeof o!="object"?[]:Object.entries(o).map(([s,a])=>{let u=a;return{directory:s,name:u.name||s,gaiaName:u.gaia_name||"",userName:u.user_name||"",email:u.user_name||"",avatarIcon:u.avatar_icon||"",isUsingDefaultName:u.is_using_default_name??!0,isEphemeral:u.is_ephemeral??!1,activeTime:u.active_time||0}})}catch{return[]}}function Nn(n){let e=n||$e(),t=ae(e),r=Vt(e),i=new Map;for(let o of r)i.set(o.directory,o);return t.map(o=>{let s=i.get(o.name),a=o.path,u={};for(let c of In)u[c.replace(/\s+/g,"_").toLowerCase()]=J(re(a,c));return u.cookies=J(nt(a)),u.top_sites=J(re(a,"Top Sites")),u.extensions=J(re(a,"Extensions")),{directory:o.name,path:a,displayName:s?.name||o.name,gaiaName:s?.gaiaName||"",email:s?.email||"",avatarIcon:s?.avatarIcon||"",isEphemeral:s?.isEphemeral??!1,activeTime:s?.activeTime||0,dataFiles:u}})}function it(n){if(!n||!J(n))return 0;let e=0,t;try{t=Pn(n,{withFileTypes:!0})}catch{return 0}for(let r of t){let i=re(n,r.name);try{if(r.isSymbolicLink())continue;r.isDirectory()?e+=it(i):r.isFile()&&(e+=Fs(i).size)}catch{}}return e}function S({profilePath:n,chromeDir:e,profile:t,browser:r,onDiagnostic:i}={}){let o=r?ge(r):void 0,s=n||e||$e(o),a;try{a=ae(s,{reportAccessDenied:!!i})}catch(u){i?.({profile:t??"",store:"User Data",code:"unreadable",message:u instanceof Error?u.message:String(u)}),a=[]}if(t){let u=a.filter(c=>c.name===t);if(u.length===0)throw new Error(`Profile "${t}" not found in ${s}`);return u}return a}import{existsSync as $s,readFileSync as js}from"node:fs";import{homedir as jn}from"node:os";import{join as at}from"node:path";import{copyFileSync as Ts,rmSync as Ls}from"node:fs";import{basename as ut,dirname as $n,join as Ps}from"node:path";import{DatabaseSync as Is}from"node:sqlite";import{lstatSync as xs,mkdtempSync as Ss,realpathSync as Mn}from"node:fs";import{tmpdir as As}from"node:os";import{isAbsolute as Os,join as vs,relative as ks,sep as Rs}from"node:path";function ie(n){try{let e=xs(n,{bigint:!0});if(!e.isFile())throw new F("unreadable",`Expected a regular store file: ${n}`);return e}catch(e){if(e.code==="ENOENT")return;throw e}}function ot(n,e){return!n||!e?n===e:n.dev===e.dev&&n.ino===e.ino&&n.size===e.size&&n.mtimeNs===e.mtimeNs&&n.ctimeNs===e.ctimeNs}function st(n,e){let t=Mn(As()),r=Mn(n),i=ks(r,t);if(!Os(i)&&i!==".."&&!i.startsWith(".."+Rs))throw new F("snapshot_unavailable","The temporary directory is inside the source profile. Set it to a directory outside the profile.");return Ss(vs(t,e))}function Ns(n){return n.map(e=>{let t={};for(let r of Object.keys(e)){let i=e[r];typeof i=="bigint"?t[r]=Number(i):i instanceof Uint8Array&&!Buffer.isBuffer(i)?t[r]=Buffer.from(i.buffer,i.byteOffset,i.byteLength):t[r]=i}return t})}function Ms(n,e){let t=["","-wal","-journal"],r=t.map(i=>ie(n+i));if(!r[0])throw new F("missing_store",`Database file not found: ${n}`);try{for(let[i,o]of t.entries())r[i]&&Ts(n+o,e+o)}catch(i){let o=i.code;throw["EBUSY","EPERM","EACCES","ENOENT"].includes(o??"")?new F("snapshot_unavailable",`Could not copy ${ut(n)} and its journals. Close the browser and retry if it is open.`,{cause:i}):i}if(t.some((i,o)=>!ot(r[o],ie(n+i))))throw new F("snapshot_unavailable",`${ut(n)} changed during the copy. Close the browser and retry.`)}function Gt(n,e){let t=$n(n),r=ut(t)==="Network"?$n(t):t,i=st(r,"chrome-tools-"),o=Ps(i,"snapshot.sqlite"),s;try{Ms(n,o),s=new Is(o,{timeout:0}),s.exec("PRAGMA trusted_schema = OFF; PRAGMA query_only = ON;");let a=s;return e((u,c=[])=>{let l=u.replace(/^(?:\s+|--[^\n]*(?:\n|$)|\/\*[\s\S]*?\*\/)+/,"");if(!/^(SELECT|WITH|VALUES|EXPLAIN|PRAGMA)\b/i.test(l))throw new F("unreadable","Only read queries are supported.");let f=a.prepare(l);return f.setReadBigInts(!0),Ns(f.all(...c))})}catch(a){if(a instanceof F)throw a;let u=a instanceof Error?a.message:String(a),c=/no such (table|column)/i.test(u)?"unsupported_schema":"unreadable";throw new F(c,`Database query failed on '${ut(n)}': ${u}`,{cause:a})}finally{try{s?.close()}finally{Ls(i,{recursive:!0,force:!0,maxRetries:3})}}}function L(n,e,t=[]){return Gt(n,r=>r(e,t))}var Hn=[{file:"Login Data",source:"device"},{file:"Login Data For Account",source:"account"}],Hs=at(jn(),".chrome_cdp_profile"),Ws=at(jn(),".config","chrome-cdp-manager","config.json"),Vs=["0","off","none","false"];function Gs(){let n=process.env.CHROME_AUTOMATION_DIR?.trim();if(n&&Vs.includes(n.toLowerCase()))return;let e=n||Us()||Hs;return ae(e).length>0?e:void 0}function Us(){try{let n=JSON.parse(js(Ws,"utf-8"));return typeof n.profileDir=="string"&&n.profileDir?n.profileDir:void 0}catch{return}}function Wn(n,e){let t=[],r=n||e?void 0:Gs();return r&&t.push(r),t.push(n),t}function Vn({chromeDir:n,profilePath:e,profile:t,browser:r}={}){let i=e||n,o=[];for(let s of Wn(i,r)){let a;try{a=S({chromeDir:s,profile:t,browser:r})}catch(u){o.push({root:s??"default",profile:t??"*",file:"*",source:"device",exists:!1,rows:null,error:u instanceof Error?u.message:String(u)});continue}for(let u of a)for(let c of Hn){let l=at(u.path,c.file),f={root:s??"default",profile:u.name,file:c.file,source:c.source,exists:$s(l),rows:null};try{f.rows=L(l,"SELECT COUNT(*) AS n FROM logins")[0]?.n??0}catch(d){f.error=d instanceof Error?d.message:String(d)}o.push(f)}}return o}function Gn({chromeDir:n,profilePath:e,profile:t,search:r,browser:i,decryptionKey:o,onDiagnostic:s}={}){let a=e||n,u=i??O().id,c=Wn(a,i),l=[],f=r?.toLowerCase(),d,D=!1;for(let p of c){let h;try{h=S({chromeDir:p,profile:t,browser:u,onDiagnostic:s})}catch(g){d??=g;continue}D=!0;for(let g of h)for(let y of Hn){let C=at(g.path,y.file),T=Ee(p??g.path,u,o,s,g.name,y.file);try{let _=L(C,`SELECT origin_url, username_value, password_value, date_last_used
|
|
56
|
+
FROM logins ORDER BY origin_url`);for(let k of _){if(f&&!(k.origin_url&&k.origin_url.toLowerCase().includes(f))&&!(k.username_value&&k.username_value.toLowerCase().includes(f)))continue;let Q=k.password_value?.length>0?T(k.password_value):"";l.push({profile:g.name,source:y.source,url:k.origin_url,username:k.username_value,password:Buffer.isBuffer(Q)?Q.toString("utf8"):Q,lastUsed:R(k.date_last_used||0)})}}catch(_){B(s,g.name,y.file,_)}}}if(!D&&d)throw d;return l}import{readFileSync as Ks}from"node:fs";import{join as qs}from"node:path";function Un(n,e=""){let t=[];if(!n)return t;let r=e?`${e}/${n.name||""}`:n.name||"";if(n.type==="url"&&t.push({title:n.name||"",url:n.url||"",folder:e,dateAdded:R(n.date_added),dateLastUsed:R(n.date_last_used),id:n.id,guid:n.guid||""}),n.children&&Array.isArray(n.children))for(let i of n.children)t.push(...Un(i,r));return t}function Kn({chromeDir:n,profilePath:e,profile:t,folder:r,search:i,browser:o,onDiagnostic:s}={}){let a=S({chromeDir:n,profilePath:e,profile:t,browser:o,onDiagnostic:s}),u=[];for(let l of a){let f=qs(l.path,"Bookmarks");try{let d=Ks(f,"utf-8"),p=JSON.parse(d).roots;if(!p)continue;let h=["bookmark_bar","other","synced"];for(let g of h)if(p[g]){let y=Un(p[g],"");for(let C of y)C.profile=l.name,u.push(C)}}catch(d){B(s,l.name,"Bookmarks",d instanceof SyntaxError?new Error("Invalid Bookmarks JSON."):d)}}let c=u;if(r){let l=r.toLowerCase();c=c.filter(f=>f.folder.toLowerCase().includes(l))}if(i){let l=i.toLowerCase();c=c.filter(f=>f.title.toLowerCase().includes(l)||f.url.toLowerCase().includes(l))}return c}import{join as qn}from"node:path";function X(n){if(n===void 0)return;let e=Math.trunc(Number(n));return Number.isFinite(e)&&e>0?e:void 0}function q(n,e){let t=X(e);return t===void 0?n:n.slice(0,t)}function be(n){return`%${n.replace(/([%_\\])/g,"\\$1")}%`}function zn({chromeDir:n,profilePath:e,profile:t,search:r,limit:i=100,browser:o,onDiagnostic:s}={}){let a=S({chromeDir:n,profilePath:e,profile:t,browser:o,onDiagnostic:s}),u=[],c=X(i);for(let l of a){let f=qn(l.path,"History");try{let d="SELECT url, title, visit_count, last_visit_time FROM urls",D=[];if(r){d+=" WHERE url LIKE ? ESCAPE '\\' OR IFNULL(title, '') LIKE ? ESCAPE '\\'";let h=be(r);D.push(h,h)}d+=" ORDER BY last_visit_time DESC",c&&(d+=` LIMIT ${c}`);let p=L(f,d,D);for(let h of p)u.push({profile:l.name,url:h.url,title:h.title||"",visitCount:h.visit_count||0,lastVisit:R(h.last_visit_time||0)})}catch(d){B(s,l.name,"History",d)}}return q(u,i)}function Yn({chromeDir:n,profilePath:e,profile:t,limit:r=100,browser:i,onDiagnostic:o}={}){let s=S({chromeDir:n,profilePath:e,profile:t,browser:i,onDiagnostic:o}),a=[],u=X(r);for(let c of s){let l=qn(c.path,"History");try{let f=`SELECT kst.term, u.url
|
|
57
57
|
FROM keyword_search_terms kst
|
|
58
58
|
JOIN urls u ON kst.url_id = u.id
|
|
59
|
-
ORDER BY u.last_visit_time DESC`;u&&(f+=` LIMIT ${u}`);let d=L(l,f);for(let D of d)a.push({profile:c.name,term:D.term||"",url:D.url||""})}catch(f){B(o,c.name,"History",f)}}return
|
|
59
|
+
ORDER BY u.last_visit_time DESC`;u&&(f+=` LIMIT ${u}`);let d=L(l,f);for(let D of d)a.push({profile:c.name,term:D.term||"",url:D.url||""})}catch(f){B(o,c.name,"History",f)}}return q(a,r)}import{existsSync as zs}from"node:fs";import{createHash as Ys}from"node:crypto";function Js(n,e){if(!Buffer.isBuffer(n))return n;let t=Ys("sha256").update(e).digest();return(n.length>=t.length&&n.subarray(0,t.length).equals(t)?n.subarray(t.length):n).toString("utf-8")}function Xs(n){if(!n)return null;try{return new URL(n)}catch{try{if(!/^[a-zA-Z][a-zA-Z0-9+.-]*:/.test(n))return new URL("https://"+n)}catch{}}return null}function Qs(n){let e=new Set;e.add(n),e.add("."+n);let t=n.split(".");for(let r=1;r<t.length;r++){let i=t.slice(r).join(".");e.add(i),e.add("."+i)}return Array.from(e)}function Zs(n,e){return!!(n===e||e.startsWith(".")&&(n===e.slice(1)||n.endsWith(e)))}function eu(n,e){let t=n||"/",r=e||"/";return!!(r==="/"||t===r||t.startsWith(r)&&(r.endsWith("/")||t[r.length]==="/"))}function Jn({chromeDir:n,profilePath:e,profile:t,browser:r,onDiagnostic:i,domain:o,url:s,decrypt:a=!0,limit:u=100,decryptionKey:c}={}){let l=e||n,f=r??O().id,d=S({chromeDir:n,profilePath:e,profile:t,browser:f,onDiagnostic:i}),D=[],p=Xs(s),h=X(u),g;for(let y of d){let C=nt(y.path);if(!zs(C)){B(i,y.name,"Cookies",new F("missing_store","Cookies database file not found."));continue}let T=Ee(l??y.path,f,c,i,y.name,"Cookies");try{let _=`SELECT host_key, name, value, encrypted_value, path,
|
|
60
60
|
expires_utc, is_secure, is_httponly, samesite,
|
|
61
61
|
creation_utc, last_access_utc
|
|
62
|
-
FROM cookies`,k=[],
|
|
62
|
+
FROM cookies`,k=[],Q=[];if(o)k.push("host_key LIKE ?"),Q.push(`%${o}%`);else if(p){let v=Qs(p.hostname),Be=v.map(()=>"?").join(", ");k.push(`host_key IN (${Be})`),Q.push(...v)}k.length>0&&(_+=` WHERE ${k.join(" AND ")}`),_+=" ORDER BY host_key, name",h&&!s&&(_+=` LIMIT ${h}`);let pt=L(C,_,Q);for(let v of pt){if(p&&(!Zs(p.hostname,v.host_key||"")||!eu(p.pathname||"/",v.path||"/")||v.is_secure&&p.protocol!=="https:"))continue;let Be=v.value||"";!Be&&v.encrypted_value?.length>0&&a&&(Be=Js(T(v.encrypted_value),v.host_key||"")),D.push({profile:y.name,domain:v.host_key||"",name:v.name||"",value:Be,path:v.path||"/",expires:R(v.expires_utc||0),secure:!!v.is_secure,httpOnly:!!v.is_httponly,sameSite:["unspecified","lax","strict","none"][v.samesite]||"unspecified",created:R(v.creation_utc||0),lastAccessed:R(v.last_access_utc||0)})}}catch(_){B(i,y.name,"Cookies",_),g??=new Error(`Could not read cookies for profile "${y.name}" at ${C}: `+(_ instanceof Error?_.message:String(_)))}}if(!i&&D.length===0&&g)throw g;return q(D,u)}import{join as ai}from"node:path";import{zstdDecompressSync as cu}from"node:zlib";function we(n,e){let t=0,r=0;for(let i=e;i<n.length&&i<e+5;i++){let o=n[i];if(t|=(o&127)<<r,(o&128)===0)return{value:t>>>0,nextOffset:i+1};r+=7}return null}var Ut=64*1024*1024;function lt(n){let e=we(n,0);if(!e||e.value>Ut)throw new Error("Invalid Snappy length");let t=Buffer.alloc(e.value),r=e.nextOffset,i=0;for(;r<n.length&&i<t.length;){let o=n[r++],s=o&3;if(s===0){let c=o>>2;if(c<60)c+=1;else{let l=c-59;if(r+l>n.length)throw new Error("Invalid Snappy literal");c=1;for(let f=0;f<l;f++)c+=n[r++]<<f*8}if(r+c>n.length||i+c>t.length)throw new Error("Invalid Snappy literal length");n.copy(t,i,r,r+c),r+=c,i+=c;continue}let a,u;if(s===1){if(r>=n.length)throw new Error("Invalid Snappy copy");a=(o>>2&7)+4,u=(o&224)<<3|n[r++]}else if(s===2){if(r+2>n.length)throw new Error("Invalid Snappy copy");a=(o>>2)+1,u=n.readUInt16LE(r),r+=2}else{if(r+4>n.length)throw new Error("Invalid Snappy copy");a=(o>>2)+1,u=n.readUInt32LE(r),r+=4}if(u<=0||u>i||i+a>t.length)throw new Error("Invalid Snappy offset");for(let c=0;c<a;c++)t[i]=t[i-u],i++}if(i!==t.length)throw new Error("Truncated Snappy stream");return t}import{copyFileSync as tu,readFileSync as Xn,readdirSync as ru,rmSync as nu}from"node:fs";import{join as _e}from"node:path";function qt(n){return ru(n).filter(e=>/\.(log|ldb|sst)$/i.test(e)).sort()}function oi(n,e){let t=st(e,"chrome-local-storage-");try{let r=qt(n),i=r.map(s=>ie(_e(n,s)));try{for(let s of r)tu(_e(n,s),_e(t,s))}catch(s){throw new F("snapshot_unavailable","Could not copy Local Storage. Close the browser and retry if it is open.",{cause:s})}let o=qt(n);if(o.length!==r.length||r.some((s,a)=>s!==o[a]||!ot(i[a],ie(_e(n,s)))))throw new F("snapshot_unavailable","Local Storage changed during the copy. Close the browser and retry.");return ou(t).values()}finally{nu(t,{recursive:!0,force:!0,maxRetries:3})}}var iu=0xdb4775248b80fb57n,Qn=32768,si=0,ui=1;function ou(n){let e=new Map,t=qt(n);for(let r of t){let i=_e(n,r),o=Xn(i);if(/\.(ldb|sst)$/i.test(r))for(let s of uu(o))Zn(e,s)}for(let r of t){if(!/\.log$/i.test(r))continue;let i=_e(n,r),o=Xn(i);for(let s of su(o))Zn(e,s)}return e}function Zn(n,e){let t=e.key.toString("hex"),r=n.get(t);r&&r.sequence>e.sequence||n.set(t,e)}function su(n){let e=[],t=0,r=[];for(;t+7<=n.length;){let i=Qn-t%Qn;if(i<7){t+=i;continue}let o=n.readUInt16LE(t+4),s=n[t+6];if(t+=7,s===0&&o===0){t+=o;continue}if(o>n.length-t||o>i-7)break;let a=n.subarray(t,t+o);t+=o,s===1?(e.push(...ei(a)),r=[]):s===2?r=[Buffer.from(a)]:s===3&&r.length>0?r.push(Buffer.from(a)):s===4&&r.length>0&&(r.push(Buffer.from(a)),e.push(...ei(Buffer.concat(r))),r=[])}return e}function ei(n){if(n.length<12)return[];let e=[],t=au(n,0),r=n.readUInt32LE(8),i=12,o=0;for(;i<n.length&&o<r;){let s=n[i++],a=ni(n,i);if(!a)break;i=a.nextOffset;let u=t+BigInt(o);if(s===ui){let c=ni(n,i);if(!c)break;i=c.nextOffset,e.push({key:a.value,value:c.value,sequence:u,deleted:!1})}else if(s===si)e.push({key:a.value,sequence:u,deleted:!0});else break;o++}return e}function uu(n){let e=[];if(n.length<48||n.readBigUInt64LE(n.length-8)!==iu)return e;let r=n.subarray(n.length-48,n.length-8),i=Kt(r,0);if(!i)return e;let o=Kt(r,i.bytesRead);if(!o)return e;let s=ti(n,o);if(!s)return e;for(let a of ri(s)){let u=Kt(a.value,0);if(!u)continue;let c=ti(n,u);if(c)for(let l of ri(c)){if(l.key.length<8)continue;let f=l.key,d=f.length-8,D=f[d],p=lu(f.subarray(d)),h=f.subarray(0,d);D===ui?e.push({key:h,value:l.value,sequence:p,deleted:!1}):D===si&&e.push({key:h,sequence:p,deleted:!0})}}return e}function ti(n,e){let t=e.offset+e.size;if(e.offset<0||e.size<0||t+5>n.length)return null;let r=n.subarray(e.offset,t),i=n[t];if(i===0)return r;if(i===1)try{return lt(r)}catch{return null}return null}function ri(n){if(n.length<4)return[];let e=n.readUInt32LE(n.length-4),t=e*4+4;if(e<1||t>n.length)return[];let r=n.length-t,i=[],o=0,s=Buffer.alloc(0);for(;o<r;){let a=we(n,o);if(!a)break;o=a.nextOffset;let u=we(n,o);if(!u)break;o=u.nextOffset;let c=we(n,o);if(!c||(o=c.nextOffset,a.value>s.length||o+u.value+c.value>r))break;let l=Buffer.concat([s.subarray(0,a.value),n.subarray(o,o+u.value)]);o+=u.value;let f=Buffer.from(n.subarray(o,o+c.value));o+=c.value,i.push({key:l,value:f}),s=l}return i}function Kt(n,e){let t=ii(n,e);if(!t)return null;let r=ii(n,t.nextOffset);return!r||t.value>BigInt(Number.MAX_SAFE_INTEGER)||r.value>BigInt(Number.MAX_SAFE_INTEGER)?null:{offset:Number(t.value),size:Number(r.value),bytesRead:r.nextOffset-e}}function ni(n,e){let t=we(n,e);if(!t)return null;let r=t.nextOffset+t.value;return r>n.length?null:{value:Buffer.from(n.subarray(t.nextOffset,r)),nextOffset:r}}function ii(n,e){let t=0n,r=0n;for(let i=e;i<n.length&&i<e+10;i++){let o=n[i];if(t|=BigInt(o&127)<<r,(o&128)===0)return{value:t,nextOffset:i+1};r+=7n}return null}function au(n,e){let t=0n;for(let r=0;r<8;r++)t|=BigInt(n[e+r]||0)<<BigInt(r*8);return t}function lu(n){let e=0n;for(let t=1;t<8;t++)e|=BigInt(n[t]||0)<<BigInt((t-1)*8);return e}function*li(n){let e=ai(n,"LocalStorage");if(ie(e)){let t=L(e,`SELECT maps.storage_key, map_entries.key,
|
|
63
63
|
map_entries.value, map_entries.value_compression_type
|
|
64
|
-
FROM map_entries JOIN maps ON maps.row_id = map_entries.map_id`);for(let r of t){if(!Buffer.isBuffer(r.storage_key)||!Buffer.isBuffer(r.key)||!Buffer.isBuffer(r.value))throw new F("unsupported_schema","Unexpected LocalStorage record encoding.");let i=r.storage_key.toString("utf8");yield{origin:i.includes("^")||i==="file:///"?i:i.replace(/\/$/,""),key:ct(r.key),value:ct(
|
|
64
|
+
FROM map_entries JOIN maps ON maps.row_id = map_entries.map_id`);for(let r of t){if(!Buffer.isBuffer(r.storage_key)||!Buffer.isBuffer(r.key)||!Buffer.isBuffer(r.value))throw new F("unsupported_schema","Unexpected LocalStorage record encoding.");let i=r.storage_key.toString("utf8");yield{origin:i.includes("^")||i==="file:///"?i:i.replace(/\/$/,""),key:ct(r.key),value:ct(fu(r.value,r.value_compression_type))}}return}for(let t of oi(ai(n,"Local Storage","leveldb"),n)){if(t.deleted||!t.value)continue;let r=du(t.key,t.value);r&&(yield r)}}function fu(n,e){switch(e){case 0:return n;case 1:return cu(n,{maxOutputLength:Ut});case 2:return lt(n);default:throw new F("unsupported_schema","Unknown LocalStorage value compression type.")}}function du(n,e){if(n.length<3||n[0]!==95)return null;let t=n.indexOf(0,1);if(t===-1)return null;let r=n.subarray(1,t).toString("utf8"),i=ct(n.subarray(t+1)),o=ct(e);return r?{origin:r,key:i,value:o}:null}function ct(n){if(n.length===0)return"";let e=n[0],t=n.subarray(1);return e===0&&t.length%2===0?t.toString("utf16le"):e===1?t.toString("latin1"):n.toString("utf8")}function ci({chromeDir:n,profilePath:e,profile:t,browser:r,onDiagnostic:i,origin:o,url:s,key:a,search:u,limit:c=100}={}){let l=S({chromeDir:n,profilePath:e,profile:t,browser:r,onDiagnostic:i}),f=[],d=pu(s||o),D=a?.toLowerCase(),p=u?.toLowerCase();for(let h of l)try{for(let g of li(h.path)){let y={profile:h.name,...g};d&&!y.origin.toLowerCase().includes(d)||D&&!y.key.toLowerCase().includes(D)||p&&!`${y.origin}
|
|
65
65
|
${y.key}
|
|
66
|
-
${y.value}`.toLowerCase().includes(p)||f.push(y)}}catch(g){B(i,h.name,"Local Storage",g)}return f.sort((h,g)=>h.profile.localeCompare(g.profile)||h.origin.localeCompare(g.origin)||h.key.localeCompare(g.key)),
|
|
67
|
-
`),city:s(H.city),state:s(H.state),zipcode:s(H.zipcode),countryCode:s(H.countryCode),origin:"",useCount:o.use_count||0,dateModified:
|
|
66
|
+
${y.value}`.toLowerCase().includes(p)||f.push(y)}}catch(g){B(i,h.name,"Local Storage",g)}return f.sort((h,g)=>h.profile.localeCompare(g.profile)||h.origin.localeCompare(g.origin)||h.key.localeCompare(g.key)),q(f,c)}function pu(n){if(n)try{return new URL(n).origin.toLowerCase()}catch{return n.toLowerCase()}}var H={firstName:3,middleName:4,lastName:5,fullName:7,email:9,phone:14,line1:30,line2:31,city:33,state:34,zipcode:35,countryCode:36,companyName:60,streetAddress:77},fi=["guid","use_count","use_date","date_modified"],di=["guid","type","value"];function oe(n,e,t){let r=new Set(n("SELECT name FROM pragma_table_info(?)",[e]).map(i=>i.name));return t.every(i=>r.has(i))}function hi(n){return R(n?BigInt(n)*1000000n+11644473600000000n:0)}function pi(n,e,t,r){let i=new Map;for(let o of n("SELECT guid, type, value FROM "+r)){let s=i.get(o.guid);s||(s=new Map,i.set(o.guid,s)),s.set(o.type,o.value)}return n("SELECT guid, use_count, use_date, date_modified FROM "+t).map(o=>{let s=a=>i.get(o.guid)?.get(a)||"";return{useDate:o.use_date,entry:{profile:e,guid:o.guid,fullName:s(H.fullName)||[H.firstName,H.middleName,H.lastName].map(s).filter(Boolean).join(" "),email:s(H.email),phone:s(H.phone),companyName:s(H.companyName),streetAddress:s(H.streetAddress)||[H.line1,H.line2].map(s).filter(Boolean).join(`
|
|
67
|
+
`),city:s(H.city),state:s(H.state),zipcode:s(H.zipcode),countryCode:s(H.countryCode),origin:"",useCount:o.use_count||0,dateModified:hi(o.date_modified)}}})}function hu(n,e){let t=oe(n,"autofill_profile_names",["guid","first_name","middle_name","last_name","full_name"])?n("SELECT guid, first_name, middle_name, last_name, full_name FROM autofill_profile_names"):[],r=oe(n,"autofill_profile_emails",["guid","email"])?n("SELECT guid, email FROM autofill_profile_emails"):[],i=oe(n,"autofill_profile_phones",["guid","number"])?n("SELECT guid, number FROM autofill_profile_phones"):[],o=new Map(t.map(u=>[u.guid,u.full_name||[u.first_name,u.middle_name,u.last_name].filter(Boolean).join(" ")])),s=new Map(r.map(u=>[u.guid,u.email])),a=new Map(i.map(u=>[u.guid,u.number]));return n("SELECT * FROM autofill_profiles ORDER BY use_date DESC").map(u=>({profile:e,guid:u.guid||"",fullName:o.get(u.guid)||"",email:s.get(u.guid)||"",phone:a.get(u.guid)||"",companyName:u.company_name||"",streetAddress:u.street_address||"",city:u.city||"",state:u.state||"",zipcode:u.zipcode||"",countryCode:u.country_code||"",origin:u.origin||"",useCount:u.use_count||0,dateModified:hi(u.date_modified)}))}function mi(n,e){return Gt(n,t=>{if(oe(t,"addresses",fi)&&oe(t,"address_type_tokens",di))return pi(t,e,"addresses","address_type_tokens").sort((o,s)=>s.useDate-o.useDate).map(({entry:o})=>o);let i=[["local_addresses","local_addresses_type_tokens"],["contact_info","contact_info_type_tokens"]].filter(([o,s])=>oe(t,o,fi)&&oe(t,s,di));if(i.length)return i.flatMap(([o,s])=>pi(t,e,o,s)).sort((o,s)=>s.useDate-o.useDate).map(({entry:o})=>o);if(oe(t,"autofill_profiles",["guid","use_date"]))return hu(t,e);throw new F("unsupported_schema","Unrecognized saved-address schema in Web Data.")})}import{join as zt}from"node:path";function Di({chromeDir:n,profilePath:e,profile:t,browser:r,onDiagnostic:i,search:o,limit:s=100}={}){let a=S({chromeDir:n,profilePath:e,profile:t,browser:r,onDiagnostic:i}),u=[],c=X(s);for(let l of a){let f=zt(l.path,"Web Data");try{let d="SELECT name, value, date_created, date_last_used, count FROM autofill",D=[];if(o){d+=" WHERE IFNULL(name, '') LIKE ? ESCAPE '\\' OR IFNULL(value, '') LIKE ? ESCAPE '\\'";let h=be(o);D.push(h,h)}d+=" ORDER BY date_last_used DESC",c&&(d+=` LIMIT ${c}`);let p=L(f,d,D);for(let h of p)u.push({profile:l.name,name:h.name||"",value:h.value||"",dateCreated:R(h.date_created?BigInt(h.date_created)*1000000n+11644473600000000n:0),dateLastUsed:R(h.date_last_used?BigInt(h.date_last_used)*1000000n+11644473600000000n:0),count:h.count||0})}catch(d){B(i,l.name,"Web Data",d)}}return q(u,s)}function gi({chromeDir:n,profilePath:e,profile:t,browser:r,onDiagnostic:i,decryptionKey:o}={}){let s=e||n,a=r??O().id,u=S({chromeDir:n,profilePath:e,profile:t,browser:a,onDiagnostic:i}),c=[];for(let l of u){let f=zt(l.path,"Web Data"),d=Ee(s??l.path,a,o,i,l.name,"Web Data");try{let D=L(f,`SELECT guid, name_on_card, expiration_month, expiration_year,
|
|
68
68
|
card_number_encrypted, date_modified, origin, use_count,
|
|
69
69
|
nickname
|
|
70
|
-
FROM credit_cards ORDER BY use_date DESC`);for(let p of D){let h="";if(p.card_number_encrypted?.length>0){let g=d(p.card_number_encrypted);h=Buffer.isBuffer(g)?g.toString("utf8"):g}c.push({profile:l.name,guid:p.guid||"",nameOnCard:p.name_on_card||"",expirationMonth:p.expiration_month||0,expirationYear:p.expiration_year||0,cardNumber:h,nickname:p.nickname||"",origin:p.origin||"",useCount:p.use_count||0,dateModified:R(p.date_modified?BigInt(p.date_modified)*1000000n+11644473600000000n:0)})}}catch(D){B(i,l.name,"Web Data",D)}}return c}function
|
|
70
|
+
FROM credit_cards ORDER BY use_date DESC`);for(let p of D){let h="";if(p.card_number_encrypted?.length>0){let g=d(p.card_number_encrypted);h=Buffer.isBuffer(g)?g.toString("utf8"):g}c.push({profile:l.name,guid:p.guid||"",nameOnCard:p.name_on_card||"",expirationMonth:p.expiration_month||0,expirationYear:p.expiration_year||0,cardNumber:h,nickname:p.nickname||"",origin:p.origin||"",useCount:p.use_count||0,dateModified:R(p.date_modified?BigInt(p.date_modified)*1000000n+11644473600000000n:0)})}}catch(D){B(i,l.name,"Web Data",D)}}return c}function yi(n={}){let e=[];for(let t of S(n))try{for(let r of mi(zt(t.path,"Web Data"),t.name))e.push(r)}catch(r){B(n.onDiagnostic,t.name,"Web Data",r)}return e}import{join as mu}from"node:path";var Du={0:"in_progress",1:"complete",2:"cancelled",3:"interrupted"},gu={0:"not_dangerous",1:"dangerous_file",2:"dangerous_url",3:"dangerous_content",4:"maybe_dangerous_content",5:"uncommon_content",6:"user_validated",7:"dangerous_host",8:"potentially_unwanted",9:"allowlisted_by_policy"};function Ci({chromeDir:n,profilePath:e,profile:t,browser:r,onDiagnostic:i,search:o,limit:s=100}={}){let a=S({chromeDir:n,profilePath:e,profile:t,browser:r,onDiagnostic:i}),u=[],c=X(s);for(let l of a){let f=mu(l.path,"History");try{let d=`SELECT target_path, tab_url, total_bytes, received_bytes,
|
|
71
71
|
start_time, end_time, mime_type, original_mime_type,
|
|
72
72
|
state, danger_type, opened, referrer, site_url
|
|
73
73
|
FROM downloads`,D=[];if(o){d+=` WHERE IFNULL(target_path, '') LIKE ? ESCAPE '\\'
|
|
74
|
-
OR IFNULL(tab_url, '') LIKE ? ESCAPE '\\'`;let h=
|
|
74
|
+
OR IFNULL(tab_url, '') LIKE ? ESCAPE '\\'`;let h=be(o);D.push(h,h)}d+=" ORDER BY start_time DESC",c&&(d+=` LIMIT ${c}`);let p=L(f,d,D);for(let h of p)u.push({profile:l.name,targetPath:h.target_path||"",url:h.tab_url||"",siteUrl:h.site_url||"",referrer:h.referrer||"",totalBytes:h.total_bytes||0,receivedBytes:h.received_bytes||0,mimeType:h.mime_type||h.original_mime_type||"",state:Du[h.state]||`unknown(${h.state})`,dangerType:gu[h.danger_type]||`unknown(${h.danger_type})`,opened:!!h.opened,startTime:R(h.start_time||0),endTime:R(h.end_time||0)})}catch(d){B(i,l.name,"History",d)}}return q(u,s)}import{existsSync as yu,readFileSync as Cu}from"node:fs";import{join as Eu}from"node:path";function Ei({chromeDir:n,profilePath:e,profile:t,search:r,browser:i,onDiagnostic:o}={}){let s=S({chromeDir:n,profilePath:e,profile:t,browser:i,onDiagnostic:o}),a=[];for(let u of s){let c=null;for(let l of["Secure Preferences","Preferences"]){let f=Eu(u.path,l);if(yu(f))try{let D=JSON.parse(Cu(f,"utf-8"))?.extensions?.settings;if(D&&typeof D=="object"){c=D;break}}catch(d){B(o,u.name,l,d instanceof SyntaxError?new Error("Invalid preferences JSON."):d)}}if(c)for(let[l,f]of Object.entries(c)){let d=f;if(d.location===5||d.location===10)continue;let D=d.manifest||{},p={profile:u.name,id:l,name:D.name||d.name||l,version:D.version||d.version||"unknown",description:D.description||"",enabled:d.state===1,homepageUrl:D.homepage_url||"",updateUrl:D.update_url||"",installTime:d.install_time||"",fromWebstore:d.from_webstore||!1,location:d.location||0};if(p.name.startsWith("__MSG_")&&(p.name=l),p.description.startsWith("__MSG_")&&(p.description=""),r){let h=r.toLowerCase();if(!(p.name&&p.name.toLowerCase().includes(h))&&!(p.id&&p.id.toLowerCase().includes(h)))continue}a.push(p)}}return a}import{join as bu}from"node:path";function bi({chromeDir:n,profilePath:e,profile:t,browser:r,onDiagnostic:i}={}){let o=S({chromeDir:n,profilePath:e,profile:t,browser:r,onDiagnostic:i}),s=[];for(let a of o){let u=bu(a.path,"Web Data");try{let c=L(u,`SELECT id, short_name, keyword, url, suggestions_url,
|
|
75
75
|
favicon_url, prepopulate_id, is_active
|
|
76
|
-
FROM keywords ORDER BY short_name`);for(let l of c)s.push({profile:a.name,id:l.id,name:l.short_name||"",keyword:l.keyword||"",url:l.url||"",suggestionsUrl:l.suggestions_url||"",faviconUrl:l.favicon_url||"",isDefault:l.prepopulate_id===1,isActive:l.is_active===1})}catch(c){B(i,a.name,"Web Data",c)}}return s}import{join as
|
|
77
|
-
FROM top_sites ORDER BY url_rank ASC`);for(let l of c)s.push({profile:a.name,url:l.url||"",title:l.title||"",rank:l.url_rank??0,redirects:l.redirects||""})}catch(c){B(i,a.name,"Top Sites",c)}}return s}var
|
|
76
|
+
FROM keywords ORDER BY short_name`);for(let l of c)s.push({profile:a.name,id:l.id,name:l.short_name||"",keyword:l.keyword||"",url:l.url||"",suggestionsUrl:l.suggestions_url||"",faviconUrl:l.favicon_url||"",isDefault:l.prepopulate_id===1,isActive:l.is_active===1})}catch(c){B(i,a.name,"Web Data",c)}}return s}import{join as wu}from"node:path";function wi({chromeDir:n,profilePath:e,profile:t,browser:r,onDiagnostic:i}={}){let o=S({chromeDir:n,profilePath:e,profile:t,browser:r,onDiagnostic:i}),s=[];for(let a of o){let u=wu(a.path,"Top Sites");try{let c=L(u,`SELECT url, url_rank, title, redirects
|
|
77
|
+
FROM top_sites ORDER BY url_rank ASC`);for(let l of c)s.push({profile:a.name,url:l.url||"",title:l.title||"",rank:l.url_rank??0,redirects:l.redirects||""})}catch(c){B(i,a.name,"Top Sites",c)}}return s}var _u=process.env.PROFILE_PATH||void 0,Fu=process.env.PROFILE_NAME||void 0,_i=process.env.BROWSER||process.env.CHROME_BROWSER||void 0;function ft(n){console.log(JSON.stringify(n,null,2))}function He(n,e){return new Fi.default({head:n.map(t=>m.bold.white(t)),colWidths:e,wordWrap:!0,style:{border:["grey"],head:[]}})}function Bu(n){return tt(n)?(console.error(m.red.bold(`
|
|
78
78
|
\u{1F511} No keychain access
|
|
79
79
|
`)),console.error(m.yellow(`chrome-tools couldn't read the browser's encryption key from your macOS
|
|
80
80
|
Keychain, so passwords and other encrypted data can't be decrypted.`)),console.error(m.dim(`
|
|
@@ -83,29 +83,29 @@ Keychain, so passwords and other encrypted data can't be decrypted.`)),console.e
|
|
|
83
83
|
\u26A0 No ${n} found.
|
|
84
84
|
`):m.green(`
|
|
85
85
|
\u2714 Found ${e} ${n}.
|
|
86
|
-
`))}function
|
|
86
|
+
`))}function U(n,e,t,r,i,o,s){if(We(n,e))return;if(e.length===0)return je(r,0);console.log(m.bold(`
|
|
87
87
|
${t}:
|
|
88
|
-
`));let a=He(i,o);for(let u of e)a.push(s(u));console.log(a.toString()),je(r,e.length)}function Yt(n){return n instanceof Error?n.message:String(n)}var se=null;function We(n,e){return se?(se.push({browser:O().name,results:e}),!0):n.json?(ft(e),!0):!1}function
|
|
88
|
+
`));let a=He(i,o);for(let u of e)a.push(s(u));console.log(a.toString()),je(r,e.length)}function Yt(n){return n instanceof Error?n.message:String(n)}var se=null;function We(n,e){return se?(se.push({browser:O().name,results:e}),!0):n.json?(ft(e),!0):!1}function xu(n,e){let t=Wt();if(t.length===0){if(e.json)return ft([]);console.log(m.yellow(`
|
|
89
89
|
\u26A0 No supported Chromium browsers found on this machine.
|
|
90
|
-
`));return}let r={...e,browser:void 0,profilePath:void 0},i=O();se=e.json?[]:null;try{for(let o of t){
|
|
90
|
+
`));return}let r={...e,browser:void 0,profilePath:void 0},i=O();se=e.json?[]:null;try{for(let o of t){Me(o.browser.id),e.json||console.log(m.bold.magenta(`
|
|
91
91
|
\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550 ${o.browser.name} \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550`));try{n(r)}catch(s){se?se.push({browser:o.browser.name,results:{error:Yt(s)}}):tt(s)?(console.log(m.red(` \u{1F511} No keychain access \u2014 skipped (${s.service}).`)),console.log(m.dim(` ${s.message.split(`
|
|
92
92
|
`).join(`
|
|
93
|
-
`)}`))):console.log(m.red(` \u26A0 Skipped: ${Yt(s)}`))}}se&&ft(se)}finally{se=null,
|
|
93
|
+
`)}`))):console.log(m.red(` \u26A0 Skipped: ${Yt(s)}`))}}se&&ft(se)}finally{se=null,Me(i.id)}}function N(n){let e=n.optsWithGlobals(),t=!!e.browser||!!e.allBrowsers||!!_i;return e.browser=e.browser||_i||void 0,e.profilePath||(e.profilePath=t?void 0:_u),e.profile||(e.profile=t?void 0:Fu),e.diagnostics&&(e.onDiagnostic=({profile:r,store:i,code:o,message:s})=>{console.error(`[${o}] ${r?r+"/":""}${i} \u2014 ${s}`)}),e}function P(n,e){if(e.allBrowsers){xu(n,e);return}Me(e.browser),n(e)}function Bi(n){let e=Wt({includeMissing:!0});if(n.json)return ft(e.map(i=>({id:i.browser.id,name:i.browser.name,installed:i.installed,profileCount:i.profileCount,path:i.chromeDir,safeStorageLabel:i.browser.safeStorageLabel})));let t=e.filter(i=>i.installed);console.log(m.bold(`
|
|
94
94
|
\u{1F310} Supported browsers (${t.length} installed):
|
|
95
|
-
`));let r=He(["Browser","Id","Installed","Profiles","Path"],[20,14,11,9,50]);for(let i of e)r.push([m.white(i.browser.name),m.cyan(i.browser.id),i.installed?m.green("\u2713"):m.dim("\u2717"),i.installed?m.yellow(String(i.profileCount)):m.dim("\u2014"),m.dim(i.chromeDir)]);console.log(r.toString())}function $(n){return n.option("--profile-path <path>","Custom browser User Data Path (overrides --browser)").option("--profile <name>","Target a specific profile").option("--browser <name>","Browser to read (chrome, edge, brave, comet, vivaldi, opera, chromium\u2026)").option("--all-browsers","Read from every installed Chromium browser").option("--diagnostics","Report profile read failures on stderr").option("--json","Output as JSON")}function le(n){return n.option("--search <term>","Filter results (case-insensitive)")}function
|
|
95
|
+
`));let r=He(["Browser","Id","Installed","Profiles","Path"],[20,14,11,9,50]);for(let i of e)r.push([m.white(i.browser.name),m.cyan(i.browser.id),i.installed?m.green("\u2713"):m.dim("\u2717"),i.installed?m.yellow(String(i.profileCount)):m.dim("\u2014"),m.dim(i.chromeDir)]);console.log(r.toString())}function $(n){return n.option("--profile-path <path>","Custom browser User Data Path (overrides --browser)").option("--profile <name>","Target a specific profile").option("--browser <name>","Browser to read (chrome, edge, brave, comet, vivaldi, opera, chromium\u2026)").option("--all-browsers","Read from every installed Chromium browser").option("--diagnostics","Report profile read failures on stderr").option("--json","Output as JSON")}function le(n){return n.option("--search <term>","Filter results (case-insensitive)")}function Fe(n,e=100){return n.option("--limit <n>","Limit number of results",xi,e)}function xi(n){let e=Number(n);if(!Number.isSafeInteger(e)||e<0)throw new Z("Limit must be a non-negative integer.");return e}var I=new fe;I.name("chrome-tools").description(m.bold.cyan("Chrome Data Toolkit")+m.dim(" \u2014 Extract passwords, bookmarks, history, cookies, and more from Chrome on macOS, Windows, and Linux")).version(Qt.version).option("--passwords","Shortcut: list saved passwords").option("--bookmarks","Shortcut: list bookmarks").option("--local-storage","Shortcut: list localStorage entries").option("--profiles","Shortcut: list profiles").option("--browsers","Shortcut: list supported / installed browsers").option("--size","Show each profile's size on disk when listing profiles (slower)");$(I).option("--search <term>","Filter results (for shortcut flags)").option("--limit <n>","Limit results (for shortcut flags)",xi).action((n,e)=>{let t=N(e);t.browsers?Bi(t):t.passwords?P(Oi,t):t.bookmarks?P(vi,t):t.localStorage?P(ki,t):P(Ai,t)});var Si=I.command("profiles").description("List Chrome profiles");$(Si).option("--size","Compute and show each profile's size on disk (slower)").action((n,e)=>{P(Ai,N(e))});var Su=Si.command("states").description("Show detailed profile states with available data files");$(Su).action((n,e)=>P(Ou,N(e)));var Au=I.command("browsers").description("List supported browsers and detect which are installed");Au.option("--json","Output as JSON").action((n,e)=>Bi(N(e)));function Ai(n){let e=ae(n.profilePath,{reportAccessDenied:!0}),t=Vt(n.profilePath),r=!!n.size;if(n.json){let u=new Map(t.map(l=>[l.directory,l])),c=e.map(l=>({...l,...u.get(l.name),...r?{sizeBytes:it(l.path)}:{}}));We(n,c);return}if(e.length===0){console.log(m.yellow(`
|
|
96
96
|
\u26A0 No Chrome profiles found.
|
|
97
97
|
`));return}let i=new Map(t.map(u=>[u.directory,u]));console.log(m.bold(`
|
|
98
98
|
\u{1F4C1} Discovered ${e.length} profile(s):
|
|
99
|
-
`));let a=He(r?["Directory","Display Name","Email","Size","Path"]:["Directory","Display Name","Email","Path"],r?[16,22,30,10,42]:[16,22,30,50]);for(let u of e){let c=i.get(u.name),l=[m.cyan(u.name),m.white(c?.name||u.name),m.dim(c?.email||"\u2014")];r&&l.push(m.yellow(
|
|
99
|
+
`));let a=He(r?["Directory","Display Name","Email","Size","Path"]:["Directory","Display Name","Email","Path"],r?[16,22,30,10,42]:[16,22,30,50]);for(let u of e){let c=i.get(u.name),l=[m.cyan(u.name),m.white(c?.name||u.name),m.dim(c?.email||"\u2014")];r&&l.push(m.yellow(Ri(it(u.path)))),l.push(m.dim(u.path)),a.push(l)}console.log(a.toString()),je("profile(s)",e.length)}function Ou(n){let e=Nn(n.profilePath);if(n.json){We(n,e);return}if(e.length===0){console.log(m.yellow(`
|
|
100
100
|
\u26A0 No Chrome profiles found.
|
|
101
101
|
`));return}console.log(m.bold(`
|
|
102
102
|
\u{1F4CA} Profile States (${e.length} profile(s)):
|
|
103
|
-
`));for(let t of e){console.log(m.bold.cyan(` ${t.displayName}`)+m.dim(` (${t.directory})`)),t.email&&console.log(m.dim(` Email: ${t.email}`)),console.log(m.dim(` Path: ${t.path}`));let r=t.dataFiles,i=Object.entries(r).filter(([,s])=>s).map(([s])=>s),o=Object.entries(r).filter(([,s])=>!s).map(([s])=>s);console.log(` Available: ${i.map(s=>m.green(s)).join(", ")||m.dim("none")}`),o.length>0&&console.log(` Missing: ${o.map(s=>m.dim(s)).join(", ")}`),console.log()}}var
|
|
103
|
+
`));for(let t of e){console.log(m.bold.cyan(` ${t.displayName}`)+m.dim(` (${t.directory})`)),t.email&&console.log(m.dim(` Email: ${t.email}`)),console.log(m.dim(` Path: ${t.path}`));let r=t.dataFiles,i=Object.entries(r).filter(([,s])=>s).map(([s])=>s),o=Object.entries(r).filter(([,s])=>!s).map(([s])=>s);console.log(` Available: ${i.map(s=>m.green(s)).join(", ")||m.dim("none")}`),o.length>0&&console.log(` Missing: ${o.map(s=>m.dim(s)).join(", ")}`),console.log()}}var vu=I.command("passwords").description("List saved passwords");le($(vu)).option("--diagnose","Report the stores that would be read \u2014 profile, file, row count, and any read error \u2014 instead of the passwords themselves").action((n,e)=>P(Oi,N(e)));function Oi(n){if(n.diagnose)return ku(n);let e=Gn(n);if(We(n,e))return;if(e.length===0)return je("passwords",0);console.log(m.bold(`
|
|
104
104
|
\u{1F511} Saved Passwords:
|
|
105
|
-
`));let t=new Set(e.map(s=>s.profile)).size>1,r=["Source","URL","Username","Password","Last Used"],i=[9,42,24,22,20];t&&(r.unshift("Profile"),i.unshift(12));let o=He(r,i);for(let s of e){let a=[m.blue(s.source??"?"),m.cyan(s.url),m.green(s.username||"<empty>"),m.yellow(s.password||"<empty>"),m.dim(s.lastUsed)];t&&a.unshift(m.magenta(s.profile)),o.push(a)}console.log(o.toString()),je("password(s)",e.length)}function
|
|
105
|
+
`));let t=new Set(e.map(s=>s.profile)).size>1,r=["Source","URL","Username","Password","Last Used"],i=[9,42,24,22,20];t&&(r.unshift("Profile"),i.unshift(12));let o=He(r,i);for(let s of e){let a=[m.blue(s.source??"?"),m.cyan(s.url),m.green(s.username||"<empty>"),m.yellow(s.password||"<empty>"),m.dim(s.lastUsed)];t&&a.unshift(m.magenta(s.profile)),o.push(a)}console.log(o.toString()),je("password(s)",e.length)}function ku(n){let e=Vn(n);if(We(n,e))return;if(e.length===0){console.log(m.yellow(`
|
|
106
106
|
\u26A0 No profiles found to read.
|
|
107
107
|
`));return}console.log(m.bold(`
|
|
108
108
|
\u{1F50E} Password stores:
|
|
109
|
-
`));let t=He(["Root","Profile","Store","Exists","Rows","Error"],[34,12,24,7,6,40]);for(let r of e)t.push([m.dim(r.root),r.profile,m.blue(r.file),r.exists?"yes":m.yellow("no"),r.rows===null?m.red("?"):String(r.rows),r.error?m.red(r.error):""]);console.log(t.toString()),console.log()}var
|
|
109
|
+
`));let t=He(["Root","Profile","Store","Exists","Rows","Error"],[34,12,24,7,6,40]);for(let r of e)t.push([m.dim(r.root),r.profile,m.blue(r.file),r.exists?"yes":m.yellow("no"),r.rows===null?m.red("?"):String(r.rows),r.error?m.red(r.error):""]);console.log(t.toString()),console.log()}var Ru=I.command("bookmarks").description("List bookmarks");le($(Ru)).option("--folder <name>","Filter by folder name").action((n,e)=>P(vi,N(e)));function vi(n){U(n,Kn(n),"\u{1F4DA} Bookmarks","bookmark(s)",["Title","URL","Folder","Date Added"],[30,50,25,20],e=>[m.white(e.title),m.cyan(e.url),m.dim(e.folder||"/"),m.dim(e.dateAdded)])}var Tu=I.command("history").description("List browsing history");le(Fe($(Tu))).action((n,e)=>P(t=>{U(t,zn(t),"\u{1F550} Browsing History","history entry(ies)",["URL","Title","Visits","Last Visit"],[50,30,8,22],r=>[m.cyan(r.url),m.white(r.title||"\u2014"),m.yellow(String(r.visitCount)),m.dim(r.lastVisit)])},N(e)));var Lu=I.command("search-terms").description("List search terms from history");Fe($(Lu)).action((n,e)=>P(t=>{U(t,Yn(t),"\u{1F50D} Search Terms","search term(s)",["Term","URL"],[40,80],r=>[m.white(r.term),m.dim(r.url)])},N(e)));var Pu=I.command("cookies").description("List cookies (encrypted values decrypted)");Fe($(Pu)).option("--domain <domain>","Filter by domain").option("--url <url>","Filter by URL with path").option("--no-decrypt","Skip decryption of encrypted values").action((n,e)=>P(t=>{U(t,Jn(t),"\u{1F36A} Cookies","cookie(s)",["Domain","Name","Value","Secure","Expires"],[30,25,30,8,22],r=>[m.cyan(r.domain),m.white(r.name),m.dim(dt(r.value,50)),r.secure?m.green("\u2713"):m.dim("\u2717"),m.dim(r.expires)])},N(e)));var Iu=I.command("local-storage").description("List localStorage entries");le(Fe($(Iu))).option("--origin <origin>","Filter by origin").option("--url <url>","Filter by URL origin").option("--key <key>","Filter by localStorage key").action((n,e)=>P(ki,N(e)));function ki(n){U(n,ci(n),"\u{1F4BE} localStorage","localStorage entries",["Origin","Key","Value"],[36,28,46],e=>[m.cyan(e.origin),m.white(e.key),m.dim(dt(e.value,80))])}var Nu=I.command("autofill").description("List autofill entries");le(Fe($(Nu))).action((n,e)=>P(t=>{U(t,Di(t),"\u{1F4DD} Autofill Entries","autofill entry(ies)",["Field Name","Value","Count","Last Used"],[25,40,8,22],r=>[m.cyan(r.name),m.white(r.value),m.yellow(String(r.count)),m.dim(r.dateLastUsed)])},N(e)));var Mu=I.command("credit-cards").description("List saved credit cards");$(Mu).action((n,e)=>P(t=>{U(t,gi(t),"\u{1F4B3} Saved Credit Cards","credit card(s)",["Name on Card","Card Number","Expires","Nickname"],[25,25,14,20],r=>[m.white(r.nameOnCard||"\u2014"),m.yellow(r.cardNumber||"\u2014"),m.dim(`${r.expirationMonth}/${r.expirationYear}`),m.dim(r.nickname||"\u2014")])},N(e)));var $u=I.command("addresses").description("List saved addresses");$($u).action((n,e)=>P(t=>{U(t,yi(t),"\u{1F3E0} Saved Addresses","address(es)",["Name","Email","Phone","Address","City/State/Zip"],[20,25,16,30,25],r=>[m.white(r.fullName||"\u2014"),m.cyan(r.email||"\u2014"),m.dim(r.phone||"\u2014"),m.white(r.streetAddress||"\u2014"),m.dim([r.city,r.state,r.zipcode].filter(Boolean).join(", ")||"\u2014")])},N(e)));var ju=I.command("downloads").description("List download history");le(Fe($(ju))).action((n,e)=>P(t=>{U(t,Ci(t),"\u2B07\uFE0F Download History","download(s)",["File","URL","Size","State","Date"],[35,40,12,12,20],r=>[m.white(r.targetPath?r.targetPath.split(/[\\/]/).pop()||"":"\u2014"),m.cyan(dt(r.url,60)),m.dim(r.totalBytes>0?Ri(r.totalBytes):"\u2014"),r.state==="complete"?m.green(r.state):m.yellow(r.state),m.dim(r.startTime)])},N(e)));var Hu=I.command("extensions").description("List installed extensions");le($(Hu)).action((n,e)=>P(t=>{U(t,Ei(t),"\u{1F9E9} Installed Extensions","extension(s)",["Name","Version","ID","Enabled","Webstore"],[30,12,36,9,9],r=>[m.white(r.name),m.dim(r.version),m.dim(r.id),r.enabled?m.green("\u2713"):m.red("\u2717"),r.fromWebstore?m.green("\u2713"):m.dim("\u2717")])},N(e)));var Wu=I.command("search-engines").description("List configured search engines");$(Wu).action((n,e)=>P(t=>{U(t,bi(t),"\u{1F50E} Search Engines","search engine(s)",["Name","Keyword","URL","Active"],[20,16,60,8],r=>[m.white(r.name),m.cyan(r.keyword),m.dim(dt(r.url,80)),r.isActive?m.green("\u2713"):m.dim("\u2717")])},N(e)));var Vu=I.command("top-sites").description("List top sites");$(Vu).action((n,e)=>P(t=>{U(t,wi(t),"\u2B50 Top Sites","top site(s)",["Rank","Title","URL"],[8,30,80],r=>[m.yellow(String(r.rank+1)),m.white(r.title||"\u2014"),m.cyan(r.url)])},N(e)));function Ri(n){if(n===0)return"0 B";let e=["B","KB","MB","GB","TB"],t=Math.floor(Math.log(n)/Math.log(1024));return`${(n/Math.pow(1024,t)).toFixed(1)} ${e[t]}`}function dt(n,e){return n?n.length>e?n.slice(0,e)+"\u2026":n:"\u2014"}try{I.parse()}catch(n){Bu(n)||console.error(m.red(`
|
|
110
110
|
\u2716 ${Yt(n)}
|
|
111
111
|
`)),process.env.DEBUG&&console.error(n),process.exit(1)}
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{existsSync as
|
|
1
|
+
import{existsSync as k,readdirSync as tt,readFileSync as ot,statSync as an}from"node:fs";import{basename as nt,join as A}from"node:path";import{createDecipheriv as ue}from"node:crypto";var Br=Buffer.alloc(16," "),U=12,K=16;function ee(e,t){if(!e||e.length===0)return Buffer.alloc(0);let r=Buffer.isBuffer(e)?e:Buffer.from(e),o=r.subarray(0,3).toString("utf-8");if(o!=="v10"&&o!=="v11")return"<unsupported encryption format>";let n=r.subarray(3);try{let s=ue("aes-128-cbc",t,Br),i=s.update(n);return i=Buffer.concat([i,s.final()]),i}catch{return"<decryption failed>"}}function Ae(e,t){if(!e||e.length===0)return Buffer.alloc(0);let r=Buffer.isBuffer(e)?e:Buffer.from(e),o=r.subarray(0,3).toString("utf-8");if(o!=="v10"&&o!=="v11")return"<unsupported encryption format>";if(r.length<3+U+K)return"<decryption failed>";let n=r.subarray(3,3+U),s=r.subarray(r.length-K),i=r.subarray(3+U,r.length-K);try{let c=ue("aes-256-gcm",t,n);return c.setAuthTag(s),Buffer.concat([c.update(i),c.final()])}catch{return"<decryption failed>"}}function re(e,t){if(!e||e.length===0)return Buffer.alloc(0);let r=Buffer.isBuffer(e)?e:Buffer.from(e);if(r.subarray(0,3).toString("utf-8")!=="v20")return"<unsupported encryption format>";if(r.length<3+U+K)return"<decryption failed>";let n=r.subarray(3,3+U),s=r.subarray(r.length-K),i=r.subarray(3+U,r.length-K);try{let c=ue("aes-256-gcm",t,n);return c.setAuthTag(s),Buffer.concat([c.update(i),c.final()])}catch{return"<decryption failed>"}}function E(e){if(e==null)return"N/A";try{let t=BigInt(e);if(t===0n)return"N/A";let r=t-11644473600000000n,o=Number(r/1000n),n=new Date(o);return isNaN(n.getTime())?"N/A":n.toLocaleString()}catch{return"N/A"}}var h=class extends Error{constructor(r,o,n){super(o,n);this.code=r}code};function w(e,t,r,o){if(!e)return;let n=o instanceof h?o.code:o?.code==="ENOENT"?"missing_store":"unreadable";e({profile:t,store:r,code:n,message:o instanceof Error?o.message:String(o)})}import{homedir as Ar}from"node:os";import{join as Tr}from"node:path";import{execFileSync as vr}from"node:child_process";import{pbkdf2Sync as xr}from"node:crypto";var br=1003,Dr=16,Pr=Buffer.from("saltysalt"),ge="Chrome Safe Storage",pe={ITEM_NOT_FOUND:44,INTERACTION_NOT_ALLOWED:36,AUTH_FAILED:45,USER_CANCELED:128},X=class extends Error{service;kind;constructor(t,r,o){super(t),this.name="KeychainAccessError",this.service=r,this.kind=o}get isAccessDenied(){return this.kind==="access-denied"}};var de=new Map,me=new Map;function Cr(){return!!(process.env.SSH_CONNECTION||process.env.SSH_TTY)||!process.env.TERM_PROGRAM}function Rr(e){let t=e;return{status:typeof t?.status=="number"?t.status:null,stderr:(t?.stderr??"").toString().trim()}}function kr(e,t,r){let o="See docs/remote-keychain-access.md for non-interactive / SSH setup.",n,s;t===pe.ITEM_NOT_FOUND||/could not be found/i.test(r)?(n="not-found",s=`No '${e}' item found in the Keychain.
|
|
2
2
|
Run this browser at least once on this machine so it creates the key.`):t===pe.INTERACTION_NOT_ALLOWED||/interaction.*not allowed/i.test(r)?(n="access-denied",s="The Keychain needs a GUI authorization prompt that can't be shown here "+(Cr()?`(you appear to be on a remote/SSH session).
|
|
3
3
|
`:`.
|
|
4
4
|
`)+`Authorize once from a GUI Terminal (click "Always Allow"), then unlock the
|
|
@@ -9,33 +9,33 @@ Try: security unlock-keychain ~/Library/Keychains/login.keychain-db
|
|
|
9
9
|
${o}`):(n="access-denied",s=`macOS showed a Keychain access prompt that was denied or dismissed.
|
|
10
10
|
Re-run the command and click "Allow" (or "Always Allow"), or authorize once with:
|
|
11
11
|
security find-generic-password -w -s "${e}"
|
|
12
|
-
${o}`);let i=[t!==null?`exit ${t}`:null,r||null].filter(Boolean).join(": ");return new
|
|
12
|
+
${o}`);let i=[t!==null?`exit ${t}`:null,r||null].filter(Boolean).join(": ");return new X(`Could not retrieve ${e} key from macOS Keychain.
|
|
13
13
|
${s}`+(i?`
|
|
14
|
-
(security: ${i})`:""),e,n)}var te=null;function ye(){return te}function
|
|
15
|
-
The item may exist with no password. Re-run the browser to recreate it.`,e,"empty");return de.set(e,r),r}function
|
|
14
|
+
(security: ${i})`:""),e,n)}var te=null;function ye(){return te}function Lr(e){te=e}function he(e=ge){let t=de.get(e);if(t!==void 0)return t;let r;if(te)r=te(e);else try{r=vr("security",["find-generic-password","-w","-s",e],{encoding:"utf-8",stdio:["pipe","pipe","pipe"]}).trim()}catch(o){let{status:n,stderr:s}=Rr(o);throw kr(e,n,s)}if(!r)throw new X(`Keychain returned an empty ${e} key.
|
|
15
|
+
The item may exist with no password. Re-run the browser to recreate it.`,e,"empty");return de.set(e,r),r}function Or(){return he(ge)}function Te(e=ge,t){let r=me.get(e);if(r!==void 0)return r;let o=t||he(e);if(!o)throw new Error("Keychain password cannot be empty for key derivation.");let n=xr(o,Pr,br,Dr,"sha1");return me.set(e,n),n}function we(){de.clear(),me.clear()}var Z={chrome:{id:"chrome",name:"Google Chrome",aliases:["google-chrome","google chrome"],safeStorageLabel:"Chrome Safe Storage",linuxSecretApp:"chrome",dirs:{darwin:"Google/Chrome",win32:"Google/Chrome/User Data",linux:"google-chrome"}},"chrome-beta":{id:"chrome-beta",name:"Google Chrome Beta",safeStorageLabel:"Chrome Safe Storage",linuxSecretApp:"chrome",dirs:{darwin:"Google/Chrome Beta",win32:"Google/Chrome Beta/User Data",linux:"google-chrome-beta"}},"chrome-canary":{id:"chrome-canary",name:"Google Chrome Canary",aliases:["canary"],safeStorageLabel:"Chrome Safe Storage",linuxSecretApp:"chrome",dirs:{darwin:"Google/Chrome Canary",win32:"Google/Chrome SxS/User Data",linux:"google-chrome-unstable"}},chromium:{id:"chromium",name:"Chromium",safeStorageLabel:"Chromium Safe Storage",linuxSecretApp:"chromium",dirs:{darwin:"Chromium",win32:"Chromium/User Data",linux:"chromium"}},edge:{id:"edge",name:"Microsoft Edge",aliases:["msedge","microsoft-edge","microsoft edge"],safeStorageLabel:"Microsoft Edge Safe Storage",linuxSecretApp:"chromium",dirs:{darwin:"Microsoft Edge",win32:"Microsoft/Edge/User Data",linux:"microsoft-edge"}},brave:{id:"brave",name:"Brave",aliases:["brave-browser"],safeStorageLabel:"Brave Safe Storage",linuxSecretApp:"chrome",dirs:{darwin:"BraveSoftware/Brave-Browser",win32:"BraveSoftware/Brave-Browser/User Data",linux:"BraveSoftware/Brave-Browser"}},comet:{id:"comet",name:"Comet",aliases:["perplexity","perplexity-comet"],safeStorageLabel:"Comet Safe Storage",linuxSecretApp:"chromium",dirs:{darwin:"Comet",win32:"Perplexity/Comet/User Data",linux:"comet"}},vivaldi:{id:"vivaldi",name:"Vivaldi",safeStorageLabel:"Chrome Safe Storage",linuxSecretApp:"chrome",dirs:{darwin:"Vivaldi",win32:"Vivaldi/User Data",linux:"vivaldi"}},opera:{id:"opera",name:"Opera",safeStorageLabel:"Opera Safe Storage",linuxSecretApp:"chromium",dirs:{darwin:"com.operasoftware.Opera",win32:"Opera Software/Opera Stable",win32Base:"roaming",linux:"opera"}}},Ie="chrome";function $(){return Object.values(Z)}function Se(e){if(!e)return null;let t=e.trim().toLowerCase();for(let r of $())if(r.id.toLowerCase()===t||r.name.toLowerCase()===t||r.aliases?.some(o=>o.toLowerCase()===t))return r;return null}function M(e){let t=Se(e);if(t)return t;throw new Error(`Unknown browser "${e}". Supported: ${$().map(r=>r.id).join(", ")}.`)}var Q=Z[Ie];function v(){return Q}function Ne(e){return!e||!e.trim()?(Q=Z[Ie],Q):(Q=M(e),Q)}var Me={name:"darwin",getDefaultChromeDir(e=v()){return Tr(Ar(),"Library","Application Support",...e.dirs.darwin.split("/"))},getDecryptionKey(e,t=v()){return Te(t.safeStorageLabel)},decrypt(e,t){return ee(e,t)},clearCache(){we()}};import{execFileSync as $e}from"node:child_process";import{randomUUID as Ir}from"node:crypto";import{constants as Nr,copyFileSync as Mr,existsSync as H,mkdirSync as Fr,readFileSync as Fe,rmSync as Ur,rmdirSync as Kr}from"node:fs";import{dirname as He,join as C,resolve as $r}from"node:path";var _e=Buffer.from("DPAPI","ascii"),Ee=Buffer.from("APPB","ascii"),Be=new Map,ve=new Map,xe=new WeakMap,Hr=new Set(["chrome","chrome-beta","brave","edge"]);function Gr(e){let t=["$ErrorActionPreference='Stop';","Add-Type -AssemblyName System.Security;","$b=[Console]::In.ReadToEnd().Trim();","$enc=[Convert]::FromBase64String($b);","$dec=[System.Security.Cryptography.ProtectedData]::Unprotect($enc,$null,[System.Security.Cryptography.DataProtectionScope]::CurrentUser);","[Console]::Out.Write([Convert]::ToBase64String($dec));"].join(" "),r;try{r=$e("powershell.exe",["-NoProfile","-NonInteractive","-Command",t],{input:e.toString("base64"),encoding:"utf-8"})}catch(o){throw new Error(`DPAPI decryption via PowerShell failed.
|
|
16
16
|
The encrypted_key can only be unprotected by the same Windows user that created it. Run as that user on the same machine.
|
|
17
|
-
(powershell: ${o?.message??o})`)}return Buffer.from(r.trim(),"base64")}function Ue(e){let t
|
|
17
|
+
(powershell: ${o?.message??o})`)}return Buffer.from(r.trim(),"base64")}function Ue(e){let t=$r(e),r=He(t);return H(C(t,"Local State"))?t:r!==t&&H(C(r,"Local State"))?r:t}function Ke(e,t,r){try{let o=$e(e,[r],{input:t.toString("base64"),encoding:"utf8",timeout:1e4,windowsHide:!0,stdio:["pipe","pipe","pipe"],cwd:He(e)}),n=Buffer.from(o.trim(),"base64");return n.length===32?n:void 0}catch{return}}function Wr(e,t){if(!Hr.has(t.id))return;let r=import.meta.dirname,o=[C(r,"chrome_abe_decrypt.exe"),C(r,"../../native/windows/chrome_abe_decrypt.exe")].find(H);if(!o)return;let n=Ke(o,e,t.id);if(n)return n;let s=t.dirs.win32.split("/").slice(0,-1),i=t.id==="edge"?"msedge.exe":t.id==="brave"?"brave.exe":"chrome.exe",c=new Set([process.env.ProgramW6432,process.env.ProgramFiles,process.env["ProgramFiles(x86)"],process.env.LOCALAPPDATA]);for(let a of c){if(!a)continue;let f=C(a,...s);if(!H(C(f,"Application",i)))continue;let l=C(f,"Temp"),p=C(l,`chrome-tools-${Ir()}.exe`),u=!1,g=!1;try{u=Fr(l,{recursive:!0})!==void 0,Mr(o,p,Nr.COPYFILE_EXCL),g=!0;let m=Ke(p,e,t.id);if(m)return m}catch{}finally{if(g)try{Ur(p)}catch{}if(u)try{Kr(l)}catch{}}}}var Ge={name:"win32",getDefaultChromeDir(e=v()){let r=e.dirs.win32Base==="roaming"?process.env.APPDATA||(process.env.USERPROFILE?C(process.env.USERPROFILE,"AppData","Roaming"):""):process.env.LOCALAPPDATA||(process.env.USERPROFILE?C(process.env.USERPROFILE,"AppData","Local"):"");if(!r)throw new Error("Could not resolve the Windows application-data directory.");return C(r,...e.dirs.win32.split("/"))},getDecryptionKey(e,t=v()){let r=e||this.getDefaultChromeDir(t),o=Ue(r),n=JSON.stringify([o,t.id]),s=Be.get(n);if(s)return s;let i=C(o,"Local State");if(!H(i))throw new Error(`Could not find Chrome's "Local State" at ${i}.
|
|
18
18
|
Run Google Chrome at least once so it creates the encryption key.`);let c;try{let l=Fe(i,"utf-8");c=JSON.parse(l)?.os_crypt?.encrypted_key}catch(l){throw new Error(`Failed to read os_crypt.encrypted_key from Local State: ${l.message}`)}if(!c)throw new Error(`No os_crypt.encrypted_key found in Local State.
|
|
19
|
-
This profile may predate Chrome's encrypted-key scheme.`);let a=Buffer.from(c,"base64");if(!a.subarray(0,_e.length).equals(_e))throw new Error('Unexpected encrypted_key format (missing "DPAPI" prefix).');let f=
|
|
20
|
-
FROM logins ORDER BY origin_url`);for(let b of
|
|
19
|
+
This profile may predate Chrome's encrypted-key scheme.`);let a=Buffer.from(c,"base64");if(!a.subarray(0,_e.length).equals(_e))throw new Error('Unexpected encrypted_key format (missing "DPAPI" prefix).');let f=Gr(a.subarray(_e.length));return Be.set(n,f),xe.set(f,{chromeDir:o,browser:t}),f},getAppBoundKey(e,t=v()){let r=Ue(e||this.getDefaultChromeDir(t)),o=JSON.stringify([r,t.id]),n=ve.get(o);if(n)return n;let s=C(r,"Local State");if(!H(s))return;let i;try{let f=Fe(s,"utf-8");i=JSON.parse(f)?.os_crypt?.app_bound_encrypted_key}catch{return}if(!i)return;let c=Buffer.from(i,"base64");if(!c.subarray(0,Ee.length).equals(Ee))return;let a=Wr(c.subarray(Ee.length),t);if(a)return ve.set(o,a),a},decrypt(e,t){if(e.subarray(0,3).toString()==="v20"){let r=xe.get(t),o=r&&this.getAppBoundKey?.(r.chromeDir,r.browser);return o?re(e,o):"<app-bound encryption unavailable>"}return Ae(e,t)},clearCache(){Be.clear(),ve.clear(),xe=new WeakMap}};import{execFileSync as jr}from"node:child_process";import{homedir as Vr}from"node:os";import{join as We}from"node:path";import{pbkdf2Sync as zr}from"node:crypto";var qr=1,Yr=16,Jr=Buffer.from("saltysalt"),Xr="peanuts",be=new Map;function Qr(e){let t=ye();if(t)return t(e);try{let r=jr("secret-tool",["lookup","application",e],{encoding:"utf-8",stdio:["pipe","pipe","pipe"]}).trim();if(r)return r}catch{}return Xr}var je={name:"linux",getDefaultChromeDir(e=v()){let t=process.env.XDG_CONFIG_HOME||We(Vr(),".config");return We(t,...e.dirs.linux.split("/"))},getDecryptionKey(e,t=v()){let r=t.linuxSecretApp||"chrome",o=be.get(r);if(o!==void 0)return o;let n=zr(Qr(r),Jr,qr,Yr,"sha1");return be.set(r,n),n},decrypt(e,t){return ee(e,t)},clearCache(){be.clear()}};var G=null;function W(){if(G)return G;switch(process.platform){case"darwin":G=Me;break;case"win32":G=Ge;break;case"linux":G=je;break;default:throw new Error(`Unsupported platform: ${process.platform}. chrome-tools supports macOS, Windows, and Linux.`)}return G}function De(e){return W().getDefaultChromeDir(Pe(e))}function Zr(e,t){return W().getDecryptionKey(e,Pe(t))}function Ve(e,t){if(!e||e.length===0)return Buffer.alloc(0);let r=Buffer.isBuffer(e)?e:Buffer.from(e);return W().decrypt(r,t)}function et(e,t){let r=Ve(e,t);return Buffer.isBuffer(r)?r.toString("utf-8"):r}function rt(){W().clearCache()}function Pe(e){return e?typeof e=="string"?M(e):e:v()}function j(e,t,r,o,n,s){let i=Pe(t),c=r,a,f=new Set;return l=>{let p;try{let u=W();u.getAppBoundKey&&l.subarray(0,3).toString()==="v20"?(a===void 0&&(a=u.getAppBoundKey(e,i)??null),p=a?re(l,a):"<app-bound encryption unavailable>"):(c??=u.getDecryptionKey(e,i),p=u.decrypt(l,c))}catch(u){throw new h("decryption_unavailable",u instanceof Error?u.message:String(u),{cause:u})}return typeof p=="string"&&!f.has(p)&&(f.add(p),w(o,n,s,new h("decryption_unavailable",p))),p}}var qe=["Login Data","History","Bookmarks","Cookies","Web Data","Local Storage","LocalStorage","Preferences"];function oe(e){let t=A(e,"Network","Cookies");return k(t)?t:A(e,"Cookies")}function ze(e){return qe.some(t=>k(A(e,t)))||k(oe(e))}function F(e){return De(e)}function st({includeMissing:e=!1}={}){let t=[];for(let r of $()){let o=F(r),n=k(o);!n&&!e||t.push({browser:r,chromeDir:o,installed:n,profileCount:n?V(o).length:0})}return t}function V(e,{reportAccessDenied:t=!1}={}){let r=e||F();if(!r)return[];try{let o=tt(r,{withFileTypes:!0}),n=[];for(let s of o){if(!s.isDirectory()||s.name==="Network")continue;let i=A(r,s.name);ze(i)&&n.push({name:s.name,path:i})}if(n.length===0&&ze(r)){let s=nt(r)||"Default";n.push({name:s,path:r})}return n}catch(o){let n=o.code;if(t&&(n==="EACCES"||n==="EPERM")){let s=process.platform==="darwin"?" Try Terminal.app if it already has access, or review the current app's permissions in System Settings \u2192 Privacy & Security.":" Check that your user has permission to read this directory.";throw new Error(`Permission denied reading the browser profile directory "${r}" (${n}).${s}`,{cause:o})}return[]}}function Ye(e){let t=e||F(),r=A(t,"Local State");if(!k(r))return[];try{let o=ot(r,"utf-8"),s=JSON.parse(o)?.profile?.info_cache;return!s||typeof s!="object"?[]:Object.entries(s).map(([i,c])=>{let a=c;return{directory:i,name:a.name||i,gaiaName:a.gaia_name||"",userName:a.user_name||"",email:a.user_name||"",avatarIcon:a.avatar_icon||"",isUsingDefaultName:a.is_using_default_name??!0,isEphemeral:a.is_ephemeral??!1,activeTime:a.active_time||0}})}catch{return[]}}function it(e){let t=e||F(),r=V(t),o=Ye(t),n=new Map;for(let s of o)n.set(s.directory,s);return r.map(s=>{let i=n.get(s.name),c=s.path,a={};for(let f of qe)a[f.replace(/\s+/g,"_").toLowerCase()]=k(A(c,f));return a.cookies=k(oe(c)),a.top_sites=k(A(c,"Top Sites")),a.extensions=k(A(c,"Extensions")),{directory:s.name,path:c,displayName:i?.name||s.name,gaiaName:i?.gaiaName||"",email:i?.email||"",avatarIcon:i?.avatarIcon||"",isEphemeral:i?.isEphemeral??!1,activeTime:i?.activeTime||0,dataFiles:a}})}function at(e,t){let r=e||F(),o=A(r,t);return k(o)?o:null}function S({profilePath:e,chromeDir:t,profile:r,browser:o,onDiagnostic:n}={}){let s=o?M(o):void 0,i=e||t||F(s),c;try{c=V(i,{reportAccessDenied:!!n})}catch(a){n?.({profile:r??"",store:"User Data",code:"unreadable",message:a instanceof Error?a.message:String(a)}),c=[]}if(r){let a=c.filter(f=>f.name===r);if(a.length===0)throw new Error(`Profile "${r}" not found in ${i}`);return a}return c}import{copyFileSync as gt,rmSync as yt}from"node:fs";import{basename as ie,dirname as Xe,join as ht}from"node:path";import{DatabaseSync as wt}from"node:sqlite";import{lstatSync as ct,mkdtempSync as ft,realpathSync as Je}from"node:fs";import{tmpdir as lt}from"node:os";import{isAbsolute as ut,join as pt,relative as dt,sep as mt}from"node:path";function T(e){try{let t=ct(e,{bigint:!0});if(!t.isFile())throw new h("unreadable",`Expected a regular store file: ${e}`);return t}catch(t){if(t.code==="ENOENT")return;throw t}}function ne(e,t){return!e||!t?e===t:e.dev===t.dev&&e.ino===t.ino&&e.size===t.size&&e.mtimeNs===t.mtimeNs&&e.ctimeNs===t.ctimeNs}function se(e,t){let r=Je(lt()),o=Je(e),n=dt(o,r);if(!ut(n)&&n!==".."&&!n.startsWith(".."+mt))throw new h("snapshot_unavailable","The temporary directory is inside the source profile. Set it to a directory outside the profile.");return ft(pt(r,t))}function St(e){return e.map(t=>{let r={};for(let o of Object.keys(t)){let n=t[o];typeof n=="bigint"?r[o]=Number(n):n instanceof Uint8Array&&!Buffer.isBuffer(n)?r[o]=Buffer.from(n.buffer,n.byteOffset,n.byteLength):r[o]=n}return r})}function _t(e,t){let r=["","-wal","-journal"],o=r.map(n=>T(e+n));if(!o[0])throw new h("missing_store",`Database file not found: ${e}`);try{for(let[n,s]of r.entries())o[n]&>(e+s,t+s)}catch(n){let s=n.code;throw["EBUSY","EPERM","EACCES","ENOENT"].includes(s??"")?new h("snapshot_unavailable",`Could not copy ${ie(e)} and its journals. Close the browser and retry if it is open.`,{cause:n}):n}if(r.some((n,s)=>!ne(o[s],T(e+n))))throw new h("snapshot_unavailable",`${ie(e)} changed during the copy. Close the browser and retry.`)}function Ce(e,t){let r=Xe(e),o=ie(r)==="Network"?Xe(r):r,n=se(o,"chrome-tools-"),s=ht(n,"snapshot.sqlite"),i;try{_t(e,s),i=new wt(s,{timeout:0}),i.exec("PRAGMA trusted_schema = OFF; PRAGMA query_only = ON;");let c=i;return t((a,f=[])=>{let l=a.replace(/^(?:\s+|--[^\n]*(?:\n|$)|\/\*[\s\S]*?\*\/)+/,"");if(!/^(SELECT|WITH|VALUES|EXPLAIN|PRAGMA)\b/i.test(l))throw new h("unreadable","Only read queries are supported.");let p=c.prepare(l);return p.setReadBigInts(!0),St(p.all(...f))})}catch(c){if(c instanceof h)throw c;let a=c instanceof Error?c.message:String(c),f=/no such (table|column)/i.test(a)?"unsupported_schema":"unreadable";throw new h(f,`Database query failed on '${ie(e)}': ${a}`,{cause:c})}finally{try{i?.close()}finally{yt(n,{recursive:!0,force:!0,maxRetries:3})}}}function B(e,t,r=[]){return Ce(e,o=>o(t,r))}function Et(e,t){try{return B(e,"SELECT 1 FROM sqlite_schema WHERE type = 'table' AND name = ?",[t]).length>0}catch{return!1}}import{existsSync as Bt,readFileSync as vt}from"node:fs";import{homedir as Qe}from"node:os";import{join as ae}from"node:path";var Ze=[{file:"Login Data",source:"device"},{file:"Login Data For Account",source:"account"}],xt=ae(Qe(),".chrome_cdp_profile"),bt=ae(Qe(),".config","chrome-cdp-manager","config.json"),Dt=["0","off","none","false"];function Pt(){let e=process.env.CHROME_AUTOMATION_DIR?.trim();if(e&&Dt.includes(e.toLowerCase()))return;let t=e||Ct()||xt;return V(t).length>0?t:void 0}function Ct(){try{let e=JSON.parse(vt(bt,"utf-8"));return typeof e.profileDir=="string"&&e.profileDir?e.profileDir:void 0}catch{return}}function er(e,t){let r=[],o=e||t?void 0:Pt();return o&&r.push(o),r.push(e),r}function Rt({chromeDir:e,profilePath:t,profile:r,browser:o}={}){let n=t||e,s=[];for(let i of er(n,o)){let c;try{c=S({chromeDir:i,profile:r,browser:o})}catch(a){s.push({root:i??"default",profile:r??"*",file:"*",source:"device",exists:!1,rows:null,error:a instanceof Error?a.message:String(a)});continue}for(let a of c)for(let f of Ze){let l=ae(a.path,f.file),p={root:i??"default",profile:a.name,file:f.file,source:f.source,exists:Bt(l),rows:null};try{p.rows=B(l,"SELECT COUNT(*) AS n FROM logins")[0]?.n??0}catch(u){p.error=u instanceof Error?u.message:String(u)}s.push(p)}}return s}function kt({chromeDir:e,profilePath:t,profile:r,search:o,browser:n,decryptionKey:s,onDiagnostic:i}={}){let c=t||e,a=n??v().id,f=er(c,n),l=[],p=o?.toLowerCase(),u,g=!1;for(let m of f){let d;try{d=S({chromeDir:m,profile:r,browser:a,onDiagnostic:i})}catch(y){u??=y;continue}g=!0;for(let y of d)for(let _ of Ze){let O=ae(y.path,_.file),le=j(m??y.path,a,s,i,y.name,_.file);try{let P=B(O,`SELECT origin_url, username_value, password_value, date_last_used
|
|
20
|
+
FROM logins ORDER BY origin_url`);for(let b of P){if(p&&!(b.origin_url&&b.origin_url.toLowerCase().includes(p))&&!(b.username_value&&b.username_value.toLowerCase().includes(p)))continue;let N=b.password_value?.length>0?le(b.password_value):"";l.push({profile:y.name,source:_.source,url:b.origin_url,username:b.username_value,password:Buffer.isBuffer(N)?N.toString("utf8"):N,lastUsed:E(b.date_last_used||0)})}}catch(P){w(i,y.name,_.file,P)}}}if(!g&&u)throw u;return l}import{readFileSync as Lt}from"node:fs";import{join as Ot}from"node:path";function rr(e,t=""){let r=[];if(!e)return r;let o=t?`${t}/${e.name||""}`:e.name||"";if(e.type==="url"&&r.push({title:e.name||"",url:e.url||"",folder:t,dateAdded:E(e.date_added),dateLastUsed:E(e.date_last_used),id:e.id,guid:e.guid||""}),e.children&&Array.isArray(e.children))for(let n of e.children)r.push(...rr(n,o));return r}function At({chromeDir:e,profilePath:t,profile:r,folder:o,search:n,browser:s,onDiagnostic:i}={}){let c=S({chromeDir:e,profilePath:t,profile:r,browser:s,onDiagnostic:i}),a=[];for(let l of c){let p=Ot(l.path,"Bookmarks");try{let u=Lt(p,"utf-8"),m=JSON.parse(u).roots;if(!m)continue;let d=["bookmark_bar","other","synced"];for(let y of d)if(m[y]){let _=rr(m[y],"");for(let O of _)O.profile=l.name,a.push(O)}}catch(u){w(i,l.name,"Bookmarks",u instanceof SyntaxError?new Error("Invalid Bookmarks JSON."):u)}}let f=a;if(o){let l=o.toLowerCase();f=f.filter(p=>p.folder.toLowerCase().includes(l))}if(n){let l=n.toLowerCase();f=f.filter(p=>p.title.toLowerCase().includes(l)||p.url.toLowerCase().includes(l))}return f}import{join as tr}from"node:path";function L(e){if(e===void 0)return;let t=Math.trunc(Number(e));return Number.isFinite(t)&&t>0?t:void 0}function R(e,t){let r=L(t);return r===void 0?e:e.slice(0,r)}function z(e){return`%${e.replace(/([%_\\])/g,"\\$1")}%`}function Tt({chromeDir:e,profilePath:t,profile:r,search:o,limit:n=100,browser:s,onDiagnostic:i}={}){let c=S({chromeDir:e,profilePath:t,profile:r,browser:s,onDiagnostic:i}),a=[],f=L(n);for(let l of c){let p=tr(l.path,"History");try{let u="SELECT url, title, visit_count, last_visit_time FROM urls",g=[];if(o){u+=" WHERE url LIKE ? ESCAPE '\\' OR IFNULL(title, '') LIKE ? ESCAPE '\\'";let d=z(o);g.push(d,d)}u+=" ORDER BY last_visit_time DESC",f&&(u+=` LIMIT ${f}`);let m=B(p,u,g);for(let d of m)a.push({profile:l.name,url:d.url,title:d.title||"",visitCount:d.visit_count||0,lastVisit:E(d.last_visit_time||0)})}catch(u){w(i,l.name,"History",u)}}return R(a,n)}function It({chromeDir:e,profilePath:t,profile:r,limit:o=100,browser:n,onDiagnostic:s}={}){let i=S({chromeDir:e,profilePath:t,profile:r,browser:n,onDiagnostic:s}),c=[],a=L(o);for(let f of i){let l=tr(f.path,"History");try{let p=`SELECT kst.term, u.url
|
|
21
21
|
FROM keyword_search_terms kst
|
|
22
22
|
JOIN urls u ON kst.url_id = u.id
|
|
23
|
-
ORDER BY u.last_visit_time DESC`;a&&(
|
|
23
|
+
ORDER BY u.last_visit_time DESC`;a&&(p+=` LIMIT ${a}`);let u=B(l,p);for(let g of u)c.push({profile:f.name,term:g.term||"",url:g.url||""})}catch(p){w(s,f.name,"History",p)}}return R(c,o)}import{existsSync as Nt}from"node:fs";import{createHash as Mt}from"node:crypto";function Ft(e,t){if(!Buffer.isBuffer(e))return e;let r=Mt("sha256").update(t).digest();return(e.length>=r.length&&e.subarray(0,r.length).equals(r)?e.subarray(r.length):e).toString("utf-8")}function Ut(e){if(!e)return null;try{return new URL(e)}catch{try{if(!/^[a-zA-Z][a-zA-Z0-9+.-]*:/.test(e))return new URL("https://"+e)}catch{}}return null}function Kt(e){let t=new Set;t.add(e),t.add("."+e);let r=e.split(".");for(let o=1;o<r.length;o++){let n=r.slice(o).join(".");t.add(n),t.add("."+n)}return Array.from(t)}function $t(e,t){return!!(e===t||t.startsWith(".")&&(e===t.slice(1)||e.endsWith(t)))}function Ht(e,t){let r=e||"/",o=t||"/";return!!(o==="/"||r===o||r.startsWith(o)&&(o.endsWith("/")||r[o.length]==="/"))}function Gt({chromeDir:e,profilePath:t,profile:r,browser:o,onDiagnostic:n,domain:s,url:i,decrypt:c=!0,limit:a=100,decryptionKey:f}={}){let l=t||e,p=o??v().id,u=S({chromeDir:e,profilePath:t,profile:r,browser:p,onDiagnostic:n}),g=[],m=Ut(i),d=L(a),y;for(let _ of u){let O=oe(_.path);if(!Nt(O)){w(n,_.name,"Cookies",new h("missing_store","Cookies database file not found."));continue}let le=j(l??_.path,p,f,n,_.name,"Cookies");try{let P=`SELECT host_key, name, value, encrypted_value, path,
|
|
24
24
|
expires_utc, is_secure, is_httponly, samesite,
|
|
25
25
|
creation_utc, last_access_utc
|
|
26
|
-
FROM cookies`,b=[],N=[];if(s)b.push("host_key LIKE ?"),N.push(`%${s}%`);else if(m){let x=
|
|
26
|
+
FROM cookies`,b=[],N=[];if(s)b.push("host_key LIKE ?"),N.push(`%${s}%`);else if(m){let x=Kt(m.hostname),J=x.map(()=>"?").join(", ");b.push(`host_key IN (${J})`),N.push(...x)}b.length>0&&(P+=` WHERE ${b.join(" AND ")}`),P+=" ORDER BY host_key, name",d&&!i&&(P+=` LIMIT ${d}`);let Er=B(O,P,N);for(let x of Er){if(m&&(!$t(m.hostname,x.host_key||"")||!Ht(m.pathname||"/",x.path||"/")||x.is_secure&&m.protocol!=="https:"))continue;let J=x.value||"";!J&&x.encrypted_value?.length>0&&c&&(J=Ft(le(x.encrypted_value),x.host_key||"")),g.push({profile:_.name,domain:x.host_key||"",name:x.name||"",value:J,path:x.path||"/",expires:E(x.expires_utc||0),secure:!!x.is_secure,httpOnly:!!x.is_httponly,sameSite:["unspecified","lax","strict","none"][x.samesite]||"unspecified",created:E(x.creation_utc||0),lastAccessed:E(x.last_access_utc||0)})}}catch(P){w(n,_.name,"Cookies",P),y??=new Error(`Could not read cookies for profile "${_.name}" at ${O}: `+(P instanceof Error?P.message:String(P)))}}if(!n&&g.length===0&&y)throw y;return R(g,a)}import{join as mr}from"node:path";import{zstdDecompressSync as Zt}from"node:zlib";function q(e,t){let r=0,o=0;for(let n=t;n<e.length&&n<t+5;n++){let s=e[n];if(r|=(s&127)<<o,(s&128)===0)return{value:r>>>0,nextOffset:n+1};o+=7}return null}var Re=64*1024*1024;function ce(e){let t=q(e,0);if(!t||t.value>Re)throw new Error("Invalid Snappy length");let r=Buffer.alloc(t.value),o=t.nextOffset,n=0;for(;o<e.length&&n<r.length;){let s=e[o++],i=s&3;if(i===0){let f=s>>2;if(f<60)f+=1;else{let l=f-59;if(o+l>e.length)throw new Error("Invalid Snappy literal");f=1;for(let p=0;p<l;p++)f+=e[o++]<<p*8}if(o+f>e.length||n+f>r.length)throw new Error("Invalid Snappy literal length");e.copy(r,n,o,o+f),o+=f,n+=f;continue}let c,a;if(i===1){if(o>=e.length)throw new Error("Invalid Snappy copy");c=(s>>2&7)+4,a=(s&224)<<3|e[o++]}else if(i===2){if(o+2>e.length)throw new Error("Invalid Snappy copy");c=(s>>2)+1,a=e.readUInt16LE(o),o+=2}else{if(o+4>e.length)throw new Error("Invalid Snappy copy");c=(s>>2)+1,a=e.readUInt32LE(o),o+=4}if(a<=0||a>n||n+c>r.length)throw new Error("Invalid Snappy offset");for(let f=0;f<c;f++)r[n]=r[n-a],n++}if(n!==r.length)throw new Error("Truncated Snappy stream");return r}import{copyFileSync as Wt,readFileSync as or,readdirSync as jt,rmSync as Vt}from"node:fs";import{join as Y}from"node:path";function Le(e){return jt(e).filter(t=>/\.(log|ldb|sst)$/i.test(t)).sort()}function ur(e,t){let r=se(t,"chrome-local-storage-");try{let o=Le(e),n=o.map(i=>T(Y(e,i)));try{for(let i of o)Wt(Y(e,i),Y(r,i))}catch(i){throw new h("snapshot_unavailable","Could not copy Local Storage. Close the browser and retry if it is open.",{cause:i})}let s=Le(e);if(s.length!==o.length||o.some((i,c)=>i!==s[c]||!ne(n[c],T(Y(e,i)))))throw new h("snapshot_unavailable","Local Storage changed during the copy. Close the browser and retry.");return qt(r).values()}finally{Vt(r,{recursive:!0,force:!0,maxRetries:3})}}var zt=0xdb4775248b80fb57n,nr=32768,pr=0,dr=1;function qt(e){let t=new Map,r=Le(e);for(let o of r){let n=Y(e,o),s=or(n);if(/\.(ldb|sst)$/i.test(o))for(let i of Jt(s))sr(t,i)}for(let o of r){if(!/\.log$/i.test(o))continue;let n=Y(e,o),s=or(n);for(let i of Yt(s))sr(t,i)}return t}function sr(e,t){let r=t.key.toString("hex"),o=e.get(r);o&&o.sequence>t.sequence||e.set(r,t)}function Yt(e){let t=[],r=0,o=[];for(;r+7<=e.length;){let n=nr-r%nr;if(n<7){r+=n;continue}let s=e.readUInt16LE(r+4),i=e[r+6];if(r+=7,i===0&&s===0){r+=s;continue}if(s>e.length-r||s>n-7)break;let c=e.subarray(r,r+s);r+=s,i===1?(t.push(...ir(c)),o=[]):i===2?o=[Buffer.from(c)]:i===3&&o.length>0?o.push(Buffer.from(c)):i===4&&o.length>0&&(o.push(Buffer.from(c)),t.push(...ir(Buffer.concat(o))),o=[])}return t}function ir(e){if(e.length<12)return[];let t=[],r=Xt(e,0),o=e.readUInt32LE(8),n=12,s=0;for(;n<e.length&&s<o;){let i=e[n++],c=fr(e,n);if(!c)break;n=c.nextOffset;let a=r+BigInt(s);if(i===dr){let f=fr(e,n);if(!f)break;n=f.nextOffset,t.push({key:c.value,value:f.value,sequence:a,deleted:!1})}else if(i===pr)t.push({key:c.value,sequence:a,deleted:!0});else break;s++}return t}function Jt(e){let t=[];if(e.length<48||e.readBigUInt64LE(e.length-8)!==zt)return t;let o=e.subarray(e.length-48,e.length-8),n=ke(o,0);if(!n)return t;let s=ke(o,n.bytesRead);if(!s)return t;let i=ar(e,s);if(!i)return t;for(let c of cr(i)){let a=ke(c.value,0);if(!a)continue;let f=ar(e,a);if(f)for(let l of cr(f)){if(l.key.length<8)continue;let p=l.key,u=p.length-8,g=p[u],m=Qt(p.subarray(u)),d=p.subarray(0,u);g===dr?t.push({key:d,value:l.value,sequence:m,deleted:!1}):g===pr&&t.push({key:d,sequence:m,deleted:!0})}}return t}function ar(e,t){let r=t.offset+t.size;if(t.offset<0||t.size<0||r+5>e.length)return null;let o=e.subarray(t.offset,r),n=e[r];if(n===0)return o;if(n===1)try{return ce(o)}catch{return null}return null}function cr(e){if(e.length<4)return[];let t=e.readUInt32LE(e.length-4),r=t*4+4;if(t<1||r>e.length)return[];let o=e.length-r,n=[],s=0,i=Buffer.alloc(0);for(;s<o;){let c=q(e,s);if(!c)break;s=c.nextOffset;let a=q(e,s);if(!a)break;s=a.nextOffset;let f=q(e,s);if(!f||(s=f.nextOffset,c.value>i.length||s+a.value+f.value>o))break;let l=Buffer.concat([i.subarray(0,c.value),e.subarray(s,s+a.value)]);s+=a.value;let p=Buffer.from(e.subarray(s,s+f.value));s+=f.value,n.push({key:l,value:p}),i=l}return n}function ke(e,t){let r=lr(e,t);if(!r)return null;let o=lr(e,r.nextOffset);return!o||r.value>BigInt(Number.MAX_SAFE_INTEGER)||o.value>BigInt(Number.MAX_SAFE_INTEGER)?null:{offset:Number(r.value),size:Number(o.value),bytesRead:o.nextOffset-t}}function fr(e,t){let r=q(e,t);if(!r)return null;let o=r.nextOffset+r.value;return o>e.length?null:{value:Buffer.from(e.subarray(r.nextOffset,o)),nextOffset:o}}function lr(e,t){let r=0n,o=0n;for(let n=t;n<e.length&&n<t+10;n++){let s=e[n];if(r|=BigInt(s&127)<<o,(s&128)===0)return{value:r,nextOffset:n+1};o+=7n}return null}function Xt(e,t){let r=0n;for(let o=0;o<8;o++)r|=BigInt(e[t+o]||0)<<BigInt(o*8);return r}function Qt(e){let t=0n;for(let r=1;r<8;r++)t|=BigInt(e[r]||0)<<BigInt((r-1)*8);return t}function*gr(e){let t=mr(e,"LocalStorage");if(T(t)){let r=B(t,`SELECT maps.storage_key, map_entries.key,
|
|
27
27
|
map_entries.value, map_entries.value_compression_type
|
|
28
|
-
FROM map_entries JOIN maps ON maps.row_id = map_entries.map_id`);for(let o of r){if(!Buffer.isBuffer(o.storage_key)||!Buffer.isBuffer(o.key)||!Buffer.isBuffer(o.value))throw new h("unsupported_schema","Unexpected LocalStorage record encoding.");let n=o.storage_key.toString("utf8");yield{origin:n.includes("^")||n==="file:///"?n:n.replace(/\/$/,""),key:fe(o.key),value:fe(
|
|
28
|
+
FROM map_entries JOIN maps ON maps.row_id = map_entries.map_id`);for(let o of r){if(!Buffer.isBuffer(o.storage_key)||!Buffer.isBuffer(o.key)||!Buffer.isBuffer(o.value))throw new h("unsupported_schema","Unexpected LocalStorage record encoding.");let n=o.storage_key.toString("utf8");yield{origin:n.includes("^")||n==="file:///"?n:n.replace(/\/$/,""),key:fe(o.key),value:fe(eo(o.value,o.value_compression_type))}}return}for(let r of ur(mr(e,"Local Storage","leveldb"),e)){if(r.deleted||!r.value)continue;let o=ro(r.key,r.value);o&&(yield o)}}function eo(e,t){switch(t){case 0:return e;case 1:return Zt(e,{maxOutputLength:Re});case 2:return ce(e);default:throw new h("unsupported_schema","Unknown LocalStorage value compression type.")}}function ro(e,t){if(e.length<3||e[0]!==95)return null;let r=e.indexOf(0,1);if(r===-1)return null;let o=e.subarray(1,r).toString("utf8"),n=fe(e.subarray(r+1)),s=fe(t);return o?{origin:o,key:n,value:s}:null}function fe(e){if(e.length===0)return"";let t=e[0],r=e.subarray(1);return t===0&&r.length%2===0?r.toString("utf16le"):t===1?r.toString("latin1"):e.toString("utf8")}function to({chromeDir:e,profilePath:t,profile:r,browser:o,onDiagnostic:n,origin:s,url:i,key:c,search:a,limit:f=100}={}){let l=S({chromeDir:e,profilePath:t,profile:r,browser:o,onDiagnostic:n}),p=[],u=oo(i||s),g=c?.toLowerCase(),m=a?.toLowerCase();for(let d of l)try{for(let y of gr(d.path)){let _={profile:d.name,...y};u&&!_.origin.toLowerCase().includes(u)||g&&!_.key.toLowerCase().includes(g)||m&&!`${_.origin}
|
|
29
29
|
${_.key}
|
|
30
|
-
${_.value}`.toLowerCase().includes(m)||
|
|
31
|
-
`),city:i(D.city),state:i(D.state),zipcode:i(D.zipcode),countryCode:i(D.countryCode),origin:"",useCount:s.use_count||0,dateModified:
|
|
30
|
+
${_.value}`.toLowerCase().includes(m)||p.push(_)}}catch(y){w(n,d.name,"Local Storage",y)}return p.sort((d,y)=>d.profile.localeCompare(y.profile)||d.origin.localeCompare(y.origin)||d.key.localeCompare(y.key)),R(p,f)}function oo(e){if(e)try{return new URL(e).origin.toLowerCase()}catch{return e.toLowerCase()}}var D={firstName:3,middleName:4,lastName:5,fullName:7,email:9,phone:14,line1:30,line2:31,city:33,state:34,zipcode:35,countryCode:36,companyName:60,streetAddress:77},yr=["guid","use_count","use_date","date_modified"],hr=["guid","type","value"];function I(e,t,r){let o=new Set(e("SELECT name FROM pragma_table_info(?)",[t]).map(n=>n.name));return r.every(n=>o.has(n))}function Sr(e){return E(e?BigInt(e)*1000000n+11644473600000000n:0)}function wr(e,t,r,o){let n=new Map;for(let s of e("SELECT guid, type, value FROM "+o)){let i=n.get(s.guid);i||(i=new Map,n.set(s.guid,i)),i.set(s.type,s.value)}return e("SELECT guid, use_count, use_date, date_modified FROM "+r).map(s=>{let i=c=>n.get(s.guid)?.get(c)||"";return{useDate:s.use_date,entry:{profile:t,guid:s.guid,fullName:i(D.fullName)||[D.firstName,D.middleName,D.lastName].map(i).filter(Boolean).join(" "),email:i(D.email),phone:i(D.phone),companyName:i(D.companyName),streetAddress:i(D.streetAddress)||[D.line1,D.line2].map(i).filter(Boolean).join(`
|
|
31
|
+
`),city:i(D.city),state:i(D.state),zipcode:i(D.zipcode),countryCode:i(D.countryCode),origin:"",useCount:s.use_count||0,dateModified:Sr(s.date_modified)}}})}function no(e,t){let r=I(e,"autofill_profile_names",["guid","first_name","middle_name","last_name","full_name"])?e("SELECT guid, first_name, middle_name, last_name, full_name FROM autofill_profile_names"):[],o=I(e,"autofill_profile_emails",["guid","email"])?e("SELECT guid, email FROM autofill_profile_emails"):[],n=I(e,"autofill_profile_phones",["guid","number"])?e("SELECT guid, number FROM autofill_profile_phones"):[],s=new Map(r.map(a=>[a.guid,a.full_name||[a.first_name,a.middle_name,a.last_name].filter(Boolean).join(" ")])),i=new Map(o.map(a=>[a.guid,a.email])),c=new Map(n.map(a=>[a.guid,a.number]));return e("SELECT * FROM autofill_profiles ORDER BY use_date DESC").map(a=>({profile:t,guid:a.guid||"",fullName:s.get(a.guid)||"",email:i.get(a.guid)||"",phone:c.get(a.guid)||"",companyName:a.company_name||"",streetAddress:a.street_address||"",city:a.city||"",state:a.state||"",zipcode:a.zipcode||"",countryCode:a.country_code||"",origin:a.origin||"",useCount:a.use_count||0,dateModified:Sr(a.date_modified)}))}function _r(e,t){return Ce(e,r=>{if(I(r,"addresses",yr)&&I(r,"address_type_tokens",hr))return wr(r,t,"addresses","address_type_tokens").sort((s,i)=>i.useDate-s.useDate).map(({entry:s})=>s);let n=[["local_addresses","local_addresses_type_tokens"],["contact_info","contact_info_type_tokens"]].filter(([s,i])=>I(r,s,yr)&&I(r,i,hr));if(n.length)return n.flatMap(([s,i])=>wr(r,t,s,i)).sort((s,i)=>i.useDate-s.useDate).map(({entry:s})=>s);if(I(r,"autofill_profiles",["guid","use_date"]))return no(r,t);throw new h("unsupported_schema","Unrecognized saved-address schema in Web Data.")})}import{join as Oe}from"node:path";function so({chromeDir:e,profilePath:t,profile:r,browser:o,onDiagnostic:n,search:s,limit:i=100}={}){let c=S({chromeDir:e,profilePath:t,profile:r,browser:o,onDiagnostic:n}),a=[],f=L(i);for(let l of c){let p=Oe(l.path,"Web Data");try{let u="SELECT name, value, date_created, date_last_used, count FROM autofill",g=[];if(s){u+=" WHERE IFNULL(name, '') LIKE ? ESCAPE '\\' OR IFNULL(value, '') LIKE ? ESCAPE '\\'";let d=z(s);g.push(d,d)}u+=" ORDER BY date_last_used DESC",f&&(u+=` LIMIT ${f}`);let m=B(p,u,g);for(let d of m)a.push({profile:l.name,name:d.name||"",value:d.value||"",dateCreated:E(d.date_created?BigInt(d.date_created)*1000000n+11644473600000000n:0),dateLastUsed:E(d.date_last_used?BigInt(d.date_last_used)*1000000n+11644473600000000n:0),count:d.count||0})}catch(u){w(n,l.name,"Web Data",u)}}return R(a,i)}function io({chromeDir:e,profilePath:t,profile:r,browser:o,onDiagnostic:n,decryptionKey:s}={}){let i=t||e,c=o??v().id,a=S({chromeDir:e,profilePath:t,profile:r,browser:c,onDiagnostic:n}),f=[];for(let l of a){let p=Oe(l.path,"Web Data"),u=j(i??l.path,c,s,n,l.name,"Web Data");try{let g=B(p,`SELECT guid, name_on_card, expiration_month, expiration_year,
|
|
32
32
|
card_number_encrypted, date_modified, origin, use_count,
|
|
33
33
|
nickname
|
|
34
|
-
FROM credit_cards ORDER BY use_date DESC`);for(let m of g){let
|
|
34
|
+
FROM credit_cards ORDER BY use_date DESC`);for(let m of g){let d="";if(m.card_number_encrypted?.length>0){let y=u(m.card_number_encrypted);d=Buffer.isBuffer(y)?y.toString("utf8"):y}f.push({profile:l.name,guid:m.guid||"",nameOnCard:m.name_on_card||"",expirationMonth:m.expiration_month||0,expirationYear:m.expiration_year||0,cardNumber:d,nickname:m.nickname||"",origin:m.origin||"",useCount:m.use_count||0,dateModified:E(m.date_modified?BigInt(m.date_modified)*1000000n+11644473600000000n:0)})}}catch(g){w(n,l.name,"Web Data",g)}}return f}function ao(e={}){let t=[];for(let r of S(e))try{for(let o of _r(Oe(r.path,"Web Data"),r.name))t.push(o)}catch(o){w(e.onDiagnostic,r.name,"Web Data",o)}return t}import{join as co}from"node:path";var fo={0:"in_progress",1:"complete",2:"cancelled",3:"interrupted"},lo={0:"not_dangerous",1:"dangerous_file",2:"dangerous_url",3:"dangerous_content",4:"maybe_dangerous_content",5:"uncommon_content",6:"user_validated",7:"dangerous_host",8:"potentially_unwanted",9:"allowlisted_by_policy"};function uo({chromeDir:e,profilePath:t,profile:r,browser:o,onDiagnostic:n,search:s,limit:i=100}={}){let c=S({chromeDir:e,profilePath:t,profile:r,browser:o,onDiagnostic:n}),a=[],f=L(i);for(let l of c){let p=co(l.path,"History");try{let u=`SELECT target_path, tab_url, total_bytes, received_bytes,
|
|
35
35
|
start_time, end_time, mime_type, original_mime_type,
|
|
36
36
|
state, danger_type, opened, referrer, site_url
|
|
37
37
|
FROM downloads`,g=[];if(s){u+=` WHERE IFNULL(target_path, '') LIKE ? ESCAPE '\\'
|
|
38
|
-
OR IFNULL(tab_url, '') LIKE ? ESCAPE '\\'`;let
|
|
38
|
+
OR IFNULL(tab_url, '') LIKE ? ESCAPE '\\'`;let d=z(s);g.push(d,d)}u+=" ORDER BY start_time DESC",f&&(u+=` LIMIT ${f}`);let m=B(p,u,g);for(let d of m)a.push({profile:l.name,targetPath:d.target_path||"",url:d.tab_url||"",siteUrl:d.site_url||"",referrer:d.referrer||"",totalBytes:d.total_bytes||0,receivedBytes:d.received_bytes||0,mimeType:d.mime_type||d.original_mime_type||"",state:fo[d.state]||`unknown(${d.state})`,dangerType:lo[d.danger_type]||`unknown(${d.danger_type})`,opened:!!d.opened,startTime:E(d.start_time||0),endTime:E(d.end_time||0)})}catch(u){w(n,l.name,"History",u)}}return R(a,i)}import{existsSync as po,readFileSync as mo}from"node:fs";import{join as go}from"node:path";function yo({chromeDir:e,profilePath:t,profile:r,search:o,browser:n,onDiagnostic:s}={}){let i=S({chromeDir:e,profilePath:t,profile:r,browser:n,onDiagnostic:s}),c=[];for(let a of i){let f=null;for(let l of["Secure Preferences","Preferences"]){let p=go(a.path,l);if(po(p))try{let g=JSON.parse(mo(p,"utf-8"))?.extensions?.settings;if(g&&typeof g=="object"){f=g;break}}catch(u){w(s,a.name,l,u instanceof SyntaxError?new Error("Invalid preferences JSON."):u)}}if(f)for(let[l,p]of Object.entries(f)){let u=p;if(u.location===5||u.location===10)continue;let g=u.manifest||{},m={profile:a.name,id:l,name:g.name||u.name||l,version:g.version||u.version||"unknown",description:g.description||"",enabled:u.state===1,homepageUrl:g.homepage_url||"",updateUrl:g.update_url||"",installTime:u.install_time||"",fromWebstore:u.from_webstore||!1,location:u.location||0};if(m.name.startsWith("__MSG_")&&(m.name=l),m.description.startsWith("__MSG_")&&(m.description=""),o){let d=o.toLowerCase();if(!(m.name&&m.name.toLowerCase().includes(d))&&!(m.id&&m.id.toLowerCase().includes(d)))continue}c.push(m)}}return c}import{join as ho}from"node:path";function wo({chromeDir:e,profilePath:t,profile:r,browser:o,onDiagnostic:n}={}){let s=S({chromeDir:e,profilePath:t,profile:r,browser:o,onDiagnostic:n}),i=[];for(let c of s){let a=ho(c.path,"Web Data");try{let f=B(a,`SELECT id, short_name, keyword, url, suggestions_url,
|
|
39
39
|
favicon_url, prepopulate_id, is_active
|
|
40
|
-
FROM keywords ORDER BY short_name`);for(let l of f)i.push({profile:c.name,id:l.id,name:l.short_name||"",keyword:l.keyword||"",url:l.url||"",suggestionsUrl:l.suggestions_url||"",faviconUrl:l.favicon_url||"",isDefault:l.prepopulate_id===1,isActive:l.is_active===1})}catch(f){w(n,c.name,"Web Data",f)}}return i}import{join as
|
|
41
|
-
FROM top_sites ORDER BY url_rank ASC`);for(let l of f)i.push({profile:c.name,url:l.url||"",title:l.title||"",rank:l.url_rank??0,redirects:l.redirects||""})}catch(f){w(n,c.name,"Top Sites",f)}}return i}export{
|
|
40
|
+
FROM keywords ORDER BY short_name`);for(let l of f)i.push({profile:c.name,id:l.id,name:l.short_name||"",keyword:l.keyword||"",url:l.url||"",suggestionsUrl:l.suggestions_url||"",faviconUrl:l.favicon_url||"",isDefault:l.prepopulate_id===1,isActive:l.is_active===1})}catch(f){w(n,c.name,"Web Data",f)}}return i}import{join as So}from"node:path";function _o({chromeDir:e,profilePath:t,profile:r,browser:o,onDiagnostic:n}={}){let s=S({chromeDir:e,profilePath:t,profile:r,browser:o,onDiagnostic:n}),i=[];for(let c of s){let a=So(c.path,"Top Sites");try{let f=B(a,`SELECT url, url_rank, title, redirects
|
|
41
|
+
FROM top_sites ORDER BY url_rank ASC`);for(let l of f)i.push({profile:c.name,url:l.url||"",title:l.title||"",rank:l.url_rank??0,redirects:l.redirects||""})}catch(f){w(n,c.name,"Top Sites",f)}}return i}export{Z as BROWSERS,E as chromeTimeToDate,rt as clearKeyCache,we as clearKeychainCache,et as decryptValue,Ve as decryptValueBuffer,Zr as deriveEncryptionKey,Rt as describePasswordStores,st as detectInstalledBrowsers,V as discoverProfiles,v as getActiveBrowser,ao as getAddresses,so as getAutofillEntries,At as getBookmarks,Or as getChromeKeychainPassword,Gt as getCookies,io as getCreditCards,F as getDefaultChromeDir,uo as getDownloads,yo as getExtensions,Tt as getHistory,he as getKeychainPassword,ye as getKeychainPasswordProvider,to as getLocalStorage,kt as getPasswords,De as getPlatformChromeDir,Ye as getProfileMetadata,it as getProfileStates,wo as getSearchEngines,It as getSearchTerms,_o as getTopSites,$ as listBrowsers,B as queryDatabase,M as requireBrowser,Se as resolveBrowser,at as resolveProfilePath,S as resolveTargetProfiles,W as selectPlatform,Ne as setActiveBrowser,Lr as setKeychainPasswordProvider,Et as tableExists};
|