diff --git a/frontend/src/components/inventory/ResultsTable.tsx b/frontend/src/components/inventory/ResultsTable.tsx index 753f2c79..3859cc31 100644 --- a/frontend/src/components/inventory/ResultsTable.tsx +++ b/frontend/src/components/inventory/ResultsTable.tsx @@ -1,5 +1,5 @@ import React, { useEffect, useMemo, useRef, useState } from 'react'; -import { COLUMNS, COLUMNS_LS_KEY } from './constants'; +import { COLUMNS, COLUMNS_LS_KEY, RENDER_CHUNK } from './constants'; import type { InventorySearch } from './useInventorySearch'; import type { InvItem } from './types'; @@ -40,6 +40,9 @@ export function ResultsTable({ search, selected, onSelect }: { const { filters: f, update, result } = search; const [visible, setVisible] = useState>(loadVisible); const [pickerOpen, setPickerOpen] = useState(false); + // Incremental rendering: the full result set is loaded in one request, but + // only renderCount rows are in the DOM; scrolling near the bottom grows it. + const [renderCount, setRenderCount] = useState(RENDER_CHUNK); const scrollRef = useRef(null); const cols = useMemo(() => { const eff = new Set(visible); @@ -47,6 +50,21 @@ export function ResultsTable({ search, selected, onSelect }: { return COLUMNS.filter(c => eff.has(c.key)); }, [visible, f.itemType]); const items = result?.items ?? []; + const shown = items.slice(0, renderCount); + + // New result set (search/sort/filter change) → jump back to the top. + useEffect(() => { + setRenderCount(RENDER_CHUNK); + scrollRef.current?.scrollTo(0, 0); + }, [result]); + + const onScroll = () => { + const el = scrollRef.current; + if (!el || renderCount >= items.length) return; + if (el.scrollTop + el.clientHeight >= el.scrollHeight - 600) { + setRenderCount(c => Math.min(c + RENDER_CHUNK, items.length)); + } + }; useEffect(() => { try { @@ -65,25 +83,24 @@ export function ResultsTable({ search, selected, onSelect }: { e.preventDefault(); const idx = selected ? items.indexOf(selected) : -1; const next = e.key === 'ArrowDown' ? Math.min(idx + 1, items.length - 1) : Math.max(idx - 1, 0); - if (items[next]) onSelect(items[next]); + if (items[next]) { + onSelect(items[next]); + // Keep keyboard navigation working past the rendered window. + if (next >= renderCount) setRenderCount(c => Math.min(c + RENDER_CHUNK, items.length)); + } }; window.addEventListener('keydown', onKey); return () => window.removeEventListener('keydown', onKey); - }, [items, selected, onSelect]); + }, [items, selected, onSelect, renderCount]); const sortOn = (sortKey?: string) => { if (!sortKey) return; if (f.sortBy === sortKey) update({ sortDir: f.sortDir === 'asc' ? 'desc' : 'asc' }); else update({ sortBy: sortKey, sortDir: 'asc' }); }; - const totalPages = result ? Math.max(1, Math.ceil(result.total_count / result.limit)) : 1; - const goto = (p: number) => { - update({ page: Math.min(Math.max(1, p), totalPages) }); - scrollRef.current?.scrollTo(0, 0); - }; return ( -
+
{pickerOpen && ( @@ -108,7 +125,7 @@ export function ResultsTable({ search, selected, onSelect }: { ))} - {items.map((it, i) => ( + {shown.map((it, i) => ( onSelect(it === selected ? null : it)}> {cols.map(c => {cell(it, c.key)})} @@ -117,12 +134,14 @@ export function ResultsTable({ search, selected, onSelect }: { {!items.length && No items match.} -
- goto(f.page - 1)}>◀ - page {result?.page ?? 1} / {totalPages} - goto(f.page + 1)}>▶ - {result?.limit ?? 200} / page -
+ {renderCount < items.length && ( +
Scroll for more… ({shown.length.toLocaleString()} of {items.length.toLocaleString()} shown)
+ )} + {result?.has_next && renderCount >= items.length && ( +
+ Showing the first {items.length.toLocaleString()} of {result.total_count.toLocaleString()} matches — narrow your filters to see the rest. +
+ )}
); } diff --git a/frontend/src/components/inventory/constants.ts b/frontend/src/components/inventory/constants.ts index 90748788..7b32ef66 100644 --- a/frontend/src/components/inventory/constants.ts +++ b/frontend/src/components/inventory/constants.ts @@ -101,5 +101,10 @@ export const COLUMNS: ColumnDef[] = [ { key: 'last_updated', label: 'Updated', sortKey: 'last_updated', defaultVisible: false }, ]; -export const PAGE_SIZE = 200; +// One-shot fetch: every search loads the full result set in a single request +// (no pagination); rows are rendered incrementally on scroll. Capped at 10k — +// a filterless all-characters browse is ~38k items / 65 MB JSON, which no +// browser should be asked to swallow; real searches are a few thousand rows. +export const PAGE_SIZE = 10000; +export const RENDER_CHUNK = 300; export const COLUMNS_LS_KEY = 'inv.visibleColumns'; diff --git a/static/assets/AdminUsersWindow-Dw8sqA9n.js b/static/assets/AdminUsersWindow-BReYQ7Y-.js similarity index 98% rename from static/assets/AdminUsersWindow-Dw8sqA9n.js rename to static/assets/AdminUsersWindow-BReYQ7Y-.js index 4830ae61..84f0fa91 100644 --- a/static/assets/AdminUsersWindow-Dw8sqA9n.js +++ b/static/assets/AdminUsersWindow-BReYQ7Y-.js @@ -1 +1 @@ -import{e as I,r as t,l as _,f as L,g as N,h as W,j as e,D as F}from"./index-YQnl0KV7.js";import"./react-yfL0ty4i.js";function R(c){try{return new Date(c).toISOString().slice(0,10)}catch{return c}}const q=({id:c,zIndex:x})=>{const{user:j}=I(),[g,k]=t.useState([]),[w,p]=t.useState(!0),[b,n]=t.useState(null),[l,C]=t.useState(""),[i,f]=t.useState(""),[h,y]=t.useState(!1),[d,S]=t.useState(!1),[A,u]=t.useState(null),[o,m]=t.useState(""),r=t.useCallback(async()=>{p(!0),n(null);try{const s=await _();k(s.users??[])}catch(s){n(String(s))}finally{p(!1)}},[]);t.useEffect(()=>{r()},[r]);const U=t.useCallback(async s=>{if(s.preventDefault(),!l.trim()||i.length<4){n("Username required and password must be at least 4 chars");return}S(!0),n(null);try{await L(l.trim(),i,h),C(""),f(""),y(!1),await r()}catch(a){n(String(a))}finally{S(!1)}},[l,i,h,r]),v=t.useCallback(async s=>{n(null);try{await N(s.id,{is_admin:!s.is_admin}),await r()}catch(a){n(String(a))}},[r]),D=t.useCallback(async s=>{if(o.length<4){n("Password must be at least 4 characters");return}n(null);try{await N(s,{password:o}),u(null),m("")}catch(a){n(String(a))}},[o]),P=t.useCallback(async s=>{if(confirm(`Delete user "${s.username}"? This cannot be undone.`)){n(null);try{await W(s.id),await r()}catch(a){n(String(a))}}},[r]);return e.jsx(F,{id:c,title:"🛡️ Admin · Users",zIndex:x,width:620,height:540,children:e.jsxs("div",{className:"ml-admin",children:[b&&e.jsx("div",{className:"ml-admin-error",children:b}),e.jsxs("section",{className:"ml-admin-section",children:[e.jsx("h3",{children:"Add user"}),e.jsxs("form",{onSubmit:U,className:"ml-admin-create",children:[e.jsx("input",{type:"text",placeholder:"Username",value:l,onChange:s=>C(s.target.value),disabled:d,autoComplete:"off"}),e.jsx("input",{type:"password",placeholder:"Password (min 4)",value:i,onChange:s=>f(s.target.value),disabled:d,autoComplete:"new-password"}),e.jsxs("label",{children:[e.jsx("input",{type:"checkbox",checked:h,onChange:s=>y(s.target.checked),disabled:d}),"admin"]}),e.jsx("button",{type:"submit",disabled:d||!l.trim()||i.length<4,children:d?"Adding…":"Add"})]})]}),e.jsxs("section",{className:"ml-admin-section",children:[e.jsxs("h3",{children:["Users ",w&&e.jsx("span",{className:"ml-admin-muted",children:"(loading…)"})]}),e.jsxs("table",{className:"ml-admin-table",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:"ID"}),e.jsx("th",{children:"Username"}),e.jsx("th",{children:"Admin"}),e.jsx("th",{children:"Created"}),e.jsx("th",{children:"Actions"})]})}),e.jsxs("tbody",{children:[g.map(s=>{const a=j!=null&&j.username.toLowerCase()===s.username.toLowerCase();return e.jsxs("tr",{children:[e.jsx("td",{children:s.id}),e.jsxs("td",{children:[s.username,a&&e.jsx("span",{className:"ml-admin-muted",children:" (you)"})]}),e.jsx("td",{children:e.jsx("button",{className:"ml-admin-toggle",onClick:()=>v(s),title:"Click to toggle admin",children:s.is_admin?"✓":"–"})}),e.jsx("td",{children:R(s.created_at)}),e.jsx("td",{children:A===s.id?e.jsxs("span",{className:"ml-admin-pw-edit",children:[e.jsx("input",{type:"text",placeholder:"New password",value:o,onChange:E=>m(E.target.value),autoFocus:!0}),e.jsx("button",{onClick:()=>D(s.id),children:"Save"}),e.jsx("button",{onClick:()=>{u(null),m("")},children:"Cancel"})]}):e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:()=>{u(s.id),m("")},children:"Reset PW"}),!a&&e.jsx("button",{className:"ml-admin-danger",onClick:()=>P(s),children:"Delete"})]})})]},s.id)}),g.length===0&&!w&&e.jsx("tr",{children:e.jsx("td",{colSpan:5,className:"ml-admin-muted",children:"No users."})})]})]})]})]})})};export{q as AdminUsersWindow}; +import{e as I,r as t,l as _,f as L,g as N,h as W,j as e,D as F}from"./index-Dg_ifawe.js";import"./react-yfL0ty4i.js";function R(c){try{return new Date(c).toISOString().slice(0,10)}catch{return c}}const q=({id:c,zIndex:x})=>{const{user:j}=I(),[g,k]=t.useState([]),[w,p]=t.useState(!0),[b,n]=t.useState(null),[l,C]=t.useState(""),[i,f]=t.useState(""),[h,y]=t.useState(!1),[d,S]=t.useState(!1),[A,u]=t.useState(null),[o,m]=t.useState(""),r=t.useCallback(async()=>{p(!0),n(null);try{const s=await _();k(s.users??[])}catch(s){n(String(s))}finally{p(!1)}},[]);t.useEffect(()=>{r()},[r]);const U=t.useCallback(async s=>{if(s.preventDefault(),!l.trim()||i.length<4){n("Username required and password must be at least 4 chars");return}S(!0),n(null);try{await L(l.trim(),i,h),C(""),f(""),y(!1),await r()}catch(a){n(String(a))}finally{S(!1)}},[l,i,h,r]),v=t.useCallback(async s=>{n(null);try{await N(s.id,{is_admin:!s.is_admin}),await r()}catch(a){n(String(a))}},[r]),D=t.useCallback(async s=>{if(o.length<4){n("Password must be at least 4 characters");return}n(null);try{await N(s,{password:o}),u(null),m("")}catch(a){n(String(a))}},[o]),P=t.useCallback(async s=>{if(confirm(`Delete user "${s.username}"? This cannot be undone.`)){n(null);try{await W(s.id),await r()}catch(a){n(String(a))}}},[r]);return e.jsx(F,{id:c,title:"🛡️ Admin · Users",zIndex:x,width:620,height:540,children:e.jsxs("div",{className:"ml-admin",children:[b&&e.jsx("div",{className:"ml-admin-error",children:b}),e.jsxs("section",{className:"ml-admin-section",children:[e.jsx("h3",{children:"Add user"}),e.jsxs("form",{onSubmit:U,className:"ml-admin-create",children:[e.jsx("input",{type:"text",placeholder:"Username",value:l,onChange:s=>C(s.target.value),disabled:d,autoComplete:"off"}),e.jsx("input",{type:"password",placeholder:"Password (min 4)",value:i,onChange:s=>f(s.target.value),disabled:d,autoComplete:"new-password"}),e.jsxs("label",{children:[e.jsx("input",{type:"checkbox",checked:h,onChange:s=>y(s.target.checked),disabled:d}),"admin"]}),e.jsx("button",{type:"submit",disabled:d||!l.trim()||i.length<4,children:d?"Adding…":"Add"})]})]}),e.jsxs("section",{className:"ml-admin-section",children:[e.jsxs("h3",{children:["Users ",w&&e.jsx("span",{className:"ml-admin-muted",children:"(loading…)"})]}),e.jsxs("table",{className:"ml-admin-table",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:"ID"}),e.jsx("th",{children:"Username"}),e.jsx("th",{children:"Admin"}),e.jsx("th",{children:"Created"}),e.jsx("th",{children:"Actions"})]})}),e.jsxs("tbody",{children:[g.map(s=>{const a=j!=null&&j.username.toLowerCase()===s.username.toLowerCase();return e.jsxs("tr",{children:[e.jsx("td",{children:s.id}),e.jsxs("td",{children:[s.username,a&&e.jsx("span",{className:"ml-admin-muted",children:" (you)"})]}),e.jsx("td",{children:e.jsx("button",{className:"ml-admin-toggle",onClick:()=>v(s),title:"Click to toggle admin",children:s.is_admin?"✓":"–"})}),e.jsx("td",{children:R(s.created_at)}),e.jsx("td",{children:A===s.id?e.jsxs("span",{className:"ml-admin-pw-edit",children:[e.jsx("input",{type:"text",placeholder:"New password",value:o,onChange:E=>m(E.target.value),autoFocus:!0}),e.jsx("button",{onClick:()=>D(s.id),children:"Save"}),e.jsx("button",{onClick:()=>{u(null),m("")},children:"Cancel"})]}):e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:()=>{u(s.id),m("")},children:"Reset PW"}),!a&&e.jsx("button",{className:"ml-admin-danger",onClick:()=>P(s),children:"Delete"})]})})]},s.id)}),g.length===0&&!w&&e.jsx("tr",{children:e.jsx("td",{colSpan:5,className:"ml-admin-muted",children:"No users."})})]})]})]})]})})};export{q as AdminUsersWindow}; diff --git a/static/assets/AgentWindow-DWbV6rD2.js b/static/assets/AgentWindow-bQ5tlleI.js similarity index 96% rename from static/assets/AgentWindow-DWbV6rD2.js rename to static/assets/AgentWindow-bQ5tlleI.js index 369bccd0..a2646218 100644 --- a/static/assets/AgentWindow-DWbV6rD2.js +++ b/static/assets/AgentWindow-bQ5tlleI.js @@ -1 +1 @@ -import{r as n,b as w,c as k,d as E,j as t,D as I}from"./index-YQnl0KV7.js";import"./react-yfL0ty4i.js";const h="overlord_agent_session_id";function v(){if(typeof crypto<"u"&&typeof crypto.randomUUID=="function")return crypto.randomUUID();const s=l=>Math.floor(Math.random()*l);return`${s(4294967296).toString(16).padStart(8,"0")}-${s(65536).toString(16).padStart(4,"0")}-4${s(4096).toString(16).padStart(3,"0")}-${(8+s(4)).toString(16)}${s(4096).toString(16).padStart(3,"0")}-${s(281474976710656).toString(16).padStart(12,"0")}`}function $(){try{const l=localStorage.getItem(h);if(l)return l}catch{}const s=v();try{localStorage.setItem(h,s)}catch{}return s}const _=({id:s,zIndex:l})=>{const[o,j]=n.useState(()=>$()),[d,i]=n.useState([]),[g,m]=n.useState(""),[r,f]=n.useState(!1),[p,x]=n.useState(!0),S=n.useRef(null);n.useEffect(()=>{let e=!1;return x(!0),w(o).then(a=>{if(e)return;const c=(a.messages??[]).map(y=>({role:y.role,text:y.text}));i(c)}).catch(()=>{e||i([])}).finally(()=>{e||x(!1)}),()=>{e=!0}},[o]),n.useEffect(()=>{const e=S.current;e&&(e.scrollTop=e.scrollHeight)},[d.length,r]);const u=n.useCallback(async()=>{const e=g.trim();if(!(!e||r)){m(""),i(a=>[...a,{role:"user",text:e}]),f(!0);try{const a=await k(e,o);i(c=>[...c,{role:a.is_error?"error":"assistant",text:a.result||"(no response)"}])}catch(a){i(c=>[...c,{role:"error",text:`Request failed: ${String(a)}`}])}finally{f(!1)}}},[g,r,o]),N=n.useCallback(async()=>{if(r)return;let e="";try{e=(await E()).session_id}catch{e=v()}try{localStorage.setItem(h,e)}catch{}j(e),i([]),m("")},[r]),b=n.useCallback(e=>{e.key==="Enter"&&!e.shiftKey&&(e.preventDefault(),u())},[u]);return t.jsx(I,{id:s,title:"🤖 Overlord Assistant",zIndex:l,width:520,height:620,children:t.jsxs("div",{className:"ml-agent",children:[t.jsxs("div",{className:"ml-agent-toolbar",children:[t.jsx("button",{className:"ml-agent-btn",onClick:N,disabled:r,children:"+ New Chat"}),t.jsxs("span",{className:"ml-agent-session",title:o,children:[o.slice(0,8),"…"]})]}),t.jsxs("div",{className:"ml-agent-messages",ref:S,children:[p&&d.length===0&&t.jsx("div",{className:"ml-agent-empty",children:"Loading conversation…"}),!p&&d.length===0&&t.jsx("div",{className:"ml-agent-empty",children:"Ask anything about the live game state — players, kills, inventory, suitbuilder, recent rares, etc."}),d.map((e,a)=>t.jsxs("div",{className:`ml-agent-msg ml-agent-${e.role}`,children:[t.jsx("div",{className:"ml-agent-role",children:e.role==="user"?"You":e.role==="assistant"?"Overlord":"Error"}),t.jsx("div",{className:"ml-agent-text",children:e.text})]},a)),r&&t.jsxs("div",{className:"ml-agent-msg ml-agent-assistant",children:[t.jsx("div",{className:"ml-agent-role",children:"Overlord"}),t.jsx("div",{className:"ml-agent-text ml-agent-thinking",children:"Thinking…"})]})]}),t.jsxs("form",{className:"ml-agent-form",onSubmit:e=>{e.preventDefault(),u()},children:[t.jsx("textarea",{className:"ml-agent-input",value:g,onChange:e=>m(e.target.value),onKeyDown:b,placeholder:r?"Waiting for response…":"Type a message — Enter to send, Shift+Enter for newline",disabled:r,rows:2}),t.jsx("button",{type:"submit",className:"ml-agent-send",disabled:r||!g.trim(),children:"Send"})]})]})})};export{_ as AgentWindow}; +import{r as n,b as w,c as k,d as E,j as t,D as I}from"./index-Dg_ifawe.js";import"./react-yfL0ty4i.js";const h="overlord_agent_session_id";function v(){if(typeof crypto<"u"&&typeof crypto.randomUUID=="function")return crypto.randomUUID();const s=l=>Math.floor(Math.random()*l);return`${s(4294967296).toString(16).padStart(8,"0")}-${s(65536).toString(16).padStart(4,"0")}-4${s(4096).toString(16).padStart(3,"0")}-${(8+s(4)).toString(16)}${s(4096).toString(16).padStart(3,"0")}-${s(281474976710656).toString(16).padStart(12,"0")}`}function $(){try{const l=localStorage.getItem(h);if(l)return l}catch{}const s=v();try{localStorage.setItem(h,s)}catch{}return s}const _=({id:s,zIndex:l})=>{const[o,j]=n.useState(()=>$()),[d,i]=n.useState([]),[g,m]=n.useState(""),[r,f]=n.useState(!1),[p,x]=n.useState(!0),S=n.useRef(null);n.useEffect(()=>{let e=!1;return x(!0),w(o).then(a=>{if(e)return;const c=(a.messages??[]).map(y=>({role:y.role,text:y.text}));i(c)}).catch(()=>{e||i([])}).finally(()=>{e||x(!1)}),()=>{e=!0}},[o]),n.useEffect(()=>{const e=S.current;e&&(e.scrollTop=e.scrollHeight)},[d.length,r]);const u=n.useCallback(async()=>{const e=g.trim();if(!(!e||r)){m(""),i(a=>[...a,{role:"user",text:e}]),f(!0);try{const a=await k(e,o);i(c=>[...c,{role:a.is_error?"error":"assistant",text:a.result||"(no response)"}])}catch(a){i(c=>[...c,{role:"error",text:`Request failed: ${String(a)}`}])}finally{f(!1)}}},[g,r,o]),N=n.useCallback(async()=>{if(r)return;let e="";try{e=(await E()).session_id}catch{e=v()}try{localStorage.setItem(h,e)}catch{}j(e),i([]),m("")},[r]),b=n.useCallback(e=>{e.key==="Enter"&&!e.shiftKey&&(e.preventDefault(),u())},[u]);return t.jsx(I,{id:s,title:"🤖 Overlord Assistant",zIndex:l,width:520,height:620,children:t.jsxs("div",{className:"ml-agent",children:[t.jsxs("div",{className:"ml-agent-toolbar",children:[t.jsx("button",{className:"ml-agent-btn",onClick:N,disabled:r,children:"+ New Chat"}),t.jsxs("span",{className:"ml-agent-session",title:o,children:[o.slice(0,8),"…"]})]}),t.jsxs("div",{className:"ml-agent-messages",ref:S,children:[p&&d.length===0&&t.jsx("div",{className:"ml-agent-empty",children:"Loading conversation…"}),!p&&d.length===0&&t.jsx("div",{className:"ml-agent-empty",children:"Ask anything about the live game state — players, kills, inventory, suitbuilder, recent rares, etc."}),d.map((e,a)=>t.jsxs("div",{className:`ml-agent-msg ml-agent-${e.role}`,children:[t.jsx("div",{className:"ml-agent-role",children:e.role==="user"?"You":e.role==="assistant"?"Overlord":"Error"}),t.jsx("div",{className:"ml-agent-text",children:e.text})]},a)),r&&t.jsxs("div",{className:"ml-agent-msg ml-agent-assistant",children:[t.jsx("div",{className:"ml-agent-role",children:"Overlord"}),t.jsx("div",{className:"ml-agent-text ml-agent-thinking",children:"Thinking…"})]})]}),t.jsxs("form",{className:"ml-agent-form",onSubmit:e=>{e.preventDefault(),u()},children:[t.jsx("textarea",{className:"ml-agent-input",value:g,onChange:e=>m(e.target.value),onKeyDown:b,placeholder:r?"Waiting for response…":"Type a message — Enter to send, Shift+Enter for newline",disabled:r,rows:2}),t.jsx("button",{type:"submit",className:"ml-agent-send",disabled:r||!g.trim(),children:"Send"})]})]})})};export{_ as AgentWindow}; diff --git a/static/assets/CharacterWindow-Crv2ChMj.js b/static/assets/CharacterWindow-CJqV0b5w.js similarity index 99% rename from static/assets/CharacterWindow-Crv2ChMj.js rename to static/assets/CharacterWindow-CJqV0b5w.js index c87210f0..ccaabc26 100644 --- a/static/assets/CharacterWindow-Crv2ChMj.js +++ b/static/assets/CharacterWindow-CJqV0b5w.js @@ -1 +1 @@ -import{r as f,a as J,j as e,D as K}from"./index-YQnl0KV7.js";import"./react-yfL0ty4i.js";const F={218:"Reinforcement of the Lugians",219:"Bleeargh's Fortitude",220:"Oswald's Enhancement",221:"Siraluun's Blessing",222:"Enduring Calm",223:"Steadfast Will",224:"Ciandra's Essence",225:"Yoshi's Essence",226:"Jibril's Essence",227:"Celdiseth's Essence",228:"Koga's Essence",229:"Shadow of the Seventh Mule",230:"Might of the Seventh Mule",231:"Clutch of the Miser",232:"Enduring Enchantment",233:"Critical Protection",234:"Quick Learner",235:"Ciandra's Fortune",236:"Charmed Smith",237:"Innate Renewal",238:"Archmage's Endurance",239:"Enhancement of the Blade Turner",240:"Enhancement of the Arrow Turner",241:"Enhancement of the Mace Turner",242:"Caustic Enhancement",243:"Fierce Impaler",244:"Iron Skin of the Invincible",245:"Eye of the Remorseless",246:"Hand of the Remorseless",294:"Master of the Steel Circle",295:"Master of the Focused Eye",296:"Master of the Five Fold Path",297:"Frenzy of the Slayer",298:"Iron Skin of the Invincible",299:"Jack of All Trades",300:"Infused Void Magic",301:"Infused War Magic",302:"Infused Life Magic",309:"Infused Item Magic",310:"Infused Creature Magic",326:"Clutch of the Miser",328:"Enduring Enchantment"},B={333:"Valor / Destruction",334:"Protection",335:"Glory / Retribution",336:"Temperance / Hardening",338:"Aetheric Vision",339:"Mana Flow",340:"Mana Infusion",342:"Purity",343:"Craftsman",344:"Specialization",365:"World"},$={370:"Damage",371:"Damage Resistance",372:"Critical",373:"Critical Resistance",374:"Critical Damage",375:"Critical Damage Resistance",376:"Healing Boost",379:"Vitality"},W={287:"Celestial Hand",288:"Eldrytch Web",289:"Radiant Blood"},D={354:"Melee",355:"Ranged",362:"Summoning"},q={1:"Unarmed",2:"Swords",3:"Axes",4:"Maces",5:"Spears",6:"Daggers",7:"Staves",8:"Bows",9:"Crossbows",10:"Thrown",11:"Two-Handed",12:"Void",13:"War",14:"Life"},U={181:"Chess Rank",192:"Fishing Skill",199:"Total Augmentations",322:"Aetheria Slots",390:"Enlightenment"};function Q(c){return c>=1001?"Master":c>=301?"Lord":c>=151?"Knight":c>=31?"Adept":"Initiate"}const d="#af7a30",u="#000022",ee=({id:c,charName:g,zIndex:L,vitals:s,liveStats:O})=>{var _,N;const[H,P]=f.useState(null),[j,V]=f.useState(0),[m,G]=f.useState(0);f.useEffect(()=>{J(`/character-stats/${encodeURIComponent(g)}`).then(P).catch(()=>{})},[g]);const n=O||H,a=t=>t!=null?Number(t).toLocaleString():"—",o=(n==null?void 0:n.stats_data)||n||{},C=o.attributes||{},A=o.skills||{},Y=o.vitals||{},E=o.titles||[],h=o.properties||{},T=Object.entries(A).filter(([,t])=>(t==null?void 0:t.training)==="Specialized").sort(([t],[l])=>t.localeCompare(l)),I=Object.entries(A).filter(([,t])=>(t==null?void 0:t.training)==="Trained").sort(([t],[l])=>t.localeCompare(l)),S=Object.entries(h).filter(([t,l])=>F[parseInt(t)]&&Number(l)>0).map(([t,l])=>({name:F[parseInt(t)],uses:Number(l)})),w=Object.entries(h).filter(([t,l])=>B[parseInt(t)]&&Number(l)>0).map(([t,l])=>({name:B[parseInt(t)],uses:Number(l)})),z=Object.entries(h).filter(([t,l])=>$[parseInt(t)]&&Number(l)>0).map(([t,l])=>({name:$[parseInt(t)],value:Number(l)})),x=[];n!=null&&n.birth&&x.push({name:"Birth",value:n.birth}),(n==null?void 0:n.deaths)!=null&&x.push({name:"Deaths",value:a(n.deaths)}),Object.entries(h).forEach(([t,l])=>{const i=parseInt(t);U[i]&&x.push({name:U[i],value:l})});const y=[];Object.entries(h).forEach(([t,l])=>{const i=parseInt(t);D[i]&&y.push({name:D[i],value:q[Number(l)]||`Unknown (${l})`})});const b=[];Object.entries(h).forEach(([t,l])=>{const i=parseInt(t);W[i]&&Number(l)>0&&b.push({name:W[i],rank:Q(Number(l)),value:Number(l)})});const R=t=>({padding:"5px 8px",fontSize:12,fontWeight:"bold",color:"#fff",cursor:"pointer",userSelect:"none",borderTop:`2px solid ${t?d:u}`,borderLeft:`2px solid ${t?d:u}`,borderRight:`2px solid ${t?d:u}`,background:t?"rgba(0,100,0,0.4)":"transparent"}),M={background:"#000",border:`2px solid ${d}`,maxHeight:400,overflowY:"auto",overflowX:"hidden"},r={background:"#222",fontWeight:"bold",fontSize:12,padding:"2px 6px"},k={padding:"2px 6px",background:"rgba(0,100,0,0.4)",whiteSpace:"nowrap"},p={padding:"2px 6px",background:"rgba(0,0,100,0.4)",textAlign:"right",whiteSpace:"nowrap"},X={padding:"2px 6px",color:"#ccc"};return e.jsx(K,{id:c,title:`Character: ${g}`,zIndex:L,width:740,height:600,children:e.jsxs("div",{style:{background:u,color:"#fff",font:'14px/1.5 -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,sans-serif',overflowY:"auto",padding:"10px 15px 15px",flex:1},children:[e.jsxs("div",{style:{marginBottom:10},children:[e.jsxs("h1",{style:{margin:"0 0 2px",fontSize:28,fontWeight:"bold"},children:[g,e.jsx("span",{style:{fontSize:"200%",color:"#fff27f",float:"right"},children:(n==null?void 0:n.level)||""})]}),e.jsx("div",{style:{fontSize:"85%",color:"gold"},children:[n==null?void 0:n.gender,n==null?void 0:n.race].filter(Boolean).join(" ")||"Awaiting character data..."})]}),e.jsxs("div",{style:{fontSize:"85%",margin:"6px 0 10px",display:"grid",gridTemplateColumns:"1fr 1fr",gap:"0 20px"},children:[e.jsxs("div",{children:["Total XP: ",a(n==null?void 0:n.total_xp)]}),e.jsxs("div",{style:{textAlign:"right"},children:["Unassigned XP: ",a(n==null?void 0:n.unassigned_xp)]}),e.jsxs("div",{children:["Luminance: ",(n==null?void 0:n.luminance_earned)!=null?`${a(n.luminance_earned)} / ${a(n.luminance_total)}`:"—"]}),e.jsxs("div",{style:{textAlign:"right"},children:["Deaths: ",a(n==null?void 0:n.deaths)]})]}),e.jsxs("div",{style:{display:"flex",gap:13,flexWrap:"wrap"},children:[e.jsxs("div",{style:{width:320},children:[e.jsx("div",{style:{height:30,display:"flex"},children:["Attributes","Skills","Titles"].map((t,l)=>e.jsx("div",{style:R(j===l),onClick:()=>V(l),children:t},t))}),e.jsxs("div",{style:M,children:[j===0&&e.jsxs(e.Fragment,{children:[e.jsx("div",{style:{padding:"6px 8px",display:"flex",flexDirection:"column",gap:8,borderBottom:`2px solid ${d}`},children:[{label:"Health",pct:(s==null?void 0:s.health_percentage)??0,cur:s==null?void 0:s.health_current,max:s==null?void 0:s.health_max,bg:"#cc3333"},{label:"Stamina",pct:(s==null?void 0:s.stamina_percentage)??0,cur:s==null?void 0:s.stamina_current,max:s==null?void 0:s.stamina_max,bg:"#ccaa33"},{label:"Mana",pct:(s==null?void 0:s.mana_percentage)??0,cur:s==null?void 0:s.mana_current,max:s==null?void 0:s.mana_max,bg:"#3366cc"}].map(t=>e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[e.jsx("span",{style:{width:55,fontSize:12,color:"#ccc"},children:t.label}),e.jsx("div",{style:{flex:1,height:14,overflow:"hidden",position:"relative",border:`1px solid ${d}`},children:e.jsx("div",{style:{height:"100%",width:`${t.pct}%`,background:t.bg,transition:"width 0.5s ease"}})}),e.jsxs("span",{style:{width:80,textAlign:"right",fontSize:12,color:"#ccc"},children:[t.cur??"—"," / ",t.max??"—"]})]},t.label))}),e.jsxs("table",{style:{width:"100%",fontSize:13,borderCollapse:"collapse"},children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("td",{style:r,children:"Attribute"}),e.jsx("td",{style:r,children:"Creation"}),e.jsx("td",{style:r,children:"Base"})]})}),e.jsx("tbody",{children:["strength","endurance","coordination","quickness","focus","self"].map(t=>{var l,i;return e.jsxs("tr",{children:[e.jsx("td",{style:k,children:t.charAt(0).toUpperCase()+t.slice(1)}),e.jsx("td",{style:X,children:((l=C[t])==null?void 0:l.creation)??"—"}),e.jsx("td",{style:p,children:((i=C[t])==null?void 0:i.base)??"—"})]},t)})})]}),e.jsxs("table",{style:{width:"100%",fontSize:13,borderCollapse:"collapse"},children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("td",{style:r,children:"Vital"}),e.jsx("td",{style:r,children:"Base"})]})}),e.jsx("tbody",{children:["health","stamina","mana"].map(t=>{var l;return e.jsxs("tr",{children:[e.jsx("td",{style:k,children:t.charAt(0).toUpperCase()+t.slice(1)}),e.jsx("td",{style:p,children:((l=Y[t])==null?void 0:l.base)??"—"})]},t)})})]}),e.jsx("table",{style:{width:"100%",fontSize:13,borderCollapse:"collapse"},children:e.jsx("tbody",{children:e.jsxs("tr",{children:[e.jsx("td",{style:k,children:"Skill Credits"}),e.jsx("td",{style:p,children:a(o.skill_credits)})]})})})]}),j===1&&e.jsxs("table",{style:{width:"100%",fontSize:13,borderCollapse:"collapse"},children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("td",{style:r,children:"Skill"}),e.jsx("td",{style:r,children:"Level"})]})}),e.jsxs("tbody",{children:[T.map(([t,l])=>e.jsxs("tr",{children:[e.jsx("td",{style:{padding:"2px 6px",background:"linear-gradient(to right, #392067, #392067, black)"},children:t.replace(/_/g," ").replace(/\b\w/g,i=>i.toUpperCase())}),e.jsx("td",{style:{...p,background:"linear-gradient(to right, #392067, #392067, black)"},children:l.base})]},t)),I.map(([t,l])=>e.jsxs("tr",{children:[e.jsx("td",{style:{padding:"2px 6px",background:"linear-gradient(to right, #0f3c3e, #0f3c3e, black)"},children:t.replace(/_/g," ").replace(/\b\w/g,i=>i.toUpperCase())}),e.jsx("td",{style:{...p,background:"linear-gradient(to right, #0f3c3e, #0f3c3e, black)"},children:l.base})]},t)),T.length===0&&I.length===0&&e.jsx("tr",{children:e.jsx("td",{colSpan:2,style:{padding:10,color:"#666",fontStyle:"italic",textAlign:"center"},children:"No skill data"})})]})]}),j===2&&e.jsx("div",{style:{padding:"6px 10px",fontSize:13},children:E.length>0?E.map((t,l)=>e.jsx("div",{style:{padding:"1px 0"},children:t},l)):e.jsx("div",{style:{color:"#666",fontStyle:"italic",textAlign:"center",padding:10},children:"No titles"})})]})]}),e.jsxs("div",{style:{width:320},children:[e.jsx("div",{style:{height:30,display:"flex"},children:["Augmentations","Ratings","Other"].map((t,l)=>e.jsx("div",{style:R(m===l),onClick:()=>G(l),children:t},t))}),e.jsxs("div",{style:M,children:[m===0&&(S.length||w.length?e.jsxs(e.Fragment,{children:[S.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("div",{style:{background:"#222",padding:"4px 8px",fontWeight:"bold",fontSize:13,borderBottom:`1px solid ${d}`},children:"Augmentations"}),e.jsxs("table",{style:{width:"100%",fontSize:13,borderCollapse:"collapse"},children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("td",{style:r,children:"Name"}),e.jsx("td",{style:r,children:"Uses"})]})}),e.jsx("tbody",{children:S.map(t=>e.jsxs("tr",{children:[e.jsx("td",{style:{padding:"2px 6px"},children:t.name}),e.jsx("td",{style:{padding:"2px 6px",textAlign:"right"},children:t.uses})]},t.name))})]})]}),w.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("div",{style:{background:"#222",padding:"4px 8px",fontWeight:"bold",fontSize:13,borderBottom:`1px solid ${d}`},children:"Auras"}),e.jsxs("table",{style:{width:"100%",fontSize:13,borderCollapse:"collapse"},children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("td",{style:r,children:"Name"}),e.jsx("td",{style:r,children:"Uses"})]})}),e.jsx("tbody",{children:w.map(t=>e.jsxs("tr",{children:[e.jsx("td",{style:{padding:"2px 6px"},children:t.name}),e.jsx("td",{style:{padding:"2px 6px",textAlign:"right"},children:t.uses})]},t.name))})]})]})]}):e.jsx("div",{style:{color:"#666",fontStyle:"italic",textAlign:"center",padding:10},children:"No augmentation data"})),m===1&&(z.length>0?e.jsxs("table",{style:{width:"100%",fontSize:13,borderCollapse:"collapse"},children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("td",{style:r,children:"Rating"}),e.jsx("td",{style:r,children:"Value"})]})}),e.jsx("tbody",{children:z.map(t=>e.jsxs("tr",{children:[e.jsx("td",{style:{padding:"2px 6px"},children:t.name}),e.jsx("td",{style:{padding:"2px 6px",textAlign:"right"},children:t.value})]},t.name))})]}):e.jsx("div",{style:{color:"#666",fontStyle:"italic",textAlign:"center",padding:10},children:"No rating data"})),m===2&&e.jsxs("div",{children:[x.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("div",{style:{background:"#222",padding:"4px 8px",fontWeight:"bold",fontSize:13,borderBottom:`1px solid ${d}`},children:"General"}),e.jsx("table",{style:{width:"100%",fontSize:13,borderCollapse:"collapse"},children:e.jsx("tbody",{children:x.map(t=>e.jsxs("tr",{children:[e.jsx("td",{style:{padding:"2px 6px"},children:t.name}),e.jsx("td",{style:{padding:"2px 6px",textAlign:"right"},children:t.value})]},t.name))})})]}),y.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("div",{style:{background:"#222",padding:"4px 8px",fontWeight:"bold",fontSize:13,borderBottom:`1px solid ${d}`},children:"Masteries"}),e.jsx("table",{style:{width:"100%",fontSize:13,borderCollapse:"collapse"},children:e.jsx("tbody",{children:y.map(t=>e.jsxs("tr",{children:[e.jsx("td",{style:{padding:"2px 6px"},children:t.name}),e.jsx("td",{style:{padding:"2px 6px",textAlign:"right"},children:t.value})]},t.name))})})]}),b.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("div",{style:{background:"#222",padding:"4px 8px",fontWeight:"bold",fontSize:13,borderBottom:`1px solid ${d}`},children:"Society"}),e.jsx("table",{style:{width:"100%",fontSize:13,borderCollapse:"collapse"},children:e.jsx("tbody",{children:b.map(t=>e.jsxs("tr",{children:[e.jsx("td",{style:{padding:"2px 6px"},children:t.name}),e.jsxs("td",{style:{padding:"2px 6px",textAlign:"right"},children:[t.rank," (",t.value,")"]})]},t.name))})})]}),x.length===0&&y.length===0&&b.length===0&&e.jsx("div",{style:{color:"#666",fontStyle:"italic",textAlign:"center",padding:10},children:"No additional data"})]})]})]})]}),(n==null?void 0:n.allegiance)&&e.jsxs("div",{style:{marginTop:5,border:`2px solid ${d}`,background:"#000"},children:[e.jsx("div",{style:{background:"#222",padding:"4px 8px",fontWeight:"bold",fontSize:13,borderBottom:`1px solid ${d}`},children:"Allegiance"}),e.jsx("table",{style:{width:"100%",fontSize:13,borderCollapse:"collapse"},children:e.jsxs("tbody",{children:[n.allegiance.name&&e.jsxs("tr",{children:[e.jsx("td",{style:{padding:"2px 6px",color:"#ccc",width:100},children:"Name"}),e.jsx("td",{style:{padding:"2px 6px"},children:n.allegiance.name})]}),((_=n.allegiance.monarch)==null?void 0:_.name)&&e.jsxs("tr",{children:[e.jsx("td",{style:{padding:"2px 6px",color:"#ccc"},children:"Monarch"}),e.jsx("td",{style:{padding:"2px 6px"},children:n.allegiance.monarch.name})]}),((N=n.allegiance.patron)==null?void 0:N.name)&&e.jsxs("tr",{children:[e.jsx("td",{style:{padding:"2px 6px",color:"#ccc"},children:"Patron"}),e.jsx("td",{style:{padding:"2px 6px"},children:n.allegiance.patron.name})]}),n.allegiance.rank!=null&&e.jsxs("tr",{children:[e.jsx("td",{style:{padding:"2px 6px",color:"#ccc"},children:"Rank"}),e.jsx("td",{style:{padding:"2px 6px"},children:n.allegiance.rank})]}),n.allegiance.followers!=null&&e.jsxs("tr",{children:[e.jsx("td",{style:{padding:"2px 6px",color:"#ccc"},children:"Followers"}),e.jsx("td",{style:{padding:"2px 6px"},children:n.allegiance.followers})]})]})})]})]})})};export{ee as CharacterWindow}; +import{r as f,a as J,j as e,D as K}from"./index-Dg_ifawe.js";import"./react-yfL0ty4i.js";const F={218:"Reinforcement of the Lugians",219:"Bleeargh's Fortitude",220:"Oswald's Enhancement",221:"Siraluun's Blessing",222:"Enduring Calm",223:"Steadfast Will",224:"Ciandra's Essence",225:"Yoshi's Essence",226:"Jibril's Essence",227:"Celdiseth's Essence",228:"Koga's Essence",229:"Shadow of the Seventh Mule",230:"Might of the Seventh Mule",231:"Clutch of the Miser",232:"Enduring Enchantment",233:"Critical Protection",234:"Quick Learner",235:"Ciandra's Fortune",236:"Charmed Smith",237:"Innate Renewal",238:"Archmage's Endurance",239:"Enhancement of the Blade Turner",240:"Enhancement of the Arrow Turner",241:"Enhancement of the Mace Turner",242:"Caustic Enhancement",243:"Fierce Impaler",244:"Iron Skin of the Invincible",245:"Eye of the Remorseless",246:"Hand of the Remorseless",294:"Master of the Steel Circle",295:"Master of the Focused Eye",296:"Master of the Five Fold Path",297:"Frenzy of the Slayer",298:"Iron Skin of the Invincible",299:"Jack of All Trades",300:"Infused Void Magic",301:"Infused War Magic",302:"Infused Life Magic",309:"Infused Item Magic",310:"Infused Creature Magic",326:"Clutch of the Miser",328:"Enduring Enchantment"},B={333:"Valor / Destruction",334:"Protection",335:"Glory / Retribution",336:"Temperance / Hardening",338:"Aetheric Vision",339:"Mana Flow",340:"Mana Infusion",342:"Purity",343:"Craftsman",344:"Specialization",365:"World"},$={370:"Damage",371:"Damage Resistance",372:"Critical",373:"Critical Resistance",374:"Critical Damage",375:"Critical Damage Resistance",376:"Healing Boost",379:"Vitality"},W={287:"Celestial Hand",288:"Eldrytch Web",289:"Radiant Blood"},D={354:"Melee",355:"Ranged",362:"Summoning"},q={1:"Unarmed",2:"Swords",3:"Axes",4:"Maces",5:"Spears",6:"Daggers",7:"Staves",8:"Bows",9:"Crossbows",10:"Thrown",11:"Two-Handed",12:"Void",13:"War",14:"Life"},U={181:"Chess Rank",192:"Fishing Skill",199:"Total Augmentations",322:"Aetheria Slots",390:"Enlightenment"};function Q(c){return c>=1001?"Master":c>=301?"Lord":c>=151?"Knight":c>=31?"Adept":"Initiate"}const d="#af7a30",u="#000022",ee=({id:c,charName:g,zIndex:L,vitals:s,liveStats:O})=>{var _,N;const[H,P]=f.useState(null),[j,V]=f.useState(0),[m,G]=f.useState(0);f.useEffect(()=>{J(`/character-stats/${encodeURIComponent(g)}`).then(P).catch(()=>{})},[g]);const n=O||H,a=t=>t!=null?Number(t).toLocaleString():"—",o=(n==null?void 0:n.stats_data)||n||{},C=o.attributes||{},A=o.skills||{},Y=o.vitals||{},E=o.titles||[],h=o.properties||{},T=Object.entries(A).filter(([,t])=>(t==null?void 0:t.training)==="Specialized").sort(([t],[l])=>t.localeCompare(l)),I=Object.entries(A).filter(([,t])=>(t==null?void 0:t.training)==="Trained").sort(([t],[l])=>t.localeCompare(l)),S=Object.entries(h).filter(([t,l])=>F[parseInt(t)]&&Number(l)>0).map(([t,l])=>({name:F[parseInt(t)],uses:Number(l)})),w=Object.entries(h).filter(([t,l])=>B[parseInt(t)]&&Number(l)>0).map(([t,l])=>({name:B[parseInt(t)],uses:Number(l)})),z=Object.entries(h).filter(([t,l])=>$[parseInt(t)]&&Number(l)>0).map(([t,l])=>({name:$[parseInt(t)],value:Number(l)})),x=[];n!=null&&n.birth&&x.push({name:"Birth",value:n.birth}),(n==null?void 0:n.deaths)!=null&&x.push({name:"Deaths",value:a(n.deaths)}),Object.entries(h).forEach(([t,l])=>{const i=parseInt(t);U[i]&&x.push({name:U[i],value:l})});const y=[];Object.entries(h).forEach(([t,l])=>{const i=parseInt(t);D[i]&&y.push({name:D[i],value:q[Number(l)]||`Unknown (${l})`})});const b=[];Object.entries(h).forEach(([t,l])=>{const i=parseInt(t);W[i]&&Number(l)>0&&b.push({name:W[i],rank:Q(Number(l)),value:Number(l)})});const R=t=>({padding:"5px 8px",fontSize:12,fontWeight:"bold",color:"#fff",cursor:"pointer",userSelect:"none",borderTop:`2px solid ${t?d:u}`,borderLeft:`2px solid ${t?d:u}`,borderRight:`2px solid ${t?d:u}`,background:t?"rgba(0,100,0,0.4)":"transparent"}),M={background:"#000",border:`2px solid ${d}`,maxHeight:400,overflowY:"auto",overflowX:"hidden"},r={background:"#222",fontWeight:"bold",fontSize:12,padding:"2px 6px"},k={padding:"2px 6px",background:"rgba(0,100,0,0.4)",whiteSpace:"nowrap"},p={padding:"2px 6px",background:"rgba(0,0,100,0.4)",textAlign:"right",whiteSpace:"nowrap"},X={padding:"2px 6px",color:"#ccc"};return e.jsx(K,{id:c,title:`Character: ${g}`,zIndex:L,width:740,height:600,children:e.jsxs("div",{style:{background:u,color:"#fff",font:'14px/1.5 -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,sans-serif',overflowY:"auto",padding:"10px 15px 15px",flex:1},children:[e.jsxs("div",{style:{marginBottom:10},children:[e.jsxs("h1",{style:{margin:"0 0 2px",fontSize:28,fontWeight:"bold"},children:[g,e.jsx("span",{style:{fontSize:"200%",color:"#fff27f",float:"right"},children:(n==null?void 0:n.level)||""})]}),e.jsx("div",{style:{fontSize:"85%",color:"gold"},children:[n==null?void 0:n.gender,n==null?void 0:n.race].filter(Boolean).join(" ")||"Awaiting character data..."})]}),e.jsxs("div",{style:{fontSize:"85%",margin:"6px 0 10px",display:"grid",gridTemplateColumns:"1fr 1fr",gap:"0 20px"},children:[e.jsxs("div",{children:["Total XP: ",a(n==null?void 0:n.total_xp)]}),e.jsxs("div",{style:{textAlign:"right"},children:["Unassigned XP: ",a(n==null?void 0:n.unassigned_xp)]}),e.jsxs("div",{children:["Luminance: ",(n==null?void 0:n.luminance_earned)!=null?`${a(n.luminance_earned)} / ${a(n.luminance_total)}`:"—"]}),e.jsxs("div",{style:{textAlign:"right"},children:["Deaths: ",a(n==null?void 0:n.deaths)]})]}),e.jsxs("div",{style:{display:"flex",gap:13,flexWrap:"wrap"},children:[e.jsxs("div",{style:{width:320},children:[e.jsx("div",{style:{height:30,display:"flex"},children:["Attributes","Skills","Titles"].map((t,l)=>e.jsx("div",{style:R(j===l),onClick:()=>V(l),children:t},t))}),e.jsxs("div",{style:M,children:[j===0&&e.jsxs(e.Fragment,{children:[e.jsx("div",{style:{padding:"6px 8px",display:"flex",flexDirection:"column",gap:8,borderBottom:`2px solid ${d}`},children:[{label:"Health",pct:(s==null?void 0:s.health_percentage)??0,cur:s==null?void 0:s.health_current,max:s==null?void 0:s.health_max,bg:"#cc3333"},{label:"Stamina",pct:(s==null?void 0:s.stamina_percentage)??0,cur:s==null?void 0:s.stamina_current,max:s==null?void 0:s.stamina_max,bg:"#ccaa33"},{label:"Mana",pct:(s==null?void 0:s.mana_percentage)??0,cur:s==null?void 0:s.mana_current,max:s==null?void 0:s.mana_max,bg:"#3366cc"}].map(t=>e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[e.jsx("span",{style:{width:55,fontSize:12,color:"#ccc"},children:t.label}),e.jsx("div",{style:{flex:1,height:14,overflow:"hidden",position:"relative",border:`1px solid ${d}`},children:e.jsx("div",{style:{height:"100%",width:`${t.pct}%`,background:t.bg,transition:"width 0.5s ease"}})}),e.jsxs("span",{style:{width:80,textAlign:"right",fontSize:12,color:"#ccc"},children:[t.cur??"—"," / ",t.max??"—"]})]},t.label))}),e.jsxs("table",{style:{width:"100%",fontSize:13,borderCollapse:"collapse"},children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("td",{style:r,children:"Attribute"}),e.jsx("td",{style:r,children:"Creation"}),e.jsx("td",{style:r,children:"Base"})]})}),e.jsx("tbody",{children:["strength","endurance","coordination","quickness","focus","self"].map(t=>{var l,i;return e.jsxs("tr",{children:[e.jsx("td",{style:k,children:t.charAt(0).toUpperCase()+t.slice(1)}),e.jsx("td",{style:X,children:((l=C[t])==null?void 0:l.creation)??"—"}),e.jsx("td",{style:p,children:((i=C[t])==null?void 0:i.base)??"—"})]},t)})})]}),e.jsxs("table",{style:{width:"100%",fontSize:13,borderCollapse:"collapse"},children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("td",{style:r,children:"Vital"}),e.jsx("td",{style:r,children:"Base"})]})}),e.jsx("tbody",{children:["health","stamina","mana"].map(t=>{var l;return e.jsxs("tr",{children:[e.jsx("td",{style:k,children:t.charAt(0).toUpperCase()+t.slice(1)}),e.jsx("td",{style:p,children:((l=Y[t])==null?void 0:l.base)??"—"})]},t)})})]}),e.jsx("table",{style:{width:"100%",fontSize:13,borderCollapse:"collapse"},children:e.jsx("tbody",{children:e.jsxs("tr",{children:[e.jsx("td",{style:k,children:"Skill Credits"}),e.jsx("td",{style:p,children:a(o.skill_credits)})]})})})]}),j===1&&e.jsxs("table",{style:{width:"100%",fontSize:13,borderCollapse:"collapse"},children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("td",{style:r,children:"Skill"}),e.jsx("td",{style:r,children:"Level"})]})}),e.jsxs("tbody",{children:[T.map(([t,l])=>e.jsxs("tr",{children:[e.jsx("td",{style:{padding:"2px 6px",background:"linear-gradient(to right, #392067, #392067, black)"},children:t.replace(/_/g," ").replace(/\b\w/g,i=>i.toUpperCase())}),e.jsx("td",{style:{...p,background:"linear-gradient(to right, #392067, #392067, black)"},children:l.base})]},t)),I.map(([t,l])=>e.jsxs("tr",{children:[e.jsx("td",{style:{padding:"2px 6px",background:"linear-gradient(to right, #0f3c3e, #0f3c3e, black)"},children:t.replace(/_/g," ").replace(/\b\w/g,i=>i.toUpperCase())}),e.jsx("td",{style:{...p,background:"linear-gradient(to right, #0f3c3e, #0f3c3e, black)"},children:l.base})]},t)),T.length===0&&I.length===0&&e.jsx("tr",{children:e.jsx("td",{colSpan:2,style:{padding:10,color:"#666",fontStyle:"italic",textAlign:"center"},children:"No skill data"})})]})]}),j===2&&e.jsx("div",{style:{padding:"6px 10px",fontSize:13},children:E.length>0?E.map((t,l)=>e.jsx("div",{style:{padding:"1px 0"},children:t},l)):e.jsx("div",{style:{color:"#666",fontStyle:"italic",textAlign:"center",padding:10},children:"No titles"})})]})]}),e.jsxs("div",{style:{width:320},children:[e.jsx("div",{style:{height:30,display:"flex"},children:["Augmentations","Ratings","Other"].map((t,l)=>e.jsx("div",{style:R(m===l),onClick:()=>G(l),children:t},t))}),e.jsxs("div",{style:M,children:[m===0&&(S.length||w.length?e.jsxs(e.Fragment,{children:[S.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("div",{style:{background:"#222",padding:"4px 8px",fontWeight:"bold",fontSize:13,borderBottom:`1px solid ${d}`},children:"Augmentations"}),e.jsxs("table",{style:{width:"100%",fontSize:13,borderCollapse:"collapse"},children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("td",{style:r,children:"Name"}),e.jsx("td",{style:r,children:"Uses"})]})}),e.jsx("tbody",{children:S.map(t=>e.jsxs("tr",{children:[e.jsx("td",{style:{padding:"2px 6px"},children:t.name}),e.jsx("td",{style:{padding:"2px 6px",textAlign:"right"},children:t.uses})]},t.name))})]})]}),w.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("div",{style:{background:"#222",padding:"4px 8px",fontWeight:"bold",fontSize:13,borderBottom:`1px solid ${d}`},children:"Auras"}),e.jsxs("table",{style:{width:"100%",fontSize:13,borderCollapse:"collapse"},children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("td",{style:r,children:"Name"}),e.jsx("td",{style:r,children:"Uses"})]})}),e.jsx("tbody",{children:w.map(t=>e.jsxs("tr",{children:[e.jsx("td",{style:{padding:"2px 6px"},children:t.name}),e.jsx("td",{style:{padding:"2px 6px",textAlign:"right"},children:t.uses})]},t.name))})]})]})]}):e.jsx("div",{style:{color:"#666",fontStyle:"italic",textAlign:"center",padding:10},children:"No augmentation data"})),m===1&&(z.length>0?e.jsxs("table",{style:{width:"100%",fontSize:13,borderCollapse:"collapse"},children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("td",{style:r,children:"Rating"}),e.jsx("td",{style:r,children:"Value"})]})}),e.jsx("tbody",{children:z.map(t=>e.jsxs("tr",{children:[e.jsx("td",{style:{padding:"2px 6px"},children:t.name}),e.jsx("td",{style:{padding:"2px 6px",textAlign:"right"},children:t.value})]},t.name))})]}):e.jsx("div",{style:{color:"#666",fontStyle:"italic",textAlign:"center",padding:10},children:"No rating data"})),m===2&&e.jsxs("div",{children:[x.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("div",{style:{background:"#222",padding:"4px 8px",fontWeight:"bold",fontSize:13,borderBottom:`1px solid ${d}`},children:"General"}),e.jsx("table",{style:{width:"100%",fontSize:13,borderCollapse:"collapse"},children:e.jsx("tbody",{children:x.map(t=>e.jsxs("tr",{children:[e.jsx("td",{style:{padding:"2px 6px"},children:t.name}),e.jsx("td",{style:{padding:"2px 6px",textAlign:"right"},children:t.value})]},t.name))})})]}),y.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("div",{style:{background:"#222",padding:"4px 8px",fontWeight:"bold",fontSize:13,borderBottom:`1px solid ${d}`},children:"Masteries"}),e.jsx("table",{style:{width:"100%",fontSize:13,borderCollapse:"collapse"},children:e.jsx("tbody",{children:y.map(t=>e.jsxs("tr",{children:[e.jsx("td",{style:{padding:"2px 6px"},children:t.name}),e.jsx("td",{style:{padding:"2px 6px",textAlign:"right"},children:t.value})]},t.name))})})]}),b.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("div",{style:{background:"#222",padding:"4px 8px",fontWeight:"bold",fontSize:13,borderBottom:`1px solid ${d}`},children:"Society"}),e.jsx("table",{style:{width:"100%",fontSize:13,borderCollapse:"collapse"},children:e.jsx("tbody",{children:b.map(t=>e.jsxs("tr",{children:[e.jsx("td",{style:{padding:"2px 6px"},children:t.name}),e.jsxs("td",{style:{padding:"2px 6px",textAlign:"right"},children:[t.rank," (",t.value,")"]})]},t.name))})})]}),x.length===0&&y.length===0&&b.length===0&&e.jsx("div",{style:{color:"#666",fontStyle:"italic",textAlign:"center",padding:10},children:"No additional data"})]})]})]})]}),(n==null?void 0:n.allegiance)&&e.jsxs("div",{style:{marginTop:5,border:`2px solid ${d}`,background:"#000"},children:[e.jsx("div",{style:{background:"#222",padding:"4px 8px",fontWeight:"bold",fontSize:13,borderBottom:`1px solid ${d}`},children:"Allegiance"}),e.jsx("table",{style:{width:"100%",fontSize:13,borderCollapse:"collapse"},children:e.jsxs("tbody",{children:[n.allegiance.name&&e.jsxs("tr",{children:[e.jsx("td",{style:{padding:"2px 6px",color:"#ccc",width:100},children:"Name"}),e.jsx("td",{style:{padding:"2px 6px"},children:n.allegiance.name})]}),((_=n.allegiance.monarch)==null?void 0:_.name)&&e.jsxs("tr",{children:[e.jsx("td",{style:{padding:"2px 6px",color:"#ccc"},children:"Monarch"}),e.jsx("td",{style:{padding:"2px 6px"},children:n.allegiance.monarch.name})]}),((N=n.allegiance.patron)==null?void 0:N.name)&&e.jsxs("tr",{children:[e.jsx("td",{style:{padding:"2px 6px",color:"#ccc"},children:"Patron"}),e.jsx("td",{style:{padding:"2px 6px"},children:n.allegiance.patron.name})]}),n.allegiance.rank!=null&&e.jsxs("tr",{children:[e.jsx("td",{style:{padding:"2px 6px",color:"#ccc"},children:"Rank"}),e.jsx("td",{style:{padding:"2px 6px"},children:n.allegiance.rank})]}),n.allegiance.followers!=null&&e.jsxs("tr",{children:[e.jsx("td",{style:{padding:"2px 6px",color:"#ccc"},children:"Followers"}),e.jsx("td",{style:{padding:"2px 6px"},children:n.allegiance.followers})]})]})})]})]})})};export{ee as CharacterWindow}; diff --git a/static/assets/CombatPickerWindow-BwEKuuEk.js b/static/assets/CombatPickerWindow-kNju07hM.js similarity index 92% rename from static/assets/CombatPickerWindow-BwEKuuEk.js rename to static/assets/CombatPickerWindow-kNju07hM.js index 74e4c5c2..1c542f5b 100644 --- a/static/assets/CombatPickerWindow-BwEKuuEk.js +++ b/static/assets/CombatPickerWindow-kNju07hM.js @@ -1 +1 @@ -import{u as c,j as r,D as d}from"./index-YQnl0KV7.js";import"./react-yfL0ty4i.js";const p=({id:n,zIndex:i,characters:a})=>{const{openWindow:s}=c(),e=Array.from(a.keys()).sort();return r.jsx(d,{id:n,title:"Combat Stats — Select Character",zIndex:i,width:300,height:400,children:r.jsx("div",{style:{flex:1,overflowY:"auto",padding:6},children:e.length===0?r.jsx("div",{style:{padding:12,color:"#666",textAlign:"center",fontSize:"0.8rem"},children:"No characters online"}):e.map(o=>r.jsx("div",{style:{padding:"5px 8px",cursor:"pointer",borderBottom:"1px solid #222",color:"#ccc",fontSize:"0.82rem"},onMouseEnter:t=>t.currentTarget.style.background="#2a2a2a",onMouseLeave:t=>t.currentTarget.style.background="",onClick:()=>s(`combat-${o}`,`Combat: ${o}`,o),children:o},o))})})};export{p as CombatPickerWindow}; +import{u as c,j as r,D as d}from"./index-Dg_ifawe.js";import"./react-yfL0ty4i.js";const p=({id:n,zIndex:i,characters:a})=>{const{openWindow:s}=c(),e=Array.from(a.keys()).sort();return r.jsx(d,{id:n,title:"Combat Stats — Select Character",zIndex:i,width:300,height:400,children:r.jsx("div",{style:{flex:1,overflowY:"auto",padding:6},children:e.length===0?r.jsx("div",{style:{padding:12,color:"#666",textAlign:"center",fontSize:"0.8rem"},children:"No characters online"}):e.map(o=>r.jsx("div",{style:{padding:"5px 8px",cursor:"pointer",borderBottom:"1px solid #222",color:"#ccc",fontSize:"0.82rem"},onMouseEnter:t=>t.currentTarget.style.background="#2a2a2a",onMouseLeave:t=>t.currentTarget.style.background="",onClick:()=>s(`combat-${o}`,`Combat: ${o}`,o),children:o},o))})})};export{p as CombatPickerWindow}; diff --git a/static/assets/CombatStatsWindow-CZ93hq_w.js b/static/assets/CombatStatsWindow-BmptnoZZ.js similarity index 99% rename from static/assets/CombatStatsWindow-CZ93hq_w.js rename to static/assets/CombatStatsWindow-BmptnoZZ.js index d3e62c68..fe444a82 100644 --- a/static/assets/CombatStatsWindow-CZ93hq_w.js +++ b/static/assets/CombatStatsWindow-BmptnoZZ.js @@ -1 +1 @@ -import{r as A,a as B,j as t,D as L}from"./index-YQnl0KV7.js";import"./react-yfL0ty4i.js";const w=["Typeless","Slash","Pierce","Bludgeon","Fire","Cold","Acid","Electric"];function _(c,a,x){var o,m,f,k;return(((m=(o=c==null?void 0:c[a])==null?void 0:o[x])==null?void 0:m.total_normal_damage)??0)+(((k=(f=c==null?void 0:c[a])==null?void 0:f[x])==null?void 0:k.total_crit_damage)??0)}function G(c){let a={attacks:0,failed:0,crits:0,normalDmg:0,maxNormal:0,critDmg:0,maxCrit:0};if(!c)return a;for(const x of Object.values(c))for(const o of Object.values(x))a.attacks+=o.total_attacks??0,a.failed+=o.failed_attacks??0,a.crits+=o.crits??0,a.normalDmg+=o.total_normal_damage??0,a.maxNormal=Math.max(a.maxNormal,o.max_normal_damage??0),a.critDmg+=o.total_crit_damage??0,a.maxCrit=Math.max(a.maxCrit,o.max_crit_damage??0);return a}function F(c,a){let x={attacks:0,failed:0};const o=c==null?void 0:c[a];if(!o)return x;for(const m of Object.values(o))x.attacks+=m.total_attacks??0,x.failed+=m.failed_attacks??0;return x}const Y=({id:c,charName:a,zIndex:x})=>{const[o,m]=A.useState(null),[f,k]=A.useState("session"),[h,R]=A.useState(null);A.useEffect(()=>{B(`/combat-stats/${encodeURIComponent(a)}`).then(m).catch(()=>{});const e=setInterval(()=>{B(`/combat-stats/${encodeURIComponent(a)}`).then(m).catch(()=>{})},1e4);return()=>clearInterval(e)},[a]);const p=o==null?void 0:o[f],j=(p==null?void 0:p.monsters)??{},S=Object.keys(j).filter(e=>e!=="__cloak_surges__").sort(),n=A.useMemo(()=>{let e={},l={},v=0,$=0;const T=h?[j[h]].filter(Boolean):S.map(u=>j[u]);for(const u of T)if(u){for(const[g,D]of Object.entries(u.offense??{})){e[g]||(e[g]={});for(const[y,E]of Object.entries(D)){e[g][y]||(e[g][y]={total_attacks:0,failed_attacks:0,crits:0,total_normal_damage:0,max_normal_damage:0,total_crit_damage:0,max_crit_damage:0});const i=e[g][y],d=E;i.total_attacks+=d.total_attacks??0,i.failed_attacks+=d.failed_attacks??0,i.crits+=d.crits??0,i.total_normal_damage+=d.total_normal_damage??0,i.max_normal_damage=Math.max(i.max_normal_damage,d.max_normal_damage??0),i.total_crit_damage+=d.total_crit_damage??0,i.max_crit_damage=Math.max(i.max_crit_damage,d.max_crit_damage??0)}}for(const[g,D]of Object.entries(u.defense??{})){l[g]||(l[g]={});for(const[y,E]of Object.entries(D)){l[g][y]||(l[g][y]={total_attacks:0,failed_attacks:0,crits:0,total_normal_damage:0,max_normal_damage:0,total_crit_damage:0,max_crit_damage:0});const i=l[g][y],d=E;i.total_attacks+=d.total_attacks??0,i.failed_attacks+=d.failed_attacks??0,i.total_normal_damage+=d.total_normal_damage??0,i.max_normal_damage=Math.max(i.max_normal_damage,d.max_normal_damage??0),i.total_crit_damage+=d.total_crit_damage??0,i.max_crit_damage=Math.max(i.max_crit_damage,d.max_crit_damage??0)}}v+=u.aetheria_surges??0,$+=u.cloak_surges??0}return j.__cloak_surges__&&!h&&($+=j.__cloak_surges__.cloak_surges??0),{offense:e,defense:l,aeth:v,cloak:$}},[j,S,h]),r=G(n.offense),b=F(n.defense,"MeleeMissile"),M=F(n.defense,"Magic");r.attacks>0&&((r.attacks-r.failed)/r.attacks*100).toFixed(0);const N=b.attacks>0?(b.failed/b.attacks*100).toFixed(0):"0",W=M.attacks>0?(M.failed/M.attacks*100).toFixed(0):"0",C=r.attacks-r.failed,O=C-r.crits,z=O>0?Math.round(r.normalDmg/O):0;r.crits>0&&Math.round(r.critDmg/r.crits);const I=C>0?(r.crits/C*100).toFixed(1):"0",s=e=>e===0?"":e.toLocaleString();return t.jsxs(L,{id:c,title:`Combat: ${a}`,zIndex:x,width:640,height:520,children:[t.jsxs("div",{style:{display:"flex",gap:4,padding:"4px 8px",borderBottom:"1px solid #333",alignItems:"center"},children:[t.jsx("button",{className:`ml-stats-range-btn ${f==="session"?"active":""}`,onClick:()=>k("session"),children:"Session"}),t.jsx("button",{className:`ml-stats-range-btn ${f==="lifetime"?"active":""}`,onClick:()=>k("lifetime"),children:"Lifetime"}),t.jsx("div",{style:{flex:1}}),f==="session"&&t.jsx("button",{style:{fontSize:"0.6rem",padding:"2px 8px",background:"rgba(204,68,68,0.15)",color:"#c66",border:"1px solid rgba(204,68,68,0.3)",borderRadius:3,cursor:"pointer"},onClick:()=>{confirm("Clear current session stats?")&&m(e=>e&&{...e,session:{total_damage_given:0,total_damage_received:0,total_kills:0,total_aetheria_surges:0,total_cloak_surges:0,monsters:{}}})},children:"Clear Session"})]}),t.jsxs("div",{style:{display:"flex",flex:1,overflow:"hidden"},children:[t.jsxs("div",{style:{width:240,borderRight:"1px solid #333",overflowY:"auto",fontSize:"0.72rem"},children:[t.jsxs("div",{style:{display:"flex",padding:"3px 6px",borderBottom:"1px solid #333",color:"#777",fontSize:"0.65rem",fontWeight:600},children:[t.jsx("span",{style:{width:14}}),t.jsx("span",{style:{flex:1},children:"Monster"}),t.jsx("span",{style:{width:40,textAlign:"right"},children:"Kills"}),t.jsx("span",{style:{width:55,textAlign:"right"},children:"Dmg"})]}),t.jsxs("div",{style:{display:"flex",padding:"3px 6px",cursor:"pointer",background:h===null?"#2a3a4a":"",borderBottom:"1px solid #222",color:"#ddd"},onClick:()=>R(null),children:[t.jsx("span",{style:{width:14,color:"#888"},children:h===null?"*":""}),t.jsx("span",{style:{flex:1},children:"All"}),t.jsx("span",{style:{width:40,textAlign:"right"},children:s((p==null?void 0:p.total_kills)??0)}),t.jsx("span",{style:{width:55,textAlign:"right"},children:s((p==null?void 0:p.total_damage_given)??0)})]}),S.map(e=>{const l=j[e];return t.jsxs("div",{style:{display:"flex",padding:"2px 6px",cursor:"pointer",background:h===e?"#2a3a4a":"",borderBottom:"1px solid #1a1a1a",color:"#ccc"},onClick:()=>R(e),children:[t.jsx("span",{style:{width:14,color:"#888"},children:h===e?"*":""}),t.jsx("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e}),t.jsx("span",{style:{width:40,textAlign:"right"},children:s(l.kill_count)}),t.jsx("span",{style:{width:55,textAlign:"right"},children:s(l.damage_given)})]},e)})]}),t.jsx("div",{style:{flex:1,overflowY:"auto",padding:6,fontSize:"0.72rem"},children:t.jsxs("table",{style:{width:"100%",borderCollapse:"collapse"},children:[t.jsx("thead",{children:t.jsxs("tr",{style:{color:"#777",fontSize:"0.65rem"},children:[t.jsx("th",{style:{textAlign:"left",padding:"1px 4px"}}),t.jsx("th",{style:{textAlign:"right",padding:"1px 3px"},children:"Given M/M"}),t.jsx("th",{style:{textAlign:"right",padding:"1px 3px"},children:"Given Mag"}),t.jsx("th",{style:{width:4}}),t.jsx("th",{style:{textAlign:"right",padding:"1px 3px"},children:"Recv M/M"}),t.jsx("th",{style:{textAlign:"right",padding:"1px 3px"},children:"Recv Mag"}),t.jsx("th",{style:{width:4}}),t.jsx("th",{style:{textAlign:"left",padding:"1px 3px"},children:"Stats"}),t.jsx("th",{style:{textAlign:"right",padding:"1px 3px"}})]})}),t.jsxs("tbody",{children:[w.map((e,l)=>{const v=[["Evades",b.attacks>0?`${s(b.attacks)} (${N}%)`:""],["Resists",M.attacks>0?`${s(M.attacks)} (${W}%)`:""],["A.Surges",n.aeth>0?`${s(n.aeth)}`:""],["C.Surges",n.cloak>0?`${s(n.cloak)}`:""],["",""],["",""],["Av/Mx",z>0?`${s(z)} / ${s(r.maxNormal)}`:""],["Crits",r.crits>0?`${s(r.crits)} (${I}%)`:""]][l]??["",""];return t.jsxs("tr",{children:[t.jsx("td",{style:{padding:"1px 4px",color:"#888"},children:e}),t.jsx("td",{style:{textAlign:"right",padding:"1px 3px",color:"#ccc"},children:s(_(n.offense,"MeleeMissile",e))}),t.jsx("td",{style:{textAlign:"right",padding:"1px 3px",color:"#ccc"},children:s(_(n.offense,"Magic",e))}),t.jsx("td",{}),t.jsx("td",{style:{textAlign:"right",padding:"1px 3px",color:"#ccc"},children:s(_(n.defense,"MeleeMissile",e))}),t.jsx("td",{style:{textAlign:"right",padding:"1px 3px",color:"#ccc"},children:s(_(n.defense,"Magic",e))}),t.jsx("td",{}),t.jsx("td",{style:{padding:"1px 3px",color:"#777",fontWeight:600,fontSize:"0.65rem"},children:v[0]}),t.jsx("td",{style:{textAlign:"right",padding:"1px 3px",color:"#ccc"},children:v[1]})]},e)}),t.jsx("tr",{children:t.jsx("td",{colSpan:9,style:{height:4}})}),t.jsxs("tr",{children:[t.jsx("td",{style:{padding:"1px 4px",color:"#888",fontWeight:600},children:"Total"}),t.jsx("td",{style:{textAlign:"right",padding:"1px 3px",color:"#ccc"},children:s(w.reduce((e,l)=>e+_(n.offense,"MeleeMissile",l),0))}),t.jsx("td",{style:{textAlign:"right",padding:"1px 3px",color:"#ccc"},children:s(w.reduce((e,l)=>e+_(n.offense,"Magic",l),0))}),t.jsx("td",{}),t.jsx("td",{style:{textAlign:"right",padding:"1px 3px",color:"#ccc"},children:s(w.reduce((e,l)=>e+_(n.defense,"MeleeMissile",l),0))}),t.jsx("td",{style:{textAlign:"right",padding:"1px 3px",color:"#ccc"},children:s(w.reduce((e,l)=>e+_(n.defense,"Magic",l),0))}),t.jsx("td",{}),t.jsx("td",{style:{padding:"1px 3px",color:"#777",fontWeight:600,fontSize:"0.65rem"},children:"Total"}),t.jsx("td",{style:{textAlign:"right",padding:"1px 3px",color:"#ccc"},children:s(r.normalDmg+r.critDmg)})]})]})]})})]})]})};export{Y as CombatStatsWindow}; +import{r as A,a as B,j as t,D as L}from"./index-Dg_ifawe.js";import"./react-yfL0ty4i.js";const w=["Typeless","Slash","Pierce","Bludgeon","Fire","Cold","Acid","Electric"];function _(c,a,x){var o,m,f,k;return(((m=(o=c==null?void 0:c[a])==null?void 0:o[x])==null?void 0:m.total_normal_damage)??0)+(((k=(f=c==null?void 0:c[a])==null?void 0:f[x])==null?void 0:k.total_crit_damage)??0)}function G(c){let a={attacks:0,failed:0,crits:0,normalDmg:0,maxNormal:0,critDmg:0,maxCrit:0};if(!c)return a;for(const x of Object.values(c))for(const o of Object.values(x))a.attacks+=o.total_attacks??0,a.failed+=o.failed_attacks??0,a.crits+=o.crits??0,a.normalDmg+=o.total_normal_damage??0,a.maxNormal=Math.max(a.maxNormal,o.max_normal_damage??0),a.critDmg+=o.total_crit_damage??0,a.maxCrit=Math.max(a.maxCrit,o.max_crit_damage??0);return a}function F(c,a){let x={attacks:0,failed:0};const o=c==null?void 0:c[a];if(!o)return x;for(const m of Object.values(o))x.attacks+=m.total_attacks??0,x.failed+=m.failed_attacks??0;return x}const Y=({id:c,charName:a,zIndex:x})=>{const[o,m]=A.useState(null),[f,k]=A.useState("session"),[h,R]=A.useState(null);A.useEffect(()=>{B(`/combat-stats/${encodeURIComponent(a)}`).then(m).catch(()=>{});const e=setInterval(()=>{B(`/combat-stats/${encodeURIComponent(a)}`).then(m).catch(()=>{})},1e4);return()=>clearInterval(e)},[a]);const p=o==null?void 0:o[f],j=(p==null?void 0:p.monsters)??{},S=Object.keys(j).filter(e=>e!=="__cloak_surges__").sort(),n=A.useMemo(()=>{let e={},l={},v=0,$=0;const T=h?[j[h]].filter(Boolean):S.map(u=>j[u]);for(const u of T)if(u){for(const[g,D]of Object.entries(u.offense??{})){e[g]||(e[g]={});for(const[y,E]of Object.entries(D)){e[g][y]||(e[g][y]={total_attacks:0,failed_attacks:0,crits:0,total_normal_damage:0,max_normal_damage:0,total_crit_damage:0,max_crit_damage:0});const i=e[g][y],d=E;i.total_attacks+=d.total_attacks??0,i.failed_attacks+=d.failed_attacks??0,i.crits+=d.crits??0,i.total_normal_damage+=d.total_normal_damage??0,i.max_normal_damage=Math.max(i.max_normal_damage,d.max_normal_damage??0),i.total_crit_damage+=d.total_crit_damage??0,i.max_crit_damage=Math.max(i.max_crit_damage,d.max_crit_damage??0)}}for(const[g,D]of Object.entries(u.defense??{})){l[g]||(l[g]={});for(const[y,E]of Object.entries(D)){l[g][y]||(l[g][y]={total_attacks:0,failed_attacks:0,crits:0,total_normal_damage:0,max_normal_damage:0,total_crit_damage:0,max_crit_damage:0});const i=l[g][y],d=E;i.total_attacks+=d.total_attacks??0,i.failed_attacks+=d.failed_attacks??0,i.total_normal_damage+=d.total_normal_damage??0,i.max_normal_damage=Math.max(i.max_normal_damage,d.max_normal_damage??0),i.total_crit_damage+=d.total_crit_damage??0,i.max_crit_damage=Math.max(i.max_crit_damage,d.max_crit_damage??0)}}v+=u.aetheria_surges??0,$+=u.cloak_surges??0}return j.__cloak_surges__&&!h&&($+=j.__cloak_surges__.cloak_surges??0),{offense:e,defense:l,aeth:v,cloak:$}},[j,S,h]),r=G(n.offense),b=F(n.defense,"MeleeMissile"),M=F(n.defense,"Magic");r.attacks>0&&((r.attacks-r.failed)/r.attacks*100).toFixed(0);const N=b.attacks>0?(b.failed/b.attacks*100).toFixed(0):"0",W=M.attacks>0?(M.failed/M.attacks*100).toFixed(0):"0",C=r.attacks-r.failed,O=C-r.crits,z=O>0?Math.round(r.normalDmg/O):0;r.crits>0&&Math.round(r.critDmg/r.crits);const I=C>0?(r.crits/C*100).toFixed(1):"0",s=e=>e===0?"":e.toLocaleString();return t.jsxs(L,{id:c,title:`Combat: ${a}`,zIndex:x,width:640,height:520,children:[t.jsxs("div",{style:{display:"flex",gap:4,padding:"4px 8px",borderBottom:"1px solid #333",alignItems:"center"},children:[t.jsx("button",{className:`ml-stats-range-btn ${f==="session"?"active":""}`,onClick:()=>k("session"),children:"Session"}),t.jsx("button",{className:`ml-stats-range-btn ${f==="lifetime"?"active":""}`,onClick:()=>k("lifetime"),children:"Lifetime"}),t.jsx("div",{style:{flex:1}}),f==="session"&&t.jsx("button",{style:{fontSize:"0.6rem",padding:"2px 8px",background:"rgba(204,68,68,0.15)",color:"#c66",border:"1px solid rgba(204,68,68,0.3)",borderRadius:3,cursor:"pointer"},onClick:()=>{confirm("Clear current session stats?")&&m(e=>e&&{...e,session:{total_damage_given:0,total_damage_received:0,total_kills:0,total_aetheria_surges:0,total_cloak_surges:0,monsters:{}}})},children:"Clear Session"})]}),t.jsxs("div",{style:{display:"flex",flex:1,overflow:"hidden"},children:[t.jsxs("div",{style:{width:240,borderRight:"1px solid #333",overflowY:"auto",fontSize:"0.72rem"},children:[t.jsxs("div",{style:{display:"flex",padding:"3px 6px",borderBottom:"1px solid #333",color:"#777",fontSize:"0.65rem",fontWeight:600},children:[t.jsx("span",{style:{width:14}}),t.jsx("span",{style:{flex:1},children:"Monster"}),t.jsx("span",{style:{width:40,textAlign:"right"},children:"Kills"}),t.jsx("span",{style:{width:55,textAlign:"right"},children:"Dmg"})]}),t.jsxs("div",{style:{display:"flex",padding:"3px 6px",cursor:"pointer",background:h===null?"#2a3a4a":"",borderBottom:"1px solid #222",color:"#ddd"},onClick:()=>R(null),children:[t.jsx("span",{style:{width:14,color:"#888"},children:h===null?"*":""}),t.jsx("span",{style:{flex:1},children:"All"}),t.jsx("span",{style:{width:40,textAlign:"right"},children:s((p==null?void 0:p.total_kills)??0)}),t.jsx("span",{style:{width:55,textAlign:"right"},children:s((p==null?void 0:p.total_damage_given)??0)})]}),S.map(e=>{const l=j[e];return t.jsxs("div",{style:{display:"flex",padding:"2px 6px",cursor:"pointer",background:h===e?"#2a3a4a":"",borderBottom:"1px solid #1a1a1a",color:"#ccc"},onClick:()=>R(e),children:[t.jsx("span",{style:{width:14,color:"#888"},children:h===e?"*":""}),t.jsx("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e}),t.jsx("span",{style:{width:40,textAlign:"right"},children:s(l.kill_count)}),t.jsx("span",{style:{width:55,textAlign:"right"},children:s(l.damage_given)})]},e)})]}),t.jsx("div",{style:{flex:1,overflowY:"auto",padding:6,fontSize:"0.72rem"},children:t.jsxs("table",{style:{width:"100%",borderCollapse:"collapse"},children:[t.jsx("thead",{children:t.jsxs("tr",{style:{color:"#777",fontSize:"0.65rem"},children:[t.jsx("th",{style:{textAlign:"left",padding:"1px 4px"}}),t.jsx("th",{style:{textAlign:"right",padding:"1px 3px"},children:"Given M/M"}),t.jsx("th",{style:{textAlign:"right",padding:"1px 3px"},children:"Given Mag"}),t.jsx("th",{style:{width:4}}),t.jsx("th",{style:{textAlign:"right",padding:"1px 3px"},children:"Recv M/M"}),t.jsx("th",{style:{textAlign:"right",padding:"1px 3px"},children:"Recv Mag"}),t.jsx("th",{style:{width:4}}),t.jsx("th",{style:{textAlign:"left",padding:"1px 3px"},children:"Stats"}),t.jsx("th",{style:{textAlign:"right",padding:"1px 3px"}})]})}),t.jsxs("tbody",{children:[w.map((e,l)=>{const v=[["Evades",b.attacks>0?`${s(b.attacks)} (${N}%)`:""],["Resists",M.attacks>0?`${s(M.attacks)} (${W}%)`:""],["A.Surges",n.aeth>0?`${s(n.aeth)}`:""],["C.Surges",n.cloak>0?`${s(n.cloak)}`:""],["",""],["",""],["Av/Mx",z>0?`${s(z)} / ${s(r.maxNormal)}`:""],["Crits",r.crits>0?`${s(r.crits)} (${I}%)`:""]][l]??["",""];return t.jsxs("tr",{children:[t.jsx("td",{style:{padding:"1px 4px",color:"#888"},children:e}),t.jsx("td",{style:{textAlign:"right",padding:"1px 3px",color:"#ccc"},children:s(_(n.offense,"MeleeMissile",e))}),t.jsx("td",{style:{textAlign:"right",padding:"1px 3px",color:"#ccc"},children:s(_(n.offense,"Magic",e))}),t.jsx("td",{}),t.jsx("td",{style:{textAlign:"right",padding:"1px 3px",color:"#ccc"},children:s(_(n.defense,"MeleeMissile",e))}),t.jsx("td",{style:{textAlign:"right",padding:"1px 3px",color:"#ccc"},children:s(_(n.defense,"Magic",e))}),t.jsx("td",{}),t.jsx("td",{style:{padding:"1px 3px",color:"#777",fontWeight:600,fontSize:"0.65rem"},children:v[0]}),t.jsx("td",{style:{textAlign:"right",padding:"1px 3px",color:"#ccc"},children:v[1]})]},e)}),t.jsx("tr",{children:t.jsx("td",{colSpan:9,style:{height:4}})}),t.jsxs("tr",{children:[t.jsx("td",{style:{padding:"1px 4px",color:"#888",fontWeight:600},children:"Total"}),t.jsx("td",{style:{textAlign:"right",padding:"1px 3px",color:"#ccc"},children:s(w.reduce((e,l)=>e+_(n.offense,"MeleeMissile",l),0))}),t.jsx("td",{style:{textAlign:"right",padding:"1px 3px",color:"#ccc"},children:s(w.reduce((e,l)=>e+_(n.offense,"Magic",l),0))}),t.jsx("td",{}),t.jsx("td",{style:{textAlign:"right",padding:"1px 3px",color:"#ccc"},children:s(w.reduce((e,l)=>e+_(n.defense,"MeleeMissile",l),0))}),t.jsx("td",{style:{textAlign:"right",padding:"1px 3px",color:"#ccc"},children:s(w.reduce((e,l)=>e+_(n.defense,"Magic",l),0))}),t.jsx("td",{}),t.jsx("td",{style:{padding:"1px 3px",color:"#777",fontWeight:600,fontSize:"0.65rem"},children:"Total"}),t.jsx("td",{style:{textAlign:"right",padding:"1px 3px",color:"#ccc"},children:s(r.normalDmg+r.critDmg)})]})]})]})})]})]})};export{Y as CombatStatsWindow}; diff --git a/static/assets/InventoryWindow-Dry2xriW.js b/static/assets/InventoryWindow-tZ7lQtZ6.js similarity index 99% rename from static/assets/InventoryWindow-Dry2xriW.js rename to static/assets/InventoryWindow-tZ7lQtZ6.js index fd6d0eb3..ced233d7 100644 --- a/static/assets/InventoryWindow-Dry2xriW.js +++ b/static/assets/InventoryWindow-tZ7lQtZ6.js @@ -1 +1 @@ -import{r as _,a as T,j as n,D as Q}from"./index-YQnl0KV7.js";import"./react-yfL0ty4i.js";function X(e){var s,d;if(!e)return e;const o=c=>c!=null&&c!==-1&&c!==-1?c:void 0,r=e.IntValues||{};return{item_id:e.item_id??e.Id??0,name:e.name??e.Name??((s=e.StringValues)==null?void 0:s["1"])??"Unknown",icon:e.icon??e.Icon??0,object_class:e.object_class??e.ObjectClass??0,current_wielded_location:e.current_wielded_location??o(e.CurrentWieldedLocation)??o(Number(r[10]))??0,container_id:e.container_id??e.ContainerId??0,items_capacity:e.items_capacity??o(e.ItemsCapacity)??o(Number(r[6]))??((d=e.enhanced_properties)==null?void 0:d.ItemSlots_Decal)??void 0,value:e.value??o(e.Value)??o(Number(r[19]))??0,burden:e.burden??o(e.Burden)??o(Number(r[5]))??0,armor_level:e.armor_level??o(e.ArmorLevel),max_damage:e.max_damage??o(e.MaxDamage),material:e.material??e.material_name??e.Material??void 0,item_set:e.item_set??e.ItemSet??void 0,imbue:e.imbue??e.Imbue??void 0,tinks:e.tinks??o(e.Tinks),workmanship:e.workmanship??o(e.Workmanship),equip_skill:e.equip_skill??e.equip_skill_name??e.EquipSkill??void 0,wield_level:e.wield_level??o(e.WieldLevel),skill_level:e.skill_level??o(e.SkillLevel),lore_requirement:e.lore_requirement??o(e.LoreRequirement),attack_bonus:e.attack_bonus??o(e.AttackBonus),melee_defense_bonus:e.melee_defense_bonus??o(e.MeleeDefenseBonus),magic_defense_bonus:e.magic_defense_bonus??o(e.MagicDBonus),damage_bonus:e.damage_bonus??o(e.DamageBonus),damage_rating:e.damage_rating??o(e.DamRating),crit_rating:e.crit_rating??o(e.CritRating),heal_boost_rating:e.heal_boost_rating??o(e.HealBoostRating),current_mana:e.current_mana??o(Number(r[218103815]))??void 0,max_mana:e.max_mana??o(Number(r[218103814]))??void 0,spellcraft:e.spellcraft??void 0,damage_range:e.damage_range??void 0,damage_type:e.damage_type??void 0,speed_text:e.speed_text??void 0,mana_display:e.mana_display??void 0,spells:e.spells??void 0,icon_overlay_id:e.icon_overlay_id??o(Number(r[218103849]))??void 0,icon_underlay_id:e.icon_underlay_id??o(Number(r[218103850]))??void 0,_raw:e}}function D(e){return!e||e<=0?"06000133":(e+100663296).toString(16).toUpperCase().padStart(8,"0")}const M={32768:{name:"Neck",row:1,col:1},1:{name:"Head",row:1,col:3},268435456:{name:"Sigil",row:1,col:5},536870912:{name:"Sigil",row:1,col:6},1073741824:{name:"Sigil",row:1,col:7},67108864:{name:"Trinket",row:2,col:1},2048:{name:"U.Arm",row:2,col:2},512:{name:"Chest",row:2,col:3},134217728:{name:"Cloak",row:2,col:7},65536:{name:"Brace L",row:3,col:1},4096:{name:"L.Arm",row:3,col:2},1024:{name:"Abdomen",row:3,col:3},8192:{name:"U.Leg",row:3,col:4},131072:{name:"Brace R",row:3,col:5},2:{name:"Shirt",row:3,col:7},262144:{name:"Ring L",row:4,col:1},32:{name:"Hands",row:4,col:2},16384:{name:"L.Leg",row:4,col:4},524288:{name:"Ring R",row:4,col:5},4:{name:"Pants",row:4,col:7},256:{name:"Feet",row:5,col:4},2097152:{name:"Shield",row:6,col:1},1048576:{name:"Melee",row:6,col:3},4194304:{name:"Missile",row:6,col:3},16777216:{name:"Held",row:6,col:3},33554432:{name:"2H",row:6,col:3},8388608:{name:"Ammo",row:6,col:7}},I={},ne=[32768,67108864,65536,131072,262144,524288],oe=[1,512,2048,1024,4096,8192,16384,32,256],te=[2,4,134217728,268435456,536870912,1073741824],ie=[2097152,1048576,4194304,16777216,33554432,8388608];(()=>{const e=new Set;Object.entries(M).forEach(([o,r])=>{const s=`${r.row}-${r.col}`,d=parseInt(o);e.has(s)||(e.add(s),ne.includes(d)?I[s]="#3a2555":oe.includes(d)?I[s]="#1e2e55":te.includes(d)?I[s]="#1e3e3e":ie.includes(d)?I[s]="#142040":I[s]="#2a2a2a")})})();const $="#af7a30";function W({item:e,size:o=36}){const r={position:"absolute",top:0,left:0,width:o,height:o,border:"none",background:"transparent",imageRendering:"pixelated"},s=e.icon_underlay_id&&e.icon_underlay_id>100?`/icons/${D(e.icon_underlay_id)}.png`:null,d=e.icon_overlay_id&&e.icon_overlay_id>100?`/icons/${D(e.icon_overlay_id)}.png`:null;return n.jsxs("div",{style:{width:o,height:o,position:"relative"},children:[s&&n.jsx("img",{src:s,alt:"",style:{...r,zIndex:1},onError:c=>{c.target.style.display="none"}}),n.jsx("img",{src:`/icons/${D(e.icon)}.png`,alt:e.name,style:{...r,zIndex:2},onError:c=>{c.target.src="/icons/06000133.png"}}),d&&n.jsx("img",{src:d,alt:"",style:{...r,zIndex:3},onError:c=>{c.target.style.display="none"}})]})}function le({item:e,x:o,y:r}){var j,L;const s=g=>g!=null&&g!==-1&&g!==-1,d=g=>g.toLocaleString(),c=g=>`${((g-1)*100).toFixed(1)}%`;return n.jsxs("div",{style:{position:"fixed",left:o+14,top:r+14,background:"rgba(0,0,0,0.96)",border:"1px solid #555",borderRadius:4,padding:"8px 12px",zIndex:99999,minWidth:200,maxWidth:340,fontSize:13,color:"#ddd",pointerEvents:"none",lineHeight:1.6,fontFamily:'-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,sans-serif'},children:[n.jsx("div",{style:{color:"#ffcc00",fontWeight:"bold",fontSize:14,marginBottom:4},children:e.name}),n.jsxs("div",{style:{color:"#aaa"},children:["Value: ",d(e.value)," · Burden: ",e.burden]}),e.workmanship&&n.jsxs("div",{style:{color:"#aaa"},children:["Workmanship: ",e.workmanship]}),e.material&&n.jsxs("div",{style:{color:"#88ff88"},children:["Material: ",e.material]}),s(e.armor_level)&&n.jsxs("div",{style:{color:"#88ff88"},children:["Armor Level: ",e.armor_level]}),s(e.max_damage)&&n.jsxs("div",{style:{color:"#88ff88"},children:["Max Damage: ",e.max_damage]}),e.damage_range&&n.jsxs("div",{style:{color:"#88ff88"},children:["Damage: ",e.damage_range,e.damage_type?`, ${e.damage_type}`:""]}),s(e.attack_bonus)&&e.attack_bonus!==1&&n.jsxs("div",{style:{color:"#88ff88"},children:["Attack: +",c(e.attack_bonus)]}),s(e.melee_defense_bonus)&&e.melee_defense_bonus!==1&&n.jsxs("div",{style:{color:"#88ff88"},children:["Melee Def: +",c(e.melee_defense_bonus)]}),s(e.magic_defense_bonus)&&e.magic_defense_bonus!==1&&n.jsxs("div",{style:{color:"#88ff88"},children:["Magic Def: +",c(e.magic_defense_bonus)]}),e.equip_skill&&n.jsxs("div",{style:{color:"#ddd"},children:["Skill: ",e.equip_skill]}),s(e.wield_level)&&n.jsxs("div",{style:{color:"#ffaa00"},children:["Wield Level: ",e.wield_level]}),s(e.lore_requirement)&&n.jsxs("div",{style:{color:"#ffaa00"},children:["Lore: ",e.lore_requirement]}),e.imbue&&n.jsxs("div",{style:{color:"#88ff88"},children:["Imbue: ",e.imbue]}),e.item_set&&n.jsxs("div",{style:{color:"#88ff88"},children:["Set: ",e.item_set]}),s(e.tinks)&&n.jsxs("div",{style:{color:"#88ff88"},children:["Tinks: ",e.tinks]}),s(e.damage_rating)&&n.jsxs("div",{children:["Damage Rating: ",e.damage_rating]}),s(e.crit_rating)&&n.jsxs("div",{children:["Crit Rating: ",e.crit_rating]}),s(e.heal_boost_rating)&&n.jsxs("div",{children:["Heal Boost: ",e.heal_boost_rating]}),e.spellcraft&&n.jsxs("div",{style:{color:"#dda0dd"},children:["Spellcraft: ",e.spellcraft]}),s(e.current_mana)&&s(e.max_mana)&&n.jsxs("div",{style:{color:"#98d7ff"},children:["Mana: ",e.current_mana," / ",e.max_mana]}),((L=(j=e.spells)==null?void 0:j.spells)==null?void 0:L.length)>0&&n.jsxs("div",{style:{color:"#4a90e2",marginTop:4,fontSize:12},children:["Spells: ",e.spells.spells.map(g=>g.name).join(", ")]})]})}function G({iconSrc:e,isActive:o,fillPct:r,label:s,onClick:d}){const c=r>90?"#b7432c":r>70?"#d8a431":"#00ff00";return n.jsxs("div",{onClick:d,title:s,style:{display:"flex",alignItems:"flex-start",gap:2,cursor:"pointer",flexShrink:0,marginTop:3,position:"relative"},children:[o&&n.jsx("span",{style:{position:"absolute",left:-11,top:8,color:$,fontSize:10},children:"▶"}),n.jsx("div",{style:{width:30,height:30,border:o?"1px solid #00ff00":"1px solid #333",boxShadow:o?"0 0 4px #00ff00":"none",background:"#000",display:"flex",alignItems:"center",justifyContent:"center"},children:n.jsx("img",{src:e,alt:"",style:{width:26,height:26,objectFit:"contain",imageRendering:"pixelated"},onError:j=>{j.target.src="/icons/06001080.png"}})}),n.jsx("div",{style:{width:7,height:30,background:"#222",border:"1px solid #666",position:"relative",overflow:"hidden",borderRadius:2},title:`${Math.round(r)}% full`,children:n.jsx("div",{style:{position:"absolute",bottom:0,left:0,right:0,height:`${r}%`,background:c,minHeight:r>0?2:0}})})]})}const ce=({id:e,charName:o,zIndex:r,inventoryVersion:s,equipmentCantrips:d})=>{var V,q,Y;const[c,j]=_.useState([]),[L,g]=_.useState(!0),[k,H]=_.useState(null),[B,U]=_.useState(null),[f,J]=_.useState(null),C=_.useRef(0),O=_.useRef(!1);_.useEffect(()=>{g(!0),Promise.all([T(`/inventory/${encodeURIComponent(o)}?limit=1000`).catch(()=>({items:[]})),T(`/character-stats/${encodeURIComponent(o)}`).catch(()=>null)]).then(([t,i])=>{j((t.items??[]).map(X)),J(i),O.current=!0}).finally(()=>g(!1))},[o]),_.useEffect(()=>{if(!(!O.current||!s))return clearTimeout(C.current),C.current=window.setTimeout(()=>{T(`/inventory/${encodeURIComponent(o)}?limit=1000&_t=${Date.now()}`).then(t=>j((t.items??[]).map(X))).catch(()=>{})},2e3),()=>clearTimeout(C.current)},[o,s]);const y=_.useCallback((t,i)=>{U(t&&i?{item:t,x:i.clientX,y:i.clientY}:null)},[]),Z=_.useMemo(()=>{const t=new Set,i=[];return Object.entries(M).forEach(([u,m])=>{const a=`${m.row}-${m.col}`;t.has(a)||(t.add(a),i.push({key:a,...m,mask:parseInt(u)}))}),i},[]),{equippedMap:A,containers:z,packItems:w}=_.useMemo(()=>{const t=new Map,i=[],u=new Set,m=new Map;c.forEach(l=>{l.object_class===10&&(i.push(l),u.add(l.item_id))}),i.sort((l,h)=>(l.item_id>>>0)-(h.item_id>>>0));let a=null;return c.forEach(l=>{l.current_wielded_location>0&&l.container_id&&!u.has(l.container_id)&&(a=l.container_id)}),c.forEach(l=>{if(u.has(l.item_id))return;const h=l.current_wielded_location;if(h>0)if(l.object_class===2)Object.entries(M).forEach(([b,x])=>{if((h&parseInt(b))===parseInt(b)){const v=`${x.row}-${x.col}`;t.has(v)||t.set(v,l)}});else{let b=!1;if(M[h]){const x=M[h],v=`${x.row}-${x.col}`;t.has(v)||(t.set(v,l),b=!0)}if(!b){for(const[x,v]of Object.entries(M))if((h&parseInt(x))===parseInt(x)){const K=`${v.row}-${v.col}`;if(!t.has(K)){t.set(K,l),b=!0;break}}}}else{let p=l.container_id||0;a&&p===a&&(p=0),m.has(p)||m.set(p,[]),m.get(p).push(l)}}),{equippedMap:t,containers:i,packItems:m}},[c]);let S=w.get(0)??[],F=0;if(S.length===0){let t=0;for(const[i,u]of w.entries())!z.some(m=>m.item_id===i)&&u.length>t&&(t=u.length,F=i);S=w.get(F)??[]}const P=k!==null?w.get(k)??[]:S,N=(f==null?void 0:f.burden_units)??((V=f==null?void 0:f.stats_data)==null?void 0:V.burden_units)??0,R=(f==null?void 0:f.encumbrance_capacity)??((q=f==null?void 0:f.stats_data)==null?void 0:q.encumbrance_capacity)??0,E=R>0?Math.min(200,N/R*100):0,ee=E>150?"#b7432c":E>100?"#d8a431":"#2e8b57";return L?n.jsx(Q,{id:e,title:`Inventory: ${o}`,zIndex:r,width:572,height:720,children:n.jsx("div",{style:{padding:20,color:"#666",fontStyle:"italic"},children:"Loading inventory..."})}):n.jsxs(Q,{id:e,title:`Inventory: ${o}`,zIndex:r,width:572,height:720,children:[n.jsxs("div",{style:{display:"flex",flex:1,overflow:"hidden",background:"rgba(14,14,14,0.96)",fontFamily:'-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,sans-serif',fontSize:13},children:[n.jsxs("div",{style:{width:316,display:"flex",flexDirection:"column",overflow:"hidden"},children:[n.jsx("div",{style:{position:"relative",height:270,minHeight:270,background:"#0a0a0a",borderBottom:`1px solid ${$}`},children:Z.map(t=>{const i=A.get(t.key),u=I[t.key]??"#2a2a2a";return n.jsx("div",{style:{position:"absolute",left:(t.col-1)*44+4,top:(t.row-1)*44+4,width:36,height:36,background:i?"#5a5a62":u,border:i?"2px solid #00ffff":"2px outset #6a6a72",boxShadow:i?"0 0 5px #00ffff, inset 0 0 5px rgba(0,255,255,0.2)":"none",display:"flex",alignItems:"center",justifyContent:"center",cursor:i?"pointer":"default"},onMouseEnter:m=>i&&y(i,m),onMouseMove:m=>i&&y(i,m),onMouseLeave:()=>y(null),children:i?n.jsx(W,{item:i,size:32}):n.jsx("img",{src:"/icons/06000133.png",alt:"",style:{width:28,height:28,opacity:.15,filter:"grayscale(100%)",imageRendering:"pixelated"}})},t.key)})}),n.jsxs("div",{style:{padding:"3px 6px",fontSize:11,color:"#ccc",background:"#111",borderBottom:`1px solid ${$}`},children:["Contents of ",k!==null?((Y=z.find(t=>t.item_id===k))==null?void 0:Y.name)??"Pack":"Backpack"]}),n.jsxs("div",{style:{flex:1,overflowY:"auto",display:"grid",gridTemplateColumns:"repeat(6, 36px)",gridAutoRows:36,gap:2,padding:4,alignContent:"start"},children:[P.map((t,i)=>n.jsx("div",{style:{width:36,height:36,background:"linear-gradient(135deg, #3d007a 0%, #1a0033 100%)",border:"1px solid #4a148c",display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer"},onMouseEnter:u=>y(t,u),onMouseMove:u=>y(t,u),onMouseLeave:()=>y(null),children:n.jsx(W,{item:t,size:32})},t.item_id??i)),Array.from({length:Math.max(0,24-P.length)}).map((t,i)=>n.jsx("div",{style:{width:36,height:36,background:"#0a0a0a",border:"1px solid #1a1a1a"}},`e${i}`))]})]}),n.jsxs("div",{style:{width:42,display:"flex",flexDirection:"column",alignItems:"center",padding:"4px 2px",borderLeft:`1px solid ${$}`,borderRight:`1px solid ${$}`},children:[n.jsx("div",{style:{textAlign:"center",fontSize:8,color:"#ccc",marginBottom:2},children:R>0?`${Math.floor(E)}%`:"Burden"}),n.jsx("div",{style:{width:14,height:40,background:"#111",border:"1px solid #555",position:"relative",overflow:"hidden",marginBottom:6,flexShrink:0},title:R>0?`${N.toLocaleString()} / ${R.toLocaleString()}`:`Burden: ${c.reduce((t,i)=>t+(i.burden??0),0).toLocaleString()}`,children:n.jsx("div",{style:{position:"absolute",bottom:0,left:0,right:0,height:`${E/2}%`,background:ee,transition:"height 0.3s"}})}),n.jsx(G,{iconSrc:"/icons/0600127E.png",isActive:k===null,fillPct:S.length>0?Math.min(100,S.length/102*100):0,label:`Backpack (${S.length}/102)`,onClick:()=>H(null)}),z.map(t=>{const i=t.item_id,u=c.filter(l=>l.container_id===i&&l.item_id!==i).length,m=t.items_capacity||24,a=m>0?Math.min(100,u/m*100):0;return n.jsx(G,{iconSrc:`/icons/${D(t.icon)}.png`,isActive:k===i,fillPct:a,label:`${t.name} (${u}/${m})`,onClick:()=>H(i)},i)})]}),n.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",overflow:"hidden",minWidth:160},children:[n.jsx("div",{style:{padding:"4px 8px",fontSize:"0.72rem",fontWeight:600,color:"#aaa",background:"#111",borderBottom:`1px solid ${$}`},children:"Mana"}),n.jsxs("div",{style:{flex:1,overflowY:"auto",padding:"2px 0"},children:[(()=>{const t=(d==null?void 0:d.items)??[],i=new Map(t.map(a=>[a.item_id,a])),u=d!=null&&d.timestamp?new Date(d.timestamp).getTime():0,m=u>0?Math.max(0,(Date.now()-u)/1e3):0;return Array.from(A.values()).map(a=>{const l=i.get(a.item_id),h=(l==null?void 0:l.current_mana)??a.current_mana??0,p=(l==null?void 0:l.max_mana)??a.max_mana??0,b=(l==null?void 0:l.mana_time_remaining_seconds)??null,x=b!=null?Math.max(0,b-m):null,v=(l==null?void 0:l.state)??(h>0?"active":"not_active");return{...a,current_mana:h,max_mana:p,liveRemaining:x,manaState:v}}).filter(a=>a.current_mana>0||a.max_mana>0).sort((a,l)=>(a.liveRemaining??999999)-(l.liveRemaining??999999)).map((a,l)=>{const h=a.manaState==="active"?"#4c4":a.manaState==="not_active"?"#c44":"#da8";return n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:4,padding:"2px 4px",borderBottom:"1px solid #1a1a1a",cursor:"pointer"},onMouseEnter:p=>y(a,p),onMouseMove:p=>y(a,p),onMouseLeave:()=>y(null),children:[n.jsx("div",{style:{width:20,height:20,flexShrink:0},children:n.jsx(W,{item:a,size:20})}),n.jsx("div",{style:{width:8,height:8,borderRadius:"50%",background:h,flexShrink:0}}),n.jsx("div",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",fontSize:"0.68rem",color:"#ccc"},children:a.name}),n.jsxs("div",{style:{fontSize:"0.65rem",color:"#88bbff",whiteSpace:"nowrap",fontVariantNumeric:"tabular-nums"},children:[a.current_mana,"/",a.max_mana]}),n.jsx("div",{style:{fontSize:"0.63rem",color:"#9c9",whiteSpace:"nowrap",fontVariantNumeric:"tabular-nums",minWidth:42,textAlign:"right"},children:a.liveRemaining!=null?se(a.liveRemaining):""})]},l)})})(),Array.from(A.values()).filter(t=>t.current_mana>0||t.max_mana>0).length===0&&n.jsx("div",{style:{padding:12,color:"#555",textAlign:"center",fontSize:"0.7rem"},children:"No mana items equipped"})]})]})]}),B&&n.jsx(le,{item:B.item,x:B.x,y:B.y})]})};function se(e){if(e<=0)return"0h00m";const o=Math.floor(e),r=Math.floor(o/3600),s=Math.floor(o%3600/60);return`${r}h${String(s).padStart(2,"0")}m`}export{ce as InventoryWindow}; +import{r as _,a as T,j as n,D as Q}from"./index-Dg_ifawe.js";import"./react-yfL0ty4i.js";function X(e){var s,d;if(!e)return e;const o=c=>c!=null&&c!==-1&&c!==-1?c:void 0,r=e.IntValues||{};return{item_id:e.item_id??e.Id??0,name:e.name??e.Name??((s=e.StringValues)==null?void 0:s["1"])??"Unknown",icon:e.icon??e.Icon??0,object_class:e.object_class??e.ObjectClass??0,current_wielded_location:e.current_wielded_location??o(e.CurrentWieldedLocation)??o(Number(r[10]))??0,container_id:e.container_id??e.ContainerId??0,items_capacity:e.items_capacity??o(e.ItemsCapacity)??o(Number(r[6]))??((d=e.enhanced_properties)==null?void 0:d.ItemSlots_Decal)??void 0,value:e.value??o(e.Value)??o(Number(r[19]))??0,burden:e.burden??o(e.Burden)??o(Number(r[5]))??0,armor_level:e.armor_level??o(e.ArmorLevel),max_damage:e.max_damage??o(e.MaxDamage),material:e.material??e.material_name??e.Material??void 0,item_set:e.item_set??e.ItemSet??void 0,imbue:e.imbue??e.Imbue??void 0,tinks:e.tinks??o(e.Tinks),workmanship:e.workmanship??o(e.Workmanship),equip_skill:e.equip_skill??e.equip_skill_name??e.EquipSkill??void 0,wield_level:e.wield_level??o(e.WieldLevel),skill_level:e.skill_level??o(e.SkillLevel),lore_requirement:e.lore_requirement??o(e.LoreRequirement),attack_bonus:e.attack_bonus??o(e.AttackBonus),melee_defense_bonus:e.melee_defense_bonus??o(e.MeleeDefenseBonus),magic_defense_bonus:e.magic_defense_bonus??o(e.MagicDBonus),damage_bonus:e.damage_bonus??o(e.DamageBonus),damage_rating:e.damage_rating??o(e.DamRating),crit_rating:e.crit_rating??o(e.CritRating),heal_boost_rating:e.heal_boost_rating??o(e.HealBoostRating),current_mana:e.current_mana??o(Number(r[218103815]))??void 0,max_mana:e.max_mana??o(Number(r[218103814]))??void 0,spellcraft:e.spellcraft??void 0,damage_range:e.damage_range??void 0,damage_type:e.damage_type??void 0,speed_text:e.speed_text??void 0,mana_display:e.mana_display??void 0,spells:e.spells??void 0,icon_overlay_id:e.icon_overlay_id??o(Number(r[218103849]))??void 0,icon_underlay_id:e.icon_underlay_id??o(Number(r[218103850]))??void 0,_raw:e}}function D(e){return!e||e<=0?"06000133":(e+100663296).toString(16).toUpperCase().padStart(8,"0")}const M={32768:{name:"Neck",row:1,col:1},1:{name:"Head",row:1,col:3},268435456:{name:"Sigil",row:1,col:5},536870912:{name:"Sigil",row:1,col:6},1073741824:{name:"Sigil",row:1,col:7},67108864:{name:"Trinket",row:2,col:1},2048:{name:"U.Arm",row:2,col:2},512:{name:"Chest",row:2,col:3},134217728:{name:"Cloak",row:2,col:7},65536:{name:"Brace L",row:3,col:1},4096:{name:"L.Arm",row:3,col:2},1024:{name:"Abdomen",row:3,col:3},8192:{name:"U.Leg",row:3,col:4},131072:{name:"Brace R",row:3,col:5},2:{name:"Shirt",row:3,col:7},262144:{name:"Ring L",row:4,col:1},32:{name:"Hands",row:4,col:2},16384:{name:"L.Leg",row:4,col:4},524288:{name:"Ring R",row:4,col:5},4:{name:"Pants",row:4,col:7},256:{name:"Feet",row:5,col:4},2097152:{name:"Shield",row:6,col:1},1048576:{name:"Melee",row:6,col:3},4194304:{name:"Missile",row:6,col:3},16777216:{name:"Held",row:6,col:3},33554432:{name:"2H",row:6,col:3},8388608:{name:"Ammo",row:6,col:7}},I={},ne=[32768,67108864,65536,131072,262144,524288],oe=[1,512,2048,1024,4096,8192,16384,32,256],te=[2,4,134217728,268435456,536870912,1073741824],ie=[2097152,1048576,4194304,16777216,33554432,8388608];(()=>{const e=new Set;Object.entries(M).forEach(([o,r])=>{const s=`${r.row}-${r.col}`,d=parseInt(o);e.has(s)||(e.add(s),ne.includes(d)?I[s]="#3a2555":oe.includes(d)?I[s]="#1e2e55":te.includes(d)?I[s]="#1e3e3e":ie.includes(d)?I[s]="#142040":I[s]="#2a2a2a")})})();const $="#af7a30";function W({item:e,size:o=36}){const r={position:"absolute",top:0,left:0,width:o,height:o,border:"none",background:"transparent",imageRendering:"pixelated"},s=e.icon_underlay_id&&e.icon_underlay_id>100?`/icons/${D(e.icon_underlay_id)}.png`:null,d=e.icon_overlay_id&&e.icon_overlay_id>100?`/icons/${D(e.icon_overlay_id)}.png`:null;return n.jsxs("div",{style:{width:o,height:o,position:"relative"},children:[s&&n.jsx("img",{src:s,alt:"",style:{...r,zIndex:1},onError:c=>{c.target.style.display="none"}}),n.jsx("img",{src:`/icons/${D(e.icon)}.png`,alt:e.name,style:{...r,zIndex:2},onError:c=>{c.target.src="/icons/06000133.png"}}),d&&n.jsx("img",{src:d,alt:"",style:{...r,zIndex:3},onError:c=>{c.target.style.display="none"}})]})}function le({item:e,x:o,y:r}){var j,L;const s=g=>g!=null&&g!==-1&&g!==-1,d=g=>g.toLocaleString(),c=g=>`${((g-1)*100).toFixed(1)}%`;return n.jsxs("div",{style:{position:"fixed",left:o+14,top:r+14,background:"rgba(0,0,0,0.96)",border:"1px solid #555",borderRadius:4,padding:"8px 12px",zIndex:99999,minWidth:200,maxWidth:340,fontSize:13,color:"#ddd",pointerEvents:"none",lineHeight:1.6,fontFamily:'-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,sans-serif'},children:[n.jsx("div",{style:{color:"#ffcc00",fontWeight:"bold",fontSize:14,marginBottom:4},children:e.name}),n.jsxs("div",{style:{color:"#aaa"},children:["Value: ",d(e.value)," · Burden: ",e.burden]}),e.workmanship&&n.jsxs("div",{style:{color:"#aaa"},children:["Workmanship: ",e.workmanship]}),e.material&&n.jsxs("div",{style:{color:"#88ff88"},children:["Material: ",e.material]}),s(e.armor_level)&&n.jsxs("div",{style:{color:"#88ff88"},children:["Armor Level: ",e.armor_level]}),s(e.max_damage)&&n.jsxs("div",{style:{color:"#88ff88"},children:["Max Damage: ",e.max_damage]}),e.damage_range&&n.jsxs("div",{style:{color:"#88ff88"},children:["Damage: ",e.damage_range,e.damage_type?`, ${e.damage_type}`:""]}),s(e.attack_bonus)&&e.attack_bonus!==1&&n.jsxs("div",{style:{color:"#88ff88"},children:["Attack: +",c(e.attack_bonus)]}),s(e.melee_defense_bonus)&&e.melee_defense_bonus!==1&&n.jsxs("div",{style:{color:"#88ff88"},children:["Melee Def: +",c(e.melee_defense_bonus)]}),s(e.magic_defense_bonus)&&e.magic_defense_bonus!==1&&n.jsxs("div",{style:{color:"#88ff88"},children:["Magic Def: +",c(e.magic_defense_bonus)]}),e.equip_skill&&n.jsxs("div",{style:{color:"#ddd"},children:["Skill: ",e.equip_skill]}),s(e.wield_level)&&n.jsxs("div",{style:{color:"#ffaa00"},children:["Wield Level: ",e.wield_level]}),s(e.lore_requirement)&&n.jsxs("div",{style:{color:"#ffaa00"},children:["Lore: ",e.lore_requirement]}),e.imbue&&n.jsxs("div",{style:{color:"#88ff88"},children:["Imbue: ",e.imbue]}),e.item_set&&n.jsxs("div",{style:{color:"#88ff88"},children:["Set: ",e.item_set]}),s(e.tinks)&&n.jsxs("div",{style:{color:"#88ff88"},children:["Tinks: ",e.tinks]}),s(e.damage_rating)&&n.jsxs("div",{children:["Damage Rating: ",e.damage_rating]}),s(e.crit_rating)&&n.jsxs("div",{children:["Crit Rating: ",e.crit_rating]}),s(e.heal_boost_rating)&&n.jsxs("div",{children:["Heal Boost: ",e.heal_boost_rating]}),e.spellcraft&&n.jsxs("div",{style:{color:"#dda0dd"},children:["Spellcraft: ",e.spellcraft]}),s(e.current_mana)&&s(e.max_mana)&&n.jsxs("div",{style:{color:"#98d7ff"},children:["Mana: ",e.current_mana," / ",e.max_mana]}),((L=(j=e.spells)==null?void 0:j.spells)==null?void 0:L.length)>0&&n.jsxs("div",{style:{color:"#4a90e2",marginTop:4,fontSize:12},children:["Spells: ",e.spells.spells.map(g=>g.name).join(", ")]})]})}function G({iconSrc:e,isActive:o,fillPct:r,label:s,onClick:d}){const c=r>90?"#b7432c":r>70?"#d8a431":"#00ff00";return n.jsxs("div",{onClick:d,title:s,style:{display:"flex",alignItems:"flex-start",gap:2,cursor:"pointer",flexShrink:0,marginTop:3,position:"relative"},children:[o&&n.jsx("span",{style:{position:"absolute",left:-11,top:8,color:$,fontSize:10},children:"▶"}),n.jsx("div",{style:{width:30,height:30,border:o?"1px solid #00ff00":"1px solid #333",boxShadow:o?"0 0 4px #00ff00":"none",background:"#000",display:"flex",alignItems:"center",justifyContent:"center"},children:n.jsx("img",{src:e,alt:"",style:{width:26,height:26,objectFit:"contain",imageRendering:"pixelated"},onError:j=>{j.target.src="/icons/06001080.png"}})}),n.jsx("div",{style:{width:7,height:30,background:"#222",border:"1px solid #666",position:"relative",overflow:"hidden",borderRadius:2},title:`${Math.round(r)}% full`,children:n.jsx("div",{style:{position:"absolute",bottom:0,left:0,right:0,height:`${r}%`,background:c,minHeight:r>0?2:0}})})]})}const ce=({id:e,charName:o,zIndex:r,inventoryVersion:s,equipmentCantrips:d})=>{var V,q,Y;const[c,j]=_.useState([]),[L,g]=_.useState(!0),[k,H]=_.useState(null),[B,U]=_.useState(null),[f,J]=_.useState(null),C=_.useRef(0),O=_.useRef(!1);_.useEffect(()=>{g(!0),Promise.all([T(`/inventory/${encodeURIComponent(o)}?limit=1000`).catch(()=>({items:[]})),T(`/character-stats/${encodeURIComponent(o)}`).catch(()=>null)]).then(([t,i])=>{j((t.items??[]).map(X)),J(i),O.current=!0}).finally(()=>g(!1))},[o]),_.useEffect(()=>{if(!(!O.current||!s))return clearTimeout(C.current),C.current=window.setTimeout(()=>{T(`/inventory/${encodeURIComponent(o)}?limit=1000&_t=${Date.now()}`).then(t=>j((t.items??[]).map(X))).catch(()=>{})},2e3),()=>clearTimeout(C.current)},[o,s]);const y=_.useCallback((t,i)=>{U(t&&i?{item:t,x:i.clientX,y:i.clientY}:null)},[]),Z=_.useMemo(()=>{const t=new Set,i=[];return Object.entries(M).forEach(([u,m])=>{const a=`${m.row}-${m.col}`;t.has(a)||(t.add(a),i.push({key:a,...m,mask:parseInt(u)}))}),i},[]),{equippedMap:A,containers:z,packItems:w}=_.useMemo(()=>{const t=new Map,i=[],u=new Set,m=new Map;c.forEach(l=>{l.object_class===10&&(i.push(l),u.add(l.item_id))}),i.sort((l,h)=>(l.item_id>>>0)-(h.item_id>>>0));let a=null;return c.forEach(l=>{l.current_wielded_location>0&&l.container_id&&!u.has(l.container_id)&&(a=l.container_id)}),c.forEach(l=>{if(u.has(l.item_id))return;const h=l.current_wielded_location;if(h>0)if(l.object_class===2)Object.entries(M).forEach(([b,x])=>{if((h&parseInt(b))===parseInt(b)){const v=`${x.row}-${x.col}`;t.has(v)||t.set(v,l)}});else{let b=!1;if(M[h]){const x=M[h],v=`${x.row}-${x.col}`;t.has(v)||(t.set(v,l),b=!0)}if(!b){for(const[x,v]of Object.entries(M))if((h&parseInt(x))===parseInt(x)){const K=`${v.row}-${v.col}`;if(!t.has(K)){t.set(K,l),b=!0;break}}}}else{let p=l.container_id||0;a&&p===a&&(p=0),m.has(p)||m.set(p,[]),m.get(p).push(l)}}),{equippedMap:t,containers:i,packItems:m}},[c]);let S=w.get(0)??[],F=0;if(S.length===0){let t=0;for(const[i,u]of w.entries())!z.some(m=>m.item_id===i)&&u.length>t&&(t=u.length,F=i);S=w.get(F)??[]}const P=k!==null?w.get(k)??[]:S,N=(f==null?void 0:f.burden_units)??((V=f==null?void 0:f.stats_data)==null?void 0:V.burden_units)??0,R=(f==null?void 0:f.encumbrance_capacity)??((q=f==null?void 0:f.stats_data)==null?void 0:q.encumbrance_capacity)??0,E=R>0?Math.min(200,N/R*100):0,ee=E>150?"#b7432c":E>100?"#d8a431":"#2e8b57";return L?n.jsx(Q,{id:e,title:`Inventory: ${o}`,zIndex:r,width:572,height:720,children:n.jsx("div",{style:{padding:20,color:"#666",fontStyle:"italic"},children:"Loading inventory..."})}):n.jsxs(Q,{id:e,title:`Inventory: ${o}`,zIndex:r,width:572,height:720,children:[n.jsxs("div",{style:{display:"flex",flex:1,overflow:"hidden",background:"rgba(14,14,14,0.96)",fontFamily:'-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,sans-serif',fontSize:13},children:[n.jsxs("div",{style:{width:316,display:"flex",flexDirection:"column",overflow:"hidden"},children:[n.jsx("div",{style:{position:"relative",height:270,minHeight:270,background:"#0a0a0a",borderBottom:`1px solid ${$}`},children:Z.map(t=>{const i=A.get(t.key),u=I[t.key]??"#2a2a2a";return n.jsx("div",{style:{position:"absolute",left:(t.col-1)*44+4,top:(t.row-1)*44+4,width:36,height:36,background:i?"#5a5a62":u,border:i?"2px solid #00ffff":"2px outset #6a6a72",boxShadow:i?"0 0 5px #00ffff, inset 0 0 5px rgba(0,255,255,0.2)":"none",display:"flex",alignItems:"center",justifyContent:"center",cursor:i?"pointer":"default"},onMouseEnter:m=>i&&y(i,m),onMouseMove:m=>i&&y(i,m),onMouseLeave:()=>y(null),children:i?n.jsx(W,{item:i,size:32}):n.jsx("img",{src:"/icons/06000133.png",alt:"",style:{width:28,height:28,opacity:.15,filter:"grayscale(100%)",imageRendering:"pixelated"}})},t.key)})}),n.jsxs("div",{style:{padding:"3px 6px",fontSize:11,color:"#ccc",background:"#111",borderBottom:`1px solid ${$}`},children:["Contents of ",k!==null?((Y=z.find(t=>t.item_id===k))==null?void 0:Y.name)??"Pack":"Backpack"]}),n.jsxs("div",{style:{flex:1,overflowY:"auto",display:"grid",gridTemplateColumns:"repeat(6, 36px)",gridAutoRows:36,gap:2,padding:4,alignContent:"start"},children:[P.map((t,i)=>n.jsx("div",{style:{width:36,height:36,background:"linear-gradient(135deg, #3d007a 0%, #1a0033 100%)",border:"1px solid #4a148c",display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer"},onMouseEnter:u=>y(t,u),onMouseMove:u=>y(t,u),onMouseLeave:()=>y(null),children:n.jsx(W,{item:t,size:32})},t.item_id??i)),Array.from({length:Math.max(0,24-P.length)}).map((t,i)=>n.jsx("div",{style:{width:36,height:36,background:"#0a0a0a",border:"1px solid #1a1a1a"}},`e${i}`))]})]}),n.jsxs("div",{style:{width:42,display:"flex",flexDirection:"column",alignItems:"center",padding:"4px 2px",borderLeft:`1px solid ${$}`,borderRight:`1px solid ${$}`},children:[n.jsx("div",{style:{textAlign:"center",fontSize:8,color:"#ccc",marginBottom:2},children:R>0?`${Math.floor(E)}%`:"Burden"}),n.jsx("div",{style:{width:14,height:40,background:"#111",border:"1px solid #555",position:"relative",overflow:"hidden",marginBottom:6,flexShrink:0},title:R>0?`${N.toLocaleString()} / ${R.toLocaleString()}`:`Burden: ${c.reduce((t,i)=>t+(i.burden??0),0).toLocaleString()}`,children:n.jsx("div",{style:{position:"absolute",bottom:0,left:0,right:0,height:`${E/2}%`,background:ee,transition:"height 0.3s"}})}),n.jsx(G,{iconSrc:"/icons/0600127E.png",isActive:k===null,fillPct:S.length>0?Math.min(100,S.length/102*100):0,label:`Backpack (${S.length}/102)`,onClick:()=>H(null)}),z.map(t=>{const i=t.item_id,u=c.filter(l=>l.container_id===i&&l.item_id!==i).length,m=t.items_capacity||24,a=m>0?Math.min(100,u/m*100):0;return n.jsx(G,{iconSrc:`/icons/${D(t.icon)}.png`,isActive:k===i,fillPct:a,label:`${t.name} (${u}/${m})`,onClick:()=>H(i)},i)})]}),n.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",overflow:"hidden",minWidth:160},children:[n.jsx("div",{style:{padding:"4px 8px",fontSize:"0.72rem",fontWeight:600,color:"#aaa",background:"#111",borderBottom:`1px solid ${$}`},children:"Mana"}),n.jsxs("div",{style:{flex:1,overflowY:"auto",padding:"2px 0"},children:[(()=>{const t=(d==null?void 0:d.items)??[],i=new Map(t.map(a=>[a.item_id,a])),u=d!=null&&d.timestamp?new Date(d.timestamp).getTime():0,m=u>0?Math.max(0,(Date.now()-u)/1e3):0;return Array.from(A.values()).map(a=>{const l=i.get(a.item_id),h=(l==null?void 0:l.current_mana)??a.current_mana??0,p=(l==null?void 0:l.max_mana)??a.max_mana??0,b=(l==null?void 0:l.mana_time_remaining_seconds)??null,x=b!=null?Math.max(0,b-m):null,v=(l==null?void 0:l.state)??(h>0?"active":"not_active");return{...a,current_mana:h,max_mana:p,liveRemaining:x,manaState:v}}).filter(a=>a.current_mana>0||a.max_mana>0).sort((a,l)=>(a.liveRemaining??999999)-(l.liveRemaining??999999)).map((a,l)=>{const h=a.manaState==="active"?"#4c4":a.manaState==="not_active"?"#c44":"#da8";return n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:4,padding:"2px 4px",borderBottom:"1px solid #1a1a1a",cursor:"pointer"},onMouseEnter:p=>y(a,p),onMouseMove:p=>y(a,p),onMouseLeave:()=>y(null),children:[n.jsx("div",{style:{width:20,height:20,flexShrink:0},children:n.jsx(W,{item:a,size:20})}),n.jsx("div",{style:{width:8,height:8,borderRadius:"50%",background:h,flexShrink:0}}),n.jsx("div",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",fontSize:"0.68rem",color:"#ccc"},children:a.name}),n.jsxs("div",{style:{fontSize:"0.65rem",color:"#88bbff",whiteSpace:"nowrap",fontVariantNumeric:"tabular-nums"},children:[a.current_mana,"/",a.max_mana]}),n.jsx("div",{style:{fontSize:"0.63rem",color:"#9c9",whiteSpace:"nowrap",fontVariantNumeric:"tabular-nums",minWidth:42,textAlign:"right"},children:a.liveRemaining!=null?se(a.liveRemaining):""})]},l)})})(),Array.from(A.values()).filter(t=>t.current_mana>0||t.max_mana>0).length===0&&n.jsx("div",{style:{padding:12,color:"#555",textAlign:"center",fontSize:"0.7rem"},children:"No mana items equipped"})]})]})]}),B&&n.jsx(le,{item:B.item,x:B.x,y:B.y})]})};function se(e){if(e<=0)return"0h00m";const o=Math.floor(e),r=Math.floor(o/3600),s=Math.floor(o%3600/60);return`${r}h${String(s).padStart(2,"0")}m`}export{ce as InventoryWindow}; diff --git a/static/assets/IssuesWindow-DhxMoU6U.js b/static/assets/IssuesWindow-BQgY9oJz.js similarity index 99% rename from static/assets/IssuesWindow-DhxMoU6U.js rename to static/assets/IssuesWindow-BQgY9oJz.js index b165ad85..1c29566c 100644 --- a/static/assets/IssuesWindow-DhxMoU6U.js +++ b/static/assets/IssuesWindow-BQgY9oJz.js @@ -1 +1 @@ -import{r as n,a as W,j as e,D as L}from"./index-YQnl0KV7.js";import"./react-yfL0ty4i.js";const O={plugin:{label:"Plugin",color:"#8844cc"},overlord:{label:"Overlord",color:"#4488cc"},nav:{label:"Nav",color:"#44aa44"},macro:{label:"Macro",color:"#cc8844"},other:{label:"Other",color:"#888888"}},i={padding:"3px 6px",fontSize:"0.8rem",border:"1px solid #555",background:"#2a2a2a",color:"#ddd",borderRadius:0},N={...i,fontSize:"0.75rem"},g={padding:"4px 12px",background:"#4a80c0",color:"#fff",border:"1px solid #336699",cursor:"pointer",fontSize:"0.75rem"},a={padding:"3px 8px",background:"#444",color:"#ccc",border:"1px solid #555",cursor:"pointer",fontSize:"0.7rem"},F=({id:P,zIndex:A})=>{const[h,R]=n.useState([]),[c,m]=n.useState(""),[y,u]=n.useState(""),[f,$]=n.useState("plugin"),[v,d]=n.useState(null),[p,j]=n.useState(""),[b,S]=n.useState(""),[C,z]=n.useState(""),[T,k]=n.useState({}),x=n.useCallback(async()=>{try{const t=await W("/issues");R((t.issues??[]).sort((r,s)=>(r.resolved?1:0)-(s.resolved?1:0)))}catch{}},[]);n.useEffect(()=>{x()},[x]);const l=async(t,r)=>{await fetch(`/api${t}`,{...r,credentials:"include",headers:{"Content-Type":"application/json",...r.headers}}),x()},E=async()=>{c.trim()&&(await l("/issues",{method:"POST",body:JSON.stringify({title:c.trim(),description:y.trim(),category:f})}),m(""),u(""))},B=t=>{if(v===t.id){d(null);return}d(t.id),j(t.title),S(t.description||""),z(t.category||"other")},I=async t=>{p.trim()&&(await l(`/issues/${t}`,{method:"PATCH",body:JSON.stringify({title:p.trim(),description:b.trim(),category:C})}),d(null))},w=async t=>{const r=(T[t]||"").trim();r&&(await l(`/issues/${t}/comments`,{method:"POST",body:JSON.stringify({text:r})}),k(s=>({...s,[t]:""})))};return e.jsxs(L,{id:P,title:"Issues Board",zIndex:A,width:540,height:520,children:[e.jsxs("div",{style:{flex:1,overflowY:"auto",padding:6,fontSize:"0.8rem"},children:[h.length===0&&e.jsx("div",{style:{padding:10,color:"#888",textAlign:"center"},children:"No open issues"}),h.map(t=>{const r=O[t.category]||O.other,s=t.created?new Date(t.created).toLocaleDateString("sv-SE"):"",D=t.comments||[];return e.jsxs("div",{style:{padding:"6px 8px",marginBottom:4,background:"#1f1f1f",borderRadius:3,border:"1px solid #333",opacity:t.resolved?.55:1},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,flexWrap:"wrap"},children:[e.jsx("span",{style:{fontSize:"0.65rem",padding:"1px 6px",borderRadius:3,background:r.color,color:"#fff",fontWeight:600},children:r.label}),e.jsx("strong",{style:{fontSize:"0.8rem",flex:1},children:t.title}),e.jsxs("span",{style:{fontSize:"0.65rem",color:"#888"},children:["by ",t.author||"User"]}),e.jsx("span",{style:{color:"#666",fontSize:"0.65rem"},children:s})]}),t.description&&e.jsx("div",{style:{color:"#999",marginTop:3,fontSize:"0.75rem"},children:t.description}),e.jsxs("div",{style:{display:"flex",gap:4,marginTop:4},children:[t.resolved?e.jsxs(e.Fragment,{children:[e.jsx("button",{style:{...a,fontSize:"0.65rem"},onClick:()=>l(`/issues/${t.id}`,{method:"PATCH",body:JSON.stringify({resolved:!1})}),children:"↻ Reopen"}),e.jsx("button",{style:{...a,fontSize:"0.65rem",color:"#c66"},onClick:()=>{confirm(`Delete issue "${t.title}"?`)&&l(`/issues/${t.id}`,{method:"DELETE"})},children:"🗑 Delete"})]}):e.jsx("button",{style:{...a,fontSize:"0.65rem",background:"rgba(68,204,68,0.15)",color:"#4c4",border:"1px solid rgba(68,204,68,0.3)"},onClick:()=>l(`/issues/${t.id}`,{method:"PATCH",body:JSON.stringify({resolved:!0})}),children:"✓ Resolve"}),e.jsx("button",{style:{...a,fontSize:"0.65rem"},onClick:()=>B(t),children:"✎ Edit"})]}),v===t.id&&e.jsxs("div",{style:{marginTop:4,padding:4,background:"#222",borderRadius:3},children:[e.jsxs("div",{style:{display:"flex",gap:4,marginBottom:4},children:[e.jsx("input",{value:p,onChange:o=>j(o.target.value),style:{...i,flex:1}}),e.jsxs("select",{value:C,onChange:o=>z(o.target.value),style:N,children:[e.jsx("option",{value:"plugin",children:"Plugin"}),e.jsx("option",{value:"overlord",children:"Overlord"}),e.jsx("option",{value:"nav",children:"Nav"}),e.jsx("option",{value:"macro",children:"Macro"}),e.jsx("option",{value:"other",children:"Other"})]})]}),e.jsxs("div",{style:{display:"flex",gap:4},children:[e.jsx("textarea",{value:b,onChange:o=>S(o.target.value),rows:2,style:{...i,flex:1,fontSize:"0.75rem",resize:"vertical"}}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:2},children:[e.jsx("button",{style:{...g,fontSize:"0.7rem",padding:"3px 8px"},onClick:()=>I(t.id),children:"Save"}),e.jsx("button",{style:{...a},onClick:()=>d(null),children:"Cancel"})]})]})]}),e.jsxs("div",{style:{marginTop:4,paddingTop:4,borderTop:"1px solid #2a2a2a"},children:[D.length===0?e.jsx("div",{style:{color:"#555",fontSize:"0.7rem",padding:"2px 0"},children:"No comments yet"}):D.map(o=>e.jsxs("div",{style:{marginBottom:3,fontSize:"0.72rem"},children:[e.jsx("span",{style:{color:"#8ac",fontWeight:500},children:o.author||"Anonymous"}),e.jsx("span",{style:{color:"#555",marginLeft:6,fontSize:"0.6rem"},children:o.created?new Date(o.created).toLocaleDateString("sv-SE"):""}),e.jsx("div",{style:{color:"#bbb",marginTop:1},children:o.text})]},o.id)),e.jsxs("div",{style:{display:"flex",gap:4,marginTop:3},children:[e.jsx("input",{value:T[t.id]||"",onChange:o=>k(J=>({...J,[t.id]:o.target.value})),placeholder:"Add a comment...",style:{...i,flex:1,fontSize:"0.75rem"},onKeyDown:o=>{o.key==="Enter"&&w(t.id)}}),e.jsx("button",{style:{...g,fontSize:"0.7rem",padding:"3px 8px"},onClick:()=>w(t.id),children:"Post"})]})]})]},t.id)})]}),e.jsxs("div",{style:{padding:6,borderTop:"1px solid #333"},children:[e.jsxs("div",{style:{display:"flex",gap:4,marginBottom:4},children:[e.jsx("input",{value:c,onChange:t=>m(t.target.value),placeholder:"Issue title...",style:{...i,flex:1},onKeyDown:t=>{t.key==="Enter"&&E()}}),e.jsxs("select",{value:f,onChange:t=>$(t.target.value),style:N,children:[e.jsx("option",{value:"plugin",children:"Plugin"}),e.jsx("option",{value:"overlord",children:"Overlord"}),e.jsx("option",{value:"nav",children:"Nav"}),e.jsx("option",{value:"macro",children:"Macro"}),e.jsx("option",{value:"other",children:"Other"})]})]}),e.jsxs("div",{style:{display:"flex",gap:4},children:[e.jsx("textarea",{value:y,onChange:t=>u(t.target.value),placeholder:"Description (optional)...",rows:2,style:{...i,flex:1,fontSize:"0.75rem",resize:"vertical"}}),e.jsx("button",{style:{...g,alignSelf:"flex-end"},onClick:E,children:"Add"})]})]})]})};export{F as IssuesWindow}; +import{r as n,a as W,j as e,D as L}from"./index-Dg_ifawe.js";import"./react-yfL0ty4i.js";const O={plugin:{label:"Plugin",color:"#8844cc"},overlord:{label:"Overlord",color:"#4488cc"},nav:{label:"Nav",color:"#44aa44"},macro:{label:"Macro",color:"#cc8844"},other:{label:"Other",color:"#888888"}},i={padding:"3px 6px",fontSize:"0.8rem",border:"1px solid #555",background:"#2a2a2a",color:"#ddd",borderRadius:0},N={...i,fontSize:"0.75rem"},g={padding:"4px 12px",background:"#4a80c0",color:"#fff",border:"1px solid #336699",cursor:"pointer",fontSize:"0.75rem"},a={padding:"3px 8px",background:"#444",color:"#ccc",border:"1px solid #555",cursor:"pointer",fontSize:"0.7rem"},F=({id:P,zIndex:A})=>{const[h,R]=n.useState([]),[c,m]=n.useState(""),[y,u]=n.useState(""),[f,$]=n.useState("plugin"),[v,d]=n.useState(null),[p,j]=n.useState(""),[b,S]=n.useState(""),[C,z]=n.useState(""),[T,k]=n.useState({}),x=n.useCallback(async()=>{try{const t=await W("/issues");R((t.issues??[]).sort((r,s)=>(r.resolved?1:0)-(s.resolved?1:0)))}catch{}},[]);n.useEffect(()=>{x()},[x]);const l=async(t,r)=>{await fetch(`/api${t}`,{...r,credentials:"include",headers:{"Content-Type":"application/json",...r.headers}}),x()},E=async()=>{c.trim()&&(await l("/issues",{method:"POST",body:JSON.stringify({title:c.trim(),description:y.trim(),category:f})}),m(""),u(""))},B=t=>{if(v===t.id){d(null);return}d(t.id),j(t.title),S(t.description||""),z(t.category||"other")},I=async t=>{p.trim()&&(await l(`/issues/${t}`,{method:"PATCH",body:JSON.stringify({title:p.trim(),description:b.trim(),category:C})}),d(null))},w=async t=>{const r=(T[t]||"").trim();r&&(await l(`/issues/${t}/comments`,{method:"POST",body:JSON.stringify({text:r})}),k(s=>({...s,[t]:""})))};return e.jsxs(L,{id:P,title:"Issues Board",zIndex:A,width:540,height:520,children:[e.jsxs("div",{style:{flex:1,overflowY:"auto",padding:6,fontSize:"0.8rem"},children:[h.length===0&&e.jsx("div",{style:{padding:10,color:"#888",textAlign:"center"},children:"No open issues"}),h.map(t=>{const r=O[t.category]||O.other,s=t.created?new Date(t.created).toLocaleDateString("sv-SE"):"",D=t.comments||[];return e.jsxs("div",{style:{padding:"6px 8px",marginBottom:4,background:"#1f1f1f",borderRadius:3,border:"1px solid #333",opacity:t.resolved?.55:1},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,flexWrap:"wrap"},children:[e.jsx("span",{style:{fontSize:"0.65rem",padding:"1px 6px",borderRadius:3,background:r.color,color:"#fff",fontWeight:600},children:r.label}),e.jsx("strong",{style:{fontSize:"0.8rem",flex:1},children:t.title}),e.jsxs("span",{style:{fontSize:"0.65rem",color:"#888"},children:["by ",t.author||"User"]}),e.jsx("span",{style:{color:"#666",fontSize:"0.65rem"},children:s})]}),t.description&&e.jsx("div",{style:{color:"#999",marginTop:3,fontSize:"0.75rem"},children:t.description}),e.jsxs("div",{style:{display:"flex",gap:4,marginTop:4},children:[t.resolved?e.jsxs(e.Fragment,{children:[e.jsx("button",{style:{...a,fontSize:"0.65rem"},onClick:()=>l(`/issues/${t.id}`,{method:"PATCH",body:JSON.stringify({resolved:!1})}),children:"↻ Reopen"}),e.jsx("button",{style:{...a,fontSize:"0.65rem",color:"#c66"},onClick:()=>{confirm(`Delete issue "${t.title}"?`)&&l(`/issues/${t.id}`,{method:"DELETE"})},children:"🗑 Delete"})]}):e.jsx("button",{style:{...a,fontSize:"0.65rem",background:"rgba(68,204,68,0.15)",color:"#4c4",border:"1px solid rgba(68,204,68,0.3)"},onClick:()=>l(`/issues/${t.id}`,{method:"PATCH",body:JSON.stringify({resolved:!0})}),children:"✓ Resolve"}),e.jsx("button",{style:{...a,fontSize:"0.65rem"},onClick:()=>B(t),children:"✎ Edit"})]}),v===t.id&&e.jsxs("div",{style:{marginTop:4,padding:4,background:"#222",borderRadius:3},children:[e.jsxs("div",{style:{display:"flex",gap:4,marginBottom:4},children:[e.jsx("input",{value:p,onChange:o=>j(o.target.value),style:{...i,flex:1}}),e.jsxs("select",{value:C,onChange:o=>z(o.target.value),style:N,children:[e.jsx("option",{value:"plugin",children:"Plugin"}),e.jsx("option",{value:"overlord",children:"Overlord"}),e.jsx("option",{value:"nav",children:"Nav"}),e.jsx("option",{value:"macro",children:"Macro"}),e.jsx("option",{value:"other",children:"Other"})]})]}),e.jsxs("div",{style:{display:"flex",gap:4},children:[e.jsx("textarea",{value:b,onChange:o=>S(o.target.value),rows:2,style:{...i,flex:1,fontSize:"0.75rem",resize:"vertical"}}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:2},children:[e.jsx("button",{style:{...g,fontSize:"0.7rem",padding:"3px 8px"},onClick:()=>I(t.id),children:"Save"}),e.jsx("button",{style:{...a},onClick:()=>d(null),children:"Cancel"})]})]})]}),e.jsxs("div",{style:{marginTop:4,paddingTop:4,borderTop:"1px solid #2a2a2a"},children:[D.length===0?e.jsx("div",{style:{color:"#555",fontSize:"0.7rem",padding:"2px 0"},children:"No comments yet"}):D.map(o=>e.jsxs("div",{style:{marginBottom:3,fontSize:"0.72rem"},children:[e.jsx("span",{style:{color:"#8ac",fontWeight:500},children:o.author||"Anonymous"}),e.jsx("span",{style:{color:"#555",marginLeft:6,fontSize:"0.6rem"},children:o.created?new Date(o.created).toLocaleDateString("sv-SE"):""}),e.jsx("div",{style:{color:"#bbb",marginTop:1},children:o.text})]},o.id)),e.jsxs("div",{style:{display:"flex",gap:4,marginTop:3},children:[e.jsx("input",{value:T[t.id]||"",onChange:o=>k(J=>({...J,[t.id]:o.target.value})),placeholder:"Add a comment...",style:{...i,flex:1,fontSize:"0.75rem"},onKeyDown:o=>{o.key==="Enter"&&w(t.id)}}),e.jsx("button",{style:{...g,fontSize:"0.7rem",padding:"3px 8px"},onClick:()=>w(t.id),children:"Post"})]})]})]},t.id)})]}),e.jsxs("div",{style:{padding:6,borderTop:"1px solid #333"},children:[e.jsxs("div",{style:{display:"flex",gap:4,marginBottom:4},children:[e.jsx("input",{value:c,onChange:t=>m(t.target.value),placeholder:"Issue title...",style:{...i,flex:1},onKeyDown:t=>{t.key==="Enter"&&E()}}),e.jsxs("select",{value:f,onChange:t=>$(t.target.value),style:N,children:[e.jsx("option",{value:"plugin",children:"Plugin"}),e.jsx("option",{value:"overlord",children:"Overlord"}),e.jsx("option",{value:"nav",children:"Nav"}),e.jsx("option",{value:"macro",children:"Macro"}),e.jsx("option",{value:"other",children:"Other"})]})]}),e.jsxs("div",{style:{display:"flex",gap:4},children:[e.jsx("textarea",{value:y,onChange:t=>u(t.target.value),placeholder:"Description (optional)...",rows:2,style:{...i,flex:1,fontSize:"0.75rem",resize:"vertical"}}),e.jsx("button",{style:{...g,alignSelf:"flex-end"},onClick:E,children:"Add"})]})]})]})};export{F as IssuesWindow}; diff --git a/static/assets/QuestStatusWindow-34SI56Mw.js b/static/assets/QuestStatusWindow-Bpt0EjyP.js similarity index 96% rename from static/assets/QuestStatusWindow-34SI56Mw.js rename to static/assets/QuestStatusWindow-Bpt0EjyP.js index 8f23da57..74afaad1 100644 --- a/static/assets/QuestStatusWindow-34SI56Mw.js +++ b/static/assets/QuestStatusWindow-Bpt0EjyP.js @@ -1 +1 @@ -import{r as c,j as t,D as u,a as f}from"./index-YQnl0KV7.js";import"./react-yfL0ty4i.js";const j=({id:p,zIndex:x})=>{const[s,h]=c.useState(null);c.useEffect(()=>{const e=async()=>{try{h(await f("/quest-status"))}catch{}};e();const o=setInterval(e,3e4);return()=>clearInterval(o)},[]);const i=s?Object.keys(s.quest_data).sort():[],l=new Set;if(s)for(const e of Object.values(s.quest_data))for(const o of Object.keys(e))l.add(o);const n=Array.from(l).sort();return t.jsx(u,{id:p,title:"Quest Status",zIndex:x,width:780,height:500,children:t.jsx("div",{style:{flex:1,overflow:"auto",fontSize:"0.72rem"},children:s?i.length===0?t.jsx("div",{style:{padding:20,color:"#666",textAlign:"center"},children:"No quest data available"}):t.jsxs("table",{style:{width:"100%",borderCollapse:"collapse"},children:[t.jsx("thead",{children:t.jsxs("tr",{style:{position:"sticky",top:0,background:"#1a1a1a",zIndex:1},children:[t.jsx("th",{style:{textAlign:"left",padding:"4px 8px",borderBottom:"1px solid #444",color:"#888",fontSize:"0.65rem",fontWeight:600,minWidth:140},children:"Character"}),n.map(e=>t.jsx("th",{style:{textAlign:"center",padding:"4px 6px",borderBottom:"1px solid #444",color:"#888",fontSize:"0.6rem",fontWeight:600,maxWidth:120,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:e,children:e.replace(" Timer","").replace(" Pickup","")},e))]})}),t.jsx("tbody",{children:i.map(e=>{const o=s.quest_data[e]||{};return t.jsxs("tr",{style:{borderBottom:"1px solid #222"},children:[t.jsx("td",{style:{padding:"3px 8px",color:"#ccc",fontWeight:500,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",maxWidth:160},children:e}),n.map(d=>{const r=o[d],a=r==="READY";return t.jsx("td",{style:{textAlign:"center",padding:"3px 6px",color:a?"#4c4":r?"#ca0":"#333",fontWeight:a?600:400,fontSize:a?"0.7rem":"0.68rem"},children:r||"—"},d)})]},e)})})]}):t.jsx("div",{style:{padding:20,color:"#666",textAlign:"center"},children:"Loading quest data..."})})})};export{j as QuestStatusWindow}; +import{r as c,j as t,D as u,a as f}from"./index-Dg_ifawe.js";import"./react-yfL0ty4i.js";const j=({id:p,zIndex:x})=>{const[s,h]=c.useState(null);c.useEffect(()=>{const e=async()=>{try{h(await f("/quest-status"))}catch{}};e();const o=setInterval(e,3e4);return()=>clearInterval(o)},[]);const i=s?Object.keys(s.quest_data).sort():[],l=new Set;if(s)for(const e of Object.values(s.quest_data))for(const o of Object.keys(e))l.add(o);const n=Array.from(l).sort();return t.jsx(u,{id:p,title:"Quest Status",zIndex:x,width:780,height:500,children:t.jsx("div",{style:{flex:1,overflow:"auto",fontSize:"0.72rem"},children:s?i.length===0?t.jsx("div",{style:{padding:20,color:"#666",textAlign:"center"},children:"No quest data available"}):t.jsxs("table",{style:{width:"100%",borderCollapse:"collapse"},children:[t.jsx("thead",{children:t.jsxs("tr",{style:{position:"sticky",top:0,background:"#1a1a1a",zIndex:1},children:[t.jsx("th",{style:{textAlign:"left",padding:"4px 8px",borderBottom:"1px solid #444",color:"#888",fontSize:"0.65rem",fontWeight:600,minWidth:140},children:"Character"}),n.map(e=>t.jsx("th",{style:{textAlign:"center",padding:"4px 6px",borderBottom:"1px solid #444",color:"#888",fontSize:"0.6rem",fontWeight:600,maxWidth:120,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:e,children:e.replace(" Timer","").replace(" Pickup","")},e))]})}),t.jsx("tbody",{children:i.map(e=>{const o=s.quest_data[e]||{};return t.jsxs("tr",{style:{borderBottom:"1px solid #222"},children:[t.jsx("td",{style:{padding:"3px 8px",color:"#ccc",fontWeight:500,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",maxWidth:160},children:e}),n.map(d=>{const r=o[d],a=r==="READY";return t.jsx("td",{style:{textAlign:"center",padding:"3px 6px",color:a?"#4c4":r?"#ca0":"#333",fontWeight:a?600:400,fontSize:a?"0.7rem":"0.68rem"},children:r||"—"},d)})]},e)})})]}):t.jsx("div",{style:{padding:20,color:"#666",textAlign:"center"},children:"Loading quest data..."})})})};export{j as QuestStatusWindow}; diff --git a/static/assets/RadarWindow-iFWXCOTG.js b/static/assets/RadarWindow-7bg8dbys.js similarity index 99% rename from static/assets/RadarWindow-iFWXCOTG.js rename to static/assets/RadarWindow-7bg8dbys.js index 7208c2c9..26cc36fb 100644 --- a/static/assets/RadarWindow-iFWXCOTG.js +++ b/static/assets/RadarWindow-7bg8dbys.js @@ -1 +1 @@ -import{r as x,j as c,D as ne}from"./index-YQnl0KV7.js";import"./react-yfL0ty4i.js";const q=300,H=.5,se={walls:{r:0,g:0,b:255},innerWalls:{r:127,g:127,b:255},rampedWalls:{r:77,g:255,b:255},floors:{r:0,g:127,b:255},stairs:{r:0,g:63,b:255}},le={walls:{r:140,g:140,b:180},innerWalls:{r:100,g:100,b:140},rampedWalls:{r:120,g:160,b:120},floors:{r:60,g:80,b:60},stairs:{r:180,g:160,b:80}};function oe(d){const g=document.createElement("canvas");g.width=10,g.height=10;const w=g.getContext("2d");w.drawImage(d,0,0,10,10);const a=w.getImageData(0,0,10,10),t=a.data;for(let p=0;p240&&R>240&&k>240){t[p+3]=0;continue}let E=!1;for(const[L,I]of Object.entries(se))if(Math.abs(_-I.r)<15&&Math.abs(R-I.g)<15&&Math.abs(k-I.b)<15){const W=le[L];t[p]=W.r,t[p+1]=W.g,t[p+2]=W.b,E=!0;break}!E&&_<15&&R<15&&k<15&&(t[p+3]=100)}return w.putImageData(a,0,0),g}function ie(d){return d===1?Math.PI:d<-.7&&d>-.8?Math.PI/2:d>.7&&d<.8?-Math.PI/2:0}let A=null;function ce(){A||(A={},fetch("/dungeon_tiles.json").then(d=>d.json()).then(d=>{Object.entries(d).forEach(([g,w])=>{const a=new Image;a.onload=()=>{A[g]=oe(a)},a.src=w})}).catch(()=>{}))}const K={Monster:"#ff4444",Player:"#4488ff",NPC:"#44cc44",Vendor:"#44cc44",Portal:"#aa44ff",Corpse:"#ff8800",Container:"#cccc44",Door:"#888888"};function re(d){const g=(d%360+360)%360;return["N","NE","E","SE","S","SW","W","NW"][Math.round(g/45)%8]}const fe=({id:d,charName:g,zIndex:w,socket:a,radarData:t})=>{const p=x.useRef(null),_=x.useRef(H),[R,k]=x.useState(H),[E,L]=x.useState(null),I=x.useRef(null),W=x.useRef([]);x.useEffect(()=>{const n=new Image;n.src="/dereth.png",n.onload=()=>{I.current=n},ce()},[]),x.useEffect(()=>((a==null?void 0:a.readyState)===WebSocket.OPEN&&a.send(JSON.stringify({player_name:g,command:"start_radar"})),()=>{(a==null?void 0:a.readyState)===WebSocket.OPEN&&a.send(JSON.stringify({player_name:g,command:"stop_radar"}))}),[g,a]);const Q=x.useCallback(n=>{n.preventDefault();const e=n.deltaY>0?1.25:.8;_.current=Math.max(.02,Math.min(5,_.current*e)),k(_.current)},[]),D=x.useCallback(n=>{const e=p.current;if(!e)return;const o=e.getBoundingClientRect(),s=(n.clientX-o.left)*(e.width/o.width),r=(n.clientY-o.top)*(e.height/o.height);let M=null,u=20;W.current.forEach(f=>{if(f._px===void 0)return;const S=Math.sqrt((s-f._px)**2+(r-f._py)**2);S{var G;const n=p.current;if(!n||!t)return;const e=n.getContext("2d");if(!e)return;const o=q,s=o/2,r=o/2,M=t.objects??[],u=t.player_ew??0,f=t.player_ns??0,S=t.player_heading??0,b=t.is_dungeon??!1,V=t.player_x??0,Z=t.player_y??0,Y=_.current,z=b?o/2/(Y*240):o/2/Y,j=S*Math.PI/180;e.clearRect(0,0,o,o),e.fillStyle="#111",e.beginPath(),e.arc(s,r,s,0,Math.PI*2),e.fill(),e.save(),e.beginPath(),e.arc(s,r,s-1,0,Math.PI*2),e.clip();const B=t.landblock??null,te=t.player_raw_z??0;if(b&&B&&((G=window.__dungeonMapCache)!=null&&G[B])){const l=window.__dungeonMapCache[B],h=Math.floor((te+3)/6)*6;e.translate(s,r),e.rotate(-(S-180)*Math.PI/180);const i=10*z,O=A&&Object.keys(A).length>0;(l.z_levels||[]).slice().sort((y,m)=>(y.z===h?1:0)-(m.z===h?1:0)).forEach(y=>{const m=y.z===h;e.globalAlpha=m?.85:.12,(y.cells||[]).forEach(T=>{const P=-(T.x-V)*z,N=(T.y-Z)*z,C=O?A[String(T.env_id)]:null;C?(e.save(),e.translate(P,N),e.rotate(ie(T.rotation)),e.drawImage(C,-i/2,-i/2,i,i),e.restore()):(e.fillStyle=m?"#3a5a3a":"#1a2a1a",e.fillRect(P-i/2,N-i/2,i,i))})}),e.globalAlpha=1,e.setTransform(1,0,0,1,0,0)}else if(!b&&I.current){const l=I.current,h=l.naturalWidth/204.2,i=(u+102.1)*h,O=(102.1-f)*h;e.globalAlpha=.4,e.save(),e.translate(s,r),e.rotate(-j);const v=Y*h*2;e.drawImage(l,i-v/2,O-v/2,v,v,-s,-r,o,o),e.restore(),e.globalAlpha=1}e.restore(),e.strokeStyle="#333",e.lineWidth=1;for(let l=1;l<=4;l++)e.beginPath(),e.arc(s,r,s/4*l,0,Math.PI*2),e.stroke();e.beginPath(),e.moveTo(s,0),e.lineTo(s,o),e.moveTo(0,r),e.lineTo(o,r),e.stroke(),e.font="bold 12px monospace",e.textAlign="center",e.textBaseline="middle",[{l:"N",a:0},{l:"E",a:Math.PI/2},{l:"S",a:Math.PI},{l:"W",a:-Math.PI/2}].forEach(({l,a:h})=>{const i=h-j;e.fillStyle=l==="N"?"#cc4444":"#888",e.fillText(l,s+Math.sin(i)*(s-12),r-Math.cos(i)*(s-12))}),e.strokeStyle="#666",e.lineWidth=1,e.beginPath(),e.moveTo(s,r),e.lineTo(s,r-s*.85),e.stroke();const $=b?Math.PI-j:j,X=Math.cos($),F=Math.sin($);M.forEach(l=>{let h,i;b&&l.raw_x!==void 0?(h=-(l.raw_x-V),i=l.raw_y-Z):(h=(l.ew??0)-u,i=(l.ns??0)-f);const O=h*X-i*F,v=b?h*F+i*X:-(h*F+i*X),y=s+O*z,m=r+v*z;if(Math.sqrt((y-s)**2+(m-r)**2)>s-4)return;l._px=y,l._py=m;const P=l.object_class??l.type??"",N=K[P]??"#888",C=l.id===E,J=C?6:P==="Monster"||P==="Player"?4:3;C&&(e.strokeStyle="#fff",e.lineWidth=2,e.beginPath(),e.arc(y,m,J+3,0,Math.PI*2),e.stroke()),e.fillStyle=N,e.beginPath(),e.arc(y,m,J,0,Math.PI*2),e.fill(),(P==="Player"||P==="Portal"||C)&&(e.fillStyle=C?"#fff":N,e.font="9px monospace",e.textAlign="left",e.fillText(l.name,y+6,m+3))}),W.current=M,e.fillStyle="#ffcc00",e.beginPath(),e.arc(s,r,5,0,Math.PI*2),e.fill(),e.strokeStyle="#fff",e.lineWidth=1,e.stroke()},[t,R,E]);const U=((t==null?void 0:t.objects)??[]).map(n=>{const e=(t==null?void 0:t.player_ew)??0,o=(t==null?void 0:t.player_ns)??0,s=(t==null?void 0:t.is_dungeon)??!1,r=(t==null?void 0:t.player_x)??0,M=(t==null?void 0:t.player_y)??0;let u,f,S;s&&n.raw_x!==void 0?(u=-(n.raw_x-r),f=n.raw_y-M,S=Math.sqrt(u*u+f*f)):(u=(n.ew??0)-e,f=(n.ns??0)-o,S=Math.sqrt(u*u+f*f)*240);const b=Math.atan2(u,f)*180/Math.PI;return{...n,dist:S,dir:re(b)}}).sort((n,e)=>n.dist-e.dist),ee=Math.round(R*240);return c.jsxs(ne,{id:d,title:`Radar: ${g}`,zIndex:w,width:360,height:560,children:[c.jsxs("div",{style:{padding:"4px 8px",display:"flex",justifyContent:"space-between",fontSize:"0.75rem",color:"#888",borderBottom:"1px solid #333",background:"#1a1a1a"},children:[c.jsxs("span",{children:["Range: ~",ee,"m"]}),c.jsx("span",{style:{fontSize:"0.65rem",color:"#555"},children:"Scroll to zoom"})]}),c.jsx("canvas",{ref:p,width:q,height:q,style:{display:"block",margin:"0 auto",borderBottom:"1px solid #333",cursor:"crosshair",flexShrink:0},onWheel:Q,onClick:D}),c.jsxs("div",{style:{flex:1,overflowY:"auto",fontSize:"0.72rem",minHeight:0},children:[c.jsxs("div",{style:{display:"flex",padding:"3px 6px",borderBottom:"1px solid #333",color:"#666",fontSize:"0.65rem",fontWeight:600},children:[c.jsx("span",{style:{width:8}}),c.jsx("span",{style:{flex:1,marginLeft:6},children:"Name"}),c.jsx("span",{style:{width:55,textAlign:"left"},children:"Type"}),c.jsx("span",{style:{width:40,textAlign:"right"},children:"Dist"}),c.jsx("span",{style:{width:24,textAlign:"center"},children:"Dir"})]}),U.length===0&&c.jsx("div",{style:{padding:12,color:"#555",textAlign:"center",fontSize:"0.7rem"},children:"Waiting for radar data..."}),U.map(n=>{const e=n.object_class??n.type??"",o=K[e]??"#888",s=n.id===E;return c.jsxs("div",{onClick:()=>L(s?null:n.id),style:{display:"flex",alignItems:"center",padding:"2px 6px",borderBottom:"1px solid #1a1a1a",cursor:"pointer",color:"#ccc",background:s?"#1a2a3a":"",borderLeft:s?"2px solid #4488ff":"2px solid transparent"},children:[c.jsx("span",{style:{width:8,height:8,borderRadius:"50%",background:o,flexShrink:0}}),c.jsx("span",{style:{flex:1,marginLeft:6,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:n.name}),c.jsx("span",{style:{width:55,color:"#888",fontSize:"0.65rem"},children:e}),c.jsx("span",{style:{width:40,textAlign:"right",fontVariantNumeric:"tabular-nums"},children:n.dist<1e3?`${Math.round(n.dist)}m`:`${(n.dist/1e3).toFixed(1)}km`}),c.jsx("span",{style:{width:24,textAlign:"center",color:"#666"},children:n.dir})]},n.id)})]})]})};export{fe as RadarWindow}; +import{r as x,j as c,D as ne}from"./index-Dg_ifawe.js";import"./react-yfL0ty4i.js";const q=300,H=.5,se={walls:{r:0,g:0,b:255},innerWalls:{r:127,g:127,b:255},rampedWalls:{r:77,g:255,b:255},floors:{r:0,g:127,b:255},stairs:{r:0,g:63,b:255}},le={walls:{r:140,g:140,b:180},innerWalls:{r:100,g:100,b:140},rampedWalls:{r:120,g:160,b:120},floors:{r:60,g:80,b:60},stairs:{r:180,g:160,b:80}};function oe(d){const g=document.createElement("canvas");g.width=10,g.height=10;const w=g.getContext("2d");w.drawImage(d,0,0,10,10);const a=w.getImageData(0,0,10,10),t=a.data;for(let p=0;p240&&R>240&&k>240){t[p+3]=0;continue}let E=!1;for(const[L,I]of Object.entries(se))if(Math.abs(_-I.r)<15&&Math.abs(R-I.g)<15&&Math.abs(k-I.b)<15){const W=le[L];t[p]=W.r,t[p+1]=W.g,t[p+2]=W.b,E=!0;break}!E&&_<15&&R<15&&k<15&&(t[p+3]=100)}return w.putImageData(a,0,0),g}function ie(d){return d===1?Math.PI:d<-.7&&d>-.8?Math.PI/2:d>.7&&d<.8?-Math.PI/2:0}let A=null;function ce(){A||(A={},fetch("/dungeon_tiles.json").then(d=>d.json()).then(d=>{Object.entries(d).forEach(([g,w])=>{const a=new Image;a.onload=()=>{A[g]=oe(a)},a.src=w})}).catch(()=>{}))}const K={Monster:"#ff4444",Player:"#4488ff",NPC:"#44cc44",Vendor:"#44cc44",Portal:"#aa44ff",Corpse:"#ff8800",Container:"#cccc44",Door:"#888888"};function re(d){const g=(d%360+360)%360;return["N","NE","E","SE","S","SW","W","NW"][Math.round(g/45)%8]}const fe=({id:d,charName:g,zIndex:w,socket:a,radarData:t})=>{const p=x.useRef(null),_=x.useRef(H),[R,k]=x.useState(H),[E,L]=x.useState(null),I=x.useRef(null),W=x.useRef([]);x.useEffect(()=>{const n=new Image;n.src="/dereth.png",n.onload=()=>{I.current=n},ce()},[]),x.useEffect(()=>((a==null?void 0:a.readyState)===WebSocket.OPEN&&a.send(JSON.stringify({player_name:g,command:"start_radar"})),()=>{(a==null?void 0:a.readyState)===WebSocket.OPEN&&a.send(JSON.stringify({player_name:g,command:"stop_radar"}))}),[g,a]);const Q=x.useCallback(n=>{n.preventDefault();const e=n.deltaY>0?1.25:.8;_.current=Math.max(.02,Math.min(5,_.current*e)),k(_.current)},[]),D=x.useCallback(n=>{const e=p.current;if(!e)return;const o=e.getBoundingClientRect(),s=(n.clientX-o.left)*(e.width/o.width),r=(n.clientY-o.top)*(e.height/o.height);let M=null,u=20;W.current.forEach(f=>{if(f._px===void 0)return;const S=Math.sqrt((s-f._px)**2+(r-f._py)**2);S{var G;const n=p.current;if(!n||!t)return;const e=n.getContext("2d");if(!e)return;const o=q,s=o/2,r=o/2,M=t.objects??[],u=t.player_ew??0,f=t.player_ns??0,S=t.player_heading??0,b=t.is_dungeon??!1,V=t.player_x??0,Z=t.player_y??0,Y=_.current,z=b?o/2/(Y*240):o/2/Y,j=S*Math.PI/180;e.clearRect(0,0,o,o),e.fillStyle="#111",e.beginPath(),e.arc(s,r,s,0,Math.PI*2),e.fill(),e.save(),e.beginPath(),e.arc(s,r,s-1,0,Math.PI*2),e.clip();const B=t.landblock??null,te=t.player_raw_z??0;if(b&&B&&((G=window.__dungeonMapCache)!=null&&G[B])){const l=window.__dungeonMapCache[B],h=Math.floor((te+3)/6)*6;e.translate(s,r),e.rotate(-(S-180)*Math.PI/180);const i=10*z,O=A&&Object.keys(A).length>0;(l.z_levels||[]).slice().sort((y,m)=>(y.z===h?1:0)-(m.z===h?1:0)).forEach(y=>{const m=y.z===h;e.globalAlpha=m?.85:.12,(y.cells||[]).forEach(T=>{const P=-(T.x-V)*z,N=(T.y-Z)*z,C=O?A[String(T.env_id)]:null;C?(e.save(),e.translate(P,N),e.rotate(ie(T.rotation)),e.drawImage(C,-i/2,-i/2,i,i),e.restore()):(e.fillStyle=m?"#3a5a3a":"#1a2a1a",e.fillRect(P-i/2,N-i/2,i,i))})}),e.globalAlpha=1,e.setTransform(1,0,0,1,0,0)}else if(!b&&I.current){const l=I.current,h=l.naturalWidth/204.2,i=(u+102.1)*h,O=(102.1-f)*h;e.globalAlpha=.4,e.save(),e.translate(s,r),e.rotate(-j);const v=Y*h*2;e.drawImage(l,i-v/2,O-v/2,v,v,-s,-r,o,o),e.restore(),e.globalAlpha=1}e.restore(),e.strokeStyle="#333",e.lineWidth=1;for(let l=1;l<=4;l++)e.beginPath(),e.arc(s,r,s/4*l,0,Math.PI*2),e.stroke();e.beginPath(),e.moveTo(s,0),e.lineTo(s,o),e.moveTo(0,r),e.lineTo(o,r),e.stroke(),e.font="bold 12px monospace",e.textAlign="center",e.textBaseline="middle",[{l:"N",a:0},{l:"E",a:Math.PI/2},{l:"S",a:Math.PI},{l:"W",a:-Math.PI/2}].forEach(({l,a:h})=>{const i=h-j;e.fillStyle=l==="N"?"#cc4444":"#888",e.fillText(l,s+Math.sin(i)*(s-12),r-Math.cos(i)*(s-12))}),e.strokeStyle="#666",e.lineWidth=1,e.beginPath(),e.moveTo(s,r),e.lineTo(s,r-s*.85),e.stroke();const $=b?Math.PI-j:j,X=Math.cos($),F=Math.sin($);M.forEach(l=>{let h,i;b&&l.raw_x!==void 0?(h=-(l.raw_x-V),i=l.raw_y-Z):(h=(l.ew??0)-u,i=(l.ns??0)-f);const O=h*X-i*F,v=b?h*F+i*X:-(h*F+i*X),y=s+O*z,m=r+v*z;if(Math.sqrt((y-s)**2+(m-r)**2)>s-4)return;l._px=y,l._py=m;const P=l.object_class??l.type??"",N=K[P]??"#888",C=l.id===E,J=C?6:P==="Monster"||P==="Player"?4:3;C&&(e.strokeStyle="#fff",e.lineWidth=2,e.beginPath(),e.arc(y,m,J+3,0,Math.PI*2),e.stroke()),e.fillStyle=N,e.beginPath(),e.arc(y,m,J,0,Math.PI*2),e.fill(),(P==="Player"||P==="Portal"||C)&&(e.fillStyle=C?"#fff":N,e.font="9px monospace",e.textAlign="left",e.fillText(l.name,y+6,m+3))}),W.current=M,e.fillStyle="#ffcc00",e.beginPath(),e.arc(s,r,5,0,Math.PI*2),e.fill(),e.strokeStyle="#fff",e.lineWidth=1,e.stroke()},[t,R,E]);const U=((t==null?void 0:t.objects)??[]).map(n=>{const e=(t==null?void 0:t.player_ew)??0,o=(t==null?void 0:t.player_ns)??0,s=(t==null?void 0:t.is_dungeon)??!1,r=(t==null?void 0:t.player_x)??0,M=(t==null?void 0:t.player_y)??0;let u,f,S;s&&n.raw_x!==void 0?(u=-(n.raw_x-r),f=n.raw_y-M,S=Math.sqrt(u*u+f*f)):(u=(n.ew??0)-e,f=(n.ns??0)-o,S=Math.sqrt(u*u+f*f)*240);const b=Math.atan2(u,f)*180/Math.PI;return{...n,dist:S,dir:re(b)}}).sort((n,e)=>n.dist-e.dist),ee=Math.round(R*240);return c.jsxs(ne,{id:d,title:`Radar: ${g}`,zIndex:w,width:360,height:560,children:[c.jsxs("div",{style:{padding:"4px 8px",display:"flex",justifyContent:"space-between",fontSize:"0.75rem",color:"#888",borderBottom:"1px solid #333",background:"#1a1a1a"},children:[c.jsxs("span",{children:["Range: ~",ee,"m"]}),c.jsx("span",{style:{fontSize:"0.65rem",color:"#555"},children:"Scroll to zoom"})]}),c.jsx("canvas",{ref:p,width:q,height:q,style:{display:"block",margin:"0 auto",borderBottom:"1px solid #333",cursor:"crosshair",flexShrink:0},onWheel:Q,onClick:D}),c.jsxs("div",{style:{flex:1,overflowY:"auto",fontSize:"0.72rem",minHeight:0},children:[c.jsxs("div",{style:{display:"flex",padding:"3px 6px",borderBottom:"1px solid #333",color:"#666",fontSize:"0.65rem",fontWeight:600},children:[c.jsx("span",{style:{width:8}}),c.jsx("span",{style:{flex:1,marginLeft:6},children:"Name"}),c.jsx("span",{style:{width:55,textAlign:"left"},children:"Type"}),c.jsx("span",{style:{width:40,textAlign:"right"},children:"Dist"}),c.jsx("span",{style:{width:24,textAlign:"center"},children:"Dir"})]}),U.length===0&&c.jsx("div",{style:{padding:12,color:"#555",textAlign:"center",fontSize:"0.7rem"},children:"Waiting for radar data..."}),U.map(n=>{const e=n.object_class??n.type??"",o=K[e]??"#888",s=n.id===E;return c.jsxs("div",{onClick:()=>L(s?null:n.id),style:{display:"flex",alignItems:"center",padding:"2px 6px",borderBottom:"1px solid #1a1a1a",cursor:"pointer",color:"#ccc",background:s?"#1a2a3a":"",borderLeft:s?"2px solid #4488ff":"2px solid transparent"},children:[c.jsx("span",{style:{width:8,height:8,borderRadius:"50%",background:o,flexShrink:0}}),c.jsx("span",{style:{flex:1,marginLeft:6,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:n.name}),c.jsx("span",{style:{width:55,color:"#888",fontSize:"0.65rem"},children:e}),c.jsx("span",{style:{width:40,textAlign:"right",fontVariantNumeric:"tabular-nums"},children:n.dist<1e3?`${Math.round(n.dist)}m`:`${(n.dist/1e3).toFixed(1)}km`}),c.jsx("span",{style:{width:24,textAlign:"center",color:"#666"},children:n.dir})]},n.id)})]})]})};export{fe as RadarWindow}; diff --git a/static/assets/StatsWindow-CEonyugb.js b/static/assets/StatsWindow-CdjmDpA0.js similarity index 93% rename from static/assets/StatsWindow-CEonyugb.js rename to static/assets/StatsWindow-CdjmDpA0.js index e6ce940d..e4d6c395 100644 --- a/static/assets/StatsWindow-CEonyugb.js +++ b/static/assets/StatsWindow-CdjmDpA0.js @@ -1 +1 @@ -import{r as o,j as t,D as d}from"./index-YQnl0KV7.js";import"./react-yfL0ty4i.js";const c=[{title:"Kills per Hour",id:1},{title:"Memory (MB)",id:2},{title:"CPU (%)",id:3},{title:"Mem Handles",id:4}],m=[{label:"1H",value:"now-1h"},{label:"6H",value:"now-6h"},{label:"24H",value:"now-24h"},{label:"7D",value:"now-7d"}],v=({id:s,charName:a,zIndex:i})=>{const[l,r]=o.useState("now-24h"),n=e=>`/grafana/d-solo/dereth-tracker/dereth-tracker-dashboard?panelId=${e}&var-character=${encodeURIComponent(a)}&from=${l}&to=now&theme=light`;return t.jsxs(d,{id:s,title:`Stats: ${a}`,zIndex:i,width:750,height:480,children:[t.jsx("div",{className:"ml-stats-controls",children:m.map(e=>t.jsx("button",{className:`ml-stats-range-btn ${l===e.value?"active":""}`,onClick:()=>r(e.value),children:e.label},e.value))}),t.jsx("div",{className:"ml-stats-grid",children:c.map(e=>t.jsx("div",{className:"ml-stats-panel",children:t.jsx("iframe",{src:n(e.id),width:"100%",height:"100%",frameBorder:"0",title:e.title})},e.id))})]})};export{v as StatsWindow}; +import{r as o,j as t,D as d}from"./index-Dg_ifawe.js";import"./react-yfL0ty4i.js";const c=[{title:"Kills per Hour",id:1},{title:"Memory (MB)",id:2},{title:"CPU (%)",id:3},{title:"Mem Handles",id:4}],m=[{label:"1H",value:"now-1h"},{label:"6H",value:"now-6h"},{label:"24H",value:"now-24h"},{label:"7D",value:"now-7d"}],v=({id:s,charName:a,zIndex:i})=>{const[l,r]=o.useState("now-24h"),n=e=>`/grafana/d-solo/dereth-tracker/dereth-tracker-dashboard?panelId=${e}&var-character=${encodeURIComponent(a)}&from=${l}&to=now&theme=light`;return t.jsxs(d,{id:s,title:`Stats: ${a}`,zIndex:i,width:750,height:480,children:[t.jsx("div",{className:"ml-stats-controls",children:m.map(e=>t.jsx("button",{className:`ml-stats-range-btn ${l===e.value?"active":""}`,onClick:()=>r(e.value),children:e.label},e.value))}),t.jsx("div",{className:"ml-stats-grid",children:c.map(e=>t.jsx("div",{className:"ml-stats-panel",children:t.jsx("iframe",{src:n(e.id),width:"100%",height:"100%",frameBorder:"0",title:e.title})},e.id))})]})};export{v as StatsWindow}; diff --git a/static/assets/VitalSharingWindow-DNhSox3R.js b/static/assets/VitalSharingWindow-iv2L5kit.js similarity index 97% rename from static/assets/VitalSharingWindow-DNhSox3R.js rename to static/assets/VitalSharingWindow-iv2L5kit.js index aaea21cb..33ed4242 100644 --- a/static/assets/VitalSharingWindow-DNhSox3R.js +++ b/static/assets/VitalSharingWindow-iv2L5kit.js @@ -1 +1 @@ -import{r as n,j as t,D as x,a as m}from"./index-YQnl0KV7.js";import"./react-yfL0ty4i.js";const v=({id:o,zIndex:c})=>{const[a,d]=n.useState([]);n.useEffect(()=>{const e=async()=>{try{const s=await m("/vital-sharing/peers");d(s.peers??[])}catch{}};e();const l=setInterval(e,5e3);return()=>clearInterval(l)},[]);const h=(e,l)=>l>0?Math.min(100,e/l*100):0;return t.jsx(x,{id:o,title:"Vital Sharing Network",zIndex:c,width:520,height:450,children:t.jsx("div",{style:{flex:1,overflowY:"auto",padding:6,fontSize:"0.75rem"},children:a.length===0?t.jsx("div",{style:{padding:16,color:"#666",textAlign:"center"},children:"No vital-sharing peers connected"}):a.map(e=>{var l,s,r;return t.jsxs("div",{style:{padding:"6px 8px",marginBottom:4,background:"#1f1f1f",borderRadius:3,border:"1px solid #333"},children:[t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,marginBottom:3},children:[t.jsx("span",{style:{color:e.plugin_connected?"#4c4":"#a33",fontSize:"0.8rem"},children:"●"}),t.jsx("strong",{style:{flex:1},children:e.character_name}),e.subscribed&&t.jsx("span",{style:{color:"#6bf",fontSize:"0.65rem"},children:"[subscribed]"})]}),t.jsxs("div",{style:{color:"#666",fontSize:"0.68rem",marginBottom:3},children:["tags: ",((l=e.tags)==null?void 0:l.join(", "))||"none"]}),e.vitals&&e.vitals.max_health>0&&t.jsx("div",{style:{display:"flex",flexDirection:"column",gap:2},children:[{label:"HP",cur:e.vitals.current_health,max:e.vitals.max_health,bg:"#330000",fill:"#c44"},{label:"STA",cur:e.vitals.current_stamina,max:e.vitals.max_stamina,bg:"#331a00",fill:"#ca0"},{label:"MANA",cur:e.vitals.current_mana,max:e.vitals.max_mana,bg:"#001433",fill:"#48f"}].map(i=>t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:4},children:[t.jsx("span",{style:{width:32,color:"#888",fontSize:"0.65rem"},children:i.label}),t.jsx("div",{style:{flex:1,height:6,background:i.bg,borderRadius:3,overflow:"hidden"},children:t.jsx("div",{style:{width:`${h(i.cur,i.max)}%`,height:"100%",background:i.fill,borderRadius:3}})}),t.jsxs("span",{style:{width:60,textAlign:"right",fontSize:"0.65rem",color:"#888"},children:[i.cur,"/",i.max]})]},i.label))}),e.position&&t.jsxs("div",{style:{color:"#555",fontSize:"0.65rem",marginTop:2},children:[(s=e.position.ns)==null?void 0:s.toFixed(1),"N, ",(r=e.position.ew)==null?void 0:r.toFixed(1),"E"]})]},e.character_name)})})})};export{v as VitalSharingWindow}; +import{r as n,j as t,D as x,a as m}from"./index-Dg_ifawe.js";import"./react-yfL0ty4i.js";const v=({id:o,zIndex:c})=>{const[a,d]=n.useState([]);n.useEffect(()=>{const e=async()=>{try{const s=await m("/vital-sharing/peers");d(s.peers??[])}catch{}};e();const l=setInterval(e,5e3);return()=>clearInterval(l)},[]);const h=(e,l)=>l>0?Math.min(100,e/l*100):0;return t.jsx(x,{id:o,title:"Vital Sharing Network",zIndex:c,width:520,height:450,children:t.jsx("div",{style:{flex:1,overflowY:"auto",padding:6,fontSize:"0.75rem"},children:a.length===0?t.jsx("div",{style:{padding:16,color:"#666",textAlign:"center"},children:"No vital-sharing peers connected"}):a.map(e=>{var l,s,r;return t.jsxs("div",{style:{padding:"6px 8px",marginBottom:4,background:"#1f1f1f",borderRadius:3,border:"1px solid #333"},children:[t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,marginBottom:3},children:[t.jsx("span",{style:{color:e.plugin_connected?"#4c4":"#a33",fontSize:"0.8rem"},children:"●"}),t.jsx("strong",{style:{flex:1},children:e.character_name}),e.subscribed&&t.jsx("span",{style:{color:"#6bf",fontSize:"0.65rem"},children:"[subscribed]"})]}),t.jsxs("div",{style:{color:"#666",fontSize:"0.68rem",marginBottom:3},children:["tags: ",((l=e.tags)==null?void 0:l.join(", "))||"none"]}),e.vitals&&e.vitals.max_health>0&&t.jsx("div",{style:{display:"flex",flexDirection:"column",gap:2},children:[{label:"HP",cur:e.vitals.current_health,max:e.vitals.max_health,bg:"#330000",fill:"#c44"},{label:"STA",cur:e.vitals.current_stamina,max:e.vitals.max_stamina,bg:"#331a00",fill:"#ca0"},{label:"MANA",cur:e.vitals.current_mana,max:e.vitals.max_mana,bg:"#001433",fill:"#48f"}].map(i=>t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:4},children:[t.jsx("span",{style:{width:32,color:"#888",fontSize:"0.65rem"},children:i.label}),t.jsx("div",{style:{flex:1,height:6,background:i.bg,borderRadius:3,overflow:"hidden"},children:t.jsx("div",{style:{width:`${h(i.cur,i.max)}%`,height:"100%",background:i.fill,borderRadius:3}})}),t.jsxs("span",{style:{width:60,textAlign:"right",fontSize:"0.65rem",color:"#888"},children:[i.cur,"/",i.max]})]},i.label))}),e.position&&t.jsxs("div",{style:{color:"#555",fontSize:"0.65rem",marginTop:2},children:[(s=e.position.ns)==null?void 0:s.toFixed(1),"N, ",(r=e.position.ew)==null?void 0:r.toFixed(1),"E"]})]},e.character_name)})})})};export{v as VitalSharingWindow}; diff --git a/static/assets/index-Dg_ifawe.js b/static/assets/index-Dg_ifawe.js new file mode 100644 index 00000000..a5e2e5c5 --- /dev/null +++ b/static/assets/index-Dg_ifawe.js @@ -0,0 +1,34 @@ +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/StatsWindow-CdjmDpA0.js","assets/react-yfL0ty4i.js","assets/CharacterWindow-CJqV0b5w.js","assets/InventoryWindow-tZ7lQtZ6.js","assets/RadarWindow-7bg8dbys.js","assets/CombatStatsWindow-BmptnoZZ.js","assets/CombatPickerWindow-kNju07hM.js","assets/IssuesWindow-BQgY9oJz.js","assets/VitalSharingWindow-iv2L5kit.js","assets/QuestStatusWindow-Bpt0EjyP.js","assets/AgentWindow-bQ5tlleI.js","assets/AdminUsersWindow-BReYQ7Y-.js"])))=>i.map(i=>d[i]); +import{r as wd,g as T0,a as E0}from"./react-yfL0ty4i.js";(function(){const r=document.createElement("link").relList;if(r&&r.supports&&r.supports("modulepreload"))return;for(const x of document.querySelectorAll('link[rel="modulepreload"]'))o(x);new MutationObserver(x=>{for(const j of x)if(j.type==="childList")for(const M of j.addedNodes)M.tagName==="LINK"&&M.rel==="modulepreload"&&o(M)}).observe(document,{childList:!0,subtree:!0});function m(x){const j={};return x.integrity&&(j.integrity=x.integrity),x.referrerPolicy&&(j.referrerPolicy=x.referrerPolicy),x.crossOrigin==="use-credentials"?j.credentials="include":x.crossOrigin==="anonymous"?j.credentials="omit":j.credentials="same-origin",j}function o(x){if(x.ep)return;x.ep=!0;const j=m(x);fetch(x.href,j)}})();var hs={exports:{}},_n={};/** + * @license React + * react-jsx-runtime.production.js + * + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var Ed;function N0(){if(Ed)return _n;Ed=1;var c=Symbol.for("react.transitional.element"),r=Symbol.for("react.fragment");function m(o,x,j){var M=null;if(j!==void 0&&(M=""+j),x.key!==void 0&&(M=""+x.key),"key"in x){j={};for(var T in x)T!=="key"&&(j[T]=x[T])}else j=x;return x=j.ref,{$$typeof:c,type:o,key:M,ref:x!==void 0?x:null,props:j}}return _n.Fragment=r,_n.jsx=m,_n.jsxs=m,_n}var Nd;function M0(){return Nd||(Nd=1,hs.exports=N0()),hs.exports}var s=M0(),g=wd();const jn=T0(g);var ys={exports:{}},zn={},vs={exports:{}},gs={};/** + * @license React + * scheduler.production.js + * + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var Md;function C0(){return Md||(Md=1,(function(c){function r(_,H){var Q=_.length;_.push(H);t:for(;0>>1,X=_[Y];if(0>>1;Yx(et,Q))Btx(El,et)?(_[Y]=El,_[Bt]=Q,Y=Bt):(_[Y]=et,_[dt]=Q,Y=dt);else if(Btx(El,Q))_[Y]=El,_[Bt]=Q,Y=Bt;else break t}}return H}function x(_,H){var Q=_.sortIndex-H.sortIndex;return Q!==0?Q:_.id-H.id}if(c.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var j=performance;c.unstable_now=function(){return j.now()}}else{var M=Date,T=M.now();c.unstable_now=function(){return M.now()-T}}var y=[],A=[],B=1,p=null,E=3,R=!1,L=!1,$=!1,at=!1,U=typeof setTimeout=="function"?setTimeout:null,q=typeof clearTimeout=="function"?clearTimeout:null,w=typeof setImmediate<"u"?setImmediate:null;function St(_){for(var H=m(A);H!==null;){if(H.callback===null)o(A);else if(H.startTime<=_)o(A),H.sortIndex=H.expirationTime,r(y,H);else break;H=m(A)}}function Mt(_){if($=!1,St(_),!L)if(m(y)!==null)L=!0,F||(F=!0,jt());else{var H=m(A);H!==null&&xl(Mt,H.startTime-_)}}var F=!1,lt=-1,Z=5,J=-1;function P(){return at?!0:!(c.unstable_now()-J_&&P());){var Y=p.callback;if(typeof Y=="function"){p.callback=null,E=p.priorityLevel;var X=Y(p.expirationTime<=_);if(_=c.unstable_now(),typeof X=="function"){p.callback=X,St(_),H=!0;break l}p===m(y)&&o(y),St(_)}else o(y);p=m(y)}if(p!==null)H=!0;else{var ot=m(A);ot!==null&&xl(Mt,ot.startTime-_),H=!1}}break t}finally{p=null,E=Q,R=!1}H=void 0}}finally{H?jt():F=!1}}}var jt;if(typeof w=="function")jt=function(){w(Rt)};else if(typeof MessageChannel<"u"){var Ol=new MessageChannel,Tl=Ol.port2;Ol.port1.onmessage=Rt,jt=function(){Tl.postMessage(null)}}else jt=function(){U(Rt,0)};function xl(_,H){lt=U(function(){_(c.unstable_now())},H)}c.unstable_IdlePriority=5,c.unstable_ImmediatePriority=1,c.unstable_LowPriority=4,c.unstable_NormalPriority=3,c.unstable_Profiling=null,c.unstable_UserBlockingPriority=2,c.unstable_cancelCallback=function(_){_.callback=null},c.unstable_forceFrameRate=function(_){0>_||125<_?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):Z=0<_?Math.floor(1e3/_):5},c.unstable_getCurrentPriorityLevel=function(){return E},c.unstable_next=function(_){switch(E){case 1:case 2:case 3:var H=3;break;default:H=E}var Q=E;E=H;try{return _()}finally{E=Q}},c.unstable_requestPaint=function(){at=!0},c.unstable_runWithPriority=function(_,H){switch(_){case 1:case 2:case 3:case 4:case 5:break;default:_=3}var Q=E;E=_;try{return H()}finally{E=Q}},c.unstable_scheduleCallback=function(_,H,Q){var Y=c.unstable_now();switch(typeof Q=="object"&&Q!==null?(Q=Q.delay,Q=typeof Q=="number"&&0Y?(_.sortIndex=Q,r(A,_),m(y)===null&&_===m(A)&&($?(q(lt),lt=-1):$=!0,xl(Mt,Q-Y))):(_.sortIndex=X,r(y,_),L||R||(L=!0,F||(F=!0,jt()))),_},c.unstable_shouldYield=P,c.unstable_wrapCallback=function(_){var H=E;return function(){var Q=E;E=H;try{return _.apply(this,arguments)}finally{E=Q}}}})(gs)),gs}var Cd;function D0(){return Cd||(Cd=1,vs.exports=C0()),vs.exports}/** + * @license React + * react-dom-client.production.js + * + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var Dd;function O0(){if(Dd)return zn;Dd=1;var c=D0(),r=wd(),m=E0();function o(t){var l="https://react.dev/errors/"+t;if(1X||(t.current=Y[X],Y[X]=null,X--)}function et(t,l){X++,Y[X]=t.current,t.current=l}var Bt=ot(null),El=ot(null),Fl=ot(null),En=ot(null);function Nn(t,l){switch(et(Fl,l),et(El,t),et(Bt,null),l.nodeType){case 9:case 11:t=(t=l.documentElement)&&(t=t.namespaceURI)?$o(t):0;break;default:if(t=l.tagName,l=l.namespaceURI)l=$o(l),t=Fo(l,t);else switch(t){case"svg":t=1;break;case"math":t=2;break;default:t=0}}dt(Bt),et(Bt,t)}function Qe(){dt(Bt),dt(El),dt(Fl)}function Wu(t){t.memoizedState!==null&&et(En,t);var l=Bt.current,e=Fo(l,t.type);l!==e&&(et(El,t),et(Bt,e))}function Mn(t){El.current===t&&(dt(Bt),dt(El)),En.current===t&&(dt(En),pn._currentValue=Q)}var $u,js;function Ae(t){if($u===void 0)try{throw Error()}catch(e){var l=e.stack.trim().match(/\n( *(at )?)/);$u=l&&l[1]||"",js=-1)":-1n||d[a]!==S[n]){var C=` +`+d[a].replace(" at new "," at ");return t.displayName&&C.includes("")&&(C=C.replace("",t.displayName)),C}while(1<=a&&0<=n);break}}}finally{Fu=!1,Error.prepareStackTrace=e}return(e=t?t.displayName||t.name:"")?Ae(e):""}function am(t,l){switch(t.tag){case 26:case 27:case 5:return Ae(t.type);case 16:return Ae("Lazy");case 13:return t.child!==l&&l!==null?Ae("Suspense Fallback"):Ae("Suspense");case 19:return Ae("SuspenseList");case 0:case 15:return Iu(t.type,!1);case 11:return Iu(t.type.render,!1);case 1:return Iu(t.type,!0);case 31:return Ae("Activity");default:return""}}function As(t){try{var l="",e=null;do l+=am(t,e),e=t,t=t.return;while(t);return l}catch(a){return` +Error generating stack: `+a.message+` +`+a.stack}}var Pu=Object.prototype.hasOwnProperty,ti=c.unstable_scheduleCallback,li=c.unstable_cancelCallback,nm=c.unstable_shouldYield,um=c.unstable_requestPaint,Pt=c.unstable_now,im=c.unstable_getCurrentPriorityLevel,Ts=c.unstable_ImmediatePriority,Es=c.unstable_UserBlockingPriority,Cn=c.unstable_NormalPriority,cm=c.unstable_LowPriority,Ns=c.unstable_IdlePriority,sm=c.log,fm=c.unstable_setDisableYieldValue,Ma=null,tl=null;function Il(t){if(typeof sm=="function"&&fm(t),tl&&typeof tl.setStrictMode=="function")try{tl.setStrictMode(Ma,t)}catch{}}var ll=Math.clz32?Math.clz32:dm,rm=Math.log,om=Math.LN2;function dm(t){return t>>>=0,t===0?32:31-(rm(t)/om|0)|0}var Dn=256,On=262144,Un=4194304;function Te(t){var l=t&42;if(l!==0)return l;switch(t&-t){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return t&261888;case 262144:case 524288:case 1048576:case 2097152:return t&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return t&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return t}}function Rn(t,l,e){var a=t.pendingLanes;if(a===0)return 0;var n=0,u=t.suspendedLanes,i=t.pingedLanes;t=t.warmLanes;var f=a&134217727;return f!==0?(a=f&~u,a!==0?n=Te(a):(i&=f,i!==0?n=Te(i):e||(e=f&~t,e!==0&&(n=Te(e))))):(f=a&~u,f!==0?n=Te(f):i!==0?n=Te(i):e||(e=a&~t,e!==0&&(n=Te(e)))),n===0?0:l!==0&&l!==n&&(l&u)===0&&(u=n&-n,e=l&-l,u>=e||u===32&&(e&4194048)!==0)?l:n}function Ca(t,l){return(t.pendingLanes&~(t.suspendedLanes&~t.pingedLanes)&l)===0}function mm(t,l){switch(t){case 1:case 2:case 4:case 8:case 64:return l+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return l+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Ms(){var t=Un;return Un<<=1,(Un&62914560)===0&&(Un=4194304),t}function ei(t){for(var l=[],e=0;31>e;e++)l.push(t);return l}function Da(t,l){t.pendingLanes|=l,l!==268435456&&(t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0)}function hm(t,l,e,a,n,u){var i=t.pendingLanes;t.pendingLanes=e,t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0,t.expiredLanes&=e,t.entangledLanes&=e,t.errorRecoveryDisabledLanes&=e,t.shellSuspendCounter=0;var f=t.entanglements,d=t.expirationTimes,S=t.hiddenUpdates;for(e=i&~e;0"u")return null;try{return t.activeElement||t.body}catch{return t.body}}var Sm=/[\n"\\]/g;function rl(t){return t.replace(Sm,function(l){return"\\"+l.charCodeAt(0).toString(16)+" "})}function si(t,l,e,a,n,u,i,f){t.name="",i!=null&&typeof i!="function"&&typeof i!="symbol"&&typeof i!="boolean"?t.type=i:t.removeAttribute("type"),l!=null?i==="number"?(l===0&&t.value===""||t.value!=l)&&(t.value=""+fl(l)):t.value!==""+fl(l)&&(t.value=""+fl(l)):i!=="submit"&&i!=="reset"||t.removeAttribute("value"),l!=null?fi(t,i,fl(l)):e!=null?fi(t,i,fl(e)):a!=null&&t.removeAttribute("value"),n==null&&u!=null&&(t.defaultChecked=!!u),n!=null&&(t.checked=n&&typeof n!="function"&&typeof n!="symbol"),f!=null&&typeof f!="function"&&typeof f!="symbol"&&typeof f!="boolean"?t.name=""+fl(f):t.removeAttribute("name")}function ws(t,l,e,a,n,u,i,f){if(u!=null&&typeof u!="function"&&typeof u!="symbol"&&typeof u!="boolean"&&(t.type=u),l!=null||e!=null){if(!(u!=="submit"&&u!=="reset"||l!=null)){ci(t);return}e=e!=null?""+fl(e):"",l=l!=null?""+fl(l):e,f||l===t.value||(t.value=l),t.defaultValue=l}a=a??n,a=typeof a!="function"&&typeof a!="symbol"&&!!a,t.checked=f?t.checked:!!a,t.defaultChecked=!!a,i!=null&&typeof i!="function"&&typeof i!="symbol"&&typeof i!="boolean"&&(t.name=i),ci(t)}function fi(t,l,e){l==="number"&&Hn(t.ownerDocument)===t||t.defaultValue===""+e||(t.defaultValue=""+e)}function $e(t,l,e,a){if(t=t.options,l){l={};for(var n=0;n"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),hi=!1;if(ql)try{var qa={};Object.defineProperty(qa,"passive",{get:function(){hi=!0}}),window.addEventListener("test",qa,qa),window.removeEventListener("test",qa,qa)}catch{hi=!1}var te=null,yi=null,Yn=null;function Ws(){if(Yn)return Yn;var t,l=yi,e=l.length,a,n="value"in te?te.value:te.textContent,u=n.length;for(t=0;t=La),lf=" ",ef=!1;function af(t,l){switch(t){case"keyup":return Jm.indexOf(l.keyCode)!==-1;case"keydown":return l.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function nf(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var ta=!1;function $m(t,l){switch(t){case"compositionend":return nf(l);case"keypress":return l.which!==32?null:(ef=!0,lf);case"textInput":return t=l.data,t===lf&&ef?null:t;default:return null}}function Fm(t,l){if(ta)return t==="compositionend"||!Si&&af(t,l)?(t=Ws(),Yn=yi=te=null,ta=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(l.ctrlKey||l.altKey||l.metaKey)||l.ctrlKey&&l.altKey){if(l.char&&1=l)return{node:e,offset:l-t};t=a}t:{for(;e;){if(e.nextSibling){e=e.nextSibling;break t}e=e.parentNode}e=void 0}e=mf(e)}}function yf(t,l){return t&&l?t===l?!0:t&&t.nodeType===3?!1:l&&l.nodeType===3?yf(t,l.parentNode):"contains"in t?t.contains(l):t.compareDocumentPosition?!!(t.compareDocumentPosition(l)&16):!1:!1}function vf(t){t=t!=null&&t.ownerDocument!=null&&t.ownerDocument.defaultView!=null?t.ownerDocument.defaultView:window;for(var l=Hn(t.document);l instanceof t.HTMLIFrameElement;){try{var e=typeof l.contentWindow.location.href=="string"}catch{e=!1}if(e)t=l.contentWindow;else break;l=Hn(t.document)}return l}function zi(t){var l=t&&t.nodeName&&t.nodeName.toLowerCase();return l&&(l==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||l==="textarea"||t.contentEditable==="true")}var uh=ql&&"documentMode"in document&&11>=document.documentMode,la=null,ji=null,wa=null,Ai=!1;function gf(t,l,e){var a=e.window===e?e.document:e.nodeType===9?e:e.ownerDocument;Ai||la==null||la!==Hn(a)||(a=la,"selectionStart"in a&&zi(a)?a={start:a.selectionStart,end:a.selectionEnd}:(a=(a.ownerDocument&&a.ownerDocument.defaultView||window).getSelection(),a={anchorNode:a.anchorNode,anchorOffset:a.anchorOffset,focusNode:a.focusNode,focusOffset:a.focusOffset}),wa&&Xa(wa,a)||(wa=a,a=Ou(ji,"onSelect"),0>=i,n-=i,Nl=1<<32-ll(l)+n|e<tt?(ct=G,G=null):ct=G.sibling;var rt=z(v,G,b[tt],D);if(rt===null){G===null&&(G=ct);break}t&&G&&rt.alternate===null&&l(v,G),h=u(rt,h,tt),ft===null?K=rt:ft.sibling=rt,ft=rt,G=ct}if(tt===b.length)return e(v,G),st&&Hl(v,tt),K;if(G===null){for(;tttt?(ct=G,G=null):ct=G.sibling;var _e=z(v,G,rt.value,D);if(_e===null){G===null&&(G=ct);break}t&&G&&_e.alternate===null&&l(v,G),h=u(_e,h,tt),ft===null?K=_e:ft.sibling=_e,ft=_e,G=ct}if(rt.done)return e(v,G),st&&Hl(v,tt),K;if(G===null){for(;!rt.done;tt++,rt=b.next())rt=O(v,rt.value,D),rt!==null&&(h=u(rt,h,tt),ft===null?K=rt:ft.sibling=rt,ft=rt);return st&&Hl(v,tt),K}for(G=a(G);!rt.done;tt++,rt=b.next())rt=N(G,v,tt,rt.value,D),rt!==null&&(t&&rt.alternate!==null&&G.delete(rt.key===null?tt:rt.key),h=u(rt,h,tt),ft===null?K=rt:ft.sibling=rt,ft=rt);return t&&G.forEach(function(A0){return l(v,A0)}),st&&Hl(v,tt),K}function pt(v,h,b,D){if(typeof b=="object"&&b!==null&&b.type===$&&b.key===null&&(b=b.props.children),typeof b=="object"&&b!==null){switch(b.$$typeof){case R:t:{for(var K=b.key;h!==null;){if(h.key===K){if(K=b.type,K===$){if(h.tag===7){e(v,h.sibling),D=n(h,b.props.children),D.return=v,v=D;break t}}else if(h.elementType===K||typeof K=="object"&&K!==null&&K.$$typeof===Z&&He(K)===h.type){e(v,h.sibling),D=n(h,b.props),Ja(D,b),D.return=v,v=D;break t}e(v,h);break}else l(v,h);h=h.sibling}b.type===$?(D=Oe(b.props.children,v.mode,D,b.key),D.return=v,v=D):(D=Wn(b.type,b.key,b.props,null,v.mode,D),Ja(D,b),D.return=v,v=D)}return i(v);case L:t:{for(K=b.key;h!==null;){if(h.key===K)if(h.tag===4&&h.stateNode.containerInfo===b.containerInfo&&h.stateNode.implementation===b.implementation){e(v,h.sibling),D=n(h,b.children||[]),D.return=v,v=D;break t}else{e(v,h);break}else l(v,h);h=h.sibling}D=Oi(b,v.mode,D),D.return=v,v=D}return i(v);case Z:return b=He(b),pt(v,h,b,D)}if(xl(b))return V(v,h,b,D);if(jt(b)){if(K=jt(b),typeof K!="function")throw Error(o(150));return b=K.call(b),k(v,h,b,D)}if(typeof b.then=="function")return pt(v,h,eu(b),D);if(b.$$typeof===w)return pt(v,h,In(v,b),D);au(v,b)}return typeof b=="string"&&b!==""||typeof b=="number"||typeof b=="bigint"?(b=""+b,h!==null&&h.tag===6?(e(v,h.sibling),D=n(h,b),D.return=v,v=D):(e(v,h),D=Di(b,v.mode,D),D.return=v,v=D),i(v)):e(v,h)}return function(v,h,b,D){try{ka=0;var K=pt(v,h,b,D);return da=null,K}catch(G){if(G===oa||G===tu)throw G;var ft=al(29,G,null,v.mode);return ft.lanes=D,ft.return=v,ft}finally{}}}var Ye=Vf(!0),Xf=Vf(!1),ue=!1;function Qi(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Zi(t,l){t=t.updateQueue,l.updateQueue===t&&(l.updateQueue={baseState:t.baseState,firstBaseUpdate:t.firstBaseUpdate,lastBaseUpdate:t.lastBaseUpdate,shared:t.shared,callbacks:null})}function ie(t){return{lane:t,tag:0,payload:null,callback:null,next:null}}function ce(t,l,e){var a=t.updateQueue;if(a===null)return null;if(a=a.shared,(mt&2)!==0){var n=a.pending;return n===null?l.next=l:(l.next=n.next,n.next=l),a.pending=l,l=Jn(t),jf(t,null,e),l}return kn(t,a,l,e),Jn(t)}function Wa(t,l,e){if(l=l.updateQueue,l!==null&&(l=l.shared,(e&4194048)!==0)){var a=l.lanes;a&=t.pendingLanes,e|=a,l.lanes=e,Ds(t,e)}}function Ki(t,l){var e=t.updateQueue,a=t.alternate;if(a!==null&&(a=a.updateQueue,e===a)){var n=null,u=null;if(e=e.firstBaseUpdate,e!==null){do{var i={lane:e.lane,tag:e.tag,payload:e.payload,callback:null,next:null};u===null?n=u=i:u=u.next=i,e=e.next}while(e!==null);u===null?n=u=l:u=u.next=l}else n=u=l;e={baseState:a.baseState,firstBaseUpdate:n,lastBaseUpdate:u,shared:a.shared,callbacks:a.callbacks},t.updateQueue=e;return}t=e.lastBaseUpdate,t===null?e.firstBaseUpdate=l:t.next=l,e.lastBaseUpdate=l}var ki=!1;function $a(){if(ki){var t=ra;if(t!==null)throw t}}function Fa(t,l,e,a){ki=!1;var n=t.updateQueue;ue=!1;var u=n.firstBaseUpdate,i=n.lastBaseUpdate,f=n.shared.pending;if(f!==null){n.shared.pending=null;var d=f,S=d.next;d.next=null,i===null?u=S:i.next=S,i=d;var C=t.alternate;C!==null&&(C=C.updateQueue,f=C.lastBaseUpdate,f!==i&&(f===null?C.firstBaseUpdate=S:f.next=S,C.lastBaseUpdate=d))}if(u!==null){var O=n.baseState;i=0,C=S=d=null,f=u;do{var z=f.lane&-536870913,N=z!==f.lane;if(N?(it&z)===z:(a&z)===z){z!==0&&z===fa&&(ki=!0),C!==null&&(C=C.next={lane:0,tag:f.tag,payload:f.payload,callback:null,next:null});t:{var V=t,k=f;z=l;var pt=e;switch(k.tag){case 1:if(V=k.payload,typeof V=="function"){O=V.call(pt,O,z);break t}O=V;break t;case 3:V.flags=V.flags&-65537|128;case 0:if(V=k.payload,z=typeof V=="function"?V.call(pt,O,z):V,z==null)break t;O=p({},O,z);break t;case 2:ue=!0}}z=f.callback,z!==null&&(t.flags|=64,N&&(t.flags|=8192),N=n.callbacks,N===null?n.callbacks=[z]:N.push(z))}else N={lane:z,tag:f.tag,payload:f.payload,callback:f.callback,next:null},C===null?(S=C=N,d=O):C=C.next=N,i|=z;if(f=f.next,f===null){if(f=n.shared.pending,f===null)break;N=f,f=N.next,N.next=null,n.lastBaseUpdate=N,n.shared.pending=null}}while(!0);C===null&&(d=O),n.baseState=d,n.firstBaseUpdate=S,n.lastBaseUpdate=C,u===null&&(n.shared.lanes=0),de|=i,t.lanes=i,t.memoizedState=O}}function wf(t,l){if(typeof t!="function")throw Error(o(191,t));t.call(l)}function Gf(t,l){var e=t.callbacks;if(e!==null)for(t.callbacks=null,t=0;tu?u:8;var i=_.T,f={};_.T=f,dc(t,!1,l,e);try{var d=n(),S=_.S;if(S!==null&&S(f,d),d!==null&&typeof d=="object"&&typeof d.then=="function"){var C=hh(d,a);tn(t,l,C,sl(t))}else tn(t,l,a,sl(t))}catch(O){tn(t,l,{then:function(){},status:"rejected",reason:O},sl())}finally{H.p=u,i!==null&&f.types!==null&&(i.types=f.types),_.T=i}}function Sh(){}function rc(t,l,e,a){if(t.tag!==5)throw Error(o(476));var n=xr(t).queue;Sr(t,n,l,Q,e===null?Sh:function(){return _r(t),e(a)})}function xr(t){var l=t.memoizedState;if(l!==null)return l;l={memoizedState:Q,baseState:Q,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Xl,lastRenderedState:Q},next:null};var e={};return l.next={memoizedState:e,baseState:e,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Xl,lastRenderedState:e},next:null},t.memoizedState=l,t=t.alternate,t!==null&&(t.memoizedState=l),l}function _r(t){var l=xr(t);l.next===null&&(l=t.alternate.memoizedState),tn(t,l.next.queue,{},sl())}function oc(){return Xt(pn)}function zr(){return Nt().memoizedState}function jr(){return Nt().memoizedState}function xh(t){for(var l=t.return;l!==null;){switch(l.tag){case 24:case 3:var e=sl();t=ie(e);var a=ce(l,t,e);a!==null&&(Ft(a,l,e),Wa(a,l,e)),l={cache:Vi()},t.payload=l;return}l=l.return}}function _h(t,l,e){var a=sl();e={lane:a,revertLane:0,gesture:null,action:e,hasEagerState:!1,eagerState:null,next:null},mu(t)?Tr(l,e):(e=Mi(t,l,e,a),e!==null&&(Ft(e,t,a),Er(e,l,a)))}function Ar(t,l,e){var a=sl();tn(t,l,e,a)}function tn(t,l,e,a){var n={lane:a,revertLane:0,gesture:null,action:e,hasEagerState:!1,eagerState:null,next:null};if(mu(t))Tr(l,n);else{var u=t.alternate;if(t.lanes===0&&(u===null||u.lanes===0)&&(u=l.lastRenderedReducer,u!==null))try{var i=l.lastRenderedState,f=u(i,e);if(n.hasEagerState=!0,n.eagerState=f,el(f,i))return kn(t,l,n,0),bt===null&&Kn(),!1}catch{}finally{}if(e=Mi(t,l,n,a),e!==null)return Ft(e,t,a),Er(e,l,a),!0}return!1}function dc(t,l,e,a){if(a={lane:2,revertLane:Qc(),gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},mu(t)){if(l)throw Error(o(479))}else l=Mi(t,e,a,2),l!==null&&Ft(l,t,2)}function mu(t){var l=t.alternate;return t===I||l!==null&&l===I}function Tr(t,l){ha=iu=!0;var e=t.pending;e===null?l.next=l:(l.next=e.next,e.next=l),t.pending=l}function Er(t,l,e){if((e&4194048)!==0){var a=l.lanes;a&=t.pendingLanes,e|=a,l.lanes=e,Ds(t,e)}}var ln={readContext:Xt,use:fu,useCallback:At,useContext:At,useEffect:At,useImperativeHandle:At,useLayoutEffect:At,useInsertionEffect:At,useMemo:At,useReducer:At,useRef:At,useState:At,useDebugValue:At,useDeferredValue:At,useTransition:At,useSyncExternalStore:At,useId:At,useHostTransitionStatus:At,useFormState:At,useActionState:At,useOptimistic:At,useMemoCache:At,useCacheRefresh:At};ln.useEffectEvent=At;var Nr={readContext:Xt,use:fu,useCallback:function(t,l){return Qt().memoizedState=[t,l===void 0?null:l],t},useContext:Xt,useEffect:or,useImperativeHandle:function(t,l,e){e=e!=null?e.concat([t]):null,ou(4194308,4,yr.bind(null,l,t),e)},useLayoutEffect:function(t,l){return ou(4194308,4,t,l)},useInsertionEffect:function(t,l){ou(4,2,t,l)},useMemo:function(t,l){var e=Qt();l=l===void 0?null:l;var a=t();if(Ve){Il(!0);try{t()}finally{Il(!1)}}return e.memoizedState=[a,l],a},useReducer:function(t,l,e){var a=Qt();if(e!==void 0){var n=e(l);if(Ve){Il(!0);try{e(l)}finally{Il(!1)}}}else n=l;return a.memoizedState=a.baseState=n,t={pending:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:n},a.queue=t,t=t.dispatch=_h.bind(null,I,t),[a.memoizedState,t]},useRef:function(t){var l=Qt();return t={current:t},l.memoizedState=t},useState:function(t){t=uc(t);var l=t.queue,e=Ar.bind(null,I,l);return l.dispatch=e,[t.memoizedState,e]},useDebugValue:sc,useDeferredValue:function(t,l){var e=Qt();return fc(e,t,l)},useTransition:function(){var t=uc(!1);return t=Sr.bind(null,I,t.queue,!0,!1),Qt().memoizedState=t,[!1,t]},useSyncExternalStore:function(t,l,e){var a=I,n=Qt();if(st){if(e===void 0)throw Error(o(407));e=e()}else{if(e=l(),bt===null)throw Error(o(349));(it&127)!==0||Wf(a,l,e)}n.memoizedState=e;var u={value:e,getSnapshot:l};return n.queue=u,or(Ff.bind(null,a,u,t),[t]),a.flags|=2048,va(9,{destroy:void 0},$f.bind(null,a,u,e,l),null),e},useId:function(){var t=Qt(),l=bt.identifierPrefix;if(st){var e=Ml,a=Nl;e=(a&~(1<<32-ll(a)-1)).toString(32)+e,l="_"+l+"R_"+e,e=cu++,0<\/script>",u=u.removeChild(u.firstChild);break;case"select":u=typeof a.is=="string"?i.createElement("select",{is:a.is}):i.createElement("select"),a.multiple?u.multiple=!0:a.size&&(u.size=a.size);break;default:u=typeof a.is=="string"?i.createElement(n,{is:a.is}):i.createElement(n)}}u[Yt]=l,u[Zt]=a;t:for(i=l.child;i!==null;){if(i.tag===5||i.tag===6)u.appendChild(i.stateNode);else if(i.tag!==4&&i.tag!==27&&i.child!==null){i.child.return=i,i=i.child;continue}if(i===l)break t;for(;i.sibling===null;){if(i.return===null||i.return===l)break t;i=i.return}i.sibling.return=i.return,i=i.sibling}l.stateNode=u;t:switch(Gt(u,n,a),n){case"button":case"input":case"select":case"textarea":a=!!a.autoFocus;break t;case"img":a=!0;break t;default:a=!1}a&&Gl(l)}}return _t(l),Tc(l,l.type,t===null?null:t.memoizedProps,l.pendingProps,e),null;case 6:if(t&&l.stateNode!=null)t.memoizedProps!==a&&Gl(l);else{if(typeof a!="string"&&l.stateNode===null)throw Error(o(166));if(t=Fl.current,ca(l)){if(t=l.stateNode,e=l.memoizedProps,a=null,n=Vt,n!==null)switch(n.tag){case 27:case 5:a=n.memoizedProps}t[Yt]=l,t=!!(t.nodeValue===e||a!==null&&a.suppressHydrationWarning===!0||Jo(t.nodeValue,e)),t||ae(l,!0)}else t=Uu(t).createTextNode(a),t[Yt]=l,l.stateNode=t}return _t(l),null;case 31:if(e=l.memoizedState,t===null||t.memoizedState!==null){if(a=ca(l),e!==null){if(t===null){if(!a)throw Error(o(318));if(t=l.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(o(557));t[Yt]=l}else Ue(),(l.flags&128)===0&&(l.memoizedState=null),l.flags|=4;_t(l),t=!1}else e=Bi(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=e),t=!0;if(!t)return l.flags&256?(ul(l),l):(ul(l),null);if((l.flags&128)!==0)throw Error(o(558))}return _t(l),null;case 13:if(a=l.memoizedState,t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){if(n=ca(l),a!==null&&a.dehydrated!==null){if(t===null){if(!n)throw Error(o(318));if(n=l.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(o(317));n[Yt]=l}else Ue(),(l.flags&128)===0&&(l.memoizedState=null),l.flags|=4;_t(l),n=!1}else n=Bi(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=n),n=!0;if(!n)return l.flags&256?(ul(l),l):(ul(l),null)}return ul(l),(l.flags&128)!==0?(l.lanes=e,l):(e=a!==null,t=t!==null&&t.memoizedState!==null,e&&(a=l.child,n=null,a.alternate!==null&&a.alternate.memoizedState!==null&&a.alternate.memoizedState.cachePool!==null&&(n=a.alternate.memoizedState.cachePool.pool),u=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(u=a.memoizedState.cachePool.pool),u!==n&&(a.flags|=2048)),e!==t&&e&&(l.child.flags|=8192),pu(l,l.updateQueue),_t(l),null);case 4:return Qe(),t===null&&Jc(l.stateNode.containerInfo),_t(l),null;case 10:return Yl(l.type),_t(l),null;case 19:if(dt(Et),a=l.memoizedState,a===null)return _t(l),null;if(n=(l.flags&128)!==0,u=a.rendering,u===null)if(n)an(a,!1);else{if(Tt!==0||t!==null&&(t.flags&128)!==0)for(t=l.child;t!==null;){if(u=uu(t),u!==null){for(l.flags|=128,an(a,!1),t=u.updateQueue,l.updateQueue=t,pu(l,t),l.subtreeFlags=0,t=e,e=l.child;e!==null;)Af(e,t),e=e.sibling;return et(Et,Et.current&1|2),st&&Hl(l,a.treeForkCount),l.child}t=t.sibling}a.tail!==null&&Pt()>zu&&(l.flags|=128,n=!0,an(a,!1),l.lanes=4194304)}else{if(!n)if(t=uu(u),t!==null){if(l.flags|=128,n=!0,t=t.updateQueue,l.updateQueue=t,pu(l,t),an(a,!0),a.tail===null&&a.tailMode==="hidden"&&!u.alternate&&!st)return _t(l),null}else 2*Pt()-a.renderingStartTime>zu&&e!==536870912&&(l.flags|=128,n=!0,an(a,!1),l.lanes=4194304);a.isBackwards?(u.sibling=l.child,l.child=u):(t=a.last,t!==null?t.sibling=u:l.child=u,a.last=u)}return a.tail!==null?(t=a.tail,a.rendering=t,a.tail=t.sibling,a.renderingStartTime=Pt(),t.sibling=null,e=Et.current,et(Et,n?e&1|2:e&1),st&&Hl(l,a.treeForkCount),t):(_t(l),null);case 22:case 23:return ul(l),Wi(),a=l.memoizedState!==null,t!==null?t.memoizedState!==null!==a&&(l.flags|=8192):a&&(l.flags|=8192),a?(e&536870912)!==0&&(l.flags&128)===0&&(_t(l),l.subtreeFlags&6&&(l.flags|=8192)):_t(l),e=l.updateQueue,e!==null&&pu(l,e.retryQueue),e=null,t!==null&&t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),a=null,l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(a=l.memoizedState.cachePool.pool),a!==e&&(l.flags|=2048),t!==null&&dt(Be),null;case 24:return e=null,t!==null&&(e=t.memoizedState.cache),l.memoizedState.cache!==e&&(l.flags|=2048),Yl(Ct),_t(l),null;case 25:return null;case 30:return null}throw Error(o(156,l.tag))}function Eh(t,l){switch(Ri(l),l.tag){case 1:return t=l.flags,t&65536?(l.flags=t&-65537|128,l):null;case 3:return Yl(Ct),Qe(),t=l.flags,(t&65536)!==0&&(t&128)===0?(l.flags=t&-65537|128,l):null;case 26:case 27:case 5:return Mn(l),null;case 31:if(l.memoizedState!==null){if(ul(l),l.alternate===null)throw Error(o(340));Ue()}return t=l.flags,t&65536?(l.flags=t&-65537|128,l):null;case 13:if(ul(l),t=l.memoizedState,t!==null&&t.dehydrated!==null){if(l.alternate===null)throw Error(o(340));Ue()}return t=l.flags,t&65536?(l.flags=t&-65537|128,l):null;case 19:return dt(Et),null;case 4:return Qe(),null;case 10:return Yl(l.type),null;case 22:case 23:return ul(l),Wi(),t!==null&&dt(Be),t=l.flags,t&65536?(l.flags=t&-65537|128,l):null;case 24:return Yl(Ct),null;case 25:return null;default:return null}}function Ir(t,l){switch(Ri(l),l.tag){case 3:Yl(Ct),Qe();break;case 26:case 27:case 5:Mn(l);break;case 4:Qe();break;case 31:l.memoizedState!==null&&ul(l);break;case 13:ul(l);break;case 19:dt(Et);break;case 10:Yl(l.type);break;case 22:case 23:ul(l),Wi(),t!==null&&dt(Be);break;case 24:Yl(Ct)}}function nn(t,l){try{var e=l.updateQueue,a=e!==null?e.lastEffect:null;if(a!==null){var n=a.next;e=n;do{if((e.tag&t)===t){a=void 0;var u=e.create,i=e.inst;a=u(),i.destroy=a}e=e.next}while(e!==n)}}catch(f){yt(l,l.return,f)}}function re(t,l,e){try{var a=l.updateQueue,n=a!==null?a.lastEffect:null;if(n!==null){var u=n.next;a=u;do{if((a.tag&t)===t){var i=a.inst,f=i.destroy;if(f!==void 0){i.destroy=void 0,n=l;var d=e,S=f;try{S()}catch(C){yt(n,d,C)}}}a=a.next}while(a!==u)}}catch(C){yt(l,l.return,C)}}function Pr(t){var l=t.updateQueue;if(l!==null){var e=t.stateNode;try{Gf(l,e)}catch(a){yt(t,t.return,a)}}}function to(t,l,e){e.props=Xe(t.type,t.memoizedProps),e.state=t.memoizedState;try{e.componentWillUnmount()}catch(a){yt(t,l,a)}}function un(t,l){try{var e=t.ref;if(e!==null){switch(t.tag){case 26:case 27:case 5:var a=t.stateNode;break;case 30:a=t.stateNode;break;default:a=t.stateNode}typeof e=="function"?t.refCleanup=e(a):e.current=a}}catch(n){yt(t,l,n)}}function Cl(t,l){var e=t.ref,a=t.refCleanup;if(e!==null)if(typeof a=="function")try{a()}catch(n){yt(t,l,n)}finally{t.refCleanup=null,t=t.alternate,t!=null&&(t.refCleanup=null)}else if(typeof e=="function")try{e(null)}catch(n){yt(t,l,n)}else e.current=null}function lo(t){var l=t.type,e=t.memoizedProps,a=t.stateNode;try{t:switch(l){case"button":case"input":case"select":case"textarea":e.autoFocus&&a.focus();break t;case"img":e.src?a.src=e.src:e.srcSet&&(a.srcset=e.srcSet)}}catch(n){yt(t,t.return,n)}}function Ec(t,l,e){try{var a=t.stateNode;Wh(a,t.type,e,l),a[Zt]=l}catch(n){yt(t,t.return,n)}}function eo(t){return t.tag===5||t.tag===3||t.tag===26||t.tag===27&&ge(t.type)||t.tag===4}function Nc(t){t:for(;;){for(;t.sibling===null;){if(t.return===null||eo(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.tag===27&&ge(t.type)||t.flags&2||t.child===null||t.tag===4)continue t;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function Mc(t,l,e){var a=t.tag;if(a===5||a===6)t=t.stateNode,l?(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e).insertBefore(t,l):(l=e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,l.appendChild(t),e=e._reactRootContainer,e!=null||l.onclick!==null||(l.onclick=Rl));else if(a!==4&&(a===27&&ge(t.type)&&(e=t.stateNode,l=null),t=t.child,t!==null))for(Mc(t,l,e),t=t.sibling;t!==null;)Mc(t,l,e),t=t.sibling}function bu(t,l,e){var a=t.tag;if(a===5||a===6)t=t.stateNode,l?e.insertBefore(t,l):e.appendChild(t);else if(a!==4&&(a===27&&ge(t.type)&&(e=t.stateNode),t=t.child,t!==null))for(bu(t,l,e),t=t.sibling;t!==null;)bu(t,l,e),t=t.sibling}function ao(t){var l=t.stateNode,e=t.memoizedProps;try{for(var a=t.type,n=l.attributes;n.length;)l.removeAttributeNode(n[0]);Gt(l,a,e),l[Yt]=t,l[Zt]=e}catch(u){yt(t,t.return,u)}}var Ql=!1,Ut=!1,Cc=!1,no=typeof WeakSet=="function"?WeakSet:Set,Lt=null;function Nh(t,l){if(t=t.containerInfo,Fc=Vu,t=vf(t),zi(t)){if("selectionStart"in t)var e={start:t.selectionStart,end:t.selectionEnd};else t:{e=(e=t.ownerDocument)&&e.defaultView||window;var a=e.getSelection&&e.getSelection();if(a&&a.rangeCount!==0){e=a.anchorNode;var n=a.anchorOffset,u=a.focusNode;a=a.focusOffset;try{e.nodeType,u.nodeType}catch{e=null;break t}var i=0,f=-1,d=-1,S=0,C=0,O=t,z=null;l:for(;;){for(var N;O!==e||n!==0&&O.nodeType!==3||(f=i+n),O!==u||a!==0&&O.nodeType!==3||(d=i+a),O.nodeType===3&&(i+=O.nodeValue.length),(N=O.firstChild)!==null;)z=O,O=N;for(;;){if(O===t)break l;if(z===e&&++S===n&&(f=i),z===u&&++C===a&&(d=i),(N=O.nextSibling)!==null)break;O=z,z=O.parentNode}O=N}e=f===-1||d===-1?null:{start:f,end:d}}else e=null}e=e||{start:0,end:0}}else e=null;for(Ic={focusedElem:t,selectionRange:e},Vu=!1,Lt=l;Lt!==null;)if(l=Lt,t=l.child,(l.subtreeFlags&1028)!==0&&t!==null)t.return=l,Lt=t;else for(;Lt!==null;){switch(l=Lt,u=l.alternate,t=l.flags,l.tag){case 0:if((t&4)!==0&&(t=l.updateQueue,t=t!==null?t.events:null,t!==null))for(e=0;e title"))),Gt(u,a,e),u[Yt]=t,Ht(u),a=u;break t;case"link":var i=od("link","href",n).get(a+(e.href||""));if(i){for(var f=0;fpt&&(i=pt,pt=k,k=i);var v=hf(f,k),h=hf(f,pt);if(v&&h&&(N.rangeCount!==1||N.anchorNode!==v.node||N.anchorOffset!==v.offset||N.focusNode!==h.node||N.focusOffset!==h.offset)){var b=O.createRange();b.setStart(v.node,v.offset),N.removeAllRanges(),k>pt?(N.addRange(b),N.extend(h.node,h.offset)):(b.setEnd(h.node,h.offset),N.addRange(b))}}}}for(O=[],N=f;N=N.parentNode;)N.nodeType===1&&O.push({element:N,left:N.scrollLeft,top:N.scrollTop});for(typeof f.focus=="function"&&f.focus(),f=0;fe?32:e,_.T=null,e=Hc,Hc=null;var u=he,i=Wl;if(qt=0,xa=he=null,Wl=0,(mt&6)!==0)throw Error(o(331));var f=mt;if(mt|=4,vo(u.current),mo(u,u.current,i,e),mt=f,dn(0,!1),tl&&typeof tl.onPostCommitFiberRoot=="function")try{tl.onPostCommitFiberRoot(Ma,u)}catch{}return!0}finally{H.p=n,_.T=a,Ro(t,l)}}function Bo(t,l,e){l=dl(e,l),l=vc(t.stateNode,l,2),t=ce(t,l,2),t!==null&&(Da(t,2),Dl(t))}function yt(t,l,e){if(t.tag===3)Bo(t,t,e);else for(;l!==null;){if(l.tag===3){Bo(l,t,e);break}else if(l.tag===1){var a=l.stateNode;if(typeof l.type.getDerivedStateFromError=="function"||typeof a.componentDidCatch=="function"&&(me===null||!me.has(a))){t=dl(e,t),e=Br(2),a=ce(l,e,2),a!==null&&(Hr(e,a,l,t),Da(a,2),Dl(a));break}}l=l.return}}function Xc(t,l,e){var a=t.pingCache;if(a===null){a=t.pingCache=new Dh;var n=new Set;a.set(l,n)}else n=a.get(l),n===void 0&&(n=new Set,a.set(l,n));n.has(e)||(Uc=!0,n.add(e),t=Bh.bind(null,t,l,e),l.then(t,t))}function Bh(t,l,e){var a=t.pingCache;a!==null&&a.delete(l),t.pingedLanes|=t.suspendedLanes&e,t.warmLanes&=~e,bt===t&&(it&e)===e&&(Tt===4||Tt===3&&(it&62914560)===it&&300>Pt()-_u?(mt&2)===0&&_a(t,0):Rc|=e,Sa===it&&(Sa=0)),Dl(t)}function Ho(t,l){l===0&&(l=Ms()),t=De(t,l),t!==null&&(Da(t,l),Dl(t))}function Hh(t){var l=t.memoizedState,e=0;l!==null&&(e=l.retryLane),Ho(t,e)}function Lh(t,l){var e=0;switch(t.tag){case 31:case 13:var a=t.stateNode,n=t.memoizedState;n!==null&&(e=n.retryLane);break;case 19:a=t.stateNode;break;case 22:a=t.stateNode._retryCache;break;default:throw Error(o(314))}a!==null&&a.delete(l),Ho(t,e)}function Yh(t,l){return ti(t,l)}var Mu=null,ja=null,wc=!1,Cu=!1,Gc=!1,ve=0;function Dl(t){t!==ja&&t.next===null&&(ja===null?Mu=ja=t:ja=ja.next=t),Cu=!0,wc||(wc=!0,Xh())}function dn(t,l){if(!Gc&&Cu){Gc=!0;do for(var e=!1,a=Mu;a!==null;){if(t!==0){var n=a.pendingLanes;if(n===0)var u=0;else{var i=a.suspendedLanes,f=a.pingedLanes;u=(1<<31-ll(42|t)+1)-1,u&=n&~(i&~f),u=u&201326741?u&201326741|1:u?u|2:0}u!==0&&(e=!0,Xo(a,u))}else u=it,u=Rn(a,a===bt?u:0,a.cancelPendingCommit!==null||a.timeoutHandle!==-1),(u&3)===0||Ca(a,u)||(e=!0,Xo(a,u));a=a.next}while(e);Gc=!1}}function Vh(){Lo()}function Lo(){Cu=wc=!1;var t=0;ve!==0&&Fh()&&(t=ve);for(var l=Pt(),e=null,a=Mu;a!==null;){var n=a.next,u=Yo(a,l);u===0?(a.next=null,e===null?Mu=n:e.next=n,n===null&&(ja=e)):(e=a,(t!==0||(u&3)!==0)&&(Cu=!0)),a=n}qt!==0&&qt!==5||dn(t),ve!==0&&(ve=0)}function Yo(t,l){for(var e=t.suspendedLanes,a=t.pingedLanes,n=t.expirationTimes,u=t.pendingLanes&-62914561;0f)break;var C=d.transferSize,O=d.initiatorType;C&&Wo(O)&&(d=d.responseEnd,i+=C*(d"u"?null:document;function cd(t,l,e){var a=Aa;if(a&&typeof l=="string"&&l){var n=rl(l);n='link[rel="'+t+'"][href="'+n+'"]',typeof e=="string"&&(n+='[crossorigin="'+e+'"]'),id.has(n)||(id.add(n),t={rel:t,crossOrigin:e,href:l},a.querySelector(n)===null&&(l=a.createElement("link"),Gt(l,"link",t),Ht(l),a.head.appendChild(l)))}}function i0(t){$l.D(t),cd("dns-prefetch",t,null)}function c0(t,l){$l.C(t,l),cd("preconnect",t,l)}function s0(t,l,e){$l.L(t,l,e);var a=Aa;if(a&&t&&l){var n='link[rel="preload"][as="'+rl(l)+'"]';l==="image"&&e&&e.imageSrcSet?(n+='[imagesrcset="'+rl(e.imageSrcSet)+'"]',typeof e.imageSizes=="string"&&(n+='[imagesizes="'+rl(e.imageSizes)+'"]')):n+='[href="'+rl(t)+'"]';var u=n;switch(l){case"style":u=Ta(t);break;case"script":u=Ea(t)}pl.has(u)||(t=p({rel:"preload",href:l==="image"&&e&&e.imageSrcSet?void 0:t,as:l},e),pl.set(u,t),a.querySelector(n)!==null||l==="style"&&a.querySelector(vn(u))||l==="script"&&a.querySelector(gn(u))||(l=a.createElement("link"),Gt(l,"link",t),Ht(l),a.head.appendChild(l)))}}function f0(t,l){$l.m(t,l);var e=Aa;if(e&&t){var a=l&&typeof l.as=="string"?l.as:"script",n='link[rel="modulepreload"][as="'+rl(a)+'"][href="'+rl(t)+'"]',u=n;switch(a){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":u=Ea(t)}if(!pl.has(u)&&(t=p({rel:"modulepreload",href:t},l),pl.set(u,t),e.querySelector(n)===null)){switch(a){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(e.querySelector(gn(u)))return}a=e.createElement("link"),Gt(a,"link",t),Ht(a),e.head.appendChild(a)}}}function r0(t,l,e){$l.S(t,l,e);var a=Aa;if(a&&t){var n=Je(a).hoistableStyles,u=Ta(t);l=l||"default";var i=n.get(u);if(!i){var f={loading:0,preload:null};if(i=a.querySelector(vn(u)))f.loading=5;else{t=p({rel:"stylesheet",href:t,"data-precedence":l},e),(e=pl.get(u))&&us(t,e);var d=i=a.createElement("link");Ht(d),Gt(d,"link",t),d._p=new Promise(function(S,C){d.onload=S,d.onerror=C}),d.addEventListener("load",function(){f.loading|=1}),d.addEventListener("error",function(){f.loading|=2}),f.loading|=4,qu(i,l,a)}i={type:"stylesheet",instance:i,count:1,state:f},n.set(u,i)}}}function o0(t,l){$l.X(t,l);var e=Aa;if(e&&t){var a=Je(e).hoistableScripts,n=Ea(t),u=a.get(n);u||(u=e.querySelector(gn(n)),u||(t=p({src:t,async:!0},l),(l=pl.get(n))&&is(t,l),u=e.createElement("script"),Ht(u),Gt(u,"link",t),e.head.appendChild(u)),u={type:"script",instance:u,count:1,state:null},a.set(n,u))}}function d0(t,l){$l.M(t,l);var e=Aa;if(e&&t){var a=Je(e).hoistableScripts,n=Ea(t),u=a.get(n);u||(u=e.querySelector(gn(n)),u||(t=p({src:t,async:!0,type:"module"},l),(l=pl.get(n))&&is(t,l),u=e.createElement("script"),Ht(u),Gt(u,"link",t),e.head.appendChild(u)),u={type:"script",instance:u,count:1,state:null},a.set(n,u))}}function sd(t,l,e,a){var n=(n=Fl.current)?Ru(n):null;if(!n)throw Error(o(446));switch(t){case"meta":case"title":return null;case"style":return typeof e.precedence=="string"&&typeof e.href=="string"?(l=Ta(e.href),e=Je(n).hoistableStyles,a=e.get(l),a||(a={type:"style",instance:null,count:0,state:null},e.set(l,a)),a):{type:"void",instance:null,count:0,state:null};case"link":if(e.rel==="stylesheet"&&typeof e.href=="string"&&typeof e.precedence=="string"){t=Ta(e.href);var u=Je(n).hoistableStyles,i=u.get(t);if(i||(n=n.ownerDocument||n,i={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},u.set(t,i),(u=n.querySelector(vn(t)))&&!u._p&&(i.instance=u,i.state.loading=5),pl.has(t)||(e={rel:"preload",as:"style",href:e.href,crossOrigin:e.crossOrigin,integrity:e.integrity,media:e.media,hrefLang:e.hrefLang,referrerPolicy:e.referrerPolicy},pl.set(t,e),u||m0(n,t,e,i.state))),l&&a===null)throw Error(o(528,""));return i}if(l&&a!==null)throw Error(o(529,""));return null;case"script":return l=e.async,e=e.src,typeof e=="string"&&l&&typeof l!="function"&&typeof l!="symbol"?(l=Ea(e),e=Je(n).hoistableScripts,a=e.get(l),a||(a={type:"script",instance:null,count:0,state:null},e.set(l,a)),a):{type:"void",instance:null,count:0,state:null};default:throw Error(o(444,t))}}function Ta(t){return'href="'+rl(t)+'"'}function vn(t){return'link[rel="stylesheet"]['+t+"]"}function fd(t){return p({},t,{"data-precedence":t.precedence,precedence:null})}function m0(t,l,e,a){t.querySelector('link[rel="preload"][as="style"]['+l+"]")?a.loading=1:(l=t.createElement("link"),a.preload=l,l.addEventListener("load",function(){return a.loading|=1}),l.addEventListener("error",function(){return a.loading|=2}),Gt(l,"link",e),Ht(l),t.head.appendChild(l))}function Ea(t){return'[src="'+rl(t)+'"]'}function gn(t){return"script[async]"+t}function rd(t,l,e){if(l.count++,l.instance===null)switch(l.type){case"style":var a=t.querySelector('style[data-href~="'+rl(e.href)+'"]');if(a)return l.instance=a,Ht(a),a;var n=p({},e,{"data-href":e.href,"data-precedence":e.precedence,href:null,precedence:null});return a=(t.ownerDocument||t).createElement("style"),Ht(a),Gt(a,"style",n),qu(a,e.precedence,t),l.instance=a;case"stylesheet":n=Ta(e.href);var u=t.querySelector(vn(n));if(u)return l.state.loading|=4,l.instance=u,Ht(u),u;a=fd(e),(n=pl.get(n))&&us(a,n),u=(t.ownerDocument||t).createElement("link"),Ht(u);var i=u;return i._p=new Promise(function(f,d){i.onload=f,i.onerror=d}),Gt(u,"link",a),l.state.loading|=4,qu(u,e.precedence,t),l.instance=u;case"script":return u=Ea(e.src),(n=t.querySelector(gn(u)))?(l.instance=n,Ht(n),n):(a=e,(n=pl.get(u))&&(a=p({},e),is(a,n)),t=t.ownerDocument||t,n=t.createElement("script"),Ht(n),Gt(n,"link",a),t.head.appendChild(n),l.instance=n);case"void":return null;default:throw Error(o(443,l.type))}else l.type==="stylesheet"&&(l.state.loading&4)===0&&(a=l.instance,l.state.loading|=4,qu(a,e.precedence,t));return l.instance}function qu(t,l,e){for(var a=e.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),n=a.length?a[a.length-1]:null,u=n,i=0;i title"):null)}function h0(t,l,e){if(e===1||l.itemProp!=null)return!1;switch(t){case"meta":case"title":return!0;case"style":if(typeof l.precedence!="string"||typeof l.href!="string"||l.href==="")break;return!0;case"link":if(typeof l.rel!="string"||typeof l.href!="string"||l.href===""||l.onLoad||l.onError)break;switch(l.rel){case"stylesheet":return t=l.disabled,typeof l.precedence=="string"&&t==null;default:return!0}case"script":if(l.async&&typeof l.async!="function"&&typeof l.async!="symbol"&&!l.onLoad&&!l.onError&&l.src&&typeof l.src=="string")return!0}return!1}function md(t){return!(t.type==="stylesheet"&&(t.state.loading&3)===0)}function y0(t,l,e,a){if(e.type==="stylesheet"&&(typeof a.media!="string"||matchMedia(a.media).matches!==!1)&&(e.state.loading&4)===0){if(e.instance===null){var n=Ta(a.href),u=l.querySelector(vn(n));if(u){l=u._p,l!==null&&typeof l=="object"&&typeof l.then=="function"&&(t.count++,t=Hu.bind(t),l.then(t,t)),e.state.loading|=4,e.instance=u,Ht(u);return}u=l.ownerDocument||l,a=fd(a),(n=pl.get(n))&&us(a,n),u=u.createElement("link"),Ht(u);var i=u;i._p=new Promise(function(f,d){i.onload=f,i.onerror=d}),Gt(u,"link",a),e.instance=u}t.stylesheets===null&&(t.stylesheets=new Map),t.stylesheets.set(e,l),(l=e.state.preload)&&(e.state.loading&3)===0&&(t.count++,e=Hu.bind(t),l.addEventListener("load",e),l.addEventListener("error",e))}}var cs=0;function v0(t,l){return t.stylesheets&&t.count===0&&Yu(t,t.stylesheets),0cs?50:800)+l);return t.unsuspend=e,function(){t.unsuspend=null,clearTimeout(a),clearTimeout(n)}}:null}function Hu(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Yu(this,this.stylesheets);else if(this.unsuspend){var t=this.unsuspend;this.unsuspend=null,t()}}}var Lu=null;function Yu(t,l){t.stylesheets=null,t.unsuspend!==null&&(t.count++,Lu=new Map,l.forEach(g0,t),Lu=null,Hu.call(t))}function g0(t,l){if(!(l.state.loading&4)){var e=Lu.get(t);if(e)var a=e.get(null);else{e=new Map,Lu.set(t,e);for(var n=t.querySelectorAll("link[data-precedence],style[data-precedence]"),u=0;u"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(c)}catch(r){console.error(r)}}return c(),ys.exports=O0(),ys.exports}var R0=U0();const Gd=g.createContext({windows:[],openWindow:()=>{},closeWindow:()=>{},bringToFront:()=>{}}),q0=({children:c})=>{const[r,m]=g.useState([]),o=g.useRef(1e4),x=g.useCallback((T,y,A)=>{m(B=>B.find(E=>E.id===T)?B.map(E=>E.id===T?{...E,zIndex:++o.current}:E):[...B,{id:T,title:y,charName:A,zIndex:++o.current}])},[]),j=g.useCallback(T=>{m(y=>y.filter(A=>A.id!==T))},[]),M=g.useCallback(T=>{m(y=>y.map(A=>A.id===T?{...A,zIndex:++o.current}:A))},[]);return s.jsx(Gd.Provider,{value:{windows:r,openWindow:x,closeWindow:j,bringToFront:M},children:c})},An=()=>g.useContext(Gd),bl={west:-102.1,east:102.1,north:102.1,south:-102.1};function Tn(c,r,m,o){const x=(c-bl.west)/(bl.east-bl.west)*m,j=(bl.north-r)/(bl.north-bl.south)*o;return{x,y:j}}function B0(c,r,m,o,x,j,M){const T=(c-o)/m,y=(r-x)/m,A=bl.west+T/j*(bl.east-bl.west),B=bl.north-y/M*(bl.north-bl.south);return{ew:A,ns:B}}function ps(c,r){const m=c>=0?"N":"S",o=r>=0?"E":"W";return`${Math.abs(c).toFixed(1)}${m}, ${Math.abs(r).toFixed(1)}${o}`}const Qd=jn.memo(({players:c,imgW:r,imgH:m,getColor:o,onHover:x,onSelect:j,selectedPlayer:M})=>{const{openWindow:T}=An(),[y,A]=g.useState(null);g.useEffect(()=>{const p=()=>A(null);return y&&window.addEventListener("click",p),()=>window.removeEventListener("click",p)},[y]);const B=g.useMemo(()=>c.filter(p=>p.ew!==void 0&&p.ns!==void 0).map(p=>({...p,pos:Tn(p.ew,p.ns,r,m),color:o(p.character_name)})),[c,r,m,o]);return s.jsxs("div",{className:"ml-dots-layer",children:[B.map(p=>s.jsx("div",{className:`ml-dot ${M===p.character_name?"ml-dot-selected":""}`,style:{left:p.pos.x,top:p.pos.y,backgroundColor:p.color},onMouseEnter:E=>{var L;const R=(L=E.currentTarget.closest(".ml-map-container"))==null?void 0:L.getBoundingClientRect();R&&x(p,E.clientX-R.left,E.clientY-R.top)},onMouseLeave:()=>x(null,0,0),onClick:()=>j(p.character_name),onDoubleClick:()=>T(`chat-${p.character_name}`,`Chat: ${p.character_name}`,p.character_name),onContextMenu:E=>{var U;E.preventDefault();const R=p.character_name,L=(U=E.currentTarget.closest(".ml-map-container"))==null?void 0:U.getBoundingClientRect(),$=L?E.clientX-L.left:E.clientX,at=L?E.clientY-L.top:E.clientY;A({name:R,x:$,y:at})}},p.character_name)),y&&s.jsx("div",{style:{position:"fixed",left:y.x+410,top:y.y,background:"#1a1a1a",border:"1px solid #444",borderRadius:4,zIndex:9999,padding:"2px 0",fontSize:"0.75rem",boxShadow:"0 4px 12px rgba(0,0,0,0.5)",minWidth:120},children:[{label:"Chat",id:"chat"},{label:"Stats",id:"stats"},{label:"Inventory",id:"inv"},{label:"Character",id:"char"},{label:"Combat",id:"combat"},{label:"Radar",id:"radar"}].map(p=>s.jsx("div",{onClick:()=>{T(`${p.id}-${y.name}`,`${p.label}: ${y.name}`,y.name),A(null)},style:{padding:"4px 12px",cursor:"pointer",color:"#ccc"},onMouseEnter:E=>E.currentTarget.style.background="#333",onMouseLeave:E=>E.currentTarget.style.background="",children:p.label},p.id))})]})});Qd.displayName="PlayerDots";const Ju="/api";async function It(c){const r=await fetch(`${Ju}${c}`,{credentials:"include"});if(!r.ok)throw new Error(`API ${c}: ${r.status}`);return r.json()}async function xs(c,r){var o;const m=await fetch(`${Ju}${c}`,{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify(r??{})});if(!m.ok){let x="";try{x=((o=await m.json())==null?void 0:o.detail)??""}catch{}throw new Error(`API ${c}: ${m.status}${x?` (${x})`:""}`)}return m.json()}async function H0(c,r){var o;const m=await fetch(`${Ju}${c}`,{method:"PATCH",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify(r??{})});if(!m.ok){let x="";try{x=((o=await m.json())==null?void 0:o.detail)??""}catch{}throw new Error(`API ${c}: ${m.status}${x?` (${x})`:""}`)}return m.json()}async function L0(c){var m;const r=await fetch(`${Ju}${c}`,{method:"DELETE",credentials:"include"});if(!r.ok){let o="";try{o=((m=await r.json())==null?void 0:m.detail)??""}catch{}throw new Error(`API ${c}: ${r.status}${o?` (${o})`:""}`)}return r.json()}function Y0(){return`${location.protocol==="https:"?"wss:":"ws:"}//${location.host}/api/ws/live`}const Zd=jn.memo(({imgW:c,imgH:r,getColor:m})=>{const[o,x]=g.useState([]);g.useEffect(()=>{const M=async()=>{try{const y=await It("/trails/?seconds=600");x(y.trails??[])}catch{}};M();const T=setInterval(M,2e3);return()=>clearInterval(T)},[]);const j=g.useMemo(()=>{const M={};for(const T of o){const{x:y,y:A}=Tn(T.ew,T.ns,c,r);M[T.character_name]||(M[T.character_name]=[]),M[T.character_name].push(`${y},${A}`)}return Object.entries(M).filter(([,T])=>T.length>=2).map(([T,y])=>({name:T,points:y.join(" ")}))},[o,c,r]);return s.jsx("svg",{className:"ml-trails-svg",viewBox:`0 0 ${c} ${r}`,preserveAspectRatio:"none",children:j.map(M=>s.jsx("polyline",{points:M.points,stroke:m(M.name),fill:"none",strokeWidth:2,strokeOpacity:.7,strokeLinecap:"round",strokeLinejoin:"round"},M.name))})});Zd.displayName="TrailsSVG";const V0=({imgW:c,imgH:r,enabled:m})=>{const o=g.useRef(null),[x,j]=g.useState([]);return g.useEffect(()=>{if(!m)return;(async()=>{try{const T=await It("/spawns/heatmap?hours=24&limit=50000");j(T.spawn_points??[])}catch{}})()},[m]),g.useEffect(()=>{const M=o.current;if(!M||!m||x.length===0||c===0)return;M.width=c,M.height=r;const T=M.getContext("2d");if(T){T.clearRect(0,0,c,r);for(const y of x){const{x:A,y:B}=Tn(y.ew,y.ns,c,r),p=Math.max(5,Math.min(12,5+Math.sqrt(y.intensity*.5))),E=T.createRadialGradient(A,B,0,A,B,p);E.addColorStop(0,`rgba(255, 0, 0, ${Math.min(.9,y.intensity/40)})`),E.addColorStop(.6,`rgba(255, 100, 0, ${Math.min(.4,y.intensity/120)})`),E.addColorStop(1,"rgba(255, 150, 0, 0)"),T.fillStyle=E,T.fillRect(A-p,B-p,p*2,p*2)}}},[x,c,r,m]),m?s.jsx("canvas",{ref:o,className:"ml-heatmap-canvas"}):null},X0=({imgW:c,imgH:r,enabled:m})=>{const[o,x]=g.useState([]);g.useEffect(()=>{if(!m)return;const M=async()=>{try{const y=await It("/portals");x(y.portals??[])}catch{}};M();const T=setInterval(M,6e4);return()=>clearInterval(T)},[m]);const j=g.useMemo(()=>o.map(M=>({...M,pos:Tn(M.coordinates.ew,M.coordinates.ns,c,r)})),[o,c,r]);return!m||j.length===0?null:s.jsx("div",{className:"ml-portals-layer",children:j.map((M,T)=>s.jsx("div",{className:"ml-portal-icon",style:{left:M.pos.x,top:M.pos.y},title:`${M.portal_name} (by ${M.discovered_by})`},T))})},Ud="mo-midsummer",w0=!1,Kd=g.createContext(null),G0=({children:c})=>{const[r,m]=g.useState(()=>localStorage.getItem(Ud)!=="off"),o=w0;g.useEffect(()=>{document.documentElement.removeAttribute("data-midsummer")},[o]);const x=g.useCallback(()=>{m(j=>{const M=!j;return localStorage.setItem(Ud,M?"on":"off"),M})},[]);return s.jsx(Kd.Provider,{value:{enabled:o,toggle:x},children:c})};function _s(){const c=g.useContext(Kd);if(!c)throw new Error("useMidsummer must be used within MidsummerProvider");return c}const Rd=6,Q0=(c,r)=>({x:c/2,y:r/2}),Z0=({imgW:c,imgH:r})=>{const{enabled:m}=_s();if(!m||c===0)return null;const{x:o,y:x}=Q0(c,r);return s.jsxs("div",{className:"ms-maypole",style:{left:o,top:x},"aria-hidden":"true",children:[s.jsx("div",{className:"ms-maypole-pole"}),s.jsx("div",{className:"ms-maypole-ring",children:Array.from({length:Rd}).map((j,M)=>s.jsx("span",{className:"ms-frog",style:{transform:`rotate(${360/Rd*M}deg) translateY(-40px)`},children:"🐸"},M))})]})},qd=20,Bd=.3,K0=({players:c,getColor:r,onSelectPlayer:m,showHeatmap:o,showPortals:x,selectedPlayer:j})=>{var Mt;const M=g.useRef(null),T=g.useRef(null),[y,A]=g.useState({w:0,h:0}),[B,p]=g.useState(null),E=g.useRef(null),R=g.useRef({scale:1,offX:0,offY:0}),L=g.useRef({dragging:!1,sx:0,sy:0,startOffX:0,startOffY:0}),$=g.useCallback(()=>{if(T.current){const{scale:F,offX:lt,offY:Z}=R.current;T.current.style.transform=`translate(${lt}px, ${Z}px) scale(${F})`}},[]),at=g.useCallback(F=>{const lt=F.currentTarget;if(A({w:lt.naturalWidth,h:lt.naturalHeight}),M.current){const Z=M.current.clientWidth,J=M.current.clientHeight,P=Math.min(Z/lt.naturalWidth,J/lt.naturalHeight);R.current={scale:P,offX:(Z-lt.naturalWidth*P)/2,offY:(J-lt.naturalHeight*P)/2},$()}},[$]),U=g.useCallback(F=>{var Tl;F.preventDefault();const lt=(Tl=M.current)==null?void 0:Tl.getBoundingClientRect();if(!lt)return;const Z=R.current,J=F.deltaY<0?1.1:.9,P=Math.min(qd,Math.max(Bd,Z.scale*J)),Rt=P/Z.scale,jt=F.clientX-lt.left,Ol=F.clientY-lt.top;R.current={scale:P,offX:jt-(jt-Z.offX)*Rt,offY:Ol-(Ol-Z.offY)*Rt},$()},[$]),q=g.useCallback(F=>{if(F.button!==0)return;const lt=R.current;L.current={dragging:!0,sx:F.clientX,sy:F.clientY,startOffX:lt.offX,startOffY:lt.offY}},[]);g.useEffect(()=>{const F=Z=>{const J=L.current;if(J.dragging&&(R.current.offX=J.startOffX+(Z.clientX-J.sx),R.current.offY=J.startOffY+(Z.clientY-J.sy),$()),M.current&&y.w>0&&E.current){const P=M.current.getBoundingClientRect(),Rt=R.current,jt=B0(Z.clientX-P.left,Z.clientY-P.top,Rt.scale,Rt.offX,Rt.offY,y.w,y.h);E.current.textContent=ps(jt.ns,jt.ew)}},lt=()=>{L.current.dragging=!1};return window.addEventListener("mousemove",F),window.addEventListener("mouseup",lt),()=>{window.removeEventListener("mousemove",F),window.removeEventListener("mouseup",lt)}},[$,y.w,y.h]);const w=g.useRef(null);g.useEffect(()=>{if(!j||y.w===0||!M.current||w.current===j)return;const F=c.find(Rt=>Rt.character_name===j);if(!F)return;w.current=j;const{x:lt,y:Z}=Tn(F.ew,F.ns,y.w,y.h),J=M.current.getBoundingClientRect(),P=3;R.current={scale:Math.min(qd,Math.max(Bd,P)),offX:J.width/2-lt*P,offY:J.height/2-Z*P},$()},[j,c,y.w,y.h,$]),g.useEffect(()=>{j||(w.current=null)},[j]);const St=g.useCallback((F,lt,Z)=>{p(F?{x:lt,y:Z,player:F}:null)},[]);return s.jsxs("div",{className:"ml-map-container",ref:M,onWheel:U,onMouseDown:q,children:[s.jsxs("div",{ref:T,className:"ml-map-group",children:[s.jsx("img",{src:"/dereth.png",alt:"Dereth",className:"ml-map-img",onLoad:at,draggable:!1}),y.w>0&&s.jsxs(s.Fragment,{children:[s.jsx(V0,{imgW:y.w,imgH:y.h,enabled:o}),s.jsx(Zd,{imgW:y.w,imgH:y.h,getColor:r}),s.jsx(Qd,{players:c,imgW:y.w,imgH:y.h,getColor:r,onHover:St,onSelect:m,selectedPlayer:j}),s.jsx(X0,{imgW:y.w,imgH:y.h,enabled:x}),s.jsx(Z0,{imgW:y.w,imgH:y.h})]})]}),B&&s.jsxs("div",{className:"ml-tooltip",style:{left:B.x+12,top:B.y-10},children:[s.jsx("strong",{children:B.player.character_name}),s.jsx("br",{}),ps(B.player.ns,B.player.ew),s.jsx("br",{}),B.player.kills_per_hour," kph · ",(Mt=B.player.kills)==null?void 0:Mt.toLocaleString()," kills"]}),s.jsx("div",{className:"ml-coords",ref:E})]})},kd=jn.memo(({player:c,vitals:r,color:m,onSelect:o,isSelected:x})=>{var B,p;const{openWindow:j}=An(),M=(c.vt_state||"idle").toLowerCase(),T=M==="combat"||M==="hunt",y=(c.total_rares??0)>0?Math.round((c.total_kills??0)/(c.total_rares??1)).toLocaleString():null,A=c.character_name;return s.jsxs("li",{className:`ml-player-row ${x?"ml-player-selected":""}`,style:{borderLeftColor:m},children:[s.jsxs("div",{className:"ml-pr-header",onClick:o,children:[s.jsx("span",{className:"ml-pr-name",children:A}),s.jsx("span",{className:"ml-pr-coords",children:ps(c.ns,c.ew)})]}),s.jsxs("div",{className:"ml-pr-vitals",children:[s.jsx("div",{className:"ml-vital-bar hp",children:s.jsx("div",{className:"ml-vital-fill",style:{width:`${(r==null?void 0:r.health_percentage)??0}%`}})}),s.jsx("div",{className:"ml-vital-bar sta",children:s.jsx("div",{className:"ml-vital-fill",style:{width:`${(r==null?void 0:r.stamina_percentage)??0}%`}})}),s.jsx("div",{className:"ml-vital-bar mana",children:s.jsx("div",{className:"ml-vital-fill",style:{width:`${(r==null?void 0:r.mana_percentage)??0}%`}})})]}),s.jsxs("div",{className:"ml-pr-grid",children:[s.jsxs("span",{className:"ml-gs",title:"Session kills",children:["⚔️ ",((B=c.kills)==null?void 0:B.toLocaleString())??0]}),s.jsxs("span",{className:"ml-gs",title:"Total kills",children:["🏆 ",(c.total_kills??0).toLocaleString()]}),s.jsxs("span",{className:"ml-gs",title:"Kills per hour",children:[c.kills_per_hour??"0"," ",s.jsx("span",{className:"ml-suffix",children:"KPH"})]}),s.jsxs("span",{className:"ml-gs",title:"Rares (session / total)",children:["💎 ",c.session_rares??0," / ",c.total_rares??0]}),s.jsx("span",{className:"ml-gs",title:"Kills per rare",children:y?s.jsxs(s.Fragment,{children:["📊 ",y," ",s.jsx("span",{className:"ml-suffix",children:"KPR"})]}):""}),s.jsx("span",{className:`ml-meta-pill ${T?"active":M!=="idle"&&M!=="default"&&M!==""?"other":""}`,children:c.vt_state||"idle"}),s.jsxs("span",{className:"ml-gs",title:"Online time",children:["🕐 ",((p=c.onlinetime)==null?void 0:p.replace(/^00\./,""))??"--"]}),s.jsxs("span",{className:"ml-gs",title:"Deaths",children:["☠️ ",c.deaths??"0"]}),s.jsxs("span",{className:"ml-gs",title:"Prismatic tapers",children:[s.jsx("img",{src:"/prismatic-taper-icon.png",className:"ml-taper-icon",alt:""}),c.prismatic_taper_count??"0"]})]}),s.jsxs("div",{className:"ml-pr-buttons",children:[s.jsx("button",{className:"ml-btn accent",onClick:()=>j(`chat-${A}`,`Chat: ${A}`,A),children:"Chat"}),s.jsx("button",{className:"ml-btn accent",onClick:()=>j(`stats-${A}`,`Stats: ${A}`,A),children:"Stats"}),s.jsx("button",{className:"ml-btn accent",onClick:()=>j(`inv-${A}`,`Inventory: ${A}`,A),children:"Inv"}),s.jsx("button",{className:"ml-btn",onClick:()=>j(`char-${A}`,`Character: ${A}`,A),children:"Char"}),s.jsx("button",{className:"ml-btn",onClick:()=>j(`combat-${A}`,`Combat: ${A}`,A),children:"Combat"}),s.jsx("button",{className:"ml-btn",onClick:()=>j(`radar-${A}`,`Radar: ${A}`,A),children:"Radar"})]})]})});kd.displayName="PlayerRow";const k0=({players:c,vitals:r,getColor:m,onSelect:o,selectedPlayer:x})=>{const j=g.useRef(null),[M,T]=g.useState(!1),y=g.useCallback(()=>{j.current&&T(j.current.scrollTop>200)},[]);return s.jsxs("div",{style:{position:"relative",flex:1,minHeight:0},children:[s.jsx("ul",{className:"ml-player-list",ref:j,onScroll:y,children:c.map(A=>s.jsx(kd,{player:A,vitals:r.get(A.character_name)??null,color:m(A.character_name),onSelect:()=>o(A.character_name),isSelected:x===A.character_name},A.character_name))}),M&&s.jsx("button",{onClick:()=>{var A;(A=j.current)==null||A.scrollTo({top:0,behavior:"smooth"})},style:{position:"absolute",bottom:8,right:8,width:28,height:28,borderRadius:"50%",background:"rgba(68,136,255,0.2)",border:"1px solid rgba(68,136,255,0.4)",color:"#6af",cursor:"pointer",fontSize:"0.8rem",display:"flex",alignItems:"center",justifyContent:"center"},children:"▲"})]})},J0=[{key:"name",label:"Name"},{key:"kph",label:"KPH"},{key:"skills",label:"S.Kills"},{key:"srares",label:"S.Rares"},{key:"tkills",label:"T.Kills"},{key:"kpr",label:"KPR"}],W0=({value:c,onChange:r})=>s.jsx("div",{className:"ml-sort-buttons",children:J0.map(m=>s.jsx("button",{className:`ml-sort-btn ${c===m.key?"active":""}`,onClick:()=>r(m.key),children:m.label},m.key))}),$0=()=>It("/live"),F0=()=>It("/combat-stats"),I0=()=>It("/server-health"),P0=()=>It("/total-rares"),ty=()=>It("/total-kills"),iv=(c,r)=>xs("/agent/ask",{message:c,session_id:r}),cv=()=>xs("/agent/sessions/new",{}),sv=c=>It(`/agent/sessions/${encodeURIComponent(c)}/history`),ly=()=>It("/me");async function ey(){await fetch("/api/logout",{credentials:"include",redirect:"manual"}),window.location.href="/login"}const fv=()=>It("/api-admin/users"),rv=(c,r,m)=>xs("/api-admin/users",{username:c,password:r,is_admin:m}),ov=(c,r)=>H0(`/api-admin/users/${c}`,r),dv=c=>L0(`/api-admin/users/${c}`);function ay(){const[c,r]=g.useState(null),[m,o]=g.useState(!0);return g.useEffect(()=>{let x=!1;return ly().then(j=>{x||r(j)}).catch(()=>{x||r(null)}).finally(()=>{x||o(!1)}),()=>{x=!0}},[]),{user:c,loading:m}}const ny=()=>{const{openWindow:c}=An(),{user:r}=ay(),m=!!(r!=null&&r.is_admin),o=g.useCallback(async()=>{if(confirm("Log out?"))try{await ey()}catch{window.location.href="/login"}},[]);return s.jsxs("div",{className:"ml-tool-links",children:[s.jsx("span",{className:"ml-tool-link",style:{cursor:"pointer"},onClick:()=>c("agent","Overlord Assistant"),children:"🤖 Assistant"}),s.jsx("span",{className:"ml-tool-link",style:{cursor:"pointer"},title:"Opens the player dashboard in a new tab",onClick:()=>window.open("/?view=dashboard","_blank","noopener"),children:"👥 Dashboard ↗"}),s.jsx("span",{className:"ml-tool-link",style:{cursor:"pointer"},onClick:()=>c("queststatus","Quest Status"),children:"📜 Quests"}),s.jsx("span",{className:"ml-tool-link",style:{cursor:"pointer"},onClick:()=>c("issues","Issues Board"),children:"📋 Issues"}),s.jsx("span",{className:"ml-tool-link",style:{cursor:"pointer"},onClick:()=>c("vitalsharing","Vital Sharing"),children:"🤝 Vitals"}),s.jsx("span",{className:"ml-tool-link",style:{cursor:"pointer"},onClick:()=>c("combatpicker","Combat Stats"),children:"⚔️ Combat"}),m&&s.jsx("span",{className:"ml-tool-link",style:{cursor:"pointer"},onClick:()=>c("adminusers","Admin · Users"),children:"🛡️ Admin"}),s.jsxs("span",{className:"ml-tool-link ml-tool-link-logout",style:{cursor:"pointer"},onClick:o,title:r?`Logged in as ${r.username}`:"Log out",children:["🚪 Log out",r?` (${r.username})`:""]})]})},uy=({players:c,vitals:r,serverHealth:m,totalRares:o,totalKills:x,getColor:j,onSelectPlayer:M,showHeatmap:T,showPortals:y,onToggleHeatmap:A,onTogglePortals:B,version:p,selectedPlayer:E})=>{var F,lt;const[R,L]=g.useState("name"),[$,at]=g.useState(""),U=g.useMemo(()=>c.reduce((Z,J)=>Z+(parseInt(J.kills_per_hour)||0),0),[c]),q=((F=m==null?void 0:m.status)==null?void 0:F.toLowerCase())==="online"||((lt=m==null?void 0:m.status)==null?void 0:lt.toLowerCase())==="up",w=g.useDeferredValue(c),St=g.useDeferredValue(r),Mt=g.useMemo(()=>{let Z=[...w];switch($&&(Z=Z.filter(J=>J.character_name.toLowerCase().startsWith($.toLowerCase()))),R){case"kph":Z.sort((J,P)=>(parseInt(P.kills_per_hour)||0)-(parseInt(J.kills_per_hour)||0));break;case"skills":Z.sort((J,P)=>(P.kills||0)-(J.kills||0));break;case"srares":Z.sort((J,P)=>(P.session_rares??0)-(J.session_rares??0));break;case"tkills":Z.sort((J,P)=>(P.total_kills??0)-(J.total_kills??0));break;case"kpr":Z.sort((J,P)=>{const Rt=(J.total_kills??0)/Math.max(1,J.total_rares??1),jt=(P.total_kills??0)/Math.max(1,P.total_rares??1);return Rt-jt});break;default:Z.sort((J,P)=>J.character_name.localeCompare(P.character_name))}return Z},[w,R,$]);return s.jsxs("div",{className:"ml-sidebar",children:[p&&s.jsxs("div",{className:"ml-version",children:["v",p]}),s.jsx("div",{className:"ml-sidebar-header",children:s.jsxs("span",{className:"ml-sidebar-title",style:{cursor:"pointer"},onClick:()=>{const Z=document.createElement("div");Z.style.cssText="position:fixed;top:0;left:0;width:100vw;height:100vh;background:#000;z-index:999999;display:flex;align-items:center;justify-content:center;";const J=document.createElement("video");J.src="/rick.mp4",J.autoplay=!0,J.loop=!0,J.style.cssText="width:100vw;height:100vh;object-fit:cover;",Z.appendChild(J),document.body.appendChild(Z),document.body.style.animation="ml-shake 0.05s 30";const P=document.createElement("style");P.textContent="@keyframes ml-shake{0%,100%{transform:translate(0) rotate(0)}25%{transform:translate(-15px,10px) rotate(-2deg)}50%{transform:translate(15px,-10px) rotate(2deg)}75%{transform:translate(-10px,-15px) rotate(-1deg)}} @keyframes ml-spin{from{transform:rotate(0)}to{transform:rotate(360deg)}}",document.head.appendChild(P),setTimeout(()=>{Z.style.animation="ml-spin 3s linear infinite"},1500),J.play().catch(()=>{})},children:["Active Mosswart Enjoyers (",c.length,")"]})}),s.jsxs("div",{className:"ml-server-status",children:[s.jsx("span",{className:`ml-status-dot ${q?"online":"offline"}`}),s.jsxs("span",{className:"ml-status-text",children:["Coldeve ",q?"Online":"Offline"]}),(m==null?void 0:m.player_count)!=null&&s.jsxs("span",{className:"ml-status-detail",children:["👥 ",m.player_count]}),(m==null?void 0:m.latency_ms)!=null&&s.jsxs("span",{className:"ml-status-detail",children:[Math.round(m.latency_ms),"ms"]}),(m==null?void 0:m.uptime_seconds)!=null&&s.jsxs("span",{className:"ml-status-detail",children:["Up: ",Math.floor(m.uptime_seconds/3600),"h"]})]}),s.jsxs("div",{className:"ml-counters",children:[s.jsxs("div",{className:"ml-counter rares",children:[s.jsx("span",{className:"ml-counter-val",children:o}),s.jsx("span",{className:"ml-counter-lbl",children:"Rares"})]}),s.jsxs("div",{className:`ml-counter kph ${U>5e3?"ultra":""}`,children:[s.jsx("span",{className:"ml-counter-val",children:U.toLocaleString()}),s.jsx("span",{className:"ml-counter-lbl",children:"Server KPH"})]}),s.jsxs("div",{className:"ml-counter kills",children:[s.jsx("span",{className:"ml-counter-val",children:x.toLocaleString()}),s.jsx("span",{className:"ml-counter-lbl",children:"Kills"})]})]}),s.jsxs("div",{className:"ml-tool-links",children:[s.jsx("a",{href:"/?view=inventory",target:"_blank",className:"ml-tool-link",children:"🔍 Inv Search"}),s.jsx("a",{href:"/suitbuilder.html",target:"_blank",className:"ml-tool-link",children:"🛡️ Suitbuilder"}),s.jsx("a",{href:"/debug.html",target:"_blank",className:"ml-tool-link",children:"🐛 Debug"})]}),s.jsx(ny,{}),s.jsxs("div",{className:"ml-toggles",children:[s.jsxs("label",{className:"ml-toggle-label",children:[s.jsx("input",{type:"checkbox",checked:T,onChange:Z=>A(Z.target.checked)}),s.jsx("span",{children:"Spawn Heatmap"})]}),s.jsxs("label",{className:"ml-toggle-label",children:[s.jsx("input",{type:"checkbox",checked:y,onChange:Z=>B(Z.target.checked)}),s.jsx("span",{children:"Portals"})]})]}),s.jsx("div",{style:{borderTop:"1px solid #333",marginTop:4,paddingTop:4}}),s.jsx(W0,{value:R,onChange:L}),s.jsx("input",{className:"ml-filter",type:"text",placeholder:"Filter players...",value:$,onChange:Z=>at(Z.target.value)}),s.jsx(k0,{players:Mt,vitals:St,getColor:j,onSelect:M,selectedPlayer:E})]})},iy="modulepreload",cy=function(c){return"/"+c},Hd={},Sl=function(r,m,o){let x=Promise.resolve();if(m&&m.length>0){let M=function(A){return Promise.all(A.map(B=>Promise.resolve(B).then(p=>({status:"fulfilled",value:p}),p=>({status:"rejected",reason:p}))))};document.getElementsByTagName("link");const T=document.querySelector("meta[property=csp-nonce]"),y=(T==null?void 0:T.nonce)||(T==null?void 0:T.getAttribute("nonce"));x=M(m.map(A=>{if(A=cy(A),A in Hd)return;Hd[A]=!0;const B=A.endsWith(".css"),p=B?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${A}"]${p}`))return;const E=document.createElement("link");if(E.rel=B?"stylesheet":iy,B||(E.as="script"),E.crossOrigin="",E.href=A,y&&E.setAttribute("nonce",y),document.head.appendChild(E),B)return new Promise((R,L)=>{E.addEventListener("load",R),E.addEventListener("error",()=>L(new Error(`Unable to preload CSS for ${A}`)))})}))}function j(M){const T=new Event("vite:preloadError",{cancelable:!0});if(T.payload=M,window.dispatchEvent(T),!T.defaultPrevented)throw M}return x.then(M=>{for(const T of M||[])T.status==="rejected"&&j(T.reason);return r().catch(j)})},Jd=({id:c,title:r,zIndex:m,width:o=700,height:x=340,children:j})=>{const{closeWindow:M,bringToFront:T}=An(),y=g.useRef(null),A=g.useRef({dragging:!1,sx:0,sy:0,ox:0,oy:0}),B=g.useRef({resizing:!1,sx:0,sy:0,sw:0,sh:0}),p=g.useRef({x:420,y:10+Math.random()*40}),[E,R]=g.useState({w:o,h:x}),L=g.useCallback(at=>{var q;at.preventDefault(),T(c);const U=(q=y.current)==null?void 0:q.getBoundingClientRect();U&&(A.current={dragging:!0,sx:at.clientX,sy:at.clientY,ox:U.left,oy:U.top})},[c,T]),$=g.useCallback(at=>{at.preventDefault(),at.stopPropagation(),B.current={resizing:!0,sx:at.clientX,sy:at.clientY,sw:E.w,sh:E.h}},[E.w,E.h]);return g.useEffect(()=>{const at=q=>{const w=A.current;w.dragging&&y.current&&(p.current.x=w.ox+(q.clientX-w.sx),p.current.y=w.oy+(q.clientY-w.sy),y.current.style.left=`${p.current.x}px`,y.current.style.top=`${p.current.y}px`);const St=B.current;if(St.resizing){const Mt=Math.max(300,St.sw+(q.clientX-St.sx)),F=Math.max(200,St.sh+(q.clientY-St.sy));R({w:Mt,h:F})}},U=()=>{A.current.dragging=!1,B.current.resizing=!1};return window.addEventListener("mousemove",at),window.addEventListener("mouseup",U),()=>{window.removeEventListener("mousemove",at),window.removeEventListener("mouseup",U)}},[]),s.jsxs("div",{ref:y,className:"ml-window",style:{zIndex:m,width:E.w,height:E.h,left:p.current.x,top:p.current.y},onMouseDown:()=>T(c),children:[s.jsxs("div",{className:"ml-window-header",onMouseDown:L,children:[s.jsx("span",{className:"ml-window-title",children:r}),s.jsx("button",{className:"ml-window-close",onClick:()=>M(c),children:"×"})]}),s.jsx("div",{className:"ml-window-content",children:j}),s.jsx("div",{className:"ml-window-resize",onMouseDown:$})]})},sy={0:"#00FF00",2:"#FFFFFF",3:"#FF0000",4:"#FFFFFF",5:"#33CCFF",6:"#CCFF99",7:"#00FFFF",14:"#FFD700",15:"#FF69B4",17:"#AAAAFF",18:"#88FF88",21:"#FF8888",22:"#FFAA66"},Wd=50,$d=c=>`mo-chat-history-${c}`;function fy(c){try{const r=localStorage.getItem($d(c));return r?JSON.parse(r):[]}catch{return[]}}function ry(c,r){try{localStorage.setItem($d(c),JSON.stringify(r.slice(-Wd)))}catch{}}const oy=({id:c,charName:r,zIndex:m,messages:o,socket:x})=>{const j=g.useRef(null),[M,T]=g.useState(""),[y,A]=g.useState(!1),B=g.useRef(fy(r)),p=g.useRef(-1),E=g.useRef(""),R=g.useRef(!1);g.useEffect(()=>{const q=j.current;q&&(R.current?A(!0):(q.scrollTop=q.scrollHeight,A(!1)))},[o.length]);const L=g.useCallback(()=>{const q=j.current;if(!q)return;const w=q.scrollHeight-q.scrollTop-q.clientHeight<30;R.current=!w,w&&A(!1)},[]),$=g.useCallback(()=>{const q=j.current;q&&(q.scrollTop=q.scrollHeight,R.current=!1,A(!1))},[]),at=g.useCallback(q=>{q.preventDefault();const w=M.trim();!w||!x||x.readyState!==WebSocket.OPEN||(x.send(JSON.stringify({player_name:r,command:w})),B.current.push(w),B.current.length>Wd&&B.current.shift(),ry(r,B.current),p.current=-1,E.current="",T(""),R.current=!1)},[M,x,r]),U=g.useCallback(q=>{const w=B.current;if(w.length!==0){if(q.key==="ArrowUp")q.preventDefault(),p.current===-1?(E.current=M,p.current=w.length-1):p.current>0&&p.current--,T(w[p.current]);else if(q.key==="ArrowDown"){if(q.preventDefault(),p.current===-1)return;p.currents.jsx("div",{className:"ml-chat-line",style:{color:sy[q.color??2]??"#ddd"},children:q.text},w))}),y&&s.jsx("div",{onClick:$,style:{padding:"3px 0",textAlign:"center",fontSize:"0.65rem",color:"#6af",background:"#1a2a3a",cursor:"pointer",borderTop:"1px solid #334"},children:"▼ New messages below"}),s.jsx("form",{className:"ml-chat-form",onSubmit:at,children:s.jsx("input",{className:"ml-chat-input",value:M,onChange:q=>T(q.target.value),onKeyDown:U,placeholder:"Enter chat..."})})]})},dy=g.lazy(()=>Sl(()=>import("./StatsWindow-CdjmDpA0.js"),__vite__mapDeps([0,1])).then(c=>({default:c.StatsWindow}))),my=g.lazy(()=>Sl(()=>import("./CharacterWindow-CJqV0b5w.js"),__vite__mapDeps([2,1])).then(c=>({default:c.CharacterWindow}))),hy=g.lazy(()=>Sl(()=>import("./InventoryWindow-tZ7lQtZ6.js"),__vite__mapDeps([3,1])).then(c=>({default:c.InventoryWindow}))),yy=g.lazy(()=>Sl(()=>import("./RadarWindow-7bg8dbys.js"),__vite__mapDeps([4,1])).then(c=>({default:c.RadarWindow}))),vy=g.lazy(()=>Sl(()=>import("./CombatStatsWindow-BmptnoZZ.js"),__vite__mapDeps([5,1])).then(c=>({default:c.CombatStatsWindow}))),gy=g.lazy(()=>Sl(()=>import("./CombatPickerWindow-kNju07hM.js"),__vite__mapDeps([6,1])).then(c=>({default:c.CombatPickerWindow}))),py=g.lazy(()=>Sl(()=>import("./IssuesWindow-BQgY9oJz.js"),__vite__mapDeps([7,1])).then(c=>({default:c.IssuesWindow}))),by=g.lazy(()=>Sl(()=>import("./VitalSharingWindow-iv2L5kit.js"),__vite__mapDeps([8,1])).then(c=>({default:c.VitalSharingWindow}))),Sy=g.lazy(()=>Sl(()=>import("./QuestStatusWindow-Bpt0EjyP.js"),__vite__mapDeps([9,1])).then(c=>({default:c.QuestStatusWindow}))),xy=g.lazy(()=>Sl(()=>Promise.resolve().then(()=>Uy),void 0).then(c=>({default:c.PlayerDashboardWindow}))),_y=g.lazy(()=>Sl(()=>import("./AgentWindow-bQ5tlleI.js"),__vite__mapDeps([10,1])).then(c=>({default:c.AgentWindow}))),zy=g.lazy(()=>Sl(()=>import("./AdminUsersWindow-BReYQ7Y-.js"),__vite__mapDeps([11,1])).then(c=>({default:c.AdminUsersWindow}))),Fd=jn.memo(({characters:c,chatMessages:r,nearbyObjects:m,inventoryVersions:o,equipmentCantrips:x,characterStats:j,socket:M})=>{const{windows:T}=An();return s.jsx(g.Suspense,{fallback:null,children:T.map(y=>{var p;const A=y.charName??"";switch(y.id.split("-")[0]){case"chat":return s.jsx(oy,{id:y.id,charName:A,zIndex:y.zIndex,messages:r.get(A)??[],socket:M},y.id);case"stats":return s.jsx(dy,{id:y.id,charName:A,zIndex:y.zIndex},y.id);case"char":return s.jsx(my,{id:y.id,charName:A,zIndex:y.zIndex,vitals:((p=c.get(A))==null?void 0:p.vitals)??void 0,liveStats:j.get(A)},y.id);case"inv":return s.jsx(hy,{id:y.id,charName:A,zIndex:y.zIndex,inventoryVersion:o.get(A)??0,equipmentCantrips:x.get(A)},y.id);case"radar":return s.jsx(yy,{id:y.id,charName:A,zIndex:y.zIndex,socket:M,radarData:m.get(A)??null},y.id);case"combat":return s.jsx(vy,{id:y.id,charName:A,zIndex:y.zIndex},y.id);case"combatpicker":return s.jsx(gy,{id:y.id,zIndex:y.zIndex,characters:c},y.id);case"issues":return s.jsx(py,{id:y.id,zIndex:y.zIndex},y.id);case"vitalsharing":return s.jsx(by,{id:y.id,zIndex:y.zIndex},y.id);case"queststatus":return s.jsx(Sy,{id:y.id,zIndex:y.zIndex},y.id);case"playerdash":return s.jsx(xy,{id:y.id,zIndex:y.zIndex,characters:c},y.id);case"agent":return s.jsx(_y,{id:y.id,zIndex:y.zIndex},y.id);case"adminusers":return s.jsx(zy,{id:y.id,zIndex:y.zIndex},y.id);default:return null}})})});Fd.displayName="WindowRenderer";let jy=0;const Ay=({recentRares:c})=>{const[r,m]=g.useState([]),[o,x]=g.useState(0),[j,M]=g.useState([]);g.useEffect(()=>{if(c.length>o&&o>0){const y=c.slice(0,c.length-o);for(const A of y){const B=++jy;m(p=>[...p,{key:B,charName:A.character_name,rareName:A.name,exiting:!1}]),T();try{const p=new AudioContext,E=p.createOscillator(),R=p.createGain();E.connect(R),R.connect(p.destination),E.frequency.value=880,E.type="sine",R.gain.value=.3,E.start(),R.gain.exponentialRampToValueAtTime(.001,p.currentTime+.5),E.stop(p.currentTime+.5)}catch{}setTimeout(()=>{m(p=>p.map(E=>E.key===B?{...E,exiting:!0}:E)),setTimeout(()=>{m(p=>p.filter(E=>E.key!==B))},500)},6e3)}}x(c.length)},[c.length]);const T=g.useCallback(()=>{const y=Date.now(),A=["#FFD700","#FF4444","#FF8800","#AA44FF","#4488FF"],B=Array.from({length:30},(p,E)=>{const R=Math.PI*2*E/30+(Math.random()-.5)*.5,L=100+Math.random()*200;return{dx:Math.cos(R)*L,dy:Math.sin(R)*L-50,color:A[Math.floor(Math.random()*A.length)]}});M(p=>[...p,{id:y,particles:B}]),setTimeout(()=>M(p=>p.filter(E=>E.id!==y)),2200)},[]);return s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"ml-rare-notifications",children:r.map(y=>s.jsxs("div",{className:`ml-rare-notif ${y.exiting?"exiting":""}`,children:[s.jsx("div",{className:"ml-rare-notif-title",children:"🎆 LEGENDARY RARE! 🎆"}),s.jsx("div",{className:"ml-rare-notif-name",children:y.rareName}),s.jsx("div",{className:"ml-rare-notif-by",children:"found by"}),s.jsx("div",{className:"ml-rare-notif-char",children:y.charName})]},y.key))}),s.jsx("div",{className:"ml-fireworks",children:j.map(y=>s.jsx(jn.Fragment,{children:y.particles.map((A,B)=>s.jsx("div",{className:"ml-firework-particle",style:{left:"50%",top:"30%",backgroundColor:A.color,"--dx":`${A.dx}px`,"--dy":`${A.dy+200}px`}},B))},y.id))})]})};let Ty=0;const Ey=({deathAlerts:c})=>{const[r,m]=g.useState([]),o=g.useRef(0);return g.useEffect(()=>{if(c.length>o.current&&o.current>0){const x=c.slice(o.current);for(const j of x){const M=++Ty;m(T=>[...T,{key:M,alert:j,exiting:!1}]);try{const T=new AudioContext,y=T.createOscillator(),A=T.createGain();y.connect(A),A.connect(T.destination),y.frequency.value=440,y.type="sawtooth",A.gain.value=.2,y.start(),A.gain.exponentialRampToValueAtTime(.001,T.currentTime+.8),y.stop(T.currentTime+.8)}catch{}setTimeout(()=>{m(T=>T.map(y=>y.key===M?{...y,exiting:!0}:y)),setTimeout(()=>m(T=>T.filter(y=>y.key!==M)),500)},8e3)}}o.current=c.length},[c.length]),r.length===0?null:s.jsx("div",{style:{position:"fixed",top:70,left:"50%",transform:"translateX(-50%)",zIndex:99999,display:"flex",flexDirection:"column",gap:6,pointerEvents:"none"},children:r.map(x=>s.jsxs("div",{style:{background:"linear-gradient(135deg, #2a0a0a, #1a0000)",border:"2px solid #cc4444",borderRadius:8,padding:"12px 24px",textAlign:"center",boxShadow:"0 0 30px rgba(204, 68, 68, 0.3)",animation:x.exiting?"ml-notif-out 0.5s ease-in forwards":"ml-notif-in 0.5s ease-out"},children:[s.jsx("div",{style:{fontSize:"1.2rem",fontWeight:800,color:"#ff4444"},children:"☠️ CHARACTER DIED ☠️"}),s.jsx("div",{style:{fontSize:"1rem",fontWeight:600,color:"#fff",marginTop:2},children:x.alert.character_name}),s.jsxs("div",{style:{fontSize:"0.8rem",color:"#c88",marginTop:2},children:["Vitae: ",x.alert.vitae,"%"]})]},x.key))})},Ld=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf","#ff4444","#44ff44","#4444ff","#ffff44","#ff44ff","#44ffff","#ff8844","#88ff44","#4488ff","#ff4488","#cc3333","#33cc33","#3333cc","#cccc33","#cc33cc","#33cccc","#cc6633","#66cc33","#3366cc","#cc3366","#ff6666","#66ff66","#6666ff","#ffff66","#ff66ff","#66ffff","#ffaa66","#aaff66","#66aaff","#ff66aa","#990099","#009900","#000099","#990000","#009999","#999900","#aa5500","#55aa00","#0055aa","#aa0055","#ffaaaa","#aaffaa","#aaaaff","#ffffaa","#ffaaff","#aaffff","#ffccaa","#ccffaa","#aaccff","#ffaacc"];function Ny(c){let r=0;for(let m=0;m{let x=c.current.get(o);return x||(x=r.current{const{enabled:c}=_s();return c?s.jsx("div",{className:"ms-banner",role:"status",children:"🐸 Glad midsommar! 🌼 Små grodorna, små grodorna… 🥂"}):null},Yd=["🐸","🌼","🌸","🇸🇪","🌿"],Pd=()=>{const{enabled:c}=_s();return g.useEffect(()=>{if(!c||window.matchMedia("(prefers-reduced-motion: reduce)").matches)return;const r=document.createElement("div");r.className="ms-rain",document.body.appendChild(r);const m=()=>{const x=document.createElement("span");x.textContent=Yd[Math.floor(Math.random()*Yd.length)],x.style.left=Math.floor(Math.random()*100)+"vw";const j=6+Math.random()*5;x.style.animationDuration=j.toFixed(2)+"s",x.style.fontSize=14+Math.floor(Math.random()*16)+"px",r.appendChild(x),window.setTimeout(()=>x.remove(),j*1e3+250)},o=window.setInterval(m,450);return()=>{window.clearInterval(o),r.remove()}},[c]),null},Cy=({data:c})=>{const r=My(),[m,o]=g.useState(!1),[x,j]=g.useState(!1),[M,T]=g.useState(null),y=g.useMemo(()=>Array.from(c.characters.values()).filter(R=>R.telemetry).map(R=>R.telemetry),[c.characters]),A=g.useMemo(()=>new Map(Array.from(c.characters.values()).filter(R=>R.vitals).map(R=>[R.name,R.vitals])),[c.characters]),[B,p]=g.useState("");g.useEffect(()=>{fetch("/api/api-version",{credentials:"include"}).then(R=>R.json()).then(R=>p(R.version??"")).catch(()=>{})},[]);const E=g.useCallback(R=>{T(L=>L===R?null:R)},[]);return s.jsx(q0,{children:s.jsxs("div",{className:"ml-layout",children:[s.jsx(Id,{}),s.jsx(Pd,{}),s.jsx(uy,{players:y,vitals:A,serverHealth:c.serverHealth,totalRares:c.totalRares,totalKills:c.totalKills,getColor:r,onSelectPlayer:E,showHeatmap:m,showPortals:x,onToggleHeatmap:o,onTogglePortals:j,version:B,selectedPlayer:M}),s.jsx(K0,{players:y,getColor:r,onSelectPlayer:E,showHeatmap:m,showPortals:x,selectedPlayer:M}),s.jsx(Fd,{characters:c.characters,chatMessages:c.chatMessages,nearbyObjects:c.nearbyObjects,inventoryVersions:c.inventoryVersions,equipmentCantrips:c.equipmentCantrips,characterStats:c.characterStats,socket:c.socketRef.current}),s.jsx(Ay,{recentRares:c.recentRares}),s.jsx(Ey,{deathAlerts:c.deathAlerts})]})})};function Dy(c){const r=g.useRef(null),m=g.useRef(0),o=g.useRef(c);o.current=c;const x=g.useCallback(()=>{var M;if(((M=r.current)==null?void 0:M.readyState)===WebSocket.OPEN)return;const j=new WebSocket(Y0());r.current=j,j.addEventListener("message",T=>{try{const y=JSON.parse(T.data);o.current(y)}catch{}}),j.addEventListener("close",()=>{r.current=null,m.current=window.setTimeout(x,2e3)}),j.addEventListener("error",()=>{j.close()})},[]);return g.useEffect(()=>(x(),()=>{var j;clearTimeout(m.current),(j=r.current)==null||j.close(),r.current=null}),[x]),r}function tm(){const[c,r]=g.useState(new Map),[m,o]=g.useState(null),[x,j]=g.useState(0),[M,T]=g.useState(0),[y,A]=g.useState([]),B=g.useRef(new Map),[p,E]=g.useState(0),[R,L]=g.useState(new Map),$=g.useRef(new Map),[at,U]=g.useState(0),q=g.useRef(new Map),[w,St]=g.useState(0),[Mt,F]=g.useState([]),[lt,Z]=g.useState(new Map),J=g.useRef(c);J.current=c;const P=g.useCallback((_,H)=>{r(Q=>{const Y=new Map(Q),X=Y.get(_)??{name:_,telemetry:null,vitals:null,combat:null,lastUpdate:0};return Y.set(_,H(X)),Y})},[]),Rt=g.useCallback(_=>{var H,Q;if(_.type){if(_.type==="telemetry"){const Y=_;P(Y.character_name,X=>({...X,telemetry:Y,lastUpdate:Date.now()}))}else if(_.type==="vitals"){const Y=_,X=(H=J.current.get(Y.character_name))==null?void 0:H.vitals;X&&(X.vitae??0)===0&&(Y.vitae??0)>0&&F(ot=>[...ot,{character_name:Y.character_name,vitae:Y.vitae,timestamp:new Date().toISOString()}].slice(-50)),P(Y.character_name,ot=>({...ot,vitals:Y,lastUpdate:Date.now()}))}else if(_.type==="combat_stats"){const Y=_;P(Y.character_name,X=>({...X,combat:Y,lastUpdate:Date.now()}))}else if(_.type==="rare"){const Y=_;A(X=>[Y,...X].slice(0,50))}else if(_.type==="inventory_delta"){const Y=_;Y.character_name&&L(X=>{const ot=new Map(X);return ot.set(Y.character_name,(ot.get(Y.character_name)??0)+1),ot})}else if(_.type==="character_stats"){const Y=_;q.current.set(Y.character_name,_),St(X=>X+1)}else if(_.type==="equipment_cantrip_state"){const Y=_;$.current.set(Y.character_name,Y),U(X=>X+1)}else if(_.type==="dungeon_map"){const Y=_;Y.landblock&&(window.__dungeonMapCache||(window.__dungeonMapCache={}),window.__dungeonMapCache[Y.landblock]=Y)}else if(_.type==="nearby_objects"){const Y=_;if(Z(X=>{const ot=new Map(X);return ot.set(Y.character_name,Y),ot}),Y.is_dungeon&&Y.landblock&&!((Q=window.__dungeonMapCache)!=null&&Q[Y.landblock])){const X=jt.current;(X==null?void 0:X.readyState)===WebSocket.OPEN&&X.send(JSON.stringify({type:"request_dungeon_map",landblock:Y.landblock}))}}else if(_.type==="chat"){const Y=_,X=B.current.get(Y.character_name)??[];X.push({text:Y.text,color:Y.color,timestamp:Y.timestamp}),X.length>1e3&&X.splice(0,X.length-1e3),B.current.set(Y.character_name,X),E(ot=>ot+1)}}},[P]),jt=Dy(Rt);g.useEffect(()=>{const _=async()=>{try{const Q=await $0();r(Y=>{var ot;const X=new Map(Y);for(const dt of Q.players??[]){const et=X.get(dt.character_name);X.set(dt.character_name,{name:dt.character_name,telemetry:dt,vitals:(et==null?void 0:et.vitals)??null,combat:(et==null?void 0:et.combat)??null,lastUpdate:Date.now()})}for(const dt of X.keys())(ot=Q.players)!=null&&ot.some(et=>et.character_name===dt)||X.delete(dt);return X})}catch{}};_();const H=setInterval(_,5e3);return()=>clearInterval(H)},[]),g.useEffect(()=>{const _=async()=>{try{const Q=await F0();for(const Y of Q.stats??[])P(Y.character_name,X=>({...X,combat:{...Y,type:"combat_stats"}}))}catch{}};_();const H=setInterval(_,3e4);return()=>clearInterval(H)},[P]),g.useEffect(()=>{const _=async()=>{try{o(await I0())}catch{}};_();const H=setInterval(_,3e4);return()=>clearInterval(H)},[]),g.useEffect(()=>{const _=async()=>{try{const[Q,Y]=await Promise.all([P0(),ty()]);j(Q.all_time??0),T(Y.total??0)}catch{}};_();const H=setInterval(_,3e5);return()=>clearInterval(H)},[]);const Ol=g.useMemo(()=>B.current,[p]),Tl=g.useMemo(()=>$.current,[at]),xl=g.useMemo(()=>q.current,[w]);return{characters:c,serverHealth:m,totalRares:x,totalKills:M,recentRares:y,chatMessages:Ol,nearbyObjects:lt,inventoryVersions:R,equipmentCantrips:Tl,characterStats:xl,deathAlerts:Mt,socketRef:jt}}const zs=({characters:c})=>{const[r,m]=g.useState("kph"),[o,x]=g.useState(!1),[j,M]=g.useState(null),T=g.useMemo(()=>{const p=Array.from(c.values()).filter(E=>E.telemetry).map(E=>{var L,$,at;const R=E.telemetry;return{name:E.name,kills:R.kills??0,kph:parseInt(R.kills_per_hour)||0,totalKills:R.total_kills??0,rares:R.total_rares??0,sessionRares:R.session_rares??0,deaths:parseInt(R.deaths)||0,totalDeaths:parseInt(R.total_deaths)||0,uptime:((L=R.onlinetime)==null?void 0:L.replace(/^00\./,""))??"",state:R.vt_state??"idle",tapers:parseInt(R.prismatic_taper_count)||0,hp:(($=E.vitals)==null?void 0:$.health_percentage)??0,vitae:((at=E.vitals)==null?void 0:at.vitae)??0}});return p.sort((E,R)=>{let L=0;switch(r){case"name":L=E.name.localeCompare(R.name);break;case"kills":L=E.kills-R.kills;break;case"kph":L=E.kph-R.kph;break;case"rares":L=E.rares-R.rares;break;case"deaths":L=E.totalDeaths-R.totalDeaths;break;case"uptime":L=E.uptime.localeCompare(R.uptime);break;case"state":L=E.state.localeCompare(R.state);break}return o?L:-L}),p},[c,r,o]),y=p=>{r===p?x(!o):(m(p),x(!1))},A=p=>({padding:"4px 6px",cursor:"pointer",userSelect:"none",color:r===p?"#6af":"#888",fontSize:"0.65rem",fontWeight:600,whiteSpace:"nowrap",borderBottom:"1px solid #444"}),B=p=>r===p?o?" ▲":" ▼":"";return s.jsxs("div",{style:{flex:1,overflow:"auto",fontSize:"0.73rem"},children:[s.jsxs("table",{style:{width:"auto",borderCollapse:"collapse"},children:[s.jsx("thead",{children:s.jsxs("tr",{style:{position:"sticky",top:0,background:"#1a1a1a",zIndex:1},children:[s.jsxs("th",{style:{...A("name"),textAlign:"left"},onClick:()=>y("name"),children:["Character",B("name")]}),s.jsxs("th",{style:{...A("state"),textAlign:"center"},onClick:()=>y("state"),children:["State",B("state")]}),s.jsxs("th",{style:{...A("kph"),textAlign:"right"},onClick:()=>y("kph"),children:["KPH",B("kph")]}),s.jsxs("th",{style:{...A("kills"),textAlign:"right"},onClick:()=>y("kills"),children:["Session",B("kills")]}),s.jsx("th",{style:{textAlign:"right",padding:"4px 6px",color:"#888",fontSize:"0.65rem",fontWeight:600,borderBottom:"1px solid #444"},children:"Total"}),s.jsxs("th",{style:{...A("rares"),textAlign:"right"},onClick:()=>y("rares"),children:["Rares",B("rares")]}),s.jsxs("th",{style:{...A("deaths"),textAlign:"right"},onClick:()=>y("deaths"),children:["Deaths",B("deaths")]}),s.jsxs("th",{style:{...A("uptime"),textAlign:"right"},onClick:()=>y("uptime"),children:["Uptime",B("uptime")]}),s.jsx("th",{style:{textAlign:"right",padding:"4px 6px",color:"#888",fontSize:"0.65rem",fontWeight:600,borderBottom:"1px solid #444"},children:"HP%"}),s.jsx("th",{style:{textAlign:"right",padding:"4px 6px",color:"#888",fontSize:"0.65rem",fontWeight:600,borderBottom:"1px solid #444"},children:"Vitae"}),s.jsx("th",{style:{textAlign:"right",padding:"4px 6px",color:"#888",fontSize:"0.65rem",fontWeight:600,borderBottom:"1px solid #444"},children:"Tapers"})]})}),s.jsx("tbody",{children:T.map(p=>{const E=p.state.toLowerCase(),R=E==="combat"||E==="hunt",L=j===p.name;return s.jsxs("tr",{onClick:()=>M(L?null:p.name),style:{borderBottom:"1px solid #1a1a1a",cursor:"pointer",background:L?"rgba(102, 170, 255, 0.18)":void 0,outline:L?"1px solid rgba(102, 170, 255, 0.55)":void 0,outlineOffset:"-1px"},children:[s.jsx("td",{style:{padding:"3px 10px 3px 6px",color:"#ccc",fontWeight:500,whiteSpace:"nowrap"},children:p.name}),s.jsx("td",{style:{textAlign:"center",padding:"3px 6px"},children:s.jsx("span",{style:{fontSize:"0.6rem",padding:"1px 6px",borderRadius:3,background:R?"rgba(68,204,68,0.15)":E==="idle"||E==="default"?"rgba(100,100,100,0.2)":"rgba(204,68,68,0.15)",color:R?"#4c4":E==="idle"||E==="default"?"#888":"#c44"},children:p.state})}),s.jsx("td",{style:{textAlign:"right",padding:"3px 6px",color:"#4c4",fontVariantNumeric:"tabular-nums"},children:p.kph.toLocaleString()}),s.jsx("td",{style:{textAlign:"right",padding:"3px 6px",color:"#ccc",fontVariantNumeric:"tabular-nums"},children:p.kills.toLocaleString()}),s.jsx("td",{style:{textAlign:"right",padding:"3px 6px",color:"#888",fontVariantNumeric:"tabular-nums"},children:p.totalKills.toLocaleString()}),s.jsxs("td",{style:{textAlign:"right",padding:"3px 6px",color:"#fc0",fontVariantNumeric:"tabular-nums"},children:[p.rares,p.sessionRares>0?` (${p.sessionRares})`:""]}),s.jsx("td",{style:{textAlign:"right",padding:"3px 6px",color:p.totalDeaths>0?"#c66":"#555",fontVariantNumeric:"tabular-nums"},children:p.totalDeaths}),s.jsx("td",{style:{textAlign:"right",padding:"3px 6px",color:"#888",fontVariantNumeric:"tabular-nums"},children:p.uptime}),s.jsxs("td",{style:{textAlign:"right",padding:"3px 6px",fontVariantNumeric:"tabular-nums",color:p.hp>80?"#4c4":p.hp>40?"#ca0":"#c44"},children:[p.hp.toFixed(0),"%"]}),s.jsx("td",{style:{textAlign:"right",padding:"3px 6px",fontVariantNumeric:"tabular-nums",color:p.vitae>0?"#f66":"#333"},children:p.vitae>0?`${p.vitae}%`:""}),s.jsx("td",{style:{textAlign:"right",padding:"3px 6px",color:"#888",fontVariantNumeric:"tabular-nums"},children:p.tapers.toLocaleString()})]},p.name)})})]}),T.length===0&&s.jsx("div",{style:{padding:20,color:"#666",textAlign:"center"},children:"No characters online"})]})},Oy=({id:c,zIndex:r,characters:m})=>s.jsx(Jd,{id:c,title:"Player Dashboard",zIndex:r,width:850,height:500,children:s.jsx(zs,{characters:m})}),Uy=Object.freeze(Object.defineProperty({__proto__:null,PlayerDashboardContent:zs,PlayerDashboardWindow:Oy},Symbol.toStringTag,{value:"Module"})),Ry=()=>{const c=tm(),[r,m]=g.useState("");g.useEffect(()=>{const x=document.title;return document.title="Overlord Dashboard",()=>{document.title=x}},[]),g.useEffect(()=>{fetch("/api/api-version",{credentials:"include"}).then(x=>x.json()).then(x=>m(x.version??"")).catch(()=>{})},[]);const o=Array.from(c.characters.values()).filter(x=>x.telemetry).length;return s.jsxs("div",{className:"ml-dashboard-page",children:[s.jsx(Id,{}),s.jsx(Pd,{}),s.jsxs("header",{className:"ml-dashboard-header",children:[s.jsx("span",{className:"ml-dashboard-title",children:"👥 Player Dashboard"}),s.jsxs("span",{className:"ml-dashboard-count",children:[o," online"]}),s.jsx("span",{style:{flex:1}}),r&&s.jsxs("span",{className:"ml-dashboard-version",children:["v",r]})]}),s.jsx("main",{className:"ml-dashboard-main",children:s.jsx(zs,{characters:c.characters})})]})},je={text:"",characters:"all",itemType:"all",weaponTypes:[],slots:[],cantrips:[],spellContains:"",ratings:{},itemSet:"",equipStatus:"",bonded:!1,attuned:!1,rare:!1,maxLevel:"",minValue:"",minWorkmanship:"",maxBurden:"",sortBy:"name",sortDir:"asc",page:1},W=c=>({value:c,label:c.replace(/^Legendary /,"")}),qy=[{group:"Attributes",items:[W("Legendary Strength"),W("Legendary Endurance"),W("Legendary Quickness"),W("Legendary Coordination"),W("Legendary Willpower"),W("Legendary Focus")]},{group:"Weapon skills",items:[W("Legendary Heavy Weapon Aptitude"),W("Legendary Light Weapon Aptitude"),W("Legendary Finesse Weapon Aptitude"),W("Legendary Missile Weapon Aptitude"),W("Legendary Two Handed Combat Aptitude"),W("Legendary Dual Wield Aptitude"),W("Legendary Shield Aptitude"),W("Legendary Sneak Attack Prowess"),W("Legendary Dirty Fighting Prowess"),W("Legendary Recklessness Prowess"),W("Legendary Defender"),W("Legendary Blood Thirst")]},{group:"Magic",items:[W("Legendary War Magic Aptitude"),W("Legendary Void Magic Aptitude"),W("Legendary Creature Enchantment Aptitude"),W("Legendary Item Enchantment Aptitude"),W("Legendary Life Magic Aptitude"),W("Legendary Mana Conversion Prowess"),W("Legendary Arcane Prowess"),W("Legendary Hermetic Link"),W("Legendary Spirit Thirst"),W("Legendary Magic Resistance")]},{group:"Utility",items:[W("Legendary Summoning Prowess"),W("Legendary Healing Prowess"),W("Legendary Leadership"),W("Legendary Deception Prowess"),W("Legendary Person Attunement"),W("Legendary Magic Item Tinkering Expertise")]},{group:"Defense",items:[W("Legendary Invulnerability"),W("Legendary Impenetrability"),W("Legendary Impregnability"),W("Legendary Armor")]},{group:"Wards & Banes",items:[W("Legendary Flame Ward"),W("Legendary Frost Ward"),W("Legendary Acid Ward"),W("Legendary Storm Ward"),W("Legendary Slashing Ward"),W("Legendary Piercing Ward"),W("Legendary Bludgeoning Ward"),W("Legendary Piercing Bane"),W("Legendary Storm Bane")]}],By=["Ring","Bracelet","Neck","Trinket","Cloak"],Hy=["Head","Chest","Abdomen","Upper Arms","Lower Arms","Hands","Upper Legs","Lower Legs","Feet","Shield"],lm=[{value:"heavy",label:"Heavy"},{value:"light",label:"Light"},{value:"finesse",label:"Finesse"},{value:"two_handed",label:"Two-Handed"},{value:"missile",label:"Missile"},{value:"war",label:"War Magic"},{value:"void",label:"Void Magic"}],bs=[{param:"min_od",label:"Weapon OD",common:!0},{param:"min_damage_rating",label:"Damage rating",common:!0},{param:"min_crit_damage_rating",label:"Crit damage",common:!0},{param:"min_heal_boost_rating",label:"Heal boost",common:!0},{param:"min_vitality_rating",label:"Vitality",common:!0},{param:"min_armor",label:"Armor level"},{param:"min_damage_resist_rating",label:"Damage resist"},{param:"min_crit_resist_rating",label:"Crit resist"},{param:"min_crit_damage_resist_rating",label:"Crit dmg resist"},{param:"min_healing_resist_rating",label:"Healing resist"},{param:"min_nether_resist_rating",label:"Nether resist"},{param:"min_healing_rating",label:"Healing rating"},{param:"min_dot_resist_rating",label:"DoT resist"},{param:"min_life_resist_rating",label:"Life resist"},{param:"min_sneak_attack_rating",label:"Sneak attack"},{param:"min_recklessness_rating",label:"Recklessness"},{param:"min_deception_rating",label:"Deception"},{param:"min_pk_damage_rating",label:"PK damage"},{param:"min_pk_damage_resist_rating",label:"PK dmg resist"},{param:"min_gear_pk_damage_rating",label:"Gear PK dmg"},{param:"min_gear_pk_damage_resist_rating",label:"Gear PK resist"},{param:"min_tinks",label:"Tinks"}],Ss=[{key:"name",label:"Item",sortKey:"name",defaultVisible:!0},{key:"character_name",label:"Character",sortKey:"character_name",defaultVisible:!0},{key:"slot_name",label:"Slot",defaultVisible:!0},{key:"value",label:"Value",sortKey:"value",defaultVisible:!0},{key:"wield_level",label:"Wield",sortKey:"level",defaultVisible:!0},{key:"spell_names",label:"Spells / Cantrips",sortKey:"spell_names",defaultVisible:!0},{key:"armor_level",label:"Armor",sortKey:"armor",defaultVisible:!1},{key:"max_damage",label:"Max Dmg",sortKey:"damage",defaultVisible:!1},{key:"od_rating",label:"OD",sortKey:"od",defaultVisible:!1},{key:"workmanship",label:"Work",sortKey:"workmanship",defaultVisible:!1},{key:"item_set_name",label:"Set",sortKey:"item_set",defaultVisible:!1},{key:"object_class_name",label:"Type",sortKey:"item_type_name",defaultVisible:!1},{key:"burden",label:"Burden",defaultVisible:!1},{key:"condition_percent",label:"Cond %",defaultVisible:!1},{key:"last_updated",label:"Updated",sortKey:"last_updated",defaultVisible:!1}],Ly=1e4,ku=300,em="inv.visibleColumns";function Yy(c){const r={};for(const o of Object.keys(je))JSON.stringify(c[o])!==JSON.stringify(je[o])&&(r[o]=c[o]);const m=new URL(window.location.href);m.searchParams.set("view","inventory"),Object.keys(r).length?m.searchParams.set("q",JSON.stringify(r)):m.searchParams.delete("q");try{window.history.replaceState(null,"",m)}catch{}}const Vy=new Set(["all","armor","jewelry","weapon","clothing","shirt","pants"]),Xy=new Set(["asc","desc"]);function Vd(c){return Array.isArray(c)&&c.every(r=>typeof r=="string")}function wy(c,r){switch(c){case"characters":return r==="all"||Vd(r)?r:void 0;case"slots":case"cantrips":case"weaponTypes":return Vd(r)?r:void 0;case"itemType":return typeof r=="string"&&Vy.has(r)?r:void 0;case"sortDir":return typeof r=="string"&&Xy.has(r)?r:void 0;case"ratings":{if(typeof r!="object"||r===null||Array.isArray(r))return;const m={};for(const[o,x]of Object.entries(r))(x===""||typeof x=="number")&&(m[o]=x);return m}case"text":case"spellContains":case"itemSet":case"sortBy":return typeof r=="string"?r:void 0;case"equipStatus":return r===""||r==="equipped"||r==="unequipped"?r:void 0;case"bonded":case"attuned":case"rare":return typeof r=="boolean"?r:void 0;case"maxLevel":case"minValue":case"minWorkmanship":case"maxBurden":return r===""||typeof r=="number"?r:void 0;case"page":return typeof r=="number"&&Number.isInteger(r)&&r>0?r:void 0;default:return}}function Gy(){try{const c=new URLSearchParams(window.location.search).get("q");if(!c)return je;const r=JSON.parse(c);if(typeof r!="object"||r===null||Array.isArray(r))return je;const m={...je};for(const o of Object.keys(je)){if(!(o in r))continue;const x=wy(o,r[o]);x!==void 0&&(m[o]=x)}return m}catch{return je}}function Qy(c){const r=new URLSearchParams;switch(c.characters==="all"?r.set("include_all_characters","true"):c.characters.length===1?r.set("character",c.characters[0]):r.set("characters",c.characters.join(",")),c.text&&r.set("text",c.text),c.itemType){case"armor":r.set("armor_only","true");break;case"jewelry":r.set("jewelry_only","true");break;case"clothing":r.set("clothing_only","true");break;case"shirt":r.set("shirt_only","true");break;case"pants":r.set("pants_only","true");break;case"weapon":r.set("weapon_only","true"),c.weaponTypes.length&&r.set("weapon_types",c.weaponTypes.join(","));break}c.slots.length&&r.set("slot_names",c.slots.join(",")),c.cantrips.length&&r.set("legendary_cantrips",c.cantrips.join(",")),c.spellContains&&r.set("spell_contains",c.spellContains);for(const[m,o]of Object.entries(c.ratings))o!==""&&r.set(m,String(o));return c.itemSet&&r.set("item_set",c.itemSet),c.equipStatus&&r.set("equipment_status",c.equipStatus),c.bonded&&r.set("bonded","true"),c.attuned&&r.set("attuned","true"),c.rare&&r.set("is_rare","true"),c.maxLevel!==""&&r.set("max_level",String(c.maxLevel)),c.minValue!==""&&r.set("min_value",String(c.minValue)),c.minWorkmanship!==""&&r.set("min_workmanship",String(c.minWorkmanship)),c.maxBurden!==""&&r.set("max_burden",String(c.maxBurden)),r.set("sort_by",c.sortBy),r.set("sort_dir",c.sortDir),r.set("page",String(c.page)),r.set("limit",String(Ly)),r}function Zy(){const[c,r]=g.useState(Gy),[m,o]=g.useState(null),[x,j]=g.useState(!1),[M,T]=g.useState(null),[y,A]=g.useState(null),B=g.useRef(null),p=g.useCallback(R=>{r(L=>({...L,page:"page"in R?L.page:1,...R}))},[]),E=g.useCallback(()=>r(je),[]);return g.useEffect(()=>{const R=setTimeout(async()=>{var at;Yy(c),(at=B.current)==null||at.abort();const L=new AbortController;B.current=L,j(!0);const $=performance.now();try{const U=await fetch(`/api/inv/search/items?${Qy(c)}`,{credentials:"include",signal:L.signal});if(!U.ok)throw new Error(`search: HTTP ${U.status}`);const q=await U.json();if(q.error)throw new Error(q.error);o(q),T(null),A(Math.round(performance.now()-$))}catch(U){(U==null?void 0:U.name)!=="AbortError"&&T(String((U==null?void 0:U.message)??U))}finally{B.current===L&&j(!1)}},400);return()=>clearTimeout(R)},[c]),{filters:c,update:p,reset:E,result:m,loading:x,error:M,queryMs:y}}function Ky({search:c}){const{filters:r,update:m}=c,[o,x]=g.useState([]),[j,M]=g.useState(new Set),[T,y]=g.useState("");g.useEffect(()=>{It("/inv/characters/list").then(E=>x(E.characters.map(R=>R.character_name).sort((R,L)=>R.localeCompare(L)))).catch(()=>{}),It("/live").then(E=>M(new Set(E.players.map(R=>R.character_name)))).catch(()=>{})},[]);const A=g.useMemo(()=>r.characters==="all"?new Set(o):new Set(r.characters),[r.characters,o]),B=E=>{const R=new Set(A);R.has(E)?R.delete(E):R.add(E),m({characters:R.size===o.length?"all":[...R]})},p=o.filter(E=>E.toLowerCase().includes(T.toLowerCase()));return s.jsxs(ze,{title:"Characters",defaultOpen:!0,badge:r.characters==="all"?"All":r.characters.length,children:[s.jsx("input",{className:"inv-minisearch",placeholder:"filter characters…",value:T,onChange:E=>y(E.target.value)}),s.jsxs("div",{className:"inv-links",children:[s.jsx("span",{className:"inv-linky",onClick:()=>m({characters:"all"}),children:"All"})," · ",s.jsx("span",{className:"inv-linky",onClick:()=>m({characters:[]}),children:"None"})," · ",s.jsx("span",{className:"inv-linky",onClick:()=>m({characters:o.filter(E=>j.has(E))}),children:"Online"})]}),p.map(E=>s.jsxs("label",{className:"inv-fitem",children:[s.jsx("input",{type:"checkbox",checked:A.has(E),onChange:()=>B(E)}),E," ",j.has(E)&&s.jsx("span",{className:"inv-online"})]},E))]})}function ky({search:c}){const{filters:r,update:m}=c,[o,x]=g.useState(""),j=T=>m({cantrips:r.cantrips.includes(T)?r.cantrips.filter(y=>y!==T):[...r.cantrips,T]}),M=T=>T.toLowerCase().includes(o.toLowerCase());return s.jsxs(ze,{title:"Cantrips",defaultOpen:!0,badge:r.cantrips.length||void 0,children:[s.jsx("input",{className:"inv-minisearch",placeholder:"find cantrip… e.g. invuln",value:o,onChange:T=>x(T.target.value)}),r.cantrips.length>0&&s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"inv-subhead",children:"Selected"}),r.cantrips.map(T=>s.jsxs("label",{className:"inv-fitem inv-gold",children:[s.jsx("input",{type:"checkbox",checked:!0,onChange:()=>j(T)}),T.replace(/^Legendary /,"")]},T))]}),qy.map(T=>{const y=T.items.filter(A=>!r.cantrips.includes(A.value)&&M(A.label));return y.length?s.jsxs("div",{children:[s.jsx("div",{className:"inv-subhead",children:T.group}),y.map(A=>s.jsxs("label",{className:"inv-fitem",children:[s.jsx("input",{type:"checkbox",checked:!1,onChange:()=>j(A.value)})," ",A.label]},A.value))]},T.group):null}),s.jsx("div",{className:"inv-subhead",children:"Any-tier spell search"}),s.jsx("input",{className:"inv-minisearch",placeholder:"spell name contains… e.g. Epic Invuln",value:r.spellContains,onChange:T=>m({spellContains:T.target.value})})]})}function ze(c){const[r,m]=g.useState(c.defaultOpen??!1);return s.jsxs("div",{className:`inv-grp${r?" inv-open":""}`,children:[s.jsxs("div",{className:"inv-grp-head",onClick:()=>m(o=>!o),children:[s.jsx("span",{className:"inv-arrow",children:"▶"})," ",c.title,c.badge?s.jsx("span",{className:"inv-badge",children:c.badge}):null]}),r&&s.jsx("div",{className:"inv-grp-body",children:c.children})]})}function Jy({search:c}){const{filters:r,update:m}=c,[o,x]=g.useState(!1),[j,M]=g.useState(!1),[T,y]=g.useState([]),[A,B]=g.useState("");g.useEffect(()=>{It("/inv/sets/list").then(U=>y(U.sets)).catch(()=>{})},[]);const p=U=>m({slots:r.slots.includes(U)?r.slots.filter(q=>q!==U):[...r.slots,U]}),E=(U,q)=>m({ratings:{...r.ratings,[U]:q===""?"":Number(q)}}),R=Object.values(r.ratings).filter(U=>U!=="").length,L=[r.equipStatus!=="",r.bonded,r.attuned,r.rare].filter(Boolean).length,$=[r.maxLevel,r.minValue,r.minWorkmanship,r.maxBurden].filter(U=>U!=="").length,at=[["all","All items"],["armor","Armor"],["jewelry","Jewelry"],["weapon","Weapons"],["clothing","Clothing"],["shirt","Shirts"],["pants","Pants"]];return s.jsxs("div",{className:"inv-sidebar",children:[s.jsx(Ky,{search:c}),s.jsxs(ze,{title:"Item state",defaultOpen:!0,badge:L||void 0,children:[[["","Any"],["equipped","Equipped"],["unequipped","Not equipped"]].map(([U,q])=>s.jsxs("label",{className:"inv-fitem",children:[s.jsx("input",{type:"radio",name:"inv-eq",checked:r.equipStatus===U,onChange:()=>m({equipStatus:U})})," ",q]},q)),s.jsxs("label",{className:"inv-fitem",children:[s.jsx("input",{type:"checkbox",checked:r.bonded,onChange:U=>m({bonded:U.target.checked})})," Bonded"]}),s.jsxs("label",{className:"inv-fitem",children:[s.jsx("input",{type:"checkbox",checked:r.attuned,onChange:U=>m({attuned:U.target.checked})})," Attuned"]}),s.jsxs("label",{className:"inv-fitem",children:[s.jsx("input",{type:"checkbox",checked:r.rare,onChange:U=>m({rare:U.target.checked})})," Rare"]})]}),s.jsxs(ze,{title:"Item type",defaultOpen:!0,badge:r.itemType!=="all"?1:void 0,children:[at.map(([U,q])=>s.jsxs("label",{className:"inv-fitem",children:[s.jsx("input",{type:"radio",name:"inv-t",checked:r.itemType===U,onChange:()=>m({itemType:U,weaponTypes:[]})})," ",q]},U)),r.itemType==="weapon"&&s.jsx("div",{className:"inv-subgroup",children:lm.map(U=>s.jsxs("label",{className:"inv-fitem",children:[s.jsx("input",{type:"checkbox",checked:r.weaponTypes.includes(U.value),onChange:()=>m({weaponTypes:r.weaponTypes.includes(U.value)?r.weaponTypes.filter(q=>q!==U.value):[...r.weaponTypes,U.value]})})," ",U.label]},U.value))})]}),s.jsxs(ze,{title:"Slots",defaultOpen:!0,badge:r.slots.length||void 0,children:[By.map(U=>s.jsxs("label",{className:"inv-fitem",children:[s.jsx("input",{type:"checkbox",checked:r.slots.includes(U),onChange:()=>p(U)})," ",U]},U)),s.jsxs("span",{className:"inv-linky",onClick:()=>x(U=>!U),children:[o?"hide":"show"," armor slots ",o?"▴":"▾"]}),o&&Hy.map(U=>s.jsxs("label",{className:"inv-fitem",children:[s.jsx("input",{type:"checkbox",checked:r.slots.includes(U),onChange:()=>p(U)})," ",U]},U))]}),s.jsx(ky,{search:c}),s.jsxs(ze,{title:"Ratings",badge:R||void 0,children:[bs.filter(U=>j||U.common).map(U=>s.jsxs("div",{className:"inv-range",children:[s.jsxs("label",{children:[U.label," ≥"]}),s.jsx("input",{type:"number",value:r.ratings[U.param]??"",placeholder:"min",onChange:q=>E(U.param,q.target.value)})]},U.param)),s.jsx("span",{className:"inv-linky",onClick:()=>M(U=>!U),children:j?"common ratings ▴":`all ${bs.length} ratings ▾`})]}),s.jsxs(ze,{title:"Equipment sets",badge:r.itemSet?1:void 0,children:[s.jsx("input",{className:"inv-minisearch",placeholder:"find set…",value:A,onChange:U=>B(U.target.value)}),s.jsxs("label",{className:"inv-fitem",children:[s.jsx("input",{type:"radio",name:"inv-set",checked:r.itemSet==="",onChange:()=>m({itemSet:""})})," Any set"]}),T.filter(U=>U.id.toLowerCase().includes(A.toLowerCase())).map(U=>s.jsxs("label",{className:"inv-fitem",children:[s.jsx("input",{type:"radio",name:"inv-set",checked:r.itemSet===U.id,onChange:()=>m({itemSet:U.id})})," ",U.id," ",s.jsxs("span",{className:"inv-dim",children:["(",U.item_count,")"]})]},U.id))]}),s.jsxs(ze,{title:"Reqs & value",badge:$||void 0,children:[s.jsxs("div",{className:"inv-range",children:[s.jsx("label",{children:"Wield lvl ≤"}),s.jsx("input",{type:"number",value:r.maxLevel,placeholder:"max",onChange:U=>m({maxLevel:U.target.value===""?"":Number(U.target.value)})})]}),s.jsxs("div",{className:"inv-range",children:[s.jsx("label",{children:"Value ≥"}),s.jsx("input",{type:"number",value:r.minValue,placeholder:"min",onChange:U=>m({minValue:U.target.value===""?"":Number(U.target.value)})})]}),s.jsxs("div",{className:"inv-range",children:[s.jsx("label",{children:"Workmanship ≥"}),s.jsx("input",{type:"number",value:r.minWorkmanship,placeholder:"min",onChange:U=>m({minWorkmanship:U.target.value===""?"":Number(U.target.value)})})]}),s.jsxs("div",{className:"inv-range",children:[s.jsx("label",{children:"Burden ≤"}),s.jsx("input",{type:"number",value:r.maxBurden,placeholder:"max",onChange:U=>m({maxBurden:U.target.value===""?"":Number(U.target.value)})})]})]})]})}function Wy({search:c}){var x;const{filters:r,update:m}=c,o=[];if(r.text&&o.push({label:`"${r.text}"`,remove:()=>m({text:""})}),r.characters!=="all"&&o.push({label:`${r.characters.length} character${r.characters.length===1?"":"s"}`,remove:()=>m({characters:"all"})}),r.itemType!=="all"&&o.push({label:r.itemType[0].toUpperCase()+r.itemType.slice(1),remove:()=>m({itemType:"all",weaponTypes:[]})}),r.itemType==="weapon")for(const j of r.weaponTypes){const M=((x=lm.find(T=>T.value===j))==null?void 0:x.label)??j;o.push({label:M,remove:()=>m({weaponTypes:r.weaponTypes.filter(T=>T!==j)})})}for(const j of r.slots)o.push({label:`Slot: ${j}`,remove:()=>m({slots:r.slots.filter(M=>M!==j)})});for(const j of r.cantrips)o.push({label:j.replace(/^Legendary /,"Leg. "),gold:!0,remove:()=>m({cantrips:r.cantrips.filter(M=>M!==j)})});r.spellContains&&o.push({label:`Spell: ${r.spellContains}`,remove:()=>m({spellContains:""})});for(const[j,M]of Object.entries(r.ratings))if(M!==""){const T=bs.find(y=>y.param===j);o.push({label:`${(T==null?void 0:T.label)??j} ≥ ${M}`,remove:()=>{const{[j]:y,...A}=r.ratings;m({ratings:A})}})}return r.itemSet&&o.push({label:`Set: ${r.itemSet}`,remove:()=>m({itemSet:""})}),r.equipStatus&&o.push({label:r.equipStatus==="equipped"?"Equipped":"Not equipped",remove:()=>m({equipStatus:""})}),r.bonded&&o.push({label:"Bonded",remove:()=>m({bonded:!1})}),r.attuned&&o.push({label:"Attuned",remove:()=>m({attuned:!1})}),r.rare&&o.push({label:"Rare",remove:()=>m({rare:!1})}),r.maxLevel!==""&&o.push({label:`Wield ≤ ${r.maxLevel}`,remove:()=>m({maxLevel:""})}),r.minValue!==""&&o.push({label:`Value ≥ ${r.minValue}`,remove:()=>m({minValue:""})}),r.minWorkmanship!==""&&o.push({label:`Work ≥ ${r.minWorkmanship}`,remove:()=>m({minWorkmanship:""})}),r.maxBurden!==""&&o.push({label:`Burden ≤ ${r.maxBurden}`,remove:()=>m({maxBurden:""})}),o.length?s.jsxs("div",{className:"inv-chipsrow",children:[s.jsx("span",{className:"inv-chips-lbl",children:"ACTIVE"}),o.map((j,M)=>s.jsxs("span",{className:`inv-chip${j.gold?" inv-chip-gold":""}`,children:[j.label," ",s.jsx("span",{className:"inv-chip-x",onClick:j.remove,children:"×"})]},M))]}):null}function $y(){try{const c=localStorage.getItem(em);if(c)return new Set(JSON.parse(c))}catch{}return new Set(Ss.filter(c=>c.defaultVisible).map(c=>c.key))}function Fy(c,r){switch(r){case"name":return s.jsxs(s.Fragment,{children:[c.name,c.is_equipped&&s.jsx("span",{className:"inv-equipped",children:" ⚔"})]});case"spell_names":return s.jsx("span",{className:"inv-spells",children:(c.spell_names??[]).map((m,o)=>s.jsxs("span",{children:[o>0&&", ",s.jsx("span",{className:/legendary/i.test(m)?"inv-leg":"",children:m})]},o))});case"value":return c.value!=null?c.value.toLocaleString():"—";case"last_updated":return c.last_updated?c.last_updated.slice(0,16).replace("T"," "):"—";case"od_rating":{const m=c.od_rating;return m==null?"—":String(m)}default:{const m=c[r];return m==null||m===-1?"—":String(m)}}}function Iy({search:c,selected:r,onSelect:m}){const{filters:o,update:x,result:j}=c,[M,T]=g.useState($y),[y,A]=g.useState(!1),[B,p]=g.useState(ku),E=g.useRef(null),R=g.useMemo(()=>{const q=new Set(M);return o.itemType==="weapon"&&q.add("od_rating"),Ss.filter(w=>q.has(w.key))},[M,o.itemType]),L=(j==null?void 0:j.items)??[],$=L.slice(0,B);g.useEffect(()=>{var q;p(ku),(q=E.current)==null||q.scrollTo(0,0)},[j]);const at=()=>{const q=E.current;!q||B>=L.length||q.scrollTop+q.clientHeight>=q.scrollHeight-600&&p(w=>Math.min(w+ku,L.length))};g.useEffect(()=>{try{localStorage.setItem(em,JSON.stringify([...M]))}catch{}},[M]),g.useEffect(()=>{const q=w=>{var F,lt;if(((F=w.target)==null?void 0:F.tagName)==="INPUT"||((lt=w.target)==null?void 0:lt.tagName)==="SELECT")return;if(w.key==="Escape"){m(null);return}if(w.key!=="ArrowDown"&&w.key!=="ArrowUp")return;w.preventDefault();const St=r?L.indexOf(r):-1,Mt=w.key==="ArrowDown"?Math.min(St+1,L.length-1):Math.max(St-1,0);L[Mt]&&(m(L[Mt]),Mt>=B&&p(Z=>Math.min(Z+ku,L.length)))};return window.addEventListener("keydown",q),()=>window.removeEventListener("keydown",q)},[L,r,m,B]);const U=q=>{q&&(o.sortBy===q?x({sortDir:o.sortDir==="asc"?"desc":"asc"}):x({sortBy:q,sortDir:"asc"}))};return s.jsxs("div",{className:"inv-results",ref:E,onScroll:at,children:[s.jsxs("div",{className:"inv-colpicker-anchor",children:[s.jsx("button",{className:"inv-btn inv-colpicker-btn",onClick:()=>A(q=>!q),children:"⚙ Columns"}),y&&s.jsx("div",{className:"inv-colpicker",children:Ss.map(q=>s.jsxs("label",{className:"inv-fitem",children:[s.jsx("input",{type:"checkbox",checked:M.has(q.key),onChange:()=>{const w=new Set(M);w.has(q.key)?w.delete(q.key):w.add(q.key),T(w)}})," ",q.label]},q.key))})]}),s.jsxs("table",{children:[s.jsx("thead",{children:s.jsx("tr",{children:R.map(q=>s.jsx("th",{className:o.sortBy===q.sortKey?`inv-sorted-${o.sortDir}`:"",onClick:()=>U(q.sortKey),children:q.label},q.key))})}),s.jsxs("tbody",{children:[$.map((q,w)=>s.jsx("tr",{className:q===r?"inv-sel":"",onClick:()=>m(q===r?null:q),children:R.map(St=>s.jsx("td",{children:Fy(q,St.key)},St.key))},w)),!L.length&&s.jsx("tr",{children:s.jsx("td",{colSpan:R.length,className:"inv-dim",children:"No items match."})})]})]}),B=L.length&&s.jsx("div",{className:"inv-pager",children:s.jsxs("span",{className:"inv-dim",children:["Showing the first ",L.length.toLocaleString()," of ",j.total_count.toLocaleString()," matches — narrow your filters to see the rest."]})})]})}function Al({k:c,v:r}){return s.jsxs("div",{className:"inv-kv",children:[s.jsx("span",{children:c}),s.jsx("b",{children:r??"—"})]})}function Py({item:c,onClose:r}){var m,o;return s.jsxs("div",{className:"inv-detail",children:[s.jsx("span",{className:"inv-closex",onClick:r,children:"×"}),s.jsx("h3",{children:c.name}),s.jsxs("div",{className:"inv-detail-sub",children:[c.slot_name??c.object_class_name??""," · ",c.is_equipped?"⚔ Equipped":"📦 Inventory",c.is_rare&&" · ★ Rare"]}),s.jsx(Al,{k:"Character",v:c.character_name}),s.jsx(Al,{k:"Value",v:(m=c.value)==null?void 0:m.toLocaleString()}),s.jsx(Al,{k:"Burden",v:c.burden}),s.jsx(Al,{k:"Wield req",v:c.wield_level?`Level ${c.wield_level}`:"—"}),s.jsx(Al,{k:"Workmanship",v:c.workmanship??"—"}),c.armor_level!=null&&c.armor_level>0&&s.jsx(Al,{k:"Armor",v:c.armor_level}),c.max_damage!=null&&c.max_damage>0&&s.jsx(Al,{k:"Max damage",v:c.max_damage}),c.od_rating!=null&&s.jsx(Al,{k:"Weapon OD",v:String(c.od_rating)}),c.condition_percent!=null&&s.jsx(Al,{k:"Condition",v:`${c.condition_percent}%`}),c.item_set_name&&s.jsx(Al,{k:"Set",v:c.item_set_name}),(c.is_bonded||c.is_attuned)&&s.jsx(Al,{k:"Binding",v:[c.is_bonded&&"Bonded",c.is_attuned&&"Attuned"].filter(Boolean).join(", ")}),s.jsx("hr",{}),s.jsxs("div",{className:"inv-sphead",children:["Spells (",((o=c.spell_names)==null?void 0:o.length)??0,")"]}),(c.spell_names??[]).map((x,j)=>s.jsx("div",{className:`inv-sp${/legendary/i.test(x)?" inv-leg":""}`,children:x},j)),s.jsx("div",{className:"inv-hint",children:"↑/↓ next item · Esc close"})]})}function Xd(c){return`${c.name} ${c.character_name} ${c.last_updated??""}`}class tv extends g.Component{constructor(r){super(r),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(r,m){console.error("Inventory search crashed:",r,m)}render(){return this.state.hasError?s.jsx("div",{className:"inv-page",children:s.jsxs("div",{className:"inv-error",style:{margin:"auto",textAlign:"center",padding:24},children:[s.jsx("p",{style:{marginBottom:12},children:"Something went wrong loading the inventory search page."}),s.jsx("button",{className:"inv-btn",onClick:()=>{window.location.href="/?view=inventory"},children:"Reset filters"})]})}):this.props.children}}function lv(){const c=Zy(),[r,m]=g.useState(null);return g.useEffect(()=>{var M;if(!r)return;const o=((M=c.result)==null?void 0:M.items)??[],x=Xd(r),j=o.find(T=>Xd(T)===x);j&&j!==r?m(j):j||m(null)},[c.result]),s.jsxs("div",{className:"inv-page",children:[s.jsxs("div",{className:"inv-topbar",children:[s.jsx("span",{className:"inv-title",children:"⚔ Inventory Search"}),s.jsx("input",{className:"inv-searchbox",placeholder:"Search name or material…",value:c.filters.text,onChange:o=>c.update({text:o.target.value})}),s.jsx("button",{className:"inv-btn",onClick:()=>{c.reset(),m(null)},children:"Reset"}),s.jsx("span",{className:"inv-count",children:c.error?s.jsx("span",{className:"inv-error",children:c.error}):c.result?s.jsxs(s.Fragment,{children:[s.jsx("b",{children:c.result.total_count.toLocaleString()})," items",c.queryMs!=null&&s.jsxs(s.Fragment,{children:[" · ",c.queryMs," ms"]}),c.loading&&" · …"]}):"loading…"})]}),s.jsx(Wy,{search:c}),s.jsxs("div",{className:"inv-main",children:[s.jsx(Jy,{search:c}),s.jsx(Iy,{search:c,selected:r,onSelect:m}),r&&s.jsx(Py,{item:r,onClose:()=>m(null)})]})]})}function ev(){return s.jsx(tv,{children:s.jsx(lv,{})})}function av(){const c=new URLSearchParams(window.location.search).get("view");return s.jsx(G0,{children:c==="dashboard"?s.jsx(Ry,{}):c==="inventory"?s.jsx(ev,{}):s.jsx(nv,{})})}function nv(){const c=tm();return s.jsx(Cy,{data:c})}R0.createRoot(document.getElementById("root")).render(s.jsx(g.StrictMode,{children:s.jsx(av,{})}));"serviceWorker"in navigator&&navigator.serviceWorker.register("/sw.js").catch(()=>{});export{Jd as D,It as a,sv as b,iv as c,cv as d,ay as e,rv as f,ov as g,dv as h,s as j,fv as l,g as r,An as u}; diff --git a/static/assets/index-YQnl0KV7.js b/static/assets/index-YQnl0KV7.js deleted file mode 100644 index f561a0fd..00000000 --- a/static/assets/index-YQnl0KV7.js +++ /dev/null @@ -1,34 +0,0 @@ -const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/StatsWindow-CEonyugb.js","assets/react-yfL0ty4i.js","assets/CharacterWindow-Crv2ChMj.js","assets/InventoryWindow-Dry2xriW.js","assets/RadarWindow-iFWXCOTG.js","assets/CombatStatsWindow-CZ93hq_w.js","assets/CombatPickerWindow-BwEKuuEk.js","assets/IssuesWindow-DhxMoU6U.js","assets/VitalSharingWindow-DNhSox3R.js","assets/QuestStatusWindow-34SI56Mw.js","assets/AgentWindow-DWbV6rD2.js","assets/AdminUsersWindow-Dw8sqA9n.js"])))=>i.map(i=>d[i]); -import{r as Xd,g as A0,a as T0}from"./react-yfL0ty4i.js";(function(){const r=document.createElement("link").relList;if(r&&r.supports&&r.supports("modulepreload"))return;for(const x of document.querySelectorAll('link[rel="modulepreload"]'))o(x);new MutationObserver(x=>{for(const _ of x)if(_.type==="childList")for(const M of _.addedNodes)M.tagName==="LINK"&&M.rel==="modulepreload"&&o(M)}).observe(document,{childList:!0,subtree:!0});function m(x){const _={};return x.integrity&&(_.integrity=x.integrity),x.referrerPolicy&&(_.referrerPolicy=x.referrerPolicy),x.crossOrigin==="use-credentials"?_.credentials="include":x.crossOrigin==="anonymous"?_.credentials="omit":_.credentials="same-origin",_}function o(x){if(x.ep)return;x.ep=!0;const _=m(x);fetch(x.href,_)}})();var ms={exports:{}},_n={};/** - * @license React - * react-jsx-runtime.production.js - * - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var Td;function E0(){if(Td)return _n;Td=1;var c=Symbol.for("react.transitional.element"),r=Symbol.for("react.fragment");function m(o,x,_){var M=null;if(_!==void 0&&(M=""+_),x.key!==void 0&&(M=""+x.key),"key"in x){_={};for(var E in x)E!=="key"&&(_[E]=x[E])}else _=x;return x=_.ref,{$$typeof:c,type:o,key:M,ref:x!==void 0?x:null,props:_}}return _n.Fragment=r,_n.jsx=m,_n.jsxs=m,_n}var Ed;function N0(){return Ed||(Ed=1,ms.exports=E0()),ms.exports}var s=N0(),g=Xd();const jn=A0(g);var hs={exports:{}},zn={},ys={exports:{}},vs={};/** - * @license React - * scheduler.production.js - * - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var Nd;function M0(){return Nd||(Nd=1,(function(c){function r(z,q){var Q=z.length;z.push(q);t:for(;0>>1,w=z[H];if(0>>1;Hx(et,Q))Btx(El,et)?(z[H]=El,z[Bt]=Q,H=Bt):(z[H]=et,z[dt]=Q,H=dt);else if(Btx(El,Q))z[H]=El,z[Bt]=Q,H=Bt;else break t}}return q}function x(z,q){var Q=z.sortIndex-q.sortIndex;return Q!==0?Q:z.id-q.id}if(c.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var _=performance;c.unstable_now=function(){return _.now()}}else{var M=Date,E=M.now();c.unstable_now=function(){return M.now()-E}}var y=[],T=[],B=1,p=null,A=3,R=!1,Y=!1,$=!1,V=!1,C=typeof setTimeout=="function"?setTimeout:null,L=typeof clearTimeout=="function"?clearTimeout:null,F=typeof setImmediate<"u"?setImmediate:null;function zt(z){for(var q=m(T);q!==null;){if(q.callback===null)o(T);else if(q.startTime<=z)o(T),q.sortIndex=q.expirationTime,r(y,q);else break;q=m(T)}}function Ut(z){if($=!1,zt(z),!Y)if(m(y)!==null)Y=!0,lt||(lt=!0,jt());else{var q=m(T);q!==null&&xl(Ut,q.startTime-z)}}var lt=!1,at=-1,Z=5,J=-1;function P(){return V?!0:!(c.unstable_now()-Jz&&P());){var H=p.callback;if(typeof H=="function"){p.callback=null,A=p.priorityLevel;var w=H(p.expirationTime<=z);if(z=c.unstable_now(),typeof w=="function"){p.callback=w,zt(z),q=!0;break l}p===m(y)&&o(y),zt(z)}else o(y);p=m(y)}if(p!==null)q=!0;else{var ot=m(T);ot!==null&&xl(Ut,ot.startTime-z),q=!1}}break t}finally{p=null,A=Q,R=!1}q=void 0}}finally{q?jt():lt=!1}}}var jt;if(typeof F=="function")jt=function(){F(Rt)};else if(typeof MessageChannel<"u"){var Ol=new MessageChannel,Tl=Ol.port2;Ol.port1.onmessage=Rt,jt=function(){Tl.postMessage(null)}}else jt=function(){C(Rt,0)};function xl(z,q){at=C(function(){z(c.unstable_now())},q)}c.unstable_IdlePriority=5,c.unstable_ImmediatePriority=1,c.unstable_LowPriority=4,c.unstable_NormalPriority=3,c.unstable_Profiling=null,c.unstable_UserBlockingPriority=2,c.unstable_cancelCallback=function(z){z.callback=null},c.unstable_forceFrameRate=function(z){0>z||125H?(z.sortIndex=Q,r(T,z),m(y)===null&&z===m(T)&&($?(L(at),at=-1):$=!0,xl(Ut,Q-H))):(z.sortIndex=w,r(y,z),Y||R||(Y=!0,lt||(lt=!0,jt()))),z},c.unstable_shouldYield=P,c.unstable_wrapCallback=function(z){var q=A;return function(){var Q=A;A=q;try{return z.apply(this,arguments)}finally{A=Q}}}})(vs)),vs}var Md;function C0(){return Md||(Md=1,ys.exports=M0()),ys.exports}/** - * @license React - * react-dom-client.production.js - * - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var Cd;function D0(){if(Cd)return zn;Cd=1;var c=C0(),r=Xd(),m=T0();function o(t){var l="https://react.dev/errors/"+t;if(1w||(t.current=H[w],H[w]=null,w--)}function et(t,l){w++,H[w]=t.current,t.current=l}var Bt=ot(null),El=ot(null),Fl=ot(null),En=ot(null);function Nn(t,l){switch(et(Fl,l),et(El,t),et(Bt,null),l.nodeType){case 9:case 11:t=(t=l.documentElement)&&(t=t.namespaceURI)?Wo(t):0;break;default:if(t=l.tagName,l=l.namespaceURI)l=Wo(l),t=$o(l,t);else switch(t){case"svg":t=1;break;case"math":t=2;break;default:t=0}}dt(Bt),et(Bt,t)}function Qe(){dt(Bt),dt(El),dt(Fl)}function Ju(t){t.memoizedState!==null&&et(En,t);var l=Bt.current,e=$o(l,t.type);l!==e&&(et(El,t),et(Bt,e))}function Mn(t){El.current===t&&(dt(Bt),dt(El)),En.current===t&&(dt(En),pn._currentValue=Q)}var Wu,zs;function Ae(t){if(Wu===void 0)try{throw Error()}catch(e){var l=e.stack.trim().match(/\n( *(at )?)/);Wu=l&&l[1]||"",zs=-1)":-1n||d[a]!==S[n]){var D=` -`+d[a].replace(" at new "," at ");return t.displayName&&D.includes("")&&(D=D.replace("",t.displayName)),D}while(1<=a&&0<=n);break}}}finally{$u=!1,Error.prepareStackTrace=e}return(e=t?t.displayName||t.name:"")?Ae(e):""}function em(t,l){switch(t.tag){case 26:case 27:case 5:return Ae(t.type);case 16:return Ae("Lazy");case 13:return t.child!==l&&l!==null?Ae("Suspense Fallback"):Ae("Suspense");case 19:return Ae("SuspenseList");case 0:case 15:return Fu(t.type,!1);case 11:return Fu(t.type.render,!1);case 1:return Fu(t.type,!0);case 31:return Ae("Activity");default:return""}}function js(t){try{var l="",e=null;do l+=em(t,e),e=t,t=t.return;while(t);return l}catch(a){return` -Error generating stack: `+a.message+` -`+a.stack}}var Iu=Object.prototype.hasOwnProperty,Pu=c.unstable_scheduleCallback,ti=c.unstable_cancelCallback,am=c.unstable_shouldYield,nm=c.unstable_requestPaint,Pt=c.unstable_now,um=c.unstable_getCurrentPriorityLevel,As=c.unstable_ImmediatePriority,Ts=c.unstable_UserBlockingPriority,Cn=c.unstable_NormalPriority,im=c.unstable_LowPriority,Es=c.unstable_IdlePriority,cm=c.log,sm=c.unstable_setDisableYieldValue,Ma=null,tl=null;function Il(t){if(typeof cm=="function"&&sm(t),tl&&typeof tl.setStrictMode=="function")try{tl.setStrictMode(Ma,t)}catch{}}var ll=Math.clz32?Math.clz32:om,fm=Math.log,rm=Math.LN2;function om(t){return t>>>=0,t===0?32:31-(fm(t)/rm|0)|0}var Dn=256,On=262144,Un=4194304;function Te(t){var l=t&42;if(l!==0)return l;switch(t&-t){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return t&261888;case 262144:case 524288:case 1048576:case 2097152:return t&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return t&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return t}}function Rn(t,l,e){var a=t.pendingLanes;if(a===0)return 0;var n=0,u=t.suspendedLanes,i=t.pingedLanes;t=t.warmLanes;var f=a&134217727;return f!==0?(a=f&~u,a!==0?n=Te(a):(i&=f,i!==0?n=Te(i):e||(e=f&~t,e!==0&&(n=Te(e))))):(f=a&~u,f!==0?n=Te(f):i!==0?n=Te(i):e||(e=a&~t,e!==0&&(n=Te(e)))),n===0?0:l!==0&&l!==n&&(l&u)===0&&(u=n&-n,e=l&-l,u>=e||u===32&&(e&4194048)!==0)?l:n}function Ca(t,l){return(t.pendingLanes&~(t.suspendedLanes&~t.pingedLanes)&l)===0}function dm(t,l){switch(t){case 1:case 2:case 4:case 8:case 64:return l+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return l+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Ns(){var t=Un;return Un<<=1,(Un&62914560)===0&&(Un=4194304),t}function li(t){for(var l=[],e=0;31>e;e++)l.push(t);return l}function Da(t,l){t.pendingLanes|=l,l!==268435456&&(t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0)}function mm(t,l,e,a,n,u){var i=t.pendingLanes;t.pendingLanes=e,t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0,t.expiredLanes&=e,t.entangledLanes&=e,t.errorRecoveryDisabledLanes&=e,t.shellSuspendCounter=0;var f=t.entanglements,d=t.expirationTimes,S=t.hiddenUpdates;for(e=i&~e;0"u")return null;try{return t.activeElement||t.body}catch{return t.body}}var bm=/[\n"\\]/g;function rl(t){return t.replace(bm,function(l){return"\\"+l.charCodeAt(0).toString(16)+" "})}function ci(t,l,e,a,n,u,i,f){t.name="",i!=null&&typeof i!="function"&&typeof i!="symbol"&&typeof i!="boolean"?t.type=i:t.removeAttribute("type"),l!=null?i==="number"?(l===0&&t.value===""||t.value!=l)&&(t.value=""+fl(l)):t.value!==""+fl(l)&&(t.value=""+fl(l)):i!=="submit"&&i!=="reset"||t.removeAttribute("value"),l!=null?si(t,i,fl(l)):e!=null?si(t,i,fl(e)):a!=null&&t.removeAttribute("value"),n==null&&u!=null&&(t.defaultChecked=!!u),n!=null&&(t.checked=n&&typeof n!="function"&&typeof n!="symbol"),f!=null&&typeof f!="function"&&typeof f!="symbol"&&typeof f!="boolean"?t.name=""+fl(f):t.removeAttribute("name")}function Xs(t,l,e,a,n,u,i,f){if(u!=null&&typeof u!="function"&&typeof u!="symbol"&&typeof u!="boolean"&&(t.type=u),l!=null||e!=null){if(!(u!=="submit"&&u!=="reset"||l!=null)){ii(t);return}e=e!=null?""+fl(e):"",l=l!=null?""+fl(l):e,f||l===t.value||(t.value=l),t.defaultValue=l}a=a??n,a=typeof a!="function"&&typeof a!="symbol"&&!!a,t.checked=f?t.checked:!!a,t.defaultChecked=!!a,i!=null&&typeof i!="function"&&typeof i!="symbol"&&typeof i!="boolean"&&(t.name=i),ii(t)}function si(t,l,e){l==="number"&&Hn(t.ownerDocument)===t||t.defaultValue===""+e||(t.defaultValue=""+e)}function $e(t,l,e,a){if(t=t.options,l){l={};for(var n=0;n"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),mi=!1;if(ql)try{var qa={};Object.defineProperty(qa,"passive",{get:function(){mi=!0}}),window.addEventListener("test",qa,qa),window.removeEventListener("test",qa,qa)}catch{mi=!1}var te=null,hi=null,Yn=null;function Js(){if(Yn)return Yn;var t,l=hi,e=l.length,a,n="value"in te?te.value:te.textContent,u=n.length;for(t=0;t=La),tf=" ",lf=!1;function ef(t,l){switch(t){case"keyup":return km.indexOf(l.keyCode)!==-1;case"keydown":return l.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function af(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var ta=!1;function Wm(t,l){switch(t){case"compositionend":return af(l);case"keypress":return l.which!==32?null:(lf=!0,tf);case"textInput":return t=l.data,t===tf&&lf?null:t;default:return null}}function $m(t,l){if(ta)return t==="compositionend"||!bi&&ef(t,l)?(t=Js(),Yn=hi=te=null,ta=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(l.ctrlKey||l.altKey||l.metaKey)||l.ctrlKey&&l.altKey){if(l.char&&1=l)return{node:e,offset:l-t};t=a}t:{for(;e;){if(e.nextSibling){e=e.nextSibling;break t}e=e.parentNode}e=void 0}e=df(e)}}function hf(t,l){return t&&l?t===l?!0:t&&t.nodeType===3?!1:l&&l.nodeType===3?hf(t,l.parentNode):"contains"in t?t.contains(l):t.compareDocumentPosition?!!(t.compareDocumentPosition(l)&16):!1:!1}function yf(t){t=t!=null&&t.ownerDocument!=null&&t.ownerDocument.defaultView!=null?t.ownerDocument.defaultView:window;for(var l=Hn(t.document);l instanceof t.HTMLIFrameElement;){try{var e=typeof l.contentWindow.location.href=="string"}catch{e=!1}if(e)t=l.contentWindow;else break;l=Hn(t.document)}return l}function _i(t){var l=t&&t.nodeName&&t.nodeName.toLowerCase();return l&&(l==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||l==="textarea"||t.contentEditable==="true")}var nh=ql&&"documentMode"in document&&11>=document.documentMode,la=null,zi=null,wa=null,ji=!1;function vf(t,l,e){var a=e.window===e?e.document:e.nodeType===9?e:e.ownerDocument;ji||la==null||la!==Hn(a)||(a=la,"selectionStart"in a&&_i(a)?a={start:a.selectionStart,end:a.selectionEnd}:(a=(a.ownerDocument&&a.ownerDocument.defaultView||window).getSelection(),a={anchorNode:a.anchorNode,anchorOffset:a.anchorOffset,focusNode:a.focusNode,focusOffset:a.focusOffset}),wa&&Xa(wa,a)||(wa=a,a=Ou(zi,"onSelect"),0>=i,n-=i,Nl=1<<32-ll(l)+n|e<tt?(ct=G,G=null):ct=G.sibling;var rt=j(v,G,b[tt],O);if(rt===null){G===null&&(G=ct);break}t&&G&&rt.alternate===null&&l(v,G),h=u(rt,h,tt),ft===null?K=rt:ft.sibling=rt,ft=rt,G=ct}if(tt===b.length)return e(v,G),st&&Hl(v,tt),K;if(G===null){for(;tttt?(ct=G,G=null):ct=G.sibling;var _e=j(v,G,rt.value,O);if(_e===null){G===null&&(G=ct);break}t&&G&&_e.alternate===null&&l(v,G),h=u(_e,h,tt),ft===null?K=_e:ft.sibling=_e,ft=_e,G=ct}if(rt.done)return e(v,G),st&&Hl(v,tt),K;if(G===null){for(;!rt.done;tt++,rt=b.next())rt=U(v,rt.value,O),rt!==null&&(h=u(rt,h,tt),ft===null?K=rt:ft.sibling=rt,ft=rt);return st&&Hl(v,tt),K}for(G=a(G);!rt.done;tt++,rt=b.next())rt=N(G,v,tt,rt.value,O),rt!==null&&(t&&rt.alternate!==null&&G.delete(rt.key===null?tt:rt.key),h=u(rt,h,tt),ft===null?K=rt:ft.sibling=rt,ft=rt);return t&&G.forEach(function(j0){return l(v,j0)}),st&&Hl(v,tt),K}function pt(v,h,b,O){if(typeof b=="object"&&b!==null&&b.type===$&&b.key===null&&(b=b.props.children),typeof b=="object"&&b!==null){switch(b.$$typeof){case R:t:{for(var K=b.key;h!==null;){if(h.key===K){if(K=b.type,K===$){if(h.tag===7){e(v,h.sibling),O=n(h,b.props.children),O.return=v,v=O;break t}}else if(h.elementType===K||typeof K=="object"&&K!==null&&K.$$typeof===Z&&He(K)===h.type){e(v,h.sibling),O=n(h,b.props),Ja(O,b),O.return=v,v=O;break t}e(v,h);break}else l(v,h);h=h.sibling}b.type===$?(O=Oe(b.props.children,v.mode,O,b.key),O.return=v,v=O):(O=Wn(b.type,b.key,b.props,null,v.mode,O),Ja(O,b),O.return=v,v=O)}return i(v);case Y:t:{for(K=b.key;h!==null;){if(h.key===K)if(h.tag===4&&h.stateNode.containerInfo===b.containerInfo&&h.stateNode.implementation===b.implementation){e(v,h.sibling),O=n(h,b.children||[]),O.return=v,v=O;break t}else{e(v,h);break}else l(v,h);h=h.sibling}O=Di(b,v.mode,O),O.return=v,v=O}return i(v);case Z:return b=He(b),pt(v,h,b,O)}if(xl(b))return X(v,h,b,O);if(jt(b)){if(K=jt(b),typeof K!="function")throw Error(o(150));return b=K.call(b),k(v,h,b,O)}if(typeof b.then=="function")return pt(v,h,eu(b),O);if(b.$$typeof===F)return pt(v,h,In(v,b),O);au(v,b)}return typeof b=="string"&&b!==""||typeof b=="number"||typeof b=="bigint"?(b=""+b,h!==null&&h.tag===6?(e(v,h.sibling),O=n(h,b),O.return=v,v=O):(e(v,h),O=Ci(b,v.mode,O),O.return=v,v=O),i(v)):e(v,h)}return function(v,h,b,O){try{ka=0;var K=pt(v,h,b,O);return da=null,K}catch(G){if(G===oa||G===tu)throw G;var ft=al(29,G,null,v.mode);return ft.lanes=O,ft.return=v,ft}finally{}}}var Ye=Yf(!0),Vf=Yf(!1),ue=!1;function Gi(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Qi(t,l){t=t.updateQueue,l.updateQueue===t&&(l.updateQueue={baseState:t.baseState,firstBaseUpdate:t.firstBaseUpdate,lastBaseUpdate:t.lastBaseUpdate,shared:t.shared,callbacks:null})}function ie(t){return{lane:t,tag:0,payload:null,callback:null,next:null}}function ce(t,l,e){var a=t.updateQueue;if(a===null)return null;if(a=a.shared,(mt&2)!==0){var n=a.pending;return n===null?l.next=l:(l.next=n.next,n.next=l),a.pending=l,l=Jn(t),zf(t,null,e),l}return kn(t,a,l,e),Jn(t)}function Wa(t,l,e){if(l=l.updateQueue,l!==null&&(l=l.shared,(e&4194048)!==0)){var a=l.lanes;a&=t.pendingLanes,e|=a,l.lanes=e,Cs(t,e)}}function Zi(t,l){var e=t.updateQueue,a=t.alternate;if(a!==null&&(a=a.updateQueue,e===a)){var n=null,u=null;if(e=e.firstBaseUpdate,e!==null){do{var i={lane:e.lane,tag:e.tag,payload:e.payload,callback:null,next:null};u===null?n=u=i:u=u.next=i,e=e.next}while(e!==null);u===null?n=u=l:u=u.next=l}else n=u=l;e={baseState:a.baseState,firstBaseUpdate:n,lastBaseUpdate:u,shared:a.shared,callbacks:a.callbacks},t.updateQueue=e;return}t=e.lastBaseUpdate,t===null?e.firstBaseUpdate=l:t.next=l,e.lastBaseUpdate=l}var Ki=!1;function $a(){if(Ki){var t=ra;if(t!==null)throw t}}function Fa(t,l,e,a){Ki=!1;var n=t.updateQueue;ue=!1;var u=n.firstBaseUpdate,i=n.lastBaseUpdate,f=n.shared.pending;if(f!==null){n.shared.pending=null;var d=f,S=d.next;d.next=null,i===null?u=S:i.next=S,i=d;var D=t.alternate;D!==null&&(D=D.updateQueue,f=D.lastBaseUpdate,f!==i&&(f===null?D.firstBaseUpdate=S:f.next=S,D.lastBaseUpdate=d))}if(u!==null){var U=n.baseState;i=0,D=S=d=null,f=u;do{var j=f.lane&-536870913,N=j!==f.lane;if(N?(it&j)===j:(a&j)===j){j!==0&&j===fa&&(Ki=!0),D!==null&&(D=D.next={lane:0,tag:f.tag,payload:f.payload,callback:null,next:null});t:{var X=t,k=f;j=l;var pt=e;switch(k.tag){case 1:if(X=k.payload,typeof X=="function"){U=X.call(pt,U,j);break t}U=X;break t;case 3:X.flags=X.flags&-65537|128;case 0:if(X=k.payload,j=typeof X=="function"?X.call(pt,U,j):X,j==null)break t;U=p({},U,j);break t;case 2:ue=!0}}j=f.callback,j!==null&&(t.flags|=64,N&&(t.flags|=8192),N=n.callbacks,N===null?n.callbacks=[j]:N.push(j))}else N={lane:j,tag:f.tag,payload:f.payload,callback:f.callback,next:null},D===null?(S=D=N,d=U):D=D.next=N,i|=j;if(f=f.next,f===null){if(f=n.shared.pending,f===null)break;N=f,f=N.next,N.next=null,n.lastBaseUpdate=N,n.shared.pending=null}}while(!0);D===null&&(d=U),n.baseState=d,n.firstBaseUpdate=S,n.lastBaseUpdate=D,u===null&&(n.shared.lanes=0),de|=i,t.lanes=i,t.memoizedState=U}}function Xf(t,l){if(typeof t!="function")throw Error(o(191,t));t.call(l)}function wf(t,l){var e=t.callbacks;if(e!==null)for(t.callbacks=null,t=0;tu?u:8;var i=z.T,f={};z.T=f,oc(t,!1,l,e);try{var d=n(),S=z.S;if(S!==null&&S(f,d),d!==null&&typeof d=="object"&&typeof d.then=="function"){var D=mh(d,a);tn(t,l,D,sl(t))}else tn(t,l,a,sl(t))}catch(U){tn(t,l,{then:function(){},status:"rejected",reason:U},sl())}finally{q.p=u,i!==null&&f.types!==null&&(i.types=f.types),z.T=i}}function bh(){}function fc(t,l,e,a){if(t.tag!==5)throw Error(o(476));var n=Sr(t).queue;br(t,n,l,Q,e===null?bh:function(){return xr(t),e(a)})}function Sr(t){var l=t.memoizedState;if(l!==null)return l;l={memoizedState:Q,baseState:Q,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Xl,lastRenderedState:Q},next:null};var e={};return l.next={memoizedState:e,baseState:e,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Xl,lastRenderedState:e},next:null},t.memoizedState=l,t=t.alternate,t!==null&&(t.memoizedState=l),l}function xr(t){var l=Sr(t);l.next===null&&(l=t.alternate.memoizedState),tn(t,l.next.queue,{},sl())}function rc(){return Xt(pn)}function _r(){return Nt().memoizedState}function zr(){return Nt().memoizedState}function Sh(t){for(var l=t.return;l!==null;){switch(l.tag){case 24:case 3:var e=sl();t=ie(e);var a=ce(l,t,e);a!==null&&(Ft(a,l,e),Wa(a,l,e)),l={cache:Yi()},t.payload=l;return}l=l.return}}function xh(t,l,e){var a=sl();e={lane:a,revertLane:0,gesture:null,action:e,hasEagerState:!1,eagerState:null,next:null},mu(t)?Ar(l,e):(e=Ni(t,l,e,a),e!==null&&(Ft(e,t,a),Tr(e,l,a)))}function jr(t,l,e){var a=sl();tn(t,l,e,a)}function tn(t,l,e,a){var n={lane:a,revertLane:0,gesture:null,action:e,hasEagerState:!1,eagerState:null,next:null};if(mu(t))Ar(l,n);else{var u=t.alternate;if(t.lanes===0&&(u===null||u.lanes===0)&&(u=l.lastRenderedReducer,u!==null))try{var i=l.lastRenderedState,f=u(i,e);if(n.hasEagerState=!0,n.eagerState=f,el(f,i))return kn(t,l,n,0),bt===null&&Kn(),!1}catch{}finally{}if(e=Ni(t,l,n,a),e!==null)return Ft(e,t,a),Tr(e,l,a),!0}return!1}function oc(t,l,e,a){if(a={lane:2,revertLane:Gc(),gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},mu(t)){if(l)throw Error(o(479))}else l=Ni(t,e,a,2),l!==null&&Ft(l,t,2)}function mu(t){var l=t.alternate;return t===I||l!==null&&l===I}function Ar(t,l){ha=iu=!0;var e=t.pending;e===null?l.next=l:(l.next=e.next,e.next=l),t.pending=l}function Tr(t,l,e){if((e&4194048)!==0){var a=l.lanes;a&=t.pendingLanes,e|=a,l.lanes=e,Cs(t,e)}}var ln={readContext:Xt,use:fu,useCallback:At,useContext:At,useEffect:At,useImperativeHandle:At,useLayoutEffect:At,useInsertionEffect:At,useMemo:At,useReducer:At,useRef:At,useState:At,useDebugValue:At,useDeferredValue:At,useTransition:At,useSyncExternalStore:At,useId:At,useHostTransitionStatus:At,useFormState:At,useActionState:At,useOptimistic:At,useMemoCache:At,useCacheRefresh:At};ln.useEffectEvent=At;var Er={readContext:Xt,use:fu,useCallback:function(t,l){return Qt().memoizedState=[t,l===void 0?null:l],t},useContext:Xt,useEffect:rr,useImperativeHandle:function(t,l,e){e=e!=null?e.concat([t]):null,ou(4194308,4,hr.bind(null,l,t),e)},useLayoutEffect:function(t,l){return ou(4194308,4,t,l)},useInsertionEffect:function(t,l){ou(4,2,t,l)},useMemo:function(t,l){var e=Qt();l=l===void 0?null:l;var a=t();if(Ve){Il(!0);try{t()}finally{Il(!1)}}return e.memoizedState=[a,l],a},useReducer:function(t,l,e){var a=Qt();if(e!==void 0){var n=e(l);if(Ve){Il(!0);try{e(l)}finally{Il(!1)}}}else n=l;return a.memoizedState=a.baseState=n,t={pending:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:n},a.queue=t,t=t.dispatch=xh.bind(null,I,t),[a.memoizedState,t]},useRef:function(t){var l=Qt();return t={current:t},l.memoizedState=t},useState:function(t){t=nc(t);var l=t.queue,e=jr.bind(null,I,l);return l.dispatch=e,[t.memoizedState,e]},useDebugValue:cc,useDeferredValue:function(t,l){var e=Qt();return sc(e,t,l)},useTransition:function(){var t=nc(!1);return t=br.bind(null,I,t.queue,!0,!1),Qt().memoizedState=t,[!1,t]},useSyncExternalStore:function(t,l,e){var a=I,n=Qt();if(st){if(e===void 0)throw Error(o(407));e=e()}else{if(e=l(),bt===null)throw Error(o(349));(it&127)!==0||Jf(a,l,e)}n.memoizedState=e;var u={value:e,getSnapshot:l};return n.queue=u,rr($f.bind(null,a,u,t),[t]),a.flags|=2048,va(9,{destroy:void 0},Wf.bind(null,a,u,e,l),null),e},useId:function(){var t=Qt(),l=bt.identifierPrefix;if(st){var e=Ml,a=Nl;e=(a&~(1<<32-ll(a)-1)).toString(32)+e,l="_"+l+"R_"+e,e=cu++,0<\/script>",u=u.removeChild(u.firstChild);break;case"select":u=typeof a.is=="string"?i.createElement("select",{is:a.is}):i.createElement("select"),a.multiple?u.multiple=!0:a.size&&(u.size=a.size);break;default:u=typeof a.is=="string"?i.createElement(n,{is:a.is}):i.createElement(n)}}u[Yt]=l,u[Zt]=a;t:for(i=l.child;i!==null;){if(i.tag===5||i.tag===6)u.appendChild(i.stateNode);else if(i.tag!==4&&i.tag!==27&&i.child!==null){i.child.return=i,i=i.child;continue}if(i===l)break t;for(;i.sibling===null;){if(i.return===null||i.return===l)break t;i=i.return}i.sibling.return=i.return,i=i.sibling}l.stateNode=u;t:switch(Gt(u,n,a),n){case"button":case"input":case"select":case"textarea":a=!!a.autoFocus;break t;case"img":a=!0;break t;default:a=!1}a&&Gl(l)}}return xt(l),Ac(l,l.type,t===null?null:t.memoizedProps,l.pendingProps,e),null;case 6:if(t&&l.stateNode!=null)t.memoizedProps!==a&&Gl(l);else{if(typeof a!="string"&&l.stateNode===null)throw Error(o(166));if(t=Fl.current,ca(l)){if(t=l.stateNode,e=l.memoizedProps,a=null,n=Vt,n!==null)switch(n.tag){case 27:case 5:a=n.memoizedProps}t[Yt]=l,t=!!(t.nodeValue===e||a!==null&&a.suppressHydrationWarning===!0||ko(t.nodeValue,e)),t||ae(l,!0)}else t=Uu(t).createTextNode(a),t[Yt]=l,l.stateNode=t}return xt(l),null;case 31:if(e=l.memoizedState,t===null||t.memoizedState!==null){if(a=ca(l),e!==null){if(t===null){if(!a)throw Error(o(318));if(t=l.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(o(557));t[Yt]=l}else Ue(),(l.flags&128)===0&&(l.memoizedState=null),l.flags|=4;xt(l),t=!1}else e=qi(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=e),t=!0;if(!t)return l.flags&256?(ul(l),l):(ul(l),null);if((l.flags&128)!==0)throw Error(o(558))}return xt(l),null;case 13:if(a=l.memoizedState,t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){if(n=ca(l),a!==null&&a.dehydrated!==null){if(t===null){if(!n)throw Error(o(318));if(n=l.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(o(317));n[Yt]=l}else Ue(),(l.flags&128)===0&&(l.memoizedState=null),l.flags|=4;xt(l),n=!1}else n=qi(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=n),n=!0;if(!n)return l.flags&256?(ul(l),l):(ul(l),null)}return ul(l),(l.flags&128)!==0?(l.lanes=e,l):(e=a!==null,t=t!==null&&t.memoizedState!==null,e&&(a=l.child,n=null,a.alternate!==null&&a.alternate.memoizedState!==null&&a.alternate.memoizedState.cachePool!==null&&(n=a.alternate.memoizedState.cachePool.pool),u=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(u=a.memoizedState.cachePool.pool),u!==n&&(a.flags|=2048)),e!==t&&e&&(l.child.flags|=8192),pu(l,l.updateQueue),xt(l),null);case 4:return Qe(),t===null&&kc(l.stateNode.containerInfo),xt(l),null;case 10:return Yl(l.type),xt(l),null;case 19:if(dt(Et),a=l.memoizedState,a===null)return xt(l),null;if(n=(l.flags&128)!==0,u=a.rendering,u===null)if(n)an(a,!1);else{if(Tt!==0||t!==null&&(t.flags&128)!==0)for(t=l.child;t!==null;){if(u=uu(t),u!==null){for(l.flags|=128,an(a,!1),t=u.updateQueue,l.updateQueue=t,pu(l,t),l.subtreeFlags=0,t=e,e=l.child;e!==null;)jf(e,t),e=e.sibling;return et(Et,Et.current&1|2),st&&Hl(l,a.treeForkCount),l.child}t=t.sibling}a.tail!==null&&Pt()>zu&&(l.flags|=128,n=!0,an(a,!1),l.lanes=4194304)}else{if(!n)if(t=uu(u),t!==null){if(l.flags|=128,n=!0,t=t.updateQueue,l.updateQueue=t,pu(l,t),an(a,!0),a.tail===null&&a.tailMode==="hidden"&&!u.alternate&&!st)return xt(l),null}else 2*Pt()-a.renderingStartTime>zu&&e!==536870912&&(l.flags|=128,n=!0,an(a,!1),l.lanes=4194304);a.isBackwards?(u.sibling=l.child,l.child=u):(t=a.last,t!==null?t.sibling=u:l.child=u,a.last=u)}return a.tail!==null?(t=a.tail,a.rendering=t,a.tail=t.sibling,a.renderingStartTime=Pt(),t.sibling=null,e=Et.current,et(Et,n?e&1|2:e&1),st&&Hl(l,a.treeForkCount),t):(xt(l),null);case 22:case 23:return ul(l),Ji(),a=l.memoizedState!==null,t!==null?t.memoizedState!==null!==a&&(l.flags|=8192):a&&(l.flags|=8192),a?(e&536870912)!==0&&(l.flags&128)===0&&(xt(l),l.subtreeFlags&6&&(l.flags|=8192)):xt(l),e=l.updateQueue,e!==null&&pu(l,e.retryQueue),e=null,t!==null&&t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),a=null,l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(a=l.memoizedState.cachePool.pool),a!==e&&(l.flags|=2048),t!==null&&dt(Be),null;case 24:return e=null,t!==null&&(e=t.memoizedState.cache),l.memoizedState.cache!==e&&(l.flags|=2048),Yl(Mt),xt(l),null;case 25:return null;case 30:return null}throw Error(o(156,l.tag))}function Th(t,l){switch(Ui(l),l.tag){case 1:return t=l.flags,t&65536?(l.flags=t&-65537|128,l):null;case 3:return Yl(Mt),Qe(),t=l.flags,(t&65536)!==0&&(t&128)===0?(l.flags=t&-65537|128,l):null;case 26:case 27:case 5:return Mn(l),null;case 31:if(l.memoizedState!==null){if(ul(l),l.alternate===null)throw Error(o(340));Ue()}return t=l.flags,t&65536?(l.flags=t&-65537|128,l):null;case 13:if(ul(l),t=l.memoizedState,t!==null&&t.dehydrated!==null){if(l.alternate===null)throw Error(o(340));Ue()}return t=l.flags,t&65536?(l.flags=t&-65537|128,l):null;case 19:return dt(Et),null;case 4:return Qe(),null;case 10:return Yl(l.type),null;case 22:case 23:return ul(l),Ji(),t!==null&&dt(Be),t=l.flags,t&65536?(l.flags=t&-65537|128,l):null;case 24:return Yl(Mt),null;case 25:return null;default:return null}}function Fr(t,l){switch(Ui(l),l.tag){case 3:Yl(Mt),Qe();break;case 26:case 27:case 5:Mn(l);break;case 4:Qe();break;case 31:l.memoizedState!==null&&ul(l);break;case 13:ul(l);break;case 19:dt(Et);break;case 10:Yl(l.type);break;case 22:case 23:ul(l),Ji(),t!==null&&dt(Be);break;case 24:Yl(Mt)}}function nn(t,l){try{var e=l.updateQueue,a=e!==null?e.lastEffect:null;if(a!==null){var n=a.next;e=n;do{if((e.tag&t)===t){a=void 0;var u=e.create,i=e.inst;a=u(),i.destroy=a}e=e.next}while(e!==n)}}catch(f){yt(l,l.return,f)}}function re(t,l,e){try{var a=l.updateQueue,n=a!==null?a.lastEffect:null;if(n!==null){var u=n.next;a=u;do{if((a.tag&t)===t){var i=a.inst,f=i.destroy;if(f!==void 0){i.destroy=void 0,n=l;var d=e,S=f;try{S()}catch(D){yt(n,d,D)}}}a=a.next}while(a!==u)}}catch(D){yt(l,l.return,D)}}function Ir(t){var l=t.updateQueue;if(l!==null){var e=t.stateNode;try{wf(l,e)}catch(a){yt(t,t.return,a)}}}function Pr(t,l,e){e.props=Xe(t.type,t.memoizedProps),e.state=t.memoizedState;try{e.componentWillUnmount()}catch(a){yt(t,l,a)}}function un(t,l){try{var e=t.ref;if(e!==null){switch(t.tag){case 26:case 27:case 5:var a=t.stateNode;break;case 30:a=t.stateNode;break;default:a=t.stateNode}typeof e=="function"?t.refCleanup=e(a):e.current=a}}catch(n){yt(t,l,n)}}function Cl(t,l){var e=t.ref,a=t.refCleanup;if(e!==null)if(typeof a=="function")try{a()}catch(n){yt(t,l,n)}finally{t.refCleanup=null,t=t.alternate,t!=null&&(t.refCleanup=null)}else if(typeof e=="function")try{e(null)}catch(n){yt(t,l,n)}else e.current=null}function to(t){var l=t.type,e=t.memoizedProps,a=t.stateNode;try{t:switch(l){case"button":case"input":case"select":case"textarea":e.autoFocus&&a.focus();break t;case"img":e.src?a.src=e.src:e.srcSet&&(a.srcset=e.srcSet)}}catch(n){yt(t,t.return,n)}}function Tc(t,l,e){try{var a=t.stateNode;Jh(a,t.type,e,l),a[Zt]=l}catch(n){yt(t,t.return,n)}}function lo(t){return t.tag===5||t.tag===3||t.tag===26||t.tag===27&&ge(t.type)||t.tag===4}function Ec(t){t:for(;;){for(;t.sibling===null;){if(t.return===null||lo(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.tag===27&&ge(t.type)||t.flags&2||t.child===null||t.tag===4)continue t;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function Nc(t,l,e){var a=t.tag;if(a===5||a===6)t=t.stateNode,l?(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e).insertBefore(t,l):(l=e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,l.appendChild(t),e=e._reactRootContainer,e!=null||l.onclick!==null||(l.onclick=Rl));else if(a!==4&&(a===27&&ge(t.type)&&(e=t.stateNode,l=null),t=t.child,t!==null))for(Nc(t,l,e),t=t.sibling;t!==null;)Nc(t,l,e),t=t.sibling}function bu(t,l,e){var a=t.tag;if(a===5||a===6)t=t.stateNode,l?e.insertBefore(t,l):e.appendChild(t);else if(a!==4&&(a===27&&ge(t.type)&&(e=t.stateNode),t=t.child,t!==null))for(bu(t,l,e),t=t.sibling;t!==null;)bu(t,l,e),t=t.sibling}function eo(t){var l=t.stateNode,e=t.memoizedProps;try{for(var a=t.type,n=l.attributes;n.length;)l.removeAttributeNode(n[0]);Gt(l,a,e),l[Yt]=t,l[Zt]=e}catch(u){yt(t,t.return,u)}}var Ql=!1,Ot=!1,Mc=!1,ao=typeof WeakSet=="function"?WeakSet:Set,Lt=null;function Eh(t,l){if(t=t.containerInfo,$c=Vu,t=yf(t),_i(t)){if("selectionStart"in t)var e={start:t.selectionStart,end:t.selectionEnd};else t:{e=(e=t.ownerDocument)&&e.defaultView||window;var a=e.getSelection&&e.getSelection();if(a&&a.rangeCount!==0){e=a.anchorNode;var n=a.anchorOffset,u=a.focusNode;a=a.focusOffset;try{e.nodeType,u.nodeType}catch{e=null;break t}var i=0,f=-1,d=-1,S=0,D=0,U=t,j=null;l:for(;;){for(var N;U!==e||n!==0&&U.nodeType!==3||(f=i+n),U!==u||a!==0&&U.nodeType!==3||(d=i+a),U.nodeType===3&&(i+=U.nodeValue.length),(N=U.firstChild)!==null;)j=U,U=N;for(;;){if(U===t)break l;if(j===e&&++S===n&&(f=i),j===u&&++D===a&&(d=i),(N=U.nextSibling)!==null)break;U=j,j=U.parentNode}U=N}e=f===-1||d===-1?null:{start:f,end:d}}else e=null}e=e||{start:0,end:0}}else e=null;for(Fc={focusedElem:t,selectionRange:e},Vu=!1,Lt=l;Lt!==null;)if(l=Lt,t=l.child,(l.subtreeFlags&1028)!==0&&t!==null)t.return=l,Lt=t;else for(;Lt!==null;){switch(l=Lt,u=l.alternate,t=l.flags,l.tag){case 0:if((t&4)!==0&&(t=l.updateQueue,t=t!==null?t.events:null,t!==null))for(e=0;e title"))),Gt(u,a,e),u[Yt]=t,Ht(u),a=u;break t;case"link":var i=rd("link","href",n).get(a+(e.href||""));if(i){for(var f=0;fpt&&(i=pt,pt=k,k=i);var v=mf(f,k),h=mf(f,pt);if(v&&h&&(N.rangeCount!==1||N.anchorNode!==v.node||N.anchorOffset!==v.offset||N.focusNode!==h.node||N.focusOffset!==h.offset)){var b=U.createRange();b.setStart(v.node,v.offset),N.removeAllRanges(),k>pt?(N.addRange(b),N.extend(h.node,h.offset)):(b.setEnd(h.node,h.offset),N.addRange(b))}}}}for(U=[],N=f;N=N.parentNode;)N.nodeType===1&&U.push({element:N,left:N.scrollLeft,top:N.scrollTop});for(typeof f.focus=="function"&&f.focus(),f=0;fe?32:e,z.T=null,e=Bc,Bc=null;var u=he,i=Wl;if(qt=0,xa=he=null,Wl=0,(mt&6)!==0)throw Error(o(331));var f=mt;if(mt|=4,yo(u.current),oo(u,u.current,i,e),mt=f,dn(0,!1),tl&&typeof tl.onPostCommitFiberRoot=="function")try{tl.onPostCommitFiberRoot(Ma,u)}catch{}return!0}finally{q.p=n,z.T=a,Uo(t,l)}}function qo(t,l,e){l=dl(e,l),l=yc(t.stateNode,l,2),t=ce(t,l,2),t!==null&&(Da(t,2),Dl(t))}function yt(t,l,e){if(t.tag===3)qo(t,t,e);else for(;l!==null;){if(l.tag===3){qo(l,t,e);break}else if(l.tag===1){var a=l.stateNode;if(typeof l.type.getDerivedStateFromError=="function"||typeof a.componentDidCatch=="function"&&(me===null||!me.has(a))){t=dl(e,t),e=qr(2),a=ce(l,e,2),a!==null&&(Br(e,a,l,t),Da(a,2),Dl(a));break}}l=l.return}}function Vc(t,l,e){var a=t.pingCache;if(a===null){a=t.pingCache=new Ch;var n=new Set;a.set(l,n)}else n=a.get(l),n===void 0&&(n=new Set,a.set(l,n));n.has(e)||(Oc=!0,n.add(e),t=qh.bind(null,t,l,e),l.then(t,t))}function qh(t,l,e){var a=t.pingCache;a!==null&&a.delete(l),t.pingedLanes|=t.suspendedLanes&e,t.warmLanes&=~e,bt===t&&(it&e)===e&&(Tt===4||Tt===3&&(it&62914560)===it&&300>Pt()-_u?(mt&2)===0&&_a(t,0):Uc|=e,Sa===it&&(Sa=0)),Dl(t)}function Bo(t,l){l===0&&(l=Ns()),t=De(t,l),t!==null&&(Da(t,l),Dl(t))}function Bh(t){var l=t.memoizedState,e=0;l!==null&&(e=l.retryLane),Bo(t,e)}function Hh(t,l){var e=0;switch(t.tag){case 31:case 13:var a=t.stateNode,n=t.memoizedState;n!==null&&(e=n.retryLane);break;case 19:a=t.stateNode;break;case 22:a=t.stateNode._retryCache;break;default:throw Error(o(314))}a!==null&&a.delete(l),Bo(t,e)}function Lh(t,l){return Pu(t,l)}var Mu=null,ja=null,Xc=!1,Cu=!1,wc=!1,ve=0;function Dl(t){t!==ja&&t.next===null&&(ja===null?Mu=ja=t:ja=ja.next=t),Cu=!0,Xc||(Xc=!0,Vh())}function dn(t,l){if(!wc&&Cu){wc=!0;do for(var e=!1,a=Mu;a!==null;){if(t!==0){var n=a.pendingLanes;if(n===0)var u=0;else{var i=a.suspendedLanes,f=a.pingedLanes;u=(1<<31-ll(42|t)+1)-1,u&=n&~(i&~f),u=u&201326741?u&201326741|1:u?u|2:0}u!==0&&(e=!0,Vo(a,u))}else u=it,u=Rn(a,a===bt?u:0,a.cancelPendingCommit!==null||a.timeoutHandle!==-1),(u&3)===0||Ca(a,u)||(e=!0,Vo(a,u));a=a.next}while(e);wc=!1}}function Yh(){Ho()}function Ho(){Cu=Xc=!1;var t=0;ve!==0&&$h()&&(t=ve);for(var l=Pt(),e=null,a=Mu;a!==null;){var n=a.next,u=Lo(a,l);u===0?(a.next=null,e===null?Mu=n:e.next=n,n===null&&(ja=e)):(e=a,(t!==0||(u&3)!==0)&&(Cu=!0)),a=n}qt!==0&&qt!==5||dn(t),ve!==0&&(ve=0)}function Lo(t,l){for(var e=t.suspendedLanes,a=t.pingedLanes,n=t.expirationTimes,u=t.pendingLanes&-62914561;0f)break;var D=d.transferSize,U=d.initiatorType;D&&Jo(U)&&(d=d.responseEnd,i+=D*(d"u"?null:document;function id(t,l,e){var a=Aa;if(a&&typeof l=="string"&&l){var n=rl(l);n='link[rel="'+t+'"][href="'+n+'"]',typeof e=="string"&&(n+='[crossorigin="'+e+'"]'),ud.has(n)||(ud.add(n),t={rel:t,crossOrigin:e,href:l},a.querySelector(n)===null&&(l=a.createElement("link"),Gt(l,"link",t),Ht(l),a.head.appendChild(l)))}}function u0(t){$l.D(t),id("dns-prefetch",t,null)}function i0(t,l){$l.C(t,l),id("preconnect",t,l)}function c0(t,l,e){$l.L(t,l,e);var a=Aa;if(a&&t&&l){var n='link[rel="preload"][as="'+rl(l)+'"]';l==="image"&&e&&e.imageSrcSet?(n+='[imagesrcset="'+rl(e.imageSrcSet)+'"]',typeof e.imageSizes=="string"&&(n+='[imagesizes="'+rl(e.imageSizes)+'"]')):n+='[href="'+rl(t)+'"]';var u=n;switch(l){case"style":u=Ta(t);break;case"script":u=Ea(t)}pl.has(u)||(t=p({rel:"preload",href:l==="image"&&e&&e.imageSrcSet?void 0:t,as:l},e),pl.set(u,t),a.querySelector(n)!==null||l==="style"&&a.querySelector(vn(u))||l==="script"&&a.querySelector(gn(u))||(l=a.createElement("link"),Gt(l,"link",t),Ht(l),a.head.appendChild(l)))}}function s0(t,l){$l.m(t,l);var e=Aa;if(e&&t){var a=l&&typeof l.as=="string"?l.as:"script",n='link[rel="modulepreload"][as="'+rl(a)+'"][href="'+rl(t)+'"]',u=n;switch(a){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":u=Ea(t)}if(!pl.has(u)&&(t=p({rel:"modulepreload",href:t},l),pl.set(u,t),e.querySelector(n)===null)){switch(a){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(e.querySelector(gn(u)))return}a=e.createElement("link"),Gt(a,"link",t),Ht(a),e.head.appendChild(a)}}}function f0(t,l,e){$l.S(t,l,e);var a=Aa;if(a&&t){var n=Je(a).hoistableStyles,u=Ta(t);l=l||"default";var i=n.get(u);if(!i){var f={loading:0,preload:null};if(i=a.querySelector(vn(u)))f.loading=5;else{t=p({rel:"stylesheet",href:t,"data-precedence":l},e),(e=pl.get(u))&&ns(t,e);var d=i=a.createElement("link");Ht(d),Gt(d,"link",t),d._p=new Promise(function(S,D){d.onload=S,d.onerror=D}),d.addEventListener("load",function(){f.loading|=1}),d.addEventListener("error",function(){f.loading|=2}),f.loading|=4,qu(i,l,a)}i={type:"stylesheet",instance:i,count:1,state:f},n.set(u,i)}}}function r0(t,l){$l.X(t,l);var e=Aa;if(e&&t){var a=Je(e).hoistableScripts,n=Ea(t),u=a.get(n);u||(u=e.querySelector(gn(n)),u||(t=p({src:t,async:!0},l),(l=pl.get(n))&&us(t,l),u=e.createElement("script"),Ht(u),Gt(u,"link",t),e.head.appendChild(u)),u={type:"script",instance:u,count:1,state:null},a.set(n,u))}}function o0(t,l){$l.M(t,l);var e=Aa;if(e&&t){var a=Je(e).hoistableScripts,n=Ea(t),u=a.get(n);u||(u=e.querySelector(gn(n)),u||(t=p({src:t,async:!0,type:"module"},l),(l=pl.get(n))&&us(t,l),u=e.createElement("script"),Ht(u),Gt(u,"link",t),e.head.appendChild(u)),u={type:"script",instance:u,count:1,state:null},a.set(n,u))}}function cd(t,l,e,a){var n=(n=Fl.current)?Ru(n):null;if(!n)throw Error(o(446));switch(t){case"meta":case"title":return null;case"style":return typeof e.precedence=="string"&&typeof e.href=="string"?(l=Ta(e.href),e=Je(n).hoistableStyles,a=e.get(l),a||(a={type:"style",instance:null,count:0,state:null},e.set(l,a)),a):{type:"void",instance:null,count:0,state:null};case"link":if(e.rel==="stylesheet"&&typeof e.href=="string"&&typeof e.precedence=="string"){t=Ta(e.href);var u=Je(n).hoistableStyles,i=u.get(t);if(i||(n=n.ownerDocument||n,i={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},u.set(t,i),(u=n.querySelector(vn(t)))&&!u._p&&(i.instance=u,i.state.loading=5),pl.has(t)||(e={rel:"preload",as:"style",href:e.href,crossOrigin:e.crossOrigin,integrity:e.integrity,media:e.media,hrefLang:e.hrefLang,referrerPolicy:e.referrerPolicy},pl.set(t,e),u||d0(n,t,e,i.state))),l&&a===null)throw Error(o(528,""));return i}if(l&&a!==null)throw Error(o(529,""));return null;case"script":return l=e.async,e=e.src,typeof e=="string"&&l&&typeof l!="function"&&typeof l!="symbol"?(l=Ea(e),e=Je(n).hoistableScripts,a=e.get(l),a||(a={type:"script",instance:null,count:0,state:null},e.set(l,a)),a):{type:"void",instance:null,count:0,state:null};default:throw Error(o(444,t))}}function Ta(t){return'href="'+rl(t)+'"'}function vn(t){return'link[rel="stylesheet"]['+t+"]"}function sd(t){return p({},t,{"data-precedence":t.precedence,precedence:null})}function d0(t,l,e,a){t.querySelector('link[rel="preload"][as="style"]['+l+"]")?a.loading=1:(l=t.createElement("link"),a.preload=l,l.addEventListener("load",function(){return a.loading|=1}),l.addEventListener("error",function(){return a.loading|=2}),Gt(l,"link",e),Ht(l),t.head.appendChild(l))}function Ea(t){return'[src="'+rl(t)+'"]'}function gn(t){return"script[async]"+t}function fd(t,l,e){if(l.count++,l.instance===null)switch(l.type){case"style":var a=t.querySelector('style[data-href~="'+rl(e.href)+'"]');if(a)return l.instance=a,Ht(a),a;var n=p({},e,{"data-href":e.href,"data-precedence":e.precedence,href:null,precedence:null});return a=(t.ownerDocument||t).createElement("style"),Ht(a),Gt(a,"style",n),qu(a,e.precedence,t),l.instance=a;case"stylesheet":n=Ta(e.href);var u=t.querySelector(vn(n));if(u)return l.state.loading|=4,l.instance=u,Ht(u),u;a=sd(e),(n=pl.get(n))&&ns(a,n),u=(t.ownerDocument||t).createElement("link"),Ht(u);var i=u;return i._p=new Promise(function(f,d){i.onload=f,i.onerror=d}),Gt(u,"link",a),l.state.loading|=4,qu(u,e.precedence,t),l.instance=u;case"script":return u=Ea(e.src),(n=t.querySelector(gn(u)))?(l.instance=n,Ht(n),n):(a=e,(n=pl.get(u))&&(a=p({},e),us(a,n)),t=t.ownerDocument||t,n=t.createElement("script"),Ht(n),Gt(n,"link",a),t.head.appendChild(n),l.instance=n);case"void":return null;default:throw Error(o(443,l.type))}else l.type==="stylesheet"&&(l.state.loading&4)===0&&(a=l.instance,l.state.loading|=4,qu(a,e.precedence,t));return l.instance}function qu(t,l,e){for(var a=e.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),n=a.length?a[a.length-1]:null,u=n,i=0;i title"):null)}function m0(t,l,e){if(e===1||l.itemProp!=null)return!1;switch(t){case"meta":case"title":return!0;case"style":if(typeof l.precedence!="string"||typeof l.href!="string"||l.href==="")break;return!0;case"link":if(typeof l.rel!="string"||typeof l.href!="string"||l.href===""||l.onLoad||l.onError)break;switch(l.rel){case"stylesheet":return t=l.disabled,typeof l.precedence=="string"&&t==null;default:return!0}case"script":if(l.async&&typeof l.async!="function"&&typeof l.async!="symbol"&&!l.onLoad&&!l.onError&&l.src&&typeof l.src=="string")return!0}return!1}function dd(t){return!(t.type==="stylesheet"&&(t.state.loading&3)===0)}function h0(t,l,e,a){if(e.type==="stylesheet"&&(typeof a.media!="string"||matchMedia(a.media).matches!==!1)&&(e.state.loading&4)===0){if(e.instance===null){var n=Ta(a.href),u=l.querySelector(vn(n));if(u){l=u._p,l!==null&&typeof l=="object"&&typeof l.then=="function"&&(t.count++,t=Hu.bind(t),l.then(t,t)),e.state.loading|=4,e.instance=u,Ht(u);return}u=l.ownerDocument||l,a=sd(a),(n=pl.get(n))&&ns(a,n),u=u.createElement("link"),Ht(u);var i=u;i._p=new Promise(function(f,d){i.onload=f,i.onerror=d}),Gt(u,"link",a),e.instance=u}t.stylesheets===null&&(t.stylesheets=new Map),t.stylesheets.set(e,l),(l=e.state.preload)&&(e.state.loading&3)===0&&(t.count++,e=Hu.bind(t),l.addEventListener("load",e),l.addEventListener("error",e))}}var is=0;function y0(t,l){return t.stylesheets&&t.count===0&&Yu(t,t.stylesheets),0is?50:800)+l);return t.unsuspend=e,function(){t.unsuspend=null,clearTimeout(a),clearTimeout(n)}}:null}function Hu(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Yu(this,this.stylesheets);else if(this.unsuspend){var t=this.unsuspend;this.unsuspend=null,t()}}}var Lu=null;function Yu(t,l){t.stylesheets=null,t.unsuspend!==null&&(t.count++,Lu=new Map,l.forEach(v0,t),Lu=null,Hu.call(t))}function v0(t,l){if(!(l.state.loading&4)){var e=Lu.get(t);if(e)var a=e.get(null);else{e=new Map,Lu.set(t,e);for(var n=t.querySelectorAll("link[data-precedence],style[data-precedence]"),u=0;u"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(c)}catch(r){console.error(r)}}return c(),hs.exports=D0(),hs.exports}var U0=O0();const wd=g.createContext({windows:[],openWindow:()=>{},closeWindow:()=>{},bringToFront:()=>{}}),R0=({children:c})=>{const[r,m]=g.useState([]),o=g.useRef(1e4),x=g.useCallback((E,y,T)=>{m(B=>B.find(A=>A.id===E)?B.map(A=>A.id===E?{...A,zIndex:++o.current}:A):[...B,{id:E,title:y,charName:T,zIndex:++o.current}])},[]),_=g.useCallback(E=>{m(y=>y.filter(T=>T.id!==E))},[]),M=g.useCallback(E=>{m(y=>y.map(T=>T.id===E?{...T,zIndex:++o.current}:T))},[]);return s.jsx(wd.Provider,{value:{windows:r,openWindow:x,closeWindow:_,bringToFront:M},children:c})},An=()=>g.useContext(wd),bl={west:-102.1,east:102.1,north:102.1,south:-102.1};function Tn(c,r,m,o){const x=(c-bl.west)/(bl.east-bl.west)*m,_=(bl.north-r)/(bl.north-bl.south)*o;return{x,y:_}}function q0(c,r,m,o,x,_,M){const E=(c-o)/m,y=(r-x)/m,T=bl.west+E/_*(bl.east-bl.west),B=bl.north-y/M*(bl.north-bl.south);return{ew:T,ns:B}}function gs(c,r){const m=c>=0?"N":"S",o=r>=0?"E":"W";return`${Math.abs(c).toFixed(1)}${m}, ${Math.abs(r).toFixed(1)}${o}`}const Gd=jn.memo(({players:c,imgW:r,imgH:m,getColor:o,onHover:x,onSelect:_,selectedPlayer:M})=>{const{openWindow:E}=An(),[y,T]=g.useState(null);g.useEffect(()=>{const p=()=>T(null);return y&&window.addEventListener("click",p),()=>window.removeEventListener("click",p)},[y]);const B=g.useMemo(()=>c.filter(p=>p.ew!==void 0&&p.ns!==void 0).map(p=>({...p,pos:Tn(p.ew,p.ns,r,m),color:o(p.character_name)})),[c,r,m,o]);return s.jsxs("div",{className:"ml-dots-layer",children:[B.map(p=>s.jsx("div",{className:`ml-dot ${M===p.character_name?"ml-dot-selected":""}`,style:{left:p.pos.x,top:p.pos.y,backgroundColor:p.color},onMouseEnter:A=>{var Y;const R=(Y=A.currentTarget.closest(".ml-map-container"))==null?void 0:Y.getBoundingClientRect();R&&x(p,A.clientX-R.left,A.clientY-R.top)},onMouseLeave:()=>x(null,0,0),onClick:()=>_(p.character_name),onDoubleClick:()=>E(`chat-${p.character_name}`,`Chat: ${p.character_name}`,p.character_name),onContextMenu:A=>{var C;A.preventDefault();const R=p.character_name,Y=(C=A.currentTarget.closest(".ml-map-container"))==null?void 0:C.getBoundingClientRect(),$=Y?A.clientX-Y.left:A.clientX,V=Y?A.clientY-Y.top:A.clientY;T({name:R,x:$,y:V})}},p.character_name)),y&&s.jsx("div",{style:{position:"fixed",left:y.x+410,top:y.y,background:"#1a1a1a",border:"1px solid #444",borderRadius:4,zIndex:9999,padding:"2px 0",fontSize:"0.75rem",boxShadow:"0 4px 12px rgba(0,0,0,0.5)",minWidth:120},children:[{label:"Chat",id:"chat"},{label:"Stats",id:"stats"},{label:"Inventory",id:"inv"},{label:"Character",id:"char"},{label:"Combat",id:"combat"},{label:"Radar",id:"radar"}].map(p=>s.jsx("div",{onClick:()=>{E(`${p.id}-${y.name}`,`${p.label}: ${y.name}`,y.name),T(null)},style:{padding:"4px 12px",cursor:"pointer",color:"#ccc"},onMouseEnter:A=>A.currentTarget.style.background="#333",onMouseLeave:A=>A.currentTarget.style.background="",children:p.label},p.id))})]})});Gd.displayName="PlayerDots";const ku="/api";async function It(c){const r=await fetch(`${ku}${c}`,{credentials:"include"});if(!r.ok)throw new Error(`API ${c}: ${r.status}`);return r.json()}async function Ss(c,r){var o;const m=await fetch(`${ku}${c}`,{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify(r??{})});if(!m.ok){let x="";try{x=((o=await m.json())==null?void 0:o.detail)??""}catch{}throw new Error(`API ${c}: ${m.status}${x?` (${x})`:""}`)}return m.json()}async function B0(c,r){var o;const m=await fetch(`${ku}${c}`,{method:"PATCH",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify(r??{})});if(!m.ok){let x="";try{x=((o=await m.json())==null?void 0:o.detail)??""}catch{}throw new Error(`API ${c}: ${m.status}${x?` (${x})`:""}`)}return m.json()}async function H0(c){var m;const r=await fetch(`${ku}${c}`,{method:"DELETE",credentials:"include"});if(!r.ok){let o="";try{o=((m=await r.json())==null?void 0:m.detail)??""}catch{}throw new Error(`API ${c}: ${r.status}${o?` (${o})`:""}`)}return r.json()}function L0(){return`${location.protocol==="https:"?"wss:":"ws:"}//${location.host}/api/ws/live`}const Qd=jn.memo(({imgW:c,imgH:r,getColor:m})=>{const[o,x]=g.useState([]);g.useEffect(()=>{const M=async()=>{try{const y=await It("/trails/?seconds=600");x(y.trails??[])}catch{}};M();const E=setInterval(M,2e3);return()=>clearInterval(E)},[]);const _=g.useMemo(()=>{const M={};for(const E of o){const{x:y,y:T}=Tn(E.ew,E.ns,c,r);M[E.character_name]||(M[E.character_name]=[]),M[E.character_name].push(`${y},${T}`)}return Object.entries(M).filter(([,E])=>E.length>=2).map(([E,y])=>({name:E,points:y.join(" ")}))},[o,c,r]);return s.jsx("svg",{className:"ml-trails-svg",viewBox:`0 0 ${c} ${r}`,preserveAspectRatio:"none",children:_.map(M=>s.jsx("polyline",{points:M.points,stroke:m(M.name),fill:"none",strokeWidth:2,strokeOpacity:.7,strokeLinecap:"round",strokeLinejoin:"round"},M.name))})});Qd.displayName="TrailsSVG";const Y0=({imgW:c,imgH:r,enabled:m})=>{const o=g.useRef(null),[x,_]=g.useState([]);return g.useEffect(()=>{if(!m)return;(async()=>{try{const E=await It("/spawns/heatmap?hours=24&limit=50000");_(E.spawn_points??[])}catch{}})()},[m]),g.useEffect(()=>{const M=o.current;if(!M||!m||x.length===0||c===0)return;M.width=c,M.height=r;const E=M.getContext("2d");if(E){E.clearRect(0,0,c,r);for(const y of x){const{x:T,y:B}=Tn(y.ew,y.ns,c,r),p=Math.max(5,Math.min(12,5+Math.sqrt(y.intensity*.5))),A=E.createRadialGradient(T,B,0,T,B,p);A.addColorStop(0,`rgba(255, 0, 0, ${Math.min(.9,y.intensity/40)})`),A.addColorStop(.6,`rgba(255, 100, 0, ${Math.min(.4,y.intensity/120)})`),A.addColorStop(1,"rgba(255, 150, 0, 0)"),E.fillStyle=A,E.fillRect(T-p,B-p,p*2,p*2)}}},[x,c,r,m]),m?s.jsx("canvas",{ref:o,className:"ml-heatmap-canvas"}):null},V0=({imgW:c,imgH:r,enabled:m})=>{const[o,x]=g.useState([]);g.useEffect(()=>{if(!m)return;const M=async()=>{try{const y=await It("/portals");x(y.portals??[])}catch{}};M();const E=setInterval(M,6e4);return()=>clearInterval(E)},[m]);const _=g.useMemo(()=>o.map(M=>({...M,pos:Tn(M.coordinates.ew,M.coordinates.ns,c,r)})),[o,c,r]);return!m||_.length===0?null:s.jsx("div",{className:"ml-portals-layer",children:_.map((M,E)=>s.jsx("div",{className:"ml-portal-icon",style:{left:M.pos.x,top:M.pos.y},title:`${M.portal_name} (by ${M.discovered_by})`},E))})},Od="mo-midsummer",X0=!1,Zd=g.createContext(null),w0=({children:c})=>{const[r,m]=g.useState(()=>localStorage.getItem(Od)!=="off"),o=X0;g.useEffect(()=>{document.documentElement.removeAttribute("data-midsummer")},[o]);const x=g.useCallback(()=>{m(_=>{const M=!_;return localStorage.setItem(Od,M?"on":"off"),M})},[]);return s.jsx(Zd.Provider,{value:{enabled:o,toggle:x},children:c})};function xs(){const c=g.useContext(Zd);if(!c)throw new Error("useMidsummer must be used within MidsummerProvider");return c}const Ud=6,G0=(c,r)=>({x:c/2,y:r/2}),Q0=({imgW:c,imgH:r})=>{const{enabled:m}=xs();if(!m||c===0)return null;const{x:o,y:x}=G0(c,r);return s.jsxs("div",{className:"ms-maypole",style:{left:o,top:x},"aria-hidden":"true",children:[s.jsx("div",{className:"ms-maypole-pole"}),s.jsx("div",{className:"ms-maypole-ring",children:Array.from({length:Ud}).map((_,M)=>s.jsx("span",{className:"ms-frog",style:{transform:`rotate(${360/Ud*M}deg) translateY(-40px)`},children:"🐸"},M))})]})},Rd=20,qd=.3,Z0=({players:c,getColor:r,onSelectPlayer:m,showHeatmap:o,showPortals:x,selectedPlayer:_})=>{var Ut;const M=g.useRef(null),E=g.useRef(null),[y,T]=g.useState({w:0,h:0}),[B,p]=g.useState(null),A=g.useRef(null),R=g.useRef({scale:1,offX:0,offY:0}),Y=g.useRef({dragging:!1,sx:0,sy:0,startOffX:0,startOffY:0}),$=g.useCallback(()=>{if(E.current){const{scale:lt,offX:at,offY:Z}=R.current;E.current.style.transform=`translate(${at}px, ${Z}px) scale(${lt})`}},[]),V=g.useCallback(lt=>{const at=lt.currentTarget;if(T({w:at.naturalWidth,h:at.naturalHeight}),M.current){const Z=M.current.clientWidth,J=M.current.clientHeight,P=Math.min(Z/at.naturalWidth,J/at.naturalHeight);R.current={scale:P,offX:(Z-at.naturalWidth*P)/2,offY:(J-at.naturalHeight*P)/2},$()}},[$]),C=g.useCallback(lt=>{var Tl;lt.preventDefault();const at=(Tl=M.current)==null?void 0:Tl.getBoundingClientRect();if(!at)return;const Z=R.current,J=lt.deltaY<0?1.1:.9,P=Math.min(Rd,Math.max(qd,Z.scale*J)),Rt=P/Z.scale,jt=lt.clientX-at.left,Ol=lt.clientY-at.top;R.current={scale:P,offX:jt-(jt-Z.offX)*Rt,offY:Ol-(Ol-Z.offY)*Rt},$()},[$]),L=g.useCallback(lt=>{if(lt.button!==0)return;const at=R.current;Y.current={dragging:!0,sx:lt.clientX,sy:lt.clientY,startOffX:at.offX,startOffY:at.offY}},[]);g.useEffect(()=>{const lt=Z=>{const J=Y.current;if(J.dragging&&(R.current.offX=J.startOffX+(Z.clientX-J.sx),R.current.offY=J.startOffY+(Z.clientY-J.sy),$()),M.current&&y.w>0&&A.current){const P=M.current.getBoundingClientRect(),Rt=R.current,jt=q0(Z.clientX-P.left,Z.clientY-P.top,Rt.scale,Rt.offX,Rt.offY,y.w,y.h);A.current.textContent=gs(jt.ns,jt.ew)}},at=()=>{Y.current.dragging=!1};return window.addEventListener("mousemove",lt),window.addEventListener("mouseup",at),()=>{window.removeEventListener("mousemove",lt),window.removeEventListener("mouseup",at)}},[$,y.w,y.h]);const F=g.useRef(null);g.useEffect(()=>{if(!_||y.w===0||!M.current||F.current===_)return;const lt=c.find(Rt=>Rt.character_name===_);if(!lt)return;F.current=_;const{x:at,y:Z}=Tn(lt.ew,lt.ns,y.w,y.h),J=M.current.getBoundingClientRect(),P=3;R.current={scale:Math.min(Rd,Math.max(qd,P)),offX:J.width/2-at*P,offY:J.height/2-Z*P},$()},[_,c,y.w,y.h,$]),g.useEffect(()=>{_||(F.current=null)},[_]);const zt=g.useCallback((lt,at,Z)=>{p(lt?{x:at,y:Z,player:lt}:null)},[]);return s.jsxs("div",{className:"ml-map-container",ref:M,onWheel:C,onMouseDown:L,children:[s.jsxs("div",{ref:E,className:"ml-map-group",children:[s.jsx("img",{src:"/dereth.png",alt:"Dereth",className:"ml-map-img",onLoad:V,draggable:!1}),y.w>0&&s.jsxs(s.Fragment,{children:[s.jsx(Y0,{imgW:y.w,imgH:y.h,enabled:o}),s.jsx(Qd,{imgW:y.w,imgH:y.h,getColor:r}),s.jsx(Gd,{players:c,imgW:y.w,imgH:y.h,getColor:r,onHover:zt,onSelect:m,selectedPlayer:_}),s.jsx(V0,{imgW:y.w,imgH:y.h,enabled:x}),s.jsx(Q0,{imgW:y.w,imgH:y.h})]})]}),B&&s.jsxs("div",{className:"ml-tooltip",style:{left:B.x+12,top:B.y-10},children:[s.jsx("strong",{children:B.player.character_name}),s.jsx("br",{}),gs(B.player.ns,B.player.ew),s.jsx("br",{}),B.player.kills_per_hour," kph · ",(Ut=B.player.kills)==null?void 0:Ut.toLocaleString()," kills"]}),s.jsx("div",{className:"ml-coords",ref:A})]})},Kd=jn.memo(({player:c,vitals:r,color:m,onSelect:o,isSelected:x})=>{var B,p;const{openWindow:_}=An(),M=(c.vt_state||"idle").toLowerCase(),E=M==="combat"||M==="hunt",y=(c.total_rares??0)>0?Math.round((c.total_kills??0)/(c.total_rares??1)).toLocaleString():null,T=c.character_name;return s.jsxs("li",{className:`ml-player-row ${x?"ml-player-selected":""}`,style:{borderLeftColor:m},children:[s.jsxs("div",{className:"ml-pr-header",onClick:o,children:[s.jsx("span",{className:"ml-pr-name",children:T}),s.jsx("span",{className:"ml-pr-coords",children:gs(c.ns,c.ew)})]}),s.jsxs("div",{className:"ml-pr-vitals",children:[s.jsx("div",{className:"ml-vital-bar hp",children:s.jsx("div",{className:"ml-vital-fill",style:{width:`${(r==null?void 0:r.health_percentage)??0}%`}})}),s.jsx("div",{className:"ml-vital-bar sta",children:s.jsx("div",{className:"ml-vital-fill",style:{width:`${(r==null?void 0:r.stamina_percentage)??0}%`}})}),s.jsx("div",{className:"ml-vital-bar mana",children:s.jsx("div",{className:"ml-vital-fill",style:{width:`${(r==null?void 0:r.mana_percentage)??0}%`}})})]}),s.jsxs("div",{className:"ml-pr-grid",children:[s.jsxs("span",{className:"ml-gs",title:"Session kills",children:["⚔️ ",((B=c.kills)==null?void 0:B.toLocaleString())??0]}),s.jsxs("span",{className:"ml-gs",title:"Total kills",children:["🏆 ",(c.total_kills??0).toLocaleString()]}),s.jsxs("span",{className:"ml-gs",title:"Kills per hour",children:[c.kills_per_hour??"0"," ",s.jsx("span",{className:"ml-suffix",children:"KPH"})]}),s.jsxs("span",{className:"ml-gs",title:"Rares (session / total)",children:["💎 ",c.session_rares??0," / ",c.total_rares??0]}),s.jsx("span",{className:"ml-gs",title:"Kills per rare",children:y?s.jsxs(s.Fragment,{children:["📊 ",y," ",s.jsx("span",{className:"ml-suffix",children:"KPR"})]}):""}),s.jsx("span",{className:`ml-meta-pill ${E?"active":M!=="idle"&&M!=="default"&&M!==""?"other":""}`,children:c.vt_state||"idle"}),s.jsxs("span",{className:"ml-gs",title:"Online time",children:["🕐 ",((p=c.onlinetime)==null?void 0:p.replace(/^00\./,""))??"--"]}),s.jsxs("span",{className:"ml-gs",title:"Deaths",children:["☠️ ",c.deaths??"0"]}),s.jsxs("span",{className:"ml-gs",title:"Prismatic tapers",children:[s.jsx("img",{src:"/prismatic-taper-icon.png",className:"ml-taper-icon",alt:""}),c.prismatic_taper_count??"0"]})]}),s.jsxs("div",{className:"ml-pr-buttons",children:[s.jsx("button",{className:"ml-btn accent",onClick:()=>_(`chat-${T}`,`Chat: ${T}`,T),children:"Chat"}),s.jsx("button",{className:"ml-btn accent",onClick:()=>_(`stats-${T}`,`Stats: ${T}`,T),children:"Stats"}),s.jsx("button",{className:"ml-btn accent",onClick:()=>_(`inv-${T}`,`Inventory: ${T}`,T),children:"Inv"}),s.jsx("button",{className:"ml-btn",onClick:()=>_(`char-${T}`,`Character: ${T}`,T),children:"Char"}),s.jsx("button",{className:"ml-btn",onClick:()=>_(`combat-${T}`,`Combat: ${T}`,T),children:"Combat"}),s.jsx("button",{className:"ml-btn",onClick:()=>_(`radar-${T}`,`Radar: ${T}`,T),children:"Radar"})]})]})});Kd.displayName="PlayerRow";const K0=({players:c,vitals:r,getColor:m,onSelect:o,selectedPlayer:x})=>{const _=g.useRef(null),[M,E]=g.useState(!1),y=g.useCallback(()=>{_.current&&E(_.current.scrollTop>200)},[]);return s.jsxs("div",{style:{position:"relative",flex:1,minHeight:0},children:[s.jsx("ul",{className:"ml-player-list",ref:_,onScroll:y,children:c.map(T=>s.jsx(Kd,{player:T,vitals:r.get(T.character_name)??null,color:m(T.character_name),onSelect:()=>o(T.character_name),isSelected:x===T.character_name},T.character_name))}),M&&s.jsx("button",{onClick:()=>{var T;(T=_.current)==null||T.scrollTo({top:0,behavior:"smooth"})},style:{position:"absolute",bottom:8,right:8,width:28,height:28,borderRadius:"50%",background:"rgba(68,136,255,0.2)",border:"1px solid rgba(68,136,255,0.4)",color:"#6af",cursor:"pointer",fontSize:"0.8rem",display:"flex",alignItems:"center",justifyContent:"center"},children:"▲"})]})},k0=[{key:"name",label:"Name"},{key:"kph",label:"KPH"},{key:"skills",label:"S.Kills"},{key:"srares",label:"S.Rares"},{key:"tkills",label:"T.Kills"},{key:"kpr",label:"KPR"}],J0=({value:c,onChange:r})=>s.jsx("div",{className:"ml-sort-buttons",children:k0.map(m=>s.jsx("button",{className:`ml-sort-btn ${c===m.key?"active":""}`,onClick:()=>r(m.key),children:m.label},m.key))}),W0=()=>It("/live"),$0=()=>It("/combat-stats"),F0=()=>It("/server-health"),I0=()=>It("/total-rares"),P0=()=>It("/total-kills"),uv=(c,r)=>Ss("/agent/ask",{message:c,session_id:r}),iv=()=>Ss("/agent/sessions/new",{}),cv=c=>It(`/agent/sessions/${encodeURIComponent(c)}/history`),ty=()=>It("/me");async function ly(){await fetch("/api/logout",{credentials:"include",redirect:"manual"}),window.location.href="/login"}const sv=()=>It("/api-admin/users"),fv=(c,r,m)=>Ss("/api-admin/users",{username:c,password:r,is_admin:m}),rv=(c,r)=>B0(`/api-admin/users/${c}`,r),ov=c=>H0(`/api-admin/users/${c}`);function ey(){const[c,r]=g.useState(null),[m,o]=g.useState(!0);return g.useEffect(()=>{let x=!1;return ty().then(_=>{x||r(_)}).catch(()=>{x||r(null)}).finally(()=>{x||o(!1)}),()=>{x=!0}},[]),{user:c,loading:m}}const ay=()=>{const{openWindow:c}=An(),{user:r}=ey(),m=!!(r!=null&&r.is_admin),o=g.useCallback(async()=>{if(confirm("Log out?"))try{await ly()}catch{window.location.href="/login"}},[]);return s.jsxs("div",{className:"ml-tool-links",children:[s.jsx("span",{className:"ml-tool-link",style:{cursor:"pointer"},onClick:()=>c("agent","Overlord Assistant"),children:"🤖 Assistant"}),s.jsx("span",{className:"ml-tool-link",style:{cursor:"pointer"},title:"Opens the player dashboard in a new tab",onClick:()=>window.open("/?view=dashboard","_blank","noopener"),children:"👥 Dashboard ↗"}),s.jsx("span",{className:"ml-tool-link",style:{cursor:"pointer"},onClick:()=>c("queststatus","Quest Status"),children:"📜 Quests"}),s.jsx("span",{className:"ml-tool-link",style:{cursor:"pointer"},onClick:()=>c("issues","Issues Board"),children:"📋 Issues"}),s.jsx("span",{className:"ml-tool-link",style:{cursor:"pointer"},onClick:()=>c("vitalsharing","Vital Sharing"),children:"🤝 Vitals"}),s.jsx("span",{className:"ml-tool-link",style:{cursor:"pointer"},onClick:()=>c("combatpicker","Combat Stats"),children:"⚔️ Combat"}),m&&s.jsx("span",{className:"ml-tool-link",style:{cursor:"pointer"},onClick:()=>c("adminusers","Admin · Users"),children:"🛡️ Admin"}),s.jsxs("span",{className:"ml-tool-link ml-tool-link-logout",style:{cursor:"pointer"},onClick:o,title:r?`Logged in as ${r.username}`:"Log out",children:["🚪 Log out",r?` (${r.username})`:""]})]})},ny=({players:c,vitals:r,serverHealth:m,totalRares:o,totalKills:x,getColor:_,onSelectPlayer:M,showHeatmap:E,showPortals:y,onToggleHeatmap:T,onTogglePortals:B,version:p,selectedPlayer:A})=>{var lt,at;const[R,Y]=g.useState("name"),[$,V]=g.useState(""),C=g.useMemo(()=>c.reduce((Z,J)=>Z+(parseInt(J.kills_per_hour)||0),0),[c]),L=((lt=m==null?void 0:m.status)==null?void 0:lt.toLowerCase())==="online"||((at=m==null?void 0:m.status)==null?void 0:at.toLowerCase())==="up",F=g.useDeferredValue(c),zt=g.useDeferredValue(r),Ut=g.useMemo(()=>{let Z=[...F];switch($&&(Z=Z.filter(J=>J.character_name.toLowerCase().startsWith($.toLowerCase()))),R){case"kph":Z.sort((J,P)=>(parseInt(P.kills_per_hour)||0)-(parseInt(J.kills_per_hour)||0));break;case"skills":Z.sort((J,P)=>(P.kills||0)-(J.kills||0));break;case"srares":Z.sort((J,P)=>(P.session_rares??0)-(J.session_rares??0));break;case"tkills":Z.sort((J,P)=>(P.total_kills??0)-(J.total_kills??0));break;case"kpr":Z.sort((J,P)=>{const Rt=(J.total_kills??0)/Math.max(1,J.total_rares??1),jt=(P.total_kills??0)/Math.max(1,P.total_rares??1);return Rt-jt});break;default:Z.sort((J,P)=>J.character_name.localeCompare(P.character_name))}return Z},[F,R,$]);return s.jsxs("div",{className:"ml-sidebar",children:[p&&s.jsxs("div",{className:"ml-version",children:["v",p]}),s.jsx("div",{className:"ml-sidebar-header",children:s.jsxs("span",{className:"ml-sidebar-title",style:{cursor:"pointer"},onClick:()=>{const Z=document.createElement("div");Z.style.cssText="position:fixed;top:0;left:0;width:100vw;height:100vh;background:#000;z-index:999999;display:flex;align-items:center;justify-content:center;";const J=document.createElement("video");J.src="/rick.mp4",J.autoplay=!0,J.loop=!0,J.style.cssText="width:100vw;height:100vh;object-fit:cover;",Z.appendChild(J),document.body.appendChild(Z),document.body.style.animation="ml-shake 0.05s 30";const P=document.createElement("style");P.textContent="@keyframes ml-shake{0%,100%{transform:translate(0) rotate(0)}25%{transform:translate(-15px,10px) rotate(-2deg)}50%{transform:translate(15px,-10px) rotate(2deg)}75%{transform:translate(-10px,-15px) rotate(-1deg)}} @keyframes ml-spin{from{transform:rotate(0)}to{transform:rotate(360deg)}}",document.head.appendChild(P),setTimeout(()=>{Z.style.animation="ml-spin 3s linear infinite"},1500),J.play().catch(()=>{})},children:["Active Mosswart Enjoyers (",c.length,")"]})}),s.jsxs("div",{className:"ml-server-status",children:[s.jsx("span",{className:`ml-status-dot ${L?"online":"offline"}`}),s.jsxs("span",{className:"ml-status-text",children:["Coldeve ",L?"Online":"Offline"]}),(m==null?void 0:m.player_count)!=null&&s.jsxs("span",{className:"ml-status-detail",children:["👥 ",m.player_count]}),(m==null?void 0:m.latency_ms)!=null&&s.jsxs("span",{className:"ml-status-detail",children:[Math.round(m.latency_ms),"ms"]}),(m==null?void 0:m.uptime_seconds)!=null&&s.jsxs("span",{className:"ml-status-detail",children:["Up: ",Math.floor(m.uptime_seconds/3600),"h"]})]}),s.jsxs("div",{className:"ml-counters",children:[s.jsxs("div",{className:"ml-counter rares",children:[s.jsx("span",{className:"ml-counter-val",children:o}),s.jsx("span",{className:"ml-counter-lbl",children:"Rares"})]}),s.jsxs("div",{className:`ml-counter kph ${C>5e3?"ultra":""}`,children:[s.jsx("span",{className:"ml-counter-val",children:C.toLocaleString()}),s.jsx("span",{className:"ml-counter-lbl",children:"Server KPH"})]}),s.jsxs("div",{className:"ml-counter kills",children:[s.jsx("span",{className:"ml-counter-val",children:x.toLocaleString()}),s.jsx("span",{className:"ml-counter-lbl",children:"Kills"})]})]}),s.jsxs("div",{className:"ml-tool-links",children:[s.jsx("a",{href:"/?view=inventory",target:"_blank",className:"ml-tool-link",children:"🔍 Inv Search"}),s.jsx("a",{href:"/suitbuilder.html",target:"_blank",className:"ml-tool-link",children:"🛡️ Suitbuilder"}),s.jsx("a",{href:"/debug.html",target:"_blank",className:"ml-tool-link",children:"🐛 Debug"})]}),s.jsx(ay,{}),s.jsxs("div",{className:"ml-toggles",children:[s.jsxs("label",{className:"ml-toggle-label",children:[s.jsx("input",{type:"checkbox",checked:E,onChange:Z=>T(Z.target.checked)}),s.jsx("span",{children:"Spawn Heatmap"})]}),s.jsxs("label",{className:"ml-toggle-label",children:[s.jsx("input",{type:"checkbox",checked:y,onChange:Z=>B(Z.target.checked)}),s.jsx("span",{children:"Portals"})]})]}),s.jsx("div",{style:{borderTop:"1px solid #333",marginTop:4,paddingTop:4}}),s.jsx(J0,{value:R,onChange:Y}),s.jsx("input",{className:"ml-filter",type:"text",placeholder:"Filter players...",value:$,onChange:Z=>V(Z.target.value)}),s.jsx(K0,{players:Ut,vitals:zt,getColor:_,onSelect:M,selectedPlayer:A})]})},uy="modulepreload",iy=function(c){return"/"+c},Bd={},Sl=function(r,m,o){let x=Promise.resolve();if(m&&m.length>0){let M=function(T){return Promise.all(T.map(B=>Promise.resolve(B).then(p=>({status:"fulfilled",value:p}),p=>({status:"rejected",reason:p}))))};document.getElementsByTagName("link");const E=document.querySelector("meta[property=csp-nonce]"),y=(E==null?void 0:E.nonce)||(E==null?void 0:E.getAttribute("nonce"));x=M(m.map(T=>{if(T=iy(T),T in Bd)return;Bd[T]=!0;const B=T.endsWith(".css"),p=B?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${T}"]${p}`))return;const A=document.createElement("link");if(A.rel=B?"stylesheet":uy,B||(A.as="script"),A.crossOrigin="",A.href=T,y&&A.setAttribute("nonce",y),document.head.appendChild(A),B)return new Promise((R,Y)=>{A.addEventListener("load",R),A.addEventListener("error",()=>Y(new Error(`Unable to preload CSS for ${T}`)))})}))}function _(M){const E=new Event("vite:preloadError",{cancelable:!0});if(E.payload=M,window.dispatchEvent(E),!E.defaultPrevented)throw M}return x.then(M=>{for(const E of M||[])E.status==="rejected"&&_(E.reason);return r().catch(_)})},kd=({id:c,title:r,zIndex:m,width:o=700,height:x=340,children:_})=>{const{closeWindow:M,bringToFront:E}=An(),y=g.useRef(null),T=g.useRef({dragging:!1,sx:0,sy:0,ox:0,oy:0}),B=g.useRef({resizing:!1,sx:0,sy:0,sw:0,sh:0}),p=g.useRef({x:420,y:10+Math.random()*40}),[A,R]=g.useState({w:o,h:x}),Y=g.useCallback(V=>{var L;V.preventDefault(),E(c);const C=(L=y.current)==null?void 0:L.getBoundingClientRect();C&&(T.current={dragging:!0,sx:V.clientX,sy:V.clientY,ox:C.left,oy:C.top})},[c,E]),$=g.useCallback(V=>{V.preventDefault(),V.stopPropagation(),B.current={resizing:!0,sx:V.clientX,sy:V.clientY,sw:A.w,sh:A.h}},[A.w,A.h]);return g.useEffect(()=>{const V=L=>{const F=T.current;F.dragging&&y.current&&(p.current.x=F.ox+(L.clientX-F.sx),p.current.y=F.oy+(L.clientY-F.sy),y.current.style.left=`${p.current.x}px`,y.current.style.top=`${p.current.y}px`);const zt=B.current;if(zt.resizing){const Ut=Math.max(300,zt.sw+(L.clientX-zt.sx)),lt=Math.max(200,zt.sh+(L.clientY-zt.sy));R({w:Ut,h:lt})}},C=()=>{T.current.dragging=!1,B.current.resizing=!1};return window.addEventListener("mousemove",V),window.addEventListener("mouseup",C),()=>{window.removeEventListener("mousemove",V),window.removeEventListener("mouseup",C)}},[]),s.jsxs("div",{ref:y,className:"ml-window",style:{zIndex:m,width:A.w,height:A.h,left:p.current.x,top:p.current.y},onMouseDown:()=>E(c),children:[s.jsxs("div",{className:"ml-window-header",onMouseDown:Y,children:[s.jsx("span",{className:"ml-window-title",children:r}),s.jsx("button",{className:"ml-window-close",onClick:()=>M(c),children:"×"})]}),s.jsx("div",{className:"ml-window-content",children:_}),s.jsx("div",{className:"ml-window-resize",onMouseDown:$})]})},cy={0:"#00FF00",2:"#FFFFFF",3:"#FF0000",4:"#FFFFFF",5:"#33CCFF",6:"#CCFF99",7:"#00FFFF",14:"#FFD700",15:"#FF69B4",17:"#AAAAFF",18:"#88FF88",21:"#FF8888",22:"#FFAA66"},Jd=50,Wd=c=>`mo-chat-history-${c}`;function sy(c){try{const r=localStorage.getItem(Wd(c));return r?JSON.parse(r):[]}catch{return[]}}function fy(c,r){try{localStorage.setItem(Wd(c),JSON.stringify(r.slice(-Jd)))}catch{}}const ry=({id:c,charName:r,zIndex:m,messages:o,socket:x})=>{const _=g.useRef(null),[M,E]=g.useState(""),[y,T]=g.useState(!1),B=g.useRef(sy(r)),p=g.useRef(-1),A=g.useRef(""),R=g.useRef(!1);g.useEffect(()=>{const L=_.current;L&&(R.current?T(!0):(L.scrollTop=L.scrollHeight,T(!1)))},[o.length]);const Y=g.useCallback(()=>{const L=_.current;if(!L)return;const F=L.scrollHeight-L.scrollTop-L.clientHeight<30;R.current=!F,F&&T(!1)},[]),$=g.useCallback(()=>{const L=_.current;L&&(L.scrollTop=L.scrollHeight,R.current=!1,T(!1))},[]),V=g.useCallback(L=>{L.preventDefault();const F=M.trim();!F||!x||x.readyState!==WebSocket.OPEN||(x.send(JSON.stringify({player_name:r,command:F})),B.current.push(F),B.current.length>Jd&&B.current.shift(),fy(r,B.current),p.current=-1,A.current="",E(""),R.current=!1)},[M,x,r]),C=g.useCallback(L=>{const F=B.current;if(F.length!==0){if(L.key==="ArrowUp")L.preventDefault(),p.current===-1?(A.current=M,p.current=F.length-1):p.current>0&&p.current--,E(F[p.current]);else if(L.key==="ArrowDown"){if(L.preventDefault(),p.current===-1)return;p.currents.jsx("div",{className:"ml-chat-line",style:{color:cy[L.color??2]??"#ddd"},children:L.text},F))}),y&&s.jsx("div",{onClick:$,style:{padding:"3px 0",textAlign:"center",fontSize:"0.65rem",color:"#6af",background:"#1a2a3a",cursor:"pointer",borderTop:"1px solid #334"},children:"▼ New messages below"}),s.jsx("form",{className:"ml-chat-form",onSubmit:V,children:s.jsx("input",{className:"ml-chat-input",value:M,onChange:L=>E(L.target.value),onKeyDown:C,placeholder:"Enter chat..."})})]})},oy=g.lazy(()=>Sl(()=>import("./StatsWindow-CEonyugb.js"),__vite__mapDeps([0,1])).then(c=>({default:c.StatsWindow}))),dy=g.lazy(()=>Sl(()=>import("./CharacterWindow-Crv2ChMj.js"),__vite__mapDeps([2,1])).then(c=>({default:c.CharacterWindow}))),my=g.lazy(()=>Sl(()=>import("./InventoryWindow-Dry2xriW.js"),__vite__mapDeps([3,1])).then(c=>({default:c.InventoryWindow}))),hy=g.lazy(()=>Sl(()=>import("./RadarWindow-iFWXCOTG.js"),__vite__mapDeps([4,1])).then(c=>({default:c.RadarWindow}))),yy=g.lazy(()=>Sl(()=>import("./CombatStatsWindow-CZ93hq_w.js"),__vite__mapDeps([5,1])).then(c=>({default:c.CombatStatsWindow}))),vy=g.lazy(()=>Sl(()=>import("./CombatPickerWindow-BwEKuuEk.js"),__vite__mapDeps([6,1])).then(c=>({default:c.CombatPickerWindow}))),gy=g.lazy(()=>Sl(()=>import("./IssuesWindow-DhxMoU6U.js"),__vite__mapDeps([7,1])).then(c=>({default:c.IssuesWindow}))),py=g.lazy(()=>Sl(()=>import("./VitalSharingWindow-DNhSox3R.js"),__vite__mapDeps([8,1])).then(c=>({default:c.VitalSharingWindow}))),by=g.lazy(()=>Sl(()=>import("./QuestStatusWindow-34SI56Mw.js"),__vite__mapDeps([9,1])).then(c=>({default:c.QuestStatusWindow}))),Sy=g.lazy(()=>Sl(()=>Promise.resolve().then(()=>Oy),void 0).then(c=>({default:c.PlayerDashboardWindow}))),xy=g.lazy(()=>Sl(()=>import("./AgentWindow-DWbV6rD2.js"),__vite__mapDeps([10,1])).then(c=>({default:c.AgentWindow}))),_y=g.lazy(()=>Sl(()=>import("./AdminUsersWindow-Dw8sqA9n.js"),__vite__mapDeps([11,1])).then(c=>({default:c.AdminUsersWindow}))),$d=jn.memo(({characters:c,chatMessages:r,nearbyObjects:m,inventoryVersions:o,equipmentCantrips:x,characterStats:_,socket:M})=>{const{windows:E}=An();return s.jsx(g.Suspense,{fallback:null,children:E.map(y=>{var p;const T=y.charName??"";switch(y.id.split("-")[0]){case"chat":return s.jsx(ry,{id:y.id,charName:T,zIndex:y.zIndex,messages:r.get(T)??[],socket:M},y.id);case"stats":return s.jsx(oy,{id:y.id,charName:T,zIndex:y.zIndex},y.id);case"char":return s.jsx(dy,{id:y.id,charName:T,zIndex:y.zIndex,vitals:((p=c.get(T))==null?void 0:p.vitals)??void 0,liveStats:_.get(T)},y.id);case"inv":return s.jsx(my,{id:y.id,charName:T,zIndex:y.zIndex,inventoryVersion:o.get(T)??0,equipmentCantrips:x.get(T)},y.id);case"radar":return s.jsx(hy,{id:y.id,charName:T,zIndex:y.zIndex,socket:M,radarData:m.get(T)??null},y.id);case"combat":return s.jsx(yy,{id:y.id,charName:T,zIndex:y.zIndex},y.id);case"combatpicker":return s.jsx(vy,{id:y.id,zIndex:y.zIndex,characters:c},y.id);case"issues":return s.jsx(gy,{id:y.id,zIndex:y.zIndex},y.id);case"vitalsharing":return s.jsx(py,{id:y.id,zIndex:y.zIndex},y.id);case"queststatus":return s.jsx(by,{id:y.id,zIndex:y.zIndex},y.id);case"playerdash":return s.jsx(Sy,{id:y.id,zIndex:y.zIndex,characters:c},y.id);case"agent":return s.jsx(xy,{id:y.id,zIndex:y.zIndex},y.id);case"adminusers":return s.jsx(_y,{id:y.id,zIndex:y.zIndex},y.id);default:return null}})})});$d.displayName="WindowRenderer";let zy=0;const jy=({recentRares:c})=>{const[r,m]=g.useState([]),[o,x]=g.useState(0),[_,M]=g.useState([]);g.useEffect(()=>{if(c.length>o&&o>0){const y=c.slice(0,c.length-o);for(const T of y){const B=++zy;m(p=>[...p,{key:B,charName:T.character_name,rareName:T.name,exiting:!1}]),E();try{const p=new AudioContext,A=p.createOscillator(),R=p.createGain();A.connect(R),R.connect(p.destination),A.frequency.value=880,A.type="sine",R.gain.value=.3,A.start(),R.gain.exponentialRampToValueAtTime(.001,p.currentTime+.5),A.stop(p.currentTime+.5)}catch{}setTimeout(()=>{m(p=>p.map(A=>A.key===B?{...A,exiting:!0}:A)),setTimeout(()=>{m(p=>p.filter(A=>A.key!==B))},500)},6e3)}}x(c.length)},[c.length]);const E=g.useCallback(()=>{const y=Date.now(),T=["#FFD700","#FF4444","#FF8800","#AA44FF","#4488FF"],B=Array.from({length:30},(p,A)=>{const R=Math.PI*2*A/30+(Math.random()-.5)*.5,Y=100+Math.random()*200;return{dx:Math.cos(R)*Y,dy:Math.sin(R)*Y-50,color:T[Math.floor(Math.random()*T.length)]}});M(p=>[...p,{id:y,particles:B}]),setTimeout(()=>M(p=>p.filter(A=>A.id!==y)),2200)},[]);return s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"ml-rare-notifications",children:r.map(y=>s.jsxs("div",{className:`ml-rare-notif ${y.exiting?"exiting":""}`,children:[s.jsx("div",{className:"ml-rare-notif-title",children:"🎆 LEGENDARY RARE! 🎆"}),s.jsx("div",{className:"ml-rare-notif-name",children:y.rareName}),s.jsx("div",{className:"ml-rare-notif-by",children:"found by"}),s.jsx("div",{className:"ml-rare-notif-char",children:y.charName})]},y.key))}),s.jsx("div",{className:"ml-fireworks",children:_.map(y=>s.jsx(jn.Fragment,{children:y.particles.map((T,B)=>s.jsx("div",{className:"ml-firework-particle",style:{left:"50%",top:"30%",backgroundColor:T.color,"--dx":`${T.dx}px`,"--dy":`${T.dy+200}px`}},B))},y.id))})]})};let Ay=0;const Ty=({deathAlerts:c})=>{const[r,m]=g.useState([]),o=g.useRef(0);return g.useEffect(()=>{if(c.length>o.current&&o.current>0){const x=c.slice(o.current);for(const _ of x){const M=++Ay;m(E=>[...E,{key:M,alert:_,exiting:!1}]);try{const E=new AudioContext,y=E.createOscillator(),T=E.createGain();y.connect(T),T.connect(E.destination),y.frequency.value=440,y.type="sawtooth",T.gain.value=.2,y.start(),T.gain.exponentialRampToValueAtTime(.001,E.currentTime+.8),y.stop(E.currentTime+.8)}catch{}setTimeout(()=>{m(E=>E.map(y=>y.key===M?{...y,exiting:!0}:y)),setTimeout(()=>m(E=>E.filter(y=>y.key!==M)),500)},8e3)}}o.current=c.length},[c.length]),r.length===0?null:s.jsx("div",{style:{position:"fixed",top:70,left:"50%",transform:"translateX(-50%)",zIndex:99999,display:"flex",flexDirection:"column",gap:6,pointerEvents:"none"},children:r.map(x=>s.jsxs("div",{style:{background:"linear-gradient(135deg, #2a0a0a, #1a0000)",border:"2px solid #cc4444",borderRadius:8,padding:"12px 24px",textAlign:"center",boxShadow:"0 0 30px rgba(204, 68, 68, 0.3)",animation:x.exiting?"ml-notif-out 0.5s ease-in forwards":"ml-notif-in 0.5s ease-out"},children:[s.jsx("div",{style:{fontSize:"1.2rem",fontWeight:800,color:"#ff4444"},children:"☠️ CHARACTER DIED ☠️"}),s.jsx("div",{style:{fontSize:"1rem",fontWeight:600,color:"#fff",marginTop:2},children:x.alert.character_name}),s.jsxs("div",{style:{fontSize:"0.8rem",color:"#c88",marginTop:2},children:["Vitae: ",x.alert.vitae,"%"]})]},x.key))})},Hd=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf","#ff4444","#44ff44","#4444ff","#ffff44","#ff44ff","#44ffff","#ff8844","#88ff44","#4488ff","#ff4488","#cc3333","#33cc33","#3333cc","#cccc33","#cc33cc","#33cccc","#cc6633","#66cc33","#3366cc","#cc3366","#ff6666","#66ff66","#6666ff","#ffff66","#ff66ff","#66ffff","#ffaa66","#aaff66","#66aaff","#ff66aa","#990099","#009900","#000099","#990000","#009999","#999900","#aa5500","#55aa00","#0055aa","#aa0055","#ffaaaa","#aaffaa","#aaaaff","#ffffaa","#ffaaff","#aaffff","#ffccaa","#ccffaa","#aaccff","#ffaacc"];function Ey(c){let r=0;for(let m=0;m{let x=c.current.get(o);return x||(x=r.current{const{enabled:c}=xs();return c?s.jsx("div",{className:"ms-banner",role:"status",children:"🐸 Glad midsommar! 🌼 Små grodorna, små grodorna… 🥂"}):null},Ld=["🐸","🌼","🌸","🇸🇪","🌿"],Id=()=>{const{enabled:c}=xs();return g.useEffect(()=>{if(!c||window.matchMedia("(prefers-reduced-motion: reduce)").matches)return;const r=document.createElement("div");r.className="ms-rain",document.body.appendChild(r);const m=()=>{const x=document.createElement("span");x.textContent=Ld[Math.floor(Math.random()*Ld.length)],x.style.left=Math.floor(Math.random()*100)+"vw";const _=6+Math.random()*5;x.style.animationDuration=_.toFixed(2)+"s",x.style.fontSize=14+Math.floor(Math.random()*16)+"px",r.appendChild(x),window.setTimeout(()=>x.remove(),_*1e3+250)},o=window.setInterval(m,450);return()=>{window.clearInterval(o),r.remove()}},[c]),null},My=({data:c})=>{const r=Ny(),[m,o]=g.useState(!1),[x,_]=g.useState(!1),[M,E]=g.useState(null),y=g.useMemo(()=>Array.from(c.characters.values()).filter(R=>R.telemetry).map(R=>R.telemetry),[c.characters]),T=g.useMemo(()=>new Map(Array.from(c.characters.values()).filter(R=>R.vitals).map(R=>[R.name,R.vitals])),[c.characters]),[B,p]=g.useState("");g.useEffect(()=>{fetch("/api/api-version",{credentials:"include"}).then(R=>R.json()).then(R=>p(R.version??"")).catch(()=>{})},[]);const A=g.useCallback(R=>{E(Y=>Y===R?null:R)},[]);return s.jsx(R0,{children:s.jsxs("div",{className:"ml-layout",children:[s.jsx(Fd,{}),s.jsx(Id,{}),s.jsx(ny,{players:y,vitals:T,serverHealth:c.serverHealth,totalRares:c.totalRares,totalKills:c.totalKills,getColor:r,onSelectPlayer:A,showHeatmap:m,showPortals:x,onToggleHeatmap:o,onTogglePortals:_,version:B,selectedPlayer:M}),s.jsx(Z0,{players:y,getColor:r,onSelectPlayer:A,showHeatmap:m,showPortals:x,selectedPlayer:M}),s.jsx($d,{characters:c.characters,chatMessages:c.chatMessages,nearbyObjects:c.nearbyObjects,inventoryVersions:c.inventoryVersions,equipmentCantrips:c.equipmentCantrips,characterStats:c.characterStats,socket:c.socketRef.current}),s.jsx(jy,{recentRares:c.recentRares}),s.jsx(Ty,{deathAlerts:c.deathAlerts})]})})};function Cy(c){const r=g.useRef(null),m=g.useRef(0),o=g.useRef(c);o.current=c;const x=g.useCallback(()=>{var M;if(((M=r.current)==null?void 0:M.readyState)===WebSocket.OPEN)return;const _=new WebSocket(L0());r.current=_,_.addEventListener("message",E=>{try{const y=JSON.parse(E.data);o.current(y)}catch{}}),_.addEventListener("close",()=>{r.current=null,m.current=window.setTimeout(x,2e3)}),_.addEventListener("error",()=>{_.close()})},[]);return g.useEffect(()=>(x(),()=>{var _;clearTimeout(m.current),(_=r.current)==null||_.close(),r.current=null}),[x]),r}function Pd(){const[c,r]=g.useState(new Map),[m,o]=g.useState(null),[x,_]=g.useState(0),[M,E]=g.useState(0),[y,T]=g.useState([]),B=g.useRef(new Map),[p,A]=g.useState(0),[R,Y]=g.useState(new Map),$=g.useRef(new Map),[V,C]=g.useState(0),L=g.useRef(new Map),[F,zt]=g.useState(0),[Ut,lt]=g.useState([]),[at,Z]=g.useState(new Map),J=g.useRef(c);J.current=c;const P=g.useCallback((z,q)=>{r(Q=>{const H=new Map(Q),w=H.get(z)??{name:z,telemetry:null,vitals:null,combat:null,lastUpdate:0};return H.set(z,q(w)),H})},[]),Rt=g.useCallback(z=>{var q,Q;if(z.type){if(z.type==="telemetry"){const H=z;P(H.character_name,w=>({...w,telemetry:H,lastUpdate:Date.now()}))}else if(z.type==="vitals"){const H=z,w=(q=J.current.get(H.character_name))==null?void 0:q.vitals;w&&(w.vitae??0)===0&&(H.vitae??0)>0&<(ot=>[...ot,{character_name:H.character_name,vitae:H.vitae,timestamp:new Date().toISOString()}].slice(-50)),P(H.character_name,ot=>({...ot,vitals:H,lastUpdate:Date.now()}))}else if(z.type==="combat_stats"){const H=z;P(H.character_name,w=>({...w,combat:H,lastUpdate:Date.now()}))}else if(z.type==="rare"){const H=z;T(w=>[H,...w].slice(0,50))}else if(z.type==="inventory_delta"){const H=z;H.character_name&&Y(w=>{const ot=new Map(w);return ot.set(H.character_name,(ot.get(H.character_name)??0)+1),ot})}else if(z.type==="character_stats"){const H=z;L.current.set(H.character_name,z),zt(w=>w+1)}else if(z.type==="equipment_cantrip_state"){const H=z;$.current.set(H.character_name,H),C(w=>w+1)}else if(z.type==="dungeon_map"){const H=z;H.landblock&&(window.__dungeonMapCache||(window.__dungeonMapCache={}),window.__dungeonMapCache[H.landblock]=H)}else if(z.type==="nearby_objects"){const H=z;if(Z(w=>{const ot=new Map(w);return ot.set(H.character_name,H),ot}),H.is_dungeon&&H.landblock&&!((Q=window.__dungeonMapCache)!=null&&Q[H.landblock])){const w=jt.current;(w==null?void 0:w.readyState)===WebSocket.OPEN&&w.send(JSON.stringify({type:"request_dungeon_map",landblock:H.landblock}))}}else if(z.type==="chat"){const H=z,w=B.current.get(H.character_name)??[];w.push({text:H.text,color:H.color,timestamp:H.timestamp}),w.length>1e3&&w.splice(0,w.length-1e3),B.current.set(H.character_name,w),A(ot=>ot+1)}}},[P]),jt=Cy(Rt);g.useEffect(()=>{const z=async()=>{try{const Q=await W0();r(H=>{var ot;const w=new Map(H);for(const dt of Q.players??[]){const et=w.get(dt.character_name);w.set(dt.character_name,{name:dt.character_name,telemetry:dt,vitals:(et==null?void 0:et.vitals)??null,combat:(et==null?void 0:et.combat)??null,lastUpdate:Date.now()})}for(const dt of w.keys())(ot=Q.players)!=null&&ot.some(et=>et.character_name===dt)||w.delete(dt);return w})}catch{}};z();const q=setInterval(z,5e3);return()=>clearInterval(q)},[]),g.useEffect(()=>{const z=async()=>{try{const Q=await $0();for(const H of Q.stats??[])P(H.character_name,w=>({...w,combat:{...H,type:"combat_stats"}}))}catch{}};z();const q=setInterval(z,3e4);return()=>clearInterval(q)},[P]),g.useEffect(()=>{const z=async()=>{try{o(await F0())}catch{}};z();const q=setInterval(z,3e4);return()=>clearInterval(q)},[]),g.useEffect(()=>{const z=async()=>{try{const[Q,H]=await Promise.all([I0(),P0()]);_(Q.all_time??0),E(H.total??0)}catch{}};z();const q=setInterval(z,3e5);return()=>clearInterval(q)},[]);const Ol=g.useMemo(()=>B.current,[p]),Tl=g.useMemo(()=>$.current,[V]),xl=g.useMemo(()=>L.current,[F]);return{characters:c,serverHealth:m,totalRares:x,totalKills:M,recentRares:y,chatMessages:Ol,nearbyObjects:at,inventoryVersions:R,equipmentCantrips:Tl,characterStats:xl,deathAlerts:Ut,socketRef:jt}}const _s=({characters:c})=>{const[r,m]=g.useState("kph"),[o,x]=g.useState(!1),[_,M]=g.useState(null),E=g.useMemo(()=>{const p=Array.from(c.values()).filter(A=>A.telemetry).map(A=>{var Y,$,V;const R=A.telemetry;return{name:A.name,kills:R.kills??0,kph:parseInt(R.kills_per_hour)||0,totalKills:R.total_kills??0,rares:R.total_rares??0,sessionRares:R.session_rares??0,deaths:parseInt(R.deaths)||0,totalDeaths:parseInt(R.total_deaths)||0,uptime:((Y=R.onlinetime)==null?void 0:Y.replace(/^00\./,""))??"",state:R.vt_state??"idle",tapers:parseInt(R.prismatic_taper_count)||0,hp:(($=A.vitals)==null?void 0:$.health_percentage)??0,vitae:((V=A.vitals)==null?void 0:V.vitae)??0}});return p.sort((A,R)=>{let Y=0;switch(r){case"name":Y=A.name.localeCompare(R.name);break;case"kills":Y=A.kills-R.kills;break;case"kph":Y=A.kph-R.kph;break;case"rares":Y=A.rares-R.rares;break;case"deaths":Y=A.totalDeaths-R.totalDeaths;break;case"uptime":Y=A.uptime.localeCompare(R.uptime);break;case"state":Y=A.state.localeCompare(R.state);break}return o?Y:-Y}),p},[c,r,o]),y=p=>{r===p?x(!o):(m(p),x(!1))},T=p=>({padding:"4px 6px",cursor:"pointer",userSelect:"none",color:r===p?"#6af":"#888",fontSize:"0.65rem",fontWeight:600,whiteSpace:"nowrap",borderBottom:"1px solid #444"}),B=p=>r===p?o?" ▲":" ▼":"";return s.jsxs("div",{style:{flex:1,overflow:"auto",fontSize:"0.73rem"},children:[s.jsxs("table",{style:{width:"auto",borderCollapse:"collapse"},children:[s.jsx("thead",{children:s.jsxs("tr",{style:{position:"sticky",top:0,background:"#1a1a1a",zIndex:1},children:[s.jsxs("th",{style:{...T("name"),textAlign:"left"},onClick:()=>y("name"),children:["Character",B("name")]}),s.jsxs("th",{style:{...T("state"),textAlign:"center"},onClick:()=>y("state"),children:["State",B("state")]}),s.jsxs("th",{style:{...T("kph"),textAlign:"right"},onClick:()=>y("kph"),children:["KPH",B("kph")]}),s.jsxs("th",{style:{...T("kills"),textAlign:"right"},onClick:()=>y("kills"),children:["Session",B("kills")]}),s.jsx("th",{style:{textAlign:"right",padding:"4px 6px",color:"#888",fontSize:"0.65rem",fontWeight:600,borderBottom:"1px solid #444"},children:"Total"}),s.jsxs("th",{style:{...T("rares"),textAlign:"right"},onClick:()=>y("rares"),children:["Rares",B("rares")]}),s.jsxs("th",{style:{...T("deaths"),textAlign:"right"},onClick:()=>y("deaths"),children:["Deaths",B("deaths")]}),s.jsxs("th",{style:{...T("uptime"),textAlign:"right"},onClick:()=>y("uptime"),children:["Uptime",B("uptime")]}),s.jsx("th",{style:{textAlign:"right",padding:"4px 6px",color:"#888",fontSize:"0.65rem",fontWeight:600,borderBottom:"1px solid #444"},children:"HP%"}),s.jsx("th",{style:{textAlign:"right",padding:"4px 6px",color:"#888",fontSize:"0.65rem",fontWeight:600,borderBottom:"1px solid #444"},children:"Vitae"}),s.jsx("th",{style:{textAlign:"right",padding:"4px 6px",color:"#888",fontSize:"0.65rem",fontWeight:600,borderBottom:"1px solid #444"},children:"Tapers"})]})}),s.jsx("tbody",{children:E.map(p=>{const A=p.state.toLowerCase(),R=A==="combat"||A==="hunt",Y=_===p.name;return s.jsxs("tr",{onClick:()=>M(Y?null:p.name),style:{borderBottom:"1px solid #1a1a1a",cursor:"pointer",background:Y?"rgba(102, 170, 255, 0.18)":void 0,outline:Y?"1px solid rgba(102, 170, 255, 0.55)":void 0,outlineOffset:"-1px"},children:[s.jsx("td",{style:{padding:"3px 10px 3px 6px",color:"#ccc",fontWeight:500,whiteSpace:"nowrap"},children:p.name}),s.jsx("td",{style:{textAlign:"center",padding:"3px 6px"},children:s.jsx("span",{style:{fontSize:"0.6rem",padding:"1px 6px",borderRadius:3,background:R?"rgba(68,204,68,0.15)":A==="idle"||A==="default"?"rgba(100,100,100,0.2)":"rgba(204,68,68,0.15)",color:R?"#4c4":A==="idle"||A==="default"?"#888":"#c44"},children:p.state})}),s.jsx("td",{style:{textAlign:"right",padding:"3px 6px",color:"#4c4",fontVariantNumeric:"tabular-nums"},children:p.kph.toLocaleString()}),s.jsx("td",{style:{textAlign:"right",padding:"3px 6px",color:"#ccc",fontVariantNumeric:"tabular-nums"},children:p.kills.toLocaleString()}),s.jsx("td",{style:{textAlign:"right",padding:"3px 6px",color:"#888",fontVariantNumeric:"tabular-nums"},children:p.totalKills.toLocaleString()}),s.jsxs("td",{style:{textAlign:"right",padding:"3px 6px",color:"#fc0",fontVariantNumeric:"tabular-nums"},children:[p.rares,p.sessionRares>0?` (${p.sessionRares})`:""]}),s.jsx("td",{style:{textAlign:"right",padding:"3px 6px",color:p.totalDeaths>0?"#c66":"#555",fontVariantNumeric:"tabular-nums"},children:p.totalDeaths}),s.jsx("td",{style:{textAlign:"right",padding:"3px 6px",color:"#888",fontVariantNumeric:"tabular-nums"},children:p.uptime}),s.jsxs("td",{style:{textAlign:"right",padding:"3px 6px",fontVariantNumeric:"tabular-nums",color:p.hp>80?"#4c4":p.hp>40?"#ca0":"#c44"},children:[p.hp.toFixed(0),"%"]}),s.jsx("td",{style:{textAlign:"right",padding:"3px 6px",fontVariantNumeric:"tabular-nums",color:p.vitae>0?"#f66":"#333"},children:p.vitae>0?`${p.vitae}%`:""}),s.jsx("td",{style:{textAlign:"right",padding:"3px 6px",color:"#888",fontVariantNumeric:"tabular-nums"},children:p.tapers.toLocaleString()})]},p.name)})})]}),E.length===0&&s.jsx("div",{style:{padding:20,color:"#666",textAlign:"center"},children:"No characters online"})]})},Dy=({id:c,zIndex:r,characters:m})=>s.jsx(kd,{id:c,title:"Player Dashboard",zIndex:r,width:850,height:500,children:s.jsx(_s,{characters:m})}),Oy=Object.freeze(Object.defineProperty({__proto__:null,PlayerDashboardContent:_s,PlayerDashboardWindow:Dy},Symbol.toStringTag,{value:"Module"})),Uy=()=>{const c=Pd(),[r,m]=g.useState("");g.useEffect(()=>{const x=document.title;return document.title="Overlord Dashboard",()=>{document.title=x}},[]),g.useEffect(()=>{fetch("/api/api-version",{credentials:"include"}).then(x=>x.json()).then(x=>m(x.version??"")).catch(()=>{})},[]);const o=Array.from(c.characters.values()).filter(x=>x.telemetry).length;return s.jsxs("div",{className:"ml-dashboard-page",children:[s.jsx(Fd,{}),s.jsx(Id,{}),s.jsxs("header",{className:"ml-dashboard-header",children:[s.jsx("span",{className:"ml-dashboard-title",children:"👥 Player Dashboard"}),s.jsxs("span",{className:"ml-dashboard-count",children:[o," online"]}),s.jsx("span",{style:{flex:1}}),r&&s.jsxs("span",{className:"ml-dashboard-version",children:["v",r]})]}),s.jsx("main",{className:"ml-dashboard-main",children:s.jsx(_s,{characters:c.characters})})]})},je={text:"",characters:"all",itemType:"all",weaponTypes:[],slots:[],cantrips:[],spellContains:"",ratings:{},itemSet:"",equipStatus:"",bonded:!1,attuned:!1,rare:!1,maxLevel:"",minValue:"",minWorkmanship:"",maxBurden:"",sortBy:"name",sortDir:"asc",page:1},W=c=>({value:c,label:c.replace(/^Legendary /,"")}),Ry=[{group:"Attributes",items:[W("Legendary Strength"),W("Legendary Endurance"),W("Legendary Quickness"),W("Legendary Coordination"),W("Legendary Willpower"),W("Legendary Focus")]},{group:"Weapon skills",items:[W("Legendary Heavy Weapon Aptitude"),W("Legendary Light Weapon Aptitude"),W("Legendary Finesse Weapon Aptitude"),W("Legendary Missile Weapon Aptitude"),W("Legendary Two Handed Combat Aptitude"),W("Legendary Dual Wield Aptitude"),W("Legendary Shield Aptitude"),W("Legendary Sneak Attack Prowess"),W("Legendary Dirty Fighting Prowess"),W("Legendary Recklessness Prowess"),W("Legendary Defender"),W("Legendary Blood Thirst")]},{group:"Magic",items:[W("Legendary War Magic Aptitude"),W("Legendary Void Magic Aptitude"),W("Legendary Creature Enchantment Aptitude"),W("Legendary Item Enchantment Aptitude"),W("Legendary Life Magic Aptitude"),W("Legendary Mana Conversion Prowess"),W("Legendary Arcane Prowess"),W("Legendary Hermetic Link"),W("Legendary Spirit Thirst"),W("Legendary Magic Resistance")]},{group:"Utility",items:[W("Legendary Summoning Prowess"),W("Legendary Healing Prowess"),W("Legendary Leadership"),W("Legendary Deception Prowess"),W("Legendary Person Attunement"),W("Legendary Magic Item Tinkering Expertise")]},{group:"Defense",items:[W("Legendary Invulnerability"),W("Legendary Impenetrability"),W("Legendary Impregnability"),W("Legendary Armor")]},{group:"Wards & Banes",items:[W("Legendary Flame Ward"),W("Legendary Frost Ward"),W("Legendary Acid Ward"),W("Legendary Storm Ward"),W("Legendary Slashing Ward"),W("Legendary Piercing Ward"),W("Legendary Bludgeoning Ward"),W("Legendary Piercing Bane"),W("Legendary Storm Bane")]}],qy=["Ring","Bracelet","Neck","Trinket","Cloak"],By=["Head","Chest","Abdomen","Upper Arms","Lower Arms","Hands","Upper Legs","Lower Legs","Feet","Shield"],tm=[{value:"heavy",label:"Heavy"},{value:"light",label:"Light"},{value:"finesse",label:"Finesse"},{value:"two_handed",label:"Two-Handed"},{value:"missile",label:"Missile"},{value:"war",label:"War Magic"},{value:"void",label:"Void Magic"}],ps=[{param:"min_od",label:"Weapon OD",common:!0},{param:"min_damage_rating",label:"Damage rating",common:!0},{param:"min_crit_damage_rating",label:"Crit damage",common:!0},{param:"min_heal_boost_rating",label:"Heal boost",common:!0},{param:"min_vitality_rating",label:"Vitality",common:!0},{param:"min_armor",label:"Armor level"},{param:"min_damage_resist_rating",label:"Damage resist"},{param:"min_crit_resist_rating",label:"Crit resist"},{param:"min_crit_damage_resist_rating",label:"Crit dmg resist"},{param:"min_healing_resist_rating",label:"Healing resist"},{param:"min_nether_resist_rating",label:"Nether resist"},{param:"min_healing_rating",label:"Healing rating"},{param:"min_dot_resist_rating",label:"DoT resist"},{param:"min_life_resist_rating",label:"Life resist"},{param:"min_sneak_attack_rating",label:"Sneak attack"},{param:"min_recklessness_rating",label:"Recklessness"},{param:"min_deception_rating",label:"Deception"},{param:"min_pk_damage_rating",label:"PK damage"},{param:"min_pk_damage_resist_rating",label:"PK dmg resist"},{param:"min_gear_pk_damage_rating",label:"Gear PK dmg"},{param:"min_gear_pk_damage_resist_rating",label:"Gear PK resist"},{param:"min_tinks",label:"Tinks"}],bs=[{key:"name",label:"Item",sortKey:"name",defaultVisible:!0},{key:"character_name",label:"Character",sortKey:"character_name",defaultVisible:!0},{key:"slot_name",label:"Slot",defaultVisible:!0},{key:"value",label:"Value",sortKey:"value",defaultVisible:!0},{key:"wield_level",label:"Wield",sortKey:"level",defaultVisible:!0},{key:"spell_names",label:"Spells / Cantrips",sortKey:"spell_names",defaultVisible:!0},{key:"armor_level",label:"Armor",sortKey:"armor",defaultVisible:!1},{key:"max_damage",label:"Max Dmg",sortKey:"damage",defaultVisible:!1},{key:"od_rating",label:"OD",sortKey:"od",defaultVisible:!1},{key:"workmanship",label:"Work",sortKey:"workmanship",defaultVisible:!1},{key:"item_set_name",label:"Set",sortKey:"item_set",defaultVisible:!1},{key:"object_class_name",label:"Type",sortKey:"item_type_name",defaultVisible:!1},{key:"burden",label:"Burden",defaultVisible:!1},{key:"condition_percent",label:"Cond %",defaultVisible:!1},{key:"last_updated",label:"Updated",sortKey:"last_updated",defaultVisible:!1}],Hy=200,lm="inv.visibleColumns";function Ly(c){const r={};for(const o of Object.keys(je))JSON.stringify(c[o])!==JSON.stringify(je[o])&&(r[o]=c[o]);const m=new URL(window.location.href);m.searchParams.set("view","inventory"),Object.keys(r).length?m.searchParams.set("q",JSON.stringify(r)):m.searchParams.delete("q");try{window.history.replaceState(null,"",m)}catch{}}const Yy=new Set(["all","armor","jewelry","weapon","clothing","shirt","pants"]),Vy=new Set(["asc","desc"]);function Yd(c){return Array.isArray(c)&&c.every(r=>typeof r=="string")}function Xy(c,r){switch(c){case"characters":return r==="all"||Yd(r)?r:void 0;case"slots":case"cantrips":case"weaponTypes":return Yd(r)?r:void 0;case"itemType":return typeof r=="string"&&Yy.has(r)?r:void 0;case"sortDir":return typeof r=="string"&&Vy.has(r)?r:void 0;case"ratings":{if(typeof r!="object"||r===null||Array.isArray(r))return;const m={};for(const[o,x]of Object.entries(r))(x===""||typeof x=="number")&&(m[o]=x);return m}case"text":case"spellContains":case"itemSet":case"sortBy":return typeof r=="string"?r:void 0;case"equipStatus":return r===""||r==="equipped"||r==="unequipped"?r:void 0;case"bonded":case"attuned":case"rare":return typeof r=="boolean"?r:void 0;case"maxLevel":case"minValue":case"minWorkmanship":case"maxBurden":return r===""||typeof r=="number"?r:void 0;case"page":return typeof r=="number"&&Number.isInteger(r)&&r>0?r:void 0;default:return}}function wy(){try{const c=new URLSearchParams(window.location.search).get("q");if(!c)return je;const r=JSON.parse(c);if(typeof r!="object"||r===null||Array.isArray(r))return je;const m={...je};for(const o of Object.keys(je)){if(!(o in r))continue;const x=Xy(o,r[o]);x!==void 0&&(m[o]=x)}return m}catch{return je}}function Gy(c){const r=new URLSearchParams;switch(c.characters==="all"?r.set("include_all_characters","true"):c.characters.length===1?r.set("character",c.characters[0]):r.set("characters",c.characters.join(",")),c.text&&r.set("text",c.text),c.itemType){case"armor":r.set("armor_only","true");break;case"jewelry":r.set("jewelry_only","true");break;case"clothing":r.set("clothing_only","true");break;case"shirt":r.set("shirt_only","true");break;case"pants":r.set("pants_only","true");break;case"weapon":r.set("weapon_only","true"),c.weaponTypes.length&&r.set("weapon_types",c.weaponTypes.join(","));break}c.slots.length&&r.set("slot_names",c.slots.join(",")),c.cantrips.length&&r.set("legendary_cantrips",c.cantrips.join(",")),c.spellContains&&r.set("spell_contains",c.spellContains);for(const[m,o]of Object.entries(c.ratings))o!==""&&r.set(m,String(o));return c.itemSet&&r.set("item_set",c.itemSet),c.equipStatus&&r.set("equipment_status",c.equipStatus),c.bonded&&r.set("bonded","true"),c.attuned&&r.set("attuned","true"),c.rare&&r.set("is_rare","true"),c.maxLevel!==""&&r.set("max_level",String(c.maxLevel)),c.minValue!==""&&r.set("min_value",String(c.minValue)),c.minWorkmanship!==""&&r.set("min_workmanship",String(c.minWorkmanship)),c.maxBurden!==""&&r.set("max_burden",String(c.maxBurden)),r.set("sort_by",c.sortBy),r.set("sort_dir",c.sortDir),r.set("page",String(c.page)),r.set("limit",String(Hy)),r}function Qy(){const[c,r]=g.useState(wy),[m,o]=g.useState(null),[x,_]=g.useState(!1),[M,E]=g.useState(null),[y,T]=g.useState(null),B=g.useRef(null),p=g.useCallback(R=>{r(Y=>({...Y,page:"page"in R?Y.page:1,...R}))},[]),A=g.useCallback(()=>r(je),[]);return g.useEffect(()=>{const R=setTimeout(async()=>{var V;Ly(c),(V=B.current)==null||V.abort();const Y=new AbortController;B.current=Y,_(!0);const $=performance.now();try{const C=await fetch(`/api/inv/search/items?${Gy(c)}`,{credentials:"include",signal:Y.signal});if(!C.ok)throw new Error(`search: HTTP ${C.status}`);const L=await C.json();if(L.error)throw new Error(L.error);o(L),E(null),T(Math.round(performance.now()-$))}catch(C){(C==null?void 0:C.name)!=="AbortError"&&E(String((C==null?void 0:C.message)??C))}finally{B.current===Y&&_(!1)}},400);return()=>clearTimeout(R)},[c]),{filters:c,update:p,reset:A,result:m,loading:x,error:M,queryMs:y}}function Zy({search:c}){const{filters:r,update:m}=c,[o,x]=g.useState([]),[_,M]=g.useState(new Set),[E,y]=g.useState("");g.useEffect(()=>{It("/inv/characters/list").then(A=>x(A.characters.map(R=>R.character_name).sort((R,Y)=>R.localeCompare(Y)))).catch(()=>{}),It("/live").then(A=>M(new Set(A.players.map(R=>R.character_name)))).catch(()=>{})},[]);const T=g.useMemo(()=>r.characters==="all"?new Set(o):new Set(r.characters),[r.characters,o]),B=A=>{const R=new Set(T);R.has(A)?R.delete(A):R.add(A),m({characters:R.size===o.length?"all":[...R]})},p=o.filter(A=>A.toLowerCase().includes(E.toLowerCase()));return s.jsxs(ze,{title:"Characters",defaultOpen:!0,badge:r.characters==="all"?"All":r.characters.length,children:[s.jsx("input",{className:"inv-minisearch",placeholder:"filter characters…",value:E,onChange:A=>y(A.target.value)}),s.jsxs("div",{className:"inv-links",children:[s.jsx("span",{className:"inv-linky",onClick:()=>m({characters:"all"}),children:"All"})," · ",s.jsx("span",{className:"inv-linky",onClick:()=>m({characters:[]}),children:"None"})," · ",s.jsx("span",{className:"inv-linky",onClick:()=>m({characters:o.filter(A=>_.has(A))}),children:"Online"})]}),p.map(A=>s.jsxs("label",{className:"inv-fitem",children:[s.jsx("input",{type:"checkbox",checked:T.has(A),onChange:()=>B(A)}),A," ",_.has(A)&&s.jsx("span",{className:"inv-online"})]},A))]})}function Ky({search:c}){const{filters:r,update:m}=c,[o,x]=g.useState(""),_=E=>m({cantrips:r.cantrips.includes(E)?r.cantrips.filter(y=>y!==E):[...r.cantrips,E]}),M=E=>E.toLowerCase().includes(o.toLowerCase());return s.jsxs(ze,{title:"Cantrips",defaultOpen:!0,badge:r.cantrips.length||void 0,children:[s.jsx("input",{className:"inv-minisearch",placeholder:"find cantrip… e.g. invuln",value:o,onChange:E=>x(E.target.value)}),r.cantrips.length>0&&s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"inv-subhead",children:"Selected"}),r.cantrips.map(E=>s.jsxs("label",{className:"inv-fitem inv-gold",children:[s.jsx("input",{type:"checkbox",checked:!0,onChange:()=>_(E)}),E.replace(/^Legendary /,"")]},E))]}),Ry.map(E=>{const y=E.items.filter(T=>!r.cantrips.includes(T.value)&&M(T.label));return y.length?s.jsxs("div",{children:[s.jsx("div",{className:"inv-subhead",children:E.group}),y.map(T=>s.jsxs("label",{className:"inv-fitem",children:[s.jsx("input",{type:"checkbox",checked:!1,onChange:()=>_(T.value)})," ",T.label]},T.value))]},E.group):null}),s.jsx("div",{className:"inv-subhead",children:"Any-tier spell search"}),s.jsx("input",{className:"inv-minisearch",placeholder:"spell name contains… e.g. Epic Invuln",value:r.spellContains,onChange:E=>m({spellContains:E.target.value})})]})}function ze(c){const[r,m]=g.useState(c.defaultOpen??!1);return s.jsxs("div",{className:`inv-grp${r?" inv-open":""}`,children:[s.jsxs("div",{className:"inv-grp-head",onClick:()=>m(o=>!o),children:[s.jsx("span",{className:"inv-arrow",children:"▶"})," ",c.title,c.badge?s.jsx("span",{className:"inv-badge",children:c.badge}):null]}),r&&s.jsx("div",{className:"inv-grp-body",children:c.children})]})}function ky({search:c}){const{filters:r,update:m}=c,[o,x]=g.useState(!1),[_,M]=g.useState(!1),[E,y]=g.useState([]),[T,B]=g.useState("");g.useEffect(()=>{It("/inv/sets/list").then(C=>y(C.sets)).catch(()=>{})},[]);const p=C=>m({slots:r.slots.includes(C)?r.slots.filter(L=>L!==C):[...r.slots,C]}),A=(C,L)=>m({ratings:{...r.ratings,[C]:L===""?"":Number(L)}}),R=Object.values(r.ratings).filter(C=>C!=="").length,Y=[r.equipStatus!=="",r.bonded,r.attuned,r.rare].filter(Boolean).length,$=[r.maxLevel,r.minValue,r.minWorkmanship,r.maxBurden].filter(C=>C!=="").length,V=[["all","All items"],["armor","Armor"],["jewelry","Jewelry"],["weapon","Weapons"],["clothing","Clothing"],["shirt","Shirts"],["pants","Pants"]];return s.jsxs("div",{className:"inv-sidebar",children:[s.jsx(Zy,{search:c}),s.jsxs(ze,{title:"Item state",defaultOpen:!0,badge:Y||void 0,children:[[["","Any"],["equipped","Equipped"],["unequipped","Not equipped"]].map(([C,L])=>s.jsxs("label",{className:"inv-fitem",children:[s.jsx("input",{type:"radio",name:"inv-eq",checked:r.equipStatus===C,onChange:()=>m({equipStatus:C})})," ",L]},L)),s.jsxs("label",{className:"inv-fitem",children:[s.jsx("input",{type:"checkbox",checked:r.bonded,onChange:C=>m({bonded:C.target.checked})})," Bonded"]}),s.jsxs("label",{className:"inv-fitem",children:[s.jsx("input",{type:"checkbox",checked:r.attuned,onChange:C=>m({attuned:C.target.checked})})," Attuned"]}),s.jsxs("label",{className:"inv-fitem",children:[s.jsx("input",{type:"checkbox",checked:r.rare,onChange:C=>m({rare:C.target.checked})})," Rare"]})]}),s.jsxs(ze,{title:"Item type",defaultOpen:!0,badge:r.itemType!=="all"?1:void 0,children:[V.map(([C,L])=>s.jsxs("label",{className:"inv-fitem",children:[s.jsx("input",{type:"radio",name:"inv-t",checked:r.itemType===C,onChange:()=>m({itemType:C,weaponTypes:[]})})," ",L]},C)),r.itemType==="weapon"&&s.jsx("div",{className:"inv-subgroup",children:tm.map(C=>s.jsxs("label",{className:"inv-fitem",children:[s.jsx("input",{type:"checkbox",checked:r.weaponTypes.includes(C.value),onChange:()=>m({weaponTypes:r.weaponTypes.includes(C.value)?r.weaponTypes.filter(L=>L!==C.value):[...r.weaponTypes,C.value]})})," ",C.label]},C.value))})]}),s.jsxs(ze,{title:"Slots",defaultOpen:!0,badge:r.slots.length||void 0,children:[qy.map(C=>s.jsxs("label",{className:"inv-fitem",children:[s.jsx("input",{type:"checkbox",checked:r.slots.includes(C),onChange:()=>p(C)})," ",C]},C)),s.jsxs("span",{className:"inv-linky",onClick:()=>x(C=>!C),children:[o?"hide":"show"," armor slots ",o?"▴":"▾"]}),o&&By.map(C=>s.jsxs("label",{className:"inv-fitem",children:[s.jsx("input",{type:"checkbox",checked:r.slots.includes(C),onChange:()=>p(C)})," ",C]},C))]}),s.jsx(Ky,{search:c}),s.jsxs(ze,{title:"Ratings",badge:R||void 0,children:[ps.filter(C=>_||C.common).map(C=>s.jsxs("div",{className:"inv-range",children:[s.jsxs("label",{children:[C.label," ≥"]}),s.jsx("input",{type:"number",value:r.ratings[C.param]??"",placeholder:"min",onChange:L=>A(C.param,L.target.value)})]},C.param)),s.jsx("span",{className:"inv-linky",onClick:()=>M(C=>!C),children:_?"common ratings ▴":`all ${ps.length} ratings ▾`})]}),s.jsxs(ze,{title:"Equipment sets",badge:r.itemSet?1:void 0,children:[s.jsx("input",{className:"inv-minisearch",placeholder:"find set…",value:T,onChange:C=>B(C.target.value)}),s.jsxs("label",{className:"inv-fitem",children:[s.jsx("input",{type:"radio",name:"inv-set",checked:r.itemSet==="",onChange:()=>m({itemSet:""})})," Any set"]}),E.filter(C=>C.id.toLowerCase().includes(T.toLowerCase())).map(C=>s.jsxs("label",{className:"inv-fitem",children:[s.jsx("input",{type:"radio",name:"inv-set",checked:r.itemSet===C.id,onChange:()=>m({itemSet:C.id})})," ",C.id," ",s.jsxs("span",{className:"inv-dim",children:["(",C.item_count,")"]})]},C.id))]}),s.jsxs(ze,{title:"Reqs & value",badge:$||void 0,children:[s.jsxs("div",{className:"inv-range",children:[s.jsx("label",{children:"Wield lvl ≤"}),s.jsx("input",{type:"number",value:r.maxLevel,placeholder:"max",onChange:C=>m({maxLevel:C.target.value===""?"":Number(C.target.value)})})]}),s.jsxs("div",{className:"inv-range",children:[s.jsx("label",{children:"Value ≥"}),s.jsx("input",{type:"number",value:r.minValue,placeholder:"min",onChange:C=>m({minValue:C.target.value===""?"":Number(C.target.value)})})]}),s.jsxs("div",{className:"inv-range",children:[s.jsx("label",{children:"Workmanship ≥"}),s.jsx("input",{type:"number",value:r.minWorkmanship,placeholder:"min",onChange:C=>m({minWorkmanship:C.target.value===""?"":Number(C.target.value)})})]}),s.jsxs("div",{className:"inv-range",children:[s.jsx("label",{children:"Burden ≤"}),s.jsx("input",{type:"number",value:r.maxBurden,placeholder:"max",onChange:C=>m({maxBurden:C.target.value===""?"":Number(C.target.value)})})]})]})]})}function Jy({search:c}){var x;const{filters:r,update:m}=c,o=[];if(r.text&&o.push({label:`"${r.text}"`,remove:()=>m({text:""})}),r.characters!=="all"&&o.push({label:`${r.characters.length} character${r.characters.length===1?"":"s"}`,remove:()=>m({characters:"all"})}),r.itemType!=="all"&&o.push({label:r.itemType[0].toUpperCase()+r.itemType.slice(1),remove:()=>m({itemType:"all",weaponTypes:[]})}),r.itemType==="weapon")for(const _ of r.weaponTypes){const M=((x=tm.find(E=>E.value===_))==null?void 0:x.label)??_;o.push({label:M,remove:()=>m({weaponTypes:r.weaponTypes.filter(E=>E!==_)})})}for(const _ of r.slots)o.push({label:`Slot: ${_}`,remove:()=>m({slots:r.slots.filter(M=>M!==_)})});for(const _ of r.cantrips)o.push({label:_.replace(/^Legendary /,"Leg. "),gold:!0,remove:()=>m({cantrips:r.cantrips.filter(M=>M!==_)})});r.spellContains&&o.push({label:`Spell: ${r.spellContains}`,remove:()=>m({spellContains:""})});for(const[_,M]of Object.entries(r.ratings))if(M!==""){const E=ps.find(y=>y.param===_);o.push({label:`${(E==null?void 0:E.label)??_} ≥ ${M}`,remove:()=>{const{[_]:y,...T}=r.ratings;m({ratings:T})}})}return r.itemSet&&o.push({label:`Set: ${r.itemSet}`,remove:()=>m({itemSet:""})}),r.equipStatus&&o.push({label:r.equipStatus==="equipped"?"Equipped":"Not equipped",remove:()=>m({equipStatus:""})}),r.bonded&&o.push({label:"Bonded",remove:()=>m({bonded:!1})}),r.attuned&&o.push({label:"Attuned",remove:()=>m({attuned:!1})}),r.rare&&o.push({label:"Rare",remove:()=>m({rare:!1})}),r.maxLevel!==""&&o.push({label:`Wield ≤ ${r.maxLevel}`,remove:()=>m({maxLevel:""})}),r.minValue!==""&&o.push({label:`Value ≥ ${r.minValue}`,remove:()=>m({minValue:""})}),r.minWorkmanship!==""&&o.push({label:`Work ≥ ${r.minWorkmanship}`,remove:()=>m({minWorkmanship:""})}),r.maxBurden!==""&&o.push({label:`Burden ≤ ${r.maxBurden}`,remove:()=>m({maxBurden:""})}),o.length?s.jsxs("div",{className:"inv-chipsrow",children:[s.jsx("span",{className:"inv-chips-lbl",children:"ACTIVE"}),o.map((_,M)=>s.jsxs("span",{className:`inv-chip${_.gold?" inv-chip-gold":""}`,children:[_.label," ",s.jsx("span",{className:"inv-chip-x",onClick:_.remove,children:"×"})]},M))]}):null}function Wy(){try{const c=localStorage.getItem(lm);if(c)return new Set(JSON.parse(c))}catch{}return new Set(bs.filter(c=>c.defaultVisible).map(c=>c.key))}function $y(c,r){switch(r){case"name":return s.jsxs(s.Fragment,{children:[c.name,c.is_equipped&&s.jsx("span",{className:"inv-equipped",children:" ⚔"})]});case"spell_names":return s.jsx("span",{className:"inv-spells",children:(c.spell_names??[]).map((m,o)=>s.jsxs("span",{children:[o>0&&", ",s.jsx("span",{className:/legendary/i.test(m)?"inv-leg":"",children:m})]},o))});case"value":return c.value!=null?c.value.toLocaleString():"—";case"last_updated":return c.last_updated?c.last_updated.slice(0,16).replace("T"," "):"—";case"od_rating":{const m=c.od_rating;return m==null?"—":String(m)}default:{const m=c[r];return m==null||m===-1?"—":String(m)}}}function Fy({search:c,selected:r,onSelect:m}){const{filters:o,update:x,result:_}=c,[M,E]=g.useState(Wy),[y,T]=g.useState(!1),B=g.useRef(null),p=g.useMemo(()=>{const V=new Set(M);return o.itemType==="weapon"&&V.add("od_rating"),bs.filter(C=>V.has(C.key))},[M,o.itemType]),A=(_==null?void 0:_.items)??[];g.useEffect(()=>{try{localStorage.setItem(lm,JSON.stringify([...M]))}catch{}},[M]),g.useEffect(()=>{const V=C=>{var zt,Ut;if(((zt=C.target)==null?void 0:zt.tagName)==="INPUT"||((Ut=C.target)==null?void 0:Ut.tagName)==="SELECT")return;if(C.key==="Escape"){m(null);return}if(C.key!=="ArrowDown"&&C.key!=="ArrowUp")return;C.preventDefault();const L=r?A.indexOf(r):-1,F=C.key==="ArrowDown"?Math.min(L+1,A.length-1):Math.max(L-1,0);A[F]&&m(A[F])};return window.addEventListener("keydown",V),()=>window.removeEventListener("keydown",V)},[A,r,m]);const R=V=>{V&&(o.sortBy===V?x({sortDir:o.sortDir==="asc"?"desc":"asc"}):x({sortBy:V,sortDir:"asc"}))},Y=_?Math.max(1,Math.ceil(_.total_count/_.limit)):1,$=V=>{var C;x({page:Math.min(Math.max(1,V),Y)}),(C=B.current)==null||C.scrollTo(0,0)};return s.jsxs("div",{className:"inv-results",ref:B,children:[s.jsxs("div",{className:"inv-colpicker-anchor",children:[s.jsx("button",{className:"inv-btn inv-colpicker-btn",onClick:()=>T(V=>!V),children:"⚙ Columns"}),y&&s.jsx("div",{className:"inv-colpicker",children:bs.map(V=>s.jsxs("label",{className:"inv-fitem",children:[s.jsx("input",{type:"checkbox",checked:M.has(V.key),onChange:()=>{const C=new Set(M);C.has(V.key)?C.delete(V.key):C.add(V.key),E(C)}})," ",V.label]},V.key))})]}),s.jsxs("table",{children:[s.jsx("thead",{children:s.jsx("tr",{children:p.map(V=>s.jsx("th",{className:o.sortBy===V.sortKey?`inv-sorted-${o.sortDir}`:"",onClick:()=>R(V.sortKey),children:V.label},V.key))})}),s.jsxs("tbody",{children:[A.map((V,C)=>s.jsx("tr",{className:V===r?"inv-sel":"",onClick:()=>m(V===r?null:V),children:p.map(L=>s.jsx("td",{children:$y(V,L.key)},L.key))},C)),!A.length&&s.jsx("tr",{children:s.jsx("td",{colSpan:p.length,className:"inv-dim",children:"No items match."})})]})]}),s.jsxs("div",{className:"inv-pager",children:[s.jsx("span",{className:"inv-pg",onClick:()=>$(o.page-1),children:"◀"}),s.jsxs("span",{children:["page ",(_==null?void 0:_.page)??1," / ",Y]}),s.jsx("span",{className:"inv-pg",onClick:()=>$(o.page+1),children:"▶"}),s.jsxs("span",{className:"inv-pager-right",children:[(_==null?void 0:_.limit)??200," / page"]})]})]})}function Al({k:c,v:r}){return s.jsxs("div",{className:"inv-kv",children:[s.jsx("span",{children:c}),s.jsx("b",{children:r??"—"})]})}function Iy({item:c,onClose:r}){var m,o;return s.jsxs("div",{className:"inv-detail",children:[s.jsx("span",{className:"inv-closex",onClick:r,children:"×"}),s.jsx("h3",{children:c.name}),s.jsxs("div",{className:"inv-detail-sub",children:[c.slot_name??c.object_class_name??""," · ",c.is_equipped?"⚔ Equipped":"📦 Inventory",c.is_rare&&" · ★ Rare"]}),s.jsx(Al,{k:"Character",v:c.character_name}),s.jsx(Al,{k:"Value",v:(m=c.value)==null?void 0:m.toLocaleString()}),s.jsx(Al,{k:"Burden",v:c.burden}),s.jsx(Al,{k:"Wield req",v:c.wield_level?`Level ${c.wield_level}`:"—"}),s.jsx(Al,{k:"Workmanship",v:c.workmanship??"—"}),c.armor_level!=null&&c.armor_level>0&&s.jsx(Al,{k:"Armor",v:c.armor_level}),c.max_damage!=null&&c.max_damage>0&&s.jsx(Al,{k:"Max damage",v:c.max_damage}),c.od_rating!=null&&s.jsx(Al,{k:"Weapon OD",v:String(c.od_rating)}),c.condition_percent!=null&&s.jsx(Al,{k:"Condition",v:`${c.condition_percent}%`}),c.item_set_name&&s.jsx(Al,{k:"Set",v:c.item_set_name}),(c.is_bonded||c.is_attuned)&&s.jsx(Al,{k:"Binding",v:[c.is_bonded&&"Bonded",c.is_attuned&&"Attuned"].filter(Boolean).join(", ")}),s.jsx("hr",{}),s.jsxs("div",{className:"inv-sphead",children:["Spells (",((o=c.spell_names)==null?void 0:o.length)??0,")"]}),(c.spell_names??[]).map((x,_)=>s.jsx("div",{className:`inv-sp${/legendary/i.test(x)?" inv-leg":""}`,children:x},_)),s.jsx("div",{className:"inv-hint",children:"↑/↓ next item · Esc close"})]})}function Vd(c){return`${c.name} ${c.character_name} ${c.last_updated??""}`}class Py extends g.Component{constructor(r){super(r),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(r,m){console.error("Inventory search crashed:",r,m)}render(){return this.state.hasError?s.jsx("div",{className:"inv-page",children:s.jsxs("div",{className:"inv-error",style:{margin:"auto",textAlign:"center",padding:24},children:[s.jsx("p",{style:{marginBottom:12},children:"Something went wrong loading the inventory search page."}),s.jsx("button",{className:"inv-btn",onClick:()=>{window.location.href="/?view=inventory"},children:"Reset filters"})]})}):this.props.children}}function tv(){const c=Qy(),[r,m]=g.useState(null);return g.useEffect(()=>{var M;if(!r)return;const o=((M=c.result)==null?void 0:M.items)??[],x=Vd(r),_=o.find(E=>Vd(E)===x);_&&_!==r?m(_):_||m(null)},[c.result]),s.jsxs("div",{className:"inv-page",children:[s.jsxs("div",{className:"inv-topbar",children:[s.jsx("span",{className:"inv-title",children:"⚔ Inventory Search"}),s.jsx("input",{className:"inv-searchbox",placeholder:"Search name or material…",value:c.filters.text,onChange:o=>c.update({text:o.target.value})}),s.jsx("button",{className:"inv-btn",onClick:()=>{c.reset(),m(null)},children:"Reset"}),s.jsx("span",{className:"inv-count",children:c.error?s.jsx("span",{className:"inv-error",children:c.error}):c.result?s.jsxs(s.Fragment,{children:[s.jsx("b",{children:c.result.total_count.toLocaleString()})," items",c.queryMs!=null&&s.jsxs(s.Fragment,{children:[" · ",c.queryMs," ms"]}),c.loading&&" · …"]}):"loading…"})]}),s.jsx(Jy,{search:c}),s.jsxs("div",{className:"inv-main",children:[s.jsx(ky,{search:c}),s.jsx(Fy,{search:c,selected:r,onSelect:m}),r&&s.jsx(Iy,{item:r,onClose:()=>m(null)})]})]})}function lv(){return s.jsx(Py,{children:s.jsx(tv,{})})}function ev(){const c=new URLSearchParams(window.location.search).get("view");return s.jsx(w0,{children:c==="dashboard"?s.jsx(Uy,{}):c==="inventory"?s.jsx(lv,{}):s.jsx(av,{})})}function av(){const c=Pd();return s.jsx(My,{data:c})}U0.createRoot(document.getElementById("root")).render(s.jsx(g.StrictMode,{children:s.jsx(ev,{})}));"serviceWorker"in navigator&&navigator.serviceWorker.register("/sw.js").catch(()=>{});export{kd as D,It as a,cv as b,uv as c,iv as d,ey as e,fv as f,rv as g,ov as h,s as j,sv as l,g as r,An as u}; diff --git a/static/index.html b/static/index.html index fbd744e2..3747174d 100644 --- a/static/index.html +++ b/static/index.html @@ -8,7 +8,7 @@ - +