create-pixi-vn 2.0.13 → 2.0.14
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/dist/index.mjs +36 -35
- package/package.json +1 -1
- package/template-react-vite-muijoy/components.json +1 -1
- package/template-react-vite-muijoy/package-lock.json +663 -967
- package/template-react-vite-muijoy/package.json +10 -11
- package/template-react-vite-muijoy/src/components/dev-devtools.tsx +25 -0
- package/template-react-vite-muijoy/src/components/menus/settings/menus/history.tsx +78 -62
- package/template-react-vite-muijoy/src/components/screens/narration/index.tsx +5 -2
- package/template-react-vite-muijoy/src/components/ui/alert-dialog.tsx +3 -2
- package/template-react-vite-muijoy/src/components/ui/avatar.tsx +2 -2
- package/template-react-vite-muijoy/src/components/ui/breadcrumb.tsx +5 -4
- package/template-react-vite-muijoy/src/components/ui/button-group.tsx +3 -2
- package/template-react-vite-muijoy/src/components/ui/button.tsx +2 -2
- package/template-react-vite-muijoy/src/components/ui/card.tsx +6 -10
- package/template-react-vite-muijoy/src/components/ui/carousel.tsx +10 -7
- package/template-react-vite-muijoy/src/components/ui/drawer.tsx +2 -0
- package/template-react-vite-muijoy/src/components/ui/field.tsx +8 -5
- package/template-react-vite-muijoy/src/components/ui/input-group.tsx +4 -3
- package/template-react-vite-muijoy/src/components/ui/input.tsx +1 -1
- package/template-react-vite-muijoy/src/components/ui/item.tsx +9 -8
- package/template-react-vite-muijoy/src/components/ui/label.tsx +1 -1
- package/template-react-vite-muijoy/src/components/ui/radio-group.tsx +4 -1
- package/template-react-vite-muijoy/src/components/ui/scroll-area.tsx +5 -2
- package/template-react-vite-muijoy/src/components/ui/select.tsx +3 -2
- package/template-react-vite-muijoy/src/components/ui/separator.tsx +2 -0
- package/template-react-vite-muijoy/src/components/ui/sonner.tsx +4 -4
- package/template-react-vite-muijoy/src/components/ui/spinner.tsx +2 -1
- package/template-react-vite-muijoy/src/components/ui/switch.tsx +3 -0
- package/template-react-vite-muijoy/src/components/ui/textarea.tsx +2 -1
- package/template-react-vite-muijoy/src/components/ui/tooltip.tsx +2 -0
- package/template-react-vite-muijoy/src/lib/hooks/hotkeys-hooks.ts +2 -0
- package/template-react-vite-muijoy/src/lib/hooks/narration-hooks.ts +24 -9
- package/template-react-vite-muijoy/src/lib/hooks/navigation-hooks.ts +29 -10
- package/template-react-vite-muijoy/src/main.tsx +0 -1
- package/{template-react-vite-muijoy-tauri/src/pixi-vn-keys.gen.d.ts → template-react-vite-muijoy/src/pixi-vn.keys.gen.ts} +4 -2
- package/template-react-vite-muijoy/src/routeTree.gen.ts +3 -21
- package/template-react-vite-muijoy/src/routes/__root.tsx +10 -20
- package/template-react-vite-muijoy/src/styles.css +43 -43
- package/template-react-vite-muijoy/vite.config.ts +1 -1
- package/template-react-vite-muijoy-ink/components.json +1 -1
- package/template-react-vite-muijoy-ink/package-lock.json +709 -1051
- package/template-react-vite-muijoy-ink/package.json +11 -12
- package/template-react-vite-muijoy-ink/src/components/dev-devtools.tsx +25 -0
- package/template-react-vite-muijoy-ink/src/components/menus/settings/menus/history.tsx +78 -62
- package/template-react-vite-muijoy-ink/src/components/screens/narration/index.tsx +5 -2
- package/template-react-vite-muijoy-ink/src/components/ui/alert-dialog.tsx +3 -2
- package/template-react-vite-muijoy-ink/src/components/ui/avatar.tsx +2 -2
- package/template-react-vite-muijoy-ink/src/components/ui/breadcrumb.tsx +5 -4
- package/template-react-vite-muijoy-ink/src/components/ui/button-group.tsx +3 -2
- package/template-react-vite-muijoy-ink/src/components/ui/button.tsx +2 -2
- package/template-react-vite-muijoy-ink/src/components/ui/card.tsx +6 -10
- package/template-react-vite-muijoy-ink/src/components/ui/carousel.tsx +10 -7
- package/template-react-vite-muijoy-ink/src/components/ui/drawer.tsx +2 -0
- package/template-react-vite-muijoy-ink/src/components/ui/field.tsx +8 -5
- package/template-react-vite-muijoy-ink/src/components/ui/input-group.tsx +4 -3
- package/template-react-vite-muijoy-ink/src/components/ui/input.tsx +1 -1
- package/template-react-vite-muijoy-ink/src/components/ui/item.tsx +9 -8
- package/template-react-vite-muijoy-ink/src/components/ui/label.tsx +1 -1
- package/template-react-vite-muijoy-ink/src/components/ui/radio-group.tsx +4 -1
- package/template-react-vite-muijoy-ink/src/components/ui/scroll-area.tsx +5 -2
- package/template-react-vite-muijoy-ink/src/components/ui/select.tsx +3 -2
- package/template-react-vite-muijoy-ink/src/components/ui/separator.tsx +2 -0
- package/template-react-vite-muijoy-ink/src/components/ui/sonner.tsx +4 -4
- package/template-react-vite-muijoy-ink/src/components/ui/spinner.tsx +2 -1
- package/template-react-vite-muijoy-ink/src/components/ui/switch.tsx +3 -0
- package/template-react-vite-muijoy-ink/src/components/ui/textarea.tsx +2 -1
- package/template-react-vite-muijoy-ink/src/components/ui/tooltip.tsx +2 -0
- package/template-react-vite-muijoy-ink/src/content/ink/hashtag-commands.ts +2 -1
- package/template-react-vite-muijoy-ink/src/lib/hooks/hotkeys-hooks.ts +2 -0
- package/template-react-vite-muijoy-ink/src/lib/hooks/narration-hooks.ts +24 -9
- package/template-react-vite-muijoy-ink/src/lib/hooks/navigation-hooks.ts +29 -10
- package/template-react-vite-muijoy-ink/src/main.tsx +0 -1
- package/template-react-vite-muijoy-ink/src/pixi-vn.keys.gen.ts +24 -0
- package/template-react-vite-muijoy-ink/src/routeTree.gen.ts +3 -21
- package/template-react-vite-muijoy-ink/src/routes/__root.tsx +10 -20
- package/template-react-vite-muijoy-ink/src/styles.css +43 -43
- package/template-react-vite-muijoy-ink/vite.config.ts +1 -1
- package/template-react-vite-muijoy-ink-tauri/components.json +1 -1
- package/template-react-vite-muijoy-ink-tauri/package-lock.json +709 -1051
- package/template-react-vite-muijoy-ink-tauri/package.json +11 -12
- package/template-react-vite-muijoy-ink-tauri/src/components/dev-devtools.tsx +25 -0
- package/template-react-vite-muijoy-ink-tauri/src/components/menus/settings/menus/history.tsx +78 -62
- package/template-react-vite-muijoy-ink-tauri/src/components/screens/narration/index.tsx +5 -2
- package/template-react-vite-muijoy-ink-tauri/src/components/ui/alert-dialog.tsx +3 -2
- package/template-react-vite-muijoy-ink-tauri/src/components/ui/avatar.tsx +2 -2
- package/template-react-vite-muijoy-ink-tauri/src/components/ui/breadcrumb.tsx +5 -4
- package/template-react-vite-muijoy-ink-tauri/src/components/ui/button-group.tsx +3 -2
- package/template-react-vite-muijoy-ink-tauri/src/components/ui/button.tsx +2 -2
- package/template-react-vite-muijoy-ink-tauri/src/components/ui/card.tsx +6 -10
- package/template-react-vite-muijoy-ink-tauri/src/components/ui/carousel.tsx +10 -7
- package/template-react-vite-muijoy-ink-tauri/src/components/ui/drawer.tsx +2 -0
- package/template-react-vite-muijoy-ink-tauri/src/components/ui/field.tsx +8 -5
- package/template-react-vite-muijoy-ink-tauri/src/components/ui/input-group.tsx +4 -3
- package/template-react-vite-muijoy-ink-tauri/src/components/ui/input.tsx +1 -1
- package/template-react-vite-muijoy-ink-tauri/src/components/ui/item.tsx +9 -8
- package/template-react-vite-muijoy-ink-tauri/src/components/ui/label.tsx +1 -1
- package/template-react-vite-muijoy-ink-tauri/src/components/ui/radio-group.tsx +4 -1
- package/template-react-vite-muijoy-ink-tauri/src/components/ui/scroll-area.tsx +5 -2
- package/template-react-vite-muijoy-ink-tauri/src/components/ui/select.tsx +3 -2
- package/template-react-vite-muijoy-ink-tauri/src/components/ui/separator.tsx +2 -0
- package/template-react-vite-muijoy-ink-tauri/src/components/ui/sonner.tsx +4 -4
- package/template-react-vite-muijoy-ink-tauri/src/components/ui/spinner.tsx +2 -1
- package/template-react-vite-muijoy-ink-tauri/src/components/ui/switch.tsx +3 -0
- package/template-react-vite-muijoy-ink-tauri/src/components/ui/textarea.tsx +2 -1
- package/template-react-vite-muijoy-ink-tauri/src/components/ui/tooltip.tsx +2 -0
- package/template-react-vite-muijoy-ink-tauri/src/content/ink/hashtag-commands.ts +2 -1
- package/template-react-vite-muijoy-ink-tauri/src/lib/hooks/hotkeys-hooks.ts +2 -0
- package/template-react-vite-muijoy-ink-tauri/src/lib/hooks/narration-hooks.ts +24 -9
- package/template-react-vite-muijoy-ink-tauri/src/lib/hooks/navigation-hooks.ts +29 -10
- package/template-react-vite-muijoy-ink-tauri/src/main.tsx +0 -1
- package/{template-react-vite-muijoy-ink/src/pixi-vn-keys.gen.d.ts → template-react-vite-muijoy-ink-tauri/src/pixi-vn.keys.gen.ts} +4 -2
- package/template-react-vite-muijoy-ink-tauri/src/routeTree.gen.ts +3 -21
- package/template-react-vite-muijoy-ink-tauri/src/routes/__root.tsx +10 -20
- package/template-react-vite-muijoy-ink-tauri/src/styles.css +43 -43
- package/template-react-vite-muijoy-ink-tauri/vite.config.ts +1 -1
- package/template-react-vite-muijoy-tauri/components.json +1 -1
- package/template-react-vite-muijoy-tauri/package-lock.json +663 -967
- package/template-react-vite-muijoy-tauri/package.json +10 -11
- package/template-react-vite-muijoy-tauri/src/components/dev-devtools.tsx +25 -0
- package/template-react-vite-muijoy-tauri/src/components/menus/settings/menus/history.tsx +78 -62
- package/template-react-vite-muijoy-tauri/src/components/screens/narration/index.tsx +5 -2
- package/template-react-vite-muijoy-tauri/src/components/ui/alert-dialog.tsx +3 -2
- package/template-react-vite-muijoy-tauri/src/components/ui/avatar.tsx +2 -2
- package/template-react-vite-muijoy-tauri/src/components/ui/breadcrumb.tsx +5 -4
- package/template-react-vite-muijoy-tauri/src/components/ui/button-group.tsx +3 -2
- package/template-react-vite-muijoy-tauri/src/components/ui/button.tsx +2 -2
- package/template-react-vite-muijoy-tauri/src/components/ui/card.tsx +6 -10
- package/template-react-vite-muijoy-tauri/src/components/ui/carousel.tsx +10 -7
- package/template-react-vite-muijoy-tauri/src/components/ui/drawer.tsx +2 -0
- package/template-react-vite-muijoy-tauri/src/components/ui/field.tsx +8 -5
- package/template-react-vite-muijoy-tauri/src/components/ui/input-group.tsx +4 -3
- package/template-react-vite-muijoy-tauri/src/components/ui/input.tsx +1 -1
- package/template-react-vite-muijoy-tauri/src/components/ui/item.tsx +9 -8
- package/template-react-vite-muijoy-tauri/src/components/ui/label.tsx +1 -1
- package/template-react-vite-muijoy-tauri/src/components/ui/radio-group.tsx +4 -1
- package/template-react-vite-muijoy-tauri/src/components/ui/scroll-area.tsx +5 -2
- package/template-react-vite-muijoy-tauri/src/components/ui/select.tsx +3 -2
- package/template-react-vite-muijoy-tauri/src/components/ui/separator.tsx +2 -0
- package/template-react-vite-muijoy-tauri/src/components/ui/sonner.tsx +4 -4
- package/template-react-vite-muijoy-tauri/src/components/ui/spinner.tsx +2 -1
- package/template-react-vite-muijoy-tauri/src/components/ui/switch.tsx +3 -0
- package/template-react-vite-muijoy-tauri/src/components/ui/textarea.tsx +2 -1
- package/template-react-vite-muijoy-tauri/src/components/ui/tooltip.tsx +2 -0
- package/template-react-vite-muijoy-tauri/src/lib/hooks/hotkeys-hooks.ts +2 -0
- package/template-react-vite-muijoy-tauri/src/lib/hooks/narration-hooks.ts +24 -9
- package/template-react-vite-muijoy-tauri/src/lib/hooks/navigation-hooks.ts +29 -10
- package/template-react-vite-muijoy-tauri/src/main.tsx +0 -1
- package/{template-react-vite-muijoy-ink-tauri/src/pixi-vn-keys.gen.d.ts → template-react-vite-muijoy-tauri/src/pixi-vn.keys.gen.ts} +4 -4
- package/template-react-vite-muijoy-tauri/src/routeTree.gen.ts +3 -21
- package/template-react-vite-muijoy-tauri/src/routes/__root.tsx +10 -20
- package/template-react-vite-muijoy-tauri/src/styles.css +43 -43
- package/template-react-vite-muijoy-tauri/vite.config.ts +1 -1
- package/template-react-vite-muijoy/src/pixi-vn-keys.gen.d.ts +0 -20
- package/template-react-vite-muijoy/src/routes/narration.tsx +0 -9
- package/template-react-vite-muijoy-ink/src/routes/narration.tsx +0 -9
- package/template-react-vite-muijoy-ink-tauri/src/routes/narration.tsx +0 -9
- package/template-react-vite-muijoy-tauri/src/routes/narration.tsx +0 -9
package/dist/index.mjs
CHANGED
|
@@ -1,65 +1,66 @@
|
|
|
1
|
-
import{styleText as l}from"node:util";import G,{stdin as Ce,stdout as ve}from"node:process";import*as oe from"node:readline";import ut from"node:readline";import{ReadStream as Oe}from"node:tty";import E from"node:fs";import A from"node:path";import{execa as K}from"execa";import ct from"open";import Le from"which";import{fileURLToPath as lt}from"node:url";const pt=(()=>{const e=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g;return t=>{let r=0;for(e.lastIndex=0;e.test(t);)r+=1;return t.length-r}})(),ft=e=>e===12288||e>=65281&&e<=65376||e>=65504&&e<=65510,ht=e=>e===8987||e===9001||e>=12272&&e<=12287||e>=12289&&e<=12350||e>=12441&&e<=12543||e>=12549&&e<=12591||e>=12593&&e<=12686||e>=12688&&e<=12771||e>=12783&&e<=12830||e>=12832&&e<=12871||e>=12880&&e<=19903||e>=65040&&e<=65049||e>=65072&&e<=65106||e>=65108&&e<=65126||e>=65128&&e<=65131||e>=127488&&e<=127490||e>=127504&&e<=127547||e>=127552&&e<=127560||e>=131072&&e<=196605||e>=196608&&e<=262141,dt=/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]|\u001b\]8;[^;]*;.*?(?:\u0007|\u001b\u005c)/y,mt=/[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y,Ne=/(?:(?![\uFF61-\uFF9F\uFF00-\uFFEF])[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}\p{Script=Tangut}]){1,1000}/yu,gt=/\t{1,1000}/y,je=new RegExp("[\\u{1F1E6}-\\u{1F1FF}]{2}|\\u{1F3F4}[\\u{E0061}-\\u{E007A}]{2}[\\u{E0030}-\\u{E0039}\\u{E0061}-\\u{E007A}]{1,3}\\u{E007F}|(?:\\p{Emoji}\\uFE0F\\u20E3?|\\p{Emoji_Modifier_Base}\\p{Emoji_Modifier}?|\\p{Emoji_Presentation})(?:\\u200D(?:\\p{Emoji_Modifier_Base}\\p{Emoji_Modifier}?|\\p{Emoji_Presentation}|\\p{Emoji}\\uFE0F\\u20E3?))*","yu"),vt=/(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y,wt=new RegExp("\\p{M}+","gu")
|
|
2
|
-
`);let
|
|
3
|
-
`){a&&(i+=Ge(""));const
|
|
1
|
+
import{styleText as l}from"node:util";import G,{stdin as Ce,stdout as ve}from"node:process";import*as oe from"node:readline";import ut from"node:readline";import{ReadStream as Oe}from"node:tty";import E from"node:fs";import A from"node:path";import{execa as K}from"execa";import ct from"open";import Le from"which";import{fileURLToPath as lt}from"node:url";const pt=(()=>{const e=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g;return t=>{let r=0;for(e.lastIndex=0;e.test(t);)r+=1;return t.length-r}})(),ft=e=>e===12288||e>=65281&&e<=65376||e>=65504&&e<=65510,ht=e=>e===8987||e===9001||e>=12272&&e<=12287||e>=12289&&e<=12350||e>=12441&&e<=12543||e>=12549&&e<=12591||e>=12593&&e<=12686||e>=12688&&e<=12771||e>=12783&&e<=12830||e>=12832&&e<=12871||e>=12880&&e<=19903||e>=65040&&e<=65049||e>=65072&&e<=65106||e>=65108&&e<=65126||e>=65128&&e<=65131||e>=127488&&e<=127490||e>=127504&&e<=127547||e>=127552&&e<=127560||e>=131072&&e<=196605||e>=196608&&e<=262141,dt=/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]|\u001b\]8;[^;]*;.*?(?:\u0007|\u001b\u005c)/y,mt=/[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y,Ne=/(?:(?![\uFF61-\uFF9F\uFF00-\uFFEF])[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}\p{Script=Tangut}]){1,1000}/yu,gt=/\t{1,1000}/y,je=new RegExp("[\\u{1F1E6}-\\u{1F1FF}]{2}|\\u{1F3F4}[\\u{E0061}-\\u{E007A}]{2}[\\u{E0030}-\\u{E0039}\\u{E0061}-\\u{E007A}]{1,3}\\u{E007F}|(?:\\p{Emoji}\\uFE0F\\u20E3?|\\p{Emoji_Modifier_Base}\\p{Emoji_Modifier}?|\\p{Emoji_Presentation})(?:\\u200D(?:\\p{Emoji_Modifier_Base}\\p{Emoji_Modifier}?|\\p{Emoji_Presentation}|\\p{Emoji}\\uFE0F\\u20E3?))*","yu"),vt=/(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y,wt=new RegExp("\\p{M}+","gu"),$t={limit:1/0,ellipsis:""},De=(e,t={},r={})=>{const i=t.limit??1/0,n=t.ellipsis??"",a=t?.ellipsisWidth??(n?De(n,$t,r).width:0),s=0,o=r.controlWidth??0,u=r.tabWidth??8,c=r.emojiWidth??2,w=2,m=r.regularWidth??1,p=r.wideWidth??w,g=[[vt,m],[dt,s],[mt,o],[gt,u],[je,c],[Ne,p]];let h=0,f=0,v=e.length,I=0,j=!1,k=v,S=Math.max(0,i-a),_=0,b=0,d=0,y=0;e:for(;;){if(b>_||f>=v&&f>h){const x=e.slice(_,b)||e.slice(h,f);I=0;for(const $ of x.replaceAll(wt,"")){const C=$.codePointAt(0)||0;if(ft(C)?y=w:ht(C)?y=p:y=m,d+y>S&&(k=Math.min(k,Math.max(_,h)+I)),d+y>i){j=!0;break e}I+=$.length,d+=y}_=b=0}if(f>=v)break e;for(let x=0,$=g.length;x<$;x++){const[C,V]=g[x];if(C.lastIndex=f,C.test(e)){if(I=C===Ne?pt(e.slice(f,C.lastIndex)):C===je?1:C.lastIndex-f,y=I*V,d+y>S&&(k=Math.min(k,f+Math.floor((S-d)/V))),d+y>i){j=!0;break e}d+=y,_=h,b=f,f=h=C.lastIndex;continue e}}f+=1}return{width:j?S:d,index:j?k:v,truncated:j,ellipsed:j&&i>=a}},yt={limit:1/0,ellipsis:"",ellipsisWidth:0},J=(e,t={})=>De(e,yt,t).width,ue="\x1B",Me="\x9B",bt=39,we="\x07",Ve="[",Et="]",Ue="m",$e=`${Et}8;;`,Pe=new RegExp(`(?:\\${Ve}(?<code>\\d+)m|\\${$e}(?<uri>.*)${we})`,"y"),Be=e=>{if(e>=30&&e<=37||e>=90&&e<=97)return 39;if(e>=40&&e<=47||e>=100&&e<=107)return 49;if(e===1||e===2)return 22;if(e===3)return 23;if(e===4)return 24;if(e===7)return 27;if(e===8)return 28;if(e===9)return 29;if(e===0)return 0},We=e=>`${ue}${Ve}${e}${Ue}`,Ge=e=>`${ue}${$e}${e}${we}`,ye=(e,t,r)=>{const i=t[Symbol.iterator]();let n=!1,a=!1,s=e.at(-1),o=s===void 0?0:J(s),u=i.next(),c=i.next(),w=0;for(;!u.done;){const m=u.value,p=J(m);o+p<=r?e[e.length-1]+=m:(e.push(m),o=0),(m===ue||m===Me)&&(n=!0,a=t.startsWith($e,w+1)),n?a?m===we&&(n=!1,a=!1):m===Ue&&(n=!1):(o+=p,o===r&&!c.done&&(e.push(""),o=0)),u=c,c=i.next(),w+=m.length}s=e.at(-1),!o&&s!==void 0&&s.length&&e.length>1&&(e[e.length-2]+=e.pop())},It=e=>{const t=e.split(" ");let r=t.length;for(;r&&!J(t[r-1]);)r--;return r===t.length?e:t.slice(0,r).join(" ")+t.slice(r).join("")},St=(e,t,r={})=>{if(r.trim!==!1&&e.trim()==="")return"";let i="",n,a;const s=e.split(" ");let o=[""],u=0;for(let m=0;m<s.length;m++){const p=s[m];if(r.trim!==!1){const h=o.at(-1)??"",f=h.trimStart();h.length!==f.length&&(o[o.length-1]=f,u=J(f))}m!==0&&(u>=t&&(r.wordWrap===!1||r.trim===!1)&&(o.push(""),u=0),(u||r.trim===!1)&&(o[o.length-1]+=" ",u++));const g=J(p);if(r.hard&&g>t){const h=t-u,f=1+Math.floor((g-h-1)/t);Math.floor((g-1)/t)<f&&o.push(""),ye(o,p,t),u=J(o.at(-1)??"");continue}if(u+g>t&&u&&g){if(r.wordWrap===!1&&u<t){ye(o,p,t),u=J(o.at(-1)??"");continue}o.push(""),u=0}if(u+g>t&&r.wordWrap===!1){ye(o,p,t),u=J(o.at(-1)??"");continue}o[o.length-1]+=p,u+=g}r.trim!==!1&&(o=o.map(m=>It(m)));const c=o.join(`
|
|
2
|
+
`);let w=!1;for(let m=0;m<c.length;m++){const p=c[m];if(i+=p,w)w=!1;else if(w=p>="\uD800"&&p<="\uDBFF",w)continue;if(p===ue||p===Me){Pe.lastIndex=m+1;const h=Pe.exec(c)?.groups;if(h?.code!==void 0){const f=Number.parseFloat(h.code);n=f===bt?void 0:f}else h?.uri!==void 0&&(a=h.uri.length===0?void 0:h.uri)}if(c[m+1]===`
|
|
3
|
+
`){a&&(i+=Ge(""));const g=n?Be(n):void 0;n&&g&&(i+=We(g))}else p===`
|
|
4
4
|
`&&(n&&Be(n)&&(i+=We(n)),a&&(i+=Ge(a)))}return i},_t=/\r?\n/;function ee(e,t,r){return String(e).normalize().split(_t).map(i=>St(i,t,r)).join(`
|
|
5
|
-
`)}function
|
|
5
|
+
`)}function Tt(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var be,Ke;function Ft(){if(Ke)return be;Ke=1;const e="\x1B",t=`${e}[`,r="\x07",i={to(s,o){return o?`${t}${o+1};${s+1}H`:`${t}${s+1}G`},move(s,o){let u="";return s<0?u+=`${t}${-s}D`:s>0&&(u+=`${t}${s}C`),o<0?u+=`${t}${-o}A`:o>0&&(u+=`${t}${o}B`),u},up:(s=1)=>`${t}${s}A`,down:(s=1)=>`${t}${s}B`,forward:(s=1)=>`${t}${s}C`,backward:(s=1)=>`${t}${s}D`,nextLine:(s=1)=>`${t}E`.repeat(s),prevLine:(s=1)=>`${t}F`.repeat(s),left:`${t}G`,hide:`${t}?25l`,show:`${t}?25h`,save:`${e}7`,restore:`${e}8`},n={up:(s=1)=>`${t}S`.repeat(s),down:(s=1)=>`${t}T`.repeat(s)},a={screen:`${t}2J`,up:(s=1)=>`${t}1J`.repeat(s),down:(s=1)=>`${t}J`.repeat(s),line:`${t}2K`,lineEnd:`${t}K`,lineStart:`${t}1K`,lines(s){let o="";for(let u=0;u<s;u++)o+=this.line+(u<s-1?i.up():"");return s&&(o+=i.left),o}};return be={cursor:i,scroll:n,erase:a,beep:r},be}var L=Ft();function ce(e,t,r){if(!r.some(s=>!s.disabled))return e;const i=e+t,n=Math.max(r.length-1,0),a=i<0?n:i>n?0:i;return r[a].disabled?ce(a,t<0?-1:1,r):a}const xt=["up","down","left","right","space","enter","cancel"],H={actions:new Set(xt),aliases:new Map([["k","up"],["j","down"],["h","left"],["l","right"],["","cancel"],["escape","cancel"]]),messages:{cancel:"Canceled",error:"Something went wrong"},withGuide:!0};function Ee(e,t){if(typeof e=="string")return H.aliases.get(e)===t;for(const r of e)if(r!==void 0&&Ee(r,t))return!0;return!1}function Rt(e,t){if(e===t)return;const r=e.split(`
|
|
6
6
|
`),i=t.split(`
|
|
7
|
-
`),n=Math.max(r.length,i.length),a=[];for(let s=0;s<n;s++)r[s]!==i[s]&&a.push(s);return{lines:a,numLinesBefore:r.length,numLinesAfter:i.length,numLines:n}}const At=globalThis.process.platform.startsWith("win"),Ie=Symbol("clack:cancel");function D(e){return e===Ie}function le(e,t){const r=e;r.isTTY&&r.setRawMode(t)}function kt({input:e=Ce,output:t=ve,overwrite:r=!0,hideCursor:i=!0}={}){const n=oe.createInterface({input:e,output:t,prompt:"",tabSize:1});oe.emitKeypressEvents(e,n),e instanceof Oe&&e.isTTY&&e.setRawMode(!0);const a=(s,{name:o,sequence:u})=>{const c=String(s);if(Ee([c,o,u],"cancel")){i&&t.write(L.cursor.show),process.exit(0);return}if(!r)return;const
|
|
8
|
-
`).map((o,u,c)=>{const
|
|
7
|
+
`),n=Math.max(r.length,i.length),a=[];for(let s=0;s<n;s++)r[s]!==i[s]&&a.push(s);return{lines:a,numLinesBefore:r.length,numLinesAfter:i.length,numLines:n}}const At=globalThis.process.platform.startsWith("win"),Ie=Symbol("clack:cancel");function D(e){return e===Ie}function le(e,t){const r=e;r.isTTY&&r.setRawMode(t)}function kt({input:e=Ce,output:t=ve,overwrite:r=!0,hideCursor:i=!0}={}){const n=oe.createInterface({input:e,output:t,prompt:"",tabSize:1});oe.emitKeypressEvents(e,n),e instanceof Oe&&e.isTTY&&e.setRawMode(!0);const a=(s,{name:o,sequence:u})=>{const c=String(s);if(Ee([c,o,u],"cancel")){i&&t.write(L.cursor.show),process.exit(0);return}if(!r)return;const w=o==="return"?0:-1,m=o==="return"?-1:0;oe.moveCursor(t,w,m,()=>{oe.clearLine(t,1,()=>{e.once("keypress",a)})})};return i&&t.write(L.cursor.hide),e.once("keypress",a),()=>{e.off("keypress",a),i&&t.write(L.cursor.show),e instanceof Oe&&e.isTTY&&!At&&e.setRawMode(!1),n.terminal=!1,n.close()}}const Se=e=>"columns"in e&&typeof e.columns=="number"?e.columns:80,He=e=>"rows"in e&&typeof e.rows=="number"?e.rows:20;function pe(e,t,r,i=r,n=r,a){const s=Se(e??ve);return ee(t,s-r.length,{hard:!0,trim:!1}).split(`
|
|
8
|
+
`).map((o,u,c)=>{const w=o;return u===0?`${i}${w}`:u===c.length-1?`${n}${w}`:`${r}${w}`}).join(`
|
|
9
9
|
`)}function Ct(e,t){if("~standard"in e){const r=e["~standard"].validate(t);if(r instanceof Promise)throw new TypeError("Schema validation must be synchronous. Update `validate()` and remove any asynchronous logic.");return r.issues?.at(0)?.message}return e(t)}class _e{input;output;_abortSignal;rl;opts;_render;_track=!1;_prevFrame="";_subscribers=new Map;_cursor=0;state="initial";error="";value;userInput="";constructor(t,r=!0){const{input:i=Ce,output:n=ve,render:a,signal:s,...o}=t;this.opts=o,this.onKeypress=this.onKeypress.bind(this),this.close=this.close.bind(this),this.render=this.render.bind(this),this._render=a.bind(this),this._track=r,this._abortSignal=s,this.input=i,this.output=n}unsubscribe(){this._subscribers.clear()}setSubscriber(t,r){const i=this._subscribers.get(t)??[];i.push(r),this._subscribers.set(t,i)}on(t,r){this.setSubscriber(t,{cb:r})}once(t,r){this.setSubscriber(t,{cb:r,once:!0})}emit(t,...r){const i=this._subscribers.get(t)??[],n=[];for(const a of i)a.cb(...r),a.once&&n.push(()=>i.splice(i.indexOf(a),1));for(const a of n)a()}prompt(){return new Promise(t=>{if(this._abortSignal){if(this._abortSignal.aborted)return this.state="cancel",this.close(),t(Ie);this._abortSignal.addEventListener("abort",()=>{this.state="cancel",this.close()},{once:!0})}this.rl=ut.createInterface({input:this.input,tabSize:2,prompt:"",escapeCodeTimeout:50,terminal:!0}),this.rl.prompt(),this.opts.initialUserInput!==void 0&&this._setUserInput(this.opts.initialUserInput,!0),this.input.on("keypress",this.onKeypress),le(this.input,!0),this.output.on("resize",this.render),this.render(),this.once("submit",()=>{this.output.write(L.cursor.show),this.output.off("resize",this.render),le(this.input,!1),t(this.value)}),this.once("cancel",()=>{this.output.write(L.cursor.show),this.output.off("resize",this.render),le(this.input,!1),t(Ie)})})}_isActionKey(t,r){return t===" "}_shouldSubmit(t,r){return!0}_setValue(t){this.value=t,this.emit("value",this.value)}_setUserInput(t,r){this.userInput=t??"",this.emit("userInput",this.userInput),r&&this._track&&this.rl&&(this.rl.write(this.userInput),this._cursor=this.rl.cursor)}_clearUserInput(){this.rl?.write(null,{ctrl:!0,name:"u"}),this._setUserInput("")}onKeypress(t,r){if(this._track&&r.name!=="return"&&(r.name&&this._isActionKey(t,r)&&this.rl?.write(null,{ctrl:!0,name:"h"}),this._cursor=this.rl?.cursor??0,this._setUserInput(this.rl?.line)),this.state==="error"&&(this.state="active"),r?.name&&(!this._track&&H.aliases.has(r.name)&&this.emit("cursor",H.aliases.get(r.name)),H.actions.has(r.name)&&this.emit("cursor",r.name)),t&&(t.toLowerCase()==="y"||t.toLowerCase()==="n")&&this.emit("confirm",t.toLowerCase()==="y"),this.emit("key",t,r),r?.name==="return"&&this._shouldSubmit(t,r)){if(this.opts.validate){const i=Ct(this.opts.validate,this.value);i&&(this.error=i instanceof Error?i.message:i,this.state="error",this.rl?.write(this.userInput))}this.state!=="error"&&(this.state="submit")}Ee([t,r?.name,r?.sequence],"cancel")&&(this.state="cancel"),(this.state==="submit"||this.state==="cancel")&&this.emit("finalize"),this.render(),(this.state==="submit"||this.state==="cancel")&&this.close()}close(){this.input.unpipe(),this.input.removeListener("keypress",this.onKeypress),this.output.write(`
|
|
10
10
|
`),le(this.input,!1),this.rl?.close(),this.rl=void 0,this.emit(`${this.state}`,this.value),this.unsubscribe()}restoreCursor(){const t=ee(this._prevFrame,process.stdout.columns,{hard:!0,trim:!1}).split(`
|
|
11
11
|
`).length-1;this.output.write(L.cursor.move(-999,t*-1))}render(){const t=ee(this._render(this)??"",process.stdout.columns,{hard:!0,trim:!1});if(t!==this._prevFrame){if(this.state==="initial")this.output.write(L.cursor.hide);else{const r=Rt(this._prevFrame,t),i=He(this.output);if(this.restoreCursor(),r){const n=Math.max(0,r.numLinesAfter-i),a=Math.max(0,r.numLinesBefore-i);let s=r.lines.find(o=>o>=n);if(s===void 0){this._prevFrame=t;return}if(r.lines.length===1){this.output.write(L.cursor.move(0,s-a)),this.output.write(L.erase.lines(1));const o=t.split(`
|
|
12
12
|
`);this.output.write(o[s]),this._prevFrame=t,this.output.write(L.cursor.move(0,o.length-s-1));return}else if(r.lines.length>1){if(n<a)s=n;else{const u=s-a;u>0&&this.output.write(L.cursor.move(0,u))}this.output.write(L.erase.down());const o=t.split(`
|
|
13
13
|
`).slice(s);this.output.write(o.join(`
|
|
14
|
-
`)),this._prevFrame=t;return}}this.output.write(L.erase.down())}this.output.write(t),this.state==="initial"&&(this.state="active"),this._prevFrame=t}}}class Ot extends _e{get cursor(){return this.value?0:1}get _value(){return this.cursor===0}constructor(t){super(t,!1),this.value=!!t.initialValue,this.on("userInput",()=>{this.value=this._value}),this.on("confirm",r=>{this.output.write(L.cursor.move(0,-1)),this.value=r,this.state="submit",this.close()}),this.on("cursor",()=>{this.value=!this.value})}}class Lt extends _e{options;cursor=0;get _selectedValue(){return this.options[this.cursor]}changeValue(){this.value=this._selectedValue.value}constructor(t){super(t,!1),this.options=t.options;const r=this.options.findIndex(({value:n})=>n===t.initialValue),i=r===-1?0:r;this.cursor=this.options[i].disabled?ce(i,1,this.options):i,this.changeValue(),this.on("cursor",n=>{switch(n){case"left":case"up":this.cursor=ce(this.cursor,-1,this.options);break;case"down":case"right":this.cursor=ce(this.cursor,1,this.options);break}this.changeValue()})}}class Nt extends _e{get userInputWithCursor(){if(this.state==="submit")return this.userInput;const t=this.userInput;if(this.cursor>=t.length)return`${this.userInput}\u2588`;const r=t.slice(0,this.cursor),[i,...n]=t.slice(this.cursor);return`${r}${l("inverse",i)}${n.join("")}`}get cursor(){return this._cursor}constructor(t){super({...t,initialUserInput:t.initialUserInput??t.initialValue}),this.on("userInput",r=>{this._setValue(r)}),this.on("finalize",()=>{this.value||(this.value=t.defaultValue),this.value===void 0&&(this.value="")})}}function jt(){return G.platform!=="win32"?G.env.TERM!=="linux":!!G.env.CI||!!G.env.WT_SESSION||!!G.env.TERMINUS_SUBLIME||G.env.ConEmuTask==="{cmd::Cmder}"||G.env.TERM_PROGRAM==="Terminus-Sublime"||G.env.TERM_PROGRAM==="vscode"||G.env.TERM==="xterm-256color"||G.env.TERM==="alacritty"||G.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}const
|
|
15
|
-
`);
|
|
14
|
+
`)),this._prevFrame=t;return}}this.output.write(L.erase.down())}this.output.write(t),this.state==="initial"&&(this.state="active"),this._prevFrame=t}}}class Ot extends _e{get cursor(){return this.value?0:1}get _value(){return this.cursor===0}constructor(t){super(t,!1),this.value=!!t.initialValue,this.on("userInput",()=>{this.value=this._value}),this.on("confirm",r=>{this.output.write(L.cursor.move(0,-1)),this.value=r,this.state="submit",this.close()}),this.on("cursor",()=>{this.value=!this.value})}}class Lt extends _e{options;cursor=0;get _selectedValue(){return this.options[this.cursor]}changeValue(){this.value=this._selectedValue.value}constructor(t){super(t,!1),this.options=t.options;const r=this.options.findIndex(({value:n})=>n===t.initialValue),i=r===-1?0:r;this.cursor=this.options[i].disabled?ce(i,1,this.options):i,this.changeValue(),this.on("cursor",n=>{switch(n){case"left":case"up":this.cursor=ce(this.cursor,-1,this.options);break;case"down":case"right":this.cursor=ce(this.cursor,1,this.options);break}this.changeValue()})}}class Nt extends _e{get userInputWithCursor(){if(this.state==="submit")return this.userInput;const t=this.userInput;if(this.cursor>=t.length)return`${this.userInput}\u2588`;const r=t.slice(0,this.cursor),[i,...n]=t.slice(this.cursor);return`${r}${l("inverse",i)}${n.join("")}`}get cursor(){return this._cursor}constructor(t){super({...t,initialUserInput:t.initialUserInput??t.initialValue}),this.on("userInput",r=>{this._setValue(r)}),this.on("finalize",()=>{this.value||(this.value=t.defaultValue),this.value===void 0&&(this.value="")})}}function jt(){return G.platform!=="win32"?G.env.TERM!=="linux":!!G.env.CI||!!G.env.WT_SESSION||!!G.env.TERMINUS_SUBLIME||G.env.ConEmuTask==="{cmd::Cmder}"||G.env.TERM_PROGRAM==="Terminus-Sublime"||G.env.TERM_PROGRAM==="vscode"||G.env.TERM==="xterm-256color"||G.env.TERM==="alacritty"||G.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}const Te=jt(),Dt=()=>process.env.CI==="true",B=(e,t)=>Te?e:t,Mt=B("\u25C6","*"),ze=B("\u25A0","x"),Ye=B("\u25B2","x"),Fe=B("\u25C7","o"),Vt=B("\u250C","T"),F=B("\u2502","|"),te=B("\u2514","\u2014"),xe=B("\u25CF",">"),fe=B("\u25CB"," "),Ut=B("\u25CF","\u2022"),Pt=B("\u25C6","*"),Bt=B("\u25B2","!"),Wt=B("\u25A0","x"),Re=e=>{switch(e){case"initial":case"active":return l("cyan",Mt);case"cancel":return l("red",ze);case"error":return l("yellow",Ye);case"submit":return l("green",Fe)}},Gt=e=>{switch(e){case"initial":case"active":return l("cyan",F);case"cancel":return l("red",F);case"error":return l("yellow",F);case"submit":return l("green",F)}};function Kt(e,t){const r=[`${t?`${l("cyan",F)} `:""}${e.join(" \u2022 ")}`];return t&&r.push(l("cyan",te)),r}const qe=(e,t,r,i,n,a=!1)=>{let s=t,o=0;if(a)for(let u=i-1;u>=r&&(s-=e[u].length,o++,!(s<=n));u--);else for(let u=r;u<i&&(s-=e[u].length,o++,!(s<=n));u++);return{lineCount:s,removals:o}},Ht=({cursor:e,options:t,style:r,output:i=process.stdout,maxItems:n=Number.POSITIVE_INFINITY,columnPadding:a=0,rowPadding:s=4})=>{const o=Se(i)-a,u=He(i),c=l("dim","..."),w=Math.max(u-s,0),m=Math.max(Math.min(n,w),5);let p=0;e>=m-3&&(p=Math.max(Math.min(e-m+3,t.length-m),0));let g=m<t.length&&p>0,h=m<t.length&&p+m<t.length;const f=Math.min(p+m,t.length),v=[];let I=0;g&&I++,h&&I++;const j=p+(g?1:0),k=f-(h?1:0);for(let _=j;_<k;_++){const b=ee(r(t[_],_===e),o,{hard:!0,trim:!1}).split(`
|
|
15
|
+
`);v.push(b),I+=b.length}if(I>w){let _=0,b=0,d=I;const y=e-j;let x=w;const $=()=>qe(v,d,0,y,x),C=()=>qe(v,d,y+1,v.length,x,!0);g?({lineCount:d,removals:_}=$(),d>x&&(h||(x-=1),{lineCount:d,removals:b}=C())):(h||(x-=1),{lineCount:d,removals:b}=C(),d>x&&(x-=1,{lineCount:d,removals:_}=$())),_>0&&(g=!0,v.splice(0,_)),b>0&&(h=!0,v.splice(v.length-b,b))}const S=[];g&&S.push(c);for(const _ of v)for(const b of _)S.push(b);return h&&S.push(c),S},Je=e=>{const t=e.active??"Yes",r=e.inactive??"No";return new Ot({active:t,inactive:r,signal:e.signal,input:e.input,output:e.output,initialValue:e.initialValue??!0,render(){const i=e.withGuide??H.withGuide,n=`${Re(this.state)} `,a=i?`${l("gray",F)} `:"",s=pe(e.output,e.message,a,n),o=`${i?`${l("gray",F)}
|
|
16
16
|
`:""}${s}
|
|
17
|
-
`,u=this.value?t:r;switch(this.state){case"submit":{const c=i?`${l("gray",
|
|
18
|
-
${l("gray",
|
|
19
|
-
${l("cyan",
|
|
17
|
+
`,u=this.value?t:r;switch(this.state){case"submit":{const c=i?`${l("gray",F)} `:"";return`${o}${c}${l("dim",u)}`}case"cancel":{const c=i?`${l("gray",F)} `:"";return`${o}${c}${l(["strikethrough","dim"],u)}${i?`
|
|
18
|
+
${l("gray",F)}`:""}`}default:{const c=i?`${l("cyan",F)} `:"",w=i?l("cyan",te):"";return`${o}${c}${this.value?`${l("green",xe)} ${t}`:`${l("dim",fe)} ${l("dim",t)}`}${e.vertical?i?`
|
|
19
|
+
${l("cyan",F)} `:`
|
|
20
20
|
`:` ${l("dim","/")} `}${this.value?`${l("dim",fe)} ${l("dim",r)}`:`${l("green",xe)} ${r}`}
|
|
21
|
-
${
|
|
22
|
-
`}}}}).prompt()},P={message:(e=[],{symbol:t=l("gray",
|
|
23
|
-
`);if(m.length>0){const[p,...
|
|
21
|
+
${w}
|
|
22
|
+
`}}}}).prompt()};`${l("dim","\u2191/\u2193")}`,`${l("dim","Space:")}`,`${l("dim","Enter:")}`;const P={message:(e=[],{symbol:t=l("gray",F),secondarySymbol:r=l("gray",F),output:i=process.stdout,spacing:n=1,withGuide:a}={})=>{const s=[],o=a??H.withGuide,u=o?r:"",c=o?`${t} `:"",w=o?`${r} `:"";for(let p=0;p<n;p++)s.push(u);const m=Array.isArray(e)?e:e.split(`
|
|
23
|
+
`);if(m.length>0){const[p,...g]=m;p.length>0?s.push(`${c}${p}`):s.push(o?t:"");for(const h of g)h.length>0?s.push(`${w}${h}`):s.push(o?r:"")}i.write(`${s.join(`
|
|
24
24
|
`)}
|
|
25
|
-
`)},info:(e,t)=>{P.message(e,{...t,symbol:l("blue",Ut)})},success:(e,t)=>{P.message(e,{...t,symbol:l("green",Pt)})},step:(e,t)=>{P.message(e,{...t,symbol:l("green",
|
|
25
|
+
`)},info:(e,t)=>{P.message(e,{...t,symbol:l("blue",Ut)})},success:(e,t)=>{P.message(e,{...t,symbol:l("green",Pt)})},step:(e,t)=>{P.message(e,{...t,symbol:l("green",Fe)})},warn:(e,t)=>{P.message(e,{...t,symbol:l("yellow",Bt)})},warning:(e,t)=>{P.warn(e,t)},error:(e,t)=>{P.message(e,{...t,symbol:l("red",Wt)})}},T=(e="",t)=>{const r=process.stdout,i=`${l("gray",te)} `;r.write(`${i}${l("red",e)}
|
|
26
26
|
|
|
27
|
-
`)},
|
|
28
|
-
`)},
|
|
27
|
+
`)},zt=(e="",t)=>{const r=process.stdout,i=`${l("gray",Vt)} `;r.write(`${i}${e}
|
|
28
|
+
`)},Yt=(e="",t)=>{const r=process.stdout,i=`${l("gray",F)}
|
|
29
29
|
${l("gray",te)} `;r.write(`${i}${e}
|
|
30
30
|
|
|
31
|
-
`)},
|
|
31
|
+
`)},qt=e=>l("magenta",e),Jt=({indicator:e="dots",onCancel:t,output:r=process.stdout,cancelMessage:i,errorMessage:n,frames:a=Te?["\u25D2","\u25D0","\u25D3","\u25D1"]:["\u2022","o","O","0"],delay:s=Te?80:120,signal:o,...u}={})=>{const c=Dt();let w,m,p=!1,g=!1,h="",f,v=performance.now();const I=Se(r),j=u?.styleFrame??qt,k=R=>{const W=R>1?n??H.messages.error:i??H.messages.cancel;g=R===1,p&&(U(W,R),g&&typeof t=="function"&&t())},S=()=>k(2),_=()=>k(1),b=()=>{process.on("uncaughtExceptionMonitor",S),process.on("unhandledRejection",S),process.on("SIGINT",_),process.on("SIGTERM",_),process.on("exit",k),o&&o.addEventListener("abort",_)},d=()=>{process.removeListener("uncaughtExceptionMonitor",S),process.removeListener("unhandledRejection",S),process.removeListener("SIGINT",_),process.removeListener("SIGTERM",_),process.removeListener("exit",k),o&&o.removeEventListener("abort",_)},y=()=>{if(f===void 0)return;c&&r.write(`
|
|
32
32
|
`);const R=ee(f,I,{hard:!0,trim:!1}).split(`
|
|
33
|
-
`);R.length>1&&r.write(L.cursor.up(R.length-1)),r.write(L.cursor.to(0)),r.write(L.erase.down())},
|
|
34
|
-
`);let W=0,Y=0
|
|
33
|
+
`);R.length>1&&r.write(L.cursor.up(R.length-1)),r.write(L.cursor.to(0)),r.write(L.erase.down())},x=R=>R.replace(/\.+$/,""),$=R=>{const W=(performance.now()-R)/1e3,Y=Math.floor(W/60),q=Math.floor(W%60);return Y>0?`[${Y}m ${q}s]`:`[${q}s]`},C=u.withGuide??H.withGuide,V=(R="")=>{p=!0,w=kt({output:r}),h=x(R),v=performance.now(),C&&r.write(`${l("gray",F)}
|
|
34
|
+
`);let W=0,Y=0;b(),m=setInterval(()=>{if(c&&h===f)return;y(),f=h;const q=j(a[W]);let ae;if(c)ae=`${q} ${h}...`;else if(e==="timer")ae=`${q} ${h} ${$(v)}`;else{const ot=".".repeat(Math.floor(Y)).slice(0,3);ae=`${q} ${h}${ot}`}const at=ee(ae,I,{hard:!0,trim:!1});r.write(at),W=W+1<a.length?W+1:0,Y=Y<4?Y+.125:0},s)},U=(R="",W=0,Y=!1)=>{if(!p)return;p=!1,clearInterval(m),y();const q=W===0?l("green",Fe):W===1?l("red",ze):l("red",Ye);h=R??h,Y||(e==="timer"?r.write(`${q} ${h} ${$(v)}
|
|
35
35
|
`):r.write(`${q} ${h}
|
|
36
|
-
`)),d(),
|
|
36
|
+
`)),d(),w()};return{start:V,stop:(R="")=>U(R,0),message:(R="")=>{h=x(R??h)},cancel:(R="")=>U(R,1),error:(R="")=>U(R,2),clear:()=>U("",0,!0),get isCancelled(){return g}}},Zt=[`${l("dim","\u2191/\u2193")} to navigate`,`${l("dim","Enter:")} confirm`],he=(e,t)=>e.includes(`
|
|
37
37
|
`)?e.split(`
|
|
38
38
|
`).map(r=>t(r)).join(`
|
|
39
|
-
`):t(e),X=e=>{const t=(r,i)=>{const n=r.label??String(r.value);switch(i){case"disabled":return`${l("gray",fe)} ${he(n,a=>l("gray",a))}${r.hint?` ${l("dim",`(${r.hint??"disabled"})`)}`:""}`;case"selected":return`${he(n,a=>l("dim",a))}`;case"active":return`${l("green",xe)} ${n}${r.hint?` ${l("dim",`(${r.hint})`)}`:""}`;case"cancelled":return`${he(n,a=>l(["strikethrough","dim"],a))}`;default:return`${l("dim",fe)} ${he(n,a=>l("dim",a))}`}};return new Lt({options:e.options,signal:e.signal,input:e.input,output:e.output,initialValue:e.initialValue,render(){const r=e.withGuide??H.withGuide,i=`${Re(this.state)} `,n=`${Gt(this.state)} `,a=pe(e.output,e.message,n,i),s=`${r?`${l("gray",
|
|
39
|
+
`):t(e),X=e=>{const t=(r,i)=>{const n=r.label??String(r.value);switch(i){case"disabled":return`${l("gray",fe)} ${he(n,a=>l("gray",a))}${r.hint?` ${l("dim",`(${r.hint??"disabled"})`)}`:""}`;case"selected":return`${he(n,a=>l("dim",a))}`;case"active":return`${l("green",xe)} ${n}${r.hint?` ${l("dim",`(${r.hint})`)}`:""}`;case"cancelled":return`${he(n,a=>l(["strikethrough","dim"],a))}`;default:return`${l("dim",fe)} ${he(n,a=>l("dim",a))}`}};return new Lt({options:e.options,signal:e.signal,input:e.input,output:e.output,initialValue:e.initialValue,render(){const r=e.withGuide??H.withGuide,i=`${Re(this.state)} `,n=`${Gt(this.state)} `,a=pe(e.output,e.message,n,i),s=`${r?`${l("gray",F)}
|
|
40
40
|
`:""}${a}
|
|
41
|
-
`;switch(this.state){case"submit":{const o=r?`${l("gray",
|
|
42
|
-
${l("gray",
|
|
43
|
-
`).length,
|
|
41
|
+
`;switch(this.state){case"submit":{const o=r?`${l("gray",F)} `:"",u=pe(e.output,t(this.options[this.cursor],"selected"),o);return`${s}${u}`}case"cancel":{const o=r?`${l("gray",F)} `:"",u=pe(e.output,t(this.options[this.cursor],"cancelled"),o);return`${s}${u}${r?`
|
|
42
|
+
${l("gray",F)}`:""}`}default:{const o=r?`${l("cyan",F)} `:"",u=s.split(`
|
|
43
|
+
`).length,c=Kt(Zt,r),w=c.join(`
|
|
44
|
+
`),m=c.length+1;return`${s}${o}${Ht({output:e.output,cursor:this.cursor,options:this.options,maxItems:e.maxItems,columnPadding:o.length,rowPadding:u+m,style:(p,g)=>t(p,p.disabled?"disabled":g?"active":"inactive")}).join(`
|
|
44
45
|
${o}`)}
|
|
45
|
-
${
|
|
46
|
-
`}}}}).prompt()};`${l("gray",
|
|
46
|
+
${w}
|
|
47
|
+
`}}}}).prompt()};`${l("gray",F)}`;const de=async(e,t)=>{for(const r of e){if(r.enabled===!1)continue;const i=Jt(t);i.start(r.title);const n=await r.task(i.message);i.stop(n||r.title)}},se=e=>new Nt({validate:e.validate,placeholder:e.placeholder,defaultValue:e.defaultValue,initialValue:e.initialValue,output:e.output,signal:e.signal,input:e.input,render(){const t=e?.withGuide??H.withGuide,r=`${`${t?`${l("gray",F)}
|
|
47
48
|
`:""}${Re(this.state)} `}${e.message}
|
|
48
|
-
`,i=e.placeholder?l("inverse",e.placeholder[0])+l("dim",e.placeholder.slice(1)):l(["inverse","hidden"],"_"),n=this.userInput?this.userInputWithCursor:i,a=this.value??"";switch(this.state){case"error":{const s=this.error?` ${l("yellow",this.error)}`:"",o=t?`${l("yellow",
|
|
49
|
+
`,i=e.placeholder?l("inverse",e.placeholder[0])+l("dim",e.placeholder.slice(1)):l(["inverse","hidden"],"_"),n=this.userInput?this.userInputWithCursor:i,a=this.value??"";switch(this.state){case"error":{const s=this.error?` ${l("yellow",this.error)}`:"",o=t?`${l("yellow",F)} `:"",u=t?l("yellow",te):"";return`${r.trim()}
|
|
49
50
|
${o}${n}
|
|
50
51
|
${u}${s}
|
|
51
|
-
`}case"submit":{const s=a?` ${l("dim",a)}`:"",o=t?l("gray",
|
|
52
|
-
${o}`:""}`}default:{const s=t?`${l("cyan",
|
|
52
|
+
`}case"submit":{const s=a?` ${l("dim",a)}`:"",o=t?l("gray",F):"";return`${r}${o}${s}`}case"cancel":{const s=a?` ${l(["strikethrough","dim"],a)}`:"",o=t?l("gray",F):"";return`${r}${o}${s}${a.trim()?`
|
|
53
|
+
${o}`:""}`}default:{const s=t?`${l("cyan",F)} `:"",o=t?l("cyan",te):"";return`${r}${s}${n}
|
|
53
54
|
${o}
|
|
54
|
-
`}}}}).prompt();let Q=!0;const re=typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{};let ne=0;if(re.process&&re.process.env&&re.process.stdout){const{FORCE_COLOR:e,NODE_DISABLE_COLORS:t,NO_COLOR:r,TERM:i,COLORTERM:n}=re.process.env;t||r||e==="0"?Q=!1:e==="1"||e==="2"||e==="3"?Q=!0:i==="dumb"?Q=!1:"CI"in re.process.env&&["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE","DRONE"].some(a=>a in re.process.env)?Q=!0:Q=process.stdout.isTTY,Q&&(process.platform==="win32"||n&&(n==="truecolor"||n==="24bit")?ne=3:i&&(i.endsWith("-256color")||i.endsWith("256"))?ne=2:ne=1)}let Ze={enabled:Q,supportLevel:ne};function me(e,t,r=1){const i=`\x1B[${e}m`,n=`\x1B[${t}m`,a=new RegExp(`\\x1b\\[${t}m`,"g");return s=>Ze.enabled&&Ze.supportLevel>=r?i+(""+s).replace(a,i)+n:""+s}const
|
|
55
|
-
GitHub Desktop: https://github.com/apps/desktop`)}}var ie=(e=>(e.VisualStudioCode="vscode",e.Cursor="cursor",e.VSCodium="codium",e.Other="other",e))(ie||{});async function ir({rootFolder:e,fileToOpen:t}){const r=await X({message:"Which IDE do you want to use?",options:[{value:ie.VisualStudioCode,label:"Visual Studio Code"},{value:ie.Cursor,label:"Cursor"},{value:ie.VSCodium,label:"VSCodium"},{value:ie.Other,label:"Other"}],initialValue:ie.VisualStudioCode});if(D(r)&&(F("Operation cancelled."),process.exit(0)),r===void 0)return;let i,n;switch(r){case"vscode":n="Opening in Visual Studio Code...",i="code";break;case"cursor":n="Opening in Cursor...",i="cursor";break;case"codium":n="Opening in VSCodium...",i="codium";break;default:return}await de([{title:n,task:async a=>{try{await Le(i);const s=await K(i,[e]);if(a(s.stdout),t){const o=await K(i,[`${e}/${t}`]);a(o.stdout)}return`Opened project using ${r}`}catch{return`Could not open project using ${r}, since ${r} was not in your PATH`}}}])}var z=(e=>(e[e.VisualNovel=0]="VisualNovel",e[e.TextStory=1]="TextStory",e[e.PointAndClick=2]="PointAndClick",e[e.GameEngine=3]="GameEngine",e[e.Library=4]="Library",e))(z||{}),O=(e=>(e[e.Ink=0]="Ink",e[e.Renpy=1]="Renpy",e[e.Typescript=2]="Typescript",e))(O||{}),M=(e=>(e[e.React=0]="React",e[e.Vue=1]="Vue",e[e.Angular=2]="Angular",e))(M||{});const Qe="My Game",Z=[{type:z.VisualNovel,name:"Visual Novel",availableUI:[M.React],availableNarrativeLanguages:[O.Ink,O.Typescript],isMultidevice:!0,canReplaceUI:!0},{type:z.TextStory,name:"Text-based Story",availableUI:[M.React],availableNarrativeLanguages:[O.Ink,O.Typescript],isMultidevice:!0,canReplaceUI:!1},{type:z.PointAndClick,name:"Point & Click Adventure",availableUI:[M.React],availableNarrativeLanguages:[O.Ink,O.Typescript],isMultidevice:!0,canReplaceUI:!1},{type:z.GameEngine,name:"Game Engine",availableUI:[],availableNarrativeLanguages:[],isMultidevice:!1,canReplaceUI:!1},{type:z.Library,name:"Library",availableUI:[],availableNarrativeLanguages:[],isMultidevice:!1,canReplaceUI:!1}];async function sr({packageName:e}){const t=await X({message:"Select the type of game you want to create:",options:Z.map(c=>({label:c.name,value:c.type})),initialValue:Z[0].type});D(t)&&(F("Operation cancelled."),process.exit(0));const r=Z.find(c=>c.type===t)?.availableUI.map(c=>{let v="";switch(c){case M.React:v=ge("React");break;case M.Vue:v=Zt("Vue");break;case M.Angular:v=Jt("Angular");break}return{label:v,value:c}})||[];let i;r.length===1?(P.warning(`Only one UI framework available: ${r[0].label}. Using it by default.`),i=r[0].value):r.length>0?(i=await X({message:"Select the UI framework you want to use:",options:r,initialValue:Z.find(c=>c.type===t)?.availableUI[0]}),D(i)&&(F("Operation cancelled."),process.exit(0))):i=void 0;const n=Z.find(c=>c.type===t)?.availableNarrativeLanguages.map(c=>{let v="";switch(c){case O.Ink:v="Ink + Typescript";break;case O.Renpy:v=Xt("Renpy");break;case O.Typescript:v=ge("Typescript");break}return{label:v,value:c}})||[];let a;n.length===1?(P.warning(`Only one narrative language available: ${n[0].label}. Using it by default.`),a=n[0].value):n.length>0?(a=await X({message:"Select the narrative language you want to use:",options:n,initialValue:Z.find(c=>c.type===t)?.availableNarrativeLanguages[0]}),D(a)&&(F("Operation cancelled."),process.exit(0))):a=void 0;const s=Z.find(c=>c.type===t)?.isMultidevice;let o=!1,u="";return s&&(o=await X({message:"Which devices is the project intended for?",options:[{label:"Web page",value:!1},{label:"Web page + Desktop + Mobile (Tauri)",value:!0}],initialValue:!1}),D(o)&&(F("Operation cancelled."),process.exit(0)),o?(u=await se({message:"Project identifier:",initialValue:`com.${e}.app`,validate:c=>{if(!c)return"Identifier is required.";if(!/^[a-zA-Z0-9_.\-]+$/.test(c))return"Identifier can only contain letters, numbers, underscores, dots and dashes."}}),D(u)&&(F("Operation cancelled."),process.exit(0))):u=""),{gameType:t,UIFramework:i,narrativeLanguage:a,multidevice:o,identifier:u}}var N=(e=>(e.Delete="delete",e.Overwrite="overwrite",e.Skip="skip",e.Ask="ask",e.Cancel="cancel",e))(N||{});function nr(e){const t=E.readdirSync(e);return t.length===0||t.length===1&&t[0]===".git"}function et(e,t,r){if(!E.existsSync(t))return;const i=E.statSync(t);if(i.isFile())(r===N.Overwrite||r===N.Delete)&&E.rmSync(t,{force:!0});else if(i.isDirectory()){const n=E.readdirSync(e);for(const a of n){const s=A.join(e,a),o=A.join(t,a);et(s,o,r)}}}function ke(e,t,r){if(E.statSync(e).isDirectory()){E.mkdirSync(t,{recursive:!0});for(const i of E.readdirSync(e)){const n=A.join(e,i),a=A.join(t,i);ke(n,a,r)}}else{if(r!==void 0&&E.existsSync(t)){if(r===N.Skip)return;(r===N.Overwrite||r===N.Delete)&&E.rmSync(t,{force:!0})}E.copyFileSync(e,t)}}function ar(e){return/^(?:@[a-z\d\-*~][a-z\d\-*._~]*\/)?[a-z\d\-~][a-z\d\-._~]*$/.test(e)}function tt(e){return e.trim().toLowerCase().replace(/\s+/g,"-").replace(/^[._]/,"").replace(/[^a-z\d\-~]+/g,"-")}async function or(){const e=await se({message:"Project name:",defaultValue:Qe,placeholder:Qe,validate:s=>{if(!s)return"Project name cannot be empty"}});D(e)&&(F("Operation cancelled."),process.exit(0));const t=await se({message:"Project description:",defaultValue:"A new game project",placeholder:"A new game project"});D(t)&&(F("Operation cancelled."),process.exit(0));const r=await se({message:"Package name:",defaultValue:tt(e),placeholder:tt(e),validate:s=>{if(s&&!ar(s))return"Invalid package name. The name can only include URL-friendly characters."}});D(r)&&(F("Operation cancelled."),process.exit(0));const i=A.basename(A.resolve()),n=await se({message:"Target directory:",defaultValue:r,placeholder:`${r} (If is equal to ".", the current directory (${i}) will be used)`});D(n)&&(F("Operation cancelled."),process.exit(0));let a;return E.existsSync(n)&&!nr(n)?(a=await X({message:"Overwrite existing files?",options:[{hint:"Delete all existing files and create a new project",label:"Delete all",value:N.Delete},{hint:"Overwrite existing conflicting files",label:"Overwrite",value:N.Overwrite},{hint:"Skip existing conflicting files",label:"Skip",value:N.Skip},{hint:"Ask for each file",label:"Ask",value:N.Ask},{hint:"Cancel operation",label:"Cancel",value:N.Cancel}],initialValue:N.Overwrite}),(D(a)||a===N.Cancel)&&(F("Operation cancelled."),process.exit(0))):a=void 0,{projectName:e,foltderName:n,description:t,packageName:r,overwrite:a}}const rt={_gitignore:".gitignore"};function it(e,t,r,i,n){return e=e.replace(/my-app-package-name/g,t),e=e.replace(/my-app-description/g,r),e=e.replace(/my-app-project-name/g,i),n&&(e=e.replace(/com\.my-app-project-name\.app/g,n)),e}function st(e,t,r,i,n){E.existsSync(e)&&E.writeFileSync(e,it(E.readFileSync(e,"utf-8"),t,r,i,n))}async function ur({rootFolder:e,overwrite:t,template:r,packageName:i,description:n,projectName:a,identifier:s}){const o=await de([{title:`Creating project in ${e}...`,task:async()=>{E.existsSync(e)||E.mkdirSync(e,{recursive:!0});const u=A.resolve(lt(import.meta.url),"../..",`${r}`),c=(w,h)=>{const f=A.join(e,rt[w]??w);h?E.writeFileSync(f,h):ke(A.join(u,w),f,t)},v=E.readdirSync(u).map(async w=>{const h=A.join(u,w),f=A.join(e,rt[w]??w);if(E.existsSync(f))switch(t){case N.Ask:if(E.statSync(f).isFile()){const g=await Je({message:`File ${f} already exists. Do you want to overwrite it?`,initialValue:!1});if(D(g)&&(F("Operation cancelled."),process.exit(0)),!g)return;E.rmSync(f,{force:!0})}else{const g=E.readdirSync(h);for(const I of g){const j=A.join(h,I),k=A.join(f,I);if(E.existsSync(k)){const S=await Je({message:`File ${k} already exists. Do you want to overwrite it?`,initialValue:!1});if(D(S)&&(F("Operation cancelled."),process.exit(0)),!S)continue;E.rmSync(k,{force:!0})}ke(j,k,t)}return}break;case N.Skip:return;case N.Overwrite:case N.Delete:et(h,f,t);break}switch(w){case"package.json":case"vite.config.ts":case"index.html":case"README.md":{c(w,it(E.readFileSync(h,"utf-8"),i,n,a));break}case".git":case"package-lock.json":break;default:c(w)}});await Promise.all(v),st(A.join(e,".vscode","launch.json"),i,n,a);const m=A.join(e,"src-tauri");if(E.existsSync(m))for(const w of["Cargo.toml","tauri.conf.json"])st(A.join(m,w),i,n,a,s);const p=A.join(e,"_github");return E.existsSync(p)&&E.renameSync(p,A.join(e,".github")),"Project created"}}]);D(o)&&(F("Operation cancelled."),process.exit(0))}const cr=process.cwd();async function lr(){let e,{description:t,overwrite:r,packageName:i,projectName:n,foltderName:a}=await or(),{UIFramework:s,gameType:o,narrativeLanguage:u,multidevice:c,identifier:v}=await sr({packageName:i});const m=A.join(cr,a);let p;switch(o){case z.VisualNovel:switch(s){case M.React:switch(u){case O.Typescript:c?p="template-react-vite-muijoy-tauri":p="template-react-vite-muijoy",e="src/content/labels/start.label.ts";break;case O.Ink:c?p="template-react-vite-muijoy-ink-tauri":p="template-react-vite-muijoy-ink",e="ink/start.ink";break;case O.Renpy:F("Error: There are no templates for this narrative language"),process.exit(0);default:F("Error: Unknown narrative language"),process.exit(0)}break;case M.Vue:case M.Angular:F("Error: There are no templates for this game type and UI framework"),process.exit(0);default:F("Error: Unknown UI framework"),process.exit(0)}break;case z.TextStory:switch(s){case M.React:switch(u){case O.Typescript:c?p="template-story-react-vite-muijoy-tauri":p="template-story-react-vite-muijoy",e="src/labels/startLabel.ts";break;case O.Ink:c?p="template-story-react-vite-muijoy-ink-tauri":p="template-story-react-vite-muijoy-ink",e="src/ink/start.ink";break;case O.Renpy:F("Error: There are no templates for this narrative language"),process.exit(0);default:F("Error: Unknown narrative language"),process.exit(0)}break;case M.Vue:case M.Angular:F("Error: There are no templates for this game type and UI framework"),process.exit(0);default:F("Error: Unknown UI framework"),process.exit(0)}break;case z.PointAndClick:switch(s){case M.React:switch(u){case O.Typescript:c?p="template-nqtr-react-vite-muijoy-tauri":p="template-nqtr-react-vite-muijoy",e="src/labels/startLabel.ts";break;case O.Ink:c?p="template-nqtr-react-vite-muijoy-ink-tauri":p="template-nqtr-react-vite-muijoy-ink",e="src/ink/variousActionsLabels.ink";break;case O.Renpy:F("Error: There are no templates for this narrative language"),process.exit(0);default:F("Error: Unknown narrative language"),process.exit(0)}break;case M.Vue:case M.Angular:F("Error: There are no templates for this game type and UI framework"),process.exit(0);default:F("Error: Unknown UI framework"),process.exit(0)}break;case z.GameEngine:p="template-game-engine",e="src/index.ts";break;case z.Library:p="template-lib",e="src/index.ts";break;default:F("Error: Unknown game type"),process.exit(0)}await ur({rootFolder:m,template:p,packageName:i,description:t,projectName:n,overwrite:r,identifier:v});const w=Z.find(h=>h.type===o)?.canReplaceUI??!1;return{rootFolder:m,fileToOpen:e,canReplaceUI:w}}function pr(){console.info(`
|
|
55
|
+
`}}}}).prompt();let Q=!0;const re=typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{};let ne=0;if(re.process&&re.process.env&&re.process.stdout){const{FORCE_COLOR:e,NODE_DISABLE_COLORS:t,NO_COLOR:r,TERM:i,COLORTERM:n}=re.process.env;t||r||e==="0"?Q=!1:e==="1"||e==="2"||e==="3"?Q=!0:i==="dumb"?Q=!1:"CI"in re.process.env&&["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE","DRONE"].some(a=>a in re.process.env)?Q=!0:Q=process.stdout.isTTY,Q&&(process.platform==="win32"||n&&(n==="truecolor"||n==="24bit")?ne=3:i&&(i.endsWith("-256color")||i.endsWith("256"))?ne=2:ne=1)}let Ze={enabled:Q,supportLevel:ne};function me(e,t,r=1){const i=`\x1B[${e}m`,n=`\x1B[${t}m`,a=new RegExp(`\\x1b\\[${t}m`,"g");return s=>Ze.enabled&&Ze.supportLevel>=r?i+(""+s).replace(a,i)+n:""+s}const Xt=me(31,39),ge=me(36,39),Qt=me(90,39),er=me(91,39);var Ae,Xe;function tr(){if(Xe)return Ae;Xe=1;function e(i,n){var a=i;n.slice(0,-1).forEach(function(o){a=a[o]||{}});var s=n[n.length-1];return s in a}function t(i){return typeof i=="number"||/^0x[0-9a-f]+$/i.test(i)?!0:/^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(i)}function r(i,n){return n==="constructor"&&typeof i[n]=="function"||n==="__proto__"}return Ae=function(i,n){n||(n={});var a={bools:{},strings:{},unknownFn:null};typeof n.unknown=="function"&&(a.unknownFn=n.unknown),typeof n.boolean=="boolean"&&n.boolean?a.allBools=!0:[].concat(n.boolean).filter(Boolean).forEach(function(d){a.bools[d]=!0});var s={};function o(d){return s[d].some(function(y){return a.bools[y]})}Object.keys(n.alias||{}).forEach(function(d){s[d]=[].concat(n.alias[d]),s[d].forEach(function(y){s[y]=[d].concat(s[d].filter(function(x){return y!==x}))})}),[].concat(n.string).filter(Boolean).forEach(function(d){a.strings[d]=!0,s[d]&&[].concat(s[d]).forEach(function(y){a.strings[y]=!0})});var u=n.default||{},c={_:[]};function w(d,y){return a.allBools&&/^--[^=]+$/.test(y)||a.strings[d]||a.bools[d]||s[d]}function m(d,y,x){for(var $=d,C=0;C<y.length-1;C++){var V=y[C];if(r($,V))return;$[V]===void 0&&($[V]={}),($[V]===Object.prototype||$[V]===Number.prototype||$[V]===String.prototype)&&($[V]={}),$[V]===Array.prototype&&($[V]=[]),$=$[V]}var U=y[y.length-1];r($,U)||(($===Object.prototype||$===Number.prototype||$===String.prototype)&&($={}),$===Array.prototype&&($=[]),$[U]===void 0||a.bools[U]||typeof $[U]=="boolean"?$[U]=x:Array.isArray($[U])?$[U].push(x):$[U]=[$[U],x])}function p(d,y,x){if(!(x&&a.unknownFn&&!w(d,x)&&a.unknownFn(x)===!1)){var $=!a.strings[d]&&t(y)?Number(y):y;m(c,d.split("."),$),(s[d]||[]).forEach(function(C){m(c,C.split("."),$)})}}Object.keys(a.bools).forEach(function(d){p(d,u[d]===void 0?!1:u[d])});var g=[];i.indexOf("--")!==-1&&(g=i.slice(i.indexOf("--")+1),i=i.slice(0,i.indexOf("--")));for(var h=0;h<i.length;h++){var f=i[h],v,I;if(/^--.+=/.test(f)){var j=f.match(/^--([^=]+)=([\s\S]*)$/);v=j[1];var k=j[2];a.bools[v]&&(k=k!=="false"),p(v,k,f)}else if(/^--no-.+/.test(f))v=f.match(/^--no-(.+)/)[1],p(v,!1,f);else if(/^--.+/.test(f))v=f.match(/^--(.+)/)[1],I=i[h+1],I!==void 0&&!/^(-|--)[^-]/.test(I)&&!a.bools[v]&&!a.allBools&&(!s[v]||!o(v))?(p(v,I,f),h+=1):/^(true|false)$/.test(I)?(p(v,I==="true",f),h+=1):p(v,a.strings[v]?"":!0,f);else if(/^-[^-]+/.test(f)){for(var S=f.slice(1,-1).split(""),_=!1,b=0;b<S.length;b++){if(I=f.slice(b+2),I==="-"){p(S[b],I,f);continue}if(/[A-Za-z]/.test(S[b])&&I[0]==="="){p(S[b],I.slice(1),f),_=!0;break}if(/[A-Za-z]/.test(S[b])&&/-?\d+(\.\d*)?(e-?\d+)?$/.test(I)){p(S[b],I,f),_=!0;break}if(S[b+1]&&S[b+1].match(/\W/)){p(S[b],f.slice(b+2),f),_=!0;break}else p(S[b],a.strings[S[b]]?"":!0,f)}v=f.slice(-1)[0],!_&&v!=="-"&&(i[h+1]&&!/^(-|--)[^-]/.test(i[h+1])&&!a.bools[v]&&(!s[v]||!o(v))?(p(v,i[h+1],f),h+=1):i[h+1]&&/^(true|false)$/.test(i[h+1])?(p(v,i[h+1]==="true",f),h+=1):p(v,a.strings[v]?"":!0,f))}else if((!a.unknownFn||a.unknownFn(f)!==!1)&&c._.push(a.strings._||!t(f)?f:Number(f)),n.stopEarly){c._.push.apply(c._,i.slice(h+1));break}}return Object.keys(u).forEach(function(d){e(c,d.split("."))||(m(c,d.split("."),u[d]),(s[d]||[]).forEach(function(y){m(c,y.split("."),u[d])}))}),n["--"]?c["--"]=g.slice():g.forEach(function(d){c._.push(d)}),c},Ae}var rr=tr();const ir=Tt(rr);async function sr({rootFolder:e}){const t=A.join(e,".git");try{if(E.existsSync(t)){P.warn("Git repository already exists.");return}}catch(i){P.error(`Error checking git folder: ${i}`);return}const r=await X({message:"Do you want to initialize a git repository? (recommended)",options:[{value:!0,label:"Yes",hint:"You can use GitHub to track changes and collaborate with others."},{value:!1,label:"No",hint:"It is not recommended to skip this step."}],initialValue:!0});if(D(r)&&(T("Operation cancelled."),process.exit(0)),r){const i=await de([{title:"Initializing git repository...",task:async n=>{const a=await K("git",["init","-b","main"],{cwd:e});n(a.stdout);const s=await K("git",["add","."],{cwd:e});n(s.stdout);const o=await K("git",["config","user.name"]).then(c=>c.stdout.trim()).catch(()=>""),u=await K("git",["config","user.email"]).then(c=>c.stdout.trim()).catch(()=>"");return o&&u&&(await K("git",["commit","-m","Initial commit"],{cwd:e}),n("Initial commit created.")),"Git repository initialized."}}]);D(i)&&(T("Operation cancelled."),process.exit(0)),P.message(`Now, you can use GitHub Desktop upload your project to GitHub.
|
|
56
|
+
GitHub Desktop: https://github.com/apps/desktop`)}}var ie=(e=>(e.VisualStudioCode="vscode",e.Cursor="cursor",e.VSCodium="codium",e.Other="other",e))(ie||{});async function nr({rootFolder:e,fileToOpen:t}){const r=await X({message:"Which IDE do you want to use?",options:[{value:ie.VisualStudioCode,label:"Visual Studio Code"},{value:ie.Cursor,label:"Cursor"},{value:ie.VSCodium,label:"VSCodium"},{value:ie.Other,label:"Other"}],initialValue:ie.VisualStudioCode});if(D(r)&&(T("Operation cancelled."),process.exit(0)),r===void 0)return;let i,n;switch(r){case"vscode":n="Opening in Visual Studio Code...",i="code";break;case"cursor":n="Opening in Cursor...",i="cursor";break;case"codium":n="Opening in VSCodium...",i="codium";break;default:return}await de([{title:n,task:async a=>{try{await Le(i);const s=await K(i,[e]);if(a(s.stdout),t){const o=await K(i,[`${e}/${t}`]);a(o.stdout)}return`Opened project using ${r}`}catch{return`Could not open project using ${r}, since ${r} was not in your PATH`}}}])}var z=(e=>(e[e.VisualNovel=0]="VisualNovel",e[e.TextStory=1]="TextStory",e[e.PointAndClick=2]="PointAndClick",e[e.GameEngine=3]="GameEngine",e[e.Library=4]="Library",e))(z||{}),O=(e=>(e[e.Ink=0]="Ink",e[e.Renpy=1]="Renpy",e[e.Typescript=2]="Typescript",e))(O||{}),M=(e=>(e[e.React=0]="React",e[e.Vue=1]="Vue",e[e.Angular=2]="Angular",e))(M||{});const Qe="My Game",Z=[{type:z.VisualNovel,name:"Visual Novel",availableUI:[M.React],availableNarrativeLanguages:[O.Ink,O.Typescript],isMultidevice:!0,canReplaceUI:!0},{type:z.TextStory,name:"Text-based Story",availableUI:[M.React],availableNarrativeLanguages:[O.Ink,O.Typescript],isMultidevice:!0,canReplaceUI:!1},{type:z.PointAndClick,name:"Point & Click Adventure",availableUI:[M.React],availableNarrativeLanguages:[O.Ink,O.Typescript],isMultidevice:!0,canReplaceUI:!1},{type:z.GameEngine,name:"Game Engine",availableUI:[],availableNarrativeLanguages:[],isMultidevice:!1,canReplaceUI:!1},{type:z.Library,name:"Library",availableUI:[],availableNarrativeLanguages:[],isMultidevice:!1,canReplaceUI:!1}];async function ar({packageName:e}){const t=await X({message:"Select the type of game you want to create:",options:Z.map(c=>({label:c.name,value:c.type})),initialValue:Z[0].type});D(t)&&(T("Operation cancelled."),process.exit(0));const r=Z.find(c=>c.type===t)?.availableUI.map(c=>{let w="";switch(c){case M.React:w=ge("React");break;case M.Vue:w=Qt("Vue");break;case M.Angular:w=Xt("Angular");break}return{label:w,value:c}})||[];let i;r.length===1?(P.warning(`Only one UI framework available: ${r[0].label}. Using it by default.`),i=r[0].value):r.length>0?(i=await X({message:"Select the UI framework you want to use:",options:r,initialValue:Z.find(c=>c.type===t)?.availableUI[0]}),D(i)&&(T("Operation cancelled."),process.exit(0))):i=void 0;const n=Z.find(c=>c.type===t)?.availableNarrativeLanguages.map(c=>{let w="";switch(c){case O.Ink:w="Ink + Typescript";break;case O.Renpy:w=er("Renpy");break;case O.Typescript:w=ge("Typescript");break}return{label:w,value:c}})||[];let a;n.length===1?(P.warning(`Only one narrative language available: ${n[0].label}. Using it by default.`),a=n[0].value):n.length>0?(a=await X({message:"Select the narrative language you want to use:",options:n,initialValue:Z.find(c=>c.type===t)?.availableNarrativeLanguages[0]}),D(a)&&(T("Operation cancelled."),process.exit(0))):a=void 0;const s=Z.find(c=>c.type===t)?.isMultidevice;let o=!1,u="";return s&&(o=await X({message:"Which devices is the project intended for?",options:[{label:"Web page",value:!1},{label:"Web page + Desktop + Mobile (Tauri)",value:!0}],initialValue:!1}),D(o)&&(T("Operation cancelled."),process.exit(0)),o?(u=await se({message:"Project identifier:",initialValue:`com.${e}.app`,validate:c=>{if(!c)return"Identifier is required.";if(!/^[a-zA-Z0-9_.\-]+$/.test(c))return"Identifier can only contain letters, numbers, underscores, dots and dashes."}}),D(u)&&(T("Operation cancelled."),process.exit(0))):u=""),{gameType:t,UIFramework:i,narrativeLanguage:a,multidevice:o,identifier:u}}var N=(e=>(e.Delete="delete",e.Overwrite="overwrite",e.Skip="skip",e.Ask="ask",e.Cancel="cancel",e))(N||{});function or(e){const t=E.readdirSync(e);return t.length===0||t.length===1&&t[0]===".git"}function et(e,t,r){if(!E.existsSync(t))return;const i=E.statSync(t);if(i.isFile())(r===N.Overwrite||r===N.Delete)&&E.rmSync(t,{force:!0});else if(i.isDirectory()){const n=E.readdirSync(e);for(const a of n){const s=A.join(e,a),o=A.join(t,a);et(s,o,r)}}}function ke(e,t,r){if(E.statSync(e).isDirectory()){E.mkdirSync(t,{recursive:!0});for(const i of E.readdirSync(e)){const n=A.join(e,i),a=A.join(t,i);ke(n,a,r)}}else{if(r!==void 0&&E.existsSync(t)){if(r===N.Skip)return;(r===N.Overwrite||r===N.Delete)&&E.rmSync(t,{force:!0})}E.copyFileSync(e,t)}}function ur(e){return/^(?:@[a-z\d\-*~][a-z\d\-*._~]*\/)?[a-z\d\-~][a-z\d\-._~]*$/.test(e)}function tt(e){return e.trim().toLowerCase().replace(/\s+/g,"-").replace(/^[._]/,"").replace(/[^a-z\d\-~]+/g,"-")}async function cr(){const e=await se({message:"Project name:",defaultValue:Qe,placeholder:Qe,validate:s=>{if(!s)return"Project name cannot be empty"}});D(e)&&(T("Operation cancelled."),process.exit(0));const t=await se({message:"Project description:",defaultValue:"A new game project",placeholder:"A new game project"});D(t)&&(T("Operation cancelled."),process.exit(0));const r=await se({message:"Package name:",defaultValue:tt(e),placeholder:tt(e),validate:s=>{if(s&&!ur(s))return"Invalid package name. The name can only include URL-friendly characters."}});D(r)&&(T("Operation cancelled."),process.exit(0));const i=A.basename(A.resolve()),n=await se({message:"Target directory:",defaultValue:r,placeholder:`${r} (If is equal to ".", the current directory (${i}) will be used)`});D(n)&&(T("Operation cancelled."),process.exit(0));let a;return E.existsSync(n)&&!or(n)?(a=await X({message:"Overwrite existing files?",options:[{hint:"Delete all existing files and create a new project",label:"Delete all",value:N.Delete},{hint:"Overwrite existing conflicting files",label:"Overwrite",value:N.Overwrite},{hint:"Skip existing conflicting files",label:"Skip",value:N.Skip},{hint:"Ask for each file",label:"Ask",value:N.Ask},{hint:"Cancel operation",label:"Cancel",value:N.Cancel}],initialValue:N.Overwrite}),(D(a)||a===N.Cancel)&&(T("Operation cancelled."),process.exit(0))):a=void 0,{projectName:e,foltderName:n,description:t,packageName:r,overwrite:a}}const rt={_gitignore:".gitignore"};function it(e,t,r,i,n){return e=e.replace(/my-app-package-name/g,t),e=e.replace(/my-app-description/g,r),e=e.replace(/my-app-project-name/g,i),n&&(e=e.replace(/com\.my-app-project-name\.app/g,n)),e}function st(e,t,r,i,n){E.existsSync(e)&&E.writeFileSync(e,it(E.readFileSync(e,"utf-8"),t,r,i,n))}async function lr({rootFolder:e,overwrite:t,template:r,packageName:i,description:n,projectName:a,identifier:s}){const o=await de([{title:`Creating project in ${e}...`,task:async()=>{E.existsSync(e)||E.mkdirSync(e,{recursive:!0});const u=A.resolve(lt(import.meta.url),"../..",`${r}`),c=(g,h)=>{const f=A.join(e,rt[g]??g);h?E.writeFileSync(f,h):ke(A.join(u,g),f,t)},w=E.readdirSync(u).map(async g=>{const h=A.join(u,g),f=A.join(e,rt[g]??g);if(E.existsSync(f))switch(t){case N.Ask:if(E.statSync(f).isFile()){const v=await Je({message:`File ${f} already exists. Do you want to overwrite it?`,initialValue:!1});if(D(v)&&(T("Operation cancelled."),process.exit(0)),!v)return;E.rmSync(f,{force:!0})}else{const v=E.readdirSync(h);for(const I of v){const j=A.join(h,I),k=A.join(f,I);if(E.existsSync(k)){const S=await Je({message:`File ${k} already exists. Do you want to overwrite it?`,initialValue:!1});if(D(S)&&(T("Operation cancelled."),process.exit(0)),!S)continue;E.rmSync(k,{force:!0})}ke(j,k,t)}return}break;case N.Skip:return;case N.Overwrite:case N.Delete:et(h,f,t);break}switch(g){case"package.json":case"vite.config.ts":case"index.html":case"README.md":{c(g,it(E.readFileSync(h,"utf-8"),i,n,a));break}case".git":case"package-lock.json":break;default:c(g)}});await Promise.all(w),st(A.join(e,".vscode","launch.json"),i,n,a);const m=A.join(e,"src-tauri");if(E.existsSync(m))for(const g of["Cargo.toml","tauri.conf.json"])st(A.join(m,g),i,n,a,s);const p=A.join(e,"_github");return E.existsSync(p)&&E.renameSync(p,A.join(e,".github")),"Project created"}}]);D(o)&&(T("Operation cancelled."),process.exit(0))}const pr=process.cwd();async function fr(){let e,{description:t,overwrite:r,packageName:i,projectName:n,foltderName:a}=await cr(),{UIFramework:s,gameType:o,narrativeLanguage:u,multidevice:c,identifier:w}=await ar({packageName:i});const m=A.join(pr,a);let p;switch(o){case z.VisualNovel:switch(s){case M.React:switch(u){case O.Typescript:c?p="template-react-vite-muijoy-tauri":p="template-react-vite-muijoy",e="src/content/labels/start.label.ts";break;case O.Ink:c?p="template-react-vite-muijoy-ink-tauri":p="template-react-vite-muijoy-ink",e="ink/start.ink";break;case O.Renpy:T("Error: There are no templates for this narrative language"),process.exit(0);default:T("Error: Unknown narrative language"),process.exit(0)}break;case M.Vue:case M.Angular:T("Error: There are no templates for this game type and UI framework"),process.exit(0);default:T("Error: Unknown UI framework"),process.exit(0)}break;case z.TextStory:switch(s){case M.React:switch(u){case O.Typescript:c?p="template-story-react-vite-muijoy-tauri":p="template-story-react-vite-muijoy",e="src/labels/startLabel.ts";break;case O.Ink:c?p="template-story-react-vite-muijoy-ink-tauri":p="template-story-react-vite-muijoy-ink",e="src/ink/start.ink";break;case O.Renpy:T("Error: There are no templates for this narrative language"),process.exit(0);default:T("Error: Unknown narrative language"),process.exit(0)}break;case M.Vue:case M.Angular:T("Error: There are no templates for this game type and UI framework"),process.exit(0);default:T("Error: Unknown UI framework"),process.exit(0)}break;case z.PointAndClick:switch(s){case M.React:switch(u){case O.Typescript:c?p="template-nqtr-react-vite-muijoy-tauri":p="template-nqtr-react-vite-muijoy",e="src/labels/startLabel.ts";break;case O.Ink:c?p="template-nqtr-react-vite-muijoy-ink-tauri":p="template-nqtr-react-vite-muijoy-ink",e="src/ink/variousActionsLabels.ink";break;case O.Renpy:T("Error: There are no templates for this narrative language"),process.exit(0);default:T("Error: Unknown narrative language"),process.exit(0)}break;case M.Vue:case M.Angular:T("Error: There are no templates for this game type and UI framework"),process.exit(0);default:T("Error: Unknown UI framework"),process.exit(0)}break;case z.GameEngine:p="template-game-engine",e="src/index.ts";break;case z.Library:p="template-lib",e="src/index.ts";break;default:T("Error: Unknown game type"),process.exit(0)}await lr({rootFolder:m,template:p,packageName:i,description:t,projectName:n,overwrite:r,identifier:w});const g=Z.find(h=>h.type===o)?.canReplaceUI??!1;return{rootFolder:m,fileToOpen:e,canReplaceUI:g}}function hr(){console.info(`
|
|
56
57
|
\u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2557\u2588\u2588\u2557 \u2588\u2588\u2557\u2588\u2588\u2557 \u2588\u2588\u2557 \u2588\u2588\u2557\u2588\u2588\u2588\u2557 \u2588\u2588\u2557
|
|
57
58
|
\u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557\u2588\u2588\u2551\u255A\u2588\u2588\u2557\u2588\u2588\u2554\u255D\u2588\u2588\u2551 \u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2551
|
|
58
59
|
\u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255D\u2588\u2588\u2551 \u255A\u2588\u2588\u2588\u2554\u255D \u2588\u2588\u2551\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2554\u2588\u2588\u2557 \u2588\u2588\u2551
|
|
59
60
|
\u2588\u2588\u2554\u2550\u2550\u2550\u255D \u2588\u2588\u2551 \u2588\u2588\u2554\u2588\u2588\u2557 \u2588\u2588\u2551\u255A\u2550\u2550\u2550\u2550\u255D\u255A\u2588\u2588\u2557 \u2588\u2588\u2554\u255D\u2588\u2588\u2551\u255A\u2588\u2588\u2557\u2588\u2588\u2551
|
|
60
61
|
\u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2554\u255D \u2588\u2588\u2557\u2588\u2588\u2551 \u255A\u2588\u2588\u2588\u2588\u2554\u255D \u2588\u2588\u2551 \u255A\u2588\u2588\u2588\u2588\u2551
|
|
61
62
|
\u255A\u2550\u255D \u255A\u2550\u255D\u255A\u2550\u255D \u255A\u2550\u255D\u255A\u2550\u255D \u255A\u2550\u2550\u2550\u255D \u255A\u2550\u255D \u255A\u2550\u2550\u2550\u255D
|
|
62
|
-
`)}function
|
|
63
|
+
`)}function dr(e){if(!e)return;const t=e.split(" ")[0].split("/");return{name:t[0],version:t[1]}}const mr=ir(process.argv.slice(2),{default:{help:!1},alias:{h:"help",t:"template"},string:["_"]}),nt=process.cwd(),gr=`Usage: create-pixi-vn [OPTION]... [DIRECTORY]
|
|
63
64
|
|
|
64
65
|
Create a new Pixi\u2019VN project.
|
|
65
66
|
With no arguments, start the CLI in interactive mode.
|
|
@@ -68,9 +69,9 @@ Options:
|
|
|
68
69
|
-t, --template NAME use a specific template
|
|
69
70
|
|
|
70
71
|
Available templates:
|
|
71
|
-
${ge("basic-visual-novel react")}`;async function
|
|
72
|
+
${ge("basic-visual-novel react")}`;async function vr(){try{if(hr(),zt(`Welcome to ${ge("Pixi\u2019VN")}! \u{1F3A8}\u2728`),mr.help){console.log(gr);return}const{rootFolder:e,fileToOpen:t,canReplaceUI:r}=await fr(),i=A.join(e,"package-lock.json");E.existsSync(i)&&E.rmSync(i);const n=dr(process.env.npm_config_user_agent),a=n?n.name:"npm",s=A.relative(nt,e);r&&(P.info("You will need to select a UI theme for your project."),await de([{title:"Installing shadcn globally...",task:async()=>{try{await Le(a),a==="yarn"?await K("yarn",["global","add","shadcn@latest"]):await K(a,["install","-g","shadcn@latest"])}catch{return"Could not install shadcn globally"}return"shadcn installed globally."}}]),P.step("Running ui:reinit..."),a==="yarn"?await K("yarn",["ui:reinit"],{cwd:e,stdio:"inherit"}):await K(a,["run","ui:reinit"],{cwd:e,stdio:"inherit"})),await sr({rootFolder:e}),await nr({rootFolder:e,fileToOpen:t});let o="To run the game:";switch(e!==nt&&(o+=`
|
|
72
73
|
cd ${s.includes(" ")?`"${s}"`:s}`),a){case"yarn":o+=`
|
|
73
74
|
yarn`,o+=`
|
|
74
75
|
yarn dev`;break;default:o+=`
|
|
75
76
|
${a} install`,o+=`
|
|
76
|
-
${a} run start`;break}P.message(o),
|
|
77
|
+
${a} run start`;break}P.message(o),Yt("You're all set! \u{1F389} Now go build your game! \u{1F680}"),await ct("https://pixi-vn.com/start/templates"),console.log()}catch(e){console.error(e)}}vr().catch(e=>{console.error(e)});
|
package/package.json
CHANGED