local n=game:GetService("\080\108\097\121\101\114\115")local H=game:GetService("\077\097\114\107\101\116\112\108\097\099\101\083\101\114\118\105\099\101")local w=require(script.Parent.Roact)local q=require(script.Parent.RoactMaterial)local b=require(script.Parent.MarketPromise)local r=true local G=w.Component:extend("\083\104\111\112\069\110\116\114\121")G.defaultProps={LayoutOrder=0,EntryName="\083\117\105\116\101";TopText="\083\117\105\116\101",BottomText="";AssetId=5088135,InfoType=Enum.InfoType.GamePass,Theme=q.Themes.Dark}function G.init(H,n)H:setState({PriceText="\069\082\082\095\070\065\073\076";ProductImage="\114\098\120\097\115\115\101\116\058\047\047\116\101\120\116\117\114\101\115\047\117\105\047\071\117\105\073\109\097\103\101\080\108\097\099\101\104\111\108\100\101\114\046\112\110\103"})H.position,H.setPosition=w.createBinding(-49);((b.PromiseProductInfo(n.AssetId,n.InfoType)):AndThen(function(n)if n.PriceInRobux~=0 then H:setState({PriceText=tostring(n.PriceInRobux)})end if n.IconImageAssetId~=0 then H:setState({ProductImage=string.format("\114\098\120\097\115\115\101\116\105\100\058\047\047\037\100",n.IconImageAssetId)})end end)):Catch(warn)end function G.render(b)return w.createElement(q.ThemeProvider,{Theme=b.props.Theme},{[b.props.EntryName]=w.createElement("\070\114\097\109\101",{BackgroundTransparency=1;LayoutOrder=b.props.LayoutOrder,Size=UDim2.fromScale(.75,.75);AnchorPoint=Vector2.new(.5,.5),Position=UDim2.fromScale(.5,.5),ClipsDescendants=true},{w.createElement(q.Shadow,{Elevation=4});ShopMain=w.createElement("\073\109\097\103\101\076\097\098\101\108",{BackgroundTransparency=1,Size=UDim2.fromScale(1,1);ZIndex=6;ClipsDescendants=true,Image="\114\098\120\097\115\115\101\116\105\100\058\047\047\049\057\051\052\054\050\052\050\048\053";ImageColor3=Color3.fromRGB(30,30,30);ScaleType=Enum.ScaleType.Slice,SliceCenter=Rect.new(4,4,252,252)},{PurchaseButton=w.createElement(q.TransparentButton,{ZIndex=12;Size=UDim2.fromScale(1,1);OnClicked=function()if b.props.InfoType==Enum.InfoType.GamePass then H:PromptGamePassPurchase(n.LocalPlayer,b.props.AssetId)elseif b.props.InfoType==Enum.InfoType.Product then H:PromptProductPurchase(n.LocalPlayer,b.props.AssetId)end end});ContainerFrame=w.createElement("\070\114\097\109\101",{Size=UDim2.fromScale(1,1);BackgroundTransparency=1},{w.createElement("\085\073\076\105\115\116\076\097\121\111\117\116",{HorizontalAlignment=Enum.HorizontalAlignment.Center;SortOrder=Enum.SortOrder.LayoutOrder});w.createElement("\085\073\080\097\100\100\105\110\103",{PaddingBottom=UDim.new(.05,0);PaddingLeft=UDim.new(.143,0),PaddingRight=UDim.new(.143,0);PaddingTop=UDim.new(.05,0)}),GamePassIcon=w.createElement("\073\109\097\103\101\076\097\098\101\108",{Size=UDim2.fromScale(.95,.95);BackgroundTransparency=1,ZIndex=6;Image=b.state.ProductImage},table.create(1,w.createElement("\085\073\065\115\112\101\099\116\082\097\116\105\111\067\111\110\115\116\114\097\105\110\116"))),ItemTitle=w.createElement("\070\114\097\109\101",{BackgroundTransparency=1,LayoutOrder=1;Size=UDim2.fromScale(1,.2);ZIndex=6},{w.createElement("\085\073\076\105\115\116\076\097\121\111\117\116",{HorizontalAlignment=Enum.HorizontalAlignment.Center;SortOrder=Enum.SortOrder.LayoutOrder});TopTitle=w.createElement("\084\101\120\116\076\097\098\101\108",{BackgroundTransparency=1,Size=UDim2.fromScale(1,.5);ZIndex=6;Font=Enum.Font.SourceSans;Text=b.props.TopText,TextColor3=Color3.new(1,1,1),TextScaled=true,TextTransparency=.129,TextXAlignment=Enum.TextXAlignment.Left,TextYAlignment=Enum.TextYAlignment.Top});BottomTitle=w.createElement("\084\101\120\116\076\097\098\101\108",{BackgroundTransparency=1,Size=UDim2.fromScale(1,.5),ZIndex=6,LayoutOrder=1;Font=Enum.Font.SourceSans;Text=b.props.BottomText;TextColor3=Color3.new(1,1,1);TextScaled=true;TextTransparency=.129;TextXAlignment=Enum.TextXAlignment.Left})});PriceFrame=w.createElement("\070\114\097\109\101",{LayoutOrder=2,BackgroundTransparency=1;Size=UDim2.fromScale(1,.096);ZIndex=6},{ItemPrice=w.createElement("\084\101\120\116\076\097\098\101\108",{BackgroundTransparency=1,Size=UDim2.fromScale(1,1);ZIndex=6;Font=Enum.Font.SourceSansSemibold,Text=b.state.PriceText;TextColor3=Color3.fromRGB(0,150,136),TextScaled=true,TextXAlignment=Enum.TextXAlignment.Right;[w.Event.Changed]=function(n,H)if H=="\084\101\120\116\066\111\117\110\100\115"or string.match(H,"\083\105\122\101\036")then b.setPosition(-(n.TextBounds.X+4))end end});RobuxIcon=w.createElement("\073\109\097\103\101\076\097\098\101\108",{AnchorPoint=Vector2.new(1,0),BackgroundTransparency=1;Position=b.position:map(function(n)return UDim2.new(1,n,0,0)end);Size=UDim2.fromScale(1,1);ZIndex=12;Image="\114\098\120\097\115\115\101\116\105\100\058\047\047\052\052\053\054\050\054\053\057\051\049",ImageColor3=Color3.fromRGB(0,150,136);ImageRectOffset=Vector2.new(43,47),ImageRectSize=Vector2.new(28,32)},table.create(1,w.createElement("\085\073\065\115\112\101\099\116\082\097\116\105\111\067\111\110\115\116\114\097\105\110\116")))})})})})})end return G
local Players = game:GetService("Players")
local MarketplaceService = game:GetService("MarketplaceService")
local Roact = require(script.Parent.Roact)
local RoactMaterial = require(script.Parent.RoactMaterial)
local MarketPromise = require(script.Parent.MarketPromise)

