UNPKG

clean-pkg-json

Version:

Clean package.json before publish by removing unnecessary properties

23 lines (22 loc) 38.4 kB
#!/usr/bin/env node "use strict";var x=require("fs"),cD=require("tty");function BD(D){return D&&typeof D=="object"&&"default"in D?D:{default:D}}var dD=BD(cD);const J=/-(\w)/g,q=D=>D.replace(J,(u,e)=>e.toUpperCase()),U=/\B([A-Z])/g,gD=D=>D.replace(U,"-$1").toLowerCase(),{stringify:b}=JSON,{hasOwnProperty:fD}=Object.prototype,v=(D,u)=>fD.call(D,u),hD=/^--?/,AD=/[.:=]/,mD=D=>{let u=D.replace(hD,""),e;const n=u.match(AD);if(n!=null&&n.index){const t=n.index;e=u.slice(t+1),u=u.slice(0,t)}return{flagName:u,flagValue:e}},bD=/[\s.:=]/,yD=(D,u)=>{const e=`Invalid flag name ${b(u)}:`;if(u.length===0)throw new Error(`${e} flag name cannot be empty}`);if(u.length===1)throw new Error(`${e} single characters are reserved for aliases`);const n=u.match(bD);if(n)throw new Error(`${e} flag name cannot contain the character ${b(n==null?void 0:n[0])}`);let t;if(J.test(u)?t=q(u):U.test(u)&&(t=gD(u)),t&&v(D,t))throw new Error(`${e} collides with flag ${b(t)}`)};function wD(D){const u=new Map;for(const e in D){if(!v(D,e))continue;yD(D,e);const n=D[e];if(n&&typeof n=="object"){const{alias:t}=n;if(typeof t=="string"){if(t.length===0)throw new Error(`Invalid flag alias ${b(e)}: flag alias cannot be empty`);if(t.length>1)throw new Error(`Invalid flag alias ${b(e)}: flag aliases can only be a single-character`);if(u.has(t))throw new Error(`Flag collision: Alias "${t}" is already used`);u.set(t,{name:e,schema:n})}}}return u}const vD=D=>!D||typeof D=="function"?!1:Array.isArray(D)||Array.isArray(D.type),$D=D=>{const u={};for(const e in D)v(D,e)&&(u[e]=vD(D[e])?[]:void 0);return u},k=(D,u)=>D===Number&&u===""?Number.NaN:D===Boolean?u!=="false":u,OD=(D,u)=>{for(const e in D){if(!v(D,e))continue;const n=D[e];if(!n)continue;const t=u[e];if(!(t!==void 0&&!(Array.isArray(t)&&t.length===0))&&"default"in n){let F=n.default;typeof F=="function"&&(F=F()),u[e]=F}}},Z=(D,u)=>{if(!u)throw new Error(`Missing type on flag "${D}"`);return typeof u=="function"?u:Array.isArray(u)?u[0]:Z(D,u.type)},jD=/^-[\da-z]+/i,xD=/^--[\w-]{2,}/,P="--";function kD(D,u=process.argv.slice(2),e={}){const n=wD(D),t={flags:$D(D),unknownFlags:{},_:Object.assign([],{[P]:[]})};let F;const o=(r,C,a)=>{const s=Z(r,C);a=k(s,a),a!==void 0&&!Number.isNaN(a)?Array.isArray(t.flags[r])?t.flags[r].push(s(a)):t.flags[r]=s(a):F=l=>{Array.isArray(t.flags[r])?t.flags[r].push(s(k(s,l||""))):t.flags[r]=s(k(s,l||"")),F=void 0}},i=(r,C)=>{r in t.unknownFlags||(t.unknownFlags[r]=[]),C!==void 0?t.unknownFlags[r].push(C):F=(a=!0)=>{t.unknownFlags[r].push(a),F=void 0}};for(let r=0;r<u.length;r+=1){const C=u[r];if(C===P){const s=u.slice(r+1);t._[P]=s,t._.push(...s);break}const a=jD.test(C);if(xD.test(C)||a){F&&F();const s=mD(C),{flagValue:l}=s;let{flagName:E}=s;if(a){for(let B=0;B<E.length;B+=1){const h=E[B],A=n.get(h),g=B===E.length-1;A?o(A.name,A.schema,g?l:!0):e!=null&&e.ignoreUnknown?t._.push(C):i(h,g?l:!0)}continue}let p=D[E];if(!p){const B=q(E);p=D[B],p&&(E=B)}if(!p){e!=null&&e.ignoreUnknown?t._.push(C):i(E,l);continue}o(E,p,l)}else F?F(C):t._.push(C)}return F&&F(),OD(D,t.flags),t}var PD=Object.create,$=Object.defineProperty,MD=Object.defineProperties,ND=Object.getOwnPropertyDescriptor,SD=Object.getOwnPropertyDescriptors,ID=Object.getOwnPropertyNames,G=Object.getOwnPropertySymbols,TD=Object.getPrototypeOf,V=Object.prototype.hasOwnProperty,LD=Object.prototype.propertyIsEnumerable,K=(D,u,e)=>u in D?$(D,u,{enumerable:!0,configurable:!0,writable:!0,value:e}):D[u]=e,O=(D,u)=>{for(var e in u||(u={}))V.call(u,e)&&K(D,e,u[e]);if(G)for(var e of G(u))LD.call(u,e)&&K(D,e,u[e]);return D},M=(D,u)=>MD(D,SD(u)),RD=D=>$(D,"__esModule",{value:!0}),_D=(D,u)=>()=>(D&&(u=D(D=0)),u),WD=(D,u)=>()=>(u||D((u={exports:{}}).exports,u),u.exports),zD=(D,u,e,n)=>{if(u&&typeof u=="object"||typeof u=="function")for(let t of ID(u))!V.call(D,t)&&(e||t!=="default")&&$(D,t,{get:()=>u[t],enumerable:!(n=ND(u,t))||n.enumerable});return D},JD=(D,u)=>zD(RD($(D!=null?PD(TD(D)):{},"default",!u&&D&&D.__esModule?{get:()=>D.default,enumerable:!0}:{value:D,enumerable:!0})),D),c=_D(()=>{}),qD=WD((D,u)=>{c(),u.exports=function(){return/\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67)\uDB40\uDC7F|(?:\uD83E\uDDD1\uD83C\uDFFF\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFC-\uDFFF])|\uD83D\uDC68(?:\uD83C\uDFFB(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|[\u2695\u2696\u2708]\uFE0F|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))?|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])\uFE0F|\u200D(?:(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D[\uDC66\uDC67])|\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC)?|(?:\uD83D\uDC69(?:\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69]))|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC69(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB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\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDE36\u200D\uD83C\uDF2B|\uD83C\uDFF3\uFE0F\u200D\u26A7|\uD83D\uDC3B\u200D\u2744|(?:(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\uD83C\uDFF4\u200D\u2620|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])\u200D[\u2640\u2642]|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u2600-\u2604\u260E\u2611\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26B0\u26B1\u26C8\u26CF\u26D1\u26D3\u26E9\u26F0\u26F1\u26F4\u26F7\u26F8\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u3030\u303D\u3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D83D[\uDD74\uDD90])(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])|[\u270A\u270B]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC08\uDC15\uDC3B\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE2E\uDE35\uDE36\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5]|\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD]|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF]|[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\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-\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0D\uDD0E\uDD10-\uDD17\uDD1D\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78\uDD7A-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCB\uDDD0\uDDE0-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6]|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDED5-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26A7\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5-\uDED7\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])\uFE0F|(?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDC8F\uDC91\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1F\uDD26\uDD30-\uDD39\uDD3C-\uDD3E\uDD77\uDDB5\uDDB6\uDDB8\uDDB9\uDDBB\uDDCD-\uDDCF\uDDD1-\uDDDD])/g}});c(),c(),c();var UD=D=>{var u,e,n;let t=(u=process.stdout.columns)!=null?u:Number.POSITIVE_INFINITY;return typeof D=="function"&&(D=D(t)),D||(D={}),Array.isArray(D)?{columns:D,stdoutColumns:t}:{columns:(e=D.columns)!=null?e:[],stdoutColumns:(n=D.stdoutColumns)!=null?n:t}};c(),c(),c(),c(),c();function ZD({onlyFirst:D=!1}={}){let u=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))"].join("|");return new RegExp(u,D?void 0:"g")}function Y(D){if(typeof D!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof D}\``);return D.replace(ZD(),"")}c();function GD(D){return Number.isInteger(D)?D>=4352&&(D<=4447||D===9001||D===9002||11904<=D&&D<=12871&&D!==12351||12880<=D&&D<=19903||19968<=D&&D<=42182||43360<=D&&D<=43388||44032<=D&&D<=55203||63744<=D&&D<=64255||65040<=D&&D<=65049||65072<=D&&D<=65131||65281<=D&&D<=65376||65504<=D&&D<=65510||110592<=D&&D<=110593||127488<=D&&D<=127569||131072<=D&&D<=262141):!1}var VD=JD(qD(),1);function f(D){if(typeof D!="string"||D.length===0||(D=Y(D),D.length===0))return 0;D=D.replace((0,VD.default)()," ");let u=0;for(let e=0;e<D.length;e++){let n=D.codePointAt(e);n<=31||n>=127&&n<=159||n>=768&&n<=879||(n>65535&&e++,u+=GD(n)?2:1)}return u}var H=D=>Math.max(...D.split(` `).map(f)),KD=D=>{let u=[];for(let e of D){let{length:n}=e,t=n-u.length;for(let F=0;F<t;F+=1)u.push(0);for(let F=0;F<n;F+=1){let o=H(e[F]);o>u[F]&&(u[F]=o)}}return u};c();var Q=/^\d+%$/,X={width:"auto",align:"left",contentWidth:0,paddingLeft:0,paddingRight:0,paddingTop:0,paddingBottom:0,horizontalPadding:0,paddingLeftString:"",paddingRightString:""},YD=(D,u)=>{var e;let n=[];for(let t=0;t<D.length;t+=1){let F=(e=u[t])!=null?e:"auto";if(typeof F=="number"||F==="auto"||F==="content-width"||typeof F=="string"&&Q.test(F)){n.push(M(O({},X),{width:F,contentWidth:D[t]}));continue}if(F&&typeof F=="object"){let o=M(O(O({},X),F),{contentWidth:D[t]});o.horizontalPadding=o.paddingLeft+o.paddingRight,n.push(o);continue}throw new Error(`Invalid column width: ${JSON.stringify(F)}`)}return n};function HD(D,u){for(let e of D){let{width:n}=e;if(n==="content-width"&&(e.width=e.contentWidth),n==="auto"){let r=Math.min(20,e.contentWidth);e.width=r,e.autoOverflow=e.contentWidth-r}if(typeof n=="string"&&Q.test(n)){let r=Number.parseFloat(n.slice(0,-1))/100;e.width=Math.floor(u*r)-(e.paddingLeft+e.paddingRight)}let{horizontalPadding:t}=e,F=1,o=F+t;if(o>=u){let r=o-u,C=Math.ceil(e.paddingLeft/t*r),a=r-C;e.paddingLeft-=C,e.paddingRight-=a,e.horizontalPadding=e.paddingLeft+e.paddingRight}e.paddingLeftString=e.paddingLeft?" ".repeat(e.paddingLeft):"",e.paddingRightString=e.paddingRight?" ".repeat(e.paddingRight):"";let i=u-e.horizontalPadding;e.width=Math.max(Math.min(e.width,i),F)}}var DD=()=>Object.assign([],{columns:0});function QD(D,u){let e=[DD()],[n]=e;for(let t of D){let F=t.width+t.horizontalPadding;n.columns+F>u&&(n=DD(),e.push(n)),n.push(t),n.columns+=F}for(let t of e){let F=t.reduce((l,E)=>l+E.width+E.horizontalPadding,0),o=u-F;if(o===0)continue;let i=t.filter(l=>"autoOverflow"in l),r=i.filter(l=>l.autoOverflow>0),C=r.reduce((l,E)=>l+E.autoOverflow,0),a=Math.min(C,o);for(let l of r){let E=Math.floor(l.autoOverflow/C*a);l.width+=E,o-=E}let s=Math.floor(o/i.length);for(let l=0;l<i.length;l+=1){let E=i[l];l===i.length-1?E.width+=o:E.width+=s,o-=s}}return e}function XD(D,u,e){let n=YD(e,u);return HD(n,D),QD(n,D)}c(),c(),c();var N=10,uD=(D=0)=>u=>`\x1B[${u+D}m`,eD=(D=0)=>u=>`\x1B[${38+D};5;${u}m`,tD=(D=0)=>(u,e,n)=>`\x1B[${38+D};2;${u};${e};${n}m`;function Du(){let D=new Map,u={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],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],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}};u.color.gray=u.color.blackBright,u.bgColor.bgGray=u.bgColor.bgBlackBright,u.color.grey=u.color.blackBright,u.bgColor.bgGrey=u.bgColor.bgBlackBright;for(let[e,n]of Object.entries(u)){for(let[t,F]of Object.entries(n))u[t]={open:`\x1B[${F[0]}m`,close:`\x1B[${F[1]}m`},n[t]=u[t],D.set(F[0],F[1]);Object.defineProperty(u,e,{value:n,enumerable:!1})}return Object.defineProperty(u,"codes",{value:D,enumerable:!1}),u.color.close="\x1B[39m",u.bgColor.close="\x1B[49m",u.color.ansi=uD(),u.color.ansi256=eD(),u.color.ansi16m=tD(),u.bgColor.ansi=uD(N),u.bgColor.ansi256=eD(N),u.bgColor.ansi16m=tD(N),Object.defineProperties(u,{rgbToAnsi256:{value:(e,n,t)=>e===n&&n===t?e<8?16:e>248?231:Math.round((e-8)/247*24)+232:16+36*Math.round(e/255*5)+6*Math.round(n/255*5)+Math.round(t/255*5),enumerable:!1},hexToRgb:{value:e=>{let n=/(?<colorString>[a-f\d]{6}|[a-f\d]{3})/i.exec(e.toString(16));if(!n)return[0,0,0];let{colorString:t}=n.groups;t.length===3&&(t=t.split("").map(o=>o+o).join(""));let F=Number.parseInt(t,16);return[F>>16&255,F>>8&255,F&255]},enumerable:!1},hexToAnsi256:{value:e=>u.rgbToAnsi256(...u.hexToRgb(e)),enumerable:!1},ansi256ToAnsi:{value:e=>{if(e<8)return 30+e;if(e<16)return 90+(e-8);let n,t,F;if(e>=232)n=((e-232)*10+8)/255,t=n,F=n;else{e-=16;let r=e%36;n=Math.floor(e/36)/5,t=Math.floor(r/6)/5,F=r%6/5}let o=Math.max(n,t,F)*2;if(o===0)return 30;let i=30+(Math.round(F)<<2|Math.round(t)<<1|Math.round(n));return o===2&&(i+=60),i},enumerable:!1},rgbToAnsi:{value:(e,n,t)=>u.ansi256ToAnsi(u.rgbToAnsi256(e,n,t)),enumerable:!1},hexToAnsi:{value:e=>u.ansi256ToAnsi(u.hexToAnsi256(e)),enumerable:!1}}),u}var uu=Du(),eu=uu,j=new Set(["\x1B","\x9B"]),tu=39,S="\x07",nD="[",nu="]",FD="m",I=`${nu}8;;`,rD=D=>`${j.values().next().value}${nD}${D}${FD}`,oD=D=>`${j.values().next().value}${I}${D}${S}`,Fu=D=>D.split(" ").map(u=>f(u)),T=(D,u,e)=>{let n=[...u],t=!1,F=!1,o=f(Y(D[D.length-1]));for(let[i,r]of n.entries()){let C=f(r);if(o+C<=e?D[D.length-1]+=r:(D.push(r),o=0),j.has(r)&&(t=!0,F=n.slice(i+1).join("").startsWith(I)),t){F?r===S&&(t=!1,F=!1):r===FD&&(t=!1);continue}o+=C,o===e&&i<n.length-1&&(D.push(""),o=0)}!o&&D[D.length-1].length>0&&D.length>1&&(D[D.length-2]+=D.pop())},ru=D=>{let u=D.split(" "),e=u.length;for(;e>0&&!(f(u[e-1])>0);)e--;return e===u.length?D:u.slice(0,e).join(" ")+u.slice(e).join("")},ou=(D,u,e={})=>{if(e.trim!==!1&&D.trim()==="")return"";let n="",t,F,o=Fu(D),i=[""];for(let[C,a]of D.split(" ").entries()){e.trim!==!1&&(i[i.length-1]=i[i.length-1].trimStart());let s=f(i[i.length-1]);if(C!==0&&(s>=u&&(e.wordWrap===!1||e.trim===!1)&&(i.push(""),s=0),(s>0||e.trim===!1)&&(i[i.length-1]+=" ",s++)),e.hard&&o[C]>u){let l=u-s,E=1+Math.floor((o[C]-l-1)/u);Math.floor((o[C]-1)/u)<E&&i.push(""),T(i,a,u);continue}if(s+o[C]>u&&s>0&&o[C]>0){if(e.wordWrap===!1&&s<u){T(i,a,u);continue}i.push("")}if(s+o[C]>u&&e.wordWrap===!1){T(i,a,u);continue}i[i.length-1]+=a}e.trim!==!1&&(i=i.map(C=>ru(C)));let r=[...i.join(` `)];for(let[C,a]of r.entries()){if(n+=a,j.has(a)){let{groups:l}=new RegExp(`(?:\\${nD}(?<code>\\d+)m|\\${I}(?<uri>.*)${S})`).exec(r.slice(C).join(""))||{groups:{}};if(l.code!==void 0){let E=Number.parseFloat(l.code);t=E===tu?void 0:E}else l.uri!==void 0&&(F=l.uri.length===0?void 0:l.uri)}let s=eu.codes.get(Number(t));r[C+1]===` `?(F&&(n+=oD("")),t&&s&&(n+=rD(s))):a===` `&&(t&&s&&(n+=rD(t)),F&&(n+=oD(F)))}return n};function iu(D,u,e){return String(D).normalize().replace(/\r\n/g,` `).split(` `).map(n=>ou(n,u,e)).join(` `)}var iD=D=>Array.from({length:D}).fill("");function Cu(D,u){let e=[],n=0;for(let t of D){let F=0,o=t.map(r=>{var C;let a=(C=u[n])!=null?C:"";n+=1,r.preprocess&&(a=r.preprocess(a)),H(a)>r.width&&(a=iu(a,r.width,{hard:!0}));let s=a.split(` `);if(r.postprocess){let{postprocess:l}=r;s=s.map((E,p)=>l.call(r,E,p))}return r.paddingTop&&s.unshift(...iD(r.paddingTop)),r.paddingBottom&&s.push(...iD(r.paddingBottom)),s.length>F&&(F=s.length),M(O({},r),{lines:s})}),i=[];for(let r=0;r<F;r+=1){let C=o.map(a=>{var s;let l=(s=a.lines[r])!=null?s:"",E=Number.isFinite(a.width)?" ".repeat(a.width-f(l)):"",p=a.paddingLeftString;return a.align==="right"&&(p+=E),p+=l,a.align==="left"&&(p+=E),p+a.paddingRightString}).join("");i.push(C)}e.push(i.join(` `))}return e.join(` `)}function au(D,u){if(!D||D.length===0)return"";let e=KD(D),n=e.length;if(n===0)return"";let{stdoutColumns:t,columns:F}=UD(u);if(F.length>n)throw new Error(`${F.length} columns defined, but only ${n} columns found`);let o=XD(t,F,e);return D.map(i=>Cu(o,i)).join(` `)}c();var su=["<",">","=",">=","<="];function lu(D){if(!su.includes(D))throw new TypeError(`Invalid breakpoint operator: ${D}`)}function Eu(D){let u=Object.keys(D).map(e=>{let[n,t]=e.split(" ");lu(n);let F=Number.parseInt(t,10);if(Number.isNaN(F))throw new TypeError(`Invalid breakpoint value: ${t}`);let o=D[e];return{operator:n,breakpoint:F,value:o}}).sort((e,n)=>n.breakpoint-e.breakpoint);return e=>{var n;return(n=u.find(({operator:t,breakpoint:F})=>t==="="&&e===F||t===">"&&e>F||t==="<"&&e<F||t===">="&&e>=F||t==="<="&&e<=F))==null?void 0:n.value}}const pu=D=>D.replace(/[-_ ](\w)/g,(u,e)=>e.toUpperCase()),cu=D=>D.replace(/\B([A-Z])/g,"-$1").toLowerCase(),Bu={"> 80":[{width:"content-width",paddingLeft:2,paddingRight:8},{width:"auto"}],"> 40":[{width:"auto",paddingLeft:2,paddingRight:8,preprocess:D=>D.trim()},{width:"100%",paddingLeft:2,paddingBottom:1}],"> 0":{stdoutColumns:1e3,columns:[{width:"content-width",paddingLeft:2,paddingRight:8},{width:"content-width"}]}};function du(D){let u=!1;const e=Object.keys(D).sort((n,t)=>n.localeCompare(t)).map(n=>{const t=D[n],F="alias"in t;return F&&(u=!0),{name:n,flag:t,flagFormatted:`--${cu(n)}`,aliasesEnabled:u,aliasFormatted:F?`-${t.alias}`:void 0}}).map(n=>(n.aliasesEnabled=u,[{type:"flagName",data:n},{type:"flagDescription",data:n}]));return{type:"table",data:{tableData:e,tableBreakpoints:Bu}}}const CD=D=>{var u;return!D||((u=D.version)!=null?u:D.help?D.help.version:void 0)},aD=D=>{var u;const e="parent"in D&&((u=D.parent)==null?void 0:u.name);return(e?`${e} `:"")+D.name};function gu(D){var u;const e=[];D.name&&e.push(aD(D));const n=(u=CD(D))!=null?u:"parent"in D&&CD(D.parent);if(n&&e.push(`v${n}`),e.length!==0)return{id:"name",type:"text",data:`${e.join(" ")} `}}function fu(D){const{help:u}=D;if(!(!u||!u.description))return{id:"description",type:"text",data:`${u.description} `}}function hu(D){var u;const e=D.help||{};if("usage"in e)return e.usage?{id:"usage",type:"section",data:{title:"Usage:",body:Array.isArray(e.usage)?e.usage.join(` `):e.usage}}:void 0;if(D.name){const n=[],t=[aD(D)];if(D.flags&&Object.keys(D.flags).length>0&&t.push("[flags...]"),D.parameters&&D.parameters.length>0){const{parameters:F}=D,o=F.indexOf("--"),i=o>-1&&F.slice(o+1).some(r=>r.startsWith("<"));t.push(F.map(r=>r!=="--"?r:i?"--":"[--]").join(" "))}if(t.length>1&&n.push(t.join(" ")),"commands"in D&&((u=D.commands)==null?void 0:u.length)&&n.push(`${D.name} <command>`),n.length>0)return{id:"usage",type:"section",data:{title:"Usage:",body:n.join(` `)}}}}function Au(D){var u;if(!("commands"in D)||!((u=D.commands)!=null&&u.length))return;const e=D.commands.map(n=>[n.options.name,n.options.help?n.options.help.description:""]);return{id:"commands",type:"section",data:{title:"Commands:",body:{type:"table",data:{tableData:e,tableOptions:[{width:"content-width",paddingLeft:2,paddingRight:8}]}},indentBody:0}}}function mu(D){if(!(!D.flags||Object.keys(D.flags).length===0))return{id:"flags",type:"section",data:{title:"Flags:",body:du(D.flags),indentBody:0}}}function bu(D){const{help:u}=D;if(!u||!u.examples||u.examples.length===0)return;let{examples:e}=u;if(Array.isArray(e)&&(e=e.join(` `)),e)return{id:"examples",type:"section",data:{title:"Examples:",body:e}}}function yu(D){if(!("alias"in D)||!D.alias)return;const{alias:u}=D,e=Array.isArray(u)?u.join(", "):u;return{id:"aliases",type:"section",data:{title:"Aliases:",body:e}}}const wu=D=>[gu,fu,hu,Au,mu,bu,yu].map(u=>u(D)).filter(u=>Boolean(u)),vu=dD.default.WriteStream.prototype.hasColors();class $u{text(u){return u}bold(u){return vu?`\x1B[1m${u}\x1B[22m`:u.toLocaleUpperCase()}indentText({text:u,spaces:e}){return u.replace(/^/gm," ".repeat(e))}heading(u){return this.bold(u)}section({title:u,body:e,indentBody:n=2}){return`${(u?`${this.heading(u)} `:"")+(e?this.indentText({text:this.render(e),spaces:n}):"")} `}table({tableData:u,tableOptions:e,tableBreakpoints:n}){return au(u.map(t=>t.map(F=>this.render(F))),n?Eu(n):e)}flagParameter(u){return u===Boolean?"":u===String?"<string>":u===Number?"<number>":Array.isArray(u)?this.flagParameter(u[0]):"<value>"}flagOperator(u){return" "}flagName(u){const{flag:e,flagFormatted:n,aliasesEnabled:t,aliasFormatted:F}=u;let o="";if(F?o+=`${F}, `:t&&(o+=" "),o+=n,"placeholder"in e&&typeof e.placeholder=="string")o+=`${this.flagOperator(u)}${e.placeholder}`;else{const i=this.flagParameter("type"in e?e.type:e);i&&(o+=`${this.flagOperator(u)}${i}`)}return o}flagDefault(u){return JSON.stringify(u)}flagDescription({flag:u}){var e;let n="description"in u&&(e=u.description)!=null?e:"";if("default"in u){let{default:t}=u;typeof t=="function"&&(t=t()),t&&(n+=` (default: ${this.flagDefault(t)})`)}return n}render(u){if(typeof u=="string")return u;if(Array.isArray(u))return u.map(e=>this.render(e)).join(` `);if("type"in u&&this[u.type]){const e=this[u.type];if(typeof e=="function")return e.call(this,u.data)}throw new Error(`Invalid node type: ${JSON.stringify(u)}`)}}const sD=/^[\w.-]+$/;var Ou=Object.defineProperty,ju=Object.defineProperties,xu=Object.getOwnPropertyDescriptors,lD=Object.getOwnPropertySymbols,ku=Object.prototype.hasOwnProperty,Pu=Object.prototype.propertyIsEnumerable,ED=(D,u,e)=>u in D?Ou(D,u,{enumerable:!0,configurable:!0,writable:!0,value:e}):D[u]=e,m=(D,u)=>{for(var e in u||(u={}))ku.call(u,e)&&ED(D,e,u[e]);if(lD)for(var e of lD(u))Pu.call(u,e)&&ED(D,e,u[e]);return D},L=(D,u)=>ju(D,xu(u));const{stringify:d}=JSON,Mu=/[|\\{}()[\]^$+*?.]/;function R(D){const u=[];let e,n;for(const t of D){if(n)throw new Error(`Invalid parameter: Spread parameter ${d(n)} must be last`);const F=t[0],o=t[t.length-1];let i;if(F==="<"&&o===">"&&(i=!0,e))throw new Error(`Invalid parameter: Required parameter ${d(t)} cannot come after optional parameter ${d(e)}`);if(F==="["&&o==="]"&&(i=!1,e=t),i===void 0)throw new Error(`Invalid parameter: ${d(t)}. Must be wrapped in <> (required parameter) or [] (optional parameter)`);let r=t.slice(1,-1);const C=r.slice(-3)==="...";C&&(n=t,r=r.slice(0,-3));const a=r.match(Mu);if(a)throw new Error(`Invalid parameter: ${d(t)}. Invalid character found ${d(a[0])}`);u.push({name:r,required:i,spread:C})}return u}function _(D,u,e,n){for(let t=0;t<u.length;t+=1){const{name:F,required:o,spread:i}=u[t],r=pu(F);if(r in D)throw new Error(`Invalid parameter: ${d(F)} is used more than once.`);const C=i?e.slice(t):e[t];if(i&&(t=u.length),o&&(!C||i&&C.length===0))return console.error(`Error: Missing required parameter ${d(F)} `),n(),process.exit(1);D[r]=C}}function Nu(D){return D===void 0||D!==!1}function pD(D,u,e,n){const t=m({},u.flags),F=u.version;F&&(t.version={type:Boolean,description:"Show version"});const{help:o}=u,i=Nu(o);i&&!("help"in t)&&(t.help={type:Boolean,alias:"h",description:"Show help"});const r=kD(t,n),C=()=>{console.log(u.version)};if(F&&r.flags.version===!0)return C(),process.exit(0);const a=new $u,s=i&&(o==null?void 0:o.render)?o.render:p=>a.render(p),l=p=>{const B=wu(L(m(m({},u),p?{help:p}:{}),{flags:t}));console.log(s(B,a))};if(i&&r.flags.help===!0)return l(),process.exit(0);if(u.parameters){let{parameters:p}=u,B=r._;const h=p.indexOf("--"),A=p.slice(h+1),g=Object.create(null);if(h>-1&&A.length>0){p=p.slice(0,h);const z=r._["--"];B=B.slice(0,-z.length||void 0),_(g,R(p),B,l),_(g,R(A),z,l)}else _(g,R(p),B,l);Object.assign(r._,g)}const E=L(m({},r),{showVersion:C,showHelp:l});return typeof e=="function"&&e(E),m({command:D},E)}function Su(D,u){const e=new Map;for(const n of u){const t=[n.options.name],{alias:F}=n.options;F&&(Array.isArray(F)?t.push(...F):t.push(F));for(const o of t){if(e.has(o))throw new Error(`Duplicate command name found: ${d(o)}`);e.set(o,n)}}return e.get(D)}function Iu(D,u,e=process.argv.slice(2)){if(!D)throw new Error("Options is required");if("name"in D&&(!D.name||!sD.test(D.name)))throw new Error(`Invalid script name: ${d(D.name)}`);const n=e[0];if(D.commands&&sD.test(n)){const t=Su(n,D.commands);if(t)return pD(t.options.name,L(m({},t.options),{parent:D}),t.callback,e.slice(1))}return pD(void 0,D,u,e)}var Tu="clean-pkg-json",Lu="1.2.0",Ru="Clean package.json before publish by removing unnecessary properties";const _u=["name","version","private","publishConfig","scripts.preinstall","scripts.install","scripts.postinstall","scripts.dependencies","files","bin","browser","main","man","jsdelivr","unpkg","dependencies","peerDependencies","peerDependenciesMeta","bundledDependencies","optionalDependencies","engines","os","cpu","description","keywords","author","contributors","license","homepage","repository","bugs","funding","type","exports","imports","sponsor","publisher","displayName","categories","galleryBanner","preview","contributes","activationEvents","badges","markdown","qna","sponsor","extensionPack","extensionDependencies","extensionKind","icon","fesm2020","fesm2015","esm2020","es2020","types","typings","typesVersions","module","sideEffects"],y="./package.json",w=Iu({name:Tu,version:Lu,flags:{verbose:{type:Boolean,alias:"v",description:"Log changes"},keep:{type:[String],alias:"k",description:"package.json properties to keep"},dry:{type:Boolean,alias:"d",description:"Dry run"}},help:{description:Ru}}),W=(...D)=>{w.flags.verbose&&console.log(...D)};(async()=>{if(!await x.promises.access(y).then(()=>!0,()=>!1))throw new Error(`${y} does not exist`);const u=await x.promises.readFile(y,"utf8"),e=JSON.parse(u),n=new Set([..._u,...w.flags.keep.flatMap(F=>F.split(","))]);W("Keeing properties",Array.from(n));for(const F in e)if(!n.has(F)){if(F==="scripts"){for(const o in e.scripts)n.has(`${F}.${o}`)||delete e.scripts[o];if(Object.keys(e.scripts).length>0)continue}W(`Removing property "${F}"`),delete e[F]}const t=JSON.stringify(e,null,2);(w.flags.dry||w.flags.verbose)&&console.log(t),w.flags.dry||(await x.promises.writeFile(y,t),W(`Updated ${y}`))})();