{"ast":null,"code":"import { getBatch } from './batch'; // encapsulates the subscription logic for connecting a component to the redux store, as\n// well as nesting subscriptions of descendant components, so that we can ensure the\n// ancestor components re-render before descendants\n\nfunction createListenerCollection() {\n var batch = getBatch();\n var first = null;\n var last = null;\n return {\n clear: function clear() {\n first = null;\n last = null;\n },\n notify: function notify() {\n batch(function () {\n var listener = first;\n\n while (listener) {\n listener.callback();\n listener = listener.next;\n }\n });\n },\n get: function get() {\n var listeners = [];\n var listener = first;\n\n while (listener) {\n listeners.push(listener);\n listener = listener.next;\n }\n\n return listeners;\n },\n subscribe: function subscribe(callback) {\n var isSubscribed = true;\n var listener = last = {\n callback: callback,\n next: null,\n prev: last\n };\n\n if (listener.prev) {\n listener.prev.next = listener;\n } else {\n first = listener;\n }\n\n return function unsubscribe() {\n if (!isSubscribed || first === null) return;\n isSubscribed = false;\n\n if (listener.next) {\n listener.next.prev = listener.prev;\n } else {\n last = listener.prev;\n }\n\n if (listener.prev) {\n listener.prev.next = listener.next;\n } else {\n first = listener.next;\n }\n };\n }\n };\n}\n\nvar nullListeners = {\n notify: function notify() {},\n get: function get() {\n return [];\n }\n};\nexport function createSubscription(store, parentSub) {\n var unsubscribe;\n var listeners = nullListeners;\n\n function addNestedSub(listener) {\n trySubscribe();\n return listeners.subscribe(listener);\n }\n\n function notifyNestedSubs() {\n listeners.notify();\n }\n\n function handleChangeWrapper() {\n if (subscription.onStateChange) {\n subscription.onStateChange();\n }\n }\n\n function isSubscribed() {\n return Boolean(unsubscribe);\n }\n\n function trySubscribe() {\n if (!unsubscribe) {\n unsubscribe = parentSub ? parentSub.addNestedSub(handleChangeWrapper) : store.subscribe(handleChangeWrapper);\n listeners = createListenerCollection();\n }\n }\n\n function tryUnsubscribe() {\n if (unsubscribe) {\n unsubscribe();\n unsubscribe = undefined;\n listeners.clear();\n listeners = nullListeners;\n }\n }\n\n var subscription = {\n addNestedSub: addNestedSub,\n notifyNestedSubs: notifyNestedSubs,\n handleChangeWrapper: handleChangeWrapper,\n isSubscribed: isSubscribed,\n trySubscribe: trySubscribe,\n tryUnsubscribe: tryUnsubscribe,\n getListeners: function getListeners() {\n return listeners;\n }\n };\n return subscription;\n}","map":{"version":3,"names":["getBatch","createListenerCollection","batch","first","last","clear","notify","listener","callback","next","get","listeners","push","subscribe","isSubscribed","prev","unsubscribe","nullListeners","createSubscription","store","parentSub","addNestedSub","trySubscribe","notifyNestedSubs","handleChangeWrapper","subscription","onStateChange","Boolean","tryUnsubscribe","undefined","getListeners"],"sources":["/Users/mahdi/Documents/work/programming/barnameNegar/arbaeenWebApp/node_modules/react-redux/es/utils/Subscription.js"],"sourcesContent":["import { getBatch } from './batch'; // encapsulates the subscription logic for connecting a component to the redux store, as\n// well as nesting subscriptions of descendant components, so that we can ensure the\n// ancestor components re-render before descendants\n\nfunction createListenerCollection() {\n var batch = getBatch();\n var first = null;\n var last = null;\n return {\n clear: function clear() {\n first = null;\n last = null;\n },\n notify: function notify() {\n batch(function () {\n var listener = first;\n\n while (listener) {\n listener.callback();\n listener = listener.next;\n }\n });\n },\n get: function get() {\n var listeners = [];\n var listener = first;\n\n while (listener) {\n listeners.push(listener);\n listener = listener.next;\n }\n\n return listeners;\n },\n subscribe: function subscribe(callback) {\n var isSubscribed = true;\n var listener = last = {\n callback: callback,\n next: null,\n prev: last\n };\n\n if (listener.prev) {\n listener.prev.next = listener;\n } else {\n first = listener;\n }\n\n return function unsubscribe() {\n if (!isSubscribed || first === null) return;\n isSubscribed = false;\n\n if (listener.next) {\n listener.next.prev = listener.prev;\n } else {\n last = listener.prev;\n }\n\n if (listener.prev) {\n listener.prev.next = listener.next;\n } else {\n first = listener.next;\n }\n };\n }\n };\n}\n\nvar nullListeners = {\n notify: function notify() {},\n get: function get() {\n return [];\n }\n};\nexport function createSubscription(store, parentSub) {\n var unsubscribe;\n var listeners = nullListeners;\n\n function addNestedSub(listener) {\n trySubscribe();\n return listeners.subscribe(listener);\n }\n\n function notifyNestedSubs() {\n listeners.notify();\n }\n\n function handleChangeWrapper() {\n if (subscription.onStateChange) {\n subscription.onStateChange();\n }\n }\n\n function isSubscribed() {\n return Boolean(unsubscribe);\n }\n\n function trySubscribe() {\n if (!unsubscribe) {\n unsubscribe = parentSub ? parentSub.addNestedSub(handleChangeWrapper) : store.subscribe(handleChangeWrapper);\n listeners = createListenerCollection();\n }\n }\n\n function tryUnsubscribe() {\n if (unsubscribe) {\n unsubscribe();\n unsubscribe = undefined;\n listeners.clear();\n listeners = nullListeners;\n }\n }\n\n var subscription = {\n addNestedSub: addNestedSub,\n notifyNestedSubs: notifyNestedSubs,\n handleChangeWrapper: handleChangeWrapper,\n isSubscribed: isSubscribed,\n trySubscribe: trySubscribe,\n tryUnsubscribe: tryUnsubscribe,\n getListeners: function getListeners() {\n return listeners;\n }\n };\n return subscription;\n}"],"mappings":"AAAA,SAASA,QAAT,QAAyB,SAAzB,C,CAAoC;AACpC;AACA;;AAEA,SAASC,wBAAT,GAAoC;EAClC,IAAIC,KAAK,GAAGF,QAAQ,EAApB;EACA,IAAIG,KAAK,GAAG,IAAZ;EACA,IAAIC,IAAI,GAAG,IAAX;EACA,OAAO;IACLC,KAAK,EAAE,SAASA,KAAT,GAAiB;MACtBF,KAAK,GAAG,IAAR;MACAC,IAAI,GAAG,IAAP;IACD,CAJI;IAKLE,MAAM,EAAE,SAASA,MAAT,GAAkB;MACxBJ,KAAK,CAAC,YAAY;QAChB,IAAIK,QAAQ,GAAGJ,KAAf;;QAEA,OAAOI,QAAP,EAAiB;UACfA,QAAQ,CAACC,QAAT;UACAD,QAAQ,GAAGA,QAAQ,CAACE,IAApB;QACD;MACF,CAPI,CAAL;IAQD,CAdI;IAeLC,GAAG,EAAE,SAASA,GAAT,GAAe;MAClB,IAAIC,SAAS,GAAG,EAAhB;MACA,IAAIJ,QAAQ,GAAGJ,KAAf;;MAEA,OAAOI,QAAP,EAAiB;QACfI,SAAS,CAACC,IAAV,CAAeL,QAAf;QACAA,QAAQ,GAAGA,QAAQ,CAACE,IAApB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