import{o as e,s as t}from"./types-CFYvnnbw.js";function n(e,t){let n=t.trim();if(!n)return``;for(let t of e.antiDup?.imageVariants??[]){let e=t.sourceUrl?.trim(),r=t.processedUrl?.trim();if(r&&r===n&&e||e&&e===n)return e}return n}function r(e,t){let n=t.trim();if(n)return e?.imageVariants?.find(e=>e.sourceUrl?.trim()===n||e.processedUrl?.trim()===n)}function i(e,t){let n=t.trim(),i=r(e,n);return i?.processedUrl?.trim()?i.processedUrl.trim():(e?.imageVariants?.find(e=>e.sourceUrl?.trim()===n))?.processedUrl?.trim()}function a(e,t){return!!i(e,t)}function o(e,t){let n=t.trim();return n?r(e.antiDup,n)?.processedUrl?.trim()||n:``}function s(e,n){let i=n.trim();return i?r(e.antiDup,i)?.processedUrl?.trim()||t(e.images,i)||i:``}function c(e){let t=new Set,n=[];for(let r of e)r.role!==`main`||!r.url||t.has(r.url)||(t.add(r.url),n.push(r.url));return n}function l(e){let t=new Set,n=[];for(let r of e){let e=r.url?.trim();!e||t.has(e)||(t.add(e),n.push(e))}return n}function u(t){let n=t.filter(e=>e.role===`main`&&e.url.trim());if(n[0])return e(n[0]);let r=t.find(e=>e.url?.trim());return r?e(r):``}function d(e){switch(e){case`goofish`:return`闲鱼`;case`1688`:return`1688`;case`pdd`:return`拼多多`;case`taobao`:return`淘宝`;case`tmall`:return`天猫`;case`sooxie`:return`搜鞋`;default:return`未知`}}export{u as a,a as c,c as i,i as l,o as n,d as o,s as r,n as s,l as t};