PageSourceSearch

https://www.instagem.ai/assets/ReelCoverCreationPage-DbU3o-uD.js

js instagem.ai collected 2026-10-05 12:05:16 UTC 5,592 bytes, 1 lines download raw bytes

1import{b as I,r as a,j as e,z as y,af as L,a as T,E as G,u as O,G as D,aM as A,al as H,W as R,cb as B,aN as z,c as F}from"./main-DX7XzkoU.js";import{D as V}from"./DashboardLoading-DZLzzgDQ.js";import{M as X}from"./MediaLibraryModal-BCoaB8Tw.js";import{C as W,a as $,P as q,L as J,G as K}from"./CreationFormParts-pRbhBlNa.js";import{a as S,b as Q,c as U,d as k}from"./reel-cover-DGekiYGs.js";import{I as Y}from"./image-play-FzvV3P2U.js";import{u as Z}from"./useProfileRedirect-DxHBy1EC.js";import{u as ee}from"./useSubscriptionErrors-Cz5UkWh8.js";import{I as re}from"./instagram-uOX4SJX4.js";import{P as te}from"./plus-C6FQ2-b-.js";import"./gem-DGeoeC5P.js";import"./scroll-area-D4uBgFjC.js";import"./tabs-BuRg9jtd.js";import"./index-D6Z5KIMn.js";import"./imageCompression-CmCw4g5L.js";import"./image-file-BbkB38iy.js";import"./search-Du1BtiHK.js";import"./image-BBUOngQh.js";import"./upload-CRdrqrw1.js";import"./eye-DTdVPMB0.js";import"./trash-2-pjGqSJFK.js";import"./switch-9pzURn_w.js";import"./routes-Dh-CjbFu.js";import"./arrow-left-Cf41rOjY.js";import"./image-plus-B8KpqAee.js";import"./chevron-right-D27HfhtL.js";import"./routes-C6M2Yg1X.js";const ae=({instagramProfileId:v,hasLogo:p,onGenerate:s,isGenerating:t,onBack:h,onShowPricingModal:x,canGenerateImages:o})=>{const{t:r}=I(),[l,c]=a.useState(""),[d,m]=a.useState(""),[j,C]=a.useState(!1),[i,f]=a.useState(null),[E,b]=a.useState(!1),u=!t&&l.trim().length>0,N=()=>
1{if(u){if(!o){x();return}s(l.trim(),d.trim(),i?[i.file_path]:void 0,j&&p)}};return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"space-y-6 pb-28 animate-in fade-in duration-500 md:pb-0",children:[e.jsx(W,{title:r("create.reel_cover"),subtitle:r("reelCover.subtitle"),onBack:h}),e.jsxs("div",{className:"max-w-2xl space-y-6",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(y,{htmlFor:"reel-cover-text",className:"text-sm font-semibold",children:r("reelCover.textLabel")}),e.jsx(L,{id:"reel-cover-text",placeholder:r("reelCover.textPlaceholder"),value:l,maxLength:S,onChange:n=>c(n.target.value),"aria-describedby":"reel-cover-text-hint",className:"min-h-[6rem] resize-none bg-surface-card text-base font-semibold leading-snug"}),e.jsxs("div",{id:"reel-cover-text-hint",className:"flex justify-between gap-3 text-xs text-muted-foreground",children:[e.jsx("span",{children:r("reelCover.textHint")}),e.jsxs("span",{className:"shrink-0 tabular-nums",children:[l.length,"/",S]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(y,{htmlFor:"reel-cover-scene",className:"text-sm font-semibold",children:[r("reelCover.sceneLabel")," ",e.jsx("span",{className:"font-normal text-muted-foreground",children:r("creation.optionalInline")})]}),e.jsx(L,{id:"reel-cover-scene",placeholder:r("reelCover.scenePlaceholder"),value:d,maxLength:Q,onChange:n=>m(n.target.value),className:"min-h-[5.5rem] resize-none bg-surface-card text-base leading-relaxed"})]}),e.jsxs($,{children:[e.jsx(q,{label:r("creation.photoLabel"),photo:i,onChoose:()=>b(!0),onRemove:()=>f(null)}),e.jsx(J,{checked:j,onCheckedChange:C,hasLogo:p,profileId:v})]}),e.jsx(K,{label:r("reelCover.generate"),icon:e.jsx(Y,{className:"h-5 w-5"}),isGenerating:t,disabled:!u,onClick:N})]})]}),e.jsx(X,{isOpen:E,onClose:()=>b(!1),onSelect:n=>{f(n[0]??null),b(!1)},instagramProfileId:v,maxSelection:1})]})},ke=()=>{const[v,p]=a.useState(!1),s=T(),{t}=I(),{toast:h}=G(),{user:x}=O(),{selectedProfile:o,profilesLoading:r,hasInitialized:l}=D(),{openPricingModal:c}=A(),{loading:d,isSubscribed:m,canGenerateImages:j,error:C}=H();Z(),ee(C);const i=a.useCallback(()=>{c({onDismiss:()=>{m||s("/dashboard")}})},[c,m,s]),f=a.useRef(!1);a.useEffect(()=>{d||m||f.current||(f.current=!0,i())},[d,m,i]);const E=a.useCallback(()=>s("/dashboard",{replace:!0}),[s]),b=a.useCallback(async(u,N,n,M)=>{if(!(!x||!o)){if(U(u)){h({title:t("common.error"),description:t("reelCover.textReserved"),variant:"destructive"});return}p(!0);try{const{data:g,error:_}=await R.from("posts").insert({user_id:x.id,instagram_profile_id:o.id,title:u,content_type:"reel_cover",aspect_ratio:k,status:"creating",creation_platform:B(),form_data:{coverText:u,sceneDescription:N,photoPaths:n??[],includeLogo:M,aspectRatio:k,type:"reel_cover"}}).select("id").single();if(_||!g)throw _??new Error("Post not created");const{data:P,error:w}=await R.functions.invoke("generate-reel-cover",{body:{postId:g.id}});if(w)throw w;if((P==null?void 0:P.error)==="LIMIT_REACHED"){c();return}s(`/dashboard/post/${g.id}`)}catch(g){z.error("[ReelCover] Falha ao criar capa",{error:g}),h({title:t("common.error"),description:t("reelCover.createError"),variant:"destructive"})}finally{p(!1)}}},[x,o,s,c,h,t]);return d||r||!l?e.jsx(V,{}):o?e.jsx("div",{className:"min-h-screen bg-background",children:e.jsx("div",{className:"max-w-4xl mx-auto px-4 py-6 md:py-8",children:e.jsx(ae,{instagramProfileId:o.id,hasLogo:!!o.logo_url,onGenerate:b,isGenerating:v,onBack:E,onShowPricingModal:i,canGenerateImages:j})})}):e.jsxs("div",{className:"min-h-screen flex flex-col items-center justify-center p-4",children:[e.jsx("div",{className:"w-20 h-20 rounded-full bg-gradient-to-br from-purple-500/10 to-pink-500/10 flex items-center justify-center mb-6",children:e.jsx(re,{className:"w-10 h-10 text-primary"})}),e.jsx("h2",{className:"text-xl font-semibold mb-2",children:t("dashboard.selectProfile")}),e.jsx("p",{className:"text-muted-foreground text-center mb-6 max-w-sm",children:t("dashboard.selectProfileDescription")}),e.jsxs(F,{onClick:()=>s("/add-instagram"),children:[e.jsx(te,{className:"w-4 h-4 mr-2"}),t("dashboard.addProfile")]})]})};export{ke 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.