function Blend.Shared(t)return t:Pipe({Rx.cache()})end function Blend.Dynamic(...)return(Blend.Computed(...)):Pipe({Rx.switchMap(function(t,...)if Promise.isPromise(t)then return Rx.fromPromise(t)elseif Observable.isObservable(t)then return t else return Rx.of(t,...)end end)})end
--[=[
	Shares this observables state/computation with all down-stream observables. This can be useful
	when a very expensive computation was done and needs to be shared.

	Generally not needed.

	@param observable Observable<T>
	@return Observable<T>
]=]
function Blend.Shared(observable)
	return observable:Pipe({
		Rx.cache(),
	})
end

function Blend.Dynamic(...)
	return Blend.Computed(...):Pipe({
		-- This switch map is relatively expensive, so we don't do this for defaul computed
		-- and instead force the user to switch to another promise
		Rx.switchMap(function(promise, ...)
			if Promise.isPromise(promise) then
				return Rx.fromPromise(promise)
			elseif Observable.isObservable(promise) then
				return promise
			else
				return Rx.of(promise, ...)
			end
		end),
	})
end
