vendor: 4,318 bytes, lines 1-16
1var se=r=>{throw TypeError(r)};var V=(r,t,a)=>t.has(r)||se("Cannot "+a);var c=(r,t,a)=>(V(r,t,"read from private field"),a?a.call(r):t.get(r)),L=(r,t,a)=>t.has(r)?se("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(r):t.set(r,a),M=(r,t,a,l)=>(V(r,t,"write to private field"),l?l.call(r,a):t.set(r,a),a),U=(r,t,a)=>(V(r,t,"access private method"),a);import{S as he,s as ge,h as te,g as pe,n as ne,b as oe,r as m,d as xe,e as fe,c as $,j as e,a as ie,f as be,i as ve,u as je,H as ye,P as _e,t as A}from"./index-CRV4PoPD.js";import{u as ae}from"./useQuery-CW8Mg7la.js";import{s as S}from"./client-Cp15HnXP.js";import{B as j,S as we}from"./button-CWclj9MS.js";import{I as K}from"./index-CHaMpYnY.js";import{u as Ne,L as ke,T as Ce,a as Se,b as O,c as T}from"./useAdminAuth-DbXAoVs8.js";import{A as Ie}from"./arrow-left-W0J2fvtC.js";import"./tslib.es6-eMSY344_.js";import"./index-BDaahMMY.js";var w,N,h,y,_,z,Q,re,Pe=(re=class extends he{constructor(t,a){super();L(this,_);L(this,w);L(this,N);L(this,h);L(this,y);M(this,w,t),this.setOptions(a),this.bindMethods(),U(this,_,z).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(t){var l;const a=this.options;this.options=c(this,w).defaultMutationOptions(t),ge(this.options,a)||c(this,w).getMutationCache().notify({type:"observerOptionsUpdated",mutation:c(this,h),observer:this}),a!=null&&a.mutationKey&&this.options.mutationKey&&te(a.mutationKey)!==te(this.options.mutationKey)?this.reset():((l=c(this,h))==null?void 0:l.state.status)==="pending"&&c(this,h).setOptions(this.options)}onUnsubscribe(){var t;this.hasListeners()||(t=c(this,h))==null||t.removeObserver(this)}onMutationUpdate(t){U(this,_,z).call(this),U(this,_,Q).call(this,t)}getCurrentResult(){return c(this,N)}reset(){var t;(t=c(this,h))==null||t.removeObserver(this),M(this,h,void 0),U(this,_,z).call(this),U(this,_,Q).call(this)}mutate(t,a){var l;return M(this,y,a),(l=c(this,h))==null||l.removeObserver(this),M(this,h,c(this,w).getMutationCache().build(c(this,w),this.options)),c(this,h).addObserver(this),c(this,h).execute(t)}},w=new WeakMap,N=new WeakMap,h=new WeakMap,y=new WeakMap,_=new WeakSet,z=function(){var a;const t=((a=c(this,h))==null?void 0:a.state)??pe();M(this,N,{...t,isPending:t.status==="pending",isSuccess:t.status==="success",isError:t.status==="error",isIdle:t.status==="idle",mutate:this.mutate,reset:this.reset})},Q=function(t){ne.batch(()=>{var a,l,u,I,b,P,n,D;if(c(this,y)&&this.hasListeners()){const p=c(this,N).variables,k=c(this,N).context;(t==null?void 0:t.type)==="success"?((l=(a=c(this,y)).onSuccess)==null||l.call(a,t.data,p,k),(I=(u=c(this,y)).onSettled)==null||I.call(u,t.data,null,p,k)):(t==null?void 0:t.type)==="error"&&((P=(b=c(this,y)).onError)==null||P.call(b,t.error,p,k),(D=(n=c(this,y)).onSettled)==null||D.call(n,void 0,t.error,p,k))}this.listeners.forEach(p=>{p(c(this,N))})})},re);function H(r,t){const a=oe(),[l]=m.useState(()=>new Pe(a,r));m.useEffect(()=>{l.setOptions(r)},[l,r]);const u=m.useSyncExternalStore(m.useCallback(b=>l.subscribe(ne.batchCalls(b)),[l]),()=>l.getCurrentResult(),()=>l.getCurrentResult()),I=m.useCallback((b,P)=>{l.mutate(b,P).catch(xe)},[l]);if(u.error&&fe(l.options.throwOnError,[u.error]))throw u.error;return{...u,mutate:I,mutateAsync:u.mutate}}/** 2 * @license lucide-react v0.462.0 - ISC 3 * 4 * This source code is licensed under the ISC license. 5 * See the LICENSE file in the root directory of this source tree. 6 */const Le=$("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/** 7 * @license lucide-react v0.462.0 - ISC 8 * 9 * This source code is licensed under the ISC license. 10 * See the LICENSE file in the root directory of this source tree. 11 */const F=$("Save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]]);/** 12 * @license lucide-react v0.462.0 - ISC 13 * 14 * This source code is licensed under the ISC license. 15 * See the LICENSE file in the root directory of this source tree. 16 */const Me=$("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}
16],["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"}]]),le=m.forwardRef(({className:r,...t},a)=>e.jsx("textarea",{className:ie("flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",r),ref:a,...t}));le.displayName="Textarea";var Ue="Label",ce=m.forwardRef((r,t)=>e.jsx(be.label,{...r,ref:t,onMouseDown:a=>{var u;a.target.closest("button, input, select, textarea")||((u=r.onMouseDown)==null||u.call(r,a),!a.defaultPrevented&&a.detail>1&&a.preventDefault())}}));ce.displayName=Ue;var de=ce;const Oe=ve("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),R=m.forwardRef(({className:r,...t},a)=>e.jsx(de,{ref:a,className:ie(Oe(),r),...t}));R.displayName=de.displayName;const Te=async()=>{const{data:r,error:t}=await S.from("site_settings").select("key, value");if(t)throw t;const a={};for(const l of r||[])a[l.key]=l.value;return a},Re=async()=>{const{data:r,error:t}=await S.from("product_images").select("*").order("sort_order",{ascending:!0});if(t)throw t;return r||[]},i=(r,t,a,l="")=>{var u;return((u=r==null?void 0:r[t])==null?void 0:u[a])??l},Qe=()=>{const r=je(),t=oe(),{isLoading:a,signOut:l}=Ne(),{data:u={},isLoading:I}=ae({queryKey:["site-settings"],queryFn:Te,enabled:!a}),{data:b=[],isLoading:P}=ae({queryKey:["product-images"],queryFn:Re,enabled:!a}),[n,D]=m.useState({}),[p,k]=m.useState(!1);m.useEffect(()=>{Object.keys(u).length>0&&Object.keys(n).length===0&&D(structuredClone(u))},[u,n]);const o=m.useCallback((s,g,v)=>{D(C=>({...C,[s]:{...C[s],[g]:v}})),k(!0)},[]),f=H({mutationFn:async s=>{for(const g of s){const{error:v}=await S.from("site_settings").update({value:n[g]}).eq("key",g);if(v)throw v}},onSuccess:()=>{t.invalidateQueries({queryKey:["site-settings"]}),k(!1),A({title:"Settings saved",description:"Your changes have been saved."})},onError:s=>{A({title:"Error saving",description:s.message,variant:"destructive"})}}),J=H({mutationFn:async s=>{const{error:g}=await S.from("product_images").delete().eq("id",s);if(g)throw g},onSuccess:()=>{t.invalidateQueries({queryKey:["product-images"]}),A({title:"Image deleted"})}}),W=H({mutationFn:async({url:s,label:g})=>{const{error:v}=await S.from("product_images").insert({url:s,label:g,sort_order:b.length});if(v)throw v},onSuccess:()=>{t.invalidateQueries({queryKey:["product-images"]}),A({title:"Image added"})}}),[q,B]=m.useState(""),[Y,G]=m.useState(""),[X,Z]=m.useState(!1),ue=async s=>{var v;const g=(v=s.target.files)==null?void 0:v[0];if(g){Z(!0);try{const C=`product-images/${Date.now()}-${g.name}`,{error:ee}=await S.storage.from("site-assets").upload(C,g,{upsert:!0});if(ee)throw ee;const{data:me}=S.storage.from("site-assets").getPublicUrl(C);B(me.publicUrl)}catch(C){A({title:"Upload failed",description:C.message,variant:"destructive"})}finally{Z(!1)}}};if(a||I)return e.jsx("div",{className:"min-h-screen bg-background"});const E=s=>f.mutate(s);return e.jsxs(e.Fragment,{children:[e.jsx(ye,{children:e.jsx("script",{type:"application/ld+json",children:JSON.stringify(_e)})}),e.jsxs("div",{className:"min-h-screen bg-background",children:[e.jsx("header",{className:"border-b border-border/50 bg-card/60 backdrop-blur-sm sticky top-0 z-10",children:e.jsxs("div",{className:"max-w-4xl mx-auto px-4 py-4 flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs(j,{variant:"ghost",size:"sm",onClick:()=>r("/admin/leads"),children:[e.jsx(Ie,{className:"w-4 h-4 mr-2"}),"Dashboard"]}),e.jsx("div",{className:"w-8 h-8 rounded-full bg-gradient-to-br from-primary to-accent p-[2px]",children:e.jsx("div",{className:"w-full h-full rounded-full bg-card flex items-center justify-center",children:e.jsx(we,{className:"w-4 h-4 text-primary",strokeWidth:1.5})})}),e.jsx("h1",{className:"font-semibold text-foreground",children:"Settings"})]}),e.jsxs(j,{variant:"ghost",size:"sm",onClick:l,children:[e.jsx(ke,{className:"w-4 h-4 mr-2"}),"Sign Out"]})]})}),e.jsx("div",{className:"max-w-4xl mx-auto px-4 py-6",children:e.jsxs(Ce,{defaultValue:"profile",className:"w-full",children:[e.jsxs(Se,{className:"mb-6 flex-wrap h-auto gap-1",children:[e.jsx(O,{value:"profile",children:"Profile & Social"}),e.jsx(O,{value:"prompt",children:"Merlin Prompt"}),e.jsx(O,{value:"booking",children:"Booking"}),e.jsx(O,{value:"images",children:"Product Images"}),e.jsx(O,{value:"urls",children:"Product URLs"}),e.jsx(O,{value:"newsletter",children:"Newsletter"})]}),e.jsx(T,{value:"profile",children:e.jsxs("div",{className:"space-y-6",children:[e.jsx("h2",{className:"text-lg font-semibold text-foreground",children:"Profile"}),e.jsxs("div",{className:"grid gap-4",children:[e.jsx(d,{label:"Display Name",value:i(n,"profile","name"),onChange:s=>o("profile","name",s)}),e.jsx(d,{label:"Title / Tagline",value:i(n,"profile","title"),onChange:s=>o("profile","title",s)}),e.jsx(d,{label:"Hero Headline",value:i(n,"profile","headline"),onChange:s=>o("profile","headline",s)}),e.jsx(d,{label:"Contact Email",value:i(n,"profile","email"),onChange:s=>o("profile","email",s)}),e.jsx(d,{label:"Website",value:i(n,"profile","website"),onChange:s=>o("profile","website",s)})]}),e.jsx("h2",{className:"text-lg font-semibold text-foreground pt-4",children:"Social Links"}),e.jsxs("div",{className:"grid gap-4",children:[e.jsx(d,{label:"Instagram URL",value:i(n,"social_links","instagram"),onChange:s=>o("social_links","instagram",s)}),e.jsx(d,{label:"LinkedIn URL",value:i(n,"social_links","linkedin"),onChange:s=>o("social_links","linkedin",s)}),e.jsx(d,{label:"YouTube URL",value:i(n,"social_links","youtube"),onChange:s=>o("social_links","youtube",s)}),e.jsx(d,{label:"Email (mailto)",value:i(n,"social_links","email"),onChange:s=>o("social_links","email",s)})]}),e.jsxs(j,{onClick:()=>E(["profile","social_links"]),disabled:f.isPending||!p,children:[e.jsx(F,{className:"w-4 h-4 mr-2"}),f.isPending?"Saving...":"Save Profile & Social"]})]})}),e.jsx(T,{value:"prompt",children:e.jsxs("div",{className:"space-y-6",children:[e.jsx("h2",{className:"text-lg font-semibold text-foreground",children:"Merlin System Prompt"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Edit the sections that define how Merlin responds. Changes take effect immediately for new conversations."}),e.jsxs("div",{className:"grid gap-6",children:[e.jsx(d,{label:"Assistant Name",value:i(n,"prompt_assistant","name"),onChange:s=>o("prompt_assistant","name",s)}),e.jsx(x,{label:"Assistant Intro / Role",value:i(n,"prompt_assistant","intro"),onChange:s=>o("prompt_assistant","intro",s),rows:3}
16),e.jsx(x,{label:"About (Background, Expertise)",value:i(n,"prompt_about","content"),onChange:s=>o("prompt_about","content",s),rows:12}),e.jsx(x,{label:"Company: crea8or.STUDIO",value:i(n,"prompt_crea8or","content"),onChange:s=>o("prompt_crea8or","content",s),rows:8}),e.jsx(x,{label:"Company: realtySTUDIO",value:i(n,"prompt_realty","content"),onChange:s=>o("prompt_realty","content",s),rows:8}),e.jsx(x,{label:"Newsletter Description",value:i(n,"prompt_newsletter","content"),onChange:s=>o("prompt_newsletter","content",s),rows:6}),e.jsx(x,{label:"Tool Stack (comma-separated)",value:i(n,"prompt_tools","content"),onChange:s=>o("prompt_tools","content",s),rows:2}),e.jsx(x,{label:"Source References",value:i(n,"prompt_sources","content"),onChange:s=>o("prompt_sources","content",s),rows:10}),e.jsx(x,{label:"Personality (Voice, Tone, Behavior)",value:i(n,"prompt_personality","content"),onChange:s=>o("prompt_personality","content",s),rows:12}),e.jsx(x,{label:"Response Formatting Rules",value:i(n,"prompt_formatting","content"),onChange:s=>o("prompt_formatting","content",s),rows:8}),e.jsx(x,{label:"Booking Flow Instructions",value:i(n,"prompt_booking_flow","content"),onChange:s=>o("prompt_booking_flow","content",s),rows:10}),e.jsx(x,{label:"Conversation Flow & Meeting Suggestions",value:i(n,"prompt_conversation_flow","content"),onChange:s=>o("prompt_conversation_flow","content",s),rows:10}),e.jsx(x,{label:"Contact Information",value:i(n,"prompt_contact_info","content"),onChange:s=>o("prompt_contact_info","content",s),rows:6})]}),e.jsxs(j,{onClick:()=>E(["prompt_assistant","prompt_about","prompt_crea8or","prompt_realty","prompt_newsletter","prompt_tools","prompt_sources","prompt_personality","prompt_formatting","prompt_booking_flow","prompt_conversation_flow","prompt_contact_info"]),disabled:f.isPending||!p,children:[e.jsx(F,{className:"w-4 h-4 mr-2"}),f.isPending?"Saving...":"Save Prompt Settings"]})]})}),e.jsx(T,{value:"booking",children:e.jsxs("div",{className:"space-y-6",children:[e.jsx("h2",{className:"text-lg font-semibold text-foreground",children:"Booking / Calendar"}),e.jsxs("div",{className:"grid gap-4",children:[e.jsx(d,{label:"Cal.com Username",value:i(n,"booking_config","cal_username"),onChange:s=>o("booking_config","cal_username",s)}),e.jsx(d,{label:"Cal.com Event Slug",value:i(n,"booking_config","cal_event_slug"),onChange:s=>o("booking_config","cal_event_slug",s)}),e.jsx(d,{label:"Booking Page URL (fallback)",value:i(n,"booking_config","booking_url"),onChange:s=>o("booking_config","booking_url",s)}),e.jsx(d,{label:"Default Timezone",value:i(n,"booking_config","default_timezone"),onChange:s=>
16o("booking_config","default_timezone",s)})]}),e.jsxs(j,{onClick:()=>E(["booking_config"]),disabled:f.isPending||!p,children:[e.jsx(F,{className:"w-4 h-4 mr-2"}),f.isPending?"Saving...":"Save Booking Settings"]})]})}),e.jsx(T,{value:"images",children:e.jsxs("div",{className:"space-y-6",children:[e.jsx("h2",{className:"text-lg font-semibold text-foreground",children:"Product Images"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Upload images that Merlin can reference in responses."}),e.jsx("div",{className:"grid gap-4",children:P?e.jsx("p",{className:"text-muted-foreground text-sm",children:"Loading..."}):b.length===0?e.jsx("p",{className:"text-muted-foreground text-sm",children:"No product images yet."}):b.map(s=>e.jsxs("div",{className:"flex items-center gap-4 p-3 border border-border rounded-lg bg-card",children:[e.jsx("img",{src:s.url,alt:s.label,className:"w-16 h-16 object-cover rounded"}),e.jsxs("div",{className:"flex-1",children:[e.jsx("p",{className:"text-sm font-medium text-foreground",children:s.label||"No label"}),e.jsx("p",{className:"text-xs text-muted-foreground truncate",children:s.url})]}),e.jsx(j,{variant:"ghost",size:"sm",onClick:()=>J.mutate(s.id),disabled:J.isPending,children:e.jsx(Me,{className:"w-4 h-4 text-destructive"})})]},s.id))}),e.jsxs("div",{className:"border border-border rounded-lg p-4 space-y-4 bg-card",children:[e.jsx("h3",{className:"text-sm font-medium text-foreground",children:"Add New Image"}),e.jsxs("div",{className:"grid gap-3",children:[e.jsxs("div",{children:[e.jsx(R,{children:"Upload Image"}),e.jsx(K,{type:"file",accept:"image/*",onChange:ue,disabled:X,className:"mt-1"}),X&&e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Uploading..."})]}),q&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{children:[e.jsx(R,{children:"Image URL"}),e.jsx(K,{value:q,onChange:s=>B(s.target.value),className:"mt-1"})]}),e.jsxs("div",{children:[e.jsx(R,{children:"Label (description for Merlin)"}),e.jsx(K,{value:Y,onChange:s=>G(s.target.value),placeholder:"e.g. realtySTUDIO dashboard screenshot",className:"mt-1"})]}),e.jsxs(j,{onClick:()=>{W.mutate({url:q,label:Y}),B(""),G("")},disabled:!q||W.isPending,size:"sm",children:[e.jsx(Le,{className:"w-4 h-4 mr-2"}),"Add Image"]})]})]})]})]})}),e.jsx(T,{value:"urls",children:e.jsxs("div",{className:"space-y-6",children:[e.jsx("h2",{className:"text-lg font-semibold text-foreground",children:"Product URLs"}),e.jsxs("div",{className:"grid gap-4",children:[e.jsx(d,{label:"realtySTUDIO",value:i(n,"product_urls","realty_studio"),onChange:s=>o("product_urls","realty_studio",s)}),e.jsx(d,{label:"realtySTUDIO AI Agents",value:i(n,"product_urls","realty_agents"),onChange:s=>o("product_urls","realty_agents",s)}),e.jsx(d,{label:"realtySTUDIO Developers",value:i(n,"product_urls","realty_developers"),onChange:s=>o("product_urls","realty_developers",s)}),e.jsx(d,{label:"crea8or Product Studio",value:i(n,"product_urls","crea8or_productstudio"),onChange:s=>o("product_urls","crea8or_productstudio",s)}),e.jsx(d,{label:"crea8or.STUDIO",value:i(n,"product_urls","crea8or_studio"),onChange:s=>o("product_urls","crea8or_studio",s)})]}),e.jsxs(j,{onClick:()=>E(["product_urls"]),disabled:f.isPending||!p,children:[e.jsx(F,{className:"w-4 h-4 mr-2"}),f.isPending?"Saving...":"Save Product URLs"]})]})}),e.jsx(T,{value:"newsletter",children:e.jsxs("div",{className:"space-y-6",children:[e.jsx("h2",{className:"text-lg font-semibold text-foreground",children:"Newsletter"}),e.jsxs("div",{className:"grid gap-4",children:[e.jsx(d,{label:"Newsletter Name",value:i(n,"newsletter","name"),onChange:s=>o("newsletter","name",s)}),e.jsx(d,{label:"Newsletter Tagline",value:i(n,"newsletter","tagline"),onChange:s=>o("newsletter","tagline",s)}),e.jsx(d,{label:"Subscribe URL",value:i(n,"newsletter","url"),onChange:s=>o("newsletter","url",s)})]}),e.jsxs(j,{onClick:()=>E(["newsletter"]),disabled:f.isPending||!p,children:[e.jsx(F,{className:"w-4 h-4 mr-2"}),f.isPending?"Saving...":"Save Newsletter Settings"]})]})})]})})]})]})},d=({label:r,value:t,onChange:a})=>e.jsxs("div",{children:[e.jsx(R,{className:"text-sm",children:r}),e.jsx(K,{value:t,onChange:l=>a(l.target.value),className:"mt-1 bg-secondary"})]}),x=({label:r,value:t,onChange:a,rows:l=4})=>e.jsxs("div",{children:[e.jsxs("div",{className:"flex justify-between items-center mb-1",children:[e.jsx(R,{className:"text-sm",children:r}),e.jsxs("span",{className:"text-xs text-muted-foreground",children:[t.length," chars"]})]}),e.jsx(le,{value:t,onChange:u=>a(u.target.value),rows:l,className:"bg-secondary font-mono text-xs"})]});
16export{Qe as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.