@askdialog/dialog-vue 3.9.0 → 3.10.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,4 +1,4 @@
1
- (function(S,t){typeof exports=="object"&&typeof module<"u"?t(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],t):(S=typeof globalThis<"u"?globalThis:S||self,t(S["dialog-vue"]={},S.Vue))})(this,(function(S,t){"use strict";var Ro=Object.defineProperty;var Bo=(S,t,T)=>t in S?Ro(S,t,{enumerable:!0,configurable:!0,writable:!0,value:T}):S[t]=T;var q=(S,t,T)=>Bo(S,typeof t!="symbol"?t+"":t,T);const T=new Set(["ar","he","iw","fa","ur"]),ce=o=>o!==void 0&&T.has(o.trim().toLowerCase().slice(0,2)),le=o=>ce(o)?"rtl":"ltr";var R;(function(o){o.OPEN_ASSISTANT="open_assistant",o.OPEN_WITH_SUGGESTIONS="OPEN_WITH_SUGGESTIONS",o.CLOSE_ASSISTANT="close_assistant",o.SEND_MESSAGE="PRODUCT_QUESTION",o.SEND_GENERIC_QUESTION="GENERIC_QUESTION",o.TRACK_ADD_TO_CART="TRACK_ADD_TO_CART",o.TRACK_SUBMIT_CHECKOUT="TRACK_SUBMIT_CHECKOUT",o.TRACK_VIEW_SEARCH_RESULTS="TRACK_VIEW_SEARCH_RESULTS",o.TRACK_SELECT_SEARCH_RESULT="TRACK_SELECT_SEARCH_RESULT"})(R||(R={}));var M;(function(o){o.USER_OPENED_ASSISTANT="userOpenedAssistant",o.USER_CLOSED_ASSISTANT="userClosedAssistant",o.USER_SENT_MESSAGE="userSentMessage",o.USER_CLICKED_ON_PRODUCT_CARD="userClickedOnProductCard",o.USER_OPENED_RECOMMENDATION="userOpenedRecommendation",o.USER_ADDED_TO_CART="userAddedToCart",o.USER_SEND_POSITIVE_FEEDBACK="userSendPositiveFeedback",o.USER_SEND_NEGATIVE_FEEDBACK="userSendNegativeFeedback"})(M||(M={})),R.TRACK_ADD_TO_CART,R.TRACK_SUBMIT_CHECKOUT,R.TRACK_VIEW_SEARCH_RESULTS,R.TRACK_SELECT_SEARCH_RESULT;class ae extends Error{constructor({status:n,code:s,message:r}){super(r);q(this,"status");q(this,"code");this.name="DialogSearchError",this.status=n,this.code=s}}const V=(o,e,n)=>{if(!/^[a-z]{2}$/.test(e))throw new Error("Search language must be a lowercase ISO 639-1 code.");if(!/^[A-Za-z]{3}$/.test(n))throw new Error("Search currency must be an ISO 4217 code.");return`${o}_${e}_${n.toLowerCase()}`},U="multiple installation methods detected:",ie=()=>typeof window>"u"?void 0:window,H=()=>{const o=ie();if(o!==void 0)return o.dialog=o.dialog??{},o.dialog.audit=o.dialog.audit??{methods:[],context:{},capabilities:[],warnings:[]},o.dialog.audit},de=o=>{if(o.warnings=o.warnings.filter(e=>!e.startsWith(U)),o.methods.length>=2){const e=o.methods.map(n=>n.method).join(", ");o.warnings.push(`${U} ${e}`)}},ue=(o,e)=>e===void 0?o:{version:(o==null?void 0:o.version)??e.version,commit:(o==null?void 0:o.commit)??e.commit},K=o=>{const e=H();if(e===void 0)return;const n=e.methods.find(s=>s.method===o.method);if(n===void 0){e.methods.push({...o,registeredAt:new Date().toISOString()}),de(e);return}n.version=n.version??o.version,n.build=ue(n.build,o.build),n.source=n.source??o.source},pe=o=>{const e=H();e!==void 0&&(e.capabilities.includes(o)||e.capabilities.push(o))},I={IDLE:"idle",LOADING:"loading",SUCCESS:"success",EMPTY:"empty",ERROR:"error"},me=.5,he=500,fe=1500,ge=100;function _e({emit:o,visibilityThreshold:e=me,dwellMs:n=he,idleFlushMs:s=fe,maxItemsPerEvent:r=ge}){let c,a=[];const l=new Set,p=new Map,d=new Map;let E;const i=()=>{clearTimeout(E),!(c===void 0||a.length===0)&&(o({...c,items:a}),a=[])},h=_=>{if(c===void 0)return;const g=`${c.query_id}:${_.product_id}`;if(!l.has(g)){if(l.add(g),a.push(_),a.length>=r){i();return}clearTimeout(E),E=setTimeout(i,s)}},f=_=>{const g=d.get(_);g!==void 0&&(clearTimeout(g),d.delete(_))},m=new IntersectionObserver(_=>{for(const g of _){const u=p.get(g.target);u!==void 0&&(g.intersectionRatio>=e?d.has(g.target)||d.set(g.target,setTimeout(()=>{d.delete(g.target),h(u)},n)):f(g.target))}},{threshold:e}),b=()=>{m.disconnect();for(const _ of d.values())clearTimeout(_);d.clear(),p.clear()},C=()=>{i()},y=_=>{if(_.persisted){l.clear();for(const g of p.keys())f(g),m.unobserve(g),m.observe(g)}};return window.addEventListener("pagehide",C),window.addEventListener("pageshow",y),{setContext(_){i(),l.clear(),c=_,b()},observe(_,g){p.set(_,g),m.observe(_)},forceImpression(_){h(_),i()},flush:i,disconnect(){i(),b(),window.removeEventListener("pagehide",C),window.removeEventListener("pageshow",y)}}}const F=(o,e)=>({product_id:o.hits[e].objectID,position:o.page*o.hitsPerPage+e+1});function Ee(o){let e,n;const s=()=>(e??(e=_e({emit:o.trackViewSearchResults})),e);return{onResponse(r){n={query_id:r.queryID,index:r.index,surface:o.surface,search_type:"lexical",page:r.page+1,total_hits:r.nbHits,query_length:[...r.query].length},s().setContext(n),r.nbHits===0&&o.trackViewSearchResults({...n,items:[]})},observeResult(r,c,a){s().observe(r,F(c,a))},select(r,c){if(n===void 0)return;const a=F(r,c);s().forceImpression(a),o.trackSelectSearchResult({...n,items:[a]})},dispose(){e==null||e.disconnect()}}}const ke=2,z=o=>{const e=o.trim();return[...e].length>=ke?e:void 0},Se=(o,e,n,{indexName:s,language:r,currency:c,hitsPerPage:a})=>({requests:[{indexName:s,query:o,page:e,hitsPerPage:a},...n.map(l=>({indexName:V(l.index,r,c),query:o,page:0,hitsPerPage:l.hitsPerPage??a}))]}),be=(o,e,{indexName:n,language:s,currency:r})=>{const c=o.results.find(l=>l.index===n);if(c===void 0)throw new Error(`Dialog search returned no ${n} entry`);const a={};for(const l of e){const p=V(l.index,s,r),d=o.results.find(E=>E.index===p);d!==void 0&&(a[l.index]=d)}return{response:c,sections:e.length===0?void 0:a}},D={status:I.IDLE,query:"",page:0,response:void 0,sections:void 0,error:void 0};function Ce({search:o,language:e,currency:n,analytics:s,navigate:r,debounceMs:c=250,hitsPerPage:a=12,sections:l=[]}){const p={indexName:V("products",e,n),language:e,currency:n,hitsPerPage:a};let d=D;const E=new Set,i=Ee(s);let h,f,m,b=0,C=!1;const y=u=>{d={...d,...u};for(const k of E)k(d)},_=()=>{clearTimeout(h),f=void 0,b+=1,m==null||m.abort(),m=void 0},g=async(u,k)=>{_(),m=new AbortController;const N=b;y({status:I.LOADING,query:u,page:k});try{const $=typeof l=="function"?l():l,re=Se(u,k,$,p),To=await o(re,{signal:m.signal});if(N!==b)return;const O=be(To,$,p);i.onResponse(O.response),y({...O,status:O.response.nbHits===0?I.EMPTY:I.SUCCESS,error:void 0})}catch($){if($ instanceof DOMException&&$.name==="AbortError"||N!==b)return;y({status:I.ERROR,error:$,response:void 0,sections:void 0})}};return{setQuery(u){if(C)return;_();const k=z(u);if(k===void 0){y(D);return}f=k,h=setTimeout(()=>void g(k,0),c)},submit(u){if(C)return;_();const k=z(u);if(k===void 0){y(D);return}g(k,0)},setPage(u){if(!C){if(f!==void 0){g(f,0);return}d.query!==""&&g(d.query,u)}},retry(){C||d.status!==I.ERROR||g(d.query,d.page)},observeResult(u,k){d.response!==void 0&&i.observeResult(u,d.response,k)},selectResult(u,k){const N=d.response;if(N===void 0)return!1;i.select(N,u);const $=N.hits[u].url;return((k==null?void 0:k.navigate)??!0)&&r!==void 0&&$!==void 0?(r($,N.hits[u]),!0):!1},subscribe(u){return E.add(u),()=>{E.delete(u)}},getState:()=>d,dispose(){C=!0,_(),E.clear(),i.dispose()}}}const j={en:{placeholder:"Ask the AI a question",aiDisclosure:"You're chatting with an AI assistant. It can make mistakes, so please double-check important information",askSomethingElse:"Ask something else"},fr:{placeholder:"Posez une question à l'IA",aiDisclosure:"Vous discutez avec un assistant IA. Il peut se tromper, pensez à vérifier les informations importantes",askSomethingElse:"Posez une autre question"},es:{placeholder:"Haz una pregunta a la IA",aiDisclosure:"Estás chateando con un asistente de IA. Puede cometer errores, así que verifica la información importante",askSomethingElse:"Pregunta otra cosa"}},G=o=>{var n;const e=((n=o==null?void 0:o.split("-")[0])==null?void 0:n.toLowerCase())??"en";return j[e]??j.en},ye=["disabled"],Ie=t.defineComponent({__name:"DialogAskSomethingElse",props:{client:{},questions:{},disabled:{type:Boolean},productId:{},productTitle:{},selectedVariantId:{}},setup(o){const e=o,n=()=>{e.client.openAssistantWithSuggestions({questions:e.questions??[],product:{id:e.productId,title:e.productTitle,selectedVariantId:e.selectedVariantId}})};return(s,r)=>(t.openBlock(),t.createElementBlock("button",{type:"button",class:"dialog-ask-something-else",disabled:e.disabled,onClick:n},t.toDisplayString(t.unref(G)(e.client.locale).askSomethingElse),9,ye))}}),w=(o,e)=>{const n=o.__vccOpts||o;for(const[s,r]of e)n[s]=r;return n},we=w(Ie,[["__scopeId","data-v-d0e272a0"]]),$e={class:"dialog-block-header-container"},Ne={class:"dialog-block-title"},Te={class:"dialog-block-description"},Re=w(t.defineComponent({__name:"DialogBlockHeader",props:{title:{},description:{}},setup(o){const e=o;return(n,s)=>(t.openBlock(),t.createElementBlock("div",$e,[t.createElementVNode("div",Ne,t.toDisplayString(e.title??"Your expert"),1),t.createElementVNode("div",Te,t.toDisplayString(e.description??"A question about this product?"),1)]))}}),[["__scopeId","data-v-28e6dda7"]]),Be={width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},Ae={"clip-path":"url(#clip0_466_934)"},Le=["stroke"],Ve=["stroke"],De=t.defineComponent({__name:"AiStarsIcon",props:{color:{}},setup(o){const e=o;return(n,s)=>(t.openBlock(),t.createElementBlock("svg",Be,[t.createElementVNode("g",Ae,[t.createElementVNode("path",{d:`M5.41675 10.8333L6.07046 12.1408C6.2917 12.5832 6.40232 12.8045 6.55011
1
+ (function(S,t){typeof exports=="object"&&typeof module<"u"?t(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],t):(S=typeof globalThis<"u"?globalThis:S||self,t(S["dialog-vue"]={},S.Vue))})(this,(function(S,t){"use strict";var Ro=Object.defineProperty;var Bo=(S,t,N)=>t in S?Ro(S,t,{enumerable:!0,configurable:!0,writable:!0,value:N}):S[t]=N;var q=(S,t,N)=>Bo(S,typeof t!="symbol"?t+"":t,N);const N=new Set(["ar","he","iw","fa","ur"]),ce=o=>o!==void 0&&N.has(o.trim().toLowerCase().slice(0,2)),le=o=>ce(o)?"rtl":"ltr";var R;(function(o){o.OPEN_ASSISTANT="open_assistant",o.OPEN_WITH_SUGGESTIONS="OPEN_WITH_SUGGESTIONS",o.CLOSE_ASSISTANT="close_assistant",o.SEND_MESSAGE="PRODUCT_QUESTION",o.SEND_GENERIC_QUESTION="GENERIC_QUESTION",o.TRACK_ADD_TO_CART="TRACK_ADD_TO_CART",o.TRACK_SUBMIT_CHECKOUT="TRACK_SUBMIT_CHECKOUT",o.TRACK_VIEW_SEARCH_RESULTS="TRACK_VIEW_SEARCH_RESULTS",o.TRACK_SELECT_SEARCH_RESULT="TRACK_SELECT_SEARCH_RESULT"})(R||(R={}));var M;(function(o){o.USER_OPENED_ASSISTANT="userOpenedAssistant",o.USER_CLOSED_ASSISTANT="userClosedAssistant",o.USER_SENT_MESSAGE="userSentMessage",o.USER_CLICKED_ON_PRODUCT_CARD="userClickedOnProductCard",o.USER_OPENED_RECOMMENDATION="userOpenedRecommendation",o.USER_ADDED_TO_CART="userAddedToCart",o.USER_SEND_POSITIVE_FEEDBACK="userSendPositiveFeedback",o.USER_SEND_NEGATIVE_FEEDBACK="userSendNegativeFeedback"})(M||(M={})),R.TRACK_ADD_TO_CART,R.TRACK_SUBMIT_CHECKOUT,R.TRACK_VIEW_SEARCH_RESULTS,R.TRACK_SELECT_SEARCH_RESULT;class ae extends Error{constructor({status:n,code:s,message:c}){super(c);q(this,"status");q(this,"code");this.name="DialogSearchError",this.status=n,this.code=s}}const V=(o,e,n)=>{if(!/^[a-z]{2}$/.test(e))throw new Error("Search language must be a lowercase ISO 639-1 code.");if(!/^[A-Za-z]{2}$/.test(n))throw new Error("Search country must be an ISO 3166-1 alpha-2 code.");return`${o}_${e}_${n.toLowerCase()}`},U="multiple installation methods detected:",ie=()=>typeof window>"u"?void 0:window,H=()=>{const o=ie();if(o!==void 0)return o.dialog=o.dialog??{},o.dialog.audit=o.dialog.audit??{methods:[],context:{},capabilities:[],warnings:[]},o.dialog.audit},de=o=>{if(o.warnings=o.warnings.filter(e=>!e.startsWith(U)),o.methods.length>=2){const e=o.methods.map(n=>n.method).join(", ");o.warnings.push(`${U} ${e}`)}},ue=(o,e)=>e===void 0?o:{version:(o==null?void 0:o.version)??e.version,commit:(o==null?void 0:o.commit)??e.commit},K=o=>{const e=H();if(e===void 0)return;const n=e.methods.find(s=>s.method===o.method);if(n===void 0){e.methods.push({...o,registeredAt:new Date().toISOString()}),de(e);return}n.version=n.version??o.version,n.build=ue(n.build,o.build),n.source=n.source??o.source},pe=o=>{const e=H();e!==void 0&&(e.capabilities.includes(o)||e.capabilities.push(o))},I={IDLE:"idle",LOADING:"loading",SUCCESS:"success",EMPTY:"empty",ERROR:"error"},me=.5,he=500,fe=1500,ge=100;function _e({emit:o,visibilityThreshold:e=me,dwellMs:n=he,idleFlushMs:s=fe,maxItemsPerEvent:c=ge}){let r,a=[];const l=new Set,u=new Map,i=new Map;let E;const d=()=>{clearTimeout(E),!(r===void 0||a.length===0)&&(o({...r,items:a}),a=[])},h=_=>{if(r===void 0)return;const g=`${r.query_id}:${_.product_id}`;if(!l.has(g)){if(l.add(g),a.push(_),a.length>=c){d();return}clearTimeout(E),E=setTimeout(d,s)}},f=_=>{const g=i.get(_);g!==void 0&&(clearTimeout(g),i.delete(_))},m=new IntersectionObserver(_=>{for(const g of _){const p=u.get(g.target);p!==void 0&&(g.intersectionRatio>=e?i.has(g.target)||i.set(g.target,setTimeout(()=>{i.delete(g.target),h(p)},n)):f(g.target))}},{threshold:e}),b=()=>{m.disconnect();for(const _ of i.values())clearTimeout(_);i.clear(),u.clear()},C=()=>{d()},y=_=>{if(_.persisted){l.clear();for(const g of u.keys())f(g),m.unobserve(g),m.observe(g)}};return window.addEventListener("pagehide",C),window.addEventListener("pageshow",y),{setContext(_){d(),l.clear(),r=_,b()},observe(_,g){u.set(_,g),m.observe(_)},forceImpression(_){h(_),d()},flush:d,disconnect(){d(),b(),window.removeEventListener("pagehide",C),window.removeEventListener("pageshow",y)}}}const F=(o,e)=>({product_id:String(o.hits[e].id),position:o.page*o.hitsPerPage+e+1});function Ee(o){let e,n;const s=()=>(e??(e=_e({emit:o.trackViewSearchResults})),e);return{onResponse(c){n={query_id:c.queryID,index:c.index,surface:o.surface,search_type:"lexical",page:c.page+1,total_hits:c.nbHits,query_length:[...c.query].length},s().setContext(n),c.nbHits===0&&o.trackViewSearchResults({...n,items:[]})},observeResult(c,r,a){s().observe(c,F(r,a))},select(c,r){if(n===void 0)return;const a=F(c,r);s().forceImpression(a),o.trackSelectSearchResult({...n,items:[a]})},dispose(){e==null||e.disconnect()}}}const ke=2,z=o=>{const e=o.trim();return[...e].length>=ke?e:void 0},Se=(o,e,n,{indexName:s,language:c,country:r,hitsPerPage:a})=>({requests:[{indexName:s,query:o,page:e,hitsPerPage:a},...n.map(l=>({indexName:V(l.index,c,r),query:o,page:0,hitsPerPage:l.hitsPerPage??a}))]}),be=(o,e,{indexName:n,language:s,country:c})=>{const r=o.results.find(l=>l.index===n);if(r===void 0)throw new Error(`Dialog search returned no ${n} entry`);const a={};for(const l of e){const u=V(l.index,s,c),i=o.results.find(E=>E.index===u);i!==void 0&&(a[l.index]=i)}return{response:r,sections:e.length===0?void 0:a}},D={status:I.IDLE,query:"",page:0,response:void 0,sections:void 0,error:void 0};function Ce({search:o,language:e,country:n,analytics:s,navigate:c,debounceMs:r=250,hitsPerPage:a=12,sections:l=[]}){const u={indexName:V("products",e,n),language:e,country:n,hitsPerPage:a};let i=D;const E=new Set,d=Ee(s);let h,f,m,b=0,C=!1;const y=p=>{i={...i,...p};for(const k of E)k(i)},_=()=>{clearTimeout(h),f=void 0,b+=1,m==null||m.abort(),m=void 0},g=async(p,k)=>{_(),m=new AbortController;const T=b;y({status:I.LOADING,query:p,page:k});try{const $=typeof l=="function"?l():l,re=Se(p,k,$,u),No=await o(re,{signal:m.signal});if(T!==b)return;const O=be(No,$,u);d.onResponse(O.response),y({...O,status:O.response.nbHits===0?I.EMPTY:I.SUCCESS,error:void 0})}catch($){if($ instanceof DOMException&&$.name==="AbortError"||T!==b)return;y({status:I.ERROR,error:$,response:void 0,sections:void 0})}};return{setQuery(p){if(C)return;_();const k=z(p);if(k===void 0){y(D);return}f=k,h=setTimeout(()=>void g(k,0),r)},submit(p){if(C)return;_();const k=z(p);if(k===void 0){y(D);return}g(k,0)},setPage(p){if(!C){if(f!==void 0){g(f,0);return}i.query!==""&&g(i.query,p)}},retry(){C||i.status!==I.ERROR||g(i.query,i.page)},observeResult(p,k){i.response!==void 0&&d.observeResult(p,i.response,k)},selectResult(p,k){const T=i.response;if(T===void 0)return!1;d.select(T,p);const $=T.hits[p].url;return((k==null?void 0:k.navigate)??!0)&&c!==void 0&&$!==void 0?(c($,T.hits[p]),!0):!1},subscribe(p){return E.add(p),()=>{E.delete(p)}},getState:()=>i,dispose(){C=!0,_(),E.clear(),d.dispose()}}}const j={en:{placeholder:"Ask the AI a question",aiDisclosure:"You're chatting with an AI assistant. It can make mistakes, so please double-check important information",askSomethingElse:"Ask something else"},fr:{placeholder:"Posez une question à l'IA",aiDisclosure:"Vous discutez avec un assistant IA. Il peut se tromper, pensez à vérifier les informations importantes",askSomethingElse:"Posez une autre question"},es:{placeholder:"Haz una pregunta a la IA",aiDisclosure:"Estás chateando con un asistente de IA. Puede cometer errores, así que verifica la información importante",askSomethingElse:"Pregunta otra cosa"}},v=o=>{var n;const e=((n=o==null?void 0:o.split("-")[0])==null?void 0:n.toLowerCase())??"en";return j[e]??j.en},ye=["disabled"],Ie=t.defineComponent({__name:"DialogAskSomethingElse",props:{client:{},questions:{},disabled:{type:Boolean},productId:{},productTitle:{},selectedVariantId:{}},setup(o){const e=o,n=()=>{e.client.openAssistantWithSuggestions({questions:e.questions??[],product:{id:e.productId,title:e.productTitle,selectedVariantId:e.selectedVariantId}})};return(s,c)=>(t.openBlock(),t.createElementBlock("button",{type:"button",class:"dialog-ask-something-else",disabled:e.disabled,onClick:n},t.toDisplayString(t.unref(v)(e.client.locale).askSomethingElse),9,ye))}}),w=(o,e)=>{const n=o.__vccOpts||o;for(const[s,c]of e)n[s]=c;return n},we=w(Ie,[["__scopeId","data-v-d0e272a0"]]),$e={class:"dialog-block-header-container"},Te={class:"dialog-block-title"},Ne={class:"dialog-block-description"},Re=w(t.defineComponent({__name:"DialogBlockHeader",props:{title:{},description:{}},setup(o){const e=o;return(n,s)=>(t.openBlock(),t.createElementBlock("div",$e,[t.createElementVNode("div",Te,t.toDisplayString(e.title??"Your expert"),1),t.createElementVNode("div",Ne,t.toDisplayString(e.description??"A question about this product?"),1)]))}}),[["__scopeId","data-v-28e6dda7"]]),Be={width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},Ae={"clip-path":"url(#clip0_466_934)"},Le=["stroke"],Ve=["stroke"],De=t.defineComponent({__name:"AiStarsIcon",props:{color:{}},setup(o){const e=o;return(n,s)=>(t.openBlock(),t.createElementBlock("svg",Be,[t.createElementVNode("g",Ae,[t.createElementVNode("path",{d:`M5.41675 10.8333L6.07046 12.1408C6.2917 12.5832 6.40232 12.8045 6.55011
2
2
  12.9962C6.68124 13.1663 6.83375 13.3188 7.00388 13.45C7.19559 13.5977 7.41684
3
3
  13.7084 7.85932 13.9296L9.16675 14.5833L7.85932 15.237C7.41684 15.4583 7.19559
4
4
  15.5689 7.00388 15.7167C6.83375 15.8478 6.68124 16.0003 6.55011 16.1704C6.40232
@@ -16,4 +16,4 @@
16
16
  9.01742C10.137 8.83469 9.83145 8.71718 9.22043 8.48217L6.66675 7.49999L9.22043
17
17
  6.5178C9.83145 6.28279 10.137 6.16529 10.3939 5.98256C10.6217 5.82061 10.8207
18
18
  5.62162 10.9827 5.39386C11.1654 5.13688 11.2829 4.83136 11.5179 4.22034L12.5001
19
- 1.66666Z`,stroke:e.color||"#181825","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"},null,8,Ve)]),s[0]||(s[0]=t.createElementVNode("defs",null,[t.createElementVNode("clipPath",{id:"clip0_466_934"},[t.createElementVNode("rect",{width:"20",height:"20",fill:"white"})])],-1))]))}}),xe=["onClick"],Pe={class:"dialog-block-suggestions-item-label"},Oe=w(t.defineComponent({__name:"DialogBlockSuggestions",props:{client:{},questions:{},productId:{},productTitle:{},selectedVariantId:{}},setup(o){const e=o,n=s=>{e.client.sendProductMessage({productId:e.productId,productTitle:e.productTitle,selectedVariantId:e.selectedVariantId,question:s,fromQuestionSuggestion:!0})};return(s,r)=>(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.questions,c=>(t.openBlock(),t.createElementBlock("button",{key:c.question,class:"dialog-block-suggestions-item",onClick:a=>n(c.question)},[t.createVNode(De,{class:"dialog-block-suggestions-item-icon",color:e.client.theme.primaryColor},null,8,["color"]),t.createElementVNode("span",Pe,t.toDisplayString(c.question),1)],8,xe))),128))}}),[["__scopeId","data-v-db34d4b4"]]),qe={};function Me(o,e){return t.openBlock(),t.createElementBlock(t.Fragment,null,[e[0]||(e[0]=t.createElementVNode("div",{class:"dialog-block-suggestions-skeleton-item"},null,-1)),e[1]||(e[1]=t.createElementVNode("div",{class:"dialog-block-suggestions-skeleton-item"},null,-1)),e[2]||(e[2]=t.createElementVNode("div",{class:"dialog-block-suggestions-skeleton-item"},null,-1))],64)}const Ue=w(qe,[["render",Me],["__scopeId","data-v-26a64b58"]]),He={class:"dialog-block-suggestions-container"},Ke=w(t.defineComponent({__name:"DialogBlockSuggestionsContainer",props:{client:{},questions:{},isLoading:{type:Boolean},productId:{},productTitle:{},selectedVariantId:{}},setup(o){const e=o;return(n,s)=>(t.openBlock(),t.createElementBlock("div",He,[e.isLoading||!e.questions?(t.openBlock(),t.createBlock(Ue,{key:0})):(t.openBlock(),t.createBlock(Oe,{key:1,client:e.client,questions:e.questions,"product-id":e.productId,"product-title":e.productTitle,"selected-variant-id":e.selectedVariantId},null,8,["client","questions","product-id","product-title","selected-variant-id"]))]))}}),[["__scopeId","data-v-18c9e78b"]]),Fe={width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},ze=["stroke"],je=t.defineComponent({__name:"ArrowIcon",props:{color:{}},setup(o){const e=o;return(n,s)=>(t.openBlock(),t.createElementBlock("svg",Fe,[t.createElementVNode("path",{d:"M10 16.6667V3.33334M10 3.33334L5 8.33334M10 3.33334L15 8.33334",stroke:e.color||"#ffffff","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"},null,8,ze)]))}}),Ge={class:"dialog-input-container"},ve=["placeholder"],Qe=["disabled"],We={id:"dialog-input-ai-disclosure",class:"dialog-input-ai-disclosure"},v=w(t.defineComponent({__name:"DialogInput",props:{client:{},placeholder:{},productId:{},productTitle:{},selectedVariantId:{}},setup(o){const e=o,n=t.ref(),s=t.ref(""),r=t.computed(()=>G(e.client.locale)),c=()=>{var l;(l=n.value)==null||l.focus()},a=()=>{const l=s.value;l.trim()&&(e.client.sendProductMessage({productId:e.productId,productTitle:e.productTitle,selectedVariantId:e.selectedVariantId,question:l,fromQuestionSuggestion:!0}),s.value="")};return(l,p)=>(t.openBlock(),t.createElementBlock("div",Ge,[t.createElementVNode("div",{class:"dialog-input-wrapper",onClick:c},[t.withDirectives(t.createElementVNode("input",{id:"dialog-ask-anything-input-ai-input",ref_key:"inputRef",ref:n,"onUpdate:modelValue":p[0]||(p[0]=d=>s.value=d),class:"dialog-ask-anything-input-ai-input",placeholder:r.value.placeholder,"aria-describedby":"dialog-input-ai-disclosure",onKeydown:t.withKeys(a,["enter"])},null,40,ve),[[t.vModelText,s.value]]),t.createElementVNode("button",{id:"send-message-button-ai-input",class:"dialog-input-submit",disabled:!s.value.trim(),onClick:a},[t.createVNode(je,{color:e.client.theme.ctaTextColor},null,8,["color"])],8,Qe)]),t.createElementVNode("p",We,t.toDisplayString(r.value.aiDisclosure),1)]))}}),[["__scopeId","data-v-87013888"]]),Xe=t.defineComponent({__name:"ThemeProvider",props:{theme:{}},setup(o){const e=o,n=document.body,s=c=>c.replace(/([A-Z])/g,"-$1").toLowerCase(),r=c=>{c&&Object.keys(c).forEach(a=>{const l=a,p=s(a);if(c[l]!==void 0){if(typeof c[l]=="object"){Object.keys(c[l]).forEach(d=>{var i;const E=d;if(E!==void 0){const h=s(d),f=c[l];n.style.setProperty(`--dialog-theme-${p}-${h}`,(i=f[E])==null?void 0:i.toString())}});return}if(l==="ctaBorderType"){const d=c[l]==="rounded"?"24px":"0";n.style.setProperty(`--dialog-theme-${p}`,d);return}n.style.setProperty(`--dialog-theme-${p}`,c[l].toString())}})};return t.onMounted(()=>{e.theme&&r(e.theme)}),t.watch(()=>e.theme,c=>{c&&r(c)},{deep:!0}),(c,a)=>t.renderSlot(c.$slots,"default")}}),Ye=["dir"],Ze=2,Je=5,et=w(t.defineComponent({__name:"DialogProductBlock",props:{client:{},productId:{},productTitle:{},selectedVariantId:{default:void 0},enableInput:{type:Boolean,default:!1}},setup(o){const e=o;t.onMounted(()=>{K({method:"vue",version:"3.9.0"}),pe("pdp-block")});const n=t.ref(!0),s=t.ref(void 0),r=t.ref(0),c=t.computed(()=>{var i;return n.value?"":(i=s.value)==null?void 0:i.assistantName}),a=t.computed(()=>{var i;return n.value?"":(i=s.value)==null?void 0:i.description}),l=t.computed(()=>{var i,h;return(h=(i=s.value)==null?void 0:i.questions)==null?void 0:h.slice(0,Ze)}),p=t.computed(()=>{var i;return n.value?"":(i=s.value)==null?void 0:i.inputPlaceholder}),d=t.computed(()=>{var i;return le((i=e.client.getLocalizationInformations())==null?void 0:i.languageCode)}),E=async()=>{const i=++r.value;n.value=!0,s.value=void 0;try{const h=await e.client.getSuggestions(e.productId,{limit:Je});i===r.value&&(s.value=h)}catch(h){console.error("error",h)}finally{i===r.value&&(n.value=!1)}};return t.watch(()=>[e.client,e.productId],()=>{E()},{immediate:!0}),(i,h)=>(t.openBlock(),t.createBlock(Xe,{theme:e.client.theme},{default:t.withCtx(()=>{var f;return[t.createElementVNode("div",{id:"dialog-instant",class:"dialog-block-container",dir:d.value},[t.createVNode(Re,{title:c.value,description:a.value},null,8,["title","description"]),t.createVNode(Ke,{client:e.client,questions:l.value,"is-loading":n.value,"product-id":e.productId,"product-title":e.productTitle,"selected-variant-id":e==null?void 0:e.selectedVariantId},null,8,["client","questions","is-loading","product-id","product-title","selected-variant-id"]),e.enableInput?(t.openBlock(),t.createBlock(v,{key:0,client:e.client,placeholder:p.value,"product-id":e.productId,"product-title":e.productTitle,"selected-variant-id":e==null?void 0:e.selectedVariantId},null,8,["client","placeholder","product-id","product-title","selected-variant-id"])):(t.openBlock(),t.createBlock(we,{key:1,client:e.client,questions:(f=s.value)==null?void 0:f.questions,disabled:n.value,"product-id":e.productId,"product-title":e.productTitle,"selected-variant-id":e.selectedVariantId},null,8,["client","questions","disabled","product-id","product-title","selected-variant-id"]))],8,Ye)]}),_:1},8,["theme"]))}}),[["__scopeId","data-v-0c307e5f"]]),tt={},ot={width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true"};function nt(o,e){return t.openBlock(),t.createElementBlock("svg",ot,e[0]||(e[0]=[t.createElementVNode("path",{d:"M8 13V3M8 3L3 8M8 3L13 8",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)]))}const st=w(tt,[["render",nt]]),rt={width:"16",height:"16",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true"},ct=["fill"],lt="M5.3217 0.588255C5.63241 -0.196084 6.36759 -0.196085 6.6783 0.588254C6.98901 1.37259 7.68193 2.82807 8.42693 3.57307C9.17193 4.31807 10.6274 5.01099 11.4117 5.3217C12.1961 5.63241 12.1961 6.36759 11.4117 6.6783C10.6274 6.98901 9.17193 7.68193 8.42693 8.42693C7.68193 9.17193 6.98901 10.6274 6.6783 11.4117C6.36759 12.1961 5.63241 12.1961 5.3217 11.4117C5.01099 10.6274 4.31807 9.17193 3.57307 8.42693C2.82808 7.68193 1.37259 6.98901 0.588255 6.6783C-0.196084 6.36759 -0.196085 5.63241 0.588254 5.3217C1.37259 5.01099 2.82807 4.31807 3.57307 3.57307C4.31807 2.82808 5.01099 1.37259 5.3217 0.588255Z",at=t.defineComponent({__name:"ShurikenIcon",props:{color:{}},setup(o){const e=o;return(n,s)=>(t.openBlock(),t.createElementBlock("svg",rt,[t.createElementVNode("path",{d:lt,fill:e.color||"currentColor"},null,8,ct)]))}}),it={class:"dialog-search-bar-field"},dt={class:"dialog-search-bar-icon"},ut=["aria-label","placeholder","autofocus"],pt=["aria-label"],mt=t.defineComponent({__name:"DialogSearchBar",props:{controller:{},placeholder:{default:"Search products..."},autoFocus:{type:Boolean,default:!1},submitAriaLabel:{default:"Search"}},setup(o){const e=o,n=t.ref(""),s=()=>{e.controller.setQuery(n.value)},r=()=>{e.controller.submit(n.value)};return(c,a)=>(t.openBlock(),t.createElementBlock("form",{class:"dialog-search-bar",role:"search",onSubmit:t.withModifiers(r,["prevent"])},[t.createElementVNode("div",it,[t.createElementVNode("span",dt,[t.createVNode(at)]),t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":a[0]||(a[0]=l=>n.value=l),type:"text",name:"dialog-search-query",class:"dialog-search-bar-input","aria-label":e.placeholder,placeholder:e.placeholder,autofocus:e.autoFocus,onInput:s},null,40,ut),[[t.vModelText,n.value]])]),t.createElementVNode("button",{type:"submit",class:"dialog-search-bar-submit","aria-label":e.submitAriaLabel},[t.createVNode(st)],8,pt)],32))}}),ht=(o,e)=>{try{return new Intl.NumberFormat(e).format(o)}catch{return String(o)}},Q={en:o=>({searching:e=>`Searching “${e}”…`,noResults:"No matching products",retry:"Retry",collectionsLabel:"Collections",productsLabel:"Products",collectionsCount:e=>e===1?"1 collection":`${o(e)} collections`,resultsCount:e=>e===1?"1 result":`${o(e)} results`,seeAllLabel:e=>e===1?"See the result":`See all ${o(e)} results`,previous:"Previous",next:"Next",pageOf:(e,n)=>`Page ${o(e)} / ${o(n)}`}),fr:o=>({searching:e=>`Recherche de « ${e} »…`,noResults:"Aucun produit correspondant",retry:"Réessayer",collectionsLabel:"Collections",productsLabel:"Produits",collectionsCount:e=>e===1?"1 collection":`${o(e)} collections`,resultsCount:e=>e===1?"1 résultat":`${o(e)} résultats`,seeAllLabel:e=>e===1?"Voir le résultat":`Voir les ${o(e)} résultats`,previous:"Précédent",next:"Suivant",pageOf:(e,n)=>`Page ${o(e)} / ${o(n)}`}),de:o=>({searching:e=>`Suche nach „${e}“…`,noResults:"Keine passenden Produkte",retry:"Erneut versuchen",collectionsLabel:"Kollektionen",productsLabel:"Produkte",collectionsCount:e=>e===1?"1 Kollektion":`${o(e)} Kollektionen`,resultsCount:e=>e===1?"1 Ergebnis":`${o(e)} Ergebnisse`,seeAllLabel:e=>e===1?"Das Ergebnis anzeigen":`Alle ${o(e)} Ergebnisse anzeigen`,previous:"Zurück",next:"Weiter",pageOf:(e,n)=>`Seite ${o(e)} / ${o(n)}`}),es:o=>({searching:e=>`Buscando «${e}»…`,noResults:"No hay productos que coincidan",retry:"Reintentar",collectionsLabel:"Colecciones",productsLabel:"Productos",collectionsCount:e=>e===1?"1 colección":`${o(e)} colecciones`,resultsCount:e=>e===1?"1 resultado":`${o(e)} resultados`,seeAllLabel:e=>e===1?"Ver el resultado":`Ver los ${o(e)} resultados`,previous:"Anterior",next:"Siguiente",pageOf:(e,n)=>`Página ${o(e)} / ${o(n)}`}),it:o=>({searching:e=>`Ricerca di “${e}”…`,noResults:"Nessun prodotto corrispondente",retry:"Riprova",collectionsLabel:"Collezioni",productsLabel:"Prodotti",collectionsCount:e=>e===1?"1 collezione":`${o(e)} collezioni`,resultsCount:e=>e===1?"1 risultato":`${o(e)} risultati`,seeAllLabel:e=>e===1?"Vedi il risultato":`Vedi tutti i ${o(e)} risultati`,previous:"Precedente",next:"Successivo",pageOf:(e,n)=>`Pagina ${o(e)} / ${o(n)}`})},W=o=>{var s;const e=((s=o==null?void 0:o.split("-")[0])==null?void 0:s.toLowerCase())??"en";return(Q[e]??Q.en)(r=>ht(r,o))},X=o=>o.status!==I.LOADING&&o.response!==void 0&&o.response.nbPages>1,ft={key:0,"aria-label":"Search results pages",class:"dialog-search-pagination"},gt=["disabled"],_t=["disabled"],Y=t.defineComponent({__name:"DialogSearchPagination",props:{controller:{},state:{},locale:{}},setup(o){const e=o,n=t.computed(()=>e.state.response),s=t.computed(()=>W(e.locale));return(r,c)=>n.value!==void 0&&t.unref(X)(e.state)?(t.openBlock(),t.createElementBlock("nav",ft,[t.createElementVNode("button",{type:"button",disabled:n.value.page===0,onClick:c[0]||(c[0]=a=>e.controller.setPage(n.value.page-1))},t.toDisplayString(s.value.previous),9,gt),t.createElementVNode("span",null,t.toDisplayString(s.value.pageOf(n.value.page+1,n.value.nbPages)),1),t.createElementVNode("button",{type:"button",disabled:n.value.page>=n.value.nbPages-1,onClick:c[1]||(c[1]=a=>e.controller.setPage(n.value.page+1))},t.toDisplayString(s.value.next),9,_t)])):t.createCommentVNode("",!0)}}),Z=o=>o.normalize("NFD").replace(new RegExp("\\p{M}","gu"),"").replace(/ẞ/gu,"ß").toUpperCase().toLowerCase().replace(/ς/g,"σ"),Et=(o,e)=>{const n={before:"",match:o,after:""},s=Z(e.trim());if(s==="")return n;const r=[...o],c=[];let a="";r.forEach((E,i)=>{const h=Z(E);for(let f=0;f<h.length;f+=1)c.push(i);a+=h});const l=a.indexOf(s);if(l===-1)return n;const p=c[l],d=c[l+s.length-1]+1;return{before:r.slice(0,p).join(""),match:r.slice(p,d).join(""),after:r.slice(d).join("")}},kt={key:0,class:"dialog-search-muted"},St={class:"dialog-search-match"},bt={key:1,class:"dialog-search-muted"},J=t.defineComponent({__name:"HighlightedTitle",props:{title:{},query:{}},setup(o){const e=o,n=t.computed(()=>Et(e.title,e.query));return(s,r)=>(t.openBlock(),t.createElementBlock(t.Fragment,null,[n.value.before!==""?(t.openBlock(),t.createElementBlock("span",kt,t.toDisplayString(n.value.before),1)):t.createCommentVNode("",!0),t.createElementVNode("span",St,t.toDisplayString(n.value.match),1),n.value.after!==""?(t.openBlock(),t.createElementBlock("span",bt,t.toDisplayString(n.value.after),1)):t.createCommentVNode("",!0)],64))}}),Ct=({amount:o,currencyCode:e},n)=>e===void 0?new Intl.NumberFormat(n).format(Number(o)):new Intl.NumberFormat(n,{style:"currency",currency:e}).format(Number(o)),yt=(o,e)=>{if(o===void 0)return"";try{return Ct(o.min,e)}catch{return""}},It=o=>{try{const{protocol:e}=new URL(o,window.location.href);return e==="http:"||e==="https:"?o:void 0}catch{return}},ee=o=>o.url===void 0||o.url===""?void 0:It(o.url),te=o=>o.title??o.handle??o.objectID,wt={class:"dialog-search-product-thumb","aria-hidden":"true"},$t=["src"],Nt={class:"dialog-search-product-title"},Tt={key:0,class:"dialog-search-product-price"},oe=t.defineComponent({__name:"DialogSearchProductCard",props:{controller:{},hit:{},index:{},locale:{default:void 0},query:{default:""}},setup(o){const e=o,n=t.ref();t.watch(()=>e.hit,()=>{n.value!==void 0&&e.controller.observeResult(n.value,e.index)},{immediate:!0,flush:"post"});const s=t.computed(()=>ee(e.hit)),r=t.computed(()=>yt(e.hit.priceRange,e.locale)),c=l=>{const p=l.metaKey||l.ctrlKey||l.shiftKey||l.altKey;e.controller.selectResult(e.index,{navigate:!p})&&l.preventDefault()},a=l=>{l.button===1&&e.controller.selectResult(e.index,{navigate:!1})};return(l,p)=>(t.openBlock(),t.createElementBlock("li",{ref_key:"cardRef",ref:n,class:"dialog-search-card"},[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(s.value===void 0?"div":"a"),t.mergeProps({class:"dialog-search-product",href:s.value},t.toHandlers(s.value===void 0?{}:{click:c,auxclick:a})),{default:t.withCtx(()=>[t.createElementVNode("span",wt,[e.hit.imageUrl!==void 0&&e.hit.imageUrl!==""?(t.openBlock(),t.createElementBlock("img",{key:0,src:e.hit.imageUrl,alt:"",loading:"lazy"},null,8,$t)):t.createCommentVNode("",!0)]),t.createElementVNode("span",Nt,[t.createVNode(J,{title:t.unref(te)(e.hit),query:e.query},null,8,["title","query"])]),r.value!==""?(t.openBlock(),t.createElementBlock("span",Tt,t.toDisplayString(r.value),1)):t.createCommentVNode("",!0)]),_:1},16,["href"]))],512))}}),Rt={},Bt={width:"16",height:"16",viewBox:"0 0 256 256",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true"};function At(o,e){return t.openBlock(),t.createElementBlock("svg",Bt,e[0]||(e[0]=[t.createElementVNode("path",{d:"M221.66,133.66l-72,72a8,8,0,0,1-11.32-11.32L196.69,136H40a8,8,0,0,1,0-16H196.69L138.34,61.66a8,8,0,0,1,11.32-11.32l72,72A8,8,0,0,1,221.66,133.66Z"},null,-1)]))}const Lt=w(Rt,[["render",At]]),Vt={},Dt={width:"12",height:"12",viewBox:"0 0 256 256",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true"};function xt(o,e){return t.openBlock(),t.createElementBlock("svg",Dt,e[0]||(e[0]=[t.createElementVNode("path",{d:"M181.66,133.66l-80,80a8,8,0,0,1-11.32-11.32L164.69,128,90.34,53.66a8,8,0,0,1,11.32-11.32l80,80A8,8,0,0,1,181.66,133.66Z"},null,-1)]))}const Pt=w(Vt,[["render",xt]]),ne=o=>(o??[]).flatMap(e=>{const n=ee(e);return n===void 0?[]:[{collection:e,href:n}]}),Ot={key:0,class:"dialog-search-collections"},qt={class:"dialog-search-section-head"},Mt={class:"dialog-search-label"},Ut={class:"dialog-search-count"},Ht={class:"dialog-search-collection-list"},Kt=["href"],Ft={class:"dialog-search-collection-thumb","aria-hidden":"true"},zt=["src"],jt={class:"dialog-search-collection-title"},Gt={class:"dialog-search-caret"},vt=t.defineComponent({__name:"DialogSearchCollections",props:{collections:{},query:{},messages:{}},setup(o){const e=o,n=t.computed(()=>ne(e.collections));return(s,r)=>n.value.length>0?(t.openBlock(),t.createElementBlock("aside",Ot,[t.createElementVNode("div",qt,[t.createElementVNode("p",Mt,t.toDisplayString(e.messages.collectionsLabel),1),t.createElementVNode("span",Ut,t.toDisplayString(e.messages.collectionsCount(n.value.length)),1)]),t.createElementVNode("ul",Ht,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(n.value,({collection:c,href:a})=>(t.openBlock(),t.createElementBlock("li",{key:c.objectID},[t.createElementVNode("a",{class:"dialog-search-collection",href:a},[t.createElementVNode("span",Ft,[c.imageUrl!==void 0&&c.imageUrl!==""?(t.openBlock(),t.createElementBlock("img",{key:0,src:c.imageUrl,alt:"",loading:"lazy"},null,8,zt)):t.createCommentVNode("",!0)]),t.createElementVNode("span",jt,[t.createVNode(J,{title:t.unref(te)(c),query:e.query},null,8,["title","query"])]),t.createElementVNode("span",Gt,[t.createVNode(Pt)])],8,Kt)]))),128))])])):t.createCommentVNode("",!0)}}),Qt={class:"dialog-search-products"},Wt={class:"dialog-search-section-head"},Xt={class:"dialog-search-label"},Yt={key:0,class:"dialog-search-label-count"},Zt={class:"dialog-search-results"},Jt={key:0,class:"dialog-search-empty",role:"status"},eo=t.defineComponent({__name:"DialogSearchProducts",props:{controller:{},response:{},locale:{},messages:{}},setup(o){const e=o;return(n,s)=>(t.openBlock(),t.createElementBlock("section",Qt,[t.createElementVNode("div",Wt,[t.createElementVNode("p",Xt,[t.createTextVNode(t.toDisplayString(e.messages.productsLabel),1),e.response.nbHits>0?(t.openBlock(),t.createElementBlock("span",Yt," · "+t.toDisplayString(e.messages.resultsCount(e.response.nbHits)),1)):t.createCommentVNode("",!0)])]),t.createElementVNode("ul",Zt,[e.response.hits.length===0?(t.openBlock(),t.createElementBlock("li",Jt,t.toDisplayString(e.messages.noResults),1)):(t.openBlock(!0),t.createElementBlock(t.Fragment,{key:1},t.renderList(e.response.hits,(r,c)=>(t.openBlock(),t.createBlock(oe,{key:r.objectID,controller:e.controller,hit:r,index:c,locale:e.locale,query:e.response.query},null,8,["controller","hit","index","locale","query"]))),128))])]))}}),A=8,B=16,to=200,oo=1440,no=(o,e)=>o.bottom>0&&o.top<e,so=(o,e)=>{const n=Math.min(oo,e-2*B),s=o.left+o.width/2-n/2;return{left:`${Math.min(Math.max(s,B),e-B-n)}px`,width:`${n}px`}},ro=(o,e,n)=>{const s=n-o.bottom-A-B,r=o.top-A-B,c=so(o,e);return s<to&&r>s?{...c,bottom:`${n-o.top+A}px`,maxHeight:`${Math.max(r,0)}px`}:{...c,top:`${o.bottom+A}px`,maxHeight:`${Math.max(s,0)}px`}},co=o=>{const e=o.trim().replace(/^#/,"");if(!/^(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/i.test(e))return;const n=e.length<=4?[...e].map(s=>s+s).join(""):e;return[0,2,4].map(s=>Number.parseInt(n.slice(s,s+2),16))},lo=o=>{const e=/^rgba?\((\d+), (\d+), (\d+)(?:, [\d.]+)?\)$/.exec(o);if(e!==null)return[e[1],e[2],e[3]].map(Number)},ao=o=>{if(typeof document>"u")return;const e=document.createElement("span");if(e.style.color=o,e.style.color==="")return;document.body.appendChild(e);const n=lo(getComputedStyle(e).color);return e.remove(),n},io=o=>co(o)??ao(o),uo=o=>{const e=o/255;return e<=.03928?e/12.92:((e+.055)/1.055)**2.4},se=o=>{const e=io(o);if(e===void 0)return;const[n,s,r]=e.map(uo);return .2126*n+.7152*s+.0722*r},po="#181825",mo="#ffffff",ho="straight",x=.5,P={light:{panel:"#ffffff",side:"#fafbfc",text:"#111827","text-sec":"#6b7280",border:"#eceef2",hover:"#eef2f7",thumb:"#eef1f5"},dark:{panel:"#15171c",side:"#1b1e25",text:"#f3f4f6","text-sec":"#9ca3af",border:"#2b2f38",hover:"#242830",thumb:"#2b2f38"}},fo={rectangle:{"r-panel":"4px","r-item":"4px","r-thumb":"2px","r-btn":"4px"},"rectangle-rounded":{"r-panel":"16px","r-item":"10px","r-thumb":"8px","r-btn":"10px"}},L=o=>o===void 0||o.trim()===""?void 0:o.trim(),go=o=>{const e=o===void 0?void 0:se(o);return e===void 0?"light":e<x?"dark":"light"},_o=(o,e)=>{const n=se(o);return n===void 0?P[e].text:(e==="light"?n<x:n>=x)?o:P[e].text},Eo=o=>{const e=go(L(o==null?void 0:o.backgroundColor)),n=(o==null?void 0:o.ctaBorderType)===ho?"rectangle":"rectangle-rounded",s=L(o==null?void 0:o.primaryColor)??po,r=L(o==null?void 0:o.fontFamily),c={...P[e],...fo[n],primary:s,accent:_o(s,e),"cta-text":L(o==null?void 0:o.ctaTextColor)??mo,...r===void 0?{}:{font:r}};return Object.fromEntries(Object.entries(c).map(([a,l])=>[`--dso-${a}`,l]))},ko=o=>{const e=t.ref(),n=t.ref(void 0),s=t.ref({width:0,height:0});return t.watch(o,(r,c,a)=>{if(!r)return;const l=()=>{const p=e.value;if(p===void 0)return;const d=p.previousElementSibling??p,{top:E,bottom:i,left:h,width:f}=d.getBoundingClientRect();(s.value.width!==window.innerWidth||s.value.height!==window.innerHeight)&&(s.value={width:window.innerWidth,height:window.innerHeight});const m=n.value;(m===void 0||m.top!==E||m.bottom!==i||m.left!==h||m.width!==f)&&(n.value={top:E,bottom:i,left:h,width:f})};l(),window.addEventListener("scroll",l,!0),window.addEventListener("resize",l),a(()=>{window.removeEventListener("scroll",l,!0),window.removeEventListener("resize",l)})},{immediate:!0,flush:"post"}),{anchorRef:e,rect:n,viewport:s}},So=(o,e)=>{const n=t.ref(!1),s=t.ref(),r=t.computed(()=>o.value.status!==I.IDLE&&!n.value);t.watch(()=>o.value.query,()=>{n.value=!1}),t.watch(r,(a,l,p)=>{if(!a)return;const d=E=>{var b,C;const i=E.target;if(!(i instanceof Node))return;const h=(b=e.value)==null?void 0:b.previousElementSibling,f=((C=s.value)==null?void 0:C.contains(i))??!1,m=(h==null?void 0:h.contains(i))??!1;!f&&!m&&(n.value=!0)};document.addEventListener("pointerdown",d),p(()=>document.removeEventListener("pointerdown",d))},{immediate:!0});const c=()=>{n.value=!1};return t.onMounted(()=>{var a,l;(l=(a=e.value)==null?void 0:a.previousElementSibling)==null||l.addEventListener("focusin",c)}),t.onUnmounted(()=>{var a,l;(l=(a=e.value)==null?void 0:a.previousElementSibling)==null||l.removeEventListener("focusin",c)}),{isOpen:r,panelRef:s}},bo={key:0,class:"dialog-search-error"},Co={role:"alert",class:"dialog-search-status dialog-search-status-error"},yo={key:1,role:"status",class:"dialog-search-status"},Io={key:0,class:"dialog-search-footer"},wo=["href"],$o=t.defineComponent({__name:"DialogSearchResults",props:{controller:{},state:{},locale:{default:void 0},theme:{default:void 0},layout:{default:"list"},seeAllHref:{type:Function,default:void 0}},setup(o){const e=o,n=u=>u instanceof ae?`Search failed (${u.status}${u.code?` ${u.code}`:""}): ${u.message}`:"Search failed: network error. Check your connection and try again.",s=t.computed(()=>e.state),r=t.computed(()=>e.state.status!==I.IDLE),{anchorRef:c,rect:a,viewport:l}=ko(r),{isOpen:p,panelRef:d}=So(s,c),E=t.computed(()=>p.value&&a.value!==void 0&&no(a.value,l.value.height)),i=t.computed(()=>Eo(e.theme)),h=t.computed(()=>({...a.value===void 0?{}:ro(a.value,l.value.width,l.value.height),...i.value})),f=t.computed(()=>W(e.locale)),m=t.computed(()=>e.state.response),b=t.computed(()=>{var u,k;return((k=(u=e.state.sections)==null?void 0:u.collections)==null?void 0:k.hits)??[]}),C=t.computed(()=>ne(b.value).length>0),y=t.computed(()=>e.seeAllHref!==void 0&&m.value!==void 0&&m.value.nbHits>0),_=t.computed(()=>!y.value&&X(e.state)),g=t.computed(()=>{var u;return m.value===void 0||(u=e.seeAllHref)==null?void 0:u.call(e,m.value.query)});return(u,k)=>(t.openBlock(),t.createElementBlock(t.Fragment,null,[t.createElementVNode("div",{ref_key:"anchorRef",ref:c},null,512),E.value?(t.openBlock(),t.createBlock(t.Teleport,{key:0,to:"body"},[t.createElementVNode("div",{ref_key:"panelRef",ref:d,class:t.normalizeClass(["dialog-search-panel",`dialog-search-panel--${e.layout}`]),style:t.normalizeStyle(h.value)},[e.state.status===t.unref(I).ERROR?(t.openBlock(),t.createElementBlock("div",bo,[t.createElementVNode("p",Co,t.toDisplayString(n(e.state.error)),1),t.createElementVNode("button",{type:"button",class:"dialog-search-retry",onClick:k[0]||(k[0]=N=>e.controller.retry())},t.toDisplayString(f.value.retry),1)])):m.value===void 0?(t.openBlock(),t.createElementBlock("p",yo,t.toDisplayString(f.value.searching(e.state.query)),1)):(t.openBlock(),t.createElementBlock(t.Fragment,{key:2},[t.createElementVNode("div",{class:t.normalizeClass(["dialog-search-body",{"dialog-search-body--no-collections":!C.value}])},[t.createVNode(vt,{collections:b.value,query:m.value.query,messages:f.value},null,8,["collections","query","messages"]),t.createVNode(eo,{controller:e.controller,response:m.value,locale:e.locale,messages:f.value},null,8,["controller","response","locale","messages"])],2),y.value||_.value?(t.openBlock(),t.createElementBlock("div",Io,[y.value?(t.openBlock(),t.createElementBlock("a",{key:0,class:"dialog-search-cta",href:g.value},[t.createTextVNode(t.toDisplayString(f.value.seeAllLabel(m.value.nbHits))+" ",1),t.createVNode(Lt)],8,wo)):(t.openBlock(),t.createBlock(Y,{key:1,controller:e.controller,state:e.state,locale:e.locale},null,8,["controller","state","locale"]))])):t.createCommentVNode("",!0)],64))],6)])):t.createCommentVNode("",!0)],64))}}),No=o=>{const{client:e,surface:n="search_page",...s}=o,r=Ce({search:(l,p)=>e.search(l,p),analytics:{surface:n,trackViewSearchResults:l=>e.trackViewSearchResults(l),trackSelectSearchResult:l=>e.trackSelectSearchResult(l)},...s}),c=t.shallowRef(r.getState()),a=r.subscribe(()=>{c.value=r.getState()});return t.onMounted(()=>{K({method:"vue",version:"3.9.0"})}),t.onUnmounted(()=>{a(),r.dispose()}),{controller:r,state:c,theme:e.theme}};S.DialogInput=v,S.DialogProductBlock=et,S.DialogSearchBar=mt,S.DialogSearchPagination=Y,S.DialogSearchProductCard=oe,S.DialogSearchResults=$o,S.useDialogSearch=No,Object.defineProperty(S,Symbol.toStringTag,{value:"Module"})}));
19
+ 1.66666Z`,stroke:e.color||"#181825","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"},null,8,Ve)]),s[0]||(s[0]=t.createElementVNode("defs",null,[t.createElementVNode("clipPath",{id:"clip0_466_934"},[t.createElementVNode("rect",{width:"20",height:"20",fill:"white"})])],-1))]))}}),xe=["onClick"],Pe={class:"dialog-block-suggestions-item-label"},Oe=w(t.defineComponent({__name:"DialogBlockSuggestions",props:{client:{},questions:{},productId:{},productTitle:{},selectedVariantId:{}},setup(o){const e=o,n=s=>{e.client.sendProductMessage({productId:e.productId,productTitle:e.productTitle,selectedVariantId:e.selectedVariantId,question:s,fromQuestionSuggestion:!0})};return(s,c)=>(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.questions,r=>(t.openBlock(),t.createElementBlock("button",{key:r.question,class:"dialog-block-suggestions-item",onClick:a=>n(r.question)},[t.createVNode(De,{class:"dialog-block-suggestions-item-icon",color:e.client.theme.primaryColor},null,8,["color"]),t.createElementVNode("span",Pe,t.toDisplayString(r.question),1)],8,xe))),128))}}),[["__scopeId","data-v-db34d4b4"]]),qe={};function Me(o,e){return t.openBlock(),t.createElementBlock(t.Fragment,null,[e[0]||(e[0]=t.createElementVNode("div",{class:"dialog-block-suggestions-skeleton-item"},null,-1)),e[1]||(e[1]=t.createElementVNode("div",{class:"dialog-block-suggestions-skeleton-item"},null,-1)),e[2]||(e[2]=t.createElementVNode("div",{class:"dialog-block-suggestions-skeleton-item"},null,-1))],64)}const Ue=w(qe,[["render",Me],["__scopeId","data-v-26a64b58"]]),He={class:"dialog-block-suggestions-container"},Ke=w(t.defineComponent({__name:"DialogBlockSuggestionsContainer",props:{client:{},questions:{},isLoading:{type:Boolean},productId:{},productTitle:{},selectedVariantId:{}},setup(o){const e=o;return(n,s)=>(t.openBlock(),t.createElementBlock("div",He,[e.isLoading||!e.questions?(t.openBlock(),t.createBlock(Ue,{key:0})):(t.openBlock(),t.createBlock(Oe,{key:1,client:e.client,questions:e.questions,"product-id":e.productId,"product-title":e.productTitle,"selected-variant-id":e.selectedVariantId},null,8,["client","questions","product-id","product-title","selected-variant-id"]))]))}}),[["__scopeId","data-v-18c9e78b"]]),Fe={width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},ze=["stroke"],je=t.defineComponent({__name:"ArrowIcon",props:{color:{}},setup(o){const e=o;return(n,s)=>(t.openBlock(),t.createElementBlock("svg",Fe,[t.createElementVNode("path",{d:"M10 16.6667V3.33334M10 3.33334L5 8.33334M10 3.33334L15 8.33334",stroke:e.color||"#ffffff","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"},null,8,ze)]))}}),ve={class:"dialog-input-container"},Ge=["placeholder"],Qe=["disabled"],We={id:"dialog-input-ai-disclosure",class:"dialog-input-ai-disclosure"},G=w(t.defineComponent({__name:"DialogInput",props:{client:{},placeholder:{},productId:{},productTitle:{},selectedVariantId:{}},setup(o){const e=o,n=t.ref(),s=t.ref(""),c=t.computed(()=>v(e.client.locale)),r=()=>{var l;(l=n.value)==null||l.focus()},a=()=>{const l=s.value;l.trim()&&(e.client.sendProductMessage({productId:e.productId,productTitle:e.productTitle,selectedVariantId:e.selectedVariantId,question:l,fromQuestionSuggestion:!0}),s.value="")};return(l,u)=>(t.openBlock(),t.createElementBlock("div",ve,[t.createElementVNode("div",{class:"dialog-input-wrapper",onClick:r},[t.withDirectives(t.createElementVNode("input",{id:"dialog-ask-anything-input-ai-input",ref_key:"inputRef",ref:n,"onUpdate:modelValue":u[0]||(u[0]=i=>s.value=i),class:"dialog-ask-anything-input-ai-input",placeholder:c.value.placeholder,"aria-describedby":"dialog-input-ai-disclosure",onKeydown:t.withKeys(a,["enter"])},null,40,Ge),[[t.vModelText,s.value]]),t.createElementVNode("button",{id:"send-message-button-ai-input",class:"dialog-input-submit",disabled:!s.value.trim(),onClick:a},[t.createVNode(je,{color:e.client.theme.ctaTextColor},null,8,["color"])],8,Qe)]),t.createElementVNode("p",We,t.toDisplayString(c.value.aiDisclosure),1)]))}}),[["__scopeId","data-v-87013888"]]),Xe=t.defineComponent({__name:"ThemeProvider",props:{theme:{}},setup(o){const e=o,n=document.body,s=r=>r.replace(/([A-Z])/g,"-$1").toLowerCase(),c=r=>{r&&Object.keys(r).forEach(a=>{const l=a,u=s(a);if(r[l]!==void 0){if(typeof r[l]=="object"){Object.keys(r[l]).forEach(i=>{var d;const E=i;if(E!==void 0){const h=s(i),f=r[l];n.style.setProperty(`--dialog-theme-${u}-${h}`,(d=f[E])==null?void 0:d.toString())}});return}if(l==="ctaBorderType"){const i=r[l]==="rounded"?"24px":"0";n.style.setProperty(`--dialog-theme-${u}`,i);return}n.style.setProperty(`--dialog-theme-${u}`,r[l].toString())}})};return t.onMounted(()=>{e.theme&&c(e.theme)}),t.watch(()=>e.theme,r=>{r&&c(r)},{deep:!0}),(r,a)=>t.renderSlot(r.$slots,"default")}}),Ye=["dir"],Ze=2,Je=5,et=w(t.defineComponent({__name:"DialogProductBlock",props:{client:{},productId:{},productTitle:{},selectedVariantId:{default:void 0},enableInput:{type:Boolean,default:!1}},setup(o){const e=o;t.onMounted(()=>{K({method:"vue",version:"3.10.0"}),pe("pdp-block")});const n=t.ref(!0),s=t.ref(void 0),c=t.ref(0),r=t.computed(()=>{var d;return n.value?"":(d=s.value)==null?void 0:d.assistantName}),a=t.computed(()=>{var d;return n.value?"":(d=s.value)==null?void 0:d.description}),l=t.computed(()=>{var d,h;return(h=(d=s.value)==null?void 0:d.questions)==null?void 0:h.slice(0,Ze)}),u=t.computed(()=>{var d;return n.value?"":(d=s.value)==null?void 0:d.inputPlaceholder}),i=t.computed(()=>{var d;return le((d=e.client.getLocalizationInformations())==null?void 0:d.languageCode)}),E=async()=>{const d=++c.value;n.value=!0,s.value=void 0;try{const h=await e.client.getSuggestions(e.productId,{limit:Je});d===c.value&&(s.value=h)}catch(h){console.error("error",h)}finally{d===c.value&&(n.value=!1)}};return t.watch(()=>[e.client,e.productId],()=>{E()},{immediate:!0}),(d,h)=>(t.openBlock(),t.createBlock(Xe,{theme:e.client.theme},{default:t.withCtx(()=>{var f;return[t.createElementVNode("div",{id:"dialog-instant",class:"dialog-block-container",dir:i.value},[t.createVNode(Re,{title:r.value,description:a.value},null,8,["title","description"]),t.createVNode(Ke,{client:e.client,questions:l.value,"is-loading":n.value,"product-id":e.productId,"product-title":e.productTitle,"selected-variant-id":e==null?void 0:e.selectedVariantId},null,8,["client","questions","is-loading","product-id","product-title","selected-variant-id"]),e.enableInput?(t.openBlock(),t.createBlock(G,{key:0,client:e.client,placeholder:u.value,"product-id":e.productId,"product-title":e.productTitle,"selected-variant-id":e==null?void 0:e.selectedVariantId},null,8,["client","placeholder","product-id","product-title","selected-variant-id"])):(t.openBlock(),t.createBlock(we,{key:1,client:e.client,questions:(f=s.value)==null?void 0:f.questions,disabled:n.value,"product-id":e.productId,"product-title":e.productTitle,"selected-variant-id":e.selectedVariantId},null,8,["client","questions","disabled","product-id","product-title","selected-variant-id"]))],8,Ye)]}),_:1},8,["theme"]))}}),[["__scopeId","data-v-0c307e5f"]]),tt={},ot={width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true"};function nt(o,e){return t.openBlock(),t.createElementBlock("svg",ot,e[0]||(e[0]=[t.createElementVNode("path",{d:"M8 13V3M8 3L3 8M8 3L13 8",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)]))}const st=w(tt,[["render",nt]]),rt={width:"16",height:"16",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true"},ct=["fill"],lt="M5.3217 0.588255C5.63241 -0.196084 6.36759 -0.196085 6.6783 0.588254C6.98901 1.37259 7.68193 2.82807 8.42693 3.57307C9.17193 4.31807 10.6274 5.01099 11.4117 5.3217C12.1961 5.63241 12.1961 6.36759 11.4117 6.6783C10.6274 6.98901 9.17193 7.68193 8.42693 8.42693C7.68193 9.17193 6.98901 10.6274 6.6783 11.4117C6.36759 12.1961 5.63241 12.1961 5.3217 11.4117C5.01099 10.6274 4.31807 9.17193 3.57307 8.42693C2.82808 7.68193 1.37259 6.98901 0.588255 6.6783C-0.196084 6.36759 -0.196085 5.63241 0.588254 5.3217C1.37259 5.01099 2.82807 4.31807 3.57307 3.57307C4.31807 2.82808 5.01099 1.37259 5.3217 0.588255Z",at=t.defineComponent({__name:"ShurikenIcon",props:{color:{}},setup(o){const e=o;return(n,s)=>(t.openBlock(),t.createElementBlock("svg",rt,[t.createElementVNode("path",{d:lt,fill:e.color||"currentColor"},null,8,ct)]))}}),it={class:"dialog-search-bar-field"},dt={class:"dialog-search-bar-icon"},ut=["aria-label","placeholder","autofocus"],pt=["aria-label"],mt=t.defineComponent({__name:"DialogSearchBar",props:{controller:{},placeholder:{default:"Search products..."},autoFocus:{type:Boolean,default:!1},submitAriaLabel:{default:"Search"}},setup(o){const e=o,n=t.ref(""),s=()=>{e.controller.setQuery(n.value)},c=()=>{e.controller.submit(n.value)};return(r,a)=>(t.openBlock(),t.createElementBlock("form",{class:"dialog-search-bar",role:"search",onSubmit:t.withModifiers(c,["prevent"])},[t.createElementVNode("div",it,[t.createElementVNode("span",dt,[t.createVNode(at)]),t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":a[0]||(a[0]=l=>n.value=l),type:"text",name:"dialog-search-query",class:"dialog-search-bar-input","aria-label":e.placeholder,placeholder:e.placeholder,autofocus:e.autoFocus,onInput:s},null,40,ut),[[t.vModelText,n.value]])]),t.createElementVNode("button",{type:"submit",class:"dialog-search-bar-submit","aria-label":e.submitAriaLabel},[t.createVNode(st)],8,pt)],32))}}),ht=(o,e)=>{try{return new Intl.NumberFormat(e).format(o)}catch{return String(o)}},Q={en:o=>({searching:e=>`Searching “${e}”…`,noResults:"No matching products",retry:"Retry",collectionsLabel:"Collections",productsLabel:"Products",collectionsCount:e=>e===1?"1 collection":`${o(e)} collections`,resultsCount:e=>e===1?"1 result":`${o(e)} results`,seeAllLabel:e=>e===1?"See the result":`See all ${o(e)} results`,previous:"Previous",next:"Next",pageOf:(e,n)=>`Page ${o(e)} / ${o(n)}`}),fr:o=>({searching:e=>`Recherche de « ${e} »…`,noResults:"Aucun produit correspondant",retry:"Réessayer",collectionsLabel:"Collections",productsLabel:"Produits",collectionsCount:e=>e===1?"1 collection":`${o(e)} collections`,resultsCount:e=>e===1?"1 résultat":`${o(e)} résultats`,seeAllLabel:e=>e===1?"Voir le résultat":`Voir les ${o(e)} résultats`,previous:"Précédent",next:"Suivant",pageOf:(e,n)=>`Page ${o(e)} / ${o(n)}`}),de:o=>({searching:e=>`Suche nach „${e}“…`,noResults:"Keine passenden Produkte",retry:"Erneut versuchen",collectionsLabel:"Kollektionen",productsLabel:"Produkte",collectionsCount:e=>e===1?"1 Kollektion":`${o(e)} Kollektionen`,resultsCount:e=>e===1?"1 Ergebnis":`${o(e)} Ergebnisse`,seeAllLabel:e=>e===1?"Das Ergebnis anzeigen":`Alle ${o(e)} Ergebnisse anzeigen`,previous:"Zurück",next:"Weiter",pageOf:(e,n)=>`Seite ${o(e)} / ${o(n)}`}),es:o=>({searching:e=>`Buscando «${e}»…`,noResults:"No hay productos que coincidan",retry:"Reintentar",collectionsLabel:"Colecciones",productsLabel:"Productos",collectionsCount:e=>e===1?"1 colección":`${o(e)} colecciones`,resultsCount:e=>e===1?"1 resultado":`${o(e)} resultados`,seeAllLabel:e=>e===1?"Ver el resultado":`Ver los ${o(e)} resultados`,previous:"Anterior",next:"Siguiente",pageOf:(e,n)=>`Página ${o(e)} / ${o(n)}`}),it:o=>({searching:e=>`Ricerca di “${e}”…`,noResults:"Nessun prodotto corrispondente",retry:"Riprova",collectionsLabel:"Collezioni",productsLabel:"Prodotti",collectionsCount:e=>e===1?"1 collezione":`${o(e)} collezioni`,resultsCount:e=>e===1?"1 risultato":`${o(e)} risultati`,seeAllLabel:e=>e===1?"Vedi il risultato":`Vedi tutti i ${o(e)} risultati`,previous:"Precedente",next:"Successivo",pageOf:(e,n)=>`Pagina ${o(e)} / ${o(n)}`})},W=o=>{var s;const e=((s=o==null?void 0:o.split("-")[0])==null?void 0:s.toLowerCase())??"en";return(Q[e]??Q.en)(c=>ht(c,o))},X=o=>o.status!==I.LOADING&&o.response!==void 0&&o.response.nbPages>1,ft={key:0,"aria-label":"Search results pages",class:"dialog-search-pagination"},gt=["disabled"],_t=["disabled"],Y=t.defineComponent({__name:"DialogSearchPagination",props:{controller:{},state:{},locale:{}},setup(o){const e=o,n=t.computed(()=>e.state.response),s=t.computed(()=>W(e.locale));return(c,r)=>n.value!==void 0&&t.unref(X)(e.state)?(t.openBlock(),t.createElementBlock("nav",ft,[t.createElementVNode("button",{type:"button",disabled:n.value.page===0,onClick:r[0]||(r[0]=a=>e.controller.setPage(n.value.page-1))},t.toDisplayString(s.value.previous),9,gt),t.createElementVNode("span",null,t.toDisplayString(s.value.pageOf(n.value.page+1,n.value.nbPages)),1),t.createElementVNode("button",{type:"button",disabled:n.value.page>=n.value.nbPages-1,onClick:r[1]||(r[1]=a=>e.controller.setPage(n.value.page+1))},t.toDisplayString(s.value.next),9,_t)])):t.createCommentVNode("",!0)}}),Z=o=>o.normalize("NFD").replace(new RegExp("\\p{M}","gu"),"").replace(/ẞ/gu,"ß").toUpperCase().toLowerCase().replace(/ς/g,"σ"),Et=(o,e)=>{const n={before:"",match:o,after:""},s=Z(e.trim());if(s==="")return n;const c=[...o],r=[];let a="";c.forEach((E,d)=>{const h=Z(E);for(let f=0;f<h.length;f+=1)r.push(d);a+=h});const l=a.indexOf(s);if(l===-1)return n;const u=r[l],i=r[l+s.length-1]+1;return{before:c.slice(0,u).join(""),match:c.slice(u,i).join(""),after:c.slice(i).join("")}},kt={key:0,class:"dialog-search-muted"},St={class:"dialog-search-match"},bt={key:1,class:"dialog-search-muted"},J=t.defineComponent({__name:"HighlightedTitle",props:{title:{},query:{}},setup(o){const e=o,n=t.computed(()=>Et(e.title,e.query));return(s,c)=>(t.openBlock(),t.createElementBlock(t.Fragment,null,[n.value.before!==""?(t.openBlock(),t.createElementBlock("span",kt,t.toDisplayString(n.value.before),1)):t.createCommentVNode("",!0),t.createElementVNode("span",St,t.toDisplayString(n.value.match),1),n.value.after!==""?(t.openBlock(),t.createElementBlock("span",bt,t.toDisplayString(n.value.after),1)):t.createCommentVNode("",!0)],64))}}),Ct=({variants_min_price:o,currency:e},n)=>{if(o===void 0)return"";try{return e===void 0?new Intl.NumberFormat(n).format(o):new Intl.NumberFormat(n,{style:"currency",currency:e}).format(o)}catch{return""}},yt=o=>o.product_image||o.image||void 0,It=o=>{try{const{protocol:e}=new URL(o,window.location.href);return e==="http:"||e==="https:"?o:void 0}catch{return}},ee=o=>o.url===void 0||o.url===""?void 0:It(o.url),te=o=>o.title??o.handle??o.objectID,wt={class:"dialog-search-product-thumb","aria-hidden":"true"},$t=["src"],Tt={class:"dialog-search-product-title"},Nt={key:0,class:"dialog-search-product-price"},oe=t.defineComponent({__name:"DialogSearchProductCard",props:{controller:{},hit:{},index:{},locale:{default:void 0},query:{default:""}},setup(o){const e=o,n=t.ref();t.watch(()=>e.hit,()=>{n.value!==void 0&&e.controller.observeResult(n.value,e.index)},{immediate:!0,flush:"post"});const s=t.computed(()=>ee(e.hit)),c=t.computed(()=>yt(e.hit)),r=t.computed(()=>Ct(e.hit,e.locale)),a=u=>{const i=u.metaKey||u.ctrlKey||u.shiftKey||u.altKey;e.controller.selectResult(e.index,{navigate:!i})&&u.preventDefault()},l=u=>{u.button===1&&e.controller.selectResult(e.index,{navigate:!1})};return(u,i)=>(t.openBlock(),t.createElementBlock("li",{ref_key:"cardRef",ref:n,class:"dialog-search-card"},[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(s.value===void 0?"div":"a"),t.mergeProps({class:"dialog-search-product",href:s.value},t.toHandlers(s.value===void 0?{}:{click:a,auxclick:l})),{default:t.withCtx(()=>[t.createElementVNode("span",wt,[c.value!==void 0?(t.openBlock(),t.createElementBlock("img",{key:0,src:c.value,alt:"",loading:"lazy"},null,8,$t)):t.createCommentVNode("",!0)]),t.createElementVNode("span",Tt,[t.createVNode(J,{title:t.unref(te)(e.hit),query:e.query},null,8,["title","query"])]),r.value!==""?(t.openBlock(),t.createElementBlock("span",Nt,t.toDisplayString(r.value),1)):t.createCommentVNode("",!0)]),_:1},16,["href"]))],512))}}),Rt={},Bt={width:"16",height:"16",viewBox:"0 0 256 256",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true"};function At(o,e){return t.openBlock(),t.createElementBlock("svg",Bt,e[0]||(e[0]=[t.createElementVNode("path",{d:"M221.66,133.66l-72,72a8,8,0,0,1-11.32-11.32L196.69,136H40a8,8,0,0,1,0-16H196.69L138.34,61.66a8,8,0,0,1,11.32-11.32l72,72A8,8,0,0,1,221.66,133.66Z"},null,-1)]))}const Lt=w(Rt,[["render",At]]),Vt={},Dt={width:"12",height:"12",viewBox:"0 0 256 256",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true"};function xt(o,e){return t.openBlock(),t.createElementBlock("svg",Dt,e[0]||(e[0]=[t.createElementVNode("path",{d:"M181.66,133.66l-80,80a8,8,0,0,1-11.32-11.32L164.69,128,90.34,53.66a8,8,0,0,1,11.32-11.32l80,80A8,8,0,0,1,181.66,133.66Z"},null,-1)]))}const Pt=w(Vt,[["render",xt]]),ne=o=>(o??[]).flatMap(e=>{const n=ee(e);return n===void 0?[]:[{collection:e,href:n}]}),Ot={key:0,class:"dialog-search-collections"},qt={class:"dialog-search-section-head"},Mt={class:"dialog-search-label"},Ut={class:"dialog-search-count"},Ht={class:"dialog-search-collection-list"},Kt=["href"],Ft={class:"dialog-search-collection-thumb","aria-hidden":"true"},zt=["src"],jt={class:"dialog-search-collection-title"},vt={class:"dialog-search-caret"},Gt=t.defineComponent({__name:"DialogSearchCollections",props:{collections:{},query:{},messages:{}},setup(o){const e=o,n=t.computed(()=>ne(e.collections));return(s,c)=>n.value.length>0?(t.openBlock(),t.createElementBlock("aside",Ot,[t.createElementVNode("div",qt,[t.createElementVNode("p",Mt,t.toDisplayString(e.messages.collectionsLabel),1),t.createElementVNode("span",Ut,t.toDisplayString(e.messages.collectionsCount(n.value.length)),1)]),t.createElementVNode("ul",Ht,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(n.value,({collection:r,href:a})=>(t.openBlock(),t.createElementBlock("li",{key:r.objectID},[t.createElementVNode("a",{class:"dialog-search-collection",href:a},[t.createElementVNode("span",Ft,[r.imageUrl!==void 0&&r.imageUrl!==""?(t.openBlock(),t.createElementBlock("img",{key:0,src:r.imageUrl,alt:"",loading:"lazy"},null,8,zt)):t.createCommentVNode("",!0)]),t.createElementVNode("span",jt,[t.createVNode(J,{title:t.unref(te)(r),query:e.query},null,8,["title","query"])]),t.createElementVNode("span",vt,[t.createVNode(Pt)])],8,Kt)]))),128))])])):t.createCommentVNode("",!0)}}),Qt={class:"dialog-search-products"},Wt={class:"dialog-search-section-head"},Xt={class:"dialog-search-label"},Yt={key:0,class:"dialog-search-label-count"},Zt={class:"dialog-search-results"},Jt={key:0,class:"dialog-search-empty",role:"status"},eo=t.defineComponent({__name:"DialogSearchProducts",props:{controller:{},response:{},locale:{},messages:{}},setup(o){const e=o;return(n,s)=>(t.openBlock(),t.createElementBlock("section",Qt,[t.createElementVNode("div",Wt,[t.createElementVNode("p",Xt,[t.createTextVNode(t.toDisplayString(e.messages.productsLabel),1),e.response.nbHits>0?(t.openBlock(),t.createElementBlock("span",Yt," · "+t.toDisplayString(e.messages.resultsCount(e.response.nbHits)),1)):t.createCommentVNode("",!0)])]),t.createElementVNode("ul",Zt,[e.response.hits.length===0?(t.openBlock(),t.createElementBlock("li",Jt,t.toDisplayString(e.messages.noResults),1)):(t.openBlock(!0),t.createElementBlock(t.Fragment,{key:1},t.renderList(e.response.hits,(c,r)=>(t.openBlock(),t.createBlock(oe,{key:c.objectID,controller:e.controller,hit:c,index:r,locale:e.locale,query:e.response.query},null,8,["controller","hit","index","locale","query"]))),128))])]))}}),A=8,B=16,to=200,oo=1440,no=(o,e)=>o.bottom>0&&o.top<e,so=(o,e)=>{const n=Math.min(oo,e-2*B),s=o.left+o.width/2-n/2;return{left:`${Math.min(Math.max(s,B),e-B-n)}px`,width:`${n}px`}},ro=(o,e,n)=>{const s=n-o.bottom-A-B,c=o.top-A-B,r=so(o,e);return s<to&&c>s?{...r,bottom:`${n-o.top+A}px`,maxHeight:`${Math.max(c,0)}px`}:{...r,top:`${o.bottom+A}px`,maxHeight:`${Math.max(s,0)}px`}},co=o=>{const e=o.trim().replace(/^#/,"");if(!/^(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/i.test(e))return;const n=e.length<=4?[...e].map(s=>s+s).join(""):e;return[0,2,4].map(s=>Number.parseInt(n.slice(s,s+2),16))},lo=o=>{const e=/^rgba?\((\d+), (\d+), (\d+)(?:, [\d.]+)?\)$/.exec(o);if(e!==null)return[e[1],e[2],e[3]].map(Number)},ao=o=>{if(typeof document>"u")return;const e=document.createElement("span");if(e.style.color=o,e.style.color==="")return;document.body.appendChild(e);const n=lo(getComputedStyle(e).color);return e.remove(),n},io=o=>co(o)??ao(o),uo=o=>{const e=o/255;return e<=.03928?e/12.92:((e+.055)/1.055)**2.4},se=o=>{const e=io(o);if(e===void 0)return;const[n,s,c]=e.map(uo);return .2126*n+.7152*s+.0722*c},po="#181825",mo="#ffffff",ho="straight",x=.5,P={light:{panel:"#ffffff",side:"#fafbfc",text:"#111827","text-sec":"#6b7280",border:"#eceef2",hover:"#eef2f7",thumb:"#eef1f5"},dark:{panel:"#15171c",side:"#1b1e25",text:"#f3f4f6","text-sec":"#9ca3af",border:"#2b2f38",hover:"#242830",thumb:"#2b2f38"}},fo={rectangle:{"r-panel":"4px","r-item":"4px","r-thumb":"2px","r-btn":"4px"},"rectangle-rounded":{"r-panel":"16px","r-item":"10px","r-thumb":"8px","r-btn":"10px"}},L=o=>o===void 0||o.trim()===""?void 0:o.trim(),go=o=>{const e=o===void 0?void 0:se(o);return e===void 0?"light":e<x?"dark":"light"},_o=(o,e)=>{const n=se(o);return n===void 0?P[e].text:(e==="light"?n<x:n>=x)?o:P[e].text},Eo=o=>{const e=go(L(o==null?void 0:o.backgroundColor)),n=(o==null?void 0:o.ctaBorderType)===ho?"rectangle":"rectangle-rounded",s=L(o==null?void 0:o.primaryColor)??po,c=L(o==null?void 0:o.fontFamily),r={...P[e],...fo[n],primary:s,accent:_o(s,e),"cta-text":L(o==null?void 0:o.ctaTextColor)??mo,...c===void 0?{}:{font:c}};return Object.fromEntries(Object.entries(r).map(([a,l])=>[`--dso-${a}`,l]))},ko=o=>{const e=t.ref(),n=t.ref(void 0),s=t.ref({width:0,height:0});return t.watch(o,(c,r,a)=>{if(!c)return;const l=()=>{const u=e.value;if(u===void 0)return;const i=u.previousElementSibling??u,{top:E,bottom:d,left:h,width:f}=i.getBoundingClientRect();(s.value.width!==window.innerWidth||s.value.height!==window.innerHeight)&&(s.value={width:window.innerWidth,height:window.innerHeight});const m=n.value;(m===void 0||m.top!==E||m.bottom!==d||m.left!==h||m.width!==f)&&(n.value={top:E,bottom:d,left:h,width:f})};l(),window.addEventListener("scroll",l,!0),window.addEventListener("resize",l),a(()=>{window.removeEventListener("scroll",l,!0),window.removeEventListener("resize",l)})},{immediate:!0,flush:"post"}),{anchorRef:e,rect:n,viewport:s}},So=(o,e)=>{const n=t.ref(!1),s=t.ref(),c=t.computed(()=>o.value.status!==I.IDLE&&!n.value);t.watch(()=>o.value.query,()=>{n.value=!1}),t.watch(c,(a,l,u)=>{if(!a)return;const i=E=>{var b,C;const d=E.target;if(!(d instanceof Node))return;const h=(b=e.value)==null?void 0:b.previousElementSibling,f=((C=s.value)==null?void 0:C.contains(d))??!1,m=(h==null?void 0:h.contains(d))??!1;!f&&!m&&(n.value=!0)};document.addEventListener("pointerdown",i),u(()=>document.removeEventListener("pointerdown",i))},{immediate:!0});const r=()=>{n.value=!1};return t.onMounted(()=>{var a,l;(l=(a=e.value)==null?void 0:a.previousElementSibling)==null||l.addEventListener("focusin",r)}),t.onUnmounted(()=>{var a,l;(l=(a=e.value)==null?void 0:a.previousElementSibling)==null||l.removeEventListener("focusin",r)}),{isOpen:c,panelRef:s}},bo={key:0,class:"dialog-search-error"},Co={role:"alert",class:"dialog-search-status dialog-search-status-error"},yo={key:1,role:"status",class:"dialog-search-status"},Io={key:0,class:"dialog-search-footer"},wo=["href"],$o=t.defineComponent({__name:"DialogSearchResults",props:{controller:{},state:{},locale:{default:void 0},theme:{default:void 0},layout:{default:"list"},seeAllHref:{type:Function,default:void 0}},setup(o){const e=o,n=p=>p instanceof ae?`Search failed (${p.status}${p.code?` ${p.code}`:""}): ${p.message}`:"Search failed: network error. Check your connection and try again.",s=t.computed(()=>e.state),c=t.computed(()=>e.state.status!==I.IDLE),{anchorRef:r,rect:a,viewport:l}=ko(c),{isOpen:u,panelRef:i}=So(s,r),E=t.computed(()=>u.value&&a.value!==void 0&&no(a.value,l.value.height)),d=t.computed(()=>Eo(e.theme)),h=t.computed(()=>({...a.value===void 0?{}:ro(a.value,l.value.width,l.value.height),...d.value})),f=t.computed(()=>W(e.locale)),m=t.computed(()=>e.state.response),b=t.computed(()=>{var p,k;return((k=(p=e.state.sections)==null?void 0:p.collections)==null?void 0:k.hits)??[]}),C=t.computed(()=>ne(b.value).length>0),y=t.computed(()=>e.seeAllHref!==void 0&&m.value!==void 0&&m.value.nbHits>0),_=t.computed(()=>!y.value&&X(e.state)),g=t.computed(()=>{var p;return m.value===void 0||(p=e.seeAllHref)==null?void 0:p.call(e,m.value.query)});return(p,k)=>(t.openBlock(),t.createElementBlock(t.Fragment,null,[t.createElementVNode("div",{ref_key:"anchorRef",ref:r},null,512),E.value?(t.openBlock(),t.createBlock(t.Teleport,{key:0,to:"body"},[t.createElementVNode("div",{ref_key:"panelRef",ref:i,class:t.normalizeClass(["dialog-search-panel",`dialog-search-panel--${e.layout}`]),style:t.normalizeStyle(h.value)},[e.state.status===t.unref(I).ERROR?(t.openBlock(),t.createElementBlock("div",bo,[t.createElementVNode("p",Co,t.toDisplayString(n(e.state.error)),1),t.createElementVNode("button",{type:"button",class:"dialog-search-retry",onClick:k[0]||(k[0]=T=>e.controller.retry())},t.toDisplayString(f.value.retry),1)])):m.value===void 0?(t.openBlock(),t.createElementBlock("p",yo,t.toDisplayString(f.value.searching(e.state.query)),1)):(t.openBlock(),t.createElementBlock(t.Fragment,{key:2},[t.createElementVNode("div",{class:t.normalizeClass(["dialog-search-body",{"dialog-search-body--no-collections":!C.value}])},[t.createVNode(Gt,{collections:b.value,query:m.value.query,messages:f.value},null,8,["collections","query","messages"]),t.createVNode(eo,{controller:e.controller,response:m.value,locale:e.locale,messages:f.value},null,8,["controller","response","locale","messages"])],2),y.value||_.value?(t.openBlock(),t.createElementBlock("div",Io,[y.value?(t.openBlock(),t.createElementBlock("a",{key:0,class:"dialog-search-cta",href:g.value},[t.createTextVNode(t.toDisplayString(f.value.seeAllLabel(m.value.nbHits))+" ",1),t.createVNode(Lt)],8,wo)):(t.openBlock(),t.createBlock(Y,{key:1,controller:e.controller,state:e.state,locale:e.locale},null,8,["controller","state","locale"]))])):t.createCommentVNode("",!0)],64))],6)])):t.createCommentVNode("",!0)],64))}}),To=o=>{const{client:e,surface:n="search_page",...s}=o,c=Ce({search:(l,u)=>e.search(l,u),analytics:{surface:n,trackViewSearchResults:l=>e.trackViewSearchResults(l),trackSelectSearchResult:l=>e.trackSelectSearchResult(l)},...s}),r=t.shallowRef(c.getState()),a=c.subscribe(()=>{r.value=c.getState()});return t.onMounted(()=>{K({method:"vue",version:"3.10.0"})}),t.onUnmounted(()=>{a(),c.dispose()}),{controller:c,state:r,theme:e.theme}};S.DialogInput=G,S.DialogProductBlock=et,S.DialogSearchBar=mt,S.DialogSearchPagination=Y,S.DialogSearchProductCard=oe,S.DialogSearchResults=$o,S.useDialogSearch=To,Object.defineProperty(S,Symbol.toStringTag,{value:"Module"})}));
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@askdialog/dialog-vue",
3
3
  "private": false,
4
- "version": "3.9.0",
4
+ "version": "3.10.0",
5
5
  "type": "module",
6
6
  "main": "./dist/dialog-vue.umd.js",
7
7
  "module": "./dist/dialog-vue.js",
@@ -29,7 +29,7 @@
29
29
  "eslint-plugin-vue": "^10.0.0",
30
30
  "vite-plugin-eslint": "^1.8.1",
31
31
  "vue-tsc": "^2.2.4",
32
- "@askdialog/dialog-sdk": "2.15.1"
32
+ "@askdialog/dialog-sdk": "2.16.0"
33
33
  },
34
34
  "author": "Dialog",
35
35
  "publishConfig": {