}()
	return errCh
}
package middleware

import (
	"github.com/prometheus/client_golang/prometheus"
	"go.opentelemetry.io/otel/trace"
	"net/http"
	"strconv"
	"time"

	"example/track-analyzer-service/internal/metrics"

	"github.com/go-chi/chi/v5"
)

type responseWriter struct {
	http.ResponseWriter
	status int
}

func NewResponseWriter(w http.ResponseWriter) *responseWriter {
	return &responseWriter{ResponseWriter: w, status: http.StatusOK}
}

func (w *responseWriter) WriteHeader(status int) {
	w.status = status
	w.ResponseWriter.WriteHeader(status)
}

func (w *responseWriter) Status() int {
	return w.status
}

func MetricsMiddleware(next http.Handler) http.Handler {
	return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
		ctx := r.Context()
		start := time.Now()

		ww := NewResponseWriter(w)
		next.ServeHTTP(ww, r)

		routePattern := chi.RouteContext(ctx).RoutePattern()
		if routePattern == "" {
			routePattern = "undefined"
		}

		spanCtx := trace.SpanContextFromContext(ctx)
		traceID := spanCtx.TraceID().String()
		traceLabels := prometheus.Labels{"trace_id": traceID}

		metrics.HttpRequestsTotal.WithLabelValues(
			routePattern,
			r.Method,
			strconv.Itoa(ww.Status()),
		).(prometheus.ExemplarAdder).AddWithExemplar(1, traceLabels)

		metrics.HttpRequestDuration.WithLabelValues(
			routePattern,
			r.Method,
		).(prometheus.ExemplarObserver).ObserveWithExemplar(time.Since(start).Seconds(), traceLabels)

		metrics.HttpRequestDurationSummary.WithLabelValues(
			routePattern,
			r.Method,
		).Observe(time.Since(start).Seconds())
	})
}
package handlers

import (
	"encoding/json"
	"net/http"

	"log/slog"

	"github.com/go-chi/chi/v5"

	"example/track-analyzer-service/internal/service"
)

type FeatureHandler struct {
	featureService *service.FeatureService
	logger         *slog.Logger
}

func NewFeatureHandler(featureService *service.FeatureService, logger *slog.Logger) *FeatureHandler {
	return &FeatureHandler{
		featureService: featureService,
		logger:         logger,
	}
}

type FeatureRequest struct {
	Value interface{} `json:"value"`
}

func (h *FeatureHandler) SetFeature(w http.ResponseWriter, r *http.Request) {
	ctx := r.Context()
	featureName := chi.URLParam(r, "name")

	var req FeatureRequest
	if err := json.NewDecoder(r.Body).Decode(&req); err != nil {
		h.logger.ErrorContext(ctx, "failed to decode request body",
			"error", err,
			"feature", featureName,
		)
		http.Error(w, "Invalid request body", http.StatusBadRequest)
		return
	}

	// Convert number to int if it's float64 (default JSON number type)
	if value, ok := req.Value.(float64); ok {
		req.Value = int(value)
	}

	h.featureService.SetFeature(ctx, featureName, req.Value)

	h.logger.InfoContext(ctx, "feature flag updated",
		"feature", featureName,
		"value", req.Value,
	)

	w.WriteHeader(http.StatusOK)
}
// Copyright The OpenTelemetry Authors
//
// Lic


.B	-2(A4),D0
	LSL.W	#4,D0
	MOVE.B	-(A4),D0
	;MOVE.W	D0,$FFFF8240.W
	SUB.W	D5,D0
	NEG.W	D0
	AND.W	#$0FFF,D0
	LEA	1(A6,D0.W),A0
	MOVEQ	#$0F,D1
	AND.B	-(A4),D1
	ADDQ.W	#2,D1
	MOVEQ	#$01,D0
	ADD.W	D1,D0
	CMPA.L	A5,A0
	BGT.S	SPACES

WRITE:	MOVE.B	-(A0),-(A6)
	DBF	D1,WRITE
BACK:	ADD.L	D0,D5
	SUB.L	D0,D4
	BGT.S	TOPDEP
EXITUP:	;MOVE.W	(A7)+,$FFFF8240.W
	RTS

SPACES: CMPA.L	A5,A0
	BLE.S	WRITE
	MOVE.B	D3,-(A6)		;COPY OUT SPACES
	SUBQ.L	#1,A0
	DBF	D1,SPACES
	BRA.S	BACK

;------------------------------------------------


D_JOYPAD_LEFT, "Left"},
		        {0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_RIGHT, "Right"},
		        {0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_SELECT, "Select"},
		        {0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_START, "Start"},
		        {0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_Y, "Square"},
		        {0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_X, "Triangle"},
		        {0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_A, "Circle"},
		        {0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_B, "Cross"},
		        {0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_L, "L1"},
		        {0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_L2, "L2"},
		        {0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_L3, "L3"},
		        {0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_R, "R1"},
		        {0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_R2, "R2"},
		        {0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_R3, "R3"},
		        {0},
		    };

		g_environ_cb(RETRO_ENVIRONMENT_SET_INPUT_DESCRIPTORS, descDS2);

		static const struct retro_controller_description controllers[] = {
		    {"PS2 DualShock2", RETRO_DEVICE_SUBCLASS(RETRO_DEVICE_JOYPAD, 0)},
		};

		static const struct retro_controller_info ports[] = {
		    {controllers, 1},
		    {NULL, 0},
		};

		g_environ_cb(RETRO_ENVIRONMENT_SET_CONTROLLER_INFO, (void*)ports);

		for(unsigned int i = 0; i < PS2::CControllerInfo::MAX_BUTTONS; i++)
		{
			auto ds2_button = static_cast<PS2::CControllerInfo::BUTTON>(i);
			auto retro_button = descDS2[i].id;
			g_ds2_to_retro_btn_map[ds2_button] = retro_button;
		}

		m_virtualMachine->CreatePadHandler(CPH_Libretro_Input::GetFactoryFunction());
	}
}

void retro_get_system_info(struct retro_system_info* info)
{
	*info = {};
	info->library_name = "Play!";
	info->library_version = PLAY_VERSION;
	info->need_fullpath = true;
	info->valid_extensions = "elf|iso|cso|isz|cue|chd";
}

void retro_get_system_av_info(struct retro_system_av_info* info)
{
	CLog::GetInstance().Print(LOG_NAME, "%s\n", __FUNCTION__);

	*info = {};
	info->timing.fps = 60.0;
	info->timing.sample_rate = 44100;
	info->geometry.base_width = 640;
	info->geometry.base_height = 448;
	info->geometry.max_width = 640 * 8;
	info->geometry.max_height = 448 * 8;
	info->geometry.aspect_ratio = 4.0 / 3.0;
}

void retro_set_video_refresh(retro_video_refresh_t cb)
{
	CLog::GetInstance().Print(LOG_NAME, "%s\n", __FUNCTION__);
	g_video_cb = cb;
}

void retro_set_environment(retro_environment_t cb)
{
	g_environ_cb


', [6.5, 1, 2], 10);
            progress2.Set('chart.colors', ['red', '#cfc', 'blue']);
            progress2.Set('chart.shadow', true);
            progress2.Set('chart.shadow.color', '#666');
            progress2.Set('chart.shadow.offsetx', 0);
            progress2.Set('chart.shadow.offsety', 0);
            progress2.Set('chart.shadow.blur', 15);
            progress2.Set('chart.margin', 3);
            progress2.Set('chart.tooltips', ['John', 'Fred', 'Pete']);
            progress2.Set('chart.tooltips.effect', 'contract');
            progress2.Set('chart.tickmarks', true);
            progress2.Set('chart.tickmarks.inner', true);
            progress2.Draw();
        }
    </script>

    RGraph: HTML5 canvas graph library
    >
    Examples
    >
    Vertical Progress bar

RGraph: HTML5 canvas graph library - Vertical Progress bar

        This is a Progress Bar for showing state. You can show anything with it - use it to show load on your server,
        or percentage space free on your servers disk drive. You could even incorporate it with some AJAX to retrieve status information
        from your webserver dynamically, making the Progress Bar realtime. To redraw the progress bar simply call RGraph.Clear()
        (which clears the canvas) and then call myProgress.Draw() again.

        The colours, title and scale are configurable, allowing you to represent a wide range of values.

Vertical Progress bar API documentation

Horizontal Progress bar

        <canvas width="125" height="450" id="progress1">[No canvas support]</canvas>
        <canvas width="125" height="450" id="progress2">[No canvas support]</canvas>

<?php ob_start('ob_gzhandler') ?>
<!DOCTYPE html>

    <meta http-equiv="X-UA-Compatible" content="chrome=1">


xn2 = cartesianCross(n1, n2)
        var A = cartesianScale(n1, c1)
        val B = cartesianScale(n2, c2)
        A = cartesianAdd(A, B)

        // Solve |p(t)|^2 = 1
        val u = n1xn2
        val w = cartesianDot(A, u)
        val uu = cartesianDot(u, u)
        val t2 = w * w - uu * (cartesianDot(A, A) - 1)

        if (t2 < 0) return null

        val t = sqrt(t2)
        var q = cartesianScale(u, (-w - t) / uu)
        q = cartesianAdd(q, A)
        q = spherical(q)

        return q
    }

    // TODO : factorize with intersect !
    private fun intersects(a: DoubleArray, b: DoubleArray): Array<DoubleArray>? {
        val pa = cartesian(a)
        val pb = cartesian(b)

        // We have two planes, n1.p = d1 and n2.p = d2.
        // Find intersection line p(t) = c1 n1 + c2 n2 + t (n1 ⨯ n2).
        val n1 = doubleArrayOf(1.0, .0, .0)                 // normal
        val n2 = cartesianCross(pa, pb)
        val n2n2 = cartesianDot(n2, n2)
        val n1n2 = n2[0]                                        // cartesianDot(n1, n2)
        val determinant = n2n2 - n1n2 * n1n2

        // Two polar points.
        if (determinant == .0) return null

        val c1 = cosRadius * n2n2 / determinant
        val c2 = -cosRadius * n1n2 / determinant
        val n1xn2 = cartesianCross(n1, n2)
        var A = cartesianScale(n1, c1)
        val B = cartesianScale(n2, c2)
        A = cartesianAdd(A, B)

        // Solve |p(t)|^2 = 1
        val u = n1xn2
        val w = cartesianDot(A, u)
        val uu = cartesianDot(u, u)
        val t2 = w * w - uu * (cartesianDot(A, A) - 1)

        if (t2 < 0) return null

        val t = sqrt(t2)
        var q = cartesianScale(u, (-w - t) / uu)
        q = cartesianAdd(q, A)
        q = spherical(q)

        // Two intersection points.
        var lambda0 = a[0]
        var lambda1 = b[0]
        var phi0 = a[1]
        var phi1 = b[1]

        if (lambda1 < lambda0) {
            val z = lambda0
            lambda0 = lambda1
            lambda1 = z
        }

        val delta = lambda1 - lambda0
        val polar = abs(delta - PI) < EPSILON
        val meridian = polar || delta < EPSILON

        if (!polar && phi1 < phi0) {
            val z = phi0
            phi0 = phi1
            phi1 = z
        }

        // Check that the first point is between a and b.
        val test = if (meridian) {
            if (polar) {
                (phi0 + phi1 > 0) xor (q[1] < if (abs(q[0] - lambda0) < EPSILON) phi0 else phi1)
            } else (q[1] in phi0..phi1)
        } else {
            (delta > PI) xor (q[0] in lambda0..lambda1)
        }

        if (test) {
            var q1 = cartesianScale(u, (-w + t) / uu)
            q1 = cartesianAdd(q1, A)
            return arrayOf(q, spherical(q1))
        }
        return null
    }

    // Generates a 4-bit vector representing the location of a point relative to
    // the small circle's bounding box.
    public fun code(x: Double, y: Double): Int {
        val r = if (smallRadius) radius else PI - radius
        var code =


-20,
	DiodeOffset:         gmath.Vec{X: -16, Y: -29},
	AllianceColorOffset: gmath.Vec{X: 7, Y: 30},
	ScoreCost:           ArkCoreCost,

	FlightHeight:  30,
	DefaultHeight: 30,

	Speed:               32,
	JumpDist:            750,
	DroneLimit:          75,
	DroneLimitScaling:   0.95,
	StartingDrones:      10,
	ResourcesLimit:      250,
	DroneProductionCost: 1,
	MaxHealth:           85,

	HitboxRadius: 4,

	MobilityRating:  10,
	AttackRating:    0,
	DefenseRating:   6,
	CapacityRating:  5,
	UnitLimitRating: 6,
}

var TankCoreWeapon1 = InitWeaponStats(&WeaponStats{
	AttackRangeMarkMultiplier: 1.5,
	AttackRange:               260,
	Reload:                    3.0,
	AttackSound:               assets.AudioTankColonyBlasterShot,
	ProjectileImage:           assets.ImageTankColonyProjectile1,
	ImpactArea:                15,
	ProjectileSpeed:           270,
	Damage:                    DamageValue{Health: 12},
	Explosion:                 ProjectileExplosionTankColonyBlaster,
	MaxTargets:                1,
	BurstSize:                 1,
	TargetFlags:               TargetFlying,
	TrailEffect:               ProjectileTrailTankColonyWeapon1,
	ProjectileFireSound:       true,
})

var TankCoreStats = &ColonyCoreStats{
	Name:                "tank",
	Image:               assets.ImageTankCore,
	HatchOffsetY:        -11,
	DiodeOffset:         gmath.Vec{X: -8, Y: -20},
	AllianceColorOffset: gmath.Vec{X: 17, Y: 36},
	ScoreCost:           TankCoreCost,

	DefaultHeight: 0,

	Speed:               32,
	JumpDist:            650,
	DroneLimit:          40,
	DroneLimitScaling:   0.7,
	StartingDrones:      5,
	ResourcesLimit:      200,
	DroneProductionCost: 1,
	MaxHealth:           75,

	HitboxRadius: 2,

	MobilityRating:  6,
	AttackRating:    8,
	DefenseRating:   5,
	CapacityRating:  4,
	UnitLimitRating: 3,
}

