create-businessdash 0.0.0-stage → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (1514) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +125 -2
  3. package/dist/index.mjs +3754 -0
  4. package/index.js +2 -0
  5. package/package.json +40 -5
  6. package/templates/angular/.claude/CLAUDE.md +54 -0
  7. package/templates/angular/.cursor/rules/cursor.mdc +60 -0
  8. package/templates/angular/.editorconfig +17 -0
  9. package/templates/angular/.env.example +62 -0
  10. package/templates/angular/.prettierrc +12 -0
  11. package/templates/angular/.vscode/extensions.json +4 -0
  12. package/templates/angular/.vscode/launch.json +20 -0
  13. package/templates/angular/.vscode/mcp.json +9 -0
  14. package/templates/angular/.vscode/tasks.json +42 -0
  15. package/templates/angular/AGENTS.md +54 -0
  16. package/templates/angular/README.md +382 -0
  17. package/templates/angular/_gitignore +49 -0
  18. package/templates/angular/angular.json +93 -0
  19. package/templates/angular/bd.config.ts +331 -0
  20. package/templates/angular/bd.data-model.config.ts +89 -0
  21. package/templates/angular/package.json +60 -0
  22. package/templates/angular/pnpm-lock.yaml +5506 -0
  23. package/templates/angular/public/favicon.ico +0 -0
  24. package/templates/angular/src/app/app.config.server.ts +10 -0
  25. package/templates/angular/src/app/app.config.ts +48 -0
  26. package/templates/angular/src/app/app.html +7 -0
  27. package/templates/angular/src/app/app.routes.server.ts +14 -0
  28. package/templates/angular/src/app/app.routes.ts +69 -0
  29. package/templates/angular/src/app/app.scss +5 -0
  30. package/templates/angular/src/app/app.spec.ts +25 -0
  31. package/templates/angular/src/app/app.ts +27 -0
  32. package/templates/angular/src/app/lib/bd-api.client.ts +416 -0
  33. package/templates/angular/src/app/lib/bd-forms.client.ts +107 -0
  34. package/templates/angular/src/app/lib/bd.service.ts +145 -0
  35. package/templates/angular/src/app/lib/followers.service.ts +143 -0
  36. package/templates/angular/src/app/pages/booking.page.ts +142 -0
  37. package/templates/angular/src/app/pages/cart.page.ts +131 -0
  38. package/templates/angular/src/app/pages/home.page.ts +37 -0
  39. package/templates/angular/src/app/pages/my-account.page.ts +197 -0
  40. package/templates/angular/src/app/pages/product-detail.page.ts +217 -0
  41. package/templates/angular/src/app/pages/reviews.page.ts +89 -0
  42. package/templates/angular/src/app/pages/service-area.page.ts +86 -0
  43. package/templates/angular/src/app/pages/services-index.page.ts +49 -0
  44. package/templates/angular/src/app/pages/store.page.ts +422 -0
  45. package/templates/angular/src/app/pages/subscriptions.page.ts +102 -0
  46. package/templates/angular/src/app/pages/todos.page.ts +194 -0
  47. package/templates/angular/src/app/pages/updates.page.ts +45 -0
  48. package/templates/angular/src/app/sections/about.component.ts +24 -0
  49. package/templates/angular/src/app/sections/blog.component.ts +33 -0
  50. package/templates/angular/src/app/sections/contact-form.component.ts +51 -0
  51. package/templates/angular/src/app/sections/footer.component.ts +14 -0
  52. package/templates/angular/src/app/sections/header.component.ts +36 -0
  53. package/templates/angular/src/app/sections/hero.component.ts +21 -0
  54. package/templates/angular/src/app/sections/news-banner.component.ts +50 -0
  55. package/templates/angular/src/app/sections/reviews-summary.component.ts +41 -0
  56. package/templates/angular/src/app/sections/sdk-setup-banner.component.ts +125 -0
  57. package/templates/angular/src/app/sections/services.component.ts +27 -0
  58. package/templates/angular/src/app/sections/subscribe.component.ts +140 -0
  59. package/templates/angular/src/app/sections/updates.component.ts +38 -0
  60. package/templates/angular/src/environments/environment.prod.ts +13 -0
  61. package/templates/angular/src/environments/environment.ts +23 -0
  62. package/templates/angular/src/index.html +13 -0
  63. package/templates/angular/src/main.server.ts +7 -0
  64. package/templates/angular/src/main.ts +5 -0
  65. package/templates/angular/src/server/bd-api.ts +1098 -0
  66. package/templates/angular/src/server/bd-seo.ts +55 -0
  67. package/templates/angular/src/server/bd-server.ts +293 -0
  68. package/templates/angular/src/server.ts +94 -0
  69. package/templates/angular/src/styles.scss +1102 -0
  70. package/templates/angular/tsconfig.app.json +11 -0
  71. package/templates/angular/tsconfig.json +33 -0
  72. package/templates/angular/tsconfig.spec.json +10 -0
  73. package/templates/astro/.env.example +48 -0
  74. package/templates/astro/.vscode/extensions.json +4 -0
  75. package/templates/astro/.vscode/launch.json +11 -0
  76. package/templates/astro/README.md +432 -0
  77. package/templates/astro/_gitignore +25 -0
  78. package/templates/astro/astro.config.mjs +13 -0
  79. package/templates/astro/bd.config.ts +331 -0
  80. package/templates/astro/bd.data-model.config.ts +90 -0
  81. package/templates/astro/package.json +40 -0
  82. package/templates/astro/pnpm-lock.yaml +3788 -0
  83. package/templates/astro/public/favicon.ico +0 -0
  84. package/templates/astro/public/favicon.svg +9 -0
  85. package/templates/astro/src/components/About.astro +59 -0
  86. package/templates/astro/src/components/Banner.astro +78 -0
  87. package/templates/astro/src/components/Blog.astro +62 -0
  88. package/templates/astro/src/components/Booking.astro +285 -0
  89. package/templates/astro/src/components/ContactForm.astro +89 -0
  90. package/templates/astro/src/components/ContactForm.tsx +80 -0
  91. package/templates/astro/src/components/Footer.astro +39 -0
  92. package/templates/astro/src/components/Gallery.astro +77 -0
  93. package/templates/astro/src/components/Header.astro +65 -0
  94. package/templates/astro/src/components/Hero.astro +45 -0
  95. package/templates/astro/src/components/NotFound.astro +22 -0
  96. package/templates/astro/src/components/Reviews.astro +169 -0
  97. package/templates/astro/src/components/SdkSetupBanner.astro +83 -0
  98. package/templates/astro/src/components/Services.astro +87 -0
  99. package/templates/astro/src/components/Subscribe.astro +196 -0
  100. package/templates/astro/src/components/Subscribe.tsx +171 -0
  101. package/templates/astro/src/layouts/Layout.astro +89 -0
  102. package/templates/astro/src/lib/bd-bundle.ts +113 -0
  103. package/templates/astro/src/lib/bd-distribution.ts +36 -0
  104. package/templates/astro/src/lib/bd-portal.ts +158 -0
  105. package/templates/astro/src/lib/bd-seo.ts +81 -0
  106. package/templates/astro/src/lib/bd-store.ts +185 -0
  107. package/templates/astro/src/lib/bd-suspension.ts +67 -0
  108. package/templates/astro/src/lib/bd-todos.ts +124 -0
  109. package/templates/astro/src/lib/bd.ts +73 -0
  110. package/templates/astro/src/pages/.well-known/mcp.json.ts +22 -0
  111. package/templates/astro/src/pages/404.astro +15 -0
  112. package/templates/astro/src/pages/[...slug].astro +50 -0
  113. package/templates/astro/src/pages/ai/product-feed.ts +25 -0
  114. package/templates/astro/src/pages/api/bd/cart/add.ts +41 -0
  115. package/templates/astro/src/pages/api/bd/cart/clear.ts +29 -0
  116. package/templates/astro/src/pages/api/bd/cart/coupon.ts +35 -0
  117. package/templates/astro/src/pages/api/bd/cart/get.ts +28 -0
  118. package/templates/astro/src/pages/api/bd/cart/remove.ts +33 -0
  119. package/templates/astro/src/pages/api/bd/cart/update.ts +41 -0
  120. package/templates/astro/src/pages/api/bd/checkout/start.ts +37 -0
  121. package/templates/astro/src/pages/api/bd/forms/[slug].ts +75 -0
  122. package/templates/astro/src/pages/api/bd/portal/plan.ts +31 -0
  123. package/templates/astro/src/pages/api/bd/portal/submit-review.ts +56 -0
  124. package/templates/astro/src/pages/api/bd/revalidate.ts +49 -0
  125. package/templates/astro/src/pages/api/bd/reviews.ts +39 -0
  126. package/templates/astro/src/pages/api/bd/scheduling/bookings.ts +44 -0
  127. package/templates/astro/src/pages/api/bd/scheduling/slots.ts +40 -0
  128. package/templates/astro/src/pages/api/bd/subscriptions/checkout.ts +29 -0
  129. package/templates/astro/src/pages/api/bd-auth/[...slug].ts +61 -0
  130. package/templates/astro/src/pages/api/mcp.ts +40 -0
  131. package/templates/astro/src/pages/index.astro +47 -0
  132. package/templates/astro/src/pages/llms.txt.ts +25 -0
  133. package/templates/astro/src/pages/my-account.astro +388 -0
  134. package/templates/astro/src/pages/reviews.astro +18 -0
  135. package/templates/astro/src/pages/robots.txt.ts +46 -0
  136. package/templates/astro/src/pages/services/[service]/[area].astro +103 -0
  137. package/templates/astro/src/pages/services/index.astro +104 -0
  138. package/templates/astro/src/pages/sitemap.xml.ts +89 -0
  139. package/templates/astro/src/pages/store/[id].astro +208 -0
  140. package/templates/astro/src/pages/store/cart.astro +458 -0
  141. package/templates/astro/src/pages/store/index.astro +567 -0
  142. package/templates/astro/src/pages/store/subscriptions.astro +155 -0
  143. package/templates/astro/src/pages/todos.astro +199 -0
  144. package/templates/astro/src/pages/updates.astro +135 -0
  145. package/templates/astro/src/styles/global.css +631 -0
  146. package/templates/astro/tsconfig.json +8 -0
  147. package/templates/elixir/.env.example +58 -0
  148. package/templates/elixir/README.md +293 -0
  149. package/templates/elixir/_gitignore +16 -0
  150. package/templates/elixir/assets/js/app.js +16 -0
  151. package/templates/elixir/bd-records/README.md +50 -0
  152. package/templates/elixir/bd-records/todo-images.json +14 -0
  153. package/templates/elixir/bd-records/todos.json +20 -0
  154. package/templates/elixir/bd.config.ts +331 -0
  155. package/templates/elixir/bd.data-model.config.ts +89 -0
  156. package/templates/elixir/config/config.exs +30 -0
  157. package/templates/elixir/config/dev.exs +20 -0
  158. package/templates/elixir/config/prod.exs +6 -0
  159. package/templates/elixir/config/runtime.exs +68 -0
  160. package/templates/elixir/config/test.exs +9 -0
  161. package/templates/elixir/lib/bd_starter/application.ex +29 -0
  162. package/templates/elixir/lib/bd_starter/bd/auth.ex +126 -0
  163. package/templates/elixir/lib/bd_starter/bd/cache.ex +148 -0
  164. package/templates/elixir/lib/bd_starter/bd/chat_session.ex +214 -0
  165. package/templates/elixir/lib/bd_starter/bd/client.ex +203 -0
  166. package/templates/elixir/lib/bd_starter/bd/customer_auth.ex +116 -0
  167. package/templates/elixir/lib/bd_starter/bd/resources/blog.ex +18 -0
  168. package/templates/elixir/lib/bd_starter/bd/resources/cart.ex +40 -0
  169. package/templates/elixir/lib/bd_starter/bd/resources/checkout.ex +22 -0
  170. package/templates/elixir/lib/bd_starter/bd/resources/data_model.ex +53 -0
  171. package/templates/elixir/lib/bd_starter/bd/resources/donations.ex +50 -0
  172. package/templates/elixir/lib/bd_starter/bd/resources/followers.ex +25 -0
  173. package/templates/elixir/lib/bd_starter/bd/resources/forms.ex +29 -0
  174. package/templates/elixir/lib/bd_starter/bd/resources/marketing.ex +20 -0
  175. package/templates/elixir/lib/bd_starter/bd/resources/notifications.ex +87 -0
  176. package/templates/elixir/lib/bd_starter/bd/resources/parallel_pages.ex +21 -0
  177. package/templates/elixir/lib/bd_starter/bd/resources/portal.ex +153 -0
  178. package/templates/elixir/lib/bd_starter/bd/resources/reviews.ex +8 -0
  179. package/templates/elixir/lib/bd_starter/bd/resources/scheduling.ex +122 -0
  180. package/templates/elixir/lib/bd_starter/bd/resources/storefront.ex +47 -0
  181. package/templates/elixir/lib/bd_starter/bd/resources/subscriptions.ex +13 -0
  182. package/templates/elixir/lib/bd_starter/bd/seo.ex +148 -0
  183. package/templates/elixir/lib/bd_starter/bd/sign_in_core.ex +258 -0
  184. package/templates/elixir/lib/bd_starter/bd/social_platforms.ex +46 -0
  185. package/templates/elixir/lib/bd_starter/bd/socials.ex +99 -0
  186. package/templates/elixir/lib/bd_starter/bd/webhook.ex +89 -0
  187. package/templates/elixir/lib/bd_starter/bd.ex +156 -0
  188. package/templates/elixir/lib/bd_starter/forms/backend.ex +74 -0
  189. package/templates/elixir/lib/bd_starter/forms/calculation.ex +158 -0
  190. package/templates/elixir/lib/bd_starter/forms/dates.ex +151 -0
  191. package/templates/elixir/lib/bd_starter/forms/field.ex +211 -0
  192. package/templates/elixir/lib/bd_starter/forms/field_path.ex +18 -0
  193. package/templates/elixir/lib/bd_starter/forms/form_controller.ex +615 -0
  194. package/templates/elixir/lib/bd_starter/forms/form_view.ex +339 -0
  195. package/templates/elixir/lib/bd_starter/forms/forms.ex +37 -0
  196. package/templates/elixir/lib/bd_starter/forms/forms_data.ex +298 -0
  197. package/templates/elixir/lib/bd_starter/forms/formula.ex +602 -0
  198. package/templates/elixir/lib/bd_starter/forms/formula_parser.ex +197 -0
  199. package/templates/elixir/lib/bd_starter/forms/js.ex +501 -0
  200. package/templates/elixir/lib/bd_starter/forms/json.ex +103 -0
  201. package/templates/elixir/lib/bd_starter/forms/messages.ex +95 -0
  202. package/templates/elixir/lib/bd_starter/forms/package_backend.ex +175 -0
  203. package/templates/elixir/lib/bd_starter/forms/quiz_arrange.ex +120 -0
  204. package/templates/elixir/lib/bd_starter/forms/quiz_backend.ex +14 -0
  205. package/templates/elixir/lib/bd_starter/forms/quiz_config.ex +51 -0
  206. package/templates/elixir/lib/bd_starter/forms/quiz_controller.ex +188 -0
  207. package/templates/elixir/lib/bd_starter/forms/quiz_engine.ex +682 -0
  208. package/templates/elixir/lib/bd_starter/forms/quiz_options.ex +99 -0
  209. package/templates/elixir/lib/bd_starter/forms/quiz_page.ex +93 -0
  210. package/templates/elixir/lib/bd_starter/forms/quiz_runs.ex +44 -0
  211. package/templates/elixir/lib/bd_starter/forms/quiz_scoring.ex +397 -0
  212. package/templates/elixir/lib/bd_starter/forms/quiz_state.ex +68 -0
  213. package/templates/elixir/lib/bd_starter/forms/quiz_words.ex +101 -0
  214. package/templates/elixir/lib/bd_starter/forms/quizzes.ex +98 -0
  215. package/templates/elixir/lib/bd_starter/forms/re.ex +22 -0
  216. package/templates/elixir/lib/bd_starter/forms/rules.ex +1355 -0
  217. package/templates/elixir/lib/bd_starter/forms/sample_backend.ex +44 -0
  218. package/templates/elixir/lib/bd_starter/forms/schema.ex +50 -0
  219. package/templates/elixir/lib/bd_starter/forms/submit_result.ex +60 -0
  220. package/templates/elixir/lib/bd_starter/forms/units.ex +75 -0
  221. package/templates/elixir/lib/bd_starter_web/bundle.ex +27 -0
  222. package/templates/elixir/lib/bd_starter_web/components/form_components.ex +779 -0
  223. package/templates/elixir/lib/bd_starter_web/components/layouts/app.html.heex +50 -0
  224. package/templates/elixir/lib/bd_starter_web/components/layouts/root.html.heex +24 -0
  225. package/templates/elixir/lib/bd_starter_web/components/layouts.ex +6 -0
  226. package/templates/elixir/lib/bd_starter_web/controllers/bd_auth_controller.ex +144 -0
  227. package/templates/elixir/lib/bd_starter_web/controllers/bd_customer_auth_controller.ex +224 -0
  228. package/templates/elixir/lib/bd_starter_web/controllers/blog_controller.ex +28 -0
  229. package/templates/elixir/lib/bd_starter_web/controllers/blog_html/index.html.heex +10 -0
  230. package/templates/elixir/lib/bd_starter_web/controllers/blog_html/show.html.heex +20 -0
  231. package/templates/elixir/lib/bd_starter_web/controllers/blog_html.ex +6 -0
  232. package/templates/elixir/lib/bd_starter_web/controllers/cart_controller.ex +140 -0
  233. package/templates/elixir/lib/bd_starter_web/controllers/cart_html/show.html.heex +42 -0
  234. package/templates/elixir/lib/bd_starter_web/controllers/cart_html.ex +6 -0
  235. package/templates/elixir/lib/bd_starter_web/controllers/error_html.ex +8 -0
  236. package/templates/elixir/lib/bd_starter_web/controllers/form_page_controller.ex +77 -0
  237. package/templates/elixir/lib/bd_starter_web/controllers/form_page_html/form.html.heex +2 -0
  238. package/templates/elixir/lib/bd_starter_web/controllers/form_page_html/quiz.html.heex +4 -0
  239. package/templates/elixir/lib/bd_starter_web/controllers/form_page_html.ex +5 -0
  240. package/templates/elixir/lib/bd_starter_web/controllers/page_controller.ex +56 -0
  241. package/templates/elixir/lib/bd_starter_web/controllers/page_html/home.html.heex +53 -0
  242. package/templates/elixir/lib/bd_starter_web/controllers/page_html/reviews.html.heex +10 -0
  243. package/templates/elixir/lib/bd_starter_web/controllers/page_html/updates.html.heex +8 -0
  244. package/templates/elixir/lib/bd_starter_web/controllers/page_html.ex +6 -0
  245. package/templates/elixir/lib/bd_starter_web/controllers/portal_controller.ex +109 -0
  246. package/templates/elixir/lib/bd_starter_web/controllers/portal_html/delete_account.html.heex +31 -0
  247. package/templates/elixir/lib/bd_starter_web/controllers/portal_html/index.html.heex +29 -0
  248. package/templates/elixir/lib/bd_starter_web/controllers/portal_html/sign_in.html.heex +18 -0
  249. package/templates/elixir/lib/bd_starter_web/controllers/portal_html.ex +6 -0
  250. package/templates/elixir/lib/bd_starter_web/controllers/seo_controller.ex +87 -0
  251. package/templates/elixir/lib/bd_starter_web/controllers/service_area_controller.ex +14 -0
  252. package/templates/elixir/lib/bd_starter_web/controllers/service_area_html/index.html.heex +12 -0
  253. package/templates/elixir/lib/bd_starter_web/controllers/service_area_html/show.html.heex +4 -0
  254. package/templates/elixir/lib/bd_starter_web/controllers/service_area_html.ex +6 -0
  255. package/templates/elixir/lib/bd_starter_web/controllers/store_controller.ex +34 -0
  256. package/templates/elixir/lib/bd_starter_web/controllers/store_html/index.html.heex +31 -0
  257. package/templates/elixir/lib/bd_starter_web/controllers/store_html/show.html.heex +29 -0
  258. package/templates/elixir/lib/bd_starter_web/controllers/store_html.ex +6 -0
  259. package/templates/elixir/lib/bd_starter_web/controllers/subscription_controller.ex +31 -0
  260. package/templates/elixir/lib/bd_starter_web/controllers/subscription_html/index.html.heex +14 -0
  261. package/templates/elixir/lib/bd_starter_web/controllers/subscription_html.ex +6 -0
  262. package/templates/elixir/lib/bd_starter_web/controllers/todos_controller.ex +58 -0
  263. package/templates/elixir/lib/bd_starter_web/controllers/todos_html/index.html.heex +38 -0
  264. package/templates/elixir/lib/bd_starter_web/controllers/todos_html.ex +6 -0
  265. package/templates/elixir/lib/bd_starter_web/controllers/webhook_controller.ex +30 -0
  266. package/templates/elixir/lib/bd_starter_web/endpoint.ex +40 -0
  267. package/templates/elixir/lib/bd_starter_web/live/chat_live.ex +113 -0
  268. package/templates/elixir/lib/bd_starter_web/live/form_live.ex +431 -0
  269. package/templates/elixir/lib/bd_starter_web/live/quiz_live.ex +532 -0
  270. package/templates/elixir/lib/bd_starter_web/live/sign_in_live.ex +533 -0
  271. package/templates/elixir/lib/bd_starter_web/money.ex +50 -0
  272. package/templates/elixir/lib/bd_starter_web/plugs/cache_body_reader.ex +33 -0
  273. package/templates/elixir/lib/bd_starter_web/router.ex +110 -0
  274. package/templates/elixir/lib/bd_starter_web.ex +75 -0
  275. package/templates/elixir/mix.exs +42 -0
  276. package/templates/elixir/package.json +20 -0
  277. package/templates/elixir/pnpm-lock.yaml +347 -0
  278. package/templates/elixir/priv/forms/demo-form.json +283 -0
  279. package/templates/elixir/priv/forms/demo-quiz.json +97 -0
  280. package/templates/elixir/priv/static/assets/app.css +113 -0
  281. package/templates/elixir/priv/static/bd-sign-in.css +51 -0
  282. package/templates/elixir/priv/static/forms.css +1153 -0
  283. package/templates/elixir/test/fixtures/forms-parity.json +3806 -0
  284. package/templates/elixir/test/fixtures/quiz-parity.json +9937 -0
  285. package/templates/elixir/test/form_controller_test.exs +314 -0
  286. package/templates/elixir/test/forms_parity_test.exs +206 -0
  287. package/templates/elixir/test/quiz_parity_test.exs +243 -0
  288. package/templates/elixir/test/support/parity.ex +46 -0
  289. package/templates/elixir/test/test_helper.exs +1 -0
  290. package/templates/elixir/tsconfig.json +19 -0
  291. package/templates/flutter/README.md +321 -0
  292. package/templates/flutter/_gitignore +9 -0
  293. package/templates/flutter/analysis_options.yaml +8 -0
  294. package/templates/flutter/bd-records/README.md +50 -0
  295. package/templates/flutter/bd-records/todo-images.json +14 -0
  296. package/templates/flutter/bd-records/todos.json +20 -0
  297. package/templates/flutter/bd.config.ts +331 -0
  298. package/templates/flutter/bd.data-model.config.ts +89 -0
  299. package/templates/flutter/lib/forms/demo_form.dart +289 -0
  300. package/templates/flutter/lib/forms/demo_quiz.dart +104 -0
  301. package/templates/flutter/lib/forms/form_hooks.dart +147 -0
  302. package/templates/flutter/lib/main.dart +120 -0
  303. package/templates/flutter/lib/ui/account_page.dart +153 -0
  304. package/templates/flutter/lib/ui/bd_scope.dart +39 -0
  305. package/templates/flutter/lib/ui/cart_page.dart +102 -0
  306. package/templates/flutter/lib/ui/chat_page.dart +111 -0
  307. package/templates/flutter/lib/ui/form_page.dart +50 -0
  308. package/templates/flutter/lib/ui/load_state.dart +62 -0
  309. package/templates/flutter/lib/ui/product_page.dart +71 -0
  310. package/templates/flutter/lib/ui/quiz_page.dart +83 -0
  311. package/templates/flutter/lib/ui/storefront_page.dart +85 -0
  312. package/templates/flutter/package.json +20 -0
  313. package/templates/flutter/packages/businessdash_forms/analysis_options.yaml +8 -0
  314. package/templates/flutter/packages/businessdash_forms/lib/businessdash_forms.dart +47 -0
  315. package/templates/flutter/packages/businessdash_forms/lib/src/controls/choice.dart +865 -0
  316. package/templates/flutter/packages/businessdash_forms/lib/src/controls/dates.dart +527 -0
  317. package/templates/flutter/packages/businessdash_forms/lib/src/controls/media.dart +507 -0
  318. package/templates/flutter/packages/businessdash_forms/lib/src/controls/static.dart +302 -0
  319. package/templates/flutter/packages/businessdash_forms/lib/src/controls/text.dart +537 -0
  320. package/templates/flutter/packages/businessdash_forms/lib/src/form.dart +781 -0
  321. package/templates/flutter/packages/businessdash_forms/lib/src/icons.dart +398 -0
  322. package/templates/flutter/packages/businessdash_forms/lib/src/logic.dart +719 -0
  323. package/templates/flutter/packages/businessdash_forms/lib/src/primitives.dart +1223 -0
  324. package/templates/flutter/packages/businessdash_forms/lib/src/quiz.dart +1225 -0
  325. package/templates/flutter/packages/businessdash_forms/lib/src/sign_in.dart +570 -0
  326. package/templates/flutter/packages/businessdash_forms/lib/src/sign_in_core.dart +1069 -0
  327. package/templates/flutter/packages/businessdash_forms/lib/src/style.dart +497 -0
  328. package/templates/flutter/packages/businessdash_forms/lib/src/tree.dart +491 -0
  329. package/templates/flutter/packages/businessdash_forms/pubspec.yaml +34 -0
  330. package/templates/flutter/packages/businessdash_forms/test/form_widget_test.dart +358 -0
  331. package/templates/flutter/packages/businessdash_forms/test/logic_test.dart +207 -0
  332. package/templates/flutter/packages/businessdash_forms/test/quiz_widget_test.dart +221 -0
  333. package/templates/flutter/packages/businessdash_forms/test/sign_in_test.dart +279 -0
  334. package/templates/flutter/packages/businessdash_sdk/CHANGELOG.md +66 -0
  335. package/templates/flutter/packages/businessdash_sdk/LICENSE +21 -0
  336. package/templates/flutter/packages/businessdash_sdk/analysis_options.yaml +6 -0
  337. package/templates/flutter/packages/businessdash_sdk/lib/businessdash_sdk.dart +21 -0
  338. package/templates/flutter/packages/businessdash_sdk/lib/forms.dart +29 -0
  339. package/templates/flutter/packages/businessdash_sdk/lib/src/bundle.dart +34 -0
  340. package/templates/flutter/packages/businessdash_sdk/lib/src/chat.dart +122 -0
  341. package/templates/flutter/packages/businessdash_sdk/lib/src/client.dart +161 -0
  342. package/templates/flutter/packages/businessdash_sdk/lib/src/customer_account.dart +31 -0
  343. package/templates/flutter/packages/businessdash_sdk/lib/src/donations.dart +179 -0
  344. package/templates/flutter/packages/businessdash_sdk/lib/src/errors.dart +82 -0
  345. package/templates/flutter/packages/businessdash_sdk/lib/src/forms/backend.dart +488 -0
  346. package/templates/flutter/packages/businessdash_sdk/lib/src/forms/calculation.dart +172 -0
  347. package/templates/flutter/packages/businessdash_sdk/lib/src/forms/controller.dart +1004 -0
  348. package/templates/flutter/packages/businessdash_sdk/lib/src/forms/dates.dart +173 -0
  349. package/templates/flutter/packages/businessdash_sdk/lib/src/forms/forms_data.generated.dart +405 -0
  350. package/templates/flutter/packages/businessdash_sdk/lib/src/forms/formula.dart +920 -0
  351. package/templates/flutter/packages/businessdash_sdk/lib/src/forms/json.dart +462 -0
  352. package/templates/flutter/packages/businessdash_sdk/lib/src/forms/quiz.dart +1185 -0
  353. package/templates/flutter/packages/businessdash_sdk/lib/src/forms/quiz_backend.dart +382 -0
  354. package/templates/flutter/packages/businessdash_sdk/lib/src/forms/quiz_controller.dart +277 -0
  355. package/templates/flutter/packages/businessdash_sdk/lib/src/forms/quiz_page.dart +148 -0
  356. package/templates/flutter/packages/businessdash_sdk/lib/src/forms/quiz_scoring.dart +550 -0
  357. package/templates/flutter/packages/businessdash_sdk/lib/src/forms/quiz_screen.dart +388 -0
  358. package/templates/flutter/packages/businessdash_sdk/lib/src/forms/quiz_words.dart +280 -0
  359. package/templates/flutter/packages/businessdash_sdk/lib/src/forms/rules.dart +1268 -0
  360. package/templates/flutter/packages/businessdash_sdk/lib/src/forms/schema.dart +1114 -0
  361. package/templates/flutter/packages/businessdash_sdk/lib/src/forms/units.dart +105 -0
  362. package/templates/flutter/packages/businessdash_sdk/lib/src/models.dart +311 -0
  363. package/templates/flutter/packages/businessdash_sdk/lib/src/money.dart +38 -0
  364. package/templates/flutter/packages/businessdash_sdk/lib/src/portal.dart +227 -0
  365. package/templates/flutter/packages/businessdash_sdk/lib/src/resources.dart +164 -0
  366. package/templates/flutter/packages/businessdash_sdk/lib/src/scheduling.dart +135 -0
  367. package/templates/flutter/packages/businessdash_sdk/lib/src/seo.dart +144 -0
  368. package/templates/flutter/packages/businessdash_sdk/lib/src/social_platforms.generated.dart +45 -0
  369. package/templates/flutter/packages/businessdash_sdk/lib/src/socials.dart +88 -0
  370. package/templates/flutter/packages/businessdash_sdk/pubspec.yaml +23 -0
  371. package/templates/flutter/packages/businessdash_sdk/test/bd_test.dart +335 -0
  372. package/templates/flutter/packages/businessdash_sdk/test/fixtures/forms-parity.json +3806 -0
  373. package/templates/flutter/packages/businessdash_sdk/test/fixtures/quiz-parity.json +9937 -0
  374. package/templates/flutter/packages/businessdash_sdk/test/form_controller_test.dart +449 -0
  375. package/templates/flutter/packages/businessdash_sdk/test/forms_parity_test.dart +254 -0
  376. package/templates/flutter/packages/businessdash_sdk/test/quiz_controller_test.dart +390 -0
  377. package/templates/flutter/packages/businessdash_sdk/test/quiz_parity_test.dart +269 -0
  378. package/templates/flutter/pnpm-lock.yaml +347 -0
  379. package/templates/flutter/pubspec.yaml +33 -0
  380. package/templates/flutter/tsconfig.json +19 -0
  381. package/templates/htmx/.env.example +59 -0
  382. package/templates/htmx/README.md +446 -0
  383. package/templates/htmx/_gitignore +7 -0
  384. package/templates/htmx/bd.config.ts +331 -0
  385. package/templates/htmx/bd.data-model.config.ts +89 -0
  386. package/templates/htmx/package.json +27 -0
  387. package/templates/htmx/pnpm-lock.yaml +97 -0
  388. package/templates/htmx/public/forms.css +1134 -0
  389. package/templates/htmx/public/index.html +68 -0
  390. package/templates/htmx/public/styles.css +1078 -0
  391. package/templates/htmx/server.ts +387 -0
  392. package/templates/htmx/src/bd.ts +142 -0
  393. package/templates/htmx/src/cache.ts +45 -0
  394. package/templates/htmx/src/form-pages.ts +35 -0
  395. package/templates/htmx/src/form.ts +955 -0
  396. package/templates/htmx/src/forms/demo-form.json +283 -0
  397. package/templates/htmx/src/forms/demo-quiz.json +97 -0
  398. package/templates/htmx/src/html.ts +55 -0
  399. package/templates/htmx/src/layout.ts +232 -0
  400. package/templates/htmx/src/pages.ts +975 -0
  401. package/templates/htmx/src/quiz.ts +582 -0
  402. package/templates/htmx/src/sections/about.ts +63 -0
  403. package/templates/htmx/src/sections/blog.ts +53 -0
  404. package/templates/htmx/src/sections/header.ts +42 -0
  405. package/templates/htmx/src/sections/hero.ts +48 -0
  406. package/templates/htmx/src/sections/services.ts +71 -0
  407. package/templates/htmx/src/sections/subscribe.ts +141 -0
  408. package/templates/htmx/src/sign-in.ts +636 -0
  409. package/templates/htmx/tsconfig.json +19 -0
  410. package/templates/kotlin/README.md +318 -0
  411. package/templates/kotlin/_gitignore +12 -0
  412. package/templates/kotlin/app/build.gradle.kts +70 -0
  413. package/templates/kotlin/app/src/main/AndroidManifest.xml +21 -0
  414. package/templates/kotlin/app/src/main/assets/bd-demo-form.json +283 -0
  415. package/templates/kotlin/app/src/main/assets/bd-demo-quiz.json +97 -0
  416. package/templates/kotlin/app/src/main/kotlin/app/bdstarter/AccountScreen.kt +209 -0
  417. package/templates/kotlin/app/src/main/kotlin/app/bdstarter/BdApp.kt +68 -0
  418. package/templates/kotlin/app/src/main/kotlin/app/bdstarter/DemoFormsBackend.kt +52 -0
  419. package/templates/kotlin/app/src/main/kotlin/app/bdstarter/FormScreen.kt +37 -0
  420. package/templates/kotlin/app/src/main/kotlin/app/bdstarter/MainActivity.kt +186 -0
  421. package/templates/kotlin/app/src/main/kotlin/app/bdstarter/QuizScreen.kt +75 -0
  422. package/templates/kotlin/app/src/main/kotlin/app/bdstarter/SessionStore.kt +68 -0
  423. package/templates/kotlin/app/src/main/kotlin/app/bdstarter/ShopViewModel.kt +73 -0
  424. package/templates/kotlin/app/src/main/res/values/strings.xml +4 -0
  425. package/templates/kotlin/app/src/main/res/values/themes.xml +5 -0
  426. package/templates/kotlin/app/src/main/res/values-night/themes.xml +4 -0
  427. package/templates/kotlin/bd/LICENSE +21 -0
  428. package/templates/kotlin/bd/README.md +31 -0
  429. package/templates/kotlin/bd/build.gradle.kts +126 -0
  430. package/templates/kotlin/bd/src/main/kotlin/app/bd/Auth.kt +58 -0
  431. package/templates/kotlin/bd/src/main/kotlin/app/bd/BdClient.kt +166 -0
  432. package/templates/kotlin/bd/src/main/kotlin/app/bd/BdError.kt +62 -0
  433. package/templates/kotlin/bd/src/main/kotlin/app/bd/Bundle.kt +52 -0
  434. package/templates/kotlin/bd/src/main/kotlin/app/bd/ChatFeed.kt +82 -0
  435. package/templates/kotlin/bd/src/main/kotlin/app/bd/DataModel.kt +95 -0
  436. package/templates/kotlin/bd/src/main/kotlin/app/bd/Donations.kt +111 -0
  437. package/templates/kotlin/bd/src/main/kotlin/app/bd/Models.kt +271 -0
  438. package/templates/kotlin/bd/src/main/kotlin/app/bd/Money.kt +48 -0
  439. package/templates/kotlin/bd/src/main/kotlin/app/bd/Portal.kt +250 -0
  440. package/templates/kotlin/bd/src/main/kotlin/app/bd/Resources.kt +129 -0
  441. package/templates/kotlin/bd/src/main/kotlin/app/bd/Scheduling.kt +134 -0
  442. package/templates/kotlin/bd/src/main/kotlin/app/bd/Seo.kt +120 -0
  443. package/templates/kotlin/bd/src/main/kotlin/app/bd/SocialPlatforms.generated.kt +46 -0
  444. package/templates/kotlin/bd/src/main/kotlin/app/bd/Socials.kt +79 -0
  445. package/templates/kotlin/bd/src/main/kotlin/app/bd/forms/BdCalculation.kt +157 -0
  446. package/templates/kotlin/bd/src/main/kotlin/app/bd/forms/BdDates.kt +108 -0
  447. package/templates/kotlin/bd/src/main/kotlin/app/bd/forms/BdFormController.kt +770 -0
  448. package/templates/kotlin/bd/src/main/kotlin/app/bd/forms/BdFormRules.kt +1149 -0
  449. package/templates/kotlin/bd/src/main/kotlin/app/bd/forms/BdFormSchema.kt +528 -0
  450. package/templates/kotlin/bd/src/main/kotlin/app/bd/forms/BdFormsBackend.kt +392 -0
  451. package/templates/kotlin/bd/src/main/kotlin/app/bd/forms/BdFormula.kt +767 -0
  452. package/templates/kotlin/bd/src/main/kotlin/app/bd/forms/BdJson.kt +294 -0
  453. package/templates/kotlin/bd/src/main/kotlin/app/bd/forms/BdQuizBackend.kt +310 -0
  454. package/templates/kotlin/bd/src/main/kotlin/app/bd/forms/BdQuizController.kt +281 -0
  455. package/templates/kotlin/bd/src/main/kotlin/app/bd/forms/BdQuizEngine.kt +578 -0
  456. package/templates/kotlin/bd/src/main/kotlin/app/bd/forms/BdQuizPage.kt +128 -0
  457. package/templates/kotlin/bd/src/main/kotlin/app/bd/forms/BdQuizScoring.kt +386 -0
  458. package/templates/kotlin/bd/src/main/kotlin/app/bd/forms/BdQuizScreen.kt +477 -0
  459. package/templates/kotlin/bd/src/main/kotlin/app/bd/forms/BdQuizWords.kt +196 -0
  460. package/templates/kotlin/bd/src/main/kotlin/app/bd/forms/BdUnits.kt +84 -0
  461. package/templates/kotlin/bd/src/main/kotlin/app/bd/forms/FormsData.generated.kt +292 -0
  462. package/templates/kotlin/bd/src/test/kotlin/app/bd/BdClientTest.kt +278 -0
  463. package/templates/kotlin/bd/src/test/kotlin/app/bd/forms/FormControllerTest.kt +294 -0
  464. package/templates/kotlin/bd/src/test/kotlin/app/bd/forms/FormsBackendPathTest.kt +27 -0
  465. package/templates/kotlin/bd/src/test/kotlin/app/bd/forms/FormsParityTest.kt +233 -0
  466. package/templates/kotlin/bd/src/test/kotlin/app/bd/forms/PackageFormsBackendTest.kt +123 -0
  467. package/templates/kotlin/bd/src/test/kotlin/app/bd/forms/QuizControllerTest.kt +359 -0
  468. package/templates/kotlin/bd/src/test/kotlin/app/bd/forms/QuizParityTest.kt +260 -0
  469. package/templates/kotlin/bd/src/test/resources/forms-parity.json +3806 -0
  470. package/templates/kotlin/bd/src/test/resources/quiz-parity.json +9937 -0
  471. package/templates/kotlin/bd-forms/build.gradle.kts +51 -0
  472. package/templates/kotlin/bd-forms/src/main/AndroidManifest.xml +5 -0
  473. package/templates/kotlin/bd-forms/src/main/kotlin/app/bd/forms/ui/BdChoiceControls.kt +651 -0
  474. package/templates/kotlin/bd-forms/src/main/kotlin/app/bd/forms/ui/BdDateControls.kt +470 -0
  475. package/templates/kotlin/bd-forms/src/main/kotlin/app/bd/forms/ui/BdFieldControl.kt +520 -0
  476. package/templates/kotlin/bd-forms/src/main/kotlin/app/bd/forms/ui/BdFieldTree.kt +328 -0
  477. package/templates/kotlin/bd-forms/src/main/kotlin/app/bd/forms/ui/BdForm.kt +573 -0
  478. package/templates/kotlin/bd-forms/src/main/kotlin/app/bd/forms/ui/BdFormStyle.kt +279 -0
  479. package/templates/kotlin/bd-forms/src/main/kotlin/app/bd/forms/ui/BdHtml.kt +438 -0
  480. package/templates/kotlin/bd-forms/src/main/kotlin/app/bd/forms/ui/BdIcon.kt +282 -0
  481. package/templates/kotlin/bd-forms/src/main/kotlin/app/bd/forms/ui/BdMediaControls.kt +412 -0
  482. package/templates/kotlin/bd-forms/src/main/kotlin/app/bd/forms/ui/BdQuiz.kt +896 -0
  483. package/templates/kotlin/bd-forms/src/main/kotlin/app/bd/forms/ui/BdStaticViews.kt +250 -0
  484. package/templates/kotlin/bd-forms/src/main/kotlin/app/bd/forms/ui/BdTextControls.kt +409 -0
  485. package/templates/kotlin/bd-forms/src/test/kotlin/app/bd/forms/ui/RendererLogicTest.kt +177 -0
  486. package/templates/kotlin/bd-records/README.md +50 -0
  487. package/templates/kotlin/bd-records/todo-images.json +14 -0
  488. package/templates/kotlin/bd-records/todos.json +20 -0
  489. package/templates/kotlin/bd-sign-in/build.gradle.kts +49 -0
  490. package/templates/kotlin/bd-sign-in/src/main/AndroidManifest.xml +27 -0
  491. package/templates/kotlin/bd-sign-in/src/main/kotlin/app/bd/signin/BdSignIn.kt +713 -0
  492. package/templates/kotlin/bd-sign-in/src/main/kotlin/app/bd/signin/BdSignInBackend.kt +291 -0
  493. package/templates/kotlin/bd-sign-in/src/main/kotlin/app/bd/signin/BdSignInChecks.kt +162 -0
  494. package/templates/kotlin/bd-sign-in/src/main/kotlin/app/bd/signin/BdSignInOAuth.kt +95 -0
  495. package/templates/kotlin/bd-sign-in/src/test/kotlin/app/bd/signin/BdSignInChecksTest.kt +64 -0
  496. package/templates/kotlin/bd.config.ts +331 -0
  497. package/templates/kotlin/bd.data-model.config.ts +89 -0
  498. package/templates/kotlin/build.gradle.kts +8 -0
  499. package/templates/kotlin/gradle/libs.versions.toml +38 -0
  500. package/templates/kotlin/gradle/wrapper/gradle-wrapper.jar +0 -0
  501. package/templates/kotlin/gradle/wrapper/gradle-wrapper.properties +10 -0
  502. package/templates/kotlin/gradle.properties +8 -0
  503. package/templates/kotlin/gradlew +248 -0
  504. package/templates/kotlin/gradlew.bat +112 -0
  505. package/templates/kotlin/local.properties.example +30 -0
  506. package/templates/kotlin/package.json +20 -0
  507. package/templates/kotlin/pnpm-lock.yaml +347 -0
  508. package/templates/kotlin/settings.gradle.kts +39 -0
  509. package/templates/kotlin/tsconfig.json +19 -0
  510. package/templates/laravel/.env.example +76 -0
  511. package/templates/laravel/README.md +316 -0
  512. package/templates/laravel/_gitignore +28 -0
  513. package/templates/laravel/app/Bd/Auth.php +181 -0
  514. package/templates/laravel/app/Bd/Bd.php +131 -0
  515. package/templates/laravel/app/Bd/BdAccessRejectedException.php +29 -0
  516. package/templates/laravel/app/Bd/BdApiException.php +18 -0
  517. package/templates/laravel/app/Bd/Client.php +358 -0
  518. package/templates/laravel/app/Bd/CustomerAnswer.php +58 -0
  519. package/templates/laravel/app/Bd/CustomerAuth.php +93 -0
  520. package/templates/laravel/app/Bd/Forms/Backend.php +35 -0
  521. package/templates/laravel/app/Bd/Forms/Calculation.php +179 -0
  522. package/templates/laravel/app/Bd/Forms/Dates.php +91 -0
  523. package/templates/laravel/app/Bd/Forms/Field.php +274 -0
  524. package/templates/laravel/app/Bd/Forms/FieldPath.php +36 -0
  525. package/templates/laravel/app/Bd/Forms/FormController.php +730 -0
  526. package/templates/laravel/app/Bd/Forms/FormView.php +307 -0
  527. package/templates/laravel/app/Bd/Forms/Forms.php +39 -0
  528. package/templates/laravel/app/Bd/Forms/FormsData.php +298 -0
  529. package/templates/laravel/app/Bd/Forms/FormsError.php +12 -0
  530. package/templates/laravel/app/Bd/Forms/Formula.php +696 -0
  531. package/templates/laravel/app/Bd/Forms/FormulaError.php +6 -0
  532. package/templates/laravel/app/Bd/Forms/FormulaParser.php +223 -0
  533. package/templates/laravel/app/Bd/Forms/Js.php +300 -0
  534. package/templates/laravel/app/Bd/Forms/Json.php +254 -0
  535. package/templates/laravel/app/Bd/Forms/Messages.php +89 -0
  536. package/templates/laravel/app/Bd/Forms/PackageBackend.php +181 -0
  537. package/templates/laravel/app/Bd/Forms/PickedFile.php +25 -0
  538. package/templates/laravel/app/Bd/Forms/QuizArrange.php +144 -0
  539. package/templates/laravel/app/Bd/Forms/QuizBackend.php +26 -0
  540. package/templates/laravel/app/Bd/Forms/QuizConfig.php +65 -0
  541. package/templates/laravel/app/Bd/Forms/QuizController.php +232 -0
  542. package/templates/laravel/app/Bd/Forms/QuizEngine.php +712 -0
  543. package/templates/laravel/app/Bd/Forms/QuizOptions.php +109 -0
  544. package/templates/laravel/app/Bd/Forms/QuizPage.php +99 -0
  545. package/templates/laravel/app/Bd/Forms/QuizScoring.php +459 -0
  546. package/templates/laravel/app/Bd/Forms/QuizState.php +96 -0
  547. package/templates/laravel/app/Bd/Forms/QuizWords.php +188 -0
  548. package/templates/laravel/app/Bd/Forms/Quizzes.php +123 -0
  549. package/templates/laravel/app/Bd/Forms/Rules.php +1593 -0
  550. package/templates/laravel/app/Bd/Forms/SampleBackend.php +48 -0
  551. package/templates/laravel/app/Bd/Forms/Schema.php +76 -0
  552. package/templates/laravel/app/Bd/Forms/Submission.php +33 -0
  553. package/templates/laravel/app/Bd/Forms/SubmitOptions.php +19 -0
  554. package/templates/laravel/app/Bd/Forms/SubmitResult.php +69 -0
  555. package/templates/laravel/app/Bd/Forms/Undefined.php +28 -0
  556. package/templates/laravel/app/Bd/Forms/Units.php +113 -0
  557. package/templates/laravel/app/Bd/Resources/Blog.php +50 -0
  558. package/templates/laravel/app/Bd/Resources/Cart.php +81 -0
  559. package/templates/laravel/app/Bd/Resources/Chatbot.php +117 -0
  560. package/templates/laravel/app/Bd/Resources/Checkout.php +51 -0
  561. package/templates/laravel/app/Bd/Resources/DataModel.php +61 -0
  562. package/templates/laravel/app/Bd/Resources/Donations.php +74 -0
  563. package/templates/laravel/app/Bd/Resources/Followers.php +48 -0
  564. package/templates/laravel/app/Bd/Resources/Forms.php +52 -0
  565. package/templates/laravel/app/Bd/Resources/Marketing.php +47 -0
  566. package/templates/laravel/app/Bd/Resources/Notifications.php +130 -0
  567. package/templates/laravel/app/Bd/Resources/ParallelPages.php +45 -0
  568. package/templates/laravel/app/Bd/Resources/Portal.php +241 -0
  569. package/templates/laravel/app/Bd/Resources/Reviews.php +22 -0
  570. package/templates/laravel/app/Bd/Resources/Scheduling.php +170 -0
  571. package/templates/laravel/app/Bd/Resources/Storefront.php +89 -0
  572. package/templates/laravel/app/Bd/Resources/Subscriptions.php +34 -0
  573. package/templates/laravel/app/Bd/Seo.php +167 -0
  574. package/templates/laravel/app/Bd/SignInCore.php +276 -0
  575. package/templates/laravel/app/Bd/SocialPlatforms.php +45 -0
  576. package/templates/laravel/app/Bd/Socials.php +118 -0
  577. package/templates/laravel/app/Bd/Webhook.php +93 -0
  578. package/templates/laravel/app/Http/Controllers/BdAuthController.php +146 -0
  579. package/templates/laravel/app/Http/Controllers/BdCustomerAuthController.php +214 -0
  580. package/templates/laravel/app/Http/Controllers/BlogController.php +49 -0
  581. package/templates/laravel/app/Http/Controllers/CartController.php +183 -0
  582. package/templates/laravel/app/Http/Controllers/Controller.php +8 -0
  583. package/templates/laravel/app/Http/Controllers/FormPageController.php +55 -0
  584. package/templates/laravel/app/Http/Controllers/HomeController.php +104 -0
  585. package/templates/laravel/app/Http/Controllers/PortalController.php +95 -0
  586. package/templates/laravel/app/Http/Controllers/SeoController.php +103 -0
  587. package/templates/laravel/app/Http/Controllers/ServiceAreaController.php +56 -0
  588. package/templates/laravel/app/Http/Controllers/StoreController.php +78 -0
  589. package/templates/laravel/app/Http/Controllers/SubscriptionController.php +40 -0
  590. package/templates/laravel/app/Http/Controllers/TodosController.php +87 -0
  591. package/templates/laravel/app/Http/Controllers/WebhookController.php +44 -0
  592. package/templates/laravel/app/Livewire/BdForm.php +508 -0
  593. package/templates/laravel/app/Livewire/BdQuiz.php +429 -0
  594. package/templates/laravel/app/Livewire/SignIn.php +449 -0
  595. package/templates/laravel/app/Support/Money.php +54 -0
  596. package/templates/laravel/app/Support/PhpSecurity.php +94 -0
  597. package/templates/laravel/artisan +16 -0
  598. package/templates/laravel/bd-records/README.md +50 -0
  599. package/templates/laravel/bd-records/todo-images.json +14 -0
  600. package/templates/laravel/bd-records/todos.json +20 -0
  601. package/templates/laravel/bd.config.ts +331 -0
  602. package/templates/laravel/bd.data-model.config.ts +89 -0
  603. package/templates/laravel/bootstrap/app.php +33 -0
  604. package/templates/laravel/bootstrap/cache/.gitkeep +0 -0
  605. package/templates/laravel/composer.json +47 -0
  606. package/templates/laravel/config/bd.php +75 -0
  607. package/templates/laravel/package.json +20 -0
  608. package/templates/laravel/phpunit.xml +22 -0
  609. package/templates/laravel/pnpm-lock.yaml +347 -0
  610. package/templates/laravel/public/bd-sign-in.css +48 -0
  611. package/templates/laravel/public/forms.css +1153 -0
  612. package/templates/laravel/public/index.php +17 -0
  613. package/templates/laravel/public/styles.css +100 -0
  614. package/templates/laravel/resources/forms/demo-form.json +283 -0
  615. package/templates/laravel/resources/forms/demo-quiz.json +97 -0
  616. package/templates/laravel/resources/views/forms/control.blade.php +238 -0
  617. package/templates/laravel/resources/views/forms/field.blade.php +39 -0
  618. package/templates/laravel/resources/views/forms/files.blade.php +36 -0
  619. package/templates/laravel/resources/views/forms/pair.blade.php +6 -0
  620. package/templates/laravel/resources/views/forms/repeater.blade.php +16 -0
  621. package/templates/laravel/resources/views/forms/styles.blade.php +8 -0
  622. package/templates/laravel/resources/views/forms/tree.blade.php +58 -0
  623. package/templates/laravel/resources/views/layout.blade.php +94 -0
  624. package/templates/laravel/resources/views/livewire/bd-form.blade.php +103 -0
  625. package/templates/laravel/resources/views/livewire/bd-quiz.blade.php +101 -0
  626. package/templates/laravel/resources/views/livewire/sign-in.blade.php +82 -0
  627. package/templates/laravel/resources/views/pages/blog-post.blade.php +24 -0
  628. package/templates/laravel/resources/views/pages/blog.blade.php +15 -0
  629. package/templates/laravel/resources/views/pages/cart.blade.php +41 -0
  630. package/templates/laravel/resources/views/pages/delete-account.blade.php +26 -0
  631. package/templates/laravel/resources/views/pages/form.blade.php +10 -0
  632. package/templates/laravel/resources/views/pages/home.blade.php +73 -0
  633. package/templates/laravel/resources/views/pages/my-account.blade.php +40 -0
  634. package/templates/laravel/resources/views/pages/product.blade.php +39 -0
  635. package/templates/laravel/resources/views/pages/quiz.blade.php +12 -0
  636. package/templates/laravel/resources/views/pages/reviews.blade.php +17 -0
  637. package/templates/laravel/resources/views/pages/service-area.blade.php +14 -0
  638. package/templates/laravel/resources/views/pages/services.blade.php +20 -0
  639. package/templates/laravel/resources/views/pages/sign-in.blade.php +30 -0
  640. package/templates/laravel/resources/views/pages/store.blade.php +35 -0
  641. package/templates/laravel/resources/views/pages/subscriptions.blade.php +19 -0
  642. package/templates/laravel/resources/views/pages/todos.blade.php +45 -0
  643. package/templates/laravel/resources/views/pages/updates.blade.php +13 -0
  644. package/templates/laravel/resources/views/quiz/actions.blade.php +14 -0
  645. package/templates/laravel/resources/views/quiz/error.blade.php +3 -0
  646. package/templates/laravel/resources/views/quiz/feedback.blade.php +19 -0
  647. package/templates/laravel/resources/views/quiz/header.blade.php +10 -0
  648. package/templates/laravel/resources/views/quiz/question.blade.php +55 -0
  649. package/templates/laravel/routes/web.php +97 -0
  650. package/templates/laravel/storage/framework/cache/.gitkeep +0 -0
  651. package/templates/laravel/storage/framework/sessions/.gitkeep +0 -0
  652. package/templates/laravel/storage/framework/views/.gitkeep +0 -0
  653. package/templates/laravel/storage/logs/.gitkeep +0 -0
  654. package/templates/laravel/tests/Fixtures/forms-parity.json +3806 -0
  655. package/templates/laravel/tests/Fixtures/quiz-parity.json +9937 -0
  656. package/templates/laravel/tests/Unit/FormControllerTest.php +310 -0
  657. package/templates/laravel/tests/Unit/FormsParityTest.php +314 -0
  658. package/templates/laravel/tests/Unit/PhpSecurityTest.php +38 -0
  659. package/templates/laravel/tests/Unit/QuizParityTest.php +303 -0
  660. package/templates/laravel/tsconfig.json +19 -0
  661. package/templates/nuxt/.env.example +47 -0
  662. package/templates/nuxt/README.md +446 -0
  663. package/templates/nuxt/_gitignore +10 -0
  664. package/templates/nuxt/app/app.vue +28 -0
  665. package/templates/nuxt/app/assets/css/bd-tokens.css +944 -0
  666. package/templates/nuxt/app/components/bd/About.vue +34 -0
  667. package/templates/nuxt/app/components/bd/BdFooter.vue +22 -0
  668. package/templates/nuxt/app/components/bd/BdHeader.vue +25 -0
  669. package/templates/nuxt/app/components/bd/Blog.vue +43 -0
  670. package/templates/nuxt/app/components/bd/Booking.vue +235 -0
  671. package/templates/nuxt/app/components/bd/ContactForm.vue +111 -0
  672. package/templates/nuxt/app/components/bd/Gallery.vue +46 -0
  673. package/templates/nuxt/app/components/bd/Hero.vue +14 -0
  674. package/templates/nuxt/app/components/bd/NewsBanner.vue +44 -0
  675. package/templates/nuxt/app/components/bd/NotFoundBody.vue +22 -0
  676. package/templates/nuxt/app/components/bd/ReviewForm.vue +106 -0
  677. package/templates/nuxt/app/components/bd/SdkSetupBanner.vue +111 -0
  678. package/templates/nuxt/app/components/bd/Services.vue +34 -0
  679. package/templates/nuxt/app/components/bd/Subscribe.vue +205 -0
  680. package/templates/nuxt/app/composables/useCart.ts +83 -0
  681. package/templates/nuxt/app/pages/[...slug].vue +52 -0
  682. package/templates/nuxt/app/pages/cart.vue +194 -0
  683. package/templates/nuxt/app/pages/index.vue +58 -0
  684. package/templates/nuxt/app/pages/my-account.vue +207 -0
  685. package/templates/nuxt/app/pages/reviews.vue +104 -0
  686. package/templates/nuxt/app/pages/services/[service]/[area].vue +85 -0
  687. package/templates/nuxt/app/pages/services/index.vue +57 -0
  688. package/templates/nuxt/app/pages/store/[id].vue +128 -0
  689. package/templates/nuxt/app/pages/store/index.vue +73 -0
  690. package/templates/nuxt/app/pages/subscriptions.vue +117 -0
  691. package/templates/nuxt/app/pages/todos.vue +222 -0
  692. package/templates/nuxt/app/pages/updates.vue +78 -0
  693. package/templates/nuxt/bd.config.ts +331 -0
  694. package/templates/nuxt/bd.data-model.config.ts +89 -0
  695. package/templates/nuxt/nuxt.config.ts +78 -0
  696. package/templates/nuxt/package.json +35 -0
  697. package/templates/nuxt/pnpm-lock.yaml +6211 -0
  698. package/templates/nuxt/public/favicon.ico +0 -0
  699. package/templates/nuxt/server/api/bd/cart/add.post.ts +21 -0
  700. package/templates/nuxt/server/api/bd/cart/clear.post.ts +10 -0
  701. package/templates/nuxt/server/api/bd/cart/coupon.post.ts +15 -0
  702. package/templates/nuxt/server/api/bd/cart/index.get.ts +25 -0
  703. package/templates/nuxt/server/api/bd/cart/remove.post.ts +10 -0
  704. package/templates/nuxt/server/api/bd/cart/update.post.ts +13 -0
  705. package/templates/nuxt/server/api/bd/checkout/start.post.ts +35 -0
  706. package/templates/nuxt/server/api/bd/forms/[slug].post.ts +37 -0
  707. package/templates/nuxt/server/api/bd/home.get.ts +284 -0
  708. package/templates/nuxt/server/api/bd/jsonld.get.ts +42 -0
  709. package/templates/nuxt/server/api/bd/legal.get.ts +30 -0
  710. package/templates/nuxt/server/api/bd/parallel/render.get.ts +53 -0
  711. package/templates/nuxt/server/api/bd/parallel/variants.get.ts +27 -0
  712. package/templates/nuxt/server/api/bd/portal/context.get.ts +76 -0
  713. package/templates/nuxt/server/api/bd/portal/plan.post.ts +27 -0
  714. package/templates/nuxt/server/api/bd/portal/submit-review.post.ts +53 -0
  715. package/templates/nuxt/server/api/bd/revalidate.post.ts +38 -0
  716. package/templates/nuxt/server/api/bd/reviews.get.ts +44 -0
  717. package/templates/nuxt/server/api/bd/scheduling/bookings.post.ts +40 -0
  718. package/templates/nuxt/server/api/bd/scheduling/slots.get.ts +37 -0
  719. package/templates/nuxt/server/api/bd/store/product/[id].get.ts +39 -0
  720. package/templates/nuxt/server/api/bd/store/products-meta.get.ts +101 -0
  721. package/templates/nuxt/server/api/bd/store/products.get.ts +53 -0
  722. package/templates/nuxt/server/api/bd/store/subscriptions/[id]/checkout.post.ts +36 -0
  723. package/templates/nuxt/server/api/bd/store/subscriptions.get.ts +42 -0
  724. package/templates/nuxt/server/api/bd/todos.get.ts +111 -0
  725. package/templates/nuxt/server/api/bd-auth/[...slug].ts +57 -0
  726. package/templates/nuxt/server/api/mcp.get.ts +14 -0
  727. package/templates/nuxt/server/api/mcp.post.ts +37 -0
  728. package/templates/nuxt/server/routes/.well-known/mcp.json.ts +31 -0
  729. package/templates/nuxt/server/routes/llms.txt.ts +43 -0
  730. package/templates/nuxt/server/routes/robots.txt.ts +38 -0
  731. package/templates/nuxt/server/routes/sitemap.xml.ts +60 -0
  732. package/templates/nuxt/server/utils/bd-cart.ts +73 -0
  733. package/templates/nuxt/server/utils/bd-env.ts +54 -0
  734. package/templates/nuxt/server/utils/bd-portal.ts +151 -0
  735. package/templates/nuxt/server/utils/bd.ts +36 -0
  736. package/templates/nuxt/tsconfig.json +18 -0
  737. package/templates/qwik/.env.example +48 -0
  738. package/templates/qwik/.prettierignore +37 -0
  739. package/templates/qwik/.vscode/launch.json +24 -0
  740. package/templates/qwik/.vscode/qwik-city.code-snippets +36 -0
  741. package/templates/qwik/.vscode/qwik.code-snippets +78 -0
  742. package/templates/qwik/README.md +436 -0
  743. package/templates/qwik/_gitignore +42 -0
  744. package/templates/qwik/bd.config.ts +331 -0
  745. package/templates/qwik/bd.data-model.config.ts +90 -0
  746. package/templates/qwik/eslint.config.js +76 -0
  747. package/templates/qwik/package.json +58 -0
  748. package/templates/qwik/pnpm-lock.yaml +4928 -0
  749. package/templates/qwik/public/favicon.svg +1 -0
  750. package/templates/qwik/public/manifest.json +9 -0
  751. package/templates/qwik/public/robots.txt +0 -0
  752. package/templates/qwik/qwik.env.d.ts +4 -0
  753. package/templates/qwik/src/components/bd/About.tsx +26 -0
  754. package/templates/qwik/src/components/bd/Banner.tsx +46 -0
  755. package/templates/qwik/src/components/bd/Blog.tsx +53 -0
  756. package/templates/qwik/src/components/bd/Booking.tsx +296 -0
  757. package/templates/qwik/src/components/bd/ContactForm.tsx +100 -0
  758. package/templates/qwik/src/components/bd/Footer.tsx +28 -0
  759. package/templates/qwik/src/components/bd/Gallery.tsx +53 -0
  760. package/templates/qwik/src/components/bd/Header.tsx +18 -0
  761. package/templates/qwik/src/components/bd/Hero.tsx +21 -0
  762. package/templates/qwik/src/components/bd/SdkSetupBanner.tsx +115 -0
  763. package/templates/qwik/src/components/bd/Services.tsx +38 -0
  764. package/templates/qwik/src/components/bd/SiteHeader.tsx +49 -0
  765. package/templates/qwik/src/components/bd/Stars.tsx +46 -0
  766. package/templates/qwik/src/components/bd/Subscribe.tsx +175 -0
  767. package/templates/qwik/src/components/router-head/router-head.tsx +48 -0
  768. package/templates/qwik/src/entry.dev.tsx +17 -0
  769. package/templates/qwik/src/entry.preview.tsx +21 -0
  770. package/templates/qwik/src/entry.ssr.tsx +31 -0
  771. package/templates/qwik/src/global.css +875 -0
  772. package/templates/qwik/src/lib/bd-content.ts +143 -0
  773. package/templates/qwik/src/lib/bd-distribution.ts +25 -0
  774. package/templates/qwik/src/lib/bd-portal.ts +181 -0
  775. package/templates/qwik/src/lib/bd-store.ts +308 -0
  776. package/templates/qwik/src/lib/bd-todos.ts +137 -0
  777. package/templates/qwik/src/lib/bd.ts +42 -0
  778. package/templates/qwik/src/root.tsx +38 -0
  779. package/templates/qwik/src/routes/.well-known/mcp.json/index.ts +19 -0
  780. package/templates/qwik/src/routes/[...slug]/index.tsx +85 -0
  781. package/templates/qwik/src/routes/ai/product-feed/index.ts +24 -0
  782. package/templates/qwik/src/routes/api/bd/revalidate/index.ts +45 -0
  783. package/templates/qwik/src/routes/api/bd-auth/[...slug]/index.ts +77 -0
  784. package/templates/qwik/src/routes/api/mcp/index.ts +38 -0
  785. package/templates/qwik/src/routes/cart/index.tsx +254 -0
  786. package/templates/qwik/src/routes/index.tsx +239 -0
  787. package/templates/qwik/src/routes/llms.txt/index.ts +23 -0
  788. package/templates/qwik/src/routes/my-account/index.tsx +370 -0
  789. package/templates/qwik/src/routes/reviews/index.tsx +147 -0
  790. package/templates/qwik/src/routes/robots.txt/index.ts +70 -0
  791. package/templates/qwik/src/routes/services/[service]/[area]/index.tsx +115 -0
  792. package/templates/qwik/src/routes/services/index.tsx +99 -0
  793. package/templates/qwik/src/routes/sitemap.xml/index.ts +62 -0
  794. package/templates/qwik/src/routes/store/[id]/index.tsx +362 -0
  795. package/templates/qwik/src/routes/store/index.tsx +436 -0
  796. package/templates/qwik/src/routes/store/order/index.tsx +74 -0
  797. package/templates/qwik/src/routes/subscriptions/index.tsx +164 -0
  798. package/templates/qwik/src/routes/todos/index.tsx +202 -0
  799. package/templates/qwik/src/routes/updates/index.tsx +106 -0
  800. package/templates/qwik/tsconfig.json +26 -0
  801. package/templates/qwik/vite.config.ts +115 -0
  802. package/templates/react-bun/.env.example +65 -0
  803. package/templates/react-bun/README.md +354 -0
  804. package/templates/react-bun/_gitignore +24 -0
  805. package/templates/react-bun/bd.config.ts +331 -0
  806. package/templates/react-bun/bd.data-model.config.ts +90 -0
  807. package/templates/react-bun/eslint.config.js +22 -0
  808. package/templates/react-bun/index.html +13 -0
  809. package/templates/react-bun/package.json +46 -0
  810. package/templates/react-bun/pnpm-lock.yaml +2060 -0
  811. package/templates/react-bun/public/favicon.svg +1 -0
  812. package/templates/react-bun/public/icons.svg +24 -0
  813. package/templates/react-bun/server.ts +978 -0
  814. package/templates/react-bun/src/App.css +910 -0
  815. package/templates/react-bun/src/App.tsx +104 -0
  816. package/templates/react-bun/src/assets/hero.png +0 -0
  817. package/templates/react-bun/src/assets/react.svg +1 -0
  818. package/templates/react-bun/src/assets/vite.svg +1 -0
  819. package/templates/react-bun/src/components/About.tsx +46 -0
  820. package/templates/react-bun/src/components/Banner.tsx +53 -0
  821. package/templates/react-bun/src/components/Blog.tsx +84 -0
  822. package/templates/react-bun/src/components/Booking.tsx +278 -0
  823. package/templates/react-bun/src/components/ContactForm.tsx +47 -0
  824. package/templates/react-bun/src/components/Footer.tsx +24 -0
  825. package/templates/react-bun/src/components/Gallery.tsx +83 -0
  826. package/templates/react-bun/src/components/Header.tsx +27 -0
  827. package/templates/react-bun/src/components/Hero.tsx +65 -0
  828. package/templates/react-bun/src/components/SdkSetupBanner.tsx +102 -0
  829. package/templates/react-bun/src/components/Services.tsx +92 -0
  830. package/templates/react-bun/src/components/Subscribe.tsx +169 -0
  831. package/templates/react-bun/src/index.css +302 -0
  832. package/templates/react-bun/src/lib/bd.ts +370 -0
  833. package/templates/react-bun/src/lib/router.tsx +54 -0
  834. package/templates/react-bun/src/main.tsx +14 -0
  835. package/templates/react-bun/src/pages/Cart.tsx +144 -0
  836. package/templates/react-bun/src/pages/MyAccount.tsx +207 -0
  837. package/templates/react-bun/src/pages/Product.tsx +220 -0
  838. package/templates/react-bun/src/pages/Reviews.tsx +73 -0
  839. package/templates/react-bun/src/pages/ServiceArea.tsx +41 -0
  840. package/templates/react-bun/src/pages/ServiceAreas.tsx +31 -0
  841. package/templates/react-bun/src/pages/Store.tsx +274 -0
  842. package/templates/react-bun/src/pages/Subscriptions.tsx +70 -0
  843. package/templates/react-bun/src/pages/Todos.tsx +147 -0
  844. package/templates/react-bun/src/pages/Updates.tsx +53 -0
  845. package/templates/react-bun/src/pages/ui.tsx +52 -0
  846. package/templates/react-bun/tsconfig.app.json +25 -0
  847. package/templates/react-bun/tsconfig.json +7 -0
  848. package/templates/react-bun/tsconfig.node.json +24 -0
  849. package/templates/react-bun/vite.config.ts +41 -0
  850. package/templates/react-native/.env.example +32 -0
  851. package/templates/react-native/README.md +299 -0
  852. package/templates/react-native/SECURITY-NOTES.md +22 -0
  853. package/templates/react-native/_gitignore +21 -0
  854. package/templates/react-native/app/(tabs)/_layout.tsx +13 -0
  855. package/templates/react-native/app/(tabs)/account.tsx +116 -0
  856. package/templates/react-native/app/(tabs)/cart.tsx +79 -0
  857. package/templates/react-native/app/(tabs)/chat.tsx +58 -0
  858. package/templates/react-native/app/(tabs)/form.tsx +41 -0
  859. package/templates/react-native/app/(tabs)/index.tsx +74 -0
  860. package/templates/react-native/app/_layout.tsx +19 -0
  861. package/templates/react-native/app/product/[id].tsx +78 -0
  862. package/templates/react-native/app.json +15 -0
  863. package/templates/react-native/bd-records/README.md +50 -0
  864. package/templates/react-native/bd-records/todo-images.json +14 -0
  865. package/templates/react-native/bd-records/todos.json +20 -0
  866. package/templates/react-native/bd.config.ts +331 -0
  867. package/templates/react-native/bd.data-model.config.ts +89 -0
  868. package/templates/react-native/metro.config.js +16 -0
  869. package/templates/react-native/package.json +51 -0
  870. package/templates/react-native/pnpm-lock.yaml +5967 -0
  871. package/templates/react-native/src/bd/auth.ts +152 -0
  872. package/templates/react-native/src/bd/client.ts +103 -0
  873. package/templates/react-native/src/bd/demo-form.json +283 -0
  874. package/templates/react-native/src/bd/forms.tsx +148 -0
  875. package/templates/react-native/src/bd/money.ts +29 -0
  876. package/templates/react-native/src/bd/session.ts +53 -0
  877. package/templates/react-native/src/bd/useBd.ts +63 -0
  878. package/templates/react-native/src/bd/useChat.ts +116 -0
  879. package/templates/react-native/src/bd-forms/BdForm.tsx +973 -0
  880. package/templates/react-native/src/bd-forms/__tests__/logic.test.ts +195 -0
  881. package/templates/react-native/src/bd-forms/controls.tsx +1966 -0
  882. package/templates/react-native/src/bd-forms/index.ts +34 -0
  883. package/templates/react-native/src/bd-forms/keyboard.ts +139 -0
  884. package/templates/react-native/src/bd-forms/logic.ts +737 -0
  885. package/templates/react-native/src/bd-forms/pickers.tsx +487 -0
  886. package/templates/react-native/src/bd-forms/primitives.tsx +1162 -0
  887. package/templates/react-native/src/bd-forms/runtime.ts +95 -0
  888. package/templates/react-native/src/bd-forms/static.tsx +304 -0
  889. package/templates/react-native/src/bd-forms/theme.ts +385 -0
  890. package/templates/react-native/src/components/LoadState.tsx +53 -0
  891. package/templates/react-native/src/components/SignInScreen.tsx +399 -0
  892. package/templates/react-native/tsconfig.json +19 -0
  893. package/templates/remix/.env.example +63 -0
  894. package/templates/remix/README.md +392 -0
  895. package/templates/remix/_gitignore +10 -0
  896. package/templates/remix/app/components/ContactForm.tsx +55 -0
  897. package/templates/remix/app/components/NewsBanner.tsx +43 -0
  898. package/templates/remix/app/components/SdkSetupBanner.tsx +96 -0
  899. package/templates/remix/app/components/SiteHeader.tsx +37 -0
  900. package/templates/remix/app/components/Subscribe.tsx +138 -0
  901. package/templates/remix/app/lib/bd-booking.server.ts +90 -0
  902. package/templates/remix/app/lib/bd-bundle.server.ts +143 -0
  903. package/templates/remix/app/lib/bd-cache.server.ts +71 -0
  904. package/templates/remix/app/lib/bd-distribution.server.ts +26 -0
  905. package/templates/remix/app/lib/bd-pages.server.ts +84 -0
  906. package/templates/remix/app/lib/bd-portal.server.ts +170 -0
  907. package/templates/remix/app/lib/bd-seo.server.ts +56 -0
  908. package/templates/remix/app/lib/bd-store.server.ts +320 -0
  909. package/templates/remix/app/lib/bd-todos.server.ts +124 -0
  910. package/templates/remix/app/lib/bd.server.ts +112 -0
  911. package/templates/remix/app/lib/format.ts +17 -0
  912. package/templates/remix/app/lib/sdk-sections.server.ts +217 -0
  913. package/templates/remix/app/root.tsx +73 -0
  914. package/templates/remix/app/routes/$.tsx +85 -0
  915. package/templates/remix/app/routes/[.well-known].[mcp.json].ts +19 -0
  916. package/templates/remix/app/routes/[llms.txt].ts +22 -0
  917. package/templates/remix/app/routes/[robots.txt].ts +45 -0
  918. package/templates/remix/app/routes/[sitemap.xml].ts +57 -0
  919. package/templates/remix/app/routes/_index.tsx +210 -0
  920. package/templates/remix/app/routes/ai.product-feed.ts +24 -0
  921. package/templates/remix/app/routes/api.bd-auth.$.ts +47 -0
  922. package/templates/remix/app/routes/api.bd.forms.ts +53 -0
  923. package/templates/remix/app/routes/api.bd.revalidate.ts +46 -0
  924. package/templates/remix/app/routes/api.mcp.ts +38 -0
  925. package/templates/remix/app/routes/api.reviews.ts +44 -0
  926. package/templates/remix/app/routes/book.tsx +155 -0
  927. package/templates/remix/app/routes/my-account.tsx +349 -0
  928. package/templates/remix/app/routes/reviews.tsx +129 -0
  929. package/templates/remix/app/routes/services.$service.$area.tsx +80 -0
  930. package/templates/remix/app/routes/services._index.tsx +51 -0
  931. package/templates/remix/app/routes/store.$id.tsx +287 -0
  932. package/templates/remix/app/routes/store._index.tsx +318 -0
  933. package/templates/remix/app/routes/store.cart.tsx +196 -0
  934. package/templates/remix/app/routes/store.subscriptions.tsx +122 -0
  935. package/templates/remix/app/routes/todos.tsx +163 -0
  936. package/templates/remix/app/routes/updates._index.tsx +70 -0
  937. package/templates/remix/app/routes.ts +9 -0
  938. package/templates/remix/app/styles.css +699 -0
  939. package/templates/remix/bd.config.ts +331 -0
  940. package/templates/remix/bd.data-model.config.ts +90 -0
  941. package/templates/remix/package.json +52 -0
  942. package/templates/remix/pnpm-lock.yaml +2368 -0
  943. package/templates/remix/react-router.config.ts +5 -0
  944. package/templates/remix/tsconfig.json +22 -0
  945. package/templates/remix/vite.config.ts +16 -0
  946. package/templates/solid/.cta.json +24 -0
  947. package/templates/solid/.cursorrules +35 -0
  948. package/templates/solid/.env.example +56 -0
  949. package/templates/solid/.vscode/settings.json +35 -0
  950. package/templates/solid/README.md +421 -0
  951. package/templates/solid/VERCEL.md +50 -0
  952. package/templates/solid/_gitignore +12 -0
  953. package/templates/solid/bd.config.ts +331 -0
  954. package/templates/solid/bd.data-model.config.ts +90 -0
  955. package/templates/solid/biome.json +39 -0
  956. package/templates/solid/package.json +63 -0
  957. package/templates/solid/pnpm-lock.yaml +4086 -0
  958. package/templates/solid/public/favicon.ico +0 -0
  959. package/templates/solid/public/logo192.png +0 -0
  960. package/templates/solid/public/logo512.png +0 -0
  961. package/templates/solid/public/manifest.json +25 -0
  962. package/templates/solid/public/robots.txt +3 -0
  963. package/templates/solid/src/components/Header.tsx +58 -0
  964. package/templates/solid/src/components/bd/About.tsx +22 -0
  965. package/templates/solid/src/components/bd/Blog.tsx +52 -0
  966. package/templates/solid/src/components/bd/Booking.tsx +286 -0
  967. package/templates/solid/src/components/bd/ContactForm.tsx +102 -0
  968. package/templates/solid/src/components/bd/Footer.tsx +23 -0
  969. package/templates/solid/src/components/bd/Gallery.tsx +52 -0
  970. package/templates/solid/src/components/bd/Header.tsx +25 -0
  971. package/templates/solid/src/components/bd/Hero.tsx +14 -0
  972. package/templates/solid/src/components/bd/NewsBanner.tsx +47 -0
  973. package/templates/solid/src/components/bd/SdkSetupBanner.tsx +111 -0
  974. package/templates/solid/src/components/bd/Services.tsx +34 -0
  975. package/templates/solid/src/components/bd/Stars.tsx +32 -0
  976. package/templates/solid/src/components/bd/Subscribe.tsx +217 -0
  977. package/templates/solid/src/components/bd/money.ts +38 -0
  978. package/templates/solid/src/env.ts +48 -0
  979. package/templates/solid/src/integrations/tanstack-query/header-user.tsx +5 -0
  980. package/templates/solid/src/integrations/tanstack-query/provider.tsx +8 -0
  981. package/templates/solid/src/lib/bd-distribution.ts +26 -0
  982. package/templates/solid/src/lib/bd-server-fns.ts +1346 -0
  983. package/templates/solid/src/lib/bd-todos.ts +122 -0
  984. package/templates/solid/src/lib/bd.ts +169 -0
  985. package/templates/solid/src/lib/utils.ts +6 -0
  986. package/templates/solid/src/routeTree.gen.ts +513 -0
  987. package/templates/solid/src/router.tsx +23 -0
  988. package/templates/solid/src/routes/$.tsx +63 -0
  989. package/templates/solid/src/routes/[.]well-known.mcp[.]json.tsx +16 -0
  990. package/templates/solid/src/routes/__root.tsx +64 -0
  991. package/templates/solid/src/routes/about.tsx +23 -0
  992. package/templates/solid/src/routes/ai.product-feed.tsx +18 -0
  993. package/templates/solid/src/routes/api/bd/revalidate.tsx +48 -0
  994. package/templates/solid/src/routes/api/bd-auth.$.tsx +63 -0
  995. package/templates/solid/src/routes/api/mcp.tsx +23 -0
  996. package/templates/solid/src/routes/demo.tanstack-query.tsx +28 -0
  997. package/templates/solid/src/routes/index.tsx +65 -0
  998. package/templates/solid/src/routes/llms[.]txt.tsx +18 -0
  999. package/templates/solid/src/routes/my-account.tsx +365 -0
  1000. package/templates/solid/src/routes/reviews.tsx +124 -0
  1001. package/templates/solid/src/routes/robots[.]txt.tsx +17 -0
  1002. package/templates/solid/src/routes/services.$service.$area.tsx +107 -0
  1003. package/templates/solid/src/routes/services.index.tsx +68 -0
  1004. package/templates/solid/src/routes/sitemap[.]xml.tsx +16 -0
  1005. package/templates/solid/src/routes/store.$id.tsx +253 -0
  1006. package/templates/solid/src/routes/store.cart.tsx +242 -0
  1007. package/templates/solid/src/routes/store.index.tsx +392 -0
  1008. package/templates/solid/src/routes/subscriptions.tsx +155 -0
  1009. package/templates/solid/src/routes/todos.tsx +214 -0
  1010. package/templates/solid/src/routes/updates.tsx +92 -0
  1011. package/templates/solid/src/styles.css +1571 -0
  1012. package/templates/solid/tsconfig.json +29 -0
  1013. package/templates/solid/ui.config.json +13 -0
  1014. package/templates/solid/vercel.json +7 -0
  1015. package/templates/solid/vite.config.ts +23 -0
  1016. package/templates/solid-1/.cta.json +24 -0
  1017. package/templates/solid-1/.cursorrules +35 -0
  1018. package/templates/solid-1/.env.example +56 -0
  1019. package/templates/solid-1/.vscode/settings.json +35 -0
  1020. package/templates/solid-1/README.md +385 -0
  1021. package/templates/solid-1/VERCEL.md +50 -0
  1022. package/templates/solid-1/_gitignore +12 -0
  1023. package/templates/solid-1/bd.config.ts +331 -0
  1024. package/templates/solid-1/bd.data-model.config.ts +90 -0
  1025. package/templates/solid-1/biome.json +39 -0
  1026. package/templates/solid-1/package.json +99 -0
  1027. package/templates/solid-1/pnpm-lock.yaml +3937 -0
  1028. package/templates/solid-1/public/favicon.ico +0 -0
  1029. package/templates/solid-1/public/logo192.png +0 -0
  1030. package/templates/solid-1/public/logo512.png +0 -0
  1031. package/templates/solid-1/public/manifest.json +25 -0
  1032. package/templates/solid-1/public/robots.txt +3 -0
  1033. package/templates/solid-1/src/components/Header.tsx +70 -0
  1034. package/templates/solid-1/src/components/bd/About.tsx +22 -0
  1035. package/templates/solid-1/src/components/bd/Blog.tsx +52 -0
  1036. package/templates/solid-1/src/components/bd/Booking.tsx +271 -0
  1037. package/templates/solid-1/src/components/bd/ContactForm.tsx +102 -0
  1038. package/templates/solid-1/src/components/bd/Footer.tsx +23 -0
  1039. package/templates/solid-1/src/components/bd/Gallery.tsx +52 -0
  1040. package/templates/solid-1/src/components/bd/Header.tsx +25 -0
  1041. package/templates/solid-1/src/components/bd/Hero.tsx +14 -0
  1042. package/templates/solid-1/src/components/bd/NewsBanner.tsx +47 -0
  1043. package/templates/solid-1/src/components/bd/SdkSetupBanner.tsx +111 -0
  1044. package/templates/solid-1/src/components/bd/Services.tsx +34 -0
  1045. package/templates/solid-1/src/components/bd/Stars.tsx +30 -0
  1046. package/templates/solid-1/src/components/bd/Subscribe.tsx +215 -0
  1047. package/templates/solid-1/src/components/bd/money.ts +38 -0
  1048. package/templates/solid-1/src/env.ts +48 -0
  1049. package/templates/solid-1/src/integrations/tanstack-query/header-user.tsx +5 -0
  1050. package/templates/solid-1/src/integrations/tanstack-query/provider.tsx +8 -0
  1051. package/templates/solid-1/src/lib/bd-distribution.ts +26 -0
  1052. package/templates/solid-1/src/lib/bd-server-fns.ts +1346 -0
  1053. package/templates/solid-1/src/lib/bd-todos.ts +122 -0
  1054. package/templates/solid-1/src/lib/bd.ts +169 -0
  1055. package/templates/solid-1/src/lib/demo-store.ts +14 -0
  1056. package/templates/solid-1/src/lib/utils.ts +6 -0
  1057. package/templates/solid-1/src/routeTree.gen.ts +555 -0
  1058. package/templates/solid-1/src/router.tsx +23 -0
  1059. package/templates/solid-1/src/routes/$.tsx +63 -0
  1060. package/templates/solid-1/src/routes/[.]well-known.mcp[.]json.tsx +16 -0
  1061. package/templates/solid-1/src/routes/__root.tsx +62 -0
  1062. package/templates/solid-1/src/routes/about.tsx +23 -0
  1063. package/templates/solid-1/src/routes/ai.product-feed.tsx +18 -0
  1064. package/templates/solid-1/src/routes/api/bd/revalidate.tsx +48 -0
  1065. package/templates/solid-1/src/routes/api/bd-auth.$.tsx +63 -0
  1066. package/templates/solid-1/src/routes/api/mcp.tsx +23 -0
  1067. package/templates/solid-1/src/routes/demo.form.tsx +339 -0
  1068. package/templates/solid-1/src/routes/demo.store.tsx +62 -0
  1069. package/templates/solid-1/src/routes/demo.tanstack-query.tsx +28 -0
  1070. package/templates/solid-1/src/routes/index.tsx +65 -0
  1071. package/templates/solid-1/src/routes/llms[.]txt.tsx +18 -0
  1072. package/templates/solid-1/src/routes/my-account.tsx +365 -0
  1073. package/templates/solid-1/src/routes/reviews.tsx +124 -0
  1074. package/templates/solid-1/src/routes/robots[.]txt.tsx +17 -0
  1075. package/templates/solid-1/src/routes/services.$service.$area.tsx +107 -0
  1076. package/templates/solid-1/src/routes/services.index.tsx +68 -0
  1077. package/templates/solid-1/src/routes/sitemap[.]xml.tsx +16 -0
  1078. package/templates/solid-1/src/routes/store.$id.tsx +253 -0
  1079. package/templates/solid-1/src/routes/store.cart.tsx +242 -0
  1080. package/templates/solid-1/src/routes/store.index.tsx +384 -0
  1081. package/templates/solid-1/src/routes/subscriptions.tsx +155 -0
  1082. package/templates/solid-1/src/routes/todos.tsx +214 -0
  1083. package/templates/solid-1/src/routes/updates.tsx +92 -0
  1084. package/templates/solid-1/src/styles.css +1571 -0
  1085. package/templates/solid-1/tsconfig.json +29 -0
  1086. package/templates/solid-1/ui.config.json +13 -0
  1087. package/templates/solid-1/vercel.json +7 -0
  1088. package/templates/solid-1/vite.config.ts +22 -0
  1089. package/templates/svelte/.cursor/mcp.json +11 -0
  1090. package/templates/svelte/.env.example +61 -0
  1091. package/templates/svelte/.mcp.json +15 -0
  1092. package/templates/svelte/.opencode/opencode.json +6 -0
  1093. package/templates/svelte/.opencode/svelte.json +3 -0
  1094. package/templates/svelte/.prettierignore +10 -0
  1095. package/templates/svelte/.prettierrc +19 -0
  1096. package/templates/svelte/.storybook/main.ts +17 -0
  1097. package/templates/svelte/.storybook/preview.ts +21 -0
  1098. package/templates/svelte/.vscode/extensions.json +7 -0
  1099. package/templates/svelte/.vscode/settings.json +5 -0
  1100. package/templates/svelte/AGENTS.md +23 -0
  1101. package/templates/svelte/CLAUDE.md +23 -0
  1102. package/templates/svelte/README.md +416 -0
  1103. package/templates/svelte/_gitignore +30 -0
  1104. package/templates/svelte/_npmrc +1 -0
  1105. package/templates/svelte/bd.config.ts +331 -0
  1106. package/templates/svelte/bd.data-model.config.ts +89 -0
  1107. package/templates/svelte/drizzle.config.ts +11 -0
  1108. package/templates/svelte/messages/en.json +4 -0
  1109. package/templates/svelte/messages/es.json +4 -0
  1110. package/templates/svelte/package.json +80 -0
  1111. package/templates/svelte/playwright.config.ts +6 -0
  1112. package/templates/svelte/pnpm-lock.yaml +4332 -0
  1113. package/templates/svelte/project.inlang/settings.json +15 -0
  1114. package/templates/svelte/src/app.d.ts +13 -0
  1115. package/templates/svelte/src/app.html +17 -0
  1116. package/templates/svelte/src/env.ts +22 -0
  1117. package/templates/svelte/src/hooks.server.ts +17 -0
  1118. package/templates/svelte/src/hooks.ts +4 -0
  1119. package/templates/svelte/src/lib/assets/favicon.svg +1 -0
  1120. package/templates/svelte/src/lib/bd/cart-client.ts +111 -0
  1121. package/templates/svelte/src/lib/components/bd/About.svelte +31 -0
  1122. package/templates/svelte/src/lib/components/bd/Banner.svelte +79 -0
  1123. package/templates/svelte/src/lib/components/bd/Blog.svelte +47 -0
  1124. package/templates/svelte/src/lib/components/bd/Booking.svelte +243 -0
  1125. package/templates/svelte/src/lib/components/bd/ContactForm.svelte +69 -0
  1126. package/templates/svelte/src/lib/components/bd/Footer.svelte +35 -0
  1127. package/templates/svelte/src/lib/components/bd/Gallery.svelte +54 -0
  1128. package/templates/svelte/src/lib/components/bd/Header.svelte +51 -0
  1129. package/templates/svelte/src/lib/components/bd/Hero.svelte +19 -0
  1130. package/templates/svelte/src/lib/components/bd/SdkSetupBanner.svelte +107 -0
  1131. package/templates/svelte/src/lib/components/bd/Services.svelte +36 -0
  1132. package/templates/svelte/src/lib/components/bd/StoreNav.svelte +65 -0
  1133. package/templates/svelte/src/lib/components/bd/Subscribe.svelte +180 -0
  1134. package/templates/svelte/src/lib/index.ts +1 -0
  1135. package/templates/svelte/src/lib/server/bd-ai.ts +21 -0
  1136. package/templates/svelte/src/lib/server/bd-bundle.ts +142 -0
  1137. package/templates/svelte/src/lib/server/bd-parallel.ts +94 -0
  1138. package/templates/svelte/src/lib/server/bd-portal.ts +187 -0
  1139. package/templates/svelte/src/lib/server/bd-seo.ts +40 -0
  1140. package/templates/svelte/src/lib/server/bd-store.ts +262 -0
  1141. package/templates/svelte/src/lib/server/bd.ts +45 -0
  1142. package/templates/svelte/src/lib/server/db/index.ts +30 -0
  1143. package/templates/svelte/src/lib/server/db/schema.ts +7 -0
  1144. package/templates/svelte/src/lib/vitest-examples/Welcome.svelte +8 -0
  1145. package/templates/svelte/src/lib/vitest-examples/Welcome.svelte.spec.ts +13 -0
  1146. package/templates/svelte/src/lib/vitest-examples/greet.spec.ts +8 -0
  1147. package/templates/svelte/src/lib/vitest-examples/greet.ts +3 -0
  1148. package/templates/svelte/src/routes/+error.svelte +30 -0
  1149. package/templates/svelte/src/routes/+layout.svelte +33 -0
  1150. package/templates/svelte/src/routes/+page.server.ts +167 -0
  1151. package/templates/svelte/src/routes/+page.svelte +45 -0
  1152. package/templates/svelte/src/routes/.well-known/mcp.json/+server.ts +34 -0
  1153. package/templates/svelte/src/routes/[...slug]/+page.server.ts +30 -0
  1154. package/templates/svelte/src/routes/[...slug]/+page.svelte +19 -0
  1155. package/templates/svelte/src/routes/api/bd/cart/+server.ts +19 -0
  1156. package/templates/svelte/src/routes/api/bd/cart/clear/+server.ts +13 -0
  1157. package/templates/svelte/src/routes/api/bd/cart/coupon/+server.ts +29 -0
  1158. package/templates/svelte/src/routes/api/bd/cart/items/+server.ts +28 -0
  1159. package/templates/svelte/src/routes/api/bd/cart/items/[itemId]/+server.ts +31 -0
  1160. package/templates/svelte/src/routes/api/bd/checkout/start/+server.ts +15 -0
  1161. package/templates/svelte/src/routes/api/bd/forms/[slug]/+server.ts +36 -0
  1162. package/templates/svelte/src/routes/api/bd/revalidate/+server.ts +40 -0
  1163. package/templates/svelte/src/routes/api/bd/reviews/+server.ts +37 -0
  1164. package/templates/svelte/src/routes/api/bd/scheduling/bookings/+server.ts +41 -0
  1165. package/templates/svelte/src/routes/api/bd/scheduling/slots/+server.ts +33 -0
  1166. package/templates/svelte/src/routes/api/bd/subscriptions/[id]/checkout/+server.ts +43 -0
  1167. package/templates/svelte/src/routes/api/bd-auth/[...slug]/+server.ts +63 -0
  1168. package/templates/svelte/src/routes/api/mcp/+server.ts +40 -0
  1169. package/templates/svelte/src/routes/bd-tokens.css +518 -0
  1170. package/templates/svelte/src/routes/demo/+page.svelte +6 -0
  1171. package/templates/svelte/src/routes/demo/paraglide/+page.svelte +22 -0
  1172. package/templates/svelte/src/routes/demo/playwright/+page.svelte +1 -0
  1173. package/templates/svelte/src/routes/demo/playwright/page.svelte.e2e.ts +6 -0
  1174. package/templates/svelte/src/routes/layout.css +10 -0
  1175. package/templates/svelte/src/routes/llms.txt/+server.ts +42 -0
  1176. package/templates/svelte/src/routes/my-account/+page.server.ts +165 -0
  1177. package/templates/svelte/src/routes/my-account/+page.svelte +291 -0
  1178. package/templates/svelte/src/routes/reviews/+page.server.ts +40 -0
  1179. package/templates/svelte/src/routes/reviews/+page.svelte +137 -0
  1180. package/templates/svelte/src/routes/robots.txt/+server.ts +52 -0
  1181. package/templates/svelte/src/routes/services/+page.server.ts +15 -0
  1182. package/templates/svelte/src/routes/services/+page.svelte +70 -0
  1183. package/templates/svelte/src/routes/services/[service]/[area]/+page.server.ts +41 -0
  1184. package/templates/svelte/src/routes/services/[service]/[area]/+page.svelte +67 -0
  1185. package/templates/svelte/src/routes/sitemap.xml/+server.ts +63 -0
  1186. package/templates/svelte/src/routes/store/+page.server.ts +98 -0
  1187. package/templates/svelte/src/routes/store/+page.svelte +514 -0
  1188. package/templates/svelte/src/routes/store/[id]/+page.server.ts +54 -0
  1189. package/templates/svelte/src/routes/store/[id]/+page.svelte +511 -0
  1190. package/templates/svelte/src/routes/store/cart/+page.server.ts +17 -0
  1191. package/templates/svelte/src/routes/store/cart/+page.svelte +237 -0
  1192. package/templates/svelte/src/routes/store/order/+page.server.ts +24 -0
  1193. package/templates/svelte/src/routes/store/order/+page.svelte +68 -0
  1194. package/templates/svelte/src/routes/store/subscriptions/+page.server.ts +35 -0
  1195. package/templates/svelte/src/routes/store/subscriptions/+page.svelte +136 -0
  1196. package/templates/svelte/src/routes/todos/+page.server.ts +153 -0
  1197. package/templates/svelte/src/routes/todos/+page.svelte +175 -0
  1198. package/templates/svelte/src/routes/updates/+page.server.ts +20 -0
  1199. package/templates/svelte/src/routes/updates/+page.svelte +94 -0
  1200. package/templates/svelte/src/stories/Button.stories.svelte +31 -0
  1201. package/templates/svelte/src/stories/Button.svelte +30 -0
  1202. package/templates/svelte/src/stories/Configure.mdx +388 -0
  1203. package/templates/svelte/src/stories/Header.stories.svelte +26 -0
  1204. package/templates/svelte/src/stories/Header.svelte +45 -0
  1205. package/templates/svelte/src/stories/Page.stories.svelte +30 -0
  1206. package/templates/svelte/src/stories/Page.svelte +70 -0
  1207. package/templates/svelte/src/stories/assets/accessibility.png +0 -0
  1208. package/templates/svelte/src/stories/assets/accessibility.svg +1 -0
  1209. package/templates/svelte/src/stories/assets/addon-library.png +0 -0
  1210. package/templates/svelte/src/stories/assets/assets.png +0 -0
  1211. package/templates/svelte/src/stories/assets/avif-test-image.avif +0 -0
  1212. package/templates/svelte/src/stories/assets/context.png +0 -0
  1213. package/templates/svelte/src/stories/assets/discord.svg +1 -0
  1214. package/templates/svelte/src/stories/assets/docs.png +0 -0
  1215. package/templates/svelte/src/stories/assets/figma-plugin.png +0 -0
  1216. package/templates/svelte/src/stories/assets/github.svg +1 -0
  1217. package/templates/svelte/src/stories/assets/share.png +0 -0
  1218. package/templates/svelte/src/stories/assets/styling.png +0 -0
  1219. package/templates/svelte/src/stories/assets/testing.png +0 -0
  1220. package/templates/svelte/src/stories/assets/theming.png +0 -0
  1221. package/templates/svelte/src/stories/assets/tutorials.svg +1 -0
  1222. package/templates/svelte/src/stories/assets/youtube.svg +1 -0
  1223. package/templates/svelte/src/stories/button.css +30 -0
  1224. package/templates/svelte/src/stories/header.css +32 -0
  1225. package/templates/svelte/src/stories/page.css +68 -0
  1226. package/templates/svelte/tsconfig.json +8 -0
  1227. package/templates/svelte/vite.config.ts +88 -0
  1228. package/templates/svelte/vitest.shims.d.ts +1 -0
  1229. package/templates/swift/BdStarter.xcconfig +30 -0
  1230. package/templates/swift/LICENSE +21 -0
  1231. package/templates/swift/Package.swift +62 -0
  1232. package/templates/swift/README.md +334 -0
  1233. package/templates/swift/Sources/BdForms/Backend/BdFormsBackend.swift +441 -0
  1234. package/templates/swift/Sources/BdForms/Controller/BdFormController.swift +717 -0
  1235. package/templates/swift/Sources/BdForms/Engine/BdCalculation.swift +173 -0
  1236. package/templates/swift/Sources/BdForms/Engine/BdFormRules+Client.swift +200 -0
  1237. package/templates/swift/Sources/BdForms/Engine/BdFormRules.swift +949 -0
  1238. package/templates/swift/Sources/BdForms/Engine/BdFormula.swift +783 -0
  1239. package/templates/swift/Sources/BdForms/Engine/BdUnits.swift +171 -0
  1240. package/templates/swift/Sources/BdForms/Generated/BdFormsData.generated.swift +294 -0
  1241. package/templates/swift/Sources/BdForms/Model/BdFormSchema.swift +509 -0
  1242. package/templates/swift/Sources/BdForms/Model/BdJSON.swift +302 -0
  1243. package/templates/swift/Sources/BdForms/Quiz/BdQuizBackend.swift +313 -0
  1244. package/templates/swift/Sources/BdForms/Quiz/BdQuizController.swift +271 -0
  1245. package/templates/swift/Sources/BdForms/Quiz/BdQuizEngine.swift +757 -0
  1246. package/templates/swift/Sources/BdForms/Quiz/BdQuizPage.swift +124 -0
  1247. package/templates/swift/Sources/BdForms/Quiz/BdQuizScoring.swift +445 -0
  1248. package/templates/swift/Sources/BdForms/Quiz/BdQuizScreen.swift +461 -0
  1249. package/templates/swift/Sources/BdForms/Quiz/BdQuizWords.swift +110 -0
  1250. package/templates/swift/Sources/BdForms/UI/BdFieldTree.swift +352 -0
  1251. package/templates/swift/Sources/BdForms/UI/BdForm.swift +346 -0
  1252. package/templates/swift/Sources/BdForms/UI/BdFormStyle.swift +247 -0
  1253. package/templates/swift/Sources/BdForms/UI/BdHTML.swift +304 -0
  1254. package/templates/swift/Sources/BdForms/UI/BdIcon.swift +351 -0
  1255. package/templates/swift/Sources/BdForms/UI/Controls/BdChoiceControls.swift +677 -0
  1256. package/templates/swift/Sources/BdForms/UI/Controls/BdDateControls.swift +360 -0
  1257. package/templates/swift/Sources/BdForms/UI/Controls/BdFieldControl.swift +338 -0
  1258. package/templates/swift/Sources/BdForms/UI/Controls/BdMediaControls.swift +412 -0
  1259. package/templates/swift/Sources/BdForms/UI/Controls/BdStaticViews.swift +183 -0
  1260. package/templates/swift/Sources/BdForms/UI/Controls/BdTextControls.swift +388 -0
  1261. package/templates/swift/Sources/BdForms/UI/Quiz/BdQuiz.swift +696 -0
  1262. package/templates/swift/Sources/BdSignIn/BdSignInBackend.swift +299 -0
  1263. package/templates/swift/Sources/BdSignIn/BdSignInChecks.swift +158 -0
  1264. package/templates/swift/Sources/BdSignIn/BdSignInView.swift +806 -0
  1265. package/templates/swift/Sources/BdStarterApp/BdEnvironment.swift +138 -0
  1266. package/templates/swift/Sources/BdStarterApp/ViewModels/CartViewModel.swift +74 -0
  1267. package/templates/swift/Sources/BdStarterApp/ViewModels/ChatViewModel.swift +87 -0
  1268. package/templates/swift/Sources/BdStarterApp/ViewModels/StorefrontViewModel.swift +73 -0
  1269. package/templates/swift/Sources/BdStarterApp/ViewModels/ViewModel.swift +53 -0
  1270. package/templates/swift/Sources/BdStarterApp/Views/AccountView.swift +163 -0
  1271. package/templates/swift/Sources/BdStarterApp/Views/BdFormView.swift +50 -0
  1272. package/templates/swift/Sources/BdStarterApp/Views/BdQuizView.swift +59 -0
  1273. package/templates/swift/Sources/BdStarterApp/Views/BlogView.swift +33 -0
  1274. package/templates/swift/Sources/BdStarterApp/Views/CartView.swift +73 -0
  1275. package/templates/swift/Sources/BdStarterApp/Views/ChatView.swift +57 -0
  1276. package/templates/swift/Sources/BdStarterApp/Views/LoadState.swift +50 -0
  1277. package/templates/swift/Sources/BdStarterApp/Views/ProductDetailView.swift +57 -0
  1278. package/templates/swift/Sources/BdStarterApp/Views/RootView.swift +60 -0
  1279. package/templates/swift/Sources/BdStarterApp/Views/StorefrontView.swift +68 -0
  1280. package/templates/swift/Sources/BusinessDashKit/BdAuth.swift +113 -0
  1281. package/templates/swift/Sources/BusinessDashKit/BdClient.swift +223 -0
  1282. package/templates/swift/Sources/BusinessDashKit/BdConfiguration.swift +59 -0
  1283. package/templates/swift/Sources/BusinessDashKit/BdError.swift +71 -0
  1284. package/templates/swift/Sources/BusinessDashKit/BdSessionStore.swift +83 -0
  1285. package/templates/swift/Sources/BusinessDashKit/ChatFeed.swift +145 -0
  1286. package/templates/swift/Sources/BusinessDashKit/Donations.swift +144 -0
  1287. package/templates/swift/Sources/BusinessDashKit/JSONValue.swift +118 -0
  1288. package/templates/swift/Sources/BusinessDashKit/Models.swift +447 -0
  1289. package/templates/swift/Sources/BusinessDashKit/Money.swift +33 -0
  1290. package/templates/swift/Sources/BusinessDashKit/Resources.swift +439 -0
  1291. package/templates/swift/Sources/BusinessDashKit/Scheduling.swift +128 -0
  1292. package/templates/swift/Sources/BusinessDashKit/Seo.swift +169 -0
  1293. package/templates/swift/Sources/BusinessDashKit/SocialPlatforms.generated.swift +48 -0
  1294. package/templates/swift/Sources/BusinessDashKit/Socials.swift +160 -0
  1295. package/templates/swift/Tests/BdFormsTests/ControllerTests.swift +356 -0
  1296. package/templates/swift/Tests/BdFormsTests/Fixtures/forms-parity.json +3806 -0
  1297. package/templates/swift/Tests/BdFormsTests/Fixtures/quiz-parity.json +9937 -0
  1298. package/templates/swift/Tests/BdFormsTests/FormsBackendPathTests.swift +17 -0
  1299. package/templates/swift/Tests/BdFormsTests/ParityTests.swift +192 -0
  1300. package/templates/swift/Tests/BdFormsTests/QuizControllerTests.swift +342 -0
  1301. package/templates/swift/Tests/BdFormsTests/QuizParityTests.swift +230 -0
  1302. package/templates/swift/Tests/BdSignInTests/BdSignInChecksTests.swift +49 -0
  1303. package/templates/swift/Tests/BusinessDashKitTests/BusinessDashKitTests.swift +367 -0
  1304. package/templates/swift/_gitignore +9 -0
  1305. package/templates/swift/bd-records/README.md +50 -0
  1306. package/templates/swift/bd-records/todo-images.json +14 -0
  1307. package/templates/swift/bd-records/todos.json +20 -0
  1308. package/templates/swift/bd.config.ts +331 -0
  1309. package/templates/swift/bd.data-model.config.ts +89 -0
  1310. package/templates/swift/package.json +20 -0
  1311. package/templates/swift/pnpm-lock.yaml +347 -0
  1312. package/templates/swift/tsconfig.json +19 -0
  1313. package/templates/t3/.env.example +62 -0
  1314. package/templates/t3/README.md +428 -0
  1315. package/templates/t3/_gitignore +46 -0
  1316. package/templates/t3/bd.config.ts +331 -0
  1317. package/templates/t3/bd.data-model.config.ts +90 -0
  1318. package/templates/t3/biome.jsonc +69 -0
  1319. package/templates/t3/drizzle.config.ts +15 -0
  1320. package/templates/t3/next.config.js +17 -0
  1321. package/templates/t3/package.json +64 -0
  1322. package/templates/t3/pnpm-lock.yaml +1843 -0
  1323. package/templates/t3/postcss.config.js +5 -0
  1324. package/templates/t3/public/favicon.ico +0 -0
  1325. package/templates/t3/src/app/.well-known/mcp.json/route.ts +17 -0
  1326. package/templates/t3/src/app/[...slug]/page.tsx +71 -0
  1327. package/templates/t3/src/app/_actions/plans.ts +60 -0
  1328. package/templates/t3/src/app/_actions/review.ts +88 -0
  1329. package/templates/t3/src/app/_actions/store.ts +119 -0
  1330. package/templates/t3/src/app/_components/bd/About.tsx +25 -0
  1331. package/templates/t3/src/app/_components/bd/AuthButtons.tsx +49 -0
  1332. package/templates/t3/src/app/_components/bd/Blog.tsx +47 -0
  1333. package/templates/t3/src/app/_components/bd/Booking.tsx +257 -0
  1334. package/templates/t3/src/app/_components/bd/ContactForm.tsx +82 -0
  1335. package/templates/t3/src/app/_components/bd/Footer.tsx +25 -0
  1336. package/templates/t3/src/app/_components/bd/Gallery.tsx +49 -0
  1337. package/templates/t3/src/app/_components/bd/Header.tsx +27 -0
  1338. package/templates/t3/src/app/_components/bd/Hero.tsx +14 -0
  1339. package/templates/t3/src/app/_components/bd/NewsBanner.tsx +57 -0
  1340. package/templates/t3/src/app/_components/bd/ReviewForm.tsx +95 -0
  1341. package/templates/t3/src/app/_components/bd/Reviews.tsx +83 -0
  1342. package/templates/t3/src/app/_components/bd/ReviewsLoadMore.tsx +107 -0
  1343. package/templates/t3/src/app/_components/bd/SdkSetupBanner.tsx +97 -0
  1344. package/templates/t3/src/app/_components/bd/Services.tsx +30 -0
  1345. package/templates/t3/src/app/_components/bd/SignInScreen.tsx +32 -0
  1346. package/templates/t3/src/app/_components/bd/Subscribe.tsx +157 -0
  1347. package/templates/t3/src/app/_components/bd/Updates.tsx +90 -0
  1348. package/templates/t3/src/app/_components/post.tsx +50 -0
  1349. package/templates/t3/src/app/ai/product-feed/route.ts +21 -0
  1350. package/templates/t3/src/app/api/bd/revalidate/route.ts +16 -0
  1351. package/templates/t3/src/app/api/bd-auth/[...slug]/route.ts +39 -0
  1352. package/templates/t3/src/app/api/mcp/route.ts +36 -0
  1353. package/templates/t3/src/app/api/trpc/[trpc]/route.ts +34 -0
  1354. package/templates/t3/src/app/layout.tsx +55 -0
  1355. package/templates/t3/src/app/llms.txt/route.ts +21 -0
  1356. package/templates/t3/src/app/my-account/page.tsx +259 -0
  1357. package/templates/t3/src/app/not-found.tsx +26 -0
  1358. package/templates/t3/src/app/page.tsx +89 -0
  1359. package/templates/t3/src/app/robots.txt/route.ts +51 -0
  1360. package/templates/t3/src/app/services/[service]/[area]/page.tsx +114 -0
  1361. package/templates/t3/src/app/sitemap.xml/route.ts +75 -0
  1362. package/templates/t3/src/app/store/[id]/page.tsx +69 -0
  1363. package/templates/t3/src/app/store/_components/AddToCart.tsx +117 -0
  1364. package/templates/t3/src/app/store/_components/CartClient.tsx +198 -0
  1365. package/templates/t3/src/app/store/_components/Notice.tsx +11 -0
  1366. package/templates/t3/src/app/store/_components/StoreView.tsx +372 -0
  1367. package/templates/t3/src/app/store/_components/store-utils.ts +63 -0
  1368. package/templates/t3/src/app/store/cart/page.tsx +28 -0
  1369. package/templates/t3/src/app/store/layout.tsx +38 -0
  1370. package/templates/t3/src/app/store/order/page.tsx +88 -0
  1371. package/templates/t3/src/app/store/page.tsx +104 -0
  1372. package/templates/t3/src/app/store/subscriptions/page.tsx +110 -0
  1373. package/templates/t3/src/app/todos/TodoCreateForm.tsx +68 -0
  1374. package/templates/t3/src/app/todos/page.tsx +134 -0
  1375. package/templates/t3/src/env.js +78 -0
  1376. package/templates/t3/src/server/api/root.ts +25 -0
  1377. package/templates/t3/src/server/api/routers/bd.ts +359 -0
  1378. package/templates/t3/src/server/api/routers/post.ts +30 -0
  1379. package/templates/t3/src/server/api/trpc.ts +106 -0
  1380. package/templates/t3/src/server/db/index.ts +40 -0
  1381. package/templates/t3/src/server/db/schema.ts +26 -0
  1382. package/templates/t3/src/server/lib/bd-distribution.ts +28 -0
  1383. package/templates/t3/src/server/lib/bd-portal.ts +163 -0
  1384. package/templates/t3/src/server/lib/bd-seo.ts +55 -0
  1385. package/templates/t3/src/server/lib/bd-store.ts +177 -0
  1386. package/templates/t3/src/server/lib/bd-todos.ts +138 -0
  1387. package/templates/t3/src/server/lib/bd.ts +260 -0
  1388. package/templates/t3/src/styles/globals.css +1088 -0
  1389. package/templates/t3/src/trpc/query-client.ts +25 -0
  1390. package/templates/t3/src/trpc/react.tsx +78 -0
  1391. package/templates/t3/src/trpc/server.ts +30 -0
  1392. package/templates/t3/start-database.sh +88 -0
  1393. package/templates/t3/tsconfig.json +42 -0
  1394. package/templates/vanilla/.env.example +51 -0
  1395. package/templates/vanilla/README.md +345 -0
  1396. package/templates/vanilla/_gitignore +7 -0
  1397. package/templates/vanilla/bd.config.ts +331 -0
  1398. package/templates/vanilla/bd.data-model.config.ts +89 -0
  1399. package/templates/vanilla/lib/cache.ts +58 -0
  1400. package/templates/vanilla/package.json +23 -0
  1401. package/templates/vanilla/pnpm-lock.yaml +97 -0
  1402. package/templates/vanilla/public/banner.js +75 -0
  1403. package/templates/vanilla/public/bd.js +435 -0
  1404. package/templates/vanilla/public/index.html +74 -0
  1405. package/templates/vanilla/public/main.js +59 -0
  1406. package/templates/vanilla/public/pages/_ui.js +24 -0
  1407. package/templates/vanilla/public/pages/cart.js +143 -0
  1408. package/templates/vanilla/public/pages/my-account.js +182 -0
  1409. package/templates/vanilla/public/pages/product.js +211 -0
  1410. package/templates/vanilla/public/pages/reviews.js +56 -0
  1411. package/templates/vanilla/public/pages/services-area.js +33 -0
  1412. package/templates/vanilla/public/pages/services.js +26 -0
  1413. package/templates/vanilla/public/pages/store.js +271 -0
  1414. package/templates/vanilla/public/pages/subscriptions.js +80 -0
  1415. package/templates/vanilla/public/pages/todos.js +160 -0
  1416. package/templates/vanilla/public/pages/updates.js +46 -0
  1417. package/templates/vanilla/public/sections/about.js +47 -0
  1418. package/templates/vanilla/public/sections/blog.js +66 -0
  1419. package/templates/vanilla/public/sections/booking.js +304 -0
  1420. package/templates/vanilla/public/sections/contact-form.js +104 -0
  1421. package/templates/vanilla/public/sections/gallery.js +70 -0
  1422. package/templates/vanilla/public/sections/hero.js +43 -0
  1423. package/templates/vanilla/public/sections/services.js +70 -0
  1424. package/templates/vanilla/public/sections/subscribe.js +160 -0
  1425. package/templates/vanilla/public/setup-banner.js +81 -0
  1426. package/templates/vanilla/public/styles.css +1720 -0
  1427. package/templates/vanilla/server.ts +1192 -0
  1428. package/templates/vanilla/src/content/en/home/about.json +4 -0
  1429. package/templates/vanilla/src/content/en/home/hero.json +6 -0
  1430. package/templates/vanilla/src/content/en/shared/brand.json +5 -0
  1431. package/templates/vanilla/src/content/en/shared/companyInfo.json +11 -0
  1432. package/templates/vanilla/tsconfig.json +14 -0
  1433. package/templates/vapor/.env.example +38 -0
  1434. package/templates/vapor/Package.resolved +285 -0
  1435. package/templates/vapor/Package.swift +33 -0
  1436. package/templates/vapor/Public/bd-sign-in.css +53 -0
  1437. package/templates/vapor/Public/forms.css +1158 -0
  1438. package/templates/vapor/Public/styles.css +100 -0
  1439. package/templates/vapor/README.md +280 -0
  1440. package/templates/vapor/Resources/Forms/demo-form.json +283 -0
  1441. package/templates/vapor/Resources/Forms/demo-quiz.json +97 -0
  1442. package/templates/vapor/Resources/Views/account.leaf +23 -0
  1443. package/templates/vapor/Resources/Views/base.leaf +51 -0
  1444. package/templates/vapor/Resources/Views/blog.leaf +18 -0
  1445. package/templates/vapor/Resources/Views/cart.leaf +30 -0
  1446. package/templates/vapor/Resources/Views/delete-account.leaf +26 -0
  1447. package/templates/vapor/Resources/Views/form.leaf +6 -0
  1448. package/templates/vapor/Resources/Views/home.leaf +37 -0
  1449. package/templates/vapor/Resources/Views/post.leaf +15 -0
  1450. package/templates/vapor/Resources/Views/product.leaf +28 -0
  1451. package/templates/vapor/Resources/Views/quiz.leaf +6 -0
  1452. package/templates/vapor/Resources/Views/reviews.leaf +16 -0
  1453. package/templates/vapor/Resources/Views/service-area.leaf +9 -0
  1454. package/templates/vapor/Resources/Views/services.leaf +15 -0
  1455. package/templates/vapor/Resources/Views/store.leaf +37 -0
  1456. package/templates/vapor/Resources/Views/subscriptions.leaf +18 -0
  1457. package/templates/vapor/Resources/Views/todos.leaf +28 -0
  1458. package/templates/vapor/Sources/App/Bd/BdCache.swift +99 -0
  1459. package/templates/vapor/Sources/App/Bd/BdClient.swift +178 -0
  1460. package/templates/vapor/Sources/App/Bd/BdWebhook.swift +92 -0
  1461. package/templates/vapor/Sources/App/Bd/Donations.swift +95 -0
  1462. package/templates/vapor/Sources/App/Bd/JSONValue.swift +66 -0
  1463. package/templates/vapor/Sources/App/Bd/Models.swift +153 -0
  1464. package/templates/vapor/Sources/App/Bd/Money.swift +29 -0
  1465. package/templates/vapor/Sources/App/Bd/PortalResources.swift +372 -0
  1466. package/templates/vapor/Sources/App/Bd/Resources.swift +115 -0
  1467. package/templates/vapor/Sources/App/Bd/Scheduling.swift +135 -0
  1468. package/templates/vapor/Sources/App/Bd/Seo.swift +169 -0
  1469. package/templates/vapor/Sources/App/Bd/SignInCore.swift +232 -0
  1470. package/templates/vapor/Sources/App/Bd/SocialPlatforms.generated.swift +48 -0
  1471. package/templates/vapor/Sources/App/Bd/Socials.swift +96 -0
  1472. package/templates/vapor/Sources/App/Controllers/AccountController.swift +435 -0
  1473. package/templates/vapor/Sources/App/Controllers/CartController.swift +107 -0
  1474. package/templates/vapor/Sources/App/Controllers/Contexts.swift +124 -0
  1475. package/templates/vapor/Sources/App/Controllers/PageController.swift +151 -0
  1476. package/templates/vapor/Sources/App/Controllers/SeoController.swift +83 -0
  1477. package/templates/vapor/Sources/App/Controllers/SignInController.swift +583 -0
  1478. package/templates/vapor/Sources/App/Controllers/StoreController.swift +48 -0
  1479. package/templates/vapor/Sources/App/Controllers/WebhookController.swift +34 -0
  1480. package/templates/vapor/Sources/App/Forms/FormPage.swift +900 -0
  1481. package/templates/vapor/Sources/App/Forms/FormPost.swift +125 -0
  1482. package/templates/vapor/Sources/App/Forms/FormRoutes.swift +36 -0
  1483. package/templates/vapor/Sources/App/Forms/FormSamples.swift +45 -0
  1484. package/templates/vapor/Sources/App/Forms/QuizPage.swift +481 -0
  1485. package/templates/vapor/Sources/App/Forms/QuizRoutes.swift +77 -0
  1486. package/templates/vapor/Sources/App/configure.swift +18 -0
  1487. package/templates/vapor/Sources/App/entrypoint.swift +20 -0
  1488. package/templates/vapor/Sources/App/routes.swift +62 -0
  1489. package/templates/vapor/Sources/BdForms/Backend/BdFormsBackend.swift +445 -0
  1490. package/templates/vapor/Sources/BdForms/Controller/BdFormController.swift +721 -0
  1491. package/templates/vapor/Sources/BdForms/Engine/BdCalculation.swift +177 -0
  1492. package/templates/vapor/Sources/BdForms/Engine/BdFormRules+Client.swift +204 -0
  1493. package/templates/vapor/Sources/BdForms/Engine/BdFormRules.swift +953 -0
  1494. package/templates/vapor/Sources/BdForms/Engine/BdFormula.swift +787 -0
  1495. package/templates/vapor/Sources/BdForms/Engine/BdUnits.swift +175 -0
  1496. package/templates/vapor/Sources/BdForms/Generated/BdFormsData.generated.swift +298 -0
  1497. package/templates/vapor/Sources/BdForms/Model/BdFormSchema.swift +513 -0
  1498. package/templates/vapor/Sources/BdForms/Model/BdJSON.swift +306 -0
  1499. package/templates/vapor/Sources/BdForms/Quiz/BdQuizBackend.swift +317 -0
  1500. package/templates/vapor/Sources/BdForms/Quiz/BdQuizController.swift +275 -0
  1501. package/templates/vapor/Sources/BdForms/Quiz/BdQuizEngine.swift +761 -0
  1502. package/templates/vapor/Sources/BdForms/Quiz/BdQuizPage.swift +128 -0
  1503. package/templates/vapor/Sources/BdForms/Quiz/BdQuizScoring.swift +449 -0
  1504. package/templates/vapor/Sources/BdForms/Quiz/BdQuizScreen.swift +465 -0
  1505. package/templates/vapor/Sources/BdForms/Quiz/BdQuizWords.swift +114 -0
  1506. package/templates/vapor/_gitignore +9 -0
  1507. package/templates/vapor/bd-records/README.md +50 -0
  1508. package/templates/vapor/bd-records/todo-images.json +14 -0
  1509. package/templates/vapor/bd-records/todos.json +20 -0
  1510. package/templates/vapor/bd.config.ts +331 -0
  1511. package/templates/vapor/bd.data-model.config.ts +89 -0
  1512. package/templates/vapor/package.json +20 -0
  1513. package/templates/vapor/pnpm-lock.yaml +347 -0
  1514. package/templates/vapor/tsconfig.json +19 -0
