local G={}local N=require(script:FindFirstAncestor("\080\108\117\103\105\110\070\114\097\109\101\119\111\114\107"))local x local n local h local O local X local f function G.Get(N,G)local j=G.scale local function w(G)local N=G.Text local x=h:GetStore()local n={type=O.RoduxActionType.MACROS.SEARCH_TEXT;data={text=N}}x:dispatch(n)end return x.createElement("\070\114\097\109\101",{BackgroundTransparency=1;Size=UDim2.fromScale(1,1)},{UIPadding=x.createElement("\085\073\080\097\100\100\105\110\103",{PaddingBottom=UDim.new(0,2);PaddingLeft=UDim.new(0,2);PaddingRight=UDim.new(0,2),PaddingTop=UDim.new(0,4)});Background=x.createElement("\070\114\097\109\101",{BackgroundColor3=f:GetColor(f.Indexes.SearchBar.Background),AnchorPoint=Vector2.new(.5,.5);Position=UDim2.fromScale(.5,.5),Size=UDim2.fromScale(.95,1)},{UICorner=x.createElement("\085\073\067\111\114\110\101\114",{CornerRadius=UDim.new(0,15)}),UIListLayout=x.createElement("\085\073\076\105\115\116\076\097\121\111\117\116",{Padding=UDim.new(0,2);FillDirection=Enum.FillDirection.Horizontal,SortOrder=Enum.SortOrder.LayoutOrder}),UIStroke=x.createElement("\085\073\083\116\114\111\107\101",{ApplyStrokeMode=Enum.ApplyStrokeMode.Contextual;Color=f:GetColor(f.Indexes.SearchBar.Stroke);LineJoinMode=Enum.LineJoinMode.Round;Thickness=2,Transparency=.2}),UIPadding=x.createElement("\085\073\080\097\100\100\105\110\103",{PaddingLeft=UDim.new(0,2)});IconContainer=x.createElement("\070\114\097\109\101",{BackgroundTransparency=1,Size=UDim2.new(0,n.SearchBar.Pixel.IconWidth*j,1,0);LayoutOrder=1},{TextLabel=x.createElement("\084\101\120\116\076\097\098\101\108",{BackgroundTransparency=1,Text=n.Icons.Search;TextScaled=true,AnchorPoint=Vector2.new(.5,.5);Position=UDim2.fromScale(.5,.55),Size=UDim2.fromScale(.8,.8),Font=X:GetSetting("\070\111\110\116")})});TextBoxContainer=x.createElement("\070\114\097\109\101",{Size=UDim2.new(1,-n.SearchBar.Pixel.IconWidth*j,1,0);BackgroundTransparency=1;LayoutOrder=2},{TextBox=x.createElement("\084\101\120\116\066\111\120",{Font=X:GetSetting("\070\111\110\116"),PlaceholderText="\083\101\097\114\099\104",Text="",PlaceholderColor3=f:GetColor(f.Indexes.SearchBar.PlaceholderText),TextColor3=f:GetColor(f.Indexes.SearchBar.Text);TextScaled=true,TextXAlignment=Enum.TextXAlignment.Left;AnchorPoint=Vector2.new(0,.5);BackgroundTransparency=1,Position=UDim2.fromScale(0,.5),Size=UDim2.fromScale(.95,1);[x.Change.Text]=w})})})})end function G.FrameworkInit(G)x=N:Require("\082\111\097\099\116")n=N:Require("\087\105\100\103\101\116\067\111\110\115\116\097\110\116\115")h=N:Require("\083\111\099\107\101\116\067\111\110\116\114\111\108\108\101\114")O=N:Require("\083\111\099\107\101\116\067\111\110\115\116\097\110\116\115")X=N:Require("\083\111\099\107\101\116\083\101\116\116\105\110\103\115")f=N:Require("\087\105\100\103\101\116\084\104\101\109\101")end function G.FrameworkStart(G) end return G
---
---Main Widget
---
---@class RoactSearchBar
---
local RoactSearchBar = {}

--------------------------------------------------
-- Types
-- ...

--------------------------------------------------
-- Dependencies
local PluginFramework = require(script:FindFirstAncestor("PluginFramework")) ---@type Framework
local Roact ---@type Roact
local WidgetConstants ---@type WidgetConstants
local SocketController ---@type SocketController
local SocketConstants ---@type SocketConstants
local SocketSettings ---@type SocketSettings
local WidgetTheme ---@type WidgetTheme

--------------------------------------------------
-- Constants
-- ...

--------------------------------------------------
-- Members

