1import{r as g,j as x}from"./jsx-runtime-CDnd_NX6.js";import{a7 as I,a9 as b,aa as L,aq as w,ab as $}from"./useUiStateStore-CJFVEkIr.js";import{S as O}from"./immer-Dw4EE-Qj.js";const P=n=>{const s={poe:n,league:$,regions:[],ensureRegions:!1,globalRules:{},listingSettings:{},lastListingsPosted:{},lastRegionInputValue:void 0};return I()(b(O((e,a)=>({...s,reset:()=>e(s),setLeague:t=>e({league:t}),setRegions:t=>e({regions:t}),setEnsureRegions:t=>e({ensureRegions:t}),setGlobalRules:t=>e({globalRules:t}),setListingSettings:t=>e(r=>{let i=r.listingSettings;return typeof t=="function"?i=t(i):i=t,{listingSettings:i}}),setLastListingsPosted:t=>e({lastListingsPosted:t}),setLastRegionInputValue:t=>e({lastRegionInputValue:t})})),{name:`poexchange-${n}-service-listing-tool-store`,storage:L(()=>localStorage),partialize:e=>({league:e.league,regions:e.regions,ensureRegions:e.ensureRegions,globalRules:e.globalRules,listingSettings:e.listingSettings,lastRegionInputValue:e.lastRegionInputValue}),version:3,migrate:(e,a)=>{if(a<3){const t=e;"prefferedRegions"in t&&!("regions"in t)&&(t.regions=t.prefferedRegions),delete t.prefferedRegions}if(a<2){const t=e,r=t.listingSettings;if(!r)return{...t,listingSettings:{}};const i=w(n,"wts"),l=new Map(i.flatMap(o=>o.id?[[o.value,o.id]]:[])),f=new Map;for(const o of i)for(const c of o.services)c.id&&f.set(c.value,c.id);const d={};for(const[o,c]of Object.entries(r)){const v=l.get(o);if(!v)continue;const u={};for(const[S,R]of Object.entries(c)){const m=R.serviceName;if(!m)continue;const p=f.get(m);if(!p)continue;const h=S.lastIndexOf("-");if(h===-1)continue;const j=S.slice(h+1);u[V(p,j)]={...R,serviceNameId:p}}Object.keys(u).length>0&&(d[v]=u)}return{...t,listingSettings:d}}return e}}))},V=(n,s,e)=>`${n}-${s}`,N=g.createContext(null),C=({children:n,poe:s})=>{const e=g.useRef();return(!e.current||e.current.getState().poe!==s)&&(e.current=P(s)),x.jsx(N.Provider,{value:e.current,children:n})},E=n=>{const s={poe:n,league:$,whisperedServices:{},recentServices:[]};return I()(b((e,a)=>({...s,reset:()=>e(s),setLeague:t=>e({league:t}),addWhisperedService:t=>e(r=>({whisperedServices:{...r.whisperedServices,[t]:!0}})),addRecentService:t=>e(r=>{const i=r.recentServices.filter(l=>!(l.serviceNameId===t.serviceNameId&&l.poe===t.poe));return{recentServices:[t,...i].slice(0,5)}})}),{name:`poexchange-${n}-service-listings-store`,storage:L(()=>localStorage),partialize:e=>({league:e.league,recentServices:e.recentServices}),version:2,migrate:(e,a)=>a<2?{...e,recentServices:[]}:e}))},M=g.createContext(null),q=({children:n,poe:s})=>{const e=g.useRef();return(!e.current||e.current.getState().poe!==s)&&(e.current=E(s)),x.jsx(M.Provider,{value:e.current,children:n})};export{C as l,q as m,N as s,M as u};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.