local UI_CORNER_ENABLED = true

local ShopEntry = Roact.Component:extend("ShopEntry")
ShopEntry.defaultProps = {
	LayoutOrder = 0,
	EntryName = "Suite",
	TopText = "Suite",
	BottomText = "",
	AssetId = 5088135,
	InfoType = Enum.InfoType.GamePass,
	Theme = RoactMaterial.Themes.Dark,
}

function ShopEntry:init(props)
	self:setState({
		PriceText = "ERR_FAIL",
		ProductImage = "rbxasset://textures/ui/GuiImagePlaceholder.png",
	})

	self.position, self.setPosition = Roact.createBinding(-49)
	MarketPromise.PromiseProductInfo(props.AssetId, props.InfoType):AndThen(function(ProductInfo)
		if ProductInfo.PriceInRobux ~= 0 then
			self:setState({
				PriceText = tostring(ProductInfo.PriceInRobux),
			})
		end

		if ProductInfo.IconImageAssetId ~= 0 then
			self:setState({
				ProductImage = string.format("rbxassetid://%d", ProductInfo.IconImageAssetId),
			})
		end
	end):Catch(warn)
end

function ShopEntry:render()
	return Roact.createElement(RoactMaterial.ThemeProvider, {
		Theme = self.props.Theme,
	}, {
		[self.props.EntryName] = Roact.createElement("Frame", {
			BackgroundTransparency = 1,
			LayoutOrder = self.props.LayoutOrder,
			Size = UDim2.fromScale(0.75, 0.75),
			AnchorPoint = Vector2.new(0.5, 0.5),
			Position = UDim2.fromScale(0.5, 0.5),
			ClipsDescendants = true,
		}, {
			Roact.createElement(RoactMaterial.Shadow, {
				Elevation = 4,
			}),

			ShopMain = Roact.createElement("ImageLabel", {
				BackgroundTransparency = 1,
				Size = UDim2.fromScale(1, 1),
				ZIndex = 6,
				ClipsDescendants = true,
				Image = "rbxassetid://1934624205",
				ImageColor3 = Color3.fromRGB(30, 30, 30),
				ScaleType = Enum.ScaleType.Slice,
				SliceCenter = Rect.new(4, 4, 252, 252),
			}, {
				PurchaseButton = Roact.createElement(RoactMaterial.TransparentButton, {
					ZIndex = 12,
					Size = UDim2.fromScale(1, 1),
					OnClicked = function()
						if self.props.InfoType == Enum.InfoType.GamePass then
							MarketplaceService:PromptGamePassPurchase(Players.LocalPlayer, self.props.AssetId)
						elseif self.props.InfoType == Enum.InfoType.Product then
							MarketplaceService:PromptProductPurchase(Players.LocalPlayer, self.props.AssetId)
						end
					end,
				}),

				ContainerFrame = Roact.createElement("Frame", {
					Size = UDim2.fromScale(1, 1),
					BackgroundTransparency = 1,
				}, {
					Roact.createElement("UIListLayout", {
						HorizontalAlignment = Enum.HorizontalAlignment.Center,
						SortOrder = Enum.SortOrder.LayoutOrder,
					}),

					Roact.createElement("UIPadding", {
						PaddingBottom = UDim.new(0.05, 0),
						PaddingLeft = UDim.new(0.143, 0),
						PaddingRight = UDim.new(0.143, 0),
						PaddingTop = UDim.new(0.05, 0),
					}),

					GamePassIcon = Roact.createElement("ImageLabel", {
						Size = UDim2.fromScale(0.95, 0.95),
						BackgroundTransparency = 1,
						ZIndex = 6,
						Image = self.state.ProductImage,
					}, table.create(1, Roact.createElement("UIAspectRatioConstraint"))),

					ItemTitle = Roact.createElement("Frame", {
						BackgroundTransparency = 1,
						LayoutOrder = 1,
						Size = UDim2.fromScale(1, 0.2),
						ZIndex = 6,
					}, {
						Roact.createElement("UIListLayout", {
							HorizontalAlignment = Enum.HorizontalAlignment.Center,
							SortOrder = Enum.SortOrder.LayoutOrder,
						}),

						TopTitle = Roact.createElement("TextLabel", {
							BackgroundTransparency = 1,
							Size = UDim2.fromScale(1, 0.5),
							ZIndex = 6,
							Font = Enum.Font.SourceSans,
							Text = self.props.TopText,
							TextColor3 = Color3.new(1, 1, 1),
							TextScaled = true,
							TextTransparency = 0.129,
							TextXAlignment = Enum.TextXAlignment.Left,
							TextYAlignment = Enum.TextYAlignment.Top,
						}),

						BottomTitle = Roact.createElement("TextLabel", {
							BackgroundTransparency = 1,
							Size = UDim2.fromScale(1, 0.5),
							ZIndex = 6,
							LayoutOrder = 1,
							Font = Enum.Font.SourceSans,
							Text = self.props.BottomText,
							TextColor3 = Color3.new(1, 1, 1),
							TextScaled = true,
							TextTransparency = 0.129,
							TextXAlignment = Enum.TextXAlignment.Left,
						}),
					}),

					PriceFrame = Roact.createElement("Frame", {
						LayoutOrder = 2,
						BackgroundTransparency = 1,
						Size = UDim2.fromScale(1, 0.096),
						ZIndex = 6,
					}, {
						ItemPrice = Roact.createElement("TextLabel", {
							BackgroundTransparency = 1,
							Size = UDim2.fromScale(1, 1),
							ZIndex = 6,
							Font = Enum.Font.SourceSansSemibold,
							Text = self.state.PriceText,
							TextColor3 = Color3.fromRGB(0, 150, 136),
							TextScaled = true,
							TextXAlignment = Enum.TextXAlignment.Right,
							[Roact.Event.Changed] = function(rbx, property)
								if property == "TextBounds" or string.match(property, "Size$") then
									self.setPosition(-(rbx.TextBounds.X + 4))
								end
							end,
						}),

						RobuxIcon = Roact.createElement("ImageLabel", {
							AnchorPoint = Vector2.new(1, 0),
							BackgroundTransparency = 1,
							Position = self.position:map(function(value)
								return UDim2.new(1, value, 0, 0)
							end),

							Size = UDim2.fromScale(1, 1),
							ZIndex = 12,
							Image = "rbxassetid://4456265931",
							ImageColor3 = Color3.fromRGB(0, 150, 136),
							ImageRectOffset = Vector2.new(43, 47),
							ImageRectSize = Vector2.new(28, 32),
						}, table.create(1, Roact.createElement("UIAspectRatioConstraint"))),
					}),
				}),
			}),
		}),
	})
end

return ShopEntry