package/dist/index.mjs ADDED
@@ -0,0 +1,3754 @@
1
+ import { createRequire } from "node:module"; const require = createRequire(import.meta.url);
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __commonJS = (cb, mod) => function __require() {
9
+ try {
10
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
11
+ } catch (e) {
12
+ throw mod = 0, e;
13
+ }
14
+ };
15
+ var __copyProps = (to, from, except, desc) => {
16
+ if (from && typeof from === "object" || typeof from === "function") {
17
+ for (let key of __getOwnPropNames(from))
18
+ if (!__hasOwnProp.call(to, key) && key !== except)
19
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
20
+ }
21
+ return to;
22
+ };
23
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
24
+ // If the importer is in node compatibility mode or this is not an ESM
25
+ // file that has been converted to a CommonJS file using a Babel-
26
+ // compatible transform (i.e. "__esModule" has not been set), then set
27
+ // "default" to the CommonJS "module.exports" for node compatibility.
28
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
29
+ mod
30
+ ));
31
+
32
+ // ../../node_modules/.pnpm/mri@1.2.0/node_modules/mri/lib/index.js
33
+ var require_lib = __commonJS({
34
+ "../../node_modules/.pnpm/mri@1.2.0/node_modules/mri/lib/index.js"(exports, module) {
35
+ function toArr(any) {
36
+ return any == null ? [] : Array.isArray(any) ? any : [any];
37
+ }
38
+ function toVal(out, key, val, opts) {
39
+ var x, old = out[key], nxt = !!~opts.string.indexOf(key) ? val == null || val === true ? "" : String(val) : typeof val === "boolean" ? val : !!~opts.boolean.indexOf(key) ? val === "false" ? false : val === "true" || (out._.push((x = +val, x * 0 === 0) ? x : val), !!val) : (x = +val, x * 0 === 0) ? x : val;
40
+ out[key] = old == null ? nxt : Array.isArray(old) ? old.concat(nxt) : [old, nxt];
41
+ }
42
+ module.exports = function(args, opts) {
43
+ args = args || [];
44
+ opts = opts || {};
45
+ var k, arr, arg, name, val, out = { _: [] };
46
+ var i2 = 0, j = 0, idx = 0, len = args.length;
47
+ const alibi = opts.alias !== void 0;
48
+ const strict = opts.unknown !== void 0;
49
+ const defaults = opts.default !== void 0;
50
+ opts.alias = opts.alias || {};
51
+ opts.string = toArr(opts.string);
52
+ opts.boolean = toArr(opts.boolean);
53
+ if (alibi) {
54
+ for (k in opts.alias) {
55
+ arr = opts.alias[k] = toArr(opts.alias[k]);
56
+ for (i2 = 0; i2 < arr.length; i2++) {
57
+ (opts.alias[arr[i2]] = arr.concat(k)).splice(i2, 1);
58
+ }
59
+ }
60
+ }
61
+ for (i2 = opts.boolean.length; i2-- > 0; ) {
62
+ arr = opts.alias[opts.boolean[i2]] || [];
63
+ for (j = arr.length; j-- > 0; ) opts.boolean.push(arr[j]);
64
+ }
65
+ for (i2 = opts.string.length; i2-- > 0; ) {
66
+ arr = opts.alias[opts.string[i2]] || [];
67
+ for (j = arr.length; j-- > 0; ) opts.string.push(arr[j]);
68
+ }
69
+ if (defaults) {
70
+ for (k in opts.default) {
71
+ name = typeof opts.default[k];
72
+ arr = opts.alias[k] = opts.alias[k] || [];
73
+ if (opts[name] !== void 0) {
74
+ opts[name].push(k);
75
+ for (i2 = 0; i2 < arr.length; i2++) {
76
+ opts[name].push(arr[i2]);
77
+ }
78
+ }
79
+ }
80
+ }
81
+ const keys = strict ? Object.keys(opts.alias) : [];
82
+ for (i2 = 0; i2 < len; i2++) {
83
+ arg = args[i2];
84
+ if (arg === "--") {
85
+ out._ = out._.concat(args.slice(++i2));
86
+ break;
87
+ }
88
+ for (j = 0; j < arg.length; j++) {
89
+ if (arg.charCodeAt(j) !== 45) break;
90
+ }
91
+ if (j === 0) {
92
+ out._.push(arg);
93
+ } else if (arg.substring(j, j + 3) === "no-") {
94
+ name = arg.substring(j + 3);
95
+ if (strict && !~keys.indexOf(name)) {
96
+ return opts.unknown(arg);
97
+ }
98
+ out[name] = false;
99
+ } else {
100
+ for (idx = j + 1; idx < arg.length; idx++) {
101
+ if (arg.charCodeAt(idx) === 61) break;
102
+ }
103
+ name = arg.substring(j, idx);
104
+ val = arg.substring(++idx) || (i2 + 1 === len || ("" + args[i2 + 1]).charCodeAt(0) === 45 || args[++i2]);
105
+ arr = j === 2 ? [name] : name;
106
+ for (idx = 0; idx < arr.length; idx++) {
107
+ name = arr[idx];
108
+ if (strict && !~keys.indexOf(name)) return opts.unknown("-".repeat(j) + name);
109
+ toVal(out, name, idx + 1 < arr.length || val, opts);
110
+ }
111
+ }
112
+ }
113
+ if (defaults) {
114
+ for (k in opts.default) {
115
+ if (out[k] === void 0) {
116
+ out[k] = opts.default[k];
117
+ }
118
+ }
119
+ }
120
+ if (alibi) {
121
+ for (k in out) {
122
+ arr = opts.alias[k] || [];
123
+ while (arr.length > 0) {
124
+ out[arr.shift()] = out[k];
125
+ }
126
+ }
127
+ }
128
+ return out;
129
+ };
130
+ }
131
+ });
132
+
133
+ // ../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js
134
+ var require_picocolors = __commonJS({
135
+ "../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js"(exports, module) {
136
+ var p = process || {};
137
+ var argv2 = p.argv || [];
138
+ var env = p.env || {};
139
+ var isColorSupported = !(!!env.NO_COLOR || argv2.includes("--no-color")) && (!!env.FORCE_COLOR || argv2.includes("--color") || p.platform === "win32" || (p.stdout || {}).isTTY && env.TERM !== "dumb" || !!env.CI);
140
+ var formatter = (open, close, replace = open) => (input) => {
141
+ let string = "" + input, index = string.indexOf(close, open.length);
142
+ return ~index ? open + replaceClose(string, close, replace, index) + close : open + string + close;
143
+ };
144
+ var replaceClose = (string, close, replace, index) => {
145
+ let result = "", cursor2 = 0;
146
+ do {
147
+ result += string.substring(cursor2, index) + replace;
148
+ cursor2 = index + close.length;
149
+ index = string.indexOf(close, cursor2);
150
+ } while (~index);
151
+ return result + string.substring(cursor2);
152
+ };
153
+ var createColors = (enabled = isColorSupported) => {
154
+ let f = enabled ? formatter : () => String;
155
+ return {
156
+ isColorSupported: enabled,
157
+ reset: f("\x1B[0m", "\x1B[0m"),
158
+ bold: f("\x1B[1m", "\x1B[22m", "\x1B[22m\x1B[1m"),
159
+ dim: f("\x1B[2m", "\x1B[22m", "\x1B[22m\x1B[2m"),
160
+ italic: f("\x1B[3m", "\x1B[23m"),
161
+ underline: f("\x1B[4m", "\x1B[24m"),
162
+ inverse: f("\x1B[7m", "\x1B[27m"),
163
+ hidden: f("\x1B[8m", "\x1B[28m"),
164
+ strikethrough: f("\x1B[9m", "\x1B[29m"),
165
+ black: f("\x1B[30m", "\x1B[39m"),
166
+ red: f("\x1B[31m", "\x1B[39m"),
167
+ green: f("\x1B[32m", "\x1B[39m"),
168
+ yellow: f("\x1B[33m", "\x1B[39m"),
169
+ blue: f("\x1B[34m", "\x1B[39m"),
170
+ magenta: f("\x1B[35m", "\x1B[39m"),
171
+ cyan: f("\x1B[36m", "\x1B[39m"),
172
+ white: f("\x1B[37m", "\x1B[39m"),
173
+ gray: f("\x1B[90m", "\x1B[39m"),
174
+ bgBlack: f("\x1B[40m", "\x1B[49m"),
175
+ bgRed: f("\x1B[41m", "\x1B[49m"),
176
+ bgGreen: f("\x1B[42m", "\x1B[49m"),
177
+ bgYellow: f("\x1B[43m", "\x1B[49m"),
178
+ bgBlue: f("\x1B[44m", "\x1B[49m"),
179
+ bgMagenta: f("\x1B[45m", "\x1B[49m"),
180
+ bgCyan: f("\x1B[46m", "\x1B[49m"),
181
+ bgWhite: f("\x1B[47m", "\x1B[49m"),
182
+ blackBright: f("\x1B[90m", "\x1B[39m"),
183
+ redBright: f("\x1B[91m", "\x1B[39m"),
184
+ greenBright: f("\x1B[92m", "\x1B[39m"),
185
+ yellowBright: f("\x1B[93m", "\x1B[39m"),
186
+ blueBright: f("\x1B[94m", "\x1B[39m"),
187
+ magentaBright: f("\x1B[95m", "\x1B[39m"),
188
+ cyanBright: f("\x1B[96m", "\x1B[39m"),
189
+ whiteBright: f("\x1B[97m", "\x1B[39m"),
190
+ bgBlackBright: f("\x1B[100m", "\x1B[49m"),
191
+ bgRedBright: f("\x1B[101m", "\x1B[49m"),
192
+ bgGreenBright: f("\x1B[102m", "\x1B[49m"),
193
+ bgYellowBright: f("\x1B[103m", "\x1B[49m"),
194
+ bgBlueBright: f("\x1B[104m", "\x1B[49m"),
195
+ bgMagentaBright: f("\x1B[105m", "\x1B[49m"),
196
+ bgCyanBright: f("\x1B[106m", "\x1B[49m"),
197
+ bgWhiteBright: f("\x1B[107m", "\x1B[49m")
198
+ };
199
+ };
200
+ module.exports = createColors();
201
+ module.exports.createColors = createColors;
202
+ }
203
+ });
204
+
205
+ // src/index.ts
206
+ import { spawnSync as spawnSync2 } from "node:child_process";
207
+ import { existsSync as existsSync3, statSync as statSync2, writeFileSync as writeFileSync3 } from "node:fs";
208
+ import { basename, join as join5, relative, resolve } from "node:path";
209
+ import { fileURLToPath } from "node:url";
210
+
211
+ // ../../node_modules/.pnpm/@clack+core@1.6.0/node_modules/@clack/core/dist/index.mjs
212
+ import { styleText } from "node:util";
213
+ import { stdout, stdin } from "node:process";
214
+ import f__default from "node:readline";
215
+
216
+ // ../../node_modules/.pnpm/fast-string-truncated-width@3.0.3/node_modules/fast-string-truncated-width/dist/utils.js
217
+ var getCodePointsLength = /* @__PURE__ */ (() => {
218
+ const SURROGATE_PAIR_RE = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g;
219
+ return (input) => {
220
+ let surrogatePairsNr = 0;
221
+ SURROGATE_PAIR_RE.lastIndex = 0;
222
+ while (SURROGATE_PAIR_RE.test(input)) {
223
+ surrogatePairsNr += 1;
224
+ }
225
+ return input.length - surrogatePairsNr;
226
+ };
227
+ })();
228
+ var isFullWidth = (x) => {
229
+ return x === 12288 || x >= 65281 && x <= 65376 || x >= 65504 && x <= 65510;
230
+ };
231
+ var isWideNotCJKTNotEmoji = (x) => {
232
+ return x === 8987 || x === 9001 || x >= 12272 && x <= 12287 || x >= 12289 && x <= 12350 || x >= 12441 && x <= 12543 || x >= 12549 && x <= 12591 || x >= 12593 && x <= 12686 || x >= 12688 && x <= 12771 || x >= 12783 && x <= 12830 || x >= 12832 && x <= 12871 || x >= 12880 && x <= 19903 || x >= 65040 && x <= 65049 || x >= 65072 && x <= 65106 || x >= 65108 && x <= 65126 || x >= 65128 && x <= 65131 || x >= 127488 && x <= 127490 || x >= 127504 && x <= 127547 || x >= 127552 && x <= 127560 || x >= 131072 && x <= 196605 || x >= 196608 && x <= 262141;
233
+ };
234
+
235
+ // ../../node_modules/.pnpm/fast-string-truncated-width@3.0.3/node_modules/fast-string-truncated-width/dist/index.js
236
+ var ANSI_RE = /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]|\u001b\]8;[^;]*;.*?(?:\u0007|\u001b\u005c)/y;
237
+ var CONTROL_RE = /[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y;
238
+ var CJKT_WIDE_RE = /(?:(?![\uFF61-\uFF9F\uFF00-\uFFEF])[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}\p{Script=Tangut}]){1,1000}/yu;
239
+ var TAB_RE = /\t{1,1000}/y;
240
+ var EMOJI_RE = 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");
241
+ var LATIN_RE = /(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y;
242
+ var MODIFIER_RE = new RegExp("\\p{M}+", "gu");
243
+ var NO_TRUNCATION = { limit: Infinity, ellipsis: "" };
244
+ var getStringTruncatedWidth = (input, truncationOptions = {}, widthOptions = {}) => {
245
+ const LIMIT = truncationOptions.limit ?? Infinity;
246
+ const ELLIPSIS = truncationOptions.ellipsis ?? "";
247
+ const ELLIPSIS_WIDTH = truncationOptions?.ellipsisWidth ?? (ELLIPSIS ? getStringTruncatedWidth(ELLIPSIS, NO_TRUNCATION, widthOptions).width : 0);
248
+ const ANSI_WIDTH = 0;
249
+ const CONTROL_WIDTH = widthOptions.controlWidth ?? 0;
250
+ const TAB_WIDTH = widthOptions.tabWidth ?? 8;
251
+ const EMOJI_WIDTH = widthOptions.emojiWidth ?? 2;
252
+ const FULL_WIDTH_WIDTH = 2;
253
+ const REGULAR_WIDTH = widthOptions.regularWidth ?? 1;
254
+ const WIDE_WIDTH = widthOptions.wideWidth ?? FULL_WIDTH_WIDTH;
255
+ const PARSE_BLOCKS = [
256
+ [LATIN_RE, REGULAR_WIDTH],
257
+ [ANSI_RE, ANSI_WIDTH],
258
+ [CONTROL_RE, CONTROL_WIDTH],
259
+ [TAB_RE, TAB_WIDTH],
260
+ [EMOJI_RE, EMOJI_WIDTH],
261
+ [CJKT_WIDE_RE, WIDE_WIDTH]
262
+ ];
263
+ let indexPrev = 0;
264
+ let index = 0;
265
+ let length = input.length;
266
+ let lengthExtra = 0;
267
+ let truncationEnabled = false;
268
+ let truncationIndex = length;
269
+ let truncationLimit = Math.max(0, LIMIT - ELLIPSIS_WIDTH);
270
+ let unmatchedStart = 0;
271
+ let unmatchedEnd = 0;
272
+ let width2 = 0;
273
+ let widthExtra = 0;
274
+ outer: while (true) {
275
+ if (unmatchedEnd > unmatchedStart || index >= length && index > indexPrev) {
276
+ const unmatched = input.slice(unmatchedStart, unmatchedEnd) || input.slice(indexPrev, index);
277
+ lengthExtra = 0;
278
+ for (const char of unmatched.replaceAll(MODIFIER_RE, "")) {
279
+ const codePoint = char.codePointAt(0) || 0;
280
+ if (isFullWidth(codePoint)) {
281
+ widthExtra = FULL_WIDTH_WIDTH;
282
+ } else if (isWideNotCJKTNotEmoji(codePoint)) {
283
+ widthExtra = WIDE_WIDTH;
284
+ } else {
285
+ widthExtra = REGULAR_WIDTH;
286
+ }
287
+ if (width2 + widthExtra > truncationLimit) {
288
+ truncationIndex = Math.min(truncationIndex, Math.max(unmatchedStart, indexPrev) + lengthExtra);
289
+ }
290
+ if (width2 + widthExtra > LIMIT) {
291
+ truncationEnabled = true;
292
+ break outer;
293
+ }
294
+ lengthExtra += char.length;
295
+ width2 += widthExtra;
296
+ }
297
+ unmatchedStart = unmatchedEnd = 0;
298
+ }
299
+ if (index >= length) {
300
+ break outer;
301
+ }
302
+ for (let i2 = 0, l = PARSE_BLOCKS.length; i2 < l; i2++) {
303
+ const [BLOCK_RE, BLOCK_WIDTH] = PARSE_BLOCKS[i2];
304
+ BLOCK_RE.lastIndex = index;
305
+ if (BLOCK_RE.test(input)) {
306
+ lengthExtra = BLOCK_RE === CJKT_WIDE_RE ? getCodePointsLength(input.slice(index, BLOCK_RE.lastIndex)) : BLOCK_RE === EMOJI_RE ? 1 : BLOCK_RE.lastIndex - index;
307
+ widthExtra = lengthExtra * BLOCK_WIDTH;
308
+ if (width2 + widthExtra > truncationLimit) {
309
+ truncationIndex = Math.min(truncationIndex, index + Math.floor((truncationLimit - width2) / BLOCK_WIDTH));
310
+ }
311
+ if (width2 + widthExtra > LIMIT) {
312
+ truncationEnabled = true;
313
+ break outer;
314
+ }
315
+ width2 += widthExtra;
316
+ unmatchedStart = indexPrev;
317
+ unmatchedEnd = index;
318
+ index = indexPrev = BLOCK_RE.lastIndex;
319
+ continue outer;
320
+ }
321
+ }
322
+ index += 1;
323
+ }
324
+ return {
325
+ width: truncationEnabled ? truncationLimit : width2,
326
+ index: truncationEnabled ? truncationIndex : length,
327
+ truncated: truncationEnabled,
328
+ ellipsed: truncationEnabled && LIMIT >= ELLIPSIS_WIDTH
329
+ };
330
+ };
331
+ var dist_default = getStringTruncatedWidth;
332
+
333
+ // ../../node_modules/.pnpm/fast-string-width@3.0.2/node_modules/fast-string-width/dist/index.js
334
+ var NO_TRUNCATION2 = {
335
+ limit: Infinity,
336
+ ellipsis: "",
337
+ ellipsisWidth: 0
338
+ };
339
+ var fastStringWidth = (input, options = {}) => {
340
+ return dist_default(input, NO_TRUNCATION2, options).width;
341
+ };
342
+ var dist_default2 = fastStringWidth;
343
+
344
+ // ../../node_modules/.pnpm/fast-wrap-ansi@0.2.2/node_modules/fast-wrap-ansi/lib/main.js
345
+ var ESC = "\x1B";
346
+ var CSI = "\x9B";
347
+ var END_CODE = 39;
348
+ var ANSI_ESCAPE_BELL = "\x07";
349
+ var ANSI_CSI = "[";
350
+ var ANSI_OSC = "]";
351
+ var ANSI_SGR_TERMINATOR = "m";
352
+ var ANSI_ESCAPE_LINK = `${ANSI_OSC}8;;`;
353
+ var GROUP_REGEX = new RegExp(`(?:\\${ANSI_CSI}(?<code>\\d+)m|\\${ANSI_ESCAPE_LINK}(?<uri>.*)${ANSI_ESCAPE_BELL})`, "y");
354
+ var getClosingCode = (openingCode) => {
355
+ if (openingCode >= 30 && openingCode <= 37)
356
+ return 39;
357
+ if (openingCode >= 90 && openingCode <= 97)
358
+ return 39;
359
+ if (openingCode >= 40 && openingCode <= 47)
360
+ return 49;
361
+ if (openingCode >= 100 && openingCode <= 107)
362
+ return 49;
363
+ if (openingCode === 1 || openingCode === 2)
364
+ return 22;
365
+ if (openingCode === 3)
366
+ return 23;
367
+ if (openingCode === 4)
368
+ return 24;
369
+ if (openingCode === 7)
370
+ return 27;
371
+ if (openingCode === 8)
372
+ return 28;
373
+ if (openingCode === 9)
374
+ return 29;
375
+ if (openingCode === 0)
376
+ return 0;
377
+ return void 0;
378
+ };
379
+ var wrapAnsiCode = (code) => `${ESC}${ANSI_CSI}${code}${ANSI_SGR_TERMINATOR}`;
380
+ var wrapAnsiHyperlink = (url) => `${ESC}${ANSI_ESCAPE_LINK}${url}${ANSI_ESCAPE_BELL}`;
381
+ var wrapWord = (rows, word, columns) => {
382
+ const characters = word[Symbol.iterator]();
383
+ let isInsideEscape = false;
384
+ let isInsideLinkEscape = false;
385
+ let lastRow = rows.at(-1);
386
+ let visible = lastRow === void 0 ? 0 : dist_default2(lastRow);
387
+ let currentCharacter = characters.next();
388
+ let nextCharacter = characters.next();
389
+ let rawCharacterIndex = 0;
390
+ while (!currentCharacter.done) {
391
+ const character = currentCharacter.value;
392
+ const characterLength = dist_default2(character);
393
+ if (visible + characterLength <= columns) {
394
+ rows[rows.length - 1] += character;
395
+ } else {
396
+ rows.push(character);
397
+ visible = 0;
398
+ }
399
+ if (character === ESC || character === CSI) {
400
+ isInsideEscape = true;
401
+ isInsideLinkEscape = word.startsWith(ANSI_ESCAPE_LINK, rawCharacterIndex + 1);
402
+ }
403
+ if (isInsideEscape) {
404
+ if (isInsideLinkEscape) {
405
+ if (character === ANSI_ESCAPE_BELL) {
406
+ isInsideEscape = false;
407
+ isInsideLinkEscape = false;
408
+ }
409
+ } else if (character === ANSI_SGR_TERMINATOR) {
410
+ isInsideEscape = false;
411
+ }
412
+ } else {
413
+ visible += characterLength;
414
+ if (visible === columns && !nextCharacter.done) {
415
+ rows.push("");
416
+ visible = 0;
417
+ }
418
+ }
419
+ currentCharacter = nextCharacter;
420
+ nextCharacter = characters.next();
421
+ rawCharacterIndex += character.length;
422
+ }
423
+ lastRow = rows.at(-1);
424
+ if (!visible && lastRow !== void 0 && lastRow.length && rows.length > 1) {
425
+ rows[rows.length - 2] += rows.pop();
426
+ }
427
+ };
428
+ var stringVisibleTrimSpacesRight = (string) => {
429
+ const words = string.split(" ");
430
+ let last = words.length;
431
+ while (last) {
432
+ if (dist_default2(words[last - 1])) {
433
+ break;
434
+ }
435
+ last--;
436
+ }
437
+ if (last === words.length) {
438
+ return string;
439
+ }
440
+ return words.slice(0, last).join(" ") + words.slice(last).join("");
441
+ };
442
+ var exec = (string, columns, options = {}) => {
443
+ if (options.trim !== false && string.trim() === "") {
444
+ return "";
445
+ }
446
+ let returnValue = "";
447
+ let escapeCode;
448
+ let escapeUrl;
449
+ const words = string.split(" ");
450
+ let rows = [""];
451
+ let rowLength = 0;
452
+ for (let index = 0; index < words.length; index++) {
453
+ const word = words[index];
454
+ if (options.trim !== false) {
455
+ const row = rows.at(-1) ?? "";
456
+ const trimmed = row.trimStart();
457
+ if (row.length !== trimmed.length) {
458
+ rows[rows.length - 1] = trimmed;
459
+ rowLength = dist_default2(trimmed);
460
+ }
461
+ }
462
+ if (index !== 0) {
463
+ if (rowLength >= columns && (options.wordWrap === false || options.trim === false)) {
464
+ rows.push("");
465
+ rowLength = 0;
466
+ }
467
+ if (rowLength || options.trim === false) {
468
+ rows[rows.length - 1] += " ";
469
+ rowLength++;
470
+ }
471
+ }
472
+ const wordLength = dist_default2(word);
473
+ if (options.hard && wordLength > columns) {
474
+ const remainingColumns = columns - rowLength;
475
+ const breaksStartingThisLine = 1 + Math.floor((wordLength - remainingColumns - 1) / columns);
476
+ const breaksStartingNextLine = Math.floor((wordLength - 1) / columns);
477
+ if (breaksStartingNextLine < breaksStartingThisLine) {
478
+ rows.push("");
479
+ }
480
+ wrapWord(rows, word, columns);
481
+ rowLength = dist_default2(rows.at(-1) ?? "");
482
+ continue;
483
+ }
484
+ if (rowLength + wordLength > columns && rowLength && wordLength) {
485
+ if (options.wordWrap === false && rowLength < columns) {
486
+ wrapWord(rows, word, columns);
487
+ rowLength = dist_default2(rows.at(-1) ?? "");
488
+ continue;
489
+ }
490
+ rows.push("");
491
+ rowLength = 0;
492
+ }
493
+ if (rowLength + wordLength > columns && options.wordWrap === false) {
494
+ wrapWord(rows, word, columns);
495
+ rowLength = dist_default2(rows.at(-1) ?? "");
496
+ continue;
497
+ }
498
+ rows[rows.length - 1] += word;
499
+ rowLength += wordLength;
500
+ }
501
+ if (options.trim !== false) {
502
+ rows = rows.map((row) => stringVisibleTrimSpacesRight(row));
503
+ }
504
+ const preString = rows.join("\n");
505
+ let inSurrogate = false;
506
+ for (let i2 = 0; i2 < preString.length; i2++) {
507
+ const character = preString[i2];
508
+ returnValue += character;
509
+ if (!inSurrogate) {
510
+ inSurrogate = character >= "\uD800" && character <= "\uDBFF";
511
+ if (inSurrogate) {
512
+ continue;
513
+ }
514
+ } else {
515
+ inSurrogate = false;
516
+ }
517
+ if (character === ESC || character === CSI) {
518
+ GROUP_REGEX.lastIndex = i2 + 1;
519
+ const groupsResult = GROUP_REGEX.exec(preString);
520
+ const groups = groupsResult?.groups;
521
+ if (groups?.code !== void 0) {
522
+ const code = Number.parseFloat(groups.code);
523
+ escapeCode = code === END_CODE ? void 0 : code;
524
+ } else if (groups?.uri !== void 0) {
525
+ escapeUrl = groups.uri.length === 0 ? void 0 : groups.uri;
526
+ }
527
+ }
528
+ if (preString[i2 + 1] === "\n") {
529
+ if (escapeUrl) {
530
+ returnValue += wrapAnsiHyperlink("");
531
+ }
532
+ const closingCode = escapeCode ? getClosingCode(escapeCode) : void 0;
533
+ if (escapeCode && closingCode) {
534
+ returnValue += wrapAnsiCode(closingCode);
535
+ }
536
+ } else if (character === "\n") {
537
+ if (escapeCode && getClosingCode(escapeCode)) {
538
+ returnValue += wrapAnsiCode(escapeCode);
539
+ }
540
+ if (escapeUrl) {
541
+ returnValue += wrapAnsiHyperlink(escapeUrl);
542
+ }
543
+ }
544
+ }
545
+ return returnValue;
546
+ };
547
+ var CRLF_OR_LF = /\r?\n/;
548
+ function wrapAnsi(string, columns, options) {
549
+ return String(string).normalize().split(CRLF_OR_LF).map((line) => exec(line, columns, options)).join("\n");
550
+ }
551
+
552
+ // ../../node_modules/.pnpm/sisteransi@2.0.0/node_modules/sisteransi/dist/index.js
553
+ var ESC2 = "\x1B";
554
+ var CSI2 = `${ESC2}[`;
555
+ var cursor = {
556
+ to(x, y) {
557
+ if (!y)
558
+ return `${CSI2}${x + 1}G`;
559
+ return `${CSI2}${y + 1};${x + 1}H`;
560
+ },
561
+ move(x, y) {
562
+ let ret = "";
563
+ if (x < 0)
564
+ ret += `${CSI2}${-x}D`;
565
+ else if (x > 0)
566
+ ret += `${CSI2}${x}C`;
567
+ if (y < 0)
568
+ ret += `${CSI2}${-y}A`;
569
+ else if (y > 0)
570
+ ret += `${CSI2}${y}B`;
571
+ return ret;
572
+ },
573
+ up: (count = 1) => `${CSI2}${count}A`,
574
+ down: (count = 1) => `${CSI2}${count}B`,
575
+ forward: (count = 1) => `${CSI2}${count}C`,
576
+ backward: (count = 1) => `${CSI2}${count}D`,
577
+ nextLine: (count = 1) => `${CSI2}E`.repeat(count),
578
+ prevLine: (count = 1) => `${CSI2}F`.repeat(count),
579
+ left: `${CSI2}G`,
580
+ hide: `${CSI2}?25l`,
581
+ show: `${CSI2}?25h`,
582
+ save: `${ESC2}7`,
583
+ restore: `${ESC2}8`
584
+ };
585
+ var erase = {
586
+ screen: `${CSI2}2J`,
587
+ up: (count = 1) => `${CSI2}1J`.repeat(count),
588
+ down: (count = 1) => `${CSI2}J`.repeat(count),
589
+ line: `${CSI2}2K`,
590
+ lineEnd: `${CSI2}K`,
591
+ lineStart: `${CSI2}1K`,
592
+ lines(count) {
593
+ let clear2 = "";
594
+ for (let i2 = 0; i2 < count; i2++)
595
+ clear2 += this.line + (i2 < count - 1 ? cursor.up() : "");
596
+ if (count)
597
+ clear2 += cursor.left;
598
+ return clear2;
599
+ }
600
+ };
601
+ var clear = {
602
+ screen: `${ESC2}c`
603
+ };
604
+
605
+ // ../../node_modules/.pnpm/@clack+core@1.6.0/node_modules/@clack/core/dist/index.mjs
606
+ function findCursor(o, s, l) {
607
+ if (!l.some((r2) => !r2.disabled))
608
+ return o;
609
+ const t2 = o + s, n3 = Math.max(l.length - 1, 0), e = t2 < 0 ? n3 : t2 > n3 ? 0 : t2;
610
+ return l[e]?.disabled ? findCursor(e, s < 0 ? -1 : 1, l) : e;
611
+ }
612
+ var a$1 = ["up", "down", "left", "right", "space", "enter", "cancel"];
613
+ var t = [
614
+ "January",
615
+ "February",
616
+ "March",
617
+ "April",
618
+ "May",
619
+ "June",
620
+ "July",
621
+ "August",
622
+ "September",
623
+ "October",
624
+ "November",
625
+ "December"
626
+ ];
627
+ var settings = {
628
+ actions: new Set(a$1),
629
+ aliases: /* @__PURE__ */ new Map([
630
+ // vim support
631
+ ["k", "up"],
632
+ ["j", "down"],
633
+ ["h", "left"],
634
+ ["l", "right"],
635
+ ["", "cancel"],
636
+ // opinionated defaults!
637
+ ["escape", "cancel"]
638
+ ]),
639
+ messages: {
640
+ cancel: "Canceled",
641
+ error: "Something went wrong"
642
+ },
643
+ withGuide: true,
644
+ accessible: void 0,
645
+ date: {
646
+ monthNames: [...t],
647
+ messages: {
648
+ required: "Please enter a valid date",
649
+ invalidMonth: "There are only 12 months in a year",
650
+ invalidDay: (n3, e) => `There are only ${n3} days in ${e}`,
651
+ afterMin: (n3) => `Date must be on or after ${n3.toISOString().slice(0, 10)}`,
652
+ beforeMax: (n3) => `Date must be on or before ${n3.toISOString().slice(0, 10)}`
653
+ }
654
+ }
655
+ };
656
+ function isAccessible(n3) {
657
+ if (n3 !== void 0) return n3;
658
+ if (settings.accessible !== void 0) return settings.accessible;
659
+ const e = process.env.ACCESSIBLE;
660
+ return e !== void 0 && e !== "" && e !== "0" && e !== "false";
661
+ }
662
+ function isActionKey(n3, e) {
663
+ if (typeof n3 == "string")
664
+ return settings.aliases.get(n3) === e;
665
+ for (const s of n3)
666
+ if (s !== void 0 && isActionKey(s, e))
667
+ return true;
668
+ return false;
669
+ }
670
+ function diffLines(i2, s) {
671
+ if (i2 === s) return;
672
+ const e = i2.split(`
673
+ `), t2 = s.split(`
674
+ `), r2 = Math.max(e.length, t2.length), f = [];
675
+ for (let n3 = 0; n3 < r2; n3++)
676
+ e[n3] !== t2[n3] && f.push(n3);
677
+ return {
678
+ lines: f,
679
+ numLinesBefore: e.length,
680
+ numLinesAfter: t2.length,
681
+ numLines: r2
682
+ };
683
+ }
684
+ var R = globalThis.process.platform.startsWith("win");
685
+ var CANCEL_SYMBOL = /* @__PURE__ */ Symbol("clack:cancel");
686
+ function isCancel(e) {
687
+ return e === CANCEL_SYMBOL;
688
+ }
689
+ function setRawMode(e, r2) {
690
+ const o = e;
691
+ o.isTTY && o.setRawMode(r2);
692
+ }
693
+ var getColumns = (e) => "columns" in e && typeof e.columns == "number" ? e.columns : 80;
694
+ var getRows = (e) => "rows" in e && typeof e.rows == "number" ? e.rows : 20;
695
+ function wrapTextWithPrefix(e, r2, o, n3 = o, s = o, t2) {
696
+ const l = getColumns(e ?? stdout), i2 = dist_default2(o);
697
+ return wrapAnsi(r2, l - i2, {
698
+ hard: true,
699
+ trim: false
700
+ }).split(`
701
+ `).map((c3, a2, g) => {
702
+ const m2 = t2 ? t2(c3, a2) : c3;
703
+ return a2 === 0 ? `${n3}${m2}` : a2 === g.length - 1 ? `${s}${m2}` : `${o}${m2}`;
704
+ }).join(`
705
+ `);
706
+ }
707
+ function runValidation(e, a2) {
708
+ if ("~standard" in e) {
709
+ const n3 = e["~standard"].validate(a2);
710
+ return n3 instanceof Promise ? n3.then((r2) => r2.issues?.at(0)?.message) : n3.issues?.at(0)?.message;
711
+ }
712
+ return e(a2);
713
+ }
714
+ var C$1 = class C {
715
+ input;
716
+ output;
717
+ _abortSignal;
718
+ rl;
719
+ opts;
720
+ _render;
721
+ _track = false;
722
+ _prevFrame = "";
723
+ _subscribers = /* @__PURE__ */ new Map();
724
+ _cursor = 0;
725
+ state = "initial";
726
+ error = "";
727
+ value;
728
+ userInput = "";
729
+ /**
730
+ * Whether accessible (static, screen-reader friendly) output is enabled for
731
+ * this prompt, resolved from the `accessible` option, the global setting,
732
+ * and the `ACCESSIBLE` env var.
733
+ */
734
+ get accessible() {
735
+ return isAccessible(this.opts.accessible);
736
+ }
737
+ constructor(t2, e = true) {
738
+ const { input: i2 = stdin, output: s = stdout, render: r2, signal: n3, ...o } = t2;
739
+ this.opts = o, this.onKeypress = this.onKeypress.bind(this), this.close = this.close.bind(this), this.render = this.render.bind(this), this._render = r2.bind(this), this._track = e, this._abortSignal = n3, this.input = i2, this.output = s;
740
+ }
741
+ /**
742
+ * Unsubscribe all listeners
743
+ */
744
+ unsubscribe() {
745
+ this._subscribers.clear();
746
+ }
747
+ /**
748
+ * Set a subscriber with opts
749
+ * @param event - The event name
750
+ */
751
+ setSubscriber(t2, e) {
752
+ const i2 = this._subscribers.get(t2) ?? [];
753
+ i2.push(e), this._subscribers.set(t2, i2);
754
+ }
755
+ /**
756
+ * Subscribe to an event
757
+ * @param event - The event name
758
+ * @param cb - The callback
759
+ */
760
+ on(t2, e) {
761
+ this.setSubscriber(t2, { cb: e });
762
+ }
763
+ /**
764
+ * Subscribe to an event once
765
+ * @param event - The event name
766
+ * @param cb - The callback
767
+ */
768
+ once(t2, e) {
769
+ this.setSubscriber(t2, { cb: e, once: true });
770
+ }
771
+ /**
772
+ * Emit an event with data
773
+ * @param event - The event name
774
+ * @param data - The data to pass to the callback
775
+ */
776
+ emit(t2, ...e) {
777
+ const i2 = this._subscribers.get(t2) ?? [], s = [];
778
+ for (const r2 of i2)
779
+ r2.cb(...e), r2.once && s.push(() => i2.splice(i2.indexOf(r2), 1));
780
+ for (const r2 of s)
781
+ r2();
782
+ }
783
+ prompt() {
784
+ return new Promise((t2) => {
785
+ if (this._abortSignal) {
786
+ if (this._abortSignal.aborted)
787
+ return this.state = "cancel", this.close(), t2(CANCEL_SYMBOL);
788
+ this._abortSignal.addEventListener(
789
+ "abort",
790
+ () => {
791
+ this.state = "cancel", this.close();
792
+ },
793
+ { once: true }
794
+ );
795
+ }
796
+ this.rl = f__default.createInterface({
797
+ input: this.input,
798
+ tabSize: 2,
799
+ prompt: "",
800
+ escapeCodeTimeout: 50,
801
+ terminal: true
802
+ }), this.rl.prompt(), this.opts.initialUserInput !== void 0 && this._setUserInput(this.opts.initialUserInput, true), this.input.on("keypress", this.onKeypress), setRawMode(this.input, true), this.output.on("resize", this.render), this.render(), this.once("submit", () => {
803
+ this.output.write(cursor.show), this.output.off("resize", this.render), setRawMode(this.input, false), t2(this.value);
804
+ }), this.once("cancel", () => {
805
+ this.output.write(cursor.show), this.output.off("resize", this.render), setRawMode(this.input, false), t2(CANCEL_SYMBOL);
806
+ });
807
+ });
808
+ }
809
+ _isActionKey(t2, e) {
810
+ return t2 === " ";
811
+ }
812
+ _shouldSubmit(t2, e) {
813
+ return true;
814
+ }
815
+ _setValue(t2) {
816
+ this.value = t2, this.emit("value", this.value);
817
+ }
818
+ _setUserInput(t2, e) {
819
+ this.userInput = t2 ?? "", this.emit("userInput", this.userInput), e && this._track && this.rl && (this.rl.write(this.userInput), this._cursor = this.rl.cursor);
820
+ }
821
+ _clearUserInput() {
822
+ this.rl?.write(null, { ctrl: true, name: "u" }), this._setUserInput("");
823
+ }
824
+ async onKeypress(t2, e) {
825
+ if (this.state !== "validating") {
826
+ if (this._track && e.name !== "return" && (e.name && this._isActionKey(t2, e) && this.rl?.write(null, { ctrl: true, name: "h" }), this._cursor = this.rl?.cursor ?? 0, this._setUserInput(this.rl?.line)), this.state === "error" && (this.state = "active"), e?.name && (!this._track && settings.aliases.has(e.name) && this.emit("cursor", settings.aliases.get(e.name)), settings.actions.has(e.name) && this.emit("cursor", e.name)), t2 && (t2.toLowerCase() === "y" || t2.toLowerCase() === "n") && this.emit("confirm", t2.toLowerCase() === "y"), this.emit("key", t2, e), e?.name === "return" && this._shouldSubmit(t2, e)) {
827
+ if (this.opts.validate) {
828
+ const i2 = runValidation(this.opts.validate, this.value);
829
+ let s;
830
+ i2 instanceof Promise ? (this.state = "validating", this.render(), s = await i2) : s = i2, s && (this.error = s instanceof Error ? s.message : s, this.state = "error", this.rl?.write(this.userInput));
831
+ }
832
+ this.state !== "error" && (this.state = "submit");
833
+ }
834
+ isActionKey([t2, e?.name, e?.sequence], "cancel") && (this.state = "cancel"), (this.state === "submit" || this.state === "cancel") && this.emit("finalize"), this.render(), (this.state === "submit" || this.state === "cancel") && this.close();
835
+ }
836
+ }
837
+ close() {
838
+ this.input.unpipe(), this.input.removeListener("keypress", this.onKeypress), this.output.write(`
839
+ `), setRawMode(this.input, false), this.rl?.close(), this.rl = void 0, this.emit(`${this.state}`, this.value), this.unsubscribe();
840
+ }
841
+ restoreCursor() {
842
+ const t2 = wrapAnsi(this._prevFrame, getColumns(this.output), { hard: true, trim: false }).split(`
843
+ `).length - 1;
844
+ this.output.write(cursor.move(-999, t2 * -1));
845
+ }
846
+ render() {
847
+ const t2 = wrapAnsi(this._render(this) ?? "", getColumns(this.output), {
848
+ hard: true,
849
+ trim: false
850
+ });
851
+ if (t2 !== this._prevFrame) {
852
+ if (this.state === "initial")
853
+ this.output.write(cursor.hide);
854
+ else {
855
+ const e = diffLines(this._prevFrame, t2), i2 = getRows(this.output);
856
+ if (this.restoreCursor(), e) {
857
+ const s = Math.max(0, e.numLinesAfter - i2), r2 = Math.max(0, e.numLinesBefore - i2);
858
+ let n3 = e.lines.find((o) => o >= s);
859
+ if (n3 === void 0) {
860
+ this._prevFrame = t2;
861
+ return;
862
+ }
863
+ if (e.lines.length === 1) {
864
+ this.output.write(cursor.move(0, n3 - r2)), this.output.write(erase.lines(1));
865
+ const o = t2.split(`
866
+ `);
867
+ this.output.write(o[n3]), this._prevFrame = t2, this.output.write(cursor.move(0, o.length - n3 - 1));
868
+ return;
869
+ } else if (e.lines.length > 1) {
870
+ if (s < r2)
871
+ n3 = s;
872
+ else {
873
+ const h2 = n3 - r2;
874
+ h2 > 0 && this.output.write(cursor.move(0, h2));
875
+ }
876
+ this.output.write(erase.down());
877
+ const m2 = t2.split(`
878
+ `).slice(n3);
879
+ this.output.write(m2.join(`
880
+ `)), this._prevFrame = t2;
881
+ return;
882
+ }
883
+ }
884
+ this.output.write(erase.down());
885
+ }
886
+ this.output.write(t2), this.state === "initial" && (this.state = "active"), this._prevFrame = t2;
887
+ }
888
+ }
889
+ };
890
+ var r = class extends C$1 {
891
+ get cursor() {
892
+ return this.value ? 0 : 1;
893
+ }
894
+ get _value() {
895
+ return this.cursor === 0;
896
+ }
897
+ constructor(t2) {
898
+ super(t2, false), this.value = !!t2.initialValue, this.on("userInput", () => {
899
+ this.value = this._value;
900
+ }), this.on("confirm", (i2) => {
901
+ this.output.write(cursor.move(0, -1)), this.value = i2, this.state = "submit", this.close();
902
+ }), this.on("cursor", () => {
903
+ this.value = !this.value;
904
+ });
905
+ }
906
+ };
907
+ var a = class extends C$1 {
908
+ options;
909
+ cursor = 0;
910
+ get _value() {
911
+ return this.options[this.cursor]?.value;
912
+ }
913
+ get _enabledOptions() {
914
+ return this.options.filter((e) => e.disabled !== true);
915
+ }
916
+ toggleAll() {
917
+ const e = this._enabledOptions, i2 = this.value !== void 0 && this.value.length === e.length;
918
+ this.value = i2 ? [] : e.map((t2) => t2.value);
919
+ }
920
+ toggleInvert() {
921
+ const e = this.value;
922
+ if (!e)
923
+ return;
924
+ const i2 = this._enabledOptions.filter((t2) => !e.includes(t2.value));
925
+ this.value = i2.map((t2) => t2.value);
926
+ }
927
+ toggleValue() {
928
+ this.value === void 0 && (this.value = []);
929
+ const e = this.value.includes(this._value);
930
+ this.value = e ? this.value.filter((i2) => i2 !== this._value) : [...this.value, this._value];
931
+ }
932
+ constructor(e) {
933
+ super(e, false), this.options = e.options, this.value = [...e.initialValues ?? []];
934
+ const i2 = Math.max(
935
+ this.options.findIndex(({ value: t2 }) => t2 === e.cursorAt),
936
+ 0
937
+ );
938
+ this.cursor = this.options[i2]?.disabled ? findCursor(i2, 1, this.options) : i2, this.on("key", (t2, s) => {
939
+ s.name === "a" && this.toggleAll(), s.name === "i" && this.toggleInvert(), s.name === void 0 && t2 === "\u3000" && this.toggleValue();
940
+ }), this.on("cursor", (t2) => {
941
+ switch (t2) {
942
+ case "left":
943
+ case "up":
944
+ this.cursor = findCursor(this.cursor, -1, this.options);
945
+ break;
946
+ case "down":
947
+ case "right":
948
+ this.cursor = findCursor(this.cursor, 1, this.options);
949
+ break;
950
+ case "space":
951
+ this.toggleValue();
952
+ break;
953
+ }
954
+ });
955
+ }
956
+ };
957
+ var u = class extends C$1 {
958
+ _mask = "\u2022";
959
+ get cursor() {
960
+ return this._cursor;
961
+ }
962
+ get masked() {
963
+ return this.userInput.replaceAll(/./g, this._mask);
964
+ }
965
+ get userInputWithCursor() {
966
+ if (this.state === "submit" || this.state === "cancel")
967
+ return this.masked;
968
+ const t2 = this.userInput;
969
+ if (this.cursor >= t2.length)
970
+ return `${this.masked}${styleText(["inverse", "hidden"], "_")}`;
971
+ const s = this.masked, r2 = s.slice(0, this.cursor), i2 = s.slice(this.cursor, this.cursor + 1), o = s.slice(this.cursor + 1);
972
+ return `${r2}${styleText("inverse", i2)}${o}`;
973
+ }
974
+ clear() {
975
+ this._clearUserInput();
976
+ }
977
+ constructor({ mask: t2, ...s }) {
978
+ super(s), this._mask = t2 ?? "\u2022", this.on("userInput", (r2) => {
979
+ this._setValue(r2);
980
+ }), this.on("finalize", () => {
981
+ this.value === void 0 && (this.value = "");
982
+ });
983
+ }
984
+ };
985
+ var n$1 = class n extends C$1 {
986
+ options;
987
+ cursor = 0;
988
+ get _selectedValue() {
989
+ return this.options[this.cursor];
990
+ }
991
+ changeValue() {
992
+ const e = this._selectedValue;
993
+ this.value = e === void 0 ? void 0 : e.value;
994
+ }
995
+ constructor(e) {
996
+ super(e, false), this.options = e.options;
997
+ const o = this.options.findIndex(({ value: s }) => s === e.initialValue), t2 = o === -1 ? 0 : o;
998
+ this.cursor = this.options[t2]?.disabled ? findCursor(t2, 1, this.options) : t2, this.changeValue(), this.on("cursor", (s) => {
999
+ switch (s) {
1000
+ case "left":
1001
+ case "up":
1002
+ this.cursor = findCursor(this.cursor, -1, this.options);
1003
+ break;
1004
+ case "down":
1005
+ case "right":
1006
+ this.cursor = findCursor(this.cursor, 1, this.options);
1007
+ break;
1008
+ }
1009
+ this.changeValue();
1010
+ });
1011
+ }
1012
+ };
1013
+ var n2 = class extends C$1 {
1014
+ get userInputWithCursor() {
1015
+ if (this.state === "submit")
1016
+ return this.userInput;
1017
+ const t2 = this.userInput;
1018
+ if (this.cursor >= t2.length)
1019
+ return `${this.userInput}\u2588`;
1020
+ const r2 = t2.slice(0, this.cursor), s = t2.slice(this.cursor, this.cursor + 1), e = t2.slice(this.cursor + 1);
1021
+ return `${r2}${styleText("inverse", s)}${e}`;
1022
+ }
1023
+ get cursor() {
1024
+ return this._cursor;
1025
+ }
1026
+ constructor(t2) {
1027
+ super({
1028
+ ...t2,
1029
+ initialUserInput: t2.initialUserInput ?? t2.initialValue
1030
+ }), this.on("userInput", (r2) => {
1031
+ this._setValue(r2);
1032
+ }), this.on("finalize", () => {
1033
+ this.value || (this.value = t2.defaultValue), this.value === void 0 && (this.value = "");
1034
+ });
1035
+ }
1036
+ };
1037
+
1038
+ // ../../node_modules/.pnpm/@clack+prompts@1.9.0/node_modules/@clack/prompts/dist/index.mjs
1039
+ import { styleText as styleText2, stripVTControlCharacters } from "node:util";
1040
+ import process$1 from "node:process";
1041
+ function isUnicodeSupported() {
1042
+ if (process$1.platform !== "win32") {
1043
+ return process$1.env.TERM !== "linux";
1044
+ }
1045
+ return Boolean(process$1.env.CI) || Boolean(process$1.env.WT_SESSION) || Boolean(process$1.env.TERMINUS_SUBLIME) || process$1.env.ConEmuTask === "{cmd::Cmder}" || process$1.env.TERM_PROGRAM === "Terminus-Sublime" || process$1.env.TERM_PROGRAM === "vscode" || process$1.env.TERM === "xterm-256color" || process$1.env.TERM === "alacritty" || process$1.env.TERMINAL_EMULATOR === "JetBrains-JediTerm";
1046
+ }
1047
+ var unicode = isUnicodeSupported();
1048
+ var unicodeOr = (e, o) => unicode ? e : o;
1049
+ var S_STEP_ACTIVE = unicodeOr("\u25C6", "*");
1050
+ var S_STEP_CANCEL = unicodeOr("\u25A0", "x");
1051
+ var S_STEP_ERROR = unicodeOr("\u25B2", "x");
1052
+ var S_STEP_SUBMIT = unicodeOr("\u25C7", "o");
1053
+ var S_BAR_START = unicodeOr("\u250C", "T");
1054
+ var S_BAR = unicodeOr("\u2502", "|");
1055
+ var S_BAR_END = unicodeOr("\u2514", "\u2014");
1056
+ var S_BAR_START_RIGHT = unicodeOr("\u2510", "T");
1057
+ var S_BAR_END_RIGHT = unicodeOr("\u2518", "\u2014");
1058
+ var S_RADIO_ACTIVE = unicodeOr("\u25CF", ">");
1059
+ var S_RADIO_INACTIVE = unicodeOr("\u25CB", " ");
1060
+ var S_CHECKBOX_ACTIVE = unicodeOr("\u25FB", "[\u2022]");
1061
+ var S_CHECKBOX_SELECTED = unicodeOr("\u25FC", "[+]");
1062
+ var S_CHECKBOX_INACTIVE = unicodeOr("\u25FB", "[ ]");
1063
+ var S_PASSWORD_MASK = unicodeOr("\u25AA", "\u2022");
1064
+ var S_BAR_H = unicodeOr("\u2500", "-");
1065
+ var S_CORNER_TOP_RIGHT = unicodeOr("\u256E", "+");
1066
+ var S_CONNECT_LEFT = unicodeOr("\u251C", "+");
1067
+ var S_CORNER_BOTTOM_RIGHT = unicodeOr("\u256F", "+");
1068
+ var S_CORNER_BOTTOM_LEFT = unicodeOr("\u2570", "+");
1069
+ var S_CORNER_TOP_LEFT = unicodeOr("\u256D", "+");
1070
+ var S_INFO = unicodeOr("\u25CF", "\u2022");
1071
+ var S_SUCCESS = unicodeOr("\u25C6", "*");
1072
+ var S_WARN = unicodeOr("\u25B2", "!");
1073
+ var S_ERROR = unicodeOr("\u25A0", "x");
1074
+ var symbol = (e) => {
1075
+ switch (e) {
1076
+ case "initial":
1077
+ case "active":
1078
+ return styleText2("cyan", S_STEP_ACTIVE);
1079
+ case "cancel":
1080
+ return styleText2("red", S_STEP_CANCEL);
1081
+ case "error":
1082
+ return styleText2("yellow", S_STEP_ERROR);
1083
+ case "submit":
1084
+ return styleText2("green", S_STEP_SUBMIT);
1085
+ case "validating":
1086
+ return styleText2("dim", S_STEP_ACTIVE);
1087
+ }
1088
+ };
1089
+ var symbolBar = (e) => {
1090
+ switch (e) {
1091
+ case "initial":
1092
+ case "active":
1093
+ return styleText2("cyan", S_BAR);
1094
+ case "cancel":
1095
+ return styleText2("red", S_BAR);
1096
+ case "error":
1097
+ return styleText2("yellow", S_BAR);
1098
+ case "submit":
1099
+ return styleText2("green", S_BAR);
1100
+ }
1101
+ };
1102
+ function formatInstructionFooter(e, o, r2) {
1103
+ const s = r2 ? `${styleText2("cyan", S_BAR)} ` : "", n3 = wrapTextWithPrefix(e, o.join(" \u2022 "), s).split(`
1104
+ `);
1105
+ return r2 && n3.push(styleText2("cyan", S_BAR_END)), n3;
1106
+ }
1107
+ var E$1 = (l, e, w, p, b, C3 = false) => {
1108
+ let r2 = e, O = 0;
1109
+ if (C3)
1110
+ for (let i2 = p - 1; i2 >= w; i2--) {
1111
+ const m2 = l[i2];
1112
+ if (m2 && (r2 -= m2.length), O++, r2 <= b) break;
1113
+ }
1114
+ else
1115
+ for (let i2 = w; i2 < p; i2++) {
1116
+ const m2 = l[i2];
1117
+ if (m2 && (r2 -= m2.length), O++, r2 <= b) break;
1118
+ }
1119
+ return { lineCount: r2, removals: O };
1120
+ };
1121
+ var limitOptions = ({
1122
+ cursor: l,
1123
+ options: e,
1124
+ style: w,
1125
+ output: p = process.stdout,
1126
+ maxItems: b = Number.POSITIVE_INFINITY,
1127
+ columnPadding: C3 = 0,
1128
+ rowPadding: r2 = 4
1129
+ }) => {
1130
+ const i2 = getColumns(p) - C3, m2 = getRows(p), M = styleText2("dim", "..."), v = Math.max(m2 - r2, 0), a2 = Math.max(Math.min(b, v), 5);
1131
+ let f = 0;
1132
+ l >= a2 - 3 && (f = Math.max(
1133
+ Math.min(l - a2 + 3, e.length - a2),
1134
+ 0
1135
+ ));
1136
+ let d = a2 < e.length && f > 0, c3 = a2 < e.length && f + a2 < e.length;
1137
+ const I = Math.min(
1138
+ f + a2,
1139
+ e.length
1140
+ ), s = [];
1141
+ let g = 0;
1142
+ d && g++, c3 && g++;
1143
+ const T = f + (d ? 1 : 0), W2 = I - (c3 ? 1 : 0);
1144
+ for (let t2 = T; t2 < W2; t2++) {
1145
+ const n3 = e[t2], o = n3 !== void 0 ? w(n3, t2 === l) : "", h2 = wrapAnsi(o, i2, {
1146
+ hard: true,
1147
+ trim: false
1148
+ }).split(`
1149
+ `);
1150
+ s.push(h2), g += h2.length;
1151
+ }
1152
+ if (g > v) {
1153
+ let t2 = 0, n3 = 0, o = g;
1154
+ const h2 = l - T;
1155
+ let u3 = v;
1156
+ const L = () => E$1(s, o, 0, h2, u3), y = () => E$1(
1157
+ s,
1158
+ o,
1159
+ h2 + 1,
1160
+ s.length,
1161
+ u3,
1162
+ true
1163
+ );
1164
+ d ? ({ lineCount: o, removals: t2 } = L(), o > u3 && (c3 || (u3 -= 1), { lineCount: o, removals: n3 } = y())) : (c3 || (u3 -= 1), { lineCount: o, removals: n3 } = y(), o > u3 && (u3 -= 1, { lineCount: o, removals: t2 } = L())), t2 > 0 && (d = true, s.splice(0, t2)), n3 > 0 && (c3 = true, s.splice(s.length - n3, n3));
1165
+ }
1166
+ const x = [];
1167
+ d && x.push(M);
1168
+ for (const t2 of s)
1169
+ for (const n3 of t2)
1170
+ x.push(n3);
1171
+ return c3 && x.push(M), x;
1172
+ };
1173
+ var confirm = (e) => {
1174
+ const a2 = e.active ?? "Yes", o = e.inactive ?? "No";
1175
+ return new r({
1176
+ active: a2,
1177
+ inactive: o,
1178
+ signal: e.signal,
1179
+ input: e.input,
1180
+ output: e.output,
1181
+ initialValue: e.initialValue ?? true,
1182
+ render() {
1183
+ const i2 = e.withGuide ?? settings.withGuide, u3 = `${symbol(this.state)} `, l = i2 ? `${styleText2("gray", S_BAR)} ` : "", f = wrapTextWithPrefix(
1184
+ e.output,
1185
+ e.message,
1186
+ l,
1187
+ u3
1188
+ ), s = `${i2 ? `${styleText2("gray", S_BAR)}
1189
+ ` : ""}${f}
1190
+ `, c3 = this.value ? a2 : o;
1191
+ switch (this.state) {
1192
+ case "submit": {
1193
+ const r2 = i2 ? `${styleText2("gray", S_BAR)} ` : "";
1194
+ return `${s}${r2}${styleText2("dim", c3)}`;
1195
+ }
1196
+ case "cancel": {
1197
+ const r2 = i2 ? `${styleText2("gray", S_BAR)} ` : "";
1198
+ return `${s}${r2}${styleText2(["strikethrough", "dim"], c3)}${i2 ? `
1199
+ ${styleText2("gray", S_BAR)}` : ""}`;
1200
+ }
1201
+ default: {
1202
+ const r2 = i2 ? `${styleText2("cyan", S_BAR)} ` : "", g = i2 ? styleText2("cyan", S_BAR_END) : "";
1203
+ return `${s}${r2}${this.value ? `${styleText2("green", S_RADIO_ACTIVE)} ${a2}` : `${styleText2("dim", S_RADIO_INACTIVE)} ${styleText2("dim", a2)}`}${e.vertical ? i2 ? `
1204
+ ${styleText2("cyan", S_BAR)} ` : `
1205
+ ` : ` ${styleText2("dim", "/")} `}${this.value ? `${styleText2("dim", S_RADIO_INACTIVE)} ${styleText2("dim", o)}` : `${styleText2("green", S_RADIO_ACTIVE)} ${o}`}
1206
+ ${g}
1207
+ `;
1208
+ }
1209
+ }
1210
+ }
1211
+ }).prompt();
1212
+ };
1213
+ var MULTISELECT_INSTRUCTIONS = [
1214
+ `${styleText2("dim", "\u2191/\u2193")} to navigate`,
1215
+ `${styleText2("dim", "Space:")} select`,
1216
+ `${styleText2("dim", "Enter:")} confirm`
1217
+ ];
1218
+ var m = (n3, u3) => n3.split(`
1219
+ `).map((d) => u3(d)).join(`
1220
+ `);
1221
+ var multiselect = (n3) => {
1222
+ const u3 = (t2, a2) => {
1223
+ const r2 = t2.label ?? String(t2.value);
1224
+ return a2 === "disabled" ? `${styleText2("gray", S_CHECKBOX_INACTIVE)} ${m(r2, (o) => styleText2(["strikethrough", "gray"], o))}${t2.hint ? ` ${styleText2("dim", `(${t2.hint ?? "disabled"})`)}` : ""}` : a2 === "active" ? `${styleText2("cyan", S_CHECKBOX_ACTIVE)} ${r2}${t2.hint ? ` ${styleText2("dim", `(${t2.hint})`)}` : ""}` : a2 === "selected" ? `${styleText2("green", S_CHECKBOX_SELECTED)} ${m(r2, (o) => styleText2("dim", o))}${t2.hint ? ` ${styleText2("dim", `(${t2.hint})`)}` : ""}` : a2 === "cancelled" ? `${m(r2, (o) => styleText2(["strikethrough", "dim"], o))}` : a2 === "active-selected" ? `${styleText2("green", S_CHECKBOX_SELECTED)} ${r2}${t2.hint ? ` ${styleText2("dim", `(${t2.hint})`)}` : ""}` : a2 === "submitted" ? `${m(r2, (o) => styleText2("dim", o))}` : `${styleText2("dim", S_CHECKBOX_INACTIVE)} ${m(r2, (o) => styleText2("dim", o))}`;
1225
+ }, d = n3.required ?? true, x = n3.showInstructions ?? true;
1226
+ return new a({
1227
+ options: n3.options,
1228
+ signal: n3.signal,
1229
+ input: n3.input,
1230
+ output: n3.output,
1231
+ initialValues: n3.initialValues,
1232
+ required: d,
1233
+ cursorAt: n3.cursorAt,
1234
+ validate(t2) {
1235
+ if (d && (t2 === void 0 || t2.length === 0))
1236
+ return `Please select at least one option.
1237
+ ${styleText2(
1238
+ "reset",
1239
+ styleText2(
1240
+ "dim",
1241
+ `Press ${styleText2(["gray", "bgWhite", "inverse"], " space ")} to select, ${styleText2(
1242
+ "gray",
1243
+ styleText2("bgWhite", styleText2("inverse", " enter "))
1244
+ )} to submit`
1245
+ )
1246
+ )}`;
1247
+ },
1248
+ render() {
1249
+ const t2 = n3.withGuide ?? settings.withGuide, a2 = wrapTextWithPrefix(
1250
+ n3.output,
1251
+ n3.message,
1252
+ t2 ? `${symbolBar(this.state)} ` : "",
1253
+ `${symbol(this.state)} `
1254
+ ), r2 = `${t2 ? `${styleText2("gray", S_BAR)}
1255
+ ` : ""}${a2}
1256
+ `, o = this.value ?? [], g = (i2, l) => {
1257
+ if (i2.disabled)
1258
+ return u3(i2, "disabled");
1259
+ const s = o.includes(i2.value);
1260
+ return l && s ? u3(i2, "active-selected") : s ? u3(i2, "selected") : u3(i2, l ? "active" : "inactive");
1261
+ };
1262
+ switch (this.state) {
1263
+ case "submit": {
1264
+ const i2 = this.options.filter(({ value: s }) => o.includes(s)).map((s) => u3(s, "submitted")).join(styleText2("dim", ", ")) || styleText2("dim", "none"), l = wrapTextWithPrefix(
1265
+ n3.output,
1266
+ i2,
1267
+ t2 ? `${styleText2("gray", S_BAR)} ` : ""
1268
+ );
1269
+ return `${r2}${l}`;
1270
+ }
1271
+ case "cancel": {
1272
+ const i2 = this.options.filter(({ value: s }) => o.includes(s)).map((s) => u3(s, "cancelled")).join(styleText2("dim", ", "));
1273
+ if (i2.trim() === "")
1274
+ return `${r2}${styleText2("gray", S_BAR)}`;
1275
+ const l = wrapTextWithPrefix(
1276
+ n3.output,
1277
+ i2,
1278
+ t2 ? `${styleText2("gray", S_BAR)} ` : ""
1279
+ );
1280
+ return `${r2}${l}${t2 ? `
1281
+ ${styleText2("gray", S_BAR)}` : ""}`;
1282
+ }
1283
+ case "error": {
1284
+ const i2 = t2 ? `${styleText2("yellow", S_BAR)} ` : "", l = this.error.split(`
1285
+ `).map(
1286
+ ($, v) => v === 0 ? `${t2 ? `${styleText2("yellow", S_BAR_END)} ` : ""}${styleText2("yellow", $)}` : ` ${$}`
1287
+ ).join(`
1288
+ `), s = r2.split(`
1289
+ `).length, h2 = l.split(`
1290
+ `).length + 1;
1291
+ return `${r2}${i2}${limitOptions({
1292
+ output: n3.output,
1293
+ options: this.options,
1294
+ cursor: this.cursor,
1295
+ maxItems: n3.maxItems,
1296
+ columnPadding: i2.length,
1297
+ rowPadding: s + h2,
1298
+ style: g
1299
+ }).join(`
1300
+ ${i2}`)}
1301
+ ${l}
1302
+ `;
1303
+ }
1304
+ default: {
1305
+ const i2 = t2 ? `${styleText2("cyan", S_BAR)} ` : "", l = r2.split(`
1306
+ `).length, s = x ? formatInstructionFooter(n3.output, MULTISELECT_INSTRUCTIONS, t2) : t2 ? [styleText2("cyan", S_BAR_END)] : [], h2 = s.join(`
1307
+ `), $ = s.length + 1;
1308
+ return `${r2}${i2}${limitOptions({
1309
+ output: n3.output,
1310
+ options: this.options,
1311
+ cursor: this.cursor,
1312
+ maxItems: n3.maxItems,
1313
+ columnPadding: i2.length,
1314
+ rowPadding: l + $,
1315
+ style: g
1316
+ }).join(`
1317
+ ${i2}`)}
1318
+ ${h2}
1319
+ `;
1320
+ }
1321
+ }
1322
+ }
1323
+ }).prompt();
1324
+ };
1325
+ var log = {
1326
+ message: (s = [], {
1327
+ symbol: e = styleText2("gray", S_BAR),
1328
+ secondarySymbol: r2 = styleText2("gray", S_BAR),
1329
+ output: m2 = process.stdout,
1330
+ spacing: l = 1,
1331
+ withGuide: c3
1332
+ } = {}) => {
1333
+ const t2 = [], o = c3 ?? settings.withGuide, f = o ? r2 : "", O = o ? `${e} ` : "", u3 = o ? `${r2} ` : "";
1334
+ for (let i2 = 0; i2 < l; i2++)
1335
+ t2.push(f);
1336
+ const g = Array.isArray(s) ? s : s.split(`
1337
+ `);
1338
+ if (g.length > 0) {
1339
+ const [i2, ...y] = g;
1340
+ i2.length > 0 ? t2.push(`${O}${i2}`) : t2.push(o ? e : "");
1341
+ for (const p of y)
1342
+ p.length > 0 ? t2.push(`${u3}${p}`) : t2.push(o ? r2 : "");
1343
+ }
1344
+ m2.write(`${t2.join(`
1345
+ `)}
1346
+ `);
1347
+ },
1348
+ info: (s, e) => {
1349
+ log.message(s, { ...e, symbol: styleText2("blue", S_INFO) });
1350
+ },
1351
+ success: (s, e) => {
1352
+ log.message(s, { ...e, symbol: styleText2("green", S_SUCCESS) });
1353
+ },
1354
+ step: (s, e) => {
1355
+ log.message(s, { ...e, symbol: styleText2("green", S_STEP_SUBMIT) });
1356
+ },
1357
+ warn: (s, e) => {
1358
+ log.message(s, { ...e, symbol: styleText2("yellow", S_WARN) });
1359
+ },
1360
+ /** alias for `log.warn()`. */
1361
+ warning: (s, e) => {
1362
+ log.warn(s, e);
1363
+ },
1364
+ error: (s, e) => {
1365
+ log.message(s, { ...e, symbol: styleText2("red", S_ERROR) });
1366
+ }
1367
+ };
1368
+ var cancel = (o = "", t2) => {
1369
+ const i2 = t2?.output ?? process.stdout, e = t2?.withGuide ?? settings.withGuide ? `${styleText2("gray", S_BAR_END)} ` : "";
1370
+ i2.write(`${e}${styleText2("red", o)}
1371
+
1372
+ `);
1373
+ };
1374
+ var intro = (o = "", t2) => {
1375
+ const i2 = t2?.output ?? process.stdout, e = t2?.withGuide ?? settings.withGuide ? `${styleText2("gray", S_BAR_START)} ` : "";
1376
+ i2.write(`${e}${o}
1377
+ `);
1378
+ };
1379
+ var outro = (o = "", t2) => {
1380
+ const i2 = t2?.output ?? process.stdout, e = t2?.withGuide ?? settings.withGuide ? `${styleText2("gray", S_BAR)}
1381
+ ${styleText2("gray", S_BAR_END)} ` : "";
1382
+ i2.write(`${e}${o}
1383
+
1384
+ `);
1385
+ };
1386
+ var W = (o) => o;
1387
+ var C2 = (o, e, s) => {
1388
+ const a2 = {
1389
+ hard: true,
1390
+ trim: false
1391
+ }, i2 = wrapAnsi(o, e, a2).split(`
1392
+ `), c3 = i2.reduce((n3, t2) => Math.max(dist_default2(t2), n3), 0), u3 = i2.map(s).reduce((n3, t2) => Math.max(dist_default2(t2), n3), 0), g = e - (u3 - c3);
1393
+ return wrapAnsi(o, g, a2);
1394
+ };
1395
+ var note = (o = "", e = "", s) => {
1396
+ const a2 = s?.output ?? process$1.stdout, i2 = s?.withGuide ?? settings.withGuide, c3 = s?.format ?? W, g = ["", ...C2(o, getColumns(a2) - 6, c3).split(`
1397
+ `).map(c3), ""], n3 = dist_default2(e), t2 = Math.max(
1398
+ g.reduce((m2, F) => {
1399
+ const O = dist_default2(F);
1400
+ return O > m2 ? O : m2;
1401
+ }, 0),
1402
+ n3
1403
+ ) + 2, h2 = g.map(
1404
+ (m2) => `${styleText2("gray", S_BAR)} ${m2}${" ".repeat(t2 - dist_default2(m2))}${styleText2("gray", S_BAR)}`
1405
+ ).join(`
1406
+ `), T = i2 ? `${styleText2("gray", S_BAR)}
1407
+ ` : "", l$1 = i2 ? S_CONNECT_LEFT : S_CORNER_BOTTOM_LEFT;
1408
+ a2.write(
1409
+ `${T}${styleText2("green", S_STEP_SUBMIT)} ${styleText2("reset", e)} ${styleText2(
1410
+ "gray",
1411
+ S_BAR_H.repeat(Math.max(t2 - n3 - 1, 1)) + S_CORNER_TOP_RIGHT
1412
+ )}
1413
+ ${h2}
1414
+ ${styleText2("gray", l$1 + S_BAR_H.repeat(t2 + 2) + S_CORNER_BOTTOM_RIGHT)}
1415
+ `
1416
+ );
1417
+ };
1418
+ var password = (e) => new u({
1419
+ validate: e.validate,
1420
+ mask: e.mask ?? S_PASSWORD_MASK,
1421
+ signal: e.signal,
1422
+ input: e.input,
1423
+ output: e.output,
1424
+ render() {
1425
+ const r2 = e.withGuide ?? settings.withGuide, o = `${r2 ? `${styleText2("gray", S_BAR)}
1426
+ ` : ""}${symbol(this.state)} ${e.message}
1427
+ `, m2 = this.userInputWithCursor, i2 = this.masked;
1428
+ switch (this.state) {
1429
+ case "error": {
1430
+ const s = r2 ? `${styleText2("yellow", S_BAR)} ` : "", n3 = r2 ? `${styleText2("yellow", S_BAR_END)} ` : "", d = i2 ?? "";
1431
+ return e.clearOnError && this.clear(), `${o.trim()}
1432
+ ${s}${d}
1433
+ ${n3}${styleText2("yellow", this.error)}
1434
+ `;
1435
+ }
1436
+ case "submit": {
1437
+ const s = r2 ? `${styleText2("gray", S_BAR)} ` : "", n3 = i2 ? styleText2("dim", i2) : "";
1438
+ return `${o}${s}${n3}`;
1439
+ }
1440
+ case "cancel": {
1441
+ const s = r2 ? `${styleText2("gray", S_BAR)} ` : "", n3 = i2 ? styleText2(["strikethrough", "dim"], i2) : "";
1442
+ return `${o}${s}${n3}${i2 && r2 ? `
1443
+ ${styleText2("gray", S_BAR)}` : ""}`;
1444
+ }
1445
+ default: {
1446
+ const s = r2 ? `${styleText2("cyan", S_BAR)} ` : "", n3 = r2 ? styleText2("cyan", S_BAR_END) : "";
1447
+ return `${o}${s}${m2}
1448
+ ${n3}
1449
+ `;
1450
+ }
1451
+ }
1452
+ }
1453
+ }).prompt();
1454
+ var u2 = {
1455
+ light: unicodeOr("\u2500", "-"),
1456
+ heavy: unicodeOr("\u2501", "="),
1457
+ block: unicodeOr("\u2588", "#")
1458
+ };
1459
+ var SELECT_INSTRUCTIONS = [
1460
+ `${styleText2("dim", "\u2191/\u2193")} to navigate`,
1461
+ `${styleText2("dim", "Enter:")} confirm`
1462
+ ];
1463
+ var c2 = (t2, o) => t2.includes(`
1464
+ `) ? t2.split(`
1465
+ `).map((d) => o(d)).join(`
1466
+ `) : o(t2);
1467
+ var select = (t2) => {
1468
+ const o = (n3, m2) => {
1469
+ if (n3 === void 0)
1470
+ return "";
1471
+ const s = n3.label ?? String(n3.value);
1472
+ switch (m2) {
1473
+ case "disabled":
1474
+ return `${styleText2("gray", S_RADIO_INACTIVE)} ${c2(s, (i2) => styleText2("gray", i2))}${n3.hint ? ` ${styleText2("dim", `(${n3.hint ?? "disabled"})`)}` : ""}`;
1475
+ case "selected":
1476
+ return `${c2(s, (i2) => styleText2("dim", i2))}`;
1477
+ case "active":
1478
+ return `${styleText2("green", S_RADIO_ACTIVE)} ${s}${n3.hint ? ` ${styleText2("dim", `(${n3.hint})`)}` : ""}`;
1479
+ case "cancelled":
1480
+ return `${c2(s, (i2) => styleText2(["strikethrough", "dim"], i2))}`;
1481
+ default:
1482
+ return `${styleText2("dim", S_RADIO_INACTIVE)} ${c2(s, (i2) => styleText2("dim", i2))}`;
1483
+ }
1484
+ }, d = t2.showInstructions ?? true;
1485
+ return new n$1({
1486
+ options: t2.options,
1487
+ signal: t2.signal,
1488
+ input: t2.input,
1489
+ output: t2.output,
1490
+ initialValue: t2.initialValue,
1491
+ render() {
1492
+ const n3 = t2.withGuide ?? settings.withGuide, m2 = `${symbol(this.state)} `, s = `${symbolBar(this.state)} `, i2 = wrapTextWithPrefix(
1493
+ t2.output,
1494
+ t2.message,
1495
+ s,
1496
+ m2
1497
+ ), u3 = `${n3 ? `${styleText2("gray", S_BAR)}
1498
+ ` : ""}${i2}
1499
+ `;
1500
+ switch (this.state) {
1501
+ case "submit": {
1502
+ const r2 = n3 ? `${styleText2("gray", S_BAR)} ` : "", a2 = wrapTextWithPrefix(
1503
+ t2.output,
1504
+ o(this.options[this.cursor], "selected"),
1505
+ r2
1506
+ );
1507
+ return `${u3}${a2}`;
1508
+ }
1509
+ case "cancel": {
1510
+ const r2 = n3 ? `${styleText2("gray", S_BAR)} ` : "", a2 = wrapTextWithPrefix(
1511
+ t2.output,
1512
+ o(this.options[this.cursor], "cancelled"),
1513
+ r2
1514
+ );
1515
+ return `${u3}${a2}${n3 ? `
1516
+ ${styleText2("gray", S_BAR)}` : ""}`;
1517
+ }
1518
+ default: {
1519
+ const r2 = n3 ? `${styleText2("cyan", S_BAR)} ` : "", a2 = u3.split(`
1520
+ `).length, p = d ? formatInstructionFooter(t2.output, SELECT_INSTRUCTIONS, n3) : n3 ? [styleText2("cyan", S_BAR_END)] : [], f = p.join(`
1521
+ `), b = p.length + 1;
1522
+ return `${u3}${r2}${limitOptions({
1523
+ output: t2.output,
1524
+ cursor: this.cursor,
1525
+ options: this.options,
1526
+ maxItems: t2.maxItems,
1527
+ columnPadding: r2.length,
1528
+ rowPadding: a2 + b,
1529
+ style: (g, x) => o(g, g.disabled ? "disabled" : x ? "active" : "inactive")
1530
+ }).join(`
1531
+ ${r2}`)}
1532
+ ${f}
1533
+ `;
1534
+ }
1535
+ }
1536
+ }
1537
+ }).prompt();
1538
+ };
1539
+ var i = `${styleText2("gray", S_BAR)} `;
1540
+ var text = (t2) => new n2({
1541
+ validate: t2.validate,
1542
+ placeholder: t2.placeholder,
1543
+ defaultValue: t2.defaultValue,
1544
+ initialValue: t2.initialValue,
1545
+ output: t2.output,
1546
+ signal: t2.signal,
1547
+ input: t2.input,
1548
+ render() {
1549
+ const r2 = t2?.withGuide ?? settings.withGuide, l = `${`${r2 ? `${styleText2("gray", S_BAR)}
1550
+ ` : ""}${symbol(this.state)} `}${t2.message}
1551
+ `, d = t2.placeholder && t2.placeholder.length > 0 ? (
1552
+ // biome-ignore lint/style/noNonNullAssertion: guarded by placeholder.length > 0
1553
+ styleText2("inverse", t2.placeholder[0]) + styleText2("dim", t2.placeholder.slice(1))
1554
+ ) : styleText2(["inverse", "hidden"], "_"), o = this.userInput ? this.userInputWithCursor : d, s = this.value ?? "";
1555
+ switch (this.state) {
1556
+ case "validating": {
1557
+ const n3 = r2 ? `${styleText2("cyan", S_BAR)} ` : "", i2 = r2 ? styleText2("cyan", S_BAR_END) : "", c3 = styleText2("dim", o), $ = styleText2("dim", "Validating...");
1558
+ return `${l}${n3}${c3}
1559
+ ${i2} ${$}
1560
+ `;
1561
+ }
1562
+ case "error": {
1563
+ const n3 = this.error ? ` ${styleText2("yellow", this.error)}` : "", i2 = r2 ? `${styleText2("yellow", S_BAR)} ` : "", c3 = r2 ? styleText2("yellow", S_BAR_END) : "";
1564
+ return `${l.trim()}
1565
+ ${i2}${o}
1566
+ ${c3}${n3}
1567
+ `;
1568
+ }
1569
+ case "submit": {
1570
+ const n3 = s ? `${r2 ? " " : ""}${styleText2("dim", s)}` : "", i2 = r2 ? styleText2("gray", S_BAR) : "";
1571
+ return `${l}${i2}${n3}`;
1572
+ }
1573
+ case "cancel": {
1574
+ const n3 = s ? ` ${styleText2(["strikethrough", "dim"], s)}` : "", i2 = r2 ? styleText2("gray", S_BAR) : "";
1575
+ return `${l}${i2}${n3}${s.trim() ? `
1576
+ ${i2}` : ""}`;
1577
+ }
1578
+ default: {
1579
+ const n3 = r2 ? `${styleText2("cyan", S_BAR)} ` : "", i2 = r2 ? styleText2("cyan", S_BAR_END) : "";
1580
+ return `${l}${n3}${o}
1581
+ ${i2}
1582
+ `;
1583
+ }
1584
+ }
1585
+ }
1586
+ }).prompt();
1587
+
1588
+ // src/index.ts
1589
+ var import_mri = __toESM(require_lib(), 1);
1590
+ var import_picocolors2 = __toESM(require_picocolors(), 1);
1591
+
1592
+ // src/apple.ts
1593
+ import { spawnSync } from "node:child_process";
1594
+ import { X509Certificate } from "node:crypto";
1595
+ import { homedir } from "node:os";
1596
+ import { join } from "node:path";
1597
+ var TEAM_ID = /^[A-Z0-9]{10}$/;
1598
+ function teamsFromXcodeJson(value) {
1599
+ if (Array.isArray(value)) return value.flatMap(teamsFromXcodeJson);
1600
+ if (typeof value !== "object" || value === null) return [];
1601
+ const record = Object.fromEntries(Object.entries(value));
1602
+ const id = record.teamID;
1603
+ if (typeof id === "string" && TEAM_ID.test(id)) {
1604
+ const name = typeof record.teamName === "string" ? record.teamName : id;
1605
+ return [{ id, name }];
1606
+ }
1607
+ return Object.values(record).flatMap(teamsFromXcodeJson);
1608
+ }
1609
+ function teamFromCertificateSubject(subject) {
1610
+ const fields = /* @__PURE__ */ new Map();
1611
+ for (const line of subject.split("\n")) {
1612
+ const eq = line.indexOf("=");
1613
+ if (eq > 0) fields.set(line.slice(0, eq).trim(), line.slice(eq + 1).trim());
1614
+ }
1615
+ const id = fields.get("OU");
1616
+ if (!id || !TEAM_ID.test(id)) return void 0;
1617
+ return { id, name: fields.get("O") ?? id };
1618
+ }
1619
+ function teamsFromXcode() {
1620
+ const plist = join(homedir(), "Library/Preferences/com.apple.dt.Xcode.plist");
1621
+ return ["IDEProvisioningTeamByIdentifier", "IDEProvisioningTeams"].flatMap(
1622
+ (key) => {
1623
+ const result = spawnSync(
1624
+ "plutil",
1625
+ ["-extract", key, "json", "-o", "-", plist],
1626
+ {
1627
+ encoding: "utf8",
1628
+ timeout: 3e3
1629
+ }
1630
+ );
1631
+ if (result.status !== 0) return [];
1632
+ try {
1633
+ return teamsFromXcodeJson(JSON.parse(result.stdout));
1634
+ } catch {
1635
+ return [];
1636
+ }
1637
+ }
1638
+ );
1639
+ }
1640
+ function teamsFromKeychain() {
1641
+ const now = Date.now();
1642
+ return [
1643
+ "Apple Development",
1644
+ "Apple Distribution",
1645
+ "iPhone Developer"
1646
+ ].flatMap((prefix) => {
1647
+ const result = spawnSync(
1648
+ "security",
1649
+ ["find-certificate", "-a", "-p", "-c", prefix],
1650
+ {
1651
+ encoding: "utf8",
1652
+ timeout: 3e3
1653
+ }
1654
+ );
1655
+ if (result.status !== 0) return [];
1656
+ const pems = result.stdout.match(
1657
+ /-----BEGIN CERTIFICATE-----[\s\S]+?-----END CERTIFICATE-----/g
1658
+ ) ?? [];
1659
+ return pems.flatMap((pem) => {
1660
+ try {
1661
+ const cert = new X509Certificate(pem);
1662
+ if (Date.parse(cert.validTo) < now) return [];
1663
+ const team = teamFromCertificateSubject(cert.subject);
1664
+ return team ? [team] : [];
1665
+ } catch {
1666
+ return [];
1667
+ }
1668
+ });
1669
+ });
1670
+ }
1671
+ function detectAppleTeams() {
1672
+ if (process.platform !== "darwin") return [];
1673
+ const byId = /* @__PURE__ */ new Map();
1674
+ for (const team of [...teamsFromXcode(), ...teamsFromKeychain()]) {
1675
+ if (!byId.has(team.id)) byId.set(team.id, team);
1676
+ }
1677
+ return [...byId.values()];
1678
+ }
1679
+
1680
+ // src/banner.ts
1681
+ var LOGO = [
1682
+ " +++++",
1683
+ " +++-------+++",
1684
+ " +++----\xF7\xF7\xF7\xF7\xF7----++",
1685
+ " +++----\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xD7---+",
1686
+ " +++----\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7--+-++++",
1687
+ " ++----\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7+---\xD7-----++",
1688
+ " ++---\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7+---\u2248\u221E\u221E\u221E\u221E\u2248\u2260---+++",
1689
+ " ++----\xF7\xF7\xF7\xF7\xF7\xF7\xF7\u2260\u2248\u2260\u2260\u2260\u2260\u2260\u2248\xF7\xF7\xF7----\xD7\u221E\u221E\u221E\u221E\u221E\u221E\u221E\u221E\u221E\u2248=---+++",
1690
+ " ++---\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\u2248\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2248=-----=\u221E\u221E\u221E\u221E\u221E\u221E\u221E\u221E\u221E\u221E\u221E\u2248\xF7---++",
1691
+ " ++----\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2248\u2260\u2248\u2260----+=\u221E\u221E\u221E\u221E\u221E\u221E\u221E\u221E\u221E\u221E\u221E\u2248\u2260----++",
1692
+ " ++---\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\u2260\u2260\u2260\u2260\u2260\u2248\u2248\u2260\u2260\u2248\u2260\u2248\u2260----+\u2260\u221E\u221E\u221E\u221E\u221E\u221E\u221E\u221E\u221E\u221E\u221E\u221E\u2248\u2260----++",
1693
+ " +++---\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xD7\xF7--\u2260\u2260\u2260\u2260\u2260\u2260\u2248\u2260\u2260\u2260\u2260\u2248\u2260\xF7----\u2260\u221E\u221E\u221E\u221E\u221E\u221E\u221E\u221E\u221E\u221E\u221E\u2248\u2260\u2260\u2260----++",
1694
+ " ++---\xD7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7-+--+\xD7\u2260\u2260\u2260\u2260\u2260\u2260\u2248\u2260\u2248\u2260\u2248\u2248\u2260=----\u2260\u221E\u221E\u221E\u221E\u221E\u221E\u221E\u221E\u221E\u2248\u2260\u2260\u2260\u2260\u2260\xF7---++",
1695
+ " ++---\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7-+------+=\u2260\u2260\u2260\u2248\u2260\u2248\u2248\u2248\u2260\u2248\u2248\u2248\u2260\u2260----\u2260\u221E\u221E\u221E\u221E\u221E\u221E\u2248\u2248\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2260----++",
1696
+ " +++---\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7-+-----------\u2260\u2260\u2248\u2260\u2248\u2260\u2248\u2248\u2248\u2248\u2248\u2248\u2248\u2248=---\xD7\u2248\u221E\u221E\u221E\u2248\u2260\u2260\u2260\u2260\u2260\u2260\u2260=====\xF7---+",
1697
+ " ++----\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xD7+-------------+\u2260\u2260\u2248\u2248\u2248\u2248\u2248\u2248\u2248\u2260\u2248\u2248\u2248\u2248\u2248\xF7---\xF7\u2260\u2248\u2260\u2260\u2260\u2260\u2260\u2260=====\xF7\xF7\xF7\xF7\xD7--+",
1698
+ " ++---\xD7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7-+-----------------\u2260\u2248\u2248\u2248\u2248\u2260\u2260\u2248\u2260\u2260\u2260\u2260\u2260\u2260\u2248\xF7----=\u2260\u2260\u2260\u2260\u2260====\xF7\xF7\xF7\xF7\xF7\xF7=--+",
1699
+ " ++---\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7-+-----------------+\u2248\u2260\u2260\u2260\u2248\u2260\u2248\u2260\u2260\u2260\u2260\u2260\u2260\u2248\u2260\u2260+---\u2260\xF7\xD7\u2260\u2260=====\xF7\xF7\xF7\xF7\xF7\xF7=+-++",
1700
+ " +----\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7-+------------------\xD7\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2248\u2248\u2248\xF7+--\xF7=\xF7\xF7\xF7\xD7====\xF7\xF7\xF7\xF7\xF7\xF7=+--++",
1701
+ " ++--\xD7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7-+-------------------\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2248\u2260+---\u2260\u2260\u2260\u2260\u2260\xF7\xF7\xD7\xF7=\xF7\xF7\xF7\xF7\xF7=+--++",
1702
+ " +---\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xD7+------------------+\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2248\u2248\xD7---=\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2260\xF7\xF7=\xF7\xF7\xF7\xF7+--++",
1703
+ "++--\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7=\xF7+-------------------=\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2248\u2260+---\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2260=\xF7\xF7\xF7\xD7+--++",
1704
+ "+---\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7=======-------------------\xF7\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2248+---\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2260\xF7=-+--+",
1705
+ " +--\xD7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7====\xD7----------------\xD7\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2248----\xF7\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2260---++",
1706
+ " +--+\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7===\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2260========\xF7\u2260\u2260\u2260\u2260\u2260======\u2260==\u2260\u2260\u2248\xF7+---\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2260\xF7+--++",
1707
+ " ++----\xD7\xF7\xF7\xF7\xF7\xF7\xF7====\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2248\u2248\u2248\u2248\u2260\u2260\u2260\u2260\u2260\u2260\u2248\u2260\u2260\u2260===\u2260=\u2260\u2260\u2260\u2260\u2260\u2260\u2248\u2248-+---\u2260\u2248\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2260\xD7+--++",
1708
+ " +++-----++---\xD7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xD7--++---+--\xF7\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2260\xF7-+--++",
1709
+ " ++++++++++---------------------------+++++++++ ++------------+++",
1710
+ " +++++++++"
1711
+ ];
1712
+ var LOGO_SMALL = [
1713
+ " +++++",
1714
+ " ++---\xF7\xF7\xF7--++",
1715
+ " ++++--\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7--++++",
1716
+ " +---\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7+------+",
1717
+ " ++--\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7---\u2248\u221E\u221E\u221E\u2260--++++",
1718
+ " ++--\xF7\xF7\xF7\xF7\xF7\xF7\u2260\u2260\u2260\u2260\u2260\u2260\u2248---\xD7\u221E\u221E\u221E\u221E\u221E\u221E\u221E\u221E\xF7--+",
1719
+ " ++---\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2248\u2260---=\u221E\u221E\u221E\u221E\u221E\u221E\u221E\u2248\u221E--+-+",
1720
+ " ++--\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2248\xF7--\u221E\u221E\u221E\u221E\u221E\u221E\u221E\u221E\u2248\u2260\u2260---+",
1721
+ " ++--\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7----\u2260\u2260\u2260\u2260\u2248\u2248\u2260\u2248\u2260=--\u2260\u221E\u221E\u221E\u221E\u221E\u2248\u2260\u2260\u2260\u2260\u2260--++",
1722
+ " ++--\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7+-------\u2260\u2248\u2260\u2248\u2248\u2248\u2248\u2248\u2248=--\xD7\u221E\u221E\u221E\u2260\u2260\u2260\u2260\u2260===--+",
1723
+ " ++--\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7----------+\u2260\u2248\u2248\u2248\u2248\u2248\u2260\u2248\u2248\u2248\xF7--\u2260\u2260\u2260\u2260\u2260===\xF7\xF7\xF7\xD7-+",
1724
+ " ++--\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7+-----------+\u2260\u2260\u2248\u2260\u2260\u2260\u2260\u2260\u2260\u2260\xF7--\u2260\xD7\u2260\u2260===\xF7\xF7\xF7\xF7=-+",
1725
+ " +---\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7-------------\xD7\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2248\u2248--\u2260=\xF7\xF7\xD7==\xF7\xF7\xF7\xF7=+-+",
1726
+ " +--\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7+-------------\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2248\xD7--\u2260\u2260\u2260\u2260\u2260\xF7\xF7=\xF7\xF7\xF7-+++",
1727
+ "+--\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7=--------------\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2248+--\u2260\u2260\u2260\u2260\u2260\u2260\u2260\xF7\xF7\xD7+-+",
1728
+ "+--\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7===------------\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2248---\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2260--+-",
1729
+ " +-+\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7==\u2260\u2260\u2260\u2260\u2260\u2260=====\xF7\u2260\u2260\u2260====\u2260=\u2260\u2260\xF7--\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2260\u2260+-++",
1730
+ " +++----+--\xD7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xF7\xD7-+--+-\xF7\u2260\u2260\u2260\u2260\u2260\u2260---++",
1731
+ " +++++++------------------++++++++--------++",
1732
+ " +++++++"
1733
+ ];
1734
+ var width = (logo) => Math.max(...logo.map((line) => [...line].length));
1735
+ var LOGO_WIDTH = width(LOGO);
1736
+ var LOGO_SMALL_WIDTH = width(LOGO_SMALL);
1737
+ function logoLines(columns) {
1738
+ if (!columns) return null;
1739
+ if (columns >= LOGO_WIDTH) return LOGO;
1740
+ if (columns >= LOGO_SMALL_WIDTH) return LOGO_SMALL;
1741
+ return null;
1742
+ }
1743
+ function colorDepth(env) {
1744
+ if (env.NO_COLOR || env.FORCE_COLOR === "0" || env.TERM === "dumb")
1745
+ return "none";
1746
+ if (env.COLORTERM === "truecolor" || env.COLORTERM === "24bit")
1747
+ return "truecolor";
1748
+ return "256";
1749
+ }
1750
+ function hueToRgb(hue) {
1751
+ const h2 = (hue % 360 + 360) % 360 / 60;
1752
+ const s = 0.8;
1753
+ const x = s * (1 - Math.abs(h2 % 2 - 1));
1754
+ const [r2, g, b] = h2 < 1 ? [s, x, 0] : h2 < 2 ? [x, s, 0] : h2 < 3 ? [0, s, x] : h2 < 4 ? [0, x, s] : h2 < 5 ? [x, 0, s] : [s, 0, x];
1755
+ const m2 = 1 - s;
1756
+ return [r2, g, b].map((c3) => Math.round((c3 + m2) * 255));
1757
+ }
1758
+ function foreground(hue, depth) {
1759
+ const [r2, g, b] = hueToRgb(hue);
1760
+ if (depth === "truecolor") return `\x1B[38;2;${r2};${g};${b}m`;
1761
+ const level = (c3) => Math.round(c3 / 255 * 5);
1762
+ return `\x1B[38;5;${16 + 36 * level(r2) + 6 * level(g) + level(b)}m`;
1763
+ }
1764
+ var HUE_STEP = 10;
1765
+ function rainbow(lines, phase, depth) {
1766
+ return lines.map((line, y) => {
1767
+ let out = "";
1768
+ let current = "";
1769
+ [...line].forEach((char, x) => {
1770
+ if (char === " ") {
1771
+ out += char;
1772
+ return;
1773
+ }
1774
+ const hue = Math.round((x * 3 + y * 6 - phase) / HUE_STEP) * HUE_STEP;
1775
+ const code = foreground(hue, depth);
1776
+ if (code !== current) out += code;
1777
+ current = code;
1778
+ out += char;
1779
+ });
1780
+ return current ? `${out}\x1B[39m` : out;
1781
+ });
1782
+ }
1783
+ var FRAME_MS = 100;
1784
+ var DEGREES_PER_FRAME = 5;
1785
+ var ESC3 = "\x1B";
1786
+ function rowsMoved(chunk) {
1787
+ let rows = 0;
1788
+ for (let i2 = 0; i2 < chunk.length; i2++) {
1789
+ const c3 = chunk[i2];
1790
+ if (c3 === "\n") {
1791
+ rows++;
1792
+ continue;
1793
+ }
1794
+ if (c3 !== ESC3) continue;
1795
+ const next = chunk[i2 + 1];
1796
+ if (next === "8" || next === "M" || next === "c") return Number.NaN;
1797
+ if (next !== "[") continue;
1798
+ let j = i2 + 2;
1799
+ let params = "";
1800
+ while (j < chunk.length && /[0-9;?]/.test(chunk[j] ?? "")) {
1801
+ params += chunk[j];
1802
+ j++;
1803
+ }
1804
+ const n3 = Number.parseInt(params, 10) || 1;
1805
+ switch (chunk[j]) {
1806
+ case "A":
1807
+ case "F":
1808
+ rows -= n3;
1809
+ break;
1810
+ case "B":
1811
+ case "E":
1812
+ rows += n3;
1813
+ break;
1814
+ case "H":
1815
+ case "f":
1816
+ case "S":
1817
+ case "T":
1818
+ case "u":
1819
+ return Number.NaN;
1820
+ case "J":
1821
+ if (params === "2" || params === "3") return Number.NaN;
1822
+ break;
1823
+ }
1824
+ i2 = j;
1825
+ }
1826
+ return rows;
1827
+ }
1828
+ var every = (tick, ms) => {
1829
+ const timer = setInterval(tick, ms);
1830
+ timer.unref?.();
1831
+ return () => clearInterval(timer);
1832
+ };
1833
+ function showLogo(out, options = {}) {
1834
+ const idle = { stop() {
1835
+ } };
1836
+ const env = options.env ?? process.env;
1837
+ const lines = out.isTTY ? logoLines(out.columns) : null;
1838
+ if (!lines) return idle;
1839
+ const depth = colorDepth(env);
1840
+ if (depth === "none") {
1841
+ out.write(`
1842
+ ${lines.join("\n")}
1843
+
1844
+ `);
1845
+ return idle;
1846
+ }
1847
+ const frame = (n4) => rainbow(lines, n4 * DEGREES_PER_FRAME, depth);
1848
+ out.write(`
1849
+ ${frame(0).join("\n")}
1850
+
1851
+ `);
1852
+ if (env.CI || (out.rows ?? 0) <= lines.length + 2) return idle;
1853
+ let below = 2;
1854
+ let stopped = false;
1855
+ const watched = [out, options.alsoWatch].filter(
1856
+ (t2) => !!t2?.isTTY
1857
+ );
1858
+ const originals = watched.map((t2) => t2.write);
1859
+ const hooks = watched.map((t2, k) => {
1860
+ const original = originals[k];
1861
+ const hook = (chunk, ...rest) => {
1862
+ if (!stopped) {
1863
+ const moved = rowsMoved(
1864
+ typeof chunk === "string" ? chunk : Buffer.from(chunk).toString()
1865
+ );
1866
+ if (Number.isNaN(moved)) stop();
1867
+ else below += moved;
1868
+ }
1869
+ return original.call(
1870
+ t2,
1871
+ chunk,
1872
+ ...rest
1873
+ );
1874
+ };
1875
+ t2.write = hook;
1876
+ return hook;
1877
+ });
1878
+ const draw = originals[0];
1879
+ let n3 = 0;
1880
+ const tick = () => {
1881
+ if (stopped || below < 1 || below + lines.length > (out.rows ?? 0)) {
1882
+ stop();
1883
+ return;
1884
+ }
1885
+ n3 = (n3 + 1) % (360 / DEGREES_PER_FRAME);
1886
+ const rows = frame(n3);
1887
+ let chunk = `${ESC3}7${ESC3}[${below + lines.length - 1}A\r`;
1888
+ rows.forEach((row, k) => {
1889
+ chunk += k === 0 ? row : `${ESC3}[1B\r${row}`;
1890
+ });
1891
+ draw.call(out, `${chunk}${ESC3}8`);
1892
+ };
1893
+ const cancel2 = (options.schedule ?? every)(tick, FRAME_MS);
1894
+ const onResize = () => stop();
1895
+ out.on?.("resize", onResize);
1896
+ function stop() {
1897
+ if (stopped) return;
1898
+ stopped = true;
1899
+ cancel2();
1900
+ out.off?.("resize", onResize);
1901
+ watched.forEach((t2, k) => {
1902
+ if (t2.write === hooks[k]) t2.write = originals[k];
1903
+ });
1904
+ }
1905
+ return { stop };
1906
+ }
1907
+
1908
+ // src/keys.ts
1909
+ var SLOT_ORDER = ["siteId", "pk", "sk"];
1910
+ var SLOT_LABEL = {
1911
+ siteId: "Site ID",
1912
+ pk: "Publishable token",
1913
+ sk: "Secret key"
1914
+ };
1915
+ var SLOT_NAMES = {
1916
+ siteId: /^(?:[A-Z]+_)*BD_SITE_ID$|^bd\.siteId$/,
1917
+ pk: /^(?:[A-Z]+_)*BD_PK$|^BD_PUBLISHABLE_KEY$|^bd\.publishableKey$/,
1918
+ sk: /^BD_API_KEY$/
1919
+ };
1920
+ var ASSIGNMENT = /^([A-Za-z_][A-Za-z0-9_.]*)(\s*=\s*)(.*)$/;
1921
+ function slotFor(name) {
1922
+ return SLOT_ORDER.find((slot) => SLOT_NAMES[slot].test(name));
1923
+ }
1924
+ function slotsIn(envText) {
1925
+ const found = /* @__PURE__ */ new Set();
1926
+ for (const line of envText.split("\n")) {
1927
+ const match = ASSIGNMENT.exec(line);
1928
+ const slot = match?.[1] ? slotFor(match[1]) : void 0;
1929
+ if (slot) found.add(slot);
1930
+ }
1931
+ return SLOT_ORDER.filter((slot) => found.has(slot));
1932
+ }
1933
+ function slotLinesOnly(text2) {
1934
+ return text2.split("\n").filter((line) => {
1935
+ const name = ASSIGNMENT.exec(line)?.[1];
1936
+ return name !== void 0 && slotFor(name) !== void 0;
1937
+ }).join("\n");
1938
+ }
1939
+ function fillEnv(envText, keys) {
1940
+ const placed = /* @__PURE__ */ new Set();
1941
+ const lines = envText.split("\n").map((line) => {
1942
+ const match = ASSIGNMENT.exec(line);
1943
+ if (!match?.[1]) return line;
1944
+ const slot = slotFor(match[1]);
1945
+ const value = slot ? keys[slot] : void 0;
1946
+ if (!slot || !value) return line;
1947
+ placed.add(slot);
1948
+ const separator = /\s=/.test(match[2] ?? "") ? " = " : "=";
1949
+ return `${match[1]}${separator}${value}`;
1950
+ });
1951
+ return {
1952
+ text: lines.join("\n"),
1953
+ placed: SLOT_ORDER.filter((s) => placed.has(s))
1954
+ };
1955
+ }
1956
+ var UUID = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
1957
+ var TOKEN_BODY = /^[A-Za-z0-9_-]+$/;
1958
+ function keyProblem(slot, raw) {
1959
+ const value = raw.trim();
1960
+ switch (slot) {
1961
+ case "siteId":
1962
+ return UUID.test(value) ? void 0 : "A site ID is a UUID: Site Builder > Developer > Site ID.";
1963
+ case "pk":
1964
+ if (!value.startsWith("pk_")) {
1965
+ return "A publishable token starts with pk_ (Site Builder > Developer > Publishable tokens). Never put a secret key here.";
1966
+ }
1967
+ return TOKEN_BODY.test(value) ? void 0 : "That token has characters a key never has. Paste it again?";
1968
+ case "sk":
1969
+ if (value.startsWith("pk_")) {
1970
+ return "That's a publishable token. The secret key is under Site Builder > Developer > Secret keys.";
1971
+ }
1972
+ return TOKEN_BODY.test(value) ? void 0 : "That key has characters a key never has. Paste it again?";
1973
+ }
1974
+ }
1975
+
1976
+ // src/package-manager.ts
1977
+ import { existsSync } from "node:fs";
1978
+ import { dirname, join as join2 } from "node:path";
1979
+ var PACKAGE_MANAGERS = ["npm", "pnpm", "yarn", "bun"];
1980
+ function isPackageManager(value) {
1981
+ return PACKAGE_MANAGERS.some((pm) => pm === value);
1982
+ }
1983
+ function detectPackageManager(userAgent) {
1984
+ const name = userAgent?.split(" ")[0]?.split("/")[0];
1985
+ return isPackageManager(name) ? name : "npm";
1986
+ }
1987
+ function installCommand(pm, options = {}) {
1988
+ switch (pm) {
1989
+ case "npm":
1990
+ return ["npm", "install"];
1991
+ case "pnpm":
1992
+ return options.ignoreWorkspace ? ["pnpm", "install", "--ignore-workspace"] : ["pnpm", "install"];
1993
+ case "yarn":
1994
+ return ["yarn"];
1995
+ case "bun":
1996
+ return ["bun", "install"];
1997
+ }
1998
+ }
1999
+ function runCommand(pm, script) {
2000
+ switch (pm) {
2001
+ case "npm":
2002
+ return ["npm", "run", script];
2003
+ case "pnpm":
2004
+ return ["pnpm", script];
2005
+ case "yarn":
2006
+ return ["yarn", script];
2007
+ case "bun":
2008
+ return ["bun", "run", script];
2009
+ }
2010
+ }
2011
+ function enclosingPnpmWorkspace(projectDir) {
2012
+ let dir = dirname(projectDir);
2013
+ while (true) {
2014
+ if (existsSync(join2(dir, "pnpm-workspace.yaml"))) return dir;
2015
+ const parent = dirname(dir);
2016
+ if (parent === dir) return void 0;
2017
+ dir = parent;
2018
+ }
2019
+ }
2020
+
2021
+ // src/payments.ts
2022
+ import {
2023
+ readdirSync,
2024
+ readFileSync,
2025
+ rmdirSync,
2026
+ rmSync,
2027
+ writeFileSync
2028
+ } from "node:fs";
2029
+ import { join as join3 } from "node:path";
2030
+ var PAYMENT_FEATURES = ["store", "donations", "saas"];
2031
+ var PAYMENT_CHOICES = {
2032
+ store: {
2033
+ label: "Store",
2034
+ hint: "products, cart and checkout"
2035
+ },
2036
+ donations: {
2037
+ label: "Donations",
2038
+ hint: "one-time and monthly gifts"
2039
+ },
2040
+ saas: {
2041
+ label: "SaaS",
2042
+ hint: "subscription plans and billing in the customer's account"
2043
+ }
2044
+ };
2045
+ function isPaymentFeature(value) {
2046
+ return PAYMENT_FEATURES.includes(value);
2047
+ }
2048
+ function parsePayments(value) {
2049
+ const names = value.split(",").map((name) => name.trim().toLowerCase()).filter(Boolean);
2050
+ const valid = `${PAYMENT_FEATURES.join(", ")}, or none`;
2051
+ if (names.length === 0) return { error: `--payments takes ${valid}.` };
2052
+ if (names.includes("none")) {
2053
+ return names.length === 1 ? { features: [] } : { error: "--payments none can't be combined with anything else." };
2054
+ }
2055
+ const unknown = names.filter((name) => !isPaymentFeature(name));
2056
+ if (unknown.length > 0) {
2057
+ return {
2058
+ error: `--payments: ${unknown.join(", ")} isn't one of ${valid}.`
2059
+ };
2060
+ }
2061
+ return {
2062
+ features: PAYMENT_FEATURES.filter((feature) => names.includes(feature))
2063
+ };
2064
+ }
2065
+ var FILE_MARKER = /\[bd-file:([a-z!,]+)\]/;
2066
+ var START_MARKER = /\[bd:([a-z!,]+)\]/;
2067
+ var END_MARKER = /\[\/bd:([a-z!,]+)\]/;
2068
+ var LINE_MARKER = /\s*(?:<!--|\/\/|#|\{\/\*|\/\*)\s*\[bd-line:([a-z!,]+)\]\s*(?:-->|\*\/\}|\*\/)?\s*$/;
2069
+ var FILE_MARKER_LINES = 5;
2070
+ function holds(condition, chosen) {
2071
+ return condition.split(",").some((token) => {
2072
+ if (token === "none") return chosen.size === 0;
2073
+ const negated = token.startsWith("!");
2074
+ const name = negated ? token.slice(1) : token;
2075
+ if (!isPaymentFeature(name)) {
2076
+ throw new Error(`Unknown payment feature "${name}" in a [bd:\u2026] marker.`);
2077
+ }
2078
+ return chosen.has(name) !== negated;
2079
+ });
2080
+ }
2081
+ var MarkerError = class extends Error {
2082
+ };
2083
+ function pruneText(text2, chosen, file = "a file") {
2084
+ if (!text2.includes("bd:") && !text2.includes("bd-line:")) return null;
2085
+ const lines = text2.split("\n");
2086
+ const out = [];
2087
+ const open = [];
2088
+ let touched = false;
2089
+ let dropped = false;
2090
+ lines.forEach((line, index) => {
2091
+ const end = END_MARKER.exec(line);
2092
+ if (end) {
2093
+ const top = open.pop();
2094
+ if (!top || top.condition !== end[1]) {
2095
+ throw new MarkerError(
2096
+ `${file}:${index + 1}: [/bd:${end[1]}] closes ${top ? `[bd:${top.condition}] from line ${top.line}` : "nothing"}.`
2097
+ );
2098
+ }
2099
+ touched = true;
2100
+ dropped = !top.keep;
2101
+ return;
2102
+ }
2103
+ const start = START_MARKER.exec(line);
2104
+ if (start?.[1] && !FILE_MARKER.test(line)) {
2105
+ const parentKeeps = open.every((region) => region.keep);
2106
+ open.push({
2107
+ condition: start[1],
2108
+ keep: parentKeeps && holds(start[1], chosen),
2109
+ line: index + 1
2110
+ });
2111
+ touched = true;
2112
+ return;
2113
+ }
2114
+ if (!open.every((region) => region.keep)) return;
2115
+ const single = LINE_MARKER.exec(line);
2116
+ if (single?.[1]) {
2117
+ touched = true;
2118
+ if (!holds(single[1], chosen)) {
2119
+ dropped = true;
2120
+ return;
2121
+ }
2122
+ line = line.slice(0, single.index);
2123
+ }
2124
+ if (dropped && line.trim() === "" && out.at(-1)?.trim() === "") return;
2125
+ dropped = false;
2126
+ out.push(line);
2127
+ });
2128
+ const unclosed = open.at(-1);
2129
+ if (unclosed) {
2130
+ throw new MarkerError(
2131
+ `${file}:${unclosed.line}: [bd:${unclosed.condition}] is never closed.`
2132
+ );
2133
+ }
2134
+ return touched ? out.join("\n") : null;
2135
+ }
2136
+ function fileCondition(text2) {
2137
+ const head = text2.split("\n", FILE_MARKER_LINES).join("\n");
2138
+ return FILE_MARKER.exec(head)?.[1];
2139
+ }
2140
+ function isText(buffer) {
2141
+ return !buffer.subarray(0, 8e3).includes(0);
2142
+ }
2143
+ function prunePayments(root, chosen) {
2144
+ const result = { removed: [], edited: [] };
2145
+ const walk = (dir, prefix) => {
2146
+ let empty = true;
2147
+ for (const entry of readdirSync(dir, { withFileTypes: true })) {
2148
+ const path = join3(dir, entry.name);
2149
+ const relativePath = prefix ? `${prefix}/${entry.name}` : entry.name;
2150
+ if (entry.isSymbolicLink()) {
2151
+ empty = false;
2152
+ continue;
2153
+ }
2154
+ if (entry.isDirectory()) {
2155
+ if (entry.name === ".git" || entry.name === "node_modules") {
2156
+ empty = false;
2157
+ continue;
2158
+ }
2159
+ if (walk(path, relativePath)) rmdirSync(path);
2160
+ else empty = false;
2161
+ continue;
2162
+ }
2163
+ const buffer = readFileSync(path);
2164
+ if (!isText(buffer)) {
2165
+ empty = false;
2166
+ continue;
2167
+ }
2168
+ const text2 = buffer.toString("utf8");
2169
+ const condition = fileCondition(text2);
2170
+ if (condition !== void 0 && !holds(condition, chosen)) {
2171
+ rmSync(path);
2172
+ result.removed.push(relativePath);
2173
+ continue;
2174
+ }
2175
+ empty = false;
2176
+ let next = text2;
2177
+ if (condition !== void 0) {
2178
+ next = next.split("\n").filter(
2179
+ (line, index) => index >= FILE_MARKER_LINES || !FILE_MARKER.test(line)
2180
+ ).join("\n");
2181
+ }
2182
+ next = pruneText(next, chosen, relativePath) ?? next;
2183
+ if (next !== text2) {
2184
+ writeFileSync(path, next);
2185
+ result.edited.push(relativePath);
2186
+ }
2187
+ }
2188
+ return empty;
2189
+ };
2190
+ walk(root, "");
2191
+ return result;
2192
+ }
2193
+ var APPLE_RULES = "https://developer.apple.com/app-store/review/guidelines/#payments";
2194
+ var GOOGLE_RULES = "https://support.google.com/googleplay/android-developer/answer/9858738";
2195
+ var GOOGLE_FEES = "https://support.google.com/googleplay/android-developer/answer/16954621";
2196
+ function appStoreTitle(stores) {
2197
+ const names = [
2198
+ stores.has("apple") ? "the App Store" : void 0,
2199
+ stores.has("google") ? "Google Play" : void 0
2200
+ ].filter(Boolean);
2201
+ return `Selling in ${names.join(" and ")}`;
2202
+ }
2203
+ function appStoreNotice(features, stores) {
2204
+ if (features.length === 0 || stores.size === 0) return [];
2205
+ const apple = stores.has("apple");
2206
+ const google = stores.has("google");
2207
+ const lines = [];
2208
+ if (features.includes("store")) {
2209
+ lines.push(
2210
+ "Store: physical goods and services used outside the app (shipping, bookings, food) can be paid with Stripe inside the app. Digital goods can't: the stores require their own billing for those."
2211
+ );
2212
+ }
2213
+ if (features.includes("saas")) {
2214
+ const cuts = [
2215
+ apple ? "Apple keeps 30%, or 15% in its Small Business Program (under $1M a year) and after a subscriber's first year" : void 0,
2216
+ google ? "Google keeps 15% (in the US, UK and EEA: a 10% service fee plus a 5% billing fee)" : void 0
2217
+ ].filter(Boolean);
2218
+ lines.push(
2219
+ `SaaS plans: subscriptions to digital features or content have to be sold through ${[apple ? "Apple's In-App Purchase" : void 0, google ? "Google Play Billing" : void 0].filter(Boolean).join(" and ")}, so the app's plans use ${apple && google ? "them" : "it"}. ${cuts.join(". ")}.`
2220
+ );
2221
+ }
2222
+ if (features.includes("donations")) {
2223
+ if (apple) {
2224
+ lines.push(
2225
+ "Donations on iPhone: only nonprofits Apple has approved may take donations inside the app, and they must offer Apple Pay. Anyone else collects on the web, outside the app."
2226
+ );
2227
+ }
2228
+ if (google) {
2229
+ lines.push(
2230
+ "Donations on Android: gifts to a tax-exempt organization must not go through Google Play Billing, and Google asks for proof of tax-exempt status first. Anyone else uses Play Billing or leaves donations out."
2231
+ );
2232
+ }
2233
+ }
2234
+ const links = [
2235
+ apple ? `Apple: ${APPLE_RULES}` : void 0,
2236
+ google ? `Google: ${GOOGLE_RULES} (fees: ${GOOGLE_FEES})` : void 0
2237
+ ].filter(Boolean);
2238
+ lines.push(
2239
+ `Rules as of November 2026. Check them before you ship: ${links.join(" ")}`
2240
+ );
2241
+ return lines;
2242
+ }
2243
+
2244
+ // src/templates.ts
2245
+ var import_picocolors = __toESM(require_picocolors(), 1);
2246
+ var envAt = (file) => ({ example: ".env.example", file });
2247
+ var FRAMEWORKS = [
2248
+ // ── Web ────────────────────────────────────────────────────────────
2249
+ {
2250
+ name: "vanilla",
2251
+ display: "Vanilla JS",
2252
+ color: import_picocolors.default.yellow,
2253
+ shape: "web",
2254
+ hint: "no framework, Bun server",
2255
+ variants: [
2256
+ {
2257
+ id: "vanilla",
2258
+ display: "Vanilla JS",
2259
+ aliases: ["vanilla-js", "js"],
2260
+ source: "Vanilla-JS",
2261
+ env: envAt(".env.local"),
2262
+ dev: "dev",
2263
+ needsBun: true
2264
+ }
2265
+ ]
2266
+ },
2267
+ {
2268
+ name: "react",
2269
+ display: "React",
2270
+ color: import_picocolors.default.cyan,
2271
+ shape: "web",
2272
+ hint: "Vite, Bun API server",
2273
+ variants: [
2274
+ {
2275
+ id: "react-bun",
2276
+ display: "React + Bun",
2277
+ aliases: ["react"],
2278
+ source: "React-Bun",
2279
+ env: envAt(".env.local"),
2280
+ dev: "dev",
2281
+ needsBun: true
2282
+ }
2283
+ ]
2284
+ },
2285
+ {
2286
+ name: "remix",
2287
+ display: "Remix",
2288
+ color: import_picocolors.default.blue,
2289
+ shape: "web",
2290
+ hint: "React Router 7",
2291
+ variants: [
2292
+ {
2293
+ id: "remix",
2294
+ display: "Remix",
2295
+ aliases: ["react-router"],
2296
+ source: "Remix",
2297
+ env: envAt(".env.local"),
2298
+ dev: "dev"
2299
+ }
2300
+ ]
2301
+ },
2302
+ {
2303
+ name: "t3",
2304
+ display: "T3-App",
2305
+ color: import_picocolors.default.magenta,
2306
+ shape: "web",
2307
+ hint: "Next.js, tRPC, Drizzle",
2308
+ variants: [
2309
+ {
2310
+ id: "t3",
2311
+ display: "T3-App",
2312
+ aliases: ["t3-app"],
2313
+ source: "T3-App",
2314
+ env: envAt(".env"),
2315
+ dev: "dev"
2316
+ }
2317
+ ]
2318
+ },
2319
+ {
2320
+ name: "nuxt",
2321
+ display: "Nuxt",
2322
+ color: import_picocolors.default.green,
2323
+ shape: "web",
2324
+ hint: "Vue",
2325
+ variants: [
2326
+ {
2327
+ id: "nuxt",
2328
+ display: "Nuxt",
2329
+ aliases: ["vue"],
2330
+ source: "Nuxt",
2331
+ env: envAt(".env"),
2332
+ dev: "dev"
2333
+ }
2334
+ ]
2335
+ },
2336
+ {
2337
+ name: "svelte",
2338
+ display: "SvelteKit",
2339
+ color: import_picocolors.default.red,
2340
+ shape: "web",
2341
+ variants: [
2342
+ {
2343
+ id: "svelte",
2344
+ display: "SvelteKit",
2345
+ aliases: ["sveltekit"],
2346
+ source: "Svelte",
2347
+ env: envAt(".env"),
2348
+ dev: "dev"
2349
+ }
2350
+ ]
2351
+ },
2352
+ {
2353
+ name: "solid",
2354
+ display: "Solid",
2355
+ color: import_picocolors.default.blueBright,
2356
+ shape: "web",
2357
+ hint: "TanStack Start",
2358
+ variants: [
2359
+ {
2360
+ id: "solid",
2361
+ display: "Solid 2",
2362
+ hint: "TanStack Start 2.0 release candidate",
2363
+ aliases: ["tanstack-start", "tanstack-start-solid", "solid-2"],
2364
+ source: "Tanstack-Start-Solid/solid",
2365
+ env: envAt(".env.local"),
2366
+ dev: "dev"
2367
+ },
2368
+ {
2369
+ id: "solid-1",
2370
+ display: "Solid 1.9",
2371
+ hint: "TanStack Start 1.x, keeps the Form and Store demos",
2372
+ source: "Tanstack-Start-Solid/solid-1",
2373
+ env: envAt(".env.local"),
2374
+ dev: "dev"
2375
+ }
2376
+ ]
2377
+ },
2378
+ {
2379
+ name: "angular",
2380
+ display: "Angular",
2381
+ color: import_picocolors.default.redBright,
2382
+ shape: "web",
2383
+ hint: "SSR",
2384
+ variants: [
2385
+ {
2386
+ id: "angular",
2387
+ display: "Angular",
2388
+ source: "Angular/Angular",
2389
+ env: envAt(".env"),
2390
+ dev: "start",
2391
+ notes: [
2392
+ "Angular takes the publishable token in src/environments/environment.ts (bdPk), not in .env."
2393
+ ]
2394
+ }
2395
+ ]
2396
+ },
2397
+ {
2398
+ name: "qwik",
2399
+ display: "Qwik",
2400
+ color: import_picocolors.default.magentaBright,
2401
+ shape: "web",
2402
+ variants: [
2403
+ {
2404
+ id: "qwik",
2405
+ display: "Qwik",
2406
+ source: "Qwik",
2407
+ env: envAt(".env.local"),
2408
+ dev: "dev"
2409
+ }
2410
+ ]
2411
+ },
2412
+ {
2413
+ name: "astro",
2414
+ display: "Astro",
2415
+ color: import_picocolors.default.yellowBright,
2416
+ shape: "web",
2417
+ variants: [
2418
+ {
2419
+ id: "astro",
2420
+ display: "Astro",
2421
+ source: "Astro",
2422
+ env: envAt(".env"),
2423
+ dev: "dev"
2424
+ }
2425
+ ]
2426
+ },
2427
+ {
2428
+ name: "htmx",
2429
+ display: "HTMX",
2430
+ color: import_picocolors.default.cyanBright,
2431
+ shape: "web",
2432
+ hint: "server-rendered, Bun",
2433
+ variants: [
2434
+ {
2435
+ id: "htmx",
2436
+ display: "HTMX",
2437
+ source: "HTMX",
2438
+ env: envAt(".env.local"),
2439
+ dev: "dev",
2440
+ needsBun: true
2441
+ }
2442
+ ]
2443
+ },
2444
+ // ── Server ─────────────────────────────────────────────────────────
2445
+ {
2446
+ name: "laravel",
2447
+ display: "Laravel",
2448
+ color: import_picocolors.default.red,
2449
+ shape: "server",
2450
+ hint: "PHP",
2451
+ variants: [
2452
+ {
2453
+ id: "laravel",
2454
+ display: "Laravel",
2455
+ aliases: ["php"],
2456
+ source: "Laravel",
2457
+ env: envAt(".env"),
2458
+ steps: () => [
2459
+ "composer install",
2460
+ "php artisan key:generate",
2461
+ "php artisan serve"
2462
+ ]
2463
+ }
2464
+ ]
2465
+ },
2466
+ {
2467
+ name: "phoenix",
2468
+ display: "Phoenix",
2469
+ color: import_picocolors.default.yellow,
2470
+ shape: "server",
2471
+ hint: "Elixir",
2472
+ variants: [
2473
+ {
2474
+ id: "elixir",
2475
+ display: "Phoenix",
2476
+ aliases: ["phoenix"],
2477
+ source: "Phoenix",
2478
+ env: envAt(".env"),
2479
+ // config/runtime.exs loads .env (then .env.local) in dev itself.
2480
+ steps: () => ["mix deps.get", "mix phx.server"]
2481
+ }
2482
+ ]
2483
+ },
2484
+ {
2485
+ name: "vapor",
2486
+ display: "Vapor",
2487
+ color: import_picocolors.default.green,
2488
+ shape: "server",
2489
+ hint: "Swift on the server",
2490
+ variants: [
2491
+ {
2492
+ id: "vapor",
2493
+ display: "Vapor",
2494
+ aliases: ["vapor-server"],
2495
+ source: "Vapor-Server",
2496
+ env: envAt(".env"),
2497
+ steps: () => ["swift run App serve --port 8080"]
2498
+ }
2499
+ ]
2500
+ },
2501
+ // ── Mobile: publishable token only ─────────────────────────────────
2502
+ {
2503
+ name: "react-native",
2504
+ display: "React Native",
2505
+ color: import_picocolors.default.cyan,
2506
+ shape: "mobile",
2507
+ hint: "Expo",
2508
+ variants: [
2509
+ {
2510
+ id: "react-native",
2511
+ display: "React Native",
2512
+ aliases: ["expo"],
2513
+ source: "React-Native",
2514
+ folder: "mobile",
2515
+ appleTeam: "app.json",
2516
+ stores: ["apple", "google"],
2517
+ env: envAt(".env"),
2518
+ dev: "start"
2519
+ }
2520
+ ]
2521
+ },
2522
+ {
2523
+ name: "swift",
2524
+ display: "Swift",
2525
+ color: import_picocolors.default.redBright,
2526
+ shape: "mobile",
2527
+ hint: "iOS and macOS, SwiftUI",
2528
+ variants: [
2529
+ {
2530
+ id: "swift",
2531
+ display: "Swift",
2532
+ aliases: ["ios", "swiftui"],
2533
+ source: "Swift",
2534
+ folder: "ios",
2535
+ appleTeam: "xcconfig",
2536
+ stores: ["apple"],
2537
+ // The starter's own comment asks for exactly this: real values in a
2538
+ // gitignored BdStarter.local.xcconfig that BdStarter.xcconfig includes.
2539
+ env: {
2540
+ example: "BdStarter.xcconfig",
2541
+ file: "BdStarter.local.xcconfig",
2542
+ format: "xcconfig"
2543
+ },
2544
+ steps: () => [
2545
+ "swift build",
2546
+ "# In Xcode: File > Add Package Dependencies > Add Local, pick this folder"
2547
+ ],
2548
+ notes: [
2549
+ "In your app target, set the configuration to BdStarter.xcconfig (Project > Info > Configurations) and add BDHost, BDPublishableKey and BDSiteID to Info.plist as $(BD_HOST), $(BD_PUBLISHABLE_KEY) and $(BD_SITE_ID). README > Setup has the table."
2550
+ ]
2551
+ }
2552
+ ]
2553
+ },
2554
+ {
2555
+ name: "kotlin",
2556
+ display: "Kotlin",
2557
+ color: import_picocolors.default.magenta,
2558
+ shape: "mobile",
2559
+ hint: "Android, Jetpack Compose",
2560
+ variants: [
2561
+ {
2562
+ id: "kotlin",
2563
+ display: "Kotlin",
2564
+ aliases: ["android"],
2565
+ source: "Kotlin",
2566
+ folder: "android",
2567
+ stores: ["google"],
2568
+ env: { example: "local.properties.example", file: "local.properties" },
2569
+ steps: () => [
2570
+ "./gradlew :app:installDebug # with an emulator or device attached",
2571
+ "# or open this folder in Android Studio and run the app configuration"
2572
+ ]
2573
+ }
2574
+ ]
2575
+ },
2576
+ {
2577
+ name: "flutter",
2578
+ display: "Flutter",
2579
+ color: import_picocolors.default.blue,
2580
+ shape: "mobile",
2581
+ hint: "iOS and Android",
2582
+ variants: [
2583
+ {
2584
+ id: "flutter",
2585
+ display: "Flutter",
2586
+ aliases: ["dart"],
2587
+ source: "Flutter",
2588
+ folder: "mobile",
2589
+ stores: ["apple", "google"],
2590
+ // Dart-defines are compiled in; there is no env file to write.
2591
+ keys: ["siteId", "pk"],
2592
+ notes: [
2593
+ "flutter create signs the iOS app with your own certificate: it reads your keychain, asks if you have more than one, and writes your Apple team into the Xcode project."
2594
+ ],
2595
+ steps: ({ keys }) => [
2596
+ "flutter create --platforms=ios,android .",
2597
+ "flutter pub get",
2598
+ `flutter run --dart-define=BD_SITE_ID=${keys.siteId ?? "<site id>"} --dart-define=BD_PK=${keys.pk ?? "pk_\u2026"}`
2599
+ ]
2600
+ }
2601
+ ]
2602
+ }
2603
+ ];
2604
+ var TEMPLATES = FRAMEWORKS.flatMap((f) => f.variants);
2605
+ function findTemplate(name) {
2606
+ const wanted = name.trim().toLowerCase();
2607
+ return TEMPLATES.find(
2608
+ (t2) => t2.id === wanted || (t2.aliases ?? []).includes(wanted)
2609
+ );
2610
+ }
2611
+ function frameworkOf(template) {
2612
+ const framework = FRAMEWORKS.find((f) => f.variants.includes(template));
2613
+ if (!framework) throw new Error(`No framework lists ${template.id}`);
2614
+ return framework;
2615
+ }
2616
+ function templateById(id) {
2617
+ const template = TEMPLATES.find((t2) => t2.id === id);
2618
+ if (!template) throw new Error(`No template has the id ${id}`);
2619
+ return template;
2620
+ }
2621
+ function defaultFolder(template) {
2622
+ return template.folder ?? frameworkOf(template).shape;
2623
+ }
2624
+
2625
+ // src/plan.ts
2626
+ function templateNames(raw) {
2627
+ if (raw === void 0) return [];
2628
+ return [raw].flat().flatMap((value) => String(value).split(",")).map((name) => name.trim()).filter(Boolean);
2629
+ }
2630
+ function uniqueTemplates(templates) {
2631
+ return templates.filter((t2, i2) => templates.indexOf(t2) === i2);
2632
+ }
2633
+ function planApps(templates) {
2634
+ const [only] = templates;
2635
+ if (only && templates.length === 1) return [{ template: only, folder: "" }];
2636
+ const wanted = templates.map(defaultFolder);
2637
+ return templates.map((template, i2) => {
2638
+ const folder = wanted[i2] ?? template.id;
2639
+ const taken = wanted.filter((f) => f === folder).length > 1;
2640
+ return { template, folder: taken ? template.id : folder };
2641
+ });
2642
+ }
2643
+ function rootReadme(name, apps, keysUrl) {
2644
+ const rows = apps.map(
2645
+ ({ template, folder }) => `| [\`${folder}/\`](./${folder}/README.md) | ${template.display} |`
2646
+ );
2647
+ const hasMobile = apps.some(
2648
+ ({ template }) => frameworkOf(template).shape === "mobile"
2649
+ );
2650
+ const sections = apps.map(
2651
+ ({ template, folder, steps }) => `### ${folder}: ${template.display}
2652
+
2653
+ \`\`\`sh
2654
+ ${steps.join("\n")}
2655
+ \`\`\``
2656
+ );
2657
+ return [
2658
+ `# ${name}`,
2659
+ "",
2660
+ "Created with [create-businessdash](https://www.npmjs.com/package/create-businessdash). Each folder is a complete BusinessDash starter that runs on its own, with its own dependencies and its own README.",
2661
+ "",
2662
+ "| Folder | Starter |",
2663
+ "| --- | --- |",
2664
+ ...rows,
2665
+ "",
2666
+ `They all read the same site. Your keys are in the dashboard under Settings > Web Content SDK: ${keysUrl}`,
2667
+ ...hasMobile ? [
2668
+ "",
2669
+ "The mobile apps take the publishable token only. The secret key stays in the web and server apps, never in an app binary."
2670
+ ] : [],
2671
+ "",
2672
+ "## Running each app",
2673
+ "",
2674
+ sections.join("\n\n"),
2675
+ ""
2676
+ ].join("\n");
2677
+ }
2678
+
2679
+ // src/scaffold.ts
2680
+ import {
2681
+ appendFileSync,
2682
+ chmodSync,
2683
+ copyFileSync,
2684
+ existsSync as existsSync2,
2685
+ mkdirSync,
2686
+ readdirSync as readdirSync2,
2687
+ readFileSync as readFileSync2,
2688
+ rmSync as rmSync2,
2689
+ statSync,
2690
+ writeFileSync as writeFileSync2
2691
+ } from "node:fs";
2692
+ import { join as join4 } from "node:path";
2693
+ var STORED_NAMES = {
2694
+ ".gitignore": "_gitignore",
2695
+ ".npmrc": "_npmrc"
2696
+ };
2697
+ var RESTORED_NAMES = Object.fromEntries(
2698
+ Object.entries(STORED_NAMES).map(([real, stored]) => [stored, real])
2699
+ );
2700
+ var DEFAULT_PROJECT_NAME = "businessdash-app";
2701
+ function formatTargetDir(dir) {
2702
+ return dir.trim().replace(/[/\\]+$/, "");
2703
+ }
2704
+ function isEmptyDir(path) {
2705
+ if (!existsSync2(path)) return true;
2706
+ const files = readdirSync2(path);
2707
+ return files.length === 0 || files.length === 1 && files[0] === ".git";
2708
+ }
2709
+ function emptyDir(dir) {
2710
+ if (!existsSync2(dir)) return;
2711
+ for (const name of readdirSync2(dir)) {
2712
+ if (name === ".git" || name.endsWith(".DSBookmark")) continue;
2713
+ rmSync2(join4(dir, name), { recursive: true, force: true });
2714
+ }
2715
+ }
2716
+ function isValidPackageName(name) {
2717
+ return /^(?:@[a-z\d\-*~][a-z\d\-*._~]*\/)?[a-z\d\-~][a-z\d\-._~]*$/.test(
2718
+ name
2719
+ );
2720
+ }
2721
+ function toValidPackageName(name) {
2722
+ return name.trim().toLowerCase().replace(/\s+/g, "-").replace(/^[._]+/, "").replace(/[^a-z\d\-~]+/g, "-");
2723
+ }
2724
+ function templateSlots(templatesDir, template) {
2725
+ if (!template.env) return template.keys ?? [];
2726
+ const example = join4(templatesDir, template.id, template.env.example);
2727
+ return existsSync2(example) ? slotsIn(readFileSync2(example, "utf8")) : [];
2728
+ }
2729
+ function copyTree(from, to, skip, prefix = "") {
2730
+ mkdirSync(to, { recursive: true });
2731
+ for (const entry of readdirSync2(from, { withFileTypes: true })) {
2732
+ const source = join4(from, entry.name);
2733
+ const name = RESTORED_NAMES[entry.name] ?? entry.name;
2734
+ const relativePath = prefix ? `${prefix}/${name}` : name;
2735
+ const target = join4(to, name);
2736
+ if (entry.isDirectory()) {
2737
+ copyTree(source, target, skip, relativePath);
2738
+ } else if (!skip(relativePath)) {
2739
+ copyFileSync(source, target);
2740
+ chmodSync(target, statSync(source).mode & 511);
2741
+ }
2742
+ }
2743
+ }
2744
+ function isRecord(value) {
2745
+ return typeof value === "object" && value !== null && !Array.isArray(value);
2746
+ }
2747
+ function rewriteJson(path, edit) {
2748
+ const text2 = readFileSync2(path, "utf8");
2749
+ const parsed = JSON.parse(text2);
2750
+ if (!isRecord(parsed)) throw new Error(`${path} is not a JSON object`);
2751
+ edit(parsed);
2752
+ const indent = /^([ \t]+)"/m.exec(text2)?.[1] ?? " ";
2753
+ writeFileSync2(path, `${JSON.stringify(parsed, null, indent)}
2754
+ `);
2755
+ }
2756
+ function rewritePackageJson(path, name, pm) {
2757
+ if (!existsSync2(path)) return;
2758
+ rewriteJson(path, (pkg) => {
2759
+ pkg.name = name;
2760
+ const pinned = pkg.packageManager;
2761
+ if (typeof pinned === "string" && !pinned.startsWith(`${pm}@`)) {
2762
+ delete pkg.packageManager;
2763
+ }
2764
+ });
2765
+ }
2766
+ function writeAppleTeam(root, template, team, env) {
2767
+ if (template.appleTeam === "xcconfig") {
2768
+ if (!env?.written) return void 0;
2769
+ appendFileSync(join4(root, env.file), `DEVELOPMENT_TEAM = ${team}
2770
+ `);
2771
+ return env.file;
2772
+ }
2773
+ if (template.appleTeam === "app.json") {
2774
+ const path = join4(root, "app.json");
2775
+ if (!existsSync2(path)) return void 0;
2776
+ rewriteJson(path, (json) => {
2777
+ const expo = isRecord(json.expo) ? json.expo : {};
2778
+ const ios = isRecord(expo.ios) ? expo.ios : {};
2779
+ ios.appleTeamId = team;
2780
+ expo.ios = ios;
2781
+ json.expo = expo;
2782
+ });
2783
+ return "app.json";
2784
+ }
2785
+ return void 0;
2786
+ }
2787
+ function globToRegExp(glob) {
2788
+ let source = "";
2789
+ for (const char of glob) {
2790
+ if (char === "*") source += "[^/]*";
2791
+ else if (char === "?") source += "[^/]";
2792
+ else source += char.replace(/[.+^${}()|[\]\\]/g, "\\$&");
2793
+ }
2794
+ return new RegExp(`^${source}$`);
2795
+ }
2796
+ function isIgnored(gitignore, file) {
2797
+ let ignored = false;
2798
+ for (const raw of gitignore.split("\n")) {
2799
+ const line = raw.trim();
2800
+ if (!line || line.startsWith("#")) continue;
2801
+ const negated = line.startsWith("!");
2802
+ let pattern = negated ? line.slice(1) : line;
2803
+ if (pattern.endsWith("/")) continue;
2804
+ if (pattern.startsWith("/")) pattern = pattern.slice(1);
2805
+ else if (pattern.startsWith("**/")) pattern = pattern.slice(3);
2806
+ if (pattern.includes("/")) continue;
2807
+ if (globToRegExp(pattern).test(file)) ignored = !negated;
2808
+ }
2809
+ return ignored;
2810
+ }
2811
+ function ensureIgnored(root, file) {
2812
+ const path = join4(root, ".gitignore");
2813
+ const text2 = existsSync2(path) ? readFileSync2(path, "utf8") : "";
2814
+ if (isIgnored(text2, file)) return false;
2815
+ const lead = text2 === "" ? "" : text2.endsWith("\n") ? `${text2}
2816
+ ` : `${text2}
2817
+
2818
+ `;
2819
+ writeFileSync2(path, `${lead}# Holds your BusinessDash keys
2820
+ ${file}
2821
+ `);
2822
+ return true;
2823
+ }
2824
+ function includeFromXcconfig(path, file) {
2825
+ const text2 = readFileSync2(path, "utf8");
2826
+ const include = `#include? "${file}"`;
2827
+ if (text2.includes(include)) return;
2828
+ const body = text2.replace(/\n*$/, "\n");
2829
+ writeFileSync2(
2830
+ path,
2831
+ `${body}
2832
+ // Your keys, kept out of git (added by create-businessdash).
2833
+ ${include}
2834
+ `
2835
+ );
2836
+ }
2837
+ function writeEnv(root, env, keys) {
2838
+ const examplePath = join4(root, env.example);
2839
+ const example = readFileSync2(examplePath, "utf8");
2840
+ const target = join4(root, env.file);
2841
+ const slots = slotsIn(example);
2842
+ let written = false;
2843
+ let placed = [];
2844
+ if (!existsSync2(target)) {
2845
+ const source = env.format === "xcconfig" ? `// Your BusinessDash keys. Gitignored; ${env.example} includes this file.
2846
+ ${slotLinesOnly(example)}
2847
+ ` : example;
2848
+ const filled = fillEnv(source, keys);
2849
+ writeFileSync2(target, filled.text, { mode: 384 });
2850
+ written = true;
2851
+ placed = filled.placed;
2852
+ }
2853
+ if (env.format === "xcconfig") includeFromXcconfig(examplePath, env.file);
2854
+ const addedToGitignore = ensureIgnored(root, env.file);
2855
+ return { file: env.file, written, slots, placed, addedToGitignore };
2856
+ }
2857
+ function scaffold(options) {
2858
+ const from = join4(options.templatesDir, options.template.id);
2859
+ if (!existsSync2(from)) {
2860
+ throw new Error(
2861
+ `The ${options.template.id} template is missing from this install (${from}).`
2862
+ );
2863
+ }
2864
+ copyTree(
2865
+ from,
2866
+ options.targetDir,
2867
+ (path) => options.pm !== "pnpm" ? path === "pnpm-lock.yaml" : false
2868
+ );
2869
+ const payments = prunePayments(options.targetDir, options.payments);
2870
+ rewritePackageJson(
2871
+ join4(options.targetDir, "package.json"),
2872
+ options.packageName,
2873
+ options.pm
2874
+ );
2875
+ const env = options.template.env ? writeEnv(options.targetDir, options.template.env, options.keys) : void 0;
2876
+ const appleTeamFile = options.appleTeam ? writeAppleTeam(
2877
+ options.targetDir,
2878
+ options.template,
2879
+ options.appleTeam,
2880
+ env
2881
+ ) : void 0;
2882
+ return { env, appleTeamFile, payments };
2883
+ }
2884
+
2885
+ // src/sign-in.ts
2886
+ import { spawn } from "node:child_process";
2887
+ import { createHash, randomBytes } from "node:crypto";
2888
+ import { createServer } from "node:http";
2889
+ import { hostname } from "node:os";
2890
+ var DEFAULT_HOST = "https://businessdash.us";
2891
+ var WAIT_MS = 5 * 6e4;
2892
+ function sha256(value) {
2893
+ return createHash("sha256").update(value).digest("base64url");
2894
+ }
2895
+ function machineName(raw = hostname()) {
2896
+ return raw.replace(/[^A-Za-z0-9._-]+/g, "").slice(0, 64) || "a computer";
2897
+ }
2898
+ function authorizeLink(host, params) {
2899
+ const query = new URLSearchParams({
2900
+ redirect_uri: params.redirectUri,
2901
+ code_challenge: params.challenge,
2902
+ state: params.state,
2903
+ machine: params.machine,
2904
+ secret: params.withSecret ? "1" : "0"
2905
+ });
2906
+ return `${host}/login?returnTo=${encodeURIComponent(`/cli/authorize?${query}`)}`;
2907
+ }
2908
+ function openInBrowser(url) {
2909
+ if (process.env.BROWSER === "none") return;
2910
+ const [command, args] = process.platform === "darwin" ? ["open", [url]] : process.platform === "win32" ? (
2911
+ // Not `cmd /c start`: cmd would split the URL at every `&`.
2912
+ ["rundll32", ["url.dll,FileProtocolHandler", url]]
2913
+ ) : ["xdg-open", [url]];
2914
+ try {
2915
+ const child = spawn(command, args, { detached: true, stdio: "ignore" });
2916
+ child.on("error", () => void 0);
2917
+ child.unref();
2918
+ } catch {
2919
+ }
2920
+ }
2921
+ function page(res, status, message) {
2922
+ res.writeHead(status, {
2923
+ "Content-Type": "text/html; charset=utf-8",
2924
+ Connection: "close"
2925
+ });
2926
+ res.end(
2927
+ `<!doctype html><meta charset="utf-8"><title>create-businessdash</title><body style="font:16px system-ui;margin:4rem auto;max-width:32rem;padding:0 1rem"><p>${message}</p></body>`
2928
+ );
2929
+ }
2930
+ async function redeem(host, body) {
2931
+ let response;
2932
+ try {
2933
+ response = await fetch(`${host}/api/cli/keys`, {
2934
+ method: "POST",
2935
+ headers: { "Content-Type": "application/json" },
2936
+ body: JSON.stringify(body),
2937
+ redirect: "error"
2938
+ });
2939
+ } catch (error) {
2940
+ const why = error instanceof Error ? error.message : String(error);
2941
+ return {
2942
+ ok: false,
2943
+ reason: "failed",
2944
+ message: `Couldn't reach BusinessDash (${why}).`
2945
+ };
2946
+ }
2947
+ let json = {};
2948
+ try {
2949
+ json = await response.json();
2950
+ } catch {
2951
+ }
2952
+ if (!response.ok) {
2953
+ const message = typeof json.message === "string" ? json.message : `BusinessDash answered ${response.status}.`;
2954
+ return { ok: false, reason: "failed", message };
2955
+ }
2956
+ const keys = {};
2957
+ const candidates = [
2958
+ ["siteId", json.siteId],
2959
+ ["pk", json.publishableKey],
2960
+ ["sk", json.secretKey]
2961
+ ];
2962
+ for (const [slot, value] of candidates) {
2963
+ if (value === void 0 && slot === "sk") continue;
2964
+ if (typeof value !== "string" || keyProblem(slot, value)) {
2965
+ return {
2966
+ ok: false,
2967
+ reason: "failed",
2968
+ message: "BusinessDash sent back keys this version doesn't recognize."
2969
+ };
2970
+ }
2971
+ keys[slot] = value;
2972
+ }
2973
+ return {
2974
+ ok: true,
2975
+ keys,
2976
+ siteName: typeof json.siteName === "string" ? json.siteName : "your site",
2977
+ publishableHost: typeof json.publishableHost === "string" ? json.publishableHost : "localhost"
2978
+ };
2979
+ }
2980
+ async function signIn(options) {
2981
+ const verifier = randomBytes(32).toString("base64url");
2982
+ const state = randomBytes(16).toString("base64url");
2983
+ let settle = () => void 0;
2984
+ const callback = new Promise((resolve2) => {
2985
+ settle = resolve2;
2986
+ });
2987
+ const server = createServer((req, res) => {
2988
+ const url = new URL(req.url ?? "/", "http://127.0.0.1");
2989
+ if (url.pathname !== "/callback") {
2990
+ res.writeHead(404, { Connection: "close" }).end();
2991
+ return;
2992
+ }
2993
+ if (url.searchParams.get("state") !== state) {
2994
+ page(
2995
+ res,
2996
+ 400,
2997
+ "This link belongs to another run of create-businessdash."
2998
+ );
2999
+ return;
3000
+ }
3001
+ if (url.searchParams.get("error")) {
3002
+ page(res, 200, "Cancelled. Your project is being created without keys.");
3003
+ settle({ kind: "cancelled" });
3004
+ return;
3005
+ }
3006
+ const code = url.searchParams.get("code");
3007
+ if (!code) {
3008
+ page(res, 400, "This sign-in came back without a code.");
3009
+ return;
3010
+ }
3011
+ page(
3012
+ res,
3013
+ 200,
3014
+ "Signed in. Go back to your terminal; you can close this tab."
3015
+ );
3016
+ settle({ kind: "code", code });
3017
+ });
3018
+ await new Promise((resolve2, reject) => {
3019
+ server.once("error", reject);
3020
+ server.listen(0, "127.0.0.1", () => resolve2());
3021
+ });
3022
+ const { port } = server.address();
3023
+ const redirectUri = `http://127.0.0.1:${port}/callback`;
3024
+ const link = authorizeLink(options.host, {
3025
+ redirectUri,
3026
+ challenge: sha256(verifier),
3027
+ state,
3028
+ machine: options.machine ?? machineName(),
3029
+ withSecret: options.withSecret
3030
+ });
3031
+ options.onLink(link);
3032
+ (options.openUrl ?? openInBrowser)(link);
3033
+ let timer;
3034
+ const timeout = new Promise((resolve2) => {
3035
+ timer = setTimeout(
3036
+ () => resolve2({ kind: "timeout" }),
3037
+ options.timeoutMs ?? WAIT_MS
3038
+ );
3039
+ });
3040
+ const skipped = (options.skip ?? new Promise(() => void 0)).then(
3041
+ () => ({ kind: "skipped" })
3042
+ );
3043
+ try {
3044
+ const outcome = await Promise.race([callback, timeout, skipped]);
3045
+ switch (outcome.kind) {
3046
+ case "cancelled":
3047
+ return {
3048
+ ok: false,
3049
+ reason: "cancelled",
3050
+ message: "Sign-in was cancelled in the browser."
3051
+ };
3052
+ case "skipped":
3053
+ return { ok: false, reason: "skipped", message: "Skipped sign-in." };
3054
+ case "timeout":
3055
+ return {
3056
+ ok: false,
3057
+ reason: "timeout",
3058
+ message: "No approval arrived from the browser."
3059
+ };
3060
+ case "code":
3061
+ return await redeem(options.host, {
3062
+ code: outcome.code,
3063
+ code_verifier: verifier,
3064
+ redirect_uri: redirectUri
3065
+ });
3066
+ }
3067
+ } finally {
3068
+ clearTimeout(timer);
3069
+ server.close();
3070
+ server.closeAllConnections();
3071
+ }
3072
+ }
3073
+
3074
+ // src/index.ts
3075
+ var TEMPLATES_DIR = fileURLToPath(new URL("../templates", import.meta.url));
3076
+ var KEYS_URL = "https://www.businessdash.us/login?returnTo=/dashboard/settings/web-content";
3077
+ var DOCS_URL = "https://www.businessdash.us/docs/developer/starters";
3078
+ var KEY_FLAGS = {
3079
+ siteId: "site-id",
3080
+ pk: "pk",
3081
+ sk: "sk"
3082
+ };
3083
+ var argv = (0, import_mri.default)(process.argv.slice(2), {
3084
+ alias: { h: "help", t: "template", i: "immediate", v: "version" },
3085
+ boolean: [
3086
+ "help",
3087
+ "version",
3088
+ "overwrite",
3089
+ "immediate",
3090
+ "interactive",
3091
+ "sign-in"
3092
+ ],
3093
+ string: [
3094
+ "template",
3095
+ "pm",
3096
+ "site-id",
3097
+ "pk",
3098
+ "sk",
3099
+ "apple-team",
3100
+ "host",
3101
+ "payments"
3102
+ ]
3103
+ });
3104
+ var SHAPE_TITLE = {
3105
+ web: "Web",
3106
+ server: "Server",
3107
+ mobile: "Mobile (publishable token only)"
3108
+ };
3109
+ function templateList() {
3110
+ const lines = [];
3111
+ for (const shape of ["web", "server", "mobile"]) {
3112
+ lines.push(` ${import_picocolors2.default.dim(SHAPE_TITLE[shape])}`);
3113
+ for (const framework of FRAMEWORKS.filter((f) => f.shape === shape)) {
3114
+ for (const t2 of framework.variants) {
3115
+ const label = framework.variants.length > 1 ? `${framework.display}: ${t2.display}` : t2.display;
3116
+ const aliases = t2.aliases?.length ? import_picocolors2.default.dim(` (also: ${t2.aliases.join(", ")})`) : "";
3117
+ lines.push(` ${framework.color(t2.id.padEnd(16))}${label}${aliases}`);
3118
+ }
3119
+ }
3120
+ }
3121
+ return lines.join("\n");
3122
+ }
3123
+ function helpText() {
3124
+ return `Usage: create-businessdash [OPTION]... [DIRECTORY]
3125
+
3126
+ Create a BusinessDash app from a starter, or several apps in one project.
3127
+ With no arguments, start the CLI in interactive mode.
3128
+
3129
+ Options:
3130
+ -t, --template NAME[,NAME\u2026] one starter, or several: each gets its own folder
3131
+ -i, --immediate install dependencies and start the dev server
3132
+ --pm NAME npm, pnpm, yarn or bun (default: the one that ran create)
3133
+ --overwrite remove existing files in DIRECTORY first
3134
+ --site-id UUID your site ID
3135
+ --pk TOKEN your publishable token (pk_\u2026)
3136
+ --sk KEY your secret key; the prompt keeps it out of shell history
3137
+ --sign-in get the keys by approving in your browser instead
3138
+ (optional; the keys prompt offers it too)
3139
+ --host URL BusinessDash address for --sign-in
3140
+ (default ${DEFAULT_HOST})
3141
+ --payments LIST what the app takes money for: store, donations,
3142
+ saas (comma-separated), or none. Payment code you
3143
+ don't pick is left out (default: none)
3144
+ --apple-team ID your Apple team, to sign an iPhone app (asked on a Mac
3145
+ when omitted; it stays on your machine)
3146
+ --interactive force interactive mode
3147
+ --no-interactive never prompt; fail instead
3148
+ -h, --help show this help
3149
+ -v, --version show the version
3150
+
3151
+ Available templates:
3152
+ ${templateList()}
3153
+
3154
+ Examples:
3155
+ npm create businessdash@latest
3156
+ pnpm create businessdash my-site --template astro
3157
+ pnpm create businessdash acme --template astro,ios,android # acme/web, acme/ios, acme/android
3158
+ npm create businessdash@latest acme -- --template nuxt,flutter --pm pnpm`;
3159
+ }
3160
+ function fail(message) {
3161
+ console.error(`${import_picocolors2.default.red("\u2716")} ${message}`);
3162
+ process.exit(1);
3163
+ }
3164
+ function cancelled() {
3165
+ cancel("Operation cancelled");
3166
+ process.exit(0);
3167
+ }
3168
+ function hasCommand(name) {
3169
+ const result = spawnSync2(name, ["--version"], {
3170
+ stdio: "ignore",
3171
+ shell: process.platform === "win32"
3172
+ });
3173
+ return result.status === 0;
3174
+ }
3175
+ function run(command, cwd) {
3176
+ const [bin, ...args] = command;
3177
+ if (!bin) return false;
3178
+ const result = spawnSync2(bin, args, {
3179
+ cwd,
3180
+ stdio: "inherit",
3181
+ shell: process.platform === "win32"
3182
+ });
3183
+ return result.status === 0;
3184
+ }
3185
+ function colored(template) {
3186
+ return frameworkOf(template).color(template.display);
3187
+ }
3188
+ function keysFromFlags() {
3189
+ const keys = {};
3190
+ for (const slot of SLOT_ORDER) {
3191
+ const flag = KEY_FLAGS[slot];
3192
+ const value = argv[flag];
3193
+ if (value === void 0) continue;
3194
+ const problem = keyProblem(slot, value);
3195
+ if (problem) fail(`--${flag}: ${problem}`);
3196
+ keys[slot] = value.trim();
3197
+ }
3198
+ return keys;
3199
+ }
3200
+ async function pickFramework(message, shape) {
3201
+ const framework = await select({
3202
+ message,
3203
+ options: FRAMEWORKS.filter((f) => f.shape === shape).map((f) => ({
3204
+ value: f,
3205
+ label: f.color(f.display),
3206
+ hint: f.hint
3207
+ }))
3208
+ });
3209
+ if (isCancel(framework)) cancelled();
3210
+ const [only] = framework.variants;
3211
+ if (only && framework.variants.length === 1) return only;
3212
+ const variant = await select({
3213
+ message: "Select a variant:",
3214
+ options: framework.variants.map((t2) => ({
3215
+ value: t2,
3216
+ label: framework.color(t2.display),
3217
+ hint: t2.hint
3218
+ }))
3219
+ });
3220
+ if (isCancel(variant)) cancelled();
3221
+ return variant;
3222
+ }
3223
+ async function pickMobile(ios, android) {
3224
+ const swift = templateById("swift");
3225
+ const kotlin = templateById("kotlin");
3226
+ const flutter = templateById("flutter");
3227
+ const expo = templateById("react-native");
3228
+ const crossPlatform = [
3229
+ { value: [flutter], label: colored(flutter), hint: "one app for both" },
3230
+ { value: [expo], label: colored(expo), hint: "Expo, one app for both" }
3231
+ ];
3232
+ const options = ios && android ? [
3233
+ ...crossPlatform,
3234
+ {
3235
+ value: [swift, kotlin],
3236
+ label: `${colored(swift)} + ${colored(kotlin)}`,
3237
+ hint: "native, one app each"
3238
+ }
3239
+ ] : ios ? [
3240
+ { value: [swift], label: colored(swift), hint: "native SwiftUI" },
3241
+ ...crossPlatform
3242
+ ] : [
3243
+ {
3244
+ value: [kotlin],
3245
+ label: colored(kotlin),
3246
+ hint: "native Jetpack Compose"
3247
+ },
3248
+ ...crossPlatform
3249
+ ];
3250
+ const choice = await select({
3251
+ message: ios && android ? "How should the iOS and Android apps be built?" : ios ? "Select an iOS framework:" : "Select an Android framework:",
3252
+ options
3253
+ });
3254
+ if (isCancel(choice)) cancelled();
3255
+ return choice;
3256
+ }
3257
+ async function pickByPlatform() {
3258
+ const platforms = await multiselect({
3259
+ message: "Which platforms?",
3260
+ options: [
3261
+ {
3262
+ value: "web",
3263
+ label: "Web",
3264
+ hint: "React, Nuxt, SvelteKit, Astro, Angular, \u2026"
3265
+ },
3266
+ {
3267
+ value: "server",
3268
+ label: "Server-rendered",
3269
+ hint: "Laravel, Phoenix, Vapor"
3270
+ },
3271
+ { value: "ios", label: "iOS" },
3272
+ { value: "android", label: "Android" }
3273
+ ],
3274
+ initialValues: ["web"],
3275
+ required: true
3276
+ });
3277
+ if (isCancel(platforms)) cancelled();
3278
+ const picked = [];
3279
+ if (platforms.includes("web"))
3280
+ picked.push(await pickFramework("Select a web framework:", "web"));
3281
+ if (platforms.includes("server")) {
3282
+ picked.push(await pickFramework("Select a server framework:", "server"));
3283
+ }
3284
+ const ios = platforms.includes("ios");
3285
+ const android = platforms.includes("android");
3286
+ if (ios || android) picked.push(...await pickMobile(ios, android));
3287
+ return picked;
3288
+ }
3289
+ async function chooseTemplates(interactive) {
3290
+ const names = templateNames(argv.template);
3291
+ if (names.length > 0) {
3292
+ const found = names.map((name) => ({ name, template: findTemplate(name) }));
3293
+ const unknown = found.filter((f) => !f.template).map((f) => `"${f.name}"`);
3294
+ if (unknown.length === 0) {
3295
+ return uniqueTemplates(
3296
+ found.flatMap((f) => f.template ? [f.template] : [])
3297
+ );
3298
+ }
3299
+ const what = `${unknown.join(", ")} ${unknown.length > 1 ? "aren't templates" : "isn't a template"}`;
3300
+ if (!interactive) fail(`${what}. Choose from:
3301
+ ${templateList()}`);
3302
+ log.warn(`${what}. Choose below:`);
3303
+ } else if (!interactive) {
3304
+ fail(
3305
+ `Pass --template NAME (or several: --template astro,ios,android). Templates:
3306
+ ${templateList()}`
3307
+ );
3308
+ }
3309
+ return pickByPlatform();
3310
+ }
3311
+ function paymentsFromFlag() {
3312
+ if (argv.payments === void 0) return void 0;
3313
+ const parsed = parsePayments(argv.payments);
3314
+ if ("error" in parsed) fail(parsed.error);
3315
+ return parsed.features;
3316
+ }
3317
+ async function choosePayments(fromFlag, interactive) {
3318
+ if (fromFlag) return fromFlag;
3319
+ if (!interactive) return [];
3320
+ const accept = await confirm({
3321
+ message: "Accept payments through Stripe?",
3322
+ initialValue: false
3323
+ });
3324
+ if (isCancel(accept)) cancelled();
3325
+ if (!accept) return [];
3326
+ const picked = await multiselect({
3327
+ message: "What will people pay for? (select all that apply)",
3328
+ options: PAYMENT_FEATURES.map((feature) => ({
3329
+ value: feature,
3330
+ label: PAYMENT_CHOICES[feature].label,
3331
+ hint: PAYMENT_CHOICES[feature].hint
3332
+ })),
3333
+ required: true
3334
+ });
3335
+ if (isCancel(picked)) cancelled();
3336
+ return PAYMENT_FEATURES.filter((feature) => picked.includes(feature));
3337
+ }
3338
+ function signInHost() {
3339
+ const raw = argv.host?.trim() || DEFAULT_HOST;
3340
+ let url;
3341
+ try {
3342
+ url = new URL(raw);
3343
+ } catch {
3344
+ fail(`--host: "${raw}" isn't a URL.`);
3345
+ }
3346
+ const local = url.hostname === "localhost" || url.hostname === "127.0.0.1";
3347
+ if (url.protocol !== "https:" && !(url.protocol === "http:" && local)) {
3348
+ fail("--host must be https (plain http only for localhost).");
3349
+ }
3350
+ return url.origin;
3351
+ }
3352
+ function keyPressed() {
3353
+ if (!process.stdin.isTTY) {
3354
+ return { pressed: new Promise(() => void 0), stop: () => void 0 };
3355
+ }
3356
+ let onData = () => void 0;
3357
+ const pressed = new Promise((resolve2) => {
3358
+ onData = () => resolve2();
3359
+ });
3360
+ process.stdin.on("data", onData);
3361
+ process.stdin.resume();
3362
+ return {
3363
+ pressed,
3364
+ stop: () => {
3365
+ process.stdin.off("data", onData);
3366
+ process.stdin.pause();
3367
+ }
3368
+ };
3369
+ }
3370
+ async function signInForKeys(slots) {
3371
+ const host = signInHost();
3372
+ const key = keyPressed();
3373
+ try {
3374
+ const result = await signIn({
3375
+ host,
3376
+ withSecret: slots.includes("sk"),
3377
+ skip: key.pressed,
3378
+ onLink: (url) => log.step(
3379
+ `Approve in your browser. If it didn't open:
3380
+ ${import_picocolors2.default.cyan(url)}
3381
+ ${import_picocolors2.default.dim("Waiting\u2026 press Enter to skip and add the keys later.")}`
3382
+ )
3383
+ });
3384
+ if (!result.ok) {
3385
+ log.warn(`${result.message} Carrying on without keys.`);
3386
+ return { keys: {}, signedIn: false };
3387
+ }
3388
+ const keys = {};
3389
+ for (const slot of slots) {
3390
+ const value = result.keys[slot];
3391
+ if (value) keys[slot] = value;
3392
+ }
3393
+ log.success(`Signed in. Using ${result.siteName}'s keys.`);
3394
+ return { keys, signedIn: true };
3395
+ } finally {
3396
+ key.stop();
3397
+ }
3398
+ }
3399
+ async function promptForKeys(slots, envFile) {
3400
+ const choice = await select({
3401
+ message: "Your BusinessDash keys:",
3402
+ initialValue: "skip",
3403
+ options: [
3404
+ {
3405
+ value: "skip",
3406
+ label: "Skip for now",
3407
+ hint: envFile ? `fill in ${envFile} later` : "add them later"
3408
+ },
3409
+ {
3410
+ value: "sign-in",
3411
+ label: "Sign in to BusinessDash",
3412
+ hint: "approve in your browser; they're filled in for you"
3413
+ },
3414
+ { value: "paste", label: "Paste them" }
3415
+ ]
3416
+ });
3417
+ if (isCancel(choice)) cancelled();
3418
+ if (choice === "skip") return { keys: {}, signedIn: false };
3419
+ if (choice === "sign-in") return signInForKeys(slots);
3420
+ log.info(
3421
+ `They're in your dashboard under Settings > Web Content SDK:
3422
+ ${import_picocolors2.default.cyan(KEYS_URL)}`
3423
+ );
3424
+ const keys = {};
3425
+ for (const slot of slots) {
3426
+ const validate = (value2) => value2?.trim() ? keyProblem(slot, value2) : void 0;
3427
+ const value = slot === "sk" ? await password({
3428
+ message: `${SLOT_LABEL[slot]} (Enter to skip):`,
3429
+ validate
3430
+ }) : await text({
3431
+ message: `${SLOT_LABEL[slot]}:`,
3432
+ placeholder: "Enter to skip",
3433
+ validate
3434
+ });
3435
+ if (isCancel(value)) cancelled();
3436
+ if (value?.trim()) keys[slot] = value.trim();
3437
+ }
3438
+ return { keys, signedIn: false };
3439
+ }
3440
+ function unusedKeyWarning(slot, templates) {
3441
+ const flag = `--${KEY_FLAGS[slot]}`;
3442
+ if (slot === "sk" && templates.every((t2) => frameworkOf(t2).shape === "mobile")) {
3443
+ return `${flag} was not written anywhere: mobile starters ship inside an app binary, so they only take a publishable token.`;
3444
+ }
3445
+ const which = templates.length === 1 ? `the ${templates[0]?.display} starter has` : "none of these starters has";
3446
+ return `${flag} was not written anywhere: ${which} a place for a ${SLOT_LABEL[slot].toLowerCase()}.`;
3447
+ }
3448
+ function envNotes(env) {
3449
+ const notes = [];
3450
+ if (!env.written) {
3451
+ notes.push(`${env.file} already existed, so it was left as it was.`);
3452
+ } else {
3453
+ const missing = env.slots.filter((slot) => !env.placed.includes(slot));
3454
+ if (missing.length > 0) {
3455
+ const names = missing.map((slot) => SLOT_LABEL[slot].toLowerCase());
3456
+ notes.push(
3457
+ `Add your ${names.join(", ")} to ${env.file}. They're at ${import_picocolors2.default.cyan(KEYS_URL)}`
3458
+ );
3459
+ }
3460
+ }
3461
+ if (env.addedToGitignore) {
3462
+ notes.push(`Added ${env.file} to .gitignore so your keys stay out of git.`);
3463
+ }
3464
+ return notes;
3465
+ }
3466
+ async function chooseAppleTeam(templates, interactive) {
3467
+ const signing = templates.filter((t2) => t2.appleTeam);
3468
+ const flag = argv["apple-team"]?.trim();
3469
+ if (flag) {
3470
+ if (signing.length > 0) return flag;
3471
+ log.warn(
3472
+ "--apple-team was not written anywhere: only the Swift and React Native starters take one (Flutter finds your team itself)."
3473
+ );
3474
+ return void 0;
3475
+ }
3476
+ if (signing.length === 0 || !interactive || process.platform !== "darwin")
3477
+ return void 0;
3478
+ const teams = detectAppleTeams();
3479
+ const [only] = teams;
3480
+ if (!only) return void 0;
3481
+ if (teams.length === 1) {
3482
+ const yes = await confirm({
3483
+ message: `Sign the iPhone app with ${only.name} (${only.id})?`,
3484
+ initialValue: true
3485
+ });
3486
+ if (isCancel(yes)) cancelled();
3487
+ return yes ? only.id : void 0;
3488
+ }
3489
+ const choice = await select({
3490
+ message: "Which Apple team should sign the iPhone app?",
3491
+ options: [
3492
+ ...teams.map((team) => ({
3493
+ value: team.id,
3494
+ label: team.name,
3495
+ hint: team.id
3496
+ })),
3497
+ { value: "", label: "None for now", hint: "pick one in Xcode later" }
3498
+ ]
3499
+ });
3500
+ if (isCancel(choice)) cancelled();
3501
+ return choice || void 0;
3502
+ }
3503
+ function quote(path) {
3504
+ return /\s/.test(path) ? `"${path}"` : path;
3505
+ }
3506
+ function appSteps(template, dir, from, pm, keys) {
3507
+ const steps = [];
3508
+ const path = relative(from, dir);
3509
+ if (path) steps.push(`cd ${quote(path)}`);
3510
+ if (template.dev) {
3511
+ const workspace = pm === "pnpm" ? enclosingPnpmWorkspace(dir) : void 0;
3512
+ steps.push(
3513
+ installCommand(pm, { ignoreWorkspace: workspace !== void 0 }).join(
3514
+ " "
3515
+ ),
3516
+ runCommand(pm, template.dev).join(" ")
3517
+ );
3518
+ } else if (template.steps) {
3519
+ steps.push(...template.steps({ keys }));
3520
+ }
3521
+ return steps;
3522
+ }
3523
+ async function main() {
3524
+ if (argv.help) {
3525
+ console.log(helpText());
3526
+ return;
3527
+ }
3528
+ if (argv.version) {
3529
+ console.log("0.1.1");
3530
+ return;
3531
+ }
3532
+ const interactive = argv.interactive ?? Boolean(process.stdin.isTTY);
3533
+ let pm = detectPackageManager(
3534
+ process.env.npm_config_user_agent
3535
+ );
3536
+ if (argv.pm !== void 0) {
3537
+ if (!isPackageManager(argv.pm))
3538
+ fail("--pm takes one of: npm, pnpm, yarn, bun.");
3539
+ pm = argv.pm;
3540
+ }
3541
+ const flagKeys = keysFromFlags();
3542
+ if (argv["sign-in"]) {
3543
+ if (Object.keys(flagKeys).length > 0) {
3544
+ fail(
3545
+ "--sign-in gets the keys for you; drop --site-id, --pk and --sk, or drop --sign-in."
3546
+ );
3547
+ }
3548
+ signInHost();
3549
+ }
3550
+ const paymentsFlag = paymentsFromFlag();
3551
+ const teamFlag = argv["apple-team"];
3552
+ if (teamFlag !== void 0 && !TEAM_ID.test(teamFlag.trim())) {
3553
+ fail(
3554
+ "--apple-team: an Apple team ID is 10 capital letters and digits (Xcode > Settings > Accounts, or developer.apple.com > Membership)."
3555
+ );
3556
+ }
3557
+ const logo = interactive ? showLogo(process.stdout, { alsoWatch: process.stderr }) : void 0;
3558
+ if (interactive) intro(import_picocolors2.default.inverse(" create-businessdash "));
3559
+ const positional = argv._[0];
3560
+ let targetDir = positional === void 0 ? "" : formatTargetDir(String(positional));
3561
+ if (!targetDir) {
3562
+ if (interactive) {
3563
+ const name = await text({
3564
+ message: "Project name:",
3565
+ placeholder: DEFAULT_PROJECT_NAME,
3566
+ defaultValue: DEFAULT_PROJECT_NAME,
3567
+ validate: (value) => value && !formatTargetDir(value) ? "That isn't a usable folder name." : void 0
3568
+ });
3569
+ if (isCancel(name)) cancelled();
3570
+ targetDir = formatTargetDir(name);
3571
+ } else {
3572
+ targetDir = DEFAULT_PROJECT_NAME;
3573
+ }
3574
+ }
3575
+ const root = resolve(targetDir);
3576
+ if (existsSync3(root) && !statSync2(root).isDirectory()) {
3577
+ fail(`"${targetDir}" is a file, not a folder.`);
3578
+ }
3579
+ if (!isEmptyDir(root)) {
3580
+ let action;
3581
+ if (argv.overwrite) {
3582
+ action = "remove";
3583
+ } else if (interactive) {
3584
+ const where = targetDir === "." ? "The current directory" : `Target directory "${targetDir}"`;
3585
+ const choice = await select({
3586
+ message: `${where} is not empty. Please choose how to proceed:`,
3587
+ options: [
3588
+ { value: "cancel", label: "Cancel operation" },
3589
+ { value: "remove", label: "Remove existing files and continue" },
3590
+ { value: "keep", label: "Ignore files and continue" }
3591
+ ]
3592
+ });
3593
+ if (isCancel(choice) || choice === "cancel") cancelled();
3594
+ action = choice;
3595
+ } else {
3596
+ fail(
3597
+ `"${targetDir}" is not empty. Pass --overwrite to replace what's there, or pick an empty folder.`
3598
+ );
3599
+ }
3600
+ if (action === "remove") emptyDir(root);
3601
+ }
3602
+ let packageName = basename(root);
3603
+ if (!isValidPackageName(packageName)) {
3604
+ const suggestion = toValidPackageName(packageName) || DEFAULT_PROJECT_NAME;
3605
+ if (interactive) {
3606
+ const name = await text({
3607
+ message: "Package name:",
3608
+ placeholder: suggestion,
3609
+ defaultValue: suggestion,
3610
+ validate: (value) => !value || isValidPackageName(value) ? void 0 : "Invalid package.json name"
3611
+ });
3612
+ if (isCancel(name)) cancelled();
3613
+ packageName = name;
3614
+ } else {
3615
+ packageName = suggestion;
3616
+ }
3617
+ }
3618
+ const templates = await chooseTemplates(interactive);
3619
+ const apps = planApps(templates);
3620
+ const multi = apps.length > 1;
3621
+ const payments = await choosePayments(paymentsFlag, interactive);
3622
+ const stores = new Set(templates.flatMap((t2) => t2.stores ?? []));
3623
+ const storeRules = appStoreNotice(payments, stores);
3624
+ if (storeRules.length > 0) {
3625
+ note(storeRules.join("\n\n"), appStoreTitle(stores));
3626
+ }
3627
+ const slots = SLOT_ORDER.filter(
3628
+ (slot) => templates.some((t2) => templateSlots(TEMPLATES_DIR, t2).includes(slot))
3629
+ );
3630
+ let keys = {};
3631
+ for (const slot of SLOT_ORDER) {
3632
+ const value = flagKeys[slot];
3633
+ if (!value) continue;
3634
+ if (slots.includes(slot)) keys[slot] = value;
3635
+ else log.warn(unusedKeyWarning(slot, templates));
3636
+ }
3637
+ let signedIn = false;
3638
+ if (slots.length > 0 && Object.keys(flagKeys).length === 0) {
3639
+ const choice = argv["sign-in"] ? await signInForKeys(slots) : interactive ? await promptForKeys(
3640
+ slots,
3641
+ multi ? void 0 : templates[0]?.env?.file
3642
+ ) : void 0;
3643
+ if (choice) {
3644
+ keys = choice.keys;
3645
+ signedIn = choice.signedIn;
3646
+ }
3647
+ }
3648
+ const appleTeam = await chooseAppleTeam(templates, interactive);
3649
+ logo?.stop();
3650
+ const written = apps.map((app) => {
3651
+ const dir = app.folder ? join5(root, app.folder) : root;
3652
+ const name = app.folder ? toValidPackageName(`${packageName}-${app.folder}`) : packageName;
3653
+ const result = scaffold({
3654
+ templatesDir: TEMPLATES_DIR,
3655
+ template: app.template,
3656
+ targetDir: dir,
3657
+ packageName: name,
3658
+ pm,
3659
+ keys,
3660
+ appleTeam,
3661
+ payments: new Set(payments)
3662
+ });
3663
+ const framework = frameworkOf(app.template);
3664
+ const label = framework.variants.length > 1 ? `${framework.display} (${app.template.display})` : framework.display;
3665
+ log.success(`Scaffolded the ${framework.color(label)} starter in ${dir}`);
3666
+ return { ...app, dir, result };
3667
+ });
3668
+ if (multi) {
3669
+ const readme = join5(root, "README.md");
3670
+ if (!existsSync3(readme)) {
3671
+ const readmeApps = written.map((w) => ({
3672
+ ...w,
3673
+ steps: appSteps(w.template, w.dir, root, pm, keys)
3674
+ }));
3675
+ writeFileSync3(readme, rootReadme(packageName, readmeApps, KEYS_URL));
3676
+ }
3677
+ }
3678
+ const [single] = written;
3679
+ if (single && !multi && single.template.dev) {
3680
+ const { template, dir } = single;
3681
+ const dev = single.template.dev;
3682
+ let immediate = argv.immediate === true;
3683
+ if (!immediate && interactive) {
3684
+ const answer = await confirm({
3685
+ message: `Install with ${pm} and start now?`,
3686
+ initialValue: false
3687
+ });
3688
+ if (isCancel(answer)) cancelled();
3689
+ immediate = answer;
3690
+ }
3691
+ if (immediate) {
3692
+ const workspace = pm === "pnpm" ? enclosingPnpmWorkspace(dir) : void 0;
3693
+ const install = installCommand(pm, {
3694
+ ignoreWorkspace: workspace !== void 0
3695
+ });
3696
+ log.step(`Installing dependencies with ${pm}\u2026`);
3697
+ if (!run(install, dir)) fail(`${install.join(" ")} failed in ${dir}.`);
3698
+ if (template.needsBun && !hasCommand("bun")) {
3699
+ log.warn(
3700
+ "The dev server runs on Bun, which isn't installed. Get it at https://bun.sh, then start it from the project folder."
3701
+ );
3702
+ return;
3703
+ }
3704
+ log.step("Starting the dev server\u2026");
3705
+ run(runCommand(pm, dev), dir);
3706
+ return;
3707
+ }
3708
+ } else if (argv.immediate) {
3709
+ log.warn(
3710
+ multi ? "--immediate starts one app. With several, each one's steps are below." : "--immediate only runs JavaScript starters. This one uses its own toolchain; the steps are below."
3711
+ );
3712
+ }
3713
+ const cwd = process.cwd();
3714
+ const bunMissing = written.some((w) => w.template.needsBun) && !hasCommand("bun");
3715
+ const sections = [];
3716
+ const notes = [];
3717
+ for (const w of written) {
3718
+ const steps = appSteps(w.template, w.dir, cwd, pm, keys);
3719
+ sections.push(
3720
+ multi ? [
3721
+ import_picocolors2.default.bold(`${w.folder}: ${w.template.display}`),
3722
+ ...steps.map((s) => ` ${s}`)
3723
+ ].join("\n") : steps.join("\n")
3724
+ );
3725
+ const prefix = multi ? `${w.folder}/: ` : "";
3726
+ const own = [
3727
+ ...w.result.env ? envNotes(w.result.env) : [],
3728
+ ...w.template.needsBun && bunMissing ? ["The dev server runs on Bun: install it from https://bun.sh first."] : [],
3729
+ ...w.template.dev && pm === "pnpm" && enclosingPnpmWorkspace(w.dir) ? [
3730
+ `This folder sits inside the pnpm workspace at ${enclosingPnpmWorkspace(w.dir)}; --ignore-workspace keeps the install to this project.`
3731
+ ] : [],
3732
+ ...w.template.appleTeam && !w.result.appleTeamFile ? [
3733
+ "No Apple team set for the iPhone app. Pick one in Xcode (Signing & Capabilities), or pass --apple-team."
3734
+ ] : [],
3735
+ ...w.result.appleTeamFile ? [
3736
+ `Your Apple team is in ${w.result.appleTeamFile}; it stays on this machine.`
3737
+ ] : [],
3738
+ ...w.template.notes ?? []
3739
+ ];
3740
+ notes.push(...own.map((note2) => `${prefix}${note2}`));
3741
+ }
3742
+ if (multi) notes.push(`README.md lists every app and how to start it.`);
3743
+ if (signedIn && keys.pk) {
3744
+ notes.push(
3745
+ `The publishable token works from localhost. Before you deploy, make one for your domain at ${import_picocolors2.default.cyan(KEYS_URL)}`
3746
+ );
3747
+ }
3748
+ note(sections.join("\n\n"), "Next steps");
3749
+ for (const note2 of notes) log.info(note2);
3750
+ outro(`Docs: ${import_picocolors2.default.cyan(DOCS_URL)}`);
3751
+ }
3752
+ main().catch((error) => {
3753
+ fail(error instanceof Error ? error.message : String(error));
3754
+ });