{"version":3,"file":"util.mjs","names":[],"sources":["../src/util/mutable.ts","../src/util/use-autorun.ts"],"sourcesContent":["import { observable, runInAction } from \"mobx\";\nimport type { ClassAccessorDecorator } from \"mobx/dist/types/decorator_fills\";\n\nexport const mutable: ClassAccessorDecorator = (accessor) => {\n  const boxedValues = new WeakMap();\n\n  return {\n    get() {\n      let boxedValue = boxedValues.get(this);\n      if (!boxedValue) {\n        const value = accessor.get.call(this);\n        boxedValue = observable.box(value);\n        boxedValues.set(this, boxedValue);\n      }\n\n      return boxedValue.get();\n    },\n    set(value) {\n      let boxedValue = boxedValues.get(this);\n      if (!boxedValue) {\n        boxedValue = observable.box(value);\n        boxedValues.set(this, boxedValue);\n      }\n\n      runInAction(() => boxedValue.set(value));\n    },\n  };\n};\n","import { autorun, type IAutorunOptions, type IReactionPublic } from \"mobx\";\nimport { useEffect } from \"react\";\n\nexport function useAutorun(func: (r: IReactionPublic) => unknown, options?: IAutorunOptions): void {\n  // biome-ignore lint/correctness/useExhaustiveDependencies: by design\n  useEffect(() => autorun(func, options), []);\n}\n"],"mappings":";;;;;;;AAGA,MAAa,WAAmC,aAAa;CAC3D,MAAM,8BAAc,IAAI,QAAQ;CAEhC,OAAO;EACL,MAAM;GACJ,IAAI,aAAa,YAAY,IAAI,IAAI;GACrC,IAAI,CAAC,YAAY;IACf,MAAM,QAAQ,SAAS,IAAI,KAAK,IAAI;IACpC,aAAa,WAAW,IAAI,KAAK;IACjC,YAAY,IAAI,MAAM,UAAU;GAClC;GAEA,OAAO,WAAW,IAAI;EACxB;EACA,IAAI,OAAO;GACT,IAAI,aAAa,YAAY,IAAI,IAAI;GACrC,IAAI,CAAC,YAAY;IACf,aAAa,WAAW,IAAI,KAAK;IACjC,YAAY,IAAI,MAAM,UAAU;GAClC;GAEA,kBAAkB,WAAW,IAAI,KAAK,CAAC;EACzC;CACF;AACF;;;;ACxBA,SAAgB,WAAW,MAAuC,SAAiC;CAEjG,gBAAgB,QAAQ,MAAM,OAAO,GAAG,CAAC,CAAC;AAC5C"}