@mhmo91/schmancy 0.2.144 → 0.2.145

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"}),require("./animated-text-UjA34w-f.cjs");const c=require("./area.component-BEDtgjNb.cjs");require("./autocomplete-CtqM8VN6.cjs"),require("./spinner-D46_Vbxf.cjs");const l=require("./icon-button-B3LSOKYP.cjs"),r=require("./teleport.component-Cgtrv4bU.cjs"),g=require("./checkbox-CGAbsupz.cjs");require("./chips-FOChglMy.cjs");const f=require("./payment-card-form-DmHX_20B.cjs");require("./date-range-CCBukS6w.cjs");const h=require("./delay-DoQ_jIcq.cjs"),i=require("./ripple-C2BHbhcS.cjs");require("./divider-Wh-OY6OR.cjs");const u=require("./timezone-2Eb26kSx.cjs");require("./form-B0CyaQwH.cjs"),require("./icon-BqQnZfcC.cjs"),require("./input-A8mZ7r9Z.cjs");const a=require("./flex-BaRE9ffF.cjs"),S=require("./list-4_krEg2r.cjs");require("./menu-fEUIZGXJ.cjs");const y=require("./notification-container-DdUjZ0bi.cjs"),b=require("./notification-service-DXXrRCmK.cjs");require("./option-CpmK20dy.cjs");const C=require("./radio-group-DOpJu0Pc.cjs"),O=require("./rxjs-utils.cjs");require("rxjs"),require("./index-DyJ0oDpR.cjs");const q=require("./select-0NLmJErW.cjs"),n=require("./sheet-BwsspKto.cjs"),s=require("./slider-9zdabbA2.cjs"),o=require("./schmancy-steps-container-B5UOYQG8.cjs"),t=require("./context-object-CP7HbDFQ.cjs"),e=require("./selector-hook-Bvne--oy.cjs"),p=require("./surface-DFXFQBBC.cjs"),d=require("./table-BG1_ofOE.cjs");require("./tabs-group-BVsNqqN1.cjs"),require("./textarea-D1nov2H8.cjs");const m=require("./theme.component-C61DdKLT.cjs"),D=require("./theme.interface-Xg5Zi46a.cjs");require("./theme-button-C-g9a2ZF.cjs");const P=require("./tree-CsKV00BK.cjs"),j=require("./types.cjs"),w=require("./typewriter-BTKJ8mPR.cjs"),M=require("./typography-BJzp77zk.cjs"),T=require("./intersection-CVvaDv96.cjs");exports.FINDING_MORTIES=c.FINDING_MORTIES,exports.HERE_RICKY=c.HERE_RICKY,exports.HISTORY_STRATEGY=c.HISTORY_STRATEGY,Object.defineProperty(exports,"SchmancyArea",{enumerable:!0,get:()=>c.SchmancyArea}),exports.area=c.area,exports.routerHistory=c.routerHistory,Object.defineProperty(exports,"SchmancyButton",{enumerable:!0,get:()=>l.SchmancyButton}),Object.defineProperty(exports,"SchmnacyIconButton",{enumerable:!0,get:()=>l.SchmnacyIconButton}),exports.$drawer=r.$drawer,exports.HereMorty=r.HereMorty,Object.defineProperty(exports,"SchmancyContentDrawer",{enumerable:!0,get:()=>r.SchmancyContentDrawer}),exports.SchmancyContentDrawerID=r.SchmancyContentDrawerID,Object.defineProperty(exports,"SchmancyContentDrawerMain",{enumerable:!0,get:()=>r.SchmancyContentDrawerMain}),exports.SchmancyContentDrawerMaxHeight=r.SchmancyContentDrawerMaxHeight,exports.SchmancyContentDrawerMinWidth=r.SchmancyContentDrawerMinWidth,Object.defineProperty(exports,"SchmancyContentDrawerSheet",{enumerable:!0,get:()=>r.SchmancyContentDrawerSheet}),exports.SchmancyContentDrawerSheetMode=r.SchmancyContentDrawerSheetMode,exports.SchmancyContentDrawerSheetState=r.SchmancyContentDrawerSheetState,Object.defineProperty(exports,"SchmancyDrawerAppbar",{enumerable:!0,get:()=>r.SchmancyDrawerAppbar}),exports.SchmancyDrawerNavbarMode=r.SchmancyDrawerNavbarMode,exports.SchmancyDrawerNavbarState=r.SchmancyDrawerNavbarState,Object.defineProperty(exports,"SchmancyNavigationDrawer",{enumerable:!0,get:()=>r.SchmancyNavigationDrawer}),Object.defineProperty(exports,"SchmancyNavigationDrawerContent",{enumerable:!0,get:()=>r.SchmancyNavigationDrawerContent}),Object.defineProperty(exports,"SchmancyNavigationDrawerSidebar",{enumerable:!0,get:()=>r.SchmancyNavigationDrawerSidebar}),Object.defineProperty(exports,"SchmancyTeleportation",{enumerable:!0,get:()=>r.SchmancyTeleportation}),exports.WhereAreYouRicky=r.WhereAreYouRicky,exports.schmancyContentDrawer=r.schmancyContentDrawer,exports.schmancyNavDrawer=r.schmancyNavDrawer,exports.teleport=r.teleport,Object.defineProperty(exports,"SchmancyCheckbox",{enumerable:!0,get:()=>g.SchmancyCheckbox}),Object.defineProperty(exports,"SchmancyPaymentCardForm",{enumerable:!0,get:()=>f.SchmancyPaymentCardForm}),Object.defineProperty(exports,"SchmancyDelay",{enumerable:!0,get:()=>h.SchmancyDelay}),exports.delayContext=h.delayContext,exports.color=i.color,exports.fullHeight=i.fullHeight,exports.ripple=i.ripple,Object.defineProperty(exports,"SchmancyCountriesSelect",{enumerable:!0,get:()=>u.SchmancyCountriesSelect}),Object.defineProperty(exports,"SchmancyTimezonesSelect",{enumerable:!0,get:()=>u.SchmancyTimezonesSelect}),Object.defineProperty(exports,"SchmancyFlex",{enumerable:!0,get:()=>a.SchmancyFlex}),Object.defineProperty(exports,"SchmancyFlexV2",{enumerable:!0,get:()=>a.SchmancyFlexV2}),Object.defineProperty(exports,"SchmancyGrid",{enumerable:!0,get:()=>a.SchmancyGrid}),Object.defineProperty(exports,"SchmancyScroll",{enumerable:!0,get:()=>a.SchmancyScroll}),Object.defineProperty(exports,"List",{enumerable:!0,get:()=>S.List}),Object.defineProperty(exports,"SchmancyListItem",{enumerable:!0,get:()=>S.SchmancyListItem}),exports.SchmancyListTypeContext=S.SchmancyListTypeContext,exports.NotificationAudioService=y.NotificationAudioService,Object.defineProperty(exports,"SchmancyNotification",{enumerable:!0,get:()=>y.SchmancyNotification}),Object.defineProperty(exports,"SchmancyNotificationContainer",{enumerable:!0,get:()=>y.SchmancyNotificationContainer}),exports.$notify=b.$notify,exports.NotificationService=b.NotificationService,Object.defineProperty(exports,"RadioGroup",{enumerable:!0,get:()=>C.RadioGroup}),exports.mutationObserver=O.mutationObserver,Object.defineProperty(exports,"SchmancySelect",{enumerable:!0,get:()=>q.SchmancySelect}),exports.SchmancySheetPosition=n.SchmancySheetPosition,exports.SheetHereMorty=n.SheetHereMorty,exports.SheetWhereAreYouRicky=n.SheetWhereAreYouRicky,exports.sheet=n.sheet,Object.defineProperty(exports,"SchmancySlide",{enumerable:!0,get:()=>s.SchmancySlide}),Object.defineProperty(exports,"SchmancySlider",{enumerable:!0,get:()=>s.SchmancySlider}),Object.defineProperty(exports,"SchmancyStep",{enumerable:!0,get:()=>o.SchmancyStep}),Object.defineProperty(exports,"SchmancyStepsContainer",{enumerable:!0,get:()=>o.SchmancyStepsContainer}),exports.StepsController=o.StepsController,exports.stepsContext=o.stepsContext,exports.BaseStore=t.BaseStore,exports.IndexedDBStorageManager=t.IndexedDBStorageManager,exports.LocalStorageManager=t.LocalStorageManager,exports.MemoryStorageManager=t.MemoryStorageManager,exports.SchmancyArrayStore=t.SchmancyArrayStore,exports.SchmancyStoreObject=t.SchmancyStoreObject,exports.SessionStorageManager=t.SessionStorageManager,exports.StoreError=t.StoreError,exports.createStorageManager=t.createStorageManager,exports.compareValues=e.compareValues,exports.createArrayContext=e.createArrayContext,exports.createCollectionSelector=e.createCollectionSelector,exports.createCompoundSelector=e.createCompoundSelector,exports.createContext=e.createContext,exports.createCountSelector=e.createCountSelector,exports.createEntriesSelector=e.createEntriesSelector,exports.createFilterSelector=e.createFilterSelector,exports.createFindSelector=e.createFindSelector,exports.createItemSelector=e.createItemSelector,exports.createItemsSelector=e.createItemsSelector,exports.createKeysSelector=e.createKeysSelector,exports.createMapSelector=e.createMapSelector,exports.createOptimizedSelector=e.createOptimizedSelector,exports.createSelector=e.createSelector,exports.createSortSelector=e.createSortSelector,exports.createTestArrayContext=e.createTestArrayContext,exports.filterArray=e.filterArray,exports.filterArrayItems=e.filterArrayItems,exports.filterMap=e.filterMap,exports.filterMapItems=e.filterMapItems,exports.getFieldValue=e.getFieldValue,exports.isArray=e.isArray,exports.isDate=e.isDate,exports.isIterable=e.isIterable,exports.isMap=e.isMap,exports.isNil=e.isNil,exports.isNumber=e.isNumber,exports.isPlainObject=e.isPlainObject,exports.isSet=e.isSet,exports.isString=e.isString,exports.select=e.select,exports.selectItem=e.selectItem,Object.defineProperty(exports,"SchmancySurface",{enumerable:!0,get:()=>p.SchmancySurface}),exports.SchmancySurfaceTypeContext=p.SchmancySurfaceTypeContext,Object.defineProperty(exports,"SchmancyDataTable",{enumerable:!0,get:()=>d.SchmancyDataTable}),Object.defineProperty(exports,"SchmancyTableRow",{enumerable:!0,get:()=>d.SchmancyTableRow}),Object.defineProperty(exports,"SchmancyThemeComponent",{enumerable:!0,get:()=>m.SchmancyThemeComponent}),exports.formateTheme=m.formateTheme,exports.tailwindStyles=m.tailwindStyles,exports.SchmancyTheme=D.SchmancyTheme,Object.defineProperty(exports,"SchmancyTree",{enumerable:!0,get:()=>P.SchmancyTree}),exports.SchmancyEvents=j.SchmancyEvents,Object.defineProperty(exports,"TypewriterElement",{enumerable:!0,get:()=>w.TypewriterElement}),Object.defineProperty(exports,"SchmancyTypography",{enumerable:!0,get:()=>M.SchmancyTypography}),exports.intersection$=T.intersection$;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"}),require("./animated-text-UjA34w-f.cjs");const c=require("./area.component-BEDtgjNb.cjs");require("./autocomplete-CtqM8VN6.cjs"),require("./spinner-D46_Vbxf.cjs");const l=require("./icon-button-B3LSOKYP.cjs"),r=require("./teleport.component-Cgtrv4bU.cjs"),g=require("./checkbox-CGAbsupz.cjs");require("./chips-FOChglMy.cjs");const f=require("./payment-card-form-DmHX_20B.cjs");require("./date-range-CCBukS6w.cjs");const h=require("./delay-DoQ_jIcq.cjs"),i=require("./ripple-C2BHbhcS.cjs");require("./divider-Wh-OY6OR.cjs");const u=require("./timezone-2Eb26kSx.cjs");require("./form-B0CyaQwH.cjs"),require("./icon-BqQnZfcC.cjs"),require("./input-A8mZ7r9Z.cjs");const a=require("./flex-BaRE9ffF.cjs"),S=require("./list-4_krEg2r.cjs");require("./menu-fEUIZGXJ.cjs");const y=require("./notification-container-DdUjZ0bi.cjs"),b=require("./notification-service-DXXrRCmK.cjs");require("./option-CpmK20dy.cjs");const C=require("./radio-group-DOpJu0Pc.cjs"),O=require("./rxjs-utils.cjs");require("rxjs"),require("./index-DyJ0oDpR.cjs");const q=require("./select-0NLmJErW.cjs"),n=require("./sheet-BwsspKto.cjs"),s=require("./slider-9zdabbA2.cjs"),o=require("./schmancy-steps-container-B5UOYQG8.cjs"),t=require("./context-object-CP7HbDFQ.cjs"),e=require("./selector-hook-BjCCf3SV.cjs"),p=require("./surface-DFXFQBBC.cjs"),d=require("./table-BG1_ofOE.cjs");require("./tabs-group-BVsNqqN1.cjs"),require("./textarea-D1nov2H8.cjs");const m=require("./theme.component-C61DdKLT.cjs"),D=require("./theme.interface-Xg5Zi46a.cjs");require("./theme-button-C-g9a2ZF.cjs");const P=require("./tree-CsKV00BK.cjs"),j=require("./types.cjs"),w=require("./typewriter-BTKJ8mPR.cjs"),M=require("./typography-BJzp77zk.cjs"),T=require("./intersection-CVvaDv96.cjs");exports.FINDING_MORTIES=c.FINDING_MORTIES,exports.HERE_RICKY=c.HERE_RICKY,exports.HISTORY_STRATEGY=c.HISTORY_STRATEGY,Object.defineProperty(exports,"SchmancyArea",{enumerable:!0,get:()=>c.SchmancyArea}),exports.area=c.area,exports.routerHistory=c.routerHistory,Object.defineProperty(exports,"SchmancyButton",{enumerable:!0,get:()=>l.SchmancyButton}),Object.defineProperty(exports,"SchmnacyIconButton",{enumerable:!0,get:()=>l.SchmnacyIconButton}),exports.$drawer=r.$drawer,exports.HereMorty=r.HereMorty,Object.defineProperty(exports,"SchmancyContentDrawer",{enumerable:!0,get:()=>r.SchmancyContentDrawer}),exports.SchmancyContentDrawerID=r.SchmancyContentDrawerID,Object.defineProperty(exports,"SchmancyContentDrawerMain",{enumerable:!0,get:()=>r.SchmancyContentDrawerMain}),exports.SchmancyContentDrawerMaxHeight=r.SchmancyContentDrawerMaxHeight,exports.SchmancyContentDrawerMinWidth=r.SchmancyContentDrawerMinWidth,Object.defineProperty(exports,"SchmancyContentDrawerSheet",{enumerable:!0,get:()=>r.SchmancyContentDrawerSheet}),exports.SchmancyContentDrawerSheetMode=r.SchmancyContentDrawerSheetMode,exports.SchmancyContentDrawerSheetState=r.SchmancyContentDrawerSheetState,Object.defineProperty(exports,"SchmancyDrawerAppbar",{enumerable:!0,get:()=>r.SchmancyDrawerAppbar}),exports.SchmancyDrawerNavbarMode=r.SchmancyDrawerNavbarMode,exports.SchmancyDrawerNavbarState=r.SchmancyDrawerNavbarState,Object.defineProperty(exports,"SchmancyNavigationDrawer",{enumerable:!0,get:()=>r.SchmancyNavigationDrawer}),Object.defineProperty(exports,"SchmancyNavigationDrawerContent",{enumerable:!0,get:()=>r.SchmancyNavigationDrawerContent}),Object.defineProperty(exports,"SchmancyNavigationDrawerSidebar",{enumerable:!0,get:()=>r.SchmancyNavigationDrawerSidebar}),Object.defineProperty(exports,"SchmancyTeleportation",{enumerable:!0,get:()=>r.SchmancyTeleportation}),exports.WhereAreYouRicky=r.WhereAreYouRicky,exports.schmancyContentDrawer=r.schmancyContentDrawer,exports.schmancyNavDrawer=r.schmancyNavDrawer,exports.teleport=r.teleport,Object.defineProperty(exports,"SchmancyCheckbox",{enumerable:!0,get:()=>g.SchmancyCheckbox}),Object.defineProperty(exports,"SchmancyPaymentCardForm",{enumerable:!0,get:()=>f.SchmancyPaymentCardForm}),Object.defineProperty(exports,"SchmancyDelay",{enumerable:!0,get:()=>h.SchmancyDelay}),exports.delayContext=h.delayContext,exports.color=i.color,exports.fullHeight=i.fullHeight,exports.ripple=i.ripple,Object.defineProperty(exports,"SchmancyCountriesSelect",{enumerable:!0,get:()=>u.SchmancyCountriesSelect}),Object.defineProperty(exports,"SchmancyTimezonesSelect",{enumerable:!0,get:()=>u.SchmancyTimezonesSelect}),Object.defineProperty(exports,"SchmancyFlex",{enumerable:!0,get:()=>a.SchmancyFlex}),Object.defineProperty(exports,"SchmancyFlexV2",{enumerable:!0,get:()=>a.SchmancyFlexV2}),Object.defineProperty(exports,"SchmancyGrid",{enumerable:!0,get:()=>a.SchmancyGrid}),Object.defineProperty(exports,"SchmancyScroll",{enumerable:!0,get:()=>a.SchmancyScroll}),Object.defineProperty(exports,"List",{enumerable:!0,get:()=>S.List}),Object.defineProperty(exports,"SchmancyListItem",{enumerable:!0,get:()=>S.SchmancyListItem}),exports.SchmancyListTypeContext=S.SchmancyListTypeContext,exports.NotificationAudioService=y.NotificationAudioService,Object.defineProperty(exports,"SchmancyNotification",{enumerable:!0,get:()=>y.SchmancyNotification}),Object.defineProperty(exports,"SchmancyNotificationContainer",{enumerable:!0,get:()=>y.SchmancyNotificationContainer}),exports.$notify=b.$notify,exports.NotificationService=b.NotificationService,Object.defineProperty(exports,"RadioGroup",{enumerable:!0,get:()=>C.RadioGroup}),exports.mutationObserver=O.mutationObserver,Object.defineProperty(exports,"SchmancySelect",{enumerable:!0,get:()=>q.SchmancySelect}),exports.SchmancySheetPosition=n.SchmancySheetPosition,exports.SheetHereMorty=n.SheetHereMorty,exports.SheetWhereAreYouRicky=n.SheetWhereAreYouRicky,exports.sheet=n.sheet,Object.defineProperty(exports,"SchmancySlide",{enumerable:!0,get:()=>s.SchmancySlide}),Object.defineProperty(exports,"SchmancySlider",{enumerable:!0,get:()=>s.SchmancySlider}),Object.defineProperty(exports,"SchmancyStep",{enumerable:!0,get:()=>o.SchmancyStep}),Object.defineProperty(exports,"SchmancyStepsContainer",{enumerable:!0,get:()=>o.SchmancyStepsContainer}),exports.StepsController=o.StepsController,exports.stepsContext=o.stepsContext,exports.BaseStore=t.BaseStore,exports.IndexedDBStorageManager=t.IndexedDBStorageManager,exports.LocalStorageManager=t.LocalStorageManager,exports.MemoryStorageManager=t.MemoryStorageManager,exports.SchmancyArrayStore=t.SchmancyArrayStore,exports.SchmancyStoreObject=t.SchmancyStoreObject,exports.SessionStorageManager=t.SessionStorageManager,exports.StoreError=t.StoreError,exports.createStorageManager=t.createStorageManager,exports.compareValues=e.compareValues,exports.createArrayContext=e.createArrayContext,exports.createCollectionSelector=e.createCollectionSelector,exports.createCompoundSelector=e.createCompoundSelector,exports.createContext=e.createContext,exports.createCountSelector=e.createCountSelector,exports.createEntriesSelector=e.createEntriesSelector,exports.createFilterSelector=e.createFilterSelector,exports.createFindSelector=e.createFindSelector,exports.createItemSelector=e.createItemSelector,exports.createItemsSelector=e.createItemsSelector,exports.createKeysSelector=e.createKeysSelector,exports.createMapSelector=e.createMapSelector,exports.createOptimizedSelector=e.createOptimizedSelector,exports.createSelector=e.createSelector,exports.createSortSelector=e.createSortSelector,exports.createTestArrayContext=e.createTestArrayContext,exports.filterArray=e.filterArray,exports.filterArrayItems=e.filterArrayItems,exports.filterMap=e.filterMap,exports.filterMapItems=e.filterMapItems,exports.getFieldValue=e.getFieldValue,exports.isArray=e.isArray,exports.isDate=e.isDate,exports.isIterable=e.isIterable,exports.isMap=e.isMap,exports.isNil=e.isNil,exports.isNumber=e.isNumber,exports.isPlainObject=e.isPlainObject,exports.isSet=e.isSet,exports.isString=e.isString,exports.select=e.select,exports.selectItem=e.selectItem,Object.defineProperty(exports,"SchmancySurface",{enumerable:!0,get:()=>p.SchmancySurface}),exports.SchmancySurfaceTypeContext=p.SchmancySurfaceTypeContext,Object.defineProperty(exports,"SchmancyDataTable",{enumerable:!0,get:()=>d.SchmancyDataTable}),Object.defineProperty(exports,"SchmancyTableRow",{enumerable:!0,get:()=>d.SchmancyTableRow}),Object.defineProperty(exports,"SchmancyThemeComponent",{enumerable:!0,get:()=>m.SchmancyThemeComponent}),exports.formateTheme=m.formateTheme,exports.tailwindStyles=m.tailwindStyles,exports.SchmancyTheme=D.SchmancyTheme,Object.defineProperty(exports,"SchmancyTree",{enumerable:!0,get:()=>P.SchmancyTree}),exports.SchmancyEvents=j.SchmancyEvents,Object.defineProperty(exports,"TypewriterElement",{enumerable:!0,get:()=>w.TypewriterElement}),Object.defineProperty(exports,"SchmancyTypography",{enumerable:!0,get:()=>M.SchmancyTypography}),exports.intersection$=T.intersection$;
2
2
  //# sourceMappingURL=index.cjs.map
package/dist/index.js CHANGED
@@ -30,7 +30,7 @@ import { S as Fa, b as Ha, a as Ba, s as La } from "./sheet-Bl64wfBe.js";
30
30
  import { S as ka, a as Ga } from "./slider-nyTR0hyw.js";
31
31
  import { S as $a, a as ja, b as Wa, s as za } from "./schmancy-steps-container-srToeIjV.js";
32
32
  import { B as Va, I as _a, L as Ka, M as qa, S as Ja, a as Qa, b as Ua, d as Xa, c as Za } from "./context-object-CISes2bD.js";
33
- import { p as ee, a as re, v as te, y as oe, c as ce, F as se, A as ne, D as Se, C as me, x as ie, w as ye, z as pe, E as he, G as le, u as fe, B as xe, b as Ce, r as de, d as De, q as we, f as ge, g as be, i as Me, j as ue, k as Te, l as Ie, o as Ne, h as Ae, n as ve, m as Re, e as Ee, s as Fe, t as He } from "./selector-hook-D_HTD-GV.js";
33
+ import { p as ee, a as re, v as te, y as oe, c as ce, F as se, A as ne, D as Se, C as me, x as ie, w as ye, z as pe, E as he, G as le, u as fe, B as xe, b as Ce, r as de, d as De, q as we, f as ge, g as be, i as Me, j as ue, k as Te, l as Ie, o as Ne, h as Ae, n as ve, m as Re, e as Ee, s as Fe, t as He } from "./selector-hook-DHPU6Z2H.js";
34
34
  import { a as Le, S as Oe } from "./surface-RtVWZEdq.js";
35
35
  import { a as Ge, S as Ye } from "./table-CGdNPIeN.js";
36
36
  import "./tabs-group-CvHe90C_.js";
