PageSourceSearch

https://generateugc.ai/_next/static/chunks/pages/admin/_panels/CarouselArchetypes-ab5f1b9e5e715c8b.js

js generateugc.ai collected 2026-10-05 12:15:23 UTC 12,416 bytes, 1 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4741],{92509:function(e,t,a){"use strict";a.d(t,{Z:function(){return r}});let r=(0,a(91373).Z)("LayoutGrid",[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}]])},42297:function(e,t,a){"use strict";a.d(t,{Z:function(){return r}});let r=(0,a(91373).Z)("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]])},30713:function(e,t,a){"use strict";a.d(t,{Z:function(){return r}});let r=(0,a(91373).Z)("RotateCcw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]])},73696:function(e,t,a){"use strict";a.d(t,{Z:function(){return r}});let r=(0,a(91373).Z)("Save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]])},13718:function(e,t,a){"use strict";a.d(t,{Z:function(){return r}});let r=(0,a(91373).Z)("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]])},40116:function(e,t,a){"use strict";a.d(t,{Z:function(){return r}});let r=(0,a(91373).Z)("TriangleAlert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]])},80806:function(e,t,a){(window.__NEXT_P=window.__NEXT_P||[]).push(["/admin/_panels/CarouselArchetypes",function(){return a(71532)}])},44115:function(e,t,a){"use strict";var r=a(85893);a(67294),t.Z=function(e){let{length:t=10}=e;return(0,r.jsx)("div",{className:"loading-skeleton",style:{width:"".concat(t,"ch")}})}},71532:function(e,t,a){"use strict";a.r(t);var r=a(85893),s=a(27039),i=a(67294),l=a(42297),n=a(92509),d=a(40116),c=a(85594),o=a(13718),u=a(30713),h=a(73696),x=a(86501),m=a(57712),p=a(44115);let f={firestore:{label:"Firestore (live)",cls:"bg-emerald-500/10 text-emerald-400 border-emerald-500/30"},builtin:{label:"Builtin default",cls:"bg-blue-500/10 text-blue-400 border-blue-500/30"},missing:{label:"Missing",cls:"bg-red-500/10 text-red-400 border-red-500/30"}};t.default=function(){var e,t;let[a,y]=(0,i.useState)([]),[v,b]=(0,i.useState)(""),[g,w]=(0,i.useState)(null),[N,j]=(0,i.useState)(""),[k,S]=(0,i.useState)(""),[A,Z]=(0,i.useState)([]),[C,M]=(0,i.useState)(!0),[_,E]=(0,i.useState)(!1),[F,R]=(0,i.useState)(!1),[L,O]=(0,i.useState)(!1),[B,T]=(0,i.useState)(!1),V=(0,i.useMemo)(()=>a.find(e=>e.id===v)||null,[a,v]),J=async()=>{M(!0);try{let e=await m.default.get("".concat("https://generateugc.ai/api","/admin/carousel-archetypes")),t=(null==e?void 0:e.archetypes)||[];y(t),!v&&t.length>0&&b(t[0].id)}catch(e){x.Am.error("Failed to load carousel archetypes")}finally{M(!1)}},q=async e=>{E(!0),Z([]);try{var t;let a=await m.default.get("".concat("https://generateugc.ai/api","/admin/carousel-archetypes/").concat(e)),r={id:e,source:(null==a?void 0:a.source)||"missing",data:null!==(t=null==a?void 0:a.data)&&void 0!==t?t:{}};w(r),j(JSON.stringify(r.data,null,2)),S("")}catch(t){x.Am.error("Failed to load ".concat(e))}finally{E(!1)}};(0,i.useEffect)(()=>{J()},[]),(0,i.useEffect)(()=>{v&&q(v)},[v]);let H=()=>{try{let e=JSON.parse(N);if(null===e||"object"!=typeof e||Array.isArray(e))return S("Top-level value must be a JSON object"),null;return S(""),e}catch(e){return S((null==e?void 0:e.message)||"Invalid JSON"),null}},z=async()=>{if(!v)return;let e=H();if(null===e){x.Am.error("Fix JSON errors before saving");return}R(!0),Z([]);try{await m.default.put("".concat("https://generateugc.ai/api","/admin/carousel-archetypes/").concat(v),{data:e}),x.Am.success("".concat(v," saved")),await J(),await q(v)}catch(s){var t,a,r;let e=(null==s?void 0:null===(a=s.response)||void 0===a?void 0:null===(t=a.data)||void 0===t?void 0:t.validationErrors)||(null==s?void 0:null===(r=s.data)||void 0===r?void 0:r.validationErrors)||(Array.isArray(null==s?void 0:s.validationErrors)?s.validationErrors:null);Array.isArray(e)&&e.length>0?(Z(e),x.Am.error("".concat(e.length," validation error(s) — see panel below"))):x.Am.error("Save failed")}finally{R(!1)}},D=async()=>
1{if(v){if(!(null==V?void 0:V.isBuiltin)){x.Am.error("No builtin seed exists for this archetype — cannot reset to default");return}if(window.confirm('Reset "'.concat(v,'" to the bundled builtin default? This will overwrite the Firestore doc.'))){O(!0);try{await m.default.post("".concat("https://generateugc.ai/api","/admin/carousel-archetypes/").concat(v,"/reset"),{}),x.Am.success("Reset to builtin default"),await J(),await q(v)}catch(e){x.Am.error("Reset failed")}finally{O(!1)}}}},P=async()=>{if(v&&window.confirm('Clear the Firestore override for "'.concat(v,'"? Reads will fall back to the builtin default.'))){T(!0);try{await m.default.delete("".concat("https://generateugc.ai/api","/admin/carousel-archetypes/").concat(v)),x.Am.success("Override cleared"),await J(),await q(v)}catch(e){x.Am.error("Clear failed")}finally{T(!1)}}};return(0,r.jsxs)(s.E.div,{initial:{opacity:0,y:12},animate:{opacity:1,y:0},className:"flex flex-col w-full space-y-4",children:[(0,r.jsx)("div",{className:"bg-[#141414] border border-white/5 p-4 rounded-lg",children:(0,r.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("h3",{className:"text-sm font-medium text-white",children:"Carousel Archetypes"}),(0,r.jsxs)("p",{className:"text-xs text-gray-400 mt-1",children:["Viral carousel format templates for the planner — slide role sequences, hook formulas, niche fit, and brief injection rules. Resolution: Firestore → builtin defaults. Set ",(0,r.jsx)("code",{className:"text-[10px]",children:"active: false"})," to retire an archetype without deleting it."]})]}),(0,r.jsxs)("button",{onClick:J,className:"text-xs text-white/70 hover:text-white flex items-center gap-1",children:[(0,r.jsx)(l.Z,{className:"w-3 h-3"})," Refresh"]})]})}),(0,r.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-[280px_1fr] gap-4",children:[(0,r.jsx)("div",{className:"bg-[#141414] border border-white/5 rounded-lg p-2 space-y-1 max-h-[75vh] overflow-y-auto",children:C?Array.from({length:6}).map((e,t)=>(0,r.jsx)("div",{className:"px-3 py-2 text-xs text-white/60",children:(0,r.jsx)(p.Z,{length:14})},t)):0===a.length?(0,r.jsx)("div",{className:"text-xs text-gray-400 px-3 py-2",children:"No archetypes available"}):a.map(e=>{let t=f[e.source]||f.missing,a=e.id===v;return(0,r.jsxs)("button",{onClick:()=>b(e.id),className:"w-full text-left px-3 py-2 rounded-md transition-colors ".concat(a?"bg-white/[0.06] border border-white/10":"hover:bg-white/[0.03] border border-transparent"),children:[(0,r.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2 min-w-0",children:[(0,r.jsx)(n.Z,{className:"w-3 h-3 text-white/50 flex-shrink-0"}),(0,r.jsx)("div",{className:"text-sm text-white truncate",children:e.name||e.id})]}),(0,r.jsx)("span",{className:"text-[10px] px-1.5 py-0.5 rounded border whitespace-nowrap ".concat(t.cls),children:t.label})]}),(0,r.jsxs)("div",{className:"text-[10px] text-gray-500 truncate mt-0.5 font-mono",children:[e.id,e.active?"":" \xb7 inactive"]})]},e.id)})}),(0,r.jsx)("div",{className:"bg-[#141414] border border-white/5 rounded-lg p-4 flex flex-col",children:v?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{className:"flex items-start justify-between gap-3 mb-3",children:[(0,r.jsxs)("div",{children:[(0,r.jsxs)("h4",{className:"text-sm font-medium text-white",children:[(null==V?void 0:V.name)||v,(0,r.jsx)("span",{className:"ml-2 text-[10px] text-gray-500 font-mono",children:v})]}),(0,r.jsx)("p",{className:"text-xs text-gray-400 mt-0.5",children:g?function(e){if(!e||"object"!=typeof e)return"";let t=e.recommendedSlideCount;return[t&&"object"==typeof t?"".concat(t.min,"–").concat(t.max," slides (default ").concat(t.default,")"):"",Array.isArray(e.bestForNiches)?e.bestForNiches.slice(0,3).join(", "):""].filter(Boolean).join(" \xb7 ")}(g.data):""})]}),(0,r.jsxs)("div",{className:"text-[11px] text-gray-400 text-right",children:[g&&(0,r.jsxs)("span",{className:"inline-block px-2 py-0.5 rounded border ".concat((null===(e=f[g.source])||void 0===e?void 0:e.cls)||""),children:["Live source: ",(null===(t=f[g.source])||void 0===t?void 0:t.label)||g.source]}),(null==V?void 0:V.firestore)&&(0,r.jsxs)("div",{className:"mt-1 text-[10px] text-gray-500",children:["Last saved ",function(e){if(!e)return"—";try{if("object"==typeof e&&e._seconds)return new Date(1e3*e._seconds).toLocaleStr
1ing();if("string"==typeof e){let t=new Date(e);return Number.isNaN(t.getTime())?"—":t.toLocaleString()}}catch(e){}return"—"}(V.firestore.updatedAt),V.firestore.updatedBy?" by ".concat(V.firestore.updatedBy.slice(0,8),"…"):""]})]})]}),_?(0,r.jsx)("div",{className:"text-xs text-gray-400",children:"Loading…"}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("textarea",{value:N,onChange:e=>{j(e.target.value),k&&S(""),A.length>0&&Z([])},spellCheck:!1,className:"w-full h-[60vh] min-h-[400px] bg-[#0d0d0d] border border-white/10 rounded-md p-3 font-mono text-[12px] leading-5 text-white focus:outline-none focus:border-white/20"}),(0,r.jsxs)("div",{className:"mt-2 flex items-center justify-between",children:[(0,r.jsx)("div",{className:"text-[11px] flex items-center gap-2",children:k?(0,r.jsxs)("span",{className:"text-red-400 flex items-center gap-1",children:[(0,r.jsx)(d.Z,{className:"w-3 h-3"}),k]}):(0,r.jsxs)("span",{className:"text-gray-500 flex items-center gap-1",children:[(0,r.jsx)(c.Z,{className:"w-3 h-3 text-emerald-400"}),"Valid JSON"]})}),(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)("button",{onClick:()=>H(),className:"text-[11px] text-white/70 hover:text-white px-3 py-1.5 border border-white/10 rounded-md",children:"Validate"}),(0,r.jsxs)("button",{onClick:P,disabled:B||(null==V?void 0:V.source)!=="firestore",className:"text-[11px] flex items-center gap-1 text-red-300 hover:text-red-200 px-3 py-1.5 border border-red-500/30 rounded-md disabled:opacity-40 disabled:cursor-not-allowed",title:(null==V?void 0:V.source)!=="firestore"?"Nothing to clear (already on builtin default)":"Clear Firestore override",children:[(0,r.jsx)(o.Z,{className:"w-3 h-3"}),"Clear override"]}),(0,r.jsxs)("button",{onClick:D,disabled:L||!(null==V?void 0:V.isBuiltin),className:"text-[11px] flex items-center gap-1 text-amber-300 hover:text-amber-200 px-3 py-1.5 border border-amber-500/30 rounded-md disabled:opacity-40 disabled:cursor-not-allowed",title:(null==V?void 0:V.isBuiltin)?"Reset to bundled default":"No builtin seed exists for this archetype",children:[(0,r.jsx)(u.Z,{className:"w-3 h-3"}),"Reset to default"]}),(0,r.jsxs)("button",{onClick:z,disabled:F||!!k,className:"text-[11px] flex items-center gap-1 text-white bg-white/10 hover:bg-white/15 px-3 py-1.5 rounded-md border border-white/15 disabled:opacity-40",children:[(0,r.jsx)(h.Z,{className:"w-3 h-3"}),F?"Saving…":"Save"]})]})]}),A.length>0&&(0,r.jsxs)("div",{className:"mt-3 p-3 bg-red-500/5 border border-red-500/20 rounded-md",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2 mb-2",children:[(0,r.jsx)(d.Z,{className:"w-3.5 h-3.5 text-red-400"}),(0,r.jsxs)("span",{className:"text-[11px] font-medium text-red-300",children:["Schema validation failed (",A.length," error",1===A.length?"":"s",")"]})]}),(0,r.jsx)("ul",{className:"space-y-1",children:A.map((e,t)=>(0,r.jsxs)("li",{className:"text-[11px] text-red-200/90 font-mono leading-relaxed",children:["• ",e]},t))})]})]})]}):(0,r.jsx)("div",{className:"text-xs text-gray-400",children:"Select an archetype on the left."})})]})]})}}},function(e){e.O(0,[7039,9774,2888,179],function(){return e(e.s=80806)}),_N_E=e.O()}]);

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.