gemkit-cli 0.2.1 → 0.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.
Files changed (2) hide show
  1. package/dist/index.js +134 -45
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1,53 +1,53 @@
1
1
  #!/usr/bin/env node
2
- var hA=Object.create;var Cc=Object.defineProperty;var fA=Object.getOwnPropertyDescriptor;var zA=Object.getOwnPropertyNames;var RA=Object.getPrototypeOf,dA=Object.prototype.hasOwnProperty;var qn=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var jA=(t,e,i,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of zA(e))!dA.call(t,r)&&r!==i&&Cc(t,r,{get:()=>e[r],enumerable:!(n=fA(e,r))||n.enumerable});return t};var Dn=(t,e,i)=>(i=t!=null?hA(RA(t)):{},jA(e||!t||!t.__esModule?Cc(i,"default",{value:t,enumerable:!0}):i,t));var $c=qn((xp,o7)=>{o7.exports={dots:{interval:80,frames:["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"]},dots2:{interval:80,frames:["\u28FE","\u28FD","\u28FB","\u28BF","\u287F","\u28DF","\u28EF","\u28F7"]},dots3:{interval:80,frames:["\u280B","\u2819","\u281A","\u281E","\u2816","\u2826","\u2834","\u2832","\u2833","\u2813"]},dots4:{interval:80,frames:["\u2804","\u2806","\u2807","\u280B","\u2819","\u2838","\u2830","\u2820","\u2830","\u2838","\u2819","\u280B","\u2807","\u2806"]},dots5:{interval:80,frames:["\u280B","\u2819","\u281A","\u2812","\u2802","\u2802","\u2812","\u2832","\u2834","\u2826","\u2816","\u2812","\u2810","\u2810","\u2812","\u2813","\u280B"]},dots6:{interval:80,frames:["\u2801","\u2809","\u2819","\u281A","\u2812","\u2802","\u2802","\u2812","\u2832","\u2834","\u2824","\u2804","\u2804","\u2824","\u2834","\u2832","\u2812","\u2802","\u2802","\u2812","\u281A","\u2819","\u2809","\u2801"]},dots7:{interval:80,frames:["\u2808","\u2809","\u280B","\u2813","\u2812","\u2810","\u2810","\u2812","\u2816","\u2826","\u2824","\u2820","\u2820","\u2824","\u2826","\u2816","\u2812","\u2810","\u2810","\u2812","\u2813","\u280B","\u2809","\u2808"]},dots8:{interval:80,frames:["\u2801","\u2801","\u2809","\u2819","\u281A","\u2812","\u2802","\u2802","\u2812","\u2832","\u2834","\u2824","\u2804","\u2804","\u2824","\u2820","\u2820","\u2824","\u2826","\u2816","\u2812","\u2810","\u2810","\u2812","\u2813","\u280B","\u2809","\u2808","\u2808"]},dots9:{interval:80,frames:["\u28B9","\u28BA","\u28BC","\u28F8","\u28C7","\u2867","\u2857","\u284F"]},dots10:{interval:80,frames:["\u2884","\u2882","\u2881","\u2841","\u2848","\u2850","\u2860"]},dots11:{interval:100,frames:["\u2801","\u2802","\u2804","\u2840","\u2880","\u2820","\u2810","\u2808"]},dots12:{interval:80,frames:["\u2880\u2800","\u2840\u2800","\u2804\u2800","\u2882\u2800","\u2842\u2800","\u2805\u2800","\u2883\u2800","\u2843\u2800","\u280D\u2800","\u288B\u2800","\u284B\u2800","\u280D\u2801","\u288B\u2801","\u284B\u2801","\u280D\u2809","\u280B\u2809","\u280B\u2809","\u2809\u2819","\u2809\u2819","\u2809\u2829","\u2808\u2899","\u2808\u2859","\u2888\u2829","\u2840\u2899","\u2804\u2859","\u2882\u2829","\u2842\u2898","\u2805\u2858","\u2883\u2828","\u2843\u2890","\u280D\u2850","\u288B\u2820","\u284B\u2880","\u280D\u2841","\u288B\u2801","\u284B\u2801","\u280D\u2809","\u280B\u2809","\u280B\u2809","\u2809\u2819","\u2809\u2819","\u2809\u2829","\u2808\u2899","\u2808\u2859","\u2808\u2829","\u2800\u2899","\u2800\u2859","\u2800\u2829","\u2800\u2898","\u2800\u2858","\u2800\u2828","\u2800\u2890","\u2800\u2850","\u2800\u2820","\u2800\u2880","\u2800\u2840"]},dots13:{interval:80,frames:["\u28FC","\u28F9","\u28BB","\u283F","\u285F","\u28CF","\u28E7","\u28F6"]},dots8Bit:{interval:80,frames:["\u2800","\u2801","\u2802","\u2803","\u2804","\u2805","\u2806","\u2807","\u2840","\u2841","\u2842","\u2843","\u2844","\u2845","\u2846","\u2847","\u2808","\u2809","\u280A","\u280B","\u280C","\u280D","\u280E","\u280F","\u2848","\u2849","\u284A","\u284B","\u284C","\u284D","\u284E","\u284F","\u2810","\u2811","\u2812","\u2813","\u2814","\u2815","\u2816","\u2817","\u2850","\u2851","\u2852","\u2853","\u2854","\u2855","\u2856","\u2857","\u2818","\u2819","\u281A","\u281B","\u281C","\u281D","\u281E","\u281F","\u2858","\u2859","\u285A","\u285B","\u285C","\u285D","\u285E","\u285F","\u2820","\u2821","\u2822","\u2823","\u2824","\u2825","\u2826","\u2827","\u2860","\u2861","\u2862","\u2863","\u2864","\u2865","\u2866","\u2867","\u2828","\u2829","\u282A","\u282B","\u282C","\u282D","\u282E","\u282F","\u2868","\u2869","\u286A","\u286B","\u286C","\u286D","\u286E","\u286F","\u2830","\u2831","\u2832","\u2833","\u2834","\u2835","\u2836","\u2837","\u2870","\u2871","\u2872","\u2873","\u2874","\u2875","\u2876","\u2877","\u2838","\u2839","\u283A","\u283B","\u283C","\u283D","\u283E","\u283F","\u2878","\u2879","\u287A","\u287B","\u287C","\u287D","\u287E","\u287F","\u2880","\u2881","\u2882","\u2883","\u2884","\u2885","\u2886","\u2887","\u28C0","\u28C1","\u28C2","\u28C3","\u28C4","\u28C5","\u28C6","\u28C7","\u2888","\u2889","\u288A","\u288B","\u288C","\u288D","\u288E","\u288F","\u28C8","\u28C9","\u28CA","\u28CB","\u28CC","\u28CD","\u28CE","\u28CF","\u2890","\u2891","\u2892","\u2893","\u2894","\u2895","\u2896","\u2897","\u28D0","\u28D1","\u28D2","\u28D3","\u28D4","\u28D5","\u28D6","\u28D7","\u2898","\u2899","\u289A","\u289B","\u289C","\u289D","\u289E","\u289F","\u28D8","\u28D9","\u28DA","\u28DB","\u28DC","\u28DD","\u28DE","\u28DF","\u28A0","\u28A1","\u28A2","\u28A3","\u28A4","\u28A5","\u28A6","\u28A7","\u28E0","\u28E1","\u28E2","\u28E3","\u28E4","\u28E5","\u28E6","\u28E7","\u28A8","\u28A9","\u28AA","\u28AB","\u28AC","\u28AD","\u28AE","\u28AF","\u28E8","\u28E9","\u28EA","\u28EB","\u28EC","\u28ED","\u28EE","\u28EF","\u28B0","\u28B1","\u28B2","\u28B3","\u28B4","\u28B5","\u28B6","\u28B7","\u28F0","\u28F1","\u28F2","\u28F3","\u28F4","\u28F5","\u28F6","\u28F7","\u28B8","\u28B9","\u28BA","\u28BB","\u28BC","\u28BD","\u28BE","\u28BF","\u28F8","\u28F9","\u28FA","\u28FB","\u28FC","\u28FD","\u28FE","\u28FF"]},sand:{interval:80,frames:["\u2801","\u2802","\u2804","\u2840","\u2848","\u2850","\u2860","\u28C0","\u28C1","\u28C2","\u28C4","\u28CC","\u28D4","\u28E4","\u28E5","\u28E6","\u28EE","\u28F6","\u28F7","\u28FF","\u287F","\u283F","\u289F","\u281F","\u285B","\u281B","\u282B","\u288B","\u280B","\u280D","\u2849","\u2809","\u2811","\u2821","\u2881"]},line:{interval:130,frames:["-","\\","|","/"]},line2:{interval:100,frames:["\u2802","-","\u2013","\u2014","\u2013","-"]},pipe:{interval:100,frames:["\u2524","\u2518","\u2534","\u2514","\u251C","\u250C","\u252C","\u2510"]},simpleDots:{interval:400,frames:[". ",".. ","..."," "]},simpleDotsScrolling:{interval:200,frames:[". ",".. ","..."," .."," ."," "]},star:{interval:70,frames:["\u2736","\u2738","\u2739","\u273A","\u2739","\u2737"]},star2:{interval:80,frames:["+","x","*"]},flip:{interval:70,frames:["_","_","_","-","`","`","'","\xB4","-","_","_","_"]},hamburger:{interval:100,frames:["\u2631","\u2632","\u2634"]},growVertical:{interval:120,frames:["\u2581","\u2583","\u2584","\u2585","\u2586","\u2587","\u2586","\u2585","\u2584","\u2583"]},growHorizontal:{interval:120,frames:["\u258F","\u258E","\u258D","\u258C","\u258B","\u258A","\u2589","\u258A","\u258B","\u258C","\u258D","\u258E"]},balloon:{interval:140,frames:[" ",".","o","O","@","*"," "]},balloon2:{interval:120,frames:[".","o","O","\xB0","O","o","."]},noise:{interval:100,frames:["\u2593","\u2592","\u2591"]},bounce:{interval:120,frames:["\u2801","\u2802","\u2804","\u2802"]},boxBounce:{interval:120,frames:["\u2596","\u2598","\u259D","\u2597"]},boxBounce2:{interval:100,frames:["\u258C","\u2580","\u2590","\u2584"]},triangle:{interval:50,frames:["\u25E2","\u25E3","\u25E4","\u25E5"]},binary:{interval:80,frames:["010010","001100","100101","111010","111101","010111","101011","111000","110011","110101"]},arc:{interval:100,frames:["\u25DC","\u25E0","\u25DD","\u25DE","\u25E1","\u25DF"]},circle:{interval:120,frames:["\u25E1","\u2299","\u25E0"]},squareCorners:{interval:180,frames:["\u25F0","\u25F3","\u25F2","\u25F1"]},circleQuarters:{interval:120,frames:["\u25F4","\u25F7","\u25F6","\u25F5"]},circleHalves:{interval:50,frames:["\u25D0","\u25D3","\u25D1","\u25D2"]},squish:{interval:100,frames:["\u256B","\u256A"]},toggle:{interval:250,frames:["\u22B6","\u22B7"]},toggle2:{interval:80,frames:["\u25AB","\u25AA"]},toggle3:{interval:120,frames:["\u25A1","\u25A0"]},toggle4:{interval:100,frames:["\u25A0","\u25A1","\u25AA","\u25AB"]},toggle5:{interval:100,frames:["\u25AE","\u25AF"]},toggle6:{interval:300,frames:["\u101D","\u1040"]},toggle7:{interval:80,frames:["\u29BE","\u29BF"]},toggle8:{interval:100,frames:["\u25CD","\u25CC"]},toggle9:{interval:100,frames:["\u25C9","\u25CE"]},toggle10:{interval:100,frames:["\u3282","\u3280","\u3281"]},toggle11:{interval:50,frames:["\u29C7","\u29C6"]},toggle12:{interval:120,frames:["\u2617","\u2616"]},toggle13:{interval:80,frames:["=","*","-"]},arrow:{interval:100,frames:["\u2190","\u2196","\u2191","\u2197","\u2192","\u2198","\u2193","\u2199"]},arrow2:{interval:80,frames:["\u2B06\uFE0F ","\u2197\uFE0F ","\u27A1\uFE0F ","\u2198\uFE0F ","\u2B07\uFE0F ","\u2199\uFE0F ","\u2B05\uFE0F ","\u2196\uFE0F "]},arrow3:{interval:120,frames:["\u25B9\u25B9\u25B9\u25B9\u25B9","\u25B8\u25B9\u25B9\u25B9\u25B9","\u25B9\u25B8\u25B9\u25B9\u25B9","\u25B9\u25B9\u25B8\u25B9\u25B9","\u25B9\u25B9\u25B9\u25B8\u25B9","\u25B9\u25B9\u25B9\u25B9\u25B8"]},bouncingBar:{interval:80,frames:["[ ]","[= ]","[== ]","[=== ]","[====]","[ ===]","[ ==]","[ =]","[ ]","[ =]","[ ==]","[ ===]","[====]","[=== ]","[== ]","[= ]"]},bouncingBall:{interval:80,frames:["( \u25CF )","( \u25CF )","( \u25CF )","( \u25CF )","( \u25CF)","( \u25CF )","( \u25CF )","( \u25CF )","( \u25CF )","(\u25CF )"]},smiley:{interval:200,frames:["\u{1F604} ","\u{1F61D} "]},monkey:{interval:300,frames:["\u{1F648} ","\u{1F648} ","\u{1F649} ","\u{1F64A} "]},hearts:{interval:100,frames:["\u{1F49B} ","\u{1F499} ","\u{1F49C} ","\u{1F49A} ","\u2764\uFE0F "]},clock:{interval:100,frames:["\u{1F55B} ","\u{1F550} ","\u{1F551} ","\u{1F552} ","\u{1F553} ","\u{1F554} ","\u{1F555} ","\u{1F556} ","\u{1F557} ","\u{1F558} ","\u{1F559} ","\u{1F55A} "]},earth:{interval:180,frames:["\u{1F30D} ","\u{1F30E} ","\u{1F30F} "]},material:{interval:17,frames:["\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581","\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581","\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581","\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581","\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581","\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581","\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588","\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588","\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588","\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588","\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588","\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588","\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588","\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588","\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581","\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581","\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581","\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581"]},moon:{interval:80,frames:["\u{1F311} ","\u{1F312} ","\u{1F313} ","\u{1F314} ","\u{1F315} ","\u{1F316} ","\u{1F317} ","\u{1F318} "]},runner:{interval:140,frames:["\u{1F6B6} ","\u{1F3C3} "]},pong:{interval:80,frames:["\u2590\u2802 \u258C","\u2590\u2808 \u258C","\u2590 \u2802 \u258C","\u2590 \u2820 \u258C","\u2590 \u2840 \u258C","\u2590 \u2820 \u258C","\u2590 \u2802 \u258C","\u2590 \u2808 \u258C","\u2590 \u2802 \u258C","\u2590 \u2820 \u258C","\u2590 \u2840 \u258C","\u2590 \u2820 \u258C","\u2590 \u2802 \u258C","\u2590 \u2808 \u258C","\u2590 \u2802\u258C","\u2590 \u2820\u258C","\u2590 \u2840\u258C","\u2590 \u2820 \u258C","\u2590 \u2802 \u258C","\u2590 \u2808 \u258C","\u2590 \u2802 \u258C","\u2590 \u2820 \u258C","\u2590 \u2840 \u258C","\u2590 \u2820 \u258C","\u2590 \u2802 \u258C","\u2590 \u2808 \u258C","\u2590 \u2802 \u258C","\u2590 \u2820 \u258C","\u2590 \u2840 \u258C","\u2590\u2820 \u258C"]},shark:{interval:120,frames:["\u2590|\\____________\u258C","\u2590_|\\___________\u258C","\u2590__|\\__________\u258C","\u2590___|\\_________\u258C","\u2590____|\\________\u258C","\u2590_____|\\_______\u258C","\u2590______|\\______\u258C","\u2590_______|\\_____\u258C","\u2590________|\\____\u258C","\u2590_________|\\___\u258C","\u2590__________|\\__\u258C","\u2590___________|\\_\u258C","\u2590____________|\\\u258C","\u2590____________/|\u258C","\u2590___________/|_\u258C","\u2590__________/|__\u258C","\u2590_________/|___\u258C","\u2590________/|____\u258C","\u2590_______/|_____\u258C","\u2590______/|______\u258C","\u2590_____/|_______\u258C","\u2590____/|________\u258C","\u2590___/|_________\u258C","\u2590__/|__________\u258C","\u2590_/|___________\u258C","\u2590/|____________\u258C"]},dqpb:{interval:100,frames:["d","q","p","b"]},weather:{interval:100,frames:["\u2600\uFE0F ","\u2600\uFE0F ","\u2600\uFE0F ","\u{1F324} ","\u26C5\uFE0F ","\u{1F325} ","\u2601\uFE0F ","\u{1F327} ","\u{1F328} ","\u{1F327} ","\u{1F328} ","\u{1F327} ","\u{1F328} ","\u26C8 ","\u{1F328} ","\u{1F327} ","\u{1F328} ","\u2601\uFE0F ","\u{1F325} ","\u26C5\uFE0F ","\u{1F324} ","\u2600\uFE0F ","\u2600\uFE0F "]},christmas:{interval:400,frames:["\u{1F332}","\u{1F384}"]},grenade:{interval:80,frames:["\u060C ","\u2032 "," \xB4 "," \u203E "," \u2E0C"," \u2E0A"," |"," \u204E"," \u2055"," \u0DF4 "," \u2053"," "," "," "]},point:{interval:125,frames:["\u2219\u2219\u2219","\u25CF\u2219\u2219","\u2219\u25CF\u2219","\u2219\u2219\u25CF","\u2219\u2219\u2219"]},layer:{interval:150,frames:["-","=","\u2261"]},betaWave:{interval:80,frames:["\u03C1\u03B2\u03B2\u03B2\u03B2\u03B2\u03B2","\u03B2\u03C1\u03B2\u03B2\u03B2\u03B2\u03B2","\u03B2\u03B2\u03C1\u03B2\u03B2\u03B2\u03B2","\u03B2\u03B2\u03B2\u03C1\u03B2\u03B2\u03B2","\u03B2\u03B2\u03B2\u03B2\u03C1\u03B2\u03B2","\u03B2\u03B2\u03B2\u03B2\u03B2\u03C1\u03B2","\u03B2\u03B2\u03B2\u03B2\u03B2\u03B2\u03C1"]},fingerDance:{interval:160,frames:["\u{1F918} ","\u{1F91F} ","\u{1F596} ","\u270B ","\u{1F91A} ","\u{1F446} "]},fistBump:{interval:80,frames:["\u{1F91C}\u3000\u3000\u3000\u3000\u{1F91B} ","\u{1F91C}\u3000\u3000\u3000\u3000\u{1F91B} ","\u{1F91C}\u3000\u3000\u3000\u3000\u{1F91B} ","\u3000\u{1F91C}\u3000\u3000\u{1F91B}\u3000 ","\u3000\u3000\u{1F91C}\u{1F91B}\u3000\u3000 ","\u3000\u{1F91C}\u2728\u{1F91B}\u3000\u3000 ","\u{1F91C}\u3000\u2728\u3000\u{1F91B}\u3000 "]},soccerHeader:{interval:80,frames:[" \u{1F9D1}\u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F\u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} "]},mindblown:{interval:160,frames:["\u{1F610} ","\u{1F610} ","\u{1F62E} ","\u{1F62E} ","\u{1F626} ","\u{1F626} ","\u{1F627} ","\u{1F627} ","\u{1F92F} ","\u{1F4A5} ","\u2728 ","\u3000 ","\u3000 ","\u3000 "]},speaker:{interval:160,frames:["\u{1F508} ","\u{1F509} ","\u{1F50A} ","\u{1F509} "]},orangePulse:{interval:100,frames:["\u{1F538} ","\u{1F536} ","\u{1F7E0} ","\u{1F7E0} ","\u{1F536} "]},bluePulse:{interval:100,frames:["\u{1F539} ","\u{1F537} ","\u{1F535} ","\u{1F535} ","\u{1F537} "]},orangeBluePulse:{interval:100,frames:["\u{1F538} ","\u{1F536} ","\u{1F7E0} ","\u{1F7E0} ","\u{1F536} ","\u{1F539} ","\u{1F537} ","\u{1F535} ","\u{1F535} ","\u{1F537} "]},timeTravel:{interval:100,frames:["\u{1F55B} ","\u{1F55A} ","\u{1F559} ","\u{1F558} ","\u{1F557} ","\u{1F556} ","\u{1F555} ","\u{1F554} ","\u{1F553} ","\u{1F552} ","\u{1F551} ","\u{1F550} "]},aesthetic:{interval:80,frames:["\u25B0\u25B1\u25B1\u25B1\u25B1\u25B1\u25B1","\u25B0\u25B0\u25B1\u25B1\u25B1\u25B1\u25B1","\u25B0\u25B0\u25B0\u25B1\u25B1\u25B1\u25B1","\u25B0\u25B0\u25B0\u25B0\u25B1\u25B1\u25B1","\u25B0\u25B0\u25B0\u25B0\u25B0\u25B1\u25B1","\u25B0\u25B0\u25B0\u25B0\u25B0\u25B0\u25B1","\u25B0\u25B0\u25B0\u25B0\u25B0\u25B0\u25B0","\u25B0\u25B1\u25B1\u25B1\u25B1\u25B1\u25B1"]},dwarfFortress:{interval:80,frames:[" \u2588\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2588\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2588\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2593\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2593\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2592\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2592\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2591\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2591\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A \u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A \u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A \u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\u2588\xA3\xA3\xA3 "," \u263A \u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\xA3\xA3\xA3 "," \u263A \u2588\xA3\xA3\xA3 "," \u263A\u2588\xA3\xA3\xA3 "," \u263A\u2588\xA3\xA3\xA3 "," \u263A\u2593\xA3\xA3\xA3 "," \u263A\u2593\xA3\xA3\xA3 "," \u263A\u2592\xA3\xA3\xA3 "," \u263A\u2592\xA3\xA3\xA3 "," \u263A\u2591\xA3\xA3\xA3 "," \u263A\u2591\xA3\xA3\xA3 "," \u263A \xA3\xA3\xA3 "," \u263A\xA3\xA3\xA3 "," \u263A\xA3\xA3\xA3 "," \u263A\u2593\xA3\xA3 "," \u263A\u2593\xA3\xA3 "," \u263A\u2592\xA3\xA3 "," \u263A\u2592\xA3\xA3 "," \u263A\u2591\xA3\xA3 "," \u263A\u2591\xA3\xA3 "," \u263A \xA3\xA3 "," \u263A\xA3\xA3 "," \u263A\xA3\xA3 "," \u263A\u2593\xA3 "," \u263A\u2593\xA3 "," \u263A\u2592\xA3 "," \u263A\u2592\xA3 "," \u263A\u2591\xA3 "," \u263A\u2591\xA3 "," \u263A \xA3 "," \u263A\xA3 "," \u263A\xA3 "," \u263A\u2593 "," \u263A\u2593 "," \u263A\u2592 "," \u263A\u2592 "," \u263A\u2591 "," \u263A\u2591 "," \u263A "," \u263A &"," \u263A \u263C&"," \u263A \u263C &"," \u263A\u263C &"," \u263A\u263C & "," \u203C & "," \u263A & "," \u203C & "," \u263A & "," \u203C & "," \u263A & ","\u203C & "," & "," & "," & \u2591 "," & \u2592 "," & \u2593 "," & \xA3 "," & \u2591\xA3 "," & \u2592\xA3 "," & \u2593\xA3 "," & \xA3\xA3 "," & \u2591\xA3\xA3 "," & \u2592\xA3\xA3 ","& \u2593\xA3\xA3 ","& \xA3\xA3\xA3 "," \u2591\xA3\xA3\xA3 "," \u2592\xA3\xA3\xA3 "," \u2593\xA3\xA3\xA3 "," \u2588\xA3\xA3\xA3 "," \u2591\u2588\xA3\xA3\xA3 "," \u2592\u2588\xA3\xA3\xA3 "," \u2593\u2588\xA3\xA3\xA3 "," \u2588\u2588\xA3\xA3\xA3 "," \u2591\u2588\u2588\xA3\xA3\xA3 "," \u2592\u2588\u2588\xA3\xA3\xA3 "," \u2593\u2588\u2588\xA3\xA3\xA3 "," \u2588\u2588\u2588\xA3\xA3\xA3 "," \u2591\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2592\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2593\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2591\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2592\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2593\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2591\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2592\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2593\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2588\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2588\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "]}}});var va=qn((Gp,tl)=>{"use strict";var ir=Object.assign({},$c()),el=Object.keys(ir);Object.defineProperty(ir,"random",{get(){let t=Math.floor(Math.random()*el.length),e=el[t];return ir[e]}});tl.exports=ir});var sl=qn((Qp,al)=>{al.exports=()=>/[#*0-9]\uFE0F?\u20E3|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26AA\u26B0\u26B1\u26BD\u26BE\u26C4\u26C8\u26CF\u26D1\u26E9\u26F0-\u26F5\u26F7\u26F8\u26FA\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2757\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B55\u3030\u303D\u3297\u3299]\uFE0F?|[\u261D\u270C\u270D](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\u270A\u270B](?:\uD83C[\uDFFB-\uDFFF])?|[\u23E9-\u23EC\u23F0\u23F3\u25FD\u2693\u26A1\u26AB\u26C5\u26CE\u26D4\u26EA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2795-\u2797\u27B0\u27BF\u2B50]|\u26D3\uFE0F?(?:\u200D\uD83D\uDCA5)?|\u26F9(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\u2764\uFE0F?(?:\u200D(?:\uD83D\uDD25|\uD83E\uDE79))?|\uD83C(?:[\uDC04\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]\uFE0F?|[\uDF85\uDFC2\uDFC7](?:\uD83C[\uDFFB-\uDFFF])?|[\uDFC4\uDFCA](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDFCB\uDFCC](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF43\uDF45-\uDF4A\uDF4C-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uDDE6\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF]|\uDDE7\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF]|\uDDE8\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF7\uDDFA-\uDDFF]|\uDDE9\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF]|\uDDEA\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA]|\uDDEB\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7]|\uDDEC\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE]|\uDDED\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA]|\uDDEE\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9]|\uDDEF\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5]|\uDDF0\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF]|\uDDF1\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE]|\uDDF2\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF]|\uDDF3\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF]|\uDDF4\uD83C\uDDF2|\uDDF5\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE]|\uDDF6\uD83C\uDDE6|\uDDF7\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC]|\uDDF8\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF]|\uDDF9\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF]|\uDDFA\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF]|\uDDFB\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA]|\uDDFC\uD83C[\uDDEB\uDDF8]|\uDDFD\uD83C\uDDF0|\uDDFE\uD83C[\uDDEA\uDDF9]|\uDDFF\uD83C[\uDDE6\uDDF2\uDDFC]|\uDF44(?:\u200D\uD83D\uDFEB)?|\uDF4B(?:\u200D\uD83D\uDFE9)?|\uDFC3(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDFF3\uFE0F?(?:\u200D(?:\u26A7\uFE0F?|\uD83C\uDF08))?|\uDFF4(?:\u200D\u2620\uFE0F?|\uDB40\uDC67\uDB40\uDC62\uDB40(?:\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDC73\uDB40\uDC63\uDB40\uDC74|\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F)?)|\uD83D(?:[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3]\uFE0F?|[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC](?:\uD83C[\uDFFB-\uDFFF])?|[\uDC6E-\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4\uDEB5](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD74\uDD90](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC25\uDC27-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE41\uDE43\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED8\uDEDC-\uDEDF\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB\uDFF0]|\uDC08(?:\u200D\u2B1B)?|\uDC15(?:\u200D\uD83E\uDDBA)?|\uDC26(?:\u200D(?:\u2B1B|\uD83D\uDD25))?|\uDC3B(?:\u200D\u2744\uFE0F?)?|\uDC41\uFE0F?(?:\u200D\uD83D\uDDE8\uFE0F?)?|\uDC68(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDC68\uDC69]\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?))?|\uDC69(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?[\uDC68\uDC69]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?|\uDC69\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?))|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFC-\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFD-\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFD\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFE]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFE])))?))?|\uDD75(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDE2E(?:\u200D\uD83D\uDCA8)?|\uDE35(?:\u200D\uD83D\uDCAB)?|\uDE36(?:\u200D\uD83C\uDF2B\uFE0F?)?|\uDE42(?:\u200D[\u2194\u2195]\uFE0F?)?|\uDEB6(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?)|\uD83E(?:[\uDD0C\uDD0F\uDD18-\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5\uDEC3-\uDEC5\uDEF0\uDEF2-\uDEF8](?:\uD83C[\uDFFB-\uDFFF])?|[\uDD26\uDD35\uDD37-\uDD39\uDD3C-\uDD3E\uDDB8\uDDB9\uDDCD\uDDCF\uDDD4\uDDD6-\uDDDD](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDDDE\uDDDF](?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD0D\uDD0E\uDD10-\uDD17\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCC\uDDD0\uDDE0-\uDDFF\uDE70-\uDE7C\uDE80-\uDE8A\uDE8E-\uDEC2\uDEC6\uDEC8\uDECD-\uDEDC\uDEDF-\uDEEA\uDEEF]|\uDDCE(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDDD1(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1|\uDDD1\u200D\uD83E\uDDD2(?:\u200D\uD83E\uDDD2)?|\uDDD2(?:\u200D\uD83E\uDDD2)?))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE])))?))?|\uDEF1(?:\uD83C(?:\uDFFB(?:\u200D\uD83E\uDEF2\uD83C[\uDFFC-\uDFFF])?|\uDFFC(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFD-\uDFFF])?|\uDFFD(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])?|\uDFFE(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFD\uDFFF])?|\uDFFF(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFE])?))?)/g});var H3=qn((xR,bs)=>{var Io=process||{},T3=Io.argv||[],Eo=Io.env||{},Tu=!(Eo.NO_COLOR||T3.includes("--no-color"))&&(!!Eo.FORCE_COLOR||T3.includes("--color")||Io.platform==="win32"||(Io.stdout||{}).isTTY&&Eo.TERM!=="dumb"||!!Eo.CI),Xu=(t,e,i=t)=>n=>{let r=""+n,o=r.indexOf(e,t.length);return~o?t+Hu(r,e,i,o)+e:t+r+e},Hu=(t,e,i,n)=>{let r="",o=0;do r+=t.substring(o,n)+i,o=n+e.length,n=t.indexOf(e,o);while(~n);return r+t.substring(o)},X3=(t=Tu)=>{let e=t?Xu:()=>String;return{isColorSupported:t,reset:e("\x1B[0m","\x1B[0m"),bold:e("\x1B[1m","\x1B[22m","\x1B[22m\x1B[1m"),dim:e("\x1B[2m","\x1B[22m","\x1B[22m\x1B[2m"),italic:e("\x1B[3m","\x1B[23m"),underline:e("\x1B[4m","\x1B[24m"),inverse:e("\x1B[7m","\x1B[27m"),hidden:e("\x1B[8m","\x1B[28m"),strikethrough:e("\x1B[9m","\x1B[29m"),black:e("\x1B[30m","\x1B[39m"),red:e("\x1B[31m","\x1B[39m"),green:e("\x1B[32m","\x1B[39m"),yellow:e("\x1B[33m","\x1B[39m"),blue:e("\x1B[34m","\x1B[39m"),magenta:e("\x1B[35m","\x1B[39m"),cyan:e("\x1B[36m","\x1B[39m"),white:e("\x1B[37m","\x1B[39m"),gray:e("\x1B[90m","\x1B[39m"),bgBlack:e("\x1B[40m","\x1B[49m"),bgRed:e("\x1B[41m","\x1B[49m"),bgGreen:e("\x1B[42m","\x1B[49m"),bgYellow:e("\x1B[43m","\x1B[49m"),bgBlue:e("\x1B[44m","\x1B[49m"),bgMagenta:e("\x1B[45m","\x1B[49m"),bgCyan:e("\x1B[46m","\x1B[49m"),bgWhite:e("\x1B[47m","\x1B[49m"),blackBright:e("\x1B[90m","\x1B[39m"),redBright:e("\x1B[91m","\x1B[39m"),greenBright:e("\x1B[92m","\x1B[39m"),yellowBright:e("\x1B[93m","\x1B[39m"),blueBright:e("\x1B[94m","\x1B[39m"),magentaBright:e("\x1B[95m","\x1B[39m"),cyanBright:e("\x1B[96m","\x1B[39m"),whiteBright:e("\x1B[97m","\x1B[39m"),bgBlackBright:e("\x1B[100m","\x1B[49m"),bgRedBright:e("\x1B[101m","\x1B[49m"),bgGreenBright:e("\x1B[102m","\x1B[49m"),bgYellowBright:e("\x1B[103m","\x1B[49m"),bgBlueBright:e("\x1B[104m","\x1B[49m"),bgMagentaBright:e("\x1B[105m","\x1B[49m"),bgCyanBright:e("\x1B[106m","\x1B[49m"),bgWhiteBright:e("\x1B[107m","\x1B[49m")}};bs.exports=X3();bs.exports.createColors=X3});import{EventEmitter as gA}from"events";function Xo(t){return t==null?[]:Array.isArray(t)?t:[t]}function xA(t,e,i,n){var r,o=t[e],a=~n.string.indexOf(e)?i==null||i===!0?"":String(i):typeof i=="boolean"?i:~n.boolean.indexOf(e)?i==="false"?!1:i==="true"||(t._.push((r=+i,r*0===0?r:i)),!!i):(r=+i,r*0===0?r:i);t[e]=o==null?a:Array.isArray(o)?o.concat(a):[o,a]}function GA(t,e){t=t||[],e=e||{};var i,n,r,o,a,c={_:[]},l=0,v=0,A=0,m=t.length;let I=e.alias!==void 0,E=e.unknown!==void 0,h=e.default!==void 0;if(e.alias=e.alias||{},e.string=Xo(e.string),e.boolean=Xo(e.boolean),I)for(i in e.alias)for(n=e.alias[i]=Xo(e.alias[i]),l=0;l<n.length;l++)(e.alias[n[l]]=n.concat(i)).splice(l,1);for(l=e.boolean.length;l-- >0;)for(n=e.alias[e.boolean[l]]||[],v=n.length;v-- >0;)e.boolean.push(n[v]);for(l=e.string.length;l-- >0;)for(n=e.alias[e.string[l]]||[],v=n.length;v-- >0;)e.string.push(n[v]);if(h){for(i in e.default)if(o=typeof e.default[i],n=e.alias[i]=e.alias[i]||[],e[o]!==void 0)for(e[o].push(i),l=0;l<n.length;l++)e[o].push(n[l])}let d=E?Object.keys(e.alias):[];for(l=0;l<m;l++){if(r=t[l],r==="--"){c._=c._.concat(t.slice(++l));break}for(v=0;v<r.length&&r.charCodeAt(v)===45;v++);if(v===0)c._.push(r);else if(r.substring(v,v+3)==="no-"){if(o=r.substring(v+3),E&&!~d.indexOf(o))return e.unknown(r);c[o]=!1}else{for(A=v+1;A<r.length&&r.charCodeAt(A)!==61;A++);for(o=r.substring(v,A),a=r.substring(++A)||l+1===m||(""+t[l+1]).charCodeAt(0)===45||t[++l],n=v===2?[o]:o,A=0;A<n.length;A++){if(o=n[A],E&&!~d.indexOf(o))return e.unknown("-".repeat(v)+o);xA(c,o,A+1<n.length||a,e)}}}if(h)for(i in e.default)c[i]===void 0&&(c[i]=e.default[i]);if(I)for(i in c)for(n=e.alias[i]||[];n.length>0;)c[n.shift()]=c[i];return c}var Kc=t=>t.replace(/[<[].+/,"").trim(),SA=t=>{let e=/<([^>]+)>/g,i=/\[([^\]]+)\]/g,n=[],r=c=>{let l=!1,v=c[1];return v.startsWith("...")&&(v=v.slice(3),l=!0),{required:c[0].startsWith("<"),value:v,variadic:l}},o;for(;o=e.exec(t);)n.push(r(o));let a;for(;a=i.exec(t);)n.push(r(a));return n},YA=t=>{let e={alias:{},boolean:[]};for(let[i,n]of t.entries())n.names.length>1&&(e.alias[n.names[0]]=n.names.slice(1)),n.isBoolean&&(n.negated&&t.some((o,a)=>a!==i&&o.names.some(c=>n.names.includes(c))&&typeof o.required=="boolean")||e.boolean.push(n.names[0]));return e},Oc=t=>t.sort((e,i)=>e.length>i.length?-1:1)[0],Uc=(t,e)=>t.length>=e?t:`${t}${" ".repeat(e-t.length)}`,WA=t=>t.replace(/([a-z])-([a-z])/g,(e,i,n)=>i+n.toUpperCase()),MA=(t,e,i)=>{let n=0,r=e.length,o=t,a;for(;n<r;++n)a=o[e[n]],o=o[e[n]]=n===r-1?i:a??(~e[n+1].indexOf(".")||!(+e[n+1]>-1)?{}:[])},CA=(t,e)=>{for(let i of Object.keys(e)){let n=e[i];n.shouldTransform&&(t[i]=Array.prototype.concat.call([],t[i]),typeof n.transformFunction=="function"&&(t[i]=t[i].map(n.transformFunction)))}},OA=t=>{let e=/([^\\\/]+)$/.exec(t);return e?e[1]:""},Vc=t=>t.split(".").map((e,i)=>i===0?WA(e):e).join("."),qi=class extends Error{constructor(e){super(e),this.name=this.constructor.name,typeof Error.captureStackTrace=="function"?Error.captureStackTrace(this,this.constructor):this.stack=new Error(e).stack}},Ho=class{constructor(e,i,n){this.rawName=e,this.description=i,this.config=Object.assign({},n),e=e.replace(/\.\*/g,""),this.negated=!1,this.names=Kc(e).split(",").map(r=>{let o=r.trim().replace(/^-{1,2}/,"");return o.startsWith("no-")&&(this.negated=!0,o=o.replace(/^no-/,"")),Vc(o)}).sort((r,o)=>r.length>o.length?1:-1),this.name=this.names[this.names.length-1],this.negated&&this.config.default==null&&(this.config.default=!0),e.includes("<")?this.required=!0:e.includes("[")?this.required=!1:this.isBoolean=!0}},UA=process.argv,KA=`${process.platform}-${process.arch} node-${process.version}`,wn=class{constructor(e,i,n={},r){this.rawName=e,this.description=i,this.config=n,this.cli=r,this.options=[],this.aliasNames=[],this.name=Kc(e),this.args=SA(e),this.examples=[]}usage(e){return this.usageText=e,this}allowUnknownOptions(){return this.config.allowUnknownOptions=!0,this}ignoreOptionDefaultValue(){return this.config.ignoreOptionDefaultValue=!0,this}version(e,i="-v, --version"){return this.versionNumber=e,this.option(i,"Display version number"),this}example(e){return this.examples.push(e),this}option(e,i,n){let r=new Ho(e,i,n);return this.options.push(r),this}alias(e){return this.aliasNames.push(e),this}action(e){return this.commandAction=e,this}isMatched(e){return this.name===e||this.aliasNames.includes(e)}get isDefaultCommand(){return this.name===""||this.aliasNames.includes("!")}get isGlobalCommand(){return this instanceof Tn}hasOption(e){return e=e.split(".")[0],this.options.find(i=>i.names.includes(e))}outputHelp(){let{name:e,commands:i}=this.cli,{versionNumber:n,options:r,helpCallback:o}=this.cli.globalCommand,a=[{body:`${e}${n?`/${n}`:""}`}];if(a.push({title:"Usage",body:` $ ${e} ${this.usageText||this.rawName}`}),(this.isGlobalCommand||this.isDefaultCommand)&&i.length>0){let v=Oc(i.map(A=>A.rawName));a.push({title:"Commands",body:i.map(A=>` ${Uc(A.rawName,v.length)} ${A.description}`).join(`
3
- `)}),a.push({title:"For more info, run any command with the `--help` flag",body:i.map(A=>` $ ${e}${A.name===""?"":` ${A.name}`} --help`).join(`
4
- `)})}let l=this.isGlobalCommand?r:[...this.options,...r||[]];if(!this.isGlobalCommand&&!this.isDefaultCommand&&(l=l.filter(v=>v.name!=="version")),l.length>0){let v=Oc(l.map(A=>A.rawName));a.push({title:"Options",body:l.map(A=>` ${Uc(A.rawName,v.length)} ${A.description} ${A.config.default===void 0?"":`(default: ${A.config.default})`}`).join(`
5
- `)})}this.examples.length>0&&a.push({title:"Examples",body:this.examples.map(v=>typeof v=="function"?v(e):v).join(`
6
- `)}),o&&(a=o(a)||a),console.log(a.map(v=>v.title?`${v.title}:
2
+ var FA=Object.create;var qc=Object.defineProperty;var QA=Object.getOwnPropertyDescriptor;var JA=Object.getOwnPropertyNames;var bA=Object.getPrototypeOf,BA=Object.prototype.hasOwnProperty;var Ln=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var ZA=(t,e,i,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of JA(e))!BA.call(t,r)&&r!==i&&qc(t,r,{get:()=>e[r],enumerable:!(n=QA(e,r))||n.enumerable});return t};var _n=(t,e,i)=>(i=t!=null?FA(bA(t)):{},ZA(e||!t||!t.__esModule?qc(i,"default",{value:t,enumerable:!0}):i,t));var ml=Ln((ff,G7)=>{G7.exports={dots:{interval:80,frames:["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"]},dots2:{interval:80,frames:["\u28FE","\u28FD","\u28FB","\u28BF","\u287F","\u28DF","\u28EF","\u28F7"]},dots3:{interval:80,frames:["\u280B","\u2819","\u281A","\u281E","\u2816","\u2826","\u2834","\u2832","\u2833","\u2813"]},dots4:{interval:80,frames:["\u2804","\u2806","\u2807","\u280B","\u2819","\u2838","\u2830","\u2820","\u2830","\u2838","\u2819","\u280B","\u2807","\u2806"]},dots5:{interval:80,frames:["\u280B","\u2819","\u281A","\u2812","\u2802","\u2802","\u2812","\u2832","\u2834","\u2826","\u2816","\u2812","\u2810","\u2810","\u2812","\u2813","\u280B"]},dots6:{interval:80,frames:["\u2801","\u2809","\u2819","\u281A","\u2812","\u2802","\u2802","\u2812","\u2832","\u2834","\u2824","\u2804","\u2804","\u2824","\u2834","\u2832","\u2812","\u2802","\u2802","\u2812","\u281A","\u2819","\u2809","\u2801"]},dots7:{interval:80,frames:["\u2808","\u2809","\u280B","\u2813","\u2812","\u2810","\u2810","\u2812","\u2816","\u2826","\u2824","\u2820","\u2820","\u2824","\u2826","\u2816","\u2812","\u2810","\u2810","\u2812","\u2813","\u280B","\u2809","\u2808"]},dots8:{interval:80,frames:["\u2801","\u2801","\u2809","\u2819","\u281A","\u2812","\u2802","\u2802","\u2812","\u2832","\u2834","\u2824","\u2804","\u2804","\u2824","\u2820","\u2820","\u2824","\u2826","\u2816","\u2812","\u2810","\u2810","\u2812","\u2813","\u280B","\u2809","\u2808","\u2808"]},dots9:{interval:80,frames:["\u28B9","\u28BA","\u28BC","\u28F8","\u28C7","\u2867","\u2857","\u284F"]},dots10:{interval:80,frames:["\u2884","\u2882","\u2881","\u2841","\u2848","\u2850","\u2860"]},dots11:{interval:100,frames:["\u2801","\u2802","\u2804","\u2840","\u2880","\u2820","\u2810","\u2808"]},dots12:{interval:80,frames:["\u2880\u2800","\u2840\u2800","\u2804\u2800","\u2882\u2800","\u2842\u2800","\u2805\u2800","\u2883\u2800","\u2843\u2800","\u280D\u2800","\u288B\u2800","\u284B\u2800","\u280D\u2801","\u288B\u2801","\u284B\u2801","\u280D\u2809","\u280B\u2809","\u280B\u2809","\u2809\u2819","\u2809\u2819","\u2809\u2829","\u2808\u2899","\u2808\u2859","\u2888\u2829","\u2840\u2899","\u2804\u2859","\u2882\u2829","\u2842\u2898","\u2805\u2858","\u2883\u2828","\u2843\u2890","\u280D\u2850","\u288B\u2820","\u284B\u2880","\u280D\u2841","\u288B\u2801","\u284B\u2801","\u280D\u2809","\u280B\u2809","\u280B\u2809","\u2809\u2819","\u2809\u2819","\u2809\u2829","\u2808\u2899","\u2808\u2859","\u2808\u2829","\u2800\u2899","\u2800\u2859","\u2800\u2829","\u2800\u2898","\u2800\u2858","\u2800\u2828","\u2800\u2890","\u2800\u2850","\u2800\u2820","\u2800\u2880","\u2800\u2840"]},dots13:{interval:80,frames:["\u28FC","\u28F9","\u28BB","\u283F","\u285F","\u28CF","\u28E7","\u28F6"]},dots8Bit:{interval:80,frames:["\u2800","\u2801","\u2802","\u2803","\u2804","\u2805","\u2806","\u2807","\u2840","\u2841","\u2842","\u2843","\u2844","\u2845","\u2846","\u2847","\u2808","\u2809","\u280A","\u280B","\u280C","\u280D","\u280E","\u280F","\u2848","\u2849","\u284A","\u284B","\u284C","\u284D","\u284E","\u284F","\u2810","\u2811","\u2812","\u2813","\u2814","\u2815","\u2816","\u2817","\u2850","\u2851","\u2852","\u2853","\u2854","\u2855","\u2856","\u2857","\u2818","\u2819","\u281A","\u281B","\u281C","\u281D","\u281E","\u281F","\u2858","\u2859","\u285A","\u285B","\u285C","\u285D","\u285E","\u285F","\u2820","\u2821","\u2822","\u2823","\u2824","\u2825","\u2826","\u2827","\u2860","\u2861","\u2862","\u2863","\u2864","\u2865","\u2866","\u2867","\u2828","\u2829","\u282A","\u282B","\u282C","\u282D","\u282E","\u282F","\u2868","\u2869","\u286A","\u286B","\u286C","\u286D","\u286E","\u286F","\u2830","\u2831","\u2832","\u2833","\u2834","\u2835","\u2836","\u2837","\u2870","\u2871","\u2872","\u2873","\u2874","\u2875","\u2876","\u2877","\u2838","\u2839","\u283A","\u283B","\u283C","\u283D","\u283E","\u283F","\u2878","\u2879","\u287A","\u287B","\u287C","\u287D","\u287E","\u287F","\u2880","\u2881","\u2882","\u2883","\u2884","\u2885","\u2886","\u2887","\u28C0","\u28C1","\u28C2","\u28C3","\u28C4","\u28C5","\u28C6","\u28C7","\u2888","\u2889","\u288A","\u288B","\u288C","\u288D","\u288E","\u288F","\u28C8","\u28C9","\u28CA","\u28CB","\u28CC","\u28CD","\u28CE","\u28CF","\u2890","\u2891","\u2892","\u2893","\u2894","\u2895","\u2896","\u2897","\u28D0","\u28D1","\u28D2","\u28D3","\u28D4","\u28D5","\u28D6","\u28D7","\u2898","\u2899","\u289A","\u289B","\u289C","\u289D","\u289E","\u289F","\u28D8","\u28D9","\u28DA","\u28DB","\u28DC","\u28DD","\u28DE","\u28DF","\u28A0","\u28A1","\u28A2","\u28A3","\u28A4","\u28A5","\u28A6","\u28A7","\u28E0","\u28E1","\u28E2","\u28E3","\u28E4","\u28E5","\u28E6","\u28E7","\u28A8","\u28A9","\u28AA","\u28AB","\u28AC","\u28AD","\u28AE","\u28AF","\u28E8","\u28E9","\u28EA","\u28EB","\u28EC","\u28ED","\u28EE","\u28EF","\u28B0","\u28B1","\u28B2","\u28B3","\u28B4","\u28B5","\u28B6","\u28B7","\u28F0","\u28F1","\u28F2","\u28F3","\u28F4","\u28F5","\u28F6","\u28F7","\u28B8","\u28B9","\u28BA","\u28BB","\u28BC","\u28BD","\u28BE","\u28BF","\u28F8","\u28F9","\u28FA","\u28FB","\u28FC","\u28FD","\u28FE","\u28FF"]},sand:{interval:80,frames:["\u2801","\u2802","\u2804","\u2840","\u2848","\u2850","\u2860","\u28C0","\u28C1","\u28C2","\u28C4","\u28CC","\u28D4","\u28E4","\u28E5","\u28E6","\u28EE","\u28F6","\u28F7","\u28FF","\u287F","\u283F","\u289F","\u281F","\u285B","\u281B","\u282B","\u288B","\u280B","\u280D","\u2849","\u2809","\u2811","\u2821","\u2881"]},line:{interval:130,frames:["-","\\","|","/"]},line2:{interval:100,frames:["\u2802","-","\u2013","\u2014","\u2013","-"]},pipe:{interval:100,frames:["\u2524","\u2518","\u2534","\u2514","\u251C","\u250C","\u252C","\u2510"]},simpleDots:{interval:400,frames:[". ",".. ","..."," "]},simpleDotsScrolling:{interval:200,frames:[". ",".. ","..."," .."," ."," "]},star:{interval:70,frames:["\u2736","\u2738","\u2739","\u273A","\u2739","\u2737"]},star2:{interval:80,frames:["+","x","*"]},flip:{interval:70,frames:["_","_","_","-","`","`","'","\xB4","-","_","_","_"]},hamburger:{interval:100,frames:["\u2631","\u2632","\u2634"]},growVertical:{interval:120,frames:["\u2581","\u2583","\u2584","\u2585","\u2586","\u2587","\u2586","\u2585","\u2584","\u2583"]},growHorizontal:{interval:120,frames:["\u258F","\u258E","\u258D","\u258C","\u258B","\u258A","\u2589","\u258A","\u258B","\u258C","\u258D","\u258E"]},balloon:{interval:140,frames:[" ",".","o","O","@","*"," "]},balloon2:{interval:120,frames:[".","o","O","\xB0","O","o","."]},noise:{interval:100,frames:["\u2593","\u2592","\u2591"]},bounce:{interval:120,frames:["\u2801","\u2802","\u2804","\u2802"]},boxBounce:{interval:120,frames:["\u2596","\u2598","\u259D","\u2597"]},boxBounce2:{interval:100,frames:["\u258C","\u2580","\u2590","\u2584"]},triangle:{interval:50,frames:["\u25E2","\u25E3","\u25E4","\u25E5"]},binary:{interval:80,frames:["010010","001100","100101","111010","111101","010111","101011","111000","110011","110101"]},arc:{interval:100,frames:["\u25DC","\u25E0","\u25DD","\u25DE","\u25E1","\u25DF"]},circle:{interval:120,frames:["\u25E1","\u2299","\u25E0"]},squareCorners:{interval:180,frames:["\u25F0","\u25F3","\u25F2","\u25F1"]},circleQuarters:{interval:120,frames:["\u25F4","\u25F7","\u25F6","\u25F5"]},circleHalves:{interval:50,frames:["\u25D0","\u25D3","\u25D1","\u25D2"]},squish:{interval:100,frames:["\u256B","\u256A"]},toggle:{interval:250,frames:["\u22B6","\u22B7"]},toggle2:{interval:80,frames:["\u25AB","\u25AA"]},toggle3:{interval:120,frames:["\u25A1","\u25A0"]},toggle4:{interval:100,frames:["\u25A0","\u25A1","\u25AA","\u25AB"]},toggle5:{interval:100,frames:["\u25AE","\u25AF"]},toggle6:{interval:300,frames:["\u101D","\u1040"]},toggle7:{interval:80,frames:["\u29BE","\u29BF"]},toggle8:{interval:100,frames:["\u25CD","\u25CC"]},toggle9:{interval:100,frames:["\u25C9","\u25CE"]},toggle10:{interval:100,frames:["\u3282","\u3280","\u3281"]},toggle11:{interval:50,frames:["\u29C7","\u29C6"]},toggle12:{interval:120,frames:["\u2617","\u2616"]},toggle13:{interval:80,frames:["=","*","-"]},arrow:{interval:100,frames:["\u2190","\u2196","\u2191","\u2197","\u2192","\u2198","\u2193","\u2199"]},arrow2:{interval:80,frames:["\u2B06\uFE0F ","\u2197\uFE0F ","\u27A1\uFE0F ","\u2198\uFE0F ","\u2B07\uFE0F ","\u2199\uFE0F ","\u2B05\uFE0F ","\u2196\uFE0F "]},arrow3:{interval:120,frames:["\u25B9\u25B9\u25B9\u25B9\u25B9","\u25B8\u25B9\u25B9\u25B9\u25B9","\u25B9\u25B8\u25B9\u25B9\u25B9","\u25B9\u25B9\u25B8\u25B9\u25B9","\u25B9\u25B9\u25B9\u25B8\u25B9","\u25B9\u25B9\u25B9\u25B9\u25B8"]},bouncingBar:{interval:80,frames:["[ ]","[= ]","[== ]","[=== ]","[====]","[ ===]","[ ==]","[ =]","[ ]","[ =]","[ ==]","[ ===]","[====]","[=== ]","[== ]","[= ]"]},bouncingBall:{interval:80,frames:["( \u25CF )","( \u25CF )","( \u25CF )","( \u25CF )","( \u25CF)","( \u25CF )","( \u25CF )","( \u25CF )","( \u25CF )","(\u25CF )"]},smiley:{interval:200,frames:["\u{1F604} ","\u{1F61D} "]},monkey:{interval:300,frames:["\u{1F648} ","\u{1F648} ","\u{1F649} ","\u{1F64A} "]},hearts:{interval:100,frames:["\u{1F49B} ","\u{1F499} ","\u{1F49C} ","\u{1F49A} ","\u2764\uFE0F "]},clock:{interval:100,frames:["\u{1F55B} ","\u{1F550} ","\u{1F551} ","\u{1F552} ","\u{1F553} ","\u{1F554} ","\u{1F555} ","\u{1F556} ","\u{1F557} ","\u{1F558} ","\u{1F559} ","\u{1F55A} "]},earth:{interval:180,frames:["\u{1F30D} ","\u{1F30E} ","\u{1F30F} "]},material:{interval:17,frames:["\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581","\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581","\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581","\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581","\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581","\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581","\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588","\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588","\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588","\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588","\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588","\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588","\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588","\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588","\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581","\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581","\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581","\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581"]},moon:{interval:80,frames:["\u{1F311} ","\u{1F312} ","\u{1F313} ","\u{1F314} ","\u{1F315} ","\u{1F316} ","\u{1F317} ","\u{1F318} "]},runner:{interval:140,frames:["\u{1F6B6} ","\u{1F3C3} "]},pong:{interval:80,frames:["\u2590\u2802 \u258C","\u2590\u2808 \u258C","\u2590 \u2802 \u258C","\u2590 \u2820 \u258C","\u2590 \u2840 \u258C","\u2590 \u2820 \u258C","\u2590 \u2802 \u258C","\u2590 \u2808 \u258C","\u2590 \u2802 \u258C","\u2590 \u2820 \u258C","\u2590 \u2840 \u258C","\u2590 \u2820 \u258C","\u2590 \u2802 \u258C","\u2590 \u2808 \u258C","\u2590 \u2802\u258C","\u2590 \u2820\u258C","\u2590 \u2840\u258C","\u2590 \u2820 \u258C","\u2590 \u2802 \u258C","\u2590 \u2808 \u258C","\u2590 \u2802 \u258C","\u2590 \u2820 \u258C","\u2590 \u2840 \u258C","\u2590 \u2820 \u258C","\u2590 \u2802 \u258C","\u2590 \u2808 \u258C","\u2590 \u2802 \u258C","\u2590 \u2820 \u258C","\u2590 \u2840 \u258C","\u2590\u2820 \u258C"]},shark:{interval:120,frames:["\u2590|\\____________\u258C","\u2590_|\\___________\u258C","\u2590__|\\__________\u258C","\u2590___|\\_________\u258C","\u2590____|\\________\u258C","\u2590_____|\\_______\u258C","\u2590______|\\______\u258C","\u2590_______|\\_____\u258C","\u2590________|\\____\u258C","\u2590_________|\\___\u258C","\u2590__________|\\__\u258C","\u2590___________|\\_\u258C","\u2590____________|\\\u258C","\u2590____________/|\u258C","\u2590___________/|_\u258C","\u2590__________/|__\u258C","\u2590_________/|___\u258C","\u2590________/|____\u258C","\u2590_______/|_____\u258C","\u2590______/|______\u258C","\u2590_____/|_______\u258C","\u2590____/|________\u258C","\u2590___/|_________\u258C","\u2590__/|__________\u258C","\u2590_/|___________\u258C","\u2590/|____________\u258C"]},dqpb:{interval:100,frames:["d","q","p","b"]},weather:{interval:100,frames:["\u2600\uFE0F ","\u2600\uFE0F ","\u2600\uFE0F ","\u{1F324} ","\u26C5\uFE0F ","\u{1F325} ","\u2601\uFE0F ","\u{1F327} ","\u{1F328} ","\u{1F327} ","\u{1F328} ","\u{1F327} ","\u{1F328} ","\u26C8 ","\u{1F328} ","\u{1F327} ","\u{1F328} ","\u2601\uFE0F ","\u{1F325} ","\u26C5\uFE0F ","\u{1F324} ","\u2600\uFE0F ","\u2600\uFE0F "]},christmas:{interval:400,frames:["\u{1F332}","\u{1F384}"]},grenade:{interval:80,frames:["\u060C ","\u2032 "," \xB4 "," \u203E "," \u2E0C"," \u2E0A"," |"," \u204E"," \u2055"," \u0DF4 "," \u2053"," "," "," "]},point:{interval:125,frames:["\u2219\u2219\u2219","\u25CF\u2219\u2219","\u2219\u25CF\u2219","\u2219\u2219\u25CF","\u2219\u2219\u2219"]},layer:{interval:150,frames:["-","=","\u2261"]},betaWave:{interval:80,frames:["\u03C1\u03B2\u03B2\u03B2\u03B2\u03B2\u03B2","\u03B2\u03C1\u03B2\u03B2\u03B2\u03B2\u03B2","\u03B2\u03B2\u03C1\u03B2\u03B2\u03B2\u03B2","\u03B2\u03B2\u03B2\u03C1\u03B2\u03B2\u03B2","\u03B2\u03B2\u03B2\u03B2\u03C1\u03B2\u03B2","\u03B2\u03B2\u03B2\u03B2\u03B2\u03C1\u03B2","\u03B2\u03B2\u03B2\u03B2\u03B2\u03B2\u03C1"]},fingerDance:{interval:160,frames:["\u{1F918} ","\u{1F91F} ","\u{1F596} ","\u270B ","\u{1F91A} ","\u{1F446} "]},fistBump:{interval:80,frames:["\u{1F91C}\u3000\u3000\u3000\u3000\u{1F91B} ","\u{1F91C}\u3000\u3000\u3000\u3000\u{1F91B} ","\u{1F91C}\u3000\u3000\u3000\u3000\u{1F91B} ","\u3000\u{1F91C}\u3000\u3000\u{1F91B}\u3000 ","\u3000\u3000\u{1F91C}\u{1F91B}\u3000\u3000 ","\u3000\u{1F91C}\u2728\u{1F91B}\u3000\u3000 ","\u{1F91C}\u3000\u2728\u3000\u{1F91B}\u3000 "]},soccerHeader:{interval:80,frames:[" \u{1F9D1}\u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F\u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} "]},mindblown:{interval:160,frames:["\u{1F610} ","\u{1F610} ","\u{1F62E} ","\u{1F62E} ","\u{1F626} ","\u{1F626} ","\u{1F627} ","\u{1F627} ","\u{1F92F} ","\u{1F4A5} ","\u2728 ","\u3000 ","\u3000 ","\u3000 "]},speaker:{interval:160,frames:["\u{1F508} ","\u{1F509} ","\u{1F50A} ","\u{1F509} "]},orangePulse:{interval:100,frames:["\u{1F538} ","\u{1F536} ","\u{1F7E0} ","\u{1F7E0} ","\u{1F536} "]},bluePulse:{interval:100,frames:["\u{1F539} ","\u{1F537} ","\u{1F535} ","\u{1F535} ","\u{1F537} "]},orangeBluePulse:{interval:100,frames:["\u{1F538} ","\u{1F536} ","\u{1F7E0} ","\u{1F7E0} ","\u{1F536} ","\u{1F539} ","\u{1F537} ","\u{1F535} ","\u{1F535} ","\u{1F537} "]},timeTravel:{interval:100,frames:["\u{1F55B} ","\u{1F55A} ","\u{1F559} ","\u{1F558} ","\u{1F557} ","\u{1F556} ","\u{1F555} ","\u{1F554} ","\u{1F553} ","\u{1F552} ","\u{1F551} ","\u{1F550} "]},aesthetic:{interval:80,frames:["\u25B0\u25B1\u25B1\u25B1\u25B1\u25B1\u25B1","\u25B0\u25B0\u25B1\u25B1\u25B1\u25B1\u25B1","\u25B0\u25B0\u25B0\u25B1\u25B1\u25B1\u25B1","\u25B0\u25B0\u25B0\u25B0\u25B1\u25B1\u25B1","\u25B0\u25B0\u25B0\u25B0\u25B0\u25B1\u25B1","\u25B0\u25B0\u25B0\u25B0\u25B0\u25B0\u25B1","\u25B0\u25B0\u25B0\u25B0\u25B0\u25B0\u25B0","\u25B0\u25B1\u25B1\u25B1\u25B1\u25B1\u25B1"]},dwarfFortress:{interval:80,frames:[" \u2588\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2588\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2588\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2593\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2593\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2592\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2592\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2591\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2591\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A \u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A \u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A \u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\u2588\xA3\xA3\xA3 "," \u263A \u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\xA3\xA3\xA3 "," \u263A \u2588\xA3\xA3\xA3 "," \u263A\u2588\xA3\xA3\xA3 "," \u263A\u2588\xA3\xA3\xA3 "," \u263A\u2593\xA3\xA3\xA3 "," \u263A\u2593\xA3\xA3\xA3 "," \u263A\u2592\xA3\xA3\xA3 "," \u263A\u2592\xA3\xA3\xA3 "," \u263A\u2591\xA3\xA3\xA3 "," \u263A\u2591\xA3\xA3\xA3 "," \u263A \xA3\xA3\xA3 "," \u263A\xA3\xA3\xA3 "," \u263A\xA3\xA3\xA3 "," \u263A\u2593\xA3\xA3 "," \u263A\u2593\xA3\xA3 "," \u263A\u2592\xA3\xA3 "," \u263A\u2592\xA3\xA3 "," \u263A\u2591\xA3\xA3 "," \u263A\u2591\xA3\xA3 "," \u263A \xA3\xA3 "," \u263A\xA3\xA3 "," \u263A\xA3\xA3 "," \u263A\u2593\xA3 "," \u263A\u2593\xA3 "," \u263A\u2592\xA3 "," \u263A\u2592\xA3 "," \u263A\u2591\xA3 "," \u263A\u2591\xA3 "," \u263A \xA3 "," \u263A\xA3 "," \u263A\xA3 "," \u263A\u2593 "," \u263A\u2593 "," \u263A\u2592 "," \u263A\u2592 "," \u263A\u2591 "," \u263A\u2591 "," \u263A "," \u263A &"," \u263A \u263C&"," \u263A \u263C &"," \u263A\u263C &"," \u263A\u263C & "," \u203C & "," \u263A & "," \u203C & "," \u263A & "," \u203C & "," \u263A & ","\u203C & "," & "," & "," & \u2591 "," & \u2592 "," & \u2593 "," & \xA3 "," & \u2591\xA3 "," & \u2592\xA3 "," & \u2593\xA3 "," & \xA3\xA3 "," & \u2591\xA3\xA3 "," & \u2592\xA3\xA3 ","& \u2593\xA3\xA3 ","& \xA3\xA3\xA3 "," \u2591\xA3\xA3\xA3 "," \u2592\xA3\xA3\xA3 "," \u2593\xA3\xA3\xA3 "," \u2588\xA3\xA3\xA3 "," \u2591\u2588\xA3\xA3\xA3 "," \u2592\u2588\xA3\xA3\xA3 "," \u2593\u2588\xA3\xA3\xA3 "," \u2588\u2588\xA3\xA3\xA3 "," \u2591\u2588\u2588\xA3\xA3\xA3 "," \u2592\u2588\u2588\xA3\xA3\xA3 "," \u2593\u2588\u2588\xA3\xA3\xA3 "," \u2588\u2588\u2588\xA3\xA3\xA3 "," \u2591\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2592\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2593\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2591\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2592\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2593\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2591\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2592\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2593\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2588\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2588\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "]}}});var js=Ln((hf,Il)=>{"use strict";var lr=Object.assign({},ml()),El=Object.keys(lr);Object.defineProperty(lr,"random",{get(){let t=Math.floor(Math.random()*El.length),e=El[t];return lr[e]}});Il.exports=lr});var zl=Ln((Of,Rl)=>{Rl.exports=()=>/[#*0-9]\uFE0F?\u20E3|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26AA\u26B0\u26B1\u26BD\u26BE\u26C4\u26C8\u26CF\u26D1\u26E9\u26F0-\u26F5\u26F7\u26F8\u26FA\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2757\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B55\u3030\u303D\u3297\u3299]\uFE0F?|[\u261D\u270C\u270D](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\u270A\u270B](?:\uD83C[\uDFFB-\uDFFF])?|[\u23E9-\u23EC\u23F0\u23F3\u25FD\u2693\u26A1\u26AB\u26C5\u26CE\u26D4\u26EA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2795-\u2797\u27B0\u27BF\u2B50]|\u26D3\uFE0F?(?:\u200D\uD83D\uDCA5)?|\u26F9(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\u2764\uFE0F?(?:\u200D(?:\uD83D\uDD25|\uD83E\uDE79))?|\uD83C(?:[\uDC04\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]\uFE0F?|[\uDF85\uDFC2\uDFC7](?:\uD83C[\uDFFB-\uDFFF])?|[\uDFC4\uDFCA](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDFCB\uDFCC](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF43\uDF45-\uDF4A\uDF4C-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uDDE6\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF]|\uDDE7\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF]|\uDDE8\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF7\uDDFA-\uDDFF]|\uDDE9\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF]|\uDDEA\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA]|\uDDEB\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7]|\uDDEC\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE]|\uDDED\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA]|\uDDEE\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9]|\uDDEF\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5]|\uDDF0\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF]|\uDDF1\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE]|\uDDF2\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF]|\uDDF3\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF]|\uDDF4\uD83C\uDDF2|\uDDF5\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE]|\uDDF6\uD83C\uDDE6|\uDDF7\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC]|\uDDF8\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF]|\uDDF9\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF]|\uDDFA\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF]|\uDDFB\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA]|\uDDFC\uD83C[\uDDEB\uDDF8]|\uDDFD\uD83C\uDDF0|\uDDFE\uD83C[\uDDEA\uDDF9]|\uDDFF\uD83C[\uDDE6\uDDF2\uDDFC]|\uDF44(?:\u200D\uD83D\uDFEB)?|\uDF4B(?:\u200D\uD83D\uDFE9)?|\uDFC3(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDFF3\uFE0F?(?:\u200D(?:\u26A7\uFE0F?|\uD83C\uDF08))?|\uDFF4(?:\u200D\u2620\uFE0F?|\uDB40\uDC67\uDB40\uDC62\uDB40(?:\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDC73\uDB40\uDC63\uDB40\uDC74|\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F)?)|\uD83D(?:[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3]\uFE0F?|[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC](?:\uD83C[\uDFFB-\uDFFF])?|[\uDC6E-\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4\uDEB5](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD74\uDD90](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC25\uDC27-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE41\uDE43\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED8\uDEDC-\uDEDF\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB\uDFF0]|\uDC08(?:\u200D\u2B1B)?|\uDC15(?:\u200D\uD83E\uDDBA)?|\uDC26(?:\u200D(?:\u2B1B|\uD83D\uDD25))?|\uDC3B(?:\u200D\u2744\uFE0F?)?|\uDC41\uFE0F?(?:\u200D\uD83D\uDDE8\uFE0F?)?|\uDC68(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDC68\uDC69]\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?))?|\uDC69(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?[\uDC68\uDC69]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?|\uDC69\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?))|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFC-\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFD-\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFD\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFE]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFE])))?))?|\uDD75(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDE2E(?:\u200D\uD83D\uDCA8)?|\uDE35(?:\u200D\uD83D\uDCAB)?|\uDE36(?:\u200D\uD83C\uDF2B\uFE0F?)?|\uDE42(?:\u200D[\u2194\u2195]\uFE0F?)?|\uDEB6(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?)|\uD83E(?:[\uDD0C\uDD0F\uDD18-\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5\uDEC3-\uDEC5\uDEF0\uDEF2-\uDEF8](?:\uD83C[\uDFFB-\uDFFF])?|[\uDD26\uDD35\uDD37-\uDD39\uDD3C-\uDD3E\uDDB8\uDDB9\uDDCD\uDDCF\uDDD4\uDDD6-\uDDDD](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDDDE\uDDDF](?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD0D\uDD0E\uDD10-\uDD17\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCC\uDDD0\uDDE0-\uDDFF\uDE70-\uDE7C\uDE80-\uDE8A\uDE8E-\uDEC2\uDEC6\uDEC8\uDECD-\uDEDC\uDEDF-\uDEEA\uDEEF]|\uDDCE(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDDD1(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1|\uDDD1\u200D\uD83E\uDDD2(?:\u200D\uD83E\uDDD2)?|\uDDD2(?:\u200D\uD83E\uDDD2)?))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE])))?))?|\uDEF1(?:\uD83C(?:\uDFFB(?:\u200D\uD83E\uDEF2\uD83C[\uDFFC-\uDFFF])?|\uDFFC(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFD-\uDFFF])?|\uDFFD(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])?|\uDFFE(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFD\uDFFF])?|\uDFFF(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFE])?))?)/g});var cv=Ln((pz,ec)=>{var Go=process||{},sv=Go.argv||[],xo=Go.env||{},EE=!(xo.NO_COLOR||sv.includes("--no-color"))&&(!!xo.FORCE_COLOR||sv.includes("--color")||Go.platform==="win32"||(Go.stdout||{}).isTTY&&xo.TERM!=="dumb"||!!xo.CI),IE=(t,e,i=t)=>n=>{let r=""+n,o=r.indexOf(e,t.length);return~o?t+pE(r,e,i,o)+e:t+r+e},pE=(t,e,i,n)=>{let r="",o=0;do r+=t.substring(o,n)+i,o=n+e.length,n=t.indexOf(e,o);while(~n);return r+t.substring(o)},av=(t=EE)=>{let e=t?IE:()=>String;return{isColorSupported:t,reset:e("\x1B[0m","\x1B[0m"),bold:e("\x1B[1m","\x1B[22m","\x1B[22m\x1B[1m"),dim:e("\x1B[2m","\x1B[22m","\x1B[22m\x1B[2m"),italic:e("\x1B[3m","\x1B[23m"),underline:e("\x1B[4m","\x1B[24m"),inverse:e("\x1B[7m","\x1B[27m"),hidden:e("\x1B[8m","\x1B[28m"),strikethrough:e("\x1B[9m","\x1B[29m"),black:e("\x1B[30m","\x1B[39m"),red:e("\x1B[31m","\x1B[39m"),green:e("\x1B[32m","\x1B[39m"),yellow:e("\x1B[33m","\x1B[39m"),blue:e("\x1B[34m","\x1B[39m"),magenta:e("\x1B[35m","\x1B[39m"),cyan:e("\x1B[36m","\x1B[39m"),white:e("\x1B[37m","\x1B[39m"),gray:e("\x1B[90m","\x1B[39m"),bgBlack:e("\x1B[40m","\x1B[49m"),bgRed:e("\x1B[41m","\x1B[49m"),bgGreen:e("\x1B[42m","\x1B[49m"),bgYellow:e("\x1B[43m","\x1B[49m"),bgBlue:e("\x1B[44m","\x1B[49m"),bgMagenta:e("\x1B[45m","\x1B[49m"),bgCyan:e("\x1B[46m","\x1B[49m"),bgWhite:e("\x1B[47m","\x1B[49m"),blackBright:e("\x1B[90m","\x1B[39m"),redBright:e("\x1B[91m","\x1B[39m"),greenBright:e("\x1B[92m","\x1B[39m"),yellowBright:e("\x1B[93m","\x1B[39m"),blueBright:e("\x1B[94m","\x1B[39m"),magentaBright:e("\x1B[95m","\x1B[39m"),cyanBright:e("\x1B[96m","\x1B[39m"),whiteBright:e("\x1B[97m","\x1B[39m"),bgBlackBright:e("\x1B[100m","\x1B[49m"),bgRedBright:e("\x1B[101m","\x1B[49m"),bgGreenBright:e("\x1B[102m","\x1B[49m"),bgYellowBright:e("\x1B[103m","\x1B[49m"),bgBlueBright:e("\x1B[104m","\x1B[49m"),bgMagentaBright:e("\x1B[105m","\x1B[49m"),bgCyanBright:e("\x1B[106m","\x1B[49m"),bgWhiteBright:e("\x1B[107m","\x1B[49m")}};ec.exports=av();ec.exports.createColors=av});import{EventEmitter as PA}from"events";function as(t){return t==null?[]:Array.isArray(t)?t:[t]}function qA(t,e,i,n){var r,o=t[e],s=~n.string.indexOf(e)?i==null||i===!0?"":String(i):typeof i=="boolean"?i:~n.boolean.indexOf(e)?i==="false"?!1:i==="true"||(t._.push((r=+i,r*0===0?r:i)),!!i):(r=+i,r*0===0?r:i);t[e]=o==null?s:Array.isArray(o)?o.concat(s):[o,s]}function yA(t,e){t=t||[],e=e||{};var i,n,r,o,s,c={_:[]},l=0,v=0,A=0,u=t.length;let I=e.alias!==void 0,E=e.unknown!==void 0,f=e.default!==void 0;if(e.alias=e.alias||{},e.string=as(e.string),e.boolean=as(e.boolean),I)for(i in e.alias)for(n=e.alias[i]=as(e.alias[i]),l=0;l<n.length;l++)(e.alias[n[l]]=n.concat(i)).splice(l,1);for(l=e.boolean.length;l-- >0;)for(n=e.alias[e.boolean[l]]||[],v=n.length;v-- >0;)e.boolean.push(n[v]);for(l=e.string.length;l-- >0;)for(n=e.alias[e.string[l]]||[],v=n.length;v-- >0;)e.string.push(n[v]);if(f){for(i in e.default)if(o=typeof e.default[i],n=e.alias[i]=e.alias[i]||[],e[o]!==void 0)for(e[o].push(i),l=0;l<n.length;l++)e[o].push(n[l])}let R=E?Object.keys(e.alias):[];for(l=0;l<u;l++){if(r=t[l],r==="--"){c._=c._.concat(t.slice(++l));break}for(v=0;v<r.length&&r.charCodeAt(v)===45;v++);if(v===0)c._.push(r);else if(r.substring(v,v+3)==="no-"){if(o=r.substring(v+3),E&&!~R.indexOf(o))return e.unknown(r);c[o]=!1}else{for(A=v+1;A<r.length&&r.charCodeAt(A)!==61;A++);for(o=r.substring(v,A),s=r.substring(++A)||l+1===u||(""+t[l+1]).charCodeAt(0)===45||t[++l],n=v===2?[o]:o,A=0;A<n.length;A++){if(o=n[A],E&&!~R.indexOf(o))return e.unknown("-".repeat(v)+o);qA(c,o,A+1<n.length||s,e)}}}if(f)for(i in e.default)c[i]===void 0&&(c[i]=e.default[i]);if(I)for(i in c)for(n=e.alias[i]||[];n.length>0;)c[n.shift()]=c[i];return c}var wc=t=>t.replace(/[<[].+/,"").trim(),DA=t=>{let e=/<([^>]+)>/g,i=/\[([^\]]+)\]/g,n=[],r=c=>{let l=!1,v=c[1];return v.startsWith("...")&&(v=v.slice(3),l=!0),{required:c[0].startsWith("<"),value:v,variadic:l}},o;for(;o=e.exec(t);)n.push(r(o));let s;for(;s=i.exec(t);)n.push(r(s));return n},wA=t=>{let e={alias:{},boolean:[]};for(let[i,n]of t.entries())n.names.length>1&&(e.alias[n.names[0]]=n.names.slice(1)),n.isBoolean&&(n.negated&&t.some((o,s)=>s!==i&&o.names.some(c=>n.names.includes(c))&&typeof o.required=="boolean")||e.boolean.push(n.names[0]));return e},yc=t=>t.sort((e,i)=>e.length>i.length?-1:1)[0],Dc=(t,e)=>t.length>=e?t:`${t}${" ".repeat(e-t.length)}`,TA=t=>t.replace(/([a-z])-([a-z])/g,(e,i,n)=>i+n.toUpperCase()),XA=(t,e,i)=>{let n=0,r=e.length,o=t,s;for(;n<r;++n)s=o[e[n]],o=o[e[n]]=n===r-1?i:s??(~e[n+1].indexOf(".")||!(+e[n+1]>-1)?{}:[])},HA=(t,e)=>{for(let i of Object.keys(e)){let n=e[i];n.shouldTransform&&(t[i]=Array.prototype.concat.call([],t[i]),typeof n.transformFunction=="function"&&(t[i]=t[i].map(n.transformFunction)))}},LA=t=>{let e=/([^\\\/]+)$/.exec(t);return e?e[1]:""},Tc=t=>t.split(".").map((e,i)=>i===0?TA(e):e).join("."),Hi=class extends Error{constructor(e){super(e),this.name=this.constructor.name,typeof Error.captureStackTrace=="function"?Error.captureStackTrace(this,this.constructor):this.stack=new Error(e).stack}},cs=class{constructor(e,i,n){this.rawName=e,this.description=i,this.config=Object.assign({},n),e=e.replace(/\.\*/g,""),this.negated=!1,this.names=wc(e).split(",").map(r=>{let o=r.trim().replace(/^-{1,2}/,"");return o.startsWith("no-")&&(this.negated=!0,o=o.replace(/^no-/,"")),Tc(o)}).sort((r,o)=>r.length>o.length?1:-1),this.name=this.names[this.names.length-1],this.negated&&this.config.default==null&&(this.config.default=!0),e.includes("<")?this.required=!0:e.includes("[")?this.required=!1:this.isBoolean=!0}},_A=process.argv,$A=`${process.platform}-${process.arch} node-${process.version}`,er=class{constructor(e,i,n={},r){this.rawName=e,this.description=i,this.config=n,this.cli=r,this.options=[],this.aliasNames=[],this.name=wc(e),this.args=DA(e),this.examples=[]}usage(e){return this.usageText=e,this}allowUnknownOptions(){return this.config.allowUnknownOptions=!0,this}ignoreOptionDefaultValue(){return this.config.ignoreOptionDefaultValue=!0,this}version(e,i="-v, --version"){return this.versionNumber=e,this.option(i,"Display version number"),this}example(e){return this.examples.push(e),this}option(e,i,n){let r=new cs(e,i,n);return this.options.push(r),this}alias(e){return this.aliasNames.push(e),this}action(e){return this.commandAction=e,this}isMatched(e){return this.name===e||this.aliasNames.includes(e)}get isDefaultCommand(){return this.name===""||this.aliasNames.includes("!")}get isGlobalCommand(){return this instanceof tr}hasOption(e){return e=e.split(".")[0],this.options.find(i=>i.names.includes(e))}outputHelp(){let{name:e,commands:i}=this.cli,{versionNumber:n,options:r,helpCallback:o}=this.cli.globalCommand,s=[{body:`${e}${n?`/${n}`:""}`}];if(s.push({title:"Usage",body:` $ ${e} ${this.usageText||this.rawName}`}),(this.isGlobalCommand||this.isDefaultCommand)&&i.length>0){let v=yc(i.map(A=>A.rawName));s.push({title:"Commands",body:i.map(A=>` ${Dc(A.rawName,v.length)} ${A.description}`).join(`
3
+ `)}),s.push({title:"For more info, run any command with the `--help` flag",body:i.map(A=>` $ ${e}${A.name===""?"":` ${A.name}`} --help`).join(`
4
+ `)})}let l=this.isGlobalCommand?r:[...this.options,...r||[]];if(!this.isGlobalCommand&&!this.isDefaultCommand&&(l=l.filter(v=>v.name!=="version")),l.length>0){let v=yc(l.map(A=>A.rawName));s.push({title:"Options",body:l.map(A=>` ${Dc(A.rawName,v.length)} ${A.description} ${A.config.default===void 0?"":`(default: ${A.config.default})`}`).join(`
5
+ `)})}this.examples.length>0&&s.push({title:"Examples",body:this.examples.map(v=>typeof v=="function"?v(e):v).join(`
6
+ `)}),o&&(s=o(s)||s),console.log(s.map(v=>v.title?`${v.title}:
7
7
  ${v.body}`:v.body).join(`
8
8
 
9
- `))}outputVersion(){let{name:e}=this.cli,{versionNumber:i}=this.cli.globalCommand;i&&console.log(`${e}/${i} ${KA}`)}checkRequiredArgs(){let e=this.args.filter(i=>i.required).length;if(this.cli.args.length<e)throw new qi(`missing required args for command \`${this.rawName}\``)}checkUnknownOptions(){let{options:e,globalCommand:i}=this.cli;if(!this.config.allowUnknownOptions){for(let n of Object.keys(e))if(n!=="--"&&!this.hasOption(n)&&!i.hasOption(n))throw new qi(`Unknown option \`${n.length>1?`--${n}`:`-${n}`}\``)}}checkOptionValue(){let{options:e,globalCommand:i}=this.cli,n=[...i.options,...this.options];for(let r of n){let o=e[r.name.split(".")[0]];if(r.required){let a=n.some(c=>c.negated&&c.names.includes(r.name));if(o===!0||o===!1&&!a)throw new qi(`option \`${r.rawName}\` value is missing`)}}}},Tn=class extends wn{constructor(e){super("@@global@@","",{},e)}},yn=Object.assign,Lo=class extends gA{constructor(e=""){super(),this.name=e,this.commands=[],this.rawArgs=[],this.args=[],this.options={},this.globalCommand=new Tn(this),this.globalCommand.usage("<command> [options]")}usage(e){return this.globalCommand.usage(e),this}command(e,i,n){let r=new wn(e,i||"",n,this);return r.globalCommand=this.globalCommand,this.commands.push(r),r}option(e,i,n){return this.globalCommand.option(e,i,n),this}help(e){return this.globalCommand.option("-h, --help","Display this message"),this.globalCommand.helpCallback=e,this.showHelpOnExit=!0,this}version(e,i="-v, --version"){return this.globalCommand.version(e,i),this.showVersionOnExit=!0,this}example(e){return this.globalCommand.example(e),this}outputHelp(){this.matchedCommand?this.matchedCommand.outputHelp():this.globalCommand.outputHelp()}outputVersion(){this.globalCommand.outputVersion()}setParsedInfo({args:e,options:i},n,r){return this.args=e,this.options=i,n&&(this.matchedCommand=n),r&&(this.matchedCommandName=r),this}unsetMatchedCommand(){this.matchedCommand=void 0,this.matchedCommandName=void 0}parse(e=UA,{run:i=!0}={}){this.rawArgs=e,this.name||(this.name=e[1]?OA(e[1]):"cli");let n=!0;for(let o of this.commands){let a=this.mri(e.slice(2),o),c=a.args[0];if(o.isMatched(c)){n=!1;let l=yn(yn({},a),{args:a.args.slice(1)});this.setParsedInfo(l,o,c),this.emit(`command:${c}`,o)}}if(n){for(let o of this.commands)if(o.name===""){n=!1;let a=this.mri(e.slice(2),o);this.setParsedInfo(a,o),this.emit("command:!",o)}}if(n){let o=this.mri(e.slice(2));this.setParsedInfo(o)}this.options.help&&this.showHelpOnExit&&(this.outputHelp(),i=!1,this.unsetMatchedCommand()),this.options.version&&this.showVersionOnExit&&this.matchedCommandName==null&&(this.outputVersion(),i=!1,this.unsetMatchedCommand());let r={args:this.args,options:this.options};return i&&this.runMatchedCommand(),!this.matchedCommand&&this.args[0]&&this.emit("command:*"),r}mri(e,i){let n=[...this.globalCommand.options,...i?i.options:[]],r=YA(n),o=[],a=e.indexOf("--");a>-1&&(o=e.slice(a+1),e=e.slice(0,a));let c=GA(e,r);c=Object.keys(c).reduce((I,E)=>yn(yn({},I),{[Vc(E)]:c[E]}),{_:[]});let l=c._,v={"--":o},A=i&&i.config.ignoreOptionDefaultValue?i.config.ignoreOptionDefaultValue:this.globalCommand.config.ignoreOptionDefaultValue,m=Object.create(null);for(let I of n){if(!A&&I.config.default!==void 0)for(let E of I.names)v[E]=I.config.default;Array.isArray(I.config.type)&&m[I.name]===void 0&&(m[I.name]=Object.create(null),m[I.name].shouldTransform=!0,m[I.name].transformFunction=I.config.type[0])}for(let I of Object.keys(c))if(I!=="_"){let E=I.split(".");MA(v,E,c[I]),CA(v,m)}return{args:l,options:v}}runMatchedCommand(){let{args:e,options:i,matchedCommand:n}=this;if(!n||!n.commandAction)return;n.checkUnknownOptions(),n.checkOptionValue(),n.checkRequiredArgs();let r=[];return n.args.forEach((o,a)=>{o.variadic?r.push(e.slice(a)):r.push(e[a])}),r.push(i),n.commandAction.apply(this,r)}},Nc=(t="")=>new Lo(t);import{existsSync as oE}from"fs";import{join as aE}from"path";import{spawn as sE}from"child_process";import nr from"node:process";var kc=(t=0)=>e=>`\x1B[${e+t}m`,Fc=(t=0)=>e=>`\x1B[${38+t};5;${e}m`,Qc=(t=0)=>(e,i,n)=>`\x1B[${38+t};2;${e};${i};${n}m`,S={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,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]}},H9=Object.keys(S.modifier),VA=Object.keys(S.color),NA=Object.keys(S.bgColor),L9=[...VA,...NA];function kA(){let t=new Map;for(let[e,i]of Object.entries(S)){for(let[n,r]of Object.entries(i))S[n]={open:`\x1B[${r[0]}m`,close:`\x1B[${r[1]}m`},i[n]=S[n],t.set(r[0],r[1]);Object.defineProperty(S,e,{value:i,enumerable:!1})}return Object.defineProperty(S,"codes",{value:t,enumerable:!1}),S.color.close="\x1B[39m",S.bgColor.close="\x1B[49m",S.color.ansi=kc(),S.color.ansi256=Fc(),S.color.ansi16m=Qc(),S.bgColor.ansi=kc(10),S.bgColor.ansi256=Fc(10),S.bgColor.ansi16m=Qc(10),Object.defineProperties(S,{rgbToAnsi256:{value(e,i,n){return e===i&&i===n?e<8?16:e>248?231:Math.round((e-8)/247*24)+232:16+36*Math.round(e/255*5)+6*Math.round(i/255*5)+Math.round(n/255*5)},enumerable:!1},hexToRgb:{value(e){let i=/[a-f\d]{6}|[a-f\d]{3}/i.exec(e.toString(16));if(!i)return[0,0,0];let[n]=i;n.length===3&&(n=[...n].map(o=>o+o).join(""));let r=Number.parseInt(n,16);return[r>>16&255,r>>8&255,r&255]},enumerable:!1},hexToAnsi256:{value:e=>S.rgbToAnsi256(...S.hexToRgb(e)),enumerable:!1},ansi256ToAnsi:{value(e){if(e<8)return 30+e;if(e<16)return 90+(e-8);let i,n,r;if(e>=232)i=((e-232)*10+8)/255,n=i,r=i;else{e-=16;let c=e%36;i=Math.floor(e/36)/5,n=Math.floor(c/6)/5,r=c%6/5}let o=Math.max(i,n,r)*2;if(o===0)return 30;let a=30+(Math.round(r)<<2|Math.round(n)<<1|Math.round(i));return o===2&&(a+=60),a},enumerable:!1},rgbToAnsi:{value:(e,i,n)=>S.ansi256ToAnsi(S.rgbToAnsi256(e,i,n)),enumerable:!1},hexToAnsi:{value:e=>S.ansi256ToAnsi(S.hexToAnsi256(e)),enumerable:!1}}),S}var FA=kA(),pe=FA;import _o from"node:process";import QA from"node:os";import Jc from"node:tty";function ve(t,e=globalThis.Deno?globalThis.Deno.args:_o.argv){let i=t.startsWith("-")?"":t.length===1?"-":"--",n=e.indexOf(i+t),r=e.indexOf("--");return n!==-1&&(r===-1||n<r)}var{env:Y}=_o,Xn;ve("no-color")||ve("no-colors")||ve("color=false")||ve("color=never")?Xn=0:(ve("color")||ve("colors")||ve("color=true")||ve("color=always"))&&(Xn=1);function JA(){if("FORCE_COLOR"in Y)return Y.FORCE_COLOR==="true"?1:Y.FORCE_COLOR==="false"?0:Y.FORCE_COLOR.length===0?1:Math.min(Number.parseInt(Y.FORCE_COLOR,10),3)}function BA(t){return t===0?!1:{level:t,hasBasic:!0,has256:t>=2,has16m:t>=3}}function ZA(t,{streamIsTTY:e,sniffFlags:i=!0}={}){let n=JA();n!==void 0&&(Xn=n);let r=i?Xn:n;if(r===0)return 0;if(i){if(ve("color=16m")||ve("color=full")||ve("color=truecolor"))return 3;if(ve("color=256"))return 2}if("TF_BUILD"in Y&&"AGENT_NAME"in Y)return 1;if(t&&!e&&r===void 0)return 0;let o=r||0;if(Y.TERM==="dumb")return o;if(_o.platform==="win32"){let a=QA.release().split(".");return Number(a[0])>=10&&Number(a[2])>=10586?Number(a[2])>=14931?3:2:1}if("CI"in Y)return["GITHUB_ACTIONS","GITEA_ACTIONS","CIRCLECI"].some(a=>a in Y)?3:["TRAVIS","APPVEYOR","GITLAB_CI","BUILDKITE","DRONE"].some(a=>a in Y)||Y.CI_NAME==="codeship"?1:o;if("TEAMCITY_VERSION"in Y)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(Y.TEAMCITY_VERSION)?1:0;if(Y.COLORTERM==="truecolor"||Y.TERM==="xterm-kitty"||Y.TERM==="xterm-ghostty"||Y.TERM==="wezterm")return 3;if("TERM_PROGRAM"in Y){let a=Number.parseInt((Y.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(Y.TERM_PROGRAM){case"iTerm.app":return a>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(Y.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(Y.TERM)||"COLORTERM"in Y?1:o}function Bc(t,e={}){let i=ZA(t,{streamIsTTY:t&&t.isTTY,...e});return BA(i)}var bA={stdout:Bc({isTTY:Jc.isatty(1)}),stderr:Bc({isTTY:Jc.isatty(2)})},Zc=bA;function bc(t,e,i){let n=t.indexOf(e);if(n===-1)return t;let r=e.length,o=0,a="";do a+=t.slice(o,n)+e+i,o=n+r,n=t.indexOf(e,o);while(n!==-1);return a+=t.slice(o),a}function Pc(t,e,i,n){let r=0,o="";do{let a=t[n-1]==="\r";o+=t.slice(r,a?n-1:n)+e+(a?`\r
9
+ `))}outputVersion(){let{name:e}=this.cli,{versionNumber:i}=this.cli.globalCommand;i&&console.log(`${e}/${i} ${$A}`)}checkRequiredArgs(){let e=this.args.filter(i=>i.required).length;if(this.cli.args.length<e)throw new Hi(`missing required args for command \`${this.rawName}\``)}checkUnknownOptions(){let{options:e,globalCommand:i}=this.cli;if(!this.config.allowUnknownOptions){for(let n of Object.keys(e))if(n!=="--"&&!this.hasOption(n)&&!i.hasOption(n))throw new Hi(`Unknown option \`${n.length>1?`--${n}`:`-${n}`}\``)}}checkOptionValue(){let{options:e,globalCommand:i}=this.cli,n=[...i.options,...this.options];for(let r of n){let o=e[r.name.split(".")[0]];if(r.required){let s=n.some(c=>c.negated&&c.names.includes(r.name));if(o===!0||o===!1&&!s)throw new Hi(`option \`${r.rawName}\` value is missing`)}}}},tr=class extends er{constructor(e){super("@@global@@","",{},e)}},$n=Object.assign,ls=class extends PA{constructor(e=""){super(),this.name=e,this.commands=[],this.rawArgs=[],this.args=[],this.options={},this.globalCommand=new tr(this),this.globalCommand.usage("<command> [options]")}usage(e){return this.globalCommand.usage(e),this}command(e,i,n){let r=new er(e,i||"",n,this);return r.globalCommand=this.globalCommand,this.commands.push(r),r}option(e,i,n){return this.globalCommand.option(e,i,n),this}help(e){return this.globalCommand.option("-h, --help","Display this message"),this.globalCommand.helpCallback=e,this.showHelpOnExit=!0,this}version(e,i="-v, --version"){return this.globalCommand.version(e,i),this.showVersionOnExit=!0,this}example(e){return this.globalCommand.example(e),this}outputHelp(){this.matchedCommand?this.matchedCommand.outputHelp():this.globalCommand.outputHelp()}outputVersion(){this.globalCommand.outputVersion()}setParsedInfo({args:e,options:i},n,r){return this.args=e,this.options=i,n&&(this.matchedCommand=n),r&&(this.matchedCommandName=r),this}unsetMatchedCommand(){this.matchedCommand=void 0,this.matchedCommandName=void 0}parse(e=_A,{run:i=!0}={}){this.rawArgs=e,this.name||(this.name=e[1]?LA(e[1]):"cli");let n=!0;for(let o of this.commands){let s=this.mri(e.slice(2),o),c=s.args[0];if(o.isMatched(c)){n=!1;let l=$n($n({},s),{args:s.args.slice(1)});this.setParsedInfo(l,o,c),this.emit(`command:${c}`,o)}}if(n){for(let o of this.commands)if(o.name===""){n=!1;let s=this.mri(e.slice(2),o);this.setParsedInfo(s,o),this.emit("command:!",o)}}if(n){let o=this.mri(e.slice(2));this.setParsedInfo(o)}this.options.help&&this.showHelpOnExit&&(this.outputHelp(),i=!1,this.unsetMatchedCommand()),this.options.version&&this.showVersionOnExit&&this.matchedCommandName==null&&(this.outputVersion(),i=!1,this.unsetMatchedCommand());let r={args:this.args,options:this.options};return i&&this.runMatchedCommand(),!this.matchedCommand&&this.args[0]&&this.emit("command:*"),r}mri(e,i){let n=[...this.globalCommand.options,...i?i.options:[]],r=wA(n),o=[],s=e.indexOf("--");s>-1&&(o=e.slice(s+1),e=e.slice(0,s));let c=yA(e,r);c=Object.keys(c).reduce((I,E)=>$n($n({},I),{[Tc(E)]:c[E]}),{_:[]});let l=c._,v={"--":o},A=i&&i.config.ignoreOptionDefaultValue?i.config.ignoreOptionDefaultValue:this.globalCommand.config.ignoreOptionDefaultValue,u=Object.create(null);for(let I of n){if(!A&&I.config.default!==void 0)for(let E of I.names)v[E]=I.config.default;Array.isArray(I.config.type)&&u[I.name]===void 0&&(u[I.name]=Object.create(null),u[I.name].shouldTransform=!0,u[I.name].transformFunction=I.config.type[0])}for(let I of Object.keys(c))if(I!=="_"){let E=I.split(".");XA(v,E,c[I]),HA(v,u)}return{args:l,options:v}}runMatchedCommand(){let{args:e,options:i,matchedCommand:n}=this;if(!n||!n.commandAction)return;n.checkUnknownOptions(),n.checkOptionValue(),n.checkRequiredArgs();let r=[];return n.args.forEach((o,s)=>{o.variadic?r.push(e.slice(s)):r.push(e[s])}),r.push(i),n.commandAction.apply(this,r)}},Xc=(t="")=>new ls(t);import{existsSync as kE}from"fs";import{join as FE}from"path";import{spawn as QE,spawnSync as JE}from"child_process";import vr from"node:process";var Hc=(t=0)=>e=>`\x1B[${e+t}m`,Lc=(t=0)=>e=>`\x1B[${38+t};5;${e}m`,_c=(t=0)=>(e,i,n)=>`\x1B[${38+t};2;${e};${i};${n}m`,S={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,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]}},Z9=Object.keys(S.modifier),e7=Object.keys(S.color),t7=Object.keys(S.bgColor),P9=[...e7,...t7];function i7(){let t=new Map;for(let[e,i]of Object.entries(S)){for(let[n,r]of Object.entries(i))S[n]={open:`\x1B[${r[0]}m`,close:`\x1B[${r[1]}m`},i[n]=S[n],t.set(r[0],r[1]);Object.defineProperty(S,e,{value:i,enumerable:!1})}return Object.defineProperty(S,"codes",{value:t,enumerable:!1}),S.color.close="\x1B[39m",S.bgColor.close="\x1B[49m",S.color.ansi=Hc(),S.color.ansi256=Lc(),S.color.ansi16m=_c(),S.bgColor.ansi=Hc(10),S.bgColor.ansi256=Lc(10),S.bgColor.ansi16m=_c(10),Object.defineProperties(S,{rgbToAnsi256:{value(e,i,n){return e===i&&i===n?e<8?16:e>248?231:Math.round((e-8)/247*24)+232:16+36*Math.round(e/255*5)+6*Math.round(i/255*5)+Math.round(n/255*5)},enumerable:!1},hexToRgb:{value(e){let i=/[a-f\d]{6}|[a-f\d]{3}/i.exec(e.toString(16));if(!i)return[0,0,0];let[n]=i;n.length===3&&(n=[...n].map(o=>o+o).join(""));let r=Number.parseInt(n,16);return[r>>16&255,r>>8&255,r&255]},enumerable:!1},hexToAnsi256:{value:e=>S.rgbToAnsi256(...S.hexToRgb(e)),enumerable:!1},ansi256ToAnsi:{value(e){if(e<8)return 30+e;if(e<16)return 90+(e-8);let i,n,r;if(e>=232)i=((e-232)*10+8)/255,n=i,r=i;else{e-=16;let c=e%36;i=Math.floor(e/36)/5,n=Math.floor(c/6)/5,r=c%6/5}let o=Math.max(i,n,r)*2;if(o===0)return 30;let s=30+(Math.round(r)<<2|Math.round(n)<<1|Math.round(i));return o===2&&(s+=60),s},enumerable:!1},rgbToAnsi:{value:(e,i,n)=>S.ansi256ToAnsi(S.rgbToAnsi256(e,i,n)),enumerable:!1},hexToAnsi:{value:e=>S.ansi256ToAnsi(S.hexToAnsi256(e)),enumerable:!1}}),S}var n7=i7(),Re=n7;import vs from"node:process";import r7 from"node:os";import $c from"node:tty";function ue(t,e=globalThis.Deno?globalThis.Deno.args:vs.argv){let i=t.startsWith("-")?"":t.length===1?"-":"--",n=e.indexOf(i+t),r=e.indexOf("--");return n!==-1&&(r===-1||n<r)}var{env:Y}=vs,ir;ue("no-color")||ue("no-colors")||ue("color=false")||ue("color=never")?ir=0:(ue("color")||ue("colors")||ue("color=true")||ue("color=always"))&&(ir=1);function o7(){if("FORCE_COLOR"in Y)return Y.FORCE_COLOR==="true"?1:Y.FORCE_COLOR==="false"?0:Y.FORCE_COLOR.length===0?1:Math.min(Number.parseInt(Y.FORCE_COLOR,10),3)}function s7(t){return t===0?!1:{level:t,hasBasic:!0,has256:t>=2,has16m:t>=3}}function a7(t,{streamIsTTY:e,sniffFlags:i=!0}={}){let n=o7();n!==void 0&&(ir=n);let r=i?ir:n;if(r===0)return 0;if(i){if(ue("color=16m")||ue("color=full")||ue("color=truecolor"))return 3;if(ue("color=256"))return 2}if("TF_BUILD"in Y&&"AGENT_NAME"in Y)return 1;if(t&&!e&&r===void 0)return 0;let o=r||0;if(Y.TERM==="dumb")return o;if(vs.platform==="win32"){let s=r7.release().split(".");return Number(s[0])>=10&&Number(s[2])>=10586?Number(s[2])>=14931?3:2:1}if("CI"in Y)return["GITHUB_ACTIONS","GITEA_ACTIONS","CIRCLECI"].some(s=>s in Y)?3:["TRAVIS","APPVEYOR","GITLAB_CI","BUILDKITE","DRONE"].some(s=>s in Y)||Y.CI_NAME==="codeship"?1:o;if("TEAMCITY_VERSION"in Y)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(Y.TEAMCITY_VERSION)?1:0;if(Y.COLORTERM==="truecolor"||Y.TERM==="xterm-kitty"||Y.TERM==="xterm-ghostty"||Y.TERM==="wezterm")return 3;if("TERM_PROGRAM"in Y){let s=Number.parseInt((Y.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(Y.TERM_PROGRAM){case"iTerm.app":return s>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(Y.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(Y.TERM)||"COLORTERM"in Y?1:o}function el(t,e={}){let i=a7(t,{streamIsTTY:t&&t.isTTY,...e});return s7(i)}var c7={stdout:el({isTTY:$c.isatty(1)}),stderr:el({isTTY:$c.isatty(2)})},tl=c7;function il(t,e,i){let n=t.indexOf(e);if(n===-1)return t;let r=e.length,o=0,s="";do s+=t.slice(o,n)+e+i,o=n+r,n=t.indexOf(e,o);while(n!==-1);return s+=t.slice(o),s}function nl(t,e,i,n){let r=0,o="";do{let s=t[n-1]==="\r";o+=t.slice(r,s?n-1:n)+e+(s?`\r
10
10
  `:`
11
11
  `)+i,r=n+1,n=t.indexOf(`
12
- `,r)}while(n!==-1);return o+=t.slice(r),o}var{stdout:qc,stderr:Dc}=Zc,$o=Symbol("GENERATOR"),li=Symbol("STYLER"),Di=Symbol("IS_EMPTY"),yc=["ansi","ansi","ansi256","ansi16m"],vi=Object.create(null),PA=(t,e={})=>{if(e.level&&!(Number.isInteger(e.level)&&e.level>=0&&e.level<=3))throw new Error("The `level` option should be an integer from 0 to 3");let i=qc?qc.level:0;t.level=e.level===void 0?i:e.level};var qA=t=>{let e=(...i)=>i.join(" ");return PA(e,t),Object.setPrototypeOf(e,yi.prototype),e};function yi(t){return qA(t)}Object.setPrototypeOf(yi.prototype,Function.prototype);for(let[t,e]of Object.entries(pe))vi[t]={get(){let i=Hn(this,ta(e.open,e.close,this[li]),this[Di]);return Object.defineProperty(this,t,{value:i}),i}};vi.visible={get(){let t=Hn(this,this[li],!0);return Object.defineProperty(this,"visible",{value:t}),t}};var ea=(t,e,i,...n)=>t==="rgb"?e==="ansi16m"?pe[i].ansi16m(...n):e==="ansi256"?pe[i].ansi256(pe.rgbToAnsi256(...n)):pe[i].ansi(pe.rgbToAnsi(...n)):t==="hex"?ea("rgb",e,i,...pe.hexToRgb(...n)):pe[i][t](...n),DA=["rgb","hex","ansi256"];for(let t of DA){vi[t]={get(){let{level:i}=this;return function(...n){let r=ta(ea(t,yc[i],"color",...n),pe.color.close,this[li]);return Hn(this,r,this[Di])}}};let e="bg"+t[0].toUpperCase()+t.slice(1);vi[e]={get(){let{level:i}=this;return function(...n){let r=ta(ea(t,yc[i],"bgColor",...n),pe.bgColor.close,this[li]);return Hn(this,r,this[Di])}}}}var yA=Object.defineProperties(()=>{},{...vi,level:{enumerable:!0,get(){return this[$o].level},set(t){this[$o].level=t}}}),ta=(t,e,i)=>{let n,r;return i===void 0?(n=t,r=e):(n=i.openAll+t,r=e+i.closeAll),{open:t,close:e,openAll:n,closeAll:r,parent:i}},Hn=(t,e,i)=>{let n=(...r)=>wA(n,r.length===1?""+r[0]:r.join(" "));return Object.setPrototypeOf(n,yA),n[$o]=t,n[li]=e,n[Di]=i,n},wA=(t,e)=>{if(t.level<=0||!e)return t[Di]?"":e;let i=t[li];if(i===void 0)return e;let{openAll:n,closeAll:r}=i;if(e.includes("\x1B"))for(;i!==void 0;)e=bc(e,i.close,i.open),i=i.parent;let o=e.indexOf(`
13
- `);return o!==-1&&(e=Pc(e,r,n,o)),n+e+r};Object.defineProperties(yi.prototype,vi);var TA=yi(),sp=yi({level:Dc?Dc.level:0});var he=TA;import _c from"node:process";import er from"node:process";var XA=(t,e,i,n)=>{if(i==="length"||i==="prototype"||i==="arguments"||i==="caller")return;let r=Object.getOwnPropertyDescriptor(t,i),o=Object.getOwnPropertyDescriptor(e,i);!HA(r,o)&&n||Object.defineProperty(t,i,o)},HA=function(t,e){return t===void 0||t.configurable||t.writable===e.writable&&t.enumerable===e.enumerable&&t.configurable===e.configurable&&(t.writable||t.value===e.value)},LA=(t,e)=>{let i=Object.getPrototypeOf(e);i!==Object.getPrototypeOf(t)&&Object.setPrototypeOf(t,i)},_A=(t,e)=>`/* Wrapped ${t}*/
14
- ${e}`,$A=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),e7=Object.getOwnPropertyDescriptor(Function.prototype.toString,"name"),t7=(t,e,i)=>{let n=i===""?"":`with ${i.trim()}() `,r=_A.bind(null,n,e.toString());Object.defineProperty(r,"name",e7);let{writable:o,enumerable:a,configurable:c}=$A;Object.defineProperty(t,"toString",{value:r,writable:o,enumerable:a,configurable:c})};function ia(t,e,{ignoreNonConfigurable:i=!1}={}){let{name:n}=t;for(let r of Reflect.ownKeys(e))XA(t,e,r,i);return LA(t,e),t7(t,e,n),t}var Ln=new WeakMap,wc=(t,e={})=>{if(typeof t!="function")throw new TypeError("Expected a function");let i,n=0,r=t.displayName||t.name||"<anonymous>",o=function(...a){if(Ln.set(o,++n),n===1)i=t.apply(this,a),t=void 0;else if(e.throw===!0)throw new Error(`Function \`${r}\` can only be called once`);return i};return ia(o,t),Ln.set(o,n),o};wc.callCount=t=>{if(!Ln.has(t))throw new Error(`The given function \`${t.name}\` is not wrapped by the \`onetime\` package`);return Ln.get(t)};var Tc=wc;var Kt=[];Kt.push("SIGHUP","SIGINT","SIGTERM");process.platform!=="win32"&&Kt.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&Kt.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT");var _n=t=>!!t&&typeof t=="object"&&typeof t.removeListener=="function"&&typeof t.emit=="function"&&typeof t.reallyExit=="function"&&typeof t.listeners=="function"&&typeof t.kill=="function"&&typeof t.pid=="number"&&typeof t.on=="function",na=Symbol.for("signal-exit emitter"),ra=globalThis,i7=Object.defineProperty.bind(Object),oa=class{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(ra[na])return ra[na];i7(ra,na,{value:this,writable:!1,enumerable:!1,configurable:!1})}on(e,i){this.listeners[e].push(i)}removeListener(e,i){let n=this.listeners[e],r=n.indexOf(i);r!==-1&&(r===0&&n.length===1?n.length=0:n.splice(r,1))}emit(e,i,n){if(this.emitted[e])return!1;this.emitted[e]=!0;let r=!1;for(let o of this.listeners[e])r=o(i,n)===!0||r;return e==="exit"&&(r=this.emit("afterExit",i,n)||r),r}},$n=class{},n7=t=>({onExit(e,i){return t.onExit(e,i)},load(){return t.load()},unload(){return t.unload()}}),aa=class extends $n{onExit(){return()=>{}}load(){}unload(){}},sa=class extends $n{#e=ca.platform==="win32"?"SIGINT":"SIGHUP";#n=new oa;#i;#r;#s;#t={};#o=!1;constructor(e){super(),this.#i=e,this.#t={};for(let i of Kt)this.#t[i]=()=>{let n=this.#i.listeners(i),{count:r}=this.#n,o=e;if(typeof o.__signal_exit_emitter__=="object"&&typeof o.__signal_exit_emitter__.count=="number"&&(r+=o.__signal_exit_emitter__.count),n.length===r){this.unload();let a=this.#n.emit("exit",null,i),c=i==="SIGHUP"?this.#e:i;a||e.kill(e.pid,c)}};this.#s=e.reallyExit,this.#r=e.emit}onExit(e,i){if(!_n(this.#i))return()=>{};this.#o===!1&&this.load();let n=i?.alwaysLast?"afterExit":"exit";return this.#n.on(n,e),()=>{this.#n.removeListener(n,e),this.#n.listeners.exit.length===0&&this.#n.listeners.afterExit.length===0&&this.unload()}}load(){if(!this.#o){this.#o=!0,this.#n.count+=1;for(let e of Kt)try{let i=this.#t[e];i&&this.#i.on(e,i)}catch{}this.#i.emit=(e,...i)=>this.#u(e,...i),this.#i.reallyExit=e=>this.#a(e)}}unload(){this.#o&&(this.#o=!1,Kt.forEach(e=>{let i=this.#t[e];if(!i)throw new Error("Listener not defined for signal: "+e);try{this.#i.removeListener(e,i)}catch{}}),this.#i.emit=this.#r,this.#i.reallyExit=this.#s,this.#n.count-=1)}#a(e){return _n(this.#i)?(this.#i.exitCode=e||0,this.#n.emit("exit",this.#i.exitCode,null),this.#s.call(this.#i,this.#i.exitCode)):0}#u(e,...i){let n=this.#r;if(e==="exit"&&_n(this.#i)){typeof i[0]=="number"&&(this.#i.exitCode=i[0]);let r=n.call(this.#i,e,...i);return this.#n.emit("exit",this.#i.exitCode,null),r}else return n.call(this.#i,e,...i)}},ca=globalThis.process,{onExit:Xc,load:Ep,unload:Ip}=n7(_n(ca)?new sa(ca):new aa);var Hc=er.stderr.isTTY?er.stderr:er.stdout.isTTY?er.stdout:void 0,r7=Hc?Tc(()=>{Xc(()=>{Hc.write("\x1B[?25h")},{alwaysLast:!0})}):()=>{},Lc=r7;var tr=!1,Ai={};Ai.show=(t=_c.stderr)=>{t.isTTY&&(tr=!1,t.write("\x1B[?25h"))};Ai.hide=(t=_c.stderr)=>{t.isTTY&&(Lc(),tr=!0,t.write("\x1B[?25l"))};Ai.toggle=(t,e)=>{t!==void 0&&(tr=t),tr?Ai.show(e):Ai.hide(e)};var la=Ai;var Xi=Dn(va(),1);import fe from"node:process";function Aa(){return fe.platform!=="win32"?fe.env.TERM!=="linux":!!fe.env.CI||!!fe.env.WT_SESSION||!!fe.env.TERMINUS_SUBLIME||fe.env.ConEmuTask==="{cmd::Cmder}"||fe.env.TERM_PROGRAM==="Terminus-Sublime"||fe.env.TERM_PROGRAM==="vscode"||fe.env.TERM==="xterm-256color"||fe.env.TERM==="alacritty"||fe.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var a7={info:he.blue("\u2139"),success:he.green("\u2714"),warning:he.yellow("\u26A0"),error:he.red("\u2716")},s7={info:he.blue("i"),success:he.green("\u221A"),warning:he.yellow("\u203C"),error:he.red("\xD7")},c7=Aa()?a7:s7,wi=c7;function ma({onlyFirst:t=!1}={}){let r="(?:\\u001B\\][\\s\\S]*?(?:\\u0007|\\u001B\\u005C|\\u009C))|[\\u001B\\u009B][[\\]()#;?]*(?:\\d{1,4}(?:[;:]\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]";return new RegExp(r,t?void 0:"g")}var l7=ma();function Ti(t){if(typeof t!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof t}\``);return t.replace(l7,"")}function il(t){return t===161||t===164||t===167||t===168||t===170||t===173||t===174||t>=176&&t<=180||t>=182&&t<=186||t>=188&&t<=191||t===198||t===208||t===215||t===216||t>=222&&t<=225||t===230||t>=232&&t<=234||t===236||t===237||t===240||t===242||t===243||t>=247&&t<=250||t===252||t===254||t===257||t===273||t===275||t===283||t===294||t===295||t===299||t>=305&&t<=307||t===312||t>=319&&t<=322||t===324||t>=328&&t<=331||t===333||t===338||t===339||t===358||t===359||t===363||t===462||t===464||t===466||t===468||t===470||t===472||t===474||t===476||t===593||t===609||t===708||t===711||t>=713&&t<=715||t===717||t===720||t>=728&&t<=731||t===733||t===735||t>=768&&t<=879||t>=913&&t<=929||t>=931&&t<=937||t>=945&&t<=961||t>=963&&t<=969||t===1025||t>=1040&&t<=1103||t===1105||t===8208||t>=8211&&t<=8214||t===8216||t===8217||t===8220||t===8221||t>=8224&&t<=8226||t>=8228&&t<=8231||t===8240||t===8242||t===8243||t===8245||t===8251||t===8254||t===8308||t===8319||t>=8321&&t<=8324||t===8364||t===8451||t===8453||t===8457||t===8467||t===8470||t===8481||t===8482||t===8486||t===8491||t===8531||t===8532||t>=8539&&t<=8542||t>=8544&&t<=8555||t>=8560&&t<=8569||t===8585||t>=8592&&t<=8601||t===8632||t===8633||t===8658||t===8660||t===8679||t===8704||t===8706||t===8707||t===8711||t===8712||t===8715||t===8719||t===8721||t===8725||t===8730||t>=8733&&t<=8736||t===8739||t===8741||t>=8743&&t<=8748||t===8750||t>=8756&&t<=8759||t===8764||t===8765||t===8776||t===8780||t===8786||t===8800||t===8801||t>=8804&&t<=8807||t===8810||t===8811||t===8814||t===8815||t===8834||t===8835||t===8838||t===8839||t===8853||t===8857||t===8869||t===8895||t===8978||t>=9312&&t<=9449||t>=9451&&t<=9547||t>=9552&&t<=9587||t>=9600&&t<=9615||t>=9618&&t<=9621||t===9632||t===9633||t>=9635&&t<=9641||t===9650||t===9651||t===9654||t===9655||t===9660||t===9661||t===9664||t===9665||t>=9670&&t<=9672||t===9675||t>=9678&&t<=9681||t>=9698&&t<=9701||t===9711||t===9733||t===9734||t===9737||t===9742||t===9743||t===9756||t===9758||t===9792||t===9794||t===9824||t===9825||t>=9827&&t<=9829||t>=9831&&t<=9834||t===9836||t===9837||t===9839||t===9886||t===9887||t===9919||t>=9926&&t<=9933||t>=9935&&t<=9939||t>=9941&&t<=9953||t===9955||t===9960||t===9961||t>=9963&&t<=9969||t===9972||t>=9974&&t<=9977||t===9979||t===9980||t===9982||t===9983||t===10045||t>=10102&&t<=10111||t>=11094&&t<=11097||t>=12872&&t<=12879||t>=57344&&t<=63743||t>=65024&&t<=65039||t===65533||t>=127232&&t<=127242||t>=127248&&t<=127277||t>=127280&&t<=127337||t>=127344&&t<=127373||t===127375||t===127376||t>=127387&&t<=127404||t>=917760&&t<=917999||t>=983040&&t<=1048573||t>=1048576&&t<=1114109}function nl(t){return t===12288||t>=65281&&t<=65376||t>=65504&&t<=65510}function rl(t){return t>=4352&&t<=4447||t===8986||t===8987||t===9001||t===9002||t>=9193&&t<=9196||t===9200||t===9203||t===9725||t===9726||t===9748||t===9749||t>=9776&&t<=9783||t>=9800&&t<=9811||t===9855||t>=9866&&t<=9871||t===9875||t===9889||t===9898||t===9899||t===9917||t===9918||t===9924||t===9925||t===9934||t===9940||t===9962||t===9970||t===9971||t===9973||t===9978||t===9981||t===9989||t===9994||t===9995||t===10024||t===10060||t===10062||t>=10067&&t<=10069||t===10071||t>=10133&&t<=10135||t===10160||t===10175||t===11035||t===11036||t===11088||t===11093||t>=11904&&t<=11929||t>=11931&&t<=12019||t>=12032&&t<=12245||t>=12272&&t<=12287||t>=12289&&t<=12350||t>=12353&&t<=12438||t>=12441&&t<=12543||t>=12549&&t<=12591||t>=12593&&t<=12686||t>=12688&&t<=12773||t>=12783&&t<=12830||t>=12832&&t<=12871||t>=12880&&t<=42124||t>=42128&&t<=42182||t>=43360&&t<=43388||t>=44032&&t<=55203||t>=63744&&t<=64255||t>=65040&&t<=65049||t>=65072&&t<=65106||t>=65108&&t<=65126||t>=65128&&t<=65131||t>=94176&&t<=94180||t>=94192&&t<=94198||t>=94208&&t<=101589||t>=101631&&t<=101662||t>=101760&&t<=101874||t>=110576&&t<=110579||t>=110581&&t<=110587||t===110589||t===110590||t>=110592&&t<=110882||t===110898||t>=110928&&t<=110930||t===110933||t>=110948&&t<=110951||t>=110960&&t<=111355||t>=119552&&t<=119638||t>=119648&&t<=119670||t===126980||t===127183||t===127374||t>=127377&&t<=127386||t>=127488&&t<=127490||t>=127504&&t<=127547||t>=127552&&t<=127560||t===127568||t===127569||t>=127584&&t<=127589||t>=127744&&t<=127776||t>=127789&&t<=127797||t>=127799&&t<=127868||t>=127870&&t<=127891||t>=127904&&t<=127946||t>=127951&&t<=127955||t>=127968&&t<=127984||t===127988||t>=127992&&t<=128062||t===128064||t>=128066&&t<=128252||t>=128255&&t<=128317||t>=128331&&t<=128334||t>=128336&&t<=128359||t===128378||t===128405||t===128406||t===128420||t>=128507&&t<=128591||t>=128640&&t<=128709||t===128716||t>=128720&&t<=128722||t>=128725&&t<=128728||t>=128732&&t<=128735||t===128747||t===128748||t>=128756&&t<=128764||t>=128992&&t<=129003||t===129008||t>=129292&&t<=129338||t>=129340&&t<=129349||t>=129351&&t<=129535||t>=129648&&t<=129660||t>=129664&&t<=129674||t>=129678&&t<=129734||t===129736||t>=129741&&t<=129756||t>=129759&&t<=129770||t>=129775&&t<=129784||t>=131072&&t<=196605||t>=196608&&t<=262141}function v7(t){if(!Number.isSafeInteger(t))throw new TypeError(`Expected a code point, got \`${typeof t}\`.`)}function ol(t,{ambiguousAsWide:e=!1}={}){return v7(t),nl(t)||rl(t)||e&&il(t)?2:1}var cl=Dn(sl(),1),A7=new Intl.Segmenter,m7=new RegExp("^\\p{Default_Ignorable_Code_Point}$","u");function ua(t,e={}){if(typeof t!="string"||t.length===0)return 0;let{ambiguousIsNarrow:i=!0,countAnsiEscapeCodes:n=!1}=e;if(n||(t=Ti(t)),t.length===0)return 0;let r=0,o={ambiguousAsWide:!i};for(let{segment:a}of A7.segment(t)){let c=a.codePointAt(0);if(!(c<=31||c>=127&&c<=159)&&!(c>=8203&&c<=8207||c===65279)&&!(c>=768&&c<=879||c>=6832&&c<=6911||c>=7616&&c<=7679||c>=8400&&c<=8447||c>=65056&&c<=65071)&&!(c>=55296&&c<=57343)&&!(c>=65024&&c<=65039)&&!m7.test(a)){if((0,cl.default)().test(a)){r+=2;continue}r+=ol(c,o)}}return r}function Ea({stream:t=process.stdout}={}){return!!(t&&t.isTTY&&process.env.TERM!=="dumb"&&!("CI"in process.env))}import ll from"node:process";function Ia(){let{env:t}=ll,{TERM:e,TERM_PROGRAM:i}=t;return ll.platform!=="win32"?e!=="linux":!!t.WT_SESSION||!!t.TERMINUS_SUBLIME||t.ConEmuTask==="{cmd::Cmder}"||i==="Terminus-Sublime"||i==="vscode"||e==="xterm-256color"||e==="alacritty"||e==="rxvt-unicode"||e==="rxvt-unicode-256color"||t.TERMINAL_EMULATOR==="JetBrains-JediTerm"}import Me from"node:process";var u7=3,pa=class{#e=0;start(){this.#e++,this.#e===1&&this.#n()}stop(){if(this.#e<=0)throw new Error("`stop` called more times than `start`");this.#e--,this.#e===0&&this.#i()}#n(){Me.platform==="win32"||!Me.stdin.isTTY||(Me.stdin.setRawMode(!0),Me.stdin.on("data",this.#r),Me.stdin.resume())}#i(){Me.stdin.isTTY&&(Me.stdin.off("data",this.#r),Me.stdin.pause(),Me.stdin.setRawMode(!1))}#r(e){e[0]===u7&&Me.emit("SIGINT")}},E7=new pa,ha=E7;var I7=Dn(va(),1),fa=class{#e=0;#n=!1;#i=0;#r=-1;#s=0;#t;#o;#a;#u;#I;#v;#A;#m;#p;#c;#l;color;constructor(e){typeof e=="string"&&(e={text:e}),this.#t={color:"cyan",stream:nr.stderr,discardStdin:!0,hideCursor:!0,...e},this.color=this.#t.color,this.spinner=this.#t.spinner,this.#I=this.#t.interval,this.#a=this.#t.stream,this.#v=typeof this.#t.isEnabled=="boolean"?this.#t.isEnabled:Ea({stream:this.#a}),this.#A=typeof this.#t.isSilent=="boolean"?this.#t.isSilent:!1,this.text=this.#t.text,this.prefixText=this.#t.prefixText,this.suffixText=this.#t.suffixText,this.indent=this.#t.indent,nr.env.NODE_ENV==="test"&&(this._stream=this.#a,this._isEnabled=this.#v,Object.defineProperty(this,"_linesToClear",{get(){return this.#e},set(i){this.#e=i}}),Object.defineProperty(this,"_frameIndex",{get(){return this.#r}}),Object.defineProperty(this,"_lineCount",{get(){return this.#i}}))}get indent(){return this.#m}set indent(e=0){if(!(e>=0&&Number.isInteger(e)))throw new Error("The `indent` option must be an integer from 0 and up");this.#m=e,this.#E()}get interval(){return this.#I??this.#o.interval??100}get spinner(){return this.#o}set spinner(e){if(this.#r=-1,this.#I=void 0,typeof e=="object"){if(e.frames===void 0)throw new Error("The given spinner must have a `frames` property");this.#o=e}else if(!Ia())this.#o=Xi.default.line;else if(e===void 0)this.#o=Xi.default.dots;else if(e!=="default"&&Xi.default[e])this.#o=Xi.default[e];else throw new Error(`There is no built-in spinner named '${e}'. See https://github.com/sindresorhus/cli-spinners/blob/main/spinners.json for a full list.`)}get text(){return this.#p}set text(e=""){this.#p=e,this.#E()}get prefixText(){return this.#c}set prefixText(e=""){this.#c=e,this.#E()}get suffixText(){return this.#l}set suffixText(e=""){this.#l=e,this.#E()}get isSpinning(){return this.#u!==void 0}#h(e=this.#c,i=" "){return typeof e=="string"&&e!==""?e+i:typeof e=="function"?e()+i:""}#f(e=this.#l,i=" "){return typeof e=="string"&&e!==""?i+e:typeof e=="function"?i+e():""}#E(){let e=this.#a.columns??80,i=this.#h(this.#c,"-"),n=this.#f(this.#l,"-"),r=" ".repeat(this.#m)+i+"--"+this.#p+"--"+n;this.#i=0;for(let o of Ti(r).split(`
15
- `))this.#i+=Math.max(1,Math.ceil(ua(o,{countAnsiEscapeCodes:!0})/e))}get isEnabled(){return this.#v&&!this.#A}set isEnabled(e){if(typeof e!="boolean")throw new TypeError("The `isEnabled` option must be a boolean");this.#v=e}get isSilent(){return this.#A}set isSilent(e){if(typeof e!="boolean")throw new TypeError("The `isSilent` option must be a boolean");this.#A=e}frame(){let e=Date.now();(this.#r===-1||e-this.#s>=this.interval)&&(this.#r=++this.#r%this.#o.frames.length,this.#s=e);let{frames:i}=this.#o,n=i[this.#r];this.color&&(n=he[this.color](n));let r=typeof this.#c=="string"&&this.#c!==""?this.#c+" ":"",o=typeof this.text=="string"?" "+this.text:"",a=typeof this.#l=="string"&&this.#l!==""?" "+this.#l:"";return r+n+o+a}clear(){if(!this.#v||!this.#a.isTTY)return this;this.#a.cursorTo(0);for(let e=0;e<this.#e;e++)e>0&&this.#a.moveCursor(0,-1),this.#a.clearLine(1);return(this.#m||this.lastIndent!==this.#m)&&this.#a.cursorTo(this.#m),this.lastIndent=this.#m,this.#e=0,this}render(){return this.#A?this:(this.clear(),this.#a.write(this.frame()),this.#e=this.#i,this)}start(e){return e&&(this.text=e),this.#A?this:this.#v?this.isSpinning?this:(this.#t.hideCursor&&la.hide(this.#a),this.#t.discardStdin&&nr.stdin.isTTY&&(this.#n=!0,ha.start()),this.render(),this.#u=setInterval(this.render.bind(this),this.interval),this):(this.text&&this.#a.write(`- ${this.text}
16
- `),this)}stop(){return this.#v?(clearInterval(this.#u),this.#u=void 0,this.#r=0,this.clear(),this.#t.hideCursor&&la.show(this.#a),this.#t.discardStdin&&nr.stdin.isTTY&&this.#n&&(ha.stop(),this.#n=!1),this):this}succeed(e){return this.stopAndPersist({symbol:wi.success,text:e})}fail(e){return this.stopAndPersist({symbol:wi.error,text:e})}warn(e){return this.stopAndPersist({symbol:wi.warning,text:e})}info(e){return this.stopAndPersist({symbol:wi.info,text:e})}stopAndPersist(e={}){if(this.#A)return this;let i=e.prefixText??this.#c,n=this.#h(i," "),r=e.symbol??" ",o=e.text??this.text,c=typeof o=="string"?(r?" ":"")+o:"",l=e.suffixText??this.#l,v=this.#f(l," "),A=n+r+c+v+`
17
- `;return this.stop(),this.#a.write(A),this}};function Ze(t){return new fa(t)}import{existsSync as ul,readFileSync as d7,writeFileSync as j7,mkdirSync as g7}from"fs";import{dirname as x7}from"path";import{homedir as vl}from"os";import{join as D}from"path";var p7=D(vl(),".gemkit"),za=D(p7,"projects"),Ra=D(vl(),".gemini"),oh=D(Ra,"config"),mi=D(Ra,"cache"),ah=D(Ra,"tmp"),ui=".gemini";var h7="plans",f7=".gk.json",z7="metadata.json",R7=".env";function rr(t=process.cwd()){return D(t,ui)}function da(t=process.cwd()){return D(t,ui,f7)}function ja(t=process.cwd()){return D(t,ui,z7)}function Vt(t=process.cwd()){return D(t,ui,R7)}function Hi(t=process.cwd()){return D(t,ui,"agents")}function Nt(t=process.cwd()){return D(t,ui,"extensions")}function Ei(t=process.cwd()){return D(t,h7)}function Li(t){return t?t.replace(/^[A-Za-z]:/,e=>e.replace(":","")).replace(/[\\/]+/g,"-").replace(/[^a-zA-Z0-9-]/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,""):""}function be(t){return D(za,t)}function kt(t,e){return D(be(t),`gk-session-${e}.json`)}function _i(t,e){return D(be(t),`gk-project-${e}.json`)}var ze={defaultScope:"local",github:{repo:"therichardngai-code/gemkit-kits-starter",apiUrl:"https://api.github.com"},cache:{enabled:!0,ttl:3600},installation:{excludePatterns:[],backupOnUpdate:!0},ui:{colors:!0,spinner:!0,verbose:!1},paths:{},spawn:{defaultModel:"gemini-2.5-flash",music:!1},office:{enabled:!0,mode:"web",port:3847,autoOpen:!0,sounds:!1,refreshRate:500}};function Al(t){return!(!t||typeof t!="object")}function ml(t){return{...ze,...t,github:{...ze.github,...t.github||{}},cache:{...ze.cache,...t.cache||{}},installation:{...ze.installation,...t.installation||{}},ui:{...ze.ui,...t.ui||{}},paths:{...ze.paths,...t.paths||{}},spawn:{...ze.spawn,...t.spawn||{}},office:{...ze.office,...t.office||{}}}}var or=class extends Error{constructor(i,n="GEMKIT_ERROR",r){super(i);this.code=n;this.details=r;this.name="GemKitError"}},Ft=class extends or{constructor(e,i){super(e,"CONFIG_ERROR",i),this.name="ConfigError"}};var Ae=class extends or{constructor(e,i){super(e,"GITHUB_ERROR",i),this.name="GitHubError"}};function ct(t){let e=da(t);if(!ul(e))return ze;try{let i=d7(e,"utf-8"),n=JSON.parse(i);if(!Al(n))throw new Ft("Invalid configuration format");return ml(n)}catch(i){throw i instanceof Ft?i:new Ft(`Failed to load config: ${i}`)}}function El(t,e){let i=da(e),n=x7(i);ul(n)||g7(n,{recursive:!0}),j7(i,JSON.stringify(t,null,2))}function Il(t,e){let i=ct(e),n=t.split("."),r=i;for(let o of n)if(r&&typeof r=="object"&&o in r)r=r[o];else return;return r}function pl(t,e,i){let n=ct(i),r=t.split("."),o=r.pop();if(!o)throw new Ft("Invalid config path");let a=n;for(let c of r)(!(c in a)||typeof a[c]!="object")&&(a[c]={}),a=a[c];a[o]=e,El(n,i)}function hl(t){El(ze,t)}import{existsSync as fl,readFileSync as G7,writeFileSync as S7,mkdirSync as Y7,readdirSync as zl,unlinkSync as Rl,statSync as W7}from"fs";import{join as ga}from"path";function xa(){return fl(mi)||Y7(mi,{recursive:!0}),mi}function dl(t){let e=t.replace(/[^a-zA-Z0-9-_]/g,"_");return ga(xa(),`${e}.json`)}function jl(t){let e=dl(t);if(!fl(e))return null;try{let i=G7(e,"utf-8"),n=JSON.parse(i);return Date.now()-n.timestamp>n.ttl*1e3?(Rl(e),null):n.data}catch{return null}}function gl(t,e,i=3600){let n=dl(t),r={key:t,data:e,timestamp:Date.now(),ttl:i};S7(n,JSON.stringify(r,null,2))}function xl(){let t=xa(),e=zl(t).filter(i=>i.endsWith(".json"));for(let i of e)Rl(ga(t,i));return e.length}function Gl(){let t=xa(),e=zl(t).filter(n=>n.endsWith(".json")),i=0;for(let n of e){let r=W7(ga(t,n));i+=r.size}return{entries:e.length,size:i}}var Sl="github-releases",M7=300;async function ar(t=10){let e=jl(Sl);if(e)return e.slice(0,t);let i=ct(),{repo:n,apiUrl:r}=i.github,o=`${r}/repos/${n}/releases?per_page=${t}`;try{let a=await fetch(o,{headers:{Accept:"application/vnd.github.v3+json","User-Agent":"gemkit-cli"}});if(!a.ok)throw new Ae(`Failed to fetch releases: ${a.status}`);let l=(await a.json()).map(v=>({version:v.tag_name.replace(/^v/,""),tag:v.tag_name,publishedAt:v.published_at,prerelease:v.prerelease,assets:v.assets.map(A=>({name:A.name,url:A.url,size:A.size,downloadUrl:A.browser_download_url}))}));return gl(Sl,l,M7),l}catch(a){throw a instanceof Ae?a:new Ae(`Failed to fetch releases: ${a}`)}}async function Ii(){let t=await ar(1);return t.length>0?t[0]:null}async function Yl(t){return(await ar(50)).find(i=>i.version===t||i.tag===t)||null}import{createWriteStream as C7,existsSync as O7,mkdirSync as U7}from"fs";import{pipeline as K7}from"stream/promises";import{join as V7}from"path";async function N7(t,e=mi){O7(e)||U7(e,{recursive:!0});let i=V7(e,t.name);try{let n=await fetch(t.downloadUrl,{headers:{"User-Agent":"gemkit-cli"}});if(!n.ok)throw new Ae(`Failed to download asset: ${n.status}`);if(!n.body)throw new Ae("No response body");let r=C7(i);return await K7(n.body,r),i}catch(n){throw n instanceof Ae?n:new Ae(`Download failed: ${n}`)}}async function pi(t){let e=t.assets.find(i=>i.name.endsWith(".tar.gz")||i.name.endsWith(".tgz"));if(!e)throw new Ae("No tarball asset found in release");return N7(e)}import{createReadStream as Bu,createWriteStream as pR,existsSync as q3,mkdirSync as Zu}from"fs";import{pipeline as bu}from"stream/promises";import{createGunzip as Pu}from"zlib";import y7 from"events";import ee from"fs";import{EventEmitter as Oa}from"node:events";import Ul from"node:stream";import{StringDecoder as k7}from"node:string_decoder";var Wl=typeof process=="object"&&process?process:{stdout:null,stderr:null},F7=t=>!!t&&typeof t=="object"&&(t instanceof rn||t instanceof Ul||Q7(t)||J7(t)),Q7=t=>!!t&&typeof t=="object"&&t instanceof Oa&&typeof t.pipe=="function"&&t.pipe!==Ul.Writable.prototype.pipe,J7=t=>!!t&&typeof t=="object"&&t instanceof Oa&&typeof t.write=="function"&&typeof t.end=="function",Pe=Symbol("EOF"),qe=Symbol("maybeEmitEnd"),lt=Symbol("emittedEnd"),sr=Symbol("emittingEnd"),$i=Symbol("emittedError"),cr=Symbol("closed"),Ml=Symbol("read"),lr=Symbol("flush"),Cl=Symbol("flushChunk"),Re=Symbol("encoding"),hi=Symbol("decoder"),k=Symbol("flowing"),en=Symbol("paused"),fi=Symbol("resume"),F=Symbol("buffer"),L=Symbol("pipes"),Q=Symbol("bufferLength"),Ga=Symbol("bufferPush"),vr=Symbol("bufferShift"),y=Symbol("objectMode"),C=Symbol("destroyed"),Sa=Symbol("error"),Ya=Symbol("emitData"),Ol=Symbol("emitEnd"),Wa=Symbol("emitEnd2"),Ce=Symbol("async"),Ma=Symbol("abort"),Ar=Symbol("aborted"),tn=Symbol("signal"),Qt=Symbol("dataListeners"),te=Symbol("discarded"),nn=t=>Promise.resolve().then(t),B7=t=>t(),Z7=t=>t==="end"||t==="finish"||t==="prefinish",b7=t=>t instanceof ArrayBuffer||!!t&&typeof t=="object"&&t.constructor&&t.constructor.name==="ArrayBuffer"&&t.byteLength>=0,P7=t=>!Buffer.isBuffer(t)&&ArrayBuffer.isView(t),mr=class{src;dest;opts;ondrain;constructor(e,i,n){this.src=e,this.dest=i,this.opts=n,this.ondrain=()=>e[fi](),this.dest.on("drain",this.ondrain)}unpipe(){this.dest.removeListener("drain",this.ondrain)}proxyErrors(e){}end(){this.unpipe(),this.opts.end&&this.dest.end()}},Ca=class extends mr{unpipe(){this.src.removeListener("error",this.proxyErrors),super.unpipe()}constructor(e,i,n){super(e,i,n),this.proxyErrors=r=>i.emit("error",r),e.on("error",this.proxyErrors)}},q7=t=>!!t.objectMode,D7=t=>!t.objectMode&&!!t.encoding&&t.encoding!=="buffer",rn=class extends Oa{[k]=!1;[en]=!1;[L]=[];[F]=[];[y];[Re];[Ce];[hi];[Pe]=!1;[lt]=!1;[sr]=!1;[cr]=!1;[$i]=null;[Q]=0;[C]=!1;[tn];[Ar]=!1;[Qt]=0;[te]=!1;writable=!0;readable=!0;constructor(...e){let i=e[0]||{};if(super(),i.objectMode&&typeof i.encoding=="string")throw new TypeError("Encoding and objectMode may not be used together");q7(i)?(this[y]=!0,this[Re]=null):D7(i)?(this[Re]=i.encoding,this[y]=!1):(this[y]=!1,this[Re]=null),this[Ce]=!!i.async,this[hi]=this[Re]?new k7(this[Re]):null,i&&i.debugExposeBuffer===!0&&Object.defineProperty(this,"buffer",{get:()=>this[F]}),i&&i.debugExposePipes===!0&&Object.defineProperty(this,"pipes",{get:()=>this[L]});let{signal:n}=i;n&&(this[tn]=n,n.aborted?this[Ma]():n.addEventListener("abort",()=>this[Ma]()))}get bufferLength(){return this[Q]}get encoding(){return this[Re]}set encoding(e){throw new Error("Encoding must be set at instantiation time")}setEncoding(e){throw new Error("Encoding must be set at instantiation time")}get objectMode(){return this[y]}set objectMode(e){throw new Error("objectMode must be set at instantiation time")}get async(){return this[Ce]}set async(e){this[Ce]=this[Ce]||!!e}[Ma](){this[Ar]=!0,this.emit("abort",this[tn]?.reason),this.destroy(this[tn]?.reason)}get aborted(){return this[Ar]}set aborted(e){}write(e,i,n){if(this[Ar])return!1;if(this[Pe])throw new Error("write after end");if(this[C])return this.emit("error",Object.assign(new Error("Cannot call write after a stream was destroyed"),{code:"ERR_STREAM_DESTROYED"})),!0;typeof i=="function"&&(n=i,i="utf8"),i||(i="utf8");let r=this[Ce]?nn:B7;if(!this[y]&&!Buffer.isBuffer(e)){if(P7(e))e=Buffer.from(e.buffer,e.byteOffset,e.byteLength);else if(b7(e))e=Buffer.from(e);else if(typeof e!="string")throw new Error("Non-contiguous data written to non-objectMode stream")}return this[y]?(this[k]&&this[Q]!==0&&this[lr](!0),this[k]?this.emit("data",e):this[Ga](e),this[Q]!==0&&this.emit("readable"),n&&r(n),this[k]):e.length?(typeof e=="string"&&!(i===this[Re]&&!this[hi]?.lastNeed)&&(e=Buffer.from(e,i)),Buffer.isBuffer(e)&&this[Re]&&(e=this[hi].write(e)),this[k]&&this[Q]!==0&&this[lr](!0),this[k]?this.emit("data",e):this[Ga](e),this[Q]!==0&&this.emit("readable"),n&&r(n),this[k]):(this[Q]!==0&&this.emit("readable"),n&&r(n),this[k])}read(e){if(this[C])return null;if(this[te]=!1,this[Q]===0||e===0||e&&e>this[Q])return this[qe](),null;this[y]&&(e=null),this[F].length>1&&!this[y]&&(this[F]=[this[Re]?this[F].join(""):Buffer.concat(this[F],this[Q])]);let i=this[Ml](e||null,this[F][0]);return this[qe](),i}[Ml](e,i){if(this[y])this[vr]();else{let n=i;e===n.length||e===null?this[vr]():typeof n=="string"?(this[F][0]=n.slice(e),i=n.slice(0,e),this[Q]-=e):(this[F][0]=n.subarray(e),i=n.subarray(0,e),this[Q]-=e)}return this.emit("data",i),!this[F].length&&!this[Pe]&&this.emit("drain"),i}end(e,i,n){return typeof e=="function"&&(n=e,e=void 0),typeof i=="function"&&(n=i,i="utf8"),e!==void 0&&this.write(e,i),n&&this.once("end",n),this[Pe]=!0,this.writable=!1,(this[k]||!this[en])&&this[qe](),this}[fi](){this[C]||(!this[Qt]&&!this[L].length&&(this[te]=!0),this[en]=!1,this[k]=!0,this.emit("resume"),this[F].length?this[lr]():this[Pe]?this[qe]():this.emit("drain"))}resume(){return this[fi]()}pause(){this[k]=!1,this[en]=!0,this[te]=!1}get destroyed(){return this[C]}get flowing(){return this[k]}get paused(){return this[en]}[Ga](e){this[y]?this[Q]+=1:this[Q]+=e.length,this[F].push(e)}[vr](){return this[y]?this[Q]-=1:this[Q]-=this[F][0].length,this[F].shift()}[lr](e=!1){do;while(this[Cl](this[vr]())&&this[F].length);!e&&!this[F].length&&!this[Pe]&&this.emit("drain")}[Cl](e){return this.emit("data",e),this[k]}pipe(e,i){if(this[C])return e;this[te]=!1;let n=this[lt];return i=i||{},e===Wl.stdout||e===Wl.stderr?i.end=!1:i.end=i.end!==!1,i.proxyErrors=!!i.proxyErrors,n?i.end&&e.end():(this[L].push(i.proxyErrors?new Ca(this,e,i):new mr(this,e,i)),this[Ce]?nn(()=>this[fi]()):this[fi]()),e}unpipe(e){let i=this[L].find(n=>n.dest===e);i&&(this[L].length===1?(this[k]&&this[Qt]===0&&(this[k]=!1),this[L]=[]):this[L].splice(this[L].indexOf(i),1),i.unpipe())}addListener(e,i){return this.on(e,i)}on(e,i){let n=super.on(e,i);if(e==="data")this[te]=!1,this[Qt]++,!this[L].length&&!this[k]&&this[fi]();else if(e==="readable"&&this[Q]!==0)super.emit("readable");else if(Z7(e)&&this[lt])super.emit(e),this.removeAllListeners(e);else if(e==="error"&&this[$i]){let r=i;this[Ce]?nn(()=>r.call(this,this[$i])):r.call(this,this[$i])}return n}removeListener(e,i){return this.off(e,i)}off(e,i){let n=super.off(e,i);return e==="data"&&(this[Qt]=this.listeners("data").length,this[Qt]===0&&!this[te]&&!this[L].length&&(this[k]=!1)),n}removeAllListeners(e){let i=super.removeAllListeners(e);return(e==="data"||e===void 0)&&(this[Qt]=0,!this[te]&&!this[L].length&&(this[k]=!1)),i}get emittedEnd(){return this[lt]}[qe](){!this[sr]&&!this[lt]&&!this[C]&&this[F].length===0&&this[Pe]&&(this[sr]=!0,this.emit("end"),this.emit("prefinish"),this.emit("finish"),this[cr]&&this.emit("close"),this[sr]=!1)}emit(e,...i){let n=i[0];if(e!=="error"&&e!=="close"&&e!==C&&this[C])return!1;if(e==="data")return!this[y]&&!n?!1:this[Ce]?(nn(()=>this[Ya](n)),!0):this[Ya](n);if(e==="end")return this[Ol]();if(e==="close"){if(this[cr]=!0,!this[lt]&&!this[C])return!1;let o=super.emit("close");return this.removeAllListeners("close"),o}else if(e==="error"){this[$i]=n,super.emit(Sa,n);let o=!this[tn]||this.listeners("error").length?super.emit("error",n):!1;return this[qe](),o}else if(e==="resume"){let o=super.emit("resume");return this[qe](),o}else if(e==="finish"||e==="prefinish"){let o=super.emit(e);return this.removeAllListeners(e),o}let r=super.emit(e,...i);return this[qe](),r}[Ya](e){for(let n of this[L])n.dest.write(e)===!1&&this.pause();let i=this[te]?!1:super.emit("data",e);return this[qe](),i}[Ol](){return this[lt]?!1:(this[lt]=!0,this.readable=!1,this[Ce]?(nn(()=>this[Wa]()),!0):this[Wa]())}[Wa](){if(this[hi]){let i=this[hi].end();if(i){for(let n of this[L])n.dest.write(i);this[te]||super.emit("data",i)}}for(let i of this[L])i.end();let e=super.emit("end");return this.removeAllListeners("end"),e}async collect(){let e=Object.assign([],{dataLength:0});this[y]||(e.dataLength=0);let i=this.promise();return this.on("data",n=>{e.push(n),this[y]||(e.dataLength+=n.length)}),await i,e}async concat(){if(this[y])throw new Error("cannot concat in objectMode");let e=await this.collect();return this[Re]?e.join(""):Buffer.concat(e,e.dataLength)}async promise(){return new Promise((e,i)=>{this.on(C,()=>i(new Error("stream destroyed"))),this.on("error",n=>i(n)),this.on("end",()=>e())})}[Symbol.asyncIterator](){this[te]=!1;let e=!1,i=async()=>(this.pause(),e=!0,{value:void 0,done:!0});return{next:()=>{if(e)return i();let r=this.read();if(r!==null)return Promise.resolve({done:!1,value:r});if(this[Pe])return i();let o,a,c=m=>{this.off("data",l),this.off("end",v),this.off(C,A),i(),a(m)},l=m=>{this.off("error",c),this.off("end",v),this.off(C,A),this.pause(),o({value:m,done:!!this[Pe]})},v=()=>{this.off("error",c),this.off("data",l),this.off(C,A),i(),o({done:!0,value:void 0})},A=()=>c(new Error("stream destroyed"));return new Promise((m,I)=>{a=I,o=m,this.once(C,A),this.once("error",c),this.once("end",v),this.once("data",l)})},throw:i,return:i,[Symbol.asyncIterator](){return this}}}[Symbol.iterator](){this[te]=!1;let e=!1,i=()=>(this.pause(),this.off(Sa,i),this.off(C,i),this.off("end",i),e=!0,{done:!0,value:void 0}),n=()=>{if(e)return i();let r=this.read();return r===null?i():{done:!1,value:r}};return this.once("end",i),this.once(Sa,i),this.once(C,i),{next:n,throw:i,return:i,[Symbol.iterator](){return this}}}destroy(e){if(this[C])return e?this.emit("error",e):this.emit(C),this;this[C]=!0,this[te]=!0,this[F].length=0,this[Q]=0;let i=this;return typeof i.close=="function"&&!this[cr]&&i.close(),e?this.emit("error",e):this.emit(C),this}static get isStream(){return F7}};var w7=ee.writev,At=Symbol("_autoClose"),je=Symbol("_close"),on=Symbol("_ended"),g=Symbol("_fd"),Ua=Symbol("_finished"),ye=Symbol("_flags"),Ka=Symbol("_flush"),Fa=Symbol("_handleChunk"),Qa=Symbol("_makeBuf"),sn=Symbol("_mode"),ur=Symbol("_needDrain"),di=Symbol("_onerror"),ji=Symbol("_onopen"),Va=Symbol("_onread"),zi=Symbol("_onwrite"),mt=Symbol("_open"),de=Symbol("_path"),vt=Symbol("_pos"),Oe=Symbol("_queue"),Ri=Symbol("_read"),Na=Symbol("_readSize"),De=Symbol("_reading"),an=Symbol("_remain"),ka=Symbol("_size"),Er=Symbol("_write"),Jt=Symbol("_writing"),Ir=Symbol("_defaultFlag"),Bt=Symbol("_errored"),Zt=class extends rn{[Bt]=!1;[g];[de];[Na];[De]=!1;[ka];[an];[At];constructor(e,i){if(i=i||{},super(i),this.readable=!0,this.writable=!1,typeof e!="string")throw new TypeError("path must be a string");this[Bt]=!1,this[g]=typeof i.fd=="number"?i.fd:void 0,this[de]=e,this[Na]=i.readSize||16*1024*1024,this[De]=!1,this[ka]=typeof i.size=="number"?i.size:1/0,this[an]=this[ka],this[At]=typeof i.autoClose=="boolean"?i.autoClose:!0,typeof this[g]=="number"?this[Ri]():this[mt]()}get fd(){return this[g]}get path(){return this[de]}write(){throw new TypeError("this is a readable stream")}end(){throw new TypeError("this is a readable stream")}[mt](){ee.open(this[de],"r",(e,i)=>this[ji](e,i))}[ji](e,i){e?this[di](e):(this[g]=i,this.emit("open",i),this[Ri]())}[Qa](){return Buffer.allocUnsafe(Math.min(this[Na],this[an]))}[Ri](){if(!this[De]){this[De]=!0;let e=this[Qa]();if(e.length===0)return process.nextTick(()=>this[Va](null,0,e));ee.read(this[g],e,0,e.length,null,(i,n,r)=>this[Va](i,n,r))}}[Va](e,i,n){this[De]=!1,e?this[di](e):this[Fa](i,n)&&this[Ri]()}[je](){if(this[At]&&typeof this[g]=="number"){let e=this[g];this[g]=void 0,ee.close(e,i=>i?this.emit("error",i):this.emit("close"))}}[di](e){this[De]=!0,this[je](),this.emit("error",e)}[Fa](e,i){let n=!1;return this[an]-=e,e>0&&(n=super.write(e<i.length?i.subarray(0,e):i)),(e===0||this[an]<=0)&&(n=!1,this[je](),super.end()),n}emit(e,...i){switch(e){case"prefinish":case"finish":return!1;case"drain":return typeof this[g]=="number"&&this[Ri](),!1;case"error":return this[Bt]?!1:(this[Bt]=!0,super.emit(e,...i));default:return super.emit(e,...i)}}},pr=class extends Zt{[mt](){let e=!0;try{this[ji](null,ee.openSync(this[de],"r")),e=!1}finally{e&&this[je]()}}[Ri](){let e=!0;try{if(!this[De]){this[De]=!0;do{let i=this[Qa](),n=i.length===0?0:ee.readSync(this[g],i,0,i.length,null);if(!this[Fa](n,i))break}while(!0);this[De]=!1}e=!1}finally{e&&this[je]()}}[je](){if(this[At]&&typeof this[g]=="number"){let e=this[g];this[g]=void 0,ee.closeSync(e),this.emit("close")}}},we=class extends y7{readable=!1;writable=!0;[Bt]=!1;[Jt]=!1;[on]=!1;[Oe]=[];[ur]=!1;[de];[sn];[At];[g];[Ir];[ye];[Ua]=!1;[vt];constructor(e,i){i=i||{},super(i),this[de]=e,this[g]=typeof i.fd=="number"?i.fd:void 0,this[sn]=i.mode===void 0?438:i.mode,this[vt]=typeof i.start=="number"?i.start:void 0,this[At]=typeof i.autoClose=="boolean"?i.autoClose:!0;let n=this[vt]!==void 0?"r+":"w";this[Ir]=i.flags===void 0,this[ye]=i.flags===void 0?n:i.flags,this[g]===void 0&&this[mt]()}emit(e,...i){if(e==="error"){if(this[Bt])return!1;this[Bt]=!0}return super.emit(e,...i)}get fd(){return this[g]}get path(){return this[de]}[di](e){this[je](),this[Jt]=!0,this.emit("error",e)}[mt](){ee.open(this[de],this[ye],this[sn],(e,i)=>this[ji](e,i))}[ji](e,i){this[Ir]&&this[ye]==="r+"&&e&&e.code==="ENOENT"?(this[ye]="w",this[mt]()):e?this[di](e):(this[g]=i,this.emit("open",i),this[Jt]||this[Ka]())}end(e,i){return e&&this.write(e,i),this[on]=!0,!this[Jt]&&!this[Oe].length&&typeof this[g]=="number"&&this[zi](null,0),this}write(e,i){return typeof e=="string"&&(e=Buffer.from(e,i)),this[on]?(this.emit("error",new Error("write() after end()")),!1):this[g]===void 0||this[Jt]||this[Oe].length?(this[Oe].push(e),this[ur]=!0,!1):(this[Jt]=!0,this[Er](e),!0)}[Er](e){ee.write(this[g],e,0,e.length,this[vt],(i,n)=>this[zi](i,n))}[zi](e,i){e?this[di](e):(this[vt]!==void 0&&typeof i=="number"&&(this[vt]+=i),this[Oe].length?this[Ka]():(this[Jt]=!1,this[on]&&!this[Ua]?(this[Ua]=!0,this[je](),this.emit("finish")):this[ur]&&(this[ur]=!1,this.emit("drain"))))}[Ka](){if(this[Oe].length===0)this[on]&&this[zi](null,0);else if(this[Oe].length===1)this[Er](this[Oe].pop());else{let e=this[Oe];this[Oe]=[],w7(this[g],e,this[vt],(i,n)=>this[zi](i,n))}}[je](){if(this[At]&&typeof this[g]=="number"){let e=this[g];this[g]=void 0,ee.close(e,i=>i?this.emit("error",i):this.emit("close"))}}},gi=class extends we{[mt](){let e;if(this[Ir]&&this[ye]==="r+")try{e=ee.openSync(this[de],this[ye],this[sn])}catch(i){if(i?.code==="ENOENT")return this[ye]="w",this[mt]();throw i}else e=ee.openSync(this[de],this[ye],this[sn]);this[ji](null,e)}[je](){if(this[At]&&typeof this[g]=="number"){let e=this[g];this[g]=void 0,ee.closeSync(e),this.emit("close")}}[Er](e){let i=!0;try{this[zi](null,ee.writeSync(this[g],e,0,e.length,this[vt])),i=!1}finally{if(i)try{this[je]()}catch{}}}};import j3 from"node:path";import Ui from"node:fs";import{dirname as qm,parse as Dm}from"path";var T7=new Map([["C","cwd"],["f","file"],["z","gzip"],["P","preservePaths"],["U","unlink"],["strip-components","strip"],["stripComponents","strip"],["keep-newer","newer"],["keepNewer","newer"],["keep-newer-files","newer"],["keepNewerFiles","newer"],["k","keep"],["keep-existing","keep"],["keepExisting","keep"],["m","noMtime"],["no-mtime","noMtime"],["p","preserveOwner"],["L","follow"],["h","follow"],["onentry","onReadEntry"]]),Kl=t=>!!t.sync&&!!t.file,Vl=t=>!t.sync&&!!t.file,Nl=t=>!!t.sync&&!t.file,kl=t=>!t.sync&&!t.file;var Fl=t=>!!t.file;var X7=t=>{let e=T7.get(t);return e||t},cn=(t={})=>{if(!t)return{};let e={};for(let[i,n]of Object.entries(t)){let r=X7(i);e[r]=n}return e.chmod===void 0&&e.noChmod===!1&&(e.chmod=!0),delete e.noChmod,e};var Ue=(t,e,i,n,r)=>Object.assign((o=[],a,c)=>{Array.isArray(o)&&(a=o,o={}),typeof a=="function"&&(c=a,a=void 0),a?a=Array.from(a):a=[];let l=cn(o);if(r?.(l,a),Kl(l)){if(typeof c=="function")throw new TypeError("callback not supported for sync tar functions");return t(l,a)}else if(Vl(l)){let v=e(l,a),A=c||void 0;return A?v.then(()=>A(),A):v}else if(Nl(l)){if(typeof c=="function")throw new TypeError("callback not supported for sync tar functions");return i(l,a)}else if(kl(l)){if(typeof c=="function")throw new TypeError("callback only supported with file option");return n(l,a)}else throw new Error("impossible options??")},{syncFile:t,asyncFile:e,syncNoFile:i,asyncNoFile:n,validate:r});import{EventEmitter as Bm}from"events";import Xa from"assert";import{Buffer as Pt}from"buffer";import{EventEmitter as ya}from"node:events";import bl from"node:stream";import{StringDecoder as H7}from"node:string_decoder";var Ql=typeof process=="object"&&process?process:{stdout:null,stderr:null},L7=t=>!!t&&typeof t=="object"&&(t instanceof un||t instanceof bl||_7(t)||$7(t)),_7=t=>!!t&&typeof t=="object"&&t instanceof ya&&typeof t.pipe=="function"&&t.pipe!==bl.Writable.prototype.pipe,$7=t=>!!t&&typeof t=="object"&&t instanceof ya&&typeof t.write=="function"&&typeof t.end=="function",Te=Symbol("EOF"),Xe=Symbol("maybeEmitEnd"),ut=Symbol("emittedEnd"),hr=Symbol("emittingEnd"),ln=Symbol("emittedError"),fr=Symbol("closed"),Jl=Symbol("read"),zr=Symbol("flush"),Bl=Symbol("flushChunk"),ge=Symbol("encoding"),xi=Symbol("decoder"),J=Symbol("flowing"),vn=Symbol("paused"),Gi=Symbol("resume"),B=Symbol("buffer"),_=Symbol("pipes"),Z=Symbol("bufferLength"),Ba=Symbol("bufferPush"),Rr=Symbol("bufferShift"),w=Symbol("objectMode"),O=Symbol("destroyed"),Za=Symbol("error"),ba=Symbol("emitData"),Zl=Symbol("emitEnd"),Pa=Symbol("emitEnd2"),Ke=Symbol("async"),qa=Symbol("abort"),dr=Symbol("aborted"),An=Symbol("signal"),bt=Symbol("dataListeners"),ie=Symbol("discarded"),mn=t=>Promise.resolve().then(t),em=t=>t(),tm=t=>t==="end"||t==="finish"||t==="prefinish",im=t=>t instanceof ArrayBuffer||!!t&&typeof t=="object"&&t.constructor&&t.constructor.name==="ArrayBuffer"&&t.byteLength>=0,nm=t=>!Buffer.isBuffer(t)&&ArrayBuffer.isView(t),jr=class{src;dest;opts;ondrain;constructor(e,i,n){this.src=e,this.dest=i,this.opts=n,this.ondrain=()=>e[Gi](),this.dest.on("drain",this.ondrain)}unpipe(){this.dest.removeListener("drain",this.ondrain)}proxyErrors(e){}end(){this.unpipe(),this.opts.end&&this.dest.end()}},Da=class extends jr{unpipe(){this.src.removeListener("error",this.proxyErrors),super.unpipe()}constructor(e,i,n){super(e,i,n),this.proxyErrors=r=>i.emit("error",r),e.on("error",this.proxyErrors)}},rm=t=>!!t.objectMode,om=t=>!t.objectMode&&!!t.encoding&&t.encoding!=="buffer",un=class extends ya{[J]=!1;[vn]=!1;[_]=[];[B]=[];[w];[ge];[Ke];[xi];[Te]=!1;[ut]=!1;[hr]=!1;[fr]=!1;[ln]=null;[Z]=0;[O]=!1;[An];[dr]=!1;[bt]=0;[ie]=!1;writable=!0;readable=!0;constructor(...e){let i=e[0]||{};if(super(),i.objectMode&&typeof i.encoding=="string")throw new TypeError("Encoding and objectMode may not be used together");rm(i)?(this[w]=!0,this[ge]=null):om(i)?(this[ge]=i.encoding,this[w]=!1):(this[w]=!1,this[ge]=null),this[Ke]=!!i.async,this[xi]=this[ge]?new H7(this[ge]):null,i&&i.debugExposeBuffer===!0&&Object.defineProperty(this,"buffer",{get:()=>this[B]}),i&&i.debugExposePipes===!0&&Object.defineProperty(this,"pipes",{get:()=>this[_]});let{signal:n}=i;n&&(this[An]=n,n.aborted?this[qa]():n.addEventListener("abort",()=>this[qa]()))}get bufferLength(){return this[Z]}get encoding(){return this[ge]}set encoding(e){throw new Error("Encoding must be set at instantiation time")}setEncoding(e){throw new Error("Encoding must be set at instantiation time")}get objectMode(){return this[w]}set objectMode(e){throw new Error("objectMode must be set at instantiation time")}get async(){return this[Ke]}set async(e){this[Ke]=this[Ke]||!!e}[qa](){this[dr]=!0,this.emit("abort",this[An]?.reason),this.destroy(this[An]?.reason)}get aborted(){return this[dr]}set aborted(e){}write(e,i,n){if(this[dr])return!1;if(this[Te])throw new Error("write after end");if(this[O])return this.emit("error",Object.assign(new Error("Cannot call write after a stream was destroyed"),{code:"ERR_STREAM_DESTROYED"})),!0;typeof i=="function"&&(n=i,i="utf8"),i||(i="utf8");let r=this[Ke]?mn:em;if(!this[w]&&!Buffer.isBuffer(e)){if(nm(e))e=Buffer.from(e.buffer,e.byteOffset,e.byteLength);else if(im(e))e=Buffer.from(e);else if(typeof e!="string")throw new Error("Non-contiguous data written to non-objectMode stream")}return this[w]?(this[J]&&this[Z]!==0&&this[zr](!0),this[J]?this.emit("data",e):this[Ba](e),this[Z]!==0&&this.emit("readable"),n&&r(n),this[J]):e.length?(typeof e=="string"&&!(i===this[ge]&&!this[xi]?.lastNeed)&&(e=Buffer.from(e,i)),Buffer.isBuffer(e)&&this[ge]&&(e=this[xi].write(e)),this[J]&&this[Z]!==0&&this[zr](!0),this[J]?this.emit("data",e):this[Ba](e),this[Z]!==0&&this.emit("readable"),n&&r(n),this[J]):(this[Z]!==0&&this.emit("readable"),n&&r(n),this[J])}read(e){if(this[O])return null;if(this[ie]=!1,this[Z]===0||e===0||e&&e>this[Z])return this[Xe](),null;this[w]&&(e=null),this[B].length>1&&!this[w]&&(this[B]=[this[ge]?this[B].join(""):Buffer.concat(this[B],this[Z])]);let i=this[Jl](e||null,this[B][0]);return this[Xe](),i}[Jl](e,i){if(this[w])this[Rr]();else{let n=i;e===n.length||e===null?this[Rr]():typeof n=="string"?(this[B][0]=n.slice(e),i=n.slice(0,e),this[Z]-=e):(this[B][0]=n.subarray(e),i=n.subarray(0,e),this[Z]-=e)}return this.emit("data",i),!this[B].length&&!this[Te]&&this.emit("drain"),i}end(e,i,n){return typeof e=="function"&&(n=e,e=void 0),typeof i=="function"&&(n=i,i="utf8"),e!==void 0&&this.write(e,i),n&&this.once("end",n),this[Te]=!0,this.writable=!1,(this[J]||!this[vn])&&this[Xe](),this}[Gi](){this[O]||(!this[bt]&&!this[_].length&&(this[ie]=!0),this[vn]=!1,this[J]=!0,this.emit("resume"),this[B].length?this[zr]():this[Te]?this[Xe]():this.emit("drain"))}resume(){return this[Gi]()}pause(){this[J]=!1,this[vn]=!0,this[ie]=!1}get destroyed(){return this[O]}get flowing(){return this[J]}get paused(){return this[vn]}[Ba](e){this[w]?this[Z]+=1:this[Z]+=e.length,this[B].push(e)}[Rr](){return this[w]?this[Z]-=1:this[Z]-=this[B][0].length,this[B].shift()}[zr](e=!1){do;while(this[Bl](this[Rr]())&&this[B].length);!e&&!this[B].length&&!this[Te]&&this.emit("drain")}[Bl](e){return this.emit("data",e),this[J]}pipe(e,i){if(this[O])return e;this[ie]=!1;let n=this[ut];return i=i||{},e===Ql.stdout||e===Ql.stderr?i.end=!1:i.end=i.end!==!1,i.proxyErrors=!!i.proxyErrors,n?i.end&&e.end():(this[_].push(i.proxyErrors?new Da(this,e,i):new jr(this,e,i)),this[Ke]?mn(()=>this[Gi]()):this[Gi]()),e}unpipe(e){let i=this[_].find(n=>n.dest===e);i&&(this[_].length===1?(this[J]&&this[bt]===0&&(this[J]=!1),this[_]=[]):this[_].splice(this[_].indexOf(i),1),i.unpipe())}addListener(e,i){return this.on(e,i)}on(e,i){let n=super.on(e,i);if(e==="data")this[ie]=!1,this[bt]++,!this[_].length&&!this[J]&&this[Gi]();else if(e==="readable"&&this[Z]!==0)super.emit("readable");else if(tm(e)&&this[ut])super.emit(e),this.removeAllListeners(e);else if(e==="error"&&this[ln]){let r=i;this[Ke]?mn(()=>r.call(this,this[ln])):r.call(this,this[ln])}return n}removeListener(e,i){return this.off(e,i)}off(e,i){let n=super.off(e,i);return e==="data"&&(this[bt]=this.listeners("data").length,this[bt]===0&&!this[ie]&&!this[_].length&&(this[J]=!1)),n}removeAllListeners(e){let i=super.removeAllListeners(e);return(e==="data"||e===void 0)&&(this[bt]=0,!this[ie]&&!this[_].length&&(this[J]=!1)),i}get emittedEnd(){return this[ut]}[Xe](){!this[hr]&&!this[ut]&&!this[O]&&this[B].length===0&&this[Te]&&(this[hr]=!0,this.emit("end"),this.emit("prefinish"),this.emit("finish"),this[fr]&&this.emit("close"),this[hr]=!1)}emit(e,...i){let n=i[0];if(e!=="error"&&e!=="close"&&e!==O&&this[O])return!1;if(e==="data")return!this[w]&&!n?!1:this[Ke]?(mn(()=>this[ba](n)),!0):this[ba](n);if(e==="end")return this[Zl]();if(e==="close"){if(this[fr]=!0,!this[ut]&&!this[O])return!1;let o=super.emit("close");return this.removeAllListeners("close"),o}else if(e==="error"){this[ln]=n,super.emit(Za,n);let o=!this[An]||this.listeners("error").length?super.emit("error",n):!1;return this[Xe](),o}else if(e==="resume"){let o=super.emit("resume");return this[Xe](),o}else if(e==="finish"||e==="prefinish"){let o=super.emit(e);return this.removeAllListeners(e),o}let r=super.emit(e,...i);return this[Xe](),r}[ba](e){for(let n of this[_])n.dest.write(e)===!1&&this.pause();let i=this[ie]?!1:super.emit("data",e);return this[Xe](),i}[Zl](){return this[ut]?!1:(this[ut]=!0,this.readable=!1,this[Ke]?(mn(()=>this[Pa]()),!0):this[Pa]())}[Pa](){if(this[xi]){let i=this[xi].end();if(i){for(let n of this[_])n.dest.write(i);this[ie]||super.emit("data",i)}}for(let i of this[_])i.end();let e=super.emit("end");return this.removeAllListeners("end"),e}async collect(){let e=Object.assign([],{dataLength:0});this[w]||(e.dataLength=0);let i=this.promise();return this.on("data",n=>{e.push(n),this[w]||(e.dataLength+=n.length)}),await i,e}async concat(){if(this[w])throw new Error("cannot concat in objectMode");let e=await this.collect();return this[ge]?e.join(""):Buffer.concat(e,e.dataLength)}async promise(){return new Promise((e,i)=>{this.on(O,()=>i(new Error("stream destroyed"))),this.on("error",n=>i(n)),this.on("end",()=>e())})}[Symbol.asyncIterator](){this[ie]=!1;let e=!1,i=async()=>(this.pause(),e=!0,{value:void 0,done:!0});return{next:()=>{if(e)return i();let r=this.read();if(r!==null)return Promise.resolve({done:!1,value:r});if(this[Te])return i();let o,a,c=m=>{this.off("data",l),this.off("end",v),this.off(O,A),i(),a(m)},l=m=>{this.off("error",c),this.off("end",v),this.off(O,A),this.pause(),o({value:m,done:!!this[Te]})},v=()=>{this.off("error",c),this.off("data",l),this.off(O,A),i(),o({done:!0,value:void 0})},A=()=>c(new Error("stream destroyed"));return new Promise((m,I)=>{a=I,o=m,this.once(O,A),this.once("error",c),this.once("end",v),this.once("data",l)})},throw:i,return:i,[Symbol.asyncIterator](){return this}}}[Symbol.iterator](){this[ie]=!1;let e=!1,i=()=>(this.pause(),this.off(Za,i),this.off(O,i),this.off("end",i),e=!0,{done:!0,value:void 0}),n=()=>{if(e)return i();let r=this.read();return r===null?i():{done:!1,value:r}};return this.once("end",i),this.once(Za,i),this.once(O,i),{next:n,throw:i,return:i,[Symbol.iterator](){return this}}}destroy(e){if(this[O])return e?this.emit("error",e):this.emit(O),this;this[O]=!0,this[ie]=!0,this[B].length=0,this[Z]=0;let i=this;return typeof i.close=="function"&&!this[fr]&&i.close(),e?this.emit("error",e):this.emit(O),this}static get isStream(){return L7}};import*as Pl from"zlib";import am from"zlib";var sm=am.constants||{ZLIB_VERNUM:4736},me=Object.freeze(Object.assign(Object.create(null),{Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_VERSION_ERROR:-6,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,DEFLATE:1,INFLATE:2,GZIP:3,GUNZIP:4,DEFLATERAW:5,INFLATERAW:6,UNZIP:7,BROTLI_DECODE:8,BROTLI_ENCODE:9,Z_MIN_WINDOWBITS:8,Z_MAX_WINDOWBITS:15,Z_DEFAULT_WINDOWBITS:15,Z_MIN_CHUNK:64,Z_MAX_CHUNK:1/0,Z_DEFAULT_CHUNK:16384,Z_MIN_MEMLEVEL:1,Z_MAX_MEMLEVEL:9,Z_DEFAULT_MEMLEVEL:8,Z_MIN_LEVEL:-1,Z_MAX_LEVEL:9,Z_DEFAULT_LEVEL:-1,BROTLI_OPERATION_PROCESS:0,BROTLI_OPERATION_FLUSH:1,BROTLI_OPERATION_FINISH:2,BROTLI_OPERATION_EMIT_METADATA:3,BROTLI_MODE_GENERIC:0,BROTLI_MODE_TEXT:1,BROTLI_MODE_FONT:2,BROTLI_DEFAULT_MODE:0,BROTLI_MIN_QUALITY:0,BROTLI_MAX_QUALITY:11,BROTLI_DEFAULT_QUALITY:11,BROTLI_MIN_WINDOW_BITS:10,BROTLI_MAX_WINDOW_BITS:24,BROTLI_LARGE_MAX_WINDOW_BITS:30,BROTLI_DEFAULT_WINDOW:22,BROTLI_MIN_INPUT_BLOCK_BITS:16,BROTLI_MAX_INPUT_BLOCK_BITS:24,BROTLI_PARAM_MODE:0,BROTLI_PARAM_QUALITY:1,BROTLI_PARAM_LGWIN:2,BROTLI_PARAM_LGBLOCK:3,BROTLI_PARAM_DISABLE_LITERAL_CONTEXT_MODELING:4,BROTLI_PARAM_SIZE_HINT:5,BROTLI_PARAM_LARGE_WINDOW:6,BROTLI_PARAM_NPOSTFIX:7,BROTLI_PARAM_NDIRECT:8,BROTLI_DECODER_RESULT_ERROR:0,BROTLI_DECODER_RESULT_SUCCESS:1,BROTLI_DECODER_RESULT_NEEDS_MORE_INPUT:2,BROTLI_DECODER_RESULT_NEEDS_MORE_OUTPUT:3,BROTLI_DECODER_PARAM_DISABLE_RING_BUFFER_REALLOCATION:0,BROTLI_DECODER_PARAM_LARGE_WINDOW:1,BROTLI_DECODER_NO_ERROR:0,BROTLI_DECODER_SUCCESS:1,BROTLI_DECODER_NEEDS_MORE_INPUT:2,BROTLI_DECODER_NEEDS_MORE_OUTPUT:3,BROTLI_DECODER_ERROR_FORMAT_EXUBERANT_NIBBLE:-1,BROTLI_DECODER_ERROR_FORMAT_RESERVED:-2,BROTLI_DECODER_ERROR_FORMAT_EXUBERANT_META_NIBBLE:-3,BROTLI_DECODER_ERROR_FORMAT_SIMPLE_HUFFMAN_ALPHABET:-4,BROTLI_DECODER_ERROR_FORMAT_SIMPLE_HUFFMAN_SAME:-5,BROTLI_DECODER_ERROR_FORMAT_CL_SPACE:-6,BROTLI_DECODER_ERROR_FORMAT_HUFFMAN_SPACE:-7,BROTLI_DECODER_ERROR_FORMAT_CONTEXT_MAP_REPEAT:-8,BROTLI_DECODER_ERROR_FORMAT_BLOCK_LENGTH_1:-9,BROTLI_DECODER_ERROR_FORMAT_BLOCK_LENGTH_2:-10,BROTLI_DECODER_ERROR_FORMAT_TRANSFORM:-11,BROTLI_DECODER_ERROR_FORMAT_DICTIONARY:-12,BROTLI_DECODER_ERROR_FORMAT_WINDOW_BITS:-13,BROTLI_DECODER_ERROR_FORMAT_PADDING_1:-14,BROTLI_DECODER_ERROR_FORMAT_PADDING_2:-15,BROTLI_DECODER_ERROR_FORMAT_DISTANCE:-16,BROTLI_DECODER_ERROR_DICTIONARY_NOT_SET:-19,BROTLI_DECODER_ERROR_INVALID_ARGUMENTS:-20,BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MODES:-21,BROTLI_DECODER_ERROR_ALLOC_TREE_GROUPS:-22,BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MAP:-25,BROTLI_DECODER_ERROR_ALLOC_RING_BUFFER_1:-26,BROTLI_DECODER_ERROR_ALLOC_RING_BUFFER_2:-27,BROTLI_DECODER_ERROR_ALLOC_BLOCK_TYPE_TREES:-30,BROTLI_DECODER_ERROR_UNREACHABLE:-31},sm));var cm=Pt.concat,ql=Object.getOwnPropertyDescriptor(Pt,"concat"),lm=t=>t,wa=ql?.writable===!0||ql?.set!==void 0?t=>{Pt.concat=t?lm:cm}:t=>{},qt=Symbol("_superWrite"),Si=class extends Error{code;errno;constructor(e,i){super("zlib: "+e.message,{cause:e}),this.code=e.code,this.errno=e.errno,this.code||(this.code="ZLIB_ERROR"),this.message="zlib: "+e.message,Error.captureStackTrace(this,i??this.constructor)}get name(){return"ZlibError"}},Ta=Symbol("flushFlag"),En=class extends un{#e=!1;#n=!1;#i;#r;#s;#t;#o;get sawError(){return this.#e}get handle(){return this.#t}get flushFlag(){return this.#i}constructor(e,i){if(!e||typeof e!="object")throw new TypeError("invalid options for ZlibBase constructor");if(super(e),this.#i=e.flush??0,this.#r=e.finishFlush??0,this.#s=e.fullFlushFlag??0,typeof Pl[i]!="function")throw new TypeError("Compression method not supported: "+i);try{this.#t=new Pl[i](e)}catch(n){throw new Si(n,this.constructor)}this.#o=n=>{this.#e||(this.#e=!0,this.close(),this.emit("error",n))},this.#t?.on("error",n=>this.#o(new Si(n))),this.once("end",()=>this.close)}close(){this.#t&&(this.#t.close(),this.#t=void 0,this.emit("close"))}reset(){if(!this.#e)return Xa(this.#t,"zlib binding closed"),this.#t.reset?.()}flush(e){this.ended||(typeof e!="number"&&(e=this.#s),this.write(Object.assign(Pt.alloc(0),{[Ta]:e})))}end(e,i,n){return typeof e=="function"&&(n=e,i=void 0,e=void 0),typeof i=="function"&&(n=i,i=void 0),e&&(i?this.write(e,i):this.write(e)),this.flush(this.#r),this.#n=!0,super.end(n)}get ended(){return this.#n}[qt](e){return super.write(e)}write(e,i,n){if(typeof i=="function"&&(n=i,i="utf8"),typeof e=="string"&&(e=Pt.from(e,i)),this.#e)return;Xa(this.#t,"zlib binding closed");let r=this.#t._handle,o=r.close;r.close=()=>{};let a=this.#t.close;this.#t.close=()=>{},wa(!0);let c;try{let v=typeof e[Ta]=="number"?e[Ta]:this.#i;c=this.#t._processChunk(e,v),wa(!1)}catch(v){wa(!1),this.#o(new Si(v,this.write))}finally{this.#t&&(this.#t._handle=r,r.close=o,this.#t.close=a,this.#t.removeAllListeners("error"))}this.#t&&this.#t.on("error",v=>this.#o(new Si(v,this.write)));let l;if(c)if(Array.isArray(c)&&c.length>0){let v=c[0];l=this[qt](Pt.from(v));for(let A=1;A<c.length;A++)l=this[qt](c[A])}else l=this[qt](Pt.from(c));return n&&n(),l}},gr=class extends En{#e;#n;constructor(e,i){e=e||{},e.flush=e.flush||me.Z_NO_FLUSH,e.finishFlush=e.finishFlush||me.Z_FINISH,e.fullFlushFlag=me.Z_FULL_FLUSH,super(e,i),this.#e=e.level,this.#n=e.strategy}params(e,i){if(!this.sawError){if(!this.handle)throw new Error("cannot switch params when binding is closed");if(!this.handle.params)throw new Error("not supported in this implementation");if(this.#e!==e||this.#n!==i){this.flush(me.Z_SYNC_FLUSH),Xa(this.handle,"zlib binding closed");let n=this.handle.flush;this.handle.flush=(r,o)=>{typeof r=="function"&&(o=r,r=this.flushFlag),this.flush(r),o?.()};try{this.handle.params(e,i)}finally{this.handle.flush=n}this.handle&&(this.#e=e,this.#n=i)}}}};var xr=class extends gr{#e;constructor(e){super(e,"Gzip"),this.#e=e&&!!e.portable}[qt](e){return this.#e?(this.#e=!1,e[9]=255,super[qt](e)):super[qt](e)}};var Gr=class extends gr{constructor(e){super(e,"Unzip")}},Sr=class extends En{constructor(e,i){e=e||{},e.flush=e.flush||me.BROTLI_OPERATION_PROCESS,e.finishFlush=e.finishFlush||me.BROTLI_OPERATION_FINISH,e.fullFlushFlag=me.BROTLI_OPERATION_FLUSH,super(e,i)}},Yr=class extends Sr{constructor(e){super(e,"BrotliCompress")}},Wr=class extends Sr{constructor(e){super(e,"BrotliDecompress")}},Mr=class extends En{constructor(e,i){e=e||{},e.flush=e.flush||me.ZSTD_e_continue,e.finishFlush=e.finishFlush||me.ZSTD_e_end,e.fullFlushFlag=me.ZSTD_e_flush,super(e,i)}},Cr=class extends Mr{constructor(e){super(e,"ZstdCompress")}},Or=class extends Mr{constructor(e){super(e,"ZstdDecompress")}};import{posix as Yi}from"node:path";var Dl=(t,e)=>{if(Number.isSafeInteger(t))t<0?mm(t,e):Am(t,e);else throw Error("cannot encode number outside of javascript safe integer range");return e},Am=(t,e)=>{e[0]=128;for(var i=e.length;i>1;i--)e[i-1]=t&255,t=Math.floor(t/256)},mm=(t,e)=>{e[0]=255;var i=!1;t=t*-1;for(var n=e.length;n>1;n--){var r=t&255;t=Math.floor(t/256),i?e[n-1]=wl(r):r===0?e[n-1]=0:(i=!0,e[n-1]=Tl(r))}},yl=t=>{let e=t[0],i=e===128?Em(t.subarray(1,t.length)):e===255?um(t):null;if(i===null)throw Error("invalid base256 encoding");if(!Number.isSafeInteger(i))throw Error("parsed number outside of javascript safe integer range");return i},um=t=>{for(var e=t.length,i=0,n=!1,r=e-1;r>-1;r--){var o=Number(t[r]),a;n?a=wl(o):o===0?a=o:(n=!0,a=Tl(o)),a!==0&&(i-=a*Math.pow(256,e-r-1))}return i},Em=t=>{for(var e=t.length,i=0,n=e-1;n>-1;n--){var r=Number(t[n]);r!==0&&(i+=r*Math.pow(256,e-n-1))}return i},wl=t=>(255^t)&255,Tl=t=>(255^t)+1&255;var Ur=t=>Kr.has(t);var Kr=new Map([["0","File"],["","OldFile"],["1","Link"],["2","SymbolicLink"],["3","CharacterDevice"],["4","BlockDevice"],["5","Directory"],["6","FIFO"],["7","ContiguousFile"],["g","GlobalExtendedHeader"],["x","ExtendedHeader"],["A","SolarisACL"],["D","GNUDumpDir"],["I","Inode"],["K","NextFileHasLongLinkpath"],["L","NextFileHasLongPath"],["M","ContinuationFile"],["N","OldGnuLongPath"],["S","SparseFile"],["V","TapeVolumeHeader"],["X","OldExtendedHeader"]]),Xl=new Map(Array.from(Kr).map(t=>[t[1],t[0]]));var ne=class{cksumValid=!1;needPax=!1;nullBlock=!1;block;path;mode;uid;gid;size;cksum;#e="Unsupported";linkpath;uname;gname;devmaj=0;devmin=0;atime;ctime;mtime;charset;comment;constructor(e,i=0,n,r){Buffer.isBuffer(e)?this.decode(e,i||0,n,r):e&&this.#n(e)}decode(e,i,n,r){if(i||(i=0),!e||!(e.length>=i+512))throw new Error("need 512 bytes for header");this.path=n?.path??Dt(e,i,100),this.mode=n?.mode??r?.mode??Et(e,i+100,8),this.uid=n?.uid??r?.uid??Et(e,i+108,8),this.gid=n?.gid??r?.gid??Et(e,i+116,8),this.size=n?.size??r?.size??Et(e,i+124,12),this.mtime=n?.mtime??r?.mtime??Ha(e,i+136,12),this.cksum=Et(e,i+148,12),r&&this.#n(r,!0),n&&this.#n(n);let o=Dt(e,i+156,1);if(Ur(o)&&(this.#e=o||"0"),this.#e==="0"&&this.path.slice(-1)==="/"&&(this.#e="5"),this.#e==="5"&&(this.size=0),this.linkpath=Dt(e,i+157,100),e.subarray(i+257,i+265).toString()==="ustar\x0000")if(this.uname=n?.uname??r?.uname??Dt(e,i+265,32),this.gname=n?.gname??r?.gname??Dt(e,i+297,32),this.devmaj=n?.devmaj??r?.devmaj??Et(e,i+329,8)??0,this.devmin=n?.devmin??r?.devmin??Et(e,i+337,8)??0,e[i+475]!==0){let c=Dt(e,i+345,155);this.path=c+"/"+this.path}else{let c=Dt(e,i+345,130);c&&(this.path=c+"/"+this.path),this.atime=n?.atime??r?.atime??Ha(e,i+476,12),this.ctime=n?.ctime??r?.ctime??Ha(e,i+488,12)}let a=256;for(let c=i;c<i+148;c++)a+=e[c];for(let c=i+156;c<i+512;c++)a+=e[c];this.cksumValid=a===this.cksum,this.cksum===void 0&&a===256&&(this.nullBlock=!0)}#n(e,i=!1){Object.assign(this,Object.fromEntries(Object.entries(e).filter(([n,r])=>!(r==null||n==="path"&&i||n==="linkpath"&&i||n==="global"))))}encode(e,i=0){if(e||(e=this.block=Buffer.alloc(512)),this.#e==="Unsupported"&&(this.#e="0"),!(e.length>=i+512))throw new Error("need 512 bytes for header");let n=this.ctime||this.atime?130:155,r=pm(this.path||"",n),o=r[0],a=r[1];this.needPax=!!r[2],this.needPax=yt(e,i,100,o)||this.needPax,this.needPax=It(e,i+100,8,this.mode)||this.needPax,this.needPax=It(e,i+108,8,this.uid)||this.needPax,this.needPax=It(e,i+116,8,this.gid)||this.needPax,this.needPax=It(e,i+124,12,this.size)||this.needPax,this.needPax=La(e,i+136,12,this.mtime)||this.needPax,e[i+156]=this.#e.charCodeAt(0),this.needPax=yt(e,i+157,100,this.linkpath)||this.needPax,e.write("ustar\x0000",i+257,8),this.needPax=yt(e,i+265,32,this.uname)||this.needPax,this.needPax=yt(e,i+297,32,this.gname)||this.needPax,this.needPax=It(e,i+329,8,this.devmaj)||this.needPax,this.needPax=It(e,i+337,8,this.devmin)||this.needPax,this.needPax=yt(e,i+345,n,a)||this.needPax,e[i+475]!==0?this.needPax=yt(e,i+345,155,a)||this.needPax:(this.needPax=yt(e,i+345,130,a)||this.needPax,this.needPax=La(e,i+476,12,this.atime)||this.needPax,this.needPax=La(e,i+488,12,this.ctime)||this.needPax);let c=256;for(let l=i;l<i+148;l++)c+=e[l];for(let l=i+156;l<i+512;l++)c+=e[l];return this.cksum=c,It(e,i+148,8,this.cksum),this.cksumValid=!0,this.needPax}get type(){return this.#e==="Unsupported"?this.#e:Kr.get(this.#e)}get typeKey(){return this.#e}set type(e){let i=String(Xl.get(e));if(Ur(i)||i==="Unsupported")this.#e=i;else if(Ur(e))this.#e=e;else throw new TypeError("invalid entry type: "+e)}},pm=(t,e)=>{let n=t,r="",o,a=Yi.parse(t).root||".";if(Buffer.byteLength(n)<100)o=[n,r,!1];else{r=Yi.dirname(n),n=Yi.basename(n);do Buffer.byteLength(n)<=100&&Buffer.byteLength(r)<=e?o=[n,r,!1]:Buffer.byteLength(n)>100&&Buffer.byteLength(r)<=e?o=[n.slice(0,99),r,!0]:(n=Yi.join(Yi.basename(r),n),r=Yi.dirname(r));while(r!==a&&o===void 0);o||(o=[t.slice(0,99),"",!0])}return o},Dt=(t,e,i)=>t.subarray(e,e+i).toString("utf8").replace(/\0.*/,""),Ha=(t,e,i)=>hm(Et(t,e,i)),hm=t=>t===void 0?void 0:new Date(t*1e3),Et=(t,e,i)=>Number(t[e])&128?yl(t.subarray(e,e+i)):zm(t,e,i),fm=t=>isNaN(t)?void 0:t,zm=(t,e,i)=>fm(parseInt(t.subarray(e,e+i).toString("utf8").replace(/\0.*$/,"").trim(),8)),Rm={12:8589934591,8:2097151},It=(t,e,i,n)=>n===void 0?!1:n>Rm[i]||n<0?(Dl(n,t.subarray(e,e+i)),!0):(dm(t,e,i,n),!1),dm=(t,e,i,n)=>t.write(jm(n,i),e,i,"ascii"),jm=(t,e)=>gm(Math.floor(t).toString(8),e),gm=(t,e)=>(t.length===e-1?t:new Array(e-t.length-1).join("0")+t+" ")+"\0",La=(t,e,i,n)=>n===void 0?!1:It(t,e,i,n.getTime()/1e3),xm=new Array(156).join("\0"),yt=(t,e,i,n)=>n===void 0?!1:(t.write(n+xm,e,i,"utf8"),n.length!==Buffer.byteLength(n)||n.length>i);import{basename as Gm}from"node:path";var pt=class t{atime;mtime;ctime;charset;comment;gid;uid;gname;uname;linkpath;dev;ino;nlink;path;size;mode;global;constructor(e,i=!1){this.atime=e.atime,this.charset=e.charset,this.comment=e.comment,this.ctime=e.ctime,this.dev=e.dev,this.gid=e.gid,this.global=i,this.gname=e.gname,this.ino=e.ino,this.linkpath=e.linkpath,this.mtime=e.mtime,this.nlink=e.nlink,this.path=e.path,this.size=e.size,this.uid=e.uid,this.uname=e.uname}encode(){let e=this.encodeBody();if(e==="")return Buffer.allocUnsafe(0);let i=Buffer.byteLength(e),n=512*Math.ceil(1+i/512),r=Buffer.allocUnsafe(n);for(let o=0;o<512;o++)r[o]=0;new ne({path:("PaxHeader/"+Gm(this.path??"")).slice(0,99),mode:this.mode||420,uid:this.uid,gid:this.gid,size:i,mtime:this.mtime,type:this.global?"GlobalExtendedHeader":"ExtendedHeader",linkpath:"",uname:this.uname||"",gname:this.gname||"",devmaj:0,devmin:0,atime:this.atime,ctime:this.ctime}).encode(r),r.write(e,512,i,"utf8");for(let o=i+512;o<r.length;o++)r[o]=0;return r}encodeBody(){return this.encodeField("path")+this.encodeField("ctime")+this.encodeField("atime")+this.encodeField("dev")+this.encodeField("ino")+this.encodeField("nlink")+this.encodeField("charset")+this.encodeField("comment")+this.encodeField("gid")+this.encodeField("gname")+this.encodeField("linkpath")+this.encodeField("mtime")+this.encodeField("size")+this.encodeField("uid")+this.encodeField("uname")}encodeField(e){if(this[e]===void 0)return"";let i=this[e],n=i instanceof Date?i.getTime()/1e3:i,r=" "+(e==="dev"||e==="ino"||e==="nlink"?"SCHILY.":"")+e+"="+n+`
18
- `,o=Buffer.byteLength(r),a=Math.floor(Math.log(o)/Math.log(10))+1;return o+a>=Math.pow(10,a)&&(a+=1),a+o+r}static parse(e,i,n=!1){return new t(Sm(Ym(e),i),n)}},Sm=(t,e)=>e?Object.assign({},e,t):t,Ym=t=>t.replace(/\n$/,"").split(`
19
- `).reduce(Wm,Object.create(null)),Wm=(t,e)=>{let i=parseInt(e,10);if(i!==Buffer.byteLength(e)+1)return t;e=e.slice((i+" ").length);let n=e.split("="),r=n.shift();if(!r)return t;let o=r.replace(/^SCHILY\.(dev|ino|nlink)/,"$1"),a=n.join("=");return t[o]=/^([A-Z]+\.)?([mac]|birth|creation)time$/.test(o)?new Date(Number(a)*1e3):/^[0-9]+$/.test(a)?+a:a,t};import{EventEmitter as rs}from"node:events";import t3 from"node:stream";import{StringDecoder as Mm}from"node:string_decoder";var Ll=typeof process=="object"&&process?process:{stdout:null,stderr:null},Cm=t=>!!t&&typeof t=="object"&&(t instanceof Ne||t instanceof t3||Om(t)||Um(t)),Om=t=>!!t&&typeof t=="object"&&t instanceof rs&&typeof t.pipe=="function"&&t.pipe!==t3.Writable.prototype.pipe,Um=t=>!!t&&typeof t=="object"&&t instanceof rs&&typeof t.write=="function"&&typeof t.end=="function",He=Symbol("EOF"),Le=Symbol("maybeEmitEnd"),ht=Symbol("emittedEnd"),Vr=Symbol("emittingEnd"),In=Symbol("emittedError"),Nr=Symbol("closed"),_l=Symbol("read"),kr=Symbol("flush"),$l=Symbol("flushChunk"),xe=Symbol("encoding"),Wi=Symbol("decoder"),b=Symbol("flowing"),pn=Symbol("paused"),Mi=Symbol("resume"),P=Symbol("buffer"),$=Symbol("pipes"),q=Symbol("bufferLength"),_a=Symbol("bufferPush"),Fr=Symbol("bufferShift"),T=Symbol("objectMode"),U=Symbol("destroyed"),$a=Symbol("error"),es=Symbol("emitData"),e3=Symbol("emitEnd"),ts=Symbol("emitEnd2"),Ve=Symbol("async"),is=Symbol("abort"),Qr=Symbol("aborted"),hn=Symbol("signal"),wt=Symbol("dataListeners"),re=Symbol("discarded"),fn=t=>Promise.resolve().then(t),Km=t=>t(),Vm=t=>t==="end"||t==="finish"||t==="prefinish",Nm=t=>t instanceof ArrayBuffer||!!t&&typeof t=="object"&&t.constructor&&t.constructor.name==="ArrayBuffer"&&t.byteLength>=0,km=t=>!Buffer.isBuffer(t)&&ArrayBuffer.isView(t),Jr=class{src;dest;opts;ondrain;constructor(e,i,n){this.src=e,this.dest=i,this.opts=n,this.ondrain=()=>e[Mi](),this.dest.on("drain",this.ondrain)}unpipe(){this.dest.removeListener("drain",this.ondrain)}proxyErrors(e){}end(){this.unpipe(),this.opts.end&&this.dest.end()}},ns=class extends Jr{unpipe(){this.src.removeListener("error",this.proxyErrors),super.unpipe()}constructor(e,i,n){super(e,i,n),this.proxyErrors=r=>i.emit("error",r),e.on("error",this.proxyErrors)}},Fm=t=>!!t.objectMode,Qm=t=>!t.objectMode&&!!t.encoding&&t.encoding!=="buffer",Ne=class extends rs{[b]=!1;[pn]=!1;[$]=[];[P]=[];[T];[xe];[Ve];[Wi];[He]=!1;[ht]=!1;[Vr]=!1;[Nr]=!1;[In]=null;[q]=0;[U]=!1;[hn];[Qr]=!1;[wt]=0;[re]=!1;writable=!0;readable=!0;constructor(...e){let i=e[0]||{};if(super(),i.objectMode&&typeof i.encoding=="string")throw new TypeError("Encoding and objectMode may not be used together");Fm(i)?(this[T]=!0,this[xe]=null):Qm(i)?(this[xe]=i.encoding,this[T]=!1):(this[T]=!1,this[xe]=null),this[Ve]=!!i.async,this[Wi]=this[xe]?new Mm(this[xe]):null,i&&i.debugExposeBuffer===!0&&Object.defineProperty(this,"buffer",{get:()=>this[P]}),i&&i.debugExposePipes===!0&&Object.defineProperty(this,"pipes",{get:()=>this[$]});let{signal:n}=i;n&&(this[hn]=n,n.aborted?this[is]():n.addEventListener("abort",()=>this[is]()))}get bufferLength(){return this[q]}get encoding(){return this[xe]}set encoding(e){throw new Error("Encoding must be set at instantiation time")}setEncoding(e){throw new Error("Encoding must be set at instantiation time")}get objectMode(){return this[T]}set objectMode(e){throw new Error("objectMode must be set at instantiation time")}get async(){return this[Ve]}set async(e){this[Ve]=this[Ve]||!!e}[is](){this[Qr]=!0,this.emit("abort",this[hn]?.reason),this.destroy(this[hn]?.reason)}get aborted(){return this[Qr]}set aborted(e){}write(e,i,n){if(this[Qr])return!1;if(this[He])throw new Error("write after end");if(this[U])return this.emit("error",Object.assign(new Error("Cannot call write after a stream was destroyed"),{code:"ERR_STREAM_DESTROYED"})),!0;typeof i=="function"&&(n=i,i="utf8"),i||(i="utf8");let r=this[Ve]?fn:Km;if(!this[T]&&!Buffer.isBuffer(e)){if(km(e))e=Buffer.from(e.buffer,e.byteOffset,e.byteLength);else if(Nm(e))e=Buffer.from(e);else if(typeof e!="string")throw new Error("Non-contiguous data written to non-objectMode stream")}return this[T]?(this[b]&&this[q]!==0&&this[kr](!0),this[b]?this.emit("data",e):this[_a](e),this[q]!==0&&this.emit("readable"),n&&r(n),this[b]):e.length?(typeof e=="string"&&!(i===this[xe]&&!this[Wi]?.lastNeed)&&(e=Buffer.from(e,i)),Buffer.isBuffer(e)&&this[xe]&&(e=this[Wi].write(e)),this[b]&&this[q]!==0&&this[kr](!0),this[b]?this.emit("data",e):this[_a](e),this[q]!==0&&this.emit("readable"),n&&r(n),this[b]):(this[q]!==0&&this.emit("readable"),n&&r(n),this[b])}read(e){if(this[U])return null;if(this[re]=!1,this[q]===0||e===0||e&&e>this[q])return this[Le](),null;this[T]&&(e=null),this[P].length>1&&!this[T]&&(this[P]=[this[xe]?this[P].join(""):Buffer.concat(this[P],this[q])]);let i=this[_l](e||null,this[P][0]);return this[Le](),i}[_l](e,i){if(this[T])this[Fr]();else{let n=i;e===n.length||e===null?this[Fr]():typeof n=="string"?(this[P][0]=n.slice(e),i=n.slice(0,e),this[q]-=e):(this[P][0]=n.subarray(e),i=n.subarray(0,e),this[q]-=e)}return this.emit("data",i),!this[P].length&&!this[He]&&this.emit("drain"),i}end(e,i,n){return typeof e=="function"&&(n=e,e=void 0),typeof i=="function"&&(n=i,i="utf8"),e!==void 0&&this.write(e,i),n&&this.once("end",n),this[He]=!0,this.writable=!1,(this[b]||!this[pn])&&this[Le](),this}[Mi](){this[U]||(!this[wt]&&!this[$].length&&(this[re]=!0),this[pn]=!1,this[b]=!0,this.emit("resume"),this[P].length?this[kr]():this[He]?this[Le]():this.emit("drain"))}resume(){return this[Mi]()}pause(){this[b]=!1,this[pn]=!0,this[re]=!1}get destroyed(){return this[U]}get flowing(){return this[b]}get paused(){return this[pn]}[_a](e){this[T]?this[q]+=1:this[q]+=e.length,this[P].push(e)}[Fr](){return this[T]?this[q]-=1:this[q]-=this[P][0].length,this[P].shift()}[kr](e=!1){do;while(this[$l](this[Fr]())&&this[P].length);!e&&!this[P].length&&!this[He]&&this.emit("drain")}[$l](e){return this.emit("data",e),this[b]}pipe(e,i){if(this[U])return e;this[re]=!1;let n=this[ht];return i=i||{},e===Ll.stdout||e===Ll.stderr?i.end=!1:i.end=i.end!==!1,i.proxyErrors=!!i.proxyErrors,n?i.end&&e.end():(this[$].push(i.proxyErrors?new ns(this,e,i):new Jr(this,e,i)),this[Ve]?fn(()=>this[Mi]()):this[Mi]()),e}unpipe(e){let i=this[$].find(n=>n.dest===e);i&&(this[$].length===1?(this[b]&&this[wt]===0&&(this[b]=!1),this[$]=[]):this[$].splice(this[$].indexOf(i),1),i.unpipe())}addListener(e,i){return this.on(e,i)}on(e,i){let n=super.on(e,i);if(e==="data")this[re]=!1,this[wt]++,!this[$].length&&!this[b]&&this[Mi]();else if(e==="readable"&&this[q]!==0)super.emit("readable");else if(Vm(e)&&this[ht])super.emit(e),this.removeAllListeners(e);else if(e==="error"&&this[In]){let r=i;this[Ve]?fn(()=>r.call(this,this[In])):r.call(this,this[In])}return n}removeListener(e,i){return this.off(e,i)}off(e,i){let n=super.off(e,i);return e==="data"&&(this[wt]=this.listeners("data").length,this[wt]===0&&!this[re]&&!this[$].length&&(this[b]=!1)),n}removeAllListeners(e){let i=super.removeAllListeners(e);return(e==="data"||e===void 0)&&(this[wt]=0,!this[re]&&!this[$].length&&(this[b]=!1)),i}get emittedEnd(){return this[ht]}[Le](){!this[Vr]&&!this[ht]&&!this[U]&&this[P].length===0&&this[He]&&(this[Vr]=!0,this.emit("end"),this.emit("prefinish"),this.emit("finish"),this[Nr]&&this.emit("close"),this[Vr]=!1)}emit(e,...i){let n=i[0];if(e!=="error"&&e!=="close"&&e!==U&&this[U])return!1;if(e==="data")return!this[T]&&!n?!1:this[Ve]?(fn(()=>this[es](n)),!0):this[es](n);if(e==="end")return this[e3]();if(e==="close"){if(this[Nr]=!0,!this[ht]&&!this[U])return!1;let o=super.emit("close");return this.removeAllListeners("close"),o}else if(e==="error"){this[In]=n,super.emit($a,n);let o=!this[hn]||this.listeners("error").length?super.emit("error",n):!1;return this[Le](),o}else if(e==="resume"){let o=super.emit("resume");return this[Le](),o}else if(e==="finish"||e==="prefinish"){let o=super.emit(e);return this.removeAllListeners(e),o}let r=super.emit(e,...i);return this[Le](),r}[es](e){for(let n of this[$])n.dest.write(e)===!1&&this.pause();let i=this[re]?!1:super.emit("data",e);return this[Le](),i}[e3](){return this[ht]?!1:(this[ht]=!0,this.readable=!1,this[Ve]?(fn(()=>this[ts]()),!0):this[ts]())}[ts](){if(this[Wi]){let i=this[Wi].end();if(i){for(let n of this[$])n.dest.write(i);this[re]||super.emit("data",i)}}for(let i of this[$])i.end();let e=super.emit("end");return this.removeAllListeners("end"),e}async collect(){let e=Object.assign([],{dataLength:0});this[T]||(e.dataLength=0);let i=this.promise();return this.on("data",n=>{e.push(n),this[T]||(e.dataLength+=n.length)}),await i,e}async concat(){if(this[T])throw new Error("cannot concat in objectMode");let e=await this.collect();return this[xe]?e.join(""):Buffer.concat(e,e.dataLength)}async promise(){return new Promise((e,i)=>{this.on(U,()=>i(new Error("stream destroyed"))),this.on("error",n=>i(n)),this.on("end",()=>e())})}[Symbol.asyncIterator](){this[re]=!1;let e=!1,i=async()=>(this.pause(),e=!0,{value:void 0,done:!0});return{next:()=>{if(e)return i();let r=this.read();if(r!==null)return Promise.resolve({done:!1,value:r});if(this[He])return i();let o,a,c=m=>{this.off("data",l),this.off("end",v),this.off(U,A),i(),a(m)},l=m=>{this.off("error",c),this.off("end",v),this.off(U,A),this.pause(),o({value:m,done:!!this[He]})},v=()=>{this.off("error",c),this.off("data",l),this.off(U,A),i(),o({done:!0,value:void 0})},A=()=>c(new Error("stream destroyed"));return new Promise((m,I)=>{a=I,o=m,this.once(U,A),this.once("error",c),this.once("end",v),this.once("data",l)})},throw:i,return:i,[Symbol.asyncIterator](){return this}}}[Symbol.iterator](){this[re]=!1;let e=!1,i=()=>(this.pause(),this.off($a,i),this.off(U,i),this.off("end",i),e=!0,{done:!0,value:void 0}),n=()=>{if(e)return i();let r=this.read();return r===null?i():{done:!1,value:r}};return this.once("end",i),this.once($a,i),this.once(U,i),{next:n,throw:i,return:i,[Symbol.iterator](){return this}}}destroy(e){if(this[U])return e?this.emit("error",e):this.emit(U),this;this[U]=!0,this[re]=!0,this[P].length=0,this[q]=0;let i=this;return typeof i.close=="function"&&!this[Nr]&&i.close(),e?this.emit("error",e):this.emit(U),this}static get isStream(){return Cm}};var Jm=process.env.TESTING_TAR_FAKE_PLATFORM||process.platform,R=Jm!=="win32"?t=>t:t=>t&&t.replace(/\\/g,"/");var Ci=class extends Ne{extended;globalExtended;header;startBlockSize;blockRemain;remain;type;meta=!1;ignore=!1;path;mode;uid;gid;uname;gname;size=0;mtime;atime;ctime;linkpath;dev;ino;nlink;invalid=!1;absolute;unsupported=!1;constructor(e,i,n){switch(super({}),this.pause(),this.extended=i,this.globalExtended=n,this.header=e,this.remain=e.size??0,this.startBlockSize=512*Math.ceil(this.remain/512),this.blockRemain=this.startBlockSize,this.type=e.type,this.type){case"File":case"OldFile":case"Link":case"SymbolicLink":case"CharacterDevice":case"BlockDevice":case"Directory":case"FIFO":case"ContiguousFile":case"GNUDumpDir":break;case"NextFileHasLongLinkpath":case"NextFileHasLongPath":case"OldGnuLongPath":case"GlobalExtendedHeader":case"ExtendedHeader":case"OldExtendedHeader":this.meta=!0;break;default:this.ignore=!0}if(!e.path)throw new Error("no path provided for tar.ReadEntry");this.path=R(e.path),this.mode=e.mode,this.mode&&(this.mode=this.mode&4095),this.uid=e.uid,this.gid=e.gid,this.uname=e.uname,this.gname=e.gname,this.size=this.remain,this.mtime=e.mtime,this.atime=e.atime,this.ctime=e.ctime,this.linkpath=e.linkpath?R(e.linkpath):void 0,this.uname=e.uname,this.gname=e.gname,i&&this.#e(i),n&&this.#e(n,!0)}write(e){let i=e.length;if(i>this.blockRemain)throw new Error("writing more to entry than is appropriate");let n=this.remain,r=this.blockRemain;return this.remain=Math.max(0,n-i),this.blockRemain=Math.max(0,r-i),this.ignore?!0:n>=i?super.write(e):super.write(e.subarray(0,n))}#e(e,i=!1){e.path&&(e.path=R(e.path)),e.linkpath&&(e.linkpath=R(e.linkpath)),Object.assign(this,Object.fromEntries(Object.entries(e).filter(([n,r])=>!(r==null||n==="path"&&i))))}};var Tt=(t,e,i,n={})=>{t.file&&(n.file=t.file),t.cwd&&(n.cwd=t.cwd),n.code=i instanceof Error&&i.code||e,n.tarCode=e,!t.strict&&n.recoverable!==!1?(i instanceof Error&&(n=Object.assign(i,n),i=i.message),t.emit("warn",e,i,n)):i instanceof Error?t.emit("error",Object.assign(i,n)):t.emit("error",Object.assign(new Error(`${e}: ${i}`),n))};var Zm=1024*1024,ls=Buffer.from([31,139]),vs=Buffer.from([40,181,47,253]),bm=Math.max(ls.length,vs.length),ue=Symbol("state"),Xt=Symbol("writeEntry"),_e=Symbol("readEntry"),os=Symbol("nextEntry"),i3=Symbol("processEntry"),ke=Symbol("extendedHeader"),zn=Symbol("globalExtendedHeader"),ft=Symbol("meta"),n3=Symbol("emitMeta"),x=Symbol("buffer"),$e=Symbol("queue"),zt=Symbol("ended"),as=Symbol("emittedEnd"),Ht=Symbol("emit"),K=Symbol("unzip"),Br=Symbol("consumeChunk"),Zr=Symbol("consumeChunkSub"),ss=Symbol("consumeBody"),r3=Symbol("consumeMeta"),o3=Symbol("consumeHeader"),Rn=Symbol("consuming"),cs=Symbol("bufferConcat"),br=Symbol("maybeEnd"),Oi=Symbol("writing"),Rt=Symbol("aborted"),Pr=Symbol("onDone"),Lt=Symbol("sawValidEntry"),qr=Symbol("sawNullBlock"),Dr=Symbol("sawEOF"),a3=Symbol("closeStream"),Pm=()=>!0,et=class extends Bm{file;strict;maxMetaEntrySize;filter;brotli;zstd;writable=!0;readable=!1;[$e]=[];[x];[_e];[Xt];[ue]="begin";[ft]="";[ke];[zn];[zt]=!1;[K];[Rt]=!1;[Lt];[qr]=!1;[Dr]=!1;[Oi]=!1;[Rn]=!1;[as]=!1;constructor(e={}){super(),this.file=e.file||"",this.on(Pr,()=>{(this[ue]==="begin"||this[Lt]===!1)&&this.warn("TAR_BAD_ARCHIVE","Unrecognized archive format")}),e.ondone?this.on(Pr,e.ondone):this.on(Pr,()=>{this.emit("prefinish"),this.emit("finish"),this.emit("end")}),this.strict=!!e.strict,this.maxMetaEntrySize=e.maxMetaEntrySize||Zm,this.filter=typeof e.filter=="function"?e.filter:Pm;let i=e.file&&(e.file.endsWith(".tar.br")||e.file.endsWith(".tbr"));this.brotli=!(e.gzip||e.zstd)&&e.brotli!==void 0?e.brotli:i?void 0:!1;let n=e.file&&(e.file.endsWith(".tar.zst")||e.file.endsWith(".tzst"));this.zstd=!(e.gzip||e.brotli)&&e.zstd!==void 0?e.zstd:n?!0:void 0,this.on("end",()=>this[a3]()),typeof e.onwarn=="function"&&this.on("warn",e.onwarn),typeof e.onReadEntry=="function"&&this.on("entry",e.onReadEntry)}warn(e,i,n={}){Tt(this,e,i,n)}[o3](e,i){this[Lt]===void 0&&(this[Lt]=!1);let n;try{n=new ne(e,i,this[ke],this[zn])}catch(r){return this.warn("TAR_ENTRY_INVALID",r)}if(n.nullBlock)this[qr]?(this[Dr]=!0,this[ue]==="begin"&&(this[ue]="header"),this[Ht]("eof")):(this[qr]=!0,this[Ht]("nullBlock"));else if(this[qr]=!1,!n.cksumValid)this.warn("TAR_ENTRY_INVALID","checksum failure",{header:n});else if(!n.path)this.warn("TAR_ENTRY_INVALID","path is required",{header:n});else{let r=n.type;if(/^(Symbolic)?Link$/.test(r)&&!n.linkpath)this.warn("TAR_ENTRY_INVALID","linkpath required",{header:n});else if(!/^(Symbolic)?Link$/.test(r)&&!/^(Global)?ExtendedHeader$/.test(r)&&n.linkpath)this.warn("TAR_ENTRY_INVALID","linkpath forbidden",{header:n});else{let o=this[Xt]=new Ci(n,this[ke],this[zn]);if(!this[Lt])if(o.remain){let a=()=>{o.invalid||(this[Lt]=!0)};o.on("end",a)}else this[Lt]=!0;o.meta?o.size>this.maxMetaEntrySize?(o.ignore=!0,this[Ht]("ignoredEntry",o),this[ue]="ignore",o.resume()):o.size>0&&(this[ft]="",o.on("data",a=>this[ft]+=a),this[ue]="meta"):(this[ke]=void 0,o.ignore=o.ignore||!this.filter(o.path,o),o.ignore?(this[Ht]("ignoredEntry",o),this[ue]=o.remain?"ignore":"header",o.resume()):(o.remain?this[ue]="body":(this[ue]="header",o.end()),this[_e]?this[$e].push(o):(this[$e].push(o),this[os]())))}}}[a3](){queueMicrotask(()=>this.emit("close"))}[i3](e){let i=!0;if(!e)this[_e]=void 0,i=!1;else if(Array.isArray(e)){let[n,...r]=e;this.emit(n,...r)}else this[_e]=e,this.emit("entry",e),e.emittedEnd||(e.on("end",()=>this[os]()),i=!1);return i}[os](){do;while(this[i3](this[$e].shift()));if(!this[$e].length){let e=this[_e];!e||e.flowing||e.size===e.remain?this[Oi]||this.emit("drain"):e.once("drain",()=>this.emit("drain"))}}[ss](e,i){let n=this[Xt];if(!n)throw new Error("attempt to consume body without entry??");let r=n.blockRemain??0,o=r>=e.length&&i===0?e:e.subarray(i,i+r);return n.write(o),n.blockRemain||(this[ue]="header",this[Xt]=void 0,n.end()),o.length}[r3](e,i){let n=this[Xt],r=this[ss](e,i);return!this[Xt]&&n&&this[n3](n),r}[Ht](e,i,n){!this[$e].length&&!this[_e]?this.emit(e,i,n):this[$e].push([e,i,n])}[n3](e){switch(this[Ht]("meta",this[ft]),e.type){case"ExtendedHeader":case"OldExtendedHeader":this[ke]=pt.parse(this[ft],this[ke],!1);break;case"GlobalExtendedHeader":this[zn]=pt.parse(this[ft],this[zn],!0);break;case"NextFileHasLongPath":case"OldGnuLongPath":{let i=this[ke]??Object.create(null);this[ke]=i,i.path=this[ft].replace(/\0.*/,"");break}case"NextFileHasLongLinkpath":{let i=this[ke]||Object.create(null);this[ke]=i,i.linkpath=this[ft].replace(/\0.*/,"");break}default:throw new Error("unknown meta: "+e.type)}}abort(e){this[Rt]=!0,this.emit("abort",e),this.warn("TAR_ABORT",e,{recoverable:!1})}write(e,i,n){if(typeof i=="function"&&(n=i,i=void 0),typeof e=="string"&&(e=Buffer.from(e,typeof i=="string"?i:"utf8")),this[Rt])return n?.(),!1;if((this[K]===void 0||this.brotli===void 0&&this[K]===!1)&&e){if(this[x]&&(e=Buffer.concat([this[x],e]),this[x]=void 0),e.length<bm)return this[x]=e,n?.(),!0;for(let l=0;this[K]===void 0&&l<ls.length;l++)e[l]!==ls[l]&&(this[K]=!1);let a=!1;if(this[K]===!1&&this.zstd!==!1){a=!0;for(let l=0;l<vs.length;l++)if(e[l]!==vs[l]){a=!1;break}}let c=this.brotli===void 0&&!a;if(this[K]===!1&&c)if(e.length<512)if(this[zt])this.brotli=!0;else return this[x]=e,n?.(),!0;else try{new ne(e.subarray(0,512)),this.brotli=!1}catch{this.brotli=!0}if(this[K]===void 0||this[K]===!1&&(this.brotli||a)){let l=this[zt];this[zt]=!1,this[K]=this[K]===void 0?new Gr({}):a?new Or({}):new Wr({}),this[K].on("data",A=>this[Br](A)),this[K].on("error",A=>this.abort(A)),this[K].on("end",()=>{this[zt]=!0,this[Br]()}),this[Oi]=!0;let v=!!this[K][l?"end":"write"](e);return this[Oi]=!1,n?.(),v}}this[Oi]=!0,this[K]?this[K].write(e):this[Br](e),this[Oi]=!1;let o=this[$e].length?!1:this[_e]?this[_e].flowing:!0;return!o&&!this[$e].length&&this[_e]?.once("drain",()=>this.emit("drain")),n?.(),o}[cs](e){e&&!this[Rt]&&(this[x]=this[x]?Buffer.concat([this[x],e]):e)}[br](){if(this[zt]&&!this[as]&&!this[Rt]&&!this[Rn]){this[as]=!0;let e=this[Xt];if(e&&e.blockRemain){let i=this[x]?this[x].length:0;this.warn("TAR_BAD_ARCHIVE",`Truncated input (needed ${e.blockRemain} more bytes, only ${i} available)`,{entry:e}),this[x]&&e.write(this[x]),e.end()}this[Ht](Pr)}}[Br](e){if(this[Rn]&&e)this[cs](e);else if(!e&&!this[x])this[br]();else if(e){if(this[Rn]=!0,this[x]){this[cs](e);let i=this[x];this[x]=void 0,this[Zr](i)}else this[Zr](e);for(;this[x]&&this[x]?.length>=512&&!this[Rt]&&!this[Dr];){let i=this[x];this[x]=void 0,this[Zr](i)}this[Rn]=!1}(!this[x]||this[zt])&&this[br]()}[Zr](e){let i=0,n=e.length;for(;i+512<=n&&!this[Rt]&&!this[Dr];)switch(this[ue]){case"begin":case"header":this[o3](e,i),i+=512;break;case"ignore":case"body":i+=this[ss](e,i);break;case"meta":i+=this[r3](e,i);break;default:throw new Error("invalid state: "+this[ue])}i<n&&(this[x]?this[x]=Buffer.concat([e.subarray(i),this[x]]):this[x]=e.subarray(i))}end(e,i,n){return typeof e=="function"&&(n=e,i=void 0,e=void 0),typeof i=="function"&&(n=i,i=void 0),typeof e=="string"&&(e=Buffer.from(e,i)),n&&this.once("finish",n),this[Rt]||(this[K]?(e&&this[K].write(e),this[K].end()):(this[zt]=!0,(this.brotli===void 0||this.zstd===void 0)&&(e=e||Buffer.alloc(0)),e&&this.write(e),this[br]())),this}};var dt=t=>{let e=t.length-1,i=-1;for(;e>-1&&t.charAt(e)==="/";)i=e,e--;return i===-1?t:t.slice(0,i)};var ym=t=>{let e=t.onReadEntry;t.onReadEntry=e?i=>{e(i),i.resume()}:i=>i.resume()},As=(t,e)=>{let i=new Map(e.map(o=>[dt(o),!0])),n=t.filter,r=(o,a="")=>{let c=a||Dm(o).root||".",l;if(o===c)l=!1;else{let v=i.get(o);v!==void 0?l=v:l=r(qm(o),c)}return i.set(o,l),l};t.filter=n?(o,a)=>n(o,a)&&r(dt(o)):o=>r(dt(o))},wm=t=>{let e=new et(t),i=t.file,n;try{n=Ui.openSync(i,"r");let r=Ui.fstatSync(n),o=t.maxReadSize||16*1024*1024;if(r.size<o){let a=Buffer.allocUnsafe(r.size),c=Ui.readSync(n,a,0,r.size,0);e.end(c===a.byteLength?a:a.subarray(0,c))}else{let a=0,c=Buffer.allocUnsafe(o);for(;a<r.size;){let l=Ui.readSync(n,c,0,o,a);if(l===0)break;a+=l,e.write(c.subarray(0,l))}e.end()}}finally{if(typeof n=="number")try{Ui.closeSync(n)}catch{}}},Tm=(t,e)=>{let i=new et(t),n=t.maxReadSize||16*1024*1024,r=t.file;return new Promise((a,c)=>{i.on("error",c),i.on("end",a),Ui.stat(r,(l,v)=>{if(l)c(l);else{let A=new Zt(r,{readSize:n,size:v.size});A.on("error",c),A.pipe(i)}})})},_t=Ue(wm,Tm,t=>new et(t),t=>new et(t),(t,e)=>{e?.length&&As(t,e),t.noResume||ym(t)});import ro from"fs";import Fe from"fs";import v3 from"path";var ms=(t,e,i)=>(t&=4095,i&&(t=(t|384)&-19),e&&(t&256&&(t|=64),t&32&&(t|=8),t&4&&(t|=1)),t);import{win32 as Xm}from"node:path";var{isAbsolute:Hm,parse:s3}=Xm,dn=t=>{let e="",i=s3(t);for(;Hm(t)||i.root;){let n=t.charAt(0)==="/"&&t.slice(0,4)!=="//?/"?"/":i.root;t=t.slice(n.length),e+=n,i=s3(t)}return[e,t]};var yr=["|","<",">","?",":"],us=yr.map(t=>String.fromCharCode(61440+t.charCodeAt(0))),Lm=new Map(yr.map((t,e)=>[t,us[e]])),_m=new Map(us.map((t,e)=>[t,yr[e]])),Es=t=>yr.reduce((e,i)=>e.split(i).join(Lm.get(i)),t),c3=t=>us.reduce((e,i)=>e.split(i).join(_m.get(i)),t);var I3=(t,e)=>e?(t=R(t).replace(/^\.(\/|$)/,""),dt(e)+"/"+t):R(t),$m=16*1024*1024,A3=Symbol("process"),m3=Symbol("file"),u3=Symbol("directory"),ps=Symbol("symlink"),E3=Symbol("hardlink"),jn=Symbol("header"),wr=Symbol("read"),hs=Symbol("lstat"),Tr=Symbol("onlstat"),fs=Symbol("onread"),zs=Symbol("onreadlink"),Rs=Symbol("openfile"),ds=Symbol("onopenfile"),jt=Symbol("close"),Xr=Symbol("mode"),js=Symbol("awaitDrain"),Is=Symbol("ondrain"),Qe=Symbol("prefix"),gn=class extends Ne{path;portable;myuid=process.getuid&&process.getuid()||0;myuser=process.env.USER||"";maxReadSize;linkCache;statCache;preservePaths;cwd;strict;mtime;noPax;noMtime;prefix;fd;blockLen=0;blockRemain=0;buf;pos=0;remain=0;length=0;offset=0;win32;absolute;header;type;linkpath;stat;onWriteEntry;#e=!1;constructor(e,i={}){let n=cn(i);super(),this.path=R(e),this.portable=!!n.portable,this.maxReadSize=n.maxReadSize||$m,this.linkCache=n.linkCache||new Map,this.statCache=n.statCache||new Map,this.preservePaths=!!n.preservePaths,this.cwd=R(n.cwd||process.cwd()),this.strict=!!n.strict,this.noPax=!!n.noPax,this.noMtime=!!n.noMtime,this.mtime=n.mtime,this.prefix=n.prefix?R(n.prefix):void 0,this.onWriteEntry=n.onWriteEntry,typeof n.onwarn=="function"&&this.on("warn",n.onwarn);let r=!1;if(!this.preservePaths){let[a,c]=dn(this.path);a&&typeof c=="string"&&(this.path=c,r=a)}this.win32=!!n.win32||process.platform==="win32",this.win32&&(this.path=c3(this.path.replace(/\\/g,"/")),e=e.replace(/\\/g,"/")),this.absolute=R(n.absolute||v3.resolve(this.cwd,e)),this.path===""&&(this.path="./"),r&&this.warn("TAR_ENTRY_INFO",`stripping ${r} from absolute path`,{entry:this,path:r+this.path});let o=this.statCache.get(this.absolute);o?this[Tr](o):this[hs]()}warn(e,i,n={}){return Tt(this,e,i,n)}emit(e,...i){return e==="error"&&(this.#e=!0),super.emit(e,...i)}[hs](){Fe.lstat(this.absolute,(e,i)=>{if(e)return this.emit("error",e);this[Tr](i)})}[Tr](e){this.statCache.set(this.absolute,e),this.stat=e,e.isFile()||(e.size=0),this.type=eu(e),this.emit("stat",e),this[A3]()}[A3](){switch(this.type){case"File":return this[m3]();case"Directory":return this[u3]();case"SymbolicLink":return this[ps]();default:return this.end()}}[Xr](e){return ms(e,this.type==="Directory",this.portable)}[Qe](e){return I3(e,this.prefix)}[jn](){if(!this.stat)throw new Error("cannot write header before stat");this.type==="Directory"&&this.portable&&(this.noMtime=!0),this.onWriteEntry?.(this),this.header=new ne({path:this[Qe](this.path),linkpath:this.type==="Link"&&this.linkpath!==void 0?this[Qe](this.linkpath):this.linkpath,mode:this[Xr](this.stat.mode),uid:this.portable?void 0:this.stat.uid,gid:this.portable?void 0:this.stat.gid,size:this.stat.size,mtime:this.noMtime?void 0:this.mtime||this.stat.mtime,type:this.type==="Unsupported"?void 0:this.type,uname:this.portable?void 0:this.stat.uid===this.myuid?this.myuser:"",atime:this.portable?void 0:this.stat.atime,ctime:this.portable?void 0:this.stat.ctime}),this.header.encode()&&!this.noPax&&super.write(new pt({atime:this.portable?void 0:this.header.atime,ctime:this.portable?void 0:this.header.ctime,gid:this.portable?void 0:this.header.gid,mtime:this.noMtime?void 0:this.mtime||this.header.mtime,path:this[Qe](this.path),linkpath:this.type==="Link"&&this.linkpath!==void 0?this[Qe](this.linkpath):this.linkpath,size:this.header.size,uid:this.portable?void 0:this.header.uid,uname:this.portable?void 0:this.header.uname,dev:this.portable?void 0:this.stat.dev,ino:this.portable?void 0:this.stat.ino,nlink:this.portable?void 0:this.stat.nlink}).encode());let e=this.header?.block;if(!e)throw new Error("failed to encode header");super.write(e)}[u3](){if(!this.stat)throw new Error("cannot create directory entry without stat");this.path.slice(-1)!=="/"&&(this.path+="/"),this.stat.size=0,this[jn](),this.end()}[ps](){Fe.readlink(this.absolute,(e,i)=>{if(e)return this.emit("error",e);this[zs](i)})}[zs](e){this.linkpath=R(e),this[jn](),this.end()}[E3](e){if(!this.stat)throw new Error("cannot create link entry without stat");this.type="Link",this.linkpath=R(v3.relative(this.cwd,e)),this.stat.size=0,this[jn](),this.end()}[m3](){if(!this.stat)throw new Error("cannot create file entry without stat");if(this.stat.nlink>1){let e=`${this.stat.dev}:${this.stat.ino}`,i=this.linkCache.get(e);if(i?.indexOf(this.cwd)===0)return this[E3](i);this.linkCache.set(e,this.absolute)}if(this[jn](),this.stat.size===0)return this.end();this[Rs]()}[Rs](){Fe.open(this.absolute,"r",(e,i)=>{if(e)return this.emit("error",e);this[ds](i)})}[ds](e){if(this.fd=e,this.#e)return this[jt]();if(!this.stat)throw new Error("should stat before calling onopenfile");this.blockLen=512*Math.ceil(this.stat.size/512),this.blockRemain=this.blockLen;let i=Math.min(this.blockLen,this.maxReadSize);this.buf=Buffer.allocUnsafe(i),this.offset=0,this.pos=0,this.remain=this.stat.size,this.length=this.buf.length,this[wr]()}[wr](){let{fd:e,buf:i,offset:n,length:r,pos:o}=this;if(e===void 0||i===void 0)throw new Error("cannot read file without first opening");Fe.read(e,i,n,r,o,(a,c)=>{if(a)return this[jt](()=>this.emit("error",a));this[fs](c)})}[jt](e=()=>{}){this.fd!==void 0&&Fe.close(this.fd,e)}[fs](e){if(e<=0&&this.remain>0){let r=Object.assign(new Error("encountered unexpected EOF"),{path:this.absolute,syscall:"read",code:"EOF"});return this[jt](()=>this.emit("error",r))}if(e>this.remain){let r=Object.assign(new Error("did not encounter expected EOF"),{path:this.absolute,syscall:"read",code:"EOF"});return this[jt](()=>this.emit("error",r))}if(!this.buf)throw new Error("should have created buffer prior to reading");if(e===this.remain)for(let r=e;r<this.length&&e<this.blockRemain;r++)this.buf[r+this.offset]=0,e++,this.remain++;let i=this.offset===0&&e===this.buf.length?this.buf:this.buf.subarray(this.offset,this.offset+e);this.write(i)?this[Is]():this[js](()=>this[Is]())}[js](e){this.once("drain",e)}write(e,i,n){if(typeof i=="function"&&(n=i,i=void 0),typeof e=="string"&&(e=Buffer.from(e,typeof i=="string"?i:"utf8")),this.blockRemain<e.length){let r=Object.assign(new Error("writing more data than expected"),{path:this.absolute});return this.emit("error",r)}return this.remain-=e.length,this.blockRemain-=e.length,this.pos+=e.length,this.offset+=e.length,super.write(e,null,n)}[Is](){if(!this.remain)return this.blockRemain&&super.write(Buffer.alloc(this.blockRemain)),this[jt](e=>e?this.emit("error",e):this.end());if(!this.buf)throw new Error("buffer lost somehow in ONDRAIN");this.offset>=this.length&&(this.buf=Buffer.allocUnsafe(Math.min(this.blockRemain,this.buf.length)),this.offset=0),this.length=this.buf.length-this.offset,this[wr]()}},Hr=class extends gn{sync=!0;[hs](){this[Tr](Fe.lstatSync(this.absolute))}[ps](){this[zs](Fe.readlinkSync(this.absolute))}[Rs](){this[ds](Fe.openSync(this.absolute,"r"))}[wr](){let e=!0;try{let{fd:i,buf:n,offset:r,length:o,pos:a}=this;if(i===void 0||n===void 0)throw new Error("fd and buf must be set in READ method");let c=Fe.readSync(i,n,r,o,a);this[fs](c),e=!1}finally{if(e)try{this[jt](()=>{})}catch{}}}[js](e){e()}[jt](e=()=>{}){this.fd!==void 0&&Fe.closeSync(this.fd),e()}},Lr=class extends Ne{blockLen=0;blockRemain=0;buf=0;pos=0;remain=0;length=0;preservePaths;portable;strict;noPax;noMtime;readEntry;type;prefix;path;mode;uid;gid;uname;gname;header;mtime;atime;ctime;linkpath;size;onWriteEntry;warn(e,i,n={}){return Tt(this,e,i,n)}constructor(e,i={}){let n=cn(i);super(),this.preservePaths=!!n.preservePaths,this.portable=!!n.portable,this.strict=!!n.strict,this.noPax=!!n.noPax,this.noMtime=!!n.noMtime,this.onWriteEntry=n.onWriteEntry,this.readEntry=e;let{type:r}=e;if(r==="Unsupported")throw new Error("writing entry that should be ignored");this.type=r,this.type==="Directory"&&this.portable&&(this.noMtime=!0),this.prefix=n.prefix,this.path=R(e.path),this.mode=e.mode!==void 0?this[Xr](e.mode):void 0,this.uid=this.portable?void 0:e.uid,this.gid=this.portable?void 0:e.gid,this.uname=this.portable?void 0:e.uname,this.gname=this.portable?void 0:e.gname,this.size=e.size,this.mtime=this.noMtime?void 0:n.mtime||e.mtime,this.atime=this.portable?void 0:e.atime,this.ctime=this.portable?void 0:e.ctime,this.linkpath=e.linkpath!==void 0?R(e.linkpath):void 0,typeof n.onwarn=="function"&&this.on("warn",n.onwarn);let o=!1;if(!this.preservePaths){let[c,l]=dn(this.path);c&&typeof l=="string"&&(this.path=l,o=c)}this.remain=e.size,this.blockRemain=e.startBlockSize,this.onWriteEntry?.(this),this.header=new ne({path:this[Qe](this.path),linkpath:this.type==="Link"&&this.linkpath!==void 0?this[Qe](this.linkpath):this.linkpath,mode:this.mode,uid:this.portable?void 0:this.uid,gid:this.portable?void 0:this.gid,size:this.size,mtime:this.noMtime?void 0:this.mtime,type:this.type,uname:this.portable?void 0:this.uname,atime:this.portable?void 0:this.atime,ctime:this.portable?void 0:this.ctime}),o&&this.warn("TAR_ENTRY_INFO",`stripping ${o} from absolute path`,{entry:this,path:o+this.path}),this.header.encode()&&!this.noPax&&super.write(new pt({atime:this.portable?void 0:this.atime,ctime:this.portable?void 0:this.ctime,gid:this.portable?void 0:this.gid,mtime:this.noMtime?void 0:this.mtime,path:this[Qe](this.path),linkpath:this.type==="Link"&&this.linkpath!==void 0?this[Qe](this.linkpath):this.linkpath,size:this.size,uid:this.portable?void 0:this.uid,uname:this.portable?void 0:this.uname,dev:this.portable?void 0:this.readEntry.dev,ino:this.portable?void 0:this.readEntry.ino,nlink:this.portable?void 0:this.readEntry.nlink}).encode());let a=this.header?.block;if(!a)throw new Error("failed to encode header");super.write(a),e.pipe(this)}[Qe](e){return I3(e,this.prefix)}[Xr](e){return ms(e,this.type==="Directory",this.portable)}write(e,i,n){typeof i=="function"&&(n=i,i=void 0),typeof e=="string"&&(e=Buffer.from(e,typeof i=="string"?i:"utf8"));let r=e.length;if(r>this.blockRemain)throw new Error("writing more to entry than is appropriate");return this.blockRemain-=r,super.write(e,n)}end(e,i,n){return this.blockRemain&&super.write(Buffer.alloc(this.blockRemain)),typeof e=="function"&&(n=e,i=void 0,e=void 0),typeof i=="function"&&(n=i,i=void 0),typeof e=="string"&&(e=Buffer.from(e,i??"utf8")),n&&this.once("finish",n),e?super.end(e,n):super.end(n),this}},eu=t=>t.isFile()?"File":t.isDirectory()?"Directory":t.isSymbolicLink()?"SymbolicLink":"Unsupported";var _r=class t{tail;head;length=0;static create(e=[]){return new t(e)}constructor(e=[]){for(let i of e)this.push(i)}*[Symbol.iterator](){for(let e=this.head;e;e=e.next)yield e.value}removeNode(e){if(e.list!==this)throw new Error("removing node which does not belong to this list");let i=e.next,n=e.prev;return i&&(i.prev=n),n&&(n.next=i),e===this.head&&(this.head=i),e===this.tail&&(this.tail=n),this.length--,e.next=void 0,e.prev=void 0,e.list=void 0,i}unshiftNode(e){if(e===this.head)return;e.list&&e.list.removeNode(e);let i=this.head;e.list=this,e.next=i,i&&(i.prev=e),this.head=e,this.tail||(this.tail=e),this.length++}pushNode(e){if(e===this.tail)return;e.list&&e.list.removeNode(e);let i=this.tail;e.list=this,e.prev=i,i&&(i.next=e),this.tail=e,this.head||(this.head=e),this.length++}push(...e){for(let i=0,n=e.length;i<n;i++)iu(this,e[i]);return this.length}unshift(...e){for(var i=0,n=e.length;i<n;i++)nu(this,e[i]);return this.length}pop(){if(!this.tail)return;let e=this.tail.value,i=this.tail;return this.tail=this.tail.prev,this.tail?this.tail.next=void 0:this.head=void 0,i.list=void 0,this.length--,e}shift(){if(!this.head)return;let e=this.head.value,i=this.head;return this.head=this.head.next,this.head?this.head.prev=void 0:this.tail=void 0,i.list=void 0,this.length--,e}forEach(e,i){i=i||this;for(let n=this.head,r=0;n;r++)e.call(i,n.value,r,this),n=n.next}forEachReverse(e,i){i=i||this;for(let n=this.tail,r=this.length-1;n;r--)e.call(i,n.value,r,this),n=n.prev}get(e){let i=0,n=this.head;for(;n&&i<e;i++)n=n.next;if(i===e&&n)return n.value}getReverse(e){let i=0,n=this.tail;for(;n&&i<e;i++)n=n.prev;if(i===e&&n)return n.value}map(e,i){i=i||this;let n=new t;for(let r=this.head;r;)n.push(e.call(i,r.value,this)),r=r.next;return n}mapReverse(e,i){i=i||this;var n=new t;for(let r=this.tail;r;)n.push(e.call(i,r.value,this)),r=r.prev;return n}reduce(e,i){let n,r=this.head;if(arguments.length>1)n=i;else if(this.head)r=this.head.next,n=this.head.value;else throw new TypeError("Reduce of empty list with no initial value");for(var o=0;r;o++)n=e(n,r.value,o),r=r.next;return n}reduceReverse(e,i){let n,r=this.tail;if(arguments.length>1)n=i;else if(this.tail)r=this.tail.prev,n=this.tail.value;else throw new TypeError("Reduce of empty list with no initial value");for(let o=this.length-1;r;o--)n=e(n,r.value,o),r=r.prev;return n}toArray(){let e=new Array(this.length);for(let i=0,n=this.head;n;i++)e[i]=n.value,n=n.next;return e}toArrayReverse(){let e=new Array(this.length);for(let i=0,n=this.tail;n;i++)e[i]=n.value,n=n.prev;return e}slice(e=0,i=this.length){i<0&&(i+=this.length),e<0&&(e+=this.length);let n=new t;if(i<e||i<0)return n;e<0&&(e=0),i>this.length&&(i=this.length);let r=this.head,o=0;for(o=0;r&&o<e;o++)r=r.next;for(;r&&o<i;o++,r=r.next)n.push(r.value);return n}sliceReverse(e=0,i=this.length){i<0&&(i+=this.length),e<0&&(e+=this.length);let n=new t;if(i<e||i<0)return n;e<0&&(e=0),i>this.length&&(i=this.length);let r=this.length,o=this.tail;for(;o&&r>i;r--)o=o.prev;for(;o&&r>e;r--,o=o.prev)n.push(o.value);return n}splice(e,i=0,...n){e>this.length&&(e=this.length-1),e<0&&(e=this.length+e);let r=this.head;for(let a=0;r&&a<e;a++)r=r.next;let o=[];for(let a=0;r&&a<i;a++)o.push(r.value),r=this.removeNode(r);r?r!==this.tail&&(r=r.prev):r=this.tail;for(let a of n)r=tu(this,r,a);return o}reverse(){let e=this.head,i=this.tail;for(let n=e;n;n=n.prev){let r=n.prev;n.prev=n.next,n.next=r}return this.head=i,this.tail=e,this}};function tu(t,e,i){let n=e,r=e?e.next:t.head,o=new xn(i,n,r,t);return o.next===void 0&&(t.tail=o),o.prev===void 0&&(t.head=o),t.length++,o}function iu(t,e){t.tail=new xn(e,t.tail,void 0,t),t.head||(t.head=t.tail),t.length++}function nu(t,e){t.head=new xn(e,void 0,t.head,t),t.tail||(t.tail=t.head),t.length++}var xn=class{list;next;prev;value;constructor(e,i,n,r){this.list=r,this.value=e,i?(i.next=this,this.prev=i):this.prev=void 0,n?(n.prev=this,this.next=n):this.next=void 0}};import R3 from"path";var oo=class{path;absolute;entry;stat;readdir;pending=!1;ignore=!1;piped=!1;constructor(e,i){this.path=e||"./",this.absolute=i}},p3=Buffer.alloc(1024),$r=Symbol("onStat"),Gn=Symbol("ended"),Ge=Symbol("queue"),Ki=Symbol("current"),$t=Symbol("process"),Sn=Symbol("processing"),h3=Symbol("processJob"),Se=Symbol("jobs"),gs=Symbol("jobDone"),eo=Symbol("addFSEntry"),f3=Symbol("addTarEntry"),Ss=Symbol("stat"),Ys=Symbol("readdir"),to=Symbol("onreaddir"),io=Symbol("pipe"),z3=Symbol("entry"),xs=Symbol("entryOpt"),no=Symbol("writeEntryClass"),d3=Symbol("write"),Gs=Symbol("ondrain"),gt=class extends Ne{opt;cwd;maxReadSize;preservePaths;strict;noPax;prefix;linkCache;statCache;file;portable;zip;readdirCache;noDirRecurse;follow;noMtime;mtime;filter;jobs;[no];onWriteEntry;[Ge];[Se]=0;[Sn]=!1;[Gn]=!1;constructor(e={}){if(super(),this.opt=e,this.file=e.file||"",this.cwd=e.cwd||process.cwd(),this.maxReadSize=e.maxReadSize,this.preservePaths=!!e.preservePaths,this.strict=!!e.strict,this.noPax=!!e.noPax,this.prefix=R(e.prefix||""),this.linkCache=e.linkCache||new Map,this.statCache=e.statCache||new Map,this.readdirCache=e.readdirCache||new Map,this.onWriteEntry=e.onWriteEntry,this[no]=gn,typeof e.onwarn=="function"&&this.on("warn",e.onwarn),this.portable=!!e.portable,e.gzip||e.brotli||e.zstd){if((e.gzip?1:0)+(e.brotli?1:0)+(e.zstd?1:0)>1)throw new TypeError("gzip, brotli, zstd are mutually exclusive");if(e.gzip&&(typeof e.gzip!="object"&&(e.gzip={}),this.portable&&(e.gzip.portable=!0),this.zip=new xr(e.gzip)),e.brotli&&(typeof e.brotli!="object"&&(e.brotli={}),this.zip=new Yr(e.brotli)),e.zstd&&(typeof e.zstd!="object"&&(e.zstd={}),this.zip=new Cr(e.zstd)),!this.zip)throw new Error("impossible");let i=this.zip;i.on("data",n=>super.write(n)),i.on("end",()=>super.end()),i.on("drain",()=>this[Gs]()),this.on("resume",()=>i.resume())}else this.on("drain",this[Gs]);this.noDirRecurse=!!e.noDirRecurse,this.follow=!!e.follow,this.noMtime=!!e.noMtime,e.mtime&&(this.mtime=e.mtime),this.filter=typeof e.filter=="function"?e.filter:()=>!0,this[Ge]=new _r,this[Se]=0,this.jobs=Number(e.jobs)||4,this[Sn]=!1,this[Gn]=!1}[d3](e){return super.write(e)}add(e){return this.write(e),this}end(e,i,n){return typeof e=="function"&&(n=e,e=void 0),typeof i=="function"&&(n=i,i=void 0),e&&this.add(e),this[Gn]=!0,this[$t](),n&&n(),this}write(e){if(this[Gn])throw new Error("write after end");return e instanceof Ci?this[f3](e):this[eo](e),this.flowing}[f3](e){let i=R(R3.resolve(this.cwd,e.path));if(!this.filter(e.path,e))e.resume();else{let n=new oo(e.path,i);n.entry=new Lr(e,this[xs](n)),n.entry.on("end",()=>this[gs](n)),this[Se]+=1,this[Ge].push(n)}this[$t]()}[eo](e){let i=R(R3.resolve(this.cwd,e));this[Ge].push(new oo(e,i)),this[$t]()}[Ss](e){e.pending=!0,this[Se]+=1;let i=this.follow?"stat":"lstat";ro[i](e.absolute,(n,r)=>{e.pending=!1,this[Se]-=1,n?this.emit("error",n):this[$r](e,r)})}[$r](e,i){this.statCache.set(e.absolute,i),e.stat=i,this.filter(e.path,i)||(e.ignore=!0),this[$t]()}[Ys](e){e.pending=!0,this[Se]+=1,ro.readdir(e.absolute,(i,n)=>{if(e.pending=!1,this[Se]-=1,i)return this.emit("error",i);this[to](e,n)})}[to](e,i){this.readdirCache.set(e.absolute,i),e.readdir=i,this[$t]()}[$t](){if(!this[Sn]){this[Sn]=!0;for(let e=this[Ge].head;e&&this[Se]<this.jobs;e=e.next)if(this[h3](e.value),e.value.ignore){let i=e.next;this[Ge].removeNode(e),e.next=i}this[Sn]=!1,this[Gn]&&!this[Ge].length&&this[Se]===0&&(this.zip?this.zip.end(p3):(super.write(p3),super.end()))}}get[Ki](){return this[Ge]&&this[Ge].head&&this[Ge].head.value}[gs](e){this[Ge].shift(),this[Se]-=1,this[$t]()}[h3](e){if(!e.pending){if(e.entry){e===this[Ki]&&!e.piped&&this[io](e);return}if(!e.stat){let i=this.statCache.get(e.absolute);i?this[$r](e,i):this[Ss](e)}if(e.stat&&!e.ignore){if(!this.noDirRecurse&&e.stat.isDirectory()&&!e.readdir){let i=this.readdirCache.get(e.absolute);if(i?this[to](e,i):this[Ys](e),!e.readdir)return}if(e.entry=this[z3](e),!e.entry){e.ignore=!0;return}e===this[Ki]&&!e.piped&&this[io](e)}}}[xs](e){return{onwarn:(i,n,r)=>this.warn(i,n,r),noPax:this.noPax,cwd:this.cwd,absolute:e.absolute,preservePaths:this.preservePaths,maxReadSize:this.maxReadSize,strict:this.strict,portable:this.portable,linkCache:this.linkCache,statCache:this.statCache,noMtime:this.noMtime,mtime:this.mtime,prefix:this.prefix,onWriteEntry:this.onWriteEntry}}[z3](e){this[Se]+=1;try{return new this[no](e.path,this[xs](e)).on("end",()=>this[gs](e)).on("error",n=>this.emit("error",n))}catch(i){this.emit("error",i)}}[Gs](){this[Ki]&&this[Ki].entry&&this[Ki].entry.resume()}[io](e){e.piped=!0,e.readdir&&e.readdir.forEach(r=>{let o=e.path,a=o==="./"?"":o.replace(/\/*$/,"/");this[eo](a+r)});let i=e.entry,n=this.zip;if(!i)throw new Error("cannot pipe without source");n?i.on("data",r=>{n.write(r)||i.pause()}):i.on("data",r=>{super.write(r)||i.pause()})}pause(){return this.zip&&this.zip.pause(),super.pause()}warn(e,i,n={}){Tt(this,e,i,n)}},ei=class extends gt{sync=!0;constructor(e){super(e),this[no]=Hr}pause(){}resume(){}[Ss](e){let i=this.follow?"statSync":"lstatSync";this[$r](e,ro[i](e.absolute))}[Ys](e){this[to](e,ro.readdirSync(e.absolute))}[io](e){let i=e.entry,n=this.zip;if(e.readdir&&e.readdir.forEach(r=>{let o=e.path,a=o==="./"?"":o.replace(/\/*$/,"/");this[eo](a+r)}),!i)throw new Error("Cannot pipe without source");n?i.on("data",r=>{n.write(r)}):i.on("data",r=>{super[d3](r)})}};var ru=(t,e)=>{let i=new ei(t),n=new gi(t.file,{mode:t.mode||438});i.pipe(n),g3(i,e)},ou=(t,e)=>{let i=new gt(t),n=new we(t.file,{mode:t.mode||438});i.pipe(n);let r=new Promise((o,a)=>{n.on("error",a),n.on("close",o),i.on("error",a)});return x3(i,e),r},g3=(t,e)=>{e.forEach(i=>{i.charAt(0)==="@"?_t({file:j3.resolve(t.cwd,i.slice(1)),sync:!0,noResume:!0,onReadEntry:n=>t.add(n)}):t.add(i)}),t.end()},x3=async(t,e)=>{for(let i=0;i<e.length;i++){let n=String(e[i]);n.charAt(0)==="@"?await _t({file:j3.resolve(String(t.cwd),n.slice(1)),noResume:!0,onReadEntry:r=>{t.add(r)}}):t.add(n)}t.end()},au=(t,e)=>{let i=new ei(t);return g3(i,e),i},su=(t,e)=>{let i=new gt(t);return x3(i,e),i},cu=Ue(ru,ou,au,su,(t,e)=>{if(!e?.length)throw new TypeError("no paths specified to add to archive")});import b3 from"node:fs";import Gu from"node:assert";import{randomBytes as Z3}from"node:crypto";import j from"node:fs";import tt from"node:path";import G3 from"fs";var lu=process.env.__FAKE_PLATFORM__||process.platform,vu=lu==="win32",{O_CREAT:Au,O_TRUNC:mu,O_WRONLY:uu}=G3.constants,S3=Number(process.env.__FAKE_FS_O_FILENAME__)||G3.constants.UV_FS_O_FILEMAP||0,Eu=vu&&!!S3,Iu=512*1024,pu=S3|mu|Au|uu,Ws=Eu?t=>t<Iu?pu:"w":()=>"w";import so from"node:fs";import Yn from"node:path";var Ms=(t,e,i)=>{try{return so.lchownSync(t,e,i)}catch(n){if(n?.code!=="ENOENT")throw n}},ao=(t,e,i,n)=>{so.lchown(t,e,i,r=>{n(r&&r?.code!=="ENOENT"?r:null)})},hu=(t,e,i,n,r)=>{if(e.isDirectory())Cs(Yn.resolve(t,e.name),i,n,o=>{if(o)return r(o);let a=Yn.resolve(t,e.name);ao(a,i,n,r)});else{let o=Yn.resolve(t,e.name);ao(o,i,n,r)}},Cs=(t,e,i,n)=>{so.readdir(t,{withFileTypes:!0},(r,o)=>{if(r){if(r.code==="ENOENT")return n();if(r.code!=="ENOTDIR"&&r.code!=="ENOTSUP")return n(r)}if(r||!o.length)return ao(t,e,i,n);let a=o.length,c=null,l=v=>{if(!c){if(v)return n(c=v);if(--a===0)return ao(t,e,i,n)}};for(let v of o)hu(t,v,e,i,l)})},fu=(t,e,i,n)=>{e.isDirectory()&&Os(Yn.resolve(t,e.name),i,n),Ms(Yn.resolve(t,e.name),i,n)},Os=(t,e,i)=>{let n;try{n=so.readdirSync(t,{withFileTypes:!0})}catch(r){let o=r;if(o?.code==="ENOENT")return;if(o?.code==="ENOTDIR"||o?.code==="ENOTSUP")return Ms(t,e,i);throw o}for(let r of n)fu(t,r,e,i);return Ms(t,e,i)};import oe from"node:fs";import zu from"node:fs/promises";import co from"node:path";var Wn=class extends Error{path;code;syscall="chdir";constructor(e,i){super(`${i}: Cannot cd into '${e}'`),this.path=e,this.code=i}get name(){return"CwdError"}};var Mn=class extends Error{path;symlink;syscall="symlink";code="TAR_SYMLINK_ERROR";constructor(e,i){super("TAR_SYMLINK_ERROR: Cannot extract through symbolic link"),this.symlink=e,this.path=i}get name(){return"SymlinkError"}};var Ru=(t,e)=>{oe.stat(t,(i,n)=>{(i||!n.isDirectory())&&(i=new Wn(t,i?.code||"ENOTDIR")),e(i)})},Y3=(t,e,i)=>{t=R(t);let n=e.umask??18,r=e.mode|448,o=(r&n)!==0,a=e.uid,c=e.gid,l=typeof a=="number"&&typeof c=="number"&&(a!==e.processUid||c!==e.processGid),v=e.preserve,A=e.unlink,m=R(e.cwd),I=(d,f)=>{d?i(d):f&&l?Cs(f,a,c,H=>I(H)):o?oe.chmod(t,r,i):i()};if(t===m)return Ru(t,I);if(v)return zu.mkdir(t,{mode:r,recursive:!0}).then(d=>I(null,d??void 0),I);let h=R(co.relative(m,t)).split("/");Us(m,h,r,A,m,void 0,I)},Us=(t,e,i,n,r,o,a)=>{if(!e.length)return a(null,o);let c=e.shift(),l=R(co.resolve(t+"/"+c));oe.mkdir(l,i,W3(l,e,i,n,r,o,a))},W3=(t,e,i,n,r,o,a)=>c=>{c?oe.lstat(t,(l,v)=>{if(l)l.path=l.path&&R(l.path),a(l);else if(v.isDirectory())Us(t,e,i,n,r,o,a);else if(n)oe.unlink(t,A=>{if(A)return a(A);oe.mkdir(t,i,W3(t,e,i,n,r,o,a))});else{if(v.isSymbolicLink())return a(new Mn(t,t+"/"+e.join("/")));a(c)}}):(o=o||t,Us(t,e,i,n,r,o,a))},du=t=>{let e=!1,i;try{e=oe.statSync(t).isDirectory()}catch(n){i=n?.code}finally{if(!e)throw new Wn(t,i??"ENOTDIR")}},M3=(t,e)=>{t=R(t);let i=e.umask??18,n=e.mode|448,r=(n&i)!==0,o=e.uid,a=e.gid,c=typeof o=="number"&&typeof a=="number"&&(o!==e.processUid||a!==e.processGid),l=e.preserve,v=e.unlink,A=R(e.cwd),m=d=>{d&&c&&Os(d,o,a),r&&oe.chmodSync(t,n)};if(t===A)return du(A),m();if(l)return m(oe.mkdirSync(t,{mode:n,recursive:!0})??void 0);let E=R(co.relative(A,t)).split("/"),h;for(let d=E.shift(),f=A;d&&(f+="/"+d);d=E.shift()){f=R(co.resolve(f));try{oe.mkdirSync(f,n),h=h||f}catch{let ce=oe.lstatSync(f);if(ce.isDirectory())continue;if(v){oe.unlinkSync(f),oe.mkdirSync(f,n),h=h||f;continue}else if(ce.isSymbolicLink())return new Mn(f,f+"/"+E.join("/"))}}return m(h)};import{join as U3}from"node:path";var Ks=Object.create(null),C3=1e4,Vi=new Set,O3=t=>{Vi.has(t)?Vi.delete(t):Ks[t]=t.normalize("NFD"),Vi.add(t);let e=Ks[t],i=Vi.size-C3;if(i>C3/10){for(let n of Vi)if(Vi.delete(n),delete Ks[n],--i<=0)break}return e};var ju=process.env.TESTING_TAR_FAKE_PLATFORM||process.platform,gu=ju==="win32",xu=t=>t.split("/").slice(0,-1).reduce((i,n)=>{let r=i[i.length-1];return r!==void 0&&(n=U3(r,n)),i.push(n||"/"),i},[]),lo=class{#e=new Map;#n=new Map;#i=new Set;reserve(e,i){e=gu?["win32 parallelization disabled"]:e.map(r=>dt(U3(O3(r))).toLowerCase());let n=new Set(e.map(r=>xu(r)).reduce((r,o)=>r.concat(o)));this.#n.set(i,{dirs:n,paths:e});for(let r of e){let o=this.#e.get(r);o?o.push(i):this.#e.set(r,[i])}for(let r of n){let o=this.#e.get(r);if(!o)this.#e.set(r,[new Set([i])]);else{let a=o[o.length-1];a instanceof Set?a.add(i):o.push(new Set([i]))}}return this.#s(i)}#r(e){let i=this.#n.get(e);if(!i)throw new Error("function does not have any path reservations");return{paths:i.paths.map(n=>this.#e.get(n)),dirs:[...i.dirs].map(n=>this.#e.get(n))}}check(e){let{paths:i,dirs:n}=this.#r(e);return i.every(r=>r&&r[0]===e)&&n.every(r=>r&&r[0]instanceof Set&&r[0].has(e))}#s(e){return this.#i.has(e)||!this.check(e)?!1:(this.#i.add(e),e(()=>this.#t(e)),!0)}#t(e){if(!this.#i.has(e))return!1;let i=this.#n.get(e);if(!i)throw new Error("invalid reservation");let{paths:n,dirs:r}=i,o=new Set;for(let a of n){let c=this.#e.get(a);if(!c||c?.[0]!==e)continue;let l=c[1];if(!l){this.#e.delete(a);continue}if(c.shift(),typeof l=="function")o.add(l);else for(let v of l)o.add(v)}for(let a of r){let c=this.#e.get(a),l=c?.[0];if(!(!c||!(l instanceof Set)))if(l.size===1&&c.length===1){this.#e.delete(a);continue}else if(l.size===1){c.shift();let v=c[0];typeof v=="function"&&o.add(v)}else l.delete(e)}return this.#i.delete(e),o.forEach(a=>this.#s(a)),!0}};var K3=Symbol("onEntry"),ks=Symbol("checkFs"),V3=Symbol("checkFs2"),Fs=Symbol("isReusable"),Ee=Symbol("makeFs"),Qs=Symbol("file"),Js=Symbol("directory"),mo=Symbol("link"),N3=Symbol("symlink"),k3=Symbol("hardlink"),F3=Symbol("unsupported"),Q3=Symbol("checkPath"),xt=Symbol("mkdir"),X=Symbol("onError"),vo=Symbol("pending"),J3=Symbol("pend"),Ni=Symbol("unpend"),Vs=Symbol("ended"),Ns=Symbol("maybeClose"),Bs=Symbol("skip"),Cn=Symbol("doChown"),On=Symbol("uid"),Un=Symbol("gid"),Kn=Symbol("checkedCwd"),Su=process.env.TESTING_TAR_FAKE_PLATFORM||process.platform,Vn=Su==="win32",Yu=1024,Wu=(t,e)=>{if(!Vn)return j.unlink(t,e);let i=t+".DELETE."+Z3(16).toString("hex");j.rename(t,i,n=>{if(n)return e(n);j.unlink(i,e)})},Mu=t=>{if(!Vn)return j.unlinkSync(t);let e=t+".DELETE."+Z3(16).toString("hex");j.renameSync(t,e),j.unlinkSync(e)},B3=(t,e,i)=>t!==void 0&&t===t>>>0?t:e!==void 0&&e===e>>>0?e:i,ki=class extends et{[Vs]=!1;[Kn]=!1;[vo]=0;reservations=new lo;transform;writable=!0;readable=!1;uid;gid;setOwner;preserveOwner;processGid;processUid;maxDepth;forceChown;win32;newer;keep;noMtime;preservePaths;unlink;cwd;strip;processUmask;umask;dmode;fmode;chmod;constructor(e={}){if(e.ondone=()=>{this[Vs]=!0,this[Ns]()},super(e),this.transform=e.transform,this.chmod=!!e.chmod,typeof e.uid=="number"||typeof e.gid=="number"){if(typeof e.uid!="number"||typeof e.gid!="number")throw new TypeError("cannot set owner without number uid and gid");if(e.preserveOwner)throw new TypeError("cannot preserve owner in archive and also set owner explicitly");this.uid=e.uid,this.gid=e.gid,this.setOwner=!0}else this.uid=void 0,this.gid=void 0,this.setOwner=!1;e.preserveOwner===void 0&&typeof e.uid!="number"?this.preserveOwner=!!(process.getuid&&process.getuid()===0):this.preserveOwner=!!e.preserveOwner,this.processUid=(this.preserveOwner||this.setOwner)&&process.getuid?process.getuid():void 0,this.processGid=(this.preserveOwner||this.setOwner)&&process.getgid?process.getgid():void 0,this.maxDepth=typeof e.maxDepth=="number"?e.maxDepth:Yu,this.forceChown=e.forceChown===!0,this.win32=!!e.win32||Vn,this.newer=!!e.newer,this.keep=!!e.keep,this.noMtime=!!e.noMtime,this.preservePaths=!!e.preservePaths,this.unlink=!!e.unlink,this.cwd=R(tt.resolve(e.cwd||process.cwd())),this.strip=Number(e.strip)||0,this.processUmask=this.chmod?typeof e.processUmask=="number"?e.processUmask:process.umask():0,this.umask=typeof e.umask=="number"?e.umask:this.processUmask,this.dmode=e.dmode||511&~this.umask,this.fmode=e.fmode||438&~this.umask,this.on("entry",i=>this[K3](i))}warn(e,i,n={}){return(e==="TAR_BAD_ARCHIVE"||e==="TAR_ABORT")&&(n.recoverable=!1),super.warn(e,i,n)}[Ns](){this[Vs]&&this[vo]===0&&(this.emit("prefinish"),this.emit("finish"),this.emit("end"))}[Q3](e){let i=R(e.path),n=i.split("/");if(this.strip){if(n.length<this.strip)return!1;if(e.type==="Link"){let r=R(String(e.linkpath)).split("/");if(r.length>=this.strip)e.linkpath=r.slice(this.strip).join("/");else return!1}n.splice(0,this.strip),e.path=n.join("/")}if(isFinite(this.maxDepth)&&n.length>this.maxDepth)return this.warn("TAR_ENTRY_ERROR","path excessively deep",{entry:e,path:i,depth:n.length,maxDepth:this.maxDepth}),!1;if(!this.preservePaths){if(n.includes("..")||Vn&&/^[a-z]:\.\.$/i.test(n[0]??""))return this.warn("TAR_ENTRY_ERROR","path contains '..'",{entry:e,path:i}),!1;let[r,o]=dn(i);r&&(e.path=String(o),this.warn("TAR_ENTRY_INFO",`stripping ${r} from absolute path`,{entry:e,path:i}))}if(tt.isAbsolute(e.path)?e.absolute=R(tt.resolve(e.path)):e.absolute=R(tt.resolve(this.cwd,e.path)),!this.preservePaths&&typeof e.absolute=="string"&&e.absolute.indexOf(this.cwd+"/")!==0&&e.absolute!==this.cwd)return this.warn("TAR_ENTRY_ERROR","path escaped extraction target",{entry:e,path:R(e.path),resolvedPath:e.absolute,cwd:this.cwd}),!1;if(e.absolute===this.cwd&&e.type!=="Directory"&&e.type!=="GNUDumpDir")return!1;if(this.win32){let{root:r}=tt.win32.parse(String(e.absolute));e.absolute=r+Es(String(e.absolute).slice(r.length));let{root:o}=tt.win32.parse(e.path);e.path=o+Es(e.path.slice(o.length))}return!0}[K3](e){if(!this[Q3](e))return e.resume();switch(Gu.equal(typeof e.absolute,"string"),e.type){case"Directory":case"GNUDumpDir":e.mode&&(e.mode=e.mode|448);case"File":case"OldFile":case"ContiguousFile":case"Link":case"SymbolicLink":return this[ks](e);default:return this[F3](e)}}[X](e,i){e.name==="CwdError"?this.emit("error",e):(this.warn("TAR_ENTRY_ERROR",e,{entry:i}),this[Ni](),i.resume())}[xt](e,i,n){Y3(R(e),{uid:this.uid,gid:this.gid,processUid:this.processUid,processGid:this.processGid,umask:this.processUmask,preserve:this.preservePaths,unlink:this.unlink,cwd:this.cwd,mode:i},n)}[Cn](e){return this.forceChown||this.preserveOwner&&(typeof e.uid=="number"&&e.uid!==this.processUid||typeof e.gid=="number"&&e.gid!==this.processGid)||typeof this.uid=="number"&&this.uid!==this.processUid||typeof this.gid=="number"&&this.gid!==this.processGid}[On](e){return B3(this.uid,e.uid,this.processUid)}[Un](e){return B3(this.gid,e.gid,this.processGid)}[Qs](e,i){let n=typeof e.mode=="number"?e.mode&4095:this.fmode,r=new we(String(e.absolute),{flags:Ws(e.size),mode:n,autoClose:!1});r.on("error",l=>{r.fd&&j.close(r.fd,()=>{}),r.write=()=>!0,this[X](l,e),i()});let o=1,a=l=>{if(l){r.fd&&j.close(r.fd,()=>{}),this[X](l,e),i();return}--o===0&&r.fd!==void 0&&j.close(r.fd,v=>{v?this[X](v,e):this[Ni](),i()})};r.on("finish",()=>{let l=String(e.absolute),v=r.fd;if(typeof v=="number"&&e.mtime&&!this.noMtime){o++;let A=e.atime||new Date,m=e.mtime;j.futimes(v,A,m,I=>I?j.utimes(l,A,m,E=>a(E&&I)):a())}if(typeof v=="number"&&this[Cn](e)){o++;let A=this[On](e),m=this[Un](e);typeof A=="number"&&typeof m=="number"&&j.fchown(v,A,m,I=>I?j.chown(l,A,m,E=>a(E&&I)):a())}a()});let c=this.transform&&this.transform(e)||e;c!==e&&(c.on("error",l=>{this[X](l,e),i()}),e.pipe(c)),c.pipe(r)}[Js](e,i){let n=typeof e.mode=="number"?e.mode&4095:this.dmode;this[xt](String(e.absolute),n,r=>{if(r){this[X](r,e),i();return}let o=1,a=()=>{--o===0&&(i(),this[Ni](),e.resume())};e.mtime&&!this.noMtime&&(o++,j.utimes(String(e.absolute),e.atime||new Date,e.mtime,a)),this[Cn](e)&&(o++,j.chown(String(e.absolute),Number(this[On](e)),Number(this[Un](e)),a)),a()})}[F3](e){e.unsupported=!0,this.warn("TAR_ENTRY_UNSUPPORTED",`unsupported entry type: ${e.type}`,{entry:e}),e.resume()}[N3](e,i){this[mo](e,String(e.linkpath),"symlink",i)}[k3](e,i){let n=R(tt.resolve(this.cwd,String(e.linkpath)));this[mo](e,n,"link",i)}[J3](){this[vo]++}[Ni](){this[vo]--,this[Ns]()}[Bs](e){this[Ni](),e.resume()}[Fs](e,i){return e.type==="File"&&!this.unlink&&i.isFile()&&i.nlink<=1&&!Vn}[ks](e){this[J3]();let i=[e.path];e.linkpath&&i.push(e.linkpath),this.reservations.reserve(i,n=>this[V3](e,n))}[V3](e,i){let n=c=>{i(c)},r=()=>{this[xt](this.cwd,this.dmode,c=>{if(c){this[X](c,e),n();return}this[Kn]=!0,o()})},o=()=>{if(e.absolute!==this.cwd){let c=R(tt.dirname(String(e.absolute)));if(c!==this.cwd)return this[xt](c,this.dmode,l=>{if(l){this[X](l,e),n();return}a()})}a()},a=()=>{j.lstat(String(e.absolute),(c,l)=>{if(l&&(this.keep||this.newer&&l.mtime>(e.mtime??l.mtime))){this[Bs](e),n();return}if(c||this[Fs](e,l))return this[Ee](null,e,n);if(l.isDirectory()){if(e.type==="Directory"){let v=this.chmod&&e.mode&&(l.mode&4095)!==e.mode,A=m=>this[Ee](m??null,e,n);return v?j.chmod(String(e.absolute),Number(e.mode),A):A()}if(e.absolute!==this.cwd)return j.rmdir(String(e.absolute),v=>this[Ee](v??null,e,n))}if(e.absolute===this.cwd)return this[Ee](null,e,n);Wu(String(e.absolute),v=>this[Ee](v??null,e,n))})};this[Kn]?o():r()}[Ee](e,i,n){if(e){this[X](e,i),n();return}switch(i.type){case"File":case"OldFile":case"ContiguousFile":return this[Qs](i,n);case"Link":return this[k3](i,n);case"SymbolicLink":return this[N3](i,n);case"Directory":case"GNUDumpDir":return this[Js](i,n)}}[mo](e,i,n,r){j[n](i,String(e.absolute),o=>{o?this[X](o,e):(this[Ni](),e.resume()),r()})}},Ao=t=>{try{return[null,t()]}catch(e){return[e,null]}},Nn=class extends ki{sync=!0;[Ee](e,i){return super[Ee](e,i,()=>{})}[ks](e){if(!this[Kn]){let o=this[xt](this.cwd,this.dmode);if(o)return this[X](o,e);this[Kn]=!0}if(e.absolute!==this.cwd){let o=R(tt.dirname(String(e.absolute)));if(o!==this.cwd){let a=this[xt](o,this.dmode);if(a)return this[X](a,e)}}let[i,n]=Ao(()=>j.lstatSync(String(e.absolute)));if(n&&(this.keep||this.newer&&n.mtime>(e.mtime??n.mtime)))return this[Bs](e);if(i||this[Fs](e,n))return this[Ee](null,e);if(n.isDirectory()){if(e.type==="Directory"){let a=this.chmod&&e.mode&&(n.mode&4095)!==e.mode,[c]=a?Ao(()=>{j.chmodSync(String(e.absolute),Number(e.mode))}):[];return this[Ee](c,e)}let[o]=Ao(()=>j.rmdirSync(String(e.absolute)));this[Ee](o,e)}let[r]=e.absolute===this.cwd?[]:Ao(()=>Mu(String(e.absolute)));this[Ee](r,e)}[Qs](e,i){let n=typeof e.mode=="number"?e.mode&4095:this.fmode,r=c=>{let l;try{j.closeSync(o)}catch(v){l=v}(c||l)&&this[X](c||l,e),i()},o;try{o=j.openSync(String(e.absolute),Ws(e.size),n)}catch(c){return r(c)}let a=this.transform&&this.transform(e)||e;a!==e&&(a.on("error",c=>this[X](c,e)),e.pipe(a)),a.on("data",c=>{try{j.writeSync(o,c,0,c.length)}catch(l){r(l)}}),a.on("end",()=>{let c=null;if(e.mtime&&!this.noMtime){let l=e.atime||new Date,v=e.mtime;try{j.futimesSync(o,l,v)}catch(A){try{j.utimesSync(String(e.absolute),l,v)}catch{c=A}}}if(this[Cn](e)){let l=this[On](e),v=this[Un](e);try{j.fchownSync(o,Number(l),Number(v))}catch(A){try{j.chownSync(String(e.absolute),Number(l),Number(v))}catch{c=c||A}}}r(c)})}[Js](e,i){let n=typeof e.mode=="number"?e.mode&4095:this.dmode,r=this[xt](String(e.absolute),n);if(r){this[X](r,e),i();return}if(e.mtime&&!this.noMtime)try{j.utimesSync(String(e.absolute),e.atime||new Date,e.mtime)}catch{}if(this[Cn](e))try{j.chownSync(String(e.absolute),Number(this[On](e)),Number(this[Un](e)))}catch{}i(),e.resume()}[xt](e,i){try{return M3(R(e),{uid:this.uid,gid:this.gid,processUid:this.processUid,processGid:this.processGid,umask:this.processUmask,preserve:this.preservePaths,unlink:this.unlink,cwd:this.cwd,mode:i})}catch(n){return n}}[mo](e,i,n,r){let o=`${n}Sync`;try{j[o](i,String(e.absolute)),r(),e.resume()}catch(a){return this[X](a,e)}}};var Cu=t=>{let e=new Nn(t),i=t.file,n=b3.statSync(i),r=t.maxReadSize||16*1024*1024;new pr(i,{readSize:r,size:n.size}).pipe(e)},Ou=(t,e)=>{let i=new ki(t),n=t.maxReadSize||16*1024*1024,r=t.file;return new Promise((a,c)=>{i.on("error",c),i.on("close",a),b3.stat(r,(l,v)=>{if(l)c(l);else{let A=new Zt(r,{readSize:n,size:v.size});A.on("error",c),A.pipe(i)}})})},Zs=Ue(Cu,Ou,t=>new Nn(t),t=>new ki(t),(t,e)=>{e?.length&&As(t,e)});import ae from"node:fs";import P3 from"node:path";var Uu=(t,e)=>{let i=new ei(t),n=!0,r,o;try{try{r=ae.openSync(t.file,"r+")}catch(l){if(l?.code==="ENOENT")r=ae.openSync(t.file,"w+");else throw l}let a=ae.fstatSync(r),c=Buffer.alloc(512);e:for(o=0;o<a.size;o+=512){for(let A=0,m=0;A<512;A+=m){if(m=ae.readSync(r,c,A,c.length-A,o+A),o===0&&c[0]===31&&c[1]===139)throw new Error("cannot append to compressed archives");if(!m)break e}let l=new ne(c);if(!l.cksumValid)break;let v=512*Math.ceil((l.size||0)/512);if(o+v+512>a.size)break;o+=v,t.mtimeCache&&l.mtime&&t.mtimeCache.set(String(l.path),l.mtime)}n=!1,Ku(t,i,o,r,e)}finally{if(n)try{ae.closeSync(r)}catch{}}},Ku=(t,e,i,n,r)=>{let o=new gi(t.file,{fd:n,start:i});e.pipe(o),Nu(e,r)},Vu=(t,e)=>{e=Array.from(e);let i=new gt(t),n=(o,a,c)=>{let l=(E,h)=>{E?ae.close(o,d=>c(E)):c(null,h)},v=0;if(a===0)return l(null,0);let A=0,m=Buffer.alloc(512),I=(E,h)=>{if(E||typeof h>"u")return l(E);if(A+=h,A<512&&h)return ae.read(o,m,A,m.length-A,v+A,I);if(v===0&&m[0]===31&&m[1]===139)return l(new Error("cannot append to compressed archives"));if(A<512)return l(null,v);let d=new ne(m);if(!d.cksumValid)return l(null,v);let f=512*Math.ceil((d.size??0)/512);if(v+f+512>a||(v+=f+512,v>=a))return l(null,v);t.mtimeCache&&d.mtime&&t.mtimeCache.set(String(d.path),d.mtime),A=0,ae.read(o,m,0,512,v,I)};ae.read(o,m,0,512,v,I)};return new Promise((o,a)=>{i.on("error",a);let c="r+",l=(v,A)=>{if(v&&v.code==="ENOENT"&&c==="r+")return c="w+",ae.open(t.file,c,l);if(v||!A)return a(v);ae.fstat(A,(m,I)=>{if(m)return ae.close(A,()=>a(m));n(A,I.size,(E,h)=>{if(E)return a(E);let d=new we(t.file,{fd:A,start:h});i.pipe(d),d.on("error",a),d.on("close",o),ku(i,e)})})};ae.open(t.file,c,l)})},Nu=(t,e)=>{e.forEach(i=>{i.charAt(0)==="@"?_t({file:P3.resolve(t.cwd,i.slice(1)),sync:!0,noResume:!0,onReadEntry:n=>t.add(n)}):t.add(i)}),t.end()},ku=async(t,e)=>{for(let i=0;i<e.length;i++){let n=String(e[i]);n.charAt(0)==="@"?await _t({file:P3.resolve(String(t.cwd),n.slice(1)),noResume:!0,onReadEntry:r=>t.add(r)}):t.add(n)}t.end()},ti=Ue(Uu,Vu,()=>{throw new TypeError("file is required")},()=>{throw new TypeError("file is required")},(t,e)=>{if(!Fl(t))throw new TypeError("file is required");if(t.gzip||t.brotli||t.zstd||t.file.endsWith(".br")||t.file.endsWith(".tbr"))throw new TypeError("cannot append to compressed archives");if(!e?.length)throw new TypeError("no paths specified to add/replace")});var Fu=Ue(ti.syncFile,ti.asyncFile,ti.syncNoFile,ti.asyncNoFile,(t,e=[])=>{ti.validate?.(t,e),Qu(t)}),Qu=t=>{let e=t.filter;t.mtimeCache||(t.mtimeCache=new Map),t.filter=e?(i,n)=>e(i,n)&&!((t.mtimeCache?.get(i)??n.mtime??0)>(n.mtime??0)):(i,n)=>!((t.mtimeCache?.get(i)??n.mtime??0)>(n.mtime??0))};async function Fi(t){let{source:e,destination:i,strip:n=1,filter:r}=t,o=[];if(!q3(e))return{success:!1,extractedFiles:[],error:`Source file not found: ${e}`};q3(i)||Zu(i,{recursive:!0});try{return await bu(Bu(e),Pu(),Zs({cwd:i,strip:n,filter:a=>r&&!r(a)?!1:(o.push(a),!0)})),{success:!0,extractedFiles:o}}catch(a){return{success:!1,extractedFiles:o,error:a instanceof Error?a.message:String(a)}}}import{existsSync as D3,readFileSync as qu,writeFileSync as Du,mkdirSync as yu}from"fs";import{dirname as wu}from"path";function ii(t){let e=ja(t);if(!D3(e))return null;try{let i=qu(e,"utf-8");return JSON.parse(i)}catch{return null}}function uo(t,e){let i=ja(e),n=wu(i);D3(n)||yu(n,{recursive:!0}),Du(i,JSON.stringify(t,null,2))}function y3(t,e,i){return{name:"gemkit",version:t,installedAt:new Date().toISOString(),scope:e,installedFiles:i,customizedFiles:[]}}function w3(t){return ii(t)!==null}var p=Dn(H3(),1),Lu=t=>{let e=parseInt(t.slice(1,3),16),i=parseInt(t.slice(3,5),16),n=parseInt(t.slice(5,7),16);return`\x1B[38;2;${e};${i};${n}m`},kn=t=>e=>p.default.isColorSupported?`${Lu(t)}${e}\x1B[39m`:e,s={primary:kn("#4f46e5"),secondary:kn("#9333ea"),accent:kn("#06b6d4"),geminiBlue:kn("#1a73e8"),geminiPurple:kn("#8e24aa"),success:t=>p.default.green(t),error:t=>p.default.red(t),warn:t=>p.default.yellow(t),info:t=>p.default.cyan(t),dim:t=>p.default.dim(t)},M={line:(t=60)=>"\u2500".repeat(t),doubleLine:(t=60)=>"\u2550".repeat(t),statusIcon:t=>{switch(t){case"active":return s.success("\u25CF");case"completed":return s.dim("\u25CB");case"failed":return s.error("\u2717");default:return"?"}},checkIcon:(t,e=!1)=>t?s.success("\u2713"):e?s.warn("\u25CB"):s.error("\u2717"),header:t=>p.default.bold(s.geminiPurple(t)),section:(t,e=60)=>{console.log(),console.log("\u2500".repeat(e)),console.log(p.default.bold(s.geminiPurple(t))),console.log("\u2500".repeat(e)),console.log()}};var GR={success:s.success,error:s.error,warning:s.warn,info:s.info,dim:s.dim,primary:s.primary,secondary:s.secondary,bold:p.default.bold};var L3={debug:0,info:1,warn:2,error:3,silent:4},Ie={level:"info",verbose:!1,json:!1};function po(t){Ie={...Ie,...t}}function Fn(t){return L3[t]>=L3[Ie.level]}function _u(t,e){Fn("debug")&&(Ie.json?console.log(JSON.stringify({level:"debug",message:t,data:e})):(console.log(s.dim(`[DEBUG] ${t}`)),e&&Ie.verbose&&console.log(s.dim(JSON.stringify(e,null,2)))))}function $u(t,e){Fn("info")&&(Ie.json?console.log(JSON.stringify({level:"info",message:t,data:e})):(console.log(`${s.info("\u2139")} ${t}`),e&&Ie.verbose&&console.log(JSON.stringify(e,null,2))))}function eE(t,e){Fn("info")&&(Ie.json?console.log(JSON.stringify({level:"success",message:t,data:e})):console.log(`${s.success("\u2713")} ${t}`))}function tE(t,e){Fn("warn")&&(Ie.json?console.log(JSON.stringify({level:"warn",message:t,data:e})):console.log(`${s.warn("\u26A0")} ${t}`))}function iE(t,e){Fn("error")&&(Ie.json?console.error(JSON.stringify({level:"error",message:t,data:e})):(console.error(`${s.error("\u2717")} ${t}`),e&&Ie.verbose&&console.error(JSON.stringify(e,null,2))))}function nE(t){Ie.json?console.log(JSON.stringify(t)):console.table(t)}function rE(t){console.log(JSON.stringify(t,null,2))}var u={debug:_u,info:$u,success:eE,warn:tE,error:iE,table:nE,json:rE,configure:po};function cE(t){switch(t){case"gemini":return[".claude",".claude/**",".agent",".agent/**"];case"claude":return[".agent",".agent/**"];case"antigravity":return[".claude",".claude/**"];default:return[]}}function lE(t){switch(t){case"gemini":return"Gemini CLI (excludes .claude, .agent)";case"claude":return"Claude Code (excludes .agent)";case"antigravity":return"Antigravity (excludes .claude)";default:return"Full (all files)"}}function vE(t,e){let i=t.replace(/\\/g,"/");for(let n of e)if(n.includes("*")){if(n.endsWith("/**")){let r=n.slice(0,-3);if(i.startsWith(r+"/"))return!0}}else if(i===n||i.startsWith(n+"/"))return!0;return!1}function AE(t){if(t.length!==0)return e=>!vE(e,t)}async function mE(){let t=aE(".gemini","extensions","spawn-agent");return oE(t)?new Promise(e=>{let i=sE("gemini",["extensions","install",t],{stdio:["pipe","pipe","pipe"],shell:process.platform==="win32",cwd:process.cwd()}),n="",r="",o=!1,a=setTimeout(()=>{o||(o=!0,i.kill(),e({success:!1,error:"Extension installation timed out"}))},3e4);i.stdout?.on("data",c=>{n+=c.toString()}),i.stderr?.on("data",c=>{r+=c.toString()}),i.on("close",c=>{o||(o=!0,clearTimeout(a),e(c===0?{success:!0}:{success:!1,error:r||n||`Exit code: ${c}`}))}),i.on("error",c=>{o||(o=!0,clearTimeout(a),e({success:!1,error:`Failed to run gemini CLI: ${c.message}`}))})}):{success:!1,error:`Extension directory not found: ${t}`}}function _3(t){t.command("init","Initialize GemKit in project").option("--version <ver>","Specific version to install").option("-f, --force","Overwrite existing installation").option("--exclude <patterns...>","File patterns to exclude").option("--skip-extension","Skip spawn-agent extension installation").option("--full","Install all files (default)").option("--gemini","Gemini CLI mode (excludes .claude, .agent folders)").option("--claude","Claude Code mode (excludes .agent folder)").option("--antigravity","Antigravity mode (excludes .claude folder)").action(async e=>{let i="full";if(e.gemini?i="gemini":e.claude?i="claude":e.antigravity?i="antigravity":e.full&&(i="full"),w3()&&!e.force){console.log(),u.warn("GemKit is already installed. Use --force to reinstall."),console.log();return}console.log(),console.log(p.default.bold(s.geminiPurple("Initializing GemKit"))),console.log(` ${s.dim("Mode:")} ${s.accent(lE(i))}`),console.log();let n=Ze({text:"Fetching latest release...",color:"magenta"}).start(),r=e.version?await Yl(e.version):await Ii();r||(n.fail("No release found"),console.log(),process.exit(1)),n.succeed(`Found version ${s.primary(r.version)}`);let o=Ze({text:"Downloading release...",color:"magenta"}).start(),a;try{a=await pi(r),o.succeed("Download complete")}catch(E){o.fail(`Download failed: ${E instanceof Error?E.message:String(E)}`),console.log(),process.exit(1)}let c=cE(i),l=Ze({text:i==="full"?"Extracting files...":`Extracting files (${i} mode)...`,color:"magenta"}).start(),v=process.cwd(),A=await Fi({source:a,destination:v,strip:1,filter:AE(c)});A.success||(l.fail(`Extraction failed: ${A.error}`),console.log(),process.exit(1)),l.succeed(`Extracted ${A.extractedFiles.length} files`);let m=y3(r.version,"local",A.extractedFiles);if(uo(m),console.log(),u.success(`GemKit ${s.primary(r.version)} installed successfully!`),!e.skipExtension&&(i==="full"||i==="gemini")){console.log();let E=Ze({text:"Installing spawn-agent extension...",color:"magenta"}).start(),h=await mE();h.success?E.succeed("spawn-agent extension installed in Gemini CLI"):(E.warn(`Could not install spawn-agent extension: ${h.error}`),u.info(`You can manually install it with: ${s.primary("gemini extensions install .gemini/extensions/spawn-agent")}`))}else(i==="claude"||i==="antigravity")&&(console.log(),u.info(`Skipped Gemini extension (${i} mode).`));console.log(),u.info(`Run ${s.primary("gk doctor")} to verify installation.`),console.log()})}function $3(t){t.command("update","Update GemKit to latest version").option("-f, --force","Force update and overwrite modified files").option("--no-backup","Disable backup before update").action(async e=>{let i=ii();i||(u.error('GemKit not initialized. Run "gk init" first.'),process.exit(1)),u.info("Checking for updates...");let n=await Ii();if(n||(u.error("Failed to check for updates."),process.exit(1)),n.version===i.version&&!e.force){u.success(`GemKit is already up to date (v${i.version})`);return}u.info(`Updating from v${i.version} to v${n.version}...`);let r=await pi(n),o=rr(),a=await Fi({source:r,destination:o,strip:1});a.success||(u.error(`Update failed: ${a.error}`),process.exit(1));let c={...i,version:n.version,installedAt:new Date().toISOString(),installedFiles:a.extractedFiles};uo(c),u.success(`GemKit updated to v${n.version} successfully!`)})}function ev(t){t.command("versions","List available GemKit versions").alias("v").option("--json","Output as JSON").action(async e=>{let i=ii(),n=await ar();if(e.json){console.log(JSON.stringify({current:i?.version||null,available:n},null,2));return}console.log(),console.log(p.default.bold(s.geminiPurple("GemKit Versions"))),console.log(),console.log(i?` ${s.dim("Current:")} ${s.success(i.version)}`:` ${s.dim("Current:")} ${s.dim("Not installed")}`),console.log(),console.log(` ${p.default.bold("Available Releases:")}`);for(let r of n){let o=r.version===i?.version?s.success(" (current)"):"";console.log(` - ${s.primary(r.version)}${o}`)}console.log()})}import{existsSync as ho}from"fs";import{join as uE}from"path";import{spawn as tv}from"child_process";async function EE(){return new Promise(t=>{let e=tv("gemini",["extensions","list"],{stdio:["pipe","pipe","pipe"],shell:process.platform==="win32"}),i="",n="",r=!1,o=setTimeout(()=>{r||(r=!0,e.kill(),t({installed:!1,error:"Check timed out"}))},2e4);e.stdout?.on("data",a=>{i+=a.toString()}),e.stderr?.on("data",a=>{n+=a.toString()}),e.on("close",a=>{if(!r)if(r=!0,clearTimeout(o),a===0){let c=i.toLowerCase().includes("spawn-agent");t({installed:c})}else t({installed:!1,error:n||"Failed to check extensions"})}),e.on("error",a=>{r||(r=!0,clearTimeout(o),t({installed:!1,error:`Gemini CLI not available: ${a.message}`}))})})}async function IE(){return new Promise(t=>{let e=tv("gemini",["--version"],{stdio:["pipe","pipe","pipe"],shell:process.platform==="win32"}),i="",n=!1,r=setTimeout(()=>{n||(n=!0,e.kill(),t({available:!1,error:"Timed out"}))},15e3);e.stdout?.on("data",o=>{i+=o.toString()}),e.on("close",o=>{if(!n)if(n=!0,clearTimeout(r),o===0){let a=i.trim().split(`
20
- `)[0]||"unknown";t({available:!0,version:a})}else t({available:!1,error:"Command failed"})}),e.on("error",o=>{n||(n=!0,clearTimeout(r),t({available:!1,error:o.message}))})})}function iv(t){t.command("doctor","Check installation health").option("--fix","Attempt to fix issues").action(async e=>{console.log(),console.log(p.default.bold(s.geminiPurple("GemKit Health Check"))),console.log();let i=0,n=0,r=[],o=process.version;parseInt(o.slice(1).split(".")[0],10)>=18?r.push({icon:s.success("\u2713"),message:`Node.js ${o}`}):(r.push({icon:s.error("\u2717"),message:`Node.js ${o} ${s.error("(requires >= 18)")}`}),i++);let c=Ze({text:"Checking Gemini CLI...",color:"magenta"}).start(),l=await IE();c.stop(),l.available?r.push({icon:s.success("\u2713"),message:`Gemini CLI ${s.dim(`(${l.version})`)}`}):(r.push({icon:s.error("\u2717"),message:`Gemini CLI not found ${s.dim(`(${l.error})`)}`}),i++);let v=rr();ho(v)?r.push({icon:s.success("\u2713"),message:".gemini directory exists"}):(r.push({icon:s.error("\u2717"),message:".gemini directory missing"}),i++);let A=Hi();ho(A)?r.push({icon:s.success("\u2713"),message:"Agents directory exists"}):(r.push({icon:s.warn("\u25CB"),message:"Agents directory missing"}),n++);let m=Nt();ho(m)?r.push({icon:s.success("\u2713"),message:"Extensions directory exists"}):(r.push({icon:s.warn("\u25CB"),message:"Extensions directory missing"}),n++);let I=uE(m,"spawn-agent");if(ho(I)?r.push({icon:s.success("\u2713"),message:"spawn-agent extension files present"}):(r.push({icon:s.warn("\u25CB"),message:"spawn-agent extension files missing"}),n++),l.available){let h=Ze({text:"Checking spawn-agent extension...",color:"magenta"}).start(),d=await EE();h.stop(),d.installed?r.push({icon:s.success("\u2713"),message:"spawn-agent extension installed in Gemini"}):(r.push({icon:s.error("\u2717"),message:"spawn-agent extension NOT installed in Gemini",hint:d.error?`${d.error}
21
- Run: gemini extensions install .gemini/extensions/spawn-agent`:"Run: gemini extensions install .gemini/extensions/spawn-agent"}),i++)}let E=ii();E?r.push({icon:s.success("\u2713"),message:`Installation metadata ${s.primary(`(v${E.version})`)}`}):(r.push({icon:s.warn("\u25CB"),message:"Installation metadata missing"}),n++);for(let h of r)if(console.log(` ${h.icon} ${h.message}`),h.hint)for(let d of h.hint.split(`
22
- `))console.log(` ${s.dim(d)}`);console.log(),i===0&&n===0?console.log(s.success("All checks passed!")):i===0?console.log(s.success(`All critical checks passed! ${s.dim(`(${n} warning${n>1?"s":""})`)}`)):(console.log(s.error(`${i} issue(s) found.`)),n>0&&console.log(s.warn(`${n} warning(s).`)),console.log(),console.log("To fix issues:"),console.log(` ${s.dim("1.")} Run ${s.primary("gk init")} to install GemKit`),console.log(` ${s.dim("2.")} Run ${s.primary("gemini extensions install .gemini/extensions/spawn-agent")} to install extension`)),console.log()})}function pE(){console.log(),console.log(p.default.bold(s.geminiPurple("Configuration Management"))),console.log(),console.log("Usage:"),console.log(` ${s.primary("gk config")} <subcommand> [options]`),console.log(),console.log("Subcommands:"),console.log(` ${s.primary("list")} Show all config (default)`),console.log(` ${s.primary("get")} <key> Get config value`),console.log(` ${s.primary("set")} <key> <val> Set config value`),console.log(` ${s.primary("reset")} Reset to defaults`),console.log(),console.log("Options:"),console.log(` ${s.dim("--json")} [list] Output as JSON`),console.log(),console.log("Examples:"),console.log(` ${s.dim("gk config list")}`),console.log(` ${s.dim("gk config get spawn.defaultModel")}`),console.log(` ${s.dim("gk config set spawn.music true")}`),console.log(` ${s.dim("gk config reset")}`),console.log()}function nv(t){t.command("config [subcommand] [key] [value]","Configuration management (list, get, set, reset)").alias("c").option("--json","[list] Output as JSON").action(async(e,i,n,r)=>{switch(e||"list"){case"list":await hE(r);break;case"get":i||(console.log(),u.error("Config key required"),console.log(s.dim("Usage: gk config get <key>")),console.log(),process.exit(1)),await fE(i);break;case"set":(!i||n===void 0)&&(console.log(),u.error("Config key and value required"),console.log(s.dim("Usage: gk config set <key> <value>")),console.log(),process.exit(1)),await zE(i,n);break;case"reset":await RE();break;default:pE()}})}async function hE(t){let e=ct();if(t.json){console.log(JSON.stringify(e,null,2));return}console.log(),console.log(p.default.bold(s.geminiPurple("GemKit Configuration"))),console.log(),console.log(JSON.stringify(e,null,2)),console.log()}async function fE(t){let e=Il(t);if(e===void 0){console.log(),u.error(`Config key not found: ${t}`),console.log();return}console.log(e)}async function zE(t,e){let i=e;e==="true"?i=!0:e==="false"?i=!1:isNaN(Number(e))||(i=Number(e));try{pl(t,i),console.log(),u.success(`Config updated: ${s.primary(t)} = ${s.success(String(i))}`),console.log()}catch(n){console.log(),u.error(`Failed to set config: ${n instanceof Error?n.message:String(n)}`),console.log()}}async function RE(){hl(),console.log(),u.success("Configuration reset to defaults."),console.log()}function rv(t){let e=t.command("cache <subcommand>","Cache management");e.example("gk cache stats # Show cache statistics"),e.example("gk cache clear # Clear all cache"),e.action(async i=>{let n=i||"stats";switch(n){case"stats":await dE();break;case"clear":await jE();break;default:console.log(),u.error(`Unknown subcommand: ${n}`),console.log(),process.exit(1)}})}async function dE(){let t=Gl();console.log(),console.log(p.default.bold(s.geminiPurple("Cache Statistics"))),console.log(),console.log(` ${s.dim("Entries:")} ${s.primary(String(t.entries))}`),console.log(` ${s.dim("Size:")} ${s.primary((t.size/1024).toFixed(2))} KB`),console.log()}async function jE(){let t=xl();console.log(),u.success(`Cleared ${s.success(String(t))} cache entries.`),console.log()}import{existsSync as gE}from"fs";import{join as xE}from"path";function ov(t){t.command("new <name>","Create a new project from starter kit").action(async e=>{let i=xE(process.cwd(),e);gE(i)&&(console.log(),u.error(`Directory already exists: ${e}`),console.log(),process.exit(1)),console.log(),console.log(p.default.bold(s.geminiPurple("Creating New Project"))),console.log(),u.info(`Name: ${s.primary(e)}`);let n=await Ii();n||(u.error("Failed to fetch latest starter kit."),console.log(),process.exit(1)),u.info(`Fetching latest starter kit (v${n.version})...`);let r=await pi(n),o=await Fi({source:r,destination:i,strip:1});o.success?(console.log(),u.success(`Project ${s.primary(e)} created successfully!`),console.log(`
12
+ `,r)}while(n!==-1);return o+=t.slice(r),o}var{stdout:rl,stderr:ol}=tl,As=Symbol("GENERATOR"),Ei=Symbol("STYLER"),Li=Symbol("IS_EMPTY"),sl=["ansi","ansi","ansi256","ansi16m"],Ii=Object.create(null),l7=(t,e={})=>{if(e.level&&!(Number.isInteger(e.level)&&e.level>=0&&e.level<=3))throw new Error("The `level` option should be an integer from 0 to 3");let i=rl?rl.level:0;t.level=e.level===void 0?i:e.level};var v7=t=>{let e=(...i)=>i.join(" ");return l7(e,t),Object.setPrototypeOf(e,_i.prototype),e};function _i(t){return v7(t)}Object.setPrototypeOf(_i.prototype,Function.prototype);for(let[t,e]of Object.entries(Re))Ii[t]={get(){let i=nr(this,ms(e.open,e.close,this[Ei]),this[Li]);return Object.defineProperty(this,t,{value:i}),i}};Ii.visible={get(){let t=nr(this,this[Ei],!0);return Object.defineProperty(this,"visible",{value:t}),t}};var us=(t,e,i,...n)=>t==="rgb"?e==="ansi16m"?Re[i].ansi16m(...n):e==="ansi256"?Re[i].ansi256(Re.rgbToAnsi256(...n)):Re[i].ansi(Re.rgbToAnsi(...n)):t==="hex"?us("rgb",e,i,...Re.hexToRgb(...n)):Re[i][t](...n),A7=["rgb","hex","ansi256"];for(let t of A7){Ii[t]={get(){let{level:i}=this;return function(...n){let r=ms(us(t,sl[i],"color",...n),Re.color.close,this[Ei]);return nr(this,r,this[Li])}}};let e="bg"+t[0].toUpperCase()+t.slice(1);Ii[e]={get(){let{level:i}=this;return function(...n){let r=ms(us(t,sl[i],"bgColor",...n),Re.bgColor.close,this[Ei]);return nr(this,r,this[Li])}}}}var u7=Object.defineProperties(()=>{},{...Ii,level:{enumerable:!0,get(){return this[As].level},set(t){this[As].level=t}}}),ms=(t,e,i)=>{let n,r;return i===void 0?(n=t,r=e):(n=i.openAll+t,r=e+i.closeAll),{open:t,close:e,openAll:n,closeAll:r,parent:i}},nr=(t,e,i)=>{let n=(...r)=>m7(n,r.length===1?""+r[0]:r.join(" "));return Object.setPrototypeOf(n,u7),n[As]=t,n[Ei]=e,n[Li]=i,n},m7=(t,e)=>{if(t.level<=0||!e)return t[Li]?"":e;let i=t[Ei];if(i===void 0)return e;let{openAll:n,closeAll:r}=i;if(e.includes("\x1B"))for(;i!==void 0;)e=il(e,i.close,i.open),i=i.parent;let o=e.indexOf(`
13
+ `);return o!==-1&&(e=nl(e,r,n,o)),n+e+r};Object.defineProperties(_i.prototype,Ii);var E7=_i(),$9=_i({level:ol?ol.level:0});var ze=E7;import ul from"node:process";import ar from"node:process";var I7=(t,e,i,n)=>{if(i==="length"||i==="prototype"||i==="arguments"||i==="caller")return;let r=Object.getOwnPropertyDescriptor(t,i),o=Object.getOwnPropertyDescriptor(e,i);!p7(r,o)&&n||Object.defineProperty(t,i,o)},p7=function(t,e){return t===void 0||t.configurable||t.writable===e.writable&&t.enumerable===e.enumerable&&t.configurable===e.configurable&&(t.writable||t.value===e.value)},f7=(t,e)=>{let i=Object.getPrototypeOf(e);i!==Object.getPrototypeOf(t)&&Object.setPrototypeOf(t,i)},h7=(t,e)=>`/* Wrapped ${t}*/
14
+ ${e}`,d7=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),R7=Object.getOwnPropertyDescriptor(Function.prototype.toString,"name"),z7=(t,e,i)=>{let n=i===""?"":`with ${i.trim()}() `,r=h7.bind(null,n,e.toString());Object.defineProperty(r,"name",R7);let{writable:o,enumerable:s,configurable:c}=d7;Object.defineProperty(t,"toString",{value:r,writable:o,enumerable:s,configurable:c})};function Es(t,e,{ignoreNonConfigurable:i=!1}={}){let{name:n}=t;for(let r of Reflect.ownKeys(e))I7(t,e,r,i);return f7(t,e),z7(t,e,n),t}var rr=new WeakMap,al=(t,e={})=>{if(typeof t!="function")throw new TypeError("Expected a function");let i,n=0,r=t.displayName||t.name||"<anonymous>",o=function(...s){if(rr.set(o,++n),n===1)i=t.apply(this,s),t=void 0;else if(e.throw===!0)throw new Error(`Function \`${r}\` can only be called once`);return i};return Es(o,t),rr.set(o,n),o};al.callCount=t=>{if(!rr.has(t))throw new Error(`The given function \`${t.name}\` is not wrapped by the \`onetime\` package`);return rr.get(t)};var cl=al;var Jt=[];Jt.push("SIGHUP","SIGINT","SIGTERM");process.platform!=="win32"&&Jt.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&Jt.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT");var or=t=>!!t&&typeof t=="object"&&typeof t.removeListener=="function"&&typeof t.emit=="function"&&typeof t.reallyExit=="function"&&typeof t.listeners=="function"&&typeof t.kill=="function"&&typeof t.pid=="number"&&typeof t.on=="function",Is=Symbol.for("signal-exit emitter"),ps=globalThis,j7=Object.defineProperty.bind(Object),fs=class{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(ps[Is])return ps[Is];j7(ps,Is,{value:this,writable:!1,enumerable:!1,configurable:!1})}on(e,i){this.listeners[e].push(i)}removeListener(e,i){let n=this.listeners[e],r=n.indexOf(i);r!==-1&&(r===0&&n.length===1?n.length=0:n.splice(r,1))}emit(e,i,n){if(this.emitted[e])return!1;this.emitted[e]=!0;let r=!1;for(let o of this.listeners[e])r=o(i,n)===!0||r;return e==="exit"&&(r=this.emit("afterExit",i,n)||r),r}},sr=class{},g7=t=>({onExit(e,i){return t.onExit(e,i)},load(){return t.load()},unload(){return t.unload()}}),hs=class extends sr{onExit(){return()=>{}}load(){}unload(){}},ds=class extends sr{#e=Rs.platform==="win32"?"SIGINT":"SIGHUP";#n=new fs;#i;#r;#a;#t={};#o=!1;constructor(e){super(),this.#i=e,this.#t={};for(let i of Jt)this.#t[i]=()=>{let n=this.#i.listeners(i),{count:r}=this.#n,o=e;if(typeof o.__signal_exit_emitter__=="object"&&typeof o.__signal_exit_emitter__.count=="number"&&(r+=o.__signal_exit_emitter__.count),n.length===r){this.unload();let s=this.#n.emit("exit",null,i),c=i==="SIGHUP"?this.#e:i;s||e.kill(e.pid,c)}};this.#a=e.reallyExit,this.#r=e.emit}onExit(e,i){if(!or(this.#i))return()=>{};this.#o===!1&&this.load();let n=i?.alwaysLast?"afterExit":"exit";return this.#n.on(n,e),()=>{this.#n.removeListener(n,e),this.#n.listeners.exit.length===0&&this.#n.listeners.afterExit.length===0&&this.unload()}}load(){if(!this.#o){this.#o=!0,this.#n.count+=1;for(let e of Jt)try{let i=this.#t[e];i&&this.#i.on(e,i)}catch{}this.#i.emit=(e,...i)=>this.#m(e,...i),this.#i.reallyExit=e=>this.#s(e)}}unload(){this.#o&&(this.#o=!1,Jt.forEach(e=>{let i=this.#t[e];if(!i)throw new Error("Listener not defined for signal: "+e);try{this.#i.removeListener(e,i)}catch{}}),this.#i.emit=this.#r,this.#i.reallyExit=this.#a,this.#n.count-=1)}#s(e){return or(this.#i)?(this.#i.exitCode=e||0,this.#n.emit("exit",this.#i.exitCode,null),this.#a.call(this.#i,this.#i.exitCode)):0}#m(e,...i){let n=this.#r;if(e==="exit"&&or(this.#i)){typeof i[0]=="number"&&(this.#i.exitCode=i[0]);let r=n.call(this.#i,e,...i);return this.#n.emit("exit",this.#i.exitCode,null),r}else return n.call(this.#i,e,...i)}},Rs=globalThis.process,{onExit:ll,load:af,unload:cf}=g7(or(Rs)?new ds(Rs):new hs);var vl=ar.stderr.isTTY?ar.stderr:ar.stdout.isTTY?ar.stdout:void 0,x7=vl?cl(()=>{ll(()=>{vl.write("\x1B[?25h")},{alwaysLast:!0})}):()=>{},Al=x7;var cr=!1,pi={};pi.show=(t=ul.stderr)=>{t.isTTY&&(cr=!1,t.write("\x1B[?25h"))};pi.hide=(t=ul.stderr)=>{t.isTTY&&(Al(),cr=!0,t.write("\x1B[?25l"))};pi.toggle=(t,e)=>{t!==void 0&&(cr=t),cr?pi.show(e):pi.hide(e)};var zs=pi;var tn=_n(js(),1);import je from"node:process";function gs(){return je.platform!=="win32"?je.env.TERM!=="linux":!!je.env.CI||!!je.env.WT_SESSION||!!je.env.TERMINUS_SUBLIME||je.env.ConEmuTask==="{cmd::Cmder}"||je.env.TERM_PROGRAM==="Terminus-Sublime"||je.env.TERM_PROGRAM==="vscode"||je.env.TERM==="xterm-256color"||je.env.TERM==="alacritty"||je.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var S7={info:ze.blue("\u2139"),success:ze.green("\u2714"),warning:ze.yellow("\u26A0"),error:ze.red("\u2716")},Y7={info:ze.blue("i"),success:ze.green("\u221A"),warning:ze.yellow("\u203C"),error:ze.red("\xD7")},W7=gs()?S7:Y7,$i=W7;function xs({onlyFirst:t=!1}={}){let r="(?:\\u001B\\][\\s\\S]*?(?:\\u0007|\\u001B\\u005C|\\u009C))|[\\u001B\\u009B][[\\]()#;?]*(?:\\d{1,4}(?:[;:]\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]";return new RegExp(r,t?void 0:"g")}var M7=xs();function en(t){if(typeof t!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof t}\``);return t.replace(M7,"")}function pl(t){return t===161||t===164||t===167||t===168||t===170||t===173||t===174||t>=176&&t<=180||t>=182&&t<=186||t>=188&&t<=191||t===198||t===208||t===215||t===216||t>=222&&t<=225||t===230||t>=232&&t<=234||t===236||t===237||t===240||t===242||t===243||t>=247&&t<=250||t===252||t===254||t===257||t===273||t===275||t===283||t===294||t===295||t===299||t>=305&&t<=307||t===312||t>=319&&t<=322||t===324||t>=328&&t<=331||t===333||t===338||t===339||t===358||t===359||t===363||t===462||t===464||t===466||t===468||t===470||t===472||t===474||t===476||t===593||t===609||t===708||t===711||t>=713&&t<=715||t===717||t===720||t>=728&&t<=731||t===733||t===735||t>=768&&t<=879||t>=913&&t<=929||t>=931&&t<=937||t>=945&&t<=961||t>=963&&t<=969||t===1025||t>=1040&&t<=1103||t===1105||t===8208||t>=8211&&t<=8214||t===8216||t===8217||t===8220||t===8221||t>=8224&&t<=8226||t>=8228&&t<=8231||t===8240||t===8242||t===8243||t===8245||t===8251||t===8254||t===8308||t===8319||t>=8321&&t<=8324||t===8364||t===8451||t===8453||t===8457||t===8467||t===8470||t===8481||t===8482||t===8486||t===8491||t===8531||t===8532||t>=8539&&t<=8542||t>=8544&&t<=8555||t>=8560&&t<=8569||t===8585||t>=8592&&t<=8601||t===8632||t===8633||t===8658||t===8660||t===8679||t===8704||t===8706||t===8707||t===8711||t===8712||t===8715||t===8719||t===8721||t===8725||t===8730||t>=8733&&t<=8736||t===8739||t===8741||t>=8743&&t<=8748||t===8750||t>=8756&&t<=8759||t===8764||t===8765||t===8776||t===8780||t===8786||t===8800||t===8801||t>=8804&&t<=8807||t===8810||t===8811||t===8814||t===8815||t===8834||t===8835||t===8838||t===8839||t===8853||t===8857||t===8869||t===8895||t===8978||t>=9312&&t<=9449||t>=9451&&t<=9547||t>=9552&&t<=9587||t>=9600&&t<=9615||t>=9618&&t<=9621||t===9632||t===9633||t>=9635&&t<=9641||t===9650||t===9651||t===9654||t===9655||t===9660||t===9661||t===9664||t===9665||t>=9670&&t<=9672||t===9675||t>=9678&&t<=9681||t>=9698&&t<=9701||t===9711||t===9733||t===9734||t===9737||t===9742||t===9743||t===9756||t===9758||t===9792||t===9794||t===9824||t===9825||t>=9827&&t<=9829||t>=9831&&t<=9834||t===9836||t===9837||t===9839||t===9886||t===9887||t===9919||t>=9926&&t<=9933||t>=9935&&t<=9939||t>=9941&&t<=9953||t===9955||t===9960||t===9961||t>=9963&&t<=9969||t===9972||t>=9974&&t<=9977||t===9979||t===9980||t===9982||t===9983||t===10045||t>=10102&&t<=10111||t>=11094&&t<=11097||t>=12872&&t<=12879||t>=57344&&t<=63743||t>=65024&&t<=65039||t===65533||t>=127232&&t<=127242||t>=127248&&t<=127277||t>=127280&&t<=127337||t>=127344&&t<=127373||t===127375||t===127376||t>=127387&&t<=127404||t>=917760&&t<=917999||t>=983040&&t<=1048573||t>=1048576&&t<=1114109}function fl(t){return t===12288||t>=65281&&t<=65376||t>=65504&&t<=65510}function hl(t){return t>=4352&&t<=4447||t===8986||t===8987||t===9001||t===9002||t>=9193&&t<=9196||t===9200||t===9203||t===9725||t===9726||t===9748||t===9749||t>=9776&&t<=9783||t>=9800&&t<=9811||t===9855||t>=9866&&t<=9871||t===9875||t===9889||t===9898||t===9899||t===9917||t===9918||t===9924||t===9925||t===9934||t===9940||t===9962||t===9970||t===9971||t===9973||t===9978||t===9981||t===9989||t===9994||t===9995||t===10024||t===10060||t===10062||t>=10067&&t<=10069||t===10071||t>=10133&&t<=10135||t===10160||t===10175||t===11035||t===11036||t===11088||t===11093||t>=11904&&t<=11929||t>=11931&&t<=12019||t>=12032&&t<=12245||t>=12272&&t<=12287||t>=12289&&t<=12350||t>=12353&&t<=12438||t>=12441&&t<=12543||t>=12549&&t<=12591||t>=12593&&t<=12686||t>=12688&&t<=12773||t>=12783&&t<=12830||t>=12832&&t<=12871||t>=12880&&t<=42124||t>=42128&&t<=42182||t>=43360&&t<=43388||t>=44032&&t<=55203||t>=63744&&t<=64255||t>=65040&&t<=65049||t>=65072&&t<=65106||t>=65108&&t<=65126||t>=65128&&t<=65131||t>=94176&&t<=94180||t>=94192&&t<=94198||t>=94208&&t<=101589||t>=101631&&t<=101662||t>=101760&&t<=101874||t>=110576&&t<=110579||t>=110581&&t<=110587||t===110589||t===110590||t>=110592&&t<=110882||t===110898||t>=110928&&t<=110930||t===110933||t>=110948&&t<=110951||t>=110960&&t<=111355||t>=119552&&t<=119638||t>=119648&&t<=119670||t===126980||t===127183||t===127374||t>=127377&&t<=127386||t>=127488&&t<=127490||t>=127504&&t<=127547||t>=127552&&t<=127560||t===127568||t===127569||t>=127584&&t<=127589||t>=127744&&t<=127776||t>=127789&&t<=127797||t>=127799&&t<=127868||t>=127870&&t<=127891||t>=127904&&t<=127946||t>=127951&&t<=127955||t>=127968&&t<=127984||t===127988||t>=127992&&t<=128062||t===128064||t>=128066&&t<=128252||t>=128255&&t<=128317||t>=128331&&t<=128334||t>=128336&&t<=128359||t===128378||t===128405||t===128406||t===128420||t>=128507&&t<=128591||t>=128640&&t<=128709||t===128716||t>=128720&&t<=128722||t>=128725&&t<=128728||t>=128732&&t<=128735||t===128747||t===128748||t>=128756&&t<=128764||t>=128992&&t<=129003||t===129008||t>=129292&&t<=129338||t>=129340&&t<=129349||t>=129351&&t<=129535||t>=129648&&t<=129660||t>=129664&&t<=129674||t>=129678&&t<=129734||t===129736||t>=129741&&t<=129756||t>=129759&&t<=129770||t>=129775&&t<=129784||t>=131072&&t<=196605||t>=196608&&t<=262141}function C7(t){if(!Number.isSafeInteger(t))throw new TypeError(`Expected a code point, got \`${typeof t}\`.`)}function dl(t,{ambiguousAsWide:e=!1}={}){return C7(t),fl(t)||hl(t)||e&&pl(t)?2:1}var jl=_n(zl(),1),O7=new Intl.Segmenter,U7=new RegExp("^\\p{Default_Ignorable_Code_Point}$","u");function Gs(t,e={}){if(typeof t!="string"||t.length===0)return 0;let{ambiguousIsNarrow:i=!0,countAnsiEscapeCodes:n=!1}=e;if(n||(t=en(t)),t.length===0)return 0;let r=0,o={ambiguousAsWide:!i};for(let{segment:s}of O7.segment(t)){let c=s.codePointAt(0);if(!(c<=31||c>=127&&c<=159)&&!(c>=8203&&c<=8207||c===65279)&&!(c>=768&&c<=879||c>=6832&&c<=6911||c>=7616&&c<=7679||c>=8400&&c<=8447||c>=65056&&c<=65071)&&!(c>=55296&&c<=57343)&&!(c>=65024&&c<=65039)&&!U7.test(s)){if((0,jl.default)().test(s)){r+=2;continue}r+=dl(c,o)}}return r}function Ss({stream:t=process.stdout}={}){return!!(t&&t.isTTY&&process.env.TERM!=="dumb"&&!("CI"in process.env))}import gl from"node:process";function Ys(){let{env:t}=gl,{TERM:e,TERM_PROGRAM:i}=t;return gl.platform!=="win32"?e!=="linux":!!t.WT_SESSION||!!t.TERMINUS_SUBLIME||t.ConEmuTask==="{cmd::Cmder}"||i==="Terminus-Sublime"||i==="vscode"||e==="xterm-256color"||e==="alacritty"||e==="rxvt-unicode"||e==="rxvt-unicode-256color"||t.TERMINAL_EMULATOR==="JetBrains-JediTerm"}import Ue from"node:process";var K7=3,Ws=class{#e=0;start(){this.#e++,this.#e===1&&this.#n()}stop(){if(this.#e<=0)throw new Error("`stop` called more times than `start`");this.#e--,this.#e===0&&this.#i()}#n(){Ue.platform==="win32"||!Ue.stdin.isTTY||(Ue.stdin.setRawMode(!0),Ue.stdin.on("data",this.#r),Ue.stdin.resume())}#i(){Ue.stdin.isTTY&&(Ue.stdin.off("data",this.#r),Ue.stdin.pause(),Ue.stdin.setRawMode(!1))}#r(e){e[0]===K7&&Ue.emit("SIGINT")}},V7=new Ws,Ms=V7;var N7=_n(js(),1),Cs=class{#e=0;#n=!1;#i=0;#r=-1;#a=0;#t;#o;#s;#m;#I;#v;#A;#u;#p;#c;#l;color;constructor(e){typeof e=="string"&&(e={text:e}),this.#t={color:"cyan",stream:vr.stderr,discardStdin:!0,hideCursor:!0,...e},this.color=this.#t.color,this.spinner=this.#t.spinner,this.#I=this.#t.interval,this.#s=this.#t.stream,this.#v=typeof this.#t.isEnabled=="boolean"?this.#t.isEnabled:Ss({stream:this.#s}),this.#A=typeof this.#t.isSilent=="boolean"?this.#t.isSilent:!1,this.text=this.#t.text,this.prefixText=this.#t.prefixText,this.suffixText=this.#t.suffixText,this.indent=this.#t.indent,vr.env.NODE_ENV==="test"&&(this._stream=this.#s,this._isEnabled=this.#v,Object.defineProperty(this,"_linesToClear",{get(){return this.#e},set(i){this.#e=i}}),Object.defineProperty(this,"_frameIndex",{get(){return this.#r}}),Object.defineProperty(this,"_lineCount",{get(){return this.#i}}))}get indent(){return this.#u}set indent(e=0){if(!(e>=0&&Number.isInteger(e)))throw new Error("The `indent` option must be an integer from 0 and up");this.#u=e,this.#E()}get interval(){return this.#I??this.#o.interval??100}get spinner(){return this.#o}set spinner(e){if(this.#r=-1,this.#I=void 0,typeof e=="object"){if(e.frames===void 0)throw new Error("The given spinner must have a `frames` property");this.#o=e}else if(!Ys())this.#o=tn.default.line;else if(e===void 0)this.#o=tn.default.dots;else if(e!=="default"&&tn.default[e])this.#o=tn.default[e];else throw new Error(`There is no built-in spinner named '${e}'. See https://github.com/sindresorhus/cli-spinners/blob/main/spinners.json for a full list.`)}get text(){return this.#p}set text(e=""){this.#p=e,this.#E()}get prefixText(){return this.#c}set prefixText(e=""){this.#c=e,this.#E()}get suffixText(){return this.#l}set suffixText(e=""){this.#l=e,this.#E()}get isSpinning(){return this.#m!==void 0}#f(e=this.#c,i=" "){return typeof e=="string"&&e!==""?e+i:typeof e=="function"?e()+i:""}#h(e=this.#l,i=" "){return typeof e=="string"&&e!==""?i+e:typeof e=="function"?i+e():""}#E(){let e=this.#s.columns??80,i=this.#f(this.#c,"-"),n=this.#h(this.#l,"-"),r=" ".repeat(this.#u)+i+"--"+this.#p+"--"+n;this.#i=0;for(let o of en(r).split(`
15
+ `))this.#i+=Math.max(1,Math.ceil(Gs(o,{countAnsiEscapeCodes:!0})/e))}get isEnabled(){return this.#v&&!this.#A}set isEnabled(e){if(typeof e!="boolean")throw new TypeError("The `isEnabled` option must be a boolean");this.#v=e}get isSilent(){return this.#A}set isSilent(e){if(typeof e!="boolean")throw new TypeError("The `isSilent` option must be a boolean");this.#A=e}frame(){let e=Date.now();(this.#r===-1||e-this.#a>=this.interval)&&(this.#r=++this.#r%this.#o.frames.length,this.#a=e);let{frames:i}=this.#o,n=i[this.#r];this.color&&(n=ze[this.color](n));let r=typeof this.#c=="string"&&this.#c!==""?this.#c+" ":"",o=typeof this.text=="string"?" "+this.text:"",s=typeof this.#l=="string"&&this.#l!==""?" "+this.#l:"";return r+n+o+s}clear(){if(!this.#v||!this.#s.isTTY)return this;this.#s.cursorTo(0);for(let e=0;e<this.#e;e++)e>0&&this.#s.moveCursor(0,-1),this.#s.clearLine(1);return(this.#u||this.lastIndent!==this.#u)&&this.#s.cursorTo(this.#u),this.lastIndent=this.#u,this.#e=0,this}render(){return this.#A?this:(this.clear(),this.#s.write(this.frame()),this.#e=this.#i,this)}start(e){return e&&(this.text=e),this.#A?this:this.#v?this.isSpinning?this:(this.#t.hideCursor&&zs.hide(this.#s),this.#t.discardStdin&&vr.stdin.isTTY&&(this.#n=!0,Ms.start()),this.render(),this.#m=setInterval(this.render.bind(this),this.interval),this):(this.text&&this.#s.write(`- ${this.text}
16
+ `),this)}stop(){return this.#v?(clearInterval(this.#m),this.#m=void 0,this.#r=0,this.clear(),this.#t.hideCursor&&zs.show(this.#s),this.#t.discardStdin&&vr.stdin.isTTY&&this.#n&&(Ms.stop(),this.#n=!1),this):this}succeed(e){return this.stopAndPersist({symbol:$i.success,text:e})}fail(e){return this.stopAndPersist({symbol:$i.error,text:e})}warn(e){return this.stopAndPersist({symbol:$i.warning,text:e})}info(e){return this.stopAndPersist({symbol:$i.info,text:e})}stopAndPersist(e={}){if(this.#A)return this;let i=e.prefixText??this.#c,n=this.#f(i," "),r=e.symbol??" ",o=e.text??this.text,c=typeof o=="string"?(r?" ":"")+o:"",l=e.suffixText??this.#l,v=this.#h(l," "),A=n+r+c+v+`
17
+ `;return this.stop(),this.#s.write(A),this}};function Ke(t){return new Cs(t)}import{existsSync as Yl,readFileSync as B7,writeFileSync as Z7,mkdirSync as P7}from"fs";import{dirname as q7}from"path";import{homedir as xl}from"os";import{join as y}from"path";var k7=y(xl(),".gemkit"),Os=y(k7,"projects"),Us=y(xl(),".gemini"),_f=y(Us,"config"),fi=y(Us,"cache"),$f=y(Us,"tmp"),hi=".gemini";var F7="plans",Q7=".gk.json",J7="metadata.json",b7=".env";function Ar(t=process.cwd()){return y(t,hi)}function Ks(t=process.cwd()){return y(t,hi,Q7)}function Vs(t=process.cwd()){return y(t,hi,J7)}function bt(t=process.cwd()){return y(t,hi,b7)}function nn(t=process.cwd()){return y(t,hi,"agents")}function Bt(t=process.cwd()){return y(t,hi,"extensions")}function di(t=process.cwd()){return y(t,F7)}function rn(t){return t?t.replace(/^[A-Za-z]:/,e=>e.replace(":","")).replace(/[\\/]+/g,"-").replace(/[^a-zA-Z0-9-]/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,""):""}function we(t){return y(Os,t)}function Zt(t,e){return y(we(t),`gk-session-${e}.json`)}function on(t,e){return y(we(t),`gk-project-${e}.json`)}var me={defaultScope:"local",github:{repo:"therichardngai-code/gemkit-kits-starter",apiUrl:"https://api.github.com"},cache:{enabled:!0,ttl:3600},installation:{excludePatterns:[],backupOnUpdate:!0},ui:{colors:!0,spinner:!0,verbose:!1},paths:{},spawn:{defaultModel:"gemini-2.5-flash",music:!1},office:{enabled:!0,mode:"web",port:3847,autoOpen:!0,sounds:!1,refreshRate:500},update:{autoCheck:!0,checkInterval:24,notifyOnly:!0}};function Gl(t){return!(!t||typeof t!="object")}function Sl(t){return{...me,...t,github:{...me.github,...t.github||{}},cache:{...me.cache,...t.cache||{}},installation:{...me.installation,...t.installation||{}},ui:{...me.ui,...t.ui||{}},paths:{...me.paths,...t.paths||{}},spawn:{...me.spawn,...t.spawn||{}},office:{...me.office,...t.office||{}},update:{...me.update,...t.update||{}}}}var ur=class extends Error{constructor(i,n="GEMKIT_ERROR",r){super(i);this.code=n;this.details=r;this.name="GemKitError"}},Pt=class extends ur{constructor(e,i){super(e,"CONFIG_ERROR",i),this.name="ConfigError"}};var Ee=class extends ur{constructor(e,i){super(e,"GITHUB_ERROR",i),this.name="GitHubError"}};function Ve(t){let e=Ks(t);if(!Yl(e))return me;try{let i=B7(e,"utf-8"),n=JSON.parse(i);if(!Gl(n))throw new Pt("Invalid configuration format");return Sl(n)}catch(i){throw i instanceof Pt?i:new Pt(`Failed to load config: ${i}`)}}function Wl(t,e){let i=Ks(e),n=q7(i);Yl(n)||P7(n,{recursive:!0}),Z7(i,JSON.stringify(t,null,2))}function Ml(t,e){let i=Ve(e),n=t.split("."),r=i;for(let o of n)if(r&&typeof r=="object"&&o in r)r=r[o];else return;return r}function Cl(t,e,i){let n=Ve(i),r=t.split("."),o=r.pop();if(!o)throw new Pt("Invalid config path");let s=n;for(let c of r)(!(c in s)||typeof s[c]!="object")&&(s[c]={}),s=s[c];s[o]=e,Wl(n,i)}function Ol(t){Wl(me,t)}import{existsSync as Ul,readFileSync as y7,writeFileSync as D7,mkdirSync as w7,readdirSync as Kl,unlinkSync as Vl,statSync as T7}from"fs";import{join as Ns}from"path";function ks(){return Ul(fi)||w7(fi,{recursive:!0}),fi}function Nl(t){let e=t.replace(/[^a-zA-Z0-9-_]/g,"_");return Ns(ks(),`${e}.json`)}function mr(t){let e=Nl(t);if(!Ul(e))return null;try{let i=y7(e,"utf-8"),n=JSON.parse(i);return Date.now()-n.timestamp>n.ttl*1e3?(Vl(e),null):n.data}catch{return null}}function Er(t,e,i=3600){let n=Nl(t),r={key:t,data:e,timestamp:Date.now(),ttl:i};D7(n,JSON.stringify(r,null,2))}function kl(){let t=ks(),e=Kl(t).filter(i=>i.endsWith(".json"));for(let i of e)Vl(Ns(t,i));return e.length}function Fl(){let t=ks(),e=Kl(t).filter(n=>n.endsWith(".json")),i=0;for(let n of e){let r=T7(Ns(t,n));i+=r.size}return{entries:e.length,size:i}}var Ql="github-releases",X7=300;async function Ir(t=10){let e=mr(Ql);if(e)return e.slice(0,t);let i=Ve(),{repo:n,apiUrl:r}=i.github,o=`${r}/repos/${n}/releases?per_page=${t}`;try{let s=await fetch(o,{headers:{Accept:"application/vnd.github.v3+json","User-Agent":"gemkit-cli"}});if(!s.ok)throw new Ee(`Failed to fetch releases: ${s.status}`);let l=(await s.json()).map(v=>({version:v.tag_name.replace(/^v/,""),tag:v.tag_name,publishedAt:v.published_at,prerelease:v.prerelease,assets:v.assets.map(A=>({name:A.name,url:A.url,size:A.size,downloadUrl:A.browser_download_url}))}));return Er(Ql,l,X7),l}catch(s){throw s instanceof Ee?s:new Ee(`Failed to fetch releases: ${s}`)}}async function qt(){let t=await Ir(1);return t.length>0?t[0]:null}async function Jl(t){return(await Ir(50)).find(i=>i.version===t||i.tag===t)||null}import{createWriteStream as H7,existsSync as L7,mkdirSync as _7}from"fs";import{pipeline as $7}from"stream/promises";import{join as eu}from"path";async function tu(t,e=fi){L7(e)||_7(e,{recursive:!0});let i=eu(e,t.name);try{let n=await fetch(t.downloadUrl,{headers:{"User-Agent":"gemkit-cli"}});if(!n.ok)throw new Ee(`Failed to download asset: ${n.status}`);if(!n.body)throw new Ee("No response body");let r=H7(i);return await $7(n.body,r),i}catch(n){throw n instanceof Ee?n:new Ee(`Download failed: ${n}`)}}async function Ri(t){let e=t.assets.find(i=>i.name.endsWith(".tar.gz")||i.name.endsWith(".tgz"));if(!e)throw new Ee("No tarball asset found in release");return tu(e)}import{createReadStream as sE,createWriteStream as cz,existsSync as iv,mkdirSync as aE}from"fs";import{pipeline as cE}from"stream/promises";import{createGunzip as lE}from"zlib";import uu from"events";import ee from"fs";import{EventEmitter as Ps}from"node:events";import ql from"node:stream";import{StringDecoder as iu}from"node:string_decoder";var bl=typeof process=="object"&&process?process:{stdout:null,stderr:null},nu=t=>!!t&&typeof t=="object"&&(t instanceof vn||t instanceof ql||ru(t)||ou(t)),ru=t=>!!t&&typeof t=="object"&&t instanceof Ps&&typeof t.pipe=="function"&&t.pipe!==ql.Writable.prototype.pipe,ou=t=>!!t&&typeof t=="object"&&t instanceof Ps&&typeof t.write=="function"&&typeof t.end=="function",Te=Symbol("EOF"),Xe=Symbol("maybeEmitEnd"),mt=Symbol("emittedEnd"),pr=Symbol("emittingEnd"),sn=Symbol("emittedError"),fr=Symbol("closed"),Bl=Symbol("read"),hr=Symbol("flush"),Zl=Symbol("flushChunk"),ge=Symbol("encoding"),zi=Symbol("decoder"),k=Symbol("flowing"),an=Symbol("paused"),ji=Symbol("resume"),F=Symbol("buffer"),L=Symbol("pipes"),Q=Symbol("bufferLength"),Fs=Symbol("bufferPush"),dr=Symbol("bufferShift"),D=Symbol("objectMode"),C=Symbol("destroyed"),Qs=Symbol("error"),Js=Symbol("emitData"),Pl=Symbol("emitEnd"),bs=Symbol("emitEnd2"),Ne=Symbol("async"),Bs=Symbol("abort"),Rr=Symbol("aborted"),cn=Symbol("signal"),yt=Symbol("dataListeners"),te=Symbol("discarded"),ln=t=>Promise.resolve().then(t),su=t=>t(),au=t=>t==="end"||t==="finish"||t==="prefinish",cu=t=>t instanceof ArrayBuffer||!!t&&typeof t=="object"&&t.constructor&&t.constructor.name==="ArrayBuffer"&&t.byteLength>=0,lu=t=>!Buffer.isBuffer(t)&&ArrayBuffer.isView(t),zr=class{src;dest;opts;ondrain;constructor(e,i,n){this.src=e,this.dest=i,this.opts=n,this.ondrain=()=>e[ji](),this.dest.on("drain",this.ondrain)}unpipe(){this.dest.removeListener("drain",this.ondrain)}proxyErrors(e){}end(){this.unpipe(),this.opts.end&&this.dest.end()}},Zs=class extends zr{unpipe(){this.src.removeListener("error",this.proxyErrors),super.unpipe()}constructor(e,i,n){super(e,i,n),this.proxyErrors=r=>i.emit("error",r),e.on("error",this.proxyErrors)}},vu=t=>!!t.objectMode,Au=t=>!t.objectMode&&!!t.encoding&&t.encoding!=="buffer",vn=class extends Ps{[k]=!1;[an]=!1;[L]=[];[F]=[];[D];[ge];[Ne];[zi];[Te]=!1;[mt]=!1;[pr]=!1;[fr]=!1;[sn]=null;[Q]=0;[C]=!1;[cn];[Rr]=!1;[yt]=0;[te]=!1;writable=!0;readable=!0;constructor(...e){let i=e[0]||{};if(super(),i.objectMode&&typeof i.encoding=="string")throw new TypeError("Encoding and objectMode may not be used together");vu(i)?(this[D]=!0,this[ge]=null):Au(i)?(this[ge]=i.encoding,this[D]=!1):(this[D]=!1,this[ge]=null),this[Ne]=!!i.async,this[zi]=this[ge]?new iu(this[ge]):null,i&&i.debugExposeBuffer===!0&&Object.defineProperty(this,"buffer",{get:()=>this[F]}),i&&i.debugExposePipes===!0&&Object.defineProperty(this,"pipes",{get:()=>this[L]});let{signal:n}=i;n&&(this[cn]=n,n.aborted?this[Bs]():n.addEventListener("abort",()=>this[Bs]()))}get bufferLength(){return this[Q]}get encoding(){return this[ge]}set encoding(e){throw new Error("Encoding must be set at instantiation time")}setEncoding(e){throw new Error("Encoding must be set at instantiation time")}get objectMode(){return this[D]}set objectMode(e){throw new Error("objectMode must be set at instantiation time")}get async(){return this[Ne]}set async(e){this[Ne]=this[Ne]||!!e}[Bs](){this[Rr]=!0,this.emit("abort",this[cn]?.reason),this.destroy(this[cn]?.reason)}get aborted(){return this[Rr]}set aborted(e){}write(e,i,n){if(this[Rr])return!1;if(this[Te])throw new Error("write after end");if(this[C])return this.emit("error",Object.assign(new Error("Cannot call write after a stream was destroyed"),{code:"ERR_STREAM_DESTROYED"})),!0;typeof i=="function"&&(n=i,i="utf8"),i||(i="utf8");let r=this[Ne]?ln:su;if(!this[D]&&!Buffer.isBuffer(e)){if(lu(e))e=Buffer.from(e.buffer,e.byteOffset,e.byteLength);else if(cu(e))e=Buffer.from(e);else if(typeof e!="string")throw new Error("Non-contiguous data written to non-objectMode stream")}return this[D]?(this[k]&&this[Q]!==0&&this[hr](!0),this[k]?this.emit("data",e):this[Fs](e),this[Q]!==0&&this.emit("readable"),n&&r(n),this[k]):e.length?(typeof e=="string"&&!(i===this[ge]&&!this[zi]?.lastNeed)&&(e=Buffer.from(e,i)),Buffer.isBuffer(e)&&this[ge]&&(e=this[zi].write(e)),this[k]&&this[Q]!==0&&this[hr](!0),this[k]?this.emit("data",e):this[Fs](e),this[Q]!==0&&this.emit("readable"),n&&r(n),this[k]):(this[Q]!==0&&this.emit("readable"),n&&r(n),this[k])}read(e){if(this[C])return null;if(this[te]=!1,this[Q]===0||e===0||e&&e>this[Q])return this[Xe](),null;this[D]&&(e=null),this[F].length>1&&!this[D]&&(this[F]=[this[ge]?this[F].join(""):Buffer.concat(this[F],this[Q])]);let i=this[Bl](e||null,this[F][0]);return this[Xe](),i}[Bl](e,i){if(this[D])this[dr]();else{let n=i;e===n.length||e===null?this[dr]():typeof n=="string"?(this[F][0]=n.slice(e),i=n.slice(0,e),this[Q]-=e):(this[F][0]=n.subarray(e),i=n.subarray(0,e),this[Q]-=e)}return this.emit("data",i),!this[F].length&&!this[Te]&&this.emit("drain"),i}end(e,i,n){return typeof e=="function"&&(n=e,e=void 0),typeof i=="function"&&(n=i,i="utf8"),e!==void 0&&this.write(e,i),n&&this.once("end",n),this[Te]=!0,this.writable=!1,(this[k]||!this[an])&&this[Xe](),this}[ji](){this[C]||(!this[yt]&&!this[L].length&&(this[te]=!0),this[an]=!1,this[k]=!0,this.emit("resume"),this[F].length?this[hr]():this[Te]?this[Xe]():this.emit("drain"))}resume(){return this[ji]()}pause(){this[k]=!1,this[an]=!0,this[te]=!1}get destroyed(){return this[C]}get flowing(){return this[k]}get paused(){return this[an]}[Fs](e){this[D]?this[Q]+=1:this[Q]+=e.length,this[F].push(e)}[dr](){return this[D]?this[Q]-=1:this[Q]-=this[F][0].length,this[F].shift()}[hr](e=!1){do;while(this[Zl](this[dr]())&&this[F].length);!e&&!this[F].length&&!this[Te]&&this.emit("drain")}[Zl](e){return this.emit("data",e),this[k]}pipe(e,i){if(this[C])return e;this[te]=!1;let n=this[mt];return i=i||{},e===bl.stdout||e===bl.stderr?i.end=!1:i.end=i.end!==!1,i.proxyErrors=!!i.proxyErrors,n?i.end&&e.end():(this[L].push(i.proxyErrors?new Zs(this,e,i):new zr(this,e,i)),this[Ne]?ln(()=>this[ji]()):this[ji]()),e}unpipe(e){let i=this[L].find(n=>n.dest===e);i&&(this[L].length===1?(this[k]&&this[yt]===0&&(this[k]=!1),this[L]=[]):this[L].splice(this[L].indexOf(i),1),i.unpipe())}addListener(e,i){return this.on(e,i)}on(e,i){let n=super.on(e,i);if(e==="data")this[te]=!1,this[yt]++,!this[L].length&&!this[k]&&this[ji]();else if(e==="readable"&&this[Q]!==0)super.emit("readable");else if(au(e)&&this[mt])super.emit(e),this.removeAllListeners(e);else if(e==="error"&&this[sn]){let r=i;this[Ne]?ln(()=>r.call(this,this[sn])):r.call(this,this[sn])}return n}removeListener(e,i){return this.off(e,i)}off(e,i){let n=super.off(e,i);return e==="data"&&(this[yt]=this.listeners("data").length,this[yt]===0&&!this[te]&&!this[L].length&&(this[k]=!1)),n}removeAllListeners(e){let i=super.removeAllListeners(e);return(e==="data"||e===void 0)&&(this[yt]=0,!this[te]&&!this[L].length&&(this[k]=!1)),i}get emittedEnd(){return this[mt]}[Xe](){!this[pr]&&!this[mt]&&!this[C]&&this[F].length===0&&this[Te]&&(this[pr]=!0,this.emit("end"),this.emit("prefinish"),this.emit("finish"),this[fr]&&this.emit("close"),this[pr]=!1)}emit(e,...i){let n=i[0];if(e!=="error"&&e!=="close"&&e!==C&&this[C])return!1;if(e==="data")return!this[D]&&!n?!1:this[Ne]?(ln(()=>this[Js](n)),!0):this[Js](n);if(e==="end")return this[Pl]();if(e==="close"){if(this[fr]=!0,!this[mt]&&!this[C])return!1;let o=super.emit("close");return this.removeAllListeners("close"),o}else if(e==="error"){this[sn]=n,super.emit(Qs,n);let o=!this[cn]||this.listeners("error").length?super.emit("error",n):!1;return this[Xe](),o}else if(e==="resume"){let o=super.emit("resume");return this[Xe](),o}else if(e==="finish"||e==="prefinish"){let o=super.emit(e);return this.removeAllListeners(e),o}let r=super.emit(e,...i);return this[Xe](),r}[Js](e){for(let n of this[L])n.dest.write(e)===!1&&this.pause();let i=this[te]?!1:super.emit("data",e);return this[Xe](),i}[Pl](){return this[mt]?!1:(this[mt]=!0,this.readable=!1,this[Ne]?(ln(()=>this[bs]()),!0):this[bs]())}[bs](){if(this[zi]){let i=this[zi].end();if(i){for(let n of this[L])n.dest.write(i);this[te]||super.emit("data",i)}}for(let i of this[L])i.end();let e=super.emit("end");return this.removeAllListeners("end"),e}async collect(){let e=Object.assign([],{dataLength:0});this[D]||(e.dataLength=0);let i=this.promise();return this.on("data",n=>{e.push(n),this[D]||(e.dataLength+=n.length)}),await i,e}async concat(){if(this[D])throw new Error("cannot concat in objectMode");let e=await this.collect();return this[ge]?e.join(""):Buffer.concat(e,e.dataLength)}async promise(){return new Promise((e,i)=>{this.on(C,()=>i(new Error("stream destroyed"))),this.on("error",n=>i(n)),this.on("end",()=>e())})}[Symbol.asyncIterator](){this[te]=!1;let e=!1,i=async()=>(this.pause(),e=!0,{value:void 0,done:!0});return{next:()=>{if(e)return i();let r=this.read();if(r!==null)return Promise.resolve({done:!1,value:r});if(this[Te])return i();let o,s,c=u=>{this.off("data",l),this.off("end",v),this.off(C,A),i(),s(u)},l=u=>{this.off("error",c),this.off("end",v),this.off(C,A),this.pause(),o({value:u,done:!!this[Te]})},v=()=>{this.off("error",c),this.off("data",l),this.off(C,A),i(),o({done:!0,value:void 0})},A=()=>c(new Error("stream destroyed"));return new Promise((u,I)=>{s=I,o=u,this.once(C,A),this.once("error",c),this.once("end",v),this.once("data",l)})},throw:i,return:i,[Symbol.asyncIterator](){return this}}}[Symbol.iterator](){this[te]=!1;let e=!1,i=()=>(this.pause(),this.off(Qs,i),this.off(C,i),this.off("end",i),e=!0,{done:!0,value:void 0}),n=()=>{if(e)return i();let r=this.read();return r===null?i():{done:!1,value:r}};return this.once("end",i),this.once(Qs,i),this.once(C,i),{next:n,throw:i,return:i,[Symbol.iterator](){return this}}}destroy(e){if(this[C])return e?this.emit("error",e):this.emit(C),this;this[C]=!0,this[te]=!0,this[F].length=0,this[Q]=0;let i=this;return typeof i.close=="function"&&!this[fr]&&i.close(),e?this.emit("error",e):this.emit(C),this}static get isStream(){return nu}};var mu=ee.writev,It=Symbol("_autoClose"),Ge=Symbol("_close"),An=Symbol("_ended"),g=Symbol("_fd"),qs=Symbol("_finished"),Le=Symbol("_flags"),ys=Symbol("_flush"),Xs=Symbol("_handleChunk"),Hs=Symbol("_makeBuf"),mn=Symbol("_mode"),jr=Symbol("_needDrain"),Gi=Symbol("_onerror"),Si=Symbol("_onopen"),Ds=Symbol("_onread"),gi=Symbol("_onwrite"),pt=Symbol("_open"),xe=Symbol("_path"),Et=Symbol("_pos"),ke=Symbol("_queue"),xi=Symbol("_read"),ws=Symbol("_readSize"),He=Symbol("_reading"),un=Symbol("_remain"),Ts=Symbol("_size"),gr=Symbol("_write"),Dt=Symbol("_writing"),xr=Symbol("_defaultFlag"),wt=Symbol("_errored"),Tt=class extends vn{[wt]=!1;[g];[xe];[ws];[He]=!1;[Ts];[un];[It];constructor(e,i){if(i=i||{},super(i),this.readable=!0,this.writable=!1,typeof e!="string")throw new TypeError("path must be a string");this[wt]=!1,this[g]=typeof i.fd=="number"?i.fd:void 0,this[xe]=e,this[ws]=i.readSize||16*1024*1024,this[He]=!1,this[Ts]=typeof i.size=="number"?i.size:1/0,this[un]=this[Ts],this[It]=typeof i.autoClose=="boolean"?i.autoClose:!0,typeof this[g]=="number"?this[xi]():this[pt]()}get fd(){return this[g]}get path(){return this[xe]}write(){throw new TypeError("this is a readable stream")}end(){throw new TypeError("this is a readable stream")}[pt](){ee.open(this[xe],"r",(e,i)=>this[Si](e,i))}[Si](e,i){e?this[Gi](e):(this[g]=i,this.emit("open",i),this[xi]())}[Hs](){return Buffer.allocUnsafe(Math.min(this[ws],this[un]))}[xi](){if(!this[He]){this[He]=!0;let e=this[Hs]();if(e.length===0)return process.nextTick(()=>this[Ds](null,0,e));ee.read(this[g],e,0,e.length,null,(i,n,r)=>this[Ds](i,n,r))}}[Ds](e,i,n){this[He]=!1,e?this[Gi](e):this[Xs](i,n)&&this[xi]()}[Ge](){if(this[It]&&typeof this[g]=="number"){let e=this[g];this[g]=void 0,ee.close(e,i=>i?this.emit("error",i):this.emit("close"))}}[Gi](e){this[He]=!0,this[Ge](),this.emit("error",e)}[Xs](e,i){let n=!1;return this[un]-=e,e>0&&(n=super.write(e<i.length?i.subarray(0,e):i)),(e===0||this[un]<=0)&&(n=!1,this[Ge](),super.end()),n}emit(e,...i){switch(e){case"prefinish":case"finish":return!1;case"drain":return typeof this[g]=="number"&&this[xi](),!1;case"error":return this[wt]?!1:(this[wt]=!0,super.emit(e,...i));default:return super.emit(e,...i)}}},Gr=class extends Tt{[pt](){let e=!0;try{this[Si](null,ee.openSync(this[xe],"r")),e=!1}finally{e&&this[Ge]()}}[xi](){let e=!0;try{if(!this[He]){this[He]=!0;do{let i=this[Hs](),n=i.length===0?0:ee.readSync(this[g],i,0,i.length,null);if(!this[Xs](n,i))break}while(!0);this[He]=!1}e=!1}finally{e&&this[Ge]()}}[Ge](){if(this[It]&&typeof this[g]=="number"){let e=this[g];this[g]=void 0,ee.closeSync(e),this.emit("close")}}},_e=class extends uu{readable=!1;writable=!0;[wt]=!1;[Dt]=!1;[An]=!1;[ke]=[];[jr]=!1;[xe];[mn];[It];[g];[xr];[Le];[qs]=!1;[Et];constructor(e,i){i=i||{},super(i),this[xe]=e,this[g]=typeof i.fd=="number"?i.fd:void 0,this[mn]=i.mode===void 0?438:i.mode,this[Et]=typeof i.start=="number"?i.start:void 0,this[It]=typeof i.autoClose=="boolean"?i.autoClose:!0;let n=this[Et]!==void 0?"r+":"w";this[xr]=i.flags===void 0,this[Le]=i.flags===void 0?n:i.flags,this[g]===void 0&&this[pt]()}emit(e,...i){if(e==="error"){if(this[wt])return!1;this[wt]=!0}return super.emit(e,...i)}get fd(){return this[g]}get path(){return this[xe]}[Gi](e){this[Ge](),this[Dt]=!0,this.emit("error",e)}[pt](){ee.open(this[xe],this[Le],this[mn],(e,i)=>this[Si](e,i))}[Si](e,i){this[xr]&&this[Le]==="r+"&&e&&e.code==="ENOENT"?(this[Le]="w",this[pt]()):e?this[Gi](e):(this[g]=i,this.emit("open",i),this[Dt]||this[ys]())}end(e,i){return e&&this.write(e,i),this[An]=!0,!this[Dt]&&!this[ke].length&&typeof this[g]=="number"&&this[gi](null,0),this}write(e,i){return typeof e=="string"&&(e=Buffer.from(e,i)),this[An]?(this.emit("error",new Error("write() after end()")),!1):this[g]===void 0||this[Dt]||this[ke].length?(this[ke].push(e),this[jr]=!0,!1):(this[Dt]=!0,this[gr](e),!0)}[gr](e){ee.write(this[g],e,0,e.length,this[Et],(i,n)=>this[gi](i,n))}[gi](e,i){e?this[Gi](e):(this[Et]!==void 0&&typeof i=="number"&&(this[Et]+=i),this[ke].length?this[ys]():(this[Dt]=!1,this[An]&&!this[qs]?(this[qs]=!0,this[Ge](),this.emit("finish")):this[jr]&&(this[jr]=!1,this.emit("drain"))))}[ys](){if(this[ke].length===0)this[An]&&this[gi](null,0);else if(this[ke].length===1)this[gr](this[ke].pop());else{let e=this[ke];this[ke]=[],mu(this[g],e,this[Et],(i,n)=>this[gi](i,n))}}[Ge](){if(this[It]&&typeof this[g]=="number"){let e=this[g];this[g]=void 0,ee.close(e,i=>i?this.emit("error",i):this.emit("close"))}}},Yi=class extends _e{[pt](){let e;if(this[xr]&&this[Le]==="r+")try{e=ee.openSync(this[xe],this[Le],this[mn])}catch(i){if(i?.code==="ENOENT")return this[Le]="w",this[pt]();throw i}else e=ee.openSync(this[xe],this[Le],this[mn]);this[Si](null,e)}[Ge](){if(this[It]&&typeof this[g]=="number"){let e=this[g];this[g]=void 0,ee.closeSync(e),this.emit("close")}}[gr](e){let i=!0;try{this[gi](null,ee.writeSync(this[g],e,0,e.length,this[Et])),i=!1}finally{if(i)try{this[Ge]()}catch{}}}};import V3 from"node:path";import ki from"node:fs";import{dirname as vm,parse as Am}from"path";var Eu=new Map([["C","cwd"],["f","file"],["z","gzip"],["P","preservePaths"],["U","unlink"],["strip-components","strip"],["stripComponents","strip"],["keep-newer","newer"],["keepNewer","newer"],["keep-newer-files","newer"],["keepNewerFiles","newer"],["k","keep"],["keep-existing","keep"],["keepExisting","keep"],["m","noMtime"],["no-mtime","noMtime"],["p","preserveOwner"],["L","follow"],["h","follow"],["onentry","onReadEntry"]]),yl=t=>!!t.sync&&!!t.file,Dl=t=>!t.sync&&!!t.file,wl=t=>!!t.sync&&!t.file,Tl=t=>!t.sync&&!t.file;var Xl=t=>!!t.file;var Iu=t=>{let e=Eu.get(t);return e||t},En=(t={})=>{if(!t)return{};let e={};for(let[i,n]of Object.entries(t)){let r=Iu(i);e[r]=n}return e.chmod===void 0&&e.noChmod===!1&&(e.chmod=!0),delete e.noChmod,e};var Fe=(t,e,i,n,r)=>Object.assign((o=[],s,c)=>{Array.isArray(o)&&(s=o,o={}),typeof s=="function"&&(c=s,s=void 0),s?s=Array.from(s):s=[];let l=En(o);if(r?.(l,s),yl(l)){if(typeof c=="function")throw new TypeError("callback not supported for sync tar functions");return t(l,s)}else if(Dl(l)){let v=e(l,s),A=c||void 0;return A?v.then(()=>A(),A):v}else if(wl(l)){if(typeof c=="function")throw new TypeError("callback not supported for sync tar functions");return i(l,s)}else if(Tl(l)){if(typeof c=="function")throw new TypeError("callback only supported with file option");return n(l,s)}else throw new Error("impossible options??")},{syncFile:t,asyncFile:e,syncNoFile:i,asyncNoFile:n,validate:r});import{EventEmitter as sm}from"events";import aa from"assert";import{Buffer as Ht}from"buffer";import{EventEmitter as ra}from"node:events";import e3 from"node:stream";import{StringDecoder as pu}from"node:string_decoder";var Hl=typeof process=="object"&&process?process:{stdout:null,stderr:null},fu=t=>!!t&&typeof t=="object"&&(t instanceof dn||t instanceof e3||hu(t)||du(t)),hu=t=>!!t&&typeof t=="object"&&t instanceof ra&&typeof t.pipe=="function"&&t.pipe!==e3.Writable.prototype.pipe,du=t=>!!t&&typeof t=="object"&&t instanceof ra&&typeof t.write=="function"&&typeof t.end=="function",$e=Symbol("EOF"),et=Symbol("maybeEmitEnd"),ft=Symbol("emittedEnd"),Sr=Symbol("emittingEnd"),In=Symbol("emittedError"),Yr=Symbol("closed"),Ll=Symbol("read"),Wr=Symbol("flush"),_l=Symbol("flushChunk"),Se=Symbol("encoding"),Wi=Symbol("decoder"),J=Symbol("flowing"),pn=Symbol("paused"),Mi=Symbol("resume"),b=Symbol("buffer"),_=Symbol("pipes"),B=Symbol("bufferLength"),_s=Symbol("bufferPush"),Mr=Symbol("bufferShift"),w=Symbol("objectMode"),O=Symbol("destroyed"),$s=Symbol("error"),ea=Symbol("emitData"),$l=Symbol("emitEnd"),ta=Symbol("emitEnd2"),Qe=Symbol("async"),ia=Symbol("abort"),Cr=Symbol("aborted"),fn=Symbol("signal"),Xt=Symbol("dataListeners"),ie=Symbol("discarded"),hn=t=>Promise.resolve().then(t),Ru=t=>t(),zu=t=>t==="end"||t==="finish"||t==="prefinish",ju=t=>t instanceof ArrayBuffer||!!t&&typeof t=="object"&&t.constructor&&t.constructor.name==="ArrayBuffer"&&t.byteLength>=0,gu=t=>!Buffer.isBuffer(t)&&ArrayBuffer.isView(t),Or=class{src;dest;opts;ondrain;constructor(e,i,n){this.src=e,this.dest=i,this.opts=n,this.ondrain=()=>e[Mi](),this.dest.on("drain",this.ondrain)}unpipe(){this.dest.removeListener("drain",this.ondrain)}proxyErrors(e){}end(){this.unpipe(),this.opts.end&&this.dest.end()}},na=class extends Or{unpipe(){this.src.removeListener("error",this.proxyErrors),super.unpipe()}constructor(e,i,n){super(e,i,n),this.proxyErrors=r=>i.emit("error",r),e.on("error",this.proxyErrors)}},xu=t=>!!t.objectMode,Gu=t=>!t.objectMode&&!!t.encoding&&t.encoding!=="buffer",dn=class extends ra{[J]=!1;[pn]=!1;[_]=[];[b]=[];[w];[Se];[Qe];[Wi];[$e]=!1;[ft]=!1;[Sr]=!1;[Yr]=!1;[In]=null;[B]=0;[O]=!1;[fn];[Cr]=!1;[Xt]=0;[ie]=!1;writable=!0;readable=!0;constructor(...e){let i=e[0]||{};if(super(),i.objectMode&&typeof i.encoding=="string")throw new TypeError("Encoding and objectMode may not be used together");xu(i)?(this[w]=!0,this[Se]=null):Gu(i)?(this[Se]=i.encoding,this[w]=!1):(this[w]=!1,this[Se]=null),this[Qe]=!!i.async,this[Wi]=this[Se]?new pu(this[Se]):null,i&&i.debugExposeBuffer===!0&&Object.defineProperty(this,"buffer",{get:()=>this[b]}),i&&i.debugExposePipes===!0&&Object.defineProperty(this,"pipes",{get:()=>this[_]});let{signal:n}=i;n&&(this[fn]=n,n.aborted?this[ia]():n.addEventListener("abort",()=>this[ia]()))}get bufferLength(){return this[B]}get encoding(){return this[Se]}set encoding(e){throw new Error("Encoding must be set at instantiation time")}setEncoding(e){throw new Error("Encoding must be set at instantiation time")}get objectMode(){return this[w]}set objectMode(e){throw new Error("objectMode must be set at instantiation time")}get async(){return this[Qe]}set async(e){this[Qe]=this[Qe]||!!e}[ia](){this[Cr]=!0,this.emit("abort",this[fn]?.reason),this.destroy(this[fn]?.reason)}get aborted(){return this[Cr]}set aborted(e){}write(e,i,n){if(this[Cr])return!1;if(this[$e])throw new Error("write after end");if(this[O])return this.emit("error",Object.assign(new Error("Cannot call write after a stream was destroyed"),{code:"ERR_STREAM_DESTROYED"})),!0;typeof i=="function"&&(n=i,i="utf8"),i||(i="utf8");let r=this[Qe]?hn:Ru;if(!this[w]&&!Buffer.isBuffer(e)){if(gu(e))e=Buffer.from(e.buffer,e.byteOffset,e.byteLength);else if(ju(e))e=Buffer.from(e);else if(typeof e!="string")throw new Error("Non-contiguous data written to non-objectMode stream")}return this[w]?(this[J]&&this[B]!==0&&this[Wr](!0),this[J]?this.emit("data",e):this[_s](e),this[B]!==0&&this.emit("readable"),n&&r(n),this[J]):e.length?(typeof e=="string"&&!(i===this[Se]&&!this[Wi]?.lastNeed)&&(e=Buffer.from(e,i)),Buffer.isBuffer(e)&&this[Se]&&(e=this[Wi].write(e)),this[J]&&this[B]!==0&&this[Wr](!0),this[J]?this.emit("data",e):this[_s](e),this[B]!==0&&this.emit("readable"),n&&r(n),this[J]):(this[B]!==0&&this.emit("readable"),n&&r(n),this[J])}read(e){if(this[O])return null;if(this[ie]=!1,this[B]===0||e===0||e&&e>this[B])return this[et](),null;this[w]&&(e=null),this[b].length>1&&!this[w]&&(this[b]=[this[Se]?this[b].join(""):Buffer.concat(this[b],this[B])]);let i=this[Ll](e||null,this[b][0]);return this[et](),i}[Ll](e,i){if(this[w])this[Mr]();else{let n=i;e===n.length||e===null?this[Mr]():typeof n=="string"?(this[b][0]=n.slice(e),i=n.slice(0,e),this[B]-=e):(this[b][0]=n.subarray(e),i=n.subarray(0,e),this[B]-=e)}return this.emit("data",i),!this[b].length&&!this[$e]&&this.emit("drain"),i}end(e,i,n){return typeof e=="function"&&(n=e,e=void 0),typeof i=="function"&&(n=i,i="utf8"),e!==void 0&&this.write(e,i),n&&this.once("end",n),this[$e]=!0,this.writable=!1,(this[J]||!this[pn])&&this[et](),this}[Mi](){this[O]||(!this[Xt]&&!this[_].length&&(this[ie]=!0),this[pn]=!1,this[J]=!0,this.emit("resume"),this[b].length?this[Wr]():this[$e]?this[et]():this.emit("drain"))}resume(){return this[Mi]()}pause(){this[J]=!1,this[pn]=!0,this[ie]=!1}get destroyed(){return this[O]}get flowing(){return this[J]}get paused(){return this[pn]}[_s](e){this[w]?this[B]+=1:this[B]+=e.length,this[b].push(e)}[Mr](){return this[w]?this[B]-=1:this[B]-=this[b][0].length,this[b].shift()}[Wr](e=!1){do;while(this[_l](this[Mr]())&&this[b].length);!e&&!this[b].length&&!this[$e]&&this.emit("drain")}[_l](e){return this.emit("data",e),this[J]}pipe(e,i){if(this[O])return e;this[ie]=!1;let n=this[ft];return i=i||{},e===Hl.stdout||e===Hl.stderr?i.end=!1:i.end=i.end!==!1,i.proxyErrors=!!i.proxyErrors,n?i.end&&e.end():(this[_].push(i.proxyErrors?new na(this,e,i):new Or(this,e,i)),this[Qe]?hn(()=>this[Mi]()):this[Mi]()),e}unpipe(e){let i=this[_].find(n=>n.dest===e);i&&(this[_].length===1?(this[J]&&this[Xt]===0&&(this[J]=!1),this[_]=[]):this[_].splice(this[_].indexOf(i),1),i.unpipe())}addListener(e,i){return this.on(e,i)}on(e,i){let n=super.on(e,i);if(e==="data")this[ie]=!1,this[Xt]++,!this[_].length&&!this[J]&&this[Mi]();else if(e==="readable"&&this[B]!==0)super.emit("readable");else if(zu(e)&&this[ft])super.emit(e),this.removeAllListeners(e);else if(e==="error"&&this[In]){let r=i;this[Qe]?hn(()=>r.call(this,this[In])):r.call(this,this[In])}return n}removeListener(e,i){return this.off(e,i)}off(e,i){let n=super.off(e,i);return e==="data"&&(this[Xt]=this.listeners("data").length,this[Xt]===0&&!this[ie]&&!this[_].length&&(this[J]=!1)),n}removeAllListeners(e){let i=super.removeAllListeners(e);return(e==="data"||e===void 0)&&(this[Xt]=0,!this[ie]&&!this[_].length&&(this[J]=!1)),i}get emittedEnd(){return this[ft]}[et](){!this[Sr]&&!this[ft]&&!this[O]&&this[b].length===0&&this[$e]&&(this[Sr]=!0,this.emit("end"),this.emit("prefinish"),this.emit("finish"),this[Yr]&&this.emit("close"),this[Sr]=!1)}emit(e,...i){let n=i[0];if(e!=="error"&&e!=="close"&&e!==O&&this[O])return!1;if(e==="data")return!this[w]&&!n?!1:this[Qe]?(hn(()=>this[ea](n)),!0):this[ea](n);if(e==="end")return this[$l]();if(e==="close"){if(this[Yr]=!0,!this[ft]&&!this[O])return!1;let o=super.emit("close");return this.removeAllListeners("close"),o}else if(e==="error"){this[In]=n,super.emit($s,n);let o=!this[fn]||this.listeners("error").length?super.emit("error",n):!1;return this[et](),o}else if(e==="resume"){let o=super.emit("resume");return this[et](),o}else if(e==="finish"||e==="prefinish"){let o=super.emit(e);return this.removeAllListeners(e),o}let r=super.emit(e,...i);return this[et](),r}[ea](e){for(let n of this[_])n.dest.write(e)===!1&&this.pause();let i=this[ie]?!1:super.emit("data",e);return this[et](),i}[$l](){return this[ft]?!1:(this[ft]=!0,this.readable=!1,this[Qe]?(hn(()=>this[ta]()),!0):this[ta]())}[ta](){if(this[Wi]){let i=this[Wi].end();if(i){for(let n of this[_])n.dest.write(i);this[ie]||super.emit("data",i)}}for(let i of this[_])i.end();let e=super.emit("end");return this.removeAllListeners("end"),e}async collect(){let e=Object.assign([],{dataLength:0});this[w]||(e.dataLength=0);let i=this.promise();return this.on("data",n=>{e.push(n),this[w]||(e.dataLength+=n.length)}),await i,e}async concat(){if(this[w])throw new Error("cannot concat in objectMode");let e=await this.collect();return this[Se]?e.join(""):Buffer.concat(e,e.dataLength)}async promise(){return new Promise((e,i)=>{this.on(O,()=>i(new Error("stream destroyed"))),this.on("error",n=>i(n)),this.on("end",()=>e())})}[Symbol.asyncIterator](){this[ie]=!1;let e=!1,i=async()=>(this.pause(),e=!0,{value:void 0,done:!0});return{next:()=>{if(e)return i();let r=this.read();if(r!==null)return Promise.resolve({done:!1,value:r});if(this[$e])return i();let o,s,c=u=>{this.off("data",l),this.off("end",v),this.off(O,A),i(),s(u)},l=u=>{this.off("error",c),this.off("end",v),this.off(O,A),this.pause(),o({value:u,done:!!this[$e]})},v=()=>{this.off("error",c),this.off("data",l),this.off(O,A),i(),o({done:!0,value:void 0})},A=()=>c(new Error("stream destroyed"));return new Promise((u,I)=>{s=I,o=u,this.once(O,A),this.once("error",c),this.once("end",v),this.once("data",l)})},throw:i,return:i,[Symbol.asyncIterator](){return this}}}[Symbol.iterator](){this[ie]=!1;let e=!1,i=()=>(this.pause(),this.off($s,i),this.off(O,i),this.off("end",i),e=!0,{done:!0,value:void 0}),n=()=>{if(e)return i();let r=this.read();return r===null?i():{done:!1,value:r}};return this.once("end",i),this.once($s,i),this.once(O,i),{next:n,throw:i,return:i,[Symbol.iterator](){return this}}}destroy(e){if(this[O])return e?this.emit("error",e):this.emit(O),this;this[O]=!0,this[ie]=!0,this[b].length=0,this[B]=0;let i=this;return typeof i.close=="function"&&!this[Yr]&&i.close(),e?this.emit("error",e):this.emit(O),this}static get isStream(){return fu}};import*as t3 from"zlib";import Su from"zlib";var Yu=Su.constants||{ZLIB_VERNUM:4736},Ie=Object.freeze(Object.assign(Object.create(null),{Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_VERSION_ERROR:-6,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,DEFLATE:1,INFLATE:2,GZIP:3,GUNZIP:4,DEFLATERAW:5,INFLATERAW:6,UNZIP:7,BROTLI_DECODE:8,BROTLI_ENCODE:9,Z_MIN_WINDOWBITS:8,Z_MAX_WINDOWBITS:15,Z_DEFAULT_WINDOWBITS:15,Z_MIN_CHUNK:64,Z_MAX_CHUNK:1/0,Z_DEFAULT_CHUNK:16384,Z_MIN_MEMLEVEL:1,Z_MAX_MEMLEVEL:9,Z_DEFAULT_MEMLEVEL:8,Z_MIN_LEVEL:-1,Z_MAX_LEVEL:9,Z_DEFAULT_LEVEL:-1,BROTLI_OPERATION_PROCESS:0,BROTLI_OPERATION_FLUSH:1,BROTLI_OPERATION_FINISH:2,BROTLI_OPERATION_EMIT_METADATA:3,BROTLI_MODE_GENERIC:0,BROTLI_MODE_TEXT:1,BROTLI_MODE_FONT:2,BROTLI_DEFAULT_MODE:0,BROTLI_MIN_QUALITY:0,BROTLI_MAX_QUALITY:11,BROTLI_DEFAULT_QUALITY:11,BROTLI_MIN_WINDOW_BITS:10,BROTLI_MAX_WINDOW_BITS:24,BROTLI_LARGE_MAX_WINDOW_BITS:30,BROTLI_DEFAULT_WINDOW:22,BROTLI_MIN_INPUT_BLOCK_BITS:16,BROTLI_MAX_INPUT_BLOCK_BITS:24,BROTLI_PARAM_MODE:0,BROTLI_PARAM_QUALITY:1,BROTLI_PARAM_LGWIN:2,BROTLI_PARAM_LGBLOCK:3,BROTLI_PARAM_DISABLE_LITERAL_CONTEXT_MODELING:4,BROTLI_PARAM_SIZE_HINT:5,BROTLI_PARAM_LARGE_WINDOW:6,BROTLI_PARAM_NPOSTFIX:7,BROTLI_PARAM_NDIRECT:8,BROTLI_DECODER_RESULT_ERROR:0,BROTLI_DECODER_RESULT_SUCCESS:1,BROTLI_DECODER_RESULT_NEEDS_MORE_INPUT:2,BROTLI_DECODER_RESULT_NEEDS_MORE_OUTPUT:3,BROTLI_DECODER_PARAM_DISABLE_RING_BUFFER_REALLOCATION:0,BROTLI_DECODER_PARAM_LARGE_WINDOW:1,BROTLI_DECODER_NO_ERROR:0,BROTLI_DECODER_SUCCESS:1,BROTLI_DECODER_NEEDS_MORE_INPUT:2,BROTLI_DECODER_NEEDS_MORE_OUTPUT:3,BROTLI_DECODER_ERROR_FORMAT_EXUBERANT_NIBBLE:-1,BROTLI_DECODER_ERROR_FORMAT_RESERVED:-2,BROTLI_DECODER_ERROR_FORMAT_EXUBERANT_META_NIBBLE:-3,BROTLI_DECODER_ERROR_FORMAT_SIMPLE_HUFFMAN_ALPHABET:-4,BROTLI_DECODER_ERROR_FORMAT_SIMPLE_HUFFMAN_SAME:-5,BROTLI_DECODER_ERROR_FORMAT_CL_SPACE:-6,BROTLI_DECODER_ERROR_FORMAT_HUFFMAN_SPACE:-7,BROTLI_DECODER_ERROR_FORMAT_CONTEXT_MAP_REPEAT:-8,BROTLI_DECODER_ERROR_FORMAT_BLOCK_LENGTH_1:-9,BROTLI_DECODER_ERROR_FORMAT_BLOCK_LENGTH_2:-10,BROTLI_DECODER_ERROR_FORMAT_TRANSFORM:-11,BROTLI_DECODER_ERROR_FORMAT_DICTIONARY:-12,BROTLI_DECODER_ERROR_FORMAT_WINDOW_BITS:-13,BROTLI_DECODER_ERROR_FORMAT_PADDING_1:-14,BROTLI_DECODER_ERROR_FORMAT_PADDING_2:-15,BROTLI_DECODER_ERROR_FORMAT_DISTANCE:-16,BROTLI_DECODER_ERROR_DICTIONARY_NOT_SET:-19,BROTLI_DECODER_ERROR_INVALID_ARGUMENTS:-20,BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MODES:-21,BROTLI_DECODER_ERROR_ALLOC_TREE_GROUPS:-22,BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MAP:-25,BROTLI_DECODER_ERROR_ALLOC_RING_BUFFER_1:-26,BROTLI_DECODER_ERROR_ALLOC_RING_BUFFER_2:-27,BROTLI_DECODER_ERROR_ALLOC_BLOCK_TYPE_TREES:-30,BROTLI_DECODER_ERROR_UNREACHABLE:-31},Yu));var Wu=Ht.concat,i3=Object.getOwnPropertyDescriptor(Ht,"concat"),Mu=t=>t,oa=i3?.writable===!0||i3?.set!==void 0?t=>{Ht.concat=t?Mu:Wu}:t=>{},Lt=Symbol("_superWrite"),Ci=class extends Error{code;errno;constructor(e,i){super("zlib: "+e.message,{cause:e}),this.code=e.code,this.errno=e.errno,this.code||(this.code="ZLIB_ERROR"),this.message="zlib: "+e.message,Error.captureStackTrace(this,i??this.constructor)}get name(){return"ZlibError"}},sa=Symbol("flushFlag"),Rn=class extends dn{#e=!1;#n=!1;#i;#r;#a;#t;#o;get sawError(){return this.#e}get handle(){return this.#t}get flushFlag(){return this.#i}constructor(e,i){if(!e||typeof e!="object")throw new TypeError("invalid options for ZlibBase constructor");if(super(e),this.#i=e.flush??0,this.#r=e.finishFlush??0,this.#a=e.fullFlushFlag??0,typeof t3[i]!="function")throw new TypeError("Compression method not supported: "+i);try{this.#t=new t3[i](e)}catch(n){throw new Ci(n,this.constructor)}this.#o=n=>{this.#e||(this.#e=!0,this.close(),this.emit("error",n))},this.#t?.on("error",n=>this.#o(new Ci(n))),this.once("end",()=>this.close)}close(){this.#t&&(this.#t.close(),this.#t=void 0,this.emit("close"))}reset(){if(!this.#e)return aa(this.#t,"zlib binding closed"),this.#t.reset?.()}flush(e){this.ended||(typeof e!="number"&&(e=this.#a),this.write(Object.assign(Ht.alloc(0),{[sa]:e})))}end(e,i,n){return typeof e=="function"&&(n=e,i=void 0,e=void 0),typeof i=="function"&&(n=i,i=void 0),e&&(i?this.write(e,i):this.write(e)),this.flush(this.#r),this.#n=!0,super.end(n)}get ended(){return this.#n}[Lt](e){return super.write(e)}write(e,i,n){if(typeof i=="function"&&(n=i,i="utf8"),typeof e=="string"&&(e=Ht.from(e,i)),this.#e)return;aa(this.#t,"zlib binding closed");let r=this.#t._handle,o=r.close;r.close=()=>{};let s=this.#t.close;this.#t.close=()=>{},oa(!0);let c;try{let v=typeof e[sa]=="number"?e[sa]:this.#i;c=this.#t._processChunk(e,v),oa(!1)}catch(v){oa(!1),this.#o(new Ci(v,this.write))}finally{this.#t&&(this.#t._handle=r,r.close=o,this.#t.close=s,this.#t.removeAllListeners("error"))}this.#t&&this.#t.on("error",v=>this.#o(new Ci(v,this.write)));let l;if(c)if(Array.isArray(c)&&c.length>0){let v=c[0];l=this[Lt](Ht.from(v));for(let A=1;A<c.length;A++)l=this[Lt](c[A])}else l=this[Lt](Ht.from(c));return n&&n(),l}},Ur=class extends Rn{#e;#n;constructor(e,i){e=e||{},e.flush=e.flush||Ie.Z_NO_FLUSH,e.finishFlush=e.finishFlush||Ie.Z_FINISH,e.fullFlushFlag=Ie.Z_FULL_FLUSH,super(e,i),this.#e=e.level,this.#n=e.strategy}params(e,i){if(!this.sawError){if(!this.handle)throw new Error("cannot switch params when binding is closed");if(!this.handle.params)throw new Error("not supported in this implementation");if(this.#e!==e||this.#n!==i){this.flush(Ie.Z_SYNC_FLUSH),aa(this.handle,"zlib binding closed");let n=this.handle.flush;this.handle.flush=(r,o)=>{typeof r=="function"&&(o=r,r=this.flushFlag),this.flush(r),o?.()};try{this.handle.params(e,i)}finally{this.handle.flush=n}this.handle&&(this.#e=e,this.#n=i)}}}};var Kr=class extends Ur{#e;constructor(e){super(e,"Gzip"),this.#e=e&&!!e.portable}[Lt](e){return this.#e?(this.#e=!1,e[9]=255,super[Lt](e)):super[Lt](e)}};var Vr=class extends Ur{constructor(e){super(e,"Unzip")}},Nr=class extends Rn{constructor(e,i){e=e||{},e.flush=e.flush||Ie.BROTLI_OPERATION_PROCESS,e.finishFlush=e.finishFlush||Ie.BROTLI_OPERATION_FINISH,e.fullFlushFlag=Ie.BROTLI_OPERATION_FLUSH,super(e,i)}},kr=class extends Nr{constructor(e){super(e,"BrotliCompress")}},Fr=class extends Nr{constructor(e){super(e,"BrotliDecompress")}},Qr=class extends Rn{constructor(e,i){e=e||{},e.flush=e.flush||Ie.ZSTD_e_continue,e.finishFlush=e.finishFlush||Ie.ZSTD_e_end,e.fullFlushFlag=Ie.ZSTD_e_flush,super(e,i)}},Jr=class extends Qr{constructor(e){super(e,"ZstdCompress")}},br=class extends Qr{constructor(e){super(e,"ZstdDecompress")}};import{posix as Oi}from"node:path";var n3=(t,e)=>{if(Number.isSafeInteger(t))t<0?Uu(t,e):Ou(t,e);else throw Error("cannot encode number outside of javascript safe integer range");return e},Ou=(t,e)=>{e[0]=128;for(var i=e.length;i>1;i--)e[i-1]=t&255,t=Math.floor(t/256)},Uu=(t,e)=>{e[0]=255;var i=!1;t=t*-1;for(var n=e.length;n>1;n--){var r=t&255;t=Math.floor(t/256),i?e[n-1]=o3(r):r===0?e[n-1]=0:(i=!0,e[n-1]=s3(r))}},r3=t=>{let e=t[0],i=e===128?Vu(t.subarray(1,t.length)):e===255?Ku(t):null;if(i===null)throw Error("invalid base256 encoding");if(!Number.isSafeInteger(i))throw Error("parsed number outside of javascript safe integer range");return i},Ku=t=>{for(var e=t.length,i=0,n=!1,r=e-1;r>-1;r--){var o=Number(t[r]),s;n?s=o3(o):o===0?s=o:(n=!0,s=s3(o)),s!==0&&(i-=s*Math.pow(256,e-r-1))}return i},Vu=t=>{for(var e=t.length,i=0,n=e-1;n>-1;n--){var r=Number(t[n]);r!==0&&(i+=r*Math.pow(256,e-n-1))}return i},o3=t=>(255^t)&255,s3=t=>(255^t)+1&255;var Br=t=>Zr.has(t);var Zr=new Map([["0","File"],["","OldFile"],["1","Link"],["2","SymbolicLink"],["3","CharacterDevice"],["4","BlockDevice"],["5","Directory"],["6","FIFO"],["7","ContiguousFile"],["g","GlobalExtendedHeader"],["x","ExtendedHeader"],["A","SolarisACL"],["D","GNUDumpDir"],["I","Inode"],["K","NextFileHasLongLinkpath"],["L","NextFileHasLongPath"],["M","ContinuationFile"],["N","OldGnuLongPath"],["S","SparseFile"],["V","TapeVolumeHeader"],["X","OldExtendedHeader"]]),a3=new Map(Array.from(Zr).map(t=>[t[1],t[0]]));var ne=class{cksumValid=!1;needPax=!1;nullBlock=!1;block;path;mode;uid;gid;size;cksum;#e="Unsupported";linkpath;uname;gname;devmaj=0;devmin=0;atime;ctime;mtime;charset;comment;constructor(e,i=0,n,r){Buffer.isBuffer(e)?this.decode(e,i||0,n,r):e&&this.#n(e)}decode(e,i,n,r){if(i||(i=0),!e||!(e.length>=i+512))throw new Error("need 512 bytes for header");this.path=n?.path??_t(e,i,100),this.mode=n?.mode??r?.mode??ht(e,i+100,8),this.uid=n?.uid??r?.uid??ht(e,i+108,8),this.gid=n?.gid??r?.gid??ht(e,i+116,8),this.size=n?.size??r?.size??ht(e,i+124,12),this.mtime=n?.mtime??r?.mtime??ca(e,i+136,12),this.cksum=ht(e,i+148,12),r&&this.#n(r,!0),n&&this.#n(n);let o=_t(e,i+156,1);if(Br(o)&&(this.#e=o||"0"),this.#e==="0"&&this.path.slice(-1)==="/"&&(this.#e="5"),this.#e==="5"&&(this.size=0),this.linkpath=_t(e,i+157,100),e.subarray(i+257,i+265).toString()==="ustar\x0000")if(this.uname=n?.uname??r?.uname??_t(e,i+265,32),this.gname=n?.gname??r?.gname??_t(e,i+297,32),this.devmaj=n?.devmaj??r?.devmaj??ht(e,i+329,8)??0,this.devmin=n?.devmin??r?.devmin??ht(e,i+337,8)??0,e[i+475]!==0){let c=_t(e,i+345,155);this.path=c+"/"+this.path}else{let c=_t(e,i+345,130);c&&(this.path=c+"/"+this.path),this.atime=n?.atime??r?.atime??ca(e,i+476,12),this.ctime=n?.ctime??r?.ctime??ca(e,i+488,12)}let s=256;for(let c=i;c<i+148;c++)s+=e[c];for(let c=i+156;c<i+512;c++)s+=e[c];this.cksumValid=s===this.cksum,this.cksum===void 0&&s===256&&(this.nullBlock=!0)}#n(e,i=!1){Object.assign(this,Object.fromEntries(Object.entries(e).filter(([n,r])=>!(r==null||n==="path"&&i||n==="linkpath"&&i||n==="global"))))}encode(e,i=0){if(e||(e=this.block=Buffer.alloc(512)),this.#e==="Unsupported"&&(this.#e="0"),!(e.length>=i+512))throw new Error("need 512 bytes for header");let n=this.ctime||this.atime?130:155,r=ku(this.path||"",n),o=r[0],s=r[1];this.needPax=!!r[2],this.needPax=$t(e,i,100,o)||this.needPax,this.needPax=dt(e,i+100,8,this.mode)||this.needPax,this.needPax=dt(e,i+108,8,this.uid)||this.needPax,this.needPax=dt(e,i+116,8,this.gid)||this.needPax,this.needPax=dt(e,i+124,12,this.size)||this.needPax,this.needPax=la(e,i+136,12,this.mtime)||this.needPax,e[i+156]=this.#e.charCodeAt(0),this.needPax=$t(e,i+157,100,this.linkpath)||this.needPax,e.write("ustar\x0000",i+257,8),this.needPax=$t(e,i+265,32,this.uname)||this.needPax,this.needPax=$t(e,i+297,32,this.gname)||this.needPax,this.needPax=dt(e,i+329,8,this.devmaj)||this.needPax,this.needPax=dt(e,i+337,8,this.devmin)||this.needPax,this.needPax=$t(e,i+345,n,s)||this.needPax,e[i+475]!==0?this.needPax=$t(e,i+345,155,s)||this.needPax:(this.needPax=$t(e,i+345,130,s)||this.needPax,this.needPax=la(e,i+476,12,this.atime)||this.needPax,this.needPax=la(e,i+488,12,this.ctime)||this.needPax);let c=256;for(let l=i;l<i+148;l++)c+=e[l];for(let l=i+156;l<i+512;l++)c+=e[l];return this.cksum=c,dt(e,i+148,8,this.cksum),this.cksumValid=!0,this.needPax}get type(){return this.#e==="Unsupported"?this.#e:Zr.get(this.#e)}get typeKey(){return this.#e}set type(e){let i=String(a3.get(e));if(Br(i)||i==="Unsupported")this.#e=i;else if(Br(e))this.#e=e;else throw new TypeError("invalid entry type: "+e)}},ku=(t,e)=>{let n=t,r="",o,s=Oi.parse(t).root||".";if(Buffer.byteLength(n)<100)o=[n,r,!1];else{r=Oi.dirname(n),n=Oi.basename(n);do Buffer.byteLength(n)<=100&&Buffer.byteLength(r)<=e?o=[n,r,!1]:Buffer.byteLength(n)>100&&Buffer.byteLength(r)<=e?o=[n.slice(0,99),r,!0]:(n=Oi.join(Oi.basename(r),n),r=Oi.dirname(r));while(r!==s&&o===void 0);o||(o=[t.slice(0,99),"",!0])}return o},_t=(t,e,i)=>t.subarray(e,e+i).toString("utf8").replace(/\0.*/,""),ca=(t,e,i)=>Fu(ht(t,e,i)),Fu=t=>t===void 0?void 0:new Date(t*1e3),ht=(t,e,i)=>Number(t[e])&128?r3(t.subarray(e,e+i)):Ju(t,e,i),Qu=t=>isNaN(t)?void 0:t,Ju=(t,e,i)=>Qu(parseInt(t.subarray(e,e+i).toString("utf8").replace(/\0.*$/,"").trim(),8)),bu={12:8589934591,8:2097151},dt=(t,e,i,n)=>n===void 0?!1:n>bu[i]||n<0?(n3(n,t.subarray(e,e+i)),!0):(Bu(t,e,i,n),!1),Bu=(t,e,i,n)=>t.write(Zu(n,i),e,i,"ascii"),Zu=(t,e)=>Pu(Math.floor(t).toString(8),e),Pu=(t,e)=>(t.length===e-1?t:new Array(e-t.length-1).join("0")+t+" ")+"\0",la=(t,e,i,n)=>n===void 0?!1:dt(t,e,i,n.getTime()/1e3),qu=new Array(156).join("\0"),$t=(t,e,i,n)=>n===void 0?!1:(t.write(n+qu,e,i,"utf8"),n.length!==Buffer.byteLength(n)||n.length>i);import{basename as yu}from"node:path";var Rt=class t{atime;mtime;ctime;charset;comment;gid;uid;gname;uname;linkpath;dev;ino;nlink;path;size;mode;global;constructor(e,i=!1){this.atime=e.atime,this.charset=e.charset,this.comment=e.comment,this.ctime=e.ctime,this.dev=e.dev,this.gid=e.gid,this.global=i,this.gname=e.gname,this.ino=e.ino,this.linkpath=e.linkpath,this.mtime=e.mtime,this.nlink=e.nlink,this.path=e.path,this.size=e.size,this.uid=e.uid,this.uname=e.uname}encode(){let e=this.encodeBody();if(e==="")return Buffer.allocUnsafe(0);let i=Buffer.byteLength(e),n=512*Math.ceil(1+i/512),r=Buffer.allocUnsafe(n);for(let o=0;o<512;o++)r[o]=0;new ne({path:("PaxHeader/"+yu(this.path??"")).slice(0,99),mode:this.mode||420,uid:this.uid,gid:this.gid,size:i,mtime:this.mtime,type:this.global?"GlobalExtendedHeader":"ExtendedHeader",linkpath:"",uname:this.uname||"",gname:this.gname||"",devmaj:0,devmin:0,atime:this.atime,ctime:this.ctime}).encode(r),r.write(e,512,i,"utf8");for(let o=i+512;o<r.length;o++)r[o]=0;return r}encodeBody(){return this.encodeField("path")+this.encodeField("ctime")+this.encodeField("atime")+this.encodeField("dev")+this.encodeField("ino")+this.encodeField("nlink")+this.encodeField("charset")+this.encodeField("comment")+this.encodeField("gid")+this.encodeField("gname")+this.encodeField("linkpath")+this.encodeField("mtime")+this.encodeField("size")+this.encodeField("uid")+this.encodeField("uname")}encodeField(e){if(this[e]===void 0)return"";let i=this[e],n=i instanceof Date?i.getTime()/1e3:i,r=" "+(e==="dev"||e==="ino"||e==="nlink"?"SCHILY.":"")+e+"="+n+`
18
+ `,o=Buffer.byteLength(r),s=Math.floor(Math.log(o)/Math.log(10))+1;return o+s>=Math.pow(10,s)&&(s+=1),s+o+r}static parse(e,i,n=!1){return new t(Du(wu(e),i),n)}},Du=(t,e)=>e?Object.assign({},e,t):t,wu=t=>t.replace(/\n$/,"").split(`
19
+ `).reduce(Tu,Object.create(null)),Tu=(t,e)=>{let i=parseInt(e,10);if(i!==Buffer.byteLength(e)+1)return t;e=e.slice((i+" ").length);let n=e.split("="),r=n.shift();if(!r)return t;let o=r.replace(/^SCHILY\.(dev|ino|nlink)/,"$1"),s=n.join("=");return t[o]=/^([A-Z]+\.)?([mac]|birth|creation)time$/.test(o)?new Date(Number(s)*1e3):/^[0-9]+$/.test(s)?+s:s,t};import{EventEmitter as pa}from"node:events";import m3 from"node:stream";import{StringDecoder as Xu}from"node:string_decoder";var l3=typeof process=="object"&&process?process:{stdout:null,stderr:null},Hu=t=>!!t&&typeof t=="object"&&(t instanceof be||t instanceof m3||Lu(t)||_u(t)),Lu=t=>!!t&&typeof t=="object"&&t instanceof pa&&typeof t.pipe=="function"&&t.pipe!==m3.Writable.prototype.pipe,_u=t=>!!t&&typeof t=="object"&&t instanceof pa&&typeof t.write=="function"&&typeof t.end=="function",tt=Symbol("EOF"),it=Symbol("maybeEmitEnd"),zt=Symbol("emittedEnd"),Pr=Symbol("emittingEnd"),zn=Symbol("emittedError"),qr=Symbol("closed"),v3=Symbol("read"),yr=Symbol("flush"),A3=Symbol("flushChunk"),Ye=Symbol("encoding"),Ui=Symbol("decoder"),Z=Symbol("flowing"),jn=Symbol("paused"),Ki=Symbol("resume"),P=Symbol("buffer"),$=Symbol("pipes"),q=Symbol("bufferLength"),va=Symbol("bufferPush"),Dr=Symbol("bufferShift"),T=Symbol("objectMode"),U=Symbol("destroyed"),Aa=Symbol("error"),ua=Symbol("emitData"),u3=Symbol("emitEnd"),ma=Symbol("emitEnd2"),Je=Symbol("async"),Ea=Symbol("abort"),wr=Symbol("aborted"),gn=Symbol("signal"),ei=Symbol("dataListeners"),re=Symbol("discarded"),xn=t=>Promise.resolve().then(t),$u=t=>t(),em=t=>t==="end"||t==="finish"||t==="prefinish",tm=t=>t instanceof ArrayBuffer||!!t&&typeof t=="object"&&t.constructor&&t.constructor.name==="ArrayBuffer"&&t.byteLength>=0,im=t=>!Buffer.isBuffer(t)&&ArrayBuffer.isView(t),Tr=class{src;dest;opts;ondrain;constructor(e,i,n){this.src=e,this.dest=i,this.opts=n,this.ondrain=()=>e[Ki](),this.dest.on("drain",this.ondrain)}unpipe(){this.dest.removeListener("drain",this.ondrain)}proxyErrors(e){}end(){this.unpipe(),this.opts.end&&this.dest.end()}},Ia=class extends Tr{unpipe(){this.src.removeListener("error",this.proxyErrors),super.unpipe()}constructor(e,i,n){super(e,i,n),this.proxyErrors=r=>i.emit("error",r),e.on("error",this.proxyErrors)}},nm=t=>!!t.objectMode,rm=t=>!t.objectMode&&!!t.encoding&&t.encoding!=="buffer",be=class extends pa{[Z]=!1;[jn]=!1;[$]=[];[P]=[];[T];[Ye];[Je];[Ui];[tt]=!1;[zt]=!1;[Pr]=!1;[qr]=!1;[zn]=null;[q]=0;[U]=!1;[gn];[wr]=!1;[ei]=0;[re]=!1;writable=!0;readable=!0;constructor(...e){let i=e[0]||{};if(super(),i.objectMode&&typeof i.encoding=="string")throw new TypeError("Encoding and objectMode may not be used together");nm(i)?(this[T]=!0,this[Ye]=null):rm(i)?(this[Ye]=i.encoding,this[T]=!1):(this[T]=!1,this[Ye]=null),this[Je]=!!i.async,this[Ui]=this[Ye]?new Xu(this[Ye]):null,i&&i.debugExposeBuffer===!0&&Object.defineProperty(this,"buffer",{get:()=>this[P]}),i&&i.debugExposePipes===!0&&Object.defineProperty(this,"pipes",{get:()=>this[$]});let{signal:n}=i;n&&(this[gn]=n,n.aborted?this[Ea]():n.addEventListener("abort",()=>this[Ea]()))}get bufferLength(){return this[q]}get encoding(){return this[Ye]}set encoding(e){throw new Error("Encoding must be set at instantiation time")}setEncoding(e){throw new Error("Encoding must be set at instantiation time")}get objectMode(){return this[T]}set objectMode(e){throw new Error("objectMode must be set at instantiation time")}get async(){return this[Je]}set async(e){this[Je]=this[Je]||!!e}[Ea](){this[wr]=!0,this.emit("abort",this[gn]?.reason),this.destroy(this[gn]?.reason)}get aborted(){return this[wr]}set aborted(e){}write(e,i,n){if(this[wr])return!1;if(this[tt])throw new Error("write after end");if(this[U])return this.emit("error",Object.assign(new Error("Cannot call write after a stream was destroyed"),{code:"ERR_STREAM_DESTROYED"})),!0;typeof i=="function"&&(n=i,i="utf8"),i||(i="utf8");let r=this[Je]?xn:$u;if(!this[T]&&!Buffer.isBuffer(e)){if(im(e))e=Buffer.from(e.buffer,e.byteOffset,e.byteLength);else if(tm(e))e=Buffer.from(e);else if(typeof e!="string")throw new Error("Non-contiguous data written to non-objectMode stream")}return this[T]?(this[Z]&&this[q]!==0&&this[yr](!0),this[Z]?this.emit("data",e):this[va](e),this[q]!==0&&this.emit("readable"),n&&r(n),this[Z]):e.length?(typeof e=="string"&&!(i===this[Ye]&&!this[Ui]?.lastNeed)&&(e=Buffer.from(e,i)),Buffer.isBuffer(e)&&this[Ye]&&(e=this[Ui].write(e)),this[Z]&&this[q]!==0&&this[yr](!0),this[Z]?this.emit("data",e):this[va](e),this[q]!==0&&this.emit("readable"),n&&r(n),this[Z]):(this[q]!==0&&this.emit("readable"),n&&r(n),this[Z])}read(e){if(this[U])return null;if(this[re]=!1,this[q]===0||e===0||e&&e>this[q])return this[it](),null;this[T]&&(e=null),this[P].length>1&&!this[T]&&(this[P]=[this[Ye]?this[P].join(""):Buffer.concat(this[P],this[q])]);let i=this[v3](e||null,this[P][0]);return this[it](),i}[v3](e,i){if(this[T])this[Dr]();else{let n=i;e===n.length||e===null?this[Dr]():typeof n=="string"?(this[P][0]=n.slice(e),i=n.slice(0,e),this[q]-=e):(this[P][0]=n.subarray(e),i=n.subarray(0,e),this[q]-=e)}return this.emit("data",i),!this[P].length&&!this[tt]&&this.emit("drain"),i}end(e,i,n){return typeof e=="function"&&(n=e,e=void 0),typeof i=="function"&&(n=i,i="utf8"),e!==void 0&&this.write(e,i),n&&this.once("end",n),this[tt]=!0,this.writable=!1,(this[Z]||!this[jn])&&this[it](),this}[Ki](){this[U]||(!this[ei]&&!this[$].length&&(this[re]=!0),this[jn]=!1,this[Z]=!0,this.emit("resume"),this[P].length?this[yr]():this[tt]?this[it]():this.emit("drain"))}resume(){return this[Ki]()}pause(){this[Z]=!1,this[jn]=!0,this[re]=!1}get destroyed(){return this[U]}get flowing(){return this[Z]}get paused(){return this[jn]}[va](e){this[T]?this[q]+=1:this[q]+=e.length,this[P].push(e)}[Dr](){return this[T]?this[q]-=1:this[q]-=this[P][0].length,this[P].shift()}[yr](e=!1){do;while(this[A3](this[Dr]())&&this[P].length);!e&&!this[P].length&&!this[tt]&&this.emit("drain")}[A3](e){return this.emit("data",e),this[Z]}pipe(e,i){if(this[U])return e;this[re]=!1;let n=this[zt];return i=i||{},e===l3.stdout||e===l3.stderr?i.end=!1:i.end=i.end!==!1,i.proxyErrors=!!i.proxyErrors,n?i.end&&e.end():(this[$].push(i.proxyErrors?new Ia(this,e,i):new Tr(this,e,i)),this[Je]?xn(()=>this[Ki]()):this[Ki]()),e}unpipe(e){let i=this[$].find(n=>n.dest===e);i&&(this[$].length===1?(this[Z]&&this[ei]===0&&(this[Z]=!1),this[$]=[]):this[$].splice(this[$].indexOf(i),1),i.unpipe())}addListener(e,i){return this.on(e,i)}on(e,i){let n=super.on(e,i);if(e==="data")this[re]=!1,this[ei]++,!this[$].length&&!this[Z]&&this[Ki]();else if(e==="readable"&&this[q]!==0)super.emit("readable");else if(em(e)&&this[zt])super.emit(e),this.removeAllListeners(e);else if(e==="error"&&this[zn]){let r=i;this[Je]?xn(()=>r.call(this,this[zn])):r.call(this,this[zn])}return n}removeListener(e,i){return this.off(e,i)}off(e,i){let n=super.off(e,i);return e==="data"&&(this[ei]=this.listeners("data").length,this[ei]===0&&!this[re]&&!this[$].length&&(this[Z]=!1)),n}removeAllListeners(e){let i=super.removeAllListeners(e);return(e==="data"||e===void 0)&&(this[ei]=0,!this[re]&&!this[$].length&&(this[Z]=!1)),i}get emittedEnd(){return this[zt]}[it](){!this[Pr]&&!this[zt]&&!this[U]&&this[P].length===0&&this[tt]&&(this[Pr]=!0,this.emit("end"),this.emit("prefinish"),this.emit("finish"),this[qr]&&this.emit("close"),this[Pr]=!1)}emit(e,...i){let n=i[0];if(e!=="error"&&e!=="close"&&e!==U&&this[U])return!1;if(e==="data")return!this[T]&&!n?!1:this[Je]?(xn(()=>this[ua](n)),!0):this[ua](n);if(e==="end")return this[u3]();if(e==="close"){if(this[qr]=!0,!this[zt]&&!this[U])return!1;let o=super.emit("close");return this.removeAllListeners("close"),o}else if(e==="error"){this[zn]=n,super.emit(Aa,n);let o=!this[gn]||this.listeners("error").length?super.emit("error",n):!1;return this[it](),o}else if(e==="resume"){let o=super.emit("resume");return this[it](),o}else if(e==="finish"||e==="prefinish"){let o=super.emit(e);return this.removeAllListeners(e),o}let r=super.emit(e,...i);return this[it](),r}[ua](e){for(let n of this[$])n.dest.write(e)===!1&&this.pause();let i=this[re]?!1:super.emit("data",e);return this[it](),i}[u3](){return this[zt]?!1:(this[zt]=!0,this.readable=!1,this[Je]?(xn(()=>this[ma]()),!0):this[ma]())}[ma](){if(this[Ui]){let i=this[Ui].end();if(i){for(let n of this[$])n.dest.write(i);this[re]||super.emit("data",i)}}for(let i of this[$])i.end();let e=super.emit("end");return this.removeAllListeners("end"),e}async collect(){let e=Object.assign([],{dataLength:0});this[T]||(e.dataLength=0);let i=this.promise();return this.on("data",n=>{e.push(n),this[T]||(e.dataLength+=n.length)}),await i,e}async concat(){if(this[T])throw new Error("cannot concat in objectMode");let e=await this.collect();return this[Ye]?e.join(""):Buffer.concat(e,e.dataLength)}async promise(){return new Promise((e,i)=>{this.on(U,()=>i(new Error("stream destroyed"))),this.on("error",n=>i(n)),this.on("end",()=>e())})}[Symbol.asyncIterator](){this[re]=!1;let e=!1,i=async()=>(this.pause(),e=!0,{value:void 0,done:!0});return{next:()=>{if(e)return i();let r=this.read();if(r!==null)return Promise.resolve({done:!1,value:r});if(this[tt])return i();let o,s,c=u=>{this.off("data",l),this.off("end",v),this.off(U,A),i(),s(u)},l=u=>{this.off("error",c),this.off("end",v),this.off(U,A),this.pause(),o({value:u,done:!!this[tt]})},v=()=>{this.off("error",c),this.off("data",l),this.off(U,A),i(),o({done:!0,value:void 0})},A=()=>c(new Error("stream destroyed"));return new Promise((u,I)=>{s=I,o=u,this.once(U,A),this.once("error",c),this.once("end",v),this.once("data",l)})},throw:i,return:i,[Symbol.asyncIterator](){return this}}}[Symbol.iterator](){this[re]=!1;let e=!1,i=()=>(this.pause(),this.off(Aa,i),this.off(U,i),this.off("end",i),e=!0,{done:!0,value:void 0}),n=()=>{if(e)return i();let r=this.read();return r===null?i():{done:!1,value:r}};return this.once("end",i),this.once(Aa,i),this.once(U,i),{next:n,throw:i,return:i,[Symbol.iterator](){return this}}}destroy(e){if(this[U])return e?this.emit("error",e):this.emit(U),this;this[U]=!0,this[re]=!0,this[P].length=0,this[q]=0;let i=this;return typeof i.close=="function"&&!this[qr]&&i.close(),e?this.emit("error",e):this.emit(U),this}static get isStream(){return Hu}};var om=process.env.TESTING_TAR_FAKE_PLATFORM||process.platform,z=om!=="win32"?t=>t:t=>t&&t.replace(/\\/g,"/");var Vi=class extends be{extended;globalExtended;header;startBlockSize;blockRemain;remain;type;meta=!1;ignore=!1;path;mode;uid;gid;uname;gname;size=0;mtime;atime;ctime;linkpath;dev;ino;nlink;invalid=!1;absolute;unsupported=!1;constructor(e,i,n){switch(super({}),this.pause(),this.extended=i,this.globalExtended=n,this.header=e,this.remain=e.size??0,this.startBlockSize=512*Math.ceil(this.remain/512),this.blockRemain=this.startBlockSize,this.type=e.type,this.type){case"File":case"OldFile":case"Link":case"SymbolicLink":case"CharacterDevice":case"BlockDevice":case"Directory":case"FIFO":case"ContiguousFile":case"GNUDumpDir":break;case"NextFileHasLongLinkpath":case"NextFileHasLongPath":case"OldGnuLongPath":case"GlobalExtendedHeader":case"ExtendedHeader":case"OldExtendedHeader":this.meta=!0;break;default:this.ignore=!0}if(!e.path)throw new Error("no path provided for tar.ReadEntry");this.path=z(e.path),this.mode=e.mode,this.mode&&(this.mode=this.mode&4095),this.uid=e.uid,this.gid=e.gid,this.uname=e.uname,this.gname=e.gname,this.size=this.remain,this.mtime=e.mtime,this.atime=e.atime,this.ctime=e.ctime,this.linkpath=e.linkpath?z(e.linkpath):void 0,this.uname=e.uname,this.gname=e.gname,i&&this.#e(i),n&&this.#e(n,!0)}write(e){let i=e.length;if(i>this.blockRemain)throw new Error("writing more to entry than is appropriate");let n=this.remain,r=this.blockRemain;return this.remain=Math.max(0,n-i),this.blockRemain=Math.max(0,r-i),this.ignore?!0:n>=i?super.write(e):super.write(e.subarray(0,n))}#e(e,i=!1){e.path&&(e.path=z(e.path)),e.linkpath&&(e.linkpath=z(e.linkpath)),Object.assign(this,Object.fromEntries(Object.entries(e).filter(([n,r])=>!(r==null||n==="path"&&i))))}};var ti=(t,e,i,n={})=>{t.file&&(n.file=t.file),t.cwd&&(n.cwd=t.cwd),n.code=i instanceof Error&&i.code||e,n.tarCode=e,!t.strict&&n.recoverable!==!1?(i instanceof Error&&(n=Object.assign(i,n),i=i.message),t.emit("warn",e,i,n)):i instanceof Error?t.emit("error",Object.assign(i,n)):t.emit("error",Object.assign(new Error(`${e}: ${i}`),n))};var am=1024*1024,za=Buffer.from([31,139]),ja=Buffer.from([40,181,47,253]),cm=Math.max(za.length,ja.length),pe=Symbol("state"),ii=Symbol("writeEntry"),nt=Symbol("readEntry"),fa=Symbol("nextEntry"),E3=Symbol("processEntry"),Be=Symbol("extendedHeader"),Gn=Symbol("globalExtendedHeader"),jt=Symbol("meta"),I3=Symbol("emitMeta"),x=Symbol("buffer"),rt=Symbol("queue"),gt=Symbol("ended"),ha=Symbol("emittedEnd"),ni=Symbol("emit"),K=Symbol("unzip"),Xr=Symbol("consumeChunk"),Hr=Symbol("consumeChunkSub"),da=Symbol("consumeBody"),p3=Symbol("consumeMeta"),f3=Symbol("consumeHeader"),Sn=Symbol("consuming"),Ra=Symbol("bufferConcat"),Lr=Symbol("maybeEnd"),Ni=Symbol("writing"),xt=Symbol("aborted"),_r=Symbol("onDone"),ri=Symbol("sawValidEntry"),$r=Symbol("sawNullBlock"),eo=Symbol("sawEOF"),h3=Symbol("closeStream"),lm=()=>!0,ot=class extends sm{file;strict;maxMetaEntrySize;filter;brotli;zstd;writable=!0;readable=!1;[rt]=[];[x];[nt];[ii];[pe]="begin";[jt]="";[Be];[Gn];[gt]=!1;[K];[xt]=!1;[ri];[$r]=!1;[eo]=!1;[Ni]=!1;[Sn]=!1;[ha]=!1;constructor(e={}){super(),this.file=e.file||"",this.on(_r,()=>{(this[pe]==="begin"||this[ri]===!1)&&this.warn("TAR_BAD_ARCHIVE","Unrecognized archive format")}),e.ondone?this.on(_r,e.ondone):this.on(_r,()=>{this.emit("prefinish"),this.emit("finish"),this.emit("end")}),this.strict=!!e.strict,this.maxMetaEntrySize=e.maxMetaEntrySize||am,this.filter=typeof e.filter=="function"?e.filter:lm;let i=e.file&&(e.file.endsWith(".tar.br")||e.file.endsWith(".tbr"));this.brotli=!(e.gzip||e.zstd)&&e.brotli!==void 0?e.brotli:i?void 0:!1;let n=e.file&&(e.file.endsWith(".tar.zst")||e.file.endsWith(".tzst"));this.zstd=!(e.gzip||e.brotli)&&e.zstd!==void 0?e.zstd:n?!0:void 0,this.on("end",()=>this[h3]()),typeof e.onwarn=="function"&&this.on("warn",e.onwarn),typeof e.onReadEntry=="function"&&this.on("entry",e.onReadEntry)}warn(e,i,n={}){ti(this,e,i,n)}[f3](e,i){this[ri]===void 0&&(this[ri]=!1);let n;try{n=new ne(e,i,this[Be],this[Gn])}catch(r){return this.warn("TAR_ENTRY_INVALID",r)}if(n.nullBlock)this[$r]?(this[eo]=!0,this[pe]==="begin"&&(this[pe]="header"),this[ni]("eof")):(this[$r]=!0,this[ni]("nullBlock"));else if(this[$r]=!1,!n.cksumValid)this.warn("TAR_ENTRY_INVALID","checksum failure",{header:n});else if(!n.path)this.warn("TAR_ENTRY_INVALID","path is required",{header:n});else{let r=n.type;if(/^(Symbolic)?Link$/.test(r)&&!n.linkpath)this.warn("TAR_ENTRY_INVALID","linkpath required",{header:n});else if(!/^(Symbolic)?Link$/.test(r)&&!/^(Global)?ExtendedHeader$/.test(r)&&n.linkpath)this.warn("TAR_ENTRY_INVALID","linkpath forbidden",{header:n});else{let o=this[ii]=new Vi(n,this[Be],this[Gn]);if(!this[ri])if(o.remain){let s=()=>{o.invalid||(this[ri]=!0)};o.on("end",s)}else this[ri]=!0;o.meta?o.size>this.maxMetaEntrySize?(o.ignore=!0,this[ni]("ignoredEntry",o),this[pe]="ignore",o.resume()):o.size>0&&(this[jt]="",o.on("data",s=>this[jt]+=s),this[pe]="meta"):(this[Be]=void 0,o.ignore=o.ignore||!this.filter(o.path,o),o.ignore?(this[ni]("ignoredEntry",o),this[pe]=o.remain?"ignore":"header",o.resume()):(o.remain?this[pe]="body":(this[pe]="header",o.end()),this[nt]?this[rt].push(o):(this[rt].push(o),this[fa]())))}}}[h3](){queueMicrotask(()=>this.emit("close"))}[E3](e){let i=!0;if(!e)this[nt]=void 0,i=!1;else if(Array.isArray(e)){let[n,...r]=e;this.emit(n,...r)}else this[nt]=e,this.emit("entry",e),e.emittedEnd||(e.on("end",()=>this[fa]()),i=!1);return i}[fa](){do;while(this[E3](this[rt].shift()));if(!this[rt].length){let e=this[nt];!e||e.flowing||e.size===e.remain?this[Ni]||this.emit("drain"):e.once("drain",()=>this.emit("drain"))}}[da](e,i){let n=this[ii];if(!n)throw new Error("attempt to consume body without entry??");let r=n.blockRemain??0,o=r>=e.length&&i===0?e:e.subarray(i,i+r);return n.write(o),n.blockRemain||(this[pe]="header",this[ii]=void 0,n.end()),o.length}[p3](e,i){let n=this[ii],r=this[da](e,i);return!this[ii]&&n&&this[I3](n),r}[ni](e,i,n){!this[rt].length&&!this[nt]?this.emit(e,i,n):this[rt].push([e,i,n])}[I3](e){switch(this[ni]("meta",this[jt]),e.type){case"ExtendedHeader":case"OldExtendedHeader":this[Be]=Rt.parse(this[jt],this[Be],!1);break;case"GlobalExtendedHeader":this[Gn]=Rt.parse(this[jt],this[Gn],!0);break;case"NextFileHasLongPath":case"OldGnuLongPath":{let i=this[Be]??Object.create(null);this[Be]=i,i.path=this[jt].replace(/\0.*/,"");break}case"NextFileHasLongLinkpath":{let i=this[Be]||Object.create(null);this[Be]=i,i.linkpath=this[jt].replace(/\0.*/,"");break}default:throw new Error("unknown meta: "+e.type)}}abort(e){this[xt]=!0,this.emit("abort",e),this.warn("TAR_ABORT",e,{recoverable:!1})}write(e,i,n){if(typeof i=="function"&&(n=i,i=void 0),typeof e=="string"&&(e=Buffer.from(e,typeof i=="string"?i:"utf8")),this[xt])return n?.(),!1;if((this[K]===void 0||this.brotli===void 0&&this[K]===!1)&&e){if(this[x]&&(e=Buffer.concat([this[x],e]),this[x]=void 0),e.length<cm)return this[x]=e,n?.(),!0;for(let l=0;this[K]===void 0&&l<za.length;l++)e[l]!==za[l]&&(this[K]=!1);let s=!1;if(this[K]===!1&&this.zstd!==!1){s=!0;for(let l=0;l<ja.length;l++)if(e[l]!==ja[l]){s=!1;break}}let c=this.brotli===void 0&&!s;if(this[K]===!1&&c)if(e.length<512)if(this[gt])this.brotli=!0;else return this[x]=e,n?.(),!0;else try{new ne(e.subarray(0,512)),this.brotli=!1}catch{this.brotli=!0}if(this[K]===void 0||this[K]===!1&&(this.brotli||s)){let l=this[gt];this[gt]=!1,this[K]=this[K]===void 0?new Vr({}):s?new br({}):new Fr({}),this[K].on("data",A=>this[Xr](A)),this[K].on("error",A=>this.abort(A)),this[K].on("end",()=>{this[gt]=!0,this[Xr]()}),this[Ni]=!0;let v=!!this[K][l?"end":"write"](e);return this[Ni]=!1,n?.(),v}}this[Ni]=!0,this[K]?this[K].write(e):this[Xr](e),this[Ni]=!1;let o=this[rt].length?!1:this[nt]?this[nt].flowing:!0;return!o&&!this[rt].length&&this[nt]?.once("drain",()=>this.emit("drain")),n?.(),o}[Ra](e){e&&!this[xt]&&(this[x]=this[x]?Buffer.concat([this[x],e]):e)}[Lr](){if(this[gt]&&!this[ha]&&!this[xt]&&!this[Sn]){this[ha]=!0;let e=this[ii];if(e&&e.blockRemain){let i=this[x]?this[x].length:0;this.warn("TAR_BAD_ARCHIVE",`Truncated input (needed ${e.blockRemain} more bytes, only ${i} available)`,{entry:e}),this[x]&&e.write(this[x]),e.end()}this[ni](_r)}}[Xr](e){if(this[Sn]&&e)this[Ra](e);else if(!e&&!this[x])this[Lr]();else if(e){if(this[Sn]=!0,this[x]){this[Ra](e);let i=this[x];this[x]=void 0,this[Hr](i)}else this[Hr](e);for(;this[x]&&this[x]?.length>=512&&!this[xt]&&!this[eo];){let i=this[x];this[x]=void 0,this[Hr](i)}this[Sn]=!1}(!this[x]||this[gt])&&this[Lr]()}[Hr](e){let i=0,n=e.length;for(;i+512<=n&&!this[xt]&&!this[eo];)switch(this[pe]){case"begin":case"header":this[f3](e,i),i+=512;break;case"ignore":case"body":i+=this[da](e,i);break;case"meta":i+=this[p3](e,i);break;default:throw new Error("invalid state: "+this[pe])}i<n&&(this[x]?this[x]=Buffer.concat([e.subarray(i),this[x]]):this[x]=e.subarray(i))}end(e,i,n){return typeof e=="function"&&(n=e,i=void 0,e=void 0),typeof i=="function"&&(n=i,i=void 0),typeof e=="string"&&(e=Buffer.from(e,i)),n&&this.once("finish",n),this[xt]||(this[K]?(e&&this[K].write(e),this[K].end()):(this[gt]=!0,(this.brotli===void 0||this.zstd===void 0)&&(e=e||Buffer.alloc(0)),e&&this.write(e),this[Lr]())),this}};var Gt=t=>{let e=t.length-1,i=-1;for(;e>-1&&t.charAt(e)==="/";)i=e,e--;return i===-1?t:t.slice(0,i)};var um=t=>{let e=t.onReadEntry;t.onReadEntry=e?i=>{e(i),i.resume()}:i=>i.resume()},ga=(t,e)=>{let i=new Map(e.map(o=>[Gt(o),!0])),n=t.filter,r=(o,s="")=>{let c=s||Am(o).root||".",l;if(o===c)l=!1;else{let v=i.get(o);v!==void 0?l=v:l=r(vm(o),c)}return i.set(o,l),l};t.filter=n?(o,s)=>n(o,s)&&r(Gt(o)):o=>r(Gt(o))},mm=t=>{let e=new ot(t),i=t.file,n;try{n=ki.openSync(i,"r");let r=ki.fstatSync(n),o=t.maxReadSize||16*1024*1024;if(r.size<o){let s=Buffer.allocUnsafe(r.size),c=ki.readSync(n,s,0,r.size,0);e.end(c===s.byteLength?s:s.subarray(0,c))}else{let s=0,c=Buffer.allocUnsafe(o);for(;s<r.size;){let l=ki.readSync(n,c,0,o,s);if(l===0)break;s+=l,e.write(c.subarray(0,l))}e.end()}}finally{if(typeof n=="number")try{ki.closeSync(n)}catch{}}},Em=(t,e)=>{let i=new ot(t),n=t.maxReadSize||16*1024*1024,r=t.file;return new Promise((s,c)=>{i.on("error",c),i.on("end",s),ki.stat(r,(l,v)=>{if(l)c(l);else{let A=new Tt(r,{readSize:n,size:v.size});A.on("error",c),A.pipe(i)}})})},oi=Fe(mm,Em,t=>new ot(t),t=>new ot(t),(t,e)=>{e?.length&&ga(t,e),t.noResume||um(t)});import mo from"fs";import Ze from"fs";import j3 from"path";var xa=(t,e,i)=>(t&=4095,i&&(t=(t|384)&-19),e&&(t&256&&(t|=64),t&32&&(t|=8),t&4&&(t|=1)),t);import{win32 as Im}from"node:path";var{isAbsolute:pm,parse:d3}=Im,Yn=t=>{let e="",i=d3(t);for(;pm(t)||i.root;){let n=t.charAt(0)==="/"&&t.slice(0,4)!=="//?/"?"/":i.root;t=t.slice(n.length),e+=n,i=d3(t)}return[e,t]};var to=["|","<",">","?",":"],Ga=to.map(t=>String.fromCharCode(61440+t.charCodeAt(0))),fm=new Map(to.map((t,e)=>[t,Ga[e]])),hm=new Map(Ga.map((t,e)=>[t,to[e]])),Sa=t=>to.reduce((e,i)=>e.split(i).join(fm.get(i)),t),R3=t=>Ga.reduce((e,i)=>e.split(i).join(hm.get(i)),t);var Y3=(t,e)=>e?(t=z(t).replace(/^\.(\/|$)/,""),Gt(e)+"/"+t):z(t),dm=16*1024*1024,g3=Symbol("process"),x3=Symbol("file"),G3=Symbol("directory"),Wa=Symbol("symlink"),S3=Symbol("hardlink"),Wn=Symbol("header"),io=Symbol("read"),Ma=Symbol("lstat"),no=Symbol("onlstat"),Ca=Symbol("onread"),Oa=Symbol("onreadlink"),Ua=Symbol("openfile"),Ka=Symbol("onopenfile"),St=Symbol("close"),ro=Symbol("mode"),Va=Symbol("awaitDrain"),Ya=Symbol("ondrain"),Pe=Symbol("prefix"),Mn=class extends be{path;portable;myuid=process.getuid&&process.getuid()||0;myuser=process.env.USER||"";maxReadSize;linkCache;statCache;preservePaths;cwd;strict;mtime;noPax;noMtime;prefix;fd;blockLen=0;blockRemain=0;buf;pos=0;remain=0;length=0;offset=0;win32;absolute;header;type;linkpath;stat;onWriteEntry;#e=!1;constructor(e,i={}){let n=En(i);super(),this.path=z(e),this.portable=!!n.portable,this.maxReadSize=n.maxReadSize||dm,this.linkCache=n.linkCache||new Map,this.statCache=n.statCache||new Map,this.preservePaths=!!n.preservePaths,this.cwd=z(n.cwd||process.cwd()),this.strict=!!n.strict,this.noPax=!!n.noPax,this.noMtime=!!n.noMtime,this.mtime=n.mtime,this.prefix=n.prefix?z(n.prefix):void 0,this.onWriteEntry=n.onWriteEntry,typeof n.onwarn=="function"&&this.on("warn",n.onwarn);let r=!1;if(!this.preservePaths){let[s,c]=Yn(this.path);s&&typeof c=="string"&&(this.path=c,r=s)}this.win32=!!n.win32||process.platform==="win32",this.win32&&(this.path=R3(this.path.replace(/\\/g,"/")),e=e.replace(/\\/g,"/")),this.absolute=z(n.absolute||j3.resolve(this.cwd,e)),this.path===""&&(this.path="./"),r&&this.warn("TAR_ENTRY_INFO",`stripping ${r} from absolute path`,{entry:this,path:r+this.path});let o=this.statCache.get(this.absolute);o?this[no](o):this[Ma]()}warn(e,i,n={}){return ti(this,e,i,n)}emit(e,...i){return e==="error"&&(this.#e=!0),super.emit(e,...i)}[Ma](){Ze.lstat(this.absolute,(e,i)=>{if(e)return this.emit("error",e);this[no](i)})}[no](e){this.statCache.set(this.absolute,e),this.stat=e,e.isFile()||(e.size=0),this.type=Rm(e),this.emit("stat",e),this[g3]()}[g3](){switch(this.type){case"File":return this[x3]();case"Directory":return this[G3]();case"SymbolicLink":return this[Wa]();default:return this.end()}}[ro](e){return xa(e,this.type==="Directory",this.portable)}[Pe](e){return Y3(e,this.prefix)}[Wn](){if(!this.stat)throw new Error("cannot write header before stat");this.type==="Directory"&&this.portable&&(this.noMtime=!0),this.onWriteEntry?.(this),this.header=new ne({path:this[Pe](this.path),linkpath:this.type==="Link"&&this.linkpath!==void 0?this[Pe](this.linkpath):this.linkpath,mode:this[ro](this.stat.mode),uid:this.portable?void 0:this.stat.uid,gid:this.portable?void 0:this.stat.gid,size:this.stat.size,mtime:this.noMtime?void 0:this.mtime||this.stat.mtime,type:this.type==="Unsupported"?void 0:this.type,uname:this.portable?void 0:this.stat.uid===this.myuid?this.myuser:"",atime:this.portable?void 0:this.stat.atime,ctime:this.portable?void 0:this.stat.ctime}),this.header.encode()&&!this.noPax&&super.write(new Rt({atime:this.portable?void 0:this.header.atime,ctime:this.portable?void 0:this.header.ctime,gid:this.portable?void 0:this.header.gid,mtime:this.noMtime?void 0:this.mtime||this.header.mtime,path:this[Pe](this.path),linkpath:this.type==="Link"&&this.linkpath!==void 0?this[Pe](this.linkpath):this.linkpath,size:this.header.size,uid:this.portable?void 0:this.header.uid,uname:this.portable?void 0:this.header.uname,dev:this.portable?void 0:this.stat.dev,ino:this.portable?void 0:this.stat.ino,nlink:this.portable?void 0:this.stat.nlink}).encode());let e=this.header?.block;if(!e)throw new Error("failed to encode header");super.write(e)}[G3](){if(!this.stat)throw new Error("cannot create directory entry without stat");this.path.slice(-1)!=="/"&&(this.path+="/"),this.stat.size=0,this[Wn](),this.end()}[Wa](){Ze.readlink(this.absolute,(e,i)=>{if(e)return this.emit("error",e);this[Oa](i)})}[Oa](e){this.linkpath=z(e),this[Wn](),this.end()}[S3](e){if(!this.stat)throw new Error("cannot create link entry without stat");this.type="Link",this.linkpath=z(j3.relative(this.cwd,e)),this.stat.size=0,this[Wn](),this.end()}[x3](){if(!this.stat)throw new Error("cannot create file entry without stat");if(this.stat.nlink>1){let e=`${this.stat.dev}:${this.stat.ino}`,i=this.linkCache.get(e);if(i?.indexOf(this.cwd)===0)return this[S3](i);this.linkCache.set(e,this.absolute)}if(this[Wn](),this.stat.size===0)return this.end();this[Ua]()}[Ua](){Ze.open(this.absolute,"r",(e,i)=>{if(e)return this.emit("error",e);this[Ka](i)})}[Ka](e){if(this.fd=e,this.#e)return this[St]();if(!this.stat)throw new Error("should stat before calling onopenfile");this.blockLen=512*Math.ceil(this.stat.size/512),this.blockRemain=this.blockLen;let i=Math.min(this.blockLen,this.maxReadSize);this.buf=Buffer.allocUnsafe(i),this.offset=0,this.pos=0,this.remain=this.stat.size,this.length=this.buf.length,this[io]()}[io](){let{fd:e,buf:i,offset:n,length:r,pos:o}=this;if(e===void 0||i===void 0)throw new Error("cannot read file without first opening");Ze.read(e,i,n,r,o,(s,c)=>{if(s)return this[St](()=>this.emit("error",s));this[Ca](c)})}[St](e=()=>{}){this.fd!==void 0&&Ze.close(this.fd,e)}[Ca](e){if(e<=0&&this.remain>0){let r=Object.assign(new Error("encountered unexpected EOF"),{path:this.absolute,syscall:"read",code:"EOF"});return this[St](()=>this.emit("error",r))}if(e>this.remain){let r=Object.assign(new Error("did not encounter expected EOF"),{path:this.absolute,syscall:"read",code:"EOF"});return this[St](()=>this.emit("error",r))}if(!this.buf)throw new Error("should have created buffer prior to reading");if(e===this.remain)for(let r=e;r<this.length&&e<this.blockRemain;r++)this.buf[r+this.offset]=0,e++,this.remain++;let i=this.offset===0&&e===this.buf.length?this.buf:this.buf.subarray(this.offset,this.offset+e);this.write(i)?this[Ya]():this[Va](()=>this[Ya]())}[Va](e){this.once("drain",e)}write(e,i,n){if(typeof i=="function"&&(n=i,i=void 0),typeof e=="string"&&(e=Buffer.from(e,typeof i=="string"?i:"utf8")),this.blockRemain<e.length){let r=Object.assign(new Error("writing more data than expected"),{path:this.absolute});return this.emit("error",r)}return this.remain-=e.length,this.blockRemain-=e.length,this.pos+=e.length,this.offset+=e.length,super.write(e,null,n)}[Ya](){if(!this.remain)return this.blockRemain&&super.write(Buffer.alloc(this.blockRemain)),this[St](e=>e?this.emit("error",e):this.end());if(!this.buf)throw new Error("buffer lost somehow in ONDRAIN");this.offset>=this.length&&(this.buf=Buffer.allocUnsafe(Math.min(this.blockRemain,this.buf.length)),this.offset=0),this.length=this.buf.length-this.offset,this[io]()}},oo=class extends Mn{sync=!0;[Ma](){this[no](Ze.lstatSync(this.absolute))}[Wa](){this[Oa](Ze.readlinkSync(this.absolute))}[Ua](){this[Ka](Ze.openSync(this.absolute,"r"))}[io](){let e=!0;try{let{fd:i,buf:n,offset:r,length:o,pos:s}=this;if(i===void 0||n===void 0)throw new Error("fd and buf must be set in READ method");let c=Ze.readSync(i,n,r,o,s);this[Ca](c),e=!1}finally{if(e)try{this[St](()=>{})}catch{}}}[Va](e){e()}[St](e=()=>{}){this.fd!==void 0&&Ze.closeSync(this.fd),e()}},so=class extends be{blockLen=0;blockRemain=0;buf=0;pos=0;remain=0;length=0;preservePaths;portable;strict;noPax;noMtime;readEntry;type;prefix;path;mode;uid;gid;uname;gname;header;mtime;atime;ctime;linkpath;size;onWriteEntry;warn(e,i,n={}){return ti(this,e,i,n)}constructor(e,i={}){let n=En(i);super(),this.preservePaths=!!n.preservePaths,this.portable=!!n.portable,this.strict=!!n.strict,this.noPax=!!n.noPax,this.noMtime=!!n.noMtime,this.onWriteEntry=n.onWriteEntry,this.readEntry=e;let{type:r}=e;if(r==="Unsupported")throw new Error("writing entry that should be ignored");this.type=r,this.type==="Directory"&&this.portable&&(this.noMtime=!0),this.prefix=n.prefix,this.path=z(e.path),this.mode=e.mode!==void 0?this[ro](e.mode):void 0,this.uid=this.portable?void 0:e.uid,this.gid=this.portable?void 0:e.gid,this.uname=this.portable?void 0:e.uname,this.gname=this.portable?void 0:e.gname,this.size=e.size,this.mtime=this.noMtime?void 0:n.mtime||e.mtime,this.atime=this.portable?void 0:e.atime,this.ctime=this.portable?void 0:e.ctime,this.linkpath=e.linkpath!==void 0?z(e.linkpath):void 0,typeof n.onwarn=="function"&&this.on("warn",n.onwarn);let o=!1;if(!this.preservePaths){let[c,l]=Yn(this.path);c&&typeof l=="string"&&(this.path=l,o=c)}this.remain=e.size,this.blockRemain=e.startBlockSize,this.onWriteEntry?.(this),this.header=new ne({path:this[Pe](this.path),linkpath:this.type==="Link"&&this.linkpath!==void 0?this[Pe](this.linkpath):this.linkpath,mode:this.mode,uid:this.portable?void 0:this.uid,gid:this.portable?void 0:this.gid,size:this.size,mtime:this.noMtime?void 0:this.mtime,type:this.type,uname:this.portable?void 0:this.uname,atime:this.portable?void 0:this.atime,ctime:this.portable?void 0:this.ctime}),o&&this.warn("TAR_ENTRY_INFO",`stripping ${o} from absolute path`,{entry:this,path:o+this.path}),this.header.encode()&&!this.noPax&&super.write(new Rt({atime:this.portable?void 0:this.atime,ctime:this.portable?void 0:this.ctime,gid:this.portable?void 0:this.gid,mtime:this.noMtime?void 0:this.mtime,path:this[Pe](this.path),linkpath:this.type==="Link"&&this.linkpath!==void 0?this[Pe](this.linkpath):this.linkpath,size:this.size,uid:this.portable?void 0:this.uid,uname:this.portable?void 0:this.uname,dev:this.portable?void 0:this.readEntry.dev,ino:this.portable?void 0:this.readEntry.ino,nlink:this.portable?void 0:this.readEntry.nlink}).encode());let s=this.header?.block;if(!s)throw new Error("failed to encode header");super.write(s),e.pipe(this)}[Pe](e){return Y3(e,this.prefix)}[ro](e){return xa(e,this.type==="Directory",this.portable)}write(e,i,n){typeof i=="function"&&(n=i,i=void 0),typeof e=="string"&&(e=Buffer.from(e,typeof i=="string"?i:"utf8"));let r=e.length;if(r>this.blockRemain)throw new Error("writing more to entry than is appropriate");return this.blockRemain-=r,super.write(e,n)}end(e,i,n){return this.blockRemain&&super.write(Buffer.alloc(this.blockRemain)),typeof e=="function"&&(n=e,i=void 0,e=void 0),typeof i=="function"&&(n=i,i=void 0),typeof e=="string"&&(e=Buffer.from(e,i??"utf8")),n&&this.once("finish",n),e?super.end(e,n):super.end(n),this}},Rm=t=>t.isFile()?"File":t.isDirectory()?"Directory":t.isSymbolicLink()?"SymbolicLink":"Unsupported";var ao=class t{tail;head;length=0;static create(e=[]){return new t(e)}constructor(e=[]){for(let i of e)this.push(i)}*[Symbol.iterator](){for(let e=this.head;e;e=e.next)yield e.value}removeNode(e){if(e.list!==this)throw new Error("removing node which does not belong to this list");let i=e.next,n=e.prev;return i&&(i.prev=n),n&&(n.next=i),e===this.head&&(this.head=i),e===this.tail&&(this.tail=n),this.length--,e.next=void 0,e.prev=void 0,e.list=void 0,i}unshiftNode(e){if(e===this.head)return;e.list&&e.list.removeNode(e);let i=this.head;e.list=this,e.next=i,i&&(i.prev=e),this.head=e,this.tail||(this.tail=e),this.length++}pushNode(e){if(e===this.tail)return;e.list&&e.list.removeNode(e);let i=this.tail;e.list=this,e.prev=i,i&&(i.next=e),this.tail=e,this.head||(this.head=e),this.length++}push(...e){for(let i=0,n=e.length;i<n;i++)jm(this,e[i]);return this.length}unshift(...e){for(var i=0,n=e.length;i<n;i++)gm(this,e[i]);return this.length}pop(){if(!this.tail)return;let e=this.tail.value,i=this.tail;return this.tail=this.tail.prev,this.tail?this.tail.next=void 0:this.head=void 0,i.list=void 0,this.length--,e}shift(){if(!this.head)return;let e=this.head.value,i=this.head;return this.head=this.head.next,this.head?this.head.prev=void 0:this.tail=void 0,i.list=void 0,this.length--,e}forEach(e,i){i=i||this;for(let n=this.head,r=0;n;r++)e.call(i,n.value,r,this),n=n.next}forEachReverse(e,i){i=i||this;for(let n=this.tail,r=this.length-1;n;r--)e.call(i,n.value,r,this),n=n.prev}get(e){let i=0,n=this.head;for(;n&&i<e;i++)n=n.next;if(i===e&&n)return n.value}getReverse(e){let i=0,n=this.tail;for(;n&&i<e;i++)n=n.prev;if(i===e&&n)return n.value}map(e,i){i=i||this;let n=new t;for(let r=this.head;r;)n.push(e.call(i,r.value,this)),r=r.next;return n}mapReverse(e,i){i=i||this;var n=new t;for(let r=this.tail;r;)n.push(e.call(i,r.value,this)),r=r.prev;return n}reduce(e,i){let n,r=this.head;if(arguments.length>1)n=i;else if(this.head)r=this.head.next,n=this.head.value;else throw new TypeError("Reduce of empty list with no initial value");for(var o=0;r;o++)n=e(n,r.value,o),r=r.next;return n}reduceReverse(e,i){let n,r=this.tail;if(arguments.length>1)n=i;else if(this.tail)r=this.tail.prev,n=this.tail.value;else throw new TypeError("Reduce of empty list with no initial value");for(let o=this.length-1;r;o--)n=e(n,r.value,o),r=r.prev;return n}toArray(){let e=new Array(this.length);for(let i=0,n=this.head;n;i++)e[i]=n.value,n=n.next;return e}toArrayReverse(){let e=new Array(this.length);for(let i=0,n=this.tail;n;i++)e[i]=n.value,n=n.prev;return e}slice(e=0,i=this.length){i<0&&(i+=this.length),e<0&&(e+=this.length);let n=new t;if(i<e||i<0)return n;e<0&&(e=0),i>this.length&&(i=this.length);let r=this.head,o=0;for(o=0;r&&o<e;o++)r=r.next;for(;r&&o<i;o++,r=r.next)n.push(r.value);return n}sliceReverse(e=0,i=this.length){i<0&&(i+=this.length),e<0&&(e+=this.length);let n=new t;if(i<e||i<0)return n;e<0&&(e=0),i>this.length&&(i=this.length);let r=this.length,o=this.tail;for(;o&&r>i;r--)o=o.prev;for(;o&&r>e;r--,o=o.prev)n.push(o.value);return n}splice(e,i=0,...n){e>this.length&&(e=this.length-1),e<0&&(e=this.length+e);let r=this.head;for(let s=0;r&&s<e;s++)r=r.next;let o=[];for(let s=0;r&&s<i;s++)o.push(r.value),r=this.removeNode(r);r?r!==this.tail&&(r=r.prev):r=this.tail;for(let s of n)r=zm(this,r,s);return o}reverse(){let e=this.head,i=this.tail;for(let n=e;n;n=n.prev){let r=n.prev;n.prev=n.next,n.next=r}return this.head=i,this.tail=e,this}};function zm(t,e,i){let n=e,r=e?e.next:t.head,o=new Cn(i,n,r,t);return o.next===void 0&&(t.tail=o),o.prev===void 0&&(t.head=o),t.length++,o}function jm(t,e){t.tail=new Cn(e,t.tail,void 0,t),t.head||(t.head=t.tail),t.length++}function gm(t,e){t.head=new Cn(e,void 0,t.head,t),t.tail||(t.tail=t.head),t.length++}var Cn=class{list;next;prev;value;constructor(e,i,n,r){this.list=r,this.value=e,i?(i.next=this,this.prev=i):this.prev=void 0,n?(n.prev=this,this.next=n):this.next=void 0}};import U3 from"path";var Eo=class{path;absolute;entry;stat;readdir;pending=!1;ignore=!1;piped=!1;constructor(e,i){this.path=e||"./",this.absolute=i}},W3=Buffer.alloc(1024),co=Symbol("onStat"),On=Symbol("ended"),We=Symbol("queue"),Fi=Symbol("current"),si=Symbol("process"),Un=Symbol("processing"),M3=Symbol("processJob"),Me=Symbol("jobs"),Na=Symbol("jobDone"),lo=Symbol("addFSEntry"),C3=Symbol("addTarEntry"),Qa=Symbol("stat"),Ja=Symbol("readdir"),vo=Symbol("onreaddir"),Ao=Symbol("pipe"),O3=Symbol("entry"),ka=Symbol("entryOpt"),uo=Symbol("writeEntryClass"),K3=Symbol("write"),Fa=Symbol("ondrain"),Yt=class extends be{opt;cwd;maxReadSize;preservePaths;strict;noPax;prefix;linkCache;statCache;file;portable;zip;readdirCache;noDirRecurse;follow;noMtime;mtime;filter;jobs;[uo];onWriteEntry;[We];[Me]=0;[Un]=!1;[On]=!1;constructor(e={}){if(super(),this.opt=e,this.file=e.file||"",this.cwd=e.cwd||process.cwd(),this.maxReadSize=e.maxReadSize,this.preservePaths=!!e.preservePaths,this.strict=!!e.strict,this.noPax=!!e.noPax,this.prefix=z(e.prefix||""),this.linkCache=e.linkCache||new Map,this.statCache=e.statCache||new Map,this.readdirCache=e.readdirCache||new Map,this.onWriteEntry=e.onWriteEntry,this[uo]=Mn,typeof e.onwarn=="function"&&this.on("warn",e.onwarn),this.portable=!!e.portable,e.gzip||e.brotli||e.zstd){if((e.gzip?1:0)+(e.brotli?1:0)+(e.zstd?1:0)>1)throw new TypeError("gzip, brotli, zstd are mutually exclusive");if(e.gzip&&(typeof e.gzip!="object"&&(e.gzip={}),this.portable&&(e.gzip.portable=!0),this.zip=new Kr(e.gzip)),e.brotli&&(typeof e.brotli!="object"&&(e.brotli={}),this.zip=new kr(e.brotli)),e.zstd&&(typeof e.zstd!="object"&&(e.zstd={}),this.zip=new Jr(e.zstd)),!this.zip)throw new Error("impossible");let i=this.zip;i.on("data",n=>super.write(n)),i.on("end",()=>super.end()),i.on("drain",()=>this[Fa]()),this.on("resume",()=>i.resume())}else this.on("drain",this[Fa]);this.noDirRecurse=!!e.noDirRecurse,this.follow=!!e.follow,this.noMtime=!!e.noMtime,e.mtime&&(this.mtime=e.mtime),this.filter=typeof e.filter=="function"?e.filter:()=>!0,this[We]=new ao,this[Me]=0,this.jobs=Number(e.jobs)||4,this[Un]=!1,this[On]=!1}[K3](e){return super.write(e)}add(e){return this.write(e),this}end(e,i,n){return typeof e=="function"&&(n=e,e=void 0),typeof i=="function"&&(n=i,i=void 0),e&&this.add(e),this[On]=!0,this[si](),n&&n(),this}write(e){if(this[On])throw new Error("write after end");return e instanceof Vi?this[C3](e):this[lo](e),this.flowing}[C3](e){let i=z(U3.resolve(this.cwd,e.path));if(!this.filter(e.path,e))e.resume();else{let n=new Eo(e.path,i);n.entry=new so(e,this[ka](n)),n.entry.on("end",()=>this[Na](n)),this[Me]+=1,this[We].push(n)}this[si]()}[lo](e){let i=z(U3.resolve(this.cwd,e));this[We].push(new Eo(e,i)),this[si]()}[Qa](e){e.pending=!0,this[Me]+=1;let i=this.follow?"stat":"lstat";mo[i](e.absolute,(n,r)=>{e.pending=!1,this[Me]-=1,n?this.emit("error",n):this[co](e,r)})}[co](e,i){this.statCache.set(e.absolute,i),e.stat=i,this.filter(e.path,i)||(e.ignore=!0),this[si]()}[Ja](e){e.pending=!0,this[Me]+=1,mo.readdir(e.absolute,(i,n)=>{if(e.pending=!1,this[Me]-=1,i)return this.emit("error",i);this[vo](e,n)})}[vo](e,i){this.readdirCache.set(e.absolute,i),e.readdir=i,this[si]()}[si](){if(!this[Un]){this[Un]=!0;for(let e=this[We].head;e&&this[Me]<this.jobs;e=e.next)if(this[M3](e.value),e.value.ignore){let i=e.next;this[We].removeNode(e),e.next=i}this[Un]=!1,this[On]&&!this[We].length&&this[Me]===0&&(this.zip?this.zip.end(W3):(super.write(W3),super.end()))}}get[Fi](){return this[We]&&this[We].head&&this[We].head.value}[Na](e){this[We].shift(),this[Me]-=1,this[si]()}[M3](e){if(!e.pending){if(e.entry){e===this[Fi]&&!e.piped&&this[Ao](e);return}if(!e.stat){let i=this.statCache.get(e.absolute);i?this[co](e,i):this[Qa](e)}if(e.stat&&!e.ignore){if(!this.noDirRecurse&&e.stat.isDirectory()&&!e.readdir){let i=this.readdirCache.get(e.absolute);if(i?this[vo](e,i):this[Ja](e),!e.readdir)return}if(e.entry=this[O3](e),!e.entry){e.ignore=!0;return}e===this[Fi]&&!e.piped&&this[Ao](e)}}}[ka](e){return{onwarn:(i,n,r)=>this.warn(i,n,r),noPax:this.noPax,cwd:this.cwd,absolute:e.absolute,preservePaths:this.preservePaths,maxReadSize:this.maxReadSize,strict:this.strict,portable:this.portable,linkCache:this.linkCache,statCache:this.statCache,noMtime:this.noMtime,mtime:this.mtime,prefix:this.prefix,onWriteEntry:this.onWriteEntry}}[O3](e){this[Me]+=1;try{return new this[uo](e.path,this[ka](e)).on("end",()=>this[Na](e)).on("error",n=>this.emit("error",n))}catch(i){this.emit("error",i)}}[Fa](){this[Fi]&&this[Fi].entry&&this[Fi].entry.resume()}[Ao](e){e.piped=!0,e.readdir&&e.readdir.forEach(r=>{let o=e.path,s=o==="./"?"":o.replace(/\/*$/,"/");this[lo](s+r)});let i=e.entry,n=this.zip;if(!i)throw new Error("cannot pipe without source");n?i.on("data",r=>{n.write(r)||i.pause()}):i.on("data",r=>{super.write(r)||i.pause()})}pause(){return this.zip&&this.zip.pause(),super.pause()}warn(e,i,n={}){ti(this,e,i,n)}},ai=class extends Yt{sync=!0;constructor(e){super(e),this[uo]=oo}pause(){}resume(){}[Qa](e){let i=this.follow?"statSync":"lstatSync";this[co](e,mo[i](e.absolute))}[Ja](e){this[vo](e,mo.readdirSync(e.absolute))}[Ao](e){let i=e.entry,n=this.zip;if(e.readdir&&e.readdir.forEach(r=>{let o=e.path,s=o==="./"?"":o.replace(/\/*$/,"/");this[lo](s+r)}),!i)throw new Error("Cannot pipe without source");n?i.on("data",r=>{n.write(r)}):i.on("data",r=>{super[K3](r)})}};var xm=(t,e)=>{let i=new ai(t),n=new Yi(t.file,{mode:t.mode||438});i.pipe(n),N3(i,e)},Gm=(t,e)=>{let i=new Yt(t),n=new _e(t.file,{mode:t.mode||438});i.pipe(n);let r=new Promise((o,s)=>{n.on("error",s),n.on("close",o),i.on("error",s)});return k3(i,e),r},N3=(t,e)=>{e.forEach(i=>{i.charAt(0)==="@"?oi({file:V3.resolve(t.cwd,i.slice(1)),sync:!0,noResume:!0,onReadEntry:n=>t.add(n)}):t.add(i)}),t.end()},k3=async(t,e)=>{for(let i=0;i<e.length;i++){let n=String(e[i]);n.charAt(0)==="@"?await oi({file:V3.resolve(String(t.cwd),n.slice(1)),noResume:!0,onReadEntry:r=>{t.add(r)}}):t.add(n)}t.end()},Sm=(t,e)=>{let i=new ai(t);return N3(i,e),i},Ym=(t,e)=>{let i=new Yt(t);return k3(i,e),i},Wm=Fe(xm,Gm,Sm,Ym,(t,e)=>{if(!e?.length)throw new TypeError("no paths specified to add to archive")});import ev from"node:fs";import ym from"node:assert";import{randomBytes as $3}from"node:crypto";import j from"node:fs";import st from"node:path";import F3 from"fs";var Mm=process.env.__FAKE_PLATFORM__||process.platform,Cm=Mm==="win32",{O_CREAT:Om,O_TRUNC:Um,O_WRONLY:Km}=F3.constants,Q3=Number(process.env.__FAKE_FS_O_FILENAME__)||F3.constants.UV_FS_O_FILEMAP||0,Vm=Cm&&!!Q3,Nm=512*1024,km=Q3|Um|Om|Km,ba=Vm?t=>t<Nm?km:"w":()=>"w";import po from"node:fs";import Kn from"node:path";var Ba=(t,e,i)=>{try{return po.lchownSync(t,e,i)}catch(n){if(n?.code!=="ENOENT")throw n}},Io=(t,e,i,n)=>{po.lchown(t,e,i,r=>{n(r&&r?.code!=="ENOENT"?r:null)})},Fm=(t,e,i,n,r)=>{if(e.isDirectory())Za(Kn.resolve(t,e.name),i,n,o=>{if(o)return r(o);let s=Kn.resolve(t,e.name);Io(s,i,n,r)});else{let o=Kn.resolve(t,e.name);Io(o,i,n,r)}},Za=(t,e,i,n)=>{po.readdir(t,{withFileTypes:!0},(r,o)=>{if(r){if(r.code==="ENOENT")return n();if(r.code!=="ENOTDIR"&&r.code!=="ENOTSUP")return n(r)}if(r||!o.length)return Io(t,e,i,n);let s=o.length,c=null,l=v=>{if(!c){if(v)return n(c=v);if(--s===0)return Io(t,e,i,n)}};for(let v of o)Fm(t,v,e,i,l)})},Qm=(t,e,i,n)=>{e.isDirectory()&&Pa(Kn.resolve(t,e.name),i,n),Ba(Kn.resolve(t,e.name),i,n)},Pa=(t,e,i)=>{let n;try{n=po.readdirSync(t,{withFileTypes:!0})}catch(r){let o=r;if(o?.code==="ENOENT")return;if(o?.code==="ENOTDIR"||o?.code==="ENOTSUP")return Ba(t,e,i);throw o}for(let r of n)Qm(t,r,e,i);return Ba(t,e,i)};import oe from"node:fs";import Jm from"node:fs/promises";import fo from"node:path";var Vn=class extends Error{path;code;syscall="chdir";constructor(e,i){super(`${i}: Cannot cd into '${e}'`),this.path=e,this.code=i}get name(){return"CwdError"}};var Nn=class extends Error{path;symlink;syscall="symlink";code="TAR_SYMLINK_ERROR";constructor(e,i){super("TAR_SYMLINK_ERROR: Cannot extract through symbolic link"),this.symlink=e,this.path=i}get name(){return"SymlinkError"}};var bm=(t,e)=>{oe.stat(t,(i,n)=>{(i||!n.isDirectory())&&(i=new Vn(t,i?.code||"ENOTDIR")),e(i)})},J3=(t,e,i)=>{t=z(t);let n=e.umask??18,r=e.mode|448,o=(r&n)!==0,s=e.uid,c=e.gid,l=typeof s=="number"&&typeof c=="number"&&(s!==e.processUid||c!==e.processGid),v=e.preserve,A=e.unlink,u=z(e.cwd),I=(R,h)=>{R?i(R):h&&l?Za(h,s,c,H=>I(H)):o?oe.chmod(t,r,i):i()};if(t===u)return bm(t,I);if(v)return Jm.mkdir(t,{mode:r,recursive:!0}).then(R=>I(null,R??void 0),I);let f=z(fo.relative(u,t)).split("/");qa(u,f,r,A,u,void 0,I)},qa=(t,e,i,n,r,o,s)=>{if(!e.length)return s(null,o);let c=e.shift(),l=z(fo.resolve(t+"/"+c));oe.mkdir(l,i,b3(l,e,i,n,r,o,s))},b3=(t,e,i,n,r,o,s)=>c=>{c?oe.lstat(t,(l,v)=>{if(l)l.path=l.path&&z(l.path),s(l);else if(v.isDirectory())qa(t,e,i,n,r,o,s);else if(n)oe.unlink(t,A=>{if(A)return s(A);oe.mkdir(t,i,b3(t,e,i,n,r,o,s))});else{if(v.isSymbolicLink())return s(new Nn(t,t+"/"+e.join("/")));s(c)}}):(o=o||t,qa(t,e,i,n,r,o,s))},Bm=t=>{let e=!1,i;try{e=oe.statSync(t).isDirectory()}catch(n){i=n?.code}finally{if(!e)throw new Vn(t,i??"ENOTDIR")}},B3=(t,e)=>{t=z(t);let i=e.umask??18,n=e.mode|448,r=(n&i)!==0,o=e.uid,s=e.gid,c=typeof o=="number"&&typeof s=="number"&&(o!==e.processUid||s!==e.processGid),l=e.preserve,v=e.unlink,A=z(e.cwd),u=R=>{R&&c&&Pa(R,o,s),r&&oe.chmodSync(t,n)};if(t===A)return Bm(A),u();if(l)return u(oe.mkdirSync(t,{mode:n,recursive:!0})??void 0);let E=z(fo.relative(A,t)).split("/"),f;for(let R=E.shift(),h=A;R&&(h+="/"+R);R=E.shift()){h=z(fo.resolve(h));try{oe.mkdirSync(h,n),f=f||h}catch{let ve=oe.lstatSync(h);if(ve.isDirectory())continue;if(v){oe.unlinkSync(h),oe.mkdirSync(h,n),f=f||h;continue}else if(ve.isSymbolicLink())return new Nn(h,h+"/"+E.join("/"))}}return u(f)};import{join as q3}from"node:path";var ya=Object.create(null),Z3=1e4,Qi=new Set,P3=t=>{Qi.has(t)?Qi.delete(t):ya[t]=t.normalize("NFD"),Qi.add(t);let e=ya[t],i=Qi.size-Z3;if(i>Z3/10){for(let n of Qi)if(Qi.delete(n),delete ya[n],--i<=0)break}return e};var Zm=process.env.TESTING_TAR_FAKE_PLATFORM||process.platform,Pm=Zm==="win32",qm=t=>t.split("/").slice(0,-1).reduce((i,n)=>{let r=i[i.length-1];return r!==void 0&&(n=q3(r,n)),i.push(n||"/"),i},[]),ho=class{#e=new Map;#n=new Map;#i=new Set;reserve(e,i){e=Pm?["win32 parallelization disabled"]:e.map(r=>Gt(q3(P3(r))).toLowerCase());let n=new Set(e.map(r=>qm(r)).reduce((r,o)=>r.concat(o)));this.#n.set(i,{dirs:n,paths:e});for(let r of e){let o=this.#e.get(r);o?o.push(i):this.#e.set(r,[i])}for(let r of n){let o=this.#e.get(r);if(!o)this.#e.set(r,[new Set([i])]);else{let s=o[o.length-1];s instanceof Set?s.add(i):o.push(new Set([i]))}}return this.#a(i)}#r(e){let i=this.#n.get(e);if(!i)throw new Error("function does not have any path reservations");return{paths:i.paths.map(n=>this.#e.get(n)),dirs:[...i.dirs].map(n=>this.#e.get(n))}}check(e){let{paths:i,dirs:n}=this.#r(e);return i.every(r=>r&&r[0]===e)&&n.every(r=>r&&r[0]instanceof Set&&r[0].has(e))}#a(e){return this.#i.has(e)||!this.check(e)?!1:(this.#i.add(e),e(()=>this.#t(e)),!0)}#t(e){if(!this.#i.has(e))return!1;let i=this.#n.get(e);if(!i)throw new Error("invalid reservation");let{paths:n,dirs:r}=i,o=new Set;for(let s of n){let c=this.#e.get(s);if(!c||c?.[0]!==e)continue;let l=c[1];if(!l){this.#e.delete(s);continue}if(c.shift(),typeof l=="function")o.add(l);else for(let v of l)o.add(v)}for(let s of r){let c=this.#e.get(s),l=c?.[0];if(!(!c||!(l instanceof Set)))if(l.size===1&&c.length===1){this.#e.delete(s);continue}else if(l.size===1){c.shift();let v=c[0];typeof v=="function"&&o.add(v)}else l.delete(e)}return this.#i.delete(e),o.forEach(s=>this.#a(s)),!0}};var y3=Symbol("onEntry"),Ta=Symbol("checkFs"),D3=Symbol("checkFs2"),Xa=Symbol("isReusable"),fe=Symbol("makeFs"),Ha=Symbol("file"),La=Symbol("directory"),jo=Symbol("link"),w3=Symbol("symlink"),T3=Symbol("hardlink"),X3=Symbol("unsupported"),H3=Symbol("checkPath"),Wt=Symbol("mkdir"),X=Symbol("onError"),Ro=Symbol("pending"),L3=Symbol("pend"),Ji=Symbol("unpend"),Da=Symbol("ended"),wa=Symbol("maybeClose"),_a=Symbol("skip"),kn=Symbol("doChown"),Fn=Symbol("uid"),Qn=Symbol("gid"),Jn=Symbol("checkedCwd"),Dm=process.env.TESTING_TAR_FAKE_PLATFORM||process.platform,bn=Dm==="win32",wm=1024,Tm=(t,e)=>{if(!bn)return j.unlink(t,e);let i=t+".DELETE."+$3(16).toString("hex");j.rename(t,i,n=>{if(n)return e(n);j.unlink(i,e)})},Xm=t=>{if(!bn)return j.unlinkSync(t);let e=t+".DELETE."+$3(16).toString("hex");j.renameSync(t,e),j.unlinkSync(e)},_3=(t,e,i)=>t!==void 0&&t===t>>>0?t:e!==void 0&&e===e>>>0?e:i,bi=class extends ot{[Da]=!1;[Jn]=!1;[Ro]=0;reservations=new ho;transform;writable=!0;readable=!1;uid;gid;setOwner;preserveOwner;processGid;processUid;maxDepth;forceChown;win32;newer;keep;noMtime;preservePaths;unlink;cwd;strip;processUmask;umask;dmode;fmode;chmod;constructor(e={}){if(e.ondone=()=>{this[Da]=!0,this[wa]()},super(e),this.transform=e.transform,this.chmod=!!e.chmod,typeof e.uid=="number"||typeof e.gid=="number"){if(typeof e.uid!="number"||typeof e.gid!="number")throw new TypeError("cannot set owner without number uid and gid");if(e.preserveOwner)throw new TypeError("cannot preserve owner in archive and also set owner explicitly");this.uid=e.uid,this.gid=e.gid,this.setOwner=!0}else this.uid=void 0,this.gid=void 0,this.setOwner=!1;e.preserveOwner===void 0&&typeof e.uid!="number"?this.preserveOwner=!!(process.getuid&&process.getuid()===0):this.preserveOwner=!!e.preserveOwner,this.processUid=(this.preserveOwner||this.setOwner)&&process.getuid?process.getuid():void 0,this.processGid=(this.preserveOwner||this.setOwner)&&process.getgid?process.getgid():void 0,this.maxDepth=typeof e.maxDepth=="number"?e.maxDepth:wm,this.forceChown=e.forceChown===!0,this.win32=!!e.win32||bn,this.newer=!!e.newer,this.keep=!!e.keep,this.noMtime=!!e.noMtime,this.preservePaths=!!e.preservePaths,this.unlink=!!e.unlink,this.cwd=z(st.resolve(e.cwd||process.cwd())),this.strip=Number(e.strip)||0,this.processUmask=this.chmod?typeof e.processUmask=="number"?e.processUmask:process.umask():0,this.umask=typeof e.umask=="number"?e.umask:this.processUmask,this.dmode=e.dmode||511&~this.umask,this.fmode=e.fmode||438&~this.umask,this.on("entry",i=>this[y3](i))}warn(e,i,n={}){return(e==="TAR_BAD_ARCHIVE"||e==="TAR_ABORT")&&(n.recoverable=!1),super.warn(e,i,n)}[wa](){this[Da]&&this[Ro]===0&&(this.emit("prefinish"),this.emit("finish"),this.emit("end"))}[H3](e){let i=z(e.path),n=i.split("/");if(this.strip){if(n.length<this.strip)return!1;if(e.type==="Link"){let r=z(String(e.linkpath)).split("/");if(r.length>=this.strip)e.linkpath=r.slice(this.strip).join("/");else return!1}n.splice(0,this.strip),e.path=n.join("/")}if(isFinite(this.maxDepth)&&n.length>this.maxDepth)return this.warn("TAR_ENTRY_ERROR","path excessively deep",{entry:e,path:i,depth:n.length,maxDepth:this.maxDepth}),!1;if(!this.preservePaths){if(n.includes("..")||bn&&/^[a-z]:\.\.$/i.test(n[0]??""))return this.warn("TAR_ENTRY_ERROR","path contains '..'",{entry:e,path:i}),!1;let[r,o]=Yn(i);r&&(e.path=String(o),this.warn("TAR_ENTRY_INFO",`stripping ${r} from absolute path`,{entry:e,path:i}))}if(st.isAbsolute(e.path)?e.absolute=z(st.resolve(e.path)):e.absolute=z(st.resolve(this.cwd,e.path)),!this.preservePaths&&typeof e.absolute=="string"&&e.absolute.indexOf(this.cwd+"/")!==0&&e.absolute!==this.cwd)return this.warn("TAR_ENTRY_ERROR","path escaped extraction target",{entry:e,path:z(e.path),resolvedPath:e.absolute,cwd:this.cwd}),!1;if(e.absolute===this.cwd&&e.type!=="Directory"&&e.type!=="GNUDumpDir")return!1;if(this.win32){let{root:r}=st.win32.parse(String(e.absolute));e.absolute=r+Sa(String(e.absolute).slice(r.length));let{root:o}=st.win32.parse(e.path);e.path=o+Sa(e.path.slice(o.length))}return!0}[y3](e){if(!this[H3](e))return e.resume();switch(ym.equal(typeof e.absolute,"string"),e.type){case"Directory":case"GNUDumpDir":e.mode&&(e.mode=e.mode|448);case"File":case"OldFile":case"ContiguousFile":case"Link":case"SymbolicLink":return this[Ta](e);default:return this[X3](e)}}[X](e,i){e.name==="CwdError"?this.emit("error",e):(this.warn("TAR_ENTRY_ERROR",e,{entry:i}),this[Ji](),i.resume())}[Wt](e,i,n){J3(z(e),{uid:this.uid,gid:this.gid,processUid:this.processUid,processGid:this.processGid,umask:this.processUmask,preserve:this.preservePaths,unlink:this.unlink,cwd:this.cwd,mode:i},n)}[kn](e){return this.forceChown||this.preserveOwner&&(typeof e.uid=="number"&&e.uid!==this.processUid||typeof e.gid=="number"&&e.gid!==this.processGid)||typeof this.uid=="number"&&this.uid!==this.processUid||typeof this.gid=="number"&&this.gid!==this.processGid}[Fn](e){return _3(this.uid,e.uid,this.processUid)}[Qn](e){return _3(this.gid,e.gid,this.processGid)}[Ha](e,i){let n=typeof e.mode=="number"?e.mode&4095:this.fmode,r=new _e(String(e.absolute),{flags:ba(e.size),mode:n,autoClose:!1});r.on("error",l=>{r.fd&&j.close(r.fd,()=>{}),r.write=()=>!0,this[X](l,e),i()});let o=1,s=l=>{if(l){r.fd&&j.close(r.fd,()=>{}),this[X](l,e),i();return}--o===0&&r.fd!==void 0&&j.close(r.fd,v=>{v?this[X](v,e):this[Ji](),i()})};r.on("finish",()=>{let l=String(e.absolute),v=r.fd;if(typeof v=="number"&&e.mtime&&!this.noMtime){o++;let A=e.atime||new Date,u=e.mtime;j.futimes(v,A,u,I=>I?j.utimes(l,A,u,E=>s(E&&I)):s())}if(typeof v=="number"&&this[kn](e)){o++;let A=this[Fn](e),u=this[Qn](e);typeof A=="number"&&typeof u=="number"&&j.fchown(v,A,u,I=>I?j.chown(l,A,u,E=>s(E&&I)):s())}s()});let c=this.transform&&this.transform(e)||e;c!==e&&(c.on("error",l=>{this[X](l,e),i()}),e.pipe(c)),c.pipe(r)}[La](e,i){let n=typeof e.mode=="number"?e.mode&4095:this.dmode;this[Wt](String(e.absolute),n,r=>{if(r){this[X](r,e),i();return}let o=1,s=()=>{--o===0&&(i(),this[Ji](),e.resume())};e.mtime&&!this.noMtime&&(o++,j.utimes(String(e.absolute),e.atime||new Date,e.mtime,s)),this[kn](e)&&(o++,j.chown(String(e.absolute),Number(this[Fn](e)),Number(this[Qn](e)),s)),s()})}[X3](e){e.unsupported=!0,this.warn("TAR_ENTRY_UNSUPPORTED",`unsupported entry type: ${e.type}`,{entry:e}),e.resume()}[w3](e,i){this[jo](e,String(e.linkpath),"symlink",i)}[T3](e,i){let n=z(st.resolve(this.cwd,String(e.linkpath)));this[jo](e,n,"link",i)}[L3](){this[Ro]++}[Ji](){this[Ro]--,this[wa]()}[_a](e){this[Ji](),e.resume()}[Xa](e,i){return e.type==="File"&&!this.unlink&&i.isFile()&&i.nlink<=1&&!bn}[Ta](e){this[L3]();let i=[e.path];e.linkpath&&i.push(e.linkpath),this.reservations.reserve(i,n=>this[D3](e,n))}[D3](e,i){let n=c=>{i(c)},r=()=>{this[Wt](this.cwd,this.dmode,c=>{if(c){this[X](c,e),n();return}this[Jn]=!0,o()})},o=()=>{if(e.absolute!==this.cwd){let c=z(st.dirname(String(e.absolute)));if(c!==this.cwd)return this[Wt](c,this.dmode,l=>{if(l){this[X](l,e),n();return}s()})}s()},s=()=>{j.lstat(String(e.absolute),(c,l)=>{if(l&&(this.keep||this.newer&&l.mtime>(e.mtime??l.mtime))){this[_a](e),n();return}if(c||this[Xa](e,l))return this[fe](null,e,n);if(l.isDirectory()){if(e.type==="Directory"){let v=this.chmod&&e.mode&&(l.mode&4095)!==e.mode,A=u=>this[fe](u??null,e,n);return v?j.chmod(String(e.absolute),Number(e.mode),A):A()}if(e.absolute!==this.cwd)return j.rmdir(String(e.absolute),v=>this[fe](v??null,e,n))}if(e.absolute===this.cwd)return this[fe](null,e,n);Tm(String(e.absolute),v=>this[fe](v??null,e,n))})};this[Jn]?o():r()}[fe](e,i,n){if(e){this[X](e,i),n();return}switch(i.type){case"File":case"OldFile":case"ContiguousFile":return this[Ha](i,n);case"Link":return this[T3](i,n);case"SymbolicLink":return this[w3](i,n);case"Directory":case"GNUDumpDir":return this[La](i,n)}}[jo](e,i,n,r){j[n](i,String(e.absolute),o=>{o?this[X](o,e):(this[Ji](),e.resume()),r()})}},zo=t=>{try{return[null,t()]}catch(e){return[e,null]}},Bn=class extends bi{sync=!0;[fe](e,i){return super[fe](e,i,()=>{})}[Ta](e){if(!this[Jn]){let o=this[Wt](this.cwd,this.dmode);if(o)return this[X](o,e);this[Jn]=!0}if(e.absolute!==this.cwd){let o=z(st.dirname(String(e.absolute)));if(o!==this.cwd){let s=this[Wt](o,this.dmode);if(s)return this[X](s,e)}}let[i,n]=zo(()=>j.lstatSync(String(e.absolute)));if(n&&(this.keep||this.newer&&n.mtime>(e.mtime??n.mtime)))return this[_a](e);if(i||this[Xa](e,n))return this[fe](null,e);if(n.isDirectory()){if(e.type==="Directory"){let s=this.chmod&&e.mode&&(n.mode&4095)!==e.mode,[c]=s?zo(()=>{j.chmodSync(String(e.absolute),Number(e.mode))}):[];return this[fe](c,e)}let[o]=zo(()=>j.rmdirSync(String(e.absolute)));this[fe](o,e)}let[r]=e.absolute===this.cwd?[]:zo(()=>Xm(String(e.absolute)));this[fe](r,e)}[Ha](e,i){let n=typeof e.mode=="number"?e.mode&4095:this.fmode,r=c=>{let l;try{j.closeSync(o)}catch(v){l=v}(c||l)&&this[X](c||l,e),i()},o;try{o=j.openSync(String(e.absolute),ba(e.size),n)}catch(c){return r(c)}let s=this.transform&&this.transform(e)||e;s!==e&&(s.on("error",c=>this[X](c,e)),e.pipe(s)),s.on("data",c=>{try{j.writeSync(o,c,0,c.length)}catch(l){r(l)}}),s.on("end",()=>{let c=null;if(e.mtime&&!this.noMtime){let l=e.atime||new Date,v=e.mtime;try{j.futimesSync(o,l,v)}catch(A){try{j.utimesSync(String(e.absolute),l,v)}catch{c=A}}}if(this[kn](e)){let l=this[Fn](e),v=this[Qn](e);try{j.fchownSync(o,Number(l),Number(v))}catch(A){try{j.chownSync(String(e.absolute),Number(l),Number(v))}catch{c=c||A}}}r(c)})}[La](e,i){let n=typeof e.mode=="number"?e.mode&4095:this.dmode,r=this[Wt](String(e.absolute),n);if(r){this[X](r,e),i();return}if(e.mtime&&!this.noMtime)try{j.utimesSync(String(e.absolute),e.atime||new Date,e.mtime)}catch{}if(this[kn](e))try{j.chownSync(String(e.absolute),Number(this[Fn](e)),Number(this[Qn](e)))}catch{}i(),e.resume()}[Wt](e,i){try{return B3(z(e),{uid:this.uid,gid:this.gid,processUid:this.processUid,processGid:this.processGid,umask:this.processUmask,preserve:this.preservePaths,unlink:this.unlink,cwd:this.cwd,mode:i})}catch(n){return n}}[jo](e,i,n,r){let o=`${n}Sync`;try{j[o](i,String(e.absolute)),r(),e.resume()}catch(s){return this[X](s,e)}}};var Hm=t=>{let e=new Bn(t),i=t.file,n=ev.statSync(i),r=t.maxReadSize||16*1024*1024;new Gr(i,{readSize:r,size:n.size}).pipe(e)},Lm=(t,e)=>{let i=new bi(t),n=t.maxReadSize||16*1024*1024,r=t.file;return new Promise((s,c)=>{i.on("error",c),i.on("close",s),ev.stat(r,(l,v)=>{if(l)c(l);else{let A=new Tt(r,{readSize:n,size:v.size});A.on("error",c),A.pipe(i)}})})},$a=Fe(Hm,Lm,t=>new Bn(t),t=>new bi(t),(t,e)=>{e?.length&&ga(t,e)});import se from"node:fs";import tv from"node:path";var _m=(t,e)=>{let i=new ai(t),n=!0,r,o;try{try{r=se.openSync(t.file,"r+")}catch(l){if(l?.code==="ENOENT")r=se.openSync(t.file,"w+");else throw l}let s=se.fstatSync(r),c=Buffer.alloc(512);e:for(o=0;o<s.size;o+=512){for(let A=0,u=0;A<512;A+=u){if(u=se.readSync(r,c,A,c.length-A,o+A),o===0&&c[0]===31&&c[1]===139)throw new Error("cannot append to compressed archives");if(!u)break e}let l=new ne(c);if(!l.cksumValid)break;let v=512*Math.ceil((l.size||0)/512);if(o+v+512>s.size)break;o+=v,t.mtimeCache&&l.mtime&&t.mtimeCache.set(String(l.path),l.mtime)}n=!1,$m(t,i,o,r,e)}finally{if(n)try{se.closeSync(r)}catch{}}},$m=(t,e,i,n,r)=>{let o=new Yi(t.file,{fd:n,start:i});e.pipe(o),tE(e,r)},eE=(t,e)=>{e=Array.from(e);let i=new Yt(t),n=(o,s,c)=>{let l=(E,f)=>{E?se.close(o,R=>c(E)):c(null,f)},v=0;if(s===0)return l(null,0);let A=0,u=Buffer.alloc(512),I=(E,f)=>{if(E||typeof f>"u")return l(E);if(A+=f,A<512&&f)return se.read(o,u,A,u.length-A,v+A,I);if(v===0&&u[0]===31&&u[1]===139)return l(new Error("cannot append to compressed archives"));if(A<512)return l(null,v);let R=new ne(u);if(!R.cksumValid)return l(null,v);let h=512*Math.ceil((R.size??0)/512);if(v+h+512>s||(v+=h+512,v>=s))return l(null,v);t.mtimeCache&&R.mtime&&t.mtimeCache.set(String(R.path),R.mtime),A=0,se.read(o,u,0,512,v,I)};se.read(o,u,0,512,v,I)};return new Promise((o,s)=>{i.on("error",s);let c="r+",l=(v,A)=>{if(v&&v.code==="ENOENT"&&c==="r+")return c="w+",se.open(t.file,c,l);if(v||!A)return s(v);se.fstat(A,(u,I)=>{if(u)return se.close(A,()=>s(u));n(A,I.size,(E,f)=>{if(E)return s(E);let R=new _e(t.file,{fd:A,start:f});i.pipe(R),R.on("error",s),R.on("close",o),iE(i,e)})})};se.open(t.file,c,l)})},tE=(t,e)=>{e.forEach(i=>{i.charAt(0)==="@"?oi({file:tv.resolve(t.cwd,i.slice(1)),sync:!0,noResume:!0,onReadEntry:n=>t.add(n)}):t.add(i)}),t.end()},iE=async(t,e)=>{for(let i=0;i<e.length;i++){let n=String(e[i]);n.charAt(0)==="@"?await oi({file:tv.resolve(String(t.cwd),n.slice(1)),noResume:!0,onReadEntry:r=>t.add(r)}):t.add(n)}t.end()},ci=Fe(_m,eE,()=>{throw new TypeError("file is required")},()=>{throw new TypeError("file is required")},(t,e)=>{if(!Xl(t))throw new TypeError("file is required");if(t.gzip||t.brotli||t.zstd||t.file.endsWith(".br")||t.file.endsWith(".tbr"))throw new TypeError("cannot append to compressed archives");if(!e?.length)throw new TypeError("no paths specified to add/replace")});var nE=Fe(ci.syncFile,ci.asyncFile,ci.syncNoFile,ci.asyncNoFile,(t,e=[])=>{ci.validate?.(t,e),rE(t)}),rE=t=>{let e=t.filter;t.mtimeCache||(t.mtimeCache=new Map),t.filter=e?(i,n)=>e(i,n)&&!((t.mtimeCache?.get(i)??n.mtime??0)>(n.mtime??0)):(i,n)=>!((t.mtimeCache?.get(i)??n.mtime??0)>(n.mtime??0))};async function Bi(t){let{source:e,destination:i,strip:n=1,filter:r}=t,o=[];if(!iv(e))return{success:!1,extractedFiles:[],error:`Source file not found: ${e}`};iv(i)||aE(i,{recursive:!0});try{return await cE(sE(e),lE(),$a({cwd:i,strip:n,filter:s=>r&&!r(s)?!1:(o.push(s),!0)})),{success:!0,extractedFiles:o}}catch(s){return{success:!1,extractedFiles:o,error:s instanceof Error?s.message:String(s)}}}import{existsSync as nv,readFileSync as vE,writeFileSync as AE,mkdirSync as uE}from"fs";import{dirname as mE}from"path";function Mt(t){let e=Vs(t);if(!nv(e))return null;try{let i=vE(e,"utf-8");return JSON.parse(i)}catch{return null}}function go(t,e){let i=Vs(e),n=mE(i);nv(n)||uE(n,{recursive:!0}),AE(i,JSON.stringify(t,null,2))}function rv(t,e,i){return{name:"gemkit",version:t,installedAt:new Date().toISOString(),scope:e,installedFiles:i,customizedFiles:[]}}function ov(t){return Mt(t)!==null}var p=_n(cv(),1),fE=t=>{let e=parseInt(t.slice(1,3),16),i=parseInt(t.slice(3,5),16),n=parseInt(t.slice(5,7),16);return`\x1B[38;2;${e};${i};${n}m`},Zn=t=>e=>p.default.isColorSupported?`${fE(t)}${e}\x1B[39m`:e,a={primary:Zn("#4f46e5"),secondary:Zn("#9333ea"),accent:Zn("#06b6d4"),geminiBlue:Zn("#1a73e8"),geminiPurple:Zn("#8e24aa"),success:t=>p.default.green(t),error:t=>p.default.red(t),warn:t=>p.default.yellow(t),info:t=>p.default.cyan(t),dim:t=>p.default.dim(t)},M={line:(t=60)=>"\u2500".repeat(t),doubleLine:(t=60)=>"\u2550".repeat(t),statusIcon:t=>{switch(t){case"active":return a.success("\u25CF");case"completed":return a.dim("\u25CB");case"failed":return a.error("\u2717");default:return"?"}},checkIcon:(t,e=!1)=>t?a.success("\u2713"):e?a.warn("\u25CB"):a.error("\u2717"),header:t=>p.default.bold(a.geminiPurple(t)),section:(t,e=60)=>{console.log(),console.log("\u2500".repeat(e)),console.log(p.default.bold(a.geminiPurple(t))),console.log("\u2500".repeat(e)),console.log()}};var fz={success:a.success,error:a.error,warning:a.warn,info:a.info,dim:a.dim,primary:a.primary,secondary:a.secondary,bold:p.default.bold};var lv={debug:0,info:1,warn:2,error:3,silent:4},he={level:"info",verbose:!1,json:!1};function So(t){he={...he,...t}}function Pn(t){return lv[t]>=lv[he.level]}function hE(t,e){Pn("debug")&&(he.json?console.log(JSON.stringify({level:"debug",message:t,data:e})):(console.log(a.dim(`[DEBUG] ${t}`)),e&&he.verbose&&console.log(a.dim(JSON.stringify(e,null,2)))))}function dE(t,e){Pn("info")&&(he.json?console.log(JSON.stringify({level:"info",message:t,data:e})):(console.log(`${a.info("\u2139")} ${t}`),e&&he.verbose&&console.log(JSON.stringify(e,null,2))))}function RE(t,e){Pn("info")&&(he.json?console.log(JSON.stringify({level:"success",message:t,data:e})):console.log(`${a.success("\u2713")} ${t}`))}function zE(t,e){Pn("warn")&&(he.json?console.log(JSON.stringify({level:"warn",message:t,data:e})):console.log(`${a.warn("\u26A0")} ${t}`))}function jE(t,e){Pn("error")&&(he.json?console.error(JSON.stringify({level:"error",message:t,data:e})):(console.error(`${a.error("\u2717")} ${t}`),e&&he.verbose&&console.error(JSON.stringify(e,null,2))))}function gE(t){he.json?console.log(JSON.stringify(t)):console.table(t)}function xE(t){console.log(JSON.stringify(t,null,2))}var m={debug:hE,info:dE,success:RE,warn:zE,error:jE,table:gE,json:xE,configure:So};import{spawnSync as ME}from"child_process";var GE="https://registry.npmjs.org",SE="npm-version",YE=3600;async function qn(t){let e=`${SE}-${t}`,i=mr(e);if(i)return i;try{let n=await fetch(`${GE}/${t}/latest`,{headers:{Accept:"application/json","User-Agent":"gemkit-cli"}});if(!n.ok)return null;let r=await n.json(),o={name:r.name,version:r.version,description:r.description,publishedAt:r.time?.[r.version]};return Er(e,o,YE),o}catch{return null}}function WE(t,e){let i=t.replace(/^v/,"").split(".").map(Number),n=e.replace(/^v/,"").split(".").map(Number);for(let r=0;r<Math.max(i.length,n.length);r++){let o=i[r]||0,s=n[r]||0;if(o>s)return 1;if(o<s)return-1}return 0}function Zi(t,e){return WE(e,t)>0}import{readFileSync as CE}from"fs";import{join as vv,dirname as OE}from"path";import{fileURLToPath as UE}from"url";var yn="gemkit-cli";function KE(){try{let t=UE(import.meta.url),e=OE(t),i=[vv(e,"..","package.json"),vv(e,"..","..","..","package.json")];for(let n of i)try{let r=JSON.parse(CE(n,"utf-8"));if(r.name===yn&&r.version)return r.version}catch{}}catch{}return"0.0.0"}var de=KE();function Av(t){t.command("update","Update GemKit CLI and/or Kits to latest version").option("-f, --force","Force update even if already up to date").option("--no-backup","Disable backup before kits update").option("--cli","Update CLI only (npm package)").option("--kits","Update Kits only (.gemini folder)").action(async e=>{let i=e.cli===!0||!e.cli&&!e.kits,n=e.kits===!0||!e.cli&&!e.kits,r=!1,o=!1;i&&(r=await VE(e.force)),n&&(o=await NE(e.force)),console.log(),r||o?m.success("Update complete!"):m.info("Everything is up to date.")})}async function VE(t){console.log(),m.info(`${a.primary("CLI")} Checking for updates...`);let e=await qn(yn);if(!e)return m.warn("Failed to check npm registry for CLI updates."),!1;let i=de,n=e.version;return!Zi(i,n)&&!t?(m.success(`CLI is up to date (v${i})`),!1):(m.info(`Updating CLI: v${i} \u2192 v${n}`),ME("npm",["install","-g",`${yn}@latest`],{encoding:"utf-8",stdio:"inherit",shell:!0}).status!==0?(m.error("CLI update failed. Try running manually:"),m.info(` npm install -g ${yn}@latest`),!1):(m.success(`CLI updated to v${n}`),!0))}async function NE(t){console.log(),m.info(`${a.primary("Kits")} Checking for updates...`);let e=Mt();if(!e)return m.warn('GemKit not initialized. Run "gk init" first to install kits.'),!1;let i=await qt();if(!i)return m.warn("Failed to check GitHub for kits updates."),!1;if(i.version===e.version&&!t)return m.success(`Kits are up to date (v${e.version})`),!1;m.info(`Updating Kits: v${e.version} \u2192 v${i.version}`);let n=await Ri(i),r=Ar(),o=await Bi({source:n,destination:r,strip:1});if(!o.success)return m.error(`Kits update failed: ${o.error}`),!1;let s={...e,version:i.version,installedAt:new Date().toISOString(),installedFiles:o.extractedFiles};return go(s),m.success(`Kits updated to v${i.version}`),!0}async function uv(){let t={cli:null,kits:null};try{let e=await qn(yn);e&&(t.cli={current:de,latest:e.version,available:Zi(de,e.version)})}catch{}try{let e=Mt(),i=await qt();e&&i&&(t.kits={current:e.version,latest:i.version,available:Zi(e.version,i.version)})}catch{}return t}var mv="gemkit-cli";function bE(t){return JE("npm",["install","-g",`${mv}@${t}`],{encoding:"utf-8",stdio:"pipe",shell:!0}).status===0}function BE(t){switch(t){case"gemini":return[".claude",".claude/**",".agent",".agent/**"];case"claude":return[".agent",".agent/**"];case"antigravity":return[".claude",".claude/**"];default:return[]}}function ZE(t){switch(t){case"gemini":return"Gemini CLI (excludes .claude, .agent)";case"claude":return"Claude Code (excludes .agent)";case"antigravity":return"Antigravity (excludes .claude)";default:return"Full (all files)"}}function PE(t,e){let i=t.replace(/\\/g,"/");for(let n of e)if(n.includes("*")){if(n.endsWith("/**")){let r=n.slice(0,-3);if(i.startsWith(r+"/"))return!0}}else if(i===n||i.startsWith(n+"/"))return!0;return!1}function qE(t){if(t.length!==0)return e=>!PE(e,t)}async function yE(){let t=FE(".gemini","extensions","spawn-agent");return kE(t)?new Promise(e=>{let i=QE("gemini",["extensions","install",t],{stdio:["pipe","pipe","pipe"],shell:process.platform==="win32",cwd:process.cwd()}),n="",r="",o=!1,s=setTimeout(()=>{o||(o=!0,i.kill(),e({success:!1,error:"Extension installation timed out"}))},3e4);i.stdout?.on("data",c=>{n+=c.toString()}),i.stderr?.on("data",c=>{r+=c.toString()}),i.on("close",c=>{o||(o=!0,clearTimeout(s),e(c===0?{success:!0}:{success:!1,error:r||n||`Exit code: ${c}`}))}),i.on("error",c=>{o||(o=!0,clearTimeout(s),e({success:!1,error:`Failed to run gemini CLI: ${c.message}`}))})}):{success:!1,error:`Extension directory not found: ${t}`}}function Ev(t){t.command("init","Initialize GemKit in project").option("--version <ver>","Specific version to install").option("-f, --force","Overwrite existing installation").option("--exclude <patterns...>","File patterns to exclude").option("--skip-extension","Skip spawn-agent extension installation").option("--full","Install all files (default)").option("--gemini","Gemini CLI mode (excludes .claude, .agent folders)").option("--claude","Claude Code mode (excludes .agent folder)").option("--antigravity","Antigravity mode (excludes .claude folder)").action(async e=>{let i="full";if(e.gemini?i="gemini":e.claude?i="claude":e.antigravity?i="antigravity":e.full&&(i="full"),ov()&&!e.force){console.log(),m.warn("GemKit is already installed. Use --force to reinstall."),console.log();return}console.log(),console.log(p.default.bold(a.geminiPurple("Initializing GemKit"))),console.log(),console.log(` ${a.dim("Mode")} ${a.accent(ZE(i))}`),console.log();let n=Ke({text:"Checking CLI version...",color:"magenta"}).start();try{let f=await qn(mv);f&&Zi(de,f.version)?(n.text=`Updating CLI v${de} \u2192 v${f.version}...`,bE(f.version)?n.succeed(`CLI updated v${a.primary(de)} \u2192 v${a.primary(f.version)}`):n.warn(`CLI v${a.primary(de)} (update to v${f.version} failed)`)):n.succeed(`CLI v${a.primary(de)}`)}catch{n.succeed(`CLI v${a.primary(de)}`)}let r=Ke({text:"Fetching latest Kits release...",color:"magenta"}).start(),o=e.version?await Jl(e.version):await qt();o||(r.fail("No Kits release found"),console.log(),process.exit(1)),r.succeed(`Found Kits v${a.primary(o.version)}`);let s=Ke({text:"Downloading Kits...",color:"magenta"}).start(),c;try{c=await Ri(o),s.succeed("Kits downloaded")}catch(f){s.fail(`Kits download failed: ${f instanceof Error?f.message:String(f)}`),console.log(),process.exit(1)}let l=BE(i),v=Ke({text:i==="full"?"Extracting Kits...":`Extracting Kits (${i} mode)...`,color:"magenta"}).start(),A=process.cwd(),u=await Bi({source:c,destination:A,strip:1,filter:qE(l)});u.success||(v.fail(`Kits extraction failed: ${u.error}`),console.log(),process.exit(1)),v.succeed(`Extracted ${u.extractedFiles.length} files`);let I=rv(o.version,"local",u.extractedFiles);if(go(I),console.log(),m.success(`Kits v${a.primary(o.version)} installed successfully!`),!e.skipExtension&&(i==="full"||i==="gemini")){console.log();let f=Ke({text:"Installing spawn-agent extension...",color:"magenta"}).start(),R=await yE();R.success?f.succeed("spawn-agent extension installed in Gemini CLI"):(f.warn(`Could not install spawn-agent extension: ${R.error}`),m.info(`You can manually install it with: ${a.primary("gemini extensions install .gemini/extensions/spawn-agent")}`))}else(i==="claude"||i==="antigravity")&&(console.log(),m.info(`Skipped Gemini extension (${i} mode).`));console.log(),m.info(`Run ${a.primary("gk doctor")} to verify installation.`),console.log()})}function Iv(t){t.command("versions","List available GemKit versions").alias("v").option("--json","Output as JSON").action(async e=>{let i=Mt(),n=await Ir();if(e.json){console.log(JSON.stringify({current:i?.version||null,available:n},null,2));return}console.log(),console.log(p.default.bold(a.geminiPurple("GemKit Versions"))),console.log(),console.log(i?` ${a.dim("Current:")} ${a.success(i.version)}`:` ${a.dim("Current:")} ${a.dim("Not installed")}`),console.log(),console.log(` ${p.default.bold("Available Releases:")}`);for(let r of n){let o=r.version===i?.version?a.success(" (current)"):"";console.log(` - ${a.primary(r.version)}${o}`)}console.log()})}import{existsSync as Yo}from"fs";import{join as DE}from"path";import{spawn as pv}from"child_process";async function wE(){return new Promise(t=>{let e=pv("gemini",["extensions","list"],{stdio:["pipe","pipe","pipe"],shell:process.platform==="win32"}),i="",n="",r=!1,o=setTimeout(()=>{r||(r=!0,e.kill(),t({installed:!1,error:"Check timed out"}))},2e4);e.stdout?.on("data",s=>{i+=s.toString()}),e.stderr?.on("data",s=>{n+=s.toString()}),e.on("close",s=>{if(!r)if(r=!0,clearTimeout(o),s===0){let c=i.toLowerCase().includes("spawn-agent");t({installed:c})}else t({installed:!1,error:n||"Failed to check extensions"})}),e.on("error",s=>{r||(r=!0,clearTimeout(o),t({installed:!1,error:`Gemini CLI not available: ${s.message}`}))})})}async function TE(){return new Promise(t=>{let e=pv("gemini",["--version"],{stdio:["pipe","pipe","pipe"],shell:process.platform==="win32"}),i="",n=!1,r=setTimeout(()=>{n||(n=!0,e.kill(),t({available:!1,error:"Timed out"}))},15e3);e.stdout?.on("data",o=>{i+=o.toString()}),e.on("close",o=>{if(!n)if(n=!0,clearTimeout(r),o===0){let s=i.trim().split(`
20
+ `)[0]||"unknown";t({available:!0,version:s})}else t({available:!1,error:"Command failed"})}),e.on("error",o=>{n||(n=!0,clearTimeout(r),t({available:!1,error:o.message}))})})}function fv(t){t.command("doctor","Check installation health").option("--fix","Attempt to fix issues").action(async e=>{console.log(),console.log(p.default.bold(a.geminiPurple("GemKit Health Check"))),console.log();let i=0,n=0,r=[],o=process.version;parseInt(o.slice(1).split(".")[0],10)>=18?r.push({icon:a.success("\u2713"),message:`Node.js ${o}`}):(r.push({icon:a.error("\u2717"),message:`Node.js ${o} ${a.error("(requires >= 18)")}`}),i++);let c=Ke({text:"Checking Gemini CLI...",color:"magenta"}).start(),l=await TE();c.stop(),l.available?r.push({icon:a.success("\u2713"),message:`Gemini CLI ${a.dim(`(${l.version})`)}`}):(r.push({icon:a.error("\u2717"),message:`Gemini CLI not found ${a.dim(`(${l.error})`)}`}),i++);let v=Ar();Yo(v)?r.push({icon:a.success("\u2713"),message:".gemini directory exists"}):(r.push({icon:a.error("\u2717"),message:".gemini directory missing"}),i++);let A=nn();Yo(A)?r.push({icon:a.success("\u2713"),message:"Agents directory exists"}):(r.push({icon:a.warn("\u25CB"),message:"Agents directory missing"}),n++);let u=Bt();Yo(u)?r.push({icon:a.success("\u2713"),message:"Extensions directory exists"}):(r.push({icon:a.warn("\u25CB"),message:"Extensions directory missing"}),n++);let I=DE(u,"spawn-agent");if(Yo(I)?r.push({icon:a.success("\u2713"),message:"spawn-agent extension files present"}):(r.push({icon:a.warn("\u25CB"),message:"spawn-agent extension files missing"}),n++),l.available){let f=Ke({text:"Checking spawn-agent extension...",color:"magenta"}).start(),R=await wE();f.stop(),R.installed?r.push({icon:a.success("\u2713"),message:"spawn-agent extension installed in Gemini"}):(r.push({icon:a.error("\u2717"),message:"spawn-agent extension NOT installed in Gemini",hint:R.error?`${R.error}
21
+ Run: gemini extensions install .gemini/extensions/spawn-agent`:"Run: gemini extensions install .gemini/extensions/spawn-agent"}),i++)}let E=Mt();E?r.push({icon:a.success("\u2713"),message:`Installation metadata ${a.primary(`(v${E.version})`)}`}):(r.push({icon:a.warn("\u25CB"),message:"Installation metadata missing"}),n++);for(let f of r)if(console.log(` ${f.icon} ${f.message}`),f.hint)for(let R of f.hint.split(`
22
+ `))console.log(` ${a.dim(R)}`);console.log(),i===0&&n===0?console.log(a.success("All checks passed!")):i===0?console.log(a.success(`All critical checks passed! ${a.dim(`(${n} warning${n>1?"s":""})`)}`)):(console.log(a.error(`${i} issue(s) found.`)),n>0&&console.log(a.warn(`${n} warning(s).`)),console.log(),console.log("To fix issues:"),console.log(` ${a.dim("1.")} Run ${a.primary("gk init")} to install GemKit`),console.log(` ${a.dim("2.")} Run ${a.primary("gemini extensions install .gemini/extensions/spawn-agent")} to install extension`)),console.log()})}function XE(){console.log(),console.log(p.default.bold(a.geminiPurple("Configuration Management"))),console.log(),console.log("Usage:"),console.log(` ${a.primary("gk config")} <subcommand> [options]`),console.log(),console.log("Subcommands:"),console.log(` ${a.primary("list")} Show all config (default)`),console.log(` ${a.primary("get")} <key> Get config value`),console.log(` ${a.primary("set")} <key> <val> Set config value`),console.log(` ${a.primary("reset")} Reset to defaults`),console.log(),console.log("Options:"),console.log(` ${a.dim("--json")} [list] Output as JSON`),console.log(),console.log("Examples:"),console.log(` ${a.dim("gk config list")}`),console.log(` ${a.dim("gk config get spawn.defaultModel")}`),console.log(` ${a.dim("gk config set spawn.music true")}`),console.log(` ${a.dim("gk config reset")}`),console.log()}function hv(t){t.command("config [subcommand] [key] [value]","Configuration management (list, get, set, reset)").alias("c").option("--json","[list] Output as JSON").action(async(e,i,n,r)=>{switch(e||"list"){case"list":await HE(r);break;case"get":i||(console.log(),m.error("Config key required"),console.log(a.dim("Usage: gk config get <key>")),console.log(),process.exit(1)),await LE(i);break;case"set":(!i||n===void 0)&&(console.log(),m.error("Config key and value required"),console.log(a.dim("Usage: gk config set <key> <value>")),console.log(),process.exit(1)),await _E(i,n);break;case"reset":await $E();break;default:XE()}})}async function HE(t){let e=Ve();if(t.json){console.log(JSON.stringify(e,null,2));return}console.log(),console.log(p.default.bold(a.geminiPurple("GemKit Configuration"))),console.log(),console.log(JSON.stringify(e,null,2)),console.log()}async function LE(t){let e=Ml(t);if(e===void 0){console.log(),m.error(`Config key not found: ${t}`),console.log();return}console.log(e)}async function _E(t,e){let i=e;e==="true"?i=!0:e==="false"?i=!1:isNaN(Number(e))||(i=Number(e));try{Cl(t,i),console.log(),m.success(`Config updated: ${a.primary(t)} = ${a.success(String(i))}`),console.log()}catch(n){console.log(),m.error(`Failed to set config: ${n instanceof Error?n.message:String(n)}`),console.log()}}async function $E(){Ol(),console.log(),m.success("Configuration reset to defaults."),console.log()}function dv(t){let e=t.command("cache <subcommand>","Cache management");e.example("gk cache stats # Show cache statistics"),e.example("gk cache clear # Clear all cache"),e.action(async i=>{let n=i||"stats";switch(n){case"stats":await eI();break;case"clear":await tI();break;default:console.log(),m.error(`Unknown subcommand: ${n}`),console.log(),process.exit(1)}})}async function eI(){let t=Fl();console.log(),console.log(p.default.bold(a.geminiPurple("Cache Statistics"))),console.log(),console.log(` ${a.dim("Entries:")} ${a.primary(String(t.entries))}`),console.log(` ${a.dim("Size:")} ${a.primary((t.size/1024).toFixed(2))} KB`),console.log()}async function tI(){let t=kl();console.log(),m.success(`Cleared ${a.success(String(t))} cache entries.`),console.log()}import{existsSync as iI}from"fs";import{join as nI}from"path";function Rv(t){t.command("new <name>","Create a new project from starter kit").action(async e=>{let i=nI(process.cwd(),e);iI(i)&&(console.log(),m.error(`Directory already exists: ${e}`),console.log(),process.exit(1)),console.log(),console.log(p.default.bold(a.geminiPurple("Creating New Project"))),console.log(),m.info(`Name: ${a.primary(e)}`);let n=await qt();n||(m.error("Failed to fetch latest starter kit."),console.log(),process.exit(1)),m.info(`Fetching latest starter kit (v${n.version})...`);let r=await Ri(n),o=await Bi({source:r,destination:i,strip:1});o.success?(console.log(),m.success(`Project ${a.primary(e)} created successfully!`),console.log(`
23
23
  Next steps:
24
- cd ${s.primary(e)}
24
+ cd ${a.primary(e)}
25
25
  gk init
26
- `)):(u.error(`Failed to create project: ${o.error}`),console.log())})}import{spawn as rI}from"child_process";import{access as oI,stat as aI,readdir as sI,readFile as Cv}from"fs/promises";import{join as Qi,basename as cI,extname as lI,relative as vI}from"path";import{existsSync as Ps,readFileSync as GE,readdirSync as SE}from"fs";import{join as sv,basename as YE}from"path";function qs(t,e){let i=Hi(e),n=sv(i,`${t}.md`);return Ps(n)?cv(n):null}function fo(t){let e=Hi(t);if(!Ps(e))return[];let i=SE(e).filter(r=>r.endsWith(".md")),n=[];for(let r of i){let o=sv(e,r),a=cv(o);a&&n.push(a)}return n}function WE(t){let e=t.match(/^---\r?\n([\s\S]*?)\r?\n---/);if(!e)return null;let i={};for(let n of e[1].split(/\r?\n/)){let r=n.indexOf(":");if(r===-1)continue;let o=n.slice(0,r).trim(),a=n.slice(r+1).trim();(a.startsWith('"')&&a.endsWith('"')||a.startsWith("'")&&a.endsWith("'"))&&(a=a.slice(1,-1)),i[o]=a}return i}function av(t){if(!t)return[];let e=t.trim();return e.startsWith("[")&&e.endsWith("]")&&(e=e.slice(1,-1)),e.split(",").map(i=>i.trim().replace(/['"]/g,"")).filter(Boolean)}function cv(t){if(!Ps(t))return null;let e=GE(t,"utf-8"),i=YE(t,".md"),n="",r="gemini-2.5-flash",o=[],a=WE(e),c=e;if(a)a.description&&(n=a.description),a.model&&(r=a.model),o=av(a.skills),c=e.replace(/^---\r?\n[\s\S]*?\r?\n---\r?\n?/,"").trim();else{let l=e.split(`
27
- `);for(let m of l){if(m.startsWith("# ")){n=m.substring(2).trim();break}if(m.trim()&&!m.startsWith("#")){n=m.trim();break}}let v=e.match(/model:\s*(.+)/i);v&&(r=v[1].trim());let A=e.match(/skills:\s*(.+)/i);A&&(o=av(A[1]))}return{name:i,description:n,model:r,skills:o,content:c,filePath:t}}import{existsSync as ni,readFileSync as ws,readdirSync as ME}from"fs";import{join as Qn}from"path";var Ts=".gemini/extensions/spawn-agent/data",lv=3,vv={combination:{file:"combinations.csv",searchCols:["keywords","description","use_when","agent","skills","intent","domain"],outputCols:["id","agent","skills","intent","domain","complexity","description","use_when"]},intent:{file:"intents.csv",searchCols:["primary_keywords","expanded_keywords","question_patterns"],outputCols:["intent","agent","primary_keywords","expanded_keywords","action_verbs"]},domain:{file:"domains.csv",searchCols:["keywords","frameworks","file_patterns","technical_terms"],outputCols:["domain","base_skills","enhanced_skills","keywords","frameworks"]},synonym:{file:"synonyms.csv",searchCols:["word","synonyms"],outputCols:["word","synonyms","category"]}},CE={simple:["quick","simple","basic","small","minor","trivial","easy","straightforward"],standard:[],full:["comprehensive","full","complete","entire","thorough","detailed"],complex:["deep","extensive","advanced","complex","sophisticated","enterprise","production"]};var Ds={research:"researcher",plan:"planner",execute:"code-executor",debug:"debugger",review:"code-reviewer",test:"tester",design:"ui-ux-designer",docs:"docs-manager",git:"git-manager",manage:"project-manager"},OE={frontend:["frontend-design"],backend:["backend-development"],auth:["better-auth","backend-development"],payment:["payment-integration"],database:["databases"],mobile:["mobile-development"],fullstack:["web-frameworks","backend-development"],ecommerce:["shopify"],media:["ai-multimodal"],ai:["ai-multimodal"],quality:["code-review"],codebase:["repomix"],general:["research"]},zo=class{k1;b;corpus=[];docLengths=[];avgdl=0;idf=new Map;docFreqs=new Map;N=0;constructor(e=1.5,i=.75){this.k1=e,this.b=i}tokenize(e){return String(e).toLowerCase().replace(/[^\w\s]/g," ").split(/\s+/).filter(n=>n.length>1)}fit(e){if(this.corpus=e.map(i=>this.tokenize(i)),this.N=this.corpus.length,this.N!==0){this.docLengths=this.corpus.map(i=>i.length),this.avgdl=this.docLengths.reduce((i,n)=>i+n,0)/this.N;for(let i of this.corpus){let n=new Set;for(let r of i)n.has(r)||(this.docFreqs.set(r,(this.docFreqs.get(r)||0)+1),n.add(r))}for(let[i,n]of this.docFreqs.entries())this.idf.set(i,Math.log((this.N-n+.5)/(n+.5)+1))}}score(e){let i=this.tokenize(e),n=[];for(let r=0;r<this.corpus.length;r++){let o=this.corpus[r],a=0,c=this.docLengths[r],l=new Map;for(let v of o)l.set(v,(l.get(v)||0)+1);for(let v of i){let A=this.idf.get(v);if(A!==void 0){let m=l.get(v)||0,I=m*(this.k1+1),E=m+this.k1*(1-this.b+this.b*c/this.avgdl);a+=A*I/E}}n.push([r,a])}return n.sort((r,o)=>o[1]-r[1])}};function UE(t){let e=[],i="",n=!1;for(let r=0;r<t.length;r++){let o=t[r];o==='"'?n=!n:o===","&&!n?(e.push(i),i=""):i+=o}return e.push(i),e}function Xs(t){if(!ni(t))return[];let i=ws(t,"utf-8").trim().split(`
28
- `);if(i.length<2)return[];let n=i[0].split(",").map(o=>o.trim()),r=[];for(let o=1;o<i.length;o++){let a=UE(i[o]),c={};n.forEach((l,v)=>{c[l]=a[v]?.trim()||""}),r.push(c)}return r}function KE(t,e,i,n,r){if(!ni(t))return[];let o=Xs(t),a=o.map(A=>e.map(m=>String(A[m]||"")).join(" ")),c=new zo;c.fit(a);let l=c.score(n),v=[];for(let[A,m]of l.slice(0,r))if(m>0){let I=o[A],E={};for(let h of i)h in I&&(E[h]=I[h]);E._score=Math.round(m*1e4)/1e4,v.push(E)}return v}function Hs(){let t=Qn(Ts,"synonyms.csv");if(!ni(t))return new Map;let e=Xs(t),i=new Map;for(let n of e){let r=(n.word||"").toLowerCase().trim(),o=(n.synonyms||"").toLowerCase().trim();r&&o&&i.set(r,o.split(",").map(a=>a.trim()))}return i}function Av(t,e){e||(e=Hs());let i=t.toLowerCase().replace(/[^\w\s]/g," ").split(/\s+/),n=new Set(i);for(let r of i){let o=e.get(r);o&&o.forEach(a=>n.add(a))}return Array.from(n).join(" ")}function Ls(t){let e=t.toLowerCase();for(let[i,n]of Object.entries(CE))for(let r of n)if(e.includes(r))return i;return"standard"}function _s(t){let e=t.toLowerCase(),n=e.split(/\s+/)[0]||"",r=[[/system architecture/,"plan"],[/design.*architecture/,"plan"],[/architect.*system/,"plan"],[/create.*roadmap/,"plan"],[/build.*roadmap/,"plan"],[/create.*strategy/,"plan"],[/stunning/,"design"],[/gorgeous/,"design"],[/beautiful.*ui/,"design"],[/beautiful.*component/,"design"],[/beautiful.*page/,"design"],[/write.*documentation/,"docs"],[/write.*docs/,"docs"],[/create.*documentation/,"docs"],[/research.*codebase/,"research"],[/deep research/,"research"]];for(let[v,A]of r)if(typeof v=="string"?e.includes(v):v.test(e))return A;let o={implement:"execute",build:"execute",create:"execute",add:"execute",make:"execute",code:"execute",develop:"execute",write:"execute",setup:"execute",configure:"execute",test:"test",verify:"test",validate:"test",debug:"debug",fix:"debug",troubleshoot:"debug",review:"review",audit:"review",document:"docs",plan:"plan",design:"design",research:"research",analyze:"research",investigate:"research"};if(n in o)return o[n];let a=[["best practices","research"],["how does","research"],["how do","research"],["what is","research"],["why is","research"],["compare","research"],["investigate","research"],["research","research"],["understand","research"],["system architecture","plan"],["implementation plan","plan"],["roadmap","plan"],["strategy for","plan"],["blueprint","plan"],["fix the","debug"],["debug the","debug"],["not working","debug"],["is broken","debug"],["error in","debug"],["fix bug","debug"],["test the","test"],["run tests","test"],["verify the","test"],["review the","review"],["audit the","review"],["check code","review"],["document the","docs"],["write docs","docs"],["api documentation","docs"]];for(let[v,A]of a)if(e.includes(v))return A;let c={debug:["fix","debug","troubleshoot","error","issue","bug","broken","failing","crash"],review:["review","audit","assess","check code","pr review","security audit"],test:["test","verify","validate","qa","coverage","unit test","e2e test"],design:["beautiful","stunning","gorgeous","ui design","ux design","mockup","layout"],docs:["document","documentation","readme","api docs","technical writing"],git:["commit","push","pull","merge","branch","git","stage"],manage:["status","progress","track","milestone","sprint"],plan:["plan","architect","roadmap","strategy","architecture design"],execute:["implement","build","create","add","make","code","develop"],research:["research","investigate","explore","study","analyze","examine","learn"]},l={};for(let[v,A]of Object.entries(c)){let m=A.filter(I=>e.includes(I)).length;m>0&&(l[v]=m)}return Object.keys(l).length>0?Object.entries(l).sort((v,A)=>A[1]-v[1])[0][0]:"execute"}function $s(t){let e=t.toLowerCase(),i=[["flutter","mobile"],["react native","mobile"],["swift","mobile"],["kotlin","mobile"],["ios app","mobile"],["android app","mobile"],["next.js","fullstack"],["nextjs","fullstack"],["nuxt","fullstack"],["sveltekit","fullstack"],["remix","fullstack"],["server component","fullstack"],["openai","ai"],["anthropic","ai"],["claude","ai"],["langchain","ai"],["llm","ai"],["chatbot","ai"],["rag","ai"],["embedding","ai"],["gpt","ai"],["angular","frontend"],["react","frontend"],["vue","frontend"],["svelte","frontend"],["tailwind","frontend"],["nestjs","backend"],["express","backend"],["fastify","backend"],["hono","backend"],["fastapi","backend"],["websocket","backend"],["shopify","ecommerce"],["product catalog","ecommerce"],["checkout flow","ecommerce"],["stripe","payment"],["paypal","payment"],["subscription","payment"],["billing","payment"],["oauth","auth"],["authentication","auth"],["login","auth"],["signup","auth"],["prisma","database"],["drizzle","database"],["postgresql","database"],["mongodb","database"],["mysql","database"],["pdf","media"],["image","media"],["video","media"],["audio","media"],["codebase","codebase"],["repository","codebase"]];for(let[o,a]of i)if(e.includes(o))return a;let n={auth:["login","signup","authentication","oauth","jwt","session","password","2fa"],payment:["payment","checkout","billing","stripe","subscription","invoice","cart"],database:["database","sql","query","migration","schema","prisma","postgresql"],frontend:["ui","component","react","vue","css","tailwind","button","form","modal"],backend:["api","endpoint","server","service","route","rest","graphql","middleware"],mobile:["mobile","ios","android","react native","flutter","app","native"],fullstack:["fullstack","nextjs","next.js","nuxt","sveltekit","app router"],ecommerce:["ecommerce","shopify","store","product","cart","checkout","order"],media:["image","video","audio","media","upload","file","ocr"],ai:["ai","llm","gpt","claude","machine learning","embedding","vector","openai"],quality:["code review","lint","test","coverage","quality","refactor"],codebase:["codebase","repository","repo","project structure"],general:[]},r={};for(let[o,a]of Object.entries(n)){let c=a.filter(l=>e.includes(l)).length;c>0&&(r[o]=c)}return Object.keys(r).length>0?Object.entries(r).sort((o,a)=>a[1]-o[1])[0][0]:"general"}function mv(t,e=lv,i=!0){let n=vv.combination,r=Qn(Ts,n.file),o=t;if(i){let c=Hs();o=Av(t,c)}let a=KE(r,n.searchCols,n.outputCols,o,e);return{query:t,expandedQuery:i?o:void 0,detectedIntent:_s(t),detectedDomain:$s(t),detectedComplexity:Ls(t),count:a.length,results:a}}function ys(t,e,i,n=lv,r=!0){let o=vv.combination,a=Qn(Ts,o.file);if(!ni(a))return{results:[],count:0};let c=Xs(a);if(e&&(c=c.filter(E=>(E.intent||"").toLowerCase()===e.toLowerCase())),i&&(c=c.filter(E=>(E.domain||"").toLowerCase()===i.toLowerCase())),c.length===0)return{results:[],count:0};let l=t;if(r){let E=Hs();l=Av(t,E)}let v=c.map(E=>o.searchCols.map(h=>String(E[h]||"")).join(" ")),A=new zo;A.fit(v);let m=A.score(l),I=[];for(let[E,h]of m.slice(0,n))if(h>0){let d=c[E],f={};for(let H of o.outputCols)H in d&&(f[H]=d[H]);f._score=Math.round(h*1e4)/1e4,I.push(f)}return{results:I,count:I.length}}function VE(t){let e=_s(t),i=$s(t),n=Ls(t);if(["debug","review","test","design","docs","research","plan"].includes(e)){let A=ys(t,e,void 0,1,!0);if(A.results.length>0){let m=A.results[0],E=(m.skills||"").split("|").map(h=>h.trim()).filter(Boolean);return{agent:Ds[e]||m.agent||"code-executor",skills:E,intent:e,domain:m.domain||i,complexity:m.complexity||n,score:m._score||0,fallback:!1,description:m.description||"",useWhen:m.use_when||""}}}if(e==="execute"&&["mobile","ai","payment","ecommerce","media","auth","database","fullstack"].includes(i)){let A=ys(t,"execute",i,1,!0);if(A.results.length>0){let m=A.results[0];return{agent:"code-executor",skills:(m.skills||"").split("|").map(h=>h.trim()).filter(Boolean),intent:e,domain:i,complexity:m.complexity||n,score:m._score||0,fallback:!1,description:m.description||"",useWhen:m.use_when||""}}}let a=mv(t,1,!0);if(a.count===0){let A=Ds[e]||"code-executor",m=OE[i]||["research"];return{agent:A,skills:m,intent:e,domain:i,complexity:n,score:0,fallback:!0,description:`Fallback combination based on detected intent (${e}) and domain (${i})`}}let c=a.results[0],v=(c.skills||"").split("|").map(A=>A.trim()).filter(Boolean);return{agent:c.agent||"code-executor",skills:v,intent:c.intent||e,domain:c.domain||i,complexity:c.complexity||n,score:c._score||0,fallback:!1,description:c.description||"",useWhen:c.use_when||""}}function uv(t,e){let{top:i=5,forceIntent:n,forceDomain:r,maxSkills:o}=e||{};if(n||r)return ys(t,n,r,i,!0).results.map(l=>{let A=(l.skills||"").split("|").map(m=>m.trim()).filter(Boolean);return o&&(A=A.slice(0,o)),{agent:n?Ds[n]:l.agent||"code-executor",skills:A,intent:l.intent||n||_s(t),domain:l.domain||r||$s(t),complexity:l.complexity||Ls(t),score:l._score||0,fallback:!1,description:l.description||"",useWhen:l.use_when||""}});let a=mv(t,i,!0);return a.count===0?[VE(t)]:a.results.map(c=>{let v=(c.skills||"").split("|").map(A=>A.trim()).filter(Boolean);return o&&(v=v.slice(0,o)),{agent:c.agent||"code-executor",skills:v,intent:c.intent||a.detectedIntent,domain:c.domain||a.detectedDomain,complexity:c.complexity||a.detectedComplexity,score:c._score||0,fallback:!1,description:c.description||"",useWhen:c.use_when||""}})}function Ev(t){let e=Nt(t),i=[];if(!ni(e))return i;let n=ME(e,{withFileTypes:!0}).filter(r=>r.isDirectory()).map(r=>r.name);for(let r of n){let o=Qn(e,r,"SKILL.md");if(ni(o)){let a=ws(o,"utf-8");i.push({name:r,path:o,content:a})}}return i}function Iv(t,e){let i=Nt(e),n=Qn(i,t,"SKILL.md");return ni(n)?ws(n,"utf-8"):null}import{existsSync as NE,readFileSync as kE}from"fs";function N(t=process.cwd()){let e={ACTIVE_GK_SESSION_ID:"",GK_PROJECT_HASH:"",PROJECT_DIR:"",ACTIVE_GEMINI_SESSION_ID:"",GEMINI_PROJECT_HASH:"",GEMINI_PARENT_ID:"",ACTIVE_PLAN:"",SUGGESTED_PLAN:"",PLAN_DATE_FORMAT:""},i=Vt(t);if(!NE(i))return e;try{let n=kE(i,"utf-8"),r=n.match(/^ACTIVE_GK_SESSION_ID=(.*)$/m);r&&(e.ACTIVE_GK_SESSION_ID=r[1].trim());let o=n.match(/^GK_PROJECT_HASH=(.*)$/m);o&&(e.GK_PROJECT_HASH=o[1].trim());let a=n.match(/^PROJECT_DIR=(.*)$/m);a&&(e.PROJECT_DIR=a[1].trim());let c=n.match(/^ACTIVE_GEMINI_SESSION_ID=(.*)$/m);c&&(e.ACTIVE_GEMINI_SESSION_ID=c[1].trim());let l=n.match(/^GEMINI_PROJECT_HASH=(.*)$/m);l&&(e.GEMINI_PROJECT_HASH=l[1].trim());let v=n.match(/^GEMINI_PARENT_ID=(.*)$/m);v&&(e.GEMINI_PARENT_ID=v[1].trim());let A=n.match(/^ACTIVE_PLAN=(.*)$/m);A&&(e.ACTIVE_PLAN=A[1].trim());let m=n.match(/^SUGGESTED_PLAN=(.*)$/m);m&&(e.SUGGESTED_PLAN=m[1].trim());let I=n.match(/^PLAN_DATE_FORMAT=(.*)$/m);I&&(e.PLAN_DATE_FORMAT=I[1].trim())}catch{}return e}function ri(t=process.cwd()){return N(t).ACTIVE_GK_SESSION_ID||void 0}function it(t=process.cwd()){let e=N(t);return e.PROJECT_DIR?e.PROJECT_DIR:Li(t)}function Ro(t=process.cwd()){return N(t).GEMINI_PROJECT_HASH||void 0}function Jn(t=process.cwd()){return N(t).ACTIVE_PLAN||void 0}import{existsSync as dv,mkdirSync as PE,writeFileSync as ec,readFileSync as qE,renameSync as DE,unlinkSync as yE}from"fs";import{execSync as wE}from"child_process";import{join as TE}from"path";import{createHash as FE}from"crypto";function QE(t){return FE("sha256").update(t).digest("hex")}function JE(t){return QE(t).substring(0,8)}function pv(t){let e=t.replace(/\\/g,"/").toLowerCase();return JE(e)}function jo(t,e){let i=Date.now().toString(36),n=Math.random().toString(36).substring(2,6);return`${t}-${e}-${i}-${n}`}import{existsSync as hv,readFileSync as fv,readdirSync as BE}from"fs";import{join as ZE}from"path";function Ye(t,e){if(!t||!e)return null;let i=kt(t,e);if(!hv(i))return null;try{let n=fv(i,"utf-8");return JSON.parse(n)}catch{return null}}function zv(t,e={}){let{limit:i=10,status:n="all"}=e,r=be(t);if(!hv(r))return[];let o=[];try{let a=BE(r).filter(c=>c.startsWith("gk-session-")&&c.endsWith(".json"));for(let c of a){let l=ZE(r,c),v=fv(l,"utf-8"),A=JSON.parse(v);n!=="all"&&(A.agents?.find(E=>E.agentType==="Main Agent")?.status||"active")!==n||o.push(A)}}catch{}return o.sort((a,c)=>new Date(c.initTimestamp).getTime()-new Date(a.initTimestamp).getTime()),o.slice(0,i)}function bE(t,e,i={}){let n=Ye(t,e);if(!n||!n.agents)return[];let r=n.agents;return i.agentType&&(r=r.filter(o=>o.agentType===i.agentType)),i.status&&(r=r.filter(o=>o.status===i.status)),r}function Rv(t,e){let i=bE(t,e),n={total:i.length,active:0,completed:0,failed:0,mainAgents:0,subAgents:0,totalDurationMs:0};return i.forEach(r=>{r.status==="active"?n.active++:r.status==="completed"?n.completed++:r.status==="failed"&&n.failed++,r.agentType==="Main Agent"?n.mainAgents++:n.subAgents++,r.startTime&&r.endTime&&(n.totalDurationMs+=new Date(r.endTime).getTime()-new Date(r.startTime).getTime())}),n}function XE(t){try{let e=`powershell -Command "$p = Get-CimInstance Win32_Process -Filter 'ProcessId=${t}'; Write-Output $p.ParentProcessId; Write-Output $p.Name"`,n=wE(e,{encoding:"utf8",stdio:["pipe","pipe","pipe"]}).trim().split(/\r?\n/),r=parseInt(n[0],10),o=n[1]||null;return{parentPid:!isNaN(r)&&r>0?r:null,processName:o}}catch{return{parentPid:null,processName:null}}}function HE(t){return t?["powershell.exe","pwsh.exe","cmd.exe","bash.exe","zsh.exe","sh.exe","fish.exe"].includes(t.toLowerCase()):!1}function LE(t){if(!t)return!1;let e=t.toLowerCase();return["code.exe","code - insiders.exe","cursor.exe","windsurf.exe","positron.exe","idea64.exe","idea.exe","webstorm64.exe","webstorm.exe","pycharm64.exe","pycharm.exe","phpstorm64.exe","phpstorm.exe","goland64.exe","goland.exe","rustrover64.exe","rustrover.exe","rider64.exe","rider.exe","clion64.exe","clion.exe","datagrip64.exe","datagrip.exe","fleet.exe","windowsterminal.exe","sublime_text.exe","zed.exe","terminal.app"].includes(e)}function tc(){let t=process.ppid;try{if(process.platform==="win32"){let e=t,i=null;for(let n=0;n<10;n++){let{parentPid:r,processName:o}=XE(e);if(HE(o)&&(i=e),LE(o)&&i)return i;if(!r||r<=4)break;e=r}return i||t}else return t}catch{}return t}function go(t){dv(t)||PE(t,{recursive:!0})}function _E(t){let{agents:e,...i}=t;return{...i,agents:e||[]}}function ic(t,e,i){if(!t||!e)return!1;let n=be(t);go(n);let r=kt(t,e),o=`${r}.tmp`;try{let a=_E(i);return ec(o,JSON.stringify(a,null,2),"utf8"),DE(o,r),!0}catch{try{yE(o)}catch{}return!1}}function jv(t){try{let e=Vt(),i=["# Auto-generated by gemkit-cli",`# Updated at: ${new Date().toISOString()}`,"","# GEMKIT IDs",`ACTIVE_GK_SESSION_ID=${t.gkSessionId||""}`,`GK_PROJECT_HASH=${t.gkProjectHash||""}`,`PROJECT_DIR=${t.projectDir||""}`,"","# GEMINI IDs (mapped)",`ACTIVE_GEMINI_SESSION_ID=${t.geminiSessionId||""}`,`GEMINI_PROJECT_HASH=${t.geminiProjectHash||""}`,"","# PLAN INFO",`ACTIVE_PLAN=${t.activePlan||""}`,`SUGGESTED_PLAN=${t.suggestedPlan||""}`,`PLAN_DATE_FORMAT=${t.planDateFormat||""}`,""].join(`
29
- `),n=TE(process.cwd(),".gemini");return go(n),ec(e,i,"utf8"),!0}catch{return!1}}function $E(t,e){if(!t||!e)return null;let i=_i(t,e);if(!dv(i))return null;try{let n=qE(i,"utf-8");return JSON.parse(n)}catch{return null}}function gv(t,e,i){if(!t||!e)return!1;let n=be(t);go(n);let r=_i(t,e);try{return ec(r,JSON.stringify(i,null,2),"utf8"),!0}catch{return!1}}function xv(t,e,i){let n=$E(t,e);return n||(n={gkProjectHash:e,projectDir:t,projectPath:i||process.cwd(),geminiProjectHash:null,initialized:!0,initTimestamp:new Date().toISOString(),lastActiveTimestamp:new Date().toISOString(),activeGkSessionId:null,sessions:[]},gv(t,e,n)),n}function eI(t,e,i){let n=xv(t,e);n.activeGkSessionId=i.gkSessionId,n.lastActiveTimestamp=new Date().toISOString();let r=n.sessions.findIndex(o=>o.gkSessionId===i.gkSessionId);if(r>=0){let o=n.sessions[r];n.sessions[r]={gkSessionId:i.gkSessionId,pid:i.pid??o.pid,sessionType:i.sessionType||o.sessionType,appName:i.appName||o.appName,prompt:i.prompt??o.prompt??null,activePlan:i.activePlan??o.activePlan??null,startTime:i.startTime||o.startTime,endTime:i.endTime??o.endTime??null}}else n.sessions.push({gkSessionId:i.gkSessionId,pid:i.pid??null,sessionType:i.sessionType||"gemini",appName:i.appName||"gemini-main",prompt:i.prompt??null,activePlan:i.activePlan??null,startTime:i.startTime||new Date().toISOString(),endTime:i.endTime??null});return n.sessions.sort((o,a)=>{let c=new Date(o.startTime||0).getTime();return new Date(a.startTime||0).getTime()-c}),gv(t,e,n)}function xo(t,e,i){let n=Ye(t,e);if(!n)return!1;let r=i.gkSessionId||e;n.agents=n.agents||[];let o=n.agents.findIndex(a=>a.gkSessionId===r);if(o>=0){let a=n.agents[o];n.agents[o]={...a,model:a.model||i.model||null,prompt:a.prompt||i.prompt||null}}else{let a={gkSessionId:r,pid:i.pid||null,geminiSessionId:i.geminiSessionId||null,geminiProjectHash:i.geminiProjectHash||null,parentGkSessionId:i.parentGkSessionId||null,agentType:i.parentGkSessionId?"Sub Agent":"Main Agent",agentRole:i.agentRole||"main",prompt:i.prompt||null,model:i.model||null,tokenUsage:i.tokenUsage||null,retryCount:i.retryCount||0,resumeCount:i.resumeCount||0,generation:i.generation||0,injected:i.injected||null,startTime:new Date().toISOString(),endTime:null,status:"active",exitCode:null,error:null};n.agents.push(a)}return ic(t,e,n)}function Gv(t,e={}){let i=e.cwd||process.cwd(),n=Li(i),r=pv(i),o=tc(),a=jo(t,o),c={gkSessionId:a,gkProjectHash:r,projectDir:n,geminiSessionId:null,geminiParentId:null,geminiProjectHash:null,initialized:!0,initTimestamp:new Date().toISOString(),sessionType:"non-gemini",appName:t,pid:o,activePlan:e.activePlan||null,suggestedPlan:e.suggestedPlan||null,agents:[]};go(be(n)),ic(n,a,c),xv(n,r,i),eI(n,r,{gkSessionId:a,pid:o,sessionType:"non-gemini",appName:t,startTime:c.initTimestamp,activePlan:c.activePlan});let l=N(),A=l.PROJECT_DIR===n&&l.GEMINI_PROJECT_HASH||"";return jv({gkSessionId:a,gkProjectHash:r,projectDir:n,geminiSessionId:"",geminiProjectHash:A,activePlan:c.activePlan||"",suggestedPlan:c.suggestedPlan||"",planDateFormat:""}),{session:c,gkSessionId:a,pid:o,projectDir:n,gkProjectHash:r}}function Sv(t,e,i){let n=Ye(t,e);if(!n||(n.activePlan=i,n.suggestedPlan=null,!ic(t,e,n)))return!1;let r=N();return jv({gkSessionId:e,gkProjectHash:n.gkProjectHash||r.GK_PROJECT_HASH,projectDir:t,geminiSessionId:n.geminiSessionId||r.ACTIVE_GEMINI_SESSION_ID,geminiProjectHash:n.geminiProjectHash||r.GEMINI_PROJECT_HASH,activePlan:i,suggestedPlan:"",planDateFormat:n.planDateFormat||r.PLAN_DATE_FORMAT})}function Yv(t){if(!t)return null;let e=t.match(/^(.+)-(\d+)-([a-z0-9]+)-([a-z0-9]{4})$/);return e?{appName:e[1],pid:parseInt(e[2],10),timestamp:e[3],random:e[4]}:null}import{spawn as tI,exec as iI}from"child_process";import{existsSync as Go,readFileSync as nc,writeFileSync as rc,unlinkSync as Wv}from"fs";import{join as Yo}from"path";import{tmpdir as nI,platform as Mv}from"os";var Je=Yo(nI(),"elevator-music.lock"),So=3e4,Wo=class{audioFile;loop;volume;process=null;isPlaying=!1;loopInterval=null;hasLock=!1;lockRefreshInterval=null;triedFallback=!1;constructor(e={}){this.audioFile=e.audioFile||this.getDefaultAudioFile(),this.loop=e.loop!==!1,this.volume=e.volume||.5}tryAcquireLock(){let e={pid:process.pid,timestamp:Date.now()};try{return rc(Je,JSON.stringify(e),{flag:"wx"}),this.hasLock=!0,this.lockRefreshInterval=setInterval(()=>{this.refreshLock()},So/3),!0}catch(i){return i.code==="EEXIST"?this.tryTakeStaleLock(e):!1}}tryTakeStaleLock(e){try{let i=JSON.parse(nc(Je,"utf8"));if(Date.now()-i.timestamp<So&&i.pid!==process.pid)try{return process.kill(i.pid,0),!1}catch{}Wv(Je);try{return rc(Je,JSON.stringify(e),{flag:"wx"}),this.hasLock=!0,this.lockRefreshInterval=setInterval(()=>{this.refreshLock()},So/3),!0}catch{return!1}}catch{return!1}}refreshLock(){if(this.hasLock)try{let e={pid:process.pid,timestamp:Date.now()};rc(Je,JSON.stringify(e),{flag:"w"})}catch{}}releaseLock(){if(this.lockRefreshInterval&&(clearInterval(this.lockRefreshInterval),this.lockRefreshInterval=null),!!this.hasLock){try{Go(Je)&&JSON.parse(nc(Je,"utf8")).pid===process.pid&&Wv(Je)}catch{}this.hasLock=!1}}getDefaultAudioFile(){let e=[Yo(process.cwd(),".gemini","extensions","spawn-agent","assets","golden-coast-melody.wav"),Yo(process.cwd(),".gemini","assets","elevator_music.wav"),Yo(process.cwd(),"assets","elevator_music.wav")];for(let i of e)if(Go(i))return i;return null}getPlayCommand(){if(!this.audioFile)return null;switch(Mv()){case"win32":return{command:"powershell",args:["-NoProfile","-Command",`$player = New-Object System.Media.SoundPlayer '${this.audioFile}'; $player.PlaySync()`],shell:!1};case"darwin":return{command:"afplay",args:["-v",String(this.volume),this.audioFile],shell:!1};case"linux":return{command:"paplay",args:["--volume",String(Math.round(this.volume*65536)),this.audioFile],shell:!1,fallback:{command:"aplay",args:["-q",this.audioFile],shell:!1}};default:return null}}start(e={}){if(!this.audioFile||!Go(this.audioFile))return!1;if(this.isPlaying)return!0;if(!e.force&&!this.tryAcquireLock())return!1;let i=this.getPlayCommand();return i?(this.isPlaying=!0,this.playLoop(i),!0):(this.releaseLock(),!1)}playLoop(e){if(!this.isPlaying)return;let i=n=>{this.process=tI(n.command,n.args,{stdio:["ignore","ignore","pipe"],windowsHide:!0,shell:n.shell}),this.process.stderr?.on("data",()=>{n.fallback&&!this.triedFallback&&(this.triedFallback=!0,this.process?.kill(),i(n.fallback))}),this.process.on("close",()=>{this.isPlaying&&this.loop&&(this.loopInterval=setTimeout(()=>{this.playLoop(e)},100))}),this.process.on("error",()=>{n.fallback&&!this.triedFallback&&(this.triedFallback=!0,i(n.fallback))})};i(e)}stop(){this.isPlaying=!1,this.loopInterval&&(clearTimeout(this.loopInterval),this.loopInterval=null),this.process&&(Mv()==="win32"?iI(`taskkill /pid ${this.process.pid} /T /F`,{windowsHide:!0}):this.process.kill("SIGTERM"),this.process=null),this.releaseLock()}get playing(){return this.isPlaying}static isAnyPlaying(){try{if(!Go(Je))return!1;let e=JSON.parse(nc(Je,"utf8"));if(Date.now()-e.timestamp>=So)return!1;try{return process.kill(e.pid,0),!0}catch{return!1}}catch{return!1}}};var Ov=[{icon:"\u{1F4A9}",action:"Pooping out some code"},{icon:"\u{1F373}",action:"Cooking up solutions"},{icon:"\u{1F9E0}",action:"Brain cells working overtime"},{icon:"\u26A1",action:"Neurons firing rapidly"},{icon:"\u{1F52E}",action:"Consulting the crystal ball"},{icon:"\u{1F3B0}",action:"Rolling the dice on this one"},{icon:"\u{1F680}",action:"Launching into hyperthink"},{icon:"\u{1F32A}\uFE0F",action:"Brainstorming intensifies"},{icon:"\u{1F3AA}",action:"Juggling multiple thoughts"},{icon:"\u{1F527}",action:"Tightening the logic bolts"},{icon:"\u{1F3A8}",action:"Painting the solution"},{icon:"\u{1F3D7}\uFE0F",action:"Building something awesome"},{icon:"\u{1F52C}",action:"Analyzing under the microscope"},{icon:"\u{1F9EA}",action:"Mixing the secret sauce"},{icon:"\u{1F3AF}",action:"Aiming for perfection"},{icon:"\u{1F9D9}",action:"Casting coding spells"},{icon:"\u{1F419}",action:"Multitasking like an octopus"},{icon:"\u{1F9BE}",action:"Flexing the AI muscles"},{icon:"\u{1F308}",action:"Finding the pot of gold"},{icon:"\u{1F3B8}",action:"Rocking out some logic"}],Uv=["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"];function AI(t){let e=0,i=0,n=0,r=process.stdout.isTTY,o=setInterval(()=>{n++,i++;let a=n%10===0;a&&e++;let c=Ov[e%Ov.length],v=`${Uv[i%Uv.length]} ${c.icon} ${c.action}... ${n}s`;r?process.stdout.write(`\r\x1B[K${v}`):(n===1||a)&&console.log(v)},1e3);return{interval:o,stop:()=>{clearInterval(o),r&&process.stdout.write("\r\x1B[K")}}}function mI(t){let{agentType:e="Sub Agent",agentRole:i="unknown",parentSessionId:n=null,activePlan:r=null,projectDir:o=null}=t,a=[`Agent Type: ${e}`,`Agent Role: ${i}`];return n&&a.push(`Parent Session: ${n.slice(0,8)}...`),o&&a.push(`Project: ${o}`),r&&a.push(`Active Plan: ${r}`),a.join(`
30
- `)}function Kv(){console.log(),console.log(p.default.bold(s.geminiPurple("Agent Management"))),console.log(),console.log("Usage:"),console.log(` ${s.primary("gk agent")} <subcommand> [options]`),console.log(),console.log("Subcommands:"),console.log(` ${s.primary("list")} List all agent profiles`),console.log(` ${s.primary("info")} <name> Show agent profile details`),console.log(` ${s.primary("search")} "<task>" Find best agent+skills for a task`),console.log(` ${s.primary("spawn")} Spawn a sub-agent`),console.log(),console.log("Examples:"),console.log(` ${s.dim("gk agent list")}`),console.log(` ${s.dim("gk agent info researcher")}`),console.log(` ${s.dim('gk agent search "implement authentication"')}`),console.log(` ${s.dim('gk agent spawn -a researcher -p "research best practices"')}`),console.log(),console.log("Run with subcommand for specific help:"),console.log(` ${s.dim("gk agent list --help")}`),console.log(` ${s.dim("gk agent spawn --help")}`),console.log()}function uI(){console.log(),console.log(p.default.bold(s.geminiPurple("gk agent list"))),console.log(s.dim("List all available agent profiles")),console.log(),console.log("Usage:"),console.log(` ${s.primary("gk agent list")} [options]`),console.log(),console.log("Options:"),console.log(` ${s.dim("--json")} Output as JSON`),console.log()}function EI(){console.log(),console.log(p.default.bold(s.geminiPurple("gk agent info"))),console.log(s.dim("Show detailed information about an agent profile")),console.log(),console.log("Usage:"),console.log(` ${s.primary("gk agent info")} <name> [options]`),console.log(),console.log("Arguments:"),console.log(` ${s.dim("<name>")} Agent profile name (without .md extension)`),console.log(),console.log("Options:"),console.log(` ${s.dim("--json")} Output as JSON`),console.log(),console.log("Example:"),console.log(` ${s.dim("gk agent info researcher")}`),console.log()}function II(){console.log(),console.log(p.default.bold(s.geminiPurple("gk agent search"))),console.log(s.dim("Find best agent+skills combination for a task using BM25 search")),console.log(),console.log("Usage:"),console.log(` ${s.primary("gk agent search")} "<task>" [options]`),console.log(),console.log("Arguments:"),console.log(` ${s.dim("<task>")} Task description to search for`),console.log(),console.log("Options:"),console.log(` ${s.dim("-n, --limit <n>")} Number of results (default: 5)`),console.log(` ${s.dim("-i, --intent <i>")} Force intent: research|plan|execute|debug|review|test|design|docs`),console.log(` ${s.dim("-d, --domain <d>")} Force domain: frontend|backend|auth|payment|database|mobile|ai|etc.`),console.log(` ${s.dim("--max-skills <n>")} Maximum skills to include`),console.log(` ${s.dim("--json")} Output as JSON`),console.log(),console.log("Examples:"),console.log(` ${s.dim('gk agent search "implement user authentication"')}`),console.log(` ${s.dim('gk agent search "debug the login form" -i debug')}`),console.log(` ${s.dim('gk agent search "build a payment page" -d payment')}`),console.log()}function Vv(){console.log(),console.log(p.default.bold(s.geminiPurple("gk agent spawn"))),console.log(s.dim("Spawn a sub-agent with Gemini CLI")),console.log(),console.log("Usage:"),console.log(` ${s.primary("gk agent spawn")} -p "<prompt>" [options]`),console.log(),console.log("Required:"),console.log(` ${s.dim("-p, --prompt <text>")} Task prompt for the agent`),console.log(),console.log("Options:"),console.log(` ${s.dim("-a, --agent <name>")} Agent profile name (from .gemini/agents/)`),console.log(` ${s.dim("-s, --skills <list>")} Comma-separated skill names to inject`),console.log(` ${s.dim("-c, --context <files>")} Context files (@file syntax)`),console.log(` ${s.dim("-m, --model <model>")} Model override (default: from config)`),console.log(` ${s.dim("--music")} Play elevator music while waiting`),console.log(` ${s.dim("--no-music")} Disable elevator music`),console.log(` ${s.dim("--music-file <path>")} Custom music file path`),console.log(),console.log("Examples:"),console.log(` ${s.dim('gk agent spawn -p "fix the login bug"')}`),console.log(` ${s.dim('gk agent spawn -a researcher -p "research React best practices"')}`),console.log(` ${s.dim('gk agent spawn -a code-executor -s "frontend-design" -p "build a dashboard"')}`),console.log(` ${s.dim('gk agent spawn -p "implement auth" -m gemini-2.5-pro --music')}`),console.log()}function Nv(t){t.command("agent [subcommand] [arg]","Agent management (list, info, search, spawn)").alias("a").option("--json","[all] Output as JSON").option("-n, --limit <n>","[search] Number of results (default: 5)",{default:5}).option("-i, --intent <intent>","[search] Force intent: research|plan|execute|debug|review|test|design|docs").option("-d, --domain <domain>","[search] Force domain: frontend|backend|auth|payment|database|mobile|ai").option("--max-skills <n>","[search] Maximum skills to include").option("-a, --agent <name>","[spawn] Agent profile name from .gemini/agents/").option("-p, --prompt <text>","[spawn] Task prompt (required for spawn)").option("-s, --skills <list>","[spawn] Comma-separated skill names").option("-c, --context <files>","[spawn] Context files (@file syntax)").option("-m, --model <model>","[spawn] Model override").option("--music","[spawn] Play elevator music while waiting").option("--no-music","[spawn] Disable elevator music").option("--music-file <path>","[spawn] Custom music file path").action(async(e,i,n)=>{if(n.help||n.h)switch(e){case"list":uI();return;case"info":EI();return;case"search":II();return;case"spawn":Vv();return;default:Kv();return}switch(e){case"list":await pI(n);break;case"info":i||(console.log(),u.error("Agent profile name required"),console.log(s.dim("Usage: gk agent info <name>")),console.log(),process.exit(1)),await hI(i,n);break;case"search":i||(console.log(),u.error("Search query required"),console.log(s.dim('Usage: gk agent search "<task>"')),console.log(),process.exit(1)),await fI(i,n);break;case"spawn":await zI(n);break;default:Kv()}})}async function pI(t){let e=fo();if(t.json){console.log(JSON.stringify(e,null,2));return}if(console.log(),console.log(p.default.bold(s.geminiPurple("Available Agents"))),console.log(),e.length===0){u.warn('No agent profiles found. Run "gk init" first.'),console.log();return}for(let i of e)console.log(` ${s.primary(i.name)}`),console.log(` ${s.dim(i.description)}`),console.log(` ${s.dim("Model:")} ${i.model}`),i.skills&&i.skills.length>0&&console.log(` ${s.dim("Skills:")} ${i.skills.join(", ")}`),console.log("");console.log(s.dim(` Total: ${e.length} agents`)),console.log()}async function hI(t,e){let i=qs(t);if(i||(console.log(),u.error(`Agent profile not found: ${t}`),console.log(),process.exit(1)),e.json){console.log(JSON.stringify(i,null,2));return}console.log(),console.log(M.doubleLine()),console.log(p.default.bold(s.geminiPurple(`Agent: ${i.name}`))),console.log(M.doubleLine()),console.log(),console.log(` ${s.dim("Description:")} ${i.description}`),console.log(` ${s.dim("Model:")} ${i.model}`),i.skills?.length&&console.log(` ${s.dim("Skills:")} ${i.skills.join(", ")}`),console.log(` ${s.dim("Path:")} ${i.filePath}`),console.log(),console.log(s.dim("--- Profile Content ---")),console.log(),console.log(s.dim(i.content)),console.log()}async function fI(t,e){let i=uv(t,{top:e.limit,forceIntent:e.intent,forceDomain:e.domain,maxSkills:e.maxSkills});if(e.json){console.log(JSON.stringify(i,null,2));return}if(console.log(),console.log(p.default.bold(s.geminiPurple(`Search results for: "${t}"`))),console.log(),i.length===0){u.warn("No matching agents found for task."),console.log();return}for(let n=0;n<i.length;n++){let r=i[n],o=r.fallback?s.warn(" [FALLBACK]"):"";console.log(` ${s.success(n+1+".")} ${s.primary(r.agent)}${o} ${s.dim(`(score: ${r.score})`)}`),console.log(` ${s.dim("Intent:")} ${r.intent} ${s.dim("Domain:")} ${r.domain} ${s.dim("Complexity:")} ${r.complexity}`),r.skills.length>0&&console.log(` ${s.dim("Skills:")} ${r.skills.join(" | ")}`),r.description&&console.log(` ${s.dim(r.description)}`),r.useWhen&&console.log(` ${s.dim("Use when:")} ${r.useWhen}`),console.log("")}if(i.length>0){let n=i[0],r=n.skills.length>0?` -s "${n.skills.join(",")}"`:"";console.log(s.dim(" Suggested command:")),console.log(` ${s.primary("gk")} agent spawn -a ${n.agent}${r} -p "${t}"`)}console.log()}async function zI(t){t.prompt||(console.log(),u.error("Prompt is required. Use -p or --prompt"),console.log(),Vv(),process.exit(1));let e=ct(),i=N(),n=i.ACTIVE_GK_SESSION_ID||null,r=i.ACTIVE_GEMINI_SESSION_ID||null,o=i.ACTIVE_PLAN||null,a=i.SUGGESTED_PLAN||null,c=i.PLAN_DATE_FORMAT||null,l=i.PROJECT_DIR||null,v=null;t.agent&&(v=qs(t.agent),v||(console.log(),u.error(`Agent profile not found: ${t.agent}`),console.log(),process.exit(1)));let A=t.model||v?.model||e.spawn.defaultModel,I=process.argv.includes("--music")||process.argv.includes("--no-music")?t.music:e.spawn.music,E=t.musicFile||e.spawn.musicFile,h=t.skills?.split(",").map(z=>z.trim())||[],d=v?.skills||[],f=[...new Set([...d,...h])],H=t.context?t.context.split(",").flatMap(z=>z.trim().split(/\s+/).filter(G=>G)).filter(z=>z):[];async function ce(z){let G=z,Be=!1;if(z.startsWith("@")){let le=z.substring(1),at=[Qi(process.cwd(),".docs",le),Qi(process.cwd(),".plans",le),Qi(process.cwd(),"docs",le),Qi(process.cwd(),"plans",le),Qi(process.cwd(),le)];for(let st of at)try{await oI(st),G=st,Be=!0;break}catch{continue}if(!Be){let st=at.map(si=>` - ${si}`).join(`
31
- `);throw new Error(`Context file not found: ${z}
26
+ `)):(m.error(`Failed to create project: ${o.error}`),console.log())})}import{spawn as FI}from"child_process";import{access as QI,stat as JI,readdir as bI,readFile as yv}from"fs/promises";import{join as Pi,basename as BI,extname as ZI,relative as PI}from"path";import{existsSync as tc,readFileSync as rI,readdirSync as oI}from"fs";import{join as jv,basename as sI}from"path";function ic(t,e){let i=nn(e),n=jv(i,`${t}.md`);return tc(n)?gv(n):null}function Wo(t){let e=nn(t);if(!tc(e))return[];let i=oI(e).filter(r=>r.endsWith(".md")),n=[];for(let r of i){let o=jv(e,r),s=gv(o);s&&n.push(s)}return n}function aI(t){let e=t.match(/^---\r?\n([\s\S]*?)\r?\n---/);if(!e)return null;let i={};for(let n of e[1].split(/\r?\n/)){let r=n.indexOf(":");if(r===-1)continue;let o=n.slice(0,r).trim(),s=n.slice(r+1).trim();(s.startsWith('"')&&s.endsWith('"')||s.startsWith("'")&&s.endsWith("'"))&&(s=s.slice(1,-1)),i[o]=s}return i}function zv(t){if(!t)return[];let e=t.trim();return e.startsWith("[")&&e.endsWith("]")&&(e=e.slice(1,-1)),e.split(",").map(i=>i.trim().replace(/['"]/g,"")).filter(Boolean)}function gv(t){if(!tc(t))return null;let e=rI(t,"utf-8"),i=sI(t,".md"),n="",r="gemini-2.5-flash",o=[],s=aI(e),c=e;if(s)s.description&&(n=s.description),s.model&&(r=s.model),o=zv(s.skills),c=e.replace(/^---\r?\n[\s\S]*?\r?\n---\r?\n?/,"").trim();else{let l=e.split(`
27
+ `);for(let u of l){if(u.startsWith("# ")){n=u.substring(2).trim();break}if(u.trim()&&!u.startsWith("#")){n=u.trim();break}}let v=e.match(/model:\s*(.+)/i);v&&(r=v[1].trim());let A=e.match(/skills:\s*(.+)/i);A&&(o=zv(A[1]))}return{name:i,description:n,model:r,skills:o,content:c,filePath:t}}import{existsSync as li,readFileSync as oc,readdirSync as cI}from"fs";import{join as Dn}from"path";var sc=".gemini/extensions/spawn-agent/data",xv=3,Gv={combination:{file:"combinations.csv",searchCols:["keywords","description","use_when","agent","skills","intent","domain"],outputCols:["id","agent","skills","intent","domain","complexity","description","use_when"]},intent:{file:"intents.csv",searchCols:["primary_keywords","expanded_keywords","question_patterns"],outputCols:["intent","agent","primary_keywords","expanded_keywords","action_verbs"]},domain:{file:"domains.csv",searchCols:["keywords","frameworks","file_patterns","technical_terms"],outputCols:["domain","base_skills","enhanced_skills","keywords","frameworks"]},synonym:{file:"synonyms.csv",searchCols:["word","synonyms"],outputCols:["word","synonyms","category"]}},lI={simple:["quick","simple","basic","small","minor","trivial","easy","straightforward"],standard:[],full:["comprehensive","full","complete","entire","thorough","detailed"],complex:["deep","extensive","advanced","complex","sophisticated","enterprise","production"]};var nc={research:"researcher",plan:"planner",execute:"code-executor",debug:"debugger",review:"code-reviewer",test:"tester",design:"ui-ux-designer",docs:"docs-manager",git:"git-manager",manage:"project-manager"},vI={frontend:["frontend-design"],backend:["backend-development"],auth:["better-auth","backend-development"],payment:["payment-integration"],database:["databases"],mobile:["mobile-development"],fullstack:["web-frameworks","backend-development"],ecommerce:["shopify"],media:["ai-multimodal"],ai:["ai-multimodal"],quality:["code-review"],codebase:["repomix"],general:["research"]},Mo=class{k1;b;corpus=[];docLengths=[];avgdl=0;idf=new Map;docFreqs=new Map;N=0;constructor(e=1.5,i=.75){this.k1=e,this.b=i}tokenize(e){return String(e).toLowerCase().replace(/[^\w\s]/g," ").split(/\s+/).filter(n=>n.length>1)}fit(e){if(this.corpus=e.map(i=>this.tokenize(i)),this.N=this.corpus.length,this.N!==0){this.docLengths=this.corpus.map(i=>i.length),this.avgdl=this.docLengths.reduce((i,n)=>i+n,0)/this.N;for(let i of this.corpus){let n=new Set;for(let r of i)n.has(r)||(this.docFreqs.set(r,(this.docFreqs.get(r)||0)+1),n.add(r))}for(let[i,n]of this.docFreqs.entries())this.idf.set(i,Math.log((this.N-n+.5)/(n+.5)+1))}}score(e){let i=this.tokenize(e),n=[];for(let r=0;r<this.corpus.length;r++){let o=this.corpus[r],s=0,c=this.docLengths[r],l=new Map;for(let v of o)l.set(v,(l.get(v)||0)+1);for(let v of i){let A=this.idf.get(v);if(A!==void 0){let u=l.get(v)||0,I=u*(this.k1+1),E=u+this.k1*(1-this.b+this.b*c/this.avgdl);s+=A*I/E}}n.push([r,s])}return n.sort((r,o)=>o[1]-r[1])}};function AI(t){let e=[],i="",n=!1;for(let r=0;r<t.length;r++){let o=t[r];o==='"'?n=!n:o===","&&!n?(e.push(i),i=""):i+=o}return e.push(i),e}function ac(t){if(!li(t))return[];let i=oc(t,"utf-8").trim().split(`
28
+ `);if(i.length<2)return[];let n=i[0].split(",").map(o=>o.trim()),r=[];for(let o=1;o<i.length;o++){let s=AI(i[o]),c={};n.forEach((l,v)=>{c[l]=s[v]?.trim()||""}),r.push(c)}return r}function uI(t,e,i,n,r){if(!li(t))return[];let o=ac(t),s=o.map(A=>e.map(u=>String(A[u]||"")).join(" ")),c=new Mo;c.fit(s);let l=c.score(n),v=[];for(let[A,u]of l.slice(0,r))if(u>0){let I=o[A],E={};for(let f of i)f in I&&(E[f]=I[f]);E._score=Math.round(u*1e4)/1e4,v.push(E)}return v}function cc(){let t=Dn(sc,"synonyms.csv");if(!li(t))return new Map;let e=ac(t),i=new Map;for(let n of e){let r=(n.word||"").toLowerCase().trim(),o=(n.synonyms||"").toLowerCase().trim();r&&o&&i.set(r,o.split(",").map(s=>s.trim()))}return i}function Sv(t,e){e||(e=cc());let i=t.toLowerCase().replace(/[^\w\s]/g," ").split(/\s+/),n=new Set(i);for(let r of i){let o=e.get(r);o&&o.forEach(s=>n.add(s))}return Array.from(n).join(" ")}function lc(t){let e=t.toLowerCase();for(let[i,n]of Object.entries(lI))for(let r of n)if(e.includes(r))return i;return"standard"}function vc(t){let e=t.toLowerCase(),n=e.split(/\s+/)[0]||"",r=[[/system architecture/,"plan"],[/design.*architecture/,"plan"],[/architect.*system/,"plan"],[/create.*roadmap/,"plan"],[/build.*roadmap/,"plan"],[/create.*strategy/,"plan"],[/stunning/,"design"],[/gorgeous/,"design"],[/beautiful.*ui/,"design"],[/beautiful.*component/,"design"],[/beautiful.*page/,"design"],[/write.*documentation/,"docs"],[/write.*docs/,"docs"],[/create.*documentation/,"docs"],[/research.*codebase/,"research"],[/deep research/,"research"]];for(let[v,A]of r)if(typeof v=="string"?e.includes(v):v.test(e))return A;let o={implement:"execute",build:"execute",create:"execute",add:"execute",make:"execute",code:"execute",develop:"execute",write:"execute",setup:"execute",configure:"execute",test:"test",verify:"test",validate:"test",debug:"debug",fix:"debug",troubleshoot:"debug",review:"review",audit:"review",document:"docs",plan:"plan",design:"design",research:"research",analyze:"research",investigate:"research"};if(n in o)return o[n];let s=[["best practices","research"],["how does","research"],["how do","research"],["what is","research"],["why is","research"],["compare","research"],["investigate","research"],["research","research"],["understand","research"],["system architecture","plan"],["implementation plan","plan"],["roadmap","plan"],["strategy for","plan"],["blueprint","plan"],["fix the","debug"],["debug the","debug"],["not working","debug"],["is broken","debug"],["error in","debug"],["fix bug","debug"],["test the","test"],["run tests","test"],["verify the","test"],["review the","review"],["audit the","review"],["check code","review"],["document the","docs"],["write docs","docs"],["api documentation","docs"]];for(let[v,A]of s)if(e.includes(v))return A;let c={debug:["fix","debug","troubleshoot","error","issue","bug","broken","failing","crash"],review:["review","audit","assess","check code","pr review","security audit"],test:["test","verify","validate","qa","coverage","unit test","e2e test"],design:["beautiful","stunning","gorgeous","ui design","ux design","mockup","layout"],docs:["document","documentation","readme","api docs","technical writing"],git:["commit","push","pull","merge","branch","git","stage"],manage:["status","progress","track","milestone","sprint"],plan:["plan","architect","roadmap","strategy","architecture design"],execute:["implement","build","create","add","make","code","develop"],research:["research","investigate","explore","study","analyze","examine","learn"]},l={};for(let[v,A]of Object.entries(c)){let u=A.filter(I=>e.includes(I)).length;u>0&&(l[v]=u)}return Object.keys(l).length>0?Object.entries(l).sort((v,A)=>A[1]-v[1])[0][0]:"execute"}function Ac(t){let e=t.toLowerCase(),i=[["flutter","mobile"],["react native","mobile"],["swift","mobile"],["kotlin","mobile"],["ios app","mobile"],["android app","mobile"],["next.js","fullstack"],["nextjs","fullstack"],["nuxt","fullstack"],["sveltekit","fullstack"],["remix","fullstack"],["server component","fullstack"],["openai","ai"],["anthropic","ai"],["claude","ai"],["langchain","ai"],["llm","ai"],["chatbot","ai"],["rag","ai"],["embedding","ai"],["gpt","ai"],["angular","frontend"],["react","frontend"],["vue","frontend"],["svelte","frontend"],["tailwind","frontend"],["nestjs","backend"],["express","backend"],["fastify","backend"],["hono","backend"],["fastapi","backend"],["websocket","backend"],["shopify","ecommerce"],["product catalog","ecommerce"],["checkout flow","ecommerce"],["stripe","payment"],["paypal","payment"],["subscription","payment"],["billing","payment"],["oauth","auth"],["authentication","auth"],["login","auth"],["signup","auth"],["prisma","database"],["drizzle","database"],["postgresql","database"],["mongodb","database"],["mysql","database"],["pdf","media"],["image","media"],["video","media"],["audio","media"],["codebase","codebase"],["repository","codebase"]];for(let[o,s]of i)if(e.includes(o))return s;let n={auth:["login","signup","authentication","oauth","jwt","session","password","2fa"],payment:["payment","checkout","billing","stripe","subscription","invoice","cart"],database:["database","sql","query","migration","schema","prisma","postgresql"],frontend:["ui","component","react","vue","css","tailwind","button","form","modal"],backend:["api","endpoint","server","service","route","rest","graphql","middleware"],mobile:["mobile","ios","android","react native","flutter","app","native"],fullstack:["fullstack","nextjs","next.js","nuxt","sveltekit","app router"],ecommerce:["ecommerce","shopify","store","product","cart","checkout","order"],media:["image","video","audio","media","upload","file","ocr"],ai:["ai","llm","gpt","claude","machine learning","embedding","vector","openai"],quality:["code review","lint","test","coverage","quality","refactor"],codebase:["codebase","repository","repo","project structure"],general:[]},r={};for(let[o,s]of Object.entries(n)){let c=s.filter(l=>e.includes(l)).length;c>0&&(r[o]=c)}return Object.keys(r).length>0?Object.entries(r).sort((o,s)=>s[1]-o[1])[0][0]:"general"}function Yv(t,e=xv,i=!0){let n=Gv.combination,r=Dn(sc,n.file),o=t;if(i){let c=cc();o=Sv(t,c)}let s=uI(r,n.searchCols,n.outputCols,o,e);return{query:t,expandedQuery:i?o:void 0,detectedIntent:vc(t),detectedDomain:Ac(t),detectedComplexity:lc(t),count:s.length,results:s}}function rc(t,e,i,n=xv,r=!0){let o=Gv.combination,s=Dn(sc,o.file);if(!li(s))return{results:[],count:0};let c=ac(s);if(e&&(c=c.filter(E=>(E.intent||"").toLowerCase()===e.toLowerCase())),i&&(c=c.filter(E=>(E.domain||"").toLowerCase()===i.toLowerCase())),c.length===0)return{results:[],count:0};let l=t;if(r){let E=cc();l=Sv(t,E)}let v=c.map(E=>o.searchCols.map(f=>String(E[f]||"")).join(" ")),A=new Mo;A.fit(v);let u=A.score(l),I=[];for(let[E,f]of u.slice(0,n))if(f>0){let R=c[E],h={};for(let H of o.outputCols)H in R&&(h[H]=R[H]);h._score=Math.round(f*1e4)/1e4,I.push(h)}return{results:I,count:I.length}}function mI(t){let e=vc(t),i=Ac(t),n=lc(t);if(["debug","review","test","design","docs","research","plan"].includes(e)){let A=rc(t,e,void 0,1,!0);if(A.results.length>0){let u=A.results[0],E=(u.skills||"").split("|").map(f=>f.trim()).filter(Boolean);return{agent:nc[e]||u.agent||"code-executor",skills:E,intent:e,domain:u.domain||i,complexity:u.complexity||n,score:u._score||0,fallback:!1,description:u.description||"",useWhen:u.use_when||""}}}if(e==="execute"&&["mobile","ai","payment","ecommerce","media","auth","database","fullstack"].includes(i)){let A=rc(t,"execute",i,1,!0);if(A.results.length>0){let u=A.results[0];return{agent:"code-executor",skills:(u.skills||"").split("|").map(f=>f.trim()).filter(Boolean),intent:e,domain:i,complexity:u.complexity||n,score:u._score||0,fallback:!1,description:u.description||"",useWhen:u.use_when||""}}}let s=Yv(t,1,!0);if(s.count===0){let A=nc[e]||"code-executor",u=vI[i]||["research"];return{agent:A,skills:u,intent:e,domain:i,complexity:n,score:0,fallback:!0,description:`Fallback combination based on detected intent (${e}) and domain (${i})`}}let c=s.results[0],v=(c.skills||"").split("|").map(A=>A.trim()).filter(Boolean);return{agent:c.agent||"code-executor",skills:v,intent:c.intent||e,domain:c.domain||i,complexity:c.complexity||n,score:c._score||0,fallback:!1,description:c.description||"",useWhen:c.use_when||""}}function Wv(t,e){let{top:i=5,forceIntent:n,forceDomain:r,maxSkills:o}=e||{};if(n||r)return rc(t,n,r,i,!0).results.map(l=>{let A=(l.skills||"").split("|").map(u=>u.trim()).filter(Boolean);return o&&(A=A.slice(0,o)),{agent:n?nc[n]:l.agent||"code-executor",skills:A,intent:l.intent||n||vc(t),domain:l.domain||r||Ac(t),complexity:l.complexity||lc(t),score:l._score||0,fallback:!1,description:l.description||"",useWhen:l.use_when||""}});let s=Yv(t,i,!0);return s.count===0?[mI(t)]:s.results.map(c=>{let v=(c.skills||"").split("|").map(A=>A.trim()).filter(Boolean);return o&&(v=v.slice(0,o)),{agent:c.agent||"code-executor",skills:v,intent:c.intent||s.detectedIntent,domain:c.domain||s.detectedDomain,complexity:c.complexity||s.detectedComplexity,score:c._score||0,fallback:!1,description:c.description||"",useWhen:c.use_when||""}})}function Mv(t){let e=Bt(t),i=[];if(!li(e))return i;let n=cI(e,{withFileTypes:!0}).filter(r=>r.isDirectory()).map(r=>r.name);for(let r of n){let o=Dn(e,r,"SKILL.md");if(li(o)){let s=oc(o,"utf-8");i.push({name:r,path:o,content:s})}}return i}function Cv(t,e){let i=Bt(e),n=Dn(i,t,"SKILL.md");return li(n)?oc(n,"utf-8"):null}import{existsSync as EI,readFileSync as II}from"fs";function N(t=process.cwd()){let e={ACTIVE_GK_SESSION_ID:"",GK_PROJECT_HASH:"",PROJECT_DIR:"",ACTIVE_GEMINI_SESSION_ID:"",GEMINI_PROJECT_HASH:"",GEMINI_PARENT_ID:"",ACTIVE_PLAN:"",SUGGESTED_PLAN:"",PLAN_DATE_FORMAT:""},i=bt(t);if(!EI(i))return e;try{let n=II(i,"utf-8"),r=n.match(/^ACTIVE_GK_SESSION_ID=(.*)$/m);r&&(e.ACTIVE_GK_SESSION_ID=r[1].trim());let o=n.match(/^GK_PROJECT_HASH=(.*)$/m);o&&(e.GK_PROJECT_HASH=o[1].trim());let s=n.match(/^PROJECT_DIR=(.*)$/m);s&&(e.PROJECT_DIR=s[1].trim());let c=n.match(/^ACTIVE_GEMINI_SESSION_ID=(.*)$/m);c&&(e.ACTIVE_GEMINI_SESSION_ID=c[1].trim());let l=n.match(/^GEMINI_PROJECT_HASH=(.*)$/m);l&&(e.GEMINI_PROJECT_HASH=l[1].trim());let v=n.match(/^GEMINI_PARENT_ID=(.*)$/m);v&&(e.GEMINI_PARENT_ID=v[1].trim());let A=n.match(/^ACTIVE_PLAN=(.*)$/m);A&&(e.ACTIVE_PLAN=A[1].trim());let u=n.match(/^SUGGESTED_PLAN=(.*)$/m);u&&(e.SUGGESTED_PLAN=u[1].trim());let I=n.match(/^PLAN_DATE_FORMAT=(.*)$/m);I&&(e.PLAN_DATE_FORMAT=I[1].trim())}catch{}return e}function vi(t=process.cwd()){return N(t).ACTIVE_GK_SESSION_ID||void 0}function at(t=process.cwd()){let e=N(t);return e.PROJECT_DIR?e.PROJECT_DIR:rn(t)}function Co(t=process.cwd()){return N(t).GEMINI_PROJECT_HASH||void 0}function wn(t=process.cwd()){return N(t).ACTIVE_PLAN||void 0}import{existsSync as kv,mkdirSync as jI,writeFileSync as uc,readFileSync as gI,renameSync as xI,unlinkSync as GI}from"fs";import{execSync as SI}from"child_process";import{join as YI}from"path";import{createHash as pI}from"crypto";function fI(t){return pI("sha256").update(t).digest("hex")}function hI(t){return fI(t).substring(0,8)}function Ov(t){let e=t.replace(/\\/g,"/").toLowerCase();return hI(e)}function Oo(t,e){let i=Date.now().toString(36),n=Math.random().toString(36).substring(2,6);return`${t}-${e}-${i}-${n}`}import{existsSync as Uv,readFileSync as Kv,readdirSync as dI}from"fs";import{join as RI}from"path";function Ce(t,e){if(!t||!e)return null;let i=Zt(t,e);if(!Uv(i))return null;try{let n=Kv(i,"utf-8");return JSON.parse(n)}catch{return null}}function Vv(t,e={}){let{limit:i=10,status:n="all"}=e,r=we(t);if(!Uv(r))return[];let o=[];try{let s=dI(r).filter(c=>c.startsWith("gk-session-")&&c.endsWith(".json"));for(let c of s){let l=RI(r,c),v=Kv(l,"utf-8"),A=JSON.parse(v);n!=="all"&&(A.agents?.find(E=>E.agentType==="Main Agent")?.status||"active")!==n||o.push(A)}}catch{}return o.sort((s,c)=>new Date(c.initTimestamp).getTime()-new Date(s.initTimestamp).getTime()),o.slice(0,i)}function zI(t,e,i={}){let n=Ce(t,e);if(!n||!n.agents)return[];let r=n.agents;return i.agentType&&(r=r.filter(o=>o.agentType===i.agentType)),i.status&&(r=r.filter(o=>o.status===i.status)),r}function Nv(t,e){let i=zI(t,e),n={total:i.length,active:0,completed:0,failed:0,mainAgents:0,subAgents:0,totalDurationMs:0};return i.forEach(r=>{r.status==="active"?n.active++:r.status==="completed"?n.completed++:r.status==="failed"&&n.failed++,r.agentType==="Main Agent"?n.mainAgents++:n.subAgents++,r.startTime&&r.endTime&&(n.totalDurationMs+=new Date(r.endTime).getTime()-new Date(r.startTime).getTime())}),n}function WI(t){try{let e=`powershell -Command "$p = Get-CimInstance Win32_Process -Filter 'ProcessId=${t}'; Write-Output $p.ParentProcessId; Write-Output $p.Name"`,n=SI(e,{encoding:"utf8",stdio:["pipe","pipe","pipe"]}).trim().split(/\r?\n/),r=parseInt(n[0],10),o=n[1]||null;return{parentPid:!isNaN(r)&&r>0?r:null,processName:o}}catch{return{parentPid:null,processName:null}}}function MI(t){return t?["powershell.exe","pwsh.exe","cmd.exe","bash.exe","zsh.exe","sh.exe","fish.exe"].includes(t.toLowerCase()):!1}function CI(t){if(!t)return!1;let e=t.toLowerCase();return["code.exe","code - insiders.exe","cursor.exe","windsurf.exe","positron.exe","idea64.exe","idea.exe","webstorm64.exe","webstorm.exe","pycharm64.exe","pycharm.exe","phpstorm64.exe","phpstorm.exe","goland64.exe","goland.exe","rustrover64.exe","rustrover.exe","rider64.exe","rider.exe","clion64.exe","clion.exe","datagrip64.exe","datagrip.exe","fleet.exe","windowsterminal.exe","sublime_text.exe","zed.exe","terminal.app"].includes(e)}function mc(){let t=process.ppid;try{if(process.platform==="win32"){let e=t,i=null;for(let n=0;n<10;n++){let{parentPid:r,processName:o}=WI(e);if(MI(o)&&(i=e),CI(o)&&i)return i;if(!r||r<=4)break;e=r}return i||t}else return t}catch{}return t}function Uo(t){kv(t)||jI(t,{recursive:!0})}function OI(t){let{agents:e,...i}=t;return{...i,agents:e||[]}}function Ec(t,e,i){if(!t||!e)return!1;let n=we(t);Uo(n);let r=Zt(t,e),o=`${r}.tmp`;try{let s=OI(i);return uc(o,JSON.stringify(s,null,2),"utf8"),xI(o,r),!0}catch{try{GI(o)}catch{}return!1}}function Fv(t){try{let e=bt(),i=["# Auto-generated by gemkit-cli",`# Updated at: ${new Date().toISOString()}`,"","# GEMKIT IDs",`ACTIVE_GK_SESSION_ID=${t.gkSessionId||""}`,`GK_PROJECT_HASH=${t.gkProjectHash||""}`,`PROJECT_DIR=${t.projectDir||""}`,"","# GEMINI IDs (mapped)",`ACTIVE_GEMINI_SESSION_ID=${t.geminiSessionId||""}`,`GEMINI_PROJECT_HASH=${t.geminiProjectHash||""}`,"","# PLAN INFO",`ACTIVE_PLAN=${t.activePlan||""}`,`SUGGESTED_PLAN=${t.suggestedPlan||""}`,`PLAN_DATE_FORMAT=${t.planDateFormat||""}`,""].join(`
29
+ `),n=YI(process.cwd(),".gemini");return Uo(n),uc(e,i,"utf8"),!0}catch{return!1}}function UI(t,e){if(!t||!e)return null;let i=on(t,e);if(!kv(i))return null;try{let n=gI(i,"utf-8");return JSON.parse(n)}catch{return null}}function Qv(t,e,i){if(!t||!e)return!1;let n=we(t);Uo(n);let r=on(t,e);try{return uc(r,JSON.stringify(i,null,2),"utf8"),!0}catch{return!1}}function Jv(t,e,i){let n=UI(t,e);return n||(n={gkProjectHash:e,projectDir:t,projectPath:i||process.cwd(),geminiProjectHash:null,initialized:!0,initTimestamp:new Date().toISOString(),lastActiveTimestamp:new Date().toISOString(),activeGkSessionId:null,sessions:[]},Qv(t,e,n)),n}function KI(t,e,i){let n=Jv(t,e);n.activeGkSessionId=i.gkSessionId,n.lastActiveTimestamp=new Date().toISOString();let r=n.sessions.findIndex(o=>o.gkSessionId===i.gkSessionId);if(r>=0){let o=n.sessions[r];n.sessions[r]={gkSessionId:i.gkSessionId,pid:i.pid??o.pid,sessionType:i.sessionType||o.sessionType,appName:i.appName||o.appName,prompt:i.prompt??o.prompt??null,activePlan:i.activePlan??o.activePlan??null,startTime:i.startTime||o.startTime,endTime:i.endTime??o.endTime??null}}else n.sessions.push({gkSessionId:i.gkSessionId,pid:i.pid??null,sessionType:i.sessionType||"gemini",appName:i.appName||"gemini-main",prompt:i.prompt??null,activePlan:i.activePlan??null,startTime:i.startTime||new Date().toISOString(),endTime:i.endTime??null});return n.sessions.sort((o,s)=>{let c=new Date(o.startTime||0).getTime();return new Date(s.startTime||0).getTime()-c}),Qv(t,e,n)}function Ko(t,e,i){let n=Ce(t,e);if(!n)return!1;let r=i.gkSessionId||e;n.agents=n.agents||[];let o=n.agents.findIndex(s=>s.gkSessionId===r);if(o>=0){let s=n.agents[o];n.agents[o]={...s,model:s.model||i.model||null,prompt:s.prompt||i.prompt||null}}else{let s={gkSessionId:r,pid:i.pid||null,geminiSessionId:i.geminiSessionId||null,geminiProjectHash:i.geminiProjectHash||null,parentGkSessionId:i.parentGkSessionId||null,agentType:i.parentGkSessionId?"Sub Agent":"Main Agent",agentRole:i.agentRole||"main",prompt:i.prompt||null,model:i.model||null,tokenUsage:i.tokenUsage||null,retryCount:i.retryCount||0,resumeCount:i.resumeCount||0,generation:i.generation||0,injected:i.injected||null,startTime:new Date().toISOString(),endTime:null,status:"active",exitCode:null,error:null};n.agents.push(s)}return Ec(t,e,n)}function bv(t,e={}){let i=e.cwd||process.cwd(),n=rn(i),r=Ov(i),o=mc(),s=Oo(t,o),c={gkSessionId:s,gkProjectHash:r,projectDir:n,geminiSessionId:null,geminiParentId:null,geminiProjectHash:null,initialized:!0,initTimestamp:new Date().toISOString(),sessionType:"non-gemini",appName:t,pid:o,activePlan:e.activePlan||null,suggestedPlan:e.suggestedPlan||null,agents:[]};Uo(we(n)),Ec(n,s,c),Jv(n,r,i),KI(n,r,{gkSessionId:s,pid:o,sessionType:"non-gemini",appName:t,startTime:c.initTimestamp,activePlan:c.activePlan});let l=N(),A=l.PROJECT_DIR===n&&l.GEMINI_PROJECT_HASH||"";return Fv({gkSessionId:s,gkProjectHash:r,projectDir:n,geminiSessionId:"",geminiProjectHash:A,activePlan:c.activePlan||"",suggestedPlan:c.suggestedPlan||"",planDateFormat:""}),{session:c,gkSessionId:s,pid:o,projectDir:n,gkProjectHash:r}}function Bv(t,e,i){let n=Ce(t,e);if(!n||(n.activePlan=i,n.suggestedPlan=null,!Ec(t,e,n)))return!1;let r=N();return Fv({gkSessionId:e,gkProjectHash:n.gkProjectHash||r.GK_PROJECT_HASH,projectDir:t,geminiSessionId:n.geminiSessionId||r.ACTIVE_GEMINI_SESSION_ID,geminiProjectHash:n.geminiProjectHash||r.GEMINI_PROJECT_HASH,activePlan:i,suggestedPlan:"",planDateFormat:n.planDateFormat||r.PLAN_DATE_FORMAT})}function Zv(t){if(!t)return null;let e=t.match(/^(.+)-(\d+)-([a-z0-9]+)-([a-z0-9]{4})$/);return e?{appName:e[1],pid:parseInt(e[2],10),timestamp:e[3],random:e[4]}:null}import{spawn as VI,exec as NI}from"child_process";import{existsSync as Vo,readFileSync as Ic,writeFileSync as pc,unlinkSync as Pv}from"fs";import{join as ko}from"path";import{tmpdir as kI,platform as qv}from"os";var qe=ko(kI(),"elevator-music.lock"),No=3e4,Fo=class{audioFile;loop;volume;process=null;isPlaying=!1;loopInterval=null;hasLock=!1;lockRefreshInterval=null;triedFallback=!1;constructor(e={}){this.audioFile=e.audioFile||this.getDefaultAudioFile(),this.loop=e.loop!==!1,this.volume=e.volume||.5}tryAcquireLock(){let e={pid:process.pid,timestamp:Date.now()};try{return pc(qe,JSON.stringify(e),{flag:"wx"}),this.hasLock=!0,this.lockRefreshInterval=setInterval(()=>{this.refreshLock()},No/3),!0}catch(i){return i.code==="EEXIST"?this.tryTakeStaleLock(e):!1}}tryTakeStaleLock(e){try{let i=JSON.parse(Ic(qe,"utf8"));if(Date.now()-i.timestamp<No&&i.pid!==process.pid)try{return process.kill(i.pid,0),!1}catch{}Pv(qe);try{return pc(qe,JSON.stringify(e),{flag:"wx"}),this.hasLock=!0,this.lockRefreshInterval=setInterval(()=>{this.refreshLock()},No/3),!0}catch{return!1}}catch{return!1}}refreshLock(){if(this.hasLock)try{let e={pid:process.pid,timestamp:Date.now()};pc(qe,JSON.stringify(e),{flag:"w"})}catch{}}releaseLock(){if(this.lockRefreshInterval&&(clearInterval(this.lockRefreshInterval),this.lockRefreshInterval=null),!!this.hasLock){try{Vo(qe)&&JSON.parse(Ic(qe,"utf8")).pid===process.pid&&Pv(qe)}catch{}this.hasLock=!1}}getDefaultAudioFile(){let e=[ko(process.cwd(),".gemini","extensions","spawn-agent","assets","golden-coast-melody.wav"),ko(process.cwd(),".gemini","assets","elevator_music.wav"),ko(process.cwd(),"assets","elevator_music.wav")];for(let i of e)if(Vo(i))return i;return null}getPlayCommand(){if(!this.audioFile)return null;switch(qv()){case"win32":return{command:"powershell",args:["-NoProfile","-Command",`$player = New-Object System.Media.SoundPlayer '${this.audioFile}'; $player.PlaySync()`],shell:!1};case"darwin":return{command:"afplay",args:["-v",String(this.volume),this.audioFile],shell:!1};case"linux":return{command:"paplay",args:["--volume",String(Math.round(this.volume*65536)),this.audioFile],shell:!1,fallback:{command:"aplay",args:["-q",this.audioFile],shell:!1}};default:return null}}start(e={}){if(!this.audioFile||!Vo(this.audioFile))return!1;if(this.isPlaying)return!0;if(!e.force&&!this.tryAcquireLock())return!1;let i=this.getPlayCommand();return i?(this.isPlaying=!0,this.playLoop(i),!0):(this.releaseLock(),!1)}playLoop(e){if(!this.isPlaying)return;let i=n=>{this.process=VI(n.command,n.args,{stdio:["ignore","ignore","pipe"],windowsHide:!0,shell:n.shell}),this.process.stderr?.on("data",()=>{n.fallback&&!this.triedFallback&&(this.triedFallback=!0,this.process?.kill(),i(n.fallback))}),this.process.on("close",()=>{this.isPlaying&&this.loop&&(this.loopInterval=setTimeout(()=>{this.playLoop(e)},100))}),this.process.on("error",()=>{n.fallback&&!this.triedFallback&&(this.triedFallback=!0,i(n.fallback))})};i(e)}stop(){this.isPlaying=!1,this.loopInterval&&(clearTimeout(this.loopInterval),this.loopInterval=null),this.process&&(qv()==="win32"?NI(`taskkill /pid ${this.process.pid} /T /F`,{windowsHide:!0}):this.process.kill("SIGTERM"),this.process=null),this.releaseLock()}get playing(){return this.isPlaying}static isAnyPlaying(){try{if(!Vo(qe))return!1;let e=JSON.parse(Ic(qe,"utf8"));if(Date.now()-e.timestamp>=No)return!1;try{return process.kill(e.pid,0),!0}catch{return!1}}catch{return!1}}};var Dv=[{icon:"\u{1F4A9}",action:"Pooping out some code"},{icon:"\u{1F373}",action:"Cooking up solutions"},{icon:"\u{1F9E0}",action:"Brain cells working overtime"},{icon:"\u26A1",action:"Neurons firing rapidly"},{icon:"\u{1F52E}",action:"Consulting the crystal ball"},{icon:"\u{1F3B0}",action:"Rolling the dice on this one"},{icon:"\u{1F680}",action:"Launching into hyperthink"},{icon:"\u{1F32A}\uFE0F",action:"Brainstorming intensifies"},{icon:"\u{1F3AA}",action:"Juggling multiple thoughts"},{icon:"\u{1F527}",action:"Tightening the logic bolts"},{icon:"\u{1F3A8}",action:"Painting the solution"},{icon:"\u{1F3D7}\uFE0F",action:"Building something awesome"},{icon:"\u{1F52C}",action:"Analyzing under the microscope"},{icon:"\u{1F9EA}",action:"Mixing the secret sauce"},{icon:"\u{1F3AF}",action:"Aiming for perfection"},{icon:"\u{1F9D9}",action:"Casting coding spells"},{icon:"\u{1F419}",action:"Multitasking like an octopus"},{icon:"\u{1F9BE}",action:"Flexing the AI muscles"},{icon:"\u{1F308}",action:"Finding the pot of gold"},{icon:"\u{1F3B8}",action:"Rocking out some logic"}],wv=["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"];function qI(t){let e=0,i=0,n=0,r=process.stdout.isTTY,o=setInterval(()=>{n++,i++;let s=n%10===0;s&&e++;let c=Dv[e%Dv.length],v=`${wv[i%wv.length]} ${c.icon} ${c.action}... ${n}s`;r?process.stdout.write(`\r\x1B[K${v}`):(n===1||s)&&console.log(v)},1e3);return{interval:o,stop:()=>{clearInterval(o),r&&process.stdout.write("\r\x1B[K")}}}function yI(t){let{agentType:e="Sub Agent",agentRole:i="unknown",parentSessionId:n=null,activePlan:r=null,projectDir:o=null}=t,s=[`Agent Type: ${e}`,`Agent Role: ${i}`];return n&&s.push(`Parent Session: ${n.slice(0,8)}...`),o&&s.push(`Project: ${o}`),r&&s.push(`Active Plan: ${r}`),s.join(`
30
+ `)}function Tv(){console.log(),console.log(p.default.bold(a.geminiPurple("Agent Management"))),console.log(),console.log("Usage:"),console.log(` ${a.primary("gk agent")} <subcommand> [options]`),console.log(),console.log("Subcommands:"),console.log(` ${a.primary("list")} List all agent profiles`),console.log(` ${a.primary("info")} <name> Show agent profile details`),console.log(` ${a.primary("search")} "<task>" Find best agent+skills for a task`),console.log(` ${a.primary("spawn")} Spawn a sub-agent`),console.log(),console.log("Examples:"),console.log(` ${a.dim("gk agent list")}`),console.log(` ${a.dim("gk agent info researcher")}`),console.log(` ${a.dim('gk agent search "implement authentication"')}`),console.log(` ${a.dim('gk agent spawn -a researcher -p "research best practices"')}`),console.log(),console.log("Run with subcommand for specific help:"),console.log(` ${a.dim("gk agent list --help")}`),console.log(` ${a.dim("gk agent spawn --help")}`),console.log()}function DI(){console.log(),console.log(p.default.bold(a.geminiPurple("gk agent list"))),console.log(a.dim("List all available agent profiles")),console.log(),console.log("Usage:"),console.log(` ${a.primary("gk agent list")} [options]`),console.log(),console.log("Options:"),console.log(` ${a.dim("--json")} Output as JSON`),console.log()}function wI(){console.log(),console.log(p.default.bold(a.geminiPurple("gk agent info"))),console.log(a.dim("Show detailed information about an agent profile")),console.log(),console.log("Usage:"),console.log(` ${a.primary("gk agent info")} <name> [options]`),console.log(),console.log("Arguments:"),console.log(` ${a.dim("<name>")} Agent profile name (without .md extension)`),console.log(),console.log("Options:"),console.log(` ${a.dim("--json")} Output as JSON`),console.log(),console.log("Example:"),console.log(` ${a.dim("gk agent info researcher")}`),console.log()}function TI(){console.log(),console.log(p.default.bold(a.geminiPurple("gk agent search"))),console.log(a.dim("Find best agent+skills combination for a task using BM25 search")),console.log(),console.log("Usage:"),console.log(` ${a.primary("gk agent search")} "<task>" [options]`),console.log(),console.log("Arguments:"),console.log(` ${a.dim("<task>")} Task description to search for`),console.log(),console.log("Options:"),console.log(` ${a.dim("-n, --limit <n>")} Number of results (default: 5)`),console.log(` ${a.dim("-i, --intent <i>")} Force intent: research|plan|execute|debug|review|test|design|docs`),console.log(` ${a.dim("-d, --domain <d>")} Force domain: frontend|backend|auth|payment|database|mobile|ai|etc.`),console.log(` ${a.dim("--max-skills <n>")} Maximum skills to include`),console.log(` ${a.dim("--json")} Output as JSON`),console.log(),console.log("Examples:"),console.log(` ${a.dim('gk agent search "implement user authentication"')}`),console.log(` ${a.dim('gk agent search "debug the login form" -i debug')}`),console.log(` ${a.dim('gk agent search "build a payment page" -d payment')}`),console.log()}function Xv(){console.log(),console.log(p.default.bold(a.geminiPurple("gk agent spawn"))),console.log(a.dim("Spawn a sub-agent with Gemini CLI")),console.log(),console.log("Usage:"),console.log(` ${a.primary("gk agent spawn")} -p "<prompt>" [options]`),console.log(),console.log("Required:"),console.log(` ${a.dim("-p, --prompt <text>")} Task prompt for the agent`),console.log(),console.log("Options:"),console.log(` ${a.dim("-a, --agent <name>")} Agent profile name (from .gemini/agents/)`),console.log(` ${a.dim("-s, --skills <list>")} Comma-separated skill names to inject`),console.log(` ${a.dim("-c, --context <files>")} Context files (@file syntax)`),console.log(` ${a.dim("-m, --model <model>")} Model override (default: from config)`),console.log(` ${a.dim("--music")} Play elevator music while waiting`),console.log(` ${a.dim("--no-music")} Disable elevator music`),console.log(` ${a.dim("--music-file <path>")} Custom music file path`),console.log(),console.log("Examples:"),console.log(` ${a.dim('gk agent spawn -p "fix the login bug"')}`),console.log(` ${a.dim('gk agent spawn -a researcher -p "research React best practices"')}`),console.log(` ${a.dim('gk agent spawn -a code-executor -s "frontend-design" -p "build a dashboard"')}`),console.log(` ${a.dim('gk agent spawn -p "implement auth" -m gemini-2.5-pro --music')}`),console.log()}function Hv(t){t.command("agent [subcommand] [arg]","Agent management (list, info, search, spawn)").alias("a").option("--json","[all] Output as JSON").option("-n, --limit <n>","[search] Number of results (default: 5)",{default:5}).option("-i, --intent <intent>","[search] Force intent: research|plan|execute|debug|review|test|design|docs").option("-d, --domain <domain>","[search] Force domain: frontend|backend|auth|payment|database|mobile|ai").option("--max-skills <n>","[search] Maximum skills to include").option("-a, --agent <name>","[spawn] Agent profile name from .gemini/agents/").option("-p, --prompt <text>","[spawn] Task prompt (required for spawn)").option("-s, --skills <list>","[spawn] Comma-separated skill names").option("-c, --context <files>","[spawn] Context files (@file syntax)").option("-m, --model <model>","[spawn] Model override").option("--music","[spawn] Play elevator music while waiting").option("--no-music","[spawn] Disable elevator music").option("--music-file <path>","[spawn] Custom music file path").action(async(e,i,n)=>{if(n.help||n.h)switch(e){case"list":DI();return;case"info":wI();return;case"search":TI();return;case"spawn":Xv();return;default:Tv();return}switch(e){case"list":await XI(n);break;case"info":i||(console.log(),m.error("Agent profile name required"),console.log(a.dim("Usage: gk agent info <name>")),console.log(),process.exit(1)),await HI(i,n);break;case"search":i||(console.log(),m.error("Search query required"),console.log(a.dim('Usage: gk agent search "<task>"')),console.log(),process.exit(1)),await LI(i,n);break;case"spawn":await _I(n);break;default:Tv()}})}async function XI(t){let e=Wo();if(t.json){console.log(JSON.stringify(e,null,2));return}if(console.log(),console.log(p.default.bold(a.geminiPurple("Available Agents"))),console.log(),e.length===0){m.warn('No agent profiles found. Run "gk init" first.'),console.log();return}for(let i of e)console.log(` ${a.primary(i.name)}`),console.log(` ${a.dim(i.description)}`),console.log(` ${a.dim("Model:")} ${i.model}`),i.skills&&i.skills.length>0&&console.log(` ${a.dim("Skills:")} ${i.skills.join(", ")}`),console.log("");console.log(a.dim(` Total: ${e.length} agents`)),console.log()}async function HI(t,e){let i=ic(t);if(i||(console.log(),m.error(`Agent profile not found: ${t}`),console.log(),process.exit(1)),e.json){console.log(JSON.stringify(i,null,2));return}console.log(),console.log(M.doubleLine()),console.log(p.default.bold(a.geminiPurple(`Agent: ${i.name}`))),console.log(M.doubleLine()),console.log(),console.log(` ${a.dim("Description:")} ${i.description}`),console.log(` ${a.dim("Model:")} ${i.model}`),i.skills?.length&&console.log(` ${a.dim("Skills:")} ${i.skills.join(", ")}`),console.log(` ${a.dim("Path:")} ${i.filePath}`),console.log(),console.log(a.dim("--- Profile Content ---")),console.log(),console.log(a.dim(i.content)),console.log()}async function LI(t,e){let i=Wv(t,{top:e.limit,forceIntent:e.intent,forceDomain:e.domain,maxSkills:e.maxSkills});if(e.json){console.log(JSON.stringify(i,null,2));return}if(console.log(),console.log(p.default.bold(a.geminiPurple(`Search results for: "${t}"`))),console.log(),i.length===0){m.warn("No matching agents found for task."),console.log();return}for(let n=0;n<i.length;n++){let r=i[n],o=r.fallback?a.warn(" [FALLBACK]"):"";console.log(` ${a.success(n+1+".")} ${a.primary(r.agent)}${o} ${a.dim(`(score: ${r.score})`)}`),console.log(` ${a.dim("Intent:")} ${r.intent} ${a.dim("Domain:")} ${r.domain} ${a.dim("Complexity:")} ${r.complexity}`),r.skills.length>0&&console.log(` ${a.dim("Skills:")} ${r.skills.join(" | ")}`),r.description&&console.log(` ${a.dim(r.description)}`),r.useWhen&&console.log(` ${a.dim("Use when:")} ${r.useWhen}`),console.log("")}if(i.length>0){let n=i[0],r=n.skills.length>0?` -s "${n.skills.join(",")}"`:"";console.log(a.dim(" Suggested command:")),console.log(` ${a.primary("gk")} agent spawn -a ${n.agent}${r} -p "${t}"`)}console.log()}async function _I(t){t.prompt||(console.log(),m.error("Prompt is required. Use -p or --prompt"),console.log(),Xv(),process.exit(1));let e=Ve(),i=N(),n=i.ACTIVE_GK_SESSION_ID||null,r=i.ACTIVE_GEMINI_SESSION_ID||null,o=i.ACTIVE_PLAN||null,s=i.SUGGESTED_PLAN||null,c=i.PLAN_DATE_FORMAT||null,l=i.PROJECT_DIR||null,v=null;t.agent&&(v=ic(t.agent),v||(console.log(),m.error(`Agent profile not found: ${t.agent}`),console.log(),process.exit(1)));let A=t.model||v?.model||e.spawn.defaultModel,I=process.argv.includes("--music")||process.argv.includes("--no-music")?t.music:e.spawn.music,E=t.musicFile||e.spawn.musicFile,f=t.skills?.split(",").map(d=>d.trim())||[],R=v?.skills||[],h=[...new Set([...R,...f])],H=t.context?t.context.split(",").flatMap(d=>d.trim().split(/\s+/).filter(G=>G)).filter(d=>d):[];async function ve(d){let G=d,De=!1;if(d.startsWith("@")){let Ae=d.substring(1),At=[Pi(process.cwd(),".docs",Ae),Pi(process.cwd(),".plans",Ae),Pi(process.cwd(),"docs",Ae),Pi(process.cwd(),"plans",Ae),Pi(process.cwd(),Ae)];for(let ut of At)try{await QI(ut),G=ut,De=!0;break}catch{continue}if(!De){let ut=At.map(ui=>` - ${ui}`).join(`
31
+ `);throw new Error(`Context file not found: ${d}
32
32
  Searched paths:
33
- ${st}
34
- Tip: Place file in .docs/, .plans/, docs/, plans/, or project root`)}}try{if((await aI(G)).isDirectory())return await bo(G,z);let at=await Cv(G,"utf-8");return{type:"context",name:cI(G),path:G,content:at.trim(),originalRef:z}}catch(le){throw new Error(`Failed to load context from ${z}: ${le.message}`)}}async function bo(z,G){let le=[".md",".txt",".json",".yaml",".yml"],at=[];async function st(si,Pn=0){if(Pn>3)return;let IA=await sI(si,{withFileTypes:!0});for(let ci of IA){let Pi=Qi(si,ci.name);if(!ci.name.startsWith(".")){if(ci.isDirectory())await st(Pi,Pn+1);else if(ci.isFile()){let pA=lI(ci.name).toLowerCase();if(le.includes(pA))try{let To=await Cv(Pi,"utf-8"),Mc=vI(z,Pi);at.push({type:"context",name:ci.name,path:Pi,relativePath:Mc,content:To.trim(),originalRef:`${G}/${Mc}`})}catch(To){console.warn(`Warning: Could not read ${Pi}: ${To.message}`)}}}}}return await st(z),at.sort((si,Pn)=>(si.relativePath||"").localeCompare(Pn.relativePath||"")),at}function Po(z){if(!z||z.length===0)return"";let G=`<context>
33
+ ${ut}
34
+ Tip: Place file in .docs/, .plans/, docs/, plans/, or project root`)}}try{if((await JI(G)).isDirectory())return await es(G,d);let At=await yv(G,"utf-8");return{type:"context",name:BI(G),path:G,content:At.trim(),originalRef:d}}catch(Ae){throw new Error(`Failed to load context from ${d}: ${Ae.message}`)}}async function es(d,G){let Ae=[".md",".txt",".json",".yaml",".yml"],At=[];async function ut(ui,Hn=0){if(Hn>3)return;let NA=await bI(ui,{withFileTypes:!0});for(let mi of NA){let Xi=Pi(ui,mi.name);if(!mi.name.startsWith(".")){if(mi.isDirectory())await ut(Xi,Hn+1);else if(mi.isFile()){let kA=ZI(mi.name).toLowerCase();if(Ae.includes(kA))try{let ss=await yv(Xi,"utf-8"),Pc=PI(d,Xi);At.push({type:"context",name:mi.name,path:Xi,relativePath:Pc,content:ss.trim(),originalRef:`${G}/${Pc}`})}catch(ss){console.warn(`Warning: Could not read ${Xi}: ${ss.message}`)}}}}}return await ut(d),At.sort((ui,Hn)=>(ui.relativePath||"").localeCompare(Hn.relativePath||"")),At}function ts(d){if(!d||d.length===0)return"";let G=`<context>
35
35
  `;return G+=`The following documents provide additional context for this task:
36
36
 
37
- `,z.forEach((Be,le)=>{G+=`## Document ${le+1}: ${Be.name}
38
- `,G+=`Source: ${Be.originalRef}
37
+ `,d.forEach((De,Ae)=>{G+=`## Document ${Ae+1}: ${De.name}
38
+ `,G+=`Source: ${De.originalRef}
39
39
 
40
40
  `}),G+=`</context>
41
41
 
42
- `,G}let rt=[];if(H&&H.length>0)for(let z of H)try{if(typeof z=="string"){let G=await ce(z);Array.isArray(G)?rt.push(...G):rt.push(G)}else rt.push(z)}catch(G){console.log(),u.error(G.message),console.log(),process.exit(1)}let Ot=v?.name||t.agent||"Sub",V=[],mA=mI({agentType:"Sub Agent",agentRole:Ot,parentSessionId:n,activePlan:o,projectDir:l});if(V.push("<subagent-context>"),V.push(mA),V.push(`</subagent-context>
42
+ `,G}let lt=[];if(H&&H.length>0)for(let d of H)try{if(typeof d=="string"){let G=await ve(d);Array.isArray(G)?lt.push(...G):lt.push(G)}else lt.push(d)}catch(G){console.log(),m.error(G.message),console.log(),process.exit(1)}let Ft=v?.name||t.agent||"Sub",V=[],UA=yI({agentType:"Sub Agent",agentRole:Ft,parentSessionId:n,activePlan:o,projectDir:l});if(V.push("<subagent-context>"),V.push(UA),V.push(`</subagent-context>
43
43
  `),V.push("<task>"),V.push(t.prompt),V.push(`</task>
44
44
  `),v&&(V.push("<agent>"),V.push(`# Agent: ${v.name}
45
45
  `),V.push("## Role & Responsibilities"),V.push(v.content),V.push(`</agent>
46
- `)),f.length>0){V.push("<skills>"),V.push(`You have access to the following skills and capabilities:
47
- `);for(let z=0;z<f.length;z++){let G=f[z],Be=Iv(G);Be&&(V.push(`## Skill ${z+1}: ${G}`),V.push(Be),V.push(`---
46
+ `)),h.length>0){V.push("<skills>"),V.push(`You have access to the following skills and capabilities:
47
+ `);for(let d=0;d<h.length;d++){let G=h[d],De=Cv(G);De&&(V.push(`## Skill ${d+1}: ${G}`),V.push(De),V.push(`---
48
48
  `))}V.push(`</skills>
49
- `)}rt.length>0&&V.push(Po(rt));let uA=V.join(`
50
- `),EA=t.prompt.length>150?t.prompt.substring(0,150):t.prompt;console.log(),u.info(`Spawning ${s.primary(Ot)} agent with model: ${s.primary(A)}`),n&&u.info(`Parent session: ${s.dim(n.slice(0,20)+"...")}`),o&&u.info(`Active plan: ${s.dim(o)}`),f.length>0&&u.info(`Injected skills: ${s.dim(f.join(", "))}`),rt.length>0&&u.info(`Injected context: ${s.dim(rt.map(z=>z.name).join(", "))}`),console.log(M.line()),console.log();let ot=null;I&&(ot=new Wo({audioFile:E,loop:!0,volume:.3}),ot.start()&&(console.log(s.dim("Playing elevator music while waiting...")),console.log()));let qo=rt.map(z=>z.path||z.name),Wc=jo("gemini-sub",process.pid);n&&l&&xo(l,n,{gkSessionId:Wc,pid:process.pid,parentGkSessionId:n,agentRole:Ot,prompt:t.prompt,model:A,injected:f.length>0||qo.length>0?{skills:f,context:qo}:null});let Do=AI(Ot),Ut=rI("gemini",["-y","-m",A],{stdio:["pipe","pipe","pipe"],shell:process.platform==="win32",env:{...process.env,GEMINI_TYPE:"sub-agent",GEMINI_PARENT_SESSION_ID:r||"",GK_PARENT_SESSION_ID:n||"",GK_SUB_SESSION_ID:Wc,GEMINI_AGENT_ROLE:Ot,GEMINI_AGENT_PROMPT:EA,GEMINI_AGENT_MODEL:A||"",GEMINI_AGENT_SKILLS:f.join(","),GEMINI_AGENT_CONTEXT:qo.join(","),GK_ACTIVE_PLAN:o||"",GK_SUGGESTED_PLAN:a||"",GK_PLAN_DATE_FORMAT:c||""}}),yo="",wo="";Ut.stdout.on("data",z=>{yo+=z.toString()}),Ut.stderr.on("data",z=>{wo+=z.toString()}),Ut.stdin.write(uA),Ut.stdin.end(),Ut.on("close",z=>{Do.stop(),ot&&(ot.stop(),console.log(s.dim("Music stopped."))),console.log(),yo&&console.log(yo),wo&&console.error(wo),z===0?u.success(`${Ot} agent completed successfully`):u.error(`${Ot} agent exited with code: ${z}`),console.log(),process.exit(z||0)}),Ut.on("error",z=>{Do.stop(),ot&&ot.stop(),console.log(),u.error(`Failed to spawn agent: ${z.message}`),console.log(),process.exit(1)}),process.on("SIGINT",()=>{Do.stop(),ot&&ot.stop(),Ut.kill("SIGTERM"),process.exit(1)})}function RI(){console.log(),console.log(p.default.bold(s.geminiPurple("Session Management"))),console.log(),console.log("Usage:"),console.log(` ${s.primary("gk session")} <subcommand> [options]`),console.log(),console.log("Subcommands:"),console.log(` ${s.primary("status")} Show active session (default)`),console.log(` ${s.primary("list")} List recent sessions`),console.log(` ${s.primary("info")} <id> Show session details`),console.log(` ${s.primary("agents")} [id] List agents in session`),console.log(` ${s.primary("init")} [app] Initialize new session`),console.log(),console.log("Options:"),console.log(` ${s.dim("--json")} Output as JSON`),console.log(` ${s.dim("-n, --limit <n>")} Number of results for list (default: 10)`),console.log(),console.log("Examples:"),console.log(` ${s.dim("gk session status")}`),console.log(` ${s.dim("gk session list -n 20")}`),console.log(` ${s.dim("gk session info abc123")}`),console.log(` ${s.dim("gk session agents")}`),console.log(` ${s.dim("gk session init myapp")}`),console.log()}function kv(t){t.command("session [subcommand] [id]","Session management (status, list, info, agents, init)").alias("s").option("--json","[all] Output as JSON").option("-n, --limit <n>","[list] Number of results",{default:10}).action(async(e,i,n)=>{switch(e||"status"){case"status":await dI(n);break;case"list":await jI(n);break;case"info":i||(console.log(),u.error("Session ID required"),console.log(s.dim("Usage: gk session info <id>")),console.log(),process.exit(1)),await gI(i,n);break;case"agents":await xI(i,n);break;case"init":await GI(i||"app",n);break;default:RI()}})}async function dI(t){let e=N(),i=it(),n=e.ACTIVE_GK_SESSION_ID;if(!n){t.json?console.log(JSON.stringify({active:!1,projectDir:i},null,2)):(console.log(),u.info("No active GemKit session."),console.log(s.dim(` Project: ${i}`)),console.log());return}let r=Ye(i,n);if(t.json){console.log(JSON.stringify(r||{active:!1,gkSessionId:n},null,2));return}if(!r){console.log(),u.warn(`Session ID in .env but file not found: ${n}`),console.log(s.dim(` Project: ${i}`)),console.log();return}let o=Rv(i,n),c=r.agents?.find(l=>l.agentType==="Main Agent")?.status||"active";console.log(),console.log(p.default.bold(s.geminiPurple("Active Session"))),console.log(M.line()),console.log(),console.log(` ${s.dim("GK Session ID:")} ${s.primary(r.gkSessionId)}`),console.log(` ${s.dim("Gemini Session ID:")} ${r.geminiSessionId||s.dim("N/A")}`),console.log(` ${s.dim("Project Dir:")} ${r.projectDir}`),console.log(` ${s.dim("App Name:")} ${r.appName}`),console.log(` ${s.dim("PID:")} ${r.pid}`),console.log(` ${s.dim("Status:")} ${M.statusIcon(c)} ${c}`),console.log(` ${s.dim("Started:")} ${r.initTimestamp}`),r.activePlan&&console.log(` ${s.dim("Active Plan:")} ${s.primary(r.activePlan)}`),console.log(),console.log(` ${s.dim("Agents:")} ${o.total} total (${o.mainAgents} main, ${o.subAgents} sub)`),console.log(` ${s.success(String(o.completed))} completed, ${s.error(String(o.failed))} failed, ${o.active} active`),console.log()}async function jI(t){let e=it(),i=zv(e,{limit:t.limit});if(t.json){console.log(JSON.stringify(i,null,2));return}if(console.log(),console.log(p.default.bold(s.geminiPurple("Recent Sessions"))),console.log(s.dim(` Project: ${e}`)),console.log(),i.length===0){u.info(" No sessions found."),console.log();return}for(let n of i){let r=new Date(n.initTimestamp).toLocaleString(),a=n.agents?.find(l=>l.agentType==="Main Agent")?.status||"active",c=n.gkSessionId.length>25?n.gkSessionId.slice(0,25)+"...":n.gkSessionId;console.log(` ${M.statusIcon(a)} ${s.primary(c)} ${s.dim(r)}`),n.activePlan&&console.log(` ${s.dim("Plan:")} ${n.activePlan}`)}console.log(),console.log(s.dim(` Showing ${i.length} sessions (limit: ${t.limit})`)),console.log()}async function gI(t,e){let i=it(),n=Ye(i,t);if(n||(console.log(),u.error(`Session not found: ${t}`),console.log(s.dim(` Looked in: ~/.gemkit/projects/${i}/`)),console.log(),process.exit(1)),e.json){console.log(JSON.stringify(n,null,2));return}console.log(),console.log(p.default.bold(s.geminiPurple(`Session: ${n.gkSessionId}`))),console.log(M.line()),console.log(),console.log(JSON.stringify(n,null,2)),console.log()}async function xI(t,e){let i=it(),n=t||ri();n||(console.log(),u.error("No session ID provided and no active session found."),console.log(),process.exit(1));let r=Ye(i,n);r||(console.log(),u.error(`Session not found: ${n}`),console.log(),process.exit(1));let o=r.agents||[];if(e.json){console.log(JSON.stringify(o,null,2));return}let a=n.length>30?n.slice(0,30)+"...":n;if(console.log(),console.log(p.default.bold(s.geminiPurple("Agents in Session"))),console.log(s.dim(` ${a}`)),console.log(),o.length===0){u.info(" No agents in this session."),console.log();return}for(let c=0;c<o.length;c++){let l=o[c],v=l.agentRole||"unknown",A=l.model||"default",m=l.agentType==="Main Agent"?s.primary("MAIN"):s.dim("SUB");if(console.log(` ${M.statusIcon(l.status)} [${m}] ${s.primary(v)} ${s.dim(`(${A})`)}`),l.prompt){let I=l.prompt.length>60?l.prompt.slice(0,60)+"...":l.prompt;console.log(` ${s.dim("Prompt:")} ${I}`)}l.tokenUsage&&console.log(` ${s.dim("Tokens:")} ${l.tokenUsage.total.toLocaleString()} total`),l.geminiSessionId&&console.log(` ${s.dim("Gemini ID:")} ${l.geminiSessionId.slice(0,8)}...`)}console.log(),console.log(s.dim(` Total: ${o.length} agents`)),console.log()}async function GI(t,e){let n=N().ACTIVE_GK_SESSION_ID;if(n){let l=Yv(n),v=it();if(l){let A=tc();if(Ye(v,n)&&l.pid===A){e.json?console.log(JSON.stringify({status:"existing",gkSessionId:n,pid:l.pid},null,2)):(console.log(),u.info(`GemKit session already active: ${s.primary(n.slice(0,30)+"...")}`),console.log(s.dim(` PID: ${l.pid}`)),console.log());return}}}let{session:r,gkSessionId:o,pid:a,projectDir:c}=Gv(t);xo(c,o,{gkSessionId:o,pid:a,geminiSessionId:null,parentGkSessionId:null,agentRole:"main",prompt:null,model:null}),e.json?console.log(JSON.stringify({status:"initialized",gkSessionId:o,pid:a,projectDir:c},null,2)):(console.log(),u.success(`GemKit session initialized: ${s.primary(o.slice(0,30)+"...")}`),console.log(s.dim(` PID: ${a}`)),console.log())}import{existsSync as Bn,readdirSync as SI,mkdirSync as Mo,writeFileSync as oc,statSync as YI}from"fs";import{join as oi}from"path";function ac(t){let e=Ei(t);if(!Bn(e))return[];let i=Jn();return SI(e,{withFileTypes:!0}).filter(r=>r.isDirectory()).map(r=>r.name).map(r=>{let o=oi(e,r),a=oi(o,"plan.md"),c="";return Bn(a)&&(c=YI(a).birthtime.toISOString()),{name:r,path:o,createdAt:c,isActive:r===i}})}function Fv(t,e){let i=Ei(e),n=oi(i,t);if(Bn(i)||Mo(i,{recursive:!0}),Bn(n))throw new Error(`Plan already exists: ${t}`);Mo(n,{recursive:!0}),Mo(oi(n,"research"),{recursive:!0}),Mo(oi(n,"artifacts"),{recursive:!0});let r=`# ${t}
49
+ `)}lt.length>0&&V.push(ts(lt));let KA=V.join(`
50
+ `),VA=t.prompt.length>150?t.prompt.substring(0,150):t.prompt;console.log(),m.info(`Spawning ${a.primary(Ft)} agent with model: ${a.primary(A)}`),n&&m.info(`Parent session: ${a.dim(n.slice(0,20)+"...")}`),o&&m.info(`Active plan: ${a.dim(o)}`),h.length>0&&m.info(`Injected skills: ${a.dim(h.join(", "))}`),lt.length>0&&m.info(`Injected context: ${a.dim(lt.map(d=>d.name).join(", "))}`),console.log(M.line()),console.log();let vt=null;I&&(vt=new Fo({audioFile:E,loop:!0,volume:.3}),vt.start()&&(console.log(a.dim("Playing elevator music while waiting...")),console.log()));let is=lt.map(d=>d.path||d.name),Zc=Oo("gemini-sub",process.pid);n&&l&&Ko(l,n,{gkSessionId:Zc,pid:process.pid,parentGkSessionId:n,agentRole:Ft,prompt:t.prompt,model:A,injected:h.length>0||is.length>0?{skills:h,context:is}:null});let ns=qI(Ft),Qt=FI("gemini",["-y","-m",A],{stdio:["pipe","pipe","pipe"],shell:process.platform==="win32",env:{...process.env,GEMINI_TYPE:"sub-agent",GEMINI_PARENT_SESSION_ID:r||"",GK_PARENT_SESSION_ID:n||"",GK_SUB_SESSION_ID:Zc,GEMINI_AGENT_ROLE:Ft,GEMINI_AGENT_PROMPT:VA,GEMINI_AGENT_MODEL:A||"",GEMINI_AGENT_SKILLS:h.join(","),GEMINI_AGENT_CONTEXT:is.join(","),GK_ACTIVE_PLAN:o||"",GK_SUGGESTED_PLAN:s||"",GK_PLAN_DATE_FORMAT:c||""}}),rs="",os="";Qt.stdout.on("data",d=>{rs+=d.toString()}),Qt.stderr.on("data",d=>{os+=d.toString()}),Qt.stdin.write(KA),Qt.stdin.end(),Qt.on("close",d=>{ns.stop(),vt&&(vt.stop(),console.log(a.dim("Music stopped."))),console.log(),rs&&console.log(rs),os&&console.error(os),d===0?m.success(`${Ft} agent completed successfully`):m.error(`${Ft} agent exited with code: ${d}`),console.log(),process.exit(d||0)}),Qt.on("error",d=>{ns.stop(),vt&&vt.stop(),console.log(),m.error(`Failed to spawn agent: ${d.message}`),console.log(),process.exit(1)}),process.on("SIGINT",()=>{ns.stop(),vt&&vt.stop(),Qt.kill("SIGTERM"),process.exit(1)})}function $I(){console.log(),console.log(p.default.bold(a.geminiPurple("Session Management"))),console.log(),console.log("Usage:"),console.log(` ${a.primary("gk session")} <subcommand> [options]`),console.log(),console.log("Subcommands:"),console.log(` ${a.primary("status")} Show active session (default)`),console.log(` ${a.primary("list")} List recent sessions`),console.log(` ${a.primary("info")} <id> Show session details`),console.log(` ${a.primary("agents")} [id] List agents in session`),console.log(` ${a.primary("init")} [app] Initialize new session`),console.log(),console.log("Options:"),console.log(` ${a.dim("--json")} Output as JSON`),console.log(` ${a.dim("-n, --limit <n>")} Number of results for list (default: 10)`),console.log(),console.log("Examples:"),console.log(` ${a.dim("gk session status")}`),console.log(` ${a.dim("gk session list -n 20")}`),console.log(` ${a.dim("gk session info abc123")}`),console.log(` ${a.dim("gk session agents")}`),console.log(` ${a.dim("gk session init myapp")}`),console.log()}function Lv(t){t.command("session [subcommand] [id]","Session management (status, list, info, agents, init)").alias("s").option("--json","[all] Output as JSON").option("-n, --limit <n>","[list] Number of results",{default:10}).action(async(e,i,n)=>{switch(e||"status"){case"status":await ep(n);break;case"list":await tp(n);break;case"info":i||(console.log(),m.error("Session ID required"),console.log(a.dim("Usage: gk session info <id>")),console.log(),process.exit(1)),await ip(i,n);break;case"agents":await np(i,n);break;case"init":await rp(i||"app",n);break;default:$I()}})}async function ep(t){let e=N(),i=at(),n=e.ACTIVE_GK_SESSION_ID;if(!n){t.json?console.log(JSON.stringify({active:!1,projectDir:i},null,2)):(console.log(),m.info("No active GemKit session."),console.log(a.dim(` Project: ${i}`)),console.log());return}let r=Ce(i,n);if(t.json){console.log(JSON.stringify(r||{active:!1,gkSessionId:n},null,2));return}if(!r){console.log(),m.warn(`Session ID in .env but file not found: ${n}`),console.log(a.dim(` Project: ${i}`)),console.log();return}let o=Nv(i,n),c=r.agents?.find(l=>l.agentType==="Main Agent")?.status||"active";console.log(),console.log(p.default.bold(a.geminiPurple("Active Session"))),console.log(M.line()),console.log(),console.log(` ${a.dim("GK Session ID:")} ${a.primary(r.gkSessionId)}`),console.log(` ${a.dim("Gemini Session ID:")} ${r.geminiSessionId||a.dim("N/A")}`),console.log(` ${a.dim("Project Dir:")} ${r.projectDir}`),console.log(` ${a.dim("App Name:")} ${r.appName}`),console.log(` ${a.dim("PID:")} ${r.pid}`),console.log(` ${a.dim("Status:")} ${M.statusIcon(c)} ${c}`),console.log(` ${a.dim("Started:")} ${r.initTimestamp}`),r.activePlan&&console.log(` ${a.dim("Active Plan:")} ${a.primary(r.activePlan)}`),console.log(),console.log(` ${a.dim("Agents:")} ${o.total} total (${o.mainAgents} main, ${o.subAgents} sub)`),console.log(` ${a.success(String(o.completed))} completed, ${a.error(String(o.failed))} failed, ${o.active} active`),console.log()}async function tp(t){let e=at(),i=Vv(e,{limit:t.limit});if(t.json){console.log(JSON.stringify(i,null,2));return}if(console.log(),console.log(p.default.bold(a.geminiPurple("Recent Sessions"))),console.log(a.dim(` Project: ${e}`)),console.log(),i.length===0){m.info(" No sessions found."),console.log();return}for(let n of i){let r=new Date(n.initTimestamp).toLocaleString(),s=n.agents?.find(l=>l.agentType==="Main Agent")?.status||"active",c=n.gkSessionId.length>25?n.gkSessionId.slice(0,25)+"...":n.gkSessionId;console.log(` ${M.statusIcon(s)} ${a.primary(c)} ${a.dim(r)}`),n.activePlan&&console.log(` ${a.dim("Plan:")} ${n.activePlan}`)}console.log(),console.log(a.dim(` Showing ${i.length} sessions (limit: ${t.limit})`)),console.log()}async function ip(t,e){let i=at(),n=Ce(i,t);if(n||(console.log(),m.error(`Session not found: ${t}`),console.log(a.dim(` Looked in: ~/.gemkit/projects/${i}/`)),console.log(),process.exit(1)),e.json){console.log(JSON.stringify(n,null,2));return}console.log(),console.log(p.default.bold(a.geminiPurple(`Session: ${n.gkSessionId}`))),console.log(M.line()),console.log(),console.log(JSON.stringify(n,null,2)),console.log()}async function np(t,e){let i=at(),n=t||vi();n||(console.log(),m.error("No session ID provided and no active session found."),console.log(),process.exit(1));let r=Ce(i,n);r||(console.log(),m.error(`Session not found: ${n}`),console.log(),process.exit(1));let o=r.agents||[];if(e.json){console.log(JSON.stringify(o,null,2));return}let s=n.length>30?n.slice(0,30)+"...":n;if(console.log(),console.log(p.default.bold(a.geminiPurple("Agents in Session"))),console.log(a.dim(` ${s}`)),console.log(),o.length===0){m.info(" No agents in this session."),console.log();return}for(let c=0;c<o.length;c++){let l=o[c],v=l.agentRole||"unknown",A=l.model||"default",u=l.agentType==="Main Agent"?a.primary("MAIN"):a.dim("SUB");if(console.log(` ${M.statusIcon(l.status)} [${u}] ${a.primary(v)} ${a.dim(`(${A})`)}`),l.prompt){let I=l.prompt.length>60?l.prompt.slice(0,60)+"...":l.prompt;console.log(` ${a.dim("Prompt:")} ${I}`)}l.tokenUsage&&console.log(` ${a.dim("Tokens:")} ${l.tokenUsage.total.toLocaleString()} total`),l.geminiSessionId&&console.log(` ${a.dim("Gemini ID:")} ${l.geminiSessionId.slice(0,8)}...`)}console.log(),console.log(a.dim(` Total: ${o.length} agents`)),console.log()}async function rp(t,e){let n=N().ACTIVE_GK_SESSION_ID;if(n){let l=Zv(n),v=at();if(l){let A=mc();if(Ce(v,n)&&l.pid===A){e.json?console.log(JSON.stringify({status:"existing",gkSessionId:n,pid:l.pid},null,2)):(console.log(),m.info(`GemKit session already active: ${a.primary(n.slice(0,30)+"...")}`),console.log(a.dim(` PID: ${l.pid}`)),console.log());return}}}let{session:r,gkSessionId:o,pid:s,projectDir:c}=bv(t);Ko(c,o,{gkSessionId:o,pid:s,geminiSessionId:null,parentGkSessionId:null,agentRole:"main",prompt:null,model:null}),e.json?console.log(JSON.stringify({status:"initialized",gkSessionId:o,pid:s,projectDir:c},null,2)):(console.log(),m.success(`GemKit session initialized: ${a.primary(o.slice(0,30)+"...")}`),console.log(a.dim(` PID: ${s}`)),console.log())}import{existsSync as Tn,readdirSync as op,mkdirSync as Qo,writeFileSync as fc,statSync as sp}from"fs";import{join as Ai}from"path";function hc(t){let e=di(t);if(!Tn(e))return[];let i=wn();return op(e,{withFileTypes:!0}).filter(r=>r.isDirectory()).map(r=>r.name).map(r=>{let o=Ai(e,r),s=Ai(o,"plan.md"),c="";return Tn(s)&&(c=sp(s).birthtime.toISOString()),{name:r,path:o,createdAt:c,isActive:r===i}})}function _v(t,e){let i=di(e),n=Ai(i,t);if(Tn(i)||Qo(i,{recursive:!0}),Tn(n))throw new Error(`Plan already exists: ${t}`);Qo(n,{recursive:!0}),Qo(Ai(n,"research"),{recursive:!0}),Qo(Ai(n,"artifacts"),{recursive:!0});let r=`# ${t}
51
51
 
52
52
  ## Overview
53
53
 
@@ -61,14 +61,14 @@ Tip: Place file in .docs/, .plans/, docs/, plans/, or project root`)}}try{if((aw
61
61
 
62
62
  ## Notes
63
63
 
64
- `;return oc(oi(n,"plan.md"),r),{name:t,path:n,createdAt:new Date().toISOString(),isActive:!1}}function sc(t,e){let i=ri();if(!i){let o=Vt(e),a=N(),c=["# Auto-generated by gemkit-cli",`# Updated at: ${new Date().toISOString()}`,"","# GEMKIT IDs",`ACTIVE_GK_SESSION_ID=${a.ACTIVE_GK_SESSION_ID||""}`,`GK_PROJECT_HASH=${a.GK_PROJECT_HASH||""}`,`PROJECT_DIR=${a.PROJECT_DIR||""}`,"","# GEMINI IDs (mapped)",`ACTIVE_GEMINI_SESSION_ID=${a.ACTIVE_GEMINI_SESSION_ID||""}`,`GEMINI_PROJECT_HASH=${a.GEMINI_PROJECT_HASH||""}`,"","# PLAN INFO",`ACTIVE_PLAN=${t}`,`SUGGESTED_PLAN=${a.SUGGESTED_PLAN||""}`,`PLAN_DATE_FORMAT=${a.PLAN_DATE_FORMAT||""}`,""].join(`
65
- `);return oc(o,c),!0}let n=it(e);if(!Ye(n,i)){let o=Vt(e),a=N(),c=["# Auto-generated by gemkit-cli",`# Updated at: ${new Date().toISOString()}`,"","# GEMKIT IDs",`ACTIVE_GK_SESSION_ID=${a.ACTIVE_GK_SESSION_ID||""}`,`GK_PROJECT_HASH=${a.GK_PROJECT_HASH||""}`,`PROJECT_DIR=${a.PROJECT_DIR||""}`,"","# GEMINI IDs (mapped)",`ACTIVE_GEMINI_SESSION_ID=${a.ACTIVE_GEMINI_SESSION_ID||""}`,`GEMINI_PROJECT_HASH=${a.GEMINI_PROJECT_HASH||""}`,"","# PLAN INFO",`ACTIVE_PLAN=${t}`,`SUGGESTED_PLAN=${a.SUGGESTED_PLAN||""}`,`PLAN_DATE_FORMAT=${a.PLAN_DATE_FORMAT||""}`,""].join(`
66
- `);return oc(o,c),!0}return Sv(n,i,t)}function Qv(t,e){let i=Ei(e),n=oi(i,t);if(!Bn(n))return null;let r=Jn();return{name:t,path:n,createdAt:"",isActive:t===r}}function WI(){console.log(),console.log(p.default.bold(s.geminiPurple("Plan Management"))),console.log(),console.log("Usage:"),console.log(` ${s.primary("gk plan")} <subcommand> [options]`),console.log(),console.log("Subcommands:"),console.log(` ${s.primary("list")} List all plans (default)`),console.log(` ${s.primary("status")} Show active plan status`),console.log(` ${s.primary("create")} <name> Create new plan`),console.log(` ${s.primary("set")} <name> Set active plan`),console.log(` ${s.primary("info")} Get plan info from .env`),console.log(),console.log("Options:"),console.log(` ${s.dim("--json")} Output as JSON`),console.log(` ${s.dim("-a, --active")} [info] Show only ACTIVE_PLAN value`),console.log(` ${s.dim("-s, --suggested")} [info] Show only SUGGESTED_PLAN value`),console.log(` ${s.dim("-f, --format")} [info] Show only PLAN_DATE_FORMAT value`),console.log(),console.log("Examples:"),console.log(` ${s.dim("gk plan list")}`),console.log(` ${s.dim("gk plan create my-feature")}`),console.log(` ${s.dim("gk plan set my-feature")}`),console.log(` ${s.dim("gk plan info --active")}`),console.log()}function Jv(t){t.command("plan [subcommand] [name]","Plan management (list, status, create, set, info)").alias("p").option("--json","[all] Output as JSON").option("-a, --active","[info] Show only ACTIVE_PLAN value").option("-s, --suggested","[info] Show only SUGGESTED_PLAN value").option("-f, --format","[info] Show only PLAN_DATE_FORMAT value").action(async(e,i,n)=>{switch(e||"list"){case"list":await MI(n);break;case"status":await CI(n);break;case"create":i||(console.log(),u.error("Plan name required"),console.log(s.dim("Usage: gk plan create <name>")),console.log(),process.exit(1)),await OI(i);break;case"set":i||(console.log(),u.error("Plan name required"),console.log(s.dim("Usage: gk plan set <name>")),console.log(),process.exit(1)),await UI(i);break;case"info":await KI(n);break;default:WI()}})}async function MI(t){let e=ac();if(t.json){console.log(JSON.stringify(e,null,2));return}if(console.log(),console.log(p.default.bold(s.geminiPurple("Project Plans"))),console.log(),e.length===0){u.info('No plans found. Create one with "gk plan create <name>".'),console.log();return}for(let i of e){let n=i.isActive?s.success("\u2192"):s.dim("\u25CB"),r=i.isActive?s.success(" (active)"):"";console.log(` ${n} ${s.primary(i.name)}${r}`),console.log(` ${s.dim("Created:")} ${s.dim(new Date(i.createdAt).toLocaleDateString())}`)}console.log()}async function CI(t){let e=Jn();if(!e){t.json?console.log(JSON.stringify({active:!1},null,2)):(console.log(),u.info("No active plan set."),console.log());return}let i=Qv(e);if(t.json){console.log(JSON.stringify(i,null,2));return}console.log(),console.log(M.line()),console.log(p.default.bold(s.geminiPurple("Active Plan"))),console.log(M.line()),console.log(),console.log(` ${s.primary(e)}`),console.log()}async function OI(t){try{let e=Fv(t);console.log(),u.success(`Plan created: ${s.primary(t)}`),u.info(`Path: ${s.dim(e.path)}`),sc(t),u.info("Set as active plan."),console.log()}catch(e){console.log(),u.error(`Failed to create plan: ${e instanceof Error?e.message:String(e)}`),console.log()}}async function UI(t){if(!ac().some(o=>o.name===t)){console.log(),u.error(`Plan not found: ${t}`),console.log();return}if(!sc(t)){console.log(),u.error("Failed to update session or env file"),console.log();return}let r=ri();console.log(),r&&u.success(`Session ${r.slice(0,20)}...: activePlan set to: ${s.primary(t)}`),u.info(`Environment updated: ACTIVE_PLAN = ${t}`),console.log(),u.success(`Active plan set to: ${s.primary(t)}`),console.log()}async function KI(t){let e=N(),i={activePlan:e.ACTIVE_PLAN||null,suggestedPlan:e.SUGGESTED_PLAN||null,planDateFormat:e.PLAN_DATE_FORMAT||null,gkSessionId:e.ACTIVE_GK_SESSION_ID||null,projectDir:e.PROJECT_DIR||null};if(t.active){t.json?console.log(JSON.stringify({activePlan:i.activePlan})):console.log(i.activePlan||"");return}if(t.suggested){t.json?console.log(JSON.stringify({suggestedPlan:i.suggestedPlan})):console.log(i.suggestedPlan||"");return}if(t.format){t.json?console.log(JSON.stringify({planDateFormat:i.planDateFormat})):console.log(i.planDateFormat||"");return}if(t.json)console.log(JSON.stringify({activePlan:i.activePlan,suggestedPlan:i.suggestedPlan,planDateFormat:i.planDateFormat,context:{gkSessionId:i.gkSessionId,projectDir:i.projectDir}},null,2));else{console.log(),console.log(M.line()),console.log(p.default.bold(s.geminiPurple("Plan Information"))),console.log(M.line()),console.log(),console.log(` ${s.dim("Active Plan:")} ${i.activePlan||s.dim("(not set)")}`),console.log(` ${s.dim("Suggested Plan:")} ${i.suggestedPlan||s.dim("(not set)")}`),console.log(` ${s.dim("Date Format:")} ${i.planDateFormat||s.dim("(not set)")}`),console.log(),console.log(M.line());let n=i.gkSessionId?i.gkSessionId.substring(0,25)+"...":s.dim("(no session)");console.log(` ${s.dim("Session:")} ${n}`),console.log(` ${s.dim("Project:")} ${i.projectDir||s.dim("(unknown)")}`),console.log()}}import{existsSync as VI,readFileSync as NI,readdirSync as kI}from"fs";import{join as Bv}from"path";import{homedir as FI}from"os";async function Zv(){let t=Ro();return t?QI(t):null}function QI(t){let e=Bv(FI(),".gemini","tmp",t,"chats");if(!VI(e))return null;let i=kI(e).filter(n=>n.startsWith("session-")&&n.endsWith(".json")).sort().reverse();if(i.length===0)return null;try{let n=Bv(e,i[0]);return JI(n)}catch{return null}}function JI(t){try{let e=NI(t,"utf-8"),i=JSON.parse(e);if(!i.messages||i.messages.length===0)return null;let n=new Set,r=0,o=0,a=0,c,l=0;for(let f of i.messages)f.model&&n.add(f.model),f.tokens&&(r+=f.tokens.output||0,o+=f.tokens.thoughts||0,a+=f.tokens.tool||0,c=f.tokens,l++);if(!c||l===0)return null;let v=c.total||0,A=c.cached||0,m=v-r-o;m<0&&(m=0);let I={input:m,output:r,cached:A,thoughts:o,tool:a,total:v},E=null;if(i.startTime&&i.lastUpdated)try{let f=new Date(i.startTime),H=new Date(i.lastUpdated),ce=Math.floor((H.getTime()-f.getTime())/1e3),bo=Math.floor(ce/60),Po=ce%60;E={seconds:ce,formatted:`${bo}m ${Po}s`}}catch{}let h=Array.from(n),d=h[0]||"unknown";return{sessionId:i.sessionId,startTime:i.startTime||null,lastUpdated:i.lastUpdated||null,duration:E,model:d,modelsUsed:h,messageCount:l,tokens:I,averages:{outputPerMessage:l>0?Math.round(r/l):0,thoughtsPerMessage:l>0?Math.round(o/l):0,toolPerMessage:l>0?Math.round(a/l):0}}}catch{return null}}var Zn={"gemini-3-pro-preview":{input:2,output:12,cached:.2,thoughts:12},"gemini-3-flash-preview":{input:.5,output:3,cached:.05,thoughts:3},"gemini-2.5-pro":{input:1.25,output:10,cached:.125,thoughts:10},"gemini-2.5-pro-preview":{input:1.25,output:10,cached:.125,thoughts:10},"gemini-2.5-flash":{input:.3,output:2.5,cached:.03,thoughts:2.5},"gemini-2.5-flash-lite":{input:.1,output:.4,cached:.01,thoughts:.4},"gemini-2.0-flash":{input:.1,output:.4,cached:.01,thoughts:.4},"gemini-2.0-flash-exp":{input:.1,output:.4,cached:.01,thoughts:.4},default:{input:.5,output:3,cached:.05,thoughts:3}};function BI(t){if(Zn[t])return Zn[t];for(let e of Object.keys(Zn))if(e.includes(t)||t.includes(e))return Zn[e];return Zn.default}function cc(t,e="default"){let i=BI(e),n=t.input-t.cached;n<0&&(n=0);let r=n/1e6*i.input,o=t.output/1e6*i.output,a=t.cached/1e6*i.cached,c=t.thoughts/1e6*i.thoughts;return{input:r,output:o,cached:a,thoughts:c,total:r+o+a+c,model:e,pricing:i}}function Gt(t){return t>=1?`$${t.toFixed(2)}`:t>=.01?`$${t.toFixed(3)}`:t>=.001?`$${t.toFixed(4)}`:`$${t.toFixed(6)}`}function lc(t){return t>=1e6?`${(t/1e6).toFixed(1)}M`:t>=1e3?`${(t/1e3).toFixed(1)}K`:String(t)}var Yt={topLeft:"\u256D",topRight:"\u256E",bottomLeft:"\u2570",bottomRight:"\u256F",horizontal:"\u2500",vertical:"\u2502",middleLeft:"\u251C",middleRight:"\u2524"};function ZI(t=75){return s.dim(`${Yt.topLeft}${Yt.horizontal.repeat(t-2)}${Yt.topRight}`)}function bI(t=75){return s.dim(`${Yt.bottomLeft}${Yt.horizontal.repeat(t-2)}${Yt.bottomRight}`)}function PI(t,e=75){let i=t.replace(/\x1b\[[0-9;]*m/g,"").length,n=Math.max(0,e-4-i);return`${s.dim(Yt.vertical)} ${t}${" ".repeat(n)} ${s.dim(Yt.vertical)}`}function vc(t){return`
67
- ${p.default.bold(s.geminiPurple(`## ${t}`))}`}function We(t,e){let i=t.replace(/\x1b\[[0-9;]*m/g,"").length,n=Math.max(0,e-i);return" ".repeat(n)+t}function St(t,e){let i=t.replace(/\x1b\[[0-9;]*m/g,"").length,n=Math.max(0,e-i);return t+" ".repeat(n)}function qI(t){let e=[],i=t.length;for(let n=0;n<i;n++){let r=n/Math.max(i-1,1),o=Math.round(26+116*r),a=Math.round(115+-79*r),c=Math.round(232+-62*r);e.push(`\x1B[38;2;${o};${a};${c}m${t[n]}`)}return e.join("")+"\x1B[0m"}function DI(t){let e=cc(t.tokens,t.model);console.log(),console.log(ZI(75)),console.log(PI(`${qI("SESSION ANALYSIS")} ${s.dim("Cost:")} ${s.warn(Gt(e.total))}`,75)),console.log(bI(75)),console.log(`
68
- ${s.dim("Session ID:")} ${s.accent(t.sessionId)}`),console.log(` ${s.dim("Start Time:")} ${t.startTime||"N/A"}`),console.log(` ${s.dim("Duration:")} ${s.accent(t.duration?.formatted||"N/A")}`),console.log(` ${s.dim("Model:")} ${s.geminiBlue(t.modelsUsed.join(", "))}`),console.log(` ${s.dim("Messages:")} ${s.accent(String(t.messageCount))}`),console.log(vc("Token Breakdown")),console.log(`
69
- ${St("Category",10)} ${We("Count",14)} ${We("Formatted",10)}`),console.log(` ${s.dim("\u2500".repeat(10))} ${s.dim("\u2500".repeat(14))} ${s.dim("\u2500".repeat(10))}`);let i=["input","output","cached","thoughts","tool"];for(let o of i){let a=t.tokens[o],c=We(s.accent(a.toLocaleString()),14),l=We(s.accent(lc(a)),10);console.log(` ${St(o,10)} ${c} ${l}`)}console.log(` ${s.dim("\u2500".repeat(10))} ${s.dim("\u2500".repeat(14))} ${s.dim("\u2500".repeat(10))}`);let n=We(s.success(t.tokens.total.toLocaleString()),14),r=We(s.success(lc(t.tokens.total)),10);if(console.log(` ${St(p.default.bold("total"),10)} ${n} ${r}`),console.log(vc("Estimated Cost")),console.log(`
70
- ${St("Input",12)} ${We(s.warn(Gt(e.input)),12)}`),console.log(` ${St("Output",12)} ${We(s.warn(Gt(e.output)),12)}`),console.log(` ${St("Cached",12)} ${We(s.warn(Gt(e.cached)),12)}`),console.log(` ${St("Thoughts",12)} ${We(s.warn(Gt(e.thoughts)),12)}`),console.log(` ${s.dim("\u2500".repeat(24))}`),console.log(` ${St(p.default.bold("TOTAL"),12)} ${We(p.default.bold(s.warn(Gt(e.total))),12)}`),t.messageCount>0){console.log(vc("Averages"));let o=Math.round(t.tokens.total/t.messageCount),a=e.total/t.messageCount;console.log(`
71
- ${s.dim("Tokens/msg:")} ${s.accent(o.toLocaleString())}`),console.log(` ${s.dim("Cost/msg:")} ${s.warn(Gt(a))}`)}console.log()}function yI(t){let e=cc(t.tokens,t.model);console.log(JSON.stringify({sessionId:t.sessionId,startTime:t.startTime,duration:t.duration,model:t.model,modelsUsed:t.modelsUsed,messageCount:t.messageCount,tokens:t.tokens,averages:t.averages,cost:{input:e.input,output:e.output,cached:e.cached,thoughts:e.thoughts,total:e.total}},null,2))}function bv(t){t.command("tokens","Show token usage for current session").alias("t").option("--json","Output as JSON").action(async e=>{let i=await Zv();if(!i){e.json?console.log(JSON.stringify({found:!1},null,2)):(console.log(),u.info("No token usage found for current session."),console.log());return}if(e.json){yI(i);return}DI(i)})}import{existsSync as wI,readdirSync as TI}from"fs";function Pv(t){let e=t.command("extension <subcommand>","Extension management").alias("ext");e.example("gk extension list # List installed extensions"),e.action(async i=>{let n=i||"list";n==="list"?await XI():(console.log(),u.error(`Unknown subcommand: ${n}`),console.log(),process.exit(1))})}async function XI(){let t=Nt();if(!wI(t)){console.log(),u.info("No extensions directory found."),console.log();return}let e=TI(t,{withFileTypes:!0}).filter(i=>i.isDirectory()).map(i=>i.name);if(e.length===0){console.log(),u.info("No extensions installed."),console.log();return}console.log(),console.log(p.default.bold(s.geminiPurple("Installed Extensions"))),console.log();for(let i of e)console.log(` ${s.success("\u2713")} ${s.primary(i)}`);console.log(),console.log(s.dim(` Total: ${e.length} extensions`)),console.log()}function qv(t){t.command("catalog [subcommand]","Catalog of skills and agents").action(async i=>{let n=i||"skills";switch(n){case"skills":await HI();break;case"agents":await LI();break;default:console.log(),u.error(`Unknown subcommand: ${n}`),console.log(),process.exit(1)}})}async function HI(){let t=Ev();if(console.log(),console.log(p.default.bold(s.geminiPurple("Available Skills"))),console.log(),t.length===0){u.info(" No skills found."),console.log();return}for(let e of t)console.log(` ${s.success("\u2713")} ${s.primary(e.name)}`);console.log(),console.log(s.dim(` Total: ${t.length} skills`)),console.log()}async function LI(){let t=fo();if(console.log(),console.log(p.default.bold(s.geminiPurple("Available Agent Profiles"))),console.log(),t.length===0){u.info(" No agent profiles found."),console.log();return}for(let e of t)console.log(` ${s.success("\u25CF")} ${s.primary(e.name)}`),console.log(` ${s.dim(e.description)}`);console.log(),console.log(s.dim(` Total: ${t.length} profiles`)),console.log()}import{spawnSync as Ji}from"child_process";import{existsSync as bn,mkdirSync as Dv,writeFileSync as _I,statSync as $I}from"fs";import{join as Ac}from"path";import{homedir as e9}from"os";var t9="clipboard-image";function yv(t){t.command("paste-image","Capture clipboard image for Gemini analysis").alias("pi").option("--format <fmt>","Image format (png, jpg)",{default:"png"}).option("--json","Output as JSON").action(async e=>{let i=r9(e),n=c9(i);e.json?console.log(JSON.stringify(n,null,2)):(console.log(),n.success?(console.log(`${s.success("\u2713")} Image captured: ${s.primary(String(n.path))}`),console.log(` ${s.dim("Size:")} ${n.size}`),console.log(` ${s.dim("Platform:")} ${n.platform}`)):(console.error(`${s.error("\u2717")} ${n.error}`),n.suggestion&&console.log(` ${s.dim("Hint:")} ${n.suggestion}`)),console.log()),process.exit(i.success?0:1)})}function i9(){let t=Ro();if(t){let i=Ac(e9(),".gemini","tmp",t);return bn(i)||Dv(i,{recursive:!0}),i}let e=Ac(process.cwd(),".gemini","tmp","clipboard");return bn(e)||Dv(e,{recursive:!0}),e}function n9(t="png"){let e=Date.now(),i=Math.random().toString(36).substring(2,8);return`${t9}-${e}-${i}.${t}`}function r9(t){let e=t.format||"png",i=process.platform,n=i9(),r=n9(e),o=Ac(n,r),a;switch(i){case"win32":a=o9(o);break;case"darwin":a=a9(o);break;case"linux":a=s9(o);break;default:a={success:!1,error:`Unsupported platform: ${i}`}}return a.platform=i,a.tempDir=n,a}function o9(t){let e=t.replace(/\\/g,"\\\\"),i=`
64
+ `;return fc(Ai(n,"plan.md"),r),{name:t,path:n,createdAt:new Date().toISOString(),isActive:!1}}function dc(t,e){let i=vi();if(!i){let o=bt(e),s=N(),c=["# Auto-generated by gemkit-cli",`# Updated at: ${new Date().toISOString()}`,"","# GEMKIT IDs",`ACTIVE_GK_SESSION_ID=${s.ACTIVE_GK_SESSION_ID||""}`,`GK_PROJECT_HASH=${s.GK_PROJECT_HASH||""}`,`PROJECT_DIR=${s.PROJECT_DIR||""}`,"","# GEMINI IDs (mapped)",`ACTIVE_GEMINI_SESSION_ID=${s.ACTIVE_GEMINI_SESSION_ID||""}`,`GEMINI_PROJECT_HASH=${s.GEMINI_PROJECT_HASH||""}`,"","# PLAN INFO",`ACTIVE_PLAN=${t}`,`SUGGESTED_PLAN=${s.SUGGESTED_PLAN||""}`,`PLAN_DATE_FORMAT=${s.PLAN_DATE_FORMAT||""}`,""].join(`
65
+ `);return fc(o,c),!0}let n=at(e);if(!Ce(n,i)){let o=bt(e),s=N(),c=["# Auto-generated by gemkit-cli",`# Updated at: ${new Date().toISOString()}`,"","# GEMKIT IDs",`ACTIVE_GK_SESSION_ID=${s.ACTIVE_GK_SESSION_ID||""}`,`GK_PROJECT_HASH=${s.GK_PROJECT_HASH||""}`,`PROJECT_DIR=${s.PROJECT_DIR||""}`,"","# GEMINI IDs (mapped)",`ACTIVE_GEMINI_SESSION_ID=${s.ACTIVE_GEMINI_SESSION_ID||""}`,`GEMINI_PROJECT_HASH=${s.GEMINI_PROJECT_HASH||""}`,"","# PLAN INFO",`ACTIVE_PLAN=${t}`,`SUGGESTED_PLAN=${s.SUGGESTED_PLAN||""}`,`PLAN_DATE_FORMAT=${s.PLAN_DATE_FORMAT||""}`,""].join(`
66
+ `);return fc(o,c),!0}return Bv(n,i,t)}function $v(t,e){let i=di(e),n=Ai(i,t);if(!Tn(n))return null;let r=wn();return{name:t,path:n,createdAt:"",isActive:t===r}}function ap(){console.log(),console.log(p.default.bold(a.geminiPurple("Plan Management"))),console.log(),console.log("Usage:"),console.log(` ${a.primary("gk plan")} <subcommand> [options]`),console.log(),console.log("Subcommands:"),console.log(` ${a.primary("list")} List all plans (default)`),console.log(` ${a.primary("status")} Show active plan status`),console.log(` ${a.primary("create")} <name> Create new plan`),console.log(` ${a.primary("set")} <name> Set active plan`),console.log(` ${a.primary("info")} Get plan info from .env`),console.log(),console.log("Options:"),console.log(` ${a.dim("--json")} Output as JSON`),console.log(` ${a.dim("-a, --active")} [info] Show only ACTIVE_PLAN value`),console.log(` ${a.dim("-s, --suggested")} [info] Show only SUGGESTED_PLAN value`),console.log(` ${a.dim("-f, --format")} [info] Show only PLAN_DATE_FORMAT value`),console.log(),console.log("Examples:"),console.log(` ${a.dim("gk plan list")}`),console.log(` ${a.dim("gk plan create my-feature")}`),console.log(` ${a.dim("gk plan set my-feature")}`),console.log(` ${a.dim("gk plan info --active")}`),console.log()}function eA(t){t.command("plan [subcommand] [name]","Plan management (list, status, create, set, info)").alias("p").option("--json","[all] Output as JSON").option("-a, --active","[info] Show only ACTIVE_PLAN value").option("-s, --suggested","[info] Show only SUGGESTED_PLAN value").option("-f, --format","[info] Show only PLAN_DATE_FORMAT value").action(async(e,i,n)=>{switch(e||"list"){case"list":await cp(n);break;case"status":await lp(n);break;case"create":i||(console.log(),m.error("Plan name required"),console.log(a.dim("Usage: gk plan create <name>")),console.log(),process.exit(1)),await vp(i);break;case"set":i||(console.log(),m.error("Plan name required"),console.log(a.dim("Usage: gk plan set <name>")),console.log(),process.exit(1)),await Ap(i);break;case"info":await up(n);break;default:ap()}})}async function cp(t){let e=hc();if(t.json){console.log(JSON.stringify(e,null,2));return}if(console.log(),console.log(p.default.bold(a.geminiPurple("Project Plans"))),console.log(),e.length===0){m.info('No plans found. Create one with "gk plan create <name>".'),console.log();return}for(let i of e){let n=i.isActive?a.success("\u2192"):a.dim("\u25CB"),r=i.isActive?a.success(" (active)"):"";console.log(` ${n} ${a.primary(i.name)}${r}`),console.log(` ${a.dim("Created:")} ${a.dim(new Date(i.createdAt).toLocaleDateString())}`)}console.log()}async function lp(t){let e=wn();if(!e){t.json?console.log(JSON.stringify({active:!1},null,2)):(console.log(),m.info("No active plan set."),console.log());return}let i=$v(e);if(t.json){console.log(JSON.stringify(i,null,2));return}console.log(),console.log(M.line()),console.log(p.default.bold(a.geminiPurple("Active Plan"))),console.log(M.line()),console.log(),console.log(` ${a.primary(e)}`),console.log()}async function vp(t){try{let e=_v(t);console.log(),m.success(`Plan created: ${a.primary(t)}`),m.info(`Path: ${a.dim(e.path)}`),dc(t),m.info("Set as active plan."),console.log()}catch(e){console.log(),m.error(`Failed to create plan: ${e instanceof Error?e.message:String(e)}`),console.log()}}async function Ap(t){if(!hc().some(o=>o.name===t)){console.log(),m.error(`Plan not found: ${t}`),console.log();return}if(!dc(t)){console.log(),m.error("Failed to update session or env file"),console.log();return}let r=vi();console.log(),r&&m.success(`Session ${r.slice(0,20)}...: activePlan set to: ${a.primary(t)}`),m.info(`Environment updated: ACTIVE_PLAN = ${t}`),console.log(),m.success(`Active plan set to: ${a.primary(t)}`),console.log()}async function up(t){let e=N(),i={activePlan:e.ACTIVE_PLAN||null,suggestedPlan:e.SUGGESTED_PLAN||null,planDateFormat:e.PLAN_DATE_FORMAT||null,gkSessionId:e.ACTIVE_GK_SESSION_ID||null,projectDir:e.PROJECT_DIR||null};if(t.active){t.json?console.log(JSON.stringify({activePlan:i.activePlan})):console.log(i.activePlan||"");return}if(t.suggested){t.json?console.log(JSON.stringify({suggestedPlan:i.suggestedPlan})):console.log(i.suggestedPlan||"");return}if(t.format){t.json?console.log(JSON.stringify({planDateFormat:i.planDateFormat})):console.log(i.planDateFormat||"");return}if(t.json)console.log(JSON.stringify({activePlan:i.activePlan,suggestedPlan:i.suggestedPlan,planDateFormat:i.planDateFormat,context:{gkSessionId:i.gkSessionId,projectDir:i.projectDir}},null,2));else{console.log(),console.log(M.line()),console.log(p.default.bold(a.geminiPurple("Plan Information"))),console.log(M.line()),console.log(),console.log(` ${a.dim("Active Plan:")} ${i.activePlan||a.dim("(not set)")}`),console.log(` ${a.dim("Suggested Plan:")} ${i.suggestedPlan||a.dim("(not set)")}`),console.log(` ${a.dim("Date Format:")} ${i.planDateFormat||a.dim("(not set)")}`),console.log(),console.log(M.line());let n=i.gkSessionId?i.gkSessionId.substring(0,25)+"...":a.dim("(no session)");console.log(` ${a.dim("Session:")} ${n}`),console.log(` ${a.dim("Project:")} ${i.projectDir||a.dim("(unknown)")}`),console.log()}}import{existsSync as mp,readFileSync as Ep,readdirSync as Ip}from"fs";import{join as tA}from"path";import{homedir as pp}from"os";async function iA(){let t=Co();return t?fp(t):null}function fp(t){let e=tA(pp(),".gemini","tmp",t,"chats");if(!mp(e))return null;let i=Ip(e).filter(n=>n.startsWith("session-")&&n.endsWith(".json")).sort().reverse();if(i.length===0)return null;try{let n=tA(e,i[0]);return hp(n)}catch{return null}}function hp(t){try{let e=Ep(t,"utf-8"),i=JSON.parse(e);if(!i.messages||i.messages.length===0)return null;let n=new Set,r=0,o=0,s=0,c,l=0;for(let h of i.messages)h.model&&n.add(h.model),h.tokens&&(r+=h.tokens.output||0,o+=h.tokens.thoughts||0,s+=h.tokens.tool||0,c=h.tokens,l++);if(!c||l===0)return null;let v=c.total||0,A=c.cached||0,u=v-r-o;u<0&&(u=0);let I={input:u,output:r,cached:A,thoughts:o,tool:s,total:v},E=null;if(i.startTime&&i.lastUpdated)try{let h=new Date(i.startTime),H=new Date(i.lastUpdated),ve=Math.floor((H.getTime()-h.getTime())/1e3),es=Math.floor(ve/60),ts=ve%60;E={seconds:ve,formatted:`${es}m ${ts}s`}}catch{}let f=Array.from(n),R=f[0]||"unknown";return{sessionId:i.sessionId,startTime:i.startTime||null,lastUpdated:i.lastUpdated||null,duration:E,model:R,modelsUsed:f,messageCount:l,tokens:I,averages:{outputPerMessage:l>0?Math.round(r/l):0,thoughtsPerMessage:l>0?Math.round(o/l):0,toolPerMessage:l>0?Math.round(s/l):0}}}catch{return null}}var Xn={"gemini-3-pro-preview":{input:2,output:12,cached:.2,thoughts:12},"gemini-3-flash-preview":{input:.5,output:3,cached:.05,thoughts:3},"gemini-2.5-pro":{input:1.25,output:10,cached:.125,thoughts:10},"gemini-2.5-pro-preview":{input:1.25,output:10,cached:.125,thoughts:10},"gemini-2.5-flash":{input:.3,output:2.5,cached:.03,thoughts:2.5},"gemini-2.5-flash-lite":{input:.1,output:.4,cached:.01,thoughts:.4},"gemini-2.0-flash":{input:.1,output:.4,cached:.01,thoughts:.4},"gemini-2.0-flash-exp":{input:.1,output:.4,cached:.01,thoughts:.4},default:{input:.5,output:3,cached:.05,thoughts:3}};function dp(t){if(Xn[t])return Xn[t];for(let e of Object.keys(Xn))if(e.includes(t)||t.includes(e))return Xn[e];return Xn.default}function Rc(t,e="default"){let i=dp(e),n=t.input-t.cached;n<0&&(n=0);let r=n/1e6*i.input,o=t.output/1e6*i.output,s=t.cached/1e6*i.cached,c=t.thoughts/1e6*i.thoughts;return{input:r,output:o,cached:s,thoughts:c,total:r+o+s+c,model:e,pricing:i}}function Ct(t){return t>=1?`$${t.toFixed(2)}`:t>=.01?`$${t.toFixed(3)}`:t>=.001?`$${t.toFixed(4)}`:`$${t.toFixed(6)}`}function zc(t){return t>=1e6?`${(t/1e6).toFixed(1)}M`:t>=1e3?`${(t/1e3).toFixed(1)}K`:String(t)}var Ut={topLeft:"\u256D",topRight:"\u256E",bottomLeft:"\u2570",bottomRight:"\u256F",horizontal:"\u2500",vertical:"\u2502",middleLeft:"\u251C",middleRight:"\u2524"};function Rp(t=75){return a.dim(`${Ut.topLeft}${Ut.horizontal.repeat(t-2)}${Ut.topRight}`)}function zp(t=75){return a.dim(`${Ut.bottomLeft}${Ut.horizontal.repeat(t-2)}${Ut.bottomRight}`)}function jp(t,e=75){let i=t.replace(/\x1b\[[0-9;]*m/g,"").length,n=Math.max(0,e-4-i);return`${a.dim(Ut.vertical)} ${t}${" ".repeat(n)} ${a.dim(Ut.vertical)}`}function jc(t){return`
67
+ ${p.default.bold(a.geminiPurple(`## ${t}`))}`}function Oe(t,e){let i=t.replace(/\x1b\[[0-9;]*m/g,"").length,n=Math.max(0,e-i);return" ".repeat(n)+t}function Ot(t,e){let i=t.replace(/\x1b\[[0-9;]*m/g,"").length,n=Math.max(0,e-i);return t+" ".repeat(n)}function gp(t){let e=[],i=t.length;for(let n=0;n<i;n++){let r=n/Math.max(i-1,1),o=Math.round(26+116*r),s=Math.round(115+-79*r),c=Math.round(232+-62*r);e.push(`\x1B[38;2;${o};${s};${c}m${t[n]}`)}return e.join("")+"\x1B[0m"}function xp(t){let e=Rc(t.tokens,t.model);console.log(),console.log(Rp(75)),console.log(jp(`${gp("SESSION ANALYSIS")} ${a.dim("Cost:")} ${a.warn(Ct(e.total))}`,75)),console.log(zp(75)),console.log(`
68
+ ${a.dim("Session ID:")} ${a.accent(t.sessionId)}`),console.log(` ${a.dim("Start Time:")} ${t.startTime||"N/A"}`),console.log(` ${a.dim("Duration:")} ${a.accent(t.duration?.formatted||"N/A")}`),console.log(` ${a.dim("Model:")} ${a.geminiBlue(t.modelsUsed.join(", "))}`),console.log(` ${a.dim("Messages:")} ${a.accent(String(t.messageCount))}`),console.log(jc("Token Breakdown")),console.log(`
69
+ ${Ot("Category",10)} ${Oe("Count",14)} ${Oe("Formatted",10)}`),console.log(` ${a.dim("\u2500".repeat(10))} ${a.dim("\u2500".repeat(14))} ${a.dim("\u2500".repeat(10))}`);let i=["input","output","cached","thoughts","tool"];for(let o of i){let s=t.tokens[o],c=Oe(a.accent(s.toLocaleString()),14),l=Oe(a.accent(zc(s)),10);console.log(` ${Ot(o,10)} ${c} ${l}`)}console.log(` ${a.dim("\u2500".repeat(10))} ${a.dim("\u2500".repeat(14))} ${a.dim("\u2500".repeat(10))}`);let n=Oe(a.success(t.tokens.total.toLocaleString()),14),r=Oe(a.success(zc(t.tokens.total)),10);if(console.log(` ${Ot(p.default.bold("total"),10)} ${n} ${r}`),console.log(jc("Estimated Cost")),console.log(`
70
+ ${Ot("Input",12)} ${Oe(a.warn(Ct(e.input)),12)}`),console.log(` ${Ot("Output",12)} ${Oe(a.warn(Ct(e.output)),12)}`),console.log(` ${Ot("Cached",12)} ${Oe(a.warn(Ct(e.cached)),12)}`),console.log(` ${Ot("Thoughts",12)} ${Oe(a.warn(Ct(e.thoughts)),12)}`),console.log(` ${a.dim("\u2500".repeat(24))}`),console.log(` ${Ot(p.default.bold("TOTAL"),12)} ${Oe(p.default.bold(a.warn(Ct(e.total))),12)}`),t.messageCount>0){console.log(jc("Averages"));let o=Math.round(t.tokens.total/t.messageCount),s=e.total/t.messageCount;console.log(`
71
+ ${a.dim("Tokens/msg:")} ${a.accent(o.toLocaleString())}`),console.log(` ${a.dim("Cost/msg:")} ${a.warn(Ct(s))}`)}console.log()}function Gp(t){let e=Rc(t.tokens,t.model);console.log(JSON.stringify({sessionId:t.sessionId,startTime:t.startTime,duration:t.duration,model:t.model,modelsUsed:t.modelsUsed,messageCount:t.messageCount,tokens:t.tokens,averages:t.averages,cost:{input:e.input,output:e.output,cached:e.cached,thoughts:e.thoughts,total:e.total}},null,2))}function nA(t){t.command("tokens","Show token usage for current session").alias("t").option("--json","Output as JSON").action(async e=>{let i=await iA();if(!i){e.json?console.log(JSON.stringify({found:!1},null,2)):(console.log(),m.info("No token usage found for current session."),console.log());return}if(e.json){Gp(i);return}xp(i)})}import{existsSync as Sp,readdirSync as Yp}from"fs";function rA(t){let e=t.command("extension <subcommand>","Extension management").alias("ext");e.example("gk extension list # List installed extensions"),e.action(async i=>{let n=i||"list";n==="list"?await Wp():(console.log(),m.error(`Unknown subcommand: ${n}`),console.log(),process.exit(1))})}async function Wp(){let t=Bt();if(!Sp(t)){console.log(),m.info("No extensions directory found."),console.log();return}let e=Yp(t,{withFileTypes:!0}).filter(i=>i.isDirectory()).map(i=>i.name);if(e.length===0){console.log(),m.info("No extensions installed."),console.log();return}console.log(),console.log(p.default.bold(a.geminiPurple("Installed Extensions"))),console.log();for(let i of e)console.log(` ${a.success("\u2713")} ${a.primary(i)}`);console.log(),console.log(a.dim(` Total: ${e.length} extensions`)),console.log()}function oA(t){t.command("catalog [subcommand]","Catalog of skills and agents").action(async i=>{let n=i||"skills";switch(n){case"skills":await Mp();break;case"agents":await Cp();break;default:console.log(),m.error(`Unknown subcommand: ${n}`),console.log(),process.exit(1)}})}async function Mp(){let t=Mv();if(console.log(),console.log(p.default.bold(a.geminiPurple("Available Skills"))),console.log(),t.length===0){m.info(" No skills found."),console.log();return}for(let e of t)console.log(` ${a.success("\u2713")} ${a.primary(e.name)}`);console.log(),console.log(a.dim(` Total: ${t.length} skills`)),console.log()}async function Cp(){let t=Wo();if(console.log(),console.log(p.default.bold(a.geminiPurple("Available Agent Profiles"))),console.log(),t.length===0){m.info(" No agent profiles found."),console.log();return}for(let e of t)console.log(` ${a.success("\u25CF")} ${a.primary(e.name)}`),console.log(` ${a.dim(e.description)}`);console.log(),console.log(a.dim(` Total: ${t.length} profiles`)),console.log()}import{spawnSync as ye}from"child_process";import{existsSync as ce,mkdirSync as sA,writeFileSync as Op,statSync as gc,copyFileSync as Jo,readdirSync as Up}from"fs";import{join as ae,extname as yi}from"path";import{homedir as qi}from"os";var Kp="clipboard-image",Vp="clipboard-video",aA=[".mp4",".webm",".mov",".avi",".mkv",".gif"],Np=5;function cA(t){t.command("paste","Capture clipboard image or video for Gemini analysis").alias("p").option("--image","Capture image from clipboard (default)").option("--video","Capture video from clipboard or recent recordings").option("--format <fmt>","Image format (png, jpg)",{default:"png"}).option("--json","Output as JSON").action(async e=>{let i=e.video===!0,n=i?Zp():Fp(e),r=i?Dp(n):Bp(n);if(e.json)console.log(JSON.stringify(r,null,2));else{if(console.log(),r.success){let o=i?"Video":"Image";console.log(`${a.success("\u2713")} ${o} captured successfully`),console.log(),console.log(` ${a.dim("Path:")} ${a.primary(String(r.path))}`),console.log(` ${a.dim("Size:")} ${r.size}`),i&&r.format&&console.log(` ${a.dim("Format:")} ${r.format}`),r.sourceType&&r.sourceType!=="clipboard"&&console.log(` ${a.dim("Source:")} ${r.sourceType}`),console.log(` ${a.dim("Platform:")} ${r.platform}`)}else console.error(`${a.error("\u2717")} ${r.error}`),r.suggestion&&console.log(` ${a.dim("Hint:")} ${r.suggestion}`);console.log()}process.exit(n.success?0:1)})}function lA(){let t=Co();if(t){let i=ae(qi(),".gemini","tmp",t);return ce(i)||sA(i,{recursive:!0}),i}let e=ae(process.cwd(),".gemini","tmp","clipboard");return ce(e)||sA(e,{recursive:!0}),e}function kp(t="png"){let e=Date.now(),i=Math.random().toString(36).substring(2,8);return`${Kp}-${e}-${i}.${t}`}function bo(t=".mp4"){let e=Date.now(),i=Math.random().toString(36).substring(2,8),n=aA.includes(t.toLowerCase())?t:".mp4";return`${Vp}-${e}-${i}${n}`}function xc(t){let e=yi(t).toLowerCase();return aA.includes(e)}function vA(t,e){for(let i of t)if(ce(i))try{let n=Up(i).filter(r=>xc(r)).map(r=>{let o=ae(i,r);return{name:r,path:o,mtime:gc(o).mtime}}).sort((r,o)=>o.mtime.getTime()-r.mtime.getTime());if(n.length>0){let r=n[0];if((Date.now()-r.mtime.getTime())/6e4<=Np){let s=yi(r.path),c=bo(s),l=ae(e,c);if(Jo(r.path,l),ce(l))return{success:!0,path:l,sourcePath:r.path,sourceType:"recent-recording"}}}}catch{}return null}function Fp(t){let e=t.format||"png",i=process.platform,n=lA(),r=kp(e),o=ae(n,r),s;switch(i){case"win32":s=Qp(o);break;case"darwin":s=Jp(o);break;case"linux":s=bp(o);break;default:s={success:!1,error:`Unsupported platform: ${i}`}}return s.platform=i,s.tempDir=n,s}function Qp(t){let e=t.replace(/\\/g,"\\\\"),i=`
72
72
  Add-Type -AssemblyName System.Windows.Forms
73
73
  Add-Type -AssemblyName System.Drawing
74
74
  $clipboard = [System.Windows.Forms.Clipboard]::GetImage()
@@ -78,9 +78,98 @@ if (-not (Test-Path $dir)) { New-Item -ItemType Directory -Path $dir -Force | Ou
78
78
  $clipboard.Save("${e}", [System.Drawing.Imaging.ImageFormat]::Png)
79
79
  $clipboard.Dispose()
80
80
  Write-Output "SUCCESS"
81
- `.trim(),n=Ji("powershell",["-NoProfile","-NonInteractive","-Command",i],{encoding:"utf-8",windowsHide:!0});return n.stderr?.includes("NO_IMAGE")?{success:!1,error:"No image in clipboard. Copy an image first."}:n.status!==0?{success:!1,error:`Failed: ${n.stderr||n.stdout}`.trim()}:bn(t)?{success:!0,path:t}:{success:!1,error:"File not created"}}function a9(t){return Ji("which",["pngpaste"],{encoding:"utf-8"}).status===0&&Ji("pngpaste",[t],{encoding:"utf-8"}).status===0&&bn(t)?{success:!0,path:t}:{success:!1,error:"No image or pngpaste failed",suggestion:"brew install pngpaste"}}function s9(t){if(Ji("which",["xclip"],{encoding:"utf-8"}).status!==0)return{success:!1,error:"xclip not installed",suggestion:"apt install xclip"};let i=Ji("xclip",["-selection","clipboard","-t","TARGETS","-o"],{encoding:"utf-8"});if(!i.stdout?.includes("image/png")&&!i.stdout?.includes("image/jpeg"))return{success:!1,error:"No image in clipboard"};let n=i.stdout.includes("image/png")?"image/png":"image/jpeg",r=Ji("xclip",["-selection","clipboard","-t",n,"-o"],{encoding:"buffer"});return r.status!==0||!r.stdout?.length?{success:!1,error:"Failed to read clipboard"}:(_I(t,r.stdout),bn(t)?{success:!0,path:t}:{success:!1,error:"Save failed"})}function c9(t){if(t.success&&t.path){let e=$I(t.path);return{success:!0,message:"Image captured",path:t.path,size:`${(e.size/1024).toFixed(1)} KB`,platform:t.platform}}return{success:!1,error:t.error,suggestion:t.suggestion,platform:t.platform}}var wv={"claude-3-opus":"gemini-2.5-pro","claude-3-sonnet":"gemini-2.5-flash","claude-3-haiku":"gemini-2.5-flash","claude-3.5-sonnet":"gemini-2.5-pro","claude-3.5-haiku":"gemini-2.5-flash","gemini-2.5-pro":"gemini-2.5-pro","gemini-2.5-flash":"gemini-2.5-flash","gemini-3-flash-preview":"gemini-3-flash-preview"};import{existsSync as se,readFileSync as Co,readdirSync as Oo,mkdirSync as Ec,writeFileSync as Tv,copyFileSync as mc,statSync as Xv}from"fs";import{join as W}from"path";var l9=".claude/skills",v9=".gemini/extensions",A9=".claude/agents",m9=".gemini/agents";function Ic(t){let e=t.match(/^---\r?\n([\s\S]*?)\r?\n---/);if(!e)return null;let i={name:"",description:""},n=e[1].split(/\r?\n/);for(let r of n){let o=r.indexOf(":");if(o===-1)continue;let a=r.slice(0,o).trim(),c=r.slice(o+1).trim();(c.startsWith('"')&&c.endsWith('"')||c.startsWith("'")&&c.endsWith("'"))&&(c=c.slice(1,-1)),i[a]=c}return i}function Uo(t=process.cwd()){return W(t,l9)}function Ko(t=process.cwd()){return W(t,v9)}function Vo(t=process.cwd()){let e=Uo(t);if(!se(e))return[];let i=[];try{let n=Oo(e,{withFileTypes:!0}).filter(r=>r.isDirectory()).map(r=>r.name);for(let r of n){let o=W(e,r),a=W(o,"SKILL.md"),c=W(o,"references"),l=se(a),v=se(c)&&Xv(c).isDirectory(),A;if(l)try{let m=Co(a,"utf-8");A=Ic(m)?.description}catch{}i.push({name:r,path:o,hasSkillMd:l,hasReferences:v,description:A})}}catch{}return i.sort((n,r)=>n.name.localeCompare(r.name))}function pc(t,e=process.cwd()){let i=W(Ko(e),t);return se(i)}function u9(t,e){let i=["SKILL.md"];return e&&i.push("references/*.md"),{name:t.name||"",version:"1.0.0",description:t.description||"",license:"MIT",contextFileName:i}}function uc(t,e,i){se(e)||(Ec(e,{recursive:!0}),i.push(e));let n=Oo(t,{withFileTypes:!0});for(let r of n){let o=W(t,r.name),a=W(e,r.name);r.isDirectory()?uc(o,a,i):(mc(o,a),i.push(a))}}function hc(t,e={},i=process.cwd()){let n={skill:t,success:!1,created:[],skipped:[],errors:[]},r=Uo(i),o=Ko(i),a=W(r,t),c=W(o,t);if(!se(a))return n.errors.push(`Skill not found: ${t}`),n;let l=W(a,"SKILL.md");if(!se(l))return n.errors.push(`SKILL.md not found in ${t}`),n;if(pc(t,i)&&!e.force)return n.skipped.push(`Extension already exists: ${t} (use --force to overwrite)`),n;let v=null;try{let E=Co(l,"utf-8");v=Ic(E)}catch(E){return n.errors.push(`Failed to read SKILL.md: ${E instanceof Error?E.message:String(E)}`),n}(!v||!v.name)&&(v={name:t,description:""});let A=W(a,"references"),m=se(A)&&Xv(A).isDirectory(),I=u9(v,m);if(e.dryRun)return n.created.push(`[DRY RUN] Would create: ${c}`),n.created.push(`[DRY RUN] Would create: ${W(c,"gemini-extension.json")}`),n.created.push("[DRY RUN] Would copy: SKILL.md"),m&&n.created.push("[DRY RUN] Would copy: references/"),n.success=!0,n;try{se(c)||(Ec(c,{recursive:!0}),n.created.push(c));let E=W(c,"gemini-extension.json");Tv(E,JSON.stringify(I,null,2)+`
82
- `),n.created.push(E);let h=W(c,"SKILL.md");if(mc(l,h),n.created.push(h),m){let f=W(c,"references");uc(A,f,n.created)}let d=Oo(a,{withFileTypes:!0});for(let f of d){if(f.name==="SKILL.md"||f.name==="references")continue;let H=W(a,f.name),ce=W(c,f.name);f.isDirectory()?uc(H,ce,n.created):(mc(H,ce),n.created.push(ce))}n.success=!0}catch(E){n.errors.push(`Failed to convert: ${E instanceof Error?E.message:String(E)}`)}return n}function Hv(t={},e=process.cwd()){let i=Vo(e),n=[];for(let r of i){let o=hc(r.name,t,e);n.push(o)}return n}function fc(t){return{total:t.length,success:t.filter(e=>e.success&&e.errors.length===0&&e.skipped.length===0).length,skipped:t.filter(e=>e.skipped.length>0).length,failed:t.filter(e=>e.errors.length>0).length}}function No(t=process.cwd()){return W(t,A9)}function ko(t=process.cwd()){return W(t,m9)}function Lv(t){let e=Ic(t);return e?{name:e.name||"",description:e.description||"",model:e.model,skills:e.skills}:null}function Fo(t=process.cwd()){let e=No(t);if(!se(e))return[];let i=[];try{let n=Oo(e,{withFileTypes:!0}).filter(r=>r.isFile()&&r.name.endsWith(".md")).map(r=>r.name);for(let r of n){let o=W(e,r),a=r.replace(/\.md$/,""),c,l,v;try{let A=Co(o,"utf-8"),m=Lv(A);m&&(c=m.description,l=m.model,v=m.skills)}catch{}i.push({name:a,path:o,description:c,model:l,skills:v})}}catch{}return i.sort((n,r)=>n.name.localeCompare(r.name))}function zc(t,e=process.cwd()){let i=W(ko(e),`${t}.md`);return se(i)}function E9(t){if(t)return wv[t]||t}function I9(t,e){let i=t.match(/^(---\r?\n)([\s\S]*?)(\r?\n---)/);if(!i)return t;let[n,r,o,a]=i,c=o.split(/\r?\n/),l=[],v=new Set;for(let m of c){let I=m.indexOf(":");if(I===-1){l.push(m);continue}let E=m.slice(0,I).trim();E in e?(v.add(E),e[E]!==void 0&&l.push(`${E}: ${e[E]}`)):l.push(m)}for(let[m,I]of Object.entries(e))!v.has(m)&&I!==void 0&&l.push(`${m}: ${I}`);let A=r+l.join(`
83
- `)+a;return t.replace(n,A)}function Rc(t,e={},i=process.cwd()){let n={skill:t,success:!1,created:[],skipped:[],errors:[]},r=No(i),o=ko(i),a=W(r,`${t}.md`),c=W(o,`${t}.md`);if(!se(a))return n.errors.push(`Agent not found: ${t}`),n;if(zc(t,i)&&!e.force)return n.skipped.push(`Agent already exists in .gemini/agents: ${t} (use --force to overwrite)`),n;let l;try{l=Co(a,"utf-8")}catch(E){return n.errors.push(`Failed to read agent file: ${E instanceof Error?E.message:String(E)}`),n}let A=Lv(l)?.model,m=E9(A),I=l;if(A&&m&&A!==m&&(I=I9(l,{model:m})),e.dryRun)return n.created.push(`[DRY RUN] Would create: ${c}`),A&&m&&A!==m&&n.created.push(`[DRY RUN] Would map model: ${A} -> ${m}`),n.success=!0,n;try{se(o)||Ec(o,{recursive:!0}),Tv(c,I),n.created.push(c),A&&m&&A!==m&&n.created.push(`Model mapped: ${A} -> ${m}`),n.success=!0}catch(E){n.errors.push(`Failed to convert: ${E instanceof Error?E.message:String(E)}`)}return n}function _v(t={},e=process.cwd()){let i=Fo(e),n=[];for(let r of i){let o=Rc(r.name,t,e);n.push(o)}return n}function $v(){console.log(),console.log(p.default.bold(s.geminiPurple("Convert .claude to .gemini"))),console.log(),console.log("Usage:"),console.log(` ${s.primary("gk convert")} <type> [name] [options]`),console.log(),console.log("Types:"),console.log(` ${s.primary("skill")} <name> Convert a single skill to extension`),console.log(` ${s.primary("skills")} Convert all skills to extensions`),console.log(` ${s.primary("agent")} <name> Convert a single agent`),console.log(` ${s.primary("agents")} Convert all agents`),console.log(),console.log("Options:"),console.log(` ${s.dim("--list")} List available items`),console.log(` ${s.dim("--force")} Overwrite existing items`),console.log(` ${s.dim("--dry-run")} Show what would be done without changes`),console.log(` ${s.dim("--json")} Output as JSON`),console.log(),console.log("Examples:"),console.log(` ${s.dim("gk convert skill --list")}`),console.log(` ${s.dim("gk convert skill my-skill")}`),console.log(` ${s.dim("gk convert skills --force")}`),console.log(` ${s.dim("gk convert agent --list")}`),console.log(` ${s.dim("gk convert agents --dry-run")}`),console.log()}function eA(t){t.command("convert [type] [name]","Convert .claude to .gemini resources").alias("cv").option("--all","[all] Convert all items").option("--list","[all] List available items").option("--force","[all] Overwrite existing items").option("--dry-run","[all] Show what would be done without making changes").option("--json","[all] Output as JSON").action(async(e,i,n)=>{if(!e){$v();return}if(e==="skill"||e==="skills"){if(n.list){await p9(n);return}if(n.all||e==="skills"){await f9(n);return}i||(console.log(),u.error("Skill name required"),console.log(s.dim("Usage: gk convert skill <name>")),console.log(s.dim(" gk convert skill --list (to see available skills)")),console.log(s.dim(" gk convert skills (to convert all)")),console.log(),process.exit(1)),await h9(i,n);return}if(e==="agent"||e==="agents"){if(n.list){await z9(n);return}if(n.all||e==="agents"){await d9(n);return}i||(console.log(),u.error("Agent name required"),console.log(s.dim("Usage: gk convert agent <name>")),console.log(s.dim(" gk convert agent --list (to see available agents)")),console.log(s.dim(" gk convert agents (to convert all)")),console.log(),process.exit(1)),await R9(i,n);return}$v()})}async function p9(t){let e=Vo();if(t.json){console.log(JSON.stringify(e,null,2));return}if(console.log(),console.log(p.default.bold(s.geminiPurple("Available Claude Skills"))),console.log(s.dim(` Source: ${Uo()}`)),console.log(),e.length===0){u.info("No skills found in .claude/skills/"),console.log();return}for(let i of e){let n=pc(i.name),r=n?s.success("\u2713"):s.dim("\u25CB"),o=n?s.dim(" (converted)"):"";if(console.log(` ${r} ${s.primary(i.name)}${o}`),i.description){let a=i.description.length>70?i.description.slice(0,70)+"...":i.description;console.log(` ${s.dim(a)}`)}}console.log(),console.log(s.dim(` Total: ${e.length} skills`)),console.log()}async function h9(t,e){let i=hc(t,{force:e.force,dryRun:e.dryRun});if(e.json){console.log(JSON.stringify(i,null,2));return}if(console.log(),i.errors.length>0){u.error(`Failed to convert skill: ${t}`);for(let n of i.errors)console.log(` ${s.error("\u2717")} ${n}`);console.log(),process.exit(1)}if(i.skipped.length>0){u.warn(`Skipped skill: ${t}`);for(let n of i.skipped)console.log(` ${s.dim("\u25CB")} ${n}`);console.log();return}if(e.dryRun){u.info(`[DRY RUN] Would convert skill: ${t}`);for(let n of i.created)console.log(` ${s.dim("\u2192")} ${n}`);console.log();return}u.success(`Converted skill: ${s.primary(t)}`),console.log(),console.log(` ${s.dim("Created files:")}`);for(let n of i.created.slice(0,5)){let r=n.replace(process.cwd(),".");console.log(` ${s.success("+")} ${r}`)}i.created.length>5&&console.log(` ${s.dim(`... and ${i.created.length-5} more`)}`),console.log(),console.log(s.dim(` Extension created at: ${Ko()}/${t}`)),console.log()}async function f9(t){if(Vo().length===0){t.json?console.log(JSON.stringify({results:[],summary:{total:0,success:0,skipped:0,failed:0}},null,2)):(console.log(),u.info("No skills found in .claude/skills/"),console.log());return}let i=Hv({force:t.force,dryRun:t.dryRun}),n=fc(i);if(t.json){console.log(JSON.stringify({results:i,summary:n},null,2));return}console.log(),t.dryRun?console.log(p.default.bold(s.geminiPurple("[DRY RUN] Skill Conversion Preview"))):console.log(p.default.bold(s.geminiPurple("Skill Conversion Results"))),console.log(M.line()),console.log();for(let r of i)if(r.errors.length>0){console.log(` ${s.error("\u2717")} ${r.skill}`);for(let o of r.errors)console.log(` ${s.dim(o)}`)}else if(r.skipped.length>0)console.log(` ${s.dim("\u25CB")} ${r.skill} ${s.dim("(skipped)")}`);else if(r.success){let o=t.dryRun?s.dim("\u2192"):s.success("\u2713");console.log(` ${o} ${r.skill}`)}console.log(),console.log(M.line()),console.log(),t.dryRun?(console.log(` ${s.dim("Would convert:")} ${n.success} skills`),console.log(` ${s.dim("Would skip:")} ${n.skipped} skills`),console.log(` ${s.dim("Would fail:")} ${n.failed} skills`)):(console.log(` ${s.success("Converted:")} ${n.success}`),console.log(` ${s.dim("Skipped:")} ${n.skipped}`),console.log(` ${s.error("Failed:")} ${n.failed}`)),console.log(),n.skipped>0&&!t.force&&(u.info("Use --force to overwrite existing extensions"),console.log())}async function z9(t){let e=Fo();if(t.json){console.log(JSON.stringify(e,null,2));return}if(console.log(),console.log(p.default.bold(s.geminiPurple("Available Claude Agents"))),console.log(s.dim(` Source: ${No()}`)),console.log(),e.length===0){u.info("No agents found in .claude/agents/"),console.log();return}for(let i of e){let n=zc(i.name),r=n?s.success("\u2713"):s.dim("\u25CB"),o=n?s.dim(" (converted)"):"";if(console.log(` ${r} ${s.primary(i.name)}${o}`),i.model&&console.log(` ${s.dim("Model:")} ${i.model}`),i.description){let a=i.description.length>60?i.description.slice(0,60)+"...":i.description;console.log(` ${s.dim(a)}`)}}console.log(),console.log(s.dim(` Total: ${e.length} agents`)),console.log()}async function R9(t,e){let i=Rc(t,{force:e.force,dryRun:e.dryRun});if(e.json){console.log(JSON.stringify(i,null,2));return}if(console.log(),i.errors.length>0){u.error(`Failed to convert agent: ${t}`);for(let n of i.errors)console.log(` ${s.error("\u2717")} ${n}`);console.log(),process.exit(1)}if(i.skipped.length>0){u.warn(`Skipped agent: ${t}`);for(let n of i.skipped)console.log(` ${s.dim("\u25CB")} ${n}`);console.log();return}if(e.dryRun){u.info(`[DRY RUN] Would convert agent: ${t}`);for(let n of i.created)console.log(` ${s.dim("\u2192")} ${n}`);console.log();return}u.success(`Converted agent: ${s.primary(t)}`),console.log();for(let n of i.created){let r=n.replace(process.cwd(),".");console.log(` ${s.success("+")} ${r}`)}console.log(),console.log(s.dim(` Agent created at: ${ko()}/${t}.md`)),console.log()}async function d9(t){if(Fo().length===0){t.json?console.log(JSON.stringify({results:[],summary:{total:0,success:0,skipped:0,failed:0}},null,2)):(console.log(),u.info("No agents found in .claude/agents/"),console.log());return}let i=_v({force:t.force,dryRun:t.dryRun}),n=fc(i);if(t.json){console.log(JSON.stringify({results:i,summary:n},null,2));return}console.log(),t.dryRun?console.log(p.default.bold(s.geminiPurple("[DRY RUN] Agent Conversion Preview"))):console.log(p.default.bold(s.geminiPurple("Agent Conversion Results"))),console.log(M.line()),console.log();for(let r of i)if(r.errors.length>0){console.log(` ${s.error("\u2717")} ${r.skill}`);for(let o of r.errors)console.log(` ${s.dim(o)}`)}else if(r.skipped.length>0)console.log(` ${s.dim("\u25CB")} ${r.skill} ${s.dim("(skipped)")}`);else if(r.success){let o=t.dryRun?s.dim("\u2192"):s.success("\u2713");console.log(` ${o} ${r.skill}`)}console.log(),console.log(M.line()),console.log(),t.dryRun?(console.log(` ${s.dim("Would convert:")} ${n.success} agents`),console.log(` ${s.dim("Would skip:")} ${n.skipped} agents`),console.log(` ${s.dim("Would fail:")} ${n.failed} agents`)):(console.log(` ${s.success("Converted:")} ${n.success}`),console.log(` ${s.dim("Skipped:")} ${n.skipped}`),console.log(` ${s.error("Failed:")} ${n.failed}`)),console.log(),n.skipped>0&&!t.force&&(u.info("Use --force to overwrite existing agents"),console.log())}function Wt(){return{orchestrator:null,agents:new Map,sessionId:null,projectDir:null,activePlan:null,appName:null,currentNotification:null,inbox:[],documents:[],isActive:!1}}var j9=[[/research|search|analyze/i,"\u{1F50D}"],[/code|implement|execute|develop/i,"\u{1F4BB}"],[/plan|architect/i,"\u{1F4CB}"],[/debug|fix|troubleshoot/i,"\u{1F41B}"],[/test|qa|quality/i,"\u{1F9EA}"],[/design|ui|ux/i,"\u{1F3A8}"],[/review|audit|check/i,"\u2705"],[/doc|write|content/i,"\u{1F4DD}"]];function Qo(t,e=!1){if(e)return"\u{1F451}";for(let[i,n]of j9)if(i.test(t))return n;return"\u{1F916}"}function dc(t){return t.replace(/-/g," ").replace(/\b\w/g,e=>e.toUpperCase())}function gc(t){let e=t.toLowerCase();return e.includes("main")?"orchestrator":e.includes("research")||e.includes("scout")?"researcher":e.includes("code")||e.includes("executor")||e.includes("debug")?"coder":e.includes("plan")?"planner":e.includes("test")?"tester":e.includes("design")||e.includes("ui")||e.includes("ux")||e.includes("artist")?"designer":e.includes("doc")||e.includes("writer")?"writer":e.includes("manager")||e.includes("git")?"manager":"other"}function jc(t,e){return t.agentType==="Main Agent"||t.parentGkSessionId===null||t.gkSessionId===e.gkSessionId}function g9(t,e){return t==="active"?"working":"idle"}function x9(t){if(t.status==="completed")return 100;if(t.status==="failed"||!t.startTime)return 0;let e=new Date(t.startTime).getTime(),n=Date.now()-e;return Math.min(100,Math.round(n/12e4*100))}function G9(t){return t.status==="completed"?"Task complete!":t.status==="failed"?"Task failed":t.injected?.skills?.length?`Working on ${t.injected.skills[0]}...`:null}function tA(t,e){let i=jc(t,e),n=!!(t.injected?.skills?.length&&t.status==="active"),r=t.agentRole||"unknown",o={id:t.gkSessionId,agentType:i?"orchestrator":"sub-agent",role:r,characterType:gc(r),icon:Qo(r,i),state:g9(t.status,n),activeSkill:t.injected?.skills?.[0]||null,progress:x9(t),speechBubble:G9(t),hasFireEffect:n,gkSessionId:t.gkSessionId,parentSessionId:t.parentGkSessionId};if(i){let a=e.agents.filter(c=>!jc(c,e));return{...o,agentType:"orchestrator",delegatedTo:a.filter(c=>c.status==="active").map(c=>c.gkSessionId),totalSubAgents:a.length,completedSubAgents:a.filter(c=>c.status==="completed").length}}return o}function iA(t){let e=t.endTime&&t.startTime?new Date(t.endTime).getTime()-new Date(t.startTime).getTime():0;return{id:`inbox-${t.gkSessionId}`,agentId:t.gkSessionId,agentRole:t.agentRole||"unknown",agentIcon:Qo(t.agentRole||""),timestamp:t.endTime?new Date(t.endTime).getTime():Date.now(),status:"unread",title:`${dc(t.agentRole||"Agent")} completed`,preview:t.prompt?t.prompt.slice(0,100):"Task completed",fullContent:null,tokenUsage:t.tokenUsage?{input:t.tokenUsage.input,output:t.tokenUsage.output}:null,duration:e,skillsUsed:t.injected?.skills||[]}}function Bi(t){let e=Wt();if(!t)return e;e.sessionId=t.gkSessionId,e.projectDir=t.projectDir,e.activePlan=t.activePlan,e.appName=t.appName||null,e.isActive=t.agents.some(i=>i.status==="active");for(let i of t.agents){let n=tA(i,t);n.agentType==="orchestrator"?e.orchestrator=n:e.agents.set(n.id,n),i.status==="completed"&&(e.inbox.find(o=>o.agentId===i.gkSessionId)||e.inbox.push(iA(i)))}return e.inbox.sort((i,n)=>n.timestamp-i.timestamp),e}import{existsSync as Zi,readdirSync as Jo,statSync as xc}from"fs";import{join as nt,basename as S9,extname as nA,relative as Y9}from"path";import{createHash as W9}from"crypto";function M9(t,e){let i={plan:"\u{1F4CB}",phase:"\u{1F4D1}",research:"\u{1F50D}",artifact:"\u{1F4E6}",report:"\u{1F4CA}",other:"\u{1F4C4}"};return t==="artifact"?{sql:"\u{1F5C4}\uFE0F",json:"\u{1F4E6}",png:"\u{1F5BC}\uFE0F",jpg:"\u{1F5BC}\uFE0F",ts:"\u{1F4BB}",js:"\u{1F4BB}"}[e]||i.artifact:i[t]}function rA(t){let e=t.match(/^phase-(\d+)/);return e?parseInt(e[1],10):null}function C9(t,e){if(e==="phase"){let i=rA(t),n=t.replace(/^phase-\d+-?/,"").replace(/-/g," ");return i!==null?`Phase ${i}: ${n}`:t}return t.replace(/-/g," ").replace(/\b\w/g,i=>i.toUpperCase())}function bi(t,e,i){let n=xc(t),r=S9(t,nA(t)),o=nA(t).slice(1);return{id:W9("md5").update(t).digest("hex").slice(0,8),name:r,displayName:C9(r,e),type:e,icon:M9(e,o),path:t,relativePath:Y9(i,t),modifiedAt:n.mtimeMs,createdAt:n.birthtimeMs,size:n.size,extension:o,phaseNumber:rA(r)}}function Gc(t){if(!Zi(t))return[];let e=[],i=nt(t,"plan.md");Zi(i)&&e.push(bi(i,"plan",t));let n=Jo(t);for(let c of n){let l=nt(t,c),v=xc(l);if(c.startsWith("phase-"))if(v.isDirectory()){let A=nt(l,"phase.md");Zi(A)&&e.push(bi(A,"phase",t))}else c.endsWith(".md")&&e.push(bi(l,"phase",t))}let r=nt(t,"research");if(Zi(r)){let c=Jo(r).filter(l=>l.endsWith(".md"));for(let l of c)e.push(bi(nt(r,l),"research",t))}let o=nt(t,"artifacts");if(Zi(o)){let c=Jo(o);for(let l of c){let v=nt(o,l);xc(v).isFile()&&e.push(bi(v,"artifact",t))}}let a=nt(t,"reports");if(Zi(a)){let c=Jo(a).filter(l=>l.endsWith(".md"));for(let l of c)e.push(bi(nt(a,l),"report",t))}return e.sort((c,l)=>l.modifiedAt-c.modifiedAt),e}var O9=1e3,Mt=class{state;stateListeners=new Set;eventListeners=new Set;eventHistory=[];constructor(e){this.state=e}onStateChange(e){return this.stateListeners.add(e),e(this.state),()=>this.stateListeners.delete(e)}onEvent(e){return this.eventListeners.add(e),()=>this.eventListeners.delete(e)}emit(e){this.eventHistory.push(e),this.eventHistory.length>O9&&this.eventHistory.shift();for(let i of this.eventListeners)try{i(e)}catch(n){console.error("Event listener error:",n)}}setState(e){this.state=e;for(let i of this.stateListeners)try{i(this.state)}catch(n){console.error("State listener error:",n)}}getState(){return this.state}getHistory(){return[...this.eventHistory]}replay(e){return this.eventHistory.filter(i=>i.timestamp>=e)}dispose(){this.stateListeners.clear(),this.eventListeners.clear(),this.eventHistory=[]}};import{existsSync as U9,readFileSync as K9,statSync as oA}from"fs";var V9=200,Ct=class{pollInterval=null;previousSession=null;previousMtime=0;options;sessionPath=null;constructor(e){this.options=e}start(){let e=N(),i=e.PROJECT_DIR,n=e.ACTIVE_GK_SESSION_ID;if(!i||!n)return this.options.onError(new Error("No active session found")),!1;if(this.sessionPath=kt(i,n),!U9(this.sessionPath))return this.options.onError(new Error(`Session file not found: ${this.sessionPath}`)),!1;try{let r=oA(this.sessionPath);this.previousMtime=r.mtimeMs}catch{}return this.loadSession(),this.pollInterval=setInterval(()=>{this.checkForChanges()},V9),!0}stop(){this.pollInterval&&(clearInterval(this.pollInterval),this.pollInterval=null)}checkForChanges(){if(this.sessionPath)try{let i=oA(this.sessionPath).mtimeMs;i>this.previousMtime&&(this.previousMtime=i,this.loadSession())}catch{}}loadSession(){if(this.sessionPath)try{let e=K9(this.sessionPath,"utf-8"),i=JSON.parse(e),n=this.previousSession?this.diffSessions(this.previousSession,i):[];this.previousSession=i,this.options.onSessionChange(i);for(let r of n)this.options.onEvent(r)}catch(e){this.options.onError(e)}}diffSessions(e,i){let n=[],r=Date.now(),o=new Map(e.agents.map(l=>[l.gkSessionId,l]));for(let l of i.agents){let v=o.get(l.gkSessionId);if(!v)n.push(this.createEvent("received_work",l,r)),l.injected?.skills?.length&&n.push(this.createEvent("skill_activated",l,r,l.injected.skills[0]));else{v.status==="active"&&l.status==="completed"&&(n.push(this.createEvent("task_complete",l,r)),n.push(this.createEvent("delivering",l,r)));let A=v.injected?.skills||[],I=(l.injected?.skills||[]).filter(E=>!A.includes(E));for(let E of I)n.push(this.createEvent("skill_activated",l,r,E))}}let a=i.agents.every(l=>l.status==="completed"||l.status==="failed"),c=e.agents.some(l=>l.status==="active");return a&&c&&i.agents.length>0&&n.push({type:"session_complete",agentId:i.gkSessionId,targetAgentId:null,skill:null,message:"All tasks completed",timestamp:r}),n}createEvent(e,i,n,r){let o={agent_idle:"Waiting for work",agent_working:"Working...",skill_activated:`Activated skill: ${r||"unknown"}`,handoff_start:"Passing work...",handoff_complete:"Handoff complete!",received_work:"Received work",delivering:"Delivering results...",task_complete:"Task complete!",session_complete:"All tasks completed"};return{type:e,agentId:i.gkSessionId,targetAgentId:i.parentGkSessionId,skill:r||i.injected?.skills?.[0]||null,message:o[e],timestamp:n,characterType:gc(i.agentRole||"coder")}}};import{exec as J9}from"child_process";import{join as B9}from"path";import{createServer as N9}from"http";import{WebSocketServer as k9,WebSocket as sA}from"ws";import{exec as F9}from"child_process";import{existsSync as cA}from"fs";import{resolve as Q9}from"path";function aA(){return`<!DOCTYPE html>
81
+ `.trim(),n=ye("powershell",["-NoProfile","-NonInteractive","-Command",i],{encoding:"utf-8",windowsHide:!0});return n.stderr?.includes("NO_IMAGE")?{success:!1,error:"No image in clipboard. Copy an image first."}:n.status!==0?{success:!1,error:`Failed: ${n.stderr||n.stdout}`.trim()}:ce(t)?{success:!0,path:t}:{success:!1,error:"File not created"}}function Jp(t){return ye("which",["pngpaste"],{encoding:"utf-8"}).status===0&&ye("pngpaste",[t],{encoding:"utf-8"}).status===0&&ce(t)?{success:!0,path:t}:{success:!1,error:"No image or pngpaste failed",suggestion:"brew install pngpaste"}}function bp(t){if(ye("which",["xclip"],{encoding:"utf-8"}).status!==0)return{success:!1,error:"xclip not installed",suggestion:"apt install xclip"};let i=ye("xclip",["-selection","clipboard","-t","TARGETS","-o"],{encoding:"utf-8"});if(!i.stdout?.includes("image/png")&&!i.stdout?.includes("image/jpeg"))return{success:!1,error:"No image in clipboard"};let n=i.stdout.includes("image/png")?"image/png":"image/jpeg",r=ye("xclip",["-selection","clipboard","-t",n,"-o"],{encoding:"buffer"});return r.status!==0||!r.stdout?.length?{success:!1,error:"Failed to read clipboard"}:(Op(t,r.stdout),ce(t)?{success:!0,path:t}:{success:!1,error:"Save failed"})}function Bp(t){if(t.success&&t.path){let e=gc(t.path);return{success:!0,message:"Image captured",path:t.path,size:`${(e.size/1024).toFixed(1)} KB`,platform:t.platform}}return{success:!1,error:t.error,suggestion:t.suggestion,platform:t.platform}}function Zp(){let t=process.platform,e=lA(),i;switch(t){case"win32":i=Pp(e);break;case"darwin":i=qp(e);break;case"linux":i=yp(e);break;default:i={success:!1,error:`Unsupported platform: ${t}`,suggestion:"This tool supports Windows, macOS, and Linux only"}}return i.platform=t,i.tempDir=e,i}function Pp(t){let e=`
82
+ Add-Type -AssemblyName System.Windows.Forms
83
+
84
+ # Try to get file drop list from clipboard (copied files)
85
+ $files = [System.Windows.Forms.Clipboard]::GetFileDropList()
86
+
87
+ if ($files -and $files.Count -gt 0) {
88
+ # Return first video file found in clipboard
89
+ foreach ($file in $files) {
90
+ $ext = [System.IO.Path]::GetExtension($file).ToLower()
91
+ if ($ext -in @('.mp4', '.webm', '.mov', '.avi', '.mkv', '.gif')) {
92
+ Write-Output "FILE:$file"
93
+ exit 0
94
+ }
95
+ }
96
+ }
97
+
98
+ # Fallback: Check for recent Snipping Tool videos
99
+ $snipFolder = [System.IO.Path]::Combine($env:USERPROFILE, 'Videos', 'Screen Recordings')
100
+ if (Test-Path $snipFolder) {
101
+ $recentVideo = Get-ChildItem -Path $snipFolder -Filter "*.mp4" |
102
+ Sort-Object LastWriteTime -Descending |
103
+ Select-Object -First 1
104
+
105
+ if ($recentVideo) {
106
+ $age = (Get-Date) - $recentVideo.LastWriteTime
107
+ if ($age.TotalMinutes -le 5) {
108
+ Write-Output "SNIP:$($recentVideo.FullName)"
109
+ exit 0
110
+ }
111
+ }
112
+ }
113
+
114
+ # Also check Screenshots folder (some versions save there)
115
+ $screenshotFolder = [System.IO.Path]::Combine($env:USERPROFILE, 'Pictures', 'Screenshots')
116
+ if (Test-Path $screenshotFolder) {
117
+ $recentVideo = Get-ChildItem -Path $screenshotFolder -Filter "*.mp4" |
118
+ Sort-Object LastWriteTime -Descending |
119
+ Select-Object -First 1
120
+
121
+ if ($recentVideo) {
122
+ $age = (Get-Date) - $recentVideo.LastWriteTime
123
+ if ($age.TotalMinutes -le 5) {
124
+ Write-Output "SNIP:$($recentVideo.FullName)"
125
+ exit 0
126
+ }
127
+ }
128
+ }
129
+
130
+ # Also check Videos folder root
131
+ $videosFolder = [System.IO.Path]::Combine($env:USERPROFILE, 'Videos')
132
+ if (Test-Path $videosFolder) {
133
+ $recentVideo = Get-ChildItem -Path $videosFolder -Filter "*.mp4" -File |
134
+ Sort-Object LastWriteTime -Descending |
135
+ Select-Object -First 1
136
+
137
+ if ($recentVideo) {
138
+ $age = (Get-Date) - $recentVideo.LastWriteTime
139
+ if ($age.TotalMinutes -le 5) {
140
+ Write-Output "SNIP:$($recentVideo.FullName)"
141
+ exit 0
142
+ }
143
+ }
144
+ }
145
+
146
+ Write-Error "NO_VIDEO_FOUND"
147
+ exit 1
148
+ `.trim();try{let i=ye("powershell",["-NoProfile","-NonInteractive","-Command",e],{encoding:"utf-8",windowsHide:!0,timeout:1e4});if(i.error)return{success:!1,error:`PowerShell error: ${i.error.message}`};if(i.stderr?.includes("NO_VIDEO_FOUND"))return{success:!1,error:"No video found in clipboard or recent recordings.",suggestion:"Copy a video file or record with Snipping Tool (Win+Shift+R) first."};if(i.status!==0)return{success:!1,error:`Failed to capture: ${(i.stderr||i.stdout||"Unknown PowerShell error").trim()}`};let n=i.stdout.trim(),r=null,o="clipboard";if(n.startsWith("FILE:")?(r=n.substring(5),o="clipboard"):n.startsWith("SNIP:")&&(r=n.substring(5),o="snipping-tool"),!r||!ce(r))return{success:!1,error:"Video file not found or inaccessible"};let s=yi(r),c=bo(s),l=ae(t,c);return Jo(r,l),ce(l)?{success:!0,path:l,sourcePath:r,sourceType:o}:{success:!1,error:"Failed to copy video file"}}catch(i){return{success:!1,error:`Windows video capture error: ${i instanceof Error?i.message:String(i)}`}}}function qp(t){let e=`
149
+ use scripting additions
150
+
151
+ set thePath to ""
152
+
153
+ try
154
+ set theFiles to the clipboard as \xABclass furl\xBB
155
+ set thePath to POSIX path of theFiles
156
+ on error
157
+ try
158
+ set theFiles to the clipboard as list
159
+ if (count of theFiles) > 0 then
160
+ set thePath to POSIX path of (item 1 of theFiles)
161
+ end if
162
+ end try
163
+ end try
164
+
165
+ if thePath is not "" then
166
+ return thePath
167
+ else
168
+ return "NO_FILE"
169
+ end if
170
+ `.trim();try{let i=ye("osascript",["-e",e],{encoding:"utf-8",timeout:5e3});if(i.stdout&&i.stdout.trim()!=="NO_FILE"){let r=i.stdout.trim();if(!xc(r))return{success:!1,error:"Clipboard does not contain a video file",suggestion:"Copy a video file (.mp4, .mov, .webm) to clipboard first"};if(!ce(r))return{success:!1,error:"Video file not found"};let o=yi(r),s=bo(o),c=ae(t,s);if(Jo(r,c),ce(c))return{success:!0,path:c,sourcePath:r,sourceType:"clipboard"}}let n=vA([ae(qi(),"Movies"),ae(qi(),"Desktop")],t);return n||{success:!1,error:"No video in clipboard or recent recordings",suggestion:"Copy a video file or use Cmd+Shift+5 to record screen"}}catch(i){return{success:!1,error:`macOS video capture error: ${i instanceof Error?i.message:String(i)}`}}}function yp(t){try{if(ye("which",["xclip"],{encoding:"utf-8"}).status!==0)return{success:!1,error:"xclip is not installed",suggestion:"Install with: sudo apt install xclip"};let i=ye("xclip",["-selection","clipboard","-t","text/uri-list","-o"],{encoding:"utf-8",timeout:5e3});if(i.status===0&&i.stdout){let r=i.stdout.trim(),o=r;if(r.startsWith("file://")&&(o=decodeURIComponent(r.replace("file://",""))),xc(o)&&ce(o)){let s=yi(o),c=bo(s),l=ae(t,c);if(Jo(o,l),ce(l))return{success:!0,path:l,sourcePath:o,sourceType:"clipboard"}}}let n=vA([ae(qi(),"Videos"),ae(qi(),"Screencasts"),ae(qi(),"Desktop")],t);return n||{success:!1,error:"No video in clipboard or recent recordings",suggestion:"Copy a video file or use a screen recorder first"}}catch(e){return{success:!1,error:`Linux video capture error: ${e instanceof Error?e.message:String(e)}`}}}function Dp(t){if(t.success&&t.path){let i=(gc(t.path).size/(1024*1024)).toFixed(2),n=yi(t.path).toLowerCase();return{success:!0,message:`Video captured from ${t.sourceType}`,path:t.path,sourcePath:t.sourcePath,sourceType:t.sourceType,size:`${i} MB`,format:n.substring(1).toUpperCase(),platform:t.platform}}return{success:!1,error:t.error,suggestion:t.suggestion||"Record a video with Snipping Tool (Win+Shift+R) or copy a video file to clipboard",platform:t.platform}}var AA={"claude-3-opus":"gemini-2.5-pro","claude-3-sonnet":"gemini-2.5-flash","claude-3-haiku":"gemini-2.5-flash","claude-3.5-sonnet":"gemini-2.5-pro","claude-3.5-haiku":"gemini-2.5-flash","gemini-2.5-pro":"gemini-2.5-pro","gemini-2.5-flash":"gemini-2.5-flash","gemini-3-flash-preview":"gemini-3-flash-preview"};import{existsSync as le,readFileSync as Bo,readdirSync as Zo,mkdirSync as Yc,writeFileSync as uA,copyFileSync as Gc,statSync as mA}from"fs";import{join as W}from"path";var wp=".claude/skills",Tp=".gemini/extensions",Xp=".claude/agents",Hp=".gemini/agents";function Wc(t){let e=t.match(/^---\r?\n([\s\S]*?)\r?\n---/);if(!e)return null;let i={name:"",description:""},n=e[1].split(/\r?\n/);for(let r of n){let o=r.indexOf(":");if(o===-1)continue;let s=r.slice(0,o).trim(),c=r.slice(o+1).trim();(c.startsWith('"')&&c.endsWith('"')||c.startsWith("'")&&c.endsWith("'"))&&(c=c.slice(1,-1)),i[s]=c}return i}function Po(t=process.cwd()){return W(t,wp)}function qo(t=process.cwd()){return W(t,Tp)}function yo(t=process.cwd()){let e=Po(t);if(!le(e))return[];let i=[];try{let n=Zo(e,{withFileTypes:!0}).filter(r=>r.isDirectory()).map(r=>r.name);for(let r of n){let o=W(e,r),s=W(o,"SKILL.md"),c=W(o,"references"),l=le(s),v=le(c)&&mA(c).isDirectory(),A;if(l)try{let u=Bo(s,"utf-8");A=Wc(u)?.description}catch{}i.push({name:r,path:o,hasSkillMd:l,hasReferences:v,description:A})}}catch{}return i.sort((n,r)=>n.name.localeCompare(r.name))}function Mc(t,e=process.cwd()){let i=W(qo(e),t);return le(i)}function Lp(t,e){let i=["SKILL.md"];return e&&i.push("references/*.md"),{name:t.name||"",version:"1.0.0",description:t.description||"",license:"MIT",contextFileName:i}}function Sc(t,e,i){le(e)||(Yc(e,{recursive:!0}),i.push(e));let n=Zo(t,{withFileTypes:!0});for(let r of n){let o=W(t,r.name),s=W(e,r.name);r.isDirectory()?Sc(o,s,i):(Gc(o,s),i.push(s))}}function Cc(t,e={},i=process.cwd()){let n={skill:t,success:!1,created:[],skipped:[],errors:[]},r=Po(i),o=qo(i),s=W(r,t),c=W(o,t);if(!le(s))return n.errors.push(`Skill not found: ${t}`),n;let l=W(s,"SKILL.md");if(!le(l))return n.errors.push(`SKILL.md not found in ${t}`),n;if(Mc(t,i)&&!e.force)return n.skipped.push(`Extension already exists: ${t} (use --force to overwrite)`),n;let v=null;try{let E=Bo(l,"utf-8");v=Wc(E)}catch(E){return n.errors.push(`Failed to read SKILL.md: ${E instanceof Error?E.message:String(E)}`),n}(!v||!v.name)&&(v={name:t,description:""});let A=W(s,"references"),u=le(A)&&mA(A).isDirectory(),I=Lp(v,u);if(e.dryRun)return n.created.push(`[DRY RUN] Would create: ${c}`),n.created.push(`[DRY RUN] Would create: ${W(c,"gemini-extension.json")}`),n.created.push("[DRY RUN] Would copy: SKILL.md"),u&&n.created.push("[DRY RUN] Would copy: references/"),n.success=!0,n;try{le(c)||(Yc(c,{recursive:!0}),n.created.push(c));let E=W(c,"gemini-extension.json");uA(E,JSON.stringify(I,null,2)+`
171
+ `),n.created.push(E);let f=W(c,"SKILL.md");if(Gc(l,f),n.created.push(f),u){let h=W(c,"references");Sc(A,h,n.created)}let R=Zo(s,{withFileTypes:!0});for(let h of R){if(h.name==="SKILL.md"||h.name==="references")continue;let H=W(s,h.name),ve=W(c,h.name);h.isDirectory()?Sc(H,ve,n.created):(Gc(H,ve),n.created.push(ve))}n.success=!0}catch(E){n.errors.push(`Failed to convert: ${E instanceof Error?E.message:String(E)}`)}return n}function EA(t={},e=process.cwd()){let i=yo(e),n=[];for(let r of i){let o=Cc(r.name,t,e);n.push(o)}return n}function Oc(t){return{total:t.length,success:t.filter(e=>e.success&&e.errors.length===0&&e.skipped.length===0).length,skipped:t.filter(e=>e.skipped.length>0).length,failed:t.filter(e=>e.errors.length>0).length}}function Do(t=process.cwd()){return W(t,Xp)}function wo(t=process.cwd()){return W(t,Hp)}function IA(t){let e=Wc(t);return e?{name:e.name||"",description:e.description||"",model:e.model,skills:e.skills}:null}function To(t=process.cwd()){let e=Do(t);if(!le(e))return[];let i=[];try{let n=Zo(e,{withFileTypes:!0}).filter(r=>r.isFile()&&r.name.endsWith(".md")).map(r=>r.name);for(let r of n){let o=W(e,r),s=r.replace(/\.md$/,""),c,l,v;try{let A=Bo(o,"utf-8"),u=IA(A);u&&(c=u.description,l=u.model,v=u.skills)}catch{}i.push({name:s,path:o,description:c,model:l,skills:v})}}catch{}return i.sort((n,r)=>n.name.localeCompare(r.name))}function Uc(t,e=process.cwd()){let i=W(wo(e),`${t}.md`);return le(i)}function _p(t){if(t)return AA[t]||t}function $p(t,e){let i=t.match(/^(---\r?\n)([\s\S]*?)(\r?\n---)/);if(!i)return t;let[n,r,o,s]=i,c=o.split(/\r?\n/),l=[],v=new Set;for(let u of c){let I=u.indexOf(":");if(I===-1){l.push(u);continue}let E=u.slice(0,I).trim();E in e?(v.add(E),e[E]!==void 0&&l.push(`${E}: ${e[E]}`)):l.push(u)}for(let[u,I]of Object.entries(e))!v.has(u)&&I!==void 0&&l.push(`${u}: ${I}`);let A=r+l.join(`
172
+ `)+s;return t.replace(n,A)}function Kc(t,e={},i=process.cwd()){let n={skill:t,success:!1,created:[],skipped:[],errors:[]},r=Do(i),o=wo(i),s=W(r,`${t}.md`),c=W(o,`${t}.md`);if(!le(s))return n.errors.push(`Agent not found: ${t}`),n;if(Uc(t,i)&&!e.force)return n.skipped.push(`Agent already exists in .gemini/agents: ${t} (use --force to overwrite)`),n;let l;try{l=Bo(s,"utf-8")}catch(E){return n.errors.push(`Failed to read agent file: ${E instanceof Error?E.message:String(E)}`),n}let A=IA(l)?.model,u=_p(A),I=l;if(A&&u&&A!==u&&(I=$p(l,{model:u})),e.dryRun)return n.created.push(`[DRY RUN] Would create: ${c}`),A&&u&&A!==u&&n.created.push(`[DRY RUN] Would map model: ${A} -> ${u}`),n.success=!0,n;try{le(o)||Yc(o,{recursive:!0}),uA(c,I),n.created.push(c),A&&u&&A!==u&&n.created.push(`Model mapped: ${A} -> ${u}`),n.success=!0}catch(E){n.errors.push(`Failed to convert: ${E instanceof Error?E.message:String(E)}`)}return n}function pA(t={},e=process.cwd()){let i=To(e),n=[];for(let r of i){let o=Kc(r.name,t,e);n.push(o)}return n}function fA(){console.log(),console.log(p.default.bold(a.geminiPurple("Convert .claude to .gemini"))),console.log(),console.log("Usage:"),console.log(` ${a.primary("gk convert")} <type> [name] [options]`),console.log(),console.log("Types:"),console.log(` ${a.primary("skill")} <name> Convert a single skill to extension`),console.log(` ${a.primary("skills")} Convert all skills to extensions`),console.log(` ${a.primary("agent")} <name> Convert a single agent`),console.log(` ${a.primary("agents")} Convert all agents`),console.log(),console.log("Options:"),console.log(` ${a.dim("--list")} List available items`),console.log(` ${a.dim("--force")} Overwrite existing items`),console.log(` ${a.dim("--dry-run")} Show what would be done without changes`),console.log(` ${a.dim("--json")} Output as JSON`),console.log(),console.log("Examples:"),console.log(` ${a.dim("gk convert skill --list")}`),console.log(` ${a.dim("gk convert skill my-skill")}`),console.log(` ${a.dim("gk convert skills --force")}`),console.log(` ${a.dim("gk convert agent --list")}`),console.log(` ${a.dim("gk convert agents --dry-run")}`),console.log()}function hA(t){t.command("convert [type] [name]","Convert .claude to .gemini resources").alias("cv").option("--all","[all] Convert all items").option("--list","[all] List available items").option("--force","[all] Overwrite existing items").option("--dry-run","[all] Show what would be done without making changes").option("--json","[all] Output as JSON").action(async(e,i,n)=>{if(!e){fA();return}if(e==="skill"||e==="skills"){if(n.list){await e9(n);return}if(n.all||e==="skills"){await i9(n);return}i||(console.log(),m.error("Skill name required"),console.log(a.dim("Usage: gk convert skill <name>")),console.log(a.dim(" gk convert skill --list (to see available skills)")),console.log(a.dim(" gk convert skills (to convert all)")),console.log(),process.exit(1)),await t9(i,n);return}if(e==="agent"||e==="agents"){if(n.list){await n9(n);return}if(n.all||e==="agents"){await o9(n);return}i||(console.log(),m.error("Agent name required"),console.log(a.dim("Usage: gk convert agent <name>")),console.log(a.dim(" gk convert agent --list (to see available agents)")),console.log(a.dim(" gk convert agents (to convert all)")),console.log(),process.exit(1)),await r9(i,n);return}fA()})}async function e9(t){let e=yo();if(t.json){console.log(JSON.stringify(e,null,2));return}if(console.log(),console.log(p.default.bold(a.geminiPurple("Available Claude Skills"))),console.log(a.dim(` Source: ${Po()}`)),console.log(),e.length===0){m.info("No skills found in .claude/skills/"),console.log();return}for(let i of e){let n=Mc(i.name),r=n?a.success("\u2713"):a.dim("\u25CB"),o=n?a.dim(" (converted)"):"";if(console.log(` ${r} ${a.primary(i.name)}${o}`),i.description){let s=i.description.length>70?i.description.slice(0,70)+"...":i.description;console.log(` ${a.dim(s)}`)}}console.log(),console.log(a.dim(` Total: ${e.length} skills`)),console.log()}async function t9(t,e){let i=Cc(t,{force:e.force,dryRun:e.dryRun});if(e.json){console.log(JSON.stringify(i,null,2));return}if(console.log(),i.errors.length>0){m.error(`Failed to convert skill: ${t}`);for(let n of i.errors)console.log(` ${a.error("\u2717")} ${n}`);console.log(),process.exit(1)}if(i.skipped.length>0){m.warn(`Skipped skill: ${t}`);for(let n of i.skipped)console.log(` ${a.dim("\u25CB")} ${n}`);console.log();return}if(e.dryRun){m.info(`[DRY RUN] Would convert skill: ${t}`);for(let n of i.created)console.log(` ${a.dim("\u2192")} ${n}`);console.log();return}m.success(`Converted skill: ${a.primary(t)}`),console.log(),console.log(` ${a.dim("Created files:")}`);for(let n of i.created.slice(0,5)){let r=n.replace(process.cwd(),".");console.log(` ${a.success("+")} ${r}`)}i.created.length>5&&console.log(` ${a.dim(`... and ${i.created.length-5} more`)}`),console.log(),console.log(a.dim(` Extension created at: ${qo()}/${t}`)),console.log()}async function i9(t){if(yo().length===0){t.json?console.log(JSON.stringify({results:[],summary:{total:0,success:0,skipped:0,failed:0}},null,2)):(console.log(),m.info("No skills found in .claude/skills/"),console.log());return}let i=EA({force:t.force,dryRun:t.dryRun}),n=Oc(i);if(t.json){console.log(JSON.stringify({results:i,summary:n},null,2));return}console.log(),t.dryRun?console.log(p.default.bold(a.geminiPurple("[DRY RUN] Skill Conversion Preview"))):console.log(p.default.bold(a.geminiPurple("Skill Conversion Results"))),console.log(M.line()),console.log();for(let r of i)if(r.errors.length>0){console.log(` ${a.error("\u2717")} ${r.skill}`);for(let o of r.errors)console.log(` ${a.dim(o)}`)}else if(r.skipped.length>0)console.log(` ${a.dim("\u25CB")} ${r.skill} ${a.dim("(skipped)")}`);else if(r.success){let o=t.dryRun?a.dim("\u2192"):a.success("\u2713");console.log(` ${o} ${r.skill}`)}console.log(),console.log(M.line()),console.log(),t.dryRun?(console.log(` ${a.dim("Would convert:")} ${n.success} skills`),console.log(` ${a.dim("Would skip:")} ${n.skipped} skills`),console.log(` ${a.dim("Would fail:")} ${n.failed} skills`)):(console.log(` ${a.success("Converted:")} ${n.success}`),console.log(` ${a.dim("Skipped:")} ${n.skipped}`),console.log(` ${a.error("Failed:")} ${n.failed}`)),console.log(),n.skipped>0&&!t.force&&(m.info("Use --force to overwrite existing extensions"),console.log())}async function n9(t){let e=To();if(t.json){console.log(JSON.stringify(e,null,2));return}if(console.log(),console.log(p.default.bold(a.geminiPurple("Available Claude Agents"))),console.log(a.dim(` Source: ${Do()}`)),console.log(),e.length===0){m.info("No agents found in .claude/agents/"),console.log();return}for(let i of e){let n=Uc(i.name),r=n?a.success("\u2713"):a.dim("\u25CB"),o=n?a.dim(" (converted)"):"";if(console.log(` ${r} ${a.primary(i.name)}${o}`),i.model&&console.log(` ${a.dim("Model:")} ${i.model}`),i.description){let s=i.description.length>60?i.description.slice(0,60)+"...":i.description;console.log(` ${a.dim(s)}`)}}console.log(),console.log(a.dim(` Total: ${e.length} agents`)),console.log()}async function r9(t,e){let i=Kc(t,{force:e.force,dryRun:e.dryRun});if(e.json){console.log(JSON.stringify(i,null,2));return}if(console.log(),i.errors.length>0){m.error(`Failed to convert agent: ${t}`);for(let n of i.errors)console.log(` ${a.error("\u2717")} ${n}`);console.log(),process.exit(1)}if(i.skipped.length>0){m.warn(`Skipped agent: ${t}`);for(let n of i.skipped)console.log(` ${a.dim("\u25CB")} ${n}`);console.log();return}if(e.dryRun){m.info(`[DRY RUN] Would convert agent: ${t}`);for(let n of i.created)console.log(` ${a.dim("\u2192")} ${n}`);console.log();return}m.success(`Converted agent: ${a.primary(t)}`),console.log();for(let n of i.created){let r=n.replace(process.cwd(),".");console.log(` ${a.success("+")} ${r}`)}console.log(),console.log(a.dim(` Agent created at: ${wo()}/${t}.md`)),console.log()}async function o9(t){if(To().length===0){t.json?console.log(JSON.stringify({results:[],summary:{total:0,success:0,skipped:0,failed:0}},null,2)):(console.log(),m.info("No agents found in .claude/agents/"),console.log());return}let i=pA({force:t.force,dryRun:t.dryRun}),n=Oc(i);if(t.json){console.log(JSON.stringify({results:i,summary:n},null,2));return}console.log(),t.dryRun?console.log(p.default.bold(a.geminiPurple("[DRY RUN] Agent Conversion Preview"))):console.log(p.default.bold(a.geminiPurple("Agent Conversion Results"))),console.log(M.line()),console.log();for(let r of i)if(r.errors.length>0){console.log(` ${a.error("\u2717")} ${r.skill}`);for(let o of r.errors)console.log(` ${a.dim(o)}`)}else if(r.skipped.length>0)console.log(` ${a.dim("\u25CB")} ${r.skill} ${a.dim("(skipped)")}`);else if(r.success){let o=t.dryRun?a.dim("\u2192"):a.success("\u2713");console.log(` ${o} ${r.skill}`)}console.log(),console.log(M.line()),console.log(),t.dryRun?(console.log(` ${a.dim("Would convert:")} ${n.success} agents`),console.log(` ${a.dim("Would skip:")} ${n.skipped} agents`),console.log(` ${a.dim("Would fail:")} ${n.failed} agents`)):(console.log(` ${a.success("Converted:")} ${n.success}`),console.log(` ${a.dim("Skipped:")} ${n.skipped}`),console.log(` ${a.error("Failed:")} ${n.failed}`)),console.log(),n.skipped>0&&!t.force&&(m.info("Use --force to overwrite existing agents"),console.log())}function Kt(){return{orchestrator:null,agents:new Map,sessionId:null,projectDir:null,activePlan:null,appName:null,currentNotification:null,inbox:[],documents:[],isActive:!1}}var s9=[[/research|search|analyze/i,"\u{1F50D}"],[/code|implement|execute|develop/i,"\u{1F4BB}"],[/plan|architect/i,"\u{1F4CB}"],[/debug|fix|troubleshoot/i,"\u{1F41B}"],[/test|qa|quality/i,"\u{1F9EA}"],[/design|ui|ux/i,"\u{1F3A8}"],[/review|audit|check/i,"\u2705"],[/doc|write|content/i,"\u{1F4DD}"]];function Xo(t,e=!1){if(e)return"\u{1F451}";for(let[i,n]of s9)if(i.test(t))return n;return"\u{1F916}"}function Vc(t){return t.replace(/-/g," ").replace(/\b\w/g,e=>e.toUpperCase())}function kc(t){let e=t.toLowerCase();return e.includes("main")?"orchestrator":e.includes("research")||e.includes("scout")?"researcher":e.includes("code")||e.includes("executor")||e.includes("debug")?"coder":e.includes("plan")?"planner":e.includes("test")?"tester":e.includes("design")||e.includes("ui")||e.includes("ux")||e.includes("artist")?"designer":e.includes("doc")||e.includes("writer")?"writer":e.includes("manager")||e.includes("git")?"manager":"other"}function Nc(t,e){return t.agentType==="Main Agent"||t.parentGkSessionId===null||t.gkSessionId===e.gkSessionId}function a9(t,e){return t==="active"?"working":"idle"}function c9(t){if(t.status==="completed")return 100;if(t.status==="failed"||!t.startTime)return 0;let e=new Date(t.startTime).getTime(),n=Date.now()-e;return Math.min(100,Math.round(n/12e4*100))}function l9(t){return t.status==="completed"?"Task complete!":t.status==="failed"?"Task failed":t.injected?.skills?.length?`Working on ${t.injected.skills[0]}...`:null}function dA(t,e){let i=Nc(t,e),n=!!(t.injected?.skills?.length&&t.status==="active"),r=t.agentRole||"unknown",o={id:t.gkSessionId,agentType:i?"orchestrator":"sub-agent",role:r,characterType:kc(r),icon:Xo(r,i),state:a9(t.status,n),activeSkill:t.injected?.skills?.[0]||null,progress:c9(t),speechBubble:l9(t),hasFireEffect:n,gkSessionId:t.gkSessionId,parentSessionId:t.parentGkSessionId};if(i){let s=e.agents.filter(c=>!Nc(c,e));return{...o,agentType:"orchestrator",delegatedTo:s.filter(c=>c.status==="active").map(c=>c.gkSessionId),totalSubAgents:s.length,completedSubAgents:s.filter(c=>c.status==="completed").length}}return o}function RA(t){let e=t.endTime&&t.startTime?new Date(t.endTime).getTime()-new Date(t.startTime).getTime():0;return{id:`inbox-${t.gkSessionId}`,agentId:t.gkSessionId,agentRole:t.agentRole||"unknown",agentIcon:Xo(t.agentRole||""),timestamp:t.endTime?new Date(t.endTime).getTime():Date.now(),status:"unread",title:`${Vc(t.agentRole||"Agent")} completed`,preview:t.prompt?t.prompt.slice(0,100):"Task completed",fullContent:null,tokenUsage:t.tokenUsage?{input:t.tokenUsage.input,output:t.tokenUsage.output}:null,duration:e,skillsUsed:t.injected?.skills||[]}}function Di(t){let e=Kt();if(!t)return e;e.sessionId=t.gkSessionId,e.projectDir=t.projectDir,e.activePlan=t.activePlan,e.appName=t.appName||null,e.isActive=t.agents.some(i=>i.status==="active");for(let i of t.agents){let n=dA(i,t);n.agentType==="orchestrator"?e.orchestrator=n:e.agents.set(n.id,n),i.status==="completed"&&(e.inbox.find(o=>o.agentId===i.gkSessionId)||e.inbox.push(RA(i)))}return e.inbox.sort((i,n)=>n.timestamp-i.timestamp),e}import{existsSync as wi,readdirSync as Ho,statSync as Fc}from"fs";import{join as ct,basename as v9,extname as zA,relative as A9}from"path";import{createHash as u9}from"crypto";function m9(t,e){let i={plan:"\u{1F4CB}",phase:"\u{1F4D1}",research:"\u{1F50D}",artifact:"\u{1F4E6}",report:"\u{1F4CA}",other:"\u{1F4C4}"};return t==="artifact"?{sql:"\u{1F5C4}\uFE0F",json:"\u{1F4E6}",png:"\u{1F5BC}\uFE0F",jpg:"\u{1F5BC}\uFE0F",ts:"\u{1F4BB}",js:"\u{1F4BB}"}[e]||i.artifact:i[t]}function jA(t){let e=t.match(/^phase-(\d+)/);return e?parseInt(e[1],10):null}function E9(t,e){if(e==="phase"){let i=jA(t),n=t.replace(/^phase-\d+-?/,"").replace(/-/g," ");return i!==null?`Phase ${i}: ${n}`:t}return t.replace(/-/g," ").replace(/\b\w/g,i=>i.toUpperCase())}function Ti(t,e,i){let n=Fc(t),r=v9(t,zA(t)),o=zA(t).slice(1);return{id:u9("md5").update(t).digest("hex").slice(0,8),name:r,displayName:E9(r,e),type:e,icon:m9(e,o),path:t,relativePath:A9(i,t),modifiedAt:n.mtimeMs,createdAt:n.birthtimeMs,size:n.size,extension:o,phaseNumber:jA(r)}}function Qc(t){if(!wi(t))return[];let e=[],i=ct(t,"plan.md");wi(i)&&e.push(Ti(i,"plan",t));let n=Ho(t);for(let c of n){let l=ct(t,c),v=Fc(l);if(c.startsWith("phase-"))if(v.isDirectory()){let A=ct(l,"phase.md");wi(A)&&e.push(Ti(A,"phase",t))}else c.endsWith(".md")&&e.push(Ti(l,"phase",t))}let r=ct(t,"research");if(wi(r)){let c=Ho(r).filter(l=>l.endsWith(".md"));for(let l of c)e.push(Ti(ct(r,l),"research",t))}let o=ct(t,"artifacts");if(wi(o)){let c=Ho(o);for(let l of c){let v=ct(o,l);Fc(v).isFile()&&e.push(Ti(v,"artifact",t))}}let s=ct(t,"reports");if(wi(s)){let c=Ho(s).filter(l=>l.endsWith(".md"));for(let l of c)e.push(Ti(ct(s,l),"report",t))}return e.sort((c,l)=>l.modifiedAt-c.modifiedAt),e}var I9=1e3,Vt=class{state;stateListeners=new Set;eventListeners=new Set;eventHistory=[];constructor(e){this.state=e}onStateChange(e){return this.stateListeners.add(e),e(this.state),()=>this.stateListeners.delete(e)}onEvent(e){return this.eventListeners.add(e),()=>this.eventListeners.delete(e)}emit(e){this.eventHistory.push(e),this.eventHistory.length>I9&&this.eventHistory.shift();for(let i of this.eventListeners)try{i(e)}catch(n){console.error("Event listener error:",n)}}setState(e){this.state=e;for(let i of this.stateListeners)try{i(this.state)}catch(n){console.error("State listener error:",n)}}getState(){return this.state}getHistory(){return[...this.eventHistory]}replay(e){return this.eventHistory.filter(i=>i.timestamp>=e)}dispose(){this.stateListeners.clear(),this.eventListeners.clear(),this.eventHistory=[]}};import{existsSync as p9,readFileSync as f9,statSync as gA}from"fs";var h9=200,Nt=class{pollInterval=null;previousSession=null;previousMtime=0;options;sessionPath=null;constructor(e){this.options=e}start(){let e=N(),i=e.PROJECT_DIR,n=e.ACTIVE_GK_SESSION_ID;if(!i||!n)return this.options.onError(new Error("No active session found")),!1;if(this.sessionPath=Zt(i,n),!p9(this.sessionPath))return this.options.onError(new Error(`Session file not found: ${this.sessionPath}`)),!1;try{let r=gA(this.sessionPath);this.previousMtime=r.mtimeMs}catch{}return this.loadSession(),this.pollInterval=setInterval(()=>{this.checkForChanges()},h9),!0}stop(){this.pollInterval&&(clearInterval(this.pollInterval),this.pollInterval=null)}checkForChanges(){if(this.sessionPath)try{let i=gA(this.sessionPath).mtimeMs;i>this.previousMtime&&(this.previousMtime=i,this.loadSession())}catch{}}loadSession(){if(this.sessionPath)try{let e=f9(this.sessionPath,"utf-8"),i=JSON.parse(e),n=this.previousSession?this.diffSessions(this.previousSession,i):[];this.previousSession=i,this.options.onSessionChange(i);for(let r of n)this.options.onEvent(r)}catch(e){this.options.onError(e)}}diffSessions(e,i){let n=[],r=Date.now(),o=new Map(e.agents.map(l=>[l.gkSessionId,l]));for(let l of i.agents){let v=o.get(l.gkSessionId);if(!v)n.push(this.createEvent("received_work",l,r)),l.injected?.skills?.length&&n.push(this.createEvent("skill_activated",l,r,l.injected.skills[0]));else{v.status==="active"&&l.status==="completed"&&(n.push(this.createEvent("task_complete",l,r)),n.push(this.createEvent("delivering",l,r)));let A=v.injected?.skills||[],I=(l.injected?.skills||[]).filter(E=>!A.includes(E));for(let E of I)n.push(this.createEvent("skill_activated",l,r,E))}}let s=i.agents.every(l=>l.status==="completed"||l.status==="failed"),c=e.agents.some(l=>l.status==="active");return s&&c&&i.agents.length>0&&n.push({type:"session_complete",agentId:i.gkSessionId,targetAgentId:null,skill:null,message:"All tasks completed",timestamp:r}),n}createEvent(e,i,n,r){let o={agent_idle:"Waiting for work",agent_working:"Working...",skill_activated:`Activated skill: ${r||"unknown"}`,handoff_start:"Passing work...",handoff_complete:"Handoff complete!",received_work:"Received work",delivering:"Delivering results...",task_complete:"Task complete!",session_complete:"All tasks completed"};return{type:e,agentId:i.gkSessionId,targetAgentId:i.parentGkSessionId,skill:r||i.injected?.skills?.[0]||null,message:o[e],timestamp:n,characterType:kc(i.agentRole||"coder")}}};import{exec as g9}from"child_process";import{join as x9}from"path";import{createServer as d9}from"http";import{WebSocketServer as R9,WebSocket as GA}from"ws";import{exec as z9}from"child_process";import{existsSync as SA}from"fs";import{resolve as j9}from"path";function xA(){return`<!DOCTYPE html>
84
173
  <html lang="en">
85
174
  <head>
86
175
  <meta charset="UTF-8">
@@ -3486,4 +3575,4 @@ hookStopAgentAnimation();
3486
3575
 
3487
3576
  </script>
3488
3577
  </body>
3489
- </html>`}var Bo=class{server=null;wss=null;options;clients=new Set;constructor(e){this.options=e}async start(){return new Promise((e,i)=>{let n=this.options.port,r=0,o=10,a=()=>{this.server=N9((c,l)=>this.handleRequest(c,l)),this.server.on("error",c=>{c.code==="EADDRINUSE"&&r<o?(r++,n++,a()):i(c)}),this.server.listen(n,this.options.host||"localhost",()=>{this.wss=new k9({server:this.server}),this.setupWebSocket(),this.options.emitter.onStateChange(c=>{this.broadcastState(c)}),this.options.emitter.onEvent(c=>{this.broadcastEvent(c)}),e(n)})};a()})}stop(){if(this.wss){for(let e of this.clients)e.close();this.wss.close(),this.wss=null}this.server&&(this.server.close(),this.server=null),this.clients.clear()}handleRequest(e,i){let n=e.url||"/";if(n==="/api/state"){i.writeHead(200,{"Content-Type":"application/json"}),i.end(JSON.stringify(this.serializeState(this.options.emitter.getState())));return}if(n==="/api/history"){i.writeHead(200,{"Content-Type":"application/json"}),i.end(JSON.stringify(this.options.emitter.getHistory()));return}if(n.startsWith("/api/open-doc")){let a=new URL(n,`http://${e.headers.host}`).searchParams.get("path");if(!a){i.writeHead(400,{"Content-Type":"application/json"}),i.end(JSON.stringify({success:!1,error:"No path provided"}));return}let c=a;if(cA(c)||(c=Q9(process.cwd(),a)),!cA(c)){i.writeHead(404,{"Content-Type":"application/json"}),i.end(JSON.stringify({success:!1,error:`File not found: ${a}`}));return}let l=process.env.EDITOR||process.env.VISUAL,A=this.options.emitter.getState().appName?.toLowerCase()||"",I=["code","cursor","windsurf","zed","vim","nvim","nano","subl","atom","idea","webstorm","notepad++","antigravity"].some(h=>A.includes(h)),E;l?(E=`"${l}" "${c}"`,console.log(`[Agent Office] Using IDE from EDITOR env: ${l}`)):A&&I?(E=`${A} "${c}"`,console.log(`[Agent Office] Using IDE from session: ${A}`)):(E=`code "${c}"`,console.log("[Agent Office] No IDE detected, defaulting to VS Code")),F9(E,h=>{h?(i.writeHead(500,{"Content-Type":"application/json"}),i.end(JSON.stringify({success:!1,error:h.message}))):(i.writeHead(200,{"Content-Type":"application/json"}),i.end(JSON.stringify({success:!0})))});return}let r=n.split("?")[0].split("#")[0];if(r==="/"||r==="/index.html"){i.writeHead(200,{"Content-Type":"text/html; charset=utf-8"}),i.end(aA());return}i.writeHead(404),i.end("Not Found")}setupWebSocket(){this.wss&&this.wss.on("connection",e=>{this.clients.add(e);let i=this.options.emitter.getState();try{e.send(JSON.stringify({type:"state",data:this.serializeState(i)}))}catch{}e.on("message",n=>{try{let r=JSON.parse(n.toString());if(r.type==="ping"&&e.send(JSON.stringify({type:"pong"})),r.type==="replay"){let o=this.options.emitter.replay(r.fromTimestamp);e.send(JSON.stringify({type:"replay",data:o}))}}catch{}}),e.on("close",()=>{this.clients.delete(e)})})}broadcastState(e){let i=JSON.stringify({type:"state",data:this.serializeState(e)});for(let n of this.clients)if(n.readyState===sA.OPEN)try{n.send(i)}catch{}}broadcastEvent(e){let i=JSON.stringify({type:"event",data:e});for(let n of this.clients)if(n.readyState===sA.OPEN)try{n.send(i)}catch{}}serializeState(e){return{...e,agents:Object.fromEntries(e.agents)}}};var Zo=class{server=null;emitter;watcher;options;constructor(e={}){this.options={port:3847,host:"localhost",autoOpen:!0,...e},this.emitter=new Mt(Wt()),this.watcher=new Ct({onSessionChange:i=>{let n=Bi(i);if(n.activePlan)try{let r=Ei(),o=B9(r,n.activePlan);n.documents=Gc(o)}catch{}this.emitter.setState(n)},onEvent:i=>{this.emitter.emit(i)},onError:i=>{this.options.onError&&this.options.onError(i)}})}async start(){if(!this.watcher.start())throw new Error("No active session found");this.server=new Bo({port:this.options.port,host:this.options.host,emitter:this.emitter});let i=await this.server.start();return this.options.autoOpen&&this.openBrowser(`http://${this.options.host}:${i}`),this.options.onReady&&this.options.onReady(i),i}stop(){this.server&&(this.server.stop(),this.server=null),this.watcher.stop(),this.emitter.dispose()}openBrowser(e){let i=process.platform==="win32"?`start ${e}`:process.platform==="darwin"?`open ${e}`:`xdg-open ${e}`;J9(i,n=>{n&&console.log(`Open ${e} in your browser`)})}};async function Sc(t={}){let e=new Zo(t);return await e.start(),e}function Yc(){console.log(),console.log(p.default.bold(s.geminiPurple("Agent Office"))),console.log(),console.log("Usage:"),console.log(` ${s.primary("gk office")} <subcommand> [options]`),console.log(),console.log("Subcommands:"),console.log(` ${s.primary("start")} Start the visualization`),console.log(` ${s.primary("status")} Show current office state`),console.log(` ${s.primary("watch")} Watch office state changes`),console.log(),console.log("Options:"),console.log(` ${s.dim("-p, --port <n>")} [start] Web server port (default: 3847)`),console.log(` ${s.dim("--no-open")} [start] Don't auto-open browser`),console.log(` ${s.dim("--json")} [status/watch] Output as JSON`),console.log(),console.log("Examples:"),console.log(` ${s.dim("gk office start")}`),console.log(` ${s.dim("gk office start --port 4000")}`),console.log(` ${s.dim("gk office status --json")}`),console.log(` ${s.dim("gk office watch")}`),console.log()}function Z9(){console.log(),console.log(p.default.bold(s.geminiPurple("gk office start"))),console.log(s.dim("Start the Agent Office web dashboard")),console.log(),console.log("Usage:"),console.log(` ${s.primary("gk office start")} [options]`),console.log(),console.log("Options:"),console.log(` ${s.dim("-p, --port <n>")} Web server port (default: 3847)`),console.log(` ${s.dim("--no-open")} Don't auto-open browser`),console.log(),console.log("Examples:"),console.log(` ${s.dim("gk office start")}`),console.log(` ${s.dim("gk office start --port 4000")}`),console.log(` ${s.dim("gk office start --port 4000 --no-open")}`),console.log()}function b9(){console.log(),console.log(p.default.bold(s.geminiPurple("gk office status"))),console.log(s.dim("Show current Agent Office state")),console.log(),console.log("Usage:"),console.log(` ${s.primary("gk office status")} [options]`),console.log(),console.log("Options:"),console.log(` ${s.dim("--json")} Output as JSON`),console.log()}function P9(){console.log(),console.log(p.default.bold(s.geminiPurple("gk office watch"))),console.log(s.dim("Watch Agent Office state changes in real-time")),console.log(),console.log("Usage:"),console.log(` ${s.primary("gk office watch")} [options]`),console.log(),console.log("Options:"),console.log(` ${s.dim("--json")} Output as JSON`),console.log()}async function q9(t){console.log(),u.info("Starting Agent Office..."),console.log();try{let e=await Sc({port:t.port||3847,autoOpen:t.open!==!1,onReady:i=>{u.success(`Dashboard running at ${s.primary(`http://localhost:${i}`)}`),console.log(s.dim(" Press Ctrl+C to stop")),console.log()},onError:i=>{u.error(`Error: ${i.message}`)}});process.on("SIGINT",()=>{e.stop(),console.log(),u.info("Agent Office stopped."),console.log(),process.exit(0)})}catch(e){e instanceof Error&&(e.message==="No active session found"?(console.log(),u.warn("No active session found."),console.log(s.dim(" Start a GemKit session first with: gk agent")),console.log()):u.error(`Failed to start: ${e.message}`)),process.exit(1)}}function D9(t){let e=new Mt(Wt()),i=new Ct({onSessionChange:r=>{let o=Bi(r);if(t.json)console.log(JSON.stringify({...o,agents:Object.fromEntries(o.agents)},null,2));else{if(console.log(),console.log(p.default.bold(s.geminiPurple("Agent Office Status"))),console.log(M.line()),console.log(),console.log(` ${s.dim("Active Plan:")} ${o.activePlan?s.primary(o.activePlan):s.dim("(none)")}`),console.log(` ${s.dim("Agents:")} ${o.agents.size}`),console.log(` ${s.dim("Inbox Items:")} ${o.inbox.length}`),console.log(` ${s.dim("Documents:")} ${o.documents.length}`),o.agents.size>0){console.log(),console.log(s.dim(" Agents:"));for(let[a,c]of o.agents){let l=c.state==="working"?s.warn:c.state==="idle"?s.success:s.dim;console.log(` ${c.icon} ${s.primary(c.role)} ${l(`[${c.state}]`)}`)}}console.log()}i.stop(),e.dispose()},onEvent:()=>{},onError:r=>{console.log(),u.error(`Error: ${r.message}`),console.log(),process.exit(1)}});i.start()||(console.log(),u.warn("No active session found."),console.log(s.dim(" Start a GemKit session first with: gk agent")),console.log(),process.exit(1))}function y9(t){console.log(),u.info("Watching Agent Office state..."),console.log(s.dim(" Press Ctrl+C to stop")),console.log();let e=new Mt(Wt()),i=new Ct({onSessionChange:r=>{let o=Bi(r);if(t.json)console.log(JSON.stringify({timestamp:new Date().toISOString(),...o,agents:Object.fromEntries(o.agents)}));else{let a=new Date().toLocaleTimeString();console.log(`${s.dim(a)} ${s.info("State:")} ${o.agents.size} agents, ${o.inbox.length} inbox items`)}},onEvent:r=>{if(t.json)console.log(JSON.stringify({type:"event",event:r}));else{let o=new Date().toLocaleTimeString();console.log(`${s.dim(o)} ${s.secondary("Event:")} ${r.type}`)}},onError:r=>{u.error(`Error: ${r.message}`)}});i.start()||(console.log(),u.warn("No active session found."),console.log(s.dim(" Start a GemKit session first with: gk agent")),console.log(),process.exit(1)),process.on("SIGINT",()=>{i.stop(),e.dispose(),console.log(),u.info("Stopped watching."),console.log(),process.exit(0)})}function lA(t){t.command("office [subcommand]","Agent Office visualization (start, status, watch)").option("-p, --port <port>","[start] Web server port",{default:3847}).option("--no-open","[start] Don't auto-open browser").option("--json","[status/watch] Output as JSON").action(async(e,i)=>{if(i.port&&(i.port=parseInt(String(i.port),10)),i.help||i.h)switch(e){case"start":Z9();return;case"status":b9();return;case"watch":P9();return;default:Yc();return}switch(e){case"start":await q9(i);break;case"status":D9(i);break;case"watch":y9(i);break;case void 0:case"help":Yc();break;default:console.log(),u.error(`Unknown subcommand: ${e}`),Yc(),process.exit(1)}})}function vA(t){_3(t),$3(t),ev(t),iv(t),nv(t),rv(t),ov(t),Nv(t),kv(t),Jv(t),bv(t),Pv(t),qv(t),yv(t),eA(t),lA(t)}var ai=Nc("gk");ai.version("0.1.0");ai.help();ai.option("--verbose","Enable verbose output");ai.option("--json","Output as JSON");var AA=ai.parse(process.argv,{run:!1});AA.options.verbose&&po({level:"debug",verbose:!0});AA.options.json&&po({json:!0});vA(ai);ai.parse();
3578
+ </html>`}var Lo=class{server=null;wss=null;options;clients=new Set;constructor(e){this.options=e}async start(){return new Promise((e,i)=>{let n=this.options.port,r=0,o=10,s=()=>{this.server=d9((c,l)=>this.handleRequest(c,l)),this.server.on("error",c=>{c.code==="EADDRINUSE"&&r<o?(r++,n++,s()):i(c)}),this.server.listen(n,this.options.host||"localhost",()=>{this.wss=new R9({server:this.server}),this.setupWebSocket(),this.options.emitter.onStateChange(c=>{this.broadcastState(c)}),this.options.emitter.onEvent(c=>{this.broadcastEvent(c)}),e(n)})};s()})}stop(){if(this.wss){for(let e of this.clients)e.close();this.wss.close(),this.wss=null}this.server&&(this.server.close(),this.server=null),this.clients.clear()}handleRequest(e,i){let n=e.url||"/";if(n==="/api/state"){i.writeHead(200,{"Content-Type":"application/json"}),i.end(JSON.stringify(this.serializeState(this.options.emitter.getState())));return}if(n==="/api/history"){i.writeHead(200,{"Content-Type":"application/json"}),i.end(JSON.stringify(this.options.emitter.getHistory()));return}if(n.startsWith("/api/open-doc")){let s=new URL(n,`http://${e.headers.host}`).searchParams.get("path");if(!s){i.writeHead(400,{"Content-Type":"application/json"}),i.end(JSON.stringify({success:!1,error:"No path provided"}));return}let c=s;if(SA(c)||(c=j9(process.cwd(),s)),!SA(c)){i.writeHead(404,{"Content-Type":"application/json"}),i.end(JSON.stringify({success:!1,error:`File not found: ${s}`}));return}let l=process.env.EDITOR||process.env.VISUAL,A=this.options.emitter.getState().appName?.toLowerCase()||"",I=["code","cursor","windsurf","zed","vim","nvim","nano","subl","atom","idea","webstorm","notepad++","antigravity"].some(f=>A.includes(f)),E;l?(E=`"${l}" "${c}"`,console.log(`[Agent Office] Using IDE from EDITOR env: ${l}`)):A&&I?(E=`${A} "${c}"`,console.log(`[Agent Office] Using IDE from session: ${A}`)):(E=`code "${c}"`,console.log("[Agent Office] No IDE detected, defaulting to VS Code")),z9(E,f=>{f?(i.writeHead(500,{"Content-Type":"application/json"}),i.end(JSON.stringify({success:!1,error:f.message}))):(i.writeHead(200,{"Content-Type":"application/json"}),i.end(JSON.stringify({success:!0})))});return}let r=n.split("?")[0].split("#")[0];if(r==="/"||r==="/index.html"){i.writeHead(200,{"Content-Type":"text/html; charset=utf-8"}),i.end(xA());return}i.writeHead(404),i.end("Not Found")}setupWebSocket(){this.wss&&this.wss.on("connection",e=>{this.clients.add(e);let i=this.options.emitter.getState();try{e.send(JSON.stringify({type:"state",data:this.serializeState(i)}))}catch{}e.on("message",n=>{try{let r=JSON.parse(n.toString());if(r.type==="ping"&&e.send(JSON.stringify({type:"pong"})),r.type==="replay"){let o=this.options.emitter.replay(r.fromTimestamp);e.send(JSON.stringify({type:"replay",data:o}))}}catch{}}),e.on("close",()=>{this.clients.delete(e)})})}broadcastState(e){let i=JSON.stringify({type:"state",data:this.serializeState(e)});for(let n of this.clients)if(n.readyState===GA.OPEN)try{n.send(i)}catch{}}broadcastEvent(e){let i=JSON.stringify({type:"event",data:e});for(let n of this.clients)if(n.readyState===GA.OPEN)try{n.send(i)}catch{}}serializeState(e){return{...e,agents:Object.fromEntries(e.agents)}}};var _o=class{server=null;emitter;watcher;options;constructor(e={}){this.options={port:3847,host:"localhost",autoOpen:!0,...e},this.emitter=new Vt(Kt()),this.watcher=new Nt({onSessionChange:i=>{let n=Di(i);if(n.activePlan)try{let r=di(),o=x9(r,n.activePlan);n.documents=Qc(o)}catch{}this.emitter.setState(n)},onEvent:i=>{this.emitter.emit(i)},onError:i=>{this.options.onError&&this.options.onError(i)}})}async start(){if(!this.watcher.start())throw new Error("No active session found");this.server=new Lo({port:this.options.port,host:this.options.host,emitter:this.emitter});let i=await this.server.start();return this.options.autoOpen&&this.openBrowser(`http://${this.options.host}:${i}`),this.options.onReady&&this.options.onReady(i),i}stop(){this.server&&(this.server.stop(),this.server=null),this.watcher.stop(),this.emitter.dispose()}openBrowser(e){let i=process.platform==="win32"?`start ${e}`:process.platform==="darwin"?`open ${e}`:`xdg-open ${e}`;g9(i,n=>{n&&console.log(`Open ${e} in your browser`)})}};async function Jc(t={}){let e=new _o(t);return await e.start(),e}function bc(){console.log(),console.log(p.default.bold(a.geminiPurple("Agent Office"))),console.log(),console.log("Usage:"),console.log(` ${a.primary("gk office")} <subcommand> [options]`),console.log(),console.log("Subcommands:"),console.log(` ${a.primary("start")} Start the visualization`),console.log(` ${a.primary("status")} Show current office state`),console.log(` ${a.primary("watch")} Watch office state changes`),console.log(),console.log("Options:"),console.log(` ${a.dim("-p, --port <n>")} [start] Web server port (default: 3847)`),console.log(` ${a.dim("--no-open")} [start] Don't auto-open browser`),console.log(` ${a.dim("--json")} [status/watch] Output as JSON`),console.log(),console.log("Examples:"),console.log(` ${a.dim("gk office start")}`),console.log(` ${a.dim("gk office start --port 4000")}`),console.log(` ${a.dim("gk office status --json")}`),console.log(` ${a.dim("gk office watch")}`),console.log()}function G9(){console.log(),console.log(p.default.bold(a.geminiPurple("gk office start"))),console.log(a.dim("Start the Agent Office web dashboard")),console.log(),console.log("Usage:"),console.log(` ${a.primary("gk office start")} [options]`),console.log(),console.log("Options:"),console.log(` ${a.dim("-p, --port <n>")} Web server port (default: 3847)`),console.log(` ${a.dim("--no-open")} Don't auto-open browser`),console.log(),console.log("Examples:"),console.log(` ${a.dim("gk office start")}`),console.log(` ${a.dim("gk office start --port 4000")}`),console.log(` ${a.dim("gk office start --port 4000 --no-open")}`),console.log()}function S9(){console.log(),console.log(p.default.bold(a.geminiPurple("gk office status"))),console.log(a.dim("Show current Agent Office state")),console.log(),console.log("Usage:"),console.log(` ${a.primary("gk office status")} [options]`),console.log(),console.log("Options:"),console.log(` ${a.dim("--json")} Output as JSON`),console.log()}function Y9(){console.log(),console.log(p.default.bold(a.geminiPurple("gk office watch"))),console.log(a.dim("Watch Agent Office state changes in real-time")),console.log(),console.log("Usage:"),console.log(` ${a.primary("gk office watch")} [options]`),console.log(),console.log("Options:"),console.log(` ${a.dim("--json")} Output as JSON`),console.log()}async function W9(t){console.log(),m.info("Starting Agent Office..."),console.log();try{let e=await Jc({port:t.port||3847,autoOpen:t.open!==!1,onReady:i=>{m.success(`Dashboard running at ${a.primary(`http://localhost:${i}`)}`),console.log(a.dim(" Press Ctrl+C to stop")),console.log()},onError:i=>{m.error(`Error: ${i.message}`)}});process.on("SIGINT",()=>{e.stop(),console.log(),m.info("Agent Office stopped."),console.log(),process.exit(0)})}catch(e){e instanceof Error&&(e.message==="No active session found"?(console.log(),m.warn("No active session found."),console.log(a.dim(" Start a GemKit session first with: gk agent")),console.log()):m.error(`Failed to start: ${e.message}`)),process.exit(1)}}function M9(t){let e=new Vt(Kt()),i=new Nt({onSessionChange:r=>{let o=Di(r);if(t.json)console.log(JSON.stringify({...o,agents:Object.fromEntries(o.agents)},null,2));else{if(console.log(),console.log(p.default.bold(a.geminiPurple("Agent Office Status"))),console.log(M.line()),console.log(),console.log(` ${a.dim("Active Plan:")} ${o.activePlan?a.primary(o.activePlan):a.dim("(none)")}`),console.log(` ${a.dim("Agents:")} ${o.agents.size}`),console.log(` ${a.dim("Inbox Items:")} ${o.inbox.length}`),console.log(` ${a.dim("Documents:")} ${o.documents.length}`),o.agents.size>0){console.log(),console.log(a.dim(" Agents:"));for(let[s,c]of o.agents){let l=c.state==="working"?a.warn:c.state==="idle"?a.success:a.dim;console.log(` ${c.icon} ${a.primary(c.role)} ${l(`[${c.state}]`)}`)}}console.log()}i.stop(),e.dispose()},onEvent:()=>{},onError:r=>{console.log(),m.error(`Error: ${r.message}`),console.log(),process.exit(1)}});i.start()||(console.log(),m.warn("No active session found."),console.log(a.dim(" Start a GemKit session first with: gk agent")),console.log(),process.exit(1))}function C9(t){console.log(),m.info("Watching Agent Office state..."),console.log(a.dim(" Press Ctrl+C to stop")),console.log();let e=new Vt(Kt()),i=new Nt({onSessionChange:r=>{let o=Di(r);if(t.json)console.log(JSON.stringify({timestamp:new Date().toISOString(),...o,agents:Object.fromEntries(o.agents)}));else{let s=new Date().toLocaleTimeString();console.log(`${a.dim(s)} ${a.info("State:")} ${o.agents.size} agents, ${o.inbox.length} inbox items`)}},onEvent:r=>{if(t.json)console.log(JSON.stringify({type:"event",event:r}));else{let o=new Date().toLocaleTimeString();console.log(`${a.dim(o)} ${a.secondary("Event:")} ${r.type}`)}},onError:r=>{m.error(`Error: ${r.message}`)}});i.start()||(console.log(),m.warn("No active session found."),console.log(a.dim(" Start a GemKit session first with: gk agent")),console.log(),process.exit(1)),process.on("SIGINT",()=>{i.stop(),e.dispose(),console.log(),m.info("Stopped watching."),console.log(),process.exit(0)})}function YA(t){t.command("office [subcommand]","Agent Office visualization (start, status, watch)").option("-p, --port <port>","[start] Web server port",{default:3847}).option("--no-open","[start] Don't auto-open browser").option("--json","[status/watch] Output as JSON").action(async(e,i)=>{if(i.port&&(i.port=parseInt(String(i.port),10)),i.help||i.h)switch(e){case"start":G9();return;case"status":S9();return;case"watch":Y9();return;default:bc();return}switch(e){case"start":await W9(i);break;case"status":M9(i);break;case"watch":C9(i);break;case void 0:case"help":bc();break;default:console.log(),m.error(`Unknown subcommand: ${e}`),bc(),process.exit(1)}})}function WA(t){Ev(t),Av(t),Iv(t),fv(t),hv(t),dv(t),Rv(t),Hv(t),Lv(t),eA(t),nA(t),rA(t),oA(t),cA(t),hA(t),YA(t)}import{existsSync as MA,readFileSync as O9,writeFileSync as U9,mkdirSync as K9}from"fs";import{join as V9,dirname as N9}from"path";import{homedir as k9}from"os";var $o=V9(k9(),".gemkit","last-update-check.json");function CA(){try{return MA($o)?JSON.parse(O9($o,"utf-8")):null}catch{return null}}function F9(t){try{let e=N9($o);MA(e)||K9(e,{recursive:!0}),U9($o,JSON.stringify(t,null,2))}catch{}}function Q9(t){let e=CA();if(!e)return!0;let i=new Date(e.lastCheck);return(new Date().getTime()-i.getTime())/(1e3*60*60)>=t}async function OA(){let e=Ve().update;if(e?.autoCheck&&Q9(e.checkInterval))try{let i=await uv(),n=CA()||{lastCheck:""},r=[];i.cli?.available&&n.notifiedCli!==i.cli.latest&&(r.push(`${a.primary("CLI")} update available: v${i.cli.current} \u2192 v${i.cli.latest}`),n.notifiedCli=i.cli.latest),i.kits?.available&&n.notifiedKits!==i.kits.latest&&(r.push(`${a.primary("Kits")} update available: v${i.kits.current} \u2192 v${i.kits.latest}`),n.notifiedKits=i.kits.latest),r.length>0&&(console.log(),console.log(a.dim("\u2500".repeat(50))),console.log(`${a.warn("\u2B06")} Updates available:`),r.forEach(o=>console.log(` ${o}`)),console.log(` Run ${a.primary("gk update")} to update.`),console.log(a.dim("\u2500".repeat(50))),console.log()),n.lastCheck=new Date().toISOString(),F9(n)}catch{}}var kt=Xc("gk");kt.version(de);kt.help();kt.option("--verbose","Enable verbose output");kt.option("--json","Output as JSON");kt.option("--no-update-check","Skip auto-update check");var Bc=kt.parse(process.argv,{run:!1});Bc.options.verbose&&So({level:"debug",verbose:!0});Bc.options.json&&So({json:!0});WA(kt);Bc.options.updateCheck!==!1&&OA().catch(()=>{});kt.parse();