var e=`xyxp_goofish_longtail_session`,t=`xyxp_goofish_longtail_latest`;function n(e){let t=e.trim();if(!t)return``;try{return decodeURIComponent(t.replace(/\+/g,` `))}catch{return t.replace(/\+/g,` `)}}function r(e){return n(e.get(`q`)??``)}function i(e=window.location.href){try{let t=new URL(e),n=r(t.searchParams);if(!n&&t.hash.includes(`?`)){let e=t.hash.slice(t.hash.indexOf(`?`));n=r(new URLSearchParams(e))}return n}catch{return``}}function a(){for(let e of[`header input[type="text"]`,`header input`,`[class*="search"] input[type="text"]`,`[class*="Search"] input`,`input[placeholder*="搜索"]`,`input[placeholder*="闲鱼"]`]){let t=document.querySelector(e);if(t?.value.trim())return n(t.value)}return``}function o(){return i()||a()}function s(e){let t=e;if(!t||typeof t.searchKeyword!=`string`||!Array.isArray(t.keywords))return null;let n=t.keywords.map(e=>typeof e==`string`?e.trim():``).filter(Boolean);return n.length?{searchKeyword:t.searchKeyword,keywords:n,updatedAt:typeof t.updatedAt==`number`?t.updatedAt:Date.now()}:null}function c(){try{let t=sessionStorage.getItem(e);return t?s(JSON.parse(t)):null}catch{return null}}function l(t){try{sessionStorage.setItem(e,JSON.stringify(t))}catch{}}function u(e){l(e);try{chrome.storage.local.set({[t]:e})}catch{}}async function d(){try{return s((await chrome.storage.local.get(t))[t])}catch{return null}}function f(e){return e.replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`).replace(/"/g,`&quot;`)}function p(e,t={}){if(!e.length)return``;let n=t.label??`长尾词`,r=e.map(e=>t.clickToCopy?`<button type="button" class="xyxp-longtail-chip xyxp-longtail-chip--copy" data-copy="${f(e)}" title="点击复制：${f(e)}">${f(e)}</button>`:`<span class="xyxp-longtail-chip" title="${f(e)}">${f(e)}</span>`).join(``),i=t.searchKeyword&&!t.compact?`<span class="xyxp-longtail-meta">来源：${f(t.searchKeyword)}</span>`:``;return`<div class="xyxp-longtail-wrap${t.compact?` xyxp-longtail-wrap--compact`:``}">
  <span class="xyxp-longtail-label">${f(n)}</span>
  <div class="xyxp-longtail-chips">${r}</div>
  ${i}
</div>`}var m=`.xyxp-longtail-wrap{display:flex;flex-wrap:wrap;align-items:flex-start;gap:6px 8px;width:100%;box-sizing:border-box;}
.xyxp-longtail-wrap--compact{gap:4px 6px;}
.xyxp-longtail-label{flex:0 0 auto;font-size:12px;font-weight:500;color:#555;line-height:24px;}
.xyxp-longtail-chips{display:flex;flex-wrap:wrap;gap:6px;flex:1;min-width:0;}
.xyxp-longtail-chip{display:inline-flex;align-items:center;padding:3px 10px;border-radius:12px;background:#fff9e6;color:#333;font-size:11px;border:1px solid rgba(255,210,80,.55);max-width:100%;word-break:break-word;line-height:1.4;}
.xyxp-longtail-chip--copy{cursor:pointer;font:inherit;font-family:inherit;transition:background .15s,border-color .15s;}
.xyxp-longtail-chip--copy:hover{background:#ffef99;border-color:#e6c200;}
.xyxp-longtail-meta{flex:0 0 100%;font-size:10px;color:#999;line-height:1.4;}`;export{p as a,c as i,d as n,o,n as r,u as s,m as t};