@realtimex/realtimex-alchemy 1.0.17 → 1.0.18
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/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [1.0.18] - 2026-01-21
|
|
9
|
+
|
|
10
|
+
### Fixed
|
|
11
|
+
- **UI**: Increased container padding in `NewSignalsFeed` and `CategoryGrid` to completely eliminate clipping during hover scale animations.
|
|
12
|
+
- **Styling**: Added `z-index` management to `CategoryCard` to ensuring scaling cards always float above their neighbors.
|
|
13
|
+
|
|
8
14
|
## [1.0.17] - 2026-01-21
|
|
9
15
|
|
|
10
16
|
### Fixed
|
|
@@ -98,7 +98,7 @@ ${e.entities.map(y=>`- ${y}`).join(`
|
|
|
98
98
|
`:""}
|
|
99
99
|
${e.content?`
|
|
100
100
|
## Full Content
|
|
101
|
-
${e.content}`:""}`,d=new Blob([c],{type:"text/markdown"}),f=URL.createObjectURL(d),p=document.createElement("a");p.href=f,p.download=`${e.title.replace(/[^a-z0-9]/gi,"_").toLowerCase()}.md`,p.click(),URL.revokeObjectURL(f)},l=()=>{const c=JSON.stringify(e,null,2),d=new Blob([c],{type:"application/json"}),f=URL.createObjectURL(d),p=document.createElement("a");p.href=f,p.download=`signal_${e.id}.json`,p.click(),URL.revokeObjectURL(f)};return g.jsx(_n,{children:g.jsx(ze.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 z-50 flex items-center justify-center p-4 bg-bg/80 backdrop-blur-sm",onClick:t,children:g.jsxs(ze.div,{initial:{opacity:0,scale:.95,y:20},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:20},onClick:c=>c.stopPropagation(),className:"w-full max-w-4xl max-h-[90vh] glass flex flex-col overflow-hidden",children:[g.jsxs("div",{className:"p-6 border-b border-border/10 flex items-start justify-between",children:[g.jsxs("div",{className:"flex-1 min-w-0 pr-4",children:[g.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[g.jsx("span",{className:"px-2 py-0.5 bg-primary/10 text-primary text-[10px] font-bold rounded border border-primary/20 uppercase tracking-wider",children:e.category||"Research"}),g.jsx("span",{className:`text-3xl font-black ${e.score>=80?"text-accent":"text-fg/40"}`,children:e.score})]}),g.jsx("h2",{className:"text-2xl font-bold leading-tight mb-2",children:e.title}),g.jsxs("p",{className:"text-xs text-fg/40 font-mono",children:["Discovered ",new Date(e.date).toLocaleDateString([],{month:"long",day:"numeric",year:"numeric"})]})]}),g.jsx("button",{onClick:t,className:"p-2 hover:bg-surface rounded-lg text-fg/40 hover:text-fg transition-all",children:g.jsx(Cr,{size:24})})]}),g.jsxs("div",{className:"flex-1 overflow-y-auto custom-scrollbar p-6 space-y-6",children:[e.url&&g.jsxs("div",{className:"space-y-2",children:[g.jsx("label",{className:"text-xs font-bold uppercase tracking-widest text-fg/40",children:"Original Source"}),g.jsxs("a",{href:e.url,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-2 p-3 glass hover:bg-surface transition-all rounded-xl text-sm font-mono text-primary hover:text-accent group",children:[g.jsx(Hl,{size:16,className:"flex-shrink-0"}),g.jsx("span",{className:"truncate",children:e.url}),g.jsx("span",{className:"ml-auto text-xs opacity-0 group-hover:opacity-100 transition-opacity",children:"Open →"})]})]}),e.entities&&e.entities.length>0&&g.jsxs("div",{className:"space-y-2",children:[g.jsx("label",{className:"text-xs font-bold uppercase tracking-widest text-fg/40",children:"Entities"}),g.jsx("div",{className:"flex flex-wrap gap-2",children:e.entities.map(c=>g.jsx("span",{className:"px-3 py-1.5 bg-surface/50 border border-border/20 rounded-lg text-sm font-medium",children:c},c))})]}),g.jsxs("div",{className:"space-y-2",children:[g.jsx("label",{className:"text-xs font-bold uppercase tracking-widest text-fg/40",children:"AI Summary"}),g.jsx("div",{className:"p-4 glass rounded-xl",children:g.jsx("p",{className:"text-sm leading-relaxed text-fg/80",children:e.summary})})]}),e.content&&g.jsxs("div",{className:"space-y-2",children:[g.jsx("label",{className:"text-xs font-bold uppercase tracking-widest text-fg/40",children:"Full Content"}),g.jsx("div",{className:"p-4 glass rounded-xl max-h-96 overflow-y-auto custom-scrollbar",children:g.jsx("p",{className:"text-sm leading-relaxed text-fg/60 whitespace-pre-wrap",children:e.content})})]})]}),g.jsxs("div",{className:"p-6 border-t border-border/10 flex items-center gap-3",children:[g.jsxs("button",{onClick:o,className:"flex-1 py-3 glass hover:bg-surface transition-all rounded-xl text-sm font-bold uppercase tracking-widest flex items-center justify-center gap-2",children:[n?g.jsx(ko,{size:16,className:"text-success"}):g.jsx(Av,{size:16}),n?"Copied!":"Copy"]}),g.jsxs("button",{onClick:a,className:"flex-1 py-3 glass hover:bg-surface transition-all rounded-xl text-sm font-bold uppercase tracking-widest flex items-center justify-center gap-2",children:[g.jsx(Dg,{size:16}),"Markdown"]}),g.jsxs("button",{onClick:l,className:"flex-1 py-3 glass hover:bg-surface transition-all rounded-xl text-sm font-bold uppercase tracking-widest flex items-center justify-center gap-2",children:[g.jsx(Dg,{size:16}),"JSON"]})]})]})})})}function CN({isOpen:e,onClose:t}){const{showToast:n}=Yw(),[r,o]=L.useState(""),[a,l]=L.useState(50),[c,d]=L.useState(!1),[f,p]=L.useState(!1);L.useEffect(()=>{e&&y()},[e]);const y=async()=>{const{data:{user:b}}=await Ee.auth.getUser();if(!b)return;const{data:S}=await Ee.from("alchemy_settings").select("*").eq("user_id",b.id).maybeSingle();if(S)if(l(S.max_urls_per_sync||50),S.sync_start_date){const _=new Date(S.sync_start_date),E=j=>j<10?"0"+j:j,P=_.getFullYear()+"-"+E(_.getMonth()+1)+"-"+E(_.getDate())+"T"+E(_.getHours())+":"+E(_.getMinutes());o(P)}else o("")},v=async()=>{d(!0);try{const{data:{user:b}}=await Ee.auth.getUser();if(!b){n("Please log in to save settings","error"),d(!1);return}const{error:S}=await Ee.from("alchemy_settings").update({max_urls_per_sync:a,sync_start_date:r?new Date(r).toISOString():null}).eq("user_id",b.id);S?n(`Failed to save: ${S.message}`,"error"):(n("Sync settings saved successfully","success"),t())}catch(b){n(`Unexpected error: ${b.message}`,"error")}finally{d(!1)}},w=async()=>{p(!0);try{const{data:{user:b}}=await Ee.auth.getUser();if(!b){n("Please log in to reset checkpoint","error"),p(!1);return}const{error:S}=await Ee.from("alchemy_settings").update({last_sync_checkpoint:null}).eq("user_id",b.id);S?n(`Failed to reset: ${S.message}`,"error"):n("Checkpoint reset successfully","success")}catch(b){n(`Unexpected error: ${b.message}`,"error")}finally{p(!1)}};return e?g.jsx("div",{className:"fixed inset-0 bg-black/50 backdrop-blur-sm flex items-center justify-center z-50 p-4",children:g.jsxs("div",{className:"bg-surface border border-border/20 rounded-2xl shadow-2xl max-w-lg w-full max-h-[90vh] overflow-y-auto",children:[g.jsxs("div",{className:"flex items-center justify-between p-6 border-b border-border/10",children:[g.jsx("h2",{className:"text-xl font-bold",children:"Sync Settings"}),g.jsx("button",{onClick:t,className:"p-2 hover:bg-black/10 rounded-lg transition-colors",children:g.jsx(Cr,{className:"w-5 h-5"})})]}),g.jsxs("div",{className:"p-6 space-y-6",children:[g.jsxs("div",{className:"space-y-3",children:[g.jsxs("label",{className:"text-sm font-semibold flex items-center gap-2",children:[g.jsx(Xk,{className:"w-4 h-4 text-primary"}),"Sync From (Optional)"]}),g.jsx("input",{type:"datetime-local",value:r,onChange:b=>o(b.target.value),className:"w-full bg-black/20 border border-border/10 rounded-xl py-3 px-4 text-sm focus:border-primary/30 outline-none transition-all"}),g.jsx("p",{className:"text-xs text-fg/50",children:"Leave empty to sync only new URLs since last sync (incremental). Set a date to process URLs from that point forward."})]}),g.jsxs("div",{className:"space-y-3",children:[g.jsxs("div",{className:"flex justify-between items-center",children:[g.jsxs("label",{className:"text-sm font-semibold flex items-center gap-2",children:[g.jsx(iS,{className:"w-4 h-4 text-primary"}),"URLs per Sync"]}),g.jsx("span",{className:"text-sm font-mono text-primary",children:a})]}),g.jsx("input",{type:"range",min:"5",max:"200",step:"5",value:a,onChange:b=>l(Number(b.target.value)),className:"w-full h-2 bg-black/20 rounded-lg appearance-none cursor-pointer accent-primary"}),g.jsxs("div",{className:"flex justify-between text-xs text-fg/30 font-medium",children:[g.jsx("span",{children:"Quick (5)"}),g.jsx("span",{children:"Balanced (50)"}),g.jsx("span",{children:"Thorough (200)"})]})]}),g.jsxs("div",{className:"pt-4 border-t border-border/10",children:[g.jsxs("button",{onClick:w,disabled:f,className:"w-full px-4 py-2.5 bg-warning/10 hover:bg-warning/20 border border-warning/20 text-warning font-medium rounded-xl transition-all flex items-center justify-center gap-2 text-sm disabled:opacity-50",children:[g.jsx(yS,{size:16,className:f?"animate-spin":""}),f?"Resetting...":"Reset Checkpoint"]}),g.jsx("p",{className:"text-xs text-fg/40 mt-2 text-center",children:'Clear the sync checkpoint to force a full re-sync from your "Sync From" date'})]}),g.jsx("div",{className:"p-4 bg-primary/5 rounded-xl",children:g.jsx("p",{className:"text-xs text-primary/60 leading-relaxed",children:'The Alchemist tracks your progress automatically. Use "Sync From" to backfill history or "Reset Checkpoint" to start fresh.'})})]}),g.jsxs("div",{className:"flex gap-3 p-6 border-t border-border/10",children:[g.jsx("button",{onClick:t,className:"flex-1 px-4 py-2.5 bg-surface hover:bg-black/10 border border-border/10 rounded-xl font-medium transition-all",children:"Cancel"}),g.jsxs("button",{onClick:v,disabled:c,className:"flex-1 px-4 py-2.5 bg-gradient-to-r from-primary to-accent text-white font-bold rounded-xl shadow-lg hover:scale-[1.02] active:scale-95 transition-all flex items-center justify-center gap-2 disabled:opacity-50",children:[g.jsx(Al,{size:18,className:c?"animate-spin":""}),c?"Saving...":"Save Settings"]})]})]})}):null}function jN(){const[e,t]=L.useState([]),[n,r]=L.useState(!0),[o,a]=L.useState(null),[l,c]=L.useState(null),[d,f]=L.useState([]),[p,y]=L.useState([]),[v,w]=L.useState([]),[b,S]=L.useState(!1);L.useEffect(()=>{_()},[]);const _=async()=>{r(!0);try{const{data:{user:z}}=await Ee.auth.getUser();if(!z)return;const{data:q,error:J}=await Ee.from("processing_events").select("*").eq("user_id",z.id).eq("agent_state","Completed").order("created_at",{ascending:!1}).limit(50);if(J){console.error("Error fetching sync runs:",J);return}const ie=(q||[]).map(re=>{const Q=re.metadata||{},ye=Q.errors||0,ne=Q.signals_found||0,Z=Q.skipped||0;return{id:re.id,started_at:re.created_at,completed_at:re.created_at,duration_ms:re.duration_ms||0,signals_found:ne,urls_processed:Q.total_urls||0,skipped:Z,errors:ye,status:ye>0?"partial":ne>0?"success":"failed"}});t(ie)}catch(z){console.error("Failed to fetch sync runs:",z)}finally{r(!1)}},E=async z=>{S(!0);try{const{data:{user:q}}=await Ee.auth.getUser();if(!q)return;const J=e.find(H=>H.id===z);if(!J)return;const ie=new Date(new Date(J.started_at).getTime()-J.duration_ms),re=new Date(J.completed_at),{data:Q,error:ye}=await Ee.from("processing_events").select("*").eq("user_id",q.id).gte("created_at",ie.toISOString()).lte("created_at",re.toISOString()).order("created_at",{ascending:!0});if(ye){console.error("Error fetching run events:",ye);return}f(Q||[]);const ne=[],Z=(Q||[]).filter(H=>H.agent_state==="Mining"&&H.message.includes("Mining source:"));for(const H of Z){const oe=H.message.match(/Mining source: (.+) \((.+)\)/);if(oe){const T=oe[1],N=oe[2],V=(Q||[]).find(ve=>ve.agent_state==="Mining"&&ve.message.includes("Found")&&ve.message.includes(T)&&ve.created_at>H.created_at),C=V?.message.match(/Found (\d+) URLs/),X=C?parseInt(C[1]):0;ne.push({label:T,browser:N,urls_found:X,duration_ms:V?.duration_ms||0,status:H.event_type==="error"?"error":"success"})}}y(ne);const fe=[],le=(Q||[]).filter(H=>H.agent_state==="Reading");for(const H of le){const oe=H.message.match(/Reading content from: (.+)/);if(!oe)continue;const T=oe[1];let N=ne.length>0?ne[0].label:"Unknown";const V=ne.filter(ae=>ae.urls_found>0);(V.length===1||V.length>1)&&(N=V[0].label),console.log(`[SystemLogs] URL ${T} assigned to source: ${N}`);const C=(Q||[]).find(ae=>ae.agent_state==="Signal"&&ae.created_at>H.created_at&&ae.message.includes("Found signal")),X=(Q||[]).find(ae=>ae.agent_state==="Skipped"&&ae.created_at>H.created_at&&ae.message.includes("Irrelevant content")),ve=(Q||[]).find(ae=>ae.event_type==="error"&&ae.created_at>H.created_at);if(C){const ae=C.message.match(/\((\d+)%\)/),je=ae?parseInt(ae[1]):0;fe.push({url:T,result:"signal",score:je,category:C.details?.category||"Unknown",duration_ms:C.duration_ms,source_label:N})}else if(X){const ae=X.message.match(/\((\d+)%\): (.+)/),je=ae?parseInt(ae[1]):0,Ae=ae?ae[2]:"Irrelevant";fe.push({url:T,result:"skipped",score:je,reason:Ae,duration_ms:X.duration_ms,source_label:N})}else ve&&fe.push({url:T,result:"error",reason:ve.message,source_label:N})}w(fe)}catch(q){console.error("Failed to fetch run details:",q)}finally{S(!1)}},P=z=>{o===z?(a(null),c(null),y([]),w([])):(a(z),c(null),E(z))},j=z=>{c(l===z?null:z)},D=z=>{if(z<1e3)return`${z}ms`;const q=Math.floor(z/1e3);if(q<60)return`${q}s`;const J=Math.floor(q/60),ie=q%60;return`${J}m ${ie}s`},$=z=>{switch(z){case"success":return g.jsx(Rh,{className:"w-5 h-5 text-success"});case"failed":return g.jsx($g,{className:"w-5 h-5 text-error"});case"partial":return g.jsx(Mo,{className:"w-5 h-5 text-warning"});default:return g.jsx(ni,{className:"w-5 h-5 text-fg/40"})}},O=z=>{switch(z){case"signal":return g.jsx(is,{className:"w-4 h-4 text-primary"});case"skipped":return g.jsx(xS,{className:"w-4 h-4 text-fg/40"});case"error":return g.jsx($g,{className:"w-4 h-4 text-error"});default:return null}};return n?g.jsx("div",{className:"flex items-center justify-center h-full",children:g.jsx("div",{className:"w-12 h-12 border-4 border-primary/20 border-t-primary rounded-full animate-spin"})}):g.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden p-8",children:[g.jsxs("div",{className:"mb-6",children:[g.jsx("h2",{className:"text-2xl font-bold",children:"System Logs"}),g.jsx("p",{className:"text-sm text-fg/50",children:"Detailed history of sync runs, sources, and URL processing"})]}),g.jsx("div",{className:"flex-1 overflow-y-auto custom-scrollbar",children:e.length===0?g.jsxs("div",{className:"text-center py-12 text-fg/40",children:[g.jsx(ni,{className:"w-12 h-12 mx-auto mb-4 opacity-50"}),g.jsx("p",{children:"No sync runs yet"})]}):g.jsx("div",{className:"space-y-2",children:e.map(z=>g.jsxs("div",{className:"glass rounded-xl overflow-hidden",children:[g.jsxs("button",{onClick:()=>P(z.id),className:"w-full p-4 flex items-center gap-4 hover:bg-surface/50 transition-colors text-left",children:[o===z.id?g.jsx(jl,{className:"w-5 h-5 text-primary shrink-0"}):g.jsx(Lg,{className:"w-5 h-5 text-fg/40 shrink-0"}),$(z.status),g.jsxs("div",{className:"flex-1 grid grid-cols-6 gap-4 items-center",children:[g.jsxs("div",{children:[g.jsx("div",{className:"text-xs text-fg/40 uppercase tracking-wider",children:"Timestamp"}),g.jsx("div",{className:"text-sm font-mono",children:new Date(z.started_at).toLocaleString([],{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})})]}),g.jsxs("div",{children:[g.jsx("div",{className:"text-xs text-fg/40 uppercase tracking-wider",children:"Duration"}),g.jsx("div",{className:"text-sm font-mono",children:D(z.duration_ms)})]}),g.jsxs("div",{children:[g.jsx("div",{className:"text-xs text-fg/40 uppercase tracking-wider",children:"Signals"}),g.jsx("div",{className:"text-sm font-semibold text-primary",children:z.signals_found})]}),g.jsxs("div",{children:[g.jsx("div",{className:"text-xs text-fg/40 uppercase tracking-wider",children:"Skipped"}),g.jsx("div",{className:"text-sm font-semibold text-fg/60",children:z.skipped})]}),g.jsxs("div",{children:[g.jsx("div",{className:"text-xs text-fg/40 uppercase tracking-wider",children:"URLs"}),g.jsx("div",{className:"text-sm font-semibold",children:z.urls_processed})]}),g.jsxs("div",{children:[g.jsx("div",{className:"text-xs text-fg/40 uppercase tracking-wider",children:"Errors"}),g.jsx("div",{className:`text-sm font-semibold ${z.errors>0?"text-error":"text-fg/40"}`,children:z.errors})]})]})]}),g.jsx(_n,{children:o===z.id&&g.jsx(ze.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.2},className:"border-t border-border/10 overflow-hidden",children:g.jsx("div",{className:"p-4 bg-black/10 space-y-2",children:b?g.jsx("div",{className:"flex items-center justify-center py-8",children:g.jsx("div",{className:"w-8 h-8 border-4 border-primary/20 border-t-primary rounded-full animate-spin"})}):p.length===0?g.jsx("div",{className:"text-center py-4 text-fg/40 text-sm",children:"No source details available"}):p.map((q,J)=>g.jsxs("div",{className:"glass rounded-lg overflow-hidden",children:[g.jsxs("button",{onClick:()=>j(q.label),className:"w-full p-3 flex items-center gap-3 hover:bg-surface/50 transition-colors text-left",children:[l===q.label?g.jsx(jl,{className:"w-4 h-4 text-primary shrink-0"}):g.jsx(Lg,{className:"w-4 h-4 text-fg/40 shrink-0"}),g.jsxs("div",{className:"flex-1 flex items-center gap-4",children:[g.jsxs("div",{className:"flex-1",children:[g.jsx("div",{className:"text-sm font-semibold",children:q.label}),g.jsx("div",{className:"text-xs text-fg/40",children:q.browser})]}),g.jsxs("div",{className:"text-right",children:[g.jsx("div",{className:"text-xs text-fg/40",children:"URLs Found"}),g.jsx("div",{className:"text-sm font-semibold",children:q.urls_found})]}),g.jsxs("div",{className:"text-right",children:[g.jsx("div",{className:"text-xs text-fg/40",children:"Duration"}),g.jsx("div",{className:"text-sm font-mono",children:D(q.duration_ms)})]})]})]}),g.jsx(_n,{children:l===q.label&&g.jsx(ze.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.2},className:"border-t border-border/10 overflow-hidden",children:g.jsx("div",{className:"p-3 bg-black/20 max-h-96 overflow-y-auto custom-scrollbar space-y-1",children:v.filter(ie=>ie.source_label===q.label).length===0?g.jsx("div",{className:"text-center py-4 text-fg/40 text-xs",children:"No URL details available for this source"}):v.filter(ie=>ie.source_label===q.label).map((ie,re)=>g.jsxs("div",{className:"flex items-center gap-2 p-2 rounded bg-surface/30 hover:bg-surface/50 transition-colors",children:[O(ie.result),g.jsxs("div",{className:"flex-1 min-w-0",children:[g.jsx("div",{className:"text-xs font-mono truncate text-fg/80",children:ie.url}),ie.result==="signal"&&g.jsxs("div",{className:"text-[10px] text-primary",children:["Signal (",ie.score,"%) - ",ie.category]}),ie.result==="skipped"&&g.jsxs("div",{className:"text-[10px] text-fg/40",children:["Skipped (",ie.score,"%) - ",ie.reason]}),ie.result==="error"&&g.jsxs("div",{className:"text-[10px] text-error",children:["Error: ",ie.reason]})]}),g.jsx("a",{href:ie.url,target:"_blank",rel:"noopener noreferrer",className:"p-1 hover:bg-surface rounded",onClick:Q=>Q.stopPropagation(),children:g.jsx(Hl,{className:"w-3 h-3 text-fg/40"})})]},re))})})})]},J))})})})]},z.id))})})]})}function AN({signals:e,limit:t=10,onSignalClick:n}){const r=e.slice(0,t),[o,a]=L.useState(()=>{const d=localStorage.getItem("newSignalsFeedExpanded");return d!==null?d==="true":!0});L.useEffect(()=>{localStorage.setItem("newSignalsFeedExpanded",String(o))},[o]);const l=d=>d>=80?"bg-yellow-400/20 text-yellow-400 border-yellow-400/30":d>=50?"bg-blue-400/20 text-blue-400 border-blue-400/30":"bg-gray-400/20 text-gray-400 border-gray-400/30",c=d=>{const f=new Date(d),y=new Date().getTime()-f.getTime(),v=Math.floor(y/6e4),w=Math.floor(y/36e5);return v<1?"Just now":v<60?`${v}m ago`:w<24?`${w}h ago`:f.toLocaleDateString("en-US",{month:"short",day:"numeric"})};return r.length===0?null:g.jsxs("div",{className:"mb-3",children:[g.jsxs("button",{onClick:()=>a(!o),className:"w-full flex items-center justify-between mb-2 px-1 py-1 hover:bg-surface/30 rounded-lg transition-colors",children:[g.jsx("div",{className:"flex items-center gap-2",children:g.jsxs("h3",{className:"text-sm font-semibold text-fg/70 uppercase tracking-wide",children:["New Signals (",r.length,")"]})}),o?g.jsx(jv,{size:16,className:"text-fg/40"}):g.jsx(jl,{size:16,className:"text-fg/40"})]}),g.jsx(_n,{children:o&&g.jsx(ze.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.2},className:"overflow-hidden py-1",children:g.jsx("div",{className:"overflow-x-auto pb-2 -mx-4 px-4 scrollbar-on-hover",children:g.jsx("div",{className:"flex gap-3 min-w-max",children:r.map(d=>g.jsxs(ze.button,{onClick:()=>n(d.id),whileHover:{scale:1.05},whileTap:{scale:.98},className:"flex-shrink-0 w-[120px] bg-surface/50 backdrop-blur-sm border border-border rounded-lg p-3 hover:border-[var(--border-hover)] transition-all duration-300 text-left group relative z-0 hover:z-10",children:[g.jsx("div",{className:`w-12 h-12 rounded-full border-2 flex items-center justify-center mx-auto mb-2 ${l(d.score)}`,children:g.jsx("span",{className:"text-xl font-bold",children:d.score})}),g.jsx("p",{className:"text-xs text-fg line-clamp-2 mb-2 group-hover:text-blue-400 transition-colors",children:d.title}),g.jsxs("div",{className:"flex items-center gap-1 text-[10px] text-fg/40",children:[g.jsx(ni,{size:10}),g.jsx("span",{children:c(d.created_at)})]})]},d.id))})})})})]})}const Lo=[{id:"ai",name:"AI & ML",icon:Cv,color:"blue",priority:1},{id:"business",name:"Business",icon:Jk,color:"purple",priority:1},{id:"politics",name:"Politics",icon:uS,color:"red",priority:1},{id:"technology",name:"Technology",icon:Oh,color:"cyan",priority:1},{id:"finance",name:"Finance",icon:nS,color:"green",priority:1},{id:"crypto",name:"Crypto",icon:Wk,color:"orange",priority:1},{id:"science",name:"Science",icon:fS,color:"teal",priority:1}],jf={id:"other",name:"Other",icon:Bd,color:"gray",priority:3},PN=[...Lo,jf];function NN(e){const t={blue:"bg-blue-500/20 text-blue-400 border-blue-500/30",purple:"bg-purple-500/20 text-purple-400 border-purple-500/30",red:"bg-red-500/20 text-red-400 border-red-500/30",cyan:"bg-cyan-500/20 text-cyan-400 border-cyan-500/30",green:"bg-green-500/20 text-green-400 border-green-500/30",orange:"bg-orange-500/20 text-orange-400 border-orange-500/30",teal:"bg-teal-500/20 text-teal-400 border-teal-500/30",gray:"bg-gray-500/20 text-gray-400 border-gray-500/30"};return t[e]||t.gray}function Zw(e,t){if(t){const n=Lo.find(r=>r.id===t.toLowerCase());if(n)return n.id}for(const n of e){const r=n.toLowerCase(),o=Lo.find(a=>r.includes(a.id)||r.includes(a.name.toLowerCase()));if(o)return o.id}return null}function RN({category:e,signalCount:t,latestTimestamp:n,onClick:r}){const o=l=>{const c=new Date(l),f=new Date().getTime()-c.getTime(),p=Math.floor(f/6e4),y=Math.floor(f/36e5),v=Math.floor(f/864e5);return p<60?`${p}m ago`:y<24?`${y}h ago`:v<7?`${v}d ago`:c.toLocaleDateString("en-US",{month:"short",day:"numeric"})},a=e.icon;return g.jsxs(ze.button,{whileHover:{scale:1.05},whileTap:{scale:.98},onClick:r,className:"bg-surface/50 backdrop-blur-sm border border-border rounded-lg p-6 cursor-pointer hover:border-[var(--border-hover)] transition-all duration-300 text-left w-full",children:[g.jsx("div",{className:"mb-4",children:g.jsx(a,{size:40,className:"text-current opacity-80"})}),g.jsx("h3",{className:"text-lg font-semibold mb-3 text-fg",children:e.name}),g.jsxs("div",{className:"flex items-center justify-between text-sm",children:[g.jsxs("span",{className:`px-2 py-1 rounded text-xs font-medium ${NN(e.color)}`,children:[t," ",t===1?"signal":"signals"]}),g.jsxs("span",{className:"text-fg/40 flex items-center gap-1 text-xs",children:[g.jsx(ni,{size:12}),o(n)]})]})]})}const ON=3;function IN({signals:e,onCategoryClick:t}){const{categories:n,categoryCounts:r}=L.useMemo(()=>{const o=new Map,a=new Map;e.forEach(f=>{const p=f.tags||[],y=Zw(p,f.category);if(y){const v=o.get(y)||{count:0,latest:f.created_at};o.set(y,{count:v.count+1,latest:f.created_at>v.latest?f.created_at:v.latest})}else p.forEach(v=>{const w=v.toLowerCase().trim();if(w){a.set(w,(a.get(w)||0)+1);const b=o.get(w)||{count:0,latest:f.created_at};o.set(w,{count:b.count+1,latest:f.created_at>b.latest?f.created_at:b.latest})}})});const l=Array.from(a.entries()).filter(([f,p])=>p>=ON).map(([f,p])=>({id:f,name:f.charAt(0).toUpperCase()+f.slice(1),icon:oS,color:"gray",priority:2}));return{categories:[...Lo,...l,jf].filter(f=>{const p=o.get(f.id);return p&&p.count>0}).sort((f,p)=>f.priority-p.priority),categoryCounts:o}},[e]);return n.length===0?g.jsxs("div",{className:"h-64 flex flex-col items-center justify-center text-fg/20",children:[g.jsx("p",{className:"font-medium italic",children:"No categories yet."}),g.jsx("p",{className:"text-sm mt-2",children:"Signals will be organized here once discovered."})]}):g.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-4 p-1",children:n.map(o=>{const a=r.get(o.id);return g.jsx(RN,{category:o,signalCount:a.count,latestTimestamp:a.latest,onClick:()=>t(o.id)},o.id)})})}function LN({signal:e,onOpen:t,onCopy:n,onArchive:r,onBookmark:o}){const[a,l]=L.useState(!1),c=y=>y>=80?"text-yellow-400 border-yellow-400/30":y>=50?"text-blue-400 border-blue-400/30":"text-gray-400 border-gray-400/30",d=y=>y>=80?"HIGH":y>=50?"MEDIUM":"LOW",f=(y,v)=>{const w=Zw(v||[],y);if(w){const b=Lo.find(S=>S.id===w);if(b)return b}return jf},p=y=>{const v=new Date(y),b=new Date().getTime()-v.getTime(),S=Math.floor(b/6e4),_=Math.floor(b/36e5),E=Math.floor(b/864e5);return S<60?`${S}m ago`:_<24?`${_}h ago`:E<7?`${E}d ago`:v.toLocaleDateString("en-US",{month:"short",day:"numeric"})};return g.jsxs(ze.div,{whileHover:{scale:1.02,boxShadow:"0 8px 24px rgba(59, 130, 246, 0.3)"},onHoverStart:()=>l(!0),onHoverEnd:()=>l(!1),className:"bg-surface/50 backdrop-blur-sm border border-border rounded-lg p-6 flex flex-col gap-4 transition-all duration-300",children:[g.jsxs("div",{className:"flex items-start justify-between",children:[g.jsx("div",{className:"flex items-center gap-3",children:g.jsxs("div",{className:`flex flex-col items-center justify-center w-16 h-16 rounded-full border-2 ${c(e.score)}`,children:[g.jsx("span",{className:"text-2xl font-bold",children:e.score}),g.jsx("span",{className:"text-[10px] font-medium opacity-70",children:d(e.score)})]})}),g.jsxs("div",{className:"flex items-center gap-2",children:[(()=>{const y=f(e.category,e.tags),v=y.icon;return g.jsxs("span",{className:"px-2 py-1 bg-blue-500/20 text-blue-400 text-xs font-medium rounded border border-blue-500/30 flex items-center gap-1.5",children:[g.jsx(v,{size:14}),y.name]})})(),g.jsxs("span",{className:"text-xs text-fg/50 flex items-center gap-1",children:[g.jsx(ni,{size:12}),p(e.created_at)]})]})]}),g.jsxs("div",{className:"flex-1",children:[g.jsx("a",{href:e.url,target:"_blank",rel:"noopener noreferrer",className:"text-lg font-semibold text-fg hover:text-blue-400 transition-colors line-clamp-2 mb-2 block",onClick:y=>{y.preventDefault(),t?.(e.url)},children:e.title}),g.jsx("p",{className:"text-sm text-fg/70 line-clamp-3",children:e.summary})]}),e.entities&&e.entities.length>0&&g.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.entities.slice(0,4).map((y,v)=>g.jsx("span",{className:"px-2 py-1 bg-white/5 text-fg/60 text-xs rounded border border-border",children:y},v)),e.entities.length>4&&g.jsxs("span",{className:"px-2 py-1 text-fg/40 text-xs",children:["+",e.entities.length-4," more"]})]}),g.jsxs("div",{className:"flex items-center gap-2 pt-2 border-t border-white/5",children:[g.jsxs("button",{onClick:()=>t?.(e.url),className:"flex-1 flex items-center justify-center gap-2 px-3 py-2 bg-white/5 hover:bg-white/10 rounded transition-colors text-sm",title:"Open URL",children:[g.jsx(Hl,{size:14}),g.jsx("span",{children:"Open"})]}),g.jsxs("button",{onClick:()=>n?.(e.summary),className:"flex-1 flex items-center justify-center gap-2 px-3 py-2 bg-white/5 hover:bg-white/10 rounded transition-colors text-sm",title:"Copy Summary",children:[g.jsx(Av,{size:14}),g.jsx("span",{children:"Copy"})]}),g.jsxs("button",{onClick:()=>r?.(e.id),className:"flex-1 flex items-center justify-center gap-2 px-3 py-2 bg-white/5 hover:bg-red-500/20 hover:text-red-400 rounded transition-colors text-sm",title:"Archive",children:[g.jsx(Vk,{size:14}),g.jsx("span",{children:"Archive"})]}),o&&g.jsx("button",{onClick:()=>o(e.id),className:"px-3 py-2 bg-white/5 hover:bg-yellow-500/20 hover:text-yellow-400 rounded transition-colors",title:"Bookmark",children:g.jsx(Gk,{size:14})})]})]})}function DN({isOpen:e,onClose:t,categoryId:n,signals:r,onOpenUrl:o,onCopyText:a,onArchive:l}){const c=PN.find(v=>v.id===n),d=r.filter(v=>{const w=v.tags||[],b=v.category?.toLowerCase()===n,S=w.some(_=>_.toLowerCase().includes(n));return b||S}),f=v=>{o?o(v):window.open(v,"_blank","noopener,noreferrer")},p=v=>{a?a(v):navigator.clipboard.writeText(v)},y=async v=>{l&&await l(v)};return g.jsx(_n,{children:e&&g.jsxs(g.Fragment,{children:[g.jsx(ze.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:t,className:"fixed inset-0 bg-black/50 backdrop-blur-sm z-40"}),g.jsx(ze.div,{initial:{x:"100%"},animate:{x:0},exit:{x:"100%"},transition:{type:"spring",damping:30,stiffness:300},className:"fixed right-0 top-0 h-full w-full md:w-2/3 lg:w-1/2 bg-bg border-l border-border z-50 overflow-y-auto custom-scrollbar",children:g.jsxs("div",{className:"p-6",children:[g.jsxs("div",{className:"flex items-center justify-between mb-6 sticky top-0 bg-bg pb-4 border-b border-border",children:[g.jsxs("div",{className:"flex items-center gap-3",children:[c?.icon&&g.jsx("div",{className:"w-10 h-10 flex items-center justify-center",children:g.jsx(c.icon,{size:40,className:"text-current opacity-80"})}),g.jsxs("div",{children:[g.jsx("h2",{className:"text-2xl font-bold",children:c?.name}),g.jsxs("p",{className:"text-sm text-fg/50",children:[d.length," ",d.length===1?"signal":"signals"]})]})]}),g.jsx("button",{onClick:t,className:"p-2 hover:bg-white/10 rounded transition-colors","aria-label":"Close drawer",children:g.jsx(Cr,{size:24})})]}),g.jsx("div",{className:"space-y-4",children:d.length===0?g.jsx("div",{className:"h-64 flex items-center justify-center text-fg/30",children:g.jsx("p",{className:"italic",children:"No signals in this category yet."})}):d.map(v=>g.jsx(LN,{signal:v,onOpen:f,onCopy:p,onArchive:y},v.id))})]})})]})})}function MN({onOpenUrl:e,onCopyText:t}){const[n,r]=L.useState([]),[o,a]=L.useState(!0),[l,c]=L.useState(null),[d,f]=L.useState(""),[p,y]=L.useState(null);L.useEffect(()=>{(async()=>{a(!0);let E=Ee.from("signals").select("*").order("created_at",{ascending:!1}).limit(50);p&&(E=E.ilike("category",p)),d&&(E=E.or(`title.ilike.%${d}%,summary.ilike.%${d}%,url.ilike.%${d}%`));const{data:P,error:j}=await E;j?console.error("Error fetching signals:",j):r(P||[]),a(!1)})();const _=Ee.channel("signals").on("postgres_changes",{event:"INSERT",schema:"public",table:"signals"},E=>{r(P=>[E.new,...P])}).subscribe();return()=>{_.unsubscribe()}},[d,p]);const v=S=>{e?e(S):window.open(S,"_blank","noopener,noreferrer")},w=S=>{t?t(S):navigator.clipboard.writeText(S)},b=async S=>{await Ee.from("signals").delete().eq("id",S),r(_=>_.filter(E=>E.id!==S))};return g.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[g.jsx("div",{className:"px-4 pt-2",children:g.jsx(AN,{signals:n,limit:10,onSignalClick:S=>{const _=n.find(E=>E.id===S);_&&_.category&&c(_.category.toLowerCase())}})}),g.jsxs("div",{className:"px-4 pt-1 pb-2 space-y-3",children:[g.jsxs("div",{className:"relative",children:[g.jsx($d,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-fg/40"}),g.jsx("input",{type:"text",placeholder:"Search signals by title, summary, or URL...",value:d,onChange:S=>f(S.target.value),className:"w-full bg-surface border border-border/20 rounded-xl py-3 pl-10 pr-10 text-sm text-fg placeholder:text-fg/40 focus:border-primary/50 focus:ring-2 focus:ring-primary/20 outline-none transition-all"}),d&&g.jsx("button",{onClick:()=>f(""),className:"absolute right-3 top-1/2 -translate-y-1/2 text-fg/40 hover:text-fg transition-colors",title:"Clear search",children:g.jsx(Cr,{size:16})})]}),g.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[g.jsx(rS,{className:"w-3.5 h-3.5 text-fg/40"}),g.jsx("button",{onClick:()=>y(null),className:`px-3 py-1.5 rounded-lg text-xs font-medium transition-all ${p===null?"bg-primary text-white shadow-sm":"bg-surface hover:bg-surface/80 text-fg/60 hover:text-fg border border-border/20"}`,children:"All"}),["AI & ML","Business","Politics","Technology","Finance","Crypto","Science","Other"].map(S=>g.jsx("button",{onClick:()=>y(S),className:`px-3 py-1.5 rounded-lg text-xs font-medium transition-all ${p===S?"bg-primary text-white shadow-sm":"bg-surface hover:bg-surface/80 text-fg/60 hover:text-fg border border-border/20"}`,children:S},S))]})]}),g.jsx("div",{className:"flex-1 overflow-y-auto px-4 pb-12 custom-scrollbar",children:o?g.jsx("div",{className:"h-64 flex items-center justify-center text-fg/30",children:g.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-blue-400"})}):g.jsx(IN,{signals:n,onCategoryClick:S=>c(S)})}),g.jsx(DN,{isOpen:!!l,onClose:()=>c(null),categoryId:l||"",signals:n,onOpenUrl:v,onCopyText:w,onArchive:b})]})}function UN(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const zN=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,FN=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,$N={};function V0(e,t){return($N.jsx?FN:zN).test(e)}const BN=/[ \t\n\f\r]/g;function VN(e){return typeof e=="object"?e.type==="text"?q0(e.value):!1:q0(e)}function q0(e){return e.replace(BN,"")===""}class Ko{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}}Ko.prototype.normal={};Ko.prototype.property={};Ko.prototype.space=void 0;function e1(e,t){const n={},r={};for(const o of e)Object.assign(n,o.property),Object.assign(r,o.normal);return new Ko(n,r,t)}function bh(e){return e.toLowerCase()}class Vt{constructor(t,n){this.attribute=n,this.property=t}}Vt.prototype.attribute="";Vt.prototype.booleanish=!1;Vt.prototype.boolean=!1;Vt.prototype.commaOrSpaceSeparated=!1;Vt.prototype.commaSeparated=!1;Vt.prototype.defined=!1;Vt.prototype.mustUseProperty=!1;Vt.prototype.number=!1;Vt.prototype.overloadedBoolean=!1;Vt.prototype.property="";Vt.prototype.spaceSeparated=!1;Vt.prototype.space=void 0;let qN=0;const Ne=ls(),lt=ls(),kh=ls(),ee=ls(),Ve=ls(),ei=ls(),Yt=ls();function ls(){return 2**++qN}const Sh=Object.freeze(Object.defineProperty({__proto__:null,boolean:Ne,booleanish:lt,commaOrSpaceSeparated:Yt,commaSeparated:ei,number:ee,overloadedBoolean:kh,spaceSeparated:Ve},Symbol.toStringTag,{value:"Module"})),jd=Object.keys(Sh);class Af extends Vt{constructor(t,n,r,o){let a=-1;if(super(t,n),H0(this,"space",o),typeof r=="number")for(;++a<jd.length;){const l=jd[a];H0(this,jd[a],(r&Sh[l])===Sh[l])}}}Af.prototype.defined=!0;function H0(e,t,n){n&&(e[t]=n)}function di(e){const t={},n={};for(const[r,o]of Object.entries(e.properties)){const a=new Af(r,e.transform(e.attributes||{},r),o,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(a.mustUseProperty=!0),t[r]=a,n[bh(r)]=r,n[bh(a.attribute)]=r}return new Ko(t,n,e.space)}const t1=di({properties:{ariaActiveDescendant:null,ariaAtomic:lt,ariaAutoComplete:null,ariaBusy:lt,ariaChecked:lt,ariaColCount:ee,ariaColIndex:ee,ariaColSpan:ee,ariaControls:Ve,ariaCurrent:null,ariaDescribedBy:Ve,ariaDetails:null,ariaDisabled:lt,ariaDropEffect:Ve,ariaErrorMessage:null,ariaExpanded:lt,ariaFlowTo:Ve,ariaGrabbed:lt,ariaHasPopup:null,ariaHidden:lt,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Ve,ariaLevel:ee,ariaLive:null,ariaModal:lt,ariaMultiLine:lt,ariaMultiSelectable:lt,ariaOrientation:null,ariaOwns:Ve,ariaPlaceholder:null,ariaPosInSet:ee,ariaPressed:lt,ariaReadOnly:lt,ariaRelevant:null,ariaRequired:lt,ariaRoleDescription:Ve,ariaRowCount:ee,ariaRowIndex:ee,ariaRowSpan:ee,ariaSelected:lt,ariaSetSize:ee,ariaSort:null,ariaValueMax:ee,ariaValueMin:ee,ariaValueNow:ee,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function n1(e,t){return t in e?e[t]:t}function r1(e,t){return n1(e,t.toLowerCase())}const HN=di({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:ei,acceptCharset:Ve,accessKey:Ve,action:null,allow:null,allowFullScreen:Ne,allowPaymentRequest:Ne,allowUserMedia:Ne,alt:null,as:null,async:Ne,autoCapitalize:null,autoComplete:Ve,autoFocus:Ne,autoPlay:Ne,blocking:Ve,capture:null,charSet:null,checked:Ne,cite:null,className:Ve,cols:ee,colSpan:null,content:null,contentEditable:lt,controls:Ne,controlsList:Ve,coords:ee|ei,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Ne,defer:Ne,dir:null,dirName:null,disabled:Ne,download:kh,draggable:lt,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Ne,formTarget:null,headers:Ve,height:ee,hidden:kh,high:ee,href:null,hrefLang:null,htmlFor:Ve,httpEquiv:Ve,id:null,imageSizes:null,imageSrcSet:null,inert:Ne,inputMode:null,integrity:null,is:null,isMap:Ne,itemId:null,itemProp:Ve,itemRef:Ve,itemScope:Ne,itemType:Ve,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Ne,low:ee,manifest:null,max:null,maxLength:ee,media:null,method:null,min:null,minLength:ee,multiple:Ne,muted:Ne,name:null,nonce:null,noModule:Ne,noValidate:Ne,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:Ne,optimum:ee,pattern:null,ping:Ve,placeholder:null,playsInline:Ne,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Ne,referrerPolicy:null,rel:Ve,required:Ne,reversed:Ne,rows:ee,rowSpan:ee,sandbox:Ve,scope:null,scoped:Ne,seamless:Ne,selected:Ne,shadowRootClonable:Ne,shadowRootDelegatesFocus:Ne,shadowRootMode:null,shape:null,size:ee,sizes:null,slot:null,span:ee,spellCheck:lt,src:null,srcDoc:null,srcLang:null,srcSet:null,start:ee,step:null,style:null,tabIndex:ee,target:null,title:null,translate:null,type:null,typeMustMatch:Ne,useMap:null,value:lt,width:ee,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Ve,axis:null,background:null,bgColor:null,border:ee,borderColor:null,bottomMargin:ee,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Ne,declare:Ne,event:null,face:null,frame:null,frameBorder:null,hSpace:ee,leftMargin:ee,link:null,longDesc:null,lowSrc:null,marginHeight:ee,marginWidth:ee,noResize:Ne,noHref:Ne,noShade:Ne,noWrap:Ne,object:null,profile:null,prompt:null,rev:null,rightMargin:ee,rules:null,scheme:null,scrolling:lt,standby:null,summary:null,text:null,topMargin:ee,valueType:null,version:null,vAlign:null,vLink:null,vSpace:ee,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:Ne,disableRemotePlayback:Ne,prefix:null,property:null,results:ee,security:null,unselectable:null},space:"html",transform:r1}),WN=di({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:Yt,accentHeight:ee,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:ee,amplitude:ee,arabicForm:null,ascent:ee,attributeName:null,attributeType:null,azimuth:ee,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:ee,by:null,calcMode:null,capHeight:ee,className:Ve,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:ee,diffuseConstant:ee,direction:null,display:null,dur:null,divisor:ee,dominantBaseline:null,download:Ne,dx:null,dy:null,edgeMode:null,editable:null,elevation:ee,enableBackground:null,end:null,event:null,exponent:ee,externalResourcesRequired:null,fill:null,fillOpacity:ee,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:ei,g2:ei,glyphName:ei,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:ee,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:ee,horizOriginX:ee,horizOriginY:ee,id:null,ideographic:ee,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:ee,k:ee,k1:ee,k2:ee,k3:ee,k4:ee,kernelMatrix:Yt,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:ee,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:ee,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:ee,overlineThickness:ee,paintOrder:null,panose1:null,path:null,pathLength:ee,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Ve,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:ee,pointsAtY:ee,pointsAtZ:ee,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Yt,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Yt,rev:Yt,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Yt,requiredFeatures:Yt,requiredFonts:Yt,requiredFormats:Yt,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:ee,specularExponent:ee,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:ee,strikethroughThickness:ee,string:null,stroke:null,strokeDashArray:Yt,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:ee,strokeOpacity:ee,strokeWidth:null,style:null,surfaceScale:ee,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Yt,tabIndex:ee,tableValues:null,target:null,targetX:ee,targetY:ee,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Yt,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:ee,underlineThickness:ee,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:ee,values:null,vAlphabetic:ee,vMathematical:ee,vectorEffect:null,vHanging:ee,vIdeographic:ee,version:null,vertAdvY:ee,vertOriginX:ee,vertOriginY:ee,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:ee,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:n1}),s1=di({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()}}),i1=di({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:r1}),o1=di({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),KN={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},GN=/[A-Z]/g,W0=/-[a-z]/g,JN=/^data[-\w.:]+$/i;function YN(e,t){const n=bh(t);let r=t,o=Vt;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&JN.test(t)){if(t.charAt(4)==="-"){const a=t.slice(5).replace(W0,QN);r="data"+a.charAt(0).toUpperCase()+a.slice(1)}else{const a=t.slice(4);if(!W0.test(a)){let l=a.replace(GN,XN);l.charAt(0)!=="-"&&(l="-"+l),t="data"+l}}o=Af}return new o(r,t)}function XN(e){return"-"+e.toLowerCase()}function QN(e){return e.charAt(1).toUpperCase()}const ZN=e1([t1,HN,s1,i1,o1],"html"),Pf=e1([t1,WN,s1,i1,o1],"svg");function eR(e){return e.join(" ").trim()}var Bs={},Ad,K0;function tR(){if(K0)return Ad;K0=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,n=/^\s*/,r=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,o=/^:\s*/,a=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,l=/^[;\s]*/,c=/^\s+|\s+$/g,d=`
|
|
101
|
+
${e.content}`:""}`,d=new Blob([c],{type:"text/markdown"}),f=URL.createObjectURL(d),p=document.createElement("a");p.href=f,p.download=`${e.title.replace(/[^a-z0-9]/gi,"_").toLowerCase()}.md`,p.click(),URL.revokeObjectURL(f)},l=()=>{const c=JSON.stringify(e,null,2),d=new Blob([c],{type:"application/json"}),f=URL.createObjectURL(d),p=document.createElement("a");p.href=f,p.download=`signal_${e.id}.json`,p.click(),URL.revokeObjectURL(f)};return g.jsx(_n,{children:g.jsx(ze.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 z-50 flex items-center justify-center p-4 bg-bg/80 backdrop-blur-sm",onClick:t,children:g.jsxs(ze.div,{initial:{opacity:0,scale:.95,y:20},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:20},onClick:c=>c.stopPropagation(),className:"w-full max-w-4xl max-h-[90vh] glass flex flex-col overflow-hidden",children:[g.jsxs("div",{className:"p-6 border-b border-border/10 flex items-start justify-between",children:[g.jsxs("div",{className:"flex-1 min-w-0 pr-4",children:[g.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[g.jsx("span",{className:"px-2 py-0.5 bg-primary/10 text-primary text-[10px] font-bold rounded border border-primary/20 uppercase tracking-wider",children:e.category||"Research"}),g.jsx("span",{className:`text-3xl font-black ${e.score>=80?"text-accent":"text-fg/40"}`,children:e.score})]}),g.jsx("h2",{className:"text-2xl font-bold leading-tight mb-2",children:e.title}),g.jsxs("p",{className:"text-xs text-fg/40 font-mono",children:["Discovered ",new Date(e.date).toLocaleDateString([],{month:"long",day:"numeric",year:"numeric"})]})]}),g.jsx("button",{onClick:t,className:"p-2 hover:bg-surface rounded-lg text-fg/40 hover:text-fg transition-all",children:g.jsx(Cr,{size:24})})]}),g.jsxs("div",{className:"flex-1 overflow-y-auto custom-scrollbar p-6 space-y-6",children:[e.url&&g.jsxs("div",{className:"space-y-2",children:[g.jsx("label",{className:"text-xs font-bold uppercase tracking-widest text-fg/40",children:"Original Source"}),g.jsxs("a",{href:e.url,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-2 p-3 glass hover:bg-surface transition-all rounded-xl text-sm font-mono text-primary hover:text-accent group",children:[g.jsx(Hl,{size:16,className:"flex-shrink-0"}),g.jsx("span",{className:"truncate",children:e.url}),g.jsx("span",{className:"ml-auto text-xs opacity-0 group-hover:opacity-100 transition-opacity",children:"Open →"})]})]}),e.entities&&e.entities.length>0&&g.jsxs("div",{className:"space-y-2",children:[g.jsx("label",{className:"text-xs font-bold uppercase tracking-widest text-fg/40",children:"Entities"}),g.jsx("div",{className:"flex flex-wrap gap-2",children:e.entities.map(c=>g.jsx("span",{className:"px-3 py-1.5 bg-surface/50 border border-border/20 rounded-lg text-sm font-medium",children:c},c))})]}),g.jsxs("div",{className:"space-y-2",children:[g.jsx("label",{className:"text-xs font-bold uppercase tracking-widest text-fg/40",children:"AI Summary"}),g.jsx("div",{className:"p-4 glass rounded-xl",children:g.jsx("p",{className:"text-sm leading-relaxed text-fg/80",children:e.summary})})]}),e.content&&g.jsxs("div",{className:"space-y-2",children:[g.jsx("label",{className:"text-xs font-bold uppercase tracking-widest text-fg/40",children:"Full Content"}),g.jsx("div",{className:"p-4 glass rounded-xl max-h-96 overflow-y-auto custom-scrollbar",children:g.jsx("p",{className:"text-sm leading-relaxed text-fg/60 whitespace-pre-wrap",children:e.content})})]})]}),g.jsxs("div",{className:"p-6 border-t border-border/10 flex items-center gap-3",children:[g.jsxs("button",{onClick:o,className:"flex-1 py-3 glass hover:bg-surface transition-all rounded-xl text-sm font-bold uppercase tracking-widest flex items-center justify-center gap-2",children:[n?g.jsx(ko,{size:16,className:"text-success"}):g.jsx(Av,{size:16}),n?"Copied!":"Copy"]}),g.jsxs("button",{onClick:a,className:"flex-1 py-3 glass hover:bg-surface transition-all rounded-xl text-sm font-bold uppercase tracking-widest flex items-center justify-center gap-2",children:[g.jsx(Dg,{size:16}),"Markdown"]}),g.jsxs("button",{onClick:l,className:"flex-1 py-3 glass hover:bg-surface transition-all rounded-xl text-sm font-bold uppercase tracking-widest flex items-center justify-center gap-2",children:[g.jsx(Dg,{size:16}),"JSON"]})]})]})})})}function CN({isOpen:e,onClose:t}){const{showToast:n}=Yw(),[r,o]=L.useState(""),[a,l]=L.useState(50),[c,d]=L.useState(!1),[f,p]=L.useState(!1);L.useEffect(()=>{e&&y()},[e]);const y=async()=>{const{data:{user:b}}=await Ee.auth.getUser();if(!b)return;const{data:S}=await Ee.from("alchemy_settings").select("*").eq("user_id",b.id).maybeSingle();if(S)if(l(S.max_urls_per_sync||50),S.sync_start_date){const _=new Date(S.sync_start_date),E=j=>j<10?"0"+j:j,P=_.getFullYear()+"-"+E(_.getMonth()+1)+"-"+E(_.getDate())+"T"+E(_.getHours())+":"+E(_.getMinutes());o(P)}else o("")},v=async()=>{d(!0);try{const{data:{user:b}}=await Ee.auth.getUser();if(!b){n("Please log in to save settings","error"),d(!1);return}const{error:S}=await Ee.from("alchemy_settings").update({max_urls_per_sync:a,sync_start_date:r?new Date(r).toISOString():null}).eq("user_id",b.id);S?n(`Failed to save: ${S.message}`,"error"):(n("Sync settings saved successfully","success"),t())}catch(b){n(`Unexpected error: ${b.message}`,"error")}finally{d(!1)}},w=async()=>{p(!0);try{const{data:{user:b}}=await Ee.auth.getUser();if(!b){n("Please log in to reset checkpoint","error"),p(!1);return}const{error:S}=await Ee.from("alchemy_settings").update({last_sync_checkpoint:null}).eq("user_id",b.id);S?n(`Failed to reset: ${S.message}`,"error"):n("Checkpoint reset successfully","success")}catch(b){n(`Unexpected error: ${b.message}`,"error")}finally{p(!1)}};return e?g.jsx("div",{className:"fixed inset-0 bg-black/50 backdrop-blur-sm flex items-center justify-center z-50 p-4",children:g.jsxs("div",{className:"bg-surface border border-border/20 rounded-2xl shadow-2xl max-w-lg w-full max-h-[90vh] overflow-y-auto",children:[g.jsxs("div",{className:"flex items-center justify-between p-6 border-b border-border/10",children:[g.jsx("h2",{className:"text-xl font-bold",children:"Sync Settings"}),g.jsx("button",{onClick:t,className:"p-2 hover:bg-black/10 rounded-lg transition-colors",children:g.jsx(Cr,{className:"w-5 h-5"})})]}),g.jsxs("div",{className:"p-6 space-y-6",children:[g.jsxs("div",{className:"space-y-3",children:[g.jsxs("label",{className:"text-sm font-semibold flex items-center gap-2",children:[g.jsx(Xk,{className:"w-4 h-4 text-primary"}),"Sync From (Optional)"]}),g.jsx("input",{type:"datetime-local",value:r,onChange:b=>o(b.target.value),className:"w-full bg-black/20 border border-border/10 rounded-xl py-3 px-4 text-sm focus:border-primary/30 outline-none transition-all"}),g.jsx("p",{className:"text-xs text-fg/50",children:"Leave empty to sync only new URLs since last sync (incremental). Set a date to process URLs from that point forward."})]}),g.jsxs("div",{className:"space-y-3",children:[g.jsxs("div",{className:"flex justify-between items-center",children:[g.jsxs("label",{className:"text-sm font-semibold flex items-center gap-2",children:[g.jsx(iS,{className:"w-4 h-4 text-primary"}),"URLs per Sync"]}),g.jsx("span",{className:"text-sm font-mono text-primary",children:a})]}),g.jsx("input",{type:"range",min:"5",max:"200",step:"5",value:a,onChange:b=>l(Number(b.target.value)),className:"w-full h-2 bg-black/20 rounded-lg appearance-none cursor-pointer accent-primary"}),g.jsxs("div",{className:"flex justify-between text-xs text-fg/30 font-medium",children:[g.jsx("span",{children:"Quick (5)"}),g.jsx("span",{children:"Balanced (50)"}),g.jsx("span",{children:"Thorough (200)"})]})]}),g.jsxs("div",{className:"pt-4 border-t border-border/10",children:[g.jsxs("button",{onClick:w,disabled:f,className:"w-full px-4 py-2.5 bg-warning/10 hover:bg-warning/20 border border-warning/20 text-warning font-medium rounded-xl transition-all flex items-center justify-center gap-2 text-sm disabled:opacity-50",children:[g.jsx(yS,{size:16,className:f?"animate-spin":""}),f?"Resetting...":"Reset Checkpoint"]}),g.jsx("p",{className:"text-xs text-fg/40 mt-2 text-center",children:'Clear the sync checkpoint to force a full re-sync from your "Sync From" date'})]}),g.jsx("div",{className:"p-4 bg-primary/5 rounded-xl",children:g.jsx("p",{className:"text-xs text-primary/60 leading-relaxed",children:'The Alchemist tracks your progress automatically. Use "Sync From" to backfill history or "Reset Checkpoint" to start fresh.'})})]}),g.jsxs("div",{className:"flex gap-3 p-6 border-t border-border/10",children:[g.jsx("button",{onClick:t,className:"flex-1 px-4 py-2.5 bg-surface hover:bg-black/10 border border-border/10 rounded-xl font-medium transition-all",children:"Cancel"}),g.jsxs("button",{onClick:v,disabled:c,className:"flex-1 px-4 py-2.5 bg-gradient-to-r from-primary to-accent text-white font-bold rounded-xl shadow-lg hover:scale-[1.02] active:scale-95 transition-all flex items-center justify-center gap-2 disabled:opacity-50",children:[g.jsx(Al,{size:18,className:c?"animate-spin":""}),c?"Saving...":"Save Settings"]})]})]})}):null}function jN(){const[e,t]=L.useState([]),[n,r]=L.useState(!0),[o,a]=L.useState(null),[l,c]=L.useState(null),[d,f]=L.useState([]),[p,y]=L.useState([]),[v,w]=L.useState([]),[b,S]=L.useState(!1);L.useEffect(()=>{_()},[]);const _=async()=>{r(!0);try{const{data:{user:z}}=await Ee.auth.getUser();if(!z)return;const{data:q,error:J}=await Ee.from("processing_events").select("*").eq("user_id",z.id).eq("agent_state","Completed").order("created_at",{ascending:!1}).limit(50);if(J){console.error("Error fetching sync runs:",J);return}const ie=(q||[]).map(re=>{const Q=re.metadata||{},ye=Q.errors||0,ne=Q.signals_found||0,Z=Q.skipped||0;return{id:re.id,started_at:re.created_at,completed_at:re.created_at,duration_ms:re.duration_ms||0,signals_found:ne,urls_processed:Q.total_urls||0,skipped:Z,errors:ye,status:ye>0?"partial":ne>0?"success":"failed"}});t(ie)}catch(z){console.error("Failed to fetch sync runs:",z)}finally{r(!1)}},E=async z=>{S(!0);try{const{data:{user:q}}=await Ee.auth.getUser();if(!q)return;const J=e.find(H=>H.id===z);if(!J)return;const ie=new Date(new Date(J.started_at).getTime()-J.duration_ms),re=new Date(J.completed_at),{data:Q,error:ye}=await Ee.from("processing_events").select("*").eq("user_id",q.id).gte("created_at",ie.toISOString()).lte("created_at",re.toISOString()).order("created_at",{ascending:!0});if(ye){console.error("Error fetching run events:",ye);return}f(Q||[]);const ne=[],Z=(Q||[]).filter(H=>H.agent_state==="Mining"&&H.message.includes("Mining source:"));for(const H of Z){const oe=H.message.match(/Mining source: (.+) \((.+)\)/);if(oe){const T=oe[1],N=oe[2],V=(Q||[]).find(ve=>ve.agent_state==="Mining"&&ve.message.includes("Found")&&ve.message.includes(T)&&ve.created_at>H.created_at),C=V?.message.match(/Found (\d+) URLs/),X=C?parseInt(C[1]):0;ne.push({label:T,browser:N,urls_found:X,duration_ms:V?.duration_ms||0,status:H.event_type==="error"?"error":"success"})}}y(ne);const fe=[],le=(Q||[]).filter(H=>H.agent_state==="Reading");for(const H of le){const oe=H.message.match(/Reading content from: (.+)/);if(!oe)continue;const T=oe[1];let N=ne.length>0?ne[0].label:"Unknown";const V=ne.filter(ae=>ae.urls_found>0);(V.length===1||V.length>1)&&(N=V[0].label),console.log(`[SystemLogs] URL ${T} assigned to source: ${N}`);const C=(Q||[]).find(ae=>ae.agent_state==="Signal"&&ae.created_at>H.created_at&&ae.message.includes("Found signal")),X=(Q||[]).find(ae=>ae.agent_state==="Skipped"&&ae.created_at>H.created_at&&ae.message.includes("Irrelevant content")),ve=(Q||[]).find(ae=>ae.event_type==="error"&&ae.created_at>H.created_at);if(C){const ae=C.message.match(/\((\d+)%\)/),je=ae?parseInt(ae[1]):0;fe.push({url:T,result:"signal",score:je,category:C.details?.category||"Unknown",duration_ms:C.duration_ms,source_label:N})}else if(X){const ae=X.message.match(/\((\d+)%\): (.+)/),je=ae?parseInt(ae[1]):0,Ae=ae?ae[2]:"Irrelevant";fe.push({url:T,result:"skipped",score:je,reason:Ae,duration_ms:X.duration_ms,source_label:N})}else ve&&fe.push({url:T,result:"error",reason:ve.message,source_label:N})}w(fe)}catch(q){console.error("Failed to fetch run details:",q)}finally{S(!1)}},P=z=>{o===z?(a(null),c(null),y([]),w([])):(a(z),c(null),E(z))},j=z=>{c(l===z?null:z)},D=z=>{if(z<1e3)return`${z}ms`;const q=Math.floor(z/1e3);if(q<60)return`${q}s`;const J=Math.floor(q/60),ie=q%60;return`${J}m ${ie}s`},$=z=>{switch(z){case"success":return g.jsx(Rh,{className:"w-5 h-5 text-success"});case"failed":return g.jsx($g,{className:"w-5 h-5 text-error"});case"partial":return g.jsx(Mo,{className:"w-5 h-5 text-warning"});default:return g.jsx(ni,{className:"w-5 h-5 text-fg/40"})}},O=z=>{switch(z){case"signal":return g.jsx(is,{className:"w-4 h-4 text-primary"});case"skipped":return g.jsx(xS,{className:"w-4 h-4 text-fg/40"});case"error":return g.jsx($g,{className:"w-4 h-4 text-error"});default:return null}};return n?g.jsx("div",{className:"flex items-center justify-center h-full",children:g.jsx("div",{className:"w-12 h-12 border-4 border-primary/20 border-t-primary rounded-full animate-spin"})}):g.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden p-8",children:[g.jsxs("div",{className:"mb-6",children:[g.jsx("h2",{className:"text-2xl font-bold",children:"System Logs"}),g.jsx("p",{className:"text-sm text-fg/50",children:"Detailed history of sync runs, sources, and URL processing"})]}),g.jsx("div",{className:"flex-1 overflow-y-auto custom-scrollbar",children:e.length===0?g.jsxs("div",{className:"text-center py-12 text-fg/40",children:[g.jsx(ni,{className:"w-12 h-12 mx-auto mb-4 opacity-50"}),g.jsx("p",{children:"No sync runs yet"})]}):g.jsx("div",{className:"space-y-2",children:e.map(z=>g.jsxs("div",{className:"glass rounded-xl overflow-hidden",children:[g.jsxs("button",{onClick:()=>P(z.id),className:"w-full p-4 flex items-center gap-4 hover:bg-surface/50 transition-colors text-left",children:[o===z.id?g.jsx(jl,{className:"w-5 h-5 text-primary shrink-0"}):g.jsx(Lg,{className:"w-5 h-5 text-fg/40 shrink-0"}),$(z.status),g.jsxs("div",{className:"flex-1 grid grid-cols-6 gap-4 items-center",children:[g.jsxs("div",{children:[g.jsx("div",{className:"text-xs text-fg/40 uppercase tracking-wider",children:"Timestamp"}),g.jsx("div",{className:"text-sm font-mono",children:new Date(z.started_at).toLocaleString([],{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})})]}),g.jsxs("div",{children:[g.jsx("div",{className:"text-xs text-fg/40 uppercase tracking-wider",children:"Duration"}),g.jsx("div",{className:"text-sm font-mono",children:D(z.duration_ms)})]}),g.jsxs("div",{children:[g.jsx("div",{className:"text-xs text-fg/40 uppercase tracking-wider",children:"Signals"}),g.jsx("div",{className:"text-sm font-semibold text-primary",children:z.signals_found})]}),g.jsxs("div",{children:[g.jsx("div",{className:"text-xs text-fg/40 uppercase tracking-wider",children:"Skipped"}),g.jsx("div",{className:"text-sm font-semibold text-fg/60",children:z.skipped})]}),g.jsxs("div",{children:[g.jsx("div",{className:"text-xs text-fg/40 uppercase tracking-wider",children:"URLs"}),g.jsx("div",{className:"text-sm font-semibold",children:z.urls_processed})]}),g.jsxs("div",{children:[g.jsx("div",{className:"text-xs text-fg/40 uppercase tracking-wider",children:"Errors"}),g.jsx("div",{className:`text-sm font-semibold ${z.errors>0?"text-error":"text-fg/40"}`,children:z.errors})]})]})]}),g.jsx(_n,{children:o===z.id&&g.jsx(ze.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.2},className:"border-t border-border/10 overflow-hidden",children:g.jsx("div",{className:"p-4 bg-black/10 space-y-2",children:b?g.jsx("div",{className:"flex items-center justify-center py-8",children:g.jsx("div",{className:"w-8 h-8 border-4 border-primary/20 border-t-primary rounded-full animate-spin"})}):p.length===0?g.jsx("div",{className:"text-center py-4 text-fg/40 text-sm",children:"No source details available"}):p.map((q,J)=>g.jsxs("div",{className:"glass rounded-lg overflow-hidden",children:[g.jsxs("button",{onClick:()=>j(q.label),className:"w-full p-3 flex items-center gap-3 hover:bg-surface/50 transition-colors text-left",children:[l===q.label?g.jsx(jl,{className:"w-4 h-4 text-primary shrink-0"}):g.jsx(Lg,{className:"w-4 h-4 text-fg/40 shrink-0"}),g.jsxs("div",{className:"flex-1 flex items-center gap-4",children:[g.jsxs("div",{className:"flex-1",children:[g.jsx("div",{className:"text-sm font-semibold",children:q.label}),g.jsx("div",{className:"text-xs text-fg/40",children:q.browser})]}),g.jsxs("div",{className:"text-right",children:[g.jsx("div",{className:"text-xs text-fg/40",children:"URLs Found"}),g.jsx("div",{className:"text-sm font-semibold",children:q.urls_found})]}),g.jsxs("div",{className:"text-right",children:[g.jsx("div",{className:"text-xs text-fg/40",children:"Duration"}),g.jsx("div",{className:"text-sm font-mono",children:D(q.duration_ms)})]})]})]}),g.jsx(_n,{children:l===q.label&&g.jsx(ze.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.2},className:"border-t border-border/10 overflow-hidden",children:g.jsx("div",{className:"p-3 bg-black/20 max-h-96 overflow-y-auto custom-scrollbar space-y-1",children:v.filter(ie=>ie.source_label===q.label).length===0?g.jsx("div",{className:"text-center py-4 text-fg/40 text-xs",children:"No URL details available for this source"}):v.filter(ie=>ie.source_label===q.label).map((ie,re)=>g.jsxs("div",{className:"flex items-center gap-2 p-2 rounded bg-surface/30 hover:bg-surface/50 transition-colors",children:[O(ie.result),g.jsxs("div",{className:"flex-1 min-w-0",children:[g.jsx("div",{className:"text-xs font-mono truncate text-fg/80",children:ie.url}),ie.result==="signal"&&g.jsxs("div",{className:"text-[10px] text-primary",children:["Signal (",ie.score,"%) - ",ie.category]}),ie.result==="skipped"&&g.jsxs("div",{className:"text-[10px] text-fg/40",children:["Skipped (",ie.score,"%) - ",ie.reason]}),ie.result==="error"&&g.jsxs("div",{className:"text-[10px] text-error",children:["Error: ",ie.reason]})]}),g.jsx("a",{href:ie.url,target:"_blank",rel:"noopener noreferrer",className:"p-1 hover:bg-surface rounded",onClick:Q=>Q.stopPropagation(),children:g.jsx(Hl,{className:"w-3 h-3 text-fg/40"})})]},re))})})})]},J))})})})]},z.id))})})]})}function AN({signals:e,limit:t=10,onSignalClick:n}){const r=e.slice(0,t),[o,a]=L.useState(()=>{const d=localStorage.getItem("newSignalsFeedExpanded");return d!==null?d==="true":!0});L.useEffect(()=>{localStorage.setItem("newSignalsFeedExpanded",String(o))},[o]);const l=d=>d>=80?"bg-yellow-400/20 text-yellow-400 border-yellow-400/30":d>=50?"bg-blue-400/20 text-blue-400 border-blue-400/30":"bg-gray-400/20 text-gray-400 border-gray-400/30",c=d=>{const f=new Date(d),y=new Date().getTime()-f.getTime(),v=Math.floor(y/6e4),w=Math.floor(y/36e5);return v<1?"Just now":v<60?`${v}m ago`:w<24?`${w}h ago`:f.toLocaleDateString("en-US",{month:"short",day:"numeric"})};return r.length===0?null:g.jsxs("div",{className:"mb-3",children:[g.jsxs("button",{onClick:()=>a(!o),className:"w-full flex items-center justify-between mb-2 px-1 py-1 hover:bg-surface/30 rounded-lg transition-colors",children:[g.jsx("div",{className:"flex items-center gap-2",children:g.jsxs("h3",{className:"text-sm font-semibold text-fg/70 uppercase tracking-wide",children:["New Signals (",r.length,")"]})}),o?g.jsx(jv,{size:16,className:"text-fg/40"}):g.jsx(jl,{size:16,className:"text-fg/40"})]}),g.jsx(_n,{children:o&&g.jsx(ze.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.2},className:"overflow-hidden py-3",children:g.jsx("div",{className:"overflow-x-auto pb-2 -mx-4 px-4 scrollbar-on-hover",children:g.jsx("div",{className:"flex gap-3 min-w-max",children:r.map(d=>g.jsxs(ze.button,{onClick:()=>n(d.id),whileHover:{scale:1.05},whileTap:{scale:.98},className:"flex-shrink-0 w-[120px] bg-surface/50 backdrop-blur-sm border border-border rounded-lg p-3 hover:border-[var(--border-hover)] transition-all duration-300 text-left group relative z-0 hover:z-10",children:[g.jsx("div",{className:`w-12 h-12 rounded-full border-2 flex items-center justify-center mx-auto mb-2 ${l(d.score)}`,children:g.jsx("span",{className:"text-xl font-bold",children:d.score})}),g.jsx("p",{className:"text-xs text-fg line-clamp-2 mb-2 group-hover:text-blue-400 transition-colors",children:d.title}),g.jsxs("div",{className:"flex items-center gap-1 text-[10px] text-fg/40",children:[g.jsx(ni,{size:10}),g.jsx("span",{children:c(d.created_at)})]})]},d.id))})})})})]})}const Lo=[{id:"ai",name:"AI & ML",icon:Cv,color:"blue",priority:1},{id:"business",name:"Business",icon:Jk,color:"purple",priority:1},{id:"politics",name:"Politics",icon:uS,color:"red",priority:1},{id:"technology",name:"Technology",icon:Oh,color:"cyan",priority:1},{id:"finance",name:"Finance",icon:nS,color:"green",priority:1},{id:"crypto",name:"Crypto",icon:Wk,color:"orange",priority:1},{id:"science",name:"Science",icon:fS,color:"teal",priority:1}],jf={id:"other",name:"Other",icon:Bd,color:"gray",priority:3},PN=[...Lo,jf];function NN(e){const t={blue:"bg-blue-500/20 text-blue-400 border-blue-500/30",purple:"bg-purple-500/20 text-purple-400 border-purple-500/30",red:"bg-red-500/20 text-red-400 border-red-500/30",cyan:"bg-cyan-500/20 text-cyan-400 border-cyan-500/30",green:"bg-green-500/20 text-green-400 border-green-500/30",orange:"bg-orange-500/20 text-orange-400 border-orange-500/30",teal:"bg-teal-500/20 text-teal-400 border-teal-500/30",gray:"bg-gray-500/20 text-gray-400 border-gray-500/30"};return t[e]||t.gray}function Zw(e,t){if(t){const n=Lo.find(r=>r.id===t.toLowerCase());if(n)return n.id}for(const n of e){const r=n.toLowerCase(),o=Lo.find(a=>r.includes(a.id)||r.includes(a.name.toLowerCase()));if(o)return o.id}return null}function RN({category:e,signalCount:t,latestTimestamp:n,onClick:r}){const o=l=>{const c=new Date(l),f=new Date().getTime()-c.getTime(),p=Math.floor(f/6e4),y=Math.floor(f/36e5),v=Math.floor(f/864e5);return p<60?`${p}m ago`:y<24?`${y}h ago`:v<7?`${v}d ago`:c.toLocaleDateString("en-US",{month:"short",day:"numeric"})},a=e.icon;return g.jsxs(ze.button,{whileHover:{scale:1.05},whileTap:{scale:.98},onClick:r,className:"bg-surface/50 backdrop-blur-sm border border-border rounded-lg p-6 cursor-pointer hover:border-[var(--border-hover)] transition-all duration-300 text-left w-full relative z-0 hover:z-10",children:[g.jsx("div",{className:"mb-4",children:g.jsx(a,{size:40,className:"text-current opacity-80"})}),g.jsx("h3",{className:"text-lg font-semibold mb-3 text-fg",children:e.name}),g.jsxs("div",{className:"flex items-center justify-between text-sm",children:[g.jsxs("span",{className:`px-2 py-1 rounded text-xs font-medium ${NN(e.color)}`,children:[t," ",t===1?"signal":"signals"]}),g.jsxs("span",{className:"text-fg/40 flex items-center gap-1 text-xs",children:[g.jsx(ni,{size:12}),o(n)]})]})]})}const ON=3;function IN({signals:e,onCategoryClick:t}){const{categories:n,categoryCounts:r}=L.useMemo(()=>{const o=new Map,a=new Map;e.forEach(f=>{const p=f.tags||[],y=Zw(p,f.category);if(y){const v=o.get(y)||{count:0,latest:f.created_at};o.set(y,{count:v.count+1,latest:f.created_at>v.latest?f.created_at:v.latest})}else p.forEach(v=>{const w=v.toLowerCase().trim();if(w){a.set(w,(a.get(w)||0)+1);const b=o.get(w)||{count:0,latest:f.created_at};o.set(w,{count:b.count+1,latest:f.created_at>b.latest?f.created_at:b.latest})}})});const l=Array.from(a.entries()).filter(([f,p])=>p>=ON).map(([f,p])=>({id:f,name:f.charAt(0).toUpperCase()+f.slice(1),icon:oS,color:"gray",priority:2}));return{categories:[...Lo,...l,jf].filter(f=>{const p=o.get(f.id);return p&&p.count>0}).sort((f,p)=>f.priority-p.priority),categoryCounts:o}},[e]);return n.length===0?g.jsxs("div",{className:"h-64 flex flex-col items-center justify-center text-fg/20",children:[g.jsx("p",{className:"font-medium italic",children:"No categories yet."}),g.jsx("p",{className:"text-sm mt-2",children:"Signals will be organized here once discovered."})]}):g.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-4 p-2",children:n.map(o=>{const a=r.get(o.id);return g.jsx(RN,{category:o,signalCount:a.count,latestTimestamp:a.latest,onClick:()=>t(o.id)},o.id)})})}function LN({signal:e,onOpen:t,onCopy:n,onArchive:r,onBookmark:o}){const[a,l]=L.useState(!1),c=y=>y>=80?"text-yellow-400 border-yellow-400/30":y>=50?"text-blue-400 border-blue-400/30":"text-gray-400 border-gray-400/30",d=y=>y>=80?"HIGH":y>=50?"MEDIUM":"LOW",f=(y,v)=>{const w=Zw(v||[],y);if(w){const b=Lo.find(S=>S.id===w);if(b)return b}return jf},p=y=>{const v=new Date(y),b=new Date().getTime()-v.getTime(),S=Math.floor(b/6e4),_=Math.floor(b/36e5),E=Math.floor(b/864e5);return S<60?`${S}m ago`:_<24?`${_}h ago`:E<7?`${E}d ago`:v.toLocaleDateString("en-US",{month:"short",day:"numeric"})};return g.jsxs(ze.div,{whileHover:{scale:1.02,boxShadow:"0 8px 24px rgba(59, 130, 246, 0.3)"},onHoverStart:()=>l(!0),onHoverEnd:()=>l(!1),className:"bg-surface/50 backdrop-blur-sm border border-border rounded-lg p-6 flex flex-col gap-4 transition-all duration-300",children:[g.jsxs("div",{className:"flex items-start justify-between",children:[g.jsx("div",{className:"flex items-center gap-3",children:g.jsxs("div",{className:`flex flex-col items-center justify-center w-16 h-16 rounded-full border-2 ${c(e.score)}`,children:[g.jsx("span",{className:"text-2xl font-bold",children:e.score}),g.jsx("span",{className:"text-[10px] font-medium opacity-70",children:d(e.score)})]})}),g.jsxs("div",{className:"flex items-center gap-2",children:[(()=>{const y=f(e.category,e.tags),v=y.icon;return g.jsxs("span",{className:"px-2 py-1 bg-blue-500/20 text-blue-400 text-xs font-medium rounded border border-blue-500/30 flex items-center gap-1.5",children:[g.jsx(v,{size:14}),y.name]})})(),g.jsxs("span",{className:"text-xs text-fg/50 flex items-center gap-1",children:[g.jsx(ni,{size:12}),p(e.created_at)]})]})]}),g.jsxs("div",{className:"flex-1",children:[g.jsx("a",{href:e.url,target:"_blank",rel:"noopener noreferrer",className:"text-lg font-semibold text-fg hover:text-blue-400 transition-colors line-clamp-2 mb-2 block",onClick:y=>{y.preventDefault(),t?.(e.url)},children:e.title}),g.jsx("p",{className:"text-sm text-fg/70 line-clamp-3",children:e.summary})]}),e.entities&&e.entities.length>0&&g.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.entities.slice(0,4).map((y,v)=>g.jsx("span",{className:"px-2 py-1 bg-white/5 text-fg/60 text-xs rounded border border-border",children:y},v)),e.entities.length>4&&g.jsxs("span",{className:"px-2 py-1 text-fg/40 text-xs",children:["+",e.entities.length-4," more"]})]}),g.jsxs("div",{className:"flex items-center gap-2 pt-2 border-t border-white/5",children:[g.jsxs("button",{onClick:()=>t?.(e.url),className:"flex-1 flex items-center justify-center gap-2 px-3 py-2 bg-white/5 hover:bg-white/10 rounded transition-colors text-sm",title:"Open URL",children:[g.jsx(Hl,{size:14}),g.jsx("span",{children:"Open"})]}),g.jsxs("button",{onClick:()=>n?.(e.summary),className:"flex-1 flex items-center justify-center gap-2 px-3 py-2 bg-white/5 hover:bg-white/10 rounded transition-colors text-sm",title:"Copy Summary",children:[g.jsx(Av,{size:14}),g.jsx("span",{children:"Copy"})]}),g.jsxs("button",{onClick:()=>r?.(e.id),className:"flex-1 flex items-center justify-center gap-2 px-3 py-2 bg-white/5 hover:bg-red-500/20 hover:text-red-400 rounded transition-colors text-sm",title:"Archive",children:[g.jsx(Vk,{size:14}),g.jsx("span",{children:"Archive"})]}),o&&g.jsx("button",{onClick:()=>o(e.id),className:"px-3 py-2 bg-white/5 hover:bg-yellow-500/20 hover:text-yellow-400 rounded transition-colors",title:"Bookmark",children:g.jsx(Gk,{size:14})})]})]})}function DN({isOpen:e,onClose:t,categoryId:n,signals:r,onOpenUrl:o,onCopyText:a,onArchive:l}){const c=PN.find(v=>v.id===n),d=r.filter(v=>{const w=v.tags||[],b=v.category?.toLowerCase()===n,S=w.some(_=>_.toLowerCase().includes(n));return b||S}),f=v=>{o?o(v):window.open(v,"_blank","noopener,noreferrer")},p=v=>{a?a(v):navigator.clipboard.writeText(v)},y=async v=>{l&&await l(v)};return g.jsx(_n,{children:e&&g.jsxs(g.Fragment,{children:[g.jsx(ze.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:t,className:"fixed inset-0 bg-black/50 backdrop-blur-sm z-40"}),g.jsx(ze.div,{initial:{x:"100%"},animate:{x:0},exit:{x:"100%"},transition:{type:"spring",damping:30,stiffness:300},className:"fixed right-0 top-0 h-full w-full md:w-2/3 lg:w-1/2 bg-bg border-l border-border z-50 overflow-y-auto custom-scrollbar",children:g.jsxs("div",{className:"p-6",children:[g.jsxs("div",{className:"flex items-center justify-between mb-6 sticky top-0 bg-bg pb-4 border-b border-border",children:[g.jsxs("div",{className:"flex items-center gap-3",children:[c?.icon&&g.jsx("div",{className:"w-10 h-10 flex items-center justify-center",children:g.jsx(c.icon,{size:40,className:"text-current opacity-80"})}),g.jsxs("div",{children:[g.jsx("h2",{className:"text-2xl font-bold",children:c?.name}),g.jsxs("p",{className:"text-sm text-fg/50",children:[d.length," ",d.length===1?"signal":"signals"]})]})]}),g.jsx("button",{onClick:t,className:"p-2 hover:bg-white/10 rounded transition-colors","aria-label":"Close drawer",children:g.jsx(Cr,{size:24})})]}),g.jsx("div",{className:"space-y-4",children:d.length===0?g.jsx("div",{className:"h-64 flex items-center justify-center text-fg/30",children:g.jsx("p",{className:"italic",children:"No signals in this category yet."})}):d.map(v=>g.jsx(LN,{signal:v,onOpen:f,onCopy:p,onArchive:y},v.id))})]})})]})})}function MN({onOpenUrl:e,onCopyText:t}){const[n,r]=L.useState([]),[o,a]=L.useState(!0),[l,c]=L.useState(null),[d,f]=L.useState(""),[p,y]=L.useState(null);L.useEffect(()=>{(async()=>{a(!0);let E=Ee.from("signals").select("*").order("created_at",{ascending:!1}).limit(50);p&&(E=E.ilike("category",p)),d&&(E=E.or(`title.ilike.%${d}%,summary.ilike.%${d}%,url.ilike.%${d}%`));const{data:P,error:j}=await E;j?console.error("Error fetching signals:",j):r(P||[]),a(!1)})();const _=Ee.channel("signals").on("postgres_changes",{event:"INSERT",schema:"public",table:"signals"},E=>{r(P=>[E.new,...P])}).subscribe();return()=>{_.unsubscribe()}},[d,p]);const v=S=>{e?e(S):window.open(S,"_blank","noopener,noreferrer")},w=S=>{t?t(S):navigator.clipboard.writeText(S)},b=async S=>{await Ee.from("signals").delete().eq("id",S),r(_=>_.filter(E=>E.id!==S))};return g.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[g.jsx("div",{className:"px-4 pt-2",children:g.jsx(AN,{signals:n,limit:10,onSignalClick:S=>{const _=n.find(E=>E.id===S);_&&_.category&&c(_.category.toLowerCase())}})}),g.jsxs("div",{className:"px-4 pt-1 pb-2 space-y-3",children:[g.jsxs("div",{className:"relative",children:[g.jsx($d,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-fg/40"}),g.jsx("input",{type:"text",placeholder:"Search signals by title, summary, or URL...",value:d,onChange:S=>f(S.target.value),className:"w-full bg-surface border border-border/20 rounded-xl py-3 pl-10 pr-10 text-sm text-fg placeholder:text-fg/40 focus:border-primary/50 focus:ring-2 focus:ring-primary/20 outline-none transition-all"}),d&&g.jsx("button",{onClick:()=>f(""),className:"absolute right-3 top-1/2 -translate-y-1/2 text-fg/40 hover:text-fg transition-colors",title:"Clear search",children:g.jsx(Cr,{size:16})})]}),g.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[g.jsx(rS,{className:"w-3.5 h-3.5 text-fg/40"}),g.jsx("button",{onClick:()=>y(null),className:`px-3 py-1.5 rounded-lg text-xs font-medium transition-all ${p===null?"bg-primary text-white shadow-sm":"bg-surface hover:bg-surface/80 text-fg/60 hover:text-fg border border-border/20"}`,children:"All"}),["AI & ML","Business","Politics","Technology","Finance","Crypto","Science","Other"].map(S=>g.jsx("button",{onClick:()=>y(S),className:`px-3 py-1.5 rounded-lg text-xs font-medium transition-all ${p===S?"bg-primary text-white shadow-sm":"bg-surface hover:bg-surface/80 text-fg/60 hover:text-fg border border-border/20"}`,children:S},S))]})]}),g.jsx("div",{className:"flex-1 overflow-y-auto px-4 pb-12 custom-scrollbar",children:o?g.jsx("div",{className:"h-64 flex items-center justify-center text-fg/30",children:g.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-blue-400"})}):g.jsx(IN,{signals:n,onCategoryClick:S=>c(S)})}),g.jsx(DN,{isOpen:!!l,onClose:()=>c(null),categoryId:l||"",signals:n,onOpenUrl:v,onCopyText:w,onArchive:b})]})}function UN(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const zN=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,FN=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,$N={};function V0(e,t){return($N.jsx?FN:zN).test(e)}const BN=/[ \t\n\f\r]/g;function VN(e){return typeof e=="object"?e.type==="text"?q0(e.value):!1:q0(e)}function q0(e){return e.replace(BN,"")===""}class Ko{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}}Ko.prototype.normal={};Ko.prototype.property={};Ko.prototype.space=void 0;function e1(e,t){const n={},r={};for(const o of e)Object.assign(n,o.property),Object.assign(r,o.normal);return new Ko(n,r,t)}function bh(e){return e.toLowerCase()}class Vt{constructor(t,n){this.attribute=n,this.property=t}}Vt.prototype.attribute="";Vt.prototype.booleanish=!1;Vt.prototype.boolean=!1;Vt.prototype.commaOrSpaceSeparated=!1;Vt.prototype.commaSeparated=!1;Vt.prototype.defined=!1;Vt.prototype.mustUseProperty=!1;Vt.prototype.number=!1;Vt.prototype.overloadedBoolean=!1;Vt.prototype.property="";Vt.prototype.spaceSeparated=!1;Vt.prototype.space=void 0;let qN=0;const Ne=ls(),lt=ls(),kh=ls(),ee=ls(),Ve=ls(),ei=ls(),Yt=ls();function ls(){return 2**++qN}const Sh=Object.freeze(Object.defineProperty({__proto__:null,boolean:Ne,booleanish:lt,commaOrSpaceSeparated:Yt,commaSeparated:ei,number:ee,overloadedBoolean:kh,spaceSeparated:Ve},Symbol.toStringTag,{value:"Module"})),jd=Object.keys(Sh);class Af extends Vt{constructor(t,n,r,o){let a=-1;if(super(t,n),H0(this,"space",o),typeof r=="number")for(;++a<jd.length;){const l=jd[a];H0(this,jd[a],(r&Sh[l])===Sh[l])}}}Af.prototype.defined=!0;function H0(e,t,n){n&&(e[t]=n)}function di(e){const t={},n={};for(const[r,o]of Object.entries(e.properties)){const a=new Af(r,e.transform(e.attributes||{},r),o,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(a.mustUseProperty=!0),t[r]=a,n[bh(r)]=r,n[bh(a.attribute)]=r}return new Ko(t,n,e.space)}const t1=di({properties:{ariaActiveDescendant:null,ariaAtomic:lt,ariaAutoComplete:null,ariaBusy:lt,ariaChecked:lt,ariaColCount:ee,ariaColIndex:ee,ariaColSpan:ee,ariaControls:Ve,ariaCurrent:null,ariaDescribedBy:Ve,ariaDetails:null,ariaDisabled:lt,ariaDropEffect:Ve,ariaErrorMessage:null,ariaExpanded:lt,ariaFlowTo:Ve,ariaGrabbed:lt,ariaHasPopup:null,ariaHidden:lt,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Ve,ariaLevel:ee,ariaLive:null,ariaModal:lt,ariaMultiLine:lt,ariaMultiSelectable:lt,ariaOrientation:null,ariaOwns:Ve,ariaPlaceholder:null,ariaPosInSet:ee,ariaPressed:lt,ariaReadOnly:lt,ariaRelevant:null,ariaRequired:lt,ariaRoleDescription:Ve,ariaRowCount:ee,ariaRowIndex:ee,ariaRowSpan:ee,ariaSelected:lt,ariaSetSize:ee,ariaSort:null,ariaValueMax:ee,ariaValueMin:ee,ariaValueNow:ee,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function n1(e,t){return t in e?e[t]:t}function r1(e,t){return n1(e,t.toLowerCase())}const HN=di({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:ei,acceptCharset:Ve,accessKey:Ve,action:null,allow:null,allowFullScreen:Ne,allowPaymentRequest:Ne,allowUserMedia:Ne,alt:null,as:null,async:Ne,autoCapitalize:null,autoComplete:Ve,autoFocus:Ne,autoPlay:Ne,blocking:Ve,capture:null,charSet:null,checked:Ne,cite:null,className:Ve,cols:ee,colSpan:null,content:null,contentEditable:lt,controls:Ne,controlsList:Ve,coords:ee|ei,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Ne,defer:Ne,dir:null,dirName:null,disabled:Ne,download:kh,draggable:lt,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Ne,formTarget:null,headers:Ve,height:ee,hidden:kh,high:ee,href:null,hrefLang:null,htmlFor:Ve,httpEquiv:Ve,id:null,imageSizes:null,imageSrcSet:null,inert:Ne,inputMode:null,integrity:null,is:null,isMap:Ne,itemId:null,itemProp:Ve,itemRef:Ve,itemScope:Ne,itemType:Ve,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Ne,low:ee,manifest:null,max:null,maxLength:ee,media:null,method:null,min:null,minLength:ee,multiple:Ne,muted:Ne,name:null,nonce:null,noModule:Ne,noValidate:Ne,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:Ne,optimum:ee,pattern:null,ping:Ve,placeholder:null,playsInline:Ne,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Ne,referrerPolicy:null,rel:Ve,required:Ne,reversed:Ne,rows:ee,rowSpan:ee,sandbox:Ve,scope:null,scoped:Ne,seamless:Ne,selected:Ne,shadowRootClonable:Ne,shadowRootDelegatesFocus:Ne,shadowRootMode:null,shape:null,size:ee,sizes:null,slot:null,span:ee,spellCheck:lt,src:null,srcDoc:null,srcLang:null,srcSet:null,start:ee,step:null,style:null,tabIndex:ee,target:null,title:null,translate:null,type:null,typeMustMatch:Ne,useMap:null,value:lt,width:ee,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Ve,axis:null,background:null,bgColor:null,border:ee,borderColor:null,bottomMargin:ee,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Ne,declare:Ne,event:null,face:null,frame:null,frameBorder:null,hSpace:ee,leftMargin:ee,link:null,longDesc:null,lowSrc:null,marginHeight:ee,marginWidth:ee,noResize:Ne,noHref:Ne,noShade:Ne,noWrap:Ne,object:null,profile:null,prompt:null,rev:null,rightMargin:ee,rules:null,scheme:null,scrolling:lt,standby:null,summary:null,text:null,topMargin:ee,valueType:null,version:null,vAlign:null,vLink:null,vSpace:ee,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:Ne,disableRemotePlayback:Ne,prefix:null,property:null,results:ee,security:null,unselectable:null},space:"html",transform:r1}),WN=di({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:Yt,accentHeight:ee,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:ee,amplitude:ee,arabicForm:null,ascent:ee,attributeName:null,attributeType:null,azimuth:ee,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:ee,by:null,calcMode:null,capHeight:ee,className:Ve,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:ee,diffuseConstant:ee,direction:null,display:null,dur:null,divisor:ee,dominantBaseline:null,download:Ne,dx:null,dy:null,edgeMode:null,editable:null,elevation:ee,enableBackground:null,end:null,event:null,exponent:ee,externalResourcesRequired:null,fill:null,fillOpacity:ee,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:ei,g2:ei,glyphName:ei,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:ee,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:ee,horizOriginX:ee,horizOriginY:ee,id:null,ideographic:ee,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:ee,k:ee,k1:ee,k2:ee,k3:ee,k4:ee,kernelMatrix:Yt,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:ee,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:ee,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:ee,overlineThickness:ee,paintOrder:null,panose1:null,path:null,pathLength:ee,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Ve,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:ee,pointsAtY:ee,pointsAtZ:ee,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Yt,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Yt,rev:Yt,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Yt,requiredFeatures:Yt,requiredFonts:Yt,requiredFormats:Yt,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:ee,specularExponent:ee,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:ee,strikethroughThickness:ee,string:null,stroke:null,strokeDashArray:Yt,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:ee,strokeOpacity:ee,strokeWidth:null,style:null,surfaceScale:ee,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Yt,tabIndex:ee,tableValues:null,target:null,targetX:ee,targetY:ee,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Yt,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:ee,underlineThickness:ee,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:ee,values:null,vAlphabetic:ee,vMathematical:ee,vectorEffect:null,vHanging:ee,vIdeographic:ee,version:null,vertAdvY:ee,vertOriginX:ee,vertOriginY:ee,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:ee,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:n1}),s1=di({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()}}),i1=di({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:r1}),o1=di({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),KN={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},GN=/[A-Z]/g,W0=/-[a-z]/g,JN=/^data[-\w.:]+$/i;function YN(e,t){const n=bh(t);let r=t,o=Vt;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&JN.test(t)){if(t.charAt(4)==="-"){const a=t.slice(5).replace(W0,QN);r="data"+a.charAt(0).toUpperCase()+a.slice(1)}else{const a=t.slice(4);if(!W0.test(a)){let l=a.replace(GN,XN);l.charAt(0)!=="-"&&(l="-"+l),t="data"+l}}o=Af}return new o(r,t)}function XN(e){return"-"+e.toLowerCase()}function QN(e){return e.charAt(1).toUpperCase()}const ZN=e1([t1,HN,s1,i1,o1],"html"),Pf=e1([t1,WN,s1,i1,o1],"svg");function eR(e){return e.join(" ").trim()}var Bs={},Ad,K0;function tR(){if(K0)return Ad;K0=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,n=/^\s*/,r=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,o=/^:\s*/,a=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,l=/^[;\s]*/,c=/^\s+|\s+$/g,d=`
|
|
102
102
|
`,f="/",p="*",y="",v="comment",w="declaration";function b(_,E){if(typeof _!="string")throw new TypeError("First argument must be a string");if(!_)return[];E=E||{};var P=1,j=1;function D(ne){var Z=ne.match(t);Z&&(P+=Z.length);var fe=ne.lastIndexOf(d);j=~fe?ne.length-fe:j+ne.length}function $(){var ne={line:P,column:j};return function(Z){return Z.position=new O(ne),J(),Z}}function O(ne){this.start=ne,this.end={line:P,column:j},this.source=E.source}O.prototype.content=_;function z(ne){var Z=new Error(E.source+":"+P+":"+j+": "+ne);if(Z.reason=ne,Z.filename=E.source,Z.line=P,Z.column=j,Z.source=_,!E.silent)throw Z}function q(ne){var Z=ne.exec(_);if(Z){var fe=Z[0];return D(fe),_=_.slice(fe.length),Z}}function J(){q(n)}function ie(ne){var Z;for(ne=ne||[];Z=re();)Z!==!1&&ne.push(Z);return ne}function re(){var ne=$();if(!(f!=_.charAt(0)||p!=_.charAt(1))){for(var Z=2;y!=_.charAt(Z)&&(p!=_.charAt(Z)||f!=_.charAt(Z+1));)++Z;if(Z+=2,y===_.charAt(Z-1))return z("End of comment missing");var fe=_.slice(2,Z-2);return j+=2,D(fe),_=_.slice(Z),j+=2,ne({type:v,comment:fe})}}function Q(){var ne=$(),Z=q(r);if(Z){if(re(),!q(o))return z("property missing ':'");var fe=q(a),le=ne({type:w,property:S(Z[0].replace(e,y)),value:fe?S(fe[0].replace(e,y)):y});return q(l),le}}function ye(){var ne=[];ie(ne);for(var Z;Z=Q();)Z!==!1&&(ne.push(Z),ie(ne));return ne}return J(),ye()}function S(_){return _?_.replace(c,y):y}return Ad=b,Ad}var G0;function nR(){if(G0)return Bs;G0=1;var e=Bs&&Bs.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Bs,"__esModule",{value:!0}),Bs.default=n;const t=e(tR());function n(r,o){let a=null;if(!r||typeof r!="string")return a;const l=(0,t.default)(r),c=typeof o=="function";return l.forEach(d=>{if(d.type!=="declaration")return;const{property:f,value:p}=d;c?o(f,p,d):p&&(a=a||{},a[f]=p)}),a}return Bs}var no={},J0;function rR(){if(J0)return no;J0=1,Object.defineProperty(no,"__esModule",{value:!0}),no.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,n=/^[^-]+$/,r=/^-(webkit|moz|ms|o|khtml)-/,o=/^-(ms)-/,a=function(f){return!f||n.test(f)||e.test(f)},l=function(f,p){return p.toUpperCase()},c=function(f,p){return"".concat(p,"-")},d=function(f,p){return p===void 0&&(p={}),a(f)?f:(f=f.toLowerCase(),p.reactCompat?f=f.replace(o,c):f=f.replace(r,c),f.replace(t,l))};return no.camelCase=d,no}var ro,Y0;function sR(){if(Y0)return ro;Y0=1;var e=ro&&ro.__importDefault||function(o){return o&&o.__esModule?o:{default:o}},t=e(nR()),n=rR();function r(o,a){var l={};return!o||typeof o!="string"||(0,t.default)(o,function(c,d){c&&d&&(l[(0,n.camelCase)(c,a)]=d)}),l}return r.default=r,ro=r,ro}var iR=sR();const oR=ql(iR),a1=l1("end"),Nf=l1("start");function l1(e){return t;function t(n){const r=n&&n.position&&n.position[e]||{};if(typeof r.line=="number"&&r.line>0&&typeof r.column=="number"&&r.column>0)return{line:r.line,column:r.column,offset:typeof r.offset=="number"&&r.offset>-1?r.offset:void 0}}}function aR(e){const t=Nf(e),n=a1(e);if(t&&n)return{start:t,end:n}}function vo(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?X0(e.position):"start"in e||"end"in e?X0(e):"line"in e||"column"in e?_h(e):""}function _h(e){return Q0(e&&e.line)+":"+Q0(e&&e.column)}function X0(e){return _h(e&&e.start)+"-"+_h(e&&e.end)}function Q0(e){return e&&typeof e=="number"?e:1}class Pt extends Error{constructor(t,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let o="",a={},l=!1;if(n&&("line"in n&&"column"in n?a={place:n}:"start"in n&&"end"in n?a={place:n}:"type"in n?a={ancestors:[n],place:n.position}:a={...n}),typeof t=="string"?o=t:!a.cause&&t&&(l=!0,o=t.message,a.cause=t),!a.ruleId&&!a.source&&typeof r=="string"){const d=r.indexOf(":");d===-1?a.ruleId=r:(a.source=r.slice(0,d),a.ruleId=r.slice(d+1))}if(!a.place&&a.ancestors&&a.ancestors){const d=a.ancestors[a.ancestors.length-1];d&&(a.place=d.position)}const c=a.place&&"start"in a.place?a.place.start:a.place;this.ancestors=a.ancestors||void 0,this.cause=a.cause||void 0,this.column=c?c.column:void 0,this.fatal=void 0,this.file="",this.message=o,this.line=c?c.line:void 0,this.name=vo(a.place)||"1:1",this.place=a.place||void 0,this.reason=this.message,this.ruleId=a.ruleId||void 0,this.source=a.source||void 0,this.stack=l&&a.cause&&typeof a.cause.stack=="string"?a.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}Pt.prototype.file="";Pt.prototype.name="";Pt.prototype.reason="";Pt.prototype.message="";Pt.prototype.stack="";Pt.prototype.column=void 0;Pt.prototype.line=void 0;Pt.prototype.ancestors=void 0;Pt.prototype.cause=void 0;Pt.prototype.fatal=void 0;Pt.prototype.place=void 0;Pt.prototype.ruleId=void 0;Pt.prototype.source=void 0;const Rf={}.hasOwnProperty,lR=new Map,uR=/[A-Z]/g,cR=new Set(["table","tbody","thead","tfoot","tr"]),dR=new Set(["td","th"]),u1="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function hR(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=t.filePath||void 0;let r;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");r=wR(n,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof t.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");r=xR(n,t.jsx,t.jsxs)}const o={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?Pf:ZN,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},a=c1(o,e,void 0);return a&&typeof a!="string"?a:o.create(e,o.Fragment,{children:a||void 0},void 0)}function c1(e,t,n){if(t.type==="element")return fR(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return pR(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return gR(e,t,n);if(t.type==="mdxjsEsm")return mR(e,t);if(t.type==="root")return yR(e,t,n);if(t.type==="text")return vR(e,t)}function fR(e,t,n){const r=e.schema;let o=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(o=Pf,e.schema=o),e.ancestors.push(t);const a=h1(e,t.tagName,!1),l=bR(e,t);let c=If(e,t);return cR.has(t.tagName)&&(c=c.filter(function(d){return typeof d=="string"?!VN(d):!0})),d1(e,l,a,t),Of(l,c),e.ancestors.pop(),e.schema=r,e.create(t,a,l,n)}function pR(e,t){if(t.data&&t.data.estree&&e.evaluater){const r=t.data.estree.body[0];return r.type,e.evaluater.evaluateExpression(r.expression)}Do(e,t.position)}function mR(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);Do(e,t.position)}function gR(e,t,n){const r=e.schema;let o=r;t.name==="svg"&&r.space==="html"&&(o=Pf,e.schema=o),e.ancestors.push(t);const a=t.name===null?e.Fragment:h1(e,t.name,!0),l=kR(e,t),c=If(e,t);return d1(e,l,a,t),Of(l,c),e.ancestors.pop(),e.schema=r,e.create(t,a,l,n)}function yR(e,t,n){const r={};return Of(r,If(e,t)),e.create(t,e.Fragment,r,n)}function vR(e,t){return t.value}function d1(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function Of(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function xR(e,t,n){return r;function r(o,a,l,c){const f=Array.isArray(l.children)?n:t;return c?f(a,l,c):f(a,l)}}function wR(e,t){return n;function n(r,o,a,l){const c=Array.isArray(a.children),d=Nf(r);return t(o,a,l,c,{columnNumber:d?d.column-1:void 0,fileName:e,lineNumber:d?d.line:void 0},void 0)}}function bR(e,t){const n={};let r,o;for(o in t.properties)if(o!=="children"&&Rf.call(t.properties,o)){const a=SR(e,o,t.properties[o]);if(a){const[l,c]=a;e.tableCellAlignToStyle&&l==="align"&&typeof c=="string"&&dR.has(t.tagName)?r=c:n[l]=c}}if(r){const a=n.style||(n.style={});a[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function kR(e,t){const n={};for(const r of t.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&e.evaluater){const a=r.data.estree.body[0];a.type;const l=a.expression;l.type;const c=l.properties[0];c.type,Object.assign(n,e.evaluater.evaluateExpression(c.argument))}else Do(e,t.position);else{const o=r.name;let a;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&e.evaluater){const c=r.value.data.estree.body[0];c.type,a=e.evaluater.evaluateExpression(c.expression)}else Do(e,t.position);else a=r.value===null?!0:r.value;n[o]=a}return n}function If(e,t){const n=[];let r=-1;const o=e.passKeys?new Map:lR;for(;++r<t.children.length;){const a=t.children[r];let l;if(e.passKeys){const d=a.type==="element"?a.tagName:a.type==="mdxJsxFlowElement"||a.type==="mdxJsxTextElement"?a.name:void 0;if(d){const f=o.get(d)||0;l=d+"-"+f,o.set(d,f+1)}}const c=c1(e,a,l);c!==void 0&&n.push(c)}return n}function SR(e,t,n){const r=YN(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?UN(n):eR(n)),r.property==="style"){let o=typeof n=="object"?n:_R(e,String(n));return e.stylePropertyNameCase==="css"&&(o=ER(o)),["style",o]}return[e.elementAttributeNameCase==="react"&&r.space?KN[r.property]||r.property:r.attribute,n]}}function _R(e,t){try{return oR(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const r=n,o=new Pt("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:r,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw o.file=e.filePath||void 0,o.url=u1+"#cannot-parse-style-attribute",o}}function h1(e,t,n){let r;if(!n)r={type:"Literal",value:t};else if(t.includes(".")){const o=t.split(".");let a=-1,l;for(;++a<o.length;){const c=V0(o[a])?{type:"Identifier",name:o[a]}:{type:"Literal",value:o[a]};l=l?{type:"MemberExpression",object:l,property:c,computed:!!(a&&c.type==="Literal"),optional:!1}:c}r=l}else r=V0(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(r.type==="Literal"){const o=r.value;return Rf.call(e.components,o)?e.components[o]:o}if(e.evaluater)return e.evaluater.evaluateExpression(r);Do(e)}function Do(e,t){const n=new Pt("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw n.file=e.filePath||void 0,n.url=u1+"#cannot-handle-mdx-estrees-without-createevaluater",n}function ER(e){const t={};let n;for(n in e)Rf.call(e,n)&&(t[TR(n)]=e[n]);return t}function TR(e){let t=e.replace(uR,CR);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function CR(e){return"-"+e.toLowerCase()}const Pd={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},jR={};function AR(e,t){const n=jR,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,o=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return f1(e,r,o)}function f1(e,t,n){if(PR(e)){if("value"in e)return e.type==="html"&&!n?"":e.value;if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return Z0(e.children,t,n)}return Array.isArray(e)?Z0(e,t,n):""}function Z0(e,t,n){const r=[];let o=-1;for(;++o<e.length;)r[o]=f1(e[o],t,n);return r.join("")}function PR(e){return!!(e&&typeof e=="object")}const ev=document.createElement("i");function Lf(e){const t="&"+e+";";ev.innerHTML=t;const n=ev.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function Mn(e,t,n,r){const o=e.length;let a=0,l;if(t<0?t=-t>o?0:o+t:t=t>o?o:t,n=n>0?n:0,r.length<1e4)l=Array.from(r),l.unshift(t,n),e.splice(...l);else for(n&&e.splice(t,n);a<r.length;)l=r.slice(a,a+1e4),l.unshift(t,0),e.splice(...l),a+=1e4,t+=1e4}function hn(e,t){return e.length>0?(Mn(e,e.length,0,t),e):t}const tv={}.hasOwnProperty;function NR(e){const t={};let n=-1;for(;++n<e.length;)RR(t,e[n]);return t}function RR(e,t){let n;for(n in t){const o=(tv.call(e,n)?e[n]:void 0)||(e[n]={}),a=t[n];let l;if(a)for(l in a){tv.call(o,l)||(o[l]=[]);const c=a[l];OR(o[l],Array.isArray(c)?c:c?[c]:[])}}}function OR(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);Mn(e,0,0,r)}function p1(e,t){const n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function ti(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const In=Nr(/[A-Za-z]/),Zt=Nr(/[\dA-Za-z]/),IR=Nr(/[#-'*+\--9=?A-Z^-~]/);function Eh(e){return e!==null&&(e<32||e===127)}const Th=Nr(/\d/),LR=Nr(/[\dA-Fa-f]/),DR=Nr(/[!-/:-@[-`{-~]/);function Ce(e){return e!==null&&e<-2}function Bt(e){return e!==null&&(e<0||e===32)}function Ue(e){return e===-2||e===-1||e===32}const MR=Nr(new RegExp("\\p{P}|\\p{S}","u")),UR=Nr(/\s/);function Nr(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function hi(e){const t=[];let n=-1,r=0,o=0;for(;++n<e.length;){const a=e.charCodeAt(n);let l="";if(a===37&&Zt(e.charCodeAt(n+1))&&Zt(e.charCodeAt(n+2)))o=2;else if(a<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(a))||(l=String.fromCharCode(a));else if(a>55295&&a<57344){const c=e.charCodeAt(n+1);a<56320&&c>56319&&c<57344?(l=String.fromCharCode(a,c),o=1):l="�"}else l=String.fromCharCode(a);l&&(t.push(e.slice(r,n),encodeURIComponent(l)),r=n+o+1,l=""),o&&(n+=o,o=0)}return t.join("")+e.slice(r)}function qe(e,t,n,r){const o=r?r-1:Number.POSITIVE_INFINITY;let a=0;return l;function l(d){return Ue(d)?(e.enter(n),c(d)):t(d)}function c(d){return Ue(d)&&a++<o?(e.consume(d),c):(e.exit(n),t(d))}}const zR={tokenize:FR};function FR(e){const t=e.attempt(this.parser.constructs.contentInitial,r,o);let n;return t;function r(c){if(c===null){e.consume(c);return}return e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),qe(e,t,"linePrefix")}function o(c){return e.enter("paragraph"),a(c)}function a(c){const d=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=d),n=d,l(c)}function l(c){if(c===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(c);return}return Ce(c)?(e.consume(c),e.exit("chunkText"),a):(e.consume(c),l)}}const $R={tokenize:BR},nv={tokenize:VR};function BR(e){const t=this,n=[];let r=0,o,a,l;return c;function c(j){if(r<n.length){const D=n[r];return t.containerState=D[1],e.attempt(D[0].continuation,d,f)(j)}return f(j)}function d(j){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,o&&P();const D=t.events.length;let $=D,O;for(;$--;)if(t.events[$][0]==="exit"&&t.events[$][1].type==="chunkFlow"){O=t.events[$][1].end;break}E(r);let z=D;for(;z<t.events.length;)t.events[z][1].end={...O},z++;return Mn(t.events,$+1,0,t.events.slice(D)),t.events.length=z,f(j)}return c(j)}function f(j){if(r===n.length){if(!o)return v(j);if(o.currentConstruct&&o.currentConstruct.concrete)return b(j);t.interrupt=!!(o.currentConstruct&&!o._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(nv,p,y)(j)}function p(j){return o&&P(),E(r),v(j)}function y(j){return t.parser.lazy[t.now().line]=r!==n.length,l=t.now().offset,b(j)}function v(j){return t.containerState={},e.attempt(nv,w,b)(j)}function w(j){return r++,n.push([t.currentConstruct,t.containerState]),v(j)}function b(j){if(j===null){o&&P(),E(0),e.consume(j);return}return o=o||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:o,contentType:"flow",previous:a}),S(j)}function S(j){if(j===null){_(e.exit("chunkFlow"),!0),E(0),e.consume(j);return}return Ce(j)?(e.consume(j),_(e.exit("chunkFlow")),r=0,t.interrupt=void 0,c):(e.consume(j),S)}function _(j,D){const $=t.sliceStream(j);if(D&&$.push(null),j.previous=a,a&&(a.next=j),a=j,o.defineSkip(j.start),o.write($),t.parser.lazy[j.start.line]){let O=o.events.length;for(;O--;)if(o.events[O][1].start.offset<l&&(!o.events[O][1].end||o.events[O][1].end.offset>l))return;const z=t.events.length;let q=z,J,ie;for(;q--;)if(t.events[q][0]==="exit"&&t.events[q][1].type==="chunkFlow"){if(J){ie=t.events[q][1].end;break}J=!0}for(E(r),O=z;O<t.events.length;)t.events[O][1].end={...ie},O++;Mn(t.events,q+1,0,t.events.slice(z)),t.events.length=O}}function E(j){let D=n.length;for(;D-- >j;){const $=n[D];t.containerState=$[1],$[0].exit.call(t,e)}n.length=j}function P(){o.write([null]),a=void 0,o=void 0,t.containerState._closeFlow=void 0}}function VR(e,t,n){return qe(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function rv(e){if(e===null||Bt(e)||UR(e))return 1;if(MR(e))return 2}function Df(e,t,n){const r=[];let o=-1;for(;++o<e.length;){const a=e[o].resolveAll;a&&!r.includes(a)&&(t=a(t,n),r.push(a))}return t}const Ch={name:"attention",resolveAll:qR,tokenize:HR};function qR(e,t){let n=-1,r,o,a,l,c,d,f,p;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(r=n;r--;)if(e[r][0]==="exit"&&e[r][1].type==="attentionSequence"&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;d=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const y={...e[r][1].end},v={...e[n][1].start};sv(y,-d),sv(v,d),l={type:d>1?"strongSequence":"emphasisSequence",start:y,end:{...e[r][1].end}},c={type:d>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:v},a={type:d>1?"strongText":"emphasisText",start:{...e[r][1].end},end:{...e[n][1].start}},o={type:d>1?"strong":"emphasis",start:{...l.start},end:{...c.end}},e[r][1].end={...l.start},e[n][1].start={...c.end},f=[],e[r][1].end.offset-e[r][1].start.offset&&(f=hn(f,[["enter",e[r][1],t],["exit",e[r][1],t]])),f=hn(f,[["enter",o,t],["enter",l,t],["exit",l,t],["enter",a,t]]),f=hn(f,Df(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),f=hn(f,[["exit",a,t],["enter",c,t],["exit",c,t],["exit",o,t]]),e[n][1].end.offset-e[n][1].start.offset?(p=2,f=hn(f,[["enter",e[n][1],t],["exit",e[n][1],t]])):p=0,Mn(e,r-1,n-r+3,f),n=r+f.length-p-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function HR(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,o=rv(r);let a;return l;function l(d){return a=d,e.enter("attentionSequence"),c(d)}function c(d){if(d===a)return e.consume(d),c;const f=e.exit("attentionSequence"),p=rv(d),y=!p||p===2&&o||n.includes(d),v=!o||o===2&&p||n.includes(r);return f._open=!!(a===42?y:y&&(o||!v)),f._close=!!(a===42?v:v&&(p||!y)),t(d)}}function sv(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const WR={name:"autolink",tokenize:KR};function KR(e,t,n){let r=0;return o;function o(w){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(w),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),a}function a(w){return In(w)?(e.consume(w),l):w===64?n(w):f(w)}function l(w){return w===43||w===45||w===46||Zt(w)?(r=1,c(w)):f(w)}function c(w){return w===58?(e.consume(w),r=0,d):(w===43||w===45||w===46||Zt(w))&&r++<32?(e.consume(w),c):(r=0,f(w))}function d(w){return w===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(w),e.exit("autolinkMarker"),e.exit("autolink"),t):w===null||w===32||w===60||Eh(w)?n(w):(e.consume(w),d)}function f(w){return w===64?(e.consume(w),p):IR(w)?(e.consume(w),f):n(w)}function p(w){return Zt(w)?y(w):n(w)}function y(w){return w===46?(e.consume(w),r=0,p):w===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(w),e.exit("autolinkMarker"),e.exit("autolink"),t):v(w)}function v(w){if((w===45||Zt(w))&&r++<63){const b=w===45?v:y;return e.consume(w),b}return n(w)}}const au={partial:!0,tokenize:GR};function GR(e,t,n){return r;function r(a){return Ue(a)?qe(e,o,"linePrefix")(a):o(a)}function o(a){return a===null||Ce(a)?t(a):n(a)}}const m1={continuation:{tokenize:YR},exit:XR,name:"blockQuote",tokenize:JR};function JR(e,t,n){const r=this;return o;function o(l){if(l===62){const c=r.containerState;return c.open||(e.enter("blockQuote",{_container:!0}),c.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(l),e.exit("blockQuoteMarker"),a}return n(l)}function a(l){return Ue(l)?(e.enter("blockQuotePrefixWhitespace"),e.consume(l),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(l))}}function YR(e,t,n){const r=this;return o;function o(l){return Ue(l)?qe(e,a,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(l):a(l)}function a(l){return e.attempt(m1,t,n)(l)}}function XR(e){e.exit("blockQuote")}const g1={name:"characterEscape",tokenize:QR};function QR(e,t,n){return r;function r(a){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(a),e.exit("escapeMarker"),o}function o(a){return DR(a)?(e.enter("characterEscapeValue"),e.consume(a),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(a)}}const y1={name:"characterReference",tokenize:ZR};function ZR(e,t,n){const r=this;let o=0,a,l;return c;function c(y){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(y),e.exit("characterReferenceMarker"),d}function d(y){return y===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(y),e.exit("characterReferenceMarkerNumeric"),f):(e.enter("characterReferenceValue"),a=31,l=Zt,p(y))}function f(y){return y===88||y===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(y),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),a=6,l=LR,p):(e.enter("characterReferenceValue"),a=7,l=Th,p(y))}function p(y){if(y===59&&o){const v=e.exit("characterReferenceValue");return l===Zt&&!Lf(r.sliceSerialize(v))?n(y):(e.enter("characterReferenceMarker"),e.consume(y),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return l(y)&&o++<a?(e.consume(y),p):n(y)}}const iv={partial:!0,tokenize:tO},ov={concrete:!0,name:"codeFenced",tokenize:eO};function eO(e,t,n){const r=this,o={partial:!0,tokenize:$};let a=0,l=0,c;return d;function d(O){return f(O)}function f(O){const z=r.events[r.events.length-1];return a=z&&z[1].type==="linePrefix"?z[2].sliceSerialize(z[1],!0).length:0,c=O,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),p(O)}function p(O){return O===c?(l++,e.consume(O),p):l<3?n(O):(e.exit("codeFencedFenceSequence"),Ue(O)?qe(e,y,"whitespace")(O):y(O))}function y(O){return O===null||Ce(O)?(e.exit("codeFencedFence"),r.interrupt?t(O):e.check(iv,S,D)(O)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),v(O))}function v(O){return O===null||Ce(O)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),y(O)):Ue(O)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),qe(e,w,"whitespace")(O)):O===96&&O===c?n(O):(e.consume(O),v)}function w(O){return O===null||Ce(O)?y(O):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),b(O))}function b(O){return O===null||Ce(O)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),y(O)):O===96&&O===c?n(O):(e.consume(O),b)}function S(O){return e.attempt(o,D,_)(O)}function _(O){return e.enter("lineEnding"),e.consume(O),e.exit("lineEnding"),E}function E(O){return a>0&&Ue(O)?qe(e,P,"linePrefix",a+1)(O):P(O)}function P(O){return O===null||Ce(O)?e.check(iv,S,D)(O):(e.enter("codeFlowValue"),j(O))}function j(O){return O===null||Ce(O)?(e.exit("codeFlowValue"),P(O)):(e.consume(O),j)}function D(O){return e.exit("codeFenced"),t(O)}function $(O,z,q){let J=0;return ie;function ie(Z){return O.enter("lineEnding"),O.consume(Z),O.exit("lineEnding"),re}function re(Z){return O.enter("codeFencedFence"),Ue(Z)?qe(O,Q,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(Z):Q(Z)}function Q(Z){return Z===c?(O.enter("codeFencedFenceSequence"),ye(Z)):q(Z)}function ye(Z){return Z===c?(J++,O.consume(Z),ye):J>=l?(O.exit("codeFencedFenceSequence"),Ue(Z)?qe(O,ne,"whitespace")(Z):ne(Z)):q(Z)}function ne(Z){return Z===null||Ce(Z)?(O.exit("codeFencedFence"),z(Z)):q(Z)}}}function tO(e,t,n){const r=this;return o;function o(l){return l===null?n(l):(e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),a)}function a(l){return r.parser.lazy[r.now().line]?n(l):t(l)}}const Nd={name:"codeIndented",tokenize:rO},nO={partial:!0,tokenize:sO};function rO(e,t,n){const r=this;return o;function o(f){return e.enter("codeIndented"),qe(e,a,"linePrefix",5)(f)}function a(f){const p=r.events[r.events.length-1];return p&&p[1].type==="linePrefix"&&p[2].sliceSerialize(p[1],!0).length>=4?l(f):n(f)}function l(f){return f===null?d(f):Ce(f)?e.attempt(nO,l,d)(f):(e.enter("codeFlowValue"),c(f))}function c(f){return f===null||Ce(f)?(e.exit("codeFlowValue"),l(f)):(e.consume(f),c)}function d(f){return e.exit("codeIndented"),t(f)}}function sO(e,t,n){const r=this;return o;function o(l){return r.parser.lazy[r.now().line]?n(l):Ce(l)?(e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),o):qe(e,a,"linePrefix",5)(l)}function a(l){const c=r.events[r.events.length-1];return c&&c[1].type==="linePrefix"&&c[2].sliceSerialize(c[1],!0).length>=4?t(l):Ce(l)?o(l):n(l)}}const iO={name:"codeText",previous:aO,resolve:oO,tokenize:lO};function oO(e){let t=e.length-4,n=3,r,o;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(r=n;++r<t;)if(e[r][1].type==="codeTextData"){e[n][1].type="codeTextPadding",e[t][1].type="codeTextPadding",n+=2,t-=2;break}}for(r=n-1,t++;++r<=t;)o===void 0?r!==t&&e[r][1].type!=="lineEnding"&&(o=r):(r===t||e[r][1].type==="lineEnding")&&(e[o][1].type="codeTextData",r!==o+2&&(e[o][1].end=e[r-1][1].end,e.splice(o+2,r-o-2),t-=r-o-2,r=o+2),o=void 0);return e}function aO(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function lO(e,t,n){let r=0,o,a;return l;function l(y){return e.enter("codeText"),e.enter("codeTextSequence"),c(y)}function c(y){return y===96?(e.consume(y),r++,c):(e.exit("codeTextSequence"),d(y))}function d(y){return y===null?n(y):y===32?(e.enter("space"),e.consume(y),e.exit("space"),d):y===96?(a=e.enter("codeTextSequence"),o=0,p(y)):Ce(y)?(e.enter("lineEnding"),e.consume(y),e.exit("lineEnding"),d):(e.enter("codeTextData"),f(y))}function f(y){return y===null||y===32||y===96||Ce(y)?(e.exit("codeTextData"),d(y)):(e.consume(y),f)}function p(y){return y===96?(e.consume(y),o++,p):o===r?(e.exit("codeTextSequence"),e.exit("codeText"),t(y)):(a.type="codeTextData",f(y))}}class uO{constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,n){const r=n??Number.POSITIVE_INFINITY;return r<this.left.length?this.left.slice(t,r):t>this.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(t,n,r){const o=n||0;this.setCursor(Math.trunc(t));const a=this.right.splice(this.right.length-o,Number.POSITIVE_INFINITY);return r&&so(this.left,r),a.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),so(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),so(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t<this.left.length){const n=this.left.splice(t,Number.POSITIVE_INFINITY);so(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);so(this.left,n.reverse())}}}function so(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function v1(e){const t={};let n=-1,r,o,a,l,c,d,f;const p=new uO(e);for(;++n<p.length;){for(;n in t;)n=t[n];if(r=p.get(n),n&&r[1].type==="chunkFlow"&&p.get(n-1)[1].type==="listItemPrefix"&&(d=r[1]._tokenizer.events,a=0,a<d.length&&d[a][1].type==="lineEndingBlank"&&(a+=2),a<d.length&&d[a][1].type==="content"))for(;++a<d.length&&d[a][1].type!=="content";)d[a][1].type==="chunkText"&&(d[a][1]._isInFirstContentOfListItem=!0,a++);if(r[0]==="enter")r[1].contentType&&(Object.assign(t,cO(p,n)),n=t[n],f=!0);else if(r[1]._container){for(a=n,o=void 0;a--;)if(l=p.get(a),l[1].type==="lineEnding"||l[1].type==="lineEndingBlank")l[0]==="enter"&&(o&&(p.get(o)[1].type="lineEndingBlank"),l[1].type="lineEnding",o=a);else if(!(l[1].type==="linePrefix"||l[1].type==="listItemIndent"))break;o&&(r[1].end={...p.get(o)[1].start},c=p.slice(o,n),c.unshift(r),p.splice(o,n-o+1,c))}}return Mn(e,0,Number.POSITIVE_INFINITY,p.slice(0)),!f}function cO(e,t){const n=e.get(t)[1],r=e.get(t)[2];let o=t-1;const a=[];let l=n._tokenizer;l||(l=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(l._contentTypeTextTrailing=!0));const c=l.events,d=[],f={};let p,y,v=-1,w=n,b=0,S=0;const _=[S];for(;w;){for(;e.get(++o)[1]!==w;);a.push(o),w._tokenizer||(p=r.sliceStream(w),w.next||p.push(null),y&&l.defineSkip(w.start),w._isInFirstContentOfListItem&&(l._gfmTasklistFirstContentOfListItem=!0),l.write(p),w._isInFirstContentOfListItem&&(l._gfmTasklistFirstContentOfListItem=void 0)),y=w,w=w.next}for(w=n;++v<c.length;)c[v][0]==="exit"&&c[v-1][0]==="enter"&&c[v][1].type===c[v-1][1].type&&c[v][1].start.line!==c[v][1].end.line&&(S=v+1,_.push(S),w._tokenizer=void 0,w.previous=void 0,w=w.next);for(l.events=[],w?(w._tokenizer=void 0,w.previous=void 0):_.pop(),v=_.length;v--;){const E=c.slice(_[v],_[v+1]),P=a.pop();d.push([P,P+E.length-1]),e.splice(P,2,E)}for(d.reverse(),v=-1;++v<d.length;)f[b+d[v][0]]=b+d[v][1],b+=d[v][1]-d[v][0]-1;return f}const dO={resolve:fO,tokenize:pO},hO={partial:!0,tokenize:mO};function fO(e){return v1(e),e}function pO(e,t){let n;return r;function r(c){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),o(c)}function o(c){return c===null?a(c):Ce(c)?e.check(hO,l,a)(c):(e.consume(c),o)}function a(c){return e.exit("chunkContent"),e.exit("content"),t(c)}function l(c){return e.consume(c),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,o}}function mO(e,t,n){const r=this;return o;function o(l){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),qe(e,a,"linePrefix")}function a(l){if(l===null||Ce(l))return n(l);const c=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&c&&c[1].type==="linePrefix"&&c[2].sliceSerialize(c[1],!0).length>=4?t(l):e.interrupt(r.parser.constructs.flow,n,t)(l)}}function x1(e,t,n,r,o,a,l,c,d){const f=d||Number.POSITIVE_INFINITY;let p=0;return y;function y(E){return E===60?(e.enter(r),e.enter(o),e.enter(a),e.consume(E),e.exit(a),v):E===null||E===32||E===41||Eh(E)?n(E):(e.enter(r),e.enter(l),e.enter(c),e.enter("chunkString",{contentType:"string"}),S(E))}function v(E){return E===62?(e.enter(a),e.consume(E),e.exit(a),e.exit(o),e.exit(r),t):(e.enter(c),e.enter("chunkString",{contentType:"string"}),w(E))}function w(E){return E===62?(e.exit("chunkString"),e.exit(c),v(E)):E===null||E===60||Ce(E)?n(E):(e.consume(E),E===92?b:w)}function b(E){return E===60||E===62||E===92?(e.consume(E),w):w(E)}function S(E){return!p&&(E===null||E===41||Bt(E))?(e.exit("chunkString"),e.exit(c),e.exit(l),e.exit(r),t(E)):p<f&&E===40?(e.consume(E),p++,S):E===41?(e.consume(E),p--,S):E===null||E===32||E===40||Eh(E)?n(E):(e.consume(E),E===92?_:S)}function _(E){return E===40||E===41||E===92?(e.consume(E),S):S(E)}}function w1(e,t,n,r,o,a){const l=this;let c=0,d;return f;function f(w){return e.enter(r),e.enter(o),e.consume(w),e.exit(o),e.enter(a),p}function p(w){return c>999||w===null||w===91||w===93&&!d||w===94&&!c&&"_hiddenFootnoteSupport"in l.parser.constructs?n(w):w===93?(e.exit(a),e.enter(o),e.consume(w),e.exit(o),e.exit(r),t):Ce(w)?(e.enter("lineEnding"),e.consume(w),e.exit("lineEnding"),p):(e.enter("chunkString",{contentType:"string"}),y(w))}function y(w){return w===null||w===91||w===93||Ce(w)||c++>999?(e.exit("chunkString"),p(w)):(e.consume(w),d||(d=!Ue(w)),w===92?v:y)}function v(w){return w===91||w===92||w===93?(e.consume(w),c++,y):y(w)}}function b1(e,t,n,r,o,a){let l;return c;function c(v){return v===34||v===39||v===40?(e.enter(r),e.enter(o),e.consume(v),e.exit(o),l=v===40?41:v,d):n(v)}function d(v){return v===l?(e.enter(o),e.consume(v),e.exit(o),e.exit(r),t):(e.enter(a),f(v))}function f(v){return v===l?(e.exit(a),d(l)):v===null?n(v):Ce(v)?(e.enter("lineEnding"),e.consume(v),e.exit("lineEnding"),qe(e,f,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),p(v))}function p(v){return v===l||v===null||Ce(v)?(e.exit("chunkString"),f(v)):(e.consume(v),v===92?y:p)}function y(v){return v===l||v===92?(e.consume(v),p):p(v)}}function xo(e,t){let n;return r;function r(o){return Ce(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),n=!0,r):Ue(o)?qe(e,r,n?"linePrefix":"lineSuffix")(o):t(o)}}const gO={name:"definition",tokenize:vO},yO={partial:!0,tokenize:xO};function vO(e,t,n){const r=this;let o;return a;function a(w){return e.enter("definition"),l(w)}function l(w){return w1.call(r,e,c,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(w)}function c(w){return o=ti(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),w===58?(e.enter("definitionMarker"),e.consume(w),e.exit("definitionMarker"),d):n(w)}function d(w){return Bt(w)?xo(e,f)(w):f(w)}function f(w){return x1(e,p,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(w)}function p(w){return e.attempt(yO,y,y)(w)}function y(w){return Ue(w)?qe(e,v,"whitespace")(w):v(w)}function v(w){return w===null||Ce(w)?(e.exit("definition"),r.parser.defined.push(o),t(w)):n(w)}}function xO(e,t,n){return r;function r(c){return Bt(c)?xo(e,o)(c):n(c)}function o(c){return b1(e,a,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(c)}function a(c){return Ue(c)?qe(e,l,"whitespace")(c):l(c)}function l(c){return c===null||Ce(c)?t(c):n(c)}}const wO={name:"hardBreakEscape",tokenize:bO};function bO(e,t,n){return r;function r(a){return e.enter("hardBreakEscape"),e.consume(a),o}function o(a){return Ce(a)?(e.exit("hardBreakEscape"),t(a)):n(a)}}const kO={name:"headingAtx",resolve:SO,tokenize:_O};function SO(e,t){let n=e.length-2,r=3,o,a;return e[r][1].type==="whitespace"&&(r+=2),n-2>r&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&e[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r&&(o={type:"atxHeadingText",start:e[r][1].start,end:e[n][1].end},a={type:"chunkText",start:e[r][1].start,end:e[n][1].end,contentType:"text"},Mn(e,r,n-r+1,[["enter",o,t],["enter",a,t],["exit",a,t],["exit",o,t]])),e}function _O(e,t,n){let r=0;return o;function o(p){return e.enter("atxHeading"),a(p)}function a(p){return e.enter("atxHeadingSequence"),l(p)}function l(p){return p===35&&r++<6?(e.consume(p),l):p===null||Bt(p)?(e.exit("atxHeadingSequence"),c(p)):n(p)}function c(p){return p===35?(e.enter("atxHeadingSequence"),d(p)):p===null||Ce(p)?(e.exit("atxHeading"),t(p)):Ue(p)?qe(e,c,"whitespace")(p):(e.enter("atxHeadingText"),f(p))}function d(p){return p===35?(e.consume(p),d):(e.exit("atxHeadingSequence"),c(p))}function f(p){return p===null||p===35||Bt(p)?(e.exit("atxHeadingText"),c(p)):(e.consume(p),f)}}const EO=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],av=["pre","script","style","textarea"],TO={concrete:!0,name:"htmlFlow",resolveTo:AO,tokenize:PO},CO={partial:!0,tokenize:RO},jO={partial:!0,tokenize:NO};function AO(e){let t=e.length;for(;t--&&!(e[t][0]==="enter"&&e[t][1].type==="htmlFlow"););return t>1&&e[t-2][1].type==="linePrefix"&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function PO(e,t,n){const r=this;let o,a,l,c,d;return f;function f(C){return p(C)}function p(C){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(C),y}function y(C){return C===33?(e.consume(C),v):C===47?(e.consume(C),a=!0,S):C===63?(e.consume(C),o=3,r.interrupt?t:T):In(C)?(e.consume(C),l=String.fromCharCode(C),_):n(C)}function v(C){return C===45?(e.consume(C),o=2,w):C===91?(e.consume(C),o=5,c=0,b):In(C)?(e.consume(C),o=4,r.interrupt?t:T):n(C)}function w(C){return C===45?(e.consume(C),r.interrupt?t:T):n(C)}function b(C){const X="CDATA[";return C===X.charCodeAt(c++)?(e.consume(C),c===X.length?r.interrupt?t:Q:b):n(C)}function S(C){return In(C)?(e.consume(C),l=String.fromCharCode(C),_):n(C)}function _(C){if(C===null||C===47||C===62||Bt(C)){const X=C===47,ve=l.toLowerCase();return!X&&!a&&av.includes(ve)?(o=1,r.interrupt?t(C):Q(C)):EO.includes(l.toLowerCase())?(o=6,X?(e.consume(C),E):r.interrupt?t(C):Q(C)):(o=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(C):a?P(C):j(C))}return C===45||Zt(C)?(e.consume(C),l+=String.fromCharCode(C),_):n(C)}function E(C){return C===62?(e.consume(C),r.interrupt?t:Q):n(C)}function P(C){return Ue(C)?(e.consume(C),P):ie(C)}function j(C){return C===47?(e.consume(C),ie):C===58||C===95||In(C)?(e.consume(C),D):Ue(C)?(e.consume(C),j):ie(C)}function D(C){return C===45||C===46||C===58||C===95||Zt(C)?(e.consume(C),D):$(C)}function $(C){return C===61?(e.consume(C),O):Ue(C)?(e.consume(C),$):j(C)}function O(C){return C===null||C===60||C===61||C===62||C===96?n(C):C===34||C===39?(e.consume(C),d=C,z):Ue(C)?(e.consume(C),O):q(C)}function z(C){return C===d?(e.consume(C),d=null,J):C===null||Ce(C)?n(C):(e.consume(C),z)}function q(C){return C===null||C===34||C===39||C===47||C===60||C===61||C===62||C===96||Bt(C)?$(C):(e.consume(C),q)}function J(C){return C===47||C===62||Ue(C)?j(C):n(C)}function ie(C){return C===62?(e.consume(C),re):n(C)}function re(C){return C===null||Ce(C)?Q(C):Ue(C)?(e.consume(C),re):n(C)}function Q(C){return C===45&&o===2?(e.consume(C),fe):C===60&&o===1?(e.consume(C),le):C===62&&o===4?(e.consume(C),N):C===63&&o===3?(e.consume(C),T):C===93&&o===5?(e.consume(C),oe):Ce(C)&&(o===6||o===7)?(e.exit("htmlFlowData"),e.check(CO,V,ye)(C)):C===null||Ce(C)?(e.exit("htmlFlowData"),ye(C)):(e.consume(C),Q)}function ye(C){return e.check(jO,ne,V)(C)}function ne(C){return e.enter("lineEnding"),e.consume(C),e.exit("lineEnding"),Z}function Z(C){return C===null||Ce(C)?ye(C):(e.enter("htmlFlowData"),Q(C))}function fe(C){return C===45?(e.consume(C),T):Q(C)}function le(C){return C===47?(e.consume(C),l="",H):Q(C)}function H(C){if(C===62){const X=l.toLowerCase();return av.includes(X)?(e.consume(C),N):Q(C)}return In(C)&&l.length<8?(e.consume(C),l+=String.fromCharCode(C),H):Q(C)}function oe(C){return C===93?(e.consume(C),T):Q(C)}function T(C){return C===62?(e.consume(C),N):C===45&&o===2?(e.consume(C),T):Q(C)}function N(C){return C===null||Ce(C)?(e.exit("htmlFlowData"),V(C)):(e.consume(C),N)}function V(C){return e.exit("htmlFlow"),t(C)}}function NO(e,t,n){const r=this;return o;function o(l){return Ce(l)?(e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),a):n(l)}function a(l){return r.parser.lazy[r.now().line]?n(l):t(l)}}function RO(e,t,n){return r;function r(o){return e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),e.attempt(au,t,n)}}const OO={name:"htmlText",tokenize:IO};function IO(e,t,n){const r=this;let o,a,l;return c;function c(T){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(T),d}function d(T){return T===33?(e.consume(T),f):T===47?(e.consume(T),$):T===63?(e.consume(T),j):In(T)?(e.consume(T),q):n(T)}function f(T){return T===45?(e.consume(T),p):T===91?(e.consume(T),a=0,b):In(T)?(e.consume(T),P):n(T)}function p(T){return T===45?(e.consume(T),w):n(T)}function y(T){return T===null?n(T):T===45?(e.consume(T),v):Ce(T)?(l=y,le(T)):(e.consume(T),y)}function v(T){return T===45?(e.consume(T),w):y(T)}function w(T){return T===62?fe(T):T===45?v(T):y(T)}function b(T){const N="CDATA[";return T===N.charCodeAt(a++)?(e.consume(T),a===N.length?S:b):n(T)}function S(T){return T===null?n(T):T===93?(e.consume(T),_):Ce(T)?(l=S,le(T)):(e.consume(T),S)}function _(T){return T===93?(e.consume(T),E):S(T)}function E(T){return T===62?fe(T):T===93?(e.consume(T),E):S(T)}function P(T){return T===null||T===62?fe(T):Ce(T)?(l=P,le(T)):(e.consume(T),P)}function j(T){return T===null?n(T):T===63?(e.consume(T),D):Ce(T)?(l=j,le(T)):(e.consume(T),j)}function D(T){return T===62?fe(T):j(T)}function $(T){return In(T)?(e.consume(T),O):n(T)}function O(T){return T===45||Zt(T)?(e.consume(T),O):z(T)}function z(T){return Ce(T)?(l=z,le(T)):Ue(T)?(e.consume(T),z):fe(T)}function q(T){return T===45||Zt(T)?(e.consume(T),q):T===47||T===62||Bt(T)?J(T):n(T)}function J(T){return T===47?(e.consume(T),fe):T===58||T===95||In(T)?(e.consume(T),ie):Ce(T)?(l=J,le(T)):Ue(T)?(e.consume(T),J):fe(T)}function ie(T){return T===45||T===46||T===58||T===95||Zt(T)?(e.consume(T),ie):re(T)}function re(T){return T===61?(e.consume(T),Q):Ce(T)?(l=re,le(T)):Ue(T)?(e.consume(T),re):J(T)}function Q(T){return T===null||T===60||T===61||T===62||T===96?n(T):T===34||T===39?(e.consume(T),o=T,ye):Ce(T)?(l=Q,le(T)):Ue(T)?(e.consume(T),Q):(e.consume(T),ne)}function ye(T){return T===o?(e.consume(T),o=void 0,Z):T===null?n(T):Ce(T)?(l=ye,le(T)):(e.consume(T),ye)}function ne(T){return T===null||T===34||T===39||T===60||T===61||T===96?n(T):T===47||T===62||Bt(T)?J(T):(e.consume(T),ne)}function Z(T){return T===47||T===62||Bt(T)?J(T):n(T)}function fe(T){return T===62?(e.consume(T),e.exit("htmlTextData"),e.exit("htmlText"),t):n(T)}function le(T){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(T),e.exit("lineEnding"),H}function H(T){return Ue(T)?qe(e,oe,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(T):oe(T)}function oe(T){return e.enter("htmlTextData"),l(T)}}const Mf={name:"labelEnd",resolveAll:UO,resolveTo:zO,tokenize:FO},LO={tokenize:$O},DO={tokenize:BO},MO={tokenize:VO};function UO(e){let t=-1;const n=[];for(;++t<e.length;){const r=e[t][1];if(n.push(e[t]),r.type==="labelImage"||r.type==="labelLink"||r.type==="labelEnd"){const o=r.type==="labelImage"?4:2;r.type="data",t+=o}}return e.length!==n.length&&Mn(e,0,e.length,n),e}function zO(e,t){let n=e.length,r=0,o,a,l,c;for(;n--;)if(o=e[n][1],a){if(o.type==="link"||o.type==="labelLink"&&o._inactive)break;e[n][0]==="enter"&&o.type==="labelLink"&&(o._inactive=!0)}else if(l){if(e[n][0]==="enter"&&(o.type==="labelImage"||o.type==="labelLink")&&!o._balanced&&(a=n,o.type!=="labelLink")){r=2;break}}else o.type==="labelEnd"&&(l=n);const d={type:e[a][1].type==="labelLink"?"link":"image",start:{...e[a][1].start},end:{...e[e.length-1][1].end}},f={type:"label",start:{...e[a][1].start},end:{...e[l][1].end}},p={type:"labelText",start:{...e[a+r+2][1].end},end:{...e[l-2][1].start}};return c=[["enter",d,t],["enter",f,t]],c=hn(c,e.slice(a+1,a+r+3)),c=hn(c,[["enter",p,t]]),c=hn(c,Df(t.parser.constructs.insideSpan.null,e.slice(a+r+4,l-3),t)),c=hn(c,[["exit",p,t],e[l-2],e[l-1],["exit",f,t]]),c=hn(c,e.slice(l+1)),c=hn(c,[["exit",d,t]]),Mn(e,a,e.length,c),e}function FO(e,t,n){const r=this;let o=r.events.length,a,l;for(;o--;)if((r.events[o][1].type==="labelImage"||r.events[o][1].type==="labelLink")&&!r.events[o][1]._balanced){a=r.events[o][1];break}return c;function c(v){return a?a._inactive?y(v):(l=r.parser.defined.includes(ti(r.sliceSerialize({start:a.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(v),e.exit("labelMarker"),e.exit("labelEnd"),d):n(v)}function d(v){return v===40?e.attempt(LO,p,l?p:y)(v):v===91?e.attempt(DO,p,l?f:y)(v):l?p(v):y(v)}function f(v){return e.attempt(MO,p,y)(v)}function p(v){return t(v)}function y(v){return a._balanced=!0,n(v)}}function $O(e,t,n){return r;function r(y){return e.enter("resource"),e.enter("resourceMarker"),e.consume(y),e.exit("resourceMarker"),o}function o(y){return Bt(y)?xo(e,a)(y):a(y)}function a(y){return y===41?p(y):x1(e,l,c,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(y)}function l(y){return Bt(y)?xo(e,d)(y):p(y)}function c(y){return n(y)}function d(y){return y===34||y===39||y===40?b1(e,f,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(y):p(y)}function f(y){return Bt(y)?xo(e,p)(y):p(y)}function p(y){return y===41?(e.enter("resourceMarker"),e.consume(y),e.exit("resourceMarker"),e.exit("resource"),t):n(y)}}function BO(e,t,n){const r=this;return o;function o(c){return w1.call(r,e,a,l,"reference","referenceMarker","referenceString")(c)}function a(c){return r.parser.defined.includes(ti(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(c):n(c)}function l(c){return n(c)}}function VO(e,t,n){return r;function r(a){return e.enter("reference"),e.enter("referenceMarker"),e.consume(a),e.exit("referenceMarker"),o}function o(a){return a===93?(e.enter("referenceMarker"),e.consume(a),e.exit("referenceMarker"),e.exit("reference"),t):n(a)}}const qO={name:"labelStartImage",resolveAll:Mf.resolveAll,tokenize:HO};function HO(e,t,n){const r=this;return o;function o(c){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(c),e.exit("labelImageMarker"),a}function a(c){return c===91?(e.enter("labelMarker"),e.consume(c),e.exit("labelMarker"),e.exit("labelImage"),l):n(c)}function l(c){return c===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(c):t(c)}}const WO={name:"labelStartLink",resolveAll:Mf.resolveAll,tokenize:KO};function KO(e,t,n){const r=this;return o;function o(l){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(l),e.exit("labelMarker"),e.exit("labelLink"),a}function a(l){return l===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(l):t(l)}}const Rd={name:"lineEnding",tokenize:GO};function GO(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),qe(e,t,"linePrefix")}}const Cl={name:"thematicBreak",tokenize:JO};function JO(e,t,n){let r=0,o;return a;function a(f){return e.enter("thematicBreak"),l(f)}function l(f){return o=f,c(f)}function c(f){return f===o?(e.enter("thematicBreakSequence"),d(f)):r>=3&&(f===null||Ce(f))?(e.exit("thematicBreak"),t(f)):n(f)}function d(f){return f===o?(e.consume(f),r++,d):(e.exit("thematicBreakSequence"),Ue(f)?qe(e,c,"whitespace")(f):c(f))}}const zt={continuation:{tokenize:ZO},exit:tI,name:"list",tokenize:QO},YO={partial:!0,tokenize:nI},XO={partial:!0,tokenize:eI};function QO(e,t,n){const r=this,o=r.events[r.events.length-1];let a=o&&o[1].type==="linePrefix"?o[2].sliceSerialize(o[1],!0).length:0,l=0;return c;function c(w){const b=r.containerState.type||(w===42||w===43||w===45?"listUnordered":"listOrdered");if(b==="listUnordered"?!r.containerState.marker||w===r.containerState.marker:Th(w)){if(r.containerState.type||(r.containerState.type=b,e.enter(b,{_container:!0})),b==="listUnordered")return e.enter("listItemPrefix"),w===42||w===45?e.check(Cl,n,f)(w):f(w);if(!r.interrupt||w===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),d(w)}return n(w)}function d(w){return Th(w)&&++l<10?(e.consume(w),d):(!r.interrupt||l<2)&&(r.containerState.marker?w===r.containerState.marker:w===41||w===46)?(e.exit("listItemValue"),f(w)):n(w)}function f(w){return e.enter("listItemMarker"),e.consume(w),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||w,e.check(au,r.interrupt?n:p,e.attempt(YO,v,y))}function p(w){return r.containerState.initialBlankLine=!0,a++,v(w)}function y(w){return Ue(w)?(e.enter("listItemPrefixWhitespace"),e.consume(w),e.exit("listItemPrefixWhitespace"),v):n(w)}function v(w){return r.containerState.size=a+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(w)}}function ZO(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(au,o,a);function o(c){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,qe(e,t,"listItemIndent",r.containerState.size+1)(c)}function a(c){return r.containerState.furtherBlankLines||!Ue(c)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,l(c)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(XO,t,l)(c))}function l(c){return r.containerState._closeFlow=!0,r.interrupt=void 0,qe(e,e.attempt(zt,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(c)}}function eI(e,t,n){const r=this;return qe(e,o,"listItemIndent",r.containerState.size+1);function o(a){const l=r.events[r.events.length-1];return l&&l[1].type==="listItemIndent"&&l[2].sliceSerialize(l[1],!0).length===r.containerState.size?t(a):n(a)}}function tI(e){e.exit(this.containerState.type)}function nI(e,t,n){const r=this;return qe(e,o,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function o(a){const l=r.events[r.events.length-1];return!Ue(a)&&l&&l[1].type==="listItemPrefixWhitespace"?t(a):n(a)}}const lv={name:"setextUnderline",resolveTo:rI,tokenize:sI};function rI(e,t){let n=e.length,r,o,a;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){r=n;break}e[n][1].type==="paragraph"&&(o=n)}else e[n][1].type==="content"&&e.splice(n,1),!a&&e[n][1].type==="definition"&&(a=n);const l={type:"setextHeading",start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[o][1].type="setextHeadingText",a?(e.splice(o,0,["enter",l,t]),e.splice(a+1,0,["exit",e[r][1],t]),e[r][1].end={...e[a][1].end}):e[r][1]=l,e.push(["exit",l,t]),e}function sI(e,t,n){const r=this;let o;return a;function a(f){let p=r.events.length,y;for(;p--;)if(r.events[p][1].type!=="lineEnding"&&r.events[p][1].type!=="linePrefix"&&r.events[p][1].type!=="content"){y=r.events[p][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||y)?(e.enter("setextHeadingLine"),o=f,l(f)):n(f)}function l(f){return e.enter("setextHeadingLineSequence"),c(f)}function c(f){return f===o?(e.consume(f),c):(e.exit("setextHeadingLineSequence"),Ue(f)?qe(e,d,"lineSuffix")(f):d(f))}function d(f){return f===null||Ce(f)?(e.exit("setextHeadingLine"),t(f)):n(f)}}const iI={tokenize:oI};function oI(e){const t=this,n=e.attempt(au,r,e.attempt(this.parser.constructs.flowInitial,o,qe(e,e.attempt(this.parser.constructs.flow,o,e.attempt(dO,o)),"linePrefix")));return n;function r(a){if(a===null){e.consume(a);return}return e.enter("lineEndingBlank"),e.consume(a),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function o(a){if(a===null){e.consume(a);return}return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const aI={resolveAll:S1()},lI=k1("string"),uI=k1("text");function k1(e){return{resolveAll:S1(e==="text"?cI:void 0),tokenize:t};function t(n){const r=this,o=this.parser.constructs[e],a=n.attempt(o,l,c);return l;function l(p){return f(p)?a(p):c(p)}function c(p){if(p===null){n.consume(p);return}return n.enter("data"),n.consume(p),d}function d(p){return f(p)?(n.exit("data"),a(p)):(n.consume(p),d)}function f(p){if(p===null)return!0;const y=o[p];let v=-1;if(y)for(;++v<y.length;){const w=y[v];if(!w.previous||w.previous.call(r,r.previous))return!0}return!1}}}function S1(e){return t;function t(n,r){let o=-1,a;for(;++o<=n.length;)a===void 0?n[o]&&n[o][1].type==="data"&&(a=o,o++):(!n[o]||n[o][1].type!=="data")&&(o!==a+2&&(n[a][1].end=n[o-1][1].end,n.splice(a+2,o-a-2),o=a+2),a=void 0);return e?e(n,r):n}}function cI(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type==="lineEnding")&&e[n-1][1].type==="data"){const r=e[n-1][1],o=t.sliceStream(r);let a=o.length,l=-1,c=0,d;for(;a--;){const f=o[a];if(typeof f=="string"){for(l=f.length;f.charCodeAt(l-1)===32;)c++,l--;if(l)break;l=-1}else if(f===-2)d=!0,c++;else if(f!==-1){a++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(c=0),c){const f={type:n===e.length||d||c<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:a?l:r.start._bufferIndex+l,_index:r.start._index+a,line:r.end.line,column:r.end.column-c,offset:r.end.offset-c},end:{...r.end}};r.end={...f.start},r.start.offset===r.end.offset?Object.assign(r,f):(e.splice(n,0,["enter",f,t],["exit",f,t]),n+=2)}n++}return e}const dI={42:zt,43:zt,45:zt,48:zt,49:zt,50:zt,51:zt,52:zt,53:zt,54:zt,55:zt,56:zt,57:zt,62:m1},hI={91:gO},fI={[-2]:Nd,[-1]:Nd,32:Nd},pI={35:kO,42:Cl,45:[lv,Cl],60:TO,61:lv,95:Cl,96:ov,126:ov},mI={38:y1,92:g1},gI={[-5]:Rd,[-4]:Rd,[-3]:Rd,33:qO,38:y1,42:Ch,60:[WR,OO],91:WO,92:[wO,g1],93:Mf,95:Ch,96:iO},yI={null:[Ch,aI]},vI={null:[42,95]},xI={null:[]},wI=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:vI,contentInitial:hI,disable:xI,document:dI,flow:pI,flowInitial:fI,insideSpan:yI,string:mI,text:gI},Symbol.toStringTag,{value:"Module"}));function bI(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const o={},a=[];let l=[],c=[];const d={attempt:z($),check:z(O),consume:P,enter:j,exit:D,interrupt:z(O,{interrupt:!0})},f={code:null,containerState:{},defineSkip:S,events:[],now:b,parser:e,previous:null,sliceSerialize:v,sliceStream:w,write:y};let p=t.tokenize.call(f,d);return t.resolveAll&&a.push(t),f;function y(re){return l=hn(l,re),_(),l[l.length-1]!==null?[]:(q(t,0),f.events=Df(a,f.events,f),f.events)}function v(re,Q){return SI(w(re),Q)}function w(re){return kI(l,re)}function b(){const{_bufferIndex:re,_index:Q,line:ye,column:ne,offset:Z}=r;return{_bufferIndex:re,_index:Q,line:ye,column:ne,offset:Z}}function S(re){o[re.line]=re.column,ie()}function _(){let re;for(;r._index<l.length;){const Q=l[r._index];if(typeof Q=="string")for(re=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===re&&r._bufferIndex<Q.length;)E(Q.charCodeAt(r._bufferIndex));else E(Q)}}function E(re){p=p(re)}function P(re){Ce(re)?(r.line++,r.column=1,r.offset+=re===-3?2:1,ie()):re!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===l[r._index].length&&(r._bufferIndex=-1,r._index++)),f.previous=re}function j(re,Q){const ye=Q||{};return ye.type=re,ye.start=b(),f.events.push(["enter",ye,f]),c.push(ye),ye}function D(re){const Q=c.pop();return Q.end=b(),f.events.push(["exit",Q,f]),Q}function $(re,Q){q(re,Q.from)}function O(re,Q){Q.restore()}function z(re,Q){return ye;function ye(ne,Z,fe){let le,H,oe,T;return Array.isArray(ne)?V(ne):"tokenize"in ne?V([ne]):N(ne);function N(ae){return je;function je(Ae){const Me=Ae!==null&&ae[Ae],ot=Ae!==null&&ae.null,Un=[...Array.isArray(Me)?Me:Me?[Me]:[],...Array.isArray(ot)?ot:ot?[ot]:[]];return V(Un)(Ae)}}function V(ae){return le=ae,H=0,ae.length===0?fe:C(ae[H])}function C(ae){return je;function je(Ae){return T=J(),oe=ae,ae.partial||(f.currentConstruct=ae),ae.name&&f.parser.constructs.disable.null.includes(ae.name)?ve():ae.tokenize.call(Q?Object.assign(Object.create(f),Q):f,d,X,ve)(Ae)}}function X(ae){return re(oe,T),Z}function ve(ae){return T.restore(),++H<le.length?C(le[H]):fe}}}function q(re,Q){re.resolveAll&&!a.includes(re)&&a.push(re),re.resolve&&Mn(f.events,Q,f.events.length-Q,re.resolve(f.events.slice(Q),f)),re.resolveTo&&(f.events=re.resolveTo(f.events,f))}function J(){const re=b(),Q=f.previous,ye=f.currentConstruct,ne=f.events.length,Z=Array.from(c);return{from:ne,restore:fe};function fe(){r=re,f.previous=Q,f.currentConstruct=ye,f.events.length=ne,c=Z,ie()}}function ie(){r.line in o&&r.column<2&&(r.column=o[r.line],r.offset+=o[r.line]-1)}}function kI(e,t){const n=t.start._index,r=t.start._bufferIndex,o=t.end._index,a=t.end._bufferIndex;let l;if(n===o)l=[e[n].slice(r,a)];else{if(l=e.slice(n,o),r>-1){const c=l[0];typeof c=="string"?l[0]=c.slice(r):l.shift()}a>0&&l.push(e[o].slice(0,a))}return l}function SI(e,t){let n=-1;const r=[];let o;for(;++n<e.length;){const a=e[n];let l;if(typeof a=="string")l=a;else switch(a){case-5:{l="\r";break}case-4:{l=`
|
|
103
103
|
`;break}case-3:{l=`\r
|
|
104
104
|
`;break}case-2:{l=t?" ":" ";break}case-1:{if(!t&&o)continue;l=" ";break}default:l=String.fromCharCode(a)}o=a===-2,r.push(l)}return r.join("")}function _I(e){const r={constructs:NR([wI,...(e||{}).extensions||[]]),content:o(zR),defined:[],document:o($R),flow:o(iI),lazy:{},string:o(lI),text:o(uI)};return r;function o(a){return l;function l(c){return bI(r,a,c)}}}function EI(e){for(;!v1(e););return e}const uv=/[\0\t\n\r]/g;function TI(){let e=1,t="",n=!0,r;return o;function o(a,l,c){const d=[];let f,p,y,v,w;for(a=t+(typeof a=="string"?a.toString():new TextDecoder(l||void 0).decode(a)),y=0,t="",n&&(a.charCodeAt(0)===65279&&y++,n=void 0);y<a.length;){if(uv.lastIndex=y,f=uv.exec(a),v=f&&f.index!==void 0?f.index:a.length,w=a.charCodeAt(v),!f){t=a.slice(y);break}if(w===10&&y===v&&r)d.push(-3),r=void 0;else switch(r&&(d.push(-5),r=void 0),y<v&&(d.push(a.slice(y,v)),e+=v-y),w){case 0:{d.push(65533),e++;break}case 9:{for(p=Math.ceil(e/4)*4,d.push(-2);e++<p;)d.push(-1);break}case 10:{d.push(-4),e=1;break}default:r=!0,e=1}y=v+1}return c&&(r&&d.push(-5),t&&d.push(t),d.push(null)),d}}const CI=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function jI(e){return e.replace(CI,AI)}function AI(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const o=n.charCodeAt(1),a=o===120||o===88;return p1(n.slice(a?2:1),a?16:10)}return Lf(n)||e}const _1={}.hasOwnProperty;function PI(e,t,n){return typeof t!="string"&&(n=t,t=void 0),NI(n)(EI(_I(n).document().write(TI()(e,t,!0))))}function NI(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:a(ds),autolinkProtocol:J,autolinkEmail:J,atxHeading:a(pi),blockQuote:a(ot),characterEscape:J,characterReference:J,codeFenced:a(Un),codeFencedFenceInfo:l,codeFencedFenceMeta:l,codeIndented:a(Un,l),codeText:a(Jo,l),codeTextData:J,data:J,codeFlowValue:J,definition:a(us),definitionDestinationString:l,definitionLabelString:l,definitionTitleString:l,emphasis:a(fi),hardBreakEscape:a(mi),hardBreakTrailing:a(mi),htmlFlow:a(cs,l),htmlFlowData:J,htmlText:a(cs,l),htmlTextData:J,image:a(Yo),label:l,link:a(ds),listItem:a(tr),listItemValue:v,listOrdered:a(er,y),listUnordered:a(er),paragraph:a(gi),reference:C,referenceString:l,resourceDestinationString:l,resourceTitleString:l,setextHeading:a(pi),strong:a(Xo),thematicBreak:a(Zo)},exit:{atxHeading:d(),atxHeadingSequence:$,autolink:d(),autolinkEmail:Me,autolinkProtocol:Ae,blockQuote:d(),characterEscapeValue:ie,characterReferenceMarkerHexadecimal:ve,characterReferenceMarkerNumeric:ve,characterReferenceValue:ae,characterReference:je,codeFenced:d(_),codeFencedFence:S,codeFencedFenceInfo:w,codeFencedFenceMeta:b,codeFlowValue:ie,codeIndented:d(E),codeText:d(Z),codeTextData:ie,data:ie,definition:d(),definitionDestinationString:D,definitionLabelString:P,definitionTitleString:j,emphasis:d(),hardBreakEscape:d(Q),hardBreakTrailing:d(Q),htmlFlow:d(ye),htmlFlowData:ie,htmlText:d(ne),htmlTextData:ie,image:d(le),label:oe,labelText:H,lineEnding:re,link:d(fe),listItem:d(),listOrdered:d(),listUnordered:d(),paragraph:d(),referenceString:X,resourceDestinationString:T,resourceTitleString:N,resource:V,setextHeading:d(q),setextHeadingLineSequence:z,setextHeadingText:O,strong:d(),thematicBreak:d()}};E1(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(W){let se={type:"root",children:[]};const _e={stack:[se],tokenStack:[],config:t,enter:c,exit:f,buffer:l,resume:p,data:n},Re=[];let Ie=-1;for(;++Ie<W.length;)if(W[Ie][1].type==="listOrdered"||W[Ie][1].type==="listUnordered")if(W[Ie][0]==="enter")Re.push(Ie);else{const gt=Re.pop();Ie=o(W,gt,Ie)}for(Ie=-1;++Ie<W.length;){const gt=t[W[Ie][0]];_1.call(gt,W[Ie][1].type)&>[W[Ie][1].type].call(Object.assign({sliceSerialize:W[Ie][2].sliceSerialize},_e),W[Ie][1])}if(_e.tokenStack.length>0){const gt=_e.tokenStack[_e.tokenStack.length-1];(gt[1]||cv).call(_e,void 0,gt[0])}for(se.position={start:Sr(W.length>0?W[0][1].start:{line:1,column:1,offset:0}),end:Sr(W.length>0?W[W.length-2][1].end:{line:1,column:1,offset:0})},Ie=-1;++Ie<t.transforms.length;)se=t.transforms[Ie](se)||se;return se}function o(W,se,_e){let Re=se-1,Ie=-1,gt=!1,zn,nn,nr,Rr;for(;++Re<=_e;){const yt=W[Re];switch(yt[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{yt[0]==="enter"?Ie++:Ie--,Rr=void 0;break}case"lineEndingBlank":{yt[0]==="enter"&&(zn&&!Rr&&!Ie&&!nr&&(nr=Re),Rr=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Rr=void 0}if(!Ie&&yt[0]==="enter"&&yt[1].type==="listItemPrefix"||Ie===-1&&yt[0]==="exit"&&(yt[1].type==="listUnordered"||yt[1].type==="listOrdered")){if(zn){let Tn=Re;for(nn=void 0;Tn--;){const qt=W[Tn];if(qt[1].type==="lineEnding"||qt[1].type==="lineEndingBlank"){if(qt[0]==="exit")continue;nn&&(W[nn][1].type="lineEndingBlank",gt=!0),qt[1].type="lineEnding",nn=Tn}else if(!(qt[1].type==="linePrefix"||qt[1].type==="blockQuotePrefix"||qt[1].type==="blockQuotePrefixWhitespace"||qt[1].type==="blockQuoteMarker"||qt[1].type==="listItemIndent"))break}nr&&(!nn||nr<nn)&&(zn._spread=!0),zn.end=Object.assign({},nn?W[nn][1].start:yt[1].end),W.splice(nn||Re,0,["exit",zn,yt[2]]),Re++,_e++}if(yt[1].type==="listItemPrefix"){const Tn={type:"listItem",_spread:!1,start:Object.assign({},yt[1].start),end:void 0};zn=Tn,W.splice(Re,0,["enter",Tn,yt[2]]),Re++,_e++,nr=void 0,Rr=!0}}}return W[se][1]._spread=gt,_e}function a(W,se){return _e;function _e(Re){c.call(this,W(Re),Re),se&&se.call(this,Re)}}function l(){this.stack.push({type:"fragment",children:[]})}function c(W,se,_e){this.stack[this.stack.length-1].children.push(W),this.stack.push(W),this.tokenStack.push([se,_e||void 0]),W.position={start:Sr(se.start),end:void 0}}function d(W){return se;function se(_e){W&&W.call(this,_e),f.call(this,_e)}}function f(W,se){const _e=this.stack.pop(),Re=this.tokenStack.pop();if(Re)Re[0].type!==W.type&&(se?se.call(this,W,Re[0]):(Re[1]||cv).call(this,W,Re[0]));else throw new Error("Cannot close `"+W.type+"` ("+vo({start:W.start,end:W.end})+"): it’s not open");_e.position.end=Sr(W.end)}function p(){return AR(this.stack.pop())}function y(){this.data.expectingFirstListItemValue=!0}function v(W){if(this.data.expectingFirstListItemValue){const se=this.stack[this.stack.length-2];se.start=Number.parseInt(this.sliceSerialize(W),10),this.data.expectingFirstListItemValue=void 0}}function w(){const W=this.resume(),se=this.stack[this.stack.length-1];se.lang=W}function b(){const W=this.resume(),se=this.stack[this.stack.length-1];se.meta=W}function S(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function _(){const W=this.resume(),se=this.stack[this.stack.length-1];se.value=W.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function E(){const W=this.resume(),se=this.stack[this.stack.length-1];se.value=W.replace(/(\r?\n|\r)$/g,"")}function P(W){const se=this.resume(),_e=this.stack[this.stack.length-1];_e.label=se,_e.identifier=ti(this.sliceSerialize(W)).toLowerCase()}function j(){const W=this.resume(),se=this.stack[this.stack.length-1];se.title=W}function D(){const W=this.resume(),se=this.stack[this.stack.length-1];se.url=W}function $(W){const se=this.stack[this.stack.length-1];if(!se.depth){const _e=this.sliceSerialize(W).length;se.depth=_e}}function O(){this.data.setextHeadingSlurpLineEnding=!0}function z(W){const se=this.stack[this.stack.length-1];se.depth=this.sliceSerialize(W).codePointAt(0)===61?1:2}function q(){this.data.setextHeadingSlurpLineEnding=void 0}function J(W){const _e=this.stack[this.stack.length-1].children;let Re=_e[_e.length-1];(!Re||Re.type!=="text")&&(Re=Qo(),Re.position={start:Sr(W.start),end:void 0},_e.push(Re)),this.stack.push(Re)}function ie(W){const se=this.stack.pop();se.value+=this.sliceSerialize(W),se.position.end=Sr(W.end)}function re(W){const se=this.stack[this.stack.length-1];if(this.data.atHardBreak){const _e=se.children[se.children.length-1];_e.position.end=Sr(W.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(se.type)&&(J.call(this,W),ie.call(this,W))}function Q(){this.data.atHardBreak=!0}function ye(){const W=this.resume(),se=this.stack[this.stack.length-1];se.value=W}function ne(){const W=this.resume(),se=this.stack[this.stack.length-1];se.value=W}function Z(){const W=this.resume(),se=this.stack[this.stack.length-1];se.value=W}function fe(){const W=this.stack[this.stack.length-1];if(this.data.inReference){const se=this.data.referenceType||"shortcut";W.type+="Reference",W.referenceType=se,delete W.url,delete W.title}else delete W.identifier,delete W.label;this.data.referenceType=void 0}function le(){const W=this.stack[this.stack.length-1];if(this.data.inReference){const se=this.data.referenceType||"shortcut";W.type+="Reference",W.referenceType=se,delete W.url,delete W.title}else delete W.identifier,delete W.label;this.data.referenceType=void 0}function H(W){const se=this.sliceSerialize(W),_e=this.stack[this.stack.length-2];_e.label=jI(se),_e.identifier=ti(se).toLowerCase()}function oe(){const W=this.stack[this.stack.length-1],se=this.resume(),_e=this.stack[this.stack.length-1];if(this.data.inReference=!0,_e.type==="link"){const Re=W.children;_e.children=Re}else _e.alt=se}function T(){const W=this.resume(),se=this.stack[this.stack.length-1];se.url=W}function N(){const W=this.resume(),se=this.stack[this.stack.length-1];se.title=W}function V(){this.data.inReference=void 0}function C(){this.data.referenceType="collapsed"}function X(W){const se=this.resume(),_e=this.stack[this.stack.length-1];_e.label=se,_e.identifier=ti(this.sliceSerialize(W)).toLowerCase(),this.data.referenceType="full"}function ve(W){this.data.characterReferenceType=W.type}function ae(W){const se=this.sliceSerialize(W),_e=this.data.characterReferenceType;let Re;_e?(Re=p1(se,_e==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Re=Lf(se);const Ie=this.stack[this.stack.length-1];Ie.value+=Re}function je(W){const se=this.stack.pop();se.position.end=Sr(W.end)}function Ae(W){ie.call(this,W);const se=this.stack[this.stack.length-1];se.url=this.sliceSerialize(W)}function Me(W){ie.call(this,W);const se=this.stack[this.stack.length-1];se.url="mailto:"+this.sliceSerialize(W)}function ot(){return{type:"blockquote",children:[]}}function Un(){return{type:"code",lang:null,meta:null,value:""}}function Jo(){return{type:"inlineCode",value:""}}function us(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function fi(){return{type:"emphasis",children:[]}}function pi(){return{type:"heading",depth:0,children:[]}}function mi(){return{type:"break"}}function cs(){return{type:"html",value:""}}function Yo(){return{type:"image",title:null,url:"",alt:null}}function ds(){return{type:"link",title:null,url:"",children:[]}}function er(W){return{type:"list",ordered:W.type==="listOrdered",start:null,spread:W._spread,children:[]}}function tr(W){return{type:"listItem",spread:W._spread,checked:null,children:[]}}function gi(){return{type:"paragraph",children:[]}}function Xo(){return{type:"strong",children:[]}}function Qo(){return{type:"text",value:""}}function Zo(){return{type:"thematicBreak"}}}function Sr(e){return{line:e.line,column:e.column,offset:e.offset}}function E1(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?E1(e,r):RI(e,r)}}function RI(e,t){let n;for(n in t)if(_1.call(t,n))switch(n){case"canContainEols":{const r=t[n];r&&e[n].push(...r);break}case"transforms":{const r=t[n];r&&e[n].push(...r);break}case"enter":case"exit":{const r=t[n];r&&Object.assign(e[n],r);break}}}function cv(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+vo({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+vo({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+vo({start:t.start,end:t.end})+") is still open")}function OI(e){const t=this;t.parser=n;function n(r){return PI(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function II(e,t){const n={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function LI(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
|
|
@@ -113,4 +113,4 @@ ${e.content}`:""}`,d=new Blob([c],{type:"text/markdown"}),f=URL.createObjectURL(
|
|
|
113
113
|
`}),n}function vv(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function xv(e,t){const n=S4(e,t),r=n.one(e,void 0),o=h4(n),a=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return o&&a.children.push({type:"text",value:`
|
|
114
114
|
`},o),a}function j4(e,t){return e&&"run"in e?async function(n,r){const o=xv(n,{file:r,...t});await e.run(o,r)}:function(n,r){return xv(n,{file:r,...e||t})}}function wv(e){if(e)throw e}var Od,bv;function A4(){if(bv)return Od;bv=1;var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,o=function(f){return typeof Array.isArray=="function"?Array.isArray(f):t.call(f)==="[object Array]"},a=function(f){if(!f||t.call(f)!=="[object Object]")return!1;var p=e.call(f,"constructor"),y=f.constructor&&f.constructor.prototype&&e.call(f.constructor.prototype,"isPrototypeOf");if(f.constructor&&!p&&!y)return!1;var v;for(v in f);return typeof v>"u"||e.call(f,v)},l=function(f,p){n&&p.name==="__proto__"?n(f,p.name,{enumerable:!0,configurable:!0,value:p.newValue,writable:!0}):f[p.name]=p.newValue},c=function(f,p){if(p==="__proto__")if(e.call(f,p)){if(r)return r(f,p).value}else return;return f[p]};return Od=function d(){var f,p,y,v,w,b,S=arguments[0],_=1,E=arguments.length,P=!1;for(typeof S=="boolean"&&(P=S,S=arguments[1]||{},_=2),(S==null||typeof S!="object"&&typeof S!="function")&&(S={});_<E;++_)if(f=arguments[_],f!=null)for(p in f)y=c(S,p),v=c(f,p),S!==v&&(P&&v&&(a(v)||(w=o(v)))?(w?(w=!1,b=y&&o(y)?y:[]):b=y&&a(y)?y:{},l(S,{name:p,newValue:d(P,b,v)})):typeof v<"u"&&l(S,{name:p,newValue:v}));return S},Od}var P4=A4();const Id=ql(P4);function Ah(e){if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function N4(){const e=[],t={run:n,use:r};return t;function n(...o){let a=-1;const l=o.pop();if(typeof l!="function")throw new TypeError("Expected function as last argument, not "+l);c(null,...o);function c(d,...f){const p=e[++a];let y=-1;if(d){l(d);return}for(;++y<o.length;)(f[y]===null||f[y]===void 0)&&(f[y]=o[y]);o=f,p?R4(p,c)(...f):l(null,...f)}}function r(o){if(typeof o!="function")throw new TypeError("Expected `middelware` to be a function, not "+o);return e.push(o),t}}function R4(e,t){let n;return r;function r(...l){const c=e.length>l.length;let d;c&&l.push(o);try{d=e.apply(this,l)}catch(f){const p=f;if(c&&n)throw p;return o(p)}c||(d&&d.then&&typeof d.then=="function"?d.then(a,o):d instanceof Error?o(d):a(d))}function o(l,...c){n||(n=!0,t(l,...c))}function a(l){o(null,l)}}const On={basename:O4,dirname:I4,extname:L4,join:D4,sep:"/"};function O4(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');Go(e);let n=0,r=-1,o=e.length,a;if(t===void 0||t.length===0||t.length>e.length){for(;o--;)if(e.codePointAt(o)===47){if(a){n=o+1;break}}else r<0&&(a=!0,r=o+1);return r<0?"":e.slice(n,r)}if(t===e)return"";let l=-1,c=t.length-1;for(;o--;)if(e.codePointAt(o)===47){if(a){n=o+1;break}}else l<0&&(a=!0,l=o+1),c>-1&&(e.codePointAt(o)===t.codePointAt(c--)?c<0&&(r=o):(c=-1,r=l));return n===r?r=l:r<0&&(r=e.length),e.slice(n,r)}function I4(e){if(Go(e),e.length===0)return".";let t=-1,n=e.length,r;for(;--n;)if(e.codePointAt(n)===47){if(r){t=n;break}}else r||(r=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function L4(e){Go(e);let t=e.length,n=-1,r=0,o=-1,a=0,l;for(;t--;){const c=e.codePointAt(t);if(c===47){if(l){r=t+1;break}continue}n<0&&(l=!0,n=t+1),c===46?o<0?o=t:a!==1&&(a=1):o>-1&&(a=-1)}return o<0||n<0||a===0||a===1&&o===n-1&&o===r+1?"":e.slice(o,n)}function D4(...e){let t=-1,n;for(;++t<e.length;)Go(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":M4(n)}function M4(e){Go(e);const t=e.codePointAt(0)===47;let n=U4(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function U4(e,t){let n="",r=0,o=-1,a=0,l=-1,c,d;for(;++l<=e.length;){if(l<e.length)c=e.codePointAt(l);else{if(c===47)break;c=47}if(c===47){if(!(o===l-1||a===1))if(o!==l-1&&a===2){if(n.length<2||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(d=n.lastIndexOf("/"),d!==n.length-1){d<0?(n="",r=0):(n=n.slice(0,d),r=n.length-1-n.lastIndexOf("/")),o=l,a=0;continue}}else if(n.length>0){n="",r=0,o=l,a=0;continue}}t&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+e.slice(o+1,l):n=e.slice(o+1,l),r=l-o-1;o=l,a=0}else c===46&&a>-1?a++:a=-1}return n}function Go(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const z4={cwd:F4};function F4(){return"/"}function Ph(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function $4(e){if(typeof e=="string")e=new URL(e);else if(!Ph(e)){const t=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if(e.protocol!=="file:"){const t=new TypeError("The URL must be of scheme file");throw t.code="ERR_INVALID_URL_SCHEME",t}return B4(e)}function B4(e){if(e.hostname!==""){const r=new TypeError('File URL host must be "localhost" or empty on darwin');throw r.code="ERR_INVALID_FILE_URL_HOST",r}const t=e.pathname;let n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){const r=t.codePointAt(n+2);if(r===70||r===102){const o=new TypeError("File URL path must not include encoded / characters");throw o.code="ERR_INVALID_FILE_URL_PATH",o}}return decodeURIComponent(t)}const Ld=["history","path","basename","stem","extname","dirname"];class I1{constructor(t){let n;t?Ph(t)?n={path:t}:typeof t=="string"||V4(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":z4.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<Ld.length;){const a=Ld[r];a in n&&n[a]!==void 0&&n[a]!==null&&(this[a]=a==="history"?[...n[a]]:n[a])}let o;for(o in n)Ld.includes(o)||(this[o]=n[o])}get basename(){return typeof this.path=="string"?On.basename(this.path):void 0}set basename(t){Md(t,"basename"),Dd(t,"basename"),this.path=On.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?On.dirname(this.path):void 0}set dirname(t){kv(this.basename,"dirname"),this.path=On.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?On.extname(this.path):void 0}set extname(t){if(Dd(t,"extname"),kv(this.dirname,"extname"),t){if(t.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(t.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=On.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){Ph(t)&&(t=$4(t)),Md(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?On.basename(this.path,this.extname):void 0}set stem(t){Md(t,"stem"),Dd(t,"stem"),this.path=On.join(this.dirname||"",t+(this.extname||""))}fail(t,n,r){const o=this.message(t,n,r);throw o.fatal=!0,o}info(t,n,r){const o=this.message(t,n,r);return o.fatal=void 0,o}message(t,n,r){const o=new Pt(t,n,r);return this.path&&(o.name=this.path+":"+o.name,o.file=this.path),o.fatal=!1,this.messages.push(o),o}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function Dd(e,t){if(e&&e.includes(On.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+On.sep+"`")}function Md(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function kv(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function V4(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const q4=(function(e){const r=this.constructor.prototype,o=r[e],a=function(){return o.apply(a,arguments)};return Object.setPrototypeOf(a,r),a}),H4={}.hasOwnProperty;class Bf extends q4{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=N4()}copy(){const t=new Bf;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];t.use(...r)}return t.data(Id(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(Fd("data",this.frozen),this.namespace[t]=n,this):H4.call(this.namespace,t)&&this.namespace[t]||void 0:t?(Fd("data",this.frozen),this.namespace=t,this):this.namespace}freeze(){if(this.frozen)return this;const t=this;for(;++this.freezeIndex<this.attachers.length;){const[n,...r]=this.attachers[this.freezeIndex];if(r[0]===!1)continue;r[0]===!0&&(r[0]=void 0);const o=n.call(t,...r);typeof o=="function"&&this.transformers.use(o)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const n=xl(t),r=this.parser||this.Parser;return Ud("parse",r),r(String(n),n)}process(t,n){const r=this;return this.freeze(),Ud("process",this.parser||this.Parser),zd("process",this.compiler||this.Compiler),n?o(void 0,n):new Promise(o);function o(a,l){const c=xl(t),d=r.parse(c);r.run(d,c,function(p,y,v){if(p||!y||!v)return f(p);const w=y,b=r.stringify(w,v);G4(b)?v.value=b:v.result=b,f(p,v)});function f(p,y){p||!y?l(p):a?a(y):n(void 0,y)}}}processSync(t){let n=!1,r;return this.freeze(),Ud("processSync",this.parser||this.Parser),zd("processSync",this.compiler||this.Compiler),this.process(t,o),_v("processSync","process",n),r;function o(a,l){n=!0,wv(a),r=l}}run(t,n,r){Sv(t),this.freeze();const o=this.transformers;return!r&&typeof n=="function"&&(r=n,n=void 0),r?a(void 0,r):new Promise(a);function a(l,c){const d=xl(n);o.run(t,d,f);function f(p,y,v){const w=y||t;p?c(p):l?l(w):r(void 0,w,v)}}}runSync(t,n){let r=!1,o;return this.run(t,n,a),_v("runSync","run",r),o;function a(l,c){wv(l),o=c,r=!0}}stringify(t,n){this.freeze();const r=xl(n),o=this.compiler||this.Compiler;return zd("stringify",o),Sv(t),o(t,r)}use(t,...n){const r=this.attachers,o=this.namespace;if(Fd("use",this.frozen),t!=null)if(typeof t=="function")d(t,n);else if(typeof t=="object")Array.isArray(t)?c(t):l(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function a(f){if(typeof f=="function")d(f,[]);else if(typeof f=="object")if(Array.isArray(f)){const[p,...y]=f;d(p,y)}else l(f);else throw new TypeError("Expected usable value, not `"+f+"`")}function l(f){if(!("plugins"in f)&&!("settings"in f))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");c(f.plugins),f.settings&&(o.settings=Id(!0,o.settings,f.settings))}function c(f){let p=-1;if(f!=null)if(Array.isArray(f))for(;++p<f.length;){const y=f[p];a(y)}else throw new TypeError("Expected a list of plugins, not `"+f+"`")}function d(f,p){let y=-1,v=-1;for(;++y<r.length;)if(r[y][0]===f){v=y;break}if(v===-1)r.push([f,...p]);else if(p.length>0){let[w,...b]=p;const S=r[v][1];Ah(S)&&Ah(w)&&(w=Id(!0,S,w)),r[v]=[f,w,...b]}}}}const W4=new Bf().freeze();function Ud(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function zd(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function Fd(e,t){if(t)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function Sv(e){if(!Ah(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function _v(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function xl(e){return K4(e)?e:new I1(e)}function K4(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function G4(e){return typeof e=="string"||J4(e)}function J4(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const Y4="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",Ev=[],Tv={allowDangerousHtml:!0},X4=/^(https?|ircs?|mailto|xmpp)$/i,Q4=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function Z4(e){const t=eL(e),n=tL(e);return nL(t.runSync(t.parse(n),n),e)}function eL(e){const t=e.rehypePlugins||Ev,n=e.remarkPlugins||Ev,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...Tv}:Tv;return W4().use(OI).use(n).use(j4,r).use(t)}function tL(e){const t=e.children||"",n=new I1;return typeof t=="string"&&(n.value=t),n}function nL(e,t){const n=t.allowedElements,r=t.allowElement,o=t.components,a=t.disallowedElements,l=t.skipHtml,c=t.unwrapDisallowed,d=t.urlTransform||rL;for(const p of Q4)Object.hasOwn(t,p.from)&&(""+p.from+(p.to?"use `"+p.to+"` instead":"remove it")+Y4+p.id,void 0);return O1(e,f),hR(e,{Fragment:g.Fragment,components:o,ignoreInvalidStyle:!0,jsx:g.jsx,jsxs:g.jsxs,passKeys:!0,passNode:!0});function f(p,y,v){if(p.type==="raw"&&v&&typeof y=="number")return l?v.children.splice(y,1):v.children[y]={type:"text",value:p.value},y;if(p.type==="element"){let w;for(w in Pd)if(Object.hasOwn(Pd,w)&&Object.hasOwn(p.properties,w)){const b=p.properties[w],S=Pd[w];(S===null||S.includes(p.tagName))&&(p.properties[w]=d(String(b||""),w,p))}}if(p.type==="element"){let w=n?!n.includes(p.tagName):a?a.includes(p.tagName):!1;if(!w&&r&&typeof y=="number"&&(w=!r(p,y,v)),w&&v&&typeof y=="number")return c&&p.children?v.children.splice(y,1,...p.children):v.children.splice(y,1),y}}}function rL(e){const t=e.indexOf(":"),n=e.indexOf("?"),r=e.indexOf("#"),o=e.indexOf("/");return t===-1||o!==-1&&t>o||n!==-1&&t>n||r!==-1&&t>r||X4.test(e.slice(0,t))?e:""}function sL({isOpen:e,onClose:t}){const[n,r]=L.useState(""),[o,a]=L.useState(!0);L.useEffect(()=>{e&&l()},[e]);const l=async()=>{a(!0);try{const d=await(await fetch("/CHANGELOG.md")).text();r(d)}catch(c){console.error("Failed to load changelog:",c),r(`# Error
|
|
115
115
|
|
|
116
|
-
Failed to load changelog.`)}finally{a(!1)}};return g.jsx(_n,{children:e&&g.jsxs(g.Fragment,{children:[g.jsx(ze.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:t,className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-50"}),g.jsx(ze.div,{initial:{opacity:0,scale:.95,y:20},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:20},transition:{type:"spring",damping:25,stiffness:300},className:"fixed inset-0 z-50 flex items-center justify-center p-4 pointer-events-none",children:g.jsxs("div",{className:"glass w-full max-w-3xl max-h-[80vh] overflow-hidden pointer-events-auto shadow-2xl",children:[g.jsxs("div",{className:"flex items-center justify-between p-6 border-b border-border",children:[g.jsxs("div",{className:"flex items-center gap-3",children:[g.jsx(Kk,{size:24,className:"text-primary"}),g.jsx("h2",{className:"text-xl font-bold",children:"Release Notes"})]}),g.jsx("button",{onClick:t,className:"p-2 hover:bg-surface rounded-lg transition-colors",children:g.jsx(Cr,{size:20,className:"text-fg/60"})})]}),g.jsx("div",{className:"p-6 overflow-y-auto custom-scrollbar max-h-[calc(80vh-88px)]",children:o?g.jsx("div",{className:"flex items-center justify-center py-12",children:g.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-2 border-primary border-t-transparent"})}):g.jsx(Z4,{components:{h1:({children:c})=>g.jsx("h1",{className:"text-2xl font-bold text-fg mb-6 mt-0",children:c}),h2:({children:c})=>g.jsx("h2",{className:"text-xl font-bold text-fg mt-8 mb-3 pb-2 border-b border-border first:mt-0",children:c}),h3:({children:c})=>g.jsx("h3",{className:"text-lg font-bold text-primary mt-6 mb-2",children:c}),p:({children:c})=>g.jsx("p",{className:"text-sm text-fg/70 mb-3 leading-relaxed",children:c}),ul:({children:c})=>g.jsx("ul",{className:"list-none space-y-1 mb-4 ml-0",children:c}),li:({children:c})=>g.jsx("li",{className:"text-sm text-fg/80 ml-4 mb-1 before:content-['•'] before:mr-2 before:text-primary",children:c}),a:({href:c,children:d})=>g.jsx("a",{href:c,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:text-primary/80 underline transition-colors",children:d}),code:({children:c})=>g.jsx("code",{className:"bg-surface/50 text-accent px-1.5 py-0.5 rounded text-xs font-mono border border-border",children:c}),strong:({children:c})=>g.jsx("strong",{className:"font-bold text-fg",children:c})},children:n})})]})})]})})}class iL{audioContext=null;enabled=!0;constructor(){}getAudioContext(){return this.audioContext||(this.audioContext=new(window.AudioContext||window.webkitAudioContext)),this.audioContext}setEnabled(t){this.enabled=t}isEnabled(){return this.enabled}playTone(t,n,r=.3){if(this.enabled)try{const o=this.getAudioContext(),a=o.createOscillator(),l=o.createGain();a.connect(l),l.connect(o.destination),a.frequency.value=t,a.type="sine",l.gain.setValueAtTime(r,o.currentTime),l.gain.exponentialRampToValueAtTime(.01,o.currentTime+n),a.start(o.currentTime),a.stop(o.currentTime+n)}catch(o){console.warn("[Sound] Failed to play tone:",o)}}playSequence(t,n=.3){if(!this.enabled)return;let r=0;t.forEach(o=>{setTimeout(()=>{this.playTone(o.freq,o.duration,n)},r),r+=o.delay})}syncStart(){this.playSequence([{freq:261.63,duration:.15,delay:0},{freq:329.63,duration:.15,delay:100},{freq:392,duration:.2,delay:100}],.2)}signalFound(){this.playSequence([{freq:392,duration:.1,delay:0},{freq:523.25,duration:.15,delay:80}],.25)}syncComplete(){this.playSequence([{freq:261.63,duration:.12,delay:0},{freq:329.63,duration:.12,delay:80},{freq:392,duration:.12,delay:80},{freq:523.25,duration:.2,delay:80}],.2)}error(){this.playSequence([{freq:329.63,duration:.15,delay:0},{freq:261.63,duration:.2,delay:100}],.3)}click(){this.playTone(440,.05,.15)}}const oo=new iL;function oL(){const[e,t]=L.useState([]),[n,r]=L.useState([]),[o,a]=L.useState("discovery"),[l,c]=L.useState(!1),[d,f]=L.useState(null),[p,y]=L.useState(!0),[v,w]=L.useState(!B0),[b,S]=L.useState(!0),[_,E]=L.useState(!1),[P,j]=L.useState(!1),[D,$]=L.useState(null),[O,z]=L.useState(!1),[q,J]=L.useState(!1),[ie,re]=L.useState(!1),[Q,ye]=L.useState(!0),[ne,Z]=L.useState(()=>localStorage.getItem("theme")||"dark"),fe=L.useRef(null);L.useMemo(()=>{const N=n.length;let V=0,C=0,X=null;for(const je of n){V+=je.score,je.score>C&&(C=je.score);const Ae=new Date(je.date);(!X||Ae>new Date(X.date))&&(X=je)}const ve=N?Math.round(V/N):0,ae=X?new Date(X.date):null;return{total:N,average:ve,top:C,latestTimestamp:ae,latestTitle:X?.title??X?.category??null}},[n]),L.useEffect(()=>{(async()=>{if(!B0){w(!0),y(!1);return}try{const{data:C,error:X}=await Ee.from("init_state").select("is_initialized").single();X?(console.warn("[App] Init check error (might be fresh DB):",X),X.code==="42P01"&&S(!1)):S(C.is_initialized>0);const{data:{session:ve}}=await Ee.auth.getSession();f(ve?.user??null)}catch(C){console.error("[App] Status check failed:",C)}finally{y(!1)}})();const{data:{subscription:V}}=Ee.auth.onAuthStateChange((C,X)=>{f(X?.user??null)});return()=>V.unsubscribe()},[]),L.useEffect(()=>{document.documentElement.setAttribute("data-theme",ne),localStorage.setItem("theme",ne)},[ne]);const[le,H]=L.useState({});L.useEffect(()=>{const N=async()=>{if(!d)return;const{data:C}=await Ee.from("alchemy_settings").select("sync_start_date, last_sync_checkpoint").eq("user_id",d.id).maybeSingle();C&&H(C)};N();const V=setInterval(N,2e3);return()=>clearInterval(V)},[d,O]),L.useEffect(()=>{if(!d)return;(async()=>{const{data:C}=await Ee.from("alchemy_settings").select("sound_enabled").eq("user_id",d.id).maybeSingle();if(C){const X=C.sound_enabled??!0;ye(X),oo.setEnabled(X)}})();const V=Ee.channel("processing_events").on("postgres_changes",{event:"INSERT",schema:"public",table:"processing_events",filter:`user_id=eq.${d.id}`},C=>{const X=C.new;X.agent_state==="Mining"&&!q&&(J(!0),re(!0),Q&&oo.syncStart()),X.agent_state==="Signal"&&Q&&oo.signalFound(),X.agent_state==="Completed"&&(J(!1),Q&&(X.metadata?.errors>0?oo.error():oo.syncComplete()),setTimeout(()=>{re(!1)},5e3),oe())}).subscribe();return()=>{Ee.removeChannel(V)}},[d,q,Q]),L.useEffect(()=>{const N=new EventSource("/events");return N.onmessage=V=>{const C=JSON.parse(V.data);C.type==="history"?t(X=>[...C.data,...X].slice(0,100)):t(X=>[C,...X].slice(0,100))},oe(),()=>N.close()},[d]),L.useEffect(()=>{fe.current&&fe.current.scrollIntoView({behavior:"smooth"})},[e]);const oe=async()=>{try{if(d){const{data:V,error:C}=await Ee.from("signals").select("*").order("created_at",{ascending:!1});if(!C&&V){r(V.map(X=>({id:X.id,title:X.title,score:X.score,summary:X.summary,date:X.created_at,category:X.category,entities:X.entities})));return}}const N=await He.get("/api/signals");r(N.data)}catch(N){console.error("Failed to fetch signals",N)}},T=async()=>{c(!0);try{await He.post("/api/mine"),oe()}catch(N){console.error("Mining failed:",N)}finally{c(!1)}};return p?g.jsx("div",{className:"flex items-center justify-center h-screen bg-bg",children:g.jsx("div",{className:"w-12 h-12 border-4 border-primary/20 border-t-primary rounded-full animate-spin"})}):v?g.jsx(Gw,{onComplete:()=>w(!1)}):d?g.jsx(hN,{children:g.jsx(gN,{children:g.jsxs("div",{className:"flex h-screen w-screen overflow-hidden bg-bg text-fg",children:[g.jsxs(ze.aside,{animate:{width:_?72:240},className:"glass m-4 mr-0 flex flex-col relative",children:[g.jsxs("div",{className:`px-4 py-3 pb-4 flex items-center gap-3 ${_?"justify-center":""}`,children:[g.jsx("div",{className:"w-10 h-10 min-w-[40px] bg-gradient-to-br from-primary to-accent rounded-xl flex items-center justify-center shadow-lg glow-primary",children:g.jsx(is,{className:"text-white fill-current",size:24})}),!_&&g.jsx(ze.h1,{initial:{opacity:0},animate:{opacity:1},className:"text-xl font-bold tracking-tight",children:"Alchemist"})]}),g.jsxs("nav",{className:"flex-1 flex flex-col gap-1 px-3",children:[g.jsx(wl,{active:o==="discovery",onClick:()=>a("discovery"),icon:g.jsx(cS,{size:20}),label:"Discovery",collapsed:_}),g.jsx(wl,{active:o==="engine",onClick:()=>a("engine"),icon:g.jsx(Oh,{size:20}),label:"Engine",collapsed:_}),g.jsx(wl,{active:o==="logs",onClick:()=>a("logs"),icon:g.jsx(Vd,{size:20}),label:"System Logs",collapsed:_}),g.jsx(wl,{active:o==="account",onClick:()=>a("account"),icon:g.jsx(Lh,{size:20}),label:"Account",collapsed:_})]}),g.jsx("div",{className:"px-3 pb-2",children:g.jsxs("button",{onClick:()=>Z(ne==="dark"?"light":"dark"),className:`w-full flex items-center ${_?"justify-center":"gap-3"} px-4 py-2.5 rounded-lg text-fg/40 hover:text-fg hover:bg-surface/50 transition-all text-xs font-medium`,title:_?ne==="dark"?"Switch to Light Mode":"Switch to Dark Mode":"",children:[g.jsx("div",{className:"min-w-[20px] flex justify-center",children:ne==="dark"?g.jsx(wS,{size:18}):g.jsx(mS,{size:18})}),!_&&g.jsx(ze.span,{initial:{opacity:0,x:-10},animate:{opacity:1,x:0},className:"whitespace-nowrap",children:ne==="dark"?"Light Mode":"Dark Mode"})]})}),g.jsxs("div",{className:"px-3 pb-3",children:[g.jsx("button",{onClick:()=>E(!_),className:`w-full flex items-center px-4 py-2.5 rounded-lg text-fg/40 hover:text-fg hover:bg-surface/50 transition-all text-xs font-medium ${_?"justify-center":"gap-3"}`,children:_?g.jsx(eS,{size:20}):g.jsxs(g.Fragment,{children:[g.jsx("div",{className:"min-w-[20px] flex justify-center",children:g.jsx(Zk,{size:20})}),g.jsx("span",{children:"Collapse"})]})}),g.jsxs("button",{onClick:()=>j(!0),className:"w-full flex items-center justify-center gap-2 px-3 py-2 mt-2 text-[10px] font-mono text-fg/30 hover:text-primary hover:bg-surface/30 rounded-lg transition-all group",title:"View Changelog",children:[!_&&g.jsxs(g.Fragment,{children:[g.jsx(Bd,{size:12,className:"group-hover:text-primary transition-colors"}),g.jsxs("span",{children:["v","1.0.17"]})]}),_&&g.jsx(Bd,{size:14,className:"group-hover:text-primary transition-colors"})]})]})]}),g.jsxs("main",{className:"flex-1 flex flex-col p-4 gap-4 overflow-hidden relative",children:[o==="discovery"&&g.jsxs(g.Fragment,{children:[g.jsxs("header",{className:"flex justify-between items-center px-4 py-2",children:[g.jsxs("div",{children:[g.jsx("h2",{className:"text-2xl font-bold",children:"Discovery"}),g.jsx("p",{className:"text-sm text-fg/50",children:"Passive intelligence mining from your browser history."})]}),g.jsxs("div",{className:"flex gap-2",children:[g.jsxs("button",{onClick:()=>z(!0),className:"px-6 py-3 glass hover:bg-surface transition-colors flex items-center gap-2 text-sm font-medium",children:[g.jsx(vS,{size:16}),g.jsxs("div",{className:"flex flex-col items-start",children:[g.jsx("span",{children:"Sync Settings"}),(le.sync_start_date||le.last_sync_checkpoint)&&g.jsx("span",{className:"text-[10px] text-fg/40 font-mono",children:le.sync_start_date?`From: ${new Date(le.sync_start_date).toLocaleString([],{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}`:le.last_sync_checkpoint?`Checkpoint: ${new Date(le.last_sync_checkpoint).toLocaleString([],{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}`:""})]})]}),g.jsxs("button",{onClick:T,disabled:q,className:"px-6 py-3 bg-gradient-to-r from-primary to-accent text-white font-bold rounded-xl shadow-lg glow-primary hover:scale-105 active:scale-95 transition-all flex items-center gap-2 disabled:opacity-50 disabled:cursor-not-allowed disabled:hover:scale-100",children:[g.jsx(Ih,{size:18,className:q?"animate-spin":""}),q?"Syncing...":"Sync History"]})]})]}),g.jsx(MN,{onOpenUrl:N=>window.open(N,"_blank","noopener,noreferrer"),onCopyText:N=>{navigator.clipboard.writeText(N)}})]}),o==="engine"&&g.jsx(mN,{}),o==="account"&&g.jsx(kN,{}),o==="logs"&&g.jsx(jN,{}),g.jsx(vN,{isExpanded:ie,onToggle:()=>re(!ie)})]}),g.jsx(TN,{signal:D,onClose:()=>$(null)}),g.jsx(CN,{isOpen:O,onClose:()=>z(!1)}),g.jsx(sL,{isOpen:P,onClose:()=>j(!1)})]})})}):g.jsx(uN,{onAuthSuccess:()=>oe(),isInitialized:b})}function wl({active:e,icon:t,label:n,onClick:r,collapsed:o}){return g.jsx("button",{onClick:r,title:o?n:"",className:`w-full flex items-center ${o?"justify-center":"gap-3"} px-4 py-3 rounded-xl transition-all ${e?"bg-primary/10 text-primary shadow-sm":"text-fg/60 hover:bg-surface hover:text-fg"}`,children:o?bo.cloneElement(t,{className:e?"text-primary":""}):g.jsxs(g.Fragment,{children:[g.jsx("div",{className:"min-w-[20px] flex justify-center",children:bo.cloneElement(t,{className:e?"text-primary":""})}),g.jsx(ze.span,{initial:{opacity:0,x:-10},animate:{opacity:1,x:0},className:"font-semibold text-sm whitespace-nowrap",children:n})]})})}function aL(){He.interceptors.request.use(async e=>{try{const{data:{session:t}}=await Ee.auth.getSession();t?.access_token&&(e.headers.Authorization=`Bearer ${t.access_token}`);const n=Tf();n&&(e.headers["x-supabase-url"]=n.url,e.headers["x-supabase-key"]=n.anonKey)}catch(t){console.error("[Axios] Error injecting headers:",t)}return e})}aL();Uk.createRoot(document.getElementById("root")).render(g.jsx(bo.StrictMode,{children:g.jsx(oL,{})}));
|
|
116
|
+
Failed to load changelog.`)}finally{a(!1)}};return g.jsx(_n,{children:e&&g.jsxs(g.Fragment,{children:[g.jsx(ze.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:t,className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-50"}),g.jsx(ze.div,{initial:{opacity:0,scale:.95,y:20},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:20},transition:{type:"spring",damping:25,stiffness:300},className:"fixed inset-0 z-50 flex items-center justify-center p-4 pointer-events-none",children:g.jsxs("div",{className:"glass w-full max-w-3xl max-h-[80vh] overflow-hidden pointer-events-auto shadow-2xl",children:[g.jsxs("div",{className:"flex items-center justify-between p-6 border-b border-border",children:[g.jsxs("div",{className:"flex items-center gap-3",children:[g.jsx(Kk,{size:24,className:"text-primary"}),g.jsx("h2",{className:"text-xl font-bold",children:"Release Notes"})]}),g.jsx("button",{onClick:t,className:"p-2 hover:bg-surface rounded-lg transition-colors",children:g.jsx(Cr,{size:20,className:"text-fg/60"})})]}),g.jsx("div",{className:"p-6 overflow-y-auto custom-scrollbar max-h-[calc(80vh-88px)]",children:o?g.jsx("div",{className:"flex items-center justify-center py-12",children:g.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-2 border-primary border-t-transparent"})}):g.jsx(Z4,{components:{h1:({children:c})=>g.jsx("h1",{className:"text-2xl font-bold text-fg mb-6 mt-0",children:c}),h2:({children:c})=>g.jsx("h2",{className:"text-xl font-bold text-fg mt-8 mb-3 pb-2 border-b border-border first:mt-0",children:c}),h3:({children:c})=>g.jsx("h3",{className:"text-lg font-bold text-primary mt-6 mb-2",children:c}),p:({children:c})=>g.jsx("p",{className:"text-sm text-fg/70 mb-3 leading-relaxed",children:c}),ul:({children:c})=>g.jsx("ul",{className:"list-none space-y-1 mb-4 ml-0",children:c}),li:({children:c})=>g.jsx("li",{className:"text-sm text-fg/80 ml-4 mb-1 before:content-['•'] before:mr-2 before:text-primary",children:c}),a:({href:c,children:d})=>g.jsx("a",{href:c,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:text-primary/80 underline transition-colors",children:d}),code:({children:c})=>g.jsx("code",{className:"bg-surface/50 text-accent px-1.5 py-0.5 rounded text-xs font-mono border border-border",children:c}),strong:({children:c})=>g.jsx("strong",{className:"font-bold text-fg",children:c})},children:n})})]})})]})})}class iL{audioContext=null;enabled=!0;constructor(){}getAudioContext(){return this.audioContext||(this.audioContext=new(window.AudioContext||window.webkitAudioContext)),this.audioContext}setEnabled(t){this.enabled=t}isEnabled(){return this.enabled}playTone(t,n,r=.3){if(this.enabled)try{const o=this.getAudioContext(),a=o.createOscillator(),l=o.createGain();a.connect(l),l.connect(o.destination),a.frequency.value=t,a.type="sine",l.gain.setValueAtTime(r,o.currentTime),l.gain.exponentialRampToValueAtTime(.01,o.currentTime+n),a.start(o.currentTime),a.stop(o.currentTime+n)}catch(o){console.warn("[Sound] Failed to play tone:",o)}}playSequence(t,n=.3){if(!this.enabled)return;let r=0;t.forEach(o=>{setTimeout(()=>{this.playTone(o.freq,o.duration,n)},r),r+=o.delay})}syncStart(){this.playSequence([{freq:261.63,duration:.15,delay:0},{freq:329.63,duration:.15,delay:100},{freq:392,duration:.2,delay:100}],.2)}signalFound(){this.playSequence([{freq:392,duration:.1,delay:0},{freq:523.25,duration:.15,delay:80}],.25)}syncComplete(){this.playSequence([{freq:261.63,duration:.12,delay:0},{freq:329.63,duration:.12,delay:80},{freq:392,duration:.12,delay:80},{freq:523.25,duration:.2,delay:80}],.2)}error(){this.playSequence([{freq:329.63,duration:.15,delay:0},{freq:261.63,duration:.2,delay:100}],.3)}click(){this.playTone(440,.05,.15)}}const oo=new iL;function oL(){const[e,t]=L.useState([]),[n,r]=L.useState([]),[o,a]=L.useState("discovery"),[l,c]=L.useState(!1),[d,f]=L.useState(null),[p,y]=L.useState(!0),[v,w]=L.useState(!B0),[b,S]=L.useState(!0),[_,E]=L.useState(!1),[P,j]=L.useState(!1),[D,$]=L.useState(null),[O,z]=L.useState(!1),[q,J]=L.useState(!1),[ie,re]=L.useState(!1),[Q,ye]=L.useState(!0),[ne,Z]=L.useState(()=>localStorage.getItem("theme")||"dark"),fe=L.useRef(null);L.useMemo(()=>{const N=n.length;let V=0,C=0,X=null;for(const je of n){V+=je.score,je.score>C&&(C=je.score);const Ae=new Date(je.date);(!X||Ae>new Date(X.date))&&(X=je)}const ve=N?Math.round(V/N):0,ae=X?new Date(X.date):null;return{total:N,average:ve,top:C,latestTimestamp:ae,latestTitle:X?.title??X?.category??null}},[n]),L.useEffect(()=>{(async()=>{if(!B0){w(!0),y(!1);return}try{const{data:C,error:X}=await Ee.from("init_state").select("is_initialized").single();X?(console.warn("[App] Init check error (might be fresh DB):",X),X.code==="42P01"&&S(!1)):S(C.is_initialized>0);const{data:{session:ve}}=await Ee.auth.getSession();f(ve?.user??null)}catch(C){console.error("[App] Status check failed:",C)}finally{y(!1)}})();const{data:{subscription:V}}=Ee.auth.onAuthStateChange((C,X)=>{f(X?.user??null)});return()=>V.unsubscribe()},[]),L.useEffect(()=>{document.documentElement.setAttribute("data-theme",ne),localStorage.setItem("theme",ne)},[ne]);const[le,H]=L.useState({});L.useEffect(()=>{const N=async()=>{if(!d)return;const{data:C}=await Ee.from("alchemy_settings").select("sync_start_date, last_sync_checkpoint").eq("user_id",d.id).maybeSingle();C&&H(C)};N();const V=setInterval(N,2e3);return()=>clearInterval(V)},[d,O]),L.useEffect(()=>{if(!d)return;(async()=>{const{data:C}=await Ee.from("alchemy_settings").select("sound_enabled").eq("user_id",d.id).maybeSingle();if(C){const X=C.sound_enabled??!0;ye(X),oo.setEnabled(X)}})();const V=Ee.channel("processing_events").on("postgres_changes",{event:"INSERT",schema:"public",table:"processing_events",filter:`user_id=eq.${d.id}`},C=>{const X=C.new;X.agent_state==="Mining"&&!q&&(J(!0),re(!0),Q&&oo.syncStart()),X.agent_state==="Signal"&&Q&&oo.signalFound(),X.agent_state==="Completed"&&(J(!1),Q&&(X.metadata?.errors>0?oo.error():oo.syncComplete()),setTimeout(()=>{re(!1)},5e3),oe())}).subscribe();return()=>{Ee.removeChannel(V)}},[d,q,Q]),L.useEffect(()=>{const N=new EventSource("/events");return N.onmessage=V=>{const C=JSON.parse(V.data);C.type==="history"?t(X=>[...C.data,...X].slice(0,100)):t(X=>[C,...X].slice(0,100))},oe(),()=>N.close()},[d]),L.useEffect(()=>{fe.current&&fe.current.scrollIntoView({behavior:"smooth"})},[e]);const oe=async()=>{try{if(d){const{data:V,error:C}=await Ee.from("signals").select("*").order("created_at",{ascending:!1});if(!C&&V){r(V.map(X=>({id:X.id,title:X.title,score:X.score,summary:X.summary,date:X.created_at,category:X.category,entities:X.entities})));return}}const N=await He.get("/api/signals");r(N.data)}catch(N){console.error("Failed to fetch signals",N)}},T=async()=>{c(!0);try{await He.post("/api/mine"),oe()}catch(N){console.error("Mining failed:",N)}finally{c(!1)}};return p?g.jsx("div",{className:"flex items-center justify-center h-screen bg-bg",children:g.jsx("div",{className:"w-12 h-12 border-4 border-primary/20 border-t-primary rounded-full animate-spin"})}):v?g.jsx(Gw,{onComplete:()=>w(!1)}):d?g.jsx(hN,{children:g.jsx(gN,{children:g.jsxs("div",{className:"flex h-screen w-screen overflow-hidden bg-bg text-fg",children:[g.jsxs(ze.aside,{animate:{width:_?72:240},className:"glass m-4 mr-0 flex flex-col relative",children:[g.jsxs("div",{className:`px-4 py-3 pb-4 flex items-center gap-3 ${_?"justify-center":""}`,children:[g.jsx("div",{className:"w-10 h-10 min-w-[40px] bg-gradient-to-br from-primary to-accent rounded-xl flex items-center justify-center shadow-lg glow-primary",children:g.jsx(is,{className:"text-white fill-current",size:24})}),!_&&g.jsx(ze.h1,{initial:{opacity:0},animate:{opacity:1},className:"text-xl font-bold tracking-tight",children:"Alchemist"})]}),g.jsxs("nav",{className:"flex-1 flex flex-col gap-1 px-3",children:[g.jsx(wl,{active:o==="discovery",onClick:()=>a("discovery"),icon:g.jsx(cS,{size:20}),label:"Discovery",collapsed:_}),g.jsx(wl,{active:o==="engine",onClick:()=>a("engine"),icon:g.jsx(Oh,{size:20}),label:"Engine",collapsed:_}),g.jsx(wl,{active:o==="logs",onClick:()=>a("logs"),icon:g.jsx(Vd,{size:20}),label:"System Logs",collapsed:_}),g.jsx(wl,{active:o==="account",onClick:()=>a("account"),icon:g.jsx(Lh,{size:20}),label:"Account",collapsed:_})]}),g.jsx("div",{className:"px-3 pb-2",children:g.jsxs("button",{onClick:()=>Z(ne==="dark"?"light":"dark"),className:`w-full flex items-center ${_?"justify-center":"gap-3"} px-4 py-2.5 rounded-lg text-fg/40 hover:text-fg hover:bg-surface/50 transition-all text-xs font-medium`,title:_?ne==="dark"?"Switch to Light Mode":"Switch to Dark Mode":"",children:[g.jsx("div",{className:"min-w-[20px] flex justify-center",children:ne==="dark"?g.jsx(wS,{size:18}):g.jsx(mS,{size:18})}),!_&&g.jsx(ze.span,{initial:{opacity:0,x:-10},animate:{opacity:1,x:0},className:"whitespace-nowrap",children:ne==="dark"?"Light Mode":"Dark Mode"})]})}),g.jsxs("div",{className:"px-3 pb-3",children:[g.jsx("button",{onClick:()=>E(!_),className:`w-full flex items-center px-4 py-2.5 rounded-lg text-fg/40 hover:text-fg hover:bg-surface/50 transition-all text-xs font-medium ${_?"justify-center":"gap-3"}`,children:_?g.jsx(eS,{size:20}):g.jsxs(g.Fragment,{children:[g.jsx("div",{className:"min-w-[20px] flex justify-center",children:g.jsx(Zk,{size:20})}),g.jsx("span",{children:"Collapse"})]})}),g.jsxs("button",{onClick:()=>j(!0),className:"w-full flex items-center justify-center gap-2 px-3 py-2 mt-2 text-[10px] font-mono text-fg/30 hover:text-primary hover:bg-surface/30 rounded-lg transition-all group",title:"View Changelog",children:[!_&&g.jsxs(g.Fragment,{children:[g.jsx(Bd,{size:12,className:"group-hover:text-primary transition-colors"}),g.jsxs("span",{children:["v","1.0.18"]})]}),_&&g.jsx(Bd,{size:14,className:"group-hover:text-primary transition-colors"})]})]})]}),g.jsxs("main",{className:"flex-1 flex flex-col p-4 gap-4 overflow-hidden relative",children:[o==="discovery"&&g.jsxs(g.Fragment,{children:[g.jsxs("header",{className:"flex justify-between items-center px-4 py-2",children:[g.jsxs("div",{children:[g.jsx("h2",{className:"text-2xl font-bold",children:"Discovery"}),g.jsx("p",{className:"text-sm text-fg/50",children:"Passive intelligence mining from your browser history."})]}),g.jsxs("div",{className:"flex gap-2",children:[g.jsxs("button",{onClick:()=>z(!0),className:"px-6 py-3 glass hover:bg-surface transition-colors flex items-center gap-2 text-sm font-medium",children:[g.jsx(vS,{size:16}),g.jsxs("div",{className:"flex flex-col items-start",children:[g.jsx("span",{children:"Sync Settings"}),(le.sync_start_date||le.last_sync_checkpoint)&&g.jsx("span",{className:"text-[10px] text-fg/40 font-mono",children:le.sync_start_date?`From: ${new Date(le.sync_start_date).toLocaleString([],{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}`:le.last_sync_checkpoint?`Checkpoint: ${new Date(le.last_sync_checkpoint).toLocaleString([],{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}`:""})]})]}),g.jsxs("button",{onClick:T,disabled:q,className:"px-6 py-3 bg-gradient-to-r from-primary to-accent text-white font-bold rounded-xl shadow-lg glow-primary hover:scale-105 active:scale-95 transition-all flex items-center gap-2 disabled:opacity-50 disabled:cursor-not-allowed disabled:hover:scale-100",children:[g.jsx(Ih,{size:18,className:q?"animate-spin":""}),q?"Syncing...":"Sync History"]})]})]}),g.jsx(MN,{onOpenUrl:N=>window.open(N,"_blank","noopener,noreferrer"),onCopyText:N=>{navigator.clipboard.writeText(N)}})]}),o==="engine"&&g.jsx(mN,{}),o==="account"&&g.jsx(kN,{}),o==="logs"&&g.jsx(jN,{}),g.jsx(vN,{isExpanded:ie,onToggle:()=>re(!ie)})]}),g.jsx(TN,{signal:D,onClose:()=>$(null)}),g.jsx(CN,{isOpen:O,onClose:()=>z(!1)}),g.jsx(sL,{isOpen:P,onClose:()=>j(!1)})]})})}):g.jsx(uN,{onAuthSuccess:()=>oe(),isInitialized:b})}function wl({active:e,icon:t,label:n,onClick:r,collapsed:o}){return g.jsx("button",{onClick:r,title:o?n:"",className:`w-full flex items-center ${o?"justify-center":"gap-3"} px-4 py-3 rounded-xl transition-all ${e?"bg-primary/10 text-primary shadow-sm":"text-fg/60 hover:bg-surface hover:text-fg"}`,children:o?bo.cloneElement(t,{className:e?"text-primary":""}):g.jsxs(g.Fragment,{children:[g.jsx("div",{className:"min-w-[20px] flex justify-center",children:bo.cloneElement(t,{className:e?"text-primary":""})}),g.jsx(ze.span,{initial:{opacity:0,x:-10},animate:{opacity:1,x:0},className:"font-semibold text-sm whitespace-nowrap",children:n})]})})}function aL(){He.interceptors.request.use(async e=>{try{const{data:{session:t}}=await Ee.auth.getSession();t?.access_token&&(e.headers.Authorization=`Bearer ${t.access_token}`);const n=Tf();n&&(e.headers["x-supabase-url"]=n.url,e.headers["x-supabase-key"]=n.anonKey)}catch(t){console.error("[Axios] Error injecting headers:",t)}return e})}aL();Uk.createRoot(document.getElementById("root")).render(g.jsx(bo.StrictMode,{children:g.jsx(oL,{})}));
|
package/dist/index.html
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
<link rel="preconnect" href="https://fonts.googleapis.com">
|
|
10
10
|
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
|
11
11
|
<link href="https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;700&family=Outfit:wght@300;400;600;800&display=swap" rel="stylesheet">
|
|
12
|
-
<script type="module" crossorigin src="/assets/index-
|
|
12
|
+
<script type="module" crossorigin src="/assets/index-CfrrGVGT.js"></script>
|
|
13
13
|
<link rel="stylesheet" crossorigin href="/assets/index-CGqpwL7z.css">
|
|
14
14
|
</head>
|
|
15
15
|
<body>
|
package/package.json
CHANGED