@@ -0,0 +1,2 @@
1
+ "use strict";const O=require("./context-object-CP7HbDFQ.cjs"),B=require("lit/decorators.js"),m=require("rxjs"),K=require("rxjs/operators");function E(n,e,t){try{e==="indexeddb"&&(e="local"),((o=n)===null||typeof o!="object"||Array.isArray(o)||o instanceof Map||o instanceof Set||o instanceof Date||o instanceof RegExp||Object.getPrototypeOf(o)!==Object.prototype)&&(n={...n});const a=O.SchmancyStoreObject.getInstance(e,t,n);return typeof(r=a.value)=="object"&&r!==null&&Object.keys(r).length===0&&a.set({...n}),a}catch{return O.SchmancyStoreObject.getInstance("memory",`${t}-fallback`,n)}var r,o}function q(n,e,t){try{const r=O.SchmancyArrayStore.getInstance(e,t,n);return r.value.length||r.replace([...n]),r}catch{return O.SchmancyArrayStore.getInstance("memory",`${t}-fallback`,[...n])}}function $(n,e,t){try{return n==null&&(n=t.includes("collection")||t.includes("map")?new Map:t.includes("array")||t.includes("list")?[]:{}),n instanceof Map?function(r,o,a){try{const u=O.SchmancyCollectionStore.getInstance(o,a,r);return u.value.size||u.replace(new Map(r)),u}catch{return O.SchmancyCollectionStore.getInstance("memory",`${a}-fallback`,new Map(r))}}(n,e,t):function(r){return Array.isArray(r)}(n)?q(n,e,t):E(typeof n=="object"?n:{value:n},e,t)}catch{return E(typeof n=="object"&&n!==null?{...n}:{value:n},"memory",`emergency-fallback-${t}`)}}const P=(n,e)=>{if(!e)return n;const t=e.split(".");let r=n;for(const o of t){if(r==null)return;r=r[o]}return r},R=n=>{if(!n||n.length<2)return[];const e=[];for(let t=0;t<n.length-1;t++)e.push(n.substring(t,t+2).toLowerCase());return e},W=(n,e)=>{if(!n||!e)return 0;const t=n.toLowerCase().trim(),r=e.toLowerCase().trim();if(t===r)return 1;const o=t.includes(r)?1:0,a=((l,y)=>{if(!l)return!0;if(!y)return!1;let s=0,i=0;for(;s<l.length&&i<y.length;)l[s].toLowerCase()===y[i].toLowerCase()&&s++,i++;return s===l.length})(r,t)?.8:0,u=((l,y)=>{if(!l)return!0;if(!y)return!1;const s=j=>j.toLowerCase().split("").reduce((I,A)=>(I[A]=(I[A]||0)+1,I),{}),i=s(l),h=s(y);return Object.keys(i).every(j=>(h[j]||0)>=i[j])})(r,t)?.7:0,f=((l,y)=>{if(!l||!y||l.length<2||y.length<2)return 0;const s=R(l),i=R(y);if(s.length===0||i.length===0)return 0;let h=0;const j=new Array(i.length).fill(!1);for(const I of s)for(let A=0;A<i.length;A++)if(!j[A]&&i[A]===I){h++,j[A]=!0;break}return 2*h/(s.length+i.length)})(t,r),c=Math.max(t.length,r.length),g=c?1-((l,y)=>{if(l===y)return 0;const s=Array(y.length+1).fill(null).map((i,h)=>[h]);for(let i=0;i<=l.length;i++)s[0][i]=i;for(let i=1;i<=y.length;i++)for(let h=1;h<=l.length;h++)y.charAt(i-1)===l.charAt(h-1)?s[i][h]=s[i-1][h-1]:s[i][h]=Math.min(s[i-1][h]+1,s[i][h-1]+1,s[i-1][h-1]+1);return s[y.length][l.length]})(t,r)/c:0;return Math.max(o,a,u,f,g)},D=n=>n==null?"":String(n);function Z(n,e,t=.3){let r,o,a,u=!1;if(Array.isArray(e)?[r,o,a,u=!1]=e:(r=e.key,o=e.operator,a=e.value,u=e.strict||!1),!u&&(a===""||a==null||k(a)&&a.length===0))return{valid:!0,score:1};const f=P(n,r);if(u){if(o==="any"){if(typeof f!="string"||typeof a!="string")return{valid:!1,score:0};const c=W(f,a);return{valid:c>=t,score:c>=t?c:0}}{const c=z(o,f,a);return{valid:c,score:c?1:0}}}if(o==="any"){if(typeof f!="string"||typeof a!="string")return{valid:!1,score:0};const c=W(f,a);return c<t?{valid:!1,score:0}:{valid:!0,score:c}}{const c=z(o,f,a);return{valid:c,score:c?1:0}}}function U(n,e=[],t=.3){if(!e.length)return Array.from(n.values());const r=[];for(const[o,a]of n.entries()){let u=0,f=0,c=!0;for(const g of e){const l=Z(a,g,t);if(!l.valid){c=!1;break}u+=l.score,f++}c&&r.push({item:a,score:f>0?u/f:1})}return r.sort((o,a)=>a.score-o.score),r.map(o=>o.item)}function V(n,e=[],t=.3){const r=new Map;return n.forEach((o,a)=>r.set(String(a),o)),U(r,e,t)}function k(n){return Array.isArray(n)}function p(n){return typeof n=="string"}function C(n){return typeof n=="number"&&!isNaN(n)}function v(n){return n instanceof Date&&!isNaN(n.getTime())}function L(n){return n instanceof Map}function x(n){return n instanceof Set}function T(n){return n==null}function z(n,e,t){if(T(e)&&T(t))return!0;if(T(e)||T(t))return n==="=="?e===t:n==="!="&&e!==t;switch(n){case"==":return e===t;case"!=":return e!==t;case">":return C(e)&&C(t)?e>t:v(e)&&v(t)?e.getTime()>t.getTime():!(!p(e)||!p(t))&&e.localeCompare(t)>0;case"<":return C(e)&&C(t)?e<t:v(e)&&v(t)?e.getTime()<t.getTime():!(!p(e)||!p(t))&&e.localeCompare(t)<0;case">=":return C(e)&&C(t)?e>=t:v(e)&&v(t)?e.getTime()>=t.getTime():!(!p(e)||!p(t))&&e.localeCompare(t)>=0;case"<=":return C(e)&&C(t)?e<=t:v(e)&&v(t)?e.getTime()<=t.getTime():!(!p(e)||!p(t))&&e.localeCompare(t)<=0;case"includes":return p(e)?e.toLowerCase().includes(D(t).toLowerCase()):k(e)?e.includes(t):x(e)?e.has(t):!!L(e)&&Array.from(e.values()).includes(t);case"notIncludes":return p(e)?!e.toLowerCase().includes(D(t).toLowerCase()):k(e)?!e.includes(t):x(e)?!e.has(t):!L(e)||!Array.from(e.values()).includes(t);case"startsWith":return!(!p(e)||!p(t))&&e.toLowerCase().startsWith(t.toLowerCase());case"endsWith":return!(!p(e)||!p(t))&&e.toLowerCase().endsWith(t.toLowerCase());case"in":return k(t)?t.includes(e):x(t)?t.has(e):!!L(t)&&(t.has(e)||Array.from(t.values()).includes(e));case"notIn":return k(t)?!t.includes(e):x(t)?!t.has(e):!L(t)||!t.has(e)&&!Array.from(t.values()).includes(e);default:return!1}}const G=U,H=V;function M(n,e){if(n===e)return!0;if(n instanceof Map&&e instanceof Map){if(n.size!==e.size)return!1;for(const[t,r]of n)if(!e.has(t)||!M(r,e.get(t)))return!1;return!0}if(n instanceof Set&&e instanceof Set){if(n.size!==e.size)return!1;for(const t of n)if(!e.has(t))return!1;return!0}if(typeof n=="object"&&n!==null&&typeof e=="object"&&e!==null){const t=Object.keys(n),r=Object.keys(e);if(t.length!==r.length)return!1;for(const o of t)if(!M(n[o],e[o]))return!1;return!0}return!1}function N(n,e){return n.$.pipe(m.map(e),m.distinctUntilChanged(M),m.shareReplay(1))}function d(n,e){return n.$.pipe(m.map(e),m.distinctUntilChanged(M),m.shareReplay(1))}const w=Symbol("selectorCleanup"),b=Symbol("selectorSubscriptions"),S=Symbol("selectorInitialized");function F(n,e=r=>r,t={}){return function(r,o,a){B.property({attribute:!1,type:Object})(r,o);const u=r.connectedCallback,f=r.disconnectedCallback;r.connectedCallback=function(){var y;var c;(c=this)[w]&&!c[w].closed||(c[w]=new m.Subject),c[b]||(c[b]=new Map),c[S]||(c[S]=new Set);const g=function(s){return"set"in s&&typeof s.set=="function"&&s.value instanceof Map}(n)?d(n,e):N(n,e);t.required||this[S].has(o)||(u==null||u.call(this),this[S].add(o)),this[b].has(o)&&((y=this[b].get(o))==null||y.unsubscribe(),this[b].delete(o)),t.debug;const l=g.pipe(K.takeUntil(this[w])).subscribe({next:s=>{var h;const i=t.deepClone?structuredClone(s):s;t.debug,t.updateOnly||(this[o]=i),(h=this.requestUpdate)==null||h.call(this),t.required&&!this[S].has(o)&&i!=null&&(t.debug,u==null||u.call(this),this[S].add(o))},error:s=>{this.isConnected&&setTimeout(()=>{var i;this.isConnected&&(t.debug,(i=this.connectedCallback)==null||i.call(this))},1e3)}});this[b].set(o,l)},r.disconnectedCallback=function(){var c;f==null||f.call(this),t.debug,(c=this)[w]&&(c[w].next(),c[w].complete(),c[w]=void 0),c[b]&&(c[b].forEach(g=>g.unsubscribe()),c[b].clear(),c[b]=void 0),c[S]&&(c[S].clear(),c[S]=void 0)}}}exports.compareValues=z,exports.createArrayContext=function(n=[],e,t="local"){try{return $(n,t,e)}catch{return q(n,"memory",`${e}-fallback`)}},exports.createCollectionSelector=d,exports.createCompoundSelector=function(n,e,t){const r=n.map((c,g)=>{const l=e[g];return"set"in c&&typeof c.set=="function"&&c.value instanceof Map?d(c,l):N(c,l)}),o=m.combineLatest(r).pipe(m.map(c=>t(...c)),m.distinctUntilChanged(M),m.shareReplay(1)),a=n.map((c,g)=>e[g](c.value)),u=t(...a),f=new m.BehaviorSubject(u);return o.subscribe(c=>f.next(c)),{$:f,get value(){return f.getValue()},ready:!0}},exports.createContext=$,exports.createCountSelector=function(n,e){return d(n,t=>e?Array.from(t.entries()).filter(([r,o])=>e(o,r)).length:t.size)},exports.createEntriesSelector=function(n){return d(n,e=>Array.from(e.entries()))},exports.createFilterSelector=function(n,e){return d(n,t=>Array.from(t.entries()).filter(([r,o])=>e(o,r)).map(([r,o])=>o))},exports.createFindSelector=function(n,e){return d(n,t=>{for(const[r,o]of t.entries())if(e(o,r))return o})},exports.createItemSelector=function(n,e){return d(n,t=>t.get(e))},exports.createItemsSelector=function(n){return d(n,e=>Array.from(e.values()))},exports.createKeysSelector=function(n){return d(n,e=>Array.from(e.keys()))},exports.createMapSelector=function(n,e){return d(n,t=>Array.from(t.entries()).map(([r,o])=>e(o,r)))},exports.createOptimizedSelector=function(n,e){return n.$.pipe(m.map(e),m.distinctUntilChanged(M),m.share({resetOnRefCountZero:!0,resetOnError:!1,resetOnComplete:!1}))},exports.createSelector=N,exports.createSortSelector=function(n,e){return d(n,t=>Array.from(t.values()).sort(e))},exports.createTestArrayContext=function(n=[],e="test-array"){try{return $(n,"memory",e)}catch{return q(n,"memory",`${e}-emergency-fallback`)}},exports.filterArray=H,exports.filterArrayItems=V,exports.filterMap=G,exports.filterMapItems=U,exports.getFieldValue=P,exports.isArray=k,exports.isDate=v,exports.isIterable=function(n){return n!=null&&typeof n=="object"&&Symbol.iterator in Object(n)&&typeof n[Symbol.iterator]=="function"},exports.isMap=L,exports.isNil=T,exports.isNumber=C,exports.isPlainObject=function(n){if(n===null||typeof n!="object")return!1;const e=Object.getPrototypeOf(n);return e===Object.prototype||e===null},exports.isSet=x,exports.isString=p,exports.select=F,exports.selectItem=function(n,e,t={}){return function(r,o,a){F(n,function(u){const f=e(this);return f?u.get(f):void 0},t)(r,o)}};
2
+ //# sourceMappingURL=selector-hook-BjCCf3SV.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"selector-hook-BjCCf3SV.cjs","sources":["../src/store/context-create.ts","../src/store/filter-directive.ts","../src/store/selectors.ts","../src/store/selector-hook.ts"],"sourcesContent":["// src/store/context-create.ts - Fixed version\n\nimport { SchmancyArrayStore } from './context-array'\nimport SchmancyCollectionStore from './context-collection'\nimport { SchmancyStoreObject } from './context-object'\nimport { IArrayStore, ICollectionStore, IStore, StorageType } from './types'\n\n/**\n * Type guard to check if an object is empty\n */\nfunction isEmptyObject(obj: unknown): boolean {\n\tif (typeof obj !== 'object' || obj === null) {\n\t\treturn false\n\t}\n\treturn Object.keys(obj).length === 0\n}\n\n/**\n * Type guard for Map objects\n */\nfunction isMap<K, V>(value: unknown): value is Map<K, V> {\n\treturn value instanceof Map\n}\n\n/**\n * Type guard for Array objects\n */\nfunction isArray<T>(value: unknown): value is Array<T> {\n\treturn Array.isArray(value)\n}\n\n/**\n * Type guard for plain objects (not arrays, maps, null, etc.)\n */\nfunction isPlainObject(value: unknown): boolean {\n\treturn (\n\t\tvalue !== null &&\n\t\ttypeof value === 'object' &&\n\t\t!Array.isArray(value) &&\n\t\t!(value instanceof Map) &&\n\t\t!(value instanceof Set) &&\n\t\t!(value instanceof Date) &&\n\t\t!(value instanceof RegExp) &&\n\t\tObject.getPrototypeOf(value) === Object.prototype\n\t)\n}\n\n/**\n * Creates a regular object store with better typing and error handling\n */\nfunction createObjectStore<T extends Record<string, any>>(\n\tinitialData: T,\n\tstorage: StorageType,\n\tkey: string,\n): IStore<T> & SchmancyStoreObject<T> {\n\ttry {\n\t\t// Validate storage type\n\t\tif (storage === 'indexeddb') {\n\t\t\tconsole.warn(`IndexedDB storage is not optimal for plain objects. Using 'local' instead for key: ${key}`)\n\t\t\tstorage = 'local'\n\t\t}\n\n\t\t// Ensure initialData is a plain object\n\t\tif (!isPlainObject(initialData)) {\n\t\t\tconsole.warn(`Initial data is not a plain object. Converting to object for key: ${key}`)\n\t\t\tinitialData = { ...initialData } as T\n\t\t}\n\n\t\t// Create the store instance\n\t\tconst store = SchmancyStoreObject.getInstance<T>(storage, key, initialData)\n\n\t\t// Initialize with provided data if store is empty\n\t\tif (isEmptyObject(store.value)) {\n\t\t\tstore.set({ ...initialData }) // Use spread to create a copy\n\t\t}\n\n\t\treturn store\n\t} catch (err) {\n\t\tconsole.error(`Failed to create object store for key: ${key}`, err)\n\t\t// Fall back to a basic implementation that won't throw\n\t\tconst fallbackStore = SchmancyStoreObject.getInstance<T>(\n\t\t\t'memory', // Fallback to memory storage\n\t\t\t`${key}-fallback`,\n\t\t\tinitialData,\n\t\t)\n\t\tconsole.warn(`Using fallback memory store for key: ${key}`)\n\t\treturn fallbackStore\n\t}\n}\n\n/**\n * Creates a collection store with better typing and error handling\n */\nfunction createCollectionStore<V>(\n\tinitialData: Map<string, V>,\n\tstorage: StorageType,\n\tkey: string,\n): ICollectionStore<V> & SchmancyCollectionStore<V> {\n\ttry {\n\t\t// Create the store instance\n\t\tconst store = SchmancyCollectionStore.getInstance(storage, key, initialData)\n\n\t\t// Initialize with provided data if store is empty\n\t\tif (!store.value.size) {\n\t\t\t// Create a new Map instance to avoid modifying the input\n\t\t\tstore.replace(new Map(initialData))\n\t\t}\n\n\t\treturn store\n\t} catch (err) {\n\t\tconsole.error(`Failed to create collection store for key: ${key}`, err)\n\t\t// Fall back to a basic implementation that won't throw\n\t\tconst fallbackStore = SchmancyCollectionStore.getInstance<V>(\n\t\t\t'memory', // Fallback to memory storage\n\t\t\t`${key}-fallback`,\n\t\t\tnew Map(initialData),\n\t\t)\n\t\tconsole.warn(`Using fallback memory store for key: ${key}`)\n\t\treturn fallbackStore\n\t}\n}\n\n/**\n * Creates an array store with better typing and error handling\n */\nfunction createArrayStore<T>(\n\tinitialData: T[],\n\tstorage: StorageType,\n\tkey: string,\n): IArrayStore<T> & SchmancyArrayStore<T> {\n\ttry {\n\t\t// Create the store instance\n\t\tconst store = SchmancyArrayStore.getInstance(storage, key, initialData)\n\n\t\t// Initialize with provided data if store is empty\n\t\tif (!store.value.length) {\n\t\t\t// Create a new array instance to avoid modifying the input\n\t\t\tstore.replace([...initialData])\n\t\t}\n\n\t\treturn store\n\t} catch (err) {\n\t\tconsole.error(`Failed to create array store for key: ${key}`, err)\n\t\t// Fall back to a basic implementation that won't throw\n\t\tconst fallbackStore = SchmancyArrayStore.getInstance<T>(\n\t\t\t'memory', // Fallback to memory storage\n\t\t\t`${key}-fallback`,\n\t\t\t[...initialData],\n\t\t)\n\t\tconsole.warn(`Using fallback memory store for key: ${key}`)\n\t\treturn fallbackStore\n\t}\n}\n\n// Function overloads for better type inference\n/**\n * Creates a context for managing object state\n * @param initialData The initial object data\n * @param storage Storage type to use\n * @param key Unique key for the store\n * @returns A store instance for the object\n */\nexport function createContext<T extends Record<string, any>>(\n\tinitialData: T,\n\tstorage: StorageType,\n\tkey: string,\n): IStore<T> & SchmancyStoreObject<T>\n\n/**\n * Creates a context for managing collection state\n * @param initialData The initial Map collection\n * @param storage Storage type to use\n * @param key Unique key for the store\n * @returns A collection store instance\n */\nexport function createContext<V>(\n\tinitialData: Map<string, V>,\n\tstorage: StorageType,\n\tkey: string,\n): ICollectionStore<V> & SchmancyCollectionStore<V>\n\n/**\n * Creates a context for managing array state\n * @param initialData The initial array\n * @param storage Storage type to use\n * @param key Unique key for the store\n * @returns An array store instance\n */\nexport function createContext<T>(\n\tinitialData: T[],\n\tstorage: StorageType,\n\tkey: string,\n): IArrayStore<T> & SchmancyArrayStore<T>\n\n/**\n * Implementation of the createContext function with complete type checking\n * and robust error handling\n */\nexport function createContext<T extends Record<string, any> | Map<string, any> | any[]>(\n\tinitialData: T,\n\tstorage: StorageType,\n\tkey: string,\n):\n\t| (IStore<T> & SchmancyStoreObject<T>)\n\t| (ICollectionStore<any> & SchmancyCollectionStore<any>)\n\t| (IArrayStore<any> & SchmancyArrayStore<any>) {\n\ttry {\n\t\t// Validate input\n\t\tif (initialData === null || initialData === undefined) {\n\t\t\tconsole.error('Initial data cannot be null or undefined')\n\t\t\t// Provide a sensible default based on type expected\n\t\t\tif (key.includes('collection') || key.includes('map')) {\n\t\t\t\tinitialData = new Map() as unknown as T\n\t\t\t} else if (key.includes('array') || key.includes('list')) {\n\t\t\t\tinitialData = [] as unknown as T\n\t\t\t} else {\n\t\t\t\tinitialData = {} as T\n\t\t\t}\n\t\t}\n\n\t\t// Determine store type based on input data with improved type checking\n\t\tif (isMap<string, any>(initialData)) {\n\t\t\treturn createCollectionStore<any>(initialData, storage, key)\n\t\t} else if (isArray<any>(initialData)) {\n\t\t\treturn createArrayStore<any>(initialData, storage, key)\n\t\t} else if (typeof initialData === 'object') {\n\t\t\treturn createObjectStore<any>(initialData as Record<string, any>, storage, key)\n\t\t} else {\n\t\t\t// Handle non-object data by wrapping it\n\t\t\tconsole.warn(`Initial data must be an object, array, or Map. Got ${typeof initialData}. Creating object wrapper.`)\n\t\t\treturn createObjectStore<any>({ value: initialData } as Record<string, any>, storage, key)\n\t\t}\n\t} catch (error) {\n\t\t// Last-resort error handling\n\t\tconsole.error(`Fatal error creating context for ${key}:`, error)\n\n\t\t// Create an emergency fallback store that won't throw\n\t\treturn createObjectStore<any>(\n\t\t\ttypeof initialData === 'object' && initialData !== null ? { ...initialData } : { value: initialData },\n\t\t\t'memory',\n\t\t\t`emergency-fallback-${key}`,\n\t\t)\n\t}\n}\n\n/**\n * Creates an array context with simplified API and type inference\n * @param initialData The initial array data\n * @param key Unique key for the store\n * @param storage Storage type to use (defaults to 'local')\n * @returns An array store instance\n */\nexport function createArrayContext<T>(\n\tinitialData: T[] = [],\n\tkey: string,\n\tstorage: StorageType = 'local',\n): IArrayStore<T> & SchmancyArrayStore<T> {\n\ttry {\n\t\treturn createContext<T>(initialData, storage, key)\n\t} catch (err) {\n\t\tconsole.error(`Failed to create array context for key: ${key}`, err)\n\t\t// Return a fallback store\n\t\treturn createArrayStore<T>(initialData, 'memory', `${key}-fallback`)\n\t}\n}\n\n/**\n * Creates a testable array context\n * @param initialData The initial array data\n * @param key Unique key for the store\n * @returns An array store that uses memory storage\n */\nexport function createTestArrayContext<T>(\n\tinitialData: T[] = [],\n\tkey: string = 'test-array',\n): IArrayStore<T> & SchmancyArrayStore<T> {\n\ttry {\n\t\treturn createContext<T>(initialData, 'memory', key)\n\t} catch (err) {\n\t\tconsole.error(`Failed to create test array context for key: ${key}`, err)\n\t\t// Return a fallback store with a different key\n\t\treturn createArrayStore<T>(initialData, 'memory', `${key}-emergency-fallback`)\n\t}\n}\n","// src/store/filter-directive.ts\n\n/** Supported comparison operators with TypeScript literal types */\nexport type ComparisonOperator =\n\t| '=='\n\t| '!='\n\t| '>'\n\t| '<'\n\t| '>='\n\t| '<='\n\t| 'includes'\n\t| 'notIncludes'\n\t| 'startsWith'\n\t| 'endsWith'\n\t| 'in'\n\t| 'notIn'\n\t| 'any' // fuzzy search operator\n\n/**\n * Type-safe condition tuple\n */\nexport type ConditionTuple = [field: string, op: ComparisonOperator, expected: unknown, strict?: boolean]\n\n/**\n * Type-safe condition object\n */\nexport interface ConditionObject {\n\tkey: string\n\toperator: ComparisonOperator\n\tvalue: unknown\n\tstrict?: boolean\n}\n\n/**\n * Unified query condition type\n */\nexport type QueryCondition = ConditionTuple | ConditionObject\n\n/**\n * Filter result with item and score\n */\nexport interface ScoredItem<T> {\n\titem: T\n\tscore: number\n}\n\n/**\n * Get a nested value from an object using a dot-separated path.\n * Checks explicitly for null/undefined so falsy values like 0 or false are preserved.\n */\nexport const getFieldValue = <T = any>(item: Record<string, any>, path: string): T => {\n\tif (!path) return item as unknown as T\n\n\tconst parts = path.split('.')\n\tlet value: any = item\n\n\tfor (const part of parts) {\n\t\tif (value == null) return undefined as unknown as T\n\t\tvalue = value[part]\n\t}\n\n\treturn value as T\n}\n\n/**\n * Compute the Levenshtein distance between two strings.\n */\nconst levenshtein = (a: string, b: string): number => {\n\tif (a === b) return 0\n\n\tconst matrix: number[][] = Array(b.length + 1)\n\t\t.fill(null)\n\t\t.map((_, i) => [i])\n\n\t// initialize the first row\n\tfor (let j = 0; j <= a.length; j++) {\n\t\tmatrix[0][j] = j\n\t}\n\n\tfor (let i = 1; i <= b.length; i++) {\n\t\tfor (let j = 1; j <= a.length; j++) {\n\t\t\tif (b.charAt(i - 1) === a.charAt(j - 1)) {\n\t\t\t\tmatrix[i][j] = matrix[i - 1][j - 1]\n\t\t\t} else {\n\t\t\t\tmatrix[i][j] = Math.min(\n\t\t\t\t\tmatrix[i - 1][j] + 1, // deletion\n\t\t\t\t\tmatrix[i][j - 1] + 1, // insertion\n\t\t\t\t\tmatrix[i - 1][j - 1] + 1, // substitution\n\t\t\t\t)\n\t\t\t}\n\t\t}\n\t}\n\treturn matrix[b.length][a.length]\n}\n\n/**\n * Check if string `sub` is a subsequence of string `str`.\n * All characters in `sub` must appear in order in `str` (they need not be contiguous).\n */\nconst isSubsequence = (sub: string, str: string): boolean => {\n\tif (!sub) return true\n\tif (!str) return false\n\n\tlet i = 0,\n\t\tj = 0\n\twhile (i < sub.length && j < str.length) {\n\t\tif (sub[i].toLowerCase() === str[j].toLowerCase()) i++\n\t\tj++\n\t}\n\treturn i === sub.length\n}\n\n/**\n * Check if every character (with frequency) in the query exists in the target.\n * For example, \"aovc\" matches \"avocados\".\n */\nconst anagramMatch = (query: string, target: string): boolean => {\n\tif (!query) return true\n\tif (!target) return false\n\n\tconst countChars = (s: string): Record<string, number> =>\n\t\ts\n\t\t\t.toLowerCase()\n\t\t\t.split('')\n\t\t\t.reduce(\n\t\t\t\t(acc, char) => {\n\t\t\t\t\tacc[char] = (acc[char] || 0) + 1\n\t\t\t\t\treturn acc\n\t\t\t\t},\n\t\t\t\t{} as Record<string, number>,\n\t\t\t)\n\n\tconst queryCount = countChars(query)\n\tconst targetCount = countChars(target)\n\treturn Object.keys(queryCount).every(char => (targetCount[char] || 0) >= queryCount[char])\n}\n\n/**\n * Generate bigrams for a string.\n */\nconst getBigrams = (s: string): string[] => {\n\tif (!s || s.length < 2) return []\n\n\tconst bigrams: string[] = []\n\tfor (let i = 0; i < s.length - 1; i++) {\n\t\tbigrams.push(s.substring(i, i + 2).toLowerCase())\n\t}\n\treturn bigrams\n}\n\n/**\n * Compute Dice's coefficient for two strings based on bigrams.\n * Returns a value between 0 (no similarity) and 1 (perfect match).\n */\nconst diceCoefficient = (s1: string, s2: string): number => {\n\tif (!s1 || !s2 || s1.length < 2 || s2.length < 2) return 0\n\n\tconst bigrams1 = getBigrams(s1)\n\tconst bigrams2 = getBigrams(s2)\n\n\tif (bigrams1.length === 0 || bigrams2.length === 0) return 0\n\n\tlet intersection = 0\n\tconst used = new Array(bigrams2.length).fill(false)\n\n\tfor (const bigram of bigrams1) {\n\t\tfor (let i = 0; i < bigrams2.length; i++) {\n\t\t\tif (!used[i] && bigrams2[i] === bigram) {\n\t\t\t\tintersection++\n\t\t\t\tused[i] = true\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n\n\treturn (2 * intersection) / (bigrams1.length + bigrams2.length)\n}\n\n/**\n * Compute a fuzzy similarity score between two strings.\n * The score is computed by taking the maximum of several methods:\n * - Direct substring match (score 1)\n * - Subsequence check (score 0.8)\n * - Anagram subset match (score 0.7)\n * - Dice coefficient\n * - Normalized Levenshtein similarity\n */\nconst computeFuzzyScore = (actual: string, expected: string): number => {\n\tif (!actual || !expected) return 0\n\n\tconst a = actual.toLowerCase().trim()\n\tconst b = expected.toLowerCase().trim()\n\n\tif (a === b) return 1\n\n\tconst substringScore = a.includes(b) ? 1 : 0\n\tconst subsequenceScore = isSubsequence(b, a) ? 0.8 : 0\n\tconst anagramScore = anagramMatch(b, a) ? 0.7 : 0\n\tconst diceScore = diceCoefficient(a, b)\n\n\tconst maxLen = Math.max(a.length, b.length)\n\tconst levenshteinScore = maxLen ? 1 - levenshtein(a, b) / maxLen : 0\n\n\treturn Math.max(substringScore, subsequenceScore, anagramScore, diceScore, levenshteinScore)\n}\n\n/**\n * Safely coerce value to string if possible, or return empty string\n */\nconst safeString = (value: unknown): string => {\n\tif (value == null) return ''\n\treturn String(value)\n}\n\n/**\n * Apply a query condition to an item and return score\n */\nfunction applyQueryCondition<T extends Record<string, any>>(\n\titem: T,\n\tquery: QueryCondition,\n\tfuzzyThreshold: number = 0.3,\n): { valid: boolean; score: number } {\n\tlet field: string,\n\t\top: ComparisonOperator,\n\t\texpected: unknown,\n\t\tstrict = false\n\n\tif (Array.isArray(query)) {\n\t\t;[field, op, expected, strict = false] = query\n\t} else {\n\t\tfield = query.key\n\t\top = query.operator\n\t\texpected = query.value\n\t\tstrict = query.strict || false\n\t}\n\n\t// Skip empty filters for non-strict queries\n\tif (!strict && (expected === '' || expected == null || (isArray(expected) && expected.length === 0))) {\n\t\treturn { valid: true, score: 1 }\n\t}\n\n\tconst actual = getFieldValue(item, field)\n\n\t// FIXED: Properly handle strict mode\n\tif (strict) {\n\t\t// For strict mode, use exact equality comparison for all operators except 'any'\n\t\tif (op === 'any') {\n\t\t\t// Fuzzy search still applies with strict mode\n\t\t\tif (typeof actual !== 'string' || typeof expected !== 'string') {\n\t\t\t\treturn { valid: false, score: 0 }\n\t\t\t}\n\n\t\t\tconst score = computeFuzzyScore(actual, expected)\n\t\t\treturn {\n\t\t\t\tvalid: score >= fuzzyThreshold,\n\t\t\t\tscore: score >= fuzzyThreshold ? score : 0,\n\t\t\t}\n\t\t} else {\n\t\t\t// For all other operators in strict mode,\n\t\t\t// delegate to compareValues function but return precise scores\n\t\t\tconst matches = compareValues(op, actual, expected)\n\t\t\treturn {\n\t\t\t\tvalid: matches,\n\t\t\t\tscore: matches ? 1 : 0,\n\t\t\t}\n\t\t}\n\t} else if (op === 'any') {\n\t\t// Fuzzy search requires both values to be strings\n\t\tif (typeof actual !== 'string' || typeof expected !== 'string') {\n\t\t\treturn { valid: false, score: 0 }\n\t\t}\n\n\t\tconst score = computeFuzzyScore(actual, expected)\n\t\tif (score < fuzzyThreshold) {\n\t\t\treturn { valid: false, score: 0 }\n\t\t}\n\n\t\treturn { valid: true, score }\n\t} else {\n\t\t// For non-fuzzy operators, check condition\n\t\tconst matches = compareValues(op, actual, expected)\n\t\treturn {\n\t\t\tvalid: matches,\n\t\t\tscore: matches ? 1 : 0,\n\t\t}\n\t}\n}\n\n/**\n * Filter a Map of items given an array of query conditions.\n * For each query condition:\n * - If the expected value is empty/null/undefined, it is treated as a match.\n * - For non-fuzzy operators, the condition must strictly match.\n * - For the \"any\" operator, a fuzzy similarity score is computed.\n * Items with a fuzzy score below a given threshold (e.g., 0.3) are excluded.\n *\n * The overall item score is the average of the scores from all conditions.\n * The results are sorted in descending order of relevance.\n *\n * @param items - A Map containing items to filter.\n * @param queries - An array of query conditions to apply.\n * @param fuzzyThreshold - Minimum score required for fuzzy matches (default: 0.3)\n * @returns An array of items that match all query conditions, sorted by relevance.\n */\nexport function filterMapItems<T extends Record<string, any>>(\n\titems: Map<string, T>,\n\tqueries: QueryCondition[] = [],\n\tfuzzyThreshold: number = 0.3,\n): T[] {\n\t// If no queries, return all items unsorted\n\tif (!queries.length) {\n\t\treturn Array.from(items.values())\n\t}\n\n\t// Score and filter each item\n\tconst scoredItems: ScoredItem<T>[] = []\n\n\tfor (const [_, item] of items.entries()) {\n\t\tlet totalScore = 0\n\t\tlet matchCount = 0\n\t\tlet valid = true\n\n\t\tfor (const query of queries) {\n\t\t\tconst result = applyQueryCondition(item, query, fuzzyThreshold)\n\n\t\t\tif (!result.valid) {\n\t\t\t\tvalid = false\n\t\t\t\tbreak\n\t\t\t}\n\n\t\t\ttotalScore += result.score\n\t\t\tmatchCount++\n\t\t}\n\n\t\tif (valid) {\n\t\t\tscoredItems.push({\n\t\t\t\titem,\n\t\t\t\tscore: matchCount > 0 ? totalScore / matchCount : 1,\n\t\t\t})\n\t\t}\n\t}\n\n\t// Sort by descending score\n\tscoredItems.sort((a, b) => b.score - a.score)\n\n\treturn scoredItems.map(x => x.item)\n}\n\n/**\n * Filter an array of items using query conditions\n */\nexport function filterArrayItems<T extends Record<string, any>>(\n\titems: T[],\n\tqueries: QueryCondition[] = [],\n\tfuzzyThreshold: number = 0.3,\n): T[] {\n\t// Create temporary map with numeric indices as keys\n\tconst map = new Map<string, T>()\n\titems.forEach((item, index) => map.set(String(index), item))\n\n\treturn filterMapItems(map, queries, fuzzyThreshold)\n}\n\n// Improved type guards for filter-directive.ts\n\n/**\n * Type guard for checking if a value is an array with better type inference\n * @param value Value to check\n * @returns True if the value is an array\n */\nexport function isArray<T = unknown>(value: unknown): value is Array<T> {\n\treturn Array.isArray(value)\n}\n\n/**\n * Type guard for checking if a value is a string\n * @param value Value to check\n * @returns True if the value is a string\n */\nexport function isString(value: unknown): value is string {\n\treturn typeof value === 'string'\n}\n\n/**\n * Type guard for checking if a value is a number\n * @param value Value to check\n * @returns True if the value is a number and not NaN\n */\nexport function isNumber(value: unknown): value is number {\n\treturn typeof value === 'number' && !isNaN(value)\n}\n\n/**\n * Type guard for checking if a value is a date\n * @param value Value to check\n * @returns True if the value is a valid Date object\n */\nexport function isDate(value: unknown): value is Date {\n\treturn value instanceof Date && !isNaN(value.getTime())\n}\n\n/**\n * Type guard for checking if a value is an iterable collection\n * @param value Value to check\n * @returns True if the value implements the iterable protocol\n */\nexport function isIterable<T = unknown>(value: unknown): value is Iterable<T> {\n\t// Must be non-null and of type 'object'\n\tif (value == null || typeof value !== 'object') {\n\t\treturn false\n\t}\n\n\t// Check for Symbol.iterator method\n\treturn Symbol.iterator in Object(value) && typeof (value as any)[Symbol.iterator] === 'function'\n}\n\n/**\n * Type guard for checking if a value is a Map\n * @param value Value to check\n * @returns True if the value is a Map\n */\nexport function isMap<K = unknown, V = unknown>(value: unknown): value is Map<K, V> {\n\treturn value instanceof Map\n}\n\n/**\n * Type guard for checking if a value is a Set\n * @param value Value to check\n * @returns True if the value is a Set\n */\nexport function isSet<T = unknown>(value: unknown): value is Set<T> {\n\treturn value instanceof Set\n}\n\n/**\n * Type guard for checking if a value is a plain object (not an array, Map, etc.)\n * @param value Value to check\n * @returns True if the value is a plain object\n */\nexport function isPlainObject(value: unknown): value is Record<string, unknown> {\n\tif (value === null || typeof value !== 'object') {\n\t\treturn false\n\t}\n\n\tconst proto = Object.getPrototypeOf(value)\n\treturn proto === Object.prototype || proto === null\n}\n\n/**\n * Type guard for checking if a value is undefined or null\n * @param value Value to check\n * @returns True if the value is undefined or null\n */\nexport function isNil(value: unknown): value is undefined | null {\n\treturn value === undefined || value === null\n}\n\n/**\n * Improved type-safe comparison function that uses appropriate type guards\n * @param op Comparison operator\n * @param actual Actual value\n * @param expected Expected value\n * @returns Result of the comparison\n */\nexport function compareValues(op: ComparisonOperator, actual: unknown, expected: unknown): boolean {\n\t// Handle null/undefined cases\n\tif (isNil(actual) && isNil(expected)) return true\n\tif (isNil(actual) || isNil(expected)) {\n\t\t// For equality operators, null == null but null != non-null\n\t\tif (op === '==') return actual === expected\n\t\tif (op === '!=') return actual !== expected\n\t\t// Other operators should return false for null/undefined values\n\t\treturn false\n\t}\n\n\tswitch (op) {\n\t\tcase '==':\n\t\t\treturn actual === expected\n\t\tcase '!=':\n\t\t\treturn actual !== expected\n\t\tcase '>':\n\t\t\tif (isNumber(actual) && isNumber(expected)) {\n\t\t\t\treturn actual > expected\n\t\t\t}\n\t\t\tif (isDate(actual) && isDate(expected)) {\n\t\t\t\treturn actual.getTime() > expected.getTime()\n\t\t\t}\n\t\t\tif (isString(actual) && isString(expected)) {\n\t\t\t\treturn actual.localeCompare(expected) > 0\n\t\t\t}\n\t\t\treturn false\n\t\tcase '<':\n\t\t\tif (isNumber(actual) && isNumber(expected)) {\n\t\t\t\treturn actual < expected\n\t\t\t}\n\t\t\tif (isDate(actual) && isDate(expected)) {\n\t\t\t\treturn actual.getTime() < expected.getTime()\n\t\t\t}\n\t\t\tif (isString(actual) && isString(expected)) {\n\t\t\t\treturn actual.localeCompare(expected) < 0\n\t\t\t}\n\t\t\treturn false\n\t\tcase '>=':\n\t\t\tif (isNumber(actual) && isNumber(expected)) {\n\t\t\t\treturn actual >= expected\n\t\t\t}\n\t\t\tif (isDate(actual) && isDate(expected)) {\n\t\t\t\treturn actual.getTime() >= expected.getTime()\n\t\t\t}\n\t\t\tif (isString(actual) && isString(expected)) {\n\t\t\t\treturn actual.localeCompare(expected) >= 0\n\t\t\t}\n\t\t\treturn false\n\t\tcase '<=':\n\t\t\tif (isNumber(actual) && isNumber(expected)) {\n\t\t\t\treturn actual <= expected\n\t\t\t}\n\t\t\tif (isDate(actual) && isDate(expected)) {\n\t\t\t\treturn actual.getTime() <= expected.getTime()\n\t\t\t}\n\t\t\tif (isString(actual) && isString(expected)) {\n\t\t\t\treturn actual.localeCompare(expected) <= 0\n\t\t\t}\n\t\t\treturn false\n\t\tcase 'includes': {\n\t\t\tif (isString(actual)) {\n\t\t\t\treturn actual.toLowerCase().includes(safeString(expected).toLowerCase())\n\t\t\t}\n\t\t\tif (isArray(actual)) {\n\t\t\t\treturn actual.includes(expected as any)\n\t\t\t}\n\t\t\tif (isSet(actual)) {\n\t\t\t\treturn actual.has(expected as any)\n\t\t\t}\n\t\t\tif (isMap(actual)) {\n\t\t\t\treturn Array.from(actual.values()).includes(expected as any)\n\t\t\t}\n\t\t\treturn false\n\t\t}\n\t\tcase 'notIncludes': {\n\t\t\tif (isString(actual)) {\n\t\t\t\treturn !actual.toLowerCase().includes(safeString(expected).toLowerCase())\n\t\t\t}\n\t\t\tif (isArray(actual)) {\n\t\t\t\treturn !actual.includes(expected as any)\n\t\t\t}\n\t\t\tif (isSet(actual)) {\n\t\t\t\treturn !actual.has(expected as any)\n\t\t\t}\n\t\t\tif (isMap(actual)) {\n\t\t\t\treturn !Array.from(actual.values()).includes(expected as any)\n\t\t\t}\n\t\t\treturn true\n\t\t}\n\t\tcase 'startsWith': {\n\t\t\tif (isString(actual) && isString(expected)) {\n\t\t\t\treturn actual.toLowerCase().startsWith(expected.toLowerCase())\n\t\t\t}\n\t\t\treturn false\n\t\t}\n\t\tcase 'endsWith': {\n\t\t\tif (isString(actual) && isString(expected)) {\n\t\t\t\treturn actual.toLowerCase().endsWith(expected.toLowerCase())\n\t\t\t}\n\t\t\treturn false\n\t\t}\n\t\tcase 'in': {\n\t\t\tif (isArray(expected)) {\n\t\t\t\treturn expected.includes(actual as any)\n\t\t\t}\n\t\t\tif (isSet(expected)) {\n\t\t\t\treturn expected.has(actual as any)\n\t\t\t}\n\t\t\tif (isMap(expected)) {\n\t\t\t\treturn expected.has(actual as any) || Array.from(expected.values()).includes(actual as any)\n\t\t\t}\n\t\t\treturn false\n\t\t}\n\t\tcase 'notIn': {\n\t\t\tif (isArray(expected)) {\n\t\t\t\treturn !expected.includes(actual as any)\n\t\t\t}\n\t\t\tif (isSet(expected)) {\n\t\t\t\treturn !expected.has(actual as any)\n\t\t\t}\n\t\t\tif (isMap(expected)) {\n\t\t\t\treturn !expected.has(actual as any) && !Array.from(expected.values()).includes(actual as any)\n\t\t\t}\n\t\t\treturn true\n\t\t}\n\t\tdefault: {\n\t\t\tconsole.warn(`Operator \"${op}\" is not supported in comparison.`)\n\t\t\treturn false\n\t\t}\n\t}\n}\n\n// Export a simpler alias for filterMapItems\nexport const filterMap = filterMapItems\n\n// Export an alias for filterArrayItems\nexport const filterArray = filterArrayItems\n","// src/store/selectors.ts\nimport { BehaviorSubject, Observable, combineLatest, distinctUntilChanged, map, share, shareReplay } from 'rxjs'\nimport { ICollectionStore, IStore } from './types'\n\n/**\n * Deep equality comparison for maps and complex objects\n * More efficient than JSON.stringify for large objects\n */\nfunction deepEqual(a: unknown, b: unknown): boolean {\n\tif (a === b) return true\n\n\tif (a instanceof Map && b instanceof Map) {\n\t\tif (a.size !== b.size) return false\n\t\tfor (const [key, value] of a) {\n\t\t\tif (!b.has(key) || !deepEqual(value, b.get(key))) return false\n\t\t}\n\t\treturn true\n\t}\n\n\tif (a instanceof Set && b instanceof Set) {\n\t\tif (a.size !== b.size) return false\n\t\tfor (const item of a) {\n\t\t\tif (!b.has(item)) return false\n\t\t}\n\t\treturn true\n\t}\n\n\tif (typeof a === 'object' && a !== null && typeof b === 'object' && b !== null) {\n\t\tconst keysA = Object.keys(a)\n\t\tconst keysB = Object.keys(b)\n\n\t\tif (keysA.length !== keysB.length) return false\n\n\t\tfor (const key of keysA) {\n\t\t\t// @ts-ignore: Index signature\n\t\t\tif (!deepEqual(a[key], b[key])) return false\n\t\t}\n\n\t\treturn true\n\t}\n\n\treturn false\n}\n\n/**\n * Creates a selector that derives a value from store state\n *\n * @param store The store to observe\n * @param selectorFn Function that transforms the state\n * @returns An observable of the selected state that only emits when the derived value changes\n */\nexport function createSelector<T, R>(store: IStore<T>, selectorFn: (state: T) => R): Observable<R> {\n\treturn store.$.pipe(map(selectorFn), distinctUntilChanged<R>(deepEqual), shareReplay(1))\n}\n\n/**\n * Creates a selector for collection stores that derives a value from the collection\n *\n * @param store The collection store to observe\n * @param selectorFn Function that transforms the collection\n * @returns An observable of the selected state that only emits when the derived value changes\n */\nexport function createCollectionSelector<T, R>(\n\tstore: ICollectionStore<T>,\n\tselectorFn: (state: Map<string, T>) => R,\n): Observable<R> {\n\treturn store.$.pipe(map(selectorFn), distinctUntilChanged<R>(deepEqual), shareReplay(1))\n}\n\n/**\n * Creates a selector that returns all items from a collection as an array\n *\n * @param store The collection store\n * @returns An observable of all items as an array\n */\nexport function createItemsSelector<T>(store: ICollectionStore<T>): Observable<T[]> {\n\treturn createCollectionSelector(store, collection => Array.from(collection.values()))\n}\n\n/**\n * Creates a selector that retrieves a single item from a collection\n *\n * @param store The collection store\n * @param itemKey The key of the item to select\n * @returns An observable of the selected item that emits when the item changes\n */\nexport function createItemSelector<T>(store: ICollectionStore<T>, itemKey: string): Observable<T | undefined> {\n\treturn createCollectionSelector(store, collection => collection.get(itemKey))\n}\n\nexport function createCompoundSelector<R>(\n\tstores: Array<IStore<any> | ICollectionStore<any>>,\n\tselectorFns: Array<(state: any) => any>,\n\tcombinerFn: (...values: any[]) => R,\n): Partial<IStore<R>> {\n\t// Create observables for each store\n\tconst observables = stores.map((store, index) => {\n\t\tconst selectorFn = selectorFns[index]\n\n\t\t// Check if it's a collection store\n\t\tif ('set' in store && typeof store.set === 'function' && store.value instanceof Map) {\n\t\t\treturn createCollectionSelector(store as ICollectionStore<any>, selectorFn)\n\t\t} else {\n\t\t\treturn createSelector(store as IStore<any>, selectorFn)\n\t\t}\n\t})\n\n\t// Combine the observables\n\tconst observable = combineLatest(observables).pipe(\n\t\tmap(values => combinerFn(...values)),\n\t\tdistinctUntilChanged(deepEqual),\n\t\tshareReplay(1),\n\t)\n\n\t// Compute initial value from source stores\n\tconst initialValues = stores.map((store, index) => selectorFns[index](store.value))\n\n\tconst initialValue = combinerFn(...initialValues)\n\n\t// Create BehaviorSubject with initial value\n\tconst behaviorSubject = new BehaviorSubject<R>(initialValue)\n\n\t// Subscribe to updates\n\tobservable.subscribe(value => behaviorSubject.next(value as R))\n\n\t// Return minimal store-compatible object\n\treturn {\n\t\t$: behaviorSubject,\n\t\tget value() {\n\t\t\treturn behaviorSubject.getValue()\n\t\t},\n\t\tready: true,\n\t}\n}\n/**\n * Creates a selector that returns all keys from a collection\n */\nexport function createKeysSelector<T>(store: ICollectionStore<T>): Observable<string[]> {\n\treturn createCollectionSelector(store, collection => Array.from(collection.keys()))\n}\n\n/**\n * Creates a selector that returns entries (key-value pairs) from a collection\n */\nexport function createEntriesSelector<T>(store: ICollectionStore<T>): Observable<[string, T][]> {\n\treturn createCollectionSelector(store, collection => Array.from(collection.entries()))\n}\n\n/**\n * Creates a selector that sorts collection items\n */\nexport function createSortSelector<T>(store: ICollectionStore<T>, compareFn: (a: T, b: T) => number): Observable<T[]> {\n\treturn createCollectionSelector(store, collection => {\n\t\treturn Array.from(collection.values()).sort(compareFn)\n\t})\n}\n\n/**\n * Creates a selector that finds the first item matching a predicate\n */\nexport function createFindSelector<T>(\n\tstore: ICollectionStore<T>,\n\tpredicate: (item: T, key: string) => boolean,\n): Observable<T | undefined> {\n\treturn createCollectionSelector(store, collection => {\n\t\tfor (const [key, item] of collection.entries()) {\n\t\t\tif (predicate(item, key)) {\n\t\t\t\treturn item\n\t\t\t}\n\t\t}\n\t\treturn undefined\n\t})\n}\n\n/**\n * Creates a selector that filters items from a collection - OPTIMIZED\n *\n * @param store The collection store\n * @param filterFn Function that returns true for items to include\n * @returns An observable of filtered items as an array\n */\nexport function createFilterSelector<T>(\n\tstore: ICollectionStore<T>,\n\tfilterFn: (item: T, key: string) => boolean,\n): Observable<T[]> {\n\treturn createCollectionSelector(store, collection =>\n\t\tArray.from(collection.entries())\n\t\t\t.filter(([key, item]) => filterFn(item, key))\n\t\t\t.map(([_, item]) => item),\n\t)\n}\n\n/**\n * Creates a selector that maps collection values through a transform function - OPTIMIZED\n */\nexport function createMapSelector<T, R>(\n\tstore: ICollectionStore<T>,\n\tmapFn: (item: T, key: string) => R,\n): Observable<R[]> {\n\treturn createCollectionSelector(store, collection =>\n\t\tArray.from(collection.entries()).map(([key, item]) => mapFn(item, key)),\n\t)\n}\n\n/**\n * Creates a selector that counts items in a collection, optionally filtered - OPTIMIZED\n *\n * @param store The collection store\n * @param filterFn Optional function to filter which items to count\n * @returns An observable of the count\n */\nexport function createCountSelector<T>(\n\tstore: ICollectionStore<T>,\n\tfilterFn?: (item: T, key: string) => boolean,\n): Observable<number> {\n\treturn createCollectionSelector(store, collection => {\n\t\tif (!filterFn) return collection.size\n\n\t\treturn Array.from(collection.entries()).filter(([key, item]) => filterFn(item, key)).length\n\t})\n}\n\n/**\n * Optimized RxJS Pipeline - use share with reset on refCount zero for better memory management\n * in scenarios where selector subscriptions come and go\n *\n * @param store The store to observe\n * @param selectorFn Function that transforms the state\n * @returns An observable of the selected state with improved memory management\n */\nexport function createOptimizedSelector<T, R>(store: IStore<T>, selectorFn: (state: T) => R): Observable<R> {\n\treturn store.$.pipe(\n\t\tmap(selectorFn),\n\t\tdistinctUntilChanged<R>(deepEqual),\n\t\tshare({\n\t\t\tresetOnRefCountZero: true,\n\t\t\tresetOnError: false,\n\t\t\tresetOnComplete: false,\n\t\t}),\n\t)\n}\n","// src/store/selector-hook.ts - Improved memory management\nimport { property as litProperty } from 'lit/decorators.js'\nimport { Observable, Subject, Subscription } from 'rxjs'\nimport { takeUntil } from 'rxjs/operators'\nimport { createCollectionSelector, createSelector } from './selectors'\nimport { ICollectionStore, IStore } from './types'\n\n/**\n * Symbol used for storing cleanup resources\n * Using a Symbol prevents name collisions with component properties\n */\nconst CLEANUP_SUBJECT = Symbol('selectorCleanup')\nconst SUBSCRIPTIONS = Symbol('selectorSubscriptions')\nconst INITIALIZED = Symbol('selectorInitialized')\n\n/**\n * Component lifecycle interface\n */\ninterface ComponentWithLifecycle {\n\t// Lifecycle hooks\n\tisConnected: boolean\n\tdisconnectedCallback?: () => void\n\tconnectedCallback?: () => void\n\trequestUpdate?: () => void\n\n\t// Internal properties using symbols to avoid name collisions\n\t[CLEANUP_SUBJECT]?: Subject<void>\n\t[SUBSCRIPTIONS]?: Map<string, Subscription>\n\t[INITIALIZED]?: Set<string>\n\n\t// Value storage\n\t[key: string]: any\n}\n\n/**\n * Property descriptor interface\n */\ntype PropertyDescriptor<T> = {\n\tget?: () => T\n\tset?: (value: T) => void\n\tvalue?: T\n\tconfigurable?: boolean\n\tenumerable?: boolean\n\twritable?: boolean\n}\n\n/**\n * Options for selecting from a store\n */\ninterface SelectOptions {\n\t/** If true, will wait for selector to emit a non-null value before calling connectedCallback */\n\trequired?: boolean\n\n\t/** If true, will only update the component and not set the property value */\n\tupdateOnly?: boolean\n\n\t/** If true, will use structuredClone to deeply clone values (prevents mutations) */\n\tdeepClone?: boolean\n\n\t/** Custom equality function to determine when to update */\n\tequals?: (a: any, b: any) => boolean\n\n\t/** Debug mode - logs selector activity */\n\tdebug?: boolean\n}\n\n/**\n * Type guard to check if a store is a collection store\n */\nfunction isCollectionStore<T>(store: IStore<any> | ICollectionStore<T>): store is ICollectionStore<T> {\n\treturn 'set' in store && typeof store.set === 'function' && store.value instanceof Map\n}\n\n/**\n * Ensures the cleanup resources exist on the component\n */\nfunction ensureCleanupResources(component: ComponentWithLifecycle): void {\n\tif (!component[CLEANUP_SUBJECT] || component[CLEANUP_SUBJECT].closed) {\n\t\tcomponent[CLEANUP_SUBJECT] = new Subject<void>()\n\t}\n\n\tif (!component[SUBSCRIPTIONS]) {\n\t\tcomponent[SUBSCRIPTIONS] = new Map()\n\t}\n\n\tif (!component[INITIALIZED]) {\n\t\tcomponent[INITIALIZED] = new Set()\n\t}\n}\n\n/**\n * Cleans up all selector resources\n */\nfunction cleanupSelectorResources(component: ComponentWithLifecycle): void {\n\tif (component[CLEANUP_SUBJECT]) {\n\t\tcomponent[CLEANUP_SUBJECT].next()\n\t\tcomponent[CLEANUP_SUBJECT].complete()\n\t\tcomponent[CLEANUP_SUBJECT] = undefined\n\t}\n\n\tif (component[SUBSCRIPTIONS]) {\n\t\tcomponent[SUBSCRIPTIONS].forEach(sub => sub.unsubscribe())\n\t\tcomponent[SUBSCRIPTIONS].clear()\n\t\tcomponent[SUBSCRIPTIONS] = undefined\n\t}\n\n\tif (component[INITIALIZED]) {\n\t\tcomponent[INITIALIZED].clear()\n\t\tcomponent[INITIALIZED] = undefined\n\t}\n}\n\n/**\n * Selector decorator that connects a component property to a store selector\n * with improved memory management\n *\n * @param store The store to select from\n * @param selectorFn Optional function to transform the store state\n * @param options Additional options for the selector\n */\nexport function select<T, R>(\n\tstore: IStore<T> | ICollectionStore<T>,\n\tselectorFn: (state: any) => R = (state: R) => state,\n\toptions: SelectOptions = {},\n) {\n\treturn function (proto: Record<string, any>, propName: string, _descriptor?: PropertyDescriptor<R>) {\n\t\t// Register as a Lit property\n\t\tlitProperty({ attribute: false, type: Object })(proto, propName)\n\n\t\t// Store original lifecycle methods\n\t\tconst originalConnectedCallback = proto.connectedCallback\n\t\tconst originalDisconnectedCallback = proto.disconnectedCallback\n\n\t\t// Override connectedCallback to set up subscription\n\t\tproto.connectedCallback = function (this: ComponentWithLifecycle) {\n\t\t\t// Initialize cleanup resources\n\t\t\tensureCleanupResources(this)\n\n\t\t\t// Create the appropriate selector\n\t\t\tconst selector: Observable<R> = isCollectionStore(store)\n\t\t\t\t? createCollectionSelector(store, selectorFn)\n\t\t\t\t: createSelector(store as IStore<T>, selectorFn)\n\n\t\t\t// Call original connectedCallback immediately if not waiting for data\n\t\t\tif (!options.required && !this[INITIALIZED]!.has(propName)) {\n\t\t\t\toriginalConnectedCallback?.call(this)\n\t\t\t\tthis[INITIALIZED]!.add(propName)\n\t\t\t}\n\n\t\t\t// Clean up any existing subscription\n\t\t\tif (this[SUBSCRIPTIONS]!.has(propName)) {\n\t\t\t\tthis[SUBSCRIPTIONS]!.get(propName)?.unsubscribe()\n\t\t\t\tthis[SUBSCRIPTIONS]!.delete(propName)\n\t\t\t}\n\n\t\t\t// Debug log if needed\n\t\t\tif (options.debug) {\n\t\t\t\tconsole.debug(`[select] Setting up subscription for ${propName}`)\n\t\t\t}\n\n\t\t\t// Create new subscription with better error handling\n\t\t\tconst subscription = selector.pipe(takeUntil(this[CLEANUP_SUBJECT]!)).subscribe({\n\t\t\t\tnext: (value: R) => {\n\t\t\t\t\t// Handle value updates\n\t\t\t\t\tconst newValue = options.deepClone ? structuredClone(value) : value\n\n\t\t\t\t\tif (options.debug) {\n\t\t\t\t\t\tconsole.debug(`[select] New value for ${propName}:`, newValue)\n\t\t\t\t\t}\n\n\t\t\t\t\tif (!options.updateOnly) {\n\t\t\t\t\t\tthis[propName] = newValue\n\t\t\t\t\t}\n\n\t\t\t\t\tthis.requestUpdate?.()\n\n\t\t\t\t\t// If required and not initialized, call connectedCallback when we get a value\n\t\t\t\t\tif (options.required && !this[INITIALIZED]!.has(propName) && newValue !== null && newValue !== undefined) {\n\t\t\t\t\t\tif (options.debug) {\n\t\t\t\t\t\t\tconsole.debug(`[select] Calling delayed connectedCallback for ${propName}`)\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\toriginalConnectedCallback?.call(this)\n\t\t\t\t\t\tthis[INITIALIZED]!.add(propName)\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\terror: (err: Error) => {\n\t\t\t\t\tconsole.error(`Error in selector subscription for ${propName}:`, err)\n\t\t\t\t\t// Resubscribe on error to prevent component from becoming unresponsive\n\t\t\t\t\tif (this.isConnected) {\n\t\t\t\t\t\t// Small delay to prevent immediate resubscription\n\t\t\t\t\t\tsetTimeout(() => {\n\t\t\t\t\t\t\tif (this.isConnected) {\n\t\t\t\t\t\t\t\tif (options.debug) {\n\t\t\t\t\t\t\t\t\tconsole.debug(`[select] Resubscribing after error for ${propName}`)\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tthis.connectedCallback?.()\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}, 1000)\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t})\n\n\t\t\t// Store the subscription for cleanup\n\t\t\tthis[SUBSCRIPTIONS]!.set(propName, subscription)\n\t\t}\n\n\t\t// Override disconnectedCallback to clean up subscriptions\n\t\tproto.disconnectedCallback = function (this: ComponentWithLifecycle) {\n\t\t\t// Call original disconnectedCallback\n\t\t\toriginalDisconnectedCallback?.call(this)\n\n\t\t\t// Debug log if needed\n\t\t\tif (options.debug) {\n\t\t\t\tconsole.debug(`[select] Cleaning up resources in disconnectedCallback`)\n\t\t\t}\n\n\t\t\t// Clean up all subscription resources\n\t\t\tcleanupSelectorResources(this)\n\t\t}\n\t}\n}\n\n/**\n * Creates a selector decorator that selects a specific item from a collection store\n * with improved memory management\n *\n * @param store The collection store\n * @param keyGetter Function that returns the key to select\n * @param options Additional options\n */\nexport function selectItem<T>(\n\tstore: ICollectionStore<T>,\n\tkeyGetter: (component: any) => string,\n\toptions: SelectOptions = {},\n) {\n\treturn function (proto: Record<string, any>, propName: string, _descriptor?: PropertyDescriptor<T | undefined>) {\n\t\tselect(\n\t\t\tstore,\n\t\t\tfunction (state) {\n\t\t\t\t// This will be evaluated during subscription, when 'this' is available\n\t\t\t\tconst itemKey = keyGetter(this)\n\t\t\t\treturn itemKey ? state.get(itemKey) : undefined\n\t\t\t},\n\t\t\toptions,\n\t\t)(proto, propName)\n\t}\n}\n"],"names":["createObjectStore","initialData","storage","key","value","Array","isArray","Map","Set","Date","RegExp","Object","getPrototypeOf","prototype","store","SchmancyStoreObject","getInstance","obj","keys","length","set","createArrayStore","SchmancyArrayStore","replace","err","createContext","includes","SchmancyCollectionStore","size","error","getFieldValue","item","path","parts","split","part","getBigrams","s","bigrams","i","push","substring","toLowerCase","computeFuzzyScore","actual","expected","a","trim","b","substringScore","subsequenceScore","sub","str","j","anagramScore","query","target","countChars","reduce","acc","char","queryCount","targetCount","every","diceScore","s1","s2","bigrams1","bigrams2","intersection","used","fill","bigram","maxLen","Math","max","levenshteinScore","matrix","map","_","charAt","min","safeString","String","applyQueryCondition","fuzzyThreshold","field","op","strict","operator","valid","score","matches","compareValues","filterMapItems","items","queries","from","values","scoredItems","entries","totalScore","matchCount","result","sort","x","filterArrayItems","forEach","index","isString","isNumber","isNaN","isDate","getTime","isMap","isSet","isNil","t","localeCompare","has","startsWith","endsWith","filterMap","filterArray","deepEqual","get","keysA","keysB","createSelector","selectorFn","$","pipe","distinctUntilChanged","shareReplay","createCollectionSelector","CLEANUP_SUBJECT","Symbol","SUBSCRIPTIONS","INITIALIZED","select","state","options","proto","propName","_descriptor","litProperty","attribute","type","originalConnectedCallback","connectedCallback","originalDisconnectedCallback","disconnectedCallback","component","this","closed","Subject","selector","required","call","add","unsubscribe","delete","debug","subscription","takeUntil","subscribe","next","newValue","deepClone","structuredClone","updateOnly","requestUpdate","isConnected","setTimeout","complete","clear","stores","selectorFns","combinerFn","observables","observable","combineLatest","initialValues","initialValue","behaviorSubject","BehaviorSubject","getValue","ready","filterFn","collection","filter","predicate","itemKey","mapFn","share","resetOnRefCountZero","resetOnError","resetOnComplete","compareFn","iterator","keyGetter"],"mappings":"yIAkDA,EAAA,SAASA,EACRC,EACAC,EACAC,EAAAA,CAEI,GAEa,CAAZD,IAAY,cAELA,EAAA,WAzBUE,EA6BFH,KA3BT,MACHG,OAAAA,GAAU,UAChBC,MAAMC,QAAQF,CACbA,GAAAA,aAAiBG,KACjBH,aAAiBI,KACjBJ,aAAiBK,MACjBL,aAAiBM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AAVA,GAAU,UAK/BoI,OAAO+D,YAAY5L,OAAOP,CAAqD,GAAA,OAAnCA,EAAcoI,OAAO+D,QACzE,GADuF,UACvF,2EAyBO,SAAuBnM,EAC7B,CAAA,GAAIA,IAAU,MAAeA,OAAAA,GAAU,SAC/B,MAAA,GAGF,MAAA0I,EAAQnI,OAAOC,eAAeR,CAC7B,EAAA,OAAA0I,IAAUnI,OAAOE,WAAaiI,IAAU,IAChD,yEEvNO,SACNhI,EACA0L,EACA3D,EAAyB,CAAA,EAElB,CAAA,OAAA,SAAUC,EAA4BC,EAAkBC,EAAAA,CAC9DL,EACC7H,EACA,SAAU8H,EAAAA,CAEH,MAAAoD,EAAUQ,EAAU/C,IAAAA,EAC1B,OAAOuC,EAAUpD,EAAMf,IAAImE,CAAW,EAAA,MACvC,EACAnD,CAAAA,EACCC,EAAOC,EACV,CACD"}
@@ -1,7 +1,7 @@
1
1
  import { e as E, S as q, a as N } from "./context-object-CISes2bD.js";
