1 line
18 KiB
JSON
1 line
18 KiB
JSON
{"ast":null,"code":"import { fromArray } from './fromArray';\nimport { isArray } from '../util/isArray';\nimport { Subscriber } from '../Subscriber';\nimport { iterator as Symbol_iterator } from '../../internal/symbol/iterator';\nimport { SimpleOuterSubscriber, SimpleInnerSubscriber, innerSubscribe } from '../innerSubscribe';\nexport function zip(...observables) {\n const resultSelector = observables[observables.length - 1];\n\n if (typeof resultSelector === 'function') {\n observables.pop();\n }\n\n return fromArray(observables, undefined).lift(new ZipOperator(resultSelector));\n}\nexport class ZipOperator {\n constructor(resultSelector) {\n this.resultSelector = resultSelector;\n }\n\n call(subscriber, source) {\n return source.subscribe(new ZipSubscriber(subscriber, this.resultSelector));\n }\n\n}\nexport class ZipSubscriber extends Subscriber {\n constructor(destination, resultSelector, values = Object.create(null)) {\n super(destination);\n this.resultSelector = resultSelector;\n this.iterators = [];\n this.active = 0;\n this.resultSelector = typeof resultSelector === 'function' ? resultSelector : undefined;\n }\n\n _next(value) {\n const iterators = this.iterators;\n\n if (isArray(value)) {\n iterators.push(new StaticArrayIterator(value));\n } else if (typeof value[Symbol_iterator] === 'function') {\n iterators.push(new StaticIterator(value[Symbol_iterator]()));\n } else {\n iterators.push(new ZipBufferIterator(this.destination, this, value));\n }\n }\n\n _complete() {\n const iterators = this.iterators;\n const len = iterators.length;\n this.unsubscribe();\n\n if (len === 0) {\n this.destination.complete();\n return;\n }\n\n this.active = len;\n\n for (let i = 0; i < len; i++) {\n let iterator = iterators[i];\n\n if (iterator.stillUnsubscribed) {\n const destination = this.destination;\n destination.add(iterator.subscribe());\n } else {\n this.active--;\n }\n }\n }\n\n notifyInactive() {\n this.active--;\n\n if (this.active === 0) {\n this.destination.complete();\n }\n }\n\n checkIterators() {\n const iterators = this.iterators;\n const len = iterators.length;\n const destination = this.destination;\n\n for (let i = 0; i < len; i++) {\n let iterator = iterators[i];\n\n if (typeof iterator.hasValue === 'function' && !iterator.hasValue()) {\n return;\n }\n }\n\n let shouldComplete = false;\n const args = [];\n\n for (let i = 0; i < len; i++) {\n let iterator = iterators[i];\n let result = iterator.next();\n\n if (iterator.hasCompleted()) {\n shouldComplete = true;\n }\n\n if (result.done) {\n destination.complete();\n return;\n }\n\n args.push(result.value);\n }\n\n if (this.resultSelector) {\n this._tryresultSelector(args);\n } else {\n destination.next(args);\n }\n\n if (shouldComplete) {\n destination.complete();\n }\n }\n\n _tryresultSelector(args) {\n let result;\n\n try {\n result = this.resultSelector.apply(this, args);\n } catch (err) {\n this.destination.error(err);\n return;\n }\n\n this.destination.next(result);\n }\n\n}\n\nclass StaticIterator {\n constructor(iterator) {\n this.iterator = iterator;\n this.nextResult = iterator.next();\n }\n\n hasValue() {\n return true;\n }\n\n next() {\n const result = this.nextResult;\n this.nextResult = this.iterator.next();\n return result;\n }\n\n hasCompleted() {\n const nextResult = this.nextResult;\n return Boolean(nextResult && nextResult.done);\n }\n\n}\n\nclass StaticArrayIterator {\n constructor(array) {\n this.array = array;\n this.index = 0;\n this.length = 0;\n this.length = array.length;\n }\n\n [Symbol_iterator]() {\n return this;\n }\n\n next(value) {\n const i = this.index++;\n const array = this.array;\n return i < this.length ? {\n value: array[i],\n done: false\n } : {\n value: null,\n done: true\n };\n }\n\n hasValue() {\n return this.array.length > this.index;\n }\n\n hasCompleted() {\n return this.array.length === this.index;\n }\n\n}\n\nclass ZipBufferIterator extends SimpleOuterSubscriber {\n constructor(destination, parent, observable) {\n super(destination);\n this.parent = parent;\n this.observable = observable;\n this.stillUnsubscribed = true;\n this.buffer = [];\n this.isComplete = false;\n }\n\n [Symbol_iterator]() {\n return this;\n }\n\n next() {\n const buffer = this.buffer;\n\n if (buffer.length === 0 && this.isComplete) {\n return {\n value: null,\n done: true\n };\n } else {\n return {\n value: buffer.shift(),\n done: false\n };\n }\n }\n\n hasValue() {\n return this.buffer.length > 0;\n }\n\n hasCompleted() {\n return this.buffer.length === 0 && this.isComplete;\n }\n\n notifyComplete() {\n if (this.buffer.length > 0) {\n this.isComplete = true;\n this.parent.notifyInactive();\n } else {\n this.destination.complete();\n }\n }\n\n notifyNext(innerValue) {\n this.buffer.push(innerValue);\n this.parent.checkIterators();\n }\n\n subscribe() {\n return innerSubscribe(this.observable, new SimpleInnerSubscriber(this));\n }\n\n}","map":{"version":3,"names":["fromArray","isArray","Subscriber","iterator","Symbol_iterator","SimpleOuterSubscriber","SimpleInnerSubscriber","innerSubscribe","zip","observables","resultSelector","length","pop","undefined","lift","ZipOperator","constructor","call","subscriber","source","subscribe","ZipSubscriber","destination","values","Object","create","iterators","active","_next","value","push","StaticArrayIterator","StaticIterator","ZipBufferIterator","_complete","len","unsubscribe","complete","i","stillUnsubscribed","add","notifyInactive","checkIterators","hasValue","shouldComplete","args","result","next","hasCompleted","done","_tryresultSelector","apply","err","error","nextResult","Boolean","array","index","parent","observable","buffer","isComplete","shift","notifyComplete","notifyNext","innerValue"],"sources":["D:/MobileDev/WRB/WrenchBoard2023a/node_modules/rxjs/_esm2015/internal/observable/zip.js"],"sourcesContent":["import { fromArray } from './fromArray';\nimport { isArray } from '../util/isArray';\nimport { Subscriber } from '../Subscriber';\nimport { iterator as Symbol_iterator } from '../../internal/symbol/iterator';\nimport { SimpleOuterSubscriber, SimpleInnerSubscriber, innerSubscribe } from '../innerSubscribe';\nexport function zip(...observables) {\n const resultSelector = observables[observables.length - 1];\n if (typeof resultSelector === 'function') {\n observables.pop();\n }\n return fromArray(observables, undefined).lift(new ZipOperator(resultSelector));\n}\nexport class ZipOperator {\n constructor(resultSelector) {\n this.resultSelector = resultSelector;\n }\n call(subscriber, source) {\n return source.subscribe(new ZipSubscriber(subscriber, this.resultSelector));\n }\n}\nexport class ZipSubscriber extends Subscriber {\n constructor(destination, resultSelector, values = Object.create(null)) {\n super(destination);\n this.resultSelector = resultSelector;\n this.iterators = [];\n this.active = 0;\n this.resultSelector = (typeof resultSelector === 'function') ? resultSelector : undefined;\n }\n _next(value) {\n const iterators = this.iterators;\n if (isArray(value)) {\n iterators.push(new StaticArrayIterator(value));\n }\n else if (typeof value[Symbol_iterator] === 'function') {\n iterators.push(new StaticIterator(value[Symbol_iterator]()));\n }\n else {\n iterators.push(new ZipBufferIterator(this.destination, this, value));\n }\n }\n _complete() {\n const iterators = this.iterators;\n const len = iterators.length;\n this.unsubscribe();\n if (len === 0) {\n this.destination.complete();\n return;\n }\n this.active = len;\n for (let i = 0; i < len; i++) {\n let iterator = iterators[i];\n if (iterator.stillUnsubscribed) {\n const destination = this.destination;\n destination.add(iterator.subscribe());\n }\n else {\n this.active--;\n }\n }\n }\n notifyInactive() {\n this.active--;\n if (this.active === 0) {\n this.destination.complete();\n }\n }\n checkIterators() {\n const iterators = this.iterators;\n const len = iterators.length;\n const destination = this.destination;\n for (let i = 0; i < len; i++) {\n let iterator = iterators[i];\n if (typeof iterator.hasValue === 'function' && !iterator.hasValue()) {\n return;\n }\n }\n let shouldComplete = false;\n const args = [];\n for (let i = 0; i < len; i++) {\n let iterator = iterators[i];\n let result = iterator.next();\n if (iterator.hasCompleted()) {\n shouldComplete = true;\n }\n if (result.done) {\n destination.complete();\n return;\n }\n args.push(result.value);\n }\n if (this.resultSelector) {\n this._tryresultSelector(args);\n }\n else {\n destination.next(args);\n }\n if (shouldComplete) {\n destination.complete();\n }\n }\n _tryresultSelector(args) {\n let result;\n try {\n result = this.resultSelector.apply(this, args);\n }\n catch (err) {\n this.destination.error(err);\n return;\n }\n this.destination.next(result);\n }\n}\nclass StaticIterator {\n constructor(iterator) {\n this.iterator = iterator;\n this.nextResult = iterator.next();\n }\n hasValue() {\n return true;\n }\n next() {\n const result = this.nextResult;\n this.nextResult = this.iterator.next();\n return result;\n }\n hasCompleted() {\n const nextResult = this.nextResult;\n return Boolean(nextResult && nextResult.done);\n }\n}\nclass StaticArrayIterator {\n constructor(array) {\n this.array = array;\n this.index = 0;\n this.length = 0;\n this.length = array.length;\n }\n [Symbol_iterator]() {\n return this;\n }\n next(value) {\n const i = this.index++;\n const array = this.array;\n return i < this.length ? { value: array[i], done: false } : { value: null, done: true };\n }\n hasValue() {\n return this.array.length > this.index;\n }\n hasCompleted() {\n return this.array.length === this.index;\n }\n}\nclass ZipBufferIterator extends SimpleOuterSubscriber {\n constructor(destination, parent, observable) {\n super(destination);\n this.parent = parent;\n this.observable = observable;\n this.stillUnsubscribed = true;\n this.buffer = [];\n this.isComplete = false;\n }\n [Symbol_iterator]() {\n return this;\n }\n next() {\n const buffer = this.buffer;\n if (buffer.length === 0 && this.isComplete) {\n return { value: null, done: true };\n }\n else {\n return { value: buffer.shift(), done: false };\n }\n }\n hasValue() {\n return this.buffer.length > 0;\n }\n hasCompleted() {\n return this.buffer.length === 0 && this.isComplete;\n }\n notifyComplete() {\n if (this.buffer.length > 0) {\n this.isComplete = true;\n this.parent.notifyInactive();\n }\n else {\n this.destination.complete();\n }\n }\n notifyNext(innerValue) {\n this.buffer.push(innerValue);\n this.parent.checkIterators();\n }\n subscribe() {\n return innerSubscribe(this.observable, new SimpleInnerSubscriber(this));\n }\n}\n"],"mappings":"AAAA,SAASA,SAAT,QAA0B,aAA1B;AACA,SAASC,OAAT,QAAwB,iBAAxB;AACA,SAASC,UAAT,QAA2B,eAA3B;AACA,SAASC,QAAQ,IAAIC,eAArB,QAA4C,gCAA5C;AACA,SAASC,qBAAT,EAAgCC,qBAAhC,EAAuDC,cAAvD,QAA6E,mBAA7E;AACA,OAAO,SAASC,GAAT,CAAa,GAAGC,WAAhB,EAA6B;EAChC,MAAMC,cAAc,GAAGD,WAAW,CAACA,WAAW,CAACE,MAAZ,GAAqB,CAAtB,CAAlC;;EACA,IAAI,OAAOD,cAAP,KAA0B,UAA9B,EAA0C;IACtCD,WAAW,CAACG,GAAZ;EACH;;EACD,OAAOZ,SAAS,CAACS,WAAD,EAAcI,SAAd,CAAT,CAAkCC,IAAlC,CAAuC,IAAIC,WAAJ,CAAgBL,cAAhB,CAAvC,CAAP;AACH;AACD,OAAO,MAAMK,WAAN,CAAkB;EACrBC,WAAW,CAACN,cAAD,EAAiB;IACxB,KAA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