{"version":3,"file":"6ab9b088.mjs","sources":["../../src/debug.ts","../../src/noto.ts","../../src/no.ts"],"sourcesContent":["import { globals } from './globals'\n\nlet nextDebugId = 1\n\nconst $D = Symbol.for('wana:debug')\n\ninterface DebugState {\n  name: string\n  actions?: any[]\n  renders?: number\n}\n\n/** Get the `Auto` object for the current `withAuto` component being rendered. */\nexport function getCurrentAuto() {\n  return globals.auto\n}\n\n/**\n * Get the `DebugState` object of the `target` object.\n *\n * Returns `undefined` if target was never passed to `setDebug`.\n */\nexport function getDebug(target: object): DebugState {\n  return target[$D]\n}\n\n/**\n * Set the `DebugState` object of the `target` object.\n */\nexport function setDebug<T>(target: T, debug: DebugState) {\n  debug.name += '#' + nextDebugId++\n  target[$D] = debug\n  return target\n}\n\n/** Safely add an action to a `DebugState` object */\nexport function addDebugAction(target: any, action: any) {\n  const debug = getDebug(target)\n  if (debug && debug.actions) {\n    debug.actions.push(action)\n  }\n}\n","import { globals } from './globals'\n\n/** Run an effect without any observable tracking */\nexport function noto<T>(effect: () => T): T {\n  const { auto, observe } = globals\n  globals.auto = null\n  globals.observe = null\n  try {\n    return effect()\n  } finally {\n    globals.auto = auto\n    globals.observe = observe\n  }\n}\n","import { is } from '@alloc/is'\nimport { setHidden } from './common'\nimport { noto } from './noto'\nimport { $$ } from './symbols'\n\n/**\n * Get the original object from an observable proxy,\n * or wrap a function to disable observation inside it.\n *\n * Read `no` as \"non-observable\", essentially the reverse of the `o` function.\n */\nexport function no<T>(value: T): T {\n  if (is.function(value)) {\n    if (value[$$]) return value\n    const fn = function(this: any, ...args: any[]) {\n      return noto(value.bind(this, ...args))\n    }\n    setHidden(fn, 'name', value.name)\n    setHidden(fn, $$, value)\n    return fn as any\n  }\n  return (value && value[$$]) || value\n}\n"],"names":[],"mappings":";;;AAEA,IAAI,cAAc;AAElB,MAAM,KAAK,OAAO,IAAI;0BASW;AAC/B,SAAO,QAAQ;AAAA;kBAQQ,QAA4B;AACnD,SAAO,OAAO;AAAA;kBAMY,QAAW,OAAmB;AACxD,QAAM,QAAQ,MAAM;AACpB,SAAO,MAAM;AACb,SAAO;AAAA;wBAIsB,QAAa,QAAa;AACvD,QAAM,QAAQ,SAAS;AACvB,MAAI,SAAS,MAAM,SAAS;AAC1B,UAAM,QAAQ,KAAK;AAAA;AAAA;;cCpCC,QAAoB;AAC1C,QAAM,CAAE,MAAM,WAAY;AAC1B,UAAQ,OAAO;AACf,UAAQ,UAAU;AAClB,MAAI;AACF,WAAO;AAAA,YACP;AACA,YAAQ,OAAO;AACf,YAAQ,UAAU;AAAA;AAAA;;YCAA,OAAa;AACjC,MAAI,GAAG,SAAS,QAAQ;AACtB,QAAI,MAAM;AAAK,aAAO;AACtB,UAAM,KAAK,YAAuB,MAAa;AAC7C,aAAO,KAAK,MAAM,KAAK,MAAM,GAAG;AAAA;AAElC,cAAU,IAAI,QAAQ,MAAM;AAC5B,cAAU,IAAI,IAAI;AAClB,WAAO;AAAA;AAET,SAAQ,SAAS,MAAM,OAAQ;AAAA;;;;"}