@socialgen_user/socialgen 2.3.7 → 2.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/.output/nitro.json +1 -1
  2. package/.output/public/_nuxt/{CpvOZWox.js → AG4bRgGu.js} +1 -1
  3. package/.output/public/_nuxt/{DR2NdyVN.js → BETWg864.js} +1 -1
  4. package/.output/public/_nuxt/{wZeFhB0j.js → BLYectCX.js} +1 -1
  5. package/.output/public/_nuxt/{8t3Wih-_.js → Cq3K0UDH.js} +2 -2
  6. package/.output/public/_nuxt/DP0BHYkh.js +91 -0
  7. package/.output/public/_nuxt/{DO1pBuIJ.js → DszeSBqN.js} +1 -1
  8. package/.output/public/_nuxt/{1ESij7sf.js → RbQ85fIq.js} +1 -1
  9. package/.output/public/_nuxt/builds/latest.json +1 -1
  10. package/.output/public/_nuxt/builds/meta/e4bcda54-37b9-414a-891f-80bc074eb01c.json +1 -0
  11. package/.output/public/_nuxt/pages.BNNMR0bP.css +1 -0
  12. package/.output/server/chunks/_/nitro.mjs +115 -115
  13. package/.output/server/chunks/build/LivePreview-styles.BbGT7KVf.mjs +8 -0
  14. package/.output/server/chunks/build/LivePreview-styles.BbGT7KVf.mjs.map +1 -0
  15. package/.output/server/chunks/build/client.precomputed.mjs +1 -1
  16. package/.output/server/chunks/build/client.precomputed.mjs.map +1 -1
  17. package/.output/server/chunks/build/entry-styles.ZVVAUeV7.mjs +8 -0
  18. package/.output/server/chunks/build/entry-styles.ZVVAUeV7.mjs.map +1 -0
  19. package/.output/server/chunks/build/index-styles-1.mjs-CBmp9qkk.mjs +4 -0
  20. package/.output/server/chunks/build/index-styles-1.mjs-CBmp9qkk.mjs.map +1 -0
  21. package/.output/server/chunks/build/index-styles.B8HyMUMp.mjs +11 -0
  22. package/.output/server/chunks/build/index-styles.B8HyMUMp.mjs.map +1 -0
  23. package/.output/server/chunks/build/{pages-DAxeAK3-.mjs → pages-ClwYJnbM.mjs} +196 -136
  24. package/.output/server/chunks/build/pages-ClwYJnbM.mjs.map +1 -0
  25. package/.output/server/chunks/build/server.mjs +1 -1
  26. package/.output/server/chunks/build/styles.mjs +5 -4
  27. package/.output/server/chunks/build/styles.mjs.map +1 -1
  28. package/.output/server/package.json +1 -1
  29. package/data/history.json +11 -6
  30. package/data/history_generations.json +132 -0
  31. package/data/templates.json +63 -0
  32. package/package.json +1 -1
  33. package/.output/public/_nuxt/JDUjn-YJ.js +0 -91
  34. package/.output/public/_nuxt/builds/meta/dd531369-b462-4ab9-9c49-be9d1a58097d.json +0 -1
  35. package/.output/public/_nuxt/pages.Df3hoeGN.css +0 -1
  36. package/.output/server/chunks/build/entry-styles.BcjSvkjT.mjs +0 -8
  37. package/.output/server/chunks/build/entry-styles.BcjSvkjT.mjs.map +0 -1
  38. package/.output/server/chunks/build/index-styles.CQioNwpv.mjs +0 -8
  39. package/.output/server/chunks/build/index-styles.CQioNwpv.mjs.map +0 -1
  40. package/.output/server/chunks/build/pages-DAxeAK3-.mjs.map +0 -1