var HiveMortarWeapon = InitWeaponStats(&WeaponStats{
	AttackRangeMarkMultiplier: 2.2,
	AttackRange:               320,
	Reload:                    3.1,
	AttackSound:               assets.AudioHiveMortarShot1,
	ProjectileFireSound:       true,
	ProjectileImage:           assets.ImageHiveMortarProjectile,
	AlwaysExplodes:            true,
	ImpactArea:                20,
	ProjectileSpeed:           240,
	Damage:                    DamageValue{Health: 9},
	BuildingDamageBonus:       -0.5,
	MaxTargets:                2,
	AttacksPerBurst:           1,
	BurstDelay:                0.25,
	BurstSize:                 4,
	FireOffsets:               []gmath.Vec{{X: -18, Y: 5}, {X: -18, Y: 5}, {X: 18, Y: 5}, {X: 18, Y: 5}},
	Explosion:                 ProjectileExplosionPurpleBurst,
	ArcPower:                  3.4,
	Accuracy:                  0.9,
	TargetFlags:               TargetGround,
	TrailEffect:


mpeqss (%rdx), %xmm1, %k2

// CHECK: vcmpeqss (%rdx), %xmm1, %k2 {%k2}
// CHECK: encoding: [0x62,0xf1,0x76,0x0a,0xc2,0x12,0x00]
vcmpeqss (%rdx), %xmm1, %k2 {%k2}

// CHECK: vcmpeqss {sae}, %xmm15, %xmm15, %k2
// CHECK: encoding: [0x62,0xd1,0x06,0x18,0xc2,0xd7,0x00]
vcmpeqss {sae}, %xmm15, %xmm15, %k2

// CHECK: vcmpeqss {sae}, %xmm15, %xmm15, %k2 {%k2}
// CHECK: encoding: [0x62,0xd1,0x06,0x1a,0xc2,0xd7,0x00]
vcmpeqss {sae}, %xmm15, %xmm15, %k2 {%k2}

// CHECK: vcmpeqss {sae}, %xmm1, %xmm1, %k2
// CHECK: encoding: [0x62,0xf1,0x76,0x18,0xc2,0xd1,0x00]
vcmpeqss {sae}, %xmm1, %xmm1, %k2

// CHECK: vcmpeqss {sae}, %xmm1, %xmm1, %k2 {%k2}
// CHECK: encoding: [0x62,0xf1,0x76,0x1a,0xc2,0xd1,0x00]
vcmpeqss {sae}, %xmm1, %xmm1, %k2 {%k2}

// CHECK: vcmpeqss %xmm15, %xmm15, %k2
// CHECK: encoding: [0x62,0xd1,0x06,0x08,0xc2,0xd7,0x00]
vcmpeqss %xmm15, %xmm15, %k2

// CHECK: vcmpeqss %xmm15, %xmm15, %k2 {%k2}
// CHECK: encoding: [0x62,0xd1,0x06,0x0a,0xc2,0xd7,0x00]
vcmpeqss %xmm15, %xmm15, %k2 {%k2}

// CHECK: vcmpeqss %xmm1, %xmm1, %k2
// CHECK: encoding: [0x62,0xf1,0x76,0x08,0xc2,0xd1,0x00]
vcmpeqss %xmm1, %xmm1, %k2

// CHECK: vcmpeqss %xmm1, %xmm1, %k2 {%k2}
// CHECK: encoding: [0x62,0xf1,0x76,0x0a,0xc2,0xd1,0x00]
vcmpeqss %xmm1, %xmm1, %k2 {%k2}

// CHECK: vcomisd 485498096, %xmm15
// CHECK: encoding: [0xc5,0x79,0x2f,0x3c,0x25,0xf0,0x1c,0xf0,0x1c]
vcomisd 485498096, %xmm15

// CHECK: vcomisd 485498096, %xmm1
// CHECK: encoding: [0xc5,0xf9,0x2f,0x0c,0x25,0xf0,0x1c,0xf0,0x1c]
vcomisd 485498096, %xmm1

// CHECK: vcomisd 512(%rdx,%rax,4), %xmm15
// CHECK: encoding: [0xc5,0x79,0x2f,0xbc,0x82,0x00,0x02,0x00,0x00]
vcomisd 512(%rdx,%rax,4), %xmm15

// CHECK:


")),
        Valid("<   1.2.3", LessThan("1.2.3")),
        Valid(" <   1.2.3 ", LessThan("1.2.3")),
        Valid("<1.2.3 <4.5.6", LessThan("1.2.3")),
        Valid("<1.2.3 || <4.5.6", LessThan("4.5.6")),
        Valid("<=1.2.3", AtMost("1.2.3")),
        Valid("  <=1.2.3   ", AtMost("1.2.3")),
        Valid("<=   1.2.3", AtMost("1.2.3")),
        Valid(" <=   1.2.3 ", AtMost("1.2.3")),
        Valid("<=1.2.3 <=4.5.6", AtMost("1.2.3")),
        Valid("<=1.2.3 || <=4.5.6", AtMost("4.5.6")),
        Valid("*-* >=2.0.0-0", AtLeast("2.0.0-0", true)),
        Valid("~1.2.3", InclusiveOfStart("1.2.3", "1.3.0-0")),
        Valid("~1.2.3-rc", InclusiveOfStart("1.2.3-rc", "1.3.0-0")),
        Valid("^1.2.3", InclusiveOfStart("1.2.3", "2.0.0-0")),
        Valid("^1.2.3-rc", InclusiveOfStart("1.2.3-rc", "2.0.0-0")),
        Valid("^0.2.3", InclusiveOfStart("0.2.3", "0.3.0-0")),
        Valid("^0.2.3-rc", InclusiveOfStart("0.2.3-rc", "0.3.0-0")),
        Valid("^0.0.3", InclusiveOfStart("0.0.3", "0.0.4-0")),
        Valid("^0.0.3-rc", InclusiveOfStart("0.0.3-rc", "0.0.4-0")),
        Valid(">=4.0.0", IncludeAllPrerelease, AtLeast("4.0.0", true)),

        // Wildcard versions
        Valid("*", AllRelease),
        Valid("*.*", AllRelease),
        Valid("*.*.*", AllRelease),
        Valid("*-*", All),
        Valid("*.*-*", All),
        Valid("*.*.*-*", All),
        Valid("3.*", InclusiveOfStart("3.0.0", "4.0.0-0")),
        Valid("3.*-*", InclusiveOfStart("3.0.0-0", "4.0.0-0", true)),
        Valid("3.*.*", InclusiveOfStart("3.0.0", "4.0.0-0")),
        Valid("3.*.*-*", InclusiveOfStart("3.0.0-0", "4.0.0-0", true)),
        Valid("3.1.*", InclusiveOfStart("3.1.0", "3.2.0-0")),
        Valid("3.1.*-*", InclusiveOfStart("3.1.0-0", "3.2.0-0", true)),
        Valid("3.1.4-*", InclusiveOfStart("3.1.4-0", "3.1.5-0", true)),
        Valid("3.1.4-rc.*", InclusiveOfStart("3.1.4-rc.0", "3.1.4-rc-", true)),
        Valid("3.1.4-5.*", InclusiveOfStart("3.1.4-5.0", "3.1.4-6", true)),
        Valid("3.1.4-2147483647.*", InclusiveOfStart("3.1.4-2147483647.0", "3.1.4-2147483648", true)),
        Valid("3.1.4-l.o.n.g.e.r.rc.*", InclusiveOfStart("3.1.4-l.o.n.g.e.r.rc.0", "3.1.4-l.o.n.g.e.r.rc-", true)),

        // Range containment (or non-containment)
        Valid("1.*||1.2.*", InclusiveOfStart("1.0.0", "2.0.0


09786354
	    TacticalRifle["Recoil"] = 0.209786354
	    SawnoffShotgun["Recoil"] = 0.209786354
end
if client and  client.esp and client.NoMap and client.AimBot and client.FastShoot and client.LowRecoil then
RS.ConfettiGUI:Clone().Parent = player.PlayerGui
Check:Destroy()
local Name = Instance.new("TextLabel", GunCheats)
local Chams = Instance.new("TextButton", GunCheats)
local NoRecoil = Instance.new("TextButton", GunCheats)
local MainGUI = Instance.new("ScreenGui", game.CoreGui)
local GunCheats = Instance.new("Frame", MainGUI)
local FastShootBTN = Instance.new("TextButton", GunCheats)
local NMBTN = Instance.new("TextButton", GunCheats)
local CB = Instance.new("TextButton", GunCheats)
local ESP = Instance.new("TextButton", GunCheats)
local NoM = Instance.new("TextButton", GunCheats)
local AllAR = Instance.new("TextButton", GunCheats)
MainGUI.Name = "Gui"
MainGUI.Enabled = true
GunCheats.Name = "GunCheats"
GunCheats.BackgroundColor3 = Color3.new(0, 0, 0)
GunCheats.Position = UDim2.new(0.252173936, 0, 0.04501, 0)
GunCheats.Size = UDim2.new(0, 175, 0, 450)
GunCheats.Transparency = .3
GunCheats.Active = true
GunCheats.Draggable = true
GunCheats.BorderColor3 = Color3.new(0, 0, 1)
GunCheats.BorderSizePixel = 2.52222222
Name.Name = "Name"
Name.Text = "STRUCID FUCK"
Name.Parent = GunCheats
Name.BackgroundColor3 = Color3.new(1, 0, 0.1)
Name.Position = UDim2.new(0.007, 0, 0, 0)
Name.Size = UDim2.new(0, 175, 0, 60)
Name.BackgroundTransparency = 1
Name.TextColor3 = Color3.new(255,255,255)
Name.TextSize = 15
FastShootBTN.Name = "Aimbot"
FastShootBTN.Text = "Aimbot"
FastShootBTN.Parent = GunCheats
FastShootBTN.BackgroundColor3 = Color3.new(1, 0, 0.1)
FastShootBTN.Position = UDim2.new(0.007, 0, 0.16401, 0)
FastShootBTN.Size = UDim2.new(0, 175, 0, 40)
FastShootBTN.BackgroundTransparency = 1
FastShootBTN.TextColor3 = Color3.new(255,255,255)
FastShootBTN.MouseButton1Down:Connect(function() client.AimBot() end)
NMBTN.Name = "NM"
NMBTN.Text = "No Map (Beta)"
NMBTN.Parent = GunCheats
NMBTN.BackgroundColor3 = Color3.new(1, 0, 0.1)
NMBTN.Position = UDim2.new(0.007, 0, 0.855001, 0)
NMBTN.Size = UDim2.new(0, 175, 0, 40)
NMBTN.BackgroundTransparency = 1
NMBTN.TextColor3 = Color3.new(255,255,255)
NMBTN.MouseButton1Down:Connect(function() client.InvisLoop() end)
Chams.Name = "Chams"
Chams.Text = "FastShoot"
Chams.Parent = GunCheats
Chams.BackgroundColor3 = Color3.new(1, 0, 0.1)
Chams.Position = UDim2.new(0.007, 0, 0.7


rkPolicyPeer proto.InternalMessageInfo

func (m *NetworkPolicyPort) Reset()      { *m = NetworkPolicyPort{} }
func (*NetworkPolicyPort) ProtoMessage() {}
func (*NetworkPolicyPort) Descriptor() ([]byte, []int) {
	return fileDescriptor_1c72867a70a7cc90, []int{6}
}
func (m *NetworkPolicyPort) XXX_Unmarshal(b []byte) error {
	return m.Unmarshal(b)
}
func (m *NetworkPolicyPort) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
	b = b[:cap(b)]
	n, err := m.MarshalToSizedBuffer(b)
	if err != nil {
		return nil, err
	}
	return b[:n], nil
}
func (m *NetworkPolicyPort) XXX_Merge(src proto.Message) {
	xxx_messageInfo_NetworkPolicyPort.Merge(m, src)
}
func (m *NetworkPolicyPort) XXX_Size() int {
	return m.Size()
}
func (m *NetworkPolicyPort) XXX_DiscardUnknown() {
	xxx_messageInfo_NetworkPolicyPort.DiscardUnknown(m)
}

var xxx_messageInfo_NetworkPolicyPort proto.InternalMessageInfo

func (m *NetworkPolicySpec) Reset()      { *m = NetworkPolicySpec{} }
func (*NetworkPolicySpec) ProtoMessage() {}
func (*NetworkPolicySpec) Descriptor() ([]byte, []int) {
	return fileDescriptor_1c72867a70a7cc90, []int{7}
}
func (m *NetworkPolicySpec) XXX_Unmarshal(b []byte) error {
	return m.Unmarshal(b)
}
func (m *NetworkPolicySpec) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
	b = b[:cap(b)]
	n, err := m.MarshalToSizedBuffer(b)
	if err != nil {
		return nil, err
	}
	return b[:n], nil
}
func (m *NetworkPolicySpec) XXX_Merge(src proto.Message) {
	xxx_messageInfo_NetworkPolicySpec.Merge(m, src)
}
func (m *NetworkPolicySpec) XXX_Size() int {
	return m.Size()
}
func (m *NetworkPolicySpec) XXX_DiscardUnknown() {
	xxx_messageInfo_NetworkPolicySpec.DiscardUnknown(m)
}

var xxx_messageInfo_NetworkPolicySpec proto.InternalMessageInfo

func init() {
	proto.RegisterType((*IPBlock)(nil), "k8s.io.api.networking.v1.IPBlock")
	proto.RegisterType((*NetworkPolicy)(nil), "k8s.io.api.networking.v1.NetworkPolicy")
	proto.RegisterType((*NetworkPolicyEgressRule)(nil), "k8s.io.api.networking.v1.NetworkPolicyEgressRule")
	proto.RegisterType((*NetworkPolicyIngressRule)(nil), "k8s.io.api.networking.v1.NetworkPolicyIngressRule")
	proto.RegisterType((*NetworkPolicyList)(nil), "k8s.io.api.networking.v1.NetworkPolicyList")
	proto.RegisterType((*NetworkPolicyPeer)(nil), "k8s.io.api.networking.v1.NetworkPolicyPeer")
	proto.RegisterType((*NetworkPolicyPort)(nil), "k8s.io.api.networking.v1.NetworkPolicyPort")
	proto.RegisterType((*NetworkPolicySpec)(nil), "k8s.io.api.networking.v1.NetworkPolicySpec")
}

func init() {
	proto.RegisterFile("k8s.io/kubernetes/vendor/k8s.io/api/networking/v1/generated.proto", fileDescriptor_1c72867a70a7cc90)
}

var fileDescriptor_1c72867a70a7cc90 = []byte{
	// 804 bytes of a gzipped FileDescriptorProto
	0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x55, 0xcf


(
                        this.getFunctionCompletions(prefix)));

                } else {
                    callback(null, this.getKeywordCompletions(prefix).concat(
                        this.getFunctionCompletions(prefix)));
                }
            }
        };

        api.get('v1/GetKeywordCompletions').then((response) => {
            this.state.completions = response.data['items'];
            VqlMode.setCompletions(this.state.completions);
        });

        // finally, bind to langTools:
        language_tools.setCompleters();
        language_tools.addCompleter(vqlCompleter);
        language_tools.addCompleter(language_tools.textCompleter);

        if (!options.enableLiveAutocompletion) {
            ace.setOptions({
                enableBasicAutocompletion: true,
                enableLiveAutocompletion: true,
            });
        };
    };
}
import "./reporting.css";
import _ from 'lodash';

