{"ast":null,"code":"'use strict';\n\nimport NativeAnimatedHelper from \"../NativeAnimatedHelper\";\nvar NativeAnimatedAPI = NativeAnimatedHelper.API;\nimport invariant from 'fbjs/lib/invariant';\nvar _uniqueId = 1;\n\nvar AnimatedNode = function () {\n  var _proto = AnimatedNode.prototype;\n\n  _proto.__attach = function __attach() {};\n\n  _proto.__detach = function __detach() {\n    if (this.__isNative && this.__nativeTag != null) {\n      NativeAnimatedHelper.API.dropAnimatedNode(this.__nativeTag);\n      this.__nativeTag = undefined;\n    }\n  };\n\n  _proto.__getValue = function __getValue() {};\n\n  _proto.__getAnimatedValue = function __getAnimatedValue() {\n    return this.__getValue();\n  };\n\n  _proto.__addChild = function __addChild(child) {};\n\n  _proto.__removeChild = function __removeChild(child) {};\n\n  _proto.__getChildren = function __getChildren() {\n    return [];\n  };\n\n  function AnimatedNode() {\n    this._listeners = {};\n  }\n\n  _proto.__makeNative = function __makeNative() {\n    if (!this.__isNative) {\n      throw new Error('This node cannot be made a \"native\" animated node');\n    }\n\n    if (this.hasListeners()) {\n      this._startListeningToNativeValueUpdates();\n    }\n  };\n\n  _proto.addListener = function addListener(callback) {\n    var id = String(_uniqueId++);\n    this._listeners[id] = callback;\n\n    if (this.__isNative) {\n      this._startListeningToNativeValueUpdates();\n    }\n\n    return id;\n  };\n\n  _proto.removeListener = function removeListener(id) {\n    delete this._listeners[id];\n\n    if (this.__isNative && !this.hasListeners()) {\n      this._stopListeningForNativeValueUpdates();\n    }\n  };\n\n  _proto.removeAllListeners = function removeAllListeners() {\n    this._listeners = {};\n\n    if (this.__isNative) {\n      this._stopListeningForNativeValueUpdates();\n    }\n  };\n\n  _proto.hasListeners = function hasListeners() {\n    return !!Object.keys(this._listeners).length;\n  };\n\n  _proto._startListeningToNativeValueUpdates = function _startListeningToNativeValueUpdates() {\n    var _this = this;\n\n    if (this.__nativeAnimatedValueListener && !this.__shouldUpdateListenersForNewNativeTag) {\n      return;\n    }\n\n    if (this.__shouldUpdateListenersForNewNativeTag) {\n      this.__shouldUpdateListenersForNewNativeTag = false;\n\n      this._stopListeningForNativeValueUpdates();\n    }\n\n    NativeAnimatedAPI.startListeningToAnimatedNodeValue(this.__getNativeTag());\n    this.__nativeAnimatedValueListener = NativeAnimatedHelper.nativeEventEmitter.addListener('onAnimatedValueUpdate', function (data) {\n      if (data.tag !== _this.__getNativeTag()) {\n        return;\n      }\n\n      _this._onAnimatedValueUpdateReceived(data.value);\n    });\n  };\n\n  _proto._onAnimatedValueUpdateReceived = function _onAnimatedValueUpdateReceived(value) {\n    this.__callListeners(value);\n  };\n\n  _proto.__callListeners = function __callListeners(value) {\n    for (var _key in this._listeners) {\n      this._listeners[_key]({\n        value: value\n      });\n    }\n  };\n\n  _proto._stopListeningForNativeValueUpdates = function _stopListeningForNativeValueUpdates() {\n    if (!this.__nativeAnimatedValueListener) {\n      return;\n    }\n\n    this.__nativeAnimatedValueListener.remove();\n\n    this.__nativeAnimatedValueListener = null;\n    NativeAnimatedAPI.stopListeningToAnimatedNodeValue(this.__getNativeTag());\n  };\n\n  _proto.__getNativeTag = function __getNativeTag() {\n    var _this$__nativeTag;\n\n    NativeAnimatedHelper.assertNativeAnimatedModule();\n    invariant(this.__isNative, 'Attempt to get native tag from node not marked as \"native\"');\n    var nativeTag = (_this$__nativeTag = this.__nativeTag) !== null && _this$__nativeTag !== void 0 ? _this$__nativeTag : NativeAnimatedHelper.generateNewNodeTag();\n\n    if (this.__nativeTag == null) {\n      this.__nativeTag = nativeTag;\n      NativeAnimatedHelper.API.createAnimatedNode(nativeTag, this.__getNativeConfig());\n      this.__shouldUpdateListenersForNewNativeTag = true;\n    }\n\n    return nativeTag;\n  };\n\n  _proto.__getNativeConfig = function __getNativeConfig() {\n    throw new Error('This JS animated node type cannot be used as native animated node');\n  };\n\n  _proto.toJSON = function toJSON() {\n    return this.__getValue();\n  };\n\n  return AnimatedNode;\n}();\n\nexport default AnimatedNode;","map":{"version":3,"sources":["/Users/rohitsingh/Documents/projects/new-nativebase-setup/NativeBase/example/node_modules/react-native-web/dist/vendor/react-native/Animated/nodes/AnimatedNode.js"],"names":["NativeAnimatedHelper","NativeAnimatedAPI","API","invariant","_uniqueId","AnimatedNode","_proto","prototype","__attach","__detach","__isNative","__nativeTag","dropAnimatedNode","undefined","__getValue","__getAnimatedValue","__addChild","child","__removeChild","__getChildren","_listeners","__makeNative","Error","hasListeners","_startListeningToNativeValueUpdates","addListener","callback","id","String","removeListener","_stopListeningForNativeValueUpdates","removeAllListeners","Object","keys","length","_this","__nativeAnimatedValueListener","__shouldUpdateListenersForNewNativeTag","startListeningToAnimatedNodeValue","__getNativeTag","nativeEventEmitter","data","tag","_onAnimatedValueUpdateReceived","value","__callListeners","_key","remove","stopListeningToAnimatedNodeValue","_this$__nativeTag","assertNativeAnimatedModule","nativeTag","generateNewNodeTag","createAnimatedNode","__getNativeConfig","toJSON"],"mappings":"AASA;;AAEA,OAAOA,oBAAP;AACA,IAAIC,iBAAiB,GAAGD,oBAAoB,CAACE,GAA7C;AACA,OAAOC,SAAP,MAAsB,oBAAtB;AACA,IAAIC,SAAS,GAAG,CAAhB;;AAGA,IAAIC,YAAY,GAAgB,YAAY;AAC1C,MAAIC,MAAM,GAAGD,YAAY,CAACE,SAA1B;;AAEAD,EAAAA,MAAM,CAACE,QAAP,GAAkB,SAASA,QAAT,GAAoB,CAAE,CAAxC;;AAEAF,EAAAA,MAAM,CAACG,QAAP,GAAkB,SAASA,QAAT,GAAoB;AACpC,QAAI,KAAKC,UAAL,IAAmB,KAAKC,WAAL,IAAoB,IAA3C,EAAiD;AAC/CX,MAAAA,oBAAoB,CAACE,GAArB,CAAyBU,gBAAzB,CAA0C,KAAKD,WAA/C;AACA,WAAKA,WAAL,GAAmBE,SAAnB;AACD;AACF,GALD;;AAOAP,EAAAA,MAAM,CAACQ,UAAP,GAAoB,SAASA,UAAT,GAAsB,CAAE,CAA5C;;AAEAR,EAAAA,MAAM,CAACS,kBAAP,GAA4B,SAASA,kBAAT,GAA8B;AAC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AA+C;AAC1F,QAAI,CAAC,KAAKM,6BAAV,EAAyC;AACvC;AACD;;AAED,SAAKA,6BAAL,CAAmCW,MAAnC;;AAEA,SAAKX,6BAAL,GAAqC,IAArC;AACAnC,IAAAA,iBAAiB,CAAC+C,gCAAlB,CAAmD,KAAKT,cAAL,EAAnD;AACD,GATD;;AAWAjC,EAAAA,MAAM,CAACiC,cAAP,GAAwB,SAASA,cAAT,GAA0B;AAChD,QAAIU,iBAAJ;;AAEAjD,IAAAA,oBAAoB,CAACkD,0BAArB;AACA/C,IAAAA,SAAS,CAAC,KAAKO,UAAN,EAAkB,4DAAlB,CAAT;AACA,QAAIyC,SAAS,GAAG,CAACF,iBAAiB,GAAG,KAAKtC,WAA1B,MAA2C,IAA3C,IAAmDsC,iBAAiB,KAAK,KAAK,CAA9E,GAAkFA,iBAAlF,GAAsGjD,oBAAoB,CAACoD,kBAArB,EAAtH;;AAEA,QAAI,KAAKzC,WAAL,IAAoB,IAAxB,EAA8B;AAC5B,WAAKA,WAAL,GAAmBwC,SAAnB;AACAnD,MAAAA,oBAAoB,CAACE,GAArB,CAAyBmD,kBAAzB,CAA4CF,SAA5C,EAAuD,KAAKG,iBAAL,EAAvD;AACA,WAAKjB,sCAAL,GAA8C,IAA9C;AACD;;AAED,WAAOc,SAAP;AACD,GAdD;;AAgBA7C,EAAAA,MAAM,CAACgD,iBAAP,GAA2B,SAASA,iBAAT,GAA6B;AACtD,UAAM,IAAIhC,KAAJ,CAAU,mEAAV,CAAN;AACD,GAFD;;AAIAhB,EAAAA,MAAM,CAACiD,MAAP,GAAgB,SAASA,MAAT,GAAkB;AAChC,WAAO,KAAKzC,UAAL,EAAP;AACD,GAFD;;AAIA,SAAOT,YAAP;AACD,CArK+B,EAAhC;;AAuKA,eAAeA,YAAf","sourcesContent":["/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * \n * @format\n */\n'use strict';\n\nimport NativeAnimatedHelper from '../NativeAnimatedHelper';\nvar NativeAnimatedAPI = NativeAnimatedHelper.API;\nimport invariant from 'fbjs/lib/invariant';\nvar _uniqueId = 1; // Note(vjeux): this would be better as an interface but flow doesn't\n// support them yet\n\nvar AnimatedNode = /*#__PURE__*/function () {\n  var _proto = AnimatedNode.prototype;\n\n  _proto.__attach = function __attach() {};\n\n  _proto.__detach = function __detach() {\n    if (this.__isNative && this.__nativeTag != null) {\n      NativeAnimatedHelper.API.dropAnimatedNode(this.__nativeTag);\n      this.__nativeTag = undefined;\n    }\n  };\n\n  _proto.__getValue = function __getValue() {};\n\n  _proto.__getAnimatedValue = function __getAnimatedValue() {\n    return this.__getValue();\n  };\n\n  _proto.__addChild = function __addChild(child) {};\n\n  _proto.__removeChild = function __removeChild(child) {};\n\n  _proto.__getChildren = function __getChildren() {\n    return [];\n  }\n  /* Methods and props used by native Animated impl */\n  ;\n\n  function AnimatedNode() {\n    this._listeners = {};\n  }\n\n  _proto.__makeNative = function __makeNative() {\n    if (!this.__isNative) {\n      throw new Error('This node cannot be made a \"native\" animated node');\n    }\n\n    if (this.hasListeners()) {\n      this._startListeningToNativeValueUpdates();\n    }\n  }\n  /**\n   * Adds an asynchronous listener to the value so you can observe updates from\n   * animations.  This is useful because there is no way to\n   * synchronously read the value because it might be driven natively.\n   *\n   * See https://reactnative.dev/docs/animatedvalue.html#addlistener\n   */\n  ;\n\n  _proto.addListener = function addListener(callback) {\n    var id = String(_uniqueId++);\n    this._listeners[id] = callback;\n\n    if (this.__isNative) {\n      this._startListeningToNativeValueUpdates();\n    }\n\n    return id;\n  }\n  /**\n   * Unregister a listener. The `id` param shall match the identifier\n   * previously returned by `addListener()`.\n   *\n   * See https://reactnative.dev/docs/animatedvalue.html#removelistener\n   */\n  ;\n\n  _proto.removeListener = function removeListener(id) {\n    delete this._listeners[id];\n\n    if (this.__isNative && !this.hasListeners()) {\n      this._stopListeningForNativeValueUpdates();\n    }\n  }\n  /**\n   * Remove all registered listeners.\n   *\n   * See https://reactnative.dev/docs/animatedvalue.html#removealllisteners\n   */\n  ;\n\n  _proto.removeAllListeners = function removeAllListeners() {\n    this._listeners = {};\n\n    if (this.__isNative) {\n      this._stopListeningForNativeValueUpdates();\n    }\n  };\n\n  _proto.hasListeners = function hasListeners() {\n    return !!Object.keys(this._listeners).length;\n  };\n\n  _proto._startListeningToNativeValueUpdates = function _startListeningToNativeValueUpdates() {\n    var _this = this;\n\n    if (this.__nativeAnimatedValueListener && !this.__shouldUpdateListenersForNewNativeTag) {\n      return;\n    }\n\n    if (this.__shouldUpdateListenersForNewNativeTag) {\n      this.__shouldUpdateListenersForNewNativeTag = false;\n\n      this._stopListeningForNativeValueUpdates();\n    }\n\n    NativeAnimatedAPI.startListeningToAnimatedNodeValue(this.__getNativeTag());\n    this.__nativeAnimatedValueListener = NativeAnimatedHelper.nativeEventEmitter.addListener('onAnimatedValueUpdate', function (data) {\n      if (data.tag !== _this.__getNativeTag()) {\n        return;\n      }\n\n      _this._onAnimatedValueUpdateReceived(data.value);\n    });\n  };\n\n  _proto._onAnimatedValueUpdateReceived = function _onAnimatedValueUpdateReceived(value) {\n    this.__callListeners(value);\n  };\n\n  _proto.__callListeners = function __callListeners(value) {\n    for (var _key in this._listeners) {\n      this._listeners[_key]({\n        value: value\n      });\n    }\n  };\n\n  _proto._stopListeningForNativeValueUpdates = function _stopListeningForNativeValueUpdates() {\n    if (!this.__nativeAnimatedValueListener) {\n      return;\n    }\n\n    this.__nativeAnimatedValueListener.remove();\n\n    this.__nativeAnimatedValueListener = null;\n    NativeAnimatedAPI.stopListeningToAnimatedNodeValue(this.__getNativeTag());\n  };\n\n  _proto.__getNativeTag = function __getNativeTag() {\n    var _this$__nativeTag;\n\n    NativeAnimatedHelper.assertNativeAnimatedModule();\n    invariant(this.__isNative, 'Attempt to get native tag from node not marked as \"native\"');\n    var nativeTag = (_this$__nativeTag = this.__nativeTag) !== null && _this$__nativeTag !== void 0 ? _this$__nativeTag : NativeAnimatedHelper.generateNewNodeTag();\n\n    if (this.__nativeTag == null) {\n      this.__nativeTag = nativeTag;\n      NativeAnimatedHelper.API.createAnimatedNode(nativeTag, this.__getNativeConfig());\n      this.__shouldUpdateListenersForNewNativeTag = true;\n    }\n\n    return nativeTag;\n  };\n\n  _proto.__getNativeConfig = function __getNativeConfig() {\n    throw new Error('This JS animated node type cannot be used as native animated node');\n  };\n\n  _proto.toJSON = function toJSON() {\n    return this.__getValue();\n  };\n\n  return AnimatedNode;\n}();\n\nexport default AnimatedNode;"]},"metadata":{},"sourceType":"module"}