Rewrite this code without any ImGui implementation, only clear actionscript3
namespace detail {
		// SpinnerBegin is a function that starts a spinner widget, used to display an animation indicating that
		// a task is in progress. It returns true if the widget is visible and can be used, or false if it should be skipped.
		inline bool SpinnerBegin(const char* label, float radius, ImVec2& pos, ImVec2& size, ImVec2& centre, int& num_segments) {
			ImGuiWindow* window = ImGui::GetCurrentWindow();
			if (window->SkipItems)
				return false;

			ImGuiContext& g = *GImGui;
			const ImGuiStyle& style = g.Style;
			const ImGuiID id = window->GetID(label);

			pos = window->DC.CursorPos;
			// The size of the spinner is set to twice the radius, plus some padding based on the style
			size = ImVec2((radius) * 2, (radius + style.FramePadding.y) * 2);

			const ImRect bb(pos, ImVec2(pos.x + size.x, pos.y + size.y));
			ImGui::ItemSize(bb, style.FramePadding.y);

			num_segments = window->DrawList->_CalcCircleAutoSegmentCount(radius);

			centre = bb.GetCenter();
			// If the item cannot be added to the window, return false
			if (!ImGui::ItemAdd(bb, id))
				return false;

			return true;
		}
	}

#define SPINNER_HEADER(pos, size, centre, num_segments) ImVec2 pos, size, centre; int num_segments; if (!detail::SpinnerBegin(label, radius, pos, size, centre, num_segments)) { return; }; ImGuiWindow *window = ImGui::GetCurrentWindow(); \
    auto circle = [&] (auto point_func, auto dbc, auto dth) { window->DrawList->PathClear(); for (int i = 0; i < num_segments; i++) { ImVec2 p = point_func(i); window->DrawList->PathLineTo(ImVec2(centre.x + p.x, centre.y + p.y)); } window->DrawList->PathStroke(dbc, false, dth); }

	inline ImColor color_alpha(ImColor c, float alpha) { c.Value.w *= alpha * ImGui::GetStyle().Alpha; return c; }

	/*
		const char *label: A string label for the spinner, used to identify it in ImGui.
		float radius: The radius of the spinner.
		float thickness: The thickness of the spinner's border.
		const ImColor &color: The color of the spinner.
		float speed: The speed of the spinning animation.
		float ang_min: Minimum angle of spinning.
		float ang_max: Maximum angle of spinning.
		int arcs: Number of arcs of the spinner.
	*/

	inline void SpinnerRainbow(const char* label, float radius, float thickness, ImColor color, float speed, float ang_min = 0.f, float ang_max = PI_2, int arcs = 1)
	{
		SPINNER_HEADER(pos, size, centre, num_segments);

		for (int i = 0; i < arcs; ++i)
		{
			const float rb = (radius / arcs) * (i + 1);

			const float start = ImAbs(ImSin((float)ImGui::GetTime()) * (num_segments - 5));
			const float a_min = ImMax(ang_min, PI_2 * ((float)start) / (float)num_segments + (IM_PI / arcs) * i);
			const float a_max = ImMin(ang_max, PI_2 * ((float)num_segments + 3 * (i + 1)) / (float)num_segments);
			static float isRed = 0.0f, isGreen = 0.01f, isBlue = 0.0f;
			ImVec4 isRGB = ImVec4(isRed, isGreen, isBlue, 1.0f);
			if (isGreen <= 0.01f && isBlue <= 0.0f)
			{
				isRed += 0.01f * speed / 2.0f;
			}

			if (isRed > 0.99f && isBlue == 0.0f)
			{
				isRed = 1.0f;
				isGreen += 0.01f * speed / 2.0f;
			}

			if (isGreen > 0.99f && isBlue == 0.0f)
			{
				isGreen = 1.0f;
				isRed -= 0.01f * speed / 2.0f;
			}

			if (isRed < 0.01f && isGreen == 1.0f)
			{
				isRed = 0.0f;
				isBlue += 0.01f * speed / 2.0f;
			}

			if (isBlue > 0.99f && isRed == 0.0f)
			{
				isBlue = 1.0f;
				isGreen -= 0.01f * speed / 2.0f;
			}

			if (isGreen < 0.01f && isBlue == 1.0f)
			{
				isGreen = 0.0f;
				isRed += 0.01f * speed / 2.0f;
			}

			if (isRed > 0.99f && isGreen == 0.0f)
			{
				isRed = 1.0f;
				isBlue -= 0.01f * speed / 2.0f;
			}

			if (isBlue < 0.01f && isGreen == 0.0f)
			{
				isBlue = 0.0f;
				isRed -= 0.01f * speed / 2.0f;
				if (isRed < 0.01f)
					isGreen = 0.01f * speed / 2.0f;
			}
			color = ImColor(isRed, isGreen, isBlue);
			circle([&](int i) {
				const float a = a_min + ((float)i / (float)num_segments) * (a_max - a_min);
			const float rspeed = a + (float)ImGui::GetTime() * speed;

			return ImVec2(ImCos(rspeed) * rb, ImSin(rspeed) * rb);
				}, color_alpha(color, 1.f), thickness);
		}
	}