---
---@param props table
---@return RoactElement
---
function RoactSearchBar:Get(props)
    -- Read props
    local scale = props.scale ---@type number

    ---@param instance TextBox
    local function onTextChanged(instance)
        local text = instance.Text
        local roduxStore = SocketController:GetStore()

        -- Send action with new text
        ---@type RoduxAction
        local action = {
            type = SocketConstants.RoduxActionType.MACROS.SEARCH_TEXT,
            data = {
                text = text,
            },
        }
        roduxStore:dispatch(action)
    end

    return Roact.createElement("Frame", {
        BackgroundTransparency = 1,
        Size = UDim2.fromScale(1, 1),
    }, {
        UIPadding = Roact.createElement("UIPadding", {
            PaddingBottom = UDim.new(0, 2),
            PaddingLeft = UDim.new(0, 2),
            PaddingRight = UDim.new(0, 2),
            PaddingTop = UDim.new(0, 4),
        }),
        Background = Roact.createElement("Frame", {
            BackgroundColor3 = WidgetTheme:GetColor(WidgetTheme.Indexes.SearchBar.Background),
            AnchorPoint = Vector2.new(0.5, 0.5),
            Position = UDim2.fromScale(0.5, 0.5),
            Size = UDim2.fromScale(0.95, 1),
        }, {
            UICorner = Roact.createElement("UICorner", {
                CornerRadius = UDim.new(0, 15),
            }),
            UIListLayout = Roact.createElement("UIListLayout", {
                Padding = UDim.new(0, 2),
                FillDirection = Enum.FillDirection.Horizontal,
                SortOrder = Enum.SortOrder.LayoutOrder,
            }),
            UIStroke = Roact.createElement("UIStroke", {
                ApplyStrokeMode = Enum.ApplyStrokeMode.Contextual,
                Color = WidgetTheme:GetColor(WidgetTheme.Indexes.SearchBar.Stroke),
                LineJoinMode = Enum.LineJoinMode.Round,
                Thickness = 2,
                Transparency = 0.2,
            }),
            UIPadding = Roact.createElement("UIPadding", {
                PaddingLeft = UDim.new(0, 2),
            }),
            IconContainer = Roact.createElement("Frame", {
                BackgroundTransparency = 1,
                Size = UDim2.new(0, WidgetConstants.SearchBar.Pixel.IconWidth * scale, 1, 0),
                LayoutOrder = 1,
            }, {
                TextLabel = Roact.createElement("TextLabel", {
                    BackgroundTransparency = 1,
                    Text = WidgetConstants.Icons.Search,
                    TextScaled = true,
                    AnchorPoint = Vector2.new(0.5, 0.5),
                    Position = UDim2.fromScale(0.5, 0.55),
                    Size = UDim2.fromScale(0.8, 0.8),
                    Font = SocketSettings:GetSetting("Font"),
                }),
            }),
            TextBoxContainer = Roact.createElement("Frame", {
                Size = UDim2.new(1, -WidgetConstants.SearchBar.Pixel.IconWidth * scale, 1, 0),
                BackgroundTransparency = 1,
                LayoutOrder = 2,
            }, {
                TextBox = Roact.createElement("TextBox", {
                    Font = SocketSettings:GetSetting("Font"),
                    PlaceholderText = "Search",
                    Text = "",
                    PlaceholderColor3 = WidgetTheme:GetColor(WidgetTheme.Indexes.SearchBar.PlaceholderText),
                    TextColor3 = WidgetTheme:GetColor(WidgetTheme.Indexes.SearchBar.Text),
                    TextScaled = true,
                    TextXAlignment = Enum.TextXAlignment.Left,
                    AnchorPoint = Vector2.new(0, 0.5),
                    BackgroundTransparency = 1,
                    Position = UDim2.fromScale(0, 0.5),
                    Size = UDim2.fromScale(0.95, 1),

                    [Roact.Change.Text] = onTextChanged,
                }),
            }),
        }),
    })
end

---
---@private
---
---Asynchronously called with all other FrameworkInit()
---
function RoactSearchBar:FrameworkInit()
    Roact = PluginFramework:Require("Roact")
    WidgetConstants = PluginFramework:Require("WidgetConstants")
    SocketController = PluginFramework:Require("SocketController")
    SocketConstants = PluginFramework:Require("SocketConstants")
    SocketSettings = PluginFramework:Require("SocketSettings")
    WidgetTheme = PluginFramework:Require("WidgetTheme")
end

---
---@private
---
---Synchronously called, one after the other, with all other FrameworkStart()
---
function RoactSearchBar:FrameworkStart() end

return RoactSearchBar
