1var I=Object.defineProperty;var A=(t,a,s)=>a in t?I(t,a,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[a]=s;var _=(t,a,s)=>A(t,typeof a!="symbol"?a+"":a,s);import{D as B,W as D,b as M,d as $,r as g,t as v,j as e,L as P,B as R,a2 as c,c as w,o as k,H as E,A as W}from"./main-DX7XzkoU.js";import{T as z}from"./ThemeToggle-C5kzRcph.js";import{R as F}from"./rotate-ccw-xkyd1NAq.js";import"./dropdown-menu-D6liHcXh.js";import"./index-D6Z5KIMn.js";import"./chevron-right-D27HfhtL.js";import"./circle-BXmX70XD.js";import"./monitor-MvsPdGOU.js";/** 2 * @license lucide-react v0.462.0 - ISC 3 * 4 * This source code is licensed under the ISC license. 5 * See the LICENSE file in the root directory of this source tree. 6 */const G=B("Minus",[["path",{d:"M5 12h14",key:"1ays0h"}]]),H=/^[a-z0-9._]{1,30}$/i;function O(t){let a=t.trim();const s=a.match(/^(?:https?:\/\/)?(?:www\.|m\.)?instagram\.com\/([^/?#\s]+)/i);return s&&(a=s[1]),a=a.replace(/^@/,"").toLowerCase(),s&&["p","reel","reels","stories","explore","tv"].includes(a)?null:H.test(a)?a:null}const U=["invalid_handle","invalid_language","not_found","unavailable"];class T extends Error{constructor(s){super(s);_(this,"code");this.name="BusinessModelError",this.code=s}}async function K(t,a){const{data:s,error:n}=await D.functions.invoke("business-model-analysis",{body:{username:t,language:a}});if(!n&&s)return s;const r=n==null?void 0:n.context;let o=null;if(r&&typeof r.json=="function")try{o=(await r.clone().json()).error}catch{}throw new T(U.includes(o)?o:"unavailable")}const x="font-['Bricolage_Grotesque',ui-sans-serif,system-ui,sans-serif]",N=["reading","understanding","modeling"],q=5e3,le=()=>{const{t,i18n:a}=M(),[s,n]=$(),[r,o]=g.useState(s.get("u")??""),[l,h]=g.useState({kind:"idle"}),[u,f]=g.useState(0),i=g.useRef(!1),p=(a.resolvedLanguage??a.language).startsWith("pt")?"pt":"en",j=g.useCallback(async m=>{const d=O(m);if(!d){h({kind:"error",code:"invalid_handle",username:""});return}n({u:d},{replace:!0}),h({kind:"loading",username:d}),f(0),v("business_model_submit",{page:"/negocios",username:d},void 0,d);try{const b=await K(d,p);h({kind:"done",result:b}),v("business_model_result",{page:"/negocios",username:d},void 0,d),window.scrollTo({top:0,behavior:"smooth"})}catch(b){h({kind:"error",code:b instanceof T?b.code:"unavailable",username:d})}},[p,n]);g.useEffect(()=>{if(i.current)return;i.current=!0;const m=s.get("u");m&&j(m)},[j,s]),g.useEffect(()=>{if(l.kind!=="loading")return;const m=window.setInterval(()=>f(d=>Math.min(d+1,N.length-1)),q);return()=>window.clearInterval(m)},[l.kind]);const L=m=>{m.preventDefault(),j(r)},C=()=>{h({kind:"idle"}),o(""),n({},{replace:!0}),window.scrollTo({top:0,behavior:"smooth"})};return e.jsxs("div",{className:"min-h-screen bg-background text-foreground",children:[e.jsxs("header",{className:"max-w-3xl mx-auto px-4 h-14 flex items-center justify-between",children:[e.jsx(P,{to:"/",className:c(x,"font-bold text-lg tracking-tight"),children:R.name}),e.jsx(z,{})]}),e.jsx("main",{className:"max-w-3xl mx-auto px-4 pb-[calc(3rem+var(--sai-bottom,0px))]",children:l.kind==="done"?e.jsx(Y,{result:l.result,onReset:C}):e.jsxs("section",{className:"pt-8 md:pt-20",children:[e.jsx("p",{className:"text-xs font-semibold uppercase tracking-[0.18em] text-primary",children:t("businessModel.eyebrow")}),e.jsx("h1",{className:c(x,"mt-3 text-4xl md:text-6xl font-extrabold leading-[1.02] tracking-tight"),children:t("businessModel.title")}),e.jsx("p",{className:"mt-4 text-base md:text-lg text-muted-foreground max-w-xl",children:t("businessModel.subtitle")}),e.jsxs("form",{onSubmit:L,className:"mt-8 flex flex-col sm:flex-row gap-3",children:[e.jsx("label",{className:"sr-only",htmlFor:"business-model-handle",children:t("businessModel.inputLabel")}),e.jsxs("div",{className:"flex-1 flex items-center rounded-xl border-2 border-input bg-card focus-within:border-primary transition-colors",children:[e.jsx("span",{className:c(x,"pl-4 text-2xl font-bold text-primary select-none"),"aria-hidden":!0,children:"@"}),e.jsx("input",{id:"business-model-handle",value:r,onChange:m=>o(m.target.value.replace(/^\s*@+/,"")),placeholder:t("businessModel.inputPlaceholder"),autoCapitalize:"none",autoCorrect:"off",autoComplete:"off",spellCheck:!1,inputMode:"text",enterKeyHint:"go",disabled:l.kind==="loading",className:"flex-1 min-w-0 h-14 bg-transparent pl-1 pr-4 text-lg outline-none placeholder:text-muted-foreground
6/60"})]}),e.jsx(w,{type:"submit",size:"lg",className:"h-14 w-full sm:w-auto px-8 text-base",disabled:l.kind==="loading",children:l.kind==="loading"?e.jsxs(e.Fragment,{children:[e.jsx(k,{className:"w-5 h-5 animate-spin","aria-hidden":!0}),e.jsx("span",{className:"sr-only",children:t(`businessModel.loading.${N[u]}`,{username:l.username})})]}):t("businessModel.submit")})]}),e.jsx("p",{className:"mt-3 text-sm text-muted-foreground",children:t("businessModel.note")}),e.jsxs("div",{"aria-live":"polite",className:"mt-8 min-h-[4rem]",children:[l.kind==="loading"&&e.jsx("ol",{className:"space-y-2",children:N.map((m,d)=>e.jsxs("li",{className:c("flex items-center gap-3 text-sm transition-opacity duration-500",d>u?"opacity-30":"opacity-100"),children:[d<u?e.jsx(E,{className:"w-4 h-4 text-primary"}):d===u?e.jsx(k,{className:"w-4 h-4 animate-spin text-primary"}):e.jsx("span",{className:"w-4 h-4 rounded-full border border-muted-foreground/40"}),t(`businessModel.loading.${m}`,{username:l.username})]},m))}),l.kind==="error"&&e.jsx("p",{role:"alert",className:"rounded-lg bg-destructive/10 text-destructive px-4 py-3 text-sm",children:l.code==="invalid_language"?t("businessModel.errors.unavailable"):t(`businessModel.errors.${l.code}`,{username:l.username})})]})]})})]})},y=(t,a)=>new Intl.NumberFormat(a,{notation:t>=1e4?"compact":"standard",maximumFractionDigits:1}).format(t);function Y({result:t,onReset:a}){const{t:s,i18n:n}=M(),{profile:r,facts:o,analysis:l}=t,h=n.resolvedLanguage??n.language,u=l.current_model,f=[{value:y(o.followers,h),label:s("businessModel.facts.followers")},o.postsPerWeek!==null&&{value:y(o.postsPerWeek,h),label:s("businessModel.facts.postsPerWeek")},o.engagementRatePct!==null&&{value:`${y(o.engagementRatePct,h)}%`,label:s("businessModel.facts.engagement")}].filter(i=>!!i);return e.jsxs("div",{className:"pt-6 md:pt-12 space-y-10 md:space-y-14 animate-in fade-in duration-500",children:[e.jsxs("section",{children:[e.jsxs("div",{className:"flex items-center gap-3",children:[r.profilePictureUrl&&e.jsx("img",{src:r.profilePictureUrl,alt:"",className:"w-12 h-12 rounded-full object-cover bg-muted",referrerPolicy:"no-referrer",onError:i=>{i.currentTarget.style.display="none"}}),e.jsxs("div",{className:"min-w-0",children:[e.jsxs("p",{className:"font-semibold truncate",children:["@",r.username]}),r.name&&e.jsx("p",{className:"text-sm text-muted-foreground truncate",children:r.name})]})]}),e.jsx("dl",{className:"mt-4 flex flex-wrap gap-x-6 gap-y-2",children:f.map(i=>e.jsxs("div",{className:"flex items-baseline gap-1.5",children:[e.jsx("dt",{className:"sr-only",children:i.label}),e.jsx("dd",{className:c(x,"text-xl font-bold"),children:i.value}),e.jsx("span",{className:"text-sm text-muted-foreground","aria-hidden":!0,children:i.label})]},i.label))}),e.jsx("h1",{className:c(x,"mt-6 text-2xl md:text-4xl font-extrabold leading-tight tracking-tight"),children:l.headline})]}),e.jsxs("section",{"aria-labelledby":"bm-current",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[e.jsx("h2",{id:"bm-current",className:c(x,"text-xl md:text-2xl font-bold"),children:s("businessModel.current.title")}),e.jsx("span",{className:"rounded-full bg-muted px-3 py-1 text-xs font-medium",children:s(`businessModel.current.stage.${u.stage}`)})]}),e.jsx("dl",{className:"mt-4 divide-y divide-border rounded-xl border bg-card",children:[[s("businessModel.current.whatTheySell"),u.what_they_sell],[s("businessModel.current.audience"),u.audience],[s("businessModel.current.moneyIn"),u.how_money_comes_in]].map(([i,p])=>e.jsxs("div",{className:"p-4 md:p-5 md:grid md:grid-cols-[12rem_1fr] md:gap-6",children:[e.jsx("dt",{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:i}),e.jsx("dd",{className:"mt-1 md:mt-0",children:p})]},i))}),e.jsxs("div",{className:"mt-6 grid gap-6 md:grid-cols-2",children:[e.jsx(S,{title:s("businessModel.current.strengths"),items:u.strengths,tone:"plus"}),e.jsx(S,{title:s("businessModel.current.gaps"),items:u.gaps,tone:"minus"})]})]}),e.jsxs("section",{"aria-labelledby":"bm-recs",children:[e.jsx("h2",{id:"bm-recs",className:c(x,"text-xl md:text-2xl font-bold"),children:s("businessModel.recommendations.title")}),e.jsx("ol",{className:"mt-4 space-y-4",children:l.recommendations.map((i,p)=>e.jsx(J,{rec:i,rank:p+1,featured:p===0},i.model_name))}),e.jsx("p",{className:"mt-3 text-xs text-muted-foreground",children:s("businessModel.priceDisclaimer")}),l.missing_info&&e.jsx("p",{className:"mt-2 text-sm text-muted-foreground",children:s("businessModel.missingInfo",{info:l.missing_info})})]}),e.jsxs("section",{className:"rounded-2xl bg-primary text-primary-foreground p-6 md:p-8",children:[e.jsx("h2",{className:c(x,"text-2xl font-bold"),children:s("businessModel.cta.title")}),e.jsx("p",{className:"mt-2 opacity-90",children:s("businessModel.cta.description",{brand:R.name})}),e.jsx(w,{asChild:!0,size:"lg",variant:"secondary",className:"mt-5 h-12 w-full sm:w-auto",children:e.jsxs(P,{to:"/register",onClick:()=>v("business_model_cta_click",{page:"/negocios",username:r.username}),children:[s("businessModel.cta.button"),e.jsx(W,{className:"w-4 h-4 ml-2"})]})})]}),e.jsxs(w,{variant:"ghost",onClick:a,className:"h-11 w-full sm:w-auto",children:[e.jsx(F,{className:"w-4 h-4 mr-2"}),s("businessModel.again")]})]})}function S({title:t,items:a,tone:s}){const n=s==="plus"?E:G;return e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-semibold",children:t}),e.jsx("ul",{className:"mt-2 space-y-2",children:a.map(r=>e.jsxs("li",{className:"flex gap-2 text-sm",children:[e.jsx(n,{className:c("w-4 h-4 mt-0.5 shrink-0",s==="plus"?"text-emerald-600 dark:text-emerald-400":"text-destructive")}
6),e.jsx("span",{children:r})]},r))})]})}function J({rec:t,rank:a,featured:s}){const{t:n}=M();return e.jsxs("li",{className:c("rounded-xl border bg-card p-5 sm:p-6 md:p-8",s&&"border-2 border-primary shadow-[var(--shadow-card)]"),children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-xs font-medium",children:[e.jsx("span",{className:c(x,"text-base font-extrabold text-primary"),children:a}),e.jsx("span",{className:"rounded-full bg-muted px-2.5 py-1",children:n(`businessModel.recommendations.category.${t.category}`)}),s&&e.jsx("span",{className:"rounded-full bg-primary text-primary-foreground px-2.5 py-1",children:n("businessModel.recommendations.startHere")})]}),e.jsx("h3",{className:c(x,"mt-3 text-xl md:text-2xl font-bold leading-snug"),children:t.model_name}),e.jsxs("div",{className:"mt-4 grid grid-cols-2 gap-3 md:grid-cols-3",children:[e.jsxs("div",{className:"col-span-2 md:col-span-1",children:[e.jsx("p",{className:"text-xs text-muted-foreground",children:n("businessModel.recommendations.price")}),e.jsx("p",{className:c(x,"text-lg font-bold text-emerald-700 dark:text-emerald-400"),children:t.price_reference})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xs text-muted-foreground",children:n("businessModel.recommendations.timeToSale")}),e.jsx("p",{className:"font-semibold",children:t.time_to_first_sale})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xs text-muted-foreground",children:n("businessModel.recommendations.effortLabel")}),e.jsx("p",{className:"font-semibold",children:n(`businessModel.recommendations.effort.${t.effort}`)})]})]}),e.jsxs("dl",{className:"mt-5 space-y-4 text-sm md:text-base",children:[e.jsxs("div",{children:[e.jsx("dt",{className:"font-semibold",children:n("businessModel.recommendations.why")}),e.jsx("dd",{className:"mt-1 text-muted-foreground",children:t.why_it_fits})]}),e.jsxs("div",{children:[e.jsx("dt",{className:"font-semibold",children:n("businessModel.recommendations.how")}),e.jsx("dd",{className:"mt-1 text-muted-foreground",children:t.how_it_works})]}),e.jsxs("div",{children:[e.jsx("dt",{className:"font-semibold",children:n("businessModel.recommendations.firstSteps")}),e.jsx("dd",{children:e.jsx("ol",{className:"mt-2 space-y-2",children:t.first_steps.map((r,o)=>e.jsxs("li",{className:"flex gap-3",children:[e.jsx("span",{className:"flex h-6 w-6 shrink-0 items-center justify-center rounded-full bg-muted text-xs font-bold",children:o+1}),e.jsx("span",{className:"pt-0.5",children:r})]},r))})})]}),e.jsxs("div",{className:"rounded-lg bg-muted/60 p-4",children:[e.jsx("dt",{className:"font-semibold",children:n("businessModel.recommendations.contentThatSells")}),e.jsx("dd",{className:"mt-1 text-muted-foreground",children:t.content_that_sells})]})]})]})}export{le as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.