From c01301c8c667dd845d04e348248464e38965bd4b Mon Sep 17 00:00:00 2001 From: "Daniel J. Summers" Date: Mon, 31 Aug 2026 19:32:11 -0400 Subject: [PATCH 1/3] Remove obsolete items, update deps --- src/Common/Common.fs | 2 +- src/Directory.Build.props | 10 +- src/Directory.Packages.props | 8 +- src/Htmx/Htmx.fs | 42 ---- src/Tests/Common.fs | 2 +- src/Tests/Htmx.fs | 73 +----- src/Tests/ViewEngine.fs | 469 ----------------------------------- src/ViewEngine.Htmx/Htmx.fs | 302 ---------------------- 8 files changed, 9 insertions(+), 899 deletions(-) diff --git a/src/Common/Common.fs b/src/Common/Common.fs index a0946c8..5a45cd7 100644 --- a/src/Common/Common.fs +++ b/src/Common/Common.fs @@ -3,7 +3,7 @@ module Giraffe.Htmx.Common /// The version of htmx embedded in the package -let HtmxVersion = "4.0.0-beta5" +let HtmxVersion = "4.0.0" /// URLs for the included htmx library static web assets module StaticAssetUrl = diff --git a/src/Directory.Build.props b/src/Directory.Build.props index c761399..a93b0a7 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props @@ -3,16 +3,10 @@ net8.0;net9.0;net10.0 4.0.0 - beta5 true - Update htmx 4 to beta5 -- [Common] Update provided htmx/htmax 4 to 4.0.0-beta5 -- [Common] Add StaticAssetUrl module with static asset paths for htmx and htmax -- [Server] Unobsolete HX-Prompt header, note that it requires hx-prompt extension -- [View Engine] Unobsolete hx-prompt attribute, note that it requires hx-prompt extension -- [View Engine] Updated CDN script tags to pull htmx / htmax 4.0.0-beta5 + htmx 4.0.0 Initial Release -See package and prior alpha release READMEs; v2 to v4 is not an update-and-forget-it release +See package and prior alpha/beta release READMEs; v2 to v4 is not an update-and-forget-it release. If you encounter build errors after installing this, install v4.0.0-beta5 instead; obsolete elements will generate a warning with suggestions of what to use instead. danieljsummers Bit Badger Solutions diff --git a/src/Directory.Packages.props b/src/Directory.Packages.props index 1f8d6c3..8d028b7 100644 --- a/src/Directory.Packages.props +++ b/src/Directory.Packages.props @@ -3,11 +3,11 @@ true - - + + - - + + \ No newline at end of file diff --git a/src/Htmx/Htmx.fs b/src/Htmx/Htmx.fs index 1433c84..ea00e2c 100644 --- a/src/Htmx/Htmx.fs +++ b/src/Htmx/Htmx.fs @@ -91,16 +91,6 @@ type IHeaderDictionary with Some (parts[0], if parts[1] <> "" then Some parts[1] else None) | None -> None - /// The id attribute of the triggered element if it exists - [] - member this.HxTrigger - with get () = hdr this "HX-Trigger" - - /// The name attribute of the triggered element if it exists - [] - member this.HxTriggerName - with get () = hdr this "HX-Trigger-Name" - /// Extensions for the request object type HttpRequest with @@ -209,38 +199,6 @@ module Handlers = let withHxTriggerMany evts : HttpHandler = toJson evts |> setHttpHeader "HX-Trigger" - /// Allows you to trigger a single client side event after changes have settled - /// The call to the event that should be triggered - /// An HTTP handler with the HX-Trigger-After-Settle header set - /// Documentation - [] - let withHxTriggerAfterSettle (evt: string) : HttpHandler = - setHttpHeader "HX-Trigger" evt - - /// Allows you to trigger multiple client side events after changes have settled - /// The calls to events that should be triggered - /// An HTTP handler with the HX-Trigger-After-Settle header set for all given events - /// Documentation - [] - let withHxTriggerManyAfterSettle evts : HttpHandler = - toJson evts |> setHttpHeader "HX-Trigger" - - /// Allows you to trigger a single client side event after DOM swapping occurs - /// The call to the event that should be triggered - /// An HTTP handler with the HX-Trigger-After-Swap header set - /// Documentation - [] - let withHxTriggerAfterSwap (evt: string) : HttpHandler = - setHttpHeader "HX-Trigger" evt - - /// Allows you to trigger multiple client side events after DOM swapping occurs - /// The calls to events that should be triggered - /// An HTTP handler with the HX-Trigger-After-Swap header set for all given events - /// Documentation - [] - let withHxTriggerManyAfterSwap evts : HttpHandler = - toJson evts |> setHttpHeader "HX-Trigger" - /// Load the package-provided version of the htmx script [] diff --git a/src/Tests/Common.fs b/src/Tests/Common.fs index 0942e42..80f4b6a 100644 --- a/src/Tests/Common.fs +++ b/src/Tests/Common.fs @@ -6,7 +6,7 @@ open Giraffe.Htmx /// Test to ensure the version was updated let version = test "HtmxVersion is correct" { - Expect.equal HtmxVersion "4.0.0-beta5" "htmx version incorrect" + Expect.equal HtmxVersion "4.0.0" "htmx version incorrect" } let staticAssetUrl = diff --git a/src/Tests/Htmx.fs b/src/Tests/Htmx.fs index 4c29c5c..1b0bd31 100644 --- a/src/Tests/Htmx.fs +++ b/src/Tests/Htmx.fs @@ -441,76 +441,5 @@ let script = } ] -#nowarn 44 // Obsolete items still have tests -let dictExtensionsObs = - testList "IHeaderDictionaryExtensions (Obsolete)" [ - testList "HxTrigger" [ - test "succeeds when the header is not present" { - let ctx = Substitute.For() - ctx.Request.Headers.ReturnsForAnyArgs (HeaderDictionary ()) |> ignore - Expect.isNone ctx.Request.Headers.HxTrigger "There should not have been a header returned" - } - test "succeeds when the header is present" { - let ctx = Substitute.For() - let dic = HeaderDictionary() - dic.Add("HX-Trigger", "#trig") - ctx.Request.Headers.ReturnsForAnyArgs dic |> ignore - Expect.isSome ctx.Request.Headers.HxTrigger "There should be a header present" - Expect.equal ctx.Request.Headers.HxTrigger.Value "#trig" "The header value was incorrect" - } - ] - testList "HxTriggerName" [ - test "succeeds when the header is not present" { - let ctx = Substitute.For() - ctx.Request.Headers.ReturnsForAnyArgs(HeaderDictionary()) |> ignore - Expect.isNone ctx.Request.Headers.HxTriggerName "There should not have been a header returned" - } - test "HxTriggerName succeeds when the header is present" { - let ctx = Substitute.For() - let dic = HeaderDictionary() - dic.Add("HX-Trigger-Name", "click") - ctx.Request.Headers.ReturnsForAnyArgs dic |> ignore - Expect.isSome ctx.Request.Headers.HxTriggerName "There should be a header present" - Expect.equal ctx.Request.Headers.HxTriggerName.Value "click" "The header value was incorrect" - } - ] - ] - -let handlerObs = - testList "Handler Tests (Obsolete)" [ - testTask "withHxTriggerAfterSettle succeeds" { - let ctx = Substitute.For() - let dic = HeaderDictionary() - ctx.Response.Headers.ReturnsForAnyArgs dic |> ignore - let! _ = withHxTriggerAfterSettle "byTheWay" next ctx - Expect.isTrue (dic.ContainsKey "HX-Trigger") "The HX-Trigger header should be present" - Expect.equal dic["HX-Trigger"].[0] "byTheWay" "The HX-Trigger value was incorrect" - } - testTask "withHxTriggerManyAfterSettle succeeds" { - let ctx = Substitute.For() - let dic = HeaderDictionary() - ctx.Response.Headers.ReturnsForAnyArgs dic |> ignore - let! _ = withHxTriggerManyAfterSettle [ "oof", "ouch"; "hmm", "uh" ] next ctx - Expect.isTrue (dic.ContainsKey "HX-Trigger") "The HX-Trigger header should be present" - Expect.equal dic["HX-Trigger"].[0] """{ "oof": "ouch", "hmm": "uh" }""" "The HX-Trigger value was incorrect" - } - testTask "withHxTriggerAfterSwap succeeds" { - let ctx = Substitute.For() - let dic = HeaderDictionary() - ctx.Response.Headers.ReturnsForAnyArgs dic |> ignore - let! _ = withHxTriggerAfterSwap "justASec" next ctx - Expect.isTrue (dic.ContainsKey "HX-Trigger") "The HX-Trigger header should be present" - Expect.equal dic["HX-Trigger"].[0] "justASec" "The HX-Trigger value was incorrect" - } - testTask "withHxTriggerManyAfterSwap succeeds" { - let ctx = Substitute.For() - let dic = HeaderDictionary() - ctx.Response.Headers.ReturnsForAnyArgs dic |> ignore - let! _ = withHxTriggerManyAfterSwap [ "this", "1"; "that", "2" ] next ctx - Expect.isTrue (dic.ContainsKey "HX-Trigger") "The HX-Trigger header should be present" - Expect.equal dic["HX-Trigger"].[0] """{ "this": "1", "that": "2" }""" "The HX-Trigger value was incorrect" - } - ] - /// All tests for this module -let allTests = testList "Htmx" [ dictExtensions; reqExtensions; handlers; script; dictExtensionsObs; handlerObs ] +let allTests = testList "Htmx" [ dictExtensions; reqExtensions; handlers; script ] diff --git a/src/Tests/ViewEngine.fs b/src/Tests/ViewEngine.fs index af633a9..9f7adac 100644 --- a/src/Tests/ViewEngine.fs +++ b/src/Tests/ViewEngine.fs @@ -863,474 +863,6 @@ let renderFragment = ] ] -#nowarn 44 // Obsolete events still have tests - -let hxEventObs = - testList "HxEvent (Obsolete)" [ - testList "AfterOnLoad" [ - test "ToString succeeds" { - Expect.equal (string AfterOnLoad) "afterOnLoad" "AfterOnLoad event name not correct" - } - test "ToHxOnString succeeds" { - Expect.equal (AfterOnLoad.ToHxOnString()) "after:init" "AfterOnLoad hx-on event name not correct" - } - ] - testList "AfterProcessNode" [ - test "ToString succeeds" { - Expect.equal (string AfterProcessNode) "afterProcessNode" "AfterProcessNode event name not correct" - } - test "ToHxOnString succeeds" { - Expect.equal - (AfterProcessNode.ToHxOnString()) "after:process" "AfterProcessNode hx-on event name not correct" - } - ] - testList "AfterSseMessage" [ - test "ToString succeeds" { - Expect.equal (string AfterSseMessage) "afterSseMessage" "AfterSseMessage event name not correct" - } - test "ToHxOnString succeeds" { - Expect.equal - (AfterSseMessage.ToHxOnString()) "after:sse:message" "AfterSseMessage hx-on event name not correct" - } - ] - testList "AfterSseStream" [ - test "ToString succeeds" { - Expect.equal (string AfterSseStream) "afterSseStream" "AfterSseStream event name not correct" - } - test "ToHxOnString succeeds" { - Expect.equal - (AfterSseStream.ToHxOnString()) "after:sse:stream" "AfterSseStream hx-on event name not correct" - } - ] - testList "BeforeCleanupElement" [ - test "ToString succeeds" { - Expect.equal - (string BeforeCleanupElement) "beforeCleanupElement" "BeforeCleanupElement event name not correct" - } - test "ToHxOnString succeeds" { - Expect.equal - (BeforeCleanupElement.ToHxOnString()) - "before:cleanup" - "BeforeCleanupElement hx-on event name not correct" - } - ] - testList "BeforeHistorySave" [ - test "ToString succeeds" { - Expect.equal (string BeforeHistorySave) "beforeHistorySave" "BeforeHistorySave event name not correct" - } - test "ToHxOnString succeeds" { - Expect.equal - (BeforeHistorySave.ToHxOnString()) - "before:history:update" - "BeforeHistorySave hx-on event name not correct" - } - ] - testList "BeforeOnLoad" [ - test "ToString succeeds" { - Expect.equal (string BeforeOnLoad) "beforeOnLoad" "BeforeOnLoad event name not correct" - } - test "ToHxOnString succeeds" { - Expect.equal (BeforeOnLoad.ToHxOnString()) "before:init" "BeforeOnLoad hx-on event name not correct" - } - ] - testList "BeforeProcessNode" [ - test "ToString succeeds" { - Expect.equal (string BeforeProcessNode) "beforeProcessNode" "BeforeProcessNode event name not correct" - } - test "ToHxOnString succeeds" { - Expect.equal - (BeforeProcessNode.ToHxOnString()) "before:process" "BeforeProcessNode hx-on event name not correct" - } - ] - testList "BeforeSend" [ - test "ToString succeeds" { - Expect.equal (string BeforeSend) "beforeSend" "BeforeSend event name not correct" - } - test "ToHxOnString succeeds" { - Expect.equal (BeforeSend.ToHxOnString()) "before:request" "BeforeSend hx-on event name not correct" - } - ] - testList "BeforeSseMessage" [ - test "ToString succeeds" { - Expect.equal (string BeforeSseMessage) "beforeSseMessage" "BeforeSseMessage event name not correct" - } - test "ToHxOnString succeeds" { - Expect.equal - (BeforeSseMessage.ToHxOnString()) - "before:sse:message" - "BeforeSseMessage hx-on event name not correct" - } - ] - testList "BeforeSseReconnect" [ - test "ToString succeeds" { - Expect.equal - (string BeforeSseReconnect) "beforeSseReconnect" "BeforeSseReconnect event name not correct" - } - test "ToHxOnString succeeds" { - Expect.equal - (BeforeSseReconnect.ToHxOnString()) - "before:sse:reconnect" - "BeforeSseReconnect hx-on event name not correct" - } - ] - testList "BeforeSseStream" [ - test "ToString succeeds" { - Expect.equal (string BeforeSseStream) "beforeSseStream" "BeforeSseStream event name not correct" - } - test "ToHxOnString succeeds" { - Expect.equal - (BeforeSseStream.ToHxOnString()) "before:sse:stream" "BeforeSseStream hx-on event name not correct" - } - ] - testList "HistoryCacheError" [ - test "ToString succeeds" { - Expect.equal (string HistoryCacheError) "historyCacheError" "HistoryCacheError event name not correct" - } - test "ToHxOnString succeeds" { - Expect.equal - (HistoryCacheError.ToHxOnString()) - "history-cache-error" - "HistoryCacheError hx-on event name not correct" - } - ] - testList "HistoryCacheMiss" [ - test "ToString succeeds" { - Expect.equal (string HistoryCacheMiss) "historyCacheMiss" "HistoryCacheMiss event name not correct" - } - test "ToHxOnString succeeds" { - Expect.equal - (HistoryCacheMiss.ToHxOnString()) - "before:history:restore" - "HistoryCacheMiss hx-on event name not correct" - } - ] - testList "HistoryCacheMissError" [ - test "ToString succeeds" { - Expect.equal - (string HistoryCacheMissError) - "historyCacheMissError" - "HistoryCacheMissError event name not correct" - } - test "ToHxOnString succeeds" { - Expect.equal - (HistoryCacheMissError.ToHxOnString()) - "history-cache-miss-error" - "HistoryCacheMissError hx-on event name not correct" - } - ] - testList "HistoryCacheMissLoad" [ - test "ToString succeeds" { - Expect.equal - (string HistoryCacheMissLoad) "historyCacheMissLoad" "HistoryCacheMissLoad event name not correct" - } - test "ToHxOnString succeeds" { - Expect.equal - (HistoryCacheMissLoad.ToHxOnString()) - "before:history:restore" - "HistoryCacheMissLoad hx-on event name not correct" - } - ] - testList "HistoryRestore" [ - test "ToString succeeds" { - Expect.equal (string HistoryRestore) "historyRestore" "HistoryRestore event name not correct" - } - test "ToHxOnString succeeds" { - Expect.equal - (HistoryRestore.ToHxOnString()) - "before:history:restore" - "HistoryRestore hx-on event name not correct" - } - ] - testList "Load" [ - test "ToString succeeds" { - Expect.equal (string Load) "load" "Load event name not correct" - } - test "ToHxOnString succeeds" { - Expect.equal (Load.ToHxOnString()) "after:init" "Load hx-on event name not correct" - } - ] - testList "NoSseSourceError" [ - test "ToString succeeds" { - Expect.equal (string NoSseSourceError) "noSSESourceError" "NoSseSourceError event name not correct" - } - test "ToHxOnString succeeds" { - Expect.equal (NoSseSourceError.ToHxOnString()) "error" "NoSseSourceError hx-on event name not correct" - } - ] - testList "OnLoadError" [ - test "ToString succeeds" { - Expect.equal (string OnLoadError) "onLoadError" "OnLoadError event name not correct" - } - test "ToHxOnString succeeds" { - Expect.equal (OnLoadError.ToHxOnString()) "error" "OnLoadError hx-on event name not correct" - } - ] - testList "OobAfterSwap" [ - test "ToString succeeds" { - Expect.equal (string OobAfterSwap) "oobAfterSwap" "OobAfterSwap event name not correct" - } - test "ToHxOnString succeeds" { - Expect.equal (OobAfterSwap.ToHxOnString()) "after:swap" "OobAfterSwap hx-on event name not correct" - } - ] - testList "OobBeforeSwap" [ - test "ToString succeeds" { - Expect.equal (string OobBeforeSwap) "oobBeforeSwap" "OobBeforeSwap event name not correct" - } - test "ToHxOnString succeeds" { - Expect.equal (OobBeforeSwap.ToHxOnString()) "before:swap" "OobBeforeSwap hx-on event name not correct" - } - ] - testList "OobErrorNoTarget" [ - test "ToString succeeds" { - Expect.equal (string OobErrorNoTarget) "oobErrorNoTarget" "OobErrorNoTarget event name not correct" - } - test "ToHxOnString succeeds" { - Expect.equal (OobErrorNoTarget.ToHxOnString()) "error" "OobErrorNoTarget hx-on event name not correct" - } - ] - testList "Prompt" [ - test "ToString succeeds" { - Expect.equal (string Prompt) "prompt" "Prompt event name not correct" - } - test "ToHxOnString succeeds" { - Expect.equal (Prompt.ToHxOnString()) "prompt" "Prompt hx-on event name not correct" - } - ] - testList "PushedIntoHistory" [ - test "ToString succeeds" { - Expect.equal (string PushedIntoHistory) "pushedIntoHistory" "PushedIntoHistory event name not correct" - } - test "ToHxOnString succeeds" { - Expect.equal - (PushedIntoHistory.ToHxOnString()) - "after:push:into:history" - "PushedIntoHistory hx-on event name not correct" - } - ] - testList "SendError" [ - test "ToString succeeds" { - Expect.equal (string SendError) "sendError" "SendError event name not correct" - } - test "ToHxOnString succeeds" { - Expect.equal (SendError.ToHxOnString()) "error" "SendError hx-on event name not correct" - } - ] - testList "SseError" [ - test "ToString succeeds" { - Expect.equal (string SseError) "sseError" "SseError event name not correct" - } - test "ToHxOnString succeeds" { - Expect.equal (SseError.ToHxOnString()) "sse:error" "SseError hx-on event name not correct" - } - ] - testList "SseOpen" [ - test "ToString succeeds" { - Expect.equal (string SseOpen) "sseOpen" "SseOpen event name not correct" - } - test "ToHxOnString succeeds" { - Expect.equal (SseOpen.ToHxOnString()) "after:sse:connection" "SseOpen hx-on event name not correct" - } - ] - testList "SwapError" [ - test "ToString succeeds" { - Expect.equal (string SwapError) "swapError" "SwapError event name not correct" - } - test "ToHxOnString succeeds" { - Expect.equal (SwapError.ToHxOnString()) "error" "SwapError hx-on event name not correct" - } - ] - testList "TargetError" [ - test "ToString succeeds" { - Expect.equal (string TargetError) "targetError" "TargetError event name not correct" - } - test "ToHxOnString succeeds" { - Expect.equal (TargetError.ToHxOnString()) "error" "TargetError hx-on event name not correct" - } - ] - testList "Timeout" [ - test "ToString succeeds" { - Expect.equal (string Timeout) "timeout" "Timeout event name not correct" - } - test "ToHxOnString succeeds" { - Expect.equal (Timeout.ToHxOnString()) "error" "Timeout hx-on event name not correct" - } - ] - testList "ValidationValidate" [ - test "ToString succeeds" { - Expect.equal - (string ValidationValidate) "validation:validate" "ValidationValidate event name not correct" - } - test "ToHxOnString succeeds" { - Expect.equal - (ValidationValidate.ToHxOnString()) - "validation:validate" - "ValidationValidate hx-on event name not correct" - } - ] - testList "ValidationFailed" [ - test "ToString succeeds" { - Expect.equal (string ValidationFailed) "validation:failed" "ValidationFailed event name not correct" - } - test "ToHxOnString succeeds" { - Expect.equal - (ValidationFailed.ToHxOnString()) - "validation:failed" - "ValidationFailed hx-on event name not correct" - } - ] - testList "ValidationHalted" [ - test "ToString succeeds" { - Expect.equal (string ValidationHalted) "validation:halted" "ValidationHalted event name not correct" - } - test "ToHxOnString succeeds" { - Expect.equal - (ValidationHalted.ToHxOnString()) - "validation:halted" - "ValidationHalted hx-on event name not correct" - } - ] - testList "XhrAbort" [ - test "ToString succeeds" { - Expect.equal (string XhrAbort) "xhr:abort" "XhrAbort event name not correct" - } - test "ToHxOnString succeeds" { - Expect.equal (XhrAbort.ToHxOnString()) "error" "XhrAbort hx-on event name not correct" - } - ] - testList "XhrLoadEnd" [ - test "ToString succeeds" { - Expect.equal (string XhrLoadEnd) "xhr:loadend" "XhrLoadEnd event name not correct" - } - test "ToHxOnString succeeds" { - Expect.equal (XhrLoadEnd.ToHxOnString()) "finally:request" "XhrLoadEnd hx-on event name not correct" - } - ] - testList "XhrLoadStart" [ - test "ToString succeeds" { - Expect.equal (string XhrLoadStart) "xhr:loadstart" "XhrLoadStart event name not correct" - } - test "ToHxOnString succeeds" { - Expect.equal (XhrLoadStart.ToHxOnString()) "xhr:loadstart" "XhrLoadStart hx-on event name not correct" - } - ] - testList "XhrProgress" [ - test "ToString succeeds" { - Expect.equal (string XhrProgress) "xhr:progress" "XhrProgress event name not correct" - } - test "ToHxOnString succeeds" { - Expect.equal (XhrProgress.ToHxOnString()) "xhr:progress" "XhrProgress hx-on event name not correct" - } - ] - ] - -/// Tests for the HxParams module -let hxParamsObs = - testList "HxParams" [ - test "All is correct" { - Expect.equal HxParams.All "*" "All is not correct" - } - test "None is correct" { - Expect.equal HxParams.None "none" "None is not correct" - } - testList "With" [ - test "succeeds with empty list" { - Expect.equal (HxParams.With []) "" "With with empty list should have been blank" - } - test "succeeds with one list item" { - Expect.equal (HxParams.With [ "boo" ]) "boo" "With single item incorrect" - } - test "succeeds with multiple list items" { - Expect.equal (HxParams.With [ "foo"; "bar"; "baz" ]) "foo,bar,baz" "With multiple items incorrect" - } - ] - testList "Except" [ - test "succeeds with empty list" { - Expect.equal (HxParams.Except []) "not " "Except with empty list incorrect" - } - test "succeeds with one list item" { - Expect.equal (HxParams.Except [ "that" ]) "not that" "Except single item incorrect" - } - test "succeeds with multiple list items" { - Expect.equal (HxParams.Except [ "blue"; "green" ]) "not blue,green" "Except multiple items incorrect" - } - ] - ] - -/// Tests for the HxConfig module -let hxRequestObs = - testList "HxRequest (Obsolete)" [ - testList "Configure" [ - test "succeeds with an empty list" { - Expect.equal (HxRequest.Configure []) "{ }" "Configure with empty list incorrect" - } - test "succeeds with a non-empty list" { - Expect.equal - (HxRequest.Configure [ "\"a\": \"b\""; "\"c\": \"d\"" ]) """{ "a": "b", "c": "d" }""" - "Configure with a non-empty list incorrect" - } - test "succeeds with all known params configured" { - Expect.equal - (HxRequest.Configure - [ HxRequest.Timeout 1000; HxRequest.Credentials false; HxRequest.NoHeaders true ]) - """{ "timeout": 1000, "credentials": false, "noHeaders": true }""" - "Configure with all known params incorrect" - } - ] - test "Timeout succeeds" { - Expect.equal (HxRequest.Timeout 50) "\"timeout\": 50" "Timeout value incorrect" - } - testList "Credentials" [ - test "succeeds when set to true" { - Expect.equal (HxRequest.Credentials true) "\"credentials\": true" "Credentials value incorrect" - } - test "succeeds when set to false" { - Expect.equal (HxRequest.Credentials false) "\"credentials\": false" "Credentials value incorrect" - } - ] - testList "NoHeaders" [ - test "succeeds when set to true" { - Expect.equal (HxRequest.NoHeaders true) "\"noHeaders\": true" "NoHeaders value incorrect" - } - test "succeeds when set to false" { - Expect.equal (HxRequest.NoHeaders false) "\"noHeaders\": false" "NoHeaders value incorrect" - } - ] - ] - -let attributesObs = - testList "Attributes (Obsolete)" [ - test "_hxDisabledElt succeeds" { - button [ _hxDisabledElt "this" ] [] |> shouldRender """""" - } - test "_hxDisinherit succeeds" { - strong [ _hxDisinherit "*" ] [] |> shouldRender """""" - } - test "_hxExt succeeds" { - section [ _hxExt "extendme" ] [] |> shouldRender """
""" - } - test "_hxHistory succeeds" { - span [ _hxHistory false ] [] |> shouldRender """""" - } - test "_hxHistoryElt succeeds" { - table [ _hxHistoryElt ] [] |> shouldRender """
""" - } - test "_hxParams succeeds" { - br [ _hxParams "[p1,p2]" ] |> shouldRender """
""" - } - test "_hxRequest succeeds" { - u [ _hxRequest "noHeaders" ] [] |> shouldRender """""" - } - test "_sseConnect succeeds" { - div [ _sseConnect "/gps/sse" ] [] |> shouldRender """
""" - } - test "_sseSwap succeeds" { - ul [ _sseSwap "sseMessageName" ] [] |> shouldRender """
    """ - } - ] - -let obsolete = testList "Obsolete" [ hxEventObs; hxParamsObs; hxRequestObs; attributesObs ] - /// All tests in this module let allTests = testList "ViewEngine.Htmx" [ @@ -1345,5 +877,4 @@ let allTests = hxTags script renderFragment - obsolete ] diff --git a/src/ViewEngine.Htmx/Htmx.fs b/src/ViewEngine.Htmx/Htmx.fs index ccbba1d..c1e80cd 100644 --- a/src/ViewEngine.Htmx/Htmx.fs +++ b/src/ViewEngine.Htmx/Htmx.fs @@ -50,7 +50,6 @@ module HxEncoding = let MultipartForm = "multipart/form-data" -#nowarn 44 // Obsolete elements still have entries in the conversion map; will be removed for v4 final /// The events recognized by htmx /// Documentation [] @@ -68,15 +67,9 @@ type HxEvent = /// Triggered after a request has initialized | AfterInit - /// Triggered after an AJAX request has completed processing a successful response - | [] AfterOnLoad - /// Triggered after htmx has initialized a DOM node or subtree | AfterProcess - /// Triggered after htmx has initialized a node - | [] AfterProcessNode - /// Triggered after new content is saved to the history cache | AfterPushIntoHistory @@ -89,12 +82,6 @@ type HxEvent = /// Triggered after the DOM has settled | AfterSettle - /// Triggered after a Server Sent Events (SSE) message is read - | [] AfterSseMessage - - /// Triggered after a Server Sent Events (SSE) stream is closed - | [] AfterSseStream - /// Triggered after new content has been swapped in | AfterSwap @@ -104,27 +91,15 @@ type HxEvent = /// Triggered before htmx disables an element or removes it from the DOM | BeforeCleanup - /// Triggered before htmx disables an element or removes it from the DOM - | [] BeforeCleanupElement - - /// Triggered before content is saved to the history cache - | [] BeforeHistorySave - /// Triggered before content is saved to the history cache | BeforeHistoryUpdate /// Triggered before htmx initializes a node | BeforeInit - /// Triggered before any response processing occurs - | [] BeforeOnLoad - /// Triggered before htmx begins processing a DOM node or subtree | BeforeProcess - /// Triggered before htmx initializes a node - | [] BeforeProcessNode - /// Triggered before an HTTP request is made | BeforeRequest @@ -134,18 +109,6 @@ type HxEvent = /// Triggered before a history restore request is made | BeforeRestoreHistory - /// Triggered just before an ajax request is sent - | [] BeforeSend - - /// Triggered before a Server Sent Events (SSE) message is read - | [] BeforeSseMessage - - /// Triggered before a Server Sent Events (SSE) connection is reconnected - | [] BeforeSseReconnect - - /// Triggered before a Server Sent Events (SSE) stream is opened - | [] BeforeSseStream - /// Triggered before a swap is done, allows you to configure the swap | BeforeSwap @@ -166,153 +129,35 @@ type HxEvent = /// Triggered after an HTTP request is made, whether it was successful or not | FinallyRequest - /// Triggered on an error during cache writing - | [] HistoryCacheError - - /// Triggered on a cache miss in the history subsystem - | [] HistoryCacheMiss - - /// Triggered on a unsuccessful remote retrieval - | [] HistoryCacheMissError - - /// Triggered on a successful remote retrieval - | [] HistoryCacheMissLoad - - /// Triggered when htmx handles a history restoration action - | [] HistoryRestore - - /// Triggered when new content is added to the DOM - | [] Load - - /// - /// Triggered when an element refers to a SSE event in its trigger, but no parent SSE source has been defined - /// - | [] NoSseSourceError - - /// Triggered when an exception occurs during the onLoad handling in htmx - | [] OnLoadError - - /// Triggered after an out of band element as been swapped in - | [] OobAfterSwap - - /// Triggered before an out of band element swap is done, allows you to configure the swap - | [] OobBeforeSwap - - /// Triggered when an out of band element does not have a matching ID in the current DOM - | [] OobErrorNoTarget - - /// Triggered after a prompt is shown - | [] Prompt - - /// Triggered after an url is pushed into history - | [] PushedIntoHistory - /// Triggered when an HTTP response error (non-200 or 300 response code) occurs | ResponseError - /// Triggered when a network error prevents an HTTP request from happening - | [] SendError - - /// Triggered when an error occurs with a SSE source - | [] SseError - - /// Triggered when an SSE source is opened - | [] SseOpen - - /// Triggered when an error occurs during the swap phase - | [] SwapError - - /// Triggered when an invalid target is specified - | [] TargetError - - /// Triggered when a request timeout occurs - | [] Timeout - - /// Triggered before an element is validated - | [] ValidationValidate - - /// Triggered when an element fails validation - | [] ValidationFailed - - /// Triggered when a request is halted due to validation errors - | [] ValidationHalted - - /// Triggered when an ajax request aborts - | [] XhrAbort - - /// Triggered when an ajax request ends - | [] XhrLoadEnd - - /// Triggered when an ajax request starts - | [] XhrLoadStart - - /// Triggered periodically during an ajax request that supports progress events - | [] XhrProgress - /// The htmx event name (fst) and kebab-case name (snd, for use with hx-on) static member private Values = Map [ Abort, ("abort", "abort") AfterCleanup, ("afterCleanup", "after:cleanup") AfterHistoryUpdate, ("afterHistoryUpdate", "after:history:update") AfterInit, ("afterInit", "after:init") - AfterOnLoad, ("afterOnLoad", "after:init") - AfterProcessNode, ("afterProcessNode", "after:process") AfterPushIntoHistory, ("afterPushIntoHistory", "after:push:into:history") AfterReplaceIntoHistory, ("afterReplaceIntoHistory", "after:replace:into:history") AfterRequest, ("afterRequest", "after:request") AfterSettle, ("afterSettle", "after:settle") - AfterSseMessage, ("afterSseMessage", "after:sse:message") - AfterSseStream, ("afterSseStream", "after:sse:stream") AfterSwap, ("afterSwap", "after:swap") AfterViewTransition, ("afterViewTransition", "after:viewTransition") BeforeCleanup, ("beforeCleanup", "before:cleanup") - BeforeCleanupElement, ("beforeCleanupElement", "before:cleanup") - BeforeHistorySave, ("beforeHistorySave", "before:history:update") BeforeHistoryUpdate, ("beforeHistoryUpdate", "before:history:update") BeforeInit, ("beforeInit", "before:init") - BeforeOnLoad, ("beforeOnLoad", "before:init") BeforeProcess, ("beforeProcess", "before:process") - BeforeProcessNode, ("beforeProcessNode", "before:process") BeforeRequest, ("beforeRequest", "before:request") BeforeResponse, ("beforeResponse", "before:response") BeforeRestoreHistory, ("beforeRestoreHistory", "before:restore:history") - BeforeSend, ("beforeSend", "before:request") - BeforeSseMessage, ("beforeSseMessage", "before:sse:message") - BeforeSseReconnect, ("beforeSseReconnect", "before:sse:reconnect") - BeforeSseStream, ("beforeSseStream", "before:sse:stream") BeforeSwap, ("beforeSwap", "before:swap") BeforeViewTransition, ("beforeTransition", "before:viewTransition") ConfigRequest, ("configRequest", "config:request") Confirm, ("confirm", "confirm") Error, ("error", "error") FinallyRequest, ("finallyRequest", "finally:request") - HistoryCacheError, ("historyCacheError", "history-cache-error") - HistoryCacheMiss, ("historyCacheMiss", "before:history:restore") - HistoryCacheMissError, ("historyCacheMissError", "history-cache-miss-error") - HistoryCacheMissLoad, ("historyCacheMissLoad", "before:history:restore") - HistoryRestore, ("historyRestore", "before:history:restore") - Load, ("load", "after:init") - NoSseSourceError, ("noSSESourceError", "error") - OnLoadError, ("onLoadError", "error") - OobAfterSwap, ("oobAfterSwap", "after:swap") - OobBeforeSwap, ("oobBeforeSwap", "before:swap") - OobErrorNoTarget, ("oobErrorNoTarget", "error") - Prompt, ("prompt", "prompt") - PushedIntoHistory, ("pushedIntoHistory", "after:push:into:history") ResponseError, ("responseError", "response:error") - SendError, ("sendError", "error") - SseError, ("sseError", "sse:error") - SseOpen, ("sseOpen", "after:sse:connection") - SwapError, ("swapError", "error") - TargetError, ("targetError", "error") - Timeout, ("timeout", "error") - ValidationValidate, ("validation:validate", "validation:validate") - ValidationFailed, ("validation:failed", "validation:failed") - ValidationHalted, ("validation:halted", "validation:halted") - XhrAbort, ("xhr:abort", "error") - XhrLoadEnd, ("xhr:loadend", "finally:request") - XhrLoadStart, ("xhr:loadstart", "xhr:loadstart") - XhrProgress, ("xhr:progress", "xhr:progress") ] /// The htmx event name @@ -320,7 +165,6 @@ type HxEvent = /// The hx-on variant of the htmx event name member this.ToHxOnString() = snd HxEvent.Values[this] -#warn 44 // restore obsolete warning /// Helper to create the hx-headers attribute @@ -331,70 +175,6 @@ module HxHeaders = let From = Giraffe.Htmx.Common.toJson -/// Values / helpers for the hx-params attribute -/// Documentation -[] -[] -module HxParams = - - /// Include all parameters - [] - let All = "*" - - /// Include no parameters - [] - let None = "none" - - /// Include the specified parameters - /// One or more fields to include in the request - /// The list of fields for the hx-params attribute value - let With fields = - match fields with [] -> "" | _ -> fields |> List.reduce (fun acc it -> $"{acc},{it}") - - /// Exclude the specified parameters - /// One or more fields to exclude from the request - /// The list of fields for the hx-params attribute value prefixed with "not" - let Except fields = - With fields |> sprintf "not %s" - - -/// Helpers to define hx-request attribute values -/// Documentation -[] -[] -module HxRequest = - - open Giraffe.Htmx.Common - - /// Configure the request with various options - /// The options to configure - /// A string with the configured options - let Configure (opts: string list) = - opts - |> String.concat ", " - |> sprintf "{ %s }" - - /// Set a timeout (in milliseconds) - /// The milliseconds for the request timeout - /// A string with the configured request timeout - let Timeout (ms: int) = - $"\"timeout\": {ms}" - - /// Include or exclude credentials from the request - /// true if credentials should be sent, false if not - /// A string with the configured credential options - let Credentials send = - (toLowerBool >> sprintf "\"credentials\": %s") send - - /// Exclude or include headers from the request - /// - /// true if no headers should be sent; false if headers should be sent - /// - /// A string with the configured header options - let NoHeaders exclude = - (toLowerBool >> sprintf "\"noHeaders\": %s") exclude - - /// Helpers for the hx-sync attribute /// Documentation [] @@ -663,22 +443,6 @@ module HtmxAttrs = let _hxDisable elt = attr "hx-disable" elt - /// Specifies elements that should be disabled when an htmx request is in flight - /// The element to disable when an htmx request is in flight - /// A configured hx-disabled-elt attribute - /// Documentation - [] - let _hxDisabledElt elt = - attr "hx-disabled-elt" elt - - /// Disinherit all ("*") or specific htmx attributes - /// The htmx attributes to disinherit (should start with "hx-") - /// A configured hx-disinherit attribute - /// Documentation - [] - let _hxDisinherit hxAttrs = - attr "hx-disinherit" hxAttrs - /// Changes the request encoding type /// The encoding type (use HxEncoding constants) /// A configured hx-encoding attribute @@ -687,14 +451,6 @@ module HtmxAttrs = let _hxEncoding enc = attr "hx-encoding" enc - /// Extensions to use for this element - /// A list of extensions to apply to this element - /// A configured hx-ext attribute - /// Documentation - [] - let _hxExt exts = - attr "hx-ext" exts - /// Issues a GET to the specified URL /// The URL to which the GET request should be sent /// A configured hx-get attribute @@ -709,22 +465,6 @@ module HtmxAttrs = let _hxHeaders hdrs = attr "hx-headers" hdrs - /// - /// Set to "false" to prevent pages with sensitive information from being stored in the history cache - /// - /// Whether the page should be stored in the history cache - /// A configured hx-history attribute - /// Documentation - [] - let _hxHistory shouldStore = - attr "hx-history" (toLowerBool shouldStore) - - /// The element to snapshot and restore during history navigation - /// Documentation - [] - let _hxHistoryElt = - flag "hx-history-elt" - /// Disables htmx processing for the given node and any children nodes /// Documentation let _hxIgnore = @@ -773,15 +513,6 @@ module HtmxAttrs = let _hxOnHxEvent (hxEvent: HxEvent) handler = _hxOnEvent $"htmx:{hxEvent.ToHxOnString()}" handler - /// Filters the parameters that will be submitted with a request - /// The fields to include (use HxParams to generate this value) - /// A configured hx-params attribute - /// - /// Documentation - [] - let _hxParams toInclude = - attr "hx-params" toInclude - /// Issues a PATCH to the specified URL /// The URL to which the request should be directed /// A configured hx-patch attribute @@ -847,15 +578,6 @@ module HtmxAttrs = let _hxReplaceUrl spec = attr "hx-replace-url" spec - /// Configures various aspects of the request - /// The configuration spec (use HxRequest.Configure to create value) - /// A configured hx-request attribute - /// - /// Documentation - [] - let _hxRequest spec = - attr "hx-request" spec - /// Selects a subset of the server response to process /// A CSS selector for the content to be selected /// A configured hx-select attribute @@ -966,20 +688,6 @@ module HtmxAttrs = let _hxVals values = attr "hx-vals" values - /// The URL of the SSE server - /// The URL from which events will be received - /// A configured sse-connect attribute - /// Extension Docs - let [] _sseConnect url = - attr "sse-connect" url - - /// The name(s) of the message(s) to swap into the DOM - /// The message names (comma-delimited) to swap (use "message" for unnamed events) - /// A configured sse-swap attribute - /// Extension Docs - let [] _sseSwap messages = - attr "sse-swap" messages - /// Modifiers for htmx attributes [] @@ -1013,8 +721,6 @@ module HxTags = /// Script tags to pull htmx into a web page module Script = - open System - /// Script tag to load the package-provided version of htmx let local = script [ _src StaticAssetUrl.htmx ] [] @@ -1052,14 +758,6 @@ module Script = _integrity "sha384-kjhVuvnX3/TsR1qH4JaIcHR6muh/WLMU5CTQRacCQZERzQlP4/r9p/TK7ucFwqvV" _crossorigin "anonymous" ] [] - /// Script tag to load the minified version from jsdelivr.net - [] - let minified = cdnMinified - - /// Script tag to load the unminified version from jsdelivr.net - [] - let unminified = cdnUnminified - /// Functions to extract and render an HTML fragment from a document [] -- 2.54.0 From 6c467ab72ddd8f8cbd55fe11dd0658b886084d7c Mon Sep 17 00:00:00 2001 From: "Daniel J. Summers" Date: Mon, 31 Aug 2026 19:40:15 -0400 Subject: [PATCH 2/3] Update htmx/htmax scripts/shas --- src/Common/wwwroot/htmax.min.js | 2 +- src/Common/wwwroot/htmx.min.js | 2 +- src/Tests/ViewEngine.fs | 8 ++++---- src/ViewEngine.Htmx/Htmx.fs | 8 ++++---- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/Common/wwwroot/htmax.min.js b/src/Common/wwwroot/htmax.min.js index 05403f0..a8d8ceb 100644 --- a/src/Common/wwwroot/htmax.min.js +++ b/src/Common/wwwroot/htmax.min.js @@ -1 +1 @@ -var htmx=(()=>{const e={parse(t){if(!t)return{};if(t.startsWith("{"))return JSON.parse(t);let r=/(?:"([^"]+)"|'([^']+)'|([^\s,:]+))(?:\s*:\s*(?:"([^"]*)"|'([^']*)'|<((?:[^/]|\/(?!>))+)\/>|([^\s,]+)))?(?=\s|,|$)/g,i={};for(let s of t.matchAll(r)){let[,t,r,n,o,a,l,c]=s,h=t??r??n,u=(o??a??l??c??"true").trim();try{u=JSON.parse(u)}catch{}let d=n?.includes("."),f=d?h.split(".").reduceRight((e,t)=>({[t]:e}),u):{[h]:u};e.merge(f,i)}return i},split:e=>e.split(/,(?![^\[]*\])(?![^(]*\))(?![^<]*\/>)(?=(?:[^"']|"[^"]*"|'[^']*')*$)/),merge(t,r){"string"==typeof t&&(t=e.parse(t));for(let[i,s]of Object.entries(t)){if(["__proto__","constructor","prototype"].includes(i))continue;let t=s&&"object"==typeof s&&!Array.isArray(s),n=r[i]&&"object"==typeof r[i]&&!Array.isArray(r[i]);t&&n?e.merge(s,r[i]):r[i]=s}return r}};class t{#e=null;#t=[];issue(e,t){return e.queueStrategy=t,this.#e?"replace"===t||"abort"!==t&&"abort"===this.#e.queueStrategy?(this.#t.forEach(e=>e.status="dropped"),this.#t=[],this.#e.request?.abort?.(),this.#e=e,!0):("queue all"===t?(this.#t.push(e),e.status="queued"):"drop"===t?e.status="dropped":"queue last"===t?(this.#t.forEach(e=>e.status="dropped"),this.#t=[e],e.status="queued"):0===this.#t.length&&"abort"!==t?(this.#t.push(e),e.status="queued"):e.status="dropped",!1):(this.#e=e,!0)}finish(){this.#e=null}next(){return this.#t.shift()}abort(){this.#e?.request?.abort?.()}more(){return this.#t?.length}}return new class{#r=e;#i=new Map;#s="";#n=new Set;#o;#a=Function;#l=Object.getPrototypeOf(async function(){}).constructor;#c={createHTML:e=>e,createScript:e=>e};#h;#u="a,form";#d=["get","post","put","patch","delete"];#f;#m;#p;#g;constructor(){this.#x(),this.#b(),this.#h=this.#y("[hx-action],[hx-get],[hx-post],[hx-put],[hx-patch],[hx-delete]"),this.#f=(new XPathEvaluator).createExpression(`.//*[@*[${this.#v("hx-on").map(e=>`starts-with(name(), "${e}")`).join(" or ")}]]`),this.#o={attributeValue:this.#w.bind(this),parseTriggerSpecs:this.#S.bind(this),determineMethodAndAction:this.#E.bind(this),createRequestContext:this.#A.bind(this),collectFormData:this.#q.bind(this),getAttributeObject:this.#C.bind(this),insertContent:this.#T.bind(this),morph:this.#H.bind(this),isSoftMatch:this.#k.bind(this),initSecurity:(e,t,r)=>{e&&(this.#c=e),t&&(this.#a=t),r&&(this.#l=r)},onTrigger:this.#_.bind(this),htmxProp:this.#N.bind(this),triggerHtmxEvent:this.#M.bind(this),executeJavaScript:this.#L.bind(this)};let e=()=>{this.#O(),this.process(document.body)};"loading"===document.readyState?document.addEventListener("DOMContentLoaded",e):setTimeout(e)}#x(){this.version="4.0.0-beta5",this.config={logAll:!1,prefix:"data-hx-",transitions:!1,history:!0,mode:"same-origin",defaultSwap:"innerHTML",defaultFocusScroll:!1,indicatorClass:"htmx-indicator",requestClass:"htmx-request",includeIndicatorCSS:!0,defaultTimeout:6e4,extensions:"",morphIgnore:["data-htmx-powered"],morphSkip:"[hx-morph-skip]",morphSkipChildren:"[hx-morph-skip-children]",morphScanLimit:10,noSwap:[204,304],implicitInheritance:!1,defaultSettleDelay:1};let t=document.querySelector('meta[name="htmx-config"]');t&&e.merge(t.content,this.config),this.#s=this.config.extensions}#b(){if(!1!==this.config.includeIndicatorCSS){let e=this.config.indicatorClass,t=this.config.requestClass,r=new CSSStyleSheet;r.replaceSync(`.${e}{opacity:0;visibility: hidden} .${t} .${e}, .${t}.${e}{opacity:1;visibility: visible;transition: opacity 200ms ease-in}`),document.adoptedStyleSheets=[...document.adoptedStyleSheets,r]}}registerExtension(e,t){return!(this.#s&&!this.#s.split(/,\s*/).includes(e))&&(!this.#n.has(e)&&(this.#n.add(e),t.init&&t.init(this.#o),void Object.entries(t).forEach(([e,t])=>{this.#i.get(e)?.push(t)||this.#i.set(e,[t])})))}#I(e){let t=this.config.prefix;return!e.closest||null!=e.closest("[hx-ignore]")||t&&null!=e.closest(`[${t}ignore]`)}#R(e,t){let r=this.config.prefix;return e.getAttribute(t)??(r?e.getAttribute(t.replace("hx-",r)):null)}#P(e,t){let r=this.config.prefix&&t.replace("hx-",this.config.prefix);return e.hasAttribute(t)?t:r&&e.hasAttribute(r)?r:null}#y(e){return this.#v(e).join(",")}#v(e){let t=[e];return this.config.prefix&&t.push(e.replaceAll("hx-",this.config.prefix)),t}#j(e,t){let r=[...e.querySelectorAll?.(t)??[]];return e.matches?.(t)&&r.unshift(e),r}#D(e){return"before"===e?"beforebegin":"after"===e?"afterend":"prepend"===e?"afterbegin":"append"===e?"beforeend":e}#V(e,t){let r=[];return this.#w(e,t,void 0,(e,t)=>{e?.split(/\s*[,:]\s*/).includes("this")&&r.push(t)}),r}#w(e,t,r,i){t=this.#W(t);let s=this.#W(":inherited"),n=this.#W(":append"),o=this.#R(e,t)??this.#R(e,t+s);if(null!=o)return i?i(o,e):o;let a=CSS.escape(this.config.implicitInheritance?t:t+s),l=CSS.escape(t+s+n),c=this.#y(`[${a}],[${l}]`),h=this.#P(e,t+n)??this.#P(e,t+s+n);if(h){let r=e.getAttribute(h),s=e.parentNode?.closest?.(c);if(i&&i(r,e),s){let e=this.#w(s,t,void 0,i);return e?(e+","+r).replace(/[{}]/g,""):r}return r}let u=e.parentNode?.closest?.(c);return u?(o=this.#w(u,t,void 0,i),!i&&o&&this.config.implicitInheritance&&this.#B(e,"htmx:after:implicitInheritance",{elt:e,name:t,parent:u}),o):r}#S(t){return e.split(t).flatMap(t=>{let[,r,i]=t.match(/^\s*(\S+\[[^\]]*\]|\S+)\s*(.*?)\s*$/)??[];if(!r)return[];if(/\[[^\]]*$/.test(r))throw"unterminated:"+r;return[{name:r,...e.parse(i)}]})}#E(e,t){if(this.#$(e))return this.#F(e,t);{let t=this.#w(e,"hx-method")||"GET",r=this.#w(e,"hx-action");if(!r)for(let i of this.#d){let s=this.#w(e,"hx-"+i);if(null!=s){r=s,t=i;break}}return t=t.toUpperCase(),{action:r,method:t}}}#F(e,t){if(e.matches("a"))return{action:e.getAttribute("href"),method:"GET"};return{action:t.submitter?.getAttribute?.("formAction")||e.getAttribute("action"),method:(t.submitter?.getAttribute?.("formMethod")||e.getAttribute("method")||"GET").toUpperCase()}}#N(e){return e._htmx||(e._htmx={listeners:[],triggerSpecs:[]},e.setAttribute("data-htmx-powered","true")),e._htmx}#U(e){return e._htmx_state||={}}#z(e){if(this.#J(e)&&this.#M(e,"htmx:before:init",{},!0)){let t=this.#N(e);t.initialized=!0,t.eventHandler=this.#Q(e),this.#G(e),this.#X(e),this.#M(e,"htmx:after:init",{},!0)}}#Q(e){return async t=>{try{let r=this.#A(e,t);await this.#K(r)}catch(t){this.#M(e,"htmx:error",{error:t})}}}#A(t,r){let{action:i,method:s}=this.#E(t,r),[n,o]=(i||"").split("#"),a=new AbortController,l={sourceElement:t,sourceEvent:r,status:"created",select:this.#w(t,"hx-select"),selectOOB:this.#w(t,"hx-select-oob"),target:this.#w(t,"hx-target"),swap:this.#w(t,"hx-swap")??this.config.defaultSwap,push:this.#w(t,"hx-push-url"),replace:this.#w(t,"hx-replace-url"),transition:this.config.transitions,confirm:this.#w(t,"hx-confirm"),request:{validate:"true"===this.#w(t,"hx-validate",!t.matches("form")||t.noValidate||r.submitter?.formNoValidate?"false":"true"),action:n,anchor:o,method:s,headers:this.#Y(t),abort:a.abort.bind(a),credentials:"same-origin",signal:a.signal,mode:this.config.mode}};t._htmx?.boosted&&e.merge(t._htmx.boosted,l),l.target=this.#Z(t,l.target),l.request.headers["HX-Request-Type"]=l.target===document.body||l.select?"full":"partial",l.target&&(l.request.headers["HX-Target"]=this.#ee(l.target));let c=this.#w(t,"hx-config");return c&&(e.merge(c,l.request),l.request.mode=this.config.mode),l}#ee(e){return`${e.tagName.toLowerCase()}${e.id?"#"+encodeURI(e.id):""}`}#Y(e){let t={"HX-Request":"true","HX-Source":this.#ee(e),"HX-Current-URL":location.href,Accept:"text/html"};return this.#$(e)&&(t["HX-Boosted"]="true"),t}#te(e,t){return this.#C(e,"hx-headers",e=>{for(let r in e)t.request.headers[r]=String(e[r])},{ctx:t})}#Z(e,t){return t instanceof Element?t:null!=t?this.#re(e,t,"hx-target"):this.#$(e)?document.body:e}#$(e){return e?._htmx?.boosted}async#K(e){let t=e.sourceElement,r=e.sourceEvent;if(!t.isConnected)return;if(this.#ie(r))return;this.#se(r)&&r.preventDefault();let i=/GET|DELETE/.test(e.request.method),s=i?t.matches("form")?t:null:t.form||t.closest("form"),n=this.#q(t,s,r.submitter,e.request.validate,i);if(!n)return;let o=this.#C(t,"hx-vals",t=>{e.vals=t;for(let e in t)n.set(e,t[e])},{ctx:e});if(o&&await o,e.values)for(let t in e.values)n.delete(t),n.append(t,e.values[t]);let a=this.#te(t,e);if(a&&await a,Object.assign(e.request,{form:s,submitter:r.submitter,body:n}),!this.#M(t,"htmx:config:request",{ctx:e}))return;if(!this.#d.includes(e.request.method.toLowerCase()))return;let l=this.#ne(e.request.action);if(null!=l){let t=Object.fromEntries(e.request.body);return void await this.#L(e.sourceElement,t,l,!1)}if(i){let t=new URL(e.request.action,document.baseURI);for(let r of e.request.body.keys())t.searchParams.delete(r);for(let[r,i]of e.request.body)t.searchParams.append(r,i);t.origin===location.origin?e.request.action=t.pathname+t.search:e.request.action=t.href,e.request.body=null}else"multipart/form-data"!==(this.#w(t,"hx-encoding")??s?.enctype)&&(e.request.body=new URLSearchParams(e.request.body));await this.#oe(e)}async#oe(e){let t=e.sourceElement,r=this.#ae(t),i=this.#le(t);if(!i.issue(e,r))return;e.status="issuing";let s=[],n=[];try{if(e.confirm){if(!await new Promise(r=>{let i={ctx:e,issueRequest:()=>r(!0),dropRequest:()=>r(!1)};if(this.#M(t,"htmx:confirm",i)){let i=this.#ne(e.confirm);r(i?this.#L(t,{ctx:e},i,!0):window.confirm(e.confirm))}}))return}if(this.#ce(e),s=this.#he(t),n=this.#ue(t),e.fetch||=window.fetch.bind(window),!this.#M(t,"htmx:before:request",{ctx:e}))return;let r=await e.fetch(e.request.action,e.request);if(e.response={raw:r,status:r.status,headers:r.headers},this.#de(e),!this.#M(t,"htmx:before:response",{ctx:e}))return;if(e.text=await r.text(),!this.#M(t,"htmx:after:request",{ctx:e}))return;if(e.response.status>=400&&this.#M(t,"htmx:response:error",{ctx:e}),this.#fe(e))return void(e.keepIndicators=!0);"issuing"===e.status&&(e.hx.retarget&&(e.target=e.hx.retarget),e.hx.reswap&&(e.swap=e.hx.reswap),e.hx.reselect&&(e.select=e.hx.reselect),e.status="response received",this.#me(e),await this.swap(e),e.status="swapped")}catch(r){e.status="error: "+r,this.#M(t,"htmx:error",{ctx:e,error:r})}finally{clearTimeout(e.requestTimeout),this.#M(t,"htmx:finally:request",{ctx:e}),e.keepIndicators||(this.#pe(s),this.#ge(n)),i.finish(),i.more()&&this.#oe(i.next())}}#de(e){e.hx={};for(let[t,r]of e.response.raw.headers)t.toLowerCase().startsWith("hx-")&&(e.hx[t.slice(3).toLowerCase().replace(/-/g,"")]=r)}#fe(t){if(t.hx.trigger&&this.#xe(t.hx.trigger,t.sourceElement),"true"===t.hx.refresh)return location.reload(),!0;if(t.hx.redirect)return location.href=t.hx.redirect,!0;if(t.hx.location){let r=t.hx.location,i={};return("{"===r[0]||/[\s,]/.test(r))&&(i=e.parse(r),r=i.path,delete i.path),i.push??="true",this.ajax("GET",r,i),!0}}#ce(e){let t=null!=e.request.timeout?this.parseInterval(e.request.timeout):this.config.defaultTimeout;t&&(e.requestTimeout=setTimeout(()=>e.request?.abort?.(),t))}#ae(e){let t=this.#w(e,"hx-sync");if(!t)return"queue first";let r=t.split(":").pop().trim();return/^(drop|abort|replace|queue)/.test(r)?r:"queue first"}#le(e){let r=this.#w(e,"hx-sync"),i=e;if(r){let t=r.includes(":")?r.slice(0,r.lastIndexOf(":")).trim():/^(drop|abort|replace|queue)/.test(r)?null:r;t&&(i=this.#re(e,t,"hx-sync")||e)}return this.#U(i).rq||=new t}#ie(e){return"click"===e.type&&(e.ctrlKey||e.metaKey||e.shiftKey)&&!!e.currentTarget?.closest?.("a[href]")}#se(e){let t=e.currentTarget;if("submit"===e.type&&"FORM"===t?.tagName)return!0;if(!("click"===e.type&&0===e.button))return!1;let r=t?.closest?.('button, input[type="submit"], input[type="image"]'),i=r?.form||r?.closest("form");if(r&&!r.disabled&&i&&("submit"===r.type||"image"===r.type||!r.type&&"BUTTON"===r.tagName))return!0;let s=t?.closest?.("a");if(!s||!s.href)return!1;let n=s.getAttribute("href");return!(n&&n.startsWith("#")&&n.length>1)}#G(e,t=e._htmx.eventHandler){let r=this.#w(e,"hx-trigger");r||(r=e.matches("form")?"submit":e.matches("input:not([type=button]):not([type=submit]),select,textarea")?"change":"click"),this.#_(e,r,t)}#_(e,t,r){let i=this.#S(t);this.#N(e).triggerSpecs.push(...i);for(let t of i){t.listeners=[];let[i,s]=this.#be(t.name),n=[e];"outside"===t.from?n=[document]:t.from&&"self"!==t.from&&(n=this.#ye(e,t.from));let o=e=>{if((t.halt||t.prevent)&&e.preventDefault(),(t.halt||t.stop||t.consume)&&e.stopPropagation(),t.once)for(let e of t.listeners)e.fromElt.removeEventListener(e.eventName,e.handler,e);r(e)},a=o;if(t.delay?a=e=>{clearTimeout(t.timeout),t.timeout=setTimeout(()=>o(e),this.parseInterval(t.delay))}:t.throttle&&(a=e=>{t.throttled?t.throttledEvent=e:(t.throttled=!0,o(e),t.throttleTimeout=setTimeout(()=>{if(t.throttled=!1,t.throttledEvent){let e=t.throttledEvent;t.throttledEvent=null,a(e)}},this.parseInterval(t.throttle)))}),t.handler=r=>{if(("self"!==t.from||r.target===e)&&("outside"!==t.from||!e.contains(r.target))&&(!t.target||r.target?.matches?.(t.target))){if(t.changed){let e=t.values??=new WeakMap,r=!1;for(let t of n)e.get(t)!==t.value&&(r=!0,e.set(t,t.value));if(!r)return}if(s){this.#se(r)&&r.preventDefault();let t={};for(let e in r)t[e]=r[e];if(!this.#L(e,t,s,!0,!1))return}a(r)}},"intersect"===i||"revealed"===i){let r={rootMargin:t.rootMargin};t.root&&(r.root=this.#re(e,t.root)),t.threshold&&(r.threshold=parseFloat(t.threshold));let s="revealed"===i;t.observer=new IntersectionObserver(r=>{for(let i=0;i"name"!==e);t.interval=setInterval(()=>{e.isConnected?this.#M(e,"every",{},!1):clearInterval(t.interval)},this.parseInterval(r))}if("load"!==i)for(let r of n){let s={fromElt:r,eventName:i,handler:t.handler,capture:!!t.capture,passive:!!t.passive};e._htmx.listeners.push(s),t.listeners.push(s),r.addEventListener(i,t.handler,s)}else t.handler(new CustomEvent("load"))}}#be(e){let t=e.match(/^([^\[]*)\[([^\]]*)]/);return t?[t[1],t[2]]:[e,null]}#xe(t,r){if("{"===t[0]){let i=e.parse(t);for(let e in i){let t=i[e],s=r;t?.target&&(s=this.find(t.target)),this.trigger(s,e,"object"==typeof t?t:{value:t})}}else t.split(",").forEach(e=>this.trigger(r,e.trim(),{}))}#ve(e){let t={},r=Object.getPrototypeOf(this);for(let i of Object.getOwnPropertyNames(r))"constructor"!==i&&"function"==typeof this[i]&&(["find","findAll"].includes(i)?t[i]=(t,r)=>void 0===r?this[i](e,t):this[i](t,r):t[i]=this[i].bind(this));return t}#L(e,t,r,i=!0,s=!0){let n={};Object.assign(n,this.#ve(e));let o={};this.#B(e,"htmx:scope",{scope:o}),Object.assign(n,o),Object.assign(n,t);let a=Object.keys(n),l=Object.values(n);return new(s?this.#l:this.#a)(...a,i?`return (${r})`:r).call(e,...l)}process(e,t){if(!e?.isConnected)return;if(!(e instanceof Element)){for(let r of e.children||[])this.process(r,t);return}if(t&&this.#we(e,!0),this.#I(e))return;if(!this.#M(e,"htmx:before:process"))return;let r=[e],i=this.#f.evaluate(e),s=null;for(;s=i.iterateNext();)r.push(s);for(let e of r)!this.#I(e)&&this.#M(e,"htmx:before:on:init",{},!0)&&this.#Se(e);for(let t of this.#j(e,this.#h))this.#z(t);for(let t of this.#j(e,this.#u))this.#Ee(t);this.#M(e,"htmx:after:process")}#Ee(e){let t=this.#w(e,"hx-boost");if(t&&"false"!==t&&this.#Ae(e)&&this.#M(e,"htmx:before:init",{},!0)){let r=this.#N(e);r.initialized=!0,r.eventHandler=this.#Q(e),r.boosted=t;let i=e.matches("a")?"click":"submit";e._htmx.listeners.push({fromElt:e,eventName:i,handler:e._htmx.eventHandler}),e.addEventListener(i,e._htmx.eventHandler),this.#M(e,"htmx:after:init",{},!0)}}#Ae(e){if(this.#J(e))if("A"===e.tagName){if(""===e.target||"_self"===e.target)return!e.hasAttribute("download")&&!e.getAttribute("href")?.startsWith?.("#")&&this.#qe(e.href)}else if("FORM"===e.tagName)return"dialog"!==e.method&&this.#qe(e.action)}#qe(e){try{return new URL(e,window.location.href).origin===window.location.origin}catch(e){return!1}}#J(e){return!e._htmx?.initialized&&!this.#I(e)}#we(e,t){let r=[e,...e.querySelectorAll?.("[data-htmx-powered]")??[]];for(let e of r)if(e._htmx){this.#M(e,"htmx:before:cleanup");for(let t of e._htmx.triggerSpecs||[])t.interval&&clearInterval(t.interval),t.timeout&&clearTimeout(t.timeout),t.throttleTimeout&&clearTimeout(t.throttleTimeout),t.observer?.disconnect();for(let t of e._htmx.listeners||[])t.fromElt.removeEventListener(t.eventName,t.handler,t);e.removeAttribute("data-htmx-powered"),this.#M(e,"htmx:after:cleanup"),t&&delete e._htmx}}#Ce(e){let t=document.createElement("div");t.hidden=!0,document.body.insertAdjacentElement("afterend",t);let r=e.querySelectorAll?.(this.#y("[hx-preserve]"))||[];for(let e of r){let r=document.getElementById(e.id);r&&this.#Te(t,r,null)}return t}#He(e){for(let t of[...e.children]){let e=document.getElementById(t.id);e&&(this.#Te(e.parentNode,t,e),this.#we(e),e.remove())}e.remove()}#ke(e){let t=this.#c.createHTML(e);return Document.parseHTMLUnsafe?.(t)||(new DOMParser).parseFromString(t,"text/html")}#_e(e){let t=e.replace(/)/gi,'"),r="";t=t.replace(/]*)?>[\s\S]*?<\/head>/i,e=>(r=this.#ke(e).title,""));let i,s,n=t.match(/<([a-z][^\/>\x20\t\r\n\f]*)/i)?.[1]?.toLowerCase();if("html"===n||"body"===n?(i=this.#ke(t),s=document.createDocumentFragment(),s.append(i.body)):(i=this.#ke(``),s=i.querySelector("template").content),!r){let e=s.querySelector("title:not(svg title)");e&&(r=e.textContent,e.remove())}return this.#Ne(s),{fragment:s,title:r}}#Me(e,t,r,i){let s=t.id?"#"+CSS.escape(t.id):null;"true"!==r&&r&&!r.includes(" ")&&([r,s=s]=r.split(/:(.*)/)),"true"!==r&&r||(r="outerHTML");let n=this.#Le(r);if(s=n.target||s,n.strip??=!n.style.startsWith("outer"),!s)return;let o=[...document.querySelectorAll(s)];for(let r of o){let s=document.createDocumentFragment();s.append(t.cloneNode(!0)),e.push({type:"oob",fragment:s,target:r,swapSpec:n,sourceElement:i})}t.remove()}#Oe(e,t,r){let i=[];if(r)for(let s of r.split(",")){let[r,n="true"]=s.split(/:(.*)/);for(let s of e.querySelectorAll(r))this.#Me(i,s,n,t)}for(let r of e.querySelectorAll(this.#y("[hx-swap-oob]"))){let e=this.#P(r,"hx-swap-oob"),s=r.getAttribute(e);r.removeAttribute(e),this.#Me(i,r,s,t)}return i}#Ie(e,t,r){t?t.before(...r.childNodes):e.append(...r.childNodes)}#Le(t){t=t.trim();let r=this.config.defaultSwap;if(t&&!/^\S*:/.test(t)){let e=t.match(/^(\S+)\s*(.*)$/);r=e[1],t=e[2]}return{style:this.#D(r),...e.parse(t)}}#Re(e,t){let r=[];for(let i of e.querySelectorAll("template[hx]")){let e=i.getAttribute("type");if("partial"===e){let e=this.#R(i,"hx-target")||(i.id?"#"+CSS.escape(i.id):null);if(e){this.#Ne(i.content);let s=this.#Le(this.#R(i,"hx-swap")||this.config.defaultSwap);for(let n of document.querySelectorAll(e))r.push({type:"partial",fragment:i.content.cloneNode(!0),target:n,swapSpec:s,sourceElement:t.sourceElement})}}else this.#B(i,"htmx:process:"+e,{ctx:t,tasks:r});i.remove()}return r}#Pe(e,t,r,i){try{null!=r&&e.setSelectionRange&&e.setSelectionRange(r,i),e.focus(t)}catch(e){}}#je(e){let t=this.#j(e,"[autofocus]")[0];t&&this.#Pe(t)}#De(e,t){if(e.scroll){let r=e.scrollTarget?this.#Ve(e.scrollTarget):t;r&&("top"===e.scroll?r.scrollTop=0:"bottom"===e.scroll&&(r.scrollTop=r.scrollHeight))}if("top"===e.show||"bottom"===e.show){let r=e.showTarget?this.#Ve(e.showTarget):t;r?.scrollIntoView("top"===e.show)}}#We(e){e.request?.anchor&&document.getElementById(e.request.anchor)?.scrollIntoView({block:"start",behavior:"auto"})}#Ne(e){let t=this.#j(e,"script");for(let e of t){let t=document.createElement("script");for(let r of e.attributes)t.setAttribute(r.name,r.value);this.config.inlineScriptNonce&&(t.nonce=this.config.inlineScriptNonce),t.textContent=this.#c.createScript(e.textContent),e.replaceWith(t)}}async swap(e){try{this.#Be(e);let{fragment:t,title:r}=this.#_e(e.text);e.title=r;let i=[],s=this.#Oe(t,e.sourceElement,e.selectOOB),n=this.#Re(t,e);i.push(...s,...n);let o=this.#$e(e,t,n);if(o&&i.unshift(o),!this.#M(e.sourceElement,"htmx:before:swap",{ctx:e,tasks:i}))return;let a=[],l=[];for(let t of i)t.swapSpec?.transition??o?.transition??e.transition?l.push(t):a.push(this.#T(t));if(l.length>0){let e=async()=>{for(let e of l)await this.#T(e,!1)};a.push(this.#Fe(e))}await Promise.all(a),this.#M(e.sourceElement,"htmx:after:swap",{ctx:e}),e.title&&!o?.swapSpec?.ignoreTitle&&(document.title=e.title),this.#We(e)}finally{this.#M(e.sourceElement,"htmx:swap:finally",{ctx:e})}}#$e(e,t,r){let i=this.#Le(e.swap||this.config.defaultSwap);if("delete"===i.style||t.childElementCount>0||t.textContent.trim()||(i.swapEmpty??this.config.defaultSwapEmpty??!r.length)){if(e.select){let r=t.querySelectorAll(e.select);(t=document.createDocumentFragment()).append(...r)}return this.#$(e.sourceElement)&&(i.show||="top"),{type:"main",fragment:t,target:this.#Z(e.sourceElement||document.body,i.target||e.target),swapSpec:i,sourceElement:e.sourceElement,transition:e.transition&&!1!==i.transition}}}async#T(e,t=!0){let{target:r,swapSpec:i,fragment:s}=e;if("string"==typeof r&&(r=document.querySelector(r)),!r)return;"string"==typeof i&&(i=this.#Le(i));let n,o=i.style;if("none"===o)return;if("BODY"===s.firstElementChild?.tagName&&("outerHTML"===o?o="outerSync":o.startsWith("outer")||(i.strip=!0)),i.strip&&s.firstElementChild&&(s=document.createDocumentFragment(),s.append(...(e.fragment.firstElementChild.content||e.fragment.firstElementChild).childNodes)),this.#Ue(r,"htmx-swapping"),t&&e.swapSpec?.swap&&await this.timeout(e.swapSpec?.swap),"delete"===o)return void(r.parentNode&&(this.#we(r),r.parentNode.removeChild(r)));let a=[],l=i.settle??this.config.defaultSettleDelay,c=r.parentNode;if("innerHTML"===o||"outerHTML"===o&&c){let e=document.activeElement;if(e?.id){let t,r;try{t=e.selectionStart,r=e.selectionEnd}catch(e){}n={elt:e,start:t,end:r}}a=t&&l?this.#ze(s,r):[]}let h=this.#Ce(s),u=[...s.childNodes];try{if("innerHTML"===o){for(const e of r.children)this.#we(e);r.replaceChildren(...s.childNodes)}else if("textContent"===o){for(const e of r.querySelectorAll("[data-htmx-powered]"))this.#we(e);r.textContent=s.textContent}else if("outerHTML"===o)c&&(this.#Ie(c,r,s),this.#we(r),c.removeChild(r),r=u[0]||c);else if("outerSync"===o){this.#Je(r,s.firstElementChild);for(const e of r.children)this.#we(e);r.replaceChildren(...s.firstElementChild.childNodes),u=[r]}else if("innerMorph"===o)this.#H(r,s,!0),u=[...r.childNodes];else if("outerMorph"===o)this.#H(r,s,!1),u.push(r);else if("beforebegin"===o)c&&this.#Ie(c,r,s);else if("afterbegin"===o)this.#Ie(r,r.firstChild,s);else if("beforeend"===o)this.#Ie(r,null,s);else if("afterend"===o)c&&this.#Ie(c,r.nextSibling,s);else{let e=this.#i.get("handle_swap")||[],t=!1;for(const n of e){let e=n(o,r,s,i);if(e){t=!0,Array.isArray(e)&&(u=e);break}}if(!t)throw new Error(`Unknown swap style: ${o}`)}}finally{this.#Qe(r,"htmx-swapping")}if(this.#He(h),n&&!n.elt.matches(":focus")){let e=document.getElementById(n.elt.id);if(e){let t={preventScroll:void 0!==i.focusScroll?!i.focusScroll:!this.config.defaultFocusScroll};this.#Pe(e,t,n.start,n.end)}}this.#M(r,"htmx:before:settle",{task:e,newContent:u,settleTasks:a});for(const e of u)this.#Ue(e,"htmx-added");if(t&&a.length>0){this.#Ue(r,"htmx-settling"),await this.timeout(l);for(let e of a)e();this.#Qe(r,"htmx-settling")}this.#M(r,"htmx:after:settle",{task:e,newContent:u,settleTasks:a});for(const e of u)this.#Qe(e,"htmx-added"),this.process(e),this.#je(e);this.#De(i,r)}#M(e,t,r={},i=!0){if(r.error){let i=`htmx: ${t}: ${r.error.message??r.error}`;r.error instanceof Error?console.error(i,r.error,{elt:e,detail:r}):console.error(i,{elt:e,detail:r})}else r.warn?console.warn(`htmx: ${t}: ${r.warn}`,{elt:e,detail:r}):this.config.logAll&&console.log(`htmx: ${t}`,{elt:e,detail:r});return e=this.#Ge(e),this.#B(e,t,r),this.trigger(e,this.#W(t),r,i)}#B(e,t,r={}){let i=this.#i.get(t.replace(/:/g,"_"));if(i){r.cancelled=!1;for(const t of i)if(!1===t(e,r)||r.cancelled)return r.cancelled=!0,!1}return!0}timeout(e){if((e=this.parseInterval(e))>0)return new Promise(t=>setTimeout(t,e))}onLoad(e){this.on(this.#W("htmx:after:process"),t=>{e(t.target)})}on(e,t,r){let i,s=document;return void 0===r?(i=e,r=t):(s=this.#Ge(e),i=t),s.addEventListener(i,r),r}find(e,t){return this.#Ve(e,t)}findAll(e,t){return this.#ye(e,t)}parseInterval(e){if("number"==typeof e)return e;let[,t,r]=e?.match(/^([\d.]+)(ms|s|m)?$/)||[],i=parseFloat(t)*({ms:1,s:1e3,m:6e4}[r]||1);return isNaN(i)?void 0:i}trigger(e,t,r={},i=!0){e=this.#Ge(e);let s=new CustomEvent(t,{detail:r,cancelable:!0,bubbles:i,composed:!0}),n=e?.isConnected?e:document;return!r.cancelled&&n.dispatchEvent(s)}ajax(e,t,r){(!r||r instanceof Element||"string"==typeof r)&&(r={target:r});let i="string"==typeof r.source?document.querySelector(r.source):r.source;if("string"==typeof r.source&&!i)return Promise.reject(new Error("Source not found"));if(r.target){let e=this.#Z(document.body,r.target);if(!e)return Promise.reject(new Error("Target not found"));i||=e}i||=document.body;let s=this.#A(i,r.event||{});return Object.assign(s,r),r.target&&(s.target=this.#Z(document.body,r.target)),Object.assign(s.request,{action:t,method:e.toUpperCase()}),r.headers&&Object.assign(s.request.headers,r.headers),this.#K(s)}#O(){this.config.history&&(history.state||history.replaceState({htmx:!0},"",location.href),window.addEventListener("popstate",e=>{e.state&&e.state.htmx&&(this.#p?.abort(),this.#Xe())}))}#Ke(e){this.config.history&&(history.pushState({htmx:!0},"",e),this.#M(document,"htmx:after:history:push",{path:e}))}#Ye(e){this.config.history&&(history.replaceState({htmx:!0},"",e),this.#M(document,"htmx:after:history:replace",{path:e}))}#Xe(e){e=e||location.pathname+location.search;let t=document.querySelector(this.#y("[hx-history-elt]"))||document.body;this.#M(document,"htmx:before:history:restore",{path:e,cacheMiss:!0})&&("reload"===this.config.history?location.reload():(this.#p=new AbortController,this.ajax("GET",e,{target:t,swap:"outerSync",select:t!==document.body?this.#y("[hx-history-elt]"):void 0,request:{headers:{"HX-History-Restore-Request":"true"},signal:this.#p.signal}})))}#Ze(e){let{sourceElement:t,push:r,replace:i,hx:s,response:n}=e;if((s?.pushurl||s?.replaceurl)&&(r=s.pushurl,i=s.replaceurl),null==r&&null==i&&this.#$(t)&&(r="true"),"false"!==r&&!1!==r||(r=null),"false"!==i&&!1!==i||(i=null),!r&&!i)return null;let o=r||i;if("true"===o){let t=n?.raw?.url||e.request.action,r=new URL(t,location.href);o=r.pathname+r.search+(e.request.anchor?"#"+e.request.anchor:"")}return{type:r?"push":"replace",path:o}}#Be(e){let t=this.#Ze(e);if(!t)return;let r={history:t,sourceElement:e.sourceElement,response:e.response};this.#M(document,"htmx:before:history:update",r)&&("push"===t.type?this.#Ke(t.path):this.#Ye(t.path),this.#M(document,"htmx:after:history:update",r))}#Se(e){if(e._htmx?.onInitialized)return;let t=this.#v("hx-on"),r=this.config.metaCharacter||":",i=t=>async r=>{try{await this.#L(e,{event:r},`with(event?.detail||{}){${t}}`,!1)}catch(t){"symbol"!=typeof t&&this.#M(e,"htmx:error",{error:t})}};for(let s of e.getAttributeNames()){let n=t.find(e=>s.startsWith(e));if(!n)continue;this.#N(e).onInitialized=!0;let o=s.substring(n.length),a=e.getAttribute(s);if(!o){for(let t of a.split(/;(?=[^;]*->)/)){let r=t.indexOf("->");-1!==r&&this.#_(e,t.substring(0,r).trim(),i(t.substring(r+2).trim()))}continue}if(o[0]!==r)continue;let l=o.substring(1);l.startsWith(r)&&(l="htmx"+r+l.substring(1)),this.#_(e,l,i(a))}}#he(e){let t,r=this.#w(e,"hx-indicator");t=r?this.#ye(e,r,"hx-indicator"):[e];for(const e of t){let t=this.#U(e);t.rc=(t.rc||0)+1,this.#Ue(e,this.config.requestClass)}return t}#pe(e){for(let t of e){let e=this.#U(t);e.rc&&--e.rc<=0&&(this.#Qe(t,this.config.requestClass),delete e.rc)}}#ue(e){let t=this.#w(e,"hx-disable"),r=[];if(t){r=this.#ye(e,t,"hx-disable");for(let e of r){let t=this.#U(e);t.dc=(t.dc||0)+1,e.disabled=!0}}return r}#ge(e){for(const t of e){let e=this.#U(t);e.dc&&--e.dc<=0&&(t.disabled=!1,delete e.dc)}}#q(e,t,r,i,s){if(i&&t&&!t.reportValidity())return;let n=t?new FormData(t):new FormData,o=t?new Set(t.elements):new Set;if(!t){if(i&&e.reportValidity&&!e.reportValidity())return;this.#et(e,o,n,s)}r&&r.name&&(n.append(r.name,r.value),o.add(r));let a=this.#w(e,"hx-include");if(a)for(let t of this.#ye(e,a)){if(i&&t.reportValidity&&!t.reportValidity())return;this.#et(t,o,n)}return n}#et(e,t,r,i){let s=e.tagName,n=[];"BUTTON"===s?n=[e]:!["INPUT","SELECT","TEXTAREA","FIELDSET"].includes(s)&&i||(n=this.#j(e,"input, select, textarea"));for(let e of n){if(!e.name||e.matches(":disabled")||t.has(e))continue;t.add(e);let i=e.type;if("checkbox"===i||"radio"===i)e.checked&&r.append(e.name,e.value);else if("file"===i)for(let t of e.files)r.append(e.name,t);else if("select-multiple"===i)for(let t of e.selectedOptions)r.append(e.name,t.value);else r.append(e.name,e.value)}}#C(t,r,i,s={}){let n=this.#w(t,r);if(!n)return null;let o=this.#ne(n);if(o)return 0!==o.indexOf("{")&&(o="{"+o+"}"),this.#L(t,s,o,!0).then(e=>{i(e)});i(e.parse(n))}#tt(e){let t=e.trim();return t.startsWith("<")&&t.endsWith("/>")?t.slice(1,-2):t}#ye(t,r,i,s){let n=r??t,o=r?this.#Ge(t):document;if(n.startsWith("global "))return this.#ye(o,n.slice(7),i,!0);let a=n?e.split(n):[],l=[],c=[];for(const e of a){let t,r=this.#tt(e);if(r.startsWith("closest "))t=o.closest(r.slice(8));else if(r.startsWith("find "))t=o.querySelector(r.slice(5));else if(r.startsWith("findAll "))l.push(...o.querySelectorAll(r.slice(8)));else if("next"===r||"nextElementSibling"===r)t=o.nextElementSibling;else if(r.startsWith("next "))t=this.#rt(o,r.slice(5),!!s);else if("previous"===r||"previousElementSibling"===r)t=o.previousElementSibling;else if(r.startsWith("previous "))t=this.#it(o,r.slice(9),!!s);else if("document"===r)t=document;else if("window"===r)t=window;else if("body"===r)t=document.body;else if("host"===r)t=o.getRootNode().host;else if("this"===r){if(i){l.push(...this.#V(o,i));continue}t=o}else c.push(r);t&&l.push(t)}if(c.length>0){let e=c.join(","),t=this.#st(o,!!s);l.push(...t.querySelectorAll(e))}return[...new Set(l)]}#rt(e,t,r){return this.#nt(this.#st(e,r).querySelectorAll(t),e,Node.DOCUMENT_POSITION_PRECEDING)}#it(e,t,r){let i=[...this.#st(e,r).querySelectorAll(t)].reverse();return this.#nt(i,e,Node.DOCUMENT_POSITION_FOLLOWING)}#nt(e,t,r){for(const i of e)if(i.compareDocumentPosition(t)===r)return i}#st(e,t){return e.isConnected&&e.getRootNode?e.getRootNode?.({composed:t}):document}#re(e,t,r){let i=this.#ye(e,t,r)[0];return i||console.warn(`htmx: '${t}' on ${r} did not match any element`,{elt:e,selector:t,attr:r}),i}#Ve(e,t,r){return this.#ye(e,t,r)[0]}#ne(e){if(null!=e){if(e.startsWith("js:"))return e.substring(3);if(e.startsWith("javascript:"))return e.substring(11)}}#X(e){let t=()=>{this.#le(e).abort()};e.addEventListener("htmx:abort",t),e._htmx.listeners.push({fromElt:e,eventName:"htmx:abort",handler:t})}#H(e,t,r){let{persistentIds:i,idMap:s}=this.#ot(e,t),n=document.createElement("div");n.hidden=!0,document.body.after(n);let o={target:e,idMap:s,persistentIds:i,pantry:n,futureMatches:new WeakSet};r?this.#at(o,e,t):this.#at(o,e.parentNode,t,e,e.nextSibling),this.#we(n),n.remove()}#at(e,t,r,i=null,s=null){t instanceof HTMLTemplateElement&&r instanceof HTMLTemplateElement&&(t=t.content,r=r.content),i||=t.firstChild;let n=r.firstChild;for(;n;){let r;if(i&&i!=s&&(r=this.#lt(e,n,i,s),r&&r!==i)){let o=i;for(;o&&o!==r;){let r=o;o=o.nextSibling,r instanceof Element&&(e.idMap.has(r)||this.#ct(e,r,n))?this.#Te(t,r,s):this.#ht(e,r)}}if(!r&&n instanceof Element&&e.persistentIds.has(n.id)){let s=CSS.escape(n.id);r=e.target.id===n.id&&e.target||e.target.querySelector(`[id="${s}"]`)||e.pantry.querySelector(`[id="${s}"]`);let o=r;for(;o=o.parentNode;){let t=e.idMap.get(o);t&&(t.delete(r.id),t.size||e.idMap.delete(o))}this.#Te(t,r,i)}if(r){this.#ut(r,n,e),i=r.nextSibling,n=n.nextSibling;continue}let o=n.nextSibling;if(e.idMap.has(n)){let r=document.createElement(n.tagName);t.insertBefore(r,i),this.#ut(r,n,e),i=r.nextSibling}else t.insertBefore(n,i),i=n.nextSibling;n=o}for(;i&&i!=s;){let t=i;i=i.nextSibling,this.#ht(e,t)}}#ct(e,t,r){if(e.futureMatches.has(t))return!0;for(let i=r.nextSibling,s=0;i&&sa.has(e)))return c;if(!r){if(o>0&&c.isEqualNode(t))return c;s||(s=c)}}if(n+=r?.size||0,n>l)break;if(null!=document.activeElement?.selectionStart&&c.contains(document.activeElement))break;if(--o<1&&0===l)break;c=c.nextSibling}return s&&this.#ct(e,s,t)?null:s}#k(e,t){return e instanceof Element&&e.tagName===t.tagName&&(!("SCRIPT"===e.tagName&&!e.isEqualNode(t))&&(!(!e._x_bindings?.id||!t.matches?.("[\\:id], [x-bind\\:id]"))||(!e.id||e.id===t.id)))}#ht(e,t){e.idMap.has(t)?this.#Te(e.pantry,t,null):(this.#we(t),t.remove())}#Te(e,t,r){if(e.moveBefore)try{return void e.moveBefore(t,r)}catch(e){}e.insertBefore(t,r)}#ut(e,t,r){if(3===e.nodeType)return void(e.nodeValue!==t.nodeValue&&(e.nodeValue=t.nodeValue));if(this.config.morphSkip&&e.matches?.(this.config.morphSkip))return;if(!this.#B(e,"htmx:before:morph:node",{oldNode:e,newNode:t}))return;this.#Je(e,t),e instanceof HTMLTextAreaElement&&e.defaultValue!=t.defaultValue&&(e.value=t.value),this.config.morphSkipChildren&&e.matches?.(this.config.morphSkipChildren)||e.isEqualNode(t)&&"TEMPLATE"!==t.tagName&&!t.querySelector?.("template")||this.#at(r,e,t)}#Je(e,t){let r=this.config.morphIgnore||[],i=!1,s=e=>this.#v("hx-").some(t=>e.startsWith(t));for(const n of t.attributes)if(!r.some(e=>n.name.startsWith(e))&&e.getAttribute(n.name)!==n.value){if(s(n.name)&&(i=!0),!this.#B(e,"htmx:before:morph:attr",{attrName:n.name,newValue:n.value}))continue;e.setAttribute(n.name,n.value),"value"===n.name&&e instanceof HTMLInputElement&&"file"!==e.type&&(e.value=n.value)}for(let n=e.attributes.length-1;n>=0;n--){let o=e.attributes[n];if(o&&!t.hasAttribute(o.name)&&!r.some(e=>o.name.startsWith(e))){if(s(o.name)&&(i=!0),!this.#B(e,"htmx:before:morph:attr",{attrName:o.name,newValue:null}))continue;e.removeAttribute(o.name)}}i&&this.#we(e,!0)}#dt(e,t,r,i){for(const s of i)if(t.has(s.id)){let t=s;for(;t&&t!==r;){let r=e.get(t);null==r&&(r=new Set,e.set(t,r)),r.add(s.id),t=t.parentElement}}}#ot(e,t){let r=this.#j(e,"[id]"),i=t.querySelectorAll("[id]"),s=this.#ft(r,i),n=new Map;return this.#dt(n,s,e.parentElement,r),this.#dt(n,s,t,i),{persistentIds:s,idMap:n}}#ft(e,t){let r=new Set,i=new Map;for(const{id:t,tagName:s}of e)i.has(t)?r.add(t):t&&i.set(t,s);let s=new Set;for(const{id:e,tagName:n}of t)s.has(e)?r.add(e):i.get(e)===n&&s.add(e);for(const e of r)s.delete(e);return s}#me(t){let r=t.response.raw.status,i=this.config.noSwap.map(e=>e+""),s=r+"";for(let r of[s,s.slice(0,2)+"x",s[0]+"xx"]){if(i.includes(r))return void(t.swap="none");let s=this.#w(t.sourceElement,"hx-status:"+r);if(s)return void e.merge(s,t)}}#Fe(e){return new Promise(t=>{this.#m||=[],this.#m.push({task:e,resolve:t}),this.#g||this.#mt()})}async#mt(){if(0===this.#m.length||this.#g)return;this.#g=!0;let{task:e,resolve:t}=this.#m.shift();try{document.startViewTransition?(this.#M(document,"htmx:before:viewTransition",{task:e}),await document.startViewTransition(e).finished,this.#M(document,"htmx:after:viewTransition",{task:e})):await e()}catch(e){}finally{this.#g=!1,t(),this.#mt()}}#ze(e,t){let r=t.querySelectorAll("[id]"),i=Object.fromEntries([...r].map(e=>[e.id,e])),s=e.querySelectorAll("[id]"),n=[];for(let e of s){let t=i[e.id];if(t?.tagName===e.tagName){let r=e.cloneNode(!1);this.#Je(e,t),n.push(()=>{this.#Je(e,r)})}}return n}#Ue(e,t){e?.classList?.add?.(t)}#Qe(e,t){e?.classList?.remove?.(t),0===e?.classList?.length&&e.removeAttribute("class")}#Ge(e){return"string"==typeof e?this.find(e):e}#W(e){return this.config.metaCharacter?e.replace(/:/g,this.config.metaCharacter):e}}})();(()=>{let e;async function*t(e){let t=new TextDecoder,r="",i=!1,s={data:"",event:"",id:"",retry:null},n=!0;try{for(;;){let{done:o,value:a}=await e.read();if(o)break;let l=t.decode(a,{stream:!0});n&&(65279===l.charCodeAt(0)&&(l=l.slice(1)),n=!1),r+=l;let c=r.split(/\r\n|\r|\n/);r=c.pop()||"";for(let e of c){if(!e){i&&(yield s,i=!1,s={data:"",event:"",id:"",retry:null});continue}let t,r,n=e.indexOf(":");if(0!==n)if(n<0?(t=e,r=""):(t=e.slice(0,n),r=e.slice(n+1)," "===r[0]&&(r=r.slice(1))),"data"===t)s.data+=(i?"\n":"")+r,i=!0;else if("event"===t)s.event=r;else if("id"===t)r.includes("\0")||(s.id=r);else if("retry"===t){let e=parseInt(r,10);isNaN(e)||(s.retry=e)}}}}finally{e.releaseLock()}}async function r(r){let i=r.sourceElement,n=function(t){let r=null!=e.attributeValue(t.sourceElement,"hx-sse:connect");return{reconnect:r,reconnectDelay:500,reconnectMaxDelay:6e4,reconnectMaxAttempts:1/0,reconnectJitter:.3,pauseOnBackground:r,...htmx.config.sse||{},...t.request.sse||{}}}(r),o=!1,a={url:r.request.action,config:n,abortController:null,reader:null,lastEventId:null,delayCanceller:null,visibilityHandler:null,attempt:0,cancelled:!1,status:null};e.htmxProp(i).sse=a;let l=!1,c=null;if(n.pauseOnBackground){let e=()=>{document.hidden?(l=!0,a.reader?.cancel()):l&&(l=!1,c&&c())};document.addEventListener("visibilitychange",e),a.visibilityHandler=e}if(a.cancelled=!1,!e.triggerHtmxEvent(i,"htmx:before:sse:connection",{connection:a})||a.cancelled)return void s(i,"cancelled");a.status=r.response.status,e.triggerHtmxEvent(i,"htmx:after:sse:connection",{connection:a});let h=r.response.raw;try{for(;i.isConnected;){if(a.attempt>0){if(l){if(await new Promise(e=>{c=e}),c=null,!i.isConnected)break;a.attempt=1,o=!0}if(!o&&(!n.reconnect||a.attempt>n.reconnectMaxAttempts))break;let t=htmx.parseInterval(n.reconnectDelay)??n.reconnectDelay,s=htmx.parseInterval(n.reconnectMaxDelay)??n.reconnectMaxDelay,u=Math.min(t*Math.pow(2,a.attempt-1),s);if(n.reconnectJitter>0){let e=u*n.reconnectJitter;u=Math.max(0,u+(2*Math.random()-1)*e)}if(a.cancelled=!1,!e.triggerHtmxEvent(i,"htmx:before:sse:connection",{connection:a})||a.cancelled)break;if(await new Promise(e=>{a.delayCanceller=e,setTimeout(e,u)}),a.delayCanceller=null,!i.isConnected)break;let d=new AbortController;a.abortController=d;try{a.lastEventId&&(r.request.headers["Last-Event-ID"]=a.lastEventId),h=await fetch(r.request.action,{...r.request,signal:d.signal})}catch(t){if(d.signal.aborted)break;e.triggerHtmxEvent(i,"htmx:sse:error",{error:t,url:r.request.action}),o=!1,a.attempt++;continue}if(!h.ok){e.triggerHtmxEvent(i,"htmx:sse:error",{error:new Error(`SSE reconnect failed with status ${h.status}`),status:h.status,url:r.request.action}),o=!1,a.attempt++;continue}a.status=h.status,e.triggerHtmxEvent(i,"htmx:after:sse:connection",{connection:a}),a.attempt=0}o=!1;try{a.reader=h.body.getReader();for await(let l of t(a.reader)){if(!i.isConnected||o)break;let t={message:{data:l.data,event:l.event,id:l.id,cancelled:!1}};if(e.triggerHtmxEvent(i,"htmx:before:sse:message",t)&&!t.message.cancelled){if(l.id&&(a.lastEventId=l.id),null!=l.retry&&(n.reconnectDelay=l.retry),t.message.event){htmx.trigger(i,t.message.event,{data:t.message.data,id:t.message.id}),delete t.message.cancelled,e.triggerHtmxEvent(i,"htmx:after:sse:message",t);let r=e.attributeValue(i,"hx-sse:close");if(r&&t.message.event===r)return void s(i,"message");continue}r.text=t.message.data,r.swap.includes("swapEmpty")||(r.swap+=" swapEmpty:false"),await htmx.swap(r),delete t.message.cancelled,e.triggerHtmxEvent(i,"htmx:after:sse:message",t)}}}catch(t){a.abortController?.signal?.aborted||e.triggerHtmxEvent(i,"htmx:sse:error",{error:t,url:r.request.action})}if(a.reader=null,!i.isConnected)break;a.attempt++}}finally{s(i,i.isConnected?"ended":"removed")}}function i(t){let r=e.attributeValue(t,"hx-sse:connect");if(!r)return;if(t._htmx?.sse)return;let i=e.attributeValue(t,"hx-trigger")||"load";e.onTrigger(t,i,()=>{t._htmx?.sse||htmx.ajax("GET",r,{source:t})})}function s(t,r){let i=t?._htmx?.sse;i&&(i.abortController?.abort(),i.reader?.cancel?.(),i.delayCanceller&&i.delayCanceller(),i.visibilityHandler&&document.removeEventListener("visibilitychange",i.visibilityHandler),e.triggerHtmxEvent(t,"htmx:sse:close",{connection:i,reason:r||"cleanup"}),delete t._htmx.sse)}function n(e){if(e.hasAttribute("sse-connect")){console.warn("htmx: [hx-sse] legacy attribute sse-connect is deprecated; use hx-sse:connect instead");let t=e.getAttribute("sse-connect"),r=(htmx.config.prefix||"hx-")+"sse"+(htmx.config.metaCharacter||":")+"connect";e.hasAttribute(r)||e.setAttribute(r,t)}e.hasAttribute("sse-swap")&&console.warn("htmx: [hx-sse] sse-swap is removed in htmx 4. Unnamed SSE messages are swapped automatically. Named events are dispatched as DOM events.")}htmx.registerExtension("sse",{init:t=>{e=t},htmx_config_request:(e,t)=>{t.ctx.request.headers.Accept="text/html, text/event-stream"},htmx_before_response:(t,i)=>{let n=i.ctx,o=n.response.raw.headers.get("Content-Type");if(o?.includes("text/event-stream"))return r(n).catch(r=>{e.triggerHtmxEvent(t,"htmx:sse:error",{error:r,url:n.request.action}),s(t)}),!1},htmx_after_process:e=>{n(e),i(e);let t=htmx.config.metaCharacter||":",r=`[${CSS.escape("hx-sse"+t+"connect")}]`;htmx.config.prefix&&(r+=`,[${CSS.escape(htmx.config.prefix+"sse"+t+"connect")}]`),e.querySelectorAll(`${r},[sse-connect]`).forEach(e=>{n(e),i(e)})},htmx_before_cleanup:e=>{s(e)}})})(),(()=>{let e;function t(e){let t=htmx.config.metaCharacter||":",r=`[${CSS.escape("hx-ws"+t+e)}]`;return htmx.config.prefix&&(r+=`,[${CSS.escape(htmx.config.prefix+"ws"+t+e)}]`),r}function r(t){const r={reconnect:!0,reconnectDelay:500,reconnectMaxDelay:6e4,reconnectMaxAttempts:1/0,reconnectJitter:.3,pauseOnBackground:!0,pendingRequestTTL:3e4};let i=htmx.config.ws||{},s={};if(t){s=e.createRequestContext(t,new CustomEvent("_")).request.ws||{}}let n={...r,...i,...s};return"boolean"==typeof n.reconnectJitter&&(n.reconnectJitter=n.reconnectJitter?.3:0),n}function i(e){if(e.startsWith("ws://")||e.startsWith("wss://"))return e;if(e.startsWith("http://"))return"ws://"+e.slice(7);if(e.startsWith("https://"))return"wss://"+e.slice(8);let t="https:"===window.location.protocol?"wss:":"ws:",r=window.location.host;return e.startsWith("//")?t+e:e.startsWith("/")?t+"//"+r+e:t+"//"+r+window.location.pathname.substring(0,window.location.pathname.lastIndexOf("/")+1)+e}const s=new Map;function n(t,n){let o=i(t);if(s.has(o))return s.get(o);let a={url:o,config:r(n),socket:null,attempt:0,timer:null,pendingRequests:new Map,visibilityHandler:null,cancelled:!1};return!e.triggerHtmxEvent(n,"htmx:before:ws:connection",{connection:a})||a.cancelled?(e.triggerHtmxEvent(n,"htmx:ws:close",{connection:a,reason:"cancelled",code:null}),null):(s.set(o,a),l(o,a),a.config.pauseOnBackground&&(a.visibilityHandler=()=>{document.hidden?a.socket&&a.socket.readyState===WebSocket.OPEN&&a.socket.close():a.socket&&a.socket.readyState!==WebSocket.CLOSED||(a.attempt=0,l(o,a))},document.addEventListener("visibilitychange",a.visibilityHandler)),a)}function o(e){let r=t("connect")+","+t("send");for(let t of document.querySelectorAll(r))if(t._htmx?.ws?.url===e)return t;return null}function a(e,t){if(t.timer&&clearTimeout(t.timer),t.visibilityHandler&&document.removeEventListener("visibilitychange",t.visibilityHandler),t.abortController&&t.abortController.abort(),t.pendingRequests.clear(),t.socket)try{t.socket.readyState!==WebSocket.OPEN&&t.socket.readyState!==WebSocket.CONNECTING||t.socket.close()}catch(e){}s.delete(e)}function l(t,r){if(r.abortController&&r.abortController.abort(),r.socket){let e=r.socket;r.socket=null;try{e.readyState!==WebSocket.OPEN&&e.readyState!==WebSocket.CONNECTING||e.close()}catch(e){}}try{r.socket=new WebSocket(t);let i=new AbortController;r.abortController=i;let n={signal:i.signal};r.socket.addEventListener("open",()=>{let i=o(t);i?(e.triggerHtmxEvent(i,"htmx:after:ws:connection",{connection:r}),r.attempt=0):a(t,r)},n),r.socket.addEventListener("message",t=>{!function(t,r){let i=null;try{i=JSON.parse(r.data)}catch(e){}c(t);let s=null,n=i?.["HX-Request-ID"]||i?.request_id;n&&t.pendingRequests.has(n)?(s=t.pendingRequests.get(n).element,t.pendingRequests.delete(n),s.isConnected||(s=o(t.url))):s=o(t.url);if(!s)return void a(t.url,t);let l,h={message:{text:r.data,json:i,cancelled:!1}};if(!e.triggerHtmxEvent(s,"htmx:before:ws:message",h)||h.message.cancelled)return;h.message.json?void 0!==h.message.json.content?l=h.message.json.content:void 0!==h.message.json.payload&&(l=h.message.json.payload,t._payloadWarnFired||(console.warn("htmx: [hx-ws] json.payload is deprecated; use json.content instead"),t._payloadWarnFired=!0)):l=h.message.text;if(null!=l){let t=h.message.json?.target||e.attributeValue(s,"hx-target"),r=h.message.json?.swap||e.attributeValue(s,"hx-swap");htmx.swap({sourceElement:s,target:t||s,swap:r||(t?htmx.config.defaultSwap:"none"),text:l,transition:!1})}delete h.message.cancelled,e.triggerHtmxEvent(s,"htmx:after:ws:message",h)}(r,t)},n),r.socket.addEventListener("close",i=>{if(i.target!==r.socket)return;let n=o(t);if(n&&e.triggerHtmxEvent(n,"htmx:ws:close",{connection:r,reason:"closed",code:i.code}),!s.has(t))return;let c=r.config;c.pauseOnBackground&&document.hidden||(c.reconnect&&o(t)?function(t,r){let i=r.config;r.attempt++;let s=r.attempt;if(!i.reconnect||s>i.reconnectMaxAttempts)return void a(t,r);let n=htmx.parseInterval(i.reconnectDelay)??i.reconnectDelay,c=htmx.parseInterval(i.reconnectMaxDelay)??i.reconnectMaxDelay,h=Math.min(n*Math.pow(2,s-1),c);if(i.reconnectJitter>0){let e=h*i.reconnectJitter;h=Math.max(0,h+(2*Math.random()-1)*e)}let u=o(t);if(!u)return void a(t,r);if(r.cancelled=!1,!e.triggerHtmxEvent(u,"htmx:before:ws:connection",{connection:r})||r.cancelled)return e.triggerHtmxEvent(u,"htmx:ws:close",{connection:r,reason:"cancelled",code:null}),void a(t,r);r.timer=setTimeout(()=>{o(t)?l(t,r):a(t,r)},h)}(t,r):a(t,r))},n),r.socket.addEventListener("error",r=>{let i=o(t);i&&e.triggerHtmxEvent(i,"htmx:ws:error",{url:t,error:r})},n)}catch(r){let i=o(t);i&&e.triggerHtmxEvent(i,"htmx:ws:error",{url:t,error:r})}}function c(e){let t=e.config,r=Date.now(),i=t.pendingRequestTTL||3e4;for(let[t,s]of e.pendingRequests)r-s.timestamp>i&&e.pendingRequests.delete(t)}function h(r){if(e.htmxProp(r).ws??={},r._htmx.ws.sendInitialized)return;let o=e.attributeValue(r,"hx-ws:send"),a=o&&"true"!==o?o:null,l=e.attributeValue(r,"hx-trigger");l||(l=r.matches("form")?"submit":r.matches("input:not([type=button]),select,textarea")?"change":"click"),e.onTrigger(r,l,async o=>{if(r.matches("form")&&"submit"===o.type&&o.preventDefault(),a&&!r._htmx?.ws?.url){let e=n(a,r);e&&(r._htmx.ws.url=e.url)}await async function(r,n){let o=e.attributeValue(r,"hx-ws:send"),a=o&&"true"!==o?o:null;if(!a){let i=r.closest(t("connect"));i&&(a=e.attributeValue(i,"hx-ws:connect"))}if(!a)return void e.triggerHtmxEvent(r,"htmx:ws:error",{url:null,error:"No WebSocket connection found for element"});let l=i(a),h=s.get(l);if(h&&h.socket&&h.socket.readyState===WebSocket.CONNECTING&&await new Promise(e=>{h.socket.addEventListener("open",e,{once:!0}),h.socket.addEventListener("close",e,{once:!0}),h.socket.addEventListener("error",e,{once:!0})}),!h||!h.socket||h.socket.readyState!==WebSocket.OPEN)return void e.triggerHtmxEvent(r,"htmx:ws:error",{url:l,error:"Connection not open"});c(h);let u={...e.createRequestContext(r,n).request.headers};delete u.Accept;let d=crypto.randomUUID();u["HX-Request-ID"]=d;let f=r.form||r.closest("form"),m=e.collectFormData(r,f,n.submitter),p={};for(let[e,t]of m)p[e]=e in p?[].concat(p[e],t):t;let g=e.getAttributeObject(r,"hx-vals",e=>Object.assign(p,e));g&&await g;let x={headers:u,body:p};if(e.triggerHtmxEvent(r,"htmx:before:ws:request",x))try{h.socket.send(JSON.stringify(x)),h.pendingRequests.set(d,{element:r,timestamp:Date.now()}),e.triggerHtmxEvent(r,"htmx:after:ws:request",x)}catch(t){e.triggerHtmxEvent(r,"htmx:ws:error",{url:l,error:t})}}(r,o)}),r._htmx.ws.sendInitialized=!0}function u(t){let r=t._htmx?.ws?.url;r&&s.has(r)&&(t._htmx.ws.url=null,o(r)||function(t,r){let i=s.get(t);i&&(i.timer&&clearTimeout(i.timer),i.visibilityHandler&&document.removeEventListener("visibilitychange",i.visibilityHandler),i.abortController&&i.abortController.abort(),i.pendingRequests.clear(),e.triggerHtmxEvent(r,"htmx:ws:close",{connection:i,reason:"removed",code:null}),i.socket&&i.socket.readyState===WebSocket.OPEN&&i.socket.close(),s.delete(t))}(r,t))}htmx.registerExtension("ws",{init:t=>{e=t,htmx.config.ws||(htmx.config.ws={})},htmx_after_process:r=>{const i=t=>{!function(e){if(e.hasAttribute("ws-connect")||e.hasAttribute("ws-send")){if(console.warn("htmx: [hx-ws] legacy attributes ws-connect and ws-send are deprecated; use hx-ws:connect and hx-ws:send instead"),e.hasAttribute("ws-connect")){let t=e.getAttribute("ws-connect"),r=htmx.config.metaCharacter||":",i=(htmx.config.prefix||"hx-")+"ws"+r+"connect";e.hasAttribute(i)||e.setAttribute(i,t)}if(e.hasAttribute("ws-send")){let t=htmx.config.metaCharacter||":",r=(htmx.config.prefix||"hx-")+"ws"+t+"send";e.hasAttribute(r)||e.setAttribute(r,"")}}}(t),null!=e.attributeValue(t,"hx-ws:connect")&&function(t){if(e.htmxProp(t).ws??={},t._htmx.ws.initialized)return;let r=e.attributeValue(t,"hx-ws:connect");if(!r)return;let i=e.attributeValue(t,"hx-trigger")||"load";e.onTrigger(t,i,()=>{if(t._htmx?.ws?.url)return;let e=n(r,t);e&&(t._htmx.ws.url=e.url)}),t._htmx.ws.initialized=!0}(t),null!=e.attributeValue(t,"hx-ws:send")&&h(t)};i(r);let s=t("connect")+","+t("send")+",[ws-connect],[ws-send]";r.querySelectorAll(s).forEach(i)},htmx_before_cleanup:e=>{u(e)}}),"undefined"!=typeof window&&window.htmx&&(window.addEventListener("pagehide",()=>{s.forEach(e=>{e.socket&&e.socket.close(1001,"page navigating away")})}),window.htmx.ext=window.htmx.ext||{},window.htmx.ext.ws={getRegistry:()=>({clear:()=>{let e=Array.from(s.values());s.clear(),e.forEach(e=>{e.timer&&clearTimeout(e.timer),e.visibilityHandler&&document.removeEventListener("visibilitychange",e.visibilityHandler),e.abortController&&e.abortController.abort(),e.socket&&e.socket.close(),e.pendingRequests.clear()})},get:e=>s.get(i(e)),has:e=>s.has(i(e)),get size(){return s.size}})})})(),(()=>{let e;htmx.registerExtension("preload",{init:t=>{e=t},htmx_after_init:t=>{!function(t){let r=e.attributeValue(t,"hx-preload");if(null==r&&!t._htmx?.boosted)return;let i=[],s=5e3;if(r){let t=e.parseTriggerSpecs(r);if(0===t.length)return;for(const e of t)i.push(e.name),e.timeout&&(s=htmx.parseInterval(e.timeout))}else{let r=t._htmx?.boosted&&"A"===t.tagName,n=null!=e.attributeValue(t,"hx-get");if(!r&&!n)return;if(r&&!1===htmx.config?.preload?.autoBoost)return;htmx.config?.preload?.boostTimeout&&(s=htmx.parseInterval(htmx.config.preload.boostTimeout)),i.push(htmx.config?.preload?.boostEvent||"mousedown"),i.push("touchstart")}let n=async r=>{let{method:i}=e.determineMethodAndAction(t,r);if("GET"!==i)return;if(t._htmx?.preload)return;let n=e.createRequestContext(t,r),o=t.form||t.closest("form"),a=e.collectFormData(t,o,r.submitter),l=e.getAttributeObject(t,"hx-vals",e=>{for(let t in e)a.set(t,e[t])});l&&await l;let c=n.request.action.replace?.(/#.*$/,""),h=new URLSearchParams(a);h.size&&(c+=(/\?/.test(c)?"&":"?")+h),t._htmx.preload={prefetch:fetch(c,n.request),action:c,expiresAt:Date.now()+s};try{await t._htmx.preload.prefetch}catch(e){delete t._htmx.preload}};for(let e of i)t.addEventListener(e,n,{passive:!0});t._htmx.preloadListener=n,t._htmx.preloadEvents=i}(t)},htmx_before_request:(e,t)=>{let{ctx:r}=t;if(e._htmx?.preload&&e._htmx.preload.action===r.request.action&&Date.now()t,delete e._htmx.preload}else e._htmx&&delete e._htmx.preload},htmx_before_cleanup:e=>{if(e._htmx?.preloadListener)for(let t of e._htmx.preloadEvents)e.removeEventListener(t,e._htmx.preloadListener)}})})(),(()=>{if("undefined"==typeof navigation)return;let e,t=0,r=new Set,i=null;function s(){navigation.addEventListener("navigate",e=>{if(!e.canIntercept)return;let s,n=history.state;e.intercept({handler:()=>new Promise(e=>{s=e}),scroll:"manual",focusReset:"manual"}),e.signal.addEventListener("abort",()=>{t>0&&(r.forEach(e=>e()),r.clear(),t=0),i=null}),i=()=>{s(),history.replaceState(n,"")}},{once:!0}),navigation.navigate(location.href,{history:"replace"})}function n(){i&&(i(),i=null)}htmx.registerExtension("browser-indicator",{init:t=>{e=t},htmx_before_history_update:()=>{n()},htmx_before_request:(i,n)=>{(function(t){return"true"===e.attributeValue(t,"hx-browser-indicator")||!(!htmx.config.boostBrowserIndicator||!t._htmx?.boosted)})(i)&&(n.ctx._browserIndicator=!0,t++,1===t&&s(),n.ctx.request?.abort&&r.add(n.ctx.request.abort))},htmx_finally_request:(e,i)=>{i.ctx._browserIndicator&&(i.ctx.request?.abort&&r.delete(i.ctx.request.abort),0!==t&&(t--,0===t&&n()))}})})(),(()=>{let e;function t(t,r,i){(async()=>{let s=+r.headers.get("Content-Length")||null;e.triggerHtmxEvent(t,"htmx:download:start",{total:s});let n=r.body.getReader(),o=[],a=0;for(;;){let{done:r,value:i}=await n.read();if(r)break;o.push(i),a+=i.length,e.triggerHtmxEvent(t,"htmx:download:progress",{loaded:a,total:s,percent:s?Math.round(a/s*100):null})}let l=new Blob(o,{type:r.headers.get("Content-Type")||"application/octet-stream"}),c=function(e,t){let r=e.get("Content-Disposition");if(r){let e=r.match(/filename\*?=['"]?(?:UTF-8'')?([^'";]+)/i);if(e)return decodeURIComponent(e[1])}return t.split("/").pop().split("?")[0]||"download"}(r.headers,i),h=URL.createObjectURL(l);Object.assign(document.createElement("a"),{href:h,download:c}).click(),URL.revokeObjectURL(h),e.triggerHtmxEvent(t,"htmx:download:complete",{filename:c,size:l.size})})()}htmx.registerExtension("download",{init:t=>{e=t},htmx_before_response:(e,{ctx:r})=>{let i=r.response.headers.get("HX-Download");if(i)return void(async()=>{t(r.sourceElement,await fetch(i),i)})();let s=r.response.headers.get("Content-Disposition");return"download"===r.swap||s?.includes("attachment")?(t(r.sourceElement,r.response.raw,r.request.action),!1):void 0}})})(),(()=>{let e;function t(e){if(e.optimisticDiv){e.optimisticDiv.remove();for(let t of e.optHidden)t.style.display=""}}htmx.registerExtension("hx-optimistic",{init:t=>{e=t},htmx_config_request:(e,t)=>{let r=t.ctx.request.body;r?.entries&&(t.ctx.optimisticBody=r)},htmx_before_request:(t,r)=>{!function(t){if(t.optimistic=e.attributeValue(t.sourceElement,"hx-optimistic"),!t.optimistic)return;let r=document.querySelector(t.optimistic);if(!r)return;let i=t.target;if("string"==typeof i&&(i=document.querySelector(i)),!i)return;let s=document.createElement("div");if(s.style.cssText="all: initial",s.classList.add("hx-optimistic"),s.innerHTML=r.innerHTML,t.optimisticBody){let e=new Set(t.optimisticBody.keys());for(let r of e){let e=t.optimisticBody.getAll(r).filter(e=>"string"==typeof e);if(!e.length)continue;let i=1===e.length?e[0]:JSON.stringify(e);try{s.dataset[r]=i}catch(e){try{s.setAttribute("data-"+r,i)}catch(e){}}}}let n="before"===(o=t.swap)?"beforebegin":"after"===o?"afterend":"prepend"===o?"afterbegin":"append"===o?"beforeend":o;var o;if(t.optHidden=[],"innerHTML"===n){for(let e of i.children)e.style.display="none",t.optHidden.push(e);i.appendChild(s)}else["beforebegin","afterbegin","beforeend","afterend"].includes(n)?i.insertAdjacentElement(n,s):(i.style.display="none",t.optHidden.push(i),i.after(s));t.optimisticDiv=s,htmx.process(s)}(r.ctx)},htmx_error:(e,r)=>{t(r.ctx)},htmx_before_swap:(e,r)=>{t(r.ctx)}})})(),(()=>{let e;htmx.registerExtension("hx-targets",{init:t=>{e=t},htmx_before_swap:(t,r)=>{let{ctx:i,tasks:s}=r,n=e.attributeValue(i.sourceElement,"hx-targets");if(!n)return;let o=htmx.findAll(i.sourceElement,n);if(!o.length)return void console.warn(`htmx: '${n}' on hx-targets did not match any elements`,{selector:n});let a=s.findIndex(e=>"main"===e.type);if(-1===a)return;let l=s[a],c=Array.from(o).map(e=>({...l,fragment:l.fragment.cloneNode(!0),target:e}));s.splice(a,1,...c)}})})(),(()=>{let e,t=new Set,r=!1,i=Symbol(),s=null,n=null,o=0,a=0,l=0,c=!1;const h={childList:!0,subtree:!0,attributes:!0,characterData:!0};function u(){s||(n=()=>d(),document.addEventListener("input",n,!0),document.addEventListener("change",n,!0),s=new MutationObserver(n),s.observe(document.documentElement,h))}function d(){if(r)return;if(o>0)return;let e=Date.now();e-l>1e3&&(l=e,a=0,c=!1),++a>50&&!c&&(console.warn("htmx: hx-live recompute exceeded 50/sec."),c=!0),r=!0,queueMicrotask(()=>{s?.disconnect(),t.forEach(e=>e()),0===t.size?s&&(document.removeEventListener("input",n,!0),document.removeEventListener("change",n,!0),s.disconnect(),s=null,n=null):s.observe(document.documentElement,h),r=!1})}let f=new Set(["disabled","hidden","required","readonly","open","inert","multiple","autofocus","novalidate","default","reversed","loop","muted","controls","autoplay","playsinline","formnovalidate","async","defer","ismap","typemustmatch","allowfullscreen","itemscope","nomodule"]),m=new Set(["checked","value","selected"]),p=new Set(["contenteditable","draggable","spellcheck"]);function g(e,t,...r){let i=t.startsWith("."),s="class"===t,n=t.startsWith("aria-"),o=m.has(t);if(0===r.length){let r=e[0];if(!r)return;return i?r.classList.contains(t.slice(1)):s?r.getAttribute("class"):n?"true"===r.getAttribute(t):f.has(t)?r.hasAttribute(t):o?r[t]:r.getAttribute(t)}let a=r[0];for(let r of e)if(i)r.classList.toggle(t.slice(1),!!a),0===r.classList.length&&r.removeAttribute("class");else if(s)y(r,a);else if(n){let e="string"==typeof a||"number"==typeof a?String(a):a?"true":"false";r.setAttribute(t,e)}else o?!1===a||null==a?(r[t]="boolean"!=typeof r[t]&&"",r.removeAttribute(t)):!0===a?(r[t]=!0,r.setAttribute(t,"")):(r[t]=a,r.setAttribute(t,String(a))):f.has(t)?a?r.setAttribute(t,""):r.removeAttribute(t):p.has(t)?null==a?r.removeAttribute(t):!0===a?r.setAttribute(t,"true"):!1===a?r.setAttribute(t,"false"):r.setAttribute(t,String(a)):null==a||!1===a?r.removeAttribute(t):r.setAttribute(t,!0===a?"":String(a))}function x(e){return e.replace(/[A-Z]/g,e=>"-"+e.toLowerCase())}function b(e){return new Proxy({},{get:(t,r)=>{if("string"!=typeof r)return;let i=x(r),s=e.closest("[data-"+i+"]");if(!s)return;let n=s.dataset[r];try{return JSON.parse(n)}catch{return n}},set:(t,r,i)=>{if("string"!=typeof r)return!1;let s=x(r);return(e.closest("[data-"+s+"]")||e).dataset[r]="string"==typeof i?i:JSON.stringify(i),!0},has:(t,r)=>{if("string"!=typeof r)return!1;let i=x(r);return!!e.closest("[data-"+i+"]")},ownKeys:()=>{let t=[],r=new Set;for(let i=e;i;i=i.parentElement)for(let e of Object.keys(i.dataset))"htmxPowered"===e||r.has(e)||(r.add(e),t.push(e));return t},getOwnPropertyDescriptor:(t,r)=>{if("string"!=typeof r||"htmxPowered"===r)return;let i=x(r);return e.closest("[data-"+i+"]")?{enumerable:!0,configurable:!0}:void 0}})}function y(t,r){let i=e.htmxProp(t),s=i.liveClasses||new Set,n=new Set;if("string"==typeof r)for(let e of r.trim().split(/\s+/).filter(Boolean))n.add(e),t.classList.add(e);else if(r&&"object"==typeof r)for(let[e,i]of Object.entries(r))for(let r of e.trim().split(/\s+/).filter(Boolean))n.add(r),t.classList.toggle(r,!!i);for(let e of s)n.has(e)||t.classList.remove(e);0===t.classList.length&&t.removeAttribute("class"),i.liveClasses=n}function v(e,t,r){let i=t.startsWith("."),s=i?t.slice(1):t,n=t.startsWith("aria-"),o=i?"."+s:"["+t+"]",a=null==r?e[0]?.parentElement:r.nodeType?r:null,l=a?[a,...a.querySelectorAll(o)]:document.querySelectorAll("string"==typeof r?r:r?.from||o),c=new Set(e);for(let e of l)c.has(e)||(i?(e.classList?.remove(s),0===e.classList?.length&&e.removeAttribute("class")):n?e.setAttribute(t,"false"):e.removeAttribute(t));for(let r of e)i?r.classList?.add(s):n?r.setAttribute(t,"true"):r.setAttribute(t,"")}function w(e,...t){let r=e||document;for(let e of t)e?.nodeType&&(r=e);return new Promise(e=>{let i=[],s=!1,n=t=>{if(!s){s=!0;for(let e of i)e();e(t)}};for(let e of t){if(null==e||e?.nodeType)continue;let t="number"==typeof e?e:"string"==typeof e?htmx.parseInterval(e):void 0;if(void 0!==t&&t>0){let r=setTimeout(()=>n(e),t);i.push(()=>clearTimeout(r))}else if("string"==typeof e){let t=e=>n(e);r.addEventListener(e,t,{once:!0}),i.push(()=>r.removeEventListener(e,t))}}})}function S(e,t,r){let i=e.startsWith("."),s=i?e.slice(1):e,n=e.startsWith("aria-"),o=t&&("string"==typeof t?t.split("|").map(e=>e.trim()):t);if(o)if(i){let e=o.findIndex(e=>e&&r.classList.contains(e));e>=0&&r.classList.remove(o[e]);let t=o[(e+1)%o.length];t&&r.classList.add(t)}else{let t=r.getAttribute(e)??"",i=o.indexOf(t),s=o[(i+1)%o.length];""===s?r.removeAttribute(e):r.setAttribute(e,s)}else if(i)r.classList.toggle(s);else if(n){let t=r.getAttribute(e);r.setAttribute(e,"true"===t?"false":"true")}else r.toggleAttribute(e)}function E(){let e=new Map;return(t,r)=>{let s=(n=r?r.toString():null,e.get(n)||(e.set(n,{last:0,reject:null}),e.get(n)));var n;s.reject?.(i),s.reject=null;let o=++s.last;if(!r)return new Promise((e,r)=>{s.reject=r,setTimeout(()=>{o===s.last&&(s.reject=null,e())},t)});setTimeout(()=>o===s.last&&r(),t)}}function A(t){let r=e.htmxProp(t);return r.debounce||(r.debounce=E())}function q(e,t=document){return r=>{if("string"!=typeof r)return N(r?.nodeType?[r]:[...r||[]]);let i=r,s=i.match(/^(.+)\s+in\s+(.+)$/),n=[t];if(s&&(i=s[1],n="this"===s[2]||"me"===s[2]?[e]:[...document.querySelectorAll(s[2])]),!n.length)return N([]);let o,a=e=>{if(1===n.length)return[...n[0].querySelectorAll(e)];let t=[],r=new Set;for(let i of n)for(let s of i.querySelectorAll(e))r.has(s)||(r.add(s),t.push(s));return t.sort((e,t)=>4&e.compareDocumentPosition(t)?-1:1)},l=i.match(/^(next|previous|closest|first|last)\s+(.+)$/);if(l){let[,t,r]=l,i=t=>e.compareDocumentPosition(t);if("closest"===t){let t=e.closest?.(r);o=t?[t]:[]}else{let e=a(r);if("first"===t)o=e.slice(0,1);else if("last"===t)o=e.slice(-1);else if("next"===t){let t=e.find(e=>4&i(e));o=t?[t]:[]}else{let t=e.reverse().find(e=>2&i(e));o=t?[t]:[]}}}else o=a(i);return N(o)}}let C,T,H,k=new Set(["map","filter","reduce","reduceRight","forEach","some","every","find","findIndex","findLast","findLastIndex","flatMap","flat","slice","indexOf","lastIndexOf","includes","join","at"]),_={before:"beforebegin",after:"afterend",start:"afterbegin",end:"beforeend"};function N(e){let t=new Proxy({},{get:(r,i)=>{if("count"===i)return e.length;if("arr"===i)return()=>e.slice();if(i===Symbol.iterator)return()=>e.values();if("q"===i)return t=>{let r=new Set;for(let i of e)for(let e of q(i,i)(t).arr())r.add(e);return N([...r])};if("trigger"===i)return(r,i,s)=>(e.forEach(e=>htmx.trigger(e,r,i,s)),t);if("insert"===i)return(r,i)=>(e.forEach(e=>e.insertAdjacentHTML(_[r],i)),t);if("take"===i)return(r,i)=>(v(e,r,i),t);if("toggle"===i)return(r,i)=>(e.forEach(e=>S(r,i,e)),t);if("attr"===i)return(r,...i)=>0===i.length?g(e,r):(g(e,r,...i),t);if("data"===i)return e[0]?b(e[0]):void 0;if(k.has(i))return e[i].bind(e);let s=e[0]?.[i];return"function"==typeof s?(...t)=>e.map(e=>e[i](...t))[0]:s&&"object"==typeof s?N(e.map(e=>e[i])):s},set:(t,r,i)=>(e.forEach(e=>e[r]=i),d(),!0)});return t}function M(e){for(let t of T)if(e.startsWith(t)&&e.length>t.length)return e.slice(t.length)}function L(e){let r=e._htmx;if(r?.liveRuns){for(let e of r.liveRuns)t.delete(e);delete r.liveRuns,delete r.liveRegistered,delete r.liveAttrs}}function O(r){if(r.closest("[hx-ignore]"))return;let s=e.htmxProp(r);if(!s.liveRegistered){let n=H.find(e=>r.hasAttribute(e));if(n){s.liveRegistered=!0,u();let o=r.getAttribute(n),a=A(r),l=async()=>{if(r.isConnected)try{await e.executeJavaScript(r,{debounce:a},o,!1)}catch(e){e!==i&&console.error("htmx: hx-live expression threw",e,{elt:r})}else t.delete(l)};t.add(l),s.liveRuns=s.liveRuns||new Set,s.liveRuns.add(l),l()}}s.liveAttrs||=new Set;for(let e of r.attributes){let t=M(e.name);t&&!s.liveAttrs.has(t)&&(s.liveAttrs.add(t),R(r,t,e.value))}}function I(e){C||function(){let e=htmx.config.metaCharacter||":",t=htmx.config.prefix;T=["hx-live"+e],t&&T.push(t+"live"+e);let r=htmx.config.live?.bindPrefix;void 0===r&&(window.Alpine?(r="",console.warn('hx-live: Alpine.js detected — ":" short-form bindings disabled. Set htmx.config.live.bindPrefix to configure.')):r=":"),r&&T.push(r),H=["hx-live"],t&&H.push(t+"live");let i=T.map(e=>`starts-with(name(), "${e}")`).join(" or "),s=H.map(e=>`@${e}`).join(" or ");C=(new XPathEvaluator).createExpression(`.//*[@*[${i}] or ${s}]`)}(),1===e.nodeType&&O(e);let t,r=C.evaluate(e),i=[];for(;t=r.iterateNext();)i.push(t);for(t of i)O(t)}function R(r,n,o){u();let a=A(r),l=/\bawait\b/.test(o)?async()=>{if(r.isConnected)try{let t=await e.executeJavaScript(r,{debounce:a},o,!0);P(r,n,t),s?.takeRecords()}catch(e){e!==i&&console.error("htmx: hx-live expression threw",e,{elt:r,attr:n})}else t.delete(l)}:()=>{if(r.isConnected)try{let t=e.executeJavaScript(r,{debounce:a},o,!0,!1);P(r,n,t)}catch(e){e!==i&&console.error("htmx: hx-live expression threw",e,{elt:r,attr:n})}else t.delete(l)};t.add(l);let c=e.htmxProp(r);c.liveRuns=c.liveRuns||new Set,c.liveRuns.add(l),l()}function P(t,r,i){"text"!==r?"html"!==r?"style"!==r?g([t],r,i):function(t,r){let i=e.htmxProp(t),s=i.liveStyles||new Set,n=new Set;if("string"==typeof r)for(let e of r.split(";")){let r=e.indexOf(":");if(r<0)continue;let i=e.slice(0,r).trim(),s=e.slice(r+1).trim();i&&(n.add(i),t.style.setProperty(i,s))}else if(r&&"object"==typeof r)for(let[e,i]of Object.entries(r)){let r=x(e);n.add(r),null==i||""===i?t.style.removeProperty(r):t.style.setProperty(r,String(i))}for(let e of s)n.has(e)||t.style.removeProperty(e);0===t.style.length&&t.removeAttribute("style"),i.liveStyles=n}(t,i):t.innerHTML=null==i?"":String(i):t.textContent=null==i?"":String(i)}let j=e=>null==e?[]:"string"==typeof e?document.querySelectorAll(e):e.nodeType?[e]:e;htmx.live={q:e=>q(document.documentElement)(e),debounce:E(),refresh:()=>d(),take:(e,t,r)=>v([...j(e)],t,r),toggle:(e,t,r)=>[...j(e)].forEach(e=>S(t,r,e)),attr:(e,t,...r)=>g([...j(e)],t,...r),forEvent:(...e)=>w(null,...e),nextFrame:()=>new Promise(e=>requestAnimationFrame(e))},htmx.registerExtension("hx-live",{init:t=>{e=t},htmx_before_cleanup:e=>{L(e)},htmx_before_morph_attr:(e,t)=>{T.some(e=>t.attrName.startsWith(e))&&L(e)},htmx_after_process:e=>{I(e)},htmx_before_swap:()=>{o++},htmx_swap_finally:()=>{0===--o&&t.size>0&&d()},htmx_scope:(e,t)=>{Object.assign(t.scope,{q:q(e),forEvent:(...t)=>w(e,...t),nextFrame:()=>new Promise(e=>requestAnimationFrame(e)),trigger:(t,r,i)=>htmx.trigger(e,t,r,i),debounce:A(e),take:(t,r)=>v([e],t,r),toggle:(t,r)=>S(t,r,e),attr:(t,...r)=>g([e],t,...r),insert:(t,r)=>e.insertAdjacentHTML(_[t],r),matches:t=>e.matches(t),style:e.style,classList:e.classList,data:b(e)})}})})(); \ No newline at end of file +var htmx=(()=>{const e={parse(t){if(!t)return{};if(t.startsWith("{"))return JSON.parse(t);let r=/(?:"([^"]+)"|'([^']+)'|([^\s,:]+))(?:\s*:\s*(?:"([^"]*)"|'([^']*)'|<((?:[^/]|\/(?!>))+)\/>|([^\s,]+)))?(?=\s|,|$)/g,i={};for(let n of t.matchAll(r)){let[,t,r,s,o,a,l,c]=n,h=t??r??s,u=(o??a??l??c??"true").trim();try{u=JSON.parse(u)}catch{}let d=s?.includes("."),f=d?h.split(".").reduceRight((e,t)=>({[t]:e}),u):{[h]:u};e.merge(f,i)}return i},split:e=>e.split(/,(?![^\[]*\])(?![^(]*\))(?![^<]*\/>)(?=(?:[^"']|"[^"]*"|'[^']*')*$)/),merge(t,r){"string"==typeof t&&(t=e.parse(t));for(let[i,n]of Object.entries(t)){if(["__proto__","constructor","prototype"].includes(i))continue;let t=n?.constructor===Object,s=r[i]?.constructor===Object;t&&s?e.merge(n,r[i]):r[i]=n}return r}};class t{#e=null;#t=[];admit(e,t,r){if(!this.#e)return this.#e={strategy:e,abort:r},"run";if("replace"===e||"abort"!==e&&"abort"===this.#e.strategy)return this.#t=[],this.#e.abort?.(),this.#e={strategy:e,abort:r},"run";if("queue all"===e)this.#t.push(t);else if("queue last"===e)this.#t=[t];else{if("abort"===e||"drop"===e||0!==this.#t.length)return"dropped";this.#t.push(t)}return"queued"}continue(){this.#e=null,this.#t.shift()?.()}abort(){this.#e?.abort?.()}}return new class{#r=e;#i=new Map;#n="";#s=new Set;_loc=window.location;#o;#a=Function;#l=Object.getPrototypeOf(async function(){}).constructor;#c={createHTML:e=>e,createScript:e=>e};#h;#u="a,form";#d=["get","post","put","patch","delete","query"];#f;#m;#p;#g;#x;constructor(){this.#b(),this.#y(),this.#h=this.#v("[hx-action],[hx-get],[hx-post],[hx-put],[hx-patch],[hx-delete],[hx-query]"),this.#f=(new XPathEvaluator).createExpression(`.//*[@*[${this.#w("hx-on").map(e=>`starts-with(name(), "${e}")`).join(" or ")}]]`),this.#o={HCON:e,attributeValue:this.#S.bind(this),parseTriggerSpecs:this.#E.bind(this),determineMethodAndAction:this.#A.bind(this),createRequestContext:this.#C.bind(this),collectFormData:this.#q.bind(this),getAttributeObject:this.#T.bind(this),insertContent:this.#_.bind(this),morph:this.#O.bind(this),isSoftMatch:this.#N.bind(this),initSecurity:(e,t,r)=>{e&&(this.#c=e),t&&(this.#a=t),r&&(this.#l=r)},onTrigger:this.#H.bind(this),htmxProp:this.#k.bind(this),triggerHtmxEvent:this.#M.bind(this),executeJavaScript:this.#I.bind(this)};let t=()=>this.initialize();"loading"===document.readyState?document.addEventListener("DOMContentLoaded",t):setTimeout(t)}#b(){this.version="4.0.0",this.config={logAll:!1,prefix:"data-hx-",transitions:!1,history:!0,mode:"same-origin",defaultSwap:"innerHTML",defaultFocusScroll:!1,indicatorClass:"htmx-indicator",requestClass:"htmx-request",includeIndicatorCSS:!0,defaultTimeout:6e4,extensions:"",morphIgnore:["data-htmx-powered"],morphSkip:"[hx-morph-skip]",morphSkipChildren:"[hx-morph-skip-children]",morphScanLimit:10,noSwap:[204,304],implicitInheritance:!1,defaultSettleDelay:1,allowEmptySwapAfterOOB:!1};let t=document.querySelector('meta[name="htmx-config"]');t&&e.merge(t.content,this.config),this.#n=this.config.extensions}#y(){if(!1!==this.config.includeIndicatorCSS){let e=this.config.indicatorClass,t=this.config.requestClass,r=new CSSStyleSheet;r.replaceSync(`.${e}{opacity:0;visibility: hidden} .${t} .${e}, .${t}.${e}{opacity:1;visibility: visible;transition: opacity 200ms ease-in}`),document.adoptedStyleSheets=[...document.adoptedStyleSheets,r]}}registerExtension(e,t){return!(this.#n&&!this.#n.split(/,\s*/).includes(e))&&(!this.#s.has(e)&&(this.#s.add(e),t.init&&t.init(this.#o),void Object.entries(t).forEach(([e,t])=>{this.#i.get(e)?.push(t)||this.#i.set(e,[t])})))}#L(e){let t=this.config.prefix;return!e.closest||null!=e.closest("[hx-ignore]")||t&&null!=e.closest(`[${t}ignore]`)}#P(e,t){let r=this.config.prefix;return e.getAttribute(t)??(r?e.getAttribute(t.replace("hx-",r)):null)}#D(e,t){let r=this.config.prefix&&t.replace("hx-",this.config.prefix);return e.hasAttribute(t)?t:r&&e.hasAttribute(r)?r:null}#v(e){return this.#w(e).join(",")}#w(e){let t=[e];return this.config.prefix&&t.push(e.replaceAll("hx-",this.config.prefix)),t}#j(e,t){let r=[...e.querySelectorAll?.(t)??[]];return e.matches?.(t)&&r.unshift(e),r}#V(e){return"before"===e?"beforebegin":"after"===e?"afterend":"prepend"===e?"afterbegin":"append"===e?"beforeend":e}#R(e,t){let r=[];return this.#S(e,t,void 0,(e,t)=>{e?.split(/\s*[,:]\s*/).includes("this")&&r.push(t)}),r}#S(e,t,r,i){t=this.#W(t);let n=this.#W(":inherited"),s=this.#W(":append"),o=this.#P(e,t)??this.#P(e,t+n);if(null!=o)return i?i(o,e):o;let a=CSS.escape(this.config.implicitInheritance?t:t+n),l=CSS.escape(t+n+s),c=this.#v(`[${a}],[${l}]`),h=this.#D(e,t+s)??this.#D(e,t+n+s);if(h){let r=e.getAttribute(h),n=e.parentNode?.closest?.(c);if(i&&i(r,e),n){let e=this.#S(n,t,void 0,i);return e?(e+","+r).replace(/[{}]/g,""):r}return r}let u=e.parentNode?.closest?.(c);return u?(o=this.#S(u,t,void 0,i),!i&&o&&this.config.implicitInheritance&&this.#$(e,"htmx:after:implicitInheritance",{elt:e,name:t,parent:u}),o):r}#E(t){return e.split(t).flatMap(t=>{let[,r,i]=t.match(/^\s*(\S+\[[^\]]*\]|\S+)\s*(.*?)\s*$/)??[];if(!r)return[];if(/\[[^\]]*$/.test(r))throw"unterminated:"+r;return[{name:r,...e.parse(i)}]})}#A(e,t){let r=this.#S(e,"hx-method"),i=this.#S(e,"hx-action");if(!i)for(let t of this.#d){let n=this.#S(e,"hx-"+t);if(null!=n){i=n,r=t;break}}return this.#B(e)&&(i||=t.submitter?.getAttribute?.("formAction")||e.getAttribute(e.matches("a")?"href":"action")),r||=t.submitter?.getAttribute?.("formmethod")||e.getAttribute("method")||"GET",{action:i,method:r.toUpperCase()}}#k(e){return e._htmx||(e._htmx={listeners:[],triggerSpecs:[]},e.setAttribute("data-htmx-powered","true")),e._htmx}#F(e){return e._htmx_state||={}}#z(e){if(this.#U(e)&&this.#M(e,"htmx:before:init",{},!0)){let t=this.#k(e);t.initialized=!0,t.eventHandler=this.#J(e),this.#Q(e),this.#M(e,"htmx:after:init",{},!0)}}#J(e){return async t=>{try{let r=this.#C(e,t);await this.#G(r)}catch(t){this.#M(e,"htmx:error",{error:t})}}}#C(t,r){let{action:i,method:n}=this.#A(t,r),[s,o]=(i||"").split("#"),a=new AbortController,l={sourceElement:t,sourceEvent:r,status:"created",select:this.#S(t,"hx-select"),selectOOB:this.#S(t,"hx-select-oob"),target:this.#S(t,"hx-target"),swap:this.#S(t,"hx-swap")??this.config.defaultSwap,push:this.#S(t,"hx-push-url"),replace:this.#S(t,"hx-replace-url"),transition:this.config.transitions,confirm:this.#S(t,"hx-confirm"),request:{validate:"true"===this.#S(t,"hx-validate",!t.matches("form")||t.noValidate||r.submitter?.formNoValidate?"false":"true"),action:s,anchor:o,method:n,headers:this.#X(t),abort:a.abort.bind(a),credentials:"same-origin",signal:a.signal,mode:this.config.mode}};t._htmx?.boosted&&e.merge(t._htmx.boosted,l),l.target=this.#K(t,l.target),l.target&&(l.request.headers["HX-Target"]=this.#Y(l.target));let c=this.#S(t,"hx-config");return c&&(e.merge(c,l.request),l.request.mode=this.config.mode),l}#Y(e){return`${e.tagName.toLowerCase()}${e.id?"#"+encodeURI(e.id):""}`}#X(e){let t={"HX-Request":"true","HX-Source":this.#Y(e),"HX-Current-URL":location.href,Accept:"text/html"};return this.#B(e)&&(t["HX-Boosted"]="true"),t}#Z(e,t){return this.#T(e,"hx-headers",e=>{for(let r in e)t.request.headers[r]=String(e[r])},{ctx:t})}#K(e,t){return t instanceof Element?t:null!=t?this.#ee(e,t,"hx-target"):this.#B(e)?document.body:e}#B(e){return e?._htmx?.boosted}async#G(e){let t=e.sourceElement,r=e.sourceEvent;if(!t.isConnected)return;if(this.#te(r))return;this.#re(r)&&r.preventDefault();let i=/GET|DELETE/.test(e.request.method),n=i?t.matches("form")?t:null:t.form||t.closest("form"),s=this.#q(t,n,r.submitter,e.request.validate,i);if(!s)return;let o=this.#T(t,"hx-vals",t=>{e.vals=t;for(let e in t)s.set(e,t[e])},{ctx:e});if(o&&await o,e.values)for(let t in e.values)s.delete(t),s.append(t,e.values[t]);let a=this.#Z(t,e);if(a&&await a,Object.assign(e.request,{form:n,submitter:r.submitter,body:s}),!this.#M(t,"htmx:config:request",{ctx:e}))return;if("DIALOG"===e.request.method)return;let l=this.#ie(e.request.action);if(null!=l){let t=Object.fromEntries(e.request.body);return void await this.#I(e.sourceElement,t,l,!1)}if(i){let t=new URL(e.request.action,document.baseURI);for(let r of e.request.body.keys())t.searchParams.delete(r);for(let[r,i]of e.request.body)t.searchParams.append(r,i);t.origin===location.origin?e.request.action=t.pathname+t.search:e.request.action=t.href,e.request.body=null}else"multipart/form-data"!==(this.#S(t,"hx-encoding")??n?.enctype)&&(e.request.body=new URLSearchParams(e.request.body));await this.#ne(e)}async#ne(e){let t=e.sourceElement,r=this.#se(t),i=this.#oe(t);if(this.#ae(t),"run"!==i.admit(r,()=>this.#ne(e),()=>e.request?.abort?.()))return;e.status="issuing";let n=[],s=[];try{if(e.confirm){if(!await new Promise(r=>{let i={ctx:e,issueRequest:()=>r(!0),dropRequest:()=>r(!1)};if(this.#M(t,"htmx:confirm",i)){let i=this.#ie(e.confirm);r(i?this.#I(t,{ctx:e},i,!0):window.confirm(e.confirm))}}))return}if(this.#le(e),n=this.#ce(t),s=this.#he(t),e.fetch||=window.fetch.bind(window),e.request.headers["HX-Request-Type"]=e.target===document.body||e.select?"full":"partial",!this.#M(t,"htmx:before:request",{ctx:e}))return;let r=await e.fetch(e.request.action,e.request);if(e.response={raw:r,status:r.status,headers:r.headers},this.#ue(e),!this.#M(t,"htmx:before:response",{ctx:e}))return;if(e.text=await r.text(),!this.#M(t,"htmx:after:request",{ctx:e}))return;if(e.response.status>=400&&this.#M(t,"htmx:response:error",{ctx:e}),this.#de(e))return void(e.keepIndicators=!0);"issuing"===e.status&&(e.hx.retarget&&(e.target=e.hx.retarget),e.hx.reswap&&(e.swap=e.hx.reswap),e.hx.reselect&&(e.select=e.hx.reselect),e.status="response received",this.#fe(e),await this.swap(e),e.status="swapped")}catch(r){e.status="error: "+r,this.#M(t,"htmx:error",{ctx:e,error:r})}finally{await(e.extensionPromise?.catch(()=>{})),clearTimeout(e.requestTimeout),e.hx?.trigger&&this.#me(e.hx.trigger,e.sourceElement),this.#M(t,"htmx:finally:request",{ctx:e}),e.keepIndicators||(this.#pe(n),this.#ge(s)),i.continue()}}#ue(e){e.hx={};for(let[t,r]of e.response.raw.headers)t.toLowerCase().startsWith("hx-")&&(e.hx[t.slice(3).toLowerCase().replace(/-/g,"")]=r)}#de(t){if("true"===t.hx.refresh)return this._loc.reload(),!0;if(t.hx.redirect)return this._loc.href=t.hx.redirect,!0;if(t.hx.location){let r=t.hx.location,i={},n=e.parse(r);return"{"!==r[0]&&null==n.path||(i=n,r=i.path,delete i.path),null==i.push&&null==i.replace&&(i.push="true"),this.ajax("GET",r,i),!0}}#le(e){let t=null!=e.request.timeout?this.parseInterval(e.request.timeout):this.config.defaultTimeout;t&&(e.requestTimeout=setTimeout(()=>e.request?.abort?.(),t))}#se(e){let t=this.#S(e,"hx-sync");if(!t)return"queue first";let r=t.split(":").pop().trim();return/^(drop|abort|replace|queue)/.test(r)?r:"queue first"}#oe(e){let r=this.#S(e,"hx-sync"),i=e;if(r){let t=r.includes(":")?r.slice(0,r.lastIndexOf(":")).trim():/^(drop|abort|replace|queue)/.test(r)?null:r;t&&(i=this.#ee(e,t,"hx-sync")||e)}return this.#F(i).rq||=new t}#te(e){return"click"===e.type&&(e.ctrlKey||e.metaKey||e.shiftKey)&&!!e.currentTarget?.closest?.("a[href]")}#re(e){let t=e.currentTarget;if("submit"===e.type&&"FORM"===t?.tagName)return!0;if(!("click"===e.type&&0===e.button))return!1;let r=t?.closest?.('button, input[type="submit"], input[type="image"]'),i=r?.form||r?.closest("form");if(r&&!r.disabled&&i&&("submit"===r.type||"image"===r.type||!r.type&&"BUTTON"===r.tagName))return!0;let n=t?.closest?.("a");if(!n||!n.href)return!1;let s=n.getAttribute("href");return!(s&&s.startsWith("#")&&s.length>1)}#Q(e,t=e._htmx.eventHandler){let r=this.#S(e,"hx-trigger")||(e.matches("form")?"submit":e.matches("input:not([type=button]):not([type=submit]),select,textarea")?"change":"click");this.#H(e,r,t)}#H(e,t,r){let i=this.#E(t);this.#k(e).triggerSpecs.push(...i);for(let t of i){t.listeners=[];let[i,n]=this.#xe(t.name),s=[e];"outside"===t.from?s=[document]:t.from&&"self"!==t.from&&(s=this.#be(e,t.from));let o=e=>{if((t.halt||t.prevent)&&e.preventDefault(),(t.halt||t.stop||t.consume)&&e.stopPropagation(),t.once)for(let e of t.listeners)e.fromElt.removeEventListener(e.eventName,e.handler,e);r(e)},a=o;if(t.delay?a=e=>{clearTimeout(t.timeout),t.timeout=setTimeout(()=>o(e),this.parseInterval(t.delay))}:t.throttle&&(a=e=>{t.throttled?t.throttledEvent=e:(t.throttled=!0,o(e),t.throttleTimeout=setTimeout(()=>{if(t.throttled=!1,t.throttledEvent){let e=t.throttledEvent;t.throttledEvent=null,a(e)}},this.parseInterval(t.throttle)))}),t.handler=r=>{if(("self"!==t.from||r.target===e)&&("outside"!==t.from||!e.contains(r.target))&&(!t.target||r.target?.matches?.(t.target))){if(t.changed){let e=t.values??=new WeakMap,r=!1;for(let t of s)e.get(t)!==t.value&&(r=!0,e.set(t,t.value));if(!r)return}if(n){this.#re(r)&&r.preventDefault();let t={};for(let e in r)t[e]=r[e];if(!this.#I(e,t,n,!0,!1))return}a(r)}},"intersect"===i||"revealed"===i){let r={rootMargin:t.rootMargin};t.root&&(r.root=this.#ee(e,t.root)),t.threshold&&(r.threshold=parseFloat(t.threshold));let n="revealed"===i;t.observer=new IntersectionObserver(r=>{for(let i=0;i"name"!==e);t.interval=setInterval(()=>{e.isConnected?this.#M(e,"every",{},!1):clearInterval(t.interval)},this.parseInterval(r))}if("load"!==i)for(let r of s){let n={fromElt:r,eventName:i,handler:t.handler,capture:!!t.capture,passive:!!t.passive};e._htmx.listeners.push(n),t.listeners.push(n),r.addEventListener(i,t.handler,n)}else t.handler(new CustomEvent("load"))}}#xe(e){let t=e.match(/^([^\[]*)\[([^\]]*)]/);return t?[t[1],t[2]]:[e,null]}#me(t,r){if("{"===t[0]){let i=e.parse(t);for(let e in i){let t=i[e],n=r;t?.target&&(n=this.find(t.target)),this.trigger(n,e,"object"==typeof t?t:{value:t})}}else t.split(",").forEach(e=>this.trigger(r,e.trim(),{}))}#ye(e){let t={},r=Object.getPrototypeOf(this);for(let i of Object.getOwnPropertyNames(r))"constructor"!==i&&"function"==typeof this[i]&&(["find","findAll"].includes(i)?t[i]=(t,r)=>void 0===r?this[i](e,t):this[i](t,r):t[i]=this[i].bind(this));return t}#I(e,t,r,i=!0,n=!0,s=!1){let o={};Object.assign(o,this.#ye(e));let a={},l={scope:a,code:r};this.#$(e,"htmx:scope",l),r=l.code,Object.assign(o,a),Object.assign(o,t);let c=Object.keys(o),h=Object.values(o),u=new(n?this.#l:this.#a)(...c,i?`return (${r})`:r);return s?()=>u.call(e,...h):u.call(e,...h)}process(e,t){if(!e?.isConnected)return;if(!(e instanceof Element)){for(let r of e.children||[])this.process(r,t);return}if(t&&this.#ve(e,!0),this.#L(e))return;if(!this.#M(e,"htmx:before:process"))return;let r=[e],i=this.#f.evaluate(e),n=null;for(;n=i.iterateNext();)r.push(n);for(let e of r)!this.#L(e)&&this.#M(e,"htmx:before:on:init",{},!0)&&this.#we(e);for(let t of this.#j(e,this.#h))this.#z(t);for(let t of this.#j(e,this.#u))this.#Se(t);this.#M(e,"htmx:after:process")}#Se(e){let t=this.#S(e,"hx-boost");if(t&&"false"!==t&&this.#Ee(e)&&this.#M(e,"htmx:before:init",{},!0)){let r=this.#k(e);r.initialized=!0,r.eventHandler=this.#J(e),r.boosted=t;let i=e.matches("a")?"click":"submit";e._htmx.listeners.push({fromElt:e,eventName:i,handler:e._htmx.eventHandler}),e.addEventListener(i,e._htmx.eventHandler),this.#M(e,"htmx:after:init",{},!0)}}#Ee(e){if(this.#U(e))if("A"===e.tagName){if(""===e.target||"_self"===e.target)return!e.hasAttribute("download")&&!e.getAttribute("href")?.startsWith?.("#")&&this.#Ae(e.href)}else if("FORM"===e.tagName)return"dialog"!==e.method&&this.#Ae(e.action)}#Ae(e){try{return new URL(e,window.location.href).origin===window.location.origin}catch(e){return!1}}#U(e){return!e._htmx?.initialized&&!this.#L(e)}#ve(e,t){let r=[e,...e.querySelectorAll?.("[data-htmx-powered]")??[]];for(let e of r)if(e._htmx){this.#M(e,"htmx:before:cleanup");for(let t of e._htmx.triggerSpecs||[])t.interval&&clearInterval(t.interval),t.timeout&&clearTimeout(t.timeout),t.throttleTimeout&&clearTimeout(t.throttleTimeout),t.observer?.disconnect();for(let t of e._htmx.listeners||[])t.fromElt.removeEventListener(t.eventName,t.handler,t);e.removeAttribute("data-htmx-powered"),this.#M(e,"htmx:after:cleanup"),t&&delete e._htmx}}#Ce(e){let t=document.createElement("div");t.hidden=!0,document.body.insertAdjacentElement("afterend",t);let r=e.querySelectorAll?.(this.#v("[hx-preserve]"))||[];for(let e of r){let r=document.getElementById(e.id);r&&this.#qe(t,r,null)}return t}#Te(e){for(let t of[...e.children]){let e=document.getElementById(t.id);e&&(this.#qe(e.parentNode,t,e),this.#ve(e),e.remove())}e.remove()}#_e(e){let t=this.#c.createHTML(e);return Document.parseHTMLUnsafe?.(t)||(new DOMParser).parseFromString(t,"text/html")}#Oe(e){let t=e.replace(/)/gi,'"),r="";t=t.replace(/]*)?>[\s\S]*?<\/head>/i,e=>(r=this.#_e(e).title,""));let i,n,s=t.match(/<([a-z][^\/>\x20\t\r\n\f]*)/i)?.[1]?.toLowerCase();if("html"===s||"body"===s?(i=this.#_e(t),n=document.createDocumentFragment(),n.append(i.body)):(i=this.#_e(``),n=i.querySelector("template").content),!r){let e=n.querySelector("title:not(svg title)");e&&(r=e.textContent,e.remove())}return this.#Ne(n),{fragment:n,title:r}}#He(e,t,r,i){let n=t.id?"#"+CSS.escape(t.id):null;"true"!==r&&r&&!r.includes(" ")&&([r,n=n]=r.split(/:(.*)/)),"true"!==r&&r||(r="outerHTML");let s=this.#ke(r);if(n=s.target||n,s.strip??=!s.style.startsWith("outer"),!n)return;let o=[...document.querySelectorAll(n)];for(let r of o){let n=document.createDocumentFragment();n.append(t.cloneNode(!0)),e.push({type:"oob",fragment:n,target:r,swapSpec:s,sourceElement:i})}t.remove()}#Me(e,t,r){let i=[];if(r)for(let n of r.split(",")){let[r,s="true"]=n.split(/:(.*)/);for(let n of e.querySelectorAll(r))this.#He(i,n,s,t)}for(let r of e.querySelectorAll(this.#v("[hx-swap-oob]"))){let e=this.#D(r,"hx-swap-oob"),n=r.getAttribute(e);r.removeAttribute(e),this.#He(i,r,n,t)}return i}#Ie(e,t,r){t?t.before(...r.childNodes):e.append(...r.childNodes)}#ke(t){t=t.trim();let r=this.config.defaultSwap;if(t&&!/^\S*:/.test(t)){let e=t.match(/^(\S+)\s*(.*)$/);r=e[1],t=e[2]}return{style:this.#V(r),...e.parse(t)}}#Le(e,t){let r=[];for(let i of e.querySelectorAll("template[hx]")){let e=i.getAttribute("type");if("partial"===e){let e=this.#P(i,"hx-target")||(i.id?"#"+CSS.escape(i.id):null);if(e){this.#Ne(i.content);let n=this.#ke(this.#P(i,"hx-swap")||this.config.defaultSwap),s=this.#be(t.sourceElement,e);for(let e of s.length?s:[null])r.push({type:"partial",fragment:i.content.cloneNode(!0),target:e,swapSpec:n,sourceElement:t.sourceElement})}}else this.#$(i,"htmx:process:"+e,{ctx:t,tasks:r});i.remove()}return r}#Pe(e,t,r,i){try{null!=r&&e.setSelectionRange&&e.setSelectionRange(r,i),e.focus(t)}catch(e){}}#De(e){let t=this.#j(e,"[autofocus]")[0];t&&this.#Pe(t)}#je(e,t){if(e.scroll){let r=e.scrollTarget?this.#Ve(e.scrollTarget):t;r&&("top"===e.scroll?r.scrollTop=0:"bottom"===e.scroll&&(r.scrollTop=r.scrollHeight))}if("top"===e.show||"bottom"===e.show){let r=e.showTarget?this.#Ve(e.showTarget):t;r?.scrollIntoView?.("top"===e.show)}}#Re(e){e.request?.anchor&&document.getElementById(e.request.anchor)?.scrollIntoView({block:"start",behavior:"auto"})}#Ne(e){let t=this.#j(e,"script");for(let e of t){let t=document.createElement("script");for(let r of e.attributes)t.setAttribute(r.name,r.value);this.config.inlineScriptNonce&&(t.nonce=this.config.inlineScriptNonce),t.textContent=this.#c.createScript(e.textContent),e.replaceWith(t)}}initialize(){this.config.history&&!this.#g&&(this.#g=!0,history.state||history.replaceState({htmx:!0},"",location.href),window.navigation&&!/firefox/i.test(navigator.userAgent)?navigation.addEventListener("navigate",e=>{"traverse"===e.navigationType&&e.canIntercept&&!e.hashChange&&e.intercept({handler:()=>this.#We()})}):window.addEventListener("popstate",e=>this.#We(e.state))),this.process(document.body)}async swap(e){try{this.#$e(e);let{fragment:t,title:r}=this.#Oe(e.text);e.title=r;let i=[],n=this.#Me(t,e.sourceElement,e.selectOOB),s=this.#Le(t,e);i.push(...n,...s);let o=s.length||n.length&&!this.config.allowEmptySwapAfterOOB,a=this.#Be(e,t,o);if(a&&i.unshift(a),!this.#M(e.sourceElement,"htmx:before:swap",{ctx:e,tasks:i}))return;let l=[],c=[];for(let t of i)t.swapSpec?.transition??a?.transition??e.transition?c.push(t):l.push(this.#_(t));if(c.length>0){let t=async()=>{for(let e of c)await this.#_(e,!1)};l.push(this.#Fe(t,e))}await Promise.all(l),!e.sourceElement?.isConnected&&a?.target?.isConnected&&(e.sourceElement=a.target),this.#M(e.sourceElement,"htmx:after:swap",{ctx:e}),e.title&&!a?.swapSpec?.ignoreTitle&&(document.title=e.title),this.#Re(e)}finally{this.#M(e.sourceElement,"htmx:finally:swap",{ctx:e})}}#Be(e,t,r){let i=this.#ke(e.swap||this.config.defaultSwap);if("delete"===i.style||t.childElementCount>0||t.textContent.trim()||(i.swapEmpty??!r)){if(e.select){let r=t.querySelectorAll(e.select);(t=document.createDocumentFragment()).append(...r)}return this.#B(e.sourceElement)&&(i.show||="top"),{type:"main",fragment:t,target:this.#K(e.sourceElement||document.body,i.target||e.target),swapSpec:i,sourceElement:e.sourceElement,transition:e.transition&&!1!==i.transition}}}async#_(e,t=!0){let{target:r,swapSpec:i,fragment:n}=e;if("string"==typeof r&&(r=document.querySelector(r)),!r)return;"string"==typeof i&&(i=this.#ke(i));let s,o=i.style;if("none"===o)return;if("BODY"===n.firstElementChild?.tagName){const e=r===document.body&&o.startsWith("outer");e&&"outerHTML"===o&&(o="outerSync"),i.strip??=!e}if(i.strip&&n.firstElementChild&&(n=document.createDocumentFragment(),n.append(...(e.fragment.firstElementChild.content||e.fragment.firstElementChild).childNodes)),this.#ze(r,"htmx-swapping"),t&&e.swapSpec?.swap&&await this.timeout(e.swapSpec?.swap),"delete"===o)return void(r.parentNode&&(this.#ve(r),r.parentNode.removeChild(r)));let a=[],l=i.settle??this.config.defaultSettleDelay,c=r.parentNode;if("innerHTML"===o||"outerHTML"===o&&c){let e=document.activeElement;if(e?.id){let t,r;try{t=e.selectionStart,r=e.selectionEnd}catch(e){}s={elt:e,start:t,end:r}}a=t&&l?this.#Ue(n,r):[]}let h=this.#Ce(n),u=[...n.childNodes];try{if("innerHTML"===o){for(const e of r.children)this.#ve(e);r.replaceChildren(...n.childNodes)}else if("textContent"===o){for(const e of r.querySelectorAll("[data-htmx-powered]"))this.#ve(e);r.textContent=n.textContent}else if("outerHTML"===o)c&&(this.#Ie(c,r,n),this.#ve(r),c.removeChild(r),r=u[0]||c);else if("outerSync"===o){this.#Je(r,n.firstElementChild);for(const e of r.children)this.#ve(e);r.replaceChildren(...n.firstElementChild.childNodes),u=[r]}else if("innerMorph"===o)this.#O(r,n,!0),u=[...r.childNodes];else if("outerMorph"===o)this.#O(r,n,!1),u.push(r);else if("beforebegin"===o)c&&this.#Ie(c,r,n);else if("afterbegin"===o)this.#Ie(r,r.firstChild,n);else if("beforeend"===o)this.#Ie(r,null,n);else if("afterend"===o)c&&this.#Ie(c,r.nextSibling,n);else{let e=this.#i.get("handle_swap")||[],t=!1;for(const s of e){let e=s(o,r,n,i);if(e){t=!0,Array.isArray(e)&&(u=e);break}}if(!t)throw new Error(`Unknown swap style: ${o}`)}}finally{this.#Qe(r,"htmx-swapping")}if(e.target=r,this.#Te(h),s&&!s.elt.matches(":focus")){let e=document.getElementById(s.elt.id);if(e){let t={preventScroll:void 0!==i.focusScroll?!i.focusScroll:!this.config.defaultFocusScroll};this.#Pe(e,t,s.start,s.end)}}this.#M(r,"htmx:before:settle",{task:e,newContent:u,settleTasks:a});for(const e of u)this.#ze(e,"htmx-added");if(t&&a.length>0){this.#ze(r,"htmx-settling"),await this.timeout(l);for(let e of a)e();this.#Qe(r,"htmx-settling")}this.#M(r,"htmx:after:settle",{task:e,newContent:u,settleTasks:a});for(const e of u)this.#Qe(e,"htmx-added"),this.process(e),this.#De(e);this.#je(i,r)}#M(e,t,r={},i=!0){if(r.error){let i=`htmx: ${t}: ${r.error.message??r.error}`;r.error instanceof Error?console.error(i,r.error,{elt:e,detail:r}):console.error(i,{elt:e,detail:r})}else r.warn?console.warn(`htmx: ${t}: ${r.warn}`,{elt:e,detail:r}):this.config.logAll&&console.log(`htmx: ${t}`,{elt:e,detail:r});return e=this.#Ge(e),this.#$(e,t,r),this.trigger(e,this.#W(t),r,i)}#$(e,t,r={}){let i=this.#i.get(t.replace(/:/g,"_"));if(i){r.cancelled=!1;for(const t of i)if(!1===t(e,r)||r.cancelled)return r.cancelled=!0,!1}return!0}timeout(e){if((e=this.parseInterval(e))>0)return new Promise(t=>setTimeout(t,e))}onLoad(e){this.on(this.#W("htmx:after:process"),t=>{e(t.target)})}on(e,t,r){let i,n=document;return void 0===r?(i=e,r=t):(n=this.#Ge(e),i=t),n.addEventListener(i,r),r}find(e,t){return this.#Ve(e,t)}findAll(e,t){return this.#be(e,t)}parseInterval(e){if("number"==typeof e)return e;let[,t,r]=e?.match(/^([\d.]+)(ms|s|m)?$/)||[],i=parseFloat(t)*({ms:1,s:1e3,m:6e4}[r]||1);return isNaN(i)?void 0:i}trigger(e,t,r={},i=!0){e=this.#Ge(e);let n=new CustomEvent(t,{detail:r,cancelable:!0,bubbles:i,composed:!0}),s=e?.isConnected?e:document;return!r.cancelled&&s.dispatchEvent(n)}ajax(e,t,r){(!r||r instanceof Element||"string"==typeof r)&&(r={target:r});let i="string"==typeof r.source?document.querySelector(r.source):r.source;if("string"==typeof r.source&&!i)return Promise.reject(new Error("Source not found"));if(r.target){let e=this.#K(document.body,r.target);if(!e)return Promise.reject(new Error("Target not found"));i||=e}i||=document.body;let n=this.#C(i,r.event||{});return Object.assign(n,r),r.target&&(n.target=this.#K(document.body,r.target)),Object.assign(n.request,{action:t,method:e.toUpperCase()}),r.headers&&Object.assign(n.request.headers,r.headers),this.#G(n)}#Xe(e){this.config.history&&(history.state||history.replaceState({htmx:!0},"",location.href),history.pushState({htmx:!0},"",e),this.#M(document,"htmx:after:history:push",{path:e}))}#Ke(e){this.config.history&&(history.replaceState({htmx:!0},"",e),this.#M(document,"htmx:after:history:replace",{path:e}))}async#We(e,t){if(await this.timeout(1),e??=history.state,!e?.htmx)return;this.#p?.abort(),t=t||location.pathname+location.search;let r=document.querySelector(this.#v("[hx-history-elt]"))||document.body;if(this.#M(document,"htmx:before:history:restore",{path:t,cacheMiss:!0})){if("reload"!==this.config.history)return this.#p=new AbortController,this.ajax("GET",t,{target:r,swap:"outerSync",select:r!==document.body?this.#v("[hx-history-elt]"):void 0,request:{headers:{"HX-History-Restore-Request":"true"},signal:this.#p.signal}});this._loc.reload()}}#Ye(e){let{sourceElement:t,push:r,replace:i,hx:n,response:s}=e;if((n?.pushurl||n?.replaceurl)&&(r=n.pushurl,i=n.replaceurl),null==r&&null==i&&this.#B(t)&&(r="true"),"false"!==r&&!1!==r||(r=null),"false"!==i&&!1!==i||(i=null),!r&&!i)return null;let o=r||i;if("true"===o){let t=s?.raw?.url||e.request.action,r=new URL(t,location.href);o=r.pathname+r.search+(e.request.anchor?"#"+e.request.anchor:"")}return{type:r?"push":"replace",path:o}}#$e(e){if(!this.config.history)return;let t=this.#Ye(e);if(!t)return;let r={history:t,sourceElement:e.sourceElement,response:e.response};this.#M(document,"htmx:before:history:update",r)&&("push"===t.type?this.#Xe(t.path):this.#Ke(t.path),this.#M(document,"htmx:after:history:update",r))}#we(e){if(e._htmx?.onInitialized)return;let t=this.#w("hx-on"),r=this.config.metaCharacter||":",i=t=>async r=>{try{await this.#I(e,{event:r},`with(event?.detail||{}){${t}}`,!1)}catch(t){"symbol"!=typeof t&&this.#M(e,"htmx:error",{error:t})}};for(let n of e.getAttributeNames()){let s=t.find(e=>n.startsWith(e));if(!s)continue;this.#k(e).onInitialized=!0;let o=n.substring(s.length),a=e.getAttribute(n);if(!o){for(let t of a.split(/;(?=[^;]*->)/)){let r=t.indexOf("->");-1!==r&&this.#H(e,t.substring(0,r).trim(),i(t.substring(r+2).trim()))}continue}if(o[0]!==r)continue;let l=o.substring(1);l.startsWith(r)&&(l="htmx"+r+l.substring(1)),this.#H(e,l,i(a))}}#ce(e){let t,r=this.#S(e,"hx-indicator");if(r)t=this.#be(e,r,"hx-indicator");else{if(e===document.body)return[];t=[e]}for(const e of t){let t=this.#F(e);t.rc=(t.rc||0)+1,this.#ze(e,this.config.requestClass)}return t}#pe(e){for(let t of e){let e=this.#F(t);e.rc&&--e.rc<=0&&(this.#Qe(t,this.config.requestClass),delete e.rc)}}#he(e){let t=this.#S(e,"hx-disable"),r=[];if(t){r=this.#be(e,t,"hx-disable");for(let e of r){let t=this.#F(e);t.dc=(t.dc||0)+1,e.disabled=!0}}return r}#ge(e){for(const t of e){let e=this.#F(t);e.dc&&--e.dc<=0&&(t.disabled=!1,delete e.dc)}}#q(e,t,r,i,n){if(i&&t&&!t.reportValidity())return;let s=t?new FormData(t):new FormData,o=t?new Set(t.elements):new Set;if(!t){if(i&&e.reportValidity&&!e.reportValidity())return;this.#Ze(e,o,s,n)}r&&r.name&&(s.append(r.name,r.value),o.add(r));let a=this.#S(e,"hx-include");if(a)for(let t of this.#be(e,a)){if(i&&t.reportValidity&&!t.reportValidity())return;this.#Ze(t,o,s)}return s}#Ze(e,t,r,i){let n=e.tagName,s=[];"BUTTON"===n||n.includes("-")?s=[e]:!["INPUT","SELECT","TEXTAREA","FIELDSET"].includes(n)&&i||(s=this.#j(e,"[name]:not(button)"));for(let e of s){let i=e.name||e.getAttribute?.("name");if(!i||e.matches(":disabled")||t.has(e))continue;t.add(e);let n=e.type;if("checkbox"===n||"radio"===n||"INPUT"!==e.tagName&&"checked"in e)e.checked&&r.append(i,e.value);else if("file"===n)for(let t of e.files)r.append(i,t);else if("select-multiple"===n)for(let t of e.selectedOptions)r.append(i,t.value);else if(Array.isArray(e.value))for(let t of e.value)r.append(i,t);else r.append(i,e.value)}}#T(t,r,i,n={}){let s=this.#S(t,r);if(!s)return null;let o=this.#ie(s);if(o)return 0!==o.indexOf("{")&&(o="{"+o+"}"),this.#I(t,n,o,!0).then(e=>{i(e)});i(e.parse(s))}#et(e){let t=e.trim();return t.startsWith("<")&&t.endsWith("/>")?t.slice(1,-2):t}#be(t,r,i,n){let s=r??t,o=r?this.#Ge(t)||document.body:document;if(s.startsWith("global "))return this.#be(o,s.slice(7),i,!0);let a=s?e.split(s):[],l=[],c=[];for(const e of a){let t,r=this.#et(e);if(r.startsWith("closest "))t=o.closest(r.slice(8));else if(r.startsWith("find "))t=o.querySelector(r.slice(5));else if(r.startsWith("findAll "))l.push(...o.querySelectorAll(r.slice(8)));else if("next"===r||"nextElementSibling"===r)t=o.nextElementSibling;else if(r.startsWith("next "))t=this.#tt(o,r.slice(5),!!n);else if("previous"===r||"previousElementSibling"===r)t=o.previousElementSibling;else if(r.startsWith("previous "))t=this.#rt(o,r.slice(9),!!n);else if("document"===r)t=document;else if("window"===r)t=window;else if("body"===r)t=document.body;else if("host"===r)t=o.getRootNode().host;else if("this"===r){if(i){l.push(...this.#R(o,i));continue}t=o}else c.push(r);t&&l.push(t)}if(c.length>0){let e=c.join(","),t=this.#it(o,!!n);l.push(...t.querySelectorAll(e))}return[...new Set(l)]}#tt(e,t,r){return this.#nt(this.#it(e,r).querySelectorAll(t),e,Node.DOCUMENT_POSITION_PRECEDING)}#rt(e,t,r){let i=[...this.#it(e,r).querySelectorAll(t)].reverse();return this.#nt(i,e,Node.DOCUMENT_POSITION_FOLLOWING)}#nt(e,t,r){for(const i of e)if(i.compareDocumentPosition(t)===r)return i}#it(e,t){return e.isConnected&&e.getRootNode?e.getRootNode?.({composed:t}):document}#ee(e,t,r){let i=this.#be(e,t,r)[0];return i||console.warn(`htmx: '${t}' on ${r} did not match any element`,{elt:e,selector:t,attr:r}),i}#Ve(e,t,r){return this.#be(e,t,r)[0]}#ie(e){if(null!=e){if(e.startsWith("js:"))return e.substring(3);if(e.startsWith("javascript:"))return e.substring(11)}}#ae(e){let t=this.#k(e);if(t.abortInitialized)return;t.abortInitialized=!0;let r=()=>{this.#oe(e).abort()};e.addEventListener("htmx:abort",r),t.listeners.push({fromElt:e,eventName:"htmx:abort",handler:r})}#O(e,t,r){let{persistentIds:i,idMap:n}=this.#st(e,t),s=document.createElement("div");s.hidden=!0,document.body.after(s);let o={target:e,idMap:n,persistentIds:i,pantry:s,futureMatches:new WeakSet};r?this.#ot(o,e,t):this.#ot(o,e.parentNode,t,e,e.nextSibling),this.#ve(s),s.remove()}#ot(e,t,r,i=null,n=null){t instanceof HTMLTemplateElement&&r instanceof HTMLTemplateElement&&(t=t.content,r=r.content),i||=t.firstChild;let s=r.firstChild;for(;s;){let r;if(i&&i!=n&&(r=this.#at(e,s,i,n),r&&r!==i)){let o=i;for(;o&&o!==r;){let r=o;o=o.nextSibling,r instanceof Element&&(e.idMap.has(r)||this.#lt(e,r,s))?this.#qe(t,r,n):this.#ct(e,r)}}if(!r&&s instanceof Element&&e.persistentIds.has(s.id)){let n=CSS.escape(s.id);r=e.target.id===s.id&&e.target||e.target.querySelector(`[id="${n}"]`)||e.pantry.querySelector(`[id="${n}"]`);let o=r;for(;o=o.parentNode;){let t=e.idMap.get(o);t&&(t.delete(r.id),t.size||e.idMap.delete(o))}this.#qe(t,r,i)}if(r){this.#ht(r,s,e),i=r.nextSibling,s=s.nextSibling;continue}let o=s.nextSibling;if(e.idMap.has(s)){let r=document.createElement(s.tagName);t.insertBefore(r,i),this.#ht(r,s,e),this.process(r),i=r.nextSibling}else t.insertBefore(s,i),i=s.nextSibling;s=o}for(;i&&i!=n;){let t=i;i=i.nextSibling,this.#ct(e,t)}}#lt(e,t,r){if(e.futureMatches.has(t))return!0;for(let i=r.nextSibling,n=0;i&&na.has(e)))return c;if(!r){if(o>0&&c.isEqualNode(t))return c;n||(n=c)}}if(s+=r?.size||0,s>l)break;if(null!=document.activeElement?.selectionStart&&c.contains(document.activeElement))break;if(--o<1&&0===l)break;c=c.nextSibling}return n&&this.#lt(e,n,t)?null:n}#N(e,t){return e instanceof Element&&e.tagName===t.tagName&&(!("SCRIPT"===e.tagName&&!e.isEqualNode(t))&&(!e.id||e.id===t.id))}#ct(e,t){e.idMap.has(t)?this.#qe(e.pantry,t,null):(this.#ve(t),t.remove())}#qe(e,t,r){if(e.moveBefore)try{return void e.moveBefore(t,r)}catch(e){}e.insertBefore(t,r)}#ht(e,t,r){if(3===e.nodeType)return void(e.nodeValue!==t.nodeValue&&(e.nodeValue=t.nodeValue));if(this.config.morphSkip&&e.matches?.(this.config.morphSkip))return;if(!this.#$(e,"htmx:before:morph:node",{oldNode:e,newNode:t}))return;this.#Je(e,t),e instanceof HTMLTextAreaElement&&document.activeElement!==e&&e.defaultValue!=t.defaultValue&&(e.value=t.value),this.config.morphSkipChildren&&e.matches?.(this.config.morphSkipChildren)||e.isEqualNode(t)&&"TEMPLATE"!==t.tagName&&!t.querySelector?.("template")||this.#ot(r,e,t)}#Je(e,t){let r=this.config.morphIgnore||[],i=!1,n=e=>this.#w("hx-").some(t=>e.startsWith(t));for(const s of t.attributes)if(!r.some(e=>s.name.startsWith(e))&&e.getAttribute(s.name)!==s.value){if(n(s.name)&&(i=!0),!this.#$(e,"htmx:before:morph:attr",{attrName:s.name,newValue:s.value}))continue;e.setAttribute(s.name,s.value),"value"===s.name&&e instanceof HTMLInputElement&&"file"!==e.type&&document.activeElement!==e&&(e.value=s.value)}for(let s=e.attributes.length-1;s>=0;s--){let o=e.attributes[s];if(o&&!t.hasAttribute(o.name)&&!r.some(e=>o.name.startsWith(e))){if(n(o.name)&&(i=!0),!this.#$(e,"htmx:before:morph:attr",{attrName:o.name,newValue:null}))continue;e.removeAttribute(o.name)}}i&&this.#ve(e,!0)}#ut(e,t,r,i){for(const n of i)if(t.has(n.id)){let t=n;for(;t&&t!==r;){let r=e.get(t);null==r&&(r=new Set,e.set(t,r)),r.add(n.id),t=t.parentElement}}}#st(e,t){let r=this.#j(e,"[id]"),i=t.querySelectorAll("[id]"),n=this.#dt(r,i),s=new Map;return this.#ut(s,n,e.parentElement,r),this.#ut(s,n,t,i),{persistentIds:n,idMap:s}}#dt(e,t){let r=new Set,i=new Map;for(const{id:t,tagName:n}of e)i.has(t)?r.add(t):t&&i.set(t,n);let n=new Set;for(const{id:e,tagName:s}of t)n.has(e)?r.add(e):i.get(e)===s&&n.add(e);for(const e of r)n.delete(e);return n}#fe(t){let r=t.response.raw.status,i=this.config.noSwap.map(e=>e+""),n=r+"";for(let r of[n,n.slice(0,2)+"x",n[0]+"xx"]){if(i.includes(r))return void(t.swap="none");let n=this.#S(t.sourceElement,"hx-status:"+r);if(n)return void e.merge(n,t)}}#Fe(e,t){return new Promise(r=>{this.#m||=[],this.#m.push({task:e,resolve:r,ctx:t}),this.#x||this.#ft()})}async#ft(){if(0===this.#m.length||this.#x)return;this.#x=!0;let{task:e,resolve:t,ctx:r}=this.#m.shift();try{if(document.startViewTransition){let t={task:e,ctx:r};this.#M(r.sourceElement,"htmx:before:viewTransition",t),await document.startViewTransition(t.task).finished,this.#M(r.sourceElement,"htmx:after:viewTransition",t)}else await e()}catch(e){}finally{this.#x=!1,t(),this.#ft()}}#Ue(e,t){let r=t.querySelectorAll("[id]"),i=Object.fromEntries([...r].map(e=>[e.id,e])),n=e.querySelectorAll("[id]"),s=[];for(let e of n){let t=i[e.id];if(t?.tagName===e.tagName){let r=e.cloneNode(!1);this.#Je(e,t),s.push(()=>{this.#Je(e,r)})}}return s}#ze(e,t){e?.classList?.add?.(t)}#Qe(e,t){e?.classList?.remove?.(t),0===e?.classList?.length&&e.removeAttribute("class")}#Ge(e){return"string"==typeof e?this.find(e):e}#W(e){return this.config.metaCharacter?e.replace(/:/g,this.config.metaCharacter):e}}})();htmx.version+="-htmax",htmx.config.historyCache??={disable:!0},(()=>{let e,t=new Set;function r(e){for(let t of Object.keys(e))"last-event-id"===t.toLowerCase()&&delete e[t]}async function*i(e){let t=e.reader,r=e.lastEventId,i=new TextDecoder,n="",s=!1,o=!1,a={data:"",event:"",retry:null},l=!0;try{for(;;){let{done:e,value:c}=await t.read();if(e)break;let h=i.decode(c,{stream:!0});l&&(65279===h.charCodeAt(0)&&(h=h.slice(1)),l=!1),n+=h;let u=n.split(/\r\n|\r|\n/);n=u.pop()||"";for(let e of u){if(!e){(s||o||a.event)&&(yield{...a,id:r,hasData:s,hasId:o}),s=!1,o=!1,a={data:"",event:"",retry:null};continue}let t,i,n=e.indexOf(":");if(0!==n)if(n<0?(t=e,i=""):(t=e.slice(0,n),i=e.slice(n+1)," "===i[0]&&(i=i.slice(1))),"data"===t)a.data+=(s?"\n":"")+i,s=!0;else if("event"===t)a.event=i;else if("id"===t)i.includes("\0")||(r=i,o=!0);else if("retry"===t){let e=parseInt(i,10);isNaN(e)||(a.retry=e)}}}}finally{t.releaseLock(),e.reader=null}}async function n(t,n){let o=t.sourceElement,a=function(t){let r=null!=e.attributeValue(t,"hx-sse:connect"),i=e.HCON.parse(e.attributeValue(t,"hx-config")).sse||{};return{reconnect:r,reconnectDelay:500,reconnectMaxDelay:6e4,reconnectMaxAttempts:1/0,reconnectJitter:.3,pauseOnBackground:r,releaseOn:r?"immediate":"end",...htmx.config.sse,...i}}(o),l=!1;function c(){n&&(n(),n=null)}"immediate"===a.releaseOn&&c();let h={url:t.request.action,config:a,abortController:{abort:t.request.abort,signal:t.request.signal},reader:null,lastEventId:"",delayCanceller:null,visibilityHandler:null,attempt:0,cancelled:!1,status:null};e.htmxProp(o).sse=h;let u=!1,d=null;if(a.pauseOnBackground){let e=()=>{document.hidden?(u=!0,h.reader?.cancel()):u&&(u=!1,d&&d())};document.addEventListener("visibilitychange",e),h.visibilityHandler=e}if(h.cancelled=!1,!e.triggerHtmxEvent(o,"htmx:sse:before:connection",{connection:h})||h.cancelled)return void s(o,"cancelled");h.status=t.response.status,e.triggerHtmxEvent(o,"htmx:sse:after:connection",{connection:h});let f=t.response.raw;try{for(;o.isConnected;){if(h.attempt>0){if(u){if(await new Promise(e=>{d=e}),d=null,!o.isConnected)break;h.attempt=1,l=!0}if(!l&&(!a.reconnect||h.attempt>a.reconnectMaxAttempts))break;let i=htmx.parseInterval(a.reconnectDelay)??a.reconnectDelay,n=htmx.parseInterval(a.reconnectMaxDelay)??a.reconnectMaxDelay,s=Math.min(i*Math.pow(2,h.attempt-1),n);if(a.reconnectJitter>0){let e=s*a.reconnectJitter;s=Math.max(0,s+(2*Math.random()-1)*e)}if(h.cancelled=!1,!e.triggerHtmxEvent(o,"htmx:sse:before:connection",{connection:h})||h.cancelled)break;if(await new Promise(e=>{h.delayCanceller=e,setTimeout(e,s)}),h.delayCanceller=null,!o.isConnected)break;let c=new AbortController;h.abortController=c;try{r(t.request.headers),h.lastEventId&&(t.request.headers["Last-Event-ID"]=h.lastEventId),f=await fetch(t.request.action,{...t.request,signal:c.signal})}catch(t){if(c.signal.aborted)break;e.triggerHtmxEvent(o,"htmx:sse:error",{connection:h,error:t}),l=!1,h.attempt++;continue}if(!f.ok){e.triggerHtmxEvent(o,"htmx:sse:error",{connection:h,error:new Error(`SSE reconnect failed with status ${f.status}`),status:f.status}),l=!1,h.attempt++;continue}h.status=f.status,e.triggerHtmxEvent(o,"htmx:sse:after:connection",{connection:h}),h.attempt=0}l=!1;try{h.reader=f.body.getReader();for await(let n of i(h)){if(!o.isConnected||l)break;if(n.hasId&&(h.lastEventId=n.id,n.id||r(t.request.headers)),!n.hasData&&!n.event)continue;let i=[],u={connection:h,message:{data:n.data,event:n.event,id:n.id},cancelled:!1,waitUntil:e=>i.push(Promise.resolve(e))},d=e.triggerHtmxEvent(o,"htmx:sse:before:message",u);if(await Promise.all(i),d&&!u.cancelled){if(null!=n.retry&&(a.reconnectDelay=n.retry),u.message.event){"hx:release"===u.message.event&&c(),htmx.trigger(o,u.message.event,{data:u.message.data,id:u.message.id}),e.triggerHtmxEvent(o,"htmx:sse:after:message",{connection:h,message:u.message});let t=e.attributeValue(o,"hx-sse:close");if(t&&u.message.event===t)return void s(o,"message");continue}t.text=u.message.data,t.swap.includes("swapEmpty")||(t.swap+=" swapEmpty:false"),await htmx.swap(t),"first"===a.releaseOn&&c(),e.triggerHtmxEvent(o,"htmx:sse:after:message",{connection:h,message:u.message})}}}catch(t){h.abortController?.signal?.aborted||"AbortError"===t.name||e.triggerHtmxEvent(o,"htmx:sse:error",{connection:h,error:t})}if(!o.isConnected)break;h.attempt++}}finally{c(),s(o,o.isConnected?"ended":"removed")}}function s(t,r){let i=t?._htmx?.sse;i&&(i.abortController?.abort(),i.reader?.cancel?.(),i.delayCanceller&&i.delayCanceller(),i.visibilityHandler&&document.removeEventListener("visibilitychange",i.visibilityHandler),e.triggerHtmxEvent(t,"htmx:sse:close",{connection:i,reason:r||"cleanup"}),delete t._htmx.sse)}htmx.registerExtension("sse",{init:t=>{e=t},htmx_config_request:(e,{ctx:{request:t}})=>{t.headers.Accept=`${t.headers.Accept??t.headers.accept??"text/html"}, text/event-stream`},htmx_before_response:(t,r)=>{let i,s=r.ctx,o=s.response.raw.headers.get("Content-Type");if(o?.includes("text/event-stream"))return clearTimeout(s.requestTimeout),s.extensionPromise=new Promise(e=>i=e),n(s,i).catch(r=>{"AbortError"!==r.name&&e.triggerHtmxEvent(t,"htmx:sse:error",{error:r,url:s.request.action})}),!1},htmx_after_process:r=>{let i=htmx.config.metaCharacter||":",n=r=>{!function(e){for(let r of["sse-connect","sse-close","sse-swap"])e.hasAttribute(r)&&!t.has(r)&&("sse-swap"===r?console.warn("htmx: [hx-sse] sse-swap is removed in htmx 4. Unnamed SSE messages are swapped automatically. Named events are dispatched as DOM events."):console.warn(`htmx: [hx-sse] legacy attribute ${r} is deprecated; use hx-sse:${r.slice(4)} instead`),t.add(r))}(r);for(let e of["connect","close"]){let t=`sse-${e}`;if(!r.hasAttribute(t))continue;let n=(htmx.config.prefix||"hx-")+"sse"+i+e;r.hasAttribute(n)||r.setAttribute(n,r.getAttribute(t))}!function(t){let r=e.attributeValue(t,"hx-sse:connect");if(!r)return;if(t._htmx?.sse)return;let i=e.attributeValue(t,"hx-trigger")||"load";e.onTrigger(t,i,()=>{t._htmx?.sse||htmx.ajax("GET",r,{source:t})})}(r)};n(r);let s=`[${CSS.escape("hx-sse"+i+"connect")}]`;htmx.config.prefix&&(s+=`,[${CSS.escape(htmx.config.prefix+"sse"+i+"connect")}]`),r.querySelectorAll(`${s},[sse-connect],[sse-close],[sse-swap]`).forEach(n)},htmx_before_cleanup:e=>{s(e)}})})(),(()=>{let e;function t(e){let t=htmx.config.metaCharacter||":",r=`[${CSS.escape("hx-ws"+t+e)}]`;return htmx.config.prefix&&(r+=`,[${CSS.escape(htmx.config.prefix+"ws"+t+e)}]`),r}function r(t){let r=e.HCON.parse(e.attributeValue(t,"hx-config")).ws||{};return{reconnect:!0,reconnectCodes:[1001,1005,1006,1011,1012,1013,1014],reconnectDelay:500,reconnectMaxDelay:6e4,reconnectMaxAttempts:1/0,reconnectJitter:.3,pauseOnBackground:!0,maxOutgoingMessagesQueueSize:100,...htmx.config.ws,...r}}function i(e){if(e.startsWith("ws://")||e.startsWith("wss://"))return e;if(e.startsWith("http://"))return"ws://"+e.slice(7);if(e.startsWith("https://"))return"wss://"+e.slice(8);let t="https:"===window.location.protocol?"wss:":"ws:",r=window.location.host;return e.startsWith("//")?t+e:e.startsWith("/")?t+"//"+r+e:t+"//"+r+window.location.pathname.substring(0,window.location.pathname.lastIndexOf("/")+1)+e}const n=new Set;function s(e,t){if(t.timer&&clearTimeout(t.timer),t.visibilityHandler&&document.removeEventListener("visibilitychange",t.visibilityHandler),t.abortController&&t.abortController.abort(),t.queue.length=0,t.socket)try{t.socket.readyState!==WebSocket.OPEN&&t.socket.readyState!==WebSocket.CONNECTING||t.socket.close()}catch(e){}e._htmx?.ws?.connection===t&&delete e._htmx.ws.connection,n.delete(t)}function o(t,r){let i=r.url;if(r.abortController&&r.abortController.abort(),r.socket){let e=r.socket;r.socket=null;try{e.readyState!==WebSocket.OPEN&&e.readyState!==WebSocket.CONNECTING||e.close()}catch(e){}}try{r.socket=new WebSocket(i,r.config?.protocols);let l=new AbortController;r.abortController=l;let c={signal:l.signal};r.socket.addEventListener("open",()=>{t.isConnected?(e.triggerHtmxEvent(t,"htmx:ws:after:connection",{connection:r}),r.attempt=0,function(e){for(;e.queue.length&&e.socket?.readyState===WebSocket.OPEN;){let t=e.queue.shift();a(e,t.element,t.message)}}(r)):s(t,r)},c),r.socket.addEventListener("message",i=>{r.receiving=r.receiving.then(()=>async function(t,r,i){let n=[],o={data:i.data,text(){let e=o.data;return"string"==typeof e?Promise.resolve(e):e instanceof Blob?e.text():Promise.resolve((new TextDecoder).decode(e))},json:()=>o.text().then(JSON.parse)};if(!t.isConnected)return void s(t,r);let a={connection:r,message:o,cancelled:!1,waitUntil(e){n.push(Promise.resolve(e))}},l=e.triggerHtmxEvent(t,"htmx:ws:before:message:incoming",a);if(await Promise.all(n),!l||a.cancelled)return;let c,h=null;if("string"==typeof o.data)try{h=await o.json()}catch(e){c=await o.text()}h&&(void 0!==h.content?c=h.content:void 0!==h.payload&&(c=h.payload,r._payloadWarnFired||(console.warn("htmx: [hx-ws] json.payload is deprecated; use json.content instead"),r._payloadWarnFired=!0)));if(null!=c){let r=h?.target||e.attributeValue(t,"hx-target"),i=h?.swap||e.attributeValue(t,"hx-swap")||htmx.config.defaultSwap;/(?:^|\s)swapEmpty(?::(?:true|false))?(?=\s|$)/.test(i)||(i+=" swapEmpty:false"),await htmx.swap({sourceElement:t,target:r||t,swap:i,select:h?.select??e.attributeValue(t,"hx-select"),selectOOB:e.attributeValue(t,"hx-select-oob"),text:c,transition:!1})}e.triggerHtmxEvent(t,"htmx:ws:after:message:incoming",{connection:r,message:o})}(t,r,i)).catch(i=>{t.isConnected&&e.triggerHtmxEvent(t,"htmx:ws:error",{connection:r,error:i})})},c),r.socket.addEventListener("close",i=>{if(i.target!==r.socket)return;if(t.isConnected&&e.triggerHtmxEvent(t,"htmx:ws:close",{connection:r,reason:"closed",code:i.code}),!n.has(r))return;let a=r.config;a.pauseOnBackground&&document.hidden||(a.reconnect&&a.reconnectCodes.includes(i.code)&&t.isConnected?function(t,r){let i=r.config;r.attempt++;let n=r.attempt;if(!i.reconnect||n>i.reconnectMaxAttempts)return void s(t,r);let a=htmx.parseInterval(i.reconnectDelay)??i.reconnectDelay,l=htmx.parseInterval(i.reconnectMaxDelay)??i.reconnectMaxDelay,c=Math.min(a*Math.pow(2,n-1),l);if(i.reconnectJitter>0){let e=c*i.reconnectJitter;c=Math.max(0,c+(2*Math.random()-1)*e)}if(!t.isConnected)return void s(t,r);if(r.cancelled=!1,!e.triggerHtmxEvent(t,"htmx:ws:before:connection",{connection:r})||r.cancelled)return e.triggerHtmxEvent(t,"htmx:ws:close",{connection:r,reason:"cancelled",code:null}),void s(t,r);r.timer=setTimeout(()=>{t.isConnected?o(t,r):s(t,r)},c)}(t,r):s(t,r))},c),r.socket.addEventListener("error",i=>{t.isConnected&&e.triggerHtmxEvent(t,"htmx:ws:error",{connection:r,error:i})},c)}catch(i){t.isConnected&&e.triggerHtmxEvent(t,"htmx:ws:error",{connection:r,error:i})}}function a(t,r,i){try{t.socket.send(i.data),e.triggerHtmxEvent(r,"htmx:ws:after:message:outgoing",{connection:t,message:i})}catch(i){e.triggerHtmxEvent(r,"htmx:ws:error",{connection:t,error:i})}}function l(t){if(e.htmxProp(t).ws??={},t._htmx.ws.initialized)return;let s=e.attributeValue(t,"hx-ws:connect");if(!s)return;let a=e.attributeValue(t,"hx-trigger")||"load";e.onTrigger(t,a,()=>{!function(t,s){if(s._htmx.ws.connection)return s._htmx.ws.connection;let a={url:i(t),config:r(s),socket:null,attempt:0,timer:null,queue:[],receiving:Promise.resolve(),sending:Promise.resolve(),abortController:null,visibilityHandler:null,cancelled:!1};!e.triggerHtmxEvent(s,"htmx:ws:before:connection",{connection:a})||a.cancelled?e.triggerHtmxEvent(s,"htmx:ws:close",{connection:a,reason:"cancelled",code:null}):(s._htmx.ws.connection=a,n.add(a),o(s,a),a.config.pauseOnBackground&&(a.visibilityHandler=()=>{document.hidden?a.socket&&a.socket.readyState===WebSocket.OPEN&&a.socket.close():a.socket&&a.socket.readyState!==WebSocket.CLOSED||(a.attempt=0,o(s,a))},document.addEventListener("visibilitychange",a.visibilityHandler)))}(s,t)}),t._htmx.ws.initialized=!0}function c(r){if(e.htmxProp(r).ws??={},r._htmx.ws.sendInitialized)return;let s=e.attributeValue(r,"hx-trigger");s||(s=r.matches("form")?"submit":r.matches("input:not([type=button]):not([type=submit]),select,textarea")?"change":"click"),e.onTrigger(r,s,async s=>{r.matches("form")&&"submit"===s.type&&s.preventDefault(),await async function(r,s){let o=r.closest(t("connect")),l=o&&e.attributeValue(o,"hx-ws:connect");if(!l)return void e.triggerHtmxEvent(r,"htmx:ws:error",{url:null,error:"No WebSocket connection found for element"});let c=i(l),h=o._htmx?.ws?.connection;if(!h)return void e.triggerHtmxEvent(r,"htmx:ws:error",{url:c,error:"Connection not open"});let u={...e.createRequestContext(r,s).request.headers};delete u.Accept;let d=r.form||r.closest("form"),f=e.collectFormData(r,d,s.submitter),m={};for(let[e,t]of f)m[e]=e in m?[].concat(m[e],t):t;let p=e.getAttributeObject(r,"hx-vals",e=>Object.assign(m,e)),g=h.sending.then(async()=>{p&&await p,delete m.headers;let t=[],i={headers:u,values:m,data:void 0},s={connection:h,message:i,cancelled:!1,waitUntil(e){t.push(Promise.resolve(e))}},o=e.triggerHtmxEvent(r,"htmx:ws:before:message:outgoing",s);try{if(await Promise.all(t),!o||s.cancelled)return;if(i.data??=JSON.stringify({...i.values,headers:i.headers}),!n.has(h))return void e.triggerHtmxEvent(r,"htmx:ws:error",{connection:h,error:"Connection closed"});h.socket?.readyState===WebSocket.OPEN?a(h,r,i):h.queue.length>=h.config.maxOutgoingMessagesQueueSize?e.triggerHtmxEvent(r,"htmx:ws:error",{connection:h,error:"Outgoing messages queue is full"}):h.queue.push({element:r,message:i})}catch(t){e.triggerHtmxEvent(r,"htmx:ws:error",{connection:h,error:t})}});h.sending=g.catch(()=>{}),await g}(r,s)}),r._htmx.ws.sendInitialized=!0}htmx.registerExtension("ws",{init:t=>{e=t,htmx.config.ws||(htmx.config.ws={})},htmx_after_process:r=>{const i=t=>{!function(e){if(e.hasAttribute("ws-connect")||e.hasAttribute("ws-send")){if(console.warn("htmx: [hx-ws] legacy attributes ws-connect and ws-send are deprecated; use hx-ws:connect and hx-ws:send instead"),e.hasAttribute("ws-connect")){let t=e.getAttribute("ws-connect"),r=htmx.config.metaCharacter||":",i=(htmx.config.prefix||"hx-")+"ws"+r+"connect";e.hasAttribute(i)||e.setAttribute(i,t)}if(e.hasAttribute("ws-send")){let t=htmx.config.metaCharacter||":",r=(htmx.config.prefix||"hx-")+"ws"+t+"send";e.hasAttribute(r)||e.setAttribute(r,"")}}}(t);let r=e.attributeValue(t,"hx-ws:send");null!=e.attributeValue(t,"hx-ws:connect")&&l(t),null!=r&&c(t)};i(r);let n=t("connect")+","+t("send")+",[ws-connect],[ws-send]";r.querySelectorAll(n).forEach(i)},htmx_before_cleanup:t=>{!function(t){let r=t._htmx?.ws?.connection;r&&(e.triggerHtmxEvent(t,"htmx:ws:close",{connection:r,reason:"removed",code:null}),s(t,r))}(t)}}),"undefined"!=typeof window&&window.htmx&&window.addEventListener("pagehide",()=>{n.forEach(e=>{e.socket&&e.socket.close(1e3,"page navigating away")})})})(),(()=>{let e;htmx.registerExtension("preload",{init:t=>{e=t},htmx_after_init:t=>{!function(t){let r=e.attributeValue(t,"hx-preload");if(null==r&&!t._htmx?.boosted)return;let i=[],n=5e3;if(r){let t=e.parseTriggerSpecs(r);if(0===t.length)return;for(const e of t)i.push(e.name),e.timeout&&(n=htmx.parseInterval(e.timeout))}else{let r=t._htmx?.boosted&&"A"===t.tagName,s=null!=e.attributeValue(t,"hx-get");if(!r&&!s)return;if(r&&!1===htmx.config?.preload?.autoBoost)return;htmx.config?.preload?.boostTimeout&&(n=htmx.parseInterval(htmx.config.preload.boostTimeout)),i.push(htmx.config?.preload?.boostEvent||"mousedown"),i.push("touchstart")}let s=async r=>{let{method:i}=e.determineMethodAndAction(t,r);if("GET"!==i)return;if(t._htmx?.preload)return;let s=e.createRequestContext(t,r),o=t.form||t.closest("form"),a=e.collectFormData(t,o,r.submitter),l=e.getAttributeObject(t,"hx-vals",e=>{for(let t in e)a.set(t,e[t])});l&&await l;let c=s.request.action.replace?.(/#.*$/,""),h=new URLSearchParams(a);h.size&&(c+=(/\?/.test(c)?"&":"?")+h);let u=new URL(c,location.href);t._htmx.preload={prefetch:fetch(c,s.request),action:u.origin===location.origin?u.pathname+u.search:u.href,expiresAt:Date.now()+n};try{await t._htmx.preload.prefetch}catch(e){delete t._htmx.preload}};for(let e of i)t.addEventListener(e,s,{passive:!0});t._htmx.preloadListener=s,t._htmx.preloadEvents=i}(t)},htmx_before_request:(e,t)=>{let{ctx:r}=t;if(e._htmx?.preload&&e._htmx.preload.action===r.request.action&&Date.now()t,delete e._htmx.preload}else e._htmx&&delete e._htmx.preload},htmx_before_cleanup:e=>{if(e._htmx?.preloadListener)for(let t of e._htmx.preloadEvents)e.removeEventListener(t,e._htmx.preloadListener)}})})(),(()=>{if("undefined"==typeof navigation)return;let e,t=0,r=new Set,i=null;function n(){navigation.addEventListener("navigate",e=>{if(!e.canIntercept)return;let n,s=history.state;e.intercept({handler:()=>new Promise(e=>{n=e}),scroll:"manual",focusReset:"manual"}),e.signal.addEventListener("abort",()=>{t>0&&(r.forEach(e=>e()),r.clear(),t=0),i=null}),i=()=>{n(),history.replaceState(s,"")}},{once:!0}),navigation.navigate(location.href,{history:"replace"})}function s(){i&&(i(),i=null)}htmx.registerExtension("browser-indicator",{init:t=>{e=t},htmx_before_history_update:()=>{s()},htmx_before_request:(i,s)=>{(function(t){let r=e.attributeValue(t,"hx-browser-indicator");return null!=r&&"false"!==r||!(!htmx.config.boostBrowserIndicator||!t._htmx?.boosted)})(i)&&(s.ctx._browserIndicator=!0,t++,1===t&&n(),s.ctx.request?.abort&&r.add(s.ctx.request.abort))},htmx_finally_request:(e,i)=>{i.ctx._browserIndicator&&(i.ctx.request?.abort&&r.delete(i.ctx.request.abort),0!==t&&(t--,0===t&&s()))}})})(),(()=>{let e;function t(t,r,i){return(async()=>{let n=+r.headers.get("Content-Length")||null;e.triggerHtmxEvent(t,"htmx:download:start",{total:n});let s=r.body.getReader(),o=[],a=0;for(;;){let{done:r,value:i}=await s.read();if(r)break;o.push(i),a+=i.length,e.triggerHtmxEvent(t,"htmx:download:progress",{loaded:a,total:n,percent:n?Math.round(a/n*100):null})}let l=new Blob(o,{type:r.headers.get("Content-Type")||"application/octet-stream"}),c=function(e,t){let r=e.get("Content-Disposition");if(r){let e=r.match(/filename\*?=['"]?(?:UTF-8'')?([^'";]+)/i);if(e)return decodeURIComponent(e[1])}return t.split("/").pop().split("?")[0]||"download"}(r.headers,i),h=URL.createObjectURL(l);Object.assign(document.createElement("a"),{href:h,download:c}).click(),URL.revokeObjectURL(h),e.triggerHtmxEvent(t,"htmx:download:complete",{filename:c,size:l.size})})()}htmx.registerExtension("download",{init:t=>{e=t},htmx_before_response:(e,{ctx:r})=>{let i=r.response.headers.get("HX-Download");if(i)return void(async()=>{t(r.sourceElement,await fetch(i),i)})();let n=r.response.headers.get("Content-Disposition");return"download"===r.swap||n?.includes("attachment")?(clearTimeout(r.requestTimeout),r.extensionPromise=t(r.sourceElement,r.response.raw,r.request.action),!1):void 0}})})(),(()=>{let e;function t(e){if(e.pendingDiv){e.pendingDiv.remove();for(let t of e.pendingHidden)t.style.display=""}}htmx.registerExtension("hx-pending",{init:t=>{e=t},htmx_config_request:(e,t)=>{let r=t.ctx.request.body;r?.entries&&(t.ctx.pendingBody=r)},htmx_before_request:(t,r)=>{!function(t){if(t.pending=e.attributeValue(t.sourceElement,"hx-pending"),!t.pending)return;let r=document.querySelector(t.pending);if(!r)return;let i=t.target;if("string"==typeof i&&(i=document.querySelector(i)),!i)return;let n=document.createElement("div");n.style.cssText="all: initial",n.classList.add("hx-pending");let s=r instanceof HTMLTemplateElement?r.content.childNodes:r.childNodes;for(let e of s)n.appendChild(e.cloneNode(!0));if(t.pendingBody){let e=new Set(t.pendingBody.keys());for(let r of e){let e=t.pendingBody.getAll(r).filter(e=>"string"==typeof e);if(!e.length)continue;let i=1===e.length?e[0]:JSON.stringify(e);try{n.dataset[r]=i}catch(e){try{n.setAttribute("data-"+r,i)}catch(e){}}}}let o="before"===(a=t.swap)?"beforebegin":"after"===a?"afterend":"prepend"===a?"afterbegin":"append"===a?"beforeend":a;var a;if(t.pendingHidden=[],"innerHTML"===o){for(let e of i.children)e.style.display="none",t.pendingHidden.push(e);i.appendChild(n)}else["beforebegin","afterbegin","beforeend","afterend"].includes(o)?i.insertAdjacentElement(o,n):(i.style.display="none",t.pendingHidden.push(i),i.after(n));t.pendingDiv=n,htmx.process(n)}(r.ctx)},htmx_error:(e,r)=>{t(r.ctx)},htmx_before_swap:(e,r)=>{t(r.ctx)}})})(),(()=>{let e;htmx.registerExtension("hx-targets",{init:t=>{e=t},htmx_before_swap:(t,r)=>{let{ctx:i,tasks:n}=r,s=e.attributeValue(i.sourceElement,"hx-targets");if(!s)return;let o=htmx.findAll(i.sourceElement,s);if(!o.length)return void console.warn(`htmx: '${s}' on hx-targets did not match any elements`,{selector:s});let a=n.findIndex(e=>"main"===e.type);if(-1===a)return;let l=n[a],c=Array.from(o).map(e=>({...l,fragment:l.fragment.cloneNode(!0),target:e}));n.splice(a,1,...c)}})})(),(()=>{let e,t=new Set,r=!1,i=Symbol(),n=null,s=null,o=null,a=0,l=!1;const c={childList:!0,subtree:!0,attributes:!0,characterData:!0};let h=null;function u(){r||a>0||(r=!0,queueMicrotask(()=>{n?.disconnect();let e=performance.now();t.forEach(e=>e());let i=performance.now()-e;!l&&i>16&&(console.warn(`htmx: hx-live expressions took ${i.toFixed(1)}ms.`),l=!0),0===t.size?n&&(clearTimeout(h),h=null,document.removeEventListener("input",o,!0),o=null,document.removeEventListener("change",s,!0),n.disconnect(),n=null,s=null,l=!1):n.observe(document.documentElement,c),r=!1}))}let d=new Set("disabled required readonly open inert multiple autofocus novalidate default reversed loop muted controls autoplay playsinline formnovalidate async defer ismap typemustmatch allowfullscreen itemscope nomodule alpha headingreset".split(" ")),f=new Set("checked value selected hidden".split(" ")),m=new Set("contenteditable draggable spellcheck writingsuggestions".split(" ")),p=new Set("tabindex colspan rowspan maxlength minlength size span start rows cols width height min max step low high optimum".split(" "));function g(e,t){return e instanceof HTMLElement?t.toLowerCase():t}function x(e,t){if((t=g(e,t)).startsWith("aria-"))return function(e,t){let r=e?.getAttribute("aria-"+t);return null==r?void 0:O.has(t)?r:N.has(t)?r.trim()?r.trim().split(/\s+/):[]:q(r)}(e,t.slice(5));if(t.startsWith("data-"))return function(e,t){let r=e.getAttribute(t);return null===r?void 0:q(r)}(e,t);if("value"===t&&("number"===e.type||"range"===e.type))return""===e.value?null:e.valueAsNumber;if(f.has(t))return e[t];if(d.has(t)||t.startsWith("shadowroot")&&"shadowrootmode"!==t&&"shadowrootslotassignment"!==t)return e.hasAttribute(t);let r=e.getAttribute(t);if(null!=r&&m.has(t))try{return JSON.parse(r.toLowerCase())}catch{}return p.has(t)&&r?.trim()&&isFinite(r)?+r:r}function b(e,t,r){if(t=g(e,t),"function"==typeof r&&(r=r(x(e,t)),"function"==typeof r?.then))throw new TypeError("hx-live: assignment returned a promise");t.startsWith("aria-")?function(e,t,r){let i="aria-"+t;null==r?e.removeAttribute(i):e.setAttribute(i,N.has(t)&&Array.isArray(r)?r.join(" "):String(r))}(e,t.slice(5),r):t.startsWith("data-")?function(e,t,r){void 0===r?e.removeAttribute(t):e.setAttribute(t,"object"==typeof r||q(r)!==r?JSON.stringify(r):r)}(e,t,r):f.has(t)?function(e,t,r){if("checked"===t||"selected"===t){let i=!!r;e[t]=i,e.toggleAttribute(t,i)}else!1===r||null==r?(e[t]="boolean"!=typeof e[t]&&"",e.removeAttribute(t)):!0===r?(e[t]=!0,e.setAttribute(t,"")):(e[t]=r,e.setAttribute(t,String(r)))}(e,t,r):d.has(t)||t.startsWith("shadowroot")&&"shadowrootmode"!==t&&"shadowrootslotassignment"!==t?e.toggleAttribute(t,!!r):null==r?e.removeAttribute(t):e.setAttribute(t,String(r))}function y(e,t){return t?new Set(e.map(t)):e}function v(e,t){let r=e.prefix;return r+("data-"===r?C(t):r?t.toLowerCase():t)}function w(e,t,r){if(!e.cascades)return e.prefix?t.hasAttribute(r)&&t:t;for(;t&&!t.hasAttribute(r);)t=t.parentElement;return t}function S(e,t,r,i){if("string"!=typeof t)return!1;let n=v(e,t);return y(e.elts,e.cascades&&(t=>w(e,t,n)||!i&&t)).forEach(e=>e&&b(e,n,r)),!0}let E={get:(e,t)=>{if(!e.prefix&&"class"===t)return e.scope.class;if("string"!=typeof t)return;let r=v(e,t),i=e.elts[0]&&w(e,e.elts[0],r);return i?x(i,r):void 0},set:(e,t,r)=>S(e,t,r),deleteProperty:(e,t)=>S(e,t,void 0,!0),has:(e,t)=>"data-"===e.prefix&&"string"==typeof t&&!!e.elts[0]&&!!w(e,e.elts[0],v(e,t)),ownKeys:e=>{if("data-"!==e.prefix)return[];let t=[],r=new Set;for(let i=e.elts[0];i;i=e.cascades?i.parentElement:null)for(let e of Object.keys(i.dataset))"htmxPowered"===e||r.has(e)||(r.add(e),t.push(e));return t},getOwnPropertyDescriptor:(e,t)=>{if("data-"===e.prefix&&"string"==typeof t&&"htmxPowered"!==t)return e.elts[0]&&w(e,e.elts[0],v(e,t))?{enumerable:!0,configurable:!0}:void 0}};function A(e,t,r,i=""){return new Proxy({elts:e,cascades:t,scope:r,prefix:i},E)}function C(e){return e.replace(/[A-Z]/g,e=>"-"+e.toLowerCase())}function q(e){try{return JSON.parse(e)}catch{return e}}let T=/(['"`\/])(?:\\.|(?!\1).)*\1|(?t?"`"===t?e.replace(/\$\{((?:[^{}]|\{[^{}]*\})*)\}/g,(e,t)=>"${"+_(t)+"}"):e:"attr.class")}let O=new Set("activedescendant details errormessage keyshortcuts label placeholder roledescription valuetext".split(" ")),N=new Set("controls describedby dropeffect flowto labelledby owns relevant".split(" "));function H(e,t){return!!e?.classList.contains(t)}function k(e,t,r){if("function"==typeof r&&(r=r(H(e,t)),"function"==typeof r?.then))throw new TypeError("hx-live: assignment returned a promise");e.classList.toggle(t,!!r),e.classList.length||e.removeAttribute("class")}function M(e,t){let r,i,n,s,o={get data(){return r||=A(e,t,null,"data-")},get aria(){return i||=A(e,t,null,"aria-")},get class(){return n||=function(e,t=!1){let r=e[0],i=(e,r)=>t?e.closest("."+CSS.escape(r)):e,n=e=>H(r&&i(r,e),e),s=(t,r)=>y(e,e=>i(e,t)||e).forEach(e=>k(e,t,r)),o={assign(t){t&&"object"==typeof t&&!Array.isArray(t)?P(s,t):console.warn("hx-live: class.assign expects an object.",{elts:e})},add:(...e)=>e.forEach(e=>s(e,!0)),remove:(...e)=>e.forEach(e=>s(e,!1)),contains:n,toggle(e,t){let r=t??!n(e);return s(e,e=>t??!e),r},replace(r,i){if(t)return!!n(r)&&(s(r,!1),s(i,!0),!0);let o;for(let t=0;t{if("string"==typeof i&&o[i])return o[i];let s=!t&&r?.classList;if(s&&i in s){let e=s[i];return"function"==typeof e?e.bind(s):e}return r?"string"==typeof i?n(i):void 0:i===Symbol.iterator?()=>[][Symbol.iterator]():void 0},set:(r,i,n)=>{if("string"!=typeof i)return!1;if(t||"value"!==i)s(i,n);else for(let t of e)t.classList.value=n;return!0},deleteProperty:(e,t)=>"string"==typeof t&&(s(t,!1),!0),has:(e,t)=>"string"==typeof t&&n(t),ownKeys:()=>!t&&r?[...r.classList]:[],getOwnPropertyDescriptor:(e,r)=>!t&&n(r)?{enumerable:!0,configurable:!0}:void 0})}(e,t)},get attr(){return s||=A(e,t,o)}};return o}function I(e){let t;return new Proxy(function(){},{apply:(t,r,[i])=>{let n=new Set;for(let t of e){let e=t.closest?.(i);e&&n.add(e)}return X([...n])},get:(r,i)=>(t||=M(e,!0))[i]})}function L(t,r,i){"class"===r?function(t,r){let i=e.htmxProp(t),n=i.liveClasses||new Set,s=new Set(P((e,r)=>k(t,e,r),r));for(let e of n)s.has(e)||k(t,e,!1);i.liveClasses=s}(t,i):k(t,r.slice(1),i)}function P(e,t){let r=[];if("string"==typeof t&&(t={[t]:!0}),t&&"object"==typeof t)for(let[i,n]of Object.entries(t))for(let t of i.trim().split(/\s+/).filter(Boolean))r.push(t),e(t,!!n);return r}function D(e,t,r){let i=t.startsWith("."),n=i?t.slice(1):t,s=t.startsWith("aria-"),o=i?"."+n:"["+t+"]",a=null==r?e[0]?.parentElement:r.nodeType?r:null,l=a?[a,...a.querySelectorAll(o)]:e.length?document.querySelectorAll("string"==typeof r?r:r?.from||o):[],c=new Set(e);for(let e of l)c.has(e)||(i?(e.classList?.remove(n),0===e.classList?.length&&e.removeAttribute("class")):s?e.setAttribute(t,"false"):e.removeAttribute(t));for(let r of e)i?r.classList?.add(n):s?r.setAttribute(t,"true"):r.setAttribute(t,"")}function j(e,...t){let r=e||document;for(let e of t)e?.addEventListener&&(r=e);return new Promise(e=>{let i=[],n=!1,s=t=>{if(!n){n=!0;for(let e of i)e();e(t)}};for(let e of t){if(null==e||e?.addEventListener)continue;let t="number"==typeof e?e:"string"==typeof e?htmx.parseInterval(e):void 0;if(t>0){let r=setTimeout(()=>s(e),t);i.push(()=>clearTimeout(r))}else"string"==typeof e&&(r.addEventListener(e,s,{once:!0}),i.push(()=>r.removeEventListener(e,s)))}})}function V(e,t,...r){let i=t.startsWith("."),n=i?t.slice(1):t,s=t.startsWith("aria-"),o=r.length>1?r:r[0];if("string"==typeof o&&(o=o.split("|").map(e=>e.trim())),o)if(i){let t=o.findIndex(t=>t&&e.classList.contains(t));t>=0&&e.classList.remove(o[t]);let r=o[(t+1)%o.length];r&&e.classList.add(r)}else{let r=o.indexOf(x(e,t)??""),i=o[(r+1)%o.length];b(e,t,""===i?void 0:i)}else if(i)e.classList.toggle(n);else if(s){let r=e.getAttribute(t);e.setAttribute(t,"true"===r?"false":"true")}else e.toggleAttribute(t)}function R(){let e=new Map;return(t,r)=>{let n=(s=r?r.toString():null,e.get(s)||(e.set(s,{last:0,reject:null}),e.get(s)));var s;n.reject?.(i),n.reject=null;let o=++n.last;if(!r)return new Promise((e,r)=>{n.reject=r,setTimeout(()=>{o===n.last&&(n.reject=null,e())},t)});setTimeout(()=>o===n.last&&r(),t)}}function W(t){let r=e.htmxProp(t);return r.debounce||(r.debounce=R())}function $(e,t=document){return r=>{if("string"!=typeof r)return X(r?.nodeType?[r]:[...r||[]]);let i=r,n=i.match(/^(.+)\s+in\s+(.+)$/),s=[t];if(n&&(i=n[1],s="this"===n[2]||"me"===n[2]?[e]:[...document.querySelectorAll(n[2])]),!s.length)return X([]);let o,a=e=>{if(1===s.length)return[...s[0].querySelectorAll(e)];let t=[],r=new Set;for(let i of s)for(let n of i.querySelectorAll(e))r.has(n)||(r.add(n),t.push(n));return t.sort((e,t)=>4&e.compareDocumentPosition(t)?-1:1)},l=i.match(/^(next|previous|closest|first|last)\s+(.+)$/);if(l){let[,t,r]=l,i=t=>e.compareDocumentPosition(t);if("closest"===t){let t=e.closest?.(r);o=t?[t]:[]}else{let e=a(r);if("first"===t)o=e.slice(0,1);else if("last"===t)o=e.slice(-1);else if("next"===t){let t=e.find(e=>4&i(e));o=t?[t]:[]}else{let t=e.reverse().find(e=>2&i(e));o=t?[t]:[]}}}else o=a(i);return X(o)}}let B="map filter reduce reduceRight forEach some every find findIndex findLast findLastIndex flatMap flat slice indexOf lastIndexOf includes join at".split(" "),F={before:"beforebegin",after:"afterend",start:"afterbegin",end:"beforeend"};function z(e,t,r){let i=e.parentElement;"into"===t?e.innerHTML=r:"replace"===t?e.outerHTML=r:e.insertAdjacentHTML(F[t],r),htmx.process(i)}let U,J,Q,G=()=>{};function X(e){let t,r,i=new Proxy({},{get:(n,s)=>{if("count"===s)return e.length;if("arr"===s)return()=>e.slice();if(s===Symbol.iterator)return()=>e.values();if("q"===s)return t=>{let r=new Set;for(let i of e)for(let e of $(i,i)(t).arr())r.add(e);return X([...r])};if("trigger"===s)return(t,r,n)=>(e.forEach(e=>htmx.trigger(e,t,r,n)),i);if("insert"===s)return(t,r)=>(e.forEach(e=>z(e,t,r)),i);if("take"===s)return(t,r)=>(D(e,t,r),i);if("toggle"===s)return(t,...r)=>(e.forEach(e=>V(e,t,...r)),i);if("attr"===s||"class"===s||"aria"===s)return(t||=M(e,!1))[s];if("data"===s)return(r||=I(e)).data;if("local"===s)return t||=M(e,!1);if("closest"===s)return r||=I(e);if(B.includes(s))return e[s].bind(e);if(!e.length)return"function"==typeof function(e){for(let t=HTMLElement.prototype;t;t=Object.getPrototypeOf(t)){let r=Object.getOwnPropertyDescriptor(t,e);if(r)return r}}(s)?.value?G:void 0;let o=e[0]?.[s];return"function"==typeof o?(...t)=>e.map(e=>e[s](...t))[0]:o&&"object"==typeof o?X(e.map(e=>e[s])):o},set:(t,r,i)=>(e.forEach(e=>{let t=e[r];if(null==t||"function"==typeof t)e[r]=i;else if("function"==typeof i){let n=i(t);if("function"==typeof n?.then)throw new TypeError("hx-live: assignment returned a promise");e[r]=n}else e[r]=i}),u(),!0)});return i}function K(){let e=htmx.config.metaCharacter||":",t=htmx.config.prefix;J=["hx-live"+e],t&&J.push(t+"live"+e);let r=htmx.config.live?.bindPrefix;void 0===r&&(window.Alpine?(r="",console.warn("hx-live: Alpine detected; set config.live.bindPrefix.")):r=":"),r&&J.push(r),Q=["hx-live"],t&&Q.push(t+"live");let i=J.map(e=>`starts-with(name(), "${e}")`).join(" or "),n=Q.map(e=>`@${e}`).join(" or ");U=(new XPathEvaluator).createExpression(`.//*[@*[${i}] or ${n}]`)}function Y(e){for(let t of J)if(e.startsWith(t)&&e.length>t.length)return e.slice(t.length)}function Z(e){let r=e._htmx;if(r?.liveRuns){for(let e of r.liveRuns)t.delete(e);delete r.liveRuns,delete r.effectRegistered,delete r.bindings}}function ee(t){if(t.closest("[hx-ignore]"))return;let r=e.htmxProp(t);if(!r.effectRegistered){let e=Q.find(e=>t.hasAttribute(e));e&&(r.effectRegistered=!0,te(t,t.getAttribute(e)))}r.bindings||=new Set;for(let e of t.attributes){let i=Y(e.name);i&&!r.bindings.has(i)&&(r.bindings.add(i),te(t,e.value,i))}}function te(r,a,l){!function(){if(n)return;s=()=>u();let e=htmx.parseInterval(htmx.config.live?.inputDebounce??100)??100;o=()=>{clearTimeout(h),h=setTimeout(u,e)},document.addEventListener("input",o,!0),document.addEventListener("change",s,!0),n=new MutationObserver(s),n.observe(document.documentElement,c)}();let d,f=void 0!==l,m=W(r),p=/\bawait\b/.test(a),g=!f&&p,y=!f||p,v=!1,w=async()=>{if(r.isConnected){if(!g||!v){v=g;try{d||=e.executeJavaScript(r,{debounce:m},a,f,y,!0);let t=y?await d():d();f&&(!function(t,r,i){if("function"==typeof i)throw new TypeError("hx-live: binding returned a function");if("text"===r){let e=null==i?"":String(i);return void(t.textContent!==e&&(t.textContent=e))}if("html"===r){let e=null==i?"":String(i);return void(t.innerHTML!==e&&(t.innerHTML=e))}if("style"===r)return void function(t,r){let i=e.htmxProp(t),n=i.liveStyles||new Set,s=[];if("string"==typeof r)for(let e of r.split(";")){let t=e.indexOf(":");if(t<0)continue;let r=e.slice(0,t).trim(),i=e.slice(t+1).trim();r&&s.push([r,i])}else if(r&&"object"==typeof r)for(let[e,t]of Object.entries(r))s.push([C(e),null==t||""===t?null:String(t)]);let o=new Set(s.map(([e])=>e));for(let e of n)o.has(e)||t.style.removeProperty(e);for(let[e,r]of s)null==r?t.style.removeProperty(e):t.style.setProperty(e,r);0===t.style.length&&t.removeAttribute("style"),i.liveStyles=o}(t,i);if("class"===r||r.startsWith("."))return void L(t,r,i);if(x(t,r)===i)return;b(t,r,i)}(r,l,t),y&&n?.takeRecords())}catch(e){e!==i&&console.error("hx-live expression failed",e,f?{elt:r,attr:l}:{elt:r})}finally{g&&queueMicrotask(()=>v=!1)}}}else t.delete(w)};t.add(w);let S=e.htmxProp(r);S.liveRuns=S.liveRuns||new Set,S.liveRuns.add(w),w()}htmx.live={q:e=>$(document.documentElement)(e),debounce:R(),refresh:()=>u(),take:(e,t,r)=>D(htmx.live.q(e).arr(),t,r),toggle:(e,t,...r)=>htmx.live.q(e).forEach(e=>V(e,t,...r)),forEvent:(...e)=>j(null,...e),nextFrame:()=>new Promise(e=>requestAnimationFrame(e))},htmx.live.$=htmx.live.q,htmx.registerExtension("hx-live",{init:t=>{e=t},htmx_before_cleanup:e=>{Z(e)},htmx_before_morph_attr:(e,t)=>{U||K(),J.some(e=>t.attrName.startsWith(e))&&Z(e)},htmx_after_process:e=>{!function(e){U||K(),1===e.nodeType&&ee(e);let t,r=U.evaluate(e),i=[];for(;t=r.iterateNext();)i.push(t);for(t of i)ee(t)}(e)},htmx_before_swap:()=>{a++},htmx_finally_swap:()=>{0===--a&&t.size>0&&u()},htmx_scope:(t,r)=>{let i=e.htmxProp(t);Object.assign(r.scope,i.liveScope||=function(e){let t=M([e],!1),r=I([e]);return{q:$(e),forEvent:(...t)=>j(e,...t),nextFrame:()=>new Promise(e=>requestAnimationFrame(e)),trigger:(t,r,i)=>htmx.trigger(e,t,r,i),debounce:W(e),take:(t,r)=>D([e],t,r),toggle:(t,...r)=>V(e,t,...r),attr:t.attr,insert:(t,r)=>z(e,t,r),matches:t=>e.matches(t),style:e.style,data:r.data,aria:t.aria,local:t,closest:r}}(t)),r.code=_(r.code),htmx.config.live?.useDollar&&(r.scope.$=r.scope.q)}})})(),(()=>{let e,t=null;const r="htmx-history-index";function i(){return htmx.config.historyCache}function n(e){let t=[e];return htmx.config.prefix&&t.push(e.replaceAll("hx-",htmx.config.prefix)),t.join(",")}function s(){try{return sessionStorage.setItem("__htmx_test__","1"),sessionStorage.removeItem("__htmx_test__"),!0}catch(e){return!1}}function o(){return htmx.find(n("[hx-history-elt]"))||document.body}const a="data-htmx-history-value",l="data-htmx-history-checked",c="data-htmx-history-scroll";function h(){let e=history.state||{htmx:!0},r=e.htmxId;r||(r=crypto.randomUUID?.()??Math.random().toString(36).slice(2),history.replaceState({...e,htmxId:r},"",location.href)),t=r}function u(e){sessionStorage.setItem(r,JSON.stringify(e))}function d(e,t){if(!s()||i().size<=0)return!1;let n=function(){try{return JSON.parse(sessionStorage.getItem(r))||[]}catch{return[]}}().filter(t=>t!==e);for(;n.length>=i().size;)sessionStorage.removeItem("htmx-history-"+n.shift());let o=JSON.stringify(t);for(;;)try{return sessionStorage.setItem("htmx-history-"+e,o),n.push(e),u(n),!0}catch(e){if(0===n.length)return!1;sessionStorage.removeItem("htmx-history-"+n.shift())}}function f(r){if(!(r=r||t))return;if(htmx.find(n('[hx-history="false"]')))return;let i=o();var s;(s=i).querySelectorAll("input, textarea, select").forEach(e=>{let t=e.type?.toLowerCase();if("file"!==t&&"password"!==t)if("checkbox"===t||"radio"===t)e.checked&&e.setAttribute(l,"1");else if("SELECT"===e.tagName&&e.multiple){let t=Array.from(e.options).filter(e=>e.selected).map(e=>e.value);t.length&&e.setAttribute(a,JSON.stringify(t))}else e.value&&e.setAttribute(a,e.value)}),s.querySelectorAll("*").forEach(e=>{(e.scrollTop>0||e.scrollLeft>0)&&e.setAttribute(c,`${e.scrollTop},${e.scrollLeft}`)});let h=document.head.outerHTML,u=window.scrollY,f=document.title,m={target:i,head:h};if(!1===e.triggerHtmxEvent(document,"htmx:history:cache:before:save",m))return;let p=function(e){let t=e.cloneNode(!0);return t.querySelectorAll(".htmx-request").forEach(e=>e.classList.remove("htmx-request")),t.querySelectorAll("[disabled][data-disabled-by-htmx]").forEach(e=>{e.removeAttribute("disabled"),e.removeAttribute("data-disabled-by-htmx")}),t.outerHTML}(i);h=m.head,d(r,{content:p,head:h,scroll:u,title:f}),e.triggerHtmxEvent(document,"htmx:history:cache:after:save",{content:p,head:h,scroll:u,title:f})}function m(){let e=history.state?.htmxId;return e&&s()?function(e){try{return JSON.parse(sessionStorage.getItem("htmx-history-"+e))}catch{return null}}(e):null}async function p(t){let r={head:t.head,ready:null};e.triggerHtmxEvent(document,"htmx:history:cache:before:restore",r),r.ready&&await r.ready;let n=t.content,s=o(),h=i().swapStyle,u={sourceElement:document.body,target:s,swap:h,text:n,transition:!1};await htmx.swap(u),document.title=t.title||document.title,requestAnimationFrame(()=>{var i;window.scrollTo(0,t.scroll||0),(i=o()).querySelectorAll(`[${l}]`).forEach(e=>{e.checked=!0,e.removeAttribute(l)}),i.querySelectorAll(`[${a}]`).forEach(e=>{let t=e.getAttribute(a);if("SELECT"===e.tagName&&e.multiple){let r=JSON.parse(t);Array.from(e.options).forEach(e=>{e.selected=r.includes(e.value)})}else e.value=t;e.removeAttribute(a)}),i.querySelectorAll(`[${c}]`).forEach(e=>{let[t,r]=e.getAttribute(c).split(",").map(Number);e.scrollTop=t,e.scrollLeft=r,e.removeAttribute(c)}),r.item=t,e.triggerHtmxEvent(document,"htmx:history:cache:after:restore",r)})}htmx.registerExtension("history-cache",{init:t=>{e=t,htmx.config.historyCache??={},htmx.config.historyCache.size??=10,htmx.config.historyCache.refreshOnMiss??=!1,htmx.config.historyCache.disable??=!1,htmx.config.historyCache.swapStyle??="outerSync",h()},htmx_before_history_update:(e,t)=>{i().disable||(h(),f())},htmx_after_history_update:()=>{i().disable||h()},htmx_before_history_restore:(r,n)=>{if(i().disable)return;let s=t,o=history.state?.htmxId;s&&s!==o&&f(s),o?t=o:h();let a=m();if(!a){let t={path:n.path,refreshOnMiss:i().refreshOnMiss};return e.triggerHtmxEvent(document,"htmx:history:cache:miss",t),t.refreshOnMiss?(location.reload(),!1):void 0}let l={path:n.path,item:a};return!1!==e.triggerHtmxEvent(document,"htmx:history:cache:hit",l)?(n.cancelled=!0,p(l.item),!1):void 0}})})(),(()=>{let e;htmx.registerExtension("upsert",{init:t=>{e=t},htmx_process_upsert:(t,r)=>{let{ctx:i,tasks:n}=r,s={style:"upsert"},o=t.getAttribute("key"),a=t.getAttribute("sort"),l=t.hasAttribute("prepend");o&&(s.key=o),null!==a&&(s.sort=a||!0),l&&(s.prepend=!0),n.push({type:"partial",fragment:t.content.cloneNode(!0),target:e.attributeValue(t,"hx-target"),swapSpec:s,sourceElement:i.sourceElement})},handle_swap:(e,t,r,i)=>{if("upsert"===e){let e=i.key||"id",n="desc"===i.sort,s=t.firstChild,o=t=>t.getAttribute(e)||t.id,a=(e,t)=>{let r=e.localeCompare(t,void 0,{numeric:!0});return n?-r:r};for(let e of Array.from(r.children)){let r=e.id;if(r){let t=document.getElementById(r);if(t){t.replaceWith(e);continue}}let n=o(e);if(!n){i.prepend?t.insertBefore(e,s):t.appendChild(e);continue}let l=!1;for(let r of t.children){let i=o(r);if(i&&a(n,i)<0){t.insertBefore(e,r),l=!0;break}}l||t.appendChild(e)}return!0}return!1}})})(),(()=>{let e,t=0;function r(){t>0&&t--,0===t&&window.Alpine?.flushAndStopDeferringMutations&&window.Alpine.flushAndStopDeferringMutations()}htmx.registerExtension("alpine-compat",{init:t=>{e=t;let r=e.isSoftMatch;e.isSoftMatch=function(e,t){return e._x_bindings?.id&&t.matches?.("[\\:id], [x-bind\\:id]")?e instanceof Element&&e.tagName===t.tagName:r(e,t)}},htmx_before_swap:(e,r)=>{if(!window.Alpine?.closestDataStack||!window.Alpine?.cloneNode||!window.Alpine?.deferMutations)return;0===t&&window.Alpine.deferMutations(),t++;let{tasks:i}=r;for(let e of i)if("innerMorph"===e.swapSpec.style||"outerMorph"===e.swapSpec.style){if(!e.fragment||!e.target)continue;if(!("string"==typeof e.target?document.querySelector(e.target):e.target))continue}},htmx_before_morph_node:(t,r)=>{if(!window.Alpine?.closestDataStack||!window.Alpine?.cloneNode)return;let{oldNode:i,newNode:n}=r,s=window.Alpine.closestDataStack(i);if(n._x_dataStack=s,i.isConnected&&(window.Alpine.cloneNode(i,n),i._x_teleport&&n._x_teleport)){let t=document.createDocumentFragment();t.append(n._x_teleport),e.morph(i._x_teleport,t,!1)}},htmx_history_cache_before_save:(e,t)=>{window.Alpine?.destroyTree&&(t.target.querySelectorAll("[x-data]").forEach(e=>{e._x_dataStack&&e.setAttribute("data-alpine-state",JSON.stringify(e._x_dataStack[0]))}),window.Alpine.destroyTree(t.target))},htmx_history_cache_after_restore:(e,t)=>{window.Alpine&&document.querySelectorAll("[data-alpine-state]").forEach(e=>{let t=JSON.parse(e.getAttribute("data-alpine-state"));if(e.removeAttribute("data-alpine-state"),e._x_dataStack)for(let r in t)try{e._x_dataStack[0][r]=t[r]}catch{}})},htmx_after_swap:(e,t)=>{t.ctx._alpineFlushed=!0,r()},htmx_finally_request:(e,t)=>{t.ctx._alpineFlushed||r()}})})(); \ No newline at end of file diff --git a/src/Common/wwwroot/htmx.min.js b/src/Common/wwwroot/htmx.min.js index 1786708..6e099f1 100644 --- a/src/Common/wwwroot/htmx.min.js +++ b/src/Common/wwwroot/htmx.min.js @@ -1 +1 @@ -var htmx=(()=>{const e={parse(t){if(!t)return{};if(t.startsWith("{"))return JSON.parse(t);let r=/(?:"([^"]+)"|'([^']+)'|([^\s,:]+))(?:\s*:\s*(?:"([^"]*)"|'([^']*)'|<((?:[^/]|\/(?!>))+)\/>|([^\s,]+)))?(?=\s|,|$)/g,i={};for(let s of t.matchAll(r)){let[,t,r,n,o,a,l,h]=s,c=t??r??n,u=(o??a??l??h??"true").trim();try{u=JSON.parse(u)}catch{}let d=n?.includes("."),f=d?c.split(".").reduceRight((e,t)=>({[t]:e}),u):{[c]:u};e.merge(f,i)}return i},split:e=>e.split(/,(?![^\[]*\])(?![^(]*\))(?![^<]*\/>)(?=(?:[^"']|"[^"]*"|'[^']*')*$)/),merge(t,r){"string"==typeof t&&(t=e.parse(t));for(let[i,s]of Object.entries(t)){if(["__proto__","constructor","prototype"].includes(i))continue;let t=s&&"object"==typeof s&&!Array.isArray(s),n=r[i]&&"object"==typeof r[i]&&!Array.isArray(r[i]);t&&n?e.merge(s,r[i]):r[i]=s}return r}};class t{#e=null;#t=[];issue(e,t){return e.queueStrategy=t,this.#e?"replace"===t||"abort"!==t&&"abort"===this.#e.queueStrategy?(this.#t.forEach(e=>e.status="dropped"),this.#t=[],this.#e.request?.abort?.(),this.#e=e,!0):("queue all"===t?(this.#t.push(e),e.status="queued"):"drop"===t?e.status="dropped":"queue last"===t?(this.#t.forEach(e=>e.status="dropped"),this.#t=[e],e.status="queued"):0===this.#t.length&&"abort"!==t?(this.#t.push(e),e.status="queued"):e.status="dropped",!1):(this.#e=e,!0)}finish(){this.#e=null}next(){return this.#t.shift()}abort(){this.#e?.request?.abort?.()}more(){return this.#t?.length}}return new class{#r=e;#i=new Map;#s="";#n=new Set;#o;#a=Function;#l=Object.getPrototypeOf(async function(){}).constructor;#h={createHTML:e=>e,createScript:e=>e};#c;#u="a,form";#d=["get","post","put","patch","delete"];#f;#m;#p;#g;constructor(){this.#x(),this.#b(),this.#c=this.#y("[hx-action],[hx-get],[hx-post],[hx-put],[hx-patch],[hx-delete]"),this.#f=(new XPathEvaluator).createExpression(`.//*[@*[${this.#S("hx-on").map(e=>`starts-with(name(), "${e}")`).join(" or ")}]]`),this.#o={attributeValue:this.#v.bind(this),parseTriggerSpecs:this.#E.bind(this),determineMethodAndAction:this.#w.bind(this),createRequestContext:this.#A.bind(this),collectFormData:this.#T.bind(this),getAttributeObject:this.#q.bind(this),insertContent:this.#C.bind(this),morph:this.#N.bind(this),isSoftMatch:this.#M.bind(this),initSecurity:(e,t,r)=>{e&&(this.#h=e),t&&(this.#a=t),r&&(this.#l=r)},onTrigger:this.#I.bind(this),htmxProp:this.#H.bind(this),triggerHtmxEvent:this.#O.bind(this),executeJavaScript:this.#L.bind(this)};let e=()=>{this.#k(),this.process(document.body)};"loading"===document.readyState?document.addEventListener("DOMContentLoaded",e):setTimeout(e)}#x(){this.version="4.0.0-beta5",this.config={logAll:!1,prefix:"data-hx-",transitions:!1,history:!0,mode:"same-origin",defaultSwap:"innerHTML",defaultFocusScroll:!1,indicatorClass:"htmx-indicator",requestClass:"htmx-request",includeIndicatorCSS:!0,defaultTimeout:6e4,extensions:"",morphIgnore:["data-htmx-powered"],morphSkip:"[hx-morph-skip]",morphSkipChildren:"[hx-morph-skip-children]",morphScanLimit:10,noSwap:[204,304],implicitInheritance:!1,defaultSettleDelay:1};let t=document.querySelector('meta[name="htmx-config"]');t&&e.merge(t.content,this.config),this.#s=this.config.extensions}#b(){if(!1!==this.config.includeIndicatorCSS){let e=this.config.indicatorClass,t=this.config.requestClass,r=new CSSStyleSheet;r.replaceSync(`.${e}{opacity:0;visibility: hidden} .${t} .${e}, .${t}.${e}{opacity:1;visibility: visible;transition: opacity 200ms ease-in}`),document.adoptedStyleSheets=[...document.adoptedStyleSheets,r]}}registerExtension(e,t){return!(this.#s&&!this.#s.split(/,\s*/).includes(e))&&(!this.#n.has(e)&&(this.#n.add(e),t.init&&t.init(this.#o),void Object.entries(t).forEach(([e,t])=>{this.#i.get(e)?.push(t)||this.#i.set(e,[t])})))}#V(e){let t=this.config.prefix;return!e.closest||null!=e.closest("[hx-ignore]")||t&&null!=e.closest(`[${t}ignore]`)}#P(e,t){let r=this.config.prefix;return e.getAttribute(t)??(r?e.getAttribute(t.replace("hx-",r)):null)}#R(e,t){let r=this.config.prefix&&t.replace("hx-",this.config.prefix);return e.hasAttribute(t)?t:r&&e.hasAttribute(r)?r:null}#y(e){return this.#S(e).join(",")}#S(e){let t=[e];return this.config.prefix&&t.push(e.replaceAll("hx-",this.config.prefix)),t}#j(e,t){let r=[...e.querySelectorAll?.(t)??[]];return e.matches?.(t)&&r.unshift(e),r}#B(e){return"before"===e?"beforebegin":"after"===e?"afterend":"prepend"===e?"afterbegin":"append"===e?"beforeend":e}#F(e,t){let r=[];return this.#v(e,t,void 0,(e,t)=>{e?.split(/\s*[,:]\s*/).includes("this")&&r.push(t)}),r}#v(e,t,r,i){t=this.#$(t);let s=this.#$(":inherited"),n=this.#$(":append"),o=this.#P(e,t)??this.#P(e,t+s);if(null!=o)return i?i(o,e):o;let a=CSS.escape(this.config.implicitInheritance?t:t+s),l=CSS.escape(t+s+n),h=this.#y(`[${a}],[${l}]`),c=this.#R(e,t+n)??this.#R(e,t+s+n);if(c){let r=e.getAttribute(c),s=e.parentNode?.closest?.(h);if(i&&i(r,e),s){let e=this.#v(s,t,void 0,i);return e?(e+","+r).replace(/[{}]/g,""):r}return r}let u=e.parentNode?.closest?.(h);return u?(o=this.#v(u,t,void 0,i),!i&&o&&this.config.implicitInheritance&&this.#_(e,"htmx:after:implicitInheritance",{elt:e,name:t,parent:u}),o):r}#E(t){return e.split(t).flatMap(t=>{let[,r,i]=t.match(/^\s*(\S+\[[^\]]*\]|\S+)\s*(.*?)\s*$/)??[];if(!r)return[];if(/\[[^\]]*$/.test(r))throw"unterminated:"+r;return[{name:r,...e.parse(i)}]})}#w(e,t){if(this.#D(e))return this.#W(e,t);{let t=this.#v(e,"hx-method")||"GET",r=this.#v(e,"hx-action");if(!r)for(let i of this.#d){let s=this.#v(e,"hx-"+i);if(null!=s){r=s,t=i;break}}return t=t.toUpperCase(),{action:r,method:t}}}#W(e,t){if(e.matches("a"))return{action:e.getAttribute("href"),method:"GET"};return{action:t.submitter?.getAttribute?.("formAction")||e.getAttribute("action"),method:(t.submitter?.getAttribute?.("formMethod")||e.getAttribute("method")||"GET").toUpperCase()}}#H(e){return e._htmx||(e._htmx={listeners:[],triggerSpecs:[]},e.setAttribute("data-htmx-powered","true")),e._htmx}#U(e){return e._htmx_state||={}}#z(e){if(this.#Q(e)&&this.#O(e,"htmx:before:init",{},!0)){let t=this.#H(e);t.initialized=!0,t.eventHandler=this.#J(e),this.#X(e),this.#G(e),this.#O(e,"htmx:after:init",{},!0)}}#J(e){return async t=>{try{let r=this.#A(e,t);await this.#K(r)}catch(t){this.#O(e,"htmx:error",{error:t})}}}#A(t,r){let{action:i,method:s}=this.#w(t,r),[n,o]=(i||"").split("#"),a=new AbortController,l={sourceElement:t,sourceEvent:r,status:"created",select:this.#v(t,"hx-select"),selectOOB:this.#v(t,"hx-select-oob"),target:this.#v(t,"hx-target"),swap:this.#v(t,"hx-swap")??this.config.defaultSwap,push:this.#v(t,"hx-push-url"),replace:this.#v(t,"hx-replace-url"),transition:this.config.transitions,confirm:this.#v(t,"hx-confirm"),request:{validate:"true"===this.#v(t,"hx-validate",!t.matches("form")||t.noValidate||r.submitter?.formNoValidate?"false":"true"),action:n,anchor:o,method:s,headers:this.#Y(t),abort:a.abort.bind(a),credentials:"same-origin",signal:a.signal,mode:this.config.mode}};t._htmx?.boosted&&e.merge(t._htmx.boosted,l),l.target=this.#Z(t,l.target),l.request.headers["HX-Request-Type"]=l.target===document.body||l.select?"full":"partial",l.target&&(l.request.headers["HX-Target"]=this.#ee(l.target));let h=this.#v(t,"hx-config");return h&&(e.merge(h,l.request),l.request.mode=this.config.mode),l}#ee(e){return`${e.tagName.toLowerCase()}${e.id?"#"+encodeURI(e.id):""}`}#Y(e){let t={"HX-Request":"true","HX-Source":this.#ee(e),"HX-Current-URL":location.href,Accept:"text/html"};return this.#D(e)&&(t["HX-Boosted"]="true"),t}#te(e,t){return this.#q(e,"hx-headers",e=>{for(let r in e)t.request.headers[r]=String(e[r])},{ctx:t})}#Z(e,t){return t instanceof Element?t:null!=t?this.#re(e,t,"hx-target"):this.#D(e)?document.body:e}#D(e){return e?._htmx?.boosted}async#K(e){let t=e.sourceElement,r=e.sourceEvent;if(!t.isConnected)return;if(this.#ie(r))return;this.#se(r)&&r.preventDefault();let i=/GET|DELETE/.test(e.request.method),s=i?t.matches("form")?t:null:t.form||t.closest("form"),n=this.#T(t,s,r.submitter,e.request.validate,i);if(!n)return;let o=this.#q(t,"hx-vals",t=>{e.vals=t;for(let e in t)n.set(e,t[e])},{ctx:e});if(o&&await o,e.values)for(let t in e.values)n.delete(t),n.append(t,e.values[t]);let a=this.#te(t,e);if(a&&await a,Object.assign(e.request,{form:s,submitter:r.submitter,body:n}),!this.#O(t,"htmx:config:request",{ctx:e}))return;if(!this.#d.includes(e.request.method.toLowerCase()))return;let l=this.#ne(e.request.action);if(null!=l){let t=Object.fromEntries(e.request.body);return void await this.#L(e.sourceElement,t,l,!1)}if(i){let t=new URL(e.request.action,document.baseURI);for(let r of e.request.body.keys())t.searchParams.delete(r);for(let[r,i]of e.request.body)t.searchParams.append(r,i);t.origin===location.origin?e.request.action=t.pathname+t.search:e.request.action=t.href,e.request.body=null}else"multipart/form-data"!==(this.#v(t,"hx-encoding")??s?.enctype)&&(e.request.body=new URLSearchParams(e.request.body));await this.#oe(e)}async#oe(e){let t=e.sourceElement,r=this.#ae(t),i=this.#le(t);if(!i.issue(e,r))return;e.status="issuing";let s=[],n=[];try{if(e.confirm){if(!await new Promise(r=>{let i={ctx:e,issueRequest:()=>r(!0),dropRequest:()=>r(!1)};if(this.#O(t,"htmx:confirm",i)){let i=this.#ne(e.confirm);r(i?this.#L(t,{ctx:e},i,!0):window.confirm(e.confirm))}}))return}if(this.#he(e),s=this.#ce(t),n=this.#ue(t),e.fetch||=window.fetch.bind(window),!this.#O(t,"htmx:before:request",{ctx:e}))return;let r=await e.fetch(e.request.action,e.request);if(e.response={raw:r,status:r.status,headers:r.headers},this.#de(e),!this.#O(t,"htmx:before:response",{ctx:e}))return;if(e.text=await r.text(),!this.#O(t,"htmx:after:request",{ctx:e}))return;if(e.response.status>=400&&this.#O(t,"htmx:response:error",{ctx:e}),this.#fe(e))return void(e.keepIndicators=!0);"issuing"===e.status&&(e.hx.retarget&&(e.target=e.hx.retarget),e.hx.reswap&&(e.swap=e.hx.reswap),e.hx.reselect&&(e.select=e.hx.reselect),e.status="response received",this.#me(e),await this.swap(e),e.status="swapped")}catch(r){e.status="error: "+r,this.#O(t,"htmx:error",{ctx:e,error:r})}finally{clearTimeout(e.requestTimeout),this.#O(t,"htmx:finally:request",{ctx:e}),e.keepIndicators||(this.#pe(s),this.#ge(n)),i.finish(),i.more()&&this.#oe(i.next())}}#de(e){e.hx={};for(let[t,r]of e.response.raw.headers)t.toLowerCase().startsWith("hx-")&&(e.hx[t.slice(3).toLowerCase().replace(/-/g,"")]=r)}#fe(t){if(t.hx.trigger&&this.#xe(t.hx.trigger,t.sourceElement),"true"===t.hx.refresh)return location.reload(),!0;if(t.hx.redirect)return location.href=t.hx.redirect,!0;if(t.hx.location){let r=t.hx.location,i={};return("{"===r[0]||/[\s,]/.test(r))&&(i=e.parse(r),r=i.path,delete i.path),i.push??="true",this.ajax("GET",r,i),!0}}#he(e){let t=null!=e.request.timeout?this.parseInterval(e.request.timeout):this.config.defaultTimeout;t&&(e.requestTimeout=setTimeout(()=>e.request?.abort?.(),t))}#ae(e){let t=this.#v(e,"hx-sync");if(!t)return"queue first";let r=t.split(":").pop().trim();return/^(drop|abort|replace|queue)/.test(r)?r:"queue first"}#le(e){let r=this.#v(e,"hx-sync"),i=e;if(r){let t=r.includes(":")?r.slice(0,r.lastIndexOf(":")).trim():/^(drop|abort|replace|queue)/.test(r)?null:r;t&&(i=this.#re(e,t,"hx-sync")||e)}return this.#U(i).rq||=new t}#ie(e){return"click"===e.type&&(e.ctrlKey||e.metaKey||e.shiftKey)&&!!e.currentTarget?.closest?.("a[href]")}#se(e){let t=e.currentTarget;if("submit"===e.type&&"FORM"===t?.tagName)return!0;if(!("click"===e.type&&0===e.button))return!1;let r=t?.closest?.('button, input[type="submit"], input[type="image"]'),i=r?.form||r?.closest("form");if(r&&!r.disabled&&i&&("submit"===r.type||"image"===r.type||!r.type&&"BUTTON"===r.tagName))return!0;let s=t?.closest?.("a");if(!s||!s.href)return!1;let n=s.getAttribute("href");return!(n&&n.startsWith("#")&&n.length>1)}#X(e,t=e._htmx.eventHandler){let r=this.#v(e,"hx-trigger");r||(r=e.matches("form")?"submit":e.matches("input:not([type=button]):not([type=submit]),select,textarea")?"change":"click"),this.#I(e,r,t)}#I(e,t,r){let i=this.#E(t);this.#H(e).triggerSpecs.push(...i);for(let t of i){t.listeners=[];let[i,s]=this.#be(t.name),n=[e];"outside"===t.from?n=[document]:t.from&&"self"!==t.from&&(n=this.#ye(e,t.from));let o=e=>{if((t.halt||t.prevent)&&e.preventDefault(),(t.halt||t.stop||t.consume)&&e.stopPropagation(),t.once)for(let e of t.listeners)e.fromElt.removeEventListener(e.eventName,e.handler,e);r(e)},a=o;if(t.delay?a=e=>{clearTimeout(t.timeout),t.timeout=setTimeout(()=>o(e),this.parseInterval(t.delay))}:t.throttle&&(a=e=>{t.throttled?t.throttledEvent=e:(t.throttled=!0,o(e),t.throttleTimeout=setTimeout(()=>{if(t.throttled=!1,t.throttledEvent){let e=t.throttledEvent;t.throttledEvent=null,a(e)}},this.parseInterval(t.throttle)))}),t.handler=r=>{if(("self"!==t.from||r.target===e)&&("outside"!==t.from||!e.contains(r.target))&&(!t.target||r.target?.matches?.(t.target))){if(t.changed){let e=t.values??=new WeakMap,r=!1;for(let t of n)e.get(t)!==t.value&&(r=!0,e.set(t,t.value));if(!r)return}if(s){this.#se(r)&&r.preventDefault();let t={};for(let e in r)t[e]=r[e];if(!this.#L(e,t,s,!0,!1))return}a(r)}},"intersect"===i||"revealed"===i){let r={rootMargin:t.rootMargin};t.root&&(r.root=this.#re(e,t.root)),t.threshold&&(r.threshold=parseFloat(t.threshold));let s="revealed"===i;t.observer=new IntersectionObserver(r=>{for(let i=0;i"name"!==e);t.interval=setInterval(()=>{e.isConnected?this.#O(e,"every",{},!1):clearInterval(t.interval)},this.parseInterval(r))}if("load"!==i)for(let r of n){let s={fromElt:r,eventName:i,handler:t.handler,capture:!!t.capture,passive:!!t.passive};e._htmx.listeners.push(s),t.listeners.push(s),r.addEventListener(i,t.handler,s)}else t.handler(new CustomEvent("load"))}}#be(e){let t=e.match(/^([^\[]*)\[([^\]]*)]/);return t?[t[1],t[2]]:[e,null]}#xe(t,r){if("{"===t[0]){let i=e.parse(t);for(let e in i){let t=i[e],s=r;t?.target&&(s=this.find(t.target)),this.trigger(s,e,"object"==typeof t?t:{value:t})}}else t.split(",").forEach(e=>this.trigger(r,e.trim(),{}))}#Se(e){let t={},r=Object.getPrototypeOf(this);for(let i of Object.getOwnPropertyNames(r))"constructor"!==i&&"function"==typeof this[i]&&(["find","findAll"].includes(i)?t[i]=(t,r)=>void 0===r?this[i](e,t):this[i](t,r):t[i]=this[i].bind(this));return t}#L(e,t,r,i=!0,s=!0){let n={};Object.assign(n,this.#Se(e));let o={};this.#_(e,"htmx:scope",{scope:o}),Object.assign(n,o),Object.assign(n,t);let a=Object.keys(n),l=Object.values(n);return new(s?this.#l:this.#a)(...a,i?`return (${r})`:r).call(e,...l)}process(e,t){if(!e?.isConnected)return;if(!(e instanceof Element)){for(let r of e.children||[])this.process(r,t);return}if(t&&this.#ve(e,!0),this.#V(e))return;if(!this.#O(e,"htmx:before:process"))return;let r=[e],i=this.#f.evaluate(e),s=null;for(;s=i.iterateNext();)r.push(s);for(let e of r)!this.#V(e)&&this.#O(e,"htmx:before:on:init",{},!0)&&this.#Ee(e);for(let t of this.#j(e,this.#c))this.#z(t);for(let t of this.#j(e,this.#u))this.#we(t);this.#O(e,"htmx:after:process")}#we(e){let t=this.#v(e,"hx-boost");if(t&&"false"!==t&&this.#Ae(e)&&this.#O(e,"htmx:before:init",{},!0)){let r=this.#H(e);r.initialized=!0,r.eventHandler=this.#J(e),r.boosted=t;let i=e.matches("a")?"click":"submit";e._htmx.listeners.push({fromElt:e,eventName:i,handler:e._htmx.eventHandler}),e.addEventListener(i,e._htmx.eventHandler),this.#O(e,"htmx:after:init",{},!0)}}#Ae(e){if(this.#Q(e))if("A"===e.tagName){if(""===e.target||"_self"===e.target)return!e.hasAttribute("download")&&!e.getAttribute("href")?.startsWith?.("#")&&this.#Te(e.href)}else if("FORM"===e.tagName)return"dialog"!==e.method&&this.#Te(e.action)}#Te(e){try{return new URL(e,window.location.href).origin===window.location.origin}catch(e){return!1}}#Q(e){return!e._htmx?.initialized&&!this.#V(e)}#ve(e,t){let r=[e,...e.querySelectorAll?.("[data-htmx-powered]")??[]];for(let e of r)if(e._htmx){this.#O(e,"htmx:before:cleanup");for(let t of e._htmx.triggerSpecs||[])t.interval&&clearInterval(t.interval),t.timeout&&clearTimeout(t.timeout),t.throttleTimeout&&clearTimeout(t.throttleTimeout),t.observer?.disconnect();for(let t of e._htmx.listeners||[])t.fromElt.removeEventListener(t.eventName,t.handler,t);e.removeAttribute("data-htmx-powered"),this.#O(e,"htmx:after:cleanup"),t&&delete e._htmx}}#qe(e){let t=document.createElement("div");t.hidden=!0,document.body.insertAdjacentElement("afterend",t);let r=e.querySelectorAll?.(this.#y("[hx-preserve]"))||[];for(let e of r){let r=document.getElementById(e.id);r&&this.#Ce(t,r,null)}return t}#Ne(e){for(let t of[...e.children]){let e=document.getElementById(t.id);e&&(this.#Ce(e.parentNode,t,e),this.#ve(e),e.remove())}e.remove()}#Me(e){let t=this.#h.createHTML(e);return Document.parseHTMLUnsafe?.(t)||(new DOMParser).parseFromString(t,"text/html")}#Ie(e){let t=e.replace(/)/gi,'"),r="";t=t.replace(/]*)?>[\s\S]*?<\/head>/i,e=>(r=this.#Me(e).title,""));let i,s,n=t.match(/<([a-z][^\/>\x20\t\r\n\f]*)/i)?.[1]?.toLowerCase();if("html"===n||"body"===n?(i=this.#Me(t),s=document.createDocumentFragment(),s.append(i.body)):(i=this.#Me(``),s=i.querySelector("template").content),!r){let e=s.querySelector("title:not(svg title)");e&&(r=e.textContent,e.remove())}return this.#He(s),{fragment:s,title:r}}#Oe(e,t,r,i){let s=t.id?"#"+CSS.escape(t.id):null;"true"!==r&&r&&!r.includes(" ")&&([r,s=s]=r.split(/:(.*)/)),"true"!==r&&r||(r="outerHTML");let n=this.#Le(r);if(s=n.target||s,n.strip??=!n.style.startsWith("outer"),!s)return;let o=[...document.querySelectorAll(s)];for(let r of o){let s=document.createDocumentFragment();s.append(t.cloneNode(!0)),e.push({type:"oob",fragment:s,target:r,swapSpec:n,sourceElement:i})}t.remove()}#ke(e,t,r){let i=[];if(r)for(let s of r.split(",")){let[r,n="true"]=s.split(/:(.*)/);for(let s of e.querySelectorAll(r))this.#Oe(i,s,n,t)}for(let r of e.querySelectorAll(this.#y("[hx-swap-oob]"))){let e=this.#R(r,"hx-swap-oob"),s=r.getAttribute(e);r.removeAttribute(e),this.#Oe(i,r,s,t)}return i}#Ve(e,t,r){t?t.before(...r.childNodes):e.append(...r.childNodes)}#Le(t){t=t.trim();let r=this.config.defaultSwap;if(t&&!/^\S*:/.test(t)){let e=t.match(/^(\S+)\s*(.*)$/);r=e[1],t=e[2]}return{style:this.#B(r),...e.parse(t)}}#Pe(e,t){let r=[];for(let i of e.querySelectorAll("template[hx]")){let e=i.getAttribute("type");if("partial"===e){let e=this.#P(i,"hx-target")||(i.id?"#"+CSS.escape(i.id):null);if(e){this.#He(i.content);let s=this.#Le(this.#P(i,"hx-swap")||this.config.defaultSwap);for(let n of document.querySelectorAll(e))r.push({type:"partial",fragment:i.content.cloneNode(!0),target:n,swapSpec:s,sourceElement:t.sourceElement})}}else this.#_(i,"htmx:process:"+e,{ctx:t,tasks:r});i.remove()}return r}#Re(e,t,r,i){try{null!=r&&e.setSelectionRange&&e.setSelectionRange(r,i),e.focus(t)}catch(e){}}#je(e){let t=this.#j(e,"[autofocus]")[0];t&&this.#Re(t)}#Be(e,t){if(e.scroll){let r=e.scrollTarget?this.#Fe(e.scrollTarget):t;r&&("top"===e.scroll?r.scrollTop=0:"bottom"===e.scroll&&(r.scrollTop=r.scrollHeight))}if("top"===e.show||"bottom"===e.show){let r=e.showTarget?this.#Fe(e.showTarget):t;r?.scrollIntoView("top"===e.show)}}#$e(e){e.request?.anchor&&document.getElementById(e.request.anchor)?.scrollIntoView({block:"start",behavior:"auto"})}#He(e){let t=this.#j(e,"script");for(let e of t){let t=document.createElement("script");for(let r of e.attributes)t.setAttribute(r.name,r.value);this.config.inlineScriptNonce&&(t.nonce=this.config.inlineScriptNonce),t.textContent=this.#h.createScript(e.textContent),e.replaceWith(t)}}async swap(e){try{this.#_e(e);let{fragment:t,title:r}=this.#Ie(e.text);e.title=r;let i=[],s=this.#ke(t,e.sourceElement,e.selectOOB),n=this.#Pe(t,e);i.push(...s,...n);let o=this.#De(e,t,n);if(o&&i.unshift(o),!this.#O(e.sourceElement,"htmx:before:swap",{ctx:e,tasks:i}))return;let a=[],l=[];for(let t of i)t.swapSpec?.transition??o?.transition??e.transition?l.push(t):a.push(this.#C(t));if(l.length>0){let e=async()=>{for(let e of l)await this.#C(e,!1)};a.push(this.#We(e))}await Promise.all(a),this.#O(e.sourceElement,"htmx:after:swap",{ctx:e}),e.title&&!o?.swapSpec?.ignoreTitle&&(document.title=e.title),this.#$e(e)}finally{this.#O(e.sourceElement,"htmx:swap:finally",{ctx:e})}}#De(e,t,r){let i=this.#Le(e.swap||this.config.defaultSwap);if("delete"===i.style||t.childElementCount>0||t.textContent.trim()||(i.swapEmpty??this.config.defaultSwapEmpty??!r.length)){if(e.select){let r=t.querySelectorAll(e.select);(t=document.createDocumentFragment()).append(...r)}return this.#D(e.sourceElement)&&(i.show||="top"),{type:"main",fragment:t,target:this.#Z(e.sourceElement||document.body,i.target||e.target),swapSpec:i,sourceElement:e.sourceElement,transition:e.transition&&!1!==i.transition}}}async#C(e,t=!0){let{target:r,swapSpec:i,fragment:s}=e;if("string"==typeof r&&(r=document.querySelector(r)),!r)return;"string"==typeof i&&(i=this.#Le(i));let n,o=i.style;if("none"===o)return;if("BODY"===s.firstElementChild?.tagName&&("outerHTML"===o?o="outerSync":o.startsWith("outer")||(i.strip=!0)),i.strip&&s.firstElementChild&&(s=document.createDocumentFragment(),s.append(...(e.fragment.firstElementChild.content||e.fragment.firstElementChild).childNodes)),this.#Ue(r,"htmx-swapping"),t&&e.swapSpec?.swap&&await this.timeout(e.swapSpec?.swap),"delete"===o)return void(r.parentNode&&(this.#ve(r),r.parentNode.removeChild(r)));let a=[],l=i.settle??this.config.defaultSettleDelay,h=r.parentNode;if("innerHTML"===o||"outerHTML"===o&&h){let e=document.activeElement;if(e?.id){let t,r;try{t=e.selectionStart,r=e.selectionEnd}catch(e){}n={elt:e,start:t,end:r}}a=t&&l?this.#ze(s,r):[]}let c=this.#qe(s),u=[...s.childNodes];try{if("innerHTML"===o){for(const e of r.children)this.#ve(e);r.replaceChildren(...s.childNodes)}else if("textContent"===o){for(const e of r.querySelectorAll("[data-htmx-powered]"))this.#ve(e);r.textContent=s.textContent}else if("outerHTML"===o)h&&(this.#Ve(h,r,s),this.#ve(r),h.removeChild(r),r=u[0]||h);else if("outerSync"===o){this.#Qe(r,s.firstElementChild);for(const e of r.children)this.#ve(e);r.replaceChildren(...s.firstElementChild.childNodes),u=[r]}else if("innerMorph"===o)this.#N(r,s,!0),u=[...r.childNodes];else if("outerMorph"===o)this.#N(r,s,!1),u.push(r);else if("beforebegin"===o)h&&this.#Ve(h,r,s);else if("afterbegin"===o)this.#Ve(r,r.firstChild,s);else if("beforeend"===o)this.#Ve(r,null,s);else if("afterend"===o)h&&this.#Ve(h,r.nextSibling,s);else{let e=this.#i.get("handle_swap")||[],t=!1;for(const n of e){let e=n(o,r,s,i);if(e){t=!0,Array.isArray(e)&&(u=e);break}}if(!t)throw new Error(`Unknown swap style: ${o}`)}}finally{this.#Je(r,"htmx-swapping")}if(this.#Ne(c),n&&!n.elt.matches(":focus")){let e=document.getElementById(n.elt.id);if(e){let t={preventScroll:void 0!==i.focusScroll?!i.focusScroll:!this.config.defaultFocusScroll};this.#Re(e,t,n.start,n.end)}}this.#O(r,"htmx:before:settle",{task:e,newContent:u,settleTasks:a});for(const e of u)this.#Ue(e,"htmx-added");if(t&&a.length>0){this.#Ue(r,"htmx-settling"),await this.timeout(l);for(let e of a)e();this.#Je(r,"htmx-settling")}this.#O(r,"htmx:after:settle",{task:e,newContent:u,settleTasks:a});for(const e of u)this.#Je(e,"htmx-added"),this.process(e),this.#je(e);this.#Be(i,r)}#O(e,t,r={},i=!0){if(r.error){let i=`htmx: ${t}: ${r.error.message??r.error}`;r.error instanceof Error?console.error(i,r.error,{elt:e,detail:r}):console.error(i,{elt:e,detail:r})}else r.warn?console.warn(`htmx: ${t}: ${r.warn}`,{elt:e,detail:r}):this.config.logAll&&console.log(`htmx: ${t}`,{elt:e,detail:r});return e=this.#Xe(e),this.#_(e,t,r),this.trigger(e,this.#$(t),r,i)}#_(e,t,r={}){let i=this.#i.get(t.replace(/:/g,"_"));if(i){r.cancelled=!1;for(const t of i)if(!1===t(e,r)||r.cancelled)return r.cancelled=!0,!1}return!0}timeout(e){if((e=this.parseInterval(e))>0)return new Promise(t=>setTimeout(t,e))}onLoad(e){this.on(this.#$("htmx:after:process"),t=>{e(t.target)})}on(e,t,r){let i,s=document;return void 0===r?(i=e,r=t):(s=this.#Xe(e),i=t),s.addEventListener(i,r),r}find(e,t){return this.#Fe(e,t)}findAll(e,t){return this.#ye(e,t)}parseInterval(e){if("number"==typeof e)return e;let[,t,r]=e?.match(/^([\d.]+)(ms|s|m)?$/)||[],i=parseFloat(t)*({ms:1,s:1e3,m:6e4}[r]||1);return isNaN(i)?void 0:i}trigger(e,t,r={},i=!0){e=this.#Xe(e);let s=new CustomEvent(t,{detail:r,cancelable:!0,bubbles:i,composed:!0}),n=e?.isConnected?e:document;return!r.cancelled&&n.dispatchEvent(s)}ajax(e,t,r){(!r||r instanceof Element||"string"==typeof r)&&(r={target:r});let i="string"==typeof r.source?document.querySelector(r.source):r.source;if("string"==typeof r.source&&!i)return Promise.reject(new Error("Source not found"));if(r.target){let e=this.#Z(document.body,r.target);if(!e)return Promise.reject(new Error("Target not found"));i||=e}i||=document.body;let s=this.#A(i,r.event||{});return Object.assign(s,r),r.target&&(s.target=this.#Z(document.body,r.target)),Object.assign(s.request,{action:t,method:e.toUpperCase()}),r.headers&&Object.assign(s.request.headers,r.headers),this.#K(s)}#k(){this.config.history&&(history.state||history.replaceState({htmx:!0},"",location.href),window.addEventListener("popstate",e=>{e.state&&e.state.htmx&&(this.#p?.abort(),this.#Ge())}))}#Ke(e){this.config.history&&(history.pushState({htmx:!0},"",e),this.#O(document,"htmx:after:history:push",{path:e}))}#Ye(e){this.config.history&&(history.replaceState({htmx:!0},"",e),this.#O(document,"htmx:after:history:replace",{path:e}))}#Ge(e){e=e||location.pathname+location.search;let t=document.querySelector(this.#y("[hx-history-elt]"))||document.body;this.#O(document,"htmx:before:history:restore",{path:e,cacheMiss:!0})&&("reload"===this.config.history?location.reload():(this.#p=new AbortController,this.ajax("GET",e,{target:t,swap:"outerSync",select:t!==document.body?this.#y("[hx-history-elt]"):void 0,request:{headers:{"HX-History-Restore-Request":"true"},signal:this.#p.signal}})))}#Ze(e){let{sourceElement:t,push:r,replace:i,hx:s,response:n}=e;if((s?.pushurl||s?.replaceurl)&&(r=s.pushurl,i=s.replaceurl),null==r&&null==i&&this.#D(t)&&(r="true"),"false"!==r&&!1!==r||(r=null),"false"!==i&&!1!==i||(i=null),!r&&!i)return null;let o=r||i;if("true"===o){let t=n?.raw?.url||e.request.action,r=new URL(t,location.href);o=r.pathname+r.search+(e.request.anchor?"#"+e.request.anchor:"")}return{type:r?"push":"replace",path:o}}#_e(e){let t=this.#Ze(e);if(!t)return;let r={history:t,sourceElement:e.sourceElement,response:e.response};this.#O(document,"htmx:before:history:update",r)&&("push"===t.type?this.#Ke(t.path):this.#Ye(t.path),this.#O(document,"htmx:after:history:update",r))}#Ee(e){if(e._htmx?.onInitialized)return;let t=this.#S("hx-on"),r=this.config.metaCharacter||":",i=t=>async r=>{try{await this.#L(e,{event:r},`with(event?.detail||{}){${t}}`,!1)}catch(t){"symbol"!=typeof t&&this.#O(e,"htmx:error",{error:t})}};for(let s of e.getAttributeNames()){let n=t.find(e=>s.startsWith(e));if(!n)continue;this.#H(e).onInitialized=!0;let o=s.substring(n.length),a=e.getAttribute(s);if(!o){for(let t of a.split(/;(?=[^;]*->)/)){let r=t.indexOf("->");-1!==r&&this.#I(e,t.substring(0,r).trim(),i(t.substring(r+2).trim()))}continue}if(o[0]!==r)continue;let l=o.substring(1);l.startsWith(r)&&(l="htmx"+r+l.substring(1)),this.#I(e,l,i(a))}}#ce(e){let t,r=this.#v(e,"hx-indicator");t=r?this.#ye(e,r,"hx-indicator"):[e];for(const e of t){let t=this.#U(e);t.rc=(t.rc||0)+1,this.#Ue(e,this.config.requestClass)}return t}#pe(e){for(let t of e){let e=this.#U(t);e.rc&&--e.rc<=0&&(this.#Je(t,this.config.requestClass),delete e.rc)}}#ue(e){let t=this.#v(e,"hx-disable"),r=[];if(t){r=this.#ye(e,t,"hx-disable");for(let e of r){let t=this.#U(e);t.dc=(t.dc||0)+1,e.disabled=!0}}return r}#ge(e){for(const t of e){let e=this.#U(t);e.dc&&--e.dc<=0&&(t.disabled=!1,delete e.dc)}}#T(e,t,r,i,s){if(i&&t&&!t.reportValidity())return;let n=t?new FormData(t):new FormData,o=t?new Set(t.elements):new Set;if(!t){if(i&&e.reportValidity&&!e.reportValidity())return;this.#et(e,o,n,s)}r&&r.name&&(n.append(r.name,r.value),o.add(r));let a=this.#v(e,"hx-include");if(a)for(let t of this.#ye(e,a)){if(i&&t.reportValidity&&!t.reportValidity())return;this.#et(t,o,n)}return n}#et(e,t,r,i){let s=e.tagName,n=[];"BUTTON"===s?n=[e]:!["INPUT","SELECT","TEXTAREA","FIELDSET"].includes(s)&&i||(n=this.#j(e,"input, select, textarea"));for(let e of n){if(!e.name||e.matches(":disabled")||t.has(e))continue;t.add(e);let i=e.type;if("checkbox"===i||"radio"===i)e.checked&&r.append(e.name,e.value);else if("file"===i)for(let t of e.files)r.append(e.name,t);else if("select-multiple"===i)for(let t of e.selectedOptions)r.append(e.name,t.value);else r.append(e.name,e.value)}}#q(t,r,i,s={}){let n=this.#v(t,r);if(!n)return null;let o=this.#ne(n);if(o)return 0!==o.indexOf("{")&&(o="{"+o+"}"),this.#L(t,s,o,!0).then(e=>{i(e)});i(e.parse(n))}#tt(e){let t=e.trim();return t.startsWith("<")&&t.endsWith("/>")?t.slice(1,-2):t}#ye(t,r,i,s){let n=r??t,o=r?this.#Xe(t):document;if(n.startsWith("global "))return this.#ye(o,n.slice(7),i,!0);let a=n?e.split(n):[],l=[],h=[];for(const e of a){let t,r=this.#tt(e);if(r.startsWith("closest "))t=o.closest(r.slice(8));else if(r.startsWith("find "))t=o.querySelector(r.slice(5));else if(r.startsWith("findAll "))l.push(...o.querySelectorAll(r.slice(8)));else if("next"===r||"nextElementSibling"===r)t=o.nextElementSibling;else if(r.startsWith("next "))t=this.#rt(o,r.slice(5),!!s);else if("previous"===r||"previousElementSibling"===r)t=o.previousElementSibling;else if(r.startsWith("previous "))t=this.#it(o,r.slice(9),!!s);else if("document"===r)t=document;else if("window"===r)t=window;else if("body"===r)t=document.body;else if("host"===r)t=o.getRootNode().host;else if("this"===r){if(i){l.push(...this.#F(o,i));continue}t=o}else h.push(r);t&&l.push(t)}if(h.length>0){let e=h.join(","),t=this.#st(o,!!s);l.push(...t.querySelectorAll(e))}return[...new Set(l)]}#rt(e,t,r){return this.#nt(this.#st(e,r).querySelectorAll(t),e,Node.DOCUMENT_POSITION_PRECEDING)}#it(e,t,r){let i=[...this.#st(e,r).querySelectorAll(t)].reverse();return this.#nt(i,e,Node.DOCUMENT_POSITION_FOLLOWING)}#nt(e,t,r){for(const i of e)if(i.compareDocumentPosition(t)===r)return i}#st(e,t){return e.isConnected&&e.getRootNode?e.getRootNode?.({composed:t}):document}#re(e,t,r){let i=this.#ye(e,t,r)[0];return i||console.warn(`htmx: '${t}' on ${r} did not match any element`,{elt:e,selector:t,attr:r}),i}#Fe(e,t,r){return this.#ye(e,t,r)[0]}#ne(e){if(null!=e){if(e.startsWith("js:"))return e.substring(3);if(e.startsWith("javascript:"))return e.substring(11)}}#G(e){let t=()=>{this.#le(e).abort()};e.addEventListener("htmx:abort",t),e._htmx.listeners.push({fromElt:e,eventName:"htmx:abort",handler:t})}#N(e,t,r){let{persistentIds:i,idMap:s}=this.#ot(e,t),n=document.createElement("div");n.hidden=!0,document.body.after(n);let o={target:e,idMap:s,persistentIds:i,pantry:n,futureMatches:new WeakSet};r?this.#at(o,e,t):this.#at(o,e.parentNode,t,e,e.nextSibling),this.#ve(n),n.remove()}#at(e,t,r,i=null,s=null){t instanceof HTMLTemplateElement&&r instanceof HTMLTemplateElement&&(t=t.content,r=r.content),i||=t.firstChild;let n=r.firstChild;for(;n;){let r;if(i&&i!=s&&(r=this.#lt(e,n,i,s),r&&r!==i)){let o=i;for(;o&&o!==r;){let r=o;o=o.nextSibling,r instanceof Element&&(e.idMap.has(r)||this.#ht(e,r,n))?this.#Ce(t,r,s):this.#ct(e,r)}}if(!r&&n instanceof Element&&e.persistentIds.has(n.id)){let s=CSS.escape(n.id);r=e.target.id===n.id&&e.target||e.target.querySelector(`[id="${s}"]`)||e.pantry.querySelector(`[id="${s}"]`);let o=r;for(;o=o.parentNode;){let t=e.idMap.get(o);t&&(t.delete(r.id),t.size||e.idMap.delete(o))}this.#Ce(t,r,i)}if(r){this.#ut(r,n,e),i=r.nextSibling,n=n.nextSibling;continue}let o=n.nextSibling;if(e.idMap.has(n)){let r=document.createElement(n.tagName);t.insertBefore(r,i),this.#ut(r,n,e),i=r.nextSibling}else t.insertBefore(n,i),i=n.nextSibling;n=o}for(;i&&i!=s;){let t=i;i=i.nextSibling,this.#ct(e,t)}}#ht(e,t,r){if(e.futureMatches.has(t))return!0;for(let i=r.nextSibling,s=0;i&&sa.has(e)))return h;if(!r){if(o>0&&h.isEqualNode(t))return h;s||(s=h)}}if(n+=r?.size||0,n>l)break;if(null!=document.activeElement?.selectionStart&&h.contains(document.activeElement))break;if(--o<1&&0===l)break;h=h.nextSibling}return s&&this.#ht(e,s,t)?null:s}#M(e,t){return e instanceof Element&&e.tagName===t.tagName&&(!("SCRIPT"===e.tagName&&!e.isEqualNode(t))&&(!(!e._x_bindings?.id||!t.matches?.("[\\:id], [x-bind\\:id]"))||(!e.id||e.id===t.id)))}#ct(e,t){e.idMap.has(t)?this.#Ce(e.pantry,t,null):(this.#ve(t),t.remove())}#Ce(e,t,r){if(e.moveBefore)try{return void e.moveBefore(t,r)}catch(e){}e.insertBefore(t,r)}#ut(e,t,r){if(3===e.nodeType)return void(e.nodeValue!==t.nodeValue&&(e.nodeValue=t.nodeValue));if(this.config.morphSkip&&e.matches?.(this.config.morphSkip))return;if(!this.#_(e,"htmx:before:morph:node",{oldNode:e,newNode:t}))return;this.#Qe(e,t),e instanceof HTMLTextAreaElement&&e.defaultValue!=t.defaultValue&&(e.value=t.value),this.config.morphSkipChildren&&e.matches?.(this.config.morphSkipChildren)||e.isEqualNode(t)&&"TEMPLATE"!==t.tagName&&!t.querySelector?.("template")||this.#at(r,e,t)}#Qe(e,t){let r=this.config.morphIgnore||[],i=!1,s=e=>this.#S("hx-").some(t=>e.startsWith(t));for(const n of t.attributes)if(!r.some(e=>n.name.startsWith(e))&&e.getAttribute(n.name)!==n.value){if(s(n.name)&&(i=!0),!this.#_(e,"htmx:before:morph:attr",{attrName:n.name,newValue:n.value}))continue;e.setAttribute(n.name,n.value),"value"===n.name&&e instanceof HTMLInputElement&&"file"!==e.type&&(e.value=n.value)}for(let n=e.attributes.length-1;n>=0;n--){let o=e.attributes[n];if(o&&!t.hasAttribute(o.name)&&!r.some(e=>o.name.startsWith(e))){if(s(o.name)&&(i=!0),!this.#_(e,"htmx:before:morph:attr",{attrName:o.name,newValue:null}))continue;e.removeAttribute(o.name)}}i&&this.#ve(e,!0)}#dt(e,t,r,i){for(const s of i)if(t.has(s.id)){let t=s;for(;t&&t!==r;){let r=e.get(t);null==r&&(r=new Set,e.set(t,r)),r.add(s.id),t=t.parentElement}}}#ot(e,t){let r=this.#j(e,"[id]"),i=t.querySelectorAll("[id]"),s=this.#ft(r,i),n=new Map;return this.#dt(n,s,e.parentElement,r),this.#dt(n,s,t,i),{persistentIds:s,idMap:n}}#ft(e,t){let r=new Set,i=new Map;for(const{id:t,tagName:s}of e)i.has(t)?r.add(t):t&&i.set(t,s);let s=new Set;for(const{id:e,tagName:n}of t)s.has(e)?r.add(e):i.get(e)===n&&s.add(e);for(const e of r)s.delete(e);return s}#me(t){let r=t.response.raw.status,i=this.config.noSwap.map(e=>e+""),s=r+"";for(let r of[s,s.slice(0,2)+"x",s[0]+"xx"]){if(i.includes(r))return void(t.swap="none");let s=this.#v(t.sourceElement,"hx-status:"+r);if(s)return void e.merge(s,t)}}#We(e){return new Promise(t=>{this.#m||=[],this.#m.push({task:e,resolve:t}),this.#g||this.#mt()})}async#mt(){if(0===this.#m.length||this.#g)return;this.#g=!0;let{task:e,resolve:t}=this.#m.shift();try{document.startViewTransition?(this.#O(document,"htmx:before:viewTransition",{task:e}),await document.startViewTransition(e).finished,this.#O(document,"htmx:after:viewTransition",{task:e})):await e()}catch(e){}finally{this.#g=!1,t(),this.#mt()}}#ze(e,t){let r=t.querySelectorAll("[id]"),i=Object.fromEntries([...r].map(e=>[e.id,e])),s=e.querySelectorAll("[id]"),n=[];for(let e of s){let t=i[e.id];if(t?.tagName===e.tagName){let r=e.cloneNode(!1);this.#Qe(e,t),n.push(()=>{this.#Qe(e,r)})}}return n}#Ue(e,t){e?.classList?.add?.(t)}#Je(e,t){e?.classList?.remove?.(t),0===e?.classList?.length&&e.removeAttribute("class")}#Xe(e){return"string"==typeof e?this.find(e):e}#$(e){return this.config.metaCharacter?e.replace(/:/g,this.config.metaCharacter):e}}})(); \ No newline at end of file +var htmx=(()=>{const e={parse(t){if(!t)return{};if(t.startsWith("{"))return JSON.parse(t);let r=/(?:"([^"]+)"|'([^']+)'|([^\s,:]+))(?:\s*:\s*(?:"([^"]*)"|'([^']*)'|<((?:[^/]|\/(?!>))+)\/>|([^\s,]+)))?(?=\s|,|$)/g,i={};for(let s of t.matchAll(r)){let[,t,r,n,o,a,l,h]=s,c=t??r??n,u=(o??a??l??h??"true").trim();try{u=JSON.parse(u)}catch{}let d=n?.includes("."),f=d?c.split(".").reduceRight((e,t)=>({[t]:e}),u):{[c]:u};e.merge(f,i)}return i},split:e=>e.split(/,(?![^\[]*\])(?![^(]*\))(?![^<]*\/>)(?=(?:[^"']|"[^"]*"|'[^']*')*$)/),merge(t,r){"string"==typeof t&&(t=e.parse(t));for(let[i,s]of Object.entries(t)){if(["__proto__","constructor","prototype"].includes(i))continue;let t=s?.constructor===Object,n=r[i]?.constructor===Object;t&&n?e.merge(s,r[i]):r[i]=s}return r}};class t{#e=null;#t=[];admit(e,t,r){if(!this.#e)return this.#e={strategy:e,abort:r},"run";if("replace"===e||"abort"!==e&&"abort"===this.#e.strategy)return this.#t=[],this.#e.abort?.(),this.#e={strategy:e,abort:r},"run";if("queue all"===e)this.#t.push(t);else if("queue last"===e)this.#t=[t];else{if("abort"===e||"drop"===e||0!==this.#t.length)return"dropped";this.#t.push(t)}return"queued"}continue(){this.#e=null,this.#t.shift()?.()}abort(){this.#e?.abort?.()}}return new class{#r=e;#i=new Map;#s="";#n=new Set;_loc=window.location;#o;#a=Function;#l=Object.getPrototypeOf(async function(){}).constructor;#h={createHTML:e=>e,createScript:e=>e};#c;#u="a,form";#d=["get","post","put","patch","delete","query"];#f;#m;#p;#g;#x;constructor(){this.#b(),this.#y(),this.#c=this.#S("[hx-action],[hx-get],[hx-post],[hx-put],[hx-patch],[hx-delete],[hx-query]"),this.#f=(new XPathEvaluator).createExpression(`.//*[@*[${this.#v("hx-on").map(e=>`starts-with(name(), "${e}")`).join(" or ")}]]`),this.#o={HCON:e,attributeValue:this.#E.bind(this),parseTriggerSpecs:this.#w.bind(this),determineMethodAndAction:this.#A.bind(this),createRequestContext:this.#T.bind(this),collectFormData:this.#C.bind(this),getAttributeObject:this.#q.bind(this),insertContent:this.#N.bind(this),morph:this.#I.bind(this),isSoftMatch:this.#M.bind(this),initSecurity:(e,t,r)=>{e&&(this.#h=e),t&&(this.#a=t),r&&(this.#l=r)},onTrigger:this.#O.bind(this),htmxProp:this.#H.bind(this),triggerHtmxEvent:this.#L.bind(this),executeJavaScript:this.#k.bind(this)};let t=()=>this.initialize();"loading"===document.readyState?document.addEventListener("DOMContentLoaded",t):setTimeout(t)}#b(){this.version="4.0.0",this.config={logAll:!1,prefix:"data-hx-",transitions:!1,history:!0,mode:"same-origin",defaultSwap:"innerHTML",defaultFocusScroll:!1,indicatorClass:"htmx-indicator",requestClass:"htmx-request",includeIndicatorCSS:!0,defaultTimeout:6e4,extensions:"",morphIgnore:["data-htmx-powered"],morphSkip:"[hx-morph-skip]",morphSkipChildren:"[hx-morph-skip-children]",morphScanLimit:10,noSwap:[204,304],implicitInheritance:!1,defaultSettleDelay:1,allowEmptySwapAfterOOB:!1};let t=document.querySelector('meta[name="htmx-config"]');t&&e.merge(t.content,this.config),this.#s=this.config.extensions}#y(){if(!1!==this.config.includeIndicatorCSS){let e=this.config.indicatorClass,t=this.config.requestClass,r=new CSSStyleSheet;r.replaceSync(`.${e}{opacity:0;visibility: hidden} .${t} .${e}, .${t}.${e}{opacity:1;visibility: visible;transition: opacity 200ms ease-in}`),document.adoptedStyleSheets=[...document.adoptedStyleSheets,r]}}registerExtension(e,t){return!(this.#s&&!this.#s.split(/,\s*/).includes(e))&&(!this.#n.has(e)&&(this.#n.add(e),t.init&&t.init(this.#o),void Object.entries(t).forEach(([e,t])=>{this.#i.get(e)?.push(t)||this.#i.set(e,[t])})))}#V(e){let t=this.config.prefix;return!e.closest||null!=e.closest("[hx-ignore]")||t&&null!=e.closest(`[${t}ignore]`)}#P(e,t){let r=this.config.prefix;return e.getAttribute(t)??(r?e.getAttribute(t.replace("hx-",r)):null)}#R(e,t){let r=this.config.prefix&&t.replace("hx-",this.config.prefix);return e.hasAttribute(t)?t:r&&e.hasAttribute(r)?r:null}#S(e){return this.#v(e).join(",")}#v(e){let t=[e];return this.config.prefix&&t.push(e.replaceAll("hx-",this.config.prefix)),t}#j(e,t){let r=[...e.querySelectorAll?.(t)??[]];return e.matches?.(t)&&r.unshift(e),r}#B(e){return"before"===e?"beforebegin":"after"===e?"afterend":"prepend"===e?"afterbegin":"append"===e?"beforeend":e}#F(e,t){let r=[];return this.#E(e,t,void 0,(e,t)=>{e?.split(/\s*[,:]\s*/).includes("this")&&r.push(t)}),r}#E(e,t,r,i){t=this.#z(t);let s=this.#z(":inherited"),n=this.#z(":append"),o=this.#P(e,t)??this.#P(e,t+s);if(null!=o)return i?i(o,e):o;let a=CSS.escape(this.config.implicitInheritance?t:t+s),l=CSS.escape(t+s+n),h=this.#S(`[${a}],[${l}]`),c=this.#R(e,t+n)??this.#R(e,t+s+n);if(c){let r=e.getAttribute(c),s=e.parentNode?.closest?.(h);if(i&&i(r,e),s){let e=this.#E(s,t,void 0,i);return e?(e+","+r).replace(/[{}]/g,""):r}return r}let u=e.parentNode?.closest?.(h);return u?(o=this.#E(u,t,void 0,i),!i&&o&&this.config.implicitInheritance&&this.#_(e,"htmx:after:implicitInheritance",{elt:e,name:t,parent:u}),o):r}#w(t){return e.split(t).flatMap(t=>{let[,r,i]=t.match(/^\s*(\S+\[[^\]]*\]|\S+)\s*(.*?)\s*$/)??[];if(!r)return[];if(/\[[^\]]*$/.test(r))throw"unterminated:"+r;return[{name:r,...e.parse(i)}]})}#A(e,t){let r=this.#E(e,"hx-method"),i=this.#E(e,"hx-action");if(!i)for(let t of this.#d){let s=this.#E(e,"hx-"+t);if(null!=s){i=s,r=t;break}}return this.#D(e)&&(i||=t.submitter?.getAttribute?.("formAction")||e.getAttribute(e.matches("a")?"href":"action")),r||=t.submitter?.getAttribute?.("formmethod")||e.getAttribute("method")||"GET",{action:i,method:r.toUpperCase()}}#H(e){return e._htmx||(e._htmx={listeners:[],triggerSpecs:[]},e.setAttribute("data-htmx-powered","true")),e._htmx}#$(e){return e._htmx_state||={}}#W(e){if(this.#U(e)&&this.#L(e,"htmx:before:init",{},!0)){let t=this.#H(e);t.initialized=!0,t.eventHandler=this.#Q(e),this.#J(e),this.#L(e,"htmx:after:init",{},!0)}}#Q(e){return async t=>{try{let r=this.#T(e,t);await this.#X(r)}catch(t){this.#L(e,"htmx:error",{error:t})}}}#T(t,r){let{action:i,method:s}=this.#A(t,r),[n,o]=(i||"").split("#"),a=new AbortController,l={sourceElement:t,sourceEvent:r,status:"created",select:this.#E(t,"hx-select"),selectOOB:this.#E(t,"hx-select-oob"),target:this.#E(t,"hx-target"),swap:this.#E(t,"hx-swap")??this.config.defaultSwap,push:this.#E(t,"hx-push-url"),replace:this.#E(t,"hx-replace-url"),transition:this.config.transitions,confirm:this.#E(t,"hx-confirm"),request:{validate:"true"===this.#E(t,"hx-validate",!t.matches("form")||t.noValidate||r.submitter?.formNoValidate?"false":"true"),action:n,anchor:o,method:s,headers:this.#G(t),abort:a.abort.bind(a),credentials:"same-origin",signal:a.signal,mode:this.config.mode}};t._htmx?.boosted&&e.merge(t._htmx.boosted,l),l.target=this.#K(t,l.target),l.target&&(l.request.headers["HX-Target"]=this.#Y(l.target));let h=this.#E(t,"hx-config");return h&&(e.merge(h,l.request),l.request.mode=this.config.mode),l}#Y(e){return`${e.tagName.toLowerCase()}${e.id?"#"+encodeURI(e.id):""}`}#G(e){let t={"HX-Request":"true","HX-Source":this.#Y(e),"HX-Current-URL":location.href,Accept:"text/html"};return this.#D(e)&&(t["HX-Boosted"]="true"),t}#Z(e,t){return this.#q(e,"hx-headers",e=>{for(let r in e)t.request.headers[r]=String(e[r])},{ctx:t})}#K(e,t){return t instanceof Element?t:null!=t?this.#ee(e,t,"hx-target"):this.#D(e)?document.body:e}#D(e){return e?._htmx?.boosted}async#X(e){let t=e.sourceElement,r=e.sourceEvent;if(!t.isConnected)return;if(this.#te(r))return;this.#re(r)&&r.preventDefault();let i=/GET|DELETE/.test(e.request.method),s=i?t.matches("form")?t:null:t.form||t.closest("form"),n=this.#C(t,s,r.submitter,e.request.validate,i);if(!n)return;let o=this.#q(t,"hx-vals",t=>{e.vals=t;for(let e in t)n.set(e,t[e])},{ctx:e});if(o&&await o,e.values)for(let t in e.values)n.delete(t),n.append(t,e.values[t]);let a=this.#Z(t,e);if(a&&await a,Object.assign(e.request,{form:s,submitter:r.submitter,body:n}),!this.#L(t,"htmx:config:request",{ctx:e}))return;if("DIALOG"===e.request.method)return;let l=this.#ie(e.request.action);if(null!=l){let t=Object.fromEntries(e.request.body);return void await this.#k(e.sourceElement,t,l,!1)}if(i){let t=new URL(e.request.action,document.baseURI);for(let r of e.request.body.keys())t.searchParams.delete(r);for(let[r,i]of e.request.body)t.searchParams.append(r,i);t.origin===location.origin?e.request.action=t.pathname+t.search:e.request.action=t.href,e.request.body=null}else"multipart/form-data"!==(this.#E(t,"hx-encoding")??s?.enctype)&&(e.request.body=new URLSearchParams(e.request.body));await this.#se(e)}async#se(e){let t=e.sourceElement,r=this.#ne(t),i=this.#oe(t);if(this.#ae(t),"run"!==i.admit(r,()=>this.#se(e),()=>e.request?.abort?.()))return;e.status="issuing";let s=[],n=[];try{if(e.confirm){if(!await new Promise(r=>{let i={ctx:e,issueRequest:()=>r(!0),dropRequest:()=>r(!1)};if(this.#L(t,"htmx:confirm",i)){let i=this.#ie(e.confirm);r(i?this.#k(t,{ctx:e},i,!0):window.confirm(e.confirm))}}))return}if(this.#le(e),s=this.#he(t),n=this.#ce(t),e.fetch||=window.fetch.bind(window),e.request.headers["HX-Request-Type"]=e.target===document.body||e.select?"full":"partial",!this.#L(t,"htmx:before:request",{ctx:e}))return;let r=await e.fetch(e.request.action,e.request);if(e.response={raw:r,status:r.status,headers:r.headers},this.#ue(e),!this.#L(t,"htmx:before:response",{ctx:e}))return;if(e.text=await r.text(),!this.#L(t,"htmx:after:request",{ctx:e}))return;if(e.response.status>=400&&this.#L(t,"htmx:response:error",{ctx:e}),this.#de(e))return void(e.keepIndicators=!0);"issuing"===e.status&&(e.hx.retarget&&(e.target=e.hx.retarget),e.hx.reswap&&(e.swap=e.hx.reswap),e.hx.reselect&&(e.select=e.hx.reselect),e.status="response received",this.#fe(e),await this.swap(e),e.status="swapped")}catch(r){e.status="error: "+r,this.#L(t,"htmx:error",{ctx:e,error:r})}finally{await(e.extensionPromise?.catch(()=>{})),clearTimeout(e.requestTimeout),e.hx?.trigger&&this.#me(e.hx.trigger,e.sourceElement),this.#L(t,"htmx:finally:request",{ctx:e}),e.keepIndicators||(this.#pe(s),this.#ge(n)),i.continue()}}#ue(e){e.hx={};for(let[t,r]of e.response.raw.headers)t.toLowerCase().startsWith("hx-")&&(e.hx[t.slice(3).toLowerCase().replace(/-/g,"")]=r)}#de(t){if("true"===t.hx.refresh)return this._loc.reload(),!0;if(t.hx.redirect)return this._loc.href=t.hx.redirect,!0;if(t.hx.location){let r=t.hx.location,i={},s=e.parse(r);return"{"!==r[0]&&null==s.path||(i=s,r=i.path,delete i.path),null==i.push&&null==i.replace&&(i.push="true"),this.ajax("GET",r,i),!0}}#le(e){let t=null!=e.request.timeout?this.parseInterval(e.request.timeout):this.config.defaultTimeout;t&&(e.requestTimeout=setTimeout(()=>e.request?.abort?.(),t))}#ne(e){let t=this.#E(e,"hx-sync");if(!t)return"queue first";let r=t.split(":").pop().trim();return/^(drop|abort|replace|queue)/.test(r)?r:"queue first"}#oe(e){let r=this.#E(e,"hx-sync"),i=e;if(r){let t=r.includes(":")?r.slice(0,r.lastIndexOf(":")).trim():/^(drop|abort|replace|queue)/.test(r)?null:r;t&&(i=this.#ee(e,t,"hx-sync")||e)}return this.#$(i).rq||=new t}#te(e){return"click"===e.type&&(e.ctrlKey||e.metaKey||e.shiftKey)&&!!e.currentTarget?.closest?.("a[href]")}#re(e){let t=e.currentTarget;if("submit"===e.type&&"FORM"===t?.tagName)return!0;if(!("click"===e.type&&0===e.button))return!1;let r=t?.closest?.('button, input[type="submit"], input[type="image"]'),i=r?.form||r?.closest("form");if(r&&!r.disabled&&i&&("submit"===r.type||"image"===r.type||!r.type&&"BUTTON"===r.tagName))return!0;let s=t?.closest?.("a");if(!s||!s.href)return!1;let n=s.getAttribute("href");return!(n&&n.startsWith("#")&&n.length>1)}#J(e,t=e._htmx.eventHandler){let r=this.#E(e,"hx-trigger")||(e.matches("form")?"submit":e.matches("input:not([type=button]):not([type=submit]),select,textarea")?"change":"click");this.#O(e,r,t)}#O(e,t,r){let i=this.#w(t);this.#H(e).triggerSpecs.push(...i);for(let t of i){t.listeners=[];let[i,s]=this.#xe(t.name),n=[e];"outside"===t.from?n=[document]:t.from&&"self"!==t.from&&(n=this.#be(e,t.from));let o=e=>{if((t.halt||t.prevent)&&e.preventDefault(),(t.halt||t.stop||t.consume)&&e.stopPropagation(),t.once)for(let e of t.listeners)e.fromElt.removeEventListener(e.eventName,e.handler,e);r(e)},a=o;if(t.delay?a=e=>{clearTimeout(t.timeout),t.timeout=setTimeout(()=>o(e),this.parseInterval(t.delay))}:t.throttle&&(a=e=>{t.throttled?t.throttledEvent=e:(t.throttled=!0,o(e),t.throttleTimeout=setTimeout(()=>{if(t.throttled=!1,t.throttledEvent){let e=t.throttledEvent;t.throttledEvent=null,a(e)}},this.parseInterval(t.throttle)))}),t.handler=r=>{if(("self"!==t.from||r.target===e)&&("outside"!==t.from||!e.contains(r.target))&&(!t.target||r.target?.matches?.(t.target))){if(t.changed){let e=t.values??=new WeakMap,r=!1;for(let t of n)e.get(t)!==t.value&&(r=!0,e.set(t,t.value));if(!r)return}if(s){this.#re(r)&&r.preventDefault();let t={};for(let e in r)t[e]=r[e];if(!this.#k(e,t,s,!0,!1))return}a(r)}},"intersect"===i||"revealed"===i){let r={rootMargin:t.rootMargin};t.root&&(r.root=this.#ee(e,t.root)),t.threshold&&(r.threshold=parseFloat(t.threshold));let s="revealed"===i;t.observer=new IntersectionObserver(r=>{for(let i=0;i"name"!==e);t.interval=setInterval(()=>{e.isConnected?this.#L(e,"every",{},!1):clearInterval(t.interval)},this.parseInterval(r))}if("load"!==i)for(let r of n){let s={fromElt:r,eventName:i,handler:t.handler,capture:!!t.capture,passive:!!t.passive};e._htmx.listeners.push(s),t.listeners.push(s),r.addEventListener(i,t.handler,s)}else t.handler(new CustomEvent("load"))}}#xe(e){let t=e.match(/^([^\[]*)\[([^\]]*)]/);return t?[t[1],t[2]]:[e,null]}#me(t,r){if("{"===t[0]){let i=e.parse(t);for(let e in i){let t=i[e],s=r;t?.target&&(s=this.find(t.target)),this.trigger(s,e,"object"==typeof t?t:{value:t})}}else t.split(",").forEach(e=>this.trigger(r,e.trim(),{}))}#ye(e){let t={},r=Object.getPrototypeOf(this);for(let i of Object.getOwnPropertyNames(r))"constructor"!==i&&"function"==typeof this[i]&&(["find","findAll"].includes(i)?t[i]=(t,r)=>void 0===r?this[i](e,t):this[i](t,r):t[i]=this[i].bind(this));return t}#k(e,t,r,i=!0,s=!0,n=!1){let o={};Object.assign(o,this.#ye(e));let a={},l={scope:a,code:r};this.#_(e,"htmx:scope",l),r=l.code,Object.assign(o,a),Object.assign(o,t);let h=Object.keys(o),c=Object.values(o),u=new(s?this.#l:this.#a)(...h,i?`return (${r})`:r);return n?()=>u.call(e,...c):u.call(e,...c)}process(e,t){if(!e?.isConnected)return;if(!(e instanceof Element)){for(let r of e.children||[])this.process(r,t);return}if(t&&this.#Se(e,!0),this.#V(e))return;if(!this.#L(e,"htmx:before:process"))return;let r=[e],i=this.#f.evaluate(e),s=null;for(;s=i.iterateNext();)r.push(s);for(let e of r)!this.#V(e)&&this.#L(e,"htmx:before:on:init",{},!0)&&this.#ve(e);for(let t of this.#j(e,this.#c))this.#W(t);for(let t of this.#j(e,this.#u))this.#Ee(t);this.#L(e,"htmx:after:process")}#Ee(e){let t=this.#E(e,"hx-boost");if(t&&"false"!==t&&this.#we(e)&&this.#L(e,"htmx:before:init",{},!0)){let r=this.#H(e);r.initialized=!0,r.eventHandler=this.#Q(e),r.boosted=t;let i=e.matches("a")?"click":"submit";e._htmx.listeners.push({fromElt:e,eventName:i,handler:e._htmx.eventHandler}),e.addEventListener(i,e._htmx.eventHandler),this.#L(e,"htmx:after:init",{},!0)}}#we(e){if(this.#U(e))if("A"===e.tagName){if(""===e.target||"_self"===e.target)return!e.hasAttribute("download")&&!e.getAttribute("href")?.startsWith?.("#")&&this.#Ae(e.href)}else if("FORM"===e.tagName)return"dialog"!==e.method&&this.#Ae(e.action)}#Ae(e){try{return new URL(e,window.location.href).origin===window.location.origin}catch(e){return!1}}#U(e){return!e._htmx?.initialized&&!this.#V(e)}#Se(e,t){let r=[e,...e.querySelectorAll?.("[data-htmx-powered]")??[]];for(let e of r)if(e._htmx){this.#L(e,"htmx:before:cleanup");for(let t of e._htmx.triggerSpecs||[])t.interval&&clearInterval(t.interval),t.timeout&&clearTimeout(t.timeout),t.throttleTimeout&&clearTimeout(t.throttleTimeout),t.observer?.disconnect();for(let t of e._htmx.listeners||[])t.fromElt.removeEventListener(t.eventName,t.handler,t);e.removeAttribute("data-htmx-powered"),this.#L(e,"htmx:after:cleanup"),t&&delete e._htmx}}#Te(e){let t=document.createElement("div");t.hidden=!0,document.body.insertAdjacentElement("afterend",t);let r=e.querySelectorAll?.(this.#S("[hx-preserve]"))||[];for(let e of r){let r=document.getElementById(e.id);r&&this.#Ce(t,r,null)}return t}#qe(e){for(let t of[...e.children]){let e=document.getElementById(t.id);e&&(this.#Ce(e.parentNode,t,e),this.#Se(e),e.remove())}e.remove()}#Ne(e){let t=this.#h.createHTML(e);return Document.parseHTMLUnsafe?.(t)||(new DOMParser).parseFromString(t,"text/html")}#Ie(e){let t=e.replace(/)/gi,'"),r="";t=t.replace(/]*)?>[\s\S]*?<\/head>/i,e=>(r=this.#Ne(e).title,""));let i,s,n=t.match(/<([a-z][^\/>\x20\t\r\n\f]*)/i)?.[1]?.toLowerCase();if("html"===n||"body"===n?(i=this.#Ne(t),s=document.createDocumentFragment(),s.append(i.body)):(i=this.#Ne(``),s=i.querySelector("template").content),!r){let e=s.querySelector("title:not(svg title)");e&&(r=e.textContent,e.remove())}return this.#Me(s),{fragment:s,title:r}}#Oe(e,t,r,i){let s=t.id?"#"+CSS.escape(t.id):null;"true"!==r&&r&&!r.includes(" ")&&([r,s=s]=r.split(/:(.*)/)),"true"!==r&&r||(r="outerHTML");let n=this.#He(r);if(s=n.target||s,n.strip??=!n.style.startsWith("outer"),!s)return;let o=[...document.querySelectorAll(s)];for(let r of o){let s=document.createDocumentFragment();s.append(t.cloneNode(!0)),e.push({type:"oob",fragment:s,target:r,swapSpec:n,sourceElement:i})}t.remove()}#Le(e,t,r){let i=[];if(r)for(let s of r.split(",")){let[r,n="true"]=s.split(/:(.*)/);for(let s of e.querySelectorAll(r))this.#Oe(i,s,n,t)}for(let r of e.querySelectorAll(this.#S("[hx-swap-oob]"))){let e=this.#R(r,"hx-swap-oob"),s=r.getAttribute(e);r.removeAttribute(e),this.#Oe(i,r,s,t)}return i}#ke(e,t,r){t?t.before(...r.childNodes):e.append(...r.childNodes)}#He(t){t=t.trim();let r=this.config.defaultSwap;if(t&&!/^\S*:/.test(t)){let e=t.match(/^(\S+)\s*(.*)$/);r=e[1],t=e[2]}return{style:this.#B(r),...e.parse(t)}}#Ve(e,t){let r=[];for(let i of e.querySelectorAll("template[hx]")){let e=i.getAttribute("type");if("partial"===e){let e=this.#P(i,"hx-target")||(i.id?"#"+CSS.escape(i.id):null);if(e){this.#Me(i.content);let s=this.#He(this.#P(i,"hx-swap")||this.config.defaultSwap),n=this.#be(t.sourceElement,e);for(let e of n.length?n:[null])r.push({type:"partial",fragment:i.content.cloneNode(!0),target:e,swapSpec:s,sourceElement:t.sourceElement})}}else this.#_(i,"htmx:process:"+e,{ctx:t,tasks:r});i.remove()}return r}#Pe(e,t,r,i){try{null!=r&&e.setSelectionRange&&e.setSelectionRange(r,i),e.focus(t)}catch(e){}}#Re(e){let t=this.#j(e,"[autofocus]")[0];t&&this.#Pe(t)}#je(e,t){if(e.scroll){let r=e.scrollTarget?this.#Be(e.scrollTarget):t;r&&("top"===e.scroll?r.scrollTop=0:"bottom"===e.scroll&&(r.scrollTop=r.scrollHeight))}if("top"===e.show||"bottom"===e.show){let r=e.showTarget?this.#Be(e.showTarget):t;r?.scrollIntoView?.("top"===e.show)}}#Fe(e){e.request?.anchor&&document.getElementById(e.request.anchor)?.scrollIntoView({block:"start",behavior:"auto"})}#Me(e){let t=this.#j(e,"script");for(let e of t){let t=document.createElement("script");for(let r of e.attributes)t.setAttribute(r.name,r.value);this.config.inlineScriptNonce&&(t.nonce=this.config.inlineScriptNonce),t.textContent=this.#h.createScript(e.textContent),e.replaceWith(t)}}initialize(){this.config.history&&!this.#g&&(this.#g=!0,history.state||history.replaceState({htmx:!0},"",location.href),window.navigation&&!/firefox/i.test(navigator.userAgent)?navigation.addEventListener("navigate",e=>{"traverse"===e.navigationType&&e.canIntercept&&!e.hashChange&&e.intercept({handler:()=>this.#ze()})}):window.addEventListener("popstate",e=>this.#ze(e.state))),this.process(document.body)}async swap(e){try{this.#_e(e);let{fragment:t,title:r}=this.#Ie(e.text);e.title=r;let i=[],s=this.#Le(t,e.sourceElement,e.selectOOB),n=this.#Ve(t,e);i.push(...s,...n);let o=n.length||s.length&&!this.config.allowEmptySwapAfterOOB,a=this.#De(e,t,o);if(a&&i.unshift(a),!this.#L(e.sourceElement,"htmx:before:swap",{ctx:e,tasks:i}))return;let l=[],h=[];for(let t of i)t.swapSpec?.transition??a?.transition??e.transition?h.push(t):l.push(this.#N(t));if(h.length>0){let t=async()=>{for(let e of h)await this.#N(e,!1)};l.push(this.#$e(t,e))}await Promise.all(l),!e.sourceElement?.isConnected&&a?.target?.isConnected&&(e.sourceElement=a.target),this.#L(e.sourceElement,"htmx:after:swap",{ctx:e}),e.title&&!a?.swapSpec?.ignoreTitle&&(document.title=e.title),this.#Fe(e)}finally{this.#L(e.sourceElement,"htmx:finally:swap",{ctx:e})}}#De(e,t,r){let i=this.#He(e.swap||this.config.defaultSwap);if("delete"===i.style||t.childElementCount>0||t.textContent.trim()||(i.swapEmpty??!r)){if(e.select){let r=t.querySelectorAll(e.select);(t=document.createDocumentFragment()).append(...r)}return this.#D(e.sourceElement)&&(i.show||="top"),{type:"main",fragment:t,target:this.#K(e.sourceElement||document.body,i.target||e.target),swapSpec:i,sourceElement:e.sourceElement,transition:e.transition&&!1!==i.transition}}}async#N(e,t=!0){let{target:r,swapSpec:i,fragment:s}=e;if("string"==typeof r&&(r=document.querySelector(r)),!r)return;"string"==typeof i&&(i=this.#He(i));let n,o=i.style;if("none"===o)return;if("BODY"===s.firstElementChild?.tagName){const e=r===document.body&&o.startsWith("outer");e&&"outerHTML"===o&&(o="outerSync"),i.strip??=!e}if(i.strip&&s.firstElementChild&&(s=document.createDocumentFragment(),s.append(...(e.fragment.firstElementChild.content||e.fragment.firstElementChild).childNodes)),this.#We(r,"htmx-swapping"),t&&e.swapSpec?.swap&&await this.timeout(e.swapSpec?.swap),"delete"===o)return void(r.parentNode&&(this.#Se(r),r.parentNode.removeChild(r)));let a=[],l=i.settle??this.config.defaultSettleDelay,h=r.parentNode;if("innerHTML"===o||"outerHTML"===o&&h){let e=document.activeElement;if(e?.id){let t,r;try{t=e.selectionStart,r=e.selectionEnd}catch(e){}n={elt:e,start:t,end:r}}a=t&&l?this.#Ue(s,r):[]}let c=this.#Te(s),u=[...s.childNodes];try{if("innerHTML"===o){for(const e of r.children)this.#Se(e);r.replaceChildren(...s.childNodes)}else if("textContent"===o){for(const e of r.querySelectorAll("[data-htmx-powered]"))this.#Se(e);r.textContent=s.textContent}else if("outerHTML"===o)h&&(this.#ke(h,r,s),this.#Se(r),h.removeChild(r),r=u[0]||h);else if("outerSync"===o){this.#Qe(r,s.firstElementChild);for(const e of r.children)this.#Se(e);r.replaceChildren(...s.firstElementChild.childNodes),u=[r]}else if("innerMorph"===o)this.#I(r,s,!0),u=[...r.childNodes];else if("outerMorph"===o)this.#I(r,s,!1),u.push(r);else if("beforebegin"===o)h&&this.#ke(h,r,s);else if("afterbegin"===o)this.#ke(r,r.firstChild,s);else if("beforeend"===o)this.#ke(r,null,s);else if("afterend"===o)h&&this.#ke(h,r.nextSibling,s);else{let e=this.#i.get("handle_swap")||[],t=!1;for(const n of e){let e=n(o,r,s,i);if(e){t=!0,Array.isArray(e)&&(u=e);break}}if(!t)throw new Error(`Unknown swap style: ${o}`)}}finally{this.#Je(r,"htmx-swapping")}if(e.target=r,this.#qe(c),n&&!n.elt.matches(":focus")){let e=document.getElementById(n.elt.id);if(e){let t={preventScroll:void 0!==i.focusScroll?!i.focusScroll:!this.config.defaultFocusScroll};this.#Pe(e,t,n.start,n.end)}}this.#L(r,"htmx:before:settle",{task:e,newContent:u,settleTasks:a});for(const e of u)this.#We(e,"htmx-added");if(t&&a.length>0){this.#We(r,"htmx-settling"),await this.timeout(l);for(let e of a)e();this.#Je(r,"htmx-settling")}this.#L(r,"htmx:after:settle",{task:e,newContent:u,settleTasks:a});for(const e of u)this.#Je(e,"htmx-added"),this.process(e),this.#Re(e);this.#je(i,r)}#L(e,t,r={},i=!0){if(r.error){let i=`htmx: ${t}: ${r.error.message??r.error}`;r.error instanceof Error?console.error(i,r.error,{elt:e,detail:r}):console.error(i,{elt:e,detail:r})}else r.warn?console.warn(`htmx: ${t}: ${r.warn}`,{elt:e,detail:r}):this.config.logAll&&console.log(`htmx: ${t}`,{elt:e,detail:r});return e=this.#Xe(e),this.#_(e,t,r),this.trigger(e,this.#z(t),r,i)}#_(e,t,r={}){let i=this.#i.get(t.replace(/:/g,"_"));if(i){r.cancelled=!1;for(const t of i)if(!1===t(e,r)||r.cancelled)return r.cancelled=!0,!1}return!0}timeout(e){if((e=this.parseInterval(e))>0)return new Promise(t=>setTimeout(t,e))}onLoad(e){this.on(this.#z("htmx:after:process"),t=>{e(t.target)})}on(e,t,r){let i,s=document;return void 0===r?(i=e,r=t):(s=this.#Xe(e),i=t),s.addEventListener(i,r),r}find(e,t){return this.#Be(e,t)}findAll(e,t){return this.#be(e,t)}parseInterval(e){if("number"==typeof e)return e;let[,t,r]=e?.match(/^([\d.]+)(ms|s|m)?$/)||[],i=parseFloat(t)*({ms:1,s:1e3,m:6e4}[r]||1);return isNaN(i)?void 0:i}trigger(e,t,r={},i=!0){e=this.#Xe(e);let s=new CustomEvent(t,{detail:r,cancelable:!0,bubbles:i,composed:!0}),n=e?.isConnected?e:document;return!r.cancelled&&n.dispatchEvent(s)}ajax(e,t,r){(!r||r instanceof Element||"string"==typeof r)&&(r={target:r});let i="string"==typeof r.source?document.querySelector(r.source):r.source;if("string"==typeof r.source&&!i)return Promise.reject(new Error("Source not found"));if(r.target){let e=this.#K(document.body,r.target);if(!e)return Promise.reject(new Error("Target not found"));i||=e}i||=document.body;let s=this.#T(i,r.event||{});return Object.assign(s,r),r.target&&(s.target=this.#K(document.body,r.target)),Object.assign(s.request,{action:t,method:e.toUpperCase()}),r.headers&&Object.assign(s.request.headers,r.headers),this.#X(s)}#Ge(e){this.config.history&&(history.state||history.replaceState({htmx:!0},"",location.href),history.pushState({htmx:!0},"",e),this.#L(document,"htmx:after:history:push",{path:e}))}#Ke(e){this.config.history&&(history.replaceState({htmx:!0},"",e),this.#L(document,"htmx:after:history:replace",{path:e}))}async#ze(e,t){if(await this.timeout(1),e??=history.state,!e?.htmx)return;this.#p?.abort(),t=t||location.pathname+location.search;let r=document.querySelector(this.#S("[hx-history-elt]"))||document.body;if(this.#L(document,"htmx:before:history:restore",{path:t,cacheMiss:!0})){if("reload"!==this.config.history)return this.#p=new AbortController,this.ajax("GET",t,{target:r,swap:"outerSync",select:r!==document.body?this.#S("[hx-history-elt]"):void 0,request:{headers:{"HX-History-Restore-Request":"true"},signal:this.#p.signal}});this._loc.reload()}}#Ye(e){let{sourceElement:t,push:r,replace:i,hx:s,response:n}=e;if((s?.pushurl||s?.replaceurl)&&(r=s.pushurl,i=s.replaceurl),null==r&&null==i&&this.#D(t)&&(r="true"),"false"!==r&&!1!==r||(r=null),"false"!==i&&!1!==i||(i=null),!r&&!i)return null;let o=r||i;if("true"===o){let t=n?.raw?.url||e.request.action,r=new URL(t,location.href);o=r.pathname+r.search+(e.request.anchor?"#"+e.request.anchor:"")}return{type:r?"push":"replace",path:o}}#_e(e){if(!this.config.history)return;let t=this.#Ye(e);if(!t)return;let r={history:t,sourceElement:e.sourceElement,response:e.response};this.#L(document,"htmx:before:history:update",r)&&("push"===t.type?this.#Ge(t.path):this.#Ke(t.path),this.#L(document,"htmx:after:history:update",r))}#ve(e){if(e._htmx?.onInitialized)return;let t=this.#v("hx-on"),r=this.config.metaCharacter||":",i=t=>async r=>{try{await this.#k(e,{event:r},`with(event?.detail||{}){${t}}`,!1)}catch(t){"symbol"!=typeof t&&this.#L(e,"htmx:error",{error:t})}};for(let s of e.getAttributeNames()){let n=t.find(e=>s.startsWith(e));if(!n)continue;this.#H(e).onInitialized=!0;let o=s.substring(n.length),a=e.getAttribute(s);if(!o){for(let t of a.split(/;(?=[^;]*->)/)){let r=t.indexOf("->");-1!==r&&this.#O(e,t.substring(0,r).trim(),i(t.substring(r+2).trim()))}continue}if(o[0]!==r)continue;let l=o.substring(1);l.startsWith(r)&&(l="htmx"+r+l.substring(1)),this.#O(e,l,i(a))}}#he(e){let t,r=this.#E(e,"hx-indicator");if(r)t=this.#be(e,r,"hx-indicator");else{if(e===document.body)return[];t=[e]}for(const e of t){let t=this.#$(e);t.rc=(t.rc||0)+1,this.#We(e,this.config.requestClass)}return t}#pe(e){for(let t of e){let e=this.#$(t);e.rc&&--e.rc<=0&&(this.#Je(t,this.config.requestClass),delete e.rc)}}#ce(e){let t=this.#E(e,"hx-disable"),r=[];if(t){r=this.#be(e,t,"hx-disable");for(let e of r){let t=this.#$(e);t.dc=(t.dc||0)+1,e.disabled=!0}}return r}#ge(e){for(const t of e){let e=this.#$(t);e.dc&&--e.dc<=0&&(t.disabled=!1,delete e.dc)}}#C(e,t,r,i,s){if(i&&t&&!t.reportValidity())return;let n=t?new FormData(t):new FormData,o=t?new Set(t.elements):new Set;if(!t){if(i&&e.reportValidity&&!e.reportValidity())return;this.#Ze(e,o,n,s)}r&&r.name&&(n.append(r.name,r.value),o.add(r));let a=this.#E(e,"hx-include");if(a)for(let t of this.#be(e,a)){if(i&&t.reportValidity&&!t.reportValidity())return;this.#Ze(t,o,n)}return n}#Ze(e,t,r,i){let s=e.tagName,n=[];"BUTTON"===s||s.includes("-")?n=[e]:!["INPUT","SELECT","TEXTAREA","FIELDSET"].includes(s)&&i||(n=this.#j(e,"[name]:not(button)"));for(let e of n){let i=e.name||e.getAttribute?.("name");if(!i||e.matches(":disabled")||t.has(e))continue;t.add(e);let s=e.type;if("checkbox"===s||"radio"===s||"INPUT"!==e.tagName&&"checked"in e)e.checked&&r.append(i,e.value);else if("file"===s)for(let t of e.files)r.append(i,t);else if("select-multiple"===s)for(let t of e.selectedOptions)r.append(i,t.value);else if(Array.isArray(e.value))for(let t of e.value)r.append(i,t);else r.append(i,e.value)}}#q(t,r,i,s={}){let n=this.#E(t,r);if(!n)return null;let o=this.#ie(n);if(o)return 0!==o.indexOf("{")&&(o="{"+o+"}"),this.#k(t,s,o,!0).then(e=>{i(e)});i(e.parse(n))}#et(e){let t=e.trim();return t.startsWith("<")&&t.endsWith("/>")?t.slice(1,-2):t}#be(t,r,i,s){let n=r??t,o=r?this.#Xe(t)||document.body:document;if(n.startsWith("global "))return this.#be(o,n.slice(7),i,!0);let a=n?e.split(n):[],l=[],h=[];for(const e of a){let t,r=this.#et(e);if(r.startsWith("closest "))t=o.closest(r.slice(8));else if(r.startsWith("find "))t=o.querySelector(r.slice(5));else if(r.startsWith("findAll "))l.push(...o.querySelectorAll(r.slice(8)));else if("next"===r||"nextElementSibling"===r)t=o.nextElementSibling;else if(r.startsWith("next "))t=this.#tt(o,r.slice(5),!!s);else if("previous"===r||"previousElementSibling"===r)t=o.previousElementSibling;else if(r.startsWith("previous "))t=this.#rt(o,r.slice(9),!!s);else if("document"===r)t=document;else if("window"===r)t=window;else if("body"===r)t=document.body;else if("host"===r)t=o.getRootNode().host;else if("this"===r){if(i){l.push(...this.#F(o,i));continue}t=o}else h.push(r);t&&l.push(t)}if(h.length>0){let e=h.join(","),t=this.#it(o,!!s);l.push(...t.querySelectorAll(e))}return[...new Set(l)]}#tt(e,t,r){return this.#st(this.#it(e,r).querySelectorAll(t),e,Node.DOCUMENT_POSITION_PRECEDING)}#rt(e,t,r){let i=[...this.#it(e,r).querySelectorAll(t)].reverse();return this.#st(i,e,Node.DOCUMENT_POSITION_FOLLOWING)}#st(e,t,r){for(const i of e)if(i.compareDocumentPosition(t)===r)return i}#it(e,t){return e.isConnected&&e.getRootNode?e.getRootNode?.({composed:t}):document}#ee(e,t,r){let i=this.#be(e,t,r)[0];return i||console.warn(`htmx: '${t}' on ${r} did not match any element`,{elt:e,selector:t,attr:r}),i}#Be(e,t,r){return this.#be(e,t,r)[0]}#ie(e){if(null!=e){if(e.startsWith("js:"))return e.substring(3);if(e.startsWith("javascript:"))return e.substring(11)}}#ae(e){let t=this.#H(e);if(t.abortInitialized)return;t.abortInitialized=!0;let r=()=>{this.#oe(e).abort()};e.addEventListener("htmx:abort",r),t.listeners.push({fromElt:e,eventName:"htmx:abort",handler:r})}#I(e,t,r){let{persistentIds:i,idMap:s}=this.#nt(e,t),n=document.createElement("div");n.hidden=!0,document.body.after(n);let o={target:e,idMap:s,persistentIds:i,pantry:n,futureMatches:new WeakSet};r?this.#ot(o,e,t):this.#ot(o,e.parentNode,t,e,e.nextSibling),this.#Se(n),n.remove()}#ot(e,t,r,i=null,s=null){t instanceof HTMLTemplateElement&&r instanceof HTMLTemplateElement&&(t=t.content,r=r.content),i||=t.firstChild;let n=r.firstChild;for(;n;){let r;if(i&&i!=s&&(r=this.#at(e,n,i,s),r&&r!==i)){let o=i;for(;o&&o!==r;){let r=o;o=o.nextSibling,r instanceof Element&&(e.idMap.has(r)||this.#lt(e,r,n))?this.#Ce(t,r,s):this.#ht(e,r)}}if(!r&&n instanceof Element&&e.persistentIds.has(n.id)){let s=CSS.escape(n.id);r=e.target.id===n.id&&e.target||e.target.querySelector(`[id="${s}"]`)||e.pantry.querySelector(`[id="${s}"]`);let o=r;for(;o=o.parentNode;){let t=e.idMap.get(o);t&&(t.delete(r.id),t.size||e.idMap.delete(o))}this.#Ce(t,r,i)}if(r){this.#ct(r,n,e),i=r.nextSibling,n=n.nextSibling;continue}let o=n.nextSibling;if(e.idMap.has(n)){let r=document.createElement(n.tagName);t.insertBefore(r,i),this.#ct(r,n,e),this.process(r),i=r.nextSibling}else t.insertBefore(n,i),i=n.nextSibling;n=o}for(;i&&i!=s;){let t=i;i=i.nextSibling,this.#ht(e,t)}}#lt(e,t,r){if(e.futureMatches.has(t))return!0;for(let i=r.nextSibling,s=0;i&&sa.has(e)))return h;if(!r){if(o>0&&h.isEqualNode(t))return h;s||(s=h)}}if(n+=r?.size||0,n>l)break;if(null!=document.activeElement?.selectionStart&&h.contains(document.activeElement))break;if(--o<1&&0===l)break;h=h.nextSibling}return s&&this.#lt(e,s,t)?null:s}#M(e,t){return e instanceof Element&&e.tagName===t.tagName&&(!("SCRIPT"===e.tagName&&!e.isEqualNode(t))&&(!e.id||e.id===t.id))}#ht(e,t){e.idMap.has(t)?this.#Ce(e.pantry,t,null):(this.#Se(t),t.remove())}#Ce(e,t,r){if(e.moveBefore)try{return void e.moveBefore(t,r)}catch(e){}e.insertBefore(t,r)}#ct(e,t,r){if(3===e.nodeType)return void(e.nodeValue!==t.nodeValue&&(e.nodeValue=t.nodeValue));if(this.config.morphSkip&&e.matches?.(this.config.morphSkip))return;if(!this.#_(e,"htmx:before:morph:node",{oldNode:e,newNode:t}))return;this.#Qe(e,t),e instanceof HTMLTextAreaElement&&document.activeElement!==e&&e.defaultValue!=t.defaultValue&&(e.value=t.value),this.config.morphSkipChildren&&e.matches?.(this.config.morphSkipChildren)||e.isEqualNode(t)&&"TEMPLATE"!==t.tagName&&!t.querySelector?.("template")||this.#ot(r,e,t)}#Qe(e,t){let r=this.config.morphIgnore||[],i=!1,s=e=>this.#v("hx-").some(t=>e.startsWith(t));for(const n of t.attributes)if(!r.some(e=>n.name.startsWith(e))&&e.getAttribute(n.name)!==n.value){if(s(n.name)&&(i=!0),!this.#_(e,"htmx:before:morph:attr",{attrName:n.name,newValue:n.value}))continue;e.setAttribute(n.name,n.value),"value"===n.name&&e instanceof HTMLInputElement&&"file"!==e.type&&document.activeElement!==e&&(e.value=n.value)}for(let n=e.attributes.length-1;n>=0;n--){let o=e.attributes[n];if(o&&!t.hasAttribute(o.name)&&!r.some(e=>o.name.startsWith(e))){if(s(o.name)&&(i=!0),!this.#_(e,"htmx:before:morph:attr",{attrName:o.name,newValue:null}))continue;e.removeAttribute(o.name)}}i&&this.#Se(e,!0)}#ut(e,t,r,i){for(const s of i)if(t.has(s.id)){let t=s;for(;t&&t!==r;){let r=e.get(t);null==r&&(r=new Set,e.set(t,r)),r.add(s.id),t=t.parentElement}}}#nt(e,t){let r=this.#j(e,"[id]"),i=t.querySelectorAll("[id]"),s=this.#dt(r,i),n=new Map;return this.#ut(n,s,e.parentElement,r),this.#ut(n,s,t,i),{persistentIds:s,idMap:n}}#dt(e,t){let r=new Set,i=new Map;for(const{id:t,tagName:s}of e)i.has(t)?r.add(t):t&&i.set(t,s);let s=new Set;for(const{id:e,tagName:n}of t)s.has(e)?r.add(e):i.get(e)===n&&s.add(e);for(const e of r)s.delete(e);return s}#fe(t){let r=t.response.raw.status,i=this.config.noSwap.map(e=>e+""),s=r+"";for(let r of[s,s.slice(0,2)+"x",s[0]+"xx"]){if(i.includes(r))return void(t.swap="none");let s=this.#E(t.sourceElement,"hx-status:"+r);if(s)return void e.merge(s,t)}}#$e(e,t){return new Promise(r=>{this.#m||=[],this.#m.push({task:e,resolve:r,ctx:t}),this.#x||this.#ft()})}async#ft(){if(0===this.#m.length||this.#x)return;this.#x=!0;let{task:e,resolve:t,ctx:r}=this.#m.shift();try{if(document.startViewTransition){let t={task:e,ctx:r};this.#L(r.sourceElement,"htmx:before:viewTransition",t),await document.startViewTransition(t.task).finished,this.#L(r.sourceElement,"htmx:after:viewTransition",t)}else await e()}catch(e){}finally{this.#x=!1,t(),this.#ft()}}#Ue(e,t){let r=t.querySelectorAll("[id]"),i=Object.fromEntries([...r].map(e=>[e.id,e])),s=e.querySelectorAll("[id]"),n=[];for(let e of s){let t=i[e.id];if(t?.tagName===e.tagName){let r=e.cloneNode(!1);this.#Qe(e,t),n.push(()=>{this.#Qe(e,r)})}}return n}#We(e,t){e?.classList?.add?.(t)}#Je(e,t){e?.classList?.remove?.(t),0===e?.classList?.length&&e.removeAttribute("class")}#Xe(e){return"string"==typeof e?this.find(e):e}#z(e){return this.config.metaCharacter?e.replace(/:/g,this.config.metaCharacter):e}}})(); \ No newline at end of file diff --git a/src/Tests/ViewEngine.fs b/src/Tests/ViewEngine.fs index 9f7adac..d29592e 100644 --- a/src/Tests/ViewEngine.fs +++ b/src/Tests/ViewEngine.fs @@ -681,14 +681,14 @@ let script = let html = RenderView.AsString.htmlNode Script.cdnMinified Expect.equal html - $"""""" + $"""""" "CDN minified script tag is incorrect" } test "cdnUnminified succeeds" { let html = RenderView.AsString.htmlNode Script.cdnUnminified Expect.equal html - $"""""" + $"""""" "CDN unminified script tag is incorrect" } testList "Max" [ @@ -703,14 +703,14 @@ let script = let html = RenderView.AsString.htmlNode Script.Max.cdnMinified Expect.equal html - $"""""" + $"""""" "CDN minified script tag is incorrect" } test "cdnMaxUnminified succeeds" { let html = RenderView.AsString.htmlNode Script.Max.cdnUnminified Expect.equal html - $"""""" + $"""""" "CDN unminified script tag is incorrect" } ] diff --git a/src/ViewEngine.Htmx/Htmx.fs b/src/ViewEngine.Htmx/Htmx.fs index c1e80cd..86b4228 100644 --- a/src/ViewEngine.Htmx/Htmx.fs +++ b/src/ViewEngine.Htmx/Htmx.fs @@ -728,14 +728,14 @@ module Script = /// Ensure cdn.jsdelivr.net is in your CSP script-src list (if applicable) let cdnMinified = script [ _src $"https://cdn.jsdelivr.net/npm/htmx.org@{HtmxVersion}/dist/htmx.min.js" - _integrity "sha384-5dnhUXCt1hXGvYrjAnKwgNX3I8xtIJiW6eIHIbeo7oWyXv2XpWYC/rl+ZiWfuYO5" + _integrity "sha384-BvJpBiO8Kh31EqtJe5DRIeWrHWnCGkwytKs9NKFi86Hhw96dEqdEMzZDeK9iEGTc" _crossorigin "anonymous" ] [] /// Script tag to load the unminified version from jsdelivr.net /// Ensure cdn.jsdelivr.net is in your CSP script-src list (if applicable) let cdnUnminified = script [ _src $"https://cdn.jsdelivr.net/npm/htmx.org@{HtmxVersion}/dist/htmx.js" - _integrity "sha384-RZoQSZlu2BAuZMuM5lTKAWXXSKC+7X6eVzP1pwkUBcyfPmOswexqVOsUqQMKbAFA" + _integrity "sha384-ESzWv77gBOAGtF3d7B8QiQ786cghRRsyhuYVVJGsrFGxwT0Dj1fLxReX9Ul6t4n9" _crossorigin "anonymous" ] [] /// Script tags to load the htmax bundle @@ -748,14 +748,14 @@ module Script = /// Ensure cdn.jsdelivr.net is in your CSP script-src list (if applicable) let cdnMinified = script [ _src $"https://cdn.jsdelivr.net/npm/htmx.org@{HtmxVersion}/dist/htmax.min.js" - _integrity "sha384-VVbrNR6a+H8puV17ZlJ8aUUMTgbcDiqM1vlLYEmaaU4oFANllvTK2pLynNonElP+" + _integrity "sha384-F2+P/m0g8+he+KLpgsCVZlZGvOx2z83bU4rmmISSNt7br4A0RTcJ7ddMrz0v45Nv" _crossorigin "anonymous" ] [] /// Script tag to load the unminified htmx-plus-extensions bundle from jsdelivr.net /// Ensure cdn.jsdelivr.net is in your CSP script-src list (if applicable) let cdnUnminified = script [ _src $"https://cdn.jsdelivr.net/npm/htmx.org@{HtmxVersion}/dist/htmax.js" - _integrity "sha384-kjhVuvnX3/TsR1qH4JaIcHR6muh/WLMU5CTQRacCQZERzQlP4/r9p/TK7ucFwqvV" + _integrity "sha384-wrTFbAj755gAdIPPR9n4aAVMkLWkzxjr1Zj+8D4kgr2App4h9doO6SXBH9wpivij" _crossorigin "anonymous" ] [] -- 2.54.0 From 935e5ca9f4b9834b6cfc02a30b744cdaf95b6b6b Mon Sep 17 00:00:00 2001 From: "Daniel J. Summers" Date: Mon, 31 Aug 2026 20:00:54 -0400 Subject: [PATCH 3/3] Update READMEs --- README.md | 10 +++++----- src/Common/README.md | 2 +- src/Htmx/README.md | 4 ++-- src/ViewEngine.Htmx/README.md | 10 ++++------ 4 files changed, 12 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index 5c93514..3612292 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ Both of these packages will also install `Giraffe.Htmx.Common`, which has some c ## Server Side (`Giraffe.Htmx`) -In addition to the regular HTTP request payloads, htmx sets [one or more headers](https://htmx.org/docs/#request_headers) along with the request. Once `Giraffe.Htmx` is opened, these are available as properties on `HttpContext.Request.Headers`. These consist of the header name, translated to a .NET name (ex. `HX-Current-URL` becomes `HxCurrentUrl`), and a strongly-typed property based on the expected value of that header. Additionally, they are all exposed as `Option`s, as they may or may not be present for any given request. +In addition to the regular HTTP request payloads, htmx sets [one or more headers](https://four.htmx.org/reference/headers#request) along with the request. Once `Giraffe.Htmx` is opened, these are available as properties on `HttpContext.Request.Headers`. These consist of the header name, translated to a .NET name (ex. `HX-Current-URL` becomes `HxCurrentUrl`), and a strongly-typed property based on the expected value of that header. Additionally, they are all exposed as `Option`s, as they may or may not be present for any given request. A server may want to respond to a request that originated from htmx differently than a regular request. One way htmx can provide the same feel as a Single Page Application (SPA) is by swapping out the `body` content (or an element within it) instead of reloading the entire page. In this case, the developer can provide a partial layout to be used for these responses, while returning the full page for regular requests. The `IsHtmx` property makes this easy... @@ -33,7 +33,7 @@ let result view : HttpHandler = full view ``` -htmx also utilizes [response headers](https://htmx.org/docs/#response_headers) to affect client-side behavior. For each of these, this library provides `HttpHandler`s that can be chained along with the response. As an example, if the server returns a redirect response (301, 302, 303, 307), the `XMLHttpRequest` handler on the client will follow the redirection before htmx can do anything with it. To redirect to a new page, you would return an OK (200) response with an `HX-Redirect` header set in the response. +htmx also utilizes [response headers](https://four.htmx.org/reference/headers#response) to affect client-side behavior. For each of these, this library provides `HttpHandler`s that can be chained along with the response. As an example, if the server returns a redirect response (301, 302, 303, 307), the `fetch` handler on the client may follow the redirection before htmx can do anything with it. To redirect to a new page, you would return an OK (200) response with an `HX-Redirect` header set in the response. ```fsharp let theHandler : HttpHandler = @@ -44,11 +44,11 @@ let theHandler : HttpHandler = Of note is that the `HX-Trigger` headers can take either one or more events. For a single event with no parameters, use `withHxTrigger`; for a single event with parameters, or multiple events, use `withHxTriggerMany`. Both these have `AfterSettle` and `AfterSwap` versions as well. -`HtmxScript.local` provides an `HtmlString` with a script tag to load the package-provided htmx library. This can be used in code, Razor templates, etc. (If you're using Giraffe.ViewEngine, see below.) +`HtmxScript.local` provides an `HtmlString` with a script tag to load the package-provided htmx library, along with `localMax` to load the htmx-plus-extensions bundle. This can be used in code, Razor templates, etc. (If you're using Giraffe.ViewEngine, see below.) ## View Engine (`Giraffe.ViewEngine.Htmx`) -As htmx uses [attributes](https://htmx.org/docs/#attributes) to extend HTML, the primary part of this library defines attributes that can be used within Giraffe views. Simply open `Giraffe.ViewEngine.Htmx`, and these attributes, along with support modules, will be visible. +As htmx uses [attributes](https://four.htmx.org/reference/attributes) to extend HTML, the primary part of this library defines attributes that can be used within Giraffe views. Simply open `Giraffe.ViewEngine.Htmx`, and these attributes, along with support modules, will be visible. As an example, creating a `div` that loads data once the HTML is rendered: @@ -70,7 +70,7 @@ let shiftClick = ] ``` -If you want to use the package-provided htmx library, `Htmx.Script.local` will create the `script` tag for you. To load htmx from jsDelivr, `Htmx.Script.cdnMinified` or `Htmx.Script.cdnUnminified` can be used to load the script in your HTML trees. In this case, if you are using a Content Security Policy (CSP) header, `cdn.jsdelivr.net` will need to be added to the `script-src` list. +If you want to use the package-provided htmx library, `Htmx.Script.local` will create the `script` tag for you (as well as `Htmx.Script.Max.local` to load the htmax bundle). To load htmx from jsDelivr, `Htmx.Script.cdnMinified` or `Htmx.Script.cdnUnminified` can be used to load the script in your HTML trees (these also have `.Max` variants). In this case, if you are using a Content Security Policy (CSP) header, `cdn.jsdelivr.net` will need to be added to the `script-src` list. ## Feedback / Help diff --git a/src/Common/README.md b/src/Common/README.md index 9e750f1..cebce65 100644 --- a/src/Common/README.md +++ b/src/Common/README.md @@ -2,6 +2,6 @@ This package contains common code shared between [`Giraffe.Htmx`](https://www.nuget.org/packages/Giraffe.Htmx) and [`Giraffe.ViewEngine.Htmx`](https://www.nuget.org/packages/Giraffe.ViewEngine.Htmx), and will be automatically installed when you install either one. It also contains htmx and htmax as static web assets, allowing them to be loaded from your local (or published) project. -**htmx version: 4.0.0-beta5** +**htmx version: 4.0.0** _**NOTE:** Pay special attention to breaking changes highlighted in the packages listed above._ \ No newline at end of file diff --git a/src/Htmx/README.md b/src/Htmx/README.md index b10d3e9..2658332 100644 --- a/src/Htmx/README.md +++ b/src/Htmx/README.md @@ -2,9 +2,9 @@ This package enables server-side support for [htmx](https://htmx.org) within [Giraffe](https://giraffe.wiki) and ASP.NET's `HttpContext`. -**htmx version: 4.0.0-beta5** +**htmx version: 4.0.0** -_Upgrading from v2.x: the [migration guide](https://four.htmx.org/docs/get-started/migration) lists changes for v4. For this package, the `HX-Trigger` and `HX-Trigger-Name` headers are marked obsolete. They are replaced by `HX-Source`, which provides the triggering tag name and `id` attribute. The `HX-Prompt` header has also been marked as obsolete, as the `hx-prompt` attribute which generated its content has been removed._ +_Upgrading from v2.x: the [migration guide](https://four.htmx.org/docs#migrating-from-htmx-2x-to-4x) lists changes for v4. For this package, the `HX-Trigger` and `HX-Trigger-Name` headers are marked obsolete. They are replaced by `HX-Source`, which provides the triggering tag name and `id` attribute. The `HX-Prompt` header has also been marked as obsolete, as the `hx-prompt` attribute which generated its content has been removed._ _Obsolete elements will be removed in the first production v4 release._ diff --git a/src/ViewEngine.Htmx/README.md b/src/ViewEngine.Htmx/README.md index ae64d82..01f90c7 100644 --- a/src/ViewEngine.Htmx/README.md +++ b/src/ViewEngine.Htmx/README.md @@ -2,13 +2,13 @@ This package enables [htmx](https://htmx.org) support within the [Giraffe](https://giraffe.wiki) view engine. -**htmx version: 4.0.0-beta5** +**htmx version: 4.0.0** -_Upgrading from v2.x: see [the migration guide](https://four.htmx.org/docs/get-started/migration) for changes, which are plentiful. htmx switches from `XMLHTTPRequest` to `fetch`, and many changes are related to the new event cycle._ +_Upgrading from v2.x: see [the migration guide](https://four.htmx.org/docs#migrating-from-htmx-2x-to-4x) for changes, which are plentiful. htmx switches from `XMLHTTPRequest` to `fetch`, and many changes are related to the new event cycle._ _Inheritance is now explicit; to have an attribute's value inherited to its children, wrap the attribute in `hxInherited` (ex. `hxInherited (_hxTarget "#main")`). Values can be appended to inherited values as well using the `hxAppend` modifier._ -_Several constructs have been marked obsolete in this release, and will be removed from the first production release of v4. With the exception of `_hxDisable`, though (which now functions as the deprecated `_hxDisabledElt` did), this should not introduce compile errors. Rather, this package will raise warnings for deprecated constructs, along with suggestions of what to use instead._ +_Several constructs have been removed in this release. If you encounter compile errors, install version `4.0.0-beta5`; it will instead flag these with warnings and suggestions on how to mitigate them. Once the warnings are gone, you can reinstall this version._ ### Setup @@ -26,11 +26,9 @@ let autoload = ``` Support modules include: -- `HxConfig` _(new in v4)_ +- `HxConfig` _(new in v4, replaces `HxRequest`)_ - `HxEncoding` - `HxHeaders` -- ~~`HxParams`~~ _(removed in v4)_ -- ~~`HxRequest`~~ _(renamed to `HxConfig`)_ - `HxSwap` (requires `open Giraffe.Htmx`) - `HxTrigger` - `HxVals` -- 2.54.0