UNPKG

decocms

Version:

Deco CMS — Self-hostable MCP Gateway for managing AI connections and tools

2 lines (1 loc) • 20.6 kB
import{c as P,r as I,a6 as Ve,eP as Pe,b as ee,m as O,j as r,a7 as Qe,ez as Ge,B as Ne,t as se,I as We,h as Ye,a_ as Ke}from"./index-ztdGKvBm.js";import{a as Ue}from"./Image01-BcIZ5mtf.js";import{s as He}from"./Trash01-BxBhF2b8.js";import{i as Re}from"./Upload01-q-rKSvZf.js";import{r as Je,L as Xe,s as Ze,F as et,i as $e}from"./use-never-published-BJeGnEQC.js";import{L as Ce}from"./label-8UxgpYiA.js";import{T as Se,a as ke,c as Ee}from"./tooltip-Bm0P1gm_.js";import{b as Ie}from"./repository-binding-D_Xc1yRH.js";import{u as tt}from"./chat-context-DFEln8mI.js";import{u as Fe,a6 as st,h as it,b as rt,a7 as nt}from"./site-editor-toast-Dq7SmLyr.js";import{c as ot}from"./use-organization-settings-C2vcrj4S.js";import{a as at}from"./SwitchHorizontal01-CMdpIiQk.js";import{a as lt,b as ct,P as dt}from"./popover-C4oz5B-L.js";import{S as ft}from"./switch-B81oLbqr.js";import{T as ut,a as mt}from"./toggle-group-yQeAFu4u.js";import{m as pt}from"./match-site-slug-config-B47_xZCi.js";import{u as gt}from"./use-file-configs-3gwPBXwK.js";import{u as xt}from"./asset-utils-DP9aQr9Q.js";import{i as ht}from"./AlertCircle-BlMH0XE7.js";const Oe=I.createContext(null);function cs(t){const e=P.c(3),{children:s}=t,n=tt(),a=Fe(n?.virtualMcpId,n?.currentBranch);let o;return e[0]!==a.kind||e[1]!==s?(o=I.createElement(Oe.Provider,{value:a.kind},s),e[0]=a.kind,e[1]=s,e[2]=o):o=e[2],o}function vt(){const t=P.c(4),e=I.useContext(Oe),{org:s}=Ve(),n=ot("new_blocks_editor"),a=!!s.id;let o;return t[0]!==e||t[1]!==n||t[2]!==a?(o=st({backend:e,hasOrg:a,orgFlag:n}),t[0]=e,t[1]=n,t[2]=a,t[3]=o):o=t[3],o}function yt(){return vt()??!1}function bt(t){if(typeof t=="string")return t;if(!t||typeof t!="object")return"";const e=t;if(Array.isArray(e.variants)){const s=e.variants,n=s.find(i=>i.rule?.__resolveType?.includes("always")),a=Pe(n);if(typeof a=="string")return a;const o=s.map(i=>Pe(i)).find(i=>typeof i=="string");if(typeof o=="string")return o}return typeof e.src=="string"?e.src:typeof e.url=="string"?e.url:typeof e.value=="string"?e.value:""}function jt(t){const e=P.c(29),{className:s}=t,n=ee();if(yt()){let c;e[0]!==n?(c=n("sectionsEditor.field.missingRequired"),e[0]=n,e[1]=c):c=e[1];let m;e[2]!==s?(m=O("shrink-0 cursor-help text-destructive",s),e[2]=s,e[3]=m):m=e[3];let x;e[4]===Symbol.for("react.memo_cache_sentinel")?(x=r.jsx(Qe,{className:"size-3.5"}),e[4]=x):x=e[4];let p;e[5]!==c||e[6]!==m?(p=r.jsx(Se,{asChild:!0,children:r.jsx("span",{role:"img","aria-label":c,className:m,children:x})}),e[5]=c,e[6]=m,e[7]=p):p=e[7];let h;e[8]!==n?(h=n("sectionsEditor.field.missingRequiredTooltip"),e[8]=n,e[9]=h):h=e[9];let g;e[10]!==h?(g=r.jsx(ke,{className:"max-w-56",children:h}),e[10]=h,e[11]=g):g=e[11];let w;return e[12]!==p||e[13]!==g?(w=r.jsxs(Ee,{children:[p,g]}),e[12]=p,e[13]=g,e[14]=w):w=e[14],w}let o;e[15]!==n?(o=n("sectionsEditor.field.missingRequired"),e[15]=n,e[16]=o):o=e[16];let i;e[17]!==s?(i=O("size-2 shrink-0 cursor-help rounded-full bg-destructive",s),e[17]=s,e[18]=i):i=e[18];let f;e[19]!==o||e[20]!==i?(f=r.jsx(Se,{asChild:!0,children:r.jsx("span",{role:"img","aria-label":o,className:i})}),e[19]=o,e[20]=i,e[21]=f):f=e[21];let d;e[22]!==n?(d=n("sectionsEditor.field.missingRequiredTooltip"),e[22]=n,e[23]=d):d=e[23];let l;e[24]!==d?(l=r.jsx(ke,{className:"max-w-56",children:d}),e[24]=d,e[25]=l):l=e[25];let u;return e[26]!==f||e[27]!==l?(u=r.jsxs(Ee,{children:[f,l]}),e[26]=f,e[27]=l,e[28]=u):u=e[28],u}const Me=I.createContext({required:!1,invalid:!1});function wt(){return I.useContext(Me)}function ds(t){const e=P.c(6),{required:s,invalid:n,children:a}=t;let o;e[0]!==n||e[1]!==s?(o={required:s,invalid:n},e[0]=n,e[1]=s,e[2]=o):o=e[2];let i;return e[3]!==a||e[4]!==o?(i=r.jsx(Me.Provider,{value:o,children:a}),e[3]=a,e[4]=o,e[5]=i):i=e[5],i}function fs(t){return t==null?!0:typeof t=="string"?t.trim()==="":Array.isArray(t)?t.length===0:typeof t=="object"?Object.keys(t).length===0:!1}const Nt="cursor-help underline decoration-dotted decoration-muted-foreground/50 underline-offset-4";function De(t){return Ie(t)?.metadata?.fieldDescriptionTooltips??!1}function Ct(t){const e=P.c(9),{description:s,virtualMcpId:n,children:a}=t,o=De(n);if(!s||!o)return a;let i;e[0]!==a?(i=I.cloneElement(a,{className:O(a.props.className,Nt)}),e[0]=a,e[1]=i):i=e[1];let f;e[2]!==i?(f=r.jsx(Se,{asChild:!0,children:i}),e[2]=i,e[3]=f):f=e[3];let d;e[4]!==s?(d=r.jsx(ke,{className:"max-w-64",children:s}),e[4]=s,e[5]=d):d=e[5];let l;return e[6]!==f||e[7]!==d?(l=r.jsxs(Ee,{delayDuration:300,children:[f,d]}),e[6]=f,e[7]=d,e[8]=l):l=e[8],l}function St(t){const e=P.c(17),{htmlFor:s,label:n,description:a,labelClassName:o,virtualMcpId:i}=t,f=De(i),{required:d,invalid:l}=wt();let u;e[0]!==l||e[1]!==d?(u=d&&l&&r.jsx(jt,{className:"mt-0.5 self-start"}),e[0]=l,e[1]=d,e[2]=u):u=e[2];let c;e[3]!==s||e[4]!==n||e[5]!==o||e[6]!==u?(c=r.jsxs(Ce,{htmlFor:s,className:o,children:[n,u]}),e[3]=s,e[4]=n,e[5]=o,e[6]=u,e[7]=c):c=e[7];const m=c;if(!f){let p;e[8]!==a?(p=a&&r.jsx("p",{className:"text-xs leading-normal text-muted-foreground",children:a}),e[8]=a,e[9]=p):p=e[9];let h;return e[10]!==m||e[11]!==p?(h=r.jsxs("div",{className:"space-y-0.5",children:[m,p]}),e[10]=m,e[11]=p,e[12]=h):h=e[12],h}let x;return e[13]!==a||e[14]!==m||e[15]!==i?(x=r.jsx(Ct,{description:a,virtualMcpId:i,children:m}),e[13]=a,e[14]=m,e[15]=i,e[16]=x):x=e[16],x}function kt(t){const e=ee(),s=Ie(t?.virtualMcpId),n=Fe(t?.virtualMcpId,t?.branch),{connection:a}=rt(t?.virtualMcpId),o=nt(n,a);if(s?.metadata?.assetStorageConfigId||!o||!t||n.kind!=="protocol"||!n.describe.assets)return null;const{maxBytes:i}=n.describe.assets,f=d=>`${o}/assets/${encodeURIComponent(d)}`;return async d=>{if(d.size>i)throw new Error(e("sectionsEditor.fileField.tooLarge",{max:`${Math.floor(i/(1024*1024))} MB`}));if(n.describe.readOnly)throw new Error(e("decoServe.upload.readOnly",{name:d.name}));let l;try{l=await fetch(f(d.name),{method:"PUT",signal:Ge(),headers:{"content-type":d.type||"application/octet-stream"},body:d})}catch{throw new Error(e("decoServe.upload.serverGone",{name:d.name}))}const u=await l.json().catch(()=>null);if(!l.ok||typeof u?.path!="string"){const c=u?.error?.message;throw new Error(e("decoServe.upload.failed",{name:d.name,detail:typeof c=="string"?c:`HTTP ${l.status}`}))}return u.path}}function Et(t,e){const s=P.c(6),n=Fe(t?.virtualMcpId,t?.branch);let a;s[0]!==n||s[1]!==t?.previewUrl?(a=n.kind==="protocol"&&n.source==="sandbox"?t?.previewUrl??null:it(n),s[0]=n,s[1]=t?.previewUrl,s[2]=a):a=s[2];const o=a;let i;return s[3]!==e||s[4]!==o?(i=o&&e.startsWith("/")&&!e.startsWith("//")?new URL(e,o).href:e,s[3]=e,s[4]=o,s[5]=i):i=s[5],i}function It(){const t=P.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=r.jsx("div",{className:"pointer-events-none absolute inset-0 flex items-center justify-center bg-black/40 opacity-0 transition-opacity group-hover:opacity-100 group-focus-within:opacity-100",children:r.jsxs("span",{className:"flex items-center gap-1.5 rounded-md bg-background px-3 py-1.5 text-xs font-medium shadow-soft",children:[r.jsx(Re,{size:14}),"Click to replace"]})}),t[0]=e):e=t[0],e}function Ft(t){try{const e=new URL(t).pathname;return decodeURIComponent(e.split("/").pop()??t)}catch{return t.split("/").pop()??t}}function _t(t){const e=t.lastIndexOf(".");return e<0||e===t.length-1?"":t.slice(e+1).toLowerCase()}const Tt=["low","medium","high","original"];function qe(t){return t==="low"||t==="medium"||t==="high"||t==="original"}function Le(t,e){try{return new URL(t).searchParams.get(e)}catch{const s=Pt(t);for(const n of s){const a=n.indexOf("=");if((a>=0?n.slice(0,a):n)===e)return a>=0?n.slice(a+1):""}return null}}function ze(t,e,s){const n=t.indexOf("#"),a=n>=0?t.slice(n):"",o=n>=0?t.slice(0,n):t,i=o.indexOf("?"),f=i>=0?o.slice(0,i):o,d=(i>=0?o.slice(i+1).split("&"):[]).filter(Boolean).filter(l=>{const u=l.indexOf("=");return(u>=0?l.slice(0,u):l)!==e});return s!==void 0&&d.push(`${e}=${s}`),`${f}${d.length?`?${d.join("&")}`:""}${a}`}function Pt(t){const e=t.indexOf("#"),s=e>=0?t.slice(0,e):t,n=s.indexOf("?");return n<0?[]:s.slice(n+1).split("&").filter(Boolean)}function Ut(t){if(!t)return;const e=Le(t,"quality");return qe(e)?e:void 0}function $t(t,e){return ze(t,"quality",e)}function Rt(t){return t?Le(t,"muted")!=="false":!0}function Ot(t,e){return ze(t,"muted",e?void 0:"false")}function Mt(t){const e=P.c(36),{value:s,onChange:n,showMuted:a}=t,o=a===void 0?!1:a,i=ee(),f=I.useId();let d;e[0]!==s?(d=Ut(s),e[0]=s,e[1]=d):d=e[1];const l=d;let u;e[2]!==s?(u=Rt(s),e[2]=s,e[3]=u):u=e[3];const c=u;let m;e[4]!==i?(m=i("sectionsEditor.mediaTransformControls.mediaOptionsLabel"),e[4]=i,e[5]=m):m=e[5];let x;e[6]===Symbol.for("react.memo_cache_sentinel")?(x=r.jsx(at,{size:14}),e[6]=x):x=e[6];let p;e[7]!==m?(p=r.jsx(lt,{asChild:!0,children:r.jsx(Ne,{type:"button",variant:"outline",size:"sm",className:"h-9 shrink-0","aria-label":m,children:x})}),e[7]=m,e[8]=p):p=e[8];let h;e[9]!==i?(h=i("sectionsEditor.mediaTransformControls.qualityLabel"),e[9]=i,e[10]=h):h=e[10];let g;e[11]!==h?(g=r.jsx(Ce,{className:"text-xs text-muted-foreground",children:h}),e[11]=h,e[12]=g):g=e[12];const w=l??"";let N;e[13]!==n||e[14]!==s?(N=b=>n($t(s,qe(b)?b:void 0)),e[13]=n,e[14]=s,e[15]=N):N=e[15];let y;e[16]===Symbol.for("react.memo_cache_sentinel")?(y=Tt.map(Dt),e[16]=y):y=e[16];let F;e[17]!==N||e[18]!==w?(F=r.jsx(ut,{type:"single",variant:"outline",size:"sm",value:w,onValueChange:N,children:y}),e[17]=N,e[18]=w,e[19]=F):F=e[19];let v;e[20]!==F||e[21]!==g?(v=r.jsxs("div",{className:"flex flex-col gap-1.5",children:[g,F]}),e[20]=F,e[21]=g,e[22]=v):v=e[22];let C;e[23]!==c||e[24]!==f||e[25]!==n||e[26]!==o||e[27]!==i||e[28]!==s?(C=o&&r.jsxs("div",{className:"flex items-center justify-between gap-3",children:[r.jsx(Ce,{htmlFor:f,className:"text-xs text-muted-foreground",children:i("sectionsEditor.mediaTransformControls.mutedLabel")}),r.jsx(ft,{id:f,checked:c,onCheckedChange:b=>n(Ot(s,b))})]}),e[23]=c,e[24]=f,e[25]=n,e[26]=o,e[27]=i,e[28]=s,e[29]=C):C=e[29];let S;e[30]!==v||e[31]!==C?(S=r.jsx(ct,{align:"end",className:"w-auto min-w-52 p-3",children:r.jsxs("div",{className:"flex flex-col gap-3",children:[v,C]})}),e[30]=v,e[31]=C,e[32]=S):S=e[32];let j;return e[33]!==S||e[34]!==p?(j=r.jsxs(dt,{children:[p,S]}),e[33]=S,e[34]=p,e[35]=j):j=e[35],j}function Dt(t){return r.jsx(mt,{value:t,className:"h-8 px-3 text-xs capitalize",children:t},t)}function qt(t){try{const e=new URL(t);return e.protocol==="http:"||e.protocol==="https:"?e.href:""}catch{return""}}const Ae=new Set(["image/png","image/jpeg","image/gif","image/webp","image/svg+xml","image/avif"]);function Lt(t){const e=P.c(26),{siteSlug:s,virtualMcpId:n,onUploaded:a,onNeedsPicker:o,serveUpload:i}=t,f=ee(),l=Ie(n)?.metadata?.assetStorageConfigId,u=!i;let c;e[0]!==u?(c={enabled:u},e[0]=u,e[1]=c):c=e[1];const m=gt(c),x=xt(),[p,h]=I.useState(!1);let g;e[2]!==m.data?.configs?(g=m.data?.configs??[],e[2]=m.data?.configs,e[3]=g):g=e[3];let w;e[4]!==l||e[5]!==s||e[6]!==g?(w=pt(g,s,l),e[4]=l,e[5]=s,e[6]=g,e[7]=w):w=e[7];const y=w?.id??null;let F;e[8]!==m.data?.configs||e[9]!==y||e[10]!==o||e[11]!==a||e[12]!==i||e[13]!==f||e[14]!==x?(F=async function(M){if(!M)return;const $=Array.from(M).filter(zt);if($.length===0){se.error(f("sectionsEditor.imageField.onlyImageFilesAccepted"));return}if(i){try{a(await i($[0]))}catch(_){const T=_;se.error(T instanceof Error?T.message:f("sectionsEditor.imageField.uploadFailed"))}return}const k=Je(m.data?.configs??[],y,typeof window<"u"?window.localStorage.getItem(Xe):null);if(!k){o();return}try{const _=await x.mutateAsync({configId:k,file:$[0]}),T=qt(_.publicUrl);if(!T){se.error(f("sectionsEditor.imageField.uploadFailed"));return}a(T),$.length>1&&se.info(f("sectionsEditor.imageField.uploadedWithExtraFilesIgnored",{fileName:$[0].name}))}catch(_){const T=_;se.error(T instanceof Error?T.message:f("sectionsEditor.imageField.uploadFailed"))}},e[8]=m.data?.configs,e[9]=y,e[10]=o,e[11]=a,e[12]=i,e[13]=f,e[14]=x,e[15]=F):F=e[15];const v=F;let C,S;e[16]===Symbol.for("react.memo_cache_sentinel")?(C=E=>{E.preventDefault(),E.dataTransfer.types.includes("Files")&&h(!0)},S=E=>{E.currentTarget===E.target&&h(!1)},e[16]=C,e[17]=S):(C=e[16],S=e[17]);let j;e[18]!==v?(j={onDragOver:C,onDragLeave:S,onDrop:E=>{E.preventDefault(),E.stopPropagation(),h(!1),v(E.dataTransfer.files)}},e[18]=v,e[19]=j):j=e[19];let b;return e[20]!==v||e[21]!==p||e[22]!==y||e[23]!==j||e[24]!==x.isPending?(b={isDragging:p,isPending:x.isPending,lockedConfigId:y,handleFiles:v,dropProps:j},e[20]=v,e[21]=p,e[22]=y,e[23]=j,e[24]=x.isPending,e[25]=b):b=e[25],b}function zt(t){return Ae.has(t.type||"")}const At=3;function us(t){const e=P.c(98),{schema:s,value:n,onChange:a,path:o,label:i,sandbox:f,compact:d}=t,l=ee();let u;e[0]!==n?(u=bt(n),e[0]=n,e[1]=u):u=e[1];const c=u,[m,x]=I.useState(!1),[p,h]=I.useState(!1),[g,w]=I.useState(!1),N=Et(f,c),[y,F]=I.useState(0);let v;e[2]!==y||e[3]!==N?(v=y>0?`${N}${N.includes("?")?"&":"?"}retry=${y}`:N,e[2]=y,e[3]=N,e[4]=v):v=e[4];let C;e[5]!==v?(C=Ze(v),e[5]=v,e[6]=C):C=e[6];const S=C,j=!!c&&!S;let b,E;e[7]!==c?(b=c?Ft(c):"",E=b?_t(b):"",e[7]=c,e[8]=b,e[9]=E):(b=e[8],E=e[9]);const M=E;let $;e[10]!==a?($=function(fe){h(!1),w(!1),F(0),a(fe)},e[10]=a,e[11]=$):$=e[11];const k=$,[_,T]=I.useState(c),[Be,_e]=I.useState(c);Be!==c&&(_e(c),T(c));let ie;e[12]!==k||e[13]!==c?(ie=function(fe){T(fe);const te=fe.trim();te&&!$e(te)||te!==c&&(_e(te),k(te))},e[12]=k,e[13]=c,e[14]=ie):ie=e[14];const ue=ie;let re;e[15]!==c||e[16]!==_?(re=function(){_.trim()&&!$e(_)&&T(c)},e[15]=c,e[16]=_,e[17]=re):re=e[17];const me=re,R=kt(f),Te=I.useRef(null);let ne;e[18]!==R?(ne=()=>R?Te.current?.click():x(!0),e[18]=R,e[19]=ne):ne=e[19];const D=ne,pe=f?.siteSlug,ge=f?.virtualMcpId;let oe;e[20]===Symbol.for("react.memo_cache_sentinel")?(oe=()=>x(!0),e[20]=oe):oe=e[20];let ae;e[21]!==R||e[22]!==k||e[23]!==ge||e[24]!==pe?(ae={siteSlug:pe,virtualMcpId:ge,onUploaded:k,onNeedsPicker:oe,serveUpload:R},e[21]=R,e[22]=k,e[23]=ge,e[24]=pe,e[25]=ae):ae=e[25];const{isDragging:le,isPending:ce,lockedConfigId:xe,dropProps:he,handleFiles:ve}=Lt(ae),ye=!i&&"hidden";let q;e[26]!==ye?(q=O("min-w-0",ye),e[26]=ye,e[27]=q):q=e[27];const be=f?.virtualMcpId;let L;e[28]!==i||e[29]!==o||e[30]!==s.description||e[31]!==be?(L=r.jsx(St,{htmlFor:o,label:i,description:s.description,labelClassName:"text-muted-foreground",virtualMcpId:be}),e[28]=i,e[29]=o,e[30]=s.description,e[31]=be,e[32]=L):L=e[32];let z;e[33]!==q||e[34]!==L?(z=r.jsx("div",{className:q,children:L}),e[33]=q,e[34]=L,e[35]=z):z=e[35];const je=le&&"border-primary ring-2 ring-primary/30",we=ce&&"pointer-events-none opacity-60";let A;e[36]!==je||e[37]!==we?(A=O("group relative w-full overflow-hidden rounded-[var(--studio-surface-radius,var(--radius-xl))] border shadow-edge border-border/60 bg-muted/30 transition",je,we),e[36]=je,e[37]=we,e[38]=A):A=e[38];let B;e[39]!==D||e[40]!==d||e[41]!==M||e[42]!==b||e[43]!==g||e[44]!==p||e[45]!==ce||e[46]!==i||e[47]!==y||e[48]!==N||e[49]!==S||e[50]!==c||e[51]!==l||e[52]!==j?(B=c?r.jsxs(r.Fragment,{children:[r.jsxs("button",{type:"button",onClick:D,"aria-label":l("sectionsEditor.imageField.replaceImage"),className:O("relative block w-full cursor-pointer bg-[image:linear-gradient(45deg,rgba(0,0,0,0.04)_25%,transparent_25%,transparent_75%,rgba(0,0,0,0.04)_75%),linear-gradient(45deg,rgba(0,0,0,0.04)_25%,transparent_25%,transparent_75%,rgba(0,0,0,0.04)_75%)] bg-[position:0_0,8px_8px] [background-size:16px_16px]",d?"h-28":"h-40"),children:[!g&&!j&&r.jsx("img",{src:S,alt:i,className:O("h-full w-full object-contain transition-opacity",!p&&"opacity-0"),onLoad:()=>h(!0),onError:()=>{N!==c&&y<At?setTimeout(()=>F(Bt),600):w(!0)}},c),(g||j)&&r.jsxs("div",{className:"flex h-full w-full flex-col items-center justify-center gap-1 text-muted-foreground",children:[r.jsx(Ue,{size:20}),r.jsx("p",{className:"text-xs",children:l("sectionsEditor.imageField.previewUnavailable")})]}),!p&&!g&&!j&&r.jsx("div",{className:"absolute inset-0 animate-pulse bg-muted/60"}),r.jsx(It,{})]}),!d&&r.jsxs("div",{className:"flex items-center gap-2 border-t border-border/60 bg-background/50 px-3 py-2",children:[r.jsx("span",{className:"min-w-0 flex-1 truncate text-xs font-medium",children:b}),M&&r.jsx("span",{className:"shrink-0 rounded-[var(--studio-control-radius,var(--radius))] bg-muted px-1.5 py-0.5 text-2xs font-medium uppercase text-muted-foreground",children:M})]})]}):r.jsxs("button",{type:"button",onClick:D,className:O("flex w-full flex-col items-center justify-center gap-2 text-sm text-muted-foreground hover:bg-accent hover:text-foreground",d?"h-28":"h-40"),children:[r.jsx(Ue,{size:20}),r.jsx("span",{className:"text-sm font-medium",children:l(ce?"sectionsEditor.imageField.uploading":"sectionsEditor.imageField.dropImageOrClickToBrowse")}),!d&&r.jsx("span",{className:"text-xs text-muted-foreground",children:l("sectionsEditor.imageField.supportedFormatsAndSize")})]}),e[39]=D,e[40]=d,e[41]=M,e[42]=b,e[43]=g,e[44]=p,e[45]=ce,e[46]=i,e[47]=y,e[48]=N,e[49]=S,e[50]=c,e[51]=l,e[52]=j,e[53]=B):B=e[53];let V;e[54]!==le||e[55]!==l?(V=le&&r.jsx("div",{className:"pointer-events-none absolute inset-0 flex items-center justify-center bg-primary/10 backdrop-blur-[1px]",children:r.jsx("span",{className:"rounded-md bg-background px-3 py-1.5 text-xs font-medium shadow-soft",children:l("sectionsEditor.imageField.dropToUpload")})}),e[54]=le,e[55]=l,e[56]=V):V=e[56];let Q;e[57]!==he||e[58]!==A||e[59]!==B||e[60]!==V?(Q=r.jsxs("div",{...he,className:A,children:[B,V]}),e[57]=he,e[58]=A,e[59]=B,e[60]=V,e[61]=Q):Q=e[61];let G;e[62]!==ue?(G=U=>ue(U.target.value),e[62]=ue,e[63]=G):G=e[63];let W;e[64]!==c?(W=U=>{U.key==="Escape"&&T(c)},e[64]=c,e[65]=W):W=e[65];let Y;e[66]!==l?(Y=l("sectionsEditor.imageField.urlPlaceholder"),e[66]=l,e[67]=Y):Y=e[67];let K;e[68]!==o||e[69]!==me||e[70]!==G||e[71]!==W||e[72]!==Y||e[73]!==_?(K=r.jsx(We,{id:o,type:"url",value:_,onChange:G,onBlur:me,onKeyDown:W,placeholder:Y,className:"h-9 min-w-0 flex-1"}),e[68]=o,e[69]=me,e[70]=G,e[71]=W,e[72]=Y,e[73]=_,e[74]=K):K=e[74];let H;e[75]!==D||e[76]!==c||e[77]!==l?(H=!c&&r.jsxs(Ne,{type:"button",variant:"outline",size:"sm",onClick:D,className:"h-9 shrink-0",children:[r.jsx(Re,{size:14}),l("sectionsEditor.imageField.browse")]}),e[75]=D,e[76]=c,e[77]=l,e[78]=H):H=e[78];let J;e[79]!==k||e[80]!==c||e[81]!==l?(J=c&&r.jsxs(r.Fragment,{children:[r.jsx(Mt,{value:c,onChange:k}),r.jsx(Ne,{type:"button",variant:"ghost",size:"sm",onClick:()=>k(""),className:"h-9 shrink-0","aria-label":l("sectionsEditor.imageField.removeImage"),children:r.jsx(He,{size:14})})]}),e[79]=k,e[80]=c,e[81]=l,e[82]=J):J=e[82];let X;e[83]!==K||e[84]!==H||e[85]!==J?(X=r.jsxs("div",{className:"flex w-full min-w-0 items-center gap-2",children:[K,H,J]}),e[83]=K,e[84]=H,e[85]=J,e[86]=X):X=e[86];let Z;e[87]!==ve||e[88]!==xe||e[89]!==m||e[90]!==R||e[91]!==k?(Z=R?r.jsx("input",{ref:Te,type:"file",accept:[...Ae].join(","),className:"hidden",onChange:U=>{ve(U.target.files),U.target.value=""}}):r.jsx(et,{open:m,onOpenChange:x,mode:"image",onSelect:U=>k(U),lockedConfigId:xe}),e[87]=ve,e[88]=xe,e[89]=m,e[90]=R,e[91]=k,e[92]=Z):Z=e[92];let de;return e[93]!==z||e[94]!==Q||e[95]!==X||e[96]!==Z?(de=r.jsxs("div",{className:"grid w-full min-w-0 grid-cols-[minmax(0,1fr)] gap-2",children:[z,Q,X,Z]}),e[93]=z,e[94]=Q,e[95]=X,e[96]=Z,e[97]=de):de=e[97],de}function Bt(t){return t+1}function ms(t){const e=P.c(15),{isPending:s,isError:n}=t,a=ee();if(n){let d;e[0]===Symbol.for("react.memo_cache_sentinel")?(d=r.jsx(ht,{size:13}),e[0]=d):d=e[0];let l;e[1]!==a?(l=a("sandbox.saveStatus.failed"),e[1]=a,e[2]=l):l=e[2];let u;return e[3]!==l?(u=r.jsxs("span",{className:"flex items-center gap-1.5 text-xs text-destructive",children:[d,l]}),e[3]=l,e[4]=u):u=e[4],u}if(s){let d;e[5]===Symbol.for("react.memo_cache_sentinel")?(d=r.jsx(Ye,{className:"size-[13px]"}),e[5]=d):d=e[5];let l;e[6]!==a?(l=a("sandbox.saveStatus.saving"),e[6]=a,e[7]=l):l=e[7];let u;return e[8]!==l?(u=r.jsxs("span",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[d,l]}),e[8]=l,e[9]=u):u=e[9],u}let o;e[10]===Symbol.for("react.memo_cache_sentinel")?(o=r.jsx(Ke,{size:13}),e[10]=o):o=e[10];let i;e[11]!==a?(i=a("sandbox.saveStatus.saved"),e[11]=a,e[12]=i):i=e[12];let f;return e[13]!==i?(f=r.jsxs("span",{className:"flex items-center gap-1.5 text-xs text-muted-foreground/70",children:[o,i]}),e[13]=i,e[14]=f):f=e[14],f}export{It as C,St as F,us as I,jt as M,cs as N,Tt as Q,ds as R,ms as S,yt as a,De as b,wt as c,Ct as d,bt as e,Ft as f,_t as g,kt as h,fs as i,Et as j,Mt as k,Ut as l,Lt as m,$t as s,vt as u};