2025-01-04 18:51:40 -05:00
// Code generated by templ - DO NOT EDIT.
2025-01-04 21:13:51 -05:00
// templ: version: v0.3.819
2025-01-04 18:51:40 -05:00
package islands
//lint:file-ignore SA4006 This context is only used if a nested component is present.
import "github.com/a-h/templ"
import templruntime "github.com/a-h/templ/runtime"
import "fmt"
func HumanSlider ( firstNumber int , lastNumber int ) templ . Component {
return templruntime . GeneratedTemplate ( func ( templ_7745c5c3_Input templruntime . GeneratedComponentInput ) ( templ_7745c5c3_Err error ) {
templ_7745c5c3_W , ctx := templ_7745c5c3_Input . Writer , templ_7745c5c3_Input . Context
if templ_7745c5c3_CtxErr := ctx . Err ( ) ; templ_7745c5c3_CtxErr != nil {
return templ_7745c5c3_CtxErr
}
templ_7745c5c3_Buffer , templ_7745c5c3_IsBuffer := templruntime . GetBuffer ( templ_7745c5c3_W )
if ! templ_7745c5c3_IsBuffer {
defer func ( ) {
templ_7745c5c3_BufErr := templruntime . ReleaseBuffer ( templ_7745c5c3_Buffer )
if templ_7745c5c3_Err == nil {
templ_7745c5c3_Err = templ_7745c5c3_BufErr
}
} ( )
}
ctx = templ . InitializeContext ( ctx )
templ_7745c5c3_Var1 := templ . GetChildren ( ctx )
if templ_7745c5c3_Var1 == nil {
templ_7745c5c3_Var1 = templ . NopComponent
}
ctx = templ . ClearChildren ( ctx )
2025-01-04 21:13:51 -05:00
templ_7745c5c3_Err = templruntime . WriteString ( templ_7745c5c3_Buffer , 1 , "<div hx-target=\"this\" hx-swap=\"outerHTML\"><sl-range name=\"is_human\" label=\"" )
2025-01-04 18:51:40 -05:00
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var2 string
templ_7745c5c3_Var2 , templ_7745c5c3_Err = templ . JoinStringErrs ( humanLabel ( firstNumber , lastNumber ) )
if templ_7745c5c3_Err != nil {
2025-01-06 19:40:10 -05:00
return templ . Error { Err : templ_7745c5c3_Err , FileName : ` app/islands/human_slider.templ ` , Line : 7 , Col : 71 }
2025-01-04 18:51:40 -05:00
}
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( templ . EscapeString ( templ_7745c5c3_Var2 ) )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
2025-01-04 21:13:51 -05:00
templ_7745c5c3_Err = templruntime . WriteString ( templ_7745c5c3_Buffer , 2 , "\" help-text=\"Prove you are a human.\" min=\"0\" max=\"9\" step=\"1\" hx-post=\"/register/profile/is_human\"></sl-range></div>" )
2025-01-04 18:51:40 -05:00
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
2025-01-04 21:13:51 -05:00
return nil
2025-01-04 18:51:40 -05:00
} )
}
func HumanSliderError ( firstNumber int , lastNumber int ) templ . Component {
return templruntime . GeneratedTemplate ( func ( templ_7745c5c3_Input templruntime . GeneratedComponentInput ) ( templ_7745c5c3_Err error ) {
templ_7745c5c3_W , ctx := templ_7745c5c3_Input . Writer , templ_7745c5c3_Input . Context
if templ_7745c5c3_CtxErr := ctx . Err ( ) ; templ_7745c5c3_CtxErr != nil {
return templ_7745c5c3_CtxErr
}
templ_7745c5c3_Buffer , templ_7745c5c3_IsBuffer := templruntime . GetBuffer ( templ_7745c5c3_W )
if ! templ_7745c5c3_IsBuffer {
defer func ( ) {
templ_7745c5c3_BufErr := templruntime . ReleaseBuffer ( templ_7745c5c3_Buffer )
if templ_7745c5c3_Err == nil {
templ_7745c5c3_Err = templ_7745c5c3_BufErr
}
} ( )
}
ctx = templ . InitializeContext ( ctx )
templ_7745c5c3_Var3 := templ . GetChildren ( ctx )
if templ_7745c5c3_Var3 == nil {
templ_7745c5c3_Var3 = templ . NopComponent
}
ctx = templ . ClearChildren ( ctx )
2025-01-04 21:13:51 -05:00
templ_7745c5c3_Err = templruntime . WriteString ( templ_7745c5c3_Buffer , 3 , "<sl-range name=\"is_human\" label=\"" )
2025-01-04 18:51:40 -05:00
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var4 string
templ_7745c5c3_Var4 , templ_7745c5c3_Err = templ . JoinStringErrs ( humanLabel ( firstNumber , lastNumber ) )
if templ_7745c5c3_Err != nil {
2025-01-06 19:40:10 -05:00
return templ . Error { Err : templ_7745c5c3_Err , FileName : ` app/islands/human_slider.templ ` , Line : 12 , Col : 70 }
2025-01-04 18:51:40 -05:00
}
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( templ . EscapeString ( templ_7745c5c3_Var4 ) )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
2025-01-04 21:13:51 -05:00
templ_7745c5c3_Err = templruntime . WriteString ( templ_7745c5c3_Buffer , 4 , "\" help-text=\"Prove you are a human.\" min=\"0\" max=\"9\" step=\"1\"></sl-range><div slot=\"help-text\"><sl-icon name=\"x-lg\" library=\"sonr\"></sl-icon> Invalid Human Sum</div>" )
2025-01-04 18:51:40 -05:00
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
2025-01-04 21:13:51 -05:00
return nil
2025-01-04 18:51:40 -05:00
} )
}
func HumanSliderSuccess ( ) templ . Component {
return templruntime . GeneratedTemplate ( func ( templ_7745c5c3_Input templruntime . GeneratedComponentInput ) ( templ_7745c5c3_Err error ) {
templ_7745c5c3_W , ctx := templ_7745c5c3_Input . Writer , templ_7745c5c3_Input . Context
if templ_7745c5c3_CtxErr := ctx . Err ( ) ; templ_7745c5c3_CtxErr != nil {
return templ_7745c5c3_CtxErr
}
templ_7745c5c3_Buffer , templ_7745c5c3_IsBuffer := templruntime . GetBuffer ( templ_7745c5c3_W )
if ! templ_7745c5c3_IsBuffer {
defer func ( ) {
templ_7745c5c3_BufErr := templruntime . ReleaseBuffer ( templ_7745c5c3_Buffer )
if templ_7745c5c3_Err == nil {
templ_7745c5c3_Err = templ_7745c5c3_BufErr
}
} ( )
}
ctx = templ . InitializeContext ( ctx )
templ_7745c5c3_Var5 := templ . GetChildren ( ctx )
if templ_7745c5c3_Var5 == nil {
templ_7745c5c3_Var5 = templ . NopComponent
}
ctx = templ . ClearChildren ( ctx )
2025-01-04 21:13:51 -05:00
templ_7745c5c3_Err = templruntime . WriteString ( templ_7745c5c3_Buffer , 5 , "<sl-range name=\"is_human\" label=\"Success! Welcome Human.\" help-text=\"Prove you are a human.\" min=\"0\" max=\"9\" step=\"1\" value=\"9\" disabled></sl-range>" )
2025-01-04 18:51:40 -05:00
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
2025-01-04 21:13:51 -05:00
return nil
2025-01-04 18:51:40 -05:00
} )
}
func humanLabel ( firstNumber int , lastNumber int ) string {
return fmt . Sprintf ( "What is %d + %d?" , firstNumber , lastNumber )
}
var _ = templruntime . GeneratedTemplate