PageSourceSearch

https://members.salesamurai.io/build/assets/KvH_u18k.js

js salesamurai.io collected 2026-09-27 20:56:21 UTC 64,527 bytes, 3 lines download raw bytes

1import{B as we}from"./B_ipyhYZ.js";import{_ as lt,a as at}from"./DFvH191t.js";import{u as xe,a as Se}from"./DGSQx9gj.js";import{u as Ze}from"./BgkcmjJp.js";import{d as ae,Q as x,ai as he,c6 as Ie,c7 as rt,c8 as Ge,c9 as nt,ca as qe,cb as it,c,F as Z,p as pe,e as a,y as k,q as i,f as e,l as ct,z as ce,t as ge,r as j,w as le,am as ut,k as K,j as J,D as Ye,aj as dt,_ as o,bi as Te,v as W,bJ as Pe,bI as $e,c5 as Je,n as ke,o as Le,aE as Me,x as pt,A as gt,H as me,G as vt,T as ht,cc as mt,cd as ft,ce as xt,a4 as bt,bj as yt,cf as wt,cg as kt,ch as _t,ci as Ct,E as St}from"./edfHDTum.js";import{_ as $t}from"./DMzy82BU.js";import{a as Qe,b as Lt}from"./BfPKaf7i.js";import{I as te,a as se}from"./Xoi1hU5U.js";import{_ as ye}from"./CHRB8wXb.js";import{_ as De}from"./Dh2ccLNZ.js";import{u as _e,_ as Ce}from"./XsR6ZTSk.js";import{_ as Fe}from"./8OdOZIMH.js";import{u as Ae}from"./C-UEDonU.js";import{u as et}from"./CL4vznwv.js";import{_ as tt}from"./DXi3aIq8.js";import{u as Ee}from"./CRLh8Ire.js";import{C as st}from"./DCi-oGBp.js";import{_ as Mt}from"./DlAUqK2U.js";import{u as ot}from"./DjkTUzOV.js";import"./jca_Kk7O.js";import"./BYecEvQY.js";import"./gMVYLUlo.js";import"./CvuVP51M.js";const It={class:"grid grid-cols-2 min:2xl:grid-cols-1 gap-2"},Tt=ae({__name:"KeywordsStatistics",setup($){const{getBadgeClass:I,getText:A}=Ze(),l=xe(),h=x(()=>l.searchResult),v=x(()=>h.value.etsySearchVolume),C=x(()=>h.value.listingsTotalCount),u=x(()=>h.value.longTail),L=x(()=>h.value.lastSearch),p=x(()=>h.value.etsyCtr),O=x(()=>h.value.googleSearchVolume),E=x(()=>h.value.googleCpc),w=x(()=>h.value.googleCompetition),y={gold:"text-lightning-yellow-300 dark:text-lightning-yellow-200",warning:"text-lightning-yellow-500 dark:text-lightning-yellow-400",danger:"text-punch-600 dark:text-cinnabar-500",success:"text-shamrock-400 dark:text-eucalyptus-500"},V=(b,F)=>b>=1e3&&F<=1e3?{icon:he,class:y.gold}:b<=1e3?{icon:he,class:y.danger}:b>1e3&&b<=15e3?{icon:he,class:y.warning}:{icon:he,class:y.success},m=(b,F)=>b>=1e3&&F<=1e3?{icon:he,class:y.gold}:F<=1e4?{icon:he,class:y.success}:F>1e4&&F<=5e4?{icon:he,class:y.warning}:{icon:he,class:y.danger},g=x(()=>{var _;const b=V(v.value,C.value),F=m(v.value,C.value);return[{key:"longTail",icon:rt,title:"Long Tail",popoverText:"Whether the phrase is long tail or not",hasFavorites:!0,value:L.value,supValue:(_=L.value)==null?void 0:_.length,valueIcon:u.value?he:Ie,valueIconClass:u.value?y.success:y.danger,badgeClass:null},{key:"etsySV",icon:Ge,title:"Etsy SV",popoverText:"Etsy search volume",hasFavorites:!1,value:v.value?v.value.toLocaleString("en-US"):"N/A",supValue:null,valueIcon:b.icon,valueIconClass:b.class,badgeClass:null},{key:"etsyCTR",icon:nt,title:"Etsy CTR",popoverText:"Click-through rate",hasFavorites:!1,value:p.value?p.value.toLocaleString("en-US")+"%":"N/A",supValue:null,valueIcon:null,valueIconClass:null,badgeClass:null},{key:"etsyCompetition",icon:qe,title:"Etsy Competition",popoverText:"Total listing count",hasFavorites:!1,value:C.value.toLocaleString("en-US"),supValue:null,valueIcon:F.icon,valueIconClass:F.class,badgeClass:null},{key:"googleSV",icon:Ge,title:"Google SV",popoverText:"Google Search volume",hasFavorites:!1,value:O.value?O.value.toLocaleString("en-US"):"N/A",supValue:null,valueIcon:null,valueIconClass:null,badgeClass:null},{key:"googleCPC",icon:it,title:"Google CPC",popoverText:"Cost per click",hasFavorites:!1,value:E.value?E.value.toLocaleString("en-US",{style:"currency",currency:"USD"}):"N/A",supValue:null,valueIcon:null,valueIconClass:null,badgeClass:null},{key:"googleCompetition",icon:qe,title:"Google Competition",popoverText:"Google Competition",hasFavorites:!1,value:A(w.value),supValue:null,valueIcon:null,valueIconClass:null,badgeClass:I(w.value)}]});return(b,F)=>(a(),c("div",It,[(a(!0),c(Z,null,pe(g.value,(_,z)=>(a(),c("div",{key:_.key,class:k(["relative",z===6?"col-span-2 min:2xl:col-span-1":""])},[i(lt,{icon:_.icon,title:_.title,value:_.value,hasFavorites:_.hasFavorites,popoverText:_.popoverText,supValue:_.supValue,valueIcon:_.valueIcon,valueIconClass:_.valueIconClass,badgeClass:_.badgeClass},null,8,["icon","title","value","hasFavorites","popoverText","supValue","valueIcon","valueIconClass","badgeClass"])],2))),128))]))}}),Pt={class:"grid grid-cols-2 gap-4 pt-6 pb-1"},Dt=ae({__name:"WarningConnectShop",emits:["close"],setup($,{emit:I}){const A=I,l=()=>{A("close")};
1return(h,v)=>{const C=ct("router-link");return a(),c(Z,null,[v[2]||(v[2]=e("div",null,"In order to see competition data, click here to connect your shop",-1)),e("div",Pt,[e("div",null,[e("button",{type:"button",class:"cursor-pointer inline-flex items-center w-full justify-center rounded-md bg-white px-3 py-3 text-sm font-semibold text-mirage-950 shadow-xs ring-1 ring-link-water-200 hover:bg-gray-50 disabled:opacity-50 disabled:cursor-not-allowed",onClick:v[0]||(v[0]=u=>l())}," Cancel ")]),e("div",null,[i(C,{to:{name:"shops"},class:k(["relative flex items-center w-full justify-center rounded-md bg-mariner-500 hover:bg-mariner-400 dark:bg-dodger-blue-350 dark:hover:bg-dodger-blue-400 px-3 py-2.5 text-sm/6 font-semibold text-white shadow-xs focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-mariner-500 disabled:opacity-60"])},{default:ce(()=>[...v[1]||(v[1]=[ge("Connect",-1)])]),_:1})])])],64)}}}),Ft={class:"mt-0.75"},At={class:"flex flex-wrap items-start gap-x-3 gap-y-4"},Et={class:"flex flex-wrap gap-x-1 grow-9999 shrink basis-0 min-w-max"},Rt={class:"grow shrink basis-[230px] min-w-40 -translate-y-2.5"},Ut={class:"relative"},Ot={class:"relative rounded-lg overflow-hidden"},Vt={class:"overflow-x-auto [&::-webkit-scrollbar-thumb]:bg-transparent! [&::-webkit-scrollbar-thumb]:transition-colors [&::-webkit-scrollbar-thumb]:duration-200 hover:[&::-webkit-scrollbar-thumb]:bg-tropical-blue-200! dark:hover:[&::-webkit-scrollbar-thumb]:bg-lynch-500!"},Nt={class:"w-full text-left border-collapse"},Bt={class:"bg-tropical-blue-200/30 dark:bg-fiord-550/29 text-woodsmoke-900 dark:text-zumthor-100"},jt={class:"px-1 py-4.5"},zt={class:"flex flex-col items-center"},Wt={class:"px-1 py-4.5"},Ht={class:"flex flex-col items-center"},Gt={key:0,class:"px-1 py-4.5"},qt={class:"flex flex-col items-center"},Kt={key:1,class:"px-1 py-4.5"},Xt={class:"flex flex-col items-center"},Zt={class:"px-1 py-4.5"},Yt={class:"flex flex-col items-center"},Jt={key:1,class:"flex items-center gap-1 whitespace-nowrap"},Qt={key:0},es={colspan:"4",class:"px-1 py-4 text-center text-lynch-500 dark:text-white"},ts={class:"flex items-center justify-center px-4 py-4.5"},ss={key:1,class:"text-sm"},os={class:"px-1 py-5.75"},ls=["title"],as={class:"truncate max-sm:max-w-[80px] max-md:max-w-[150px] lg:max-w-[200px] xl:max-w-[350px] text-sm"},rs={class:"text-sm text-gray-400 flex-shrink-0 ml-1"},ns={class:"flex items-center gap-0.5 flex-shrink-0 ml-1"},is={class:"px-1 py-1 text-left whitespace-nowrap text-sm text-woodsmoke-900 dark:text-white"},cs={key:0,class:"px-1 py-1 text-left whitespace-nowrap text-sm"},us={key:1,class:"px-1 py-1 text-left whitespace-nowrap text-sm"},ds={class:"px-1 py-1 text-left whitespace-nowrap"},ps={key:0,class:"text-sm"},gs={key:1,class:"flex items-center justify-center"},vs={key:0,class:"absolute inset-0 flex flex-col items-center justify-center gap-2 pointer-events-none text-gray-500 dark:text-link-water-200"},hs={key:0},ms={key:1},fs={key:0,class:"flex flex-col sm:flex-row items-end sm:items-center justify-end mt-0 py-1.75 gap-1"},xs=ae({__name:"MostTrendingTable",setup($){const{isSupported:I,copyToClipboard:A}=et(),{getBadgeClass:l,getText:h}=Ze(),{notify:v}=Lt(),C=_e(),u=_e(),L=Qe(),p=xe(),O=Se(),E=x(()=>O.getAllFavoriteKeywords()),w=x(()=>new Set(E.value.map(D=>{var f;return(f=D.keyword)==null?void 0:f.toLowerCase().trim()}))),y=j(null),V=x(()=>L.shops.length>0),m=j("etsy"),g=x(()=>m.value==="etsy"?p.etsySuggestions??[]:p.googleSuggestions??[]),b=j(1),F=j(8),_=j(""),z=j(new Set),G=j(null),M=j(""),{currentSortColumn:s,currentSortOrder:t,toggleSort:n,getSortIconClass:d}=Ae(),U=x(()=>X.value.length),T=x(()=>Math.ceil(U.value/F.value)),r=x(()=>{const D=(b.value-1)*F.value,f=D+F.value;return X.value.slice(D,f)}),S=x(()=>Math.max(0,F.value-r.value.length)),R=()=>`${m.value}-${b.value}-${s.value||"none"}-${t.value}-${_.value.toLowerCase()}`,N=()=>`${Date.now()}-${Math.random().toString(36).substr(2,9)}`,P=()=>{G.value&&(G.value.abort(),G.value=null),M.value=""},q=D=>{D==="competition"&&m.value==="etsy"||(P(),n(D),b.value=1)},H=(D,f,B)=>[...D].sort((oe,ie)=>{var be,Ue,Oe,Ve,Ne,Be,je,ze,We,He;let ee,ve;switch(f){case"keywords":ee=((be=oe.keywords)==null?void 0:be.toLowerCase())||"",ve=((Ue=ie.keywords)==null?void 0:Ue.toLowerCase())||"";break;case"search_volume":ee=parseFloat(((Oe=oe.search_volume)==null?void 0:Oe.toString())||"0"),ve=parseFloat(((Ve=ie.search_volume)==null?void 0:Ve.toString())||"0");break;case"ctr":ee=parseFloat(((Ne=oe.ctr)==null?void 0:Ne.toString())||"0"),ve=parseFloat(((Be=ie.ctr)==null?void 0:Be.toString())||"0");break;case"cpc":ee=parseFloat(((je=oe.cpc)==null?void 0:je.toString())||"0"),ve=parseFloat(((ze=ie.cpc)==null?void 0:ze.toString())||"0");break;case"competition":if(m.value==="google")ee=parseFloat(((We=oe.competition)==null?void 0:We.toString())||"0"),ve=parseFloat(((He=ie.competition)==null?void 0:He.toString())||"0");else return 0;break;default:return 0}let fe=0;return ee>ve?fe=1:ee<ve&&(fe=-1),B==="desc"?fe*-1:fe}),X=x(()=>
1{if(g.value.length===0)return[];let D=[...g.value];if(_.value.trim()){const f=_.value.toLowerCase();D=D.filter(B=>B.keywords.toLowerCase().includes(f))}return s.value&&(D=H(D,s.value,t.value)),D}),Q=async()=>{if(!V.value||m.value!=="etsy")return;const D=R(),f=N();if(z.value.has(D))return;P(),M.value=f,G.value=new AbortController;const B=r.value.filter(oe=>oe.competition===null);if(B.length===0){z.value.add(D),M.value="",G.value=null;return}try{const ie=[];for(let ee=0;ee<B.length;ee+=3)ie.push(B.slice(ee,ee+3));for(const ee of ie){if(M.value!==f)return;const ve=ee.map(fe=>{var be;return p.getEtsyCompetition(fe.keywords,(be=G.value)==null?void 0:be.signal)});if(await Promise.all(ve),M.value!==f)return;ie.length>1&&ee!==ie[ie.length-1]&&await new Promise(fe=>setTimeout(fe,100))}M.value===f&&(z.value.add(D),M.value="",G.value=null)}catch(oe){M.value===f&&oe instanceof Error&&oe.name!=="AbortError"&&v("Error loading competition data","error"),M.value===f&&(M.value="",G.value=null)}},Y=D=>{D>=1&&D<=T.value&&(P(),b.value=D)},ue=D=>D&&D!==0?D.toLocaleString("en-US"):"N/A",re=D=>D&&D!==0?D.toLocaleString("en-US")+"%":"N/A",ne=D=>D&&D!==0?D.toLocaleString("en-US",{style:"currency",currency:"USD"}):"N/A",de=D=>{y.value=D,u.openDialog()};return le(m,()=>{P(),b.value=1,_.value="",s.value=null,t.value="asc",z.value.clear()}),le(_,()=>{P(),b.value=1,z.value.clear()}),le(()=>[p.searchResult.etsy_suggestions,p.searchResult.google_suggestions],(
1)=>{P(),b.value=1,_.value="",s.value=null,t.value="asc",z.value.clear()}),le([b,r],async()=>{await ke(),await Q()},{immediate:!0}),ut(()=>{P()}),(D,f)=>(a(),c(Z,null,[e("div",Ft,[e("div",At,[e("div",Et,[e("button",{onClick:f[0]||(f[0]=B=>m.value="etsy"),class:k([m.value==="etsy"?"text-blue-ribbon-500 dark:text-dodger-blue-430 underline underline-offset-16 decoration-2 decoration-blue-ribbon-500 dark:decoration-dodger-blue-430":"text-lynch-500 dark:text-zumthor-100 hover:text-blue-ribbon-500/80 dark:hover:text-dodger-blue-430/80","p-0 text-base font-semibold transition-colors cursor-pointer"])}," Etsy Most Trending ",2),e("button",{onClick:f[1]||(f[1]=B=>m.value="google"),class:k([m.value==="google"?"text-blue-ribbon-500 dark:text-dodger-blue-430 underline underline-offset-16 decoration-2 decoration-blue-ribbon-500 dark:decoration-dodger-blue-430":"text-lynch-500 dark:text-zumthor-100 hover:text-blue-ribbon-500/80 dark:hover:text-dodger-blue-430/80","px-5 py-1 text-base font-semibold transition-colors cursor-pointer"])}," Google Most Trending ",2)]),e("div",Rt,[e("div",Ut,[Ye(e("input",{"onUpdate:modelValue":f[2]||(f[2]=B=>_.value=B),type:"text",placeholder:"Search...",class:"w-full pl-3 pr-3 mb-1 h-[50px] rounded-lg bg-white dark:bg-pickled-bluewood-800a text-lynch-500 dark:text-gray-chateau-400 outline-1 -outline-offset-1 outline-tropical-blue-200 dark:outline-lynch-500 placeholder:text-lynch-500 dark:placeholder:text-gray-chateau-400 placeholder:text-base placeholder:font-normal focus:outline-1 focus:-outline-offset-1 focus:outline-blue-ribbon-500 dark:focus:outline-dodger-blue-400"},null,512),[[dt,_.value]])])])])]),e("div",Ot,[e("div",Vt,[e("table",Nt,[e("thead",Bt,[e("tr",null,[e("th",
1jt,[e("div",{class:"flex items-center gap-1 cursor-pointer ml-2",onClick:f[3]||(f[3]=B=>q("keywords"))},[f[9]||(f[9]=e("span",{class:"font-medium text-sm"},"Keywords",-1)),e("div",zt,[i(te,{class:k(["h-2 w-2",o(d)("keywords","asc")])},null,8,["class"]),i(se,{class:k(["h-2 w-2",o(d)("keywords","desc")])},null,8,["class"])])])]),e("th",Wt,[e("div",{class:"flex items-center gap-1 cursor-pointer whitespace-nowrap",onClick:f[4]||(f[4]=B=>q("search_volume"))},[f[10]||(f[10]=e("span",{class:"font-medium text-sm"},"Volume",-1)),e("div",Ht,[i(te,{class:k(["h-2 w-2",o(d)("search_volume","asc")])},null,8,["class"]),i(se,{class:k(["h-2 w-2",o(d)("search_volume","desc")])},null,8,["class"])])])]),m.value==="etsy"?(a(),c("th",Gt,[e("div",{class:"flex items-center gap-1 cursor-pointer whitespace-nowrap",onClick:f[5]||(f[5]=B=>q("ctr"))},[f[11]||(f[11]=e("span",{class:"font-medium text-sm"},"CTR",-1)),e("div",qt,[i(te,{class:k(["h-2 w-2",o(d)("ctr","asc")])},null,8,["class"]),i(se,{class:k(["h-2 w-2",o(d)("ctr","desc")])},null,8,["class"])])])])):(a(),c("th",Kt,[e("div",{class:"flex items-center gap-1 cursor-pointer whitespace-nowrap",onClick:f[6]||(f[6]=B=>q("cpc"))},[f[12]||(f[12]=e("span",{class:"font-medium text-sm"},"CPC",-1)),e("div",Xt,[i(te,{class:k(["h-2 w-2",o(d)("cpc","asc")])},null,8,["class"]),i(se,{class:k(["h-2 w-2",o(d)("cpc","desc")])},null,8,["class"])])])])),e("th",Zt,[m.value==="google"?(a(),c("div",{key:0,class:"flex items-center gap-1 cursor-pointer whitespace-nowrap",onClick:f[7]||(f[7]=B=>q("competition"))},[f[13]||(f[13]=e("span",{class:"font-medium text-sm"},"Competition",-1)),e("div",Yt,[i(te,{class:k(["h-2 w-2",o(d)("competition","asc")])},null,8,["class"]),i(se,{class:k(["h-2 w-2",o(d)("competition","desc")])},null,8,["class"])])])):(a(),c("div",Jt,[...f[14]||(f[14]=[e("span",{class:"font-medium text-sm"},"Competition",-1)])]))])])]),o(p).isLoading?(a(),c("tbody",Qt,[e("tr",null,[e("td",es,[e("div",ts,[i(ye,{classColor:"text-blue-ribbon-500 dark:hover:text-dodger-blue-430 mr-2"}),f[15]||(f[15]=e("span",null,"Loading...",-1))])])])])):(a(),c("tbody",ss,[(a(!0),c(Z,null,pe(r.value,B=>(a(),c("tr",{key:`${m.value}-${B.keywords}`,class:"bg-tropical-blue-40 dark:bg-polo-blue-500b text-lynch-500 dark:text-white hover:bg-tropical-blue-200/30 dark:hover:bg-fiord-550/29 transition-colors"},[e("td",os,[e("div",{class:"flex items-center gap-1 ml-2 mt-0.25",title:B.keywords},[e("span",as,W(B.keywords),1),e("sup",rs,W(B.keywords.length),1),e("div",ns,[w.value.has(B.keywords.toLowerCase().trim())?(a(),J(o(Pe),{key:0,class:"w-4 h-4 text-gray-chateau-500"})):(a(),J(o($e),{key:1,onClick:oe=>de(B),class:"w-4 h-4 text-gray-chateau-500 cursor-pointer"},null,8,["onClick"])),o(I)?(a(),J(o(Je),{key:2,onClick:oe=>o(A)(B.keywords),class:"w-4 h-4 text-gray-chateau-500 cursor-pointer hover:text-mariner-500 dark:hover:text-dodger-blue-400 transition-colors",title:`Copy ${B.keywords} to clipboard`},null,8,["onClick","title"])):K("",!0)])],8,ls)]),e("td",is,W(ue(B.search_volume)),1),m.value==="etsy"?(a(),c("td",cs,W(re(B.ctr)),1)):(a(),c("td",us,W(ne(B.cpc)),1)),e("td",ds,[m.value==="etsy"&&V.value?(a(),c(Z,{key:0},[typeof B.competition=="number"?(a(),c("div",ps,W(B.competition.toLocaleString("en-US")),1)):(a(),c("div",gs,[i(ye,{"class-size":"w-4 h-4","class-color":"text-blue-ribbon-500 dark:text-dodger-blue-430"})]))],64)):m.value==="google"?(a(),c("span",{key:1,class:k([o(l)(B.competition),"text-sm font-semibold px-3 py-1 rounded-lg whitespace-nowrap"])},W(o(h)(B.competition)),3)):m.value==="etsy"&&!V.value?(a(),J(o(Ie),{key:2,onClick:f[8]||(f[8]=oe=>o(C).openDialog()),class:"inline-block w-4 h-4 text-gray-chateau-500 cursor-pointer"})):K("",!0)])]))),128)),(a(!0),c(Z,null,pe(S.value,B=>(a(),c("tr",{key:`placeholder-${B}`,"aria-hidden":"true",class:"bg-tropical-blue-40 dark:bg-polo-blue-500b"},[...f[16]||(f[16]=[e("td",{class:"px-1 py-5.75",colspan:"4"},[e("div",{class:"flex items-center mt-0.25"},[e("span",{class:"text-sm"}," ")])],-1)])]))),128))]))])]),!o(p).isLoading&&r.value.length===0?(a(),c("div",vs,[i(o(Te),{class:"h-12 w-12 text-gray-300"}
1),_.value.trim()?(a(),c("span",hs,' No suggestions found matching "'+W(_.value)+'" ',1)):(a(),c("span",ms,"No suggestions found."))])):K("",!0)]),o(p).isLoading?K("",!0):(a(),c("div",fs,[f[17]||(f[17]=e("div",{class:"text-sm text-gray-500 dark:text-link-water-400"},null,-1)),i(De,{"current-page":b.value,"total-pages":Math.max(T.value,1),"onUpdate:currentPage":Y,class:k(["order-1 sm:order-2 my-3",T.value===0?"invisible":""])},null,8,["current-page","total-pages","class"])])),i(Ce,{"is-open":o(C).isOpen.value,title:"Notice",onClose:o(C).closeDialog},{contentModal:ce(()=>[i(Dt,{onClose:o(C).closeDialog},null,8,["onClose"])]),_:1},8,["is-open","onClose"]),y.value?(a(),J(Ce,{key:1,"is-open":o(u).isOpen.value,title:"Like keyword",onClose:o(u).closeDialog},{contentModal:ce(()=>[i(Fe,{onClose:o(u).closeDialog,categories:o(O).keywordCategories,type:"keywords",item:y.value},null,8,["onClose","categories","item"])]),_:1},8,["is-open","onClose"])):K("",!0)],64))}}),bs={class:"bg-tropical-blue-200/15 dark:bg-polo-blue-500b p-1 rounded-lg px-3 py-4.5 dark:text-white"},ys={class:"flex items-start gap-3"},ws={key:0,class:"w-10 h-10 bg-blue-ribbon-500 dark:bg-dodger-blue-430 rounded-full flex items-center justify-center shrink-0 transform-gpu"},ks={class:"flex-1"},_s={class:"text-lynch-500 dark:text-polo-blue-500a text-sm pb-2 whitespace-nowrap"},Cs={class:"relative inline-block pr-0.75"},Ss={class:"text-3xl font-semibold p-0.5 text-woodsmoke-900 dark:text-white"},Re=ae({__name:"CardStatisticListing",props:{icon:{type:[Function,Object,null]},popoverText:{},title:{},value:{}},setup($){const I=j(!1),A=j(),l=j(),h=j({top:"0px",left:"0px"}),v=j(!1),C=j(!1),u=async()=>{var b,F;if(!A.value)return;await ke();const E=A.value.getBoundingClientRect(),w=window.innerWidth,y=((b=l.value)==null?void 0:b.offsetWidth)||200,V=w-(E.left+E.width/2);v.value=V<y/2+50;const m=((F=$.popoverText)==null?void 0:F.length)||0;C.value=m>30;let g=E.left+window.scrollX+E.width/2;v.value&&(g=Math.min(g,w-y/2-20)),h.value={top:`${E.top+window.scrollY-8}px`,left:`${g}px`}},L=x(()=>({...h.value,transform:"translate(-50%, -100%)"})),p=x(()=>{const E=[];return C.value||v.value?E.push("max-w-xs","whitespace-normal","break-words"):E.push("whitespace-nowrap"),E.join(" ")}),O=x(()=>v.value?"left-3/4 transform -translate-x-1/2":"left-1/2 transform -translate-x-1/2");return le(I,E=>{E&&u()}),Le(()=>{window.addEventListener("resize",u),window.addEventListener("scroll",u)}),Me(()=>{window.removeEventListener("resize",u),window.removeEventListener("scroll",u)}),(E,w)=>(a(),c("div",bs,[e("div",ys,[$.icon?(a(),c("div",ws,[(a(),J(pt($.icon),{class:"block w-6 h-6 text-white shrink-0 transform-gpu"}))])):K("",!0),e("div",ks,[e("div",_s,[ge(W($.title)+" ",1),e("div",Cs,[i(o(Ie),{ref_key:"iconRef",ref:A,class:"inline-block w-4 h-4 text-gray-chateau-500 cursor-pointer",onMouseenter:w[0]||(w[0]=y=>I.value=!0),onMouseleave:w[1]||(w[1]=y=>I.value=!1)},null,512),(a(),J(ht,{to:"body"},[i(gt,{"enter-active-class":"transition duration-200 ease-out","enter-from-class":"translate-y-1 opacity-0","enter-to-class":"translate-y-0 opacity-100","leave-active-class":"transition duration-150 ease-in","leave-from-class":"translate-y-0 opacity-100","leave-to-class":"translate-y-1 opacity-0"},{default:ce(()=>[Ye(e("div",{ref_key:"popoverRef",ref:l,class:"absolute mb-2",style:me([L.value,{"z-index":"40"}]),onMouseenter:w[2]||(w[2]=y=>I.value=!0),onMouseleave:w[3]||(w[3]=y=>I.value=!1)},[e("div",{class:k([p.value,"bg-blue-ribbon-500 dark:bg-dodger-blue-430 text-white rounded-lg px-3 py-2 shadow-lg relative"])},[e("div",{class:k([O.value,"absolute top-full w-0 h-0 border-l-4 border-r-4 border-t-4 border-l-transparent border-r-transparent border-t-mariner-500"])},null,2),ge(" "+W($.popoverText),1)],2)],36),[[vt,I.value]])]),_:1})]))])]),e("span",Ss,W($.value),1)])])]))}}),$s={class:"grid grid-cols-1 sm:grid-cols-3 min:2xl:grid-cols-1 gap-2 items-stretch"},Ls=ae({__name:"ListingStatistics",setup($){const I=xe(),A=x(()=>[{key:"views",icon:mt,title:"Avg. Views",popoverText:"Average Views",value:I.averageViews().toLocaleStr
1ing("en-US")},{key:"likes",icon:$e,title:"Avg. Likes",popoverText:"Average Likes",value:I.averageLikes().toLocaleString("en-US")},{key:"photos",icon:ft,title:"Avg. Photos",popoverText:"Average Photos",value:I.averagePhotos().toLocaleString("en-US")}]);return(l,h)=>(a(),c("div",$s,[(a(!0),c(Z,null,pe(A.value,v=>(a(),c("div",{key:v.key,class:"relative h-full"},[i(Re,{icon:v.icon,title:v.title,value:v.value,popoverText:v.popoverText,class:"h-full"},null,8,["icon","title","value","popoverText"])]))),128))]))}}),Ms={class:"grid grid-cols-2 gap-4"},Is={class:"flex justify-end space-x-2"},Ts={class:"rounded-lg overflow-hidden"},Ps={class:"overflow-x-auto [&::-webkit-scrollbar-thumb]:bg-transparent! [&::-webkit-scrollbar-thumb]:transition-colors [&::-webkit-scrollbar-thumb]:duration-200 hover:[&::-webkit-scrollbar-thumb]:bg-tropical-blue-200! dark:hover:[&::-webkit-scrollbar-thumb]:bg-lynch-500!"},Ds={class:"w-full text-left border-collapse"},Fs={class:"bg-tropical-blue-200/30 dark:bg-fiord-550/29 text-woodsmoke-900 dark:text-zumthor-100"},As={class:"px-1 py-5"},Es={class:"flex flex-col items-center"},Rs={class:"px-1 py-5"},Us={class:"flex flex-col items-center"},Os={class:"px-1 py-5"},Vs={class:"flex flex-col items-center"},Ns={class:"px-1 py-5"},Bs={class:"flex flex-col items-center"},js={class:"px-1 py-5"},zs={class:"flex flex-col items-center"},Ws={class:"px-1 py-5"},Hs={class:"flex flex-col items-center"},Gs={class:"px-1 py-5"},qs={class:"flex flex-col items-center"},Ks={key:0},Xs={colspan:"9",class:"px-1 py-4 text-center text-lynch-500 dark:text-white"},Zs={class:"flex items-center justify-center px-4 py-2"},Ys={key:1,class:"text-sm"},Js={class:"px-1 py-3"},Qs={class:"ml-2"},eo={class:"px-1 py-3"},to=["title"],so=["src","alt"],oo=["href","title"],lo={class:"px-1 py-3 text-left whitespace-nowrap text-sm text-woodsmoke-900 dark:text-white"},ao={class:"px-1 py-3 text-left whitespace-nowrap text-sm"},ro={class:"px-1 py-3 text-left whitespace-nowrap text-sm"},no={class:"px-1 py-3 text-left whitespace-nowrap text-sm"},io={class:"px-1 py-3 text-left whitespace-nowrap text-sm"},co={class:"px-1 py-3 text-left whitespace-nowrap text-sm"},uo={class:"px-1 py-3 whitespace-nowrap"},po={class:"mr-2"},go={key:2},vo={key:0},ho={colspan:"9",class:"px-1 py-4 text-center text-lynch-500 dark:text-white bg-tropical-blue-200/15 dark:bg-polo-blue-500b"},mo={class:"flex flex-col items-center justify-center gap-2"},fo={key:0,class:"flex flex-col sm:flex-row items-end sm:items-center justify-end sm:justify-between mt-0 py-1 gap-1"},xo=ae({__name:"ListingTable",setup($){const I=bt(),A=_e(),l=s=>{I.push({name:"listing-detail",params:{listingId:s}})},h=Se(),v=x(()=>h.getAllFavoriteListings()),C=x(()=>new Set(v.value.map(s=>s.listing_id))),u=j(null),L=s=>{u.value=s,A.openDialog()},p=xe(),O=j(1),E=j(5),w=s=>{const t=s.target;p.setListingsSearchItem(t.value)},{currentSortColumn:y,currentSortOrder:V,toggleSort:m,getSortIconClass:g}=Ae(()=>{O.value=1}),b=(s,t,n)=>[...s].sort((d,U)=>{var R,N,P,q,H,X,Q,Y,ue,re,ne,de,D,f;let T,r;switch(t){case"title":T=((R=d.title)==null?void 0:R.toLowerCase())||"",r=((N=U.title)==null?void 0:N.toLowerCase())||"";break;case"price_in_dollars":T=parseFloat(((P=d.price_in_dollars)==null?void 0:P.toString())||"0"),r=parseFloat(((q=U.price_in_dollars)==null?void 0:q.toString())||"0");break;case"shipping_days":T=parseInt(((H=d.shipping_days)==null?void 0:H.toString())||"0",10),r=parseInt(((X=U.shipping_days)==null?void 0:X.toString())||"0",10);break;case"images_count":T=parseInt(((Q=d.images_count)==null?void 0:Q.toString())||"0",10),r=parseInt(((Y=U.images_count)==null?void 0:Y.toString())||"0",10);break;case"views":T=parseInt(((ue=d.views)==null?void 0:ue.toString())||"0",10),r=parseInt(((re=U.views)==null?void 0:re.toString())||"0",10);break;case"monthly_views":T=parseInt(((ne=d.monthly_views)==null?void 0:ne.toString())||"0",10),r=parseInt(((de=U.monthly_views)==null?void 0:de.toString())||"0",10);break;case"num_favorers":T=parseInt(((D=d.num_favorers)==null?void 0:D.toString())||"0",10),r=parseInt(((f=U.num_favorers)==null?void 0:f.toString())||"0",10);break;default:return 0}let S=0;return T>r?S=1:T<r&&(S=-1),n==="desc"?S*-1:S}),F=x(()=>{var d;const s=p.listings??[];if(s.length===0)return[];const t=((d=p.listingsSearchItem)==null?void 0:d.toLowerCase())||"";let n=[...s];return t.trim()&&(n=n.filter(U=>U.title.toLowerCase().includes(t))),y.value&&(n=b(n,y.value,V.value)),n}),_=x(()=>F.value.length),z=x(()=>Math.ceil(_.value/E.value)),G=x(()=>{const s=(O.value-1)*E.value,t=s+E.value;return F.value.slice(s,t)}),M=s=>
1s&&s!==0?s.toLocaleString("en-US"):"N/A";return le([()=>p.listingsSearchItem,()=>E.value,()=>y.value,()=>V.value],()=>{O.value=1}),le(()=>p.listings,()=>{y.value=null,V.value="asc",O.value=1}),xt(async()=>{await p.getListings()}),(s,t)=>(a(),c(Z,null,[e("div",Ms,[i(we,null,{default:ce(()=>[...t[9]||(t[9]=[ge("Listings",-1)])]),_:1}),e("div",Is,[e("input",{id:"searchListing",type:"text",placeholder:"Search...",onInput:w,class:"block w-[250px] h-[50px] rounded-lg bg-white px-3 mb-3 mt-1.5 text-base text-mirage-950 outline-1 -outline-offset-1 outline-link-water-200 placeholder:text-gray-chateau-500 placeholder:text-base placeholder:font-light focus:outline-2 focus:-outline-offset-2 focus:outline-mariner-500 dark:bg-big-stone-950a autofill:shadow-[inset_0_0_0px_1000px_var(--color-white)]! dark:autofill:shadow-[inset_0_0_0px_1000px_var(--color-big-stone-950a)]! dark:text-link-water-200 dark:autofill:[-webkit-text-fill-color:var(--color-white)] dark:outline-pickled-bluewood-700 dark:focus:outline-pickled-bluewood-900"},null,32)])]),e("div",Ts,[e("div",Ps,[e("table",Ds,[e("thead",Fs,[e("tr",null,[t[17]||(t[17]=e("th",{class:"px-1 py-5 w-8"},null,-1)),e("th",As,[e("div",{class:"flex items-center gap-1 cursor-pointer ml-2",onClick:t[0]||(t[0]=n=>o(m)("title"))},[t[10]||(t[10]=e("span",{class:"font-medium text-sm"},"Product",-1)),e("div",Es,[i(te,{class:k(["h-2 w-2",o(g)("title","asc")])},null,8,["class"]),i(se,{class:k(["h-2 w-2",o(g)("title","desc")])},null,8,["class"])])])]),e("th",Rs,[e("div",{class:"flex items-center gap-1 cursor-pointer whitespace-nowrap",onClick:t[1]||(t[1]=n=>o(m)("price_in_dollars"))},[t[11]||(t[11]=e("span",{class:"font-medium text-sm"},"Price",-1)),e("div",Us,[i(te,{class:k(["h-2 w-2",o(g)("price_in_dollars","asc")])},null,8,["class"]),i(se,{class:k(["h-2 w-2",o(g)("price_in_dollars","desc")])},null,8,["class"])])])]),e("th",Os,[e("div",{class:"flex items-center gap-1 cursor-pointer whitespace-nowrap",onClick:t[2]||(t[2]=n=>o(m)("shipping_days"))},[t[12]||(t[12]=e("span",{class:"font-medium text-sm"},"Shipping",-1)),e("div",Vs,[i(te,{class:k(["h-2 w-2",o(g)("shipping_days","asc")])},null,8,["class"]),i(se,{class:k(["h-2 w-2",o(g)("shipping_days","desc")])},null,8,["class"])])])]),e("th",Ns,[e("div",{class:"flex items-center gap-1 cursor-pointer",onClick:t[3]||(t[3]=n=>o(m)("images_count"))},[t[13]||(t[13]=e("span",{class:"font-medium text-sm"},"Photos",-1)),e("div",Bs,[i(te,{class:k(["h-2 w-2",o(g)("images_count","asc")])},null,8,["class"]),i(se,{class:k(["h-2 w-2",o(g)("images_count","desc")])},null,8,["class"])])])]),e("th",js,[e("div",{class:"flex items-center gap-1 cursor-pointer",onClick:t[4]||(t[4]=n=>o(m)("views"))},[t[14]||(t[14]=e("span",{class:"font-medium text-sm"},"Views",-1)),e("div",zs,[i(te,{class:k(["h-2 w-2",o(g)("views","asc")])},null,8,["class"]),i(se,{class:k(["h-2 w-2",o(g)("views","desc")])},null,8,["class"])])])]),e("th",Ws,[e("div",{class:"flex items-center gap-1 cursor-pointer",onClick:t[5]||(t[5]=n=>o(m)("monthly_views"))},[t[15]||(t[15]=e("span",{class:"font-medium text-sm whitespace-nowrap"},"Monthly Views",-1)),e("div",Hs,[i(te,{class:k(["h-2 w-2",o(g)("monthly_views","asc")])},null,8,["class"]),i(se,{class:k(["h-2 w-2",o(g)("monthly_views","desc")])},null,8,["class"])])])]),e("th",Gs,[e("div",{class:"flex items-center gap-1 cursor-pointer",onClick:t[6]||(t[6]=n=>o(m)("num_favorers"))},[t[16]||(t[16]=e("span",{class:"font-medium text-sm"},"Likes",-1)),e("div",qs,[i(te,{class:k(["h-2 w-2",o(g)("num_favorers","asc")])},null,8,["class"]),i(se,{class:k(["h-2 w-2",o(g)("num_favorers","desc")])},null,8,["class"])])])]),t[18]||(t[18]=e("th",{class:"px-1 py-5 w-8"},null,-1))])]),o(p).isLoading?(a(),c("tbody",Ks,[e("tr",null,[e("td",Xs,[e("div",Zs,[i(ye,{classColor:"text-blue-ribbon-500 dark:text-dodger-blue-430 mr-2"}),t[19]||(t[19]=e("span",null,"Loading...",-1))])])])])):G.value.length>0?(a(),c("tbody",Ys,[(a(!0),c(Z,null,pe(G.value,n=>(a(),c("tr",{key:n.listing_id,class:"bg-tropical-blue-40 dark:bg-polo-blue-500b text-lynch-500 dark:text-white hover:bg-tropical-blue-200/30 dark:hover:bg-fiord-550/29 transition-colors min-h-16"},[e("td",Js,[e("div",Qs,[C.value.has(n.listing_id)?(a(),J(o(Pe),{key:0,class:"w-4 h-4 text-gray-chateau-500"})):(a(),J(o($e),{key:1,onClick:d=>L(n),class:"w-4 h-4 text-gray-chateau-500 cursor-pointer"},null,8,["onClick"]))])]),e("td",eo,[e("div",{class:"flex items-center gap-1 ml-2",title:n.title},[e("img",{src:n.image,alt:n.title,class:"shrink-0 rounded-full w-11.5 h-11.5 object-cover mr-2"},null,8,so),e("a",{href:n.url,target:"_blank",class:"block whitespace-nowrap text-blue-ribbon-500 dark:text-dodger-blue-430 text-sm",title:n.title},W(n.title),9,oo)],8,to)]),e("td",lo," $"+W(n.price_in_dollars),1),e("td",ao,W(n.shipping_days),1),e("td",ro,W(n.images_count),1),e("td",no,W(M(n.views)),1),e("td",io,W(M(n.monthly_views)),1),e("td",co,W(M(n.num_favorers)),1),e("td",uo,[e("div",po,[i(o(yt),{onClick:d=>l(n.listing_id),class:"w-4.5 h-4.5 text-blue-ribbon-500 dark:text-dodger-blue-430 cursor-pointer"},null,8,["onClick"])])])]))),128))])):(a(),c("tbody",go,[o(p).isLoading?K("",!0):(a(),c("tr",vo,[e("td",ho,[e("div",mo,[i(o(Te),{class:"h-12 w-12 text-gray-300"}),t[20]||(t[20]=ge(" No listings found. ",-1))])])]))]))])])]),o(p).isLoading?K("",!0):(a(),c("div",fo,[i(tt,{modelValue:E.value,"onUpdate:modelValue":t[7]||(t[7]=n=>E.value=n),class:"order-2 sm:order-1"},null,8,["modelValue"]),i(De,{"current-page":O.value,"onUpdate:currentPage":t[8]||(t[8]=n=>
1O.value=n),"total-pages":z.value,class:"order-1 sm:order-2 my-3"},null,8,["current-page","total-pages"])])),u.value?(a(),J(Ce,{key:1,"is-open":o(A).isOpen.value,title:"Like listing",onClose:o(A).closeDialog},{contentModal:ce(()=>[i(Fe,{onClose:o(A).closeDialog,categories:o(h).listingCategories,type:"listings",item:u.value},null,8,["onClose","categories","item"])]),_:1},8,["is-open","onClose"])):K("",!0)],64))}}),bo={class:"grid grid-cols-2 gap-4"},yo={class:"flex justify-end space-x-2"},wo={class:"rounded-lg overflow-hidden"},ko={class:"overflow-x-auto [&::-webkit-scrollbar-thumb]:bg-transparent! [&::-webkit-scrollbar-thumb]:transition-colors [&::-webkit-scrollbar-thumb]:duration-200 hover:[&::-webkit-scrollbar-thumb]:bg-tropical-blue-200! dark:hover:[&::-webkit-scrollbar-thumb]:bg-lynch-500!"},_o={class:"w-full text-left border-collapse table-fixed"},Co={class:"bg-tropical-blue-200/30 dark:bg-fiord-550/29 text-woodsmoke-900 dark:text-zumthor-100"},So={class:"px-2 py-5"},$o={class:"flex flex-col items-center"},Lo={class:"px-2 py-5"},Mo={class:"flex flex-col items-center"},Io={class:"px-2 py-5"},To={class:"flex flex-col items-center"},Po={key:0},Do={colspan:"3",class:"px-1 py-4 text-center text-lynch-500 dark:text-white"},Fo={class:"flex items-center justify-center px-4 py-2"},Ao={key:1,class:"text-sm"},Eo={class:"px-2 py-5.75"},Ro=["title"],Uo={class:"truncate max-sm:max-w-[80px] max-md:max-w-[150px] lg:max-w-[200px] xl:max-w-[350px] text-sm"},Oo={class:"text-sm text-gray-400 flex-shrink-0 ml-1"},Vo={class:"px-4 py-5.75 text-left whitespace-nowrap text-sm"},No={class:"px-2 py-5.75 text-left whitespace-nowrap text-sm"},Bo={key:2},jo={key:0},zo={colspan:"3",class:"bg-tropical-blue-200/15 dark:bg-polo-blue-500b px-2 py-4 text-center text-gray-500 dark:text-link-water-200"},Wo={class:"flex flex-col items-center justify-center gap-2"},Ho={key:0,class:"flex flex-col min-[640px]:flex-row min-[1024px]:flex-col min-[1400px]:flex-row items-end min-[640px]:items-center min-[1024px]:items-end min-[1400px]:items-center justify-end min-[640px]:justify-between min-[1024px]:justify-end min-[1400px]:justify-between mt-0 py-1 gap-1"},Go=ae({__name:"TagTable",setup($){const{isSupported:I,copyToClipboard:A}=et(),l=_e(),h=Se(),v=x(()=>h.getAllFavoriteKeywords()),C=x(()=>new Set(v.value.map(M=>{var s;return(s=M.keyword)==null?void 0:s.toLowerCase().trim()}))),u=j(null),L=xe(),p=j(1),O=j(5),E=M=>{u.value=M,l.openDialog()},w=M=>{const s=M.target;L.setTagsSearchItem(s.value)},{currentSortColumn:y,currentSortOrder:V,toggleSort:m,getSortIconClass:g}=Ae(()=>{p.value=1}),b=(M,s,t)=>[...M].sort((n,d)=>{var S,R,N,P,q,H;let U,T;switch(s){case"tag":U=((S=n.tag)==null?void 0:S.toLowerCase())||"",T=((R=d.tag)==null?void 0:R.toLowerCase())||"";break;case"count":U=parseFloat(((N=n.count)==null?void 0:N.toString())||"0"),T=parseFloat(((P=d.count)==null?void 0:P.toString())||"0");break;case"etsy_sv":U=parseFloat(((q=n.etsy_search_volume)==null?void 0:q.toString())||"0"),T=parseFloat(((H=d.etsy_search_volume)==null?void 0:H.toString())||"0");break;default:return 0}let r=0;return U>T?r=1:U<T&&(r=-1),t==="desc"?r*-1:r}),F=x(()=>{var n;const M=L.tags??[];if(M.length===0)return[];const s=((n=L.tagsSearchItem)==null?void 0:n.toLowerCase())||"";let t=[...M];return s.trim()&&(t=t.filter(d=>d.tag.toLowerCase().includes(s))),y.value&&(t=b(t,y.value,V.value)),t}),_=x(()=>F.value.length),z=x(()=>Math.ceil(_.value/O.value)),G=x(()=>{const M=(p.value-1)*O.value,s=M+O.value;return F.value.slice(M,s)});return le([()=>L.tagsSearchItem,()=>O.value,()=>y.value,()=>V.value],()=>{p.value=1}),le(()=>L.tags,()=>{y.value=null,V.value="asc",p.value=1}),(M,s)=>(a(),c(Z,null,[e("div",bo,[i(we,null,{default:ce(()=>[...s[5]||(s[5]=[ge("Tags",-1)])]),_:1}),e("div",yo,[e("input",{id:"searchListing",type:"text",placeholder:"Search...",onInput:w,class:"block w-[250px] h-[50px] rounded-lg bg-white px-3 mb-3 mt-1.5 text-base text-mirage-950 outline-1 -outline-offset-1 outline-link-water-200 placeholder:text-gray-chateau-500 placeholder:text-base placeholder:font-light focus:outline-2 focus:-outline-offset-2 focus:outline-mariner-500 dark:bg-big-stone-950a autofill:shadow-[inset_0_0_0px_1000px_theme(colors.white)]! dark:autofill:shadow-[inset_0_0_0px_1000px_theme(colors.big-stone.950a)]! dark:text-link-water-200 dark:autofill:[-webkit-text-fill-color:theme(colors.white)] dark:autifill:[-webkit-text-fill-color:theme(colors.link-water.200)] dark:outline-pickled-bluewood-700 dark:focus:outline-pickled-bluewood-900"}
1,null,32)])]),e("div",wo,[e("div",ko,[e("table",_o,[s[11]||(s[11]=e("colgroup",null,[e("col",{class:"w-auto"}),e("col",{class:"w-24"}),e("col",{class:"w-24"})],-1)),e("thead",Co,[e("tr",null,[e("th",So,[e("div",{class:"flex items-center gap-1 cursor-pointer",onClick:s[0]||(s[0]=t=>o(m)("tag"))},[s[6]||(s[6]=e("span",{class:"font-medium text-sm"},"Tag",-1)),e("div",$o,[i(te,{class:k(["h-2 w-2",o(g)("tag","asc")])},null,8,["class"]),i(se,{class:k(["h-2 w-2",o(g)("tag","desc")])},null,8,["class"])])])]),e("th",Lo,[e("div",{class:"flex items-center gap-1 cursor-pointer whitespace-nowrap",onClick:s[1]||(s[1]=t=>o(m)("count"))},[s[7]||(s[7]=e("span",{class:"font-medium text-sm"},"Count",-1)),e("div",Mo,[i(te,{class:k(["h-2 w-2",o(g)("count","asc")])},null,8,["class"]),i(se,{class:k(["h-2 w-2",o(g)("count","desc")])},null,8,["class"])])])]),e("th",Io,[e("div",{class:"flex items-center gap-1 cursor-pointer whitespace-nowrap",onClick:s[2]||(s[2]=t=>o(m)("etsy_sv"))},[s[8]||(s[8]=e("span",{class:"font-medium text-sm"},"Etsy SV",-1)),e("div",To,[i(te,{class:k(["h-2 w-2",o(g)("etsy_sv","asc")])},null,8,["class"]),i(se,{class:k(["h-2 w-2",o(g)("etsy_sv","desc")])},null,8,["class"])])])])])]),o(L).isLoading?(a(),c("tbody",Po,[e("tr",null,[e("td",Do,[e("div",Fo,[i(ye,{classColor:"text-blue-ribbon-500 dark:text-dodger-blue-430 mr-2"}),s[9]||(s[9]=e("span",null,"Loading...",-1))])])])])):G.value.length>0?(a(),c("tbody",Ao,[(a(!0),c(Z,null,pe(G.value,t=>(a(),c("tr",{key:t.tag,class:"bg-tropical-blue-40 dark:bg-polo-blue-500b text-lynch-500 dark:text-white hover:bg-tropical-blue-200/30 dark:hover:bg-fiord-550/29 transition-colors"},[e("td",Eo,[e("div",{class:"flex items-center gap-1 ml-2 mt-1",title:t.tag},[e("span",Uo,W(t.tag),1),e("sup",Oo,W(t.tag.length),1),C.value.has(t.tag.toLowerCase().trim())?(a(),J(o(Pe),{key:0,class:"w-4 h-4 text-gray-chateau-500"})):(a(),J(o($e),{key:1,onClick:n=>E(t),class:"w-4 h-4 text-gray-chateau-500 cursor-pointer"},null,8,["onClick"])),o(I)?(a(),J(o(Je),{key:2,onClick:n=>o(A)(t.tag),class:"w-4 h-4 text-gray-chateau-500 cursor-pointer hover:text-mariner-500 dark:hover:text-dodger-blue-400 transition-colors",title:`Copy ${t.tag} to clipboard`},null,8,["onClick","title"])):K("",!0)],8,Ro)]),e("td",Vo,W(t.count.toLocaleString("en-US")),1),e("td",No,W(t.etsy_search_volume.toLocaleString("en-US")),1)]))),128))])):(a(),c("tbody",Bo,[o(L).isLoading?K("",!0):(a(),c("tr",jo,[e("td",zo,[e("div",Wo,[i(o(Te),{class:"h-12 w-12 text-gray-300"}),s[10]||(s[10]=ge(" No listings found. ",-1))])])]))]))])])]),o(L).isLoading?K("",!0):(a(),c("div",Ho,[i(tt,{modelValue:O.value,"onUpdate:modelValue":s[3]||(s[3]=t=>O.value=t),class:"order-2 min-[640px]:order-1 min-[1024px]:order-2 min-[1400px]:order-1"},null,8,["modelValue"]),i(De,{"current-page":p.value,"onUpdate:currentPage":s[4]||(s[4]=t=>p.value=t),"total-pages":z.value,"max-visible-pages":3,class:"order-1 min-[640px]:order-2 min-[1024px]:order-1 min-[1400px]:order-2 my-3"},null,8,["current-page","total-pages"])])),u.value?(a(),J(Ce,{key:1,"is-open":o(l).isOpen.value,title:"Like keyword",onClose:o(l).closeDialog},{contentModal:ce(()=>[i(Fe,{onClose:o(l).closeDialog,categories:o(h).keywordCategories,type:"tags",item:u.value},null,8,["onClose","categories","item"])]),_:1},8,["is-open","onClose"])):K("",!0)],64))}}),qo={class:"flex flex-col lg:flex-row gap-4 mt-10"},Ko={class:"lg:w-8/12 lg:min-w-0"},Xo={class:"lg:w-4/12 lg:min-w-0"},Zo=ae({__name:"ListingsAndTags",setup($){return(I,A)=>(a(),c("div",qo,[e("div",Ko,[i(xo)]),e("div",Xo,[i(Go)])]))}}),Yo={class:"relative w-full select-none"},Jo={key:0,class:"flex justify-end items-center mb-3 space-x-2"},Qo={class:"flex space-x-1"},el=["disabled"],tl=["disabled"],sl={class:"relative"},ol={key:1,class:"text-xs text-gray-500 mt-1 text-center"},ll=ae({__name:"BarChar",props:{series:{type:Array,required:!0,default:()=>[]},categories:{type:Array,required:!0,default:()=>[]},title:{type:String,default:"Bar Chart"},height:{type:Number,default:300},barColor:{type:String,default:"#3658FA"},formatPrice:{type:Function,default:$=>$},enableZoom:{type:Boolean,default:!0},enablePan:{type:Boolean,default:!0},showControls:{type:Boolean,default:!0}},setup($,{expose:I}){const{isDark:A}=Ee(),l=$,h=j(null);let v=null;const C=j(!1),u=j(1),L=j(0),p=j(!1),O=j(0),E=j(0),w=x(()=>l.series&&l.categories&&l.series.length>0&&l.categories.length>0&&l.series.every(r=>r&&r.data&&Array.isArray(r.data))),y=x(()=>
1{if(!w.value)return{labels:[],datasets:[]};if(u.value<=1)return{labels:l.categories||[],datasets:(l.series||[]).map((r,S)=>({label:(r==null?void 0:r.name)||`Series ${S+1}`,data:(r==null?void 0:r.data)||[],backgroundColor:l.barColor,borderColor:l.barColor,borderWidth:0,borderRadius:4,borderSkipped:!1,barPercentage:.6,categoryPercentage:.8,backgroundColorHover:l.barColor}))};{const r=l.categories.length,S=Math.max(3,Math.round(r/u.value)),R=Math.max(0,r-S),N=Math.max(0,Math.min(R,L.value)),P=Math.min(r,N+S);return{labels:l.categories.slice(N,P),datasets:(l.series||[]).map((H,X)=>{const Q=((H==null?void 0:H.data)||[]).slice(N,P);return{label:(H==null?void 0:H.name)||`Series ${X+1}`,data:Q,backgroundColor:l.barColor,borderColor:l.barColor,borderWidth:0,borderRadius:4,borderSkipped:!1,barPercentage:.6,categoryPercentage:.8,backgroundColorHover:l.barColor}})}}}),V=x(()=>({type:"bar",data:y.value,options:{responsive:!0,maintainAspectRatio:!1,interaction:{mode:"index",intersect:!1},plugins:{legend:{display:!1},tooltip:{enabled:!0,backgroundColor:A.value?"#1C293D":"#f1f5f9",titleColor:A.value?"#f5f7f9":"#0f172b",bodyColor:A.value?"#f5f7f9":"#0f172b",borderColor:A.value?"#304258":"#cad5e2",borderWidth:1,cornerRadius:6,displayColors:!1,callbacks:{title:function(r){var S,R;if(r&&r.length>0){const N=r[0].dataIndex;if(u.value>1){const P=l.categories.length,q=Math.max(3,Math.round(P/u.value)),H=Math.max(0,P-q),Q=Math.max(0,Math.min(H,L.value))+N,Y=(S=l.categories)==null?void 0:S[Q];return l.formatPrice&&Y?l.formatPrice(Y):Y||""}else{const P=(R=l.categories)==null?void 0:R[N];return l.formatPrice&&P?l.formatPrice(P):P||""}}return""},label:function(r){return`${r.dataset.label}: ${r.parsed.y}`}}},datalabels:{display:!0,anchor:"end",align:"top",offset:1,color:A.value?"#e2e8f0":"#314158",font:{size:12,weight:"normal"},formatter:function(r){return r.toString()}}},scales:{y:{beginAtZero:!0,grace:"10%",border:{display:!1},grid:{color:A.value?"#304258":"#cad5e2",drawBorder:!1},ticks:{display:!0,color:A.value?"#cad5e2":"#787d8a",font:{size:12},callback:function(r){return parseInt(r.toString())}}},x:{border:{display:!1},grid:{display:!1,drawBorder:!1},ticks:{color:A.value?"#cad5e2":"#787d8a",font:{size:12},callback:function(r,S){var R,N;if(u.value>1){const P=l.categories.length,q=Math.max(3,Math.round(P/u.value)),H=Math.max(0,P-q),Q=Math.max(0,Math.min(H,L.value))+S,Y=(R=l.categories)==null?void 0:R[Q];return l.formatPrice&&Y?l.formatPrice(Y):Y||""}else{const P=(N=l.categories)==null?void 0:N[S];return l.formatPrice&&P?l.formatPrice(P):P||""}},maxRotation:45,minRotation:0}}},animation:{duration:p.value?0:1e3,easing:"easeInOutQuart"},elements:{bar:{borderSkipped:!1}}}})),m=()=>{v&&(v.destroy(),v=null)},g=async()=>{if(await ke(),!h.value){console.warn("Canvas ref not available");return}m();try{const r=h.value.getContext("2d");if(!r){console.error("Could not get 2d context");return}v=new st(r,V.value)}catch(r){console.error("Error creating chart:",r)}},b=()=>{v?(v.data=V.value.data,v.options=V.value.options,v.update(p.value?"none":"resize")):g()},F=r=>{!l.enablePan||u.value<=1||(p.value=!0,O.value=r.clientX,E.value=L.value,r.preventDefault())},_=r=>{if(!p.value||!l.enablePan||u.value<=1)return;const S=r.clientX-O.value,R=.5,N=l.categories.length,P=Math.max(3,Math.round(N/u.value)),q=Math.max(0,N-P),H=Math.round(-S*R/10),X=Math.max(0,Math.min(q,E.value+H));X!==L.value&&(L.value=X,b())},z=()=>{p.value=!1},G=()=>{u.value=1,L.value=0,b()},M=()=>{const r=u.value;if(u.value=Math.min(u.value*1.5,10),r===1&&u.value>1){const S=l.categories.length,R=Math.max(3,Math.round(S/u.value));L.value=Math.max(0,Math.floor((S-R)/2))}else{const S=l.categories.length,R=Math.max(3,Math.round(S/u.value)),N=Math.max(0,S-R);L.value=Math.min(L.value,N)}b()},s=()=>
1{if(u.value=Math.max(u.value/1.5,1),u.value<=1)u.value=1,L.value=0;else{const r=l.categories.length,S=Math.max(3,Math.round(r/u.value)),R=Math.max(0,r-S);L.value=Math.min(L.value,R)}b()},t=()=>{if(v){const S=v.canvas.toDataURL("image/png");d(S,`${l.title||"chart"}.png`)}C.value=!1},n=()=>{if(!w.value)return;let r=`Price,Listing
2`;l.categories.forEach((N,P)=>{l.series.forEach(q=>{q.data[P]!==void 0&&(r+=`"${N}","${q.data[P]}"
3`)})});const S=new Blob([r],{type:"text/csv;charset=utf-8;"}),R=URL.createObjectURL(S);d(R,`${l.title||"chart"}.csv`),URL.revokeObjectURL(R),C.value=!1},d=(r,S)=>{const R=document.createElement("a");R.download=S,R.href=r,R.style.display="none",document.body.appendChild(R),R.click(),document.body.removeChild(R)},U=r=>{r.stopPropagation(),C.value=!C.value},T=r=>{r.target.closest(".relative")||(C.value=!1)};return le([()=>l.categories,()=>l.series,()=>A],()=>{u.value=1,L.value=0,b()},{deep:!0}),le([u,L],()=>{b()},{deep:!0}),Le(()=>{setTimeout(()=>{g()},100),document.addEventListener("click",T),document.addEventListener("mouseup",z),document.addEventListener("mousemove",_)}),Me(()=>{m(),document.removeEventListener("click",T),document.removeEventListener("mouseup",z),document.removeEventListener("mousemove",_)}),I({resetZoom:G,zoomIn:M,zoomOut:s,downloadPNG:t,downloadCSV:n}),(r,S)=>(a(),c("div",Yo,[$.showControls?(a(),c("div",Jo,[e("div",Qo,[e("button",{onClick:M,disabled:u.value>=10,class:"px-0 py-1 rounded text-xs transition-colors disabled:opacity-50",title:"Zoom In"},[i(o(wt),{class:"inline-block w-6 h-6 cursor-pointer text-blue-ribbon-500 hover:text-blue-ribbon-500/70 dark:text-dodger-blue-430 dark:hover:text-dodger-blue-430/80"})],8,el),e("button",{onClick:s,disabled:u.value<=1,class:"px-0 py-1 rounded text-xs transition-colors disabled:opacity-50",title:"Zoom Out"},[i(o(kt),{class:"inline-block w-6 h-6 cursor-pointer text-blue-ribbon-500 hover:text-blue-ribbon-500/70 dark:text-dodger-blue-430 dark:hover:text-dodger-blue-430/80"})],8,tl),e("button",{onClick:G,class:"px-2 py-1 text-xs transition-colors",title:"Reset Zoom"},[i(o(_t),{class:"inline-block w-6 h-6 cursor-pointer text-blue-ribbon-500 hover:text-blue-ribbon-500/70 dark:text-dodger-blue-430 dark:hover:text-dodger-blue-430/80"})])]),e("div",sl,[e("button",{onClick:U,class:"px-2 py-1 cursor-pointer bg-blue-ribbon-500 dark:bg-dodger-blue-430 text-white rounded text-xs hover:opacity-90 transition-opacity shadow-sm flex items-center space-x-1",title:"Export Chart"},[S[1]||(S[1]=e("span",null,"Export",-1)),i(o(Ct),{class:"w-4 h-4"})]),C.value?(a(),c("div",{key:0,class:"absolute right-0 top-full mt-1 bg-white dark:bg-big-stone-950a dark:border-none rounded-md shadow-lg border border-gray-200 min-w-[120px] z-50",onClick:S[0]||(S[0]=St(()=>{},["stop"]))},[e("button",{onClick:t,class:"block cursor-pointer w-full text-left px-3 py-2 text-xs text-gray-700 dark:text-white hover:bg-gray-100 dark:hover:bg-pickled-bluewood-800a rounded-t-md"}," PNG "),e("button",{onClick:n,class:"block cursor-pointer w-full text-left px-3 py-2 text-xs text-gray-700 dark:text-white hover:bg-gray-100 dark:hover:bg-pickled-bluewood-800a rounded-b-md"}," CSV ")])):K("",!0)])])):K("",!0),e("div",{class:k(["relative w-full",[{"cursor-grab":!p.value&&l.enablePan&&u.value>1,"cursor-grabbing":p.value}]]),style:me({height:`${$.height}px`}),onMousedown:F,onMousemove:_,onMouseup:z,onMouseleave:z},[e("canvas",{ref_key:"canvasRef",ref:h,class:"max-w-full h-auto sm:max-sm:h-[240px]"},null,512)],38),l.enablePan&&u.value>1?(a(),c("div",ol," Click and drag to pan horizontally ")):K("",!0)]))}}),al=Mt(ll,[["__scopeId","data-v-d4409777"]]),rl={class:"mt-10"},nl={class:"flex flex-col lg:flex-row gap-5"},il={class:"lg:w-3/12 space-y-5"},cl={class:"lg:w-9/12 bg-tropical-blue-200/15 dark:bg-polo-blue-500b rounded-lg p-3"},ul=ae({__name:"PriceSpread",setup($){const{presets:I}=ot();I.bar();const{isDark:A}=Ee(),l=xe(),h=x(()=>l.getPricesWithCountArray().map(p=>p.price.toString())),v=x(()=>l.getPricesWithCountArray().map(p=>p.count)),C=x(()=>({priceSpread:{series:[{name:"Listings",data:v.value}],categories:h.value}})),u=p=>
3parseFloat(p).toLocaleString("en-US",{style:"currency",currency:"USD"}),L=x(()=>[{key:"minPrice",title:"Min. Price",popoverText:"The minimum pricing statistics",value:l.getMinPrice().toLocaleString("en-US",{style:"currency",currency:"USD"})},{key:"manPrice",title:"Max. Price",popoverText:"The maximum pricing statistics",value:l.getMaxPrice().toLocaleString("en-US",{style:"currency",currency:"USD"})},{key:"averagePrice",title:"Avg. Price",popoverText:"The average pricing statistics",value:l.getAveragePrice().toLocaleString("en-US",{style:"currency",currency:"USD"})}]);return(p,O)=>(a(),c("div",rl,[i(we,null,{default:ce(()=>[...O[0]||(O[0]=[ge("Price Spread",-1)])]),_:1}),e("div",nl,[e("div",il,[(a(!0),c(Z,null,pe(L.value,E=>(a(),c("div",{key:E.key,class:"relative"},[i(Re,{title:E.title,value:E.value,popoverText:E.popoverText},null,8,["title","value","popoverText"])]))),128))]),e("div",cl,[i(al,{class:"mt-5",series:C.value.priceSpread.series,categories:C.value.priceSpread.categories,title:"Price spreed",height:250,"show-controls":!0,"bar-color":o(A)?"#38A2FF":"#4848fe","format-price":u,"enable-zoom":!0,"enable-pan":!0},null,8,["series","categories","bar-color"])])])]))}}),dl={class:"w-full @container"},pl={key:0,class:"text-base font-semibold text-left ml-5 mb-5 text-lynch-500 dark:text-polo-blue-500a"},gl=["onClick"],vl={key:1,class:"absolute inset-0 flex flex-col items-center justify-center pointer-events-none"},hl={class:"text-center px-4"},ml={key:0,class:"text-2xl font-bold text-gray-800 dark:text-gray-100"},fl={key:1,class:"text-sm text-gray-600 dark:text-gray-300 mt-1 line-clamp-2"},xl=["onClick"],Ke=12,bl=10,Xe=ae({__name:"PieChart",props:{series:{type:Array,required:!0},labels:{type:Array,required:!0},colors:{type:Array,required:!0},title:{type:String,default:""},height:{type:Number,default:300},legendPosition:{type:String,default:"left"},maxLegendHeight:{type:Number,default:200},animated:{type:Boolean,default:!1},showLegend:{type:Boolean,default:!0},insliceLabelThreshold:{type:Number,default:.05},cutout:{type:[String,Number],default:"60%"},centerFallbackText:{type:String,default:""},centerFallbackSubText:{type:String,default:""},scaleMode:{type:String,default:"linear"},showOuterLabels:{type:Boolean,default:!1}},setup($){const I={id:"sliceShadow",afterDatasetDraw(s){const{ctx:t}=s,n=s.getDatasetMeta(0),d=new Set;s.getActiveElements().forEach(U=>d.add(U.index)),u.value!==null&&d.add(u.value),d.size&&d.forEach(U=>{const T=n.data[U];T&&(t.save(),t.shadowColor="rgba(0, 0, 0, 0.45)",t.shadowBlur=18,t.shadowOffsetX=0,t.shadowOffsetY=6,T.draw(t),t.restore())})}},A={id:"outerLabels",afterDatasetDraw(s){if(u.value===null)return;const{ctx:t,data:n}=s,d=s.getDatasetMeta(0),U=u.value,T=d.data[U];if(!T)return;const r=n.datasets[0].backgroundColor,S=18,R=14,N=(T.startAngle+T.endAngle)/2,P=T.x,q=T.y,H=T.outerRadius,X=Math.cos(N)>=0,Q=P+Math.cos(N)*H,Y=q+Math.sin(N)*H,ue=P+Math.cos(N)*(H+S),re=q+Math.sin(N)*(H+S),ne=ue+(X?R:-R),de=r[U]||"#666";t.save(),t.strokeStyle=de,t.lineWidth=1.5,t.lineJoin="round",t.beginPath(),t.moveTo(Q,Y),t.lineTo(ue,re),t.lineTo(ne,re),t.stroke(),t.fillStyle=de,t.beginPath(),t.arc(ne,re,2.5,0,Math.PI*2),t.fill(),t.restore()}},{isDark:l}=Ee(),h=$,v=j(null),C=j(new Set),u=j(null),L=j(null);let p=null;const O=x(()=>{const s=[];return h.legendPosition==="left"||h.legendPosition==="right"?s.push("w-full @min-[540px]:w-[200px] @min-[540px]:max-w-[200px]"):s.push("w-full"),s}),E=s=>h.scaleMode==="sqrt"?Math.sqrt(s):h.scaleMode==="log"?Math.log(s+1):s,w=x(()=>h.series.map((s,t)=>C.value.has(t)?0:E(s))),y=x(()=>{var de;if(!h.showOuterLabels||u.value===null||!p)return null;const s=u.value,n=p.getDatasetMeta(0).data[s];if(!n)return null;const d=18,U=14,T=5,r=4,S=7,R=16,N=(n.startAngle+n.endAngle)/2,P=Math.cos(N)>=0,q=n.x+Math.cos(N)*(n.outerRadius+d),H=n.y+Math.sin(N)*(n.outerRadius+d),X=q+(P?U:-U),Q=((de=p.data.labels)==null?void 0:de[s])??"",Y=p.width,ue=Q.length*S+R;let re=null,ne=null;return P?X+T+ue>Y-r?ne=r:re=X+T:X-T-ue<r?re=r:ne=Y-X+T,{leftPx:re,rightPx:ne,yPercent:H/p.height*100,color:p.data.datasets[0].backgroundColor[s]??"#666",label:Q}}),V=x(()=>u.value!==null?u.value:L.value),m=x(()=>{const s=V.value;if(s===null)return{text:h.centerFallbackText,subText:h.centerFallbackSubText};const t=h.series[s]??0,n=h.series.reduce((U,T)=>U+(T??0),0);
3return{text:n===0?"0%":(t/n).toLocaleString("en-US",{style:"percent",minimumFractionDigits:0,maximumFractionDigits:1}),subText:h.labels[s]??""}}),g=(s,t)=>{if(s.startsWith("rgba("))return s.replace(/rgba\(([^,]+),([^,]+),([^,]+),[^)]+\)/,`rgba($1,$2,$3,${t})`);if(s.startsWith("rgb("))return s.replace("rgb(","rgba(").replace(")",`, ${t})`);if(s.startsWith("#")&&s.length===7){const n=parseInt(s.slice(1,3),16),d=parseInt(s.slice(3,5),16),U=parseInt(s.slice(5,7),16);return`rgba(${n}, ${d}, ${U}, ${t})`}return s},b=x(()=>h.colors.map((s,t)=>C.value.has(t)?"rgba(0,0,0,0.1)":u.value!==null&&u.value!==t?g(s,.1):s)),F=x(()=>({type:"pie",data:{labels:h.labels,datasets:[{data:w.value,backgroundColor:b.value,borderWidth:1,borderColor:l.value?"#10162B":"#FFFFFF",hoverOffset:Ke,spacing:0,borderRadius:0}]},options:{responsive:!0,maintainAspectRatio:!1,cutout:h.cutout,onClick:(s,t)=>{if(t.length===0){u.value=null;return}const n=t[0].index;u.value=u.value===n?null:n},onHover:(s,t,n)=>{if(t.length>0){const d=t[0].index;L.value!==d&&(L.value=d)}else L.value!==null&&(L.value=null);n.canvas&&(n.canvas.style.cursor=t.length>0?"pointer":"default")},layout:{padding:bl+Ke},animation:{duration:h.animated?1500:250,easing:"easeOutCubic",animateRotate:h.animated,animateScale:h.animated},interaction:{intersect:!0,mode:"point"},plugins:{legend:{display:!1},tooltip:{backgroundColor:l.value?"#а304258":"#f1f5f9",titleColor:l.value?"#f5f7f9":"#0f172b",bodyColor:l.value?"#f5f7f9":"#0f172b",borderColor:l.value?"#304258":"#cad5e2",borderWidth:1,cornerRadius:6,displayColors:!1,filter:function(s){return!C.value.has(s.dataIndex)},callbacks:{title:function(){return""},label:function(s){if(C.value.has(s.dataIndex))return;const t=s.label||"",n=h.series[s.dataIndex],d=h.series.filter((T,r)=>!C.value.has(r)).reduce((T,r)=>T+r,0);if(d===0)return[t,"0%"];const U=(n/d).toLocaleString("en-US",{style:"percent",minimumFractionDigits:2,maximumFractionDigits:2});return[t,`${n} (${U})`]}}},datalabels:{display:!1}}}})),_=s=>{C.value.has(s)?C.value.delete(s):(C.value.add(s),u.value===s&&(u.value=null)),M()},z=()=>{p&&(p.destroy(),p=null)},G=async()=>{if(await ke(),!v.value){console.warn("Canvas ref not available");return}z();try{const s=v.value.getContext("2d");if(!s){console.error("Could not get 2d context");return}const t=[I,...h.showOuterLabels?[A]:[]];p=new st(s,{...F.value,plugins:t})}catch(s){console.error("Error creating chart:",s)}},M=()=>{if(p){p.data=F.value.data;const s=F.value.options;s&&(p.options=s),p.update()}else G()};return le([()=>h.series,()=>h.labels],()=>{C.value.clear(),u.value=null,L.value=null,M()},{deep:!0}),le(()=>l.value,()=>{M()}),le(u,()=>{M()}),Le(()=>{setTimeout(()=>{G()},100)}),Me(()=>{z()}),(s,t)=>(a(),c("div",dl,[$.title?(a(),c("div",pl,W($.title),1)):K("",!0),e("div",{class:k(["flex flex-col gap-5",{"@min-[540px]:flex-row @min-[540px]:items-start":$.legendPosition==="left"||$.legendPosition==="right"}])},[$.showLegend&&($.legendPosition==="left"||$.legendPosition==="top")?(a(),c("div",{key:0,class:k(["flex-shrink-0",O.value])},[e("div",{class:"overflow-y-auto pl-2 pr-2 [&::-webkit-scrollbar]:w-1.5 [&::-webkit-scrollbar-track]:bg-transparent [&::-webkit-scrollbar-thumb]:bg-gray-800/30 [&::-webkit-scrollbar-thumb]:rounded-sm hover:[&::-webkit-scrollbar-thumb]:bg-gray-800/50 dark:[&::-webkit-scrollbar-track]:bg-pickled-bluewood-950 dark:[&::-webkit-scrollbar-thumb]:bg-pickled-bluewood-600/60 dark:hover:[&::-webkit-scrollbar-thumb]:bg-pickled-bluewood-600/80",style:me({maxHeight:$.maxLegendHeight+"px"})},[(a(!0),c(Z,null,pe($.labels,(n,d)=>(a(),c("div",{key:d,class:k(["flex items-center gap-2 px-2 py-1.5 mb-1 cursor-pointer rounded transition-all duration-200 select-none hover:bg-black/5 dark:hover:bg-white/5",{"opacity-40":C.value.has(d)}]),onClick:U=>_(d)},[e("div",{class:"w-3 h-3 rounded-lg shrink-0",style:me({backgroundColor:$.colors[d]})},null,4),e("span",{class:k(["flex-1 text-sm text-gray-700 dark:text-gray-300 leading-tight",{"line-through":C.value.has(d)}])},W(n),3)],10,gl))),128))],4)],2)):K("",!0),e("div",{class:"relative flex-1 min-w-0",style:me({height:$.height+"px"})},[e("canvas",{class:"max-w-full !h-auto",ref_key:"canvasRef",ref:v},null,512),$.showOuterLabels&&y.value?(a(),c("div",{key:0,class:"absolute pointer-events-none",style:me({left:y.value.leftPx!==null?y.value.leftPx+"px":"auto",right:y.value.rightPx!==null?y.value.rightPx+"px":"auto",top:y.value.yPercent+"%",transform:"translateY(-50%)"})},[e("span",{class:"whitespace-nowrap text-[11px] font-bold rounded-md px-2 py-0.5 block",style:me({color:o(l)?"#ffffff"
3:"#1a1a1a",backgroundColor:o(l)?"#293550":"#F6FAFE",border:`1px solid ${y.value.color}`})},W(y.value.label),5)],4)):K("",!0),$.cutout!==0&&$.cutout!=="0"&&$.cutout!=="0%"&&(m.value.text||m.value.subText)?(a(),c("div",vl,[e("div",hl,[m.value.text?(a(),c("div",ml,W(m.value.text),1)):K("",!0),m.value.subText?(a(),c("div",fl,W(m.value.subText),1)):K("",!0)])])):K("",!0)],4),$.showLegend&&($.legendPosition==="right"||$.legendPosition==="bottom")?(a(),c("div",{key:1,class:k(["flex-shrink-0",[O.value,{"order-first @min-[540px]:order-none":$.legendPosition==="right"}]])},[e("div",{class:"overflow-y-auto pr-2 [&::-webkit-scrollbar]:w-1.5 [&::-webkit-scrollbar-track]:bg-transparent [&::-webkit-scrollbar-thumb]:bg-gray-800/30 [&::-webkit-scrollbar-thumb]:rounded-sm hover:[&::-webkit-scrollbar-thumb]:bg-gray-800/50 dark:[&::-webkit-scrollbar-track]:bg-pickled-bluewood-950 dark:[&::-webkit-scrollbar-thumb]:bg-pickled-bluewood-600/60 dark:hover:[&::-webkit-scrollbar-thumb]:bg-pickled-bluewood-600/80",style:me({maxHeight:$.maxLegendHeight+"px"})},[(a(!0),c(Z,null,pe($.labels,(n,d)=>(a(),c("div",{key:d,class:k(["flex items-center gap-2 px-2 py-1.5 mb-1 cursor-pointer rounded transition-all duration-200 select-none hover:bg-black/5 dark:hover:bg-white/5",{"opacity-40":C.value.has(d)}]),onClick:U=>_(d)},[e("div",{class:"w-3 h-3 rounded-lg shrink-0",style:me({backgroundColor:$.colors[d]})},null,4),e("span",{class:k(["flex-1 text-sm text-gray-700 dark:text-gray-300 leading-tight",{"line-through":C.value.has(d)}])},W(n),3)],10,xl))),128))],4)],2)):K("",!0)],2)]))}}),yl={class:"mt-10"},wl={class:"flex flex-col lg:flex-row gap-6"},kl={class:"flex flex-col 2xl:flex-row gap-6"},_l={class:"flex-1 bg-tropical-blue-200/15 dark:bg-polo-blue-500b rounded-lg pt-5"},Cl={key:0,class:"flex-1 bg-tropical-blue-200/15 dark:bg-polo-blue-500b rounded-lg pt-5"},Sl=ae({__name:"ShippingStatistics",setup($){const I=xe(),{presets:A}=ot();A.pie();const l=x(()=>I.searchResult.shippingInfo),h=x(()=>!!I.searchResult.listings.length&&!!l.value.max_shipping_days),v=x(()=>!!I.searchResult.listings.length&&!!l.value.max_shipping_price),C=w=>{const y=["#8C3AD3","#4848FE","#FFBC13","#38A2FF"],V=_=>{const z=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(_);return z?{r:parseInt(z[1],16),g:parseInt(z[2],16),b:parseInt(z[3],16)}:{r:0,g:0,b:0}},m=(_,z,G,M)=>({r:Math.max(0,Math.min(255,Math.round(_*M))),g:Math.max(0,Math.min(255,Math.round(z*M))),b:Math.max(0,Math.min(255,Math.round(G*M)))}),g=[1,.82,.65,.5,.38],b=[];g.forEach(_=>{y.forEach(z=>{const G=V(z),M=m(G.r,G.g,G.b,_);b.push(`rgb(${M.r}, ${M.g}, ${M.b})`)})});const F=[];for(let _=0;_<w;_++)F.push(b[_%b.length]);return F},u=()=>{const w={series:[0],labels:["Not declared"],colors:[]},y=Math.ceil(l.value.max_shipping_days/10)+1,V=C(y);w.colors=[V[0]];for(let g=0;g<l.value.max_shipping_days;g+=10)w.labels.push(`${g} - ${g+10} days`),w.colors.push(V[Math.floor(g/10)+1]),w.series.push(0);I.searchResult.listings.forEach(g=>{if(g.shipping_median!==null){for(let b=10,F=1;b<l.value.max_shipping_days+10;b+=10,F++)if(g.shipping_median<b){w.series[F]++;break}}else w.series[0]++});const m={series:[],labels:[],colors:[]};return w.series.forEach((g,b)=>{g>0&&(m.series.push(g),m.labels.push(w.labels[b]),m.colors.push(w.colors[b]))}),m},L=x(()=>!I.searchResult.listings.length||!l.value.max_shipping_days?{series:[0],labels:["Not declared"],colors:["#556ee6"]}:u()),p=()=>{const w={series:[0],labels:["Free"],colors:[]},y=Math.ceil(l.value.max_shipping_price/10)+1,V=C(y);w.colors=[V[0]];for(let g=0;g<l.value.max_shipping_price;g+=10)w.labels.push(`${g.toLocaleString("en-US",{style:"currency",currency:"USD"})} - ${(g+10).toLocaleString("en-US",{style:"currency",currency:"USD"})}`),w.colors.push(V[Math.floor(g/10)+1]),w.series.push(0);I.searchResult.listings.forEach(g=>{g.shipping_prices_array.forEach(b=>{for(let F=10,_=1;F<l.value.max_shipping_price+10;F+=10,_++)if(b===0){w.series[0]++;break}else if(b<F){w.series[_]++;break}})});const m={series:[],labels:[],colors:[]};return w.series.forEach((g,b)=>{g>0&&(m.series.push(g),m.labels.push(w.labels[b]),m.colors.push(w.colors[b]))}),m},O=x(()=>!I.searchResult.listings.length||!l.value.max_shipping_price?{series:[0],labels:["Free"],colors:["#34c38f"]}:p()),E=x(()=>[{key:"shippingDaysMin",title:"Shipping Days Min.",popoverText:"Statistics for the minimum shipping days",value:l.value.min_shipping_days,visible:h.value},{key:"shippingCostMin",title:"Shipping Cost Min.",popoverText:"Statistics for the minimum shipping cost",value:(l.value.min_shipping_price??0).toLocaleStr
3ing("en-US",{style:"currency",currency:"USD"}),visible:v.value},{key:"shippingDaysMax",title:"Shipping Days Max.",popoverText:"Statistics for the maximum shipping days",value:l.value.max_shipping_days,visible:h.value},{key:"shippingCostMax",title:"Shipping Cost Max.",popoverText:"Statistics for the maximum shipping cost",value:(l.value.max_shipping_price??0).toLocaleString("en-US",{style:"currency",currency:"USD"}),visible:v.value},{key:"shippingDaysAvg",title:"Shipping Days Avg.",popoverText:"Statistics for the average shipping days",value:l.value.avg_shipping_days,visible:h.value},{key:"shippingCostAvg",title:"Shipping Cost Avg.",popoverText:"Statistics for the average shipping cost",value:(l.value.avg_shipping_price??0).toLocaleString("en-US",{style:"currency",currency:"USD"}),visible:v.value}].filter(w=>w.visible));return(w,y)=>(a(),c("div",yl,[i(we,null,{default:ce(()=>[...y[0]||(y[0]=[ge("Shipping",-1)])]),_:1}),e("div",wl,[e("div",{class:k(v.value?"lg:w-9/12":"lg:w-1/2")},[e("div",kl,[e("div",_l,[i(Xe,{key:"shipping-chart-1",series:L.value.series,labels:L.value.labels,colors:L.value.colors,title:"Shipping Days",height:300,"legend-position":"left","max-legend-height":300,"scale-mode":"sqrt",cutout:0,"show-outer-labels":""},null,8,["series","labels","colors"])]),v.value?(a(),c("div",Cl,[i(Xe,{key:"price-chart-2",series:O.value.series,labels:O.value.labels,colors:O.value.colors,title:"Shipping Cost",height:300,"legend-position":"right","max-legend-height":300,"scale-mode":"sqrt",cutout:0,"show-outer-labels":""},null,8,["series","labels","colors"])])):K("",!0)])],2),e("div",{class:k(["space-y-5",v.value?"lg:w-3/12":"lg:w-1/2"])},[e("div",{class:k(["grid gap-4 lg:ml-4 items-stretch",v.value?"grid-cols-1 2xl:grid-cols-2 max-lg:grid-cols-2":"grid-cols-1"])},[(a(!0),c(Z,null,pe(E.value,V=>(a(),c("div",{key:V.key,class:"relative"},[i(Re,{title:V.title,value:V.value,popoverText:V.popoverText},null,8,["title","value","popoverText"])]))),128))],2)],2)])]))}}),$l={key:0,class:"flex justify-center items-center min-h-64"},Ll={class:"flex flex-col lg:flex-row gap-4 mt-1.5"},Ml={class:"lg:shrink-0 lg:min-w-0"},Il={class:"lg:grow lg:min-w-0"},Ql=ae({__name:"SearchTab",setup($){const I=xe(),A=Qe(),l=Se(),h=async()=>{await Promise.allSettled([l.getListingCategories(),l.getKeywordCategories()])};return Le(async()=>{await ke(),h().catch(v=>{console.error("Error initializing favorites:",v)}),I.isEmpty()&&setTimeout(async()=>{try{await I.syncSearch()}catch(v){console.error("Error syncing search:",v)}},100)}),Me(()=>{I.etsyCancelSearchRequests()}),(v,C)=>(a(),c(Z,null,[!o(A).isLoading&&o(A).shops.length===0?(a(),J(at,{key:0})):K("",!0),!o(I).searchResult.lastSearch&&!o(I).isLoading?(a(),J($t,{key:1,title:"Find What You Need Quickly",subtitle:"Type in your keywords in the searchbox above."})):(a(),c(Z,{key:2},[o(I).isLoading?(a(),c("div",$l,[i(ye,{"class-size":"size-25",classColor:"text-blue-ribbon-500 dark:text-dodger-blue-430"})])):(a(),c(Z,{key:1},[e("div",Ll,[e("div",Ml,[i(we,null,{default:ce(()=>[...C[0]||(C[0]=[ge("Keywords",-1)])]),_:1}),i(Tt)]),e("div",Il,[i(xs)])]),o(I).searchResult.listings.length>0?(a(),c(Z,{key:0},[i(Ls),i(Zo),i(ul),i(Sl)],64)):K("",!0)],64))],64))],64))}});export{Ql as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.