/*!
Copyright (c) 2026 Lenovo SSG BASD. All rights reserved.
@license Proprietary

This software is the confidential and proprietary property of Lenovo SSG BASD.
You shall not disclose such Confidential Information and shall use it only in
accordance with the terms of the license agreement.

--- Build Info ---
Version: 1.1.1
Build Time: 2026/2/26 17:21:00
Build Commit: 81e556ed827e2f043668506dae6fae8dbb9ef395
*/
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./derived.js"),t=new WeakMap,o=new WeakMap,r={current:[]};let n=!1,s=0;const c=new Set,f=new Map;function i(n){const s=Array.from(n).sort((t,o)=>t instanceof e.Derived&&t.options.deps.includes(o)?1:o instanceof e.Derived&&o.options.deps.includes(t)?-1:0);for(const e of s){if(r.current.includes(e))continue;r.current.push(e),e.recompute();const n=o.get(e);if(n)for(const e of n){const o=t.get(e);o&&i(o)}}}function a(e){const t={prevVal:e.prevState,currentVal:e.state};for(const o of e.listeners)o(t)}function u(e){const t={prevVal:e.prevState,currentVal:e.state};for(const o of e.listeners)o(t)}function p(e){if(s>0&&!f.has(e)&&f.set(e,e.prevState),c.add(e),!(s>0||n))try{for(n=!0;c.size>0;){const e=Array.from(c);c.clear();for(const t of e){const e=f.get(t)??t.prevState;t.prevState=e,a(t)}for(const o of e){const e=t.get(o);e&&(r.current.push(o),i(e))}for(const o of e){const e=t.get(o);if(e)for(const t of e)u(t)}}}finally{n=!1,r.current=[],f.clear()}}exports.__depsThatHaveWrittenThisTick=r,exports.__derivedToStore=o,exports.__flush=p,exports.__storeToDerived=t,exports.batch=function(e){s++;try{e()}finally{if(s--,0===s){const e=c.values().next().value;e&&p(e)}}};