import{o as e,$ as t,w as n,d as r,u as o,a as i,v as s,h as u,i as l,p as a,X as c,e as m,j as d,k as f,l as p,m as v}from"./vue-vendor-a4114f72.js";import{a3 as y}from"./main-6eeb4491.js";const h=e=>{if(!e.isConnected)return!1;const t=window.getComputedStyle(e),n=e.getBoundingClientRect();return"none"!==t.display&&"hidden"!==t.visibility&&n.width>0&&n.height>0},g=e=>{const t=Array.isArray(null==e?void 0:e.pickerColumn)?e.pickerColumn:[];return Array.from(document.querySelectorAll(".nut-picker__column")).filter(h).map((e,n)=>{const r=t[n];return r?{element:e,proxy:r}:null}).filter(e=>null!==e)},b=r=>{const o=new Map,i=new Map,s=e=>{const t=i.get(e);t&&(clearTimeout(t),i.delete(e))},u=()=>{i.forEach(e=>{clearTimeout(e)}),i.clear(),o.clear()},l=e=>{const t=r.value,{target:n}=e,o=g(t);if(n instanceof Element){const e=o.find(e=>e.element.contains(n));if(e)return e.proxy}const i=((e,t,n)=>{var r,o;return!Number.isFinite(t)||!Number.isFinite(n)||0===t&&0===n?null:null!=(o=null==(r=g(e).find(e=>{const r=e.element.getBoundingClientRect();return t>=r.left&&t<=r.right&&n>=r.top&&n<=r.bottom}))?void 0:r.proxy)?o:null})(t,e.clientX,e.clientY);return i||null},a=e=>{var t;const n=r.value;if(!(null==n?void 0:n.show))return;const u=l(e);if(!u)return;const a=(null!=(t=o.get(u))?t:0)+e.deltaY;if(o.set(u,a),(e=>{s(e);const t=setTimeout(()=>{i.delete(e),o.delete(e)},160);i.set(e,t)})(u),e.preventDefault(),Math.abs(a)<40)return;(e=>{s(e),o.delete(e)})(u);((e,t)=>{const n=Array.isArray(e.column)?e.column.length:0,r=Number(e.currIndex),o=Number(e.lineSpacing),i=Number(e.transformY);if(!n||!r||!o||Number.isNaN(i))return!1;const s=Math.min(n,Math.max(1,r+t));if(s===r||"function"!=typeof e.setMove)return!1;const u=-(s-1)*o-i;e.setMove(u,"end",200)})(u,a>0?1:-1)};e(()=>{y()&&"undefined"!=typeof document&&document.addEventListener("wheel",a,{capture:!0,passive:!1})}),t(()=>{u(),"undefined"!=typeof document&&document.removeEventListener("wheel",a,!0)}),n(()=>{var e;return null==(e=r.value)?void 0:e.show},e=>{e||u()})},w=r({__name:"DesktopPicker",setup(e){const t=o(),n=i();return b(n),(e,r)=>{const o=c("nut-picker");return m(),s(o,{ref_key:"pickerRef",ref:n},u({_:2},[l(a(t),(t,n)=>({name:n,fn:d(t=>[f(e.$slots,n,p(v(t||{})))])}))]),1536)}}});export{w as _};
