admesh-ui-sdk 0.17.0 → 0.18.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.
@@ -1 +1 @@
1
- {"version":3,"file":"AdMeshProductCard.d.ts","sourceRoot":"","sources":["../../src/components/AdMeshProductCard.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA4B,MAAM,OAAO,CAAC;AAEjD,OAAO,KAAK,EAAE,sBAAsB,EAAa,MAAM,gBAAgB,CAAC;AAUxE,eAAO,MAAM,iBAAiB,EAAE,KAAK,CAAC,EAAE,CAAC,sBAAsB,CAgW9D,CAAC"}
1
+ {"version":3,"file":"AdMeshProductCard.d.ts","sourceRoot":"","sources":["../../src/components/AdMeshProductCard.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA4B,MAAM,OAAO,CAAC;AAEjD,OAAO,KAAK,EAAE,sBAAsB,EAAa,MAAM,gBAAgB,CAAC;AASxE,eAAO,MAAM,iBAAiB,EAAE,KAAK,CAAC,EAAE,CAAC,sBAAsB,CAoV9D,CAAC"}
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("react");function Se(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Z={exports:{}},J={};/**
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("react");function Se(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Q={exports:{}},Y={};/**
2
2
  * @license React
3
3
  * react-jsx-runtime.production.js
4
4
  *
@@ -6,7 +6,7 @@
6
6
  *
7
7
  * This source code is licensed under the MIT license found in the
8
8
  * LICENSE file in the root directory of this source tree.
9
- */var le;function je(){if(le)return J;le=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function o(d,n,s){var a=null;if(s!==void 0&&(a=""+s),n.key!==void 0&&(a=""+n.key),"key"in n){s={};for(var c in n)c!=="key"&&(s[c]=n[c])}else s=n;return n=s.ref,{$$typeof:e,type:d,key:a,ref:n!==void 0?n:null,props:s}}return J.Fragment=t,J.jsx=o,J.jsxs=o,J}var X={};/**
9
+ */var le;function je(){if(le)return Y;le=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function o(d,n,i){var a=null;if(i!==void 0&&(a=""+i),n.key!==void 0&&(a=""+n.key),"key"in n){i={};for(var c in n)c!=="key"&&(i[c]=n[c])}else i=n;return n=i.ref,{$$typeof:e,type:d,key:a,ref:n!==void 0?n:null,props:i}}return Y.Fragment=t,Y.jsx=o,Y.jsxs=o,Y}var G={};/**
10
10
  * @license React
11
11
  * react-jsx-runtime.development.js
12
12
  *
@@ -14,16 +14,16 @@
14
14
  *
15
15
  * This source code is licensed under the MIT license found in the
16
16
  * LICENSE file in the root directory of this source tree.
17
- */var me;function Me(){return me||(me=1,process.env.NODE_ENV!=="production"&&function(){function e(i){if(i==null)return null;if(typeof i=="function")return i.$$typeof===k?null:i.displayName||i.name||null;if(typeof i=="string")return i;switch(i){case S:return"Fragment";case j:return"Profiler";case w:return"StrictMode";case L:return"Suspense";case g:return"SuspenseList";case v:return"Activity"}if(typeof i=="object")switch(typeof i.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),i.$$typeof){case C:return"Portal";case M:return(i.displayName||"Context")+".Provider";case A:return(i._context.displayName||"Context")+".Consumer";case O:var y=i.render;return i=i.displayName,i||(i=y.displayName||y.name||"",i=i!==""?"ForwardRef("+i+")":"ForwardRef"),i;case _:return y=i.displayName||null,y!==null?y:e(i.type)||"Memo";case l:y=i._payload,i=i._init;try{return e(i(y))}catch{}}return null}function t(i){return""+i}function o(i){try{t(i);var y=!1}catch{y=!0}if(y){y=console;var T=y.error,N=typeof Symbol=="function"&&Symbol.toStringTag&&i[Symbol.toStringTag]||i.constructor.name||"Object";return T.call(y,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",N),t(i)}}function d(i){if(i===S)return"<>";if(typeof i=="object"&&i!==null&&i.$$typeof===l)return"<...>";try{var y=e(i);return y?"<"+y+">":"<...>"}catch{return"<...>"}}function n(){var i=I.A;return i===null?null:i.getOwner()}function s(){return Error("react-stack-top-frame")}function a(i){if(V.call(i,"key")){var y=Object.getOwnPropertyDescriptor(i,"key").get;if(y&&y.isReactWarning)return!1}return i.key!==void 0}function c(i,y){function T(){z||(z=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",y))}T.isReactWarning=!0,Object.defineProperty(i,"key",{get:T,configurable:!0})}function p(){var i=e(this.type);return q[i]||(q[i]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),i=this.props.ref,i!==void 0?i:null}function f(i,y,T,N,D,F,te,re){return T=F.ref,i={$$typeof:x,type:i,key:y,props:F,_owner:D},(T!==void 0?T:null)!==null?Object.defineProperty(i,"ref",{enumerable:!1,get:p}):Object.defineProperty(i,"ref",{enumerable:!1,value:null}),i._store={},Object.defineProperty(i._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(i,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(i,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:te}),Object.defineProperty(i,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:re}),Object.freeze&&(Object.freeze(i.props),Object.freeze(i)),i}function h(i,y,T,N,D,F,te,re){var R=y.children;if(R!==void 0)if(N)if(E(R)){for(N=0;N<R.length;N++)m(R[N]);Object.freeze&&Object.freeze(R)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else m(R);if(V.call(y,"key")){R=e(i);var W=Object.keys(y).filter(function(Te){return Te!=="key"});N=0<W.length?"{key: someKey, "+W.join(": ..., ")+": ...}":"{key: someKey}",P[R+N]||(W=0<W.length?"{"+W.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
17
+ */var me;function Me(){return me||(me=1,process.env.NODE_ENV!=="production"&&function(){function e(s){if(s==null)return null;if(typeof s=="function")return s.$$typeof===k?null:s.displayName||s.name||null;if(typeof s=="string")return s;switch(s){case S:return"Fragment";case j:return"Profiler";case y:return"StrictMode";case I:return"Suspense";case p:return"SuspenseList";case v:return"Activity"}if(typeof s=="object")switch(typeof s.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),s.$$typeof){case C:return"Portal";case M:return(s.displayName||"Context")+".Provider";case R:return(s._context.displayName||"Context")+".Consumer";case V:var b=s.render;return s=s.displayName,s||(s=b.displayName||b.name||"",s=s!==""?"ForwardRef("+s+")":"ForwardRef"),s;case _:return b=s.displayName||null,b!==null?b:e(s.type)||"Memo";case l:b=s._payload,s=s._init;try{return e(s(b))}catch{}}return null}function t(s){return""+s}function o(s){try{t(s);var b=!1}catch{b=!0}if(b){b=console;var T=b.error,N=typeof Symbol=="function"&&Symbol.toStringTag&&s[Symbol.toStringTag]||s.constructor.name||"Object";return T.call(b,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",N),t(s)}}function d(s){if(s===S)return"<>";if(typeof s=="object"&&s!==null&&s.$$typeof===l)return"<...>";try{var b=e(s);return b?"<"+b+">":"<...>"}catch{return"<...>"}}function n(){var s=D.A;return s===null?null:s.getOwner()}function i(){return Error("react-stack-top-frame")}function a(s){if(L.call(s,"key")){var b=Object.getOwnPropertyDescriptor(s,"key").get;if(b&&b.isReactWarning)return!1}return s.key!==void 0}function c(s,b){function T(){U||(U=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",b))}T.isReactWarning=!0,Object.defineProperty(s,"key",{get:T,configurable:!0})}function u(){var s=e(this.type);return P[s]||(P[s]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),s=this.props.ref,s!==void 0?s:null}function g(s,b,T,N,$,F,te,re){return T=F.ref,s={$$typeof:x,type:s,key:b,props:F,_owner:$},(T!==void 0?T:null)!==null?Object.defineProperty(s,"ref",{enumerable:!1,get:u}):Object.defineProperty(s,"ref",{enumerable:!1,value:null}),s._store={},Object.defineProperty(s._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(s,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(s,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:te}),Object.defineProperty(s,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:re}),Object.freeze&&(Object.freeze(s.props),Object.freeze(s)),s}function w(s,b,T,N,$,F,te,re){var A=b.children;if(A!==void 0)if(N)if(E(A)){for(N=0;N<A.length;N++)m(A[N]);Object.freeze&&Object.freeze(A)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else m(A);if(L.call(b,"key")){A=e(s);var H=Object.keys(b).filter(function(Te){return Te!=="key"});N=0<H.length?"{key: someKey, "+H.join(": ..., ")+": ...}":"{key: someKey}",ee[A+N]||(H=0<H.length?"{"+H.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
18
18
  let props = %s;
19
19
  <%s {...props} />
20
20
  React keys must be passed directly to JSX without using spread:
21
21
  let props = %s;
22
- <%s key={someKey} {...props} />`,N,R,W,R),P[R+N]=!0)}if(R=null,T!==void 0&&(o(T),R=""+T),a(y)&&(o(y.key),R=""+y.key),"key"in y){T={};for(var ae in y)ae!=="key"&&(T[ae]=y[ae])}else T=y;return R&&c(T,typeof i=="function"?i.displayName||i.name||"Unknown":i),f(i,R,F,D,n(),T,te,re)}function m(i){typeof i=="object"&&i!==null&&i.$$typeof===x&&i._store&&(i._store.validated=1)}var b=u,x=Symbol.for("react.transitional.element"),C=Symbol.for("react.portal"),S=Symbol.for("react.fragment"),w=Symbol.for("react.strict_mode"),j=Symbol.for("react.profiler"),A=Symbol.for("react.consumer"),M=Symbol.for("react.context"),O=Symbol.for("react.forward_ref"),L=Symbol.for("react.suspense"),g=Symbol.for("react.suspense_list"),_=Symbol.for("react.memo"),l=Symbol.for("react.lazy"),v=Symbol.for("react.activity"),k=Symbol.for("react.client.reference"),I=b.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,V=Object.prototype.hasOwnProperty,E=Array.isArray,$=console.createTask?console.createTask:function(){return null};b={"react-stack-bottom-frame":function(i){return i()}};var z,q={},Y=b["react-stack-bottom-frame"].bind(b,s)(),G=$(d(s)),P={};X.Fragment=S,X.jsx=function(i,y,T,N,D){var F=1e4>I.recentlyCreatedOwnerStacks++;return h(i,y,T,!1,N,D,F?Error("react-stack-top-frame"):Y,F?$(d(i)):G)},X.jsxs=function(i,y,T,N,D){var F=1e4>I.recentlyCreatedOwnerStacks++;return h(i,y,T,!0,N,D,F?Error("react-stack-top-frame"):Y,F?$(d(i)):G)}}()),X}var ue;function Ee(){return ue||(ue=1,process.env.NODE_ENV==="production"?Z.exports=je():Z.exports=Me()),Z.exports}var r=Ee();const Ne=e=>{try{return new URL(e),!0}catch{return!1}},pe=(e,t)=>{const o=new Map;t.forEach(p=>{p.admesh_link&&o.set(p.admesh_link,p)});const d=/\[([^\]]+)\]\(([^)]+)\)/g,n=[];let s=0,a,c=0;for(;(a=d.exec(e))!==null;){const[p,f,h]=a,m=o.get(h);a.index>s&&n.push(e.slice(s,a.index)),m?(c++,n.push(r.jsx("a",{href:m.admesh_link,target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 dark:text-blue-400 hover:text-blue-800 dark:hover:text-blue-300 underline decoration-blue-600 dark:decoration-blue-400 hover:decoration-blue-800 dark:hover:decoration-blue-300 transition-colors duration-200 font-medium",style:{color:"#2563eb",textDecoration:"underline",textDecorationColor:"#2563eb",textUnderlineOffset:"2px"},onClick:b=>{console.log("AdMesh summary link clicked:",{adId:m.ad_id,productId:m.product_id,title:m.title||m.recommendation_title,brand:m.brand,pricing:m.pricing,admeshLink:m.admesh_link,source:"summary"}),typeof window<"u"&&window.admeshTracker&&window.admeshTracker.trackClick({adId:m.ad_id,productId:m.product_id,admeshLink:m.admesh_link,source:"summary"})},children:f},`summary-link-${c}`))):(console.warn(`[AdMesh Summary] No recommendation found for link: [${f}](${h}), creating regular link`),Ne(h)?(c++,n.push(r.jsx("a",{href:h,target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 dark:text-blue-400 hover:text-blue-800 dark:hover:text-blue-300 underline decoration-blue-600 dark:decoration-blue-400 hover:decoration-blue-800 dark:hover:decoration-blue-300 transition-colors duration-200 font-medium",style:{color:"#2563eb",textDecoration:"underline",textDecorationColor:"#2563eb",textUnderlineOffset:"2px"},onClick:b=>{console.log("AdMesh summary unmatched link clicked:",{linkText:f,url:h,source:"summary"}),typeof window<"u"&&window.admeshTracker&&window.admeshTracker.trackClick({url:h,linkText:f,source:"summary_unmatched"})},children:f},`summary-link-${c}`))):(console.warn(`[AdMesh Summary] Invalid URL in markdown link: [${f}](${h})`),n.push(f))),s=a.index+p.length}return s<e.length&&n.push(e.slice(s)),n},se=({summaryText:e,recommendations:t,theme:o,className:d="",style:n={},onLinkClick:s})=>{if(!e||!e.trim())return console.warn("[AdMesh Summary] No summary text provided"),null;if(!t||t.length===0){console.warn("[AdMesh Summary] No recommendations provided");const c=pe(e,[]);return r.jsx("div",{className:`admesh-summary-unit ${d}`,style:n,children:r.jsx("p",{className:"text-gray-700 dark:text-gray-300 leading-relaxed",children:c.map((p,f)=>r.jsx(u.Fragment,{children:p},f))})})}const a=pe(e,t);return r.jsxs("div",{className:`admesh-summary-unit ${d}`,style:{fontFamily:(o==null?void 0:o.fontFamily)||'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',...n},children:[r.jsx("div",{className:"summary-content",children:r.jsx("p",{className:"text-gray-700 dark:text-gray-300 leading-relaxed text-base",children:a.map((c,p)=>r.jsx(u.Fragment,{children:c},p))})}),r.jsx("div",{className:"mt-3 pt-2 border-t border-gray-200 dark:border-gray-700",children:r.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:"Sponsored"})})]})};var oe={exports:{}};/*!
22
+ <%s key={someKey} {...props} />`,N,A,H,A),ee[A+N]=!0)}if(A=null,T!==void 0&&(o(T),A=""+T),a(b)&&(o(b.key),A=""+b.key),"key"in b){T={};for(var ae in b)ae!=="key"&&(T[ae]=b[ae])}else T=b;return A&&c(T,typeof s=="function"?s.displayName||s.name||"Unknown":s),g(s,A,F,$,n(),T,te,re)}function m(s){typeof s=="object"&&s!==null&&s.$$typeof===x&&s._store&&(s._store.validated=1)}var h=f,x=Symbol.for("react.transitional.element"),C=Symbol.for("react.portal"),S=Symbol.for("react.fragment"),y=Symbol.for("react.strict_mode"),j=Symbol.for("react.profiler"),R=Symbol.for("react.consumer"),M=Symbol.for("react.context"),V=Symbol.for("react.forward_ref"),I=Symbol.for("react.suspense"),p=Symbol.for("react.suspense_list"),_=Symbol.for("react.memo"),l=Symbol.for("react.lazy"),v=Symbol.for("react.activity"),k=Symbol.for("react.client.reference"),D=h.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,L=Object.prototype.hasOwnProperty,E=Array.isArray,O=console.createTask?console.createTask:function(){return null};h={"react-stack-bottom-frame":function(s){return s()}};var U,P={},z=h["react-stack-bottom-frame"].bind(h,i)(),K=O(d(i)),ee={};G.Fragment=S,G.jsx=function(s,b,T,N,$){var F=1e4>D.recentlyCreatedOwnerStacks++;return w(s,b,T,!1,N,$,F?Error("react-stack-top-frame"):z,F?O(d(s)):K)},G.jsxs=function(s,b,T,N,$){var F=1e4>D.recentlyCreatedOwnerStacks++;return w(s,b,T,!0,N,$,F?Error("react-stack-top-frame"):z,F?O(d(s)):K)}}()),G}var ue;function Ee(){return ue||(ue=1,process.env.NODE_ENV==="production"?Q.exports=je():Q.exports=Me()),Q.exports}var r=Ee();const Ne=e=>{try{return new URL(e),!0}catch{return!1}},pe=(e,t)=>{const o=new Map;t.forEach(u=>{u.admesh_link&&o.set(u.admesh_link,u)});const d=/\[([^\]]+)\]\(([^)]+)\)/g,n=[];let i=0,a,c=0;for(;(a=d.exec(e))!==null;){const[u,g,w]=a,m=o.get(w);a.index>i&&n.push(e.slice(i,a.index)),m?(c++,n.push(r.jsx("a",{href:m.admesh_link,target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 dark:text-blue-400 hover:text-blue-800 dark:hover:text-blue-300 underline decoration-blue-600 dark:decoration-blue-400 hover:decoration-blue-800 dark:hover:decoration-blue-300 transition-colors duration-200 font-medium",style:{color:"#2563eb",textDecoration:"underline",textDecorationColor:"#2563eb",textUnderlineOffset:"2px"},onClick:h=>{console.log("AdMesh summary link clicked:",{adId:m.ad_id,productId:m.product_id,title:m.title||m.recommendation_title,brand:m.brand,pricing:m.pricing,admeshLink:m.admesh_link,source:"summary"}),typeof window<"u"&&window.admeshTracker&&window.admeshTracker.trackClick({adId:m.ad_id,productId:m.product_id,admeshLink:m.admesh_link,source:"summary"})},children:g},`summary-link-${c}`))):(console.warn(`[AdMesh Summary] No recommendation found for link: [${g}](${w}), creating regular link`),Ne(w)?(c++,n.push(r.jsx("a",{href:w,target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 dark:text-blue-400 hover:text-blue-800 dark:hover:text-blue-300 underline decoration-blue-600 dark:decoration-blue-400 hover:decoration-blue-800 dark:hover:decoration-blue-300 transition-colors duration-200 font-medium",style:{color:"#2563eb",textDecoration:"underline",textDecorationColor:"#2563eb",textUnderlineOffset:"2px"},onClick:h=>{console.log("AdMesh summary unmatched link clicked:",{linkText:g,url:w,source:"summary"}),typeof window<"u"&&window.admeshTracker&&window.admeshTracker.trackClick({url:w,linkText:g,source:"summary_unmatched"})},children:g},`summary-link-${c}`))):(console.warn(`[AdMesh Summary] Invalid URL in markdown link: [${g}](${w})`),n.push(g))),i=a.index+u.length}return i<e.length&&n.push(e.slice(i)),n},se=({summaryText:e,recommendations:t,theme:o,className:d="",style:n={},onLinkClick:i})=>{if(!e||!e.trim())return console.warn("[AdMesh Summary] No summary text provided"),null;if(!t||t.length===0){console.warn("[AdMesh Summary] No recommendations provided");const c=pe(e,[]);return r.jsx("div",{className:`admesh-summary-unit ${d}`,style:n,children:r.jsx("p",{className:"text-gray-700 dark:text-gray-300 leading-relaxed",children:c.map((u,g)=>r.jsx(f.Fragment,{children:u},g))})})}const a=pe(e,t);return r.jsxs("div",{className:`admesh-summary-unit ${d}`,style:{fontFamily:(o==null?void 0:o.fontFamily)||'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',...n},children:[r.jsx("div",{className:"summary-content",children:r.jsx("p",{className:"text-gray-700 dark:text-gray-300 leading-relaxed text-base",children:a.map((c,u)=>r.jsx(f.Fragment,{children:c},u))})}),r.jsx("div",{className:"mt-3 pt-2 border-t border-gray-200 dark:border-gray-700",children:r.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:"Sponsored"})})]})};var oe={exports:{}};/*!
23
23
  Copyright (c) 2018 Jed Watson.
24
24
  Licensed under the MIT License (MIT), see
25
25
  http://jedwatson.github.io/classnames
26
- */var he;function Re(){return he||(he=1,function(e){(function(){var t={}.hasOwnProperty;function o(){for(var s="",a=0;a<arguments.length;a++){var c=arguments[a];c&&(s=n(s,d(c)))}return s}function d(s){if(typeof s=="string"||typeof s=="number")return s;if(typeof s!="object")return"";if(Array.isArray(s))return o.apply(null,s);if(s.toString!==Object.prototype.toString&&!s.toString.toString().includes("[native code]"))return s.toString();var a="";for(var c in s)t.call(s,c)&&s[c]&&(a=n(a,c));return a}function n(s,a){return a?s?s+" "+a:s+a:s}e.exports?(o.default=o,e.exports=o):window.classNames=o})()}(oe)),oe.exports}var Ae=Re();const U=Se(Ae),Pe="https://api.useadmesh.com/track";let ie={apiBaseUrl:Pe,enabled:!0,debug:!1,retryAttempts:3,retryDelay:1e3};const De=e=>{ie={...ie,...e}},be=e=>{const[t,o]=u.useState(!1),[d,n]=u.useState(null),s=u.useMemo(()=>({...ie,...e}),[e]),a=u.useCallback((m,b)=>{s.debug&&console.log(`[AdMesh Tracker] ${m}`,b)},[s.debug]),c=u.useCallback(async(m,b)=>{if(!s.enabled){a("Tracking disabled, skipping event",{eventType:m,data:b});return}if(!b.adId||!b.admeshLink){const w="Missing required tracking data: adId and admeshLink are required";a(w,b),n(w);return}o(!0),n(null);const x={event_type:m,ad_id:b.adId,admesh_link:b.admeshLink,product_id:b.productId,user_id:b.userId,session_id:b.sessionId,revenue:b.revenue,conversion_type:b.conversionType,metadata:b.metadata,timestamp:new Date().toISOString(),user_agent:navigator.userAgent,referrer:document.referrer,page_url:window.location.href};a(`Sending ${m} event`,x);let C=null;for(let w=1;w<=(s.retryAttempts||3);w++)try{const j=await fetch(`${s.apiBaseUrl}/events`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(x)});if(!j.ok)throw new Error(`HTTP ${j.status}: ${j.statusText}`);const A=await j.json();a(`${m} event tracked successfully`,A),o(!1);return}catch(j){C=j,a(`Attempt ${w} failed for ${m} event`,j),w<(s.retryAttempts||3)&&await new Promise(A=>setTimeout(A,(s.retryDelay||1e3)*w))}const S=`Failed to track ${m} event after ${s.retryAttempts} attempts: ${C==null?void 0:C.message}`;a(S,C),n(S),o(!1)},[s,a]),p=u.useCallback(async m=>c("click",m),[c]),f=u.useCallback(async m=>c("view",m),[c]),h=u.useCallback(async m=>(!m.revenue&&!m.conversionType&&a("Warning: Conversion tracking without revenue or conversion type",m),c("conversion",m)),[c,a]);return{trackClick:p,trackView:f,trackConversion:h,isTracking:t,error:d}},Le=(e,t,o)=>{try{const d=new URL(e);return d.searchParams.set("ad_id",t),d.searchParams.set("utm_source","admesh"),d.searchParams.set("utm_medium","recommendation"),o&&Object.entries(o).forEach(([n,s])=>{d.searchParams.set(n,s)}),d.toString()}catch(d){return console.warn("[AdMesh] Invalid URL provided to buildAdMeshLink:",e,d),e}},Ie=(e,t)=>({adId:e.ad_id,admeshLink:e.admesh_link,productId:e.product_id,...t}),Q=({adId:e,admeshLink:t,productId:o,children:d,trackingData:n,className:s,style:a})=>{const{trackClick:c,trackView:p}=be(),f=u.useRef(null),h=u.useRef(!1);u.useEffect(()=>{if(!f.current||h.current)return;const b=new IntersectionObserver(x=>{x.forEach(C=>{C.isIntersecting&&!h.current&&(h.current=!0,p({adId:e,admeshLink:t,productId:o,...n}).catch(console.error))})},{threshold:.5,rootMargin:"0px"});return b.observe(f.current),()=>{b.disconnect()}},[e,t,o,n,p]);const m=u.useCallback(async b=>{try{await c({adId:e,admeshLink:t,productId:o,...n})}catch(S){console.error("Failed to track click:",S)}b.target.closest("a")||window.open(t,"_blank","noopener,noreferrer")},[e,t,o,n,c]);return r.jsx("div",{ref:f,className:s,onClick:m,style:{cursor:"pointer",...a},children:d})};Q.displayName="AdMeshLinkTracker";const Ve=`
26
+ */var he;function Ae(){return he||(he=1,function(e){(function(){var t={}.hasOwnProperty;function o(){for(var i="",a=0;a<arguments.length;a++){var c=arguments[a];c&&(i=n(i,d(c)))}return i}function d(i){if(typeof i=="string"||typeof i=="number")return i;if(typeof i!="object")return"";if(Array.isArray(i))return o.apply(null,i);if(i.toString!==Object.prototype.toString&&!i.toString.toString().includes("[native code]"))return i.toString();var a="";for(var c in i)t.call(i,c)&&i[c]&&(a=n(a,c));return a}function n(i,a){return a?i?i+" "+a:i+a:i}e.exports?(o.default=o,e.exports=o):window.classNames=o})()}(oe)),oe.exports}var Re=Ae();const W=Se(Re),Pe="https://api.useadmesh.com/track";let ie={apiBaseUrl:Pe,enabled:!0,debug:!1,retryAttempts:3,retryDelay:1e3};const Ie=e=>{ie={...ie,...e}},be=e=>{const[t,o]=f.useState(!1),[d,n]=f.useState(null),i=f.useMemo(()=>({...ie,...e}),[e]),a=f.useCallback((m,h)=>{i.debug&&console.log(`[AdMesh Tracker] ${m}`,h)},[i.debug]),c=f.useCallback(async(m,h)=>{if(!i.enabled){a("Tracking disabled, skipping event",{eventType:m,data:h});return}if(!h.adId||!h.admeshLink){const y="Missing required tracking data: adId and admeshLink are required";a(y,h),n(y);return}o(!0),n(null);const x={event_type:m,ad_id:h.adId,admesh_link:h.admeshLink,product_id:h.productId,user_id:h.userId,session_id:h.sessionId,revenue:h.revenue,conversion_type:h.conversionType,metadata:h.metadata,timestamp:new Date().toISOString(),user_agent:navigator.userAgent,referrer:document.referrer,page_url:window.location.href};a(`Sending ${m} event`,x);let C=null;for(let y=1;y<=(i.retryAttempts||3);y++)try{const j=await fetch(`${i.apiBaseUrl}/events`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(x)});if(!j.ok)throw new Error(`HTTP ${j.status}: ${j.statusText}`);const R=await j.json();a(`${m} event tracked successfully`,R),o(!1);return}catch(j){C=j,a(`Attempt ${y} failed for ${m} event`,j),y<(i.retryAttempts||3)&&await new Promise(R=>setTimeout(R,(i.retryDelay||1e3)*y))}const S=`Failed to track ${m} event after ${i.retryAttempts} attempts: ${C==null?void 0:C.message}`;a(S,C),n(S),o(!1)},[i,a]),u=f.useCallback(async m=>c("click",m),[c]),g=f.useCallback(async m=>c("view",m),[c]),w=f.useCallback(async m=>(!m.revenue&&!m.conversionType&&a("Warning: Conversion tracking without revenue or conversion type",m),c("conversion",m)),[c,a]);return{trackClick:u,trackView:g,trackConversion:w,isTracking:t,error:d}},De=(e,t,o)=>{try{const d=new URL(e);return d.searchParams.set("ad_id",t),d.searchParams.set("utm_source","admesh"),d.searchParams.set("utm_medium","recommendation"),o&&Object.entries(o).forEach(([n,i])=>{d.searchParams.set(n,i)}),d.toString()}catch(d){return console.warn("[AdMesh] Invalid URL provided to buildAdMeshLink:",e,d),e}},Le=(e,t)=>({adId:e.ad_id,admeshLink:e.admesh_link,productId:e.product_id,...t}),X=({adId:e,admeshLink:t,productId:o,children:d,trackingData:n,className:i,style:a})=>{const{trackClick:c,trackView:u}=be(),g=f.useRef(null),w=f.useRef(!1);f.useEffect(()=>{if(!g.current||w.current)return;const h=new IntersectionObserver(x=>{x.forEach(C=>{C.isIntersecting&&!w.current&&(w.current=!0,u({adId:e,admeshLink:t,productId:o,...n}).catch(console.error))})},{threshold:.5,rootMargin:"0px"});return h.observe(g.current),()=>{h.disconnect()}},[e,t,o,n,u]);const m=f.useCallback(async h=>{try{await c({adId:e,admeshLink:t,productId:o,...n})}catch(S){console.error("Failed to track click:",S)}h.target.closest("a")||window.open(t,"_blank","noopener,noreferrer")},[e,t,o,n,c]);return r.jsx("div",{ref:g,className:i,onClick:m,style:{cursor:"pointer",...a},children:d})};X.displayName="AdMeshLinkTracker";const Ve=`
27
27
  /* AdMesh UI SDK - Complete Self-Contained Styles */
28
28
 
29
29
  /* CSS Reset for AdMesh components */
@@ -691,7 +691,7 @@ React keys must be passed directly to JSX without using spread:
691
691
  .admesh-component .lg\\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
692
692
  .admesh-component .lg\\:col-span-1 { grid-column: span 1 / span 1; }
693
693
  }
694
- `;let ne=!1;const xe=()=>{u.useEffect(()=>{if(ne)return;const e=document.createElement("style");return e.id="admesh-ui-sdk-styles",e.textContent=Ve,document.getElementById("admesh-ui-sdk-styles")||(document.head.appendChild(e),ne=!0),()=>{const t=document.getElementById("admesh-ui-sdk-styles");t&&document.head.contains(t)&&(document.head.removeChild(t),ne=!1)}},[])},Fe=(e,t,o=!0)=>{const d=u.useRef(null),n=u.useRef(!1),s=u.useRef(null),a=u.useRef(null),c=u.useCallback(async()=>{if(!(!e||n.current)){n.current=!0;try{if(navigator.sendBeacon&&navigator.sendBeacon(e)){console.debug(`✅ Exposure pixel fired via sendBeacon for ${t}`);return}fetch(e,{method:"GET",keepalive:!0,mode:"no-cors"}).then(()=>{console.debug(`✅ Exposure pixel fired via fetch for ${t}`)}).catch(h=>{console.warn(`⚠️ Failed to fire exposure pixel for ${t}:`,h)})}catch(h){console.warn(`⚠️ Error firing exposure pixel for ${t}:`,h)}}},[e,t]),p=u.useCallback(h=>h.intersectionRatio>=.5,[]),f=u.useCallback(h=>{h.forEach(m=>{!o||n.current||(p(m)?s.current||(s.current=setTimeout(()=>{c(),s.current=null},1e3),console.debug(`👁️ Element ${t} is 50%+ visible, starting 1-second timer`)):s.current&&(clearTimeout(s.current),s.current=null,console.debug(`👁️ Element ${t} scrolled out of view, timer cleared`)))})},[o,p,c,t]);return u.useEffect(()=>{if(!o||!e||!d.current)return;const h=new IntersectionObserver(f,{threshold:[0,.1,.2,.3,.4,.5,.6,.7,.8,.9,1],rootMargin:"0px"});return a.current=h,h.observe(d.current),console.debug(`🔍 Intersection Observer started for ${t}`),()=>{s.current&&clearTimeout(s.current),a.current&&(a.current.disconnect(),console.debug(`🔍 Intersection Observer stopped for ${t}`))}},[o,e,t,f]),{elementRef:d,isTracked:n.current,firePixelManually:c}},H=(e,t={})=>{const o=e.intent_match_score||0,d=t.customLabels||{};return o>=.8?d.partnerRecommendation||"Smart Pick":o>=.6?d.partnerMatch||"Partner Recommendation":o>=.3?d.promotedOption||"Promoted Match":d.relatedOption||"Related"},de=(e,t)=>{const o=e.intent_match_score||0;return o>=.8?"This recommendation is from a partner who compensates us when you engage. We've matched it to your needs based on your query.":o>=.6?"Top-rated partner solution matched to your specific requirements. Partner compensates us for qualified referrals.":o>=.3?"This partner solution may be relevant to your needs. The partner compensates us when you take qualifying actions.":"This solution is somewhat related to your query. While not a perfect match, it might still be helpful. This partner compensates us for qualified referrals."},Oe=(e=!0,t=!1)=>e?t?"These curated recommendations are from partners who compensate us for referrals.":"Personalized Sponsoreds: All results are from vetted partners who compensate us for qualified matches. We've ranked them based on relevance to your specific needs.":"Expanded Results: While these don't perfectly match your query, they're related solutions from our partner network. All partners compensate us for referrals.",$e=(e,t=!1)=>{const o=e.intent_match_score||0;return t?"Promoted Match":o>=.8?"Smart Pick":o>=.6?"Partner Recommendation":"Promoted Match"},ze=()=>"We've partnered with trusted providers to bring you relevant solutions. These partners compensate us for qualified referrals, which helps us keep our service free.",Be=e=>({"Top Match":"Smart Pick",Sponsored:"Smart Pick","Perfect Fit":"Smart Pick","Great Match":"Partner Recommendation",Recommended:"Partner Recommendation","Good Fit":"Promoted Match",Featured:"Promoted Match","Popular Choice":"Popular Choice","Premium Pick":"Premium Pick","Free Tier":"Free Tier","AI Powered":"AI Powered",Popular:"Popular",New:"New","Trial Available":"Trial Available","Related Option":"Related Option","Alternative Solution":"Alternative Solution","Expanded Match":"Expanded Match"})[e]||e,Ue=(e,t="button")=>{const o=e.recommendation_title||e.title;return t==="link"?o:e.trial_days&&e.trial_days>0?`Try ${o}`:"Learn More"},We=e=>e.some(t=>(t.intent_match_score||0)>=.8),He=(e=!1)=>e?"":"Recommendations ",K=({recommendation:e,theme:t,showBadges:o=!0,showFeatures:d=!1,variation:n="default",expandable:s=!1,className:a,style:c})=>{var w,j,A,M,O,L,g,_,l,v,k,I,V,E,$,z,q,Y,G;xe();const[p,f]=u.useState(!1),{elementRef:h,isTracked:m}=Fe(e.exposure_url,((w=e.meta)==null?void 0:w.ad_id)||e.ad_id||"",!0);u.useMemo(()=>{var N;const P=[],i=H(e);(i==="Smart Pick"||i==="Partner Recommendation"||i==="Promoted Match")&&P.push("Top Match"),e.trial_days&&e.trial_days>0&&P.push("Trial Available");const y=["ai","artificial intelligence","machine learning","ml","automation"];return(((N=e.keywords)==null?void 0:N.some(D=>y.some(F=>D.toLowerCase().includes(F))))||e.title.toLowerCase().includes("ai"))&&P.push("AI Powered"),e.badges&&e.badges.length>0&&e.badges.forEach(D=>{["Top Match","Free Tier","AI Powered","Popular","New","Trial Available"].includes(D)&&!P.includes(D)&&P.push(D)}),P},[e]),Math.round((((j=e.meta)==null?void 0:j.intent_match_score)||e.intent_match_score||0)*100);const x=n==="simple"?{title:e.recommendation_title||e.title,description:e.recommendation_description||e.description||e.reason,ctaText:e.recommendation_title||e.title,isSimple:!0}:{title:e.recommendation_title||e.title,description:e.recommendation_description||e.description||e.reason,ctaText:e.recommendation_title||e.title},C=U("admesh-component","admesh-card","relative p-3 sm:p-4 rounded-xl bg-gradient-to-br from-white to-gray-50 dark:from-slate-800 dark:to-slate-900 border border-gray-200/50 dark:border-slate-700/50 shadow-lg hover:shadow-xl transition-all duration-300 hover:-translate-y-1",a),S=t?{"--admesh-primary":t.primaryColor||t.accentColor||"#3b82f6","--admesh-secondary":t.secondaryColor||"#10b981","--admesh-accent":t.accentColor||"#3b82f6","--admesh-background":t.backgroundColor,"--admesh-surface":t.surfaceColor,"--admesh-border":t.borderColor,"--admesh-text":t.textColor,"--admesh-text-secondary":t.textSecondaryColor,"--admesh-radius":t.borderRadius||"12px","--admesh-shadow-sm":(A=t.shadows)==null?void 0:A.small,"--admesh-shadow-md":(M=t.shadows)==null?void 0:M.medium,"--admesh-shadow-lg":(O=t.shadows)==null?void 0:O.large,"--admesh-spacing-sm":(L=t.spacing)==null?void 0:L.small,"--admesh-spacing-md":(g=t.spacing)==null?void 0:g.medium,"--admesh-spacing-lg":(_=t.spacing)==null?void 0:_.large,"--admesh-font-size-sm":(l=t.fontSize)==null?void 0:l.small,"--admesh-font-size-base":(v=t.fontSize)==null?void 0:v.base,"--admesh-font-size-lg":(k=t.fontSize)==null?void 0:k.large,"--admesh-font-size-title":(I=t.fontSize)==null?void 0:I.title,fontFamily:t.fontFamily,width:((E=(V=t.components)==null?void 0:V.productCard)==null?void 0:E.width)||"100%"}:{width:"100%"};return n==="simple"?r.jsxs("div",{ref:h,className:U("admesh-component admesh-simple-ad","inline-block text-sm leading-relaxed",a),style:{fontFamily:(t==null?void 0:t.fontFamily)||'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',...($=t==null?void 0:t.components)==null?void 0:$.productCard,...c},"data-admesh-theme":t==null?void 0:t.mode,"data-admesh-tracked":m?"true":"false",children:[r.jsx("span",{style:{fontSize:"11px",fontWeight:"600",color:(t==null?void 0:t.mode)==="dark"?"#000000":"#ffffff",backgroundColor:(t==null?void 0:t.mode)==="dark"?"#ffffff":"#000000",padding:"2px 6px",borderRadius:"4px",marginRight:"8px"},title:de(e,H(e)),children:H(e)}),r.jsxs("span",{style:{color:(t==null?void 0:t.mode)==="dark"?"#f3f4f6":"#374151",marginRight:"4px"},children:[x.description," "]}),r.jsx(Q,{adId:((z=e.meta)==null?void 0:z.ad_id)||e.ad_id||"",admeshLink:e.admesh_link,productId:e.product_id,trackingData:{title:e.title,matchScore:e.intent_match_score,component:"simple_ad_cta"},children:r.jsx("span",{style:{color:(t==null?void 0:t.mode)==="dark"?"#ffffff":"#000000",textDecoration:"underline",cursor:"pointer",fontSize:"inherit",fontFamily:"inherit"},children:x.ctaText})})]}):r.jsx("div",{ref:h,className:C,style:{fontFamily:(t==null?void 0:t.fontFamily)||'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',...(q=t==null?void 0:t.components)==null?void 0:q.productCard,...c},"data-admesh-theme":t==null?void 0:t.mode,"data-admesh-tracked":m?"true":"false",children:r.jsxs("div",{className:"h-full flex flex-col",style:S,children:[r.jsx("div",{className:"mb-1.5",children:r.jsx("span",{style:{fontSize:"11px",fontWeight:"600",color:(t==null?void 0:t.mode)==="dark"?"#000000":"#ffffff",backgroundColor:(t==null?void 0:t.mode)==="dark"?"#ffffff":"#000000",padding:"2px 6px",borderRadius:"4px"},title:de(e,H(e)),children:H(e)})}),r.jsxs("div",{className:"flex justify-between items-center gap-3 mb-2",children:[r.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0",children:[e.product_logo&&r.jsx("img",{src:e.product_logo.url,alt:`${e.title} logo`,className:"w-6 h-6 rounded flex-shrink-0",onError:P=>{P.target.style.display="none"}}),r.jsx("h4",{className:"font-semibold text-gray-800 dark:text-gray-200 text-sm sm:text-base truncate",children:x.title})]}),r.jsx("div",{className:"flex-shrink-0",children:r.jsx(Q,{adId:((Y=e.meta)==null?void 0:Y.ad_id)||e.ad_id||"",admeshLink:e.admesh_link,productId:e.product_id,trackingData:{title:e.title,matchScore:((G=e.meta)==null?void 0:G.intent_match_score)||e.intent_match_score,component:"product_card_cta"},children:r.jsxs("button",{className:"text-xs px-2 py-1 sm:px-3 sm:py-2 rounded-full flex items-center transition-all duration-200 transform hover:scale-105 shadow-md hover:shadow-lg whitespace-nowrap",style:{backgroundColor:(t==null?void 0:t.accentColor)||"#000000",color:(t==null?void 0:t.mode)==="dark"?"#000000":"#ffffff"},children:["Visit",r.jsx("svg",{className:"ml-1 h-3 w-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"})})]})})})]}),r.jsx("div",{className:"mb-3",children:r.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-300 leading-snug",children:x.description})}),d&&e.features&&e.features.length>0&&r.jsxs("div",{className:"mb-2",children:[r.jsx("div",{className:"text-xs font-medium mb-1.5",style:{color:(t==null?void 0:t.mode)==="dark"?"#9ca3af":"#666666"},children:"Key Features"}),r.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[e.features.slice(0,4).map((P,i)=>r.jsxs("span",{className:"text-xs px-2 py-1 rounded-full border",style:{backgroundColor:(t==null?void 0:t.mode)==="dark"?"#111111":"#f5f5f5",color:(t==null?void 0:t.mode)==="dark"?"#ffffff":"#000000",borderColor:(t==null?void 0:t.mode)==="dark"?"#333333":"#e5e7eb"},children:[r.jsx("svg",{className:"h-3 w-3 mr-0.5 inline",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"})}),P]},i)),e.features.length>4&&r.jsxs("span",{className:"text-xs px-2 py-1",style:{color:(t==null?void 0:t.mode)==="dark"?"#9ca3af":"#666666"},children:["+",e.features.length-4," more"]})]})]}),r.jsx("div",{className:"mt-auto pt-3 border-t border-gray-100 dark:border-slate-700",children:r.jsxs("div",{className:"flex items-center justify-between text-xs text-gray-500 dark:text-gray-400",children:[r.jsx("span",{children:"Sponsored"}),r.jsx("span",{className:"text-gray-400 dark:text-gray-500"})]})})]})})};K.displayName="AdMeshProductCard";const ye=({recommendations:e,title:t="Product Recommendations",showTitle:o=!0,className:d="",cardClassName:n="",onProductClick:s,showPricing:a=!0,showRatings:c=!0,showBrand:p=!0,showSource:f=!1,showShipping:h=!0,maxCards:m=10,cardWidth:b="md",theme:x="auto",borderRadius:C="md",shadow:S="sm"})=>{if(!e||e.length===0)return console.log("[AdMesh Ecommerce Cards] Empty recommendations - not rendering anything"),null;const w=e.slice(0,m),j=()=>{switch(b){case"sm":return"w-48 min-w-48";case"md":return"w-64 min-w-64";case"lg":return"w-80 min-w-80";default:return"w-64 min-w-64"}},A=()=>{switch(C){case"none":return"rounded-none";case"sm":return"rounded-sm";case"md":return"rounded-lg";case"lg":return"rounded-xl";default:return"rounded-lg"}},M=()=>{switch(S){case"none":return"";case"sm":return"shadow-sm hover:shadow-md";case"md":return"shadow-md hover:shadow-lg";case"lg":return"shadow-lg hover:shadow-xl";default:return"shadow-sm hover:shadow-md"}},O=()=>x==="dark"?"bg-gray-900 text-white":x==="light"?"bg-white text-gray-900":"bg-white dark:bg-gray-900 text-gray-900 dark:text-white",L=l=>new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",minimumFractionDigits:0,maximumFractionDigits:2}).format(l),g=l=>{const v=[],k=Math.floor(l),I=l%1!==0;for(let E=0;E<k;E++)v.push(r.jsx("span",{className:"text-yellow-400",children:"★"},E));I&&v.push(r.jsx("span",{className:"text-yellow-400",children:"☆"},"half"));const V=5-Math.ceil(l);for(let E=0;E<V;E++)v.push(r.jsx("span",{className:"text-gray-300 dark:text-gray-600",children:"☆"},`empty-${E}`));return v},_=l=>{if(s)s(l);else{const v=l.admesh_link||l.url;v&&window.open(v,"_blank","noopener,noreferrer")}};return(!products||products.length===0)&&(!e||e.length===0)?null:r.jsxs("div",{className:U("w-full",d),children:[o&&r.jsxs("div",{className:"mb-4",children:[r.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:t}),r.jsx("div",{className:"mt-1 h-0.5 w-12 bg-blue-500"})]}),r.jsxs("div",{className:"relative",children:[w.length===0?r.jsx("div",{className:"text-center py-8 text-gray-500",children:"No products to display"}):r.jsx("div",{className:"flex gap-4 overflow-x-auto pb-4 scrollbar-hide",children:w.map(l=>{var k;const v=l.product_id||l.id||l.ad_id;return r.jsxs("div",{className:U(j(),A(),M(),O(),"flex-shrink-0 border border-gray-200 dark:border-gray-700 transition-all duration-200 cursor-pointer hover:scale-[1.02]",n),onClick:()=>_(l),children:[r.jsxs("div",{className:"relative aspect-square w-full overflow-hidden",children:[l.image_url?r.jsx("img",{src:l.image_url,alt:l.title,className:"h-full w-full object-cover transition-transform duration-200 hover:scale-105",loading:"lazy"}):r.jsx("div",{className:"flex h-full w-full items-center justify-center bg-gray-100 dark:bg-gray-800",children:r.jsx("svg",{className:"h-12 w-12 text-gray-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z"})})}),a&&l.discount_percentage&&l.discount_percentage>0&&r.jsxs("div",{className:"absolute top-2 left-2 bg-red-500 text-white text-xs font-bold px-2 py-1 rounded",children:["-",Math.round(l.discount_percentage),"%"]}),f&&l.source&&r.jsx("div",{className:"absolute top-2 right-2 bg-blue-500 text-white text-xs font-medium px-2 py-1 rounded",children:l.source.toUpperCase()})]}),r.jsxs("div",{className:"p-3",children:[p&&l.brand&&r.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400 mb-1 uppercase tracking-wide",children:l.brand}),r.jsx("h4",{className:"text-sm font-medium text-gray-900 dark:text-white line-clamp-2 mb-2 leading-tight",children:l.title}),c&&l.rating&&r.jsxs("div",{className:"flex items-center gap-1 mb-2",children:[r.jsx("div",{className:"flex text-sm",children:g(l.rating)}),r.jsxs("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:["(",l.review_count||0,")"]})]}),a&&l.price&&r.jsx("div",{className:"mb-2",children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-lg font-bold text-gray-900 dark:text-white",children:L(l.price)}),l.original_price&&l.original_price>l.price&&r.jsx("span",{className:"text-sm text-gray-500 dark:text-gray-400 line-through",children:L(l.original_price)})]})}),h&&((k=l.shipping_info)==null?void 0:k.free_shipping_over_35)&&r.jsx("div",{className:"text-xs text-green-600 dark:text-green-400 font-medium",children:"Free shipping over $35"}),l.availability&&l.availability!=="unknown"&&r.jsx("div",{className:U("text-xs font-medium mt-1",l.availability==="in_stock"?"text-green-600 dark:text-green-400":"text-red-600 dark:text-red-400"),children:l.availability==="in_stock"?"In Stock":"Out of Stock"})]})]},v)})}),w.length>0&&r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"absolute top-1/2 -left-2 transform -translate-y-1/2 bg-white dark:bg-gray-800 rounded-full shadow-lg p-1 opacity-0 group-hover:opacity-100 transition-opacity",children:r.jsx("svg",{className:"w-4 h-4 text-gray-600 dark:text-gray-300",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 19l-7-7 7-7"})})}),r.jsx("div",{className:"absolute top-1/2 -right-2 transform -translate-y-1/2 bg-white dark:bg-gray-800 rounded-full shadow-lg p-1 opacity-0 group-hover:opacity-100 transition-opacity",children:r.jsx("svg",{className:"w-4 h-4 text-gray-600 dark:text-gray-300",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})})})]})]}),r.jsxs("div",{className:"flex justify-between items-center mt-3 pt-2 border-t border-gray-200 dark:border-gray-700",children:[r.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:"Sponsored"}),r.jsx("span",{className:"text-xs text-gray-400 dark:text-gray-500"})]}),r.jsx("style",{dangerouslySetInnerHTML:{__html:`
694
+ `;let ne=!1;const xe=()=>{f.useEffect(()=>{if(ne)return;const e=document.createElement("style");return e.id="admesh-ui-sdk-styles",e.textContent=Ve,document.getElementById("admesh-ui-sdk-styles")||(document.head.appendChild(e),ne=!0),()=>{const t=document.getElementById("admesh-ui-sdk-styles");t&&document.head.contains(t)&&(document.head.removeChild(t),ne=!1)}},[])},q=(e,t={})=>{const o=e.intent_match_score||0,d=t.customLabels||{};return o>=.8?d.partnerRecommendation||"Smart Pick":o>=.6?d.partnerMatch||"Partner Recommendation":o>=.3?d.promotedOption||"Promoted Match":d.relatedOption||"Related"},de=(e,t)=>{const o=e.intent_match_score||0;return o>=.8?"This recommendation is from a partner who compensates us when you engage. We've matched it to your needs based on your query.":o>=.6?"Top-rated partner solution matched to your specific requirements. Partner compensates us for qualified referrals.":o>=.3?"This partner solution may be relevant to your needs. The partner compensates us when you take qualifying actions.":"This solution is somewhat related to your query. While not a perfect match, it might still be helpful. This partner compensates us for qualified referrals."},Fe=(e=!0,t=!1)=>e?t?"These curated recommendations are from partners who compensate us for referrals.":"Personalized Sponsoreds: All results are from vetted partners who compensate us for qualified matches. We've ranked them based on relevance to your specific needs.":"Expanded Results: While these don't perfectly match your query, they're related solutions from our partner network. All partners compensate us for referrals.",Oe=(e,t=!1)=>{const o=e.intent_match_score||0;return t?"Promoted Match":o>=.8?"Smart Pick":o>=.6?"Partner Recommendation":"Promoted Match"},ze=()=>"We've partnered with trusted providers to bring you relevant solutions. These partners compensate us for qualified referrals, which helps us keep our service free.",$e=e=>({"Top Match":"Smart Pick",Sponsored:"Smart Pick","Perfect Fit":"Smart Pick","Great Match":"Partner Recommendation",Recommended:"Partner Recommendation","Good Fit":"Promoted Match",Featured:"Promoted Match","Popular Choice":"Popular Choice","Premium Pick":"Premium Pick","Free Tier":"Free Tier","AI Powered":"AI Powered",Popular:"Popular",New:"New","Trial Available":"Trial Available","Related Option":"Related Option","Alternative Solution":"Alternative Solution","Expanded Match":"Expanded Match"})[e]||e,Ue=(e,t="button")=>{const o=e.recommendation_title||e.title;return t==="link"?o:e.trial_days&&e.trial_days>0?`Try ${o}`:"Learn More"},Be=e=>e.some(t=>(t.intent_match_score||0)>=.8),We=(e=!1)=>e?"":"Recommendations ",J=({recommendation:e,theme:t,showBadges:o=!0,showFeatures:d=!1,variation:n="default",expandable:i=!1,className:a,style:c})=>{var C,S,y,j,R,M,V,I,p,_,l,v,k,D,L,E,O,U;xe();const[u,g]=f.useState(!1);f.useMemo(()=>{var s;const P=[],z=q(e);(z==="Smart Pick"||z==="Partner Recommendation"||z==="Promoted Match")&&P.push("Top Match"),e.trial_days&&e.trial_days>0&&P.push("Trial Available");const K=["ai","artificial intelligence","machine learning","ml","automation"];return(((s=e.keywords)==null?void 0:s.some(b=>K.some(T=>b.toLowerCase().includes(T))))||e.title.toLowerCase().includes("ai"))&&P.push("AI Powered"),e.badges&&e.badges.length>0&&e.badges.forEach(b=>{["Top Match","Free Tier","AI Powered","Popular","New","Trial Available"].includes(b)&&!P.includes(b)&&P.push(b)}),P},[e]),Math.round((((C=e.meta)==null?void 0:C.intent_match_score)||e.intent_match_score||0)*100);const m=n==="simple"?{title:e.recommendation_title||e.title,description:e.recommendation_description||e.description||e.reason,ctaText:e.recommendation_title||e.title,isSimple:!0}:{title:e.recommendation_title||e.title,description:e.recommendation_description||e.description||e.reason,ctaText:e.recommendation_title||e.title},h=W("admesh-component","admesh-card","relative p-3 sm:p-4 rounded-xl bg-gradient-to-br from-white to-gray-50 dark:from-slate-800 dark:to-slate-900 border border-gray-200/50 dark:border-slate-700/50 shadow-lg hover:shadow-xl transition-all duration-300 hover:-translate-y-1",a),x=t?{"--admesh-primary":t.primaryColor||t.accentColor||"#3b82f6","--admesh-secondary":t.secondaryColor||"#10b981","--admesh-accent":t.accentColor||"#3b82f6","--admesh-background":t.backgroundColor,"--admesh-surface":t.surfaceColor,"--admesh-border":t.borderColor,"--admesh-text":t.textColor,"--admesh-text-secondary":t.textSecondaryColor,"--admesh-radius":t.borderRadius||"12px","--admesh-shadow-sm":(S=t.shadows)==null?void 0:S.small,"--admesh-shadow-md":(y=t.shadows)==null?void 0:y.medium,"--admesh-shadow-lg":(j=t.shadows)==null?void 0:j.large,"--admesh-spacing-sm":(R=t.spacing)==null?void 0:R.small,"--admesh-spacing-md":(M=t.spacing)==null?void 0:M.medium,"--admesh-spacing-lg":(V=t.spacing)==null?void 0:V.large,"--admesh-font-size-sm":(I=t.fontSize)==null?void 0:I.small,"--admesh-font-size-base":(p=t.fontSize)==null?void 0:p.base,"--admesh-font-size-lg":(_=t.fontSize)==null?void 0:_.large,"--admesh-font-size-title":(l=t.fontSize)==null?void 0:l.title,fontFamily:t.fontFamily,width:((k=(v=t.components)==null?void 0:v.productCard)==null?void 0:k.width)||"100%"}:{width:"100%"};return n==="simple"?r.jsxs("div",{className:W("admesh-component admesh-simple-ad","inline-block text-sm leading-relaxed",a),style:{fontFamily:(t==null?void 0:t.fontFamily)||'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',...(D=t==null?void 0:t.components)==null?void 0:D.productCard,...c},"data-admesh-theme":t==null?void 0:t.mode,children:[r.jsx("span",{style:{fontSize:"11px",fontWeight:"600",color:(t==null?void 0:t.mode)==="dark"?"#000000":"#ffffff",backgroundColor:(t==null?void 0:t.mode)==="dark"?"#ffffff":"#000000",padding:"2px 6px",borderRadius:"4px",marginRight:"8px"},title:de(e,q(e)),children:q(e)}),r.jsxs("span",{style:{color:(t==null?void 0:t.mode)==="dark"?"#f3f4f6":"#374151",marginRight:"4px"},children:[m.description," "]}),r.jsx(X,{adId:((L=e.meta)==null?void 0:L.ad_id)||e.ad_id||"",admeshLink:e.admesh_link,productId:e.product_id,trackingData:{title:e.title,matchScore:e.intent_match_score,component:"simple_ad_cta"},children:r.jsx("span",{style:{color:(t==null?void 0:t.mode)==="dark"?"#ffffff":"#000000",textDecoration:"underline",cursor:"pointer",fontSize:"inherit",fontFamily:"inherit"},children:m.ctaText})})]}):r.jsx("div",{className:h,style:{fontFamily:(t==null?void 0:t.fontFamily)||'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',...(E=t==null?void 0:t.components)==null?void 0:E.productCard,...c},"data-admesh-theme":t==null?void 0:t.mode,children:r.jsxs("div",{className:"h-full flex flex-col",style:x,children:[r.jsx("div",{className:"mb-1.5",children:r.jsx("span",{style:{fontSize:"11px",fontWeight:"600",color:(t==null?void 0:t.mode)==="dark"?"#000000":"#ffffff",backgroundColor:(t==null?void 0:t.mode)==="dark"?"#ffffff":"#000000",padding:"2px 6px",borderRadius:"4px"},title:de(e,q(e)),children:q(e)})}),r.jsxs("div",{className:"flex justify-between items-center gap-3 mb-2",children:[r.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0",children:[e.product_logo&&r.jsx("img",{src:e.product_logo.url,alt:`${e.title} logo`,className:"w-6 h-6 rounded flex-shrink-0",onError:P=>{P.target.style.display="none"}}),r.jsx("h4",{className:"font-semibold text-gray-800 dark:text-gray-200 text-sm sm:text-base truncate",children:m.title})]}),r.jsx("div",{className:"flex-shrink-0",children:r.jsx(X,{adId:((O=e.meta)==null?void 0:O.ad_id)||e.ad_id||"",admeshLink:e.admesh_link,productId:e.product_id,trackingData:{title:e.title,matchScore:((U=e.meta)==null?void 0:U.intent_match_score)||e.intent_match_score,component:"product_card_cta"},children:r.jsxs("button",{className:"text-xs px-2 py-1 sm:px-3 sm:py-2 rounded-full flex items-center transition-all duration-200 transform hover:scale-105 shadow-md hover:shadow-lg whitespace-nowrap",style:{backgroundColor:(t==null?void 0:t.accentColor)||"#000000",color:(t==null?void 0:t.mode)==="dark"?"#000000":"#ffffff"},children:["Visit",r.jsx("svg",{className:"ml-1 h-3 w-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"})})]})})})]}),r.jsx("div",{className:"mb-3",children:r.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-300 leading-snug",children:m.description})}),d&&e.features&&e.features.length>0&&r.jsxs("div",{className:"mb-2",children:[r.jsx("div",{className:"text-xs font-medium mb-1.5",style:{color:(t==null?void 0:t.mode)==="dark"?"#9ca3af":"#666666"},children:"Key Features"}),r.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[e.features.slice(0,4).map((P,z)=>r.jsxs("span",{className:"text-xs px-2 py-1 rounded-full border",style:{backgroundColor:(t==null?void 0:t.mode)==="dark"?"#111111":"#f5f5f5",color:(t==null?void 0:t.mode)==="dark"?"#ffffff":"#000000",borderColor:(t==null?void 0:t.mode)==="dark"?"#333333":"#e5e7eb"},children:[r.jsx("svg",{className:"h-3 w-3 mr-0.5 inline",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"})}),P]},z)),e.features.length>4&&r.jsxs("span",{className:"text-xs px-2 py-1",style:{color:(t==null?void 0:t.mode)==="dark"?"#9ca3af":"#666666"},children:["+",e.features.length-4," more"]})]})]}),r.jsx("div",{className:"mt-auto pt-3 border-t border-gray-100 dark:border-slate-700",children:r.jsxs("div",{className:"flex items-center justify-between text-xs text-gray-500 dark:text-gray-400",children:[r.jsx("span",{children:"Sponsored"}),r.jsx("span",{className:"text-gray-400 dark:text-gray-500"})]})})]})})};J.displayName="AdMeshProductCard";const ye=({recommendations:e,title:t="Product Recommendations",showTitle:o=!0,className:d="",cardClassName:n="",onProductClick:i,showPricing:a=!0,showRatings:c=!0,showBrand:u=!0,showSource:g=!1,showShipping:w=!0,maxCards:m=10,cardWidth:h="md",theme:x="auto",borderRadius:C="md",shadow:S="sm"})=>{if(!e||e.length===0)return console.log("[AdMesh Ecommerce Cards] Empty recommendations - not rendering anything"),null;const y=e.slice(0,m),j=()=>{switch(h){case"sm":return"w-48 min-w-48";case"md":return"w-64 min-w-64";case"lg":return"w-80 min-w-80";default:return"w-64 min-w-64"}},R=()=>{switch(C){case"none":return"rounded-none";case"sm":return"rounded-sm";case"md":return"rounded-lg";case"lg":return"rounded-xl";default:return"rounded-lg"}},M=()=>{switch(S){case"none":return"";case"sm":return"shadow-sm hover:shadow-md";case"md":return"shadow-md hover:shadow-lg";case"lg":return"shadow-lg hover:shadow-xl";default:return"shadow-sm hover:shadow-md"}},V=()=>x==="dark"?"bg-gray-900 text-white":x==="light"?"bg-white text-gray-900":"bg-white dark:bg-gray-900 text-gray-900 dark:text-white",I=l=>new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",minimumFractionDigits:0,maximumFractionDigits:2}).format(l),p=l=>{const v=[],k=Math.floor(l),D=l%1!==0;for(let E=0;E<k;E++)v.push(r.jsx("span",{className:"text-yellow-400",children:"★"},E));D&&v.push(r.jsx("span",{className:"text-yellow-400",children:"☆"},"half"));const L=5-Math.ceil(l);for(let E=0;E<L;E++)v.push(r.jsx("span",{className:"text-gray-300 dark:text-gray-600",children:"☆"},`empty-${E}`));return v},_=l=>{if(i)i(l);else{const v=l.admesh_link||l.url;v&&window.open(v,"_blank","noopener,noreferrer")}};return(!products||products.length===0)&&(!e||e.length===0)?null:r.jsxs("div",{className:W("w-full",d),children:[o&&r.jsxs("div",{className:"mb-4",children:[r.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:t}),r.jsx("div",{className:"mt-1 h-0.5 w-12 bg-blue-500"})]}),r.jsxs("div",{className:"relative",children:[y.length===0?r.jsx("div",{className:"text-center py-8 text-gray-500",children:"No products to display"}):r.jsx("div",{className:"flex gap-4 overflow-x-auto pb-4 scrollbar-hide",children:y.map(l=>{var k;const v=l.product_id||l.id||l.ad_id;return r.jsxs("div",{className:W(j(),R(),M(),V(),"flex-shrink-0 border border-gray-200 dark:border-gray-700 transition-all duration-200 cursor-pointer hover:scale-[1.02]",n),onClick:()=>_(l),children:[r.jsxs("div",{className:"relative aspect-square w-full overflow-hidden",children:[l.image_url?r.jsx("img",{src:l.image_url,alt:l.title,className:"h-full w-full object-cover transition-transform duration-200 hover:scale-105",loading:"lazy"}):r.jsx("div",{className:"flex h-full w-full items-center justify-center bg-gray-100 dark:bg-gray-800",children:r.jsx("svg",{className:"h-12 w-12 text-gray-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z"})})}),a&&l.discount_percentage&&l.discount_percentage>0&&r.jsxs("div",{className:"absolute top-2 left-2 bg-red-500 text-white text-xs font-bold px-2 py-1 rounded",children:["-",Math.round(l.discount_percentage),"%"]}),g&&l.source&&r.jsx("div",{className:"absolute top-2 right-2 bg-blue-500 text-white text-xs font-medium px-2 py-1 rounded",children:l.source.toUpperCase()})]}),r.jsxs("div",{className:"p-3",children:[u&&l.brand&&r.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400 mb-1 uppercase tracking-wide",children:l.brand}),r.jsx("h4",{className:"text-sm font-medium text-gray-900 dark:text-white line-clamp-2 mb-2 leading-tight",children:l.title}),c&&l.rating&&r.jsxs("div",{className:"flex items-center gap-1 mb-2",children:[r.jsx("div",{className:"flex text-sm",children:p(l.rating)}),r.jsxs("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:["(",l.review_count||0,")"]})]}),a&&l.price&&r.jsx("div",{className:"mb-2",children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-lg font-bold text-gray-900 dark:text-white",children:I(l.price)}),l.original_price&&l.original_price>l.price&&r.jsx("span",{className:"text-sm text-gray-500 dark:text-gray-400 line-through",children:I(l.original_price)})]})}),w&&((k=l.shipping_info)==null?void 0:k.free_shipping_over_35)&&r.jsx("div",{className:"text-xs text-green-600 dark:text-green-400 font-medium",children:"Free shipping over $35"}),l.availability&&l.availability!=="unknown"&&r.jsx("div",{className:W("text-xs font-medium mt-1",l.availability==="in_stock"?"text-green-600 dark:text-green-400":"text-red-600 dark:text-red-400"),children:l.availability==="in_stock"?"In Stock":"Out of Stock"})]})]},v)})}),y.length>0&&r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"absolute top-1/2 -left-2 transform -translate-y-1/2 bg-white dark:bg-gray-800 rounded-full shadow-lg p-1 opacity-0 group-hover:opacity-100 transition-opacity",children:r.jsx("svg",{className:"w-4 h-4 text-gray-600 dark:text-gray-300",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 19l-7-7 7-7"})})}),r.jsx("div",{className:"absolute top-1/2 -right-2 transform -translate-y-1/2 bg-white dark:bg-gray-800 rounded-full shadow-lg p-1 opacity-0 group-hover:opacity-100 transition-opacity",children:r.jsx("svg",{className:"w-4 h-4 text-gray-600 dark:text-gray-300",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})})})]})]}),r.jsxs("div",{className:"flex justify-between items-center mt-3 pt-2 border-t border-gray-200 dark:border-gray-700",children:[r.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:"Sponsored"}),r.jsx("span",{className:"text-xs text-gray-400 dark:text-gray-500"})]}),r.jsx("style",{dangerouslySetInnerHTML:{__html:`
695
695
  .scrollbar-hide {
696
696
  -ms-overflow-style: none;
697
697
  scrollbar-width: none;
@@ -705,5 +705,5 @@ React keys must be passed directly to JSX without using spread:
705
705
  -webkit-box-orient: vertical;
706
706
  overflow: hidden;
707
707
  }
708
- `}})]})},qe=e=>{var n,s,a;const t=[];if(!e)return{isValid:!1,isEmpty:!0,warnings:["No response object provided"]};(!e.recommendations||!Array.isArray(e.recommendations))&&t.push("No recommendations array found in response"),e.layout_type==="citation"&&!e.citation_summary&&t.push("Citation layout specified but no citation_summary provided");const o=((n=e.recommendations)==null?void 0:n.filter(c=>c&&c.admesh_link&&(c.title||c.recommendation_title)))||[],d=((s=e.recommendations)==null?void 0:s.length)===0;return o.length===0&&!d&&t.push("No valid recommendations found (missing admesh_link or title)"),{isValid:o.length>0,isEmpty:d,validCount:o.length,totalCount:((a=e.recommendations)==null?void 0:a.length)||0,warnings:t}},we=({response:e,theme:t,className:o="",style:d={},onRecommendationClick:n,onLinkClick:s})=>{const a=qe(e);if(a.warnings.length>0&&console.warn("[AdMesh Summary Layout] Validation warnings:",a.warnings),a.isEmpty)return console.log("[AdMesh Summary Layout] Empty recommendations array - not rendering anything"),null;if(!a.isValid)return console.error("[AdMesh Summary Layout] Invalid response object"),null;const{layout_type:c="citation",citation_summary:p,recommendations:f=[],requires_summary:h=!0}=e;console.log(`[AdMesh Summary Layout] Rendering ${c} layout with ${a.validCount}/${a.totalCount} valid recommendations`);const m=()=>{switch(c){case"citation":return p&&h?r.jsx(se,{summaryText:p,recommendations:f,theme:t,onLinkClick:s}):r.jsxs("div",{className:"fallback-citation",children:[r.jsx("p",{className:"text-gray-700 dark:text-gray-300 mb-3",children:"Based on your query, I'd recommend checking out these options:"}),r.jsx(K,{recommendation:f[0],theme:t})]});case"product_cards":case"product":return r.jsx("div",{className:"product-cards-layout",children:f.slice(0,3).map((b,x)=>r.jsx(K,{recommendation:b,theme:t,className:"mb-4"},b.ad_id||`rec-${x}`))});case"ecommerce":return r.jsx(ye,{recommendations:f.slice(0,3),theme:(t==null?void 0:t.mode)||"light"});default:return console.warn(`[AdMesh Summary Layout] Unknown layout type: ${c}`),p?r.jsx(se,{summaryText:p,recommendations:f,theme:t,onLinkClick:s}):r.jsx(K,{recommendation:f[0],theme:t})}};return r.jsx("div",{className:`admesh-summary-layout admesh-layout-${c} ${o}`,style:{fontFamily:(t==null?void 0:t.fontFamily)||'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',...d},children:m()})},Ye=({response:e,theme:t,className:o,style:d,onRecommendationClick:n,onLinkClick:s})=>e?e.recommendations&&Array.isArray(e.recommendations)&&e.recommendations.length===0?(console.log("[AdMeshLayout] Empty recommendations array - not rendering anything"),null):r.jsx(we,{response:e,theme:t,className:o,style:d,onRecommendationClick:n,onLinkClick:s}):(console.error("[AdMeshLayout] response prop is required"),null),ve=({recommendation:e,theme:t,variation:o="default",expandable:d=!1,className:n,style:s})=>{var m,b,x,C,S;const[a,c]=u.useState(!1),f=(()=>{const w=e.content_variations;return o==="question"&&(w!=null&&w.question)?{title:w.question.cta||e.recommendation_title||e.title,description:w.question.text,ctaText:w.question.cta||e.recommendation_title||e.title}:o==="statement"&&(w!=null&&w.statement)?{title:e.recommendation_title||e.title,description:w.statement.text,ctaText:w.statement.cta||e.recommendation_title||e.title}:{title:e.recommendation_title||e.title,description:e.recommendation_description||e.reason||"",ctaText:e.recommendation_title||e.title}})(),h=U("rounded-xl shadow-sm border border-gray-200 dark:border-gray-800 p-4 bg-white dark:bg-slate-900","hover:shadow-md transition-shadow duration-200",{"cursor-pointer":d&&(o==="question"||o==="statement")},n);return r.jsx("div",{className:h,style:{fontFamily:(t==null?void 0:t.fontFamily)||'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',width:((b=(m=t==null?void 0:t.components)==null?void 0:m.inlineRecommendation)==null?void 0:b.width)||"100%",...(x=t==null?void 0:t.components)==null?void 0:x.productCard,...s},"data-admesh-theme":t==null?void 0:t.mode,children:r.jsxs("div",{className:"h-full flex flex-col",children:[r.jsxs("div",{className:"flex justify-between items-center gap-3 mb-2",children:[r.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0",children:[e.product_logo&&r.jsx("img",{src:e.product_logo.url,alt:`${e.title} logo`,className:"w-5 h-5 rounded flex-shrink-0",onError:w=>{w.target.style.display="none"}}),r.jsx("h4",{className:"font-semibold text-gray-800 dark:text-gray-200 text-sm truncate",children:f.title})]}),r.jsx("div",{className:"flex-shrink-0",children:r.jsx(Q,{adId:((C=e.meta)==null?void 0:C.ad_id)||e.ad_id||"",admeshLink:e.admesh_link,productId:e.product_id,trackingData:{title:e.title,matchScore:((S=e.meta)==null?void 0:S.intent_match_score)||e.intent_match_score,component:"inline_card_cta"},children:r.jsxs("button",{className:"text-xs px-2 py-1 rounded-full bg-gradient-to-r from-purple-500 to-pink-500 text-white hover:from-purple-600 hover:to-pink-600 flex items-center transition-all duration-200 transform hover:scale-105 shadow-sm whitespace-nowrap",children:[o==="question"?"Try":"Visit",r.jsx("svg",{className:"ml-1 h-3 w-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"})})]})})})]}),f.description&&r.jsx("p",{className:"text-xs text-gray-600 dark:text-gray-300 mb-2 line-clamp-2",children:f.description}),r.jsx("div",{className:"mt-auto pt-2 border-t border-gray-100 dark:border-slate-700",children:r.jsxs("div",{className:"flex items-center justify-between text-[11px] text-gray-500 dark:text-gray-400",children:[r.jsx("span",{children:"Sponsored"}),r.jsx("span",{className:"text-gray-400 dark:text-gray-500"})]})})]})})};ve.displayName="AdMeshInlineCard";const Ge={"Top Match":"primary","Free Tier":"success","AI Powered":"secondary",Popular:"warning",New:"primary","Trial Available":"success"},Je={"Top Match":"★","Free Tier":"◆","AI Powered":"◉",Popular:"▲",New:"●","Trial Available":"◈"},ke=({type:e,variant:t,size:o="md",className:d,style:n})=>{const s=t||Ge[e]||"secondary",a=Je[e],c=U("admesh-component","admesh-badge",`admesh-badge--${s}`,`admesh-badge--${o}`,d);return r.jsxs("span",{className:c,style:n,children:[a&&r.jsx("span",{className:"admesh-badge__icon",children:a}),r.jsx("span",{className:"admesh-badge__text",children:e})]})};ke.displayName="AdMeshBadge";function Xe(e,t,o){const n=e*t>242500;return{...{visibilityThreshold:n?.3:.5,minimumDuration:1e3,isLargeAd:n},...o}}function Ke(e){return e<768?"mobile":e<1024?"tablet":"desktop"}function Qe(e){const t=e.getBoundingClientRect(),o=window.innerHeight||document.documentElement.clientHeight,d=window.innerWidth||document.documentElement.clientWidth,n=t.height,s=t.width;if(n===0||s===0)return 0;const a=Math.max(0,t.top),c=Math.min(o,t.bottom),p=Math.max(0,t.left),f=Math.min(d,t.right),h=Math.max(0,c-a),m=Math.max(0,f-p),b=h*m,x=n*s;return x>0?b/x:0}function fe(){const e=window.innerHeight,t=document.documentElement.scrollHeight,o=window.pageYOffset||document.documentElement.scrollTop,d=t-e;return d<=0?100:Math.min(100,o/d*100)}function Ze(e){const t=e.getBoundingClientRect(),o=window.pageYOffset||document.documentElement.scrollTop,d=window.pageXOffset||document.documentElement.scrollLeft;return{top:t.top+o,left:t.left+d}}function et(e){const t=e.getBoundingClientRect(),o=Ze(e),d=window.innerWidth||document.documentElement.clientWidth,n=window.innerHeight||document.documentElement.clientHeight,s=window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches;return{pageUrl:window.location.href,pageTitle:document.title,referrer:document.referrer,deviceType:Ke(d),viewportWidth:d,viewportHeight:n,adWidth:t.width,adHeight:t.height,adPositionTop:o.top,adPositionLeft:o.left,isDarkMode:s,language:navigator.language,timezone:Intl.DateTimeFormat().resolvedOptions().timeZone}}function tt(){return`session_${Date.now()}_${Math.random().toString(36).substring(2,11)}`}function rt(){return`batch_${Date.now()}_${Math.random().toString(36).substring(2,11)}`}function at(e,t,o){return e>=o.visibilityThreshold&&t>=o.minimumDuration}function ee(e=new Date){return e.toISOString()}function ot(e){return e.length===0?0:e.reduce((o,d)=>o+d,0)/e.length}function ge(e,t){let o;return function(...n){o||(e(...n),o=!0,setTimeout(()=>o=!1,t))}}async function nt(e,t,o=3,d=1e3){let n=null;for(let s=0;s<o;s++){try{const a=await fetch(t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(a.ok)return!0;n=new Error(`HTTP ${a.status}: ${a.statusText}`)}catch(a){n=a}s<o-1&&await new Promise(a=>setTimeout(a,d*Math.pow(2,s)))}return console.error("[AdMesh Viewability] Failed to send analytics event:",n),!1}async function st(e,t,o,d=3,n=1e3){if(e.length===0)return!0;const s={batchId:rt(),sessionId:t,createdAt:ee(),events:e,eventCount:e.length};let a=null;for(let c=0;c<d;c++){try{const p=await fetch(o,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)});if(p.ok)return!0;a=new Error(`HTTP ${p.status}: ${p.statusText}`)}catch(p){a=p}c<d-1&&await new Promise(p=>setTimeout(p,n*Math.pow(2,c)))}return console.error("[AdMesh Viewability] Failed to send analytics batch:",a),!1}const it={enabled:!0,apiEndpoint:"https://api.useadmesh.com/analytics/ui-sdk/viewability",enableBatching:!0,batchSize:10,batchTimeout:5e3,debug:!1,enableRetry:!0,maxRetries:3,retryDelay:1e3};let ce=it;const dt=e=>{ce={...ce,...e}};function _e({adId:e,productId:t,offerId:o,agentId:d,elementRef:n,config:s}){const a={...ce,...s},c=u.useRef(tt()),[p,f]=u.useState({isVisible:!1,isViewable:!1,visibilityPercentage:0,timeMetrics:{loadedAt:ee(),totalVisibleDuration:0,totalViewableDuration:0,totalHoverDuration:0,totalFocusDuration:0},engagementMetrics:{currentScrollDepth:0,viewportEnterCount:0,viewportExitCount:0,hoverCount:0,wasClicked:!1,maxVisibilityPercentage:0,averageVisibilityPercentage:0},isTracking:a.enabled}),h=u.useRef(null),m=u.useRef(null),b=u.useRef(null),x=u.useRef(null),C=u.useRef(null),S=u.useRef([]),w=u.useRef([]),j=u.useRef(null),A=u.useCallback((g,_)=>{a.debug&&console.log(`[AdMesh Viewability] ${g}`,_)},[a.debug]),M=u.useCallback(async(g,_)=>{if(!a.enabled||!n.current||!h.current)return;const l=et(n.current),v={eventType:g,timestamp:ee(),sessionId:c.current,adId:e,productId:t,offerId:o,agentId:d,timeMetrics:p.timeMetrics,engagementMetrics:p.engagementMetrics,contextMetrics:l,mrcStandards:h.current,isViewable:p.isViewable,metadata:_};A(`Event: ${g}`,v),a.onEvent&&a.onEvent(v),a.enableBatching?(w.current.push(v),w.current.length>=a.batchSize?await O():(j.current&&clearTimeout(j.current),j.current=setTimeout(O,a.batchTimeout))):await nt(v,a.apiEndpoint,a.maxRetries,a.retryDelay)},[a,e,t,o,d,n,p,A]),O=u.useCallback(async()=>{if(w.current.length===0)return;const g=[...w.current];w.current=[],j.current&&(clearTimeout(j.current),j.current=null),await st(g,c.current,a.apiEndpoint,a.maxRetries,a.retryDelay)&&a.onBatchSent&&a.onBatchSent({batchId:`batch_${Date.now()}`,sessionId:c.current,createdAt:ee(),events:g,eventCount:g.length})},[a]),L=u.useCallback(ge(()=>{if(!n.current)return;const g=Qe(n.current),_=Date.now(),l=new Date(p.timeMetrics.loadedAt).getTime();f(v=>{const k={...v};g>0&&S.current.push(g);const I=v.isVisible,V=g>0;if(V&&!I)m.current=_,k.engagementMetrics.viewportEnterCount++,k.timeMetrics.timeToFirstVisible||(k.timeMetrics.timeToFirstVisible=_-l,k.engagementMetrics.scrollDepthAtFirstVisible=fe(),M("ad_visible"));else if(!V&&I){if(m.current){const E=_-m.current;k.timeMetrics.totalVisibleDuration+=E,m.current=null}k.engagementMetrics.viewportExitCount++,M("ad_hidden")}else if(V&&I&&m.current){const E=_-m.current;k.timeMetrics.totalVisibleDuration+=E,m.current=_}if(k.isVisible=V,k.visibilityPercentage=g,g>k.engagementMetrics.maxVisibilityPercentage&&(k.engagementMetrics.maxVisibilityPercentage=g),S.current.length>0&&(k.engagementMetrics.averageVisibilityPercentage=ot(S.current)),h.current){const E=v.isViewable,$=at(g,k.timeMetrics.totalVisibleDuration,h.current);if($&&!E)k.isViewable=!0,k.timeMetrics.timeToViewable=_-l,b.current=_,M("ad_viewable");else if($&&E&&b.current){const z=_-b.current;k.timeMetrics.totalViewableDuration+=z,b.current=_}}return k.engagementMetrics.currentScrollDepth=fe(),k})},100),[n,p.timeMetrics.loadedAt,M]);return u.useEffect(()=>{if(!n.current)return;const g=n.current.getBoundingClientRect();h.current=Xe(g.width,g.height,a.mrcStandards),A("Initialized MRC standards",h.current),M("ad_loaded")},[n,a.mrcStandards,A,M]),u.useEffect(()=>{if(!a.enabled||!n.current)return;const g=new IntersectionObserver(_=>{_.forEach(()=>{L()})},{threshold:[0,.1,.2,.3,.4,.5,.6,.7,.8,.9,1],rootMargin:"0px"});return g.observe(n.current),()=>{g.disconnect()}},[a.enabled,n,L]),u.useEffect(()=>{if(!a.enabled)return;const g=ge(()=>{L()},100);return window.addEventListener("scroll",g,{passive:!0}),()=>window.removeEventListener("scroll",g)},[a.enabled,L]),u.useEffect(()=>{if(!a.enabled||!n.current)return;const g=n.current,_=()=>{x.current=Date.now(),f(v=>({...v,engagementMetrics:{...v.engagementMetrics,hoverCount:v.engagementMetrics.hoverCount+1}})),M("ad_hover_start")},l=()=>{if(x.current){const v=Date.now()-x.current;f(k=>({...k,timeMetrics:{...k.timeMetrics,totalHoverDuration:k.timeMetrics.totalHoverDuration+v}})),x.current=null,M("ad_hover_end",{hoverDuration:v})}};return g.addEventListener("mouseenter",_),g.addEventListener("mouseleave",l),()=>{g.removeEventListener("mouseenter",_),g.removeEventListener("mouseleave",l)}},[a.enabled,n,M]),u.useEffect(()=>{if(!a.enabled||!n.current)return;const g=n.current,_=()=>{C.current=Date.now(),M("ad_focus")},l=()=>{if(C.current){const v=Date.now()-C.current;f(k=>({...k,timeMetrics:{...k.timeMetrics,totalFocusDuration:k.timeMetrics.totalFocusDuration+v}})),C.current=null,M("ad_blur",{focusDuration:v})}};return g.addEventListener("focus",_),g.addEventListener("blur",l),()=>{g.removeEventListener("focus",_),g.removeEventListener("blur",l)}},[a.enabled,n,M]),u.useEffect(()=>{if(!a.enabled||!n.current)return;const g=n.current,_=()=>{f(l=>({...l,engagementMetrics:{...l.engagementMetrics,wasClicked:!0}})),M("ad_click")};return g.addEventListener("click",_),()=>{g.removeEventListener("click",_)}},[a.enabled,n,M]),u.useEffect(()=>()=>{const g=Date.now(),_=new Date(p.timeMetrics.loadedAt).getTime(),l=g-_;f(v=>({...v,timeMetrics:{...v.timeMetrics,sessionDuration:l}})),M("ad_unloaded",{sessionDuration:l}),O()},[]),p}const Ce=({adId:e,productId:t,offerId:o,agentId:d,children:n,config:s,className:a,style:c,onViewabilityChange:p,onVisible:f,onViewable:h,onClick:m})=>{const b=u.useRef(null),x=_e({adId:e,productId:t,offerId:o,agentId:d,elementRef:b,config:s}),C=u.useRef(x.isViewable);u.useEffect(()=>{x.isViewable!==C.current&&(C.current=x.isViewable,p&&p(x.isViewable),x.isViewable&&h&&h())},[x.isViewable,p,h]);const S=u.useRef(x.isVisible);u.useEffect(()=>{x.isVisible!==S.current&&(S.current=x.isVisible,x.isVisible&&f&&f())},[x.isVisible,f]);const w=j=>{m&&m()};return r.jsx("div",{ref:b,className:a,style:c,onClick:w,"data-admesh-viewability-tracker":!0,"data-ad-id":e,"data-is-viewable":x.isViewable,"data-is-visible":x.isVisible,"data-visibility-percentage":x.visibilityPercentage.toFixed(2),children:n})};Ce.displayName="AdMeshViewabilityTracker";const B=(e={})=>{const t={mode:"light",primaryColor:"#000000",secondaryColor:"#666666",accentColor:"#000000",backgroundColor:"#ffffff",surfaceColor:"#ffffff",borderColor:"#e5e7eb",textColor:"#000000",textSecondaryColor:"#666666",fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',fontSize:{small:"12px",base:"14px",large:"16px",title:"18px"},borderRadius:"8px",spacing:{small:"4px",medium:"8px",large:"16px"},shadows:{small:"0 1px 3px rgba(0, 0, 0, 0.1)",medium:"0 4px 6px rgba(0, 0, 0, 0.1)",large:"0 10px 15px rgba(0, 0, 0, 0.1)"},icons:{expandIcon:"▼",collapseIcon:"▲",starIcon:"★",checkIcon:"✓",arrowIcon:"→"},gradients:{primary:"#000000",secondary:"#666666",accent:"#000000"},components:{productCard:{width:"100%"},citationUnit:{width:"100%"},inlineRecommendation:{width:"100%"},expandableUnit:{width:"100%"},compareTable:{width:"100%"},card:{width:"auto"},button:{width:"auto"}}},o={...t,...e,fontSize:{...t.fontSize,...e.fontSize},spacing:{...t.spacing,...e.spacing},shadows:{...t.shadows,...e.shadows},icons:{...t.icons,...e.icons},components:{...t.components,...e.components}};return mt(o)},ct=(e={})=>B({...{mode:"dark",primaryColor:"#ffffff",secondaryColor:"#9ca3af",accentColor:"#ffffff",backgroundColor:"#000000",surfaceColor:"#111111",borderColor:"#333333",textColor:"#ffffff",textSecondaryColor:"#9ca3af",shadows:{small:"0 1px 3px rgba(255, 255, 255, 0.1)",medium:"0 4px 6px rgba(255, 255, 255, 0.1)",large:"0 10px 15px rgba(255, 255, 255, 0.1)"},gradients:{primary:"#ffffff",secondary:"#9ca3af",accent:"#ffffff"}},...e}),lt={get minimal(){return B({primaryColor:"#000000",secondaryColor:"#666666",borderRadius:"4px",shadows:{small:"none",medium:"0 1px 3px rgba(0, 0, 0, 0.1)",large:"0 2px 6px rgba(0, 0, 0, 0.1)"},gradients:{primary:"#000000",secondary:"#666666",accent:"#000000"},components:{productCard:{width:"100%"},citationUnit:{width:"100%"},inlineRecommendation:{width:"100%"},expandableUnit:{width:"100%"},compareTable:{width:"100%"}}})},get vibrant(){return B({primaryColor:"#8b5cf6",secondaryColor:"#06b6d4",accentColor:"#f59e0b",borderRadius:"12px",gradients:{primary:"#8b5cf6",secondary:"#06b6d4",accent:"#f59e0b"},components:{productCard:{width:"100%"},citationUnit:{width:"100%"},inlineRecommendation:{width:"100%"},expandableUnit:{width:"100%"},compareTable:{width:"100%"}}})},get corporate(){return B({primaryColor:"#1e40af",secondaryColor:"#059669",backgroundColor:"#f8fafc",surfaceColor:"#ffffff",borderColor:"#cbd5e1",borderRadius:"6px",fontFamily:'"Inter", -apple-system, BlinkMacSystemFont, sans-serif',components:{productCard:{width:"100%"},citationUnit:{width:"100%"},inlineRecommendation:{width:"100%"},expandableUnit:{width:"100%"},compareTable:{width:"100%"}}})},get highContrast(){return B({primaryColor:"#000000",secondaryColor:"#ffffff",backgroundColor:"#ffffff",surfaceColor:"#f5f5f5",borderColor:"#000000",textColor:"#000000",textSecondaryColor:"#333333",borderRadius:"0px",shadows:{small:"none",medium:"0 0 0 2px #000000",large:"0 0 0 3px #000000"},components:{productCard:{width:"100%"},citationUnit:{width:"100%"},inlineRecommendation:{width:"100%"},expandableUnit:{width:"100%"},compareTable:{width:"100%"}}})}},mt=(e={})=>{const t=e.components||{},o={productCard:{width:"100%",...t.productCard},citationUnit:{width:"100%",...t.citationUnit},inlineRecommendation:{width:"100%",...t.inlineRecommendation},expandableUnit:{width:"100%",...t.expandableUnit},compareTable:{width:"100%",...t.compareTable},card:{width:"auto",...t.card},button:{width:"auto",...t.button}};return{...e,components:{...t,...o}}},ut=(...e)=>{const t=B();return e.reduce((o,d)=>d?{...o,...d,mode:d.mode||o.mode}:o,t)},pt=e=>{var o,d,n,s,a,c;const t=getComputedStyle(e);return{primaryColor:((o=t.getPropertyValue("--admesh-primary-color"))==null?void 0:o.trim())||void 0,secondaryColor:((d=t.getPropertyValue("--admesh-secondary-color"))==null?void 0:d.trim())||void 0,backgroundColor:((n=t.getPropertyValue("--admesh-background-color"))==null?void 0:n.trim())||void 0,textColor:((s=t.getPropertyValue("--admesh-text-color"))==null?void 0:s.trim())||void 0,borderRadius:((a=t.getPropertyValue("--admesh-border-radius"))==null?void 0:a.trim())||void 0,fontFamily:((c=t.getPropertyValue("--admesh-font-family"))==null?void 0:c.trim())||void 0}},ht="0.2.1",ft={trackingEnabled:!0,debug:!1,theme:{mode:"light",accentColor:"#2563eb"}};exports.AdMeshBadge=ke;exports.AdMeshEcommerceCards=ye;exports.AdMeshInlineCard=ve;exports.AdMeshLayout=Ye;exports.AdMeshLinkTracker=Q;exports.AdMeshProductCard=K;exports.AdMeshSummaryLayout=we;exports.AdMeshSummaryUnit=se;exports.AdMeshViewabilityTracker=Ce;exports.DEFAULT_CONFIG=ft;exports.VERSION=ht;exports.buildAdMeshLink=Le;exports.createAdMeshTheme=B;exports.createDarkTheme=ct;exports.extractTrackingData=Ie;exports.getBadgeText=Be;exports.getCtaText=Ue;exports.getInlineDisclosure=$e;exports.getInlineTooltip=ze;exports.getLabelTooltip=de;exports.getPoweredByText=He;exports.getRecommendationLabel=H;exports.getSectionDisclosure=Oe;exports.hasHighQualityMatches=We;exports.mergeThemes=ut;exports.setAdMeshTrackerConfig=De;exports.setViewabilityTrackerConfig=dt;exports.themeFromCSSProperties=pt;exports.themePresets=lt;exports.useAdMeshStyles=xe;exports.useAdMeshTracker=be;exports.useViewabilityTracker=_e;
708
+ `}})]})},He=e=>{var n,i,a;const t=[];if(!e)return{isValid:!1,isEmpty:!0,warnings:["No response object provided"]};(!e.recommendations||!Array.isArray(e.recommendations))&&t.push("No recommendations array found in response"),e.layout_type==="citation"&&!e.citation_summary&&t.push("Citation layout specified but no citation_summary provided");const o=((n=e.recommendations)==null?void 0:n.filter(c=>c&&c.admesh_link&&(c.title||c.recommendation_title)))||[],d=((i=e.recommendations)==null?void 0:i.length)===0;return o.length===0&&!d&&t.push("No valid recommendations found (missing admesh_link or title)"),{isValid:o.length>0,isEmpty:d,validCount:o.length,totalCount:((a=e.recommendations)==null?void 0:a.length)||0,warnings:t}},we=({response:e,theme:t,className:o="",style:d={},onRecommendationClick:n,onLinkClick:i})=>{const a=He(e);if(a.warnings.length>0&&console.warn("[AdMesh Summary Layout] Validation warnings:",a.warnings),a.isEmpty)return console.log("[AdMesh Summary Layout] Empty recommendations array - not rendering anything"),null;if(!a.isValid)return console.error("[AdMesh Summary Layout] Invalid response object"),null;const{layout_type:c="citation",citation_summary:u,recommendations:g=[],requires_summary:w=!0}=e;console.log(`[AdMesh Summary Layout] Rendering ${c} layout with ${a.validCount}/${a.totalCount} valid recommendations`);const m=()=>{switch(c){case"citation":return u&&w?r.jsx(se,{summaryText:u,recommendations:g,theme:t,onLinkClick:i}):r.jsxs("div",{className:"fallback-citation",children:[r.jsx("p",{className:"text-gray-700 dark:text-gray-300 mb-3",children:"Based on your query, I'd recommend checking out these options:"}),r.jsx(J,{recommendation:g[0],theme:t})]});case"product_cards":case"product":return r.jsx("div",{className:"product-cards-layout",children:g.slice(0,3).map((h,x)=>r.jsx(J,{recommendation:h,theme:t,className:"mb-4"},h.ad_id||`rec-${x}`))});case"ecommerce":return r.jsx(ye,{recommendations:g.slice(0,3),theme:(t==null?void 0:t.mode)||"light"});default:return console.warn(`[AdMesh Summary Layout] Unknown layout type: ${c}`),u?r.jsx(se,{summaryText:u,recommendations:g,theme:t,onLinkClick:i}):r.jsx(J,{recommendation:g[0],theme:t})}};return r.jsx("div",{className:`admesh-summary-layout admesh-layout-${c} ${o}`,style:{fontFamily:(t==null?void 0:t.fontFamily)||'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',...d},children:m()})},qe=({response:e,theme:t,className:o,style:d,onRecommendationClick:n,onLinkClick:i})=>e?e.recommendations&&Array.isArray(e.recommendations)&&e.recommendations.length===0?(console.log("[AdMeshLayout] Empty recommendations array - not rendering anything"),null):r.jsx(we,{response:e,theme:t,className:o,style:d,onRecommendationClick:n,onLinkClick:i}):(console.error("[AdMeshLayout] response prop is required"),null),ve=({recommendation:e,theme:t,variation:o="default",expandable:d=!1,className:n,style:i})=>{var m,h,x,C,S;const[a,c]=f.useState(!1),g=(()=>{const y=e.content_variations;return o==="question"&&(y!=null&&y.question)?{title:y.question.cta||e.recommendation_title||e.title,description:y.question.text,ctaText:y.question.cta||e.recommendation_title||e.title}:o==="statement"&&(y!=null&&y.statement)?{title:e.recommendation_title||e.title,description:y.statement.text,ctaText:y.statement.cta||e.recommendation_title||e.title}:{title:e.recommendation_title||e.title,description:e.recommendation_description||e.reason||"",ctaText:e.recommendation_title||e.title}})(),w=W("rounded-xl shadow-sm border border-gray-200 dark:border-gray-800 p-4 bg-white dark:bg-slate-900","hover:shadow-md transition-shadow duration-200",{"cursor-pointer":d&&(o==="question"||o==="statement")},n);return r.jsx("div",{className:w,style:{fontFamily:(t==null?void 0:t.fontFamily)||'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',width:((h=(m=t==null?void 0:t.components)==null?void 0:m.inlineRecommendation)==null?void 0:h.width)||"100%",...(x=t==null?void 0:t.components)==null?void 0:x.productCard,...i},"data-admesh-theme":t==null?void 0:t.mode,children:r.jsxs("div",{className:"h-full flex flex-col",children:[r.jsxs("div",{className:"flex justify-between items-center gap-3 mb-2",children:[r.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0",children:[e.product_logo&&r.jsx("img",{src:e.product_logo.url,alt:`${e.title} logo`,className:"w-5 h-5 rounded flex-shrink-0",onError:y=>{y.target.style.display="none"}}),r.jsx("h4",{className:"font-semibold text-gray-800 dark:text-gray-200 text-sm truncate",children:g.title})]}),r.jsx("div",{className:"flex-shrink-0",children:r.jsx(X,{adId:((C=e.meta)==null?void 0:C.ad_id)||e.ad_id||"",admeshLink:e.admesh_link,productId:e.product_id,trackingData:{title:e.title,matchScore:((S=e.meta)==null?void 0:S.intent_match_score)||e.intent_match_score,component:"inline_card_cta"},children:r.jsxs("button",{className:"text-xs px-2 py-1 rounded-full bg-gradient-to-r from-purple-500 to-pink-500 text-white hover:from-purple-600 hover:to-pink-600 flex items-center transition-all duration-200 transform hover:scale-105 shadow-sm whitespace-nowrap",children:[o==="question"?"Try":"Visit",r.jsx("svg",{className:"ml-1 h-3 w-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"})})]})})})]}),g.description&&r.jsx("p",{className:"text-xs text-gray-600 dark:text-gray-300 mb-2 line-clamp-2",children:g.description}),r.jsx("div",{className:"mt-auto pt-2 border-t border-gray-100 dark:border-slate-700",children:r.jsxs("div",{className:"flex items-center justify-between text-[11px] text-gray-500 dark:text-gray-400",children:[r.jsx("span",{children:"Sponsored"}),r.jsx("span",{className:"text-gray-400 dark:text-gray-500"})]})})]})})};ve.displayName="AdMeshInlineCard";const Ye={"Top Match":"primary","Free Tier":"success","AI Powered":"secondary",Popular:"warning",New:"primary","Trial Available":"success"},Ge={"Top Match":"★","Free Tier":"◆","AI Powered":"◉",Popular:"▲",New:"●","Trial Available":"◈"},ke=({type:e,variant:t,size:o="md",className:d,style:n})=>{const i=t||Ye[e]||"secondary",a=Ge[e],c=W("admesh-component","admesh-badge",`admesh-badge--${i}`,`admesh-badge--${o}`,d);return r.jsxs("span",{className:c,style:n,children:[a&&r.jsx("span",{className:"admesh-badge__icon",children:a}),r.jsx("span",{className:"admesh-badge__text",children:e})]})};ke.displayName="AdMeshBadge";function Je(e,t,o){const n=e*t>242500;return{...{visibilityThreshold:n?.3:.5,minimumDuration:1e3,isLargeAd:n},...o}}function Xe(e){return e<768?"mobile":e<1024?"tablet":"desktop"}function Ke(e){const t=e.getBoundingClientRect(),o=window.innerHeight||document.documentElement.clientHeight,d=window.innerWidth||document.documentElement.clientWidth,n=t.height,i=t.width;if(n===0||i===0)return 0;const a=Math.max(0,t.top),c=Math.min(o,t.bottom),u=Math.max(0,t.left),g=Math.min(d,t.right),w=Math.max(0,c-a),m=Math.max(0,g-u),h=w*m,x=n*i;return x>0?h/x:0}function fe(){const e=window.innerHeight,t=document.documentElement.scrollHeight,o=window.pageYOffset||document.documentElement.scrollTop,d=t-e;return d<=0?100:Math.min(100,o/d*100)}function Qe(e){const t=e.getBoundingClientRect(),o=window.pageYOffset||document.documentElement.scrollTop,d=window.pageXOffset||document.documentElement.scrollLeft;return{top:t.top+o,left:t.left+d}}function Ze(e){const t=e.getBoundingClientRect(),o=Qe(e),d=window.innerWidth||document.documentElement.clientWidth,n=window.innerHeight||document.documentElement.clientHeight,i=window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches;return{pageUrl:window.location.href,pageTitle:document.title,referrer:document.referrer,deviceType:Xe(d),viewportWidth:d,viewportHeight:n,adWidth:t.width,adHeight:t.height,adPositionTop:o.top,adPositionLeft:o.left,isDarkMode:i,language:navigator.language,timezone:Intl.DateTimeFormat().resolvedOptions().timeZone}}function et(){return`session_${Date.now()}_${Math.random().toString(36).substring(2,11)}`}function tt(){return`batch_${Date.now()}_${Math.random().toString(36).substring(2,11)}`}function rt(e,t,o){return e>=o.visibilityThreshold&&t>=o.minimumDuration}function Z(e=new Date){return e.toISOString()}function at(e){return e.length===0?0:e.reduce((o,d)=>o+d,0)/e.length}function ge(e,t){let o;return function(...n){o||(e(...n),o=!0,setTimeout(()=>o=!1,t))}}async function ot(e,t,o=3,d=1e3){let n=null;for(let i=0;i<o;i++){try{const a=await fetch(t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(a.ok)return!0;n=new Error(`HTTP ${a.status}: ${a.statusText}`)}catch(a){n=a}i<o-1&&await new Promise(a=>setTimeout(a,d*Math.pow(2,i)))}return console.error("[AdMesh Viewability] Failed to send analytics event:",n),!1}async function nt(e,t,o,d=3,n=1e3){if(e.length===0)return!0;const i={batchId:tt(),sessionId:t,createdAt:Z(),events:e,eventCount:e.length};let a=null;for(let c=0;c<d;c++){try{const u=await fetch(o,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)});if(u.ok)return!0;a=new Error(`HTTP ${u.status}: ${u.statusText}`)}catch(u){a=u}c<d-1&&await new Promise(u=>setTimeout(u,n*Math.pow(2,c)))}return console.error("[AdMesh Viewability] Failed to send analytics batch:",a),!1}const st={enabled:!0,apiEndpoint:"https://api.useadmesh.com/analytics/ui-sdk/viewability",enableBatching:!0,batchSize:10,batchTimeout:5e3,debug:!1,enableRetry:!0,maxRetries:3,retryDelay:1e3};let ce=st;const it=e=>{ce={...ce,...e}};function _e({adId:e,productId:t,offerId:o,agentId:d,elementRef:n,config:i}){const a={...ce,...i},c=f.useRef(et()),[u,g]=f.useState({isVisible:!1,isViewable:!1,visibilityPercentage:0,timeMetrics:{loadedAt:Z(),totalVisibleDuration:0,totalViewableDuration:0,totalHoverDuration:0,totalFocusDuration:0},engagementMetrics:{currentScrollDepth:0,viewportEnterCount:0,viewportExitCount:0,hoverCount:0,wasClicked:!1,maxVisibilityPercentage:0,averageVisibilityPercentage:0},isTracking:a.enabled}),w=f.useRef(null),m=f.useRef(null),h=f.useRef(null),x=f.useRef(null),C=f.useRef(null),S=f.useRef([]),y=f.useRef([]),j=f.useRef(null),R=f.useCallback((p,_)=>{a.debug&&console.log(`[AdMesh Viewability] ${p}`,_)},[a.debug]),M=f.useCallback(async(p,_)=>{if(!a.enabled||!n.current||!w.current)return;const l=Ze(n.current),v={eventType:p,timestamp:Z(),sessionId:c.current,adId:e,productId:t,offerId:o,agentId:d,timeMetrics:u.timeMetrics,engagementMetrics:u.engagementMetrics,contextMetrics:l,mrcStandards:w.current,isViewable:u.isViewable,metadata:_};R(`Event: ${p}`,v),a.onEvent&&a.onEvent(v),a.enableBatching?(y.current.push(v),y.current.length>=a.batchSize?await V():(j.current&&clearTimeout(j.current),j.current=setTimeout(V,a.batchTimeout))):await ot(v,a.apiEndpoint,a.maxRetries,a.retryDelay)},[a,e,t,o,d,n,u,R]),V=f.useCallback(async()=>{if(y.current.length===0)return;const p=[...y.current];y.current=[],j.current&&(clearTimeout(j.current),j.current=null),await nt(p,c.current,a.apiEndpoint,a.maxRetries,a.retryDelay)&&a.onBatchSent&&a.onBatchSent({batchId:`batch_${Date.now()}`,sessionId:c.current,createdAt:Z(),events:p,eventCount:p.length})},[a]),I=f.useCallback(ge(()=>{if(!n.current)return;const p=Ke(n.current),_=Date.now(),l=new Date(u.timeMetrics.loadedAt).getTime();g(v=>{const k={...v};p>0&&S.current.push(p);const D=v.isVisible,L=p>0;if(L&&!D)m.current=_,k.engagementMetrics.viewportEnterCount++,k.timeMetrics.timeToFirstVisible||(k.timeMetrics.timeToFirstVisible=_-l,k.engagementMetrics.scrollDepthAtFirstVisible=fe(),M("ad_visible"));else if(!L&&D){if(m.current){const E=_-m.current;k.timeMetrics.totalVisibleDuration+=E,m.current=null}k.engagementMetrics.viewportExitCount++,M("ad_hidden")}else if(L&&D&&m.current){const E=_-m.current;k.timeMetrics.totalVisibleDuration+=E,m.current=_}if(k.isVisible=L,k.visibilityPercentage=p,p>k.engagementMetrics.maxVisibilityPercentage&&(k.engagementMetrics.maxVisibilityPercentage=p),S.current.length>0&&(k.engagementMetrics.averageVisibilityPercentage=at(S.current)),w.current){const E=v.isViewable,O=rt(p,k.timeMetrics.totalVisibleDuration,w.current);if(O&&!E)k.isViewable=!0,k.timeMetrics.timeToViewable=_-l,h.current=_,M("ad_viewable");else if(O&&E&&h.current){const U=_-h.current;k.timeMetrics.totalViewableDuration+=U,h.current=_}}return k.engagementMetrics.currentScrollDepth=fe(),k})},100),[n,u.timeMetrics.loadedAt,M]);return f.useEffect(()=>{if(!n.current)return;const p=n.current.getBoundingClientRect();w.current=Je(p.width,p.height,a.mrcStandards),R("Initialized MRC standards",w.current),M("ad_loaded")},[n,a.mrcStandards,R,M]),f.useEffect(()=>{if(!a.enabled||!n.current)return;const p=new IntersectionObserver(_=>{_.forEach(()=>{I()})},{threshold:[0,.1,.2,.3,.4,.5,.6,.7,.8,.9,1],rootMargin:"0px"});return p.observe(n.current),()=>{p.disconnect()}},[a.enabled,n,I]),f.useEffect(()=>{if(!a.enabled)return;const p=ge(()=>{I()},100);return window.addEventListener("scroll",p,{passive:!0}),()=>window.removeEventListener("scroll",p)},[a.enabled,I]),f.useEffect(()=>{if(!a.enabled||!n.current)return;const p=n.current,_=()=>{x.current=Date.now(),g(v=>({...v,engagementMetrics:{...v.engagementMetrics,hoverCount:v.engagementMetrics.hoverCount+1}})),M("ad_hover_start")},l=()=>{if(x.current){const v=Date.now()-x.current;g(k=>({...k,timeMetrics:{...k.timeMetrics,totalHoverDuration:k.timeMetrics.totalHoverDuration+v}})),x.current=null,M("ad_hover_end",{hoverDuration:v})}};return p.addEventListener("mouseenter",_),p.addEventListener("mouseleave",l),()=>{p.removeEventListener("mouseenter",_),p.removeEventListener("mouseleave",l)}},[a.enabled,n,M]),f.useEffect(()=>{if(!a.enabled||!n.current)return;const p=n.current,_=()=>{C.current=Date.now(),M("ad_focus")},l=()=>{if(C.current){const v=Date.now()-C.current;g(k=>({...k,timeMetrics:{...k.timeMetrics,totalFocusDuration:k.timeMetrics.totalFocusDuration+v}})),C.current=null,M("ad_blur",{focusDuration:v})}};return p.addEventListener("focus",_),p.addEventListener("blur",l),()=>{p.removeEventListener("focus",_),p.removeEventListener("blur",l)}},[a.enabled,n,M]),f.useEffect(()=>{if(!a.enabled||!n.current)return;const p=n.current,_=()=>{g(l=>({...l,engagementMetrics:{...l.engagementMetrics,wasClicked:!0}})),M("ad_click")};return p.addEventListener("click",_),()=>{p.removeEventListener("click",_)}},[a.enabled,n,M]),f.useEffect(()=>()=>{const p=Date.now(),_=new Date(u.timeMetrics.loadedAt).getTime(),l=p-_;g(v=>({...v,timeMetrics:{...v.timeMetrics,sessionDuration:l}})),M("ad_unloaded",{sessionDuration:l}),V()},[]),u}const Ce=({adId:e,productId:t,offerId:o,agentId:d,children:n,config:i,className:a,style:c,onViewabilityChange:u,onVisible:g,onViewable:w,onClick:m})=>{const h=f.useRef(null),x=_e({adId:e,productId:t,offerId:o,agentId:d,elementRef:h,config:i}),C=f.useRef(x.isViewable);f.useEffect(()=>{x.isViewable!==C.current&&(C.current=x.isViewable,u&&u(x.isViewable),x.isViewable&&w&&w())},[x.isViewable,u,w]);const S=f.useRef(x.isVisible);f.useEffect(()=>{x.isVisible!==S.current&&(S.current=x.isVisible,x.isVisible&&g&&g())},[x.isVisible,g]);const y=j=>{m&&m()};return r.jsx("div",{ref:h,className:a,style:c,onClick:y,"data-admesh-viewability-tracker":!0,"data-ad-id":e,"data-is-viewable":x.isViewable,"data-is-visible":x.isVisible,"data-visibility-percentage":x.visibilityPercentage.toFixed(2),children:n})};Ce.displayName="AdMeshViewabilityTracker";const B=(e={})=>{const t={mode:"light",primaryColor:"#000000",secondaryColor:"#666666",accentColor:"#000000",backgroundColor:"#ffffff",surfaceColor:"#ffffff",borderColor:"#e5e7eb",textColor:"#000000",textSecondaryColor:"#666666",fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',fontSize:{small:"12px",base:"14px",large:"16px",title:"18px"},borderRadius:"8px",spacing:{small:"4px",medium:"8px",large:"16px"},shadows:{small:"0 1px 3px rgba(0, 0, 0, 0.1)",medium:"0 4px 6px rgba(0, 0, 0, 0.1)",large:"0 10px 15px rgba(0, 0, 0, 0.1)"},icons:{expandIcon:"▼",collapseIcon:"▲",starIcon:"★",checkIcon:"✓",arrowIcon:"→"},gradients:{primary:"#000000",secondary:"#666666",accent:"#000000"},components:{productCard:{width:"100%"},citationUnit:{width:"100%"},inlineRecommendation:{width:"100%"},expandableUnit:{width:"100%"},compareTable:{width:"100%"},card:{width:"auto"},button:{width:"auto"}}},o={...t,...e,fontSize:{...t.fontSize,...e.fontSize},spacing:{...t.spacing,...e.spacing},shadows:{...t.shadows,...e.shadows},icons:{...t.icons,...e.icons},components:{...t.components,...e.components}};return lt(o)},dt=(e={})=>B({...{mode:"dark",primaryColor:"#ffffff",secondaryColor:"#9ca3af",accentColor:"#ffffff",backgroundColor:"#000000",surfaceColor:"#111111",borderColor:"#333333",textColor:"#ffffff",textSecondaryColor:"#9ca3af",shadows:{small:"0 1px 3px rgba(255, 255, 255, 0.1)",medium:"0 4px 6px rgba(255, 255, 255, 0.1)",large:"0 10px 15px rgba(255, 255, 255, 0.1)"},gradients:{primary:"#ffffff",secondary:"#9ca3af",accent:"#ffffff"}},...e}),ct={get minimal(){return B({primaryColor:"#000000",secondaryColor:"#666666",borderRadius:"4px",shadows:{small:"none",medium:"0 1px 3px rgba(0, 0, 0, 0.1)",large:"0 2px 6px rgba(0, 0, 0, 0.1)"},gradients:{primary:"#000000",secondary:"#666666",accent:"#000000"},components:{productCard:{width:"100%"},citationUnit:{width:"100%"},inlineRecommendation:{width:"100%"},expandableUnit:{width:"100%"},compareTable:{width:"100%"}}})},get vibrant(){return B({primaryColor:"#8b5cf6",secondaryColor:"#06b6d4",accentColor:"#f59e0b",borderRadius:"12px",gradients:{primary:"#8b5cf6",secondary:"#06b6d4",accent:"#f59e0b"},components:{productCard:{width:"100%"},citationUnit:{width:"100%"},inlineRecommendation:{width:"100%"},expandableUnit:{width:"100%"},compareTable:{width:"100%"}}})},get corporate(){return B({primaryColor:"#1e40af",secondaryColor:"#059669",backgroundColor:"#f8fafc",surfaceColor:"#ffffff",borderColor:"#cbd5e1",borderRadius:"6px",fontFamily:'"Inter", -apple-system, BlinkMacSystemFont, sans-serif',components:{productCard:{width:"100%"},citationUnit:{width:"100%"},inlineRecommendation:{width:"100%"},expandableUnit:{width:"100%"},compareTable:{width:"100%"}}})},get highContrast(){return B({primaryColor:"#000000",secondaryColor:"#ffffff",backgroundColor:"#ffffff",surfaceColor:"#f5f5f5",borderColor:"#000000",textColor:"#000000",textSecondaryColor:"#333333",borderRadius:"0px",shadows:{small:"none",medium:"0 0 0 2px #000000",large:"0 0 0 3px #000000"},components:{productCard:{width:"100%"},citationUnit:{width:"100%"},inlineRecommendation:{width:"100%"},expandableUnit:{width:"100%"},compareTable:{width:"100%"}}})}},lt=(e={})=>{const t=e.components||{},o={productCard:{width:"100%",...t.productCard},citationUnit:{width:"100%",...t.citationUnit},inlineRecommendation:{width:"100%",...t.inlineRecommendation},expandableUnit:{width:"100%",...t.expandableUnit},compareTable:{width:"100%",...t.compareTable},card:{width:"auto",...t.card},button:{width:"auto",...t.button}};return{...e,components:{...t,...o}}},mt=(...e)=>{const t=B();return e.reduce((o,d)=>d?{...o,...d,mode:d.mode||o.mode}:o,t)},ut=e=>{var o,d,n,i,a,c;const t=getComputedStyle(e);return{primaryColor:((o=t.getPropertyValue("--admesh-primary-color"))==null?void 0:o.trim())||void 0,secondaryColor:((d=t.getPropertyValue("--admesh-secondary-color"))==null?void 0:d.trim())||void 0,backgroundColor:((n=t.getPropertyValue("--admesh-background-color"))==null?void 0:n.trim())||void 0,textColor:((i=t.getPropertyValue("--admesh-text-color"))==null?void 0:i.trim())||void 0,borderRadius:((a=t.getPropertyValue("--admesh-border-radius"))==null?void 0:a.trim())||void 0,fontFamily:((c=t.getPropertyValue("--admesh-font-family"))==null?void 0:c.trim())||void 0}},pt="0.2.1",ht={trackingEnabled:!0,debug:!1,theme:{mode:"light",accentColor:"#2563eb"}};exports.AdMeshBadge=ke;exports.AdMeshEcommerceCards=ye;exports.AdMeshInlineCard=ve;exports.AdMeshLayout=qe;exports.AdMeshLinkTracker=X;exports.AdMeshProductCard=J;exports.AdMeshSummaryLayout=we;exports.AdMeshSummaryUnit=se;exports.AdMeshViewabilityTracker=Ce;exports.DEFAULT_CONFIG=ht;exports.VERSION=pt;exports.buildAdMeshLink=De;exports.createAdMeshTheme=B;exports.createDarkTheme=dt;exports.extractTrackingData=Le;exports.getBadgeText=$e;exports.getCtaText=Ue;exports.getInlineDisclosure=Oe;exports.getInlineTooltip=ze;exports.getLabelTooltip=de;exports.getPoweredByText=We;exports.getRecommendationLabel=q;exports.getSectionDisclosure=Fe;exports.hasHighQualityMatches=Be;exports.mergeThemes=mt;exports.setAdMeshTrackerConfig=Ie;exports.setViewabilityTrackerConfig=it;exports.themeFromCSSProperties=ut;exports.themePresets=ct;exports.useAdMeshStyles=xe;exports.useAdMeshTracker=be;exports.useViewabilityTracker=_e;
709
709
  //# sourceMappingURL=index.js.map