import React from 'react';
import PropTypes from 'prop-types';
import {CancelToken} from 'axios';
import parseHTML from '../core/sanitize.jsx';

import api from '../core/api-service.jsx';
import { VeloLineChart, VeloTimeChart } from './line-charts.jsx';
import Spinner from '../utils/spinner.jsx';
import ToolViewer from "../tools/tool-viewer.jsx";
import Timeline from "../timeline/timeline.jsx";
import NotebookTableRenderer from '../notebooks/notebook-table-renderer.jsx';
import { NotebookLineChart, NotebookTimeChart,
         NotebookScatterChart, NotebookBarChart
       } from '../notebooks/notebook-chart-renderer.jsx';

import VeloValueRenderer from '../utils/value.jsx';
import { JSONparse } from '../utils/json_parse.jsx';
import VeloSigmaEditor from './sigma-editor.jsx';

// Renders a report in the DOM.
const parse_param = domNode=>JSONparse(decodeURIComponent(
    domNode.attribs.params, {}));

// NOTE: The server sanitizes reports using the bluemonday
// sanitization. We therefore trust the output and are allowed to
// insert it into the DOM.

export default class VeloReportViewer extends React.Component {
    static propTypes = {
        artifact: PropTypes.string,
        type: PropTypes.string,
        params: PropTypes.object,
        client: PropTypes.object,
        flow_id: PropTypes.string,
        refresh: PropTypes.func,
    }

    state = {
        template: "",
        data: {},
        messages: [],
        loading: true,
        version: 0,
    }

    componentDidMount() {
        this.source = CancelToken.source();
        this.updateReport();
    }

    componentWillUnmount() {
        this.source.cancel();
    }

    componentDidUpdate(prevProps) {
        let client_id = this.props.client && this.props.client.client_id;
        let artifact = this.props.artifact;
        let previous_version = prevProps.params && prevProps.params.Version;
        let current_version = this.props.params && this.props.params.Version;

        let prev_client_id = prevProps.client && prevProps.client.client_id;

        if (client_id !== prev_client_id ||
            previous_version !== current_version ||
            artifact !== prevProps.artifact ||
            !_.isEqual(prevProps.params, this.props.params)) {
                this.updateReport();
        }
    }

