@askdialog/dialog-vue 3.9.0 → 3.11.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 Do=Object.defineProperty;var xo=(S,t,R)=>t in S?Do(S,t,{enumerable:!0,configurable:!0,writable:!0,value:R}):S[t]=R;var U=(S,t,R)=>xo(S,typeof t!="symbol"?t+"":t,R);const R=new Set(["ar","he","iw","fa","ur"]),de=o=>o!==void 0&&R.has(o.trim().toLowerCase().slice(0,2)),ue=o=>de(o)?"rtl":"ltr";var A;(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"})(A||(A={}));var H;(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"})(H||(H={})),A.TRACK_ADD_TO_CART,A.TRACK_SUBMIT_CHECKOUT,A.TRACK_VIEW_SEARCH_RESULTS,A.TRACK_SELECT_SEARCH_RESULT;class pe extends Error{constructor({status:n,code:s,message:c}){super(c);U(this,"status");U(this,"code");this.name="DialogSearchError",this.status=n,this.code=s}}const x=(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()}`},K="multiple installation methods detected:",me=()=>typeof window>"u"?void 0:window,F=()=>{const o=me();if(o!==void 0)return o.dialog=o.dialog??{},o.dialog.audit=o.dialog.audit??{methods:[],context:{},capabilities:[],warnings:[]},o.dialog.audit},he=o=>{if(o.warnings=o.warnings.filter(e=>!e.startsWith(K)),o.methods.length>=2){const e=o.methods.map(n=>n.method).join(", ");o.warnings.push(`${K} ${e}`)}},fe=(o,e)=>e===void 0?o:{version:(o==null?void 0:o.version)??e.version,commit:(o==null?void 0:o.commit)??e.commit},z=o=>{const e=F();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()}),he(e);return}n.version=n.version??o.version,n.build=fe(n.build,o.build),n.source=n.source??o.source},ge=o=>{const e=F();e!==void 0&&(e.capabilities.includes(o)||e.capabilities.push(o))},$={IDLE:"idle",LOADING:"loading",SUCCESS:"success",EMPTY:"empty",ERROR:"error"},_e=.5,Ee=500,ke=1500,Se=100;function be({emit:o,visibilityThreshold:e=_e,dwellMs:n=Ee,idleFlushMs:s=ke,maxItemsPerEvent:c=Se}){let r,l=[];const a=new Set,p=new Map,d=new Map;let u;const i=()=>{clearTimeout(u),!(r===void 0||l.length===0)&&(o({...r,items:l}),l=[])},m=f=>{if(r===void 0)return;const E=`${r.query_id}:${f.product_id}`;if(!a.has(E)){if(a.add(E),l.push(f),l.length>=c){i();return}clearTimeout(u),u=setTimeout(i,s)}},_=f=>{const E=d.get(f);E!==void 0&&(clearTimeout(E),d.delete(f))},h=new IntersectionObserver(f=>{for(const E of f){const k=p.get(E.target);k!==void 0&&(E.intersectionRatio>=e?d.has(E.target)||d.set(E.target,setTimeout(()=>{d.delete(E.target),m(k)},n)):_(E.target))}},{threshold:e}),C=()=>{h.disconnect();for(const f of d.values())clearTimeout(f);d.clear(),p.clear()},y=()=>{i()},I=f=>{if(f.persisted){a.clear();for(const E of p.keys())_(E),h.unobserve(E),h.observe(E)}};return window.addEventListener("pagehide",y),window.addEventListener("pageshow",I),{setContext(f){i(),a.clear(),r=f,C()},observe(f,E){p.set(f,E),h.observe(f)},forceImpression(f){m(f),i()},flush:i,disconnect(){i(),C(),window.removeEventListener("pagehide",y),window.removeEventListener("pageshow",I)}}}const j=(o,e)=>({product_id:String(o.hits[e].id),position:o.page*o.hitsPerPage+e+1});function Ce(o){let e,n;const s=()=>(e??(e=be({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,l){s().observe(c,j(r,l))},select(c,r){if(n===void 0)return;const l=j(c,r);s().forceImpression(l),o.trackSelectSearchResult({...n,items:[l]})},dispose(){e==null||e.disconnect()}}}const P={status:$.IDLE,query:"",page:0,response:void 0,sections:void 0,error:void 0},ye=2,G=o=>{const e=o.trim();return[...e].length>=ye?e:void 0},Ie=(o,e,n,{indexName:s,language:c,country:r,hitsPerPage:l})=>({requests:[{indexName:s,query:o,page:e,hitsPerPage:l},...n.map(a=>({indexName:x(a.index,c,r),query:o,page:0,hitsPerPage:a.hitsPerPage??l}))]}),we=(o,e,{indexName:n,language:s,country:c})=>{const r=o.results.find(a=>a.index===n);if(r===void 0)throw new Error(`Dialog search returned no ${n} entry`);const l={};for(const a of e){const p=x(a.index,s,c),d=o.results.find(u=>u.index===p);d!==void 0&&(l[a.index]=d)}return{response:r,sections:e.length===0?void 0:l}};function $e({search:o,language:e,country:n,analytics:s,navigate:c,buildProductUrl:r,debounceMs:l=250,hitsPerPage:a=12,sections:p=[]}){const d={indexName:x("products",e,n),language:e,country:n,hitsPerPage:a};let u=P;const i=new Set,m=Ce(s);let _,h,C,y=0,I=!1;const f=g=>{u={...u,...g};for(const b of i)b(u)},E=g=>g.url!==void 0&&g.url!==""?g.url:r==null?void 0:r(g),k=()=>{clearTimeout(_),h=void 0,y+=1,C==null||C.abort(),C=void 0},w=async(g,b)=>{k(),C=new AbortController;const B=y;f({status:$.LOADING,query:g,page:b});try{const T=typeof p=="function"?p():p,ie=Ie(g,b,T,d),Vo=await o(ie,{signal:C.signal});if(B!==y)return;const M=we(Vo,T,d);m.onResponse(M.response),f({...M,status:M.response.nbHits===0?$.EMPTY:$.SUCCESS,error:void 0})}catch(T){if(T instanceof DOMException&&T.name==="AbortError"||B!==y)return;f({status:$.ERROR,error:T,response:void 0,sections:void 0})}};return{setQuery(g){if(I)return;k();const b=G(g);if(b===void 0){f(P);return}h=b,_=setTimeout(()=>void w(b,0),l)},submit(g){if(I)return;k();const b=G(g);if(b===void 0){f(P);return}w(b,0)},setPage(g){if(!I){if(h!==void 0){w(h,0);return}u.query!==""&&w(u.query,g)}},retry(){I||u.status!==$.ERROR||w(u.query,u.page)},observeResult(g,b){u.response!==void 0&&m.observeResult(g,u.response,b)},selectResult(g,b){const B=u.response;if(B===void 0)return!1;m.select(B,g);const T=E(B.hits[g]);return((b==null?void 0:b.navigate)??!0)&&c!==void 0&&T!==void 0?(c(T,B.hits[g]),!0):!1},productUrl:E,subscribe(g){return i.add(g),()=>{i.delete(g)}},getState:()=>u,dispose(){I=!0,k(),i.clear(),m.dispose()}}}const Q=(o,e,n)=>{if(o===void 0||!Number.isFinite(o))return"";try{return e===void 0?new Intl.NumberFormat(n).format(o):new Intl.NumberFormat(n,{style:"currency",currency:e}).format(o)}catch{return""}},v=({variants_min_price:o,currency:e},n)=>Q(o,e,n),Ne=(o,e)=>{const{variants_min_price:n,variants_compare_at_price_min:s}=o;return n===void 0||s===void 0||!(s>n)||v(o,e)===""?"":Q(s,o.currency,e)},W={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"}},X=o=>{var n;const e=((n=o==null?void 0:o.split("-")[0])==null?void 0:n.toLowerCase())??"en";return W[e]??W.en},Te=["disabled"],Be=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(X)(e.client.locale).askSomethingElse),9,Te))}}),N=(o,e)=>{const n=o.__vccOpts||o;for(const[s,c]of e)n[s]=c;return n},Re=N(Be,[["__scopeId","data-v-d0e272a0"]]),Ae={class:"dialog-block-header-container"},Le={class:"dialog-block-title"},Ve={class:"dialog-block-description"},De=N(t.defineComponent({__name:"DialogBlockHeader",props:{title:{},description:{}},setup(o){const e=o;return(n,s)=>(t.openBlock(),t.createElementBlock("div",Ae,[t.createElementVNode("div",Le,t.toDisplayString(e.title??"Your expert"),1),t.createElementVNode("div",Ve,t.toDisplayString(e.description??"A question about this product?"),1)]))}}),[["__scopeId","data-v-28e6dda7"]]),xe={width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},Pe={"clip-path":"url(#clip0_466_934)"},Oe=["stroke"],qe=["stroke"],Me=t.defineComponent({__name:"AiStarsIcon",props:{color:{}},setup(o){const e=o;return(n,s)=>(t.openBlock(),t.createElementBlock("svg",xe,[t.createElementVNode("g",Pe,[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
@@ -7,7 +7,7 @@
7
7
  15.7167C3.6379 15.5689 3.41666 15.4583 2.97418 15.237L1.66675 14.5833L2.97418
8
8
  13.9296C3.41666 13.7084 3.6379 13.5977 3.82962 13.45C3.99974 13.3188 4.15225
9
9
  13.1663 4.28339 12.9962C4.43117 12.8045 4.54179 12.5832 4.76303 12.1408L5.41675
10
- 10.8333Z`,stroke:e.color||"#181825","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"},null,8,Le),t.createElementVNode("path",{d:`M12.5001 1.66666L13.4823 4.22034C13.7173 4.83136 13.8348 5.13688 14.0175
10
+ 10.8333Z`,stroke:e.color||"#181825","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"},null,8,Oe),t.createElementVNode("path",{d:`M12.5001 1.66666L13.4823 4.22034C13.7173 4.83136 13.8348 5.13688 14.0175
11
11
  5.39386C14.1795 5.62162 14.3785 5.82061 14.6062 5.98256C14.8632 6.16529 15.1687
12
12
  6.2828 15.7797 6.5178L18.3334 7.49999L15.7797 8.48217C15.1687 8.71718 14.8632
13
13
  8.83469 14.6062 9.01742C14.3785 9.17937 14.1795 9.37836 14.0175 9.60612C13.8348
@@ -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,qe)]),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))]))}}),Ue=["onClick"],He={class:"dialog-block-suggestions-item-label"},Ke=N(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:l=>n(r.question)},[t.createVNode(Me,{class:"dialog-block-suggestions-item-icon",color:e.client.theme.primaryColor},null,8,["color"]),t.createElementVNode("span",He,t.toDisplayString(r.question),1)],8,Ue))),128))}}),[["__scopeId","data-v-db34d4b4"]]),Fe={};function ze(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 je=N(Fe,[["render",ze],["__scopeId","data-v-26a64b58"]]),Ge={class:"dialog-block-suggestions-container"},Qe=N(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",Ge,[e.isLoading||!e.questions?(t.openBlock(),t.createBlock(je,{key:0})):(t.openBlock(),t.createBlock(Ke,{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"]]),ve={width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},We=["stroke"],Xe=t.defineComponent({__name:"ArrowIcon",props:{color:{}},setup(o){const e=o;return(n,s)=>(t.openBlock(),t.createElementBlock("svg",ve,[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,We)]))}}),Ye={class:"dialog-input-container"},Ze=["placeholder"],Je=["disabled"],et={id:"dialog-input-ai-disclosure",class:"dialog-input-ai-disclosure"},Y=N(t.defineComponent({__name:"DialogInput",props:{client:{},placeholder:{},productId:{},productTitle:{},selectedVariantId:{}},setup(o){const e=o,n=t.ref(),s=t.ref(""),c=t.computed(()=>X(e.client.locale)),r=()=>{var a;(a=n.value)==null||a.focus()},l=()=>{const a=s.value;a.trim()&&(e.client.sendProductMessage({productId:e.productId,productTitle:e.productTitle,selectedVariantId:e.selectedVariantId,question:a,fromQuestionSuggestion:!0}),s.value="")};return(a,p)=>(t.openBlock(),t.createElementBlock("div",Ye,[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":p[0]||(p[0]=d=>s.value=d),class:"dialog-ask-anything-input-ai-input",placeholder:c.value.placeholder,"aria-describedby":"dialog-input-ai-disclosure",onKeydown:t.withKeys(l,["enter"])},null,40,Ze),[[t.vModelText,s.value]]),t.createElementVNode("button",{id:"send-message-button-ai-input",class:"dialog-input-submit",disabled:!s.value.trim(),onClick:l},[t.createVNode(Xe,{color:e.client.theme.ctaTextColor},null,8,["color"])],8,Je)]),t.createElementVNode("p",et,t.toDisplayString(c.value.aiDisclosure),1)]))}}),[["__scopeId","data-v-87013888"]]),tt=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(l=>{const a=l,p=s(l);if(r[a]!==void 0){if(typeof r[a]=="object"){Object.keys(r[a]).forEach(d=>{var i;const u=d;if(u!==void 0){const m=s(d),_=r[a];n.style.setProperty(`--dialog-theme-${p}-${m}`,(i=_[u])==null?void 0:i.toString())}});return}if(a==="ctaBorderType"){const d=r[a]==="rounded"?"24px":"0";n.style.setProperty(`--dialog-theme-${p}`,d);return}n.style.setProperty(`--dialog-theme-${p}`,r[a].toString())}})};return t.onMounted(()=>{e.theme&&c(e.theme)}),t.watch(()=>e.theme,r=>{r&&c(r)},{deep:!0}),(r,l)=>t.renderSlot(r.$slots,"default")}}),ot=["dir"],nt=2,st=5,rt=N(t.defineComponent({__name:"DialogProductBlock",props:{client:{},productId:{},productTitle:{},selectedVariantId:{default:void 0},enableInput:{type:Boolean,default:!1}},setup(o){const e=o;t.onMounted(()=>{z({method:"vue",version:"3.11.0"}),ge("pdp-block")});const n=t.ref(!0),s=t.ref(void 0),c=t.ref(0),r=t.computed(()=>{var i;return n.value?"":(i=s.value)==null?void 0:i.assistantName}),l=t.computed(()=>{var i;return n.value?"":(i=s.value)==null?void 0:i.description}),a=t.computed(()=>{var i,m;return(m=(i=s.value)==null?void 0:i.questions)==null?void 0:m.slice(0,nt)}),p=t.computed(()=>{var i;return n.value?"":(i=s.value)==null?void 0:i.inputPlaceholder}),d=t.computed(()=>{var i;return ue((i=e.client.getLocalizationInformations())==null?void 0:i.languageCode)}),u=async()=>{const i=++c.value;n.value=!0,s.value=void 0;try{const m=await e.client.getSuggestions(e.productId,{limit:st});i===c.value&&(s.value=m)}catch(m){console.error("error",m)}finally{i===c.value&&(n.value=!1)}};return t.watch(()=>[e.client,e.productId],()=>{u()},{immediate:!0}),(i,m)=>(t.openBlock(),t.createBlock(tt,{theme:e.client.theme},{default:t.withCtx(()=>{var _;return[t.createElementVNode("div",{id:"dialog-instant",class:"dialog-block-container",dir:d.value},[t.createVNode(De,{title:r.value,description:l.value},null,8,["title","description"]),t.createVNode(Qe,{client:e.client,questions:a.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(Y,{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(Re,{key:1,client:e.client,questions:(_=s.value)==null?void 0:_.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,ot)]}),_:1},8,["theme"]))}}),[["__scopeId","data-v-0c307e5f"]]),ct={},at={width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true"};function lt(o,e){return t.openBlock(),t.createElementBlock("svg",at,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 it=N(ct,[["render",lt]]),dt={width:"16",height:"16",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true"},ut=["fill"],pt="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",mt=t.defineComponent({__name:"ShurikenIcon",props:{color:{}},setup(o){const e=o;return(n,s)=>(t.openBlock(),t.createElementBlock("svg",dt,[t.createElementVNode("path",{d:pt,fill:e.color||"currentColor"},null,8,ut)]))}}),ht={class:"dialog-search-bar-field"},ft={class:"dialog-search-bar-icon"},gt=["aria-label","placeholder","autofocus"],_t=["aria-label"],Et=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,l)=>(t.openBlock(),t.createElementBlock("form",{class:"dialog-search-bar",role:"search",onSubmit:t.withModifiers(c,["prevent"])},[t.createElementVNode("div",ht,[t.createElementVNode("span",ft,[t.createVNode(mt)]),t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":l[0]||(l[0]=a=>n.value=a),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,gt),[[t.vModelText,n.value]])]),t.createElementVNode("button",{type:"submit",class:"dialog-search-bar-submit","aria-label":e.submitAriaLabel},[t.createVNode(it)],8,_t)],32))}}),kt=(o,e)=>{try{return new Intl.NumberFormat(e).format(o)}catch{return String(o)}},Z={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)}`})},J=o=>{var s;const e=((s=o==null?void 0:o.split("-")[0])==null?void 0:s.toLowerCase())??"en";return(Z[e]??Z.en)(c=>kt(c,o))},ee=o=>o.status!==$.LOADING&&o.response!==void 0&&o.response.nbPages>1,St={key:0,"aria-label":"Search results pages",class:"dialog-search-pagination"},bt=["disabled"],Ct=["disabled"],te=t.defineComponent({__name:"DialogSearchPagination",props:{controller:{},state:{},locale:{}},setup(o){const e=o,n=t.computed(()=>e.state.response),s=t.computed(()=>J(e.locale));return(c,r)=>n.value!==void 0&&t.unref(ee)(e.state)?(t.openBlock(),t.createElementBlock("nav",St,[t.createElementVNode("button",{type:"button",disabled:n.value.page===0,onClick:r[0]||(r[0]=l=>e.controller.setPage(n.value.page-1))},t.toDisplayString(s.value.previous),9,bt),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]=l=>e.controller.setPage(n.value.page+1))},t.toDisplayString(s.value.next),9,Ct)])):t.createCommentVNode("",!0)}}),oe=o=>o.normalize("NFD").replace(new RegExp("\\p{M}","gu"),"").replace(/ẞ/gu,"ß").toUpperCase().toLowerCase().replace(/ς/g,"σ"),yt=(o,e)=>{const n={before:"",match:o,after:""},s=oe(e.trim());if(s==="")return n;const c=[...o],r=[];let l="";c.forEach((u,i)=>{const m=oe(u);for(let _=0;_<m.length;_+=1)r.push(i);l+=m});const a=l.indexOf(s);if(a===-1)return n;const p=r[a],d=r[a+s.length-1]+1;return{before:c.slice(0,p).join(""),match:c.slice(p,d).join(""),after:c.slice(d).join("")}},It={key:0,class:"dialog-search-muted"},wt={class:"dialog-search-match"},$t={key:1,class:"dialog-search-muted"},ne=t.defineComponent({__name:"HighlightedTitle",props:{title:{},query:{}},setup(o){const e=o,n=t.computed(()=>yt(e.title,e.query));return(s,c)=>(t.openBlock(),t.createElementBlock(t.Fragment,null,[n.value.before!==""?(t.openBlock(),t.createElementBlock("span",It,t.toDisplayString(n.value.before),1)):t.createCommentVNode("",!0),t.createElementVNode("span",wt,t.toDisplayString(n.value.match),1),n.value.after!==""?(t.openBlock(),t.createElementBlock("span",$t,t.toDisplayString(n.value.after),1)):t.createCommentVNode("",!0)],64))}}),Nt=o=>o.product_image||o.image||void 0,se=o=>{if(!(o===void 0||o===""))try{const{protocol:e}=new URL(o,window.location.href);return e==="http:"||e==="https:"?o:void 0}catch{return}},Tt=o=>se(o.url),re=o=>o.title??o.handle??o.objectID,Bt={class:"dialog-search-product-thumb","aria-hidden":"true"},Rt=["src"],At={class:"dialog-search-product-title"},Lt={key:0,class:"dialog-search-product-price"},Vt={key:0,class:"dialog-search-product-compare-at"},ce=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(()=>se(e.controller.productUrl(e.hit))),c=t.computed(()=>Nt(e.hit)),r=t.computed(()=>v(e.hit,e.locale)),l=t.computed(()=>Ne(e.hit,e.locale)),a=d=>{const u=d.metaKey||d.ctrlKey||d.shiftKey||d.altKey;e.controller.selectResult(e.index,{navigate:!u})&&d.preventDefault()},p=d=>{d.button===1&&e.controller.selectResult(e.index,{navigate:!1})};return(d,u)=>(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:p})),{default:t.withCtx(()=>[t.createElementVNode("span",Bt,[c.value!==void 0?(t.openBlock(),t.createElementBlock("img",{key:0,src:c.value,alt:"",loading:"lazy"},null,8,Rt)):t.createCommentVNode("",!0)]),t.createElementVNode("span",At,[t.createVNode(ne,{title:t.unref(re)(e.hit),query:e.query},null,8,["title","query"])]),r.value!==""?(t.openBlock(),t.createElementBlock("span",Lt,[l.value!==""?(t.openBlock(),t.createElementBlock("s",Vt,t.toDisplayString(l.value),1)):t.createCommentVNode("",!0),t.createTextVNode(t.toDisplayString(r.value),1)])):t.createCommentVNode("",!0)]),_:1},16,["href"]))],512))}}),Dt={},xt={width:"16",height:"16",viewBox:"0 0 256 256",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true"};function Pt(o,e){return t.openBlock(),t.createElementBlock("svg",xt,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 Ot=N(Dt,[["render",Pt]]),qt={},Mt={width:"12",height:"12",viewBox:"0 0 256 256",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true"};function Ut(o,e){return t.openBlock(),t.createElementBlock("svg",Mt,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 Ht=N(qt,[["render",Ut]]),ae=o=>(o??[]).flatMap(e=>{const n=Tt(e);return n===void 0?[]:[{collection:e,href:n}]}),Kt={key:0,class:"dialog-search-collections"},Ft={class:"dialog-search-section-head"},zt={class:"dialog-search-label"},jt={class:"dialog-search-count"},Gt={class:"dialog-search-collection-list"},Qt=["href"],vt={class:"dialog-search-collection-thumb","aria-hidden":"true"},Wt=["src"],Xt={class:"dialog-search-collection-title"},Yt={class:"dialog-search-caret"},Zt=t.defineComponent({__name:"DialogSearchCollections",props:{collections:{},query:{},messages:{}},setup(o){const e=o,n=t.computed(()=>ae(e.collections));return(s,c)=>n.value.length>0?(t.openBlock(),t.createElementBlock("aside",Kt,[t.createElementVNode("div",Ft,[t.createElementVNode("p",zt,t.toDisplayString(e.messages.collectionsLabel),1),t.createElementVNode("span",jt,t.toDisplayString(e.messages.collectionsCount(n.value.length)),1)]),t.createElementVNode("ul",Gt,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(n.value,({collection:r,href:l})=>(t.openBlock(),t.createElementBlock("li",{key:r.objectID},[t.createElementVNode("a",{class:"dialog-search-collection",href:l},[t.createElementVNode("span",vt,[r.image?(t.openBlock(),t.createElementBlock("img",{key:0,src:r.image,alt:"",loading:"lazy"},null,8,Wt)):t.createCommentVNode("",!0)]),t.createElementVNode("span",Xt,[t.createVNode(ne,{title:t.unref(re)(r),query:e.query},null,8,["title","query"])]),t.createElementVNode("span",Yt,[t.createVNode(Ht)])],8,Qt)]))),128))])])):t.createCommentVNode("",!0)}}),Jt={class:"dialog-search-products"},eo={class:"dialog-search-section-head"},to={class:"dialog-search-label"},oo={key:0,class:"dialog-search-label-count"},no={class:"dialog-search-results"},so={key:0,class:"dialog-search-empty",role:"status"},ro=t.defineComponent({__name:"DialogSearchProducts",props:{controller:{},response:{},locale:{},messages:{}},setup(o){const e=o;return(n,s)=>(t.openBlock(),t.createElementBlock("section",Jt,[t.createElementVNode("div",eo,[t.createElementVNode("p",to,[t.createTextVNode(t.toDisplayString(e.messages.productsLabel),1),e.response.nbHits>0?(t.openBlock(),t.createElementBlock("span",oo," · "+t.toDisplayString(e.messages.resultsCount(e.response.nbHits)),1)):t.createCommentVNode("",!0)])]),t.createElementVNode("ul",no,[e.response.hits.length===0?(t.openBlock(),t.createElementBlock("li",so,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(ce,{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))])]))}}),V=8,L=16,co=200,ao=1440,lo=(o,e)=>o.bottom>0&&o.top<e,io=(o,e)=>{const n=Math.min(ao,e-2*L),s=o.left+o.width/2-n/2;return{left:`${Math.min(Math.max(s,L),e-L-n)}px`,width:`${n}px`}},uo=(o,e,n)=>{const s=n-o.bottom-V-L,c=o.top-V-L,r=io(o,e);return s<co&&c>s?{...r,bottom:`${n-o.top+V}px`,maxHeight:`${Math.max(c,0)}px`}:{...r,top:`${o.bottom+V}px`,maxHeight:`${Math.max(s,0)}px`}},po=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))},mo=o=>{const e=/^rgba?\((\d+), (\d+), (\d+)(?:, [\d.]+)?\)$/.exec(o);if(e!==null)return[e[1],e[2],e[3]].map(Number)},ho=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=mo(getComputedStyle(e).color);return e.remove(),n},fo=o=>po(o)??ho(o),go=o=>{const e=o/255;return e<=.03928?e/12.92:((e+.055)/1.055)**2.4},le=o=>{const e=fo(o);if(e===void 0)return;const[n,s,c]=e.map(go);return .2126*n+.7152*s+.0722*c},_o="#181825",Eo="#ffffff",ko="straight",O=.5,q={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"}},So={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"}},D=o=>o===void 0||o.trim()===""?void 0:o.trim(),bo=o=>{const e=o===void 0?void 0:le(o);return e===void 0?"light":e<O?"dark":"light"},Co=(o,e)=>{const n=le(o);return n===void 0?q[e].text:(e==="light"?n<O:n>=O)?o:q[e].text},yo=o=>{const e=bo(D(o==null?void 0:o.backgroundColor)),n=(o==null?void 0:o.ctaBorderType)===ko?"rectangle":"rectangle-rounded",s=D(o==null?void 0:o.primaryColor)??_o,c=D(o==null?void 0:o.fontFamily),r={...q[e],...So[n],primary:s,accent:Co(s,e),"cta-text":D(o==null?void 0:o.ctaTextColor)??Eo,...c===void 0?{}:{font:c}};return Object.fromEntries(Object.entries(r).map(([l,a])=>[`--dso-${l}`,a]))},Io=o=>{const e=t.ref(),n=t.ref(void 0),s=t.ref({width:0,height:0});return t.watch(o,(c,r,l)=>{if(!c)return;const a=()=>{const p=e.value;if(p===void 0)return;const d=p.previousElementSibling??p,{top:u,bottom:i,left:m,width:_}=d.getBoundingClientRect();(s.value.width!==window.innerWidth||s.value.height!==window.innerHeight)&&(s.value={width:window.innerWidth,height:window.innerHeight});const h=n.value;(h===void 0||h.top!==u||h.bottom!==i||h.left!==m||h.width!==_)&&(n.value={top:u,bottom:i,left:m,width:_})};a(),window.addEventListener("scroll",a,!0),window.addEventListener("resize",a),l(()=>{window.removeEventListener("scroll",a,!0),window.removeEventListener("resize",a)})},{immediate:!0,flush:"post"}),{anchorRef:e,rect:n,viewport:s}},wo=(o,e)=>{const n=t.ref(!1),s=t.ref(),c=t.computed(()=>o.value.status!==$.IDLE&&!n.value);t.watch(()=>o.value.query,()=>{n.value=!1}),t.watch(c,(l,a,p)=>{if(!l)return;const d=u=>{var C,y;const i=u.target;if(!(i instanceof Node))return;const m=(C=e.value)==null?void 0:C.previousElementSibling,_=((y=s.value)==null?void 0:y.contains(i))??!1,h=(m==null?void 0:m.contains(i))??!1;!_&&!h&&(n.value=!0)};document.addEventListener("pointerdown",d),p(()=>document.removeEventListener("pointerdown",d))},{immediate:!0});const r=()=>{n.value=!1};return t.onMounted(()=>{var l,a;(a=(l=e.value)==null?void 0:l.previousElementSibling)==null||a.addEventListener("focusin",r)}),t.onUnmounted(()=>{var l,a;(a=(l=e.value)==null?void 0:l.previousElementSibling)==null||a.removeEventListener("focusin",r)}),{isOpen:c,panelRef:s}},$o={key:0,class:"dialog-search-error"},No={role:"alert",class:"dialog-search-status dialog-search-status-error"},To={key:1,role:"status",class:"dialog-search-status"},Bo={key:0,class:"dialog-search-footer"},Ro=["href"],Ao=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=k=>k instanceof pe?`Search failed (${k.status}${k.code?` ${k.code}`:""}): ${k.message}`:"Search failed: network error. Check your connection and try again.",s=t.computed(()=>e.state),c=t.computed(()=>e.state.status!==$.IDLE),{anchorRef:r,rect:l,viewport:a}=Io(c),{isOpen:p,panelRef:d}=wo(s,r),u=t.computed(()=>p.value&&l.value!==void 0&&lo(l.value,a.value.height)),i=t.computed(()=>yo(e.theme)),m=t.computed(()=>({...l.value===void 0?{}:uo(l.value,a.value.width,a.value.height),...i.value})),_=t.computed(()=>J(e.locale)),h=t.computed(()=>e.state.response),C=t.computed(()=>{var k,w;return((w=(k=e.state.sections)==null?void 0:k.collections)==null?void 0:w.hits)??[]}),y=t.computed(()=>ae(C.value).length>0),I=t.computed(()=>e.seeAllHref!==void 0&&h.value!==void 0&&h.value.nbHits>0),f=t.computed(()=>!I.value&&ee(e.state)),E=t.computed(()=>{var k;return h.value===void 0||(k=e.seeAllHref)==null?void 0:k.call(e,h.value.query)});return(k,w)=>(t.openBlock(),t.createElementBlock(t.Fragment,null,[t.createElementVNode("div",{ref_key:"anchorRef",ref:r},null,512),u.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(m.value)},[e.state.status===t.unref($).ERROR?(t.openBlock(),t.createElementBlock("div",$o,[t.createElementVNode("p",No,t.toDisplayString(n(e.state.error)),1),t.createElementVNode("button",{type:"button",class:"dialog-search-retry",onClick:w[0]||(w[0]=g=>e.controller.retry())},t.toDisplayString(_.value.retry),1)])):h.value===void 0?(t.openBlock(),t.createElementBlock("p",To,t.toDisplayString(_.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":!y.value}])},[t.createVNode(Zt,{collections:C.value,query:h.value.query,messages:_.value},null,8,["collections","query","messages"]),t.createVNode(ro,{controller:e.controller,response:h.value,locale:e.locale,messages:_.value},null,8,["controller","response","locale","messages"])],2),I.value||f.value?(t.openBlock(),t.createElementBlock("div",Bo,[I.value?(t.openBlock(),t.createElementBlock("a",{key:0,class:"dialog-search-cta",href:E.value},[t.createTextVNode(t.toDisplayString(_.value.seeAllLabel(h.value.nbHits))+" ",1),t.createVNode(Ot)],8,Ro)):(t.openBlock(),t.createBlock(te,{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))}}),Lo=o=>{const{client:e,surface:n="search_page",...s}=o,c=$e({search:(a,p)=>e.search(a,p),analytics:{surface:n,trackViewSearchResults:a=>e.trackViewSearchResults(a),trackSelectSearchResult:a=>e.trackSelectSearchResult(a)},...s}),r=t.shallowRef(c.getState()),l=c.subscribe(()=>{r.value=c.getState()});return t.onMounted(()=>{z({method:"vue",version:"3.11.0"})}),t.onUnmounted(()=>{l(),c.dispose()}),{controller:c,state:r,theme:e.theme}};S.DialogInput=Y,S.DialogProductBlock=rt,S.DialogSearchBar=Et,S.DialogSearchPagination=te,S.DialogSearchProductCard=ce,S.DialogSearchResults=Ao,S.useDialogSearch=Lo,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.11.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.17.0"
33
33
  },
34
34
  "author": "Dialog",
35
35
  "publishConfig": {