{"version":3,"file":"HostedOnboarding.cjs","names":["useT","Button","Badge","Spinner","ArrowRightIcon","CheckIcon","Input","Textarea"],"sources":["../../../../src/web/features/onboarding/HostedOnboarding.tsx"],"sourcesContent":["import { useT } from '@agimon-ai/po-core/web';\nimport { ArrowRightIcon, Badge, Button, CheckIcon, Input, Spinner, Textarea } from '@agimon-ai/po-web-components';\nimport type { ReactNode } from 'react';\n\nimport { START_HERE, type StarterPo } from '../../lib/starterPos';\n\nfunction Face({ avatar, className }: { avatar: string; className: string }) {\n  return <img src={avatar} alt=\"\" aria-hidden=\"true\" className={`shrink-0 rounded-full ${className}`} />;\n}\n\n/** The centred first-run column, with one dot per step. */\nfunction Step({ current, wide = false, children }: { current: 0 | 1; wide?: boolean; children: ReactNode }) {\n  const t = useT();\n  return (\n    <div className=\"flex min-h-0 flex-1 items-center justify-center overflow-y-auto px-4 py-10\">\n      <section className={`flex w-full flex-col gap-6 ${wide ? 'max-w-4xl' : 'max-w-xl'}`}>\n        {children}\n        <ol aria-label={t('webDashboard.onboarding.steps', 'Setup steps')} className=\"flex justify-center gap-2\">\n          {[0, 1].map((index) => (\n            <li\n              key={index}\n              aria-current={index === current ? 'step' : undefined}\n              className={`size-1.5 rounded-full ${index === current ? 'bg-po-selected' : 'bg-po-border-soft'}`}\n            />\n          ))}\n        </ol>\n      </section>\n    </div>\n  );\n}\n\n// Three cards on the first row and two centred under them, so no Po sits alone.\nconst GRID_PLACE = ['', '', '', 'sm:col-start-2', ''];\n\n/** Step 1 of 2. One click on a Po sets everything up; there is nothing else to confirm. */\nexport function ChoosePoStep({\n  pos,\n  settingUpId,\n  failed,\n  onChoose,\n}: {\n  pos: readonly StarterPo[];\n  settingUpId?: string;\n  /** The Po that could not get ready; its card says why and can be clicked again. */\n  failed?: { id: string; error: string };\n  onChoose: (po: StarterPo) => void;\n}) {\n  const t = useT();\n  return (\n    <Step current={0} wide>\n      <header className=\"flex flex-col items-center gap-2 text-center\">\n        <span className=\"text-sm text-po-dim\">{t('webDashboard.onboarding.choose.step', 'Step 1 of 2')}</span>\n        <h1 className=\"text-2xl font-semibold text-po-hi\">\n          {t('webDashboard.onboarding.choose.title', 'Who would you like by your side?')}\n        </h1>\n        <p className=\"text-base text-po-dim\">\n          {t('webDashboard.onboarding.choose.description', 'Each Po is ready to go. You can meet the others any time.')}\n        </p>\n      </header>\n      <ul className=\"grid gap-3 sm:grid-cols-6\">\n        {pos.map((po, index) => {\n          const settingUp = po.id === settingUpId;\n          const error = po.id === failed?.id ? failed.error : undefined;\n          return (\n            <li key={po.id} className={`sm:col-span-2 ${GRID_PLACE[index] ?? ''}`}>\n              <Button\n                variant=\"outline\"\n                size=\"card\"\n                aria-busy={settingUp}\n                aria-label={t('webDashboard.onboarding.choose.label', 'Choose {name}, your {role}', {\n                  name: po.name,\n                  role: po.role.toLowerCase(),\n                })}\n                disabled={settingUpId !== undefined && !settingUp}\n                onClick={() => {\n                  if (settingUpId === undefined) onChoose(po);\n                }}\n                // Extra top padding leaves headroom for the hop, which rises a quarter of the avatar.\n                className={`group relative h-full items-center gap-2 rounded-lg px-4 pb-5 pt-8 text-center hover:bg-po-selected/5 focus-visible:bg-po-selected/5 ${\n                  settingUp ? 'border-po-selected bg-po-selected/5' : error ? 'border-po-edge-red' : ''\n                }`}\n              >\n                {po.id === START_HERE ? (\n                  <Badge tone=\"green\" size=\"xs\" className=\"absolute right-3 top-3\">\n                    {t('webDashboard.onboarding.choose.startHere', 'Start here')}\n                  </Badge>\n                ) : null}\n                {/* Po lifts on hover and hops while getting ready; both stop under reduced motion. */}\n                <Face\n                  avatar={po.avatar}\n                  className={`size-20 transition-transform duration-200 motion-safe:group-hover:-translate-y-1 motion-safe:group-hover:scale-105 ${\n                    settingUp ? 'motion-safe:animate-bounce' : ''\n                  }`}\n                />\n                <span className=\"text-lg font-semibold text-po-hi\">{po.name}</span>\n                <Badge size=\"sm\">{po.role}</Badge>\n                <span className=\"text-sm text-po-dim\">{po.purpose}</span>\n                {settingUp ? (\n                  <span className=\"mt-1 flex items-center gap-1.5 text-sm font-medium text-po-green\">\n                    <Spinner\n                      label={t('webDashboard.onboarding.choose.gettingReadyLabel', 'Getting {name} ready', {\n                        name: po.name,\n                      })}\n                      className=\"size-3.5\"\n                    />\n                    {t('webDashboard.onboarding.choose.gettingReady', 'Getting {name} ready…', { name: po.name })}\n                  </span>\n                ) : error ? (\n                  <span role=\"alert\" className=\"mt-1 text-sm text-po-red\">\n                    {error}\n                  </span>\n                ) : (\n                  // Always shown, so a tap on a phone is as obvious as a hover with a mouse.\n                  <span\n                    aria-hidden=\"true\"\n                    className=\"mt-1 flex items-center gap-1.5 text-sm font-medium text-po-dim transition-colors group-hover:text-po-green group-focus-visible:text-po-green\"\n                  >\n                    {t('webDashboard.onboarding.choose.choose', 'Choose {name}', { name: po.name })}\n                    <ArrowRightIcon className=\"size-3.5\" />\n                  </span>\n                )}\n              </Button>\n            </li>\n          );\n        })}\n      </ul>\n    </Step>\n  );\n}\n\n/** Step 2 of 2. Both fields are optional, and choosing a different Po goes back to step 1. */\nexport function AboutYouStep({\n  po,\n  name,\n  interests,\n  busy = false,\n  error,\n  onNameChange,\n  onInterestsChange,\n  onBack,\n  onContinue,\n}: {\n  po: StarterPo;\n  name: string;\n  interests: string;\n  busy?: boolean;\n  error?: string;\n  onNameChange: (name: string) => void;\n  onInterestsChange: (interests: string) => void;\n  onBack: () => void;\n  onContinue: () => void;\n}) {\n  const t = useT();\n  return (\n    <Step current={1}>\n      <div className=\"flex flex-col gap-6 rounded-lg border border-po-border-soft bg-po-panel p-8 shadow-sm\">\n        <header className=\"flex flex-col items-center gap-2 text-center\">\n          <span className=\"relative\">\n            <Face avatar={po.avatar} className=\"size-20\" />\n            <span\n              aria-hidden=\"true\"\n              className=\"absolute -bottom-0.5 -right-0.5 flex size-6 items-center justify-center rounded-full bg-po-selected text-po-on-selected ring-2 ring-po-panel\"\n            >\n              <CheckIcon className=\"size-3.5\" />\n            </span>\n          </span>\n          <span className=\"mt-1 text-sm font-medium text-po-dim\">\n            {t('webDashboard.onboarding.about.ready', '{name} is ready', { name: po.name })}\n          </span>\n          <h1 className=\"text-2xl font-semibold text-po-hi\">\n            {t('webDashboard.onboarding.about.title', 'Tell {name} about you', { name: po.name })}\n          </h1>\n          <p className=\"text-base text-po-dim\">\n            {t(\n              'webDashboard.onboarding.about.description',\n              'Share a little about yourself so you start off as friends, not strangers.',\n            )}\n          </p>\n        </header>\n        <label htmlFor=\"onboarding-name\" className=\"flex flex-col gap-1.5\">\n          <span className=\"text-base font-medium text-po-text\">{t('webDashboard.onboarding.about.name', 'Name')}</span>\n          <Input\n            id=\"onboarding-name\"\n            value={name}\n            maxLength={80}\n            placeholder={t('webDashboard.onboarding.about.namePlaceholder', 'What should Po call you?')}\n            onChange={(event) => onNameChange(event.target.value)}\n          />\n        </label>\n        <label htmlFor=\"onboarding-interests\" className=\"flex flex-col gap-1.5\">\n          <span className=\"text-base font-medium text-po-text\">\n            {t('webDashboard.onboarding.about.interests', 'What are you interested in?')}\n          </span>\n          <Textarea\n            id=\"onboarding-interests\"\n            value={interests}\n            maxLength={400}\n            placeholder={t(\n              'webDashboard.onboarding.about.interestsPlaceholder',\n              'Your work, your hobbies, what you would like help with.',\n            )}\n            aria-describedby=\"onboarding-interests-hint\"\n            onChange={(event) => onInterestsChange(event.target.value)}\n            className=\"min-h-20 resize-none\"\n          />\n          <span id=\"onboarding-interests-hint\" className=\"text-sm text-po-dim\">\n            {t(\n              'webDashboard.onboarding.about.interestsHint',\n              'Optional. {name} uses it to suggest where to start. You can change it later in Settings.',\n              { name: po.name },\n            )}\n          </span>\n        </label>\n        {error ? (\n          <p role=\"alert\" className=\"text-sm text-po-red\">\n            {error}\n          </p>\n        ) : null}\n        <div className=\"flex items-center justify-between gap-2\">\n          <Button variant=\"ghost\" size=\"lg\" disabled={busy} onClick={onBack}>\n            {t('webDashboard.onboarding.about.back', 'Choose a different Po')}\n          </Button>\n          <Button variant=\"primary\" size=\"lg\" disabled={busy} onClick={onContinue}>\n            {busy ? t('webDashboard.common.saving', 'Saving…') : t('webDashboard.common.continue', 'Continue')}\n            <ArrowRightIcon className=\"size-3.5\" />\n          </Button>\n        </div>\n      </div>\n    </Step>\n  );\n}\n"],"mappings":";;;;;AAMA,SAAS,KAAK,EAAE,QAAQ,aAAoD;CAC1E,OAAO,iBAAA,GAAA,kBAAA,IAAA,CAAC,OAAD;EAAK,KAAK;EAAQ,KAAI;EAAG,eAAY;EAAO,WAAW,yBAAyB;CAAc,CAAA;AACvG;;AAGA,SAAS,KAAK,EAAE,SAAS,OAAO,OAAO,YAAqE;CAC1G,MAAM,KAAA,GAAIA,uBAAAA,KAAAA,CAAK;CACf,OACE,iBAAA,GAAA,kBAAA,IAAA,CAAC,OAAD;EAAK,WAAU;EACb,UAAA,iBAAA,GAAA,kBAAA,KAAA,CAAC,WAAD;GAAS,WAAW,8BAA8B,OAAO,cAAc;GAAvE,UAAA,CACG,UACD,iBAAA,GAAA,kBAAA,IAAA,CAAC,MAAD;IAAI,cAAY,EAAE,iCAAiC,aAAa;IAAG,WAAU;IAC1E,UAAA,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,UACX,iBAAA,GAAA,kBAAA,IAAA,CAAC,MAAD;KAEE,gBAAc,UAAU,UAAU,SAAS,KAAA;KAC3C,WAAW,yBAAyB,UAAU,UAAU,mBAAmB;IAC5E,GAHM,KAGN,CACF;GACC,CAAA,CACG;;CACN,CAAA;AAET;AAGA,MAAM,aAAa;CAAC;CAAI;CAAI;CAAI;CAAkB;AAAE;;AAGpD,SAAgB,aAAa,EAC3B,KACA,aACA,QACA,YAOC;CACD,MAAM,KAAA,GAAIA,uBAAAA,KAAAA,CAAK;CACf,OACE,iBAAA,GAAA,kBAAA,KAAA,CAAC,MAAD;EAAM,SAAS;EAAG,MAAA;EAAlB,UAAA,CACE,iBAAA,GAAA,kBAAA,KAAA,CAAC,UAAD;GAAQ,WAAU;GAAlB,UAAA;IACE,iBAAA,GAAA,kBAAA,IAAA,CA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