@qwanyx/stack 0.2.65 → 0.2.66

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.
package/dist/index.cjs.js CHANGED
@@ -158,4 +158,4 @@ React keys must be passed directly to JSX without using spread:
158
158
  from { transform: rotate(0deg); }
159
159
  to { transform: rotate(360deg); }
160
160
  }
161
- `})]})}const Hf={background:"#ffffff",text:"#111827",textSecondary:"#6b7280",border:"#e5e7eb",primary:"#3b82f6",chipBackground:"#f3f4f6",chipText:"#374151",hoverBackground:"#f9fafb"};function Qf({options:r,value:e,onChange:t,placeholder:n="Search or select...",allowCreate:s=!0,onCreate:i,allowDelete:o=!1,onDelete:a,label:l,disabled:u=!1,max:c=0,theme:d={},className:f=""}){const h={...Hf,...d},[p,m]=w.useState(!1),[y,D]=w.useState(""),x=w.useRef(null),E=w.useRef(null);w.useEffect(()=>{function T(B){x.current&&!x.current.contains(B.target)&&(m(!1),D(""))}return document.addEventListener("mousedown",T),()=>document.removeEventListener("mousedown",T)},[]);const _=r.filter(T=>{var B;return((B=T.label)==null?void 0:B.toLowerCase().includes(y.toLowerCase()))&&!e.includes(T.id)}),A=s&&y.trim()&&!r.some(T=>{var B;return((B=T.label)==null?void 0:B.toLowerCase())===y.toLowerCase()}),b=e.map(T=>r.find(B=>B.id===T)).filter(Boolean),v=w.useCallback(T=>{var B;c>0&&e.length>=c||(t([...e,T]),D(""),c===1?m(!1):(B=E.current)==null||B.focus())},[e,t,c]),S=w.useCallback(T=>{t(e.filter(B=>B!==T))},[e,t]),k=w.useCallback(async()=>{if(!A)return;const T=await(i==null?void 0:i(y.trim()));T&&v(T.id),D("")},[A,y,i,v]),j=w.useCallback(T=>{T.key==="Enter"?(T.preventDefault(),A?k():_.length>0&&v(_[0].id)):T.key==="Backspace"&&!y&&e.length>0?S(e[e.length-1]):T.key==="Escape"&&(m(!1),D(""))},[A,_,y,e,k,v,S]);return g.jsxs("div",{ref:x,className:f,style:{position:"relative"},children:[l&&g.jsx("label",{style:{display:"block",fontSize:"12px",textTransform:"uppercase",color:h.textSecondary,marginBottom:"4px"},children:l}),g.jsxs("div",{onClick:()=>!u&&m(!0),style:{display:"flex",flexWrap:"wrap",gap:"6px",padding:"8px 12px",border:`1px solid ${p?h.primary:h.border}`,borderRadius:"8px",background:u?h.hoverBackground:h.background,cursor:u?"not-allowed":"text",minHeight:"42px",alignItems:"center"},children:[b.map(T=>g.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:"4px",padding:"2px 8px",borderRadius:"4px",fontSize:"13px",background:T.color||h.chipBackground,color:T.color?"#fff":h.chipText},children:[T.label,!u&&g.jsx("button",{type:"button",onClick:B=>{B.stopPropagation(),S(T.id)},style:{border:"none",background:"transparent",cursor:"pointer",padding:"0 2px",fontSize:"14px",color:"inherit",opacity:.7},children:"×"})]},T.id)),g.jsx("input",{ref:E,type:"text",value:y,onChange:T=>{D(T.target.value),p||m(!0)},onFocus:()=>m(!0),onKeyDown:j,placeholder:b.length===0?n:"",disabled:u||c>0&&e.length>=c,style:{flex:1,minWidth:"60px",border:"none",outline:"none",fontSize:"14px",background:"transparent",color:h.text}})]}),p&&!u&&g.jsx("div",{style:{position:"absolute",top:"100%",left:0,right:0,marginTop:"4px",background:h.background,border:`1px solid ${h.border}`,borderRadius:"8px",boxShadow:"0 4px 12px rgba(0,0,0,0.1)",maxHeight:"200px",overflowY:"auto",zIndex:50},children:_.length===0&&!A?g.jsx("div",{style:{padding:"12px",fontSize:"14px",color:h.textSecondary,textAlign:"center"},children:y?"No matches":"No options available"}):g.jsxs(g.Fragment,{children:[_.map(T=>g.jsxs("div",{onClick:()=>v(T.id),style:{padding:"10px 12px",fontSize:"14px",cursor:"pointer",color:h.text,display:"flex",alignItems:"center",justifyContent:"space-between"},onMouseEnter:B=>{B.currentTarget.style.background=h.hoverBackground||""},onMouseLeave:B=>{B.currentTarget.style.background=""},children:[T.label,o&&a&&g.jsx("button",{type:"button",onClick:B=>{B.stopPropagation(),a(T.id)},style:{border:"none",background:"transparent",cursor:"pointer",padding:"2px",fontSize:"14px",color:h.textSecondary,opacity:.5},onMouseEnter:B=>{B.currentTarget.style.opacity="1",B.currentTarget.style.color="#ef4444"},onMouseLeave:B=>{B.currentTarget.style.opacity="0.5",B.currentTarget.style.color=h.textSecondary||""},children:"×"})]},T.id)),A&&g.jsxs("div",{onClick:k,style:{padding:"10px 12px",fontSize:"14px",cursor:"pointer",color:h.primary,borderTop:_.length>0?`1px solid ${h.border}`:"none"},onMouseEnter:T=>{T.currentTarget.style.background=h.hoverBackground||""},onMouseLeave:T=>{T.currentTarget.style.background=""},children:['+ Create "',y.trim(),'"']})]})})]})}const Jf={background:"#ffffff",cardBackground:"#f9fafb",cardHover:"#f3f4f6",text:"#111827",textSecondary:"#6b7280",border:"#e5e7eb",primary:"#3b82f6"};function Yf({options:r,type:e,placeholder:t="Search...",onItemClick:n,onCreate:s,maxHeight:i=300,className:o="",theme:a={}}){const l={...Jf,...a},[u,c]=w.useState(""),[d,f]=w.useState(!1),h=w.useRef(null),p=w.useRef(null),m=w.useMemo(()=>{if(!u.trim())return r;const _=u.toLowerCase();return r.filter(A=>{var b,v;return((b=A.label)==null?void 0:b.toLowerCase().includes(_))||((v=A.notes)==null?void 0:v.toLowerCase().includes(_))})},[r,u]);w.useEffect(()=>{const _=A=>{h.current&&!h.current.contains(A.target)&&f(!1)};return document.addEventListener("mousedown",_),()=>document.removeEventListener("mousedown",_)},[]);const y=_=>{n&&n(_),f(!1),c("")},D=()=>{s&&s(),f(!1)},x=()=>{f(!0)},E=_=>{c(_.target.value),d||f(!0)};return g.jsxs("div",{ref:h,className:`combostack ${o}`,style:{position:"relative",width:"100%"},children:[g.jsxs("div",{style:{display:"flex",gap:"8px"},children:[g.jsxs("div",{style:{flex:1,position:"relative"},children:[g.jsx("span",{style:{position:"absolute",left:"12px",top:"50%",transform:"translateY(-50%)",color:l.textSecondary,fontSize:"14px",pointerEvents:"none"},children:"🔍"}),g.jsx("input",{ref:p,type:"text",value:u,onChange:E,onFocus:x,placeholder:t,style:{width:"100%",padding:"8px 12px 8px 36px",fontSize:"14px",border:`1px solid ${d?l.primary:l.border}`,borderRadius:"6px",background:l.background,color:l.text,outline:"none",boxSizing:"border-box",transition:"border-color 0.15s"}})]}),s&&g.jsx("button",{onClick:D,style:{width:"36px",height:"36px",display:"flex",alignItems:"center",justifyContent:"center",border:`1px solid ${l.border}`,borderRadius:"6px",background:l.background,color:l.primary,cursor:"pointer",fontSize:"18px",fontWeight:"bold",transition:"background 0.15s"},onMouseEnter:_=>{_.currentTarget.style.background=l.cardHover||"#f3f4f6"},onMouseLeave:_=>{_.currentTarget.style.background=l.background||"#ffffff"},title:`Create ${e||"item"}`,children:"+"})]}),d&&g.jsx("div",{style:{position:"absolute",top:"100%",left:0,right:0,marginTop:"4px",maxHeight:typeof i=="number"?`${i}px`:i,overflowY:"auto",border:`1px solid ${l.border}`,borderRadius:"8px",background:l.background,boxShadow:"0 4px 12px rgba(0, 0, 0, 0.15)",zIndex:50},children:m.length===0?g.jsx("div",{style:{padding:"16px",textAlign:"center",color:l.textSecondary,fontSize:"14px"},children:u?`No results for "${u}"`:"No items"}):m.map((_,A)=>g.jsxs("div",{onClick:()=>y(_),style:{padding:"10px 14px",cursor:"pointer",borderBottom:A<m.length-1?`1px solid ${l.border}`:"none",background:l.cardBackground,transition:"background 0.15s"},onMouseEnter:b=>{b.currentTarget.style.background=l.cardHover||"#f3f4f6"},onMouseLeave:b=>{b.currentTarget.style.background=l.cardBackground||"#f9fafb"},children:[g.jsx("div",{style:{fontSize:"14px",fontWeight:500,color:_.color||l.text,marginBottom:_.notes?"2px":0},children:_.label}),_.notes&&g.jsx("div",{style:{fontSize:"12px",color:l.textSecondary,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:_.notes})]},_.id))})]})}function Xf({items:r,columns:e,getItemId:t,getItemColumn:n,getItemOrder:s,renderItem:i,onItemMove:o,onItemReorder:a,onItemClick:l,renderColumnHeader:u,renderColumnFooter:c,className:d="",columnClassName:f="",itemClassName:h=""}){const[p,m]=w.useState(null),[y,D]=w.useState(null),[x,E]=w.useState(null),_=w.useRef(null),A=e.reduce((B,L)=>{let R=r.filter(P=>n(P)===L.id);return s&&(R=R.sort((P,Q)=>s(P)-s(Q))),B[L.id]=R,B},{}),b=w.useCallback((B,L)=>{const R=t(L),P=n(L);m(R),_.current=P,B.dataTransfer.effectAllowed="move",B.dataTransfer.setData("text/plain",R),requestAnimationFrame(()=>{const Q=B.target;Q.style.opacity="0.5"})},[t,n]),v=w.useCallback(B=>{const L=B.target;L.style.opacity="1",m(null),D(null),E(null),_.current=null},[]),S=w.useCallback((B,L,R)=>{B.preventDefault(),B.dataTransfer.dropEffect="move",D(L),E(R)},[]),k=w.useCallback(B=>{const L=B.relatedTarget;L!=null&&L.closest("[data-kanban-column]")||(D(null),E(null))},[]),j=w.useCallback((B,L,R)=>{if(B.preventDefault(),!p)return;const P=_.current;P===L?a==null||a(p,L,R):P&&o(p,P,L,R),m(null),D(null),E(null),_.current=null},[p,o,a]),T=(B,L)=>g.jsxs("div",{className:"flex items-center justify-between px-3 py-2",children:[g.jsxs("div",{className:"flex items-center gap-2",children:[B.color&&g.jsx("div",{className:"w-2 h-2 rounded-full",style:{backgroundColor:B.color}}),g.jsx("span",{className:"font-medium text-sm text-neutral-700",children:B.label})]}),g.jsx("span",{className:"text-xs text-neutral-400 bg-neutral-100 px-2 py-0.5 rounded-full",children:L})]});return g.jsx("div",{className:`flex gap-4 overflow-x-auto pb-4 ${d}`,style:{minHeight:"400px"},children:e.map(B=>{const L=A[B.id]||[],R=y===B.id;return g.jsxs("div",{"data-kanban-column":B.id,className:`flex-1 min-w-[180px] bg-neutral-50 rounded-xl flex flex-col ${f}`,onDragOver:P=>{P.preventDefault(),p&&!R&&D(B.id)},onDragLeave:k,onDrop:P=>j(P,B.id,x??L.length),children:[g.jsx("div",{className:"flex-shrink-0 border-b border-neutral-200",children:u?u(B,L.length):T(B,L.length)}),g.jsxs("div",{className:`flex-1 overflow-y-auto p-2 space-y-2 min-h-[100px] transition-colors ${R?"bg-blue-50":""}`,children:[L.map((P,Q)=>{const se=t(P),xe=p===se,oe=R&&x===Q&&!xe;return g.jsxs("div",{children:[oe&&g.jsx("div",{className:"h-1 bg-blue-500 rounded-full mb-2 mx-1"}),g.jsx("div",{draggable:!0,onDragStart:Se=>b(Se,P),onDragEnd:v,onDragOver:Se=>S(Se,B.id,Q),onClick:()=>l==null?void 0:l(P),className:`cursor-grab active:cursor-grabbing transition-all ${xe?"opacity-50 scale-95":""} ${h}`,children:i(P,xe)})]},se)}),g.jsx("div",{className:"min-h-[40px] flex-1",onDragOver:P=>{P.preventDefault(),S(P,B.id,L.length)},children:R&&x===L.length&&g.jsx("div",{className:"h-1 bg-blue-500 rounded-full mx-1 mt-1"})}),L.length===0&&R&&g.jsx("div",{className:"h-20 border-2 border-dashed border-blue-300 rounded-lg bg-blue-50/50 flex items-center justify-center",children:g.jsx("span",{className:"text-sm text-blue-400",children:"Drop here"})})]}),c&&g.jsx("div",{className:"flex-shrink-0 border-t border-neutral-200 p-2",children:c(B)})]},B.id)})})}const Zf={background:"#ffffff",hourLineColor:"#e5e7eb",halfHourLineColor:"#f3f4f6",hourTextColor:"#9ca3af",currentTimeColor:"#ef4444",allDayBackground:"#f9fafb",allDayBorder:"#e5e7eb"};function eh(r){const e=r.match(/^(\d{1,2}):(\d{2})$/);return e?{hours:parseInt(e[1],10),minutes:parseInt(e[2],10)}:null}function th(r){const e=r%12||12,t=r<12?"AM":"PM";return`${e} ${t}`}function rh(r){const e=new Date;return r.getDate()===e.getDate()&&r.getMonth()===e.getMonth()&&r.getFullYear()===e.getFullYear()}function nh({items:r,date:e,startHour:t=7,endHour:n=22,hourHeight:s=60,getItemTime:i,getItemDuration:o,getItemIsAllDay:a,getItemId:l,renderItem:u,onItemClick:c,onTimeSlotClick:d,showCurrentTime:f=!0,className:h="",theme:p={}}){const m={...Zf,...p},{allDayItems:y,timedItems:D}=w.useMemo(()=>{const v=[],S=[];for(const k of r)a(k)?v.push(k):S.push(k);return{allDayItems:v,timedItems:S}},[r,a]),x=w.useMemo(()=>{const v=[];for(let S=t;S<=n;S++)v.push(S);return v},[t,n]),E=(n-t+1)*s,_=w.useCallback(v=>{const S=i(v);if(!S)return null;const k=eh(S);if(!k)return null;const{hours:j,minutes:T}=k,B=Math.max(t,Math.min(n,j)),L=j<t?0:T,R=(B-t)*s+L/60*s,P=o(v),Q=Math.max(20,P/60*s);return{top:R,height:Q}},[i,o,t,n,s]),A=w.useMemo(()=>{if(!f||!rh(e))return null;const v=new Date,S=v.getHours(),k=v.getMinutes();return S<t||S>n?null:(S-t)*s+k/60*s},[e,f,t,n,s]),b=w.useCallback(v=>{if(!d)return;const S=v.currentTarget.getBoundingClientRect(),j=(v.clientY-S.top)/s*60,T=Math.floor(j/60)+t,B=Math.round(j%60/15)*15,L=Math.min(n,Math.max(t,T)),R=B>=60?0:B,P=`${L.toString().padStart(2,"0")}:${R.toString().padStart(2,"0")}`;d(P)},[d,s,t,n]);return g.jsxs("div",{className:h,style:{background:m.background},children:[y.length>0&&g.jsxs("div",{style:{padding:"8px 0 8px 60px",borderBottom:`1px solid ${m.allDayBorder}`,background:m.allDayBackground},children:[g.jsx("div",{style:{fontSize:"11px",color:m.hourTextColor,marginBottom:"4px",textTransform:"uppercase",letterSpacing:"0.05em"},children:"All Day"}),g.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:"4px"},children:y.map(v=>g.jsx("div",{onClick:()=>c==null?void 0:c(v),style:{cursor:c?"pointer":"default"},children:u(v)},l(v)))})]}),g.jsxs("div",{style:{position:"relative",height:E},children:[x.map((v,S)=>g.jsxs("div",{style:{position:"absolute",top:S*s,left:0,right:0},children:[g.jsx("div",{style:{position:"absolute",left:0,top:-8,width:"50px",textAlign:"right",paddingRight:"10px",fontSize:"11px",color:m.hourTextColor},children:th(v)}),g.jsx("div",{style:{position:"absolute",left:"60px",right:0,top:0,height:"1px",background:m.hourLineColor}}),S<x.length-1&&g.jsx("div",{style:{position:"absolute",left:"60px",right:0,top:s/2,height:"1px",background:m.halfHourLineColor}})]},v)),g.jsx("div",{style:{position:"absolute",left:"60px",right:0,top:0,bottom:0,cursor:d?"pointer":"default"},onClick:b}),A!==null&&g.jsxs("div",{style:{position:"absolute",left:"55px",right:0,top:A,zIndex:20,pointerEvents:"none"},children:[g.jsx("div",{style:{width:"10px",height:"10px",borderRadius:"50%",background:m.currentTimeColor,marginLeft:"-5px",marginTop:"-5px",position:"absolute"}}),g.jsx("div",{style:{marginLeft:"5px",height:"2px",background:m.currentTimeColor}})]}),D.map(v=>{const S=_(v);return S?g.jsx("div",{style:{position:"absolute",left:"64px",right:"8px",top:S.top,height:S.height,zIndex:10,cursor:c?"pointer":"default"},onClick:k=>{k.stopPropagation(),c==null||c(v)},children:u(v)},l(v)):null})]})]})}function sh({onComplete:r,onCancel:e,onTranscribe:t,onTranscriptionComplete:n,variant:s="widget",hideSaveButton:i=!1,maxDuration:o=180}){const a=s==="widget",[l,u]=w.useState("idle"),[c,d]=w.useState(0),[f,h]=w.useState(0),[p,m]=w.useState(!1),[y,D]=w.useState(0),[x,E]=w.useState(null),[_,A]=w.useState(!1),[b,v]=w.useState(null),[S,k]=w.useState(!0),[j,T]=w.useState([]),[B,L]=w.useState({completed:0,total:0}),R=w.useRef(!1),P=w.useRef(!0);w.useEffect(()=>{P.current=S},[S]);const Q=w.useRef(null),se=w.useRef(null),xe=w.useRef(null),oe=w.useRef(null),Se=w.useRef(null),he=w.useRef([]),fe=w.useRef(null),pe=w.useRef(null),ge=w.useRef(null),Ae=w.useRef(null),be=w.useRef(!1),we=w.useRef([]),Re=w.useRef(null),ce=w.useRef(null),je=w.useRef([]),at=w.useRef([]),kt=w.useRef("insert"),zt=w.useRef(!1),nt=w.useRef(0),mt=w.useRef(0),ft=w.useRef(0),Yt=q=>{const N=Math.floor(q/60),H=Math.floor(q%60);return`${N.toString().padStart(2,"0")}:${H.toString().padStart(2,"0")}`},qt=async q=>{const N=await q.arrayBuffer(),H=new AudioContext,Y=await H.decodeAudioData(N);return await H.close(),Y},Tt=q=>{const N=q.numberOfChannels,H=q.sampleRate,Y=1,I=16,re=I/8,Z=N*re,ee=H*Z,me=q.length*Z,Ee=new ArrayBuffer(44+me),te=new DataView(Ee),ne=(Be,ve)=>{for(let Je=0;Je<ve.length;Je++)te.setUint8(Be+Je,ve.charCodeAt(Je))};ne(0,"RIFF"),te.setUint32(4,36+me,!0),ne(8,"WAVE"),ne(12,"fmt "),te.setUint32(16,16,!0),te.setUint16(20,Y,!0),te.setUint16(22,N,!0),te.setUint32(24,H,!0),te.setUint32(28,ee,!0),te.setUint16(32,Z,!0),te.setUint16(34,I,!0),ne(36,"data"),te.setUint32(40,me,!0);const ze=[];for(let Be=0;Be<N;Be++)ze.push(q.getChannelData(Be));let We=44;for(let Be=0;Be<q.length;Be++)for(let ve=0;ve<N;ve++){const Je=Math.max(-1,Math.min(1,ze[ve][Be])),Ye=Je<0?Je*32768:Je*32767;te.setInt16(We,Ye,!0),We+=2}return new Blob([Ee],{type:"audio/wav"})},Nt=async(q,N,H,Y)=>{const I=new AudioContext,re=q.sampleRate,Z=Math.max(q.numberOfChannels,N.numberOfChannels),ee=Math.min(H,q.length),me=Math.max(0,q.length-H),Ee=Y==="insert"?ee+N.length+me:ee+N.length,te=I.createBuffer(Z,Ee,re);for(let ne=0;ne<Z;ne++){const ze=te.getChannelData(ne),We=ne<q.numberOfChannels?q.getChannelData(ne):q.getChannelData(0);for(let ve=0;ve<ee;ve++)ze[ve]=We[ve];const Be=ne<N.numberOfChannels?N.getChannelData(ne):N.getChannelData(0);for(let ve=0;ve<N.length;ve++)ze[ee+ve]=Be[ve];if(Y==="insert")for(let ve=0;ve<me;ve++)ze[ee+N.length+ve]=We[H+ve]}return await I.close(),te},ut=w.useCallback(()=>{const q=Q.current;if(!q)return;const N=q.getContext("2d");if(!N)return;const H=q.getBoundingClientRect(),Y=H.width,I=H.height,re=we.current,Z=f||c||1,ee=l==="recording"?c:y;N.fillStyle="#2d3b35",N.fillRect(0,0,Y,I);const me=8,Ee="rgba(0, 0, 0, 0.4)",te=N.createLinearGradient(0,0,0,me);te.addColorStop(0,Ee),te.addColorStop(1,"transparent"),N.fillStyle=te,N.fillRect(0,0,Y,me);const ne=N.createLinearGradient(0,I-me,0,I);ne.addColorStop(0,"transparent"),ne.addColorStop(1,Ee),N.fillStyle=ne,N.fillRect(0,I-me,Y,me);const ze=N.createLinearGradient(0,0,me,0);ze.addColorStop(0,Ee),ze.addColorStop(1,"transparent"),N.fillStyle=ze,N.fillRect(0,0,me,I);const We=N.createLinearGradient(Y-me,0,Y,0);We.addColorStop(0,"transparent"),We.addColorStop(1,Ee),N.fillStyle=We,N.fillRect(Y-me,0,me,I),N.strokeStyle="#5a6b62",N.lineWidth=1,N.beginPath(),N.moveTo(0,I/2),N.lineTo(Y,I/2),N.stroke();const Be=Y/2;if(re.length>0)if(l==="recording")for(let Ye=0;Ye<re.length;Ye++){const ht=re.length-1-Ye,Wt=Be-ht*4;if(Wt<-3||Wt>Y)continue;const bt=re[Ye]*(I/2-12),C=I/2-bt;N.fillStyle="#10b981",N.fillRect(Wt,C,3,bt*2)}else{const Ye=Z>0?ee/Z*re.length:0;for(let ht=0;ht<re.length;ht++){const Wt=Ye-ht,bt=Be-Wt*4;if(bt<-3||bt>Y)continue;const C=re[ht]*(I/2-12),M=I/2-C;N.fillStyle=ht<=Ye?"#10b981":"#4b5563",N.fillRect(bt,M,3,C*2)}}N.strokeStyle="#ef4444",N.lineWidth=1,N.beginPath(),N.moveTo(Be,0),N.lineTo(Be,I),N.stroke(),N.fillStyle="#fff",N.font="bold 18px monospace",N.textAlign="center",N.fillText(Yt(ee),Be,I-6),l==="recording"&&(N.fillStyle="#ef4444",N.beginPath(),N.arc(20,20,8,0,Math.PI*2),N.fill(),N.fillStyle="#fff",N.font="10px sans-serif",N.textAlign="left",N.fillText("REC",34,24)),N.textAlign="left"},[l,y,c,f]),yt=()=>{const q=Se.current;if(!q||!be.current)return;const N=q.frequencyBinCount,H=new Uint8Array(N);q.getByteTimeDomainData(H);let Y=0;for(let Z=0;Z<N;Z++){const ee=(H[Z]-128)/128;Y+=ee*ee}const I=Math.sqrt(Y/N),re=Math.min(1,I*3);we.current.push(re),ut(),be.current&&(pe.current=requestAnimationFrame(yt))},W=async()=>{try{E(null),A(!1),Re.current===null&&(we.current=[]);const q=await navigator.mediaDevices.getUserMedia({audio:!0});xe.current=q;const N=new AudioContext;oe.current=N;const H=N.createAnalyser();H.fftSize=2048,Se.current=H,N.createMediaStreamSource(q).connect(H);const I=new MediaRecorder(q);se.current=I,he.current=[],I.ondataavailable=re=>{re.data.size>0&&he.current.push(re.data)},I.onstop=async()=>{try{if(be.current=!1,he.current.length===0){E("No audio was recorded. Please try again."),u("idle"),q.getTracks().forEach(te=>te.stop());return}const re=new Blob(he.current,{type:"audio/webm"});let Z,ee;if(Re.current!==null&&ce.current)try{const te=await qt(re),ne=ce.current.sampleRate,ze=Math.floor(Re.current*ne),We=await Nt(ce.current,te,ze,kt.current);Z=Tt(We),ee=We.length/We.sampleRate,kt.current==="insert"&&(we.current=[...we.current,...at.current]),Re.current=null,ce.current=null,je.current=[],at.current=[]}catch{Z=re,ee=nt.current>0?nt.current:1}else Z=re,ee=nt.current>0?nt.current:1;if(Ae.current=Z,q.getTracks().forEach(te=>te.stop()),P.current&&t){T(te=>[...te,Z]),L(te=>({...te,total:te.total+1})),Ae.current=null,we.current=[],D(0),h(0),d(0),u("idle");return}const me=URL.createObjectURL(Z),Ee=new Audio(me);Ee.ontimeupdate=()=>{D(Ee.currentTime)},Ee.onended=()=>{m(!1)},ge.current=Ee,h(ee),D(ee),u("editing")}catch{E("Failed to process recording"),u("idle")}},I.start(100),be.current=!0,u("recording"),d(0),nt.current=0,fe.current=setInterval(()=>{nt.current+=1,d(nt.current),nt.current>=o&&(se.current&&se.current.state!=="inactive"&&se.current.stop(),be.current=!1,v(null),fe.current&&(clearInterval(fe.current),fe.current=null),pe.current&&(cancelAnimationFrame(pe.current),pe.current=null),setTimeout(()=>{alert(`Maximum recording time of ${Math.floor(o/60)} minutes reached.`)},100))},1e3)}catch{E("Could not access microphone. Please allow microphone access.")}},De=()=>{be.current=!1,A(!1),v(null),pe.current&&(cancelAnimationFrame(pe.current),pe.current=null),fe.current&&(clearInterval(fe.current),fe.current=null),se.current&&se.current.state!=="inactive"&&se.current.stop()},Te=q=>{const N=Q.current;if(!N)return;const H=f||c;if(H<=0)return;const Y=we.current;if(Y.length===0)return;const I=N.getBoundingClientRect(),re=q-mt.current,Z=4,ee=I.width/N.width,me=Y.length/H*Z,Ee=-re/(me*ee),te=ft.current+Ee,ne=Math.max(0,Math.min(te,H));ge.current&&(ge.current.currentTime=ne),D(ne)},ke=()=>{ge.current&&(ge.current.currentTime=0),D(0)},Bt=()=>{const q=f||c;ge.current&&(ge.current.currentTime=q),D(q)},Ft=()=>{const q=ge.current;q&&(p?(q.pause(),D(q.currentTime),m(!1)):(q.currentTime=y,q.play().catch(()=>{}),m(!0)))},Ut=async q=>{if(!Ae.current){W();return}try{ge.current&&(ge.current.pause(),m(!1)),kt.current=q,ce.current=await qt(Ae.current);const N=f||c;Re.current=y;const H=N>0?y/N:0,Y=Math.floor(H*we.current.length);je.current=we.current.slice(0,Y),at.current=we.current.slice(Y),we.current=[...je.current],W()}catch{E("Failed to prepare recording. Please try again.")}},V=()=>{ge.current&&(ge.current.pause(),ge.current=null),Ae.current=null,ce.current=null,Re.current=null,je.current=[],m(!1),D(0),h(0),d(0),W()},J=()=>{Ae.current?r(Ae.current,f||c):alert("No audio recorded yet!")};w.useEffect(()=>{l==="recording"&&Q.current&&Se.current&&be.current&&(pe.current=requestAnimationFrame(yt))},[l]),w.useEffect(()=>{const q=Q.current;if(!q)return;const N=()=>{const H=window.devicePixelRatio||1,Y=q.getBoundingClientRect();q.width=Y.width*H,q.height=Y.height*H;const I=q.getContext("2d");I&&I.scale(H,H)};return N(),window.addEventListener("resize",N),()=>window.removeEventListener("resize",N)},[]),w.useEffect(()=>{if(l==="idle"){const q=Q.current;if(!q)return;const N=q.getContext("2d");if(!N)return;const H=q.getBoundingClientRect(),Y=H.width,I=H.height;N.fillStyle="#2d3b35",N.fillRect(0,0,Y,I);const re=8,Z="rgba(0, 0, 0, 0.4)",ee=N.createLinearGradient(0,0,0,re);ee.addColorStop(0,Z),ee.addColorStop(1,"transparent"),N.fillStyle=ee,N.fillRect(0,0,Y,re);const me=N.createLinearGradient(0,I-re,0,I);me.addColorStop(0,"transparent"),me.addColorStop(1,Z),N.fillStyle=me,N.fillRect(0,I-re,Y,re);const Ee=N.createLinearGradient(0,0,re,0);Ee.addColorStop(0,Z),Ee.addColorStop(1,"transparent"),N.fillStyle=Ee,N.fillRect(0,0,re,I);const te=N.createLinearGradient(Y-re,0,Y,0);te.addColorStop(0,"transparent"),te.addColorStop(1,Z),N.fillStyle=te,N.fillRect(Y-re,0,re,I),N.strokeStyle="#5a6b62",N.lineWidth=1,N.beginPath(),N.moveTo(0,I/2),N.lineTo(Y,I/2),N.stroke();const ne=Y/2;N.strokeStyle="#ef4444",N.lineWidth=1,N.beginPath(),N.moveTo(ne,0),N.lineTo(ne,I),N.stroke(),N.fillStyle="#fff",N.font="bold 18px monospace",N.textAlign="center",N.fillText("00:00",ne,I-6)}},[l]);const Ne=w.useCallback(q=>{T(N=>[...N,q]),L(N=>({...N,total:N.total+1}))},[]);if(w.useEffect(()=>{(async()=>{if(R.current||j.length===0||!t)return;R.current=!0;const N=j[0];try{const H=await t(N);H&&n&&n(H)}catch(H){console.error("Transcription failed:",H)}finally{T(H=>H.slice(1)),L(H=>({...H,completed:H.completed+1})),R.current=!1}})()},[j,t,n]),w.useEffect(()=>()=>{be.current=!1,fe.current&&clearInterval(fe.current),pe.current&&cancelAnimationFrame(pe.current),xe.current&&xe.current.getTracks().forEach(q=>q.stop()),oe.current&&oe.current.state!=="closed"&&oe.current.close()},[]),w.useEffect(()=>{if(l==="editing"&&p){let q;const N=()=>{const H=ge.current;if(H&&p){const Y=Q.current;if(Y){const I=Y.getContext("2d");if(I){const re=Y.getBoundingClientRect(),Z=re.width,ee=re.height,me=we.current,Ee=f||c||1,te=H.currentTime;I.fillStyle="#2d3b35",I.fillRect(0,0,Z,ee);const ne=8,ze="rgba(0, 0, 0, 0.4)",We=I.createLinearGradient(0,0,0,ne);We.addColorStop(0,ze),We.addColorStop(1,"transparent"),I.fillStyle=We,I.fillRect(0,0,Z,ne);const Be=I.createLinearGradient(0,ee-ne,0,ee);Be.addColorStop(0,"transparent"),Be.addColorStop(1,ze),I.fillStyle=Be,I.fillRect(0,ee-ne,Z,ne);const ve=I.createLinearGradient(0,0,ne,0);ve.addColorStop(0,ze),ve.addColorStop(1,"transparent"),I.fillStyle=ve,I.fillRect(0,0,ne,ee);const Je=I.createLinearGradient(Z-ne,0,Z,0);Je.addColorStop(0,"transparent"),Je.addColorStop(1,ze),I.fillStyle=Je,I.fillRect(Z-ne,0,ne,ee),I.strokeStyle="#5a6b62",I.lineWidth=1,I.beginPath(),I.moveTo(0,ee/2),I.lineTo(Z,ee/2),I.stroke();const Ye=Z/2,ht=3,Wt=4,bt=Ee>0?te/Ee*me.length:0;for(let U=0;U<me.length;U++){const X=bt-U,ue=Ye-X*Wt;if(ue<-ht||ue>Z)continue;const _e=me[U]*(ee/2-12),le=ee/2-_e;I.fillStyle=U<=bt?"#10b981":"#4b5563",I.fillRect(ue,le,ht,_e*2)}I.strokeStyle="#ef4444",I.lineWidth=1,I.beginPath(),I.moveTo(Ye,0),I.lineTo(Ye,ee),I.stroke(),I.fillStyle="#fff",I.font="bold 18px monospace",I.textAlign="center";const C=Math.floor(te/60),M=Math.floor(te%60);I.fillText(`${C.toString().padStart(2,"0")}:${M.toString().padStart(2,"0")}`,Ye,ee-6),I.textAlign="left"}}q=requestAnimationFrame(N)}};return q=requestAnimationFrame(N),()=>cancelAnimationFrame(q)}},[l,p,f,c]),w.useEffect(()=>{l==="editing"&&!p&&ut()},[l,y,p,ut]),x)return g.jsxs("div",{style:{border:"1px solid #fecaca",borderRadius:"12px",padding:"16px",background:"#fef2f2"},children:[g.jsx("p",{style:{fontSize:"14px",color:"#dc2626",marginBottom:"12px"},children:x}),g.jsx("button",{onClick:()=>{E(null),W()},style:{padding:"8px 16px",fontSize:"14px",background:"#171717",color:"white",borderRadius:"8px",border:"none",cursor:"pointer"},children:"Try Again"})]});const Oe={padding:"8px",borderRadius:"8px",border:"none",background:"transparent",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",transition:"background 0.15s"},Ie={...Oe,opacity:.3,cursor:"not-allowed"},xt=a?{border:"1px solid #e5e5e5",borderRadius:"12px",overflow:"hidden",background:"white"}:{overflow:"hidden",background:"white",flexShrink:0};return g.jsxs("div",{style:xt,children:[g.jsx("canvas",{ref:Q,style:{width:"100%",height:"32px",cursor:"pointer",flexShrink:0},onMouseDown:q=>{if(l==="editing"){zt.current=!0,mt.current=q.clientX,ft.current=y;const N=Y=>{zt.current&&Te(Y.clientX)},H=()=>{zt.current=!1,window.removeEventListener("mousemove",N),window.removeEventListener("mouseup",H)};window.addEventListener("mousemove",N),window.addEventListener("mouseup",H)}}}),g.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:a?"6px 8px":"4px",borderTop:"1px solid #d4d4d4",background:"linear-gradient(to bottom, #e0e0e0 0%, #c8c8c8 100%)",boxShadow:"inset 0 1px 0 rgba(255,255,255,0.6), inset 0 -1px 0 rgba(0,0,0,0.1)",flexShrink:0},children:[g.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"4px"},children:[g.jsx("button",{onClick:ke,disabled:l==="idle"||l==="recording",style:l==="idle"||l==="recording"?Ie:Oe,title:"Go to start",children:g.jsx("span",{className:"material-icons",style:{fontSize:"20px",color:"#171717"},children:"first_page"})}),g.jsx("button",{onClick:()=>{if(l==="recording"){const q=se.current;q&&(q.state==="recording"?(q.pause(),A(!0)):q.state==="paused"&&(q.resume(),A(!1)))}else Ft()},disabled:l==="idle",style:l==="idle"?Ie:Oe,title:p||l==="recording"&&!_?"Pause":"Play",children:g.jsx("span",{className:"material-icons",style:{fontSize:"20px",color:"#171717"},children:p||l==="recording"&&!_?"pause":"play_arrow"})}),g.jsx("button",{onClick:Bt,disabled:l==="idle"||l==="recording",style:l==="idle"||l==="recording"?Ie:Oe,title:"Go to end",children:g.jsx("span",{className:"material-icons",style:{fontSize:"20px",color:"#171717"},children:"last_page"})}),g.jsx("div",{style:{width:"1px",height:"24px",margin:"0 4px",background:"linear-gradient(to bottom, rgba(255,255,255,0.5), rgba(0,0,0,0.15))"}}),g.jsx("button",{onClick:()=>{b==="insert"?De():l==="idle"?(v("insert"),W()):l==="editing"&&(v("insert"),Ut("insert"))},disabled:l==="recording"&&b!=="insert"||p,style:l==="recording"&&b!=="insert"||p?Ie:Oe,title:b==="insert"?"Stop recording":"Insert recording",children:g.jsx("span",{className:"material-icons",style:{fontSize:"20px",color:b==="insert"?"#ef4444":"#171717"},children:"add"})}),g.jsx("button",{onClick:()=>{P.current||(b==="mic"?De():l==="idle"?(v("mic"),W()):l==="editing"&&(v("mic"),Ut("replace")))},onMouseDown:()=>{P.current&&l==="idle"&&!p&&(v("mic"),W())},onMouseUp:()=>{P.current&&l==="recording"&&b==="mic"&&De()},onMouseLeave:()=>{P.current&&l==="recording"&&b==="mic"&&De()},onTouchStart:()=>{P.current&&l==="idle"&&!p&&(v("mic"),W())},onTouchEnd:()=>{P.current&&l==="recording"&&b==="mic"&&De()},disabled:l==="recording"&&b!=="mic"||p,style:l==="recording"&&b!=="mic"||p?Ie:Oe,title:S?"Hold to record (walkie-talkie)":b==="mic"?"Stop recording":"Record",children:g.jsx("span",{className:"material-icons",style:{fontSize:"20px",color:b==="mic"?"#ef4444":"#171717"},children:"mic"})}),g.jsx("button",{onClick:()=>{b==="startover"?De():l==="editing"&&(v("startover"),V())},disabled:l==="idle"||l==="recording"&&b!=="startover"||p,style:l==="idle"||l==="recording"&&b!=="startover"||p?Ie:Oe,title:b==="startover"?"Stop recording":"Start over",children:g.jsx("span",{className:"material-icons",style:{fontSize:"20px",color:b==="startover"?"#ef4444":"#171717"},children:"refresh"})})]}),g.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"4px"},children:[B.total>0&&B.completed<B.total&&g.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"4px",padding:"4px 8px",background:"rgba(16, 185, 129, 0.1)",borderRadius:"4px",fontSize:"11px",color:"#10b981"},children:[g.jsx("span",{className:"material-icons",style:{fontSize:"14px",animation:"spin 1s linear infinite"},children:"sync"}),B.completed,"/",B.total]}),t&&g.jsxs(g.Fragment,{children:[g.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"4px",marginRight:"4px"},children:[g.jsx("button",{onClick:()=>k(!S),style:{width:"28px",height:"16px",borderRadius:"8px",border:"none",background:S?"#10b981":"#9ca3af",cursor:"pointer",position:"relative",transition:"background 0.2s",padding:0},title:S?"Auto-transcribe ON":"Auto-transcribe OFF",children:g.jsx("div",{style:{width:"12px",height:"12px",borderRadius:"50%",background:"white",position:"absolute",top:"2px",left:S?"14px":"2px",transition:"left 0.2s",boxShadow:"0 1px 2px rgba(0,0,0,0.2)"}})}),g.jsx("span",{style:{fontSize:"10px",color:"#666"},children:"auto"})]}),g.jsx("button",{onClick:()=>{l==="editing"&&Ae.current&&Ne(Ae.current)},disabled:l!=="editing",style:l!=="editing"?Ie:Oe,title:"Transcribe audio",children:g.jsx("span",{className:"material-icons",style:{fontSize:"20px",color:S?"#10b981":"#171717"},children:"subtitles"})})]}),!i&&g.jsx("button",{onClick:J,disabled:l!=="editing",style:l!=="editing"?Ie:Oe,title:"Save recording",children:g.jsx("span",{className:"material-icons",style:{fontSize:"20px",color:"#171717"},children:"save"})})]})]}),B.total>0&&B.completed<B.total&&g.jsx("div",{style:{height:"3px",background:"#e5e5e5",overflow:"hidden"},children:g.jsx("div",{style:{height:"100%",background:"#10b981",width:`${B.completed/B.total*100}%`,transition:"width 0.3s ease"}})})]})}exports.$createQRCodeNode=Qi;exports.$isQRCodeNode=If;exports.AnimatedCardFlip=Ou;exports.ApiClient=wl;exports.AudioEditor=sh;exports.AuthManager=Cl;exports.Card=Mu;exports.ComboBox=Qf;exports.ComboStack=Yf;exports.DataOperations=$n;exports.Detail=Pu;exports.GraphClient=cu;exports.KanbanBoard=Xf;exports.Mail=$u;exports.MailClient=vl;exports.MailComposer=Kf;exports.MailEditor=su;exports.QRCodeNode=Ur;exports.SelectableList=zu;exports.Stack=Lu;exports.Timeline=nh;exports.getApiClient=xi;exports.initializeApiClient=Nu;exports.useMutation=Bu;exports.useQuery=Dl;
161
+ `})]})}const Hf={background:"#ffffff",text:"#111827",textSecondary:"#6b7280",border:"#e5e7eb",primary:"#3b82f6",chipBackground:"#f3f4f6",chipText:"#374151",hoverBackground:"#f9fafb"};function Qf({options:r,value:e,onChange:t,placeholder:n="Search or select...",allowCreate:s=!0,onCreate:i,allowDelete:o=!1,onDelete:a,label:l,disabled:u=!1,max:c=0,theme:d={},className:f=""}){const h={...Hf,...d},[p,m]=w.useState(!1),[y,D]=w.useState(""),x=w.useRef(null),E=w.useRef(null);w.useEffect(()=>{function T(B){x.current&&!x.current.contains(B.target)&&(m(!1),D(""))}return document.addEventListener("mousedown",T),()=>document.removeEventListener("mousedown",T)},[]);const _=r.filter(T=>{var B;return((B=T.label)==null?void 0:B.toLowerCase().includes(y.toLowerCase()))&&!e.includes(T.id)}),A=s&&y.trim()&&!r.some(T=>{var B;return((B=T.label)==null?void 0:B.toLowerCase())===y.toLowerCase()}),b=e.map(T=>r.find(B=>B.id===T)).filter(Boolean),v=w.useCallback(T=>{var B;c>0&&e.length>=c||(t([...e,T]),D(""),c===1?m(!1):(B=E.current)==null||B.focus())},[e,t,c]),S=w.useCallback(T=>{t(e.filter(B=>B!==T))},[e,t]),k=w.useCallback(async()=>{if(!A)return;const T=await(i==null?void 0:i(y.trim()));T&&v(T.id),D("")},[A,y,i,v]),j=w.useCallback(T=>{T.key==="Enter"?(T.preventDefault(),A?k():_.length>0&&v(_[0].id)):T.key==="Backspace"&&!y&&e.length>0?S(e[e.length-1]):T.key==="Escape"&&(m(!1),D(""))},[A,_,y,e,k,v,S]);return g.jsxs("div",{ref:x,className:f,style:{position:"relative"},children:[l&&g.jsx("label",{style:{display:"block",fontSize:"12px",textTransform:"uppercase",color:h.textSecondary,marginBottom:"4px"},children:l}),g.jsxs("div",{onClick:()=>!u&&m(!0),style:{display:"flex",flexWrap:"wrap",gap:"6px",padding:"8px 12px",border:`1px solid ${p?h.primary:h.border}`,borderRadius:"8px",background:u?h.hoverBackground:h.background,cursor:u?"not-allowed":"text",minHeight:"42px",alignItems:"center"},children:[b.map(T=>g.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:"4px",padding:"2px 8px",borderRadius:"4px",fontSize:"13px",background:T.color||h.chipBackground,color:T.color?"#fff":h.chipText},children:[T.label,!u&&g.jsx("button",{type:"button",onClick:B=>{B.stopPropagation(),S(T.id)},style:{border:"none",background:"transparent",cursor:"pointer",padding:"0 2px",fontSize:"14px",color:"inherit",opacity:.7},children:"×"})]},T.id)),g.jsx("input",{ref:E,type:"text",value:y,onChange:T=>{D(T.target.value),p||m(!0)},onFocus:()=>m(!0),onKeyDown:j,placeholder:b.length===0?n:"",disabled:u||c>0&&e.length>=c,style:{flex:1,minWidth:"60px",border:"none",outline:"none",fontSize:"14px",background:"transparent",color:h.text}})]}),p&&!u&&g.jsx("div",{style:{position:"absolute",top:"100%",left:0,right:0,marginTop:"4px",background:h.background,border:`1px solid ${h.border}`,borderRadius:"8px",boxShadow:"0 4px 12px rgba(0,0,0,0.1)",maxHeight:"200px",overflowY:"auto",zIndex:50},children:_.length===0&&!A?g.jsx("div",{style:{padding:"12px",fontSize:"14px",color:h.textSecondary,textAlign:"center"},children:y?"No matches":"No options available"}):g.jsxs(g.Fragment,{children:[_.map(T=>g.jsxs("div",{onClick:()=>v(T.id),style:{padding:"10px 12px",fontSize:"14px",cursor:"pointer",color:h.text,display:"flex",alignItems:"center",justifyContent:"space-between"},onMouseEnter:B=>{B.currentTarget.style.background=h.hoverBackground||""},onMouseLeave:B=>{B.currentTarget.style.background=""},children:[T.label,o&&a&&g.jsx("button",{type:"button",onClick:B=>{B.stopPropagation(),a(T.id)},style:{border:"none",background:"transparent",cursor:"pointer",padding:"2px",fontSize:"14px",color:h.textSecondary,opacity:.5},onMouseEnter:B=>{B.currentTarget.style.opacity="1",B.currentTarget.style.color="#ef4444"},onMouseLeave:B=>{B.currentTarget.style.opacity="0.5",B.currentTarget.style.color=h.textSecondary||""},children:"×"})]},T.id)),A&&g.jsxs("div",{onClick:k,style:{padding:"10px 12px",fontSize:"14px",cursor:"pointer",color:h.primary,borderTop:_.length>0?`1px solid ${h.border}`:"none"},onMouseEnter:T=>{T.currentTarget.style.background=h.hoverBackground||""},onMouseLeave:T=>{T.currentTarget.style.background=""},children:['+ Create "',y.trim(),'"']})]})})]})}const Jf={background:"#ffffff",cardBackground:"#f9fafb",cardHover:"#f3f4f6",text:"#111827",textSecondary:"#6b7280",border:"#e5e7eb",primary:"#3b82f6"};function Yf({options:r,type:e,placeholder:t="Search...",onItemClick:n,onCreate:s,maxHeight:i=300,className:o="",theme:a={}}){const l={...Jf,...a},[u,c]=w.useState(""),[d,f]=w.useState(!1),h=w.useRef(null),p=w.useRef(null),m=w.useMemo(()=>{if(!u.trim())return r;const _=u.toLowerCase();return r.filter(A=>{var b,v;return((b=A.label)==null?void 0:b.toLowerCase().includes(_))||((v=A.notes)==null?void 0:v.toLowerCase().includes(_))})},[r,u]);w.useEffect(()=>{const _=A=>{h.current&&!h.current.contains(A.target)&&f(!1)};return document.addEventListener("mousedown",_),()=>document.removeEventListener("mousedown",_)},[]);const y=_=>{n&&n(_),f(!1),c("")},D=()=>{s&&s(),f(!1)},x=()=>{f(!0)},E=_=>{c(_.target.value),d||f(!0)};return g.jsxs("div",{ref:h,className:`combostack ${o}`,style:{position:"relative",width:"100%"},children:[g.jsxs("div",{style:{display:"flex",gap:"8px"},children:[g.jsxs("div",{style:{flex:1,position:"relative"},children:[g.jsx("span",{className:"material-icons",style:{position:"absolute",left:"10px",top:"50%",transform:"translateY(-50%)",color:l.textSecondary,fontSize:"18px",pointerEvents:"none"},children:"search"}),g.jsx("input",{ref:p,type:"text",value:u,onChange:E,onFocus:x,placeholder:t,style:{width:"100%",padding:"8px 12px 8px 36px",fontSize:"14px",border:`1px solid ${d?l.primary:l.border}`,borderRadius:"6px",background:l.background,color:l.text,outline:"none",boxSizing:"border-box",transition:"border-color 0.15s"}})]}),s&&g.jsx("button",{onClick:D,style:{width:"36px",height:"36px",display:"flex",alignItems:"center",justifyContent:"center",border:`1px solid ${l.border}`,borderRadius:"6px",background:l.background,color:l.primary,cursor:"pointer",fontSize:"18px",fontWeight:"bold",transition:"background 0.15s"},onMouseEnter:_=>{_.currentTarget.style.background=l.cardHover||"#f3f4f6"},onMouseLeave:_=>{_.currentTarget.style.background=l.background||"#ffffff"},title:`Create ${e||"item"}`,children:"+"})]}),d&&g.jsx("div",{style:{position:"absolute",top:"100%",left:0,right:0,marginTop:"4px",maxHeight:typeof i=="number"?`${i}px`:i,overflowY:"auto",border:`1px solid ${l.border}`,borderRadius:"8px",background:l.background,boxShadow:"0 4px 12px rgba(0, 0, 0, 0.15)",zIndex:50},children:m.length===0?g.jsx("div",{style:{padding:"16px",textAlign:"center",color:l.textSecondary,fontSize:"14px"},children:u?`No results for "${u}"`:"No items"}):m.map((_,A)=>g.jsxs("div",{onClick:()=>y(_),style:{padding:"10px 14px",cursor:"pointer",borderBottom:A<m.length-1?`1px solid ${l.border}`:"none",background:l.cardBackground,transition:"background 0.15s"},onMouseEnter:b=>{b.currentTarget.style.background=l.cardHover||"#f3f4f6"},onMouseLeave:b=>{b.currentTarget.style.background=l.cardBackground||"#f9fafb"},children:[g.jsx("div",{style:{fontSize:"14px",fontWeight:500,color:_.color||l.text,marginBottom:_.notes?"2px":0},children:_.label}),_.notes&&g.jsx("div",{style:{fontSize:"12px",color:l.textSecondary,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:_.notes})]},_.id))})]})}function Xf({items:r,columns:e,getItemId:t,getItemColumn:n,getItemOrder:s,renderItem:i,onItemMove:o,onItemReorder:a,onItemClick:l,renderColumnHeader:u,renderColumnFooter:c,className:d="",columnClassName:f="",itemClassName:h=""}){const[p,m]=w.useState(null),[y,D]=w.useState(null),[x,E]=w.useState(null),_=w.useRef(null),A=e.reduce((B,L)=>{let R=r.filter(P=>n(P)===L.id);return s&&(R=R.sort((P,Q)=>s(P)-s(Q))),B[L.id]=R,B},{}),b=w.useCallback((B,L)=>{const R=t(L),P=n(L);m(R),_.current=P,B.dataTransfer.effectAllowed="move",B.dataTransfer.setData("text/plain",R),requestAnimationFrame(()=>{const Q=B.target;Q.style.opacity="0.5"})},[t,n]),v=w.useCallback(B=>{const L=B.target;L.style.opacity="1",m(null),D(null),E(null),_.current=null},[]),S=w.useCallback((B,L,R)=>{B.preventDefault(),B.dataTransfer.dropEffect="move",D(L),E(R)},[]),k=w.useCallback(B=>{const L=B.relatedTarget;L!=null&&L.closest("[data-kanban-column]")||(D(null),E(null))},[]),j=w.useCallback((B,L,R)=>{if(B.preventDefault(),!p)return;const P=_.current;P===L?a==null||a(p,L,R):P&&o(p,P,L,R),m(null),D(null),E(null),_.current=null},[p,o,a]),T=(B,L)=>g.jsxs("div",{className:"flex items-center justify-between px-3 py-2",children:[g.jsxs("div",{className:"flex items-center gap-2",children:[B.color&&g.jsx("div",{className:"w-2 h-2 rounded-full",style:{backgroundColor:B.color}}),g.jsx("span",{className:"font-medium text-sm text-neutral-700",children:B.label})]}),g.jsx("span",{className:"text-xs text-neutral-400 bg-neutral-100 px-2 py-0.5 rounded-full",children:L})]});return g.jsx("div",{className:`flex gap-4 overflow-x-auto pb-4 ${d}`,style:{minHeight:"400px"},children:e.map(B=>{const L=A[B.id]||[],R=y===B.id;return g.jsxs("div",{"data-kanban-column":B.id,className:`flex-1 min-w-[180px] bg-neutral-50 rounded-xl flex flex-col ${f}`,onDragOver:P=>{P.preventDefault(),p&&!R&&D(B.id)},onDragLeave:k,onDrop:P=>j(P,B.id,x??L.length),children:[g.jsx("div",{className:"flex-shrink-0 border-b border-neutral-200",children:u?u(B,L.length):T(B,L.length)}),g.jsxs("div",{className:`flex-1 overflow-y-auto p-2 space-y-2 min-h-[100px] transition-colors ${R?"bg-blue-50":""}`,children:[L.map((P,Q)=>{const se=t(P),xe=p===se,oe=R&&x===Q&&!xe;return g.jsxs("div",{children:[oe&&g.jsx("div",{className:"h-1 bg-blue-500 rounded-full mb-2 mx-1"}),g.jsx("div",{draggable:!0,onDragStart:Se=>b(Se,P),onDragEnd:v,onDragOver:Se=>S(Se,B.id,Q),onClick:()=>l==null?void 0:l(P),className:`cursor-grab active:cursor-grabbing transition-all ${xe?"opacity-50 scale-95":""} ${h}`,children:i(P,xe)})]},se)}),g.jsx("div",{className:"min-h-[40px] flex-1",onDragOver:P=>{P.preventDefault(),S(P,B.id,L.length)},children:R&&x===L.length&&g.jsx("div",{className:"h-1 bg-blue-500 rounded-full mx-1 mt-1"})}),L.length===0&&R&&g.jsx("div",{className:"h-20 border-2 border-dashed border-blue-300 rounded-lg bg-blue-50/50 flex items-center justify-center",children:g.jsx("span",{className:"text-sm text-blue-400",children:"Drop here"})})]}),c&&g.jsx("div",{className:"flex-shrink-0 border-t border-neutral-200 p-2",children:c(B)})]},B.id)})})}const Zf={background:"#ffffff",hourLineColor:"#e5e7eb",halfHourLineColor:"#f3f4f6",hourTextColor:"#9ca3af",currentTimeColor:"#ef4444",allDayBackground:"#f9fafb",allDayBorder:"#e5e7eb"};function eh(r){const e=r.match(/^(\d{1,2}):(\d{2})$/);return e?{hours:parseInt(e[1],10),minutes:parseInt(e[2],10)}:null}function th(r){const e=r%12||12,t=r<12?"AM":"PM";return`${e} ${t}`}function rh(r){const e=new Date;return r.getDate()===e.getDate()&&r.getMonth()===e.getMonth()&&r.getFullYear()===e.getFullYear()}function nh({items:r,date:e,startHour:t=7,endHour:n=22,hourHeight:s=60,getItemTime:i,getItemDuration:o,getItemIsAllDay:a,getItemId:l,renderItem:u,onItemClick:c,onTimeSlotClick:d,showCurrentTime:f=!0,className:h="",theme:p={}}){const m={...Zf,...p},{allDayItems:y,timedItems:D}=w.useMemo(()=>{const v=[],S=[];for(const k of r)a(k)?v.push(k):S.push(k);return{allDayItems:v,timedItems:S}},[r,a]),x=w.useMemo(()=>{const v=[];for(let S=t;S<=n;S++)v.push(S);return v},[t,n]),E=(n-t+1)*s,_=w.useCallback(v=>{const S=i(v);if(!S)return null;const k=eh(S);if(!k)return null;const{hours:j,minutes:T}=k,B=Math.max(t,Math.min(n,j)),L=j<t?0:T,R=(B-t)*s+L/60*s,P=o(v),Q=Math.max(20,P/60*s);return{top:R,height:Q}},[i,o,t,n,s]),A=w.useMemo(()=>{if(!f||!rh(e))return null;const v=new Date,S=v.getHours(),k=v.getMinutes();return S<t||S>n?null:(S-t)*s+k/60*s},[e,f,t,n,s]),b=w.useCallback(v=>{if(!d)return;const S=v.currentTarget.getBoundingClientRect(),j=(v.clientY-S.top)/s*60,T=Math.floor(j/60)+t,B=Math.round(j%60/15)*15,L=Math.min(n,Math.max(t,T)),R=B>=60?0:B,P=`${L.toString().padStart(2,"0")}:${R.toString().padStart(2,"0")}`;d(P)},[d,s,t,n]);return g.jsxs("div",{className:h,style:{background:m.background},children:[y.length>0&&g.jsxs("div",{style:{padding:"8px 0 8px 60px",borderBottom:`1px solid ${m.allDayBorder}`,background:m.allDayBackground},children:[g.jsx("div",{style:{fontSize:"11px",color:m.hourTextColor,marginBottom:"4px",textTransform:"uppercase",letterSpacing:"0.05em"},children:"All Day"}),g.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:"4px"},children:y.map(v=>g.jsx("div",{onClick:()=>c==null?void 0:c(v),style:{cursor:c?"pointer":"default"},children:u(v)},l(v)))})]}),g.jsxs("div",{style:{position:"relative",height:E},children:[x.map((v,S)=>g.jsxs("div",{style:{position:"absolute",top:S*s,left:0,right:0},children:[g.jsx("div",{style:{position:"absolute",left:0,top:-8,width:"50px",textAlign:"right",paddingRight:"10px",fontSize:"11px",color:m.hourTextColor},children:th(v)}),g.jsx("div",{style:{position:"absolute",left:"60px",right:0,top:0,height:"1px",background:m.hourLineColor}}),S<x.length-1&&g.jsx("div",{style:{position:"absolute",left:"60px",right:0,top:s/2,height:"1px",background:m.halfHourLineColor}})]},v)),g.jsx("div",{style:{position:"absolute",left:"60px",right:0,top:0,bottom:0,cursor:d?"pointer":"default"},onClick:b}),A!==null&&g.jsxs("div",{style:{position:"absolute",left:"55px",right:0,top:A,zIndex:20,pointerEvents:"none"},children:[g.jsx("div",{style:{width:"10px",height:"10px",borderRadius:"50%",background:m.currentTimeColor,marginLeft:"-5px",marginTop:"-5px",position:"absolute"}}),g.jsx("div",{style:{marginLeft:"5px",height:"2px",background:m.currentTimeColor}})]}),D.map(v=>{const S=_(v);return S?g.jsx("div",{style:{position:"absolute",left:"64px",right:"8px",top:S.top,height:S.height,zIndex:10,cursor:c?"pointer":"default"},onClick:k=>{k.stopPropagation(),c==null||c(v)},children:u(v)},l(v)):null})]})]})}function sh({onComplete:r,onCancel:e,onTranscribe:t,onTranscriptionComplete:n,variant:s="widget",hideSaveButton:i=!1,maxDuration:o=180}){const a=s==="widget",[l,u]=w.useState("idle"),[c,d]=w.useState(0),[f,h]=w.useState(0),[p,m]=w.useState(!1),[y,D]=w.useState(0),[x,E]=w.useState(null),[_,A]=w.useState(!1),[b,v]=w.useState(null),[S,k]=w.useState(!0),[j,T]=w.useState([]),[B,L]=w.useState({completed:0,total:0}),R=w.useRef(!1),P=w.useRef(!0);w.useEffect(()=>{P.current=S},[S]);const Q=w.useRef(null),se=w.useRef(null),xe=w.useRef(null),oe=w.useRef(null),Se=w.useRef(null),he=w.useRef([]),fe=w.useRef(null),pe=w.useRef(null),ge=w.useRef(null),Ae=w.useRef(null),be=w.useRef(!1),we=w.useRef([]),Re=w.useRef(null),ce=w.useRef(null),je=w.useRef([]),at=w.useRef([]),kt=w.useRef("insert"),zt=w.useRef(!1),nt=w.useRef(0),mt=w.useRef(0),ft=w.useRef(0),Yt=q=>{const N=Math.floor(q/60),H=Math.floor(q%60);return`${N.toString().padStart(2,"0")}:${H.toString().padStart(2,"0")}`},qt=async q=>{const N=await q.arrayBuffer(),H=new AudioContext,Y=await H.decodeAudioData(N);return await H.close(),Y},Tt=q=>{const N=q.numberOfChannels,H=q.sampleRate,Y=1,I=16,re=I/8,Z=N*re,ee=H*Z,me=q.length*Z,Ee=new ArrayBuffer(44+me),te=new DataView(Ee),ne=(Be,ve)=>{for(let Je=0;Je<ve.length;Je++)te.setUint8(Be+Je,ve.charCodeAt(Je))};ne(0,"RIFF"),te.setUint32(4,36+me,!0),ne(8,"WAVE"),ne(12,"fmt "),te.setUint32(16,16,!0),te.setUint16(20,Y,!0),te.setUint16(22,N,!0),te.setUint32(24,H,!0),te.setUint32(28,ee,!0),te.setUint16(32,Z,!0),te.setUint16(34,I,!0),ne(36,"data"),te.setUint32(40,me,!0);const ze=[];for(let Be=0;Be<N;Be++)ze.push(q.getChannelData(Be));let We=44;for(let Be=0;Be<q.length;Be++)for(let ve=0;ve<N;ve++){const Je=Math.max(-1,Math.min(1,ze[ve][Be])),Ye=Je<0?Je*32768:Je*32767;te.setInt16(We,Ye,!0),We+=2}return new Blob([Ee],{type:"audio/wav"})},Nt=async(q,N,H,Y)=>{const I=new AudioContext,re=q.sampleRate,Z=Math.max(q.numberOfChannels,N.numberOfChannels),ee=Math.min(H,q.length),me=Math.max(0,q.length-H),Ee=Y==="insert"?ee+N.length+me:ee+N.length,te=I.createBuffer(Z,Ee,re);for(let ne=0;ne<Z;ne++){const ze=te.getChannelData(ne),We=ne<q.numberOfChannels?q.getChannelData(ne):q.getChannelData(0);for(let ve=0;ve<ee;ve++)ze[ve]=We[ve];const Be=ne<N.numberOfChannels?N.getChannelData(ne):N.getChannelData(0);for(let ve=0;ve<N.length;ve++)ze[ee+ve]=Be[ve];if(Y==="insert")for(let ve=0;ve<me;ve++)ze[ee+N.length+ve]=We[H+ve]}return await I.close(),te},ut=w.useCallback(()=>{const q=Q.current;if(!q)return;const N=q.getContext("2d");if(!N)return;const H=q.getBoundingClientRect(),Y=H.width,I=H.height,re=we.current,Z=f||c||1,ee=l==="recording"?c:y;N.fillStyle="#2d3b35",N.fillRect(0,0,Y,I);const me=8,Ee="rgba(0, 0, 0, 0.4)",te=N.createLinearGradient(0,0,0,me);te.addColorStop(0,Ee),te.addColorStop(1,"transparent"),N.fillStyle=te,N.fillRect(0,0,Y,me);const ne=N.createLinearGradient(0,I-me,0,I);ne.addColorStop(0,"transparent"),ne.addColorStop(1,Ee),N.fillStyle=ne,N.fillRect(0,I-me,Y,me);const ze=N.createLinearGradient(0,0,me,0);ze.addColorStop(0,Ee),ze.addColorStop(1,"transparent"),N.fillStyle=ze,N.fillRect(0,0,me,I);const We=N.createLinearGradient(Y-me,0,Y,0);We.addColorStop(0,"transparent"),We.addColorStop(1,Ee),N.fillStyle=We,N.fillRect(Y-me,0,me,I),N.strokeStyle="#5a6b62",N.lineWidth=1,N.beginPath(),N.moveTo(0,I/2),N.lineTo(Y,I/2),N.stroke();const Be=Y/2;if(re.length>0)if(l==="recording")for(let Ye=0;Ye<re.length;Ye++){const ht=re.length-1-Ye,Wt=Be-ht*4;if(Wt<-3||Wt>Y)continue;const bt=re[Ye]*(I/2-12),C=I/2-bt;N.fillStyle="#10b981",N.fillRect(Wt,C,3,bt*2)}else{const Ye=Z>0?ee/Z*re.length:0;for(let ht=0;ht<re.length;ht++){const Wt=Ye-ht,bt=Be-Wt*4;if(bt<-3||bt>Y)continue;const C=re[ht]*(I/2-12),M=I/2-C;N.fillStyle=ht<=Ye?"#10b981":"#4b5563",N.fillRect(bt,M,3,C*2)}}N.strokeStyle="#ef4444",N.lineWidth=1,N.beginPath(),N.moveTo(Be,0),N.lineTo(Be,I),N.stroke(),N.fillStyle="#fff",N.font="bold 18px monospace",N.textAlign="center",N.fillText(Yt(ee),Be,I-6),l==="recording"&&(N.fillStyle="#ef4444",N.beginPath(),N.arc(20,20,8,0,Math.PI*2),N.fill(),N.fillStyle="#fff",N.font="10px sans-serif",N.textAlign="left",N.fillText("REC",34,24)),N.textAlign="left"},[l,y,c,f]),yt=()=>{const q=Se.current;if(!q||!be.current)return;const N=q.frequencyBinCount,H=new Uint8Array(N);q.getByteTimeDomainData(H);let Y=0;for(let Z=0;Z<N;Z++){const ee=(H[Z]-128)/128;Y+=ee*ee}const I=Math.sqrt(Y/N),re=Math.min(1,I*3);we.current.push(re),ut(),be.current&&(pe.current=requestAnimationFrame(yt))},W=async()=>{try{E(null),A(!1),Re.current===null&&(we.current=[]);const q=await navigator.mediaDevices.getUserMedia({audio:!0});xe.current=q;const N=new AudioContext;oe.current=N;const H=N.createAnalyser();H.fftSize=2048,Se.current=H,N.createMediaStreamSource(q).connect(H);const I=new MediaRecorder(q);se.current=I,he.current=[],I.ondataavailable=re=>{re.data.size>0&&he.current.push(re.data)},I.onstop=async()=>{try{if(be.current=!1,he.current.length===0){E("No audio was recorded. Please try again."),u("idle"),q.getTracks().forEach(te=>te.stop());return}const re=new Blob(he.current,{type:"audio/webm"});let Z,ee;if(Re.current!==null&&ce.current)try{const te=await qt(re),ne=ce.current.sampleRate,ze=Math.floor(Re.current*ne),We=await Nt(ce.current,te,ze,kt.current);Z=Tt(We),ee=We.length/We.sampleRate,kt.current==="insert"&&(we.current=[...we.current,...at.current]),Re.current=null,ce.current=null,je.current=[],at.current=[]}catch{Z=re,ee=nt.current>0?nt.current:1}else Z=re,ee=nt.current>0?nt.current:1;if(Ae.current=Z,q.getTracks().forEach(te=>te.stop()),P.current&&t){T(te=>[...te,Z]),L(te=>({...te,total:te.total+1})),Ae.current=null,we.current=[],D(0),h(0),d(0),u("idle");return}const me=URL.createObjectURL(Z),Ee=new Audio(me);Ee.ontimeupdate=()=>{D(Ee.currentTime)},Ee.onended=()=>{m(!1)},ge.current=Ee,h(ee),D(ee),u("editing")}catch{E("Failed to process recording"),u("idle")}},I.start(100),be.current=!0,u("recording"),d(0),nt.current=0,fe.current=setInterval(()=>{nt.current+=1,d(nt.current),nt.current>=o&&(se.current&&se.current.state!=="inactive"&&se.current.stop(),be.current=!1,v(null),fe.current&&(clearInterval(fe.current),fe.current=null),pe.current&&(cancelAnimationFrame(pe.current),pe.current=null),setTimeout(()=>{alert(`Maximum recording time of ${Math.floor(o/60)} minutes reached.`)},100))},1e3)}catch{E("Could not access microphone. Please allow microphone access.")}},De=()=>{be.current=!1,A(!1),v(null),pe.current&&(cancelAnimationFrame(pe.current),pe.current=null),fe.current&&(clearInterval(fe.current),fe.current=null),se.current&&se.current.state!=="inactive"&&se.current.stop()},Te=q=>{const N=Q.current;if(!N)return;const H=f||c;if(H<=0)return;const Y=we.current;if(Y.length===0)return;const I=N.getBoundingClientRect(),re=q-mt.current,Z=4,ee=I.width/N.width,me=Y.length/H*Z,Ee=-re/(me*ee),te=ft.current+Ee,ne=Math.max(0,Math.min(te,H));ge.current&&(ge.current.currentTime=ne),D(ne)},ke=()=>{ge.current&&(ge.current.currentTime=0),D(0)},Bt=()=>{const q=f||c;ge.current&&(ge.current.currentTime=q),D(q)},Ft=()=>{const q=ge.current;q&&(p?(q.pause(),D(q.currentTime),m(!1)):(q.currentTime=y,q.play().catch(()=>{}),m(!0)))},Ut=async q=>{if(!Ae.current){W();return}try{ge.current&&(ge.current.pause(),m(!1)),kt.current=q,ce.current=await qt(Ae.current);const N=f||c;Re.current=y;const H=N>0?y/N:0,Y=Math.floor(H*we.current.length);je.current=we.current.slice(0,Y),at.current=we.current.slice(Y),we.current=[...je.current],W()}catch{E("Failed to prepare recording. Please try again.")}},V=()=>{ge.current&&(ge.current.pause(),ge.current=null),Ae.current=null,ce.current=null,Re.current=null,je.current=[],m(!1),D(0),h(0),d(0),W()},J=()=>{Ae.current?r(Ae.current,f||c):alert("No audio recorded yet!")};w.useEffect(()=>{l==="recording"&&Q.current&&Se.current&&be.current&&(pe.current=requestAnimationFrame(yt))},[l]),w.useEffect(()=>{const q=Q.current;if(!q)return;const N=()=>{const H=window.devicePixelRatio||1,Y=q.getBoundingClientRect();q.width=Y.width*H,q.height=Y.height*H;const I=q.getContext("2d");I&&I.scale(H,H)};return N(),window.addEventListener("resize",N),()=>window.removeEventListener("resize",N)},[]),w.useEffect(()=>{if(l==="idle"){const q=Q.current;if(!q)return;const N=q.getContext("2d");if(!N)return;const H=q.getBoundingClientRect(),Y=H.width,I=H.height;N.fillStyle="#2d3b35",N.fillRect(0,0,Y,I);const re=8,Z="rgba(0, 0, 0, 0.4)",ee=N.createLinearGradient(0,0,0,re);ee.addColorStop(0,Z),ee.addColorStop(1,"transparent"),N.fillStyle=ee,N.fillRect(0,0,Y,re);const me=N.createLinearGradient(0,I-re,0,I);me.addColorStop(0,"transparent"),me.addColorStop(1,Z),N.fillStyle=me,N.fillRect(0,I-re,Y,re);const Ee=N.createLinearGradient(0,0,re,0);Ee.addColorStop(0,Z),Ee.addColorStop(1,"transparent"),N.fillStyle=Ee,N.fillRect(0,0,re,I);const te=N.createLinearGradient(Y-re,0,Y,0);te.addColorStop(0,"transparent"),te.addColorStop(1,Z),N.fillStyle=te,N.fillRect(Y-re,0,re,I),N.strokeStyle="#5a6b62",N.lineWidth=1,N.beginPath(),N.moveTo(0,I/2),N.lineTo(Y,I/2),N.stroke();const ne=Y/2;N.strokeStyle="#ef4444",N.lineWidth=1,N.beginPath(),N.moveTo(ne,0),N.lineTo(ne,I),N.stroke(),N.fillStyle="#fff",N.font="bold 18px monospace",N.textAlign="center",N.fillText("00:00",ne,I-6)}},[l]);const Ne=w.useCallback(q=>{T(N=>[...N,q]),L(N=>({...N,total:N.total+1}))},[]);if(w.useEffect(()=>{(async()=>{if(R.current||j.length===0||!t)return;R.current=!0;const N=j[0];try{const H=await t(N);H&&n&&n(H)}catch(H){console.error("Transcription failed:",H)}finally{T(H=>H.slice(1)),L(H=>({...H,completed:H.completed+1})),R.current=!1}})()},[j,t,n]),w.useEffect(()=>()=>{be.current=!1,fe.current&&clearInterval(fe.current),pe.current&&cancelAnimationFrame(pe.current),xe.current&&xe.current.getTracks().forEach(q=>q.stop()),oe.current&&oe.current.state!=="closed"&&oe.current.close()},[]),w.useEffect(()=>{if(l==="editing"&&p){let q;const N=()=>{const H=ge.current;if(H&&p){const Y=Q.current;if(Y){const I=Y.getContext("2d");if(I){const re=Y.getBoundingClientRect(),Z=re.width,ee=re.height,me=we.current,Ee=f||c||1,te=H.currentTime;I.fillStyle="#2d3b35",I.fillRect(0,0,Z,ee);const ne=8,ze="rgba(0, 0, 0, 0.4)",We=I.createLinearGradient(0,0,0,ne);We.addColorStop(0,ze),We.addColorStop(1,"transparent"),I.fillStyle=We,I.fillRect(0,0,Z,ne);const Be=I.createLinearGradient(0,ee-ne,0,ee);Be.addColorStop(0,"transparent"),Be.addColorStop(1,ze),I.fillStyle=Be,I.fillRect(0,ee-ne,Z,ne);const ve=I.createLinearGradient(0,0,ne,0);ve.addColorStop(0,ze),ve.addColorStop(1,"transparent"),I.fillStyle=ve,I.fillRect(0,0,ne,ee);const Je=I.createLinearGradient(Z-ne,0,Z,0);Je.addColorStop(0,"transparent"),Je.addColorStop(1,ze),I.fillStyle=Je,I.fillRect(Z-ne,0,ne,ee),I.strokeStyle="#5a6b62",I.lineWidth=1,I.beginPath(),I.moveTo(0,ee/2),I.lineTo(Z,ee/2),I.stroke();const Ye=Z/2,ht=3,Wt=4,bt=Ee>0?te/Ee*me.length:0;for(let U=0;U<me.length;U++){const X=bt-U,ue=Ye-X*Wt;if(ue<-ht||ue>Z)continue;const _e=me[U]*(ee/2-12),le=ee/2-_e;I.fillStyle=U<=bt?"#10b981":"#4b5563",I.fillRect(ue,le,ht,_e*2)}I.strokeStyle="#ef4444",I.lineWidth=1,I.beginPath(),I.moveTo(Ye,0),I.lineTo(Ye,ee),I.stroke(),I.fillStyle="#fff",I.font="bold 18px monospace",I.textAlign="center";const C=Math.floor(te/60),M=Math.floor(te%60);I.fillText(`${C.toString().padStart(2,"0")}:${M.toString().padStart(2,"0")}`,Ye,ee-6),I.textAlign="left"}}q=requestAnimationFrame(N)}};return q=requestAnimationFrame(N),()=>cancelAnimationFrame(q)}},[l,p,f,c]),w.useEffect(()=>{l==="editing"&&!p&&ut()},[l,y,p,ut]),x)return g.jsxs("div",{style:{border:"1px solid #fecaca",borderRadius:"12px",padding:"16px",background:"#fef2f2"},children:[g.jsx("p",{style:{fontSize:"14px",color:"#dc2626",marginBottom:"12px"},children:x}),g.jsx("button",{onClick:()=>{E(null),W()},style:{padding:"8px 16px",fontSize:"14px",background:"#171717",color:"white",borderRadius:"8px",border:"none",cursor:"pointer"},children:"Try Again"})]});const Oe={padding:"8px",borderRadius:"8px",border:"none",background:"transparent",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",transition:"background 0.15s"},Ie={...Oe,opacity:.3,cursor:"not-allowed"},xt=a?{border:"1px solid #e5e5e5",borderRadius:"12px",overflow:"hidden",background:"white"}:{overflow:"hidden",background:"white",flexShrink:0};return g.jsxs("div",{style:xt,children:[g.jsx("canvas",{ref:Q,style:{width:"100%",height:"32px",cursor:"pointer",flexShrink:0},onMouseDown:q=>{if(l==="editing"){zt.current=!0,mt.current=q.clientX,ft.current=y;const N=Y=>{zt.current&&Te(Y.clientX)},H=()=>{zt.current=!1,window.removeEventListener("mousemove",N),window.removeEventListener("mouseup",H)};window.addEventListener("mousemove",N),window.addEventListener("mouseup",H)}}}),g.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:a?"6px 8px":"4px",borderTop:"1px solid #d4d4d4",background:"linear-gradient(to bottom, #e0e0e0 0%, #c8c8c8 100%)",boxShadow:"inset 0 1px 0 rgba(255,255,255,0.6), inset 0 -1px 0 rgba(0,0,0,0.1)",flexShrink:0},children:[g.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"4px"},children:[g.jsx("button",{onClick:ke,disabled:l==="idle"||l==="recording",style:l==="idle"||l==="recording"?Ie:Oe,title:"Go to start",children:g.jsx("span",{className:"material-icons",style:{fontSize:"20px",color:"#171717"},children:"first_page"})}),g.jsx("button",{onClick:()=>{if(l==="recording"){const q=se.current;q&&(q.state==="recording"?(q.pause(),A(!0)):q.state==="paused"&&(q.resume(),A(!1)))}else Ft()},disabled:l==="idle",style:l==="idle"?Ie:Oe,title:p||l==="recording"&&!_?"Pause":"Play",children:g.jsx("span",{className:"material-icons",style:{fontSize:"20px",color:"#171717"},children:p||l==="recording"&&!_?"pause":"play_arrow"})}),g.jsx("button",{onClick:Bt,disabled:l==="idle"||l==="recording",style:l==="idle"||l==="recording"?Ie:Oe,title:"Go to end",children:g.jsx("span",{className:"material-icons",style:{fontSize:"20px",color:"#171717"},children:"last_page"})}),g.jsx("div",{style:{width:"1px",height:"24px",margin:"0 4px",background:"linear-gradient(to bottom, rgba(255,255,255,0.5), rgba(0,0,0,0.15))"}}),g.jsx("button",{onClick:()=>{b==="insert"?De():l==="idle"?(v("insert"),W()):l==="editing"&&(v("insert"),Ut("insert"))},disabled:l==="recording"&&b!=="insert"||p,style:l==="recording"&&b!=="insert"||p?Ie:Oe,title:b==="insert"?"Stop recording":"Insert recording",children:g.jsx("span",{className:"material-icons",style:{fontSize:"20px",color:b==="insert"?"#ef4444":"#171717"},children:"add"})}),g.jsx("button",{onClick:()=>{P.current||(b==="mic"?De():l==="idle"?(v("mic"),W()):l==="editing"&&(v("mic"),Ut("replace")))},onMouseDown:()=>{P.current&&l==="idle"&&!p&&(v("mic"),W())},onMouseUp:()=>{P.current&&l==="recording"&&b==="mic"&&De()},onMouseLeave:()=>{P.current&&l==="recording"&&b==="mic"&&De()},onTouchStart:()=>{P.current&&l==="idle"&&!p&&(v("mic"),W())},onTouchEnd:()=>{P.current&&l==="recording"&&b==="mic"&&De()},disabled:l==="recording"&&b!=="mic"||p,style:l==="recording"&&b!=="mic"||p?Ie:Oe,title:S?"Hold to record (walkie-talkie)":b==="mic"?"Stop recording":"Record",children:g.jsx("span",{className:"material-icons",style:{fontSize:"20px",color:b==="mic"?"#ef4444":"#171717"},children:"mic"})}),g.jsx("button",{onClick:()=>{b==="startover"?De():l==="editing"&&(v("startover"),V())},disabled:l==="idle"||l==="recording"&&b!=="startover"||p,style:l==="idle"||l==="recording"&&b!=="startover"||p?Ie:Oe,title:b==="startover"?"Stop recording":"Start over",children:g.jsx("span",{className:"material-icons",style:{fontSize:"20px",color:b==="startover"?"#ef4444":"#171717"},children:"refresh"})})]}),g.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"4px"},children:[B.total>0&&B.completed<B.total&&g.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"4px",padding:"4px 8px",background:"rgba(16, 185, 129, 0.1)",borderRadius:"4px",fontSize:"11px",color:"#10b981"},children:[g.jsx("span",{className:"material-icons",style:{fontSize:"14px",animation:"spin 1s linear infinite"},children:"sync"}),B.completed,"/",B.total]}),t&&g.jsxs(g.Fragment,{children:[g.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"4px",marginRight:"4px"},children:[g.jsx("button",{onClick:()=>k(!S),style:{width:"28px",height:"16px",borderRadius:"8px",border:"none",background:S?"#10b981":"#9ca3af",cursor:"pointer",position:"relative",transition:"background 0.2s",padding:0},title:S?"Auto-transcribe ON":"Auto-transcribe OFF",children:g.jsx("div",{style:{width:"12px",height:"12px",borderRadius:"50%",background:"white",position:"absolute",top:"2px",left:S?"14px":"2px",transition:"left 0.2s",boxShadow:"0 1px 2px rgba(0,0,0,0.2)"}})}),g.jsx("span",{style:{fontSize:"10px",color:"#666"},children:"auto"})]}),g.jsx("button",{onClick:()=>{l==="editing"&&Ae.current&&Ne(Ae.current)},disabled:l!=="editing",style:l!=="editing"?Ie:Oe,title:"Transcribe audio",children:g.jsx("span",{className:"material-icons",style:{fontSize:"20px",color:S?"#10b981":"#171717"},children:"subtitles"})})]}),!i&&g.jsx("button",{onClick:J,disabled:l!=="editing",style:l!=="editing"?Ie:Oe,title:"Save recording",children:g.jsx("span",{className:"material-icons",style:{fontSize:"20px",color:"#171717"},children:"save"})})]})]}),B.total>0&&B.completed<B.total&&g.jsx("div",{style:{height:"3px",background:"#e5e5e5",overflow:"hidden"},children:g.jsx("div",{style:{height:"100%",background:"#10b981",width:`${B.completed/B.total*100}%`,transition:"width 0.3s ease"}})})]})}exports.$createQRCodeNode=Qi;exports.$isQRCodeNode=If;exports.AnimatedCardFlip=Ou;exports.ApiClient=wl;exports.AudioEditor=sh;exports.AuthManager=Cl;exports.Card=Mu;exports.ComboBox=Qf;exports.ComboStack=Yf;exports.DataOperations=$n;exports.Detail=Pu;exports.GraphClient=cu;exports.KanbanBoard=Xf;exports.Mail=$u;exports.MailClient=vl;exports.MailComposer=Kf;exports.MailEditor=su;exports.QRCodeNode=Ur;exports.SelectableList=zu;exports.Stack=Lu;exports.Timeline=nh;exports.getApiClient=xi;exports.initializeApiClient=Nu;exports.useMutation=Bu;exports.useQuery=Dl;
package/dist/index.esm.js CHANGED
@@ -14027,15 +14027,22 @@ function mh({
14027
14027
  children: [
14028
14028
  /* @__PURE__ */ g.jsxs("div", { style: { display: "flex", gap: "8px" }, children: [
14029
14029
  /* @__PURE__ */ g.jsxs("div", { style: { flex: 1, position: "relative" }, children: [
14030
- /* @__PURE__ */ g.jsx("span", { style: {
14031
- position: "absolute",
14032
- left: "12px",
14033
- top: "50%",
14034
- transform: "translateY(-50%)",
14035
- color: l.textSecondary,
14036
- fontSize: "14px",
14037
- pointerEvents: "none"
14038
- }, children: "🔍" }),
14030
+ /* @__PURE__ */ g.jsx(
14031
+ "span",
14032
+ {
14033
+ className: "material-icons",
14034
+ style: {
14035
+ position: "absolute",
14036
+ left: "10px",
14037
+ top: "50%",
14038
+ transform: "translateY(-50%)",
14039
+ color: l.textSecondary,
14040
+ fontSize: "18px",
14041
+ pointerEvents: "none"
14042
+ },
14043
+ children: "search"
14044
+ }
14045
+ ),
14039
14046
  /* @__PURE__ */ g.jsx(
14040
14047
  "input",
14041
14048
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qwanyx/stack",
3
- "version": "0.2.65",
3
+ "version": "0.2.66",
4
4
  "description": "Modern HyperCard for React - All-in-one data management (REST + Graph API + Auth + Hooks + UI)",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.esm.js",