The only tool you need to know what is happening and how to fix it.
Go alertingexception-trackerissue-trackinglogsmetricsmonitoringobservability-platformopen-telemetryotelsession-replaytelemetrytraces
feat: implemented full session recording - not fully tested on clickhouse yet
ddux2c4f3908ab2f
diff --git a/backend/app/controllers/clientcontrollers/client.controller.go b/backend/app/controllers/clientcontrollers/client.controller.goindex be6b5fc6..ebac5896 100644--- a/backend/app/controllers/clientcontrollers/client.controller.go+++ b/backend/app/controllers/clientcontrollers/client.controller.go@@ -82,11 +82,16 @@ func (e clientController) Report(c *gin.Context) {exceptionStackTraceToInsert := []models.ExceptionStackTrace{}metricPointsToInsert := []models.MetricPoint{}spansToInsert := []models.Span{}+ sessionsToUpsert := []models.Session{}type recordingWork struct {- Id uuid.UUID- ProjectId uuid.UUID- ExceptionId uuid.UUID+ Id uuid.UUID+ ProjectId uuid.UUID+ ExceptionId uuid.UUID+ SessionId *uuid.UUID+ SegmentIndex int32+ // Key is the S3 object key the body is written to.+ Key string// Body is the marshaled JSON of the entire ClientSessionRecording// sub-document — events + logs + actions + startedAt/endedAt — exactly// as it lands in S3. App console logs in `logs` are intentionally not@@ -96,11 +101,30 @@ func (e clientController) Report(c *gin.Context) {}var recordingsWork []recordingWork- // Map frontend sessionRecordingId → backend-generated exception UUID+ // Map frontend sessionRecordingId → backend-generated exception UUID.+ // Used only for the legacy exception-bound recording path; the always-on+ // session linkage uses the SDK-supplied sessionId UUID directly (it IS+ // the session row id by design, so no in-request map is needed).recordingIdToExceptionId := map[string]uuid.UUID{}convertSpan := traceway.StartSpan(c, "report.convert_frames")for _, cf := range request.CollectionFrames {+ for _, cs := range cf.Sessions {+ s := cs.ToSession(request.AppVersion, request.ServerName)+ s.ProjectId = projectId+ // The SDK can't see the public-facing IP; we stamp it server-side+ // into the attributes blob so the dashboard surfaces it alongside+ // browser/url/viewport collected by the SDK.+ if clientIP := c.ClientIP(); clientIP != "" {+ if s.Attributes == nil {+ s.Attributes = map[string]string{}+ }+ s.Attributes["client.ip"] = clientIP+ s.ClientIP = clientIP+ }+ sessionsToUpsert = append(sessionsToUpsert, s)+ }+for _, ct := range cf.Traces {if ct.IsTask {t := ct.ToTask(request.AppVersion, request.ServerName)@@ -157,6 +181,15 @@ func (e clientController) Report(c *gin.Context) {if cst.SessionRecordingId != nil {recordingIdToExceptionId[*cst.SessionRecordingId] = est.Id}+ // The SDK-provided session UID is the session row id by design, so+ // parse it directly. The parent `sessions` row may have been+ // upserted in an earlier request — we don't require it in this+ // batch.+ if cst.SessionId != nil {+ if parsed, err := uuid.Parse(*cst.SessionId); err == nil {+ est.SessionId = &parsed+ }+ }exceptionStackTraceToInsert = append(exceptionStackTraceToInsert, est)}resolveSpan.End()@@ -168,13 +201,25 @@ func (e clientController) Report(c *gin.Context) {}for _, sr := range cf.SessionRecordings {- exceptionId, ok := recordingIdToExceptionId[sr.ExceptionId]- if !ok {+ // A recording can be exception-bound (legacy path), session-bound+ // (always-on path), or both. Exception linkage requires the+ // exception to be in this batch; session linkage doesn't, since+ // the SDK-provided sessionId is the session row id by design.+ var exceptionId uuid.UUID+ if sr.ExceptionId != "" {+ if id, ok := recordingIdToExceptionId[sr.ExceptionId]; ok {+ exceptionId = id+ }+ }+ var sessionPtr *uuid.UUID+ if sr.SessionId != "" {+ if parsed, err := uuid.Parse(sr.SessionId); err == nil {+ sessionPtr = &parsed+ }+ }+ if exceptionId == uuid.Nil && sessionPtr == nil {continue}- // Skip recordings that carry no payload at all. The SDK shouldn't- // be sending these, but be defensive — an empty recording would- // just be a wasted S3 write and an empty session_recordings row.if isEmptyRaw(sr.Events) && isEmptyRaw(sr.Logs) && isEmptyRaw(sr.Actions) {continue}@@ -183,12 +228,21 @@ func (e clientController) Report(c *gin.Context) {traceway.CaptureException(traceway.NewStackTraceErrorf("failed to marshal session recording: %w", err))continue}+ var key string+ if sessionPtr != nil {+ key = fmt.Sprintf("recordings/%s/sessions/%s/%d.json", projectId, sessionPtr.String(), sr.SegmentIndex)+ } else {+ key = fmt.Sprintf("recordings/%s/%s.json", projectId, exceptionId)+ }recordingsWork = append(recordingsWork, recordingWork{- Id: uuid.New(),- ProjectId: projectId,- ExceptionId: exceptionId,- Body: body,- RecordedAt: time.Now().UTC(),+ Id: uuid.New(),+ ProjectId: projectId,+ ExceptionId: exceptionId,+ SessionId: sessionPtr,+ SegmentIndex: sr.SegmentIndex,+ Key: key,+ Body: body,+ RecordedAt: time.Now().UTC(),})}}@@ -217,6 +271,16 @@ func (e clientController) Report(c *gin.Context) {}}+ if len(sessionsToUpsert) > 0 {+ insertSpan := traceway.StartSpan(c, "report.upsert.sessions")+ err := repositories.SessionRepository.Upsert(c, sessionsToUpsert)+ insertSpan.End()+ if err != nil {+ c.AbortWithError(500, traceway.NewStackTraceErrorf("error upserting sessions: %w", err))+ return+ }+ }+exceptionInsertSpan := traceway.StartSpan(c, "report.insert.exceptions")err = repositories.ExceptionStackTraceRepository.InsertAsync(c, exceptionStackTraceToInsert)exceptionInsertSpan.End()@@ -276,17 +340,18 @@ func (e clientController) Report(c *gin.Context) {go func() {var successful []models.SessionRecordingfor _, rw := range work {- key := fmt.Sprintf("recordings/%s/%s.json", rw.ProjectId, rw.ExceptionId)- if err := storage.Store.Write(context.Background(), key, rw.Body); err != nil {- traceway.CaptureException(traceway.NewStackTraceErrorf("failed to write session recording (key=%s): %w", key, err))+ if err := storage.Store.Write(context.Background(), rw.Key, rw.Body); err != nil {+ traceway.CaptureException(traceway.NewStackTraceErrorf("failed to write session recording (key=%s): %w", rw.Key, err))continue}successful = append(successful, models.SessionRecording{- Id: rw.Id,- ProjectId: rw.ProjectId,- ExceptionId: rw.ExceptionId,- FilePath: key,- RecordedAt: rw.RecordedAt,+ Id: rw.Id,+ ProjectId: rw.ProjectId,+ ExceptionId: rw.ExceptionId,+ SessionId: rw.SessionId,+ SegmentIndex: rw.SegmentIndex,+ FilePath: rw.Key,+ RecordedAt: rw.RecordedAt,})}if len(successful) > 0 {diff --git a/backend/app/controllers/exception_stack_trace.controller.go b/backend/app/controllers/exception_stack_trace.controller.goindex 15d9189d..d6cc0567 100644--- a/backend/app/controllers/exception_stack_trace.controller.go+++ b/backend/app/controllers/exception_stack_trace.controller.go@@ -46,6 +46,10 @@ type ExceptionDetailResponse struct {Occurrences []models.ExceptionStackTrace `json:"occurrences"`Pagination Pagination `json:"pagination"`SessionRecording json.RawMessage `json:"sessionRecording,omitempty"`+ // SessionId is set when the exception is linked to a parent session row+ // (always-on recording). The frontend swaps SessionRecording for a fetch+ // against `/sessions/:sessionId/recording`, which spans every segment.+ SessionId *uuid.UUID `json:"sessionId,omitempty"`}// wrapLegacyRecording handles the case where a recording in blob storage was@@ -177,6 +181,9 @@ func (e exceptionStackTraceController) FindByHash(c *gin.Context) {}if len(occurrences) > 0 {+ // The per-exception 10 s clip and the parent session are independent+ // attachments — surface both whenever they exist. The dashboard plays+ // the clip inline and renders a link to the full session.filePath, err := repositories.SessionRecordingRepository.FindByExceptionId(c, projectId, occurrences[0].Id)if err == nil && filePath != "" {recording, err := loadSessionRecording(c, filePath)@@ -188,6 +195,11 @@ func (e exceptionStackTraceController) FindByHash(c *gin.Context) {} else if err != nil && !errors.Is(err, sql.ErrNoRows) {traceway.CaptureException(fmt.Errorf("failed to load session recording ref for exception %s: %w", occurrences[0].Id, err))}++ sessionId, err := repositories.ExceptionStackTraceRepository.GetSessionIdForException(c, projectId, occurrences[0].Id)+ if err == nil && sessionId != nil {+ response.SessionId = sessionId+ }}c.JSON(http.StatusOK, response)@@ -287,6 +299,11 @@ func (e exceptionStackTraceController) FindById(c *gin.Context) {traceway.CaptureException(fmt.Errorf("failed to load session recording ref for exception %s: %w", exceptionId, err))}+ sessionId, err := repositories.ExceptionStackTraceRepository.GetSessionIdForException(c, projectId, exceptionId)+ if err == nil && sessionId != nil {+ response["sessionId"] = sessionId+ }+c.JSON(http.StatusOK, response)}diff --git a/backend/app/controllers/routes.go b/backend/app/controllers/routes.goindex 68c4c1da..6707c182 100644--- a/backend/app/controllers/routes.go+++ b/backend/app/controllers/routes.go@@ -89,6 +89,11 @@ func RegisterControllers(router *gin.RouterGroup) {router.POST("/tasks/task", middleware.UseAppAuth, middleware.RequireProjectAccess, TaskController.FindByTaskName)router.POST("/tasks/:taskId", middleware.UseAppAuth, middleware.RequireProjectAccess, TaskDetailController.GetTaskDetail)+ // Sessions (projectId in body / query)+ router.POST("/sessions", middleware.UseAppAuth, middleware.RequireProjectAccess, SessionController.FindAllSessions)+ router.POST("/sessions/:sessionId", middleware.UseAppAuth, middleware.RequireProjectAccess, SessionDetailController.GetSessionDetail)+ router.GET("/sessions/:sessionId/recording", middleware.UseAppAuth, middleware.RequireProjectAccess, SessionDetailController.GetSessionRecording)+// AI Traces (projectId in body)router.POST("/ai-traces/grouped", middleware.UseAppAuth, middleware.RequireProjectAccess, AiTraceController.FindGroupedByTraceName)router.POST("/ai-traces/trace", middleware.UseAppAuth, middleware.RequireProjectAccess, AiTraceController.FindByTraceName)diff --git a/backend/app/controllers/session.controller.go b/backend/app/controllers/session.controller.gonew file mode 100644index 00000000..ff38562f--- /dev/null+++ b/backend/app/controllers/session.controller.go@@ -0,0 +1,72 @@+package controllers++import (+ "net/http"+ "time"++ "github.com/tracewayapp/traceway/backend/app/middleware"+ "github.com/tracewayapp/traceway/backend/app/models"+ "github.com/tracewayapp/traceway/backend/app/repositories"++ "github.com/gin-gonic/gin"+ traceway "go.tracewayapp.com"+)++type sessionController struct{}++type SessionAttributeFilter struct {+ Key string `json:"key"`+ Value string `json:"value"`+}++type SessionSearchRequest struct {+ FromDate time.Time `json:"fromDate"`+ ToDate time.Time `json:"toDate"`+ OrderBy string `json:"orderBy"`+ SortDirection string `json:"sortDirection"`+ Search string `json:"search"`+ AttributeFilters []SessionAttributeFilter `json:"attributeFilters"`+ Pagination PaginationParams `json:"pagination"`+}++func (s sessionController) FindAllSessions(c *gin.Context) {+ projectId, err := middleware.GetProjectId(c)+ if err != nil {+ c.AbortWithError(http.StatusInternalServerError, traceway.NewStackTraceErrorf("RequireProjectAccess middleware must be applied: %w", err))+ return+ }++ var request SessionSearchRequest+ if err := c.ShouldBindJSON(&request); err != nil {+ c.JSON(http.StatusBadRequest, gin.H{"error": err.Error()})+ return+ }++ filters := make([]repositories.SessionAttributeFilter, 0, len(request.AttributeFilters))+ for _, f := range request.AttributeFilters {+ if f.Key == "" {+ continue+ }+ filters = append(filters, repositories.SessionAttributeFilter{Key: f.Key, Value: f.Value})+ }++ span := traceway.StartSpan(c, "loading sessions")+ sessions, total, err := repositories.SessionRepository.FindAll(c, projectId, request.FromDate, request.ToDate, request.Pagination.Page, request.Pagination.PageSize, request.OrderBy, request.SortDirection, request.Search, filters)+ span.End()+ if err != nil {+ c.AbortWithError(500, traceway.NewStackTraceErrorf("error loading sessions: %w", err))+ return+ }++ c.JSON(http.StatusOK, PaginatedResponse[models.Session]{+ Data: sessions,+ Pagination: Pagination{+ Page: request.Pagination.Page,+ PageSize: request.Pagination.PageSize,+ Total: total,+ TotalPages: (total + int64(request.Pagination.PageSize) - 1) / int64(request.Pagination.PageSize),+ },+ })+}++var SessionController = sessionController{}diff --git a/backend/app/controllers/session_detail.controller.go b/backend/app/controllers/session_detail.controller.gonew file mode 100644index 00000000..8cb3f752--- /dev/null+++ b/backend/app/controllers/session_detail.controller.go@@ -0,0 +1,172 @@+package controllers++import (+ "context"+ "encoding/json"+ "net/http"+ "time"++ "github.com/tracewayapp/traceway/backend/app/middleware"+ "github.com/tracewayapp/traceway/backend/app/models"+ "github.com/tracewayapp/traceway/backend/app/repositories"+ "github.com/tracewayapp/traceway/backend/app/storage"++ "github.com/gin-gonic/gin"+ "github.com/google/uuid"+ traceway "go.tracewayapp.com"+)++type sessionDetailController struct{}++type SessionExceptionInfo struct {+ Id uuid.UUID `json:"id"`+ ExceptionHash string `json:"exceptionHash"`+ StackTrace string `json:"stackTrace"`+ RecordedAt string `json:"recordedAt"`+ IsMessage bool `json:"isMessage"`+}++type SessionDetailResponse struct {+ Session *models.Session `json:"session"`+ Exceptions []SessionExceptionInfo `json:"exceptions"`+}++// SessionRecordingPayload is the shape consumed by the frontend SessionReplay+// component. We concatenate rrweb event arrays from every segment ordered by+// segment_index, plus union the optional logs/actions arrays. Logs/actions are+// kept as raw JSON since the backend never inspects them.+type SessionRecordingPayload struct {+ Events []json.RawMessage `json:"events"`+ Logs []json.RawMessage `json:"logs,omitempty"`+ Actions []json.RawMessage `json:"actions,omitempty"`+ StartedAt *time.Time `json:"startedAt,omitempty"`+ EndedAt *time.Time `json:"endedAt,omitempty"`+}++func (s sessionDetailController) GetSessionDetail(c *gin.Context) {+ projectId, err := middleware.GetProjectId(c)+ if err != nil {+ c.AbortWithError(http.StatusInternalServerError, traceway.NewStackTraceErrorf("RequireProjectAccess middleware must be applied: %w", err))+ return+ }++ sessionId, err := uuid.Parse(c.Param("sessionId"))+ if err != nil {+ c.JSON(http.StatusBadRequest, gin.H{"error": "Invalid sessionId"})+ return+ }++ span := traceway.StartSpan(c, "loading session")+ session, err := repositories.SessionRepository.FindById(c, projectId, sessionId)+ span.End()+ if err != nil {+ c.AbortWithError(500, traceway.NewStackTraceErrorf("error loading session: %w", err))+ return+ }+ if session == nil {+ c.JSON(http.StatusNotFound, gin.H{"error": "Session not found"})+ return+ }++ span = traceway.StartSpan(c, "loading session exceptions")+ exceptions, err := repositories.ExceptionStackTraceRepository.FindAllBySessionId(c, projectId, sessionId)+ span.End()+ if err != nil {+ c.AbortWithError(500, traceway.NewStackTraceErrorf("error loading session exceptions: %w", err))+ return+ }++ out := make([]SessionExceptionInfo, 0, len(exceptions))+ for _, e := range exceptions {+ out = append(out, SessionExceptionInfo{+ Id: e.Id,+ ExceptionHash: e.ExceptionHash,+ StackTrace: e.StackTrace,+ RecordedAt: e.RecordedAt.Format("2006-01-02T15:04:05Z07:00"),+ IsMessage: e.IsMessage,+ })+ }++ c.JSON(http.StatusOK, SessionDetailResponse{+ Session: session,+ Exceptions: out,+ })+}++func (s sessionDetailController) GetSessionRecording(c *gin.Context) {+ projectId, err := middleware.GetProjectId(c)+ if err != nil {+ c.AbortWithError(http.StatusInternalServerError, traceway.NewStackTraceErrorf("RequireProjectAccess middleware must be applied: %w", err))+ return+ }++ sessionId, err := uuid.Parse(c.Param("sessionId"))+ if err != nil {+ c.JSON(http.StatusBadRequest, gin.H{"error": "Invalid sessionId"})+ return+ }++ span := traceway.StartSpan(c, "loading session segments")+ segments, err := repositories.SessionRecordingRepository.FindBySessionId(c, projectId, sessionId)+ span.End()+ if err != nil {+ c.AbortWithError(500, traceway.NewStackTraceErrorf("error loading session segments: %w", err))+ return+ }++ payload := SessionRecordingPayload{+ Events: []json.RawMessage{},+ }++ type segmentBody struct {+ Events json.RawMessage `json:"events"`+ Logs json.RawMessage `json:"logs"`+ Actions json.RawMessage `json:"actions"`+ StartedAt *time.Time `json:"startedAt"`+ EndedAt *time.Time `json:"endedAt"`+ }++ for _, seg := range segments {+ raw, err := storage.Store.Read(context.Background(), seg.FilePath)+ if err != nil {+ traceway.CaptureException(traceway.NewStackTraceErrorf("failed to read session segment (key=%s): %w", seg.FilePath, err))+ continue+ }+ var body segmentBody+ if err := json.Unmarshal(raw, &body); err != nil {+ traceway.CaptureException(traceway.NewStackTraceErrorf("failed to parse session segment (key=%s): %w", seg.FilePath, err))+ continue+ }++ if len(body.Events) > 0 {+ var events []json.RawMessage+ if err := json.Unmarshal(body.Events, &events); err == nil {+ payload.Events = append(payload.Events, events...)+ }+ }+ if len(body.Logs) > 0 {+ var logs []json.RawMessage+ if err := json.Unmarshal(body.Logs, &logs); err == nil {+ payload.Logs = append(payload.Logs, logs...)+ }+ }+ if len(body.Actions) > 0 {+ var actions []json.RawMessage+ if err := json.Unmarshal(body.Actions, &actions); err == nil {+ payload.Actions = append(payload.Actions, actions...)+ }+ }+ if body.StartedAt != nil && (payload.StartedAt == nil || body.StartedAt.Before(*payload.StartedAt)) {+ t := *body.StartedAt+ payload.StartedAt = &t+ }+ if body.EndedAt != nil && (payload.EndedAt == nil || body.EndedAt.After(*payload.EndedAt)) {+ t := *body.EndedAt+ payload.EndedAt = &t+ }+ }++ c.JSON(http.StatusOK, payload)+}++var SessionDetailController = sessionDetailController{}diff --git a/backend/app/middleware/use_gzip_decompress.middleware.go b/backend/app/middleware/use_gzip_decompress.middleware.goindex c1e91d15..47c73bde 100644--- a/backend/app/middleware/use_gzip_decompress.middleware.go+++ b/backend/app/middleware/use_gzip_decompress.middleware.go@@ -8,8 +8,13 @@ import ()func UseGzip(c *gin.Context) {+ // Decompress when Content-Encoding announces gzip; otherwise pass the+ // body through untouched. The pagehide / keepalive code path in the SDK+ // has to dispatch the request synchronously inside the unload handler,+ // which means it can't `await` the async CompressionStream — those+ // requests arrive as plain JSON and we accept them as-is.if c.GetHeader("Content-Encoding") != "gzip" {- c.AbortWithStatus(http.StatusBadRequest)+ c.Next()return}diff --git a/backend/app/migrations/ch/0049_create_sessions.up.sql b/backend/app/migrations/ch/0049_create_sessions.up.sqlnew file mode 100644index 00000000..074e7519--- /dev/null+++ b/backend/app/migrations/ch/0049_create_sessions.up.sql@@ -0,0 +1,19 @@+CREATE TABLE IF NOT EXISTS sessions+(+ `id` UUID,+ `project_id` UUID,+ `started_at` DateTime,+ `ended_at` Nullable(DateTime) DEFAULT NULL,+ `duration` Int64 DEFAULT 0,+ `client_ip` String DEFAULT '',+ `attributes` String DEFAULT '{}',+ `app_version` LowCardinality(String) DEFAULT '',+ `server_name` LowCardinality(String) DEFAULT '',+ `distributed_trace_id` Nullable(UUID) DEFAULT NULL,+ `version` DateTime64(3) DEFAULT now64(3),+ INDEX idx_session_id id TYPE bloom_filter(0.001) GRANULARITY 1+)+ENGINE = ReplacingMergeTree(version)+PARTITION BY toYYYYMMDD(started_at)+ORDER BY (project_id, id)+SETTINGS index_granularity = 8192diff --git a/backend/app/migrations/ch/0050_add_session_id_to_session_recordings.up.sql b/backend/app/migrations/ch/0050_add_session_id_to_session_recordings.up.sqlnew file mode 100644index 00000000..6a8210a0--- /dev/null+++ b/backend/app/migrations/ch/0050_add_session_id_to_session_recordings.up.sql@@ -0,0 +1 @@+ALTER TABLE session_recordings ADD COLUMN session_id Nullable(UUID) DEFAULT NULLdiff --git a/backend/app/migrations/ch/0051_add_segment_index_to_session_recordings.up.sql b/backend/app/migrations/ch/0051_add_segment_index_to_session_recordings.up.sqlnew file mode 100644index 00000000..7836d1ec--- /dev/null+++ b/backend/app/migrations/ch/0051_add_segment_index_to_session_recordings.up.sql@@ -0,0 +1 @@+ALTER TABLE session_recordings ADD COLUMN segment_index Int32 DEFAULT 0diff --git a/backend/app/migrations/ch/0052_add_session_id_to_exception_stack_traces.up.sql b/backend/app/migrations/ch/0052_add_session_id_to_exception_stack_traces.up.sqlnew file mode 100644index 00000000..d100a6d1--- /dev/null+++ b/backend/app/migrations/ch/0052_add_session_id_to_exception_stack_traces.up.sql@@ -0,0 +1 @@+ALTER TABLE exception_stack_traces ADD COLUMN session_id Nullable(UUID) DEFAULT NULLdiff --git a/backend/app/migrations/ch/0053_add_session_id_index_session_recordings.up.sql b/backend/app/migrations/ch/0053_add_session_id_index_session_recordings.up.sqlnew file mode 100644index 00000000..3f48509b--- /dev/null+++ b/backend/app/migrations/ch/0053_add_session_id_index_session_recordings.up.sql@@ -0,0 +1 @@+ALTER TABLE session_recordings ADD INDEX idx_recordings_session_id session_id TYPE bloom_filter(0.001) GRANULARITY 1diff --git a/backend/app/migrations/ch/0054_add_session_id_index_exception_stack_traces.up.sql b/backend/app/migrations/ch/0054_add_session_id_index_exception_stack_traces.up.sqlnew file mode 100644index 00000000..6d0ccc63--- /dev/null+++ b/backend/app/migrations/ch/0054_add_session_id_index_exception_stack_traces.up.sql@@ -0,0 +1 @@+ALTER TABLE exception_stack_traces ADD INDEX idx_exceptions_session_id session_id TYPE bloom_filter(0.001) GRANULARITY 1diff --git a/backend/app/migrations/ch/0055_drop_sessions.up.sql b/backend/app/migrations/ch/0055_drop_sessions.up.sqlnew file mode 100644index 00000000..63e35bf3--- /dev/null+++ b/backend/app/migrations/ch/0055_drop_sessions.up.sql@@ -0,0 +1 @@+DROP TABLE IF EXISTS sessionsdiff --git a/backend/app/migrations/ch/0056_create_sessions_v2.up.sql b/backend/app/migrations/ch/0056_create_sessions_v2.up.sqlnew file mode 100644index 00000000..edee85c5--- /dev/null+++ b/backend/app/migrations/ch/0056_create_sessions_v2.up.sql@@ -0,0 +1,21 @@+CREATE TABLE IF NOT EXISTS sessions+(+ `id` UUID,+ `project_id` UUID,+ `started_at` DateTime,+ `ended_at` Nullable(DateTime) DEFAULT NULL,+ `duration` Int64 DEFAULT 0,+ `client_ip` String DEFAULT '',+ `attributes` Map(LowCardinality(String), String),+ `app_version` LowCardinality(String) DEFAULT '',+ `server_name` LowCardinality(String) DEFAULT '',+ `distributed_trace_id` Nullable(UUID) DEFAULT NULL,+ `version` DateTime64(3) DEFAULT now64(3),+ INDEX idx_session_id id TYPE bloom_filter(0.001) GRANULARITY 1,+ INDEX idx_session_attr_keys mapKeys(attributes) TYPE bloom_filter(0.01) GRANULARITY 1,+ INDEX idx_session_attr_values mapValues(attributes) TYPE bloom_filter(0.01) GRANULARITY 1+)+ENGINE = ReplacingMergeTree(version)+PARTITION BY toYYYYMMDD(started_at)+ORDER BY (project_id, started_at, id)+SETTINGS index_granularity = 8192diff --git a/backend/app/migrations/sqlite_telemetry/0007_sessions_and_session_link.up.sql b/backend/app/migrations/sqlite_telemetry/0007_sessions_and_session_link.up.sqlnew file mode 100644index 00000000..968eb663--- /dev/null+++ b/backend/app/migrations/sqlite_telemetry/0007_sessions_and_session_link.up.sql@@ -0,0 +1,20 @@+CREATE TABLE IF NOT EXISTS sessions (+ id TEXT NOT NULL PRIMARY KEY,+ project_id TEXT NOT NULL,+ started_at DATETIME NOT NULL,+ ended_at DATETIME,+ duration INTEGER NOT NULL DEFAULT 0,+ client_ip TEXT NOT NULL DEFAULT '',+ attributes TEXT NOT NULL DEFAULT '{}',+ app_version TEXT NOT NULL DEFAULT '',+ server_name TEXT NOT NULL DEFAULT '',+ distributed_trace_id TEXT DEFAULT NULL+);+CREATE INDEX IF NOT EXISTS idx_sessions_project_started ON sessions(project_id, started_at);++ALTER TABLE session_recordings ADD COLUMN session_id TEXT DEFAULT NULL;+ALTER TABLE session_recordings ADD COLUMN segment_index INTEGER NOT NULL DEFAULT 0;+CREATE INDEX IF NOT EXISTS idx_session_recordings_session ON session_recordings(session_id, segment_index);++ALTER TABLE exception_stack_traces ADD COLUMN session_id TEXT DEFAULT NULL;+CREATE INDEX IF NOT EXISTS idx_exceptions_session ON exception_stack_traces(project_id, session_id);diff --git a/backend/app/models/clientmodels/clientmodels.model.go b/backend/app/models/clientmodels/clientmodels.model.goindex c7407456..966e98f4 100644--- a/backend/app/models/clientmodels/clientmodels.model.go+++ b/backend/app/models/clientmodels/clientmodels.model.go@@ -16,6 +16,7 @@ type ClientExceptionStackTrace struct {Attributes map[string]string `json:"attributes"`IsMessage bool `json:"isMessage"`SessionRecordingId *string `json:"sessionRecordingId"`+ SessionId *string `json:"sessionId"`DistributedTraceId *string `json:"distributedTraceId"`}@@ -39,6 +40,13 @@ func (c *ClientExceptionStackTrace) ToExceptionStackTrace(exceptionHash, appVers}}+ var sessionId *uuid.UUID+ if c.SessionId != nil {+ if parsed, err := uuid.Parse(*c.SessionId); err == nil {+ sessionId = &parsed+ }+ }+return models.ExceptionStackTrace{ExceptionHash: exceptionHash,TraceId: traceId,@@ -50,6 +58,7 @@ func (c *ClientExceptionStackTrace) ToExceptionStackTrace(exceptionHash, appVersAppVersion: appVersion,ServerName: serverName,DistributedTraceId: distributedTraceId,+ SessionId: sessionId,}}@@ -165,8 +174,10 @@ func (c *ClientSpan) ToSpan(traceId uuid.UUID) models.Span {}type ClientSessionRecording struct {- ExceptionId string `json:"exceptionId"`- Events json.RawMessage `json:"events"`+ ExceptionId string `json:"exceptionId"`+ SessionId string `json:"sessionId,omitempty"`+ SegmentIndex int32 `json:"segmentIndex,omitempty"`+ Events json.RawMessage `json:"events"`// Logs and Actions are opaque to the backend — they ride into S3 alongside// Events without ever being inspected. App console logs from session// recordings are intentionally NOT inserted into the OTel logs ClickHouse@@ -177,9 +188,53 @@ type ClientSessionRecording struct {EndedAt *time.Time `json:"endedAt,omitempty"`}+type ClientSession struct {+ Id string `json:"id"`+ StartedAt time.Time `json:"startedAt"`+ EndedAt *time.Time `json:"endedAt,omitempty"`+ ClientIP string `json:"clientIP"`+ Attributes map[string]string `json:"attributes"`+ DistributedTraceId string `json:"distributedTraceId,omitempty"`+}++func (c *ClientSession) ToSession(appVersion, serverName string) models.Session {+ id, err := uuid.Parse(c.Id)+ if err != nil {+ id = uuid.New()+ }++ var distributedTraceId *uuid.UUID+ if c.DistributedTraceId != "" {+ if parsed, err := uuid.Parse(c.DistributedTraceId); err == nil {+ distributedTraceId = &parsed+ }+ }++ var duration int64+ if c.EndedAt != nil {+ duration = c.EndedAt.Sub(c.StartedAt).Nanoseconds()+ if duration < 0 {+ duration = 0+ }+ }++ return models.Session{+ Id: id,+ StartedAt: c.StartedAt,+ EndedAt: c.EndedAt,+ Duration: duration,+ ClientIP: c.ClientIP,+ Attributes: c.Attributes,+ AppVersion: appVersion,+ ServerName: serverName,+ DistributedTraceId: distributedTraceId,+ }+}+type CollectionFrame struct {StackTraces []*ClientExceptionStackTrace `json:"stackTraces"`Metrics []*ClientMetricRecord `json:"metrics"`Traces []*ClientTrace `json:"traces"`SessionRecordings []*ClientSessionRecording `json:"sessionRecordings"`+ Sessions []*ClientSession `json:"sessions"`}diff --git a/backend/app/models/exception_stack_trace.model.go b/backend/app/models/exception_stack_trace.model.goindex 0647a2b5..0ce045d3 100644--- a/backend/app/models/exception_stack_trace.model.go+++ b/backend/app/models/exception_stack_trace.model.go@@ -19,6 +19,7 @@ type ExceptionStackTrace struct {ServerName string `json:"serverName" ch:"server_name"`IsMessage bool `json:"isMessage" ch:"is_message"`DistributedTraceId *uuid.UUID `json:"distributedTraceId,omitempty" ch:"distributed_trace_id"`+ SessionId *uuid.UUID `json:"sessionId,omitempty" ch:"session_id"`}type ExceptionTrendPoint struct {diff --git a/backend/app/models/session.model.go b/backend/app/models/session.model.gonew file mode 100644index 00000000..8e8332d7--- /dev/null+++ b/backend/app/models/session.model.go@@ -0,0 +1,20 @@+package models++import (+ "time"++ "github.com/google/uuid"+)++type Session struct {+ Id uuid.UUID `json:"id" ch:"id"`+ ProjectId uuid.UUID `json:"projectId" ch:"project_id"`+ StartedAt time.Time `json:"startedAt" ch:"started_at"`+ EndedAt *time.Time `json:"endedAt,omitempty" ch:"ended_at"`+ Duration int64 `json:"duration" ch:"duration"`+ ClientIP string `json:"clientIP" ch:"client_ip"`+ Attributes map[string]string `json:"attributes" ch:"attributes"`+ AppVersion string `json:"appVersion" ch:"app_version"`+ ServerName string `json:"serverName" ch:"server_name"`+ DistributedTraceId *uuid.UUID `json:"distributedTraceId,omitempty" ch:"distributed_trace_id"`+}diff --git a/backend/app/models/session_recording.model.go b/backend/app/models/session_recording.model.goindex bed4db2f..2db5fc24 100644--- a/backend/app/models/session_recording.model.go+++ b/backend/app/models/session_recording.model.go@@ -7,9 +7,11 @@ import ()type SessionRecording struct {- Id uuid.UUID `json:"id" ch:"id"`- ProjectId uuid.UUID `json:"projectId" ch:"project_id"`- ExceptionId uuid.UUID `json:"exceptionId" ch:"exception_id"`- FilePath string `json:"filePath" ch:"file_path"`- RecordedAt time.Time `json:"recordedAt" ch:"recorded_at"`+ Id uuid.UUID `json:"id" ch:"id"`+ ProjectId uuid.UUID `json:"projectId" ch:"project_id"`+ ExceptionId uuid.UUID `json:"exceptionId" ch:"exception_id"`+ SessionId *uuid.UUID `json:"sessionId,omitempty" ch:"session_id"`+ SegmentIndex int32 `json:"segmentIndex" ch:"segment_index"`+ FilePath string `json:"filePath" ch:"file_path"`+ RecordedAt time.Time `json:"recordedAt" ch:"recorded_at"`}diff --git a/backend/app/repositories/exception_stack_trace.repository.go b/backend/app/repositories/exception_stack_trace.repository.goindex 411718db..32831e25 100644--- a/backend/app/repositories/exception_stack_trace.repository.go+++ b/backend/app/repositories/exception_stack_trace.repository.go@@ -19,7 +19,7 @@ import (type exceptionStackTraceRepository struct{}func (e *exceptionStackTraceRepository) InsertAsync(ctx context.Context, lines []models.ExceptionStackTrace) error {- batch, err := chdb.Conn.PrepareBatch(clickhouse.Context(context.Background(), clickhouse.WithAsync(false)), "INSERT INTO exception_stack_traces (id, project_id, trace_id, trace_type, exception_hash, stack_trace, recorded_at, attributes, app_version, server_name, is_message, distributed_trace_id)")+ batch, err := chdb.Conn.PrepareBatch(clickhouse.Context(context.Background(), clickhouse.WithAsync(false)), "INSERT INTO exception_stack_traces (id, project_id, trace_id, trace_type, exception_hash, stack_trace, recorded_at, attributes, app_version, server_name, is_message, distributed_trace_id, session_id)")if err != nil {return err}@@ -38,13 +38,61 @@ func (e *exceptionStackTraceRepository) InsertAsync(ctx context.Context, lines [if traceType == "" {traceType = "endpoint"}- if err := batch.Append(est.Id, est.ProjectId, est.TraceId, traceType, est.ExceptionHash, est.StackTrace, est.RecordedAt, attributesJSON, est.AppVersion, est.ServerName, isMessage, est.DistributedTraceId); err != nil {+ if err := batch.Append(est.Id, est.ProjectId, est.TraceId, traceType, est.ExceptionHash, est.StackTrace, est.RecordedAt, attributesJSON, est.AppVersion, est.ServerName, isMessage, est.DistributedTraceId, est.SessionId); err != nil {return err}}return batch.Send()}+// FindAllBySessionId returns all exceptions/messages stamped with the given session_id.+func (e *exceptionStackTraceRepository) FindAllBySessionId(ctx context.Context, projectId, sessionId uuid.UUID) ([]models.ExceptionStackTrace, error) {+ rows, err := chdb.Conn.Query(ctx,+ `SELECT id, project_id, trace_id, trace_type, exception_hash, stack_trace, recorded_at, attributes, app_version, server_name, is_message, distributed_trace_id, session_id+ FROM exception_stack_traces+ WHERE project_id = ? AND session_id = ?+ ORDER BY recorded_at ASC`,+ projectId, sessionId)+ if err != nil {+ return nil, err+ }+ defer rows.Close()++ var results []models.ExceptionStackTrace+ for rows.Next() {+ var est models.ExceptionStackTrace+ var attributesJSON string+ var isMessage uint8+ if err := rows.Scan(&est.Id, &est.ProjectId, &est.TraceId, &est.TraceType, &est.ExceptionHash, &est.StackTrace,+ &est.RecordedAt, &attributesJSON, &est.AppVersion, &est.ServerName, &isMessage, &est.DistributedTraceId, &est.SessionId); err != nil {+ return nil, err+ }+ est.IsMessage = isMessage == 1+ if attributesJSON != "" && attributesJSON != "{}" {+ if err := json.Unmarshal([]byte(attributesJSON), &est.Attributes); err != nil {+ est.Attributes = nil+ }+ }+ results = append(results, est)+ }+ return results, nil+}++// GetSessionIdForException returns the session_id for the given exception, or nil when not linked.+func (e *exceptionStackTraceRepository) GetSessionIdForException(ctx context.Context, projectId, exceptionId uuid.UUID) (*uuid.UUID, error) {+ var sessionId *uuid.UUID+ err := chdb.Conn.QueryRow(ctx,+ "SELECT session_id FROM exception_stack_traces WHERE project_id = ? AND id = ? LIMIT 1",+ projectId, exceptionId).Scan(&sessionId)+ if err != nil {+ if errors.Is(err, sql.ErrNoRows) {+ return nil, nil+ }+ return nil, err+ }+ return sessionId, nil+}+func (e *exceptionStackTraceRepository) CountBetween(ctx context.Context, projectId uuid.UUID, start, end time.Time) (int64, error) {var count uint64err := chdb.Conn.QueryRow(ctx, "SELECT count() FROM exception_stack_traces WHERE project_id = ? AND recorded_at >= ? AND recorded_at <= ?", projectId, start, end).Scan(&count)diff --git a/backend/app/repositories/exception_stack_trace.repository_sqlite.go b/backend/app/repositories/exception_stack_trace.repository_sqlite.goindex a176a0de..309babd4 100644--- a/backend/app/repositories/exception_stack_trace.repository_sqlite.go+++ b/backend/app/repositories/exception_stack_trace.repository_sqlite.go@@ -29,6 +29,7 @@ type exceptionRow struct {ServerName string `lit:"server_name"`IsMessage bool `lit:"is_message"`DistributedTraceId *uuid.UUID `lit:"distributed_trace_id"`+ SessionId *uuid.UUID `lit:"session_id"`}type exceptionRowNaming struct{ lit.DefaultDbNamingStrategy }@@ -78,6 +79,7 @@ func exceptionToRow(est models.ExceptionStackTrace) exceptionRow {ServerName: est.ServerName,IsMessage: est.IsMessage,DistributedTraceId: est.DistributedTraceId,+ SessionId: est.SessionId,}}@@ -94,6 +96,7 @@ func (r *exceptionRow) toModel() models.ExceptionStackTrace {ServerName: r.ServerName,IsMessage: r.IsMessage,DistributedTraceId: r.DistributedTraceId,+ SessionId: r.SessionId,}if r.Attributes != nil {est.Attributes = map[string]string(r.Attributes)@@ -244,7 +247,7 @@ func (e *exceptionStackTraceRepository) FindByHash(ctx context.Context, projectI}rows, err := lit.SelectNamed[exceptionRow](db.TelemetryDB,- `SELECT id, project_id, trace_id, trace_type, exception_hash, stack_trace, recorded_at, attributes, app_version, server_name, is_message, distributed_trace_id+ `SELECT id, project_id, trace_id, trace_type, exception_hash, stack_trace, recorded_at, attributes, app_version, server_name, is_message, distributed_trace_id, session_idFROM exception_stack_traces WHERE project_id = :project_id AND exception_hash = :exception_hashORDER BY recorded_at DESC LIMIT :limit OFFSET :offset`,lit.P{"project_id": projectId, "exception_hash": exceptionHash, "limit": pageSize, "offset": offset})@@ -380,7 +383,7 @@ func (e *exceptionStackTraceRepository) IsArchived(ctx context.Context, projectIfunc (e *exceptionStackTraceRepository) FindExceptionByTraceId(ctx context.Context, projectId uuid.UUID, traceId uuid.UUID) (*models.ExceptionStackTrace, error) {row, err := lit.SelectSingleNamed[exceptionRow](db.TelemetryDB,- `SELECT id, project_id, trace_id, trace_type, exception_hash, stack_trace, recorded_at, attributes, app_version, server_name, is_message, distributed_trace_id+ `SELECT id, project_id, trace_id, trace_type, exception_hash, stack_trace, recorded_at, attributes, app_version, server_name, is_message, distributed_trace_id, session_idFROM exception_stack_traces WHERE project_id = :project_id AND trace_id = :trace_id AND is_message = 0 LIMIT 1`,lit.P{"project_id": projectId, "trace_id": traceId})if err != nil {@@ -395,7 +398,7 @@ func (e *exceptionStackTraceRepository) FindExceptionByTraceId(ctx context.Contefunc (e *exceptionStackTraceRepository) FindAllByTraceId(ctx context.Context, projectId uuid.UUID, traceId uuid.UUID) ([]models.ExceptionStackTrace, error) {rows, err := lit.SelectNamed[exceptionRow](db.TelemetryDB,- `SELECT id, project_id, trace_id, trace_type, exception_hash, stack_trace, recorded_at, attributes, app_version, server_name, is_message, distributed_trace_id+ `SELECT id, project_id, trace_id, trace_type, exception_hash, stack_trace, recorded_at, attributes, app_version, server_name, is_message, distributed_trace_id, session_idFROM exception_stack_traces WHERE project_id = :project_id AND trace_id = :trace_id ORDER BY recorded_at ASC`,lit.P{"project_id": projectId, "trace_id": traceId})if err != nil {@@ -411,7 +414,7 @@ func (e *exceptionStackTraceRepository) FindAllByTraceId(ctx context.Context, prfunc (e *exceptionStackTraceRepository) FindById(ctx context.Context, projectId uuid.UUID, id uuid.UUID) (*models.ExceptionStackTrace, error) {row, err := lit.SelectSingleNamed[exceptionRow](db.TelemetryDB,- `SELECT id, project_id, trace_id, trace_type, exception_hash, stack_trace, recorded_at, attributes, app_version, server_name, is_message, distributed_trace_id+ `SELECT id, project_id, trace_id, trace_type, exception_hash, stack_trace, recorded_at, attributes, app_version, server_name, is_message, distributed_trace_id, session_idFROM exception_stack_traces WHERE project_id = :project_id AND id = :id LIMIT 1`,lit.P{"project_id": projectId, "id": id})if err != nil {@@ -436,7 +439,7 @@ func (e *exceptionStackTraceRepository) FindByDistributedTraceId(ctx context.Conparams[key] = pid}- query := `SELECT id, project_id, trace_id, trace_type, exception_hash, stack_trace, recorded_at, attributes, app_version, server_name, is_message, distributed_trace_id+ query := `SELECT id, project_id, trace_id, trace_type, exception_hash, stack_trace, recorded_at, attributes, app_version, server_name, is_message, distributed_trace_id, session_idFROM exception_stack_traces WHERE distributed_trace_id = :trace_id AND project_id IN (` + strings.Join(placeholders, ",") + `) AND is_message = 0ORDER BY recorded_at ASC`@@ -455,7 +458,7 @@ func (e *exceptionStackTraceRepository) FindByDistributedTraceId(ctx context.Confor sqlRows.Next() {var row exceptionRowif err := sqlRows.Scan(&row.Id, &row.ProjectId, &row.TraceId, &row.TraceType, &row.ExceptionHash, &row.StackTrace,- &row.RecordedAt, &row.Attributes, &row.AppVersion, &row.ServerName, &row.IsMessage, &row.DistributedTraceId); err != nil {+ &row.RecordedAt, &row.Attributes, &row.AppVersion, &row.ServerName, &row.IsMessage, &row.DistributedTraceId, &row.SessionId); err != nil {return nil, err}results = append(results, row.toModel())@@ -463,4 +466,35 @@ func (e *exceptionStackTraceRepository) FindByDistributedTraceId(ctx context.Conreturn results, nil}+// FindAllBySessionId returns all exceptions/messages stamped with the given session_id, ordered by time.+func (e *exceptionStackTraceRepository) FindAllBySessionId(ctx context.Context, projectId, sessionId uuid.UUID) ([]models.ExceptionStackTrace, error) {+ rows, err := lit.SelectNamed[exceptionRow](db.TelemetryDB,+ `SELECT id, project_id, trace_id, trace_type, exception_hash, stack_trace, recorded_at, attributes, app_version, server_name, is_message, distributed_trace_id, session_id+ FROM exception_stack_traces+ WHERE project_id = :project_id AND session_id = :session_id+ ORDER BY recorded_at ASC`,+ lit.P{"project_id": projectId, "session_id": sessionId})+ if err != nil {+ return nil, err+ }+ out := make([]models.ExceptionStackTrace, 0, len(rows))+ for _, row := range rows {+ out = append(out, row.toModel())+ }+ return out, nil+}++// GetSessionIdForException returns the session_id for the given exception or nil when not linked.+func (e *exceptionStackTraceRepository) GetSessionIdForException(ctx context.Context, projectId, exceptionId uuid.UUID) (*uuid.UUID, error) {+ row, err := lit.SelectSingleNamed[exceptionRow](db.TelemetryDB,+ `SELECT id, project_id, trace_id, trace_type, exception_hash, stack_trace, recorded_at, attributes, app_version, server_name, is_message, distributed_trace_id, session_id+ FROM exception_stack_traces+ WHERE project_id = :project_id AND id = :id LIMIT 1`,+ lit.P{"project_id": projectId, "id": exceptionId})+ if err != nil || row == nil {+ return nil, err+ }+ return row.SessionId, nil+}+var ExceptionStackTraceRepository = exceptionStackTraceRepository{}diff --git a/backend/app/repositories/session.repository.go b/backend/app/repositories/session.repository.gonew file mode 100644index 00000000..5a22526a--- /dev/null+++ b/backend/app/repositories/session.repository.go@@ -0,0 +1,144 @@+//go:build pgch++package repositories++import (+ "context"+ "database/sql"+ "errors"+ "strings"+ "time"++ "github.com/ClickHouse/clickhouse-go/v2"+ "github.com/google/uuid"+ "github.com/tracewayapp/traceway/backend/app/chdb"+ "github.com/tracewayapp/traceway/backend/app/models"+)++type sessionRepository struct{}++func (r *sessionRepository) Upsert(ctx context.Context, sessions []models.Session) error {+ if len(sessions) == 0 {+ return nil+ }+ batch, err := chdb.Conn.PrepareBatch(clickhouse.Context(context.Background(), clickhouse.WithAsync(false)),+ "INSERT INTO sessions (id, project_id, started_at, ended_at, duration, client_ip, attributes, app_version, server_name, distributed_trace_id, version)")+ if err != nil {+ return err+ }+ for _, s := range sessions {+ attrs := s.Attributes+ if attrs == nil {+ attrs = map[string]string{}+ }+ if err := batch.Append(s.Id, s.ProjectId, s.StartedAt, s.EndedAt, s.Duration, s.ClientIP, attrs, s.AppVersion, s.ServerName, s.DistributedTraceId, time.Now()); err != nil {+ return err+ }+ }+ return batch.Send()+}++func (r *sessionRepository) CountBetween(ctx context.Context, projectId uuid.UUID, start, end time.Time) (int64, error) {+ var count uint64+ err := chdb.Conn.QueryRow(ctx,+ "SELECT count() FROM sessions FINAL WHERE project_id = ? AND started_at >= ? AND started_at <= ?",+ projectId, start, end).Scan(&count)+ return int64(count), err+}++func (r *sessionRepository) FindAll(ctx context.Context, projectId uuid.UUID, fromDate, toDate time.Time, page, pageSize int, orderBy string, sortDirection string, search string, attributeFilters []SessionAttributeFilter) ([]models.Session, int64, error) {+ whereExtra, extraArgs := buildSessionFilterClause(search, attributeFilters)++ countArgs := []interface{}{projectId, fromDate, toDate}+ countArgs = append(countArgs, extraArgs...)+ var count uint64+ countQuery := "SELECT count() FROM sessions FINAL WHERE project_id = ? AND started_at >= ? AND started_at <= ?" + whereExtra+ if err := chdb.Conn.QueryRow(ctx, countQuery, countArgs...).Scan(&count); err != nil {+ return nil, 0, err+ }++ allowedOrderBy := map[string]bool{+ "started_at": true,+ "duration": true,+ }+ if !allowedOrderBy[orderBy] {+ orderBy = "started_at"+ }+ sortDir := "DESC"+ if sortDirection == "asc" {+ sortDir = "ASC"+ }++ offset := (page - 1) * pageSize++ query := "SELECT id, project_id, started_at, ended_at, duration, client_ip, attributes, app_version, server_name, distributed_trace_id FROM sessions FINAL WHERE project_id = ? AND started_at >= ? AND started_at <= ?" + whereExtra + " ORDER BY " + orderBy + " " + sortDir + " LIMIT ? OFFSET ?"+ queryArgs := []interface{}{projectId, fromDate, toDate}+ queryArgs = append(queryArgs, extraArgs...)+ queryArgs = append(queryArgs, pageSize, offset)+ rows, err := chdb.Conn.Query(ctx, query, queryArgs...)+ if err != nil {+ return nil, 0, err+ }+ defer rows.Close()++ var sessions []models.Session+ for rows.Next() {+ var s models.Session+ if err := rows.Scan(&s.Id, &s.ProjectId, &s.StartedAt, &s.EndedAt, &s.Duration, &s.ClientIP, &s.Attributes, &s.AppVersion, &s.ServerName, &s.DistributedTraceId); err != nil {+ return nil, 0, err+ }+ sessions = append(sessions, s)+ }+ return sessions, int64(count), nil+}++func (r *sessionRepository) FindById(ctx context.Context, projectId, sessionId uuid.UUID) (*models.Session, error) {+ var s models.Session++ err := chdb.Conn.QueryRow(ctx,+ `SELECT id, project_id, started_at, ended_at, duration, client_ip, attributes, app_version, server_name, distributed_trace_id+ FROM sessions FINAL+ WHERE project_id = ? AND id = ?+ LIMIT 1`,+ projectId, sessionId).Scan(+ &s.Id, &s.ProjectId, &s.StartedAt, &s.EndedAt, &s.Duration, &s.ClientIP, &s.Attributes, &s.AppVersion, &s.ServerName, &s.DistributedTraceId,+ )+ if err != nil {+ if errors.Is(err, sql.ErrNoRows) {+ return nil, nil+ }+ return nil, err+ }+ return &s, nil+}++// buildSessionFilterClause assembles the search + attribute-filter portion of+// the WHERE clause for sessions queries. Empty inputs return ("", nil).+// Search restricts to a single session id (only valid UUIDs match — any other+// search input falls through and matches nothing useful, which is the right+// behaviour given attribute filters now cover the structured-search use case).+// Each attribute filter adds an exact-match clause via the `attributes[?]`+// Map subscript, which is O(1) per row and indexed by the bloom filters on+// `mapKeys(attributes)` / `mapValues(attributes)`.+func buildSessionFilterClause(search string, filters []SessionAttributeFilter) (string, []interface{}) {+ var sb strings.Builder+ args := []interface{}{}+ if s := strings.TrimSpace(search); s != "" {+ if id, err := uuid.Parse(s); err == nil {+ sb.WriteString(" AND id = ?")+ args = append(args, id)+ }+ }+ for _, f := range filters {+ if f.Key == "" {+ continue+ }+ // `attributes[?]` does an O(1) lookup on the Map column. Combined+ // with the bloom_filter on mapKeys/mapValues this is index-driven.+ sb.WriteString(" AND attributes[?] = ?")+ args = append(args, f.Key, f.Value)+ }+ return sb.String(), args+}++var SessionRepository = sessionRepository{}diff --git a/backend/app/repositories/session.repository_sqlite.go b/backend/app/repositories/session.repository_sqlite.gonew file mode 100644index 00000000..e4c77a8b--- /dev/null+++ b/backend/app/repositories/session.repository_sqlite.go@@ -0,0 +1,245 @@+//go:build !pgch++package repositories++import (+ "context"+ "fmt"+ "strings"+ "time"++ "github.com/google/uuid"+ "github.com/tracewayapp/lit/v2"+ "github.com/tracewayapp/traceway/backend/app/db"+ "github.com/tracewayapp/traceway/backend/app/models"+)++type sessionRow struct {+ Id uuid.UUID `lit:"id"`+ ProjectId uuid.UUID `lit:"project_id"`+ StartedAt SQLiteTime `lit:"started_at"`+ EndedAt *SQLiteTime `lit:"ended_at"`+ Duration int64 `lit:"duration"`+ ClientIP string `lit:"client_ip"`+ Attributes SQLiteJSONMap `lit:"attributes"`+ AppVersion string `lit:"app_version"`+ ServerName string `lit:"server_name"`+ DistributedTraceId *uuid.UUID `lit:"distributed_trace_id"`+}++type sessionRowNaming struct{ lit.DefaultDbNamingStrategy }++func (sessionRowNaming) GetTableNameFromStructName(string) string {+ return "sessions"+}++func init() {+ models.ExtensionModelRegistrations = append(models.ExtensionModelRegistrations, func(driver lit.Driver) {+ lit.RegisterModelWithNaming[sessionRow](driver, sessionRowNaming{})+ })+}++func sessionToRow(s models.Session) sessionRow {+ row := sessionRow{+ Id: s.Id,+ ProjectId: s.ProjectId,+ StartedAt: NewSQLiteTime(s.StartedAt),+ Duration: s.Duration,+ ClientIP: s.ClientIP,+ Attributes: NewSQLiteJSONMap(s.Attributes),+ AppVersion: s.AppVersion,+ ServerName: s.ServerName,+ DistributedTraceId: s.DistributedTraceId,+ }+ if s.EndedAt != nil {+ t := NewSQLiteTime(*s.EndedAt)+ row.EndedAt = &t+ }+ return row+}++func (row *sessionRow) toModel() models.Session {+ s := models.Session{+ Id: row.Id,+ ProjectId: row.ProjectId,+ StartedAt: row.StartedAt.Time,+ Duration: row.Duration,+ ClientIP: row.ClientIP,+ AppVersion: row.AppVersion,+ ServerName: row.ServerName,+ DistributedTraceId: row.DistributedTraceId,+ }+ if row.EndedAt != nil {+ t := row.EndedAt.Time+ s.EndedAt = &t+ }+ if row.Attributes != nil {+ s.Attributes = map[string]string(row.Attributes)+ }+ return s+}++type sessionRepository struct{}++func (r *sessionRepository) Upsert(ctx context.Context, sessions []models.Session) error {+ if len(sessions) == 0 {+ return nil+ }+ const stmt = `INSERT INTO sessions+ (id, project_id, started_at, ended_at, duration, client_ip, attributes, app_version, server_name, distributed_trace_id)+ VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)+ ON CONFLICT(id) DO UPDATE SET+ ended_at = COALESCE(excluded.ended_at, sessions.ended_at),+ duration = CASE WHEN excluded.duration > 0 THEN excluded.duration ELSE sessions.duration END,+ attributes = excluded.attributes,+ app_version = excluded.app_version,+ server_name = excluded.server_name,+ distributed_trace_id = excluded.distributed_trace_id`+ for _, s := range sessions {+ row := sessionToRow(s)+ attrs, err := row.Attributes.Value()+ if err != nil {+ return err+ }+ var endedAt interface{}+ if row.EndedAt != nil {+ v, err := row.EndedAt.Value()+ if err != nil {+ return err+ }+ endedAt = v+ }+ startedAt, err := row.StartedAt.Value()+ if err != nil {+ return err+ }+ if _, err := db.TelemetryDB.ExecContext(ctx, stmt,+ row.Id, row.ProjectId, startedAt, endedAt, row.Duration,+ row.ClientIP, attrs, row.AppVersion, row.ServerName, row.DistributedTraceId,+ ); err != nil {+ return err+ }+ }+ return nil+}++func (r *sessionRepository) CountBetween(ctx context.Context, projectId uuid.UUID, start, end time.Time) (int64, error) {+ result, err := lit.SelectSingleNamed[models.CountResult](db.TelemetryDB,+ "SELECT count(*) as count FROM sessions WHERE project_id = :project_id AND started_at >= :start AND started_at <= :end",+ lit.P{"project_id": projectId, "start": NewSQLiteTime(start), "end": NewSQLiteTime(end)})+ if err != nil {+ return 0, err+ }+ if result == nil {+ return 0, nil+ }+ return int64(result.Count), nil+}++func (r *sessionRepository) FindAll(ctx context.Context, projectId uuid.UUID, fromDate, toDate time.Time, page, pageSize int, orderBy string, sortDirection string, search string, attributeFilters []SessionAttributeFilter) ([]models.Session, int64, error) {+ whereExtra, extraParams := buildSessionFilterClauseSQLite(search, attributeFilters)++ countQuery := "SELECT count(*) as count FROM sessions WHERE project_id = :project_id AND started_at >= :start AND started_at <= :end" + whereExtra+ countParams := lit.P{+ "project_id": projectId,+ "start": NewSQLiteTime(fromDate),+ "end": NewSQLiteTime(toDate),+ }+ for k, v := range extraParams {+ countParams[k] = v+ }+ countResult, err := lit.SelectSingleNamed[models.CountResult](db.TelemetryDB, countQuery, countParams)+ if err != nil {+ return nil, 0, err+ }+ var count int64+ if countResult != nil {+ count = int64(countResult.Count)+ }++ allowedOrderBy := map[string]bool{+ "started_at": true,+ "duration": true,+ }+ if !allowedOrderBy[orderBy] {+ orderBy = "started_at"+ }+ sortDir := "DESC"+ if sortDirection == "asc" {+ sortDir = "ASC"+ }++ offset := (page - 1) * pageSize+ query := "SELECT id, project_id, started_at, ended_at, duration, client_ip, attributes, app_version, server_name, distributed_trace_id FROM sessions WHERE project_id = :project_id AND started_at >= :start AND started_at <= :end" + whereExtra + " ORDER BY " + orderBy + " " + sortDir + " LIMIT :limit OFFSET :offset"++ queryParams := lit.P{+ "project_id": projectId,+ "start": NewSQLiteTime(fromDate),+ "end": NewSQLiteTime(toDate),+ "limit": pageSize,+ "offset": offset,+ }+ for k, v := range extraParams {+ queryParams[k] = v+ }+ rows, err := lit.SelectNamed[sessionRow](db.TelemetryDB, query, queryParams)+ if err != nil {+ return nil, 0, err+ }++ sessions := make([]models.Session, 0, len(rows))+ for _, row := range rows {+ sessions = append(sessions, row.toModel())+ }+ return sessions, count, nil+}++// buildSessionFilterClauseSQLite produces a WHERE fragment + named params+// mirroring the ClickHouse helper: search must be a valid UUID for an exact+// id match (anything else is ignored), and each attribute filter becomes an+// exact match against `json_extract(attributes, '$.<key>')`.+func buildSessionFilterClauseSQLite(search string, filters []SessionAttributeFilter) (string, lit.P) {+ var sb strings.Builder+ params := lit.P{}+ if s := strings.TrimSpace(search); s != "" {+ if id, err := uuid.Parse(s); err == nil {+ sb.WriteString(" AND id = :search_id")+ params["search_id"] = id+ }+ }+ for i, f := range filters {+ if f.Key == "" {+ continue+ }+ keyParam := fmt.Sprintf("attr_k_%d", i)+ valParam := fmt.Sprintf("attr_v_%d", i)+ // Build the JSON path inline (key is interpolated into a parameter)+ // using json_extract's `$.path` syntax via concatenation, but SQLite+ // requires the path string itself to be a literal — we build it via+ // `'$.' || :key`. (`json_extract` accepts a path expression as a+ // regular string, not a column reference.)+ sb.WriteString(" AND json_extract(attributes, '$.' || :")+ sb.WriteString(keyParam)+ sb.WriteString(") = :")+ sb.WriteString(valParam)+ params[keyParam] = f.Key+ params[valParam] = f.Value+ }+ return sb.String(), params+}++func (r *sessionRepository) FindById(ctx context.Context, projectId, sessionId uuid.UUID) (*models.Session, error) {+ row, err := lit.SelectSingleNamed[sessionRow](db.TelemetryDB,+ "SELECT id, project_id, started_at, ended_at, duration, client_ip, attributes, app_version, server_name, distributed_trace_id FROM sessions WHERE project_id = :project_id AND id = :id LIMIT 1",+ lit.P{"project_id": projectId, "id": sessionId})+ if err != nil {+ return nil, err+ }+ if row == nil {+ return nil, nil+ }+ s := row.toModel()+ return &s, nil+}++var SessionRepository = sessionRepository{}diff --git a/backend/app/repositories/session_filter.go b/backend/app/repositories/session_filter.gonew file mode 100644index 00000000..c640048c--- /dev/null+++ b/backend/app/repositories/session_filter.go@@ -0,0 +1,9 @@+package repositories++// SessionAttributeFilter narrows the sessions list by an exact key=value+// match against the JSON `attributes` blob. Defined in a tag-neutral file+// so both the ClickHouse and SQLite repository builds see the same type.+type SessionAttributeFilter struct {+ Key string+ Value string+}diff --git a/backend/app/repositories/session_recording.repository.go b/backend/app/repositories/session_recording.repository.goindex 7f139f19..e6ba2358 100644--- a/backend/app/repositories/session_recording.repository.go+++ b/backend/app/repositories/session_recording.repository.go@@ -19,12 +19,12 @@ func (r *sessionRecordingRepository) InsertAsync(ctx context.Context, recordingsif len(recordings) == 0 {return nil}- batch, err := chdb.Conn.PrepareBatch(clickhouse.Context(context.Background(), clickhouse.WithAsync(false)), "INSERT INTO session_recordings (id, project_id, exception_id, file_path, recorded_at)")+ batch, err := chdb.Conn.PrepareBatch(clickhouse.Context(context.Background(), clickhouse.WithAsync(false)), "INSERT INTO session_recordings (id, project_id, exception_id, session_id, segment_index, file_path, recorded_at)")if err != nil {return err}for _, rec := range recordings {- if err := batch.Append(rec.Id, rec.ProjectId, rec.ExceptionId, rec.FilePath, rec.RecordedAt); err != nil {+ if err := batch.Append(rec.Id, rec.ProjectId, rec.ExceptionId, rec.SessionId, rec.SegmentIndex, rec.FilePath, rec.RecordedAt); err != nil {return err}}@@ -45,4 +45,25 @@ func (r *sessionRecordingRepository) FindByExceptionId(ctx context.Context, projreturn filePath, nil}+// FindBySessionId returns all recording segments for a session ordered by segment_index.+func (r *sessionRecordingRepository) FindBySessionId(ctx context.Context, projectId, sessionId uuid.UUID) ([]models.SessionRecording, error) {+ rows, err := chdb.Conn.Query(ctx,+ "SELECT id, project_id, exception_id, session_id, segment_index, file_path, recorded_at FROM session_recordings WHERE project_id = ? AND session_id = ? ORDER BY segment_index ASC, recorded_at ASC",+ projectId, sessionId)+ if err != nil {+ return nil, err+ }+ defer rows.Close()++ var recordings []models.SessionRecording+ for rows.Next() {+ var rec models.SessionRecording+ if err := rows.Scan(&rec.Id, &rec.ProjectId, &rec.ExceptionId, &rec.SessionId, &rec.SegmentIndex, &rec.FilePath, &rec.RecordedAt); err != nil {+ return nil, err+ }+ recordings = append(recordings, rec)+ }+ return recordings, nil+}+var SessionRecordingRepository = sessionRecordingRepository{}diff --git a/backend/app/repositories/session_recording.repository_sqlite.go b/backend/app/repositories/session_recording.repository_sqlite.goindex 4c5c7ab9..3fd76fba 100644--- a/backend/app/repositories/session_recording.repository_sqlite.go+++ b/backend/app/repositories/session_recording.repository_sqlite.go@@ -14,11 +14,13 @@ import ()type sessionRecording struct {- Id uuid.UUID `lit:"id"`- ProjectId uuid.UUID `lit:"project_id"`- ExceptionId uuid.UUID `lit:"exception_id"`- FilePath string `lit:"file_path"`- RecordedAt SQLiteTime `lit:"recorded_at"`+ Id uuid.UUID `lit:"id"`+ ProjectId uuid.UUID `lit:"project_id"`+ ExceptionId uuid.UUID `lit:"exception_id"`+ SessionId *uuid.UUID `lit:"session_id"`+ SegmentIndex int32 `lit:"segment_index"`+ FilePath string `lit:"file_path"`+ RecordedAt SQLiteTime `lit:"recorded_at"`}func init() {@@ -36,11 +38,13 @@ func (r *sessionRecordingRepository) InsertAsync(ctx context.Context, recordingsfor _, rec := range recordings {row := sessionRecording{- Id: rec.Id,- ProjectId: rec.ProjectId,- ExceptionId: rec.ExceptionId,- FilePath: rec.FilePath,- RecordedAt: NewSQLiteTime(rec.RecordedAt),+ Id: rec.Id,+ ProjectId: rec.ProjectId,+ ExceptionId: rec.ExceptionId,+ SessionId: rec.SessionId,+ SegmentIndex: rec.SegmentIndex,+ FilePath: rec.FilePath,+ RecordedAt: NewSQLiteTime(rec.RecordedAt),}if err := lit.InsertExistingUuid(db.TelemetryDB, &row); err != nil {return err@@ -63,6 +67,30 @@ func (r *sessionRecordingRepository) FindByExceptionId(ctx context.Context, projreturn result.FilePath, nil}+// FindBySessionId returns all recording segments for a session ordered by segment_index.+func (r *sessionRecordingRepository) FindBySessionId(ctx context.Context, projectId, sessionId uuid.UUID) ([]models.SessionRecording, error) {+ rows, err := lit.SelectNamed[sessionRecording](db.TelemetryDB,+ "SELECT id, project_id, exception_id, session_id, segment_index, file_path, recorded_at FROM session_recordings WHERE project_id = :project_id AND session_id = :session_id ORDER BY segment_index ASC, recorded_at ASC",+ lit.P{"project_id": projectId, "session_id": sessionId})+ if err != nil {+ return nil, err+ }++ out := make([]models.SessionRecording, 0, len(rows))+ for _, row := range rows {+ out = append(out, models.SessionRecording{+ Id: row.Id,+ ProjectId: row.ProjectId,+ ExceptionId: row.ExceptionId,+ SessionId: row.SessionId,+ SegmentIndex: row.SegmentIndex,+ FilePath: row.FilePath,+ RecordedAt: row.RecordedAt.Time,+ })+ }+ return out, nil+}+// Preserve original error contract: returns sql.ErrNoRows when not foundvar _ = errors.Isdiff --git a/examples/devtesting-embedded/cdn.html b/examples/devtesting-embedded/cdn.htmlindex 7c72b6db..c8f8bbd0 100644--- a/examples/devtesting-embedded/cdn.html+++ b/examples/devtesting-embedded/cdn.html@@ -39,7 +39,9 @@<div id="log">Waiting for actions...</div><script>- TracewayJQuery.init("frontend-dev-token@http://localhost:8082/api/report");+ TracewayJQuery.init("frontend-dev-token@http://localhost:8082/api/report", {+ recordAllSessions: true,+ });function addLog(msg) {var time = new Date().toLocaleTimeString();diff --git a/examples/devtesting-embedded/frontend/package-lock.json b/examples/devtesting-embedded/frontend/package-lock.jsonindex 4577b48a..76f5d7d5 100644--- a/examples/devtesting-embedded/frontend/package-lock.json+++ b/examples/devtesting-embedded/frontend/package-lock.json@@ -14,9 +14,9 @@},"../../../../js-client/packages/jquery": {"name": "@tracewayapp/jquery",- "version": "1.0.4",+ "version": "1.0.6","dependencies": {- "@tracewayapp/frontend": "1.0.4"+ "@tracewayapp/frontend": "1.0.6"}},"node_modules/@esbuild/aix-ppc64": {diff --git a/examples/devtesting-embedded/frontend/src/app.js b/examples/devtesting-embedded/frontend/src/app.jsindex 2bd66ac7..aafcd26e 100644--- a/examples/devtesting-embedded/frontend/src/app.js+++ b/examples/devtesting-embedded/frontend/src/app.js@@ -1,6 +1,31 @@-import { init } from "@tracewayapp/jquery";+import {+ init,+ setAttribute,+ setAttributes,+} from "@tracewayapp/jquery";-init("frontend-dev-token@http://localhost:8082/api/report");+init("frontend-dev-token@http://localhost:8082/api/report", {+ recordAllSessions: true,+});++// Pretend we just resolved the user / tenant context after auth and+// stamped some app-level globals onto the Traceway scope. These attach to+// every session this tab opens and to every exception captured below,+// alongside the auto-collected url / userAgent / viewport / etc.+setAttributes({+ userId: "u_42",+ tenant: "acme-corp",+ plan: "pro",+ build_channel: "canary",+});++// Pick a per-session experiment bucket so we can demonstrate filter-by-attribute+// on the Sessions page. Random for variety; in a real app this'd be the actual+// flag value.+setAttribute(+ "experiment.cart_redesign",+ Math.random() < 0.5 ? "control" : "variant_b",+);function addLog(msg) {var time = new Date().toLocaleTimeString();diff --git a/examples/devtesting-embedded/static/app.js b/examples/devtesting-embedded/static/app.jsindex c010ef3f..3e6f2fdb 100644--- a/examples/devtesting-embedded/static/app.js+++ b/examples/devtesting-embedded/static/app.js@@ -1,32 +1,32 @@-var zf=Object.defineProperty;var Wf=(me,ge,Q)=>ge in me?zf(me,ge,{enumerable:!0,configurable:!0,writable:!0,value:Q}):me[ge]=Q;var T=(me,ge,Q)=>Wf(me,typeof ge!="symbol"?ge+"":ge,Q);(function(){"use strict";function me(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,s=>{const e=Math.random()*16|0;return(s==="x"?e:e&3|8).toString(16)})}function ge(s){const e=s.indexOf("@");if(e===-1)throw new Error("Invalid connection string: must be in format {token}@{apiUrl}");const t=s.slice(0,e),r=s.slice(e+1);if(!t||!r)throw new Error("Invalid connection string: token and apiUrl must not be empty");return{token:t,apiUrl:r}}function Q(){return new Date().toISOString()}var Vs=class{constructor(s={}){T(this,"windowMs");T(this,"maxSize");T(this,"q",[]);this.windowMs=s.windowMs??1e4,this.maxSize=s.maxSize??200}add(s){this.q.push(s),this.prune()}snapshot(){return this.prune(),this.q.slice()}clear(){this.q.length=0}get length(){return this.q.length}prune(){const s=Date.now()-this.windowMs;for(;this.q.length>0&&Date.parse(this.q[0].timestamp)<s;)this.q.shift();for(;this.q.length>this.maxSize;)this.q.shift()}},Ko=Object.defineProperty,Xo=(s,e,t)=>e in s?Ko(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t,w=(s,e,t)=>Xo(s,typeof e!="symbol"?e+"":e,t),js,Qo=Object.defineProperty,qo=(s,e,t)=>e in s?Qo(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t,Ys=(s,e,t)=>qo(s,typeof e!="symbol"?e+"":e,t),j=(s=>(s[s.Document=0]="Document",s[s.DocumentType=1]="DocumentType",s[s.Element=2]="Element",s[s.Text=3]="Text",s[s.CDATA=4]="CDATA",s[s.Comment=5]="Comment",s))(j||{});const Hs={Node:["childNodes","parentNode","parentElement","textContent","ownerDocument"],ShadowRoot:["host","styleSheets"],Element:["shadowRoot","querySelector","querySelectorAll"],MutationObserver:[]},Zs={Node:["contains","getRootNode"],ShadowRoot:["getSelection"],Element:[],MutationObserver:["constructor"]},gt={},ea=()=>!!globalThis.Zone;function vr(s){if(gt[s])return gt[s];const e=globalThis[s],t=e.prototype,r=s in Hs?Hs[s]:void 0,i=!!(r&&r.every(l=>{var a,u;return!!((u=(a=Object.getOwnPropertyDescriptor(t,l))==null?void 0:a.get)!=null&&u.toString().includes("[native code]"))})),n=s in Zs?Zs[s]:void 0,o=!!(n&&n.every(l=>{var a;return typeof t[l]=="function"&&((a=t[l])==null?void 0:a.toString().includes("[native code]"))}));if(i&&o&&!ea())return gt[s]=e.prototype,e.prototype;try{const l=document.createElement("iframe");document.body.appendChild(l);const a=l.contentWindow;if(!a)return e.prototype;const u=a[s].prototype;return document.body.removeChild(l),u?gt[s]=u:t}catch{return t}}const Ir={};function ye(s,e,t){var r;const i=`${s}.${String(t)}`;if(Ir[i])return Ir[i].call(e);const n=vr(s),o=(r=Object.getOwnPropertyDescriptor(n,t))==null?void 0:r.get;return o?(Ir[i]=o,o.call(e)):e[t]}const xr={};function Js(s,e,t){const r=`${s}.${String(t)}`;if(xr[r])return xr[r].bind(e);const n=vr(s)[t];return typeof n!="function"?e[t]:(xr[r]=n,n.bind(e))}function ta(s){return ye("Node",s,"ownerDocument")}function ra(s){return ye("Node",s,"childNodes")}function sa(s){return ye("Node",s,"parentNode")}function ia(s){return ye("Node",s,"parentElement")}function na(s){return ye("Node",s,"textContent")}function oa(s,e){return Js("Node",s,"contains")(e)}function aa(s){return Js("Node",s,"getRootNode")()}function la(s){return!s||!("host"in s)?null:ye("ShadowRoot",s,"host")}function ua(s){return s.styleSheets}function ca(s){return!s||!("shadowRoot"in s)?null:ye("Element",s,"shadowRoot")}function ha(s,e){return ye("Element",s,"querySelector")(e)}function fa(s,e){return ye("Element",s,"querySelectorAll")(e)}function da(){return vr("MutationObserver").constructor}function pa(s,e,t){try{if(!(e in s))return()=>{};const r=s[e],i=t(r);return typeof i=="function"&&(i.prototype=i.prototype||{},Object.defineProperties(i,{__rrweb_original__:{enumerable:!1,value:r}})),s[e]=i,()=>{s[e]=r}}catch{return()=>{}}}const J={ownerDocument:ta,childNodes:ra,parentNode:sa,parentElement:ia,textContent:na,contains:oa,getRootNode:aa,host:la,styleSheets:ua,shadowRoot:ca,querySelector:ha,querySelectorAll:fa,mutationObserver:da,patch:pa};function Ks(s){return s.nodeType===s.ELEMENT_NODE}function Ye(s){const e=s&&"host"in s&&"mode"in s&&J.host(s)||null;return!!(e&&"shadowRoot"in e&&J.shadowRoot(e)===s)}function He(s){return Object.prototype.toString.call(s)==="[object ShadowRoot]"}function ma(s){return s.includes(" background-clip: text;")&&!s.includes(" -webkit-background-clip: text;")&&(s=s.replace(/\sbackground-clip:\s*text;/g," -webkit-background-clip: text; background-clip: text;")),s}function ga(s){const{cssText:e}=s;if(e.split('"').length<3)return e;const t=["@import",`url(${JSON.stringify(s.href)})`];return s.layerName===""?t.push("layer"):s.layerName&&t.push(`layer(${s.layerName})`),s.supportsText&&t.push(`supports(${s.supportsText})`),s.media.length&&t.push(s.media.mediaText),t.join(" ")+";"}function Or(s){try{const e=s.rules||s.cssRules;if(!e)return null;let t=s.href;!t&&s.ownerNode&&(t=s.ownerNode.baseURI);const r=Array.from(e,i=>Xs(i,t)).join("");return ma(r)}catch{return null}}function Xs(s,e){if(wa(s)){let t;try{t=Or(s.styleSheet)||ga(s)}catch{t=s.cssText}return s.styleSheet.href?bt(t,s.styleSheet.href):t}else{let t=s.cssText;return ba(s)&&s.selectorText.includes(":")&&(t=ya(t)),e?bt(t,e):t}}function ya(s){const e=/(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm;return s.replace(e,"$1\\$2")}function wa(s){return"styleSheet"in s}function ba(s){return"selectorText"in s}class Qs{constructor(){Ys(this,"idNodeMap",new Map),Ys(this,"nodeMetaMap",new WeakMap)}getId(e){var t;return e?((t=this.getMeta(e))==null?void 0:t.id)??-1:-1}getNode(e){return this.idNodeMap.get(e)||null}getIds(){return Array.from(this.idNodeMap.keys())}getMeta(e){return this.nodeMetaMap.get(e)||null}removeNodeFromMap(e){const t=this.getId(e);this.idNodeMap.delete(t),e.childNodes&&e.childNodes.forEach(r=>this.removeNodeFromMap(r))}has(e){return this.idNodeMap.has(e)}hasNode(e){return this.nodeMetaMap.has(e)}add(e,t){const r=t.id;this.idNodeMap.set(r,e),this.nodeMetaMap.set(e,t)}replace(e,t){const r=this.getNode(e);if(r){const i=this.nodeMetaMap.get(r);i&&this.nodeMetaMap.set(t,i)}this.idNodeMap.set(e,t)}reset(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}}function Sa(){return new Qs}function yt({element:s,maskInputOptions:e,tagName:t,type:r,value:i,maskInputFn:n}){let o=i||"";const l=r&&Ie(r);return(e[t.toLowerCase()]||l&&e[l])&&(n?o=n(o,s):o="*".repeat(o.length)),o}function Ie(s){return s.toLowerCase()}const qs="__rrweb_original__";function Ca(s){const e=s.getContext("2d");if(!e)return!0;const t=50;for(let r=0;r<s.width;r+=t)for(let i=0;i<s.height;i+=t){const n=e.getImageData,o=qs in n?n[qs]:n;if(new Uint32Array(o.call(e,r,i,Math.min(t,s.width-r),Math.min(t,s.height-i)).data.buffer).some(a=>a!==0))return!1}return!0}function wt(s){const e=s.type;return s.hasAttribute("data-rr-is-password")?"password":e?Ie(e):null}function ei(s,e){let t;try{t=new URL(s,e??window.location.href)}catch{return null}const r=/\.([0-9a-z]+)(?:$)/i,i=t.pathname.match(r);return(i==null?void 0:i[1])??null}function va(s){let e="";return s.indexOf("//")>-1?e=s.split("/").slice(0,3).join("/"):e=s.split("/")[0],e=e.split("?")[0],e}const Ia=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,xa=/^(?:[a-z+]+:)?\/\//i,Oa=/^www\..*/i,Ra=/^(data:)([^,]*),(.*)/i;function bt(s,e){return(s||"").replace(Ia,(t,r,i,n,o,l)=>{const a=i||o||l,u=r||n||"";if(!a)return t;if(xa.test(a)||Oa.test(a))return`url(${u}${a}${u})`;if(Ra.test(a))return`url(${u}${a}${u})`;if(a[0]==="/")return`url(${u}${va(e)+a}${u})`;const c=e.split("/"),h=a.split("/");c.pop();for(const p of h)p!=="."&&(p===".."?c.pop():c.push(p));return`url(${u}${c.join("/")}${u})`})}function St(s,e=!1){return e?s.replace(/(\/\*[^*]*\*\/)|[\s;]/g,""):s.replace(/(\/\*[^*]*\*\/)|[\s;]/g,"").replace(/0px/g,"0")}function Ea(s,e,t=!1){const r=Array.from(e.childNodes),i=[];let n=0;if(r.length>1&&s&&typeof s=="string"){let o=St(s,t);const l=o.length/s.length;for(let a=1;a<r.length;a++)if(r[a].textContent&&typeof r[a].textContent=="string"){const u=St(r[a].textContent,t),c=100;let h=3;for(;h<u.length&&(u[h].match(/[a-zA-Z0-9]/)||u.indexOf(u.substring(0,h),1)!==-1);h++);for(;h<u.length;h++){let p=u.substring(0,h),m=o.split(p),g=-1;if(m.length===2)g=m[0].length;else if(m.length>2&&m[0]===""&&r[a-1].textContent!=="")g=o.indexOf(p,1);else if(m.length===1){if(p=p.substring(0,p.length-1),m=o.split(p),m.length<=1)return i.push(s),i;h=c+1}else h===u.length-1&&(g=o.indexOf(p));if(m.length>=2&&h>c){const d=r[a-1].textContent;if(d&&typeof d=="string"){const f=St(d).length;g=o.indexOf(p,f)}g===-1&&(g=m[0].length)}if(g!==-1){let d=Math.floor(g/l);for(;d>0&&d<s.length;){if(n+=1,n>50*r.length)return i.push(s),i;const f=St(s.substring(0,d),t);if(f.length===g){i.push(s.substring(0,d)),s=s.substring(d),o=o.substring(g);break}else f.length<g?d+=Math.max(1,Math.floor((g-f.length)/l)):d-=Math.max(1,Math.floor((f.length-g)*l))}break}}}}return i.push(s),i}function Aa(s,e){return Ea(s,e).join("/* rr_split */")}let Ma=1;const $a=new RegExp("[^a-z0-9-_:]"),Ze=-2;function ti(){return Ma++}function Na(s){if(s instanceof HTMLFormElement)return"form";const e=Ie(s.tagName);return $a.test(e)?"div":e}let ke,ri;const ka=/^[^ \t\n\r\u000c]+/,Ta=/^[, \t\n\r\u000c]+/;function Pa(s,e){if(e.trim()==="")return e;let t=0;function r(n){let o;const l=n.exec(e.substring(t));return l?(o=l[0],t+=o.length,o):""}const i=[];for(;r(Ta),!(t>=e.length);){let n=r(ka);if(n.slice(-1)===",")n=Te(s,n.substring(0,n.length-1)),i.push(n);else{let o="";n=Te(s,n);let l=!1;for(;;){const a=e.charAt(t);if(a===""){i.push((n+o).trim());break}else if(l)a===")"&&(l=!1);else if(a===","){t+=1,i.push((n+o).trim());break}else a==="("&&(l=!0);o+=a,t+=1}}}return i.join(", ")}const si=new WeakMap;function Te(s,e){return!e||e.trim()===""?e:Rr(s,e)}function Da(s){return!!(s.tagName==="svg"||s.ownerSVGElement)}function Rr(s,e){let t=si.get(s);if(t||(t=s.createElement("a"),si.set(s,t)),!e)e="";else if(e.startsWith("blob:")||e.startsWith("data:"))return e;return t.setAttribute("href",e),t.href}function ii(s,e,t,r){return r&&(t==="src"||t==="href"&&!(e==="use"&&r[0]==="#")||t==="xlink:href"&&r[0]!=="#"||t==="background"&&["table","td","th"].includes(e)?Te(s,r):t==="srcset"?Pa(s,r):t==="style"?bt(r,Rr(s)):e==="object"&&t==="data"?Te(s,r):r)}function ni(s,e,t){return["video","audio"].includes(s)&&e==="autoplay"}function La(s,e,t){try{if(typeof e=="string"){if(s.classList.contains(e))return!0}else for(let r=s.classList.length;r--;){const i=s.classList[r];if(e.test(i))return!0}if(t)return s.matches(t)}catch{}return!1}function Ct(s,e,t){if(!s)return!1;if(s.nodeType!==s.ELEMENT_NODE)return t?Ct(J.parentNode(s),e,t):!1;for(let r=s.classList.length;r--;){const i=s.classList[r];if(e.test(i))return!0}return t?Ct(J.parentNode(s),e,t):!1}function oi(s,e,t,r){let i;if(Ks(s)){if(i=s,!J.childNodes(i).length)return!1}else{if(J.parentElement(s)===null)return!1;i=J.parentElement(s)}try{if(typeof e=="string"){if(r){if(i.closest(`.${e}`))return!0}else if(i.classList.contains(e))return!0}else if(Ct(i,e,r))return!0;if(t){if(r){if(i.closest(t))return!0}else if(i.matches(t))return!0}}catch{}return!1}function _a(s,e,t){const r=s.contentWindow;if(!r)return;let i=!1,n;try{n=r.document.readyState}catch{return}if(n!=="complete"){const l=setTimeout(()=>{i||(e(),i=!0)},t);s.addEventListener("load",()=>{clearTimeout(l),i=!0,e()});return}const o="about:blank";if(r.location.href!==o||s.src===o||s.src==="")return setTimeout(e,0),s.addEventListener("load",e);s.addEventListener("load",e)}function Fa(s,e,t){let r=!1,i;try{i=s.sheet}catch{return}if(i)return;const n=setTimeout(()=>{r||(e(),r=!0)},t);s.addEventListener("load",()=>{clearTimeout(n),r=!0,e()})}function Ua(s,e){const{doc:t,mirror:r,blockClass:i,blockSelector:n,needsMask:o,inlineStylesheet:l,maskInputOptions:a={},maskTextFn:u,maskInputFn:c,dataURLOptions:h={},inlineImages:p,recordCanvas:m,keepIframeSrcFn:g,newlyAddedElement:d=!1,cssCaptured:f=!1}=e,b=Ba(t,r);switch(s.nodeType){case s.DOCUMENT_NODE:return s.compatMode!=="CSS1Compat"?{type:j.Document,childNodes:[],compatMode:s.compatMode}:{type:j.Document,childNodes:[]};case s.DOCUMENT_TYPE_NODE:return{type:j.DocumentType,name:s.name,publicId:s.publicId,systemId:s.systemId,rootId:b};case s.ELEMENT_NODE:return Wa(s,{doc:t,blockClass:i,blockSelector:n,inlineStylesheet:l,maskInputOptions:a,maskInputFn:c,dataURLOptions:h,inlineImages:p,recordCanvas:m,keepIframeSrcFn:g,newlyAddedElement:d,rootId:b});case s.TEXT_NODE:return za(s,{doc:t,needsMask:o,maskTextFn:u,rootId:b,cssCaptured:f});case s.CDATA_SECTION_NODE:return{type:j.CDATA,textContent:"",rootId:b};case s.COMMENT_NODE:return{type:j.Comment,textContent:J.textContent(s)||"",rootId:b};default:return!1}}function Ba(s,e){if(!e.hasNode(s))return;const t=e.getId(s);return t===1?void 0:t}function za(s,e){const{needsMask:t,maskTextFn:r,rootId:i,cssCaptured:n}=e,o=J.parentNode(s),l=o&&o.tagName;let a="";const u=l==="STYLE"?!0:void 0,c=l==="SCRIPT"?!0:void 0;return c?a="SCRIPT_PLACEHOLDER":n||(a=J.textContent(s),u&&a&&(a=bt(a,Rr(e.doc)))),!u&&!c&&a&&t&&(a=r?r(a,J.parentElement(s)):a.replace(/[\S]/g,"*")),{type:j.Text,textContent:a||"",rootId:i}}function Wa(s,e){const{doc:t,blockClass:r,blockSelector:i,inlineStylesheet:n,maskInputOptions:o={},maskInputFn:l,dataURLOptions:a={},inlineImages:u,recordCanvas:c,keepIframeSrcFn:h,newlyAddedElement:p=!1,rootId:m}=e,g=La(s,r,i),d=Na(s);let f={};const b=s.attributes.length;for(let y=0;y<b;y++){const C=s.attributes[y];ni(d,C.name,C.value)||(f[C.name]=ii(t,d,Ie(C.name),C.value))}if(d==="link"&&n){const y=Array.from(t.styleSheets).find(N=>N.href===s.href);let C=null;y&&(C=Or(y)),C&&(delete f.rel,delete f.href,f._cssText=C)}if(d==="style"&&s.sheet){let y=Or(s.sheet);y&&(s.childNodes.length>1&&(y=Aa(y,s)),f._cssText=y)}if(["input","textarea","select"].includes(d)){const y=s.value,C=s.checked;f.type!=="radio"&&f.type!=="checkbox"&&f.type!=="submit"&&f.type!=="button"&&y?f.value=yt({element:s,type:wt(s),tagName:d,value:y,maskInputOptions:o,maskInputFn:l}):C&&(f.checked=C)}if(d==="option"&&(s.selected&&!o.select?f.selected=!0:delete f.selected),d==="dialog"&&s.open&&(f.rr_open_mode=s.matches("dialog:modal")?"modal":"non-modal"),d==="canvas"&&c){if(s.__context==="2d")Ca(s)||(f.rr_dataURL=s.toDataURL(a.type,a.quality));else if(!("__context"in s)){const y=s.toDataURL(a.type,a.quality),C=t.createElement("canvas");C.width=s.width,C.height=s.height;const N=C.toDataURL(a.type,a.quality);y!==N&&(f.rr_dataURL=y)}}if(d==="img"&&u){ke||(ke=t.createElement("canvas"),ri=ke.getContext("2d"));const y=s,C=y.currentSrc||y.getAttribute("src")||"<unknown-src>",N=y.crossOrigin,D=()=>{y.removeEventListener("load",D);try{ke.width=y.naturalWidth,ke.height=y.naturalHeight,ri.drawImage(y,0,0),f.rr_dataURL=ke.toDataURL(a.type,a.quality)}catch(Y){if(y.crossOrigin!=="anonymous"){y.crossOrigin="anonymous",y.complete&&y.naturalWidth!==0?D():y.addEventListener("load",D);return}else console.warn(`Cannot inline img src=${C}! Error: ${Y}`)}y.crossOrigin==="anonymous"&&(N?f.crossOrigin=N:y.removeAttribute("crossorigin"))};y.complete&&y.naturalWidth!==0?D():y.addEventListener("load",D)}if(["audio","video"].includes(d)){const y=f;y.rr_mediaState=s.paused?"paused":"played",y.rr_mediaCurrentTime=s.currentTime,y.rr_mediaPlaybackRate=s.playbackRate,y.rr_mediaMuted=s.muted,y.rr_mediaLoop=s.loop,y.rr_mediaVolume=s.volume}if(p||(s.scrollLeft&&(f.rr_scrollLeft=s.scrollLeft),s.scrollTop&&(f.rr_scrollTop=s.scrollTop)),g){const{width:y,height:C}=s.getBoundingClientRect();f={class:f.class,rr_width:`${y}px`,rr_height:`${C}px`}}d==="iframe"&&!h(f.src)&&(s.contentDocument||(f.rr_src=f.src),delete f.src);let S;try{customElements.get(d)&&(S=!0)}catch{}return{type:j.Element,tagName:d,attributes:f,childNodes:[],isSVG:Da(s)||void 0,needBlock:g,rootId:m,isCustom:S}}function P(s){return s==null?"":s.toLowerCase()}function ai(s){return s===!0||s==="all"?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaVerification:!0,headMetaAuthorship:s==="all",headMetaDescKeywords:s==="all",headTitleMutations:s==="all"}:s||{}}function Ga(s,e){if(e.comment&&s.type===j.Comment)return!0;if(s.type===j.Element){if(e.script&&(s.tagName==="script"||s.tagName==="link"&&(s.attributes.rel==="preload"&&s.attributes.as==="script"||s.attributes.rel==="modulepreload")||s.tagName==="link"&&s.attributes.rel==="prefetch"&&typeof s.attributes.href=="string"&&ei(s.attributes.href)==="js"))return!0;if(e.headFavicon&&(s.tagName==="link"&&s.attributes.rel==="shortcut icon"||s.tagName==="meta"&&(P(s.attributes.name).match(/^msapplication-tile(image|color)$/)||P(s.attributes.name)==="application-name"||P(s.attributes.rel)==="icon"||P(s.attributes.rel)==="apple-touch-icon"||P(s.attributes.rel)==="shortcut icon")))return!0;if(s.tagName==="meta"){if(e.headMetaDescKeywords&&P(s.attributes.name).match(/^description|keywords$/))return!0;if(e.headMetaSocial&&(P(s.attributes.property).match(/^(og|twitter|fb):/)||P(s.attributes.name).match(/^(og|twitter):/)||P(s.attributes.name)==="pinterest"))return!0;if(e.headMetaRobots&&(P(s.attributes.name)==="robots"||P(s.attributes.name)==="googlebot"||P(s.attributes.name)==="bingbot"))return!0;if(e.headMetaHttpEquiv&&s.attributes["http-equiv"]!==void 0)return!0;if(e.headMetaAuthorship&&(P(s.attributes.name)==="author"||P(s.attributes.name)==="generator"||P(s.attributes.name)==="framework"||P(s.attributes.name)==="publisher"||P(s.attributes.name)==="progid"||P(s.attributes.property).match(/^article:/)||P(s.attributes.property).match(/^product:/)))return!0;if(e.headMetaVerification&&(P(s.attributes.name)==="google-site-verification"||P(s.attributes.name)==="yandex-verification"||P(s.attributes.name)==="csrf-token"||P(s.attributes.name)==="p:domain_verify"||P(s.attributes.name)==="verify-v1"||P(s.attributes.name)==="verification"||P(s.attributes.name)==="shopify-checkout-api-token"))return!0}}return!1}function Pe(s,e){const{doc:t,mirror:r,blockClass:i,blockSelector:n,maskTextClass:o,maskTextSelector:l,skipChild:a=!1,inlineStylesheet:u=!0,maskInputOptions:c={},maskTextFn:h,maskInputFn:p,slimDOMOptions:m,dataURLOptions:g={},inlineImages:d=!1,recordCanvas:f=!1,onSerialize:b,onIframeLoad:S,iframeLoadTimeout:y=5e3,onStylesheetLoad:C,stylesheetLoadTimeout:N=5e3,keepIframeSrcFn:D=()=>!1,newlyAddedElement:Y=!1,cssCaptured:B=!1}=e;let{needsMask:V}=e,{preserveWhiteSpace:Z=!0}=e;V||(V=oi(s,o,l,V===void 0));const se=Ua(s,{doc:t,mirror:r,blockClass:i,blockSelector:n,needsMask:V,inlineStylesheet:u,maskInputOptions:c,maskTextFn:h,maskInputFn:p,dataURLOptions:g,inlineImages:d,recordCanvas:f,keepIframeSrcFn:D,newlyAddedElement:Y,cssCaptured:B});if(!se)return console.warn(s,"not serialized"),null;let de;r.hasNode(s)?de=r.getId(s):Ga(se,m)||!Z&&se.type===j.Text&&!se.textContent.replace(/^\s+|\s+$/gm,"").length?de=Ze:de=ti();const R=Object.assign(se,{id:de});if(r.add(s,R),de===Ze)return null;b&&b(s);let pt=!a;if(R.type===j.Element){pt=pt&&!R.needBlock,delete R.needBlock;const H=J.shadowRoot(s);H&&He(H)&&(R.isShadowHost=!0)}if((R.type===j.Document||R.type===j.Element)&&pt){m.headWhitespace&&R.type===j.Element&&R.tagName==="head"&&(Z=!1);const H={doc:t,mirror:r,blockClass:i,blockSelector:n,needsMask:V,maskTextClass:o,maskTextSelector:l,skipChild:a,inlineStylesheet:u,maskInputOptions:c,maskTextFn:h,maskInputFn:p,slimDOMOptions:m,dataURLOptions:g,inlineImages:d,recordCanvas:f,preserveWhiteSpace:Z,onSerialize:b,onIframeLoad:S,iframeLoadTimeout:y,onStylesheetLoad:C,stylesheetLoadTimeout:N,keepIframeSrcFn:D,cssCaptured:!1};if(!(R.type===j.Element&&R.tagName==="textarea"&&R.attributes.value!==void 0)){R.type===j.Element&&R.attributes._cssText!==void 0&&typeof R.attributes._cssText=="string"&&(H.cssCaptured=!0);for(const Me of Array.from(J.childNodes(s))){const pe=Pe(Me,H);pe&&R.childNodes.push(pe)}}let ie=null;if(Ks(s)&&(ie=J.shadowRoot(s)))for(const Me of Array.from(J.childNodes(ie))){const pe=Pe(Me,H);pe&&(He(ie)&&(pe.isShadow=!0),R.childNodes.push(pe))}}const mt=J.parentNode(s);return mt&&Ye(mt)&&He(mt)&&(R.isShadow=!0),R.type===j.Element&&R.tagName==="iframe"&&_a(s,()=>{const H=s.contentDocument;if(H&&S){const ie=Pe(H,{doc:H,mirror:r,blockClass:i,blockSelector:n,needsMask:V,maskTextClass:o,maskTextSelector:l,skipChild:!1,inlineStylesheet:u,maskInputOptions:c,maskTextFn:h,maskInputFn:p,slimDOMOptions:m,dataURLOptions:g,inlineImages:d,recordCanvas:f,preserveWhiteSpace:Z,onSerialize:b,onIframeLoad:S,iframeLoadTimeout:y,onStylesheetLoad:C,stylesheetLoadTimeout:N,keepIframeSrcFn:D});ie&&S(s,ie)}},y),R.type===j.Element&&R.tagName==="link"&&typeof R.attributes.rel=="string"&&(R.attributes.rel==="stylesheet"||R.attributes.rel==="preload"&&typeof R.attributes.href=="string"&&ei(R.attributes.href)==="css")&&Fa(s,()=>{if(C){const H=Pe(s,{doc:t,mirror:r,blockClass:i,blockSelector:n,needsMask:V,maskTextClass:o,maskTextSelector:l,skipChild:!1,inlineStylesheet:u,maskInputOptions:c,maskTextFn:h,maskInputFn:p,slimDOMOptions:m,dataURLOptions:g,inlineImages:d,recordCanvas:f,preserveWhiteSpace:Z,onSerialize:b,onIframeLoad:S,iframeLoadTimeout:y,onStylesheetLoad:C,stylesheetLoadTimeout:N,keepIframeSrcFn:D});H&&C(s,H)}},N),R}function Va(s,e){const{mirror:t=new Qs,blockClass:r="rr-block",blockSelector:i=null,maskTextClass:n="rr-mask",maskTextSelector:o=null,inlineStylesheet:l=!0,inlineImages:a=!1,recordCanvas:u=!1,maskAllInputs:c=!1,maskTextFn:h,maskInputFn:p,slimDOM:m=!1,dataURLOptions:g,preserveWhiteSpace:d,onSerialize:f,onIframeLoad:b,iframeLoadTimeout:S,onStylesheetLoad:y,stylesheetLoadTimeout:C,keepIframeSrcFn:N=()=>!1}=e||{},D=c===!0?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,password:!0}:c===!1?{password:!0}:c,Y=ai(m);return Pe(s,{doc:s,mirror:t,blockClass:r,blockSelector:i,maskTextClass:n,maskTextSelector:o,skipChild:!1,inlineStylesheet:l,maskInputOptions:D,maskTextFn:h,maskInputFn:p,slimDOMOptions:Y,dataURLOptions:g,inlineImages:a,recordCanvas:u,preserveWhiteSpace:d,onSerialize:f,onIframeLoad:b,iframeLoadTimeout:S,onStylesheetLoad:y,stylesheetLoadTimeout:C,keepIframeSrcFn:N,newlyAddedElement:!1})}function ja(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}function Ya(s){if(s.__esModule)return s;var e=s.default;if(typeof e=="function"){var t=function r(){return this instanceof r?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};t.prototype=e.prototype}else t={};return Object.defineProperty(t,"__esModule",{value:!0}),Object.keys(s).forEach(function(r){var i=Object.getOwnPropertyDescriptor(s,r);Object.defineProperty(t,r,i.get?i:{enumerable:!0,get:function(){return s[r]}})}),t}var Er={exports:{}},L=String,li=function(){return{isColorSupported:!1,reset:L,bold:L,dim:L,italic:L,underline:L,inverse:L,hidden:L,strikethrough:L,black:L,red:L,green:L,yellow:L,blue:L,magenta:L,cyan:L,white:L,gray:L,bgBlack:L,bgRed:L,bgGreen:L,bgYellow:L,bgBlue:L,bgMagenta:L,bgCyan:L,bgWhite:L}};Er.exports=li(),Er.exports.createColors=li;var Ha=Er.exports;const ne=Ya(Object.freeze(Object.defineProperty({__proto__:null,default:{}},Symbol.toStringTag,{value:"Module"})));let ui=Ha,ci=ne,Ar=class Vo extends Error{constructor(e,t,r,i,n,o){super(e),this.name="CssSyntaxError",this.reason=e,n&&(this.file=n),i&&(this.source=i),o&&(this.plugin=o),typeof t<"u"&&typeof r<"u"&&(typeof t=="number"?(this.line=t,this.column=r):(this.line=t.line,this.column=t.column,this.endLine=r.line,this.endColumn=r.column)),this.setMessage(),Error.captureStackTrace&&Error.captureStackTrace(this,Vo)}setMessage(){this.message=this.plugin?this.plugin+": ":"",this.message+=this.file?this.file:"<css input>",typeof this.line<"u"&&(this.message+=":"+this.line+":"+this.column),this.message+=": "+this.reason}showSourceCode(e){if(!this.source)return"";let t=this.source;e==null&&(e=ui.isColorSupported),ci&&e&&(t=ci(t));let r=t.split(/\r?\n/),i=Math.max(this.line-3,0),n=Math.min(this.line+2,r.length),o=String(n).length,l,a;if(e){let{bold:u,gray:c,red:h}=ui.createColors(!0);l=p=>u(h(p)),a=p=>c(p)}else l=a=u=>u;return r.slice(i,n).map((u,c)=>{let h=i+1+c,p=" "+(" "+h).slice(-o)+" | ";if(h===this.line){let m=a(p.replace(/\d/g," "))+u.slice(0,this.column-1).replace(/[^\t]/g," ");return l(">")+a(p)+u+`+var jf=Object.defineProperty;var Hf=(ce,ge,J)=>ge in ce?jf(ce,ge,{enumerable:!0,configurable:!0,writable:!0,value:J}):ce[ge]=J;var v=(ce,ge,J)=>Hf(ce,typeof ge!="symbol"?ge+"":ge,J);(function(){"use strict";function ce(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,s=>{const e=Math.random()*16|0;return(s==="x"?e:e&3|8).toString(16)})}function ge(s){const e=s.indexOf("@");if(e===-1)throw new Error("Invalid connection string: must be in format {token}@{apiUrl}");const t=s.slice(0,e),r=s.slice(e+1);if(!t||!r)throw new Error("Invalid connection string: token and apiUrl must not be empty");return{token:t,apiUrl:r}}function J(){return new Date().toISOString()}var Vs=class{constructor(s={}){v(this,"windowMs");v(this,"maxSize");v(this,"q",[]);this.windowMs=s.windowMs??1e4,this.maxSize=s.maxSize??200}add(s){this.q.push(s),this.prune()}snapshot(){return this.prune(),this.q.slice()}clear(){this.q.length=0}get length(){return this.q.length}prune(){const s=Date.now()-this.windowMs;for(;this.q.length>0&&Date.parse(this.q[0].timestamp)<s;)this.q.shift();for(;this.q.length>this.maxSize;)this.q.shift()}},Xo=Object.defineProperty,Qo=(s,e,t)=>e in s?Xo(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t,w=(s,e,t)=>Qo(s,typeof e!="symbol"?e+"":e,t),js,qo=Object.defineProperty,ea=(s,e,t)=>e in s?qo(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t,Hs=(s,e,t)=>ea(s,typeof e!="symbol"?e+"":e,t),j=(s=>(s[s.Document=0]="Document",s[s.DocumentType=1]="DocumentType",s[s.Element=2]="Element",s[s.Text=3]="Text",s[s.CDATA=4]="CDATA",s[s.Comment=5]="Comment",s))(j||{});const Ys={Node:["childNodes","parentNode","parentElement","textContent","ownerDocument"],ShadowRoot:["host","styleSheets"],Element:["shadowRoot","querySelector","querySelectorAll"],MutationObserver:[]},Zs={Node:["contains","getRootNode"],ShadowRoot:["getSelection"],Element:[],MutationObserver:["constructor"]},gt={},ta=()=>!!globalThis.Zone;function Cr(s){if(gt[s])return gt[s];const e=globalThis[s],t=e.prototype,r=s in Ys?Ys[s]:void 0,i=!!(r&&r.every(l=>{var a,u;return!!((u=(a=Object.getOwnPropertyDescriptor(t,l))==null?void 0:a.get)!=null&&u.toString().includes("[native code]"))})),n=s in Zs?Zs[s]:void 0,o=!!(n&&n.every(l=>{var a;return typeof t[l]=="function"&&((a=t[l])==null?void 0:a.toString().includes("[native code]"))}));if(i&&o&&!ta())return gt[s]=e.prototype,e.prototype;try{const l=document.createElement("iframe");document.body.appendChild(l);const a=l.contentWindow;if(!a)return e.prototype;const u=a[s].prototype;return document.body.removeChild(l),u?gt[s]=u:t}catch{return t}}const Ir={};function ye(s,e,t){var r;const i=`${s}.${String(t)}`;if(Ir[i])return Ir[i].call(e);const n=Cr(s),o=(r=Object.getOwnPropertyDescriptor(n,t))==null?void 0:r.get;return o?(Ir[i]=o,o.call(e)):e[t]}const xr={};function Js(s,e,t){const r=`${s}.${String(t)}`;if(xr[r])return xr[r].bind(e);const n=Cr(s)[t];return typeof n!="function"?e[t]:(xr[r]=n,n.bind(e))}function ra(s){return ye("Node",s,"ownerDocument")}function sa(s){return ye("Node",s,"childNodes")}function ia(s){return ye("Node",s,"parentNode")}function na(s){return ye("Node",s,"parentElement")}function oa(s){return ye("Node",s,"textContent")}function aa(s,e){return Js("Node",s,"contains")(e)}function la(s){return Js("Node",s,"getRootNode")()}function ua(s){return!s||!("host"in s)?null:ye("ShadowRoot",s,"host")}function ca(s){return s.styleSheets}function ha(s){return!s||!("shadowRoot"in s)?null:ye("Element",s,"shadowRoot")}function fa(s,e){return ye("Element",s,"querySelector")(e)}function da(s,e){return ye("Element",s,"querySelectorAll")(e)}function pa(){return Cr("MutationObserver").constructor}function ma(s,e,t){try{if(!(e in s))return()=>{};const r=s[e],i=t(r);return typeof i=="function"&&(i.prototype=i.prototype||{},Object.defineProperties(i,{__rrweb_original__:{enumerable:!1,value:r}})),s[e]=i,()=>{s[e]=r}}catch{return()=>{}}}const K={ownerDocument:ra,childNodes:sa,parentNode:ia,parentElement:na,textContent:oa,contains:aa,getRootNode:la,host:ua,styleSheets:ca,shadowRoot:ha,querySelector:fa,querySelectorAll:da,mutationObserver:pa,patch:ma};function Ks(s){return s.nodeType===s.ELEMENT_NODE}function He(s){const e=s&&"host"in s&&"mode"in s&&K.host(s)||null;return!!(e&&"shadowRoot"in e&&K.shadowRoot(e)===s)}function Ye(s){return Object.prototype.toString.call(s)==="[object ShadowRoot]"}function ga(s){return s.includes(" background-clip: text;")&&!s.includes(" -webkit-background-clip: text;")&&(s=s.replace(/\sbackground-clip:\s*text;/g," -webkit-background-clip: text; background-clip: text;")),s}function ya(s){const{cssText:e}=s;if(e.split('"').length<3)return e;const t=["@import",`url(${JSON.stringify(s.href)})`];return s.layerName===""?t.push("layer"):s.layerName&&t.push(`layer(${s.layerName})`),s.supportsText&&t.push(`supports(${s.supportsText})`),s.media.length&&t.push(s.media.mediaText),t.join(" ")+";"}function Ar(s){try{const e=s.rules||s.cssRules;if(!e)return null;let t=s.href;!t&&s.ownerNode&&(t=s.ownerNode.baseURI);const r=Array.from(e,i=>Xs(i,t)).join("");return ga(r)}catch{return null}}function Xs(s,e){if(Sa(s)){let t;try{t=Ar(s.styleSheet)||ya(s)}catch{t=s.cssText}return s.styleSheet.href?St(t,s.styleSheet.href):t}else{let t=s.cssText;return ba(s)&&s.selectorText.includes(":")&&(t=wa(t)),e?St(t,e):t}}function wa(s){const e=/(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm;return s.replace(e,"$1\\$2")}function Sa(s){return"styleSheet"in s}function ba(s){return"selectorText"in s}class Qs{constructor(){Hs(this,"idNodeMap",new Map),Hs(this,"nodeMetaMap",new WeakMap)}getId(e){var t;return e?((t=this.getMeta(e))==null?void 0:t.id)??-1:-1}getNode(e){return this.idNodeMap.get(e)||null}getIds(){return Array.from(this.idNodeMap.keys())}getMeta(e){return this.nodeMetaMap.get(e)||null}removeNodeFromMap(e){const t=this.getId(e);this.idNodeMap.delete(t),e.childNodes&&e.childNodes.forEach(r=>this.removeNodeFromMap(r))}has(e){return this.idNodeMap.has(e)}hasNode(e){return this.nodeMetaMap.has(e)}add(e,t){const r=t.id;this.idNodeMap.set(r,e),this.nodeMetaMap.set(e,t)}replace(e,t){const r=this.getNode(e);if(r){const i=this.nodeMetaMap.get(r);i&&this.nodeMetaMap.set(t,i)}this.idNodeMap.set(e,t)}reset(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}}function va(){return new Qs}function yt({element:s,maskInputOptions:e,tagName:t,type:r,value:i,maskInputFn:n}){let o=i||"";const l=r&&Ie(r);return(e[t.toLowerCase()]||l&&e[l])&&(n?o=n(o,s):o="*".repeat(o.length)),o}function Ie(s){return s.toLowerCase()}const qs="__rrweb_original__";function Ca(s){const e=s.getContext("2d");if(!e)return!0;const t=50;for(let r=0;r<s.width;r+=t)for(let i=0;i<s.height;i+=t){const n=e.getImageData,o=qs in n?n[qs]:n;if(new Uint32Array(o.call(e,r,i,Math.min(t,s.width-r),Math.min(t,s.height-i)).data.buffer).some(a=>a!==0))return!1}return!0}function wt(s){const e=s.type;return s.hasAttribute("data-rr-is-password")?"password":e?Ie(e):null}function ei(s,e){let t;try{t=new URL(s,e??window.location.href)}catch{return null}const r=/\.([0-9a-z]+)(?:$)/i,i=t.pathname.match(r);return(i==null?void 0:i[1])??null}function Ia(s){let e="";return s.indexOf("//")>-1?e=s.split("/").slice(0,3).join("/"):e=s.split("/")[0],e=e.split("?")[0],e}const xa=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,Aa=/^(?:[a-z+]+:)?\/\//i,Ra=/^www\..*/i,Oa=/^(data:)([^,]*),(.*)/i;function St(s,e){return(s||"").replace(xa,(t,r,i,n,o,l)=>{const a=i||o||l,u=r||n||"";if(!a)return t;if(Aa.test(a)||Ra.test(a))return`url(${u}${a}${u})`;if(Oa.test(a))return`url(${u}${a}${u})`;if(a[0]==="/")return`url(${u}${Ia(e)+a}${u})`;const c=e.split("/"),h=a.split("/");c.pop();for(const p of h)p!=="."&&(p===".."?c.pop():c.push(p));return`url(${u}${c.join("/")}${u})`})}function bt(s,e=!1){return e?s.replace(/(\/\*[^*]*\*\/)|[\s;]/g,""):s.replace(/(\/\*[^*]*\*\/)|[\s;]/g,"").replace(/0px/g,"0")}function Ea(s,e,t=!1){const r=Array.from(e.childNodes),i=[];let n=0;if(r.length>1&&s&&typeof s=="string"){let o=bt(s,t);const l=o.length/s.length;for(let a=1;a<r.length;a++)if(r[a].textContent&&typeof r[a].textContent=="string"){const u=bt(r[a].textContent,t),c=100;let h=3;for(;h<u.length&&(u[h].match(/[a-zA-Z0-9]/)||u.indexOf(u.substring(0,h),1)!==-1);h++);for(;h<u.length;h++){let p=u.substring(0,h),m=o.split(p),g=-1;if(m.length===2)g=m[0].length;else if(m.length>2&&m[0]===""&&r[a-1].textContent!=="")g=o.indexOf(p,1);else if(m.length===1){if(p=p.substring(0,p.length-1),m=o.split(p),m.length<=1)return i.push(s),i;h=c+1}else h===u.length-1&&(g=o.indexOf(p));if(m.length>=2&&h>c){const d=r[a-1].textContent;if(d&&typeof d=="string"){const f=bt(d).length;g=o.indexOf(p,f)}g===-1&&(g=m[0].length)}if(g!==-1){let d=Math.floor(g/l);for(;d>0&&d<s.length;){if(n+=1,n>50*r.length)return i.push(s),i;const f=bt(s.substring(0,d),t);if(f.length===g){i.push(s.substring(0,d)),s=s.substring(d),o=o.substring(g);break}else f.length<g?d+=Math.max(1,Math.floor((g-f.length)/l)):d-=Math.max(1,Math.floor((f.length-g)*l))}break}}}}return i.push(s),i}function Ma(s,e){return Ea(s,e).join("/* rr_split */")}let $a=1;const Na=new RegExp("[^a-z0-9-_:]"),Ze=-2;function ti(){return $a++}function ka(s){if(s instanceof HTMLFormElement)return"form";const e=Ie(s.tagName);return Na.test(e)?"div":e}let ke,ri;const Ta=/^[^ \t\n\r\u000c]+/,Pa=/^[, \t\n\r\u000c]+/;function Da(s,e){if(e.trim()==="")return e;let t=0;function r(n){let o;const l=n.exec(e.substring(t));return l?(o=l[0],t+=o.length,o):""}const i=[];for(;r(Pa),!(t>=e.length);){let n=r(Ta);if(n.slice(-1)===",")n=Te(s,n.substring(0,n.length-1)),i.push(n);else{let o="";n=Te(s,n);let l=!1;for(;;){const a=e.charAt(t);if(a===""){i.push((n+o).trim());break}else if(l)a===")"&&(l=!1);else if(a===","){t+=1,i.push((n+o).trim());break}else a==="("&&(l=!0);o+=a,t+=1}}}return i.join(", ")}const si=new WeakMap;function Te(s,e){return!e||e.trim()===""?e:Rr(s,e)}function La(s){return!!(s.tagName==="svg"||s.ownerSVGElement)}function Rr(s,e){let t=si.get(s);if(t||(t=s.createElement("a"),si.set(s,t)),!e)e="";else if(e.startsWith("blob:")||e.startsWith("data:"))return e;return t.setAttribute("href",e),t.href}function ii(s,e,t,r){return r&&(t==="src"||t==="href"&&!(e==="use"&&r[0]==="#")||t==="xlink:href"&&r[0]!=="#"||t==="background"&&["table","td","th"].includes(e)?Te(s,r):t==="srcset"?Da(s,r):t==="style"?St(r,Rr(s)):e==="object"&&t==="data"?Te(s,r):r)}function ni(s,e,t){return["video","audio"].includes(s)&&e==="autoplay"}function _a(s,e,t){try{if(typeof e=="string"){if(s.classList.contains(e))return!0}else for(let r=s.classList.length;r--;){const i=s.classList[r];if(e.test(i))return!0}if(t)return s.matches(t)}catch{}return!1}function vt(s,e,t){if(!s)return!1;if(s.nodeType!==s.ELEMENT_NODE)return t?vt(K.parentNode(s),e,t):!1;for(let r=s.classList.length;r--;){const i=s.classList[r];if(e.test(i))return!0}return t?vt(K.parentNode(s),e,t):!1}function oi(s,e,t,r){let i;if(Ks(s)){if(i=s,!K.childNodes(i).length)return!1}else{if(K.parentElement(s)===null)return!1;i=K.parentElement(s)}try{if(typeof e=="string"){if(r){if(i.closest(`.${e}`))return!0}else if(i.classList.contains(e))return!0}else if(vt(i,e,r))return!0;if(t){if(r){if(i.closest(t))return!0}else if(i.matches(t))return!0}}catch{}return!1}function Fa(s,e,t){const r=s.contentWindow;if(!r)return;let i=!1,n;try{n=r.document.readyState}catch{return}if(n!=="complete"){const l=setTimeout(()=>{i||(e(),i=!0)},t);s.addEventListener("load",()=>{clearTimeout(l),i=!0,e()});return}const o="about:blank";if(r.location.href!==o||s.src===o||s.src==="")return setTimeout(e,0),s.addEventListener("load",e);s.addEventListener("load",e)}function Ua(s,e,t){let r=!1,i;try{i=s.sheet}catch{return}if(i)return;const n=setTimeout(()=>{r||(e(),r=!0)},t);s.addEventListener("load",()=>{clearTimeout(n),r=!0,e()})}function Ba(s,e){const{doc:t,mirror:r,blockClass:i,blockSelector:n,needsMask:o,inlineStylesheet:l,maskInputOptions:a={},maskTextFn:u,maskInputFn:c,dataURLOptions:h={},inlineImages:p,recordCanvas:m,keepIframeSrcFn:g,newlyAddedElement:d=!1,cssCaptured:f=!1}=e,S=za(t,r);switch(s.nodeType){case s.DOCUMENT_NODE:return s.compatMode!=="CSS1Compat"?{type:j.Document,childNodes:[],compatMode:s.compatMode}:{type:j.Document,childNodes:[]};case s.DOCUMENT_TYPE_NODE:return{type:j.DocumentType,name:s.name,publicId:s.publicId,systemId:s.systemId,rootId:S};case s.ELEMENT_NODE:return Ga(s,{doc:t,blockClass:i,blockSelector:n,inlineStylesheet:l,maskInputOptions:a,maskInputFn:c,dataURLOptions:h,inlineImages:p,recordCanvas:m,keepIframeSrcFn:g,newlyAddedElement:d,rootId:S});case s.TEXT_NODE:return Wa(s,{doc:t,needsMask:o,maskTextFn:u,rootId:S,cssCaptured:f});case s.CDATA_SECTION_NODE:return{type:j.CDATA,textContent:"",rootId:S};case s.COMMENT_NODE:return{type:j.Comment,textContent:K.textContent(s)||"",rootId:S};default:return!1}}function za(s,e){if(!e.hasNode(s))return;const t=e.getId(s);return t===1?void 0:t}function Wa(s,e){const{needsMask:t,maskTextFn:r,rootId:i,cssCaptured:n}=e,o=K.parentNode(s),l=o&&o.tagName;let a="";const u=l==="STYLE"?!0:void 0,c=l==="SCRIPT"?!0:void 0;return c?a="SCRIPT_PLACEHOLDER":n||(a=K.textContent(s),u&&a&&(a=St(a,Rr(e.doc)))),!u&&!c&&a&&t&&(a=r?r(a,K.parentElement(s)):a.replace(/[\S]/g,"*")),{type:j.Text,textContent:a||"",rootId:i}}function Ga(s,e){const{doc:t,blockClass:r,blockSelector:i,inlineStylesheet:n,maskInputOptions:o={},maskInputFn:l,dataURLOptions:a={},inlineImages:u,recordCanvas:c,keepIframeSrcFn:h,newlyAddedElement:p=!1,rootId:m}=e,g=_a(s,r,i),d=ka(s);let f={};const S=s.attributes.length;for(let y=0;y<S;y++){const C=s.attributes[y];ni(d,C.name,C.value)||(f[C.name]=ii(t,d,Ie(C.name),C.value))}if(d==="link"&&n){const y=Array.from(t.styleSheets).find(k=>k.href===s.href);let C=null;y&&(C=Ar(y)),C&&(delete f.rel,delete f.href,f._cssText=C)}if(d==="style"&&s.sheet){let y=Ar(s.sheet);y&&(s.childNodes.length>1&&(y=Ma(y,s)),f._cssText=y)}if(["input","textarea","select"].includes(d)){const y=s.value,C=s.checked;f.type!=="radio"&&f.type!=="checkbox"&&f.type!=="submit"&&f.type!=="button"&&y?f.value=yt({element:s,type:wt(s),tagName:d,value:y,maskInputOptions:o,maskInputFn:l}):C&&(f.checked=C)}if(d==="option"&&(s.selected&&!o.select?f.selected=!0:delete f.selected),d==="dialog"&&s.open&&(f.rr_open_mode=s.matches("dialog:modal")?"modal":"non-modal"),d==="canvas"&&c){if(s.__context==="2d")Ca(s)||(f.rr_dataURL=s.toDataURL(a.type,a.quality));else if(!("__context"in s)){const y=s.toDataURL(a.type,a.quality),C=t.createElement("canvas");C.width=s.width,C.height=s.height;const k=C.toDataURL(a.type,a.quality);y!==k&&(f.rr_dataURL=y)}}if(d==="img"&&u){ke||(ke=t.createElement("canvas"),ri=ke.getContext("2d"));const y=s,C=y.currentSrc||y.getAttribute("src")||"<unknown-src>",k=y.crossOrigin,D=()=>{y.removeEventListener("load",D);try{ke.width=y.naturalWidth,ke.height=y.naturalHeight,ri.drawImage(y,0,0),f.rr_dataURL=ke.toDataURL(a.type,a.quality)}catch(H){if(y.crossOrigin!=="anonymous"){y.crossOrigin="anonymous",y.complete&&y.naturalWidth!==0?D():y.addEventListener("load",D);return}else console.warn(`Cannot inline img src=${C}! Error: ${H}`)}y.crossOrigin==="anonymous"&&(k?f.crossOrigin=k:y.removeAttribute("crossorigin"))};y.complete&&y.naturalWidth!==0?D():y.addEventListener("load",D)}if(["audio","video"].includes(d)){const y=f;y.rr_mediaState=s.paused?"paused":"played",y.rr_mediaCurrentTime=s.currentTime,y.rr_mediaPlaybackRate=s.playbackRate,y.rr_mediaMuted=s.muted,y.rr_mediaLoop=s.loop,y.rr_mediaVolume=s.volume}if(p||(s.scrollLeft&&(f.rr_scrollLeft=s.scrollLeft),s.scrollTop&&(f.rr_scrollTop=s.scrollTop)),g){const{width:y,height:C}=s.getBoundingClientRect();f={class:f.class,rr_width:`${y}px`,rr_height:`${C}px`}}d==="iframe"&&!h(f.src)&&(s.contentDocument||(f.rr_src=f.src),delete f.src);let b;try{customElements.get(d)&&(b=!0)}catch{}return{type:j.Element,tagName:d,attributes:f,childNodes:[],isSVG:La(s)||void 0,needBlock:g,rootId:m,isCustom:b}}function P(s){return s==null?"":s.toLowerCase()}function ai(s){return s===!0||s==="all"?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaVerification:!0,headMetaAuthorship:s==="all",headMetaDescKeywords:s==="all",headTitleMutations:s==="all"}:s||{}}function Va(s,e){if(e.comment&&s.type===j.Comment)return!0;if(s.type===j.Element){if(e.script&&(s.tagName==="script"||s.tagName==="link"&&(s.attributes.rel==="preload"&&s.attributes.as==="script"||s.attributes.rel==="modulepreload")||s.tagName==="link"&&s.attributes.rel==="prefetch"&&typeof s.attributes.href=="string"&&ei(s.attributes.href)==="js"))return!0;if(e.headFavicon&&(s.tagName==="link"&&s.attributes.rel==="shortcut icon"||s.tagName==="meta"&&(P(s.attributes.name).match(/^msapplication-tile(image|color)$/)||P(s.attributes.name)==="application-name"||P(s.attributes.rel)==="icon"||P(s.attributes.rel)==="apple-touch-icon"||P(s.attributes.rel)==="shortcut icon")))return!0;if(s.tagName==="meta"){if(e.headMetaDescKeywords&&P(s.attributes.name).match(/^description|keywords$/))return!0;if(e.headMetaSocial&&(P(s.attributes.property).match(/^(og|twitter|fb):/)||P(s.attributes.name).match(/^(og|twitter):/)||P(s.attributes.name)==="pinterest"))return!0;if(e.headMetaRobots&&(P(s.attributes.name)==="robots"||P(s.attributes.name)==="googlebot"||P(s.attributes.name)==="bingbot"))return!0;if(e.headMetaHttpEquiv&&s.attributes["http-equiv"]!==void 0)return!0;if(e.headMetaAuthorship&&(P(s.attributes.name)==="author"||P(s.attributes.name)==="generator"||P(s.attributes.name)==="framework"||P(s.attributes.name)==="publisher"||P(s.attributes.name)==="progid"||P(s.attributes.property).match(/^article:/)||P(s.attributes.property).match(/^product:/)))return!0;if(e.headMetaVerification&&(P(s.attributes.name)==="google-site-verification"||P(s.attributes.name)==="yandex-verification"||P(s.attributes.name)==="csrf-token"||P(s.attributes.name)==="p:domain_verify"||P(s.attributes.name)==="verify-v1"||P(s.attributes.name)==="verification"||P(s.attributes.name)==="shopify-checkout-api-token"))return!0}}return!1}function Pe(s,e){const{doc:t,mirror:r,blockClass:i,blockSelector:n,maskTextClass:o,maskTextSelector:l,skipChild:a=!1,inlineStylesheet:u=!0,maskInputOptions:c={},maskTextFn:h,maskInputFn:p,slimDOMOptions:m,dataURLOptions:g={},inlineImages:d=!1,recordCanvas:f=!1,onSerialize:S,onIframeLoad:b,iframeLoadTimeout:y=5e3,onStylesheetLoad:C,stylesheetLoadTimeout:k=5e3,keepIframeSrcFn:D=()=>!1,newlyAddedElement:H=!1,cssCaptured:B=!1}=e;let{needsMask:V}=e,{preserveWhiteSpace:Z=!0}=e;V||(V=oi(s,o,l,V===void 0));const ie=Ba(s,{doc:t,mirror:r,blockClass:i,blockSelector:n,needsMask:V,inlineStylesheet:u,maskInputOptions:c,maskTextFn:h,maskInputFn:p,dataURLOptions:g,inlineImages:d,recordCanvas:f,keepIframeSrcFn:D,newlyAddedElement:H,cssCaptured:B});if(!ie)return console.warn(s,"not serialized"),null;let pe;r.hasNode(s)?pe=r.getId(s):Va(ie,m)||!Z&&ie.type===j.Text&&!ie.textContent.replace(/^\s+|\s+$/gm,"").length?pe=Ze:pe=ti();const O=Object.assign(ie,{id:pe});if(r.add(s,O),pe===Ze)return null;S&&S(s);let pt=!a;if(O.type===j.Element){pt=pt&&!O.needBlock,delete O.needBlock;const Y=K.shadowRoot(s);Y&&Ye(Y)&&(O.isShadowHost=!0)}if((O.type===j.Document||O.type===j.Element)&&pt){m.headWhitespace&&O.type===j.Element&&O.tagName==="head"&&(Z=!1);const Y={doc:t,mirror:r,blockClass:i,blockSelector:n,needsMask:V,maskTextClass:o,maskTextSelector:l,skipChild:a,inlineStylesheet:u,maskInputOptions:c,maskTextFn:h,maskInputFn:p,slimDOMOptions:m,dataURLOptions:g,inlineImages:d,recordCanvas:f,preserveWhiteSpace:Z,onSerialize:S,onIframeLoad:b,iframeLoadTimeout:y,onStylesheetLoad:C,stylesheetLoadTimeout:k,keepIframeSrcFn:D,cssCaptured:!1};if(!(O.type===j.Element&&O.tagName==="textarea"&&O.attributes.value!==void 0)){O.type===j.Element&&O.attributes._cssText!==void 0&&typeof O.attributes._cssText=="string"&&(Y.cssCaptured=!0);for(const Me of Array.from(K.childNodes(s))){const me=Pe(Me,Y);me&&O.childNodes.push(me)}}let ne=null;if(Ks(s)&&(ne=K.shadowRoot(s)))for(const Me of Array.from(K.childNodes(ne))){const me=Pe(Me,Y);me&&(Ye(ne)&&(me.isShadow=!0),O.childNodes.push(me))}}const mt=K.parentNode(s);return mt&&He(mt)&&Ye(mt)&&(O.isShadow=!0),O.type===j.Element&&O.tagName==="iframe"&&Fa(s,()=>{const Y=s.contentDocument;if(Y&&b){const ne=Pe(Y,{doc:Y,mirror:r,blockClass:i,blockSelector:n,needsMask:V,maskTextClass:o,maskTextSelector:l,skipChild:!1,inlineStylesheet:u,maskInputOptions:c,maskTextFn:h,maskInputFn:p,slimDOMOptions:m,dataURLOptions:g,inlineImages:d,recordCanvas:f,preserveWhiteSpace:Z,onSerialize:S,onIframeLoad:b,iframeLoadTimeout:y,onStylesheetLoad:C,stylesheetLoadTimeout:k,keepIframeSrcFn:D});ne&&b(s,ne)}},y),O.type===j.Element&&O.tagName==="link"&&typeof O.attributes.rel=="string"&&(O.attributes.rel==="stylesheet"||O.attributes.rel==="preload"&&typeof O.attributes.href=="string"&&ei(O.attributes.href)==="css")&&Ua(s,()=>{if(C){const Y=Pe(s,{doc:t,mirror:r,blockClass:i,blockSelector:n,needsMask:V,maskTextClass:o,maskTextSelector:l,skipChild:!1,inlineStylesheet:u,maskInputOptions:c,maskTextFn:h,maskInputFn:p,slimDOMOptions:m,dataURLOptions:g,inlineImages:d,recordCanvas:f,preserveWhiteSpace:Z,onSerialize:S,onIframeLoad:b,iframeLoadTimeout:y,onStylesheetLoad:C,stylesheetLoadTimeout:k,keepIframeSrcFn:D});Y&&C(s,Y)}},k),O}function ja(s,e){const{mirror:t=new Qs,blockClass:r="rr-block",blockSelector:i=null,maskTextClass:n="rr-mask",maskTextSelector:o=null,inlineStylesheet:l=!0,inlineImages:a=!1,recordCanvas:u=!1,maskAllInputs:c=!1,maskTextFn:h,maskInputFn:p,slimDOM:m=!1,dataURLOptions:g,preserveWhiteSpace:d,onSerialize:f,onIframeLoad:S,iframeLoadTimeout:b,onStylesheetLoad:y,stylesheetLoadTimeout:C,keepIframeSrcFn:k=()=>!1}=e||{},D=c===!0?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,password:!0}:c===!1?{password:!0}:c,H=ai(m);return Pe(s,{doc:s,mirror:t,blockClass:r,blockSelector:i,maskTextClass:n,maskTextSelector:o,skipChild:!1,inlineStylesheet:l,maskInputOptions:D,maskTextFn:h,maskInputFn:p,slimDOMOptions:H,dataURLOptions:g,inlineImages:a,recordCanvas:u,preserveWhiteSpace:d,onSerialize:f,onIframeLoad:S,iframeLoadTimeout:b,onStylesheetLoad:y,stylesheetLoadTimeout:C,keepIframeSrcFn:k,newlyAddedElement:!1})}function Ha(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}function Ya(s){if(s.__esModule)return s;var e=s.default;if(typeof e=="function"){var t=function r(){return this instanceof r?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};t.prototype=e.prototype}else t={};return Object.defineProperty(t,"__esModule",{value:!0}),Object.keys(s).forEach(function(r){var i=Object.getOwnPropertyDescriptor(s,r);Object.defineProperty(t,r,i.get?i:{enumerable:!0,get:function(){return s[r]}})}),t}var Or={exports:{}},L=String,li=function(){return{isColorSupported:!1,reset:L,bold:L,dim:L,italic:L,underline:L,inverse:L,hidden:L,strikethrough:L,black:L,red:L,green:L,yellow:L,blue:L,magenta:L,cyan:L,white:L,gray:L,bgBlack:L,bgRed:L,bgGreen:L,bgYellow:L,bgBlue:L,bgMagenta:L,bgCyan:L,bgWhite:L}};Or.exports=li(),Or.exports.createColors=li;var Za=Or.exports;const oe=Ya(Object.freeze(Object.defineProperty({__proto__:null,default:{}},Symbol.toStringTag,{value:"Module"})));let ui=Za,ci=oe,Er=class jo extends Error{constructor(e,t,r,i,n,o){super(e),this.name="CssSyntaxError",this.reason=e,n&&(this.file=n),i&&(this.source=i),o&&(this.plugin=o),typeof t<"u"&&typeof r<"u"&&(typeof t=="number"?(this.line=t,this.column=r):(this.line=t.line,this.column=t.column,this.endLine=r.line,this.endColumn=r.column)),this.setMessage(),Error.captureStackTrace&&Error.captureStackTrace(this,jo)}setMessage(){this.message=this.plugin?this.plugin+": ":"",this.message+=this.file?this.file:"<css input>",typeof this.line<"u"&&(this.message+=":"+this.line+":"+this.column),this.message+=": "+this.reason}showSourceCode(e){if(!this.source)return"";let t=this.source;e==null&&(e=ui.isColorSupported),ci&&e&&(t=ci(t));let r=t.split(/\r?\n/),i=Math.max(this.line-3,0),n=Math.min(this.line+2,r.length),o=String(n).length,l,a;if(e){let{bold:u,gray:c,red:h}=ui.createColors(!0);l=p=>u(h(p)),a=p=>c(p)}else l=a=u=>u;return r.slice(i,n).map((u,c)=>{let h=i+1+c,p=" "+(" "+h).slice(-o)+" | ";if(h===this.line){let m=a(p.replace(/\d/g," "))+u.slice(0,this.column-1).replace(/[^\t]/g," ");return l(">")+a(p)+u+``+m+l("^")}return" "+a(p)+u}).join(``)}toString(){let e=this.showSourceCode();return e&&(e=``+e+`-`),this.name+": "+this.message+e}};var Mr=Ar;Ar.default=Ar;var Je={};Je.isClean=Symbol("isClean"),Je.my=Symbol("my");const hi={after:`+`),this.name+": "+this.message+e}};var Mr=Er;Er.default=Er;var Je={};Je.isClean=Symbol("isClean"),Je.my=Symbol("my");const hi={after:``,beforeClose:``,beforeComment:``,beforeDecl:``,beforeOpen:" ",beforeRule:`-`,colon:": ",commentLeft:" ",commentRight:" ",emptyBody:"",indent:" ",semicolon:!1};function Za(s){return s[0].toUpperCase()+s.slice(1)}let $r=class{constructor(e){this.builder=e}atrule(e,t){let r="@"+e.name,i=e.params?this.rawValue(e,"params"):"";if(typeof e.raws.afterName<"u"?r+=e.raws.afterName:i&&(r+=" "),e.nodes)this.block(e,r+i);else{let n=(e.raws.between||"")+(t?";":"");this.builder(r+i+n,e)}}beforeAfter(e,t){let r;e.type==="decl"?r=this.raw(e,null,"beforeDecl"):e.type==="comment"?r=this.raw(e,null,"beforeComment"):t==="before"?r=this.raw(e,null,"beforeRule"):r=this.raw(e,null,"beforeClose");let i=e.parent,n=0;for(;i&&i.type!=="root";)n+=1,i=i.parent;if(r.includes(`-`)){let o=this.raw(e,null,"indent");if(o.length)for(let l=0;l<n;l++)r+=o}return r}block(e,t){let r=this.raw(e,"between","beforeOpen");this.builder(t+r+"{",e,"start");let i;e.nodes&&e.nodes.length?(this.body(e),i=this.raw(e,"after")):i=this.raw(e,"after","emptyBody"),i&&this.builder(i),this.builder("}",e,"end")}body(e){let t=e.nodes.length-1;for(;t>0&&e.nodes[t].type==="comment";)t-=1;let r=this.raw(e,"semicolon");for(let i=0;i<e.nodes.length;i++){let n=e.nodes[i],o=this.raw(n,"before");o&&this.builder(o),this.stringify(n,t!==i||r)}}comment(e){let t=this.raw(e,"left","commentLeft"),r=this.raw(e,"right","commentRight");this.builder("/*"+t+e.text+r+"*/",e)}decl(e,t){let r=this.raw(e,"between","colon"),i=e.prop+r+this.rawValue(e,"value");e.important&&(i+=e.raws.important||" !important"),t&&(i+=";"),this.builder(i,e)}document(e){this.body(e)}raw(e,t,r){let i;if(r||(r=t),t&&(i=e.raws[t],typeof i<"u"))return i;let n=e.parent;if(r==="before"&&(!n||n.type==="root"&&n.first===e||n&&n.type==="document"))return"";if(!n)return hi[r];let o=e.root();if(o.rawCache||(o.rawCache={}),typeof o.rawCache[r]<"u")return o.rawCache[r];if(r==="before"||r==="after")return this.beforeAfter(e,r);{let l="raw"+Za(r);this[l]?i=this[l](o,e):o.walk(a=>{if(i=a.raws[t],typeof i<"u")return!1})}return typeof i>"u"&&(i=hi[r]),o.rawCache[r]=i,i}rawBeforeClose(e){let t;return e.walk(r=>{if(r.nodes&&r.nodes.length>0&&typeof r.raws.after<"u")return t=r.raws.after,t.includes(`+`,colon:": ",commentLeft:" ",commentRight:" ",emptyBody:"",indent:" ",semicolon:!1};function Ja(s){return s[0].toUpperCase()+s.slice(1)}let $r=class{constructor(e){this.builder=e}atrule(e,t){let r="@"+e.name,i=e.params?this.rawValue(e,"params"):"";if(typeof e.raws.afterName<"u"?r+=e.raws.afterName:i&&(r+=" "),e.nodes)this.block(e,r+i);else{let n=(e.raws.between||"")+(t?";":"");this.builder(r+i+n,e)}}beforeAfter(e,t){let r;e.type==="decl"?r=this.raw(e,null,"beforeDecl"):e.type==="comment"?r=this.raw(e,null,"beforeComment"):t==="before"?r=this.raw(e,null,"beforeRule"):r=this.raw(e,null,"beforeClose");let i=e.parent,n=0;for(;i&&i.type!=="root";)n+=1,i=i.parent;if(r.includes(`+`)){let o=this.raw(e,null,"indent");if(o.length)for(let l=0;l<n;l++)r+=o}return r}block(e,t){let r=this.raw(e,"between","beforeOpen");this.builder(t+r+"{",e,"start");let i;e.nodes&&e.nodes.length?(this.body(e),i=this.raw(e,"after")):i=this.raw(e,"after","emptyBody"),i&&this.builder(i),this.builder("}",e,"end")}body(e){let t=e.nodes.length-1;for(;t>0&&e.nodes[t].type==="comment";)t-=1;let r=this.raw(e,"semicolon");for(let i=0;i<e.nodes.length;i++){let n=e.nodes[i],o=this.raw(n,"before");o&&this.builder(o),this.stringify(n,t!==i||r)}}comment(e){let t=this.raw(e,"left","commentLeft"),r=this.raw(e,"right","commentRight");this.builder("/*"+t+e.text+r+"*/",e)}decl(e,t){let r=this.raw(e,"between","colon"),i=e.prop+r+this.rawValue(e,"value");e.important&&(i+=e.raws.important||" !important"),t&&(i+=";"),this.builder(i,e)}document(e){this.body(e)}raw(e,t,r){let i;if(r||(r=t),t&&(i=e.raws[t],typeof i<"u"))return i;let n=e.parent;if(r==="before"&&(!n||n.type==="root"&&n.first===e||n&&n.type==="document"))return"";if(!n)return hi[r];let o=e.root();if(o.rawCache||(o.rawCache={}),typeof o.rawCache[r]<"u")return o.rawCache[r];if(r==="before"||r==="after")return this.beforeAfter(e,r);{let l="raw"+Ja(r);this[l]?i=this[l](o,e):o.walk(a=>{if(i=a.raws[t],typeof i<"u")return!1})}return typeof i>"u"&&(i=hi[r]),o.rawCache[r]=i,i}rawBeforeClose(e){let t;return e.walk(r=>{if(r.nodes&&r.nodes.length>0&&typeof r.raws.after<"u")return t=r.raws.after,t.includes(``)&&(t=t.replace(/[^\n]+$/,"")),!1}),t&&(t=t.replace(/\S/g,"")),t}rawBeforeComment(e,t){let r;return e.walkComments(i=>{if(typeof i.raws.before<"u")return r=i.raws.before,r.includes(``)&&(r=r.replace(/[^\n]+$/,"")),!1}),typeof r>"u"?r=this.raw(t,null,"beforeDecl"):r&&(r=r.replace(/\S/g,"")),r}rawBeforeDecl(e,t){let r;return e.walkDecls(i=>{if(typeof i.raws.before<"u")return r=i.raws.before,r.includes(``)&&(r=r.replace(/[^\n]+$/,"")),!1}),typeof r>"u"?r=this.raw(t,null,"beforeRule"):r&&(r=r.replace(/\S/g,"")),r}rawBeforeOpen(e){let t;return e.walk(r=>{if(r.type!=="decl"&&(t=r.raws.between,typeof t<"u"))return!1}),t}rawBeforeRule(e){let t;return e.walk(r=>{if(r.nodes&&(r.parent!==e||e.first!==r)&&typeof r.raws.before<"u")return t=r.raws.before,t.includes(``)&&(t=t.replace(/[^\n]+$/,"")),!1}),t&&(t=t.replace(/\S/g,"")),t}rawColon(e){let t;return e.walkDecls(r=>{if(typeof r.raws.between<"u")return t=r.raws.between.replace(/[^\s:]/g,""),!1}),t}rawEmptyBody(e){let t;return e.walk(r=>{if(r.nodes&&r.nodes.length===0&&(t=r.raws.after,typeof t<"u"))return!1}),t}rawIndent(e){if(e.raws.indent)return e.raws.indent;let t;return e.walk(r=>{let i=r.parent;if(i&&i!==e&&i.parent&&i.parent===e&&typeof r.raws.before<"u"){let n=r.raws.before.split(`-`);return t=n[n.length-1],t=t.replace(/\S/g,""),!1}}),t}rawSemicolon(e){let t;return e.walk(r=>{if(r.nodes&&r.nodes.length&&r.last.type==="decl"&&(t=r.raws.semicolon,typeof t<"u"))return!1}),t}rawValue(e,t){let r=e[t],i=e.raws[t];return i&&i.value===r?i.raw:r}root(e){this.body(e),e.raws.after&&this.builder(e.raws.after)}rule(e){this.block(e,this.rawValue(e,"selector")),e.raws.ownSemicolon&&this.builder(e.raws.ownSemicolon,e,"end")}stringify(e,t){if(!this[e.type])throw new Error("Unknown AST node type "+e.type+". Maybe you need to change PostCSS stringifier.");this[e.type](e,t)}};var fi=$r;$r.default=$r;let Ja=fi;function Nr(s,e){new Ja(e).stringify(s)}var vt=Nr;Nr.default=Nr;let{isClean:It,my:Ka}=Je,Xa=Mr,Qa=fi,qa=vt;function kr(s,e){let t=new s.constructor;for(let r in s){if(!Object.prototype.hasOwnProperty.call(s,r)||r==="proxyCache")continue;let i=s[r],n=typeof i;r==="parent"&&n==="object"?e&&(t[r]=e):r==="source"?t[r]=i:Array.isArray(i)?t[r]=i.map(o=>kr(o,t)):(n==="object"&&i!==null&&(i=kr(i)),t[r]=i)}return t}let Tr=class{constructor(e={}){this.raws={},this[It]=!1,this[Ka]=!0;for(let t in e)if(t==="nodes"){this.nodes=[];for(let r of e[t])typeof r.clone=="function"?this.append(r.clone()):this.append(r)}else this[t]=e[t]}addToError(e){if(e.postcssNode=this,e.stack&&this.source&&/\n\s{4}at /.test(e.stack)){let t=this.source;e.stack=e.stack.replace(/\n\s{4}at /,`$&${t.input.from}:${t.start.line}:${t.start.column}$&`)}return e}after(e){return this.parent.insertAfter(this,e),this}assign(e={}){for(let t in e)this[t]=e[t];return this}before(e){return this.parent.insertBefore(this,e),this}cleanRaws(e){delete this.raws.before,delete this.raws.after,e||delete this.raws.between}clone(e={}){let t=kr(this);for(let r in e)t[r]=e[r];return t}cloneAfter(e={}){let t=this.clone(e);return this.parent.insertAfter(this,t),t}cloneBefore(e={}){let t=this.clone(e);return this.parent.insertBefore(this,t),t}error(e,t={}){if(this.source){let{end:r,start:i}=this.rangeBy(t);return this.source.input.error(e,{column:i.column,line:i.line},{column:r.column,line:r.line},t)}return new Xa(e)}getProxyProcessor(){return{get(e,t){return t==="proxyOf"?e:t==="root"?()=>e.root().toProxy():e[t]},set(e,t,r){return e[t]===r||(e[t]=r,(t==="prop"||t==="value"||t==="name"||t==="params"||t==="important"||t==="text")&&e.markDirty()),!0}}}markDirty(){if(this[It]){this[It]=!1;let e=this;for(;e=e.parent;)e[It]=!1}}next(){if(!this.parent)return;let e=this.parent.index(this);return this.parent.nodes[e+1]}positionBy(e,t){let r=this.source.start;if(e.index)r=this.positionInside(e.index,t);else if(e.word){t=this.toString();let i=t.indexOf(e.word);i!==-1&&(r=this.positionInside(i,t))}return r}positionInside(e,t){let r=t||this.toString(),i=this.source.start.column,n=this.source.start.line;for(let o=0;o<e;o++)r[o]===`-`?(i=1,n+=1):i+=1;return{column:i,line:n}}prev(){if(!this.parent)return;let e=this.parent.index(this);return this.parent.nodes[e-1]}rangeBy(e){let t={column:this.source.start.column,line:this.source.start.line},r=this.source.end?{column:this.source.end.column+1,line:this.source.end.line}:{column:t.column+1,line:t.line};if(e.word){let i=this.toString(),n=i.indexOf(e.word);n!==-1&&(t=this.positionInside(n,i),r=this.positionInside(n+e.word.length,i))}else e.start?t={column:e.start.column,line:e.start.line}:e.index&&(t=this.positionInside(e.index)),e.end?r={column:e.end.column,line:e.end.line}:typeof e.endIndex=="number"?r=this.positionInside(e.endIndex):e.index&&(r=this.positionInside(e.index+1));return(r.line<t.line||r.line===t.line&&r.column<=t.column)&&(r={column:t.column+1,line:t.line}),{end:r,start:t}}raw(e,t){return new Qa().raw(this,e,t)}remove(){return this.parent&&this.parent.removeChild(this),this.parent=void 0,this}replaceWith(...e){if(this.parent){let t=this,r=!1;for(let i of e)i===this?r=!0:r?(this.parent.insertAfter(t,i),t=i):this.parent.insertBefore(t,i);r||this.remove()}return this}root(){let e=this;for(;e.parent&&e.parent.type!=="document";)e=e.parent;return e}toJSON(e,t){let r={},i=t==null;t=t||new Map;let n=0;for(let o in this){if(!Object.prototype.hasOwnProperty.call(this,o)||o==="parent"||o==="proxyCache")continue;let l=this[o];if(Array.isArray(l))r[o]=l.map(a=>typeof a=="object"&&a.toJSON?a.toJSON(null,t):a);else if(typeof l=="object"&&l.toJSON)r[o]=l.toJSON(null,t);else if(o==="source"){let a=t.get(l.input);a==null&&(a=n,t.set(l.input,n),n++),r[o]={end:l.end,inputId:a,start:l.start}}else r[o]=l}return i&&(r.inputs=[...t.keys()].map(o=>o.toJSON())),r}toProxy(){return this.proxyCache||(this.proxyCache=new Proxy(this,this.getProxyProcessor())),this.proxyCache}toString(e=qa){e.stringify&&(e=e.stringify);let t="";return e(this,r=>{t+=r}),t}warn(e,t,r){let i={node:this};for(let n in r)i[n]=r[n];return e.warn(t,i)}get proxyOf(){return this}};var xt=Tr;Tr.default=Tr;let el=xt,Pr=class extends el{constructor(e){e&&typeof e.value<"u"&&typeof e.value!="string"&&(e={...e,value:String(e.value)}),super(e),this.type="decl"}get variable(){return this.prop.startsWith("--")||this.prop[0]==="$"}};var Ot=Pr;Pr.default=Pr;let tl="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";var rl={nanoid:(s=21)=>{let e="",t=s;for(;t--;)e+=tl[Math.random()*64|0];return e}};let{SourceMapConsumer:di,SourceMapGenerator:pi}=ne,{existsSync:sl,readFileSync:il}=ne,{dirname:Dr,join:nl}=ne;function ol(s){return Buffer?Buffer.from(s,"base64").toString():window.atob(s)}let Lr=class{constructor(e,t){if(t.map===!1)return;this.loadAnnotation(e),this.inline=this.startWith(this.annotation,"data:");let r=t.map?t.map.prev:void 0,i=this.loadMap(t.from,r);!this.mapFile&&t.from&&(this.mapFile=t.from),this.mapFile&&(this.root=Dr(this.mapFile)),i&&(this.text=i)}consumer(){return this.consumerCache||(this.consumerCache=new di(this.text)),this.consumerCache}decodeInline(e){let t=/^data:application\/json;charset=utf-?8;base64,/,r=/^data:application\/json;base64,/,i=/^data:application\/json;charset=utf-?8,/,n=/^data:application\/json,/;if(i.test(e)||n.test(e))return decodeURIComponent(e.substr(RegExp.lastMatch.length));if(t.test(e)||r.test(e))return ol(e.substr(RegExp.lastMatch.length));let o=e.match(/data:application\/json;([^,]+),/)[1];throw new Error("Unsupported source map encoding "+o)}getAnnotationURL(e){return e.replace(/^\/\*\s*# sourceMappingURL=/,"").trim()}isMap(e){return typeof e!="object"?!1:typeof e.mappings=="string"||typeof e._mappings=="string"||Array.isArray(e.sections)}loadAnnotation(e){let t=e.match(/\/\*\s*# sourceMappingURL=/gm);if(!t)return;let r=e.lastIndexOf(t.pop()),i=e.indexOf("*/",r);r>-1&&i>-1&&(this.annotation=this.getAnnotationURL(e.substring(r,i)))}loadFile(e){if(this.root=Dr(e),sl(e))return this.mapFile=e,il(e,"utf-8").toString().trim()}loadMap(e,t){if(t===!1)return!1;if(t){if(typeof t=="string")return t;if(typeof t=="function"){let r=t(e);if(r){let i=this.loadFile(r);if(!i)throw new Error("Unable to load previous source map: "+r.toString());return i}}else{if(t instanceof di)return pi.fromSourceMap(t).toString();if(t instanceof pi)return t.toString();if(this.isMap(t))return JSON.stringify(t);throw new Error("Unsupported previous source map format: "+t.toString())}}else{if(this.inline)return this.decodeInline(this.annotation);if(this.annotation){let r=this.annotation;return e&&(r=nl(Dr(e),r)),this.loadFile(r)}}}startWith(e,t){return e?e.substr(0,t.length)===t:!1}withContent(){return!!(this.consumer().sourcesContent&&this.consumer().sourcesContent.length>0)}};var mi=Lr;Lr.default=Lr;let{SourceMapConsumer:al,SourceMapGenerator:ll}=ne,{fileURLToPath:gi,pathToFileURL:Rt}=ne,{isAbsolute:_r,resolve:Fr}=ne,{nanoid:ul}=rl,Ur=ne,yi=Mr,cl=mi,Br=Symbol("fromOffsetCache"),hl=!!(al&&ll),wi=!!(Fr&&_r),Et=class{constructor(e,t={}){if(e===null||typeof e>"u"||typeof e=="object"&&!e.toString)throw new Error(`PostCSS received ${e} instead of CSS string`);if(this.css=e.toString(),this.css[0]==="\uFEFF"||this.css[0]===""?(this.hasBOM=!0,this.css=this.css.slice(1)):this.hasBOM=!1,t.from&&(!wi||/^\w+:\/\//.test(t.from)||_r(t.from)?this.file=t.from:this.file=Fr(t.from)),wi&&hl){let r=new cl(this.css,t);if(r.text){this.map=r;let i=r.consumer().file;!this.file&&i&&(this.file=this.mapResolve(i))}}this.file||(this.id="<input css "+ul(6)+">"),this.map&&(this.map.file=this.from)}error(e,t,r,i={}){let n,o,l;if(t&&typeof t=="object"){let u=t,c=r;if(typeof u.offset=="number"){let h=this.fromOffset(u.offset);t=h.line,r=h.col}else t=u.line,r=u.column;if(typeof c.offset=="number"){let h=this.fromOffset(c.offset);o=h.line,l=h.col}else o=c.line,l=c.column}else if(!r){let u=this.fromOffset(t);t=u.line,r=u.col}let a=this.origin(t,r,o,l);return a?n=new yi(e,a.endLine===void 0?a.line:{column:a.column,line:a.line},a.endLine===void 0?a.column:{column:a.endColumn,line:a.endLine},a.source,a.file,i.plugin):n=new yi(e,o===void 0?t:{column:r,line:t},o===void 0?r:{column:l,line:o},this.css,this.file,i.plugin),n.input={column:r,endColumn:l,endLine:o,line:t,source:this.css},this.file&&(Rt&&(n.input.url=Rt(this.file).toString()),n.input.file=this.file),n}fromOffset(e){let t,r;if(this[Br])r=this[Br];else{let n=this.css.split(`-`);r=new Array(n.length);let o=0;for(let l=0,a=n.length;l<a;l++)r[l]=o,o+=n[l].length+1;this[Br]=r}t=r[r.length-1];let i=0;if(e>=t)i=r.length-1;else{let n=r.length-2,o;for(;i<n;)if(o=i+(n-i>>1),e<r[o])n=o-1;else if(e>=r[o+1])i=o+1;else{i=o;break}}return{col:e-r[i]+1,line:i+1}}mapResolve(e){return/^\w+:\/\//.test(e)?e:Fr(this.map.consumer().sourceRoot||this.map.root||".",e)}origin(e,t,r,i){if(!this.map)return!1;let n=this.map.consumer(),o=n.originalPositionFor({column:t,line:e});if(!o.source)return!1;let l;typeof r=="number"&&(l=n.originalPositionFor({column:i,line:r}));let a;_r(o.source)?a=Rt(o.source):a=new URL(o.source,this.map.consumer().sourceRoot||Rt(this.map.mapFile));let u={column:o.column,endColumn:l&&l.column,endLine:l&&l.line,line:o.line,url:a.toString()};if(a.protocol==="file:")if(gi)u.file=gi(a);else throw new Error("file: protocol is not available in this PostCSS build");let c=n.sourceContentFor(o.source);return c&&(u.source=c),u}toJSON(){let e={};for(let t of["hasBOM","css","file","id"])this[t]!=null&&(e[t]=this[t]);return this.map&&(e.map={...this.map},e.map.consumerCache&&(e.map.consumerCache=void 0)),e}get from(){return this.file||this.id}};var At=Et;Et.default=Et,Ur&&Ur.registerInput&&Ur.registerInput(Et);let{SourceMapConsumer:bi,SourceMapGenerator:Mt}=ne,{dirname:$t,relative:Si,resolve:Ci,sep:vi}=ne,{pathToFileURL:Ii}=ne,fl=At,dl=!!(bi&&Mt),pl=!!($t&&Ci&&Si&&vi);var xi=class{constructor(e,t,r,i){this.stringify=e,this.mapOpts=r.map||{},this.root=t,this.opts=r,this.css=i,this.originalCSS=i,this.usesFileUrls=!this.mapOpts.from&&this.mapOpts.absolute,this.memoizedFileURLs=new Map,this.memoizedPaths=new Map,this.memoizedURLs=new Map}addAnnotation(){let e;this.isInline()?e="data:application/json;base64,"+this.toBase64(this.map.toString()):typeof this.mapOpts.annotation=="string"?e=this.mapOpts.annotation:typeof this.mapOpts.annotation=="function"?e=this.mapOpts.annotation(this.opts.to,this.root):e=this.outputFile()+".map";let t=`+`);return t=n[n.length-1],t=t.replace(/\S/g,""),!1}}),t}rawSemicolon(e){let t;return e.walk(r=>{if(r.nodes&&r.nodes.length&&r.last.type==="decl"&&(t=r.raws.semicolon,typeof t<"u"))return!1}),t}rawValue(e,t){let r=e[t],i=e.raws[t];return i&&i.value===r?i.raw:r}root(e){this.body(e),e.raws.after&&this.builder(e.raws.after)}rule(e){this.block(e,this.rawValue(e,"selector")),e.raws.ownSemicolon&&this.builder(e.raws.ownSemicolon,e,"end")}stringify(e,t){if(!this[e.type])throw new Error("Unknown AST node type "+e.type+". Maybe you need to change PostCSS stringifier.");this[e.type](e,t)}};var fi=$r;$r.default=$r;let Ka=fi;function Nr(s,e){new Ka(e).stringify(s)}var Ct=Nr;Nr.default=Nr;let{isClean:It,my:Xa}=Je,Qa=Mr,qa=fi,el=Ct;function kr(s,e){let t=new s.constructor;for(let r in s){if(!Object.prototype.hasOwnProperty.call(s,r)||r==="proxyCache")continue;let i=s[r],n=typeof i;r==="parent"&&n==="object"?e&&(t[r]=e):r==="source"?t[r]=i:Array.isArray(i)?t[r]=i.map(o=>kr(o,t)):(n==="object"&&i!==null&&(i=kr(i)),t[r]=i)}return t}let Tr=class{constructor(e={}){this.raws={},this[It]=!1,this[Xa]=!0;for(let t in e)if(t==="nodes"){this.nodes=[];for(let r of e[t])typeof r.clone=="function"?this.append(r.clone()):this.append(r)}else this[t]=e[t]}addToError(e){if(e.postcssNode=this,e.stack&&this.source&&/\n\s{4}at /.test(e.stack)){let t=this.source;e.stack=e.stack.replace(/\n\s{4}at /,`$&${t.input.from}:${t.start.line}:${t.start.column}$&`)}return e}after(e){return this.parent.insertAfter(this,e),this}assign(e={}){for(let t in e)this[t]=e[t];return this}before(e){return this.parent.insertBefore(this,e),this}cleanRaws(e){delete this.raws.before,delete this.raws.after,e||delete this.raws.between}clone(e={}){let t=kr(this);for(let r in e)t[r]=e[r];return t}cloneAfter(e={}){let t=this.clone(e);return this.parent.insertAfter(this,t),t}cloneBefore(e={}){let t=this.clone(e);return this.parent.insertBefore(this,t),t}error(e,t={}){if(this.source){let{end:r,start:i}=this.rangeBy(t);return this.source.input.error(e,{column:i.column,line:i.line},{column:r.column,line:r.line},t)}return new Qa(e)}getProxyProcessor(){return{get(e,t){return t==="proxyOf"?e:t==="root"?()=>e.root().toProxy():e[t]},set(e,t,r){return e[t]===r||(e[t]=r,(t==="prop"||t==="value"||t==="name"||t==="params"||t==="important"||t==="text")&&e.markDirty()),!0}}}markDirty(){if(this[It]){this[It]=!1;let e=this;for(;e=e.parent;)e[It]=!1}}next(){if(!this.parent)return;let e=this.parent.index(this);return this.parent.nodes[e+1]}positionBy(e,t){let r=this.source.start;if(e.index)r=this.positionInside(e.index,t);else if(e.word){t=this.toString();let i=t.indexOf(e.word);i!==-1&&(r=this.positionInside(i,t))}return r}positionInside(e,t){let r=t||this.toString(),i=this.source.start.column,n=this.source.start.line;for(let o=0;o<e;o++)r[o]===`+`?(i=1,n+=1):i+=1;return{column:i,line:n}}prev(){if(!this.parent)return;let e=this.parent.index(this);return this.parent.nodes[e-1]}rangeBy(e){let t={column:this.source.start.column,line:this.source.start.line},r=this.source.end?{column:this.source.end.column+1,line:this.source.end.line}:{column:t.column+1,line:t.line};if(e.word){let i=this.toString(),n=i.indexOf(e.word);n!==-1&&(t=this.positionInside(n,i),r=this.positionInside(n+e.word.length,i))}else e.start?t={column:e.start.column,line:e.start.line}:e.index&&(t=this.positionInside(e.index)),e.end?r={column:e.end.column,line:e.end.line}:typeof e.endIndex=="number"?r=this.positionInside(e.endIndex):e.index&&(r=this.positionInside(e.index+1));return(r.line<t.line||r.line===t.line&&r.column<=t.column)&&(r={column:t.column+1,line:t.line}),{end:r,start:t}}raw(e,t){return new qa().raw(this,e,t)}remove(){return this.parent&&this.parent.removeChild(this),this.parent=void 0,this}replaceWith(...e){if(this.parent){let t=this,r=!1;for(let i of e)i===this?r=!0:r?(this.parent.insertAfter(t,i),t=i):this.parent.insertBefore(t,i);r||this.remove()}return this}root(){let e=this;for(;e.parent&&e.parent.type!=="document";)e=e.parent;return e}toJSON(e,t){let r={},i=t==null;t=t||new Map;let n=0;for(let o in this){if(!Object.prototype.hasOwnProperty.call(this,o)||o==="parent"||o==="proxyCache")continue;let l=this[o];if(Array.isArray(l))r[o]=l.map(a=>typeof a=="object"&&a.toJSON?a.toJSON(null,t):a);else if(typeof l=="object"&&l.toJSON)r[o]=l.toJSON(null,t);else if(o==="source"){let a=t.get(l.input);a==null&&(a=n,t.set(l.input,n),n++),r[o]={end:l.end,inputId:a,start:l.start}}else r[o]=l}return i&&(r.inputs=[...t.keys()].map(o=>o.toJSON())),r}toProxy(){return this.proxyCache||(this.proxyCache=new Proxy(this,this.getProxyProcessor())),this.proxyCache}toString(e=el){e.stringify&&(e=e.stringify);let t="";return e(this,r=>{t+=r}),t}warn(e,t,r){let i={node:this};for(let n in r)i[n]=r[n];return e.warn(t,i)}get proxyOf(){return this}};var xt=Tr;Tr.default=Tr;let tl=xt,Pr=class extends tl{constructor(e){e&&typeof e.value<"u"&&typeof e.value!="string"&&(e={...e,value:String(e.value)}),super(e),this.type="decl"}get variable(){return this.prop.startsWith("--")||this.prop[0]==="$"}};var At=Pr;Pr.default=Pr;let rl="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";var sl={nanoid:(s=21)=>{let e="",t=s;for(;t--;)e+=rl[Math.random()*64|0];return e}};let{SourceMapConsumer:di,SourceMapGenerator:pi}=oe,{existsSync:il,readFileSync:nl}=oe,{dirname:Dr,join:ol}=oe;function al(s){return Buffer?Buffer.from(s,"base64").toString():window.atob(s)}let Lr=class{constructor(e,t){if(t.map===!1)return;this.loadAnnotation(e),this.inline=this.startWith(this.annotation,"data:");let r=t.map?t.map.prev:void 0,i=this.loadMap(t.from,r);!this.mapFile&&t.from&&(this.mapFile=t.from),this.mapFile&&(this.root=Dr(this.mapFile)),i&&(this.text=i)}consumer(){return this.consumerCache||(this.consumerCache=new di(this.text)),this.consumerCache}decodeInline(e){let t=/^data:application\/json;charset=utf-?8;base64,/,r=/^data:application\/json;base64,/,i=/^data:application\/json;charset=utf-?8,/,n=/^data:application\/json,/;if(i.test(e)||n.test(e))return decodeURIComponent(e.substr(RegExp.lastMatch.length));if(t.test(e)||r.test(e))return al(e.substr(RegExp.lastMatch.length));let o=e.match(/data:application\/json;([^,]+),/)[1];throw new Error("Unsupported source map encoding "+o)}getAnnotationURL(e){return e.replace(/^\/\*\s*# sourceMappingURL=/,"").trim()}isMap(e){return typeof e!="object"?!1:typeof e.mappings=="string"||typeof e._mappings=="string"||Array.isArray(e.sections)}loadAnnotation(e){let t=e.match(/\/\*\s*# sourceMappingURL=/gm);if(!t)return;let r=e.lastIndexOf(t.pop()),i=e.indexOf("*/",r);r>-1&&i>-1&&(this.annotation=this.getAnnotationURL(e.substring(r,i)))}loadFile(e){if(this.root=Dr(e),il(e))return this.mapFile=e,nl(e,"utf-8").toString().trim()}loadMap(e,t){if(t===!1)return!1;if(t){if(typeof t=="string")return t;if(typeof t=="function"){let r=t(e);if(r){let i=this.loadFile(r);if(!i)throw new Error("Unable to load previous source map: "+r.toString());return i}}else{if(t instanceof di)return pi.fromSourceMap(t).toString();if(t instanceof pi)return t.toString();if(this.isMap(t))return JSON.stringify(t);throw new Error("Unsupported previous source map format: "+t.toString())}}else{if(this.inline)return this.decodeInline(this.annotation);if(this.annotation){let r=this.annotation;return e&&(r=ol(Dr(e),r)),this.loadFile(r)}}}startWith(e,t){return e?e.substr(0,t.length)===t:!1}withContent(){return!!(this.consumer().sourcesContent&&this.consumer().sourcesContent.length>0)}};var mi=Lr;Lr.default=Lr;let{SourceMapConsumer:ll,SourceMapGenerator:ul}=oe,{fileURLToPath:gi,pathToFileURL:Rt}=oe,{isAbsolute:_r,resolve:Fr}=oe,{nanoid:cl}=sl,Ur=oe,yi=Mr,hl=mi,Br=Symbol("fromOffsetCache"),fl=!!(ll&&ul),wi=!!(Fr&&_r),Ot=class{constructor(e,t={}){if(e===null||typeof e>"u"||typeof e=="object"&&!e.toString)throw new Error(`PostCSS received ${e} instead of CSS string`);if(this.css=e.toString(),this.css[0]==="\uFEFF"||this.css[0]===""?(this.hasBOM=!0,this.css=this.css.slice(1)):this.hasBOM=!1,t.from&&(!wi||/^\w+:\/\//.test(t.from)||_r(t.from)?this.file=t.from:this.file=Fr(t.from)),wi&&fl){let r=new hl(this.css,t);if(r.text){this.map=r;let i=r.consumer().file;!this.file&&i&&(this.file=this.mapResolve(i))}}this.file||(this.id="<input css "+cl(6)+">"),this.map&&(this.map.file=this.from)}error(e,t,r,i={}){let n,o,l;if(t&&typeof t=="object"){let u=t,c=r;if(typeof u.offset=="number"){let h=this.fromOffset(u.offset);t=h.line,r=h.col}else t=u.line,r=u.column;if(typeof c.offset=="number"){let h=this.fromOffset(c.offset);o=h.line,l=h.col}else o=c.line,l=c.column}else if(!r){let u=this.fromOffset(t);t=u.line,r=u.col}let a=this.origin(t,r,o,l);return a?n=new yi(e,a.endLine===void 0?a.line:{column:a.column,line:a.line},a.endLine===void 0?a.column:{column:a.endColumn,line:a.endLine},a.source,a.file,i.plugin):n=new yi(e,o===void 0?t:{column:r,line:t},o===void 0?r:{column:l,line:o},this.css,this.file,i.plugin),n.input={column:r,endColumn:l,endLine:o,line:t,source:this.css},this.file&&(Rt&&(n.input.url=Rt(this.file).toString()),n.input.file=this.file),n}fromOffset(e){let t,r;if(this[Br])r=this[Br];else{let n=this.css.split(`+`);r=new Array(n.length);let o=0;for(let l=0,a=n.length;l<a;l++)r[l]=o,o+=n[l].length+1;this[Br]=r}t=r[r.length-1];let i=0;if(e>=t)i=r.length-1;else{let n=r.length-2,o;for(;i<n;)if(o=i+(n-i>>1),e<r[o])n=o-1;else if(e>=r[o+1])i=o+1;else{i=o;break}}return{col:e-r[i]+1,line:i+1}}mapResolve(e){return/^\w+:\/\//.test(e)?e:Fr(this.map.consumer().sourceRoot||this.map.root||".",e)}origin(e,t,r,i){if(!this.map)return!1;let n=this.map.consumer(),o=n.originalPositionFor({column:t,line:e});if(!o.source)return!1;let l;typeof r=="number"&&(l=n.originalPositionFor({column:i,line:r}));let a;_r(o.source)?a=Rt(o.source):a=new URL(o.source,this.map.consumer().sourceRoot||Rt(this.map.mapFile));let u={column:o.column,endColumn:l&&l.column,endLine:l&&l.line,line:o.line,url:a.toString()};if(a.protocol==="file:")if(gi)u.file=gi(a);else throw new Error("file: protocol is not available in this PostCSS build");let c=n.sourceContentFor(o.source);return c&&(u.source=c),u}toJSON(){let e={};for(let t of["hasBOM","css","file","id"])this[t]!=null&&(e[t]=this[t]);return this.map&&(e.map={...this.map},e.map.consumerCache&&(e.map.consumerCache=void 0)),e}get from(){return this.file||this.id}};var Et=Ot;Ot.default=Ot,Ur&&Ur.registerInput&&Ur.registerInput(Ot);let{SourceMapConsumer:Si,SourceMapGenerator:Mt}=oe,{dirname:$t,relative:bi,resolve:vi,sep:Ci}=oe,{pathToFileURL:Ii}=oe,dl=Et,pl=!!(Si&&Mt),ml=!!($t&&vi&&bi&&Ci);var xi=class{constructor(e,t,r,i){this.stringify=e,this.mapOpts=r.map||{},this.root=t,this.opts=r,this.css=i,this.originalCSS=i,this.usesFileUrls=!this.mapOpts.from&&this.mapOpts.absolute,this.memoizedFileURLs=new Map,this.memoizedPaths=new Map,this.memoizedURLs=new Map}addAnnotation(){let e;this.isInline()?e="data:application/json;base64,"+this.toBase64(this.map.toString()):typeof this.mapOpts.annotation=="string"?e=this.mapOpts.annotation:typeof this.mapOpts.annotation=="function"?e=this.mapOpts.annotation(this.opts.to,this.root):e=this.outputFile()+".map";let t=``;this.css.includes(`\r`)&&(t=`\r-`),this.css+=t+"/*# sourceMappingURL="+e+" */"}applyPrevMaps(){for(let e of this.previous()){let t=this.toUrl(this.path(e.file)),r=e.root||$t(e.file),i;this.mapOpts.sourcesContent===!1?(i=new bi(e.text),i.sourcesContent&&(i.sourcesContent=null)):i=e.consumer(),this.map.applySourceMap(i,t,this.toUrl(this.path(r)))}}clearAnnotation(){if(this.mapOpts.annotation!==!1)if(this.root){let e;for(let t=this.root.nodes.length-1;t>=0;t--)e=this.root.nodes[t],e.type==="comment"&&e.text.indexOf("# sourceMappingURL=")===0&&this.root.removeChild(t)}else this.css&&(this.css=this.css.replace(/\n*?\/\*#[\S\s]*?\*\/$/gm,""))}generate(){if(this.clearAnnotation(),pl&&dl&&this.isMap())return this.generateMap();{let e="";return this.stringify(this.root,t=>{e+=t}),[e]}}generateMap(){if(this.root)this.generateString();else if(this.previous().length===1){let e=this.previous()[0].consumer();e.file=this.outputFile(),this.map=Mt.fromSourceMap(e,{ignoreInvalidMapping:!0})}else this.map=new Mt({file:this.outputFile(),ignoreInvalidMapping:!0}),this.map.addMapping({generated:{column:0,line:1},original:{column:0,line:1},source:this.opts.from?this.toUrl(this.path(this.opts.from)):"<no source>"});return this.isSourcesContent()&&this.setSourcesContent(),this.root&&this.previous().length>0&&this.applyPrevMaps(),this.isAnnotation()&&this.addAnnotation(),this.isInline()?[this.css]:[this.css,this.map]}generateString(){this.css="",this.map=new Mt({file:this.outputFile(),ignoreInvalidMapping:!0});let e=1,t=1,r="<no source>",i={generated:{column:0,line:0},original:{column:0,line:0},source:""},n,o;this.stringify(this.root,(l,a,u)=>{if(this.css+=l,a&&u!=="end"&&(i.generated.line=e,i.generated.column=t-1,a.source&&a.source.start?(i.source=this.sourcePath(a),i.original.line=a.source.start.line,i.original.column=a.source.start.column-1,this.map.addMapping(i)):(i.source=r,i.original.line=1,i.original.column=0,this.map.addMapping(i))),n=l.match(/\n/g),n?(e+=n.length,o=l.lastIndexOf(`-`),t=l.length-o):t+=l.length,a&&u!=="start"){let c=a.parent||{raws:{}};(!(a.type==="decl"||a.type==="atrule"&&!a.nodes)||a!==c.last||c.raws.semicolon)&&(a.source&&a.source.end?(i.source=this.sourcePath(a),i.original.line=a.source.end.line,i.original.column=a.source.end.column-1,i.generated.line=e,i.generated.column=t-2,this.map.addMapping(i)):(i.source=r,i.original.line=1,i.original.column=0,i.generated.line=e,i.generated.column=t-1,this.map.addMapping(i)))}})}isAnnotation(){return this.isInline()?!0:typeof this.mapOpts.annotation<"u"?this.mapOpts.annotation:this.previous().length?this.previous().some(e=>e.annotation):!0}isInline(){if(typeof this.mapOpts.inline<"u")return this.mapOpts.inline;let e=this.mapOpts.annotation;return typeof e<"u"&&e!==!0?!1:this.previous().length?this.previous().some(t=>t.inline):!0}isMap(){return typeof this.opts.map<"u"?!!this.opts.map:this.previous().length>0}isSourcesContent(){return typeof this.mapOpts.sourcesContent<"u"?this.mapOpts.sourcesContent:this.previous().length?this.previous().some(e=>e.withContent()):!0}outputFile(){return this.opts.to?this.path(this.opts.to):this.opts.from?this.path(this.opts.from):"to.css"}path(e){if(this.mapOpts.absolute||e.charCodeAt(0)===60||/^\w+:\/\//.test(e))return e;let t=this.memoizedPaths.get(e);if(t)return t;let r=this.opts.to?$t(this.opts.to):".";typeof this.mapOpts.annotation=="string"&&(r=$t(Ci(r,this.mapOpts.annotation)));let i=Si(r,e);return this.memoizedPaths.set(e,i),i}previous(){if(!this.previousMaps)if(this.previousMaps=[],this.root)this.root.walk(e=>{if(e.source&&e.source.input.map){let t=e.source.input.map;this.previousMaps.includes(t)||this.previousMaps.push(t)}});else{let e=new fl(this.originalCSS,this.opts);e.map&&this.previousMaps.push(e.map)}return this.previousMaps}setSourcesContent(){let e={};if(this.root)this.root.walk(t=>{if(t.source){let r=t.source.input.from;if(r&&!e[r]){e[r]=!0;let i=this.usesFileUrls?this.toFileUrl(r):this.toUrl(this.path(r));this.map.setSourceContent(i,t.source.input.css)}}});else if(this.css){let t=this.opts.from?this.toUrl(this.path(this.opts.from)):"<no source>";this.map.setSourceContent(t,this.css)}}sourcePath(e){return this.mapOpts.from?this.toUrl(this.mapOpts.from):this.usesFileUrls?this.toFileUrl(e.source.input.from):this.toUrl(this.path(e.source.input.from))}toBase64(e){return Buffer?Buffer.from(e).toString("base64"):window.btoa(unescape(encodeURIComponent(e)))}toFileUrl(e){let t=this.memoizedFileURLs.get(e);if(t)return t;if(Ii){let r=Ii(e).toString();return this.memoizedFileURLs.set(e,r),r}else throw new Error("`map.absolute` option is not available in this PostCSS build")}toUrl(e){let t=this.memoizedURLs.get(e);if(t)return t;vi==="\\"&&(e=e.replace(/\\/g,"/"));let r=encodeURI(e).replace(/[#?]/g,encodeURIComponent);return this.memoizedURLs.set(e,r),r}};let ml=xt,zr=class extends ml{constructor(e){super(e),this.type="comment"}};var Nt=zr;zr.default=zr;let{isClean:Oi,my:Ri}=Je,Ei=Ot,Ai=Nt,gl=xt,Mi,Wr,Gr,$i;function Ni(s){return s.map(e=>(e.nodes&&(e.nodes=Ni(e.nodes)),delete e.source,e))}function ki(s){if(s[Oi]=!1,s.proxyOf.nodes)for(let e of s.proxyOf.nodes)ki(e)}let we=class jo extends gl{append(...e){for(let t of e){let r=this.normalize(t,this.last);for(let i of r)this.proxyOf.nodes.push(i)}return this.markDirty(),this}cleanRaws(e){if(super.cleanRaws(e),this.nodes)for(let t of this.nodes)t.cleanRaws(e)}each(e){if(!this.proxyOf.nodes)return;let t=this.getIterator(),r,i;for(;this.indexes[t]<this.proxyOf.nodes.length&&(r=this.indexes[t],i=e(this.proxyOf.nodes[r],r),i!==!1);)this.indexes[t]+=1;return delete this.indexes[t],i}every(e){return this.nodes.every(e)}getIterator(){this.lastEach||(this.lastEach=0),this.indexes||(this.indexes={}),this.lastEach+=1;let e=this.lastEach;return this.indexes[e]=0,e}getProxyProcessor(){return{get(e,t){return t==="proxyOf"?e:e[t]?t==="each"||typeof t=="string"&&t.startsWith("walk")?(...r)=>e[t](...r.map(i=>typeof i=="function"?(n,o)=>i(n.toProxy(),o):i)):t==="every"||t==="some"?r=>e[t]((i,...n)=>r(i.toProxy(),...n)):t==="root"?()=>e.root().toProxy():t==="nodes"?e.nodes.map(r=>r.toProxy()):t==="first"||t==="last"?e[t].toProxy():e[t]:e[t]},set(e,t,r){return e[t]===r||(e[t]=r,(t==="name"||t==="params"||t==="selector")&&e.markDirty()),!0}}}index(e){return typeof e=="number"?e:(e.proxyOf&&(e=e.proxyOf),this.proxyOf.nodes.indexOf(e))}insertAfter(e,t){let r=this.index(e),i=this.normalize(t,this.proxyOf.nodes[r]).reverse();r=this.index(e);for(let o of i)this.proxyOf.nodes.splice(r+1,0,o);let n;for(let o in this.indexes)n=this.indexes[o],r<n&&(this.indexes[o]=n+i.length);return this.markDirty(),this}insertBefore(e,t){let r=this.index(e),i=r===0?"prepend":!1,n=this.normalize(t,this.proxyOf.nodes[r],i).reverse();r=this.index(e);for(let l of n)this.proxyOf.nodes.splice(r,0,l);let o;for(let l in this.indexes)o=this.indexes[l],r<=o&&(this.indexes[l]=o+n.length);return this.markDirty(),this}normalize(e,t){if(typeof e=="string")e=Ni(Mi(e).nodes);else if(typeof e>"u")e=[];else if(Array.isArray(e)){e=e.slice(0);for(let i of e)i.parent&&i.parent.removeChild(i,"ignore")}else if(e.type==="root"&&this.type!=="document"){e=e.nodes.slice(0);for(let i of e)i.parent&&i.parent.removeChild(i,"ignore")}else if(e.type)e=[e];else if(e.prop){if(typeof e.value>"u")throw new Error("Value field is missed in node creation");typeof e.value!="string"&&(e.value=String(e.value)),e=[new Ei(e)]}else if(e.selector)e=[new Wr(e)];else if(e.name)e=[new Gr(e)];else if(e.text)e=[new Ai(e)];else throw new Error("Unknown node type in node creation");return e.map(i=>(i[Ri]||jo.rebuild(i),i=i.proxyOf,i.parent&&i.parent.removeChild(i),i[Oi]&&ki(i),typeof i.raws.before>"u"&&t&&typeof t.raws.before<"u"&&(i.raws.before=t.raws.before.replace(/\S/g,"")),i.parent=this.proxyOf,i))}prepend(...e){e=e.reverse();for(let t of e){let r=this.normalize(t,this.first,"prepend").reverse();for(let i of r)this.proxyOf.nodes.unshift(i);for(let i in this.indexes)this.indexes[i]=this.indexes[i]+r.length}return this.markDirty(),this}push(e){return e.parent=this,this.proxyOf.nodes.push(e),this}removeAll(){for(let e of this.proxyOf.nodes)e.parent=void 0;return this.proxyOf.nodes=[],this.markDirty(),this}removeChild(e){e=this.index(e),this.proxyOf.nodes[e].parent=void 0,this.proxyOf.nodes.splice(e,1);let t;for(let r in this.indexes)t=this.indexes[r],t>=e&&(this.indexes[r]=t-1);return this.markDirty(),this}replaceValues(e,t,r){return r||(r=t,t={}),this.walkDecls(i=>{t.props&&!t.props.includes(i.prop)||t.fast&&!i.value.includes(t.fast)||(i.value=i.value.replace(e,r))}),this.markDirty(),this}some(e){return this.nodes.some(e)}walk(e){return this.each((t,r)=>{let i;try{i=e(t,r)}catch(n){throw t.addToError(n)}return i!==!1&&t.walk&&(i=t.walk(e)),i})}walkAtRules(e,t){return t?e instanceof RegExp?this.walk((r,i)=>{if(r.type==="atrule"&&e.test(r.name))return t(r,i)}):this.walk((r,i)=>{if(r.type==="atrule"&&r.name===e)return t(r,i)}):(t=e,this.walk((r,i)=>{if(r.type==="atrule")return t(r,i)}))}walkComments(e){return this.walk((t,r)=>{if(t.type==="comment")return e(t,r)})}walkDecls(e,t){return t?e instanceof RegExp?this.walk((r,i)=>{if(r.type==="decl"&&e.test(r.prop))return t(r,i)}):this.walk((r,i)=>{if(r.type==="decl"&&r.prop===e)return t(r,i)}):(t=e,this.walk((r,i)=>{if(r.type==="decl")return t(r,i)}))}walkRules(e,t){return t?e instanceof RegExp?this.walk((r,i)=>{if(r.type==="rule"&&e.test(r.selector))return t(r,i)}):this.walk((r,i)=>{if(r.type==="rule"&&r.selector===e)return t(r,i)}):(t=e,this.walk((r,i)=>{if(r.type==="rule")return t(r,i)}))}get first(){if(this.proxyOf.nodes)return this.proxyOf.nodes[0]}get last(){if(this.proxyOf.nodes)return this.proxyOf.nodes[this.proxyOf.nodes.length-1]}};we.registerParse=s=>{Mi=s},we.registerRule=s=>{Wr=s},we.registerAtRule=s=>{Gr=s},we.registerRoot=s=>{$i=s};var xe=we;we.default=we,we.rebuild=s=>{s.type==="atrule"?Object.setPrototypeOf(s,Gr.prototype):s.type==="rule"?Object.setPrototypeOf(s,Wr.prototype):s.type==="decl"?Object.setPrototypeOf(s,Ei.prototype):s.type==="comment"?Object.setPrototypeOf(s,Ai.prototype):s.type==="root"&&Object.setPrototypeOf(s,$i.prototype),s[Ri]=!0,s.nodes&&s.nodes.forEach(e=>{we.rebuild(e)})};let yl=xe,Ti,Pi,Ke=class extends yl{constructor(e){super({type:"document",...e}),this.nodes||(this.nodes=[])}toResult(e={}){return new Ti(new Pi,this,e).stringify()}};Ke.registerLazyResult=s=>{Ti=s},Ke.registerProcessor=s=>{Pi=s};var Vr=Ke;Ke.default=Ke;let Di={};var Li=function(e){Di[e]||(Di[e]=!0,typeof console<"u"&&console.warn&&console.warn(e))};let jr=class{constructor(e,t={}){if(this.type="warning",this.text=e,t.node&&t.node.source){let r=t.node.rangeBy(t);this.line=r.start.line,this.column=r.start.column,this.endLine=r.end.line,this.endColumn=r.end.column}for(let r in t)this[r]=t[r]}toString(){return this.node?this.node.error(this.text,{index:this.index,plugin:this.plugin,word:this.word}).message:this.plugin?this.plugin+": "+this.text:this.text}};var _i=jr;jr.default=jr;let wl=_i,Yr=class{constructor(e,t,r){this.processor=e,this.messages=[],this.root=t,this.opts=r,this.css=void 0,this.map=void 0}toString(){return this.css}warn(e,t={}){t.plugin||this.lastPlugin&&this.lastPlugin.postcssPlugin&&(t.plugin=this.lastPlugin.postcssPlugin);let r=new wl(e,t);return this.messages.push(r),r}warnings(){return this.messages.filter(e=>e.type==="warning")}get content(){return this.css}};var Hr=Yr;Yr.default=Yr;const Zr=39,Fi=34,kt=92,Ui=47,Tt=10,Xe=32,Pt=12,Dt=9,Lt=13,bl=91,Sl=93,Cl=40,vl=41,Il=123,xl=125,Ol=59,Rl=42,El=58,Al=64,_t=/[\t\n\f\r "#'()/;[\\\]{}]/g,Ft=/[\t\n\f\r !"#'():;@[\\\]{}]|\/(?=\*)/g,Ml=/.[\r\n"'(/\\]/,Bi=/[\da-f]/i;var $l=function(e,t={}){let r=e.css.valueOf(),i=t.ignoreErrors,n,o,l,a,u,c,h,p,m,g,d=r.length,f=0,b=[],S=[];function y(){return f}function C(B){throw e.error("Unclosed "+B,f)}function N(){return S.length===0&&f>=d}function D(B){if(S.length)return S.pop();if(f>=d)return;let V=B?B.ignoreUnclosed:!1;switch(n=r.charCodeAt(f),n){case Tt:case Xe:case Dt:case Lt:case Pt:{o=f;do o+=1,n=r.charCodeAt(o);while(n===Xe||n===Tt||n===Dt||n===Lt||n===Pt);g=["space",r.slice(f,o)],f=o-1;break}case bl:case Sl:case Il:case xl:case El:case Ol:case vl:{let Z=String.fromCharCode(n);g=[Z,Z,f];break}case Cl:{if(p=b.length?b.pop()[1]:"",m=r.charCodeAt(f+1),p==="url"&&m!==Zr&&m!==Fi&&m!==Xe&&m!==Tt&&m!==Dt&&m!==Pt&&m!==Lt){o=f;do{if(c=!1,o=r.indexOf(")",o+1),o===-1)if(i||V){o=f;break}else C("bracket");for(h=o;r.charCodeAt(h-1)===kt;)h-=1,c=!c}while(c);g=["brackets",r.slice(f,o+1),f,o],f=o}else o=r.indexOf(")",f+1),a=r.slice(f,o+1),o===-1||Ml.test(a)?g=["(","(",f]:(g=["brackets",a,f,o],f=o);break}case Zr:case Fi:{l=n===Zr?"'":'"',o=f;do{if(c=!1,o=r.indexOf(l,o+1),o===-1)if(i||V){o=f+1;break}else C("string");for(h=o;r.charCodeAt(h-1)===kt;)h-=1,c=!c}while(c);g=["string",r.slice(f,o+1),f,o],f=o;break}case Al:{_t.lastIndex=f+1,_t.test(r),_t.lastIndex===0?o=r.length-1:o=_t.lastIndex-2,g=["at-word",r.slice(f,o+1),f,o],f=o;break}case kt:{for(o=f,u=!0;r.charCodeAt(o+1)===kt;)o+=1,u=!u;if(n=r.charCodeAt(o+1),u&&n!==Ui&&n!==Xe&&n!==Tt&&n!==Dt&&n!==Lt&&n!==Pt&&(o+=1,Bi.test(r.charAt(o)))){for(;Bi.test(r.charAt(o+1));)o+=1;r.charCodeAt(o+1)===Xe&&(o+=1)}g=["word",r.slice(f,o+1),f,o],f=o;break}default:{n===Ui&&r.charCodeAt(f+1)===Rl?(o=r.indexOf("*/",f+2)+1,o===0&&(i||V?o=r.length:C("comment")),g=["comment",r.slice(f,o+1),f,o],f=o):(Ft.lastIndex=f+1,Ft.test(r),Ft.lastIndex===0?o=r.length-1:o=Ft.lastIndex-2,g=["word",r.slice(f,o+1),f,o],b.push(g),f=o);break}}return f++,g}function Y(B){S.push(B)}return{back:Y,endOfFile:N,nextToken:D,position:y}};let zi=xe,Ut=class extends zi{constructor(e){super(e),this.type="atrule"}append(...e){return this.proxyOf.nodes||(this.nodes=[]),super.append(...e)}prepend(...e){return this.proxyOf.nodes||(this.nodes=[]),super.prepend(...e)}};var Jr=Ut;Ut.default=Ut,zi.registerAtRule(Ut);let Wi=xe,Gi,Vi,De=class extends Wi{constructor(e){super(e),this.type="root",this.nodes||(this.nodes=[])}normalize(e,t,r){let i=super.normalize(e);if(t){if(r==="prepend")this.nodes.length>1?t.raws.before=this.nodes[1].raws.before:delete t.raws.before;else if(this.first!==t)for(let n of i)n.raws.before=t.raws.before}return i}removeChild(e,t){let r=this.index(e);return!t&&r===0&&this.nodes.length>1&&(this.nodes[1].raws.before=this.nodes[r].raws.before),super.removeChild(e)}toResult(e={}){return new Gi(new Vi,this,e).stringify()}};De.registerLazyResult=s=>{Gi=s},De.registerProcessor=s=>{Vi=s};var Qe=De;De.default=De,Wi.registerRoot(De);let qe={comma(s){return qe.split(s,[","],!0)},space(s){let e=[" ",`-`," "];return qe.split(s,e)},split(s,e,t){let r=[],i="",n=!1,o=0,l=!1,a="",u=!1;for(let c of s)u?u=!1:c==="\\"?u=!0:l?c===a&&(l=!1):c==='"'||c==="'"?(l=!0,a=c):c==="("?o+=1:c===")"?o>0&&(o-=1):o===0&&e.includes(c)&&(n=!0),n?(i!==""&&r.push(i.trim()),i="",n=!1):i+=c;return(t||i!=="")&&r.push(i.trim()),r}};var ji=qe;qe.default=qe;let Yi=xe,Nl=ji,Bt=class extends Yi{constructor(e){super(e),this.type="rule",this.nodes||(this.nodes=[])}get selectors(){return Nl.comma(this.selector)}set selectors(e){let t=this.selector?this.selector.match(/,\s*/):null,r=t?t[0]:","+this.raw("between","beforeOpen");this.selector=e.join(r)}};var Kr=Bt;Bt.default=Bt,Yi.registerRule(Bt);let kl=Ot,Tl=$l,Pl=Nt,Dl=Jr,Ll=Qe,Hi=Kr;const Zi={empty:!0,space:!0};function _l(s){for(let e=s.length-1;e>=0;e--){let t=s[e],r=t[3]||t[2];if(r)return r}}var Fl=class{constructor(e){this.input=e,this.root=new Ll,this.current=this.root,this.spaces="",this.semicolon=!1,this.createTokenizer(),this.root.source={input:e,start:{column:1,line:1,offset:0}}}atrule(e){let t=new Dl;t.name=e[1].slice(1),t.name===""&&this.unnamedAtrule(t,e),this.init(t,e[2]);let r,i,n,o=!1,l=!1,a=[],u=[];for(;!this.tokenizer.endOfFile();){if(e=this.tokenizer.nextToken(),r=e[0],r==="("||r==="["?u.push(r==="("?")":"]"):r==="{"&&u.length>0?u.push("}"):r===u[u.length-1]&&u.pop(),u.length===0)if(r===";"){t.source.end=this.getPosition(e[2]),t.source.end.offset++,this.semicolon=!0;break}else if(r==="{"){l=!0;break}else if(r==="}"){if(a.length>0){for(n=a.length-1,i=a[n];i&&i[0]==="space";)i=a[--n];i&&(t.source.end=this.getPosition(i[3]||i[2]),t.source.end.offset++)}this.end(e);break}else a.push(e);else a.push(e);if(this.tokenizer.endOfFile()){o=!0;break}}t.raws.between=this.spacesAndCommentsFromEnd(a),a.length?(t.raws.afterName=this.spacesAndCommentsFromStart(a),this.raw(t,"params",a),o&&(e=a[a.length-1],t.source.end=this.getPosition(e[3]||e[2]),t.source.end.offset++,this.spaces=t.raws.between,t.raws.between="")):(t.raws.afterName="",t.params=""),l&&(t.nodes=[],this.current=t)}checkMissedSemicolon(e){let t=this.colon(e);if(t===!1)return;let r=0,i;for(let n=t-1;n>=0&&(i=e[n],!(i[0]!=="space"&&(r+=1,r===2)));n--);throw this.input.error("Missed semicolon",i[0]==="word"?i[3]+1:i[2])}colon(e){let t=0,r,i,n;for(let[o,l]of e.entries()){if(r=l,i=r[0],i==="("&&(t+=1),i===")"&&(t-=1),t===0&&i===":")if(!n)this.doubleColon(r);else{if(n[0]==="word"&&n[1]==="progid")continue;return o}n=r}return!1}comment(e){let t=new Pl;this.init(t,e[2]),t.source.end=this.getPosition(e[3]||e[2]),t.source.end.offset++;let r=e[1].slice(2,-2);if(/^\s*$/.test(r))t.text="",t.raws.left=r,t.raws.right="";else{let i=r.match(/^(\s*)([^]*\S)(\s*)$/);t.text=i[2],t.raws.left=i[1],t.raws.right=i[3]}}createTokenizer(){this.tokenizer=Tl(this.input)}decl(e,t){let r=new kl;this.init(r,e[0][2]);let i=e[e.length-1];for(i[0]===";"&&(this.semicolon=!0,e.pop()),r.source.end=this.getPosition(i[3]||i[2]||_l(e)),r.source.end.offset++;e[0][0]!=="word";)e.length===1&&this.unknownWord(e),r.raws.before+=e.shift()[1];for(r.source.start=this.getPosition(e[0][2]),r.prop="";e.length;){let u=e[0][0];if(u===":"||u==="space"||u==="comment")break;r.prop+=e.shift()[1]}r.raws.between="";let n;for(;e.length;)if(n=e.shift(),n[0]===":"){r.raws.between+=n[1];break}else n[0]==="word"&&/\w/.test(n[1])&&this.unknownWord([n]),r.raws.between+=n[1];(r.prop[0]==="_"||r.prop[0]==="*")&&(r.raws.before+=r.prop[0],r.prop=r.prop.slice(1));let o=[],l;for(;e.length&&(l=e[0][0],!(l!=="space"&&l!=="comment"));)o.push(e.shift());this.precheckMissedSemicolon(e);for(let u=e.length-1;u>=0;u--){if(n=e[u],n[1].toLowerCase()==="!important"){r.important=!0;let c=this.stringFrom(e,u);c=this.spacesFromEnd(e)+c,c!==" !important"&&(r.raws.important=c);break}else if(n[1].toLowerCase()==="important"){let c=e.slice(0),h="";for(let p=u;p>0;p--){let m=c[p][0];if(h.trim().indexOf("!")===0&&m!=="space")break;h=c.pop()[1]+h}h.trim().indexOf("!")===0&&(r.important=!0,r.raws.important=h,e=c)}if(n[0]!=="space"&&n[0]!=="comment")break}e.some(u=>u[0]!=="space"&&u[0]!=="comment")&&(r.raws.between+=o.map(u=>u[1]).join(""),o=[]),this.raw(r,"value",o.concat(e),t),r.value.includes(":")&&!t&&this.checkMissedSemicolon(e)}doubleColon(e){throw this.input.error("Double colon",{offset:e[2]},{offset:e[2]+e[1].length})}emptyRule(e){let t=new Hi;this.init(t,e[2]),t.selector="",t.raws.between="",this.current=t}end(e){this.current.nodes&&this.current.nodes.length&&(this.current.raws.semicolon=this.semicolon),this.semicolon=!1,this.current.raws.after=(this.current.raws.after||"")+this.spaces,this.spaces="",this.current.parent?(this.current.source.end=this.getPosition(e[2]),this.current.source.end.offset++,this.current=this.current.parent):this.unexpectedClose(e)}endFile(){this.current.parent&&this.unclosedBlock(),this.current.nodes&&this.current.nodes.length&&(this.current.raws.semicolon=this.semicolon),this.current.raws.after=(this.current.raws.after||"")+this.spaces,this.root.source.end=this.getPosition(this.tokenizer.position())}freeSemicolon(e){if(this.spaces+=e[1],this.current.nodes){let t=this.current.nodes[this.current.nodes.length-1];t&&t.type==="rule"&&!t.raws.ownSemicolon&&(t.raws.ownSemicolon=this.spaces,this.spaces="")}}getPosition(e){let t=this.input.fromOffset(e);return{column:t.col,line:t.line,offset:e}}init(e,t){this.current.push(e),e.source={input:this.input,start:this.getPosition(t)},e.raws.before=this.spaces,this.spaces="",e.type!=="comment"&&(this.semicolon=!1)}other(e){let t=!1,r=null,i=!1,n=null,o=[],l=e[1].startsWith("--"),a=[],u=e;for(;u;){if(r=u[0],a.push(u),r==="("||r==="[")n||(n=u),o.push(r==="("?")":"]");else if(l&&i&&r==="{")n||(n=u),o.push("}");else if(o.length===0)if(r===";")if(i){this.decl(a,l);return}else break;else if(r==="{"){this.rule(a);return}else if(r==="}"){this.tokenizer.back(a.pop()),t=!0;break}else r===":"&&(i=!0);else r===o[o.length-1]&&(o.pop(),o.length===0&&(n=null));u=this.tokenizer.nextToken()}if(this.tokenizer.endOfFile()&&(t=!0),o.length>0&&this.unclosedBracket(n),t&&i){if(!l)for(;a.length&&(u=a[a.length-1][0],!(u!=="space"&&u!=="comment"));)this.tokenizer.back(a.pop());this.decl(a,l)}else this.unknownWord(a)}parse(){let e;for(;!this.tokenizer.endOfFile();)switch(e=this.tokenizer.nextToken(),e[0]){case"space":this.spaces+=e[1];break;case";":this.freeSemicolon(e);break;case"}":this.end(e);break;case"comment":this.comment(e);break;case"at-word":this.atrule(e);break;case"{":this.emptyRule(e);break;default:this.other(e);break}this.endFile()}precheckMissedSemicolon(){}raw(e,t,r,i){let n,o,l=r.length,a="",u=!0,c,h;for(let p=0;p<l;p+=1)n=r[p],o=n[0],o==="space"&&p===l-1&&!i?u=!1:o==="comment"?(h=r[p-1]?r[p-1][0]:"empty",c=r[p+1]?r[p+1][0]:"empty",!Zi[h]&&!Zi[c]?a.slice(-1)===","?u=!1:a+=n[1]:u=!1):a+=n[1];if(!u){let p=r.reduce((m,g)=>m+g[1],"");e.raws[t]={raw:p,value:a}}e[t]=a}rule(e){e.pop();let t=new Hi;this.init(t,e[0][2]),t.raws.between=this.spacesAndCommentsFromEnd(e),this.raw(t,"selector",e),this.current=t}spacesAndCommentsFromEnd(e){let t,r="";for(;e.length&&(t=e[e.length-1][0],!(t!=="space"&&t!=="comment"));)r=e.pop()[1]+r;return r}spacesAndCommentsFromStart(e){let t,r="";for(;e.length&&(t=e[0][0],!(t!=="space"&&t!=="comment"));)r+=e.shift()[1];return r}spacesFromEnd(e){let t,r="";for(;e.length&&(t=e[e.length-1][0],t==="space");)r=e.pop()[1]+r;return r}stringFrom(e,t){let r="";for(let i=t;i<e.length;i++)r+=e[i][1];return e.splice(t,e.length-t),r}unclosedBlock(){let e=this.current.source.start;throw this.input.error("Unclosed block",e.line,e.column)}unclosedBracket(e){throw this.input.error("Unclosed bracket",{offset:e[2]},{offset:e[2]+1})}unexpectedClose(e){throw this.input.error("Unexpected }",{offset:e[2]},{offset:e[2]+1})}unknownWord(e){throw this.input.error("Unknown word",{offset:e[0][2]},{offset:e[0][2]+e[0][1].length})}unnamedAtrule(e,t){throw this.input.error("At-rule without name",{offset:t[2]},{offset:t[2]+t[1].length})}};let Ul=xe,Bl=Fl,zl=At;function zt(s,e){let t=new zl(s,e),r=new Bl(t);try{r.parse()}catch(i){throw process.env.NODE_ENV!=="production"&&i.name==="CssSyntaxError"&&e&&e.from&&(/\.scss$/i.test(e.from)?i.message+=`+`),this.css+=t+"/*# sourceMappingURL="+e+" */"}applyPrevMaps(){for(let e of this.previous()){let t=this.toUrl(this.path(e.file)),r=e.root||$t(e.file),i;this.mapOpts.sourcesContent===!1?(i=new Si(e.text),i.sourcesContent&&(i.sourcesContent=null)):i=e.consumer(),this.map.applySourceMap(i,t,this.toUrl(this.path(r)))}}clearAnnotation(){if(this.mapOpts.annotation!==!1)if(this.root){let e;for(let t=this.root.nodes.length-1;t>=0;t--)e=this.root.nodes[t],e.type==="comment"&&e.text.indexOf("# sourceMappingURL=")===0&&this.root.removeChild(t)}else this.css&&(this.css=this.css.replace(/\n*?\/\*#[\S\s]*?\*\/$/gm,""))}generate(){if(this.clearAnnotation(),ml&&pl&&this.isMap())return this.generateMap();{let e="";return this.stringify(this.root,t=>{e+=t}),[e]}}generateMap(){if(this.root)this.generateString();else if(this.previous().length===1){let e=this.previous()[0].consumer();e.file=this.outputFile(),this.map=Mt.fromSourceMap(e,{ignoreInvalidMapping:!0})}else this.map=new Mt({file:this.outputFile(),ignoreInvalidMapping:!0}),this.map.addMapping({generated:{column:0,line:1},original:{column:0,line:1},source:this.opts.from?this.toUrl(this.path(this.opts.from)):"<no source>"});return this.isSourcesContent()&&this.setSourcesContent(),this.root&&this.previous().length>0&&this.applyPrevMaps(),this.isAnnotation()&&this.addAnnotation(),this.isInline()?[this.css]:[this.css,this.map]}generateString(){this.css="",this.map=new Mt({file:this.outputFile(),ignoreInvalidMapping:!0});let e=1,t=1,r="<no source>",i={generated:{column:0,line:0},original:{column:0,line:0},source:""},n,o;this.stringify(this.root,(l,a,u)=>{if(this.css+=l,a&&u!=="end"&&(i.generated.line=e,i.generated.column=t-1,a.source&&a.source.start?(i.source=this.sourcePath(a),i.original.line=a.source.start.line,i.original.column=a.source.start.column-1,this.map.addMapping(i)):(i.source=r,i.original.line=1,i.original.column=0,this.map.addMapping(i))),n=l.match(/\n/g),n?(e+=n.length,o=l.lastIndexOf(`+`),t=l.length-o):t+=l.length,a&&u!=="start"){let c=a.parent||{raws:{}};(!(a.type==="decl"||a.type==="atrule"&&!a.nodes)||a!==c.last||c.raws.semicolon)&&(a.source&&a.source.end?(i.source=this.sourcePath(a),i.original.line=a.source.end.line,i.original.column=a.source.end.column-1,i.generated.line=e,i.generated.column=t-2,this.map.addMapping(i)):(i.source=r,i.original.line=1,i.original.column=0,i.generated.line=e,i.generated.column=t-1,this.map.addMapping(i)))}})}isAnnotation(){return this.isInline()?!0:typeof this.mapOpts.annotation<"u"?this.mapOpts.annotation:this.previous().length?this.previous().some(e=>e.annotation):!0}isInline(){if(typeof this.mapOpts.inline<"u")return this.mapOpts.inline;let e=this.mapOpts.annotation;return typeof e<"u"&&e!==!0?!1:this.previous().length?this.previous().some(t=>t.inline):!0}isMap(){return typeof this.opts.map<"u"?!!this.opts.map:this.previous().length>0}isSourcesContent(){return typeof this.mapOpts.sourcesContent<"u"?this.mapOpts.sourcesContent:this.previous().length?this.previous().some(e=>e.withContent()):!0}outputFile(){return this.opts.to?this.path(this.opts.to):this.opts.from?this.path(this.opts.from):"to.css"}path(e){if(this.mapOpts.absolute||e.charCodeAt(0)===60||/^\w+:\/\//.test(e))return e;let t=this.memoizedPaths.get(e);if(t)return t;let r=this.opts.to?$t(this.opts.to):".";typeof this.mapOpts.annotation=="string"&&(r=$t(vi(r,this.mapOpts.annotation)));let i=bi(r,e);return this.memoizedPaths.set(e,i),i}previous(){if(!this.previousMaps)if(this.previousMaps=[],this.root)this.root.walk(e=>{if(e.source&&e.source.input.map){let t=e.source.input.map;this.previousMaps.includes(t)||this.previousMaps.push(t)}});else{let e=new dl(this.originalCSS,this.opts);e.map&&this.previousMaps.push(e.map)}return this.previousMaps}setSourcesContent(){let e={};if(this.root)this.root.walk(t=>{if(t.source){let r=t.source.input.from;if(r&&!e[r]){e[r]=!0;let i=this.usesFileUrls?this.toFileUrl(r):this.toUrl(this.path(r));this.map.setSourceContent(i,t.source.input.css)}}});else if(this.css){let t=this.opts.from?this.toUrl(this.path(this.opts.from)):"<no source>";this.map.setSourceContent(t,this.css)}}sourcePath(e){return this.mapOpts.from?this.toUrl(this.mapOpts.from):this.usesFileUrls?this.toFileUrl(e.source.input.from):this.toUrl(this.path(e.source.input.from))}toBase64(e){return Buffer?Buffer.from(e).toString("base64"):window.btoa(unescape(encodeURIComponent(e)))}toFileUrl(e){let t=this.memoizedFileURLs.get(e);if(t)return t;if(Ii){let r=Ii(e).toString();return this.memoizedFileURLs.set(e,r),r}else throw new Error("`map.absolute` option is not available in this PostCSS build")}toUrl(e){let t=this.memoizedURLs.get(e);if(t)return t;Ci==="\\"&&(e=e.replace(/\\/g,"/"));let r=encodeURI(e).replace(/[#?]/g,encodeURIComponent);return this.memoizedURLs.set(e,r),r}};let gl=xt,zr=class extends gl{constructor(e){super(e),this.type="comment"}};var Nt=zr;zr.default=zr;let{isClean:Ai,my:Ri}=Je,Oi=At,Ei=Nt,yl=xt,Mi,Wr,Gr,$i;function Ni(s){return s.map(e=>(e.nodes&&(e.nodes=Ni(e.nodes)),delete e.source,e))}function ki(s){if(s[Ai]=!1,s.proxyOf.nodes)for(let e of s.proxyOf.nodes)ki(e)}let we=class Ho extends yl{append(...e){for(let t of e){let r=this.normalize(t,this.last);for(let i of r)this.proxyOf.nodes.push(i)}return this.markDirty(),this}cleanRaws(e){if(super.cleanRaws(e),this.nodes)for(let t of this.nodes)t.cleanRaws(e)}each(e){if(!this.proxyOf.nodes)return;let t=this.getIterator(),r,i;for(;this.indexes[t]<this.proxyOf.nodes.length&&(r=this.indexes[t],i=e(this.proxyOf.nodes[r],r),i!==!1);)this.indexes[t]+=1;return delete this.indexes[t],i}every(e){return this.nodes.every(e)}getIterator(){this.lastEach||(this.lastEach=0),this.indexes||(this.indexes={}),this.lastEach+=1;let e=this.lastEach;return this.indexes[e]=0,e}getProxyProcessor(){return{get(e,t){return t==="proxyOf"?e:e[t]?t==="each"||typeof t=="string"&&t.startsWith("walk")?(...r)=>e[t](...r.map(i=>typeof i=="function"?(n,o)=>i(n.toProxy(),o):i)):t==="every"||t==="some"?r=>e[t]((i,...n)=>r(i.toProxy(),...n)):t==="root"?()=>e.root().toProxy():t==="nodes"?e.nodes.map(r=>r.toProxy()):t==="first"||t==="last"?e[t].toProxy():e[t]:e[t]},set(e,t,r){return e[t]===r||(e[t]=r,(t==="name"||t==="params"||t==="selector")&&e.markDirty()),!0}}}index(e){return typeof e=="number"?e:(e.proxyOf&&(e=e.proxyOf),this.proxyOf.nodes.indexOf(e))}insertAfter(e,t){let r=this.index(e),i=this.normalize(t,this.proxyOf.nodes[r]).reverse();r=this.index(e);for(let o of i)this.proxyOf.nodes.splice(r+1,0,o);let n;for(let o in this.indexes)n=this.indexes[o],r<n&&(this.indexes[o]=n+i.length);return this.markDirty(),this}insertBefore(e,t){let r=this.index(e),i=r===0?"prepend":!1,n=this.normalize(t,this.proxyOf.nodes[r],i).reverse();r=this.index(e);for(let l of n)this.proxyOf.nodes.splice(r,0,l);let o;for(let l in this.indexes)o=this.indexes[l],r<=o&&(this.indexes[l]=o+n.length);return this.markDirty(),this}normalize(e,t){if(typeof e=="string")e=Ni(Mi(e).nodes);else if(typeof e>"u")e=[];else if(Array.isArray(e)){e=e.slice(0);for(let i of e)i.parent&&i.parent.removeChild(i,"ignore")}else if(e.type==="root"&&this.type!=="document"){e=e.nodes.slice(0);for(let i of e)i.parent&&i.parent.removeChild(i,"ignore")}else if(e.type)e=[e];else if(e.prop){if(typeof e.value>"u")throw new Error("Value field is missed in node creation");typeof e.value!="string"&&(e.value=String(e.value)),e=[new Oi(e)]}else if(e.selector)e=[new Wr(e)];else if(e.name)e=[new Gr(e)];else if(e.text)e=[new Ei(e)];else throw new Error("Unknown node type in node creation");return e.map(i=>(i[Ri]||Ho.rebuild(i),i=i.proxyOf,i.parent&&i.parent.removeChild(i),i[Ai]&&ki(i),typeof i.raws.before>"u"&&t&&typeof t.raws.before<"u"&&(i.raws.before=t.raws.before.replace(/\S/g,"")),i.parent=this.proxyOf,i))}prepend(...e){e=e.reverse();for(let t of e){let r=this.normalize(t,this.first,"prepend").reverse();for(let i of r)this.proxyOf.nodes.unshift(i);for(let i in this.indexes)this.indexes[i]=this.indexes[i]+r.length}return this.markDirty(),this}push(e){return e.parent=this,this.proxyOf.nodes.push(e),this}removeAll(){for(let e of this.proxyOf.nodes)e.parent=void 0;return this.proxyOf.nodes=[],this.markDirty(),this}removeChild(e){e=this.index(e),this.proxyOf.nodes[e].parent=void 0,this.proxyOf.nodes.splice(e,1);let t;for(let r in this.indexes)t=this.indexes[r],t>=e&&(this.indexes[r]=t-1);return this.markDirty(),this}replaceValues(e,t,r){return r||(r=t,t={}),this.walkDecls(i=>{t.props&&!t.props.includes(i.prop)||t.fast&&!i.value.includes(t.fast)||(i.value=i.value.replace(e,r))}),this.markDirty(),this}some(e){return this.nodes.some(e)}walk(e){return this.each((t,r)=>{let i;try{i=e(t,r)}catch(n){throw t.addToError(n)}return i!==!1&&t.walk&&(i=t.walk(e)),i})}walkAtRules(e,t){return t?e instanceof RegExp?this.walk((r,i)=>{if(r.type==="atrule"&&e.test(r.name))return t(r,i)}):this.walk((r,i)=>{if(r.type==="atrule"&&r.name===e)return t(r,i)}):(t=e,this.walk((r,i)=>{if(r.type==="atrule")return t(r,i)}))}walkComments(e){return this.walk((t,r)=>{if(t.type==="comment")return e(t,r)})}walkDecls(e,t){return t?e instanceof RegExp?this.walk((r,i)=>{if(r.type==="decl"&&e.test(r.prop))return t(r,i)}):this.walk((r,i)=>{if(r.type==="decl"&&r.prop===e)return t(r,i)}):(t=e,this.walk((r,i)=>{if(r.type==="decl")return t(r,i)}))}walkRules(e,t){return t?e instanceof RegExp?this.walk((r,i)=>{if(r.type==="rule"&&e.test(r.selector))return t(r,i)}):this.walk((r,i)=>{if(r.type==="rule"&&r.selector===e)return t(r,i)}):(t=e,this.walk((r,i)=>{if(r.type==="rule")return t(r,i)}))}get first(){if(this.proxyOf.nodes)return this.proxyOf.nodes[0]}get last(){if(this.proxyOf.nodes)return this.proxyOf.nodes[this.proxyOf.nodes.length-1]}};we.registerParse=s=>{Mi=s},we.registerRule=s=>{Wr=s},we.registerAtRule=s=>{Gr=s},we.registerRoot=s=>{$i=s};var xe=we;we.default=we,we.rebuild=s=>{s.type==="atrule"?Object.setPrototypeOf(s,Gr.prototype):s.type==="rule"?Object.setPrototypeOf(s,Wr.prototype):s.type==="decl"?Object.setPrototypeOf(s,Oi.prototype):s.type==="comment"?Object.setPrototypeOf(s,Ei.prototype):s.type==="root"&&Object.setPrototypeOf(s,$i.prototype),s[Ri]=!0,s.nodes&&s.nodes.forEach(e=>{we.rebuild(e)})};let wl=xe,Ti,Pi,Ke=class extends wl{constructor(e){super({type:"document",...e}),this.nodes||(this.nodes=[])}toResult(e={}){return new Ti(new Pi,this,e).stringify()}};Ke.registerLazyResult=s=>{Ti=s},Ke.registerProcessor=s=>{Pi=s};var Vr=Ke;Ke.default=Ke;let Di={};var Li=function(e){Di[e]||(Di[e]=!0,typeof console<"u"&&console.warn&&console.warn(e))};let jr=class{constructor(e,t={}){if(this.type="warning",this.text=e,t.node&&t.node.source){let r=t.node.rangeBy(t);this.line=r.start.line,this.column=r.start.column,this.endLine=r.end.line,this.endColumn=r.end.column}for(let r in t)this[r]=t[r]}toString(){return this.node?this.node.error(this.text,{index:this.index,plugin:this.plugin,word:this.word}).message:this.plugin?this.plugin+": "+this.text:this.text}};var _i=jr;jr.default=jr;let Sl=_i,Hr=class{constructor(e,t,r){this.processor=e,this.messages=[],this.root=t,this.opts=r,this.css=void 0,this.map=void 0}toString(){return this.css}warn(e,t={}){t.plugin||this.lastPlugin&&this.lastPlugin.postcssPlugin&&(t.plugin=this.lastPlugin.postcssPlugin);let r=new Sl(e,t);return this.messages.push(r),r}warnings(){return this.messages.filter(e=>e.type==="warning")}get content(){return this.css}};var Yr=Hr;Hr.default=Hr;const Zr=39,Fi=34,kt=92,Ui=47,Tt=10,Xe=32,Pt=12,Dt=9,Lt=13,bl=91,vl=93,Cl=40,Il=41,xl=123,Al=125,Rl=59,Ol=42,El=58,Ml=64,_t=/[\t\n\f\r "#'()/;[\\\]{}]/g,Ft=/[\t\n\f\r !"#'():;@[\\\]{}]|\/(?=\*)/g,$l=/.[\r\n"'(/\\]/,Bi=/[\da-f]/i;var Nl=function(e,t={}){let r=e.css.valueOf(),i=t.ignoreErrors,n,o,l,a,u,c,h,p,m,g,d=r.length,f=0,S=[],b=[];function y(){return f}function C(B){throw e.error("Unclosed "+B,f)}function k(){return b.length===0&&f>=d}function D(B){if(b.length)return b.pop();if(f>=d)return;let V=B?B.ignoreUnclosed:!1;switch(n=r.charCodeAt(f),n){case Tt:case Xe:case Dt:case Lt:case Pt:{o=f;do o+=1,n=r.charCodeAt(o);while(n===Xe||n===Tt||n===Dt||n===Lt||n===Pt);g=["space",r.slice(f,o)],f=o-1;break}case bl:case vl:case xl:case Al:case El:case Rl:case Il:{let Z=String.fromCharCode(n);g=[Z,Z,f];break}case Cl:{if(p=S.length?S.pop()[1]:"",m=r.charCodeAt(f+1),p==="url"&&m!==Zr&&m!==Fi&&m!==Xe&&m!==Tt&&m!==Dt&&m!==Pt&&m!==Lt){o=f;do{if(c=!1,o=r.indexOf(")",o+1),o===-1)if(i||V){o=f;break}else C("bracket");for(h=o;r.charCodeAt(h-1)===kt;)h-=1,c=!c}while(c);g=["brackets",r.slice(f,o+1),f,o],f=o}else o=r.indexOf(")",f+1),a=r.slice(f,o+1),o===-1||$l.test(a)?g=["(","(",f]:(g=["brackets",a,f,o],f=o);break}case Zr:case Fi:{l=n===Zr?"'":'"',o=f;do{if(c=!1,o=r.indexOf(l,o+1),o===-1)if(i||V){o=f+1;break}else C("string");for(h=o;r.charCodeAt(h-1)===kt;)h-=1,c=!c}while(c);g=["string",r.slice(f,o+1),f,o],f=o;break}case Ml:{_t.lastIndex=f+1,_t.test(r),_t.lastIndex===0?o=r.length-1:o=_t.lastIndex-2,g=["at-word",r.slice(f,o+1),f,o],f=o;break}case kt:{for(o=f,u=!0;r.charCodeAt(o+1)===kt;)o+=1,u=!u;if(n=r.charCodeAt(o+1),u&&n!==Ui&&n!==Xe&&n!==Tt&&n!==Dt&&n!==Lt&&n!==Pt&&(o+=1,Bi.test(r.charAt(o)))){for(;Bi.test(r.charAt(o+1));)o+=1;r.charCodeAt(o+1)===Xe&&(o+=1)}g=["word",r.slice(f,o+1),f,o],f=o;break}default:{n===Ui&&r.charCodeAt(f+1)===Ol?(o=r.indexOf("*/",f+2)+1,o===0&&(i||V?o=r.length:C("comment")),g=["comment",r.slice(f,o+1),f,o],f=o):(Ft.lastIndex=f+1,Ft.test(r),Ft.lastIndex===0?o=r.length-1:o=Ft.lastIndex-2,g=["word",r.slice(f,o+1),f,o],S.push(g),f=o);break}}return f++,g}function H(B){b.push(B)}return{back:H,endOfFile:k,nextToken:D,position:y}};let zi=xe,Ut=class extends zi{constructor(e){super(e),this.type="atrule"}append(...e){return this.proxyOf.nodes||(this.nodes=[]),super.append(...e)}prepend(...e){return this.proxyOf.nodes||(this.nodes=[]),super.prepend(...e)}};var Jr=Ut;Ut.default=Ut,zi.registerAtRule(Ut);let Wi=xe,Gi,Vi,De=class extends Wi{constructor(e){super(e),this.type="root",this.nodes||(this.nodes=[])}normalize(e,t,r){let i=super.normalize(e);if(t){if(r==="prepend")this.nodes.length>1?t.raws.before=this.nodes[1].raws.before:delete t.raws.before;else if(this.first!==t)for(let n of i)n.raws.before=t.raws.before}return i}removeChild(e,t){let r=this.index(e);return!t&&r===0&&this.nodes.length>1&&(this.nodes[1].raws.before=this.nodes[r].raws.before),super.removeChild(e)}toResult(e={}){return new Gi(new Vi,this,e).stringify()}};De.registerLazyResult=s=>{Gi=s},De.registerProcessor=s=>{Vi=s};var Qe=De;De.default=De,Wi.registerRoot(De);let qe={comma(s){return qe.split(s,[","],!0)},space(s){let e=[" ",`+`," "];return qe.split(s,e)},split(s,e,t){let r=[],i="",n=!1,o=0,l=!1,a="",u=!1;for(let c of s)u?u=!1:c==="\\"?u=!0:l?c===a&&(l=!1):c==='"'||c==="'"?(l=!0,a=c):c==="("?o+=1:c===")"?o>0&&(o-=1):o===0&&e.includes(c)&&(n=!0),n?(i!==""&&r.push(i.trim()),i="",n=!1):i+=c;return(t||i!=="")&&r.push(i.trim()),r}};var ji=qe;qe.default=qe;let Hi=xe,kl=ji,Bt=class extends Hi{constructor(e){super(e),this.type="rule",this.nodes||(this.nodes=[])}get selectors(){return kl.comma(this.selector)}set selectors(e){let t=this.selector?this.selector.match(/,\s*/):null,r=t?t[0]:","+this.raw("between","beforeOpen");this.selector=e.join(r)}};var Kr=Bt;Bt.default=Bt,Hi.registerRule(Bt);let Tl=At,Pl=Nl,Dl=Nt,Ll=Jr,_l=Qe,Yi=Kr;const Zi={empty:!0,space:!0};function Fl(s){for(let e=s.length-1;e>=0;e--){let t=s[e],r=t[3]||t[2];if(r)return r}}var Ul=class{constructor(e){this.input=e,this.root=new _l,this.current=this.root,this.spaces="",this.semicolon=!1,this.createTokenizer(),this.root.source={input:e,start:{column:1,line:1,offset:0}}}atrule(e){let t=new Ll;t.name=e[1].slice(1),t.name===""&&this.unnamedAtrule(t,e),this.init(t,e[2]);let r,i,n,o=!1,l=!1,a=[],u=[];for(;!this.tokenizer.endOfFile();){if(e=this.tokenizer.nextToken(),r=e[0],r==="("||r==="["?u.push(r==="("?")":"]"):r==="{"&&u.length>0?u.push("}"):r===u[u.length-1]&&u.pop(),u.length===0)if(r===";"){t.source.end=this.getPosition(e[2]),t.source.end.offset++,this.semicolon=!0;break}else if(r==="{"){l=!0;break}else if(r==="}"){if(a.length>0){for(n=a.length-1,i=a[n];i&&i[0]==="space";)i=a[--n];i&&(t.source.end=this.getPosition(i[3]||i[2]),t.source.end.offset++)}this.end(e);break}else a.push(e);else a.push(e);if(this.tokenizer.endOfFile()){o=!0;break}}t.raws.between=this.spacesAndCommentsFromEnd(a),a.length?(t.raws.afterName=this.spacesAndCommentsFromStart(a),this.raw(t,"params",a),o&&(e=a[a.length-1],t.source.end=this.getPosition(e[3]||e[2]),t.source.end.offset++,this.spaces=t.raws.between,t.raws.between="")):(t.raws.afterName="",t.params=""),l&&(t.nodes=[],this.current=t)}checkMissedSemicolon(e){let t=this.colon(e);if(t===!1)return;let r=0,i;for(let n=t-1;n>=0&&(i=e[n],!(i[0]!=="space"&&(r+=1,r===2)));n--);throw this.input.error("Missed semicolon",i[0]==="word"?i[3]+1:i[2])}colon(e){let t=0,r,i,n;for(let[o,l]of e.entries()){if(r=l,i=r[0],i==="("&&(t+=1),i===")"&&(t-=1),t===0&&i===":")if(!n)this.doubleColon(r);else{if(n[0]==="word"&&n[1]==="progid")continue;return o}n=r}return!1}comment(e){let t=new Dl;this.init(t,e[2]),t.source.end=this.getPosition(e[3]||e[2]),t.source.end.offset++;let r=e[1].slice(2,-2);if(/^\s*$/.test(r))t.text="",t.raws.left=r,t.raws.right="";else{let i=r.match(/^(\s*)([^]*\S)(\s*)$/);t.text=i[2],t.raws.left=i[1],t.raws.right=i[3]}}createTokenizer(){this.tokenizer=Pl(this.input)}decl(e,t){let r=new Tl;this.init(r,e[0][2]);let i=e[e.length-1];for(i[0]===";"&&(this.semicolon=!0,e.pop()),r.source.end=this.getPosition(i[3]||i[2]||Fl(e)),r.source.end.offset++;e[0][0]!=="word";)e.length===1&&this.unknownWord(e),r.raws.before+=e.shift()[1];for(r.source.start=this.getPosition(e[0][2]),r.prop="";e.length;){let u=e[0][0];if(u===":"||u==="space"||u==="comment")break;r.prop+=e.shift()[1]}r.raws.between="";let n;for(;e.length;)if(n=e.shift(),n[0]===":"){r.raws.between+=n[1];break}else n[0]==="word"&&/\w/.test(n[1])&&this.unknownWord([n]),r.raws.between+=n[1];(r.prop[0]==="_"||r.prop[0]==="*")&&(r.raws.before+=r.prop[0],r.prop=r.prop.slice(1));let o=[],l;for(;e.length&&(l=e[0][0],!(l!=="space"&&l!=="comment"));)o.push(e.shift());this.precheckMissedSemicolon(e);for(let u=e.length-1;u>=0;u--){if(n=e[u],n[1].toLowerCase()==="!important"){r.important=!0;let c=this.stringFrom(e,u);c=this.spacesFromEnd(e)+c,c!==" !important"&&(r.raws.important=c);break}else if(n[1].toLowerCase()==="important"){let c=e.slice(0),h="";for(let p=u;p>0;p--){let m=c[p][0];if(h.trim().indexOf("!")===0&&m!=="space")break;h=c.pop()[1]+h}h.trim().indexOf("!")===0&&(r.important=!0,r.raws.important=h,e=c)}if(n[0]!=="space"&&n[0]!=="comment")break}e.some(u=>u[0]!=="space"&&u[0]!=="comment")&&(r.raws.between+=o.map(u=>u[1]).join(""),o=[]),this.raw(r,"value",o.concat(e),t),r.value.includes(":")&&!t&&this.checkMissedSemicolon(e)}doubleColon(e){throw this.input.error("Double colon",{offset:e[2]},{offset:e[2]+e[1].length})}emptyRule(e){let t=new Yi;this.init(t,e[2]),t.selector="",t.raws.between="",this.current=t}end(e){this.current.nodes&&this.current.nodes.length&&(this.current.raws.semicolon=this.semicolon),this.semicolon=!1,this.current.raws.after=(this.current.raws.after||"")+this.spaces,this.spaces="",this.current.parent?(this.current.source.end=this.getPosition(e[2]),this.current.source.end.offset++,this.current=this.current.parent):this.unexpectedClose(e)}endFile(){this.current.parent&&this.unclosedBlock(),this.current.nodes&&this.current.nodes.length&&(this.current.raws.semicolon=this.semicolon),this.current.raws.after=(this.current.raws.after||"")+this.spaces,this.root.source.end=this.getPosition(this.tokenizer.position())}freeSemicolon(e){if(this.spaces+=e[1],this.current.nodes){let t=this.current.nodes[this.current.nodes.length-1];t&&t.type==="rule"&&!t.raws.ownSemicolon&&(t.raws.ownSemicolon=this.spaces,this.spaces="")}}getPosition(e){let t=this.input.fromOffset(e);return{column:t.col,line:t.line,offset:e}}init(e,t){this.current.push(e),e.source={input:this.input,start:this.getPosition(t)},e.raws.before=this.spaces,this.spaces="",e.type!=="comment"&&(this.semicolon=!1)}other(e){let t=!1,r=null,i=!1,n=null,o=[],l=e[1].startsWith("--"),a=[],u=e;for(;u;){if(r=u[0],a.push(u),r==="("||r==="[")n||(n=u),o.push(r==="("?")":"]");else if(l&&i&&r==="{")n||(n=u),o.push("}");else if(o.length===0)if(r===";")if(i){this.decl(a,l);return}else break;else if(r==="{"){this.rule(a);return}else if(r==="}"){this.tokenizer.back(a.pop()),t=!0;break}else r===":"&&(i=!0);else r===o[o.length-1]&&(o.pop(),o.length===0&&(n=null));u=this.tokenizer.nextToken()}if(this.tokenizer.endOfFile()&&(t=!0),o.length>0&&this.unclosedBracket(n),t&&i){if(!l)for(;a.length&&(u=a[a.length-1][0],!(u!=="space"&&u!=="comment"));)this.tokenizer.back(a.pop());this.decl(a,l)}else this.unknownWord(a)}parse(){let e;for(;!this.tokenizer.endOfFile();)switch(e=this.tokenizer.nextToken(),e[0]){case"space":this.spaces+=e[1];break;case";":this.freeSemicolon(e);break;case"}":this.end(e);break;case"comment":this.comment(e);break;case"at-word":this.atrule(e);break;case"{":this.emptyRule(e);break;default:this.other(e);break}this.endFile()}precheckMissedSemicolon(){}raw(e,t,r,i){let n,o,l=r.length,a="",u=!0,c,h;for(let p=0;p<l;p+=1)n=r[p],o=n[0],o==="space"&&p===l-1&&!i?u=!1:o==="comment"?(h=r[p-1]?r[p-1][0]:"empty",c=r[p+1]?r[p+1][0]:"empty",!Zi[h]&&!Zi[c]?a.slice(-1)===","?u=!1:a+=n[1]:u=!1):a+=n[1];if(!u){let p=r.reduce((m,g)=>m+g[1],"");e.raws[t]={raw:p,value:a}}e[t]=a}rule(e){e.pop();let t=new Yi;this.init(t,e[0][2]),t.raws.between=this.spacesAndCommentsFromEnd(e),this.raw(t,"selector",e),this.current=t}spacesAndCommentsFromEnd(e){let t,r="";for(;e.length&&(t=e[e.length-1][0],!(t!=="space"&&t!=="comment"));)r=e.pop()[1]+r;return r}spacesAndCommentsFromStart(e){let t,r="";for(;e.length&&(t=e[0][0],!(t!=="space"&&t!=="comment"));)r+=e.shift()[1];return r}spacesFromEnd(e){let t,r="";for(;e.length&&(t=e[e.length-1][0],t==="space");)r=e.pop()[1]+r;return r}stringFrom(e,t){let r="";for(let i=t;i<e.length;i++)r+=e[i][1];return e.splice(t,e.length-t),r}unclosedBlock(){let e=this.current.source.start;throw this.input.error("Unclosed block",e.line,e.column)}unclosedBracket(e){throw this.input.error("Unclosed bracket",{offset:e[2]},{offset:e[2]+1})}unexpectedClose(e){throw this.input.error("Unexpected }",{offset:e[2]},{offset:e[2]+1})}unknownWord(e){throw this.input.error("Unknown word",{offset:e[0][2]},{offset:e[0][2]+e[0][1].length})}unnamedAtrule(e,t){throw this.input.error("At-rule without name",{offset:t[2]},{offset:t[2]+t[1].length})}};let Bl=xe,zl=Ul,Wl=Et;function zt(s,e){let t=new Wl(s,e),r=new zl(t);try{r.parse()}catch(i){throw process.env.NODE_ENV!=="production"&&i.name==="CssSyntaxError"&&e&&e.from&&(/\.scss$/i.test(e.from)?i.message+=`You tried to parse SCSS with the standard CSS parser; try again with the postcss-scss parser`:/\.sass/i.test(e.from)?i.message+=`You tried to parse Sass with the standard CSS parser; try again with the postcss-sass parser`:/\.less$/i.test(e.from)&&(i.message+=`-You tried to parse Less with the standard CSS parser; try again with the postcss-less parser`)),i}return r.root}var Xr=zt;zt.default=zt,Ul.registerParse(zt);let{isClean:ue,my:Wl}=Je,Gl=xi,Vl=vt,jl=xe,Yl=Vr,Hl=Li,Ji=Hr,Zl=Xr,Jl=Qe;const Kl={atrule:"AtRule",comment:"Comment",decl:"Declaration",document:"Document",root:"Root",rule:"Rule"},Xl={AtRule:!0,AtRuleExit:!0,Comment:!0,CommentExit:!0,Declaration:!0,DeclarationExit:!0,Document:!0,DocumentExit:!0,Once:!0,OnceExit:!0,postcssPlugin:!0,prepare:!0,Root:!0,RootExit:!0,Rule:!0,RuleExit:!0},Ql={Once:!0,postcssPlugin:!0,prepare:!0},Le=0;function et(s){return typeof s=="object"&&typeof s.then=="function"}function Ki(s){let e=!1,t=Kl[s.type];return s.type==="decl"?e=s.prop.toLowerCase():s.type==="atrule"&&(e=s.name.toLowerCase()),e&&s.append?[t,t+"-"+e,Le,t+"Exit",t+"Exit-"+e]:e?[t,t+"-"+e,t+"Exit",t+"Exit-"+e]:s.append?[t,Le,t+"Exit"]:[t,t+"Exit"]}function Xi(s){let e;return s.type==="document"?e=["Document",Le,"DocumentExit"]:s.type==="root"?e=["Root",Le,"RootExit"]:e=Ki(s),{eventIndex:0,events:e,iterator:0,node:s,visitorIndex:0,visitors:[]}}function Qr(s){return s[ue]=!1,s.nodes&&s.nodes.forEach(e=>Qr(e)),s}let qr={},_e=class Yo{constructor(e,t,r){this.stringified=!1,this.processed=!1;let i;if(typeof t=="object"&&t!==null&&(t.type==="root"||t.type==="document"))i=Qr(t);else if(t instanceof Yo||t instanceof Ji)i=Qr(t.root),t.map&&(typeof r.map>"u"&&(r.map={}),r.map.inline||(r.map.inline=!1),r.map.prev=t.map);else{let n=Zl;r.syntax&&(n=r.syntax.parse),r.parser&&(n=r.parser),n.parse&&(n=n.parse);try{i=n(t,r)}catch(o){this.processed=!0,this.error=o}i&&!i[Wl]&&jl.rebuild(i)}this.result=new Ji(e,i,r),this.helpers={...qr,postcss:qr,result:this.result},this.plugins=this.processor.plugins.map(n=>typeof n=="object"&&n.prepare?{...n,...n.prepare(this.result)}:n)}async(){return this.error?Promise.reject(this.error):this.processed?Promise.resolve(this.result):(this.processing||(this.processing=this.runAsync()),this.processing)}catch(e){return this.async().catch(e)}finally(e){return this.async().then(e,e)}getAsyncError(){throw new Error("Use process(css).then(cb) to work with async plugins")}handleError(e,t){let r=this.result.lastPlugin;try{if(t&&t.addToError(e),this.error=e,e.name==="CssSyntaxError"&&!e.plugin)e.plugin=r.postcssPlugin,e.setMessage();else if(r.postcssVersion&&process.env.NODE_ENV!=="production"){let i=r.postcssPlugin,n=r.postcssVersion,o=this.result.processor.version,l=n.split("."),a=o.split(".");(l[0]!==a[0]||parseInt(l[1])>parseInt(a[1]))&&console.error("Unknown error from PostCSS plugin. Your current PostCSS version is "+o+", but "+i+" uses "+n+". Perhaps this is the source of the error below.")}}catch(i){console&&console.error&&console.error(i)}return e}prepareVisitors(){this.listeners={};let e=(t,r,i)=>{this.listeners[r]||(this.listeners[r]=[]),this.listeners[r].push([t,i])};for(let t of this.plugins)if(typeof t=="object")for(let r in t){if(!Xl[r]&&/^[A-Z]/.test(r))throw new Error(`Unknown event ${r} in ${t.postcssPlugin}. Try to update PostCSS (${this.processor.version} now).`);if(!Ql[r])if(typeof t[r]=="object")for(let i in t[r])i==="*"?e(t,r,t[r][i]):e(t,r+"-"+i.toLowerCase(),t[r][i]);else typeof t[r]=="function"&&e(t,r,t[r])}this.hasListener=Object.keys(this.listeners).length>0}async runAsync(){this.plugin=0;for(let e=0;e<this.plugins.length;e++){let t=this.plugins[e],r=this.runOnRoot(t);if(et(r))try{await r}catch(i){throw this.handleError(i)}}if(this.prepareVisitors(),this.hasListener){let e=this.result.root;for(;!e[ue];){e[ue]=!0;let t=[Xi(e)];for(;t.length>0;){let r=this.visitTick(t);if(et(r))try{await r}catch(i){let n=t[t.length-1].node;throw this.handleError(i,n)}}}if(this.listeners.OnceExit)for(let[t,r]of this.listeners.OnceExit){this.result.lastPlugin=t;try{if(e.type==="document"){let i=e.nodes.map(n=>r(n,this.helpers));await Promise.all(i)}else await r(e,this.helpers)}catch(i){throw this.handleError(i)}}}return this.processed=!0,this.stringify()}runOnRoot(e){this.result.lastPlugin=e;try{if(typeof e=="object"&&e.Once){if(this.result.root.type==="document"){let t=this.result.root.nodes.map(r=>e.Once(r,this.helpers));return et(t[0])?Promise.all(t):t}return e.Once(this.result.root,this.helpers)}else if(typeof e=="function")return e(this.result.root,this.result)}catch(t){throw this.handleError(t)}}stringify(){if(this.error)throw this.error;if(this.stringified)return this.result;this.stringified=!0,this.sync();let e=this.result.opts,t=Vl;e.syntax&&(t=e.syntax.stringify),e.stringifier&&(t=e.stringifier),t.stringify&&(t=t.stringify);let i=new Gl(t,this.result.root,this.result.opts).generate();return this.result.css=i[0],this.result.map=i[1],this.result}sync(){if(this.error)throw this.error;if(this.processed)return this.result;if(this.processed=!0,this.processing)throw this.getAsyncError();for(let e of this.plugins){let t=this.runOnRoot(e);if(et(t))throw this.getAsyncError()}if(this.prepareVisitors(),this.hasListener){let e=this.result.root;for(;!e[ue];)e[ue]=!0,this.walkSync(e);if(this.listeners.OnceExit)if(e.type==="document")for(let t of e.nodes)this.visitSync(this.listeners.OnceExit,t);else this.visitSync(this.listeners.OnceExit,e)}return this.result}then(e,t){return process.env.NODE_ENV!=="production"&&("from"in this.opts||Hl("Without `from` option PostCSS could generate wrong source map and will not find Browserslist config. Set it to CSS file path or to `undefined` to prevent this warning.")),this.async().then(e,t)}toString(){return this.css}visitSync(e,t){for(let[r,i]of e){this.result.lastPlugin=r;let n;try{n=i(t,this.helpers)}catch(o){throw this.handleError(o,t.proxyOf)}if(t.type!=="root"&&t.type!=="document"&&!t.parent)return!0;if(et(n))throw this.getAsyncError()}}visitTick(e){let t=e[e.length-1],{node:r,visitors:i}=t;if(r.type!=="root"&&r.type!=="document"&&!r.parent){e.pop();return}if(i.length>0&&t.visitorIndex<i.length){let[o,l]=i[t.visitorIndex];t.visitorIndex+=1,t.visitorIndex===i.length&&(t.visitors=[],t.visitorIndex=0),this.result.lastPlugin=o;try{return l(r.toProxy(),this.helpers)}catch(a){throw this.handleError(a,r)}}if(t.iterator!==0){let o=t.iterator,l;for(;l=r.nodes[r.indexes[o]];)if(r.indexes[o]+=1,!l[ue]){l[ue]=!0,e.push(Xi(l));return}t.iterator=0,delete r.indexes[o]}let n=t.events;for(;t.eventIndex<n.length;){let o=n[t.eventIndex];if(t.eventIndex+=1,o===Le){r.nodes&&r.nodes.length&&(r[ue]=!0,t.iterator=r.getIterator());return}else if(this.listeners[o]){t.visitors=this.listeners[o];return}}e.pop()}walkSync(e){e[ue]=!0;let t=Ki(e);for(let r of t)if(r===Le)e.nodes&&e.each(i=>{i[ue]||this.walkSync(i)});else{let i=this.listeners[r];if(i&&this.visitSync(i,e.toProxy()))return}}warnings(){return this.sync().warnings()}get content(){return this.stringify().content}get css(){return this.stringify().css}get map(){return this.stringify().map}get messages(){return this.sync().messages}get opts(){return this.result.opts}get processor(){return this.result.processor}get root(){return this.sync().root}get[Symbol.toStringTag](){return"LazyResult"}};_e.registerPostcss=s=>{qr=s};var Qi=_e;_e.default=_e,Jl.registerLazyResult(_e),Yl.registerLazyResult(_e);let ql=xi,eu=vt,tu=Li,ru=Xr;const su=Hr;let es=class{constructor(e,t,r){t=t.toString(),this.stringified=!1,this._processor=e,this._css=t,this._opts=r,this._map=void 0;let i,n=eu;this.result=new su(this._processor,i,this._opts),this.result.css=t;let o=this;Object.defineProperty(this.result,"root",{get(){return o.root}});let l=new ql(n,i,this._opts,t);if(l.isMap()){let[a,u]=l.generate();a&&(this.result.css=a),u&&(this.result.map=u)}else l.clearAnnotation(),this.result.css=l.css}async(){return this.error?Promise.reject(this.error):Promise.resolve(this.result)}catch(e){return this.async().catch(e)}finally(e){return this.async().then(e,e)}sync(){if(this.error)throw this.error;return this.result}then(e,t){return process.env.NODE_ENV!=="production"&&("from"in this._opts||tu("Without `from` option PostCSS could generate wrong source map and will not find Browserslist config. Set it to CSS file path or to `undefined` to prevent this warning.")),this.async().then(e,t)}toString(){return this._css}warnings(){return[]}get content(){return this.result.css}get css(){return this.result.css}get map(){return this.result.map}get messages(){return[]}get opts(){return this.result.opts}get processor(){return this.result.processor}get root(){if(this._root)return this._root;let e,t=ru;try{e=t(this._css,this._opts)}catch(r){this.error=r}if(this.error)throw this.error;return this._root=e,e}get[Symbol.toStringTag](){return"NoWorkResult"}};var iu=es;es.default=es;let nu=iu,ou=Qi,au=Vr,lu=Qe,tt=class{constructor(e=[]){this.version="8.4.38",this.plugins=this.normalize(e)}normalize(e){let t=[];for(let r of e)if(r.postcss===!0?r=r():r.postcss&&(r=r.postcss),typeof r=="object"&&Array.isArray(r.plugins))t=t.concat(r.plugins);else if(typeof r=="object"&&r.postcssPlugin)t.push(r);else if(typeof r=="function")t.push(r);else if(typeof r=="object"&&(r.parse||r.stringify)){if(process.env.NODE_ENV!=="production")throw new Error("PostCSS syntaxes cannot be used as plugins. Instead, please use one of the syntax/parser/stringifier options as outlined in your PostCSS runner documentation.")}else throw new Error(r+" is not a PostCSS plugin");return t}process(e,t={}){return!this.plugins.length&&!t.parser&&!t.stringifier&&!t.syntax?new nu(this,e,t):new ou(this,e,t)}use(e){return this.plugins=this.plugins.concat(this.normalize([e])),this}};var uu=tt;tt.default=tt,lu.registerProcessor(tt),au.registerProcessor(tt);let cu=Ot,hu=mi,fu=Nt,du=Jr,pu=At,mu=Qe,gu=Kr;function rt(s,e){if(Array.isArray(s))return s.map(i=>rt(i));let{inputs:t,...r}=s;if(t){e=[];for(let i of t){let n={...i,__proto__:pu.prototype};n.map&&(n.map={...n.map,__proto__:hu.prototype}),e.push(n)}}if(r.nodes&&(r.nodes=s.nodes.map(i=>rt(i,e))),r.source){let{inputId:i,...n}=r.source;r.source=n,i!=null&&(r.source.input=e[i])}if(r.type==="root")return new mu(r);if(r.type==="decl")return new cu(r);if(r.type==="rule")return new gu(r);if(r.type==="comment")return new fu(r);if(r.type==="atrule")return new du(r);throw new Error("Unknown node type: "+s.type)}var yu=rt;rt.default=rt;let wu=Mr,qi=Ot,bu=Qi,Su=xe,ts=uu,Cu=vt,vu=yu,en=Vr,Iu=_i,tn=Nt,rn=Jr,xu=Hr,Ou=At,Ru=Xr,Eu=ji,sn=Kr,nn=Qe,Au=xt;function A(...s){return s.length===1&&Array.isArray(s[0])&&(s=s[0]),new ts(s)}A.plugin=function(e,t){let r=!1;function i(...o){console&&console.warn&&!r&&(r=!0,console.warn(e+`: postcss.plugin was deprecated. Migration guide:+You tried to parse Less with the standard CSS parser; try again with the postcss-less parser`)),i}return r.root}var Xr=zt;zt.default=zt,Bl.registerParse(zt);let{isClean:he,my:Gl}=Je,Vl=xi,jl=Ct,Hl=xe,Yl=Vr,Zl=Li,Ji=Yr,Jl=Xr,Kl=Qe;const Xl={atrule:"AtRule",comment:"Comment",decl:"Declaration",document:"Document",root:"Root",rule:"Rule"},Ql={AtRule:!0,AtRuleExit:!0,Comment:!0,CommentExit:!0,Declaration:!0,DeclarationExit:!0,Document:!0,DocumentExit:!0,Once:!0,OnceExit:!0,postcssPlugin:!0,prepare:!0,Root:!0,RootExit:!0,Rule:!0,RuleExit:!0},ql={Once:!0,postcssPlugin:!0,prepare:!0},Le=0;function et(s){return typeof s=="object"&&typeof s.then=="function"}function Ki(s){let e=!1,t=Xl[s.type];return s.type==="decl"?e=s.prop.toLowerCase():s.type==="atrule"&&(e=s.name.toLowerCase()),e&&s.append?[t,t+"-"+e,Le,t+"Exit",t+"Exit-"+e]:e?[t,t+"-"+e,t+"Exit",t+"Exit-"+e]:s.append?[t,Le,t+"Exit"]:[t,t+"Exit"]}function Xi(s){let e;return s.type==="document"?e=["Document",Le,"DocumentExit"]:s.type==="root"?e=["Root",Le,"RootExit"]:e=Ki(s),{eventIndex:0,events:e,iterator:0,node:s,visitorIndex:0,visitors:[]}}function Qr(s){return s[he]=!1,s.nodes&&s.nodes.forEach(e=>Qr(e)),s}let qr={},_e=class Yo{constructor(e,t,r){this.stringified=!1,this.processed=!1;let i;if(typeof t=="object"&&t!==null&&(t.type==="root"||t.type==="document"))i=Qr(t);else if(t instanceof Yo||t instanceof Ji)i=Qr(t.root),t.map&&(typeof r.map>"u"&&(r.map={}),r.map.inline||(r.map.inline=!1),r.map.prev=t.map);else{let n=Jl;r.syntax&&(n=r.syntax.parse),r.parser&&(n=r.parser),n.parse&&(n=n.parse);try{i=n(t,r)}catch(o){this.processed=!0,this.error=o}i&&!i[Gl]&&Hl.rebuild(i)}this.result=new Ji(e,i,r),this.helpers={...qr,postcss:qr,result:this.result},this.plugins=this.processor.plugins.map(n=>typeof n=="object"&&n.prepare?{...n,...n.prepare(this.result)}:n)}async(){return this.error?Promise.reject(this.error):this.processed?Promise.resolve(this.result):(this.processing||(this.processing=this.runAsync()),this.processing)}catch(e){return this.async().catch(e)}finally(e){return this.async().then(e,e)}getAsyncError(){throw new Error("Use process(css).then(cb) to work with async plugins")}handleError(e,t){let r=this.result.lastPlugin;try{if(t&&t.addToError(e),this.error=e,e.name==="CssSyntaxError"&&!e.plugin)e.plugin=r.postcssPlugin,e.setMessage();else if(r.postcssVersion&&process.env.NODE_ENV!=="production"){let i=r.postcssPlugin,n=r.postcssVersion,o=this.result.processor.version,l=n.split("."),a=o.split(".");(l[0]!==a[0]||parseInt(l[1])>parseInt(a[1]))&&console.error("Unknown error from PostCSS plugin. Your current PostCSS version is "+o+", but "+i+" uses "+n+". Perhaps this is the source of the error below.")}}catch(i){console&&console.error&&console.error(i)}return e}prepareVisitors(){this.listeners={};let e=(t,r,i)=>{this.listeners[r]||(this.listeners[r]=[]),this.listeners[r].push([t,i])};for(let t of this.plugins)if(typeof t=="object")for(let r in t){if(!Ql[r]&&/^[A-Z]/.test(r))throw new Error(`Unknown event ${r} in ${t.postcssPlugin}. Try to update PostCSS (${this.processor.version} now).`);if(!ql[r])if(typeof t[r]=="object")for(let i in t[r])i==="*"?e(t,r,t[r][i]):e(t,r+"-"+i.toLowerCase(),t[r][i]);else typeof t[r]=="function"&&e(t,r,t[r])}this.hasListener=Object.keys(this.listeners).length>0}async runAsync(){this.plugin=0;for(let e=0;e<this.plugins.length;e++){let t=this.plugins[e],r=this.runOnRoot(t);if(et(r))try{await r}catch(i){throw this.handleError(i)}}if(this.prepareVisitors(),this.hasListener){let e=this.result.root;for(;!e[he];){e[he]=!0;let t=[Xi(e)];for(;t.length>0;){let r=this.visitTick(t);if(et(r))try{await r}catch(i){let n=t[t.length-1].node;throw this.handleError(i,n)}}}if(this.listeners.OnceExit)for(let[t,r]of this.listeners.OnceExit){this.result.lastPlugin=t;try{if(e.type==="document"){let i=e.nodes.map(n=>r(n,this.helpers));await Promise.all(i)}else await r(e,this.helpers)}catch(i){throw this.handleError(i)}}}return this.processed=!0,this.stringify()}runOnRoot(e){this.result.lastPlugin=e;try{if(typeof e=="object"&&e.Once){if(this.result.root.type==="document"){let t=this.result.root.nodes.map(r=>e.Once(r,this.helpers));return et(t[0])?Promise.all(t):t}return e.Once(this.result.root,this.helpers)}else if(typeof e=="function")return e(this.result.root,this.result)}catch(t){throw this.handleError(t)}}stringify(){if(this.error)throw this.error;if(this.stringified)return this.result;this.stringified=!0,this.sync();let e=this.result.opts,t=jl;e.syntax&&(t=e.syntax.stringify),e.stringifier&&(t=e.stringifier),t.stringify&&(t=t.stringify);let i=new Vl(t,this.result.root,this.result.opts).generate();return this.result.css=i[0],this.result.map=i[1],this.result}sync(){if(this.error)throw this.error;if(this.processed)return this.result;if(this.processed=!0,this.processing)throw this.getAsyncError();for(let e of this.plugins){let t=this.runOnRoot(e);if(et(t))throw this.getAsyncError()}if(this.prepareVisitors(),this.hasListener){let e=this.result.root;for(;!e[he];)e[he]=!0,this.walkSync(e);if(this.listeners.OnceExit)if(e.type==="document")for(let t of e.nodes)this.visitSync(this.listeners.OnceExit,t);else this.visitSync(this.listeners.OnceExit,e)}return this.result}then(e,t){return process.env.NODE_ENV!=="production"&&("from"in this.opts||Zl("Without `from` option PostCSS could generate wrong source map and will not find Browserslist config. Set it to CSS file path or to `undefined` to prevent this warning.")),this.async().then(e,t)}toString(){return this.css}visitSync(e,t){for(let[r,i]of e){this.result.lastPlugin=r;let n;try{n=i(t,this.helpers)}catch(o){throw this.handleError(o,t.proxyOf)}if(t.type!=="root"&&t.type!=="document"&&!t.parent)return!0;if(et(n))throw this.getAsyncError()}}visitTick(e){let t=e[e.length-1],{node:r,visitors:i}=t;if(r.type!=="root"&&r.type!=="document"&&!r.parent){e.pop();return}if(i.length>0&&t.visitorIndex<i.length){let[o,l]=i[t.visitorIndex];t.visitorIndex+=1,t.visitorIndex===i.length&&(t.visitors=[],t.visitorIndex=0),this.result.lastPlugin=o;try{return l(r.toProxy(),this.helpers)}catch(a){throw this.handleError(a,r)}}if(t.iterator!==0){let o=t.iterator,l;for(;l=r.nodes[r.indexes[o]];)if(r.indexes[o]+=1,!l[he]){l[he]=!0,e.push(Xi(l));return}t.iterator=0,delete r.indexes[o]}let n=t.events;for(;t.eventIndex<n.length;){let o=n[t.eventIndex];if(t.eventIndex+=1,o===Le){r.nodes&&r.nodes.length&&(r[he]=!0,t.iterator=r.getIterator());return}else if(this.listeners[o]){t.visitors=this.listeners[o];return}}e.pop()}walkSync(e){e[he]=!0;let t=Ki(e);for(let r of t)if(r===Le)e.nodes&&e.each(i=>{i[he]||this.walkSync(i)});else{let i=this.listeners[r];if(i&&this.visitSync(i,e.toProxy()))return}}warnings(){return this.sync().warnings()}get content(){return this.stringify().content}get css(){return this.stringify().css}get map(){return this.stringify().map}get messages(){return this.sync().messages}get opts(){return this.result.opts}get processor(){return this.result.processor}get root(){return this.sync().root}get[Symbol.toStringTag](){return"LazyResult"}};_e.registerPostcss=s=>{qr=s};var Qi=_e;_e.default=_e,Kl.registerLazyResult(_e),Yl.registerLazyResult(_e);let eu=xi,tu=Ct,ru=Li,su=Xr;const iu=Yr;let es=class{constructor(e,t,r){t=t.toString(),this.stringified=!1,this._processor=e,this._css=t,this._opts=r,this._map=void 0;let i,n=tu;this.result=new iu(this._processor,i,this._opts),this.result.css=t;let o=this;Object.defineProperty(this.result,"root",{get(){return o.root}});let l=new eu(n,i,this._opts,t);if(l.isMap()){let[a,u]=l.generate();a&&(this.result.css=a),u&&(this.result.map=u)}else l.clearAnnotation(),this.result.css=l.css}async(){return this.error?Promise.reject(this.error):Promise.resolve(this.result)}catch(e){return this.async().catch(e)}finally(e){return this.async().then(e,e)}sync(){if(this.error)throw this.error;return this.result}then(e,t){return process.env.NODE_ENV!=="production"&&("from"in this._opts||ru("Without `from` option PostCSS could generate wrong source map and will not find Browserslist config. Set it to CSS file path or to `undefined` to prevent this warning.")),this.async().then(e,t)}toString(){return this._css}warnings(){return[]}get content(){return this.result.css}get css(){return this.result.css}get map(){return this.result.map}get messages(){return[]}get opts(){return this.result.opts}get processor(){return this.result.processor}get root(){if(this._root)return this._root;let e,t=su;try{e=t(this._css,this._opts)}catch(r){this.error=r}if(this.error)throw this.error;return this._root=e,e}get[Symbol.toStringTag](){return"NoWorkResult"}};var nu=es;es.default=es;let ou=nu,au=Qi,lu=Vr,uu=Qe,tt=class{constructor(e=[]){this.version="8.4.38",this.plugins=this.normalize(e)}normalize(e){let t=[];for(let r of e)if(r.postcss===!0?r=r():r.postcss&&(r=r.postcss),typeof r=="object"&&Array.isArray(r.plugins))t=t.concat(r.plugins);else if(typeof r=="object"&&r.postcssPlugin)t.push(r);else if(typeof r=="function")t.push(r);else if(typeof r=="object"&&(r.parse||r.stringify)){if(process.env.NODE_ENV!=="production")throw new Error("PostCSS syntaxes cannot be used as plugins. Instead, please use one of the syntax/parser/stringifier options as outlined in your PostCSS runner documentation.")}else throw new Error(r+" is not a PostCSS plugin");return t}process(e,t={}){return!this.plugins.length&&!t.parser&&!t.stringifier&&!t.syntax?new ou(this,e,t):new au(this,e,t)}use(e){return this.plugins=this.plugins.concat(this.normalize([e])),this}};var cu=tt;tt.default=tt,uu.registerProcessor(tt),lu.registerProcessor(tt);let hu=At,fu=mi,du=Nt,pu=Jr,mu=Et,gu=Qe,yu=Kr;function rt(s,e){if(Array.isArray(s))return s.map(i=>rt(i));let{inputs:t,...r}=s;if(t){e=[];for(let i of t){let n={...i,__proto__:mu.prototype};n.map&&(n.map={...n.map,__proto__:fu.prototype}),e.push(n)}}if(r.nodes&&(r.nodes=s.nodes.map(i=>rt(i,e))),r.source){let{inputId:i,...n}=r.source;r.source=n,i!=null&&(r.source.input=e[i])}if(r.type==="root")return new gu(r);if(r.type==="decl")return new hu(r);if(r.type==="rule")return new yu(r);if(r.type==="comment")return new du(r);if(r.type==="atrule")return new pu(r);throw new Error("Unknown node type: "+s.type)}var wu=rt;rt.default=rt;let Su=Mr,qi=At,bu=Qi,vu=xe,ts=cu,Cu=Ct,Iu=wu,en=Vr,xu=_i,tn=Nt,rn=Jr,Au=Yr,Ru=Et,Ou=Xr,Eu=ji,sn=Kr,nn=Qe,Mu=xt;function M(...s){return s.length===1&&Array.isArray(s[0])&&(s=s[0]),new ts(s)}M.plugin=function(e,t){let r=!1;function i(...o){console&&console.warn&&!r&&(r=!0,console.warn(e+`: postcss.plugin was deprecated. Migration guide:https://evilmartians.com/chronicles/postcss-8-plugin-migration`),process.env.LANG&&process.env.LANG.startsWith("cn")&&console.warn(e+`: 里面 postcss.plugin 被弃用. 迁移指南:-https://www.w3ctech.com/topic/2226`));let l=t(...o);return l.postcssPlugin=e,l.postcssVersion=new ts().version,l}let n;return Object.defineProperty(i,"postcss",{get(){return n||(n=i()),n}}),i.process=function(o,l,a){return A([i(a)]).process(o,l)},i},A.stringify=Cu,A.parse=Ru,A.fromJSON=vu,A.list=Eu,A.comment=s=>new tn(s),A.atRule=s=>new rn(s),A.decl=s=>new qi(s),A.rule=s=>new sn(s),A.root=s=>new nn(s),A.document=s=>new en(s),A.CssSyntaxError=wu,A.Declaration=qi,A.Container=Su,A.Processor=ts,A.Document=en,A.Comment=tn,A.Warning=Iu,A.AtRule=rn,A.Result=xu,A.Input=Ou,A.Rule=sn,A.Root=nn,A.Node=Au,bu.registerPostcss(A);var Mu=A;A.default=A;const F=ja(Mu);F.stringify,F.fromJSON,F.plugin,F.parse,F.list,F.document,F.comment,F.atRule,F.rule,F.decl,F.root,F.CssSyntaxError,F.Declaration,F.Container,F.Processor,F.Document,F.Comment,F.Warning,F.AtRule,F.Result,F.Input,F.Rule,F.Root,F.Node;var $u=Object.defineProperty,Nu=(s,e,t)=>e in s?$u(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t,te=(s,e,t)=>Nu(s,typeof e!="symbol"?e+"":e,t);function ku(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}function Tu(s){if(s.__esModule)return s;var e=s.default;if(typeof e=="function"){var t=function r(){return this instanceof r?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};t.prototype=e.prototype}else t={};return Object.defineProperty(t,"__esModule",{value:!0}),Object.keys(s).forEach(function(r){var i=Object.getOwnPropertyDescriptor(s,r);Object.defineProperty(t,r,i.get?i:{enumerable:!0,get:function(){return s[r]}})}),t}var rs={exports:{}},_=String,on=function(){return{isColorSupported:!1,reset:_,bold:_,dim:_,italic:_,underline:_,inverse:_,hidden:_,strikethrough:_,black:_,red:_,green:_,yellow:_,blue:_,magenta:_,cyan:_,white:_,gray:_,bgBlack:_,bgRed:_,bgGreen:_,bgYellow:_,bgBlue:_,bgMagenta:_,bgCyan:_,bgWhite:_}};rs.exports=on(),rs.exports.createColors=on;var Pu=rs.exports;const oe=Tu(Object.freeze(Object.defineProperty({__proto__:null,default:{}},Symbol.toStringTag,{value:"Module"})));let an=Pu,ln=oe,ss=class Ho extends Error{constructor(e,t,r,i,n,o){super(e),this.name="CssSyntaxError",this.reason=e,n&&(this.file=n),i&&(this.source=i),o&&(this.plugin=o),typeof t<"u"&&typeof r<"u"&&(typeof t=="number"?(this.line=t,this.column=r):(this.line=t.line,this.column=t.column,this.endLine=r.line,this.endColumn=r.column)),this.setMessage(),Error.captureStackTrace&&Error.captureStackTrace(this,Ho)}setMessage(){this.message=this.plugin?this.plugin+": ":"",this.message+=this.file?this.file:"<css input>",typeof this.line<"u"&&(this.message+=":"+this.line+":"+this.column),this.message+=": "+this.reason}showSourceCode(e){if(!this.source)return"";let t=this.source;e==null&&(e=an.isColorSupported),ln&&e&&(t=ln(t));let r=t.split(/\r?\n/),i=Math.max(this.line-3,0),n=Math.min(this.line+2,r.length),o=String(n).length,l,a;if(e){let{bold:u,gray:c,red:h}=an.createColors(!0);l=p=>u(h(p)),a=p=>c(p)}else l=a=u=>u;return r.slice(i,n).map((u,c)=>{let h=i+1+c,p=" "+(" "+h).slice(-o)+" | ";if(h===this.line){let m=a(p.replace(/\d/g," "))+u.slice(0,this.column-1).replace(/[^\t]/g," ");return l(">")+a(p)+u+`+https://www.w3ctech.com/topic/2226`));let l=t(...o);return l.postcssPlugin=e,l.postcssVersion=new ts().version,l}let n;return Object.defineProperty(i,"postcss",{get(){return n||(n=i()),n}}),i.process=function(o,l,a){return M([i(a)]).process(o,l)},i},M.stringify=Cu,M.parse=Ou,M.fromJSON=Iu,M.list=Eu,M.comment=s=>new tn(s),M.atRule=s=>new rn(s),M.decl=s=>new qi(s),M.rule=s=>new sn(s),M.root=s=>new nn(s),M.document=s=>new en(s),M.CssSyntaxError=Su,M.Declaration=qi,M.Container=vu,M.Processor=ts,M.Document=en,M.Comment=tn,M.Warning=xu,M.AtRule=rn,M.Result=Au,M.Input=Ru,M.Rule=sn,M.Root=nn,M.Node=Mu,bu.registerPostcss(M);var $u=M;M.default=M;const F=Ha($u);F.stringify,F.fromJSON,F.plugin,F.parse,F.list,F.document,F.comment,F.atRule,F.rule,F.decl,F.root,F.CssSyntaxError,F.Declaration,F.Container,F.Processor,F.Document,F.Comment,F.Warning,F.AtRule,F.Result,F.Input,F.Rule,F.Root,F.Node;var Nu=Object.defineProperty,ku=(s,e,t)=>e in s?Nu(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t,re=(s,e,t)=>ku(s,typeof e!="symbol"?e+"":e,t);function Tu(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}function Pu(s){if(s.__esModule)return s;var e=s.default;if(typeof e=="function"){var t=function r(){return this instanceof r?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};t.prototype=e.prototype}else t={};return Object.defineProperty(t,"__esModule",{value:!0}),Object.keys(s).forEach(function(r){var i=Object.getOwnPropertyDescriptor(s,r);Object.defineProperty(t,r,i.get?i:{enumerable:!0,get:function(){return s[r]}})}),t}var rs={exports:{}},_=String,on=function(){return{isColorSupported:!1,reset:_,bold:_,dim:_,italic:_,underline:_,inverse:_,hidden:_,strikethrough:_,black:_,red:_,green:_,yellow:_,blue:_,magenta:_,cyan:_,white:_,gray:_,bgBlack:_,bgRed:_,bgGreen:_,bgYellow:_,bgBlue:_,bgMagenta:_,bgCyan:_,bgWhite:_}};rs.exports=on(),rs.exports.createColors=on;var Du=rs.exports;const ae=Pu(Object.freeze(Object.defineProperty({__proto__:null,default:{}},Symbol.toStringTag,{value:"Module"})));let an=Du,ln=ae,ss=class Zo extends Error{constructor(e,t,r,i,n,o){super(e),this.name="CssSyntaxError",this.reason=e,n&&(this.file=n),i&&(this.source=i),o&&(this.plugin=o),typeof t<"u"&&typeof r<"u"&&(typeof t=="number"?(this.line=t,this.column=r):(this.line=t.line,this.column=t.column,this.endLine=r.line,this.endColumn=r.column)),this.setMessage(),Error.captureStackTrace&&Error.captureStackTrace(this,Zo)}setMessage(){this.message=this.plugin?this.plugin+": ":"",this.message+=this.file?this.file:"<css input>",typeof this.line<"u"&&(this.message+=":"+this.line+":"+this.column),this.message+=": "+this.reason}showSourceCode(e){if(!this.source)return"";let t=this.source;e==null&&(e=an.isColorSupported),ln&&e&&(t=ln(t));let r=t.split(/\r?\n/),i=Math.max(this.line-3,0),n=Math.min(this.line+2,r.length),o=String(n).length,l,a;if(e){let{bold:u,gray:c,red:h}=an.createColors(!0);l=p=>u(h(p)),a=p=>c(p)}else l=a=u=>u;return r.slice(i,n).map((u,c)=>{let h=i+1+c,p=" "+(" "+h).slice(-o)+" | ";if(h===this.line){let m=a(p.replace(/\d/g," "))+u.slice(0,this.column-1).replace(/[^\t]/g," ");return l(">")+a(p)+u+``+m+l("^")}return" "+a(p)+u}).join(``)}toString(){let e=this.showSourceCode();return e&&(e=`@@ -36,28 +36,28 @@ https://www.w3ctech.com/topic/2226`));let l=t(...o);return l.postcssPlugin=e,l.p`,beforeComment:``,beforeDecl:``,beforeOpen:" ",beforeRule:`-`,colon:": ",commentLeft:" ",commentRight:" ",emptyBody:"",indent:" ",semicolon:!1};function Du(s){return s[0].toUpperCase()+s.slice(1)}let ns=class{constructor(e){this.builder=e}atrule(e,t){let r="@"+e.name,i=e.params?this.rawValue(e,"params"):"";if(typeof e.raws.afterName<"u"?r+=e.raws.afterName:i&&(r+=" "),e.nodes)this.block(e,r+i);else{let n=(e.raws.between||"")+(t?";":"");this.builder(r+i+n,e)}}beforeAfter(e,t){let r;e.type==="decl"?r=this.raw(e,null,"beforeDecl"):e.type==="comment"?r=this.raw(e,null,"beforeComment"):t==="before"?r=this.raw(e,null,"beforeRule"):r=this.raw(e,null,"beforeClose");let i=e.parent,n=0;for(;i&&i.type!=="root";)n+=1,i=i.parent;if(r.includes(`-`)){let o=this.raw(e,null,"indent");if(o.length)for(let l=0;l<n;l++)r+=o}return r}block(e,t){let r=this.raw(e,"between","beforeOpen");this.builder(t+r+"{",e,"start");let i;e.nodes&&e.nodes.length?(this.body(e),i=this.raw(e,"after")):i=this.raw(e,"after","emptyBody"),i&&this.builder(i),this.builder("}",e,"end")}body(e){let t=e.nodes.length-1;for(;t>0&&e.nodes[t].type==="comment";)t-=1;let r=this.raw(e,"semicolon");for(let i=0;i<e.nodes.length;i++){let n=e.nodes[i],o=this.raw(n,"before");o&&this.builder(o),this.stringify(n,t!==i||r)}}comment(e){let t=this.raw(e,"left","commentLeft"),r=this.raw(e,"right","commentRight");this.builder("/*"+t+e.text+r+"*/",e)}decl(e,t){let r=this.raw(e,"between","colon"),i=e.prop+r+this.rawValue(e,"value");e.important&&(i+=e.raws.important||" !important"),t&&(i+=";"),this.builder(i,e)}document(e){this.body(e)}raw(e,t,r){let i;if(r||(r=t),t&&(i=e.raws[t],typeof i<"u"))return i;let n=e.parent;if(r==="before"&&(!n||n.type==="root"&&n.first===e||n&&n.type==="document"))return"";if(!n)return un[r];let o=e.root();if(o.rawCache||(o.rawCache={}),typeof o.rawCache[r]<"u")return o.rawCache[r];if(r==="before"||r==="after")return this.beforeAfter(e,r);{let l="raw"+Du(r);this[l]?i=this[l](o,e):o.walk(a=>{if(i=a.raws[t],typeof i<"u")return!1})}return typeof i>"u"&&(i=un[r]),o.rawCache[r]=i,i}rawBeforeClose(e){let t;return e.walk(r=>{if(r.nodes&&r.nodes.length>0&&typeof r.raws.after<"u")return t=r.raws.after,t.includes(`+`,colon:": ",commentLeft:" ",commentRight:" ",emptyBody:"",indent:" ",semicolon:!1};function Lu(s){return s[0].toUpperCase()+s.slice(1)}let ns=class{constructor(e){this.builder=e}atrule(e,t){let r="@"+e.name,i=e.params?this.rawValue(e,"params"):"";if(typeof e.raws.afterName<"u"?r+=e.raws.afterName:i&&(r+=" "),e.nodes)this.block(e,r+i);else{let n=(e.raws.between||"")+(t?";":"");this.builder(r+i+n,e)}}beforeAfter(e,t){let r;e.type==="decl"?r=this.raw(e,null,"beforeDecl"):e.type==="comment"?r=this.raw(e,null,"beforeComment"):t==="before"?r=this.raw(e,null,"beforeRule"):r=this.raw(e,null,"beforeClose");let i=e.parent,n=0;for(;i&&i.type!=="root";)n+=1,i=i.parent;if(r.includes(`+`)){let o=this.raw(e,null,"indent");if(o.length)for(let l=0;l<n;l++)r+=o}return r}block(e,t){let r=this.raw(e,"between","beforeOpen");this.builder(t+r+"{",e,"start");let i;e.nodes&&e.nodes.length?(this.body(e),i=this.raw(e,"after")):i=this.raw(e,"after","emptyBody"),i&&this.builder(i),this.builder("}",e,"end")}body(e){let t=e.nodes.length-1;for(;t>0&&e.nodes[t].type==="comment";)t-=1;let r=this.raw(e,"semicolon");for(let i=0;i<e.nodes.length;i++){let n=e.nodes[i],o=this.raw(n,"before");o&&this.builder(o),this.stringify(n,t!==i||r)}}comment(e){let t=this.raw(e,"left","commentLeft"),r=this.raw(e,"right","commentRight");this.builder("/*"+t+e.text+r+"*/",e)}decl(e,t){let r=this.raw(e,"between","colon"),i=e.prop+r+this.rawValue(e,"value");e.important&&(i+=e.raws.important||" !important"),t&&(i+=";"),this.builder(i,e)}document(e){this.body(e)}raw(e,t,r){let i;if(r||(r=t),t&&(i=e.raws[t],typeof i<"u"))return i;let n=e.parent;if(r==="before"&&(!n||n.type==="root"&&n.first===e||n&&n.type==="document"))return"";if(!n)return un[r];let o=e.root();if(o.rawCache||(o.rawCache={}),typeof o.rawCache[r]<"u")return o.rawCache[r];if(r==="before"||r==="after")return this.beforeAfter(e,r);{let l="raw"+Lu(r);this[l]?i=this[l](o,e):o.walk(a=>{if(i=a.raws[t],typeof i<"u")return!1})}return typeof i>"u"&&(i=un[r]),o.rawCache[r]=i,i}rawBeforeClose(e){let t;return e.walk(r=>{if(r.nodes&&r.nodes.length>0&&typeof r.raws.after<"u")return t=r.raws.after,t.includes(``)&&(t=t.replace(/[^\n]+$/,"")),!1}),t&&(t=t.replace(/\S/g,"")),t}rawBeforeComment(e,t){let r;return e.walkComments(i=>{if(typeof i.raws.before<"u")return r=i.raws.before,r.includes(``)&&(r=r.replace(/[^\n]+$/,"")),!1}),typeof r>"u"?r=this.raw(t,null,"beforeDecl"):r&&(r=r.replace(/\S/g,"")),r}rawBeforeDecl(e,t){let r;return e.walkDecls(i=>{if(typeof i.raws.before<"u")return r=i.raws.before,r.includes(``)&&(r=r.replace(/[^\n]+$/,"")),!1}),typeof r>"u"?r=this.raw(t,null,"beforeRule"):r&&(r=r.replace(/\S/g,"")),r}rawBeforeOpen(e){let t;return e.walk(r=>{if(r.type!=="decl"&&(t=r.raws.between,typeof t<"u"))return!1}),t}rawBeforeRule(e){let t;return e.walk(r=>{if(r.nodes&&(r.parent!==e||e.first!==r)&&typeof r.raws.before<"u")return t=r.raws.before,t.includes(``)&&(t=t.replace(/[^\n]+$/,"")),!1}),t&&(t=t.replace(/\S/g,"")),t}rawColon(e){let t;return e.walkDecls(r=>{if(typeof r.raws.between<"u")return t=r.raws.between.replace(/[^\s:]/g,""),!1}),t}rawEmptyBody(e){let t;return e.walk(r=>{if(r.nodes&&r.nodes.length===0&&(t=r.raws.after,typeof t<"u"))return!1}),t}rawIndent(e){if(e.raws.indent)return e.raws.indent;let t;return e.walk(r=>{let i=r.parent;if(i&&i!==e&&i.parent&&i.parent===e&&typeof r.raws.before<"u"){let n=r.raws.before.split(`-`);return t=n[n.length-1],t=t.replace(/\S/g,""),!1}}),t}rawSemicolon(e){let t;return e.walk(r=>{if(r.nodes&&r.nodes.length&&r.last.type==="decl"&&(t=r.raws.semicolon,typeof t<"u"))return!1}),t}rawValue(e,t){let r=e[t],i=e.raws[t];return i&&i.value===r?i.raw:r}root(e){this.body(e),e.raws.after&&this.builder(e.raws.after)}rule(e){this.block(e,this.rawValue(e,"selector")),e.raws.ownSemicolon&&this.builder(e.raws.ownSemicolon,e,"end")}stringify(e,t){if(!this[e.type])throw new Error("Unknown AST node type "+e.type+". Maybe you need to change PostCSS stringifier.");this[e.type](e,t)}};var cn=ns;ns.default=ns;let Lu=cn;function os(s,e){new Lu(e).stringify(s)}var Wt=os;os.default=os;let{isClean:Gt,my:_u}=st,Fu=is,Uu=cn,Bu=Wt;function as(s,e){let t=new s.constructor;for(let r in s){if(!Object.prototype.hasOwnProperty.call(s,r)||r==="proxyCache")continue;let i=s[r],n=typeof i;r==="parent"&&n==="object"?e&&(t[r]=e):r==="source"?t[r]=i:Array.isArray(i)?t[r]=i.map(o=>as(o,t)):(n==="object"&&i!==null&&(i=as(i)),t[r]=i)}return t}let ls=class{constructor(e={}){this.raws={},this[Gt]=!1,this[_u]=!0;for(let t in e)if(t==="nodes"){this.nodes=[];for(let r of e[t])typeof r.clone=="function"?this.append(r.clone()):this.append(r)}else this[t]=e[t]}addToError(e){if(e.postcssNode=this,e.stack&&this.source&&/\n\s{4}at /.test(e.stack)){let t=this.source;e.stack=e.stack.replace(/\n\s{4}at /,`$&${t.input.from}:${t.start.line}:${t.start.column}$&`)}return e}after(e){return this.parent.insertAfter(this,e),this}assign(e={}){for(let t in e)this[t]=e[t];return this}before(e){return this.parent.insertBefore(this,e),this}cleanRaws(e){delete this.raws.before,delete this.raws.after,e||delete this.raws.between}clone(e={}){let t=as(this);for(let r in e)t[r]=e[r];return t}cloneAfter(e={}){let t=this.clone(e);return this.parent.insertAfter(this,t),t}cloneBefore(e={}){let t=this.clone(e);return this.parent.insertBefore(this,t),t}error(e,t={}){if(this.source){let{end:r,start:i}=this.rangeBy(t);return this.source.input.error(e,{column:i.column,line:i.line},{column:r.column,line:r.line},t)}return new Fu(e)}getProxyProcessor(){return{get(e,t){return t==="proxyOf"?e:t==="root"?()=>e.root().toProxy():e[t]},set(e,t,r){return e[t]===r||(e[t]=r,(t==="prop"||t==="value"||t==="name"||t==="params"||t==="important"||t==="text")&&e.markDirty()),!0}}}markDirty(){if(this[Gt]){this[Gt]=!1;let e=this;for(;e=e.parent;)e[Gt]=!1}}next(){if(!this.parent)return;let e=this.parent.index(this);return this.parent.nodes[e+1]}positionBy(e,t){let r=this.source.start;if(e.index)r=this.positionInside(e.index,t);else if(e.word){t=this.toString();let i=t.indexOf(e.word);i!==-1&&(r=this.positionInside(i,t))}return r}positionInside(e,t){let r=t||this.toString(),i=this.source.start.column,n=this.source.start.line;for(let o=0;o<e;o++)r[o]===`-`?(i=1,n+=1):i+=1;return{column:i,line:n}}prev(){if(!this.parent)return;let e=this.parent.index(this);return this.parent.nodes[e-1]}rangeBy(e){let t={column:this.source.start.column,line:this.source.start.line},r=this.source.end?{column:this.source.end.column+1,line:this.source.end.line}:{column:t.column+1,line:t.line};if(e.word){let i=this.toString(),n=i.indexOf(e.word);n!==-1&&(t=this.positionInside(n,i),r=this.positionInside(n+e.word.length,i))}else e.start?t={column:e.start.column,line:e.start.line}:e.index&&(t=this.positionInside(e.index)),e.end?r={column:e.end.column,line:e.end.line}:typeof e.endIndex=="number"?r=this.positionInside(e.endIndex):e.index&&(r=this.positionInside(e.index+1));return(r.line<t.line||r.line===t.line&&r.column<=t.column)&&(r={column:t.column+1,line:t.line}),{end:r,start:t}}raw(e,t){return new Uu().raw(this,e,t)}remove(){return this.parent&&this.parent.removeChild(this),this.parent=void 0,this}replaceWith(...e){if(this.parent){let t=this,r=!1;for(let i of e)i===this?r=!0:r?(this.parent.insertAfter(t,i),t=i):this.parent.insertBefore(t,i);r||this.remove()}return this}root(){let e=this;for(;e.parent&&e.parent.type!=="document";)e=e.parent;return e}toJSON(e,t){let r={},i=t==null;t=t||new Map;let n=0;for(let o in this){if(!Object.prototype.hasOwnProperty.call(this,o)||o==="parent"||o==="proxyCache")continue;let l=this[o];if(Array.isArray(l))r[o]=l.map(a=>typeof a=="object"&&a.toJSON?a.toJSON(null,t):a);else if(typeof l=="object"&&l.toJSON)r[o]=l.toJSON(null,t);else if(o==="source"){let a=t.get(l.input);a==null&&(a=n,t.set(l.input,n),n++),r[o]={end:l.end,inputId:a,start:l.start}}else r[o]=l}return i&&(r.inputs=[...t.keys()].map(o=>o.toJSON())),r}toProxy(){return this.proxyCache||(this.proxyCache=new Proxy(this,this.getProxyProcessor())),this.proxyCache}toString(e=Bu){e.stringify&&(e=e.stringify);let t="";return e(this,r=>{t+=r}),t}warn(e,t,r){let i={node:this};for(let n in r)i[n]=r[n];return e.warn(t,i)}get proxyOf(){return this}};var Vt=ls;ls.default=ls;let zu=Vt,us=class extends zu{constructor(e){e&&typeof e.value<"u"&&typeof e.value!="string"&&(e={...e,value:String(e.value)}),super(e),this.type="decl"}get variable(){return this.prop.startsWith("--")||this.prop[0]==="$"}};var jt=us;us.default=us;let Wu="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";var Gu={nanoid:(s=21)=>{let e="",t=s;for(;t--;)e+=Wu[Math.random()*64|0];return e}};let{SourceMapConsumer:hn,SourceMapGenerator:fn}=oe,{existsSync:Vu,readFileSync:ju}=oe,{dirname:cs,join:Yu}=oe;function Hu(s){return Buffer?Buffer.from(s,"base64").toString():window.atob(s)}let hs=class{constructor(e,t){if(t.map===!1)return;this.loadAnnotation(e),this.inline=this.startWith(this.annotation,"data:");let r=t.map?t.map.prev:void 0,i=this.loadMap(t.from,r);!this.mapFile&&t.from&&(this.mapFile=t.from),this.mapFile&&(this.root=cs(this.mapFile)),i&&(this.text=i)}consumer(){return this.consumerCache||(this.consumerCache=new hn(this.text)),this.consumerCache}decodeInline(e){let t=/^data:application\/json;charset=utf-?8;base64,/,r=/^data:application\/json;base64,/,i=/^data:application\/json;charset=utf-?8,/,n=/^data:application\/json,/;if(i.test(e)||n.test(e))return decodeURIComponent(e.substr(RegExp.lastMatch.length));if(t.test(e)||r.test(e))return Hu(e.substr(RegExp.lastMatch.length));let o=e.match(/data:application\/json;([^,]+),/)[1];throw new Error("Unsupported source map encoding "+o)}getAnnotationURL(e){return e.replace(/^\/\*\s*# sourceMappingURL=/,"").trim()}isMap(e){return typeof e!="object"?!1:typeof e.mappings=="string"||typeof e._mappings=="string"||Array.isArray(e.sections)}loadAnnotation(e){let t=e.match(/\/\*\s*# sourceMappingURL=/gm);if(!t)return;let r=e.lastIndexOf(t.pop()),i=e.indexOf("*/",r);r>-1&&i>-1&&(this.annotation=this.getAnnotationURL(e.substring(r,i)))}loadFile(e){if(this.root=cs(e),Vu(e))return this.mapFile=e,ju(e,"utf-8").toString().trim()}loadMap(e,t){if(t===!1)return!1;if(t){if(typeof t=="string")return t;if(typeof t=="function"){let r=t(e);if(r){let i=this.loadFile(r);if(!i)throw new Error("Unable to load previous source map: "+r.toString());return i}}else{if(t instanceof hn)return fn.fromSourceMap(t).toString();if(t instanceof fn)return t.toString();if(this.isMap(t))return JSON.stringify(t);throw new Error("Unsupported previous source map format: "+t.toString())}}else{if(this.inline)return this.decodeInline(this.annotation);if(this.annotation){let r=this.annotation;return e&&(r=Yu(cs(e),r)),this.loadFile(r)}}}startWith(e,t){return e?e.substr(0,t.length)===t:!1}withContent(){return!!(this.consumer().sourcesContent&&this.consumer().sourcesContent.length>0)}};var dn=hs;hs.default=hs;let{SourceMapConsumer:Zu,SourceMapGenerator:Ju}=oe,{fileURLToPath:pn,pathToFileURL:Yt}=oe,{isAbsolute:fs,resolve:ds}=oe,{nanoid:Ku}=Gu,ps=oe,mn=is,Xu=dn,ms=Symbol("fromOffsetCache"),Qu=!!(Zu&&Ju),gn=!!(ds&&fs),Ht=class{constructor(e,t={}){if(e===null||typeof e>"u"||typeof e=="object"&&!e.toString)throw new Error(`PostCSS received ${e} instead of CSS string`);if(this.css=e.toString(),this.css[0]==="\uFEFF"||this.css[0]===""?(this.hasBOM=!0,this.css=this.css.slice(1)):this.hasBOM=!1,t.from&&(!gn||/^\w+:\/\//.test(t.from)||fs(t.from)?this.file=t.from:this.file=ds(t.from)),gn&&Qu){let r=new Xu(this.css,t);if(r.text){this.map=r;let i=r.consumer().file;!this.file&&i&&(this.file=this.mapResolve(i))}}this.file||(this.id="<input css "+Ku(6)+">"),this.map&&(this.map.file=this.from)}error(e,t,r,i={}){let n,o,l;if(t&&typeof t=="object"){let u=t,c=r;if(typeof u.offset=="number"){let h=this.fromOffset(u.offset);t=h.line,r=h.col}else t=u.line,r=u.column;if(typeof c.offset=="number"){let h=this.fromOffset(c.offset);o=h.line,l=h.col}else o=c.line,l=c.column}else if(!r){let u=this.fromOffset(t);t=u.line,r=u.col}let a=this.origin(t,r,o,l);return a?n=new mn(e,a.endLine===void 0?a.line:{column:a.column,line:a.line},a.endLine===void 0?a.column:{column:a.endColumn,line:a.endLine},a.source,a.file,i.plugin):n=new mn(e,o===void 0?t:{column:r,line:t},o===void 0?r:{column:l,line:o},this.css,this.file,i.plugin),n.input={column:r,endColumn:l,endLine:o,line:t,source:this.css},this.file&&(Yt&&(n.input.url=Yt(this.file).toString()),n.input.file=this.file),n}fromOffset(e){let t,r;if(this[ms])r=this[ms];else{let n=this.css.split(`-`);r=new Array(n.length);let o=0;for(let l=0,a=n.length;l<a;l++)r[l]=o,o+=n[l].length+1;this[ms]=r}t=r[r.length-1];let i=0;if(e>=t)i=r.length-1;else{let n=r.length-2,o;for(;i<n;)if(o=i+(n-i>>1),e<r[o])n=o-1;else if(e>=r[o+1])i=o+1;else{i=o;break}}return{col:e-r[i]+1,line:i+1}}mapResolve(e){return/^\w+:\/\//.test(e)?e:ds(this.map.consumer().sourceRoot||this.map.root||".",e)}origin(e,t,r,i){if(!this.map)return!1;let n=this.map.consumer(),o=n.originalPositionFor({column:t,line:e});if(!o.source)return!1;let l;typeof r=="number"&&(l=n.originalPositionFor({column:i,line:r}));let a;fs(o.source)?a=Yt(o.source):a=new URL(o.source,this.map.consumer().sourceRoot||Yt(this.map.mapFile));let u={column:o.column,endColumn:l&&l.column,endLine:l&&l.line,line:o.line,url:a.toString()};if(a.protocol==="file:")if(pn)u.file=pn(a);else throw new Error("file: protocol is not available in this PostCSS build");let c=n.sourceContentFor(o.source);return c&&(u.source=c),u}toJSON(){let e={};for(let t of["hasBOM","css","file","id"])this[t]!=null&&(e[t]=this[t]);return this.map&&(e.map={...this.map},e.map.consumerCache&&(e.map.consumerCache=void 0)),e}get from(){return this.file||this.id}};var Zt=Ht;Ht.default=Ht,ps&&ps.registerInput&&ps.registerInput(Ht);let{SourceMapConsumer:yn,SourceMapGenerator:Jt}=oe,{dirname:Kt,relative:wn,resolve:bn,sep:Sn}=oe,{pathToFileURL:Cn}=oe,qu=Zt,ec=!!(yn&&Jt),tc=!!(Kt&&bn&&wn&&Sn);var vn=class{constructor(e,t,r,i){this.stringify=e,this.mapOpts=r.map||{},this.root=t,this.opts=r,this.css=i,this.originalCSS=i,this.usesFileUrls=!this.mapOpts.from&&this.mapOpts.absolute,this.memoizedFileURLs=new Map,this.memoizedPaths=new Map,this.memoizedURLs=new Map}addAnnotation(){let e;this.isInline()?e="data:application/json;base64,"+this.toBase64(this.map.toString()):typeof this.mapOpts.annotation=="string"?e=this.mapOpts.annotation:typeof this.mapOpts.annotation=="function"?e=this.mapOpts.annotation(this.opts.to,this.root):e=this.outputFile()+".map";let t=`+`);return t=n[n.length-1],t=t.replace(/\S/g,""),!1}}),t}rawSemicolon(e){let t;return e.walk(r=>{if(r.nodes&&r.nodes.length&&r.last.type==="decl"&&(t=r.raws.semicolon,typeof t<"u"))return!1}),t}rawValue(e,t){let r=e[t],i=e.raws[t];return i&&i.value===r?i.raw:r}root(e){this.body(e),e.raws.after&&this.builder(e.raws.after)}rule(e){this.block(e,this.rawValue(e,"selector")),e.raws.ownSemicolon&&this.builder(e.raws.ownSemicolon,e,"end")}stringify(e,t){if(!this[e.type])throw new Error("Unknown AST node type "+e.type+". Maybe you need to change PostCSS stringifier.");this[e.type](e,t)}};var cn=ns;ns.default=ns;let _u=cn;function os(s,e){new _u(e).stringify(s)}var Wt=os;os.default=os;let{isClean:Gt,my:Fu}=st,Uu=is,Bu=cn,zu=Wt;function as(s,e){let t=new s.constructor;for(let r in s){if(!Object.prototype.hasOwnProperty.call(s,r)||r==="proxyCache")continue;let i=s[r],n=typeof i;r==="parent"&&n==="object"?e&&(t[r]=e):r==="source"?t[r]=i:Array.isArray(i)?t[r]=i.map(o=>as(o,t)):(n==="object"&&i!==null&&(i=as(i)),t[r]=i)}return t}let ls=class{constructor(e={}){this.raws={},this[Gt]=!1,this[Fu]=!0;for(let t in e)if(t==="nodes"){this.nodes=[];for(let r of e[t])typeof r.clone=="function"?this.append(r.clone()):this.append(r)}else this[t]=e[t]}addToError(e){if(e.postcssNode=this,e.stack&&this.source&&/\n\s{4}at /.test(e.stack)){let t=this.source;e.stack=e.stack.replace(/\n\s{4}at /,`$&${t.input.from}:${t.start.line}:${t.start.column}$&`)}return e}after(e){return this.parent.insertAfter(this,e),this}assign(e={}){for(let t in e)this[t]=e[t];return this}before(e){return this.parent.insertBefore(this,e),this}cleanRaws(e){delete this.raws.before,delete this.raws.after,e||delete this.raws.between}clone(e={}){let t=as(this);for(let r in e)t[r]=e[r];return t}cloneAfter(e={}){let t=this.clone(e);return this.parent.insertAfter(this,t),t}cloneBefore(e={}){let t=this.clone(e);return this.parent.insertBefore(this,t),t}error(e,t={}){if(this.source){let{end:r,start:i}=this.rangeBy(t);return this.source.input.error(e,{column:i.column,line:i.line},{column:r.column,line:r.line},t)}return new Uu(e)}getProxyProcessor(){return{get(e,t){return t==="proxyOf"?e:t==="root"?()=>e.root().toProxy():e[t]},set(e,t,r){return e[t]===r||(e[t]=r,(t==="prop"||t==="value"||t==="name"||t==="params"||t==="important"||t==="text")&&e.markDirty()),!0}}}markDirty(){if(this[Gt]){this[Gt]=!1;let e=this;for(;e=e.parent;)e[Gt]=!1}}next(){if(!this.parent)return;let e=this.parent.index(this);return this.parent.nodes[e+1]}positionBy(e,t){let r=this.source.start;if(e.index)r=this.positionInside(e.index,t);else if(e.word){t=this.toString();let i=t.indexOf(e.word);i!==-1&&(r=this.positionInside(i,t))}return r}positionInside(e,t){let r=t||this.toString(),i=this.source.start.column,n=this.source.start.line;for(let o=0;o<e;o++)r[o]===`+`?(i=1,n+=1):i+=1;return{column:i,line:n}}prev(){if(!this.parent)return;let e=this.parent.index(this);return this.parent.nodes[e-1]}rangeBy(e){let t={column:this.source.start.column,line:this.source.start.line},r=this.source.end?{column:this.source.end.column+1,line:this.source.end.line}:{column:t.column+1,line:t.line};if(e.word){let i=this.toString(),n=i.indexOf(e.word);n!==-1&&(t=this.positionInside(n,i),r=this.positionInside(n+e.word.length,i))}else e.start?t={column:e.start.column,line:e.start.line}:e.index&&(t=this.positionInside(e.index)),e.end?r={column:e.end.column,line:e.end.line}:typeof e.endIndex=="number"?r=this.positionInside(e.endIndex):e.index&&(r=this.positionInside(e.index+1));return(r.line<t.line||r.line===t.line&&r.column<=t.column)&&(r={column:t.column+1,line:t.line}),{end:r,start:t}}raw(e,t){return new Bu().raw(this,e,t)}remove(){return this.parent&&this.parent.removeChild(this),this.parent=void 0,this}replaceWith(...e){if(this.parent){let t=this,r=!1;for(let i of e)i===this?r=!0:r?(this.parent.insertAfter(t,i),t=i):this.parent.insertBefore(t,i);r||this.remove()}return this}root(){let e=this;for(;e.parent&&e.parent.type!=="document";)e=e.parent;return e}toJSON(e,t){let r={},i=t==null;t=t||new Map;let n=0;for(let o in this){if(!Object.prototype.hasOwnProperty.call(this,o)||o==="parent"||o==="proxyCache")continue;let l=this[o];if(Array.isArray(l))r[o]=l.map(a=>typeof a=="object"&&a.toJSON?a.toJSON(null,t):a);else if(typeof l=="object"&&l.toJSON)r[o]=l.toJSON(null,t);else if(o==="source"){let a=t.get(l.input);a==null&&(a=n,t.set(l.input,n),n++),r[o]={end:l.end,inputId:a,start:l.start}}else r[o]=l}return i&&(r.inputs=[...t.keys()].map(o=>o.toJSON())),r}toProxy(){return this.proxyCache||(this.proxyCache=new Proxy(this,this.getProxyProcessor())),this.proxyCache}toString(e=zu){e.stringify&&(e=e.stringify);let t="";return e(this,r=>{t+=r}),t}warn(e,t,r){let i={node:this};for(let n in r)i[n]=r[n];return e.warn(t,i)}get proxyOf(){return this}};var Vt=ls;ls.default=ls;let Wu=Vt,us=class extends Wu{constructor(e){e&&typeof e.value<"u"&&typeof e.value!="string"&&(e={...e,value:String(e.value)}),super(e),this.type="decl"}get variable(){return this.prop.startsWith("--")||this.prop[0]==="$"}};var jt=us;us.default=us;let Gu="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";var Vu={nanoid:(s=21)=>{let e="",t=s;for(;t--;)e+=Gu[Math.random()*64|0];return e}};let{SourceMapConsumer:hn,SourceMapGenerator:fn}=ae,{existsSync:ju,readFileSync:Hu}=ae,{dirname:cs,join:Yu}=ae;function Zu(s){return Buffer?Buffer.from(s,"base64").toString():window.atob(s)}let hs=class{constructor(e,t){if(t.map===!1)return;this.loadAnnotation(e),this.inline=this.startWith(this.annotation,"data:");let r=t.map?t.map.prev:void 0,i=this.loadMap(t.from,r);!this.mapFile&&t.from&&(this.mapFile=t.from),this.mapFile&&(this.root=cs(this.mapFile)),i&&(this.text=i)}consumer(){return this.consumerCache||(this.consumerCache=new hn(this.text)),this.consumerCache}decodeInline(e){let t=/^data:application\/json;charset=utf-?8;base64,/,r=/^data:application\/json;base64,/,i=/^data:application\/json;charset=utf-?8,/,n=/^data:application\/json,/;if(i.test(e)||n.test(e))return decodeURIComponent(e.substr(RegExp.lastMatch.length));if(t.test(e)||r.test(e))return Zu(e.substr(RegExp.lastMatch.length));let o=e.match(/data:application\/json;([^,]+),/)[1];throw new Error("Unsupported source map encoding "+o)}getAnnotationURL(e){return e.replace(/^\/\*\s*# sourceMappingURL=/,"").trim()}isMap(e){return typeof e!="object"?!1:typeof e.mappings=="string"||typeof e._mappings=="string"||Array.isArray(e.sections)}loadAnnotation(e){let t=e.match(/\/\*\s*# sourceMappingURL=/gm);if(!t)return;let r=e.lastIndexOf(t.pop()),i=e.indexOf("*/",r);r>-1&&i>-1&&(this.annotation=this.getAnnotationURL(e.substring(r,i)))}loadFile(e){if(this.root=cs(e),ju(e))return this.mapFile=e,Hu(e,"utf-8").toString().trim()}loadMap(e,t){if(t===!1)return!1;if(t){if(typeof t=="string")return t;if(typeof t=="function"){let r=t(e);if(r){let i=this.loadFile(r);if(!i)throw new Error("Unable to load previous source map: "+r.toString());return i}}else{if(t instanceof hn)return fn.fromSourceMap(t).toString();if(t instanceof fn)return t.toString();if(this.isMap(t))return JSON.stringify(t);throw new Error("Unsupported previous source map format: "+t.toString())}}else{if(this.inline)return this.decodeInline(this.annotation);if(this.annotation){let r=this.annotation;return e&&(r=Yu(cs(e),r)),this.loadFile(r)}}}startWith(e,t){return e?e.substr(0,t.length)===t:!1}withContent(){return!!(this.consumer().sourcesContent&&this.consumer().sourcesContent.length>0)}};var dn=hs;hs.default=hs;let{SourceMapConsumer:Ju,SourceMapGenerator:Ku}=ae,{fileURLToPath:pn,pathToFileURL:Ht}=ae,{isAbsolute:fs,resolve:ds}=ae,{nanoid:Xu}=Vu,ps=ae,mn=is,Qu=dn,ms=Symbol("fromOffsetCache"),qu=!!(Ju&&Ku),gn=!!(ds&&fs),Yt=class{constructor(e,t={}){if(e===null||typeof e>"u"||typeof e=="object"&&!e.toString)throw new Error(`PostCSS received ${e} instead of CSS string`);if(this.css=e.toString(),this.css[0]==="\uFEFF"||this.css[0]===""?(this.hasBOM=!0,this.css=this.css.slice(1)):this.hasBOM=!1,t.from&&(!gn||/^\w+:\/\//.test(t.from)||fs(t.from)?this.file=t.from:this.file=ds(t.from)),gn&&qu){let r=new Qu(this.css,t);if(r.text){this.map=r;let i=r.consumer().file;!this.file&&i&&(this.file=this.mapResolve(i))}}this.file||(this.id="<input css "+Xu(6)+">"),this.map&&(this.map.file=this.from)}error(e,t,r,i={}){let n,o,l;if(t&&typeof t=="object"){let u=t,c=r;if(typeof u.offset=="number"){let h=this.fromOffset(u.offset);t=h.line,r=h.col}else t=u.line,r=u.column;if(typeof c.offset=="number"){let h=this.fromOffset(c.offset);o=h.line,l=h.col}else o=c.line,l=c.column}else if(!r){let u=this.fromOffset(t);t=u.line,r=u.col}let a=this.origin(t,r,o,l);return a?n=new mn(e,a.endLine===void 0?a.line:{column:a.column,line:a.line},a.endLine===void 0?a.column:{column:a.endColumn,line:a.endLine},a.source,a.file,i.plugin):n=new mn(e,o===void 0?t:{column:r,line:t},o===void 0?r:{column:l,line:o},this.css,this.file,i.plugin),n.input={column:r,endColumn:l,endLine:o,line:t,source:this.css},this.file&&(Ht&&(n.input.url=Ht(this.file).toString()),n.input.file=this.file),n}fromOffset(e){let t,r;if(this[ms])r=this[ms];else{let n=this.css.split(`+`);r=new Array(n.length);let o=0;for(let l=0,a=n.length;l<a;l++)r[l]=o,o+=n[l].length+1;this[ms]=r}t=r[r.length-1];let i=0;if(e>=t)i=r.length-1;else{let n=r.length-2,o;for(;i<n;)if(o=i+(n-i>>1),e<r[o])n=o-1;else if(e>=r[o+1])i=o+1;else{i=o;break}}return{col:e-r[i]+1,line:i+1}}mapResolve(e){return/^\w+:\/\//.test(e)?e:ds(this.map.consumer().sourceRoot||this.map.root||".",e)}origin(e,t,r,i){if(!this.map)return!1;let n=this.map.consumer(),o=n.originalPositionFor({column:t,line:e});if(!o.source)return!1;let l;typeof r=="number"&&(l=n.originalPositionFor({column:i,line:r}));let a;fs(o.source)?a=Ht(o.source):a=new URL(o.source,this.map.consumer().sourceRoot||Ht(this.map.mapFile));let u={column:o.column,endColumn:l&&l.column,endLine:l&&l.line,line:o.line,url:a.toString()};if(a.protocol==="file:")if(pn)u.file=pn(a);else throw new Error("file: protocol is not available in this PostCSS build");let c=n.sourceContentFor(o.source);return c&&(u.source=c),u}toJSON(){let e={};for(let t of["hasBOM","css","file","id"])this[t]!=null&&(e[t]=this[t]);return this.map&&(e.map={...this.map},e.map.consumerCache&&(e.map.consumerCache=void 0)),e}get from(){return this.file||this.id}};var Zt=Yt;Yt.default=Yt,ps&&ps.registerInput&&ps.registerInput(Yt);let{SourceMapConsumer:yn,SourceMapGenerator:Jt}=ae,{dirname:Kt,relative:wn,resolve:Sn,sep:bn}=ae,{pathToFileURL:vn}=ae,ec=Zt,tc=!!(yn&&Jt),rc=!!(Kt&&Sn&&wn&&bn);var Cn=class{constructor(e,t,r,i){this.stringify=e,this.mapOpts=r.map||{},this.root=t,this.opts=r,this.css=i,this.originalCSS=i,this.usesFileUrls=!this.mapOpts.from&&this.mapOpts.absolute,this.memoizedFileURLs=new Map,this.memoizedPaths=new Map,this.memoizedURLs=new Map}addAnnotation(){let e;this.isInline()?e="data:application/json;base64,"+this.toBase64(this.map.toString()):typeof this.mapOpts.annotation=="string"?e=this.mapOpts.annotation:typeof this.mapOpts.annotation=="function"?e=this.mapOpts.annotation(this.opts.to,this.root):e=this.outputFile()+".map";let t=``;this.css.includes(`\r`)&&(t=`\r-`),this.css+=t+"/*# sourceMappingURL="+e+" */"}applyPrevMaps(){for(let e of this.previous()){let t=this.toUrl(this.path(e.file)),r=e.root||Kt(e.file),i;this.mapOpts.sourcesContent===!1?(i=new yn(e.text),i.sourcesContent&&(i.sourcesContent=null)):i=e.consumer(),this.map.applySourceMap(i,t,this.toUrl(this.path(r)))}}clearAnnotation(){if(this.mapOpts.annotation!==!1)if(this.root){let e;for(let t=this.root.nodes.length-1;t>=0;t--)e=this.root.nodes[t],e.type==="comment"&&e.text.indexOf("# sourceMappingURL=")===0&&this.root.removeChild(t)}else this.css&&(this.css=this.css.replace(/\n*?\/\*#[\S\s]*?\*\/$/gm,""))}generate(){if(this.clearAnnotation(),tc&&ec&&this.isMap())return this.generateMap();{let e="";return this.stringify(this.root,t=>{e+=t}),[e]}}generateMap(){if(this.root)this.generateString();else if(this.previous().length===1){let e=this.previous()[0].consumer();e.file=this.outputFile(),this.map=Jt.fromSourceMap(e,{ignoreInvalidMapping:!0})}else this.map=new Jt({file:this.outputFile(),ignoreInvalidMapping:!0}),this.map.addMapping({generated:{column:0,line:1},original:{column:0,line:1},source:this.opts.from?this.toUrl(this.path(this.opts.from)):"<no source>"});return this.isSourcesContent()&&this.setSourcesContent(),this.root&&this.previous().length>0&&this.applyPrevMaps(),this.isAnnotation()&&this.addAnnotation(),this.isInline()?[this.css]:[this.css,this.map]}generateString(){this.css="",this.map=new Jt({file:this.outputFile(),ignoreInvalidMapping:!0});let e=1,t=1,r="<no source>",i={generated:{column:0,line:0},original:{column:0,line:0},source:""},n,o;this.stringify(this.root,(l,a,u)=>{if(this.css+=l,a&&u!=="end"&&(i.generated.line=e,i.generated.column=t-1,a.source&&a.source.start?(i.source=this.sourcePath(a),i.original.line=a.source.start.line,i.original.column=a.source.start.column-1,this.map.addMapping(i)):(i.source=r,i.original.line=1,i.original.column=0,this.map.addMapping(i))),n=l.match(/\n/g),n?(e+=n.length,o=l.lastIndexOf(`-`),t=l.length-o):t+=l.length,a&&u!=="start"){let c=a.parent||{raws:{}};(!(a.type==="decl"||a.type==="atrule"&&!a.nodes)||a!==c.last||c.raws.semicolon)&&(a.source&&a.source.end?(i.source=this.sourcePath(a),i.original.line=a.source.end.line,i.original.column=a.source.end.column-1,i.generated.line=e,i.generated.column=t-2,this.map.addMapping(i)):(i.source=r,i.original.line=1,i.original.column=0,i.generated.line=e,i.generated.column=t-1,this.map.addMapping(i)))}})}isAnnotation(){return this.isInline()?!0:typeof this.mapOpts.annotation<"u"?this.mapOpts.annotation:this.previous().length?this.previous().some(e=>e.annotation):!0}isInline(){if(typeof this.mapOpts.inline<"u")return this.mapOpts.inline;let e=this.mapOpts.annotation;return typeof e<"u"&&e!==!0?!1:this.previous().length?this.previous().some(t=>t.inline):!0}isMap(){return typeof this.opts.map<"u"?!!this.opts.map:this.previous().length>0}isSourcesContent(){return typeof this.mapOpts.sourcesContent<"u"?this.mapOpts.sourcesContent:this.previous().length?this.previous().some(e=>e.withContent()):!0}outputFile(){return this.opts.to?this.path(this.opts.to):this.opts.from?this.path(this.opts.from):"to.css"}path(e){if(this.mapOpts.absolute||e.charCodeAt(0)===60||/^\w+:\/\//.test(e))return e;let t=this.memoizedPaths.get(e);if(t)return t;let r=this.opts.to?Kt(this.opts.to):".";typeof this.mapOpts.annotation=="string"&&(r=Kt(bn(r,this.mapOpts.annotation)));let i=wn(r,e);return this.memoizedPaths.set(e,i),i}previous(){if(!this.previousMaps)if(this.previousMaps=[],this.root)this.root.walk(e=>{if(e.source&&e.source.input.map){let t=e.source.input.map;this.previousMaps.includes(t)||this.previousMaps.push(t)}});else{let e=new qu(this.originalCSS,this.opts);e.map&&this.previousMaps.push(e.map)}return this.previousMaps}setSourcesContent(){let e={};if(this.root)this.root.walk(t=>{if(t.source){let r=t.source.input.from;if(r&&!e[r]){e[r]=!0;let i=this.usesFileUrls?this.toFileUrl(r):this.toUrl(this.path(r));this.map.setSourceContent(i,t.source.input.css)}}});else if(this.css){let t=this.opts.from?this.toUrl(this.path(this.opts.from)):"<no source>";this.map.setSourceContent(t,this.css)}}sourcePath(e){return this.mapOpts.from?this.toUrl(this.mapOpts.from):this.usesFileUrls?this.toFileUrl(e.source.input.from):this.toUrl(this.path(e.source.input.from))}toBase64(e){return Buffer?Buffer.from(e).toString("base64"):window.btoa(unescape(encodeURIComponent(e)))}toFileUrl(e){let t=this.memoizedFileURLs.get(e);if(t)return t;if(Cn){let r=Cn(e).toString();return this.memoizedFileURLs.set(e,r),r}else throw new Error("`map.absolute` option is not available in this PostCSS build")}toUrl(e){let t=this.memoizedURLs.get(e);if(t)return t;Sn==="\\"&&(e=e.replace(/\\/g,"/"));let r=encodeURI(e).replace(/[#?]/g,encodeURIComponent);return this.memoizedURLs.set(e,r),r}};let rc=Vt,gs=class extends rc{constructor(e){super(e),this.type="comment"}};var Xt=gs;gs.default=gs;let{isClean:In,my:xn}=st,On=jt,Rn=Xt,sc=Vt,En,ys,ws,An;function Mn(s){return s.map(e=>(e.nodes&&(e.nodes=Mn(e.nodes)),delete e.source,e))}function $n(s){if(s[In]=!1,s.proxyOf.nodes)for(let e of s.proxyOf.nodes)$n(e)}let be=class Zo extends sc{append(...e){for(let t of e){let r=this.normalize(t,this.last);for(let i of r)this.proxyOf.nodes.push(i)}return this.markDirty(),this}cleanRaws(e){if(super.cleanRaws(e),this.nodes)for(let t of this.nodes)t.cleanRaws(e)}each(e){if(!this.proxyOf.nodes)return;let t=this.getIterator(),r,i;for(;this.indexes[t]<this.proxyOf.nodes.length&&(r=this.indexes[t],i=e(this.proxyOf.nodes[r],r),i!==!1);)this.indexes[t]+=1;return delete this.indexes[t],i}every(e){return this.nodes.every(e)}getIterator(){this.lastEach||(this.lastEach=0),this.indexes||(this.indexes={}),this.lastEach+=1;let e=this.lastEach;return this.indexes[e]=0,e}getProxyProcessor(){return{get(e,t){return t==="proxyOf"?e:e[t]?t==="each"||typeof t=="string"&&t.startsWith("walk")?(...r)=>e[t](...r.map(i=>typeof i=="function"?(n,o)=>i(n.toProxy(),o):i)):t==="every"||t==="some"?r=>e[t]((i,...n)=>r(i.toProxy(),...n)):t==="root"?()=>e.root().toProxy():t==="nodes"?e.nodes.map(r=>r.toProxy()):t==="first"||t==="last"?e[t].toProxy():e[t]:e[t]},set(e,t,r){return e[t]===r||(e[t]=r,(t==="name"||t==="params"||t==="selector")&&e.markDirty()),!0}}}index(e){return typeof e=="number"?e:(e.proxyOf&&(e=e.proxyOf),this.proxyOf.nodes.indexOf(e))}insertAfter(e,t){let r=this.index(e),i=this.normalize(t,this.proxyOf.nodes[r]).reverse();r=this.index(e);for(let o of i)this.proxyOf.nodes.splice(r+1,0,o);let n;for(let o in this.indexes)n=this.indexes[o],r<n&&(this.indexes[o]=n+i.length);return this.markDirty(),this}insertBefore(e,t){let r=this.index(e),i=r===0?"prepend":!1,n=this.normalize(t,this.proxyOf.nodes[r],i).reverse();r=this.index(e);for(let l of n)this.proxyOf.nodes.splice(r,0,l);let o;for(let l in this.indexes)o=this.indexes[l],r<=o&&(this.indexes[l]=o+n.length);return this.markDirty(),this}normalize(e,t){if(typeof e=="string")e=Mn(En(e).nodes);else if(typeof e>"u")e=[];else if(Array.isArray(e)){e=e.slice(0);for(let i of e)i.parent&&i.parent.removeChild(i,"ignore")}else if(e.type==="root"&&this.type!=="document"){e=e.nodes.slice(0);for(let i of e)i.parent&&i.parent.removeChild(i,"ignore")}else if(e.type)e=[e];else if(e.prop){if(typeof e.value>"u")throw new Error("Value field is missed in node creation");typeof e.value!="string"&&(e.value=String(e.value)),e=[new On(e)]}else if(e.selector)e=[new ys(e)];else if(e.name)e=[new ws(e)];else if(e.text)e=[new Rn(e)];else throw new Error("Unknown node type in node creation");return e.map(i=>(i[xn]||Zo.rebuild(i),i=i.proxyOf,i.parent&&i.parent.removeChild(i),i[In]&&$n(i),typeof i.raws.before>"u"&&t&&typeof t.raws.before<"u"&&(i.raws.before=t.raws.before.replace(/\S/g,"")),i.parent=this.proxyOf,i))}prepend(...e){e=e.reverse();for(let t of e){let r=this.normalize(t,this.first,"prepend").reverse();for(let i of r)this.proxyOf.nodes.unshift(i);for(let i in this.indexes)this.indexes[i]=this.indexes[i]+r.length}return this.markDirty(),this}push(e){return e.parent=this,this.proxyOf.nodes.push(e),this}removeAll(){for(let e of this.proxyOf.nodes)e.parent=void 0;return this.proxyOf.nodes=[],this.markDirty(),this}removeChild(e){e=this.index(e),this.proxyOf.nodes[e].parent=void 0,this.proxyOf.nodes.splice(e,1);let t;for(let r in this.indexes)t=this.indexes[r],t>=e&&(this.indexes[r]=t-1);return this.markDirty(),this}replaceValues(e,t,r){return r||(r=t,t={}),this.walkDecls(i=>{t.props&&!t.props.includes(i.prop)||t.fast&&!i.value.includes(t.fast)||(i.value=i.value.replace(e,r))}),this.markDirty(),this}some(e){return this.nodes.some(e)}walk(e){return this.each((t,r)=>{let i;try{i=e(t,r)}catch(n){throw t.addToError(n)}return i!==!1&&t.walk&&(i=t.walk(e)),i})}walkAtRules(e,t){return t?e instanceof RegExp?this.walk((r,i)=>{if(r.type==="atrule"&&e.test(r.name))return t(r,i)}):this.walk((r,i)=>{if(r.type==="atrule"&&r.name===e)return t(r,i)}):(t=e,this.walk((r,i)=>{if(r.type==="atrule")return t(r,i)}))}walkComments(e){return this.walk((t,r)=>{if(t.type==="comment")return e(t,r)})}walkDecls(e,t){return t?e instanceof RegExp?this.walk((r,i)=>{if(r.type==="decl"&&e.test(r.prop))return t(r,i)}):this.walk((r,i)=>{if(r.type==="decl"&&r.prop===e)return t(r,i)}):(t=e,this.walk((r,i)=>{if(r.type==="decl")return t(r,i)}))}walkRules(e,t){return t?e instanceof RegExp?this.walk((r,i)=>{if(r.type==="rule"&&e.test(r.selector))return t(r,i)}):this.walk((r,i)=>{if(r.type==="rule"&&r.selector===e)return t(r,i)}):(t=e,this.walk((r,i)=>{if(r.type==="rule")return t(r,i)}))}get first(){if(this.proxyOf.nodes)return this.proxyOf.nodes[0]}get last(){if(this.proxyOf.nodes)return this.proxyOf.nodes[this.proxyOf.nodes.length-1]}};be.registerParse=s=>{En=s},be.registerRule=s=>{ys=s},be.registerAtRule=s=>{ws=s},be.registerRoot=s=>{An=s};var Oe=be;be.default=be,be.rebuild=s=>{s.type==="atrule"?Object.setPrototypeOf(s,ws.prototype):s.type==="rule"?Object.setPrototypeOf(s,ys.prototype):s.type==="decl"?Object.setPrototypeOf(s,On.prototype):s.type==="comment"?Object.setPrototypeOf(s,Rn.prototype):s.type==="root"&&Object.setPrototypeOf(s,An.prototype),s[xn]=!0,s.nodes&&s.nodes.forEach(e=>{be.rebuild(e)})};let ic=Oe,Nn,kn,it=class extends ic{constructor(e){super({type:"document",...e}),this.nodes||(this.nodes=[])}toResult(e={}){return new Nn(new kn,this,e).stringify()}};it.registerLazyResult=s=>{Nn=s},it.registerProcessor=s=>{kn=s};var bs=it;it.default=it;let Tn={};var Pn=function(e){Tn[e]||(Tn[e]=!0,typeof console<"u"&&console.warn&&console.warn(e))};let Ss=class{constructor(e,t={}){if(this.type="warning",this.text=e,t.node&&t.node.source){let r=t.node.rangeBy(t);this.line=r.start.line,this.column=r.start.column,this.endLine=r.end.line,this.endColumn=r.end.column}for(let r in t)this[r]=t[r]}toString(){return this.node?this.node.error(this.text,{index:this.index,plugin:this.plugin,word:this.word}).message:this.plugin?this.plugin+": "+this.text:this.text}};var Dn=Ss;Ss.default=Ss;let nc=Dn,Cs=class{constructor(e,t,r){this.processor=e,this.messages=[],this.root=t,this.opts=r,this.css=void 0,this.map=void 0}toString(){return this.css}warn(e,t={}){t.plugin||this.lastPlugin&&this.lastPlugin.postcssPlugin&&(t.plugin=this.lastPlugin.postcssPlugin);let r=new nc(e,t);return this.messages.push(r),r}warnings(){return this.messages.filter(e=>e.type==="warning")}get content(){return this.css}};var vs=Cs;Cs.default=Cs;const Is=39,Ln=34,Qt=92,_n=47,qt=10,nt=32,er=12,tr=9,rr=13,oc=91,ac=93,lc=40,uc=41,cc=123,hc=125,fc=59,dc=42,pc=58,mc=64,sr=/[\t\n\f\r "#'()/;[\\\]{}]/g,ir=/[\t\n\f\r !"#'():;@[\\\]{}]|\/(?=\*)/g,gc=/.[\r\n"'(/\\]/,Fn=/[\da-f]/i;var yc=function(e,t={}){let r=e.css.valueOf(),i=t.ignoreErrors,n,o,l,a,u,c,h,p,m,g,d=r.length,f=0,b=[],S=[];function y(){return f}function C(B){throw e.error("Unclosed "+B,f)}function N(){return S.length===0&&f>=d}function D(B){if(S.length)return S.pop();if(f>=d)return;let V=B?B.ignoreUnclosed:!1;switch(n=r.charCodeAt(f),n){case qt:case nt:case tr:case rr:case er:{o=f;do o+=1,n=r.charCodeAt(o);while(n===nt||n===qt||n===tr||n===rr||n===er);g=["space",r.slice(f,o)],f=o-1;break}case oc:case ac:case cc:case hc:case pc:case fc:case uc:{let Z=String.fromCharCode(n);g=[Z,Z,f];break}case lc:{if(p=b.length?b.pop()[1]:"",m=r.charCodeAt(f+1),p==="url"&&m!==Is&&m!==Ln&&m!==nt&&m!==qt&&m!==tr&&m!==er&&m!==rr){o=f;do{if(c=!1,o=r.indexOf(")",o+1),o===-1)if(i||V){o=f;break}else C("bracket");for(h=o;r.charCodeAt(h-1)===Qt;)h-=1,c=!c}while(c);g=["brackets",r.slice(f,o+1),f,o],f=o}else o=r.indexOf(")",f+1),a=r.slice(f,o+1),o===-1||gc.test(a)?g=["(","(",f]:(g=["brackets",a,f,o],f=o);break}case Is:case Ln:{l=n===Is?"'":'"',o=f;do{if(c=!1,o=r.indexOf(l,o+1),o===-1)if(i||V){o=f+1;break}else C("string");for(h=o;r.charCodeAt(h-1)===Qt;)h-=1,c=!c}while(c);g=["string",r.slice(f,o+1),f,o],f=o;break}case mc:{sr.lastIndex=f+1,sr.test(r),sr.lastIndex===0?o=r.length-1:o=sr.lastIndex-2,g=["at-word",r.slice(f,o+1),f,o],f=o;break}case Qt:{for(o=f,u=!0;r.charCodeAt(o+1)===Qt;)o+=1,u=!u;if(n=r.charCodeAt(o+1),u&&n!==_n&&n!==nt&&n!==qt&&n!==tr&&n!==rr&&n!==er&&(o+=1,Fn.test(r.charAt(o)))){for(;Fn.test(r.charAt(o+1));)o+=1;r.charCodeAt(o+1)===nt&&(o+=1)}g=["word",r.slice(f,o+1),f,o],f=o;break}default:{n===_n&&r.charCodeAt(f+1)===dc?(o=r.indexOf("*/",f+2)+1,o===0&&(i||V?o=r.length:C("comment")),g=["comment",r.slice(f,o+1),f,o],f=o):(ir.lastIndex=f+1,ir.test(r),ir.lastIndex===0?o=r.length-1:o=ir.lastIndex-2,g=["word",r.slice(f,o+1),f,o],b.push(g),f=o);break}}return f++,g}function Y(B){S.push(B)}return{back:Y,endOfFile:N,nextToken:D,position:y}};let Un=Oe,nr=class extends Un{constructor(e){super(e),this.type="atrule"}append(...e){return this.proxyOf.nodes||(this.nodes=[]),super.append(...e)}prepend(...e){return this.proxyOf.nodes||(this.nodes=[]),super.prepend(...e)}};var xs=nr;nr.default=nr,Un.registerAtRule(nr);let Bn=Oe,zn,Wn,Fe=class extends Bn{constructor(e){super(e),this.type="root",this.nodes||(this.nodes=[])}normalize(e,t,r){let i=super.normalize(e);if(t){if(r==="prepend")this.nodes.length>1?t.raws.before=this.nodes[1].raws.before:delete t.raws.before;else if(this.first!==t)for(let n of i)n.raws.before=t.raws.before}return i}removeChild(e,t){let r=this.index(e);return!t&&r===0&&this.nodes.length>1&&(this.nodes[1].raws.before=this.nodes[r].raws.before),super.removeChild(e)}toResult(e={}){return new zn(new Wn,this,e).stringify()}};Fe.registerLazyResult=s=>{zn=s},Fe.registerProcessor=s=>{Wn=s};var ot=Fe;Fe.default=Fe,Bn.registerRoot(Fe);let at={comma(s){return at.split(s,[","],!0)},space(s){let e=[" ",`-`," "];return at.split(s,e)},split(s,e,t){let r=[],i="",n=!1,o=0,l=!1,a="",u=!1;for(let c of s)u?u=!1:c==="\\"?u=!0:l?c===a&&(l=!1):c==='"'||c==="'"?(l=!0,a=c):c==="("?o+=1:c===")"?o>0&&(o-=1):o===0&&e.includes(c)&&(n=!0),n?(i!==""&&r.push(i.trim()),i="",n=!1):i+=c;return(t||i!=="")&&r.push(i.trim()),r}};var Gn=at;at.default=at;let Vn=Oe,wc=Gn,or=class extends Vn{constructor(e){super(e),this.type="rule",this.nodes||(this.nodes=[])}get selectors(){return wc.comma(this.selector)}set selectors(e){let t=this.selector?this.selector.match(/,\s*/):null,r=t?t[0]:","+this.raw("between","beforeOpen");this.selector=e.join(r)}};var Os=or;or.default=or,Vn.registerRule(or);let bc=jt,Sc=yc,Cc=Xt,vc=xs,Ic=ot,jn=Os;const Yn={empty:!0,space:!0};function xc(s){for(let e=s.length-1;e>=0;e--){let t=s[e],r=t[3]||t[2];if(r)return r}}var Oc=class{constructor(e){this.input=e,this.root=new Ic,this.current=this.root,this.spaces="",this.semicolon=!1,this.createTokenizer(),this.root.source={input:e,start:{column:1,line:1,offset:0}}}atrule(e){let t=new vc;t.name=e[1].slice(1),t.name===""&&this.unnamedAtrule(t,e),this.init(t,e[2]);let r,i,n,o=!1,l=!1,a=[],u=[];for(;!this.tokenizer.endOfFile();){if(e=this.tokenizer.nextToken(),r=e[0],r==="("||r==="["?u.push(r==="("?")":"]"):r==="{"&&u.length>0?u.push("}"):r===u[u.length-1]&&u.pop(),u.length===0)if(r===";"){t.source.end=this.getPosition(e[2]),t.source.end.offset++,this.semicolon=!0;break}else if(r==="{"){l=!0;break}else if(r==="}"){if(a.length>0){for(n=a.length-1,i=a[n];i&&i[0]==="space";)i=a[--n];i&&(t.source.end=this.getPosition(i[3]||i[2]),t.source.end.offset++)}this.end(e);break}else a.push(e);else a.push(e);if(this.tokenizer.endOfFile()){o=!0;break}}t.raws.between=this.spacesAndCommentsFromEnd(a),a.length?(t.raws.afterName=this.spacesAndCommentsFromStart(a),this.raw(t,"params",a),o&&(e=a[a.length-1],t.source.end=this.getPosition(e[3]||e[2]),t.source.end.offset++,this.spaces=t.raws.between,t.raws.between="")):(t.raws.afterName="",t.params=""),l&&(t.nodes=[],this.current=t)}checkMissedSemicolon(e){let t=this.colon(e);if(t===!1)return;let r=0,i;for(let n=t-1;n>=0&&(i=e[n],!(i[0]!=="space"&&(r+=1,r===2)));n--);throw this.input.error("Missed semicolon",i[0]==="word"?i[3]+1:i[2])}colon(e){let t=0,r,i,n;for(let[o,l]of e.entries()){if(r=l,i=r[0],i==="("&&(t+=1),i===")"&&(t-=1),t===0&&i===":")if(!n)this.doubleColon(r);else{if(n[0]==="word"&&n[1]==="progid")continue;return o}n=r}return!1}comment(e){let t=new Cc;this.init(t,e[2]),t.source.end=this.getPosition(e[3]||e[2]),t.source.end.offset++;let r=e[1].slice(2,-2);if(/^\s*$/.test(r))t.text="",t.raws.left=r,t.raws.right="";else{let i=r.match(/^(\s*)([^]*\S)(\s*)$/);t.text=i[2],t.raws.left=i[1],t.raws.right=i[3]}}createTokenizer(){this.tokenizer=Sc(this.input)}decl(e,t){let r=new bc;this.init(r,e[0][2]);let i=e[e.length-1];for(i[0]===";"&&(this.semicolon=!0,e.pop()),r.source.end=this.getPosition(i[3]||i[2]||xc(e)),r.source.end.offset++;e[0][0]!=="word";)e.length===1&&this.unknownWord(e),r.raws.before+=e.shift()[1];for(r.source.start=this.getPosition(e[0][2]),r.prop="";e.length;){let u=e[0][0];if(u===":"||u==="space"||u==="comment")break;r.prop+=e.shift()[1]}r.raws.between="";let n;for(;e.length;)if(n=e.shift(),n[0]===":"){r.raws.between+=n[1];break}else n[0]==="word"&&/\w/.test(n[1])&&this.unknownWord([n]),r.raws.between+=n[1];(r.prop[0]==="_"||r.prop[0]==="*")&&(r.raws.before+=r.prop[0],r.prop=r.prop.slice(1));let o=[],l;for(;e.length&&(l=e[0][0],!(l!=="space"&&l!=="comment"));)o.push(e.shift());this.precheckMissedSemicolon(e);for(let u=e.length-1;u>=0;u--){if(n=e[u],n[1].toLowerCase()==="!important"){r.important=!0;let c=this.stringFrom(e,u);c=this.spacesFromEnd(e)+c,c!==" !important"&&(r.raws.important=c);break}else if(n[1].toLowerCase()==="important"){let c=e.slice(0),h="";for(let p=u;p>0;p--){let m=c[p][0];if(h.trim().indexOf("!")===0&&m!=="space")break;h=c.pop()[1]+h}h.trim().indexOf("!")===0&&(r.important=!0,r.raws.important=h,e=c)}if(n[0]!=="space"&&n[0]!=="comment")break}e.some(u=>u[0]!=="space"&&u[0]!=="comment")&&(r.raws.between+=o.map(u=>u[1]).join(""),o=[]),this.raw(r,"value",o.concat(e),t),r.value.includes(":")&&!t&&this.checkMissedSemicolon(e)}doubleColon(e){throw this.input.error("Double colon",{offset:e[2]},{offset:e[2]+e[1].length})}emptyRule(e){let t=new jn;this.init(t,e[2]),t.selector="",t.raws.between="",this.current=t}end(e){this.current.nodes&&this.current.nodes.length&&(this.current.raws.semicolon=this.semicolon),this.semicolon=!1,this.current.raws.after=(this.current.raws.after||"")+this.spaces,this.spaces="",this.current.parent?(this.current.source.end=this.getPosition(e[2]),this.current.source.end.offset++,this.current=this.current.parent):this.unexpectedClose(e)}endFile(){this.current.parent&&this.unclosedBlock(),this.current.nodes&&this.current.nodes.length&&(this.current.raws.semicolon=this.semicolon),this.current.raws.after=(this.current.raws.after||"")+this.spaces,this.root.source.end=this.getPosition(this.tokenizer.position())}freeSemicolon(e){if(this.spaces+=e[1],this.current.nodes){let t=this.current.nodes[this.current.nodes.length-1];t&&t.type==="rule"&&!t.raws.ownSemicolon&&(t.raws.ownSemicolon=this.spaces,this.spaces="")}}getPosition(e){let t=this.input.fromOffset(e);return{column:t.col,line:t.line,offset:e}}init(e,t){this.current.push(e),e.source={input:this.input,start:this.getPosition(t)},e.raws.before=this.spaces,this.spaces="",e.type!=="comment"&&(this.semicolon=!1)}other(e){let t=!1,r=null,i=!1,n=null,o=[],l=e[1].startsWith("--"),a=[],u=e;for(;u;){if(r=u[0],a.push(u),r==="("||r==="[")n||(n=u),o.push(r==="("?")":"]");else if(l&&i&&r==="{")n||(n=u),o.push("}");else if(o.length===0)if(r===";")if(i){this.decl(a,l);return}else break;else if(r==="{"){this.rule(a);return}else if(r==="}"){this.tokenizer.back(a.pop()),t=!0;break}else r===":"&&(i=!0);else r===o[o.length-1]&&(o.pop(),o.length===0&&(n=null));u=this.tokenizer.nextToken()}if(this.tokenizer.endOfFile()&&(t=!0),o.length>0&&this.unclosedBracket(n),t&&i){if(!l)for(;a.length&&(u=a[a.length-1][0],!(u!=="space"&&u!=="comment"));)this.tokenizer.back(a.pop());this.decl(a,l)}else this.unknownWord(a)}parse(){let e;for(;!this.tokenizer.endOfFile();)switch(e=this.tokenizer.nextToken(),e[0]){case"space":this.spaces+=e[1];break;case";":this.freeSemicolon(e);break;case"}":this.end(e);break;case"comment":this.comment(e);break;case"at-word":this.atrule(e);break;case"{":this.emptyRule(e);break;default:this.other(e);break}this.endFile()}precheckMissedSemicolon(){}raw(e,t,r,i){let n,o,l=r.length,a="",u=!0,c,h;for(let p=0;p<l;p+=1)n=r[p],o=n[0],o==="space"&&p===l-1&&!i?u=!1:o==="comment"?(h=r[p-1]?r[p-1][0]:"empty",c=r[p+1]?r[p+1][0]:"empty",!Yn[h]&&!Yn[c]?a.slice(-1)===","?u=!1:a+=n[1]:u=!1):a+=n[1];if(!u){let p=r.reduce((m,g)=>m+g[1],"");e.raws[t]={raw:p,value:a}}e[t]=a}rule(e){e.pop();let t=new jn;this.init(t,e[0][2]),t.raws.between=this.spacesAndCommentsFromEnd(e),this.raw(t,"selector",e),this.current=t}spacesAndCommentsFromEnd(e){let t,r="";for(;e.length&&(t=e[e.length-1][0],!(t!=="space"&&t!=="comment"));)r=e.pop()[1]+r;return r}spacesAndCommentsFromStart(e){let t,r="";for(;e.length&&(t=e[0][0],!(t!=="space"&&t!=="comment"));)r+=e.shift()[1];return r}spacesFromEnd(e){let t,r="";for(;e.length&&(t=e[e.length-1][0],t==="space");)r=e.pop()[1]+r;return r}stringFrom(e,t){let r="";for(let i=t;i<e.length;i++)r+=e[i][1];return e.splice(t,e.length-t),r}unclosedBlock(){let e=this.current.source.start;throw this.input.error("Unclosed block",e.line,e.column)}unclosedBracket(e){throw this.input.error("Unclosed bracket",{offset:e[2]},{offset:e[2]+1})}unexpectedClose(e){throw this.input.error("Unexpected }",{offset:e[2]},{offset:e[2]+1})}unknownWord(e){throw this.input.error("Unknown word",{offset:e[0][2]},{offset:e[0][2]+e[0][1].length})}unnamedAtrule(e,t){throw this.input.error("At-rule without name",{offset:t[2]},{offset:t[2]+t[1].length})}};let Rc=Oe,Ec=Oc,Ac=Zt;function ar(s,e){let t=new Ac(s,e),r=new Ec(t);try{r.parse()}catch(i){throw process.env.NODE_ENV!=="production"&&i.name==="CssSyntaxError"&&e&&e.from&&(/\.scss$/i.test(e.from)?i.message+=`+`),this.css+=t+"/*# sourceMappingURL="+e+" */"}applyPrevMaps(){for(let e of this.previous()){let t=this.toUrl(this.path(e.file)),r=e.root||Kt(e.file),i;this.mapOpts.sourcesContent===!1?(i=new yn(e.text),i.sourcesContent&&(i.sourcesContent=null)):i=e.consumer(),this.map.applySourceMap(i,t,this.toUrl(this.path(r)))}}clearAnnotation(){if(this.mapOpts.annotation!==!1)if(this.root){let e;for(let t=this.root.nodes.length-1;t>=0;t--)e=this.root.nodes[t],e.type==="comment"&&e.text.indexOf("# sourceMappingURL=")===0&&this.root.removeChild(t)}else this.css&&(this.css=this.css.replace(/\n*?\/\*#[\S\s]*?\*\/$/gm,""))}generate(){if(this.clearAnnotation(),rc&&tc&&this.isMap())return this.generateMap();{let e="";return this.stringify(this.root,t=>{e+=t}),[e]}}generateMap(){if(this.root)this.generateString();else if(this.previous().length===1){let e=this.previous()[0].consumer();e.file=this.outputFile(),this.map=Jt.fromSourceMap(e,{ignoreInvalidMapping:!0})}else this.map=new Jt({file:this.outputFile(),ignoreInvalidMapping:!0}),this.map.addMapping({generated:{column:0,line:1},original:{column:0,line:1},source:this.opts.from?this.toUrl(this.path(this.opts.from)):"<no source>"});return this.isSourcesContent()&&this.setSourcesContent(),this.root&&this.previous().length>0&&this.applyPrevMaps(),this.isAnnotation()&&this.addAnnotation(),this.isInline()?[this.css]:[this.css,this.map]}generateString(){this.css="",this.map=new Jt({file:this.outputFile(),ignoreInvalidMapping:!0});let e=1,t=1,r="<no source>",i={generated:{column:0,line:0},original:{column:0,line:0},source:""},n,o;this.stringify(this.root,(l,a,u)=>{if(this.css+=l,a&&u!=="end"&&(i.generated.line=e,i.generated.column=t-1,a.source&&a.source.start?(i.source=this.sourcePath(a),i.original.line=a.source.start.line,i.original.column=a.source.start.column-1,this.map.addMapping(i)):(i.source=r,i.original.line=1,i.original.column=0,this.map.addMapping(i))),n=l.match(/\n/g),n?(e+=n.length,o=l.lastIndexOf(`+`),t=l.length-o):t+=l.length,a&&u!=="start"){let c=a.parent||{raws:{}};(!(a.type==="decl"||a.type==="atrule"&&!a.nodes)||a!==c.last||c.raws.semicolon)&&(a.source&&a.source.end?(i.source=this.sourcePath(a),i.original.line=a.source.end.line,i.original.column=a.source.end.column-1,i.generated.line=e,i.generated.column=t-2,this.map.addMapping(i)):(i.source=r,i.original.line=1,i.original.column=0,i.generated.line=e,i.generated.column=t-1,this.map.addMapping(i)))}})}isAnnotation(){return this.isInline()?!0:typeof this.mapOpts.annotation<"u"?this.mapOpts.annotation:this.previous().length?this.previous().some(e=>e.annotation):!0}isInline(){if(typeof this.mapOpts.inline<"u")return this.mapOpts.inline;let e=this.mapOpts.annotation;return typeof e<"u"&&e!==!0?!1:this.previous().length?this.previous().some(t=>t.inline):!0}isMap(){return typeof this.opts.map<"u"?!!this.opts.map:this.previous().length>0}isSourcesContent(){return typeof this.mapOpts.sourcesContent<"u"?this.mapOpts.sourcesContent:this.previous().length?this.previous().some(e=>e.withContent()):!0}outputFile(){return this.opts.to?this.path(this.opts.to):this.opts.from?this.path(this.opts.from):"to.css"}path(e){if(this.mapOpts.absolute||e.charCodeAt(0)===60||/^\w+:\/\//.test(e))return e;let t=this.memoizedPaths.get(e);if(t)return t;let r=this.opts.to?Kt(this.opts.to):".";typeof this.mapOpts.annotation=="string"&&(r=Kt(Sn(r,this.mapOpts.annotation)));let i=wn(r,e);return this.memoizedPaths.set(e,i),i}previous(){if(!this.previousMaps)if(this.previousMaps=[],this.root)this.root.walk(e=>{if(e.source&&e.source.input.map){let t=e.source.input.map;this.previousMaps.includes(t)||this.previousMaps.push(t)}});else{let e=new ec(this.originalCSS,this.opts);e.map&&this.previousMaps.push(e.map)}return this.previousMaps}setSourcesContent(){let e={};if(this.root)this.root.walk(t=>{if(t.source){let r=t.source.input.from;if(r&&!e[r]){e[r]=!0;let i=this.usesFileUrls?this.toFileUrl(r):this.toUrl(this.path(r));this.map.setSourceContent(i,t.source.input.css)}}});else if(this.css){let t=this.opts.from?this.toUrl(this.path(this.opts.from)):"<no source>";this.map.setSourceContent(t,this.css)}}sourcePath(e){return this.mapOpts.from?this.toUrl(this.mapOpts.from):this.usesFileUrls?this.toFileUrl(e.source.input.from):this.toUrl(this.path(e.source.input.from))}toBase64(e){return Buffer?Buffer.from(e).toString("base64"):window.btoa(unescape(encodeURIComponent(e)))}toFileUrl(e){let t=this.memoizedFileURLs.get(e);if(t)return t;if(vn){let r=vn(e).toString();return this.memoizedFileURLs.set(e,r),r}else throw new Error("`map.absolute` option is not available in this PostCSS build")}toUrl(e){let t=this.memoizedURLs.get(e);if(t)return t;bn==="\\"&&(e=e.replace(/\\/g,"/"));let r=encodeURI(e).replace(/[#?]/g,encodeURIComponent);return this.memoizedURLs.set(e,r),r}};let sc=Vt,gs=class extends sc{constructor(e){super(e),this.type="comment"}};var Xt=gs;gs.default=gs;let{isClean:In,my:xn}=st,An=jt,Rn=Xt,ic=Vt,On,ys,ws,En;function Mn(s){return s.map(e=>(e.nodes&&(e.nodes=Mn(e.nodes)),delete e.source,e))}function $n(s){if(s[In]=!1,s.proxyOf.nodes)for(let e of s.proxyOf.nodes)$n(e)}let Se=class Jo extends ic{append(...e){for(let t of e){let r=this.normalize(t,this.last);for(let i of r)this.proxyOf.nodes.push(i)}return this.markDirty(),this}cleanRaws(e){if(super.cleanRaws(e),this.nodes)for(let t of this.nodes)t.cleanRaws(e)}each(e){if(!this.proxyOf.nodes)return;let t=this.getIterator(),r,i;for(;this.indexes[t]<this.proxyOf.nodes.length&&(r=this.indexes[t],i=e(this.proxyOf.nodes[r],r),i!==!1);)this.indexes[t]+=1;return delete this.indexes[t],i}every(e){return this.nodes.every(e)}getIterator(){this.lastEach||(this.lastEach=0),this.indexes||(this.indexes={}),this.lastEach+=1;let e=this.lastEach;return this.indexes[e]=0,e}getProxyProcessor(){return{get(e,t){return t==="proxyOf"?e:e[t]?t==="each"||typeof t=="string"&&t.startsWith("walk")?(...r)=>e[t](...r.map(i=>typeof i=="function"?(n,o)=>i(n.toProxy(),o):i)):t==="every"||t==="some"?r=>e[t]((i,...n)=>r(i.toProxy(),...n)):t==="root"?()=>e.root().toProxy():t==="nodes"?e.nodes.map(r=>r.toProxy()):t==="first"||t==="last"?e[t].toProxy():e[t]:e[t]},set(e,t,r){return e[t]===r||(e[t]=r,(t==="name"||t==="params"||t==="selector")&&e.markDirty()),!0}}}index(e){return typeof e=="number"?e:(e.proxyOf&&(e=e.proxyOf),this.proxyOf.nodes.indexOf(e))}insertAfter(e,t){let r=this.index(e),i=this.normalize(t,this.proxyOf.nodes[r]).reverse();r=this.index(e);for(let o of i)this.proxyOf.nodes.splice(r+1,0,o);let n;for(let o in this.indexes)n=this.indexes[o],r<n&&(this.indexes[o]=n+i.length);return this.markDirty(),this}insertBefore(e,t){let r=this.index(e),i=r===0?"prepend":!1,n=this.normalize(t,this.proxyOf.nodes[r],i).reverse();r=this.index(e);for(let l of n)this.proxyOf.nodes.splice(r,0,l);let o;for(let l in this.indexes)o=this.indexes[l],r<=o&&(this.indexes[l]=o+n.length);return this.markDirty(),this}normalize(e,t){if(typeof e=="string")e=Mn(On(e).nodes);else if(typeof e>"u")e=[];else if(Array.isArray(e)){e=e.slice(0);for(let i of e)i.parent&&i.parent.removeChild(i,"ignore")}else if(e.type==="root"&&this.type!=="document"){e=e.nodes.slice(0);for(let i of e)i.parent&&i.parent.removeChild(i,"ignore")}else if(e.type)e=[e];else if(e.prop){if(typeof e.value>"u")throw new Error("Value field is missed in node creation");typeof e.value!="string"&&(e.value=String(e.value)),e=[new An(e)]}else if(e.selector)e=[new ys(e)];else if(e.name)e=[new ws(e)];else if(e.text)e=[new Rn(e)];else throw new Error("Unknown node type in node creation");return e.map(i=>(i[xn]||Jo.rebuild(i),i=i.proxyOf,i.parent&&i.parent.removeChild(i),i[In]&&$n(i),typeof i.raws.before>"u"&&t&&typeof t.raws.before<"u"&&(i.raws.before=t.raws.before.replace(/\S/g,"")),i.parent=this.proxyOf,i))}prepend(...e){e=e.reverse();for(let t of e){let r=this.normalize(t,this.first,"prepend").reverse();for(let i of r)this.proxyOf.nodes.unshift(i);for(let i in this.indexes)this.indexes[i]=this.indexes[i]+r.length}return this.markDirty(),this}push(e){return e.parent=this,this.proxyOf.nodes.push(e),this}removeAll(){for(let e of this.proxyOf.nodes)e.parent=void 0;return this.proxyOf.nodes=[],this.markDirty(),this}removeChild(e){e=this.index(e),this.proxyOf.nodes[e].parent=void 0,this.proxyOf.nodes.splice(e,1);let t;for(let r in this.indexes)t=this.indexes[r],t>=e&&(this.indexes[r]=t-1);return this.markDirty(),this}replaceValues(e,t,r){return r||(r=t,t={}),this.walkDecls(i=>{t.props&&!t.props.includes(i.prop)||t.fast&&!i.value.includes(t.fast)||(i.value=i.value.replace(e,r))}),this.markDirty(),this}some(e){return this.nodes.some(e)}walk(e){return this.each((t,r)=>{let i;try{i=e(t,r)}catch(n){throw t.addToError(n)}return i!==!1&&t.walk&&(i=t.walk(e)),i})}walkAtRules(e,t){return t?e instanceof RegExp?this.walk((r,i)=>{if(r.type==="atrule"&&e.test(r.name))return t(r,i)}):this.walk((r,i)=>{if(r.type==="atrule"&&r.name===e)return t(r,i)}):(t=e,this.walk((r,i)=>{if(r.type==="atrule")return t(r,i)}))}walkComments(e){return this.walk((t,r)=>{if(t.type==="comment")return e(t,r)})}walkDecls(e,t){return t?e instanceof RegExp?this.walk((r,i)=>{if(r.type==="decl"&&e.test(r.prop))return t(r,i)}):this.walk((r,i)=>{if(r.type==="decl"&&r.prop===e)return t(r,i)}):(t=e,this.walk((r,i)=>{if(r.type==="decl")return t(r,i)}))}walkRules(e,t){return t?e instanceof RegExp?this.walk((r,i)=>{if(r.type==="rule"&&e.test(r.selector))return t(r,i)}):this.walk((r,i)=>{if(r.type==="rule"&&r.selector===e)return t(r,i)}):(t=e,this.walk((r,i)=>{if(r.type==="rule")return t(r,i)}))}get first(){if(this.proxyOf.nodes)return this.proxyOf.nodes[0]}get last(){if(this.proxyOf.nodes)return this.proxyOf.nodes[this.proxyOf.nodes.length-1]}};Se.registerParse=s=>{On=s},Se.registerRule=s=>{ys=s},Se.registerAtRule=s=>{ws=s},Se.registerRoot=s=>{En=s};var Ae=Se;Se.default=Se,Se.rebuild=s=>{s.type==="atrule"?Object.setPrototypeOf(s,ws.prototype):s.type==="rule"?Object.setPrototypeOf(s,ys.prototype):s.type==="decl"?Object.setPrototypeOf(s,An.prototype):s.type==="comment"?Object.setPrototypeOf(s,Rn.prototype):s.type==="root"&&Object.setPrototypeOf(s,En.prototype),s[xn]=!0,s.nodes&&s.nodes.forEach(e=>{Se.rebuild(e)})};let nc=Ae,Nn,kn,it=class extends nc{constructor(e){super({type:"document",...e}),this.nodes||(this.nodes=[])}toResult(e={}){return new Nn(new kn,this,e).stringify()}};it.registerLazyResult=s=>{Nn=s},it.registerProcessor=s=>{kn=s};var Ss=it;it.default=it;let Tn={};var Pn=function(e){Tn[e]||(Tn[e]=!0,typeof console<"u"&&console.warn&&console.warn(e))};let bs=class{constructor(e,t={}){if(this.type="warning",this.text=e,t.node&&t.node.source){let r=t.node.rangeBy(t);this.line=r.start.line,this.column=r.start.column,this.endLine=r.end.line,this.endColumn=r.end.column}for(let r in t)this[r]=t[r]}toString(){return this.node?this.node.error(this.text,{index:this.index,plugin:this.plugin,word:this.word}).message:this.plugin?this.plugin+": "+this.text:this.text}};var Dn=bs;bs.default=bs;let oc=Dn,vs=class{constructor(e,t,r){this.processor=e,this.messages=[],this.root=t,this.opts=r,this.css=void 0,this.map=void 0}toString(){return this.css}warn(e,t={}){t.plugin||this.lastPlugin&&this.lastPlugin.postcssPlugin&&(t.plugin=this.lastPlugin.postcssPlugin);let r=new oc(e,t);return this.messages.push(r),r}warnings(){return this.messages.filter(e=>e.type==="warning")}get content(){return this.css}};var Cs=vs;vs.default=vs;const Is=39,Ln=34,Qt=92,_n=47,qt=10,nt=32,er=12,tr=9,rr=13,ac=91,lc=93,uc=40,cc=41,hc=123,fc=125,dc=59,pc=42,mc=58,gc=64,sr=/[\t\n\f\r "#'()/;[\\\]{}]/g,ir=/[\t\n\f\r !"#'():;@[\\\]{}]|\/(?=\*)/g,yc=/.[\r\n"'(/\\]/,Fn=/[\da-f]/i;var wc=function(e,t={}){let r=e.css.valueOf(),i=t.ignoreErrors,n,o,l,a,u,c,h,p,m,g,d=r.length,f=0,S=[],b=[];function y(){return f}function C(B){throw e.error("Unclosed "+B,f)}function k(){return b.length===0&&f>=d}function D(B){if(b.length)return b.pop();if(f>=d)return;let V=B?B.ignoreUnclosed:!1;switch(n=r.charCodeAt(f),n){case qt:case nt:case tr:case rr:case er:{o=f;do o+=1,n=r.charCodeAt(o);while(n===nt||n===qt||n===tr||n===rr||n===er);g=["space",r.slice(f,o)],f=o-1;break}case ac:case lc:case hc:case fc:case mc:case dc:case cc:{let Z=String.fromCharCode(n);g=[Z,Z,f];break}case uc:{if(p=S.length?S.pop()[1]:"",m=r.charCodeAt(f+1),p==="url"&&m!==Is&&m!==Ln&&m!==nt&&m!==qt&&m!==tr&&m!==er&&m!==rr){o=f;do{if(c=!1,o=r.indexOf(")",o+1),o===-1)if(i||V){o=f;break}else C("bracket");for(h=o;r.charCodeAt(h-1)===Qt;)h-=1,c=!c}while(c);g=["brackets",r.slice(f,o+1),f,o],f=o}else o=r.indexOf(")",f+1),a=r.slice(f,o+1),o===-1||yc.test(a)?g=["(","(",f]:(g=["brackets",a,f,o],f=o);break}case Is:case Ln:{l=n===Is?"'":'"',o=f;do{if(c=!1,o=r.indexOf(l,o+1),o===-1)if(i||V){o=f+1;break}else C("string");for(h=o;r.charCodeAt(h-1)===Qt;)h-=1,c=!c}while(c);g=["string",r.slice(f,o+1),f,o],f=o;break}case gc:{sr.lastIndex=f+1,sr.test(r),sr.lastIndex===0?o=r.length-1:o=sr.lastIndex-2,g=["at-word",r.slice(f,o+1),f,o],f=o;break}case Qt:{for(o=f,u=!0;r.charCodeAt(o+1)===Qt;)o+=1,u=!u;if(n=r.charCodeAt(o+1),u&&n!==_n&&n!==nt&&n!==qt&&n!==tr&&n!==rr&&n!==er&&(o+=1,Fn.test(r.charAt(o)))){for(;Fn.test(r.charAt(o+1));)o+=1;r.charCodeAt(o+1)===nt&&(o+=1)}g=["word",r.slice(f,o+1),f,o],f=o;break}default:{n===_n&&r.charCodeAt(f+1)===pc?(o=r.indexOf("*/",f+2)+1,o===0&&(i||V?o=r.length:C("comment")),g=["comment",r.slice(f,o+1),f,o],f=o):(ir.lastIndex=f+1,ir.test(r),ir.lastIndex===0?o=r.length-1:o=ir.lastIndex-2,g=["word",r.slice(f,o+1),f,o],S.push(g),f=o);break}}return f++,g}function H(B){b.push(B)}return{back:H,endOfFile:k,nextToken:D,position:y}};let Un=Ae,nr=class extends Un{constructor(e){super(e),this.type="atrule"}append(...e){return this.proxyOf.nodes||(this.nodes=[]),super.append(...e)}prepend(...e){return this.proxyOf.nodes||(this.nodes=[]),super.prepend(...e)}};var xs=nr;nr.default=nr,Un.registerAtRule(nr);let Bn=Ae,zn,Wn,Fe=class extends Bn{constructor(e){super(e),this.type="root",this.nodes||(this.nodes=[])}normalize(e,t,r){let i=super.normalize(e);if(t){if(r==="prepend")this.nodes.length>1?t.raws.before=this.nodes[1].raws.before:delete t.raws.before;else if(this.first!==t)for(let n of i)n.raws.before=t.raws.before}return i}removeChild(e,t){let r=this.index(e);return!t&&r===0&&this.nodes.length>1&&(this.nodes[1].raws.before=this.nodes[r].raws.before),super.removeChild(e)}toResult(e={}){return new zn(new Wn,this,e).stringify()}};Fe.registerLazyResult=s=>{zn=s},Fe.registerProcessor=s=>{Wn=s};var ot=Fe;Fe.default=Fe,Bn.registerRoot(Fe);let at={comma(s){return at.split(s,[","],!0)},space(s){let e=[" ",`+`," "];return at.split(s,e)},split(s,e,t){let r=[],i="",n=!1,o=0,l=!1,a="",u=!1;for(let c of s)u?u=!1:c==="\\"?u=!0:l?c===a&&(l=!1):c==='"'||c==="'"?(l=!0,a=c):c==="("?o+=1:c===")"?o>0&&(o-=1):o===0&&e.includes(c)&&(n=!0),n?(i!==""&&r.push(i.trim()),i="",n=!1):i+=c;return(t||i!=="")&&r.push(i.trim()),r}};var Gn=at;at.default=at;let Vn=Ae,Sc=Gn,or=class extends Vn{constructor(e){super(e),this.type="rule",this.nodes||(this.nodes=[])}get selectors(){return Sc.comma(this.selector)}set selectors(e){let t=this.selector?this.selector.match(/,\s*/):null,r=t?t[0]:","+this.raw("between","beforeOpen");this.selector=e.join(r)}};var As=or;or.default=or,Vn.registerRule(or);let bc=jt,vc=wc,Cc=Xt,Ic=xs,xc=ot,jn=As;const Hn={empty:!0,space:!0};function Ac(s){for(let e=s.length-1;e>=0;e--){let t=s[e],r=t[3]||t[2];if(r)return r}}var Rc=class{constructor(e){this.input=e,this.root=new xc,this.current=this.root,this.spaces="",this.semicolon=!1,this.createTokenizer(),this.root.source={input:e,start:{column:1,line:1,offset:0}}}atrule(e){let t=new Ic;t.name=e[1].slice(1),t.name===""&&this.unnamedAtrule(t,e),this.init(t,e[2]);let r,i,n,o=!1,l=!1,a=[],u=[];for(;!this.tokenizer.endOfFile();){if(e=this.tokenizer.nextToken(),r=e[0],r==="("||r==="["?u.push(r==="("?")":"]"):r==="{"&&u.length>0?u.push("}"):r===u[u.length-1]&&u.pop(),u.length===0)if(r===";"){t.source.end=this.getPosition(e[2]),t.source.end.offset++,this.semicolon=!0;break}else if(r==="{"){l=!0;break}else if(r==="}"){if(a.length>0){for(n=a.length-1,i=a[n];i&&i[0]==="space";)i=a[--n];i&&(t.source.end=this.getPosition(i[3]||i[2]),t.source.end.offset++)}this.end(e);break}else a.push(e);else a.push(e);if(this.tokenizer.endOfFile()){o=!0;break}}t.raws.between=this.spacesAndCommentsFromEnd(a),a.length?(t.raws.afterName=this.spacesAndCommentsFromStart(a),this.raw(t,"params",a),o&&(e=a[a.length-1],t.source.end=this.getPosition(e[3]||e[2]),t.source.end.offset++,this.spaces=t.raws.between,t.raws.between="")):(t.raws.afterName="",t.params=""),l&&(t.nodes=[],this.current=t)}checkMissedSemicolon(e){let t=this.colon(e);if(t===!1)return;let r=0,i;for(let n=t-1;n>=0&&(i=e[n],!(i[0]!=="space"&&(r+=1,r===2)));n--);throw this.input.error("Missed semicolon",i[0]==="word"?i[3]+1:i[2])}colon(e){let t=0,r,i,n;for(let[o,l]of e.entries()){if(r=l,i=r[0],i==="("&&(t+=1),i===")"&&(t-=1),t===0&&i===":")if(!n)this.doubleColon(r);else{if(n[0]==="word"&&n[1]==="progid")continue;return o}n=r}return!1}comment(e){let t=new Cc;this.init(t,e[2]),t.source.end=this.getPosition(e[3]||e[2]),t.source.end.offset++;let r=e[1].slice(2,-2);if(/^\s*$/.test(r))t.text="",t.raws.left=r,t.raws.right="";else{let i=r.match(/^(\s*)([^]*\S)(\s*)$/);t.text=i[2],t.raws.left=i[1],t.raws.right=i[3]}}createTokenizer(){this.tokenizer=vc(this.input)}decl(e,t){let r=new bc;this.init(r,e[0][2]);let i=e[e.length-1];for(i[0]===";"&&(this.semicolon=!0,e.pop()),r.source.end=this.getPosition(i[3]||i[2]||Ac(e)),r.source.end.offset++;e[0][0]!=="word";)e.length===1&&this.unknownWord(e),r.raws.before+=e.shift()[1];for(r.source.start=this.getPosition(e[0][2]),r.prop="";e.length;){let u=e[0][0];if(u===":"||u==="space"||u==="comment")break;r.prop+=e.shift()[1]}r.raws.between="";let n;for(;e.length;)if(n=e.shift(),n[0]===":"){r.raws.between+=n[1];break}else n[0]==="word"&&/\w/.test(n[1])&&this.unknownWord([n]),r.raws.between+=n[1];(r.prop[0]==="_"||r.prop[0]==="*")&&(r.raws.before+=r.prop[0],r.prop=r.prop.slice(1));let o=[],l;for(;e.length&&(l=e[0][0],!(l!=="space"&&l!=="comment"));)o.push(e.shift());this.precheckMissedSemicolon(e);for(let u=e.length-1;u>=0;u--){if(n=e[u],n[1].toLowerCase()==="!important"){r.important=!0;let c=this.stringFrom(e,u);c=this.spacesFromEnd(e)+c,c!==" !important"&&(r.raws.important=c);break}else if(n[1].toLowerCase()==="important"){let c=e.slice(0),h="";for(let p=u;p>0;p--){let m=c[p][0];if(h.trim().indexOf("!")===0&&m!=="space")break;h=c.pop()[1]+h}h.trim().indexOf("!")===0&&(r.important=!0,r.raws.important=h,e=c)}if(n[0]!=="space"&&n[0]!=="comment")break}e.some(u=>u[0]!=="space"&&u[0]!=="comment")&&(r.raws.between+=o.map(u=>u[1]).join(""),o=[]),this.raw(r,"value",o.concat(e),t),r.value.includes(":")&&!t&&this.checkMissedSemicolon(e)}doubleColon(e){throw this.input.error("Double colon",{offset:e[2]},{offset:e[2]+e[1].length})}emptyRule(e){let t=new jn;this.init(t,e[2]),t.selector="",t.raws.between="",this.current=t}end(e){this.current.nodes&&this.current.nodes.length&&(this.current.raws.semicolon=this.semicolon),this.semicolon=!1,this.current.raws.after=(this.current.raws.after||"")+this.spaces,this.spaces="",this.current.parent?(this.current.source.end=this.getPosition(e[2]),this.current.source.end.offset++,this.current=this.current.parent):this.unexpectedClose(e)}endFile(){this.current.parent&&this.unclosedBlock(),this.current.nodes&&this.current.nodes.length&&(this.current.raws.semicolon=this.semicolon),this.current.raws.after=(this.current.raws.after||"")+this.spaces,this.root.source.end=this.getPosition(this.tokenizer.position())}freeSemicolon(e){if(this.spaces+=e[1],this.current.nodes){let t=this.current.nodes[this.current.nodes.length-1];t&&t.type==="rule"&&!t.raws.ownSemicolon&&(t.raws.ownSemicolon=this.spaces,this.spaces="")}}getPosition(e){let t=this.input.fromOffset(e);return{column:t.col,line:t.line,offset:e}}init(e,t){this.current.push(e),e.source={input:this.input,start:this.getPosition(t)},e.raws.before=this.spaces,this.spaces="",e.type!=="comment"&&(this.semicolon=!1)}other(e){let t=!1,r=null,i=!1,n=null,o=[],l=e[1].startsWith("--"),a=[],u=e;for(;u;){if(r=u[0],a.push(u),r==="("||r==="[")n||(n=u),o.push(r==="("?")":"]");else if(l&&i&&r==="{")n||(n=u),o.push("}");else if(o.length===0)if(r===";")if(i){this.decl(a,l);return}else break;else if(r==="{"){this.rule(a);return}else if(r==="}"){this.tokenizer.back(a.pop()),t=!0;break}else r===":"&&(i=!0);else r===o[o.length-1]&&(o.pop(),o.length===0&&(n=null));u=this.tokenizer.nextToken()}if(this.tokenizer.endOfFile()&&(t=!0),o.length>0&&this.unclosedBracket(n),t&&i){if(!l)for(;a.length&&(u=a[a.length-1][0],!(u!=="space"&&u!=="comment"));)this.tokenizer.back(a.pop());this.decl(a,l)}else this.unknownWord(a)}parse(){let e;for(;!this.tokenizer.endOfFile();)switch(e=this.tokenizer.nextToken(),e[0]){case"space":this.spaces+=e[1];break;case";":this.freeSemicolon(e);break;case"}":this.end(e);break;case"comment":this.comment(e);break;case"at-word":this.atrule(e);break;case"{":this.emptyRule(e);break;default:this.other(e);break}this.endFile()}precheckMissedSemicolon(){}raw(e,t,r,i){let n,o,l=r.length,a="",u=!0,c,h;for(let p=0;p<l;p+=1)n=r[p],o=n[0],o==="space"&&p===l-1&&!i?u=!1:o==="comment"?(h=r[p-1]?r[p-1][0]:"empty",c=r[p+1]?r[p+1][0]:"empty",!Hn[h]&&!Hn[c]?a.slice(-1)===","?u=!1:a+=n[1]:u=!1):a+=n[1];if(!u){let p=r.reduce((m,g)=>m+g[1],"");e.raws[t]={raw:p,value:a}}e[t]=a}rule(e){e.pop();let t=new jn;this.init(t,e[0][2]),t.raws.between=this.spacesAndCommentsFromEnd(e),this.raw(t,"selector",e),this.current=t}spacesAndCommentsFromEnd(e){let t,r="";for(;e.length&&(t=e[e.length-1][0],!(t!=="space"&&t!=="comment"));)r=e.pop()[1]+r;return r}spacesAndCommentsFromStart(e){let t,r="";for(;e.length&&(t=e[0][0],!(t!=="space"&&t!=="comment"));)r+=e.shift()[1];return r}spacesFromEnd(e){let t,r="";for(;e.length&&(t=e[e.length-1][0],t==="space");)r=e.pop()[1]+r;return r}stringFrom(e,t){let r="";for(let i=t;i<e.length;i++)r+=e[i][1];return e.splice(t,e.length-t),r}unclosedBlock(){let e=this.current.source.start;throw this.input.error("Unclosed block",e.line,e.column)}unclosedBracket(e){throw this.input.error("Unclosed bracket",{offset:e[2]},{offset:e[2]+1})}unexpectedClose(e){throw this.input.error("Unexpected }",{offset:e[2]},{offset:e[2]+1})}unknownWord(e){throw this.input.error("Unknown word",{offset:e[0][2]},{offset:e[0][2]+e[0][1].length})}unnamedAtrule(e,t){throw this.input.error("At-rule without name",{offset:t[2]},{offset:t[2]+t[1].length})}};let Oc=Ae,Ec=Rc,Mc=Zt;function ar(s,e){let t=new Mc(s,e),r=new Ec(t);try{r.parse()}catch(i){throw process.env.NODE_ENV!=="production"&&i.name==="CssSyntaxError"&&e&&e.from&&(/\.scss$/i.test(e.from)?i.message+=`You tried to parse SCSS with the standard CSS parser; try again with the postcss-scss parser`:/\.sass/i.test(e.from)?i.message+=`You tried to parse Sass with the standard CSS parser; try again with the postcss-sass parser`:/\.less$/i.test(e.from)&&(i.message+=`-You tried to parse Less with the standard CSS parser; try again with the postcss-less parser`)),i}return r.root}var Rs=ar;ar.default=ar,Rc.registerParse(ar);let{isClean:ce,my:Mc}=st,$c=vn,Nc=Wt,kc=Oe,Tc=bs,Pc=Pn,Hn=vs,Dc=Rs,Lc=ot;const _c={atrule:"AtRule",comment:"Comment",decl:"Declaration",document:"Document",root:"Root",rule:"Rule"},Fc={AtRule:!0,AtRuleExit:!0,Comment:!0,CommentExit:!0,Declaration:!0,DeclarationExit:!0,Document:!0,DocumentExit:!0,Once:!0,OnceExit:!0,postcssPlugin:!0,prepare:!0,Root:!0,RootExit:!0,Rule:!0,RuleExit:!0},Uc={Once:!0,postcssPlugin:!0,prepare:!0},Ue=0;function lt(s){return typeof s=="object"&&typeof s.then=="function"}function Zn(s){let e=!1,t=_c[s.type];return s.type==="decl"?e=s.prop.toLowerCase():s.type==="atrule"&&(e=s.name.toLowerCase()),e&&s.append?[t,t+"-"+e,Ue,t+"Exit",t+"Exit-"+e]:e?[t,t+"-"+e,t+"Exit",t+"Exit-"+e]:s.append?[t,Ue,t+"Exit"]:[t,t+"Exit"]}function Jn(s){let e;return s.type==="document"?e=["Document",Ue,"DocumentExit"]:s.type==="root"?e=["Root",Ue,"RootExit"]:e=Zn(s),{eventIndex:0,events:e,iterator:0,node:s,visitorIndex:0,visitors:[]}}function Es(s){return s[ce]=!1,s.nodes&&s.nodes.forEach(e=>Es(e)),s}let As={},Be=class Jo{constructor(e,t,r){this.stringified=!1,this.processed=!1;let i;if(typeof t=="object"&&t!==null&&(t.type==="root"||t.type==="document"))i=Es(t);else if(t instanceof Jo||t instanceof Hn)i=Es(t.root),t.map&&(typeof r.map>"u"&&(r.map={}),r.map.inline||(r.map.inline=!1),r.map.prev=t.map);else{let n=Dc;r.syntax&&(n=r.syntax.parse),r.parser&&(n=r.parser),n.parse&&(n=n.parse);try{i=n(t,r)}catch(o){this.processed=!0,this.error=o}i&&!i[Mc]&&kc.rebuild(i)}this.result=new Hn(e,i,r),this.helpers={...As,postcss:As,result:this.result},this.plugins=this.processor.plugins.map(n=>typeof n=="object"&&n.prepare?{...n,...n.prepare(this.result)}:n)}async(){return this.error?Promise.reject(this.error):this.processed?Promise.resolve(this.result):(this.processing||(this.processing=this.runAsync()),this.processing)}catch(e){return this.async().catch(e)}finally(e){return this.async().then(e,e)}getAsyncError(){throw new Error("Use process(css).then(cb) to work with async plugins")}handleError(e,t){let r=this.result.lastPlugin;try{if(t&&t.addToError(e),this.error=e,e.name==="CssSyntaxError"&&!e.plugin)e.plugin=r.postcssPlugin,e.setMessage();else if(r.postcssVersion&&process.env.NODE_ENV!=="production"){let i=r.postcssPlugin,n=r.postcssVersion,o=this.result.processor.version,l=n.split("."),a=o.split(".");(l[0]!==a[0]||parseInt(l[1])>parseInt(a[1]))&&console.error("Unknown error from PostCSS plugin. Your current PostCSS version is "+o+", but "+i+" uses "+n+". Perhaps this is the source of the error below.")}}catch(i){console&&console.error&&console.error(i)}return e}prepareVisitors(){this.listeners={};let e=(t,r,i)=>{this.listeners[r]||(this.listeners[r]=[]),this.listeners[r].push([t,i])};for(let t of this.plugins)if(typeof t=="object")for(let r in t){if(!Fc[r]&&/^[A-Z]/.test(r))throw new Error(`Unknown event ${r} in ${t.postcssPlugin}. Try to update PostCSS (${this.processor.version} now).`);if(!Uc[r])if(typeof t[r]=="object")for(let i in t[r])i==="*"?e(t,r,t[r][i]):e(t,r+"-"+i.toLowerCase(),t[r][i]);else typeof t[r]=="function"&&e(t,r,t[r])}this.hasListener=Object.keys(this.listeners).length>0}async runAsync(){this.plugin=0;for(let e=0;e<this.plugins.length;e++){let t=this.plugins[e],r=this.runOnRoot(t);if(lt(r))try{await r}catch(i){throw this.handleError(i)}}if(this.prepareVisitors(),this.hasListener){let e=this.result.root;for(;!e[ce];){e[ce]=!0;let t=[Jn(e)];for(;t.length>0;){let r=this.visitTick(t);if(lt(r))try{await r}catch(i){let n=t[t.length-1].node;throw this.handleError(i,n)}}}if(this.listeners.OnceExit)for(let[t,r]of this.listeners.OnceExit){this.result.lastPlugin=t;try{if(e.type==="document"){let i=e.nodes.map(n=>r(n,this.helpers));await Promise.all(i)}else await r(e,this.helpers)}catch(i){throw this.handleError(i)}}}return this.processed=!0,this.stringify()}runOnRoot(e){this.result.lastPlugin=e;try{if(typeof e=="object"&&e.Once){if(this.result.root.type==="document"){let t=this.result.root.nodes.map(r=>e.Once(r,this.helpers));return lt(t[0])?Promise.all(t):t}return e.Once(this.result.root,this.helpers)}else if(typeof e=="function")return e(this.result.root,this.result)}catch(t){throw this.handleError(t)}}stringify(){if(this.error)throw this.error;if(this.stringified)return this.result;this.stringified=!0,this.sync();let e=this.result.opts,t=Nc;e.syntax&&(t=e.syntax.stringify),e.stringifier&&(t=e.stringifier),t.stringify&&(t=t.stringify);let i=new $c(t,this.result.root,this.result.opts).generate();return this.result.css=i[0],this.result.map=i[1],this.result}sync(){if(this.error)throw this.error;if(this.processed)return this.result;if(this.processed=!0,this.processing)throw this.getAsyncError();for(let e of this.plugins){let t=this.runOnRoot(e);if(lt(t))throw this.getAsyncError()}if(this.prepareVisitors(),this.hasListener){let e=this.result.root;for(;!e[ce];)e[ce]=!0,this.walkSync(e);if(this.listeners.OnceExit)if(e.type==="document")for(let t of e.nodes)this.visitSync(this.listeners.OnceExit,t);else this.visitSync(this.listeners.OnceExit,e)}return this.result}then(e,t){return process.env.NODE_ENV!=="production"&&("from"in this.opts||Pc("Without `from` option PostCSS could generate wrong source map and will not find Browserslist config. Set it to CSS file path or to `undefined` to prevent this warning.")),this.async().then(e,t)}toString(){return this.css}visitSync(e,t){for(let[r,i]of e){this.result.lastPlugin=r;let n;try{n=i(t,this.helpers)}catch(o){throw this.handleError(o,t.proxyOf)}if(t.type!=="root"&&t.type!=="document"&&!t.parent)return!0;if(lt(n))throw this.getAsyncError()}}visitTick(e){let t=e[e.length-1],{node:r,visitors:i}=t;if(r.type!=="root"&&r.type!=="document"&&!r.parent){e.pop();return}if(i.length>0&&t.visitorIndex<i.length){let[o,l]=i[t.visitorIndex];t.visitorIndex+=1,t.visitorIndex===i.length&&(t.visitors=[],t.visitorIndex=0),this.result.lastPlugin=o;try{return l(r.toProxy(),this.helpers)}catch(a){throw this.handleError(a,r)}}if(t.iterator!==0){let o=t.iterator,l;for(;l=r.nodes[r.indexes[o]];)if(r.indexes[o]+=1,!l[ce]){l[ce]=!0,e.push(Jn(l));return}t.iterator=0,delete r.indexes[o]}let n=t.events;for(;t.eventIndex<n.length;){let o=n[t.eventIndex];if(t.eventIndex+=1,o===Ue){r.nodes&&r.nodes.length&&(r[ce]=!0,t.iterator=r.getIterator());return}else if(this.listeners[o]){t.visitors=this.listeners[o];return}}e.pop()}walkSync(e){e[ce]=!0;let t=Zn(e);for(let r of t)if(r===Ue)e.nodes&&e.each(i=>{i[ce]||this.walkSync(i)});else{let i=this.listeners[r];if(i&&this.visitSync(i,e.toProxy()))return}}warnings(){return this.sync().warnings()}get content(){return this.stringify().content}get css(){return this.stringify().css}get map(){return this.stringify().map}get messages(){return this.sync().messages}get opts(){return this.result.opts}get processor(){return this.result.processor}get root(){return this.sync().root}get[Symbol.toStringTag](){return"LazyResult"}};Be.registerPostcss=s=>{As=s};var Kn=Be;Be.default=Be,Lc.registerLazyResult(Be),Tc.registerLazyResult(Be);let Bc=vn,zc=Wt,Wc=Pn,Gc=Rs;const Vc=vs;let Ms=class{constructor(e,t,r){t=t.toString(),this.stringified=!1,this._processor=e,this._css=t,this._opts=r,this._map=void 0;let i,n=zc;this.result=new Vc(this._processor,i,this._opts),this.result.css=t;let o=this;Object.defineProperty(this.result,"root",{get(){return o.root}});let l=new Bc(n,i,this._opts,t);if(l.isMap()){let[a,u]=l.generate();a&&(this.result.css=a),u&&(this.result.map=u)}else l.clearAnnotation(),this.result.css=l.css}async(){return this.error?Promise.reject(this.error):Promise.resolve(this.result)}catch(e){return this.async().catch(e)}finally(e){return this.async().then(e,e)}sync(){if(this.error)throw this.error;return this.result}then(e,t){return process.env.NODE_ENV!=="production"&&("from"in this._opts||Wc("Without `from` option PostCSS could generate wrong source map and will not find Browserslist config. Set it to CSS file path or to `undefined` to prevent this warning.")),this.async().then(e,t)}toString(){return this._css}warnings(){return[]}get content(){return this.result.css}get css(){return this.result.css}get map(){return this.result.map}get messages(){return[]}get opts(){return this.result.opts}get processor(){return this.result.processor}get root(){if(this._root)return this._root;let e,t=Gc;try{e=t(this._css,this._opts)}catch(r){this.error=r}if(this.error)throw this.error;return this._root=e,e}get[Symbol.toStringTag](){return"NoWorkResult"}};var jc=Ms;Ms.default=Ms;let Yc=jc,Hc=Kn,Zc=bs,Jc=ot,ut=class{constructor(e=[]){this.version="8.4.38",this.plugins=this.normalize(e)}normalize(e){let t=[];for(let r of e)if(r.postcss===!0?r=r():r.postcss&&(r=r.postcss),typeof r=="object"&&Array.isArray(r.plugins))t=t.concat(r.plugins);else if(typeof r=="object"&&r.postcssPlugin)t.push(r);else if(typeof r=="function")t.push(r);else if(typeof r=="object"&&(r.parse||r.stringify)){if(process.env.NODE_ENV!=="production")throw new Error("PostCSS syntaxes cannot be used as plugins. Instead, please use one of the syntax/parser/stringifier options as outlined in your PostCSS runner documentation.")}else throw new Error(r+" is not a PostCSS plugin");return t}process(e,t={}){return!this.plugins.length&&!t.parser&&!t.stringifier&&!t.syntax?new Yc(this,e,t):new Hc(this,e,t)}use(e){return this.plugins=this.plugins.concat(this.normalize([e])),this}};var Kc=ut;ut.default=ut,Jc.registerProcessor(ut),Zc.registerProcessor(ut);let Xc=jt,Qc=dn,qc=Xt,eh=xs,th=Zt,rh=ot,sh=Os;function ct(s,e){if(Array.isArray(s))return s.map(i=>ct(i));let{inputs:t,...r}=s;if(t){e=[];for(let i of t){let n={...i,__proto__:th.prototype};n.map&&(n.map={...n.map,__proto__:Qc.prototype}),e.push(n)}}if(r.nodes&&(r.nodes=s.nodes.map(i=>ct(i,e))),r.source){let{inputId:i,...n}=r.source;r.source=n,i!=null&&(r.source.input=e[i])}if(r.type==="root")return new rh(r);if(r.type==="decl")return new Xc(r);if(r.type==="rule")return new sh(r);if(r.type==="comment")return new qc(r);if(r.type==="atrule")return new eh(r);throw new Error("Unknown node type: "+s.type)}var ih=ct;ct.default=ct;let nh=is,Xn=jt,oh=Kn,ah=Oe,$s=Kc,lh=Wt,uh=ih,Qn=bs,ch=Dn,qn=Xt,eo=xs,hh=vs,fh=Zt,dh=Rs,ph=Gn,to=Os,ro=ot,mh=Vt;function M(...s){return s.length===1&&Array.isArray(s[0])&&(s=s[0]),new $s(s)}M.plugin=function(e,t){let r=!1;function i(...o){console&&console.warn&&!r&&(r=!0,console.warn(e+`: postcss.plugin was deprecated. Migration guide:+You tried to parse Less with the standard CSS parser; try again with the postcss-less parser`)),i}return r.root}var Rs=ar;ar.default=ar,Oc.registerParse(ar);let{isClean:fe,my:$c}=st,Nc=Cn,kc=Wt,Tc=Ae,Pc=Ss,Dc=Pn,Yn=Cs,Lc=Rs,_c=ot;const Fc={atrule:"AtRule",comment:"Comment",decl:"Declaration",document:"Document",root:"Root",rule:"Rule"},Uc={AtRule:!0,AtRuleExit:!0,Comment:!0,CommentExit:!0,Declaration:!0,DeclarationExit:!0,Document:!0,DocumentExit:!0,Once:!0,OnceExit:!0,postcssPlugin:!0,prepare:!0,Root:!0,RootExit:!0,Rule:!0,RuleExit:!0},Bc={Once:!0,postcssPlugin:!0,prepare:!0},Ue=0;function lt(s){return typeof s=="object"&&typeof s.then=="function"}function Zn(s){let e=!1,t=Fc[s.type];return s.type==="decl"?e=s.prop.toLowerCase():s.type==="atrule"&&(e=s.name.toLowerCase()),e&&s.append?[t,t+"-"+e,Ue,t+"Exit",t+"Exit-"+e]:e?[t,t+"-"+e,t+"Exit",t+"Exit-"+e]:s.append?[t,Ue,t+"Exit"]:[t,t+"Exit"]}function Jn(s){let e;return s.type==="document"?e=["Document",Ue,"DocumentExit"]:s.type==="root"?e=["Root",Ue,"RootExit"]:e=Zn(s),{eventIndex:0,events:e,iterator:0,node:s,visitorIndex:0,visitors:[]}}function Os(s){return s[fe]=!1,s.nodes&&s.nodes.forEach(e=>Os(e)),s}let Es={},Be=class Ko{constructor(e,t,r){this.stringified=!1,this.processed=!1;let i;if(typeof t=="object"&&t!==null&&(t.type==="root"||t.type==="document"))i=Os(t);else if(t instanceof Ko||t instanceof Yn)i=Os(t.root),t.map&&(typeof r.map>"u"&&(r.map={}),r.map.inline||(r.map.inline=!1),r.map.prev=t.map);else{let n=Lc;r.syntax&&(n=r.syntax.parse),r.parser&&(n=r.parser),n.parse&&(n=n.parse);try{i=n(t,r)}catch(o){this.processed=!0,this.error=o}i&&!i[$c]&&Tc.rebuild(i)}this.result=new Yn(e,i,r),this.helpers={...Es,postcss:Es,result:this.result},this.plugins=this.processor.plugins.map(n=>typeof n=="object"&&n.prepare?{...n,...n.prepare(this.result)}:n)}async(){return this.error?Promise.reject(this.error):this.processed?Promise.resolve(this.result):(this.processing||(this.processing=this.runAsync()),this.processing)}catch(e){return this.async().catch(e)}finally(e){return this.async().then(e,e)}getAsyncError(){throw new Error("Use process(css).then(cb) to work with async plugins")}handleError(e,t){let r=this.result.lastPlugin;try{if(t&&t.addToError(e),this.error=e,e.name==="CssSyntaxError"&&!e.plugin)e.plugin=r.postcssPlugin,e.setMessage();else if(r.postcssVersion&&process.env.NODE_ENV!=="production"){let i=r.postcssPlugin,n=r.postcssVersion,o=this.result.processor.version,l=n.split("."),a=o.split(".");(l[0]!==a[0]||parseInt(l[1])>parseInt(a[1]))&&console.error("Unknown error from PostCSS plugin. Your current PostCSS version is "+o+", but "+i+" uses "+n+". Perhaps this is the source of the error below.")}}catch(i){console&&console.error&&console.error(i)}return e}prepareVisitors(){this.listeners={};let e=(t,r,i)=>{this.listeners[r]||(this.listeners[r]=[]),this.listeners[r].push([t,i])};for(let t of this.plugins)if(typeof t=="object")for(let r in t){if(!Uc[r]&&/^[A-Z]/.test(r))throw new Error(`Unknown event ${r} in ${t.postcssPlugin}. Try to update PostCSS (${this.processor.version} now).`);if(!Bc[r])if(typeof t[r]=="object")for(let i in t[r])i==="*"?e(t,r,t[r][i]):e(t,r+"-"+i.toLowerCase(),t[r][i]);else typeof t[r]=="function"&&e(t,r,t[r])}this.hasListener=Object.keys(this.listeners).length>0}async runAsync(){this.plugin=0;for(let e=0;e<this.plugins.length;e++){let t=this.plugins[e],r=this.runOnRoot(t);if(lt(r))try{await r}catch(i){throw this.handleError(i)}}if(this.prepareVisitors(),this.hasListener){let e=this.result.root;for(;!e[fe];){e[fe]=!0;let t=[Jn(e)];for(;t.length>0;){let r=this.visitTick(t);if(lt(r))try{await r}catch(i){let n=t[t.length-1].node;throw this.handleError(i,n)}}}if(this.listeners.OnceExit)for(let[t,r]of this.listeners.OnceExit){this.result.lastPlugin=t;try{if(e.type==="document"){let i=e.nodes.map(n=>r(n,this.helpers));await Promise.all(i)}else await r(e,this.helpers)}catch(i){throw this.handleError(i)}}}return this.processed=!0,this.stringify()}runOnRoot(e){this.result.lastPlugin=e;try{if(typeof e=="object"&&e.Once){if(this.result.root.type==="document"){let t=this.result.root.nodes.map(r=>e.Once(r,this.helpers));return lt(t[0])?Promise.all(t):t}return e.Once(this.result.root,this.helpers)}else if(typeof e=="function")return e(this.result.root,this.result)}catch(t){throw this.handleError(t)}}stringify(){if(this.error)throw this.error;if(this.stringified)return this.result;this.stringified=!0,this.sync();let e=this.result.opts,t=kc;e.syntax&&(t=e.syntax.stringify),e.stringifier&&(t=e.stringifier),t.stringify&&(t=t.stringify);let i=new Nc(t,this.result.root,this.result.opts).generate();return this.result.css=i[0],this.result.map=i[1],this.result}sync(){if(this.error)throw this.error;if(this.processed)return this.result;if(this.processed=!0,this.processing)throw this.getAsyncError();for(let e of this.plugins){let t=this.runOnRoot(e);if(lt(t))throw this.getAsyncError()}if(this.prepareVisitors(),this.hasListener){let e=this.result.root;for(;!e[fe];)e[fe]=!0,this.walkSync(e);if(this.listeners.OnceExit)if(e.type==="document")for(let t of e.nodes)this.visitSync(this.listeners.OnceExit,t);else this.visitSync(this.listeners.OnceExit,e)}return this.result}then(e,t){return process.env.NODE_ENV!=="production"&&("from"in this.opts||Dc("Without `from` option PostCSS could generate wrong source map and will not find Browserslist config. Set it to CSS file path or to `undefined` to prevent this warning.")),this.async().then(e,t)}toString(){return this.css}visitSync(e,t){for(let[r,i]of e){this.result.lastPlugin=r;let n;try{n=i(t,this.helpers)}catch(o){throw this.handleError(o,t.proxyOf)}if(t.type!=="root"&&t.type!=="document"&&!t.parent)return!0;if(lt(n))throw this.getAsyncError()}}visitTick(e){let t=e[e.length-1],{node:r,visitors:i}=t;if(r.type!=="root"&&r.type!=="document"&&!r.parent){e.pop();return}if(i.length>0&&t.visitorIndex<i.length){let[o,l]=i[t.visitorIndex];t.visitorIndex+=1,t.visitorIndex===i.length&&(t.visitors=[],t.visitorIndex=0),this.result.lastPlugin=o;try{return l(r.toProxy(),this.helpers)}catch(a){throw this.handleError(a,r)}}if(t.iterator!==0){let o=t.iterator,l;for(;l=r.nodes[r.indexes[o]];)if(r.indexes[o]+=1,!l[fe]){l[fe]=!0,e.push(Jn(l));return}t.iterator=0,delete r.indexes[o]}let n=t.events;for(;t.eventIndex<n.length;){let o=n[t.eventIndex];if(t.eventIndex+=1,o===Ue){r.nodes&&r.nodes.length&&(r[fe]=!0,t.iterator=r.getIterator());return}else if(this.listeners[o]){t.visitors=this.listeners[o];return}}e.pop()}walkSync(e){e[fe]=!0;let t=Zn(e);for(let r of t)if(r===Ue)e.nodes&&e.each(i=>{i[fe]||this.walkSync(i)});else{let i=this.listeners[r];if(i&&this.visitSync(i,e.toProxy()))return}}warnings(){return this.sync().warnings()}get content(){return this.stringify().content}get css(){return this.stringify().css}get map(){return this.stringify().map}get messages(){return this.sync().messages}get opts(){return this.result.opts}get processor(){return this.result.processor}get root(){return this.sync().root}get[Symbol.toStringTag](){return"LazyResult"}};Be.registerPostcss=s=>{Es=s};var Kn=Be;Be.default=Be,_c.registerLazyResult(Be),Pc.registerLazyResult(Be);let zc=Cn,Wc=Wt,Gc=Pn,Vc=Rs;const jc=Cs;let Ms=class{constructor(e,t,r){t=t.toString(),this.stringified=!1,this._processor=e,this._css=t,this._opts=r,this._map=void 0;let i,n=Wc;this.result=new jc(this._processor,i,this._opts),this.result.css=t;let o=this;Object.defineProperty(this.result,"root",{get(){return o.root}});let l=new zc(n,i,this._opts,t);if(l.isMap()){let[a,u]=l.generate();a&&(this.result.css=a),u&&(this.result.map=u)}else l.clearAnnotation(),this.result.css=l.css}async(){return this.error?Promise.reject(this.error):Promise.resolve(this.result)}catch(e){return this.async().catch(e)}finally(e){return this.async().then(e,e)}sync(){if(this.error)throw this.error;return this.result}then(e,t){return process.env.NODE_ENV!=="production"&&("from"in this._opts||Gc("Without `from` option PostCSS could generate wrong source map and will not find Browserslist config. Set it to CSS file path or to `undefined` to prevent this warning.")),this.async().then(e,t)}toString(){return this._css}warnings(){return[]}get content(){return this.result.css}get css(){return this.result.css}get map(){return this.result.map}get messages(){return[]}get opts(){return this.result.opts}get processor(){return this.result.processor}get root(){if(this._root)return this._root;let e,t=Vc;try{e=t(this._css,this._opts)}catch(r){this.error=r}if(this.error)throw this.error;return this._root=e,e}get[Symbol.toStringTag](){return"NoWorkResult"}};var Hc=Ms;Ms.default=Ms;let Yc=Hc,Zc=Kn,Jc=Ss,Kc=ot,ut=class{constructor(e=[]){this.version="8.4.38",this.plugins=this.normalize(e)}normalize(e){let t=[];for(let r of e)if(r.postcss===!0?r=r():r.postcss&&(r=r.postcss),typeof r=="object"&&Array.isArray(r.plugins))t=t.concat(r.plugins);else if(typeof r=="object"&&r.postcssPlugin)t.push(r);else if(typeof r=="function")t.push(r);else if(typeof r=="object"&&(r.parse||r.stringify)){if(process.env.NODE_ENV!=="production")throw new Error("PostCSS syntaxes cannot be used as plugins. Instead, please use one of the syntax/parser/stringifier options as outlined in your PostCSS runner documentation.")}else throw new Error(r+" is not a PostCSS plugin");return t}process(e,t={}){return!this.plugins.length&&!t.parser&&!t.stringifier&&!t.syntax?new Yc(this,e,t):new Zc(this,e,t)}use(e){return this.plugins=this.plugins.concat(this.normalize([e])),this}};var Xc=ut;ut.default=ut,Kc.registerProcessor(ut),Jc.registerProcessor(ut);let Qc=jt,qc=dn,eh=Xt,th=xs,rh=Zt,sh=ot,ih=As;function ct(s,e){if(Array.isArray(s))return s.map(i=>ct(i));let{inputs:t,...r}=s;if(t){e=[];for(let i of t){let n={...i,__proto__:rh.prototype};n.map&&(n.map={...n.map,__proto__:qc.prototype}),e.push(n)}}if(r.nodes&&(r.nodes=s.nodes.map(i=>ct(i,e))),r.source){let{inputId:i,...n}=r.source;r.source=n,i!=null&&(r.source.input=e[i])}if(r.type==="root")return new sh(r);if(r.type==="decl")return new Qc(r);if(r.type==="rule")return new ih(r);if(r.type==="comment")return new eh(r);if(r.type==="atrule")return new th(r);throw new Error("Unknown node type: "+s.type)}var nh=ct;ct.default=ct;let oh=is,Xn=jt,ah=Kn,lh=Ae,$s=Xc,uh=Wt,ch=nh,Qn=Ss,hh=Dn,qn=Xt,eo=xs,fh=Cs,dh=Zt,ph=Rs,mh=Gn,to=As,ro=ot,gh=Vt;function N(...s){return s.length===1&&Array.isArray(s[0])&&(s=s[0]),new $s(s)}N.plugin=function(e,t){let r=!1;function i(...o){console&&console.warn&&!r&&(r=!0,console.warn(e+`: postcss.plugin was deprecated. Migration guide:https://evilmartians.com/chronicles/postcss-8-plugin-migration`),process.env.LANG&&process.env.LANG.startsWith("cn")&&console.warn(e+`: 里面 postcss.plugin 被弃用. 迁移指南:-https://www.w3ctech.com/topic/2226`));let l=t(...o);return l.postcssPlugin=e,l.postcssVersion=new $s().version,l}let n;return Object.defineProperty(i,"postcss",{get(){return n||(n=i()),n}}),i.process=function(o,l,a){return M([i(a)]).process(o,l)},i},M.stringify=lh,M.parse=dh,M.fromJSON=uh,M.list=ph,M.comment=s=>new qn(s),M.atRule=s=>new eo(s),M.decl=s=>new Xn(s),M.rule=s=>new to(s),M.root=s=>new ro(s),M.document=s=>new Qn(s),M.CssSyntaxError=nh,M.Declaration=Xn,M.Container=ah,M.Processor=$s,M.Document=Qn,M.Comment=qn,M.Warning=ch,M.AtRule=eo,M.Result=hh,M.Input=fh,M.Rule=to,M.Root=ro,M.Node=mh,oh.registerPostcss(M);var gh=M;M.default=M;const U=ku(gh);U.stringify,U.fromJSON,U.plugin,U.parse,U.list,U.document,U.comment,U.atRule,U.rule,U.decl,U.root,U.CssSyntaxError,U.Declaration,U.Container,U.Processor,U.Document,U.Comment,U.Warning,U.AtRule,U.Result,U.Input,U.Rule,U.Root,U.Node;class Ns{constructor(...e){te(this,"parentElement",null),te(this,"parentNode",null),te(this,"ownerDocument"),te(this,"firstChild",null),te(this,"lastChild",null),te(this,"previousSibling",null),te(this,"nextSibling",null),te(this,"ELEMENT_NODE",1),te(this,"TEXT_NODE",3),te(this,"nodeType"),te(this,"nodeName"),te(this,"RRNodeType")}get childNodes(){const e=[];let t=this.firstChild;for(;t;)e.push(t),t=t.nextSibling;return e}contains(e){if(e instanceof Ns){if(e.ownerDocument!==this.ownerDocument)return!1;if(e===this)return!0}else return!1;for(;e.parentNode;){if(e.parentNode===this)return!0;e=e.parentNode}return!1}appendChild(e){throw new Error("RRDomException: Failed to execute 'appendChild' on 'RRNode': This RRNode type does not support this method.")}insertBefore(e,t){throw new Error("RRDomException: Failed to execute 'insertBefore' on 'RRNode': This RRNode type does not support this method.")}removeChild(e){throw new Error("RRDomException: Failed to execute 'removeChild' on 'RRNode': This RRNode type does not support this method.")}toString(){return"RRNode"}}const so={Node:["childNodes","parentNode","parentElement","textContent","ownerDocument"],ShadowRoot:["host","styleSheets"],Element:["shadowRoot","querySelector","querySelectorAll"],MutationObserver:[]},io={Node:["contains","getRootNode"],ShadowRoot:["getSelection"],Element:[],MutationObserver:["constructor"]},lr={},yh=()=>!!globalThis.Zone;function ks(s){if(lr[s])return lr[s];const e=globalThis[s],t=e.prototype,r=s in so?so[s]:void 0,i=!!(r&&r.every(l=>{var a,u;return!!((u=(a=Object.getOwnPropertyDescriptor(t,l))==null?void 0:a.get)!=null&&u.toString().includes("[native code]"))})),n=s in io?io[s]:void 0,o=!!(n&&n.every(l=>{var a;return typeof t[l]=="function"&&((a=t[l])==null?void 0:a.toString().includes("[native code]"))}));if(i&&o&&!yh())return lr[s]=e.prototype,e.prototype;try{const l=document.createElement("iframe");document.body.appendChild(l);const a=l.contentWindow;if(!a)return e.prototype;const u=a[s].prototype;return document.body.removeChild(l),u?lr[s]=u:t}catch{return t}}const Ts={};function Se(s,e,t){var r;const i=`${s}.${String(t)}`;if(Ts[i])return Ts[i].call(e);const n=ks(s),o=(r=Object.getOwnPropertyDescriptor(n,t))==null?void 0:r.get;return o?(Ts[i]=o,o.call(e)):e[t]}const Ps={};function no(s,e,t){const r=`${s}.${String(t)}`;if(Ps[r])return Ps[r].bind(e);const n=ks(s)[t];return typeof n!="function"?e[t]:(Ps[r]=n,n.bind(e))}function wh(s){return Se("Node",s,"ownerDocument")}function bh(s){return Se("Node",s,"childNodes")}function Sh(s){return Se("Node",s,"parentNode")}function Ch(s){return Se("Node",s,"parentElement")}function vh(s){return Se("Node",s,"textContent")}function Ih(s,e){return no("Node",s,"contains")(e)}function xh(s){return no("Node",s,"getRootNode")()}function Oh(s){return!s||!("host"in s)?null:Se("ShadowRoot",s,"host")}function Rh(s){return s.styleSheets}function Eh(s){return!s||!("shadowRoot"in s)?null:Se("Element",s,"shadowRoot")}function Ah(s,e){return Se("Element",s,"querySelector")(e)}function Mh(s,e){return Se("Element",s,"querySelectorAll")(e)}function oo(){return ks("MutationObserver").constructor}function Re(s,e,t){try{if(!(e in s))return()=>{};const r=s[e],i=t(r);return typeof i=="function"&&(i.prototype=i.prototype||{},Object.defineProperties(i,{__rrweb_original__:{enumerable:!1,value:r}})),s[e]=i,()=>{s[e]=r}}catch{return()=>{}}}const v={ownerDocument:wh,childNodes:bh,parentNode:Sh,parentElement:Ch,textContent:vh,contains:Ih,getRootNode:xh,host:Oh,styleSheets:Rh,shadowRoot:Eh,querySelector:Ah,querySelectorAll:Mh,mutationObserver:oo,patch:Re};function K(s,e,t=document){const r={capture:!0,passive:!0};return t.addEventListener(s,e,r),()=>t.removeEventListener(s,e,r)}const ze=`Please stop import mirror directly. Instead of that,\r+https://www.w3ctech.com/topic/2226`));let l=t(...o);return l.postcssPlugin=e,l.postcssVersion=new $s().version,l}let n;return Object.defineProperty(i,"postcss",{get(){return n||(n=i()),n}}),i.process=function(o,l,a){return N([i(a)]).process(o,l)},i},N.stringify=uh,N.parse=ph,N.fromJSON=ch,N.list=mh,N.comment=s=>new qn(s),N.atRule=s=>new eo(s),N.decl=s=>new Xn(s),N.rule=s=>new to(s),N.root=s=>new ro(s),N.document=s=>new Qn(s),N.CssSyntaxError=oh,N.Declaration=Xn,N.Container=lh,N.Processor=$s,N.Document=Qn,N.Comment=qn,N.Warning=hh,N.AtRule=eo,N.Result=fh,N.Input=dh,N.Rule=to,N.Root=ro,N.Node=gh,ah.registerPostcss(N);var yh=N;N.default=N;const U=Tu(yh);U.stringify,U.fromJSON,U.plugin,U.parse,U.list,U.document,U.comment,U.atRule,U.rule,U.decl,U.root,U.CssSyntaxError,U.Declaration,U.Container,U.Processor,U.Document,U.Comment,U.Warning,U.AtRule,U.Result,U.Input,U.Rule,U.Root,U.Node;class Ns{constructor(...e){re(this,"parentElement",null),re(this,"parentNode",null),re(this,"ownerDocument"),re(this,"firstChild",null),re(this,"lastChild",null),re(this,"previousSibling",null),re(this,"nextSibling",null),re(this,"ELEMENT_NODE",1),re(this,"TEXT_NODE",3),re(this,"nodeType"),re(this,"nodeName"),re(this,"RRNodeType")}get childNodes(){const e=[];let t=this.firstChild;for(;t;)e.push(t),t=t.nextSibling;return e}contains(e){if(e instanceof Ns){if(e.ownerDocument!==this.ownerDocument)return!1;if(e===this)return!0}else return!1;for(;e.parentNode;){if(e.parentNode===this)return!0;e=e.parentNode}return!1}appendChild(e){throw new Error("RRDomException: Failed to execute 'appendChild' on 'RRNode': This RRNode type does not support this method.")}insertBefore(e,t){throw new Error("RRDomException: Failed to execute 'insertBefore' on 'RRNode': This RRNode type does not support this method.")}removeChild(e){throw new Error("RRDomException: Failed to execute 'removeChild' on 'RRNode': This RRNode type does not support this method.")}toString(){return"RRNode"}}const so={Node:["childNodes","parentNode","parentElement","textContent","ownerDocument"],ShadowRoot:["host","styleSheets"],Element:["shadowRoot","querySelector","querySelectorAll"],MutationObserver:[]},io={Node:["contains","getRootNode"],ShadowRoot:["getSelection"],Element:[],MutationObserver:["constructor"]},lr={},wh=()=>!!globalThis.Zone;function ks(s){if(lr[s])return lr[s];const e=globalThis[s],t=e.prototype,r=s in so?so[s]:void 0,i=!!(r&&r.every(l=>{var a,u;return!!((u=(a=Object.getOwnPropertyDescriptor(t,l))==null?void 0:a.get)!=null&&u.toString().includes("[native code]"))})),n=s in io?io[s]:void 0,o=!!(n&&n.every(l=>{var a;return typeof t[l]=="function"&&((a=t[l])==null?void 0:a.toString().includes("[native code]"))}));if(i&&o&&!wh())return lr[s]=e.prototype,e.prototype;try{const l=document.createElement("iframe");document.body.appendChild(l);const a=l.contentWindow;if(!a)return e.prototype;const u=a[s].prototype;return document.body.removeChild(l),u?lr[s]=u:t}catch{return t}}const Ts={};function be(s,e,t){var r;const i=`${s}.${String(t)}`;if(Ts[i])return Ts[i].call(e);const n=ks(s),o=(r=Object.getOwnPropertyDescriptor(n,t))==null?void 0:r.get;return o?(Ts[i]=o,o.call(e)):e[t]}const Ps={};function no(s,e,t){const r=`${s}.${String(t)}`;if(Ps[r])return Ps[r].bind(e);const n=ks(s)[t];return typeof n!="function"?e[t]:(Ps[r]=n,n.bind(e))}function Sh(s){return be("Node",s,"ownerDocument")}function bh(s){return be("Node",s,"childNodes")}function vh(s){return be("Node",s,"parentNode")}function Ch(s){return be("Node",s,"parentElement")}function Ih(s){return be("Node",s,"textContent")}function xh(s,e){return no("Node",s,"contains")(e)}function Ah(s){return no("Node",s,"getRootNode")()}function Rh(s){return!s||!("host"in s)?null:be("ShadowRoot",s,"host")}function Oh(s){return s.styleSheets}function Eh(s){return!s||!("shadowRoot"in s)?null:be("Element",s,"shadowRoot")}function Mh(s,e){return be("Element",s,"querySelector")(e)}function $h(s,e){return be("Element",s,"querySelectorAll")(e)}function oo(){return ks("MutationObserver").constructor}function Re(s,e,t){try{if(!(e in s))return()=>{};const r=s[e],i=t(r);return typeof i=="function"&&(i.prototype=i.prototype||{},Object.defineProperties(i,{__rrweb_original__:{enumerable:!1,value:r}})),s[e]=i,()=>{s[e]=r}}catch{return()=>{}}}const I={ownerDocument:Sh,childNodes:bh,parentNode:vh,parentElement:Ch,textContent:Ih,contains:xh,getRootNode:Ah,host:Rh,styleSheets:Oh,shadowRoot:Eh,querySelector:Mh,querySelectorAll:$h,mutationObserver:oo,patch:Re};function X(s,e,t=document){const r={capture:!0,passive:!0};return t.addEventListener(s,e,r),()=>t.removeEventListener(s,e,r)}const ze=`Please stop import mirror directly. Instead of that,\rnow you can use replayer.getMirror() to access the mirror instance of a replayer,\r-or you can use record.mirror to access the mirror instance during recording.`;let ao={map:{},getId(){return console.error(ze),-1},getNode(){return console.error(ze),null},removeNodeFromMap(){console.error(ze)},has(){return console.error(ze),!1},reset(){console.error(ze)}};typeof window<"u"&&window.Proxy&&window.Reflect&&(ao=new Proxy(ao,{get(s,e,t){return e==="map"&&console.error(ze),Reflect.get(s,e,t)}}));function ht(s,e,t={}){let r=null,i=0;return function(...n){const o=Date.now();!i&&t.leading===!1&&(i=o);const l=e-(o-i),a=this;l<=0||l>e?(r&&(clearTimeout(r),r=null),i=o,s.apply(a,n)):!r&&t.trailing!==!1&&(r=setTimeout(()=>{i=t.leading===!1?0:Date.now(),r=null,s.apply(a,n)},l))}}function ur(s,e,t,r,i=window){const n=i.Object.getOwnPropertyDescriptor(s,e);return i.Object.defineProperty(s,e,r?t:{set(o){setTimeout(()=>{t.set.call(this,o)},0),n&&n.set&&n.set.call(this,o)}}),()=>ur(s,e,n||{},!0)}let cr=Date.now;/[1-9][0-9]{12}/.test(Date.now().toString())||(cr=()=>new Date().getTime());function lo(s){var e,t,r,i;const n=s.document;return{left:n.scrollingElement?n.scrollingElement.scrollLeft:s.pageXOffset!==void 0?s.pageXOffset:n.documentElement.scrollLeft||(n==null?void 0:n.body)&&((e=v.parentElement(n.body))==null?void 0:e.scrollLeft)||((t=n==null?void 0:n.body)==null?void 0:t.scrollLeft)||0,top:n.scrollingElement?n.scrollingElement.scrollTop:s.pageYOffset!==void 0?s.pageYOffset:(n==null?void 0:n.documentElement.scrollTop)||(n==null?void 0:n.body)&&((r=v.parentElement(n.body))==null?void 0:r.scrollTop)||((i=n==null?void 0:n.body)==null?void 0:i.scrollTop)||0}}function uo(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function co(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function ho(s){return s?s.nodeType===s.ELEMENT_NODE?s:v.parentElement(s):null}function X(s,e,t,r){if(!s)return!1;const i=ho(s);if(!i)return!1;try{if(typeof e=="string"){if(i.classList.contains(e)||r&&i.closest("."+e)!==null)return!0}else if(Ct(i,e,r))return!0}catch{}return!!(t&&(i.matches(t)||r&&i.closest(t)!==null))}function $h(s,e){return e.getId(s)!==-1}function Ds(s,e,t){return s.tagName==="TITLE"&&t.headTitleMutations?!0:e.getId(s)===Ze}function fo(s,e){if(Ye(s))return!1;const t=e.getId(s);if(!e.has(t))return!0;const r=v.parentNode(s);return r&&r.nodeType===s.DOCUMENT_NODE?!1:r?fo(r,e):!0}function Ls(s){return!!s.changedTouches}function Nh(s=window){"NodeList"in s&&!s.NodeList.prototype.forEach&&(s.NodeList.prototype.forEach=Array.prototype.forEach),"DOMTokenList"in s&&!s.DOMTokenList.prototype.forEach&&(s.DOMTokenList.prototype.forEach=Array.prototype.forEach)}function po(s,e){return!!(s.nodeName==="IFRAME"&&e.getMeta(s))}function mo(s,e){return!!(s.nodeName==="LINK"&&s.nodeType===s.ELEMENT_NODE&&s.getAttribute&&s.getAttribute("rel")==="stylesheet"&&e.getMeta(s))}function _s(s){return s?s instanceof Ns&&"shadowRoot"in s?!!s.shadowRoot:!!v.shadowRoot(s):!1}class kh{constructor(){w(this,"id",1),w(this,"styleIDMap",new WeakMap),w(this,"idStyleMap",new Map)}getId(e){return this.styleIDMap.get(e)??-1}has(e){return this.styleIDMap.has(e)}add(e,t){if(this.has(e))return this.getId(e);let r;return t===void 0?r=this.id++:r=t,this.styleIDMap.set(e,r),this.idStyleMap.set(r,e),r}getStyle(e){return this.idStyleMap.get(e)||null}reset(){this.styleIDMap=new WeakMap,this.idStyleMap=new Map,this.id=1}generateId(){return this.id++}}function go(s){var e;let t=null;return"getRootNode"in s&&((e=v.getRootNode(s))==null?void 0:e.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&v.host(v.getRootNode(s))&&(t=v.host(v.getRootNode(s))),t}function Th(s){let e=s,t;for(;t=go(e);)e=t;return e}function Ph(s){const e=v.ownerDocument(s);if(!e)return!1;const t=Th(s);return v.contains(e,t)}function yo(s){const e=v.ownerDocument(s);return e?v.contains(e,s)||Ph(s):!1}var O=(s=>(s[s.DomContentLoaded=0]="DomContentLoaded",s[s.Load=1]="Load",s[s.FullSnapshot=2]="FullSnapshot",s[s.IncrementalSnapshot=3]="IncrementalSnapshot",s[s.Meta=4]="Meta",s[s.Custom=5]="Custom",s[s.Plugin=6]="Plugin",s))(O||{}),I=(s=>(s[s.Mutation=0]="Mutation",s[s.MouseMove=1]="MouseMove",s[s.MouseInteraction=2]="MouseInteraction",s[s.Scroll=3]="Scroll",s[s.ViewportResize=4]="ViewportResize",s[s.Input=5]="Input",s[s.TouchMove=6]="TouchMove",s[s.MediaInteraction=7]="MediaInteraction",s[s.StyleSheetRule=8]="StyleSheetRule",s[s.CanvasMutation=9]="CanvasMutation",s[s.Font=10]="Font",s[s.Log=11]="Log",s[s.Drag=12]="Drag",s[s.StyleDeclaration=13]="StyleDeclaration",s[s.Selection=14]="Selection",s[s.AdoptedStyleSheet=15]="AdoptedStyleSheet",s[s.CustomElement=16]="CustomElement",s))(I||{}),q=(s=>(s[s.MouseUp=0]="MouseUp",s[s.MouseDown=1]="MouseDown",s[s.Click=2]="Click",s[s.ContextMenu=3]="ContextMenu",s[s.DblClick=4]="DblClick",s[s.Focus=5]="Focus",s[s.Blur=6]="Blur",s[s.TouchStart=7]="TouchStart",s[s.TouchMove_Departed=8]="TouchMove_Departed",s[s.TouchEnd=9]="TouchEnd",s[s.TouchCancel=10]="TouchCancel",s))(q||{}),Ce=(s=>(s[s.Mouse=0]="Mouse",s[s.Pen=1]="Pen",s[s.Touch=2]="Touch",s))(Ce||{}),We=(s=>(s[s["2D"]=0]="2D",s[s.WebGL=1]="WebGL",s[s.WebGL2=2]="WebGL2",s))(We||{}),Ge=(s=>(s[s.Play=0]="Play",s[s.Pause=1]="Pause",s[s.Seeked=2]="Seeked",s[s.VolumeChange=3]="VolumeChange",s[s.RateChange=4]="RateChange",s))(Ge||{}),wo=(s=>(s[s.Document=0]="Document",s[s.DocumentType=1]="DocumentType",s[s.Element=2]="Element",s[s.Text=3]="Text",s[s.CDATA=4]="CDATA",s[s.Comment=5]="Comment",s))(wo||{});function bo(s){return"__ln"in s}class Dh{constructor(){w(this,"length",0),w(this,"head",null),w(this,"tail",null)}get(e){if(e>=this.length)throw new Error("Position outside of list range");let t=this.head;for(let r=0;r<e;r++)t=(t==null?void 0:t.next)||null;return t}addNode(e){const t={value:e,previous:null,next:null};if(e.__ln=t,e.previousSibling&&bo(e.previousSibling)){const r=e.previousSibling.__ln.next;t.next=r,t.previous=e.previousSibling.__ln,e.previousSibling.__ln.next=t,r&&(r.previous=t)}else if(e.nextSibling&&bo(e.nextSibling)&&e.nextSibling.__ln.previous){const r=e.nextSibling.__ln.previous;t.previous=r,t.next=e.nextSibling.__ln,e.nextSibling.__ln.previous=t,r&&(r.next=t)}else this.head&&(this.head.previous=t),t.next=this.head,this.head=t;t.next===null&&(this.tail=t),this.length++}removeNode(e){const t=e.__ln;this.head&&(t.previous?(t.previous.next=t.next,t.next?t.next.previous=t.previous:this.tail=t.previous):(this.head=t.next,this.head?this.head.previous=null:this.tail=null),e.__ln&&delete e.__ln,this.length--)}}const So=(s,e)=>`${s}@${e}`;class Lh{constructor(){w(this,"frozen",!1),w(this,"locked",!1),w(this,"texts",[]),w(this,"attributes",[]),w(this,"attributeMap",new WeakMap),w(this,"removes",[]),w(this,"mapRemoves",[]),w(this,"movedMap",{}),w(this,"addedSet",new Set),w(this,"movedSet",new Set),w(this,"droppedSet",new Set),w(this,"removesSubTreeCache",new Set),w(this,"mutationCb"),w(this,"blockClass"),w(this,"blockSelector"),w(this,"maskTextClass"),w(this,"maskTextSelector"),w(this,"inlineStylesheet"),w(this,"maskInputOptions"),w(this,"maskTextFn"),w(this,"maskInputFn"),w(this,"keepIframeSrcFn"),w(this,"recordCanvas"),w(this,"inlineImages"),w(this,"slimDOMOptions"),w(this,"dataURLOptions"),w(this,"doc"),w(this,"mirror"),w(this,"iframeManager"),w(this,"stylesheetManager"),w(this,"shadowDomManager"),w(this,"canvasManager"),w(this,"processedNodeManager"),w(this,"unattachedDoc"),w(this,"processMutations",e=>{e.forEach(this.processMutation),this.emit()}),w(this,"emit",()=>{if(this.frozen||this.locked)return;const e=[],t=new Set,r=new Dh,i=a=>{let u=a,c=Ze;for(;c===Ze;)u=u&&u.nextSibling,c=u&&this.mirror.getId(u);return c},n=a=>{const u=v.parentNode(a);if(!u||!yo(a))return;let c=!1;if(a.nodeType===Node.TEXT_NODE){const g=u.tagName;if(g==="TEXTAREA")return;g==="STYLE"&&this.addedSet.has(u)&&(c=!0)}const h=Ye(u)?this.mirror.getId(go(a)):this.mirror.getId(u),p=i(a);if(h===-1||p===-1)return r.addNode(a);const m=Pe(a,{doc:this.doc,mirror:this.mirror,blockClass:this.blockClass,blockSelector:this.blockSelector,maskTextClass:this.maskTextClass,maskTextSelector:this.maskTextSelector,skipChild:!0,newlyAddedElement:!0,inlineStylesheet:this.inlineStylesheet,maskInputOptions:this.maskInputOptions,maskTextFn:this.maskTextFn,maskInputFn:this.maskInputFn,slimDOMOptions:this.slimDOMOptions,dataURLOptions:this.dataURLOptions,recordCanvas:this.recordCanvas,inlineImages:this.inlineImages,onSerialize:g=>{po(g,this.mirror)&&this.iframeManager.addIframe(g),mo(g,this.mirror)&&this.stylesheetManager.trackLinkElement(g),_s(a)&&this.shadowDomManager.addShadowRoot(v.shadowRoot(a),this.doc)},onIframeLoad:(g,d)=>{this.iframeManager.attachIframe(g,d),this.shadowDomManager.observeAttachShadow(g)},onStylesheetLoad:(g,d)=>{this.stylesheetManager.attachLinkElement(g,d)},cssCaptured:c});m&&(e.push({parentId:h,nextId:p,node:m}),t.add(m.id))};for(;this.mapRemoves.length;)this.mirror.removeNodeFromMap(this.mapRemoves.shift());for(const a of this.movedSet)Co(this.removesSubTreeCache,a,this.mirror)&&!this.movedSet.has(v.parentNode(a))||n(a);for(const a of this.addedSet)!vo(this.droppedSet,a)&&!Co(this.removesSubTreeCache,a,this.mirror)||vo(this.movedSet,a)?n(a):this.droppedSet.add(a);let o=null;for(;r.length;){let a=null;if(o){const u=this.mirror.getId(v.parentNode(o.value)),c=i(o.value);u!==-1&&c!==-1&&(a=o)}if(!a){let u=r.tail;for(;u;){const c=u;if(u=u.previous,c){const h=this.mirror.getId(v.parentNode(c.value));if(i(c.value)===-1)continue;if(h!==-1){a=c;break}else{const m=c.value,g=v.parentNode(m);if(g&&g.nodeType===Node.DOCUMENT_FRAGMENT_NODE){const d=v.host(g);if(this.mirror.getId(d)!==-1){a=c;break}}}}}}if(!a){for(;r.head;)r.removeNode(r.head.value);break}o=a.previous,r.removeNode(a.value),n(a.value)}const l={texts:this.texts.map(a=>{const u=a.node,c=v.parentNode(u);return c&&c.tagName==="TEXTAREA"&&this.genTextAreaValueMutation(c),{id:this.mirror.getId(u),value:a.value}}).filter(a=>!t.has(a.id)).filter(a=>this.mirror.has(a.id)),attributes:this.attributes.map(a=>{const{attributes:u}=a;if(typeof u.style=="string"){const c=JSON.stringify(a.styleDiff),h=JSON.stringify(a._unchangedStyles);c.length<u.style.length&&(c+h).split("var(").length===u.style.split("var(").length&&(u.style=a.styleDiff)}return{id:this.mirror.getId(a.node),attributes:u}}).filter(a=>!t.has(a.id)).filter(a=>this.mirror.has(a.id)),removes:this.removes,adds:e};!l.texts.length&&!l.attributes.length&&!l.removes.length&&!l.adds.length||(this.texts=[],this.attributes=[],this.attributeMap=new WeakMap,this.removes=[],this.addedSet=new Set,this.movedSet=new Set,this.droppedSet=new Set,this.removesSubTreeCache=new Set,this.movedMap={},this.mutationCb(l))}),w(this,"genTextAreaValueMutation",e=>{let t=this.attributeMap.get(e);t||(t={node:e,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(t),this.attributeMap.set(e,t));const r=Array.from(v.childNodes(e),i=>v.textContent(i)||"").join("");t.attributes.value=yt({element:e,maskInputOptions:this.maskInputOptions,tagName:e.tagName,type:wt(e),value:r,maskInputFn:this.maskInputFn})}),w(this,"processMutation",e=>{if(!Ds(e.target,this.mirror,this.slimDOMOptions))switch(e.type){case"characterData":{const t=v.textContent(e.target);!X(e.target,this.blockClass,this.blockSelector,!1)&&t!==e.oldValue&&this.texts.push({value:oi(e.target,this.maskTextClass,this.maskTextSelector,!0)&&t?this.maskTextFn?this.maskTextFn(t,ho(e.target)):t.replace(/[\S]/g,"*"):t,node:e.target});break}case"attributes":{const t=e.target;let r=e.attributeName,i=e.target.getAttribute(r);if(r==="value"){const o=wt(t);i=yt({element:t,maskInputOptions:this.maskInputOptions,tagName:t.tagName,type:o,value:i,maskInputFn:this.maskInputFn})}if(X(e.target,this.blockClass,this.blockSelector,!1)||i===e.oldValue)return;let n=this.attributeMap.get(e.target);if(t.tagName==="IFRAME"&&r==="src"&&!this.keepIframeSrcFn(i))if(!t.contentDocument)r="rr_src";else return;if(n||(n={node:e.target,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(n),this.attributeMap.set(e.target,n)),r==="type"&&t.tagName==="INPUT"&&(e.oldValue||"").toLowerCase()==="password"&&t.setAttribute("data-rr-is-password","true"),!ni(t.tagName,r))if(n.attributes[r]=ii(this.doc,Ie(t.tagName),Ie(r),i),r==="style"){if(!this.unattachedDoc)try{this.unattachedDoc=document.implementation.createHTMLDocument()}catch{this.unattachedDoc=this.doc}const o=this.unattachedDoc.createElement("span");e.oldValue&&o.setAttribute("style",e.oldValue);for(const l of Array.from(t.style)){const a=t.style.getPropertyValue(l),u=t.style.getPropertyPriority(l);a!==o.style.getPropertyValue(l)||u!==o.style.getPropertyPriority(l)?u===""?n.styleDiff[l]=a:n.styleDiff[l]=[a,u]:n._unchangedStyles[l]=[a,u]}for(const l of Array.from(o.style))t.style.getPropertyValue(l)===""&&(n.styleDiff[l]=!1)}else r==="open"&&t.tagName==="DIALOG"&&(t.matches("dialog:modal")?n.attributes.rr_open_mode="modal":n.attributes.rr_open_mode="non-modal");break}case"childList":{if(X(e.target,this.blockClass,this.blockSelector,!0))return;if(e.target.tagName==="TEXTAREA"){this.genTextAreaValueMutation(e.target);return}e.addedNodes.forEach(t=>this.genAdds(t,e.target)),e.removedNodes.forEach(t=>{const r=this.mirror.getId(t),i=Ye(e.target)?this.mirror.getId(v.host(e.target)):this.mirror.getId(e.target);X(e.target,this.blockClass,this.blockSelector,!1)||Ds(t,this.mirror,this.slimDOMOptions)||!$h(t,this.mirror)||(this.addedSet.has(t)?(Fs(this.addedSet,t),this.droppedSet.add(t)):this.addedSet.has(e.target)&&r===-1||fo(e.target,this.mirror)||(this.movedSet.has(t)&&this.movedMap[So(r,i)]?Fs(this.movedSet,t):(this.removes.push({parentId:i,id:r,isShadow:Ye(e.target)&&He(e.target)?!0:void 0}),_h(t,this.removesSubTreeCache))),this.mapRemoves.push(t))});break}}}),w(this,"genAdds",(e,t)=>{if(!this.processedNodeManager.inOtherBuffer(e,this)&&!(this.addedSet.has(e)||this.movedSet.has(e))){if(this.mirror.hasNode(e)){if(Ds(e,this.mirror,this.slimDOMOptions))return;this.movedSet.add(e);let r=null;t&&this.mirror.hasNode(t)&&(r=this.mirror.getId(t)),r&&r!==-1&&(this.movedMap[So(this.mirror.getId(e),r)]=!0)}else this.addedSet.add(e),this.droppedSet.delete(e);X(e,this.blockClass,this.blockSelector,!1)||(v.childNodes(e).forEach(r=>this.genAdds(r)),_s(e)&&v.childNodes(v.shadowRoot(e)).forEach(r=>{this.processedNodeManager.add(r,this),this.genAdds(r,e)}))}})}init(e){["mutationCb","blockClass","blockSelector","maskTextClass","maskTextSelector","inlineStylesheet","maskInputOptions","maskTextFn","maskInputFn","keepIframeSrcFn","recordCanvas","inlineImages","slimDOMOptions","dataURLOptions","doc","mirror","iframeManager","stylesheetManager","shadowDomManager","canvasManager","processedNodeManager"].forEach(t=>{this[t]=e[t]})}freeze(){this.frozen=!0,this.canvasManager.freeze()}unfreeze(){this.frozen=!1,this.canvasManager.unfreeze(),this.emit()}isFrozen(){return this.frozen}lock(){this.locked=!0,this.canvasManager.lock()}unlock(){this.locked=!1,this.canvasManager.unlock(),this.emit()}reset(){this.shadowDomManager.reset(),this.canvasManager.reset()}}function Fs(s,e){s.delete(e),v.childNodes(e).forEach(t=>Fs(s,t))}function _h(s,e){const t=[s];for(;t.length;){const r=t.pop();e.has(r)||(e.add(r),v.childNodes(r).forEach(i=>t.push(i)))}}function Co(s,e,t){return s.size===0?!1:Fh(s,e)}function Fh(s,e,t){const r=v.parentNode(e);return r?s.has(r):!1}function vo(s,e){return s.size===0?!1:Io(s,e)}function Io(s,e){const t=v.parentNode(e);return t?s.has(t)?!0:Io(s,t):!1}let ft;function Uh(s){ft=s}function Bh(){ft=void 0}const x=s=>ft?(...t)=>{try{return s(...t)}catch(r){if(ft&&ft(r)===!0)return;throw r}}:s,Ee=[];function dt(s){try{if("composedPath"in s){const e=s.composedPath();if(e.length)return e[0]}else if("path"in s&&s.path.length)return s.path[0]}catch{}return s&&s.target}function xo(s,e){const t=new Lh;Ee.push(t),t.init(s);const r=new(oo())(x(t.processMutations.bind(t)));return r.observe(e,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),r}function zh({mousemoveCb:s,sampling:e,doc:t,mirror:r}){if(e.mousemove===!1)return()=>{};const i=typeof e.mousemove=="number"?e.mousemove:50,n=typeof e.mousemoveCallback=="number"?e.mousemoveCallback:500;let o=[],l;const a=ht(x(h=>{const p=Date.now()-l;s(o.map(m=>(m.timeOffset-=p,m)),h),o=[],l=null}),n),u=x(ht(x(h=>{const p=dt(h),{clientX:m,clientY:g}=Ls(h)?h.changedTouches[0]:h;l||(l=cr()),o.push({x:m,y:g,id:r.getId(p),timeOffset:cr()-l}),a(typeof DragEvent<"u"&&h instanceof DragEvent?I.Drag:h instanceof MouseEvent?I.MouseMove:I.TouchMove)}),i,{trailing:!1})),c=[K("mousemove",u,t),K("touchmove",u,t),K("drag",u,t)];return x(()=>{c.forEach(h=>h())})}function Wh({mouseInteractionCb:s,doc:e,mirror:t,blockClass:r,blockSelector:i,sampling:n}){if(n.mouseInteraction===!1)return()=>{};const o=n.mouseInteraction===!0||n.mouseInteraction===void 0?{}:n.mouseInteraction,l=[];let a=null;const u=c=>h=>{const p=dt(h);if(X(p,r,i,!0))return;let m=null,g=c;if("pointerType"in h){switch(h.pointerType){case"mouse":m=Ce.Mouse;break;case"touch":m=Ce.Touch;break;case"pen":m=Ce.Pen;break}m===Ce.Touch?q[c]===q.MouseDown?g="TouchStart":q[c]===q.MouseUp&&(g="TouchEnd"):Ce.Pen}else Ls(h)&&(m=Ce.Touch);m!==null?(a=m,(g.startsWith("Touch")&&m===Ce.Touch||g.startsWith("Mouse")&&m===Ce.Mouse)&&(m=null)):q[c]===q.Click&&(m=a,a=null);const d=Ls(h)?h.changedTouches[0]:h;if(!d)return;const f=t.getId(p),{clientX:b,clientY:S}=d;x(s)({type:q[g],id:f,x:b,y:S,...m!==null&&{pointerType:m}})};return Object.keys(q).filter(c=>Number.isNaN(Number(c))&&!c.endsWith("_Departed")&&o[c]!==!1).forEach(c=>{let h=Ie(c);const p=u(c);if(window.PointerEvent)switch(q[c]){case q.MouseDown:case q.MouseUp:h=h.replace("mouse","pointer");break;case q.TouchStart:case q.TouchEnd:return}l.push(K(h,p,e))}),x(()=>{l.forEach(c=>c())})}function Oo({scrollCb:s,doc:e,mirror:t,blockClass:r,blockSelector:i,sampling:n}){const o=x(ht(x(l=>{const a=dt(l);if(!a||X(a,r,i,!0))return;const u=t.getId(a);if(a===e&&e.defaultView){const c=lo(e.defaultView);s({id:u,x:c.left,y:c.top})}else s({id:u,x:a.scrollLeft,y:a.scrollTop})}),n.scroll||100));return K("scroll",o,e)}function Gh({viewportResizeCb:s},{win:e}){let t=-1,r=-1;const i=x(ht(x(()=>{const n=uo(),o=co();(t!==n||r!==o)&&(s({width:Number(o),height:Number(n)}),t=n,r=o)}),200));return K("resize",i,e)}const Vh=["INPUT","TEXTAREA","SELECT"],Ro=new WeakMap;function jh({inputCb:s,doc:e,mirror:t,blockClass:r,blockSelector:i,ignoreClass:n,ignoreSelector:o,maskInputOptions:l,maskInputFn:a,sampling:u,userTriggeredOnInput:c}){function h(S){let y=dt(S);const C=S.isTrusted,N=y&&y.tagName;if(y&&N==="OPTION"&&(y=v.parentElement(y)),!y||!N||Vh.indexOf(N)<0||X(y,r,i,!0)||y.classList.contains(n)||o&&y.matches(o))return;let D=y.value,Y=!1;const B=wt(y)||"";B==="radio"||B==="checkbox"?Y=y.checked:(l[N.toLowerCase()]||l[B])&&(D=yt({element:y,maskInputOptions:l,tagName:N,type:B,value:D,maskInputFn:a})),p(y,c?{text:D,isChecked:Y,userTriggered:C}:{text:D,isChecked:Y});const V=y.name;B==="radio"&&V&&Y&&e.querySelectorAll(`input[type="radio"][name="${V}"]`).forEach(Z=>{if(Z!==y){const se=Z.value;p(Z,c?{text:se,isChecked:!Y,userTriggered:!1}:{text:se,isChecked:!Y})}})}function p(S,y){const C=Ro.get(S);if(!C||C.text!==y.text||C.isChecked!==y.isChecked){Ro.set(S,y);const N=t.getId(S);x(s)({...y,id:N})}}const g=(u.input==="last"?["change"]:["input","change"]).map(S=>K(S,x(h),e)),d=e.defaultView;if(!d)return()=>{g.forEach(S=>S())};const f=d.Object.getOwnPropertyDescriptor(d.HTMLInputElement.prototype,"value"),b=[[d.HTMLInputElement.prototype,"value"],[d.HTMLInputElement.prototype,"checked"],[d.HTMLSelectElement.prototype,"value"],[d.HTMLTextAreaElement.prototype,"value"],[d.HTMLSelectElement.prototype,"selectedIndex"],[d.HTMLOptionElement.prototype,"selected"]];return f&&f.set&&g.push(...b.map(S=>ur(S[0],S[1],{set(){x(h)({target:this,isTrusted:!1})}},!1,d))),x(()=>{g.forEach(S=>S())})}function hr(s){const e=[];function t(r,i){if(fr("CSSGroupingRule")&&r.parentRule instanceof CSSGroupingRule||fr("CSSMediaRule")&&r.parentRule instanceof CSSMediaRule||fr("CSSSupportsRule")&&r.parentRule instanceof CSSSupportsRule||fr("CSSConditionRule")&&r.parentRule instanceof CSSConditionRule){const o=Array.from(r.parentRule.cssRules).indexOf(r);i.unshift(o)}else if(r.parentStyleSheet){const o=Array.from(r.parentStyleSheet.cssRules).indexOf(r);i.unshift(o)}return i}return t(s,e)}function ve(s,e,t){let r,i;return s?(s.ownerNode?r=e.getId(s.ownerNode):i=t.getId(s),{styleId:i,id:r}):{}}function Yh({styleSheetRuleCb:s,mirror:e,stylesheetManager:t},{win:r}){if(!r.CSSStyleSheet||!r.CSSStyleSheet.prototype)return()=>{};const i=r.CSSStyleSheet.prototype.insertRule;r.CSSStyleSheet.prototype.insertRule=new Proxy(i,{apply:x((c,h,p)=>{const[m,g]=p,{id:d,styleId:f}=ve(h,e,t.styleMirror);return(d&&d!==-1||f&&f!==-1)&&s({id:d,styleId:f,adds:[{rule:m,index:g}]}),c.apply(h,p)})}),r.CSSStyleSheet.prototype.addRule=function(c,h,p=this.cssRules.length){const m=`${c} { ${h} }`;return r.CSSStyleSheet.prototype.insertRule.apply(this,[m,p])};const n=r.CSSStyleSheet.prototype.deleteRule;r.CSSStyleSheet.prototype.deleteRule=new Proxy(n,{apply:x((c,h,p)=>{const[m]=p,{id:g,styleId:d}=ve(h,e,t.styleMirror);return(g&&g!==-1||d&&d!==-1)&&s({id:g,styleId:d,removes:[{index:m}]}),c.apply(h,p)})}),r.CSSStyleSheet.prototype.removeRule=function(c){return r.CSSStyleSheet.prototype.deleteRule.apply(this,[c])};let o;r.CSSStyleSheet.prototype.replace&&(o=r.CSSStyleSheet.prototype.replace,r.CSSStyleSheet.prototype.replace=new Proxy(o,{apply:x((c,h,p)=>{const[m]=p,{id:g,styleId:d}=ve(h,e,t.styleMirror);return(g&&g!==-1||d&&d!==-1)&&s({id:g,styleId:d,replace:m}),c.apply(h,p)})}));let l;r.CSSStyleSheet.prototype.replaceSync&&(l=r.CSSStyleSheet.prototype.replaceSync,r.CSSStyleSheet.prototype.replaceSync=new Proxy(l,{apply:x((c,h,p)=>{const[m]=p,{id:g,styleId:d}=ve(h,e,t.styleMirror);return(g&&g!==-1||d&&d!==-1)&&s({id:g,styleId:d,replaceSync:m}),c.apply(h,p)})}));const a={};dr("CSSGroupingRule")?a.CSSGroupingRule=r.CSSGroupingRule:(dr("CSSMediaRule")&&(a.CSSMediaRule=r.CSSMediaRule),dr("CSSConditionRule")&&(a.CSSConditionRule=r.CSSConditionRule),dr("CSSSupportsRule")&&(a.CSSSupportsRule=r.CSSSupportsRule));const u={};return Object.entries(a).forEach(([c,h])=>{u[c]={insertRule:h.prototype.insertRule,deleteRule:h.prototype.deleteRule},h.prototype.insertRule=new Proxy(u[c].insertRule,{apply:x((p,m,g)=>{const[d,f]=g,{id:b,styleId:S}=ve(m.parentStyleSheet,e,t.styleMirror);return(b&&b!==-1||S&&S!==-1)&&s({id:b,styleId:S,adds:[{rule:d,index:[...hr(m),f||0]}]}),p.apply(m,g)})}),h.prototype.deleteRule=new Proxy(u[c].deleteRule,{apply:x((p,m,g)=>{const[d]=g,{id:f,styleId:b}=ve(m.parentStyleSheet,e,t.styleMirror);return(f&&f!==-1||b&&b!==-1)&&s({id:f,styleId:b,removes:[{index:[...hr(m),d]}]}),p.apply(m,g)})})}),x(()=>{r.CSSStyleSheet.prototype.insertRule=i,r.CSSStyleSheet.prototype.deleteRule=n,o&&(r.CSSStyleSheet.prototype.replace=o),l&&(r.CSSStyleSheet.prototype.replaceSync=l),Object.entries(a).forEach(([c,h])=>{h.prototype.insertRule=u[c].insertRule,h.prototype.deleteRule=u[c].deleteRule})})}function Eo({mirror:s,stylesheetManager:e},t){var r,i,n;let o=null;t.nodeName==="#document"?o=s.getId(t):o=s.getId(v.host(t));const l=t.nodeName==="#document"?(r=t.defaultView)==null?void 0:r.Document:(n=(i=t.ownerDocument)==null?void 0:i.defaultView)==null?void 0:n.ShadowRoot,a=l!=null&&l.prototype?Object.getOwnPropertyDescriptor(l==null?void 0:l.prototype,"adoptedStyleSheets"):void 0;return o===null||o===-1||!l||!a?()=>{}:(Object.defineProperty(t,"adoptedStyleSheets",{configurable:a.configurable,enumerable:a.enumerable,get(){var u;return(u=a.get)==null?void 0:u.call(this)},set(u){var c;const h=(c=a.set)==null?void 0:c.call(this,u);if(o!==null&&o!==-1)try{e.adoptStyleSheets(u,o)}catch{}return h}}),x(()=>{Object.defineProperty(t,"adoptedStyleSheets",{configurable:a.configurable,enumerable:a.enumerable,get:a.get,set:a.set})}))}function Hh({styleDeclarationCb:s,mirror:e,ignoreCSSAttributes:t,stylesheetManager:r},{win:i}){const n=i.CSSStyleDeclaration.prototype.setProperty;i.CSSStyleDeclaration.prototype.setProperty=new Proxy(n,{apply:x((l,a,u)=>{var c;const[h,p,m]=u;if(t.has(h))return n.apply(a,[h,p,m]);const{id:g,styleId:d}=ve((c=a.parentRule)==null?void 0:c.parentStyleSheet,e,r.styleMirror);return(g&&g!==-1||d&&d!==-1)&&s({id:g,styleId:d,set:{property:h,value:p,priority:m},index:hr(a.parentRule)}),l.apply(a,u)})});const o=i.CSSStyleDeclaration.prototype.removeProperty;return i.CSSStyleDeclaration.prototype.removeProperty=new Proxy(o,{apply:x((l,a,u)=>{var c;const[h]=u;if(t.has(h))return o.apply(a,[h]);const{id:p,styleId:m}=ve((c=a.parentRule)==null?void 0:c.parentStyleSheet,e,r.styleMirror);return(p&&p!==-1||m&&m!==-1)&&s({id:p,styleId:m,remove:{property:h},index:hr(a.parentRule)}),l.apply(a,u)})}),x(()=>{i.CSSStyleDeclaration.prototype.setProperty=n,i.CSSStyleDeclaration.prototype.removeProperty=o})}function Zh({mediaInteractionCb:s,blockClass:e,blockSelector:t,mirror:r,sampling:i,doc:n}){const o=x(a=>ht(x(u=>{const c=dt(u);if(!c||X(c,e,t,!0))return;const{currentTime:h,volume:p,muted:m,playbackRate:g,loop:d}=c;s({type:a,id:r.getId(c),currentTime:h,volume:p,muted:m,playbackRate:g,loop:d})}),i.media||500)),l=[K("play",o(Ge.Play),n),K("pause",o(Ge.Pause),n),K("seeked",o(Ge.Seeked),n),K("volumechange",o(Ge.VolumeChange),n),K("ratechange",o(Ge.RateChange),n)];return x(()=>{l.forEach(a=>a())})}function Jh({fontCb:s,doc:e}){const t=e.defaultView;if(!t)return()=>{};const r=[],i=new WeakMap,n=t.FontFace;t.FontFace=function(a,u,c){const h=new n(a,u,c);return i.set(h,{family:a,buffer:typeof u!="string",descriptors:c,fontSource:typeof u=="string"?u:JSON.stringify(Array.from(new Uint8Array(u)))}),h};const o=Re(e.fonts,"add",function(l){return function(a){return setTimeout(x(()=>{const u=i.get(a);u&&(s(u),i.delete(a))}),0),l.apply(this,[a])}});return r.push(()=>{t.FontFace=n}),r.push(o),x(()=>{r.forEach(l=>l())})}function Kh(s){const{doc:e,mirror:t,blockClass:r,blockSelector:i,selectionCb:n}=s;let o=!0;const l=x(()=>{const a=e.getSelection();if(!a||o&&(a!=null&&a.isCollapsed))return;o=a.isCollapsed||!1;const u=[],c=a.rangeCount||0;for(let h=0;h<c;h++){const p=a.getRangeAt(h),{startContainer:m,startOffset:g,endContainer:d,endOffset:f}=p;X(m,r,i,!0)||X(d,r,i,!0)||u.push({start:t.getId(m),startOffset:g,end:t.getId(d),endOffset:f})}n({ranges:u})});return l(),K("selectionchange",l)}function Xh({doc:s,customElementCb:e}){const t=s.defaultView;return!t||!t.customElements?()=>{}:Re(t.customElements,"define",function(i){return function(n,o,l){try{e({define:{name:n}})}catch{console.warn(`Custom element callback failed for ${n}`)}return i.apply(this,[n,o,l])}})}function Qh(s,e){const{mutationCb:t,mousemoveCb:r,mouseInteractionCb:i,scrollCb:n,viewportResizeCb:o,inputCb:l,mediaInteractionCb:a,styleSheetRuleCb:u,styleDeclarationCb:c,canvasMutationCb:h,fontCb:p,selectionCb:m,customElementCb:g}=s;s.mutationCb=(...d)=>{e.mutation&&e.mutation(...d),t(...d)},s.mousemoveCb=(...d)=>{e.mousemove&&e.mousemove(...d),r(...d)},s.mouseInteractionCb=(...d)=>{e.mouseInteraction&&e.mouseInteraction(...d),i(...d)},s.scrollCb=(...d)=>{e.scroll&&e.scroll(...d),n(...d)},s.viewportResizeCb=(...d)=>{e.viewportResize&&e.viewportResize(...d),o(...d)},s.inputCb=(...d)=>{e.input&&e.input(...d),l(...d)},s.mediaInteractionCb=(...d)=>{e.mediaInteaction&&e.mediaInteaction(...d),a(...d)},s.styleSheetRuleCb=(...d)=>{e.styleSheetRule&&e.styleSheetRule(...d),u(...d)},s.styleDeclarationCb=(...d)=>{e.styleDeclaration&&e.styleDeclaration(...d),c(...d)},s.canvasMutationCb=(...d)=>{e.canvasMutation&&e.canvasMutation(...d),h(...d)},s.fontCb=(...d)=>{e.font&&e.font(...d),p(...d)},s.selectionCb=(...d)=>{e.selection&&e.selection(...d),m(...d)},s.customElementCb=(...d)=>{e.customElement&&e.customElement(...d),g(...d)}}function qh(s,e={}){const t=s.doc.defaultView;if(!t)return()=>{};Qh(s,e);let r;s.recordDOM&&(r=xo(s,s.doc));const i=zh(s),n=Wh(s),o=Oo(s),l=Gh(s,{win:t}),a=jh(s),u=Zh(s);let c=()=>{},h=()=>{},p=()=>{},m=()=>{};s.recordDOM&&(c=Yh(s,{win:t}),h=Eo(s,s.doc),p=Hh(s,{win:t}),s.collectFonts&&(m=Jh(s)));const g=Kh(s),d=Xh(s),f=[];for(const b of s.plugins)f.push(b.observer(b.callback,t,b.options));return x(()=>{Ee.forEach(b=>b.reset()),r==null||r.disconnect(),i(),n(),o(),l(),a(),u(),c(),h(),p(),m(),g(),d(),f.forEach(b=>b())})}function fr(s){return typeof window[s]<"u"}function dr(s){return!!(typeof window[s]<"u"&&window[s].prototype&&"insertRule"in window[s].prototype&&"deleteRule"in window[s].prototype)}class Ao{constructor(e){w(this,"iframeIdToRemoteIdMap",new WeakMap),w(this,"iframeRemoteIdToIdMap",new WeakMap),this.generateIdFn=e}getId(e,t,r,i){const n=r||this.getIdToRemoteIdMap(e),o=i||this.getRemoteIdToIdMap(e);let l=n.get(t);return l||(l=this.generateIdFn(),n.set(t,l),o.set(l,t)),l}getIds(e,t){const r=this.getIdToRemoteIdMap(e),i=this.getRemoteIdToIdMap(e);return t.map(n=>this.getId(e,n,r,i))}getRemoteId(e,t,r){const i=r||this.getRemoteIdToIdMap(e);if(typeof t!="number")return t;const n=i.get(t);return n||-1}getRemoteIds(e,t){const r=this.getRemoteIdToIdMap(e);return t.map(i=>this.getRemoteId(e,i,r))}reset(e){if(!e){this.iframeIdToRemoteIdMap=new WeakMap,this.iframeRemoteIdToIdMap=new WeakMap;return}this.iframeIdToRemoteIdMap.delete(e),this.iframeRemoteIdToIdMap.delete(e)}getIdToRemoteIdMap(e){let t=this.iframeIdToRemoteIdMap.get(e);return t||(t=new Map,this.iframeIdToRemoteIdMap.set(e,t)),t}getRemoteIdToIdMap(e){let t=this.iframeRemoteIdToIdMap.get(e);return t||(t=new Map,this.iframeRemoteIdToIdMap.set(e,t)),t}}class ef{constructor(e){w(this,"iframes",new WeakMap),w(this,"crossOriginIframeMap",new WeakMap),w(this,"crossOriginIframeMirror",new Ao(ti)),w(this,"crossOriginIframeStyleMirror"),w(this,"crossOriginIframeRootIdMap",new WeakMap),w(this,"mirror"),w(this,"mutationCb"),w(this,"wrappedEmit"),w(this,"loadListener"),w(this,"stylesheetManager"),w(this,"recordCrossOriginIframes"),this.mutationCb=e.mutationCb,this.wrappedEmit=e.wrappedEmit,this.stylesheetManager=e.stylesheetManager,this.recordCrossOriginIframes=e.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new Ao(this.stylesheetManager.styleMirror.generateId.bind(this.stylesheetManager.styleMirror)),this.mirror=e.mirror,this.recordCrossOriginIframes&&window.addEventListener("message",this.handleMessage.bind(this))}addIframe(e){this.iframes.set(e,!0),e.contentWindow&&this.crossOriginIframeMap.set(e.contentWindow,e)}addLoadListener(e){this.loadListener=e}attachIframe(e,t){var r,i;this.mutationCb({adds:[{parentId:this.mirror.getId(e),nextId:null,node:t}],removes:[],texts:[],attributes:[],isAttachIframe:!0}),this.recordCrossOriginIframes&&((r=e.contentWindow)==null||r.addEventListener("message",this.handleMessage.bind(this))),(i=this.loadListener)==null||i.call(this,e),e.contentDocument&&e.contentDocument.adoptedStyleSheets&&e.contentDocument.adoptedStyleSheets.length>0&&this.stylesheetManager.adoptStyleSheets(e.contentDocument.adoptedStyleSheets,this.mirror.getId(e.contentDocument))}handleMessage(e){const t=e;if(t.data.type!=="rrweb"||t.origin!==t.data.origin||!e.source)return;const i=this.crossOriginIframeMap.get(e.source);if(!i)return;const n=this.transformCrossOriginEvent(i,t.data.event);n&&this.wrappedEmit(n,t.data.isCheckout)}transformCrossOriginEvent(e,t){var r;switch(t.type){case O.FullSnapshot:{this.crossOriginIframeMirror.reset(e),this.crossOriginIframeStyleMirror.reset(e),this.replaceIdOnNode(t.data.node,e);const i=t.data.node.id;return this.crossOriginIframeRootIdMap.set(e,i),this.patchRootIdOnNode(t.data.node,i),{timestamp:t.timestamp,type:O.IncrementalSnapshot,data:{source:I.Mutation,adds:[{parentId:this.mirror.getId(e),nextId:null,node:t.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}}}case O.Meta:case O.Load:case O.DomContentLoaded:return!1;case O.Plugin:return t;case O.Custom:return this.replaceIds(t.data.payload,e,["id","parentId","previousId","nextId"]),t;case O.IncrementalSnapshot:switch(t.data.source){case I.Mutation:return t.data.adds.forEach(i=>{this.replaceIds(i,e,["parentId","nextId","previousId"]),this.replaceIdOnNode(i.node,e);const n=this.crossOriginIframeRootIdMap.get(e);n&&this.patchRootIdOnNode(i.node,n)}),t.data.removes.forEach(i=>{this.replaceIds(i,e,["parentId","id"])}),t.data.attributes.forEach(i=>{this.replaceIds(i,e,["id"])}),t.data.texts.forEach(i=>{this.replaceIds(i,e,["id"])}),t;case I.Drag:case I.TouchMove:case I.MouseMove:return t.data.positions.forEach(i=>{this.replaceIds(i,e,["id"])}),t;case I.ViewportResize:return!1;case I.MediaInteraction:case I.MouseInteraction:case I.Scroll:case I.CanvasMutation:case I.Input:return this.replaceIds(t.data,e,["id"]),t;case I.StyleSheetRule:case I.StyleDeclaration:return this.replaceIds(t.data,e,["id"]),this.replaceStyleIds(t.data,e,["styleId"]),t;case I.Font:return t;case I.Selection:return t.data.ranges.forEach(i=>{this.replaceIds(i,e,["start","end"])}),t;case I.AdoptedStyleSheet:return this.replaceIds(t.data,e,["id"]),this.replaceStyleIds(t.data,e,["styleIds"]),(r=t.data.styles)==null||r.forEach(i=>{this.replaceStyleIds(i,e,["styleId"])}),t}}return!1}replace(e,t,r,i){for(const n of i)!Array.isArray(t[n])&&typeof t[n]!="number"||(Array.isArray(t[n])?t[n]=e.getIds(r,t[n]):t[n]=e.getId(r,t[n]));return t}replaceIds(e,t,r){return this.replace(this.crossOriginIframeMirror,e,t,r)}replaceStyleIds(e,t,r){return this.replace(this.crossOriginIframeStyleMirror,e,t,r)}replaceIdOnNode(e,t){this.replaceIds(e,t,["id","rootId"]),"childNodes"in e&&e.childNodes.forEach(r=>{this.replaceIdOnNode(r,t)})}patchRootIdOnNode(e,t){e.type!==wo.Document&&!e.rootId&&(e.rootId=t),"childNodes"in e&&e.childNodes.forEach(r=>{this.patchRootIdOnNode(r,t)})}}class tf{constructor(e){w(this,"shadowDoms",new WeakSet),w(this,"mutationCb"),w(this,"scrollCb"),w(this,"bypassOptions"),w(this,"mirror"),w(this,"restoreHandlers",[]),this.mutationCb=e.mutationCb,this.scrollCb=e.scrollCb,this.bypassOptions=e.bypassOptions,this.mirror=e.mirror,this.init()}init(){this.reset(),this.patchAttachShadow(Element,document)}addShadowRoot(e,t){if(!He(e)||this.shadowDoms.has(e))return;this.shadowDoms.add(e);const r=xo({...this.bypassOptions,doc:t,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this},e);this.restoreHandlers.push(()=>r.disconnect()),this.restoreHandlers.push(Oo({...this.bypassOptions,scrollCb:this.scrollCb,doc:e,mirror:this.mirror})),setTimeout(()=>{e.adoptedStyleSheets&&e.adoptedStyleSheets.length>0&&this.bypassOptions.stylesheetManager.adoptStyleSheets(e.adoptedStyleSheets,this.mirror.getId(v.host(e))),this.restoreHandlers.push(Eo({mirror:this.mirror,stylesheetManager:this.bypassOptions.stylesheetManager},e))},0)}observeAttachShadow(e){!e.contentWindow||!e.contentDocument||this.patchAttachShadow(e.contentWindow.Element,e.contentDocument)}patchAttachShadow(e,t){const r=this;this.restoreHandlers.push(Re(e.prototype,"attachShadow",function(i){return function(n){const o=i.call(this,n),l=v.shadowRoot(this);return l&&yo(this)&&r.addShadowRoot(l,t),o}}))}reset(){this.restoreHandlers.forEach(e=>{try{e()}catch{}}),this.restoreHandlers=[],this.shadowDoms=new WeakSet}}for(var Ve="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",rf=typeof Uint8Array>"u"?[]:new Uint8Array(256),pr=0;pr<Ve.length;pr++)rf[Ve.charCodeAt(pr)]=pr;var sf=function(s){var e=new Uint8Array(s),t,r=e.length,i="";for(t=0;t<r;t+=3)i+=Ve[e[t]>>2],i+=Ve[(e[t]&3)<<4|e[t+1]>>4],i+=Ve[(e[t+1]&15)<<2|e[t+2]>>6],i+=Ve[e[t+2]&63];return r%3===2?i=i.substring(0,i.length-1)+"=":r%3===1&&(i=i.substring(0,i.length-2)+"=="),i};const Mo=new Map;function nf(s,e){let t=Mo.get(s);return t||(t=new Map,Mo.set(s,t)),t.has(e)||t.set(e,[]),t.get(e)}const $o=(s,e,t)=>{if(!s||!(ko(s,e)||typeof s=="object"))return;const r=s.constructor.name,i=nf(t,r);let n=i.indexOf(s);return n===-1&&(n=i.length,i.push(s)),n};function mr(s,e,t){if(s instanceof Array)return s.map(r=>mr(r,e,t));if(s===null)return s;if(s instanceof Float32Array||s instanceof Float64Array||s instanceof Int32Array||s instanceof Uint32Array||s instanceof Uint8Array||s instanceof Uint16Array||s instanceof Int16Array||s instanceof Int8Array||s instanceof Uint8ClampedArray)return{rr_type:s.constructor.name,args:[Object.values(s)]};if(s instanceof ArrayBuffer){const r=s.constructor.name,i=sf(s);return{rr_type:r,base64:i}}else{if(s instanceof DataView)return{rr_type:s.constructor.name,args:[mr(s.buffer,e,t),s.byteOffset,s.byteLength]};if(s instanceof HTMLImageElement){const r=s.constructor.name,{src:i}=s;return{rr_type:r,src:i}}else if(s instanceof HTMLCanvasElement){const r="HTMLImageElement",i=s.toDataURL();return{rr_type:r,src:i}}else{if(s instanceof ImageData)return{rr_type:s.constructor.name,args:[mr(s.data,e,t),s.width,s.height]};if(ko(s,e)||typeof s=="object"){const r=s.constructor.name,i=$o(s,e,t);return{rr_type:r,index:i}}}}return s}const No=(s,e,t)=>s.map(r=>mr(r,e,t)),ko=(s,e)=>!!["WebGLActiveInfo","WebGLBuffer","WebGLFramebuffer","WebGLProgram","WebGLRenderbuffer","WebGLShader","WebGLShaderPrecisionFormat","WebGLTexture","WebGLUniformLocation","WebGLVertexArrayObject","WebGLVertexArrayObjectOES"].filter(i=>typeof e[i]=="function").find(i=>s instanceof e[i]);function of(s,e,t,r){const i=[],n=Object.getOwnPropertyNames(e.CanvasRenderingContext2D.prototype);for(const o of n)try{if(typeof e.CanvasRenderingContext2D.prototype[o]!="function")continue;const l=Re(e.CanvasRenderingContext2D.prototype,o,function(a){return function(...u){return X(this.canvas,t,r,!0)||setTimeout(()=>{const c=No(u,e,this);s(this.canvas,{type:We["2D"],property:o,args:c})},0),a.apply(this,u)}});i.push(l)}catch{const l=ur(e.CanvasRenderingContext2D.prototype,o,{set(a){s(this.canvas,{type:We["2D"],property:o,args:[a],setter:!0})}});i.push(l)}return()=>{i.forEach(o=>o())}}function af(s){return s==="experimental-webgl"?"webgl":s}function To(s,e,t,r){const i=[];try{const n=Re(s.HTMLCanvasElement.prototype,"getContext",function(o){return function(l,...a){if(!X(this,e,t,!0)){const u=af(l);if("__context"in this||(this.__context=u),r&&["webgl","webgl2"].includes(u))if(a[0]&&typeof a[0]=="object"){const c=a[0];c.preserveDrawingBuffer||(c.preserveDrawingBuffer=!0)}else a.splice(0,1,{preserveDrawingBuffer:!0})}return o.apply(this,[l,...a])}});i.push(n)}catch{console.error("failed to patch HTMLCanvasElement.prototype.getContext")}return()=>{i.forEach(n=>n())}}function Po(s,e,t,r,i,n){const o=[],l=Object.getOwnPropertyNames(s);for(const a of l)if(!["isContextLost","canvas","drawingBufferWidth","drawingBufferHeight"].includes(a))try{if(typeof s[a]!="function")continue;const u=Re(s,a,function(c){return function(...h){const p=c.apply(this,h);if($o(p,n,this),"tagName"in this.canvas&&!X(this.canvas,r,i,!0)){const m=No(h,n,this),g={type:e,property:a,args:m};t(this.canvas,g)}return p}});o.push(u)}catch{const u=ur(s,a,{set(c){t(this.canvas,{type:e,property:a,args:[c],setter:!0})}});o.push(u)}return o}function lf(s,e,t,r){const i=[];return i.push(...Po(e.WebGLRenderingContext.prototype,We.WebGL,s,t,r,e)),typeof e.WebGL2RenderingContext<"u"&&i.push(...Po(e.WebGL2RenderingContext.prototype,We.WebGL2,s,t,r,e)),()=>{i.forEach(n=>n())}}const Do="KGZ1bmN0aW9uKCkgewogICJ1c2Ugc3RyaWN0IjsKICB2YXIgY2hhcnMgPSAiQUJDREVGR0hJSktMTU5PUFFSU1RVVldYWVphYmNkZWZnaGlqa2xtbm9wcXJzdHV2d3h5ejAxMjM0NTY3ODkrLyI7CiAgdmFyIGxvb2t1cCA9IHR5cGVvZiBVaW50OEFycmF5ID09PSAidW5kZWZpbmVkIiA/IFtdIDogbmV3IFVpbnQ4QXJyYXkoMjU2KTsKICBmb3IgKHZhciBpID0gMDsgaSA8IGNoYXJzLmxlbmd0aDsgaSsrKSB7CiAgICBsb29rdXBbY2hhcnMuY2hhckNvZGVBdChpKV0gPSBpOwogIH0KICB2YXIgZW5jb2RlID0gZnVuY3Rpb24oYXJyYXlidWZmZXIpIHsKICAgIHZhciBieXRlcyA9IG5ldyBVaW50OEFycmF5KGFycmF5YnVmZmVyKSwgaTIsIGxlbiA9IGJ5dGVzLmxlbmd0aCwgYmFzZTY0ID0gIiI7CiAgICBmb3IgKGkyID0gMDsgaTIgPCBsZW47IGkyICs9IDMpIHsKICAgICAgYmFzZTY0ICs9IGNoYXJzW2J5dGVzW2kyXSA+PiAyXTsKICAgICAgYmFzZTY0ICs9IGNoYXJzWyhieXRlc1tpMl0gJiAzKSA8PCA0IHwgYnl0ZXNbaTIgKyAxXSA+PiA0XTsKICAgICAgYmFzZTY0ICs9IGNoYXJzWyhieXRlc1tpMiArIDFdICYgMTUpIDw8IDIgfCBieXRlc1tpMiArIDJdID4+IDZdOwogICAgICBiYXNlNjQgKz0gY2hhcnNbYnl0ZXNbaTIgKyAyXSAmIDYzXTsKICAgIH0KICAgIGlmIChsZW4gJSAzID09PSAyKSB7CiAgICAgIGJhc2U2NCA9IGJhc2U2NC5zdWJzdHJpbmcoMCwgYmFzZTY0Lmxlbmd0aCAtIDEpICsgIj0iOwogICAgfSBlbHNlIGlmIChsZW4gJSAzID09PSAxKSB7CiAgICAgIGJhc2U2NCA9IGJhc2U2NC5zdWJzdHJpbmcoMCwgYmFzZTY0Lmxlbmd0aCAtIDIpICsgIj09IjsKICAgIH0KICAgIHJldHVybiBiYXNlNjQ7CiAgfTsKICBjb25zdCBsYXN0QmxvYk1hcCA9IC8qIEBfX1BVUkVfXyAqLyBuZXcgTWFwKCk7CiAgY29uc3QgdHJhbnNwYXJlbnRCbG9iTWFwID0gLyogQF9fUFVSRV9fICovIG5ldyBNYXAoKTsKICBhc3luYyBmdW5jdGlvbiBnZXRUcmFuc3BhcmVudEJsb2JGb3Iod2lkdGgsIGhlaWdodCwgZGF0YVVSTE9wdGlvbnMpIHsKICAgIGNvbnN0IGlkID0gYCR7d2lkdGh9LSR7aGVpZ2h0fWA7CiAgICBpZiAoIk9mZnNjcmVlbkNhbnZhcyIgaW4gZ2xvYmFsVGhpcykgewogICAgICBpZiAodHJhbnNwYXJlbnRCbG9iTWFwLmhhcyhpZCkpIHJldHVybiB0cmFuc3BhcmVudEJsb2JNYXAuZ2V0KGlkKTsKICAgICAgY29uc3Qgb2Zmc2NyZWVuID0gbmV3IE9mZnNjcmVlbkNhbnZhcyh3aWR0aCwgaGVpZ2h0KTsKICAgICAgb2Zmc2NyZWVuLmdldENvbnRleHQoIjJkIik7CiAgICAgIGNvbnN0IGJsb2IgPSBhd2FpdCBvZmZzY3JlZW4uY29udmVydFRvQmxvYihkYXRhVVJMT3B0aW9ucyk7CiAgICAgIGNvbnN0IGFycmF5QnVmZmVyID0gYXdhaXQgYmxvYi5hcnJheUJ1ZmZlcigpOwogICAgICBjb25zdCBiYXNlNjQgPSBlbmNvZGUoYXJyYXlCdWZmZXIpOwogICAgICB0cmFuc3BhcmVudEJsb2JNYXAuc2V0KGlkLCBiYXNlNjQpOwogICAgICByZXR1cm4gYmFzZTY0OwogICAgfSBlbHNlIHsKICAgICAgcmV0dXJuICIiOwogICAgfQogIH0KICBjb25zdCB3b3JrZXIgPSBzZWxmOwogIHdvcmtlci5vbm1lc3NhZ2UgPSBhc3luYyBmdW5jdGlvbihlKSB7CiAgICBpZiAoIk9mZnNjcmVlbkNhbnZhcyIgaW4gZ2xvYmFsVGhpcykgewogICAgICBjb25zdCB7IGlkLCBiaXRtYXAsIHdpZHRoLCBoZWlnaHQsIGRhdGFVUkxPcHRpb25zIH0gPSBlLmRhdGE7CiAgICAgIGNvbnN0IHRyYW5zcGFyZW50QmFzZTY0ID0gZ2V0VHJhbnNwYXJlbnRCbG9iRm9yKAogICAgICAgIHdpZHRoLAogICAgICAgIGhlaWdodCwKICAgICAgICBkYXRhVVJMT3B0aW9ucwogICAgICApOwogICAgICBjb25zdCBvZmZzY3JlZW4gPSBuZXcgT2Zmc2NyZWVuQ2FudmFzKHdpZHRoLCBoZWlnaHQpOwogICAgICBjb25zdCBjdHggPSBvZmZzY3JlZW4uZ2V0Q29udGV4dCgiMmQiKTsKICAgICAgY3R4LmRyYXdJbWFnZShiaXRtYXAsIDAsIDApOwogICAgICBiaXRtYXAuY2xvc2UoKTsKICAgICAgY29uc3QgYmxvYiA9IGF3YWl0IG9mZnNjcmVlbi5jb252ZXJ0VG9CbG9iKGRhdGFVUkxPcHRpb25zKTsKICAgICAgY29uc3QgdHlwZSA9IGJsb2IudHlwZTsKICAgICAgY29uc3QgYXJyYXlCdWZmZXIgPSBhd2FpdCBibG9iLmFycmF5QnVmZmVyKCk7CiAgICAgIGNvbnN0IGJhc2U2NCA9IGVuY29kZShhcnJheUJ1ZmZlcik7CiAgICAgIGlmICghbGFzdEJsb2JNYXAuaGFzKGlkKSAmJiBhd2FpdCB0cmFuc3BhcmVudEJhc2U2NCA9PT0gYmFzZTY0KSB7CiAgICAgICAgbGFzdEJsb2JNYXAuc2V0KGlkLCBiYXNlNjQpOwogICAgICAgIHJldHVybiB3b3JrZXIucG9zdE1lc3NhZ2UoeyBpZCB9KTsKICAgICAgfQogICAgICBpZiAobGFzdEJsb2JNYXAuZ2V0KGlkKSA9PT0gYmFzZTY0KSByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQgfSk7CiAgICAgIHdvcmtlci5wb3N0TWVzc2FnZSh7CiAgICAgICAgaWQsCiAgICAgICAgdHlwZSwKICAgICAgICBiYXNlNjQsCiAgICAgICAgd2lkdGgsCiAgICAgICAgaGVpZ2h0CiAgICAgIH0pOwogICAgICBsYXN0QmxvYk1hcC5zZXQoaWQsIGJhc2U2NCk7CiAgICB9IGVsc2UgewogICAgICByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQ6IGUuZGF0YS5pZCB9KTsKICAgIH0KICB9Owp9KSgpOwovLyMgc291cmNlTWFwcGluZ1VSTD1pbWFnZS1iaXRtYXAtZGF0YS11cmwtd29ya2VyLUlKcEM3Z19iLmpzLm1hcAo=",uf=s=>Uint8Array.from(atob(s),e=>e.charCodeAt(0)),Lo=typeof window<"u"&&window.Blob&&new Blob([uf(Do)],{type:"text/javascript;charset=utf-8"});function cf(s){let e;try{if(e=Lo&&(window.URL||window.webkitURL).createObjectURL(Lo),!e)throw"";const t=new Worker(e,{name:s==null?void 0:s.name});return t.addEventListener("error",()=>{(window.URL||window.webkitURL).revokeObjectURL(e)}),t}catch{return new Worker("data:text/javascript;base64,"+Do,{name:s==null?void 0:s.name})}finally{e&&(window.URL||window.webkitURL).revokeObjectURL(e)}}class hf{constructor(e){w(this,"pendingCanvasMutations",new Map),w(this,"rafStamps",{latestId:0,invokeId:null}),w(this,"mirror"),w(this,"mutationCb"),w(this,"resetObservers"),w(this,"frozen",!1),w(this,"locked",!1),w(this,"processMutation",(a,u)=>{(this.rafStamps.invokeId&&this.rafStamps.latestId!==this.rafStamps.invokeId||!this.rafStamps.invokeId)&&(this.rafStamps.invokeId=this.rafStamps.latestId),this.pendingCanvasMutations.has(a)||this.pendingCanvasMutations.set(a,[]),this.pendingCanvasMutations.get(a).push(u)});const{sampling:t="all",win:r,blockClass:i,blockSelector:n,recordCanvas:o,dataURLOptions:l}=e;this.mutationCb=e.mutationCb,this.mirror=e.mirror,o&&t==="all"&&this.initCanvasMutationObserver(r,i,n),o&&typeof t=="number"&&this.initCanvasFPSObserver(t,r,i,n,{dataURLOptions:l})}reset(){this.pendingCanvasMutations.clear(),this.resetObservers&&this.resetObservers()}freeze(){this.frozen=!0}unfreeze(){this.frozen=!1}lock(){this.locked=!0}unlock(){this.locked=!1}initCanvasFPSObserver(e,t,r,i,n){const o=To(t,r,i,!0),l=new Map,a=new cf;a.onmessage=g=>{const{id:d}=g.data;if(l.set(d,!1),!("base64"in g.data))return;const{base64:f,type:b,width:S,height:y}=g.data;this.mutationCb({id:d,type:We["2D"],commands:[{property:"clearRect",args:[0,0,S,y]},{property:"drawImage",args:[{rr_type:"ImageBitmap",args:[{rr_type:"Blob",data:[{rr_type:"ArrayBuffer",base64:f}],type:b}]},0,0]}]})};const u=1e3/e;let c=0,h;const p=()=>{const g=[];return t.document.querySelectorAll("canvas").forEach(d=>{X(d,r,i,!0)||g.push(d)}),g},m=g=>{if(c&&g-c<u){h=requestAnimationFrame(m);return}c=g,p().forEach(async d=>{var f;const b=this.mirror.getId(d);if(l.get(b)||d.width===0||d.height===0)return;if(l.set(b,!0),["webgl","webgl2"].includes(d.__context)){const y=d.getContext(d.__context);((f=y==null?void 0:y.getContextAttributes())==null?void 0:f.preserveDrawingBuffer)===!1&&y.clear(y.COLOR_BUFFER_BIT)}const S=await createImageBitmap(d);a.postMessage({id:b,bitmap:S,width:d.width,height:d.height,dataURLOptions:n.dataURLOptions},[S])}),h=requestAnimationFrame(m)};h=requestAnimationFrame(m),this.resetObservers=()=>{o(),cancelAnimationFrame(h)}}initCanvasMutationObserver(e,t,r){this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher();const i=To(e,t,r,!1),n=of(this.processMutation.bind(this),e,t,r),o=lf(this.processMutation.bind(this),e,t,r);this.resetObservers=()=>{i(),n(),o()}}startPendingCanvasMutationFlusher(){requestAnimationFrame(()=>this.flushPendingCanvasMutations())}startRAFTimestamping(){const e=t=>{this.rafStamps.latestId=t,requestAnimationFrame(e)};requestAnimationFrame(e)}flushPendingCanvasMutations(){this.pendingCanvasMutations.forEach((e,t)=>{const r=this.mirror.getId(t);this.flushPendingCanvasMutationFor(t,r)}),requestAnimationFrame(()=>this.flushPendingCanvasMutations())}flushPendingCanvasMutationFor(e,t){if(this.frozen||this.locked)return;const r=this.pendingCanvasMutations.get(e);if(!r||t===-1)return;const i=r.map(o=>{const{type:l,...a}=o;return a}),{type:n}=r[0];this.mutationCb({id:t,type:n,commands:i}),this.pendingCanvasMutations.delete(e)}}class ff{constructor(e){w(this,"trackedLinkElements",new WeakSet),w(this,"mutationCb"),w(this,"adoptedStyleSheetCb"),w(this,"styleMirror",new kh),this.mutationCb=e.mutationCb,this.adoptedStyleSheetCb=e.adoptedStyleSheetCb}attachLinkElement(e,t){"_cssText"in t.attributes&&this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:t.id,attributes:t.attributes}]}),this.trackLinkElement(e)}trackLinkElement(e){this.trackedLinkElements.has(e)||(this.trackedLinkElements.add(e),this.trackStylesheetInLinkElement(e))}adoptStyleSheets(e,t){if(e.length===0)return;const r={id:t,styleIds:[]},i=[];for(const n of e){let o;this.styleMirror.has(n)?o=this.styleMirror.getId(n):(o=this.styleMirror.add(n),i.push({styleId:o,rules:Array.from(n.rules||CSSRule,(l,a)=>({rule:Xs(l,n.href),index:a}))})),r.styleIds.push(o)}i.length>0&&(r.styles=i),this.adoptedStyleSheetCb(r)}reset(){this.styleMirror.reset(),this.trackedLinkElements=new WeakSet}trackStylesheetInLinkElement(e){}}class df{constructor(){w(this,"nodeMap",new WeakMap),w(this,"active",!1)}inOtherBuffer(e,t){const r=this.nodeMap.get(e);return r&&Array.from(r).some(i=>i!==t)}add(e,t){this.active||(this.active=!0,requestAnimationFrame(()=>{this.nodeMap=new WeakMap,this.active=!1})),this.nodeMap.set(e,(this.nodeMap.get(e)||new Set).add(t))}destroy(){}}let z,gr,Us,yr=!1;try{if(Array.from([1],s=>s*2)[0]!==2){const s=document.createElement("iframe");document.body.appendChild(s),Array.from=((js=s.contentWindow)==null?void 0:js.Array.from)||Array.from,document.body.removeChild(s)}}catch(s){console.debug("Unable to override Array.from",s)}const ae=Sa();function he(s={}){const{emit:e,checkoutEveryNms:t,checkoutEveryNth:r,blockClass:i="rr-block",blockSelector:n=null,ignoreClass:o="rr-ignore",ignoreSelector:l=null,maskTextClass:a="rr-mask",maskTextSelector:u=null,inlineStylesheet:c=!0,maskAllInputs:h,maskInputOptions:p,slimDOMOptions:m,maskInputFn:g,maskTextFn:d,hooks:f,packFn:b,sampling:S={},dataURLOptions:y={},mousemoveWait:C,recordDOM:N=!0,recordCanvas:D=!1,recordCrossOriginIframes:Y=!1,recordAfter:B=s.recordAfter==="DOMContentLoaded"?s.recordAfter:"load",userTriggeredOnInput:V=!1,collectFonts:Z=!1,inlineImages:se=!1,plugins:de,keepIframeSrcFn:R=()=>!1,ignoreCSSAttributes:pt=new Set([]),errorHandler:mt}=s;Uh(mt);const H=Y?window.parent===window:!0;let ie=!1;if(!H)try{window.parent.document&&(ie=!1)}catch{ie=!0}if(H&&!e)throw new Error("emit function is required");if(!H&&!ie)return()=>{};C!==void 0&&S.mousemove===void 0&&(S.mousemove=C),ae.reset();const Me=h===!0?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,password:!0}:p!==void 0?p:{password:!0},pe=ai(m);Nh();let Bo,zs=0;const zo=E=>{for(const le of de||[])le.eventProcessor&&(E=le.eventProcessor(E));return b&&!ie&&(E=b(E)),E};z=(E,le)=>{var W;const G=E;if(G.timestamp=cr(),(W=Ee[0])!=null&&W.isFrozen()&&G.type!==O.FullSnapshot&&!(G.type===O.IncrementalSnapshot&&G.data.source===I.Mutation)&&Ee.forEach(ee=>ee.unfreeze()),H)e==null||e(zo(G),le);else if(ie){const ee={type:"rrweb",event:zo(G),origin:window.location.origin,isCheckout:le};window.parent.postMessage(ee,"*")}if(G.type===O.FullSnapshot)Bo=G,zs=0;else if(G.type===O.IncrementalSnapshot){if(G.data.source===I.Mutation&&G.data.isAttachIframe)return;zs++;const ee=r&&zs>=r,k=t&&G.timestamp-Bo.timestamp>t;(ee||k)&&gr(!0)}};const Sr=E=>{z({type:O.IncrementalSnapshot,data:{source:I.Mutation,...E}})},Wo=E=>z({type:O.IncrementalSnapshot,data:{source:I.Scroll,...E}}),Go=E=>z({type:O.IncrementalSnapshot,data:{source:I.CanvasMutation,...E}}),Bf=E=>z({type:O.IncrementalSnapshot,data:{source:I.AdoptedStyleSheet,...E}}),$e=new ff({mutationCb:Sr,adoptedStyleSheetCb:Bf}),Ne=new ef({mirror:ae,mutationCb:Sr,stylesheetManager:$e,recordCrossOriginIframes:Y,wrappedEmit:z});for(const E of de||[])E.getMirror&&E.getMirror({nodeMirror:ae,crossOriginIframeMirror:Ne.crossOriginIframeMirror,crossOriginIframeStyleMirror:Ne.crossOriginIframeStyleMirror});const Ws=new df;Us=new hf({recordCanvas:D,mutationCb:Go,win:window,blockClass:i,blockSelector:n,mirror:ae,sampling:S.canvas,dataURLOptions:y});const Cr=new tf({mutationCb:Sr,scrollCb:Wo,bypassOptions:{blockClass:i,blockSelector:n,maskTextClass:a,maskTextSelector:u,inlineStylesheet:c,maskInputOptions:Me,dataURLOptions:y,maskTextFn:d,maskInputFn:g,recordCanvas:D,inlineImages:se,sampling:S,slimDOMOptions:pe,iframeManager:Ne,stylesheetManager:$e,canvasManager:Us,keepIframeSrcFn:R,processedNodeManager:Ws},mirror:ae});gr=(E=!1)=>{if(!N)return;z({type:O.Meta,data:{href:window.location.href,width:co(),height:uo()}},E),$e.reset(),Cr.init(),Ee.forEach(W=>W.lock());const le=Va(document,{mirror:ae,blockClass:i,blockSelector:n,maskTextClass:a,maskTextSelector:u,inlineStylesheet:c,maskAllInputs:Me,maskTextFn:d,maskInputFn:g,slimDOM:pe,dataURLOptions:y,recordCanvas:D,inlineImages:se,onSerialize:W=>{po(W,ae)&&Ne.addIframe(W),mo(W,ae)&&$e.trackLinkElement(W),_s(W)&&Cr.addShadowRoot(v.shadowRoot(W),document)},onIframeLoad:(W,G)=>{Ne.attachIframe(W,G),Cr.observeAttachShadow(W)},onStylesheetLoad:(W,G)=>{$e.attachLinkElement(W,G)},keepIframeSrcFn:R});if(!le)return console.warn("Failed to snapshot the document");z({type:O.FullSnapshot,data:{node:le,initialOffset:lo(window)}},E),Ee.forEach(W=>W.unlock()),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&$e.adoptStyleSheets(document.adoptedStyleSheets,ae.getId(document))};try{const E=[],le=G=>{var ee;return x(qh)({mutationCb:Sr,mousemoveCb:(k,Gs)=>z({type:O.IncrementalSnapshot,data:{source:Gs,positions:k}}),mouseInteractionCb:k=>z({type:O.IncrementalSnapshot,data:{source:I.MouseInteraction,...k}}),scrollCb:Wo,viewportResizeCb:k=>z({type:O.IncrementalSnapshot,data:{source:I.ViewportResize,...k}}),inputCb:k=>z({type:O.IncrementalSnapshot,data:{source:I.Input,...k}}),mediaInteractionCb:k=>z({type:O.IncrementalSnapshot,data:{source:I.MediaInteraction,...k}}),styleSheetRuleCb:k=>z({type:O.IncrementalSnapshot,data:{source:I.StyleSheetRule,...k}}),styleDeclarationCb:k=>z({type:O.IncrementalSnapshot,data:{source:I.StyleDeclaration,...k}}),canvasMutationCb:Go,fontCb:k=>z({type:O.IncrementalSnapshot,data:{source:I.Font,...k}}),selectionCb:k=>{z({type:O.IncrementalSnapshot,data:{source:I.Selection,...k}})},customElementCb:k=>{z({type:O.IncrementalSnapshot,data:{source:I.CustomElement,...k}})},blockClass:i,ignoreClass:o,ignoreSelector:l,maskTextClass:a,maskTextSelector:u,maskInputOptions:Me,inlineStylesheet:c,sampling:S,recordDOM:N,recordCanvas:D,inlineImages:se,userTriggeredOnInput:V,collectFonts:Z,doc:G,maskInputFn:g,maskTextFn:d,keepIframeSrcFn:R,blockSelector:n,slimDOMOptions:pe,dataURLOptions:y,mirror:ae,iframeManager:Ne,stylesheetManager:$e,shadowDomManager:Cr,processedNodeManager:Ws,canvasManager:Us,ignoreCSSAttributes:pt,plugins:((ee=de==null?void 0:de.filter(k=>k.observer))==null?void 0:ee.map(k=>({observer:k.observer,options:k.options,callback:Gs=>z({type:O.Plugin,data:{plugin:k.name,payload:Gs}})})))||[]},f)};Ne.addLoadListener(G=>{try{E.push(le(G.contentDocument))}catch(ee){console.warn(ee)}});const W=()=>{gr(),E.push(le(document)),yr=!0};return["interactive","complete"].includes(document.readyState)?W():(E.push(K("DOMContentLoaded",()=>{z({type:O.DomContentLoaded,data:{}}),B==="DOMContentLoaded"&&W()})),E.push(K("load",()=>{z({type:O.Load,data:{}}),B==="load"&&W()},window))),()=>{E.forEach(G=>{try{G()}catch(ee){String(ee).toLowerCase().includes("cross-origin")||console.warn(ee)}}),Ws.destroy(),yr=!1,Bh()}}catch(E){console.warn(E)}}he.addCustomEvent=(s,e)=>{if(!yr)throw new Error("please add custom event after start recording");z({type:O.Custom,data:{tag:s,payload:e}})},he.freezePage=()=>{Ee.forEach(s=>s.freeze())},he.takeFullSnapshot=s=>{if(!yr)throw new Error("please take full snapshot after start recording");gr(s)},he.mirror=ae;var _o;(function(s){s[s.NotStarted=0]="NotStarted",s[s.Running=1]="Running",s[s.Stopped=2]="Stopped"})(_o||(_o={}));const{addCustomEvent:qf}=he,{freezePage:ed}=he,{takeFullSnapshot:td}=he;async function pf(s){const t=new TextEncoder().encode(s),r=new CompressionStream("gzip"),i=r.writable.getWriter();i.write(t),i.close();const n=r.readable.getReader(),o=[];let l=0;for(;;){const{done:c,value:h}=await n.read();if(c)break;o.push(h),l+=h.length}const a=new Uint8Array(l);let u=0;for(const c of o)a.set(c,u),u+=c.length;return a}async function mf(s,e,t){const r=await pf(t);return(await fetch(s,{method:"POST",headers:{"Content-Type":"application/json","Content-Encoding":"gzip",Authorization:`Bearer ${e}`},body:r})).status===200}var gf=class{constructor(s={}){T(this,"segmentDuration");T(this,"current");T(this,"previous",null);T(this,"stopFn",null);T(this,"rotateInterval",null);this.segmentDuration=s.segmentDuration??1e4,this.current={events:[],startedAt:new Date().toISOString()}}start(){this.stopFn=he({emit:s=>{this.onEvent(s)}}),this.rotateInterval=setInterval(()=>{this.rotateSegment()},this.segmentDuration)}stop(){this.stopFn&&(this.stopFn(),this.stopFn=null),this.rotateInterval&&(clearInterval(this.rotateInterval),this.rotateInterval=null)}onEvent(s){this.current.events.push(s)}rotateSegment(){this.previous=this.current,this.current={events:[],startedAt:new Date().toISOString()},he.takeFullSnapshot()}getSegments(){const s=[];return this.previous&&this.previous.events.length>0&&s.push({events:this.previous.events,timestamp:this.previous.startedAt}),this.current.events.length>0&&s.push({events:this.current.events,timestamp:this.current.startedAt}),s}hasSegments(){return this.current.events.length>0||this.previous!==null&&this.previous.events.length>0}flush(){this.previous=null,this.current={events:[],startedAt:new Date().toISOString()},this.stopFn&&he.takeFullSnapshot()}};function wr(s){return new Date(s).toISOString()}function yf(s,e,t){if(s.length>0){const i=[];for(const n of s){const o=n==null?void 0:n.timestamp;typeof o=="number"&&Number.isFinite(o)&&i.push(o)}if(i.length>0)return{startedAt:wr(Math.min(...i)),endedAt:wr(Math.max(...i))}}const r=[...e.map(i=>Date.parse(i.timestamp)),...t.map(i=>Date.parse(i.timestamp))].filter(i=>Number.isFinite(i));return r.length===0?{}:{startedAt:wr(Math.min(...r)),endedAt:wr(Math.max(...r))}}var wf=["Failed to fetch","NetworkError when attempting to fetch resource","Load failed","Network Error","The operation was aborted",/timeout/i,/status code 4\d{2}/,/failed: 4\d{2}/],bf=class{constructor(s,e={}){T(this,"apiUrl");T(this,"token");T(this,"debug");T(this,"debounceMs");T(this,"retryDelayMs");T(this,"version");T(this,"pendingExceptions",[]);T(this,"pendingRecordings",[]);T(this,"isSyncing",!1);T(this,"debounceTimer",null);T(this,"retryTimer",null);T(this,"recorder",null);T(this,"ignoreErrors");T(this,"beforeCapture");T(this,"captureLogs");T(this,"captureNetwork");T(this,"captureNavigation");T(this,"logs");T(this,"actions");const{token:t,apiUrl:r}=ge(s);this.apiUrl=r,this.token=t,this.debug=e.debug??!1,this.debounceMs=e.debounceMs??1500,this.retryDelayMs=e.retryDelayMs??1e4,this.version=e.version??"",this.ignoreErrors=e.ignoreErrors??wf,this.beforeCapture=e.beforeCapture??null,this.captureLogs=e.captureLogs??!0,this.captureNetwork=e.captureNetwork??!0,this.captureNavigation=e.captureNavigation??!0;const i={windowMs:e.eventsWindowMs??1e4,maxSize:e.eventsMaxCount??200};this.logs=new Vs(i),this.actions=new Vs(i),e.sessionRecording!==!1&&typeof window<"u"&&(this.recorder=new gf({segmentDuration:e.sessionRecordingSegmentDuration}),this.recorder.start())}recordLog(s,e){this.captureLogs&&this.logs.add({type:"log",timestamp:Q(),level:s,message:e})}recordNetworkEvent(s){this.captureNetwork&&this.actions.add({type:"network",timestamp:s.timestamp??Q(),method:s.method,url:s.url,durationMs:s.durationMs,statusCode:s.statusCode,requestBytes:s.requestBytes,responseBytes:s.responseBytes,error:s.error})}recordNavigationEvent(s){this.captureNavigation&&this.actions.add({type:"navigation",timestamp:s.timestamp??Q(),action:s.action,from:s.from,to:s.to})}recordAction(s,e,t){this.actions.add({type:"custom",timestamp:Q(),category:s,name:e,data:t})}bufferedLogs(){return this.logs.snapshot()}bufferedActions(){return this.actions.snapshot()}addException(s){if(this.shouldIgnore(s)){this.debug&&console.debug("Traceway: exception suppressed by filter",s.stackTrace.slice(0,120));return}const e=this.recorder&&this.recorder.hasSegments()?this.recorder.getSegments().flatMap(n=>n.events):[],t=this.logs.snapshot(),r=this.actions.snapshot();if(e.length>0||t.length>0||r.length>0){const n=me();s.sessionRecordingId=n;const o={exceptionId:n,events:e},l=yf(e,t,r);l.startedAt&&(o.startedAt=l.startedAt),l.endedAt&&(o.endedAt=l.endedAt),t.length>0&&(o.logs=t),r.length>0&&(o.actions=r),this.pendingRecordings.push(o)}this.pendingExceptions.push(s),this.scheduleSync()}shouldIgnore(s){if(this.ignoreErrors.length>0){const e=s.stackTrace;for(const t of this.ignoreErrors)if(typeof t=="string"){if(e.includes(t))return!0}else if(t.lastIndex=0,t.test(e))return!0}if(this.beforeCapture!==null)try{if(this.beforeCapture(s)===!1)return!0}catch(e){this.debug&&console.error("Traceway: beforeCapture callback threw:",e)}return!1}scheduleSync(){this.debounceTimer!==null&&clearTimeout(this.debounceTimer),this.debounceTimer=setTimeout(()=>{this.debounceTimer=null,this.doSync()},this.debounceMs)}async doSync(){if(this.isSyncing||this.pendingExceptions.length===0)return;this.isSyncing=!0;const s=this.pendingExceptions.splice(0),e=this.pendingRecordings.splice(0),r={collectionFrames:[{stackTraces:s,metrics:[],traces:[],sessionRecordings:e.length>0?e:void 0}],appVersion:this.version,serverName:""};let i=!1;try{await mf(this.apiUrl,this.token,JSON.stringify(r))||(i=!0,this.pendingExceptions.unshift(...s),this.pendingRecordings.unshift(...e),this.debug&&console.error("Traceway: sync failed, re-queued exceptions"))}catch(n){i=!0,this.pendingExceptions.unshift(...s),this.pendingRecordings.unshift(...e),this.debug&&console.error("Traceway: sync error:",n)}finally{this.isSyncing=!1,this.pendingExceptions.length>0&&(i?this.scheduleRetry():this.doSync())}}scheduleRetry(){this.retryTimer===null&&(this.retryTimer=setTimeout(()=>{this.retryTimer=null,this.doSync()},this.retryDelayMs))}async flush(s){this.debounceTimer!==null&&(clearTimeout(this.debounceTimer),this.debounceTimer=null),this.retryTimer!==null&&(clearTimeout(this.retryTimer),this.retryTimer=null),this.recorder&&this.recorder.stop();const e=this.doSync();s!==void 0?await Promise.race([e,new Promise(t=>setTimeout(t,s))]):await e}};function Bs(s){var r;const e=[],t=((r=s.constructor)==null?void 0:r.name)||"Error";if(e.push(`${t}: ${s.message}`),s.stack){const i=s.stack.split(`-`);for(const n of i){const o=n.match(/^\s+at\s+(.+?)\s+\((.+):(\d+):(\d+)\)$/);if(o){const c=Fo(o[1]),h=br(o[2]);e.push(`${c}()`),e.push(` ${h}:${o[3]}:${o[4]}`);continue}const l=n.match(/^\s+at\s+(.+):(\d+):(\d+)$/);if(l){const c=br(l[1]);e.push("<anonymous>()"),e.push(` ${c}:${l[2]}:${l[3]}`);continue}const a=n.match(/^(.+)@(.+):(\d+):(\d+)$/);if(a){const c=Fo(a[1])||"<anonymous>",h=br(a[2]);e.push(`${c}()`),e.push(` ${h}:${a[3]}:${a[4]}`);continue}const u=n.match(/^@(.+):(\d+):(\d+)$/);if(u){const c=br(u[1]);e.push("<anonymous>()"),e.push(` ${c}:${u[2]}:${u[3]}`);continue}}}return e.join(`+or you can use record.mirror to access the mirror instance during recording.`;let ao={map:{},getId(){return console.error(ze),-1},getNode(){return console.error(ze),null},removeNodeFromMap(){console.error(ze)},has(){return console.error(ze),!1},reset(){console.error(ze)}};typeof window<"u"&&window.Proxy&&window.Reflect&&(ao=new Proxy(ao,{get(s,e,t){return e==="map"&&console.error(ze),Reflect.get(s,e,t)}}));function ht(s,e,t={}){let r=null,i=0;return function(...n){const o=Date.now();!i&&t.leading===!1&&(i=o);const l=e-(o-i),a=this;l<=0||l>e?(r&&(clearTimeout(r),r=null),i=o,s.apply(a,n)):!r&&t.trailing!==!1&&(r=setTimeout(()=>{i=t.leading===!1?0:Date.now(),r=null,s.apply(a,n)},l))}}function ur(s,e,t,r,i=window){const n=i.Object.getOwnPropertyDescriptor(s,e);return i.Object.defineProperty(s,e,r?t:{set(o){setTimeout(()=>{t.set.call(this,o)},0),n&&n.set&&n.set.call(this,o)}}),()=>ur(s,e,n||{},!0)}let cr=Date.now;/[1-9][0-9]{12}/.test(Date.now().toString())||(cr=()=>new Date().getTime());function lo(s){var e,t,r,i;const n=s.document;return{left:n.scrollingElement?n.scrollingElement.scrollLeft:s.pageXOffset!==void 0?s.pageXOffset:n.documentElement.scrollLeft||(n==null?void 0:n.body)&&((e=I.parentElement(n.body))==null?void 0:e.scrollLeft)||((t=n==null?void 0:n.body)==null?void 0:t.scrollLeft)||0,top:n.scrollingElement?n.scrollingElement.scrollTop:s.pageYOffset!==void 0?s.pageYOffset:(n==null?void 0:n.documentElement.scrollTop)||(n==null?void 0:n.body)&&((r=I.parentElement(n.body))==null?void 0:r.scrollTop)||((i=n==null?void 0:n.body)==null?void 0:i.scrollTop)||0}}function uo(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function co(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function ho(s){return s?s.nodeType===s.ELEMENT_NODE?s:I.parentElement(s):null}function Q(s,e,t,r){if(!s)return!1;const i=ho(s);if(!i)return!1;try{if(typeof e=="string"){if(i.classList.contains(e)||r&&i.closest("."+e)!==null)return!0}else if(vt(i,e,r))return!0}catch{}return!!(t&&(i.matches(t)||r&&i.closest(t)!==null))}function Nh(s,e){return e.getId(s)!==-1}function Ds(s,e,t){return s.tagName==="TITLE"&&t.headTitleMutations?!0:e.getId(s)===Ze}function fo(s,e){if(He(s))return!1;const t=e.getId(s);if(!e.has(t))return!0;const r=I.parentNode(s);return r&&r.nodeType===s.DOCUMENT_NODE?!1:r?fo(r,e):!0}function Ls(s){return!!s.changedTouches}function kh(s=window){"NodeList"in s&&!s.NodeList.prototype.forEach&&(s.NodeList.prototype.forEach=Array.prototype.forEach),"DOMTokenList"in s&&!s.DOMTokenList.prototype.forEach&&(s.DOMTokenList.prototype.forEach=Array.prototype.forEach)}function po(s,e){return!!(s.nodeName==="IFRAME"&&e.getMeta(s))}function mo(s,e){return!!(s.nodeName==="LINK"&&s.nodeType===s.ELEMENT_NODE&&s.getAttribute&&s.getAttribute("rel")==="stylesheet"&&e.getMeta(s))}function _s(s){return s?s instanceof Ns&&"shadowRoot"in s?!!s.shadowRoot:!!I.shadowRoot(s):!1}class Th{constructor(){w(this,"id",1),w(this,"styleIDMap",new WeakMap),w(this,"idStyleMap",new Map)}getId(e){return this.styleIDMap.get(e)??-1}has(e){return this.styleIDMap.has(e)}add(e,t){if(this.has(e))return this.getId(e);let r;return t===void 0?r=this.id++:r=t,this.styleIDMap.set(e,r),this.idStyleMap.set(r,e),r}getStyle(e){return this.idStyleMap.get(e)||null}reset(){this.styleIDMap=new WeakMap,this.idStyleMap=new Map,this.id=1}generateId(){return this.id++}}function go(s){var e;let t=null;return"getRootNode"in s&&((e=I.getRootNode(s))==null?void 0:e.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&I.host(I.getRootNode(s))&&(t=I.host(I.getRootNode(s))),t}function Ph(s){let e=s,t;for(;t=go(e);)e=t;return e}function Dh(s){const e=I.ownerDocument(s);if(!e)return!1;const t=Ph(s);return I.contains(e,t)}function yo(s){const e=I.ownerDocument(s);return e?I.contains(e,s)||Dh(s):!1}var R=(s=>(s[s.DomContentLoaded=0]="DomContentLoaded",s[s.Load=1]="Load",s[s.FullSnapshot=2]="FullSnapshot",s[s.IncrementalSnapshot=3]="IncrementalSnapshot",s[s.Meta=4]="Meta",s[s.Custom=5]="Custom",s[s.Plugin=6]="Plugin",s))(R||{}),x=(s=>(s[s.Mutation=0]="Mutation",s[s.MouseMove=1]="MouseMove",s[s.MouseInteraction=2]="MouseInteraction",s[s.Scroll=3]="Scroll",s[s.ViewportResize=4]="ViewportResize",s[s.Input=5]="Input",s[s.TouchMove=6]="TouchMove",s[s.MediaInteraction=7]="MediaInteraction",s[s.StyleSheetRule=8]="StyleSheetRule",s[s.CanvasMutation=9]="CanvasMutation",s[s.Font=10]="Font",s[s.Log=11]="Log",s[s.Drag=12]="Drag",s[s.StyleDeclaration=13]="StyleDeclaration",s[s.Selection=14]="Selection",s[s.AdoptedStyleSheet=15]="AdoptedStyleSheet",s[s.CustomElement=16]="CustomElement",s))(x||{}),q=(s=>(s[s.MouseUp=0]="MouseUp",s[s.MouseDown=1]="MouseDown",s[s.Click=2]="Click",s[s.ContextMenu=3]="ContextMenu",s[s.DblClick=4]="DblClick",s[s.Focus=5]="Focus",s[s.Blur=6]="Blur",s[s.TouchStart=7]="TouchStart",s[s.TouchMove_Departed=8]="TouchMove_Departed",s[s.TouchEnd=9]="TouchEnd",s[s.TouchCancel=10]="TouchCancel",s))(q||{}),ve=(s=>(s[s.Mouse=0]="Mouse",s[s.Pen=1]="Pen",s[s.Touch=2]="Touch",s))(ve||{}),We=(s=>(s[s["2D"]=0]="2D",s[s.WebGL=1]="WebGL",s[s.WebGL2=2]="WebGL2",s))(We||{}),Ge=(s=>(s[s.Play=0]="Play",s[s.Pause=1]="Pause",s[s.Seeked=2]="Seeked",s[s.VolumeChange=3]="VolumeChange",s[s.RateChange=4]="RateChange",s))(Ge||{}),wo=(s=>(s[s.Document=0]="Document",s[s.DocumentType=1]="DocumentType",s[s.Element=2]="Element",s[s.Text=3]="Text",s[s.CDATA=4]="CDATA",s[s.Comment=5]="Comment",s))(wo||{});function So(s){return"__ln"in s}class Lh{constructor(){w(this,"length",0),w(this,"head",null),w(this,"tail",null)}get(e){if(e>=this.length)throw new Error("Position outside of list range");let t=this.head;for(let r=0;r<e;r++)t=(t==null?void 0:t.next)||null;return t}addNode(e){const t={value:e,previous:null,next:null};if(e.__ln=t,e.previousSibling&&So(e.previousSibling)){const r=e.previousSibling.__ln.next;t.next=r,t.previous=e.previousSibling.__ln,e.previousSibling.__ln.next=t,r&&(r.previous=t)}else if(e.nextSibling&&So(e.nextSibling)&&e.nextSibling.__ln.previous){const r=e.nextSibling.__ln.previous;t.previous=r,t.next=e.nextSibling.__ln,e.nextSibling.__ln.previous=t,r&&(r.next=t)}else this.head&&(this.head.previous=t),t.next=this.head,this.head=t;t.next===null&&(this.tail=t),this.length++}removeNode(e){const t=e.__ln;this.head&&(t.previous?(t.previous.next=t.next,t.next?t.next.previous=t.previous:this.tail=t.previous):(this.head=t.next,this.head?this.head.previous=null:this.tail=null),e.__ln&&delete e.__ln,this.length--)}}const bo=(s,e)=>`${s}@${e}`;class _h{constructor(){w(this,"frozen",!1),w(this,"locked",!1),w(this,"texts",[]),w(this,"attributes",[]),w(this,"attributeMap",new WeakMap),w(this,"removes",[]),w(this,"mapRemoves",[]),w(this,"movedMap",{}),w(this,"addedSet",new Set),w(this,"movedSet",new Set),w(this,"droppedSet",new Set),w(this,"removesSubTreeCache",new Set),w(this,"mutationCb"),w(this,"blockClass"),w(this,"blockSelector"),w(this,"maskTextClass"),w(this,"maskTextSelector"),w(this,"inlineStylesheet"),w(this,"maskInputOptions"),w(this,"maskTextFn"),w(this,"maskInputFn"),w(this,"keepIframeSrcFn"),w(this,"recordCanvas"),w(this,"inlineImages"),w(this,"slimDOMOptions"),w(this,"dataURLOptions"),w(this,"doc"),w(this,"mirror"),w(this,"iframeManager"),w(this,"stylesheetManager"),w(this,"shadowDomManager"),w(this,"canvasManager"),w(this,"processedNodeManager"),w(this,"unattachedDoc"),w(this,"processMutations",e=>{e.forEach(this.processMutation),this.emit()}),w(this,"emit",()=>{if(this.frozen||this.locked)return;const e=[],t=new Set,r=new Lh,i=a=>{let u=a,c=Ze;for(;c===Ze;)u=u&&u.nextSibling,c=u&&this.mirror.getId(u);return c},n=a=>{const u=I.parentNode(a);if(!u||!yo(a))return;let c=!1;if(a.nodeType===Node.TEXT_NODE){const g=u.tagName;if(g==="TEXTAREA")return;g==="STYLE"&&this.addedSet.has(u)&&(c=!0)}const h=He(u)?this.mirror.getId(go(a)):this.mirror.getId(u),p=i(a);if(h===-1||p===-1)return r.addNode(a);const m=Pe(a,{doc:this.doc,mirror:this.mirror,blockClass:this.blockClass,blockSelector:this.blockSelector,maskTextClass:this.maskTextClass,maskTextSelector:this.maskTextSelector,skipChild:!0,newlyAddedElement:!0,inlineStylesheet:this.inlineStylesheet,maskInputOptions:this.maskInputOptions,maskTextFn:this.maskTextFn,maskInputFn:this.maskInputFn,slimDOMOptions:this.slimDOMOptions,dataURLOptions:this.dataURLOptions,recordCanvas:this.recordCanvas,inlineImages:this.inlineImages,onSerialize:g=>{po(g,this.mirror)&&this.iframeManager.addIframe(g),mo(g,this.mirror)&&this.stylesheetManager.trackLinkElement(g),_s(a)&&this.shadowDomManager.addShadowRoot(I.shadowRoot(a),this.doc)},onIframeLoad:(g,d)=>{this.iframeManager.attachIframe(g,d),this.shadowDomManager.observeAttachShadow(g)},onStylesheetLoad:(g,d)=>{this.stylesheetManager.attachLinkElement(g,d)},cssCaptured:c});m&&(e.push({parentId:h,nextId:p,node:m}),t.add(m.id))};for(;this.mapRemoves.length;)this.mirror.removeNodeFromMap(this.mapRemoves.shift());for(const a of this.movedSet)vo(this.removesSubTreeCache,a,this.mirror)&&!this.movedSet.has(I.parentNode(a))||n(a);for(const a of this.addedSet)!Co(this.droppedSet,a)&&!vo(this.removesSubTreeCache,a,this.mirror)||Co(this.movedSet,a)?n(a):this.droppedSet.add(a);let o=null;for(;r.length;){let a=null;if(o){const u=this.mirror.getId(I.parentNode(o.value)),c=i(o.value);u!==-1&&c!==-1&&(a=o)}if(!a){let u=r.tail;for(;u;){const c=u;if(u=u.previous,c){const h=this.mirror.getId(I.parentNode(c.value));if(i(c.value)===-1)continue;if(h!==-1){a=c;break}else{const m=c.value,g=I.parentNode(m);if(g&&g.nodeType===Node.DOCUMENT_FRAGMENT_NODE){const d=I.host(g);if(this.mirror.getId(d)!==-1){a=c;break}}}}}}if(!a){for(;r.head;)r.removeNode(r.head.value);break}o=a.previous,r.removeNode(a.value),n(a.value)}const l={texts:this.texts.map(a=>{const u=a.node,c=I.parentNode(u);return c&&c.tagName==="TEXTAREA"&&this.genTextAreaValueMutation(c),{id:this.mirror.getId(u),value:a.value}}).filter(a=>!t.has(a.id)).filter(a=>this.mirror.has(a.id)),attributes:this.attributes.map(a=>{const{attributes:u}=a;if(typeof u.style=="string"){const c=JSON.stringify(a.styleDiff),h=JSON.stringify(a._unchangedStyles);c.length<u.style.length&&(c+h).split("var(").length===u.style.split("var(").length&&(u.style=a.styleDiff)}return{id:this.mirror.getId(a.node),attributes:u}}).filter(a=>!t.has(a.id)).filter(a=>this.mirror.has(a.id)),removes:this.removes,adds:e};!l.texts.length&&!l.attributes.length&&!l.removes.length&&!l.adds.length||(this.texts=[],this.attributes=[],this.attributeMap=new WeakMap,this.removes=[],this.addedSet=new Set,this.movedSet=new Set,this.droppedSet=new Set,this.removesSubTreeCache=new Set,this.movedMap={},this.mutationCb(l))}),w(this,"genTextAreaValueMutation",e=>{let t=this.attributeMap.get(e);t||(t={node:e,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(t),this.attributeMap.set(e,t));const r=Array.from(I.childNodes(e),i=>I.textContent(i)||"").join("");t.attributes.value=yt({element:e,maskInputOptions:this.maskInputOptions,tagName:e.tagName,type:wt(e),value:r,maskInputFn:this.maskInputFn})}),w(this,"processMutation",e=>{if(!Ds(e.target,this.mirror,this.slimDOMOptions))switch(e.type){case"characterData":{const t=I.textContent(e.target);!Q(e.target,this.blockClass,this.blockSelector,!1)&&t!==e.oldValue&&this.texts.push({value:oi(e.target,this.maskTextClass,this.maskTextSelector,!0)&&t?this.maskTextFn?this.maskTextFn(t,ho(e.target)):t.replace(/[\S]/g,"*"):t,node:e.target});break}case"attributes":{const t=e.target;let r=e.attributeName,i=e.target.getAttribute(r);if(r==="value"){const o=wt(t);i=yt({element:t,maskInputOptions:this.maskInputOptions,tagName:t.tagName,type:o,value:i,maskInputFn:this.maskInputFn})}if(Q(e.target,this.blockClass,this.blockSelector,!1)||i===e.oldValue)return;let n=this.attributeMap.get(e.target);if(t.tagName==="IFRAME"&&r==="src"&&!this.keepIframeSrcFn(i))if(!t.contentDocument)r="rr_src";else return;if(n||(n={node:e.target,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(n),this.attributeMap.set(e.target,n)),r==="type"&&t.tagName==="INPUT"&&(e.oldValue||"").toLowerCase()==="password"&&t.setAttribute("data-rr-is-password","true"),!ni(t.tagName,r))if(n.attributes[r]=ii(this.doc,Ie(t.tagName),Ie(r),i),r==="style"){if(!this.unattachedDoc)try{this.unattachedDoc=document.implementation.createHTMLDocument()}catch{this.unattachedDoc=this.doc}const o=this.unattachedDoc.createElement("span");e.oldValue&&o.setAttribute("style",e.oldValue);for(const l of Array.from(t.style)){const a=t.style.getPropertyValue(l),u=t.style.getPropertyPriority(l);a!==o.style.getPropertyValue(l)||u!==o.style.getPropertyPriority(l)?u===""?n.styleDiff[l]=a:n.styleDiff[l]=[a,u]:n._unchangedStyles[l]=[a,u]}for(const l of Array.from(o.style))t.style.getPropertyValue(l)===""&&(n.styleDiff[l]=!1)}else r==="open"&&t.tagName==="DIALOG"&&(t.matches("dialog:modal")?n.attributes.rr_open_mode="modal":n.attributes.rr_open_mode="non-modal");break}case"childList":{if(Q(e.target,this.blockClass,this.blockSelector,!0))return;if(e.target.tagName==="TEXTAREA"){this.genTextAreaValueMutation(e.target);return}e.addedNodes.forEach(t=>this.genAdds(t,e.target)),e.removedNodes.forEach(t=>{const r=this.mirror.getId(t),i=He(e.target)?this.mirror.getId(I.host(e.target)):this.mirror.getId(e.target);Q(e.target,this.blockClass,this.blockSelector,!1)||Ds(t,this.mirror,this.slimDOMOptions)||!Nh(t,this.mirror)||(this.addedSet.has(t)?(Fs(this.addedSet,t),this.droppedSet.add(t)):this.addedSet.has(e.target)&&r===-1||fo(e.target,this.mirror)||(this.movedSet.has(t)&&this.movedMap[bo(r,i)]?Fs(this.movedSet,t):(this.removes.push({parentId:i,id:r,isShadow:He(e.target)&&Ye(e.target)?!0:void 0}),Fh(t,this.removesSubTreeCache))),this.mapRemoves.push(t))});break}}}),w(this,"genAdds",(e,t)=>{if(!this.processedNodeManager.inOtherBuffer(e,this)&&!(this.addedSet.has(e)||this.movedSet.has(e))){if(this.mirror.hasNode(e)){if(Ds(e,this.mirror,this.slimDOMOptions))return;this.movedSet.add(e);let r=null;t&&this.mirror.hasNode(t)&&(r=this.mirror.getId(t)),r&&r!==-1&&(this.movedMap[bo(this.mirror.getId(e),r)]=!0)}else this.addedSet.add(e),this.droppedSet.delete(e);Q(e,this.blockClass,this.blockSelector,!1)||(I.childNodes(e).forEach(r=>this.genAdds(r)),_s(e)&&I.childNodes(I.shadowRoot(e)).forEach(r=>{this.processedNodeManager.add(r,this),this.genAdds(r,e)}))}})}init(e){["mutationCb","blockClass","blockSelector","maskTextClass","maskTextSelector","inlineStylesheet","maskInputOptions","maskTextFn","maskInputFn","keepIframeSrcFn","recordCanvas","inlineImages","slimDOMOptions","dataURLOptions","doc","mirror","iframeManager","stylesheetManager","shadowDomManager","canvasManager","processedNodeManager"].forEach(t=>{this[t]=e[t]})}freeze(){this.frozen=!0,this.canvasManager.freeze()}unfreeze(){this.frozen=!1,this.canvasManager.unfreeze(),this.emit()}isFrozen(){return this.frozen}lock(){this.locked=!0,this.canvasManager.lock()}unlock(){this.locked=!1,this.canvasManager.unlock(),this.emit()}reset(){this.shadowDomManager.reset(),this.canvasManager.reset()}}function Fs(s,e){s.delete(e),I.childNodes(e).forEach(t=>Fs(s,t))}function Fh(s,e){const t=[s];for(;t.length;){const r=t.pop();e.has(r)||(e.add(r),I.childNodes(r).forEach(i=>t.push(i)))}}function vo(s,e,t){return s.size===0?!1:Uh(s,e)}function Uh(s,e,t){const r=I.parentNode(e);return r?s.has(r):!1}function Co(s,e){return s.size===0?!1:Io(s,e)}function Io(s,e){const t=I.parentNode(e);return t?s.has(t)?!0:Io(s,t):!1}let ft;function Bh(s){ft=s}function zh(){ft=void 0}const A=s=>ft?(...t)=>{try{return s(...t)}catch(r){if(ft&&ft(r)===!0)return;throw r}}:s,Oe=[];function dt(s){try{if("composedPath"in s){const e=s.composedPath();if(e.length)return e[0]}else if("path"in s&&s.path.length)return s.path[0]}catch{}return s&&s.target}function xo(s,e){const t=new _h;Oe.push(t),t.init(s);const r=new(oo())(A(t.processMutations.bind(t)));return r.observe(e,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),r}function Wh({mousemoveCb:s,sampling:e,doc:t,mirror:r}){if(e.mousemove===!1)return()=>{};const i=typeof e.mousemove=="number"?e.mousemove:50,n=typeof e.mousemoveCallback=="number"?e.mousemoveCallback:500;let o=[],l;const a=ht(A(h=>{const p=Date.now()-l;s(o.map(m=>(m.timeOffset-=p,m)),h),o=[],l=null}),n),u=A(ht(A(h=>{const p=dt(h),{clientX:m,clientY:g}=Ls(h)?h.changedTouches[0]:h;l||(l=cr()),o.push({x:m,y:g,id:r.getId(p),timeOffset:cr()-l}),a(typeof DragEvent<"u"&&h instanceof DragEvent?x.Drag:h instanceof MouseEvent?x.MouseMove:x.TouchMove)}),i,{trailing:!1})),c=[X("mousemove",u,t),X("touchmove",u,t),X("drag",u,t)];return A(()=>{c.forEach(h=>h())})}function Gh({mouseInteractionCb:s,doc:e,mirror:t,blockClass:r,blockSelector:i,sampling:n}){if(n.mouseInteraction===!1)return()=>{};const o=n.mouseInteraction===!0||n.mouseInteraction===void 0?{}:n.mouseInteraction,l=[];let a=null;const u=c=>h=>{const p=dt(h);if(Q(p,r,i,!0))return;let m=null,g=c;if("pointerType"in h){switch(h.pointerType){case"mouse":m=ve.Mouse;break;case"touch":m=ve.Touch;break;case"pen":m=ve.Pen;break}m===ve.Touch?q[c]===q.MouseDown?g="TouchStart":q[c]===q.MouseUp&&(g="TouchEnd"):ve.Pen}else Ls(h)&&(m=ve.Touch);m!==null?(a=m,(g.startsWith("Touch")&&m===ve.Touch||g.startsWith("Mouse")&&m===ve.Mouse)&&(m=null)):q[c]===q.Click&&(m=a,a=null);const d=Ls(h)?h.changedTouches[0]:h;if(!d)return;const f=t.getId(p),{clientX:S,clientY:b}=d;A(s)({type:q[g],id:f,x:S,y:b,...m!==null&&{pointerType:m}})};return Object.keys(q).filter(c=>Number.isNaN(Number(c))&&!c.endsWith("_Departed")&&o[c]!==!1).forEach(c=>{let h=Ie(c);const p=u(c);if(window.PointerEvent)switch(q[c]){case q.MouseDown:case q.MouseUp:h=h.replace("mouse","pointer");break;case q.TouchStart:case q.TouchEnd:return}l.push(X(h,p,e))}),A(()=>{l.forEach(c=>c())})}function Ao({scrollCb:s,doc:e,mirror:t,blockClass:r,blockSelector:i,sampling:n}){const o=A(ht(A(l=>{const a=dt(l);if(!a||Q(a,r,i,!0))return;const u=t.getId(a);if(a===e&&e.defaultView){const c=lo(e.defaultView);s({id:u,x:c.left,y:c.top})}else s({id:u,x:a.scrollLeft,y:a.scrollTop})}),n.scroll||100));return X("scroll",o,e)}function Vh({viewportResizeCb:s},{win:e}){let t=-1,r=-1;const i=A(ht(A(()=>{const n=uo(),o=co();(t!==n||r!==o)&&(s({width:Number(o),height:Number(n)}),t=n,r=o)}),200));return X("resize",i,e)}const jh=["INPUT","TEXTAREA","SELECT"],Ro=new WeakMap;function Hh({inputCb:s,doc:e,mirror:t,blockClass:r,blockSelector:i,ignoreClass:n,ignoreSelector:o,maskInputOptions:l,maskInputFn:a,sampling:u,userTriggeredOnInput:c}){function h(b){let y=dt(b);const C=b.isTrusted,k=y&&y.tagName;if(y&&k==="OPTION"&&(y=I.parentElement(y)),!y||!k||jh.indexOf(k)<0||Q(y,r,i,!0)||y.classList.contains(n)||o&&y.matches(o))return;let D=y.value,H=!1;const B=wt(y)||"";B==="radio"||B==="checkbox"?H=y.checked:(l[k.toLowerCase()]||l[B])&&(D=yt({element:y,maskInputOptions:l,tagName:k,type:B,value:D,maskInputFn:a})),p(y,c?{text:D,isChecked:H,userTriggered:C}:{text:D,isChecked:H});const V=y.name;B==="radio"&&V&&H&&e.querySelectorAll(`input[type="radio"][name="${V}"]`).forEach(Z=>{if(Z!==y){const ie=Z.value;p(Z,c?{text:ie,isChecked:!H,userTriggered:!1}:{text:ie,isChecked:!H})}})}function p(b,y){const C=Ro.get(b);if(!C||C.text!==y.text||C.isChecked!==y.isChecked){Ro.set(b,y);const k=t.getId(b);A(s)({...y,id:k})}}const g=(u.input==="last"?["change"]:["input","change"]).map(b=>X(b,A(h),e)),d=e.defaultView;if(!d)return()=>{g.forEach(b=>b())};const f=d.Object.getOwnPropertyDescriptor(d.HTMLInputElement.prototype,"value"),S=[[d.HTMLInputElement.prototype,"value"],[d.HTMLInputElement.prototype,"checked"],[d.HTMLSelectElement.prototype,"value"],[d.HTMLTextAreaElement.prototype,"value"],[d.HTMLSelectElement.prototype,"selectedIndex"],[d.HTMLOptionElement.prototype,"selected"]];return f&&f.set&&g.push(...S.map(b=>ur(b[0],b[1],{set(){A(h)({target:this,isTrusted:!1})}},!1,d))),A(()=>{g.forEach(b=>b())})}function hr(s){const e=[];function t(r,i){if(fr("CSSGroupingRule")&&r.parentRule instanceof CSSGroupingRule||fr("CSSMediaRule")&&r.parentRule instanceof CSSMediaRule||fr("CSSSupportsRule")&&r.parentRule instanceof CSSSupportsRule||fr("CSSConditionRule")&&r.parentRule instanceof CSSConditionRule){const o=Array.from(r.parentRule.cssRules).indexOf(r);i.unshift(o)}else if(r.parentStyleSheet){const o=Array.from(r.parentStyleSheet.cssRules).indexOf(r);i.unshift(o)}return i}return t(s,e)}function Ce(s,e,t){let r,i;return s?(s.ownerNode?r=e.getId(s.ownerNode):i=t.getId(s),{styleId:i,id:r}):{}}function Yh({styleSheetRuleCb:s,mirror:e,stylesheetManager:t},{win:r}){if(!r.CSSStyleSheet||!r.CSSStyleSheet.prototype)return()=>{};const i=r.CSSStyleSheet.prototype.insertRule;r.CSSStyleSheet.prototype.insertRule=new Proxy(i,{apply:A((c,h,p)=>{const[m,g]=p,{id:d,styleId:f}=Ce(h,e,t.styleMirror);return(d&&d!==-1||f&&f!==-1)&&s({id:d,styleId:f,adds:[{rule:m,index:g}]}),c.apply(h,p)})}),r.CSSStyleSheet.prototype.addRule=function(c,h,p=this.cssRules.length){const m=`${c} { ${h} }`;return r.CSSStyleSheet.prototype.insertRule.apply(this,[m,p])};const n=r.CSSStyleSheet.prototype.deleteRule;r.CSSStyleSheet.prototype.deleteRule=new Proxy(n,{apply:A((c,h,p)=>{const[m]=p,{id:g,styleId:d}=Ce(h,e,t.styleMirror);return(g&&g!==-1||d&&d!==-1)&&s({id:g,styleId:d,removes:[{index:m}]}),c.apply(h,p)})}),r.CSSStyleSheet.prototype.removeRule=function(c){return r.CSSStyleSheet.prototype.deleteRule.apply(this,[c])};let o;r.CSSStyleSheet.prototype.replace&&(o=r.CSSStyleSheet.prototype.replace,r.CSSStyleSheet.prototype.replace=new Proxy(o,{apply:A((c,h,p)=>{const[m]=p,{id:g,styleId:d}=Ce(h,e,t.styleMirror);return(g&&g!==-1||d&&d!==-1)&&s({id:g,styleId:d,replace:m}),c.apply(h,p)})}));let l;r.CSSStyleSheet.prototype.replaceSync&&(l=r.CSSStyleSheet.prototype.replaceSync,r.CSSStyleSheet.prototype.replaceSync=new Proxy(l,{apply:A((c,h,p)=>{const[m]=p,{id:g,styleId:d}=Ce(h,e,t.styleMirror);return(g&&g!==-1||d&&d!==-1)&&s({id:g,styleId:d,replaceSync:m}),c.apply(h,p)})}));const a={};dr("CSSGroupingRule")?a.CSSGroupingRule=r.CSSGroupingRule:(dr("CSSMediaRule")&&(a.CSSMediaRule=r.CSSMediaRule),dr("CSSConditionRule")&&(a.CSSConditionRule=r.CSSConditionRule),dr("CSSSupportsRule")&&(a.CSSSupportsRule=r.CSSSupportsRule));const u={};return Object.entries(a).forEach(([c,h])=>{u[c]={insertRule:h.prototype.insertRule,deleteRule:h.prototype.deleteRule},h.prototype.insertRule=new Proxy(u[c].insertRule,{apply:A((p,m,g)=>{const[d,f]=g,{id:S,styleId:b}=Ce(m.parentStyleSheet,e,t.styleMirror);return(S&&S!==-1||b&&b!==-1)&&s({id:S,styleId:b,adds:[{rule:d,index:[...hr(m),f||0]}]}),p.apply(m,g)})}),h.prototype.deleteRule=new Proxy(u[c].deleteRule,{apply:A((p,m,g)=>{const[d]=g,{id:f,styleId:S}=Ce(m.parentStyleSheet,e,t.styleMirror);return(f&&f!==-1||S&&S!==-1)&&s({id:f,styleId:S,removes:[{index:[...hr(m),d]}]}),p.apply(m,g)})})}),A(()=>{r.CSSStyleSheet.prototype.insertRule=i,r.CSSStyleSheet.prototype.deleteRule=n,o&&(r.CSSStyleSheet.prototype.replace=o),l&&(r.CSSStyleSheet.prototype.replaceSync=l),Object.entries(a).forEach(([c,h])=>{h.prototype.insertRule=u[c].insertRule,h.prototype.deleteRule=u[c].deleteRule})})}function Oo({mirror:s,stylesheetManager:e},t){var r,i,n;let o=null;t.nodeName==="#document"?o=s.getId(t):o=s.getId(I.host(t));const l=t.nodeName==="#document"?(r=t.defaultView)==null?void 0:r.Document:(n=(i=t.ownerDocument)==null?void 0:i.defaultView)==null?void 0:n.ShadowRoot,a=l!=null&&l.prototype?Object.getOwnPropertyDescriptor(l==null?void 0:l.prototype,"adoptedStyleSheets"):void 0;return o===null||o===-1||!l||!a?()=>{}:(Object.defineProperty(t,"adoptedStyleSheets",{configurable:a.configurable,enumerable:a.enumerable,get(){var u;return(u=a.get)==null?void 0:u.call(this)},set(u){var c;const h=(c=a.set)==null?void 0:c.call(this,u);if(o!==null&&o!==-1)try{e.adoptStyleSheets(u,o)}catch{}return h}}),A(()=>{Object.defineProperty(t,"adoptedStyleSheets",{configurable:a.configurable,enumerable:a.enumerable,get:a.get,set:a.set})}))}function Zh({styleDeclarationCb:s,mirror:e,ignoreCSSAttributes:t,stylesheetManager:r},{win:i}){const n=i.CSSStyleDeclaration.prototype.setProperty;i.CSSStyleDeclaration.prototype.setProperty=new Proxy(n,{apply:A((l,a,u)=>{var c;const[h,p,m]=u;if(t.has(h))return n.apply(a,[h,p,m]);const{id:g,styleId:d}=Ce((c=a.parentRule)==null?void 0:c.parentStyleSheet,e,r.styleMirror);return(g&&g!==-1||d&&d!==-1)&&s({id:g,styleId:d,set:{property:h,value:p,priority:m},index:hr(a.parentRule)}),l.apply(a,u)})});const o=i.CSSStyleDeclaration.prototype.removeProperty;return i.CSSStyleDeclaration.prototype.removeProperty=new Proxy(o,{apply:A((l,a,u)=>{var c;const[h]=u;if(t.has(h))return o.apply(a,[h]);const{id:p,styleId:m}=Ce((c=a.parentRule)==null?void 0:c.parentStyleSheet,e,r.styleMirror);return(p&&p!==-1||m&&m!==-1)&&s({id:p,styleId:m,remove:{property:h},index:hr(a.parentRule)}),l.apply(a,u)})}),A(()=>{i.CSSStyleDeclaration.prototype.setProperty=n,i.CSSStyleDeclaration.prototype.removeProperty=o})}function Jh({mediaInteractionCb:s,blockClass:e,blockSelector:t,mirror:r,sampling:i,doc:n}){const o=A(a=>ht(A(u=>{const c=dt(u);if(!c||Q(c,e,t,!0))return;const{currentTime:h,volume:p,muted:m,playbackRate:g,loop:d}=c;s({type:a,id:r.getId(c),currentTime:h,volume:p,muted:m,playbackRate:g,loop:d})}),i.media||500)),l=[X("play",o(Ge.Play),n),X("pause",o(Ge.Pause),n),X("seeked",o(Ge.Seeked),n),X("volumechange",o(Ge.VolumeChange),n),X("ratechange",o(Ge.RateChange),n)];return A(()=>{l.forEach(a=>a())})}function Kh({fontCb:s,doc:e}){const t=e.defaultView;if(!t)return()=>{};const r=[],i=new WeakMap,n=t.FontFace;t.FontFace=function(a,u,c){const h=new n(a,u,c);return i.set(h,{family:a,buffer:typeof u!="string",descriptors:c,fontSource:typeof u=="string"?u:JSON.stringify(Array.from(new Uint8Array(u)))}),h};const o=Re(e.fonts,"add",function(l){return function(a){return setTimeout(A(()=>{const u=i.get(a);u&&(s(u),i.delete(a))}),0),l.apply(this,[a])}});return r.push(()=>{t.FontFace=n}),r.push(o),A(()=>{r.forEach(l=>l())})}function Xh(s){const{doc:e,mirror:t,blockClass:r,blockSelector:i,selectionCb:n}=s;let o=!0;const l=A(()=>{const a=e.getSelection();if(!a||o&&(a!=null&&a.isCollapsed))return;o=a.isCollapsed||!1;const u=[],c=a.rangeCount||0;for(let h=0;h<c;h++){const p=a.getRangeAt(h),{startContainer:m,startOffset:g,endContainer:d,endOffset:f}=p;Q(m,r,i,!0)||Q(d,r,i,!0)||u.push({start:t.getId(m),startOffset:g,end:t.getId(d),endOffset:f})}n({ranges:u})});return l(),X("selectionchange",l)}function Qh({doc:s,customElementCb:e}){const t=s.defaultView;return!t||!t.customElements?()=>{}:Re(t.customElements,"define",function(i){return function(n,o,l){try{e({define:{name:n}})}catch{console.warn(`Custom element callback failed for ${n}`)}return i.apply(this,[n,o,l])}})}function qh(s,e){const{mutationCb:t,mousemoveCb:r,mouseInteractionCb:i,scrollCb:n,viewportResizeCb:o,inputCb:l,mediaInteractionCb:a,styleSheetRuleCb:u,styleDeclarationCb:c,canvasMutationCb:h,fontCb:p,selectionCb:m,customElementCb:g}=s;s.mutationCb=(...d)=>{e.mutation&&e.mutation(...d),t(...d)},s.mousemoveCb=(...d)=>{e.mousemove&&e.mousemove(...d),r(...d)},s.mouseInteractionCb=(...d)=>{e.mouseInteraction&&e.mouseInteraction(...d),i(...d)},s.scrollCb=(...d)=>{e.scroll&&e.scroll(...d),n(...d)},s.viewportResizeCb=(...d)=>{e.viewportResize&&e.viewportResize(...d),o(...d)},s.inputCb=(...d)=>{e.input&&e.input(...d),l(...d)},s.mediaInteractionCb=(...d)=>{e.mediaInteaction&&e.mediaInteaction(...d),a(...d)},s.styleSheetRuleCb=(...d)=>{e.styleSheetRule&&e.styleSheetRule(...d),u(...d)},s.styleDeclarationCb=(...d)=>{e.styleDeclaration&&e.styleDeclaration(...d),c(...d)},s.canvasMutationCb=(...d)=>{e.canvasMutation&&e.canvasMutation(...d),h(...d)},s.fontCb=(...d)=>{e.font&&e.font(...d),p(...d)},s.selectionCb=(...d)=>{e.selection&&e.selection(...d),m(...d)},s.customElementCb=(...d)=>{e.customElement&&e.customElement(...d),g(...d)}}function ef(s,e={}){const t=s.doc.defaultView;if(!t)return()=>{};qh(s,e);let r;s.recordDOM&&(r=xo(s,s.doc));const i=Wh(s),n=Gh(s),o=Ao(s),l=Vh(s,{win:t}),a=Hh(s),u=Jh(s);let c=()=>{},h=()=>{},p=()=>{},m=()=>{};s.recordDOM&&(c=Yh(s,{win:t}),h=Oo(s,s.doc),p=Zh(s,{win:t}),s.collectFonts&&(m=Kh(s)));const g=Xh(s),d=Qh(s),f=[];for(const S of s.plugins)f.push(S.observer(S.callback,t,S.options));return A(()=>{Oe.forEach(S=>S.reset()),r==null||r.disconnect(),i(),n(),o(),l(),a(),u(),c(),h(),p(),m(),g(),d(),f.forEach(S=>S())})}function fr(s){return typeof window[s]<"u"}function dr(s){return!!(typeof window[s]<"u"&&window[s].prototype&&"insertRule"in window[s].prototype&&"deleteRule"in window[s].prototype)}class Eo{constructor(e){w(this,"iframeIdToRemoteIdMap",new WeakMap),w(this,"iframeRemoteIdToIdMap",new WeakMap),this.generateIdFn=e}getId(e,t,r,i){const n=r||this.getIdToRemoteIdMap(e),o=i||this.getRemoteIdToIdMap(e);let l=n.get(t);return l||(l=this.generateIdFn(),n.set(t,l),o.set(l,t)),l}getIds(e,t){const r=this.getIdToRemoteIdMap(e),i=this.getRemoteIdToIdMap(e);return t.map(n=>this.getId(e,n,r,i))}getRemoteId(e,t,r){const i=r||this.getRemoteIdToIdMap(e);if(typeof t!="number")return t;const n=i.get(t);return n||-1}getRemoteIds(e,t){const r=this.getRemoteIdToIdMap(e);return t.map(i=>this.getRemoteId(e,i,r))}reset(e){if(!e){this.iframeIdToRemoteIdMap=new WeakMap,this.iframeRemoteIdToIdMap=new WeakMap;return}this.iframeIdToRemoteIdMap.delete(e),this.iframeRemoteIdToIdMap.delete(e)}getIdToRemoteIdMap(e){let t=this.iframeIdToRemoteIdMap.get(e);return t||(t=new Map,this.iframeIdToRemoteIdMap.set(e,t)),t}getRemoteIdToIdMap(e){let t=this.iframeRemoteIdToIdMap.get(e);return t||(t=new Map,this.iframeRemoteIdToIdMap.set(e,t)),t}}class tf{constructor(e){w(this,"iframes",new WeakMap),w(this,"crossOriginIframeMap",new WeakMap),w(this,"crossOriginIframeMirror",new Eo(ti)),w(this,"crossOriginIframeStyleMirror"),w(this,"crossOriginIframeRootIdMap",new WeakMap),w(this,"mirror"),w(this,"mutationCb"),w(this,"wrappedEmit"),w(this,"loadListener"),w(this,"stylesheetManager"),w(this,"recordCrossOriginIframes"),this.mutationCb=e.mutationCb,this.wrappedEmit=e.wrappedEmit,this.stylesheetManager=e.stylesheetManager,this.recordCrossOriginIframes=e.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new Eo(this.stylesheetManager.styleMirror.generateId.bind(this.stylesheetManager.styleMirror)),this.mirror=e.mirror,this.recordCrossOriginIframes&&window.addEventListener("message",this.handleMessage.bind(this))}addIframe(e){this.iframes.set(e,!0),e.contentWindow&&this.crossOriginIframeMap.set(e.contentWindow,e)}addLoadListener(e){this.loadListener=e}attachIframe(e,t){var r,i;this.mutationCb({adds:[{parentId:this.mirror.getId(e),nextId:null,node:t}],removes:[],texts:[],attributes:[],isAttachIframe:!0}),this.recordCrossOriginIframes&&((r=e.contentWindow)==null||r.addEventListener("message",this.handleMessage.bind(this))),(i=this.loadListener)==null||i.call(this,e),e.contentDocument&&e.contentDocument.adoptedStyleSheets&&e.contentDocument.adoptedStyleSheets.length>0&&this.stylesheetManager.adoptStyleSheets(e.contentDocument.adoptedStyleSheets,this.mirror.getId(e.contentDocument))}handleMessage(e){const t=e;if(t.data.type!=="rrweb"||t.origin!==t.data.origin||!e.source)return;const i=this.crossOriginIframeMap.get(e.source);if(!i)return;const n=this.transformCrossOriginEvent(i,t.data.event);n&&this.wrappedEmit(n,t.data.isCheckout)}transformCrossOriginEvent(e,t){var r;switch(t.type){case R.FullSnapshot:{this.crossOriginIframeMirror.reset(e),this.crossOriginIframeStyleMirror.reset(e),this.replaceIdOnNode(t.data.node,e);const i=t.data.node.id;return this.crossOriginIframeRootIdMap.set(e,i),this.patchRootIdOnNode(t.data.node,i),{timestamp:t.timestamp,type:R.IncrementalSnapshot,data:{source:x.Mutation,adds:[{parentId:this.mirror.getId(e),nextId:null,node:t.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}}}case R.Meta:case R.Load:case R.DomContentLoaded:return!1;case R.Plugin:return t;case R.Custom:return this.replaceIds(t.data.payload,e,["id","parentId","previousId","nextId"]),t;case R.IncrementalSnapshot:switch(t.data.source){case x.Mutation:return t.data.adds.forEach(i=>{this.replaceIds(i,e,["parentId","nextId","previousId"]),this.replaceIdOnNode(i.node,e);const n=this.crossOriginIframeRootIdMap.get(e);n&&this.patchRootIdOnNode(i.node,n)}),t.data.removes.forEach(i=>{this.replaceIds(i,e,["parentId","id"])}),t.data.attributes.forEach(i=>{this.replaceIds(i,e,["id"])}),t.data.texts.forEach(i=>{this.replaceIds(i,e,["id"])}),t;case x.Drag:case x.TouchMove:case x.MouseMove:return t.data.positions.forEach(i=>{this.replaceIds(i,e,["id"])}),t;case x.ViewportResize:return!1;case x.MediaInteraction:case x.MouseInteraction:case x.Scroll:case x.CanvasMutation:case x.Input:return this.replaceIds(t.data,e,["id"]),t;case x.StyleSheetRule:case x.StyleDeclaration:return this.replaceIds(t.data,e,["id"]),this.replaceStyleIds(t.data,e,["styleId"]),t;case x.Font:return t;case x.Selection:return t.data.ranges.forEach(i=>{this.replaceIds(i,e,["start","end"])}),t;case x.AdoptedStyleSheet:return this.replaceIds(t.data,e,["id"]),this.replaceStyleIds(t.data,e,["styleIds"]),(r=t.data.styles)==null||r.forEach(i=>{this.replaceStyleIds(i,e,["styleId"])}),t}}return!1}replace(e,t,r,i){for(const n of i)!Array.isArray(t[n])&&typeof t[n]!="number"||(Array.isArray(t[n])?t[n]=e.getIds(r,t[n]):t[n]=e.getId(r,t[n]));return t}replaceIds(e,t,r){return this.replace(this.crossOriginIframeMirror,e,t,r)}replaceStyleIds(e,t,r){return this.replace(this.crossOriginIframeStyleMirror,e,t,r)}replaceIdOnNode(e,t){this.replaceIds(e,t,["id","rootId"]),"childNodes"in e&&e.childNodes.forEach(r=>{this.replaceIdOnNode(r,t)})}patchRootIdOnNode(e,t){e.type!==wo.Document&&!e.rootId&&(e.rootId=t),"childNodes"in e&&e.childNodes.forEach(r=>{this.patchRootIdOnNode(r,t)})}}class rf{constructor(e){w(this,"shadowDoms",new WeakSet),w(this,"mutationCb"),w(this,"scrollCb"),w(this,"bypassOptions"),w(this,"mirror"),w(this,"restoreHandlers",[]),this.mutationCb=e.mutationCb,this.scrollCb=e.scrollCb,this.bypassOptions=e.bypassOptions,this.mirror=e.mirror,this.init()}init(){this.reset(),this.patchAttachShadow(Element,document)}addShadowRoot(e,t){if(!Ye(e)||this.shadowDoms.has(e))return;this.shadowDoms.add(e);const r=xo({...this.bypassOptions,doc:t,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this},e);this.restoreHandlers.push(()=>r.disconnect()),this.restoreHandlers.push(Ao({...this.bypassOptions,scrollCb:this.scrollCb,doc:e,mirror:this.mirror})),setTimeout(()=>{e.adoptedStyleSheets&&e.adoptedStyleSheets.length>0&&this.bypassOptions.stylesheetManager.adoptStyleSheets(e.adoptedStyleSheets,this.mirror.getId(I.host(e))),this.restoreHandlers.push(Oo({mirror:this.mirror,stylesheetManager:this.bypassOptions.stylesheetManager},e))},0)}observeAttachShadow(e){!e.contentWindow||!e.contentDocument||this.patchAttachShadow(e.contentWindow.Element,e.contentDocument)}patchAttachShadow(e,t){const r=this;this.restoreHandlers.push(Re(e.prototype,"attachShadow",function(i){return function(n){const o=i.call(this,n),l=I.shadowRoot(this);return l&&yo(this)&&r.addShadowRoot(l,t),o}}))}reset(){this.restoreHandlers.forEach(e=>{try{e()}catch{}}),this.restoreHandlers=[],this.shadowDoms=new WeakSet}}for(var Ve="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",sf=typeof Uint8Array>"u"?[]:new Uint8Array(256),pr=0;pr<Ve.length;pr++)sf[Ve.charCodeAt(pr)]=pr;var nf=function(s){var e=new Uint8Array(s),t,r=e.length,i="";for(t=0;t<r;t+=3)i+=Ve[e[t]>>2],i+=Ve[(e[t]&3)<<4|e[t+1]>>4],i+=Ve[(e[t+1]&15)<<2|e[t+2]>>6],i+=Ve[e[t+2]&63];return r%3===2?i=i.substring(0,i.length-1)+"=":r%3===1&&(i=i.substring(0,i.length-2)+"=="),i};const Mo=new Map;function of(s,e){let t=Mo.get(s);return t||(t=new Map,Mo.set(s,t)),t.has(e)||t.set(e,[]),t.get(e)}const $o=(s,e,t)=>{if(!s||!(ko(s,e)||typeof s=="object"))return;const r=s.constructor.name,i=of(t,r);let n=i.indexOf(s);return n===-1&&(n=i.length,i.push(s)),n};function mr(s,e,t){if(s instanceof Array)return s.map(r=>mr(r,e,t));if(s===null)return s;if(s instanceof Float32Array||s instanceof Float64Array||s instanceof Int32Array||s instanceof Uint32Array||s instanceof Uint8Array||s instanceof Uint16Array||s instanceof Int16Array||s instanceof Int8Array||s instanceof Uint8ClampedArray)return{rr_type:s.constructor.name,args:[Object.values(s)]};if(s instanceof ArrayBuffer){const r=s.constructor.name,i=nf(s);return{rr_type:r,base64:i}}else{if(s instanceof DataView)return{rr_type:s.constructor.name,args:[mr(s.buffer,e,t),s.byteOffset,s.byteLength]};if(s instanceof HTMLImageElement){const r=s.constructor.name,{src:i}=s;return{rr_type:r,src:i}}else if(s instanceof HTMLCanvasElement){const r="HTMLImageElement",i=s.toDataURL();return{rr_type:r,src:i}}else{if(s instanceof ImageData)return{rr_type:s.constructor.name,args:[mr(s.data,e,t),s.width,s.height]};if(ko(s,e)||typeof s=="object"){const r=s.constructor.name,i=$o(s,e,t);return{rr_type:r,index:i}}}}return s}const No=(s,e,t)=>s.map(r=>mr(r,e,t)),ko=(s,e)=>!!["WebGLActiveInfo","WebGLBuffer","WebGLFramebuffer","WebGLProgram","WebGLRenderbuffer","WebGLShader","WebGLShaderPrecisionFormat","WebGLTexture","WebGLUniformLocation","WebGLVertexArrayObject","WebGLVertexArrayObjectOES"].filter(i=>typeof e[i]=="function").find(i=>s instanceof e[i]);function af(s,e,t,r){const i=[],n=Object.getOwnPropertyNames(e.CanvasRenderingContext2D.prototype);for(const o of n)try{if(typeof e.CanvasRenderingContext2D.prototype[o]!="function")continue;const l=Re(e.CanvasRenderingContext2D.prototype,o,function(a){return function(...u){return Q(this.canvas,t,r,!0)||setTimeout(()=>{const c=No(u,e,this);s(this.canvas,{type:We["2D"],property:o,args:c})},0),a.apply(this,u)}});i.push(l)}catch{const l=ur(e.CanvasRenderingContext2D.prototype,o,{set(a){s(this.canvas,{type:We["2D"],property:o,args:[a],setter:!0})}});i.push(l)}return()=>{i.forEach(o=>o())}}function lf(s){return s==="experimental-webgl"?"webgl":s}function To(s,e,t,r){const i=[];try{const n=Re(s.HTMLCanvasElement.prototype,"getContext",function(o){return function(l,...a){if(!Q(this,e,t,!0)){const u=lf(l);if("__context"in this||(this.__context=u),r&&["webgl","webgl2"].includes(u))if(a[0]&&typeof a[0]=="object"){const c=a[0];c.preserveDrawingBuffer||(c.preserveDrawingBuffer=!0)}else a.splice(0,1,{preserveDrawingBuffer:!0})}return o.apply(this,[l,...a])}});i.push(n)}catch{console.error("failed to patch HTMLCanvasElement.prototype.getContext")}return()=>{i.forEach(n=>n())}}function Po(s,e,t,r,i,n){const o=[],l=Object.getOwnPropertyNames(s);for(const a of l)if(!["isContextLost","canvas","drawingBufferWidth","drawingBufferHeight"].includes(a))try{if(typeof s[a]!="function")continue;const u=Re(s,a,function(c){return function(...h){const p=c.apply(this,h);if($o(p,n,this),"tagName"in this.canvas&&!Q(this.canvas,r,i,!0)){const m=No(h,n,this),g={type:e,property:a,args:m};t(this.canvas,g)}return p}});o.push(u)}catch{const u=ur(s,a,{set(c){t(this.canvas,{type:e,property:a,args:[c],setter:!0})}});o.push(u)}return o}function uf(s,e,t,r){const i=[];return i.push(...Po(e.WebGLRenderingContext.prototype,We.WebGL,s,t,r,e)),typeof e.WebGL2RenderingContext<"u"&&i.push(...Po(e.WebGL2RenderingContext.prototype,We.WebGL2,s,t,r,e)),()=>{i.forEach(n=>n())}}const Do="KGZ1bmN0aW9uKCkgewogICJ1c2Ugc3RyaWN0IjsKICB2YXIgY2hhcnMgPSAiQUJDREVGR0hJSktMTU5PUFFSU1RVVldYWVphYmNkZWZnaGlqa2xtbm9wcXJzdHV2d3h5ejAxMjM0NTY3ODkrLyI7CiAgdmFyIGxvb2t1cCA9IHR5cGVvZiBVaW50OEFycmF5ID09PSAidW5kZWZpbmVkIiA/IFtdIDogbmV3IFVpbnQ4QXJyYXkoMjU2KTsKICBmb3IgKHZhciBpID0gMDsgaSA8IGNoYXJzLmxlbmd0aDsgaSsrKSB7CiAgICBsb29rdXBbY2hhcnMuY2hhckNvZGVBdChpKV0gPSBpOwogIH0KICB2YXIgZW5jb2RlID0gZnVuY3Rpb24oYXJyYXlidWZmZXIpIHsKICAgIHZhciBieXRlcyA9IG5ldyBVaW50OEFycmF5KGFycmF5YnVmZmVyKSwgaTIsIGxlbiA9IGJ5dGVzLmxlbmd0aCwgYmFzZTY0ID0gIiI7CiAgICBmb3IgKGkyID0gMDsgaTIgPCBsZW47IGkyICs9IDMpIHsKICAgICAgYmFzZTY0ICs9IGNoYXJzW2J5dGVzW2kyXSA+PiAyXTsKICAgICAgYmFzZTY0ICs9IGNoYXJzWyhieXRlc1tpMl0gJiAzKSA8PCA0IHwgYnl0ZXNbaTIgKyAxXSA+PiA0XTsKICAgICAgYmFzZTY0ICs9IGNoYXJzWyhieXRlc1tpMiArIDFdICYgMTUpIDw8IDIgfCBieXRlc1tpMiArIDJdID4+IDZdOwogICAgICBiYXNlNjQgKz0gY2hhcnNbYnl0ZXNbaTIgKyAyXSAmIDYzXTsKICAgIH0KICAgIGlmIChsZW4gJSAzID09PSAyKSB7CiAgICAgIGJhc2U2NCA9IGJhc2U2NC5zdWJzdHJpbmcoMCwgYmFzZTY0Lmxlbmd0aCAtIDEpICsgIj0iOwogICAgfSBlbHNlIGlmIChsZW4gJSAzID09PSAxKSB7CiAgICAgIGJhc2U2NCA9IGJhc2U2NC5zdWJzdHJpbmcoMCwgYmFzZTY0Lmxlbmd0aCAtIDIpICsgIj09IjsKICAgIH0KICAgIHJldHVybiBiYXNlNjQ7CiAgfTsKICBjb25zdCBsYXN0QmxvYk1hcCA9IC8qIEBfX1BVUkVfXyAqLyBuZXcgTWFwKCk7CiAgY29uc3QgdHJhbnNwYXJlbnRCbG9iTWFwID0gLyogQF9fUFVSRV9fICovIG5ldyBNYXAoKTsKICBhc3luYyBmdW5jdGlvbiBnZXRUcmFuc3BhcmVudEJsb2JGb3Iod2lkdGgsIGhlaWdodCwgZGF0YVVSTE9wdGlvbnMpIHsKICAgIGNvbnN0IGlkID0gYCR7d2lkdGh9LSR7aGVpZ2h0fWA7CiAgICBpZiAoIk9mZnNjcmVlbkNhbnZhcyIgaW4gZ2xvYmFsVGhpcykgewogICAgICBpZiAodHJhbnNwYXJlbnRCbG9iTWFwLmhhcyhpZCkpIHJldHVybiB0cmFuc3BhcmVudEJsb2JNYXAuZ2V0KGlkKTsKICAgICAgY29uc3Qgb2Zmc2NyZWVuID0gbmV3IE9mZnNjcmVlbkNhbnZhcyh3aWR0aCwgaGVpZ2h0KTsKICAgICAgb2Zmc2NyZWVuLmdldENvbnRleHQoIjJkIik7CiAgICAgIGNvbnN0IGJsb2IgPSBhd2FpdCBvZmZzY3JlZW4uY29udmVydFRvQmxvYihkYXRhVVJMT3B0aW9ucyk7CiAgICAgIGNvbnN0IGFycmF5QnVmZmVyID0gYXdhaXQgYmxvYi5hcnJheUJ1ZmZlcigpOwogICAgICBjb25zdCBiYXNlNjQgPSBlbmNvZGUoYXJyYXlCdWZmZXIpOwogICAgICB0cmFuc3BhcmVudEJsb2JNYXAuc2V0KGlkLCBiYXNlNjQpOwogICAgICByZXR1cm4gYmFzZTY0OwogICAgfSBlbHNlIHsKICAgICAgcmV0dXJuICIiOwogICAgfQogIH0KICBjb25zdCB3b3JrZXIgPSBzZWxmOwogIHdvcmtlci5vbm1lc3NhZ2UgPSBhc3luYyBmdW5jdGlvbihlKSB7CiAgICBpZiAoIk9mZnNjcmVlbkNhbnZhcyIgaW4gZ2xvYmFsVGhpcykgewogICAgICBjb25zdCB7IGlkLCBiaXRtYXAsIHdpZHRoLCBoZWlnaHQsIGRhdGFVUkxPcHRpb25zIH0gPSBlLmRhdGE7CiAgICAgIGNvbnN0IHRyYW5zcGFyZW50QmFzZTY0ID0gZ2V0VHJhbnNwYXJlbnRCbG9iRm9yKAogICAgICAgIHdpZHRoLAogICAgICAgIGhlaWdodCwKICAgICAgICBkYXRhVVJMT3B0aW9ucwogICAgICApOwogICAgICBjb25zdCBvZmZzY3JlZW4gPSBuZXcgT2Zmc2NyZWVuQ2FudmFzKHdpZHRoLCBoZWlnaHQpOwogICAgICBjb25zdCBjdHggPSBvZmZzY3JlZW4uZ2V0Q29udGV4dCgiMmQiKTsKICAgICAgY3R4LmRyYXdJbWFnZShiaXRtYXAsIDAsIDApOwogICAgICBiaXRtYXAuY2xvc2UoKTsKICAgICAgY29uc3QgYmxvYiA9IGF3YWl0IG9mZnNjcmVlbi5jb252ZXJ0VG9CbG9iKGRhdGFVUkxPcHRpb25zKTsKICAgICAgY29uc3QgdHlwZSA9IGJsb2IudHlwZTsKICAgICAgY29uc3QgYXJyYXlCdWZmZXIgPSBhd2FpdCBibG9iLmFycmF5QnVmZmVyKCk7CiAgICAgIGNvbnN0IGJhc2U2NCA9IGVuY29kZShhcnJheUJ1ZmZlcik7CiAgICAgIGlmICghbGFzdEJsb2JNYXAuaGFzKGlkKSAmJiBhd2FpdCB0cmFuc3BhcmVudEJhc2U2NCA9PT0gYmFzZTY0KSB7CiAgICAgICAgbGFzdEJsb2JNYXAuc2V0KGlkLCBiYXNlNjQpOwogICAgICAgIHJldHVybiB3b3JrZXIucG9zdE1lc3NhZ2UoeyBpZCB9KTsKICAgICAgfQogICAgICBpZiAobGFzdEJsb2JNYXAuZ2V0KGlkKSA9PT0gYmFzZTY0KSByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQgfSk7CiAgICAgIHdvcmtlci5wb3N0TWVzc2FnZSh7CiAgICAgICAgaWQsCiAgICAgICAgdHlwZSwKICAgICAgICBiYXNlNjQsCiAgICAgICAgd2lkdGgsCiAgICAgICAgaGVpZ2h0CiAgICAgIH0pOwogICAgICBsYXN0QmxvYk1hcC5zZXQoaWQsIGJhc2U2NCk7CiAgICB9IGVsc2UgewogICAgICByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQ6IGUuZGF0YS5pZCB9KTsKICAgIH0KICB9Owp9KSgpOwovLyMgc291cmNlTWFwcGluZ1VSTD1pbWFnZS1iaXRtYXAtZGF0YS11cmwtd29ya2VyLUlKcEM3Z19iLmpzLm1hcAo=",cf=s=>Uint8Array.from(atob(s),e=>e.charCodeAt(0)),Lo=typeof window<"u"&&window.Blob&&new Blob([cf(Do)],{type:"text/javascript;charset=utf-8"});function hf(s){let e;try{if(e=Lo&&(window.URL||window.webkitURL).createObjectURL(Lo),!e)throw"";const t=new Worker(e,{name:s==null?void 0:s.name});return t.addEventListener("error",()=>{(window.URL||window.webkitURL).revokeObjectURL(e)}),t}catch{return new Worker("data:text/javascript;base64,"+Do,{name:s==null?void 0:s.name})}finally{e&&(window.URL||window.webkitURL).revokeObjectURL(e)}}class ff{constructor(e){w(this,"pendingCanvasMutations",new Map),w(this,"rafStamps",{latestId:0,invokeId:null}),w(this,"mirror"),w(this,"mutationCb"),w(this,"resetObservers"),w(this,"frozen",!1),w(this,"locked",!1),w(this,"processMutation",(a,u)=>{(this.rafStamps.invokeId&&this.rafStamps.latestId!==this.rafStamps.invokeId||!this.rafStamps.invokeId)&&(this.rafStamps.invokeId=this.rafStamps.latestId),this.pendingCanvasMutations.has(a)||this.pendingCanvasMutations.set(a,[]),this.pendingCanvasMutations.get(a).push(u)});const{sampling:t="all",win:r,blockClass:i,blockSelector:n,recordCanvas:o,dataURLOptions:l}=e;this.mutationCb=e.mutationCb,this.mirror=e.mirror,o&&t==="all"&&this.initCanvasMutationObserver(r,i,n),o&&typeof t=="number"&&this.initCanvasFPSObserver(t,r,i,n,{dataURLOptions:l})}reset(){this.pendingCanvasMutations.clear(),this.resetObservers&&this.resetObservers()}freeze(){this.frozen=!0}unfreeze(){this.frozen=!1}lock(){this.locked=!0}unlock(){this.locked=!1}initCanvasFPSObserver(e,t,r,i,n){const o=To(t,r,i,!0),l=new Map,a=new hf;a.onmessage=g=>{const{id:d}=g.data;if(l.set(d,!1),!("base64"in g.data))return;const{base64:f,type:S,width:b,height:y}=g.data;this.mutationCb({id:d,type:We["2D"],commands:[{property:"clearRect",args:[0,0,b,y]},{property:"drawImage",args:[{rr_type:"ImageBitmap",args:[{rr_type:"Blob",data:[{rr_type:"ArrayBuffer",base64:f}],type:S}]},0,0]}]})};const u=1e3/e;let c=0,h;const p=()=>{const g=[];return t.document.querySelectorAll("canvas").forEach(d=>{Q(d,r,i,!0)||g.push(d)}),g},m=g=>{if(c&&g-c<u){h=requestAnimationFrame(m);return}c=g,p().forEach(async d=>{var f;const S=this.mirror.getId(d);if(l.get(S)||d.width===0||d.height===0)return;if(l.set(S,!0),["webgl","webgl2"].includes(d.__context)){const y=d.getContext(d.__context);((f=y==null?void 0:y.getContextAttributes())==null?void 0:f.preserveDrawingBuffer)===!1&&y.clear(y.COLOR_BUFFER_BIT)}const b=await createImageBitmap(d);a.postMessage({id:S,bitmap:b,width:d.width,height:d.height,dataURLOptions:n.dataURLOptions},[b])}),h=requestAnimationFrame(m)};h=requestAnimationFrame(m),this.resetObservers=()=>{o(),cancelAnimationFrame(h)}}initCanvasMutationObserver(e,t,r){this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher();const i=To(e,t,r,!1),n=af(this.processMutation.bind(this),e,t,r),o=uf(this.processMutation.bind(this),e,t,r);this.resetObservers=()=>{i(),n(),o()}}startPendingCanvasMutationFlusher(){requestAnimationFrame(()=>this.flushPendingCanvasMutations())}startRAFTimestamping(){const e=t=>{this.rafStamps.latestId=t,requestAnimationFrame(e)};requestAnimationFrame(e)}flushPendingCanvasMutations(){this.pendingCanvasMutations.forEach((e,t)=>{const r=this.mirror.getId(t);this.flushPendingCanvasMutationFor(t,r)}),requestAnimationFrame(()=>this.flushPendingCanvasMutations())}flushPendingCanvasMutationFor(e,t){if(this.frozen||this.locked)return;const r=this.pendingCanvasMutations.get(e);if(!r||t===-1)return;const i=r.map(o=>{const{type:l,...a}=o;return a}),{type:n}=r[0];this.mutationCb({id:t,type:n,commands:i}),this.pendingCanvasMutations.delete(e)}}class df{constructor(e){w(this,"trackedLinkElements",new WeakSet),w(this,"mutationCb"),w(this,"adoptedStyleSheetCb"),w(this,"styleMirror",new Th),this.mutationCb=e.mutationCb,this.adoptedStyleSheetCb=e.adoptedStyleSheetCb}attachLinkElement(e,t){"_cssText"in t.attributes&&this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:t.id,attributes:t.attributes}]}),this.trackLinkElement(e)}trackLinkElement(e){this.trackedLinkElements.has(e)||(this.trackedLinkElements.add(e),this.trackStylesheetInLinkElement(e))}adoptStyleSheets(e,t){if(e.length===0)return;const r={id:t,styleIds:[]},i=[];for(const n of e){let o;this.styleMirror.has(n)?o=this.styleMirror.getId(n):(o=this.styleMirror.add(n),i.push({styleId:o,rules:Array.from(n.rules||CSSRule,(l,a)=>({rule:Xs(l,n.href),index:a}))})),r.styleIds.push(o)}i.length>0&&(r.styles=i),this.adoptedStyleSheetCb(r)}reset(){this.styleMirror.reset(),this.trackedLinkElements=new WeakSet}trackStylesheetInLinkElement(e){}}class pf{constructor(){w(this,"nodeMap",new WeakMap),w(this,"active",!1)}inOtherBuffer(e,t){const r=this.nodeMap.get(e);return r&&Array.from(r).some(i=>i!==t)}add(e,t){this.active||(this.active=!0,requestAnimationFrame(()=>{this.nodeMap=new WeakMap,this.active=!1})),this.nodeMap.set(e,(this.nodeMap.get(e)||new Set).add(t))}destroy(){}}let z,gr,Us,yr=!1;try{if(Array.from([1],s=>s*2)[0]!==2){const s=document.createElement("iframe");document.body.appendChild(s),Array.from=((js=s.contentWindow)==null?void 0:js.Array.from)||Array.from,document.body.removeChild(s)}}catch(s){console.debug("Unable to override Array.from",s)}const le=va();function de(s={}){const{emit:e,checkoutEveryNms:t,checkoutEveryNth:r,blockClass:i="rr-block",blockSelector:n=null,ignoreClass:o="rr-ignore",ignoreSelector:l=null,maskTextClass:a="rr-mask",maskTextSelector:u=null,inlineStylesheet:c=!0,maskAllInputs:h,maskInputOptions:p,slimDOMOptions:m,maskInputFn:g,maskTextFn:d,hooks:f,packFn:S,sampling:b={},dataURLOptions:y={},mousemoveWait:C,recordDOM:k=!0,recordCanvas:D=!1,recordCrossOriginIframes:H=!1,recordAfter:B=s.recordAfter==="DOMContentLoaded"?s.recordAfter:"load",userTriggeredOnInput:V=!1,collectFonts:Z=!1,inlineImages:ie=!1,plugins:pe,keepIframeSrcFn:O=()=>!1,ignoreCSSAttributes:pt=new Set([]),errorHandler:mt}=s;Bh(mt);const Y=H?window.parent===window:!0;let ne=!1;if(!Y)try{window.parent.document&&(ne=!1)}catch{ne=!0}if(Y&&!e)throw new Error("emit function is required");if(!Y&&!ne)return()=>{};C!==void 0&&b.mousemove===void 0&&(b.mousemove=C),le.reset();const Me=h===!0?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,password:!0}:p!==void 0?p:{password:!0},me=ai(m);kh();let zo,zs=0;const Wo=E=>{for(const ue of pe||[])ue.eventProcessor&&(E=ue.eventProcessor(E));return S&&!ne&&(E=S(E)),E};z=(E,ue)=>{var W;const G=E;if(G.timestamp=cr(),(W=Oe[0])!=null&&W.isFrozen()&&G.type!==R.FullSnapshot&&!(G.type===R.IncrementalSnapshot&&G.data.source===x.Mutation)&&Oe.forEach(te=>te.unfreeze()),Y)e==null||e(Wo(G),ue);else if(ne){const te={type:"rrweb",event:Wo(G),origin:window.location.origin,isCheckout:ue};window.parent.postMessage(te,"*")}if(G.type===R.FullSnapshot)zo=G,zs=0;else if(G.type===R.IncrementalSnapshot){if(G.data.source===x.Mutation&&G.data.isAttachIframe)return;zs++;const te=r&&zs>=r,T=t&&G.timestamp-zo.timestamp>t;(te||T)&&gr(!0)}};const br=E=>{z({type:R.IncrementalSnapshot,data:{source:x.Mutation,...E}})},Go=E=>z({type:R.IncrementalSnapshot,data:{source:x.Scroll,...E}}),Vo=E=>z({type:R.IncrementalSnapshot,data:{source:x.CanvasMutation,...E}}),Vf=E=>z({type:R.IncrementalSnapshot,data:{source:x.AdoptedStyleSheet,...E}}),$e=new df({mutationCb:br,adoptedStyleSheetCb:Vf}),Ne=new tf({mirror:le,mutationCb:br,stylesheetManager:$e,recordCrossOriginIframes:H,wrappedEmit:z});for(const E of pe||[])E.getMirror&&E.getMirror({nodeMirror:le,crossOriginIframeMirror:Ne.crossOriginIframeMirror,crossOriginIframeStyleMirror:Ne.crossOriginIframeStyleMirror});const Ws=new pf;Us=new ff({recordCanvas:D,mutationCb:Vo,win:window,blockClass:i,blockSelector:n,mirror:le,sampling:b.canvas,dataURLOptions:y});const vr=new rf({mutationCb:br,scrollCb:Go,bypassOptions:{blockClass:i,blockSelector:n,maskTextClass:a,maskTextSelector:u,inlineStylesheet:c,maskInputOptions:Me,dataURLOptions:y,maskTextFn:d,maskInputFn:g,recordCanvas:D,inlineImages:ie,sampling:b,slimDOMOptions:me,iframeManager:Ne,stylesheetManager:$e,canvasManager:Us,keepIframeSrcFn:O,processedNodeManager:Ws},mirror:le});gr=(E=!1)=>{if(!k)return;z({type:R.Meta,data:{href:window.location.href,width:co(),height:uo()}},E),$e.reset(),vr.init(),Oe.forEach(W=>W.lock());const ue=ja(document,{mirror:le,blockClass:i,blockSelector:n,maskTextClass:a,maskTextSelector:u,inlineStylesheet:c,maskAllInputs:Me,maskTextFn:d,maskInputFn:g,slimDOM:me,dataURLOptions:y,recordCanvas:D,inlineImages:ie,onSerialize:W=>{po(W,le)&&Ne.addIframe(W),mo(W,le)&&$e.trackLinkElement(W),_s(W)&&vr.addShadowRoot(I.shadowRoot(W),document)},onIframeLoad:(W,G)=>{Ne.attachIframe(W,G),vr.observeAttachShadow(W)},onStylesheetLoad:(W,G)=>{$e.attachLinkElement(W,G)},keepIframeSrcFn:O});if(!ue)return console.warn("Failed to snapshot the document");z({type:R.FullSnapshot,data:{node:ue,initialOffset:lo(window)}},E),Oe.forEach(W=>W.unlock()),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&$e.adoptStyleSheets(document.adoptedStyleSheets,le.getId(document))};try{const E=[],ue=G=>{var te;return A(ef)({mutationCb:br,mousemoveCb:(T,Gs)=>z({type:R.IncrementalSnapshot,data:{source:Gs,positions:T}}),mouseInteractionCb:T=>z({type:R.IncrementalSnapshot,data:{source:x.MouseInteraction,...T}}),scrollCb:Go,viewportResizeCb:T=>z({type:R.IncrementalSnapshot,data:{source:x.ViewportResize,...T}}),inputCb:T=>z({type:R.IncrementalSnapshot,data:{source:x.Input,...T}}),mediaInteractionCb:T=>z({type:R.IncrementalSnapshot,data:{source:x.MediaInteraction,...T}}),styleSheetRuleCb:T=>z({type:R.IncrementalSnapshot,data:{source:x.StyleSheetRule,...T}}),styleDeclarationCb:T=>z({type:R.IncrementalSnapshot,data:{source:x.StyleDeclaration,...T}}),canvasMutationCb:Vo,fontCb:T=>z({type:R.IncrementalSnapshot,data:{source:x.Font,...T}}),selectionCb:T=>{z({type:R.IncrementalSnapshot,data:{source:x.Selection,...T}})},customElementCb:T=>{z({type:R.IncrementalSnapshot,data:{source:x.CustomElement,...T}})},blockClass:i,ignoreClass:o,ignoreSelector:l,maskTextClass:a,maskTextSelector:u,maskInputOptions:Me,inlineStylesheet:c,sampling:b,recordDOM:k,recordCanvas:D,inlineImages:ie,userTriggeredOnInput:V,collectFonts:Z,doc:G,maskInputFn:g,maskTextFn:d,keepIframeSrcFn:O,blockSelector:n,slimDOMOptions:me,dataURLOptions:y,mirror:le,iframeManager:Ne,stylesheetManager:$e,shadowDomManager:vr,processedNodeManager:Ws,canvasManager:Us,ignoreCSSAttributes:pt,plugins:((te=pe==null?void 0:pe.filter(T=>T.observer))==null?void 0:te.map(T=>({observer:T.observer,options:T.options,callback:Gs=>z({type:R.Plugin,data:{plugin:T.name,payload:Gs}})})))||[]},f)};Ne.addLoadListener(G=>{try{E.push(ue(G.contentDocument))}catch(te){console.warn(te)}});const W=()=>{gr(),E.push(ue(document)),yr=!0};return["interactive","complete"].includes(document.readyState)?W():(E.push(X("DOMContentLoaded",()=>{z({type:R.DomContentLoaded,data:{}}),B==="DOMContentLoaded"&&W()})),E.push(X("load",()=>{z({type:R.Load,data:{}}),B==="load"&&W()},window))),()=>{E.forEach(G=>{try{G()}catch(te){String(te).toLowerCase().includes("cross-origin")||console.warn(te)}}),Ws.destroy(),yr=!1,zh()}}catch(E){console.warn(E)}}de.addCustomEvent=(s,e)=>{if(!yr)throw new Error("please add custom event after start recording");z({type:R.Custom,data:{tag:s,payload:e}})},de.freezePage=()=>{Oe.forEach(s=>s.freeze())},de.takeFullSnapshot=s=>{if(!yr)throw new Error("please take full snapshot after start recording");gr(s)},de.mirror=le;var _o;(function(s){s[s.NotStarted=0]="NotStarted",s[s.Running=1]="Running",s[s.Stopped=2]="Stopped"})(_o||(_o={}));const{addCustomEvent:sd}=de,{freezePage:id}=de,{takeFullSnapshot:nd}=de;async function mf(s){const t=new TextEncoder().encode(s),r=new CompressionStream("gzip"),i=r.writable.getWriter();i.write(t),i.close();const n=r.readable.getReader(),o=[];let l=0;for(;;){const{done:c,value:h}=await n.read();if(c)break;o.push(h),l+=h.length}const a=new Uint8Array(l);let u=0;for(const c of o)a.set(c,u),u+=c.length;return a}async function gf(s,e,t,r={}){if(r.keepalive)try{return fetch(s,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${e}`},body:t,keepalive:!0}),!0}catch{return!1}const n=await mf(t);return(await fetch(s,{method:"POST",headers:{"Content-Type":"application/json","Content-Encoding":"gzip",Authorization:`Bearer ${e}`},body:n})).status===200}var yf=class{constructor(s={}){v(this,"segmentDuration");v(this,"current");v(this,"previous",null);v(this,"stopFn",null);v(this,"onSegmentReady");v(this,"onActivity");this.segmentDuration=s.segmentDuration??3e4,this.current=this.newSegment(),this.onSegmentReady=s.onSegmentReady,this.onActivity=s.onActivity}start(){this.stopFn=de({emit:s=>{this.onEvent(s)}})}stop(){this.stopFn&&(this.stopFn(),this.stopFn=null)}onEvent(s){if(this.onActivity)try{this.onActivity()}catch{}if(this.current.events.length>0&&s.timestamp-this.current.startedAtMs>=this.segmentDuration){const e=this.current,t=s.timestamp-this.current.startedAtMs>=2*this.segmentDuration;if(this.previous=t?null:this.current,this.current=this.newSegment(),de.takeFullSnapshot(),this.onSegmentReady&&e.events.length>0){const r=e.events[e.events.length-1].timestamp;try{this.onSegmentReady({events:e.events,startedAt:e.startedAt,endedAt:new Date(r).toISOString()})}catch{}}}this.current.events.length===0&&(this.current.startedAtMs=s.timestamp,this.current.startedAt=new Date(s.timestamp).toISOString()),this.current.events.push(s)}drainCurrent(){if(this.current.events.length===0)return null;const s=this.current;this.current=this.newSegment();const e=s.events[s.events.length-1].timestamp;return{events:s.events,startedAt:s.startedAt,endedAt:new Date(e).toISOString()}}newSegment(){const s=Date.now();return{events:[],startedAt:new Date(s).toISOString(),startedAtMs:s}}getSegments(){const s=[];return this.previous&&this.previous.events.length>0&&s.push({events:this.previous.events,timestamp:this.previous.startedAt}),this.current.events.length>0&&s.push({events:this.current.events,timestamp:this.current.startedAt}),s}hasSegments(){return this.current.events.length>0||this.previous!==null&&this.previous.events.length>0}flush(){this.previous=null,this.current=this.newSegment(),this.stopFn&&de.takeFullSnapshot()}},wf=class{constructor(s){v(this,"inactivityMs");v(this,"maxDurationMs");v(this,"checkIntervalMs");v(this,"onSessionEnd");v(this,"onSoftFlush");v(this,"onUnloading");v(this,"onSessionRestart");v(this,"startedAtMs");v(this,"lastActivityMs");v(this,"timer",null);v(this,"installed",!1);v(this,"ended",!1);v(this,"boundPagehide",()=>this.handlePagehide());v(this,"boundVisibility",()=>this.handleVisibility());v(this,"boundPageshow",s=>this.handlePageshow(s));this.inactivityMs=s.inactivityMs??15*6e4,this.maxDurationMs=s.maxDurationMs??60*6e4,this.checkIntervalMs=s.checkIntervalMs??3e4,this.onSessionEnd=s.onSessionEnd,this.onSoftFlush=s.onSoftFlush??(()=>{}),this.onUnloading=s.onUnloading??(()=>{}),this.onSessionRestart=s.onSessionRestart??(()=>{});const e=Date.now();this.startedAtMs=e,this.lastActivityMs=e}install(){this.installed||typeof window>"u"||(window.addEventListener("pagehide",this.boundPagehide),window.addEventListener("pageshow",this.boundPageshow),document.addEventListener("visibilitychange",this.boundVisibility),this.timer=setInterval(()=>this.tick(),this.checkIntervalMs),this.installed=!0)}uninstall(){this.installed&&(window.removeEventListener("pagehide",this.boundPagehide),window.removeEventListener("pageshow",this.boundPageshow),document.removeEventListener("visibilitychange",this.boundVisibility),this.timer!==null&&(clearInterval(this.timer),this.timer=null),this.installed=!1)}markActivity(){this.lastActivityMs=Date.now()}reset(){const s=Date.now();this.startedAtMs=s,this.lastActivityMs=s,this.ended=!1}startedAt(){return new Date(this.startedAtMs)}tick(){if(this.ended)return;const s=Date.now();(s-this.lastActivityMs>=this.inactivityMs||s-this.startedAtMs>=this.maxDurationMs)&&this.endSession()}handlePagehide(){try{this.onUnloading()}catch{}this.endSession()}handlePageshow(s){if(s.persisted){this.reset();try{this.onSessionRestart()}catch{}}}handleVisibility(){typeof document>"u"||document.visibilityState==="hidden"&&this.onSoftFlush()}endSession(){if(!this.ended){this.ended=!0;try{this.onSessionEnd()}catch{}}}};function Fo(){if(typeof window>"u")return{};const s={};try{s.url=window.location.href,s.path=window.location.pathname}catch{}try{document.referrer&&(s.referrer=document.referrer)}catch{}try{navigator.userAgent&&(s.userAgent=navigator.userAgent),navigator.language&&(s.language=navigator.language),navigator.platform&&(s.platform=navigator.platform)}catch{}try{const e=window.innerWidth,t=window.innerHeight;Number.isFinite(e)&&Number.isFinite(t)&&(s.viewport=`${e}x${t}`)}catch{}try{if(window.screen){const e=window.screen.width,t=window.screen.height;Number.isFinite(e)&&Number.isFinite(t)&&(s.screen=`${e}x${t}`)}}catch{}try{const e=Intl.DateTimeFormat().resolvedOptions().timeZone;e&&(s.timezone=e)}catch{}return s}function wr(s){return new Date(s).toISOString()}function Sf(s,e,t){if(s.length>0){const i=[];for(const n of s){const o=n==null?void 0:n.timestamp;typeof o=="number"&&Number.isFinite(o)&&i.push(o)}if(i.length>0)return{startedAt:wr(Math.min(...i)),endedAt:wr(Math.max(...i))}}const r=[...e.map(i=>Date.parse(i.timestamp)),...t.map(i=>Date.parse(i.timestamp))].filter(i=>Number.isFinite(i));return r.length===0?{}:{startedAt:wr(Math.min(...r)),endedAt:wr(Math.max(...r))}}var bf=["Failed to fetch","NetworkError when attempting to fetch resource","Load failed","Network Error","The operation was aborted",/timeout/i,/status code 4\d{2}/,/failed: 4\d{2}/],vf=class{constructor(s,e={}){v(this,"apiUrl");v(this,"token");v(this,"debug");v(this,"debounceMs");v(this,"retryDelayMs");v(this,"version");v(this,"pendingExceptions",[]);v(this,"pendingRecordings",[]);v(this,"pendingSessions",[]);v(this,"isSyncing",!1);v(this,"debounceTimer",null);v(this,"retryTimer",null);v(this,"recorder",null);v(this,"lifecycle",null);v(this,"recordAllSessions");v(this,"sessionId",null);v(this,"sessionStartedAt",null);v(this,"segmentIndex",0);v(this,"globalAttributes",{});v(this,"unloading",!1);v(this,"ignoreErrors");v(this,"beforeCapture");v(this,"captureLogs");v(this,"captureNetwork");v(this,"captureNavigation");v(this,"logs");v(this,"actions");const{token:t,apiUrl:r}=ge(s);this.apiUrl=r,this.token=t,this.debug=e.debug??!1,this.debounceMs=e.debounceMs??1500,this.retryDelayMs=e.retryDelayMs??1e4,this.version=e.version??"",this.ignoreErrors=e.ignoreErrors??bf,this.beforeCapture=e.beforeCapture??null,this.captureLogs=e.captureLogs??!0,this.captureNetwork=e.captureNetwork??!0,this.captureNavigation=e.captureNavigation??!0;const i=e.recordAllSessions===!0,n={windowMs:e.eventsWindowMs??(i?3e4:1e4),maxSize:e.eventsMaxCount??(i?600:200)};this.logs=new Vs(n),this.actions=new Vs(n),this.recordAllSessions=e.recordAllSessions??!1;const o=typeof window<"u";if(this.recordAllSessions&&o&&(this.beginSession(),this.lifecycle=new wf({onUnloading:()=>{this.unloading=!0},onSessionEnd:()=>this.endSession(),onSessionRestart:()=>this.restartSession(),onSoftFlush:()=>{(this.pendingSessions.length>0||this.pendingRecordings.length>0)&&this.scheduleSync()}}),this.lifecycle.install()),e.sessionRecording!==!1&&o){const l={segmentDuration:e.sessionRecordingSegmentDuration};this.recordAllSessions&&(l.onSegmentReady=a=>this.handleSegmentReady(a),l.onActivity=()=>{var a;return(a=this.lifecycle)==null?void 0:a.markActivity()}),this.recorder=new yf(l),this.recorder.start()}}beginSession(){this.sessionId=ce(),this.sessionStartedAt=J(),this.segmentIndex=0,this.pendingSessions.push({id:this.sessionId,startedAt:this.sessionStartedAt,attributes:this.composedSessionAttributes()}),this.scheduleSync()}composedSessionAttributes(){return{...Fo(),...this.globalAttributes}}setAttribute(s,e){s&&(this.globalAttributes[s]=e,this.refreshOpenSessionAttributes())}setAttributes(s){if(!s)return;let e=!1;for(const t of Object.keys(s))t&&(this.globalAttributes[t]=s[t],e=!0);e&&this.refreshOpenSessionAttributes()}removeAttribute(s){s in this.globalAttributes&&(delete this.globalAttributes[s],this.refreshOpenSessionAttributes())}clearAttributes(){Object.keys(this.globalAttributes).length!==0&&(this.globalAttributes={},this.refreshOpenSessionAttributes())}currentAttributes(){return{...this.globalAttributes}}refreshOpenSessionAttributes(){!this.sessionId||!this.sessionStartedAt||this.recordAllSessions===!0&&(this.pendingSessions.push({id:this.sessionId,startedAt:this.sessionStartedAt,attributes:this.composedSessionAttributes()}),this.scheduleSync())}endSession(){if(!(!this.sessionId||!this.sessionStartedAt)){if(this.recorder){const s=this.recorder.drainCurrent();s&&s.events.length>0&&this.queueSegment(s)}this.pendingSessions.push({id:this.sessionId,startedAt:this.sessionStartedAt,endedAt:J(),attributes:this.composedSessionAttributes()}),this.unloading?(this.debounceTimer!==null&&(clearTimeout(this.debounceTimer),this.debounceTimer=null),this.doSync()):this.scheduleSync()}}restartSession(){this.unloading=!1,this.beginSession()}handleSegmentReady(s){this.sessionId&&(this.queueSegment(s),this.scheduleSync())}queueSegment(s){if(!this.sessionId)return;const e=this.logs.snapshot(),t=this.actions.snapshot();e.length>0&&this.logs.clear(),t.length>0&&this.actions.clear();const r={sessionId:this.sessionId,segmentIndex:this.segmentIndex++,events:s.events,startedAt:s.startedAt,endedAt:s.endedAt};e.length>0&&(r.logs=e),t.length>0&&(r.actions=t),this.pendingRecordings.push(r)}currentSessionId(){return this.sessionId}recordLog(s,e){this.captureLogs&&this.logs.add({type:"log",timestamp:J(),level:s,message:e})}recordNetworkEvent(s){this.captureNetwork&&(this.isOwnReportUrl(s.url)||this.actions.add({type:"network",timestamp:s.timestamp??J(),method:s.method,url:s.url,durationMs:s.durationMs,statusCode:s.statusCode,requestBytes:s.requestBytes,responseBytes:s.responseBytes,error:s.error}))}isOwnReportUrl(s){return s?!!(s===this.apiUrl||s.startsWith(this.apiUrl+"?")||s.startsWith(this.apiUrl+"#")):!1}recordNavigationEvent(s){this.captureNavigation&&this.actions.add({type:"navigation",timestamp:s.timestamp??J(),action:s.action,from:s.from,to:s.to})}recordAction(s,e,t){this.actions.add({type:"custom",timestamp:J(),category:s,name:e,data:t})}bufferedLogs(){return this.logs.snapshot()}bufferedActions(){return this.actions.snapshot()}addException(s){if(this.shouldIgnore(s)){this.debug&&console.debug("Traceway: exception suppressed by filter",s.stackTrace.slice(0,120));return}s.attributes={...Fo(),...this.globalAttributes,...s.attributes??{}};const e=this.recorder&&this.recorder.hasSegments()?this.recorder.getSegments().flatMap(n=>n.events):[],t=this.logs.snapshot(),r=this.actions.snapshot(),i=e.length>0||t.length>0||r.length>0;if(this.recordAllSessions&&this.sessionId&&(s.sessionId=this.sessionId),i){const n=ce();s.sessionRecordingId=n;const o={exceptionId:n,events:e},l=Sf(e,t,r);l.startedAt&&(o.startedAt=l.startedAt),l.endedAt&&(o.endedAt=l.endedAt),t.length>0&&(o.logs=t),r.length>0&&(o.actions=r),this.pendingRecordings.push(o)}this.pendingExceptions.push(s),this.scheduleSync()}shouldIgnore(s){if(this.ignoreErrors.length>0){const e=s.stackTrace;for(const t of this.ignoreErrors)if(typeof t=="string"){if(e.includes(t))return!0}else if(t.lastIndex=0,t.test(e))return!0}if(this.beforeCapture!==null)try{if(this.beforeCapture(s)===!1)return!0}catch(e){this.debug&&console.error("Traceway: beforeCapture callback threw:",e)}return!1}scheduleSync(){this.debounceTimer!==null&&clearTimeout(this.debounceTimer),this.debounceTimer=setTimeout(()=>{this.debounceTimer=null,this.doSync()},this.debounceMs)}async doSync(){if(this.isSyncing||this.pendingExceptions.length===0&&this.pendingRecordings.length===0&&this.pendingSessions.length===0)return;this.isSyncing=!0;const s=this.pendingExceptions.splice(0),e=this.pendingRecordings.splice(0),t=this.pendingSessions.splice(0),i={collectionFrames:[{stackTraces:s,metrics:[],traces:[],sessionRecordings:e.length>0?e:void 0,sessions:t.length>0?t:void 0}],appVersion:this.version,serverName:""};let n=!1;try{await gf(this.apiUrl,this.token,JSON.stringify(i),this.unloading?{keepalive:!0}:void 0)||(n=!0,this.pendingExceptions.unshift(...s),this.pendingRecordings.unshift(...e),this.pendingSessions.unshift(...t),this.debug&&console.error("Traceway: sync failed, re-queued exceptions"))}catch(o){n=!0,this.pendingExceptions.unshift(...s),this.pendingRecordings.unshift(...e),this.pendingSessions.unshift(...t),this.debug&&console.error("Traceway: sync error:",o)}finally{this.isSyncing=!1,(this.pendingExceptions.length>0||this.pendingRecordings.length>0||this.pendingSessions.length>0)&&(n?this.scheduleRetry():this.doSync())}}scheduleRetry(){this.retryTimer===null&&(this.retryTimer=setTimeout(()=>{this.retryTimer=null,this.doSync()},this.retryDelayMs))}async flush(s){this.debounceTimer!==null&&(clearTimeout(this.debounceTimer),this.debounceTimer=null),this.retryTimer!==null&&(clearTimeout(this.retryTimer),this.retryTimer=null),this.lifecycle&&this.lifecycle.uninstall(),this.recordAllSessions&&this.endSession(),this.recorder&&this.recorder.stop();const e=this.doSync();s!==void 0?await Promise.race([e,new Promise(t=>setTimeout(t,s))]):await e}};function Bs(s){var r;const e=[],t=((r=s.constructor)==null?void 0:r.name)||"Error";if(e.push(`${t}: ${s.message}`),s.stack){const i=s.stack.split(`+`);for(const n of i){const o=n.match(/^\s+at\s+(.+?)\s+\((.+):(\d+):(\d+)\)$/);if(o){const c=Uo(o[1]),h=Sr(o[2]);e.push(`${c}()`),e.push(` ${h}:${o[3]}:${o[4]}`);continue}const l=n.match(/^\s+at\s+(.+):(\d+):(\d+)$/);if(l){const c=Sr(l[1]);e.push("<anonymous>()"),e.push(` ${c}:${l[2]}:${l[3]}`);continue}const a=n.match(/^(.+)@(.+):(\d+):(\d+)$/);if(a){const c=Uo(a[1])||"<anonymous>",h=Sr(a[2]);e.push(`${c}()`),e.push(` ${h}:${a[3]}:${a[4]}`);continue}const u=n.match(/^@(.+):(\d+):(\d+)$/);if(u){const c=Sr(u[1]);e.push("<anonymous>()"),e.push(` ${c}:${u[2]}:${u[3]}`);continue}}}return e.join(``)+`-`}function Fo(s){const e=s.lastIndexOf("/");e>=0&&(s=s.slice(e+1));const t=s.indexOf(".");return t>=0&&(s=s.slice(t+1)),s}function br(s){const e=s.split("/");return e[e.length-1]}var Ae=null;function je(){return Ae}function Sf(s){Ae=s}function Cf(s){Ae===s&&(Ae=null)}function vf(s){try{return new URL(typeof s=="string"?s:s instanceof Request?s.url:s.href,window.location.origin).origin===window.location.origin}catch{return!0}}function If(s){return typeof s=="string"?s:s instanceof URL?s.href:s instanceof Request?s.url:String(s)}function xf(s,e){return e!=null&&e.method?e.method:s instanceof Request?s.method:"GET"}function Of(s){if(s!=null&&s.body){if(typeof s.body=="string")return s.body.length;if(s.body instanceof Blob)return s.body.size;if(s.body instanceof ArrayBuffer||ArrayBuffer.isView(s.body))return s.body.byteLength}}function Rf(s){const e=s.headers.get("content-length");if(e===null)return;const t=Number(e);return Number.isFinite(t)?t:void 0}function Ef(s){const e=window.fetch;window.fetch=function(t,r){const i=vf(t),n=xf(t,r),o=If(t),l=Of(r),a=performance.now(),u=new Date().toISOString();let c=r,h=null;if(i){h=me(),Ae=h;const m=new Headers(r==null?void 0:r.headers);m.set("traceway-trace-id",h),c={...r,headers:m}}const p=(m,g)=>{if(s)try{s.recordNetworkEvent({method:n.toUpperCase(),url:o,durationMs:Math.round(performance.now()-a),statusCode:m==null?void 0:m.status,requestBytes:l,responseBytes:m?Rf(m):void 0,error:g?String(g):void 0,timestamp:u})}catch{}};return e.call(this,t,c).then(m=>(p(m,null),m)).catch(m=>{throw p(null,m),m}).finally(()=>{h!==null&&Ae===h&&(Ae=null)})}}function Af(s){const e=window.onerror;window.onerror=(r,i,n,o,l)=>(l?s.addException({traceId:null,stackTrace:Bs(l),recordedAt:Q(),isMessage:!1,distributedTraceId:je()}):s.addException({traceId:null,stackTrace:String(r),recordedAt:Q(),isMessage:!1,distributedTraceId:je()}),typeof e=="function"?e(r,i,n,o,l):!1);const t=window.onunhandledrejection;window.onunhandledrejection=r=>{const i=r.reason;i instanceof Error?s.addException({traceId:null,stackTrace:Bs(i),recordedAt:Q(),isMessage:!1,distributedTraceId:je()}):s.addException({traceId:null,stackTrace:String(i),recordedAt:Q(),isMessage:!1,distributedTraceId:je()}),typeof t=="function"&&t.call(window,r)}}function Mf(s){try{return new URL(s,window.location.origin).origin===window.location.origin}catch{return!0}}function $f(s){if(s!=null){if(typeof s=="string")return s.length;if(s instanceof Blob)return s.size;if(s instanceof ArrayBuffer||ArrayBuffer.isView(s))return s.byteLength;s instanceof FormData}}function Nf(s){const e=XMLHttpRequest.prototype.open,t=XMLHttpRequest.prototype.send;XMLHttpRequest.prototype.open=function(r,i,...n){const o=String(i);return this._tracewaySameOrigin=Mf(o),this._tracewayMethod=r,this._tracewayUrl=o,this._tracewayRecorded=!1,e.apply(this,[r,i,...n])},XMLHttpRequest.prototype.send=function(r){this._tracewayStart=performance.now(),this._tracewayStartedAt=new Date().toISOString(),this._tracewayRequestBytes=$f(r);let i=null;this._tracewaySameOrigin&&(i=me(),Sf(i),this.setRequestHeader("traceway-trace-id",i));const n=c=>{if(!this._tracewayRecorded){if(this._tracewayRecorded=!0,s)try{const h=this.getResponseHeader("content-length"),p=h!==null&&Number.isFinite(Number(h))?Number(h):void 0;s.recordNetworkEvent({method:(this._tracewayMethod??"GET").toUpperCase(),url:this._tracewayUrl??"",durationMs:Math.round(performance.now()-(this._tracewayStart??performance.now())),statusCode:this.status||void 0,requestBytes:this._tracewayRequestBytes,responseBytes:p,error:c?`XHR ${this.statusText||"error"}`:void 0,timestamp:this._tracewayStartedAt??new Date().toISOString()})}catch{}i!==null&&Cf(i),this.removeEventListener("load",o),this.removeEventListener("error",l),this.removeEventListener("abort",a),this.removeEventListener("timeout",u)}},o=()=>n(!1),l=()=>n(!0),a=()=>n(!0),u=()=>n(!0);return this.addEventListener("load",o),this.addEventListener("error",l),this.addEventListener("abort",a),this.addEventListener("timeout",u),t.call(this,r)}}var kf=[{name:"debug",level:"debug"},{name:"log",level:"info"},{name:"info",level:"info"},{name:"warn",level:"warn"},{name:"error",level:"error"}];function Tf(s){if(typeof s=="string")return s;if(s instanceof Error)return s.stack??s.message;if(s==null)return String(s);if(typeof s=="object")try{return JSON.stringify(s)}catch{return Object.prototype.toString.call(s)}return String(s)}function Pf(s){if(!(typeof console>"u"))for(const{name:e,level:t}of kf){const r=console[e];typeof r=="function"&&(console[e]=function(...i){try{const n=i.map(Tf).join(" ");s.recordLog(t,n)}catch{}return r.apply(console,i)})}}function Uo(){return typeof window>"u"||!window.location?"":window.location.pathname+window.location.search+window.location.hash}function Df(s){if(typeof window>"u"||!window.history)return;let e=Uo();const t=n=>{const o=Uo();if(o!==e){try{s.recordNavigationEvent({action:n,from:e,to:o})}catch{}e=o}},r=window.history.pushState;window.history.pushState=function(...n){const o=r.apply(this,n);return t("push"),o};const i=window.history.replaceState;window.history.replaceState=function(...n){const o=i.apply(this,n);return t("replace"),o},window.addEventListener("popstate",()=>t("pop")),window.addEventListener("hashchange",()=>t("push"))}var fe=null;function Lf(s,e={}){fe=new bf(s,e),typeof window<"u"&&(Af(fe),Ef(fe),Nf(fe),fe.captureLogs&&Pf(fe),fe.captureNavigation&&Df(fe))}function _f(s,e,t){fe&&fe.addException({traceId:null,stackTrace:Bs(s),recordedAt:Q(),attributes:e,isMessage:!1,distributedTraceId:(t==null?void 0:t.distributedTraceId)??je()})}function Ff(s,e={}){Lf(s,e),Uf()}function Uf(){const s=typeof jQuery<"u"?jQuery:typeof $<"u"&&typeof $.ajax=="function"?$:null;s&&s(document).ajaxError(function(e,t,r,i){var c;const n=i||(t==null?void 0:t.statusText)||"AJAX Error",o=(r==null?void 0:r.url)||"unknown",l=((r==null?void 0:r.type)||"GET").toUpperCase(),a=(t==null?void 0:t.status)||0,u=((c=t==null?void 0:t.getResponseHeader)==null?void 0:c.call(t,"traceway-trace-id"))??je();_f(new Error(`${l} ${o} failed: ${a} ${n}`),{url:o,method:l,status:String(a)},{distributedTraceId:u??void 0})})}Ff("frontend-dev-token@http://localhost:8082/api/report");function re(s){var e=new Date().toLocaleTimeString(),t=$("#log"),r=t.text();r==="Waiting for actions..."&&(r=""),t.text(r+"["+e+"] "+s+`-`)}$(function(){$("#btn-error").on("click",function(){re("Calling GET /api/test-error ..."),$.ajax({url:"/api/test-error",method:"GET",complete:function(s){var e=s.getResponseHeader("traceway-trace-id");re("Response: "+s.status+" — traceway-trace-id: "+(e||"not present")),s.status>=400&&re("Exception auto-captured by @tracewayapp/jquery with distributedTraceId="+e)}})}),$("#btn-success").on("click",function(){re("Calling GET /api/test-success ..."),$.ajax({url:"/api/test-success",method:"GET",complete:function(s){var e=s.getResponseHeader("traceway-trace-id");re("Response: "+s.status+" — traceway-trace-id: "+(e||"not present"))}})}),$("#btn-logs").on("click",function(){re("Emitting console logs at every level ..."),console.debug("traceway-demo: debug ping",{step:1}),console.log("traceway-demo: cart loaded",{items:3,total:49.99}),console.info("traceway-demo: user resumed session",{userId:"u_42"}),console.warn("traceway-demo: slow response from /api/test-success"),console.error("traceway-demo: payment retry exhausted",{attempts:3}),re("5 console.* calls captured into the rolling log buffer.")}),$("#btn-network").on("click",function(){re("Firing 4 network requests (mix of fetch + jQuery, success + 404) ..."),fetch("/api/test-success").then(function(s){re("fetch GET /api/test-success -> "+s.status)}),fetch("/api/test-log-levels").then(function(s){re("fetch GET /api/test-log-levels -> "+s.status)}),fetch("/api/does-not-exist").then(function(s){re("fetch GET /api/does-not-exist -> "+s.status)}),$.ajax({url:"/api/test-spans-with-logs",method:"GET",complete:function(s){re("jQuery GET /api/test-spans-with-logs -> "+s.status)}})}),$("#btn-clear").on("click",function(){$("#log").text("Waiting for actions...")})})})();+`}function Uo(s){const e=s.lastIndexOf("/");e>=0&&(s=s.slice(e+1));const t=s.indexOf(".");return t>=0&&(s=s.slice(t+1)),s}function Sr(s){const e=s.split("/");return e[e.length-1]}var Ee=null;function je(){return Ee}function Cf(s){Ee=s}function If(s){Ee===s&&(Ee=null)}function xf(s){try{return new URL(typeof s=="string"?s:s instanceof Request?s.url:s.href,window.location.origin).origin===window.location.origin}catch{return!0}}function Af(s){return typeof s=="string"?s:s instanceof URL?s.href:s instanceof Request?s.url:String(s)}function Rf(s,e){return e!=null&&e.method?e.method:s instanceof Request?s.method:"GET"}function Of(s){if(s!=null&&s.body){if(typeof s.body=="string")return s.body.length;if(s.body instanceof Blob)return s.body.size;if(s.body instanceof ArrayBuffer||ArrayBuffer.isView(s.body))return s.body.byteLength}}function Ef(s){const e=s.headers.get("content-length");if(e===null)return;const t=Number(e);return Number.isFinite(t)?t:void 0}function Mf(s){const e=window.fetch;window.fetch=function(t,r){const i=xf(t),n=Rf(t,r),o=Af(t),l=Of(r),a=performance.now(),u=new Date().toISOString();let c=r,h=null;if(i){h=ce(),Ee=h;const m=new Headers(r==null?void 0:r.headers);m.set("traceway-trace-id",h),c={...r,headers:m}}const p=(m,g)=>{if(s)try{s.recordNetworkEvent({method:n.toUpperCase(),url:o,durationMs:Math.round(performance.now()-a),statusCode:m==null?void 0:m.status,requestBytes:l,responseBytes:m?Ef(m):void 0,error:g?String(g):void 0,timestamp:u})}catch{}};return e.call(this,t,c).then(m=>(p(m,null),m)).catch(m=>{throw p(null,m),m}).finally(()=>{h!==null&&Ee===h&&(Ee=null)})}}function $f(s){const e=window.onerror;window.onerror=(r,i,n,o,l)=>(l?s.addException({traceId:null,stackTrace:Bs(l),recordedAt:J(),isMessage:!1,distributedTraceId:je()}):s.addException({traceId:null,stackTrace:String(r),recordedAt:J(),isMessage:!1,distributedTraceId:je()}),typeof e=="function"?e(r,i,n,o,l):!1);const t=window.onunhandledrejection;window.onunhandledrejection=r=>{const i=r.reason;i instanceof Error?s.addException({traceId:null,stackTrace:Bs(i),recordedAt:J(),isMessage:!1,distributedTraceId:je()}):s.addException({traceId:null,stackTrace:String(i),recordedAt:J(),isMessage:!1,distributedTraceId:je()}),typeof t=="function"&&t.call(window,r)}}function Nf(s){try{return new URL(s,window.location.origin).origin===window.location.origin}catch{return!0}}function kf(s){if(s!=null){if(typeof s=="string")return s.length;if(s instanceof Blob)return s.size;if(s instanceof ArrayBuffer||ArrayBuffer.isView(s))return s.byteLength;s instanceof FormData}}function Tf(s){const e=XMLHttpRequest.prototype.open,t=XMLHttpRequest.prototype.send;XMLHttpRequest.prototype.open=function(r,i,...n){const o=String(i);return this._tracewaySameOrigin=Nf(o),this._tracewayMethod=r,this._tracewayUrl=o,this._tracewayRecorded=!1,e.apply(this,[r,i,...n])},XMLHttpRequest.prototype.send=function(r){this._tracewayStart=performance.now(),this._tracewayStartedAt=new Date().toISOString(),this._tracewayRequestBytes=kf(r);let i=null;this._tracewaySameOrigin&&(i=ce(),Cf(i),this.setRequestHeader("traceway-trace-id",i));const n=c=>{if(!this._tracewayRecorded){if(this._tracewayRecorded=!0,s)try{const h=this.getResponseHeader("content-length"),p=h!==null&&Number.isFinite(Number(h))?Number(h):void 0;s.recordNetworkEvent({method:(this._tracewayMethod??"GET").toUpperCase(),url:this._tracewayUrl??"",durationMs:Math.round(performance.now()-(this._tracewayStart??performance.now())),statusCode:this.status||void 0,requestBytes:this._tracewayRequestBytes,responseBytes:p,error:c?`XHR ${this.statusText||"error"}`:void 0,timestamp:this._tracewayStartedAt??new Date().toISOString()})}catch{}i!==null&&If(i),this.removeEventListener("load",o),this.removeEventListener("error",l),this.removeEventListener("abort",a),this.removeEventListener("timeout",u)}},o=()=>n(!1),l=()=>n(!0),a=()=>n(!0),u=()=>n(!0);return this.addEventListener("load",o),this.addEventListener("error",l),this.addEventListener("abort",a),this.addEventListener("timeout",u),t.call(this,r)}}var Pf=[{name:"debug",level:"debug"},{name:"log",level:"info"},{name:"info",level:"info"},{name:"warn",level:"warn"},{name:"error",level:"error"}];function Df(s){if(typeof s=="string")return s;if(s instanceof Error)return s.stack??s.message;if(s==null)return String(s);if(typeof s=="object")try{return JSON.stringify(s)}catch{return Object.prototype.toString.call(s)}return String(s)}function Lf(s){if(!(typeof console>"u"))for(const{name:e,level:t}of Pf){const r=console[e];typeof r=="function"&&(console[e]=function(...i){try{const n=i.map(Df).join(" ");s.recordLog(t,n)}catch{}return r.apply(console,i)})}}function Bo(){return typeof window>"u"||!window.location?"":window.location.pathname+window.location.search+window.location.hash}function _f(s){if(typeof window>"u"||!window.history)return;let e=Bo();const t=n=>{const o=Bo();if(o!==e){try{s.recordNavigationEvent({action:n,from:e,to:o})}catch{}e=o}},r=window.history.pushState;window.history.pushState=function(...n){const o=r.apply(this,n);return t("push"),o};const i=window.history.replaceState;window.history.replaceState=function(...n){const o=i.apply(this,n);return t("replace"),o},window.addEventListener("popstate",()=>t("pop")),window.addEventListener("hashchange",()=>t("push"))}var ee=null;function Ff(s,e={}){ee=new vf(s,e),typeof window<"u"&&($f(ee),Mf(ee),Tf(ee),ee.captureLogs&&Lf(ee),ee.captureNavigation&&_f(ee))}function Uf(s,e,t){ee&&ee.addException({traceId:null,stackTrace:Bs(s),recordedAt:J(),attributes:e,isMessage:!1,distributedTraceId:(t==null?void 0:t.distributedTraceId)??je()})}function Bf(s,e){ee&&ee.setAttribute(s,e)}function zf(s){ee&&ee.setAttributes(s)}function Wf(s,e={}){Ff(s,e),Gf()}function Gf(){const s=typeof jQuery<"u"?jQuery:typeof $<"u"&&typeof $.ajax=="function"?$:null;s&&s(document).ajaxError(function(e,t,r,i){var c;const n=i||(t==null?void 0:t.statusText)||"AJAX Error",o=(r==null?void 0:r.url)||"unknown",l=((r==null?void 0:r.type)||"GET").toUpperCase(),a=(t==null?void 0:t.status)||0,u=((c=t==null?void 0:t.getResponseHeader)==null?void 0:c.call(t,"traceway-trace-id"))??je();Uf(new Error(`${l} ${o} failed: ${a} ${n}`),{url:o,method:l,status:String(a)},{distributedTraceId:u??void 0})})}Wf("frontend-dev-token@http://localhost:8082/api/report",{recordAllSessions:!0}),zf({userId:"u_42",tenant:"acme-corp",plan:"pro",build_channel:"canary"}),Bf("experiment.cart_redesign",Math.random()<.5?"control":"variant_b");function se(s){var e=new Date().toLocaleTimeString(),t=$("#log"),r=t.text();r==="Waiting for actions..."&&(r=""),t.text(r+"["+e+"] "+s+`+`)}$(function(){$("#btn-error").on("click",function(){se("Calling GET /api/test-error ..."),$.ajax({url:"/api/test-error",method:"GET",complete:function(s){var e=s.getResponseHeader("traceway-trace-id");se("Response: "+s.status+" — traceway-trace-id: "+(e||"not present")),s.status>=400&&se("Exception auto-captured by @tracewayapp/jquery with distributedTraceId="+e)}})}),$("#btn-success").on("click",function(){se("Calling GET /api/test-success ..."),$.ajax({url:"/api/test-success",method:"GET",complete:function(s){var e=s.getResponseHeader("traceway-trace-id");se("Response: "+s.status+" — traceway-trace-id: "+(e||"not present"))}})}),$("#btn-logs").on("click",function(){se("Emitting console logs at every level ..."),console.debug("traceway-demo: debug ping",{step:1}),console.log("traceway-demo: cart loaded",{items:3,total:49.99}),console.info("traceway-demo: user resumed session",{userId:"u_42"}),console.warn("traceway-demo: slow response from /api/test-success"),console.error("traceway-demo: payment retry exhausted",{attempts:3}),se("5 console.* calls captured into the rolling log buffer.")}),$("#btn-network").on("click",function(){se("Firing 4 network requests (mix of fetch + jQuery, success + 404) ..."),fetch("/api/test-success").then(function(s){se("fetch GET /api/test-success -> "+s.status)}),fetch("/api/test-log-levels").then(function(s){se("fetch GET /api/test-log-levels -> "+s.status)}),fetch("/api/does-not-exist").then(function(s){se("fetch GET /api/does-not-exist -> "+s.status)}),$.ajax({url:"/api/test-spans-with-logs",method:"GET",complete:function(s){se("jQuery GET /api/test-spans-with-logs -> "+s.status)}})}),$("#btn-clear").on("click",function(){$("#log").text("Waiting for actions...")})})})();diff --git a/frontend/src/lib/components/app-sidebar.svelte b/frontend/src/lib/components/app-sidebar.svelteindex 1ac5c610..3b4e218d 100644--- a/frontend/src/lib/components/app-sidebar.svelte+++ b/frontend/src/lib/components/app-sidebar.svelte@@ -9,6 +9,7 @@ChartNoAxesCombined,ChartNoAxesGantt,FileText,+ Film,Gauge,ListEnd,Settings,@@ -31,6 +32,10 @@const hiddenForFrontend = new Set(['Dashboard', 'Logs', 'Endpoints', 'Tasks', 'Metrics', 'AI Traces']);const hiddenForCloudflare = new Set(['Metrics']);+ // Items that only make sense for frontend (browser) projects — dropped from+ // the sidebar for any other framework, so a Go backend project doesn't+ // surface a Sessions tab that can never be populated.+ const frontendOnly = new Set(['Sessions']);const allSidebarItems: SidebarItem[] = [{ Icon: LayoutDashboard, href: '/', title: 'Dashboard', stickyParams: [] },@@ -38,6 +43,7 @@{ Icon: FileText, href: '/logs', title: 'Logs', stickyParams: ['preset', 'from', 'to'] },{ Icon: Gauge, href: '/endpoints', title: 'Endpoints', stickyParams: ['preset', 'from', 'to'] },{ Icon: ListEnd, href: '/tasks', title: 'Tasks', stickyParams: ['preset', 'from', 'to'] },+ { Icon: Film, href: '/sessions', title: 'Sessions', stickyParams: ['preset', 'from', 'to'] },{ Icon: Workflow, href: '/ai-traces', title: 'AI Traces', stickyParams: ['preset', 'from', 'to'] },{Icon: ChartNoAxesCombined,@@ -53,8 +59,8 @@projectsState.currentProject && isFrontendFramework(projectsState.currentProject.framework)? allSidebarItems.filter((item) => !hiddenForFrontend.has(item.title)): projectsState.currentProject && isCloudflareFramework(projectsState.currentProject.framework)- ? allSidebarItems.filter((item) => !hiddenForCloudflare.has(item.title))- : allSidebarItems+ ? allSidebarItems.filter((item) => !hiddenForCloudflare.has(item.title) && !frontendOnly.has(item.title))+ : allSidebarItems.filter((item) => !frontendOnly.has(item.title)));const allSidebarItemsBottom: SidebarItem[] = [diff --git a/frontend/src/lib/components/issues/event-card.svelte b/frontend/src/lib/components/issues/event-card.svelteindex 4cbb72f7..07ddf01d 100644--- a/frontend/src/lib/components/issues/event-card.svelte+++ b/frontend/src/lib/components/issues/event-card.svelte@@ -23,6 +23,7 @@occurrence: ExceptionOccurrence;linkedTrace: LinkedTrace | null;sessionRecording?: SessionRecording | null;+ sessionId?: string | null;title?: string;description?: string;timezone?: string;@@ -32,6 +33,7 @@occurrence,linkedTrace,sessionRecording = null,+ sessionId = null,title = 'Event',description = 'Details for this specific occurrence',timezone@@ -66,8 +68,18 @@<!-- Session Replay -->{#if hasReplay}<Card.Root class="pb-0">- <Card.Header class="gap-0">+ <Card.Header class="flex flex-row items-center justify-between gap-2"><Card.Title>Session Replay</Card.Title>+ {#if sessionId}+ <Button+ variant="outline"+ size="sm"+ onclick={() => goto(`/sessions/${sessionId}`)}+ >+ View full session+ <ArrowRight class="size-4" />+ </Button>+ {/if}</Card.Header><Card.Content class="p-0">{#key recordingEvents}@@ -79,6 +91,23 @@{/key}</Card.Content></Card.Root>+{:else if sessionId}+ <Card.Root>+ <Card.Header class="flex flex-row items-center justify-between gap-2">+ <Card.Title>Session</Card.Title>+ <Button+ variant="outline"+ size="sm"+ onclick={() => goto(`/sessions/${sessionId}`)}+ >+ View full session+ <ArrowRight class="size-4" />+ </Button>+ </Card.Header>+ <Card.Content class="text-sm text-muted-foreground">+ This exception is linked to a recorded user session.+ </Card.Content>+ </Card.Root>{/if}<!-- Session Context (logs + actions). Frontend projects only. -->diff --git a/frontend/src/lib/components/issues/session-replay.svelte b/frontend/src/lib/components/issues/session-replay.svelteindex c00b66ae..1a0e0dda 100644--- a/frontend/src/lib/components/issues/session-replay.svelte+++ b/frontend/src/lib/components/issues/session-replay.svelte@@ -2,6 +2,12 @@import { onMount, onDestroy } from 'svelte';import { Globe, Play, Pause, Maximize, Minimize } from 'lucide-svelte';import type { eventWithTime } from '@rrweb/types';+ // Static side-effect import — keeps the rrweb-player stylesheet attached+ // to the page for the lifetime of the SPA, even across mount/unmount cycles.+ // A dynamic import inside onMount would let Vite's HMR dispose the style+ // node when the component unmounts, leaving the next mount with no+ // background fill on .replayer-wrapper until a hard refresh.+ import 'rrweb-player/dist/style.css';interface FlutterVideoEvent {type: 'flutter_video';@@ -160,7 +166,6 @@if (!events || events.length === 0 || isFlutterVideo) return;const { default: rrwebPlayer } = await import('rrweb-player');- await import('rrweb-player/dist/style.css');const width = Math.round(container.clientWidth * 0.75);diff --git a/frontend/src/routes/issues/[exceptionHash]/+page.svelte b/frontend/src/routes/issues/[exceptionHash]/+page.svelteindex 5ec84908..7490d6bf 100644--- a/frontend/src/routes/issues/[exceptionHash]/+page.svelte+++ b/frontend/src/routes/issues/[exceptionHash]/+page.svelte@@ -28,6 +28,7 @@let total = $state(0);let linkedTrace = $state<LinkedTrace | null>(null);let sessionRecording = $state<SessionRecording | null>(null);+ let sessionId = $state<string | null>(null);let showArchiveDialog = $state(false);let archiving = $state(false);@@ -43,6 +44,7 @@notFound = false;linkedTrace = null;sessionRecording = null;+ sessionId = null;try {const exceptionHash = page.params.exceptionHash;@@ -61,6 +63,7 @@occurrences = response.occurrences || [];total = response.pagination.total;sessionRecording = response.sessionRecording ?? null;+ sessionId = response.sessionId ?? null;// Load linked trace if the latest occurrence has a traceIdconst firstOccurrence = occurrences[0];@@ -172,6 +175,7 @@occurrence={latestOccurrence}{linkedTrace}{sessionRecording}+ {sessionId}title="Last Event"description="Details from the most recent occurrence of this exception"/>diff --git a/frontend/src/routes/issues/[exceptionHash]/[exceptionId]/+page.svelte b/frontend/src/routes/issues/[exceptionHash]/[exceptionId]/+page.svelteindex 610d853c..b31f8cf3 100644--- a/frontend/src/routes/issues/[exceptionHash]/[exceptionId]/+page.svelte+++ b/frontend/src/routes/issues/[exceptionHash]/[exceptionId]/+page.svelte@@ -25,6 +25,7 @@let total = $state(0);let linkedTrace = $state<LinkedTrace | null>(null);let sessionRecording = $state<SessionRecording | null>(null);+ let sessionId = $state<string | null>(null);let showArchiveDialog = $state(false);let archiving = $state(false);@@ -46,6 +47,7 @@const exceptionResponse = await api.post(`/exception-stack-traces/by-id/${data.exceptionId}`, {}, { projectId: projectsState.currentProjectId ?? undefined });occurrence = exceptionResponse.exception;sessionRecording = exceptionResponse.sessionRecording ?? null;+ sessionId = exceptionResponse.sessionId ?? null;if (!occurrence) {notFound = true;@@ -175,6 +177,7 @@{occurrence}{linkedTrace}{sessionRecording}+ {sessionId}title="Event"description="Details for this specific occurrence"/>diff --git a/frontend/src/routes/sessions/+page.svelte b/frontend/src/routes/sessions/+page.sveltenew file mode 100644index 00000000..384ec1d5--- /dev/null+++ b/frontend/src/routes/sessions/+page.svelte@@ -0,0 +1,472 @@+<script lang="ts">+ import { onMount, onDestroy } from 'svelte';+ import { api } from '$lib/api';+ import { formatDuration, formatRelativeTime, toUTCISO, calendarDateTimeToLuxon } from '$lib/utils/formatters';+ import { getTimezone } from '$lib/state/timezone.svelte';+ import * as Table from "$lib/components/ui/table";+ import { LoadingCircle } from "$lib/components/ui/loading-circle";+ import { TracewayTableHeader } from "$lib/components/ui/traceway-table-header";+ import { TableEmptyState } from "$lib/components/ui/table-empty-state";+ import { PaginationFooter } from "$lib/components/ui/pagination-footer";+ import { TimeRangePicker } from "$lib/components/ui/time-range-picker";+ import { SearchBar } from "$lib/components/ui/search-bar";+ import * as AlertDialog from '$lib/components/ui/alert-dialog';+ import * as Tooltip from '$lib/components/ui/tooltip';+ import { Button } from '$lib/components/ui/button';+ import { Input } from '$lib/components/ui/input';+ import Plus from '@lucide/svelte/icons/plus';+ import X from '@lucide/svelte/icons/x';+ import Info from '@lucide/svelte/icons/info';+ import { CalendarDate } from "@internationalized/date";+ import { browser } from '$app/environment';+ import { goto } from '$app/navigation';+ import { projectsState } from '$lib/state/projects.svelte';+ import { createRowClickHandler } from '$lib/utils/navigation';+ import { resolve } from '$app/paths';+ import PageHeader from '$lib/components/issues/page-header.svelte';+ import {+ getTimeRangeFromPreset,+ dateToCalendarDate,+ dateToTimeString,+ parseTimeRangeFromUrl,+ getResolvedTimeRange,+ updateUrl+ } from '$lib/utils/url-params';+ import {+ getSortState,+ setSortState,+ handleSortClick,+ type SortDirection+ } from '$lib/utils/sort-storage';++ const timezone = $derived(getTimezone());++ type Session = {+ id: string;+ startedAt: string;+ endedAt?: string | null;+ duration: number;+ clientIP: string;+ appVersion: string;+ serverName: string;+ };++ type SortField = 'started_at' | 'duration';++ let sessions = $state<Session[]>([]);+ let loading = $state(true);+ let error = $state('');++ let page = $state(1);+ let pageSize = $state(50);+ let total = $state(0);+ let totalPages = $state(0);++ type AttributeFilter = { key: string; value: string };++ function parseAttributeFilter(input: string): AttributeFilter | null {+ const idx = input.indexOf('=');+ if (idx <= 0) return null;+ const key = input.slice(0, idx).trim();+ const value = input.slice(idx + 1);+ if (!key) return null;+ return { key, value };+ }++ function parseSessionsUrlParams() {+ const timeParams = parseTimeRangeFromUrl(timezone);+ if (!browser) return { ...timeParams, search: '', attributeFilters: [] as AttributeFilter[] };+ const params = new URLSearchParams(window.location.search);+ const attrs: AttributeFilter[] = [];+ for (const raw of params.getAll('attr')) {+ const parsed = parseAttributeFilter(raw);+ if (parsed) attrs.push(parsed);+ }+ return {+ ...timeParams,+ search: params.get('search') ?? '',+ attributeFilters: attrs+ };+ }++ const initialUrlParams = parseSessionsUrlParams();+ const initialRange = getResolvedTimeRange(initialUrlParams, timezone);++ let selectedPreset = $state<string | null>(initialUrlParams.preset);+ let fromDate = $state<CalendarDate>(dateToCalendarDate(initialRange.from, timezone));+ let toDate = $state<CalendarDate>(dateToCalendarDate(initialRange.to, timezone));+ let fromTime = $state(dateToTimeString(initialRange.from, timezone));+ let toTime = $state(dateToTimeString(initialRange.to, timezone));+ let searchQuery = $state(initialUrlParams.search);+ let attributeFilters = $state<AttributeFilter[]>(initialUrlParams.attributeFilters);++ let addFilterOpen = $state(false);+ let dialogKey = $state('');+ let dialogValue = $state('');+ let dialogError = $state('');++ function openAddFilterDialog() {+ dialogKey = '';+ dialogValue = '';+ dialogError = '';+ addFilterOpen = true;+ }++ function submitDialogFilter() {+ const key = dialogKey.trim();+ if (!key) {+ dialogError = 'Attribute key is required';+ return;+ }+ const value = dialogValue;+ const dup = attributeFilters.some((f) => f.key === key && f.value === value);+ if (!dup) {+ attributeFilters = [...attributeFilters, { key, value }];+ }+ addFilterOpen = false;+ page = 1;+ loadData(true);+ }++ function handleDialogKeydown(e: KeyboardEvent) {+ if (e.key === 'Enter') {+ e.preventDefault();+ submitDialogFilter();+ }+ }++ function removeAttributeFilter(index: number) {+ attributeFilters = attributeFilters.filter((_, i) => i !== index);+ page = 1;+ loadData(true);+ }++ function updateTimeRangeUrl(pushToHistory = true) {+ if (!browser) return;+ const params = new URLSearchParams();+ if (selectedPreset) {+ params.set('preset', selectedPreset);+ } else {+ params.set('from', getFromDateTimeUTC());+ params.set('to', getToDateTimeUTC());+ }+ if (searchQuery.trim()) params.set('search', searchQuery.trim());+ for (const f of attributeFilters) {+ params.append('attr', `${f.key}=${f.value}`);+ }+ const newUrl = `${window.location.pathname}?${params.toString()}`;+ // eslint-disable-next-line svelte/no-navigation-without-resolve+ goto(newUrl, { replaceState: !pushToHistory, noScroll: true, keepFocus: true });+ }++ function handlePopState() {+ const urlParams = parseSessionsUrlParams();+ const range = getResolvedTimeRange(urlParams, timezone);+ selectedPreset = urlParams.preset;+ fromDate = dateToCalendarDate(range.from, timezone);+ fromTime = dateToTimeString(range.from, timezone);+ toDate = dateToCalendarDate(range.to, timezone);+ toTime = dateToTimeString(range.to, timezone);+ searchQuery = urlParams.search;+ attributeFilters = urlParams.attributeFilters;+ page = 1;+ loadData(false);+ }++ function handleSearch() {+ page = 1;+ loadData(true);+ }++ const SORT_STORAGE_KEY = 'sessions';+ const initialSort = getSortState(SORT_STORAGE_KEY, { field: 'started_at', direction: 'desc' });+ let orderBy = $state<SortField>(initialSort.field as SortField);+ let sortDirection = $state<SortDirection>(initialSort.direction);++ function getFromDateTimeUTC(): string {+ const [hour, minute] = (fromTime || '00:00').split(':').map(Number);+ const dt = calendarDateTimeToLuxon({ year: fromDate.year, month: fromDate.month, day: fromDate.day, hour, minute }, timezone);+ return toUTCISO(dt);+ }++ function getToDateTimeUTC(): string {+ const [hour, minute] = (toTime || '23:59').split(':').map(Number);+ const dt = calendarDateTimeToLuxon({ year: toDate.year, month: toDate.month, day: toDate.day, hour, minute }, timezone).endOf('minute');+ return toUTCISO(dt);+ }++ function handleTimeRangeChange(from: { date: CalendarDate; time: string }, to: { date: CalendarDate; time: string }, preset: string | null) {+ fromDate = from.date;+ fromTime = from.time;+ toDate = to.date;+ toTime = to.time;+ selectedPreset = preset;+ page = 1;+ loadData(true);+ }++ function shortId(id: string): string {+ return id.split('-')[0] ?? id.slice(0, 8);+ }++ const ABANDONED_AFTER_MS = 15 * 60_000;++ function durationLabel(s: Session): string {+ if (s.endedAt) return formatDuration(s.duration);+ const startedMs = Date.parse(s.startedAt);+ if (Number.isFinite(startedMs) && Date.now() - startedMs >= ABANDONED_AFTER_MS) {+ return 'Abandoned';+ }+ return 'in progress';+ }++ async function loadData(pushToHistory = true) {+ loading = true;+ error = '';++ if (selectedPreset) {+ const range = getTimeRangeFromPreset(selectedPreset, timezone);+ fromDate = dateToCalendarDate(range.from, timezone);+ toDate = dateToCalendarDate(range.to, timezone);+ fromTime = dateToTimeString(range.from, timezone);+ toTime = dateToTimeString(range.to, timezone);+ }++ updateTimeRangeUrl(pushToHistory);++ try {+ const requestBody = {+ fromDate: getFromDateTimeUTC(),+ toDate: getToDateTimeUTC(),+ orderBy,+ sortDirection,+ search: searchQuery.trim(),+ attributeFilters,+ pagination: { page, pageSize }+ };++ const response = await api.post('/sessions', requestBody, { projectId: projectsState.currentProjectId ?? undefined });++ sessions = response.data || [];+ total = response.pagination.total;+ totalPages = response.pagination.totalPages;+ } catch (e: any) {+ console.error(e);+ error = e.message || 'Failed to load data';+ } finally {+ loading = false;+ }+ }++ function handlePageChange(newPage: number) {+ if (newPage >= 1 && newPage <= totalPages) {+ page = newPage;+ loadData(false);+ }+ }++ function handlePageSizeChange(newPageSize: number) {+ pageSize = newPageSize;+ page = 1;+ loadData(false);+ }++ function handleSort(field: SortField) {+ const newSort = handleSortClick(field, orderBy, sortDirection);+ orderBy = newSort.field as SortField;+ sortDirection = newSort.direction;+ setSortState(SORT_STORAGE_KEY, newSort);+ page = 1;+ loadData(false);+ }++ onMount(() => {+ window.addEventListener('popstate', handlePopState);+ loadData(false);+ });++ onDestroy(() => {+ if (typeof window !== 'undefined') {+ window.removeEventListener('popstate', handlePopState);+ }+ });+</script>++<div class="space-y-4">+ <div class="flex flex-col gap-4 sm:flex-row sm:justify-between">+ <div class="flex items-start gap-2">+ <PageHeader title="Sessions" />+ <Tooltip.Root>+ <Tooltip.Trigger class="mt-2 text-muted-foreground/60 hover:text-muted-foreground">+ <Info class="h-4 w-4" />+ </Tooltip.Trigger>+ <Tooltip.Content side="right" class="max-w-xs">+ <p class="text-xs">+ Sessions are full recordings of user interactions and are only recorded when manually enabled+ (<code class="font-mono">recordAllSessions: true</code> in the SDK init options).+ </p>+ </Tooltip.Content>+ </Tooltip.Root>+ </div>+ <div class="flex flex-col">+ <TimeRangePicker+ bind:fromDate+ bind:toDate+ bind:fromTime+ bind:toTime+ bind:preset={selectedPreset}+ onApply={handleTimeRangeChange}+ />+ </div>+ </div>++ <SearchBar+ placeholder="Search by session ID..."+ bind:value={searchQuery}+ onSearch={handleSearch}+ />++ <div class="flex flex-wrap items-center gap-2">+ <button+ type="button"+ class="inline-flex items-center gap-1 rounded-full border border-dashed px-3 py-0.5 text-xs font-medium text-muted-foreground transition-colors hover:border-foreground/40 hover:text-foreground"+ onclick={openAddFilterDialog}+ disabled={loading}+ >+ <Plus class="h-3 w-3" />+ Add filter+ </button>+ {#each attributeFilters as f, i (i)}+ <span class="inline-flex items-center gap-1 rounded-full bg-muted px-2 py-0.5 text-xs font-mono">+ <span class="text-muted-foreground">{f.key}</span>+ <span>=</span>+ <span>{f.value || '""'}</span>+ <button+ type="button"+ aria-label="Remove filter"+ class="ml-1 text-muted-foreground hover:text-foreground"+ onclick={() => removeAttributeFilter(i)}+ >+ <X class="h-3 w-3" />+ </button>+ </span>+ {/each}+ </div>++ <AlertDialog.Root open={addFilterOpen} onOpenChange={(open) => (addFilterOpen = open)}>+ <AlertDialog.Content>+ <AlertDialog.Header>+ <AlertDialog.Title>Add attribute filter</AlertDialog.Title>+ <AlertDialog.Description>+ Match sessions by an exact attribute value. Keys come from what the SDK auto-collects (<code class="font-mono">url</code>, <code class="font-mono">userAgent</code>, <code class="font-mono">viewport</code>, <code class="font-mono">client.ip</code>, …) plus anything you attach yourself.+ </AlertDialog.Description>+ </AlertDialog.Header>+ <div class="flex flex-col gap-3">+ <label class="flex flex-col gap-1 text-sm">+ <span class="font-medium">Attribute key</span>+ <Input+ placeholder="userAgent"+ bind:value={dialogKey}+ onkeydown={handleDialogKeydown}+ />+ </label>+ <label class="flex flex-col gap-1 text-sm">+ <span class="font-medium">Value</span>+ <Input+ placeholder="Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7)..."+ bind:value={dialogValue}+ onkeydown={handleDialogKeydown}+ />+ </label>+ {#if dialogError}+ <p class="text-xs text-red-500">{dialogError}</p>+ {/if}+ </div>+ <AlertDialog.Footer>+ <Button variant="outline" onclick={() => (addFilterOpen = false)}>Cancel</Button>+ <Button onclick={submitDialogFilter}>+ <Plus class="h-4 w-4" /> Add filter+ </Button>+ </AlertDialog.Footer>+ </AlertDialog.Content>+ </AlertDialog.Root>++ <div class="rounded-md border overflow-hidden">+ <Table.Root>+ {#if loading}+ <Table.Body>+ <Table.Row>+ <Table.Cell colspan={4} class="h-48">+ <div class="flex justify-center items-center h-full">+ <LoadingCircle size="xlg" />+ </div>+ </Table.Cell>+ </Table.Row>+ </Table.Body>+ {:else if error}+ <Table.Body>+ <Table.Row>+ <Table.Cell colspan={4} class="h-24 text-center text-red-500">+ {error}+ </Table.Cell>+ </Table.Row>+ </Table.Body>+ {:else if sessions.length === 0}+ <Table.Body>+ <TableEmptyState colspan={4} message="No sessions recorded yet — enable recordAllSessions in the SDK to start capturing them." />+ </Table.Body>+ {:else}+ <Table.Header>+ <Table.Row>+ <TracewayTableHeader label="Session" tooltip="Session UUID — open to play back the recording" />+ <TracewayTableHeader+ label="Started"+ tooltip="When the session began"+ sortField="started_at"+ currentSortField={orderBy}+ {sortDirection}+ onSort={(field) => handleSort(field as SortField)}+ class="w-[160px]"+ />+ <TracewayTableHeader+ label="Duration"+ tooltip="Wall-clock length of the session"+ sortField="duration"+ currentSortField={orderBy}+ {sortDirection}+ onSort={(field) => handleSort(field as SortField)}+ class="w-[120px]"+ />+ <TracewayTableHeader label="Version" tooltip="App version reported by the SDK" class="w-[120px]" />+ </Table.Row>+ </Table.Header>+ <Table.Body>+ {#each sessions as session}+ <Table.Row+ class="cursor-pointer hover:bg-muted/50"+ onclick={createRowClickHandler(resolve(`/sessions/${session.id}`), 'preset', 'from', 'to')}+ >+ <Table.Cell class="font-mono text-sm">{shortId(session.id)}</Table.Cell>+ <Table.Cell class="text-sm">{formatRelativeTime(session.startedAt, timezone)}</Table.Cell>+ <Table.Cell class="font-mono text-sm tabular-nums">+ {durationLabel(session)}+ </Table.Cell>+ <Table.Cell class="font-mono text-sm">{session.appVersion || '—'}</Table.Cell>+ </Table.Row>+ {/each}+ </Table.Body>+ {/if}+ </Table.Root>+ </div>++ <PaginationFooter+ currentPage={page}+ {totalPages}+ {pageSize}+ totalItems={total}+ onPageChange={handlePageChange}+ onPageSizeChange={handlePageSizeChange}+ {loading}+ itemLabel="session"+ />+</div>diff --git a/frontend/src/routes/sessions/[sessionId]/+page.svelte b/frontend/src/routes/sessions/[sessionId]/+page.sveltenew file mode 100644index 00000000..f6cd964b--- /dev/null+++ b/frontend/src/routes/sessions/[sessionId]/+page.svelte@@ -0,0 +1,258 @@+<script lang="ts">+ import { onMount } from 'svelte';+ import { resolve } from '$app/paths';+ import { goto } from '$app/navigation';+ import { page as pageState } from '$app/state';+ import { api } from '$lib/api';+ import { projectsState } from '$lib/state/projects.svelte';+ import { getTimezone } from '$lib/state/timezone.svelte';+ import { formatDuration, formatDateTime } from '$lib/utils/formatters';+ import * as Card from '$lib/components/ui/card';+ import * as Table from '$lib/components/ui/table';+ import * as Tabs from '$lib/components/ui/tabs';+ import { Button } from '$lib/components/ui/button';+ import { LoadingCircle } from '$lib/components/ui/loading-circle';+ import { LabelValue } from '$lib/components/ui/label-value';+ import { AttributesGrid } from '$lib/components/ui/attributes-grid';+ import { TableEmptyState } from '$lib/components/ui/table-empty-state';+ import SessionReplay from '$lib/components/issues/session-replay.svelte';+ import SessionLogsTable from '$lib/components/issues/session-logs-table.svelte';+ import SessionActionsTable from '$lib/components/issues/session-actions-table.svelte';+ import { ErrorDisplay } from '$lib/components/ui/error-display';+ import PageHeader from '$lib/components/issues/page-header.svelte';+ import { ArrowRight } from 'lucide-svelte';++ type Session = {+ id: string;+ startedAt: string;+ endedAt?: string | null;+ duration: number;+ clientIP: string;+ appVersion: string;+ serverName: string;+ attributes?: Record<string, string> | null;+ };++ type SessionException = {+ id: string;+ exceptionHash: string;+ stackTrace: string;+ recordedAt: string;+ isMessage: boolean;+ };++ const timezone = $derived(getTimezone());+ const sessionId = $derived(pageState.params.sessionId);++ let session = $state<Session | null>(null);+ let exceptions = $state<SessionException[]>([]);+ let recordingEvents = $state<unknown[] | null>(null);+ let recordingLogs = $state<any[]>([]);+ let recordingActions = $state<any[]>([]);+ let loading = $state(true);+ let error = $state('');+ let notFound = $state(false);++ let currentTimeMs = $state(0);+ let replayRef = $state<{ seek: (ms: number) => void } | null>(null);++ function handleSeek(offsetMs: number) {+ replayRef?.seek(offsetMs);+ }++ const hasLogs = $derived(recordingLogs.length > 0);+ const hasActions = $derived(recordingActions.length > 0);+ const defaultTab = $derived(hasLogs ? 'logs' : 'actions');++ const ABANDONED_AFTER_MS = 15 * 60_000;++ function durationLabel(s: Session | null): string {+ if (!s) return '—';+ if (s.endedAt) return formatDuration(s.duration);+ const startedMs = Date.parse(s.startedAt);+ if (Number.isFinite(startedMs) && Date.now() - startedMs >= ABANDONED_AFTER_MS) {+ return 'Abandoned';+ }+ return 'in progress';+ }++ async function loadAll() {+ loading = true;+ error = '';+ notFound = false;++ try {+ const detail = await api.post(`/sessions/${sessionId}`, {}, {+ projectId: projectsState.currentProjectId ?? undefined+ });+ session = detail.session;+ exceptions = detail.exceptions || [];++ const recording = await api.get(`/sessions/${sessionId}/recording`, {+ projectId: projectsState.currentProjectId ?? undefined+ });+ recordingEvents = recording?.events ?? [];+ recordingLogs = recording?.logs ?? [];+ recordingActions = recording?.actions ?? [];+ } catch (e: any) {+ if (e?.status === 404) {+ notFound = true;+ } else {+ error = e?.message || 'Failed to load session';+ }+ } finally {+ loading = false;+ }+ }++ onMount(() => {+ loadAll();+ });++ function gotoIssue(hash: string) {+ goto(resolve(`/issues/${hash}`));+ }+</script>++<div class="space-y-4">+ <PageHeader title="Session" />++ {#if loading}+ <div class="flex justify-center items-center h-64">+ <LoadingCircle size="xlg" />+ </div>+ {:else if notFound}+ <ErrorDisplay status={404} title="Session not found" description="This session does not exist or has been pruned." onRetry={loadAll} />+ {:else if error}+ <ErrorDisplay status={500} title="Error" description={error} onRetry={loadAll} />+ {:else if session}+ <Card.Root>+ <Card.Header>+ <Card.Title>Overview</Card.Title>+ </Card.Header>+ <Card.Content class="grid grid-cols-2 gap-4 sm:grid-cols-3">+ <LabelValue label="Started" value={formatDateTime(session.startedAt, { timezone })} />+ <LabelValue label="Duration" value={durationLabel(session)} />+ <LabelValue label="App version" value={session.appVersion || '—'} />+ </Card.Content>+ </Card.Root>++ {#if session.attributes && Object.keys(session.attributes).length > 0}+ <Card.Root>+ <Card.Header>+ <Card.Title>Attributes</Card.Title>+ </Card.Header>+ <Card.Content>+ <AttributesGrid attributes={session.attributes} collapsedCount={6} />+ </Card.Content>+ </Card.Root>+ {/if}++ {#if recordingEvents && recordingEvents.length > 0}+ <Card.Root class="pb-0">+ <Card.Header class="gap-0">+ <Card.Title>Session Replay</Card.Title>+ </Card.Header>+ <Card.Content class="p-0">+ {#key recordingEvents}+ <SessionReplay+ bind:this={replayRef}+ events={recordingEvents as any}+ onTimeUpdate={(ms) => (currentTimeMs = ms)}+ />+ {/key}+ </Card.Content>+ </Card.Root>+ {:else}+ <Card.Root>+ <Card.Header>+ <Card.Title>Session Replay</Card.Title>+ </Card.Header>+ <Card.Content class="text-sm text-muted-foreground">+ No replay data has been uploaded for this session yet.+ </Card.Content>+ </Card.Root>+ {/if}++ {#if hasLogs || hasActions}+ <Card.Root>+ <Card.Header>+ <Card.Title>Session Context</Card.Title>+ <Card.Description>+ Console output and recorded actions across the session. Times are offsets from session start.+ </Card.Description>+ </Card.Header>+ <Card.Content>+ <Tabs.Root value={defaultTab}>+ <Tabs.List class="mb-4">+ {#if hasLogs}+ <Tabs.Trigger value="logs">Logs ({recordingLogs.length})</Tabs.Trigger>+ {/if}+ {#if hasActions}+ <Tabs.Trigger value="actions">Actions ({recordingActions.length})</Tabs.Trigger>+ {/if}+ </Tabs.List>+ {#if hasLogs}+ <Tabs.Content value="logs">+ <SessionLogsTable+ logs={recordingLogs}+ startedAt={session.startedAt}+ {currentTimeMs}+ onSeek={handleSeek}+ />+ </Tabs.Content>+ {/if}+ {#if hasActions}+ <Tabs.Content value="actions">+ <SessionActionsTable+ actions={recordingActions}+ startedAt={session.startedAt}+ {currentTimeMs}+ onSeek={handleSeek}+ />+ </Tabs.Content>+ {/if}+ </Tabs.Root>+ </Card.Content>+ </Card.Root>+ {/if}++ <Card.Root>+ <Card.Header>+ <Card.Title>Exceptions in this session</Card.Title>+ </Card.Header>+ <Card.Content class="p-0">+ <Table.Root>+ {#if exceptions.length === 0}+ <Table.Body>+ <TableEmptyState colspan={3} message="No exceptions captured during this session." />+ </Table.Body>+ {:else}+ <Table.Header>+ <Table.Row>+ <Table.Head>When</Table.Head>+ <Table.Head>Stack trace</Table.Head>+ <Table.Head class="w-[60px]"></Table.Head>+ </Table.Row>+ </Table.Header>+ <Table.Body>+ {#each exceptions as exc}+ <Table.Row class="cursor-pointer hover:bg-muted/50" onclick={() => gotoIssue(exc.exceptionHash)}>+ <Table.Cell class="text-sm whitespace-nowrap">{formatDateTime(exc.recordedAt, { timezone })}</Table.Cell>+ <Table.Cell class="font-mono text-xs truncate max-w-md">+ {exc.stackTrace.split('\n')[0]}+ </Table.Cell>+ <Table.Cell>+ <Button variant="ghost" size="icon" aria-label="Open issue">+ <ArrowRight class="size-4" />+ </Button>+ </Table.Cell>+ </Table.Row>+ {/each}+ </Table.Body>+ {/if}+ </Table.Root>+ </Card.Content>+ </Card.Root>+ {/if}+</div>