2
- import { property as G } from "lit/decorators.js";
3
- import { map as I, distinctUntilChanged as $, shareReplay as x, combineLatest as Z, share as H, Subject as J } from "rxjs";
4
- import { takeUntil as K } from "rxjs/operators";
2
+ import { property as V } from "lit/decorators.js";
3
+ import { map as $, distinctUntilChanged as x, shareReplay as I, combineLatest as Z, BehaviorSubject as H, share as J, Subject as K } from "rxjs";
4
+ import { takeUntil as Q } from "rxjs/operators";
5
5
  function W(n, e, t) {
6
6
  try {
7
7
  e === "indexeddb" && (e = "local"), ((o = n) === null || typeof o != "object" || Array.isArray(o) || o instanceof Map || o instanceof Set || o instanceof Date || o instanceof RegExp || Object.getPrototypeOf(o) !== Object.prototype) && (n = { ...n });
@@ -20,7 +20,7 @@ function z(n, e, t) {
20
20
  return q.getInstance("memory", `${t}-fallback`, [...n]);
21
21
  }
22
22
  }
23
- function B(n, e, t) {
23
+ function P(n, e, t) {
24
24
  try {
25
25
  return n == null && (n = t.includes("collection") || t.includes("map") ? /* @__PURE__ */ new Map() : t.includes("array") || t.includes("list") ? [] : {}), n instanceof Map ? function(r, o, c) {
26
26
  try {
@@ -36,21 +36,21 @@ function B(n, e, t) {
36
36
  return W(typeof n == "object" && n !== null ? { ...n } : { value: n }, "memory", `emergency-fallback-${t}`);
37
37
  }
38
38
  }
39
- function oe(n = [], e, t = "local") {
39
+ function se(n = [], e, t = "local") {
40
40
  try {
41
- return B(n, t, e);
41
+ return P(n, t, e);
42
42
  } catch {
43
43
  return z(n, "memory", `${e}-fallback`);
44
44
  }
45
45
  }
46
- function se(n = [], e = "test-array") {
46
+ function ae(n = [], e = "test-array") {
47
47
  try {
48
- return B(n, "memory", e);
48
+ return P(n, "memory", e);
49
49
  } catch {
50
50
  return z(n, "memory", `${e}-emergency-fallback`);
51
51
  }
52
52
  }
53
- const Q = (n, e) => {
53
+ const X = (n, e) => {
54
54
  if (!e) return n;
55
55
  const t = e.split(".");
56
56
  let r = n;
@@ -77,32 +77,32 @@ const Q = (n, e) => {
77
77
  })(r, t) ? 0.8 : 0, u = ((l, h) => {
78
78
  if (!l) return !0;
79
79
  if (!h) return !1;
80
- const i = (k) => k.toLowerCase().split("").reduce((O, b) => (O[b] = (O[b] || 0) + 1, O), {}), a = i(l), p = i(h);
81
- return Object.keys(a).every((k) => (p[k] || 0) >= a[k]);
80
+ const i = (j) => j.toLowerCase().split("").reduce((O, v) => (O[v] = (O[v] || 0) + 1, O), {}), a = i(l), p = i(h);
81
+ return Object.keys(a).every((j) => (p[j] || 0) >= a[j]);
82
82
  })(r, t) ? 0.7 : 0, f = ((l, h) => {
83
83
  if (!l || !h || l.length < 2 || h.length < 2) return 0;
84
84
  const i = D(l), a = D(h);
85
85
  if (i.length === 0 || a.length === 0) return 0;
86
86
  let p = 0;
87
- const k = new Array(a.length).fill(!1);
88
- for (const O of i) for (let b = 0; b < a.length; b++) if (!k[b] && a[b] === O) {
89
- p++, k[b] = !0;
87
+ const j = new Array(a.length).fill(!1);
88
+ for (const O of i) for (let v = 0; v < a.length; v++) if (!j[v] && a[v] === O) {
89
+ p++, j[v] = !0;
90
90
  break;
91
91
  }
92
92
  return 2 * p / (i.length + a.length);
93
- })(t, r), s = Math.max(t.length, r.length), w = s ? 1 - ((l, h) => {
93
+ })(t, r), s = Math.max(t.length, r.length), m = s ? 1 - ((l, h) => {
94
94
  if (l === h) return 0;
95
95
  const i = Array(h.length + 1).fill(null).map((a, p) => [p]);
96
96
  for (let a = 0; a <= l.length; a++) i[0][a] = a;
97
97
  for (let a = 1; a <= h.length; a++) for (let p = 1; p <= l.length; p++) h.charAt(a - 1) === l.charAt(p - 1) ? i[a][p] = i[a - 1][p - 1] : i[a][p] = Math.min(i[a - 1][p] + 1, i[a][p - 1] + 1, i[a - 1][p - 1] + 1);
98
98
  return i[h.length][l.length];
99
99
  })(t, r) / s : 0;
100
- return Math.max(o, c, u, f, w);
100
+ return Math.max(o, c, u, f, m);
101
101
  }, U = (n) => n == null ? "" : String(n);
102
- function V(n, e, t = 0.3) {
102
+ function Y(n, e, t = 0.3) {
103
103
  let r, o, c, u = !1;
104
- if (Array.isArray(e) ? [r, o, c, u = !1] = e : (r = e.key, o = e.operator, c = e.value, u = e.strict || !1), !u && (c === "" || c == null || L(c) && c.length === 0)) return { valid: !0, score: 1 };
105
- const f = Q(n, r);
104
+ if (Array.isArray(e) ? [r, o, c, u = !1] = e : (r = e.key, o = e.operator, c = e.value, u = e.strict || !1), !u && (c === "" || c == null || S(c) && c.length === 0)) return { valid: !0, score: 1 };
105
+ const f = X(n, r);
106
106
  if (u) {
107
107
  if (o === "any") {
108
108
  if (typeof f != "string" || typeof c != "string") return { valid: !1, score: 0 };
@@ -110,7 +110,7 @@ function V(n, e, t = 0.3) {
110
110
  return { valid: s >= t, score: s >= t ? s : 0 };
111
111
  }
112
112
  {
113
- const s = P(o, f, c);
113
+ const s = B(o, f, c);
114
114
  return { valid: s, score: s ? 1 : 0 };
115
115
  }
116
116
  }
@@ -120,7 +120,7 @@ function V(n, e, t = 0.3) {
120
120
  return s < t ? { valid: !1, score: 0 } : { valid: !0, score: s };
121
121
  }
122
122
  {
123
- const s = P(o, f, c);
123
+ const s = B(o, f, c);
124
124
  return { valid: s, score: s ? 1 : 0 };
125
125
  }
126
126
  }
@@ -129,8 +129,8 @@ function F(n, e = [], t = 0.3) {
129
129
  const r = [];
130
130
  for (const [o, c] of n.entries()) {
131
131
  let u = 0, f = 0, s = !0;
132
- for (const w of e) {
133
- const l = V(c, w, t);
132
+ for (const m of e) {
133
+ const l = Y(c, m, t);
134
134
  if (!l.valid) {
135
135
  s = !1;
136
136
  break;
@@ -141,32 +141,32 @@ function F(n, e = [], t = 0.3) {
141
141
  }
142
142
  return r.sort((o, c) => c.score - o.score), r.map((o) => o.item);
143
143
  }
144
- function X(n, e = [], t = 0.3) {
144
+ function _(n, e = [], t = 0.3) {
145
145
  const r = /* @__PURE__ */ new Map();
146
146
  return n.forEach((o, c) => r.set(String(c), o)), F(r, e, t);
147
147
  }
148
- function L(n) {
148
+ function S(n) {
149
149
  return Array.isArray(n);
150
150
  }
151
151
  function y(n) {
152
152
  return typeof n == "string";
153
153
  }
154
- function v(n) {
154
+ function C(n) {
155
155
  return typeof n == "number" && !isNaN(n);
156
156
  }
157
- function C(n) {
157
+ function w(n) {
158
158
  return n instanceof Date && !isNaN(n.getTime());
159
159
  }
160
- function ae(n) {
160
+ function ce(n) {
161
161
  return n != null && typeof n == "object" && Symbol.iterator in Object(n) && typeof n[Symbol.iterator] == "function";
162
162
  }
163
- function S(n) {
163
+ function L(n) {
164
164
  return n instanceof Map;
165
165
  }
166
166
  function M(n) {
167
167
  return n instanceof Set;
168
168
  }
169
- function ce(n) {
169
+ function ie(n) {
170
170
  if (n === null || typeof n != "object") return !1;
171
171
  const e = Object.getPrototypeOf(n);
172
172
  return e === Object.prototype || e === null;
@@ -174,7 +174,7 @@ function ce(n) {
174
174
  function T(n) {
175
175
  return n == null;
176
176
  }
177
- function P(n, e, t) {
177
+ function B(n, e, t) {
178
178
  if (T(e) && T(t)) return !0;
179
179
  if (T(e) || T(t)) return n === "==" ? e === t : n === "!=" && e !== t;
180
180
  switch (n) {
@@ -183,35 +183,35 @@ function P(n, e, t) {
183
183
  case "!=":
184
184
  return e !== t;
185
185
  case ">":
186
- return v(e) && v(t) ? e > t : C(e) && C(t) ? e.getTime() > t.getTime() : !(!y(e) || !y(t)) && e.localeCompare(t) > 0;
186
+ return C(e) && C(t) ? e > t : w(e) && w(t) ? e.getTime() > t.getTime() : !(!y(e) || !y(t)) && e.localeCompare(t) > 0;
187
187
  case "<":
188
- return v(e) && v(t) ? e < t : C(e) && C(t) ? e.getTime() < t.getTime() : !(!y(e) || !y(t)) && e.localeCompare(t) < 0;
188
+ return C(e) && C(t) ? e < t : w(e) && w(t) ? e.getTime() < t.getTime() : !(!y(e) || !y(t)) && e.localeCompare(t) < 0;
189
189
  case ">=":
190
- return v(e) && v(t) ? e >= t : C(e) && C(t) ? e.getTime() >= t.getTime() : !(!y(e) || !y(t)) && e.localeCompare(t) >= 0;
190
+ return C(e) && C(t) ? e >= t : w(e) && w(t) ? e.getTime() >= t.getTime() : !(!y(e) || !y(t)) && e.localeCompare(t) >= 0;
191
191
  case "<=":
192
- return v(e) && v(t) ? e <= t : C(e) && C(t) ? e.getTime() <= t.getTime() : !(!y(e) || !y(t)) && e.localeCompare(t) <= 0;
192
+ return C(e) && C(t) ? e <= t : w(e) && w(t) ? e.getTime() <= t.getTime() : !(!y(e) || !y(t)) && e.localeCompare(t) <= 0;
193
193
  case "includes":
194
- return y(e) ? e.toLowerCase().includes(U(t).toLowerCase()) : L(e) ? e.includes(t) : M(e) ? e.has(t) : !!S(e) && Array.from(e.values()).includes(t);
194
+ return y(e) ? e.toLowerCase().includes(U(t).toLowerCase()) : S(e) ? e.includes(t) : M(e) ? e.has(t) : !!L(e) && Array.from(e.values()).includes(t);
195
195
  case "notIncludes":
196
- return y(e) ? !e.toLowerCase().includes(U(t).toLowerCase()) : L(e) ? !e.includes(t) : M(e) ? !e.has(t) : !S(e) || !Array.from(e.values()).includes(t);
196
+ return y(e) ? !e.toLowerCase().includes(U(t).toLowerCase()) : S(e) ? !e.includes(t) : M(e) ? !e.has(t) : !L(e) || !Array.from(e.values()).includes(t);
197
197
  case "startsWith":
198
198
  return !(!y(e) || !y(t)) && e.toLowerCase().startsWith(t.toLowerCase());
199
199
  case "endsWith":
200
200
  return !(!y(e) || !y(t)) && e.toLowerCase().endsWith(t.toLowerCase());
201
201
  case "in":
202
- return L(t) ? t.includes(e) : M(t) ? t.has(e) : !!S(t) && (t.has(e) || Array.from(t.values()).includes(e));
202
+ return S(t) ? t.includes(e) : M(t) ? t.has(e) : !!L(t) && (t.has(e) || Array.from(t.values()).includes(e));
203
203
  case "notIn":
204
- return L(t) ? !t.includes(e) : M(t) ? !t.has(e) : !S(t) || !t.has(e) && !Array.from(t.values()).includes(e);
204
+ return S(t) ? !t.includes(e) : M(t) ? !t.has(e) : !L(t) || !t.has(e) && !Array.from(t.values()).includes(e);
205
205
  default:
206
206
  return !1;
207
207
  }
208
208
  }
209
- const ie = F, ue = X;
210
- function j(n, e) {
209
+ const ue = F, le = _;
210
+ function k(n, e) {
211
211
  if (n === e) return !0;
212
212
  if (n instanceof Map && e instanceof Map) {
213
213
  if (n.size !== e.size) return !1;
214
- for (const [t, r] of n) if (!e.has(t) || !j(r, e.get(t))) return !1;
214
+ for (const [t, r] of n) if (!e.has(t) || !k(r, e.get(t))) return !1;
215
215
  return !0;
216
216
  }
217
217
  if (n instanceof Set && e instanceof Set) {
@@ -222,123 +222,129 @@ function j(n, e) {
222
222
  if (typeof n == "object" && n !== null && typeof e == "object" && e !== null) {
223
223
  const t = Object.keys(n), r = Object.keys(e);
224
224
  if (t.length !== r.length) return !1;
225
- for (const o of t) if (!j(n[o], e[o])) return !1;
225
+ for (const o of t) if (!k(n[o], e[o])) return !1;
226
226
  return !0;
227
227
  }
228
228
  return !1;
229
229
  }
230
- function Y(n, e) {
231
- return n.$.pipe(I(e), $(j), x(1));
230
+ function G(n, e) {
231
+ return n.$.pipe($(e), x(k), I(1));
232
232
  }
233
- function d(n, e) {
234
- return n.$.pipe(I(e), $(j), x(1));
233
+ function g(n, e) {
234
+ return n.$.pipe($(e), x(k), I(1));
235
235
  }
236
- function le(n) {
237
- return d(n, (e) => Array.from(e.values()));
238
- }
239
- function fe(n, e) {
240
- return d(n, (t) => t.get(e));
236
+ function fe(n) {
237
+ return g(n, (e) => Array.from(e.values()));
241
238
  }
242
239
  function he(n, e) {
243
- return Z(n).pipe(I((t) => e(...t)), $(j), x(1));
240
+ return g(n, (t) => t.get(e));
244
241
  }
245
- function pe(n) {
246
- return d(n, (e) => Array.from(e.keys()));
242
+ function pe(n, e, t) {
243
+ const r = n.map((s, m) => {
244
+ const l = e[m];
245
+ return "set" in s && typeof s.set == "function" && s.value instanceof Map ? g(s, l) : G(s, l);
246
+ }), o = Z(r).pipe($((s) => t(...s)), x(k), I(1)), c = n.map((s, m) => e[m](s.value)), u = t(...c), f = new H(u);
247
+ return o.subscribe((s) => f.next(s)), { $: f, get value() {
248
+ return f.getValue();
249
+ }, ready: !0 };
247
250
  }
248
251
  function ye(n) {
249
- return d(n, (e) => Array.from(e.entries()));
252
+ return g(n, (e) => Array.from(e.keys()));
250
253
  }
251
- function me(n, e) {
252
- return d(n, (t) => Array.from(t.values()).sort(e));
254
+ function me(n) {
255
+ return g(n, (e) => Array.from(e.entries()));
256
+ }
257
+ function ge(n, e) {
258
+ return g(n, (t) => Array.from(t.values()).sort(e));
253
259
  }
254
260
  function de(n, e) {
255
- return d(n, (t) => {
261
+ return g(n, (t) => {
256
262
  for (const [r, o] of t.entries()) if (e(o, r)) return o;
257
263
  });
258
264
  }
259
- function ge(n, e) {
260
- return d(n, (t) => Array.from(t.entries()).filter(([r, o]) => e(o, r)).map(([r, o]) => o));
261
- }
262
265
  function be(n, e) {
263
- return d(n, (t) => Array.from(t.entries()).map(([r, o]) => e(o, r)));
266
+ return g(n, (t) => Array.from(t.entries()).filter(([r, o]) => e(o, r)).map(([r, o]) => o));
264
267
  }
265
268
  function ve(n, e) {
266
- return d(n, (t) => e ? Array.from(t.entries()).filter(([r, o]) => e(o, r)).length : t.size);
269
+ return g(n, (t) => Array.from(t.entries()).map(([r, o]) => e(o, r)));
267
270
  }
268
271
  function Ce(n, e) {
269
- return n.$.pipe(I(e), $(j), H({ resetOnRefCountZero: !0, resetOnError: !1, resetOnComplete: !1 }));
272
+ return g(n, (t) => e ? Array.from(t.entries()).filter(([r, o]) => e(o, r)).length : t.size);
273
+ }
274
+ function we(n, e) {
275
+ return n.$.pipe($(e), x(k), J({ resetOnRefCountZero: !0, resetOnError: !1, resetOnComplete: !1 }));
270
276
  }
271
- const A = Symbol("selectorCleanup"), m = Symbol("selectorSubscriptions"), g = Symbol("selectorInitialized");
272
- function _(n, e = (r) => r, t = {}) {
277
+ const A = Symbol("selectorCleanup"), d = Symbol("selectorSubscriptions"), b = Symbol("selectorInitialized");
278
+ function ee(n, e = (r) => r, t = {}) {
273
279
  return function(r, o, c) {
274
- G({ attribute: !1, type: Object })(r, o);
280
+ V({ attribute: !1, type: Object })(r, o);
275
281
  const u = r.connectedCallback, f = r.disconnectedCallback;
276
282
  r.connectedCallback = function() {
277
283
  var h;
278
284
  var s;
279
- (s = this)[A] && !s[A].closed || (s[A] = new J()), s[m] || (s[m] = /* @__PURE__ */ new Map()), s[g] || (s[g] = /* @__PURE__ */ new Set());
280
- const w = function(i) {
285
+ (s = this)[A] && !s[A].closed || (s[A] = new K()), s[d] || (s[d] = /* @__PURE__ */ new Map()), s[b] || (s[b] = /* @__PURE__ */ new Set());
286
+ const m = function(i) {
281
287
  return "set" in i && typeof i.set == "function" && i.value instanceof Map;
282
- }(n) ? d(n, e) : Y(n, e);
283
- t.required || this[g].has(o) || (u == null || u.call(this), this[g].add(o)), this[m].has(o) && ((h = this[m].get(o)) == null || h.unsubscribe(), this[m].delete(o)), t.debug;
284
- const l = w.pipe(K(this[A])).subscribe({ next: (i) => {
288
+ }(n) ? g(n, e) : G(n, e);
289
+ t.required || this[b].has(o) || (u == null || u.call(this), this[b].add(o)), this[d].has(o) && ((h = this[d].get(o)) == null || h.unsubscribe(), this[d].delete(o)), t.debug;
290
+ const l = m.pipe(Q(this[A])).subscribe({ next: (i) => {
285
291
  var p;
286
292
  const a = t.deepClone ? structuredClone(i) : i;
287
- t.debug, t.updateOnly || (this[o] = a), (p = this.requestUpdate) == null || p.call(this), t.required && !this[g].has(o) && a != null && (t.debug, u == null || u.call(this), this[g].add(o));
293
+ t.debug, t.updateOnly || (this[o] = a), (p = this.requestUpdate) == null || p.call(this), t.required && !this[b].has(o) && a != null && (t.debug, u == null || u.call(this), this[b].add(o));
288
294
  }, error: (i) => {
289
295
  this.isConnected && setTimeout(() => {
290
296
  var a;
291
297
  this.isConnected && (t.debug, (a = this.connectedCallback) == null || a.call(this));
292
298
  }, 1e3);
293
299
  } });
294
- this[m].set(o, l);
300
+ this[d].set(o, l);
295
301
  }, r.disconnectedCallback = function() {
296
302
  var s;
297
- f == null || f.call(this), t.debug, (s = this)[A] && (s[A].next(), s[A].complete(), s[A] = void 0), s[m] && (s[m].forEach((w) => w.unsubscribe()), s[m].clear(), s[m] = void 0), s[g] && (s[g].clear(), s[g] = void 0);
303
+ f == null || f.call(this), t.debug, (s = this)[A] && (s[A].next(), s[A].complete(), s[A] = void 0), s[d] && (s[d].forEach((m) => m.unsubscribe()), s[d].clear(), s[d] = void 0), s[b] && (s[b].clear(), s[b] = void 0);
298
304
  };
299
305
  };
300
306
  }
301
307
  function Ae(n, e, t = {}) {
302
308
  return function(r, o, c) {
303
- _(n, function(u) {
309
+ ee(n, function(u) {
304
310
  const f = e(this);
305
311
  return f ? u.get(f) : void 0;
306
312
  }, t)(r, o);
307
313
  };
308
314
  }
309
315
  export {
310
- ye as A,
311
- me as B,
316
+ me as A,
317
+ ge as B,
312
318
  de as C,
313
- ge as D,
314
- be as E,
315
- ve as F,
316
- Ce as G,
317
- oe as a,
318
- se as b,
319
- B as c,
320
- X as d,
319
+ be as D,
320
+ ve as E,
321
+ Ce as F,
322
+ we as G,
323
+ se as a,
324
+ ae as b,
325
+ P as c,
326
+ _ as d,
321
327
  y as e,
322
328
  F as f,
323
- Q as g,
324
- v as h,
325
- L as i,
326
- C as j,
327
- ae as k,
328
- S as l,
329
+ X as g,
330
+ C as h,
331
+ S as i,
332
+ w as j,
333
+ ce as k,
334
+ L as l,
329
335
  M as m,
330
- ce as n,
336
+ ie as n,
331
337
  T as o,
332
- P as p,
333
- ie as q,
334
- ue as r,
335
- _ as s,
338
+ B as p,
339
+ ue as q,
340
+ le as r,
341
+ ee as s,
336
342
  Ae as t,
337
- Y as u,
338
- d as v,
339
- le as w,
340
- fe as x,
341
- he as y,
342
- pe as z
343
+ G as u,
344
+ g as v,
345
+ fe as w,
346
+ he as x,
347
+ pe as y,
348
+ ye as z
343
349
  };
344
- //# sourceMappingURL=selector-hook-D_HTD-GV.js.map
350
+ //# sourceMappingURL=selector-hook-DHPU6Z2H.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"selector-hook-DHPU6Z2H.js","sources":["../src/store/context-create.ts","../src/store/filter-directive.ts","../src/store/selectors.ts","../src/store/selector-hook.ts"],"sourcesContent":["// src/store/context-create.ts - Fixed version\n\nimport { SchmancyArrayStore } from './context-array'\nimport SchmancyCollectionStore from './context-collection'\nimport { SchmancyStoreObject } from './context-object'\nimport { IArrayStore, ICollectionStore, IStore, StorageType } from './types'\n\n/**\n * Type guard to check if an object is empty\n */\nfunction isEmptyObject(obj: unknown): boolean {\n\tif (typeof obj !== 'object' || obj === null) {\n\t\treturn false\n\t}\n\treturn Object.keys(obj).length === 0\n}\n\n/**\n * Type guard for Map objects\n */\nfunction isMap<K, V>(value: unknown): value is Map<K, V> {\n\treturn value instanceof Map\n}\n\n/**\n * Type guard for Array objects\n */\nfunction isArray<T>(value: unknown): value is Array<T> {\n\treturn Array.isArray(value)\n}\n\n/**\n * Type guard for plain objects (not arrays, maps, null, etc.)\n */\nfunction isPlainObject(value: unknown): boolean {\n\treturn (\n\t\tvalue !== null &&\n\t\ttypeof value === 'object' &&\n\t\t!Array.isArray(value) &&\n\t\t!(value instanceof Map) &&\n\t\t!(value instanceof Set) &&\n\t\t!(value instanceof Date) &&\n\t\t!(value instanceof RegExp) &&\n\t\tObject.getPrototypeOf(value) === Object.prototype\n\t)\n}\n\n/**\n * Creates a regular object store with better typing and error handling\n */\nfunction createObjectStore<T extends Record<string, any>>(\n\tinitialData: T,\n\tstorage: StorageType,\n\tkey: string,\n): IStore<T> & SchmancyStoreObject<T> {\n\ttry {\n\t\t// Validate storage type\n\t\tif (storage === 'indexeddb') {\n\t\t\tconsole.warn(`IndexedDB storage is not optimal for plain objects. Using 'local' instead for key: ${key}`)\n\t\t\tstorage = 'local'\n\t\t}\n\n\t\t// Ensure initialData is a plain object\n\t\tif (!isPlainObject(initialData)) {\n\t\t\tconsole.warn(`Initial data is not a plain object. Converting to object for key: ${key}`)\n\t\t\tinitialData = { ...initialData } as T\n\t\t}\n\n\t\t// Create the store instance\n\t\tconst store = SchmancyStoreObject.getInstance<T>(storage, key, initialData)\n\n\t\t// Initialize with provided data if store is empty\n\t\tif (isEmptyObject(store.value)) {\n\t\t\tstore.set({ ...initialData }) // Use spread to create a copy\n\t\t}\n\n\t\treturn store\n\t} catch (err) {\n\t\tconsole.error(`Failed to create object store for key: ${key}`, err)\n\t\t// Fall back to a basic implementation that won't throw\n\t\tconst fallbackStore = SchmancyStoreObject.getInstance<T>(\n\t\t\t'memory', // Fallback to memory storage\n\t\t\t`${key}-fallback`,\n\t\t\tinitialData,\n\t\t)\n\t\tconsole.warn(`Using fallback memory store for key: ${key}`)\n\t\treturn fallbackStore\n\t}\n}\n\n/**\n * Creates a collection store with better typing and error handling\n */\nfunction createCollectionStore<V>(\n\tinitialData: Map<string, V>,\n\tstorage: StorageType,\n\tkey: string,\n): ICollectionStore<V> & SchmancyCollectionStore<V> {\n\ttry {\n\t\t// Create the store instance\n\t\tconst store = SchmancyCollectionStore.getInstance(storage, key, initialData)\n\n\t\t// Initialize with provided data if store is empty\n\t\tif (!store.value.size) {\n\t\t\t// Create a new Map instance to avoid modifying the input\n\t\t\tstore.replace(new Map(initialData))\n\t\t}\n\n\t\treturn store\n\t} catch (err) {\n\t\tconsole.error(`Failed to create collection store for key: ${key}`, err)\n\t\t// Fall back to a basic implementation that won't throw\n\t\tconst fallbackStore = SchmancyCollectionStore.getInstance<V>(\n\t\t\t'memory', // Fallback to memory storage\n\t\t\t`${key}-fallback`,\n\t\t\tnew Map(initialData),\n\t\t)\n\t\tconsole.warn(`Using fallback memory store for key: ${key}`)\n\t\treturn fallbackStore\n\t}\n}\n\n/**\n * Creates an array store with better typing and error handling\n */\nfunction createArrayStore<T>(\n\tinitialData: T[],\n\tstorage: StorageType,\n\tkey: string,\n): IArrayStore<T> & SchmancyArrayStore<T> {\n\ttry {\n\t\t// Create the store instance\n\t\tconst store = SchmancyArrayStore.getInstance(storage, key, initialData)\n\n\t\t// Initialize with provided data if store is empty\n\t\tif (!store.value.length) {\n\t\t\t// Create a new array instance to avoid modifying the input\n\t\t\tstore.replace([...initialData])\n\t\t}\n\n\t\treturn store\n\t} catch (err) {\n\t\tconsole.error(`Failed to create array store for key: ${key}`, err)\n\t\t// Fall back to a basic implementation that won't throw\n\t\tconst fallbackStore = SchmancyArrayStore.getInstance<T>(\n\t\t\t'memory', // Fallback to memory storage\n\t\t\t`${key}-fallback`,\n\t\t\t[...initialData],\n\t\t)\n\t\tconsole.warn(`Using fallback memory store for key: ${key}`)\n\t\treturn fallbackStore\n\t}\n}\n\n// Function overloads for better type inference\n/**\n * Creates a context for managing object state\n * @param initialData The initial object data\n * @param storage Storage type to use\n * @param key Unique key for the store\n * @returns A store instance for the object\n */\nexport function createContext<T extends Record<string, any>>(\n\tinitialData: T,\n\tstorage: StorageType,\n\tkey: string,\n): IStore<T> & SchmancyStoreObject<T>\n\n/**\n * Creates a context for managing collection state\n * @param initialData The initial Map collection\n * @param storage Storage type to use\n * @param key Unique key for the store\n * @returns A collection store instance\n */\nexport function createContext<V>(\n\tinitialData: Map<string, V>,\n\tstorage: StorageType,\n\tkey: string,\n): ICollectionStore<V> & SchmancyCollectionStore<V>\n\n/**\n * Creates a context for managing array state\n * @param initialData The initial array\n * @param storage Storage type to use\n * @param key Unique key for the store\n * @returns An array store instance\n */\nexport function createContext<T>(\n\tinitialData: T[],\n\tstorage: StorageType,\n\tkey: string,\n): IArrayStore<T> & SchmancyArrayStore<T>\n\n/**\n * Implementation of the createContext function with complete type checking\n * and robust error handling\n */\nexport function createContext<T extends Record<string, any> | Map<string, any> | any[]>(\n\tinitialData: T,\n\tstorage: StorageType,\n\tkey: string,\n):\n\t| (IStore<T> & SchmancyStoreObject<T>)\n\t| (ICollectionStore<any> & SchmancyCollectionStore<any>)\n\t| (IArrayStore<any> & SchmancyArrayStore<any>) {\n\ttry {\n\t\t// Validate input\n\t\tif (initialData === null || initialData === undefined) {\n\t\t\tconsole.error('Initial data cannot be null or undefined')\n\t\t\t// Provide a sensible default based on type expected\n\t\t\tif (key.includes('collection') || key.includes('map')) {\n\t\t\t\tinitialData = new Map() as unknown as T\n\t\t\t} else if (key.includes('array') || key.includes('list')) {\n\t\t\t\tinitialData = [] as unknown as T\n\t\t\t} else {\n\t\t\t\tinitialData = {} as T\n\t\t\t}\n\t\t}\n\n\t\t// Determine store type based on input data with improved type checking\n\t\tif (isMap<string, any>(initialData)) {\n\t\t\treturn createCollectionStore<any>(initialData, storage, key)\n\t\t} else if (isArray<any>(initialData)) {\n\t\t\treturn createArrayStore<any>(initialData, storage, key)\n\t\t} else if (typeof initialData === 'object') {\n\t\t\treturn createObjectStore<any>(initialData as Record<string, any>, storage, key)\n\t\t} else {\n\t\t\t// Handle non-object data by wrapping it\n\t\t\tconsole.warn(`Initial data must be an object, array, or Map. Got ${typeof initialData}. Creating object wrapper.`)\n\t\t\treturn createObjectStore<any>({ value: initialData } as Record<string, any>, storage, key)\n\t\t}\n\t} catch (error) {\n\t\t// Last-resort error handling\n\t\tconsole.error(`Fatal error creating context for ${key}:`, error)\n\n\t\t// Create an emergency fallback store that won't throw\n\t\treturn createObjectStore<any>(\n\t\t\ttypeof initialData === 'object' && initialData !== null ? { ...initialData } : { value: initialData },\n\t\t\t'memory',\n\t\t\t`emergency-fallback-${key}`,\n\t\t)\n\t}\n}\n\n/**\n * Creates an array context with simplified API and type inference\n * @param initialData The initial array data\n * @param key Unique key for the store\n * @param storage Storage type to use (defaults to 'local')\n * @returns An array store instance\n */\nexport function createArrayContext<T>(\n\tinitialData: T[] = [],\n\tkey: string,\n\tstorage: StorageType = 'local',\n): IArrayStore<T> & SchmancyArrayStore<T> {\n\ttry {\n\t\treturn createContext<T>(initialData, storage, key)\n\t} catch (err) {\n\t\tconsole.error(`Failed to create array context for key: ${key}`, err)\n\t\t// Return a fallback store\n\t\treturn createArrayStore<T>(initialData, 'memory', `${key}-fallback`)\n\t}\n}\n\n/**\n * Creates a testable array context\n * @param initialData The initial array data\n * @param key Unique key for the store\n * @returns An array store that uses memory storage\n */\nexport function createTestArrayContext<T>(\n\tinitialData: T[] = [],\n\tkey: string = 'test-array',\n): IArrayStore<T> & SchmancyArrayStore<T> {\n\ttry {\n\t\treturn createContext<T>(initialData, 'memory', key)\n\t} catch (err) {\n\t\tconsole.error(`Failed to create test array context for key: ${key}`, err)\n\t\t// Return a fallback store with a different key\n\t\treturn createArrayStore<T>(initialData, 'memory', `${key}-emergency-fallback`)\n\t}\n}\n","// src/store/filter-directive.ts\n\n/** Supported comparison operators with TypeScript literal types */\nexport type ComparisonOperator =\n\t| '=='\n\t| '!='\n\t| '>'\n\t| '<'\n\t| '>='\n\t| '<='\n\t| 'includes'\n\t| 'notIncludes'\n\t| 'startsWith'\n\t| 'endsWith'\n\t| 'in'\n\t| 'notIn'\n\t| 'any' // fuzzy search operator\n\n/**\n * Type-safe condition tuple\n */\nexport type ConditionTuple = [field: string, op: ComparisonOperator, expected: unknown, strict?: boolean]\n\n/**\n * Type-safe condition object\n */\nexport interface ConditionObject {\n\tkey: string\n\toperator: ComparisonOperator\n\tvalue: unknown\n\tstrict?: boolean\n}\n\n/**\n * Unified query condition type\n */\nexport type QueryCondition = ConditionTuple | ConditionObject\n\n/**\n * Filter result with item and score\n */\nexport interface ScoredItem<T> {\n\titem: T\n\tscore: number\n}\n\n/**\n * Get a nested value from an object using a dot-separated path.\n * Checks explicitly for null/undefined so falsy values like 0 or false are preserved.\n */\nexport const getFieldValue = <T = any>(item: Record<string, any>, path: string): T => {\n\tif (!path) return item as unknown as T\n\n\tconst parts = path.split('.')\n\tlet value: any = item\n\n\tfor (const part of parts) {\n\t\tif (value == null) return undefined as unknown as T\n\t\tvalue = value[part]\n\t}\n\n\treturn value as T\n}\n\n/**\n * Compute the Levenshtein distance between two strings.\n */\nconst levenshtein = (a: string, b: string): number => {\n\tif (a === b) return 0\n\n\tconst matrix: number[][] = Array(b.length + 1)\n\t\t.fill(null)\n\t\t.map((_, i) => [i])\n\n\t// initialize the first row\n\tfor (let j = 0; j <= a.length; j++) {\n\t\tmatrix[0][j] = j\n\t}\n\n\tfor (let i = 1; i <= b.length; i++) {\n\t\tfor (let j = 1; j <= a.length; j++) {\n\t\t\tif (b.charAt(i - 1) === a.charAt(j - 1)) {\n\t\t\t\tmatrix[i][j] = matrix[i - 1][j - 1]\n\t\t\t} else {\n\t\t\t\tmatrix[i][j] = Math.min(\n\t\t\t\t\tmatrix[i - 1][j] + 1, // deletion\n\t\t\t\t\tmatrix[i][j - 1] + 1, // insertion\n\t\t\t\t\tmatrix[i - 1][j - 1] + 1, // substitution\n\t\t\t\t)\n\t\t\t}\n\t\t}\n\t}\n\treturn matrix[b.length][a.length]\n}\n\n/**\n * Check if string `sub` is a subsequence of string `str`.\n * All characters in `sub` must appear in order in `str` (they need not be contiguous).\n */\nconst isSubsequence = (sub: string, str: string): boolean => {\n\tif (!sub) return true\n\tif (!str) return false\n\n\tlet i = 0,\n\t\tj = 0\n\twhile (i < sub.length && j < str.length) {\n\t\tif (sub[i].toLowerCase() === str[j].toLowerCase()) i++\n\t\tj++\n\t}\n\treturn i === sub.length\n}\n\n/**\n * Check if every character (with frequency) in the query exists in the target.\n * For example, \"aovc\" matches \"avocados\".\n */\nconst anagramMatch = (query: string, target: string): boolean => {\n\tif (!query) return true\n\tif (!target) return false\n\n\tconst countChars = (s: string): Record<string, number> =>\n\t\ts\n\t\t\t.toLowerCase()\n\t\t\t.split('')\n\t\t\t.reduce(\n\t\t\t\t(acc, char) => {\n\t\t\t\t\tacc[char] = (acc[char] || 0) + 1\n\t\t\t\t\treturn acc\n\t\t\t\t},\n\t\t\t\t{} as Record<string, number>,\n\t\t\t)\n\n\tconst queryCount = countChars(query)\n\tconst targetCount = countChars(target)\n\treturn Object.keys(queryCount).every(char => (targetCount[char] || 0) >= queryCount[char])\n}\n\n/**\n * Generate bigrams for a string.\n */\nconst getBigrams = (s: string): string[] => {\n\tif (!s || s.length < 2) return []\n\n\tconst bigrams: string[] = []\n\tfor (let i = 0; i < s.length - 1; i++) {\n\t\tbigrams.push(s.substring(i, i + 2).toLowerCase())\n\t}\n\treturn bigrams\n}\n\n/**\n * Compute Dice's coefficient for two strings based on bigrams.\n * Returns a value between 0 (no similarity) and 1 (perfect match).\n */\nconst diceCoefficient = (s1: string, s2: string): number => {\n\tif (!s1 || !s2 || s1.length < 2 || s2.length < 2) return 0\n\n\tconst bigrams1 = getBigrams(s1)\n\tconst bigrams2 = getBigrams(s2)\n\n\tif (bigrams1.length === 0 || bigrams2.length === 0) return 0\n\n\tlet intersection = 0\n\tconst used = new Array(bigrams2.length).fill(false)\n\n\tfor (const bigram of bigrams1) {\n\t\tfor (let i = 0; i < bigrams2.length; i++) {\n\t\t\tif (!used[i] && bigrams2[i] === bigram) {\n\t\t\t\tintersection++\n\t\t\t\tused[i] = true\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n\n\treturn (2 * intersection) / (bigrams1.length + bigrams2.length)\n}\n\n/**\n * Compute a fuzzy similarity score between two strings.\n * The score is computed by taking the maximum of several methods:\n * - Direct substring match (score 1)\n * - Subsequence check (score 0.8)\n * - Anagram subset match (score 0.7)\n * - Dice coefficient\n * - Normalized Levenshtein similarity\n */\nconst computeFuzzyScore = (actual: string, expected: string): number => {\n\tif (!actual || !expected) return 0\n\n\tconst a = actual.toLowerCase().trim()\n\tconst b = expected.toLowerCase().trim()\n\n\tif (a === b) return 1\n\n\tconst substringScore = a.includes(b) ? 1 : 0\n\tconst subsequenceScore = isSubsequence(b, a) ? 0.8 : 0\n\tconst anagramScore = anagramMatch(b, a) ? 0.7 : 0\n\tconst diceScore = diceCoefficient(a, b)\n\n\tconst maxLen = Math.max(a.length, b.length)\n\tconst levenshteinScore = maxLen ? 1 - levenshtein(a, b) / maxLen : 0\n\n\treturn Math.max(substringScore, subsequenceScore, anagramScore, diceScore, levenshteinScore)\n}\n\n/**\n * Safely coerce value to string if possible, or return empty string\n */\nconst safeString = (value: unknown): string => {\n\tif (value == null) return ''\n\treturn String(value)\n}\n\n/**\n * Apply a query condition to an item and return score\n */\nfunction applyQueryCondition<T extends Record<string, any>>(\n\titem: T,\n\tquery: QueryCondition,\n\tfuzzyThreshold: number = 0.3,\n): { valid: boolean; score: number } {\n\tlet field: string,\n\t\top: ComparisonOperator,\n\t\texpected: unknown,\n\t\tstrict = false\n\n\tif (Array.isArray(query)) {\n\t\t;[field, op, expected, strict = false] = query\n\t} else {\n\t\tfield = query.key\n\t\top = query.operator\n\t\texpected = query.value\n\t\tstrict = query.strict || false\n\t}\n\n\t// Skip empty filters for non-strict queries\n\tif (!strict && (expected === '' || expected == null || (isArray(expected) && expected.length === 0))) {\n\t\treturn { valid: true, score: 1 }\n\t}\n\n\tconst actual = getFieldValue(item, field)\n\n\t// FIXED: Properly handle strict mode\n\tif (strict) {\n\t\t// For strict mode, use exact equality comparison for all operators except 'any'\n\t\tif (op === 'any') {\n\t\t\t// Fuzzy search still applies with strict mode\n\t\t\tif (typeof actual !== 'string' || typeof expected !== 'string') {\n\t\t\t\treturn { valid: false, score: 0 }\n\t\t\t}\n\n\t\t\tconst score = computeFuzzyScore(actual, expected)\n\t\t\treturn {\n\t\t\t\tvalid: score >= fuzzyThreshold,\n\t\t\t\tscore: score >= fuzzyThreshold ? score : 0,\n\t\t\t}\n\t\t} else {\n\t\t\t// For all other operators in strict mode,\n\t\t\t// delegate to compareValues function but return precise scores\n\t\t\tconst matches = compareValues(op, actual, expected)\n\t\t\treturn {\n\t\t\t\tvalid: matches,\n\t\t\t\tscore: matches ? 1 : 0,\n\t\t\t}\n\t\t}\n\t} else if (op === 'any') {\n\t\t// Fuzzy search requires both values to be strings\n\t\tif (typeof actual !== 'string' || typeof expected !== 'string') {\n\t\t\treturn { valid: false, score: 0 }\n\t\t}\n\n\t\tconst score = computeFuzzyScore(actual, expected)\n\t\tif (score < fuzzyThreshold) {\n\t\t\treturn { valid: false, score: 0 }\n\t\t}\n\n\t\treturn { valid: true, score }\n\t} else {\n\t\t// For non-fuzzy operators, check condition\n\t\tconst matches = compareValues(op, actual, expected)\n\t\treturn {\n\t\t\tvalid: matches,\n\t\t\tscore: matches ? 1 : 0,\n\t\t}\n\t}\n}\n\n/**\n * Filter a Map of items given an array of query conditions.\n * For each query condition:\n * - If the expected value is empty/null/undefined, it is treated as a match.\n * - For non-fuzzy operators, the condition must strictly match.\n * - For the \"any\" operator, a fuzzy similarity score is computed.\n * Items with a fuzzy score below a given threshold (e.g., 0.3) are excluded.\n *\n * The overall item score is the average of the scores from all conditions.\n * The results are sorted in descending order of relevance.\n *\n * @param items - A Map containing items to filter.\n * @param queries - An array of query conditions to apply.\n * @param fuzzyThreshold - Minimum score required for fuzzy matches (default: 0.3)\n * @returns An array of items that match all query conditions, sorted by relevance.\n */\nexport function filterMapItems<T extends Record<string, any>>(\n\titems: Map<string, T>,\n\tqueries: QueryCondition[] = [],\n\tfuzzyThreshold: number = 0.3,\n): T[] {\n\t// If no queries, return all items unsorted\n\tif (!queries.length) {\n\t\treturn Array.from(items.values())\n\t}\n\n\t// Score and filter each item\n\tconst scoredItems: ScoredItem<T>[] = []\n\n\tfor (const [_, item] of items.entries()) {\n\t\tlet totalScore = 0\n\t\tlet matchCount = 0\n\t\tlet valid = true\n\n\t\tfor (const query of queries) {\n\t\t\tconst result = applyQueryCondition(item, query, fuzzyThreshold)\n\n\t\t\tif (!result.valid) {\n\t\t\t\tvalid = false\n\t\t\t\tbreak\n\t\t\t}\n\n\t\t\ttotalScore += result.score\n\t\t\tmatchCount++\n\t\t}\n\n\t\tif (valid) {\n\t\t\tscoredItems.push({\n\t\t\t\titem,\n\t\t\t\tscore: matchCount > 0 ? totalScore / matchCount : 1,\n\t\t\t})\n\t\t}\n\t}\n\n\t// Sort by descending score\n\tscoredItems.sort((a, b) => b.score - a.score)\n\n\treturn scoredItems.map(x => x.item)\n}\n\n/**\n * Filter an array of items using query conditions\n */\nexport function filterArrayItems<T extends Record<string, any>>(\n\titems: T[],\n\tqueries: QueryCondition[] = [],\n\tfuzzyThreshold: number = 0.3,\n): T[] {\n\t// Create temporary map with numeric indices as keys\n\tconst map = new Map<string, T>()\n\titems.forEach((item, index) => map.set(String(index), item))\n\n\treturn filterMapItems(map, queries, fuzzyThreshold)\n}\n\n// Improved type guards for filter-directive.ts\n\n/**\n * Type guard for checking if a value is an array with better type inference\n * @param value Value to check\n * @returns True if the value is an array\n */\nexport function isArray<T = unknown>(value: unknown): value is Array<T> {\n\treturn Array.isArray(value)\n}\n\n/**\n * Type guard for checking if a value is a string\n * @param value Value to check\n * @returns True if the value is a string\n */\nexport function isString(value: unknown): value is string {\n\treturn typeof value === 'string'\n}\n\n/**\n * Type guard for checking if a value is a number\n * @param value Value to check\n * @returns True if the value is a number and not NaN\n */\nexport function isNumber(value: unknown): value is number {\n\treturn typeof value === 'number' && !isNaN(value)\n}\n\n/**\n * Type guard for checking if a value is a date\n * @param value Value to check\n * @returns True if the value is a valid Date object\n */\nexport function isDate(value: unknown): value is Date {\n\treturn value instanceof Date && !isNaN(value.getTime())\n}\n\n/**\n * Type guard for checking if a value is an iterable collection\n * @param value Value to check\n * @returns True if the value implements the iterable protocol\n */\nexport function isIterable<T = unknown>(value: unknown): value is Iterable<T> {\n\t// Must be non-null and of type 'object'\n\tif (value == null || typeof value !== 'object') {\n\t\treturn false\n\t}\n\n\t// Check for Symbol.iterator method\n\treturn Symbol.iterator in Object(value) && typeof (value as any)[Symbol.iterator] === 'function'\n}\n\n/**\n * Type guard for checking if a value is a Map\n * @param value Value to check\n * @returns True if the value is a Map\n */\nexport function isMap<K = unknown, V = unknown>(value: unknown): value is Map<K, V> {\n\treturn value instanceof Map\n}\n\n/**\n * Type guard for checking if a value is a Set\n * @param value Value to check\n * @returns True if the value is a Set\n */\nexport function isSet<T = unknown>(value: unknown): value is Set<T> {\n\treturn value instanceof Set\n}\n\n/**\n * Type guard for checking if a value is a plain object (not an array, Map, etc.)\n * @param value Value to check\n * @returns True if the value is a plain object\n */\nexport function isPlainObject(value: unknown): value is Record<string, unknown> {\n\tif (value === null || typeof value !== 'object') {\n\t\treturn false\n\t}\n\n\tconst proto = Object.getPrototypeOf(value)\n\treturn proto === Object.prototype || proto === null\n}\n\n/**\n * Type guard for checking if a value is undefined or null\n * @param value Value to check\n * @returns True if the value is undefined or null\n */\nexport function isNil(value: unknown): value is undefined | null {\n\treturn value === undefined || value === null\n}\n\n/**\n * Improved type-safe comparison function that uses appropriate type guards\n * @param op Comparison operator\n * @param actual Actual value\n * @param expected Expected value\n * @returns Result of the comparison\n */\nexport function compareValues(op: ComparisonOperator, actual: unknown, expected: unknown): boolean {\n\t// Handle null/undefined cases\n\tif (isNil(actual) && isNil(expected)) return true\n\tif (isNil(actual) || isNil(expected)) {\n\t\t// For equality operators, null == null but null != non-null\n\t\tif (op === '==') return actual === expected\n\t\tif (op === '!=') return actual !== expected\n\t\t// Other operators should return false for null/undefined values\n\t\treturn false\n\t}\n\n\tswitch (op) {\n\t\tcase '==':\n\t\t\treturn actual === expected\n\t\tcase '!=':\n\t\t\treturn actual !== expected\n\t\tcase '>':\n\t\t\tif (isNumber(actual) && isNumber(expected)) {\n\t\t\t\treturn actual > expected\n\t\t\t}\n\t\t\tif (isDate(actual) && isDate(expected)) {\n\t\t\t\treturn actual.getTime() > expected.getTime()\n\t\t\t}\n\t\t\tif (isString(actual) && isString(expected)) {\n\t\t\t\treturn actual.localeCompare(expected) > 0\n\t\t\t}\n\t\t\treturn false\n\t\tcase '<':\n\t\t\tif (isNumber(actual) && isNumber(expected)) {\n\t\t\t\treturn actual < expected\n\t\t\t}\n\t\t\tif (isDate(actual) && isDate(expected)) {\n\t\t\t\treturn actual.getTime() < expected.getTime()\n\t\t\t}\n\t\t\tif (isString(actual) && isString(expected)) {\n\t\t\t\treturn actual.localeCompare(expected) < 0\n\t\t\t}\n\t\t\treturn false\n\t\tcase '>=':\n\t\t\tif (isNumber(actual) && isNumber(expected)) {\n\t\t\t\treturn actual >= expected\n\t\t\t}\n\t\t\tif (isDate(actual) && isDate(expected)) {\n\t\t\t\treturn actual.getTime() >= expected.getTime()\n\t\t\t}\n\t\t\tif (isString(actual) && isString(expected)) {\n\t\t\t\treturn actual.localeCompare(expected) >= 0\n\t\t\t}\n\t\t\treturn false\n\t\tcase '<=':\n\t\t\tif (isNumber(actual) && isNumber(expected)) {\n\t\t\t\treturn actual <= expected\n\t\t\t}\n\t\t\tif (isDate(actual) && isDate(expected)) {\n\t\t\t\treturn actual.getTime() <= expected.getTime()\n\t\t\t}\n\t\t\tif (isString(actual) && isString(expected)) {\n\t\t\t\treturn actual.localeCompare(expected) <= 0\n\t\t\t}\n\t\t\treturn false\n\t\tcase 'includes': {\n\t\t\tif (isString(actual)) {\n\t\t\t\treturn actual.toLowerCase().includes(safeString(expected).toLowerCase())\n\t\t\t}\n\t\t\tif (isArray(actual)) {\n\t\t\t\treturn actual.includes(expected as any)\n\t\t\t}\n\t\t\tif (isSet(actual)) {\n\t\t\t\treturn actual.has(expected as any)\n\t\t\t}\n\t\t\tif (isMap(actual)) {\n\t\t\t\treturn Array.from(actual.values()).includes(expected as any)\n\t\t\t}\n\t\t\treturn false\n\t\t}\n\t\tcase 'notIncludes': {\n\t\t\tif (isString(actual)) {\n\t\t\t\treturn !actual.toLowerCase().includes(safeString(expected).toLowerCase())\n\t\t\t}\n\t\t\tif (isArray(actual)) {\n\t\t\t\treturn !actual.includes(expected as any)\n\t\t\t}\n\t\t\tif (isSet(actual)) {\n\t\t\t\treturn !actual.has(expected as any)\n\t\t\t}\n\t\t\tif (isMap(actual)) {\n\t\t\t\treturn !Array.from(actual.values()).includes(expected as any)\n\t\t\t}\n\t\t\treturn true\n\t\t}\n\t\tcase 'startsWith': {\n\t\t\tif (isString(actual) && isString(expected)) {\n\t\t\t\treturn actual.toLowerCase().startsWith(expected.toLowerCase())\n\t\t\t}\n\t\t\treturn false\n\t\t}\n\t\tcase 'endsWith': {\n\t\t\tif (isString(actual) && isString(expected)) {\n\t\t\t\treturn actual.toLowerCase().endsWith(expected.toLowerCase())\n\t\t\t}\n\t\t\treturn false\n\t\t}\n\t\tcase 'in': {\n\t\t\tif (isArray(expected)) {\n\t\t\t\treturn expected.includes(actual as any)\n\t\t\t}\n\t\t\tif (isSet(expected)) {\n\t\t\t\treturn expected.has(actual as any)\n\t\t\t}\n\t\t\tif (isMap(expected)) {\n\t\t\t\treturn expected.has(actual as any) || Array.from(expected.values()).includes(actual as any)\n\t\t\t}\n\t\t\treturn false\n\t\t}\n\t\tcase 'notIn': {\n\t\t\tif (isArray(expected)) {\n\t\t\t\treturn !expected.includes(actual as any)\n\t\t\t}\n\t\t\tif (isSet(expected)) {\n\t\t\t\treturn !expected.has(actual as any)\n\t\t\t}\n\t\t\tif (isMap(expected)) {\n\t\t\t\treturn !expected.has(actual as any) && !Array.from(expected.values()).includes(actual as any)\n\t\t\t}\n\t\t\treturn true\n\t\t}\n\t\tdefault: {\n\t\t\tconsole.warn(`Operator \"${op}\" is not supported in comparison.`)\n\t\t\treturn false\n\t\t}\n\t}\n}\n\n// Export a simpler alias for filterMapItems\nexport const filterMap = filterMapItems\n\n// Export an alias for filterArrayItems\nexport const filterArray = filterArrayItems\n","// src/store/selectors.ts\nimport { BehaviorSubject, Observable, combineLatest, distinctUntilChanged, map, share, shareReplay } from 'rxjs'\nimport { ICollectionStore, IStore } from './types'\n\n/**\n * Deep equality comparison for maps and complex objects\n * More efficient than JSON.stringify for large objects\n */\nfunction deepEqual(a: unknown, b: unknown): boolean {\n\tif (a === b) return true\n\n\tif (a instanceof Map && b instanceof Map) {\n\t\tif (a.size !== b.size) return false\n\t\tfor (const [key, value] of a) {\n\t\t\tif (!b.has(key) || !deepEqual(value, b.get(key))) return false\n\t\t}\n\t\treturn true\n\t}\n\n\tif (a instanceof Set && b instanceof Set) {\n\t\tif (a.size !== b.size) return false\n\t\tfor (const item of a) {\n\t\t\tif (!b.has(item)) return false\n\t\t}\n\t\treturn true\n\t}\n\n\tif (typeof a === 'object' && a !== null && typeof b === 'object' && b !== null) {\n\t\tconst keysA = Object.keys(a)\n\t\tconst keysB = Object.keys(b)\n\n\t\tif (keysA.length !== keysB.length) return false\n\n\t\tfor (const key of keysA) {\n\t\t\t// @ts-ignore: Index signature\n\t\t\tif (!deepEqual(a[key], b[key])) return false\n\t\t}\n\n\t\treturn true\n\t}\n\n\treturn false\n}\n\n/**\n * Creates a selector that derives a value from store state\n *\n * @param store The store to observe\n * @param selectorFn Function that transforms the state\n * @returns An observable of the selected state that only emits when the derived value changes\n */\nexport function createSelector<T, R>(store: IStore<T>, selectorFn: (state: T) => R): Observable<R> {\n\treturn store.$.pipe(map(selectorFn), distinctUntilChanged<R>(deepEqual), shareReplay(1))\n}\n\n/**\n * Creates a selector for collection stores that derives a value from the collection\n *\n * @param store The collection store to observe\n * @param selectorFn Function that transforms the collection\n * @returns An observable of the selected state that only emits when the derived value changes\n */\nexport function createCollectionSelector<T, R>(\n\tstore: ICollectionStore<T>,\n\tselectorFn: (state: Map<string, T>) => R,\n): Observable<R> {\n\treturn store.$.pipe(map(selectorFn), distinctUntilChanged<R>(deepEqual), shareReplay(1))\n}\n\n/**\n * Creates a selector that returns all items from a collection as an array\n *\n * @param store The collection store\n * @returns An observable of all items as an array\n */\nexport function createItemsSelector<T>(store: ICollectionStore<T>): Observable<T[]> {\n\treturn createCollectionSelector(store, collection => Array.from(collection.values()))\n}\n\n/**\n * Creates a selector that retrieves a single item from a collection\n *\n * @param store The collection store\n * @param itemKey The key of the item to select\n * @returns An observable of the selected item that emits when the item changes\n */\nexport function createItemSelector<T>(store: ICollectionStore<T>, itemKey: string): Observable<T | undefined> {\n\treturn createCollectionSelector(store, collection => collection.get(itemKey))\n}\n\nexport function createCompoundSelector<R>(\n\tstores: Array<IStore<any> | ICollectionStore<any>>,\n\tselectorFns: Array<(state: any) => any>,\n\tcombinerFn: (...values: any[]) => R,\n): Partial<IStore<R>> {\n\t// Create observables for each store\n\tconst observables = stores.map((store, index) => {\n\t\tconst selectorFn = selectorFns[index]\n\n\t\t// Check if it's a collection store\n\t\tif ('set' in store && typeof store.set === 'function' && store.value instanceof Map) {\n\t\t\treturn createCollectionSelector(store as ICollectionStore<any>, selectorFn)\n\t\t} else {\n\t\t\treturn createSelector(store as IStore<any>, selectorFn)\n\t\t}\n\t})\n\n\t// Combine the observables\n\tconst observable = combineLatest(observables).pipe(\n\t\tmap(values => combinerFn(...values)),\n\t\tdistinctUntilChanged(deepEqual),\n\t\tshareReplay(1),\n\t)\n\n\t// Compute initial value from source stores\n\tconst initialValues = stores.map((store, index) => selectorFns[index](store.value))\n\n\tconst initialValue = combinerFn(...initialValues)\n\n\t// Create BehaviorSubject with initial value\n\tconst behaviorSubject = new BehaviorSubject<R>(initialValue)\n\n\t// Subscribe to updates\n\tobservable.subscribe(value => behaviorSubject.next(value as R))\n\n\t// Return minimal store-compatible object\n\treturn {\n\t\t$: behaviorSubject,\n\t\tget value() {\n\t\t\treturn behaviorSubject.getValue()\n\t\t},\n\t\tready: true,\n\t}\n}\n/**\n * Creates a selector that returns all keys from a collection\n */\nexport function createKeysSelector<T>(store: ICollectionStore<T>): Observable<string[]> {\n\treturn createCollectionSelector(store, collection => Array.from(collection.keys()))\n}\n\n/**\n * Creates a selector that returns entries (key-value pairs) from a collection\n */\nexport function createEntriesSelector<T>(store: ICollectionStore<T>): Observable<[string, T][]> {\n\treturn createCollectionSelector(store, collection => Array.from(collection.entries()))\n}\n\n/**\n * Creates a selector that sorts collection items\n */\nexport function createSortSelector<T>(store: ICollectionStore<T>, compareFn: (a: T, b: T) => number): Observable<T[]> {\n\treturn createCollectionSelector(store, collection => {\n\t\treturn Array.from(collection.values()).sort(compareFn)\n\t})\n}\n\n/**\n * Creates a selector that finds the first item matching a predicate\n */\nexport function createFindSelector<T>(\n\tstore: ICollectionStore<T>,\n\tpredicate: (item: T, key: string) => boolean,\n): Observable<T | undefined> {\n\treturn createCollectionSelector(store, collection => {\n\t\tfor (const [key, item] of collection.entries()) {\n\t\t\tif (predicate(item, key)) {\n\t\t\t\treturn item\n\t\t\t}\n\t\t}\n\t\treturn undefined\n\t})\n}\n\n/**\n * Creates a selector that filters items from a collection - OPTIMIZED\n *\n * @param store The collection store\n * @param filterFn Function that returns true for items to include\n * @returns An observable of filtered items as an array\n */\nexport function createFilterSelector<T>(\n\tstore: ICollectionStore<T>,\n\tfilterFn: (item: T, key: string) => boolean,\n): Observable<T[]> {\n\treturn createCollectionSelector(store, collection =>\n\t\tArray.from(collection.entries())\n\t\t\t.filter(([key, item]) => filterFn(item, key))\n\t\t\t.map(([_, item]) => item),\n\t)\n}\n\n/**\n * Creates a selector that maps collection values through a transform function - OPTIMIZED\n */\nexport function createMapSelector<T, R>(\n\tstore: ICollectionStore<T>,\n\tmapFn: (item: T, key: string) => R,\n): Observable<R[]> {\n\treturn createCollectionSelector(store, collection =>\n\t\tArray.from(collection.entries()).map(([key, item]) => mapFn(item, key)),\n\t)\n}\n\n/**\n * Creates a selector that counts items in a collection, optionally filtered - OPTIMIZED\n *\n * @param store The collection store\n * @param filterFn Optional function to filter which items to count\n * @returns An observable of the count\n */\nexport function createCountSelector<T>(\n\tstore: ICollectionStore<T>,\n\tfilterFn?: (item: T, key: string) => boolean,\n): Observable<number> {\n\treturn createCollectionSelector(store, collection => {\n\t\tif (!filterFn) return collection.size\n\n\t\treturn Array.from(collection.entries()).filter(([key, item]) => filterFn(item, key)).length\n\t})\n}\n\n/**\n * Optimized RxJS Pipeline - use share with reset on refCount zero for better memory management\n * in scenarios where selector subscriptions come and go\n *\n * @param store The store to observe\n * @param selectorFn Function that transforms the state\n * @returns An observable of the selected state with improved memory management\n */\nexport function createOptimizedSelector<T, R>(store: IStore<T>, selectorFn: (state: T) => R): Observable<R> {\n\treturn store.$.pipe(\n\t\tmap(selectorFn),\n\t\tdistinctUntilChanged<R>(deepEqual),\n\t\tshare({\n\t\t\tresetOnRefCountZero: true,\n\t\t\tresetOnError: false,\n\t\t\tresetOnComplete: false,\n\t\t}),\n\t)\n}\n","// src/store/selector-hook.ts - Improved memory management\nimport { property as litProperty } from 'lit/decorators.js'\nimport { Observable, Subject, Subscription } from 'rxjs'\nimport { takeUntil } from 'rxjs/operators'\nimport { createCollectionSelector, createSelector } from './selectors'\nimport { ICollectionStore, IStore } from './types'\n\n/**\n * Symbol used for storing cleanup resources\n * Using a Symbol prevents name collisions with component properties\n */\nconst CLEANUP_SUBJECT = Symbol('selectorCleanup')\nconst SUBSCRIPTIONS = Symbol('selectorSubscriptions')\nconst INITIALIZED = Symbol('selectorInitialized')\n\n/**\n * Component lifecycle interface\n */\ninterface ComponentWithLifecycle {\n\t// Lifecycle hooks\n\tisConnected: boolean\n\tdisconnectedCallback?: () => void\n\tconnectedCallback?: () => void\n\trequestUpdate?: () => void\n\n\t// Internal properties using symbols to avoid name collisions\n\t[CLEANUP_SUBJECT]?: Subject<void>\n\t[SUBSCRIPTIONS]?: Map<string, Subscription>\n\t[INITIALIZED]?: Set<string>\n\n\t// Value storage\n\t[key: string]: any\n}\n\n/**\n * Property descriptor interface\n */\ntype PropertyDescriptor<T> = {\n\tget?: () => T\n\tset?: (value: T) => void\n\tvalue?: T\n\tconfigurable?: boolean\n\tenumerable?: boolean\n\twritable?: boolean\n}\n\n/**\n * Options for selecting from a store\n */\ninterface SelectOptions {\n\t/** If true, will wait for selector to emit a non-null value before calling connectedCallback */\n\trequired?: boolean\n\n\t/** If true, will only update the component and not set the property value */\n\tupdateOnly?: boolean\n\n\t/** If true, will use structuredClone to deeply clone values (prevents mutations) */\n\tdeepClone?: boolean\n\n\t/** Custom equality function to determine when to update */\n\tequals?: (a: any, b: any) => boolean\n\n\t/** Debug mode - logs selector activity */\n\tdebug?: boolean\n}\n\n/**\n * Type guard to check if a store is a collection store\n */\nfunction isCollectionStore<T>(store: IStore<any> | ICollectionStore<T>): store is ICollectionStore<T> {\n\treturn 'set' in store && typeof store.set === 'function' && store.value instanceof Map\n}\n\n/**\n * Ensures the cleanup resources exist on the component\n */\nfunction ensureCleanupResources(component: ComponentWithLifecycle): void {\n\tif (!component[CLEANUP_SUBJECT] || component[CLEANUP_SUBJECT].closed) {\n\t\tcomponent[CLEANUP_SUBJECT] = new Subject<void>()\n\t}\n\n\tif (!component[SUBSCRIPTIONS]) {\n\t\tcomponent[SUBSCRIPTIONS] = new Map()\n\t}\n\n\tif (!component[INITIALIZED]) {\n\t\tcomponent[INITIALIZED] = new Set()\n\t}\n}\n\n/**\n * Cleans up all selector resources\n */\nfunction cleanupSelectorResources(component: ComponentWithLifecycle): void {\n\tif (component[CLEANUP_SUBJECT]) {\n\t\tcomponent[CLEANUP_SUBJECT].next()\n\t\tcomponent[CLEANUP_SUBJECT].complete()\n\t\tcomponent[CLEANUP_SUBJECT] = undefined\n\t}\n\n\tif (component[SUBSCRIPTIONS]) {\n\t\tcomponent[SUBSCRIPTIONS].forEach(sub => sub.unsubscribe())\n\t\tcomponent[SUBSCRIPTIONS].clear()\n\t\tcomponent[SUBSCRIPTIONS] = undefined\n\t}\n\n\tif (component[INITIALIZED]) {\n\t\tcomponent[INITIALIZED].clear()\n\t\tcomponent[INITIALIZED] = undefined\n\t}\n}\n\n/**\n * Selector decorator that connects a component property to a store selector\n * with improved memory management\n *\n * @param store The store to select from\n * @param selectorFn Optional function to transform the store state\n * @param options Additional options for the selector\n */\nexport function select<T, R>(\n\tstore: IStore<T> | ICollectionStore<T>,\n\tselectorFn: (state: any) => R = (state: R) => state,\n\toptions: SelectOptions = {},\n) {\n\treturn function (proto: Record<string, any>, propName: string, _descriptor?: PropertyDescriptor<R>) {\n\t\t// Register as a Lit property\n\t\tlitProperty({ attribute: false, type: Object })(proto, propName)\n\n\t\t// Store original lifecycle methods\n\t\tconst originalConnectedCallback = proto.connectedCallback\n\t\tconst originalDisconnectedCallback = proto.disconnectedCallback\n\n\t\t// Override connectedCallback to set up subscription\n\t\tproto.connectedCallback = function (this: ComponentWithLifecycle) {\n\t\t\t// Initialize cleanup resources\n\t\t\tensureCleanupResources(this)\n\n\t\t\t// Create the appropriate selector\n\t\t\tconst selector: Observable<R> = isCollectionStore(store)\n\t\t\t\t? createCollectionSelector(store, selectorFn)\n\t\t\t\t: createSelector(store as IStore<T>, selectorFn)\n\n\t\t\t// Call original connectedCallback immediately if not waiting for data\n\t\t\tif (!options.required && !this[INITIALIZED]!.has(propName)) {\n\t\t\t\toriginalConnectedCallback?.call(this)\n\t\t\t\tthis[INITIALIZED]!.add(propName)\n\t\t\t}\n\n\t\t\t// Clean up any existing subscription\n\t\t\tif (this[SUBSCRIPTIONS]!.has(propName)) {\n\t\t\t\tthis[SUBSCRIPTIONS]!.get(propName)?.unsubscribe()\n\t\t\t\tthis[SUBSCRIPTIONS]!.delete(propName)\n\t\t\t}\n\n\t\t\t// Debug log if needed\n\t\t\tif (options.debug) {\n\t\t\t\tconsole.debug(`[select] Setting up subscription for ${propName}`)\n\t\t\t}\n\n\t\t\t// Create new subscription with better error handling\n\t\t\tconst subscription = selector.pipe(takeUntil(this[CLEANUP_SUBJECT]!)).subscribe({\n\t\t\t\tnext: (value: R) => {\n\t\t\t\t\t// Handle value updates\n\t\t\t\t\tconst newValue = options.deepClone ? structuredClone(value) : value\n\n\t\t\t\t\tif (options.debug) {\n\t\t\t\t\t\tconsole.debug(`[select] New value for ${propName}:`, newValue)\n\t\t\t\t\t}\n\n\t\t\t\t\tif (!options.updateOnly) {\n\t\t\t\t\t\tthis[propName] = newValue\n\t\t\t\t\t}\n\n\t\t\t\t\tthis.requestUpdate?.()\n\n\t\t\t\t\t// If required and not initialized, call connectedCallback when we get a value\n\t\t\t\t\tif (options.required && !this[INITIALIZED]!.has(propName) && newValue !== null && newValue !== undefined) {\n\t\t\t\t\t\tif (options.debug) {\n\t\t\t\t\t\t\tconsole.debug(`[select] Calling delayed connectedCallback for ${propName}`)\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\toriginalConnectedCallback?.call(this)\n\t\t\t\t\t\tthis[INITIALIZED]!.add(propName)\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\terror: (err: Error) => {\n\t\t\t\t\tconsole.error(`Error in selector subscription for ${propName}:`, err)\n\t\t\t\t\t// Resubscribe on error to prevent component from becoming unresponsive\n\t\t\t\t\tif (this.isConnected) {\n\t\t\t\t\t\t// Small delay to prevent immediate resubscription\n\t\t\t\t\t\tsetTimeout(() => {\n\t\t\t\t\t\t\tif (this.isConnected) {\n\t\t\t\t\t\t\t\tif (options.debug) {\n\t\t\t\t\t\t\t\t\tconsole.debug(`[select] Resubscribing after error for ${propName}`)\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tthis.connectedCallback?.()\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}, 1000)\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t})\n\n\t\t\t// Store the subscription for cleanup\n\t\t\tthis[SUBSCRIPTIONS]!.set(propName, subscription)\n\t\t}\n\n\t\t// Override disconnectedCallback to clean up subscriptions\n\t\tproto.disconnectedCallback = function (this: ComponentWithLifecycle) {\n\t\t\t// Call original disconnectedCallback\n\t\t\toriginalDisconnectedCallback?.call(this)\n\n\t\t\t// Debug log if needed\n\t\t\tif (options.debug) {\n\t\t\t\tconsole.debug(`[select] Cleaning up resources in disconnectedCallback`)\n\t\t\t}\n\n\t\t\t// Clean up all subscription resources\n\t\t\tcleanupSelectorResources(this)\n\t\t}\n\t}\n}\n\n/**\n * Creates a selector decorator that selects a specific item from a collection store\n * with improved memory management\n *\n * @param store The collection store\n * @param keyGetter Function that returns the key to select\n * @param options Additional options\n */\nexport function selectItem<T>(\n\tstore: ICollectionStore<T>,\n\tkeyGetter: (component: any) => string,\n\toptions: SelectOptions = {},\n) {\n\treturn function (proto: Record<string, any>, propName: string, _descriptor?: PropertyDescriptor<T | undefined>) {\n\t\tselect(\n\t\t\tstore,\n\t\t\tfunction (state) {\n\t\t\t\t// This will be evaluated during subscription, when 'this' is available\n\t\t\t\tconst itemKey = keyGetter(this)\n\t\t\t\treturn itemKey ? state.get(itemKey) : undefined\n\t\t\t},\n\t\t\toptions,\n\t\t)(proto, propName)\n\t}\n}\n"],"names":["createObjectStore","initialData","storage","key","value","Array","isArray","Map","Set","Date","RegExp","Object","getPrototypeOf","prototype","store","SchmancyStoreObject","getInstance","obj","keys","length","set","createArrayStore","SchmancyArrayStore","replace","err","createContext","includes","SchmancyCollectionStore","size","error","createArrayContext","createTestArrayContext","getFieldValue","item","path","parts","split","part","getBigrams","s","bigrams","i","push","substring","toLowerCase","computeFuzzyScore","actual","expected","a","trim","b","substringScore","subsequenceScore","sub","str","j","anagramScore","query","target","countChars","reduce","acc","char","queryCount","targetCount","every","diceScore","s1","s2","bigrams1","bigrams2","intersection","used","fill","bigram","maxLen","Math","max","levenshteinScore","matrix","map","_","charAt","min","safeString","String","applyQueryCondition","fuzzyThreshold","field","op","strict","operator","valid","score","matches","compareValues","t","filterMapItems","items","queries","from","values","scoredItems","entries","totalScore","matchCount","result","sort","x","filterArrayItems","forEach","index","isString","isNumber","isNaN","isDate","getTime","isIterable","Symbol","iterator","isMap","isSet","isPlainObject","proto","isNil","localeCompare","has","startsWith","endsWith","filterMap","filterArray","deepEqual","get","keysA","keysB","createSelector","selectorFn","$","pipe","distinctUntilChanged","shareReplay","createCollectionSelector","createItemsSelector","collection","createItemSelector","itemKey","createCompoundSelector","stores","selectorFns","combinerFn","observables","observable","combineLatest","initialValues","initialValue","behaviorSubject","BehaviorSubject","subscribe","next","getValue","ready","createKeysSelector","createEntriesSelector","createSortSelector","compareFn","createFindSelector","predicate","createFilterSelector","filterFn","filter","createMapSelector","mapFn","createCountSelector","createOptimizedSelector","share","resetOnRefCountZero","resetOnError","resetOnComplete","CLEANUP_SUBJECT","SUBSCRIPTIONS","INITIALIZED","select","state","options","propName","_descriptor","litProperty","attribute","type","originalConnectedCallback","connectedCallback","originalDisconnectedCallback","disconnectedCallback","component","this","closed","Subject","selector","required","call","add","unsubscribe","delete","debug","subscription","takeUntil","newValue","deepClone","structuredClone","updateOnly","requestUpdate","isConnected","setTimeout","complete","clear","selectItem","keyGetter"],"mappings":";;;;AAkDA,SAASA,EACRC,GACAC,GACAC,GAEI;AAAA,MAAA;AAEa,IAAZD,MAAY,gBAELA,IAAA,YAzBUE,IA6BFH,OA3BT,QACO,OAAVG,KAAU,YAChBC,MAAMC,QAAQF,CACbA,KAAAA,aAAiBG,OACjBH,aAAiBI,OACjBJ,aAAiBK,QACjBL,aAAiBM,UACnBC,OAAOC,eAAeR,CAAAA,MAAWO,OAAOE,eAsBzBZ,IAAA,EAAA,GAAKA,EAIpB;AAAA,UAAMa,IAAQC,EAAoBC,YAAed,GAASC,GAAKF,CAAAA;AAOxD,WAjEW,QADGgB,IA8DHH,EAAMV,UA7DN,YAAYa,MAAQ,QAGhCN,OAAOO,KAAKD,CAAAA,EAAKE,WAAW,KA2DjCL,EAAMM,IAAI,EAAA,GAAKnB,EAGTa,CAAAA,GAAAA;AAAAA,UAUA;AAAA,WANeC,EAAoBC,YACzC,UACA,GAAGb,CACHF,aAAAA,CAAAA;AAAAA,EAGM;AA5ET,MAAuBgB,GAwBAb;AAsDvB;AAqCA,SAASiB,EACRpB,GACAC,G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d,CAAAA,MACbc,EAAUd,CAAAA,EAAerE,QAAezD,CAAAA,MAAAA,EAAIoJ,YAAAA,CAAAA,GAClCR,EAAAd,CAAAA,EAAemC,MACzBrB,GAAAA,EAAUd,CAAiB,IAAA,SAGxBc,EAAUb,CAAAA,MACHa,EAAAb,CAAAA,EAAakC,MACvBrB,GAAAA,EAAUb,CAAe,IAAA;AAAA,IA+GzB;AAAA,EACD;AACD;AAUO,SAASmC,GACfzM,GACA0M,GACAjC,IAAyB,CAAA,GAElB;AAAA,SAAA,SAAU5D,GAA4B6D,GAAkBC,GAAAA;AAC9DJ,IAAAA,GACCvK,GACA,SAAUwK,GAAAA;AAEH,YAAArC,IAAUuE,EAAUtB,IAAAA;AAC1B,aAAOjD,IAAUqC,EAAMlD,IAAIa,CAAW,IAAA;AAAA,IACvC,GACAsC,CAAAA,EACC5D,GAAO6D,CACV;AAAA,EAAA;AACD;"}
package/dist/store.cjs CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./context-object-CP7HbDFQ.cjs"),e=require("./selector-hook-Bvne--oy.cjs");exports.BaseStore=r.BaseStore,exports.IndexedDBStorageManager=r.IndexedDBStorageManager,exports.LocalStorageManager=r.LocalStorageManager,exports.MemoryStorageManager=r.MemoryStorageManager,exports.SchmancyArrayStore=r.SchmancyArrayStore,exports.SchmancyStoreObject=r.SchmancyStoreObject,exports.SessionStorageManager=r.SessionStorageManager,exports.StoreError=r.StoreError,exports.createStorageManager=r.createStorageManager,exports.compareValues=e.compareValues,exports.createArrayContext=e.createArrayContext,exports.createCollectionSelector=e.createCollectionSelector,exports.createCompoundSelector=e.createCompoundSelector,exports.createContext=e.createContext,exports.createCountSelector=e.createCountSelector,exports.createEntriesSelector=e.createEntriesSelector,exports.createFilterSelector=e.createFilterSelector,exports.createFindSelector=e.createFindSelector,exports.createItemSelector=e.createItemSelector,exports.createItemsSelector=e.createItemsSelector,exports.createKeysSelector=e.createKeysSelector,exports.createMapSelector=e.createMapSelector,exports.createOptimizedSelector=e.createOptimizedSelector,exports.createSelector=e.createSelector,exports.createSortSelector=e.createSortSelector,exports.createTestArrayContext=e.createTestArrayContext,exports.filterArray=e.filterArray,exports.filterArrayItems=e.filterArrayItems,exports.filterMap=e.filterMap,exports.filterMapItems=e.filterMapItems,exports.getFieldValue=e.getFieldValue,exports.isArray=e.isArray,exports.isDate=e.isDate,exports.isIterable=e.isIterable,exports.isMap=e.isMap,exports.isNil=e.isNil,exports.isNumber=e.isNumber,exports.isPlainObject=e.isPlainObject,exports.isSet=e.isSet,exports.isString=e.isString,exports.select=e.select,exports.selectItem=e.selectItem;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./context-object-CP7HbDFQ.cjs"),e=require("./selector-hook-BjCCf3SV.cjs");exports.BaseStore=r.BaseStore,exports.IndexedDBStorageManager=r.IndexedDBStorageManager,exports.LocalStorageManager=r.LocalStorageManager,exports.MemoryStorageManager=r.MemoryStorageManager,exports.SchmancyArrayStore=r.SchmancyArrayStore,exports.SchmancyStoreObject=r.SchmancyStoreObject,exports.SessionStorageManager=r.SessionStorageManager,exports.StoreError=r.StoreError,exports.createStorageManager=r.createStorageManager,exports.compareValues=e.compareValues,exports.createArrayContext=e.createArrayContext,exports.createCollectionSelector=e.createCollectionSelector,exports.createCompoundSelector=e.createCompoundSelector,exports.createContext=e.createContext,exports.createCountSelector=e.createCountSelector,exports.createEntriesSelector=e.createEntriesSelector,exports.createFilterSelector=e.createFilterSelector,exports.createFindSelector=e.createFindSelector,exports.createItemSelector=e.createItemSelector,exports.createItemsSelector=e.createItemsSelector,exports.createKeysSelector=e.createKeysSelector,exports.createMapSelector=e.createMapSelector,exports.createOptimizedSelector=e.createOptimizedSelector,exports.createSelector=e.createSelector,exports.createSortSelector=e.createSortSelector,exports.createTestArrayContext=e.createTestArrayContext,exports.filterArray=e.filterArray,exports.filterArrayItems=e.filterArrayItems,exports.filterMap=e.filterMap,exports.filterMapItems=e.filterMapItems,exports.getFieldValue=e.getFieldValue,exports.isArray=e.isArray,exports.isDate=e.isDate,exports.isIterable=e.isIterable,exports.isMap=e.isMap,exports.isNil=e.isNil,exports.isNumber=e.isNumber,exports.isPlainObject=e.isPlainObject,exports.isSet=e.isSet,exports.isString=e.isString,exports.select=e.select,exports.selectItem=e.selectItem;
2
2
  //# sourceMappingURL=store.cjs.map
package/dist/store.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { B as r, I as t, L as s, M as c, S as o, a as l, b as S, d as i, c as n } from "./context-object-CISes2bD.js";
2
- import { p as g, a as y, v as M, y as p, c as d, F as I, A as f, D as x, C as A, x as C, w as b, z as u, E as B, G as F, u as h, B as j, b as D, r as E, d as O, q as z, f as L, g as N, i as V, j as k, k as q, l as v, o as w, h as G, n as K, m as P, e as T, s as H, t as J } from "./selector-hook-D_HTD-GV.js";
2
+ import { p as g, a as y, v as M, y as p, c as d, F as I, A as f, D as x, C as A, x as C, w as b, z as u, E as B, G as F, u as h, B as j, b as D, r as E, d as O, q as z, f as L, g as N, i as V, j as k, k as q, l as v, o as w, h as G, n as K, m as P, e as T, s as H, t as J } from "./selector-hook-DHPU6Z2H.js";
3
3
  export {
4
4
  r as BaseStore,
5
5
  t as IndexedDBStorageManager,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mhmo91/schmancy",
3
- "version": "0.2.144",
3
+ "version": "0.2.145",
4
4
  "description": "UI library build with web components",
5
5
  "main": "./dist/index.js",
6
6
  "packageManager": "yarn@4.6.0",
@@ -1,5 +1,5 @@
1
1
  import { Observable } from 'rxjs';
2
- import { IStore, ICollectionStore } from './types';
2
+ import { ICollectionStore, IStore } from './types';
3
3
  /**
4
4
  * Creates a selector that derives a value from store state
5
5
  *
@@ -31,16 +31,7 @@ export declare function createItemsSelector<T>(store: ICollectionStore<T>): Obse
31
31
  * @returns An observable of the selected item that emits when the item changes
32
32
  */
33
33
  export declare function createItemSelector<T>(store: ICollectionStore<T>, itemKey: string): Observable<T | undefined>;
34
- /**
35
- * Creates a compound selector that depends on multiple other selectors
36
- *
37
- * @param selectors Array of source selectors
38
- * @param combinerFn Function that combines all selector results
39
- * @returns An observable of the combined result
40
- */
41
- export declare function createCompoundSelector<T extends unknown[], R>(selectors: {
42
- [K in keyof T]: Observable<T[K]>;
43
- }, combinerFn: (...values: T) => R): Observable<R>;
34
+ export declare function createCompoundSelector<R>(stores: Array<IStore<any> | ICollectionStore<any>>, selectorFns: Array<(state: any) => any>, combinerFn: (...values: any[]) => R): Partial<IStore<R>>;
44
35
  /**
45
36
  * Creates a selector that returns all keys from a collection
46
37
  */
@@ -1,2 +0,0 @@
1
- "use strict";const O=require("./context-object-CP7HbDFQ.cjs"),K=require("lit/decorators.js"),m=require("rxjs"),Z=require("rxjs/operators");function U(n,e,t){try{e==="indexeddb"&&(e="local"),((o=n)===null||typeof o!="object"||Array.isArray(o)||o instanceof Map||o instanceof Set||o instanceof Date||o instanceof RegExp||Object.getPrototypeOf(o)!==Object.prototype)&&(n={...n});const a=O.SchmancyStoreObject.getInstance(e,t,n);return typeof(r=a.value)=="object"&&r!==null&&Object.keys(r).length===0&&a.set({...n}),a}catch{return O.SchmancyStoreObject.getInstance("memory",`${t}-fallback`,n)}var r,o}function q(n,e,t){try{const r=O.SchmancyArrayStore.getInstance(e,t,n);return r.value.length||r.replace([...n]),r}catch{return O.SchmancyArrayStore.getInstance("memory",`${t}-fallback`,[...n])}}function $(n,e,t){try{return n==null&&(n=t.includes("collection")||t.includes("map")?new Map:t.includes("array")||t.includes("list")?[]:{}),n instanceof Map?function(r,o,a){try{const u=O.SchmancyCollectionStore.getInstance(o,a,r);return u.value.size||u.replace(new Map(r)),u}catch{return O.SchmancyCollectionStore.getInstance("memory",`${a}-fallback`,new Map(r))}}(n,e,t):function(r){return Array.isArray(r)}(n)?q(n,e,t):U(typeof n=="object"?n:{value:n},e,t)}catch{return U(typeof n=="object"&&n!==null?{...n}:{value:n},"memory",`emergency-fallback-${t}`)}}const F=(n,e)=>{if(!e)return n;const t=e.split(".");let r=n;for(const o of t){if(r==null)return;r=r[o]}return r},E=n=>{if(!n||n.length<2)return[];const e=[];for(let t=0;t<n.length-1;t++)e.push(n.substring(t,t+2).toLowerCase());return e},R=(n,e)=>{if(!n||!e)return 0;const t=n.toLowerCase().trim(),r=e.toLowerCase().trim();if(t===r)return 1;const o=t.includes(r)?1:0,a=((l,h)=>{if(!l)return!0;if(!h)return!1;let s=0,i=0;for(;s<l.length&&i<h.length;)l[s].toLowerCase()===h[i].toLowerCase()&&s++,i++;return s===l.length})(r,t)?.8:0,u=((l,h)=>{if(!l)return!0;if(!h)return!1;const s=j=>j.toLowerCase().split("").reduce((I,v)=>(I[v]=(I[v]||0)+1,I),{}),i=s(l),y=s(h);return Object.keys(i).every(j=>(y[j]||0)>=i[j])})(r,t)?.7:0,f=((l,h)=>{if(!l||!h||l.length<2||h.length<2)return 0;const s=E(l),i=E(h);if(s.length===0||i.length===0)return 0;let y=0;const j=new Array(i.length).fill(!1);for(const I of s)for(let v=0;v<i.length;v++)if(!j[v]&&i[v]===I){y++,j[v]=!0;break}return 2*y/(s.length+i.length)})(t,r),c=Math.max(t.length,r.length),w=c?1-((l,h)=>{if(l===h)return 0;const s=Array(h.length+1).fill(null).map((i,y)=>[y]);for(let i=0;i<=l.length;i++)s[0][i]=i;for(let i=1;i<=h.length;i++)for(let y=1;y<=l.length;y++)h.charAt(i-1)===l.charAt(y-1)?s[i][y]=s[i-1][y-1]:s[i][y]=Math.min(s[i-1][y]+1,s[i][y-1]+1,s[i-1][y-1]+1);return s[h.length][l.length]})(t,r)/c:0;return Math.max(o,a,u,f,w)},W=n=>n==null?"":String(n);function B(n,e,t=.3){let r,o,a,u=!1;if(Array.isArray(e)?[r,o,a,u=!1]=e:(r=e.key,o=e.operator,a=e.value,u=e.strict||!1),!u&&(a===""||a==null||k(a)&&a.length===0))return{valid:!0,score:1};const f=F(n,r);if(u){if(o==="any"){if(typeof f!="string"||typeof a!="string")return{valid:!1,score:0};const c=R(f,a);return{valid:c>=t,score:c>=t?c:0}}{const c=z(o,f,a);return{valid:c,score:c?1:0}}}if(o==="any"){if(typeof f!="string"||typeof a!="string")return{valid:!1,score:0};const c=R(f,a);return c<t?{valid:!1,score:0}:{valid:!0,score:c}}{const c=z(o,f,a);return{valid:c,score:c?1:0}}}function N(n,e=[],t=.3){if(!e.length)return Array.from(n.values());const r=[];for(const[o,a]of n.entries()){let u=0,f=0,c=!0;for(const w of e){const l=B(a,w,t);if(!l.valid){c=!1;break}u+=l.score,f++}c&&r.push({item:a,score:f>0?u/f:1})}return r.sort((o,a)=>a.score-o.score),r.map(o=>o.item)}function P(n,e=[],t=.3){const r=new Map;return n.forEach((o,a)=>r.set(String(a),o)),N(r,e,t)}function k(n){return Array.isArray(n)}function p(n){return typeof n=="string"}function C(n){return typeof n=="number"&&!isNaN(n)}function S(n){return n instanceof Date&&!isNaN(n.getTime())}function L(n){return n instanceof Map}function T(n){return n instanceof Set}function x(n){return n==null}function z(n,e,t){if(x(e)&&x(t))return!0;if(x(e)||x(t))return n==="=="?e===t:n==="!="&&e!==t;switch(n){case"==":return e===t;case"!=":return e!==t;case">":return C(e)&&C(t)?e>t:S(e)&&S(t)?e.getTime()>t.getTime():!(!p(e)||!p(t))&&e.localeCompare(t)>0;case"<":return C(e)&&C(t)?e<t:S(e)&&S(t)?e.getTime()<t.getTime():!(!p(e)||!p(t))&&e.localeCompare(t)<0;case">=":return C(e)&&C(t)?e>=t:S(e)&&S(t)?e.getTime()>=t.getTime():!(!p(e)||!p(t))&&e.localeCompare(t)>=0;case"<=":return C(e)&&C(t)?e<=t:S(e)&&S(t)?e.getTime()<=t.getTime():!(!p(e)||!p(t))&&e.localeCompare(t)<=0;case"includes":return p(e)?e.toLowerCase().includes(W(t).toLowerCase()):k(e)?e.includes(t):T(e)?e.has(t):!!L(e)&&Array.from(e.values()).includes(t);case"notIncludes":return p(e)?!e.toLowerCase().includes(W(t).toLowerCase()):k(e)?!e.includes(t):T(e)?!e.has(t):!L(e)||!Array.from(e.values()).includes(t);case"startsWith":return!(!p(e)||!p(t))&&e.toLowerCase().startsWith(t.toLowerCase());case"endsWith":return!(!p(e)||!p(t))&&e.toLowerCase().endsWith(t.toLowerCase());case"in":return k(t)?t.includes(e):T(t)?t.has(e):!!L(t)&&(t.has(e)||Array.from(t.values()).includes(e));case"notIn":return k(t)?!t.includes(e):T(t)?!t.has(e):!L(t)||!t.has(e)&&!Array.from(t.values()).includes(e);default:return!1}}const G=N,H=P;function M(n,e){if(n===e)return!0;if(n instanceof Map&&e instanceof Map){if(n.size!==e.size)return!1;for(const[t,r]of n)if(!e.has(t)||!M(r,e.get(t)))return!1;return!0}if(n instanceof Set&&e instanceof Set){if(n.size!==e.size)return!1;for(const t of n)if(!e.has(t))return!1;return!0}if(typeof n=="object"&&n!==null&&typeof e=="object"&&e!==null){const t=Object.keys(n),r=Object.keys(e);if(t.length!==r.length)return!1;for(const o of t)if(!M(n[o],e[o]))return!1;return!0}return!1}function V(n,e){return n.$.pipe(m.map(e),m.distinctUntilChanged(M),m.shareReplay(1))}function d(n,e){return n.$.pipe(m.map(e),m.distinctUntilChanged(M),m.shareReplay(1))}const A=Symbol("selectorCleanup"),g=Symbol("selectorSubscriptions"),b=Symbol("selectorInitialized");function D(n,e=r=>r,t={}){return function(r,o,a){K.property({attribute:!1,type:Object})(r,o);const u=r.connectedCallback,f=r.disconnectedCallback;r.connectedCallback=function(){var h;var c;(c=this)[A]&&!c[A].closed||(c[A]=new m.Subject),c[g]||(c[g]=new Map),c[b]||(c[b]=new Set);const w=function(s){return"set"in s&&typeof s.set=="function"&&s.value instanceof Map}(n)?d(n,e):V(n,e);t.required||this[b].has(o)||(u==null||u.call(this),this[b].add(o)),this[g].has(o)&&((h=this[g].get(o))==null||h.unsubscribe(),this[g].delete(o)),t.debug;const l=w.pipe(Z.takeUntil(this[A])).subscribe({next:s=>{var y;const i=t.deepClone?structuredClone(s):s;t.debug,t.updateOnly||(this[o]=i),(y=this.requestUpdate)==null||y.call(this),t.required&&!this[b].has(o)&&i!=null&&(t.debug,u==null||u.call(this),this[b].add(o))},error:s=>{this.isConnected&&setTimeout(()=>{var i;this.isConnected&&(t.debug,(i=this.connectedCallback)==null||i.call(this))},1e3)}});this[g].set(o,l)},r.disconnectedCallback=function(){var c;f==null||f.call(this),t.debug,(c=this)[A]&&(c[A].next(),c[A].complete(),c[A]=void 0),c[g]&&(c[g].forEach(w=>w.unsubscribe()),c[g].clear(),c[g]=void 0),c[b]&&(c[b].clear(),c[b]=void 0)}}}exports.compareValues=z,exports.createArrayContext=function(n=[],e,t="local"){try{return $(n,t,e)}catch{return q(n,"memory",`${e}-fallback`)}},exports.createCollectionSelector=d,exports.createCompoundSelector=function(n,e){return m.combineLatest(n).pipe(m.map(t=>e(...t)),m.distinctUntilChanged(M),m.shareReplay(1))},exports.createContext=$,exports.createCountSelector=function(n,e){return d(n,t=>e?Array.from(t.entries()).filter(([r,o])=>e(o,r)).length:t.size)},exports.createEntriesSelector=function(n){return d(n,e=>Array.from(e.entries()))},exports.createFilterSelector=function(n,e){return d(n,t=>Array.from(t.entries()).filter(([r,o])=>e(o,r)).map(([r,o])=>o))},exports.createFindSelector=function(n,e){return d(n,t=>{for(const[r,o]of t.entries())if(e(o,r))return o})},exports.createItemSelector=function(n,e){return d(n,t=>t.get(e))},exports.createItemsSelector=function(n){return d(n,e=>Array.from(e.values()))},exports.createKeysSelector=function(n){return d(n,e=>Array.from(e.keys()))},exports.createMapSelector=function(n,e){return d(n,t=>Array.from(t.entries()).map(([r,o])=>e(o,r)))},exports.createOptimizedSelector=function(n,e){return n.$.pipe(m.map(e),m.distinctUntilChanged(M),m.share({resetOnRefCountZero:!0,resetOnError:!1,resetOnComplete:!1}))},exports.createSelector=V,exports.createSortSelector=function(n,e){return d(n,t=>Array.from(t.values()).sort(e))},exports.createTestArrayContext=function(n=[],e="test-array"){try{return $(n,"memory",e)}catch{return q(n,"memory",`${e}-emergency-fallback`)}},exports.filterArray=H,exports.filterArrayItems=P,exports.filterMap=G,exports.filterMapItems=N,exports.getFieldValue=F,exports.isArray=k,exports.isDate=S,exports.isIterable=function(n){return n!=null&&typeof n=="object"&&Symbol.iterator in Object(n)&&typeof n[Symbol.iterator]=="function"},exports.isMap=L,exports.isNil=x,exports.isNumber=C,exports.isPlainObject=function(n){if(n===null||typeof n!="object")return!1;const e=Object.getPrototypeOf(n);return e===Object.prototype||e===null},exports.isSet=T,exports.isString=p,exports.select=D,exports.selectItem=function(n,e,t={}){return function(r,o,a){D(n,function(u){const f=e(this);return f?u.get(f):void 0},t)(r,o)}};
2
- //# sourceMappingURL=selector-hook-Bvne--oy.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"selector-hook-Bvne--oy.cjs","sources":["../src/store/context-create.ts","../src/store/filter-directive.ts","../src/store/selectors.ts","../src/store/selector-hook.ts"],"sourcesContent":["// src/store/context-create.ts - Fixed version\n\nimport { SchmancyArrayStore } from './context-array'\nimport SchmancyCollectionStore from './context-collection'\nimport { SchmancyStoreObject } from './context-object'\nimport { IArrayStore, ICollectionStore, IStore, StorageType } from './types'\n\n/**\n * Type guard to check if an object is empty\n */\nfunction isEmptyObject(obj: unknown): boolean {\n\tif (typeof obj !== 'object' || obj === null) {\n\t\treturn false\n\t}\n\treturn Object.keys(obj).length === 0\n}\n\n/**\n * Type guard for Map objects\n */\nfunction isMap<K, V>(value: unknown): value is Map<K, V> {\n\treturn value instanceof Map\n}\n\n/**\n * Type guard for Array objects\n */\nfunction isArray<T>(value: unknown): value is Array<T> {\n\treturn Array.isArray(value)\n}\n\n/**\n * Type guard for plain objects (not arrays, maps, null, etc.)\n */\nfunction isPlainObject(value: unknown): boolean {\n\treturn (\n\t\tvalue !== null &&\n\t\ttypeof value === 'object' &&\n\t\t!Array.isArray(value) &&\n\t\t!(value instanceof Map) &&\n\t\t!(value instanceof Set) &&\n\t\t!(value instanceof Date) &&\n\t\t!(value instanceof RegExp) &&\n\t\tObject.getPrototypeOf(value) === Object.prototype\n\t)\n}\n\n/**\n * Creates a regular object store with better typing and error handling\n */\nfunction createObjectStore<T extends Record<string, any>>(\n\tinitialData: T,\n\tstorage: StorageType,\n\tkey: string,\n): IStore<T> & SchmancyStoreObject<T> {\n\ttry {\n\t\t// Validate storage type\n\t\tif (storage === 'indexeddb') {\n\t\t\tconsole.warn(`IndexedDB storage is not optimal for plain objects. Using 'local' instead for key: ${key}`)\n\t\t\tstorage = 'local'\n\t\t}\n\n\t\t// Ensure initialData is a plain object\n\t\tif (!isPlainObject(initialData)) {\n\t\t\tconsole.warn(`Initial data is not a plain object. Converting to object for key: ${key}`)\n\t\t\tinitialData = { ...initialData } as T\n\t\t}\n\n\t\t// Create the store instance\n\t\tconst store = SchmancyStoreObject.getInstance<T>(storage, key, initialData)\n\n\t\t// Initialize with provided data if store is empty\n\t\tif (isEmptyObject(store.value)) {\n\t\t\tstore.set({ ...initialData }) // Use spread to create a copy\n\t\t}\n\n\t\treturn store\n\t} catch (err) {\n\t\tconsole.error(`Failed to create object store for key: ${key}`, err)\n\t\t// Fall back to a basic implementation that won't throw\n\t\tconst fallbackStore = SchmancyStoreObject.getInstance<T>(\n\t\t\t'memory', // Fallback to memory storage\n\t\t\t`${key}-fallback`,\n\t\t\tinitialData,\n\t\t)\n\t\tconsole.warn(`Using fallback memory store for key: ${key}`)\n\t\treturn fallbackStore\n\t}\n}\n\n/**\n * Creates a collection store with better typing and error handling\n */\nfunction createCollectionStore<V>(\n\tinitialData: Map<string, V>,\n\tstorage: StorageType,\n\tkey: string,\n): ICollectionStore<V> & SchmancyCollectionStore<V> {\n\ttry {\n\t\t// Create the store instance\n\t\tconst store = SchmancyCollectionStore.getInstance(storage, key, initialData)\n\n\t\t// Initialize with provided data if store is empty\n\t\tif (!store.value.size) {\n\t\t\t// Create a new Map instance to avoid modifying the input\n\t\t\tstore.replace(new Map(initialData))\n\t\t}\n\n\t\treturn store\n\t} catch (err) {\n\t\tconsole.error(`Failed to create collection store for key: ${key}`, err)\n\t\t// Fall back to a basic implementation that won't throw\n\t\tconst fallbackStore = SchmancyCollectionStore.getInstance<V>(\n\t\t\t'memory', // Fallback to memory storage\n\t\t\t`${key}-fallback`,\n\t\t\tnew Map(initialData),\n\t\t)\n\t\tconsole.warn(`Using fallback memory store for key: ${key}`)\n\t\treturn fallbackStore\n\t}\n}\n\n/**\n * Creates an array store with better typing and error handling\n */\nfunction createArrayStore<T>(\n\tinitialData: T[],\n\tstorage: StorageType,\n\tkey: string,\n): IArrayStore<T> & SchmancyArrayStore<T> {\n\ttry {\n\t\t// Create the store instance\n\t\tconst store = SchmancyArrayStore.getInstance(storage, key, initialData)\n\n\t\t// Initialize with provided data if store is empty\n\t\tif (!store.value.length) {\n\t\t\t// Create a new array instance to avoid modifying the input\n\t\t\tstore.replace([...initialData])\n\t\t}\n\n\t\treturn store\n\t} catch (err) {\n\t\tconsole.error(`Failed to create array store for key: ${key}`, err)\n\t\t// Fall back to a basic implementation that won't throw\n\t\tconst fallbackStore = SchmancyArrayStore.getInstance<T>(\n\t\t\t'memory', // Fallback to memory storage\n\t\t\t`${key}-fallback`,\n\t\t\t[...initialData],\n\t\t)\n\t\tconsole.warn(`Using fallback memory store for key: ${key}`)\n\t\treturn fallbackStore\n\t}\n}\n\n// Function overloads for better type inference\n/**\n * Creates a context for managing object state\n * @param initialData The initial object data\n * @param storage Storage type to use\n * @param key Unique key for the store\n * @returns A store instance for the object\n */\nexport function createContext<T extends Record<string, any>>(\n\tinitialData: T,\n\tstorage: StorageType,\n\tkey: string,\n): IStore<T> & SchmancyStoreObject<T>\n\n/**\n * Creates a context for managing collection state\n * @param initialData The initial Map collection\n * @param storage Storage type to use\n * @param key Unique key for the store\n * @returns A collection store instance\n */\nexport function createContext<V>(\n\tinitialData: Map<string, V>,\n\tstorage: StorageType,\n\tkey: string,\n): ICollectionStore<V> & SchmancyCollectionStore<V>\n\n/**\n * Creates a context for managing array state\n * @param initialData The initial array\n * @param storage Storage type to use\n * @param key Unique key for the store\n * @returns An array store instance\n */\nexport function createContext<T>(\n\tinitialData: T[],\n\tstorage: StorageType,\n\tkey: string,\n): IArrayStore<T> & SchmancyArrayStore<T>\n\n/**\n * Implementation of the createContext function with complete type checking\n * and robust error handling\n */\nexport function createContext<T extends Record<string, any> | Map<string, any> | any[]>(\n\tinitialData: T,\n\tstorage: StorageType,\n\tkey: string,\n):\n\t| (IStore<T> & SchmancyStoreObject<T>)\n\t| (ICollectionStore<any> & SchmancyCollectionStore<any>)\n\t| (IArrayStore<any> & SchmancyArrayStore<any>) {\n\ttry {\n\t\t// Validate input\n\t\tif (initialData === null || initialData === undefined) {\n\t\t\tconsole.error('Initial data cannot be null or undefined')\n\t\t\t// Provide a sensible default based on type expected\n\t\t\tif (key.includes('collection') || key.includes('map')) {\n\t\t\t\tinitialData = new Map() as unknown as T\n\t\t\t} else if (key.includes('array') || key.includes('list')) {\n\t\t\t\tinitialData = [] as unknown as T\n\t\t\t} else {\n\t\t\t\tinitialData = {} as T\n\t\t\t}\n\t\t}\n\n\t\t// Determine store type based on input data with improved type checking\n\t\tif (isMap<string, any>(initialData)) {\n\t\t\treturn createCollectionStore<any>(initialData, storage, key)\n\t\t} else if (isArray<any>(initialData)) {\n\t\t\treturn createArrayStore<any>(initialData, storage, key)\n\t\t} else if (typeof initialData === 'object') {\n\t\t\treturn createObjectStore<any>(initialData as Record<string, any>, storage, key)\n\t\t} else {\n\t\t\t// Handle non-object data by wrapping it\n\t\t\tconsole.warn(`Initial data must be an object, array, or Map. Got ${typeof initialData}. Creating object wrapper.`)\n\t\t\treturn createObjectStore<any>({ value: initialData } as Record<string, any>, storage, key)\n\t\t}\n\t} catch (error) {\n\t\t// Last-resort error handling\n\t\tconsole.error(`Fatal error creating context for ${key}:`, error)\n\n\t\t// Create an emergency fallback store that won't throw\n\t\treturn createObjectStore<any>(\n\t\t\ttypeof initialData === 'object' && initialData !== null ? { ...initialData } : { value: initialData },\n\t\t\t'memory',\n\t\t\t`emergency-fallback-${key}`,\n\t\t)\n\t}\n}\n\n/**\n * Creates an array context with simplified API and type inference\n * @param initialData The initial array data\n * @param key Unique key for the store\n * @param storage Storage type to use (defaults to 'local')\n * @returns An array store instance\n */\nexport function createArrayContext<T>(\n\tinitialData: T[] = [],\n\tkey: string,\n\tstorage: StorageType = 'local',\n): IArrayStore<T> & SchmancyArrayStore<T> {\n\ttry {\n\t\treturn createContext<T>(initialData, storage, key)\n\t} catch (err) {\n\t\tconsole.error(`Failed to create array context for key: ${key}`, err)\n\t\t// Return a fallback store\n\t\treturn createArrayStore<T>(initialData, 'memory', `${key}-fallback`)\n\t}\n}\n\n/**\n * Creates a testable array context\n * @param initialData The initial array data\n * @param key Unique key for the store\n * @returns An array store that uses memory storage\n */\nexport function createTestArrayContext<T>(\n\tinitialData: T[] = [],\n\tkey: string = 'test-array',\n): IArrayStore<T> & SchmancyArrayStore<T> {\n\ttry {\n\t\treturn createContext<T>(initialData, 'memory', key)\n\t} catch (err) {\n\t\tconsole.error(`Failed to create test array context for key: ${key}`, err)\n\t\t// Return a fallback store with a different key\n\t\treturn createArrayStore<T>(initialData, 'memory', `${key}-emergency-fallback`)\n\t}\n}\n","// src/store/filter-directive.ts\n\n/** Supported comparison operators with TypeScript literal types */\nexport type ComparisonOperator =\n\t| '=='\n\t| '!='\n\t| '>'\n\t| '<'\n\t| '>='\n\t| '<='\n\t| 'includes'\n\t| 'notIncludes'\n\t| 'startsWith'\n\t| 'endsWith'\n\t| 'in'\n\t| 'notIn'\n\t| 'any' // fuzzy search operator\n\n/**\n * Type-safe condition tuple\n */\nexport type ConditionTuple = [field: string, op: ComparisonOperator, expected: unknown, strict?: boolean]\n\n/**\n * Type-safe condition object\n */\nexport interface ConditionObject {\n\tkey: string\n\toperator: ComparisonOperator\n\tvalue: unknown\n\tstrict?: boolean\n}\n\n/**\n * Unified query condition type\n */\nexport type QueryCondition = ConditionTuple | ConditionObject\n\n/**\n * Filter result with item and score\n */\nexport interface ScoredItem<T> {\n\titem: T\n\tscore: number\n}\n\n/**\n * Get a nested value from an object using a dot-separated path.\n * Checks explicitly for null/undefined so falsy values like 0 or false are preserved.\n */\nexport const getFieldValue = <T = any>(item: Record<string, any>, path: string): T => {\n\tif (!path) return item as unknown as T\n\n\tconst parts = path.split('.')\n\tlet value: any = item\n\n\tfor (const part of parts) {\n\t\tif (value == null) return undefined as unknown as T\n\t\tvalue = value[part]\n\t}\n\n\treturn value as T\n}\n\n/**\n * Compute the Levenshtein distance between two strings.\n */\nconst levenshtein = (a: string, b: string): number => {\n\tif (a === b) return 0\n\n\tconst matrix: number[][] = Array(b.length + 1)\n\t\t.fill(null)\n\t\t.map((_, i) => [i])\n\n\t// initialize the first row\n\tfor (let j = 0; j <= a.length; j++) {\n\t\tmatrix[0][j] = j\n\t}\n\n\tfor (let i = 1; i <= b.length; i++) {\n\t\tfor (let j = 1; j <= a.length; j++) {\n\t\t\tif (b.charAt(i - 1) === a.charAt(j - 1)) {\n\t\t\t\tmatrix[i][j] = matrix[i - 1][j - 1]\n\t\t\t} else {\n\t\t\t\tmatrix[i][j] = Math.min(\n\t\t\t\t\tmatrix[i - 1][j] + 1, // deletion\n\t\t\t\t\tmatrix[i][j - 1] + 1, // insertion\n\t\t\t\t\tmatrix[i - 1][j - 1] + 1, // substitution\n\t\t\t\t)\n\t\t\t}\n\t\t}\n\t}\n\treturn matrix[b.length][a.length]\n}\n\n/**\n * Check if string `sub` is a subsequence of string `str`.\n * All characters in `sub` must appear in order in `str` (they need not be contiguous).\n */\nconst isSubsequence = (sub: string, str: string): boolean => {\n\tif (!sub) return true\n\tif (!str) return false\n\n\tlet i = 0,\n\t\tj = 0\n\twhile (i < sub.length && j < str.length) {\n\t\tif (sub[i].toLowerCase() === str[j].toLowerCase()) i++\n\t\tj++\n\t}\n\treturn i === sub.length\n}\n\n/**\n * Check if every character (with frequency) in the query exists in the target.\n * For example, \"aovc\" matches \"avocados\".\n */\nconst anagramMatch = (query: string, target: string): boolean => {\n\tif (!query) return true\n\tif (!target) return false\n\n\tconst countChars = (s: string): Record<string, number> =>\n\t\ts\n\t\t\t.toLowerCase()\n\t\t\t.split('')\n\t\t\t.reduce(\n\t\t\t\t(acc, char) => {\n\t\t\t\t\tacc[char] = (acc[char] || 0) + 1\n\t\t\t\t\treturn acc\n\t\t\t\t},\n\t\t\t\t{} as Record<string, number>,\n\t\t\t)\n\n\tconst queryCount = countChars(query)\n\tconst targetCount = countChars(target)\n\treturn Object.keys(queryCount).every(char => (targetCount[char] || 0) >= queryCount[char])\n}\n\n/**\n * Generate bigrams for a string.\n */\nconst getBigrams = (s: string): string[] => {\n\tif (!s || s.length < 2) return []\n\n\tconst bigrams: string[] = []\n\tfor (let i = 0; i < s.length - 1; i++) {\n\t\tbigrams.push(s.substring(i, i + 2).toLowerCase())\n\t}\n\treturn bigrams\n}\n\n/**\n * Compute Dice's coefficient for two strings based on bigrams.\n * Returns a value between 0 (no similarity) and 1 (perfect match).\n */\nconst diceCoefficient = (s1: string, s2: string): number => {\n\tif (!s1 || !s2 || s1.length < 2 || s2.length < 2) return 0\n\n\tconst bigrams1 = getBigrams(s1)\n\tconst bigrams2 = getBigrams(s2)\n\n\tif (bigrams1.length === 0 || bigrams2.length === 0) return 0\n\n\tlet intersection = 0\n\tconst used = new Array(bigrams2.length).fill(false)\n\n\tfor (const bigram of bigrams1) {\n\t\tfor (let i = 0; i < bigrams2.length; i++) {\n\t\t\tif (!used[i] && bigrams2[i] === bigram) {\n\t\t\t\tintersection++\n\t\t\t\tused[i] = true\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n\n\treturn (2 * intersection) / (bigrams1.length + bigrams2.length)\n}\n\n/**\n * Compute a fuzzy similarity score between two strings.\n * The score is computed by taking the maximum of several methods:\n * - Direct substring match (score 1)\n * - Subsequence check (score 0.8)\n * - Anagram subset match (score 0.7)\n * - Dice coefficient\n * - Normalized Levenshtein similarity\n */\nconst computeFuzzyScore = (actual: string, expected: string): number => {\n\tif (!actual || !expected) return 0\n\n\tconst a = actual.toLowerCase().trim()\n\tconst b = expected.toLowerCase().trim()\n\n\tif (a === b) return 1\n\n\tconst substringScore = a.includes(b) ? 1 : 0\n\tconst subsequenceScore = isSubsequence(b, a) ? 0.8 : 0\n\tconst anagramScore = anagramMatch(b, a) ? 0.7 : 0\n\tconst diceScore = diceCoefficient(a, b)\n\n\tconst maxLen = Math.max(a.length, b.length)\n\tconst levenshteinScore = maxLen ? 1 - levenshtein(a, b) / maxLen : 0\n\n\treturn Math.max(substringScore, subsequenceScore, anagramScore, diceScore, levenshteinScore)\n}\n\n/**\n * Safely coerce value to string if possible, or return empty string\n */\nconst safeString = (value: unknown): string => {\n\tif (value == null) return ''\n\treturn String(value)\n}\n\n/**\n * Apply a query condition to an item and return score\n */\nfunction applyQueryCondition<T extends Record<string, any>>(\n\titem: T,\n\tquery: QueryCondition,\n\tfuzzyThreshold: number = 0.3,\n): { valid: boolean; score: number } {\n\tlet field: string,\n\t\top: ComparisonOperator,\n\t\texpected: unknown,\n\t\tstrict = false\n\n\tif (Array.isArray(query)) {\n\t\t;[field, op, expected, strict = false] = query\n\t} else {\n\t\tfield = query.key\n\t\top = query.operator\n\t\texpected = query.value\n\t\tstrict = query.strict || false\n\t}\n\n\t// Skip empty filters for non-strict queries\n\tif (!strict && (expected === '' || expected == null || (isArray(expected) && expected.length === 0))) {\n\t\treturn { valid: true, score: 1 }\n\t}\n\n\tconst actual = getFieldValue(item, field)\n\n\t// FIXED: Properly handle strict mode\n\tif (strict) {\n\t\t// For strict mode, use exact equality comparison for all operators except 'any'\n\t\tif (op === 'any') {\n\t\t\t// Fuzzy search still applies with strict mode\n\t\t\tif (typeof actual !== 'string' || typeof expected !== 'string') {\n\t\t\t\treturn { valid: false, score: 0 }\n\t\t\t}\n\n\t\t\tconst score = computeFuzzyScore(actual, expected)\n\t\t\treturn {\n\t\t\t\tvalid: score >= fuzzyThreshold,\n\t\t\t\tscore: score >= fuzzyThreshold ? score : 0,\n\t\t\t}\n\t\t} else {\n\t\t\t// For all other operators in strict mode,\n\t\t\t// delegate to compareValues function but return precise scores\n\t\t\tconst matches = compareValues(op, actual, expected)\n\t\t\treturn {\n\t\t\t\tvalid: matches,\n\t\t\t\tscore: matches ? 1 : 0,\n\t\t\t}\n\t\t}\n\t} else if (op === 'any') {\n\t\t// Fuzzy search requires both values to be strings\n\t\tif (typeof actual !== 'string' || typeof expected !== 'string') {\n\t\t\treturn { valid: false, score: 0 }\n\t\t}\n\n\t\tconst score = computeFuzzyScore(actual, expected)\n\t\tif (score < fuzzyThreshold) {\n\t\t\treturn { valid: false, score: 0 }\n\t\t}\n\n\t\treturn { valid: true, score }\n\t} else {\n\t\t// For non-fuzzy operators, check condition\n\t\tconst matches = compareValues(op, actual, expected)\n\t\treturn {\n\t\t\tvalid: matches,\n\t\t\tscore: matches ? 1 : 0,\n\t\t}\n\t}\n}\n\n/**\n * Filter a Map of items given an array of query conditions.\n * For each query condition:\n * - If the expected value is empty/null/undefined, it is treated as a match.\n * - For non-fuzzy operators, the condition must strictly match.\n * - For the \"any\" operator, a fuzzy similarity score is computed.\n * Items with a fuzzy score below a given threshold (e.g., 0.3) are excluded.\n *\n * The overall item score is the average of the scores from all conditions.\n * The results are sorted in descending order of relevance.\n *\n * @param items - A Map containing items to filter.\n * @param queries - An array of query conditions to apply.\n * @param fuzzyThreshold - Minimum score required for fuzzy matches (default: 0.3)\n * @returns An array of items that match all query conditions, sorted by relevance.\n */\nexport function filterMapItems<T extends Record<string, any>>(\n\titems: Map<string, T>,\n\tqueries: QueryCondition[] = [],\n\tfuzzyThreshold: number = 0.3,\n): T[] {\n\t// If no queries, return all items unsorted\n\tif (!queries.length) {\n\t\treturn Array.from(items.values())\n\t}\n\n\t// Score and filter each item\n\tconst scoredItems: ScoredItem<T>[] = []\n\n\tfor (const [_, item] of items.entries()) {\n\t\tlet totalScore = 0\n\t\tlet matchCount = 0\n\t\tlet valid = true\n\n\t\tfor (const query of queries) {\n\t\t\tconst result = applyQueryCondition(item, query, fuzzyThreshold)\n\n\t\t\tif (!result.valid) {\n\t\t\t\tvalid = false\n\t\t\t\tbreak\n\t\t\t}\n\n\t\t\ttotalScore += result.score\n\t\t\tmatchCount++\n\t\t}\n\n\t\tif (valid) {\n\t\t\tscoredItems.push({\n\t\t\t\titem,\n\t\t\t\tscore: matchCount > 0 ? totalScore / matchCount : 1,\n\t\t\t})\n\t\t}\n\t}\n\n\t// Sort by descending score\n\tscoredItems.sort((a, b) => b.score - a.score)\n\n\treturn scoredItems.map(x => x.item)\n}\n\n/**\n * Filter an array of items using query conditions\n */\nexport function filterArrayItems<T extends Record<string, any>>(\n\titems: T[],\n\tqueries: QueryCondition[] = [],\n\tfuzzyThreshold: number = 0.3,\n): T[] {\n\t// Create temporary map with numeric indices as keys\n\tconst map = new Map<string, T>()\n\titems.forEach((item, index) => map.set(String(index), item))\n\n\treturn filterMapItems(map, queries, fuzzyThreshold)\n}\n\n// Improved type guards for filter-directive.ts\n\n/**\n * Type guard for checking if a value is an array with better type inference\n * @param value Value to check\n * @returns True if the value is an array\n */\nexport function isArray<T = unknown>(value: unknown): value is Array<T> {\n\treturn Array.isArray(value)\n}\n\n/**\n * Type guard for checking if a value is a string\n * @param value Value to check\n * @returns True if the value is a string\n */\nexport function isString(value: unknown): value is string {\n\treturn typeof value === 'string'\n}\n\n/**\n * Type guard for checking if a value is a number\n * @param value Value to check\n * @returns True if the value is a number and not NaN\n */\nexport function isNumber(value: unknown): value is number {\n\treturn typeof value === 'number' && !isNaN(value)\n}\n\n/**\n * Type guard for checking if a value is a date\n * @param value Value to check\n * @returns True if the value is a valid Date object\n */\nexport function isDate(value: unknown): value is Date {\n\treturn value instanceof Date && !isNaN(value.getTime())\n}\n\n/**\n * Type guard for checking if a value is an iterable collection\n * @param value Value to check\n * @returns True if the value implements the iterable protocol\n */\nexport function isIterable<T = unknown>(value: unknown): value is Iterable<T> {\n\t// Must be non-null and of type 'object'\n\tif (value == null || typeof value !== 'object') {\n\t\treturn false\n\t}\n\n\t// Check for Symbol.iterator method\n\treturn Symbol.iterator in Object(value) && typeof (value as any)[Symbol.iterator] === 'function'\n}\n\n/**\n * Type guard for checking if a value is a Map\n * @param value Value to check\n * @returns True if the value is a Map\n */\nexport function isMap<K = unknown, V = unknown>(value: unknown): value is Map<K, V> {\n\treturn value instanceof Map\n}\n\n/**\n * Type guard for checking if a value is a Set\n * @param value Value to check\n * @returns True if the value is a Set\n */\nexport function isSet<T = unknown>(value: unknown): value is Set<T> {\n\treturn value instanceof Set\n}\n\n/**\n * Type guard for checking if a value is a plain object (not an array, Map, etc.)\n * @param value Value to check\n * @returns True if the value is a plain object\n */\nexport function isPlainObject(value: unknown): value is Record<string, unknown> {\n\tif (value === null || typeof value !== 'object') {\n\t\treturn false\n\t}\n\n\tconst proto = Object.getPrototypeOf(value)\n\treturn proto === Object.prototype || proto === null\n}\n\n/**\n * Type guard for checking if a value is undefined or null\n * @param value Value to check\n * @returns True if the value is undefined or null\n */\nexport function isNil(value: unknown): value is undefined | null {\n\treturn value === undefined || value === null\n}\n\n/**\n * Improved type-safe comparison function that uses appropriate type guards\n * @param op Comparison operator\n * @param actual Actual value\n * @param expected Expected value\n * @returns Result of the comparison\n */\nexport function compareValues(op: ComparisonOperator, actual: unknown, expected: unknown): boolean {\n\t// Handle null/undefined cases\n\tif (isNil(actual) && isNil(expected)) return true\n\tif (isNil(actual) || isNil(expected)) {\n\t\t// For equality operators, null == null but null != non-null\n\t\tif (op === '==') return actual === expected\n\t\tif (op === '!=') return actual !== expected\n\t\t// Other operators should return false for null/undefined values\n\t\treturn false\n\t}\n\n\tswitch (op) {\n\t\tcase '==':\n\t\t\treturn actual === expected\n\t\tcase '!=':\n\t\t\treturn actual !== expected\n\t\tcase '>':\n\t\t\tif (isNumber(actual) && isNumber(expected)) {\n\t\t\t\treturn actual > expected\n\t\t\t}\n\t\t\tif (isDate(actual) && isDate(expected)) {\n\t\t\t\treturn actual.getTime() > expected.getTime()\n\t\t\t}\n\t\t\tif (isString(actual) && isString(expected)) {\n\t\t\t\treturn actual.localeCompare(expected) > 0\n\t\t\t}\n\t\t\treturn false\n\t\tcase '<':\n\t\t\tif (isNumber(actual) && isNumber(expected)) {\n\t\t\t\treturn actual < expected\n\t\t\t}\n\t\t\tif (isDate(actual) && isDate(expected)) {\n\t\t\t\treturn actual.getTime() < expected.getTime()\n\t\t\t}\n\t\t\tif (isString(actual) && isString(expected)) {\n\t\t\t\treturn actual.localeCompare(expected) < 0\n\t\t\t}\n\t\t\treturn false\n\t\tcase '>=':\n\t\t\tif (isNumber(actual) && isNumber(expected)) {\n\t\t\t\treturn actual >= expected\n\t\t\t}\n\t\t\tif (isDate(actual) && isDate(expected)) {\n\t\t\t\treturn actual.getTime() >= expected.getTime()\n\t\t\t}\n\t\t\tif (isString(actual) && isString(expected)) {\n\t\t\t\treturn actual.localeCompare(expected) >= 0\n\t\t\t}\n\t\t\treturn false\n\t\tcase '<=':\n\t\t\tif (isNumber(actual) && isNumber(expected)) {\n\t\t\t\treturn actual <= expected\n\t\t\t}\n\t\t\tif (isDate(actual) && isDate(expected)) {\n\t\t\t\treturn actual.getTime() <= expected.getTime()\n\t\t\t}\n\t\t\tif (isString(actual) && isString(expected)) {\n\t\t\t\treturn actual.localeCompare(expected) <= 0\n\t\t\t}\n\t\t\treturn false\n\t\tcase 'includes': {\n\t\t\tif (isString(actual)) {\n\t\t\t\treturn actual.toLowerCase().includes(safeString(expected).toLowerCase())\n\t\t\t}\n\t\t\tif (isArray(actual)) {\n\t\t\t\treturn actual.includes(expected as any)\n\t\t\t}\n\t\t\tif (isSet(actual)) {\n\t\t\t\treturn actual.has(expected as any)\n\t\t\t}\n\t\t\tif (isMap(actual)) {\n\t\t\t\treturn Array.from(actual.values()).includes(expected as any)\n\t\t\t}\n\t\t\treturn false\n\t\t}\n\t\tcase 'notIncludes': {\n\t\t\tif (isString(actual)) {\n\t\t\t\treturn !actual.toLowerCase().includes(safeString(expected).toLowerCase())\n\t\t\t}\n\t\t\tif (isArray(actual)) {\n\t\t\t\treturn !actual.includes(expected as any)\n\t\t\t}\n\t\t\tif (isSet(actual)) {\n\t\t\t\treturn !actual.has(expected as any)\n\t\t\t}\n\t\t\tif (isMap(actual)) {\n\t\t\t\treturn !Array.from(actual.values()).includes(expected as any)\n\t\t\t}\n\t\t\treturn true\n\t\t}\n\t\tcase 'startsWith': {\n\t\t\tif (isString(actual) && isString(expected)) {\n\t\t\t\treturn actual.toLowerCase().startsWith(expected.toLowerCase())\n\t\t\t}\n\t\t\treturn false\n\t\t}\n\t\tcase 'endsWith': {\n\t\t\tif (isString(actual) && isString(expected)) {\n\t\t\t\treturn actual.toLowerCase().endsWith(expected.toLowerCase())\n\t\t\t}\n\t\t\treturn false\n\t\t}\n\t\tcase 'in': {\n\t\t\tif (isArray(expected)) {\n\t\t\t\treturn expected.includes(actual as any)\n\t\t\t}\n\t\t\tif (isSet(expected)) {\n\t\t\t\treturn expected.has(actual as any)\n\t\t\t}\n\t\t\tif (isMap(expected)) {\n\t\t\t\treturn expected.has(actual as any) || Array.from(expected.values()).includes(actual as any)\n\t\t\t}\n\t\t\treturn false\n\t\t}\n\t\tcase 'notIn': {\n\t\t\tif (isArray(expected)) {\n\t\t\t\treturn !expected.includes(actual as any)\n\t\t\t}\n\t\t\tif (isSet(expected)) {\n\t\t\t\treturn !expected.has(actual as any)\n\t\t\t}\n\t\t\tif (isMap(expected)) {\n\t\t\t\treturn !expected.has(actual as any) && !Array.from(expected.values()).includes(actual as any)\n\t\t\t}\n\t\t\treturn true\n\t\t}\n\t\tdefault: {\n\t\t\tconsole.warn(`Operator \"${op}\" is not supported in comparison.`)\n\t\t\treturn false\n\t\t}\n\t}\n}\n\n// Export a simpler alias for filterMapItems\nexport const filterMap = filterMapItems\n\n// Export an alias for filterArrayItems\nexport const filterArray = filterArrayItems\n","// src/store/selectors.ts\nimport { Observable, combineLatest, distinctUntilChanged, map, share, shareReplay } from 'rxjs'\nimport { IStore, ICollectionStore } from './types'\n\n/**\n * Deep equality comparison for maps and complex objects\n * More efficient than JSON.stringify for large objects\n */\nfunction deepEqual(a: unknown, b: unknown): boolean {\n\tif (a === b) return true\n\n\tif (a instanceof Map && b instanceof Map) {\n\t\tif (a.size !== b.size) return false\n\t\tfor (const [key, value] of a) {\n\t\t\tif (!b.has(key) || !deepEqual(value, b.get(key))) return false\n\t\t}\n\t\treturn true\n\t}\n\n\tif (a instanceof Set && b instanceof Set) {\n\t\tif (a.size !== b.size) return false\n\t\tfor (const item of a) {\n\t\t\tif (!b.has(item)) return false\n\t\t}\n\t\treturn true\n\t}\n\n\tif (typeof a === 'object' && a !== null && typeof b === 'object' && b !== null) {\n\t\tconst keysA = Object.keys(a)\n\t\tconst keysB = Object.keys(b)\n\n\t\tif (keysA.length !== keysB.length) return false\n\n\t\tfor (const key of keysA) {\n\t\t\t// @ts-ignore: Index signature\n\t\t\tif (!deepEqual(a[key], b[key])) return false\n\t\t}\n\n\t\treturn true\n\t}\n\n\treturn false\n}\n\n/**\n * Creates a selector that derives a value from store state\n *\n * @param store The store to observe\n * @param selectorFn Function that transforms the state\n * @returns An observable of the selected state that only emits when the derived value changes\n */\nexport function createSelector<T, R>(store: IStore<T>, selectorFn: (state: T) => R): Observable<R> {\n\treturn store.$.pipe(map(selectorFn), distinctUntilChanged<R>(deepEqual), shareReplay(1))\n}\n\n/**\n * Creates a selector for collection stores that derives a value from the collection\n *\n * @param store The collection store to observe\n * @param selectorFn Function that transforms the collection\n * @returns An observable of the selected state that only emits when the derived value changes\n */\nexport function createCollectionSelector<T, R>(\n\tstore: ICollectionStore<T>,\n\tselectorFn: (state: Map<string, T>) => R,\n): Observable<R> {\n\treturn store.$.pipe(map(selectorFn), distinctUntilChanged<R>(deepEqual), shareReplay(1))\n}\n\n/**\n * Creates a selector that returns all items from a collection as an array\n *\n * @param store The collection store\n * @returns An observable of all items as an array\n */\nexport function createItemsSelector<T>(store: ICollectionStore<T>): Observable<T[]> {\n\treturn createCollectionSelector(store, collection => Array.from(collection.values()))\n}\n\n/**\n * Creates a selector that retrieves a single item from a collection\n *\n * @param store The collection store\n * @param itemKey The key of the item to select\n * @returns An observable of the selected item that emits when the item changes\n */\nexport function createItemSelector<T>(store: ICollectionStore<T>, itemKey: string): Observable<T | undefined> {\n\treturn createCollectionSelector(store, collection => collection.get(itemKey))\n}\n\n/**\n * Creates a compound selector that depends on multiple other selectors\n *\n * @param selectors Array of source selectors\n * @param combinerFn Function that combines all selector results\n * @returns An observable of the combined result\n */\nexport function createCompoundSelector<T extends unknown[], R>(\n\tselectors: { [K in keyof T]: Observable<T[K]> },\n\tcombinerFn: (...values: T) => R,\n): Observable<R> {\n\treturn combineLatest(selectors).pipe(\n\t\tmap(values => combinerFn(...(values as T))),\n\t\tdistinctUntilChanged<R>(deepEqual),\n\t\tshareReplay(1),\n\t)\n}\n\n/**\n * Creates a selector that returns all keys from a collection\n */\nexport function createKeysSelector<T>(store: ICollectionStore<T>): Observable<string[]> {\n\treturn createCollectionSelector(store, collection => Array.from(collection.keys()))\n}\n\n/**\n * Creates a selector that returns entries (key-value pairs) from a collection\n */\nexport function createEntriesSelector<T>(store: ICollectionStore<T>): Observable<[string, T][]> {\n\treturn createCollectionSelector(store, collection => Array.from(collection.entries()))\n}\n\n/**\n * Creates a selector that sorts collection items\n */\nexport function createSortSelector<T>(store: ICollectionStore<T>, compareFn: (a: T, b: T) => number): Observable<T[]> {\n\treturn createCollectionSelector(store, collection => {\n\t\treturn Array.from(collection.values()).sort(compareFn)\n\t})\n}\n\n/**\n * Creates a selector that finds the first item matching a predicate\n */\nexport function createFindSelector<T>(\n\tstore: ICollectionStore<T>,\n\tpredicate: (item: T, key: string) => boolean,\n): Observable<T | undefined> {\n\treturn createCollectionSelector(store, collection => {\n\t\tfor (const [key, item] of collection.entries()) {\n\t\t\tif (predicate(item, key)) {\n\t\t\t\treturn item\n\t\t\t}\n\t\t}\n\t\treturn undefined\n\t})\n}\n\n/**\n * Creates a selector that filters items from a collection - OPTIMIZED\n *\n * @param store The collection store\n * @param filterFn Function that returns true for items to include\n * @returns An observable of filtered items as an array\n */\nexport function createFilterSelector<T>(\n\tstore: ICollectionStore<T>,\n\tfilterFn: (item: T, key: string) => boolean,\n): Observable<T[]> {\n\treturn createCollectionSelector(store, collection =>\n\t\tArray.from(collection.entries())\n\t\t\t.filter(([key, item]) => filterFn(item, key))\n\t\t\t.map(([_, item]) => item),\n\t)\n}\n\n/**\n * Creates a selector that maps collection values through a transform function - OPTIMIZED\n */\nexport function createMapSelector<T, R>(\n\tstore: ICollectionStore<T>,\n\tmapFn: (item: T, key: string) => R,\n): Observable<R[]> {\n\treturn createCollectionSelector(store, collection =>\n\t\tArray.from(collection.entries()).map(([key, item]) => mapFn(item, key)),\n\t)\n}\n\n/**\n * Creates a selector that counts items in a collection, optionally filtered - OPTIMIZED\n *\n * @param store The collection store\n * @param filterFn Optional function to filter which items to count\n * @returns An observable of the count\n */\nexport function createCountSelector<T>(\n\tstore: ICollectionStore<T>,\n\tfilterFn?: (item: T, key: string) => boolean,\n): Observable<number> {\n\treturn createCollectionSelector(store, collection => {\n\t\tif (!filterFn) return collection.size\n\n\t\treturn Array.from(collection.entries()).filter(([key, item]) => filterFn(item, key)).length\n\t})\n}\n\n/**\n * Optimized RxJS Pipeline - use share with reset on refCount zero for better memory management\n * in scenarios where selector subscriptions come and go\n *\n * @param store The store to observe\n * @param selectorFn Function that transforms the state\n * @returns An observable of the selected state with improved memory management\n */\nexport function createOptimizedSelector<T, R>(store: IStore<T>, selectorFn: (state: T) => R): Observable<R> {\n\treturn store.$.pipe(\n\t\tmap(selectorFn),\n\t\tdistinctUntilChanged<R>(deepEqual),\n\t\tshare({\n\t\t\tresetOnRefCountZero: true,\n\t\t\tresetOnError: false,\n\t\t\tresetOnComplete: false,\n\t\t}),\n\t)\n}\n","// src/store/selector-hook.ts - Improved memory management\nimport { property as litProperty } from 'lit/decorators.js'\nimport { Observable, Subject, Subscription } from 'rxjs'\nimport { takeUntil } from 'rxjs/operators'\nimport { createCollectionSelector, createSelector } from './selectors'\nimport { ICollectionStore, IStore } from './types'\n\n/**\n * Symbol used for storing cleanup resources\n * Using a Symbol prevents name collisions with component properties\n */\nconst CLEANUP_SUBJECT = Symbol('selectorCleanup')\nconst SUBSCRIPTIONS = Symbol('selectorSubscriptions')\nconst INITIALIZED = Symbol('selectorInitialized')\n\n/**\n * Component lifecycle interface\n */\ninterface ComponentWithLifecycle {\n\t// Lifecycle hooks\n\tisConnected: boolean\n\tdisconnectedCallback?: () => void\n\tconnectedCallback?: () => void\n\trequestUpdate?: () => void\n\n\t// Internal properties using symbols to avoid name collisions\n\t[CLEANUP_SUBJECT]?: Subject<void>\n\t[SUBSCRIPTIONS]?: Map<string, Subscription>\n\t[INITIALIZED]?: Set<string>\n\n\t// Value storage\n\t[key: string]: any\n}\n\n/**\n * Property descriptor interface\n */\ntype PropertyDescriptor<T> = {\n\tget?: () => T\n\tset?: (value: T) => void\n\tvalue?: T\n\tconfigurable?: boolean\n\tenumerable?: boolean\n\twritable?: boolean\n}\n\n/**\n * Options for selecting from a store\n */\ninterface SelectOptions {\n\t/** If true, will wait for selector to emit a non-null value before calling connectedCallback */\n\trequired?: boolean\n\n\t/** If true, will only update the component and not set the property value */\n\tupdateOnly?: boolean\n\n\t/** If true, will use structuredClone to deeply clone values (prevents mutations) */\n\tdeepClone?: boolean\n\n\t/** Custom equality function to determine when to update */\n\tequals?: (a: any, b: any) => boolean\n\n\t/** Debug mode - logs selector activity */\n\tdebug?: boolean\n}\n\n/**\n * Type guard to check if a store is a collection store\n */\nfunction isCollectionStore<T>(store: IStore<any> | ICollectionStore<T>): store is ICollectionStore<T> {\n\treturn 'set' in store && typeof store.set === 'function' && store.value instanceof Map\n}\n\n/**\n * Ensures the cleanup resources exist on the component\n */\nfunction ensureCleanupResources(component: ComponentWithLifecycle): void {\n\tif (!component[CLEANUP_SUBJECT] || component[CLEANUP_SUBJECT].closed) {\n\t\tcomponent[CLEANUP_SUBJECT] = new Subject<void>()\n\t}\n\n\tif (!component[SUBSCRIPTIONS]) {\n\t\tcomponent[SUBSCRIPTIONS] = new Map()\n\t}\n\n\tif (!component[INITIALIZED]) {\n\t\tcomponent[INITIALIZED] = new Set()\n\t}\n}\n\n/**\n * Cleans up all selector resources\n */\nfunction cleanupSelectorResources(component: ComponentWithLifecycle): void {\n\tif (component[CLEANUP_SUBJECT]) {\n\t\tcomponent[CLEANUP_SUBJECT].next()\n\t\tcomponent[CLEANUP_SUBJECT].complete()\n\t\tcomponent[CLEANUP_SUBJECT] = undefined\n\t}\n\n\tif (component[SUBSCRIPTIONS]) {\n\t\tcomponent[SUBSCRIPTIONS].forEach(sub => sub.unsubscribe())\n\t\tcomponent[SUBSCRIPTIONS].clear()\n\t\tcomponent[SUBSCRIPTIONS] = undefined\n\t}\n\n\tif (component[INITIALIZED]) {\n\t\tcomponent[INITIALIZED].clear()\n\t\tcomponent[INITIALIZED] = undefined\n\t}\n}\n\n/**\n * Selector decorator that connects a component property to a store selector\n * with improved memory management\n *\n * @param store The store to select from\n * @param selectorFn Optional function to transform the store state\n * @param options Additional options for the selector\n */\nexport function select<T, R>(\n\tstore: IStore<T> | ICollectionStore<T>,\n\tselectorFn: (state: any) => R = (state: R) => state,\n\toptions: SelectOptions = {},\n) {\n\treturn function (proto: Record<string, any>, propName: string, _descriptor?: PropertyDescriptor<R>) {\n\t\t// Register as a Lit property\n\t\tlitProperty({ attribute: false, type: Object })(proto, propName)\n\n\t\t// Store original lifecycle methods\n\t\tconst originalConnectedCallback = proto.connectedCallback\n\t\tconst originalDisconnectedCallback = proto.disconnectedCallback\n\n\t\t// Override connectedCallback to set up subscription\n\t\tproto.connectedCallback = function (this: ComponentWithLifecycle) {\n\t\t\t// Initialize cleanup resources\n\t\t\tensureCleanupResources(this)\n\n\t\t\t// Create the appropriate selector\n\t\t\tconst selector: Observable<R> = isCollectionStore(store)\n\t\t\t\t? createCollectionSelector(store, selectorFn)\n\t\t\t\t: createSelector(store as IStore<T>, selectorFn)\n\n\t\t\t// Call original connectedCallback immediately if not waiting for data\n\t\t\tif (!options.required && !this[INITIALIZED]!.has(propName)) {\n\t\t\t\toriginalConnectedCallback?.call(this)\n\t\t\t\tthis[INITIALIZED]!.add(propName)\n\t\t\t}\n\n\t\t\t// Clean up any existing subscription\n\t\t\tif (this[SUBSCRIPTIONS]!.has(propName)) {\n\t\t\t\tthis[SUBSCRIPTIONS]!.get(propName)?.unsubscribe()\n\t\t\t\tthis[SUBSCRIPTIONS]!.delete(propName)\n\t\t\t}\n\n\t\t\t// Debug log if needed\n\t\t\tif (options.debug) {\n\t\t\t\tconsole.debug(`[select] Setting up subscription for ${propName}`)\n\t\t\t}\n\n\t\t\t// Create new subscription with better error handling\n\t\t\tconst subscription = selector.pipe(takeUntil(this[CLEANUP_SUBJECT]!)).subscribe({\n\t\t\t\tnext: (value: R) => {\n\t\t\t\t\t// Handle value updates\n\t\t\t\t\tconst newValue = options.deepClone ? structuredClone(value) : value\n\n\t\t\t\t\tif (options.debug) {\n\t\t\t\t\t\tconsole.debug(`[select] New value for ${propName}:`, newValue)\n\t\t\t\t\t}\n\n\t\t\t\t\tif (!options.updateOnly) {\n\t\t\t\t\t\tthis[propName] = newValue\n\t\t\t\t\t}\n\n\t\t\t\t\tthis.requestUpdate?.()\n\n\t\t\t\t\t// If required and not initialized, call connectedCallback when we get a value\n\t\t\t\t\tif (options.required && !this[INITIALIZED]!.has(propName) && newValue !== null && newValue !== undefined) {\n\t\t\t\t\t\tif (options.debug) {\n\t\t\t\t\t\t\tconsole.debug(`[select] Calling delayed connectedCallback for ${propName}`)\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\toriginalConnectedCallback?.call(this)\n\t\t\t\t\t\tthis[INITIALIZED]!.add(propName)\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\terror: (err: Error) => {\n\t\t\t\t\tconsole.error(`Error in selector subscription for ${propName}:`, err)\n\t\t\t\t\t// Resubscribe on error to prevent component from becoming unresponsive\n\t\t\t\t\tif (this.isConnected) {\n\t\t\t\t\t\t// Small delay to prevent immediate resubscription\n\t\t\t\t\t\tsetTimeout(() => {\n\t\t\t\t\t\t\tif (this.isConnected) {\n\t\t\t\t\t\t\t\tif (options.debug) {\n\t\t\t\t\t\t\t\t\tconsole.debug(`[select] Resubscribing after error for ${propName}`)\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tthis.connectedCallback?.()\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}, 1000)\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t})\n\n\t\t\t// Store the subscription for cleanup\n\t\t\tthis[SUBSCRIPTIONS]!.set(propName, subscription)\n\t\t}\n\n\t\t// Override disconnectedCallback to clean up subscriptions\n\t\tproto.disconnectedCallback = function (this: ComponentWithLifecycle) {\n\t\t\t// Call original disconnectedCallback\n\t\t\toriginalDisconnectedCallback?.call(this)\n\n\t\t\t// Debug log if needed\n\t\t\tif (options.debug) {\n\t\t\t\tconsole.debug(`[select] Cleaning up resources in disconnectedCallback`)\n\t\t\t}\n\n\t\t\t// Clean up all subscription resources\n\t\t\tcleanupSelectorResources(this)\n\t\t}\n\t}\n}\n\n/**\n * Creates a selector decorator that selects a specific item from a collection store\n * with improved memory management\n *\n * @param store The collection store\n * @param keyGetter Function that returns the key to select\n * @param options Additional options\n */\nexport function selectItem<T>(\n\tstore: ICollectionStore<T>,\n\tkeyGetter: (component: any) => string,\n\toptions: SelectOptions = {},\n) {\n\treturn function (proto: Record<string, any>, propName: string, _descriptor?: PropertyDescriptor<T | undefined>) {\n\t\tselect(\n\t\t\tstore,\n\t\t\tfunction (state) {\n\t\t\t\t// This will be evaluated during subscription, when 'this' is available\n\t\t\t\tconst itemKey = keyGetter(this)\n\t\t\t\treturn itemKey ? state.get(itemKey) : undefined\n\t\t\t},\n\t\t\toptions,\n\t\t)(proto, propName)\n\t}\n}\n"],"names":["createObjectStore","initialData","storage","key","value","Array","isArray","Map","Set","Date","RegExp","Object","getPrototypeOf","prototype","store","SchmancyStoreObject","getInstance","obj","keys","length","set","err","createArrayStore","SchmancyArrayStore","replace","createContext","includes","SchmancyCollectionStore","size","getFieldValue","item","path","parts","split","part","getBigrams","s","bigrams","i","push","substring","toLowerCase","computeFuzzyScore","actual","expected","a","trim","b","substringScore","subsequenceScore","sub","str","j","anagramScore","query","target","countChars","reduce","acc","char","queryCount","targetCount","every","diceScore","s1","s2","bigrams1","bigrams2","intersection","used","fill","bigram","maxLen","Math","max","levenshteinScore","matrix","map","_","charAt","min","safeString","String","applyQueryCondition","fuzzyThreshold","field","op","strict","operator","valid","score","matches","compareValues","t","filterMapItems","items","queries","from","values","scoredItems","entries","totalScore","matchCount","result","sort","x","filterArrayItems","forEach","index","isString","isNumber","isNaN","isDate","getTime","isMap","isSet","isNil","localeCompare","has","startsWith","endsWith","filterMap","filterArray","deepEqual","get","keysA","keysB","createSelector","selectorFn","$","pipe","distinctUntilChanged","shareReplay","createCollectionSelector","CLEANUP_SUBJECT","Symbol","SUBSCRIPTIONS","INITIALIZED","select","state","options","proto","propName","_descriptor","litProperty","attribute","type","originalConnectedCallback","connectedCallback","originalDisconnectedCallback","disconnectedCallback","component","this","closed","Subject","selector","required","call","add","unsubscribe","delete","debug","subscription","takeUntil","subscribe","next","newValue","deepClone","structuredClone","updateOnly","requestUpdate","error","isConnected","setTimeout","complete","clear","selectors","combinerFn","combineLatest","filterFn","collection","filter","predicate","itemKey","mapFn","share","resetOnRefCountZero","resetOnError","resetOnComplete","compareFn","iterator","keyGetter"],"mappings":"2IAkDA,SAASA,EACRC,EACAC,EACAC,EAEI,CAAA,GAAA,CAECD,IAAY,cAELA,EAAA,WAzBUE,EA6BFH,KA3BT,MACO,OAAVG,GAAU,UAChBC,MAAMC,QAAQF,CACbA,GAAAA,aAAiBG,KACjBH,aAAiBI,KACjBJ,aAAiBK,MACjBL,aAAiBM,QACnBC,OAAOC,eAAeR,CAAAA,IAAWO,OAAOE,aAsBzBZ,EAAA,CAAA,GAAKA,CAIpB,G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,EAAAA,qBAAwBR,CAAAA,EACxB8D,QAAM,CACLC,oBAAAA,GACAC,aAAAA,GACAC,gBAAAA,EAGH,CAAA,CAAA,CAAA,sDAzFgB,SAAsB9K,EAA4B+K,EAAAA,CAC1D,OAAAxD,EAAyBvH,EAAqBsK,GAC7C/K,MAAM4F,KAAKmF,EAAWlF,OAAAA,CAAAA,EAAUM,KAAKqF,CAAAA,CAAAA,CAE9C,iCF+IO,SACN5L,EAAmB,CAAA,EACnBE,EAAc,aAAA,CAEV,GACI,CAAA,OAAAsB,EAAiBxB,EAAa,SAAUE,CAAAA,OACvCkB,CAGR,OAAOC,EAAoBrB,EAAa,SAAU,GAAGE,CAAAA,qBAAAA,CAAwB,CAE/E,8KC2HO,SAAiCC,EAAAA,CAEvC,OAAIA,GAAS,MAAyB,OAAVA,GAAU,UAK/BmI,OAAOuD,YAAYnL,OAAOP,CAAqD,GAAA,OAAnCA,EAAcmI,OAAOuD,QACzE,GADuF,UACvF,2EAyBO,SAAuB1L,GAC7B,GAAIA,IAAU,MAAyB,OAAVA,GAAU,SAC/B,MAAA,GAGF,MAAAyI,EAAQlI,OAAOC,eAAeR,CAAAA,EAC7B,OAAAyI,IAAUlI,OAAOE,WAAagI,IAAU,IAChD,yEEvNO,SACN/H,EACAiL,EACAnD,EAAyB,CAAA,EAAA,CAElB,OAAA,SAAUC,EAA4BC,EAAkBC,EAC9DL,CAAAA,EACC5H,EACA,SAAU6H,EAEH,CAAA,MAAA4C,EAAUQ,EAAUvC,IAC1B,EAAA,OAAO+B,EAAU5C,EAAMf,IAAI2D,CAAAA,EAAAA,MAC5B,EACA3C,CAPDF,EAQEG,EAAOC,CAAAA,CACV,CACD"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"selector-hook-D_HTD-GV.js","sources":["../src/store/context-create.ts","../src/store/filter-directive.ts","../src/store/selectors.ts","../src/store/selector-hook.ts"],"sourcesContent":["// src/store/context-create.ts - Fixed version\n\nimport { SchmancyArrayStore } from './context-array'\nimport SchmancyCollectionStore from './context-collection'\nimport { SchmancyStoreObject } from './context-object'\nimport { IArrayStore, ICollectionStore, IStore, StorageType } from './types'\n\n/**\n * Type guard to check if an object is empty\n */\nfunction isEmptyObject(obj: unknown): boolean {\n\tif (typeof obj !== 'object' || obj === null) {\n\t\treturn false\n\t}\n\treturn Object.keys(obj).length === 0\n}\n\n/**\n * Type guard for Map objects\n */\nfunction isMap<K, V>(value: unknown): value is Map<K, V> {\n\treturn value instanceof Map\n}\n\n/**\n * Type guard for Array objects\n */\nfunction isArray<T>(value: unknown): value is Array<T> {\n\treturn Array.isArray(value)\n}\n\n/**\n * Type guard for plain objects (not arrays, maps, null, etc.)\n */\nfunction isPlainObject(value: unknown): boolean {\n\treturn (\n\t\tvalue !== null &&\n\t\ttypeof value === 'object' &&\n\t\t!Array.isArray(value) &&\n\t\t!(value instanceof Map) &&\n\t\t!(value instanceof Set) &&\n\t\t!(value instanceof Date) &&\n\t\t!(value instanceof RegExp) &&\n\t\tObject.getPrototypeOf(value) === Object.prototype\n\t)\n}\n\n/**\n * Creates a regular object store with better typing and error handling\n */\nfunction createObjectStore<T extends Record<string, any>>(\n\tinitialData: T,\n\tstorage: StorageType,\n\tkey: string,\n): IStore<T> & SchmancyStoreObject<T> {\n\ttry {\n\t\t// Validate storage type\n\t\tif (storage === 'indexeddb') {\n\t\t\tconsole.warn(`IndexedDB storage is not optimal for plain objects. Using 'local' instead for key: ${key}`)\n\t\t\tstorage = 'local'\n\t\t}\n\n\t\t// Ensure initialData is a plain object\n\t\tif (!isPlainObject(initialData)) {\n\t\t\tconsole.warn(`Initial data is not a plain object. Converting to object for key: ${key}`)\n\t\t\tinitialData = { ...initialData } as T\n\t\t}\n\n\t\t// Create the store instance\n\t\tconst store = SchmancyStoreObject.getInstance<T>(storage, key, initialData)\n\n\t\t// Initialize with provided data if store is empty\n\t\tif (isEmptyObject(store.value)) {\n\t\t\tstore.set({ ...initialData }) // Use spread to create a copy\n\t\t}\n\n\t\treturn store\n\t} catch (err) {\n\t\tconsole.error(`Failed to create object store for key: ${key}`, err)\n\t\t// Fall back to a basic implementation that won't throw\n\t\tconst fallbackStore = SchmancyStoreObject.getInstance<T>(\n\t\t\t'memory', // Fallback to memory storage\n\t\t\t`${key}-fallback`,\n\t\t\tinitialData,\n\t\t)\n\t\tconsole.warn(`Using fallback memory store for key: ${key}`)\n\t\treturn fallbackStore\n\t}\n}\n\n/**\n * Creates a collection store with better typing and error handling\n */\nfunction createCollectionStore<V>(\n\tinitialData: Map<string, V>,\n\tstorage: StorageType,\n\tkey: string,\n): ICollectionStore<V> & SchmancyCollectionStore<V> {\n\ttry {\n\t\t// Create the store instance\n\t\tconst store = SchmancyCollectionStore.getInstance(storage, key, initialData)\n\n\t\t// Initialize with provided data if store is empty\n\t\tif (!store.value.size) {\n\t\t\t// Create a new Map instance to avoid modifying the input\n\t\t\tstore.replace(new Map(initialData))\n\t\t}\n\n\t\treturn store\n\t} catch (err) {\n\t\tconsole.error(`Failed to create collection store for key: ${key}`, err)\n\t\t// Fall back to a basic implementation that won't throw\n\t\tconst fallbackStore = SchmancyCollectionStore.getInstance<V>(\n\t\t\t'memory', // Fallback to memory storage\n\t\t\t`${key}-fallback`,\n\t\t\tnew Map(initialData),\n\t\t)\n\t\tconsole.warn(`Using fallback memory store for key: ${key}`)\n\t\treturn fallbackStore\n\t}\n}\n\n/**\n * Creates an array store with better typing and error handling\n */\nfunction createArrayStore<T>(\n\tinitialData: T[],\n\tstorage: StorageType,\n\tkey: string,\n): IArrayStore<T> & SchmancyArrayStore<T> {\n\ttry {\n\t\t// Create the store instance\n\t\tconst store = SchmancyArrayStore.getInstance(storage, key, initialData)\n\n\t\t// Initialize with provided data if store is empty\n\t\tif (!store.value.length) {\n\t\t\t// Create a new array instance to avoid modifying the input\n\t\t\tstore.replace([...initialData])\n\t\t}\n\n\t\treturn store\n\t} catch (err) {\n\t\tconsole.error(`Failed to create array store for key: ${key}`, err)\n\t\t// Fall back to a basic implementation that won't throw\n\t\tconst fallbackStore = SchmancyArrayStore.getInstance<T>(\n\t\t\t'memory', // Fallback to memory storage\n\t\t\t`${key}-fallback`,\n\t\t\t[...initialData],\n\t\t)\n\t\tconsole.warn(`Using fallback memory store for key: ${key}`)\n\t\treturn fallbackStore\n\t}\n}\n\n// Function overloads for better type inference\n/**\n * Creates a context for managing object state\n * @param initialData The initial object data\n * @param storage Storage type to use\n * @param key Unique key for the store\n * @returns A store instance for the object\n */\nexport function createContext<T extends Record<string, any>>(\n\tinitialData: T,\n\tstorage: StorageType,\n\tkey: string,\n): IStore<T> & SchmancyStoreObject<T>\n\n/**\n * Creates a context for managing collection state\n * @param initialData The initial Map collection\n * @param storage Storage type to use\n * @param key Unique key for the store\n * @returns A collection store instance\n */\nexport function createContext<V>(\n\tinitialData: Map<string, V>,\n\tstorage: StorageType,\n\tkey: string,\n): ICollectionStore<V> & SchmancyCollectionStore<V>\n\n/**\n * Creates a context for managing array state\n * @param initialData The initial array\n * @param storage Storage type to use\n * @param key Unique key for the store\n * @returns An array store instance\n */\nexport function createContext<T>(\n\tinitialData: T[],\n\tstorage: StorageType,\n\tkey: string,\n): IArrayStore<T> & SchmancyArrayStore<T>\n\n/**\n * Implementation of the createContext function with complete type checking\n * and robust error handling\n */\nexport function createContext<T extends Record<string, any> | Map<string, any> | any[]>(\n\tinitialData: T,\n\tstorage: StorageType,\n\tkey: string,\n):\n\t| (IStore<T> & SchmancyStoreObject<T>)\n\t| (ICollectionStore<any> & SchmancyCollectionStore<any>)\n\t| (IArrayStore<any> & SchmancyArrayStore<any>) {\n\ttry {\n\t\t// Validate input\n\t\tif (initialData === null || initialData === undefined) {\n\t\t\tconsole.error('Initial data cannot be null or undefined')\n\t\t\t// Provide a sensible default based on type expected\n\t\t\tif (key.includes('collection') || key.includes('map')) {\n\t\t\t\tinitialData = new Map() as unknown as T\n\t\t\t} else if (key.includes('array') || key.includes('list')) {\n\t\t\t\tinitialData = [] as unknown as T\n\t\t\t} else {\n\t\t\t\tinitialData = {} as T\n\t\t\t}\n\t\t}\n\n\t\t// Determine store type based on input data with improved type checking\n\t\tif (isMap<string, any>(initialData)) {\n\t\t\treturn createCollectionStore<any>(initialData, storage, key)\n\t\t} else if (isArray<any>(initialData)) {\n\t\t\treturn createArrayStore<any>(initialData, storage, key)\n\t\t} else if (typeof initialData === 'object') {\n\t\t\treturn createObjectStore<any>(initialData as Record<string, any>, storage, key)\n\t\t} else {\n\t\t\t// Handle non-object data by wrapping it\n\t\t\tconsole.warn(`Initial data must be an object, array, or Map. Got ${typeof initialData}. Creating object wrapper.`)\n\t\t\treturn createObjectStore<any>({ value: initialData } as Record<string, any>, storage, key)\n\t\t}\n\t} catch (error) {\n\t\t// Last-resort error handling\n\t\tconsole.error(`Fatal error creating context for ${key}:`, error)\n\n\t\t// Create an emergency fallback store that won't throw\n\t\treturn createObjectStore<any>(\n\t\t\ttypeof initialData === 'object' && initialData !== null ? { ...initialData } : { value: initialData },\n\t\t\t'memory',\n\t\t\t`emergency-fallback-${key}`,\n\t\t)\n\t}\n}\n\n/**\n * Creates an array context with simplified API and type inference\n * @param initialData The initial array data\n * @param key Unique key for the store\n * @param storage Storage type to use (defaults to 'local')\n * @returns An array store instance\n */\nexport function createArrayContext<T>(\n\tinitialData: T[] = [],\n\tkey: string,\n\tstorage: StorageType = 'local',\n): IArrayStore<T> & SchmancyArrayStore<T> {\n\ttry {\n\t\treturn createContext<T>(initialData, storage, key)\n\t} catch (err) {\n\t\tconsole.error(`Failed to create array context for key: ${key}`, err)\n\t\t// Return a fallback store\n\t\treturn createArrayStore<T>(initialData, 'memory', `${key}-fallback`)\n\t}\n}\n\n/**\n * Creates a testable array context\n * @param initialData The initial array data\n * @param key Unique key for the store\n * @returns An array store that uses memory storage\n */\nexport function createTestArrayContext<T>(\n\tinitialData: T[] = [],\n\tkey: string = 'test-array',\n): IArrayStore<T> & SchmancyArrayStore<T> {\n\ttry {\n\t\treturn createContext<T>(initialData, 'memory', key)\n\t} catch (err) {\n\t\tconsole.error(`Failed to create test array context for key: ${key}`, err)\n\t\t// Return a fallback store with a different key\n\t\treturn createArrayStore<T>(initialData, 'memory', `${key}-emergency-fallback`)\n\t}\n}\n","// src/store/filter-directive.ts\n\n/** Supported comparison operators with TypeScript literal types */\nexport type ComparisonOperator =\n\t| '=='\n\t| '!='\n\t| '>'\n\t| '<'\n\t| '>='\n\t| '<='\n\t| 'includes'\n\t| 'notIncludes'\n\t| 'startsWith'\n\t| 'endsWith'\n\t| 'in'\n\t| 'notIn'\n\t| 'any' // fuzzy search operator\n\n/**\n * Type-safe condition tuple\n */\nexport type ConditionTuple = [field: string, op: ComparisonOperator, expected: unknown, strict?: boolean]\n\n/**\n * Type-safe condition object\n */\nexport interface ConditionObject {\n\tkey: string\n\toperator: ComparisonOperator\n\tvalue: unknown\n\tstrict?: boolean\n}\n\n/**\n * Unified query condition type\n */\nexport type QueryCondition = ConditionTuple | ConditionObject\n\n/**\n * Filter result with item and score\n */\nexport interface ScoredItem<T> {\n\titem: T\n\tscore: number\n}\n\n/**\n * Get a nested value from an object using a dot-separated path.\n * Checks explicitly for null/undefined so falsy values like 0 or false are preserved.\n */\nexport const getFieldValue = <T = any>(item: Record<string, any>, path: string): T => {\n\tif (!path) return item as unknown as T\n\n\tconst parts = path.split('.')\n\tlet value: any = item\n\n\tfor (const part of parts) {\n\t\tif (value == null) return undefined as unknown as T\n\t\tvalue = value[part]\n\t}\n\n\treturn value as T\n}\n\n/**\n * Compute the Levenshtein distance between two strings.\n */\nconst levenshtein = (a: string, b: string): number => {\n\tif (a === b) return 0\n\n\tconst matrix: number[][] = Array(b.length + 1)\n\t\t.fill(null)\n\t\t.map((_, i) => [i])\n\n\t// initialize the first row\n\tfor (let j = 0; j <= a.length; j++) {\n\t\tmatrix[0][j] = j\n\t}\n\n\tfor (let i = 1; i <= b.length; i++) {\n\t\tfor (let j = 1; j <= a.length; j++) {\n\t\t\tif (b.charAt(i - 1) === a.charAt(j - 1)) {\n\t\t\t\tmatrix[i][j] = matrix[i - 1][j - 1]\n\t\t\t} else {\n\t\t\t\tmatrix[i][j] = Math.min(\n\t\t\t\t\tmatrix[i - 1][j] + 1, // deletion\n\t\t\t\t\tmatrix[i][j - 1] + 1, // insertion\n\t\t\t\t\tmatrix[i - 1][j - 1] + 1, // substitution\n\t\t\t\t)\n\t\t\t}\n\t\t}\n\t}\n\treturn matrix[b.length][a.length]\n}\n\n/**\n * Check if string `sub` is a subsequence of string `str`.\n * All characters in `sub` must appear in order in `str` (they need not be contiguous).\n */\nconst isSubsequence = (sub: string, str: string): boolean => {\n\tif (!sub) return true\n\tif (!str) return false\n\n\tlet i = 0,\n\t\tj = 0\n\twhile (i < sub.length && j < str.length) {\n\t\tif (sub[i].toLowerCase() === str[j].toLowerCase()) i++\n\t\tj++\n\t}\n\treturn i === sub.length\n}\n\n/**\n * Check if every character (with frequency) in the query exists in the target.\n * For example, \"aovc\" matches \"avocados\".\n */\nconst anagramMatch = (query: string, target: string): boolean => {\n\tif (!query) return true\n\tif (!target) return false\n\n\tconst countChars = (s: string): Record<string, number> =>\n\t\ts\n\t\t\t.toLowerCase()\n\t\t\t.split('')\n\t\t\t.reduce(\n\t\t\t\t(acc, char) => {\n\t\t\t\t\tacc[char] = (acc[char] || 0) + 1\n\t\t\t\t\treturn acc\n\t\t\t\t},\n\t\t\t\t{} as Record<string, number>,\n\t\t\t)\n\n\tconst queryCount = countChars(query)\n\tconst targetCount = countChars(target)\n\treturn Object.keys(queryCount).every(char => (targetCount[char] || 0) >= queryCount[char])\n}\n\n/**\n * Generate bigrams for a string.\n */\nconst getBigrams = (s: string): string[] => {\n\tif (!s || s.length < 2) return []\n\n\tconst bigrams: string[] = []\n\tfor (let i = 0; i < s.length - 1; i++) {\n\t\tbigrams.push(s.substring(i, i + 2).toLowerCase())\n\t}\n\treturn bigrams\n}\n\n/**\n * Compute Dice's coefficient for two strings based on bigrams.\n * Returns a value between 0 (no similarity) and 1 (perfect match).\n */\nconst diceCoefficient = (s1: string, s2: string): number => {\n\tif (!s1 || !s2 || s1.length < 2 || s2.length < 2) return 0\n\n\tconst bigrams1 = getBigrams(s1)\n\tconst bigrams2 = getBigrams(s2)\n\n\tif (bigrams1.length === 0 || bigrams2.length === 0) return 0\n\n\tlet intersection = 0\n\tconst used = new Array(bigrams2.length).fill(false)\n\n\tfor (const bigram of bigrams1) {\n\t\tfor (let i = 0; i < bigrams2.length; i++) {\n\t\t\tif (!used[i] && bigrams2[i] === bigram) {\n\t\t\t\tintersection++\n\t\t\t\tused[i] = true\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n\n\treturn (2 * intersection) / (bigrams1.length + bigrams2.length)\n}\n\n/**\n * Compute a fuzzy similarity score between two strings.\n * The score is computed by taking the maximum of several methods:\n * - Direct substring match (score 1)\n * - Subsequence check (score 0.8)\n * - Anagram subset match (score 0.7)\n * - Dice coefficient\n * - Normalized Levenshtein similarity\n */\nconst computeFuzzyScore = (actual: string, expected: string): number => {\n\tif (!actual || !expected) return 0\n\n\tconst a = actual.toLowerCase().trim()\n\tconst b = expected.toLowerCase().trim()\n\n\tif (a === b) return 1\n\n\tconst substringScore = a.includes(b) ? 1 : 0\n\tconst subsequenceScore = isSubsequence(b, a) ? 0.8 : 0\n\tconst anagramScore = anagramMatch(b, a) ? 0.7 : 0\n\tconst diceScore = diceCoefficient(a, b)\n\n\tconst maxLen = Math.max(a.length, b.length)\n\tconst levenshteinScore = maxLen ? 1 - levenshtein(a, b) / maxLen : 0\n\n\treturn Math.max(substringScore, subsequenceScore, anagramScore, diceScore, levenshteinScore)\n}\n\n/**\n * Safely coerce value to string if possible, or return empty string\n */\nconst safeString = (value: unknown): string => {\n\tif (value == null) return ''\n\treturn String(value)\n}\n\n/**\n * Apply a query condition to an item and return score\n */\nfunction applyQueryCondition<T extends Record<string, any>>(\n\titem: T,\n\tquery: QueryCondition,\n\tfuzzyThreshold: number = 0.3,\n): { valid: boolean; score: number } {\n\tlet field: string,\n\t\top: ComparisonOperator,\n\t\texpected: unknown,\n\t\tstrict = false\n\n\tif (Array.isArray(query)) {\n\t\t;[field, op, expected, strict = false] = query\n\t} else {\n\t\tfield = query.key\n\t\top = query.operator\n\t\texpected = query.value\n\t\tstrict = query.strict || false\n\t}\n\n\t// Skip empty filters for non-strict queries\n\tif (!strict && (expected === '' || expected == null || (isArray(expected) && expected.length === 0))) {\n\t\treturn { valid: true, score: 1 }\n\t}\n\n\tconst actual = getFieldValue(item, field)\n\n\t// FIXED: Properly handle strict mode\n\tif (strict) {\n\t\t// For strict mode, use exact equality comparison for all operators except 'any'\n\t\tif (op === 'any') {\n\t\t\t// Fuzzy search still applies with strict mode\n\t\t\tif (typeof actual !== 'string' || typeof expected !== 'string') {\n\t\t\t\treturn { valid: false, score: 0 }\n\t\t\t}\n\n\t\t\tconst score = computeFuzzyScore(actual, expected)\n\t\t\treturn {\n\t\t\t\tvalid: score >= fuzzyThreshold,\n\t\t\t\tscore: score >= fuzzyThreshold ? score : 0,\n\t\t\t}\n\t\t} else {\n\t\t\t// For all other operators in strict mode,\n\t\t\t// delegate to compareValues function but return precise scores\n\t\t\tconst matches = compareValues(op, actual, expected)\n\t\t\treturn {\n\t\t\t\tvalid: matches,\n\t\t\t\tscore: matches ? 1 : 0,\n\t\t\t}\n\t\t}\n\t} else if (op === 'any') {\n\t\t// Fuzzy search requires both values to be strings\n\t\tif (typeof actual !== 'string' || typeof expected !== 'string') {\n\t\t\treturn { valid: false, score: 0 }\n\t\t}\n\n\t\tconst score = computeFuzzyScore(actual, expected)\n\t\tif (score < fuzzyThreshold) {\n\t\t\treturn { valid: false, score: 0 }\n\t\t}\n\n\t\treturn { valid: true, score }\n\t} else {\n\t\t// For non-fuzzy operators, check condition\n\t\tconst matches = compareValues(op, actual, expected)\n\t\treturn {\n\t\t\tvalid: matches,\n\t\t\tscore: matches ? 1 : 0,\n\t\t}\n\t}\n}\n\n/**\n * Filter a Map of items given an array of query conditions.\n * For each query condition:\n * - If the expected value is empty/null/undefined, it is treated as a match.\n * - For non-fuzzy operators, the condition must strictly match.\n * - For the \"any\" operator, a fuzzy similarity score is computed.\n * Items with a fuzzy score below a given threshold (e.g., 0.3) are excluded.\n *\n * The overall item score is the average of the scores from all conditions.\n * The results are sorted in descending order of relevance.\n *\n * @param items - A Map containing items to filter.\n * @param queries - An array of query conditions to apply.\n * @param fuzzyThreshold - Minimum score required for fuzzy matches (default: 0.3)\n * @returns An array of items that match all query conditions, sorted by relevance.\n */\nexport function filterMapItems<T extends Record<string, any>>(\n\titems: Map<string, T>,\n\tqueries: QueryCondition[] = [],\n\tfuzzyThreshold: number = 0.3,\n): T[] {\n\t// If no queries, return all items unsorted\n\tif (!queries.length) {\n\t\treturn Array.from(items.values())\n\t}\n\n\t// Score and filter each item\n\tconst scoredItems: ScoredItem<T>[] = []\n\n\tfor (const [_, item] of items.entries()) {\n\t\tlet totalScore = 0\n\t\tlet matchCount = 0\n\t\tlet valid = true\n\n\t\tfor (const query of queries) {\n\t\t\tconst result = applyQueryCondition(item, query, fuzzyThreshold)\n\n\t\t\tif (!result.valid) {\n\t\t\t\tvalid = false\n\t\t\t\tbreak\n\t\t\t}\n\n\t\t\ttotalScore += result.score\n\t\t\tmatchCount++\n\t\t}\n\n\t\tif (valid) {\n\t\t\tscoredItems.push({\n\t\t\t\titem,\n\t\t\t\tscore: matchCount > 0 ? totalScore / matchCount : 1,\n\t\t\t})\n\t\t}\n\t}\n\n\t// Sort by descending score\n\tscoredItems.sort((a, b) => b.score - a.score)\n\n\treturn scoredItems.map(x => x.item)\n}\n\n/**\n * Filter an array of items using query conditions\n */\nexport function filterArrayItems<T extends Record<string, any>>(\n\titems: T[],\n\tqueries: QueryCondition[] = [],\n\tfuzzyThreshold: number = 0.3,\n): T[] {\n\t// Create temporary map with numeric indices as keys\n\tconst map = new Map<string, T>()\n\titems.forEach((item, index) => map.set(String(index), item))\n\n\treturn filterMapItems(map, queries, fuzzyThreshold)\n}\n\n// Improved type guards for filter-directive.ts\n\n/**\n * Type guard for checking if a value is an array with better type inference\n * @param value Value to check\n * @returns True if the value is an array\n */\nexport function isArray<T = unknown>(value: unknown): value is Array<T> {\n\treturn Array.isArray(value)\n}\n\n/**\n * Type guard for checking if a value is a string\n * @param value Value to check\n * @returns True if the value is a string\n */\nexport function isString(value: unknown): value is string {\n\treturn typeof value === 'string'\n}\n\n/**\n * Type guard for checking if a value is a number\n * @param value Value to check\n * @returns True if the value is a number and not NaN\n */\nexport function isNumber(value: unknown): value is number {\n\treturn typeof value === 'number' && !isNaN(value)\n}\n\n/**\n * Type guard for checking if a value is a date\n * @param value Value to check\n * @returns True if the value is a valid Date object\n */\nexport function isDate(value: unknown): value is Date {\n\treturn value instanceof Date && !isNaN(value.getTime())\n}\n\n/**\n * Type guard for checking if a value is an iterable collection\n * @param value Value to check\n * @returns True if the value implements the iterable protocol\n */\nexport function isIterable<T = unknown>(value: unknown): value is Iterable<T> {\n\t// Must be non-null and of type 'object'\n\tif (value == null || typeof value !== 'object') {\n\t\treturn false\n\t}\n\n\t// Check for Symbol.iterator method\n\treturn Symbol.iterator in Object(value) && typeof (value as any)[Symbol.iterator] === 'function'\n}\n\n/**\n * Type guard for checking if a value is a Map\n * @param value Value to check\n * @returns True if the value is a Map\n */\nexport function isMap<K = unknown, V = unknown>(value: unknown): value is Map<K, V> {\n\treturn value instanceof Map\n}\n\n/**\n * Type guard for checking if a value is a Set\n * @param value Value to check\n * @returns True if the value is a Set\n */\nexport function isSet<T = unknown>(value: unknown): value is Set<T> {\n\treturn value instanceof Set\n}\n\n/**\n * Type guard for checking if a value is a plain object (not an array, Map, etc.)\n * @param value Value to check\n * @returns True if the value is a plain object\n */\nexport function isPlainObject(value: unknown): value is Record<string, unknown> {\n\tif (value === null || typeof value !== 'object') {\n\t\treturn false\n\t}\n\n\tconst proto = Object.getPrototypeOf(value)\n\treturn proto === Object.prototype || proto === null\n}\n\n/**\n * Type guard for checking if a value is undefined or null\n * @param value Value to check\n * @returns True if the value is undefined or null\n */\nexport function isNil(value: unknown): value is undefined | null {\n\treturn value === undefined || value === null\n}\n\n/**\n * Improved type-safe comparison function that uses appropriate type guards\n * @param op Comparison operator\n * @param actual Actual value\n * @param expected Expected value\n * @returns Result of the comparison\n */\nexport function compareValues(op: ComparisonOperator, actual: unknown, expected: unknown): boolean {\n\t// Handle null/undefined cases\n\tif (isNil(actual) && isNil(expected)) return true\n\tif (isNil(actual) || isNil(expected)) {\n\t\t// For equality operators, null == null but null != non-null\n\t\tif (op === '==') return actual === expected\n\t\tif (op === '!=') return actual !== expected\n\t\t// Other operators should return false for null/undefined values\n\t\treturn false\n\t}\n\n\tswitch (op) {\n\t\tcase '==':\n\t\t\treturn actual === expected\n\t\tcase '!=':\n\t\t\treturn actual !== expected\n\t\tcase '>':\n\t\t\tif (isNumber(actual) && isNumber(expected)) {\n\t\t\t\treturn actual > expected\n\t\t\t}\n\t\t\tif (isDate(actual) && isDate(expected)) {\n\t\t\t\treturn actual.getTime() > expected.getTime()\n\t\t\t}\n\t\t\tif (isString(actual) && isString(expected)) {\n\t\t\t\treturn actual.localeCompare(expected) > 0\n\t\t\t}\n\t\t\treturn false\n\t\tcase '<':\n\t\t\tif (isNumber(actual) && isNumber(expected)) {\n\t\t\t\treturn actual < expected\n\t\t\t}\n\t\t\tif (isDate(actual) && isDate(expected)) {\n\t\t\t\treturn actual.getTime() < expected.getTime()\n\t\t\t}\n\t\t\tif (isString(actual) && isString(expected)) {\n\t\t\t\treturn actual.localeCompare(expected) < 0\n\t\t\t}\n\t\t\treturn false\n\t\tcase '>=':\n\t\t\tif (isNumber(actual) && isNumber(expected)) {\n\t\t\t\treturn actual >= expected\n\t\t\t}\n\t\t\tif (isDate(actual) && isDate(expected)) {\n\t\t\t\treturn actual.getTime() >= expected.getTime()\n\t\t\t}\n\t\t\tif (isString(actual) && isString(expected)) {\n\t\t\t\treturn actual.localeCompare(expected) >= 0\n\t\t\t}\n\t\t\treturn false\n\t\tcase '<=':\n\t\t\tif (isNumber(actual) && isNumber(expected)) {\n\t\t\t\treturn actual <= expected\n\t\t\t}\n\t\t\tif (isDate(actual) && isDate(expected)) {\n\t\t\t\treturn actual.getTime() <= expected.getTime()\n\t\t\t}\n\t\t\tif (isString(actual) && isString(expected)) {\n\t\t\t\treturn actual.localeCompare(expected) <= 0\n\t\t\t}\n\t\t\treturn false\n\t\tcase 'includes': {\n\t\t\tif (isString(actual)) {\n\t\t\t\treturn actual.toLowerCase().includes(safeString(expected).toLowerCase())\n\t\t\t}\n\t\t\tif (isArray(actual)) {\n\t\t\t\treturn actual.includes(expected as any)\n\t\t\t}\n\t\t\tif (isSet(actual)) {\n\t\t\t\treturn actual.has(expected as any)\n\t\t\t}\n\t\t\tif (isMap(actual)) {\n\t\t\t\treturn Array.from(actual.values()).includes(expected as any)\n\t\t\t}\n\t\t\treturn false\n\t\t}\n\t\tcase 'notIncludes': {\n\t\t\tif (isString(actual)) {\n\t\t\t\treturn !actual.toLowerCase().includes(safeString(expected).toLowerCase())\n\t\t\t}\n\t\t\tif (isArray(actual)) {\n\t\t\t\treturn !actual.includes(expected as any)\n\t\t\t}\n\t\t\tif (isSet(actual)) {\n\t\t\t\treturn !actual.has(expected as any)\n\t\t\t}\n\t\t\tif (isMap(actual)) {\n\t\t\t\treturn !Array.from(actual.values()).includes(expected as any)\n\t\t\t}\n\t\t\treturn true\n\t\t}\n\t\tcase 'startsWith': {\n\t\t\tif (isString(actual) && isString(expected)) {\n\t\t\t\treturn actual.toLowerCase().startsWith(expected.toLowerCase())\n\t\t\t}\n\t\t\treturn false\n\t\t}\n\t\tcase 'endsWith': {\n\t\t\tif (isString(actual) && isString(expected)) {\n\t\t\t\treturn actual.toLowerCase().endsWith(expected.toLowerCase())\n\t\t\t}\n\t\t\treturn false\n\t\t}\n\t\tcase 'in': {\n\t\t\tif (isArray(expected)) {\n\t\t\t\treturn expected.includes(actual as any)\n\t\t\t}\n\t\t\tif (isSet(expected)) {\n\t\t\t\treturn expected.has(actual as any)\n\t\t\t}\n\t\t\tif (isMap(expected)) {\n\t\t\t\treturn expected.has(actual as any) || Array.from(expected.values()).includes(actual as any)\n\t\t\t}\n\t\t\treturn false\n\t\t}\n\t\tcase 'notIn': {\n\t\t\tif (isArray(expected)) {\n\t\t\t\treturn !expected.includes(actual as any)\n\t\t\t}\n\t\t\tif (isSet(expected)) {\n\t\t\t\treturn !expected.has(actual as any)\n\t\t\t}\n\t\t\tif (isMap(expected)) {\n\t\t\t\treturn !expected.has(actual as any) && !Array.from(expected.values()).includes(actual as any)\n\t\t\t}\n\t\t\treturn true\n\t\t}\n\t\tdefault: {\n\t\t\tconsole.warn(`Operator \"${op}\" is not supported in comparison.`)\n\t\t\treturn false\n\t\t}\n\t}\n}\n\n// Export a simpler alias for filterMapItems\nexport const filterMap = filterMapItems\n\n// Export an alias for filterArrayItems\nexport const filterArray = filterArrayItems\n","// src/store/selectors.ts\nimport { Observable, combineLatest, distinctUntilChanged, map, share, shareReplay } from 'rxjs'\nimport { IStore, ICollectionStore } from './types'\n\n/**\n * Deep equality comparison for maps and complex objects\n * More efficient than JSON.stringify for large objects\n */\nfunction deepEqual(a: unknown, b: unknown): boolean {\n\tif (a === b) return true\n\n\tif (a instanceof Map && b instanceof Map) {\n\t\tif (a.size !== b.size) return false\n\t\tfor (const [key, value] of a) {\n\t\t\tif (!b.has(key) || !deepEqual(value, b.get(key))) return false\n\t\t}\n\t\treturn true\n\t}\n\n\tif (a instanceof Set && b instanceof Set) {\n\t\tif (a.size !== b.size) return false\n\t\tfor (const item of a) {\n\t\t\tif (!b.has(item)) return false\n\t\t}\n\t\treturn true\n\t}\n\n\tif (typeof a === 'object' && a !== null && typeof b === 'object' && b !== null) {\n\t\tconst keysA = Object.keys(a)\n\t\tconst keysB = Object.keys(b)\n\n\t\tif (keysA.length !== keysB.length) return false\n\n\t\tfor (const key of keysA) {\n\t\t\t// @ts-ignore: Index signature\n\t\t\tif (!deepEqual(a[key], b[key])) return false\n\t\t}\n\n\t\treturn true\n\t}\n\n\treturn false\n}\n\n/**\n * Creates a selector that derives a value from store state\n *\n * @param store The store to observe\n * @param selectorFn Function that transforms the state\n * @returns An observable of the selected state that only emits when the derived value changes\n */\nexport function createSelector<T, R>(store: IStore<T>, selectorFn: (state: T) => R): Observable<R> {\n\treturn store.$.pipe(map(selectorFn), distinctUntilChanged<R>(deepEqual), shareReplay(1))\n}\n\n/**\n * Creates a selector for collection stores that derives a value from the collection\n *\n * @param store The collection store to observe\n * @param selectorFn Function that transforms the collection\n * @returns An observable of the selected state that only emits when the derived value changes\n */\nexport function createCollectionSelector<T, R>(\n\tstore: ICollectionStore<T>,\n\tselectorFn: (state: Map<string, T>) => R,\n): Observable<R> {\n\treturn store.$.pipe(map(selectorFn), distinctUntilChanged<R>(deepEqual), shareReplay(1))\n}\n\n/**\n * Creates a selector that returns all items from a collection as an array\n *\n * @param store The collection store\n * @returns An observable of all items as an array\n */\nexport function createItemsSelector<T>(store: ICollectionStore<T>): Observable<T[]> {\n\treturn createCollectionSelector(store, collection => Array.from(collection.values()))\n}\n\n/**\n * Creates a selector that retrieves a single item from a collection\n *\n * @param store The collection store\n * @param itemKey The key of the item to select\n * @returns An observable of the selected item that emits when the item changes\n */\nexport function createItemSelector<T>(store: ICollectionStore<T>, itemKey: string): Observable<T | undefined> {\n\treturn createCollectionSelector(store, collection => collection.get(itemKey))\n}\n\n/**\n * Creates a compound selector that depends on multiple other selectors\n *\n * @param selectors Array of source selectors\n * @param combinerFn Function that combines all selector results\n * @returns An observable of the combined result\n */\nexport function createCompoundSelector<T extends unknown[], R>(\n\tselectors: { [K in keyof T]: Observable<T[K]> },\n\tcombinerFn: (...values: T) => R,\n): Observable<R> {\n\treturn combineLatest(selectors).pipe(\n\t\tmap(values => combinerFn(...(values as T))),\n\t\tdistinctUntilChanged<R>(deepEqual),\n\t\tshareReplay(1),\n\t)\n}\n\n/**\n * Creates a selector that returns all keys from a collection\n */\nexport function createKeysSelector<T>(store: ICollectionStore<T>): Observable<string[]> {\n\treturn createCollectionSelector(store, collection => Array.from(collection.keys()))\n}\n\n/**\n * Creates a selector that returns entries (key-value pairs) from a collection\n */\nexport function createEntriesSelector<T>(store: ICollectionStore<T>): Observable<[string, T][]> {\n\treturn createCollectionSelector(store, collection => Array.from(collection.entries()))\n}\n\n/**\n * Creates a selector that sorts collection items\n */\nexport function createSortSelector<T>(store: ICollectionStore<T>, compareFn: (a: T, b: T) => number): Observable<T[]> {\n\treturn createCollectionSelector(store, collection => {\n\t\treturn Array.from(collection.values()).sort(compareFn)\n\t})\n}\n\n/**\n * Creates a selector that finds the first item matching a predicate\n */\nexport function createFindSelector<T>(\n\tstore: ICollectionStore<T>,\n\tpredicate: (item: T, key: string) => boolean,\n): Observable<T | undefined> {\n\treturn createCollectionSelector(store, collection => {\n\t\tfor (const [key, item] of collection.entries()) {\n\t\t\tif (predicate(item, key)) {\n\t\t\t\treturn item\n\t\t\t}\n\t\t}\n\t\treturn undefined\n\t})\n}\n\n/**\n * Creates a selector that filters items from a collection - OPTIMIZED\n *\n * @param store The collection store\n * @param filterFn Function that returns true for items to include\n * @returns An observable of filtered items as an array\n */\nexport function createFilterSelector<T>(\n\tstore: ICollectionStore<T>,\n\tfilterFn: (item: T, key: string) => boolean,\n): Observable<T[]> {\n\treturn createCollectionSelector(store, collection =>\n\t\tArray.from(collection.entries())\n\t\t\t.filter(([key, item]) => filterFn(item, key))\n\t\t\t.map(([_, item]) => item),\n\t)\n}\n\n/**\n * Creates a selector that maps collection values through a transform function - OPTIMIZED\n */\nexport function createMapSelector<T, R>(\n\tstore: ICollectionStore<T>,\n\tmapFn: (item: T, key: string) => R,\n): Observable<R[]> {\n\treturn createCollectionSelector(store, collection =>\n\t\tArray.from(collection.entries()).map(([key, item]) => mapFn(item, key)),\n\t)\n}\n\n/**\n * Creates a selector that counts items in a collection, optionally filtered - OPTIMIZED\n *\n * @param store The collection store\n * @param filterFn Optional function to filter which items to count\n * @returns An observable of the count\n */\nexport function createCountSelector<T>(\n\tstore: ICollectionStore<T>,\n\tfilterFn?: (item: T, key: string) => boolean,\n): Observable<number> {\n\treturn createCollectionSelector(store, collection => {\n\t\tif (!filterFn) return collection.size\n\n\t\treturn Array.from(collection.entries()).filter(([key, item]) => filterFn(item, key)).length\n\t})\n}\n\n/**\n * Optimized RxJS Pipeline - use share with reset on refCount zero for better memory management\n * in scenarios where selector subscriptions come and go\n *\n * @param store The store to observe\n * @param selectorFn Function that transforms the state\n * @returns An observable of the selected state with improved memory management\n */\nexport function createOptimizedSelector<T, R>(store: IStore<T>, selectorFn: (state: T) => R): Observable<R> {\n\treturn store.$.pipe(\n\t\tmap(selectorFn),\n\t\tdistinctUntilChanged<R>(deepEqual),\n\t\tshare({\n\t\t\tresetOnRefCountZero: true,\n\t\t\tresetOnError: false,\n\t\t\tresetOnComplete: false,\n\t\t}),\n\t)\n}\n","// src/store/selector-hook.ts - Improved memory management\nimport { property as litProperty } from 'lit/decorators.js'\nimport { Observable, Subject, Subscription } from 'rxjs'\nimport { takeUntil } from 'rxjs/operators'\nimport { createCollectionSelector, createSelector } from './selectors'\nimport { ICollectionStore, IStore } from './types'\n\n/**\n * Symbol used for storing cleanup resources\n * Using a Symbol prevents name collisions with component properties\n */\nconst CLEANUP_SUBJECT = Symbol('selectorCleanup')\nconst SUBSCRIPTIONS = Symbol('selectorSubscriptions')\nconst INITIALIZED = Symbol('selectorInitialized')\n\n/**\n * Component lifecycle interface\n */\ninterface ComponentWithLifecycle {\n\t// Lifecycle hooks\n\tisConnected: boolean\n\tdisconnectedCallback?: () => void\n\tconnectedCallback?: () => void\n\trequestUpdate?: () => void\n\n\t// Internal properties using symbols to avoid name collisions\n\t[CLEANUP_SUBJECT]?: Subject<void>\n\t[SUBSCRIPTIONS]?: Map<string, Subscription>\n\t[INITIALIZED]?: Set<string>\n\n\t// Value storage\n\t[key: string]: any\n}\n\n/**\n * Property descriptor interface\n */\ntype PropertyDescriptor<T> = {\n\tget?: () => T\n\tset?: (value: T) => void\n\tvalue?: T\n\tconfigurable?: boolean\n\tenumerable?: boolean\n\twritable?: boolean\n}\n\n/**\n * Options for selecting from a store\n */\ninterface SelectOptions {\n\t/** If true, will wait for selector to emit a non-null value before calling connectedCallback */\n\trequired?: boolean\n\n\t/** If true, will only update the component and not set the property value */\n\tupdateOnly?: boolean\n\n\t/** If true, will use structuredClone to deeply clone values (prevents mutations) */\n\tdeepClone?: boolean\n\n\t/** Custom equality function to determine when to update */\n\tequals?: (a: any, b: any) => boolean\n\n\t/** Debug mode - logs selector activity */\n\tdebug?: boolean\n}\n\n/**\n * Type guard to check if a store is a collection store\n */\nfunction isCollectionStore<T>(store: IStore<any> | ICollectionStore<T>): store is ICollectionStore<T> {\n\treturn 'set' in store && typeof store.set === 'function' && store.value instanceof Map\n}\n\n/**\n * Ensures the cleanup resources exist on the component\n */\nfunction ensureCleanupResources(component: ComponentWithLifecycle): void {\n\tif (!component[CLEANUP_SUBJECT] || component[CLEANUP_SUBJECT].closed) {\n\t\tcomponent[CLEANUP_SUBJECT] = new Subject<void>()\n\t}\n\n\tif (!component[SUBSCRIPTIONS]) {\n\t\tcomponent[SUBSCRIPTIONS] = new Map()\n\t}\n\n\tif (!component[INITIALIZED]) {\n\t\tcomponent[INITIALIZED] = new Set()\n\t}\n}\n\n/**\n * Cleans up all selector resources\n */\nfunction cleanupSelectorResources(component: ComponentWithLifecycle): void {\n\tif (component[CLEANUP_SUBJECT]) {\n\t\tcomponent[CLEANUP_SUBJECT].next()\n\t\tcomponent[CLEANUP_SUBJECT].complete()\n\t\tcomponent[CLEANUP_SUBJECT] = undefined\n\t}\n\n\tif (component[SUBSCRIPTIONS]) {\n\t\tcomponent[SUBSCRIPTIONS].forEach(sub => sub.unsubscribe())\n\t\tcomponent[SUBSCRIPTIONS].clear()\n\t\tcomponent[SUBSCRIPTIONS] = undefined\n\t}\n\n\tif (component[INITIALIZED]) {\n\t\tcomponent[INITIALIZED].clear()\n\t\tcomponent[INITIALIZED] = undefined\n\t}\n}\n\n/**\n * Selector decorator that connects a component property to a store selector\n * with improved memory management\n *\n * @param store The store to select from\n * @param selectorFn Optional function to transform the store state\n * @param options Additional options for the selector\n */\nexport function select<T, R>(\n\tstore: IStore<T> | ICollectionStore<T>,\n\tselectorFn: (state: any) => R = (state: R) => state,\n\toptions: SelectOptions = {},\n) {\n\treturn function (proto: Record<string, any>, propName: string, _descriptor?: PropertyDescriptor<R>) {\n\t\t// Register as a Lit property\n\t\tlitProperty({ attribute: false, type: Object })(proto, propName)\n\n\t\t// Store original lifecycle methods\n\t\tconst originalConnectedCallback = proto.connectedCallback\n\t\tconst originalDisconnectedCallback = proto.disconnectedCallback\n\n\t\t// Override connectedCallback to set up subscription\n\t\tproto.connectedCallback = function (this: ComponentWithLifecycle) {\n\t\t\t// Initialize cleanup resources\n\t\t\tensureCleanupResources(this)\n\n\t\t\t// Create the appropriate selector\n\t\t\tconst selector: Observable<R> = isCollectionStore(store)\n\t\t\t\t? createCollectionSelector(store, selectorFn)\n\t\t\t\t: createSelector(store as IStore<T>, selectorFn)\n\n\t\t\t// Call original connectedCallback immediately if not waiting for data\n\t\t\tif (!options.required && !this[INITIALIZED]!.has(propName)) {\n\t\t\t\toriginalConnectedCallback?.call(this)\n\t\t\t\tthis[INITIALIZED]!.add(propName)\n\t\t\t}\n\n\t\t\t// Clean up any existing subscription\n\t\t\tif (this[SUBSCRIPTIONS]!.has(propName)) {\n\t\t\t\tthis[SUBSCRIPTIONS]!.get(propName)?.unsubscribe()\n\t\t\t\tthis[SUBSCRIPTIONS]!.delete(propName)\n\t\t\t}\n\n\t\t\t// Debug log if needed\n\t\t\tif (options.debug) {\n\t\t\t\tconsole.debug(`[select] Setting up subscription for ${propName}`)\n\t\t\t}\n\n\t\t\t// Create new subscription with better error handling\n\t\t\tconst subscription = selector.pipe(takeUntil(this[CLEANUP_SUBJECT]!)).subscribe({\n\t\t\t\tnext: (value: R) => {\n\t\t\t\t\t// Handle value updates\n\t\t\t\t\tconst newValue = options.deepClone ? structuredClone(value) : value\n\n\t\t\t\t\tif (options.debug) {\n\t\t\t\t\t\tconsole.debug(`[select] New value for ${propName}:`, newValue)\n\t\t\t\t\t}\n\n\t\t\t\t\tif (!options.updateOnly) {\n\t\t\t\t\t\tthis[propName] = newValue\n\t\t\t\t\t}\n\n\t\t\t\t\tthis.requestUpdate?.()\n\n\t\t\t\t\t// If required and not initialized, call connectedCallback when we get a value\n\t\t\t\t\tif (options.required && !this[INITIALIZED]!.has(propName) && newValue !== null && newValue !== undefined) {\n\t\t\t\t\t\tif (options.debug) {\n\t\t\t\t\t\t\tconsole.debug(`[select] Calling delayed connectedCallback for ${propName}`)\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\toriginalConnectedCallback?.call(this)\n\t\t\t\t\t\tthis[INITIALIZED]!.add(propName)\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\terror: (err: Error) => {\n\t\t\t\t\tconsole.error(`Error in selector subscription for ${propName}:`, err)\n\t\t\t\t\t// Resubscribe on error to prevent component from becoming unresponsive\n\t\t\t\t\tif (this.isConnected) {\n\t\t\t\t\t\t// Small delay to prevent immediate resubscription\n\t\t\t\t\t\tsetTimeout(() => {\n\t\t\t\t\t\t\tif (this.isConnected) {\n\t\t\t\t\t\t\t\tif (options.debug) {\n\t\t\t\t\t\t\t\t\tconsole.debug(`[select] Resubscribing after error for ${propName}`)\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tthis.connectedCallback?.()\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}, 1000)\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t})\n\n\t\t\t// Store the subscription for cleanup\n\t\t\tthis[SUBSCRIPTIONS]!.set(propName, subscription)\n\t\t}\n\n\t\t// Override disconnectedCallback to clean up subscriptions\n\t\tproto.disconnectedCallback = function (this: ComponentWithLifecycle) {\n\t\t\t// Call original disconnectedCallback\n\t\t\toriginalDisconnectedCallback?.call(this)\n\n\t\t\t// Debug log if needed\n\t\t\tif (options.debug) {\n\t\t\t\tconsole.debug(`[select] Cleaning up resources in disconnectedCallback`)\n\t\t\t}\n\n\t\t\t// Clean up all subscription resources\n\t\t\tcleanupSelectorResources(this)\n\t\t}\n\t}\n}\n\n/**\n * Creates a selector decorator that selects a specific item from a collection store\n * with improved memory management\n *\n * @param store The collection store\n * @param keyGetter Function that returns the key to select\n * @param options Additional options\n */\nexport function selectItem<T>(\n\tstore: ICollectionStore<T>,\n\tkeyGetter: (component: any) => string,\n\toptions: SelectOptions = {},\n) {\n\treturn function (proto: Record<string, any>, propName: string, _descriptor?: PropertyDescriptor<T | undefined>) {\n\t\tselect(\n\t\t\tstore,\n\t\t\tfunction (state) {\n\t\t\t\t// This will be evaluated during subscription, when 'this' is available\n\t\t\t\tconst itemKey = keyGetter(this)\n\t\t\t\treturn itemKey ? state.get(itemKey) : undefined\n\t\t\t},\n\t\t\toptions,\n\t\t)(proto, propName)\n\t}\n}\n"],"names":["createObjectStore","initialData","storage","key","value","Array","isArray","Map","Set","Date","RegExp","Object","getPrototypeOf","prototype","store","SchmancyStoreObject","getInstance","obj","keys","length","set","createArrayStore","SchmancyArrayStore","replace","createContext","includes","SchmancyCollectionStore","size","err","createArrayContext","createTestArrayContext","getFieldValue","item","path","parts","split","part","getBigrams","s","bigrams","i","push","substring","toLowerCase","computeFuzzyScore","actual","expected","a","trim","b","substringScore","subsequenceScore","sub","str","j","anagramScore","query","target","countChars","reduce","acc","char","queryCount","targetCount","every","diceScore","s1","s2","bigrams1","bigrams2","intersection","used","fill","bigram","maxLen","Math","max","levenshteinScore","matrix","map","_","charAt","min","safeString","String","applyQueryCondition","fuzzyThreshold","field","op","strict","operator","valid","score","matches","compareValues","t","filterMapItems","items","queries","from","values","scoredItems","entries","totalScore","matchCount","result","sort","x","filterArrayItems","forEach","index","isString","isNumber","isNaN","isDate","getTime","isIterable","Symbol","iterator","isMap","isSet","isPlainObject","proto","isNil","localeCompare","has","startsWith","endsWith","filterMap","filterArray","deepEqual","get","keysA","keysB","createSelector","selectorFn","$","pipe","distinctUntilChanged","shareReplay","createCollectionSelector","createItemsSelector","collection","createItemSelector","itemKey","createCompoundSelector","selectors","combinerFn","combineLatest","createKeysSelector","createEntriesSelector","createSortSelector","compareFn","createFindSelector","predicate","createFilterSelector","filterFn","filter","createMapSelector","mapFn","createCountSelector","createOptimizedSelector","share","resetOnRefCountZero","resetOnError","resetOnComplete","CLEANUP_SUBJECT","SUBSCRIPTIONS","INITIALIZED","select","state","options","propName","_descriptor","litProperty","attribute","type","originalConnectedCallback","connectedCallback","originalDisconnectedCallback","disconnectedCallback","component","this","closed","Subject","selector","required","call","add","unsubscribe","delete","debug","subscription","takeUntil","subscribe","next","newValue","deepClone","structuredClone","updateOnly","requestUpdate","error","isConnected","setTimeout","complete","clear","selectItem","keyGetter"],"mappings":";;;;AAkDA,SAASA,EACRC,GACAC,GACAC,GAEI;AAAA,MAAA;AAEa,IAAZD,MAAY,gBAELA,IAAA,YAzBUE,IA6BFH,OA3BT,QACO,OAAVG,KAAU,YAChBC,MAAMC,QAAQF,CACbA,KAAAA,aAAiBG,OACjBH,aAAiBI,OACjBJ,aAAiBK,QACjBL,aAAiBM,UACnBC,OAAOC,eAAeR,CAAAA,MAAWO,OAAOE,eAsBzBZ,IAAA,EAAKA,GAAAA,EAAAA;AAIpB,UAAMa,IAAQC,EAAoBC,YAAed,GAASC,GAAKF,CAOxD;AAAA,WAlEcgB,QAAAA,IA8DHH,EAAMV,UA7DN,YAAYa,MAAQ,QAGhCN,OAAOO,KAAKD,CAAKE,EAAAA,WAAW,KA2DjCL,EAAMM,IAAI,EAAKnB,GAAAA,EAAAA,CAAAA,GAGTa;AAAAA,UAUA;AAAA,WANeC,EAAoBC,YACzC,UACA,GAAGb,CACHF,aAAAA,CAAAA;AAAAA,EAGM;AA5ET,MAAuBgB,GAwBAb;AAsDvB;AAqCA,SAASiB,EACRpB,GACAC,GACAC,GAEI;AAAA,MAAA;AAEH,UAAMW,IAAQQ,EAAmBN,YAAYd,GAASC,GAAKF,CAQpD;AAAA,WALFa,EAAMV,MAAMe,UAEhB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