    // Notebook charts make API calls to actually get their data.
    maybeProcessNotebookChart = domNode=>{
        switch (domNode.name) {
        case "notebook-line-chart":
            return <NotebookLineChart params={parse_param(domNode)} />;

        case "notebook-bar-chart":
            return <NotebookBarChart params={parse_param(domNode)} />;

        case "notebook-scatter-chart":


aws 單子律}

:::{.equations}
  * {title="右單位律(right identity): " #eq:monad-right-id}
    |p >>= return {-"~"-}| |={-"~"-} p {-"~~,"-}|
  * {title="左單位律(left identity): " #eq:monad-left-id}
    |return x >>= f {-"~"-}| |={-"~"-} f x {-"~~,"-}|
  * {title="結合律(associativity): " #eq:monad-assoc}
    |(p >>= f) >>= g {-"~"-}| |={-"~"-} p >>= (\x -> f x >>= g) {-"~~."-}|

:::

:::

*右單位律*若寫成 |p >>= \x -> return x| 也許更好理解。計算 |p| 的結果 |x| 被傳到 |(>>=)| 的右邊，但後者只是單純地把 |x| 再傳出。這和只寫 |p| 得是一樣的。

在*左單位律*的左手邊 |return x >>= f| 之中，函數 |f| 接收 |return x| 的結果 --- 而 |return x| 的結果就是 |x|! 因此這和 |f x| 得是一樣的。

最後一條是 |(>>=)| 的*結合律*：「用 |p| 與 |f| 串接出一個程式，再把 |g| 串接到右邊」與「把 |f| 與 |g| 串接在一起，並把 |p| 串接在它們左邊」得到的必須是一樣的程式。
但由於型別的問題，在後者的情況我們需要一個 |x| 表示 |p| 的結果，前者則不用。

每定義一個新的單子，我們需選定一個型別 |m|，定義 |return| 與 |(>>=)| 兩個運算子，然後證明它們滿足單子律。需要推論含單子的程式的性質與正確性時，這三條單子律也是我們會用到的性質。

最後一提：定義 \@ref{def:monad} 並不是單子的唯一定義方式。其他等價的定義詳見 \todo{where}.

:::{.exlist}
:::{.exer}
證明第 \@ref{sec:exceptions} 節中的定義滿足單子律。
意即當 |m = Except|, |return = Return|, 而 |(>>=)| 的定義如第 \@ref{sec:exceptions} 節所示時，三條單子律都成立。
:::
:::

{title="單子 class"}
既然 Haskell 有 type class 機制，我們可以把單子定義為一個 class:
```spec
class Monad m where
  return  :: a -> m a
  (>>


0,50;
}.markdown-body{-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%;margin:0;color:#24292f;background-color:#f2f2f2;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji";font-size:16px;line-height:1.5;word-wrap:break-word}.markdown-body .octicon{display:inline-block;fill:currentColor;vertical-align:text-bottom}.markdown-body h1:hover .anchor .octicon-link:before,.markdown-body h2:hover .anchor .octicon-link:before,.markdown-body h3:hover .anchor .octicon-link:before,.markdown-body h4:hover .anchor .octicon-link:before,.markdown-body h5:hover .anchor .octicon-link:before,.markdown-body h6:hover .anchor .octicon-link:before{width:16px;height:16px;content:' ';display:inline-block;background-color:currentColor;-webkit-mask-image:url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' version='1.1' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg>");mask-image:url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' version='1.1' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg>")}.markdown-body details,.markdown-body figcaption,.markdown-body figure{display:block}.markdown-body summary{display:list-item}.markdown-body [hidden]{display:none!important}.markdown-body a{background-color:transparent;color:#0969da;text-decoration:none}.markdown-body a:active,.markdown-body a:hover{outline-width:0}.markdown-body abbr[title]{border-bottom:none;text-decoration:underline dotted}.markdown-body b,.markdown-body strong{font-weight:600}.markdown-body dfn{font-style:italic}.markdown-body h1{margin:.67em 0;font-weight:600;padding-bottom:.3em;font-size:2em;border-bottom:1px solid #d7dde3}.markdown-body mark{background-color:#fff8c5;color:#24292f}.markdown-body small{font-size:90%}.markdown-body sub,.markdown-body sup{font-size:75%;line-height:0;position:relative;vertical-


, T__96=97, T__97=98, T__98=99, T__99=100, T__100=101,
		T__101=102, T__102=103, T__103=104, T__104=105, T__105=106, T__106=107,
		T__107=108, T__108=109, T__109=110, T__110=111, T__111=112, T__112=113,
		T__113=114, T__114=115, T__115=116, T__116=117, WHITESPACE=118, NUMBER=119,
		HEX_NUMBER=120, SingleLineString=121, MultiLineString=122, NEWLINE=123,
		IDENTIFIER=124, SINGLE_LINE_COMMENT=125, MULTI_LINE_COMMENT=126;
	public static final int
		RULE_compilationUnit = 0, RULE_variableDeclaration = 1, RULE_declaredIdentifier = 2,
		RULE_finalConstVarOrType = 3, RULE_varOrType = 4, RULE_initializedVariableDeclaration = 5,
		RULE_initializedIdentifier = 6, RULE_initializedIdentifierList = 7, RULE_functionSignature = 8,
		RULE_formalParameterPart = 9, RULE_returnType = 10, RULE_functionBody = 11,
		RULE_block = 12, RULE_formalParameterList = 13, RULE_normalFormalParameters = 14,
		RULE_optionalFormalParameters = 15, RULE_optionalPositionalFormalParameters = 16,
		RULE_namedFormalParameters = 17, RULE_normalFormalParameter = 18, RULE_functionFormalParameter = 19,
		RULE_simpleFormalParameter = 20, RULE_fieldFormalParameter = 21, RULE_defaultFormalParameter = 22,
		RULE_defaultNamedParameter = 23, RULE_classDefinition = 24, RULE_mixins = 25,
		RULE_classMemberDefinition = 26, RULE_methodSignature = 27, RULE_declaration = 28,
		RULE_staticFinalDeclarationList = 29, RULE_staticFinalDeclaration = 30,
		RULE_operatorSignature = 31, RULE_operator = 32, RULE_binaryOperator = 33,
		RULE_getterSignature = 34, RULE_setterSignature = 35, RULE_constructorSignature = 36,
		RULE_redirection = 37, RULE_initializers = 38, RULE_initializerListEntry = 39,
		RULE_fieldInitializer = 40, RULE_factoryConstructorSignature = 41, RULE_redirectingFactoryConstructorSignature = 42,
		RULE_constantConstructorSignature = 43, RULE_superclass = 44, RULE_interfaces = 45,
		RULE_mixinApplicationClass = 46, RULE_mixinApplication = 47, RULE_enumType = 48,
		RULE_enumEntry = 49, RULE_typeParameter = 50, RULE_typeParameters = 51,
		RULE_metadata = 52, RULE_expression = 53, RULE_expressionWithoutCascade = 54,
		RULE_expressionList = 55, RULE_primary = 56, RULE_literal = 57, RULE_nullLiteral = 58,
		RULE_numericLiteral = 59, RULE_booleanLiteral = 60, RULE_stringLiteral = 61,
		RULE_stringInterpolation = 62, RULE_symbolLiteral = 63, RULE_listLiteral = 64,
		RULE_mapLiteral = 65, RULE_mapLiteralEntry = 66, RULE_throwExpression = 67,
		RULE_throwExpressionWithoutCascade = 68, RULE_functionExpression = 69,
		RULE_thisExpression = 70, RULE_nayaExpression = 71, RULE_constObjectExpression = 72,
		RULE_arguments = 73, RULE_argumentList = 74, RULE_namedArgument = 75,
		RULE_cascadeSection = 76, RULE_cascadeSelector = 77, RULE_argumentPart = 78,
		RULE_assignmentOperator = 79, RULE_compoundAssignmentOperator = 80, RULE_conditionalExpression = 81,
		RULE_ifNullExpression = 82, RULE_logicalOrExpression = 83, RULE_logicalAndExpression = 84,
		RULE_equalityExpression = 85, RULE_equalityOperator = 86, RULE_relationalExpression = 87,
		RULE_r


using EPiServer.Security;

namespace Foundation.Infrastructure
{
    [GroupDefinitions]
    public static class TabNames
    {
        [Display(Order = 10)]
        public const string Default = "Default";

        [Display(Name = "Blog list", Order = 30)]
        public const string BlogList = "BlogList";

        [Display(Order = 40)]
        public const string Review = "Review";

        [Display(Order = 50)]
        [RequiredAccess(AccessLevel.Edit)]
        public const string Header = "Header";

        [Display(Order = 55)]
        [RequiredAccess(AccessLevel.Edit)]
        public const string TopBanner = "Top Banner";

        [Display(Order = 60)]
        [RequiredAccess(AccessLevel.Edit)]
        public const string Footer = "Footer";

        [Display(Name = "Search settings", Order = 65)]
        public const string SearchSettings = "SearchSettings";

        [Display(Order = 70)]
        [RequiredAccess(AccessLevel.Edit)]
        public const string Menu = "Menu";

        [Display(Name = "Site labels", Order = 75)]
        [RequiredAccess(AccessLevel.Edit)]
        public const string SiteLabels = "SiteLabels";

        [Display(Order = 76)]
        public const string Manufacturer = "Manufacturer";

        [Display(Name = "Site structure", Order = 77)]
        [RequiredAccess(AccessLevel.Edit)]
        public const string SiteStructure = "SiteStructure";

        [Display(Name = "Mail templates", Order = 78)]
        [RequiredAccess(AccessLevel.Edit)]
        public const string MailTemplates = "MailTemplates";

        [Display(Order = 80)]
        [RequiredAccess(AccessLevel.Edit)]
        public const string Archives = "Archi


Field(obj.GetType(), (i as FieldInfo).Name);
						obj = r.GetValue(obj);
						objName = r.Name;
					}
					else if(i is PropertyInfo)
                    {
						var r = AccessTools.Property(obj.GetType(), (i as PropertyInfo).Name);
						obj = r.GetValue(obj);
						objName = r.Name;
					}
				}
				if(obj is bool)
                {
					ModEntry.SMonitor.Log($"Setting {label} for {AccessTools.Field(lastObject.GetType(), objName)} to {(bool)obj}");
					AccessTools.Field(lastObject.GetType(), objName).SetValue(lastObject, isChecked);
                }
				selected = null;
			}
		}

		public override void draw(SpriteBatch b, int slotX, int slotY, IClickableMenu context = null)
		{
			b.Draw(Game1.mouseCursors, new Vector2((float)(slotX + bounds.X), (float)(slotY + bounds.Y)), new Rectangle?(isChecked ? OptionsCheckbox.sourceRectChecked : OptionsCheckbox.sourceRectUnchecked), Color.White * (greyedOut ? 0.33f : 1f), 0f, Vector2.Zero, 4f, SpriteEffects.None, 0.4f);
			base.draw(b, slotX, slotY, context);
		}

		public const int pixelsWide = 9;

		public static FieldCheckbox selected;

		public bool isChecked;

		public static Rectangle sourceRectUnchecked = new Rectangle(227, 425, 9, 9);

		public static Rectangle sourceRectChecked = new Rectangle(236, 425, 9, 9);
	}
}


gle.activated ul a {
    color: #ddd;
    margin: 0;
  }

  article.tutorial .outline_nav_toggle.activated ul a:active {
    color: #ddd;
  }

  article.tutorial .outline_nav_toggle.activated ul a:visited {
    color: #ddd;
  }

  article.tutorial .outline_nav_toggle.activated ul ul a {
    color: #bbb;
    color: #bbb !important;
    margin: 0;
  }

  article.tutorial .outline_nav_toggle.activated ul ul  a:active {
    color: #bbb;
    color: #bbb !important;
  }

  article.tutorial .outline_nav_toggle.activated ul ul ul a:visited {
    color: #bbb !important;
  }

  article.tutorial .outline_nav_toggle.activated ul ul ul a {
    color: #999 !important;
    margin: 0;
  }

  article.tutorial .outline_nav_toggle.activated ul ul ul a:active {
    color: #999 !important;
  }

  article.tutorial .outline_nav_toggle.activated ul ul ul a:visited {
    color: #999 !important;
  }

  article.tutorial nav {
    background-color: #EC4936 !important;
    color: white;
    height: 100%;
    width: 100% !important;
    text-align: center;
    margin: 0;
    margin-top: 4px !important;
  }

  article.tutorial .outline_nav_toggle.activated nav {
    background-color: transparent !important;
    color: white;
    text-align: inherit;
  }

  article.tutorial .outline_nav_toggle.activated nav.outline.toc ul {
    margin-left: 1em;
  }

  article.tutorial .outline_nav_toggle.activated h3 {
    font-size: 18px;
    font-weight: 400;
  }

  article.tutorial .outline_nav_toggle.activated nav li {
    margin-bottom: 1em;
    font-size:16px;
    font-weight: 300;
  }

  .profile .articles
  {
    height: inherit;
    overflow: visible;
  }

  .profile .articles li
  {
    list-style: none !important;
    white-space: normal;
    margin-left: 1em;
    text-indent: -1.5em;
  }

  .profile .articles a
  {
    list-style: none !important;
    overflow: visible;
  }

  .two_columns
  {
    -moz-column-count: 1;
    -o-column-count: 1;
    -ms-column-count: 1;
    -webkit-column-count: 1;
    column-count: 1;
  }

  div.one_quarter,
  div.one_half    { float: left; }
  div.one_quarter {
    width: 50%;
    padding-bottom: .75em;
  }
  div.one_half    { width: 100%; }

  /* Homepage */

  body[data-href="home"] #updates.feed li
  {
    border-top: 1px solid #bbb;
    padding: .25em 0;
    overflow: hidden;
  }

  body[data-href="home"] #updates.feed li:first-child
  {
    border-top: 0;
  }

  body[data-href="home"] #updates.feed li span.byline,
  body[data-href="home"] #updates.feed li span.details
  {
    display: inline;
  }

  body[data-href="home"] #updates.feed li span.classes,
  body[data-href="home"] #updates.feed li span.type
  {
    display: none;
  }

  body[data-href="home"] article.profile { width: 49% !important; }


Lyrics__Active
  #SpicyLyricsPage.SpicyRenderer
  .LyricsContainer
  .LyricsContent:has(.OppositeAligned)
  .line.OppositeAligned:not(.rtl) {
  padding-left: 10cqw !important;
}

body.SpicySidebarLyrics__Active
  #SpicyLyricsPage.SpicyRenderer
  .LyricsContainer
  .LyricsContent:has(.OppositeAligned)
  .line:not(.OppositeAligned, .rtl) {
  padding-right: 10cqw !important;
}

body.SpicySidebarLyrics__Active
  #SpicyLyricsPage.SpicyRenderer
  .LyricsContainer
  .LyricsContent:has(.OppositeAligned.rtl)
  .line.OppositeAligned {
  padding-right: 10cqw !important;
}

body.SpicySidebarLyrics__Active
  #SpicyLyricsPage.SpicyRenderer
  .LyricsContainer
  .LyricsContent:has(.OppositeAligned.rtl)
  .line:not(.OppositeAligned) {
  padding-left: 10cqw !important;
}

body.SpicySidebarLyrics__Active
  #SpicyLyricsPage.SpicyRenderer
  .LyricsContainer
  .LyricsContent:not(:has(.OppositeAligned))
  .line {
  padding-right: 2cqw !important;
}

body.SpicySidebarLyrics__Active
  #SpicyLyricsPage.SpicyRenderer
  .LyricsContainer
  .LyricsContent:not(:has(.OppositeAligned))
  .line.rtl {
  padding-left: 2cqw !important;
}

/* #SpicyLyricsPage.SpicyRenderer .LyricsContainer .LyricsContent .line:not(.Active):not(.musical-line) .word,
#SpicyLyricsPage.SpicyRenderer .LyricsContainer .LyricsContent .line:not(.Active):not(.musical-line) .letter,
#SpicyLyricsPage.SpicyRenderer .LyricsContainer .LyricsContent .line:not(.Active):not(.musical-line) .letterGroup {
  transition: text-shadow .2s linear !important;
} */

#SpicyLyricsPage.SpicyRenderer .LyricsContainer .LyricsContent .line.bg-line,
#SpicyLyricsPage.SpicyRenderer .LyricsContainer .LyricsContent .line.bg-line .word,
#SpicyLyricsPage.SpicyRenderer .LyricsContainer .LyricsContent .line.bg-line .letterGroup,
#SpicyLyricsPage.SpicyRenderer .LyricsContainer .LyricsContent .line.bg-line .letterGroup .letter {
  --font-size: calc(var(--DefaultLyricsSize) * 0.75);
  font-size: var(--font-size) !important;
  font-weight: 600 !important;
}

#SpicyLyricsPage.SpicyRenderer .LyricsContainer .LyricsContent .Credits {
  --font-size: calc(var(--DefaultLyricsSize) * 0.47);
  font-weight: 600 !important;
  font-size: var(--font-size) !important;
  opacity: 0.6;
  margin: 1cqw 0 0 !important;
  scale: 1;
  color: white;
}

#SpicyLyricsPage.SpicyRenderer .LyricsContainer .LyricsContent .SongInfo .song-info-profile-section {
  font-weight: 700;
  opacity: 0.55;
  transition: opacity 0.21s;
  text-decoration: underline;
  cursor: pointer;
}

#SpicyLyricsPage.SpicyRenderer .LyricsContainer .LyricsContent .SongInfo .song-info-profile-section:hover {
  opacity: 1;
}body { background-color: #eeeeee; padding: 0; margin: 5px; overflow-y: scroll; }

#HTMLReporter { font-size: 11px; font-family: Monaco, "Lucida Console", monospace; line-height: 14px; color: #333333; }
#HTMLReporter a { text-decoration: none; }
#HTMLReporter a:hover { text-decoration: underline; }
#HTMLReporter p,


	Out:             Out,
		Bars:            make([]*Bar, 0),
		RefreshInterval: RefreshInterval,

		tdone: make(chan bool),
		lw:    lw,
		mtx:   &sync.RWMutex{},
	}
}

// AddBar creates a new progress bar and adds it to the default progress container
func AddBar(total int) *Bar {
	return defaultProgress.AddBar(total)
}

// Start starts the rendering the progress of progress bars using the DefaultProgress. It listens for updates using `bar.Set(n)` and new bars when added using `AddBar`
func Start() {
	defaultProgress.Start()
}

// Stop stops listening
func Stop() {
	defaultProgress.Stop()
}

// Listen listens for updates and renders the progress bars
func Listen() {
	defaultProgress.Listen()
}

func (p *Progress) SetOut(o io.Writer) {
	p.mtx.Lock()
	defer p.mtx.Unlock()

	p.Out = o
	p.lw.Out = o
}

func (p *Progress) SetRefreshInterval(interval time.Duration) {
	p.mtx.Lock()
	defer p.mtx.Unlock()
	p.RefreshInterval = interval
}

// AddBar creates a new progress bar and adds to the container
func (p *Progress) AddBar(total int) *Bar {
	p.mtx.Lock()
	defer p.mtx.Unlock()

	bar := NewBar(total)
	bar.Width = p.Width
	p.Bars = append(p.Bars, bar)
	return bar
}

// Listen listens for updates and renders the progress bars
func (p *Progress) Listen() {
	for {

		p.mtx.Lock()
		interval := p.RefreshInterval
		p.mtx.Unlock()

		select {
		case <-time.After(interval):
			p.print()
		case <-p.tdone:
			p.print()
			close(p.tdone)
			return
		}
	}
}

func (p *Progress) print() {
	p.mtx.Lock()
	defer p.mtx.Unlock()
	for _, bar := range p.Bars {
		fmt.Fprintln(p.lw, bar.String())
	}
	p.lw.Flush()
}

// Start starts the rendering the progress of progress bars. It listens for updates using `bar.Set(n)` and new bars when added using `AddBar`
func (p *Progress) Start() {
	go p.Listen()
}

// Stop stops listening
func (p *Progress) Stop() {
	p.tdone <- true
	<-p.tdone
}

// Bypass returns a writer which allows non-buffered data to be written to the underlying output
func (p *Progress) Bypass() io.Writer {
	return p.lw.Bypass()
}
package generator

import (
	"bytes"
	"errors"
	"os"
	"path/filepath"
	"regexp"
	"strings"
	"testing"

	"github.com/stretchr/testify/assert"
	"github.com/stretchr/testify/require"

	"github.com/go-openapi/analysis"
	"github.com/go-openapi/loads"
	"github.com/go-openapi/runtime"
	"github.com/go-openapi/swag"
)

const invalidSpecExample = "../fixtures/bugs/825/swagger.yml"

func testAppGenerator(t testing.TB, specPath, name string) (*appGenerator, error) {
	specDoc, err := loads.Spec(specPath)
	require.NoError(t, err)
	analyzed := analysis.New(specDoc.Spec())

	models, err := gatherModels(specDoc, nil)
	require.NoError(t, err)

	operations := gatherOperations(analyzed, nil)
	if len(operations) == 0 {
		return nil, errors.New("no operations were selected")
	}

	opts := testGenOpts()
	opts.Spec = specPath
	apiPackage :=


n    bytemeB[4] = int(floor(value / 8.));\\n    value -= float(bytemeB[4] * 8);\\n    bytemeB[5] = int(floor(value / 4.));\\n    value -= float(bytemeB[5] * 4);\\n    bytemeB[6] = int(floor(value / 2.));\\n    value -= float(bytemeB[6] * 2);\\n    bytemeB[7] = int(floor(value));\\n\\n    value = a * 255.;\\n    int bytemeA[8];\\n    bytemeA[0] = int(floor(value / 128.));\\n    value -= float(bytemeA[0] * 128);\\n    bytemeA[1] = int(floor(value / 64.));\\n    value -= float(bytemeA[1] * 64);\\n    bytemeA[2] = int(floor(value / 32.));\\n    value -= float(bytemeA[2] * 32);\\n    bytemeA[3] = int(floor(value / 16.));\\n    value -= float(bytemeA[3] * 16);\\n    bytemeA[4] = int(floor(value / 8.));\\n    value -= float(bytemeA[4] * 8);\\n    bytemeA[5] = int(floor(value / 4.));\\n    value -= float(bytemeA[5] * 4);\\n    bytemeA[6] = int(floor(value / 2.));\\n    value -= float(bytemeA[6] * 2);\\n    bytemeA[7] = int(floor(value));\\n\\n    // compute float32 value from bit arrays\\n    // sign\\n    int issigned = 1 - 2 * bytemeR[0];\\n\\n    // exponent\\n    int exponent = 0;\\n\\n    exponent += bytemeR[1] * int(pow(2., 7.));\\n    exponent += bytemeR[2] * int(pow(2., 6.));\\n    exponent += bytemeR[3] * int(pow(2., 5.));\\n    exponent += bytemeR[4] * int(pow(2., 4.));\\n    exponent += bytemeR[5] * int(pow(2., 3.));\\n    exponent += bytemeR[6] * int(pow(2., 2.));\\n    exponent += bytemeR[7] * int(pow(2., 1.));\\n    exponent += bytemeG[0];\\n\\n    // fraction\\n    float fraction = 0.;\\n\\n    fraction = float(bytemeG[1]) * pow(2., -1.);\\n    fraction += float(bytemeG[2]) * pow(2., -2.);\\n    fraction += float(bytemeG[3]) * pow(2., -3.);\\n    fraction += float(bytemeG[4]) * pow(2., -4.);\\n    fraction += float(bytemeG[5]) * pow(2., -5.);\\n    fraction += float(bytemeG[6]) * pow(2., -6.);\\n    fraction += float(bytemeG[7]) * pow(2., -7.);\\n\\n    fraction += float(bytemeB[0]) * pow(2., -8.);\\n    fraction += float(bytemeB[1]) * pow(2., -9.);\\n    fraction += float(bytemeB[2]) * pow(2., -10.);\\n    fraction += float(bytemeB[3]) * pow(2., -11.);\\n    fraction += float(bytemeB[4]) * pow(2., -12.);\\n    fraction += float(bytemeB[5]) * pow(2., -13.);\\n    fraction += float(bytemeB[6]) * pow(2., -14.);\\n    fraction += float(bytemeB[7]) * pow(2., -15.);\\n\\n    fraction += float(bytemeA[0]) *


#pragma once

#include "go_unit.h"

namespace minizero::env::go {

class GoBlock {
public:
    GoBlock(int id)
        : id_(id)
    {
        reset();
    }

    inline void reset()
    {
        num_grid_ = 0;
        num_liberty_ = 0;
        player_ = Player::kPlayerNone;
        hash_key_ = 0;
        grid_bitboard_.reset();
        liberty_bitboard_.reset();
        neighbor_area_id_bitboard_.reset();
    }

    inline void combineWithBlock(GoBlock* block)
    {
        assert(block);
        addHashKey(block->getHashKey());
        grid_bitboard_ |= block->getGridBitboard();
        num_grid_ += block->getNumGrid();
        liberty_bitboard_ |= block->getLibertyBitboard();
        num_liberty_ = liberty_bitboard_.count();
        neighbor_area_id_bitboard_ |= block->getNeighborAreaIDBitboard();
    }

    // setter
    inline void setPlayer(Player p) { player_ = p; }
    inline void addHashKey(GoHashKey key) { hash_key_ ^= key; }
    inline void addGrid(int pos)
    {
        assert(!grid_bitboard_.test(pos));
        ++num_grid_;
        grid_bitboard_.set(pos);
    }
    inline void addLiberty(int pos)
    {
        if (liberty_bitboard_.test(pos)) { return; }
        liberty_bitboard_.set(pos);
        ++num_liberty_;
    }
    inline void removeLiberty(int pos)
    {
        if (!liberty_bitboard_.test(pos)) { return; }
        liberty_bitboard_.reset(pos);
        --num_liberty_;
    }
    inline void addNeighborAreaIDBitboard(int area_id) { neighbor_area_id_bitboard_.set(area_id); }
    inline void removeNeighborAreaIDBitboard(int area_id) { neighbor_area_id_bitboard_.reset(area_id); }

    // getter
    inline int getID() const { return id_; }
    inline int getNumGrid() const { return num_grid_; }
    inline int getNumLiberty() const { return num_liberty_; }
    inline Player getPlayer() const { return player_; }
    inline GoHashKey getHashKey() const { return hash_key_; }
    inline GoBitboard& getGridBitboard() { return grid_bitboard_; }
    inline const GoBitboard& getGridBitboard() const { return grid_bitboard_; }
    inline GoBitboard& getLibertyBitboard() { return liberty_bitboard_; }
    inline const GoBitboard& getLibertyBitboard() const { return liberty_bitboard_; }
    inline GoBitboard& getNeighborAreaIDBitboard() { return neighbor_area_id_bitboard_; }
    inline const GoBitboard& getNeighborAreaIDBitboard() const { return neighbor_area_id_bitboard_; }

private:
    int id_;
    int num_grid_;
    int num_liberty_;
    Player player_;
    GoHashKey hash_key_;
    GoBitboard grid_bitboard_;
    GoBitboard liberty_bitboard_;
    GoBitboard neighbor_area_id_bitboard_;
};

} // namespace minizero::env::go


ptr + size;
		buffer_offset += size;
	}
	return 0;
}

int binder_alloc_copy_to_buffer(struct binder_alloc *alloc,
				struct binder_buffer *buffer,
				binder_size_t buffer_offset,
				void *src,
				size_t bytes)
{
	return binder_alloc_do_buffer_copy(alloc, true, buffer, buffer_offset,
					   src, bytes);
}

int binder_alloc_copy_from_buffer(struct binder_alloc *alloc,
				  void *dest,
				  struct binder_buffer *buffer,
				  binder_size_t buffer_offset,
				  size_t bytes)
{
	return binder_alloc_do_buffer_copy(alloc, false, buffer, buffer_offset,
					   dest, bytes);
}


 u16>::empty().load_be::<u8>(); }

#[test]
#[should_panic]
fn bsm16_lb16_empty() { BitSlice::<Msb0, u16>::empty().load_be::<u16>(); }

#[test]
#[should_panic]
fn bsm16_lb32_empty() { BitSlice::<Msb0, u16>::empty().load_be::<u32>(); }

#[cfg(target_pointer_width = "64")]
#[test]
#[should_panic]
fn bsm16_lb64_empty() { BitSlice::<Msb0, u16>::empty().load_be::<u64>(); }

#[test]
#[should_panic]
fn bsm32_ll08_empty() { BitSlice::<Msb0, u32>::empty().load_le::<u8>(); }

#[test]
#[should_panic]
fn bsm32_ll16_empty() { BitSlice::<Msb0, u32>::empty().load_le::<u16>(); }

#[test]
#[should_panic]
fn bsm32_ll32_empty() { BitSlice::<Msb0, u32>::empty().load_le::<u32>(); }

#[cfg(target_pointer_width = "64")]
#[test]
#[should_panic]
fn bsm32_ll64_empty() { BitSlice::<Msb0, u32>::empty().load_le::<u64>(); }

#[test]
#[should_panic]
fn bsm32_lb08_empty() { BitSlice::<Msb0, u32>::empty().load_be::<u8>(); }

#[test]
#[should_panic]
fn bsm32_lb16_empty() { BitSlice::<Msb0, u32>::empty().load_be::<u16>(); }

#[test]
#[should_panic]
fn bsm32_lb32_empty() { BitSlice::<Msb0, u32>::empty().load_be::<u32>(); }

#[cfg(target_pointer_width = "64")]
#[test]
#[should_panic]
fn bsm32_lb64_empty() { BitSlice::<Msb0, u32>::empty().load_be::<u64>(); }

#[cfg(target_pointer_width = "64")]
#[test]
#[should_panic]
fn bsm64_ll08_empty() { BitSlice::<Msb0, u64>::empty().load_le::<u8>(); }

#[cfg(target_pointer_width = "64")]
#[test]
#[should_panic]
fn bsm64_ll16_empty() { BitSlice::<Msb0, u64>::empty().load_le::<u16>(); }

#[cfg(target_pointer_width = "64")]
#[test]
#[should_panic]
fn bsm64_ll32_empty() { BitSlice::<Msb0, u64>::empty().load_le::<u32>(); }

#[cfg(target_pointer_width = "64")]
#[test]
#[should_panic]
fn bsm64_ll64_empty() { BitSlice::<Msb0, u64>::empty().load_le::<u64>(); }

#[cfg(target_pointer_width = "64")]
#[test]
#[should_panic]
fn bsm64_lb08_empty() { BitSlice::<Msb0, u64>::empty().load_be::<u8>(); }

#[cfg(target_pointer_width = "64")]
#[test]
#[should_panic]
fn bsm64_lb16_empty() { BitSlice::<Msb0, u64>::empty().load_be::<u16>(); }

#[cfg(targe


^
  // [analyzer] COMPILE_TIME_ERROR.NEW_WITH_UNDEFINED_CONSTRUCTOR
  // [cfe] Couldn't find constructor 'NoUnnamed.new'.
}
// Copyright (c) 2011, the Dart project authors.  Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
// Dart test program for redirection constructors.

import "package:expect/expect.dart";

class A {
  var x;
  A(this.x) {}
  A.named(x, int y) : this(x + y);
  A.named2(int x, int y, z) : this.named(staticFun(x, y), z);
  //                                     ^^^^^^^^^
  // [analyzer] COMPILE_TIME_ERROR.IMPLICIT_THIS_REFERENCE_IN_INITIALIZER
  // [cfe] Can't access 'this' in a field initializer to read 'staticFun'.

  // The following is a bit tricky. It is a compile-time error to
  // refer to this (implicitly or explicitly) from an initializer.
  // When we remove the line with moreStaticFun, staticFun is really a
  // static function and it is legal to call it. This is what will
  // happen in the /none version of this test. However, in /01,
  // staticFun isn't really a static function and should cause a
  // compile-time error.
  static moreStaticFun() {}
  int staticFun(int v1, int v2) {
    return v1 * v2;
  }
}

class B extends A {
  B(y) : super(y + 1) {}
  B.named(y) : super.named(y, y + 1) {}
}

class C {
  final x;
  const C(this.x);
  const C.named(x, int y) : this(x + y);
}

class D extends C {
  const D(y) : super(y + 1);
  const D.named(y) : super.named(y, y + 1);
}

class ConstructorRedirectTest {
  static testMain() {
    var a = new A(499);
    Expect.equals(499, a.x);
    a = new A.named(349, 499);
    Expect.equals(349 + 499, a.x);
    a = new A.named2(11, 42, 99);
    Expect.equals(11 * 42 + 99, a.x);

    var b = new B(498);
    Expect.equals(499, b.x);
    b = new B.named(249);
    Expect.equals(499, b.x);

    C c = const C(499);
    Expect.equals(499, c.x);
    c = const C.named(249, 250);
    Expect.equals(499, c.x);

    D d = const D(498);
    Expect.equals(499, d.x);
    d = const D.named(249);
    Expect.equals(499, d.x);
  }
}

main() {
  ConstructorRedirectTest.testMain();
}
// Copyright (c) 2012, the Dart project authors.  Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

import "package:expect/expect.dart";

// Test is-test of typedefs with optional and named parameters.

typedef int Func1(int a);
typedef int Func2(int a, [int b]);
typedef int Func3(int a, [int b, int c]);
typedef int Func4([int a, int b, int c]);
typedef int Func5(int a, {int b});
typedef int Func6(int a, {int b, int c});
typedef int Func7({int a, int b, int c});

void main() {
  int func1(int i) => -1;
  Expect.isTrue(func1 is


  }
    // 功能：从前面有序插入
    // 说明：如果已经存在key, 就更新变量
    //       如果key节点不存在，就从前端插入, 你可以将map理解成一个list
    public void push_front(_TyKey key, _TyValue value)
    {

    }
    // 功能：从指定位置后面插入
    public void insert_back(_TyKey where, _TyKey key, _TyValue value)
    {

    }
    // 功能：从指定位置前面插入
    public void insert_front(_TyKey where, _TyKey key, _TyValue value)
    {

    }
    // 功能：删除指定的节点
    public void remove(_TyKey key)
    {

    }
    // 功能：删除所有的节点
    public void RemoveAll()
    {

    }
    // 功能：返回首节点
    public iterator<_TyKey, _TyValue> begin()
    {
        return m_it;
    }
    // 功能：查找指定KEY值的节点
    public iterator<_TyKey, _TyValue> find(_TyKey key)
    {
        return m_it;
    }
    // 功能：测试是不是存在指定Key值的节点
    public bool ContainKey(_TyKey key)
    {
        return true;
    }
    // 功能：预分配hash数组，用于性能优化
    // 说明：如果你大致知道总的节点的数量，预先设置一下总的节点数量，有利于优化插入的性能
    public void Reserve(int nSize)
    {

    }
    // 功能：插入完成的优化
    // 参数：nMaxSize - hash数组的最大长度（内存限制，以免优化后内存大副增加)
    // 说明：调用这个接口可以优化hash数组，减少冲突，提升查询性能，对于节点数量巨大且查询非常频繁的map来说，是很有效的
    public void Optimize(int nMaxSize)
    {

    }

	// 功能：串连两个map
	public void operator += (map<_TyKey, _TyValue> other){}

	// 功能：克隆一个新的map
	public map<_TyKey, _TyValue> Clone(){return null;}
};


 - | `OpenR1-Math` | Open R1: A fully open reproduction of DeepSeek-R1 | [![Blog](https://img.shields.io/badge/Blog-1F4E79?style=for-the-badge)](https://huggingface.co/blog/open-r1) | [![GitHub Stars](https://img.shields.io/github/stars/huggingface/open-r1?style=for-the-badge&logo=github&label=GitHub&color=black)](https://github.com/huggingface/open-r1) |
| - | `DeepScaleR` | DeepScaleR: Surpassing O1-Preview with a 1.5B Model by Scaling RL | [![Paper](https://img.shields.io/badge/Paper-6772E5?style=for-the-badge)](https://pretty-radio-b75.notion.site/DeepScaleR-Surpassing-O1-Preview-with-a-1-5B-Model-by-Scaling-RL-19681902c1468005bed8ca303013a4e2) | - |

#### Static Corpus (Agent)

| Date | Name | Title | Paper | Github |
|:-:|:-:|:-|:-:|:-:|
| 2025-08 | `ASearcher` | Beyond Ten Turns: Unlocking Long-Horizon Agentic Search with Large-Scale Asynchronous RL | [![Paper](https://img.shields.io/badge/paper-A42C25?style=for-the-badge&logo=arxiv&logoColor=white)](https://arxiv.org/abs/2508.07976) | - |
| 2025-07 | `WebShaper` | WebShaper: Agentically Data Synthesizing via Information-Seeking Formalization | [![Paper](https://img.shields.io/badge/paper-A42C25?style=for-the-badge&logo=arxiv&logoColor=white)](https://arxiv.org/abs/2507.15061) | - |
| 2025-05 | `ZeroSearch` | ZeroSearch: Incentivize the Search Capability of LLMs without Searching | [![Paper](https://img.shields.io/badge/paper-A42C25?style=for-the-badge&logo=arxiv&logoColor=white)](https://arxiv.org/abs/2505.04588) | [![GitHub Stars](https://img.shields.io/github/stars/Alibaba-NLP/ZeroSearch?style=for-the-badge&logo=github&label=GitHub&color=black)](https://github.com/Alibaba-NLP/ZeroSearch) |
| 2025-04 | `ToolRL` | ToolRL: Reward is All Tool Learning Needs | [![Paper](https://img.shields.io/badge/paper-A42C25?style=for-the-badge&logo=arxiv&logoColor=white)](https://arxiv.org/abs/2504.13958) | [![GitHub Stars](https://img.shields.io/github/stars/qiancheng0/ToolRL?style=for-the-badge&logo=github&label=GitHub&color=black)](https://github.com/qiancheng0/ToolRL) |
| 2025-03 | `Search-R1` | Search-R1: Training LLMs to Reason and Leverage Search Engines with Reinforcement Learning | [![Paper](https://img.shields.io/badge/paper-A42C25?style=for-the-badge&logo=arxiv&logoColor=white)](https://arxiv.org/abs/2503.09516) | [![GitHub Stars](https://img.shields.io/github/stars/PeterGriffinJin/Search-R1?style=for-the-badge&logo=github&label=GitHub&color=black)](https://github.com/PeterGriffinJin/Search-R1) |
| 2025-03 | `ToRL` | ToRL: Scaling Tool-Integrated RL | [![Paper](https://img.shields.io/badge/paper-A42C25?style=for


 = "".toByteArray()
    ): ByteArray {
        val ivKey = if (iv.isEmpty()) defaultIvGen.next() else iv
        val c = Cipher.getInstance("AES/CBC/PKCS5Padding")
        val skSpec = SecretKeySpec(secretKey, "AES")
        val ivSpec = IvParameterSpec(ivKey)
        c.init(Cipher.DECRYPT_MODE, skSpec, ivSpec)
        return c.doFinal(data)
    }

    private fun isEncrypted(m3u8Data: String): Boolean {
        val st = ENCRYPTION_DETECTION_REGEX.find(m3u8Data)
        return st != null && (st.value.isNotEmpty() || st.destructured.component1() != "NONE")
    }

    data class M3u8Stream(
        val streamUrl: String,
        val quality: Int? = null,
        val headers: Map<String, String> = mapOf()
    )

    private fun selectBest(qualities: List<M3u8Stream>): M3u8Stream? {
        val result = qualities.sortedBy {
            if (it.quality != null && it.quality <= 1080) it.quality else 0
        }.filter {
            listOf("m3u", "m3u8").contains(absoluteExtensionDetermination(it.streamUrl))
        }
        return result.lastOrNull()
    }

    private fun getParentLink(uri: String): String {
        val split = uri.split("/").toMutableList()
        split.removeLast()
        return split.joinToString("/")
    }

    private fun isNotCompleteUrl(url: String): Boolean {
        return !url.contains("https://") && !url.contains("http://")
    }

    suspend fun m3u8Generation(m3u8: M3u8Stream, returnThis: Boolean?): List<M3u8Stream> {
        val list = mutableListOf<M3u8Stream>()

        val m3u8Parent = getParentLink(m3u8.streamUrl)
        val response = app.get(m3u8.streamUrl, headers = m3u8.headers, verify = false).text

        var hasAnyContent = false
        for (match in QUALITY_REGEX.findAll(response)) {
            hasAnyContent = true
            var (quality, m3u8Link, m3u8Link2) = match.destructured
            if (m3u8Link.isEmpty()) m3u8Link = m3u8Link2
            if (absoluteExtensionDetermination(m3u8Link) == "m3u8") {
                if (isNotCompleteUrl(m3u8Link)) {
                    m3u8Link = "$m3u8Parent/$m3u8Link"
                }
                if (quality.isEmpty()) {
                    println(m3u8.streamUrl)
                }
                list += m3u8Generation(
                    M3u8Stream(
                        m3u8Link,
                        quality.toIntOrNull(),
                        m3u8.headers
                    ), false
                )

            }
            list += M3u8Stream(
                m3u8Link,
                quality.toIntOrNull(),
                m3u8.headers
            )

        }
        if (returnThis ?: !hasAnyContent) {
            list += M3u8Stream(
                m3u8.streamUrl,
                Qualities.Unknown.value,
                m3u8.headers
            )
        }

        return list
    }

    data class HlsDownloadData(
        val bytes: ByteArray,
        val currentIndex: Int,
        val totalTs: Int,
        val errored: Boolean = false
    )

    suspend fun hlsYield(qualities: List<M3u8Stream>, startIndex: Int = 0): Iterator<HlsDownloadData> {
        if (qualities.isEmpty()) return listOf(
            HlsDownloadData(
                byteArrayOf(),
                1,
                1,
                true
            )
        ).iterator()

        var selected = selectBest(qualities)
        if (selected == null) {
            selected = qualities[0]
        }
        val headers = selected.headers

        val streams = qualities.map { m3u8Generation(it, false) }.flatten()
        //val sslVerification = if (headers.containsKey("ssl_verification")) headers["ssl_verification"].toBoolean() else true

        val secondSelection = selectBest(streams.ifEmpty { listOf(selected) })


/*
 * SonarAnalyzer for .NET
 * Copyright (C) 2014-2025 SonarSource SA
 * mailto:info AT sonarsource DOT com
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the Sonar Source-Available License Version 1, as published by SonarSource SA.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the Sonar Source-Available License for more details.
 *
 * You should have received a copy of the Sonar Source-Available License
 * along with this program; if not, see https://sonarsource.com/license/ssal/
 */

using Microsoft.CodeAnalysis.CodeActions;
using Microsoft.CodeAnalysis.CodeFixes;
using SonarAnalyzer.TestFramework.Verification.IssueValidation;

namespace SonarAnalyzer.TestFramework.Verification;

internal class CodeFixVerifier
{
    private const string FixedMessage = "Fixed";

    private readonly DiagnosticAnalyzer analyzer;
    private readonly CodeFixProvider codeFix;
    private readonly Document originalDocument;
    private readonly string codeFixTitle;

    public CodeFixVerifier(DiagnosticAnalyzer analyzer, CodeFixProvider codeFix, Document originalDocument, string codeFixTitle)
    {
        this.analyzer = analyzer;
        this.codeFix = codeFix;
        this.originalDocument = originalDocument;
        this.codeFixTitle = codeFixTitle;
    }

    public void VerifyWhileDocumentChanges(ParseOptions parseOptions, string pathToExpected)
    {
        var state = new State(analyzer, originalDocument, parseOptions);
        var codeFixExecuted = false;
        string codeBeforeFix;
        state.Diagnostics.Should().NotBeEmpty();
        do
        {
            codeBeforeFix = state.ActualCode;
            if (state.Diagnostics
                    .Where(x => codeFix.FixableDiagnosticIds.Contains(x.Id))    // Analyzer can also raise other Diagnostics that we can't fix
                    .SelectMany(x => ActionToApply(codeFix, state.Document, x))
                    .FirstOrDefault() is { } actionToApply)
            {
                state = new State(analyzer, ApplyCodeFix(state.Document, actionToApply), parseOptions);
                codeFixExecuted = true;
            }
        }
        while (codeBeforeFix != state.ActualCode);

        codeFixExecuted.Should().BeTrue();
        state.AssertExpected(pathToExpected, nameof(VerifyWhileDocumentChanges) + " updates the document until all issues are fixed, even if the fix itself creates a new issue again");
    }

    public void VerifyFixAllProvider(FixAllProvider fixAllProvider, ParseOptions parseOptions, string pathToExpected)
    {
        var state = new State(analyzer, originalDocument, parseOptions);
        state.Diagnostics.Should().NotBeEmpty();

        var fixAllDiagnosticProvider = new FixAllDiagnosticProvider(state.Diagnostics);
        var codeActionEquivalenceKey = codeFixTitle ?? CodeFixTitle(codeFix, state);    // We need to find the title of the single action to use
        var fixAllContext = new FixAllContext(state.Document, codeFix, FixAllScope.Document, codeActionEquivalenceKey, codeFix.FixableDiagnosticIds, fixAllDiagnosticProvider, default);
        var codeActionToExecute = fixAllProvider.GetFixAsync(fixAllContext).Result;
        codeActionToExecute.Should().NotBeNull();

        new State(analyzer, ApplyCodeFix(state.Document, codeActionToExecute), parseOptions)
            .AssertExpected(pathToExpected, $"{nameof(VerifyFixAllP


", runnerID).
			Err(err).
			Msg("CRITICAL: failed to get runner status for memory calculation - cannot proceed without real data")
		return 0, 0, 0, fmt.Errorf("runner %s status unavailable: %w", runnerID, err)
	}

	totalMemory := runnerStatus.TotalMemory
	if totalMemory == 0 {
		log.Error().
			Str("runner_id", runnerID).
			Msg("CRITICAL: runner reports zero total memory - cannot proceed without real memory data")
		return 0, 0, 0, fmt.Errorf("runner %s reports zero total memory", runnerID)
	}

	// Calculate allocated memory from all models using LOCAL state for consistency
	// Memory is allocated to slots regardless of whether they're currently active
	allocatedMemory := uint64(0)
	skippedSlots := 0
	var rangeErr error
	s.slots.Range(func(_ uuid.UUID, slot *Slot) bool {
		// Only count slots on this specific runner
		if slot.RunnerID == runnerID {
			modelName := slot.InitialWork().ModelName().String()

			// NEW ARCHITECTURE: Require configured models - no fallbacks
			if slot.InitialWork().model == nil || !slot.InitialWork().model.IsAllocationConfigured() {
				rangeErr = fmt.Errorf("slot %s has unconfigured model %s - all models must use NewModelForGPUAllocation",
					slot.ID.String(), modelName)
				log.Error().
					Str("runner_id", runnerID).
					Str("slot_id", slot.ID.String()).
					Str("model_name", modelName).
					Err(rangeErr).
					Msg("CRITICAL: Unconfigured model in calculateRunnerMemory")
				return false // Stop iteration
			}

			// Use configured model memory (authoritative, never fails)
			modelMemory := slot.InitialWork().model.GetMemoryForAllocation()
			log.Debug().
				Str("runner_id", runnerID).
				Str("model_name", modelName).
				Uint64("configured_memory_gb", modelMemory/(1024*1024*1024)).
				Int("configured_gpu_count", slot.InitialWork().model.GetGPUCount()).
				Msg("Using configured model memory (no fallbacks)")
			allocatedMemory += modelMemory
		}
		return true
	})

	if rangeErr != nil {
		return 0, 0, 0, rangeErr
	}

	if skippedSlots > 0 {
		log.Warn().
			Str("runner_id", runnerID).
			Int("skipped_slots", skippedSlots).
			Msg("WARNING: Some slots were skipped in memory calculation due to missing GGUF data for Ollama models")
	}

	var freeMemory uint64
	if allocatedMemory < totalMemory {
		freeMemory = totalMemory - allocatedMemory
	} else {
		freeMemory = 0 // Over-allocated
	}

	return totalMemory, allocatedMemory, freeMemory, nil
}

// getGGUFBasedMemoryEstimate attempts to get GGUF-based memory estimate for Ollama models
func (s *Scheduler) getGGUFBasedMemoryEstimate(modelID string) (uint64, error) {
	log.Debug().
		Str("🔧 MEMORY_DEBUG", "gguf_estimation_entry").
		Str("model_id", modelID).
		Msg("🔧 MEMORY_DEBUG: Starting GGUF-based memory estimation")

	// Check if this is an Ollama model first
	models, err := s.controller.store.ListModels(context.Background(), &store.ListModelsQuery{})
	if err != nil {
		log.Error().
			Str("🔧 MEMORY_DEBUG", "gguf_store_error").
			Str("model_id", modelID).
			Err(err).
			Msg("🔧 MEMORY_DEBUG: Failed to list models from store for GGUF estimation")
		return 0, fmt.Errorf("failed to list models from store: %w", err)
	}

	var targetModel *types.Mo


PoolEntry *__cdecl DB_AllocXAssetEntry(XAssetType type, unsigned int zoneIndex)
{
  XAssetEntryPoolEntry *freeHead;

  freeHead = g_freeAssetEntryHead;
  if ( !g_freeAssetEntryHead )
  {
    Com_Error(ERR_DROP, "Could not allocate asset - increase XASSET_ENTRY_POOL_SIZE");
  }
  if ( ++XAssetEntryHighCount > XAssetEntryHighWaterMark )
  {
    XAssetEntryHighWaterMark = XAssetEntryHighCount;
  }
  g_freeAssetEntryHead = freeHead->next;
  freeHead->entry.asset.type = type;
  freeHead->entry.asset.header = DB_AllocXAssetHeader(type);
  freeHead->entry.zoneIndex = zoneIndex;
  freeHead->entry.inuse = 0;
  freeHead->entry.nextHash = 0;
  freeHead->entry.nextOverride = 0;
  return freeHead;
}

extern "C"
{

void __cdecl Load_WeaponDefAsset(struct WeaponDef **weapon)
{
    XAssetHeader hweapon;
    hweapon.weapon = *weapon;
    *weapon = DB_AddXAsset(ASSET_TYPE_WEAPON, hweapon).weapon;

}

XAssetEntryPoolEntry *__cdecl DB_FindXAssetEntry(XAssetType type, const char *name)
{
  unsigned int assetEntryIndex;
  XAssetEntryPoolEntry *assetEntry;

  for ( assetEntryIndex = db_hashTable[DB_HashForName(name, type) % ARRAY_COUNT(db_hashTable)]; assetEntryIndex; assetEntryIndex = assetEntry->entry.nextHash )
  {
    assetEntry = &g_assetEntryPool[assetEntryIndex];
    if ( g_assetEntryPool[assetEntryIndex].entry.asset.type == type )
    {
      const char* assetname = DB_GetXAssetName(&assetEntry->entry.asset);
      if ( !Q_stricmp(assetname, name) )
      {
        return &g_assetEntryPool[assetEntryIndex];
      }
    }
  }
  return NULL;
}

bool __cdecl DB_GetInitializing()
{
  return g_initializing;
}

void __cdecl DB_LogMissingAsset(XAssetType type, const char *name)
{
  char msg[1024];
  FILE* g_missingAssetFile;

  switch ( type )
  {
    case ASSET_TYPE_SOUND:
    case ASSET_TYPE_MENU:
    case ASSET_TYPE_LOCALIZE_ENTRY:
    case ASSET_TYPE_SNDDRIVER_GLOBALS:
//    case ASSET_TYPE_XGLOBALS:
      return;
    case ASSET_TYPE_WEAPON:
      Com_sprintf(msg, sizeof(msg), "%s,mp/%s\n", g_assetNames[type], name);
      break;
    default:
      Com_sprintf(msg, sizeof(msg), "%s,%s\n", g_assetNames[type], name);
      break;
  }

  g_missingAssetFile = fopen("missingasset.csv", "a");
  if ( g_missingAssetFile )
  {
    fwrite(msg, 0, strlen(msg), g_missingAssetFile);
    fclose(g_missingAssetFile);
    g_missingAssetFile = NULL;
  }
}

XAssetEntryPoolEntry *__cdecl DB_CreateDummyEntry(XAssetType type, const char *name)
{
  unsigned int nhash;
  XAssetEntryPoolEntry *newEntry;

  ++g_defaultAssetCount;
  newEntry = DB_AllocXAssetEntry(type, 0);
  nhash = DB_HashForName(name, type);
  newEntry->entry.nextHash  = db_hashTable[nhash % ARRAY_COUNT(db_hashTable)];
  db_hashTable[nhash % ARRAY_COUNT(db_hashTable)] = newEntry - g_assetEntryPool;

  newEnt


local previewItemClass

local function validateOutfitList( previewPanel, ignorePreview )
	previewPanel.outfits = {}

	for _, item in pairs( LocalPlayer().PS2_EquippedItems ) do
		local isHat = instanceOf( Pointshop2.GetItemClassByName( "base_hat" ), item )
		if isHat and not item:NoPreview() then
			local outfit, id = item:getOutfitForModel( previewPanel.Entity:GetModel() )
			previewPanel.outfits[id] = outfit
		end
	end
	if previewItemClass and not ignorePreview then
		local outfit, id = previewItemClass.getOutfitForModel( previewPanel.Entity:GetModel( ) )
		previewPanel.outfits[id] = outfit
	end

	previewPanel.Entity.attachedOutfits = previewPanel.Entity.attachedOutfits or {}

	--Remove outfits not valid anymore
	for id, outfit in pairs( previewPanel.Entity.attachedOutfits ) do
		if not previewPanel.outfits[id] then
			print( "detaching", id )
			previewPanel.Entity:RemovePACPart( outfit )
			previewPanel.Entity.attachedOutfits[id] = nil
		end
	end

	--Add outfits that are not added yet
	for id, outfit in pairs( previewPanel.outfits ) do
		if not previewPanel.Entity.attachedOutfits[id] then
			previewPanel.Entity:AttachPACPart( outfit )
			timer.Simple(0, function( )
				if not IsValid(previewPanel.Entity) then
					return
				end

				if not previewPanel.Entity.AttachPACPart then
					previewPanel.Entity.Owner = LocalPlayer()
					pac.SetupENT( previewPanel.Entity, "Owner" ) --why u do dis?
				end
				previewPanel.Entity:AttachPACPart( outfit )
			end )
			previewPanel.Entity.attachedOutfits[id] = outfit
		end
	end
end

hook.Add( "PACItemSelected",


/*-
 * Copyright (c) 1992, 1993
 *	The Regents of the University of California.  All rights reserved.
 * (c) UNIX System Laboratories, Inc.
 * All or some portions of this file are derived from material licensed
 * to the University of California by American Telephone and Telegraph
 * Co. or Unix System Laboratories, Inc. and are reproduced herein with
 * the permission of UNIX System Laboratories, Inc.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 * 3. All advertising materials mentioning features or use of this software
 *    must display the following acknowledgement:
 *	This product includes software developed by the University of
 *	California, Berkeley and its contributors.
 * 4. Neither the name of the University nor the names of its contributors
 *    may be used to endorse or promote products derived from this software
 *    without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 * SUCH DAMAGE.
 *
 *	@(#)varargs.h	8.2 (Berkeley) 3/22/94
 */

#ifndef _VARARGS_H_
#define	_VARARGS_H_

typedef char *va_list;

#define	va_dcl	int va_alist;

#define	va_start(ap) \
	ap = (char *)&va_alist

#ifdef KERNEL
#define	va_arg(ap, type) \
	((type *)(ap += sizeof(type)))[-1]
#else
#define	va_arg(ap, type) \
	((type *)(ap += sizeof(type) == sizeof(int) ? sizeof(type) : \
		sizeof(type) > sizeof(int) ? \
		(-(int)(ap) & (sizeof(type) - 1)) + sizeof(type) : \
		(abort(), 0)))[-1]
#endif

#define	va_end(ap)

#endif /* !_VARARGS_H_ */


/* =========================================================================
 * This file is part of NITRO
 * =========================================================================
 *
 * (C) Copyright 2004 - 2014, MDA Information Systems LLC
 *
 * NITRO is free software; you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation; either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this program; if not, If not,
 * see <http://www.gnu.org/licenses/>.
 *
 */

#ifndef __NITF_DE_SUBHEADER_H__
#define __NITF_DE_SUBHEADER_H__

/*  We get file security and some constants already  */
/*  defined by including this first                  */
#include "nitf/FileHeader.h"

NITF_CXX_GUARD
#define NITF_DE_SZ      2
#define NITF_DESTAG_SZ  25
#define NITF_DESVER_SZ  2
#define NITF_DESCLAS_SZ 1
#define NITF_DESOFLW_SZ 6
#define NITF_DESITEM_SZ 3
#define NITF_DESSHL_SZ  4
#define NITF_DE        filePartType
#define NITF_DESTAG    typeID
#define NITF_DESVER    version
#define NITF_DESCLAS   securityClass
#define NITF_DESOFLW   overflowedHeaderType
#define NITF_DESITEM   dataItemOverflowed
#define NITF_DESSHL    subheaderFieldsLength

typedef struct _nitf_DESubheader
{
    nitf_Field *filePartType;
    nitf_Field *typeID;
    nitf_Field *version;
    nitf_Field *securityClass;
    nitf_FileSecurity *securityGroup;
    nitf_Field *overflowedHeaderType;
    nitf_Field *dataItemOverflowed;
    nitf_Field *subheaderFieldsLength;
    nitf_TRE *subheaderFields;
    uint64_t dataLength;

    nitf_Extensions *userDefinedSection;
}
nitf_DESubheader;

/*!
 *  Construct a new de subheader object.  This object will
 *  be null set for every field.  The object returned will be
 *  a full-fledged subheader, unless there is an error, in which
 *  case NULL will be returned, and the error object that was
 *  passed in will be populated.
 *
 *  \param error In case of error, when this function returns, this
 *  parameter will be populated
 *
 *  \return The de subheader, or NULL on failure.
 */
NITFAPI(nitf_DESubheader *) nitf_DESubheader_construct(nitf_Error * error);

/*!
 *  TODO: Add documentation
 */
NITFAPI(nitf_DESubheader *)
nitf_DESubheader_clone(nitf_DESubheader * source, nitf_Error * error);

/*!
 *  Destroy a de subheader object, and NULL-set the subheader.
 *  A double pointer is make the NULL-set persistant on function
 *  exit.
 *
 *  \param The address of the the de subheader pointer
 */
NITFAPI(void) nitf_DESubheader_destruct(nitf_DESubheader ** subhdr);

NITF_CXX_ENDGUARD

#endif


10h-10zM19 19h10v10H19zm13.5 0h10v10h-10zm-27 13.5h10v10h-10zm13.5 0h10v10H19zm13.5 0h10v10h-10z"/><path fill="currentColor" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" d="M8.5 22h4v4h-4zm27-13.5h4v4h-4z"/></svg>';
  static const String memrise =
      '<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="48" height="48" preserveAspectRatio="xMidYMid meet" viewBox="0 0 48 48"><path fill="currentColor" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" d="M5.5 19.6v20.9a2 2 0 002 2h33a2 2 0 002-2v-33a2 2 0 00-2-2h-33a2 2 0 00-2 2v12.1m27.262 16.886H38.5M32.762 25.01H38.5m-5.738 5.738h3.741m-3.741-5.738v11.476M21.647 21.195h4.841m-4.841-9.681h4.841m-4.841 4.841h3.157m-3.157-4.841v9.681"/><path fill="currentColor" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" d="M9.5 21.185v-9.671l4.841 9.681 4.841-9.667v9.667m9.636-.01v-9.671l4.841 9.681 4.841-9.667v9.667m-29 15.291V25.01h3.757a3.854 3.854 0 010 7.708H9.5m3.757.001 3.757 3.764"/><circle cx="19.972" cy="25.369" r=".75" fill="currentColor"/><path fill="currentColor" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" d="M19.972 28.883v7.603m2.871-1.257a3.21 3.21 0 002.813 1.257h1.7a2.866 2.866 0 002.862-2.869h0a2.866 2.866 0 00-2.862-2.869h-1.878a2.866 2.866 0 01-2.863-2.869h0a2.866 2.866 0 012.863-2.869h1.7a3.21 3.21 0 012.813 1.258"/></svg>';
  static const String mercado_libre =
      '<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="48" height="48" preserveAspectRatio="xMidYMid meet" viewBox="0 0 48 48"><ellipse cx="24" cy="24" fill="currentColor" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" rx="19.5" ry="12.978"/><path fill="currentColor" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" d="M9.704 15.53a20.834 20.834 0 006.386 1.866 22.82 22.82 0 004.546-.773"/><path fill="currentColor" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" d="M38.882 15.614a8.616 8.616 0 01-5.165 1.485c-3.335 0-6.225-2.199-9.215-2.199-2.668 0-7.189 4.373-7.189 5.164s1.31 1.26


*/
  private async onGetInventoryCosmetics(req: express.Request, res: express.Response): Promise<void> {
    const reqUserId: number = Number(req.params.userId)

    LogInstance.debug(`GET request to /inventory/${reqUserId}/cosmetics`)

    if (isNaN(reqUserId)) {
      return res.status(400).end()
    }

    try {
      const cosmetics: InventoryCosmetics = await InventoryCosmetics.get(reqUserId)
      if (cosmetics != null) {
        return res.status(200).json(cosmetics).end()
      } else {
        return res.status(404).end()
      }
    } catch (error) {
      LogInstance.error(error)
      return res.status(500).end()
    }
  }

  /**
   * called when a POST request to /inventory/:userId/cosmetics is done
   * create cosmetic slots for an user
   * returns 201 if created successfully
   * returns 400 if the request is malformed
   * returns 409 if the user already has cosmetic slots
   * returns 500 if an internal unknown error occured
   * @param req the request data
   * @param res the response data
   * @param next the next request handler
   */
  private async onPostInventoryCosmetics(req: express.Request, res: express.Response): Promise<void> {
    const reqUserId: number = Number(req.params.userId)

    LogInstance.debug(`POST request to /inventory/${reqUserId}/cosmetics`)

    if (isNaN(reqUserId)) {
      return res.status(400).end()
    }

    try {
      const newCosmetics: InventoryCosmetics = await InventoryCosmetics.create(reqUserId)
      return res.status(201).json(newCosmetics).end()
    } catch (error) {
      if (error instanceof MongoError) {
        // 11000 is the duplicate key error code
        if (error.code === 11000) {
          LogInstance.warn(`Tried to create cosmetic slots for an existing user (userId: ${reqUserId}`)
          return res.status(409).end()
        }
      }
      LogInstance.error(error)
      return res.status(500).end()
    }
  }

  /**
   * called when a PUT request to /inventory/:userId/cosmetics is done
   * sets an user's equipped cosmetics
   * returns 200 if set successfully
   * returns 400 if the request is malformed
   * returns 404 if the user doesn't exist
   * returns 500 if an internal unknown error occured
   * @param req the request data
   * @param res the response data
   * @param next the next request handler
   */
  private async onPutInventoryCosmetics(req: express.Request, res: express.Response): Promise<void> {
    const reqUserId: number = Number(req.params.userId)
    const reqCosmetics: ISetCosmeticsBody = req.body

    LogInstance.debug(`PUT request to /inventory/${reqUserId}/cosmetics`)

    if (isNaN(reqUserId)) {
      return res.status(400).end()
    }

    try {
      const wasUpdated: boolean = await InventoryCosmetics.set(reqCosmetics, reqUserId)
      if (wasUpdated === true) {
        return res.status(200).end()
      } else {
        return res.status(404).end()
      }
    } catch (error) {
      LogInstance.error(error)
      return res.status(500).end()
    }
  }

  /**
   * called when a DELETE request to /inventory/:userId/cosmetics is done
   * deletes an user's cosmetics slots
   * return


了。

我在《编译原理之美》的开篇词中就说过，编译原理与你的工作息息相关，无论你是前端工程师、后端工程师，还是运维工程师，不论你是初级工程师还是职场老手，编译技术都能给你帮助，甚至让你提升一个级别。

在第一季，我带你一起梳理了编译技术最核心的概念、理论和算法，帮你构建出了一条相对平坦的学习曲线，让你能够理解大多数技术人都很畏惧的编译原理核心知识。在课程更新的过程中，我发现有很多同学都会有这样一个疑问，那就是：“我确实理解了编译技术的相关原理、概念、算法等，但是有没有更直接的方式，能让我更加深入地把知识与实践相结合呢？”

所以，在[第二季](https://time.geekbang.org/column/intro/314?utm_term=zeusULN89&utm_source=app&utm_medium=geektime&utm_campaign=314-presell&utm_content=diyijijiacan0601)，我会以实战的方式带你挑战编译原理这个领域，也就是带你一起解析真实世界中的编译器。在课程中，我会带你研究不同语言的编译器的源代码，一起跟踪它们的运行过程，分析编译过程的每一步是如何实现的，并会对有特点的编译技术点加以分析和点评。在这个过程中，你会获得对编译器的第一手的理解。

另外，我还会带你分析和总结前面已经研究过的编译器，让你对现代语言的编译器的结构、所采用的算法以及设计上的权衡，都获得比较真切的认识。

下面是专栏的目录：

<img src="https://static001.geekbang.org/resource/image/0c/3e/0cd5596b9f86ddc49f4ef009cf363e3e.jpg" alt="">

为了感谢老同学， 我还准备了一个「专属福利」：

6月1日课程上线，我会送你一张15元专属优惠券，可与限时优惠同享，有效期48小时，建议尽早使用。

**点击下方图片**，立即免费试读新专栏。
<audio id="audio" title="37  | 云编程：云计算会如何改变编程模式？" controls="" preload="none"><source id="mp3" src="https://static001.geekbang.org/resource/audio/36/28/36ef59dc8c60


f) -> &mut Self::Target {
        &mut self.0
    }
}
impl From<crate::W<CHNL_PRI_ALT_SET_SPEC>> for W {
    #[inline(always)]
    fn from(writer: crate::W<CHNL_PRI_ALT_SET_SPEC>) -> Self {
        W(writer)
    }
}
#[doc = "Field `chnl_pri_alt_set` reader - Returns the channel control data structure status, or selects the alternate data structure for the corresponding DMA channel. Read as: \n \n Bit \\[C\\]
= 0 DMA channel C is using the primary data structure. \n \n Bit \\[C\\]
= 1 DMA channel C is using the alternate data structure. \n \n Write as: \n \n Bit \\[C\\]
= 0 No effect. Use the chnl_pri_alt_clr Register to set bit \\[C\\]
to 0. \n \n Bit \\[C\\]
= 1 Selects the alternate data structure for channel C. \n \n Writing to a bit where a DMA channel is not implemented has no effect."]
pub struct CHNL_PRI_ALT_SET_R(crate::FieldReader<u16, u16>);
impl CHNL_PRI_ALT_SET_R {
    #[inline(always)]
    pub(crate) fn new(bits: u16) -> Self {
        CHNL_PRI_ALT_SET_R(crate::FieldReader::new(bits))
    }
}
impl core::ops::Deref for CHNL_PRI_ALT_SET_R {
    type Target = crate::FieldReader<u16, u16>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
#[doc = "Field `chnl_pri_alt_set` writer - Returns the channel control data structure status, or selects the alternate data structure for the corresponding DMA channel. Read as: \n \n Bit \\[C\\]
= 0 DMA channel C is using the primary data structure. \n \n Bit \\[C\\]
= 1 DMA channel C is using the alternate data structure. \n \n Write as: \n \n Bit \\[C\\]
= 0 No effect. Use the chnl_pri_alt_clr Register to set bit \\[C\\]
to 0. \n \n Bit \\[C\\]
= 1 Selects the alternate data structure for channel C. \n \n Writing to a bit where a DMA channel is not implemented has no effect."]
pub struct CHNL_PRI_ALT_SET_W<'a> {
    w: &'a mut W,
}
impl<'a> CHNL_PRI_ALT_SET_W<'a> {
    #[doc = r"Writes raw bits to the field"]
    #[inline(always)]
    pub unsafe fn bits(self, value: u16) -> &'a mut W {
        self.w.bits = (self.w.bits & !0xffff) | (value as u32 & 0xffff);
        self.w
    }
}
impl R {
    #[doc = "Bits 0:15 - Returns the channel control data structure status, or selects the alternate data structure for the corresponding DMA channel. Read as: \n \n Bit \\[C\\]
= 0 DMA channel C is using the primary data structure. \n \n Bit \\[C\\]
= 1 DMA channel C is using the alternate data structure. \n \n Write as: \n \n Bit \\[C\\]
= 0 No effect. Use the chnl_pri_alt_clr Register to set bit \\[C\\]
to 0. \n \n Bit \\[C\\]
= 1 Selects the alternate data structure for channel C. \n \n Writing to a bit where a DMA channel is not implemented has no effect."]
    #[inline(always)]
    pub fn chnl_pri_alt_set(&self) -> CHNL_PRI_ALT_SET_R {
        CHNL_PRI_ALT_SET_R::new((self.bits & 0xffff) as u16)
    }
}
impl W {
    #[doc = "Bits 0:15 - Returns the channel control data structure status, or selects the alternate data structure for the corresponding DMA channel. Read as: \n \n


 - InternalError - some other error

* ExpectedClientAlert, ExpectedServerAlert - expected alert. See
  `ssl_test_ctx.c` for known values. Note: the expected alert is currently
  matched against the _last_ received alert (i.e., a fatal alert or a
  `close_notify`). Warning alert expectations are not yet supported. (A warning
  alert will not be correctly matched, if followed by a `close_notify` or
  another alert.)

* ExpectedProtocol - expected negotiated protocol. One of
  SSLv3, TLSv1, TLSv1.1, TLSv1.2.

* SessionTicketExpected - whether or not a session ticket is expected
  - Ignore - do not check for a session ticket (default)
  - Yes - a session ticket is expected
  - No - a session ticket is not expected

* SessionIdExpected - whether or not a session id is expected
  - Ignore - do not check for a session id (default)
  - Yes - a session id is expected
  - No - a session id is not expected

* ResumptionExpected - whether or not resumption is expected (Resume mode only)
  - Yes - resumed handshake
  - No - full handshake (default)

* ExpectedNPNProtocol, ExpectedALPNProtocol - NPN and ALPN expectations.

* ExpectedTmpKeyType - the expected algorithm or curve of server temp key

* ExpectedServerCertType, ExpectedClientCertType - the expected algorithm or
  curve of server or client certificate

* ExpectedServerSignHash, ExpectedClientSignHash - the expected
  signing hash used by server or client certificate

* ExpectedServerSignType, ExpectedClientSignType - the expected
  signature type used by server or client when signing messages

* ExpectedClientCANames - for client auth list of CA names the server must
  send. If this is "empty" the list is expected to be empty otherwise it
  is a file of certificates whose subject names form the list.

* ExpectedServerCANames - list of CA names the client must send, TLS 1.3 only.
  If this is "empty" the list is expected to be empty otherwise it is a file
  of certificates whose subject names form the list.

## Configuring the client and server

The client and server configurations can be any valid `SSL_CTX`
configurations. For details, see the manpages for `SSL_CONF_cmd`.

Give your configurations as a dictionary of CONF commands, e.g.

```
server => {
    "CipherString" => "DEFAULT",
    "MinProtocol" => "TLSv1",
}
```

The following sections may optionally be defined:

* server2 - this section configures a secondary context that is selected via the
  ServerName test option. This context is used whenever a ServerNameCallback is
  specified. If the server2 section is not present, then the configuration
  matches server.
* resume_server - this section configures the client to resume its session
  against a different server. This context is used whenever HandshakeMode is
  Resume. If the resume_server section is not present, then the configuration
  matches server.
* resume_client - this section configures the client to resume its session with
  a different configuration. In practice this may occur when, for example,
  upgraded clients reuse sessions persisted on


TYPE_TEXT_FLAG_CAP_SENTENCES">

        public
        static
        final
        int

        TYPE_TEXT_FLAG_CAP_SENTENCES

  Added in API level 3

Flag for TYPE_CLASS_TEXT: capitalize the first character of
 each sentence.  This value is explicitly defined
 to be the same as CAP_MODE_SENTENCES. For example
 in English it means to capitalize after a period and a space (note that other
 languages may have different characters for period, or not use spaces,
 or use different grammatical rules). Of course,
 this only affects languages where there are upper-case and lower-case letters.

        Constant Value:

                16384
                (0x00004000)

        public
        static
        final
        int

        TYPE_TEXT_FLAG_CAP_WORDS

  Added in API level 3

Flag for TYPE_CLASS_TEXT: capitalize the first character of
 every word.  Overrides TYPE_TEXT_FLAG_CAP_SENTENCES.  This
 value is explicitly defined
 to be the same as CAP_MODE_WORDS. Of course,
 this only affects languages where there are upper-case and lower-case letters.

        Constant Value:

                8192
                (0x00002000)

        public
        static
        final
        int

        TYPE_TEXT_FLAG_IME_MULTI_LINE

  Added in API level 3


nce.K8s.Info_log_create_basic_secret_start)
				pwd, _ := os.Getwd()
				htpasswdCmd := exec.Command("htpasswd", "-b", "-c", "auth", username, password)
				htpasswdCmd.Stdout = os.Stdout
				htpasswdCmd.Stderr = os.Stderr
				if htpasswdCmdErr := htpasswdCmd.Run(); htpasswdCmdErr != nil {
					common.SmartIDELog.Error(htpasswdCmdErr)
				}
				// 运行kubectl create secret命令
				// e.g. kubectl create secret generic basic-auth --from-file=auth -n <NAMESPACE>
				err = k8sUtil.ExecKubectlCommandRealtime(fmt.Sprintf("create secret generic basic-auth --from-file=auth -n %v", namespace), pwd, false)
				common.CheckError(err)
				smartIdeIngress.Metadata.Annotations.NginxIngressKubernetesIoAuthType = "basic"
				smartIdeIngress.Metadata.Annotations.NginxIngressKubernetesIoAuthSecret = "basic-auth"
				common.SmartIDELog.Info(i18nInstance.K8s.Info_log_create_basic_secret_success)
			}

			// Genetrate AllInOne Ingress Yaml
			for index, portInfo := range workspaceInfo.Extend.Ports {
				if portInfo.HostPortDesc == "tools-ssh" {
					continue
				}
				host := fmt.Sprintf("%v-%v-p%v.%v", namespace, portInfo.ServiceName, portInfo.ClientPort, baseDNSName)
				//Append Rules
				smartIdeIngress.Spec.Rules = append(smartIdeIngress.Spec.Rules, struct {
					Host string "yaml:\"host\""
					HTTP struct {
						Paths []struct {
							Path     string "yaml:\"path\""
							PathType string "yaml:\"pathType\""
							Backend  struct {
								Service struct {
									Name string "yaml:\"name\""
									Port struct {
										Number int "yaml:\"number\""
									} "yaml:\"port\""
								} "yaml:\"service\""
							} "yaml:\"backend\""
						} "yaml:\"paths\""
					} "yaml:\"http\""
				}{
					Host: host,
					HTTP: struct {
						Paths []struct {
							Path     string "yaml:\"path\""
							PathType string "yaml:\"pathType\""
							Backend  struct {
								Service struct {
									Name string "yaml:\"name\""
									Port struct {
										Number int "yaml:\"number\""
									} "yaml:\"port\""
								} "yaml:\"service\""
							} "yaml:\"backend\""
						} "yaml:\"paths\""
					}{
						Paths: []struct {
							Path     string "yaml:\"path\""
							PathType string "yaml:\"pathType\""
							Backend  struct {
								Service struct {
									Name string "yaml:\"name\""
									Port struct {
										Number int "yaml:\"number\""
									} "yaml:\"port\""
								} "yaml:\"service\""
							} "yaml:\"backend\""
						}{
							{
								Path:     "/",
								PathType: "Prefix",
								Backend: struct {
									Service struct {
										Name string "yaml:\"name\""
										Port struct {
											Number int "yaml:\"number\""
										} "yaml:\"port\""
									} "yaml:\"service\""
								}{
									Service: struct {
										Name string "yaml:\"name\""
										Port struct {
											Number int "yaml:\"number\""
										} "yaml:\"port\""
									}{
										Name: portInfo.ServiceName,
										Port: struct {
											Number int "yaml:\"number\""
										}{
											Number: portInfo.ClientPort,
										},
									},
								},
							},
						},
					},
				})

				//Set Public URL


 loading
            // inside component with OnPush CD strategy. Mark us for check to be sure CD will reach us.
            // We are inside a promise here so no need for setTimeout - CD should trigger after the promise.
            this.changeDetector.markForCheck();
            return compRef;
        })
    }

    public loadComponent(componentType: Type): Promise<ComponentRef<any>> {
        log("DetachedLoader.loadComponent viewLoaded: " + this.viewLoaded);

        // Check if called before placeholder is initialized.
        // Delay load if so.
        if (this.viewLoaded) {
            return this.loadInLocation(componentType);
        } else {
            // loadComponent called, but detached-loader is still not initialized.
            // Mark it for change and trigger change detection to be sure it will be initialized,
            // so that loading can conitionue.
            log("DetachedLoader.loadComponent -> markForCheck(with setTimeout())")
            setTimeout(() => this.changeDetector.markForCheck(), 0);

            return new Promise((resolve, reject) => {
                this.pendingLoads.push({
                    componentType: componentType,
                    resolveCallback: resolve
                });
            });
        }
    }

    public loadWithFactory<T>(factory: ComponentFactory<T>): ComponentRef<T> {
        return this.containerRef.createComponent(factory, this.containerRef.length, this.containerRef.parentInjector, null);
    }
}
import { IGameStatus } from '../index';
import { getPositionValue, IGamePosition, Color, getFiguresByType, getFightMap, getFiguresByColor, convertCoordinateToString, deepCopyArray, Desk } from '../helpers';
import { King } from '../figures'
export default class GameStatus {

  defineNextPlayerColor(gamePosition: IGamePosition): Color {
    const { lastMove } = gamePosition;

    if (!lastMove) {
      return 'white';
    }

    const lastMoveFigure = getPositionValue(gamePosition, lastMove[1]);

    if (!lastMoveFigure) {
      throw new Error('Position is broken');
    }

    return lastMoveFigure.color === 'white' ? 'black' : lastMoveFigure.color;
  }

  isCheck(gamePosition: IGamePosition, color: Color) {
    const figuresForCurrentColor = getFiguresByColor(gamePosition, color);
    const opositeFigures = getFiguresByColor(gamePosition, color === 'black' ? 'white' : 'black');
    const fightMapForOpositeColor = getFightMap(gamePosition, opositeFigures);
    const king = figuresForCurrentColor.find(el => el instanceof King);

    if (!king) {
      throw new Error('Game position is invalid. King is not exist.');
    }

    return !!fightMapForOpositeColor[convertCoordinateToString(king.position)];
  }

  getAllowedMovesForDeclineCheck(gamePosition: IGamePosition, color: Color) {
    const result: [string, string][] = [];
    const figuresForCurrentColor = getFiguresByColor(gamePosition, color);

    for (let i = 0; i < figuresForCurrentColor.length; i += 1) {
      const figure = figuresForCurrentColor[i];
      const allowedMoves = figure.getAllowedPositions(gamePosition);

      for (let j = 0; j < allowedMoves.length; j += 1) {
        const move = allowedMoves[j];
        const exPosition = figure.position;
        const newGamePosition = figure.setPosition(gamePosition, move);

        const isCheck = this.isCheck(newGamePosition