@kitschpatrol/tldraw-cli 1.0.1 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/cli.js +12 -12
- package/dist/lib/index.d.ts +2 -0
- package/dist/lib/index.js +1 -0
- package/dist/lib/tldr-to-image.d.ts +2 -0
- package/dist/{assets/index-38ua_y9K.js → tldraw/assets/index-a71XA0Xq.js} +1 -1
- package/dist/{index.html → tldraw/index.html} +1 -1
- package/dist/types.d.ts +2 -0
- package/package.json +9 -2
- package/readme.md +28 -1
- /package/dist/{assets → tldraw/assets}/index-Go1mR3Ch.css +0 -0
- /package/dist/{embed-icons → tldraw/embed-icons}/codepen.png +0 -0
- /package/dist/{embed-icons → tldraw/embed-icons}/codesandbox.png +0 -0
- /package/dist/{embed-icons → tldraw/embed-icons}/excalidraw.png +0 -0
- /package/dist/{embed-icons → tldraw/embed-icons}/felt.png +0 -0
- /package/dist/{embed-icons → tldraw/embed-icons}/figma.png +0 -0
- /package/dist/{embed-icons → tldraw/embed-icons}/github_gist.png +0 -0
- /package/dist/{embed-icons → tldraw/embed-icons}/google_calendar.png +0 -0
- /package/dist/{embed-icons → tldraw/embed-icons}/google_maps.png +0 -0
- /package/dist/{embed-icons → tldraw/embed-icons}/google_slides.png +0 -0
- /package/dist/{embed-icons → tldraw/embed-icons}/observable.png +0 -0
- /package/dist/{embed-icons → tldraw/embed-icons}/replit.png +0 -0
- /package/dist/{embed-icons → tldraw/embed-icons}/scratch.png +0 -0
- /package/dist/{embed-icons → tldraw/embed-icons}/spotify.png +0 -0
- /package/dist/{embed-icons → tldraw/embed-icons}/tldraw.png +0 -0
- /package/dist/{embed-icons → tldraw/embed-icons}/val_town.png +0 -0
- /package/dist/{embed-icons → tldraw/embed-icons}/vimeo.png +0 -0
- /package/dist/{embed-icons → tldraw/embed-icons}/youtube.png +0 -0
- /package/dist/{fonts → tldraw/fonts}/IBMPlexMono-Medium.woff2 +0 -0
- /package/dist/{fonts → tldraw/fonts}/IBMPlexSans-Medium.woff2 +0 -0
- /package/dist/{fonts → tldraw/fonts}/IBMPlexSerif-Medium.woff2 +0 -0
- /package/dist/{fonts → tldraw/fonts}/Shantell_Sans-Tldrawish.woff2 +0 -0
- /package/dist/{icons → tldraw/icons}/icon/align-bottom-center.svg +0 -0
- /package/dist/{icons → tldraw/icons}/icon/align-bottom-left.svg +0 -0
- /package/dist/{icons → tldraw/icons}/icon/align-bottom-right.svg +0 -0
- /package/dist/{icons → tldraw/icons}/icon/align-bottom.svg +0 -0
- /package/dist/{icons → tldraw/icons}/icon/align-center-center.svg +0 -0
- /package/dist/{icons → tldraw/icons}/icon/align-center-horizontal.svg +0 -0
- /package/dist/{icons → tldraw/icons}/icon/align-center-left.svg +0 -0
- /package/dist/{icons → tldraw/icons}/icon/align-center-right.svg +0 -0
- /package/dist/{icons → tldraw/icons}/icon/align-center-vertical.svg +0 -0
- /package/dist/{icons → tldraw/icons}/icon/align-left.svg +0 -0
- /package/dist/{icons → tldraw/icons}/icon/align-right.svg +0 -0
- /package/dist/{icons → tldraw/icons}/icon/align-top-center.svg +0 -0
- /package/dist/{icons → tldraw/icons}/icon/align-top-left.svg +0 -0
- /package/dist/{icons → tldraw/icons}/icon/align-top-right.svg +0 -0
- /package/dist/{icons → tldraw/icons}/icon/align-top.svg +0 -0
- /package/dist/{icons → tldraw/icons}/icon/arrow-left.svg +0 -0
- /package/dist/{icons → tldraw/icons}/icon/arrowhead-arrow.svg +0 -0
- /package/dist/{icons → tldraw/icons}/icon/arrowhead-bar.svg +0 -0
- /package/dist/{icons → tldraw/icons}/icon/arrowhead-diamond.svg +0 -0
- /package/dist/{icons → tldraw/icons}/icon/arrowhead-dot.svg +0 -0
- /package/dist/{icons → tldraw/icons}/icon/arrowhead-none.svg +0 -0
- /package/dist/{icons → tldraw/icons}/icon/arrowhead-square.svg +0 -0
- /package/dist/{icons → tldraw/icons}/icon/arrowhead-triangle-inverted.svg +0 -0
- /package/dist/{icons → tldraw/icons}/icon/arrowhead-triangle.svg +0 -0
- /package/dist/{icons → tldraw/icons}/icon/aspect-ratio.svg +0 -0
- /package/dist/{icons → tldraw/icons}/icon/avatar.svg +0 -0
- /package/dist/{icons → tldraw/icons}/icon/blob.svg +0 -0
- /package/dist/{icons → tldraw/icons}/icon/bring-forward.svg +0 -0
- /package/dist/{icons → tldraw/icons}/icon/bring-to-front.svg +0 -0
- /package/dist/{icons → tldraw/icons}/icon/check.svg +0 -0
- /package/dist/{icons → tldraw/icons}/icon/checkbox-checked.svg +0 -0
- /package/dist/{icons → tldraw/icons}/icon/checkbox-empty.svg +0 -0
- /package/dist/{icons → tldraw/icons}/icon/chevron-down.svg +0 -0
- /package/dist/{icons → tldraw/icons}/icon/chevron-left.svg +0 -0
- /package/dist/{icons → tldraw/icons}/icon/chevron-right.svg +0 -0
- /package/dist/{icons → tldraw/icons}/icon/chevron-up.svg +0 -0
- /package/dist/{icons → tldraw/icons}/icon/chevrons-ne.svg +0 -0
- /package/dist/{icons → tldraw/icons}/icon/chevrons-sw.svg +0 -0
- /package/dist/{icons → tldraw/icons}/icon/clipboard-copied.svg +0 -0
- /package/dist/{icons → tldraw/icons}/icon/clipboard-copy.svg +0 -0
- /package/dist/{icons → tldraw/icons}/icon/code.svg +0 -0
- /package/dist/{icons → tldraw/icons}/icon/collab.svg +0 -0
- /package/dist/{icons → tldraw/icons}/icon/color.svg +0 -0
- /package/dist/{icons → tldraw/icons}/icon/comment.svg +0 -0
- /package/dist/{icons → tldraw/icons}/icon/cross-2.svg +0 -0
- /package/dist/{icons → tldraw/icons}/icon/cross.svg +0 -0
- /package/dist/{icons → tldraw/icons}/icon/dash-dashed.svg +0 -0
- /package/dist/{icons → tldraw/icons}/icon/dash-dotted.svg +0 -0
- /package/dist/{icons → tldraw/icons}/icon/dash-draw.svg +0 -0
- /package/dist/{icons → tldraw/icons}/icon/dash-solid.svg +0 -0
- /package/dist/{icons → tldraw/icons}/icon/discord.svg +0 -0
- /package/dist/{icons → tldraw/icons}/icon/distribute-horizontal.svg +0 -0
- /package/dist/{icons → tldraw/icons}/icon/distribute-vertical.svg +0 -0
- /package/dist/{icons → tldraw/icons}/icon/dot.svg +0 -0
- /package/dist/{icons → tldraw/icons}/icon/dots-horizontal.svg +0 -0
- /package/dist/{icons → tldraw/icons}/icon/dots-vertical.svg +0 -0
- /package/dist/{icons → tldraw/icons}/icon/drag-handle-dots.svg +0 -0
- /package/dist/{icons → tldraw/icons}/icon/duplicate.svg +0 -0
- /package/dist/{icons → tldraw/icons}/icon/edit.svg +0 -0
- /package/dist/{icons → tldraw/icons}/icon/external-link.svg +0 -0
- /package/dist/{icons → tldraw/icons}/icon/file.svg +0 -0
- /package/dist/{icons → tldraw/icons}/icon/fill-none.svg +0 -0
- /package/dist/{icons → tldraw/icons}/icon/fill-pattern.svg +0 -0
- /package/dist/{icons → tldraw/icons}/icon/fill-semi.svg +0 -0
- /package/dist/{icons → tldraw/icons}/icon/fill-solid.svg +0 -0
- /package/dist/{icons → tldraw/icons}/icon/follow.svg +0 -0
- /package/dist/{icons → tldraw/icons}/icon/following.svg +0 -0
- /package/dist/{icons → tldraw/icons}/icon/font-draw.svg +0 -0
- /package/dist/{icons → tldraw/icons}/icon/font-mono.svg +0 -0
- /package/dist/{icons → tldraw/icons}/icon/font-sans.svg +0 -0
- /package/dist/{icons → tldraw/icons}/icon/font-serif.svg +0 -0
- /package/dist/{icons → tldraw/icons}/icon/geo-arrow-down.svg +0 -0
- /package/dist/{icons → tldraw/icons}/icon/geo-arrow-left.svg +0 -0
- /package/dist/{icons → tldraw/icons}/icon/geo-arrow-right.svg +0 -0
- /package/dist/{icons → tldraw/icons}/icon/geo-arrow-up.svg +0 -0
- /package/dist/{icons → tldraw/icons}/icon/geo-check-box.svg +0 -0
- /package/dist/{icons → tldraw/icons}/icon/geo-cloud.svg +0 -0
- /package/dist/{icons → tldraw/icons}/icon/geo-diamond.svg +0 -0
- /package/dist/{icons → tldraw/icons}/icon/geo-ellipse.svg +0 -0
- /package/dist/{icons → tldraw/icons}/icon/geo-hexagon.svg +0 -0
- /package/dist/{icons → tldraw/icons}/icon/geo-octagon.svg +0 -0
- /package/dist/{icons → tldraw/icons}/icon/geo-oval.svg +0 -0
- /package/dist/{icons → tldraw/icons}/icon/geo-pentagon.svg +0 -0
- /package/dist/{icons → tldraw/icons}/icon/geo-rectangle.svg +0 -0
- /package/dist/{icons → tldraw/icons}/icon/geo-rhombus-2.svg +0 -0
- /package/dist/{icons → tldraw/icons}/icon/geo-rhombus.svg +0 -0
- /package/dist/{icons → tldraw/icons}/icon/geo-star.svg +0 -0
- /package/dist/{icons → tldraw/icons}/icon/geo-trapezoid.svg +0 -0
- /package/dist/{icons → tldraw/icons}/icon/geo-triangle.svg +0 -0
- /package/dist/{icons → tldraw/icons}/icon/geo-x-box.svg +0 -0
- /package/dist/{icons → tldraw/icons}/icon/github.svg +0 -0
- /package/dist/{icons → tldraw/icons}/icon/group.svg +0 -0
- /package/dist/{icons → tldraw/icons}/icon/hidden.svg +0 -0
- /package/dist/{icons → tldraw/icons}/icon/icon-names.json +0 -0
- /package/dist/{icons → tldraw/icons}/icon/image.svg +0 -0
- /package/dist/{icons → tldraw/icons}/icon/info-circle.svg +0 -0
- /package/dist/{icons → tldraw/icons}/icon/leading.svg +0 -0
- /package/dist/{icons → tldraw/icons}/icon/link.svg +0 -0
- /package/dist/{icons → tldraw/icons}/icon/lock-small.svg +0 -0
- /package/dist/{icons → tldraw/icons}/icon/lock.svg +0 -0
- /package/dist/{icons → tldraw/icons}/icon/menu.svg +0 -0
- /package/dist/{icons → tldraw/icons}/icon/minus.svg +0 -0
- /package/dist/{icons → tldraw/icons}/icon/mixed.svg +0 -0
- /package/dist/{icons → tldraw/icons}/icon/pack.svg +0 -0
- /package/dist/{icons → tldraw/icons}/icon/page.svg +0 -0
- /package/dist/{icons → tldraw/icons}/icon/plus.svg +0 -0
- /package/dist/{icons → tldraw/icons}/icon/question-mark-circle.svg +0 -0
- /package/dist/{icons → tldraw/icons}/icon/question-mark.svg +0 -0
- /package/dist/{icons → tldraw/icons}/icon/redo.svg +0 -0
- /package/dist/{icons → tldraw/icons}/icon/reset-zoom.svg +0 -0
- /package/dist/{icons → tldraw/icons}/icon/rotate-ccw.svg +0 -0
- /package/dist/{icons → tldraw/icons}/icon/rotate-cw.svg +0 -0
- /package/dist/{icons → tldraw/icons}/icon/ruler.svg +0 -0
- /package/dist/{icons → tldraw/icons}/icon/search.svg +0 -0
- /package/dist/{icons → tldraw/icons}/icon/send-backward.svg +0 -0
- /package/dist/{icons → tldraw/icons}/icon/send-to-back.svg +0 -0
- /package/dist/{icons → tldraw/icons}/icon/settings-horizontal.svg +0 -0
- /package/dist/{icons → tldraw/icons}/icon/settings-vertical-1.svg +0 -0
- /package/dist/{icons → tldraw/icons}/icon/settings-vertical.svg +0 -0
- /package/dist/{icons → tldraw/icons}/icon/share-1.svg +0 -0
- /package/dist/{icons → tldraw/icons}/icon/share-2.svg +0 -0
- /package/dist/{icons → tldraw/icons}/icon/size-extra-large.svg +0 -0
- /package/dist/{icons → tldraw/icons}/icon/size-large.svg +0 -0
- /package/dist/{icons → tldraw/icons}/icon/size-medium.svg +0 -0
- /package/dist/{icons → tldraw/icons}/icon/size-small.svg +0 -0
- /package/dist/{icons → tldraw/icons}/icon/spline-cubic.svg +0 -0
- /package/dist/{icons → tldraw/icons}/icon/spline-line.svg +0 -0
- /package/dist/{icons → tldraw/icons}/icon/stack-horizontal.svg +0 -0
- /package/dist/{icons → tldraw/icons}/icon/stack-vertical.svg +0 -0
- /package/dist/{icons → tldraw/icons}/icon/status-offline.svg +0 -0
- /package/dist/{icons → tldraw/icons}/icon/status-online.svg +0 -0
- /package/dist/{icons → tldraw/icons}/icon/stretch-horizontal.svg +0 -0
- /package/dist/{icons → tldraw/icons}/icon/stretch-vertical.svg +0 -0
- /package/dist/{icons → tldraw/icons}/icon/text-align-center.svg +0 -0
- /package/dist/{icons → tldraw/icons}/icon/text-align-justify.svg +0 -0
- /package/dist/{icons → tldraw/icons}/icon/text-align-left.svg +0 -0
- /package/dist/{icons → tldraw/icons}/icon/text-align-right.svg +0 -0
- /package/dist/{icons → tldraw/icons}/icon/tool-arrow.svg +0 -0
- /package/dist/{icons → tldraw/icons}/icon/tool-embed.svg +0 -0
- /package/dist/{icons → tldraw/icons}/icon/tool-eraser.svg +0 -0
- /package/dist/{icons → tldraw/icons}/icon/tool-frame.svg +0 -0
- /package/dist/{icons → tldraw/icons}/icon/tool-hand.svg +0 -0
- /package/dist/{icons → tldraw/icons}/icon/tool-highlight.svg +0 -0
- /package/dist/{icons → tldraw/icons}/icon/tool-laser.svg +0 -0
- /package/dist/{icons → tldraw/icons}/icon/tool-line.svg +0 -0
- /package/dist/{icons → tldraw/icons}/icon/tool-media.svg +0 -0
- /package/dist/{icons → tldraw/icons}/icon/tool-note.svg +0 -0
- /package/dist/{icons → tldraw/icons}/icon/tool-pencil.svg +0 -0
- /package/dist/{icons → tldraw/icons}/icon/tool-pointer.svg +0 -0
- /package/dist/{icons → tldraw/icons}/icon/tool-text.svg +0 -0
- /package/dist/{icons → tldraw/icons}/icon/trash.svg +0 -0
- /package/dist/{icons → tldraw/icons}/icon/triangle-down.svg +0 -0
- /package/dist/{icons → tldraw/icons}/icon/triangle-up.svg +0 -0
- /package/dist/{icons → tldraw/icons}/icon/twitter.svg +0 -0
- /package/dist/{icons → tldraw/icons}/icon/undo.svg +0 -0
- /package/dist/{icons → tldraw/icons}/icon/ungroup.svg +0 -0
- /package/dist/{icons → tldraw/icons}/icon/unlock-small.svg +0 -0
- /package/dist/{icons → tldraw/icons}/icon/unlock.svg +0 -0
- /package/dist/{icons → tldraw/icons}/icon/vertical-align-center.svg +0 -0
- /package/dist/{icons → tldraw/icons}/icon/vertical-align-end.svg +0 -0
- /package/dist/{icons → tldraw/icons}/icon/vertical-align-start.svg +0 -0
- /package/dist/{icons → tldraw/icons}/icon/visible.svg +0 -0
- /package/dist/{icons → tldraw/icons}/icon/warning-triangle.svg +0 -0
- /package/dist/{icons → tldraw/icons}/icon/zoom-in.svg +0 -0
- /package/dist/{icons → tldraw/icons}/icon/zoom-out.svg +0 -0
- /package/dist/{translations → tldraw/translations}/ar.json +0 -0
- /package/dist/{translations → tldraw/translations}/ca.json +0 -0
- /package/dist/{translations → tldraw/translations}/cs.json +0 -0
- /package/dist/{translations → tldraw/translations}/da.json +0 -0
- /package/dist/{translations → tldraw/translations}/de.json +0 -0
- /package/dist/{translations → tldraw/translations}/en.json +0 -0
- /package/dist/{translations → tldraw/translations}/es.json +0 -0
- /package/dist/{translations → tldraw/translations}/fa.json +0 -0
- /package/dist/{translations → tldraw/translations}/fi.json +0 -0
- /package/dist/{translations → tldraw/translations}/fr.json +0 -0
- /package/dist/{translations → tldraw/translations}/gl.json +0 -0
- /package/dist/{translations → tldraw/translations}/he.json +0 -0
- /package/dist/{translations → tldraw/translations}/hi-in.json +0 -0
- /package/dist/{translations → tldraw/translations}/hu.json +0 -0
- /package/dist/{translations → tldraw/translations}/it.json +0 -0
- /package/dist/{translations → tldraw/translations}/ja.json +0 -0
- /package/dist/{translations → tldraw/translations}/ko-kr.json +0 -0
- /package/dist/{translations → tldraw/translations}/ku.json +0 -0
- /package/dist/{translations → tldraw/translations}/languages.json +0 -0
- /package/dist/{translations → tldraw/translations}/main.json +0 -0
- /package/dist/{translations → tldraw/translations}/my.json +0 -0
- /package/dist/{translations → tldraw/translations}/ne.json +0 -0
- /package/dist/{translations → tldraw/translations}/no.json +0 -0
- /package/dist/{translations → tldraw/translations}/pl.json +0 -0
- /package/dist/{translations → tldraw/translations}/pt-br.json +0 -0
- /package/dist/{translations → tldraw/translations}/pt-pt.json +0 -0
- /package/dist/{translations → tldraw/translations}/ro.json +0 -0
- /package/dist/{translations → tldraw/translations}/ru.json +0 -0
- /package/dist/{translations → tldraw/translations}/sv.json +0 -0
- /package/dist/{translations → tldraw/translations}/te.json +0 -0
- /package/dist/{translations → tldraw/translations}/th.json +0 -0
- /package/dist/{translations → tldraw/translations}/tr.json +0 -0
- /package/dist/{translations → tldraw/translations}/uk.json +0 -0
- /package/dist/{translations → tldraw/translations}/vi.json +0 -0
- /package/dist/{translations → tldraw/translations}/zh-cn.json +0 -0
- /package/dist/{translations → tldraw/translations}/zh-tw.json +0 -0
package/bin/cli.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
var Ot=(s=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(s,{get:(t,e)=>(typeof require<"u"?require:t)[e]}):s)(function(s){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+s+'" is not supported')});var an="1.0.
|
|
2
|
+
var Ot=(s=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(s,{get:(t,e)=>(typeof require<"u"?require:t)[e]}):s)(function(s){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+s+'" is not supported')});var an="1.0.1";import hn from"express";import bi from"node:net";import wi from"node:os";var he=class extends Error{constructor(t){super(`${t} is locked`)}},Zt={old:new Set,young:new Set},yi=1e3*15;var ie,Oi=()=>{let s=wi.networkInterfaces(),t=new Set([void 0,"0.0.0.0"]);for(let e of Object.values(s))for(let n of e)t.add(n.address);return t},ln=s=>new Promise((t,e)=>{let n=bi.createServer();n.unref(),n.on("error",e),n.listen(s,()=>{let{port:i}=n.address();n.close(()=>{t(i)})})}),cn=async(s,t)=>{if(s.host||s.port===0)return ln(s);for(let e of t)try{await ln({port:s.port,host:e})}catch(n){if(!["EADDRNOTAVAIL","EINVAL"].includes(n.code))throw n}return s.port},_i=function*(s){s&&(yield*s),yield 0};async function $e(s){let t,e=new Set;if(s&&(s.port&&(t=typeof s.port=="number"?[s.port]:s.port),s.exclude)){let i=s.exclude;if(typeof i[Symbol.iterator]!="function")throw new TypeError("The `exclude` option must be an iterable.");for(let r of i){if(typeof r!="number")throw new TypeError("Each item in the `exclude` option must be a number corresponding to the port you want excluded.");if(!Number.isSafeInteger(r))throw new TypeError(`Number ${r} in the exclude option is not a safe integer and can't be used`)}e=new Set(i)}ie===void 0&&(ie=setTimeout(()=>{ie=void 0,Zt.old=Zt.young,Zt.young=new Set},yi),ie.unref&&ie.unref());let n=Oi();for(let i of _i(t))try{if(e.has(i))continue;let r=await cn({...s,port:i},n);for(;Zt.old.has(r)||Zt.young.has(r);){if(i!==0)throw new he(i);r=await cn({...s,port:i},n)}return Zt.young.add(r),r}catch(r){if(!["EADDRINUSE","EACCES"].includes(r.code)&&!(r instanceof he))throw r}throw new Error("No available ports found")}import un from"node:fs/promises";import dn from"node:os";import Wt from"node:path";import{dirname as xi}from"node:path";import{fileURLToPath as Ei}from"node:url";import ji from"puppeteer";import Ci from"node:os";var fn=Ci.homedir();function ue(s){if(typeof s!="string")throw new TypeError(`Expected a string, got ${typeof s}`);return fn?s.replace(/^~(?=$|\/|\\)/,fn):s}async function Ai(s){let t=hn(),e=await $e();return t.use(hn.static(s)),new Promise((n,i)=>{let r=t.listen(e,()=>{n(r)});r.on("error",a=>{i(a)})})}async function Pi(s){return new Promise((t,e)=>{s.on("Browser.downloadProgress",n=>{n.state==="completed"?t(n.guid):n.state==="canceled"&&e(new Error("Download was canceled"))})})}async function pn(s,t="svg",e="./",n=!1){let i=xi(Ei(import.meta.url)),r=Wt.resolve(ue(s));n&&console.log(`Loading tldr file "${r}"`);let a=await un.readFile(r,"utf8");n&&console.log("Starting tldraw server..."),console.log(`scriptDirectory: ${i}`);let c=Wt.join(i,i.endsWith("/src/lib")?"../../dist/tldraw":i.endsWith("/dist/lib")?"../tldraw":"../dist/tldraw");n&&console.log(`tldraw served from "${c}"`);let g=await Ai(c),{port:w}=g.address();n&&console.log(`tldraw hosted at "http://localhost:${w}"`),n&&console.log("Starting Puppeteer...");let p=await ji.launch({headless:"new"}),u=await p.newPage();await u.setRequestInterception(!0),u.on("request",D=>{D.url().endsWith("favicon.ico")?D.respond({status:200}):D.continue()}),u.on("console",D=>{let z=D.type(),T=D.text();z==="error"?console.error(`[Browser] ${T}`):z==="warning"?console.warn(`[Browser] ${T}`):n&&console.log(`[Browser] ${T}`)});let m=await u.target().createCDPSession();await m.send("Browser.setDownloadBehavior",{behavior:"allowAndName",downloadPath:dn.tmpdir(),eventsEnabled:!0}),await u.goto(`http://localhost:${w}`),await u.waitForFunction(()=>window.tldrawExportFile!==void 0),n&&console.log("Requesting download"),await u.evaluate((D,z)=>{window.tldrawExportFile(D,z)},a,t);let y=await Pi(m);n&&console.log("Download complete"),await p.close(),n&&console.log("Stopped Puppeteer");let E=Wt.basename(s,Wt.extname(s)),_=Wt.join(dn.tmpdir(),y),d=ue(Wt.join(e,`${E}.${t}`));return await un.rename(_,d),n&&console.log(`Saved to "${d}"`),g.close(),n&&console.log("Stopped tldraw server"),Wt.resolve(d)}import{notStrictEqual as Xi,strictEqual as ki}from"assert";var Si={right:Fi,center:Ni},Ii=0,de=1,Mi=2,pe=3,ve=class{constructor(t){var e;this.width=t.width,this.wrap=(e=t.wrap)!==null&&e!==void 0?e:!0,this.rows=[]}span(...t){let e=this.div(...t);e.span=!0}resetOutput(){this.rows=[]}div(...t){if(t.length===0&&this.div(""),this.wrap&&this.shouldApplyLayoutDSL(...t)&&typeof t[0]=="string")return this.applyLayoutDSL(t[0]);let e=t.map(n=>typeof n=="string"?this.colFromString(n):n);return this.rows.push(e),e}shouldApplyLayoutDSL(...t){return t.length===1&&typeof t[0]=="string"&&/[\t\n]/.test(t[0])}applyLayoutDSL(t){let e=t.split(`
|
|
3
3
|
`).map(i=>i.split(" ")),n=0;return e.forEach(i=>{i.length>1&&at.stringWidth(i[0])>n&&(n=Math.min(Math.floor(this.width*.5),at.stringWidth(i[0])))}),e.forEach(i=>{this.div(...i.map((r,a)=>({text:r.trim(),padding:this.measurePadding(r),width:a===0&&i.length>1?n:void 0})))}),this.rows[this.rows.length-1]}colFromString(t){return{text:t,padding:this.measurePadding(t)}}measurePadding(t){let e=at.stripAnsi(t);return[0,e.match(/\s*$/)[0].length,0,e.match(/^\s*/)[0].length]}toString(){let t=[];return this.rows.forEach(e=>{this.rowToString(e,t)}),t.filter(e=>!e.hidden).map(e=>e.text).join(`
|
|
4
4
|
`)}rowToString(t,e){return this.rasterize(t).forEach((n,i)=>{let r="";n.forEach((a,c)=>{let{width:g}=t[c],w=this.negatePadding(t[c]),p=a;if(w>at.stringWidth(a)&&(p+=" ".repeat(w-at.stringWidth(a))),t[c].align&&t[c].align!=="left"&&this.wrap){let m=Si[t[c].align];p=m(p,w),at.stringWidth(p)<w&&(p+=" ".repeat((g||0)-at.stringWidth(p)-1))}let u=t[c].padding||[0,0,0,0];u[pe]&&(r+=" ".repeat(u[pe])),r+=mn(t[c],p,"| "),r+=p,r+=mn(t[c],p," |"),u[de]&&(r+=" ".repeat(u[de])),i===0&&e.length>0&&(r=this.renderInline(r,e[e.length-1]))}),e.push({text:r.replace(/ +$/,""),span:t.span})}),e}renderInline(t,e){let n=t.match(/^ */),i=n?n[0].length:0,r=e.text,a=at.stringWidth(r.trimRight());return e.span?this.wrap?i<a?t:(e.hidden=!0,r.trimRight()+" ".repeat(i-a)+t.trimLeft()):(e.hidden=!0,r+t):t}rasterize(t){let e=[],n=this.columnWidths(t),i;return t.forEach((r,a)=>{r.width=n[a],this.wrap?i=at.wrap(r.text,this.negatePadding(r),{hard:!0}).split(`
|
|
5
5
|
`):i=r.text.split(`
|
|
6
|
-
`),r.border&&(i.unshift("."+"-".repeat(this.negatePadding(r)+2)+"."),i.push("'"+"-".repeat(this.negatePadding(r)+2)+"'")),r.padding&&(i.unshift(...new Array(r.padding[
|
|
7
|
-
`),i+=s.charAt(r);return e&&n&&(i=`${e}${i}${n}`),i}function Ne(s){return gn(s,{stringWidth:t=>[...t].length,stripAnsi:Fe,wrap:wn})}import{dirname as yn,resolve as On}from"path";import{readdirSync as Di,statSync as Wi}from"fs";function _n(s,t){let e=On(".",s),n;for(Wi(e).isDirectory()||(e=yn(e));;){if(n=t(e,Di(e)),n)return On(e,n);if(e=yn(n=e),n===e)break}}import{inspect as ts}from"util";import{readFileSync as es}from"fs";import{fileURLToPath as ns}from"url";import{format as Ri}from"util";import{normalize as Ui,resolve as Ti}from"path";function Wt(s){if(s!==s.toLowerCase()&&s!==s.toUpperCase()||(s=s.toLowerCase()),s.indexOf("-")===-1&&s.indexOf("_")===-1)return s;{let e="",n=!1,i=s.match(/^-+/);for(let r=i?i[0].length:0;r<s.length;r++){let a=s.charAt(r);n&&(n=!1,a=a.toUpperCase()),r!==0&&(a==="-"||a==="_")?n=!0:a!=="-"&&a!=="_"&&(e+=a)}return e}}function me(s,t){let e=s.toLowerCase();t=t||"-";let n="";for(let i=0;i<s.length;i++){let r=e.charAt(i),a=s.charAt(i);r!==a&&i>0?n+=`${t}${e.charAt(i)}`:n+=a}return n}function ge(s){return s==null?!1:typeof s=="number"||/^0x[0-9a-f]+$/i.test(s)?!0:/^0[^.]/.test(s)?!1:/^[-]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(s)}function Cn(s){if(Array.isArray(s))return s.map(a=>typeof a!="string"?a+"":a);s=s.trim();let t=0,e=null,n=null,i=null,r=[];for(let a=0;a<s.length;a++){if(e=n,n=s.charAt(a),n===" "&&!i){e!==" "&&t++;continue}n===i?i=null:(n==="'"||n==='"')&&!i&&(i=n),r[t]||(r[t]=""),r[t]+=n}return r}var ht;(function(s){s.BOOLEAN="boolean",s.STRING="string",s.NUMBER="number",s.ARRAY="array"})(ht||(ht={}));var jt,be=class{constructor(t){jt=t}parse(t,e){let n=Object.assign({alias:void 0,array:void 0,boolean:void 0,config:void 0,configObjects:void 0,configuration:void 0,coerce:void 0,count:void 0,default:void 0,envPrefix:void 0,narg:void 0,normalize:void 0,string:void 0,number:void 0,__:void 0,key:void 0},e),i=Cn(t),r=typeof t=="string",a=Li(Object.assign(Object.create(null),n.alias)),c=Object.assign({"boolean-negation":!0,"camel-case-expansion":!0,"combine-arrays":!1,"dot-notation":!0,"duplicate-arguments-array":!0,"flatten-duplicate-arrays":!0,"greedy-arrays":!0,"halt-at-non-option":!1,"nargs-eats-options":!1,"negation-prefix":"no-","parse-numbers":!0,"parse-positional-numbers":!0,"populate--":!1,"set-placeholder-key":!1,"short-option-groups":!0,"strip-aliased":!1,"strip-dashed":!1,"unknown-options-as-args":!1},n.configuration),g=Object.assign(Object.create(null),n.default),w=n.configObjects||[],p=n.envPrefix,u=c["populate--"],m=u?"--":"_",y=Object.create(null),E=Object.create(null),_=n.__||jt.format,d={aliases:Object.create(null),arrays:Object.create(null),bools:Object.create(null),strings:Object.create(null),numbers:Object.create(null),counts:Object.create(null),normalize:Object.create(null),configs:Object.create(null),nargs:Object.create(null),coercions:Object.create(null),keys:[]},F=/^-([0-9]+(\.[0-9]+)?|\.[0-9]+)$/,z=new RegExp("^--"+c["negation-prefix"]+"(.+)");[].concat(n.array||[]).filter(Boolean).forEach(function(l){let h=typeof l=="object"?l.key:l,O=Object.keys(l).map(function(b){return{boolean:"bools",string:"strings",number:"numbers"}[b]}).filter(Boolean).pop();O&&(d[O][h]=!0),d.arrays[h]=!0,d.keys.push(h)}),[].concat(n.boolean||[]).filter(Boolean).forEach(function(l){d.bools[l]=!0,d.keys.push(l)}),[].concat(n.string||[]).filter(Boolean).forEach(function(l){d.strings[l]=!0,d.keys.push(l)}),[].concat(n.number||[]).filter(Boolean).forEach(function(l){d.numbers[l]=!0,d.keys.push(l)}),[].concat(n.count||[]).filter(Boolean).forEach(function(l){d.counts[l]=!0,d.keys.push(l)}),[].concat(n.normalize||[]).filter(Boolean).forEach(function(l){d.normalize[l]=!0,d.keys.push(l)}),typeof n.narg=="object"&&Object.entries(n.narg).forEach(([l,h])=>{typeof h=="number"&&(d.nargs[l]=h,d.keys.push(l))}),typeof n.coerce=="object"&&Object.entries(n.coerce).forEach(([l,h])=>{typeof h=="function"&&(d.coercions[l]=h,d.keys.push(l))}),typeof n.config<"u"&&(Array.isArray(n.config)||typeof n.config=="string"?[].concat(n.config).filter(Boolean).forEach(function(l){d.configs[l]=!0}):typeof n.config=="object"&&Object.entries(n.config).forEach(([l,h])=>{(typeof h=="boolean"||typeof h=="function")&&(d.configs[l]=h)})),Dt(n.key,a,n.default,d.arrays),Object.keys(g).forEach(function(l){(d.aliases[l]||[]).forEach(function(h){g[h]=g[l]})});let T=null;fe();let U=[],B=Object.assign(Object.create(null),{_:[]}),At={};for(let l=0;l<i.length;l++){let h=i[l],O=h.replace(/^-{3,}/,"---"),b,f,S,x,$,it;if(h!=="--"&&/^-/.test(h)&&J(h))gt(h);else if(O.match(/^---+(=|$)/)){gt(h);continue}else if(h.match(/^--.+=/)||!c["short-option-groups"]&&h.match(/^-.+=/))x=h.match(/^--?([^=]+)=([\s\S]*)$/),x!==null&&Array.isArray(x)&&x.length>=3&&(N(x[1],d.arrays)?l=Ft(l,x[1],i,x[2]):N(x[1],d.nargs)!==!1?l=Qt(l,x[1],i,x[2]):G(x[1],x[2],!0));else if(h.match(z)&&c["boolean-negation"])x=h.match(z),x!==null&&Array.isArray(x)&&x.length>=2&&(f=x[1],G(f,N(f,d.arrays)?[!1]:!1));else if(h.match(/^--.+/)||!c["short-option-groups"]&&h.match(/^-[^-]+/))x=h.match(/^--?(.+)/),x!==null&&Array.isArray(x)&&x.length>=2&&(f=x[1],N(f,d.arrays)?l=Ft(l,f,i):N(f,d.nargs)!==!1?l=Qt(l,f,i):($=i[l+1],$!==void 0&&(!$.match(/^-/)||$.match(F))&&!N(f,d.bools)&&!N(f,d.counts)||/^(true|false)$/.test($)?(G(f,$),l++):G(f,Z(f))));else if(h.match(/^-.\..+=/))x=h.match(/^-([^=]+)=([\s\S]*)$/),x!==null&&Array.isArray(x)&&x.length>=3&&G(x[1],x[2]);else if(h.match(/^-.\..+/)&&!h.match(F))$=i[l+1],x=h.match(/^-(.\..+)/),x!==null&&Array.isArray(x)&&x.length>=2&&(f=x[1],$!==void 0&&!$.match(/^-/)&&!N(f,d.bools)&&!N(f,d.counts)?(G(f,$),l++):G(f,Z(f)));else if(h.match(/^-[^-]+/)&&!h.match(F)){S=h.slice(1,-1).split(""),b=!1;for(let rt=0;rt<S.length;rt++){if($=h.slice(rt+2),S[rt+1]&&S[rt+1]==="="){it=h.slice(rt+3),f=S[rt],N(f,d.arrays)?l=Ft(l,f,i,it):N(f,d.nargs)!==!1?l=Qt(l,f,i,it):G(f,it),b=!0;break}if($==="-"){G(S[rt],$);continue}if(/[A-Za-z]/.test(S[rt])&&/^-?\d+(\.\d*)?(e-?\d+)?$/.test($)&&N($,d.bools)===!1){G(S[rt],$),b=!0;break}if(S[rt+1]&&S[rt+1].match(/\W/)){G(S[rt],$),b=!0;break}else G(S[rt],Z(S[rt]))}f=h.slice(-1)[0],!b&&f!=="-"&&(N(f,d.arrays)?l=Ft(l,f,i):N(f,d.nargs)!==!1?l=Qt(l,f,i):($=i[l+1],$!==void 0&&(!/^(-|--)[^-]/.test($)||$.match(F))&&!N(f,d.bools)&&!N(f,d.counts)||/^(true|false)$/.test($)?(G(f,$),l++):G(f,Z(f))))}else if(h.match(/^-[0-9]$/)&&h.match(F)&&N(h.slice(1),d.bools))f=h.slice(1),G(f,Z(f));else if(h==="--"){U=i.slice(l+1);break}else if(c["halt-at-non-option"]){U=i.slice(l);break}else gt(h)}H(B,!0),H(B,!1),L(B),et(),Q(B,d.aliases,g,!0),nt(B),c["set-placeholder-key"]&&Nt(B),Object.keys(d.counts).forEach(function(l){xt(B,l.split("."))||G(l,0)}),u&&U.length&&(B[m]=[]),U.forEach(function(l){B[m].push(l)}),c["camel-case-expansion"]&&c["strip-dashed"]&&Object.keys(B).filter(l=>l!=="--"&&l.includes("-")).forEach(l=>{delete B[l]}),c["strip-aliased"]&&[].concat(...Object.keys(a).map(l=>a[l])).forEach(l=>{c["camel-case-expansion"]&&l.includes("-")&&delete B[l.split(".").map(h=>Wt(h)).join(".")],delete B[l]});function gt(l){let h=P("_",l);(typeof h=="string"||typeof h=="number")&&B._.push(h)}function Qt(l,h,O,b){let f,S=N(h,d.nargs);if(S=typeof S!="number"||isNaN(S)?1:S,S===0)return wt(b)||(T=Error(_("Argument unexpected for: %s",h))),G(h,Z(h)),l;let x=wt(b)?0:1;if(c["nargs-eats-options"])O.length-(l+1)+x<S&&(T=Error(_("Not enough arguments following: %s",h))),x=S;else{for(f=l+1;f<O.length&&(!O[f].match(/^-[^0-9]/)||O[f].match(F)||J(O[f]));f++)x++;x<S&&(T=Error(_("Not enough arguments following: %s",h)))}let $=Math.min(x,S);for(!wt(b)&&$>0&&(G(h,b),$--),f=l+1;f<$+l+1;f++)G(h,O[f]);return l+$}function Ft(l,h,O,b){let f=[],S=b||O[l+1],x=N(h,d.nargs);if(N(h,d.bools)&&!/^(true|false)$/.test(S))f.push(!0);else if(wt(S)||wt(b)&&/^-/.test(S)&&!F.test(S)&&!J(S)){if(g[h]!==void 0){let $=g[h];f=Array.isArray($)?$:[$]}}else{wt(b)||f.push(C(h,b,!0));for(let $=l+1;$<O.length&&!(!c["greedy-arrays"]&&f.length>0||x&&typeof x=="number"&&f.length>=x||(S=O[$],/^-/.test(S)&&!F.test(S)&&!J(S)));$++)l=$,f.push(C(h,S,r))}return typeof x=="number"&&(x&&f.length<x||isNaN(x)&&f.length===0)&&(T=Error(_("Not enough arguments following: %s",h))),G(h,f),l}function G(l,h,O=r){if(/-/.test(l)&&c["camel-case-expansion"]){let S=l.split(".").map(function(x){return Wt(x)}).join(".");M(l,S)}let b=C(l,h,O),f=l.split(".");Et(B,f,b),d.aliases[l]&&d.aliases[l].forEach(function(S){let x=S.split(".");Et(B,x,b)}),f.length>1&&c["dot-notation"]&&(d.aliases[f[0]]||[]).forEach(function(S){let x=S.split("."),$=[].concat(f);$.shift(),x=x.concat($),(d.aliases[l]||[]).includes(x.join("."))||Et(B,x,b)}),N(l,d.normalize)&&!N(l,d.arrays)&&[l].concat(d.aliases[l]||[]).forEach(function(x){Object.defineProperty(At,x,{enumerable:!0,get(){return h},set($){h=typeof $=="string"?jt.normalize($):$}})})}function M(l,h){d.aliases[l]&&d.aliases[l].length||(d.aliases[l]=[h],y[h]=!0),d.aliases[h]&&d.aliases[h].length||M(h,l)}function C(l,h,O){O&&(h=zi(h)),(N(l,d.bools)||N(l,d.counts))&&typeof h=="string"&&(h=h==="true");let b=Array.isArray(h)?h.map(function(f){return P(l,f)}):P(l,h);return N(l,d.counts)&&(wt(b)||typeof b=="boolean")&&(b=De()),N(l,d.normalize)&&N(l,d.arrays)&&(Array.isArray(h)?b=h.map(f=>jt.normalize(f)):b=jt.normalize(h)),b}function P(l,h){return!c["parse-positional-numbers"]&&l==="_"||!N(l,d.strings)&&!N(l,d.bools)&&!Array.isArray(h)&&(ge(h)&&c["parse-numbers"]&&Number.isSafeInteger(Math.floor(parseFloat(`${h}`)))||!wt(h)&&N(l,d.numbers))&&(h=Number(h)),h}function L(l){let h=Object.create(null);Q(h,d.aliases,g),Object.keys(d.configs).forEach(function(O){let b=l[O]||h[O];if(b)try{let f=null,S=jt.resolve(jt.cwd(),b),x=d.configs[O];if(typeof x=="function"){try{f=x(S)}catch($){f=$}if(f instanceof Error){T=f;return}}else f=jt.require(S);Y(f)}catch(f){f.name==="PermissionDenied"?T=f:l[O]&&(T=Error(_("Invalid JSON config file: %s",b)))}})}function Y(l,h){Object.keys(l).forEach(function(O){let b=l[O],f=h?h+"."+O:O;typeof b=="object"&&b!==null&&!Array.isArray(b)&&c["dot-notation"]?Y(b,f):(!xt(B,f.split("."))||N(f,d.arrays)&&c["combine-arrays"])&&G(f,b)})}function et(){typeof w<"u"&&w.forEach(function(l){Y(l)})}function H(l,h){if(typeof p>"u")return;let O=typeof p=="string"?p:"",b=jt.env();Object.keys(b).forEach(function(f){if(O===""||f.lastIndexOf(O,0)===0){let S=f.split("__").map(function(x,$){return $===0&&(x=x.substring(O.length)),Wt(x)});(h&&d.configs[S.join(".")]||!h)&&!xt(l,S)&&G(S.join("."),b[f])}})}function nt(l){let h,O=new Set;Object.keys(l).forEach(function(b){if(!O.has(b)&&(h=N(b,d.coercions),typeof h=="function"))try{let f=P(b,h(l[b]));[].concat(d.aliases[b]||[],b).forEach(S=>{O.add(S),l[S]=f})}catch(f){T=f}})}function Nt(l){return d.keys.forEach(h=>{~h.indexOf(".")||typeof l[h]>"u"&&(l[h]=void 0)}),l}function Q(l,h,O,b=!1){Object.keys(O).forEach(function(f){xt(l,f.split("."))||(Et(l,f.split("."),O[f]),b&&(E[f]=!0),(h[f]||[]).forEach(function(S){xt(l,S.split("."))||Et(l,S.split("."),O[f])}))})}function xt(l,h){let O=l;c["dot-notation"]||(h=[h.join(".")]),h.slice(0,-1).forEach(function(f){O=O[f]||{}});let b=h[h.length-1];return typeof O!="object"?!1:b in O}function Et(l,h,O){let b=l;c["dot-notation"]||(h=[h.join(".")]),h.slice(0,-1).forEach(function(it){it=xn(it),typeof b=="object"&&b[it]===void 0&&(b[it]={}),typeof b[it]!="object"||Array.isArray(b[it])?(Array.isArray(b[it])?b[it].push({}):b[it]=[b[it],{}],b=b[it][b[it].length-1]):b=b[it]});let f=xn(h[h.length-1]),S=N(h.join("."),d.arrays),x=Array.isArray(O),$=c["duplicate-arguments-array"];!$&&N(f,d.nargs)&&($=!0,(!wt(b[f])&&d.nargs[f]===1||Array.isArray(b[f])&&b[f].length===d.nargs[f])&&(b[f]=void 0)),O===De()?b[f]=De(b[f]):Array.isArray(b[f])?$&&S&&x?b[f]=c["flatten-duplicate-arrays"]?b[f].concat(O):(Array.isArray(b[f][0])?b[f]:[b[f]]).concat([O]):!$&&!!S==!!x?b[f]=O:b[f]=b[f].concat([O]):b[f]===void 0&&S?b[f]=x?O:[O]:$&&!(b[f]===void 0||N(f,d.counts)||N(f,d.bools))?b[f]=[b[f],O]:b[f]=O}function Dt(...l){l.forEach(function(h){Object.keys(h||{}).forEach(function(O){d.aliases[O]||(d.aliases[O]=[].concat(a[O]||[]),d.aliases[O].concat(O).forEach(function(b){if(/-/.test(b)&&c["camel-case-expansion"]){let f=Wt(b);f!==O&&d.aliases[O].indexOf(f)===-1&&(d.aliases[O].push(f),y[f]=!0)}}),d.aliases[O].concat(O).forEach(function(b){if(b.length>1&&/[A-Z]/.test(b)&&c["camel-case-expansion"]){let f=me(b,"-");f!==O&&d.aliases[O].indexOf(f)===-1&&(d.aliases[O].push(f),y[f]=!0)}}),d.aliases[O].forEach(function(b){d.aliases[b]=[O].concat(d.aliases[O].filter(function(f){return b!==f}))}))})})}function N(l,h){let O=[].concat(d.aliases[l]||[],l),b=Object.keys(h),f=O.find(S=>b.includes(S));return f?h[f]:!1}function Ie(l){let h=Object.keys(d);return[].concat(h.map(b=>d[b])).some(function(b){return Array.isArray(b)?b.includes(l):b[l]})}function v(l,...h){return[].concat(...h).some(function(b){let f=l.match(b);return f&&Ie(f[1])})}function K(l){if(l.match(F)||!l.match(/^-[^-]+/))return!1;let h=!0,O,b=l.slice(1).split("");for(let f=0;f<b.length;f++){if(O=l.slice(f+2),!Ie(b[f])){h=!1;break}if(b[f+1]&&b[f+1]==="="||O==="-"||/[A-Za-z]/.test(b[f])&&/^-?\d+(\.\d*)?(e-?\d+)?$/.test(O)||b[f+1]&&b[f+1].match(/\W/))break}return h}function J(l){return c["unknown-options-as-args"]&&R(l)}function R(l){return l=l.replace(/^-{3,}/,"--"),l.match(F)||K(l)?!1:!v(l,/^-+([^=]+?)=[\s\S]*$/,z,/^-+([^=]+?)$/,/^-+([^=]+?)-$/,/^-+([^=]+?\d+)$/,/^-+([^=]+?)\W+.*$/)}function Z(l){return!N(l,d.bools)&&!N(l,d.counts)&&`${l}`in g?g[l]:k(bt(l))}function k(l){return{[ht.BOOLEAN]:!0,[ht.STRING]:"",[ht.NUMBER]:void 0,[ht.ARRAY]:[]}[l]}function bt(l){let h=ht.BOOLEAN;return N(l,d.strings)?h=ht.STRING:N(l,d.numbers)?h=ht.NUMBER:N(l,d.bools)?h=ht.BOOLEAN:N(l,d.arrays)&&(h=ht.ARRAY),h}function wt(l){return l===void 0}function fe(){Object.keys(d.counts).find(l=>N(l,d.arrays)?(T=Error(_("Invalid configuration: %s, opts.count excludes opts.array.",l)),!0):N(l,d.nargs)?(T=Error(_("Invalid configuration: %s, opts.count excludes opts.narg.",l)),!0):!1)}return{aliases:Object.assign({},d.aliases),argv:Object.assign(At,B),configuration:c,defaulted:Object.assign({},E),error:T,newAliases:Object.assign({},y)}}};function Li(s){let t=[],e=Object.create(null),n=!0;for(Object.keys(s).forEach(function(i){t.push([].concat(s[i],i))});n;){n=!1;for(let i=0;i<t.length;i++)for(let r=i+1;r<t.length;r++)if(t[i].filter(function(c){return t[r].indexOf(c)!==-1}).length){t[i]=t[i].concat(t[r]),t.splice(r,1),n=!0;break}}return t.forEach(function(i){i=i.filter(function(a,c,g){return g.indexOf(a)===c});let r=i.pop();r!==void 0&&typeof r=="string"&&(e[r]=i)}),e}function De(s){return s!==void 0?s+1:1}function xn(s){return s==="__proto__"?"___proto___":s}function zi(s){return typeof s=="string"&&(s[0]==="'"||s[0]==='"')&&s[s.length-1]===s[0]?s.substring(1,s.length-1):s}import{readFileSync as Hi}from"fs";var We,Le,ze,En=process&&process.env&&process.env.YARGS_MIN_NODE_VERSION?Number(process.env.YARGS_MIN_NODE_VERSION):12,jn=(Le=(We=process==null?void 0:process.versions)===null||We===void 0?void 0:We.node)!==null&&Le!==void 0?Le:(ze=process==null?void 0:process.version)===null||ze===void 0?void 0:ze.slice(1);if(jn&&Number(jn.match(/^([^.]+)/)[1])<En)throw Error(`yargs parser supports a minimum Node.js version of ${En}. Read our version support policy: https://github.com/yargs/yargs-parser#supported-nodejs-versions`);var Yi=process?process.env:{},An=new be({cwd:process.cwd,env:()=>Yi,format:Ri,normalize:Ui,resolve:Ti,require:s=>{if(typeof Ot<"u")return Ot(s);if(s.match(/\.json$/))return JSON.parse(Hi(s,"utf8"));throw Error("only .json config files are supported in ESM")}}),se=function(t,e){return An.parse(t.slice(),e).argv};se.detailed=function(s,t){return An.parse(s.slice(),t)};se.camelCase=Wt;se.decamelize=me;se.looksLikeNumber=ge;var Re=se;import{basename as is,dirname as ss,extname as rs,relative as os,resolve as vn}from"path";function Pn(){return Bi()?0:1}function Bi(){return Gi()&&!process.defaultApp}function Gi(){return!!process.versions.electron}function Ue(s){return s.slice(Pn()+1)}function Sn(){return process.argv[Pn()]}var V=class s extends Error{constructor(t){super(t||"yargs error"),this.name="YError",Error.captureStackTrace&&Error.captureStackTrace(this,s)}};import{readFileSync as Vi,statSync as qi,writeFile as Ki}from"fs";import{format as Qi}from"util";import{resolve as Ji}from"path";var Mn={fs:{readFileSync:Vi,writeFile:Ki},format:Qi,resolve:Ji,exists:s=>{try{return qi(s).isFile()}catch{return!1}}};var yt,Te=class{constructor(t){t=t||{},this.directory=t.directory||"./locales",this.updateFiles=typeof t.updateFiles=="boolean"?t.updateFiles:!0,this.locale=t.locale||"en",this.fallbackToLanguage=typeof t.fallbackToLanguage=="boolean"?t.fallbackToLanguage:!0,this.cache=Object.create(null),this.writeQueue=[]}__(...t){if(typeof arguments[0]!="string")return this._taggedLiteral(arguments[0],...arguments);let e=t.shift(),n=function(){};return typeof t[t.length-1]=="function"&&(n=t.pop()),n=n||function(){},this.cache[this.locale]||this._readLocaleFile(),!this.cache[this.locale][e]&&this.updateFiles?(this.cache[this.locale][e]=e,this._enqueueWrite({directory:this.directory,locale:this.locale,cb:n})):n(),yt.format.apply(yt.format,[this.cache[this.locale][e]||e].concat(t))}__n(){let t=Array.prototype.slice.call(arguments),e=t.shift(),n=t.shift(),i=t.shift(),r=function(){};typeof t[t.length-1]=="function"&&(r=t.pop()),this.cache[this.locale]||this._readLocaleFile();let a=i===1?e:n;this.cache[this.locale][e]&&(a=this.cache[this.locale][e][i===1?"one":"other"]),!this.cache[this.locale][e]&&this.updateFiles?(this.cache[this.locale][e]={one:e,other:n},this._enqueueWrite({directory:this.directory,locale:this.locale,cb:r})):r();let c=[a];return~a.indexOf("%d")&&c.push(i),yt.format.apply(yt.format,c.concat(t))}setLocale(t){this.locale=t}getLocale(){return this.locale}updateLocale(t){this.cache[this.locale]||this._readLocaleFile();for(let e in t)Object.prototype.hasOwnProperty.call(t,e)&&(this.cache[this.locale][e]=t[e])}_taggedLiteral(t,...e){let n="";return t.forEach(function(i,r){let a=e[r+1];n+=i,typeof a<"u"&&(n+="%s")}),this.__.apply(this,[n].concat([].slice.call(e,1)))}_enqueueWrite(t){this.writeQueue.push(t),this.writeQueue.length===1&&this._processWriteQueue()}_processWriteQueue(){let t=this,e=this.writeQueue[0],n=e.directory,i=e.locale,r=e.cb,a=this._resolveLocaleFile(n,i),c=JSON.stringify(this.cache[i],null,2);yt.fs.writeFile(a,c,"utf-8",function(g){t.writeQueue.shift(),t.writeQueue.length>0&&t._processWriteQueue(),r(g)})}_readLocaleFile(){let t={},e=this._resolveLocaleFile(this.directory,this.locale);try{yt.fs.readFileSync&&(t=JSON.parse(yt.fs.readFileSync(e,"utf-8")))}catch(n){if(n instanceof SyntaxError&&(n.message="syntax error in "+e),n.code==="ENOENT")t={};else throw n}this.cache[this.locale]=t}_resolveLocaleFile(t,e){let n=yt.resolve(t,"./",e+".json");if(this.fallbackToLanguage&&!this._fileExistsSync(n)&&~e.lastIndexOf("_")){let i=yt.resolve(t,"./",e.split("_")[0]+".json");this._fileExistsSync(i)&&(n=i)}return n}_fileExistsSync(t){return yt.exists(t)}};function In(s,t){yt=t;let e=new Te(s);return{__:e.__.bind(e),__n:e.__n.bind(e),setLocale:e.setLocale.bind(e),getLocale:e.getLocale.bind(e),updateLocale:e.updateLocale.bind(e),locale:e.locale}}var Zi=s=>In(s,Mn),$n=Zi;var as="require is not supported by ESM",Fn="loading a directory of commands is not supported yet for ESM",re;try{re=ns(import.meta.url)}catch{re=process.cwd()}var ls=re.substring(0,re.lastIndexOf("node_modules")),He={assert:{notStrictEqual:Xi,strictEqual:ki},cliui:Ne,findUp:_n,getEnv:s=>process.env[s],inspect:ts,getCallerFile:()=>{throw new V(Fn)},getProcessArgvBin:Sn,mainFilename:ls||process.cwd(),Parser:Re,path:{basename:is,dirname:ss,extname:rs,relative:os,resolve:vn},process:{argv:()=>process.argv,cwd:process.cwd,emitWarning:(s,t)=>process.emitWarning(s,t),execPath:()=>process.execPath,exit:process.exit,nextTick:process.nextTick,stdColumns:typeof process.stdout.columns<"u"?process.stdout.columns:null},readFileSync:es,require:()=>{throw new V(as)},requireDirectory:()=>{throw new V(Fn)},stringWidth:s=>[...s].length,y18n:$n({directory:vn(re,"../../../locales"),updateFiles:!1})};function ot(s,t,e,n){e.assert.notStrictEqual(s,t,n)}function Ye(s,t){t.assert.strictEqual(typeof s,"string")}function Xt(s){return Object.keys(s)}function q(s){return!!s&&!!s.then&&typeof s.then=="function"}function Pt(s){let e=s.replace(/\s{2,}/g," ").split(/\s+(?![^[]*]|[^<]*>)/),n=/\.*[\][<>]/g,i=e.shift();if(!i)throw new Error(`No command found in: ${s}`);let r={cmd:i.replace(n,""),demanded:[],optional:[]};return e.forEach((a,c)=>{let g=!1;a=a.replace(/\s/g,""),/\.+[\]>]/.test(a)&&c===e.length-1&&(g=!0),/^\[/.test(a)?r.optional.push({cmd:a.replace(n,"").split("|"),variadic:g}):r.demanded.push({cmd:a.replace(n,"").split("|"),variadic:g})}),r}var cs=["first","second","third","fourth","fifth","sixth"];function j(s,t,e){function n(){return typeof s=="object"?[{demanded:[],optional:[]},s,t]:[Pt(`cmd ${s}`),t,e]}try{let i=0,[r,a,c]=n(),g=[].slice.call(a);for(;g.length&&g[g.length-1]===void 0;)g.pop();let w=c||g.length;if(w<r.demanded.length)throw new V(`Not enough arguments provided. Expected ${r.demanded.length} but received ${g.length}.`);let p=r.demanded.length+r.optional.length;if(w>p)throw new V(`Too many arguments provided. Expected max ${p} but received ${w}.`);r.demanded.forEach(u=>{let m=g.shift(),y=Nn(m);u.cmd.filter(_=>_===y||_==="*").length===0&&Dn(y,u.cmd,i),i+=1}),r.optional.forEach(u=>{if(g.length===0)return;let m=g.shift(),y=Nn(m);u.cmd.filter(_=>_===y||_==="*").length===0&&Dn(y,u.cmd,i),i+=1})}catch(i){console.warn(i.stack)}}function Nn(s){return Array.isArray(s)?"array":s===null?"null":typeof s}function Dn(s,t,e){throw new V(`Invalid ${cs[e]||"manyith"} argument. Expected ${t.join(" or ")} but received ${s}.`)}var we=class{constructor(t){this.globalMiddleware=[],this.frozens=[],this.yargs=t}addMiddleware(t,e,n=!0,i=!1){if(j("<array|function> [boolean] [boolean] [boolean]",[t,e,n],arguments.length),Array.isArray(t)){for(let r=0;r<t.length;r++){if(typeof t[r]!="function")throw Error("middleware must be a function");let a=t[r];a.applyBeforeValidation=e,a.global=n}Array.prototype.push.apply(this.globalMiddleware,t)}else if(typeof t=="function"){let r=t;r.applyBeforeValidation=e,r.global=n,r.mutates=i,this.globalMiddleware.push(t)}return this.yargs}addCoerceMiddleware(t,e){let n=this.yargs.getAliases();return this.globalMiddleware=this.globalMiddleware.filter(i=>{let r=[...n[e]||[],e];return i.option?!r.includes(i.option):!0}),t.option=e,this.addMiddleware(t,!0,!0,!0)}getMiddleware(){return this.globalMiddleware}freeze(){this.frozens.push([...this.globalMiddleware])}unfreeze(){let t=this.frozens.pop();t!==void 0&&(this.globalMiddleware=t)}reset(){this.globalMiddleware=this.globalMiddleware.filter(t=>t.global)}};function Wn(s){return s?s.map(t=>(t.applyBeforeValidation=!1,t)):[]}function Lt(s,t,e,n){return e.reduce((i,r)=>{if(r.applyBeforeValidation!==n)return i;if(r.mutates){if(r.applied)return i;r.applied=!0}if(q(i))return i.then(a=>Promise.all([a,r(a,t)])).then(([a,c])=>Object.assign(a,c));{let a=r(i,t);return q(a)?a.then(c=>Object.assign(i,c)):Object.assign(i,a)}},s)}function zt(s,t,e=n=>{throw n}){try{let n=fs(s)?s():s;return q(n)?n.then(i=>t(i)):t(n)}catch(n){return e(n)}}function fs(s){return typeof s=="function"}function Be(s){if(typeof Ot>"u")return null;for(let t=0,e=Object.keys(Ot.cache),n;t<e.length;t++)if(n=Ot.cache[e[t]],n.exports===s)return n;return null}var kt=/(^\*)|(^\$0)/,Ge=class{constructor(t,e,n,i){this.requireCache=new Set,this.handlers={},this.aliasMap={},this.frozens=[],this.shim=i,this.usage=t,this.globalMiddleware=n,this.validation=e}addDirectory(t,e,n,i){i=i||{},typeof i.recurse!="boolean"&&(i.recurse=!1),Array.isArray(i.extensions)||(i.extensions=["js"]);let r=typeof i.visit=="function"?i.visit:a=>a;i.visit=(a,c,g)=>{let w=r(a,c,g);if(w){if(this.requireCache.has(c))return w;this.requireCache.add(c),this.addHandler(w)}return w},this.shim.requireDirectory({require:e,filename:n},t,i)}addHandler(t,e,n,i,r,a){let c=[],g=Wn(r);if(i=i||(()=>{}),Array.isArray(t))if(hs(t))[t,...c]=t;else for(let w of t)this.addHandler(w);else if(ds(t)){let w=Array.isArray(t.command)||typeof t.command=="string"?t.command:this.moduleName(t);t.aliases&&(w=[].concat(w).concat(t.aliases)),this.addHandler(w,this.extractDesc(t),t.builder,t.handler,t.middlewares,t.deprecated);return}else if(Ln(n)){this.addHandler([t].concat(c),e,n.builder,n.handler,n.middlewares,n.deprecated);return}if(typeof t=="string"){let w=Pt(t);c=c.map(m=>Pt(m).cmd);let p=!1,u=[w.cmd].concat(c).filter(m=>kt.test(m)?(p=!0,!1):!0);u.length===0&&p&&u.push("$0"),p&&(w.cmd=u[0],c=u.slice(1),t=t.replace(kt,w.cmd)),c.forEach(m=>{this.aliasMap[m]=w.cmd}),e!==!1&&this.usage.command(t,e,p,c,a),this.handlers[w.cmd]={original:t,description:e,handler:i,builder:n||{},middlewares:g,deprecated:a,demanded:w.demanded,optional:w.optional},p&&(this.defaultCommand=this.handlers[w.cmd])}}getCommandHandlers(){return this.handlers}getCommands(){return Object.keys(this.handlers).concat(Object.keys(this.aliasMap))}hasDefaultCommand(){return!!this.defaultCommand}runCommand(t,e,n,i,r,a){let c=this.handlers[t]||this.handlers[this.aliasMap[t]]||this.defaultCommand,g=e.getInternalMethods().getContext(),w=g.commands.slice(),p=!t;t&&(g.commands.push(t),g.fullCommands.push(c.original));let u=this.applyBuilderUpdateUsageAndParse(p,c,e,n.aliases,w,i,r,a);return q(u)?u.then(m=>this.applyMiddlewareAndGetResult(p,c,m.innerArgv,g,r,m.aliases,e)):this.applyMiddlewareAndGetResult(p,c,u.innerArgv,g,r,u.aliases,e)}applyBuilderUpdateUsageAndParse(t,e,n,i,r,a,c,g){let w=e.builder,p=n;if(ye(w)){n.getInternalMethods().getUsageInstance().freeze();let u=w(n.getInternalMethods().reset(i),g);if(q(u))return u.then(m=>(p=Rn(m)?m:n,this.parseAndUpdateUsage(t,e,p,r,a,c)))}else us(w)&&(n.getInternalMethods().getUsageInstance().freeze(),p=n.getInternalMethods().reset(i),Object.keys(e.builder).forEach(u=>{p.option(u,w[u])}));return this.parseAndUpdateUsage(t,e,p,r,a,c)}parseAndUpdateUsage(t,e,n,i,r,a){t&&n.getInternalMethods().getUsageInstance().unfreeze(!0),this.shouldUpdateUsage(n)&&n.getInternalMethods().getUsageInstance().usage(this.usageFromParentCommandsCommandHandler(i,e),e.description);let c=n.getInternalMethods().runYargsParserAndExecuteCommands(null,void 0,!0,r,a);return q(c)?c.then(g=>({aliases:n.parsed.aliases,innerArgv:g})):{aliases:n.parsed.aliases,innerArgv:c}}shouldUpdateUsage(t){return!t.getInternalMethods().getUsageInstance().getUsageDisabled()&&t.getInternalMethods().getUsageInstance().getUsage().length===0}usageFromParentCommandsCommandHandler(t,e){let n=kt.test(e.original)?e.original.replace(kt,"").trim():e.original,i=t.filter(r=>!kt.test(r));return i.push(n),`$0 ${i.join(" ")}`}handleValidationAndGetResult(t,e,n,i,r,a,c,g){if(!a.getInternalMethods().getHasOutput()){let w=a.getInternalMethods().runValidation(r,g,a.parsed.error,t);n=zt(n,p=>(w(p),p))}if(e.handler&&!a.getInternalMethods().getHasOutput()){a.getInternalMethods().setHasOutput();let w=!!a.getOptions().configuration["populate--"];a.getInternalMethods().postProcess(n,w,!1,!1),n=Lt(n,a,c,!1),n=zt(n,p=>{let u=e.handler(p);return q(u)?u.then(()=>p):p}),t||a.getInternalMethods().getUsageInstance().cacheHelpMessage(),q(n)&&!a.getInternalMethods().hasParseCallback()&&n.catch(p=>{try{a.getInternalMethods().getUsageInstance().fail(null,p)}catch{}})}return t||(i.commands.pop(),i.fullCommands.pop()),n}applyMiddlewareAndGetResult(t,e,n,i,r,a,c){let g={};if(r)return n;c.getInternalMethods().getHasOutput()||(g=this.populatePositionals(e,n,i,c));let w=this.globalMiddleware.getMiddleware().slice(0).concat(e.middlewares),p=Lt(n,c,w,!0);return q(p)?p.then(u=>this.handleValidationAndGetResult(t,e,u,i,a,c,w,g)):this.handleValidationAndGetResult(t,e,p,i,a,c,w,g)}populatePositionals(t,e,n,i){e._=e._.slice(n.commands.length);let r=t.demanded.slice(0),a=t.optional.slice(0),c={};for(this.validation.positionalCount(r.length,e._.length);r.length;){let g=r.shift();this.populatePositional(g,e,c)}for(;a.length;){let g=a.shift();this.populatePositional(g,e,c)}return e._=n.commands.concat(e._.map(g=>""+g)),this.postProcessPositionals(e,c,this.cmdToParseOptions(t.original),i),c}populatePositional(t,e,n){let i=t.cmd[0];t.variadic?n[i]=e._.splice(0).map(String):e._.length&&(n[i]=[String(e._.shift())])}cmdToParseOptions(t){let e={array:[],default:{},alias:{},demand:{}},n=Pt(t);return n.demanded.forEach(i=>{let[r,...a]=i.cmd;i.variadic&&(e.array.push(r),e.default[r]=[]),e.alias[r]=a,e.demand[r]=!0}),n.optional.forEach(i=>{let[r,...a]=i.cmd;i.variadic&&(e.array.push(r),e.default[r]=[]),e.alias[r]=a}),e}postProcessPositionals(t,e,n,i){let r=Object.assign({},i.getOptions());r.default=Object.assign(n.default,r.default);for(let w of Object.keys(n.alias))r.alias[w]=(r.alias[w]||[]).concat(n.alias[w]);r.array=r.array.concat(n.array),r.config={};let a=[];if(Object.keys(e).forEach(w=>{e[w].map(p=>{r.configuration["unknown-options-as-args"]&&(r.key[w]=!0),a.push(`--${w}`),a.push(p)})}),!a.length)return;let c=Object.assign({},r.configuration,{"populate--":!1}),g=this.shim.Parser.detailed(a,Object.assign({},r,{configuration:c}));if(g.error)i.getInternalMethods().getUsageInstance().fail(g.error.message,g.error);else{let w=Object.keys(e);Object.keys(e).forEach(p=>{w.push(...g.aliases[p])}),Object.keys(g.argv).forEach(p=>{w.includes(p)&&(e[p]||(e[p]=g.argv[p]),!this.isInConfigs(i,p)&&!this.isDefaulted(i,p)&&Object.prototype.hasOwnProperty.call(t,p)&&Object.prototype.hasOwnProperty.call(g.argv,p)&&(Array.isArray(t[p])||Array.isArray(g.argv[p]))?t[p]=[].concat(t[p],g.argv[p]):t[p]=g.argv[p])})}}isDefaulted(t,e){let{default:n}=t.getOptions();return Object.prototype.hasOwnProperty.call(n,e)||Object.prototype.hasOwnProperty.call(n,this.shim.Parser.camelCase(e))}isInConfigs(t,e){let{configObjects:n}=t.getOptions();return n.some(i=>Object.prototype.hasOwnProperty.call(i,e))||n.some(i=>Object.prototype.hasOwnProperty.call(i,this.shim.Parser.camelCase(e)))}runDefaultBuilderOn(t){if(!this.defaultCommand)return;if(this.shouldUpdateUsage(t)){let n=kt.test(this.defaultCommand.original)?this.defaultCommand.original:this.defaultCommand.original.replace(/^[^[\]<>]*/,"$0 ");t.getInternalMethods().getUsageInstance().usage(n,this.defaultCommand.description)}let e=this.defaultCommand.builder;if(ye(e))return e(t,!0);Ln(e)||Object.keys(e).forEach(n=>{t.option(n,e[n])})}moduleName(t){let e=Be(t);if(!e)throw new Error(`No command name given for module: ${this.shim.inspect(t)}`);return this.commandFromFilename(e.filename)}commandFromFilename(t){return this.shim.path.basename(t,this.shim.path.extname(t))}extractDesc({describe:t,description:e,desc:n}){for(let i of[t,e,n]){if(typeof i=="string"||i===!1)return i;ot(i,!0,this.shim)}return!1}freeze(){this.frozens.push({handlers:this.handlers,aliasMap:this.aliasMap,defaultCommand:this.defaultCommand})}unfreeze(){let t=this.frozens.pop();ot(t,void 0,this.shim),{handlers:this.handlers,aliasMap:this.aliasMap,defaultCommand:this.defaultCommand}=t}reset(){return this.handlers={},this.aliasMap={},this.defaultCommand=void 0,this.requireCache=new Set,this}};function zn(s,t,e,n){return new Ge(s,t,e,n)}function Ln(s){return typeof s=="object"&&!!s.builder&&typeof s.handler=="function"}function hs(s){return s.every(t=>typeof t=="string")}function ye(s){return typeof s=="function"}function us(s){return typeof s=="object"}function ds(s){return typeof s=="object"&&!Array.isArray(s)}function St(s={},t=()=>!0){let e={};return Xt(s).forEach(n=>{t(n,s[n])&&(e[n]=s[n])}),e}function Mt(s){typeof process>"u"||[process.stdout,process.stderr].forEach(t=>{let e=t;e._handle&&e.isTTY&&typeof e._handle.setBlocking=="function"&&e._handle.setBlocking(s)})}function ps(s){return typeof s=="boolean"}function Tn(s,t){let e=t.y18n.__,n={},i=[];n.failFn=function(C){i.push(C)};let r=null,a=null,c=!0;n.showHelpOnFail=function(C=!0,P){let[L,Y]=typeof C=="string"?[!0,C]:[C,P];return s.getInternalMethods().isGlobalContext()&&(a=Y),r=Y,c=L,n};let g=!1;n.fail=function(C,P){let L=s.getInternalMethods().getLoggerInstance();if(i.length)for(let Y=i.length-1;Y>=0;--Y){let et=i[Y];if(ps(et)){if(P)throw P;if(C)throw Error(C)}else et(C,P,n)}else{if(s.getExitProcess()&&Mt(!0),!g){g=!0,c&&(s.showHelp("error"),L.error()),(C||P)&&L.error(C||P);let Y=r||a;Y&&((C||P)&&L.error(""),L.error(Y))}if(P=P||new V(C),s.getExitProcess())return s.exit(1);if(s.getInternalMethods().hasParseCallback())return s.exit(1,P);throw P}};let w=[],p=!1;n.usage=(M,C)=>M===null?(p=!0,w=[],n):(p=!1,w.push([M,C||""]),n),n.getUsage=()=>w,n.getUsageDisabled=()=>p,n.getPositionalGroupName=()=>e("Positionals:");let u=[];n.example=(M,C)=>{u.push([M,C||""])};let m=[];n.command=function(C,P,L,Y,et=!1){L&&(m=m.map(H=>(H[2]=!1,H))),m.push([C,P||"",L,Y,et])},n.getCommands=()=>m;let y={};n.describe=function(C,P){Array.isArray(C)?C.forEach(L=>{n.describe(L,P)}):typeof C=="object"?Object.keys(C).forEach(L=>{n.describe(L,C[L])}):y[C]=P},n.getDescriptions=()=>y;let E=[];n.epilog=M=>{E.push(M)};let _=!1,d;n.wrap=M=>{_=!0,d=M},n.getWrap=()=>t.getEnv("YARGS_DISABLE_WRAP")?null:(_||(d=Qt(),_=!0),d);let F="__yargsString__:";n.deferY18nLookup=M=>F+M,n.help=function(){if(U)return U;T();let C=s.customScriptName?s.$0:t.path.basename(s.$0),P=s.getDemandedOptions(),L=s.getDemandedCommands(),Y=s.getDeprecatedOptions(),et=s.getGroups(),H=s.getOptions(),nt=[];nt=nt.concat(Object.keys(y)),nt=nt.concat(Object.keys(P)),nt=nt.concat(Object.keys(L)),nt=nt.concat(Object.keys(H.default)),nt=nt.filter(At),nt=Object.keys(nt.reduce((v,K)=>(K!=="_"&&(v[K]=!0),v),{}));let Nt=n.getWrap(),Q=t.cliui({width:Nt,wrap:!!Nt});if(!p){if(w.length)w.forEach(v=>{Q.div({text:`${v[0].replace(/\$0/g,C)}`}),v[1]&&Q.div({text:`${v[1]}`,padding:[1,0,0,0]})}),Q.div();else if(m.length){let v=null;L._?v=`${C} <${e("command")}>
|
|
6
|
+
`),r.border&&(i.unshift("."+"-".repeat(this.negatePadding(r)+2)+"."),i.push("'"+"-".repeat(this.negatePadding(r)+2)+"'")),r.padding&&(i.unshift(...new Array(r.padding[Ii]||0).fill("")),i.push(...new Array(r.padding[Mi]||0).fill(""))),i.forEach((c,g)=>{e[g]||e.push([]);let w=e[g];for(let p=0;p<a;p++)w[p]===void 0&&w.push("");w.push(c)})}),e}negatePadding(t){let e=t.width||0;return t.padding&&(e-=(t.padding[pe]||0)+(t.padding[de]||0)),t.border&&(e-=4),e}columnWidths(t){if(!this.wrap)return t.map(a=>a.width||at.stringWidth(a.text));let e=t.length,n=this.width,i=t.map(a=>{if(a.width)return e--,n-=a.width,a.width}),r=e?Math.floor(n/e):0;return i.map((a,c)=>a===void 0?Math.max(r,$i(t[c])):a)}};function mn(s,t,e){return s.border?/[.']-+[.']/.test(t)?"":t.trim().length!==0?e:" ":""}function $i(s){let t=s.padding||[],e=1+(t[pe]||0)+(t[de]||0);return s.border?e+4:e}function vi(){return typeof process=="object"&&process.stdout&&process.stdout.columns?process.stdout.columns:80}function Fi(s,t){s=s.trim();let e=at.stringWidth(s);return e<t?" ".repeat(t-e)+s:s}function Ni(s,t){s=s.trim();let e=at.stringWidth(s);return e>=t?s:" ".repeat(t-e>>1)+s}var at;function gn(s,t){return at=t,new ve({width:s?.width||vi(),wrap:s?.wrap})}var bn=new RegExp("\x1B(?:\\[(?:\\d+[ABCDEFGJKSTm]|\\d+;\\d+[Hfm]|\\d+;\\d+;\\d+m|6n|s|u|\\?25[lh])|\\w)","g");function Fe(s){return s.replace(bn,"")}function wn(s,t){let[e,n]=s.match(bn)||["",""];s=Fe(s);let i="";for(let r=0;r<s.length;r++)r!==0&&r%t===0&&(i+=`
|
|
7
|
+
`),i+=s.charAt(r);return e&&n&&(i=`${e}${i}${n}`),i}function Ne(s){return gn(s,{stringWidth:t=>[...t].length,stripAnsi:Fe,wrap:wn})}import{dirname as yn,resolve as On}from"path";import{readdirSync as Di,statSync as Wi}from"fs";function _n(s,t){let e=On(".",s),n;for(Wi(e).isDirectory()||(e=yn(e));;){if(n=t(e,Di(e)),n)return On(e,n);if(e=yn(n=e),n===e)break}}import{inspect as ts}from"util";import{readFileSync as es}from"fs";import{fileURLToPath as ns}from"url";import{format as Ri}from"util";import{normalize as Ui,resolve as Ti}from"path";function Lt(s){if(s!==s.toLowerCase()&&s!==s.toUpperCase()||(s=s.toLowerCase()),s.indexOf("-")===-1&&s.indexOf("_")===-1)return s;{let e="",n=!1,i=s.match(/^-+/);for(let r=i?i[0].length:0;r<s.length;r++){let a=s.charAt(r);n&&(n=!1,a=a.toUpperCase()),r!==0&&(a==="-"||a==="_")?n=!0:a!=="-"&&a!=="_"&&(e+=a)}return e}}function me(s,t){let e=s.toLowerCase();t=t||"-";let n="";for(let i=0;i<s.length;i++){let r=e.charAt(i),a=s.charAt(i);r!==a&&i>0?n+=`${t}${e.charAt(i)}`:n+=a}return n}function ge(s){return s==null?!1:typeof s=="number"||/^0x[0-9a-f]+$/i.test(s)?!0:/^0[^.]/.test(s)?!1:/^[-]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(s)}function Cn(s){if(Array.isArray(s))return s.map(a=>typeof a!="string"?a+"":a);s=s.trim();let t=0,e=null,n=null,i=null,r=[];for(let a=0;a<s.length;a++){if(e=n,n=s.charAt(a),n===" "&&!i){e!==" "&&t++;continue}n===i?i=null:(n==="'"||n==='"')&&!i&&(i=n),r[t]||(r[t]=""),r[t]+=n}return r}var ht;(function(s){s.BOOLEAN="boolean",s.STRING="string",s.NUMBER="number",s.ARRAY="array"})(ht||(ht={}));var jt,be=class{constructor(t){jt=t}parse(t,e){let n=Object.assign({alias:void 0,array:void 0,boolean:void 0,config:void 0,configObjects:void 0,configuration:void 0,coerce:void 0,count:void 0,default:void 0,envPrefix:void 0,narg:void 0,normalize:void 0,string:void 0,number:void 0,__:void 0,key:void 0},e),i=Cn(t),r=typeof t=="string",a=Li(Object.assign(Object.create(null),n.alias)),c=Object.assign({"boolean-negation":!0,"camel-case-expansion":!0,"combine-arrays":!1,"dot-notation":!0,"duplicate-arguments-array":!0,"flatten-duplicate-arrays":!0,"greedy-arrays":!0,"halt-at-non-option":!1,"nargs-eats-options":!1,"negation-prefix":"no-","parse-numbers":!0,"parse-positional-numbers":!0,"populate--":!1,"set-placeholder-key":!1,"short-option-groups":!0,"strip-aliased":!1,"strip-dashed":!1,"unknown-options-as-args":!1},n.configuration),g=Object.assign(Object.create(null),n.default),w=n.configObjects||[],p=n.envPrefix,u=c["populate--"],m=u?"--":"_",y=Object.create(null),E=Object.create(null),_=n.__||jt.format,d={aliases:Object.create(null),arrays:Object.create(null),bools:Object.create(null),strings:Object.create(null),numbers:Object.create(null),counts:Object.create(null),normalize:Object.create(null),configs:Object.create(null),nargs:Object.create(null),coercions:Object.create(null),keys:[]},D=/^-([0-9]+(\.[0-9]+)?|\.[0-9]+)$/,z=new RegExp("^--"+c["negation-prefix"]+"(.+)");[].concat(n.array||[]).filter(Boolean).forEach(function(l){let h=typeof l=="object"?l.key:l,O=Object.keys(l).map(function(b){return{boolean:"bools",string:"strings",number:"numbers"}[b]}).filter(Boolean).pop();O&&(d[O][h]=!0),d.arrays[h]=!0,d.keys.push(h)}),[].concat(n.boolean||[]).filter(Boolean).forEach(function(l){d.bools[l]=!0,d.keys.push(l)}),[].concat(n.string||[]).filter(Boolean).forEach(function(l){d.strings[l]=!0,d.keys.push(l)}),[].concat(n.number||[]).filter(Boolean).forEach(function(l){d.numbers[l]=!0,d.keys.push(l)}),[].concat(n.count||[]).filter(Boolean).forEach(function(l){d.counts[l]=!0,d.keys.push(l)}),[].concat(n.normalize||[]).filter(Boolean).forEach(function(l){d.normalize[l]=!0,d.keys.push(l)}),typeof n.narg=="object"&&Object.entries(n.narg).forEach(([l,h])=>{typeof h=="number"&&(d.nargs[l]=h,d.keys.push(l))}),typeof n.coerce=="object"&&Object.entries(n.coerce).forEach(([l,h])=>{typeof h=="function"&&(d.coercions[l]=h,d.keys.push(l))}),typeof n.config<"u"&&(Array.isArray(n.config)||typeof n.config=="string"?[].concat(n.config).filter(Boolean).forEach(function(l){d.configs[l]=!0}):typeof n.config=="object"&&Object.entries(n.config).forEach(([l,h])=>{(typeof h=="boolean"||typeof h=="function")&&(d.configs[l]=h)})),Dt(n.key,a,n.default,d.arrays),Object.keys(g).forEach(function(l){(d.aliases[l]||[]).forEach(function(h){g[h]=g[l]})});let T=null;fe();let U=[],B=Object.assign(Object.create(null),{_:[]}),At={};for(let l=0;l<i.length;l++){let h=i[l],O=h.replace(/^-{3,}/,"---"),b,f,S,x,$,it;if(h!=="--"&&/^-/.test(h)&&J(h))gt(h);else if(O.match(/^---+(=|$)/)){gt(h);continue}else if(h.match(/^--.+=/)||!c["short-option-groups"]&&h.match(/^-.+=/))x=h.match(/^--?([^=]+)=([\s\S]*)$/),x!==null&&Array.isArray(x)&&x.length>=3&&(F(x[1],d.arrays)?l=Ft(l,x[1],i,x[2]):F(x[1],d.nargs)!==!1?l=Jt(l,x[1],i,x[2]):G(x[1],x[2],!0));else if(h.match(z)&&c["boolean-negation"])x=h.match(z),x!==null&&Array.isArray(x)&&x.length>=2&&(f=x[1],G(f,F(f,d.arrays)?[!1]:!1));else if(h.match(/^--.+/)||!c["short-option-groups"]&&h.match(/^-[^-]+/))x=h.match(/^--?(.+)/),x!==null&&Array.isArray(x)&&x.length>=2&&(f=x[1],F(f,d.arrays)?l=Ft(l,f,i):F(f,d.nargs)!==!1?l=Jt(l,f,i):($=i[l+1],$!==void 0&&(!$.match(/^-/)||$.match(D))&&!F(f,d.bools)&&!F(f,d.counts)||/^(true|false)$/.test($)?(G(f,$),l++):G(f,Z(f))));else if(h.match(/^-.\..+=/))x=h.match(/^-([^=]+)=([\s\S]*)$/),x!==null&&Array.isArray(x)&&x.length>=3&&G(x[1],x[2]);else if(h.match(/^-.\..+/)&&!h.match(D))$=i[l+1],x=h.match(/^-(.\..+)/),x!==null&&Array.isArray(x)&&x.length>=2&&(f=x[1],$!==void 0&&!$.match(/^-/)&&!F(f,d.bools)&&!F(f,d.counts)?(G(f,$),l++):G(f,Z(f)));else if(h.match(/^-[^-]+/)&&!h.match(D)){S=h.slice(1,-1).split(""),b=!1;for(let rt=0;rt<S.length;rt++){if($=h.slice(rt+2),S[rt+1]&&S[rt+1]==="="){it=h.slice(rt+3),f=S[rt],F(f,d.arrays)?l=Ft(l,f,i,it):F(f,d.nargs)!==!1?l=Jt(l,f,i,it):G(f,it),b=!0;break}if($==="-"){G(S[rt],$);continue}if(/[A-Za-z]/.test(S[rt])&&/^-?\d+(\.\d*)?(e-?\d+)?$/.test($)&&F($,d.bools)===!1){G(S[rt],$),b=!0;break}if(S[rt+1]&&S[rt+1].match(/\W/)){G(S[rt],$),b=!0;break}else G(S[rt],Z(S[rt]))}f=h.slice(-1)[0],!b&&f!=="-"&&(F(f,d.arrays)?l=Ft(l,f,i):F(f,d.nargs)!==!1?l=Jt(l,f,i):($=i[l+1],$!==void 0&&(!/^(-|--)[^-]/.test($)||$.match(D))&&!F(f,d.bools)&&!F(f,d.counts)||/^(true|false)$/.test($)?(G(f,$),l++):G(f,Z(f))))}else if(h.match(/^-[0-9]$/)&&h.match(D)&&F(h.slice(1),d.bools))f=h.slice(1),G(f,Z(f));else if(h==="--"){U=i.slice(l+1);break}else if(c["halt-at-non-option"]){U=i.slice(l);break}else gt(h)}H(B,!0),H(B,!1),L(B),et(),Q(B,d.aliases,g,!0),nt(B),c["set-placeholder-key"]&&Nt(B),Object.keys(d.counts).forEach(function(l){xt(B,l.split("."))||G(l,0)}),u&&U.length&&(B[m]=[]),U.forEach(function(l){B[m].push(l)}),c["camel-case-expansion"]&&c["strip-dashed"]&&Object.keys(B).filter(l=>l!=="--"&&l.includes("-")).forEach(l=>{delete B[l]}),c["strip-aliased"]&&[].concat(...Object.keys(a).map(l=>a[l])).forEach(l=>{c["camel-case-expansion"]&&l.includes("-")&&delete B[l.split(".").map(h=>Lt(h)).join(".")],delete B[l]});function gt(l){let h=P("_",l);(typeof h=="string"||typeof h=="number")&&B._.push(h)}function Jt(l,h,O,b){let f,S=F(h,d.nargs);if(S=typeof S!="number"||isNaN(S)?1:S,S===0)return wt(b)||(T=Error(_("Argument unexpected for: %s",h))),G(h,Z(h)),l;let x=wt(b)?0:1;if(c["nargs-eats-options"])O.length-(l+1)+x<S&&(T=Error(_("Not enough arguments following: %s",h))),x=S;else{for(f=l+1;f<O.length&&(!O[f].match(/^-[^0-9]/)||O[f].match(D)||J(O[f]));f++)x++;x<S&&(T=Error(_("Not enough arguments following: %s",h)))}let $=Math.min(x,S);for(!wt(b)&&$>0&&(G(h,b),$--),f=l+1;f<$+l+1;f++)G(h,O[f]);return l+$}function Ft(l,h,O,b){let f=[],S=b||O[l+1],x=F(h,d.nargs);if(F(h,d.bools)&&!/^(true|false)$/.test(S))f.push(!0);else if(wt(S)||wt(b)&&/^-/.test(S)&&!D.test(S)&&!J(S)){if(g[h]!==void 0){let $=g[h];f=Array.isArray($)?$:[$]}}else{wt(b)||f.push(C(h,b,!0));for(let $=l+1;$<O.length&&!(!c["greedy-arrays"]&&f.length>0||x&&typeof x=="number"&&f.length>=x||(S=O[$],/^-/.test(S)&&!D.test(S)&&!J(S)));$++)l=$,f.push(C(h,S,r))}return typeof x=="number"&&(x&&f.length<x||isNaN(x)&&f.length===0)&&(T=Error(_("Not enough arguments following: %s",h))),G(h,f),l}function G(l,h,O=r){if(/-/.test(l)&&c["camel-case-expansion"]){let S=l.split(".").map(function(x){return Lt(x)}).join(".");I(l,S)}let b=C(l,h,O),f=l.split(".");Et(B,f,b),d.aliases[l]&&d.aliases[l].forEach(function(S){let x=S.split(".");Et(B,x,b)}),f.length>1&&c["dot-notation"]&&(d.aliases[f[0]]||[]).forEach(function(S){let x=S.split("."),$=[].concat(f);$.shift(),x=x.concat($),(d.aliases[l]||[]).includes(x.join("."))||Et(B,x,b)}),F(l,d.normalize)&&!F(l,d.arrays)&&[l].concat(d.aliases[l]||[]).forEach(function(x){Object.defineProperty(At,x,{enumerable:!0,get(){return h},set($){h=typeof $=="string"?jt.normalize($):$}})})}function I(l,h){d.aliases[l]&&d.aliases[l].length||(d.aliases[l]=[h],y[h]=!0),d.aliases[h]&&d.aliases[h].length||I(h,l)}function C(l,h,O){O&&(h=zi(h)),(F(l,d.bools)||F(l,d.counts))&&typeof h=="string"&&(h=h==="true");let b=Array.isArray(h)?h.map(function(f){return P(l,f)}):P(l,h);return F(l,d.counts)&&(wt(b)||typeof b=="boolean")&&(b=De()),F(l,d.normalize)&&F(l,d.arrays)&&(Array.isArray(h)?b=h.map(f=>jt.normalize(f)):b=jt.normalize(h)),b}function P(l,h){return!c["parse-positional-numbers"]&&l==="_"||!F(l,d.strings)&&!F(l,d.bools)&&!Array.isArray(h)&&(ge(h)&&c["parse-numbers"]&&Number.isSafeInteger(Math.floor(parseFloat(`${h}`)))||!wt(h)&&F(l,d.numbers))&&(h=Number(h)),h}function L(l){let h=Object.create(null);Q(h,d.aliases,g),Object.keys(d.configs).forEach(function(O){let b=l[O]||h[O];if(b)try{let f=null,S=jt.resolve(jt.cwd(),b),x=d.configs[O];if(typeof x=="function"){try{f=x(S)}catch($){f=$}if(f instanceof Error){T=f;return}}else f=jt.require(S);Y(f)}catch(f){f.name==="PermissionDenied"?T=f:l[O]&&(T=Error(_("Invalid JSON config file: %s",b)))}})}function Y(l,h){Object.keys(l).forEach(function(O){let b=l[O],f=h?h+"."+O:O;typeof b=="object"&&b!==null&&!Array.isArray(b)&&c["dot-notation"]?Y(b,f):(!xt(B,f.split("."))||F(f,d.arrays)&&c["combine-arrays"])&&G(f,b)})}function et(){typeof w<"u"&&w.forEach(function(l){Y(l)})}function H(l,h){if(typeof p>"u")return;let O=typeof p=="string"?p:"",b=jt.env();Object.keys(b).forEach(function(f){if(O===""||f.lastIndexOf(O,0)===0){let S=f.split("__").map(function(x,$){return $===0&&(x=x.substring(O.length)),Lt(x)});(h&&d.configs[S.join(".")]||!h)&&!xt(l,S)&&G(S.join("."),b[f])}})}function nt(l){let h,O=new Set;Object.keys(l).forEach(function(b){if(!O.has(b)&&(h=F(b,d.coercions),typeof h=="function"))try{let f=P(b,h(l[b]));[].concat(d.aliases[b]||[],b).forEach(S=>{O.add(S),l[S]=f})}catch(f){T=f}})}function Nt(l){return d.keys.forEach(h=>{~h.indexOf(".")||typeof l[h]>"u"&&(l[h]=void 0)}),l}function Q(l,h,O,b=!1){Object.keys(O).forEach(function(f){xt(l,f.split("."))||(Et(l,f.split("."),O[f]),b&&(E[f]=!0),(h[f]||[]).forEach(function(S){xt(l,S.split("."))||Et(l,S.split("."),O[f])}))})}function xt(l,h){let O=l;c["dot-notation"]||(h=[h.join(".")]),h.slice(0,-1).forEach(function(f){O=O[f]||{}});let b=h[h.length-1];return typeof O!="object"?!1:b in O}function Et(l,h,O){let b=l;c["dot-notation"]||(h=[h.join(".")]),h.slice(0,-1).forEach(function(it){it=xn(it),typeof b=="object"&&b[it]===void 0&&(b[it]={}),typeof b[it]!="object"||Array.isArray(b[it])?(Array.isArray(b[it])?b[it].push({}):b[it]=[b[it],{}],b=b[it][b[it].length-1]):b=b[it]});let f=xn(h[h.length-1]),S=F(h.join("."),d.arrays),x=Array.isArray(O),$=c["duplicate-arguments-array"];!$&&F(f,d.nargs)&&($=!0,(!wt(b[f])&&d.nargs[f]===1||Array.isArray(b[f])&&b[f].length===d.nargs[f])&&(b[f]=void 0)),O===De()?b[f]=De(b[f]):Array.isArray(b[f])?$&&S&&x?b[f]=c["flatten-duplicate-arrays"]?b[f].concat(O):(Array.isArray(b[f][0])?b[f]:[b[f]]).concat([O]):!$&&!!S==!!x?b[f]=O:b[f]=b[f].concat([O]):b[f]===void 0&&S?b[f]=x?O:[O]:$&&!(b[f]===void 0||F(f,d.counts)||F(f,d.bools))?b[f]=[b[f],O]:b[f]=O}function Dt(...l){l.forEach(function(h){Object.keys(h||{}).forEach(function(O){d.aliases[O]||(d.aliases[O]=[].concat(a[O]||[]),d.aliases[O].concat(O).forEach(function(b){if(/-/.test(b)&&c["camel-case-expansion"]){let f=Lt(b);f!==O&&d.aliases[O].indexOf(f)===-1&&(d.aliases[O].push(f),y[f]=!0)}}),d.aliases[O].concat(O).forEach(function(b){if(b.length>1&&/[A-Z]/.test(b)&&c["camel-case-expansion"]){let f=me(b,"-");f!==O&&d.aliases[O].indexOf(f)===-1&&(d.aliases[O].push(f),y[f]=!0)}}),d.aliases[O].forEach(function(b){d.aliases[b]=[O].concat(d.aliases[O].filter(function(f){return b!==f}))}))})})}function F(l,h){let O=[].concat(d.aliases[l]||[],l),b=Object.keys(h),f=O.find(S=>b.includes(S));return f?h[f]:!1}function Me(l){let h=Object.keys(d);return[].concat(h.map(b=>d[b])).some(function(b){return Array.isArray(b)?b.includes(l):b[l]})}function v(l,...h){return[].concat(...h).some(function(b){let f=l.match(b);return f&&Me(f[1])})}function K(l){if(l.match(D)||!l.match(/^-[^-]+/))return!1;let h=!0,O,b=l.slice(1).split("");for(let f=0;f<b.length;f++){if(O=l.slice(f+2),!Me(b[f])){h=!1;break}if(b[f+1]&&b[f+1]==="="||O==="-"||/[A-Za-z]/.test(b[f])&&/^-?\d+(\.\d*)?(e-?\d+)?$/.test(O)||b[f+1]&&b[f+1].match(/\W/))break}return h}function J(l){return c["unknown-options-as-args"]&&R(l)}function R(l){return l=l.replace(/^-{3,}/,"--"),l.match(D)||K(l)?!1:!v(l,/^-+([^=]+?)=[\s\S]*$/,z,/^-+([^=]+?)$/,/^-+([^=]+?)-$/,/^-+([^=]+?\d+)$/,/^-+([^=]+?)\W+.*$/)}function Z(l){return!F(l,d.bools)&&!F(l,d.counts)&&`${l}`in g?g[l]:k(bt(l))}function k(l){return{[ht.BOOLEAN]:!0,[ht.STRING]:"",[ht.NUMBER]:void 0,[ht.ARRAY]:[]}[l]}function bt(l){let h=ht.BOOLEAN;return F(l,d.strings)?h=ht.STRING:F(l,d.numbers)?h=ht.NUMBER:F(l,d.bools)?h=ht.BOOLEAN:F(l,d.arrays)&&(h=ht.ARRAY),h}function wt(l){return l===void 0}function fe(){Object.keys(d.counts).find(l=>F(l,d.arrays)?(T=Error(_("Invalid configuration: %s, opts.count excludes opts.array.",l)),!0):F(l,d.nargs)?(T=Error(_("Invalid configuration: %s, opts.count excludes opts.narg.",l)),!0):!1)}return{aliases:Object.assign({},d.aliases),argv:Object.assign(At,B),configuration:c,defaulted:Object.assign({},E),error:T,newAliases:Object.assign({},y)}}};function Li(s){let t=[],e=Object.create(null),n=!0;for(Object.keys(s).forEach(function(i){t.push([].concat(s[i],i))});n;){n=!1;for(let i=0;i<t.length;i++)for(let r=i+1;r<t.length;r++)if(t[i].filter(function(c){return t[r].indexOf(c)!==-1}).length){t[i]=t[i].concat(t[r]),t.splice(r,1),n=!0;break}}return t.forEach(function(i){i=i.filter(function(a,c,g){return g.indexOf(a)===c});let r=i.pop();r!==void 0&&typeof r=="string"&&(e[r]=i)}),e}function De(s){return s!==void 0?s+1:1}function xn(s){return s==="__proto__"?"___proto___":s}function zi(s){return typeof s=="string"&&(s[0]==="'"||s[0]==='"')&&s[s.length-1]===s[0]?s.substring(1,s.length-1):s}import{readFileSync as Hi}from"fs";var We,Le,ze,En=process&&process.env&&process.env.YARGS_MIN_NODE_VERSION?Number(process.env.YARGS_MIN_NODE_VERSION):12,jn=(Le=(We=process==null?void 0:process.versions)===null||We===void 0?void 0:We.node)!==null&&Le!==void 0?Le:(ze=process==null?void 0:process.version)===null||ze===void 0?void 0:ze.slice(1);if(jn&&Number(jn.match(/^([^.]+)/)[1])<En)throw Error(`yargs parser supports a minimum Node.js version of ${En}. Read our version support policy: https://github.com/yargs/yargs-parser#supported-nodejs-versions`);var Yi=process?process.env:{},An=new be({cwd:process.cwd,env:()=>Yi,format:Ri,normalize:Ui,resolve:Ti,require:s=>{if(typeof Ot<"u")return Ot(s);if(s.match(/\.json$/))return JSON.parse(Hi(s,"utf8"));throw Error("only .json config files are supported in ESM")}}),se=function(t,e){return An.parse(t.slice(),e).argv};se.detailed=function(s,t){return An.parse(s.slice(),t)};se.camelCase=Lt;se.decamelize=me;se.looksLikeNumber=ge;var Re=se;import{basename as is,dirname as ss,extname as rs,relative as os,resolve as vn}from"path";function Pn(){return Bi()?0:1}function Bi(){return Gi()&&!process.defaultApp}function Gi(){return!!process.versions.electron}function Ue(s){return s.slice(Pn()+1)}function Sn(){return process.argv[Pn()]}var V=class s extends Error{constructor(t){super(t||"yargs error"),this.name="YError",Error.captureStackTrace&&Error.captureStackTrace(this,s)}};import{readFileSync as Vi,statSync as qi,writeFile as Ki}from"fs";import{format as Qi}from"util";import{resolve as Ji}from"path";var In={fs:{readFileSync:Vi,writeFile:Ki},format:Qi,resolve:Ji,exists:s=>{try{return qi(s).isFile()}catch{return!1}}};var yt,Te=class{constructor(t){t=t||{},this.directory=t.directory||"./locales",this.updateFiles=typeof t.updateFiles=="boolean"?t.updateFiles:!0,this.locale=t.locale||"en",this.fallbackToLanguage=typeof t.fallbackToLanguage=="boolean"?t.fallbackToLanguage:!0,this.cache=Object.create(null),this.writeQueue=[]}__(...t){if(typeof arguments[0]!="string")return this._taggedLiteral(arguments[0],...arguments);let e=t.shift(),n=function(){};return typeof t[t.length-1]=="function"&&(n=t.pop()),n=n||function(){},this.cache[this.locale]||this._readLocaleFile(),!this.cache[this.locale][e]&&this.updateFiles?(this.cache[this.locale][e]=e,this._enqueueWrite({directory:this.directory,locale:this.locale,cb:n})):n(),yt.format.apply(yt.format,[this.cache[this.locale][e]||e].concat(t))}__n(){let t=Array.prototype.slice.call(arguments),e=t.shift(),n=t.shift(),i=t.shift(),r=function(){};typeof t[t.length-1]=="function"&&(r=t.pop()),this.cache[this.locale]||this._readLocaleFile();let a=i===1?e:n;this.cache[this.locale][e]&&(a=this.cache[this.locale][e][i===1?"one":"other"]),!this.cache[this.locale][e]&&this.updateFiles?(this.cache[this.locale][e]={one:e,other:n},this._enqueueWrite({directory:this.directory,locale:this.locale,cb:r})):r();let c=[a];return~a.indexOf("%d")&&c.push(i),yt.format.apply(yt.format,c.concat(t))}setLocale(t){this.locale=t}getLocale(){return this.locale}updateLocale(t){this.cache[this.locale]||this._readLocaleFile();for(let e in t)Object.prototype.hasOwnProperty.call(t,e)&&(this.cache[this.locale][e]=t[e])}_taggedLiteral(t,...e){let n="";return t.forEach(function(i,r){let a=e[r+1];n+=i,typeof a<"u"&&(n+="%s")}),this.__.apply(this,[n].concat([].slice.call(e,1)))}_enqueueWrite(t){this.writeQueue.push(t),this.writeQueue.length===1&&this._processWriteQueue()}_processWriteQueue(){let t=this,e=this.writeQueue[0],n=e.directory,i=e.locale,r=e.cb,a=this._resolveLocaleFile(n,i),c=JSON.stringify(this.cache[i],null,2);yt.fs.writeFile(a,c,"utf-8",function(g){t.writeQueue.shift(),t.writeQueue.length>0&&t._processWriteQueue(),r(g)})}_readLocaleFile(){let t={},e=this._resolveLocaleFile(this.directory,this.locale);try{yt.fs.readFileSync&&(t=JSON.parse(yt.fs.readFileSync(e,"utf-8")))}catch(n){if(n instanceof SyntaxError&&(n.message="syntax error in "+e),n.code==="ENOENT")t={};else throw n}this.cache[this.locale]=t}_resolveLocaleFile(t,e){let n=yt.resolve(t,"./",e+".json");if(this.fallbackToLanguage&&!this._fileExistsSync(n)&&~e.lastIndexOf("_")){let i=yt.resolve(t,"./",e.split("_")[0]+".json");this._fileExistsSync(i)&&(n=i)}return n}_fileExistsSync(t){return yt.exists(t)}};function Mn(s,t){yt=t;let e=new Te(s);return{__:e.__.bind(e),__n:e.__n.bind(e),setLocale:e.setLocale.bind(e),getLocale:e.getLocale.bind(e),updateLocale:e.updateLocale.bind(e),locale:e.locale}}var Zi=s=>Mn(s,In),$n=Zi;var as="require is not supported by ESM",Fn="loading a directory of commands is not supported yet for ESM",re;try{re=ns(import.meta.url)}catch{re=process.cwd()}var ls=re.substring(0,re.lastIndexOf("node_modules")),He={assert:{notStrictEqual:Xi,strictEqual:ki},cliui:Ne,findUp:_n,getEnv:s=>process.env[s],inspect:ts,getCallerFile:()=>{throw new V(Fn)},getProcessArgvBin:Sn,mainFilename:ls||process.cwd(),Parser:Re,path:{basename:is,dirname:ss,extname:rs,relative:os,resolve:vn},process:{argv:()=>process.argv,cwd:process.cwd,emitWarning:(s,t)=>process.emitWarning(s,t),execPath:()=>process.execPath,exit:process.exit,nextTick:process.nextTick,stdColumns:typeof process.stdout.columns<"u"?process.stdout.columns:null},readFileSync:es,require:()=>{throw new V(as)},requireDirectory:()=>{throw new V(Fn)},stringWidth:s=>[...s].length,y18n:$n({directory:vn(re,"../../../locales"),updateFiles:!1})};function ot(s,t,e,n){e.assert.notStrictEqual(s,t,n)}function Ye(s,t){t.assert.strictEqual(typeof s,"string")}function Xt(s){return Object.keys(s)}function q(s){return!!s&&!!s.then&&typeof s.then=="function"}function Pt(s){let e=s.replace(/\s{2,}/g," ").split(/\s+(?![^[]*]|[^<]*>)/),n=/\.*[\][<>]/g,i=e.shift();if(!i)throw new Error(`No command found in: ${s}`);let r={cmd:i.replace(n,""),demanded:[],optional:[]};return e.forEach((a,c)=>{let g=!1;a=a.replace(/\s/g,""),/\.+[\]>]/.test(a)&&c===e.length-1&&(g=!0),/^\[/.test(a)?r.optional.push({cmd:a.replace(n,"").split("|"),variadic:g}):r.demanded.push({cmd:a.replace(n,"").split("|"),variadic:g})}),r}var cs=["first","second","third","fourth","fifth","sixth"];function j(s,t,e){function n(){return typeof s=="object"?[{demanded:[],optional:[]},s,t]:[Pt(`cmd ${s}`),t,e]}try{let i=0,[r,a,c]=n(),g=[].slice.call(a);for(;g.length&&g[g.length-1]===void 0;)g.pop();let w=c||g.length;if(w<r.demanded.length)throw new V(`Not enough arguments provided. Expected ${r.demanded.length} but received ${g.length}.`);let p=r.demanded.length+r.optional.length;if(w>p)throw new V(`Too many arguments provided. Expected max ${p} but received ${w}.`);r.demanded.forEach(u=>{let m=g.shift(),y=Nn(m);u.cmd.filter(_=>_===y||_==="*").length===0&&Dn(y,u.cmd,i),i+=1}),r.optional.forEach(u=>{if(g.length===0)return;let m=g.shift(),y=Nn(m);u.cmd.filter(_=>_===y||_==="*").length===0&&Dn(y,u.cmd,i),i+=1})}catch(i){console.warn(i.stack)}}function Nn(s){return Array.isArray(s)?"array":s===null?"null":typeof s}function Dn(s,t,e){throw new V(`Invalid ${cs[e]||"manyith"} argument. Expected ${t.join(" or ")} but received ${s}.`)}var we=class{constructor(t){this.globalMiddleware=[],this.frozens=[],this.yargs=t}addMiddleware(t,e,n=!0,i=!1){if(j("<array|function> [boolean] [boolean] [boolean]",[t,e,n],arguments.length),Array.isArray(t)){for(let r=0;r<t.length;r++){if(typeof t[r]!="function")throw Error("middleware must be a function");let a=t[r];a.applyBeforeValidation=e,a.global=n}Array.prototype.push.apply(this.globalMiddleware,t)}else if(typeof t=="function"){let r=t;r.applyBeforeValidation=e,r.global=n,r.mutates=i,this.globalMiddleware.push(t)}return this.yargs}addCoerceMiddleware(t,e){let n=this.yargs.getAliases();return this.globalMiddleware=this.globalMiddleware.filter(i=>{let r=[...n[e]||[],e];return i.option?!r.includes(i.option):!0}),t.option=e,this.addMiddleware(t,!0,!0,!0)}getMiddleware(){return this.globalMiddleware}freeze(){this.frozens.push([...this.globalMiddleware])}unfreeze(){let t=this.frozens.pop();t!==void 0&&(this.globalMiddleware=t)}reset(){this.globalMiddleware=this.globalMiddleware.filter(t=>t.global)}};function Wn(s){return s?s.map(t=>(t.applyBeforeValidation=!1,t)):[]}function zt(s,t,e,n){return e.reduce((i,r)=>{if(r.applyBeforeValidation!==n)return i;if(r.mutates){if(r.applied)return i;r.applied=!0}if(q(i))return i.then(a=>Promise.all([a,r(a,t)])).then(([a,c])=>Object.assign(a,c));{let a=r(i,t);return q(a)?a.then(c=>Object.assign(i,c)):Object.assign(i,a)}},s)}function Rt(s,t,e=n=>{throw n}){try{let n=fs(s)?s():s;return q(n)?n.then(i=>t(i)):t(n)}catch(n){return e(n)}}function fs(s){return typeof s=="function"}function Be(s){if(typeof Ot>"u")return null;for(let t=0,e=Object.keys(Ot.cache),n;t<e.length;t++)if(n=Ot.cache[e[t]],n.exports===s)return n;return null}var kt=/(^\*)|(^\$0)/,Ge=class{constructor(t,e,n,i){this.requireCache=new Set,this.handlers={},this.aliasMap={},this.frozens=[],this.shim=i,this.usage=t,this.globalMiddleware=n,this.validation=e}addDirectory(t,e,n,i){i=i||{},typeof i.recurse!="boolean"&&(i.recurse=!1),Array.isArray(i.extensions)||(i.extensions=["js"]);let r=typeof i.visit=="function"?i.visit:a=>a;i.visit=(a,c,g)=>{let w=r(a,c,g);if(w){if(this.requireCache.has(c))return w;this.requireCache.add(c),this.addHandler(w)}return w},this.shim.requireDirectory({require:e,filename:n},t,i)}addHandler(t,e,n,i,r,a){let c=[],g=Wn(r);if(i=i||(()=>{}),Array.isArray(t))if(hs(t))[t,...c]=t;else for(let w of t)this.addHandler(w);else if(ds(t)){let w=Array.isArray(t.command)||typeof t.command=="string"?t.command:this.moduleName(t);t.aliases&&(w=[].concat(w).concat(t.aliases)),this.addHandler(w,this.extractDesc(t),t.builder,t.handler,t.middlewares,t.deprecated);return}else if(Ln(n)){this.addHandler([t].concat(c),e,n.builder,n.handler,n.middlewares,n.deprecated);return}if(typeof t=="string"){let w=Pt(t);c=c.map(m=>Pt(m).cmd);let p=!1,u=[w.cmd].concat(c).filter(m=>kt.test(m)?(p=!0,!1):!0);u.length===0&&p&&u.push("$0"),p&&(w.cmd=u[0],c=u.slice(1),t=t.replace(kt,w.cmd)),c.forEach(m=>{this.aliasMap[m]=w.cmd}),e!==!1&&this.usage.command(t,e,p,c,a),this.handlers[w.cmd]={original:t,description:e,handler:i,builder:n||{},middlewares:g,deprecated:a,demanded:w.demanded,optional:w.optional},p&&(this.defaultCommand=this.handlers[w.cmd])}}getCommandHandlers(){return this.handlers}getCommands(){return Object.keys(this.handlers).concat(Object.keys(this.aliasMap))}hasDefaultCommand(){return!!this.defaultCommand}runCommand(t,e,n,i,r,a){let c=this.handlers[t]||this.handlers[this.aliasMap[t]]||this.defaultCommand,g=e.getInternalMethods().getContext(),w=g.commands.slice(),p=!t;t&&(g.commands.push(t),g.fullCommands.push(c.original));let u=this.applyBuilderUpdateUsageAndParse(p,c,e,n.aliases,w,i,r,a);return q(u)?u.then(m=>this.applyMiddlewareAndGetResult(p,c,m.innerArgv,g,r,m.aliases,e)):this.applyMiddlewareAndGetResult(p,c,u.innerArgv,g,r,u.aliases,e)}applyBuilderUpdateUsageAndParse(t,e,n,i,r,a,c,g){let w=e.builder,p=n;if(ye(w)){n.getInternalMethods().getUsageInstance().freeze();let u=w(n.getInternalMethods().reset(i),g);if(q(u))return u.then(m=>(p=Rn(m)?m:n,this.parseAndUpdateUsage(t,e,p,r,a,c)))}else us(w)&&(n.getInternalMethods().getUsageInstance().freeze(),p=n.getInternalMethods().reset(i),Object.keys(e.builder).forEach(u=>{p.option(u,w[u])}));return this.parseAndUpdateUsage(t,e,p,r,a,c)}parseAndUpdateUsage(t,e,n,i,r,a){t&&n.getInternalMethods().getUsageInstance().unfreeze(!0),this.shouldUpdateUsage(n)&&n.getInternalMethods().getUsageInstance().usage(this.usageFromParentCommandsCommandHandler(i,e),e.description);let c=n.getInternalMethods().runYargsParserAndExecuteCommands(null,void 0,!0,r,a);return q(c)?c.then(g=>({aliases:n.parsed.aliases,innerArgv:g})):{aliases:n.parsed.aliases,innerArgv:c}}shouldUpdateUsage(t){return!t.getInternalMethods().getUsageInstance().getUsageDisabled()&&t.getInternalMethods().getUsageInstance().getUsage().length===0}usageFromParentCommandsCommandHandler(t,e){let n=kt.test(e.original)?e.original.replace(kt,"").trim():e.original,i=t.filter(r=>!kt.test(r));return i.push(n),`$0 ${i.join(" ")}`}handleValidationAndGetResult(t,e,n,i,r,a,c,g){if(!a.getInternalMethods().getHasOutput()){let w=a.getInternalMethods().runValidation(r,g,a.parsed.error,t);n=Rt(n,p=>(w(p),p))}if(e.handler&&!a.getInternalMethods().getHasOutput()){a.getInternalMethods().setHasOutput();let w=!!a.getOptions().configuration["populate--"];a.getInternalMethods().postProcess(n,w,!1,!1),n=zt(n,a,c,!1),n=Rt(n,p=>{let u=e.handler(p);return q(u)?u.then(()=>p):p}),t||a.getInternalMethods().getUsageInstance().cacheHelpMessage(),q(n)&&!a.getInternalMethods().hasParseCallback()&&n.catch(p=>{try{a.getInternalMethods().getUsageInstance().fail(null,p)}catch{}})}return t||(i.commands.pop(),i.fullCommands.pop()),n}applyMiddlewareAndGetResult(t,e,n,i,r,a,c){let g={};if(r)return n;c.getInternalMethods().getHasOutput()||(g=this.populatePositionals(e,n,i,c));let w=this.globalMiddleware.getMiddleware().slice(0).concat(e.middlewares),p=zt(n,c,w,!0);return q(p)?p.then(u=>this.handleValidationAndGetResult(t,e,u,i,a,c,w,g)):this.handleValidationAndGetResult(t,e,p,i,a,c,w,g)}populatePositionals(t,e,n,i){e._=e._.slice(n.commands.length);let r=t.demanded.slice(0),a=t.optional.slice(0),c={};for(this.validation.positionalCount(r.length,e._.length);r.length;){let g=r.shift();this.populatePositional(g,e,c)}for(;a.length;){let g=a.shift();this.populatePositional(g,e,c)}return e._=n.commands.concat(e._.map(g=>""+g)),this.postProcessPositionals(e,c,this.cmdToParseOptions(t.original),i),c}populatePositional(t,e,n){let i=t.cmd[0];t.variadic?n[i]=e._.splice(0).map(String):e._.length&&(n[i]=[String(e._.shift())])}cmdToParseOptions(t){let e={array:[],default:{},alias:{},demand:{}},n=Pt(t);return n.demanded.forEach(i=>{let[r,...a]=i.cmd;i.variadic&&(e.array.push(r),e.default[r]=[]),e.alias[r]=a,e.demand[r]=!0}),n.optional.forEach(i=>{let[r,...a]=i.cmd;i.variadic&&(e.array.push(r),e.default[r]=[]),e.alias[r]=a}),e}postProcessPositionals(t,e,n,i){let r=Object.assign({},i.getOptions());r.default=Object.assign(n.default,r.default);for(let w of Object.keys(n.alias))r.alias[w]=(r.alias[w]||[]).concat(n.alias[w]);r.array=r.array.concat(n.array),r.config={};let a=[];if(Object.keys(e).forEach(w=>{e[w].map(p=>{r.configuration["unknown-options-as-args"]&&(r.key[w]=!0),a.push(`--${w}`),a.push(p)})}),!a.length)return;let c=Object.assign({},r.configuration,{"populate--":!1}),g=this.shim.Parser.detailed(a,Object.assign({},r,{configuration:c}));if(g.error)i.getInternalMethods().getUsageInstance().fail(g.error.message,g.error);else{let w=Object.keys(e);Object.keys(e).forEach(p=>{w.push(...g.aliases[p])}),Object.keys(g.argv).forEach(p=>{w.includes(p)&&(e[p]||(e[p]=g.argv[p]),!this.isInConfigs(i,p)&&!this.isDefaulted(i,p)&&Object.prototype.hasOwnProperty.call(t,p)&&Object.prototype.hasOwnProperty.call(g.argv,p)&&(Array.isArray(t[p])||Array.isArray(g.argv[p]))?t[p]=[].concat(t[p],g.argv[p]):t[p]=g.argv[p])})}}isDefaulted(t,e){let{default:n}=t.getOptions();return Object.prototype.hasOwnProperty.call(n,e)||Object.prototype.hasOwnProperty.call(n,this.shim.Parser.camelCase(e))}isInConfigs(t,e){let{configObjects:n}=t.getOptions();return n.some(i=>Object.prototype.hasOwnProperty.call(i,e))||n.some(i=>Object.prototype.hasOwnProperty.call(i,this.shim.Parser.camelCase(e)))}runDefaultBuilderOn(t){if(!this.defaultCommand)return;if(this.shouldUpdateUsage(t)){let n=kt.test(this.defaultCommand.original)?this.defaultCommand.original:this.defaultCommand.original.replace(/^[^[\]<>]*/,"$0 ");t.getInternalMethods().getUsageInstance().usage(n,this.defaultCommand.description)}let e=this.defaultCommand.builder;if(ye(e))return e(t,!0);Ln(e)||Object.keys(e).forEach(n=>{t.option(n,e[n])})}moduleName(t){let e=Be(t);if(!e)throw new Error(`No command name given for module: ${this.shim.inspect(t)}`);return this.commandFromFilename(e.filename)}commandFromFilename(t){return this.shim.path.basename(t,this.shim.path.extname(t))}extractDesc({describe:t,description:e,desc:n}){for(let i of[t,e,n]){if(typeof i=="string"||i===!1)return i;ot(i,!0,this.shim)}return!1}freeze(){this.frozens.push({handlers:this.handlers,aliasMap:this.aliasMap,defaultCommand:this.defaultCommand})}unfreeze(){let t=this.frozens.pop();ot(t,void 0,this.shim),{handlers:this.handlers,aliasMap:this.aliasMap,defaultCommand:this.defaultCommand}=t}reset(){return this.handlers={},this.aliasMap={},this.defaultCommand=void 0,this.requireCache=new Set,this}};function zn(s,t,e,n){return new Ge(s,t,e,n)}function Ln(s){return typeof s=="object"&&!!s.builder&&typeof s.handler=="function"}function hs(s){return s.every(t=>typeof t=="string")}function ye(s){return typeof s=="function"}function us(s){return typeof s=="object"}function ds(s){return typeof s=="object"&&!Array.isArray(s)}function St(s={},t=()=>!0){let e={};return Xt(s).forEach(n=>{t(n,s[n])&&(e[n]=s[n])}),e}function It(s){typeof process>"u"||[process.stdout,process.stderr].forEach(t=>{let e=t;e._handle&&e.isTTY&&typeof e._handle.setBlocking=="function"&&e._handle.setBlocking(s)})}function ps(s){return typeof s=="boolean"}function Tn(s,t){let e=t.y18n.__,n={},i=[];n.failFn=function(C){i.push(C)};let r=null,a=null,c=!0;n.showHelpOnFail=function(C=!0,P){let[L,Y]=typeof C=="string"?[!0,C]:[C,P];return s.getInternalMethods().isGlobalContext()&&(a=Y),r=Y,c=L,n};let g=!1;n.fail=function(C,P){let L=s.getInternalMethods().getLoggerInstance();if(i.length)for(let Y=i.length-1;Y>=0;--Y){let et=i[Y];if(ps(et)){if(P)throw P;if(C)throw Error(C)}else et(C,P,n)}else{if(s.getExitProcess()&&It(!0),!g){g=!0,c&&(s.showHelp("error"),L.error()),(C||P)&&L.error(C||P);let Y=r||a;Y&&((C||P)&&L.error(""),L.error(Y))}if(P=P||new V(C),s.getExitProcess())return s.exit(1);if(s.getInternalMethods().hasParseCallback())return s.exit(1,P);throw P}};let w=[],p=!1;n.usage=(I,C)=>I===null?(p=!0,w=[],n):(p=!1,w.push([I,C||""]),n),n.getUsage=()=>w,n.getUsageDisabled=()=>p,n.getPositionalGroupName=()=>e("Positionals:");let u=[];n.example=(I,C)=>{u.push([I,C||""])};let m=[];n.command=function(C,P,L,Y,et=!1){L&&(m=m.map(H=>(H[2]=!1,H))),m.push([C,P||"",L,Y,et])},n.getCommands=()=>m;let y={};n.describe=function(C,P){Array.isArray(C)?C.forEach(L=>{n.describe(L,P)}):typeof C=="object"?Object.keys(C).forEach(L=>{n.describe(L,C[L])}):y[C]=P},n.getDescriptions=()=>y;let E=[];n.epilog=I=>{E.push(I)};let _=!1,d;n.wrap=I=>{_=!0,d=I},n.getWrap=()=>t.getEnv("YARGS_DISABLE_WRAP")?null:(_||(d=Jt(),_=!0),d);let D="__yargsString__:";n.deferY18nLookup=I=>D+I,n.help=function(){if(U)return U;T();let C=s.customScriptName?s.$0:t.path.basename(s.$0),P=s.getDemandedOptions(),L=s.getDemandedCommands(),Y=s.getDeprecatedOptions(),et=s.getGroups(),H=s.getOptions(),nt=[];nt=nt.concat(Object.keys(y)),nt=nt.concat(Object.keys(P)),nt=nt.concat(Object.keys(L)),nt=nt.concat(Object.keys(H.default)),nt=nt.filter(At),nt=Object.keys(nt.reduce((v,K)=>(K!=="_"&&(v[K]=!0),v),{}));let Nt=n.getWrap(),Q=t.cliui({width:Nt,wrap:!!Nt});if(!p){if(w.length)w.forEach(v=>{Q.div({text:`${v[0].replace(/\$0/g,C)}`}),v[1]&&Q.div({text:`${v[1]}`,padding:[1,0,0,0]})}),Q.div();else if(m.length){let v=null;L._?v=`${C} <${e("command")}>
|
|
8
8
|
`:v=`${C} [${e("command")}]
|
|
9
|
-
`,Q.div(`${v}`)}}if(m.length>1||m.length===1&&!m[0][2]){Q.div(e("Commands:"));let v=s.getInternalMethods().getContext(),K=v.commands.length?`${v.commands.join(" ")} `:"";s.getInternalMethods().getParserConfiguration()["sort-commands"]===!0&&(m=m.sort((R,Z)=>R[0].localeCompare(Z[0])));let J=C?`${C} `:"";m.forEach(R=>{let Z=`${J}${K}${R[0].replace(/^\$0 ?/,"")}`;Q.span({text:Z,padding:[0,2,0,2],width:z(m,Nt,`${C}${K}`)+4},{text:R[1]});let k=[];R[2]&&k.push(`[${e("default")}]`),R[3]&&R[3].length&&k.push(`[${e("aliases:")} ${R[3].join(", ")}]`),R[4]&&(typeof R[4]=="string"?k.push(`[${e("deprecated: %s",R[4])}]`):k.push(`[${e("deprecated")}]`)),k.length?Q.div({text:k.join(" "),padding:[0,0,0,2],align:"right"}):Q.div()}),Q.div()}let xt=(Object.keys(H.alias)||[]).concat(Object.keys(s.parsed.newAliases)||[]);nt=nt.filter(v=>!s.parsed.newAliases[v]&&xt.every(K=>(H.alias[K]||[]).indexOf(v)===-1));let Et=e("Options:");et[Et]||(et[Et]=[]),B(nt,H.alias,et,Et);let Dt=v=>/^--/.test(Oe(v)),
|
|
9
|
+
`,Q.div(`${v}`)}}if(m.length>1||m.length===1&&!m[0][2]){Q.div(e("Commands:"));let v=s.getInternalMethods().getContext(),K=v.commands.length?`${v.commands.join(" ")} `:"";s.getInternalMethods().getParserConfiguration()["sort-commands"]===!0&&(m=m.sort((R,Z)=>R[0].localeCompare(Z[0])));let J=C?`${C} `:"";m.forEach(R=>{let Z=`${J}${K}${R[0].replace(/^\$0 ?/,"")}`;Q.span({text:Z,padding:[0,2,0,2],width:z(m,Nt,`${C}${K}`)+4},{text:R[1]});let k=[];R[2]&&k.push(`[${e("default")}]`),R[3]&&R[3].length&&k.push(`[${e("aliases:")} ${R[3].join(", ")}]`),R[4]&&(typeof R[4]=="string"?k.push(`[${e("deprecated: %s",R[4])}]`):k.push(`[${e("deprecated")}]`)),k.length?Q.div({text:k.join(" "),padding:[0,0,0,2],align:"right"}):Q.div()}),Q.div()}let xt=(Object.keys(H.alias)||[]).concat(Object.keys(s.parsed.newAliases)||[]);nt=nt.filter(v=>!s.parsed.newAliases[v]&&xt.every(K=>(H.alias[K]||[]).indexOf(v)===-1));let Et=e("Options:");et[Et]||(et[Et]=[]),B(nt,H.alias,et,Et);let Dt=v=>/^--/.test(Oe(v)),F=Object.keys(et).filter(v=>et[v].length>0).map(v=>{let K=et[v].filter(At).map(J=>{if(xt.includes(J))return J;for(let R=0,Z;(Z=xt[R])!==void 0;R++)if((H.alias[Z]||[]).includes(J))return Z;return J});return{groupName:v,normalizedKeys:K}}).filter(({normalizedKeys:v})=>v.length>0).map(({groupName:v,normalizedKeys:K})=>{let J=K.reduce((R,Z)=>(R[Z]=[Z].concat(H.alias[Z]||[]).map(k=>v===n.getPositionalGroupName()?k:(/^[0-9]$/.test(k)?H.boolean.includes(Z)?"-":"--":k.length>1?"--":"-")+k).sort((k,bt)=>Dt(k)===Dt(bt)?0:Dt(k)?1:-1).join(", "),R),{});return{groupName:v,normalizedKeys:K,switches:J}});if(F.filter(({groupName:v})=>v!==n.getPositionalGroupName()).some(({normalizedKeys:v,switches:K})=>!v.every(J=>Dt(K[J])))&&F.filter(({groupName:v})=>v!==n.getPositionalGroupName()).forEach(({normalizedKeys:v,switches:K})=>{v.forEach(J=>{Dt(K[J])&&(K[J]=ms(K[J],4))})}),F.forEach(({groupName:v,normalizedKeys:K,switches:J})=>{Q.div(v),K.forEach(R=>{let Z=J[R],k=y[R]||"",bt=null;k.includes(D)&&(k=e(k.substring(D.length))),H.boolean.includes(R)&&(bt=`[${e("boolean")}]`),H.count.includes(R)&&(bt=`[${e("count")}]`),H.string.includes(R)&&(bt=`[${e("string")}]`),H.normalize.includes(R)&&(bt=`[${e("string")}]`),H.array.includes(R)&&(bt=`[${e("array")}]`),H.number.includes(R)&&(bt=`[${e("number")}]`);let wt=h=>typeof h=="string"?`[${e("deprecated: %s",h)}]`:`[${e("deprecated")}]`,fe=[R in Y?wt(Y[R]):null,bt,R in P?`[${e("required")}]`:null,H.choices&&H.choices[R]?`[${e("choices:")} ${n.stringifiedValues(H.choices[R])}]`:null,gt(H.default[R],H.defaultDescription[R])].filter(Boolean).join(" ");Q.span({text:Oe(Z),padding:[0,2,0,2+Un(Z)],width:z(J,Nt)+4},k);let l=s.getInternalMethods().getUsageConfiguration()["hide-types"]===!0;fe&&!l?Q.div({text:fe,padding:[0,0,0,2],align:"right"}):Q.div()}),Q.div()}),u.length&&(Q.div(e("Examples:")),u.forEach(v=>{v[0]=v[0].replace(/\$0/g,C)}),u.forEach(v=>{v[1]===""?Q.div({text:v[0],padding:[0,2,0,2]}):Q.div({text:v[0],padding:[0,2,0,2],width:z(u,Nt)+4},{text:v[1]})}),Q.div()),E.length>0){let v=E.map(K=>K.replace(/\$0/g,C)).join(`
|
|
10
10
|
`);Q.div(`${v}
|
|
11
|
-
`)}return Q.toString().replace(/\s*$/,"")};function z(
|
|
11
|
+
`)}return Q.toString().replace(/\s*$/,"")};function z(I,C,P){let L=0;return Array.isArray(I)||(I=Object.values(I).map(Y=>[Y])),I.forEach(Y=>{L=Math.max(t.stringWidth(P?`${P} ${Oe(Y[0])}`:Oe(Y[0]))+Un(Y[0]),L)}),C&&(L=Math.min(L,parseInt((C*.5).toString(),10))),L}function T(){let I=s.getDemandedOptions(),C=s.getOptions();(Object.keys(C.alias)||[]).forEach(P=>{C.alias[P].forEach(L=>{y[L]&&n.describe(P,y[L]),L in I&&s.demandOption(P,I[L]),C.boolean.includes(L)&&s.boolean(P),C.count.includes(L)&&s.count(P),C.string.includes(L)&&s.string(P),C.normalize.includes(L)&&s.normalize(P),C.array.includes(L)&&s.array(P),C.number.includes(L)&&s.number(P)})})}let U;n.cacheHelpMessage=function(){U=this.help()},n.clearCachedHelpMessage=function(){U=void 0},n.hasCachedHelpMessage=function(){return!!U};function B(I,C,P,L){let Y=[],et=null;return Object.keys(P).forEach(H=>{Y=Y.concat(P[H])}),I.forEach(H=>{et=[H].concat(C[H]),et.some(nt=>Y.indexOf(nt)!==-1)||P[L].push(H)}),Y}function At(I){return s.getOptions().hiddenOptions.indexOf(I)<0||s.parsed.argv[s.getOptions().showHiddenOpt]}n.showHelp=I=>{let C=s.getInternalMethods().getLoggerInstance();I||(I="error"),(typeof I=="function"?I:C[I])(n.help())},n.functionDescription=I=>["(",I.name?t.Parser.decamelize(I.name,"-"):e("generated-value"),")"].join(""),n.stringifiedValues=function(C,P){let L="",Y=P||", ",et=[].concat(C);return!C||!et.length||et.forEach(H=>{L.length&&(L+=Y),L+=JSON.stringify(H)}),L};function gt(I,C){let P=`[${e("default:")} `;if(I===void 0&&!C)return null;if(C)P+=C;else switch(typeof I){case"string":P+=`"${I}"`;break;case"object":P+=JSON.stringify(I);break;default:P+=I}return`${P}]`}function Jt(){return t.process.stdColumns?Math.min(80,t.process.stdColumns):80}let Ft=null;n.version=I=>{Ft=I},n.showVersion=I=>{let C=s.getInternalMethods().getLoggerInstance();I||(I="error"),(typeof I=="function"?I:C[I])(Ft)},n.reset=function(C){return r=null,g=!1,w=[],p=!1,E=[],u=[],m=[],y=St(y,P=>!C[P]),n};let G=[];return n.freeze=function(){G.push({failMessage:r,failureOutput:g,usages:w,usageDisabled:p,epilogs:E,examples:u,commands:m,descriptions:y})},n.unfreeze=function(C=!1){let P=G.pop();P&&(C?(y={...P.descriptions,...y},m=[...P.commands,...m],w=[...P.usages,...w],u=[...P.examples,...u],E=[...P.epilogs,...E]):{failMessage:r,failureOutput:g,usages:w,usageDisabled:p,epilogs:E,examples:u,commands:m,descriptions:y}=P)},n}function Ve(s){return typeof s=="object"}function ms(s,t){return Ve(s)?{text:s.text,indentation:s.indentation+t}:{text:s,indentation:t}}function Un(s){return Ve(s)?s.indentation:0}function Oe(s){return Ve(s)?s.text:s}var Hn=`###-begin-{{app_name}}-completions-###
|
|
12
12
|
#
|
|
13
13
|
# yargs command completion script
|
|
14
14
|
#
|
|
@@ -55,14 +55,14 @@ _{{app_name}}_yargs_completions()
|
|
|
55
55
|
}
|
|
56
56
|
compdef _{{app_name}}_yargs_completions {{app_name}}
|
|
57
57
|
###-end-{{app_name}}-completions-###
|
|
58
|
-
`;var qe=class{constructor(t,e,n,i){var r,a,c;this.yargs=t,this.usage=e,this.command=n,this.shim=i,this.completionKey="get-yargs-completions",this.aliases=null,this.customCompletionFunction=null,this.indexAfterLastReset=0,this.zshShell=(c=((r=this.shim.getEnv("SHELL"))===null||r===void 0?void 0:r.includes("zsh"))||((a=this.shim.getEnv("ZSH_NAME"))===null||a===void 0?void 0:a.includes("zsh")))!==null&&c!==void 0?c:!1}defaultCompletion(t,e,n,i){let r=this.command.getCommandHandlers();for(let c=0,g=t.length;c<g;++c)if(r[t[c]]&&r[t[c]].builder){let w=r[t[c]].builder;if(ye(w)){this.indexAfterLastReset=c+1;let p=this.yargs.getInternalMethods().reset();return w(p,!0),p.argv}}let a=[];this.commandCompletions(a,t,n),this.optionCompletions(a,t,e,n),this.choicesFromOptionsCompletions(a,t,e,n),this.choicesFromPositionalsCompletions(a,t,e,n),i(null,a)}commandCompletions(t,e,n){let i=this.yargs.getInternalMethods().getContext().commands;!n.match(/^-/)&&i[i.length-1]!==n&&!this.previousArgHasChoices(e)&&this.usage.getCommands().forEach(r=>{let a=Pt(r[0]).cmd;if(e.indexOf(a)===-1)if(!this.zshShell)t.push(a);else{let c=r[1]||"";t.push(a.replace(/:/g,"\\:")+":"+c)}})}optionCompletions(t,e,n,i){if((i.match(/^-/)||i===""&&t.length===0)&&!this.previousArgHasChoices(e)){let r=this.yargs.getOptions(),a=this.yargs.getGroups()[this.usage.getPositionalGroupName()]||[];Object.keys(r.key).forEach(c=>{let g=!!r.configuration["boolean-negation"]&&r.boolean.includes(c);!a.includes(c)&&!r.hiddenOptions.includes(c)&&!this.argsContainKey(e,c,g)&&this.completeOptionKey(c,t,i,g&&!!r.default[c])})}}choicesFromOptionsCompletions(t,e,n,i){if(this.previousArgHasChoices(e)){let r=this.getPreviousArgChoices(e);r&&r.length>0&&t.push(...r.map(a=>a.replace(/:/g,"\\:")))}}choicesFromPositionalsCompletions(t,e,n,i){if(i===""&&t.length>0&&this.previousArgHasChoices(e))return;let r=this.yargs.getGroups()[this.usage.getPositionalGroupName()]||[],a=Math.max(this.indexAfterLastReset,this.yargs.getInternalMethods().getContext().commands.length+1),c=r[n._.length-a-1];if(!c)return;let g=this.yargs.getOptions().choices[c]||[];for(let w of g)w.startsWith(i)&&t.push(w.replace(/:/g,"\\:"))}getPreviousArgChoices(t){if(t.length<1)return;let e=t[t.length-1],n="";if(!e.startsWith("-")&&t.length>1&&(n=e,e=t[t.length-2]),!e.startsWith("-"))return;let i=e.replace(/^-+/,""),r=this.yargs.getOptions(),a=[i,...this.yargs.getAliases()[i]||[]],c;for(let g of a)if(Object.prototype.hasOwnProperty.call(r.key,g)&&Array.isArray(r.choices[g])){c=r.choices[g];break}if(c)return c.filter(g=>!n||g.startsWith(n))}previousArgHasChoices(t){let e=this.getPreviousArgChoices(t);return e!==void 0&&e.length>0}argsContainKey(t,e,n){let i=r=>t.indexOf((/^[^0-9]$/.test(r)?"-":"--")+r)!==-1;if(i(e)||n&&i(`no-${e}`))return!0;if(this.aliases){for(let r of this.aliases[e])if(i(r))return!0}return!1}completeOptionKey(t,e,n,i){var r,a,c,g;let w=t;if(this.zshShell){let y=this.usage.getDescriptions(),E=(a=(r=this===null||this===void 0?void 0:this.aliases)===null||r===void 0?void 0:r[t])===null||a===void 0?void 0:a.find(
|
|
58
|
+
`;var qe=class{constructor(t,e,n,i){var r,a,c;this.yargs=t,this.usage=e,this.command=n,this.shim=i,this.completionKey="get-yargs-completions",this.aliases=null,this.customCompletionFunction=null,this.indexAfterLastReset=0,this.zshShell=(c=((r=this.shim.getEnv("SHELL"))===null||r===void 0?void 0:r.includes("zsh"))||((a=this.shim.getEnv("ZSH_NAME"))===null||a===void 0?void 0:a.includes("zsh")))!==null&&c!==void 0?c:!1}defaultCompletion(t,e,n,i){let r=this.command.getCommandHandlers();for(let c=0,g=t.length;c<g;++c)if(r[t[c]]&&r[t[c]].builder){let w=r[t[c]].builder;if(ye(w)){this.indexAfterLastReset=c+1;let p=this.yargs.getInternalMethods().reset();return w(p,!0),p.argv}}let a=[];this.commandCompletions(a,t,n),this.optionCompletions(a,t,e,n),this.choicesFromOptionsCompletions(a,t,e,n),this.choicesFromPositionalsCompletions(a,t,e,n),i(null,a)}commandCompletions(t,e,n){let i=this.yargs.getInternalMethods().getContext().commands;!n.match(/^-/)&&i[i.length-1]!==n&&!this.previousArgHasChoices(e)&&this.usage.getCommands().forEach(r=>{let a=Pt(r[0]).cmd;if(e.indexOf(a)===-1)if(!this.zshShell)t.push(a);else{let c=r[1]||"";t.push(a.replace(/:/g,"\\:")+":"+c)}})}optionCompletions(t,e,n,i){if((i.match(/^-/)||i===""&&t.length===0)&&!this.previousArgHasChoices(e)){let r=this.yargs.getOptions(),a=this.yargs.getGroups()[this.usage.getPositionalGroupName()]||[];Object.keys(r.key).forEach(c=>{let g=!!r.configuration["boolean-negation"]&&r.boolean.includes(c);!a.includes(c)&&!r.hiddenOptions.includes(c)&&!this.argsContainKey(e,c,g)&&this.completeOptionKey(c,t,i,g&&!!r.default[c])})}}choicesFromOptionsCompletions(t,e,n,i){if(this.previousArgHasChoices(e)){let r=this.getPreviousArgChoices(e);r&&r.length>0&&t.push(...r.map(a=>a.replace(/:/g,"\\:")))}}choicesFromPositionalsCompletions(t,e,n,i){if(i===""&&t.length>0&&this.previousArgHasChoices(e))return;let r=this.yargs.getGroups()[this.usage.getPositionalGroupName()]||[],a=Math.max(this.indexAfterLastReset,this.yargs.getInternalMethods().getContext().commands.length+1),c=r[n._.length-a-1];if(!c)return;let g=this.yargs.getOptions().choices[c]||[];for(let w of g)w.startsWith(i)&&t.push(w.replace(/:/g,"\\:"))}getPreviousArgChoices(t){if(t.length<1)return;let e=t[t.length-1],n="";if(!e.startsWith("-")&&t.length>1&&(n=e,e=t[t.length-2]),!e.startsWith("-"))return;let i=e.replace(/^-+/,""),r=this.yargs.getOptions(),a=[i,...this.yargs.getAliases()[i]||[]],c;for(let g of a)if(Object.prototype.hasOwnProperty.call(r.key,g)&&Array.isArray(r.choices[g])){c=r.choices[g];break}if(c)return c.filter(g=>!n||g.startsWith(n))}previousArgHasChoices(t){let e=this.getPreviousArgChoices(t);return e!==void 0&&e.length>0}argsContainKey(t,e,n){let i=r=>t.indexOf((/^[^0-9]$/.test(r)?"-":"--")+r)!==-1;if(i(e)||n&&i(`no-${e}`))return!0;if(this.aliases){for(let r of this.aliases[e])if(i(r))return!0}return!1}completeOptionKey(t,e,n,i){var r,a,c,g;let w=t;if(this.zshShell){let y=this.usage.getDescriptions(),E=(a=(r=this===null||this===void 0?void 0:this.aliases)===null||r===void 0?void 0:r[t])===null||a===void 0?void 0:a.find(D=>{let z=y[D];return typeof z=="string"&&z.length>0}),_=E?y[E]:void 0,d=(g=(c=y[t])!==null&&c!==void 0?c:_)!==null&&g!==void 0?g:"";w=`${t.replace(/:/g,"\\:")}:${d.replace("__yargsString__:","").replace(/(\r\n|\n|\r)/gm," ")}`}let p=y=>/^--/.test(y),u=y=>/^[^0-9]$/.test(y),m=!p(n)&&u(t)?"-":"--";e.push(m+w),i&&e.push(m+"no-"+w)}customCompletion(t,e,n,i){if(ot(this.customCompletionFunction,null,this.shim),bs(this.customCompletionFunction)){let r=this.customCompletionFunction(n,e);return q(r)?r.then(a=>{this.shim.process.nextTick(()=>{i(null,a)})}).catch(a=>{this.shim.process.nextTick(()=>{i(a,void 0)})}):i(null,r)}else return ws(this.customCompletionFunction)?this.customCompletionFunction(n,e,(r=i)=>this.defaultCompletion(t,e,n,r),r=>{i(null,r)}):this.customCompletionFunction(n,e,r=>{i(null,r)})}getCompletion(t,e){let n=t.length?t[t.length-1]:"",i=this.yargs.parse(t,!0),r=this.customCompletionFunction?a=>this.customCompletion(t,a,n,e):a=>this.defaultCompletion(t,a,n,e);return q(i)?i.then(r):r(i)}generateCompletionScript(t,e){let n=this.zshShell?Yn:Hn,i=this.shim.path.basename(t);return t.match(/\.js$/)&&(t=`./${t}`),n=n.replace(/{{app_name}}/g,i),n=n.replace(/{{completion_command}}/g,e),n.replace(/{{app_path}}/g,t)}registerFunction(t){this.customCompletionFunction=t}setParsed(t){this.aliases=t.aliases}};function Bn(s,t,e,n){return new qe(s,t,e,n)}function bs(s){return s.length<3}function ws(s){return s.length>3}function Gn(s,t){if(s.length===0)return t.length;if(t.length===0)return s.length;let e=[],n;for(n=0;n<=t.length;n++)e[n]=[n];let i;for(i=0;i<=s.length;i++)e[0][i]=i;for(n=1;n<=t.length;n++)for(i=1;i<=s.length;i++)t.charAt(n-1)===s.charAt(i-1)?e[n][i]=e[n-1][i-1]:n>1&&i>1&&t.charAt(n-2)===s.charAt(i-1)&&t.charAt(n-1)===s.charAt(i-2)?e[n][i]=e[n-2][i-2]+1:e[n][i]=Math.min(e[n-1][i-1]+1,Math.min(e[n][i-1]+1,e[n-1][i]+1));return e[t.length][s.length]}var Vn=["$0","--","_"];function qn(s,t,e){let n=e.y18n.__,i=e.y18n.__n,r={};r.nonOptionCount=function(u){let m=s.getDemandedCommands(),E=u._.length+(u["--"]?u["--"].length:0)-s.getInternalMethods().getContext().commands.length;m._&&(E<m._.min||E>m._.max)&&(E<m._.min?m._.minMsg!==void 0?t.fail(m._.minMsg?m._.minMsg.replace(/\$0/g,E.toString()).replace(/\$1/,m._.min.toString()):null):t.fail(i("Not enough non-option arguments: got %s, need at least %s","Not enough non-option arguments: got %s, need at least %s",E,E.toString(),m._.min.toString())):E>m._.max&&(m._.maxMsg!==void 0?t.fail(m._.maxMsg?m._.maxMsg.replace(/\$0/g,E.toString()).replace(/\$1/,m._.max.toString()):null):t.fail(i("Too many non-option arguments: got %s, maximum of %s","Too many non-option arguments: got %s, maximum of %s",E,E.toString(),m._.max.toString()))))},r.positionalCount=function(u,m){m<u&&t.fail(i("Not enough non-option arguments: got %s, need at least %s","Not enough non-option arguments: got %s, need at least %s",m,m+"",u+""))},r.requiredArguments=function(u,m){let y=null;for(let E of Object.keys(m))(!Object.prototype.hasOwnProperty.call(u,E)||typeof u[E]>"u")&&(y=y||{},y[E]=m[E]);if(y){let E=[];for(let d of Object.keys(y)){let D=y[d];D&&E.indexOf(D)<0&&E.push(D)}let _=E.length?`
|
|
59
59
|
${E.join(`
|
|
60
|
-
`)}`:"";t.fail(i("Missing required argument: %s","Missing required arguments: %s",Object.keys(y).length,Object.keys(y).join(", ")+_))}},r.unknownArguments=function(u,m,y,E,_=!0){var d;let
|
|
61
|
-
${n("Argument: %s, Given: %s, Choices: %s",d,t.stringifiedValues(y[d]),t.stringifiedValues(m.choices[d]))}`}),t.fail(_)};let a={};r.implies=function(u,m){j("<string|object> [array|number|string]",[u,m],arguments.length),typeof u=="object"?Object.keys(u).forEach(y=>{r.implies(y,u[y])}):(s.global(u),a[u]||(a[u]=[]),Array.isArray(m)?m.forEach(y=>r.implies(u,y)):(ot(m,void 0,e),a[u].push(m)))},r.getImplied=function(){return a};function c(p,u){let m=Number(u);return u=isNaN(m)?u:m,typeof u=="number"?u=p._.length>=u:u.match(/^--no-.+/)?(u=u.match(/^--no-(.+)/)[1],u=!Object.prototype.hasOwnProperty.call(p,u)):u=Object.prototype.hasOwnProperty.call(p,u),u}r.implications=function(u){let m=[];if(Object.keys(a).forEach(y=>{let E=y;(a[y]||[]).forEach(_=>{let d=E,
|
|
62
|
-
`;m.forEach(E=>{y+=E}),t.fail(y)}};let g={};r.conflicts=function(u,m){j("<string|object> [array|string]",[u,m],arguments.length),typeof u=="object"?Object.keys(u).forEach(y=>{r.conflicts(y,u[y])}):(s.global(u),g[u]||(g[u]=[]),Array.isArray(m)?m.forEach(y=>r.conflicts(u,y)):g[u].push(m))},r.getConflicting=()=>g,r.conflicting=function(u){Object.keys(u).forEach(m=>{g[m]&&g[m].forEach(y=>{y&&u[m]!==void 0&&u[y]!==void 0&&t.fail(n("Arguments %s and %s are mutually exclusive",m,y))})}),s.getInternalMethods().getParserConfiguration()["strip-dashed"]&&Object.keys(g).forEach(m=>{g[m].forEach(y=>{y&&u[e.Parser.camelCase(m)]!==void 0&&u[e.Parser.camelCase(y)]!==void 0&&t.fail(n("Arguments %s and %s are mutually exclusive",m,y))})})},r.recommendCommands=function(u,m){m=m.sort((d,F)=>F.length-d.length);let E=null,_=1/0;for(let d=0,F;(F=m[d])!==void 0;d++){let z=Gn(u,F);z<=3&&z<_&&(_=z,E=F)}E&&t.fail(n("Did you mean %s?",E))},r.reset=function(u){return a=St(a,m=>!u[m]),g=St(g,m=>!u[m]),r};let w=[];return r.freeze=function(){w.push({implied:a,conflicting:g})},r.unfreeze=function(){let u=w.pop();ot(u,void 0,e),{implied:a,conflicting:g}=u},r}var Ke=[],oe;function ae(s,t,e,n){oe=n;let i={};if(Object.prototype.hasOwnProperty.call(s,"extends")){if(typeof s.extends!="string")return i;let r=/\.json|\..*rc$/.test(s.extends),a=null;if(r)a=Os(t,s.extends);else try{a=Ot.resolve(s.extends)}catch{return s}ys(a),Ke.push(a),i=r?JSON.parse(oe.readFileSync(a,"utf8")):Ot(s.extends),delete s.extends,i=ae(i,oe.path.dirname(a),e,oe)}return Ke=[],e?Kn(i,s):Object.assign({},i,s)}function ys(s){if(Ke.indexOf(s)>-1)throw new V(`Circular extended configurations: '${s}'.`)}function Os(s,t){return oe.path.resolve(s,t)}function Kn(s,t){let e={};function n(i){return i&&typeof i=="object"&&!Array.isArray(i)}Object.assign(e,s);for(let i of Object.keys(t))n(t[i])&&n(e[i])?e[i]=Kn(s[i],t[i]):e[i]=t[i];return e}var A=function(s,t,e,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof t=="function"?s!==t||!i:!t.has(s))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(s,e):i?i.value=e:t.set(s,e),e},o=function(s,t,e,n){if(e==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?s!==t||!n:!t.has(s))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e==="m"?n:e==="a"?n.call(s):n?n.value:t.get(s)},tt,Rt,le,ut,lt,_e,It,Ut,Ce,dt,xe,pt,_t,ct,mt,Ee,te,st,I,je,Ae,ft,Tt,ee,Ht,$t,Pe,D,Yt,Bt,Gt,W,Se,Ct,X;function pi(s){return(t=[],e=s.process.cwd(),n)=>{let i=new on(t,e,n,s);return Object.defineProperty(i,"argv",{get:()=>i.parse(),enumerable:!0}),i.help(),i.version(),i}}var Qn=Symbol("copyDoubleDash"),Jn=Symbol("copyDoubleDash"),Qe=Symbol("deleteFromParserHintObject"),Zn=Symbol("emitWarning"),Xn=Symbol("freeze"),kn=Symbol("getDollarZero"),Vt=Symbol("getParserConfiguration"),ti=Symbol("getUsageConfiguration"),Je=Symbol("guessLocale"),ei=Symbol("guessVersion"),ni=Symbol("parsePositionalNumbers"),Ze=Symbol("pkgUp"),vt=Symbol("populateParserHintArray"),ne=Symbol("populateParserHintSingleValueDictionary"),Xe=Symbol("populateParserHintArrayDictionary"),ke=Symbol("populateParserHintDictionary"),tn=Symbol("sanitizeKey"),en=Symbol("setKey"),nn=Symbol("unfreeze"),ii=Symbol("validateAsync"),si=Symbol("getCommandInstance"),ri=Symbol("getContext"),oi=Symbol("getHasOutput"),ai=Symbol("getLoggerInstance"),li=Symbol("getParseContext"),ci=Symbol("getUsageInstance"),fi=Symbol("getValidationInstance"),Me=Symbol("hasParseCallback"),hi=Symbol("isGlobalContext"),qt=Symbol("postProcess"),ui=Symbol("rebase"),sn=Symbol("reset"),ce=Symbol("runYargsParserAndExecuteCommands"),rn=Symbol("runValidation"),di=Symbol("setHasOutput"),Kt=Symbol("kTrackManuallySetKeys"),on=class{constructor(t=[],e,n,i){this.customScriptName=!1,this.parsed=!1,tt.set(this,void 0),Rt.set(this,void 0),le.set(this,{commands:[],fullCommands:[]}),ut.set(this,null),lt.set(this,null),_e.set(this,"show-hidden"),It.set(this,null),Ut.set(this,!0),Ce.set(this,{}),dt.set(this,!0),xe.set(this,[]),pt.set(this,void 0),_t.set(this,{}),ct.set(this,!1),mt.set(this,null),Ee.set(this,!0),te.set(this,void 0),st.set(this,""),I.set(this,void 0),je.set(this,void 0),Ae.set(this,{}),ft.set(this,null),Tt.set(this,null),ee.set(this,{}),Ht.set(this,{}),$t.set(this,void 0),Pe.set(this,!1),D.set(this,void 0),Yt.set(this,!1),Bt.set(this,!1),Gt.set(this,!1),W.set(this,void 0),Se.set(this,{}),Ct.set(this,null),X.set(this,void 0),A(this,D,i,"f"),A(this,$t,t,"f"),A(this,Rt,e,"f"),A(this,je,n,"f"),A(this,pt,new we(this),"f"),this.$0=this[kn](),this[sn](),A(this,tt,o(this,tt,"f"),"f"),A(this,W,o(this,W,"f"),"f"),A(this,X,o(this,X,"f"),"f"),A(this,I,o(this,I,"f"),"f"),o(this,I,"f").showHiddenOpt=o(this,_e,"f"),A(this,te,this[Jn](),"f")}addHelpOpt(t,e){let n="help";return j("[string|boolean] [string]",[t,e],arguments.length),o(this,mt,"f")&&(this[Qe](o(this,mt,"f")),A(this,mt,null,"f")),t===!1&&e===void 0?this:(A(this,mt,typeof t=="string"?t:n,"f"),this.boolean(o(this,mt,"f")),this.describe(o(this,mt,"f"),e||o(this,W,"f").deferY18nLookup("Show help")),this)}help(t,e){return this.addHelpOpt(t,e)}addShowHiddenOpt(t,e){if(j("[string|boolean] [string]",[t,e],arguments.length),t===!1&&e===void 0)return this;let n=typeof t=="string"?t:o(this,_e,"f");return this.boolean(n),this.describe(n,e||o(this,W,"f").deferY18nLookup("Show hidden options")),o(this,I,"f").showHiddenOpt=n,this}showHidden(t,e){return this.addShowHiddenOpt(t,e)}alias(t,e){return j("<object|string|array> [string|array]",[t,e],arguments.length),this[Xe](this.alias.bind(this),"alias",t,e),this}array(t){return j("<array|string>",[t],arguments.length),this[vt]("array",t),this[Kt](t),this}boolean(t){return j("<array|string>",[t],arguments.length),this[vt]("boolean",t),this[Kt](t),this}check(t,e){return j("<function> [boolean]",[t,e],arguments.length),this.middleware((n,i)=>zt(()=>t(n,i.getOptions()),r=>(r?(typeof r=="string"||r instanceof Error)&&o(this,W,"f").fail(r.toString(),r):o(this,W,"f").fail(o(this,D,"f").y18n.__("Argument check failed: %s",t.toString())),n),r=>(o(this,W,"f").fail(r.message?r.message:r.toString(),r),n)),!1,e),this}choices(t,e){return j("<object|string|array> [string|array]",[t,e],arguments.length),this[Xe](this.choices.bind(this),"choices",t,e),this}coerce(t,e){if(j("<object|string|array> [function]",[t,e],arguments.length),Array.isArray(t)){if(!e)throw new V("coerce callback must be provided");for(let n of t)this.coerce(n,e);return this}else if(typeof t=="object"){for(let n of Object.keys(t))this.coerce(n,t[n]);return this}if(!e)throw new V("coerce callback must be provided");return o(this,I,"f").key[t]=!0,o(this,pt,"f").addCoerceMiddleware((n,i)=>{let r;return Object.prototype.hasOwnProperty.call(n,t)?zt(()=>(r=i.getAliases(),e(n[t])),c=>{n[t]=c;let g=i.getInternalMethods().getParserConfiguration()["strip-aliased"];if(r[t]&&g!==!0)for(let w of r[t])n[w]=c;return n},c=>{throw new V(c.message)}):n},t),this}conflicts(t,e){return j("<string|object> [string|array]",[t,e],arguments.length),o(this,X,"f").conflicts(t,e),this}config(t="config",e,n){return j("[object|string] [string|function] [function]",[t,e,n],arguments.length),typeof t=="object"&&!Array.isArray(t)?(t=ae(t,o(this,Rt,"f"),this[Vt]()["deep-merge-config"]||!1,o(this,D,"f")),o(this,I,"f").configObjects=(o(this,I,"f").configObjects||[]).concat(t),this):(typeof e=="function"&&(n=e,e=void 0),this.describe(t,e||o(this,W,"f").deferY18nLookup("Path to JSON config file")),(Array.isArray(t)?t:[t]).forEach(i=>{o(this,I,"f").config[i]=n||!0}),this)}completion(t,e,n){return j("[string] [string|boolean|function] [function]",[t,e,n],arguments.length),typeof e=="function"&&(n=e,e=void 0),A(this,lt,t||o(this,lt,"f")||"completion","f"),!e&&e!==!1&&(e="generate completion script"),this.command(o(this,lt,"f"),e),n&&o(this,ut,"f").registerFunction(n),this}command(t,e,n,i,r,a){return j("<string|array|object> [string|boolean] [function|object] [function] [array] [boolean|string]",[t,e,n,i,r,a],arguments.length),o(this,tt,"f").addHandler(t,e,n,i,r,a),this}commands(t,e,n,i,r,a){return this.command(t,e,n,i,r,a)}commandDir(t,e){j("<string> [object]",[t,e],arguments.length);let n=o(this,je,"f")||o(this,D,"f").require;return o(this,tt,"f").addDirectory(t,n,o(this,D,"f").getCallerFile(),e),this}count(t){return j("<array|string>",[t],arguments.length),this[vt]("count",t),this[Kt](t),this}default(t,e,n){return j("<object|string|array> [*] [string]",[t,e,n],arguments.length),n&&(Ye(t,o(this,D,"f")),o(this,I,"f").defaultDescription[t]=n),typeof e=="function"&&(Ye(t,o(this,D,"f")),o(this,I,"f").defaultDescription[t]||(o(this,I,"f").defaultDescription[t]=o(this,W,"f").functionDescription(e)),e=e.call()),this[ne](this.default.bind(this),"default",t,e),this}defaults(t,e,n){return this.default(t,e,n)}demandCommand(t=1,e,n,i){return j("[number] [number|string] [string|null|undefined] [string|null|undefined]",[t,e,n,i],arguments.length),typeof e!="number"&&(n=e,e=1/0),this.global("_",!1),o(this,I,"f").demandedCommands._={min:t,max:e,minMsg:n,maxMsg:i},this}demand(t,e,n){return Array.isArray(e)?(e.forEach(i=>{ot(n,!0,o(this,D,"f")),this.demandOption(i,n)}),e=1/0):typeof e!="number"&&(n=e,e=1/0),typeof t=="number"?(ot(n,!0,o(this,D,"f")),this.demandCommand(t,e,n,n)):Array.isArray(t)?t.forEach(i=>{ot(n,!0,o(this,D,"f")),this.demandOption(i,n)}):typeof n=="string"?this.demandOption(t,n):(n===!0||typeof n>"u")&&this.demandOption(t),this}demandOption(t,e){return j("<object|string|array> [string]",[t,e],arguments.length),this[ne](this.demandOption.bind(this),"demandedOptions",t,e),this}deprecateOption(t,e){return j("<string> [string|boolean]",[t,e],arguments.length),o(this,I,"f").deprecatedOptions[t]=e,this}describe(t,e){return j("<object|string|array> [string]",[t,e],arguments.length),this[en](t,!0),o(this,W,"f").describe(t,e),this}detectLocale(t){return j("<boolean>",[t],arguments.length),A(this,Ut,t,"f"),this}env(t){return j("[string|boolean]",[t],arguments.length),t===!1?delete o(this,I,"f").envPrefix:o(this,I,"f").envPrefix=t||"",this}epilogue(t){return j("<string>",[t],arguments.length),o(this,W,"f").epilog(t),this}epilog(t){return this.epilogue(t)}example(t,e){return j("<string|array> [string]",[t,e],arguments.length),Array.isArray(t)?t.forEach(n=>this.example(...n)):o(this,W,"f").example(t,e),this}exit(t,e){A(this,ct,!0,"f"),A(this,It,e,"f"),o(this,dt,"f")&&o(this,D,"f").process.exit(t)}exitProcess(t=!0){return j("[boolean]",[t],arguments.length),A(this,dt,t,"f"),this}fail(t){if(j("<function|boolean>",[t],arguments.length),typeof t=="boolean"&&t!==!1)throw new V("Invalid first argument. Expected function or boolean 'false'");return o(this,W,"f").failFn(t),this}getAliases(){return this.parsed?this.parsed.aliases:{}}async getCompletion(t,e){return j("<array> [function]",[t,e],arguments.length),e?o(this,ut,"f").getCompletion(t,e):new Promise((n,i)=>{o(this,ut,"f").getCompletion(t,(r,a)=>{r?i(r):n(a)})})}getDemandedOptions(){return j([],0),o(this,I,"f").demandedOptions}getDemandedCommands(){return j([],0),o(this,I,"f").demandedCommands}getDeprecatedOptions(){return j([],0),o(this,I,"f").deprecatedOptions}getDetectLocale(){return o(this,Ut,"f")}getExitProcess(){return o(this,dt,"f")}getGroups(){return Object.assign({},o(this,_t,"f"),o(this,Ht,"f"))}getHelp(){if(A(this,ct,!0,"f"),!o(this,W,"f").hasCachedHelpMessage()){if(!this.parsed){let e=this[ce](o(this,$t,"f"),void 0,void 0,0,!0);if(q(e))return e.then(()=>o(this,W,"f").help())}let t=o(this,tt,"f").runDefaultBuilderOn(this);if(q(t))return t.then(()=>o(this,W,"f").help())}return Promise.resolve(o(this,W,"f").help())}getOptions(){return o(this,I,"f")}getStrict(){return o(this,Yt,"f")}getStrictCommands(){return o(this,Bt,"f")}getStrictOptions(){return o(this,Gt,"f")}global(t,e){return j("<string|array> [boolean]",[t,e],arguments.length),t=[].concat(t),e!==!1?o(this,I,"f").local=o(this,I,"f").local.filter(n=>t.indexOf(n)===-1):t.forEach(n=>{o(this,I,"f").local.includes(n)||o(this,I,"f").local.push(n)}),this}group(t,e){j("<string|array> <string>",[t,e],arguments.length);let n=o(this,Ht,"f")[e]||o(this,_t,"f")[e];o(this,Ht,"f")[e]&&delete o(this,Ht,"f")[e];let i={};return o(this,_t,"f")[e]=(n||[]).concat(t).filter(r=>i[r]?!1:i[r]=!0),this}hide(t){return j("<string>",[t],arguments.length),o(this,I,"f").hiddenOptions.push(t),this}implies(t,e){return j("<string|object> [number|string|array]",[t,e],arguments.length),o(this,X,"f").implies(t,e),this}locale(t){return j("[string]",[t],arguments.length),t===void 0?(this[Je](),o(this,D,"f").y18n.getLocale()):(A(this,Ut,!1,"f"),o(this,D,"f").y18n.setLocale(t),this)}middleware(t,e,n){return o(this,pt,"f").addMiddleware(t,!!e,n)}nargs(t,e){return j("<string|object|array> [number]",[t,e],arguments.length),this[ne](this.nargs.bind(this),"narg",t,e),this}normalize(t){return j("<array|string>",[t],arguments.length),this[vt]("normalize",t),this}number(t){return j("<array|string>",[t],arguments.length),this[vt]("number",t),this[Kt](t),this}option(t,e){if(j("<string|object> [object]",[t,e],arguments.length),typeof t=="object")Object.keys(t).forEach(n=>{this.options(n,t[n])});else{typeof e!="object"&&(e={}),this[Kt](t),o(this,Ct,"f")&&(t==="version"||e?.alias==="version")&&this[Zn](['"version" is a reserved word.',"Please do one of the following:",'- Disable version with `yargs.version(false)` if using "version" as an option',"- Use the built-in `yargs.version` method instead (if applicable)","- Use a different option key","https://yargs.js.org/docs/#api-reference-version"].join(`
|
|
63
|
-
`),void 0,"versionWarning"),o(this,
|
|
64
|
-
`,"f"),A(this,st,o(this,st,"f")+t.join(" "),"f")},error:(...t)=>{this[
|
|
65
|
-
`,"f"),A(this,st,o(this,st,"f")+t.join(" "),"f")}}}[Qe](t){Xt(o(this,
|
|
60
|
+
`)}`:"";t.fail(i("Missing required argument: %s","Missing required arguments: %s",Object.keys(y).length,Object.keys(y).join(", ")+_))}},r.unknownArguments=function(u,m,y,E,_=!0){var d;let D=s.getInternalMethods().getCommandInstance().getCommands(),z=[],T=s.getInternalMethods().getContext();if(Object.keys(u).forEach(U=>{!Vn.includes(U)&&!Object.prototype.hasOwnProperty.call(y,U)&&!Object.prototype.hasOwnProperty.call(s.getInternalMethods().getParseContext(),U)&&!r.isValidAndSomeAliasIsNotNew(U,m)&&z.push(U)}),_&&(T.commands.length>0||D.length>0||E)&&u._.slice(T.commands.length).forEach(U=>{D.includes(""+U)||z.push(""+U)}),_){let B=((d=s.getDemandedCommands()._)===null||d===void 0?void 0:d.max)||0,At=T.commands.length+B;At<u._.length&&u._.slice(At).forEach(gt=>{gt=String(gt),!T.commands.includes(gt)&&!z.includes(gt)&&z.push(gt)})}z.length&&t.fail(i("Unknown argument: %s","Unknown arguments: %s",z.length,z.map(U=>U.trim()?U:`"${U}"`).join(", ")))},r.unknownCommands=function(u){let m=s.getInternalMethods().getCommandInstance().getCommands(),y=[],E=s.getInternalMethods().getContext();return(E.commands.length>0||m.length>0)&&u._.slice(E.commands.length).forEach(_=>{m.includes(""+_)||y.push(""+_)}),y.length>0?(t.fail(i("Unknown command: %s","Unknown commands: %s",y.length,y.join(", "))),!0):!1},r.isValidAndSomeAliasIsNotNew=function(u,m){if(!Object.prototype.hasOwnProperty.call(m,u))return!1;let y=s.parsed.newAliases;return[u,...m[u]].some(E=>!Object.prototype.hasOwnProperty.call(y,E)||!y[u])},r.limitedChoices=function(u){let m=s.getOptions(),y={};if(!Object.keys(m.choices).length)return;Object.keys(u).forEach(d=>{Vn.indexOf(d)===-1&&Object.prototype.hasOwnProperty.call(m.choices,d)&&[].concat(u[d]).forEach(D=>{m.choices[d].indexOf(D)===-1&&D!==void 0&&(y[d]=(y[d]||[]).concat(D))})});let E=Object.keys(y);if(!E.length)return;let _=n("Invalid values:");E.forEach(d=>{_+=`
|
|
61
|
+
${n("Argument: %s, Given: %s, Choices: %s",d,t.stringifiedValues(y[d]),t.stringifiedValues(m.choices[d]))}`}),t.fail(_)};let a={};r.implies=function(u,m){j("<string|object> [array|number|string]",[u,m],arguments.length),typeof u=="object"?Object.keys(u).forEach(y=>{r.implies(y,u[y])}):(s.global(u),a[u]||(a[u]=[]),Array.isArray(m)?m.forEach(y=>r.implies(u,y)):(ot(m,void 0,e),a[u].push(m)))},r.getImplied=function(){return a};function c(p,u){let m=Number(u);return u=isNaN(m)?u:m,typeof u=="number"?u=p._.length>=u:u.match(/^--no-.+/)?(u=u.match(/^--no-(.+)/)[1],u=!Object.prototype.hasOwnProperty.call(p,u)):u=Object.prototype.hasOwnProperty.call(p,u),u}r.implications=function(u){let m=[];if(Object.keys(a).forEach(y=>{let E=y;(a[y]||[]).forEach(_=>{let d=E,D=_;d=c(u,d),_=c(u,_),d&&!_&&m.push(` ${E} -> ${D}`)})}),m.length){let y=`${n("Implications failed:")}
|
|
62
|
+
`;m.forEach(E=>{y+=E}),t.fail(y)}};let g={};r.conflicts=function(u,m){j("<string|object> [array|string]",[u,m],arguments.length),typeof u=="object"?Object.keys(u).forEach(y=>{r.conflicts(y,u[y])}):(s.global(u),g[u]||(g[u]=[]),Array.isArray(m)?m.forEach(y=>r.conflicts(u,y)):g[u].push(m))},r.getConflicting=()=>g,r.conflicting=function(u){Object.keys(u).forEach(m=>{g[m]&&g[m].forEach(y=>{y&&u[m]!==void 0&&u[y]!==void 0&&t.fail(n("Arguments %s and %s are mutually exclusive",m,y))})}),s.getInternalMethods().getParserConfiguration()["strip-dashed"]&&Object.keys(g).forEach(m=>{g[m].forEach(y=>{y&&u[e.Parser.camelCase(m)]!==void 0&&u[e.Parser.camelCase(y)]!==void 0&&t.fail(n("Arguments %s and %s are mutually exclusive",m,y))})})},r.recommendCommands=function(u,m){m=m.sort((d,D)=>D.length-d.length);let E=null,_=1/0;for(let d=0,D;(D=m[d])!==void 0;d++){let z=Gn(u,D);z<=3&&z<_&&(_=z,E=D)}E&&t.fail(n("Did you mean %s?",E))},r.reset=function(u){return a=St(a,m=>!u[m]),g=St(g,m=>!u[m]),r};let w=[];return r.freeze=function(){w.push({implied:a,conflicting:g})},r.unfreeze=function(){let u=w.pop();ot(u,void 0,e),{implied:a,conflicting:g}=u},r}var Ke=[],oe;function ae(s,t,e,n){oe=n;let i={};if(Object.prototype.hasOwnProperty.call(s,"extends")){if(typeof s.extends!="string")return i;let r=/\.json|\..*rc$/.test(s.extends),a=null;if(r)a=Os(t,s.extends);else try{a=Ot.resolve(s.extends)}catch{return s}ys(a),Ke.push(a),i=r?JSON.parse(oe.readFileSync(a,"utf8")):Ot(s.extends),delete s.extends,i=ae(i,oe.path.dirname(a),e,oe)}return Ke=[],e?Kn(i,s):Object.assign({},i,s)}function ys(s){if(Ke.indexOf(s)>-1)throw new V(`Circular extended configurations: '${s}'.`)}function Os(s,t){return oe.path.resolve(s,t)}function Kn(s,t){let e={};function n(i){return i&&typeof i=="object"&&!Array.isArray(i)}Object.assign(e,s);for(let i of Object.keys(t))n(t[i])&&n(e[i])?e[i]=Kn(s[i],t[i]):e[i]=t[i];return e}var A=function(s,t,e,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof t=="function"?s!==t||!i:!t.has(s))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(s,e):i?i.value=e:t.set(s,e),e},o=function(s,t,e,n){if(e==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?s!==t||!n:!t.has(s))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e==="m"?n:e==="a"?n.call(s):n?n.value:t.get(s)},tt,Ut,le,ut,lt,_e,Mt,Tt,Ce,dt,xe,pt,_t,ct,mt,Ee,te,st,M,je,Ae,ft,Ht,ee,Yt,$t,Pe,N,Bt,Gt,Vt,W,Se,Ct,X;function pi(s){return(t=[],e=s.process.cwd(),n)=>{let i=new on(t,e,n,s);return Object.defineProperty(i,"argv",{get:()=>i.parse(),enumerable:!0}),i.help(),i.version(),i}}var Qn=Symbol("copyDoubleDash"),Jn=Symbol("copyDoubleDash"),Qe=Symbol("deleteFromParserHintObject"),Zn=Symbol("emitWarning"),Xn=Symbol("freeze"),kn=Symbol("getDollarZero"),qt=Symbol("getParserConfiguration"),ti=Symbol("getUsageConfiguration"),Je=Symbol("guessLocale"),ei=Symbol("guessVersion"),ni=Symbol("parsePositionalNumbers"),Ze=Symbol("pkgUp"),vt=Symbol("populateParserHintArray"),ne=Symbol("populateParserHintSingleValueDictionary"),Xe=Symbol("populateParserHintArrayDictionary"),ke=Symbol("populateParserHintDictionary"),tn=Symbol("sanitizeKey"),en=Symbol("setKey"),nn=Symbol("unfreeze"),ii=Symbol("validateAsync"),si=Symbol("getCommandInstance"),ri=Symbol("getContext"),oi=Symbol("getHasOutput"),ai=Symbol("getLoggerInstance"),li=Symbol("getParseContext"),ci=Symbol("getUsageInstance"),fi=Symbol("getValidationInstance"),Ie=Symbol("hasParseCallback"),hi=Symbol("isGlobalContext"),Kt=Symbol("postProcess"),ui=Symbol("rebase"),sn=Symbol("reset"),ce=Symbol("runYargsParserAndExecuteCommands"),rn=Symbol("runValidation"),di=Symbol("setHasOutput"),Qt=Symbol("kTrackManuallySetKeys"),on=class{constructor(t=[],e,n,i){this.customScriptName=!1,this.parsed=!1,tt.set(this,void 0),Ut.set(this,void 0),le.set(this,{commands:[],fullCommands:[]}),ut.set(this,null),lt.set(this,null),_e.set(this,"show-hidden"),Mt.set(this,null),Tt.set(this,!0),Ce.set(this,{}),dt.set(this,!0),xe.set(this,[]),pt.set(this,void 0),_t.set(this,{}),ct.set(this,!1),mt.set(this,null),Ee.set(this,!0),te.set(this,void 0),st.set(this,""),M.set(this,void 0),je.set(this,void 0),Ae.set(this,{}),ft.set(this,null),Ht.set(this,null),ee.set(this,{}),Yt.set(this,{}),$t.set(this,void 0),Pe.set(this,!1),N.set(this,void 0),Bt.set(this,!1),Gt.set(this,!1),Vt.set(this,!1),W.set(this,void 0),Se.set(this,{}),Ct.set(this,null),X.set(this,void 0),A(this,N,i,"f"),A(this,$t,t,"f"),A(this,Ut,e,"f"),A(this,je,n,"f"),A(this,pt,new we(this),"f"),this.$0=this[kn](),this[sn](),A(this,tt,o(this,tt,"f"),"f"),A(this,W,o(this,W,"f"),"f"),A(this,X,o(this,X,"f"),"f"),A(this,M,o(this,M,"f"),"f"),o(this,M,"f").showHiddenOpt=o(this,_e,"f"),A(this,te,this[Jn](),"f")}addHelpOpt(t,e){let n="help";return j("[string|boolean] [string]",[t,e],arguments.length),o(this,mt,"f")&&(this[Qe](o(this,mt,"f")),A(this,mt,null,"f")),t===!1&&e===void 0?this:(A(this,mt,typeof t=="string"?t:n,"f"),this.boolean(o(this,mt,"f")),this.describe(o(this,mt,"f"),e||o(this,W,"f").deferY18nLookup("Show help")),this)}help(t,e){return this.addHelpOpt(t,e)}addShowHiddenOpt(t,e){if(j("[string|boolean] [string]",[t,e],arguments.length),t===!1&&e===void 0)return this;let n=typeof t=="string"?t:o(this,_e,"f");return this.boolean(n),this.describe(n,e||o(this,W,"f").deferY18nLookup("Show hidden options")),o(this,M,"f").showHiddenOpt=n,this}showHidden(t,e){return this.addShowHiddenOpt(t,e)}alias(t,e){return j("<object|string|array> [string|array]",[t,e],arguments.length),this[Xe](this.alias.bind(this),"alias",t,e),this}array(t){return j("<array|string>",[t],arguments.length),this[vt]("array",t),this[Qt](t),this}boolean(t){return j("<array|string>",[t],arguments.length),this[vt]("boolean",t),this[Qt](t),this}check(t,e){return j("<function> [boolean]",[t,e],arguments.length),this.middleware((n,i)=>Rt(()=>t(n,i.getOptions()),r=>(r?(typeof r=="string"||r instanceof Error)&&o(this,W,"f").fail(r.toString(),r):o(this,W,"f").fail(o(this,N,"f").y18n.__("Argument check failed: %s",t.toString())),n),r=>(o(this,W,"f").fail(r.message?r.message:r.toString(),r),n)),!1,e),this}choices(t,e){return j("<object|string|array> [string|array]",[t,e],arguments.length),this[Xe](this.choices.bind(this),"choices",t,e),this}coerce(t,e){if(j("<object|string|array> [function]",[t,e],arguments.length),Array.isArray(t)){if(!e)throw new V("coerce callback must be provided");for(let n of t)this.coerce(n,e);return this}else if(typeof t=="object"){for(let n of Object.keys(t))this.coerce(n,t[n]);return this}if(!e)throw new V("coerce callback must be provided");return o(this,M,"f").key[t]=!0,o(this,pt,"f").addCoerceMiddleware((n,i)=>{let r;return Object.prototype.hasOwnProperty.call(n,t)?Rt(()=>(r=i.getAliases(),e(n[t])),c=>{n[t]=c;let g=i.getInternalMethods().getParserConfiguration()["strip-aliased"];if(r[t]&&g!==!0)for(let w of r[t])n[w]=c;return n},c=>{throw new V(c.message)}):n},t),this}conflicts(t,e){return j("<string|object> [string|array]",[t,e],arguments.length),o(this,X,"f").conflicts(t,e),this}config(t="config",e,n){return j("[object|string] [string|function] [function]",[t,e,n],arguments.length),typeof t=="object"&&!Array.isArray(t)?(t=ae(t,o(this,Ut,"f"),this[qt]()["deep-merge-config"]||!1,o(this,N,"f")),o(this,M,"f").configObjects=(o(this,M,"f").configObjects||[]).concat(t),this):(typeof e=="function"&&(n=e,e=void 0),this.describe(t,e||o(this,W,"f").deferY18nLookup("Path to JSON config file")),(Array.isArray(t)?t:[t]).forEach(i=>{o(this,M,"f").config[i]=n||!0}),this)}completion(t,e,n){return j("[string] [string|boolean|function] [function]",[t,e,n],arguments.length),typeof e=="function"&&(n=e,e=void 0),A(this,lt,t||o(this,lt,"f")||"completion","f"),!e&&e!==!1&&(e="generate completion script"),this.command(o(this,lt,"f"),e),n&&o(this,ut,"f").registerFunction(n),this}command(t,e,n,i,r,a){return j("<string|array|object> [string|boolean] [function|object] [function] [array] [boolean|string]",[t,e,n,i,r,a],arguments.length),o(this,tt,"f").addHandler(t,e,n,i,r,a),this}commands(t,e,n,i,r,a){return this.command(t,e,n,i,r,a)}commandDir(t,e){j("<string> [object]",[t,e],arguments.length);let n=o(this,je,"f")||o(this,N,"f").require;return o(this,tt,"f").addDirectory(t,n,o(this,N,"f").getCallerFile(),e),this}count(t){return j("<array|string>",[t],arguments.length),this[vt]("count",t),this[Qt](t),this}default(t,e,n){return j("<object|string|array> [*] [string]",[t,e,n],arguments.length),n&&(Ye(t,o(this,N,"f")),o(this,M,"f").defaultDescription[t]=n),typeof e=="function"&&(Ye(t,o(this,N,"f")),o(this,M,"f").defaultDescription[t]||(o(this,M,"f").defaultDescription[t]=o(this,W,"f").functionDescription(e)),e=e.call()),this[ne](this.default.bind(this),"default",t,e),this}defaults(t,e,n){return this.default(t,e,n)}demandCommand(t=1,e,n,i){return j("[number] [number|string] [string|null|undefined] [string|null|undefined]",[t,e,n,i],arguments.length),typeof e!="number"&&(n=e,e=1/0),this.global("_",!1),o(this,M,"f").demandedCommands._={min:t,max:e,minMsg:n,maxMsg:i},this}demand(t,e,n){return Array.isArray(e)?(e.forEach(i=>{ot(n,!0,o(this,N,"f")),this.demandOption(i,n)}),e=1/0):typeof e!="number"&&(n=e,e=1/0),typeof t=="number"?(ot(n,!0,o(this,N,"f")),this.demandCommand(t,e,n,n)):Array.isArray(t)?t.forEach(i=>{ot(n,!0,o(this,N,"f")),this.demandOption(i,n)}):typeof n=="string"?this.demandOption(t,n):(n===!0||typeof n>"u")&&this.demandOption(t),this}demandOption(t,e){return j("<object|string|array> [string]",[t,e],arguments.length),this[ne](this.demandOption.bind(this),"demandedOptions",t,e),this}deprecateOption(t,e){return j("<string> [string|boolean]",[t,e],arguments.length),o(this,M,"f").deprecatedOptions[t]=e,this}describe(t,e){return j("<object|string|array> [string]",[t,e],arguments.length),this[en](t,!0),o(this,W,"f").describe(t,e),this}detectLocale(t){return j("<boolean>",[t],arguments.length),A(this,Tt,t,"f"),this}env(t){return j("[string|boolean]",[t],arguments.length),t===!1?delete o(this,M,"f").envPrefix:o(this,M,"f").envPrefix=t||"",this}epilogue(t){return j("<string>",[t],arguments.length),o(this,W,"f").epilog(t),this}epilog(t){return this.epilogue(t)}example(t,e){return j("<string|array> [string]",[t,e],arguments.length),Array.isArray(t)?t.forEach(n=>this.example(...n)):o(this,W,"f").example(t,e),this}exit(t,e){A(this,ct,!0,"f"),A(this,Mt,e,"f"),o(this,dt,"f")&&o(this,N,"f").process.exit(t)}exitProcess(t=!0){return j("[boolean]",[t],arguments.length),A(this,dt,t,"f"),this}fail(t){if(j("<function|boolean>",[t],arguments.length),typeof t=="boolean"&&t!==!1)throw new V("Invalid first argument. Expected function or boolean 'false'");return o(this,W,"f").failFn(t),this}getAliases(){return this.parsed?this.parsed.aliases:{}}async getCompletion(t,e){return j("<array> [function]",[t,e],arguments.length),e?o(this,ut,"f").getCompletion(t,e):new Promise((n,i)=>{o(this,ut,"f").getCompletion(t,(r,a)=>{r?i(r):n(a)})})}getDemandedOptions(){return j([],0),o(this,M,"f").demandedOptions}getDemandedCommands(){return j([],0),o(this,M,"f").demandedCommands}getDeprecatedOptions(){return j([],0),o(this,M,"f").deprecatedOptions}getDetectLocale(){return o(this,Tt,"f")}getExitProcess(){return o(this,dt,"f")}getGroups(){return Object.assign({},o(this,_t,"f"),o(this,Yt,"f"))}getHelp(){if(A(this,ct,!0,"f"),!o(this,W,"f").hasCachedHelpMessage()){if(!this.parsed){let e=this[ce](o(this,$t,"f"),void 0,void 0,0,!0);if(q(e))return e.then(()=>o(this,W,"f").help())}let t=o(this,tt,"f").runDefaultBuilderOn(this);if(q(t))return t.then(()=>o(this,W,"f").help())}return Promise.resolve(o(this,W,"f").help())}getOptions(){return o(this,M,"f")}getStrict(){return o(this,Bt,"f")}getStrictCommands(){return o(this,Gt,"f")}getStrictOptions(){return o(this,Vt,"f")}global(t,e){return j("<string|array> [boolean]",[t,e],arguments.length),t=[].concat(t),e!==!1?o(this,M,"f").local=o(this,M,"f").local.filter(n=>t.indexOf(n)===-1):t.forEach(n=>{o(this,M,"f").local.includes(n)||o(this,M,"f").local.push(n)}),this}group(t,e){j("<string|array> <string>",[t,e],arguments.length);let n=o(this,Yt,"f")[e]||o(this,_t,"f")[e];o(this,Yt,"f")[e]&&delete o(this,Yt,"f")[e];let i={};return o(this,_t,"f")[e]=(n||[]).concat(t).filter(r=>i[r]?!1:i[r]=!0),this}hide(t){return j("<string>",[t],arguments.length),o(this,M,"f").hiddenOptions.push(t),this}implies(t,e){return j("<string|object> [number|string|array]",[t,e],arguments.length),o(this,X,"f").implies(t,e),this}locale(t){return j("[string]",[t],arguments.length),t===void 0?(this[Je](),o(this,N,"f").y18n.getLocale()):(A(this,Tt,!1,"f"),o(this,N,"f").y18n.setLocale(t),this)}middleware(t,e,n){return o(this,pt,"f").addMiddleware(t,!!e,n)}nargs(t,e){return j("<string|object|array> [number]",[t,e],arguments.length),this[ne](this.nargs.bind(this),"narg",t,e),this}normalize(t){return j("<array|string>",[t],arguments.length),this[vt]("normalize",t),this}number(t){return j("<array|string>",[t],arguments.length),this[vt]("number",t),this[Qt](t),this}option(t,e){if(j("<string|object> [object]",[t,e],arguments.length),typeof t=="object")Object.keys(t).forEach(n=>{this.options(n,t[n])});else{typeof e!="object"&&(e={}),this[Qt](t),o(this,Ct,"f")&&(t==="version"||e?.alias==="version")&&this[Zn](['"version" is a reserved word.',"Please do one of the following:",'- Disable version with `yargs.version(false)` if using "version" as an option',"- Use the built-in `yargs.version` method instead (if applicable)","- Use a different option key","https://yargs.js.org/docs/#api-reference-version"].join(`
|
|
63
|
+
`),void 0,"versionWarning"),o(this,M,"f").key[t]=!0,e.alias&&this.alias(t,e.alias);let n=e.deprecate||e.deprecated;n&&this.deprecateOption(t,n);let i=e.demand||e.required||e.require;i&&this.demand(t,i),e.demandOption&&this.demandOption(t,typeof e.demandOption=="string"?e.demandOption:void 0),e.conflicts&&this.conflicts(t,e.conflicts),"default"in e&&this.default(t,e.default),e.implies!==void 0&&this.implies(t,e.implies),e.nargs!==void 0&&this.nargs(t,e.nargs),e.config&&this.config(t,e.configParser),e.normalize&&this.normalize(t),e.choices&&this.choices(t,e.choices),e.coerce&&this.coerce(t,e.coerce),e.group&&this.group(t,e.group),(e.boolean||e.type==="boolean")&&(this.boolean(t),e.alias&&this.boolean(e.alias)),(e.array||e.type==="array")&&(this.array(t),e.alias&&this.array(e.alias)),(e.number||e.type==="number")&&(this.number(t),e.alias&&this.number(e.alias)),(e.string||e.type==="string")&&(this.string(t),e.alias&&this.string(e.alias)),(e.count||e.type==="count")&&this.count(t),typeof e.global=="boolean"&&this.global(t,e.global),e.defaultDescription&&(o(this,M,"f").defaultDescription[t]=e.defaultDescription),e.skipValidation&&this.skipValidation(t);let r=e.describe||e.description||e.desc,a=o(this,W,"f").getDescriptions();(!Object.prototype.hasOwnProperty.call(a,t)||typeof r=="string")&&this.describe(t,r),e.hidden&&this.hide(t),e.requiresArg&&this.requiresArg(t)}return this}options(t,e){return this.option(t,e)}parse(t,e,n){j("[string|array] [function|boolean|object] [function]",[t,e,n],arguments.length),this[Xn](),typeof t>"u"&&(t=o(this,$t,"f")),typeof e=="object"&&(A(this,Ht,e,"f"),e=n),typeof e=="function"&&(A(this,ft,e,"f"),e=!1),e||A(this,$t,t,"f"),o(this,ft,"f")&&A(this,dt,!1,"f");let i=this[ce](t,!!e),r=this.parsed;return o(this,ut,"f").setParsed(this.parsed),q(i)?i.then(a=>(o(this,ft,"f")&&o(this,ft,"f").call(this,o(this,Mt,"f"),a,o(this,st,"f")),a)).catch(a=>{throw o(this,ft,"f")&&o(this,ft,"f")(a,this.parsed.argv,o(this,st,"f")),a}).finally(()=>{this[nn](),this.parsed=r}):(o(this,ft,"f")&&o(this,ft,"f").call(this,o(this,Mt,"f"),i,o(this,st,"f")),this[nn](),this.parsed=r,i)}parseAsync(t,e,n){let i=this.parse(t,e,n);return q(i)?i:Promise.resolve(i)}parseSync(t,e,n){let i=this.parse(t,e,n);if(q(i))throw new V(".parseSync() must not be used with asynchronous builders, handlers, or middleware");return i}parserConfiguration(t){return j("<object>",[t],arguments.length),A(this,Ae,t,"f"),this}pkgConf(t,e){j("<string> [string]",[t,e],arguments.length);let n=null,i=this[Ze](e||o(this,Ut,"f"));return i[t]&&typeof i[t]=="object"&&(n=ae(i[t],e||o(this,Ut,"f"),this[qt]()["deep-merge-config"]||!1,o(this,N,"f")),o(this,M,"f").configObjects=(o(this,M,"f").configObjects||[]).concat(n)),this}positional(t,e){j("<string> <object>",[t,e],arguments.length);let n=["default","defaultDescription","implies","normalize","choices","conflicts","coerce","type","describe","desc","description","alias"];e=St(e,(a,c)=>a==="type"&&!["string","number","boolean"].includes(c)?!1:n.includes(a));let i=o(this,le,"f").fullCommands[o(this,le,"f").fullCommands.length-1],r=i?o(this,tt,"f").cmdToParseOptions(i):{array:[],alias:{},default:{},demand:{}};return Xt(r).forEach(a=>{let c=r[a];Array.isArray(c)?c.indexOf(t)!==-1&&(e[a]=!0):c[t]&&!(a in e)&&(e[a]=c[t])}),this.group(t,o(this,W,"f").getPositionalGroupName()),this.option(t,e)}recommendCommands(t=!0){return j("[boolean]",[t],arguments.length),A(this,Pe,t,"f"),this}required(t,e,n){return this.demand(t,e,n)}require(t,e,n){return this.demand(t,e,n)}requiresArg(t){return j("<array|string|object> [number]",[t],arguments.length),typeof t=="string"&&o(this,M,"f").narg[t]?this:(this[ne](this.requiresArg.bind(this),"narg",t,NaN),this)}showCompletionScript(t,e){return j("[string] [string]",[t,e],arguments.length),t=t||this.$0,o(this,te,"f").log(o(this,ut,"f").generateCompletionScript(t,e||o(this,lt,"f")||"completion")),this}showHelp(t){if(j("[string|function]",[t],arguments.length),A(this,ct,!0,"f"),!o(this,W,"f").hasCachedHelpMessage()){if(!this.parsed){let n=this[ce](o(this,$t,"f"),void 0,void 0,0,!0);if(q(n))return n.then(()=>{o(this,W,"f").showHelp(t)}),this}let e=o(this,tt,"f").runDefaultBuilderOn(this);if(q(e))return e.then(()=>{o(this,W,"f").showHelp(t)}),this}return o(this,W,"f").showHelp(t),this}scriptName(t){return this.customScriptName=!0,this.$0=t,this}showHelpOnFail(t,e){return j("[boolean|string] [string]",[t,e],arguments.length),o(this,W,"f").showHelpOnFail(t,e),this}showVersion(t){return j("[string|function]",[t],arguments.length),o(this,W,"f").showVersion(t),this}skipValidation(t){return j("<array|string>",[t],arguments.length),this[vt]("skipValidation",t),this}strict(t){return j("[boolean]",[t],arguments.length),A(this,Bt,t!==!1,"f"),this}strictCommands(t){return j("[boolean]",[t],arguments.length),A(this,Gt,t!==!1,"f"),this}strictOptions(t){return j("[boolean]",[t],arguments.length),A(this,Vt,t!==!1,"f"),this}string(t){return j("<array|string>",[t],arguments.length),this[vt]("string",t),this[Qt](t),this}terminalWidth(){return j([],0),o(this,N,"f").process.stdColumns}updateLocale(t){return this.updateStrings(t)}updateStrings(t){return j("<object>",[t],arguments.length),A(this,Tt,!1,"f"),o(this,N,"f").y18n.updateLocale(t),this}usage(t,e,n,i){if(j("<string|null|undefined> [string|boolean] [function|object] [function]",[t,e,n,i],arguments.length),e!==void 0){if(ot(t,null,o(this,N,"f")),(t||"").match(/^\$0( |$)/))return this.command(t,e,n,i);throw new V(".usage() description must start with $0 if being used as alias for .command()")}else return o(this,W,"f").usage(t),this}usageConfiguration(t){return j("<object>",[t],arguments.length),A(this,Se,t,"f"),this}version(t,e,n){let i="version";if(j("[boolean|string] [string] [string]",[t,e,n],arguments.length),o(this,Ct,"f")&&(this[Qe](o(this,Ct,"f")),o(this,W,"f").version(void 0),A(this,Ct,null,"f")),arguments.length===0)n=this[ei](),t=i;else if(arguments.length===1){if(t===!1)return this;n=t,t=i}else arguments.length===2&&(n=e,e=void 0);return A(this,Ct,typeof t=="string"?t:i,"f"),e=e||o(this,W,"f").deferY18nLookup("Show version number"),o(this,W,"f").version(n||void 0),this.boolean(o(this,Ct,"f")),this.describe(o(this,Ct,"f"),e),this}wrap(t){return j("<number|null|undefined>",[t],arguments.length),o(this,W,"f").wrap(t),this}[(tt=new WeakMap,Ut=new WeakMap,le=new WeakMap,ut=new WeakMap,lt=new WeakMap,_e=new WeakMap,Mt=new WeakMap,Tt=new WeakMap,Ce=new WeakMap,dt=new WeakMap,xe=new WeakMap,pt=new WeakMap,_t=new WeakMap,ct=new WeakMap,mt=new WeakMap,Ee=new WeakMap,te=new WeakMap,st=new WeakMap,M=new WeakMap,je=new WeakMap,Ae=new WeakMap,ft=new WeakMap,Ht=new WeakMap,ee=new WeakMap,Yt=new WeakMap,$t=new WeakMap,Pe=new WeakMap,N=new WeakMap,Bt=new WeakMap,Gt=new WeakMap,Vt=new WeakMap,W=new WeakMap,Se=new WeakMap,Ct=new WeakMap,X=new WeakMap,Qn)](t){if(!t._||!t["--"])return t;t._.push.apply(t._,t["--"]);try{delete t["--"]}catch{}return t}[Jn](){return{log:(...t)=>{this[Ie]()||console.log(...t),A(this,ct,!0,"f"),o(this,st,"f").length&&A(this,st,o(this,st,"f")+`
|
|
64
|
+
`,"f"),A(this,st,o(this,st,"f")+t.join(" "),"f")},error:(...t)=>{this[Ie]()||console.error(...t),A(this,ct,!0,"f"),o(this,st,"f").length&&A(this,st,o(this,st,"f")+`
|
|
65
|
+
`,"f"),A(this,st,o(this,st,"f")+t.join(" "),"f")}}}[Qe](t){Xt(o(this,M,"f")).forEach(e=>{if((i=>i==="configObjects")(e))return;let n=o(this,M,"f")[e];Array.isArray(n)?n.includes(t)&&n.splice(n.indexOf(t),1):typeof n=="object"&&delete n[t]}),delete o(this,W,"f").getDescriptions()[t]}[Zn](t,e,n){o(this,Ce,"f")[n]||(o(this,N,"f").process.emitWarning(t,e),o(this,Ce,"f")[n]=!0)}[Xn](){o(this,xe,"f").push({options:o(this,M,"f"),configObjects:o(this,M,"f").configObjects.slice(0),exitProcess:o(this,dt,"f"),groups:o(this,_t,"f"),strict:o(this,Bt,"f"),strictCommands:o(this,Gt,"f"),strictOptions:o(this,Vt,"f"),completionCommand:o(this,lt,"f"),output:o(this,st,"f"),exitError:o(this,Mt,"f"),hasOutput:o(this,ct,"f"),parsed:this.parsed,parseFn:o(this,ft,"f"),parseContext:o(this,Ht,"f")}),o(this,W,"f").freeze(),o(this,X,"f").freeze(),o(this,tt,"f").freeze(),o(this,pt,"f").freeze()}[kn](){let t="",e;return/\b(node|iojs|electron)(\.exe)?$/.test(o(this,N,"f").process.argv()[0])?e=o(this,N,"f").process.argv().slice(1,2):e=o(this,N,"f").process.argv().slice(0,1),t=e.map(n=>{let i=this[ui](o(this,Ut,"f"),n);return n.match(/^(\/|([a-zA-Z]:)?\\)/)&&i.length<n.length?i:n}).join(" ").trim(),o(this,N,"f").getEnv("_")&&o(this,N,"f").getProcessArgvBin()===o(this,N,"f").getEnv("_")&&(t=o(this,N,"f").getEnv("_").replace(`${o(this,N,"f").path.dirname(o(this,N,"f").process.execPath())}/`,"")),t}[qt](){return o(this,Ae,"f")}[ti](){return o(this,Se,"f")}[Je](){if(!o(this,Tt,"f"))return;let t=o(this,N,"f").getEnv("LC_ALL")||o(this,N,"f").getEnv("LC_MESSAGES")||o(this,N,"f").getEnv("LANG")||o(this,N,"f").getEnv("LANGUAGE")||"en_US";this.locale(t.replace(/[.:].*/,""))}[ei](){return this[Ze]().version||"unknown"}[ni](t){let e=t["--"]?t["--"]:t._;for(let n=0,i;(i=e[n])!==void 0;n++)o(this,N,"f").Parser.looksLikeNumber(i)&&Number.isSafeInteger(Math.floor(parseFloat(`${i}`)))&&(e[n]=Number(i));return t}[Ze](t){let e=t||"*";if(o(this,ee,"f")[e])return o(this,ee,"f")[e];let n={};try{let i=t||o(this,N,"f").mainFilename;!t&&o(this,N,"f").path.extname(i)&&(i=o(this,N,"f").path.dirname(i));let r=o(this,N,"f").findUp(i,(a,c)=>{if(c.includes("package.json"))return"package.json"});ot(r,void 0,o(this,N,"f")),n=JSON.parse(o(this,N,"f").readFileSync(r,"utf8"))}catch{}return o(this,ee,"f")[e]=n||{},o(this,ee,"f")[e]}[vt](t,e){e=[].concat(e),e.forEach(n=>{n=this[tn](n),o(this,M,"f")[t].push(n)})}[ne](t,e,n,i){this[ke](t,e,n,i,(r,a,c)=>{o(this,M,"f")[r][a]=c})}[Xe](t,e,n,i){this[ke](t,e,n,i,(r,a,c)=>{o(this,M,"f")[r][a]=(o(this,M,"f")[r][a]||[]).concat(c)})}[ke](t,e,n,i,r){if(Array.isArray(n))n.forEach(a=>{t(a,i)});else if((a=>typeof a=="object")(n))for(let a of Xt(n))t(a,n[a]);else r(e,this[tn](n),i)}[tn](t){return t==="__proto__"?"___proto___":t}[en](t,e){return this[ne](this[en].bind(this),"key",t,e),this}[nn](){var t,e,n,i,r,a,c,g,w,p,u,m;let y=o(this,xe,"f").pop();ot(y,void 0,o(this,N,"f"));let E;t=this,e=this,n=this,i=this,r=this,a=this,c=this,g=this,w=this,p=this,u=this,m=this,{options:{set value(_){A(t,M,_,"f")}}.value,configObjects:E,exitProcess:{set value(_){A(e,dt,_,"f")}}.value,groups:{set value(_){A(n,_t,_,"f")}}.value,output:{set value(_){A(i,st,_,"f")}}.value,exitError:{set value(_){A(r,Mt,_,"f")}}.value,hasOutput:{set value(_){A(a,ct,_,"f")}}.value,parsed:this.parsed,strict:{set value(_){A(c,Bt,_,"f")}}.value,strictCommands:{set value(_){A(g,Gt,_,"f")}}.value,strictOptions:{set value(_){A(w,Vt,_,"f")}}.value,completionCommand:{set value(_){A(p,lt,_,"f")}}.value,parseFn:{set value(_){A(u,ft,_,"f")}}.value,parseContext:{set value(_){A(m,Ht,_,"f")}}.value}=y,o(this,M,"f").configObjects=E,o(this,W,"f").unfreeze(),o(this,X,"f").unfreeze(),o(this,tt,"f").unfreeze(),o(this,pt,"f").unfreeze()}[ii](t,e){return Rt(e,n=>(t(n),n))}getInternalMethods(){return{getCommandInstance:this[si].bind(this),getContext:this[ri].bind(this),getHasOutput:this[oi].bind(this),getLoggerInstance:this[ai].bind(this),getParseContext:this[li].bind(this),getParserConfiguration:this[qt].bind(this),getUsageConfiguration:this[ti].bind(this),getUsageInstance:this[ci].bind(this),getValidationInstance:this[fi].bind(this),hasParseCallback:this[Ie].bind(this),isGlobalContext:this[hi].bind(this),postProcess:this[Kt].bind(this),reset:this[sn].bind(this),runValidation:this[rn].bind(this),runYargsParserAndExecuteCommands:this[ce].bind(this),setHasOutput:this[di].bind(this)}}[si](){return o(this,tt,"f")}[ri](){return o(this,le,"f")}[oi](){return o(this,ct,"f")}[ai](){return o(this,te,"f")}[li](){return o(this,Ht,"f")||{}}[ci](){return o(this,W,"f")}[fi](){return o(this,X,"f")}[Ie](){return!!o(this,ft,"f")}[hi](){return o(this,Ee,"f")}[Kt](t,e,n,i){return n||q(t)||(e||(t=this[Qn](t)),(this[qt]()["parse-positional-numbers"]||this[qt]()["parse-positional-numbers"]===void 0)&&(t=this[ni](t)),i&&(t=zt(t,this,o(this,pt,"f").getMiddleware(),!1))),t}[sn](t={}){A(this,M,o(this,M,"f")||{},"f");let e={};e.local=o(this,M,"f").local||[],e.configObjects=o(this,M,"f").configObjects||[];let n={};e.local.forEach(a=>{n[a]=!0,(t[a]||[]).forEach(c=>{n[c]=!0})}),Object.assign(o(this,Yt,"f"),Object.keys(o(this,_t,"f")).reduce((a,c)=>{let g=o(this,_t,"f")[c].filter(w=>!(w in n));return g.length>0&&(a[c]=g),a},{})),A(this,_t,{},"f");let i=["array","boolean","string","skipValidation","count","normalize","number","hiddenOptions"],r=["narg","key","alias","default","defaultDescription","config","choices","demandedOptions","demandedCommands","deprecatedOptions"];return i.forEach(a=>{e[a]=(o(this,M,"f")[a]||[]).filter(c=>!n[c])}),r.forEach(a=>{e[a]=St(o(this,M,"f")[a],c=>!n[c])}),e.envPrefix=o(this,M,"f").envPrefix,A(this,M,e,"f"),A(this,W,o(this,W,"f")?o(this,W,"f").reset(n):Tn(this,o(this,N,"f")),"f"),A(this,X,o(this,X,"f")?o(this,X,"f").reset(n):qn(this,o(this,W,"f"),o(this,N,"f")),"f"),A(this,tt,o(this,tt,"f")?o(this,tt,"f").reset():zn(o(this,W,"f"),o(this,X,"f"),o(this,pt,"f"),o(this,N,"f")),"f"),o(this,ut,"f")||A(this,ut,Bn(this,o(this,W,"f"),o(this,tt,"f"),o(this,N,"f")),"f"),o(this,pt,"f").reset(),A(this,lt,null,"f"),A(this,st,"","f"),A(this,Mt,null,"f"),A(this,ct,!1,"f"),this.parsed=!1,this}[ui](t,e){return o(this,N,"f").path.relative(t,e)}[ce](t,e,n,i=0,r=!1){let a=!!n||r;t=t||o(this,$t,"f"),o(this,M,"f").__=o(this,N,"f").y18n.__,o(this,M,"f").configuration=this[qt]();let c=!!o(this,M,"f").configuration["populate--"],g=Object.assign({},o(this,M,"f").configuration,{"populate--":!0}),w=o(this,N,"f").Parser.detailed(t,Object.assign({},o(this,M,"f"),{configuration:{"parse-positional-numbers":!1,...g}})),p=Object.assign(w.argv,o(this,Ht,"f")),u,m=w.aliases,y=!1,E=!1;Object.keys(p).forEach(_=>{_===o(this,mt,"f")&&p[_]?y=!0:_===o(this,Ct,"f")&&p[_]&&(E=!0)}),p.$0=this.$0,this.parsed=w,i===0&&o(this,W,"f").clearCachedHelpMessage();try{if(this[Je](),e)return this[Kt](p,c,!!n,!1);o(this,mt,"f")&&[o(this,mt,"f")].concat(m[o(this,mt,"f")]||[]).filter(T=>T.length>1).includes(""+p._[p._.length-1])&&(p._.pop(),y=!0),A(this,Ee,!1,"f");let _=o(this,tt,"f").getCommands(),d=o(this,ut,"f").completionKey in p,D=y||d||r;if(p._.length){if(_.length){let z;for(let T=i||0,U;p._[T]!==void 0;T++)if(U=String(p._[T]),_.includes(U)&&U!==o(this,lt,"f")){let B=o(this,tt,"f").runCommand(U,this,w,T+1,r,y||E||r);return this[Kt](B,c,!!n,!1)}else if(!z&&U!==o(this,lt,"f")){z=U;break}!o(this,tt,"f").hasDefaultCommand()&&o(this,Pe,"f")&&z&&!D&&o(this,X,"f").recommendCommands(z,_)}o(this,lt,"f")&&p._.includes(o(this,lt,"f"))&&!d&&(o(this,dt,"f")&&It(!0),this.showCompletionScript(),this.exit(0))}if(o(this,tt,"f").hasDefaultCommand()&&!D){let z=o(this,tt,"f").runCommand(null,this,w,0,r,y||E||r);return this[Kt](z,c,!!n,!1)}if(d){o(this,dt,"f")&&It(!0),t=[].concat(t);let z=t.slice(t.indexOf(`--${o(this,ut,"f").completionKey}`)+1);return o(this,ut,"f").getCompletion(z,(T,U)=>{if(T)throw new V(T.message);(U||[]).forEach(B=>{o(this,te,"f").log(B)}),this.exit(0)}),this[Kt](p,!c,!!n,!1)}if(o(this,ct,"f")||(y?(o(this,dt,"f")&&It(!0),a=!0,this.showHelp("log"),this.exit(0)):E&&(o(this,dt,"f")&&It(!0),a=!0,o(this,W,"f").showVersion("log"),this.exit(0))),!a&&o(this,M,"f").skipValidation.length>0&&(a=Object.keys(p).some(z=>o(this,M,"f").skipValidation.indexOf(z)>=0&&p[z]===!0)),!a){if(w.error)throw new V(w.error.message);if(!d){let z=this[rn](m,{},w.error);n||(u=zt(p,this,o(this,pt,"f").getMiddleware(),!0)),u=this[ii](z,u??p),q(u)&&!n&&(u=u.then(()=>zt(p,this,o(this,pt,"f").getMiddleware(),!1)))}}}catch(_){if(_ instanceof V)o(this,W,"f").fail(_.message,_);else throw _}return this[Kt](u??p,c,!!n,!0)}[rn](t,e,n,i){let r={...this.getDemandedOptions()};return a=>{if(n)throw new V(n.message);o(this,X,"f").nonOptionCount(a),o(this,X,"f").requiredArguments(a,r);let c=!1;o(this,Gt,"f")&&(c=o(this,X,"f").unknownCommands(a)),o(this,Bt,"f")&&!c?o(this,X,"f").unknownArguments(a,t,e,!!i):o(this,Vt,"f")&&o(this,X,"f").unknownArguments(a,t,{},!1,!1),o(this,X,"f").limitedChoices(a),o(this,X,"f").implications(a),o(this,X,"f").conflicting(a)}}[di](){A(this,ct,!0,"f")}[Qt](t){if(typeof t=="string")o(this,M,"f").key[t]=!0;else for(let e of t)o(this,M,"f").key[e]=!0}};function Rn(s){return!!s&&typeof s.getInternalMethods=="function"}var _s=pi(He),mi=_s;await mi(Ue(process.argv)).command("$0 <file>",'Convert a tldraw ".tldr" file to an svg or png image',s=>s.positional("file",{demandOption:!0,describe:'The ".tldr" file to convert',type:"string"}).option("format",{alias:"f",choices:["png","svg"],default:"svg",describe:"Output image format",type:"string"}).option("output",{alias:"o",default:"./",describe:"Output image directory",type:"string"}).option("verbose",{default:!1,describe:"Enable verbose output",type:"boolean"}),async s=>{let{file:t,format:e,output:n,verbose:i}=s;try{await pn(t,e,n,i)}catch(r){console.error("Error during conversion:",r),process.exit(1)}}).alias("h","help").version("version",an).alias("v","version").help().parse();
|
|
66
66
|
/*! Bundled license information:
|
|
67
67
|
|
|
68
68
|
yargs-parser/build/lib/string-utils.js:
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import D from"express";import R from"node:net";import C from"node:os";var w=class extends Error{constructor(t){super(`${t} is locked`)}},c={old:new Set,young:new Set},B=1e3*15;var d,k=()=>{let e=C.networkInterfaces(),t=new Set([void 0,"0.0.0.0"]);for(let s of Object.values(e))for(let o of s)t.add(o.address);return t},b=e=>new Promise((t,s)=>{let o=R.createServer();o.unref(),o.on("error",s),o.listen(e,()=>{let{port:n}=o.address();o.close(()=>{t(n)})})}),$=async(e,t)=>{if(e.host||e.port===0)return b(e);for(let s of t)try{await b({port:e.port,host:s})}catch(o){if(!["EADDRNOTAVAIL","EINVAL"].includes(o.code))throw o}return e.port},L=function*(e){e&&(yield*e),yield 0};async function h(e){let t,s=new Set;if(e&&(e.port&&(t=typeof e.port=="number"?[e.port]:e.port),e.exclude)){let n=e.exclude;if(typeof n[Symbol.iterator]!="function")throw new TypeError("The `exclude` option must be an iterable.");for(let r of n){if(typeof r!="number")throw new TypeError("Each item in the `exclude` option must be a number corresponding to the port you want excluded.");if(!Number.isSafeInteger(r))throw new TypeError(`Number ${r} in the exclude option is not a safe integer and can't be used`)}s=new Set(n)}d===void 0&&(d=setTimeout(()=>{d=void 0,c.old=c.young,c.young=new Set},B),d.unref&&d.unref());let o=k();for(let n of L(t))try{if(s.has(n))continue;let r=await $({...e,port:n},o);for(;c.old.has(r)||c.young.has(r);){if(n!==0)throw new w(n);r=await $({...e,port:n},o)}return c.young.add(r),r}catch(r){if(!["EADDRINUSE","EACCES"].includes(r.code)&&!(r instanceof w))throw r}throw new Error("No available ports found")}import I from"node:fs/promises";import A from"node:os";import l from"node:path";import{dirname as q}from"node:path";import{fileURLToPath as O}from"node:url";import U from"puppeteer";import j from"node:os";var v=j.homedir();function u(e){if(typeof e!="string")throw new TypeError(`Expected a string, got ${typeof e}`);return v?e.replace(/^~(?=$|\/|\\)/,v):e}async function V(e){let t=D(),s=await h();return t.use(D.static(e)),new Promise((o,n)=>{let r=t.listen(s,()=>{o(r)});r.on("error",p=>{n(p)})})}async function _(e){return new Promise((t,s)=>{e.on("Browser.downloadProgress",o=>{o.state==="completed"?t(o.guid):o.state==="canceled"&&s(new Error("Download was canceled"))})})}async function G(e,t="svg",s="./",o=!1){let n=q(O(import.meta.url)),r=l.resolve(u(e));o&&console.log(`Loading tldr file "${r}"`);let p=await I.readFile(r,"utf8");o&&console.log("Starting tldraw server..."),console.log(`scriptDirectory: ${n}`);let y=l.join(n,n.endsWith("/src/lib")?"../../dist/tldraw":n.endsWith("/dist/lib")?"../tldraw":"../dist/tldraw");o&&console.log(`tldraw served from "${y}"`);let x=await V(y),{port:P}=x.address();o&&console.log(`tldraw hosted at "http://localhost:${P}"`),o&&console.log("Starting Puppeteer...");let E=await U.launch({headless:"new"}),a=await E.newPage();await a.setRequestInterception(!0),a.on("request",i=>{i.url().endsWith("favicon.ico")?i.respond({status:200}):i.continue()}),a.on("console",i=>{let f=i.type(),g=i.text();f==="error"?console.error(`[Browser] ${g}`):f==="warning"?console.warn(`[Browser] ${g}`):o&&console.log(`[Browser] ${g}`)});let S=await a.target().createCDPSession();await S.send("Browser.setDownloadBehavior",{behavior:"allowAndName",downloadPath:A.tmpdir(),eventsEnabled:!0}),await a.goto(`http://localhost:${P}`),await a.waitForFunction(()=>window.tldrawExportFile!==void 0),o&&console.log("Requesting download"),await a.evaluate((i,f)=>{window.tldrawExportFile(i,f)},p,t);let F=await _(S);o&&console.log("Download complete"),await E.close(),o&&console.log("Stopped Puppeteer");let T=l.basename(e,l.extname(e)),N=l.join(A.tmpdir(),F),m=u(l.join(s,`${T}.${t}`));return await I.rename(N,m),o&&console.log(`Saved to "${m}"`),x.close(),o&&console.log("Stopped tldraw server"),l.resolve(m)}export{G as tldrToImage};
|
|
@@ -312,4 +312,4 @@ Error generating stack: `+s.message+`
|
|
|
312
312
|
font-weight: ${y.weight};
|
|
313
313
|
font-style: ${y.style};
|
|
314
314
|
src: url("${o}") format("woff2")
|
|
315
|
-
}`,()=>{document.fonts.delete(y),h=!0}},[e,n]),t};function Eee(e){return{draw:{url:e.fonts.draw},serif:{url:e.fonts.serif},sansSerif:{url:e.fonts.sansSerif},monospace:{url:e.fonts.monospace}}}function kee(e){const n=b.useMemo(()=>Eee(e),[e]),t=[zd("tldraw_draw",n.draw),zd("tldraw_serif",n.serif),zd("tldraw_sans",n.sansSerif),zd("tldraw_mono",n.monospace)];return{error:t.some(r=>r===1),done:!t.some(r=>r===2)}}function Iee(e){const{children:n,maxImageDimension:t,maxAssetSize:r,acceptedImageMimeTypes:o,acceptedVideoMimeTypes:s,onMount:i,...a}=e,l=sL(a.components??{}),c=Cx(a.shapeUtils??[]),u=Cx(a.tools??[]),d={initialState:"select",...a,components:b.useMemo(()=>({Scribble:vb,CollaboratorScribble:vb,SelectionForeground:fU,SelectionBackground:hU,Handles:iU,HoveredShapeIndicator:aU,...l}),[l]),shapeUtils:b.useMemo(()=>[...IV,...c],[c]),tools:b.useMemo(()=>[...BV,...iH,...u],[u])},h=DG(a.assetUrls),{done:p,error:y}=kee(h);return y?g.jsx(tL,{children:"Could not load assets. Please refresh the page."}):p?g.jsx(Zj,{...d,children:g.jsxs(tee,{...d,children:[g.jsx(Cee,{children:g.jsx(Av,{})}),g.jsx(_ee,{maxImageDimension:t,maxAssetSize:r,acceptedImageMimeTypes:o,acceptedVideoMimeTypes:s,onMount:i}),n]})}):g.jsx(wE,{children:"Loading assets..."})}function _ee({maxImageDimension:e=1e3,maxAssetSize:n=10*1024*1024,acceptedImageMimeTypes:t=["image/jpeg","image/png","image/gif","image/svg+xml"],acceptedVideoMimeTypes:r=["video/mp4","video/quicktime"],onMount:o}){const s=K(),i=Tee(a=>{const l=[];return l.push(..._V(a)),GU(a,{maxImageDimension:e,maxAssetSize:n,acceptedImageMimeTypes:t,acceptedVideoMimeTypes:r}),l.push(o==null?void 0:o(a)),()=>{l.forEach(c=>c==null?void 0:c())}});return b.useLayoutEffect(()=>{if(s)return i==null?void 0:i(s)},[s,i]),null}function Tee(e){const n=b.useRef();return b.useLayoutEffect(()=>{n.current=e}),b.useDebugValue(e),b.useCallback((...t)=>{const r=n.current;return oi(r,"fn does not exist"),r(...t)},[])}const $ee=1,Mee=Pe({tldrawFileFormatVersion:E5,schema:Pe({schemaVersion:Bu,storeVersion:Bu,recordVersions:Sy(me,Pe({version:Bu,subTypeVersions:Sy(me,Bu).optional(),subTypeKey:me.optional()}))}),records:ln(Pe({id:me,typeName:me}).allowUnknownProperties())});function Aee(e){var n;try{return!!((n=e.document)!=null&&n.version)}catch{return!1}}function Oee({json:e,schema:n}){let t;try{t=Mee.validate(JSON.parse(e))}catch(o){try{if(t=JSON.parse(e),Aee(t))return Ks.err({type:"v1File",data:t})}catch{}return Ks.err({type:"notATldrawFile",cause:o})}if(t.tldrawFileFormatVersion>$ee)return Ks.err({type:"fileFormatVersionTooNew",version:t.tldrawFileFormatVersion});let r;try{const o=Object.fromEntries(t.records.map(s=>[s.id,s]));r=n.migrateStoreSnapshot({store:o,schema:t.schema})}catch(o){return Ks.err({type:"invalidRecords",cause:o})}if(r.type==="error")return Ks.err({type:"migrationFailed",reason:r.reason});try{return Ks.ok(mE({initialData:r.value,schema:n}))}catch(o){return Ks.err({type:"invalidRecords",cause:o})}}function Ree(){const[e,n]=b.useState(null),[t,r]=b.useState(null),[o,s]=b.useState(null);b.useEffect(()=>{const a=(l,c
|
|
315
|
+
}`,()=>{document.fonts.delete(y),h=!0}},[e,n]),t};function Eee(e){return{draw:{url:e.fonts.draw},serif:{url:e.fonts.serif},sansSerif:{url:e.fonts.sansSerif},monospace:{url:e.fonts.monospace}}}function kee(e){const n=b.useMemo(()=>Eee(e),[e]),t=[zd("tldraw_draw",n.draw),zd("tldraw_serif",n.serif),zd("tldraw_sans",n.sansSerif),zd("tldraw_mono",n.monospace)];return{error:t.some(r=>r===1),done:!t.some(r=>r===2)}}function Iee(e){const{children:n,maxImageDimension:t,maxAssetSize:r,acceptedImageMimeTypes:o,acceptedVideoMimeTypes:s,onMount:i,...a}=e,l=sL(a.components??{}),c=Cx(a.shapeUtils??[]),u=Cx(a.tools??[]),d={initialState:"select",...a,components:b.useMemo(()=>({Scribble:vb,CollaboratorScribble:vb,SelectionForeground:fU,SelectionBackground:hU,Handles:iU,HoveredShapeIndicator:aU,...l}),[l]),shapeUtils:b.useMemo(()=>[...IV,...c],[c]),tools:b.useMemo(()=>[...BV,...iH,...u],[u])},h=DG(a.assetUrls),{done:p,error:y}=kee(h);return y?g.jsx(tL,{children:"Could not load assets. Please refresh the page."}):p?g.jsx(Zj,{...d,children:g.jsxs(tee,{...d,children:[g.jsx(Cee,{children:g.jsx(Av,{})}),g.jsx(_ee,{maxImageDimension:t,maxAssetSize:r,acceptedImageMimeTypes:o,acceptedVideoMimeTypes:s,onMount:i}),n]})}):g.jsx(wE,{children:"Loading assets..."})}function _ee({maxImageDimension:e=1e3,maxAssetSize:n=10*1024*1024,acceptedImageMimeTypes:t=["image/jpeg","image/png","image/gif","image/svg+xml"],acceptedVideoMimeTypes:r=["video/mp4","video/quicktime"],onMount:o}){const s=K(),i=Tee(a=>{const l=[];return l.push(..._V(a)),GU(a,{maxImageDimension:e,maxAssetSize:n,acceptedImageMimeTypes:t,acceptedVideoMimeTypes:r}),l.push(o==null?void 0:o(a)),()=>{l.forEach(c=>c==null?void 0:c())}});return b.useLayoutEffect(()=>{if(s)return i==null?void 0:i(s)},[s,i]),null}function Tee(e){const n=b.useRef();return b.useLayoutEffect(()=>{n.current=e}),b.useDebugValue(e),b.useCallback((...t)=>{const r=n.current;return oi(r,"fn does not exist"),r(...t)},[])}const $ee=1,Mee=Pe({tldrawFileFormatVersion:E5,schema:Pe({schemaVersion:Bu,storeVersion:Bu,recordVersions:Sy(me,Pe({version:Bu,subTypeVersions:Sy(me,Bu).optional(),subTypeKey:me.optional()}))}),records:ln(Pe({id:me,typeName:me}).allowUnknownProperties())});function Aee(e){var n;try{return!!((n=e.document)!=null&&n.version)}catch{return!1}}function Oee({json:e,schema:n}){let t;try{t=Mee.validate(JSON.parse(e))}catch(o){try{if(t=JSON.parse(e),Aee(t))return Ks.err({type:"v1File",data:t})}catch{}return Ks.err({type:"notATldrawFile",cause:o})}if(t.tldrawFileFormatVersion>$ee)return Ks.err({type:"fileFormatVersionTooNew",version:t.tldrawFileFormatVersion});let r;try{const o=Object.fromEntries(t.records.map(s=>[s.id,s]));r=n.migrateStoreSnapshot({store:o,schema:t.schema})}catch(o){return Ks.err({type:"invalidRecords",cause:o})}if(r.type==="error")return Ks.err({type:"migrationFailed",reason:r.reason});try{return Ks.ok(mE({initialData:r.value,schema:n}))}catch(o){return Ks.err({type:"invalidRecords",cause:o})}}function Ree(){const[e,n]=b.useState(null),[t,r]=b.useState(null),[o,s]=b.useState(null);b.useEffect(()=>{const a=(l,c)=>{n(c),r(l)};window.tldrawExportFile=a},[]),b.useEffect(()=>{if(o&&e&&t){console.log(`tldraw is exporting to ${e}`);try{Dee(o,t)}catch(a){console.error(`error parsing and loading data: ${String(a)}`)}f$(o,[],e,{}).then(()=>{console.log("exported data successfully")}).catch(a=>{console.error(`error exporting data: ${a}`)})}},[o,t,e]);const i=a=>{o||(console.log("tldraw is ready"),s(a))};return g.jsx("div",{style:{inset:0,position:"fixed"},children:g.jsx(Iee,{assetUrls:LA(),onMount:i})})}function Dee(e,n){const t=Oee({json:n,schema:e.store.schema});if(!t.ok)throw new Error(String(t.error));nr(()=>{const{isFocused:r}=e.getInstanceState();e.store.clear();const[o,s]=jee(t.value.allRecords(),a=>a.typeName==="shape");e.store.put(s,"initialize"),e.store.put(o,"initialize"),e.history.clear(),e.updateViewportScreenBounds();const i=e.getCurrentPageBounds();i&&e.zoomToBounds(i,1),e.updateInstanceState({isFocused:r})})}function jee(e,n){const t=[],r=[];for(const o of e)n(o)?t.push(o):r.push(o);return[t,r]}var av={},LC=il;av.createRoot=LC.createRoot,av.hydrateRoot=LC.hydrateRoot;av.createRoot(document.querySelector("#root")).render(g.jsx(ne.StrictMode,{children:g.jsx(Ree,{})}));
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
<meta charset="UTF-8" />
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
6
|
<title>tldraw export helper</title>
|
|
7
|
-
<script type="module" crossorigin src="/assets/index-
|
|
7
|
+
<script type="module" crossorigin src="/assets/index-a71XA0Xq.js"></script>
|
|
8
8
|
<link rel="stylesheet" crossorigin href="/assets/index-Go1mR3Ch.css">
|
|
9
9
|
</head>
|
|
10
10
|
<body>
|
package/dist/types.d.ts
ADDED