1!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},t=(new e.Error).stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="d7d52a10-0338-4e5a-bd19-653bb1ae4ee3",e._sentryDebugIdIdentifier="sentry-dbid-d7d52a10-0338-4e5a-bd19-653bb1ae4ee3")}catch(e){}}();"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[71358],{28702:(e,t,r)=>{r.d(t,{A:()=>a});var n=r(12115);let a=n.forwardRef(function(e,t){let{title:r,titleId:a,...l}=e;return n.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:t,"aria-labelledby":a},l),r?n.createElement("title",{id:a},r):null,n.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v6m3-3H9m12 0a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z"}))})},71358:(e,t,r)=>{r.r(t),r.d(t,{default:()=>p});var n=r(95155),a=r(12115),l=r(15239),s=r(28702),o=r(93489),i=r(37005),d=r(56868),c=r(27581);function u(e,t){let r="#ffffff";if(e.token){let r=(0,c.$p)(e.token,t,"");if(r&&!(0,c.U8)(r))return r}let n=(e.color||"").trim();if(!n)return r;let a=(0,c.$p)(n,t,r);if(a&&!(0,c.U8)(a))return a;let l=h(n);return m(l)?l:r}function h(e){let t=e.trim();if(/^#[0-9a-fA-F]{3}$/i.test(t)){let e=t.slice(1);return"#"+e[0]+e[0]+e[1]+e[1]+e[2]+e[2]}return t}function m(e){if(!e||"transparent"===e)return null;let t=e.trim(),r=t.match(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)(?:\s*,\s*([\d.]+))?\)/);if(r)return{r:parseInt(r[1],10),g:parseInt(r[2],10),b:parseInt(r[3],10),a:void 0!==r[4]?parseFloat(r[4]):1};let n=t.match(/^#([0-9a-fA-F]{6})$/i);if(n){let e=n[1];return{r:parseInt(e.slice(0,2),16),g:parseInt(e.slice(2,4),16),b:parseInt(e.slice(4,6),16),a:1}}return null}function f(e,t,r){return"#"+[e,t,r].map(e=>Math.round(e).toString(16).padStart(2,"0")).join("")}function p(e){let{label:t,value:r,onChange:p,onClear:x,placeholder:g="Transparent",className:b="",theme:w,alwaysShowBrandColors:k=!1,variant:y="dark",compact:v=!1,businessId:j,onBrandPaletteUpdated:N,allowAddToBrandPalette:C=!0,showAutoContrastSwatches:_,persistThemeTokens:T=!0}=e,{theme:U,brandPaletteForColorPickers:S,refreshBrandPalette:M}=(0,i.Rc)(),I="light"===y,A=I?"border-gray-400":"border-white/20",[R,E]=(0,a.useState)(!1),[F,O]=(0,a.useState)(r||"#ffffff"),[P,B]=(0,a.useState)(100),[H,$]=(0,a.useState)("Custom color"),[D,q]=(0,a.useState)(!1),[L,W]=(0,a.useState)(null),z=j||(null==U?void 0:U.business_id)||"",V=null!=N?N:M,Z=C&&!!z&&(!!N||!!U),G=(0,a.useMemo)(()=>{var e;return S?{...w||{},...S}:null!=(e=null!=w?w:U)?e:null},[w,S,U]),J=(0,a.useMemo)(()=>{if(!G)return[];let e=(e,t,r)=>{let n=u({token:t,color:r||void 0},G);return!n||(0,c.U8)(n)||!m(h(n))?null:{name:e,color:n,token:t}};return[e("Primary","theme-primary",G.primary_color),e("Secondary","theme-secondary",G.secondary_color),e("Accent","theme-accent",G.accent_color),e("Background","theme-background",G.background_color),e("Text","theme-text",G.text_color),e("Heading","theme-heading",G.heading_color),...(G.additionalColors||[]).map(e=>{let t=u({color:e.hex},G);return t&&m(h(t))?{name:e.name,color:t}:null})].filter(e=>null!=e)},[G]),K=(0,a.useMemo)(()=>G?[{surface:G.primary_color,name:"On Primary",pairedRole:"Primary",token:"theme-on-primary"},{surface:G.secondary_color,name:"On Secondary",pairedRole:"Secondary",token:"theme-on-secondary"},{surface:G.accent_color,name:"On Accent",pairedRole:"Accent",token:"theme-on-accent"},{surface:G.background_color,name:"On Background",pairedRole:"Background",token:"theme-on-background"},{surface:G.heading_color,name:"On Heading",pairedRole:"Heading",token:"theme-on-heading"}].filter(e=>!!e.surface).map(e=>{let t=(0,c.resolveThemeColorToken)(e.token,G||null);return{name:e.name,pairedRole:e.pairedRole,token:e.token,resolvedColor:"string"==typeof t?t:"#FFFFFF"}}):[],[G]),Q=!1===_?[]:K;(0,a.useEffect)(()=>{if(R)return;if((0,c.U8)(r)){O(r),B(100);return}let e=r?h(r.trim()):"",t=e?m(e):null;t?(O(e),B(Math.round(100*t.a))):(O("#ffffff"),B(100))},[r,R]);let X=(0,a.useCallback)(()=>
1{if((0,c.U8)(r)){O(r),B(100),W(null),E(!0);return}let e=r?h(r.trim()):"",t=e?m(e):null;t?(O(e),B(Math.round(100*t.a))):(O("#ffffff"),B(100)),W(null),E(!0)},[r]),Y=(e,t)=>{var r,n,a,l;let s=m(e);return s?(r=s.r,n=s.g,a=s.b,(l=t/100)>=1?f(r,n,a):"rgba(".concat(Math.round(r),", ").concat(Math.round(n),", ").concat(Math.round(a),", ").concat(Math.round(100*l)/100,")")):e},ee=e=>{O(e),B(100)},et=e=>{O(e),B(100)},er=(0,a.useMemo)(()=>{let e=F;if((0,c.U8)(e)){let t=(0,c.resolveThemeColorToken)(e,G||null);e="string"==typeof t?t:"#ffffff"}return Y(h(String(e).trim()),P)},[F,P,G]),en=async()=>{if(Z&&z){W(null),q(!0);try{let e=F;if((0,c.U8)(e)){let t=(0,c.resolveThemeColorToken)(e,G||null);e="string"==typeof t?t:e}let t=h(e.trim()),r=Y(t,P),n=await (0,d.UF)(z,r,H,null!=G?G:null);if(!n.ok)return void W({type:"err",text:n.error});W({type:"ok",text:"Added to brand palette"}),V&&await Promise.resolve(V())}catch(e){W({type:"err",text:e instanceof Error?e.message:"Could not save"})}finally{q(!1)}}};return(0,n.jsxs)("div",{className:b,children:[(0,n.jsx)("button",{type:"button",onClick:X,className:v?"flex items-center justify-center p-0.5 rounded-md border-2 transition-all hover:opacity-90 group ".concat(A):"w-full flex items-center gap-3 transition-all group",children:(0,n.jsxs)("div",{className:v?"flex items-center justify-center":"flex items-center gap-3",children:[(0,n.jsx)("div",{className:v?"w-8 h-8 rounded-md":"w-10 h-10 rounded-lg border-2 shadow-sm ".concat(I?"border-gray-400 ring-1 ring-black/10":A),style:{backgroundColor:(e=>{if(!e)return e;if((0,c.U8)(e)){let t=(0,c.resolveThemeColorToken)(e,G||null);return"string"==typeof t?t:e}return e})(r)||"transparent"},title:(0,c.U8)(r)?"".concat((0,c.NH)(r)," (").concat(r,")"):void 0}),!v&&(0,n.jsxs)("span",{className:"block text-xs font-medium text-left ".concat(I?"text-gray-700":"text-white/70"),children:[t,(0,c.U8)(r)?(0,n.jsx)("span",{className:"ml-1 text-[10px] uppercase tracking-wide text-emerald-500/80",children:(0,c.NH)(r)}):null]})]})}),(0,n.jsx)(o.Ay,{isOpen:R,onClose:()=>{E(!1),W(null)},title:t,icon:(0,n.jsx)(l.default,{src:"/logos/marketninja-icon-wht-1.png",alt:"MarketNinja",width:40,height:40,className:"h-9 w-9 object-contain sm:h-10 sm:w-10",priority:!0}
1),maxWidth:"900",footer:(0,n.jsxs)(o.b,{className:"w-full justify-between",children:[(0,n.jsx)("button",{onClick:()=>{x(),E(!1)},className:"px-4 py-2 text-sm font-medium text-white/70 hover:text-white hover:bg-white/5 rounded-lg transition-all",children:"Clear"}),(0,n.jsxs)("div",{className:"flex gap-2",children:[(0,n.jsx)("button",{onClick:()=>E(!1),className:"px-4 py-2 text-sm font-medium bg-white/10 hover:bg-white/20 text-white rounded-lg transition-all",children:"Cancel"}),(0,n.jsx)("button",{onClick:()=>{let e;if(T&&(0,c.U8)(F)&&P>=100)e=F;else{let t=F,r=(0,c.$p)(t,G||null,"");r&&!(0,c.U8)(r)?t=r:(0,c.U8)(t)&&(t="#ffffff");let n=h(t.trim());e=m(n)?Y(n,P):Y("#ffffff",P)}E(!1),queueMicrotask(()=>p(e))},className:"px-4 py-2 text-sm font-medium bg-white text-black hover:bg-white/90 rounded-lg transition-all",children:"Apply"})]})]}),children:(0,n.jsx)(o.VT,{className:"space-y-5",children:(0,n.jsxs)("div",{className:"grid gap-6 ".concat(J.length>0||Q.length>0?"grid-cols-1 lg:grid-cols-2":"grid-cols-1"),children:[(0,n.jsxs)("div",{className:"rounded-xl border border-white/10 bg-white/[0.04] p-4 min-w-0 space-y-4",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("p",{className:"text-xs font-semibold text-white/90 tracking-wide uppercase",children:"Custom"}),(0,n.jsx)("p",{className:"text-[11px] text-white/45 mt-0.5 leading-snug",children:"Pick a literal color, adjust opacity, then Apply. Brand tokens below stay linked to each business."})]}),(0,n.jsxs)("div",{className:"flex flex-wrap items-stretch gap-3",children:[(0,n.jsx)("input",{type:"color",value:(()=>{if((0,c.U8)(F)){let e=(0,c.resolveThemeColorToken)(F,G||null);if("string"==typeof e){let t=m(e);if(t)return f(t.r,t.g,t.b)}return"#ffffff"}let e=m(F);return e?f(e.r,e.g,e.b):"#ffffff"})(),onChange:e=>O(e.target.value),className:"w-14 h-14 rounded-xl border border-white/20 cursor-pointer transition-all hover:scale-[1.02] shrink-0",style:{background:"rgba(255, 255, 255, 0.05)"},"aria-label":"Color wheel"}),(0,n.jsxs)("div",{className:"flex-1 min-w-[8rem] flex flex-col gap-2",children:[(0,n.jsx)("label",{className:"sr-only",children:"Color value"}),(0,n.jsx)("input",{type:"text",value:(0,c.U8)(F)?(0,c.NH)(F):Y(F,P),onChange:e=>{let t=e.target.value.trim(),r=m(t);r?(O(t),B(Math.round(100*r.a))):(O(t),B(100))},autoComplete:"off",autoCorrect:"off",spellCheck:!1,"data-1p-ignore":!0,"data-lpignore":"true",placeholder:g,className:"w-full bg-white/5 border border-white/10 rounded-lg px-3 py-2.5 text-white placeholder-white/40 text-sm focus:outline-none focus:ring-2 focus:ring-white/30 focus:border-white/20 transition-all"}),(0,n.jsxs)("div",{className:"flex items-center gap-3",children:[(0,n.jsx)("div",{className:"h-10 w-14 rounded-lg border border-white/15 shrink-0 overflow-hidden relative",title:"Preview with transparency",style:{backgroundColor:"#2a2a2a",backgroundImage:"linear-gradient(45deg, #3f3f3f 25%, transparent 25%), linear-gradient(-45deg, #3f3f3f 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #3f3f3f 75%), linear-gradient(-45deg, transparent 75%, #3f3f3f 75%)",backgroundSize:"8px 8px",backgroundPosition:"0 0, 0 4px, 4px -4px, -4px 0px"},children:(0,n.jsx)("div",{className:"absolute inset-0",style:{backgroundColor:er}})}),(0,n.jsx)("p",{className:"text-[10px] text-white/40 leading-snug flex-1",children:"Preview shows transparency over a checkerboard."})]})]})]}),(0,n.jsxs)("div",{className:"space-y-2",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,n.jsx)("span",{className:"text-xs font-medium text-white/70",children:"Opacity"}),(0,n.jsxs)("span",{className:"text-xs text-white/55 tabular-nums",children:[P,"%"]})]}),(0,n.jsx)("input",{type:"range",min:0,max:100,value:P,onChange:e=>B(parseInt(e.target.value,10)),className:"w-full h-2 rounded-lg appearance-none cursor-pointer bg-white/10 [&::-webkit-slider-thumb]:appearance-none [&::-webkit-slider-thumb]:w-4 [&::-webkit-slider-thumb]:h-4 [&::-webkit-slider-thumb]:rounded-full [&::-webkit-slider-thumb]:bg-white [&::-webkit-slider-thumb]:cursor-pointer"}),(0,n.jsxs)("p",{className:"text-[10px] text-white/40 leading-snug",children:["Opacity below 100% saves a fixed ",(0,n.jsx)("span",{className:"text-white/55",children:"rgba"})," value (brand tokens need 100%)."]})]}),Z&&(0,n.jsxs)("div",{className:"pt-3 border-t border-white/10 space-y-2",children:[(0,n.jsx)("div",{className:"flex items-center justify-between gap-2 flex-wrap",children:(0,n.jsx)("span",{className:"text-xs font-medium text-white/80",children:"Add to brand palette"})}),(0,n.jsx)("p",{className:"text-[11px] text-white/45 leading-snug",children:"Save the staged color (including opacity) as an extra swatch in your brand guide."}),(0,n.jsxs)("div",{className:"flex flex-wrap items-stretch gap-2",children:[(0,n.jsx)("input",{type:"text",value:H,onChange:e=>$(e.target.value),autoComplete:"off",placeholder:"Swatch name",className:"min-w-0 flex-1 bg-white/5 border border-white/10 rounded-lg px-3 py-2 text-white text-sm placeholder-white/40 focus:outline-none focus:ring-2 focus:ring-white/30"}),(0,n.jsxs)("button",{type:"button",onClick:en,disabled:D,className:"shrink-0 inline-flex items-center justify-center gap-1.5 px-4 py-2 rounded-lg text-sm font-medium bg-[#1c7aa2]/90 hover:bg-[#1c7aa2] text-white border border-white/10 disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:[(0,n.jsx)(s.A,{className:"w-5 h-5 shrink-0"}),D?"Savingâ¦":"Add"]})]}),L&&(0,n.jsx)("p",{className:"text-xs ".concat("ok"===L.type?"text-emerald-400":"text-amber-300"),children:L.text})]})]}),(J.length>0||Q.length>0)&&(0,n.jsxs)("div",{className:"space-y-5 min-w-0",children:[J.length>0&&(0,n.jsxs)("div",{className:"space-y-2",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("p",{className:"text-xs font-semibold text-white/90 tracking-wide uppercase",children:"Brand palette"}),(0,n.jsx)("p",{className:"text-[11px] text-white/45 mt-0.5 leading-snug",children:T?"Each slot saves as a theme token so templates follow this business's roles when generated.":"Each slot applies this businessâs current brand color to the canvas."})]}),(0,n.jsx)("div",{className:"grid grid-cols-4 sm:grid-cols-4 gap-2",children:J.map((e,t)=>{let r=e.token?F===e.token:F===e.color;return(0,n.jsxs)("button",{type:"button",onClick:()=>e.token&&T?et(e.token):ee(u(e,G||null)),className:"group flex flex-col items-center gap-1.5 rounded-lg p-1.5 border transition-all hover:bg-white/[0.06] ".concat(r?"ring-2 ring-emerald-400/70 border-white/50 bg-white/[0.06]":"border-white/15 hover:border-white/35"),title:e.token?"".concat(e.name," â saves as ").concat(e.token," so it adapts to each business"):"".concat(e.name,": ").concat(e.color),children:[(0,n.jsx)("span",{className:"w-full aspect-square max-h-[3.25rem] rounded-md border border-black/20 shadow-inner",style:{backgroundColor:e.color}}),(0,n.jsx)("span",{className:"text-[10px] font-medium text-white/70 leading-none text-center truncate w-full px-0.5",children:e.name})]},t)})})]}),Q.length>0&&(0,n.jsxs)("div",{className:"rounded-xl border border-white/10 bg-white/[0.03] p-3 space-y-2",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("p",{className:"text-xs font-semibold text-white/90 tracking-wide uppercase",children:"Contrast on brand surfaces"}),(0,n.jsx)("p",{className:"text-[11px] text-white/45 mt-0.5 leading-snug",children:"Template tokens for text and icons on top of each brand role. They resolve to light or dark per business."})]}),(0,n.jsx)("div",{className:"grid grid-cols-2 sm:grid-cols-3 gap-2",children:Q.map((e,t)=>{let r=F===e.token;return(0,n.jsxs)("button",{type:"button",onClick:()=>T?et(e.token):ee(e.resolvedColor),className:"flex flex-col items-stretch gap-1 rounded-lg p-2 border text-left transition-all hover:bg-white/[0.06] ".concat(r?"ring-2 ring-emerald-400/70 border-white/50 bg-white/[0.06]":"border-white/15 hover:border-white/35"),title:"".concat(e.name," â ").concat(e.token,"; readable on ").concat(e.pairedRole),children:[(0,n.jsx)("span",{className:"w-full h-9 rounded-md border border-black/25 shrink-0",style:{backgroundColor:e.resolvedColor}}),(0,n.jsx)("span",{className:"text-[11px] font-medium text-white/85 leading-tight",children:e.name}),(0,n.jsxs)("span",{className:"text-[10px] text-white/45 leading-tight",children:["on ",e.pairedRole]})]},t)})})]})]})]})})})]})}}}]);
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.