UNPKG

@prisma/cli-dev

Version:

Dev CLI for Prisma

12 lines (9 loc) 1.07 kB
import { createRequire } from 'module'; const require = createRequire(import.meta.url); import{d as o,h as a,k as c}from"./chunk-SZYQ5TDI.js";import{b as r}from"./chunk-4QNO2WQL.js";async function T(e){let{confirmationText:t,debug:h}=e;return a?typeof await new c({debug:h,render(){switch(this.state){case"active":case"error":case"initial":{let s=` \u{1F9F7} To confirm, type ${o(t)} and press ${r("inverse"," \u23CE ")}:`,l=this.value?.length<=t.length&&t.startsWith(this.value),i=!this.error&&u(this.value,t),n=t.charAt(this.cursor)?r("inverse",t.charAt(this.cursor)):this.valueWithCursor.charAt(this.cursor),m=r("dim",t.slice(this.valueWithCursor.length)),p=i?`${t}${r("reset",r("strikethrough",r("dim",this.value.slice(t.length))))}${n}`:`${this.value}${n}`;return`${s} ${r(i?"greenBright":l?"reset":"redBright",`${r("hidden","_")}> ${p}`)}${m} `}case"cancel":return` Aborted! `;case"submit":return` `;default:return this.state,` `}},validate:s=>u(s,t)?void 0:"!"}).prompt()=="string":!0}function u(e,t){return typeof e=="string"&&e.startsWith(t)}export{T as a};