@@ -0,0 +1,91 @@
1
+ import{h as Qt,d as ua,i as S,M as ke,o as ca,A as p,B as m,l as o,C as t,E as k,G as z,D as x,N as I,O as ue,P as Ae,Q as at,R as St,S as xe,T as he,U as Ne,V as ft,W as j,X as Ee,Y as ea,m as ce,c as ds,Z as Oa,_ as us}from"./Cq3K0UDH.js";import{_ as cs}from"./BETWg864.js";async function ht(n){if(!n)return!1;if(typeof window<"u"&&window.isSecureContext&&navigator?.clipboard?.writeText)try{return await navigator.clipboard.writeText(n),!0}catch(e){console.warn("[SocialGen Clipboard] navigator.clipboard.writeText failed, falling back to execCommand:",e)}if(typeof document<"u")try{const e=document.createElement("textarea");if(e.value=n,e.style.position="fixed",e.style.left="-9999px",e.style.top=(window.pageYOffset||document.documentElement.scrollTop||0)+"px",e.style.width="2em",e.style.height="2em",e.style.padding="0",e.style.border="none",e.style.outline="none",e.style.boxShadow="none",e.style.background="transparent",e.style.fontSize="16px",document.body.appendChild(e),typeof navigator<"u"&&/ipad|iphone|ipod/i.test(navigator.userAgent)){e.contentEditable="true",e.readOnly=!1;const l=document.createRange();l.selectNodeContents(e);const d=window.getSelection();d&&(d.removeAllRanges(),d.addRange(l)),e.setSelectionRange(0,999999)}else e.focus(),e.select();let i=!1;try{i=document.execCommand("copy")}catch(l){console.warn("[SocialGen Clipboard] execCommand call threw error:",l)}if(document.body.removeChild(e),i)return!0}catch(e){console.warn("[SocialGen Clipboard] DOM fallback failed:",e)}return!1}const ps=n=>n.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();var Tt={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":2,"stroke-linecap":"round","stroke-linejoin":"round"};const fs=({size:n,strokeWidth:e=2,absoluteStrokeWidth:s,color:i,iconNode:l,name:d,class:f,...c},{slots:C})=>Qt("svg",{...Tt,width:n||Tt.width,height:n||Tt.height,stroke:i||Tt.stroke,"stroke-width":s?Number(e)*24/Number(n):e,class:["lucide",`lucide-${ps(d??"icon")}`],...c},[...l.map(w=>Qt(...w)),...C.default?[C.default()]:[]]);const Z=(n,e)=>(s,{slots:i})=>Qt(fs,{...s,iconNode:e,name:n},i);const Gt=Z("BookmarkIcon",[["path",{d:"m19 21-7-4-7 4V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2v16z",key:"1fy3hk"}]]);const qe=Z("CheckIcon",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);const Aa=Z("CircleAlertIcon",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);const ms=Z("CircleCheckIcon",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);const Kt=Z("ClockIcon",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);const Wt=Z("CodeIcon",[["polyline",{points:"16 18 22 12 16 6",key:"z7tu5w"}],["polyline",{points:"8 6 2 12 8 18",key:"1eg1df"}]]);const Ze=Z("CopyIcon",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);const Na=Z("EyeIcon",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);const qt=Z("FileTextIcon",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]);const ta=Z("FilmIcon",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M7 3v18",key:"bbkbws"}],["path",{d:"M3 7.5h4",key:"zfgn84"}],["path",{d:"M3 12h18",key:"1i2n21"}],["path",{d:"M3 16.5h4",key:"1230mu"}],["path",{d:"M17 3v18",key:"in4fa5"}],["path",{d:"M17 7.5h4",key:"myr1c1"}],["path",{d:"M17 16.5h4",key:"go4c1d"}]]);const xs=Z("GlobeIcon",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]]);const hs=Z("LayersIcon",[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",key:"zw3jo"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",key:"1wduqc"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",key:"kqbvx6"}]]);const Ia=Z("LayoutTemplateIcon",[["rect",{width:"18",height:"7",x:"3",y:"3",rx:"1",key:"f1a2em"}],["rect",{width:"9",height:"7",x:"3",y:"14",rx:"1",key:"jqznyg"}],["rect",{width:"5",height:"7",x:"16",y:"14",rx:"1",key:"q5h2i8"}]]);const aa=Z("MusicIcon",[["path",{d:"M9 18V5l12-2v13",key:"1jmyc2"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["circle",{cx:"18",cy:"16",r:"3",key:"1hluhg"}]]);const bs=Z("PauseIcon",[["rect",{x:"14",y:"4",width:"4",height:"16",rx:"1",key:"zuxfzm"}],["rect",{x:"6",y:"4",width:"4",height:"16",rx:"1",key:"1okwgv"}]]);const Ct=Z("PenIcon",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}]]);const Wa=Z("PlayIcon",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]]);const mt=Z("PlusIcon",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);const Ma=Z("RefreshCwIcon",[["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"}]]);const qa=Z("RotateCcwIcon",[["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"}]]);const sa=Z("ScissorsIcon",[["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M8.12 8.12 12 12",key:"1alkpv"}],["path",{d:"M20 4 8.12 15.88",key:"xgtan2"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M14.8 14.8 20 20",key:"ptml3r"}]]);const $a=Z("SettingsIcon",[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);const gs=Z("ShieldAlertIcon",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M12 16h.01",key:"1drbdi"}]]);const vs=Z("SlidersVerticalIcon",[["line",{x1:"4",x2:"4",y1:"21",y2:"14",key:"1p332r"}],["line",{x1:"4",x2:"4",y1:"10",y2:"3",key:"gb41h5"}],["line",{x1:"12",x2:"12",y1:"21",y2:"12",key:"hf2csr"}],["line",{x1:"12",x2:"12",y1:"8",y2:"3",key:"1kfi7u"}],["line",{x1:"20",x2:"20",y1:"21",y2:"16",key:"1lhrwl"}],["line",{x1:"20",x2:"20",y1:"12",y2:"3",key:"16vvfq"}],["line",{x1:"2",x2:"6",y1:"14",y2:"14",key:"1uebub"}],["line",{x1:"10",x2:"14",y1:"8",y2:"8",key:"1yglbp"}],["line",{x1:"18",x2:"22",y1:"16",y2:"16",key:"1jxqpz"}]]);const nt=Z("SparklesIcon",[["path",{d:"M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z",key:"4pj2yx"}],["path",{d:"M20 3v4",key:"1olli1"}],["path",{d:"M22 5h-4",key:"1gvqau"}],["path",{d:"M4 17v2",key:"vumght"}],["path",{d:"M5 18H3",key:"zchphs"}]]);const st=Z("Trash2Icon",[["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"}]]);const Ot=Z("UploadIcon",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"17 8 12 3 7 8",key:"t8dd8p"}],["line",{x1:"12",x2:"12",y1:"3",y2:"15",key:"widbto"}]]);const ys=Z("Volume2Icon",[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["path",{d:"M16 9a5 5 0 0 1 0 6",key:"1q6k2b"}],["path",{d:"M19.364 18.364a9 9 0 0 0 0-12.728",key:"ijwkga"}]]);const ks=Z("VolumeXIcon",[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["line",{x1:"22",x2:"16",y1:"9",y2:"15",key:"1ewh16"}],["line",{x1:"16",x2:"22",y1:"9",y2:"15",key:"5ykzw1"}]]);const ws=Z("WandSparklesIcon",[["path",{d:"m21.64 3.64-1.28-1.28a1.21 1.21 0 0 0-1.72 0L2.36 18.64a1.21 1.21 0 0 0 0 1.72l1.28 1.28a1.2 1.2 0 0 0 1.72 0L21.64 5.36a1.2 1.2 0 0 0 0-1.72",key:"ul74o6"}],["path",{d:"m14 7 3 3",key:"1r5n42"}],["path",{d:"M5 6v4",key:"ilb8ba"}],["path",{d:"M19 14v4",key:"blhpug"}],["path",{d:"M10 2v2",key:"7u0qdc"}],["path",{d:"M7 8H3",key:"zfb6yr"}],["path",{d:"M21 16h-4",key:"1cnmox"}],["path",{d:"M11 3H9",key:"1obp7u"}]]);const Yt=Z("XIcon",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);const _s=Z("ZoomInIcon",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"11",x2:"11",y1:"8",y2:"14",key:"1vmskp"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]]);const Ss=Z("ZoomOutIcon",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]]),Ts={class:"flex flex-col gap-3 text-slate-100"},Cs={key:0,class:"fixed inset-0 z-50 bg-black/80 backdrop-blur-sm flex items-center justify-center p-4"},Os={class:"bg-slate-900 border border-slate-700 rounded-3xl max-w-xl w-full p-5 shadow-2xl flex flex-col gap-4 text-xs max-h-[90vh] overflow-y-auto custom-scrollbar"},As={class:"flex items-center justify-between pb-3 border-b border-slate-800"},Ns={class:"text-sm font-black text-white flex items-center gap-2"},Is={class:"p-3.5 bg-slate-950 rounded-2xl border border-slate-800 flex flex-col gap-2.5"},Ms={class:"font-bold text-sky-400 flex items-center justify-between"},$s={class:"grid grid-cols-1 sm:grid-cols-2 gap-2"},Ds={class:"flex flex-col gap-2"},js={class:"text-[11px] font-bold text-slate-400 uppercase tracking-wider"},Es={class:"flex flex-col gap-2 max-h-[220px] overflow-y-auto pr-1 custom-scrollbar"},Rs={class:"flex-1"},Ps={class:"flex items-center gap-2 mb-1"},Ls={class:"font-extrabold text-white text-xs"},Vs={class:"px-1.5 py-0.2 rounded text-[9px] font-bold bg-slate-800 text-slate-300 border border-slate-700"},Bs={class:"text-[11px] text-slate-400 leading-snug"},Js={class:"flex items-center gap-1"},Fs=["onClick"],Zs=["onClick"],Us={key:1,class:"fixed inset-0 z-50 bg-black/80 backdrop-blur-sm flex items-center justify-center p-4"},Hs={class:"bg-slate-900 border border-slate-700 rounded-3xl max-w-2xl w-full p-6 shadow-2xl flex flex-col gap-4 text-xs max-h-[90vh]"},zs={class:"flex items-center justify-between pb-3 border-b border-slate-800"},Gs={class:"text-sm font-black text-white flex items-center gap-2"},Ks={class:"flex items-center gap-2 bg-slate-950 p-2.5 rounded-xl border border-slate-800 text-[11px] flex-wrap"},Ws={class:"text-white font-semibold"},qs={class:"text-white font-semibold"},Ys={class:"text-white font-semibold"},Xs={class:"text-purple-400 font-bold"},Qs={class:"relative flex-1 min-h-[220px]"},en=["value"],tn={class:"flex items-center justify-between pt-2 border-t border-slate-800"},an={class:"bg-slate-900 border border-slate-700 rounded-3xl max-w-2xl w-full p-5 shadow-2xl flex flex-col gap-4 text-xs max-h-[92vh] overflow-hidden"},sn={class:"flex items-center justify-between pb-3 border-b border-slate-800"},nn={class:"text-sm font-black text-white flex items-center gap-2"},on={class:"flex items-center justify-between bg-slate-950 p-1 rounded-xl border border-slate-800"},ln={class:"flex items-center gap-1"},rn={key:0,class:"px-2.5 py-0.5 rounded-lg bg-amber-500/20 text-amber-300 border border-amber-500/40 text-[10px] font-bold flex items-center gap-1"},dn={key:0,class:"flex-1 overflow-y-auto pr-1 flex flex-col gap-2.5 custom-scrollbar min-h-[300px]"},un={key:0,class:"text-center py-12 text-slate-500 text-xs"},cn={class:"flex-1 min-w-0"},pn={class:"flex items-center gap-2 mb-1 flex-wrap"},fn={class:"font-extrabold text-white text-xs"},mn={class:"px-1.5 py-0.2 rounded text-[9px] font-bold bg-sky-950 text-sky-300 border border-sky-800"},xn={class:"text-[9px] text-slate-500 font-mono"},hn={class:"text-[11px] text-slate-400 leading-snug line-clamp-2"},bn={class:"flex items-center gap-1.5 flex-shrink-0 self-end sm:self-center"},gn=["onClick"],vn=["onClick"],yn=["onClick"],kn=["onClick"],wn={key:1,class:"flex-1 overflow-y-auto pr-1 flex flex-col gap-3 custom-scrollbar min-h-[350px]"},_n={key:0,class:"p-2 rounded-xl bg-rose-950/60 border border-rose-500/50 text-rose-300 text-[11px] font-semibold"},Sn={key:1,class:"p-2.5 rounded-2xl bg-amber-950/60 border border-amber-500/50 text-amber-200 text-xs flex items-center justify-between shadow-lg"},Tn={class:"flex items-center gap-2 min-w-0"},Cn={class:"p-1 rounded-lg bg-amber-500/20 text-amber-400 shrink-0"},On={class:"min-w-0"},An={class:"font-extrabold text-white text-xs flex items-center gap-1.5 truncate"},Nn={class:"text-amber-300 truncate"},In={class:"text-[10px] text-amber-400/80"},Mn={class:"p-3 rounded-2xl bg-gradient-to-r from-sky-950/60 via-indigo-950/40 to-slate-900 border border-sky-500/30 flex flex-col gap-2.5"},$n={class:"flex flex-col sm:flex-row sm:items-center justify-between gap-2"},Dn={class:"flex items-center gap-1.5 shrink-0 flex-wrap"},jn=["title"],En={key:0,class:"mt-1 flex flex-col gap-2 p-2.5 rounded-xl bg-slate-950/90 border border-sky-500/40"},Rn={class:"flex items-center justify-between"},Pn=["value"],Ln={key:1,class:"mt-1 flex flex-col gap-2 p-2.5 rounded-xl bg-slate-950/90 border border-sky-500/40"},Vn={class:"flex justify-end gap-2"},Bn={class:"grid grid-cols-1 sm:grid-cols-3 gap-2.5"},Jn=["disabled"],Fn={class:"grid grid-cols-1 sm:grid-cols-2 gap-2.5"},Zn=["value"],Un={key:2,class:"flex flex-col gap-2.5 p-3 rounded-2xl bg-slate-950/80 border border-sky-500/30"},Hn={class:"flex items-center justify-between"},zn={class:"text-[11px] font-black text-sky-400 flex items-center gap-1"},Gn={class:"flex items-center justify-end gap-2 pt-2 border-t border-slate-800"},Kn={class:"flex lg:hidden flex-col gap-3 pb-24"},Wn={class:"flex items-center justify-between gap-1 p-1 bg-slate-900/95 border border-slate-800 rounded-2xl shadow-lg sticky top-0 z-20 backdrop-blur-md"},qn={class:"flex items-center gap-1 overflow-x-auto no-scrollbar flex-1 py-0.5"},Yn={key:0,class:"flex flex-col gap-3"},Xn={class:"flex items-start gap-2.5"},Qn={class:"min-w-0 flex-1"},eo={class:"font-black text-white text-xs"},to={class:"text-[11px] mt-0.5 leading-relaxed opacity-90"},ao={key:0},so={key:1},no={class:"underline text-white"},oo={class:"underline text-white"},io={key:2},lo={class:"flex items-center gap-2 pt-1 border-t border-white/10 flex-wrap"},ro={key:1,class:"p-2.5 rounded-xl bg-slate-900/60 border border-slate-800 flex items-center justify-between text-[11px] shadow-sm"},uo={class:"flex items-center gap-2 text-slate-300 truncate"},co={class:"font-extrabold text-white truncate"},po={class:"p-3.5 bg-slate-900/90 border border-slate-800 rounded-2xl space-y-1.5 shadow-md"},fo=["value"],mo={class:"p-3.5 bg-slate-900/90 border border-slate-800 rounded-2xl space-y-1.5 shadow-md"},xo=["value"],ho={class:"grid grid-cols-1 sm:grid-cols-2 gap-2.5"},bo={class:"p-3 bg-slate-900/90 border border-slate-800 rounded-2xl space-y-1 shadow-md"},go=["value"],vo={class:"p-3 bg-slate-900/90 border border-slate-800 rounded-2xl space-y-1 shadow-md"},yo=["value"],ko={class:"p-3.5 bg-slate-900/90 border border-slate-800 rounded-2xl space-y-2 shadow-md"},wo={class:"flex items-center justify-between"},_o=["value"],So={key:1,class:"flex flex-col gap-3"},To={class:"p-3.5 bg-slate-900/90 border border-slate-800 rounded-2xl space-y-2.5 shadow-md"},Co={class:"flex items-center justify-between"},Oo={class:"text-xs font-extrabold text-white"},Ao={key:0,class:"p-2.5 rounded-xl bg-amber-950/70 border border-amber-500/40 text-amber-200 text-xs flex items-center justify-between shadow"},No={class:"flex items-center gap-1.5 truncate"},Io={class:"text-[11px] truncate"},Mo={key:0},$o={key:1},Do={key:2},jo={class:"flex gap-2 overflow-x-auto no-scrollbar py-1"},Eo=["onClick"],Ro={class:"w-8 h-8 rounded-xl bg-slate-800 flex items-center justify-center text-sm shadow"},Po={class:"text-[10px] font-black text-white leading-tight truncate w-full"},Lo={class:"p-3.5 bg-slate-900/90 border border-slate-800 rounded-2xl space-y-2.5 shadow-md"},Vo={class:"flex items-center justify-between"},Bo={class:"text-[10px] text-sky-400 font-bold"},Jo={class:"grid grid-cols-5 gap-2.5 py-1"},Fo=["onClick","title"],Zo={class:"text-[8px] text-slate-400 truncate w-full text-center"},Uo={class:"p-3.5 bg-slate-900/90 border border-slate-800 rounded-2xl flex flex-col gap-3 shadow-md"},Ho={class:"flex items-center justify-between"},zo={class:"pt-2.5 border-t border-slate-800/80 flex items-center justify-between gap-2"},Go={class:"flex items-center gap-1.5"},Ko={key:0,class:"p-2 rounded-xl bg-slate-950 border border-sky-500/40"},Wo=["value"],qo={key:2,class:"flex flex-col gap-3"},Yo={class:"p-3.5 bg-slate-900/90 border border-slate-800 rounded-2xl space-y-2.5 shadow-md"},Xo={class:"flex items-center justify-between"},Qo={class:"text-xs font-extrabold text-sky-400 flex items-center gap-1.5"},ei=["disabled"],ti=["value"],ai=["value"],si={class:"pt-1 space-y-1"},ni={class:"flex items-center justify-between text-[11px]"},oi={class:"text-slate-400 font-mono"},ii={class:"text-sky-300 font-bold"},li=["max","value"],ri={class:"p-3.5 bg-slate-900/90 border border-slate-800 rounded-2xl space-y-2.5 shadow-md"},di={class:"flex items-center justify-between"},ui={class:"text-xs font-extrabold text-purple-400 flex items-center gap-1.5"},ci=["disabled"],pi=["value"],fi=["value"],mi={class:"pt-1 space-y-1"},xi={class:"flex items-center justify-between text-[11px]"},hi={class:"text-slate-400 font-mono"},bi={class:"text-purple-300 font-bold"},gi=["max","value"],vi={class:"p-3.5 bg-slate-900/90 border border-slate-800 rounded-2xl flex items-center justify-between shadow-md"},yi={class:"text-xs font-bold text-slate-300 flex items-center gap-1.5"},ki={class:"flex items-center gap-1.5"},wi=["onClick"],_i={class:"p-3 bg-slate-900/90 border border-slate-800 rounded-2xl space-y-1.5 shadow-md"},Si={class:"grid grid-cols-3 gap-2"},Ti=["checked"],Ci=["checked"],Oi=["checked"],Ai={key:3,class:"flex flex-col gap-3"},Ni={class:"p-4 rounded-3xl bg-gradient-to-br from-indigo-950/80 via-slate-900 to-sky-950/80 border border-sky-500/30 space-y-3 shadow-xl"},Ii={class:"flex items-center justify-between"},Mi={class:"text-xs font-black text-sky-300 uppercase tracking-wider flex items-center gap-1.5"},$i={class:"text-[9px] px-2 py-0.5 rounded-full bg-emerald-500/20 text-emerald-400 font-bold border border-emerald-500/30"},Di={class:"grid grid-cols-2 gap-2"},ji={class:"space-y-1"},Ei=["value"],Ri={class:"space-y-1"},Pi=["disabled"],Li={class:"p-3.5 bg-slate-900/90 border border-purple-500/30 rounded-2xl space-y-2.5 shadow-md"},Vi={class:"flex items-center justify-between"},Bi={class:"flex items-center gap-1.5"},Ji={class:"flex items-center gap-2"},Fi=["disabled"],Zi={key:4,class:"flex flex-col gap-3"},Ui={class:"flex items-center justify-between bg-slate-900/90 p-1 rounded-2xl border border-slate-800 text-xs font-bold shadow-md"},Hi={key:0,class:"flex flex-col gap-2"},zi={class:"flex items-center justify-between px-1"},Gi={key:0,class:"text-center py-10 text-slate-500 text-xs bg-slate-900/50 rounded-2xl border border-slate-800"},Ki=["onClick"],Wi={class:"flex-1 pr-2 truncate"},qi={class:"font-extrabold text-xs text-white truncate"},Yi={class:"text-[10px] text-slate-400 font-mono"},Xi=["onClick"],Qi={key:1,class:"flex flex-col gap-2"},el={class:"flex items-center justify-between px-1"},tl={key:0,class:"text-center py-10 text-slate-500 text-xs bg-slate-900/50 rounded-2xl border border-slate-800"},al=["onClick"],sl={class:"flex-1 pr-2 truncate"},nl={class:"font-extrabold text-xs text-white truncate"},ol={class:"text-[10px] text-slate-400 font-mono"},il=["onClick"],ll={key:5,class:"fixed inset-0 z-50 bg-black/80 backdrop-blur-sm flex flex-col justify-end"},rl={class:"w-full max-h-[80vh] bg-slate-900 border-t border-slate-700 rounded-t-3xl p-4 flex flex-col gap-3 shadow-2xl animate-in slide-in-from-bottom"},dl={class:"flex items-center justify-between pb-2 border-b border-slate-800"},ul={class:"flex items-center gap-1.5 truncate"},cl={class:"truncate"},pl={key:0},fl={key:1},ml={key:2},xl=["value"],hl={class:"flex items-center justify-between gap-2"},bl={class:"hidden lg:flex flex-col h-full overflow-hidden w-full"},gl={class:"h-12 px-3 bg-slate-900/90 border-b border-slate-800/80 flex items-center justify-between shrink-0 shadow-sm z-20"},vl={class:"flex items-center gap-2"},yl={class:"flex items-center gap-1.5 mr-1"},kl={class:"flex items-center gap-1 bg-slate-950 px-2 py-1 rounded-xl border border-slate-800 shadow-inner"},wl=["value"],_l={class:"flex items-center gap-1 bg-slate-950 px-2 py-1 rounded-xl border border-slate-800 shadow-inner"},Sl={class:"flex items-center gap-2"},Tl=["disabled"],Cl={class:"relative group"},Ol={class:"absolute right-0 mt-1 hidden group-hover:flex flex-col bg-slate-900 border border-slate-800 rounded-xl shadow-2xl py-2 z-30 w-56 text-xs"},Al={class:"px-3 py-1.5"},Nl={key:0,class:"p-2.5 bg-gradient-to-r from-sky-950 via-indigo-950 to-purple-950 border-b border-sky-500/50 flex items-center gap-3 animate-pulse shadow-md shrink-0"},Il={class:"w-5 h-5 rounded-lg bg-sky-500/20 border border-sky-400/40 flex items-center justify-center flex-shrink-0"},Ml={class:"text-[11px] flex items-center gap-2"},$l={class:"text-[9px] px-1.5 py-0.2 rounded bg-sky-500/30 text-sky-200 border border-sky-400/30"},Dl={class:"flex-1 flex flex-row overflow-hidden min-h-0"},jl={class:"w-64 xl:w-72 bg-slate-900/80 border-r border-slate-800/80 flex flex-col shrink-0 overflow-hidden"},El={class:"p-2 border-b border-slate-800/80 bg-slate-950/70 flex items-center justify-between shrink-0"},Rl={class:"flex items-center gap-1 w-full"},Pl={key:0,class:"flex-1 flex flex-col overflow-hidden min-h-0"},Ll={class:"p-2.5 border-b border-slate-800/60 flex flex-col gap-2 shrink-0"},Vl={class:"flex items-center justify-between"},Bl={class:"text-[10px] font-extrabold uppercase tracking-wider text-slate-400"},Jl={class:"relative"},Fl={class:"flex-1 overflow-y-auto p-2 space-y-1.5 custom-scrollbar"},Zl=["onClick"],Ul={class:"flex items-center justify-between"},Hl={class:"text-xs font-black truncate text-white group-hover:text-sky-300 transition"},zl={key:0,class:"w-2 h-2 rounded-full bg-sky-400 shrink-0"},Gl={key:1,class:"text-[9px] text-amber-400 font-bold shrink-0"},Kl={class:"text-[10px] text-slate-400 line-clamp-1 leading-snug"},Wl={class:"flex items-center gap-1 mt-0.5 flex-wrap"},ql={class:"px-1.5 py-0.2 rounded text-[8px] font-bold bg-sky-900/60 text-sky-300 border border-sky-700/50 uppercase"},Yl={key:0,class:"px-1.5 py-0.2 rounded text-[8px] font-bold bg-slate-800 text-slate-400 uppercase"},Xl={class:"p-2.5 border-t border-slate-800/80 bg-slate-950/80 flex items-center justify-between shrink-0"},Ql={class:"text-[10px] font-bold text-slate-400 flex items-center gap-1"},er={key:1,class:"flex-1 flex flex-col overflow-hidden min-h-0"},tr={class:"p-2.5 border-b border-slate-800/60 flex items-center justify-between shrink-0"},ar={class:"text-[10px] font-extrabold uppercase tracking-wider text-slate-400"},sr={class:"flex-1 overflow-y-auto p-2 space-y-1.5 custom-scrollbar"},nr={key:0,class:"p-2 rounded-xl bg-amber-500/15 border border-amber-500/40 text-amber-200 flex items-center justify-between gap-1 shadow-sm text-xs mb-1"},or={class:"truncate text-[10px]"},ir={class:"text-amber-100 font-semibold truncate"},lr={key:1,class:"text-center py-8 text-slate-500 text-[11px] leading-relaxed"},rr=["onClick"],dr={class:"flex-1 min-w-0 pr-1"},ur={class:"flex items-center gap-1 mb-0.5"},cr={class:"px-1.5 py-0.2 rounded text-[8px] font-bold uppercase bg-amber-500/20 text-amber-300 border border-amber-500/30"},pr={class:"text-[9px] text-slate-400 font-semibold truncate"},fr={class:"font-bold text-[11px] truncate text-slate-100"},mr=["onClick"],xr={key:2,class:"flex-1 flex flex-col overflow-hidden min-h-0"},hr={class:"p-2.5 border-b border-slate-800/60 flex items-center justify-between shrink-0"},br={class:"text-[10px] font-extrabold uppercase tracking-wider text-slate-400"},gr={class:"flex-1 overflow-y-auto p-2 space-y-1.5 custom-scrollbar"},vr={key:0,class:"p-2 rounded-xl bg-purple-500/15 border border-purple-500/40 text-purple-200 flex items-center justify-between gap-1 shadow-sm text-xs mb-1"},yr={class:"truncate text-[10px]"},kr={class:"text-purple-100 font-semibold truncate"},wr={key:1,class:"text-center py-8 text-slate-500 text-[11px] leading-relaxed"},_r=["onClick"],Sr={class:"flex-1 min-w-0 pr-1"},Tr={class:"flex items-center gap-1 mb-0.5"},Cr={class:"px-1.5 py-0.2 rounded text-[8px] font-bold uppercase bg-purple-500/20 text-purple-300 border border-purple-500/30"},Or={class:"text-[9px] text-slate-400 font-semibold truncate"},Ar={key:0,class:"text-[8px] text-slate-500 font-mono ml-auto"},Nr={class:"font-bold text-[11px] truncate text-slate-100"},Ir=["onClick"],Mr={class:"w-[390px] xl:w-[440px] bg-slate-950 border-r border-slate-800/80 flex flex-col shrink-0 overflow-hidden"},$r={class:"px-3.5 py-2.5 bg-slate-900/70 border-b border-slate-800 flex items-center justify-between shrink-0"},Dr={class:"flex items-center gap-2"},jr={class:"text-[10px] px-2 py-0.5 rounded-full bg-slate-800 text-sky-300 font-semibold truncate max-w-[150px]"},Er={class:"flex items-center gap-1"},Rr={class:"flex-1 overflow-y-auto p-3 space-y-3.5 custom-scrollbar"},Pr={class:"p-3 bg-slate-900/80 border border-slate-800 rounded-2xl space-y-2 shadow-sm"},Lr={class:"flex items-center justify-between"},Vr={class:"text-[10px] font-bold text-sky-400 truncate max-w-[170px]"},Br={class:"grid grid-cols-5 gap-1.5"},Jr=["onClick","title"],Fr={class:"grid grid-cols-3 gap-2"},Zr={class:"col-span-1 space-y-1"},Ur=["value"],Hr={class:"col-span-2 space-y-1"},zr=["value"],Gr={class:"p-3 bg-slate-900/80 border border-slate-800 rounded-2xl space-y-2 shadow-sm"},Kr={class:"flex items-center justify-between"},Wr={class:"text-[10px] font-black uppercase tracking-wider text-slate-400 flex items-center gap-1.5"},qr={key:0,class:"inline-flex items-center gap-0.5 px-2 py-0.5 rounded-full text-[9px] font-semibold bg-emerald-500/20 text-emerald-400 border border-emerald-500/30"},Yr={key:1,class:"inline-flex items-center gap-0.5 px-2 py-0.5 rounded-full text-[9px] font-semibold bg-rose-500/20 text-rose-400 border border-rose-500/30"},Xr={key:0},Qr={key:1},ed={class:"flex items-center gap-1.5"},td=["value"],ad={key:1,class:"text-[10px] text-rose-400 mt-1 px-1"},sd={class:"p-3 bg-slate-900/80 border border-slate-800 rounded-2xl flex flex-col gap-2.5 shadow-sm text-xs"},nd={class:"flex flex-col gap-1.5"},od={class:"flex items-center justify-between gap-2"},id={class:"font-bold text-slate-300 flex items-center gap-1.5 text-[11px]"},ld={class:"flex items-center gap-1.5"},rd=["value"],dd=["value"],ud=["disabled"],cd={class:"hidden sm:inline"},pd={class:"flex items-center justify-between pl-5 pr-1 text-[10px] text-slate-400"},fd={class:"flex items-center gap-1 text-sky-300 font-mono"},md=["max","value"],xd={class:"flex flex-col gap-1.5 pt-1.5 border-t border-slate-800"},hd={class:"flex items-center justify-between gap-2"},bd={class:"font-bold text-slate-300 flex items-center gap-1.5 text-[11px]"},gd={class:"flex items-center gap-1.5"},vd=["value"],yd=["value"],kd=["disabled"],wd={class:"hidden sm:inline"},_d={class:"flex items-center justify-between pl-5 pr-1 text-[10px] text-slate-400"},Sd={class:"flex items-center gap-1 text-purple-300 font-mono"},Td=["max","value"],Cd={class:"flex items-center justify-between pt-1.5 border-t border-slate-800"},Od={class:"font-bold text-slate-300 flex items-center gap-1.5 text-[11px]"},Ad={class:"flex items-center gap-1.5 flex-wrap justify-end"},Nd=["onClick"],Id={class:"grid grid-cols-3 gap-2 pt-1.5 border-t border-slate-800"},Md=["checked"],$d=["checked"],Dd=["checked"],jd={class:"p-3 bg-slate-900/90 border-t border-slate-800 shrink-0"},Ed=["disabled"],Rd=ua({__name:"DashboardControls",props:{modelValue:{},options:{},isValid:{type:Boolean},validationError:{},isGenerating:{type:Boolean},generateStage:{},isAutoTopicLoading:{type:Boolean},drafts:{},activeDraftIndex:{},history:{},activeHistoryIndex:{},unsavedStash:{}},emits:["update:modelValue","update:options","generate","autoTopic","selectDraft","deleteDraft","saveDraft","selectHistory","deleteHistory","clearAllHistory","restoreStash","clearStash","toast"],setup(n,{emit:e}){const s=n,i=e,l=S(""),d=S(s.modelValue?.templateId||s.modelValue?.layoutType||"table"),f=S(!0),c=S(""),C=S(""),w=S("gemini-3.8-flash"),M=S("editor");function ee(){i("restoreStash"),M.value="editor"}const pe=S([]),W=S("tech"),V=S(!1),D=S(null),J=S({id:"",name:"",theme:"blue-tech",description:""});async function fe(){try{const u=await $fetch("/api/niches");u?.niches&&u.niches.length>0&&(pe.value=u.niches,pe.value.some(a=>a.id===W.value)||(W.value=pe.value[0].id))}catch(u){console.error("Failed to load niches:",u)}}function Ce(){D.value=null,J.value={id:"",name:"",theme:s.modelValue.theme||"blue-tech",description:""},V.value=!0}function $e(u){D.value=u.id,J.value={id:u.id,name:u.name,theme:u.theme||"blue-tech",description:u.description}}async function ve(){if(!J.value.name.trim()){alert("Nama Niche wajib diisi");return}const a={id:D.value||J.value.name.toLowerCase().replace(/[^a-z0-9_-]/g,"_"),name:J.value.name.trim(),theme:J.value.theme,description:J.value.description.trim()||`Fokus pada topik ${J.value.name.trim()}`};try{const r=await $fetch("/api/niches",{method:"POST",body:a});r?.niches&&(pe.value=r.niches,W.value=a.id,D.value=null,J.value={id:"",name:"",theme:"blue-tech",description:""})}catch(r){alert("Gagal menyimpan niche: "+(r.data?.statusMessage||r.message))}}async function Y(u){if(pe.value.length<=1){alert("Minimal harus ada 1 niche tersisa.");return}if(confirm("Hapus niche ini?"))try{const a=await $fetch(`/api/niches?id=${u}`,{method:"DELETE"});a?.niches&&(pe.value=a.niches,W.value===u&&(W.value=a.niches[0].id),D.value===u&&(D.value=null))}catch(a){alert("Gagal menghapus niche: "+(a.data?.statusMessage||a.message))}}const G=S("id"),q=S([{id:"table",name:"📊 Comparison Table",category:"Perbandingan",description:"Tabel komparasi 2 entitas",icon:"Table",layoutType:"table",isBuiltin:!0,sampleData:{},promptDirective:""},{id:"versus",name:"⚔️ Versus Showdown Arena",category:"Perbandingan",description:"Duel head-to-head dua kubu",icon:"Swords",layoutType:"versus",isBuiltin:!0,sampleData:{},promptDirective:""},{id:"receipt",name:"🧾 Monthly Living Invoice",category:"Finansial",description:"Format slip gaji pengeluaran bulanan",icon:"Receipt",layoutType:"receipt",isBuiltin:!0,sampleData:{},promptDirective:""},{id:"news",name:"📰 Special Report Pamphlet",category:"Jurnalisme",description:"Pamflet investigasi dengan 3 poin kunci",icon:"Newspaper",layoutType:"news",isBuiltin:!0,sampleData:{},promptDirective:""},{id:"stat",name:"🎯 Big Shocking Number",category:"Analisis",description:"Fokus pada satu angka kontras raksasa",icon:"Target",layoutType:"stat",isBuiltin:!0,sampleData:{},promptDirective:""},{id:"timeline",name:"⏳ 10-Year Shift (Then vs Now)",category:"Tren",description:"Pergeseran tren 10 tahun lalu vs sekarang",icon:"Clock",layoutType:"timeline",isBuiltin:!0,sampleData:{},promptDirective:""},{id:"barchart",name:"📈 Income Allocation Bars",category:"Finansial",description:"Distribusi alokasi dana dengan bar chart",icon:"BarChart3",layoutType:"barchart",isBuiltin:!0,sampleData:{},promptDirective:""},{id:"list",name:"🏆 Top 5 Ranked List",category:"Peringkat",description:"Ranking 5 teratas dengan kartu metrik",icon:"ListOrdered",layoutType:"list",isBuiltin:!0,sampleData:{},promptDirective:""},{id:"quote",name:"💬 Hot Take / Quote Debate",category:"Opini",description:"Kutipan tajam memicu perdebatan",icon:"Quote",layoutType:"quote",isBuiltin:!0,sampleData:{},promptDirective:""},{id:"leaderboard",name:"🥇 Multi-Country Leaderboard (Top 10)",category:"Peringkat",description:"Peringkat 5-10 negara dengan horizontal bar chart",icon:"Trophy",layoutType:"leaderboard",isBuiltin:!0,sampleData:{},promptDirective:""},{id:"editorial",name:"📰 Editorial Storytelling Deep Dive",category:"Jurnalisme",description:"Format narasi editorial 3 kartu bertahap",icon:"BookOpen",layoutType:"editorial",isBuiltin:!0,sampleData:{},promptDirective:""},{id:"matrix",name:"📊 Multi-Column Matrix (3-4 Negara)",category:"Perbandingan",description:"Tabel matriks komparasi 3-4 negara sekaligus",icon:"Grid",layoutType:"matrix",isBuiltin:!0,sampleData:{},promptDirective:""},{id:"debate",name:"⚡ Debate Arena (Pro vs Kontra)",category:"Interaktif",description:"Arena debat dua kubu dengan skor komunitas",icon:"Flame",layoutType:"debate",isBuiltin:!0,sampleData:{},promptDirective:""},{id:"tierlist",name:"🎖️ Tier List Ranking (S, A, B, C)",category:"Peringkat",description:"Hierarki tingkatan Tier S, A, B, C",icon:"Layers",layoutType:"tierlist",isBuiltin:!0,sampleData:{},promptDirective:""},{id:"breaking-notifications",name:"📱 Breaking Alert Notification Stack",category:"Berita Viral",description:"Tumpukan 3 kartu notifikasi darurat kaca iOS/Android",icon:"Bell",layoutType:"custom",isBuiltin:!0,sampleData:{},promptDirective:""}]),we=S(!1),oe=S("list"),X=S(null),te=S(""),H=S(""),ge=S(!1),ae=S(!1),_e=S(!1),se=S(""),N=S({id:"",name:"",category:"Kustom",description:"",layoutType:"custom",customHtml:"",customCss:"",promptDirective:"",sampleJsonText:""});async function Ge(){try{const u=await $fetch("/api/templates");u?.templates&&u.templates.length>0&&(q.value=u.templates)}catch(u){console.error("Failed to load templates:",u)}}function $(u="list"){oe.value=u,H.value="",u==="form"&&B(),we.value=!0}function h(){B(),H.value="",oe.value="form",we.value=!0}function Q(){B(),H.value="",oe.value="list"}function Me(){we.value=!1,B(),H.value="",oe.value="list"}function B(){X.value=null,N.value={id:"",name:"",category:"Kustom",description:"",layoutType:"custom",customHtml:`<div class="p-6 rounded-2xl bg-slate-900/90 border border-slate-700/80 text-center shadow-xl">
2
+ <span class="px-3 py-1 rounded-full text-xs font-black uppercase tracking-wider bg-sky-500/20 text-sky-400 border border-sky-500/30 mb-3 inline-block">{{ data.category }}</span>
3
+ <h2 class="text-3xl font-black text-white mb-2 leading-tight">{{ data.title }}</h2>
4
+ <p class="text-lg text-sky-300 font-bold mb-4">{{ data.subtitle }}</p>
5
+ </div>`,customCss:".custom-card-glow { box-shadow: 0 10px 30px -5px rgba(14, 165, 233, 0.3); }",promptDirective:"Instruksi khusus untuk AI saat generate format ini...",sampleJsonText:JSON.stringify({title:"JUDUL KONTEN MENARIK 2026",subtitle:"Subjudul penjelas berbasis fakta data",category:"KUSTOM VIRAL",watermark:"@SocialGen"},null,2)}}function Be(u){if(N.value.layoutType=u,u==="custom"){N.value.customHtml||(N.value.customHtml=`<div class="p-6 rounded-2xl bg-slate-900/90 border border-slate-700/80 text-center shadow-xl">
6
+ <span class="px-3 py-1 rounded-full text-xs font-black uppercase tracking-wider bg-sky-500/20 text-sky-400 border border-sky-500/30 mb-3 inline-block">{{ data.category }}</span>
7
+ <h2 class="text-3xl font-black text-white mb-2 leading-tight">{{ data.title }}</h2>
8
+ <p class="text-lg text-sky-300 font-bold mb-4">{{ data.subtitle }}</p>
9
+ </div>`);return}const a=q.value.find(r=>r.id===u||r.layoutType===u);a&&(N.value.promptDirective=a.promptDirective,N.value.sampleJsonText=JSON.stringify(a.sampleData,null,2),N.value.customHtml=a.customHtml||"",N.value.customCss=a.customCss||"")}function jt(u){X.value=u.id,N.value={id:u.id,name:u.name,category:u.category,description:u.description,layoutType:u.layoutType,customHtml:u.customHtml||"",customCss:u.customCss||"",promptDirective:u.promptDirective,sampleJsonText:JSON.stringify(u.sampleData,null,2)},oe.value="form"}function Xe(u){X.value=null,N.value={id:`${u.id}-custom-${Date.now().toString().slice(-4)}`,name:`${u.name} (Kustom)`,category:u.category||"Kustom",description:u.description,layoutType:u.layoutType,customHtml:u.customHtml||"",customCss:u.customCss||"",promptDirective:u.promptDirective,sampleJsonText:JSON.stringify(u.sampleData,null,2)},oe.value="form"}const ct=ce(()=>`Bertindaklah sebagai Lead Design Technologist & Senior Frontend Engineer untuk SocialGen (Dynamic Visual Engine for High-CPM Meta Monetization).
10
+
11
+ Saya melampirkan screenshot / gambar desain kartu visual media sosial.
12
+
13
+ Tugas Anda:
14
+ Analisis tata letak visual, dekorasi, tipografi, warna, bingkai, dan struktur konten pada gambar ini, lalu ubah menjadi template visual kustom SocialGen dalam format 1 objek JSON valid persis seperti ini:
15
+
16
+ {
17
+ "id": "slug-unik-kebab-case",
18
+ "name": "Nama Template Unik (Awali dengan Emoji, misal: 📰 Orange Pill Hero & News Tablet)",
19
+ "category": "Kategori Template (misal: Edukasi, Finansial, Berita Viral, Ranking, Perbandingan)",
20
+ "description": "Deskripsi singkat 1-2 kalimat mengenai gaya visual dan kegunaan template ini.",
21
+ "layoutType": "custom",
22
+ "customHtml": "<div class=\\"my-container\\">\\n <!-- Header / Hero Section -->\\n <div class=\\"my-hero\\">\\n <div class=\\"my-subtitle\\">{{ data.subtitle }}</div>\\n <div class=\\"my-title-box\\">\\n <h1 class=\\"my-title\\">{{ data.title }}</h1>\\n </div>\\n </div>\\n\\n <!-- Body / Main Content Visual Structure (Tablet / Frame / Pill Cards) -->\\n <div class=\\"my-frame-box\\">\\n {{#each data.items}}\\n <div class=\\"my-item-card\\">\\n <div class=\\"my-item-dot\\"></div>\\n <div class=\\"my-item-text\\">{{ text }}</div>\\n </div>\\n {{/each}}\\n </div>\\n\\n <!-- Footer / Source Attribution -->\\n <div class=\\"my-footer\\">\\n <span class=\\"my-source\\">{{ data.footerNote }}</span>\\n </div>\\n</div>",
23
+ "customCss": ".my-container { width: 100%; max-width: 960px; margin: 0 auto; display: flex; flex-direction: column; gap: 28px; box-sizing: border-box; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; } .my-hero { display: flex; flex-direction: column; gap: 12px; } .my-subtitle { font-size: 24px; font-weight: 800; color: #ffffff; text-shadow: 0 2px 8px rgba(0,0,0,0.4); } .my-title-box { background: #ffffff; border-radius: 24px; padding: 22px 32px; box-shadow: 0 12px 28px rgba(0,0,0,0.25); } .my-title { margin: 0; font-size: 56px; font-weight: 900; line-height: 1.1; color: #d84e1f; text-transform: uppercase; } .my-frame-box { display: flex; flex-direction: column; gap: 16px; background: rgba(30, 41, 59, 0.9); border-radius: 32px; padding: 26px; border: 2px solid rgba(255,255,255,0.15); box-shadow: 0 20px 40px rgba(0,0,0,0.35); } .my-item-card { display: flex; align-items: flex-start; gap: 16px; background: #ffffff; border-radius: 18px; padding: 20px 24px; border-left: 8px solid #eb6a37; box-shadow: 0 4px 12px rgba(0,0,0,0.06); } .my-item-dot { width: 14px; height: 14px; min-width: 14px; border-radius: 50%; background: #f5b027; margin-top: 6px; } .my-item-text { font-size: 22px; font-weight: 700; line-height: 1.45; color: #1e293b; margin: 0; } .my-footer { display: flex; justify-content: center; } .my-source { font-size: 17px; font-weight: 700; color: rgba(255,255,255,0.9); background: rgba(15,23,42,0.6); padding: 10px 22px; border-radius: 999px; border: 1px solid rgba(255,255,255,0.2); text-shadow: 0 1px 3px rgba(0,0,0,0.4); }",
24
+ "sampleData": {
25
+ "templateId": "slug-unik-kebab-case",
26
+ "layoutType": "custom",
27
+ "title": "CONTOH JUDUL BESAR KAPITAL SESUAI GAMBAR",
28
+ "subtitle": "Contoh subjudul pengantar informatif sesuai konteks gambar",
29
+ "category": "KATEGORI KONTEN",
30
+ "watermark": "@SocialGen",
31
+ "theme": "sunset-orange",
32
+ "footerNote": "Sumber: Lembaga Riset / Instansi Resmi (domain.go.id / .org) 2026",
33
+ "methodologyBadge": "Metodologi Riset Resmi 2026",
34
+ "disclaimer": "Ringkasan data edukasi • Bukan nasihat resmi",
35
+ "sourceUrl": "https://domain-resmi.org",
36
+ "reelsDuration": 30,
37
+ "caption": "Pertanyaan pemantik interaksi netizen? Tulis pendapatmu di bawah! 👇 #hashtags",
38
+ "items": [
39
+ { "text": "Poin penjelasan pertama yang ringkas dan padat (maksimal 20 kata per poin)..." },
40
+ { "text": "Poin penjelasan kedua yang mereplikasi isi kartu pada gambar..." },
41
+ { "text": "Poin penjelasan ketiga yang melengkapi data infografis..." }
42
+ ]
43
+ },
44
+ "promptDirective": "FORMAT STRUKTUR JSON:\\n- 'templateId': Wajib cantumkan 'slug-unik-kebab-case'.\\n- 'layoutType': Wajib 'custom'.\\n- 'title': Judul utama singkat, padat, kapital (2-4 kata) yang menonjol.\\n- 'subtitle': Subjudul informatif 1 baris (6-10 kata) sebagai pengantar.\\n- 'footerNote': WAJIB cantumkan nama lembaga/sumber data riset resmi & tahun data.\\n- 'items': Array berisi 3 hingga 5 objek dengan properti 'text' (1-2 kalimat ringkas padat)."
45
+ }
46
+
47
+ =======================================================
48
+ PANDUAN STANDAR WAJIB ARSITEKTUR TEMPLATE SOCIALGEN:
49
+
50
+ 1. ATURAN KRUSIAL KODE HTML (JANGAN PERNAH DIHAPUS):
51
+ - Kolom \\"customHtml\\" WAJIB berupa string HTML utuh dengan seluruh tag pembuka & penutup <div>, <h1>, <p>, <span>.
52
+ - DILARANG KERAS hanya menulis variabel {{ data.title }} {{ data.items }} tanpa tag pembungkus HTML dan class CSS!
53
+ - Semua tanda kutip dua atribut di dalam JSON wajib di-escape (misal: class=\\"my-card\\").
54
+
55
+ 2. KESERASIAN ID TEMPLATE (ID MATCHING):
56
+ - Field root \\"id\\" dan field \\"sampleData.templateId\\" HARUS BERNILAI SAMA PERSIS (contoh: \\"orange-pill-hero\\").
57
+ - Jangan menggunakan ID yang berbeda antara root dan sampleData karena sistem SocialGen auto-switch menggunakan ID ini.
58
+
59
+ 3. KANVAS RESPONSIVE MULTI-FORMAT (FEED 4:5 & REELS 9:16):
60
+ - SocialGen mengekspor konten ke Feed 4:5 (1080x1350) dan Story/Reels 9:16 (1080x1920).
61
+ - JANGAN PERNAH memberi tinggi mati (height: 1350px) pada kontainer utama!
62
+ - Kontainer terluar WAJIB menggunakan:
63
+ width: 100%; max-width: 960px; margin: 0 auto; display: flex; flex-direction: column;
64
+ - Dengan aturan ini, kartu akan selalu berada tepat di tengah (center) dan berada di dalam Safe Zone baik pada format Feed maupun Reels.
65
+
66
+ 4. JANGAN DUPLIKASI HEADER & FOOTER GLOBAL SOCIALGEN:
67
+ - SocialGen SUDAH otomatis merender Top Metadata Bar (Category Badge & Watermark @SocialGen) di bagian paling atas kanvas.
68
+ - SocialGen SUDAH otomatis merender Bottom Callout (\\"💬 Drop your opinion below • Share to your feed ↗\\" & Disclaimer) di bagian paling bawah.
69
+ - Oleh karena itu, customHtml HANYA fokus mendesain kartu konten di bagian tengah:
70
+ * Header kartu (Subtitle + Judul Besar)
71
+ * Badan kartu (mockup tablet, framed box, kartu list pil/bubble)
72
+ * Sumber data (footerNote) di bagian bawah kartu
73
+
74
+ 5. TIPOGRAFI STANDAR 1080px (READABILITY V2.3.4):
75
+ - Kanvas beresolusi 1080px lebar. Agar terbaca jelas di HP tanpa zoom:
76
+ * Judul Utama (title): font-size: 52px – 64px (font-weight: 900, line-height: 1.08 - 1.15)
77
+ * Subjudul (subtitle): font-size: 22px – 26px (font-weight: 700-800)
78
+ * Teks Kartu Poin (items): font-size: 20px – 24px (font-weight: 700, line-height: 1.45)
79
+ * Sumber Data (footerNote): font-size: 16px – 18px (font-weight: 600-700)
80
+
81
+ 6. MURNI CSS EKSPLISIT DI 'customCss':
82
+ - Karena aplikasi sudah di-compile, jangan mengandalkan arbitrary Tailwind baru (seperti text-[55px] atau bg-[#123456]).
83
+ - Semua warna, background, border, radius, bayangan, font-size, dan flexbox WAJIB ditulis lengkap dan eksplisit di \\"customCss\\".
84
+
85
+ 7. KREDIBILITAS TIER 1 (META CPM MONETIZATION):
86
+ - Selalu sertakan field \\"methodologyBadge\\", \\"disclaimer\\", dan \\"sourceUrl\\" di sampleData untuk lolos verifikasi transparansi data audiens Tier 1.
87
+
88
+ Keluarkan HANYA 1 objek JSON valid tanpa markdown formatting (\`\`\`json) agar bisa langsung diimpor otomatis ke aplikasi SocialGen.`);async function Qe(){await ht(ct.value)&&(ge.value=!0,setTimeout(()=>{ge.value=!1},3e3))}function Et(){if(H.value="",!!se.value.trim())try{let u=se.value.trim();u=u.replace(/^```json\s*/i,"").replace(/```$/i,"").trim();const a=JSON.parse(u),r=(a.id||a.sampleData?.templateId||a.name||"").toLowerCase().replace(/[^a-z0-9_-]/g,"-").replace(/^-+|-+$/g,"");if(r&&(N.value.id=r),a.name&&(N.value.name=a.name),a.category&&(N.value.category=a.category),a.description&&(N.value.description=a.description),N.value.layoutType=a.layoutType||"custom",a.customHtml){const v=a.customHtml.trim();N.value.customHtml=v,/<[a-z][\s\S]*>/i.test(v)||(H.value="⚠️ Perhatian: customHtml tidak mendeteksi tag HTML (seperti <div>, <p>). Pastikan AI menyertakan elemen HTML pembungkus class CSS.")}if(a.customCss&&(N.value.customCss=a.customCss),a.promptDirective&&(N.value.promptDirective=a.promptDirective),a.sampleData){const v={...a.sampleData};N.value.id&&(v.templateId=N.value.id,v.layoutType="custom"),v.id||(v.id="sample-"+(N.value.id||Date.now())),N.value.sampleJsonText=JSON.stringify(v,null,2)}ae.value=!1,se.value=""}catch(u){H.value="Gagal membaca JSON dari AI: "+u.message}}async function Rt(){if(H.value="",!N.value.name.trim()){H.value="Nama template wajib diisi";return}const u=X.value||N.value.id.trim()||N.value.name.toLowerCase().replace(/[^a-z0-9_-]/g,"-");let a=null;try{a=JSON.parse(N.value.sampleJsonText),a.id||(a.id=u)}catch(r){H.value="JSON Sampel Data tidak valid: "+r.message;return}try{const r=await $fetch("/api/templates",{method:"POST",body:{id:u,name:N.value.name.trim(),category:N.value.category.trim()||"Kustom",description:N.value.description.trim(),layoutType:N.value.layoutType,customHtml:N.value.customHtml?.trim()||void 0,customCss:N.value.customCss?.trim()||void 0,sampleData:a,promptDirective:N.value.promptDirective.trim(),isBuiltin:!!(X.value&&q.value.find(v=>v.id===X.value)?.isBuiltin)}});r?.templates&&(q.value=r.templates),oe.value="list",X.value=null}catch(r){H.value=r.data?.statusMessage||r.message||"Gagal menyimpan template"}}async function yt(u){if(confirm("Yakin ingin menghapus template kustom ini?"))try{const a=await $fetch(`/api/templates?id=${u}`,{method:"DELETE"});a?.templates&&(q.value=a.templates)}catch(a){alert(a.data?.statusMessage||a.message||"Gagal menghapus template")}}function Pt(u){et(u.layoutType==="custom"?u.id:u.layoutType||u.id),we.value=!1}const T=ce(()=>{if(!te.value.trim())return q.value;const u=te.value.toLowerCase();return q.value.filter(a=>a.name.toLowerCase().includes(u)||a.category.toLowerCase().includes(u)||a.description.toLowerCase().includes(u)||a.layoutType.toLowerCase().includes(u))}),b=S(!1),ye=S(""),le=S({}),fa=S(!1),kt=S(!1),Lt=S(["cyber_blue.mp4","emerald_flow.mp4","default_bg.mp4"]),Vt=S(["synthwave_pulse.mp3","lofi_chill.mp3","default_ambient.mp3"]),De=S({"neon_cyber_grid.mp4":8,"financial_pulse_flow.mp4":8,"dark_luxury_particles.mp4":8,"cyber_matrix_stream.mp4":10,"cyber_blue.mp4":15,"default_bg.mp4":15,"emerald_flow.mp4":15,"cyber_pulse.mp4":15,"cyber_future_tech.mp3":15,"dark_phonk_pulse.mp3":15,"deep_finance_groove.mp3":15,"synthwave_pulse.mp3":15,"lofi_chill.mp3":15,"default_ambient.mp3":15,"motivation_cinematic.mp3":110,"lofi_viral_study.mp3":147}),Bt=ce(()=>{const u=s.options.backgroundSource||"";return De.value[u]||15}),Ke=ce(()=>Math.max(1,Bt.value-1)),Jt=ce(()=>{const u=s.options.musicFile||"";return De.value[u]||30}),We=ce(()=>Math.max(1,Jt.value-1));function ma(u,a){if(!u||u==="random"||typeof window>"u")return;const r=a==="video"?`/api/stream/videos/${encodeURIComponent(u)}`:`/api/stream/musics/${encodeURIComponent(u)}`;if(a==="audio"){const v=new Audio;v.preload="metadata",v.src=r,v.onloadedmetadata=()=>{if(v.duration&&!isNaN(v.duration)&&isFinite(v.duration)){const P=Math.round(v.duration);P>0&&P!==De.value[u]&&(De.value={...De.value,[u]:P})}}}else{const v=document.createElement("video");v.preload="metadata",v.src=r,v.onloadedmetadata=()=>{if(v.duration&&!isNaN(v.duration)&&isFinite(v.duration)){const P=Math.round(v.duration);P>0&&P!==De.value[u]&&(De.value={...De.value,[u]:P})}}}}ke(()=>s.options.backgroundSource,(u,a)=>{if(u&&ma(u,"video"),a!==void 0&&u!==a)je("videoStartOffset",0);else{const r=Ke.value;(s.options.videoStartOffset||0)>r&&je("videoStartOffset",r)}},{immediate:!0}),ke(()=>s.options.musicFile,(u,a)=>{if(u&&ma(u,"audio"),a!==void 0&&u!==a)je("audioStartOffset",0);else{const r=We.value;(s.options.audioStartOffset||0)>r&&je("audioStartOffset",r)}},{immediate:!0});const Je=S(!1),Ft=S(null),Zt=S(null);async function xa(){try{const u=await $fetch("/api/media");u?.videos?.length&&(Lt.value=u.videos),u?.audio?.length&&(Vt.value=u.audio),u?.durations&&(De.value={...De.value,...u.durations})}catch(u){console.error("Failed to fetch media list:",u)}}ca(()=>{try{const u=localStorage.getItem("sg_selected_language");u&&(G.value=u)}catch{}xa(),fe(),Ge()}),ke(G,u=>{try{localStorage.setItem("sg_selected_language",u)}catch{}});async function ha(u,a){const r=u.target,v=r.files?.[0];if(v){Je.value=!0;try{const P=new FormData;P.append("file",v);const Oe=await $fetch("/api/upload-media",{method:"POST",body:P});Oe?.success&&(await xa(),Oe.type==="video"?i("update:options",{...s.options,backgroundSource:Oe.filename,videoStartOffset:0}):i("update:options",{...s.options,musicFile:Oe.filename,audioStartOffset:0}))}catch(P){alert("Upload gagal: "+(P.data?.statusMessage||P.message))}finally{Je.value=!1,r.value=""}}}const de=ce(()=>{const u=(d.value||"table").trim().toLowerCase();return q.value.find(a=>a.id.toLowerCase()===u||a.layoutType&&a.layoutType.toLowerCase()===u)||q.value[0]}),me=ce(()=>{const u=l.value.trim();if(!u)return null;try{return JSON.parse(u)}catch{return null}}),K=ce(()=>{if(!l.value.trim()||!me.value)return null;const u=(me.value.templateId||me.value.layoutType||(q.value.some(P=>P.id===me.value?.id)?me.value?.id:"")||"").trim().toLowerCase();if(!u)return null;const a=(d.value||"").trim().toLowerCase(),r=(de.value?.layoutType||"").trim().toLowerCase();if(u===a||u===r)return null;const v=q.value.find(P=>P.id.toLowerCase()===u||P.layoutType&&P.layoutType.toLowerCase()===u);return{jsonTemplateId:me.value.templateId||me.value.layoutType||me.value.id,matchedTarget:v||null,isKnown:!!v}}),Fe=ce(()=>{if(!l.value.trim()){const u=de.value?.sampleData?JSON.parse(JSON.stringify(de.value.sampleData)):{},a=de.value?.id||"table",r=de.value?.layoutType==="custom"?a:de.value?.layoutType||a;return{...u,id:u.id||a,templateId:a,layoutType:r,customHtml:de.value?.customHtml||void 0,customCss:de.value?.customCss||void 0}}if(me.value){const u=de.value?.id||me.value.templateId||"table",a=de.value?.layoutType==="custom"?u:de.value?.layoutType||u;return{...me.value,templateId:u,layoutType:a,customHtml:de.value?.customHtml||me.value.customHtml||void 0,customCss:de.value?.customCss||me.value.customCss||void 0}}return s.modelValue});ke(()=>Fe.value,u=>{i("update:modelValue",u),u.theme&&u.theme!==s.options.theme&&i("update:options",{...s.options,theme:u.theme})},{immediate:!0,deep:!0}),ke(()=>s.modelValue,u=>{if(!u)return;const a=JSON.stringify(Fe.value),r=JSON.stringify(u);if(a!==r){const v=u.templateId||u.layoutType;if(v){const P=q.value.find(Oe=>Oe.id.toLowerCase()===v.toLowerCase()||Oe.layoutType&&Oe.layoutType.toLowerCase()===v.toLowerCase());P&&(d.value=P.id)}l.value=JSON.stringify(u,null,2)}},{deep:!0}),ke(()=>s.unsavedStash,(u,a)=>{a&&!u&&(M.value="editor")});function ba(u){const a=u.target;if(l.value=a.value,!a.value.trim()){c.value="";return}try{const r=JSON.parse(a.value);if(c.value="",f.value){const v=(r.templateId||r.layoutType||(q.value.some(P=>P.id===r.id)?r.id:"")||"").trim().toLowerCase();if(v){const P=q.value.find(Oe=>Oe.id.toLowerCase()===v||Oe.layoutType&&Oe.layoutType.toLowerCase()===v);P?P.id.toLowerCase()!==d.value.toLowerCase()?(d.value=P.id,i("toast",`✓ JSON terdeteksi: Otomatis beralih ke template ${P.name}`,"success")):i("toast",`✓ JSON cocok dengan template ${P.name}`,"success"):i("toast",`⚠️ Format JSON: Template ID "${v}" tidak terdaftar di sistem`,"error")}else i("toast",`JSON valid dimasukkan untuk template ${de.value?.name}`,"success")}}catch(r){c.value="Format JSON tidak valid: "+r.message}}function Ut(){l.value="",c.value="",i("toast",`Format direset ke sampel template ${de.value?.name||""}`,"success")}function Ht(){l.value="",c.value="",i("toast",`Format disesuaikan ke data sampel ${de.value?.name||""}`,"success")}function ga(){if(l.value.trim())try{const u=JSON.parse(l.value);l.value=JSON.stringify(u,null,2),c.value="",i("toast","JSON berhasil dirapikan","success")}catch{c.value="Format JSON tidak valid, periksa kembali kurung/tanda petik"}}function et(u){d.value=u;const a=q.value.find(v=>v.id===u),r=a?.name||u;if(l.value.trim()&&me.value){const v=(me.value.templateId||me.value.layoutType||(q.value.some(rs=>rs.id===me.value?.id)?me.value?.id:"")||"").trim().toLowerCase(),P=u.trim().toLowerCase(),Oe=(a?.layoutType||"").trim().toLowerCase();v&&v!==P&&v!==Oe?i("toast",`Beralih ke template ${r}. Format JSON berbeda, klik 'Pakai Sampel' untuk menyesuaikan.`,"info"):i("toast",`Template diubah ke ${r}`,"success")}else i("toast",`Template diubah ke ${r}`,"success")}function va(u){try{const a=l.value.trim()?JSON.parse(l.value):{...Fe.value};a.title=u,l.value=JSON.stringify(a,null,2)}catch{}}function ya(u){try{const a=l.value.trim()?JSON.parse(l.value):{...Fe.value};a.watermark=u,l.value=JSON.stringify(a,null,2)}catch{}}function es(u){try{const a=l.value.trim()?JSON.parse(l.value):{...Fe.value};a.subtitle=u,l.value=JSON.stringify(a,null,2)}catch{}}function ts(u){try{const a=l.value.trim()?JSON.parse(l.value):{...Fe.value};a.footerNote=u,l.value=JSON.stringify(a,null,2)}catch{}}function as(u){try{const a=l.value.trim()?JSON.parse(l.value):{...Fe.value};a.caption=u,l.value=JSON.stringify(a,null,2)}catch{}}const Se=S("content"),pt=S(!1),ss=[{id:"blue-tech",name:"Blue Tech",color:"#0284c7"},{id:"emerald-finance",name:"Emerald Finance",color:"#059669"},{id:"slate-education",name:"Slate Education",color:"#64748b"},{id:"dark-contrast",name:"Dark Contrast",color:"#1e293b"},{id:"crimson-alert",name:"Crimson Alert",color:"#e11d48"},{id:"amber-gold",name:"Amber Gold",color:"#d97706"},{id:"cyber-violet",name:"Cyber Violet",color:"#7c3aed"},{id:"sunset-orange",name:"Sunset Orange",color:"#ea580c"},{id:"nordic-frost",name:"Nordic Frost",color:"#0891b2"},{id:"monochrome-luxe",name:"Monochrome Luxe",color:"#475569"}];function ns(u,a){const r=(a||u||"").toLowerCase();return r.includes("orange")||r.includes("news")?"📰":r.includes("edu")||r.includes("infografis")?"📜":r.includes("breaking")||r.includes("alert")?"🚨":r.includes("stat")?"🎯":r.includes("table")||r.includes("matrix")?"📊":r.includes("versus")||r.includes("debate")?"⚔️":r.includes("receipt")?"🧾":r.includes("tierlist")?"🎖️":r.includes("leaderboard")||r.includes("list")?"🏆":r.includes("quote")?"💬":r.includes("timeline")?"⏳":r.includes("barchart")?"📈":"🎨"}function ka(u){try{const a=l.value.trim()?JSON.parse(l.value):{...Fe.value};a.theme=u,l.value=JSON.stringify(a,null,2)}catch{}i("update:options",{...s.options,theme:u})}const wa=[{id:"dark-contrast",name:"Dark Contrast (Universal Bold)",bgClass:"bg-slate-950 border-slate-700"},{id:"blue-tech",name:"Blue Tech (AI & Software)",bgClass:"bg-blue-900 border-blue-600"},{id:"emerald-finance",name:"Emerald Finance (Salaries & Living)",bgClass:"bg-emerald-900 border-emerald-600"},{id:"amber-gold",name:"Amber Gold (Luxury & Executive)",bgClass:"bg-amber-900 border-amber-600"},{id:"slate-education",name:"Slate Education (Education & Career)",bgClass:"bg-indigo-900 border-indigo-600"},{id:"crimson-alert",name:"Crimson Alert (Breaking Shock)",bgClass:"bg-rose-900 border-rose-600"},{id:"cyber-violet",name:"Cyber Violet (Synthwave & Neon)",bgClass:"bg-purple-900 border-purple-600"},{id:"sunset-orange",name:"Sunset Orange (Warm Energy)",bgClass:"bg-orange-900 border-orange-600"},{id:"nordic-frost",name:"Nordic Frost (Polar Cyan Clean)",bgClass:"bg-cyan-900 border-cyan-600"},{id:"monochrome-luxe",name:"Monochrome Luxe (Minimalist)",bgClass:"bg-zinc-800 border-zinc-500"}],os=ce(()=>q.value.find(a=>a.id===d.value)?.name||d.value||"Custom");function _a(u){const a={...s.modelValue,reelsDuration:u};i("update:modelValue",a)}function je(u,a){i("update:options",{...s.options,[u]:a})}function tt(u,a){const r=s.options.outputs||{feed:!0,story:!0,reels:!0};i("update:options",{...s.options,outputs:{...r,[u]:a}})}function Sa(u,a){i("autoTopic",W.value,C.value||void 0,w.value,G.value)}async function zt(){b.value=!0,fa.value=!0;try{const u=await $fetch("/api/copy-prompt",{query:{niche:W.value,layout:s.modelValue.layoutType||"table",language:G.value}});ye.value=u.prompt,le.value={topic:u.topic,pair:u.pair,niche:u.niche,template:u.template,usedCount:u.usedCount,language:u.language||G.value}}catch(u){console.error("Failed to get manual prompt:",u)}finally{fa.value=!1}}async function is(){if(!ye.value)return;await ht(ye.value)&&(kt.value=!0,setTimeout(()=>{kt.value=!1},2500))}const wt=S(!1),_t=S(!1);async function ls(){wt.value=!0;try{const u=await $fetch("/api/copy-prompt",{query:{niche:W.value,layout:s.modelValue.layoutType||"table",language:G.value}});ye.value=u.prompt,le.value={topic:u.topic,pair:u.pair,niche:u.niche,template:u.template,usedCount:u.usedCount,language:u.language||G.value},await ht(u.prompt)&&(_t.value=!0,setTimeout(()=>{_t.value=!1},2500))}catch(u){console.error("Failed to copy topic prompt:",u)}finally{wt.value=!1}}function Ta(){s.history.length!==0&&confirm(`Bersihkan semua ${s.history.length} riwayat generate otomatis?`)&&i("clearAllHistory")}function Ca(u){if(!u)return"";try{return new Date(u).toLocaleDateString("id-ID",{day:"numeric",month:"short",hour:"2-digit",minute:"2-digit"})}catch{return""}}return(u,a)=>(p(),m("div",Ts,[o(V)?(p(),m("div",Cs,[t("div",Os,[t("div",As,[t("div",null,[t("h3",Ns,[k(o($a),{class:"w-4 h-4 text-sky-400"}),a[81]||(a[81]=z(" Kelola & Buat Niche Baru ",-1))]),a[82]||(a[82]=t("p",{class:"text-[11px] text-slate-400 mt-0.5"}," Simpan niche favoritmu. AI dan Prompt Generator akan otomatis menggunakannya. ",-1))]),t("button",{onClick:a[0]||(a[0]=r=>V.value=!1),class:"p-1 rounded-lg text-slate-400 hover:text-white hover:bg-slate-800"},[k(o(Yt),{class:"w-4 h-4"})])]),t("div",Is,[t("div",Ms,[t("span",null,x(o(D)?"✏️ Edit Niche":"➕ Tambah Niche Baru"),1),o(D)?(p(),m("button",{key:0,onClick:a[1]||(a[1]=r=>{D.value=null,J.value={id:"",name:"",theme:"blue-tech",description:""}}),class:"text-[10px] text-slate-400 hover:text-white"}," Batal Edit ")):I("",!0)]),t("div",$s,[t("div",null,[a[83]||(a[83]=t("label",{class:"block text-[10px] font-bold text-slate-400 mb-1"},"Nama Niche",-1)),ue(t("input",{"onUpdate:modelValue":a[2]||(a[2]=r=>o(J).name=r),type:"text",placeholder:"Contoh: Kuliner & Restoran, Otomotif EV",class:"w-full bg-slate-900 border border-slate-800 rounded-xl px-2.5 py-1.5 text-xs text-white focus:outline-none focus:border-sky-500"},null,512),[[Ae,o(J).name]])]),t("div",null,[a[85]||(a[85]=t("label",{class:"block text-[10px] font-bold text-slate-400 mb-1"},"Tema Default",-1)),ue(t("select",{"onUpdate:modelValue":a[3]||(a[3]=r=>o(J).theme=r),class:"w-full bg-slate-900 border border-slate-800 rounded-xl px-2.5 py-1.5 text-xs text-white focus:outline-none focus:border-sky-500"},[...a[84]||(a[84]=[St('<option value="blue-tech">🔵 Blue Tech</option><option value="emerald-finance">🟢 Emerald Finance</option><option value="slate-education">🟣 Slate Education</option><option value="dark-contrast">⚫ Dark Contrast</option><option value="crimson-alert">🔴 Crimson Alert</option><option value="amber-gold">🟡 Amber Gold</option><option value="cyber-violet">🟪 Cyber Violet</option><option value="sunset-orange">🟠 Sunset Orange</option><option value="nordic-frost">❄️ Nordic Frost</option><option value="monochrome-luxe">⚪ Monochrome Luxe</option>',10)])],512),[[at,o(J).theme]])])]),t("div",null,[a[86]||(a[86]=t("label",{class:"block text-[10px] font-bold text-slate-400 mb-1"},"Fokus Topik & Instruksi Prompt",-1)),ue(t("textarea",{"onUpdate:modelValue":a[4]||(a[4]=r=>o(J).description=r),rows:"2",placeholder:"Jelaskan topik yang ingin disorot AI (misal: perbandingan harga kopi, biaya buka gerai, margin laba kuliner...)",class:"w-full bg-slate-900 border border-slate-800 rounded-xl p-2 text-xs text-slate-200 focus:outline-none focus:border-sky-500 resize-none leading-relaxed"},null,512),[[Ae,o(J).description]])]),t("button",{onClick:ve,class:"self-end px-4 py-1.5 rounded-xl bg-sky-600 hover:bg-sky-500 text-white font-bold text-xs transition flex items-center gap-1.5 shadow"},[k(o(qe),{class:"w-3.5 h-3.5"}),t("span",null,x(o(D)?"Perbarui Niche":"Simpan Niche"),1)])]),t("div",Ds,[t("div",js," Daftar Niche Tersimpan ("+x(o(pe).length)+") ",1),t("div",Es,[(p(!0),m(xe,null,he(o(pe),r=>(p(),m("div",{key:r.id,class:"p-2.5 rounded-xl border bg-slate-950 border-slate-800 flex items-start justify-between gap-2"},[t("div",Rs,[t("div",Ps,[t("span",Ls,x(r.name),1),t("span",Vs,x(r.theme||"blue-tech"),1)]),t("p",Bs,x(r.description),1)]),t("div",Js,[t("button",{onClick:v=>$e(r),class:"p-1.5 rounded-lg text-slate-400 hover:text-sky-300 hover:bg-slate-800 transition",title:"Edit Niche"},[k(o(Ct),{class:"w-3.5 h-3.5"})],8,Fs),t("button",{onClick:v=>Y(r.id),class:"p-1.5 rounded-lg text-slate-400 hover:text-rose-400 hover:bg-slate-800 transition",title:"Hapus Niche"},[k(o(st),{class:"w-3.5 h-3.5"})],8,Zs)])]))),128))])])])])):I("",!0),o(b)?(p(),m("div",Us,[t("div",Hs,[t("div",zs,[t("div",null,[t("h3",Gs,[k(o(qt),{class:"w-4 h-4 text-purple-400"}),a[87]||(a[87]=z(" Master Prompt AI (Dynamic Research & Zero-Collision) ",-1))]),a[88]||(a[88]=t("p",{class:"text-[11px] text-slate-400 mt-0.5"}," Salin prompt ini ke ChatGPT / Gemini / Claude / DeepSeek untuk mencari topik terbaru. ",-1))]),t("button",{onClick:a[5]||(a[5]=r=>b.value=!1),class:"p-1 rounded-lg text-slate-400 hover:text-white hover:bg-slate-800"},[k(o(Yt),{class:"w-4 h-4"})])]),t("div",Ks,[a[89]||(a[89]=t("span",{class:"font-bold text-sky-400"},"Niche Aktif:",-1)),t("span",Ws,x(o(pe).find(r=>r.id===o(W))?.name||"Default"),1),a[90]||(a[90]=t("span",{class:"text-slate-500"},"•",-1)),a[91]||(a[91]=t("span",{class:"font-bold text-amber-400"},"Template:",-1)),t("span",qs,x(o(le).template||"Otomatis"),1),a[92]||(a[92]=t("span",{class:"text-slate-500"},"•",-1)),a[93]||(a[93]=t("span",{class:"font-bold text-emerald-400"},"Bahasa:",-1)),t("span",Ys,x(o(le).language||"Bahasa Indonesia 🇮🇩"),1),a[94]||(a[94]=t("span",{class:"text-slate-500"},"•",-1)),t("span",Xs,x(o(le).usedCount||0)+" Topik Riwayat Dikecualikan",1)]),t("div",Qs,[t("textarea",{value:o(ye),readonly:"",rows:"12",class:"w-full h-full bg-slate-950 text-slate-300 font-mono text-[11px] p-3 rounded-xl border border-slate-800 focus:outline-none resize-none leading-relaxed select-all"},null,8,en)]),t("div",tn,[a[95]||(a[95]=t("span",{class:"text-[11px] text-slate-400"},[z(" Paste hasil JSON yang kamu buat ke kolom "),t("b",null,"RAW JSON"),z(" SocialGen. ")],-1)),t("button",{onClick:is,class:"px-5 py-2.5 rounded-xl font-bold bg-gradient-to-r from-purple-600 to-indigo-600 hover:from-purple-500 hover:to-indigo-500 text-white shadow-lg flex items-center gap-2 transition"},[o(kt)?(p(),Ne(o(qe),{key:0,class:"w-4 h-4 text-emerald-400"})):(p(),Ne(o(Ze),{key:1,class:"w-4 h-4"})),t("span",null,x(o(kt)?"Prompt Berhasil Disalin!":"Copy Master Prompt"),1)])])])])):I("",!0),o(we)?(p(),m("div",{key:2,onClick:ft(Me,["self"]),class:"fixed inset-0 z-50 bg-black/80 backdrop-blur-sm flex items-center justify-center p-4"},[t("div",an,[t("div",sn,[t("div",null,[t("h3",nn,[k(o(Ia),{class:"w-4 h-4 text-sky-400"}),a[96]||(a[96]=z(" Kelola Template Visual (Dynamic Template System) ",-1))]),a[97]||(a[97]=t("p",{class:"text-[11px] text-slate-400 mt-0.5"}," Buat format baru, edit sampel tampilan, dan atur prompt AI spesifik per template. ",-1))]),t("button",{onClick:Me,class:"p-1 rounded-lg text-slate-400 hover:text-white hover:bg-slate-800"},[k(o(Yt),{class:"w-4 h-4"})])]),t("div",on,[t("div",ln,[t("button",{onClick:Q,class:j(["px-3 py-1 rounded-lg transition font-bold text-xs",o(oe)==="list"?"bg-slate-800 text-sky-400 shadow":"text-slate-400 hover:text-white"])}," Daftar Template ("+x(o(q).length)+") ",3),t("button",{onClick:h,class:j(["px-3 py-1 rounded-lg transition font-bold text-xs flex items-center gap-1",o(oe)==="form"&&!o(X)?"bg-slate-800 text-emerald-400 shadow":"text-slate-400 hover:text-white"])},[k(o(mt),{class:"w-3.5 h-3.5"}),a[98]||(a[98]=t("span",null,"Buat Template Baru",-1))],2),o(X)&&o(oe)==="form"?(p(),m("span",rn,[k(o(Ct),{class:"w-3 h-3"}),a[99]||(a[99]=t("span",null,"Sedang Edit Template",-1))])):I("",!0)]),o(oe)==="list"?ue((p(),m("input",{key:0,"onUpdate:modelValue":a[6]||(a[6]=r=>Ee(te)?te.value=r:null),type:"text",placeholder:"Cari template...",class:"bg-slate-900 border border-slate-800 rounded-lg px-2 py-0.5 text-[11px] text-white focus:outline-none focus:border-sky-500 w-36"},null,512)),[[Ae,o(te)]]):I("",!0)]),o(oe)==="list"?(p(),m("div",dn,[o(T).length===0?(p(),m("div",un,' Tidak ada template yang cocok dengan pencarian "'+x(o(te))+'". ',1)):I("",!0),(p(!0),m(xe,null,he(o(T),r=>(p(),m("div",{key:r.id,class:"p-3 rounded-2xl border bg-slate-950 border-slate-800/80 hover:border-slate-700 transition flex flex-col sm:flex-row items-start sm:items-center justify-between gap-3 group"},[t("div",cn,[t("div",pn,[t("span",fn,x(r.name),1),t("span",mn,x(r.category),1),t("span",{class:j(["px-1.5 py-0.2 rounded text-[8px] font-bold uppercase tracking-wider",r.isBuiltin?"bg-slate-800 text-slate-400 border border-slate-700":"bg-purple-950 text-purple-300 border border-purple-800"])},x(r.isBuiltin?"Bawaan":"⭐ Kustom"),3),t("span",xn," layout: "+x(r.layoutType),1)]),t("p",hn,x(r.description||"Tidak ada deskripsi."),1)]),t("div",bn,[t("button",{onClick:v=>Pt(r),class:"px-2.5 py-1 rounded-xl bg-sky-600/20 hover:bg-sky-600/40 text-sky-300 border border-sky-500/40 font-bold text-[10px] transition flex items-center gap-1",title:"Pilih dan gunakan format template ini"},[k(o(qe),{class:"w-3 h-3"}),a[100]||(a[100]=t("span",null,"Pilih Format",-1))],8,gn),t("button",{onClick:v=>Xe(r),class:"p-1.5 rounded-lg text-slate-400 hover:text-sky-300 hover:bg-slate-800 transition",title:"Duplikasi sebagai template kustom baru"},[k(o(Ze),{class:"w-3.5 h-3.5"})],8,vn),r.isBuiltin?I("",!0):(p(),m("button",{key:0,onClick:v=>jt(r),class:"p-1.5 rounded-lg text-slate-400 hover:text-amber-300 hover:bg-slate-800 transition",title:"Edit template kustom"},[k(o(Ct),{class:"w-3.5 h-3.5"})],8,yn)),r.isBuiltin?I("",!0):(p(),m("button",{key:1,onClick:v=>yt(r.id),class:"p-1.5 rounded-lg text-slate-400 hover:text-rose-400 hover:bg-slate-800 transition",title:"Hapus template kustom"},[k(o(st),{class:"w-3.5 h-3.5"})],8,kn))])]))),128))])):(p(),m("div",wn,[o(H)?(p(),m("div",_n,x(o(H)),1)):I("",!0),o(X)?(p(),m("div",Sn,[t("div",Tn,[t("div",Cn,[k(o(Ct),{class:"w-4 h-4"})]),t("div",On,[t("div",An,[a[101]||(a[101]=t("span",null,"Sedang Mengedit:",-1)),t("span",Nn,x(o(N).name),1)]),t("div",In,"ID: "+x(o(N).id)+" • Perubahan akan memperbarui template yang tersimpan",1)])]),t("button",{onClick:h,type:"button",class:"px-2.5 py-1 rounded-xl bg-slate-900 hover:bg-slate-800 text-slate-200 border border-slate-700 text-[10px] font-bold transition flex items-center gap-1 shrink-0 ml-2"},[k(o(mt),{class:"w-3 h-3"}),a[102]||(a[102]=t("span",null,"Beralih ke Buat Baru",-1))])])):I("",!0),t("div",Mn,[t("div",$n,[a[104]||(a[104]=t("div",{class:"flex items-center gap-2"},[t("span",{class:"text-xl"},"🤖"),t("div",null,[t("h4",{class:"text-xs font-black text-white"},"Buat Template Otomatis dari Screenshot / Gambar"),t("p",{class:"text-[10px] text-slate-400"},"Punya referensi gambar desain? Salin prompt AI dan kirim bersama screenshot ke ChatGPT / Claude / Gemini.")])],-1)),t("div",Dn,[t("button",{onClick:Qe,type:"button",class:j(["px-2.5 py-1.5 rounded-xl text-xs font-bold transition flex items-center gap-1.5 shadow",o(ge)?"bg-emerald-600 text-white":"bg-sky-600 hover:bg-sky-500 text-white"])},[k(o(Ze),{class:"w-3.5 h-3.5"}),t("span",null,x(o(ge)?"✓ Prompt Tersalin!":"Salin Prompt Bantuan AI"),1)],2),t("button",{onClick:a[7]||(a[7]=r=>_e.value=!o(_e)),type:"button",class:"px-2 py-1.5 rounded-xl bg-slate-800 hover:bg-slate-700 text-slate-200 text-xs font-bold transition flex items-center gap-1",title:o(_e)?"Sembunyikan teks prompt":"Lihat / salin teks prompt manual di HP"},[t("span",null,x(o(_e)?"Tutup Teks":"👁️ Lihat Teks Prompt"),1)],8,jn),t("button",{onClick:a[8]||(a[8]=r=>ae.value=!o(ae)),type:"button",class:"px-2.5 py-1.5 rounded-xl bg-slate-800 hover:bg-slate-700 text-slate-200 text-xs font-bold transition flex items-center gap-1"},[...a[103]||(a[103]=[t("span",null,"📥 Tempel JSON",-1)])])])]),o(_e)?(p(),m("div",En,[t("div",Rn,[a[105]||(a[105]=t("label",{class:"text-[10px] font-bold text-sky-400"},"Teks Lengkap Prompt Bantuan AI (Bisa ditandai/disalin manual di HP):",-1)),t("button",{onClick:a[9]||(a[9]=r=>_e.value=!1),class:"text-[10px] text-slate-400 hover:text-white"},"✕ Tutup")]),t("textarea",{value:o(ct),readonly:"",rows:"6",class:"w-full bg-slate-900 border border-slate-700 rounded-lg p-2 text-[11px] text-sky-200 font-mono select-all focus:outline-none focus:border-sky-500 custom-scrollbar"},null,8,Pn)])):I("",!0),o(ae)?(p(),m("div",Ln,[a[106]||(a[106]=t("label",{class:"text-[10px] font-bold text-sky-400"},"Tempelkan respon JSON dari AI di sini:",-1)),ue(t("textarea",{"onUpdate:modelValue":a[10]||(a[10]=r=>Ee(se)?se.value=r:null),rows:"4",placeholder:'Tempelkan respon JSON dari AI di sini (contoh: { "name": "...", "layoutType": "custom", "customHtml": "...", "sampleData": {...} })...',class:"w-full bg-slate-900 border border-slate-700 rounded-lg p-2 text-xs text-sky-200 font-mono focus:outline-none focus:border-sky-500"},null,512),[[Ae,o(se)]]),t("div",Vn,[t("button",{onClick:a[11]||(a[11]=r=>ae.value=!1),type:"button",class:"px-2.5 py-1 rounded-lg text-[10px] font-bold text-slate-400 hover:text-white"}," Tutup "),t("button",{onClick:Et,type:"button",class:"px-3 py-1 rounded-lg bg-emerald-600 hover:bg-emerald-500 text-white text-[10px] font-bold shadow"}," Terapkan ke Form Otomatis ")])])):I("",!0)]),t("div",Bn,[t("div",null,[a[107]||(a[107]=t("label",{class:"block text-[10px] font-bold text-slate-400 mb-1"},"ID Template (Slug Unik)",-1)),ue(t("input",{"onUpdate:modelValue":a[12]||(a[12]=r=>o(N).id=r),disabled:!!o(X),type:"text",placeholder:"misal: tech-radar, crypto-card",class:"w-full bg-slate-950 border border-slate-800 rounded-xl px-2.5 py-1.5 text-xs text-white focus:outline-none focus:border-sky-500 disabled:opacity-50"},null,8,Jn),[[Ae,o(N).id]])]),t("div",null,[a[108]||(a[108]=t("label",{class:"block text-[10px] font-bold text-slate-400 mb-1"},"Nama Template",-1)),ue(t("input",{"onUpdate:modelValue":a[13]||(a[13]=r=>o(N).name=r),type:"text",placeholder:"misal: ⚡ Tech Radar 2026",class:"w-full bg-slate-950 border border-slate-800 rounded-xl px-2.5 py-1.5 text-xs text-white focus:outline-none focus:border-sky-500"},null,512),[[Ae,o(N).name]])]),t("div",null,[a[109]||(a[109]=t("label",{class:"block text-[10px] font-bold text-slate-400 mb-1"},"Kategori",-1)),ue(t("input",{"onUpdate:modelValue":a[14]||(a[14]=r=>o(N).category=r),type:"text",placeholder:"misal: Perbandingan, Peringkat, Finansial",class:"w-full bg-slate-950 border border-slate-800 rounded-xl px-2.5 py-1.5 text-xs text-white focus:outline-none focus:border-sky-500"},null,512),[[Ae,o(N).category]])])]),t("div",Fn,[t("div",null,[a[111]||(a[111]=t("label",{class:"block text-[10px] font-bold text-slate-400 mb-1"},"Base Layout Visual Engine",-1)),t("select",{value:o(N).layoutType,onChange:a[15]||(a[15]=r=>Be(r.target.value)),class:"w-full bg-slate-950 border border-slate-800 rounded-xl px-2.5 py-1.5 text-xs text-sky-300 font-semibold focus:outline-none focus:border-sky-500"},[...a[110]||(a[110]=[St('<option value="custom">🎨 Custom HTML &amp; CSS (Bebas / Desain Sendiri)</option><option value="table">📊 Comparison Table</option><option value="versus">⚔️ Versus Showdown Arena</option><option value="receipt">🧾 Monthly Living Invoice</option><option value="news">📰 Special Report Pamphlet</option><option value="stat">🎯 Big Shocking Number</option><option value="timeline">⏳ 10-Year Shift (Then vs Now)</option><option value="barchart">📈 Income Allocation Bars</option><option value="list">🏆 Top 5 Ranked List</option><option value="quote">💬 Hot Take / Quote Debate</option><option value="leaderboard">🥇 Multi-Country Leaderboard (Top 10)</option><option value="editorial">📰 Editorial Storytelling Deep Dive</option><option value="matrix">📊 Multi-Column Matrix (3-4 Negara)</option><option value="debate">⚡ Debate Arena (Pro vs Kontra)</option><option value="tierlist">🎖️ Tier List Ranking (S, A, B, C)</option>',15)])],40,Zn)]),t("div",null,[a[112]||(a[112]=t("label",{class:"block text-[10px] font-bold text-slate-400 mb-1"},"Deskripsi Ringkas",-1)),ue(t("input",{"onUpdate:modelValue":a[16]||(a[16]=r=>o(N).description=r),type:"text",placeholder:"Jelaskan kegunaan format tampilan template ini...",class:"w-full bg-slate-950 border border-slate-800 rounded-xl px-2.5 py-1.5 text-xs text-white focus:outline-none focus:border-sky-500"},null,512),[[Ae,o(N).description]])])]),o(N).layoutType==="custom"?(p(),m("div",Un,[t("div",Hn,[t("span",zn,[k(o(Wt),{class:"w-3.5 h-3.5"}),a[113]||(a[113]=z(" Template Engine HTML & Styling CSS ",-1))]),a[114]||(a[114]=t("span",{class:"text-[10px] text-slate-400 font-mono"},"Gunakan {{ data.title }} & {{#each data.items}}",-1))]),t("div",null,[a[115]||(a[115]=t("label",{class:"block text-[10px] font-bold text-slate-400 mb-1"},"HTML Template (Tailwind utility classes didukung penuh)",-1)),ue(t("textarea",{"onUpdate:modelValue":a[17]||(a[17]=r=>o(N).customHtml=r),rows:"6",placeholder:`<div class="p-6 rounded-2xl bg-slate-900/90 border border-slate-700 text-center">
89
+ <h2 class="text-3xl font-black text-white">{{ data.title }}</h2>
90
+ <p class="text-slate-300">{{ data.subtitle }}</p>
91
+ </div>`,class:"w-full bg-slate-900 border border-slate-800 rounded-xl p-2.5 text-xs text-sky-300 font-mono leading-relaxed focus:outline-none focus:border-sky-500"},null,512),[[Ae,o(N).customHtml]])]),t("div",null,[a[116]||(a[116]=t("label",{class:"block text-[10px] font-bold text-slate-400 mb-1"},"Custom CSS (Opsional - animasi, gradien unik, glassmorphism)",-1)),ue(t("textarea",{"onUpdate:modelValue":a[18]||(a[18]=r=>o(N).customCss=r),rows:"3",placeholder:".my-custom-card { backdrop-filter: blur(16px); }",class:"w-full bg-slate-900 border border-slate-800 rounded-xl p-2.5 text-xs text-emerald-300 font-mono leading-relaxed focus:outline-none focus:border-emerald-500"},null,512),[[Ae,o(N).customCss]])])])):I("",!0),t("div",null,[a[117]||(a[117]=t("label",{class:"block text-[10px] font-bold text-slate-400 mb-1"},"AI Prompt Directive (Aturan Khusus Generator)",-1)),ue(t("textarea",{"onUpdate:modelValue":a[19]||(a[19]=r=>o(N).promptDirective=r),rows:"3",placeholder:"Instruksi spesifik untuk AI Gemini / ChatGPT saat meriset konten dengan template ini...",class:"w-full bg-slate-950 border border-slate-800 rounded-xl p-2.5 text-xs text-slate-200 focus:outline-none focus:border-sky-500 font-mono leading-relaxed"},null,512),[[Ae,o(N).promptDirective]])]),t("div",null,[a[118]||(a[118]=t("div",{class:"flex items-center justify-between mb-1"},[t("label",{class:"text-[10px] font-bold text-slate-400"},"Sampel Data JSON (Pristine Default Tampilan)"),t("span",{class:"text-[10px] text-slate-500"},"Akan langsung ditampilkan di Live Preview")],-1)),ue(t("textarea",{"onUpdate:modelValue":a[20]||(a[20]=r=>o(N).sampleJsonText=r),rows:"7",class:"w-full bg-slate-950 border border-slate-800 rounded-xl p-2.5 text-xs text-sky-200 focus:outline-none focus:border-sky-500 font-mono leading-relaxed select-all"},null,512),[[Ae,o(N).sampleJsonText]])]),t("div",Gn,[t("button",{onClick:Q,class:"px-3.5 py-1.5 rounded-xl bg-slate-800 hover:bg-slate-700 text-slate-300 font-bold text-xs transition"}," Batal "),t("button",{onClick:Rt,class:"px-5 py-1.5 rounded-xl bg-gradient-to-r from-emerald-600 to-teal-600 hover:from-emerald-500 hover:to-teal-500 text-white font-bold text-xs shadow-lg transition flex items-center gap-1.5"},[k(o(qe),{class:"w-3.5 h-3.5"}),t("span",null,x(o(X)?"Perbarui Template":"Simpan Template"),1)])])]))])])):I("",!0),t("div",Kn,[t("div",Wn,[t("div",qn,[t("button",{onClick:a[21]||(a[21]=r=>Se.value="content"),type:"button",class:j(["px-2.5 py-1.5 rounded-xl text-xs font-bold flex items-center gap-1 shrink-0 transition",o(Se)==="content"?"bg-sky-500 text-white shadow font-black":"text-slate-400 hover:text-white"])},[...a[119]||(a[119]=[t("span",null,"📝 Konten",-1)])],2),t("button",{onClick:a[22]||(a[22]=r=>Se.value="design"),type:"button",class:j(["px-2.5 py-1.5 rounded-xl text-xs font-bold flex items-center gap-1 shrink-0 transition",o(Se)==="design"?"bg-sky-500 text-white shadow font-black":"text-slate-400 hover:text-white"])},[...a[120]||(a[120]=[t("span",null,"🎨 Template",-1)])],2),t("button",{onClick:a[23]||(a[23]=r=>Se.value="media"),type:"button",class:j(["px-2.5 py-1.5 rounded-xl text-xs font-bold flex items-center gap-1 shrink-0 transition",o(Se)==="media"?"bg-sky-500 text-white shadow font-black":"text-slate-400 hover:text-white"])},[...a[121]||(a[121]=[t("span",null,"🎬 Media",-1)])],2),t("button",{onClick:a[24]||(a[24]=r=>Se.value="ai"),type:"button",class:j(["px-2.5 py-1.5 rounded-xl text-xs font-bold flex items-center gap-1 shrink-0 transition",o(Se)==="ai"?"bg-sky-500 text-white shadow font-black":"text-slate-400 hover:text-white"])},[...a[122]||(a[122]=[t("span",null,"⚡ AI Topic",-1)])],2),t("button",{onClick:a[25]||(a[25]=r=>Se.value="history"),type:"button",class:j(["px-2.5 py-1.5 rounded-xl text-xs font-bold flex items-center gap-1 shrink-0 transition",o(Se)==="history"?"bg-sky-500 text-white shadow font-black":"text-slate-400 hover:text-white"])},[...a[123]||(a[123]=[t("span",null,"💾 Draft",-1)])],2)]),t("button",{onClick:a[26]||(a[26]=r=>pt.value=!0),type:"button",class:"px-2 py-1.5 rounded-xl bg-slate-800 hover:bg-slate-700 text-[10px] font-mono font-bold text-sky-300 border border-slate-700 flex items-center gap-0.5 shrink-0 ml-1",title:"Buka RAW JSON Editor"},[...a[124]||(a[124]=[t("span",null,"</> JSON",-1)])])]),o(Se)==="content"?(p(),m("div",Yn,[o(c)||n.validationError||o(K)?(p(),m("div",{key:0,class:j(["p-3.5 rounded-2xl border text-xs shadow-lg space-y-2.5 animate-in fade-in",o(c)||n.validationError?"bg-rose-950/80 border-rose-500/60 text-rose-200":"bg-amber-950/80 border-amber-500/60 text-amber-200"])},[t("div",Xn,[k(o(Aa),{class:j(["w-4 h-4 shrink-0 mt-0.5",o(c)||n.validationError?"text-rose-400":"text-amber-400"])},null,8,["class"]),t("div",Qn,[t("div",eo,x(o(c)?"Sintaks JSON Tidak Valid":o(K)?"Perbedaan Format Template":"Data Belum Sesuai Template"),1),t("p",to,[o(c)?(p(),m("span",ao,x(o(c)),1)):o(K)?(p(),m("span",so,[a[125]||(a[125]=z(" Data JSON saat ini dibuat untuk template ",-1)),t("b",no,x(o(K).matchedTarget?.name||o(K).jsonTemplateId),1),a[126]||(a[126]=z(", sedangkan template aktif saat ini adalah ",-1)),t("b",oo,x(o(de).name),1),a[127]||(a[127]=z(". ",-1))])):(p(),m("span",io,x(n.validationError),1))])])]),t("div",lo,[t("button",{onClick:Ht,type:"button",class:"px-3 py-1.5 rounded-xl bg-white text-slate-950 text-xs font-black shadow transition active:scale-95 flex items-center gap-1.5"},[k(o(Ma),{class:"w-3.5 h-3.5"}),t("span",null,"Pakai Sampel "+x(o(de).name),1)]),o(K)?.isKnown&&o(K).matchedTarget?(p(),m("button",{key:0,onClick:a[27]||(a[27]=r=>et(o(K).matchedTarget.id)),type:"button",class:"px-2.5 py-1.5 rounded-xl bg-amber-500/20 hover:bg-amber-500/40 text-amber-300 border border-amber-500/40 text-xs font-bold transition flex items-center gap-1 active:scale-95"},[t("span",null,"Beralih ke "+x(o(K).matchedTarget.name),1)])):I("",!0),t("button",{onClick:a[28]||(a[28]=r=>pt.value=!0),type:"button",class:"px-2.5 py-1.5 rounded-xl bg-slate-800 text-slate-200 text-xs font-bold border border-slate-700 transition ml-auto active:scale-95"},[...a[128]||(a[128]=[t("span",null,"</> Buka JSON",-1)])])])],2)):(p(),m("div",ro,[t("div",uo,[a[129]||(a[129]=t("span",{class:"w-2 h-2 rounded-full bg-emerald-400 shrink-0"},null,-1)),a[130]||(a[130]=t("span",{class:"text-slate-400"},"Template Aktif:",-1)),t("span",co,x(o(de).name),1)]),t("button",{onClick:Ht,type:"button",class:"text-[10px] text-sky-400 hover:text-sky-300 font-bold shrink-0 ml-2 transition",title:"Muat ulang sampel data template aktif"}," Reset ke Sampel ")])),t("div",po,[a[131]||(a[131]=t("div",{class:"flex items-center justify-between"},[t("label",{class:"text-xs font-extrabold text-white flex items-center gap-1.5"},[t("span",null,"Judul Utama (Title)")]),t("span",{class:"text-[9px] text-sky-400 font-bold uppercase tracking-wider"},"Wajib")],-1)),t("input",{type:"text",value:n.modelValue.title,onInput:a[29]||(a[29]=r=>va(r.target.value)),placeholder:"Judul Utama Konten...",class:"w-full bg-slate-950 border border-slate-800 rounded-xl px-3 py-2 text-xs text-white font-bold focus:outline-none focus:border-sky-500 transition"},null,40,fo)]),t("div",mo,[a[132]||(a[132]=t("label",{class:"text-xs font-bold text-slate-300"},"Subtitle / Penjelasan Ringkas",-1)),t("textarea",{value:n.modelValue.subtitle||"",onInput:a[30]||(a[30]=r=>es(r.target.value)),rows:"2",placeholder:"Ringkasan atau penjelas judul...",class:"w-full bg-slate-950 border border-slate-800 rounded-xl p-2.5 text-xs text-slate-200 focus:outline-none focus:border-sky-500 transition resize-none leading-relaxed"},null,40,xo)]),t("div",ho,[t("div",bo,[a[133]||(a[133]=t("label",{class:"text-[11px] font-bold text-slate-400"},"Watermark Handle",-1)),t("input",{type:"text",value:n.modelValue.watermark||"@SocialGen",onInput:a[31]||(a[31]=r=>ya(r.target.value)),placeholder:"@NamaAkun",class:"w-full bg-slate-950 border border-slate-800 rounded-xl px-2.5 py-1.5 text-sky-400 font-bold text-xs focus:outline-none focus:border-sky-500"},null,40,go)]),t("div",vo,[a[134]||(a[134]=t("label",{class:"text-[11px] font-bold text-slate-400"},"Sumber (Footer Note)",-1)),t("input",{type:"text",value:n.modelValue.footerNote||"",onInput:a[32]||(a[32]=r=>ts(r.target.value)),placeholder:"Source: Data Wire 2026...",class:"w-full bg-slate-950 border border-slate-800 rounded-xl px-2.5 py-1.5 text-slate-300 text-xs focus:outline-none focus:border-sky-500"},null,40,yo)])]),t("div",ko,[t("div",wo,[a[136]||(a[136]=t("span",{class:"text-xs font-bold text-slate-300"},"Viral Caption & Hashtags",-1)),t("button",{onClick:a[33]||(a[33]=async()=>{n.modelValue.caption&&(await o(ht)(n.modelValue.caption),i("toast","Caption berhasil disalin!","success"))}),type:"button",class:"text-[11px] font-bold text-sky-400 hover:text-sky-300 flex items-center gap-1 active:scale-95 transition"},[k(o(Ze),{class:"w-3 h-3"}),a[135]||(a[135]=t("span",null,"Salin Caption",-1))])]),t("textarea",{value:n.modelValue.caption||"",onInput:a[34]||(a[34]=r=>as(r.target.value)),rows:"3",placeholder:"Tulis caption reels / post di sini...",class:"w-full bg-slate-950 border border-slate-800 rounded-xl p-2.5 text-xs text-slate-200 focus:outline-none focus:border-sky-500 leading-relaxed resize-none"},null,40,_o)])])):o(Se)==="design"?(p(),m("div",So,[t("div",To,[t("div",Co,[t("div",null,[t("span",Oo,"Pilih Format Template ("+x(o(q).length)+")",1),a[137]||(a[137]=t("p",{class:"text-[10px] text-slate-400"},"Geser ke kanan untuk melihat semua format",-1))]),t("button",{onClick:a[35]||(a[35]=r=>$("list")),type:"button",class:"text-[10px] font-bold text-sky-400 hover:text-sky-300 flex items-center gap-1 bg-slate-800 px-2 py-1 rounded-lg border border-slate-700"},[k(o($a),{class:"w-3 h-3"}),a[138]||(a[138]=t("span",null,"Kelola",-1))])]),o(K)||n.validationError||o(c)?(p(),m("div",Ao,[t("div",No,[a[140]||(a[140]=t("span",{class:"text-sm"},"⚠️",-1)),t("span",Io,[o(K)?(p(),m("span",Mo,[a[139]||(a[139]=z("Format JSON milik: ",-1)),t("b",null,x(o(K).matchedTarget?.name||o(K).jsonTemplateId),1)])):o(c)?(p(),m("span",$o,"Sintaks JSON tidak valid")):(p(),m("span",Do,x(n.validationError),1))])]),t("button",{onClick:Ht,type:"button",class:"px-2.5 py-1 rounded-lg bg-amber-500 text-slate-950 font-black text-[10px] shrink-0 active:scale-95 shadow ml-2"}," Pakai Sampel ")])):I("",!0),t("div",jo,[(p(!0),m(xe,null,he(o(q),r=>(p(),m("button",{key:r.id,onClick:v=>et(r.id),type:"button",class:j(["shrink-0 w-28 p-2.5 rounded-2xl border text-center flex flex-col items-center gap-1.5 transition active:scale-95",o(d)===r.id?"bg-slate-950 border-sky-500 shadow-lg shadow-sky-500/20":"bg-slate-950/70 border-slate-800 hover:border-slate-700"])},[t("div",Ro,x(ns(r.layoutType,r.id)),1),t("span",Po,x(r.name),1),t("span",{class:j(["text-[8px] font-bold px-1.5 py-0.2 rounded uppercase tracking-wider",r.isBuiltin?"bg-slate-800 text-slate-400":"bg-purple-950 text-purple-300 border border-purple-800"])},x(r.isBuiltin?r.category:"⭐ Kustom"),3)],10,Eo))),128))])]),t("div",Lo,[t("div",Vo,[a[141]||(a[141]=t("span",{class:"text-xs font-extrabold text-white"},"Tema Warna (Visual Swatches)",-1)),t("span",Bo,x(n.modelValue.theme||"blue-tech"),1)]),t("div",Jo,[(p(),m(xe,null,he(ss,r=>t("button",{key:r.id,onClick:v=>ka(r.id),type:"button",class:"flex flex-col items-center gap-1 p-1 rounded-xl transition",title:r.name},[t("div",{class:j(["w-8 h-8 rounded-full border-2 transition transform active:scale-90",n.modelValue.theme===r.id?"ring-2 ring-white ring-offset-2 ring-offset-slate-950 scale-105":"border-white/10 hover:border-white/40"]),style:ea({backgroundColor:r.color})},null,6),t("span",Zo,x(r.name.split(" ")[0]),1)],8,Fo)),64))])]),t("div",Uo,[t("div",Ho,[a[143]||(a[143]=t("div",{class:"flex flex-col"},[t("span",{class:"text-xs font-bold text-white"},"Buat Template Kustom"),t("span",{class:"text-[10px] text-slate-400"},"Punya referensi kartu baru? Tambahkan ke sistem.")],-1)),t("button",{onClick:h,type:"button",class:"px-3 py-1.5 rounded-xl bg-gradient-to-r from-sky-600 to-indigo-600 hover:from-sky-500 text-white text-xs font-bold shadow flex items-center gap-1.5 active:scale-95 transition"},[k(o(mt),{class:"w-3.5 h-3.5"}),a[142]||(a[142]=t("span",null,"+ Buat Template",-1))])]),t("div",zo,[a[144]||(a[144]=t("span",{class:"text-[10px] text-slate-400 flex items-center gap-1"},[t("span",null,"🤖 Prompt AI Buat Template")],-1)),t("div",Go,[t("button",{onClick:Qe,type:"button",class:"px-2.5 py-1 rounded-lg bg-sky-600/20 hover:bg-sky-600/40 text-sky-300 text-[10px] font-bold border border-sky-500/30 flex items-center gap-1 transition active:scale-95"},[k(o(Ze),{class:"w-3 h-3"}),t("span",null,x(o(ge)?"✓ Tersalin":"Salin Prompt"),1)]),t("button",{onClick:a[36]||(a[36]=r=>_e.value=!o(_e)),type:"button",class:"px-2 py-1 rounded-lg bg-slate-800 text-slate-300 text-[10px] font-bold border border-slate-700"},[t("span",null,x(o(_e)?"Tutup":"Lihat"),1)])])]),o(_e)?(p(),m("div",Ko,[a[145]||(a[145]=t("p",{class:"text-[9px] text-slate-400 mb-1"},"Kirim prompt ini bersama screenshot kartu ke ChatGPT / Gemini / Claude untuk menghasilkan HTML & CSS template:",-1)),t("textarea",{value:o(ct),readonly:"",rows:"5",class:"w-full bg-slate-900 border border-slate-700 rounded-lg p-2 text-[10px] text-sky-200 font-mono select-all focus:outline-none custom-scrollbar"},null,8,Wo)])):I("",!0)])])):o(Se)==="media"?(p(),m("div",qo,[t("div",Yo,[t("div",Xo,[t("label",Qo,[k(o(ta),{class:"w-4 h-4"}),a[146]||(a[146]=t("span",null,"Background Video",-1))]),t("button",{onClick:a[37]||(a[37]=r=>o(Ft)?.click()),disabled:o(Je),type:"button",class:"px-2.5 py-1 rounded-xl bg-sky-950/60 border border-sky-500/40 text-sky-300 text-[10px] font-bold flex items-center gap-1"},[k(o(Ot),{class:"w-3 h-3"}),a[147]||(a[147]=t("span",null,"Upload MP4",-1))],8,ei)]),t("select",{value:n.options.backgroundSource||"random",onChange:a[38]||(a[38]=r=>{const v=r.target.value;i("update:options",{...n.options,backgroundSource:v,videoStartOffset:0})}),class:"w-full bg-slate-950 border border-slate-800 rounded-xl px-3 py-2 text-slate-200 text-xs font-semibold focus:outline-none focus:border-sky-500"},[a[148]||(a[148]=t("option",{value:"random"},"🔀 Acak Video",-1)),(p(!0),m(xe,null,he(o(Lt),r=>(p(),m("option",{key:r,value:r},x(r.replace(".mp4","").replace(/_/g," ")),9,ai))),128)),a[149]||(a[149]=t("option",{value:"pexels"},"🌐 Pexels API (Auto HD)",-1))],40,ti),t("div",si,[t("div",ni,[t("span",oi,[a[150]||(a[150]=z(" ✂️ Mulai Detik: ",-1)),t("strong",ii,x(Math.min(n.options.videoStartOffset||0,o(Ke)))+"s",1),z(" / "+x(o(Bt))+"s ",1)]),t("button",{onClick:a[39]||(a[39]=r=>je("videoStartOffset",0)),type:"button",class:"text-[10px] text-sky-400 hover:text-white"}," Reset 0s ")]),t("input",{type:"range",min:"0",max:o(Ke),step:"1",value:Math.min(n.options.videoStartOffset||0,o(Ke)),onInput:a[40]||(a[40]=r=>je("videoStartOffset",Number(r.target.value))),class:"w-full h-1.5 bg-slate-950 rounded appearance-none cursor-pointer accent-sky-400"},null,40,li)])]),t("div",ri,[t("div",di,[t("label",ui,[k(o(aa),{class:"w-4 h-4"}),a[151]||(a[151]=t("span",null,"Musik Reels",-1))]),t("button",{onClick:a[41]||(a[41]=r=>o(Zt)?.click()),disabled:o(Je),type:"button",class:"px-2.5 py-1 rounded-xl bg-purple-950/60 border border-purple-500/40 text-purple-300 text-[10px] font-bold flex items-center gap-1"},[k(o(Ot),{class:"w-3 h-3"}),a[152]||(a[152]=t("span",null,"Upload MP3",-1))],8,ci)]),t("select",{value:n.options.musicFile||"random",onChange:a[42]||(a[42]=r=>{const v=r.target.value;i("update:options",{...n.options,musicFile:v,audioStartOffset:0})}),class:"w-full bg-slate-950 border border-slate-800 rounded-xl px-3 py-2 text-slate-200 text-xs font-semibold focus:outline-none focus:border-purple-500"},[a[153]||(a[153]=t("option",{value:"random"},"🔀 Acak Musik",-1)),(p(!0),m(xe,null,he(o(Vt),r=>(p(),m("option",{key:r,value:r},x(r.replace(".mp3","").replace(/_/g," ")),9,fi))),128))],40,pi),t("div",mi,[t("div",xi,[t("span",hi,[a[154]||(a[154]=z(" ✂️ Mulai Intro: ",-1)),t("strong",bi,x(Math.min(n.options.audioStartOffset||0,o(We)))+"s",1),z(" / "+x(o(Jt))+"s ",1)]),t("button",{onClick:a[43]||(a[43]=r=>je("audioStartOffset",0)),type:"button",class:"text-[10px] text-purple-400 hover:text-white"}," Reset 0s ")]),t("input",{type:"range",min:"0",max:o(We),step:"1",value:Math.min(n.options.audioStartOffset||0,o(We)),onInput:a[44]||(a[44]=r=>je("audioStartOffset",Number(r.target.value))),class:"w-full h-1.5 bg-slate-950 rounded appearance-none cursor-pointer accent-purple-400"},null,40,gi)])]),t("div",vi,[t("label",yi,[k(o(Kt),{class:"w-3.5 h-3.5 text-emerald-400"}),a[155]||(a[155]=t("span",null,"Durasi Reels:",-1))]),t("div",ki,[(p(),m(xe,null,he([7,10,15,30,60],r=>t("button",{key:r,onClick:v=>_a(r),type:"button",class:j(["px-2.5 py-1 rounded-xl text-xs font-bold transition",n.modelValue.reelsDuration===r?"bg-emerald-500 text-white shadow":"bg-slate-950 text-slate-400 border border-slate-800"])},x(r)+"s ",11,wi)),64))])]),t("div",_i,[a[159]||(a[159]=t("span",{class:"text-[11px] font-bold text-slate-400 uppercase tracking-wider block"},"Format Output Aktif",-1)),t("div",Si,[t("label",{class:j(["flex items-center gap-1.5 p-2 rounded-xl border text-xs cursor-pointer select-none",n.options.outputs?.feed!==!1?"bg-sky-500/10 border-sky-500/40 text-sky-200":"bg-slate-950 border-slate-800 text-slate-500"])},[t("input",{type:"checkbox",checked:n.options.outputs?.feed!==!1,onChange:a[45]||(a[45]=r=>tt("feed",r.target.checked)),class:"rounded text-sky-500"},null,40,Ti),a[156]||(a[156]=t("span",{class:"font-bold"},"Feed 4:5",-1))],2),t("label",{class:j(["flex items-center gap-1.5 p-2 rounded-xl border text-xs cursor-pointer select-none",n.options.outputs?.story!==!1?"bg-indigo-500/10 border-indigo-500/40 text-indigo-200":"bg-slate-950 border-slate-800 text-slate-500"])},[t("input",{type:"checkbox",checked:n.options.outputs?.story!==!1,onChange:a[46]||(a[46]=r=>tt("story",r.target.checked)),class:"rounded text-indigo-500"},null,40,Ci),a[157]||(a[157]=t("span",{class:"font-bold"},"Story 9:16",-1))],2),t("label",{class:j(["flex items-center gap-1.5 p-2 rounded-xl border text-xs cursor-pointer select-none",n.options.outputs?.reels!==!1?"bg-emerald-500/10 border-emerald-500/40 text-emerald-200":"bg-slate-950 border-slate-800 text-slate-500"])},[t("input",{type:"checkbox",checked:n.options.outputs?.reels!==!1,onChange:a[47]||(a[47]=r=>tt("reels",r.target.checked)),class:"rounded text-emerald-500"},null,40,Oi),a[158]||(a[158]=t("span",{class:"font-bold"},"Reels MP4",-1))],2)])])])):o(Se)==="ai"?(p(),m("div",Ai,[t("div",Ni,[t("div",Ii,[t("span",Mi,[k(o(nt),{class:"w-4 h-4 text-sky-400"}),a[160]||(a[160]=z(" Auto-Topic AI Generator ",-1))]),t("span",$i,x(o(w)),1)]),t("div",Di,[t("div",ji,[a[161]||(a[161]=t("label",{class:"text-[10px] font-bold text-slate-400"},"Pilih Niche",-1)),ue(t("select",{"onUpdate:modelValue":a[48]||(a[48]=r=>Ee(W)?W.value=r:null),class:"w-full bg-slate-950 border border-slate-800 rounded-xl px-2.5 py-2 text-xs text-white font-bold focus:outline-none"},[(p(!0),m(xe,null,he(o(pe),r=>(p(),m("option",{key:r.id,value:r.id},x(r.name),9,Ei))),128))],512),[[at,o(W)]])]),t("div",Ri,[a[163]||(a[163]=t("label",{class:"text-[10px] font-bold text-slate-400"},"Bahasa Konten",-1)),ue(t("select",{"onUpdate:modelValue":a[49]||(a[49]=r=>Ee(G)?G.value=r:null),class:"w-full bg-slate-950 border border-slate-800 rounded-xl px-2.5 py-2 text-xs text-emerald-300 font-bold focus:outline-none"},[...a[162]||(a[162]=[St('<option value="id">🇮🇩 Indonesia</option><option value="en">🇺🇸 English</option><option value="es">🇪🇸 Español</option><option value="ja">🇯🇵 日本語</option><option value="de">🇩🇪 Deutsch</option>',5)])],512),[[at,o(G)]])])]),t("button",{onClick:a[50]||(a[50]=r=>Sa()),disabled:n.isGenerating||n.isAutoTopicLoading,type:"button",class:"w-full py-3 rounded-2xl bg-gradient-to-r from-sky-500 via-indigo-600 to-purple-600 text-white font-black text-xs shadow-xl shadow-sky-500/25 flex items-center justify-center gap-2 active:scale-98 transition disabled:opacity-50"},[k(o(nt),{class:j(["w-4 h-4",{"animate-spin":n.isAutoTopicLoading}])},null,8,["class"]),t("span",null,x(n.isAutoTopicLoading?"Meriset Data Viral...":"✨ Auto-Topic Viral Baru"),1)],8,Pi)]),t("div",Li,[t("div",Vi,[t("div",Bi,[k(o(qt),{class:"w-4 h-4 text-purple-400"}),a[164]||(a[164]=t("span",{class:"text-xs font-black text-white"},"Master Prompt Riset Topik AI",-1))]),t("button",{onClick:zt,type:"button",class:"px-2 py-0.5 rounded-lg bg-purple-950/60 border border-purple-500/40 text-purple-300 text-[10px] font-bold flex items-center gap-1 hover:text-white"},[k(o(Na),{class:"w-3 h-3"}),a[165]||(a[165]=t("span",null,"Buka Detail",-1))])]),a[166]||(a[166]=t("p",{class:"text-[11px] text-slate-400 leading-relaxed"},[z(" Salin prompt riset cerdas ini ke "),t("b",null,"ChatGPT / Gemini / Claude"),z(" untuk riset topik konten viral terbaru sesuai niche & template yang aktif (bebas bentrok riwayat): ")],-1)),t("div",Ji,[t("button",{onClick:ls,disabled:o(wt),type:"button",class:"flex-1 px-3 py-2.5 rounded-xl bg-gradient-to-r from-purple-600 to-indigo-600 hover:from-purple-500 text-white text-xs font-bold shadow-lg transition flex items-center justify-center gap-1.5 active:scale-95 disabled:opacity-50"},[o(_t)?(p(),Ne(o(qe),{key:0,class:"w-3.5 h-3.5 text-emerald-300"})):(p(),Ne(o(Ze),{key:1,class:"w-3.5 h-3.5"})),t("span",null,x(o(wt)?"Menyiapkan Prompt...":o(_t)?"✓ Master Prompt Tersalin!":"Salin Master Prompt Topik"),1)],8,Fi),t("button",{onClick:zt,type:"button",title:"Lihat teks prompt manual lengkap",class:"px-3 py-2.5 rounded-xl bg-slate-800 text-slate-300 text-xs font-bold border border-slate-700 hover:bg-slate-700 transition"},[k(o(Na),{class:"w-3.5 h-3.5"})])])])])):o(Se)==="history"?(p(),m("div",Zi,[t("div",Ui,[t("button",{onClick:a[51]||(a[51]=r=>M.value="drafts"),type:"button",class:j(["flex-1 py-1.5 px-3 rounded-xl transition text-center",o(M)==="drafts"?"bg-amber-500 text-slate-950 font-black shadow":"text-slate-400 hover:text-white"])},[t("span",null,"Drafts ("+x(n.drafts.length)+")",1)],2),t("button",{onClick:a[52]||(a[52]=r=>M.value="history"),type:"button",class:j(["flex-1 py-1.5 px-3 rounded-xl transition text-center",o(M)==="history"?"bg-purple-600 text-white font-black shadow":"text-slate-400 hover:text-white"])},[t("span",null,"Riwayat ("+x(n.history.length)+")",1)],2)]),o(M)==="drafts"?(p(),m("div",Hi,[t("div",zi,[a[168]||(a[168]=t("span",{class:"text-[11px] font-bold text-slate-400 uppercase tracking-wider"},"Daftar Draft Tersimpan",-1)),t("button",{onClick:a[53]||(a[53]=r=>i("saveDraft")),type:"button",class:"text-[11px] font-bold text-amber-400 hover:text-amber-300 flex items-center gap-1"},[k(o(Gt),{class:"w-3 h-3"}),a[167]||(a[167]=t("span",null,"+ Simpan Draft",-1))])]),n.drafts.length===0?(p(),m("div",Gi," Belum ada draft tersimpan. ")):I("",!0),(p(!0),m(xe,null,he(n.drafts,(r,v)=>(p(),m("div",{key:v,onClick:P=>i("selectDraft",v),class:"p-3 rounded-2xl border bg-slate-900/80 border-slate-800 hover:border-amber-500/40 flex items-center justify-between cursor-pointer active:scale-98 transition shadow"},[t("div",Wi,[t("div",qi,x(r.title||"Tanpa Judul"),1),t("div",Yi,x(r.category||"Draft"),1)]),t("button",{onClick:ft(P=>i("deleteDraft",v),["stop"]),type:"button",class:"p-1.5 text-slate-400 hover:text-rose-400 rounded-lg transition"},[k(o(st),{class:"w-3.5 h-3.5"})],8,Xi)],8,Ki))),128))])):(p(),m("div",Qi,[t("div",el,[a[169]||(a[169]=t("span",{class:"text-[11px] font-bold text-slate-400 uppercase tracking-wider"},"Riwayat Generasi Terakhir",-1)),n.history.length>0?(p(),m("button",{key:0,onClick:Ta,type:"button",class:"text-[10px] font-bold text-rose-400 hover:text-rose-300"}," Hapus Semua ")):I("",!0)]),n.history.length===0?(p(),m("div",tl," Belum ada riwayat pembuatan. ")):I("",!0),(p(!0),m(xe,null,he(n.history,(r,v)=>(p(),m("div",{key:v,onClick:P=>i("selectHistory",v),class:"p-3 rounded-2xl border bg-slate-900/80 border-slate-800 hover:border-purple-500/40 flex items-center justify-between cursor-pointer active:scale-98 transition shadow"},[t("div",sl,[t("div",nl,x(r.title),1),t("div",ol,x(r.category)+" • "+x(Ca(r.generatedAt)),1)]),t("button",{onClick:ft(P=>i("deleteHistory",v),["stop"]),type:"button",class:"p-1.5 text-slate-400 hover:text-rose-400 rounded-lg transition"},[k(o(st),{class:"w-3.5 h-3.5"})],8,il)],8,al))),128))]))])):I("",!0),o(pt)?(p(),m("div",ll,[t("div",rl,[t("div",dl,[a[170]||(a[170]=t("div",{class:"flex items-center gap-2"},[t("span",{class:"text-xs font-bold text-white font-mono"},"</> RAW JSON SocialGen"),t("span",{class:"text-[9px] px-1.5 py-0.2 rounded-full bg-sky-500/20 text-sky-300 font-mono"},"Format V2")],-1)),t("button",{onClick:a[54]||(a[54]=r=>pt.value=!1),type:"button",class:"w-7 h-7 rounded-full bg-slate-800 flex items-center justify-center text-xs text-slate-400 hover:text-white"}," ✕ ")]),o(K)||o(c)||n.validationError?(p(),m("div",{key:0,class:j(["p-2.5 rounded-xl border text-[11px] flex items-center justify-between gap-2 shadow",o(c)||n.validationError?"bg-rose-950/80 border-rose-500/50 text-rose-200":"bg-amber-950/80 border-amber-500/50 text-amber-200"])},[t("div",ul,[a[172]||(a[172]=t("span",null,"⚠️",-1)),t("span",cl,[o(c)?(p(),m("span",pl,x(o(c)),1)):o(K)?(p(),m("span",fl,[a[171]||(a[171]=z("JSON untuk template: ",-1)),t("b",null,x(o(K).matchedTarget?.name||o(K).jsonTemplateId),1)])):(p(),m("span",ml,x(n.validationError),1))])]),o(K)?.isKnown&&o(K).matchedTarget?(p(),m("button",{key:0,onClick:a[55]||(a[55]=r=>et(o(K).matchedTarget.id)),type:"button",class:"px-2 py-0.5 rounded-lg bg-amber-500 text-slate-950 font-bold text-[10px] shrink-0 active:scale-95 shadow"}," Ganti Template ")):I("",!0)],2)):I("",!0),t("textarea",{value:o(l),onInput:ba,rows:"8",spellcheck:"false",class:"w-full bg-slate-950 text-sky-200 text-xs font-mono p-3 rounded-xl border border-slate-800 focus:outline-none focus:border-sky-500/50 resize-y leading-relaxed",placeholder:"Paste Content JSON here..."},null,40,xl),t("div",hl,[t("button",{onClick:Ut,type:"button",class:"px-3 py-2 rounded-xl bg-slate-800 hover:bg-slate-700 text-xs font-bold text-amber-400"}," Pakai Sample "),t("button",{onClick:ga,type:"button",class:"px-3 py-2 rounded-xl bg-slate-800 hover:bg-slate-700 text-xs font-bold text-sky-400"}," Format JSON "),t("button",{onClick:a[56]||(a[56]=r=>pt.value=!1),type:"button",class:"px-4 py-2 rounded-xl bg-sky-500 hover:bg-sky-400 text-xs font-bold text-white shadow-lg"}," Selesai ")])])])):I("",!0)]),t("div",bl,[t("div",gl,[t("div",vl,[t("div",yl,[k(o(ws),{class:"w-3.5 h-3.5 text-sky-400"}),a[173]||(a[173]=t("span",{class:"text-xs font-black text-white"},"Content Studio",-1))]),t("div",kl,[k(o(hs),{class:"w-3.5 h-3.5 text-sky-400"}),a[175]||(a[175]=t("span",{class:"text-[11px] font-bold text-slate-400"},"Niche:",-1)),ue(t("select",{"onUpdate:modelValue":a[57]||(a[57]=r=>Ee(W)?W.value=r:null),class:"bg-transparent text-[11px] font-black text-white focus:outline-none cursor-pointer max-w-[130px] truncate",title:"Pilih Niche Konten"},[(p(!0),m(xe,null,he(o(pe),r=>(p(),m("option",{key:r.id,value:r.id,class:"bg-slate-900 text-white"},x(r.name),9,wl))),128))],512),[[at,o(W)]]),t("button",{onClick:Ce,class:"p-0.5 px-1 rounded bg-slate-800 hover:bg-slate-700 text-sky-400 text-[10px] font-bold transition flex items-center gap-0.5",title:"Kelola & Buat Niche Baru"},[k(o(mt),{class:"w-3 h-3"}),a[174]||(a[174]=t("span",null,"Niche",-1))])]),t("div",_l,[k(o(xs),{class:"w-3.5 h-3.5 text-emerald-400"}),ue(t("select",{"onUpdate:modelValue":a[58]||(a[58]=r=>Ee(G)?G.value=r:null),class:"bg-transparent text-[11px] font-bold text-emerald-300 focus:outline-none cursor-pointer"},[...a[176]||(a[176]=[St('<option value="id" class="bg-slate-900 text-white">🇮🇩 Indonesia</option><option value="en" class="bg-slate-900 text-white">🇺🇸 English</option><option value="es" class="bg-slate-900 text-white">🇪🇸 Español</option><option value="ja" class="bg-slate-900 text-white">🇯🇵 日本語</option><option value="de" class="bg-slate-900 text-white">🇩🇪 Deutsch</option>',5)])],512),[[at,o(G)]])])]),t("div",Sl,[t("button",{onClick:zt,title:"Buat prompt manual bebas bentrok untuk ChatGPT / Gemini Web",class:"px-2.5 py-1.5 rounded-xl bg-purple-950/40 hover:bg-purple-900/50 border border-purple-500/30 text-purple-300 text-xs font-bold transition flex items-center gap-1.5 shadow-sm active:scale-95"},[k(o(qt),{class:"w-3.5 h-3.5 text-purple-400"}),a[177]||(a[177]=t("span",null,"Prompt Manual",-1))]),t("button",{onClick:a[59]||(a[59]=r=>Sa()),disabled:n.isGenerating||n.isAutoTopicLoading,class:"px-3 py-1.5 rounded-xl bg-gradient-to-r from-sky-500 via-indigo-600 to-purple-600 hover:opacity-90 text-white text-xs font-bold transition flex items-center gap-1.5 shadow-md shadow-indigo-500/20 active:scale-95 disabled:opacity-50"},[k(o(nt),{class:j(["w-3.5 h-3.5 text-amber-300",{"animate-spin":n.isAutoTopicLoading}])},null,8,["class"]),t("span",null,x(n.isAutoTopicLoading?"Meriset Data...":"✨ Auto-Topic"),1)],8,Tl),t("div",Cl,[a[180]||(a[180]=t("button",{class:"px-2 py-1.5 text-xs font-bold text-slate-300 bg-slate-800 hover:bg-slate-700 border border-slate-700 rounded-xl"}," ▾ ",-1)),t("div",Ol,[a[179]||(a[179]=t("div",{class:"px-3 py-1 text-[10px] font-bold text-slate-500 uppercase"},"Model AI Engine",-1)),t("div",Al,[ue(t("select",{"onUpdate:modelValue":a[60]||(a[60]=r=>Ee(w)?w.value=r:null),class:"w-full bg-slate-950 border border-slate-700 rounded-lg p-1.5 text-xs text-sky-300 focus:outline-none"},[...a[178]||(a[178]=[t("option",{value:"gemini-3.8-flash"},"⚡ Gemini 3.8 Flash",-1),t("option",{value:"gemini-3.5-flash"},"⚡ Gemini 3.5 Flash",-1),t("option",{value:"gemini-2.5-pro"},"💎 Gemini 2.5 Pro",-1),t("option",{value:"gemini-1.5-pro"},"💎 Gemini 1.5 Pro",-1)])],512),[[at,o(w)]])])])])])]),n.isAutoTopicLoading?(p(),m("div",Nl,[t("div",Il,[k(o(nt),{class:"w-3 h-3 text-sky-400 animate-spin"})]),t("div",Ml,[a[181]||(a[181]=t("span",{class:"font-bold text-white"},"AI Research Engine Sedang Bekerja...",-1)),t("span",$l,x(o(w)),1),a[182]||(a[182]=t("span",{class:"text-[10px] text-slate-300"},"Meriset data perbandingan terbaru & copywriting viral.",-1))])])):I("",!0),t("div",Dl,[t("aside",jl,[t("div",El,[t("div",Rl,[t("button",{onClick:a[61]||(a[61]=r=>M.value="editor"),class:j(["flex-1 py-1.5 px-2 rounded-lg text-[11px] transition flex items-center justify-center gap-1 font-bold",o(M)==="editor"?"bg-slate-800 text-sky-400 shadow":"text-slate-400 hover:text-white"])},[k(o(Ia),{class:"w-3.5 h-3.5"}),a[183]||(a[183]=t("span",null,"Template",-1))],2),t("button",{onClick:a[62]||(a[62]=r=>M.value="drafts"),class:j(["flex-1 py-1.5 px-2 rounded-lg text-[11px] transition flex items-center justify-center gap-1 font-bold",o(M)==="drafts"?"bg-slate-800 text-amber-400 shadow":"text-slate-400 hover:text-white"])},[k(o(Gt),{class:"w-3.5 h-3.5"}),t("span",null,"Drafts ("+x(n.drafts.length)+")",1)],2),t("button",{onClick:a[63]||(a[63]=r=>M.value="history"),class:j(["flex-1 py-1.5 px-2 rounded-lg text-[11px] transition flex items-center justify-center gap-1 font-bold",o(M)==="history"?"bg-slate-800 text-purple-400 shadow":"text-slate-400 hover:text-white"])},[k(o(Kt),{class:"w-3.5 h-3.5"}),t("span",null,"Riwayat ("+x(n.history.length)+")",1)],2)])]),o(M)==="editor"?(p(),m("div",Pl,[t("div",Ll,[t("div",Vl,[t("span",Bl,"Library ("+x(o(q).length)+" Template)",1),t("button",{onClick:h,type:"button",class:"px-2 py-0.5 rounded-lg bg-sky-500/20 text-sky-300 border border-sky-500/30 text-[10px] font-bold hover:bg-sky-500/30 flex items-center gap-1 transition active:scale-95"},[k(o(mt),{class:"w-3 h-3"}),a[184]||(a[184]=t("span",null,"+ Buat Template",-1))])]),t("div",Jl,[ue(t("input",{"onUpdate:modelValue":a[64]||(a[64]=r=>Ee(te)?te.value=r:null),type:"text",placeholder:"Cari template...",class:"w-full bg-slate-950 border border-slate-800 rounded-xl px-2.5 py-1.5 text-xs text-white placeholder-slate-500 focus:outline-none focus:border-sky-500"},null,512),[[Ae,o(te)]])])]),t("div",Fl,[(p(!0),m(xe,null,he(o(T),r=>(p(),m("div",{key:r.id,onClick:v=>et(r.layoutType==="custom"?r.id:r.layoutType||r.id),class:j(["p-2.5 rounded-xl border cursor-pointer transition flex flex-col gap-1 group text-left",o(d)===r.id?"bg-sky-950/40 border-sky-500/50 shadow-sm":"bg-slate-950/60 border-slate-800/80 hover:border-slate-700"])},[t("div",Ul,[t("span",Hl,x(r.name),1),o(d)===r.id?(p(),m("span",zl)):r.isBuiltin?I("",!0):(p(),m("span",Gl,"⭐ Kustom"))]),t("span",Kl,x(r.description||"Format kartu visual studio"),1),t("div",Wl,[t("span",ql,x(r.category||"UMUM"),1),r.isBuiltin?(p(),m("span",Yl," BAWAAN ")):I("",!0)])],10,Zl))),128))]),t("div",Xl,[t("span",Ql,[k(o(nt),{class:"w-3 h-3 text-purple-400"}),a[185]||(a[185]=t("span",null,"AI Vision Template",-1))]),t("button",{onClick:Qe,class:"px-2 py-1 rounded-lg bg-slate-800 hover:bg-slate-700 text-slate-300 hover:text-white text-[10px] font-bold transition flex items-center gap-1"},[k(o(Ze),{class:"w-2.5 h-2.5"}),t("span",null,x(o(ge)?"✓ Tersalin":"Salin Prompt"),1)])])])):o(M)==="drafts"?(p(),m("div",er,[t("div",tr,[t("span",ar,"Tersimpan ("+x(n.drafts.length)+")",1),t("button",{onClick:a[65]||(a[65]=r=>i("saveDraft")),class:"text-[10px] text-amber-400 hover:text-amber-300 transition font-bold flex items-center gap-1",title:"Simpan konten saat ini ke Drafts"},[k(o(Gt),{class:"w-3 h-3"}),a[186]||(a[186]=t("span",null,"+ Simpan ke Draft",-1))])]),t("div",sr,[n.unsavedStash?(p(),m("div",nr,[t("div",or,[a[187]||(a[187]=t("span",{class:"font-bold text-amber-300"},"Editan aktif: ",-1)),t("span",ir,x(n.unsavedStash.title||"Tanpa Judul"),1)]),t("button",{onClick:ee,class:"px-1.5 py-0.5 bg-amber-500 text-slate-950 font-bold rounded text-[9px] shrink-0"}," Kembali ")])):I("",!0),n.drafts.length===0?(p(),m("div",lr,[...a[188]||(a[188]=[z(" Belum ada draft tersimpan.",-1),t("br",null,null,-1),z(" Klik ",-1),t("b",null,"+ Simpan ke Draft",-1),z(" di atas untuk menyimpan konten ini! ",-1)])])):I("",!0),(p(!0),m(xe,null,he(n.drafts,(r,v)=>(p(),m("div",{key:v,onClick:P=>i("selectDraft",v),"data-draft-item":"",class:j(["p-2 rounded-xl border cursor-pointer transition flex items-center justify-between text-xs group",n.activeDraftIndex===v?"bg-amber-500/15 border-amber-500/50 text-white":"bg-slate-950/60 border-slate-800 text-slate-300 hover:border-slate-700"])},[t("div",dr,[t("div",ur,[t("span",cr,x(r.layoutType||"table"),1),t("span",pr,x(r.category),1)]),t("div",fr,x(r.title),1)]),t("button",{onClick:ft(P=>i("deleteDraft",v),["stop"]),class:"opacity-0 group-hover:opacity-100 p-1 text-slate-400 hover:text-rose-400 transition rounded shrink-0",title:"Hapus draft ini"},[k(o(st),{class:"w-3.5 h-3.5"})],8,mr)],10,rr))),128))])])):o(M)==="history"?(p(),m("div",xr,[t("div",hr,[t("span",br,"Riwayat ("+x(n.history.length)+")",1),n.history.length>0?(p(),m("button",{key:0,onClick:Ta,class:"text-[10px] text-rose-400 hover:text-rose-300 transition font-bold"}," Bersihkan Riwayat ")):I("",!0)]),t("div",gr,[n.unsavedStash?(p(),m("div",vr,[t("div",yr,[a[189]||(a[189]=t("span",{class:"font-bold text-purple-300"},"Editan aktif: ",-1)),t("span",kr,x(n.unsavedStash.title||"Tanpa Judul"),1)]),t("button",{onClick:ee,class:"px-1.5 py-0.5 bg-purple-500 text-white font-bold rounded text-[9px] shrink-0"}," Kembali ")])):I("",!0),n.history.length===0?(p(),m("div",wr,[...a[190]||(a[190]=[z(" Belum ada riwayat pembuatan.",-1),t("br",null,null,-1),z(" Hasil generate akan otomatis tercatat di sini! ",-1)])])):I("",!0),(p(!0),m(xe,null,he(n.history,(r,v)=>(p(),m("div",{key:v,onClick:P=>i("selectHistory",v),"data-history-item":"",class:j(["p-2 rounded-xl border cursor-pointer transition flex items-center justify-between text-xs group",n.activeHistoryIndex===v?"bg-purple-500/15 border-purple-500/50 text-white":"bg-slate-950/60 border-slate-800 text-slate-300 hover:border-slate-700"])},[t("div",Sr,[t("div",Tr,[t("span",Cr,x(r.layoutType||"reels"),1),t("span",Or,x(r.category),1),r.generatedAt?(p(),m("span",Ar,x(Ca(r.generatedAt)),1)):I("",!0)]),t("div",Nr,x(r.title),1)]),t("button",{onClick:ft(P=>i("deleteHistory",v),["stop"]),class:"opacity-0 group-hover:opacity-100 p-1 text-slate-400 hover:text-rose-400 transition rounded shrink-0",title:"Hapus riwayat ini"},[k(o(st),{class:"w-3.5 h-3.5"})],8,Ir)],10,_r))),128))])])):I("",!0)]),t("section",Mr,[t("div",$r,[t("div",Dr,[k(o(vs),{class:"w-3.5 h-3.5 text-sky-400"}),a[191]||(a[191]=t("span",{class:"text-xs font-black text-white"},"Studio Inspector",-1)),t("span",jr,x(o(os)),1)]),t("div",Er,[t("button",{onClick:ga,class:"px-2 py-1 rounded-lg bg-slate-800 hover:bg-slate-700 text-slate-300 text-[10px] font-bold transition flex items-center gap-1",title:"Format JSON"},[k(o(Wt),{class:"w-2.5 h-2.5"}),a[192]||(a[192]=t("span",null,"Format",-1))]),t("button",{onClick:Ut,class:"px-2 py-1 rounded-lg bg-sky-950/60 border border-sky-500/40 text-sky-300 text-[10px] font-bold hover:bg-sky-900/50 transition flex items-center gap-1",title:"Clear / Pakai Sample"},[k(o(qa),{class:"w-2.5 h-2.5"}),a[193]||(a[193]=t("span",null,"Sample",-1))])])]),t("div",Rr,[t("div",Pr,[t("div",Lr,[a[194]||(a[194]=t("label",{class:"text-[10px] font-black uppercase tracking-wider text-slate-400"},"Palette Tema (10 Pilihan)",-1)),t("span",Vr,x(wa.find(r=>r.id===(n.modelValue.theme||"blue-tech"))?.name||"Blue Tech"),1)]),t("div",Br,[(p(),m(xe,null,he(wa,r=>t("button",{key:r.id,onClick:v=>ka(r.id),type:"button",class:j(["h-6 rounded-lg transition border flex items-center justify-center shadow",[r.bgClass,(n.modelValue.theme||"blue-tech")===r.id?"border-2 border-sky-400 ring-2 ring-sky-400/30 scale-105":"border-slate-800 hover:border-slate-600"]]),title:r.name},[(n.modelValue.theme||"blue-tech")===r.id?(p(),Ne(o(qe),{key:0,class:"w-3 h-3 text-white"})):I("",!0)],10,Jr)),64))])]),t("div",Fr,[t("div",Zr,[a[195]||(a[195]=t("label",{class:"text-[10px] font-black uppercase tracking-wider text-slate-400"},"Watermark",-1)),t("input",{type:"text",value:n.modelValue.watermark||"@SocialGen",onInput:a[66]||(a[66]=r=>ya(r.target.value)),class:"w-full bg-slate-900 border border-slate-800 rounded-xl px-2.5 py-1.5 text-xs text-sky-400 font-semibold focus:outline-none focus:border-sky-500"},null,40,Ur)]),t("div",Hr,[a[196]||(a[196]=t("label",{class:"text-[10px] font-black uppercase tracking-wider text-slate-400"},"Judul Konten (Title)",-1)),t("input",{type:"text",value:n.modelValue.title,onInput:a[67]||(a[67]=r=>va(r.target.value)),placeholder:"Judul Utama Konten...",class:"w-full bg-slate-900 border border-slate-800 rounded-xl px-2.5 py-1.5 text-xs text-slate-100 font-semibold focus:outline-none focus:border-sky-500"},null,40,zr)])]),t("div",Gr,[t("div",Kr,[t("label",Wr,[k(o(Wt),{class:"w-3.5 h-3.5 text-sky-400"}),a[197]||(a[197]=t("span",null,"RAW JSON Content",-1))]),o(c)?(p(),m("span",Yr,[k(o(Aa),{class:"w-2.5 h-2.5"}),a[198]||(a[198]=z(" Invalid ",-1))])):(p(),m("span",qr,[k(o(ms),{class:"w-2.5 h-2.5"}),z(" "+x(o(l).trim()?"Valid":"Sample Mode"),1)]))]),o(K)?(p(),m("div",{key:0,class:j(["p-2 rounded-xl border text-xs transition-all shadow-md flex flex-col gap-1.5",o(K).isKnown?"bg-amber-500/10 border-amber-500/30":"bg-rose-500/10 border-rose-500/30"])},[t("div",{class:j(["flex items-center gap-1.5 text-[11px]",o(K).isKnown?"text-amber-300":"text-rose-300"])},[a[200]||(a[200]=t("span",null,"⚠️",-1)),o(K).isKnown?(p(),m("span",Xr,[a[199]||(a[199]=z(" Format milik: ",-1)),t("b",null,x(o(K).matchedTarget?.name),1)])):(p(),m("span",Qr,' Template "'+x(o(K).jsonTemplateId)+'" tidak ditemukan. ',1))],2),t("div",ed,[o(K).isKnown&&o(K).matchedTarget?(p(),m("button",{key:0,onClick:a[68]||(a[68]=r=>et(o(K).matchedTarget.id)),class:"px-2 py-0.5 rounded-lg bg-amber-500/20 hover:bg-amber-500/30 text-amber-200 border border-amber-500/40 text-[10px] font-bold transition"}," Pindah Template ")):I("",!0),t("button",{onClick:Ut,class:"px-2 py-0.5 rounded-lg bg-slate-800 hover:bg-slate-700 text-slate-300 text-[10px] font-semibold transition"}," Pakai Sampel ")])],2)):I("",!0),t("textarea",{value:o(l),onInput:ba,rows:"7",spellcheck:"false",class:"w-full bg-slate-950 text-sky-200 text-[11px] font-mono p-2.5 rounded-xl border border-slate-800 focus:outline-none focus:border-sky-500/50 resize-y leading-relaxed select-text custom-scrollbar",placeholder:"Paste Content JSON here... (kosong = otomatis menggunakan data sampel template aktif)"},null,40,td),o(c)||n.validationError?(p(),m("p",ad," ⚠️ "+x(o(c)||n.validationError),1)):I("",!0)]),t("input",{type:"file",ref_key:"videoInputRef",ref:Ft,accept:"video/mp4,video/webm",class:"hidden",onChange:a[69]||(a[69]=r=>ha(r))},null,544),t("input",{type:"file",ref_key:"audioInputRef",ref:Zt,accept:"audio/mp3,audio/mpeg,audio/wav",class:"hidden",onChange:a[70]||(a[70]=r=>ha(r))},null,544),t("div",sd,[t("div",nd,[t("div",od,[t("label",id,[k(o(ta),{class:"w-3.5 h-3.5 text-sky-400"}),a[201]||(a[201]=t("span",null,"Background Video",-1))]),t("div",ld,[t("select",{value:n.options.backgroundSource||"random",onChange:a[71]||(a[71]=r=>{const v=r.target.value;i("update:options",{...n.options,backgroundSource:v,videoStartOffset:0})}),class:"bg-slate-950 border border-slate-800 rounded-lg px-2 py-1 text-slate-300 text-[11px] focus:outline-none max-w-[150px] truncate"},[a[202]||(a[202]=t("option",{value:"random"},"🔀 Acak Video",-1)),(p(!0),m(xe,null,he(o(Lt),r=>(p(),m("option",{key:r,value:r},x(r.replace(".mp4","").replace(/_/g," ")),9,dd))),128)),a[203]||(a[203]=t("option",{value:"pexels"},"🌐 Pexels API (Auto HD)",-1))],40,rd),t("button",{onClick:a[72]||(a[72]=r=>o(Ft)?.click()),disabled:o(Je),title:"Upload Video MP4 Sendiri",class:"p-1 px-2 rounded-lg border border-sky-500/30 text-sky-300 bg-sky-950/40 hover:bg-sky-900/60 text-[10px] flex items-center gap-1 font-bold transition disabled:opacity-50"},[k(o(Ot),{class:"w-3 h-3"}),t("span",cd,x(o(Je)?"...":"Upload"),1)],8,ud)])]),t("div",pd,[t("span",fd,[k(o(sa),{class:"w-2.5 h-2.5"}),z(" Mulai: "+x(Math.min(n.options.videoStartOffset||0,o(Ke)))+"s / "+x(o(Bt))+"s ",1)]),t("input",{type:"range",min:"0",max:o(Ke),step:"1",value:Math.min(n.options.videoStartOffset||0,o(Ke)),onInput:a[73]||(a[73]=r=>je("videoStartOffset",Number(r.target.value))),class:"w-28 h-1 bg-slate-950 rounded appearance-none cursor-pointer accent-sky-400"},null,40,md)])]),t("div",xd,[t("div",hd,[t("label",bd,[k(o(aa),{class:"w-3.5 h-3.5 text-purple-400"}),a[204]||(a[204]=t("span",null,"Musik Reels",-1))]),t("div",gd,[t("select",{value:n.options.musicFile||"random",onChange:a[74]||(a[74]=r=>{const v=r.target.value;i("update:options",{...n.options,musicFile:v,audioStartOffset:0})}),class:"bg-slate-950 border border-slate-800 rounded-lg px-2 py-1 text-slate-300 text-[11px] focus:outline-none max-w-[150px] truncate"},[a[205]||(a[205]=t("option",{value:"random"},"🔀 Acak Musik",-1)),(p(!0),m(xe,null,he(o(Vt),r=>(p(),m("option",{key:r,value:r},x(r.replace(".mp3","").replace(/_/g," ")),9,yd))),128))],40,vd),t("button",{onClick:a[75]||(a[75]=r=>o(Zt)?.click()),disabled:o(Je),title:"Upload Musik MP3 Sendiri",class:"p-1 px-2 rounded-lg border border-purple-500/30 text-purple-300 bg-purple-950/40 hover:bg-purple-900/60 text-[10px] flex items-center gap-1 font-bold transition disabled:opacity-50"},[k(o(Ot),{class:"w-3 h-3"}),t("span",wd,x(o(Je)?"...":"Upload"),1)],8,kd)])]),t("div",_d,[t("span",Sd,[k(o(sa),{class:"w-2.5 h-2.5"}),z(" Mulai: "+x(Math.min(n.options.audioStartOffset||0,o(We)))+"s / "+x(o(Jt))+"s ",1)]),t("input",{type:"range",min:"0",max:o(We),step:"1",value:Math.min(n.options.audioStartOffset||0,o(We)),onInput:a[76]||(a[76]=r=>je("audioStartOffset",Number(r.target.value))),class:"w-28 h-1 bg-slate-950 rounded appearance-none cursor-pointer accent-purple-400"},null,40,Td)])]),t("div",Cd,[t("label",Od,[k(o(Kt),{class:"w-3.5 h-3.5 text-emerald-400"}),a[206]||(a[206]=t("span",null,"Durasi Reels:",-1))]),t("div",Ad,[(p(),m(xe,null,he([7,10,15,30,60],r=>t("button",{key:r,onClick:v=>_a(r),class:j(["px-2 py-0.5 text-[10px] font-bold rounded-lg border transition",(n.modelValue.reelsDuration||30)===r?"bg-emerald-500/20 border-emerald-500/60 text-emerald-300":"bg-slate-950 border-slate-800 text-slate-400 hover:text-white"])},x(r===60?"1m":r+"s"),11,Nd)),64))])]),t("div",Id,[t("label",{class:j(["flex items-center gap-1.5 p-1.5 rounded-xl border text-[11px] cursor-pointer transition select-none",n.options.outputs?.feed!==!1?"bg-sky-500/10 border-sky-500/40 text-sky-200":"bg-slate-950/50 border-slate-800 text-slate-500"])},[t("input",{type:"checkbox",checked:n.options.outputs?.feed!==!1,onChange:a[77]||(a[77]=r=>tt("feed",r.target.checked)),class:"rounded text-sky-500 focus:ring-0 bg-slate-900 border-slate-700 w-3 h-3"},null,40,Md),a[207]||(a[207]=t("span",{class:"font-bold"},"Feed 4:5",-1))],2),t("label",{class:j(["flex items-center gap-1.5 p-1.5 rounded-xl border text-[11px] cursor-pointer transition select-none",n.options.outputs?.story!==!1?"bg-indigo-500/10 border-indigo-500/40 text-indigo-200":"bg-slate-950/50 border-slate-800 text-slate-500"])},[t("input",{type:"checkbox",checked:n.options.outputs?.story!==!1,onChange:a[78]||(a[78]=r=>tt("story",r.target.checked)),class:"rounded text-indigo-500 focus:ring-0 bg-slate-900 border-slate-700 w-3 h-3"},null,40,$d),a[208]||(a[208]=t("span",{class:"font-bold"},"Story 9:16",-1))],2),t("label",{class:j(["flex items-center gap-1.5 p-1.5 rounded-xl border text-[11px] cursor-pointer transition select-none",n.options.outputs?.reels!==!1?"bg-emerald-500/10 border-emerald-500/40 text-emerald-200":"bg-slate-950/50 border-slate-800 text-slate-500"])},[t("input",{type:"checkbox",checked:n.options.outputs?.reels!==!1,onChange:a[79]||(a[79]=r=>tt("reels",r.target.checked)),class:"rounded text-emerald-500 focus:ring-0 bg-slate-900 border-slate-700 w-3 h-3"},null,40,Dd),a[209]||(a[209]=t("span",{class:"font-bold"},"Reels MP4",-1))],2)])])]),t("div",jd,[t("button",{onClick:a[80]||(a[80]=r=>i("generate")),disabled:!n.isValid||n.isGenerating||!!o(c),class:j(["w-full py-3 px-4 rounded-xl font-black text-xs tracking-wide shadow-xl transition flex items-center justify-center gap-2",[!n.isValid||n.isGenerating||o(c)?"bg-slate-800 text-slate-500 cursor-not-allowed border border-slate-700":"bg-gradient-to-r from-sky-500 via-indigo-600 to-purple-600 hover:from-sky-400 hover:to-indigo-500 text-white shadow-sky-500/25 active:scale-[0.99]"]])},[n.isGenerating?(p(),Ne(o(Ma),{key:0,class:"w-3.5 h-3.5 animate-spin"})):(p(),Ne(o(Wa),{key:1,class:"w-3.5 h-3.5 fill-current"})),t("span",null,x(n.isGenerating?n.generateStage||"Rendering Content...":"GENERATE CONTENT SEKARANG"),1)],10,Ed)])])])])]))}}),Pd={class:"flex flex-col gap-2.5 h-full text-slate-100 min-h-0 justify-between relative"},Ld={key:0,class:"absolute inset-0 z-50 bg-slate-950/85 backdrop-blur-md rounded-2xl flex flex-col items-center justify-center p-6 text-center animate-in fade-in duration-200"},Vd={class:"relative flex items-center justify-center mb-5"},Bd={class:"absolute inset-0 flex items-center justify-center"},Jd={class:"text-xs text-sky-300 font-bold mb-4 flex items-center gap-2"},Fd={class:"flex flex-wrap items-center justify-between gap-2 p-2.5 bg-slate-900/90 border border-slate-800 rounded-2xl shadow-lg flex-shrink-0"},Zd={class:"flex items-center gap-1 bg-slate-950 p-1 rounded-xl border border-slate-800 text-xs font-bold"},Ud={key:0,class:"w-1.5 h-1.5 rounded-full bg-white animate-pulse"},Hd={class:"flex items-center gap-2 text-xs"},zd={class:"flex items-center gap-1 bg-slate-950 p-1 rounded-xl border border-slate-800 text-xs shadow-inner"},Gd={key:0,class:"relative shadow-2xl rounded-2xl overflow-hidden border border-slate-700/80 flex-shrink-0",style:{width:"360px",height:"450px"}},Kd={style:{width:"1080px",height:"1350px",transform:"scale(0.333333)","transform-origin":"top left"}},Wd={key:1,class:"relative shadow-2xl rounded-2xl overflow-hidden border border-slate-700/80 flex-shrink-0",style:{width:"300px",height:"533.33px"}},qd={key:0,class:"absolute inset-0 z-0 bg-slate-950 overflow-hidden"},Yd=["src"],Xd=["src","muted"],Qd={class:"relative z-10 pointer-events-none",style:{width:"1080px",height:"1920px",transform:"scale(0.277778)","transform-origin":"top left"}},eu={key:1,class:"absolute inset-0 z-20 pointer-events-none flex flex-col justify-between"},tu={class:"flex-1 flex justify-end p-2"},au={key:0,class:"w-10 bg-red-500/20 border-l border-dashed border-red-500/60 rounded flex flex-col items-center justify-center gap-3 text-[8px] text-red-200 py-3 text-center px-0.5 font-bold"},su={key:1,class:"flex flex-col bg-slate-900/95 border border-slate-800 rounded-2xl p-2.5 gap-2 shadow-xl flex-shrink-0 text-xs"},nu={class:"flex items-center justify-between gap-3"},ou=["title"],iu={class:"text-[11px] hidden sm:inline"},lu={class:"flex-1 flex items-center gap-2"},ru=["max","value"],du={class:"font-mono text-[11px] font-bold text-slate-300 min-w-[75px] text-right"},uu=["title"],cu={key:0,class:"grid grid-cols-1 sm:grid-cols-2 gap-3 p-2.5 bg-slate-950/80 rounded-xl border border-slate-800/80 animate-fadeIn"},pu={class:"flex flex-col gap-1.5"},fu={class:"flex items-center justify-between text-[11px]"},mu={class:"font-bold text-sky-300 flex items-center gap-1"},xu=["max","value"],hu={class:"text-[9px] text-slate-500"},bu={class:"flex flex-col gap-1.5"},gu={class:"flex items-center justify-between text-[11px]"},vu={class:"font-bold text-purple-300 flex items-center gap-1"},yu=["max","value"],ku={class:"text-[9px] text-slate-500"},wu={class:"flex flex-col bg-slate-900/90 border border-slate-800 rounded-2xl p-2.5 gap-1.5 shadow-lg flex-shrink-0"},_u={class:"flex items-center justify-between text-xs"},Su=["value"],Tu=ua({__name:"LivePreview",props:{data:{},selectedVideo:{},selectedMusic:{},videoStartOffset:{default:0},audioStartOffset:{default:0},isGenerating:{type:Boolean,default:!1},generateStage:{default:""},generatedResult:{}},emits:["update:videoStartOffset","update:audioStartOffset"],setup(n,{emit:e}){const s=n,i=e,l={"neon_cyber_grid.mp4":8,"financial_pulse_flow.mp4":8,"dark_luxury_particles.mp4":8,"cyber_matrix_stream.mp4":10,"cyber_blue.mp4":15,"default_bg.mp4":15,"emerald_flow.mp4":15,"cyber_pulse.mp4":15,"cyber_future_tech.mp3":15,"dark_phonk_pulse.mp3":15,"deep_finance_groove.mp3":15,"synthwave_pulse.mp3":15,"lofi_chill.mp3":15,"default_ambient.mp3":15,"motivation_cinematic.mp3":110,"lofi_viral_study.mp3":147},d=ce(()=>s.selectedVideo&&s.selectedVideo!=="pexels"&&s.selectedVideo!=="random"?`/api/stream/videos/${s.selectedVideo}`:"/api/stream/videos/default_bg.mp4"),f=ce(()=>s.selectedMusic&&s.selectedMusic!=="random"?`/api/stream/audio/${s.selectedMusic}`:"/api/stream/audio/lofi_viral_study.mp3"),c=S("feed"),C=S(!1),w=S(!1),M=S(!1),ee=S(1),pe=ce(()=>c.value==="feed"?360:300),W=ce(()=>c.value==="feed"?450:533.33),V=S(null),D=S(null),J=S(!0),fe=S(!1),Ce=S(0),$e=ce(()=>s.data.reelsDuration||30),ve=S(l[s.selectedVideo||""]||8),Y=S(l[s.selectedMusic||""]||30),G=ce(()=>Math.max(1,Math.floor(ve.value-1))),ie=ce(()=>Math.max(1,Math.floor(Y.value-1)));function q(){ee.value<2.5&&(ee.value=Math.min(2.5,+(ee.value+.15).toFixed(2)))}function we(){ee.value>.5&&(ee.value=Math.max(.5,+(ee.value-.15).toFixed(2)))}function oe(){ee.value=1}function X(T){(T.ctrlKey||T.metaKey)&&(T.preventDefault(),T.deltaY<0?q():we())}let te=0,H=null;function ge(T){if(J.value){if(te>0){const b=(T-te)/1e3;b>0&&b<1&&(Ce.value+=b,Ce.value>=$e.value&&(Ce.value=0,Xe(0)))}te=T,H=requestAnimationFrame(ge)}}const ae=S({});async function _e(){try{const T=await $fetch("/api/media");if(T?.durations){ae.value=T.durations;const b=s.selectedVideo||"";ae.value[b]&&(ve.value=ae.value[b]);const ye=s.selectedMusic||"";ae.value[ye]&&(Y.value=ae.value[ye])}}catch{}}ca(()=>{_e(),J.value&&(te=performance.now(),H&&cancelAnimationFrame(H),H=requestAnimationFrame(ge))}),ds(()=>{H&&(cancelAnimationFrame(H),H=null)}),ke($e,T=>{Ce.value>T&&(Ce.value=0,Xe(0))});function se(){J.value?Ge():N()}function N(){J.value=!0,te=performance.now(),H&&cancelAnimationFrame(H),H=requestAnimationFrame(ge),V.value&&V.value.play().catch(()=>{}),D.value&&(D.value.muted=fe.value,D.value.volume=.85,D.value.play().catch(()=>{}))}function Ge(){J.value=!1,te=0,H&&(cancelAnimationFrame(H),H=null),V.value&&V.value.pause(),D.value&&D.value.pause()}function $(){if(fe.value=!fe.value,D.value)if(D.value.muted=fe.value,D.value.volume=.85,!fe.value&&J.value){const T=s.audioStartOffset||0;D.value.currentTime=T+Ce.value%Math.max(1,Y.value-T),D.value.play().catch(()=>{})}else D.value.pause()}function h(T){const b=T.target;b&&b.duration&&!isNaN(b.duration)&&isFinite(b.duration)&&(ve.value=Math.max(1,Math.floor(b.duration)),s.videoStartOffset&&s.videoStartOffset>=ve.value&&i("update:videoStartOffset",Math.max(0,ve.value-2))),V.value&&(V.value.currentTime=Math.min(s.videoStartOffset||0,G.value),J.value&&V.value.play().catch(()=>{}))}function Q(T){const b=T.target;b&&b.duration&&!isNaN(b.duration)&&isFinite(b.duration)&&(Y.value=Math.max(1,Math.floor(b.duration)),s.audioStartOffset&&s.audioStartOffset>=Y.value&&i("update:audioStartOffset",Math.max(0,Y.value-2))),D.value&&(D.value.muted=fe.value,D.value.volume=.85,D.value.currentTime=Math.min(s.audioStartOffset||0,ie.value),J.value&&!fe.value&&D.value.play().catch(()=>{}))}function Me(){if(!V.value)return;const T=Math.min(s.videoStartOffset||0,G.value);V.value.currentTime=T,J.value&&V.value.play().catch(()=>{})}function B(){if(!D.value)return;const T=Math.min(s.audioStartOffset||0,ie.value);D.value.currentTime=T,J.value&&!fe.value&&D.value.play().catch(()=>{})}function Be(){if(!V.value)return;const T=Math.min(s.videoStartOffset||0,G.value),b=ve.value;V.value.currentTime>=b-.25&&(V.value.currentTime=T,J.value&&V.value.play().catch(()=>{}))}function jt(){if(!D.value)return;const T=Math.min(s.audioStartOffset||0,ie.value),b=Y.value;D.value.currentTime>=b-.25&&(D.value.currentTime=T,J.value&&!fe.value&&D.value.play().catch(()=>{}))}function Xe(T){Ce.value=Math.min(Math.max(0,T),$e.value),te=performance.now();const b=Math.min(s.videoStartOffset||0,G.value),ye=Math.min(s.audioStartOffset||0,ie.value);if(V.value){const le=b+T%Math.max(1,ve.value-b);V.value.currentTime=Math.min(le,ve.value-.1)}if(D.value){const le=ye+T%Math.max(1,Y.value-ye);D.value.currentTime=Math.min(le,Y.value-.1)}}function ct(T){const b=Number(T.target.value);Xe(b)}ke(()=>s.selectedVideo,(T,b)=>{b!==void 0&&T!==b&&(i("update:videoStartOffset",0),Ce.value=0,V.value&&(V.value.currentTime=0))}),ke(()=>s.selectedMusic,(T,b)=>{b!==void 0&&T!==b&&(i("update:audioStartOffset",0),D.value&&(D.value.currentTime=0))}),ke(()=>s.videoStartOffset,T=>{const b=Math.min(T||0,G.value);V.value&&(V.value.currentTime=b)}),ke(()=>s.audioStartOffset,T=>{const b=Math.min(T||0,ie.value);D.value&&(D.value.currentTime=b)});function Qe(T){const b=Math.min(T,G.value);i("update:videoStartOffset",b),V.value&&(V.value.currentTime=b)}function Et(T){const b=Math.min(T,ie.value);i("update:audioStartOffset",b),D.value&&(D.value.currentTime=b)}function Rt(){if(V.value){const T=Math.min(Math.floor(V.value.currentTime),G.value);Qe(T)}}function yt(T){const b=Math.floor(T/60),ye=Math.floor(T%60);return`${b.toString().padStart(2,"0")}:${ye.toString().padStart(2,"0")}`}async function Pt(){if(!s.data.caption)return;await ht(s.data.caption)&&(M.value=!0,setTimeout(()=>{M.value=!1},2e3))}return ke(()=>d.value,()=>{const T=s.selectedVideo||"";(ae.value[T]||l[T])&&(ve.value=ae.value[T]||l[T]),Oa(()=>{Xe(0)})}),ke(()=>f.value,()=>{const T=s.selectedMusic||"";(ae.value[T]||l[T])&&(Y.value=ae.value[T]||l[T])}),ke(()=>c.value,T=>{T==="reels"?Oa(()=>{J.value&&N()}):D.value&&D.value.pause()}),(T,b)=>{const ye=cs;return p(),m("div",Pd,[n.isGenerating?(p(),m("div",Ld,[t("div",Vd,[b[8]||(b[8]=t("div",{class:"w-20 h-20 rounded-full border-4 border-sky-500/20 border-t-sky-400 border-r-indigo-500 animate-spin"},null,-1)),t("div",Bd,[k(o(nt),{class:"w-8 h-8 text-sky-400 animate-pulse"})])]),b[10]||(b[10]=t("h3",{class:"text-base font-black text-white tracking-wide mb-1.5"}," Sedang Men-generate Konten... ",-1)),t("p",Jd,[b[9]||(b[9]=t("span",{class:"w-2 h-2 rounded-full bg-sky-400 animate-ping"},null,-1)),t("span",null,x(n.generateStage||"Merender Gambar & Video Reels..."),1)]),b[11]||(b[11]=t("div",{class:"w-64 max-w-full bg-slate-900 border border-slate-800 rounded-full h-2.5 overflow-hidden shadow-inner mb-3"},[t("div",{class:"h-full bg-gradient-to-r from-sky-500 via-indigo-500 to-purple-500 rounded-full animate-pulse w-full"})],-1)),b[12]||(b[12]=t("span",{class:"text-[10px] text-slate-400 font-mono tracking-wider uppercase"}," Multi-Format Studio Engine • Mohon Tunggu Sebentar ",-1))])):I("",!0),t("div",Fd,[t("div",Zd,[t("button",{onClick:b[0]||(b[0]=le=>c.value="feed"),class:j(["px-3 py-1.5 rounded-lg transition",o(c)==="feed"?"bg-sky-500 text-white shadow-md":"text-slate-400 hover:text-white"])}," Feed 4:5 ",2),t("button",{onClick:b[1]||(b[1]=le=>c.value="story"),class:j(["px-3 py-1.5 rounded-lg transition",o(c)==="story"?"bg-indigo-500 text-white shadow-md":"text-slate-400 hover:text-white"])}," Story 9:16 ",2),t("button",{onClick:b[2]||(b[2]=le=>c.value="reels"),class:j(["px-3 py-1.5 rounded-lg transition flex items-center gap-1.5",o(c)==="reels"?"bg-emerald-500 text-white shadow-md":"text-slate-400 hover:text-white"])},[b[13]||(b[13]=t("span",null,"Reels 9:16 (Video)",-1)),o(c)==="reels"&&o(J)?(p(),m("span",Ud)):I("",!0)],2)]),t("div",Hd,[t("div",zd,[t("button",{onClick:we,title:"Zoom Out (-15%)",class:"p-1.5 rounded-lg text-slate-400 hover:text-white hover:bg-slate-800 transition"},[k(o(Ss),{class:"w-3.5 h-3.5"})]),t("button",{onClick:oe,title:"Klik untuk Reset Zoom (100% Fit)",class:"px-2 py-0.5 rounded-lg text-[11px] font-bold text-sky-400 hover:bg-slate-800 hover:text-sky-300 transition font-mono min-w-[42px] text-center"},x(Math.round(o(ee)*100))+"% ",1),t("button",{onClick:q,title:"Zoom In (+15%)",class:"p-1.5 rounded-lg text-slate-400 hover:text-white hover:bg-slate-800 transition"},[k(o(_s),{class:"w-3.5 h-3.5"})]),o(ee)!==1?(p(),m("button",{key:0,onClick:oe,title:"Reset ke Ukuran Pas",class:"p-1.5 rounded-lg text-amber-400 hover:bg-slate-800 transition"},[k(o(qa),{class:"w-3.5 h-3.5"})])):I("",!0)]),o(c)!=="feed"?(p(),m("button",{key:0,onClick:b[3]||(b[3]=le=>C.value=!o(C)),class:j(["inline-flex items-center gap-1.5 px-2.5 py-1.5 rounded-lg border text-xs font-bold transition",o(C)?"bg-amber-500/20 text-amber-300 border-amber-500/50":"bg-slate-950 text-slate-400 border-slate-800"])},[k(o(gs),{class:"w-3.5 h-3.5"}),b[14]||(b[14]=t("span",{class:"hidden sm:inline"},"Safe Zones",-1))],2)):I("",!0)])]),t("div",{onWheel:X,class:"relative flex-1 min-h-0 bg-slate-950/80 canvas-dot-bg border border-slate-800/80 rounded-2xl flex p-4 overflow-auto shadow-inner custom-scrollbar"},[t("div",{class:"m-auto flex-shrink-0 relative transition-all duration-200 ease-out",style:ea({width:`${Math.round(o(pe)*o(ee))}px`,height:`${Math.round(o(W)*o(ee))}px`})},[t("div",{class:"origin-top-left transition-transform duration-200 ease-out absolute top-0 left-0",style:ea({width:`${o(pe)}px`,height:`${o(W)}px`,transform:`scale(${o(ee)})`})},[o(c)==="feed"?(p(),m("div",Gd,[t("div",Kd,[k(ye,{data:n.data,mode:"feed","is-render":!0},null,8,["data"])])])):(p(),m("div",Wd,[o(c)==="reels"?(p(),m("div",qd,[(p(),m("video",{ref_key:"videoElement",ref:V,key:o(d),autoplay:"",muted:"",playsinline:"",class:"w-full h-full object-cover brightness-90 contrast-105",src:o(d),onLoadedmetadata:h,onTimeupdate:Be,onEnded:Me},null,40,Yd)),b[15]||(b[15]=t("div",{class:"absolute inset-0 bg-slate-950/30 backdrop-blur-[0.5px]"},null,-1)),(p(),m("audio",{ref_key:"audioElement",ref:D,key:o(f),src:o(f),muted:o(fe),onLoadedmetadata:Q,onTimeupdate:jt,onEnded:B},null,40,Xd))])):I("",!0),t("div",Qd,[k(ye,{data:n.data,mode:o(c)==="reels"?"overlay":"story","is-render":!0},null,8,["data","mode"])]),o(C)?(p(),m("div",eu,[b[17]||(b[17]=t("div",{class:"h-14 bg-red-500/20 border-b border-dashed border-red-500/60 flex items-center justify-center text-[9px] text-red-200 font-bold tracking-wider"}," TOP SAFE ZONE (Profile & Status) ",-1)),t("div",tu,[o(c)==="reels"?(p(),m("div",au,[...b[16]||(b[16]=[t("span",null,"❤️ Like",-1),t("span",null,"💬 Comm",-1),t("span",null,"↗️ Share",-1)])])):I("",!0)]),b[18]||(b[18]=t("div",{class:"h-20 bg-red-500/20 border-t border-dashed border-red-500/60 flex items-center justify-center text-[9px] text-red-200 font-bold tracking-wider"}," BOTTOM SAFE ZONE (Caption & Audio) ",-1))])):I("",!0)]))],4)],4)],32),o(c)==="reels"?(p(),m("div",su,[t("div",nu,[t("button",{onClick:se,class:"p-2 rounded-xl bg-emerald-600 hover:bg-emerald-500 text-white font-bold transition flex items-center gap-1.5 shadow-md",title:o(J)?"Pause Preview":"Putar Preview"},[o(J)?(p(),Ne(o(bs),{key:0,class:"w-3.5 h-3.5 fill-current"})):(p(),Ne(o(Wa),{key:1,class:"w-3.5 h-3.5 fill-current"})),t("span",iu,x(o(J)?"Pause":"Play"),1)],8,ou),t("div",lu,[t("input",{type:"range",min:"0",max:o($e),step:"0.1",value:o(Ce),onInput:ct,class:"flex-1 h-1.5 bg-slate-950 rounded-lg appearance-none cursor-pointer accent-emerald-500 hover:accent-emerald-400"},null,40,ru),t("span",du,x(yt(o(Ce)))+" / "+x(yt(o($e))),1)]),t("button",{onClick:$,class:j(["px-2.5 py-2 rounded-xl border transition flex items-center gap-1.5 font-bold text-[11px]",o(fe)?"bg-slate-950 text-slate-400 border-slate-800 hover:text-white":"bg-purple-600/40 text-purple-200 border-purple-500/60 shadow-md ring-1 ring-purple-500/40"]),title:o(fe)?"Aktifkan Suara Musik (Unmute)":"Matikan Suara Musik (Mute)"},[o(fe)?(p(),Ne(o(ks),{key:1,class:"w-3.5 h-3.5"})):(p(),Ne(o(ys),{key:0,class:"w-3.5 h-3.5 text-purple-300 animate-pulse"})),t("span",null,x(o(fe)?"Muted":"Audio ON"),1)],10,uu),t("button",{onClick:b[4]||(b[4]=le=>w.value=!o(w)),class:j(["px-2.5 py-2 rounded-xl border text-[11px] font-bold flex items-center gap-1.5 transition",o(w)?"bg-sky-500/20 text-sky-300 border-sky-500/50":"bg-slate-950 text-slate-400 border-slate-800 hover:text-white"]),title:"Atur Detik Awal Video & Musik"},[k(o(sa),{class:"w-3.5 h-3.5 text-sky-400"}),b[19]||(b[19]=t("span",{class:"hidden sm:inline"},"Trim Offset",-1))],2)]),o(w)?(p(),m("div",cu,[t("div",pu,[t("div",fu,[t("span",mu,[k(o(ta),{class:"w-3 h-3"}),z(" Mulai Video: "+x(Math.min(n.videoStartOffset||0,o(G)))+"s / "+x(o(ve))+"s ",1)]),t("button",{onClick:Rt,class:"text-[9px] px-1.5 py-0.5 rounded bg-slate-800 hover:bg-slate-700 text-sky-300 border border-slate-700 transition",title:"Gunakan posisi video saat ini sebagai detik mulai"}," Set Detik Ini ")]),t("input",{type:"range",min:"0",max:o(G),step:"1",value:Math.min(n.videoStartOffset||0,o(G)),onInput:b[5]||(b[5]=le=>Qe(Number(le.target.value))),class:"w-full h-1 bg-slate-900 rounded appearance-none cursor-pointer accent-sky-400"},null,40,xu),t("div",hu," Maksimal offset: "+x(o(G))+" detik (panjang asli video: "+x(o(ve))+"s) ",1)]),t("div",bu,[t("div",gu,[t("span",vu,[k(o(aa),{class:"w-3 h-3"}),z(" Mulai Musik: "+x(Math.min(n.audioStartOffset||0,o(ie)))+"s / "+x(o(Y))+"s ",1)]),b[20]||(b[20]=t("span",{class:"text-[10px] text-slate-500 font-mono"}," (Skip intro) ",-1))]),t("input",{type:"range",min:"0",max:o(ie),step:"1",value:Math.min(n.audioStartOffset||0,o(ie)),onInput:b[6]||(b[6]=le=>Et(Number(le.target.value))),class:"w-full h-1 bg-slate-900 rounded appearance-none cursor-pointer accent-purple-400"},null,40,yu),t("div",ku," Maksimal offset: "+x(o(ie))+" detik (panjang asli musik: "+x(o(Y))+"s) ",1)])])):I("",!0)])):I("",!0),t("div",wu,[t("div",_u,[b[21]||(b[21]=t("span",{class:"font-extrabold text-slate-300 text-[11px]"},"VIRAL CAPTION & HASHTAGS",-1)),t("button",{onClick:Pt,class:"inline-flex items-center gap-1.5 px-3 py-1 bg-slate-800 hover:bg-slate-700 text-sky-300 border border-slate-700 rounded-lg transition text-[11px] font-bold"},[o(M)?(p(),Ne(o(qe),{key:0,class:"w-3.5 h-3.5 text-emerald-400"})):(p(),Ne(o(Ze),{key:1,class:"w-3.5 h-3.5"})),t("span",null,x(o(M)?"Tersalin!":"Copy Caption"),1)])]),t("textarea",{value:n.data.caption,onInput:b[7]||(b[7]=le=>n.data.caption=le.target.value),rows:"2",class:"w-full bg-slate-950 text-slate-200 text-xs p-2 rounded-xl border border-slate-800 focus:outline-none focus:border-sky-500/50 resize-none leading-relaxed font-sans",placeholder:"Caption will appear here..."},null,40,Su)])])}}}),Cu=us(Tu,[["__scopeId","data-v-8f29de3b"]]);var U;(function(n){n.assertEqual=l=>{};function e(l){}n.assertIs=e;function s(l){throw new Error}n.assertNever=s,n.arrayToEnum=l=>{const d={};for(const f of l)d[f]=f;return d},n.getValidEnumValues=l=>{const d=n.objectKeys(l).filter(c=>typeof l[l[c]]!="number"),f={};for(const c of d)f[c]=l[c];return n.objectValues(f)},n.objectValues=l=>n.objectKeys(l).map(function(d){return l[d]}),n.objectKeys=typeof Object.keys=="function"?l=>Object.keys(l):l=>{const d=[];for(const f in l)Object.prototype.hasOwnProperty.call(l,f)&&d.push(f);return d},n.find=(l,d)=>{for(const f of l)if(d(f))return f},n.isInteger=typeof Number.isInteger=="function"?l=>Number.isInteger(l):l=>typeof l=="number"&&Number.isFinite(l)&&Math.floor(l)===l;function i(l,d=" | "){return l.map(f=>typeof f=="string"?`'${f}'`:f).join(d)}n.joinValues=i,n.jsonStringifyReplacer=(l,d)=>typeof d=="bigint"?d.toString():d})(U||(U={}));var Da;(function(n){n.mergeShapes=(e,s)=>({...e,...s})})(Da||(Da={}));const O=U.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Ue=n=>{switch(typeof n){case"undefined":return O.undefined;case"string":return O.string;case"number":return Number.isNaN(n)?O.nan:O.number;case"boolean":return O.boolean;case"function":return O.function;case"bigint":return O.bigint;case"symbol":return O.symbol;case"object":return Array.isArray(n)?O.array:n===null?O.null:n.then&&typeof n.then=="function"&&n.catch&&typeof n.catch=="function"?O.promise:typeof Map<"u"&&n instanceof Map?O.map:typeof Set<"u"&&n instanceof Set?O.set:typeof Date<"u"&&n instanceof Date?O.date:O.object;default:return O.unknown}},g=U.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class Ve extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=i=>{this.issues=[...this.issues,i]},this.addIssues=(i=[])=>{this.issues=[...this.issues,...i]};const s=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,s):this.__proto__=s,this.name="ZodError",this.issues=e}format(e){const s=e||function(d){return d.message},i={_errors:[]},l=d=>{for(const f of d.issues)if(f.code==="invalid_union")f.unionErrors.map(l);else if(f.code==="invalid_return_type")l(f.returnTypeError);else if(f.code==="invalid_arguments")l(f.argumentsError);else if(f.path.length===0)i._errors.push(s(f));else{let c=i,C=0;for(;C<f.path.length;){const w=f.path[C];C===f.path.length-1?(c[w]=c[w]||{_errors:[]},c[w]._errors.push(s(f))):c[w]=c[w]||{_errors:[]},c=c[w],C++}}};return l(this),i}static assert(e){if(!(e instanceof Ve))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,U.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=s=>s.message){const s={},i=[];for(const l of this.issues)if(l.path.length>0){const d=l.path[0];s[d]=s[d]||[],s[d].push(e(l))}else i.push(e(l));return{formErrors:i,fieldErrors:s}}get formErrors(){return this.flatten()}}Ve.create=n=>new Ve(n);const na=(n,e)=>{let s;switch(n.code){case g.invalid_type:n.received===O.undefined?s="Required":s=`Expected ${n.expected}, received ${n.received}`;break;case g.invalid_literal:s=`Invalid literal value, expected ${JSON.stringify(n.expected,U.jsonStringifyReplacer)}`;break;case g.unrecognized_keys:s=`Unrecognized key(s) in object: ${U.joinValues(n.keys,", ")}`;break;case g.invalid_union:s="Invalid input";break;case g.invalid_union_discriminator:s=`Invalid discriminator value. Expected ${U.joinValues(n.options)}`;break;case g.invalid_enum_value:s=`Invalid enum value. Expected ${U.joinValues(n.options)}, received '${n.received}'`;break;case g.invalid_arguments:s="Invalid function arguments";break;case g.invalid_return_type:s="Invalid function return type";break;case g.invalid_date:s="Invalid date";break;case g.invalid_string:typeof n.validation=="object"?"includes"in n.validation?(s=`Invalid input: must include "${n.validation.includes}"`,typeof n.validation.position=="number"&&(s=`${s} at one or more positions greater than or equal to ${n.validation.position}`)):"startsWith"in n.validation?s=`Invalid input: must start with "${n.validation.startsWith}"`:"endsWith"in n.validation?s=`Invalid input: must end with "${n.validation.endsWith}"`:U.assertNever(n.validation):n.validation!=="regex"?s=`Invalid ${n.validation}`:s="Invalid";break;case g.too_small:n.type==="array"?s=`Array must contain ${n.exact?"exactly":n.inclusive?"at least":"more than"} ${n.minimum} element(s)`:n.type==="string"?s=`String must contain ${n.exact?"exactly":n.inclusive?"at least":"over"} ${n.minimum} character(s)`:n.type==="number"?s=`Number must be ${n.exact?"exactly equal to ":n.inclusive?"greater than or equal to ":"greater than "}${n.minimum}`:n.type==="bigint"?s=`Number must be ${n.exact?"exactly equal to ":n.inclusive?"greater than or equal to ":"greater than "}${n.minimum}`:n.type==="date"?s=`Date must be ${n.exact?"exactly equal to ":n.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(n.minimum))}`:s="Invalid input";break;case g.too_big:n.type==="array"?s=`Array must contain ${n.exact?"exactly":n.inclusive?"at most":"less than"} ${n.maximum} element(s)`:n.type==="string"?s=`String must contain ${n.exact?"exactly":n.inclusive?"at most":"under"} ${n.maximum} character(s)`:n.type==="number"?s=`Number must be ${n.exact?"exactly":n.inclusive?"less than or equal to":"less than"} ${n.maximum}`:n.type==="bigint"?s=`BigInt must be ${n.exact?"exactly":n.inclusive?"less than or equal to":"less than"} ${n.maximum}`:n.type==="date"?s=`Date must be ${n.exact?"exactly":n.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(n.maximum))}`:s="Invalid input";break;case g.custom:s="Invalid input";break;case g.invalid_intersection_types:s="Intersection results could not be merged";break;case g.not_multiple_of:s=`Number must be a multiple of ${n.multipleOf}`;break;case g.not_finite:s="Number must be finite";break;default:s=e.defaultError,U.assertNever(n)}return{message:s}};let Ou=na;function Au(){return Ou}const Nu=n=>{const{data:e,path:s,errorMaps:i,issueData:l}=n,d=[...s,...l.path||[]],f={...l,path:d};if(l.message!==void 0)return{...l,path:d,message:l.message};let c="";const C=i.filter(w=>!!w).slice().reverse();for(const w of C)c=w(f,{data:e,defaultError:c}).message;return{...l,path:d,message:c}};function _(n,e){const s=Au(),i=Nu({issueData:e,data:n.data,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,s,s===na?void 0:na].filter(l=>!!l)});n.common.issues.push(i)}class Te{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,s){const i=[];for(const l of s){if(l.status==="aborted")return R;l.status==="dirty"&&e.dirty(),i.push(l.value)}return{status:e.value,value:i}}static async mergeObjectAsync(e,s){const i=[];for(const l of s){const d=await l.key,f=await l.value;i.push({key:d,value:f})}return Te.mergeObjectSync(e,i)}static mergeObjectSync(e,s){const i={};for(const l of s){const{key:d,value:f}=l;if(d.status==="aborted"||f.status==="aborted")return R;d.status==="dirty"&&e.dirty(),f.status==="dirty"&&e.dirty(),d.value!=="__proto__"&&(typeof f.value<"u"||l.alwaysSet)&&(i[d.value]=f.value)}return{status:e.value,value:i}}}const R=Object.freeze({status:"aborted"}),bt=n=>({status:"dirty",value:n}),Ie=n=>({status:"valid",value:n}),ja=n=>n.status==="aborted",Ea=n=>n.status==="dirty",it=n=>n.status==="valid",At=n=>typeof Promise<"u"&&n instanceof Promise;var A;(function(n){n.errToObj=e=>typeof e=="string"?{message:e}:e||{},n.toString=e=>typeof e=="string"?e:e?.message})(A||(A={}));class Pe{constructor(e,s,i,l){this._cachedPath=[],this.parent=e,this.data=s,this._path=i,this._key=l}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const Ra=(n,e)=>{if(it(e))return{success:!0,data:e.value};if(!n.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const s=new Ve(n.common.issues);return this._error=s,this._error}}};function L(n){if(!n)return{};const{errorMap:e,invalid_type_error:s,required_error:i,description:l}=n;if(e&&(s||i))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:l}:{errorMap:(f,c)=>{const{message:C}=n;return f.code==="invalid_enum_value"?{message:C??c.defaultError}:typeof c.data>"u"?{message:C??i??c.defaultError}:f.code!=="invalid_type"?{message:c.defaultError}:{message:C??s??c.defaultError}},description:l}}class F{get description(){return this._def.description}_getType(e){return Ue(e.data)}_getOrReturnCtx(e,s){return s||{common:e.parent.common,data:e.data,parsedType:Ue(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Te,ctx:{common:e.parent.common,data:e.data,parsedType:Ue(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const s=this._parse(e);if(At(s))throw new Error("Synchronous parse encountered promise.");return s}_parseAsync(e){const s=this._parse(e);return Promise.resolve(s)}parse(e,s){const i=this.safeParse(e,s);if(i.success)return i.data;throw i.error}safeParse(e,s){const i={common:{issues:[],async:s?.async??!1,contextualErrorMap:s?.errorMap},path:s?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Ue(e)},l=this._parseSync({data:e,path:i.path,parent:i});return Ra(i,l)}"~validate"(e){const s={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Ue(e)};if(!this["~standard"].async)try{const i=this._parseSync({data:e,path:[],parent:s});return it(i)?{value:i.value}:{issues:s.common.issues}}catch(i){i?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),s.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:s}).then(i=>it(i)?{value:i.value}:{issues:s.common.issues})}async parseAsync(e,s){const i=await this.safeParseAsync(e,s);if(i.success)return i.data;throw i.error}async safeParseAsync(e,s){const i={common:{issues:[],contextualErrorMap:s?.errorMap,async:!0},path:s?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Ue(e)},l=this._parse({data:e,path:i.path,parent:i}),d=await(At(l)?l:Promise.resolve(l));return Ra(i,d)}refine(e,s){const i=l=>typeof s=="string"||typeof s>"u"?{message:s}:typeof s=="function"?s(l):s;return this._refinement((l,d)=>{const f=e(l),c=()=>d.addIssue({code:g.custom,...i(l)});return typeof Promise<"u"&&f instanceof Promise?f.then(C=>C?!0:(c(),!1)):f?!0:(c(),!1)})}refinement(e,s){return this._refinement((i,l)=>e(i)?!0:(l.addIssue(typeof s=="function"?s(i,l):s),!1))}_refinement(e){return new dt({schema:this,typeName:E.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:s=>this["~validate"](s)}}optional(){return He.create(this,this._def)}nullable(){return ut.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Re.create(this)}promise(){return Dt.create(this,this._def)}or(e){return It.create([this,e],this._def)}and(e){return Mt.create(this,e,this._def)}transform(e){return new dt({...L(this._def),schema:this,typeName:E.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const s=typeof e=="function"?e:()=>e;return new la({...L(this._def),innerType:this,defaultValue:s,typeName:E.ZodDefault})}brand(){return new Xu({typeName:E.ZodBranded,type:this,...L(this._def)})}catch(e){const s=typeof e=="function"?e:()=>e;return new ra({...L(this._def),innerType:this,catchValue:s,typeName:E.ZodCatch})}describe(e){const s=this.constructor;return new s({...this._def,description:e})}pipe(e){return pa.create(this,e)}readonly(){return da.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const Iu=/^c[^\s-]{8,}$/i,Mu=/^[0-9a-z]+$/,$u=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Du=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,ju=/^[a-z0-9_-]{21}$/i,Eu=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Ru=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,Pu=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Lu="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let Xt;const Vu=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Bu=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,Ju=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,Fu=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Zu=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Uu=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Ya="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",Hu=new RegExp(`^${Ya}$`);function Xa(n){let e="[0-5]\\d";n.precision?e=`${e}\\.\\d{${n.precision}}`:n.precision==null&&(e=`${e}(\\.\\d+)?`);const s=n.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${s}`}function zu(n){return new RegExp(`^${Xa(n)}$`)}function Gu(n){let e=`${Ya}T${Xa(n)}`;const s=[];return s.push(n.local?"Z?":"Z"),n.offset&&s.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${s.join("|")})`,new RegExp(`^${e}$`)}function Ku(n,e){return!!((e==="v4"||!e)&&Vu.test(n)||(e==="v6"||!e)&&Ju.test(n))}function Wu(n,e){if(!Eu.test(n))return!1;try{const[s]=n.split(".");if(!s)return!1;const i=s.replace(/-/g,"+").replace(/_/g,"/").padEnd(s.length+(4-s.length%4)%4,"="),l=JSON.parse(atob(i));return!(typeof l!="object"||l===null||"typ"in l&&l?.typ!=="JWT"||!l.alg||e&&l.alg!==e)}catch{return!1}}function qu(n,e){return!!((e==="v4"||!e)&&Bu.test(n)||(e==="v6"||!e)&&Fu.test(n))}class Le extends F{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==O.string){const d=this._getOrReturnCtx(e);return _(d,{code:g.invalid_type,expected:O.string,received:d.parsedType}),R}const i=new Te;let l;for(const d of this._def.checks)if(d.kind==="min")e.data.length<d.value&&(l=this._getOrReturnCtx(e,l),_(l,{code:g.too_small,minimum:d.value,type:"string",inclusive:!0,exact:!1,message:d.message}),i.dirty());else if(d.kind==="max")e.data.length>d.value&&(l=this._getOrReturnCtx(e,l),_(l,{code:g.too_big,maximum:d.value,type:"string",inclusive:!0,exact:!1,message:d.message}),i.dirty());else if(d.kind==="length"){const f=e.data.length>d.value,c=e.data.length<d.value;(f||c)&&(l=this._getOrReturnCtx(e,l),f?_(l,{code:g.too_big,maximum:d.value,type:"string",inclusive:!0,exact:!0,message:d.message}):c&&_(l,{code:g.too_small,minimum:d.value,type:"string",inclusive:!0,exact:!0,message:d.message}),i.dirty())}else if(d.kind==="email")Pu.test(e.data)||(l=this._getOrReturnCtx(e,l),_(l,{validation:"email",code:g.invalid_string,message:d.message}),i.dirty());else if(d.kind==="emoji")Xt||(Xt=new RegExp(Lu,"u")),Xt.test(e.data)||(l=this._getOrReturnCtx(e,l),_(l,{validation:"emoji",code:g.invalid_string,message:d.message}),i.dirty());else if(d.kind==="uuid")Du.test(e.data)||(l=this._getOrReturnCtx(e,l),_(l,{validation:"uuid",code:g.invalid_string,message:d.message}),i.dirty());else if(d.kind==="nanoid")ju.test(e.data)||(l=this._getOrReturnCtx(e,l),_(l,{validation:"nanoid",code:g.invalid_string,message:d.message}),i.dirty());else if(d.kind==="cuid")Iu.test(e.data)||(l=this._getOrReturnCtx(e,l),_(l,{validation:"cuid",code:g.invalid_string,message:d.message}),i.dirty());else if(d.kind==="cuid2")Mu.test(e.data)||(l=this._getOrReturnCtx(e,l),_(l,{validation:"cuid2",code:g.invalid_string,message:d.message}),i.dirty());else if(d.kind==="ulid")$u.test(e.data)||(l=this._getOrReturnCtx(e,l),_(l,{validation:"ulid",code:g.invalid_string,message:d.message}),i.dirty());else if(d.kind==="url")try{new URL(e.data)}catch{l=this._getOrReturnCtx(e,l),_(l,{validation:"url",code:g.invalid_string,message:d.message}),i.dirty()}else d.kind==="regex"?(d.regex.lastIndex=0,d.regex.test(e.data)||(l=this._getOrReturnCtx(e,l),_(l,{validation:"regex",code:g.invalid_string,message:d.message}),i.dirty())):d.kind==="trim"?e.data=e.data.trim():d.kind==="includes"?e.data.includes(d.value,d.position)||(l=this._getOrReturnCtx(e,l),_(l,{code:g.invalid_string,validation:{includes:d.value,position:d.position},message:d.message}),i.dirty()):d.kind==="toLowerCase"?e.data=e.data.toLowerCase():d.kind==="toUpperCase"?e.data=e.data.toUpperCase():d.kind==="startsWith"?e.data.startsWith(d.value)||(l=this._getOrReturnCtx(e,l),_(l,{code:g.invalid_string,validation:{startsWith:d.value},message:d.message}),i.dirty()):d.kind==="endsWith"?e.data.endsWith(d.value)||(l=this._getOrReturnCtx(e,l),_(l,{code:g.invalid_string,validation:{endsWith:d.value},message:d.message}),i.dirty()):d.kind==="datetime"?Gu(d).test(e.data)||(l=this._getOrReturnCtx(e,l),_(l,{code:g.invalid_string,validation:"datetime",message:d.message}),i.dirty()):d.kind==="date"?Hu.test(e.data)||(l=this._getOrReturnCtx(e,l),_(l,{code:g.invalid_string,validation:"date",message:d.message}),i.dirty()):d.kind==="time"?zu(d).test(e.data)||(l=this._getOrReturnCtx(e,l),_(l,{code:g.invalid_string,validation:"time",message:d.message}),i.dirty()):d.kind==="duration"?Ru.test(e.data)||(l=this._getOrReturnCtx(e,l),_(l,{validation:"duration",code:g.invalid_string,message:d.message}),i.dirty()):d.kind==="ip"?Ku(e.data,d.version)||(l=this._getOrReturnCtx(e,l),_(l,{validation:"ip",code:g.invalid_string,message:d.message}),i.dirty()):d.kind==="jwt"?Wu(e.data,d.alg)||(l=this._getOrReturnCtx(e,l),_(l,{validation:"jwt",code:g.invalid_string,message:d.message}),i.dirty()):d.kind==="cidr"?qu(e.data,d.version)||(l=this._getOrReturnCtx(e,l),_(l,{validation:"cidr",code:g.invalid_string,message:d.message}),i.dirty()):d.kind==="base64"?Zu.test(e.data)||(l=this._getOrReturnCtx(e,l),_(l,{validation:"base64",code:g.invalid_string,message:d.message}),i.dirty()):d.kind==="base64url"?Uu.test(e.data)||(l=this._getOrReturnCtx(e,l),_(l,{validation:"base64url",code:g.invalid_string,message:d.message}),i.dirty()):U.assertNever(d);return{status:i.value,value:e.data}}_regex(e,s,i){return this.refinement(l=>e.test(l),{validation:s,code:g.invalid_string,...A.errToObj(i)})}_addCheck(e){return new Le({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...A.errToObj(e)})}url(e){return this._addCheck({kind:"url",...A.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...A.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...A.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...A.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...A.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...A.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...A.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...A.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...A.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...A.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...A.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...A.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...A.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...A.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...A.errToObj(e)})}regex(e,s){return this._addCheck({kind:"regex",regex:e,...A.errToObj(s)})}includes(e,s){return this._addCheck({kind:"includes",value:e,position:s?.position,...A.errToObj(s?.message)})}startsWith(e,s){return this._addCheck({kind:"startsWith",value:e,...A.errToObj(s)})}endsWith(e,s){return this._addCheck({kind:"endsWith",value:e,...A.errToObj(s)})}min(e,s){return this._addCheck({kind:"min",value:e,...A.errToObj(s)})}max(e,s){return this._addCheck({kind:"max",value:e,...A.errToObj(s)})}length(e,s){return this._addCheck({kind:"length",value:e,...A.errToObj(s)})}nonempty(e){return this.min(1,A.errToObj(e))}trim(){return new Le({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new Le({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new Le({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(const s of this._def.checks)s.kind==="min"&&(e===null||s.value>e)&&(e=s.value);return e}get maxLength(){let e=null;for(const s of this._def.checks)s.kind==="max"&&(e===null||s.value<e)&&(e=s.value);return e}}Le.create=n=>new Le({checks:[],typeName:E.ZodString,coerce:n?.coerce??!1,...L(n)});function Yu(n,e){const s=(n.toString().split(".")[1]||"").length,i=(e.toString().split(".")[1]||"").length,l=s>i?s:i,d=Number.parseInt(n.toFixed(l).replace(".","")),f=Number.parseInt(e.toFixed(l).replace(".",""));return d%f/10**l}class lt extends F{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==O.number){const d=this._getOrReturnCtx(e);return _(d,{code:g.invalid_type,expected:O.number,received:d.parsedType}),R}let i;const l=new Te;for(const d of this._def.checks)d.kind==="int"?U.isInteger(e.data)||(i=this._getOrReturnCtx(e,i),_(i,{code:g.invalid_type,expected:"integer",received:"float",message:d.message}),l.dirty()):d.kind==="min"?(d.inclusive?e.data<d.value:e.data<=d.value)&&(i=this._getOrReturnCtx(e,i),_(i,{code:g.too_small,minimum:d.value,type:"number",inclusive:d.inclusive,exact:!1,message:d.message}),l.dirty()):d.kind==="max"?(d.inclusive?e.data>d.value:e.data>=d.value)&&(i=this._getOrReturnCtx(e,i),_(i,{code:g.too_big,maximum:d.value,type:"number",inclusive:d.inclusive,exact:!1,message:d.message}),l.dirty()):d.kind==="multipleOf"?Yu(e.data,d.value)!==0&&(i=this._getOrReturnCtx(e,i),_(i,{code:g.not_multiple_of,multipleOf:d.value,message:d.message}),l.dirty()):d.kind==="finite"?Number.isFinite(e.data)||(i=this._getOrReturnCtx(e,i),_(i,{code:g.not_finite,message:d.message}),l.dirty()):U.assertNever(d);return{status:l.value,value:e.data}}gte(e,s){return this.setLimit("min",e,!0,A.toString(s))}gt(e,s){return this.setLimit("min",e,!1,A.toString(s))}lte(e,s){return this.setLimit("max",e,!0,A.toString(s))}lt(e,s){return this.setLimit("max",e,!1,A.toString(s))}setLimit(e,s,i,l){return new lt({...this._def,checks:[...this._def.checks,{kind:e,value:s,inclusive:i,message:A.toString(l)}]})}_addCheck(e){return new lt({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:A.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:A.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:A.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:A.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:A.toString(e)})}multipleOf(e,s){return this._addCheck({kind:"multipleOf",value:e,message:A.toString(s)})}finite(e){return this._addCheck({kind:"finite",message:A.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:A.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:A.toString(e)})}get minValue(){let e=null;for(const s of this._def.checks)s.kind==="min"&&(e===null||s.value>e)&&(e=s.value);return e}get maxValue(){let e=null;for(const s of this._def.checks)s.kind==="max"&&(e===null||s.value<e)&&(e=s.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&U.isInteger(e.value))}get isFinite(){let e=null,s=null;for(const i of this._def.checks){if(i.kind==="finite"||i.kind==="int"||i.kind==="multipleOf")return!0;i.kind==="min"?(s===null||i.value>s)&&(s=i.value):i.kind==="max"&&(e===null||i.value<e)&&(e=i.value)}return Number.isFinite(s)&&Number.isFinite(e)}}lt.create=n=>new lt({checks:[],typeName:E.ZodNumber,coerce:n?.coerce||!1,...L(n)});class gt extends F{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==O.bigint)return this._getInvalidInput(e);let i;const l=new Te;for(const d of this._def.checks)d.kind==="min"?(d.inclusive?e.data<d.value:e.data<=d.value)&&(i=this._getOrReturnCtx(e,i),_(i,{code:g.too_small,type:"bigint",minimum:d.value,inclusive:d.inclusive,message:d.message}),l.dirty()):d.kind==="max"?(d.inclusive?e.data>d.value:e.data>=d.value)&&(i=this._getOrReturnCtx(e,i),_(i,{code:g.too_big,type:"bigint",maximum:d.value,inclusive:d.inclusive,message:d.message}),l.dirty()):d.kind==="multipleOf"?e.data%d.value!==BigInt(0)&&(i=this._getOrReturnCtx(e,i),_(i,{code:g.not_multiple_of,multipleOf:d.value,message:d.message}),l.dirty()):U.assertNever(d);return{status:l.value,value:e.data}}_getInvalidInput(e){const s=this._getOrReturnCtx(e);return _(s,{code:g.invalid_type,expected:O.bigint,received:s.parsedType}),R}gte(e,s){return this.setLimit("min",e,!0,A.toString(s))}gt(e,s){return this.setLimit("min",e,!1,A.toString(s))}lte(e,s){return this.setLimit("max",e,!0,A.toString(s))}lt(e,s){return this.setLimit("max",e,!1,A.toString(s))}setLimit(e,s,i,l){return new gt({...this._def,checks:[...this._def.checks,{kind:e,value:s,inclusive:i,message:A.toString(l)}]})}_addCheck(e){return new gt({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:A.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:A.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:A.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:A.toString(e)})}multipleOf(e,s){return this._addCheck({kind:"multipleOf",value:e,message:A.toString(s)})}get minValue(){let e=null;for(const s of this._def.checks)s.kind==="min"&&(e===null||s.value>e)&&(e=s.value);return e}get maxValue(){let e=null;for(const s of this._def.checks)s.kind==="max"&&(e===null||s.value<e)&&(e=s.value);return e}}gt.create=n=>new gt({checks:[],typeName:E.ZodBigInt,coerce:n?.coerce??!1,...L(n)});class Pa extends F{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==O.boolean){const i=this._getOrReturnCtx(e);return _(i,{code:g.invalid_type,expected:O.boolean,received:i.parsedType}),R}return Ie(e.data)}}Pa.create=n=>new Pa({typeName:E.ZodBoolean,coerce:n?.coerce||!1,...L(n)});class Nt extends F{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==O.date){const d=this._getOrReturnCtx(e);return _(d,{code:g.invalid_type,expected:O.date,received:d.parsedType}),R}if(Number.isNaN(e.data.getTime())){const d=this._getOrReturnCtx(e);return _(d,{code:g.invalid_date}),R}const i=new Te;let l;for(const d of this._def.checks)d.kind==="min"?e.data.getTime()<d.value&&(l=this._getOrReturnCtx(e,l),_(l,{code:g.too_small,message:d.message,inclusive:!0,exact:!1,minimum:d.value,type:"date"}),i.dirty()):d.kind==="max"?e.data.getTime()>d.value&&(l=this._getOrReturnCtx(e,l),_(l,{code:g.too_big,message:d.message,inclusive:!0,exact:!1,maximum:d.value,type:"date"}),i.dirty()):U.assertNever(d);return{status:i.value,value:new Date(e.data.getTime())}}_addCheck(e){return new Nt({...this._def,checks:[...this._def.checks,e]})}min(e,s){return this._addCheck({kind:"min",value:e.getTime(),message:A.toString(s)})}max(e,s){return this._addCheck({kind:"max",value:e.getTime(),message:A.toString(s)})}get minDate(){let e=null;for(const s of this._def.checks)s.kind==="min"&&(e===null||s.value>e)&&(e=s.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const s of this._def.checks)s.kind==="max"&&(e===null||s.value<e)&&(e=s.value);return e!=null?new Date(e):null}}Nt.create=n=>new Nt({checks:[],coerce:n?.coerce||!1,typeName:E.ZodDate,...L(n)});class La extends F{_parse(e){if(this._getType(e)!==O.symbol){const i=this._getOrReturnCtx(e);return _(i,{code:g.invalid_type,expected:O.symbol,received:i.parsedType}),R}return Ie(e.data)}}La.create=n=>new La({typeName:E.ZodSymbol,...L(n)});class Va extends F{_parse(e){if(this._getType(e)!==O.undefined){const i=this._getOrReturnCtx(e);return _(i,{code:g.invalid_type,expected:O.undefined,received:i.parsedType}),R}return Ie(e.data)}}Va.create=n=>new Va({typeName:E.ZodUndefined,...L(n)});class Ba extends F{_parse(e){if(this._getType(e)!==O.null){const i=this._getOrReturnCtx(e);return _(i,{code:g.invalid_type,expected:O.null,received:i.parsedType}),R}return Ie(e.data)}}Ba.create=n=>new Ba({typeName:E.ZodNull,...L(n)});class oa extends F{constructor(){super(...arguments),this._any=!0}_parse(e){return Ie(e.data)}}oa.create=n=>new oa({typeName:E.ZodAny,...L(n)});class Ja extends F{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Ie(e.data)}}Ja.create=n=>new Ja({typeName:E.ZodUnknown,...L(n)});class ze extends F{_parse(e){const s=this._getOrReturnCtx(e);return _(s,{code:g.invalid_type,expected:O.never,received:s.parsedType}),R}}ze.create=n=>new ze({typeName:E.ZodNever,...L(n)});class Fa extends F{_parse(e){if(this._getType(e)!==O.undefined){const i=this._getOrReturnCtx(e);return _(i,{code:g.invalid_type,expected:O.void,received:i.parsedType}),R}return Ie(e.data)}}Fa.create=n=>new Fa({typeName:E.ZodVoid,...L(n)});class Re extends F{_parse(e){const{ctx:s,status:i}=this._processInputParams(e),l=this._def;if(s.parsedType!==O.array)return _(s,{code:g.invalid_type,expected:O.array,received:s.parsedType}),R;if(l.exactLength!==null){const f=s.data.length>l.exactLength.value,c=s.data.length<l.exactLength.value;(f||c)&&(_(s,{code:f?g.too_big:g.too_small,minimum:c?l.exactLength.value:void 0,maximum:f?l.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:l.exactLength.message}),i.dirty())}if(l.minLength!==null&&s.data.length<l.minLength.value&&(_(s,{code:g.too_small,minimum:l.minLength.value,type:"array",inclusive:!0,exact:!1,message:l.minLength.message}),i.dirty()),l.maxLength!==null&&s.data.length>l.maxLength.value&&(_(s,{code:g.too_big,maximum:l.maxLength.value,type:"array",inclusive:!0,exact:!1,message:l.maxLength.message}),i.dirty()),s.common.async)return Promise.all([...s.data].map((f,c)=>l.type._parseAsync(new Pe(s,f,s.path,c)))).then(f=>Te.mergeArray(i,f));const d=[...s.data].map((f,c)=>l.type._parseSync(new Pe(s,f,s.path,c)));return Te.mergeArray(i,d)}get element(){return this._def.type}min(e,s){return new Re({...this._def,minLength:{value:e,message:A.toString(s)}})}max(e,s){return new Re({...this._def,maxLength:{value:e,message:A.toString(s)}})}length(e,s){return new Re({...this._def,exactLength:{value:e,message:A.toString(s)}})}nonempty(e){return this.min(1,e)}}Re.create=(n,e)=>new Re({type:n,minLength:null,maxLength:null,exactLength:null,typeName:E.ZodArray,...L(e)});function ot(n){if(n instanceof re){const e={};for(const s in n.shape){const i=n.shape[s];e[s]=He.create(ot(i))}return new re({...n._def,shape:()=>e})}else return n instanceof Re?new Re({...n._def,type:ot(n.element)}):n instanceof He?He.create(ot(n.unwrap())):n instanceof ut?ut.create(ot(n.unwrap())):n instanceof Ye?Ye.create(n.items.map(e=>ot(e))):n}class re extends F{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const e=this._def.shape(),s=U.objectKeys(e);return this._cached={shape:e,keys:s},this._cached}_parse(e){if(this._getType(e)!==O.object){const w=this._getOrReturnCtx(e);return _(w,{code:g.invalid_type,expected:O.object,received:w.parsedType}),R}const{status:i,ctx:l}=this._processInputParams(e),{shape:d,keys:f}=this._getCached(),c=[];if(!(this._def.catchall instanceof ze&&this._def.unknownKeys==="strip"))for(const w in l.data)f.includes(w)||c.push(w);const C=[];for(const w of f){const M=d[w],ee=l.data[w];C.push({key:{status:"valid",value:w},value:M._parse(new Pe(l,ee,l.path,w)),alwaysSet:w in l.data})}if(this._def.catchall instanceof ze){const w=this._def.unknownKeys;if(w==="passthrough")for(const M of c)C.push({key:{status:"valid",value:M},value:{status:"valid",value:l.data[M]}});else if(w==="strict")c.length>0&&(_(l,{code:g.unrecognized_keys,keys:c}),i.dirty());else if(w!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const w=this._def.catchall;for(const M of c){const ee=l.data[M];C.push({key:{status:"valid",value:M},value:w._parse(new Pe(l,ee,l.path,M)),alwaysSet:M in l.data})}}return l.common.async?Promise.resolve().then(async()=>{const w=[];for(const M of C){const ee=await M.key,pe=await M.value;w.push({key:ee,value:pe,alwaysSet:M.alwaysSet})}return w}).then(w=>Te.mergeObjectSync(i,w)):Te.mergeObjectSync(i,C)}get shape(){return this._def.shape()}strict(e){return A.errToObj,new re({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(s,i)=>{const l=this._def.errorMap?.(s,i).message??i.defaultError;return s.code==="unrecognized_keys"?{message:A.errToObj(e).message??l}:{message:l}}}:{}})}strip(){return new re({...this._def,unknownKeys:"strip"})}passthrough(){return new re({...this._def,unknownKeys:"passthrough"})}extend(e){return new re({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new re({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:E.ZodObject})}setKey(e,s){return this.augment({[e]:s})}catchall(e){return new re({...this._def,catchall:e})}pick(e){const s={};for(const i of U.objectKeys(e))e[i]&&this.shape[i]&&(s[i]=this.shape[i]);return new re({...this._def,shape:()=>s})}omit(e){const s={};for(const i of U.objectKeys(this.shape))e[i]||(s[i]=this.shape[i]);return new re({...this._def,shape:()=>s})}deepPartial(){return ot(this)}partial(e){const s={};for(const i of U.objectKeys(this.shape)){const l=this.shape[i];e&&!e[i]?s[i]=l:s[i]=l.optional()}return new re({...this._def,shape:()=>s})}required(e){const s={};for(const i of U.objectKeys(this.shape))if(e&&!e[i])s[i]=this.shape[i];else{let d=this.shape[i];for(;d instanceof He;)d=d._def.innerType;s[i]=d}return new re({...this._def,shape:()=>s})}keyof(){return Qa(U.objectKeys(this.shape))}}re.create=(n,e)=>new re({shape:()=>n,unknownKeys:"strip",catchall:ze.create(),typeName:E.ZodObject,...L(e)});re.strictCreate=(n,e)=>new re({shape:()=>n,unknownKeys:"strict",catchall:ze.create(),typeName:E.ZodObject,...L(e)});re.lazycreate=(n,e)=>new re({shape:n,unknownKeys:"strip",catchall:ze.create(),typeName:E.ZodObject,...L(e)});class It extends F{_parse(e){const{ctx:s}=this._processInputParams(e),i=this._def.options;function l(d){for(const c of d)if(c.result.status==="valid")return c.result;for(const c of d)if(c.result.status==="dirty")return s.common.issues.push(...c.ctx.common.issues),c.result;const f=d.map(c=>new Ve(c.ctx.common.issues));return _(s,{code:g.invalid_union,unionErrors:f}),R}if(s.common.async)return Promise.all(i.map(async d=>{const f={...s,common:{...s.common,issues:[]},parent:null};return{result:await d._parseAsync({data:s.data,path:s.path,parent:f}),ctx:f}})).then(l);{let d;const f=[];for(const C of i){const w={...s,common:{...s.common,issues:[]},parent:null},M=C._parseSync({data:s.data,path:s.path,parent:w});if(M.status==="valid")return M;M.status==="dirty"&&!d&&(d={result:M,ctx:w}),w.common.issues.length&&f.push(w.common.issues)}if(d)return s.common.issues.push(...d.ctx.common.issues),d.result;const c=f.map(C=>new Ve(C));return _(s,{code:g.invalid_union,unionErrors:c}),R}}get options(){return this._def.options}}It.create=(n,e)=>new It({options:n,typeName:E.ZodUnion,...L(e)});function ia(n,e){const s=Ue(n),i=Ue(e);if(n===e)return{valid:!0,data:n};if(s===O.object&&i===O.object){const l=U.objectKeys(e),d=U.objectKeys(n).filter(c=>l.indexOf(c)!==-1),f={...n,...e};for(const c of d){const C=ia(n[c],e[c]);if(!C.valid)return{valid:!1};f[c]=C.data}return{valid:!0,data:f}}else if(s===O.array&&i===O.array){if(n.length!==e.length)return{valid:!1};const l=[];for(let d=0;d<n.length;d++){const f=n[d],c=e[d],C=ia(f,c);if(!C.valid)return{valid:!1};l.push(C.data)}return{valid:!0,data:l}}else return s===O.date&&i===O.date&&+n==+e?{valid:!0,data:n}:{valid:!1}}class Mt extends F{_parse(e){const{status:s,ctx:i}=this._processInputParams(e),l=(d,f)=>{if(ja(d)||ja(f))return R;const c=ia(d.value,f.value);return c.valid?((Ea(d)||Ea(f))&&s.dirty(),{status:s.value,value:c.data}):(_(i,{code:g.invalid_intersection_types}),R)};return i.common.async?Promise.all([this._def.left._parseAsync({data:i.data,path:i.path,parent:i}),this._def.right._parseAsync({data:i.data,path:i.path,parent:i})]).then(([d,f])=>l(d,f)):l(this._def.left._parseSync({data:i.data,path:i.path,parent:i}),this._def.right._parseSync({data:i.data,path:i.path,parent:i}))}}Mt.create=(n,e,s)=>new Mt({left:n,right:e,typeName:E.ZodIntersection,...L(s)});class Ye extends F{_parse(e){const{status:s,ctx:i}=this._processInputParams(e);if(i.parsedType!==O.array)return _(i,{code:g.invalid_type,expected:O.array,received:i.parsedType}),R;if(i.data.length<this._def.items.length)return _(i,{code:g.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),R;!this._def.rest&&i.data.length>this._def.items.length&&(_(i,{code:g.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),s.dirty());const d=[...i.data].map((f,c)=>{const C=this._def.items[c]||this._def.rest;return C?C._parse(new Pe(i,f,i.path,c)):null}).filter(f=>!!f);return i.common.async?Promise.all(d).then(f=>Te.mergeArray(s,f)):Te.mergeArray(s,d)}get items(){return this._def.items}rest(e){return new Ye({...this._def,rest:e})}}Ye.create=(n,e)=>{if(!Array.isArray(n))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Ye({items:n,typeName:E.ZodTuple,rest:null,...L(e)})};class $t extends F{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:s,ctx:i}=this._processInputParams(e);if(i.parsedType!==O.object)return _(i,{code:g.invalid_type,expected:O.object,received:i.parsedType}),R;const l=[],d=this._def.keyType,f=this._def.valueType;for(const c in i.data)l.push({key:d._parse(new Pe(i,c,i.path,c)),value:f._parse(new Pe(i,i.data[c],i.path,c)),alwaysSet:c in i.data});return i.common.async?Te.mergeObjectAsync(s,l):Te.mergeObjectSync(s,l)}get element(){return this._def.valueType}static create(e,s,i){return s instanceof F?new $t({keyType:e,valueType:s,typeName:E.ZodRecord,...L(i)}):new $t({keyType:Le.create(),valueType:e,typeName:E.ZodRecord,...L(s)})}}class Za extends F{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:s,ctx:i}=this._processInputParams(e);if(i.parsedType!==O.map)return _(i,{code:g.invalid_type,expected:O.map,received:i.parsedType}),R;const l=this._def.keyType,d=this._def.valueType,f=[...i.data.entries()].map(([c,C],w)=>({key:l._parse(new Pe(i,c,i.path,[w,"key"])),value:d._parse(new Pe(i,C,i.path,[w,"value"]))}));if(i.common.async){const c=new Map;return Promise.resolve().then(async()=>{for(const C of f){const w=await C.key,M=await C.value;if(w.status==="aborted"||M.status==="aborted")return R;(w.status==="dirty"||M.status==="dirty")&&s.dirty(),c.set(w.value,M.value)}return{status:s.value,value:c}})}else{const c=new Map;for(const C of f){const w=C.key,M=C.value;if(w.status==="aborted"||M.status==="aborted")return R;(w.status==="dirty"||M.status==="dirty")&&s.dirty(),c.set(w.value,M.value)}return{status:s.value,value:c}}}}Za.create=(n,e,s)=>new Za({valueType:e,keyType:n,typeName:E.ZodMap,...L(s)});class vt extends F{_parse(e){const{status:s,ctx:i}=this._processInputParams(e);if(i.parsedType!==O.set)return _(i,{code:g.invalid_type,expected:O.set,received:i.parsedType}),R;const l=this._def;l.minSize!==null&&i.data.size<l.minSize.value&&(_(i,{code:g.too_small,minimum:l.minSize.value,type:"set",inclusive:!0,exact:!1,message:l.minSize.message}),s.dirty()),l.maxSize!==null&&i.data.size>l.maxSize.value&&(_(i,{code:g.too_big,maximum:l.maxSize.value,type:"set",inclusive:!0,exact:!1,message:l.maxSize.message}),s.dirty());const d=this._def.valueType;function f(C){const w=new Set;for(const M of C){if(M.status==="aborted")return R;M.status==="dirty"&&s.dirty(),w.add(M.value)}return{status:s.value,value:w}}const c=[...i.data.values()].map((C,w)=>d._parse(new Pe(i,C,i.path,w)));return i.common.async?Promise.all(c).then(C=>f(C)):f(c)}min(e,s){return new vt({...this._def,minSize:{value:e,message:A.toString(s)}})}max(e,s){return new vt({...this._def,maxSize:{value:e,message:A.toString(s)}})}size(e,s){return this.min(e,s).max(e,s)}nonempty(e){return this.min(1,e)}}vt.create=(n,e)=>new vt({valueType:n,minSize:null,maxSize:null,typeName:E.ZodSet,...L(e)});class Ua extends F{get schema(){return this._def.getter()}_parse(e){const{ctx:s}=this._processInputParams(e);return this._def.getter()._parse({data:s.data,path:s.path,parent:s})}}Ua.create=(n,e)=>new Ua({getter:n,typeName:E.ZodLazy,...L(e)});class Ha extends F{_parse(e){if(e.data!==this._def.value){const s=this._getOrReturnCtx(e);return _(s,{received:s.data,code:g.invalid_literal,expected:this._def.value}),R}return{status:"valid",value:e.data}}get value(){return this._def.value}}Ha.create=(n,e)=>new Ha({value:n,typeName:E.ZodLiteral,...L(e)});function Qa(n,e){return new rt({values:n,typeName:E.ZodEnum,...L(e)})}class rt extends F{_parse(e){if(typeof e.data!="string"){const s=this._getOrReturnCtx(e),i=this._def.values;return _(s,{expected:U.joinValues(i),received:s.parsedType,code:g.invalid_type}),R}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){const s=this._getOrReturnCtx(e),i=this._def.values;return _(s,{received:s.data,code:g.invalid_enum_value,options:i}),R}return Ie(e.data)}get options(){return this._def.values}get enum(){const e={};for(const s of this._def.values)e[s]=s;return e}get Values(){const e={};for(const s of this._def.values)e[s]=s;return e}get Enum(){const e={};for(const s of this._def.values)e[s]=s;return e}extract(e,s=this._def){return rt.create(e,{...this._def,...s})}exclude(e,s=this._def){return rt.create(this.options.filter(i=>!e.includes(i)),{...this._def,...s})}}rt.create=Qa;class za extends F{_parse(e){const s=U.getValidEnumValues(this._def.values),i=this._getOrReturnCtx(e);if(i.parsedType!==O.string&&i.parsedType!==O.number){const l=U.objectValues(s);return _(i,{expected:U.joinValues(l),received:i.parsedType,code:g.invalid_type}),R}if(this._cache||(this._cache=new Set(U.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const l=U.objectValues(s);return _(i,{received:i.data,code:g.invalid_enum_value,options:l}),R}return Ie(e.data)}get enum(){return this._def.values}}za.create=(n,e)=>new za({values:n,typeName:E.ZodNativeEnum,...L(e)});class Dt extends F{unwrap(){return this._def.type}_parse(e){const{ctx:s}=this._processInputParams(e);if(s.parsedType!==O.promise&&s.common.async===!1)return _(s,{code:g.invalid_type,expected:O.promise,received:s.parsedType}),R;const i=s.parsedType===O.promise?s.data:Promise.resolve(s.data);return Ie(i.then(l=>this._def.type.parseAsync(l,{path:s.path,errorMap:s.common.contextualErrorMap})))}}Dt.create=(n,e)=>new Dt({type:n,typeName:E.ZodPromise,...L(e)});class dt extends F{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===E.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:s,ctx:i}=this._processInputParams(e),l=this._def.effect||null,d={addIssue:f=>{_(i,f),f.fatal?s.abort():s.dirty()},get path(){return i.path}};if(d.addIssue=d.addIssue.bind(d),l.type==="preprocess"){const f=l.transform(i.data,d);if(i.common.async)return Promise.resolve(f).then(async c=>{if(s.value==="aborted")return R;const C=await this._def.schema._parseAsync({data:c,path:i.path,parent:i});return C.status==="aborted"?R:C.status==="dirty"||s.value==="dirty"?bt(C.value):C});{if(s.value==="aborted")return R;const c=this._def.schema._parseSync({data:f,path:i.path,parent:i});return c.status==="aborted"?R:c.status==="dirty"||s.value==="dirty"?bt(c.value):c}}if(l.type==="refinement"){const f=c=>{const C=l.refinement(c,d);if(i.common.async)return Promise.resolve(C);if(C instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return c};if(i.common.async===!1){const c=this._def.schema._parseSync({data:i.data,path:i.path,parent:i});return c.status==="aborted"?R:(c.status==="dirty"&&s.dirty(),f(c.value),{status:s.value,value:c.value})}else return this._def.schema._parseAsync({data:i.data,path:i.path,parent:i}).then(c=>c.status==="aborted"?R:(c.status==="dirty"&&s.dirty(),f(c.value).then(()=>({status:s.value,value:c.value}))))}if(l.type==="transform")if(i.common.async===!1){const f=this._def.schema._parseSync({data:i.data,path:i.path,parent:i});if(!it(f))return R;const c=l.transform(f.value,d);if(c instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:s.value,value:c}}else return this._def.schema._parseAsync({data:i.data,path:i.path,parent:i}).then(f=>it(f)?Promise.resolve(l.transform(f.value,d)).then(c=>({status:s.value,value:c})):R);U.assertNever(l)}}dt.create=(n,e,s)=>new dt({schema:n,typeName:E.ZodEffects,effect:e,...L(s)});dt.createWithPreprocess=(n,e,s)=>new dt({schema:e,effect:{type:"preprocess",transform:n},typeName:E.ZodEffects,...L(s)});class He extends F{_parse(e){return this._getType(e)===O.undefined?Ie(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}He.create=(n,e)=>new He({innerType:n,typeName:E.ZodOptional,...L(e)});class ut extends F{_parse(e){return this._getType(e)===O.null?Ie(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}ut.create=(n,e)=>new ut({innerType:n,typeName:E.ZodNullable,...L(e)});class la extends F{_parse(e){const{ctx:s}=this._processInputParams(e);let i=s.data;return s.parsedType===O.undefined&&(i=this._def.defaultValue()),this._def.innerType._parse({data:i,path:s.path,parent:s})}removeDefault(){return this._def.innerType}}la.create=(n,e)=>new la({innerType:n,typeName:E.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...L(e)});class ra extends F{_parse(e){const{ctx:s}=this._processInputParams(e),i={...s,common:{...s.common,issues:[]}},l=this._def.innerType._parse({data:i.data,path:i.path,parent:{...i}});return At(l)?l.then(d=>({status:"valid",value:d.status==="valid"?d.value:this._def.catchValue({get error(){return new Ve(i.common.issues)},input:i.data})})):{status:"valid",value:l.status==="valid"?l.value:this._def.catchValue({get error(){return new Ve(i.common.issues)},input:i.data})}}removeCatch(){return this._def.innerType}}ra.create=(n,e)=>new ra({innerType:n,typeName:E.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...L(e)});class Ga extends F{_parse(e){if(this._getType(e)!==O.nan){const i=this._getOrReturnCtx(e);return _(i,{code:g.invalid_type,expected:O.nan,received:i.parsedType}),R}return{status:"valid",value:e.data}}}Ga.create=n=>new Ga({typeName:E.ZodNaN,...L(n)});class Xu extends F{_parse(e){const{ctx:s}=this._processInputParams(e),i=s.data;return this._def.type._parse({data:i,path:s.path,parent:s})}unwrap(){return this._def.type}}class pa extends F{_parse(e){const{status:s,ctx:i}=this._processInputParams(e);if(i.common.async)return(async()=>{const d=await this._def.in._parseAsync({data:i.data,path:i.path,parent:i});return d.status==="aborted"?R:d.status==="dirty"?(s.dirty(),bt(d.value)):this._def.out._parseAsync({data:d.value,path:i.path,parent:i})})();{const l=this._def.in._parseSync({data:i.data,path:i.path,parent:i});return l.status==="aborted"?R:l.status==="dirty"?(s.dirty(),{status:"dirty",value:l.value}):this._def.out._parseSync({data:l.value,path:i.path,parent:i})}}static create(e,s){return new pa({in:e,out:s,typeName:E.ZodPipeline})}}class da extends F{_parse(e){const s=this._def.innerType._parse(e),i=l=>(it(l)&&(l.value=Object.freeze(l.value)),l);return At(s)?s.then(l=>i(l)):i(s)}unwrap(){return this._def.innerType}}da.create=(n,e)=>new da({innerType:n,typeName:E.ZodReadonly,...L(e)});var E;(function(n){n.ZodString="ZodString",n.ZodNumber="ZodNumber",n.ZodNaN="ZodNaN",n.ZodBigInt="ZodBigInt",n.ZodBoolean="ZodBoolean",n.ZodDate="ZodDate",n.ZodSymbol="ZodSymbol",n.ZodUndefined="ZodUndefined",n.ZodNull="ZodNull",n.ZodAny="ZodAny",n.ZodUnknown="ZodUnknown",n.ZodNever="ZodNever",n.ZodVoid="ZodVoid",n.ZodArray="ZodArray",n.ZodObject="ZodObject",n.ZodUnion="ZodUnion",n.ZodDiscriminatedUnion="ZodDiscriminatedUnion",n.ZodIntersection="ZodIntersection",n.ZodTuple="ZodTuple",n.ZodRecord="ZodRecord",n.ZodMap="ZodMap",n.ZodSet="ZodSet",n.ZodFunction="ZodFunction",n.ZodLazy="ZodLazy",n.ZodLiteral="ZodLiteral",n.ZodEnum="ZodEnum",n.ZodEffects="ZodEffects",n.ZodNativeEnum="ZodNativeEnum",n.ZodOptional="ZodOptional",n.ZodNullable="ZodNullable",n.ZodDefault="ZodDefault",n.ZodCatch="ZodCatch",n.ZodPromise="ZodPromise",n.ZodBranded="ZodBranded",n.ZodPipeline="ZodPipeline",n.ZodReadonly="ZodReadonly"})(E||(E={}));const y=Le.create,xt=lt.create,Ka=oa.create;ze.create;const be=Re.create,ne=re.create;It.create;Mt.create;Ye.create;const Qu=$t.create,ec=rt.create;Dt.create;He.create;ut.create;const tc=ne({label:y().min(1).max(40),left:y().min(1).max(35),right:y().min(1).max(35)}),ac=ne({id:y().optional().default(()=>`post-${Date.now()}`).transform(n=>n||`post-${Date.now()}`),templateId:y().optional(),category:y().optional().default("TECH"),theme:ec(["blue-tech","emerald-finance","slate-education","dark-contrast","crimson-alert","amber-gold","cyber-violet","sunset-orange","nordic-frost","monochrome-luxe"]).default("blue-tech"),layoutType:y().default("table"),title:y().min(1).max(120),subtitle:y().min(1).max(250),leftHeader:y().optional().default("USA 🇺🇸"),rightHeader:y().optional().default("UK 🇬🇧"),rows:be(tc).optional().default([]),bullets:be(ne({highlight:y().optional().default(""),text:y().min(1)})).optional().default([]),bigStat:ne({number:y().default("$165,000"),label:y().default("Average Compensation"),subtext:y().optional().default(""),secondaryNumber:y().optional().default(""),secondaryLabel:y().optional().default("")}).optional(),listItems:be(ne({rank:xt(),title:y(),value:y(),tag:y().optional().default("")})).optional().default([]),quoteData:ne({quote:y(),highlight:y().optional().default(""),source:y().default("Industry Insider")}).optional(),versusData:ne({leftEntity:y().optional(),leftStats:be(ne({label:y(),value:y()})).optional(),leftPerk:y().optional(),rightEntity:y().optional(),rightStats:be(ne({label:y(),value:y()})).optional(),rightPerk:y().optional(),verdict:y().optional()}).optional(),receiptData:ne({grossMonthly:y().optional(),items:be(ne({label:y(),amount:y(),note:y().optional()})).optional(),totalDeductions:y().optional(),netRemaining:y().optional()}).optional(),timelineData:ne({pastYear:y().optional().default("2016"),presentYear:y().optional().default("2026"),items:be(ne({label:y(),pastValue:y(),presentValue:y(),changeBadge:y().optional()})).optional(),bottomInsight:y().optional()}).optional(),barchartData:be(ne({label:y(),percentage:xt().min(0).max(100),amount:y().optional(),tag:y().optional()})).optional().default([]),leaderboardData:ne({calloutNote:y().optional().default("*Asumsi kurs : Rp15.500/US$"),items:be(ne({rank:xt(),name:y(),flag:y().optional().default("🌐"),value:y(),percentage:xt().min(0).max(100).optional()})).optional()}).optional(),editorialData:ne({badge:y().optional().default("INVESTIGASI KHUSUS"),highlightPhrase:y().optional(),cards:be(ne({step:y().optional(),title:y(),text:y(),stat:y().optional()})).optional(),keyTakeaway:y().optional()}).optional(),matrixData:ne({headers:be(y()).optional().default(["Indikator","🇮🇩 IDN","🇲🇾 MYS","🇸🇬 SGP"]),rows:be(ne({label:y(),values:be(y())})).optional()}).optional(),debateData:ne({proTitle:y().optional().default("SISI PRO / BENEFIT"),proScore:y().optional().default("65%"),proPoints:be(y()).optional(),conTitle:y().optional().default("SISI KONTRA / RISIKO"),conScore:y().optional().default("35%"),conPoints:be(y()).optional(),callToAction:y().optional().default("Kalian di tim mana? Tulis pendapatmu di bawah! 👇")}).optional(),tierlistData:be(ne({tier:y(),tierColor:y().optional(),items:be(ne({name:y(),badge:y().optional(),desc:y().optional()}))})).optional().default([]),customHtml:y().optional(),customCss:y().optional(),customFields:Qu(Ka()).optional(),items:be(Ka()).optional(),footerNote:y().optional().default("Industry Benchmark 2026"),sourceUrl:y().optional(),methodologyBadge:y().optional(),disclaimer:y().optional(),watermark:y().optional().default("@SocialGen"),bgKeyword:y().optional().default("modern office coding night"),reelsDuration:xt().min(5).max(90).default(30),caption:y().optional().default("Bagikan pendapat Anda di kolom komentar! #infografis #edukasi")}),sc={class:"h-screen w-screen bg-slate-950 text-slate-100 flex flex-col font-sans selection:bg-sky-500 selection:text-white overflow-hidden"},nc={class:"h-14 flex-shrink-0 border-b border-slate-800/80 bg-slate-900/60 backdrop-blur sticky top-0 z-30 px-3 sm:px-6 flex items-center justify-between"},oc={class:"flex items-center gap-2.5 sm:gap-3"},ic={class:"text-sm font-extrabold tracking-tight text-white flex items-center gap-1.5 sm:gap-2"},lc={class:"text-[9px] sm:text-[10px] font-bold px-2 py-0.5 rounded-full bg-slate-800 text-sky-400 border border-slate-700"},rc={class:"flex items-center gap-2 sm:gap-3 text-xs"},dc={key:0,class:"px-2.5 py-0.5 sm:py-1 rounded-full bg-emerald-500/10 text-emerald-400 border border-emerald-500/20 font-semibold text-[10px] sm:text-[11px]"},uc={key:1,class:"px-2.5 py-0.5 sm:py-1 rounded-full bg-slate-800 text-slate-400 border border-slate-700 font-semibold text-[10px] sm:text-[11px]"},cc={class:"lg:hidden flex items-center justify-center px-3 py-2 bg-slate-900/90 border-b border-slate-800 flex-shrink-0"},pc={class:"grid grid-cols-2 w-full max-w-sm bg-slate-950 p-1 rounded-xl border border-slate-800 text-xs font-bold shadow-inner"},fc={key:0,class:"w-2 h-2 rounded-full bg-emerald-400 animate-ping"},mc={class:"flex items-center gap-2"},xc={key:0,class:"text-emerald-400"},hc={key:1,class:"text-sky-400"},bc={key:2,class:"text-rose-400"},gc={class:"flex-1 w-full flex flex-col lg:flex-row overflow-hidden min-h-0"},vc={key:2,class:"lg:hidden fixed bottom-0 left-0 right-0 z-30 h-16 px-4 bg-slate-900/95 backdrop-blur-lg border-t border-slate-800 flex items-center justify-between gap-3 shadow-2xl"},yc={class:"flex flex-col"},kc={class:"flex items-center gap-1 text-[10px] font-bold text-sky-400"},wc={key:0},_c={key:1},Sc={key:2},Tc=["disabled"],Cc={key:0,class:"animate-spin"},Oc={key:1},Ac={key:3,class:"lg:hidden fixed inset-0 z-50 bg-slate-950 flex flex-col justify-between overflow-hidden animate-in slide-in-from-bottom"},Nc={class:"h-14 px-4 bg-slate-900/95 border-b border-slate-800 flex items-center justify-between shrink-0 shadow-md"},Ic={class:"flex-1 overflow-hidden p-2 flex flex-col min-h-0"},Mc={class:"h-16 px-4 bg-slate-900/95 border-t border-slate-800 flex items-center justify-between gap-2 shrink-0"},$c=["disabled"],Ec=ua({__name:"index",setup(n){const e=S({id:"news-us-germany-salary-divide-2026",category:"TECH REPORT",theme:"blue-tech",layoutType:"news",title:"THE $90,000 TRANSATLANTIC TECH DIVIDE",subtitle:"United States 🇺🇸 vs Germany 🇩🇪 (2026 Real Purchasing Power)",leftHeader:"USA 🇺🇸",rightHeader:"Germany 🇩🇪",rows:[{label:"Junior Dev",left:"$88,000/yr",right:"$52,000/yr"},{label:"Mid-Level",left:"$135,000/yr",right:"$75,000/yr"},{label:"Senior Lead",left:"$180,000/yr",right:"$98,000/yr"},{label:"Effective Tax",left:"24%",right:"42%"},{label:"Paid Vacation",left:"15 Days",right:"30 Days"}],bullets:[{highlight:"Gross Salary Lead",text:"American engineers take home up to 84% higher base compensation."},{highlight:"Work-Life Balance",text:"German labor laws guarantee 30 paid days off with zero expectation of after-hours Slack."},{highlight:"Healthcare Drag",text:"US health insurance deductibles and out-of-pocket costs eat up to $14,000/yr per family."}],bigStat:{number:"$180,000",label:"Senior Tech Base in California",secondaryNumber:"$98,000",secondaryLabel:"Munich Hub",subtext:"The gap widens at senior level, but so does cost of childcare and housing inflation."},listItems:[{rank:1,title:"Switzerland 🇨🇭",value:"$145,000/yr",tag:"Top Net Pay"},{rank:2,title:"United States 🇺🇸",value:"$135,000/yr",tag:"Fast Growth"},{rank:3,title:"Australia 🇦🇺",value:"$98,000/yr",tag:"High Super"},{rank:4,title:"Germany 🇩🇪",value:"$84,000/yr",tag:"Pension Safety"},{rank:5,title:"United Kingdom 🇬🇧",value:"$72,000/yr",tag:"Flexible"}],quoteData:{quote:"Chasing the American gross salary without calculating healthcare deductibles and 50-hour workweeks is the most common financial illusion in global tech.",highlight:"most common financial illusion",source:"Principal Tech Recruiter"},footerNote:"Source: Verified Industry Compensation Survey 2026",watermark:"@SocialGen",bgKeyword:"modern office coding night technology",reelsDuration:30,caption:"Higher gross salary in the US or guaranteed 30 days off in Germany? Which lifestyle would you choose? Drop your vote below! 👇 #techcareers #salary #softwareengineer #worklife"}),s=S({theme:"blue-tech",backgroundSource:"pexels",musicFile:"random",videoStartOffset:0,audioStartOffset:0,outputs:{feed:!0,story:!0,reels:!0}}),i=S([]),l=S(-1),d=S(null);function f($){if(!e.value||!e.value.title||d.value)return;const h=JSON.stringify(e.value),Q=$?JSON.stringify($):"";if(h!==Q){d.value=JSON.parse(h);try{localStorage.setItem("sg_unsaved_stash",h)}catch{}}}function c(){if(!d.value)return;const $=d.value.title||"Editan Anda";e.value=JSON.parse(JSON.stringify(d.value)),d.value.theme&&(s.value.theme=d.value.theme),d.value=null,l.value=-1,V.value=-1;try{localStorage.removeItem("sg_unsaved_stash")}catch{}se(`Editan sebelumnya ("${$.slice(0,24)}...") berhasil dikembalikan! ↩️`,"success")}function C(){d.value=null;try{localStorage.removeItem("sg_unsaved_stash")}catch{}}function w(){try{localStorage.setItem("sg_drafts",JSON.stringify(i.value))}catch{}$fetch("/api/drafts",{method:"POST",body:{drafts:i.value}}).catch(()=>{})}function M(){i.value.unshift(JSON.parse(JSON.stringify(e.value))),l.value=0,V.value=-1,w(),se("Draft berhasil disimpan!")}function ee($){const h=i.value[$];if(h){f(h),e.value=JSON.parse(JSON.stringify(h)),h.theme&&(s.value.theme=h.theme),l.value=$,V.value=-1;const Q=!!d.value;se(`Memuat draft #${$+1}: "${(h.title||"Untitled").slice(0,20)}..."`,"success",Q?{label:"↩️ Kembalikan Editan",onClick:c}:void 0)}}function pe($){i.value.splice($,1),l.value===$&&(l.value=-1),w(),se("Draft dihapus")}const W=S([]),V=S(-1);function D(){try{localStorage.setItem("sg_gen_history",JSON.stringify(W.value))}catch{}$fetch("/api/generation-history",{method:"POST",body:{history:W.value}}).catch(()=>{})}function J($){const h=W.value[$];if(h){const Q=h.contentData||h;f(Q),e.value=JSON.parse(JSON.stringify(Q)),h.options&&(s.value={...s.value,...h.options}),V.value=$,l.value=-1;const Me=!!d.value;se(`Memuat riwayat: "${(h.title||"Untitled").slice(0,24)}..."`,"success",Me?{label:"↩️ Kembalikan Editan",onClick:c}:void 0)}}function fe($){W.value.splice($,1),V.value===$&&(V.value=-1),D(),se("Item riwayat dihapus")}function Ce(){W.value=[],V.value=-1,D(),se("Seluruh riwayat generate berhasil dibersihkan!")}let $e=null;function ve(){try{localStorage.setItem("sg_active_content",JSON.stringify(e.value)),localStorage.setItem("sg_active_options",JSON.stringify(s.value))}catch{}clearTimeout($e),$e=setTimeout(()=>{$fetch("/api/last-session",{method:"POST",body:{content:e.value,options:s.value}}).catch(()=>{})},1e3)}ke(()=>e.value,ve,{deep:!0}),ke(()=>s.value,ve,{deep:!0});const Y=S(!1),G=S(!1),ie=S(""),q=S(null),we=S(""),oe=S("success"),X=S("editor"),te=S(!1),H=S(null);ca(async()=>{try{const $=localStorage.getItem("sg_active_content");if($){const h=JSON.parse($);h&&h.title&&(e.value=h)}else{const h=await $fetch("/api/last-session");h?.session?.content&&(e.value=h.session.content,h.session.options&&(s.value={...s.value,...h.session.options}))}}catch{}try{const $=localStorage.getItem("sg_active_options");if($){const h=JSON.parse($);h&&(s.value={...s.value,...h})}}catch{}try{const $=await $fetch("/api/drafts");if($?.drafts&&Array.isArray($.drafts)&&$.drafts.length>0)i.value=$.drafts;else{const h=localStorage.getItem("sg_drafts");if(h){const Q=JSON.parse(h);Array.isArray(Q)&&Q.length>0&&(i.value=Q,$fetch("/api/drafts",{method:"POST",body:{drafts:Q}}).catch(()=>{}))}}}catch{const $=localStorage.getItem("sg_drafts");if($)try{i.value=JSON.parse($)}catch{}}try{const $=await $fetch("/api/generation-history");if($?.history&&Array.isArray($.history)&&$.history.length>0)W.value=$.history;else{const h=localStorage.getItem("sg_gen_history");h&&(W.value=JSON.parse(h))}}catch{}try{const $=await $fetch("/api/status");H.value=$}catch{}try{const $=localStorage.getItem("sg_unsaved_stash");$&&(d.value=JSON.parse($))}catch{}});const ge=ce(()=>{const $=ac.safeParse(e.value);if($.success)return{isValid:!0,error:""};{const h=$.error.errors[0];return{isValid:!1,error:`${h.path.join(".")}: ${h.message}`}}}),ae=S(null);let _e=null;function se($,h="success",Q){clearTimeout(_e),we.value=$,oe.value=h,ae.value=Q||null,_e=setTimeout(()=>{we.value="",ae.value=null},Q?7e3:4e3)}async function N($,h,Q,Me){G.value=!0,ie.value=`AI Research (${Q||"Gemini"})...`;try{const B=await $fetch("/api/auto-topic",{method:"POST",body:{niche:$,layoutType:h,model:Q,language:Me}});if(B?.dataset){f(B.dataset),e.value=B.dataset,s.value.theme=B.dataset.theme,i.value.unshift(B.dataset),l.value=0,w();const Be=!!d.value;B.source==="gemini"?se(`✨ [${B.modelUsed||"Gemini"}] Berhasil meriset: "${B.dataset.title.slice(0,32)}..."`,"success",Be?{label:"↩️ Kembalikan Editan",onClick:c}:void 0):se(`ℹ️ [Curated Data] Topik siap: "${B.dataset.title.slice(0,32)}..."`,"success",Be?{label:"↩️ Kembalikan Editan",onClick:c}:void 0)}}catch(B){se("Gagal auto-topic: "+(B.data?.statusMessage||B.message),"error")}finally{G.value=!1,ie.value=""}}async function Ge(){if(!ge.value.isValid){se("Data tidak valid: "+ge.value.error,"error");return}Y.value=!0,ie.value="Rendering Images & Reels...",q.value=null;const $={id:e.value.id||String(Date.now()),title:e.value.title||"Untitled Creation",layoutType:e.value.layoutType||"table",category:e.value.category||"GENERAL",theme:e.value.theme||"blue-tech",generatedAt:new Date().toISOString(),contentData:JSON.parse(JSON.stringify(e.value)),options:JSON.parse(JSON.stringify(s.value))};W.value.unshift($),V.value=0,D(),X.value="preview";try{const h=await $fetch("/api/generate",{method:"POST",body:{data:e.value,options:s.value}});h?.success&&(q.value=h,se(`✅ Generate selesai! Berhasil dirender dalam ${(h.durationMs/1e3).toFixed(1)} detik.`,"success"))}catch(h){se("Gagal render: "+(h.data?.statusMessage||h.message),"error")}finally{Y.value=!1,ie.value=""}}return($,h)=>{const Q=Rd,Me=Cu;return p(),m("div",sc,[t("header",nc,[t("div",oc,[h[16]||(h[16]=t("div",{class:"w-8 h-8 rounded-xl bg-gradient-to-tr from-sky-500 via-indigo-600 to-purple-600 flex items-center justify-center font-black text-white shadow-md shadow-sky-500/20 text-xs"}," SG ",-1)),t("div",null,[t("h1",ic,[h[15]||(h[15]=z(" SocialGen ",-1)),t("span",lc," v"+x(o(H)?.version||"2.4.0 Studio"),1)])])]),t("div",rc,[o(H)?.geminiActive?(p(),m("span",dc," ● AI Connected ")):(p(),m("span",uc," ● Local Engine "))])]),t("div",cc,[t("div",pc,[t("button",{onClick:h[0]||(h[0]=B=>X.value="editor"),class:j(["py-1.5 px-3 rounded-lg transition flex items-center justify-center gap-1.5",o(X)==="editor"?"bg-sky-500 text-white shadow-md font-black":"text-slate-400 hover:text-slate-200"])},[...h[17]||(h[17]=[t("span",null,"⚙️ Studio & Editor",-1)])],2),t("button",{onClick:h[1]||(h[1]=B=>X.value="preview"),class:j(["py-1.5 px-3 rounded-lg transition flex items-center justify-center gap-1.5",o(X)==="preview"?"bg-indigo-600 text-white shadow-md font-black":"text-slate-400 hover:text-slate-200"])},[h[18]||(h[18]=t("span",null,"👁️ Live Preview",-1)),o(q)?(p(),m("span",fc)):I("",!0)],2)])]),o(we)?(p(),m("div",{key:0,class:j(["fixed bottom-20 lg:bottom-6 right-4 lg:right-6 z-50 flex items-center gap-3 px-4 py-3 rounded-2xl shadow-2xl text-xs font-bold border transition-all max-w-[90vw]",o(oe)==="success"?"bg-slate-900 text-slate-100 border-sky-500/50 shadow-sky-950/50":o(oe)==="info"?"bg-slate-900 text-sky-200 border-indigo-500/50 shadow-indigo-950/50":"bg-rose-950 text-rose-200 border-rose-500/50"])},[t("div",mc,[o(oe)==="success"?(p(),m("span",xc,"●")):o(oe)==="info"?(p(),m("span",hc,"ℹ️")):(p(),m("span",bc,"⚠️")),t("span",null,x(o(we)),1)]),o(ae)?(p(),m("button",{key:0,onClick:h[2]||(h[2]=()=>{o(ae)?.onClick(),we.value="",ae.value=null}),class:"px-2.5 py-1 bg-sky-500 hover:bg-sky-400 text-white font-extrabold rounded-lg shadow transition text-[11px] flex items-center gap-1 active:scale-95"},x(o(ae).label),1)):I("",!0),t("button",{onClick:h[3]||(h[3]=B=>{we.value="",ae.value=null}),class:"text-slate-400 hover:text-white transition ml-1 text-xs"}," ✕ ")],2)):I("",!0),t("main",gc,[t("section",{class:j(["h-full shrink-0",o(X)==="editor"?"flex flex-col w-full lg:w-auto lg:flex-row lg:overflow-hidden p-2 lg:p-0":"hidden lg:flex lg:flex-row lg:overflow-hidden"])},[k(Q,{modelValue:o(e),"onUpdate:modelValue":h[4]||(h[4]=B=>Ee(e)?e.value=B:null),options:o(s),"onUpdate:options":h[5]||(h[5]=B=>Ee(s)?s.value=B:null),"is-valid":o(ge).isValid,"validation-error":o(ge).error,"is-generating":o(Y),"generate-stage":o(ie),"is-auto-topic-loading":o(G),drafts:o(i),"active-draft-index":o(l),history:o(W),"active-history-index":o(V),"unsaved-stash":o(d),onGenerate:Ge,onAutoTopic:N,onSelectDraft:ee,onDeleteDraft:pe,onSaveDraft:M,onSelectHistory:J,onDeleteHistory:fe,onClearAllHistory:Ce,onRestoreStash:c,onClearStash:C,onToast:h[6]||(h[6]=(B,Be)=>se(B,Be))},null,8,["modelValue","options","is-valid","validation-error","is-generating","generate-stage","is-auto-topic-loading","drafts","active-draft-index","history","active-history-index","unsaved-stash"])],2),t("section",{class:j(["h-full min-w-0 flex-col justify-between overflow-hidden",o(X)==="preview"?"flex w-full p-2":"hidden lg:flex lg:flex-1 lg:p-3"])},[k(Me,{data:o(e),"selected-video":o(s).backgroundSource,"selected-music":o(s).musicFile,"video-start-offset":o(s).videoStartOffset,"onUpdate:videoStartOffset":h[7]||(h[7]=B=>o(s).videoStartOffset=B),"audio-start-offset":o(s).audioStartOffset,"onUpdate:audioStartOffset":h[8]||(h[8]=B=>o(s).audioStartOffset=B),"is-generating":o(Y),"generate-stage":o(ie)},null,8,["data","selected-video","selected-music","video-start-offset","audio-start-offset","is-generating","generate-stage"])],2)]),o(X)==="editor"?(p(),m("button",{key:1,onClick:h[9]||(h[9]=B=>te.value=!0),type:"button",class:"lg:hidden fixed bottom-20 right-4 z-40 px-4 py-2.5 rounded-full bg-gradient-to-r from-sky-500 to-indigo-600 hover:from-sky-400 hover:to-indigo-500 text-white font-black text-xs shadow-2xl border border-sky-400/40 flex items-center gap-1.5 active:scale-95 transition"},[...h[19]||(h[19]=[t("span",{class:"text-sm"},"👁️",-1),t("span",null,"Intip Canvas",-1)])])):I("",!0),o(X)==="editor"?(p(),m("div",vc,[t("div",yc,[h[20]||(h[20]=t("span",{class:"text-[9px] font-bold text-slate-400 uppercase tracking-wider"},"Output",-1)),t("div",kc,[o(s).outputs?.feed!==!1?(p(),m("span",wc,"Feed")):I("",!0),o(s).outputs?.feed!==!1&&o(s).outputs?.reels!==!1?(p(),m("span",_c,"•")):I("",!0),o(s).outputs?.reels!==!1?(p(),m("span",Sc,"Reels")):I("",!0)])]),t("button",{onClick:Ge,disabled:o(Y)||!o(ge).isValid,type:"button",class:"flex-1 py-3 px-4 rounded-2xl bg-gradient-to-r from-sky-500 to-indigo-600 hover:from-sky-400 hover:to-indigo-500 text-white font-black text-xs tracking-wide shadow-xl shadow-sky-500/25 flex items-center justify-center gap-2 active:scale-95 transition disabled:opacity-50"},[o(Y)?(p(),m("span",Cc,"🔄")):(p(),m("span",Oc,"🚀")),t("span",null,x(o(Y)?o(ie)||"Rendering Content...":"GENERATE SEKARANG"),1)],8,Tc)])):I("",!0),o(te)?(p(),m("div",Ac,[t("div",Nc,[h[22]||(h[22]=t("div",{class:"flex items-center gap-2"},[t("span",{class:"w-2 h-2 rounded-full bg-emerald-400 animate-ping"}),t("span",{class:"text-xs font-black text-white"},"Preview Canvas Penuh")],-1)),t("button",{onClick:h[10]||(h[10]=B=>te.value=!1),type:"button",class:"px-3 py-1.5 rounded-xl bg-slate-800 hover:bg-slate-700 text-xs font-bold text-slate-200 border border-slate-700 flex items-center gap-1 active:scale-95 transition"},[...h[21]||(h[21]=[t("span",null,"✕ Tutup Preview",-1)])])]),t("div",Ic,[k(Me,{data:o(e),"selected-video":o(s).backgroundSource,"selected-music":o(s).musicFile,"video-start-offset":o(s).videoStartOffset,"onUpdate:videoStartOffset":h[11]||(h[11]=B=>o(s).videoStartOffset=B),"audio-start-offset":o(s).audioStartOffset,"onUpdate:audioStartOffset":h[12]||(h[12]=B=>o(s).audioStartOffset=B),"is-generating":o(Y),"generate-stage":o(ie)},null,8,["data","selected-video","selected-music","video-start-offset","audio-start-offset","is-generating","generate-stage"])]),t("div",Mc,[t("button",{onClick:h[13]||(h[13]=B=>te.value=!1),type:"button",class:"flex-1 py-2.5 rounded-xl bg-slate-800 hover:bg-slate-700 text-xs font-bold text-slate-200 active:scale-95 transition"}," ✏️ Lanjut Edit Form "),t("button",{onClick:h[14]||(h[14]=()=>{te.value=!1,Ge()}),disabled:o(Y)||!o(ge).isValid,type:"button",class:"flex-1 py-2.5 rounded-xl bg-gradient-to-r from-sky-500 to-indigo-600 text-xs font-bold text-white shadow-lg active:scale-95 transition disabled:opacity-50"}," 🚀 Langsung Render ",8,$c)])])):I("",!0)])}}});export{Ec as default};