function RxInstanceUtils.observePropertyBrio(C,J,t)assert(typeof(C)=="\073\110\115\116\097\110\099\101","\066\097\100 \105\110\115\116\097\110\099\101")assert(type(J)=="\115\116\114\105\110\103","\066\097\100 \112\114\111\112\101\114\116\121\078\097\109\101")assert(type(t)=="\102\117\110\099\116\105\111\110"or t==nil,"\066\097\100 \112\114\101\100\105\099\097\116\101")return Observable.new(function(O)local m=Maid.new()local h=UNSET_VALUE local function g()local g=C[J]if h~=g then h=g if not t or t(g)then local t=Brio.new(C[J])m._lastBrio=t if m._lastBrio==t then O:Fire(t)end else m._lastBrio=nil end end end m:GiveTask((C:GetPropertyChangedSignal(J)):Connect(g))g()return m end)end
--[=[
	Returns a brio of the property value

	@param instance Instance
	@param propertyName string
	@param predicate ((value: T) -> boolean)? -- Optional filter
	@return Observable<Brio<T>>
]=]
function RxInstanceUtils.observePropertyBrio(instance, propertyName, predicate)
	assert(typeof(instance) == "Instance", "Bad instance")
	assert(type(propertyName) == "string", "Bad propertyName")
	assert(type(predicate) == "function" or predicate == nil, "Bad predicate")

	return Observable.new(function(sub)
		local maid = Maid.new()
		local lastValue = UNSET_VALUE

		local function handlePropertyChanged()
			local propertyValue = instance[propertyName]

			-- Deferred events can cause multiple values to be queued at once
			-- but we operate at this post-deferred layer, so lets only output
			-- reflected values.
			if lastValue ~= propertyValue then
				lastValue = propertyValue

				if not predicate or predicate(propertyValue) then
					local brio = Brio.new(instance[propertyName])

					maid._lastBrio = brio

					-- The above line can cause us to be overwritten so make sure before firing.
					if maid._lastBrio == brio then
						sub:Fire(brio)
					end
				else
					maid._lastBrio = nil
				end
			end
		end

		maid:GiveTask(instance:GetPropertyChangedSignal(propertyName):Connect(handlePropertyChanged))
		handlePropertyChanged()

		return maid
	end)
end
