1!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},s=(new e.Error).stack;s&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[s]="38cbc766-c7a0-439f-9662-74bc1025de9c",e._sentryDebugIdIdentifier="sentry-dbid-38cbc766-c7a0-439f-9662-74bc1025de9c")}catch(e){}}();"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4470],{9280:(e,s,t)=>{t.d(s,{v:()=>c});var a=t(54568),r=t(67842),n=t(74328),l=t(27261),i=t.n(l),o=t(27098),d=t(94644);function c(e){let{open:s,onOpenChange:t}=e;return(0,a.jsx)(r.lG,{open:s,onOpenChange:t,children:(0,a.jsxs)(r.Cf,{className:"max-w-[90%] md:min-w-[900px] max-h-[90vh] overflow-y-scroll p-0 dark:bg-[#0f0f10] bg-white p-2",children:[(0,a.jsxs)(r.c7,{className:"px-6 pt-8 w-fit mx-auto text-center",children:[(0,a.jsxs)(r.L3,{className:"text-2xl font-medium flex items-center gap-2 w-fit mx-auto",children:[(0,a.jsx)(d.LogoIcon,{className:"w-8 h-8"})," Upgrade your plan"]}),(0,a.jsx)("p",{className:"text-sm text-muted-foreground",children:"Start building amazing applications with AI agents."})]}),(0,a.jsxs)("div",{className:"p-6 pt-2",children:[(0,a.jsx)(o.o,{tiers:n.T.slice(0,3),onCheckoutOpen:()=>t(!1),onCheckoutClose:()=>t(!0)}),(0,a.jsxs)("div",{className:"mt-8 text-center text-sm text-muted-foreground",children:["Compare plans and options on our"," ",(0,a.jsx)(i(),{href:"/pricing",className:"text-blue-500 hover:underline",children:"pricing page â"})]})]})]})})}},30362:(e,s,t)=>{t.d(s,{V:()=>v});var a=t(54568),r=t(7620),n=t(22710),l=t(25118),i=t(35972),o=t(61641),d=t(51874),c=t(59725),m=t(72940),u=t(46024),x=t(14263),p=t(66168),h=t(9387),g=t(71623),j=t(67933);function f(e){let{className:s}=e;return(0,a.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 384 512",fill:"currentColor",className:null!=s?s:"h-4 w-4",children:(0,a.jsx)("path",{d:"M318.7 268.7c-.2-36.7 16.4-64.4 50-84.8-18.8-26.9-47.2-41.7-84.7-44.6-35.5-2.8-74.3 20.7-88.5 20.7-15 0-49.4-19.7-76.4-19.7C63.3 141.2 4 184.8 4 273.5q0 39.3 14.4 81.2c12.8 36.7 59 126.7 107.2 125.2 25.2-.6 43-17.9 75.8-17.9 31.8 0 48.3 17.9 76.4 17.9 48.6-.7 90.4-82.5 102.6-119.3-65.2-30.7-61.7-90-61.7-91.9zm-56.6-164.2c27.3-32.4 24.8-61.9 24-72.5-24.1 1.4-52 16.4-67.9 34.9-17.5 19.8-27.8 44.3-25.6 71.9 26.1 2 49.9-11.4 69.5-34.3z"})})}function v(e){let{projectId:s}=e,t=(0,g.n6)(),v=(0,g._K)(),[b,y]=(0,r.useState)(""),[N,w]=(0,r.useState)(""),[k,A]=(0,r.useState)(""),[C,S]=(0,r.useState)(""),[R,P]=(0,r.useState)(""),[_,z]=(0,r.useState)(!1),[I,E]=(0,r.useState)(!1),[O,F]=(0,r.useState)(!1),[D,T]=(0,r.useState)(!1),L=(0,r.useRef)(null),{data:U,isLoading:G,refetch:M}=(0,j.I)(t.project.getAppleCredentials.queryOptions({projectId:s})),{data:$,isLoading:K}=(0,j.I)(t.user.getAppleCredentials.queryOptions()),B=(null==U?void 0:U.configured)===!0,Y=(null==$?void 0:$.configured)===!0,J=async()=>{if(!b.trim())return void d.oR.error("Please upload your .p8 key file");if(!k.trim()||!C.trim()||!R.trim())return void d.oR.error("Please fill in all fields");z(!0);try{let e={p8Content:b.trim(),keyId:k.trim(),issuerId:C.trim(),teamId:R.trim()};await v.project.saveAppleCredentials.mutate({projectId:s,...e}),D&&await v.user.saveAppleCredentials.mutate(e),d.oR.success(D?"Credentials saved to project and your account!":"Apple Developer credentials saved!"),y(""),w(""),A(""),S(""),P(""),T(!1),await M()}catch(e){d.oR.error((null==e?void 0:e.message)||"Failed to save credentials")}finally{z(!1)}},q=async()=>{F(!0);try{await v.project.useUserAppleCredentials.mutate({projectId:s}),d.oR.success("Saved credentials applied to this project!"),await M()}catch(e){d.oR.error((null==e?void 0:e.message)||"Failed to apply saved credentials")}finally{F(!1)}},V=async()=>{E(!0);try{await v.project.deleteAppleCredentials.mutate({projectId:s}),d.oR.success("Apple Developer credentials removed"),await M()}catch(e){d.oR.error((null==e?void 0:e.message)||"Failed to remove credentials")}finally{E(!1)}};return G||K?(0,a.jsxs)("div",{className:"flex items-center justify-center py-12",children:[(0,a.jsx)(m.A,{className:"w-5 h-5 animate-spin text-muted-foreground"}),(0,a.jsx)("span",{className:"ml-2 text-sm text-muted-foreground",children:"Loading..."})]}):B?(0,a.jsxs)("div",{className:"space-y-6",children:[(0,a.jsx)("div",{children:(0,a.jsxs)("h3",{className:"text-lg font-medium flex items-center gap-2",children:[(0,a.jsx)(f,{}),"Apple Developer"]})}),(0,a.jsxs)("div",{className:"flex items-center justify-between p-3 rounded-lg border bg-green-50/50 dark:bg-green-950/20",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)("div",{className:"w-8 h-8 rounded-md bg-green-100 dark:bg-green-900/30 flex items-center justify-center",children:(0,a.jsx)(u.A,{className:"w-4 h-4 text-green-600 dark:text-green-400"})}),(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"font-medium text-sm",children:"App Store Connect API Key"}),(0,a.jsxs)("div",{className:"text-xs text-muted-foreground",children:["Key ID: ",U.keyId]})]})]}),(0,a.jsxs)(c.Lt,{children:[(0,a.jsx)(c.tv,{asChild:!0,children:(0,a.jsx)(n.$,{variant:"ghost",size:"sm",disabled:I,children:I?(0,a.jsx)(m.A,{className:"w-4 h-4 animate-spin"}):(0,a.jsx)(x.A,{className:"w-4 h-4"})})}),(0,a.jsxs)(c.EO,{children:[(0,a.jsxs)(c.wd,{children:[(0,a.jsx)(c.r7,{children:"Remove Apple Developer Credentials"}),(0,a.jsx)(c.$v,{children:"This will remove your App Store Connect API Key from this project. You won't be able to build iOS apps until you add new credentials."})]}),(0,a.jsxs)(c.ck,{children:[(0,a.jsx)(c.Zr,{children:"Cancel"}),(0,a.jsx)(c.Rx,{onClick:V,className:"bg-red-600 hover:bg-red-700",children:"Remove"})]})]})]})]}),(0,a.jsx)("p",{className:"text-xs text-muted-foreground",children:"Your credentials are encrypted and stored securely. They are only used during iOS builds to sign your app."})]}):(0,a.jsx)("div",{className:"space-y-6",children:(0,a.jsxs)("div",{className:"text-center py-8 px-6",children:[(0,a.jsx)("div",{className:"mb-6",children:(0,a.jsx)("div",{className:"inline-flex items-center justify-center w-16 h-16 rounded-full mb-4 bg-gray-50 dark:bg-gray-900/30",children:(0,a.jsx)(f,{className:"h-8 w-8"})})}),(0,a.jsx)("h3",{className:"text-xl font-semibold text-foreground mb-2",children:"Connect Your Apple Developer Account"}),(0,a.jsx)("p",{className:"text-sm text-muted-foreground mb-6 max-w-sm mx-auto",children:"Add your Ap
1p Store Connect API Key to enable iOS builds. This key is used to sign your app for distribution on the App Store and TestFlight."}),Y&&(0,a.jsxs)("div",{className:"w-full max-w-sm mx-auto mb-6",children:[(0,a.jsxs)("button",{type:"button",onClick:q,disabled:O,className:"w-full flex items-center gap-3 p-3 rounded-lg border border-primary/30 bg-primary/5 hover:bg-primary/10 transition-colors text-left",children:[(0,a.jsx)("div",{className:"w-8 h-8 rounded-md bg-primary/10 flex items-center justify-center shrink-0",children:O?(0,a.jsx)(m.A,{className:"w-4 h-4 animate-spin text-primary"}):(0,a.jsx)(p.A,{className:"w-4 h-4 text-primary"})}),(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsx)("div",{className:"font-medium text-sm",children:"Use saved credentials"}),(0,a.jsxs)("div",{className:"text-xs text-muted-foreground truncate",children:["Key ID: ",$.keyId," \xb7 Team: ",$.teamId]})]})]}),(0,a.jsxs)("div",{className:"relative my-4",children:[(0,a.jsx)("div",{className:"absolute inset-0 flex items-center",children:(0,a.jsx)("div",{className:"w-full border-t border-border"})}),(0,a.jsx)("div",{className:"relative flex justify-center text-xs",children:(0,a.jsx)("span",{className:"bg-background px-2 text-muted-foreground",children:"or upload new credentials"})})]})]}),(0,a.jsxs)("div",{className:"space-y-4 w-full max-w-sm mx-auto text-left",children:[(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsx)(i.J,{className:"text-sm font-medium",children:"API Key (.p8 file)"}),(0,a.jsx)("input",{ref:L,type:"file",accept:".p8",className:"hidden",onChange:e=>{var s;let t=null==(s=e.target.files)?void 0:s[0];if(!t)return;if(!t.name.endsWith(".p8"))return void d.oR.error("Please upload a .p8 file");let a=new FileReader;a.onload=e=>{var s;y(null==(s=e.target)?void 0:s.result),w(t.name)},a.readAsText(t),e.target.value=""}}),(0,a.jsxs)("button",{type:"button",onClick:()=>{var e;return null==(e=L.current)?void 0:e.click()},className:"w-full flex items-center gap-3 px-3 py-2.5 rounded-lg border border-dashed border-border hover:border-foreground
1/30 transition-colors bg-muted/30",children:[(0,a.jsx)(h.A,{className:"w-4 h-4 text-muted-foreground shrink-0"}),(0,a.jsx)("span",{className:"text-sm text-muted-foreground truncate",children:N||"Upload AuthKey_XXXXXXXXXX.p8"})]})]}),(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsx)(i.J,{htmlFor:"apple-key-id",className:"text-sm font-medium",children:"Key ID"}),(0,a.jsx)(l.p,{id:"apple-key-id",value:k,onChange:e=>A(e.target.value),placeholder:"e.g., ABC123DEFG",disabled:_})]}),(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsx)(i.J,{htmlFor:"apple-issuer-id",className:"text-sm font-medium",children:"Issuer ID"}),(0,a.jsx)(l.p,{id:"apple-issuer-id",value:C,onChange:e=>S(e.target.value),placeholder:"e.g., 12345678-1234-1234-1234-123456789012",disabled:_})]}),(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsx)(i.J,{htmlFor:"apple-team-id",className:"text-sm font-medium",children:"Team ID"}),(0,a.jsx)(l.p,{id:"apple-team-id",value:R,onChange:e=>P(e.target.value),placeholder:"e.g., A1B2C3D4E5",disabled:_})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(o.S,{id:"save-to-account",checked:D,onCheckedChange:e=>T(!0===e)}),(0,a.jsx)(i.J,{htmlFor:"save-to-account",className:"text-sm text-muted-foreground cursor-pointer",children:"Save to my account for use in other projects"})]}),(0,a.jsx)(n.$,{size:"sm",onClick:J,disabled:!b.trim()||!k.trim()||!C.trim()||!R.trim()||_,className:"w-full text-white dark:text-black",children:_?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(m.A,{className:"w-4 h-4 mr-2 animate-spin"}),"Saving..."]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(u.A,{className:"w-4 h-4 mr-2"}),"Save Credentials"]})}),(0,a.jsxs)("p",{className:"text-xs text-muted-foreground",children:["You can create an API Key in"," ",(0,a.jsx)("a",{href:"https://appstoreconnect.apple.com/access/integrations/api",target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:"App Store Connect â Keys"}),'. Select "Admin" access and note down the Key ID, Issuer ID, and Team ID.']})]})]})})}},46266:(e,s,t)=>{t.d(s,{TR:()=>p,bq:()=>u,eb:()=>h,gC:()=>x,l6:()=>d,s3:()=>c,yv:()=>m});var a=t(54568);t(7620);var r=t(93709),n=t(60276),l=t(26918),i=t(46005),o=t(99749);function d(e){let{...s}=e;return(0,a.jsx)(r.bL,{"data-slot":"select",...s})}function c(e){let{...s}=e;return(0,a.jsx)(r.YJ,{"data-slot":"select-group",...s})}function m(e){let{...s}=e;return(0,a.jsx)(r.WT,{"data-slot":"select-value",...s})}function u(e){let{className:s,size:t="default",children:l,...i}=e;return(0,a.jsxs)(r.l9,{"data-slot":"select-trigger","data-size":t,className:(0,o.cn)("border-input data-[placeholder]:text-muted-foreground [&_svg:not([class*='text-'])]:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 dark:hover:bg-input/50 flex w-fit items-center justify-between gap-2 rounded-md border bg-transparent px-3 py-2 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 cursor-pointer",s),...i,children:[l,(0,a.jsx)(r.In,{asChild:!0,children:(0,a.jsx)(n.A,{className:"size-4 opacity-50"})})]})}function x(e){let{className:s,children:t,position:n="popper",...l}=e;return(0,a.jsx)(r.ZL,{children:(0,a.jsxs)(r.UC,{"data-slot":"select-content",className:(0,o.cn)("t-dropdown bg-popover text-popover-foreground relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border shadow-md","popper"===n&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",s),position:n,...l,children:[(0,a.jsx)(g,{}),(0,a.jsx)(r.LM,{className:(0,o.cn)("p-1","popper"===n&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"),children:t}),(0,a.jsx)(j,{})]})})}function p(e){let{className:s,...t}=e;return(0,a.jsx)(r.JU,{"data-slot":"select-label",className:(0,o.cn)("text-muted-foreground px-2 py-1.5 text-xs",s),...t})}function h(e){let{className:s,children:t,...n}=e;return(0,a.jsxs)(r.q7,{"data-slot":"select-item",className:(0,o.cn)("focus:bg-accent focus:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",s),...n,children:[(0,a.jsx)("span",{className:"absolute right-2 flex size-3.5 items-center justify-center",children:(0,a.jsx)(r.VF,{children:(0,a.jsx)(l.A,{className:"size-4"})})}),(0,a.jsx)(r.p4,{children:t})]})}function g(e){let{className:s,...t}=e;return(0,a.jsx)(r.PP,{"data-slot":"select-scroll-up-button",className:(0,o.cn)("flex cursor-default items-center justify-center py-1",s),...t,children:(0,a.jsx)(i.A,{className:"size-4"})})}function j(e){let{className:s,...t}=e;return(0,a.jsx)(r.wn,{"data-slot":"select-scroll-down-button",className:(0,o.cn)("flex cursor-default items-center justify-center py-1",s),...t,children:(0,a.jsx)(n.A,{className:"size-4"})})}},59725:(e,s,t)=>{t.d(s,{$v:()=>h,EO:()=>m,Lt:()=>i,Rx:()=>g,Zr:()=>j,ck:()=>x,r7:()=>p,tv:()=>o,wd:()=>u});var a=t(54568);t(7620);var r=t(84160),n=t(99749),l=t(22710);function i(e){let{...s}=e;return(0,a.jsx)(r.bL,{"data-slot":"alert-dialog",...s})}function o(e){let{...s}=e;return(0,a.jsx)(r.l9,{"data-slot":"alert-dialog-trigger",...s})}function d(e){let{...s}=e;return(0,a.jsx)(r.ZL,{"data-slot":"alert-dialog-portal",...s})}function c(e){let{className:s,...t}=e;return(0,a.jsx)(r.hJ,{"data-slot":"alert-dialog-overlay",className:(0,n.cn)("t-backdrop fixed inset-0 z-50 bg-black/50",s),...t})}function m(e){let{className:s,...t}=e;return(0,a.jsxs)(d,{children:[(0,a.jsx)(c,{}),(0,a.jsx)(r.UC,{"data-slot":"alert-dialog-content",className:(0,n.cn)("t-modal bg-background fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 roun
1ded-lg border p-6 shadow-lg sm:max-w-lg",s),...t})]})}function u(e){let{className:s,...t}=e;return(0,a.jsx)("div",{"data-slot":"alert-dialog-header",className:(0,n.cn)("flex flex-col gap-2 text-center sm:text-left",s),...t})}function x(e){let{className:s,...t}=e;return(0,a.jsx)("div",{"data-slot":"alert-dialog-footer",className:(0,n.cn)("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",s),...t})}function p(e){let{className:s,...t}=e;return(0,a.jsx)(r.hE,{"data-slot":"alert-dialog-title",className:(0,n.cn)("text-lg font-semibold",s),...t})}function h(e){let{className:s,...t}=e;return(0,a.jsx)(r.VY,{"data-slot":"alert-dialog-description",className:(0,n.cn)("text-muted-foreground text-sm",s),...t})}function g(e){let{className:s,...t}=e;return(0,a.jsx)(r.rc,{className:(0,n.cn)((0,l.r)(),s),...t})}function j(e){let{className:s,...t}=e;return(0,a.jsx)(r.ZD,{className:(0,n.cn)((0,l.r)({variant:"outline"}),s),...t})}},61641:(e,s,t)=>{t.d(s,{S:()=>i});var a=t(54568);t(7620);var r=t(23180),n=t(26918),l=t(99749);function i(e){let{className:s,...t}=e;return(0,a.jsx)(r.bL,{"data-slot":"checkbox",className:(0,l.cn)("t-check peer border-input dark:bg-input/30 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground dark:data-[state=checked]:bg-primary data-[state=checked]:border-primary focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive size-4 shrink-0 rounded-[4px] border shadow-xs outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",s),...t,children:(0,a.jsx)(r.C1,{forceMount:!0,"data-slot":"checkbox-indicator",className:"flex items-center justify-center text-current transition-none",children:(0,a.jsx)(n.A,{className:"size-3.5"})})})}},65330:(e,s,t)=>{t.d(s,{E:()=>b});var a=t(54568),r=t(7620),n=t(61355),l=t(5796),i=t(22710),o=t(25118),d=t(8328),c=t(11218),m=t(8031),u=t(66784),x=t(33919),p=t(44160),h=t(14263),g=t(51874),j=t(41240),f=t(9280),v=t(86526);function b(e){let{projectId:s}=e,{project:t}=(0,j.By)({projectId:s}),[b,y]=(0,r.useState)(""),[N,w]=(0,r.useState)(new Set),[k,A]=(0,r.useState)(new Set),[C,S]=(0,r.useState)(!1),{data:R}=(0,j.yj)(),{openSettings:P}=(0,v.t)(),{query:_,domains:z,invalidateCustomDomains:I}=(0,j._k)({projectId:s}),{addCustomDomain:E}=(0,j.w7)(),{deleteCustomDomain:O}=(0,j.wt)(),{canAddCustomDomainData:F,query:D}=(0,j.kQ)({projectId:s}),{deployProject:T}=(0,j.AZ)(),L=_.isLoading||D.isLoading,U=E.isPending;(0,r.useEffect)(()=>{let e=setInterval(()=>{z.some(e=>!e.verified)&&!L&&I()},3e4);return()=>clearInterval(e)},[s,z.length,L,I]);let G=async()=>{if(!(null==R?void 0:R.permissions.canAddCustomDomain)){S(!0),g.oR.error("You need to upgrade to a paid plan to connect domains");return}if(F&&!F.canBeAdded)return void("PROJECT_NOT_DEPLOYED_IN_PRODUCTION"===F.reason?g.oR.error("Please publish your project first"):g.oR.error("Cannot add custom domains at this time"));if(!b.trim())return void g.oR.error("Please enter a domain name");try{let e=await E.mutateAsync({projectId:s,domain:b.trim()});if(!1===e.success){let s=e.error;if("DOMAIN_ALREADY_ADDED"===s)return void g.oR.error("This domain is already connected to this project");if("PROTECTED_DOMAIN_NOT_AUTHORIZED"===s)return void g.oR.error("This domain is reserved and cannot be used as a custom domain. Please use a domain you own.")}y(""),g.oR.success("Domain connection initiated")}catch(s){var e,t,a;(null==(e=s.message)?void 0:e.includes("already exists"))?g.oR.error("Domain already connected to another project"):(null==(t=s.message)?void 0:t.includes("Invalid domain"))?g.oR.error("Invalid domain format"):(null==(a=s.message)?void 0:a.includes("don't have permission"))?(g.oR.error("Please upgrade your plan to add custom domains"),P("Billing")):g.oR.error(s.message||"Failed to connect domain")}},M=async e=>{w(s=>new Set([...s,e]));try{await O.mutateAsync({projectId:s,domain:e}),g.oR.success("Domain removed")}catch(e){g.oR.error(e.message||"Failed to remove domain")}finally{w(s=>{let t=new Set(s);return t.delete(e),t})}},$=async()=>{try{await T.mutateAsync({projectId:s,targetEnv:"production"}),g.oR.success("Your project is being published")}catch(e){g.oR.error(e.message||"Failed to publish your project")}},K=e=>{navigator.clipboard.writeText(e),g.oR.success("Copied to clipboard")};return L?(0,a.jsx)("div",{className:"space-y-4",children:(0,a.jsxs)("div",{className:"animate-pulse space-y-3",children:[(0,a.jsx)("div",{className:"h-5 bg-muted rounded w-24"}),(0,a.jsx)("div",{className:"h-12 bg-muted rounded"}),(0,a.jsx)("div",{className:"h-12 bg-muted rounded"})]})}):(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("h2",{className:"text-sm font-semibold",children:"Domains"}),(0,a.jsx)("p",{className:"text-xs text-muted-foreground mt-0.5",children:"Connect custom domains to your project."})]}),(0,a.jsx)(f.v,{open:C,onOpenChange:S}),(null==R?void 0:R.permissions.canAddCustomDomain)?F&&!F.canBeAdded&&"PROJECT_NOT_DEPLOYED_IN_PRODUCTION"===F.reason?(0,a.jsxs)("div",{className:"rounded-lg border bg-muted/30 p-4",children:[(0,a.jsx)("p",{className:"text-sm font-medium",children:"Publish your project first"}),(0,a.jsx)("p",{className:"text-xs text-muted-foreground mt-1",children:"You need to publish your project before adding custom domains."}),(0,a.jsx)(i.$,{size:"sm",onClick:$,disabled:T.isPending,className:"mt-3 h-7 text-xs",children:T.isPending||(null==t?void 0:t.publishStatus)==="BEING_PUBLISHED"?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(c.A,{className:"w-3 h-3 animate-spin"}),"Publishing..."]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(d.A,{className:"w-3 h-3"}),"Publish"]})})]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("div",{className:"divide-y",children:(0,a.jsx)(n.N,{mode:"popLayout",children:[...z].sort((e,s)=>{if(!e.verified&&s.verified)return -1;if(e.verified&&!s.verified)return 1;let t=!1!==e.removable,a=!1!==s.removable;return t&&!a?-1:!t&&a?1:e.domain.localeCompare(s.domain)}).map(e=>(0,a.jsx)(l.PY1.div,{initial:{opacity:0,height:0}
1,animate:{opacity:1,height:"auto"},exit:{opacity:0,height:0},transition:{duration:.2},className:N.has(e.domain)?"opacity-50 pointer-events-none":"",children:(0,a.jsxs)("div",{className:"py-3 space-y-2",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between gap-2 group",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2.5 min-w-0",children:[(0,a.jsx)(m.A,{className:"w-3.5 h-3.5 text-muted-foreground shrink-0"}),(0,a.jsx)("span",{className:"text-sm font-medium truncate",children:e.domain}),e.verified?(0,a.jsxs)("span",{className:"flex items-center gap-1 shrink-0",children:[(0,a.jsx)("span",{className:"w-1.5 h-1.5 rounded-full bg-emerald-500"}),(0,a.jsx)("span",{className:"text-[11px] text-emerald-600 dark:text-emerald-400",children:"Verified"})]}):(0,a.jsxs)("span",{className:"flex items-center gap-1 shrink-0",children:[(0,a.jsx)("span",{className:"w-1.5 h-1.5 rounded-full bg-amber-500 animate-pulse"}),(0,a.jsx)("span",{className:"text-[11px] text-amber-600 dark:text-amber-400",children:"Pending"})]}),e.certStatus&&(0,a.jsxs)("span",{className:"text-[11px] text-muted-foreground",children:["(",e.certStatus,")"]})]}),(0,a.jsxs)("div",{className:"flex items-center gap-0.5 opacity-0 group-hover:opacity-100 transition-opacity shrink-0",children:[e.verification.length>0&&(0,a.jsx)("button",{type:"button",onClick:()=>A(s=>{let t=new Set(s);return t.has(e.domain)?t.delete(e.domain):t.add(e.domain),t}),className:"text-muted-foreground hover:text-foreground transition-colors p-1 rounded hover:bg-muted",children:(0,a.jsx)(u.A,{className:"w-3 h-3"})}),(0,a.jsx)("button",{type:"button",onClick:()=>K(e.domain),className:"text-muted-foreground hover:text-foreground transition-colors p-1 rounded hover:bg-muted",children:(0,a.jsx)(x.A,{className:"w-3 h-3"})}),(0,a.jsx)("a",{href:"https://".concat(e.domain),target:"_blank",rel:"noopener noreferrer",className:"text-muted-foreground hover:text-foreground transition-colors p-1 rounded hover:bg-muted",children:(0,a.jsx)(p.A,{className:"w-3 h-3"})}),!1!==e.removable&&(0,a.jsx)("button",{type:"button",onClick:()=>M(e.domain),disabled:N.has(e.domain),className:"text-muted-foreground hover:text-red-500 transition-colors p-1 rounded hover:bg-red-50 dark:hover:bg-red-500/10 disabled:opacity-50",children:N.has(e.domain)?(0,a.jsx)(c.A,{className:"w-3 h-3 animate-spin"}):(0,a.jsx)(h.A,{className:"w-3 h-3"})})]})]}),e.verification.length>0&&(!e.verified||k.has(e.domain))&&(0,a.jsxs)("div",{className:"ml-6 space-y-2",children:[(0,a.jsx)("p",{className:"text-xs text-muted-foreground",children:e.verified?"DNS records for this domain:":"Add these DNS records to verify your domain:"}),(0,a.jsx)("div",{className:"space-y-1.5",children:e.verification.map((e,s)=>(0,a.jsxs)("div",{className:"bg-muted rounded-md p-2.5 text-xs font-mono space-y-1",children:[(0,a.jsx)("div",{className:"text-muted-foreground",children:e.type}),(0,a.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,a.jsx)("span",{className:"text-muted-foreground text-[11px] shrink-0 w-10",children:"Name"}),(0,a.jsx)("span",{className:"flex-1 truncate",children:e.domain||e.name}),(0,a.jsx)("button",{type:"button",onClick:()=>{var s;return K(null!=(s=e.domain||e.name)?s:"")},className:"text-muted-foreground hover:text-foreground p-0.5 rounded hover:bg-background shrink-0",children:(0,a.jsx)(x.A,{className:"w-3 h-3"})})]}),(0,a.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,a.jsx)("span",{className:"text-muted-foreground text-[11px] shrink-0 w-10",children:"Value"}),(0,a.jsx)("span",{className:"flex-1 truncate",children:e.value}),(0,a.jsx)("button",{type:"button",onClick:()=>{var s;return K(null!=(s=e.value)?s:"")},className:"text-muted-foreground hover:text-foreground p-0.5 rounded hover:bg-background shrink-0",children:(0,a.jsx)(x.A,{className:"w-3 h-3"})})]})]},s))}),!e.verified&&(0,a.jsx)("p",{className:"text-[11px] text-muted-foreground",children:"DNS changes can take up to 24 hours to propagate. Most domains verify within 15 minutes."})]})]})},e.domain))})}),(0,a.jsxs)("div",{className:"flex gap-2 pt-1",children:[(0,a.jsx)(o.p,{type:"text",placeholder:"example.com",value:b,onChange:e=>y(e.target.value),onKeyDown:e=>{"Enter"===e.key&&G()},className:"h-8 text-sm"}),(0,a.jsx)(i.$,{size:"sm",onClick:G,disabled:U||!b.trim()||!!F&&!F.canBeAdded,className:"h-8 px-4 shrink-0",children:U?"Connecting...":"Connect"})]})]}):(0,a.jsxs)("div",{className:"rounded-lg border bg-muted/30 p-4",children:[(0,a.jsx)("p",{className:"text-sm font-medium",children:"Upgrade to add custom domains"}),(0,a.jsx)("p",{className:"text-xs text-muted-foreground mt-1",children:"Custom domains are available on paid plans."}),(0,a.jsxs)(i.$,{size:"sm",onClick:()=>P("Billing"),className:"mt-3 h-7 text-xs",children:[(0,a.jsx)(d.A,{className:"w-3 h-3"}),"Upgrade"]})]})]})}},66535:(e,s,t)=>{t.d(s,{E:()=>o});var a=t(54568);t(7620);
1var r=t(58218),n=t(615),l=t(99749);let i=(0,n.F)("inline-flex items-center justify-center rounded-md border px-2 py-0.5 text-xs font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-[color,box-shadow] overflow-hidden",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground [a&]:hover:bg-primary/90",secondary:"border-transparent bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90",destructive:"border-transparent bg-destructive text-white [a&]:hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground"}},defaultVariants:{variant:"default"}});function o(e){let{className:s,variant:t,asChild:n=!1,...o}=e,d=n?r.DX:"span";return(0,a.jsx)(d,{"data-slot":"badge",className:(0,l.cn)(i({variant:t}),s),...o})}},72117:(e,s,t)=>{t.d(s,{m:()=>y});var a=t(54568),r=t(7620),n=t(25118),l=t(15032),i=t(22710),o=t(72940),d=t(14049),c=t(9387),m=t(50457),u=t(26918),x=t(25342),p=t(24150),h=t(8031),g=t(71623),j=t(87606),f=t(67933),v=t(16258),b=t(51874);function y(e){var s;let{projectId:t}=e,y=(0,g.n6)(),N=(0,g._K)(),w=(0,j.jE)(),{data:k,isLoading:A}=(0,f.I)(y.project.getOne.queryOptions({projectId:t})),C=null==k?void 0:k.data,S=(null==C?void 0:C.type)==="mobile",[R,P]=(0,r.useState)(""),[_,z]=(0,r.useState)(""),[I,E]=(0,r.useState)(""),[O,F]=(0,r.useState)(""),[D,T]=(0,r.useState)(!1),[L,U]=(0,r.useState)(!1),[G,M]=(0,r.useState)(!1),[$,K]=(0,r.useState)(!1),[B,Y]=(0,r.useState)(null),[J,q]=(0,r.useState)(!1),V=(0,r.useRef)(null),X=(0,r.useRef)(null),Z=null==C||null==(s=C.eas)?void 0:s.appIconUrl,[H,W]=(0,r.useState)(!1),[Q,ee]=(0,r.useState)(!1),es=(0,r.useRef)(null);(0,r.useEffect)(()=>{if(C){var e,s,t,a,r;let n=C.metadata;P(null!=(s=null!=(e=null==n?void 0:n.title)?e:C.name)?s:""),z(null!=(t=null==n?void 0:n.description)?t:""),E(null!=(a=null==n?void 0:n.faviconUrl)?a:""),F(null!=(r=null==n?void 0:n.ogImageUrl)?r:""),q(!1)}},[C]);let et=(0,r.useCallback)(()=>{w.invalidateQueries({queryKey:y.project.getOne.queryKey({projectId:t})})},[w,y,t]),ea=(0,v.n)(y.project.updateMetadata.mutationOptions({onSuccess:()=>{b.oR.success("Changes saved"),q(!1),et()},onError:()=>{b.oR.error("Failed to save changes")}})),er=async(e,s,t)=>{Y(null),t(!0);try{let t=await new Promise((s,t)=>{let a=new FileReader;a.onload=()=>s(a.result),a.onerror=()=>t(Error("Failed to read file")),a.readAsDataURL(e)}),a=await N.upload.uploadImage.mutate({image:t,filename:e.name.replace(/\.[^/.]+$/,""),compress:!0});s(a.data.url),q(!0)}catch(e){Y("Upload failed. Please try again.")}finally{t(!1)}},en=(0,r.useCallback)(async e=>{W(!0);try{let s=await new Promise((s,t)=>{let a=new FileReader;a.onload=()=>s(a.result),a.onerror=()=>t(Error("Failed to read file")),a.readAsDataURL(e)}),a=await N.upload.uploadImage.mutate({image:s,filename:"app-icon-".concat(t),compress:!1});await N.project.saveAppIcon.mutate({projectId:t,appIconUrl:a.data.url}),et(),b.oR.success("App icon saved")}catch(e){b.oR.error("Failed to upload icon")}finally{W(!1)}},[N,t,et]),el=(0,r.useCallback)(async()=>{ee(!0);try{var e;await N.project.generateAppIcon.mutate({projectId:t,projectName:null!=(e=null==C?void 0:C.name)?e:"App",description:_||void 0}),et(),b.oR.success("App icon generated")}catch(e){b.oR.error("Failed to generate icon")}finally{ee(!1)}},[N,t,null==C?void 0:C.name,_,et]),ei=(0,r.useCallback)(async()=>{M(!0);try{var e;let s=await N.project.generateFavicon.mutate({projectId:t,projectName:null!=(e=null==C?void 0:C.name)?e:"Website",description:_||void 0});E(s.faviconUrl),q(!0),b.oR.success("Favicon generated")}catch(e){b.oR.error("Failed to generate favicon")}finally{M(!1)}},[N,t,null==C?void 0:C.name,_]),eo=(0,r.useCallback)(async()=>{K(!0);try{let e=await N.project.generateOgImage.mutate({projectId:t});F(e.ogImageUrl),q(!0),b.oR.success("Social image generated")}catch(e){b.oR.error("Failed to generate social image")}finally{K(!1)}},[N,t]),ed=(null==C?void 0:C.url)?C.url.replace(/^https?:\/\//,""):"yourproject.capacity.studio";return A?(0,a.jsx)("div",{className:"flex items-center justify-center py-20",children:(0,a.jsx)(o.A,{className:"w-5 h-5 animate-spin text-muted-foreground"})}):(0,a.jsxs)("div",{className:"space-y-8 max-w-xl pb-6",children:[S&&(0,a.jsxs)("section",{className:"space-y-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("h3",{className:"text-sm font-semibold",children:"App Icon"}),(0,a.jsx)("p",{className:"text-xs text-muted-foreground mt-0.5",children:"Your app icon as it appears on the home screen and app stores."})]}),(0,a.jsxs)("div",{className:"flex items-start gap-4",children:[(0,a.jsx)("input",{ref:es,type:"file",accept:"image/*",className:"hidden",onChange:e=>{var s;let t=null==(s=e.target.files)?void 0:s[0];t&&en(t),e.target.value=""}}),(0,a.jsx)("button",{type:"button",onClick:()=>{var e;return null==(e=es.current)?void 0:e.click()},className:"w-20 h-20 shrink-0 rounded-[18px] border-2 border-dashed border-border hover:border-foreground
1/30 transition-all flex items-center justify-center bg-muted/30 overflow-hidden shadow-sm",children:H?(0,a.jsx)(o.A,{className:"w-6 h-6 animate-spin text-muted-foreground"}):Z?(0,a.jsx)("img",{src:Z,alt:"App icon",className:"w-full h-full object-cover"}):(0,a.jsx)(d.A,{className:"w-6 h-6 text-muted-foreground/40"})}),(0,a.jsxs)("div",{className:"flex flex-col gap-2 flex-1 pt-0.5",children:[(0,a.jsxs)(i.$,{variant:"outline",size:"sm",className:"w-full justify-center",disabled:H||Q,onClick:()=>{var e;return null==(e=es.current)?void 0:e.click()},children:[(0,a.jsx)(c.A,{className:"w-3.5 h-3.5 mr-2"}),Z?"Replace icon":"Upload icon"]}),(0,a.jsxs)(i.$,{variant:"outline",size:"sm",className:"w-full justify-center",disabled:H||Q,onClick:el,children:[Q?(0,a.jsx)(o.A,{className:"w-3.5 h-3.5 mr-2 animate-spin"}):(0,a.jsx)(m.A,{className:"w-3.5 h-3.5 mr-2"}),Q?"Generating...":Z?"Regenerate with AI":"Generate with AI"]}),(0,a.jsxs)("p",{className:"text-[11px] text-muted-foreground flex items-center gap-1",children:[Z&&(0,a.jsx)(u.A,{className:"w-3 h-3 text-green-500"}),Z?"Icon saved \xb7 1024\xd71024px PNG":"1024\xd71024px PNG recommended"]})]})]})]}),(0,a.jsxs)("section",{className:"space-y-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("h3",{className:"text-sm font-semibold",children:S?"App Details":"Page Info"}),(0,a.jsx)("p",{className:"text-xs text-muted-foreground mt-0.5",children:S?"Name and description shown in app stores.":"Shown in browser tabs and search results."})]}),(0,a.jsxs)("div",{className:"space-y-3",children:[(0,a.jsxs)("div",{className:"space-y-1.5",children:[(0,a.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:S?"App name":"Page title"}),(0,a.jsx)(n.p,{placeholder:S?"My App":"My Awesome Website",value:R,onChange:e=>{P(e.target.value),q(!0)},maxLength:100})]}),(0,a.jsxs)("div",{className:"space-y-1.5",children:[(0,a.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:"Description"}),(0,a.jsx)(l.T,{placeholder:S?"A short description for the app store listing":"A short description for search engines and social sharing",className:"resize-none",rows:3,value:_,onChange:e=>{z(e.target.value),q(!0)},maxLength:300})]})]})]}),!S&&(0,a.jsxs)("section",{className:"space-y-6",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("h3",{className:"text-sm font-semibold",children:"Images"}),(0,a.jsx)("p",{className:"text-xs text-muted-foreground mt-0.5",children:"Favicon and social sharing image for your website."})]}),(0,a.jsxs)("div",{className:"space-y-2.5",children:[(0,a.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:"Social image (OG)"}),(0,a.jsx)("input",{ref:X,type:"file",accept:"image/*",className:"hidden",onChange:e=>{var s;let t=null==(s=e.target.files)?void 0:s[0];t&&er(t,F,U),e.target.value=""}}),(0,a.jsx)("button",{type:"button",onClick:()=>{var e;return null==(e=X.current)?void 0:e.click()},disabled:$,className:"w-full rounded-xl border-2 border-dashed border-border hover:border-foreground
1/30 transition-all bg-muted/20 overflow-hidden group",children:L||$?(0,a.jsxs)("div",{className:"aspect-[1.91/1] flex flex-col items-center justify-center gap-2",children:[(0,a.jsx)(o.A,{className:"w-5 h-5 animate-spin text-muted-foreground"}),(0,a.jsx)("span",{className:"text-[10px] text-muted-foreground",children:$?"Generating...":"Uploading..."})]}):O?(0,a.jsx)("div",{className:"aspect-[1.91/1]",children:(0,a.jsx)("img",{src:O,alt:"Social image",className:"w-full h-full object-cover"})}):(0,a.jsxs)("div",{className:"aspect-[1.91/1] flex flex-col items-center justify-center gap-1",children:[(0,a.jsx)(x.A,{className:"w-6 h-6 text-muted-foreground/40 group-hover:text-muted-foreground/60 transition-colors"}),(0,a.jsx)("span",{className:"text-[10px] text-muted-foreground/50",children:"1200 \xd7 630px"})]})}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsxs)(i.$,{variant:"outline",size:"sm",disabled:L||$,onClick:()=>{var e;return null==(e=X.current)?void 0:e.click()},children:[(0,a.jsx)(c.A,{className:"w-3.5 h-3.5"}),"Upload"]}),(0,a.jsxs)(i.$,{variant:"outline",size:"sm",disabled:L||$,onClick:eo,children:[$?(0,a.jsx)(o.A,{className:"w-3.5 h-3.5 animate-spin"}):(0,a.jsx)(m.A,{className:"w-3.5 h-3.5"}),$?"Generating...":"Generate"]}),O&&(0,a.jsxs)("button",{type:"button",onClick:()=>{F(""),q(!0)},className:"text-[11px] text-muted-foreground hover:text-foreground transition-colors flex items-center gap-1 ml-auto",children:[(0,a.jsx)(p.A,{className:"w-3 h-3"}),"Remove"]})]})]}),(0,a.jsxs)("div",{className:"space-y-2.5",children:[(0,a.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:"Favicon"}),(0,a.jsxs)("div",{className:"flex items-start gap-3",children:[(0,a.jsx)("input",{ref:V,type:"file",accept:"image/*",className:"hidden",onChange:e=>{var s;let t=null==(s=e.target.files)?void 0:s[0];t&&er(t,E,T),e.target.value=""}}),(0,a.jsx)("button",{type:"button",onClick:()=>{var e;return null==(e=V.current)?void 0:e.click()},className:"w-12 h-12 shrink-0 rounded-lg border-2 border-dashed border-border hover:border-foreground
1/30 transition-all flex items-center justify-center bg-muted/20 overflow-hidden",children:D?(0,a.jsx)(o.A,{className:"w-4 h-4 animate-spin text-muted-foreground"}):I?(0,a.jsx)("img",{src:I,alt:"Favicon",className:"w-full h-full object-cover"}):(0,a.jsx)(h.A,{className:"w-4 h-4 text-muted-foreground/40"})}),(0,a.jsxs)("div",{className:"flex flex-col gap-1.5 pt-0.5",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsxs)(i.$,{variant:"outline",size:"sm",disabled:D||G,onClick:()=>{var e;return null==(e=V.current)?void 0:e.click()},children:[(0,a.jsx)(c.A,{className:"w-3.5 h-3.5"}),"Upload"]}),(0,a.jsxs)(i.$,{variant:"outline",size:"sm",disabled:D||G,onClick:ei,children:[G?(0,a.jsx)(o.A,{className:"w-3.5 h-3.5 animate-spin"}):(0,a.jsx)(m.A,{className:"w-3.5 h-3.5"}),G?"Generating...":"Generate"]}),I&&(0,a.jsxs)("button",{type:"button",onClick:()=>{E(""),q(!0)},className:"text-[11px] text-muted-foreground hover:text-foreground transition-colors flex items-center gap-1",children:[(0,a.jsx)(p.A,{className:"w-3 h-3"}),"Remove"]})]}),(0,a.jsx)("p",{className:"text-[11px] text-muted-foreground",children:"32\xd732px+ recommended"})]})]})]}),B&&(0,a.jsx)("p",{className:"text-xs text-red-500",children:B})]}),!S&&(R.trim()||_.trim()||O||I)&&(0,a.jsxs)("section",{className:"space-y-3",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("h3",{className:"text-sm font-semibold",children:"Social Preview"}),(0,a.jsx)("p",{className:"text-xs text-muted-foreground mt-0.5",children:"How your site looks when shared on social media."})]}),(0,a.jsxs)("div",{className:"rounded-xl border overflow-hidden shadow-sm",children:[O?(0,a.jsx)("div",{className:"aspect-[1.91/1] bg-muted",children:(0,a.jsx)("img",{src:O,alt:"OG preview",className:"w-full h-full object-cover"})}):(0,a.jsx)("div",{className:"aspect-[1.91/1] bg-muted flex items-center justify-center",children:(0,a.jsx)(h.A,{className:"w-10 h-10 text-muted-foreground/10"})}),(0,a.jsxs)("div",{className:"px-3.5 py-2.5 bg-muted/30 space-y-0.5",children:[(0,a.jsxs)("div",{className:"flex items-center gap-1.5",children:[I?(0,a.jsx)("img",{src:I,alt:"",className:"w-4 h-4 rounded-sm shrink-0 object-cover"}):(0,a.jsx)(h.A,{className:"w-3 h-3 shrink-0 text-muted-foreground"}),(0,a.jsx)("span",{className:"text-[11px] text-muted-foreground truncate",children:ed})]}),R.trim()&&(0,a.jsx)("p",{className:"text-sm font-medium truncate leading-snug",children:R.trim()}),_.trim()&&(0,a.jsx)("p",{className:"text-xs text-muted-foreground line-clamp-2 leading-relaxed",children:_.trim()})]})]})]}),(0,a.jsxs)("div",{className:"flex items-center gap-3 pt-2",children:[(0,a.jsxs)(i.$,{onClick:()=>{ea.mutate({projectId:t,metadata:{...R.trim()&&{title:R.trim()},..._.trim()&&{description:_.trim()},...I.trim()&&{faviconUrl:I.trim()},...O.trim()&&{ogImageUrl:O.trim()}}})},disabled:ea.isPending||!J,size:"sm",children:[ea.isPending?(0,a.jsx)(o.A,{className:"w-4 h-4 animate-spin mr-2"}):null,ea.isPending?"Saving...":"Save changes"]}),!J&&ea.isSuccess&&(0,a.jsx)("span",{className:"text-xs text-muted-foreground",children:"Saved"})]})]})}},72276:(e,s,t)=>{t.d(s,{n:()=>y});var a=t(54568),r=t(7620),n=t(22710),l=t(66535),i=t(46266),o=t(25118),d=t(35972),c=t(51874),m=t(59725),u=t(72940),x=t(46024),p=t(24150),h=t(63247),g=t(4477),j=t(11218),f=t(44160),v=t(14263),b=t(41240);function y(e){let{projectId:s}=e,[t,y]=(0,r.useState)(!1),[N,w]=(0,r.useState)(""),{updateSupabasePAT:k}=(0,b.Kc)(),{refreshSupabaseOrganization:A}=(0,b.Gj)(),{deleteSupabaseConnection:C}=(0,b.Jy)(),{deleteSelectedProject:S}=(0,b.b7)(),{selectProject:R}=(0,b.RV)(),{connections:P,query:_}=(0,b.vY)(),{selectedProject:z,query:I}=(0,b.WA)({projectId:s}),E=(0,r.useMemo)(()=>_.isLoading||I.isLoading,[_.isLoading,I.isLoading]),O=async()=>{if(!N.trim())return void c.oR.error("Please enter a personal access token");try{await k.mutateAsync({personalAccessToken:N.trim()}),c.oR.success("Successfully connected to Supabase!"),w("")}catch(e){console.error("Error validating token:",e),(null==e?void 0:e.message)==="INVALID_PERSONAL_ACCESS_TOKEN"?c.oR.error("Invalid personal access token. Please check your token and try again."):c.oR.error((null==e?void 0:e.message)||"Failed to validate token")}},F=async e=>{try{await C.mutateAsync({connectionId:e}),c.oR.success("Organization disconnected successfully")}catch(e){console.error("Error disconnecting:",e),c.oR.error((null==e?void 0:e.message)||"Failed to disconnect organization")}},D=async e=>{try{y(!0),await R.mutateAsync({projectId:s,supabaseProjectId:e}),c.oR.success("Supabase project selected for this app")}catch(e){console.error("Error selecting project:",e),c.oR.error((null==e?void 0:e.message)||"Failed to select project")}finally{y(!1)}},T=async()=>{try{await S.mutateAsync({projectId:s}),c.oR.success("Supabase project selection removed")}catch(e){console.error("Error removing selection:",e),c.oR.error((null==e?void 0:e.message)||"Failed to remove selection")}},L=async e=>{try{await A.mutateAsync({connectionId:e}),c.oR.success("Organization refreshed successfully")}catch(e){console.error("Error refreshing organization:",e),c.oR.error((null==e?void 0:e.message)||"Failed to refresh organization")}},U=e=>"active_healthy"===e.toLowerCase()?(0,a.jsx)("div",{className:"w-2 h-2 bg-emerald-500 rounded-full"}):(0,a.jsx)("div",{className:"w-2 h-2 bg-gray-500 rounded-full"}),[G,M]=(0,r.useState)(null),[$,K]=(0,r.useState)(null);return(console.log(G),console.log($),(0,r.useEffect)(()=>{fetch("".concat("https://api.capacity.so","/setting/me"),{credentials:"include",headers:{"Content-Type":"application/json"}}).then(e=>e.json()).then(e=>{M(e),K(e.plan)}).catch(e=>{console.log(e)})},[]),E||!G)?(0,a.jsxs)("div",{className:"flex items-center justify-center py-12",children:[(0,a.jsx)(u.A,{className:"w-5 h-5 animate-spin text-muted-foreground"}),(0,a.jsx)("span",{className:"ml-2 text-sm text-muted-foreground",children:"Loading..."})]}):(0,a.jsxs)("div",{className:"space-y-6 max-h-[70vh] overflow-y-auto",children:[P.length>0&&(0,a.jsx)("div",{className:"flex items-center justify-between",children:(0,a.jsx)("div",{children:(0,a.jsxs)("h3",{className:"text-lg font-medium flex items-center gap-2",children:[(0,a.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"
1currentColor",viewBox:"0 0 109 113",className:"h-4 w-4",children:[(0,a.jsx)("path",{fill:"url(#supabase_svg__a)",d:"M63.708 110.284c-2.86 3.601-8.658 1.628-8.727-2.97l-1.007-67.251h45.22c8.19 0 12.758 9.46 7.665 15.874z"}),(0,a.jsx)("path",{fill:"url(#supabase_svg__b)",fillOpacity:"0.2",d:"M63.708 110.284c-2.86 3.601-8.658 1.628-8.727-2.97l-1.007-67.251h45.22c8.19 0 12.758 9.46 7.665 15.874z"}),(0,a.jsx)("path",{fill:"#3ECF8E",d:"M45.317 2.071c2.86-3.601 8.657-1.628 8.726 2.97l.442 67.251H9.83c-8.19 0-12.759-9.46-7.665-15.875z"}),(0,a.jsxs)("defs",{children:[(0,a.jsxs)("linearGradient",{id:"supabase_svg__a",x1:"53.974",x2:"94.163",y1:"54.974",y2:"71.829",gradientUnits:"userSpaceOnUse",children:[(0,a.jsx)("stop",{stopColor:"#249361"}),(0,a.jsx)("stop",{offset:"1",stopColor:"#3ECF8E"})]}),(0,a.jsxs)("linearGradient",{id:"supabase_svg__b",x1:"36.156",x2:"54.484",y1:"30.578",y2:"65.081",gradientUnits:"userSpaceOnUse",children:[(0,a.jsx)("stop",{}),(0,a.jsx)("stop",{offset:"1",stopOpacity:"0"})]})]})]}),"Supabase"]})})}),z&&(0,a.jsxs)("div",{className:"flex items-center justify-between p-3 rounded-lg border bg-green-50/50 dark:bg-green-950/20",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)("div",{className:"w-8 h-8 rounded-md bg-green-100 dark:bg-green-900/30 flex items-center justify-center",children:(0,a.jsx)(x.A,{className:"w-4 h-4 text-green-600 dark:text-green-400"})}),(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"font-medium text-sm",children:z.name}),(0,a.jsx)("div",{className:"text-xs text-muted-foreground",children:z.organizationName})]})]}),(0,a.jsx)(n.$,{variant:"ghost",size:"sm",onClick:T,disabled:S.isPending,children:S.isPending?(0,a.jsx)(u.A,{className:"w-4 h-4 animate-spin"}):(0,a.jsx)(p.A,{className:"w-4 h-4"})})]}),P.length>0&&!z&&(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsx)("p",{className:"text-sm font-medium",children:"Select Project"}),(0,a.jsxs)(i.l6,{onValueChange:D,disabled:t||R.isPending,children:[(0,a.jsx)(i.bq,{className:"h-9 border-red-500 focus:ring-red-500 transition-colors duration-200",children:(0,a.jsx)(i.yv,{placeholder:"Choose a project"})}),(0,a.jsx)(i.gC,{children:P.flatMap(e=>e.projects.map(s=>({...s,organizationName:e.organizationName}))).map(e=>(0,a.jsx)(i.eb,{value:e.id,children:(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(h.A,{className:"w-3 h-3"}),(0,a.jsx)("span",{className:"text-sm",children:e.name}),(0,a.jsxs)("span",{className:"text-xs text-muted-foreground",children:["(",e.organizationName,")"]})]})},e.id))})]}),(0,a.jsx)("p",{className:"text-xs text-red-500",children:"Project selection required"})]}),(0,a.jsx)("div",{className:"space-y-3",children:0===P.length?(0,a.jsxs)("div",{className:"text-center py-12 px-6",children:[(0,a.jsx)("div",{className:"mb-6",children:(0,a.jsx)("div",{className:"inline-flex items-center justify-center w-16 h-16 rounded-full mb-4 bg-green-50 dark:bg-green-900/30",children:(0,a.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",viewBox:"0 0 109 113",className:"h-8 w-8 text-green-600",children:[(0,a.jsx)("path",{fill:"url(#supabase_svg__a)",d:"M63.708 110.284c-2.86 3.601-8.658 1.628-8.727-2.97l-1.007-67.251h45.22c8.19 0 12.758 9.46 7.665 15.874z"}),(0,a.jsx)("path",{fill:"url(#supabase_svg__b)",fillOpacity:"0.2",d:"M63.708 110.284c-2.86 3.601-8.658 1.628-8.727-2.97l-1.007-67.251h45.22c8.19 0 12.758 9.46 7.665 15.874z"}),(0,a.jsx)("path",{fill:"#3ECF8E",d:"M45.317 2.071c2.86-3.601 8.657-1.628 8.726 2.97l.442 67.251H9.83c-8.19 0-12.759-9.46-7.665-15.875z"}),(0,a.jsxs)("defs",{children:[(0,a.jsxs)("linearGradient",{id:"supabase_svg__a",x1:"53.974",x2:"94.163",y1:"54.974",y2:"71.829",gradientUnits:"userSpaceOnUse",children:[(0,a.jsx)("stop",{stopColor:"#249361"}),(0,a.jsx)("stop",{offset:"1",stopColor:"#3ECF8E"})]}),(0,a.jsxs)("linearGradient",{id:"supabase_svg__b",x1:"36.156",x2:"54.484",y1:"30.578",y2:"65.081",gradientUnits:"userSpaceOnUse",children:[(0,a.jsx)("stop",{}),(0,a.jsx)("stop",{offset:"1",stopOpacity:"0"})]})]})]})})}),(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("h3",{className:"text-xl font-semibold text-foreground mb-2",children:"Connect Your Supabase Account"}),(0,a.jsx)("p",{className:"text-sm text-muted-foreground mb-6 max-w-sm mx-auto",children:"Enter your Supabase personal access token to enable real-time database features, authentication, and seamless backend integration for your projects."}),(0,a.jsxs)("div",{className:"space-y-4 w-full max-w-sm mx-auto",children:[(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsx)(d.J,{htmlFor:"access-token",className:"text-sm font-medium",children:"Personal Access Token"}),(0,a.jsxs)("div",{className:"relative",children:[(0,a.jsx)(o.p,{id:"access-token",type:"password",value:N,onChange:e=>w(e.target.value),placeholder:"sbp_0123456789abcdef...",className:"pr-10",disabled:k.isPending}),(0,a.jsx)(g.A,{className:"absolute right-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground"})]}),(0,a.jsxs)("p",{className:"text-xs text-muted-foreground",children:["You can create a personal access token in your"," ",(0,a.jsx)("a",{href:"https://supabase.com/dashboard/account/tokens",target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:"Supabase account settings"})]})]}),(0,a.jsx)(n.$,{size:"sm",onClick:O,disabled:!N.trim()||k.isPending,className:"w-full text-white dark:text-black",children:k.isPending?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(u.A,{className:"w-4 h-4 mr-2 animate-spin"}),"Validating..."]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(x.A,{className:"w-4 h-4 mr-2"}),"Validate Token"]})})]})]})]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("h4",{className:"text-sm font-medium text-muted-foreground",children:"Connected organizations"}),(0,a.jsx)("div",{className:"space-y-3",children:P.map(e=>(0,a.jsxs)("div",{className:"border rounded-lg p-4 space-y-3",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)("div",{className:"w-8 h-8 rounded-md bg-muted flex items-center justify-center",children:(0,a.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"
1currentColor",viewBox:"0 0 109 113",className:"h-4 w-4",children:[(0,a.jsx)("path",{fill:"url(#supabase_svg__a)",d:"M63.708 110.284c-2.86 3.601-8.658 1.628-8.727-2.97l-1.007-67.251h45.22c8.19 0 12.758 9.46 7.665 15.874z"}),(0,a.jsx)("path",{fill:"url(#supabase_svg__b)",fillOpacity:"0.2",d:"M63.708 110.284c-2.86 3.601-8.658 1.628-8.727-2.97l-1.007-67.251h45.22c8.19 0 12.758 9.46 7.665 15.874z"}),(0,a.jsx)("path",{fill:"#3ECF8E",d:"M45.317 2.071c2.86-3.601 8.657-1.628 8.726 2.97l.442 67.251H9.83c-8.19 0-12.759-9.46-7.665-15.875z"}),(0,a.jsxs)("defs",{children:[(0,a.jsxs)("linearGradient",{id:"supabase_svg__a",x1:"53.974",x2:"94.163",y1:"54.974",y2:"71.829",gradientUnits:"userSpaceOnUse",children:[(0,a.jsx)("stop",{stopColor:"#249361"}),(0,a.jsx)("stop",{offset:"1",stopColor:"#3ECF8E"})]}),(0,a.jsxs)("linearGradient",{id:"supabase_svg__b",x1:"36.156",x2:"54.484",y1:"30.578",y2:"65.081",gradientUnits:"userSpaceOnUse",children:[(0,a.jsx)("stop",{}),(0,a.jsx)("stop",{offset:"1",stopOpacity:"0"})]})]})]})}),(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"font-medium text-sm",children:e.organizationName}),(0,a.jsxs)("div",{className:"text-xs text-muted-foreground",children:[e.projects.length," projects"]})]})]}),(0,a.jsxs)("div",{className:"flex items-center gap-1",children:[(0,a.jsx)(n.$,{variant:"ghost",size:"sm",onClick:()=>L(e.id),disabled:A.isPending,children:(0,a.jsx)(j.A,{className:"w-3 h-3 ".concat(A.isPending?"animate-spin":"")})}),(0,a.jsx)(n.$,{variant:"ghost",size:"sm",onClick:()=>window.open("https://supabase.com/dashboard/org/".concat(e.organizationName),"_blank"),children:(0,a.jsx)(f.A,{className:"w-3 h-3"})}),(0,a.jsxs)(m.Lt,{children:[(0,a.jsx)(m.tv,{asChild:!0,children:(0,a.jsx)(n.$,{variant:"ghost",size:"sm",children:(0,a.jsx)(v.A,{className:"w-3 h-3"})})}),(0,a.jsxs)(m.EO,{children:[(0,a.jsxs)(m.wd,{children:[(0,a.jsx)(m.r7,{children:"Disconnect Organization"}),(0,a.jsxs)(m.$v,{children:['Remove access to "',e.organizationName,'" and all its projects?']})]}),(0,a.jsxs)(m.ck,{children:[(0,a.jsx)(m.Zr,{children:"Cancel"}),(0,a.jsx)(m.Rx,{onClick:()=>F(e.id),className:"bg-red-600 hover:bg-red-700",disabled:C.isPending,children:C.isPending?"Disconnecting...":"Disconnect"})]})]})]})]})]}),e.projects.length>0&&(0,a.jsx)("div",{className:"space-y-2",children:e.projects.map(e=>(0,a.jsxs)("div",{className:"flex items-center justify-between p-2 rounded-md bg-muted/30",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[U(e.status),(0,a.jsx)("span",{className:"text-sm font-medium",children:e.name}),e.ref&&(0,a.jsx)("span",{className:"text-xs text-muted-foreground",children:e.ref})]}),(null==z?void 0:z.id)===e.id&&(0,a.jsx)(l.E,{variant:"secondary",className:"text-xs",children:"Active"})]},e.id))})]},e.id))})]})})]})}},86349:(e,s,t)=>{t.d(s,{K:()=>h});var a=t(54568),r=t(7620),n=t(22710),l=t(51874),i=t(59725),o=t(72940),d=t(46024),c=t(14263),m=t(9387),u=t(71623),x=t(67933);function p(e){let{className:s}=e;return(0,a.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 512",className:null!=s?s:"h-4 w-4",children:[(0,a.jsx)("path",{fill:"#4285F4",d:"M325.3 234.3L104.6 13l280.8 161.2-60.1 60.1zM47 0C34 6.8 25.3 19.2 25.3 35.3v441.3c0 16.1 8.7 28.5 21.7 35.3l256.6-256L47 0z"}),(0,a.jsx)("path",{fill:"#34A853",d:"M47 512c-12.9-6.8-21.7-19.2-21.7-35.3V476l256.6-256 43.2 43.2L47 512z"}),(0,a.jsx)("path",{fill:"#FBBC04",d:"M325.3 277.7l60.1 60.1L104.6 499 325.3 277.7z"}),(0,a.jsx)("path",{fill:"#EA4335",d:"M486.8 256c0-9.4-5.3-18.9-15.9-25.2L385.4 174l-60.1 60.1 60.1 60.1 86.5-56.7c10.6-6.3 15.9-15.8 14.9-25.2v-6.3z"}),(0,a.jsx)("path",{fill:"#34A853",d:"M104.6 499l280.8-161.2-60.1-60.1L104.6 499z"})]})}function h(e){let{projectId:s}=e,t=(0,u.n6)(),h=(0,u._K)(),[g,j]=(0,r.useState)(""),[f,v]=(0,r.useState)(""),[b,y]=(0,r.useState)(!1),[N,w]=(0,r.useState)(!1),k=(0,r.useRef)(null),{data:A,isLoading:C,refetch:S}=(0,x.I)(t.project.getGooglePlayCredentials.queryOptions({projectId:s})),R=(null==A?void 0:A.configured)===!0,P=async()=>{if(!g.trim())return void l.oR.error("Please upload your service account JSON key file");y(!0);try{await h.project.saveGooglePlayCredentials.mutate({projectId:s,serviceAccountKey:g.trim()}),l.oR.success("Google Play credentials saved!"),j(""),v(""),await S()}catch(e){l.oR.error((null==e?void 0:e.message)||"Failed to save credentials")}finally{y(!1)}},_=async()=>{w(!0);try{await h.project.deleteGooglePlayCredentials.mutate({projectId:s}),l.oR.success("Google Play credentials removed"),await S()}catch(e){l.oR.error((null==e?void 0:e.message)||"Failed to remove credentials")}finally{w(!1)}};return C?(0,a.jsxs)("div",{className:"flex items-center justify-center py-12",children:[(0,a.jsx)(o.A,{className:"w-5 h-5 animate-spin text-muted-foreground"}),(0,a.jsx)("span",{className:"ml-2 text-sm text-muted-foreground",children:"Loading..."})]}):R?(0,a.jsxs)("div",{className:"space-y-6",children:[(0,a.jsx)("div",{children:(0,a.jsxs)("h3",{className:"text-lg font-medium flex items-center gap-2",children:[(0,a.jsx)(p,{}),"Google Play"]})}),(0,a.jsxs)("div",{className:"flex items-center justify-between p-3 rounded-lg border bg-green-50/50 dark:bg-green-950/20",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)("div",{className:"w-8 h-8 rounded-md bg-green-100 dark:bg-green-900/30 flex items-center justify-center",children:(0,a.jsx)(d.A,{className:"w-4 h-4 text-green-600 dark:text-green-400"})}),(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"font-medium text-sm",children:"Service Account Key"}),(0,a.jsx)("div",{className:"text-xs text-muted-foreground",children:"Connected to Google Play Console"})]})]}),(0,a.jsxs)(i.Lt,{children:[(0,a.jsx)(i.tv,{asChild:!0,children:(0,a.jsx)(n.$,{variant:"ghost",size:"sm",disabled:N,children:N?(0,a.jsx)(o.A,{className:"w-4 h-4 animate-spin"}):(0,a.jsx)(c.A,{className:"w-4 h-4"})})}),(0,a.jsxs)(i.EO,{children:[(0,a.jsxs)(i.wd,{children:[(0,a.jsx)(i.r7,{children:"Remove Google Play Credentials"}),(0,a.jsx)(i.$v,{children:"This will remove your Google Play Service Account key from this project. You won't be able to submit Android apps to the Play Store until you add new credentials."})]}),(0,a.jsxs)(i.ck,{children:[(0,a.jsx)(i.Zr,{children:"Cancel"}),(0,a.jsx)(i.Rx,{onClick:_,className:"bg-red-600 hover:bg-red-700",children:"Remove"})]})]})]})]}),(0,a.jsx)("p",{className:"text-xs text-muted-foreground",children:"Your credentials are encrypted and stored securely. They are only used during Android submissions to upload your app to Google Play."})]}):(0,a.jsx)("div",{className:"space-y-6",children:(0,a.jsxs)("div",{className:"text-center py-8 px-6",children:[(0,a.jsx)("div",{className:"mb-6",children:(0,a.jsx)("div",{className:"inline-flex items-center justify-center w-16 h-16 rounded-full mb-4 bg-gray-50 dark:bg-gray-900/30",children:(0,a.jsx)(p,{className:"h-8 w-8"})})}),(0,a.jsx)("h3",{className:"text-xl font-semibold text-foreground mb-2",children:"Connect Google Play Console"}),(0,a.jsx)("p",{className:"text-sm text-muted-foreground mb-6 max-w-sm mx-auto",children:"Add a Google Play Service Account key to enable automated app submissions to the Play Store."}),(0,a.jsxs)("div",{className:"space-y-4 w-full max-w-sm mx-auto text-left",children:[(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsx)("label",{className:"text-sm font-medium",children:"Service Account Key (.json)"}),(0,a.jsx)("input",{ref:k,type:"file",accept:".json",className:"hidden",onChange:e=>{var s;let t=null==(s=e.target.files)?void 0:s[0];if(!t)return;if(!t.name.endsWith(".json"))return void l.oR.error("Please upload a .json file");let a=new FileReader;a.onload=e=>{var s;let a=null==(s=e.target)?void 0:s.result;try{JSON.parse(a),j(a),v(t.name)}catch(e){l.oR.error("Invalid JSON file")}},a.readAsText(t),e.target.value=""}}),(0,a.jsxs)("button",{type:"button",onClick:()=>{var e;
1return null==(e=k.current)?void 0:e.click()},className:"w-full flex items-center gap-3 px-3 py-2.5 rounded-lg border border-dashed border-border hover:border-foreground/30 transition-colors bg-muted/30",children:[(0,a.jsx)(m.A,{className:"w-4 h-4 text-muted-foreground shrink-0"}),(0,a.jsx)("span",{className:"text-sm text-muted-foreground truncate",children:f||"Upload service-account-key.json"})]})]}),(0,a.jsx)(n.$,{size:"sm",onClick:P,disabled:!g.trim()||b,className:"w-full text-white dark:text-black",children:b?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(o.A,{className:"w-4 h-4 mr-2 animate-spin"}),"Saving..."]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(d.A,{className:"w-4 h-4 mr-2"}),"Save Credentials"]})}),(0,a.jsxs)("div",{className:"text-xs text-muted-foreground space-y-2",children:[(0,a.jsx)("p",{children:"To create a Service Account key:"}),(0,a.jsxs)("ol",{className:"list-decimal pl-4 space-y-1",children:[(0,a.jsxs)("li",{children:["Go to"," ",(0,a.jsx)("a",{href:"https://console.cloud.google.com/iam-admin/serviceaccounts",target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:"Google Cloud Console"})," ","and create a Service Account"]}),(0,a.jsx)("li",{children:"Download the JSON key for the Service Account"}),(0,a.jsxs)("li",{children:["In"," ",(0,a.jsx)("a",{href:"https://play.google.com/console",target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:"Google Play Console"}),", go to Settings > API Access and grant the Service Account access"]})]}),(0,a.jsx)("p",{className:"text-amber-600 dark:text-amber-400",children:"Note: The first version of your app must be uploaded manually to Google Play Console before automated submissions can work."})]})]})]})})}},86526:(e,s,t)=>{t.d(s,{Z:()=>o,t:()=>d});var a=t(54568),r=t(41240),n=t(7620),l=t(51874);let i=(0,n.createContext)(void 0);function o(e){let{children:s,projectId:t}
1=e,[o,d]=(0,n.useState)(!1),[c,m]=(0,n.useState)("Settings"),{project:u}=(0,r.By)({projectId:t}),[x,p]=(0,n.useState)({name:"",isPublic:!0,environmentVariables:[],knowledgeBase:[]}),[h,g]=(0,n.useState)(!1),j=(0,n.useRef)(null);(0,n.useEffect)(()=>{if(null!=u){var e,s,t,a;p({name:null!=(e=u.name)?e:"",environmentVariables:(null!=(s=u.environmentVariables)?s:[]).map(e=>{var s;return{name:e.name,value:null!=(s=e.value)?s:""}}),isPublic:null==(t=u.isPublic)||t,knowledgeBase:null!=(a=u.knowledgeBase)?a:[]})}},[u]);let f=(0,n.useCallback)(async e=>{g(!0);try{(await fetch("".concat("https://api.capacity.so","/setting/update/").concat(t),{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).ok?l.oR.success("Project updated successfully"):l.oR.error("Error updating project")}catch(e){console.error("Error updating project:",e),l.oR.error("Error updating project")}finally{g(!1)}},[g]),v=(0,n.useCallback)(e=>(p(e),j.current&&clearTimeout(j.current),j.current=setTimeout(()=>{f(e)},2e3),()=>{j.current&&clearTimeout(j.current)}),[f]),b=e=>{e&&m(e),d(!0)},y=(0,n.useMemo)(()=>({settingsOpen:o,setSettingsOpen:d,activeSection:c,setActiveSection:m,settings:x,setSettings:v,loading:h,openSettings:b}),[o,d,c,m,x,v,h,b]);return(0,a.jsx)(i.Provider,{value:y,children:s})}function d(){let e=(0,n.useContext)(i);if(void 0===e)throw Error("useSettings must be used within a SettingsProvider");return e}}}]);
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.