tainsNul => "user option contains NUL",
            DaemonizeError::SetUser(_) => "unable to set user",
            DaemonizeError::ChangeDirectory => "unable to change directory",
            DaemonizeError::PathContainsNul => "pid_file option contains NUL",
            DaemonizeError::OpenPidfile => "unable to open pid file",
            DaemonizeError::LockPidfile(_) => "unable to lock pid file",
            DaemonizeError::ChownPidfile(_) => "unable to chown pid file",
            DaemonizeError::RedirectStreams(_) => "unable to redirect standard streams to /dev/null",
            DaemonizeError::WritePid => "unable to write self pid to pid file",
            DaemonizeError::__Nonexhaustive => unreachable!(),
        }
    }
}

impl std::fmt::Display for DaemonizeError {
    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
        self.__description().fmt(f)
    }
}

impl std::error::Error for DaemonizeError {
    fn description(&self) -> &str {
        self.__description()
    }
}

type Result<T> = std::result::Result<T, DaemonizeError>;

/// Expects system user id or name. If name is provided it will be resolved to id later.
#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Clone)]
pub enum User {
    Name(String),
    Id(uid_t),
}

impl<'a> From<&'a str> for User {
    fn from(t: &'a str) -> User {
        User::Name(t.to_owned())
    }
}

impl From<uid_t> for User {
    fn from(t: uid_t) -> User {
        User::Id(t)
    }
}

/// Expects system group id or name. If name is provided it will be resolved to id later.
#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Clone)]
pub enum Group {
    Name(String),
    Id(gid_t),
}

impl<'a> From<&'a str> for Group {
    fn from(t: &'a str) -> Group {
        Group::Name(t.to_owned())
    }
}

impl From<gid_t> for Group {
    fn from(t: gid_t) -> Group {
        Group::Id(t)
    }
}

/// Daemonization options.
///
/// Fork the process in the background, disassociate from its process group and the control terminal.
/// Change umask value to `0o027`, redirect all standard streams to `/dev/null`. Change working
/// directory to `/` or provided value.
///
/// Optionally:
///
///   * maintain and lock the pid-file;
///   * drop user privileges;
///   * drop group privileges;
///   * change the pid-file ownership to provided user (and/or) group;
///   * execute any provided action just before dropping privileges.
///
pub struct Daemonize<T> {
    directory: PathBuf,
    pid_file: Option<PathBuf>,
    chown_pid_file: bool,
    user: Option<User>,
    group: Option<Group>,
    umask: mode_t,
    privileged_action: Box<Fn() -> T>,
}

impl<T> fmt::Debug for Daemonize<T> {
    fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
        fmt.debug_struct("Daemonize")
            .field("directory", &self.directory)
            .field("pid_file", &self.pid_file)
            .field("chown_pid_file", &self.chown_pid_file)
            .field("user", &self.user)
            .field("group", &self.group)
            .field("umask", &self.umask)
            .finish()
    }
}

impl Daemonize<()> {

    pub fn new() -> Self {
        Daemonize


C114.1 0 64 50.1 64 112c0 7.1 .7 14.1 1.9 20.8C27.6 145.4 0 181.5 0 224zm330.1 3.6c-5.8-4.7-14.2-4.7-20.1-.1l-160 128c-5.3 4.2-7.4 11.4-5.1 17.8s8.3 10.7 15.1 10.7l70.1 0L177.7 488.8c-3.4 6.7-1.6 14.9 4.3 19.6s14.2 4.7 20.1 .1l160-128c5.3-4.2 7.4-11.4 5.1-17.8s-8.3-10.7-15.1-10.7l-70.1 0 52.4-104.8c3.4-6.7 1.6-14.9-4.2-19.6z"],
    "text-slash": [640, 512, ["remove-format"], "f87d", "M38.8 5.1C28.4-3.1 13.3-1.2 5.1 9.2S-1.2 34.7 9.2 42.9l592 464c10.4 8.2 25.5 6.3 33.7-4.1s6.3-25.5-4.1-33.7L355.7 253.5 400.2 96 503 96 497 120.2c-4.3 17.1 6.1 34.5 23.3 38.8s34.5-6.1 38.8-23.3l11-44.1C577.6 61.3 554.7 32 523.5 32L376.1 32l-.3 0L204.5 32c-22 0-41.2 15-46.6 36.4l-6.3 25.2L38.8 5.1zm168 131.7c.1-.3 .2-.7 .3-1L217 96l116.7 0L301.3 210.8l-94.5-74.1zM243.3 416L192 416c-17.7 0-32 14.3-32 32s14.3 32 32 32l160 0c17.7 0 32-14.3 32-32s-14.3-32-32-32l-42.2 0 17.6-62.1L272.9 311 243.3 416z"],
    "face-smile-wink": [512, 512, [128521, "smile-wink"], "f4da", "M256 512A256 256 0 1 0 256 0a256 256 0 1 0 0 512zM164.1 325.5C182 346.2 212.6 368 256 368s74-21.8 91.9-42.5c5.8-6.7 15.9-7.4 22.6-1.6s7.4 15.9 1.6 22.6C349.8 372.1 311.1 400 256 400s-93.8-27.9-116.1-53.5c-5.8-6.7-5.1-16.8 1.6-22.6s16.8-5.1 22.6 1.6zM144.4 208a32 32 0 1 1 64 0 32 32 0 1 1 -64 0zm156.4 25.6c-5.3 7.1-15.3 8.5-22.4 3.2s-8.5-15.3-3.2-22.4c30.4-40.5 91.2-40.5 121.6 0c5.3 7.1 3.9 17.1-3.2 22.4s-17.1 3.9-22.4-3.2c-17.6-23.5-52.8-23.5-70.4 0z"],
    "file-word": [384, 512, [], "f1c2", "M64 0C28.7 0 0 28.7 0 64L0 448c0 35.3 28.7 64 64 64l256 0c35.3 0 64-28.7 64-64l0-288-128 0c-17.7 0-32-14.3-32-32L224


接收方反馈
>         接收方提供明确的反馈信息给发送方;
>         - 比如: 使用肯定确认(ACK, positive acknowledgment)、否定确认(NAK, negative acknowledgment) ;
>     - 重传机制
>         接收方收到有差错的分组时, 发送方重传该分组;
> - **等停 (stop-and-wait) 协议**
>     当发送方未确认接收方已经正确地收到分组时(即发送方没有收到ACK分组), 发送方会等待而不是继续发送;
>
> ---
>
> ###### 状态机图示
>
> <left></left>

---

#### rdt 2.1

> ###### 概述
>
> - 假设信道不发生丢包;
> - **解决了 ACK、NAK 出错的问题**;
>
> ----
>
> ###### 改进
>
> - 解决了接收方的反馈信息出错导致的问题: 在数据包、反馈信息中都加入了占 1 bit 的序号
>
>     - 发送方两种状态
>         - 发送 0 号数据包
>         - 发送 1 号数据包;
>
>     - 接收方两种状态
>         - 等待 0 号数据包
>         - 等待 1 号数据包;
>
>     - 反馈信息错误检测机制
>         - ACK 翻转为 NAK
>             假设发送方向接收方发送 0 号数据包, 如果接收方正确接收到 0 号数据包, 返回 ACK, 但是 ACK 翻转为了 NAK, 此时, 接收方处于等待 1 号数据状态, 但发送方接收到了 NAK, 于是重发 0 号数据, 进而接收方会拒绝此 0 号数据, 避免重复;
>         - NAK 翻转为 ACK
>             如果接收方接收到 0 号数据包出现错误, 返回 NAK, 但是 NAK 翻转为了 ACK, 此时, 接收方处于等待 0 号数据状态, 但发送发收到了 ACK, 于是发送方发送了 1 号数据, 进而接收方会拒绝 1 号数据, 避免错序;
>
>
> ---
>
> ###### 状态机图示
>
> <left></left>

---

#### rdt 2.2

> ###### 概述
>
> - 在 rdt 2.1 的基础上, 取消 NAK, **使用冗余 ACK** (duplicate ACK) 代替它;
>
> ---
>
> ###### 改进
>
> - 当接收方没有正确地接受分组时:
>     - 接收方重新发送一个针对错误分组的上一个分组的 ACK(冗余 ACK);
>         - 而不是像 rdt 2.1 一样发送 NAK;
>     - 当接收方发现接收到两个针对同一个分组的 ACK 时, 就知道这个被两次确认的分组的下一个分组传输失败, 需要重传;
>
> ---
>
> ###### 状态机图示
>
> <left><img src="assets/202203282018987


random_ignore_vo = {
				chance = 0.3,
				hold_for = 0,
				max_failed_tries = 0,
			},
		},
	})
	define_rule({
		category = "conversations_prio_1",
		database = "veteran_female_b",
		name = "bonding_conversation_killstreak_extension_vet_b_vet_c_d",
		response = "bonding_conversation_killstreak_extension_vet_b_vet_c_d",
		wwise_route = 0,
		criterias = {
			{
				"query_context",
				"concept",
				OP.EQ,
				"heard_speak",
			},
			{
				"query_context",
				"dialogue_name",
				OP.SET_INCLUDES,
				args = {
					"bonding_conversation_killstreak_extension_vet_b_vet_c_c",
				},
			},
			{
				"user_context",
				"voice_template",
				OP.SET_INCLUDES,
				args = {
					"veteran_female_c",
				},
			},
			{
				"user_memory",
				"last_killstreak",
				OP.GT,
				1,
			},
			{
				"user_memory",
				"last_killstreak",
				OP.TIMEDIFF,
				OP.LT,
				10,
			},
		},
		on_done = {},
		heard_speak_routing = {
			target = "players",
		},
		on_pre_rule_execution = {
			delay_vo = {
				duration = 0.2,
			},
		},
	})
	define_rule({
		category = "conversations_prio_1",
		database = "veteran_female_b",
		name = "bonding_conversation_killstreak_extension_vet_b_vet_c_e",
		response = "bonding_conversation_killstreak_extension_vet_b_vet_c_e",
		wwise_route = 0,
		criterias = {
			{
				"query_context",
				"concept",
				OP.EQ,
				"heard_speak",
			},
			{
				"query_context",
				"dialogue_name",
				OP.SET_INCLUDES,
				args = {
					"bonding_conversation_killstreak_extension_vet_b_vet_c_d",
				},
			},
			{
				"user_context",
				"voice_template",
				OP.SET_INCLUDES,
				args = {
					"veteran_female_b",
				},
			},
			{
				"user_memory",
				"bonding_conversation_killstreak_user",
				OP.EQ,
				OP.LT,
				1,
			},
		},
		on_done = {},
		heard_speak_routing = {
			target = "disabled",
		},
		on_pre_rule_execution = {
			delay_vo = {
				duration = 0.2,
			},
		},
	})
	define_rule({
		category = "conversations_prio_1",
		database = "veteran_female_b",
		name = "bonding_conversation_killstreak_extension_vet_b_zea_c_c",
		response = "bonding_conversation_killstreak_extension_vet_b_zea_c_c",
		wwise_route = 0,
		criterias = {
			{
				"query_context",
				"concept",
				OP.EQ,
				"heard_speak",
			},
			{
				"query_context",
				"sound_event",
				OP.SET_INCLUDES,
				args = {
					"loc_zealot_male_c__response_for_veteran_seen_killstreak_zealot_01",


edundancyGroupZ += redundancyZ;

				maxGrossErrorGroupX = Math.abs(grossErrorX) > Math.abs(maxGrossErrorGroupX) ? grossErrorX : maxGrossErrorGroupX;
				maxGrossErrorGroupY = Math.abs(grossErrorY) > Math.abs(maxGrossErrorGroupY) ? grossErrorY : maxGrossErrorGroupY;
				maxGrossErrorGroupZ = Math.abs(grossErrorZ) > Math.abs(maxGrossErrorGroupZ) ? grossErrorZ : maxGrossErrorGroupZ;

				maxResidualGroupX = Math.abs(residualX) > Math.abs(maxResidualGroupX) ? residualX : maxResidualGroupX;
				maxResidualGroupY = Math.abs(residualY) > Math.abs(maxResidualGroupY) ? residualY : maxResidualGroupY;
				maxResidualGroupZ = Math.abs(residualZ) > Math.abs(maxResidualGroupZ) ? residualZ : maxResidualGroupZ;

				if (!significantGroup && significant)
					significantGroup = true;

				points.add(h);
			}

			if (points != null && points.size() > 0) {
				groupParam.put("id",           groupId);
				groupParam.put("name",         groupSet.getString("name"));
				groupParam.put("points",       points);
				groupParam.put("omega",        omegaGroup);
				groupParam.put("significant",  significantGroup);
				groupParam.put("dimension",    dim);
				groupParam.put("type",         pointType.name());

				groupParam.put("redundancy_x",  redundancyGroupX);
				groupParam.put("redundancy_y",  redundancyGroupY);
				groupParam.put("redundancy_z",  redundancyGroupZ);
				groupParam.put("redundancy",    redundancyGroupX+redundancyGroupY+redundancyGroupZ);

				groupParam.put("max_gross_error_x", options.convertLengthResidualToView(maxGrossErrorGroupX));
				groupParam.put("max_gross_error_y", options.convertLengthResidualToView(maxGrossErrorGroupY));
				groupParam.put("max_gross_error_z", options.convertLengthResidualToView(maxGrossErrorGroupZ));

				groupParam.put("max_residual_x", options.convertLengthResidualToView(maxResidualGroupX));
				groupParam.put("max_residual_y", options.convertLengthResidualToView(maxResidualGroupY));
				groupParam.put("max_residual_z", options.convertLengthResidualToView(maxResidualGroupZ));

				if (groupUncertainties != null && !groupUncertainties.isEmpty())
					groupParam.put("uncertainties", groupUncertainties);

				groupParam.put("visible", this.isPointDimensionVisibility(pointType, dim));

				groups.add(groupParam);
			}
		}

		return groups;
	}

	private List<HashMap<String, Object>> getVerticalDeflectionGroups(VerticalDeflectionType verticalDeflectionType) throws SQLException {
		List<HashMap<String, Object>> groups = new ArrayList<HashMap<String, Object>>();

		String sqlGroup = "SELECT \"id\", \"name\" FROM \"VerticalDeflectionGroup\" WHERE \"type\" = ? AND \"enable\" = TRUE";

		String sqlUncertainty = "SELECT \"type\", \"value\" FROM \"VerticalDeflectionGroupUncertainty\" WHERE \"group_id\" = ?";

		String sqlDeflection = "SELECT"
				+ "\"name\", "

				+ "\"x0\", \"y0\", "
				+ "\"x\",  \"y\", "

				+ "\"VerticalDeflectionAposteriori\".\"sigma_x0\" AS \"sigma_x0\", "
				+ "\"VerticalDeflectionAposteriori\".\"sigma_y0\" AS \"sigma_y0\", "


context).text(style: TextStyle(color: textColor)),
      ].column().padAll(10),
    );
  }
}

class LessonOverlapGroup extends StatelessWidget {
  final List<TimetableLessonPart> lessonsInSlot;
  final int timeslot;
  final TimetableEntity timetable;

  const LessonOverlapGroup(
    this.lessonsInSlot,
    this.timeslot,
    this.timetable, {
    super.key,
  });

  @override
  Widget build(BuildContext context) {
    if (lessonsInSlot.isEmpty) return const SizedBox.shrink();
    final List<Widget> all = [];
    ClassTime? classTime;
    const palette = BuiltinTimetablePalettes.classic;
    for (int lessonIndex = 0; lessonIndex < lessonsInSlot.length; lessonIndex++) {
      final lesson = lessonsInSlot[lessonIndex];
      final course = lesson.course;
      final colorEntry = timetable.resolveColor(palette, course);
      final color = colorEntry.colorBy(context);
      classTime = calcBeginEndTimePointOfLesson(timeslot, timetable.campus, course.place);
      final row = LessonCard(
        lesson: lesson,
        course: course,
        timetable: timetable,
        color: color,
      );
      all.add(row);
    }
    // [classTime] must be nonnull.
    // TODO: Color for class overlap.
    final firstColorEntry = BuiltinTimetablePalettes.classic.colors[0];
    return Card.outlined(
      child: [
        ClassTimeCard(
          color: firstColorEntry.colorBy(context),
          classTime: classTime!,
          textColor: firstColorEntry.textColorBy(context),
        ),
        all.column().expanded(),
      ].row().padAll(3),
    );
  }
}

enum _RowBuilderState {
  row,
  divider,
  none;
}

class _LessonRowBuilder {
  final Widget Function(int dividerNumber) dividerBuilder;

  _LessonRowBuilder({required this.dividerBuilder});

  final List<Widget> _rows = [];
  _RowBuilderState lastAdded = _RowBuilderState.none;

  void add(int index, Widget? row) {
    // WOW! MEAL TIME!
    // For each four classes, there's a meal.
    // Avoid adding two divider in a row
    if (index != 0 && index % 4 == 0 && lastAdded != _RowBuilderState.divider) {
      _rows.add(dividerBuilder(index ~/ 4));
      lastAdded = _RowBuilderState.divider;
    }
    if (row != null) {
      _rows.add(row);
      lastAdded = _RowBuilderState.row;
    }
  }

  List<Widget> build() {
    // Remove surplus dividers.
    for (int i = _rows.length - 1; 0 <= i; i--) {
      if (_rows[i] is Divider) {
        _rows.removeLast();
      } else {
        break;
      }
    }
    return _rows;
  }
}
import 'package:flutter/material.dart';
import 'package:flutter_hbb/common.dart';
import 'package:flutter_hbb/models/platform_model.dart';
import 'package:flutter_hbb/plugin/model.dart';
import 'package:flutter_hbb/plugin/common.dart';
import 'package:get/get.dart';

import '../manager.dart';
import './desc_ui.dart';

// to-do: use settings from desktop_setting_page.dart
const double _kCardFixedWidth = 540;
const double _kCardLeftMargin = 15;
const double _kContentHMargin = 15;
const double _kTitleFontSize = 20;
const double _kVersionFontSize = 12;

class DesktopSettingsCard extends StatefulWidget {
  final PluginInfo plugin;
  DesktopSettingsCard({
    Key? key,
    required this.plugin,
  }) : super(key: key);

  @override
  State<DesktopSettingsCard> createState() => _DesktopSettingsCardState();
}

class _DesktopSettingsCardState extends State<DesktopSettingsCard> {
  PluginInfo get plugin => widget.pl


 let t = text_6x8!("Hello Rust!", fill = Some(20u8)).translate(icoord!(20, 16));
//!
//! display.draw(c);
//! display.draw(t);
//! ```
//!
//! ## Chaining
//!
//! Items can be chained to build more complex graphics objects.
//!
//! ```rust
//! use embedded_graphics::prelude::*;
//! use embedded_graphics::{text_6x8, egcircle, icoord, egrectangle};
//! # use embedded_graphics::mock_display::Display;
//!
//! fn build_thing(text: &'static str) -> impl Iterator<Item = Pixel<u8>> {
//!     egrectangle!((0, 0), (40, 40)).into_iter()
//!         .chain(egcircle!((20, 20), 8, fill = Some(1u8)))
//!         .chain(text_6x8!(text, fill = Some(20u8)).translate(icoord!(20, 16)))
//! }
//!
//! fn main() {
//!     # let mut display = Display::default();
//!     display.draw(build_thing("Hello Rust!"));
//! }
//! ```
//!
//! # Implementing `embedded_graphics` in a driver
//!
//! To add support for embedded_graphics to a display driver, [`Drawing`] (and if possible
//! [`SizedDrawing`]) should be implemented. This allows all embedded_graphics objects to be
//! rendered by the display. See their [respective][`Drawing`] [docs][`SizedDrawing`] for
//! implementation details.
//!
//! [`Circle`]: ./primitives/circle/struct.Circle.html
//! [`Font6x8`]: ./fonts/type.Font6x8.html
//! [`Drawing`]: ./trait.Drawing.html
//! [`SizedDrawing`]: ./trait.SizedDrawing.html

#![no_std]
#![deny(missing_docs)]
#![deny(missing_debug_implementations)]
#![deny(missing_copy_implementations)]
#![deny(trivial_casts)]
#![deny(trivial_numeric_casts)]
#![deny(unsafe_code)]
#![deny(unstable_features)]
#![deny(unused_import_braces)]
#![deny(unused_qualifications)]

#[cfg(feature = "nalgebra_support")]
extern crate nalgebra;

pub mod coord;
pub mod drawable;
pub mod fonts;
pub mod image;
#[doc(hidden)]
pub mod mock_display;
pub mod pixelcolor;
pub mod prelude;
pub mod primitives;
pub mod style;
pub mod transform;
pub mod unsignedcoord;

use crate::drawable::Dimensions;
use crate::pixelcolor::PixelColor;

/// To use this crate in a driver, `Drawing` must be implemented. This allows display drivers to
/// support all embedded_graphics objects through the `draw()` method.
///
/// Note that you should also implement [`SizedDrawing`] if the display supports partial updates.
///
/// Here's an example for an imaginary display that has a 64x64px framebuffer of 8 bit values that
/// communicates over a (simplified) SPI interface:
///
/// ```rust
/// use embedded_graphics::prelude::*;
/// use embedded_graphics::Drawing;
/// use embedded_graphics::egcircle;
///
/// # struct SPI1;
/// #
/// # impl SPI1 {
/// #     pub fn send_bytes(&self, buf: &[u8]) -> Result<(), ()> {
/// #         Ok(())
/// #     }
/// # }
/// #
/// /// A fake display 64px x 64px where each pixel is stored as a single `u8`
/// struct ExampleDisplay {
///     framebuffer: [u8; 64 * 64],
///     iface: SPI1,
/// }
///
/// impl ExampleDisplay {
///     /// Send buffer to the display
///     pub fn flush(&self) -> Result<(), ()> {
///         self.iface.send_bytes(&self.framebuffer)
///     }
/// }
///


 if admin user existed"),
  }
}

// channels

pub fn find_feed_by_url(url: &str) -> Option<Feed> {
  use schema::feeds::dsl::*;

  let pool = establish_pool();
  let connection = pool.get().unwrap();
  match feeds.filter(feed_link.eq(url)).first::<Feed>(&*connection) {
    Ok(ch) => Some(ch),
    Err(_) => None,
  }
}

pub fn get_feed_id(url: &str) -> Result<i32, diesel::result::Error> {
  use schema::feeds::dsl::*;

  let pool = establish_pool();
  let connection = pool.get().unwrap();
  feeds
    .filter(feed_link.eq(url))
    .select(id)
    .first(&*connection)
}

pub fn insert_channel(channel: NewFeed) -> Feed {
  let pool = establish_pool();
  let connection = pool.get().unwrap();

  diesel::insert_into(feeds::table)
    .values(&channel)
    .get_result::<Feed>(&*connection)
    .expect("Error saving new post")
}

// used during update loop
pub fn get_channel_urls_and_subscribers() -> Vec<(i32, String, Vec<i32>)> {
  let pool = establish_pool();
  let connection = pool.get().unwrap();

  let subscribed = subscribed_feeds::table
    .select((subscribed_feeds::feed_id, subscribed_feeds::user_id))
    .load::<(i32, i32)>(&*connection)
    .unwrap();

  let mut h: HashMap<i32, Vec<i32>> = HashMap::new();
  subscribed.iter().for_each(|x| {
    h.entry(x.0)
      .and_modify(|e| e.push(x.1))
      .or_insert(vec![x.1]);
  });

  // let feeds: Result<Vec<(i32, String, Vec<i32>)>, diesel::result::Error> = feeds::table
  //   .select((feeds::id, feeds::feed_link))
  //   .load::<(i32, String)>(&*connection)
  //   .map(|f| {
  //     f.into_iter()
  //       .map(|(i, u)| (i, u, h.remove(&i).unwrap()))
  //       .collect()
  //   });
  // info!("result: {:?}", feeds);

  let feeds = feeds::table
    .select((feeds::id, feeds::feed_link))
    .load::<(i32, String)>(&*connection)
    .unwrap();

  let res: Vec<(i32, String, Vec<i32>)> = feeds
    .into_iter()
    .map(|(i, u)| (i, u, h.remove(&i).unwrap()))
    .collect();
  res
}

//items

pub fn insert_items(items: &Vec<NewItem>) -> Option<Vec<Item>> {
  use schema::items;

  debug!("found {} new items", items.len());
  let pool = establish_pool();
  let connection = pool.get().unwrap();
  diesel::insert_into(items::table)
    .values(items)
    .get_results::<Item>(&*connection)
    .ok()
}

pub fn update_item(iid: i32, item: NewItem) {
  use schema::items::dsl::*;

  let pool = establish_pool();
  let connection = pool.get().unwrap();
  diesel::update(items.find(iid))
    .set((
      title.eq(item.title),
      link.eq(item.link),
      summary.eq(item.summary),
      published_at.eq(item.published_at),
      content.eq(item.content),
    )).execute(&*connection)
    .expect("failed to update item")


de" }
		}

		@Transient
		lateinit var modelIdentifier: Identifier
		fun bake(manager: ResourceManager) {
			modelIdentifier = bakeModel(model, layers)
		}
	}

	private fun resolveComponent(slot: EquipmentSlot, model: Identifier): EquippableComponent {
		return EquippableComponent(
			slot,
			null,
			Optional.of(RegistryKey.of(EquipmentAssetKeys.REGISTRY_KEY, model)),
			Optional.empty(),
			Optional.empty(),
			false,
			false,
			false,
			false,
			false,
			null
		)
	}

	// TODO: BipedEntityRenderer.getEquippedStack create copies of itemstacks for rendering. This means this cache is essentially useless
	// If i figure out how to circumvent this (maybe track the origin of those copied itemstacks in some sort of variable in the itemstack to track back the original instance) i should reenable this cache.
	// Then also re add this to the cache clearing function
	val overrideCache =
		WeakCache.dontMemoize<ItemStack, EquipmentSlot, Optional<EquippableComponent>>("ArmorOverrides") { stack, slot ->
			val id = stack.skyBlockId ?: return@dontMemoize Optional.empty()
			val override = overrides[id.neuItem] ?: return@dontMemoize Optional.empty()
			for (suboverride in override.overrides) {
				if (suboverride.predicate.test(stack)) {
					return@dontMemoize resolveComponent(slot, suboverride.modelIdentifier).intoOptional()
				}
			}
			return@dontMemoize resolveComponent(slot, override.modelIdentifier).intoOptional()
		}

	var overrides: Map<String, ArmorOverride> = mapOf()
	private var bakedOverrides: MutableMap<Identifier, EquipmentModel> = mutableMapOf()
	private val sentinelFirmRunning = AtomicInteger()

	private fun bakeModel(model: Identifier?, layers: List<ArmorOverrideLayer>?): Identifier {
		require(model == null || layers == null)
		if (model != null) {
			return model
		} else if (layers != null) {
			val idNumber = sentinelFirmRunning.incrementAndGet()
			val identifier = Identifier.of("firmament:sentinel/armor/$idNumber")
			val equipmentLayers = layers.map {
				EquipmentModel.Layer(
					it.identifier, if (it.tint) {
						Optional.of(EquipmentModel.Dyeable(Optional.of(0xFFA06540.toInt())))
					} else {
						Optional.empty()
					},
					false
				)
			}
			bakedOverrides[identifier] = EquipmentModel(
				mapOf(
					EquipmentModel.LayerType.HUMANOID to equipmentLayers,
					EquipmentModel.LayerType.HUMANOID_LEGGINGS to equipmentLayers,
				)
			)
			return identifier
		} else {
			error("Either model or layers must be non null")
		}
	}

	@Subscribe
	fun onStart(event: FinalizeResourceManagerEvent) {
		event.resourceManager.registerReloader(object :
			                                       SinglePreparationResourceReloader<Map<String, ArmorOverride>>() {
			override fun prepare(manager: ResourceManager, profiler: Profiler): Map<String, ArmorOverride> {
				val overrideFiles = manager.findResources("overrides/armor_models") {
					it.namespace == "firmskyblock" && it.path.endsWith(".json")
				}
				val overrides = overrideFiles.mapNotNull {
					Firmament.tryDecodeJsonFromStream<ArmorOverride>(it.value.inputStream).getOrElse { ex ->
						logger.error("Failed to load armor texture override at ${it.key}", ex)
						null
					}
				}
				bakedOverrides.clear()
				val associatedMap = overrides.flatMap { obj -> obj.itemIds.map { it to obj } }
					.


gif;base64,R0lGODlhCwAHAIAAACgoKP///yH5BAEAAAEALAAAAAALAAcAAAINjI+AC7rWHIsPtmoxLAA7);background-position:left center;background-repeat:no-repeat}.vakata-context-rtl .vakata-context-separator>a{margin:0 2.4em 0 0;border-left:0;border-right:1px solid #e2e3e3}.vakata-context-rtl .vakata-context-left ul{right:auto;left:100%;margin-left:-4px;margin-right:auto}.vakata-context-rtl li>a>i{margin:0 -2em 0 0}.vakata-context-rtl li>a .vakata-contextmenu-sep{margin:0 0 0 .5em;border-left-color:#fff;background:#e2e3e3}#jstree-marker{position:absolute;top:0;left:0;margin:-5px 0 0 0;padding:0;border-right:0;border-top:5px solid transparent;border-bottom:5px solid transparent;border-left:5px solid;width:0;height:0;font-size:0;line-height:0}#jstree-dnd{line-height:16px;margin:0;padding:4px}#jstree-dnd .jstree-icon,#jstree-dnd .jstree-copy{display:inline-block;text-decoration:none;margin:0 2px 0 0;padding:0;width:16px;height:16px}#jstree-dnd .jstree-ok{background:green}#jstree-dnd .jstree-er{background:red}#jstree-dnd .jstree-copy{margin:0 2px}.jstree-default .jstree-node,.jstree-default .jstree-icon{background-repeat:no-repeat;background-color:transparent}.jstree-default .jstree-anchor,.jstree-default .jstree-wholerow{transition:background-color .15s,box-shadow .15s}.jstree-default .jstree-hovered{background:#e7f4f9;border-radius:2px;box-shadow:inset 0 0 1px #ccc}.jstree-default .jstree-clicked{background:#beebff;border-radius:2px;box-shadow:inset 0 0 1px #999}.jstree-default .jstree-no-icons .jstree-anchor>.jstree-themeicon{display:none}.jstree-default .jstree-disabled{background:0 0;color:#666}.jstree-default .jstree-disabled.jstree-hovered{background:0 0;box-shadow:none}.jstree-default .jstree-disabled.jstree-clicked{background:#efefef}.jstree-default .jstree-disabled>.jstree-icon{opacity:.8;filter:url("data:image/svg+xml;utf8,<svg xmlns=\'http://www.w3.org/2000/svg\'><filter id=\'jstree-grayscale\'><feColorMatrix type=\'matrix\' values=\'0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0 0 0 1 0\'/></filter></svg>#jstree-grayscale");filter:gray;-webkit-filter:grayscale(100%)}.jstree-default .jstree-search{font-style:italic;color:#8b0000;font-weight:700}.jstree-default .jstree-no-checkboxes .jstree-checkbox{display:none!important}.jstree-default.jstree-checkbox-no-clicked .jstree-clicked{background:0 0;box-shadow:none}.jstree-default.jstree-checkbox-no-clicked .jstree-clicked.jstree-hovered{background:#


lic void test4933() {
    check( //
        "Integrate[1/Sqrt[2 + 2*x^2 - 3*x^4], x]", //
        "EllipticF[ArcSin[Sqrt[3/(1 + Sqrt[7])]*x], (-4 - Sqrt[7])/3]/Sqrt[-1 + Sqrt[7]]", //
        1109, 430);
  }

  // {1109, 430}
  public void test4934() {
    check( //
        "Integrate[1/Sqrt[2 + x^2 - 3*x^4], x]", //
        "EllipticF[ArcSin[x], -3/2]/Sqrt[2]", //
        1109, 430);
  }

  // {1109, 430}
  public void test4935() {
    check( //
        "Integrate[1/Sqrt[2 - x^2 - 3*x^4], x]", //
        "EllipticF[ArcSin[Sqrt[3/2]*x], -2/3]/Sqrt[3]", //
        1109, 430);
  }

  // {1109, 430}
  public void test4936() {
    check( //
        "Integrate[1/Sqrt[2 - 2*x^2 - 3*x^4], x]", //
        "EllipticF[ArcSin[Sqrt[3/(-1 + Sqrt[7])]*x], (-4 + Sqrt[7])/3]/Sqrt[1 + Sqrt[7]]", //
        1109, 430);
  }

  // {1109, 430}
  public void test4937() {
    check( //
        "Integrate[1/Sqrt[2 - 3*x^2 - 3*x^4], x]", //
        "Sqrt[2/(3 + Sqrt[33])]*EllipticF[ArcSin[Sqrt[6/(-3 + Sqrt[33])]*x], (-7 + Sqrt[33])/4]", //
        1109, 430);
  }

  // {1109, 430}
  public void test4938() {
    check( //
        "Integrate[1/Sqrt[2 - 4*x^2 - 3*x^4], x]", //
        "Sqrt[(-2 + Sqrt[10])/6]*EllipticF[ArcSin[Sqrt[(2 + Sqrt[10])/2]*x], (-7 + 2*Sqrt[10])/3]", //
        1109, 430);
  }

  // {1109, 430}
  public void test4939() {
    check( //
        "Integrate[1/Sqrt[2 - 5*x^2 - 3*x^4], x]", //
        "EllipticF[ArcSin[Sqrt[3]*x], -1/6]/Sqrt[6]", //
        1109, 430);
  }

  // {1109, 430}
  public void test4940() {
    check( //
        "Integrate[1/Sqrt[3 + 7*x^2 - 2*x^4], x]", //
        "Sqrt[2/(-7 + Sqrt[73])]*EllipticF[ArcSin[(2*x)/Sqrt[7 + Sqrt[73]]], (-61 - 7*Sqrt[73])/12]", //
        1109, 430);
  }

  // {1109, 430}
  public void test4941() {
    check( //
        "Integrate[1/Sqrt[3 + 6*x^2 - 2*x^4], x]", //
        "Sqrt[(3 + Sqrt[15])/6]*EllipticF[ArcSin[Sqrt[(-3 + Sqrt[15])/3]*x], -4 - Sqrt[15]]", //
        1109, 430);
  }

  // {1109, 430}


str,
                 x        : f32,
                 y        : f32,
                 text     : &str )
{
    unsafe{
        let filename1 = CString::new("examples/images/".to_owned()+filename).unwrap();

        let page = HPDF_GetCurrentPage (pdf);

        let image = HPDF_LoadJpegImageFromFile (pdf, CString::new(filename1).unwrap().as_ptr());

        /* Draw image to the canvas. */
        HPDF_Page_DrawImage (page, image, x, y, HPDF_Image_GetWidth (image) as f32,
                    HPDF_Image_GetHeight (image) as f32);

        /* Print the text. */
        HPDF_Page_BeginText (page);
        HPDF_Page_SetTextLeading (page, 16.0);
        HPDF_Page_MoveTextPos (page, x, y);
        HPDF_Page_ShowTextNextLine (page, CString::new(filename).unwrap().as_ptr());
        HPDF_Page_ShowTextNextLine (page, CString::new(text).unwrap().as_ptr());
        HPDF_Page_EndText (page);
    }
}

fn main ()
{
    unsafe{
        let fname = CString::new("TEST.pdf").unwrap();

        let mut pdf = HPDF_New (error_handler, ptr::null_mut());
        if (pdf == ptr::null_mut()) {
            println! ("error: cannot create PdfDoc object\n");
            panic!("")
        }

        HPDF_SetCompressionMode (pdf, HPDF_COMP_ALL);

        /* create default-font */
        let font = HPDF_GetFont (pdf, CString::new("Helvetica").unwrap().as_ptr(), ptr::null_mut());

        /* add a new page object. */
        let mut page = HPDF_AddPage (pdf);

        HPDF_Page_SetWidth (page, 650.0);
        HPDF_Page_SetHeight (page, 500.0);

        let dst = HPDF_Page_CreateDestination (page);
        HPDF_Destination_SetXYZ (dst, 0.0, HPDF_Page_GetHeight (page), 1.0);
        HPDF_SetOpenAction(pdf, dst);

        HPDF_Page_BeginText (page);
        HPDF_Page_SetFontAndSize (page, font, 20.0);
        HPDF_Page_MoveTextPos (page, 220.0, HPDF_Page_GetHeight (page) - 70.0);
        HPDF_Page_ShowText (page, CString::new("JpegDemo").unwrap().as_ptr());
        HPDF_Page_EndText (page);

        HPDF_Page_SetFontAndSize (page, font, 12.0);

        draw_image (pdf, "rgb.jpg", 70.0, HPDF_Page_GetHeight (page) - 410.0,
                    "24bit color image");
        draw_image (pdf, "gray.jpg", 340.0, HPDF_Page_GetHeight (page) - 410.0,
                    "8bit grayscale image");

        /* save the document to a file */
        HPDF_SaveToFile (pdf, fname.as_ptr());

        /* clean up */
        HPDF_Free (pdf);
    }
}

use aoc_2020::input_file;
use std::collections::HashMap;
use std::fs;

type Bags = HashMap<String, Vec<(u32, String)>>;

fn parse(input: &str) -> Bags {
    let mut bags = HashMap::new();

    for line in input.lines() {
        if let [first, second, rest @ ..] =
            line.split_whitespace().collect::<Vec<&str>>().as_slice()
        {
            let inner_bags = rest
                .windows(3)
                .map(|slice| {
                    Some((
                        slice[0].parse().ok()?,
                        format!("{} {}", slice[1], slice[2])


ck() falls back to Default before initializeCache()
	epoch := g.epochWithFallback()
	blockNum := CalcGovernanceInfoBlock(num, epoch)

	// Check cache first
	if gBlockNum, ok := g.searchCache(blockNum); ok {
		if data, okay := g.getGovernanceCache(gBlockNum); okay {
			return gBlockNum, data, nil
		}
	}
	if g.db != nil {
		bn, result, err := g.db.ReadGovernanceAtNumber(num, epoch)
		result = adjustDecodedSet(result)
		return bn, result, err
	} else {
		// For CI tests which don't have a database
		return 0, nil, nil
	}
}

func CalcGovernanceInfoBlock(num uint64, epoch uint64) uint64 {
	governanceInfoBlock := num - (num % epoch)
	if governanceInfoBlock >= epoch {
		governanceInfoBlock -= epoch
	}
	return governanceInfoBlock
}

func (g *Governance) GetGovernanceChange() map[string]interface{} {
	if g.changeSet.Size() > 0 {
		return g.changeSet.Items()
	}
	return nil
}

// WriteGovernanceForNextEpoch creates governance items for next epoch and writes them to the database.
// The governance items on next epoch will be the given `governance` items applied on the top of past epoch items.
func (gov *Governance) WriteGovernanceForNextEpoch(number uint64, governance []byte) {
	var epoch uint64
	var ok bool

	if epoch, ok = gov.GetGovernanceValue(params.Epoch).(uint64); !ok {
		if epoch, ok = gov.GetGovernanceValue(params.CliqueEpoch).(uint64); !ok {
			logger.Error("Couldn't find epoch from governance items")
			return
		}
	}

	// Store updated governance information if exist
	if number%epoch == 0 {
		if len(governance) > 0 {
			tempData := []byte("")
			tempItems := make(map[string]interface{})
			tempSet := NewGovernanceSet()
			if err := rlp.DecodeBytes(governance, &tempData); err != nil {
				logger.Error("Failed to decode governance data", "number", number, "err", err, "data", governance)
				return
			}
			if err := json.Unmarshal(tempData, &tempItems); err != nil {
				logger.Error("Failed to unmarshal governance data", "number", number, "err", err, "data", tempData)
				return

			}
			tempItems = adjustDecodedSet(tempItems)
			tempSet.Import(tempItems)

			_, govItems, err := gov.ReadGovernance(number)
			if err != nil {
				logger.Error("Failed to read governance", "number", number, "err", err)
				return
			}
			govSet := NewGovernanceSet()
			govSet.Import(govItems)

			// Store new governance items for next epoch to governance database
			if err := gov.WriteGovernance(number, govSet, tempSet); err != nil {
				logger.Crit("Failed to store new governance data", "number", number, "err", err)
			}
		}
	}
}

func (gov *Governance) removeDuplicatedVote(vote *GovernanceVote, number uint64) {
	gov.RemoveVote(vote.Key, vote.Value, number)
}

func (gov *Governance) UpdateCurrentSet(num uint64) {
	newNumber, newGovernanceSet, _ := gov.ReadGovernance(num)
	// Do the change only when the governance actually changed
	if newGovernanceSet != nil && newNumber > gov.actualGovernanceBlock.Load().(uint64) {
		gov.actualGovernanceBlock.Store(newNumber)
		gov.currentSet.Import(newGovernanceSet)
		gov.triggerChange(newGovernanceSet)
	}
}

func (gov *Governance) triggerChange


(Ui::MakeConfirmBox({
		.text = tr::lng_stickers_remove_group_set(),
		.confirmed = crl::guard(this, [this, group = _megagroupSet](
				Fn<void()> &&close) {
			Expects(group->mgInfo != nullptr);

			if (group->mgInfo->stickerSet) {
				session().api().setGroupStickerSet(group, {});
			}
			close();
		}),
		.cancelled = [](Fn<void()> &&close) { close(); },
		.labelStyle = &st().boxLabel,
	}));
}

void StickersListWidget::removeSet(uint64 setId) {
	const auto &st = this->st().boxLabel;
	if (setId == Data::Stickers::MegagroupSetId) {
		const auto &sets = shownSets();
		const auto i = ranges::find(sets, setId, &Set::id);
		Assert(i != end(sets));
		const auto removeLocally = i->stickers.empty()
			|| !_megagroupSet->canEditStickers();
		removeMegagroupSet(removeLocally);
	} else if (auto box = MakeConfirmRemoveSetBox(&session(), st, setId)) {
		checkHideWithBox(std::move(box));
	}
}

const Data::StickersSetsOrder &StickersListWidget::defaultSetsOrder() const {
	return _isMasks
		? session().data().stickers().maskSetsOrder()
		: session().data().stickers().setsOrder();
}

Data::StickersSetsOrder &StickersListWidget::defaultSetsOrderRef() {
	return _isMasks
		? session().data().stickers().maskSetsOrderRef()
		: session().data().stickers().setsOrderRef();
}

bool StickersListWidget::mySetsEmpty() const {
	return _mySets.empty();
}

StickersListWidget::~StickersListWidget() = default;

object_ptr<Ui::BoxContent> MakeConfirmRemoveSetBox(
		not_null<Main::Session*> session,
		const style::FlatLabel &st,
		uint64 setId) {
	const auto &sets = session->data().stickers().sets();
	const auto it = sets.find(setId);
	if (it == sets.cend()) {
		return nullptr;
	}
	const auto set = it->second.get();
	const auto text = tr::lng_stickers_remove_pack(
		tr::now,
		lt_sticker_pack,
		set->title);
	return Ui::MakeConfirmBox({
		.text = text,
		.confirmed = [=](Fn<void()> &&close) {
			close();
			const auto &sets = session->data().stickers().sets();
			const auto it = sets.find(setId);
			if (it != sets.cend()) {
				const auto set = it->second.get();
				if (set->id && set->accessHash) {
					session->api().request(MTPmessages_UninstallStickerSet(
						MTP_inputStickerSetID(
							MTP_long(set->id),
							MTP_long(set->accessHash)))
					).send();
				} else if (!set->shortName.isEmpty()) {
					session->api().request(MTPmessages_UninstallStickerSet(
						MTP_inputStickerSetShortName(
							MTP_string(set->shortName)))
					).send();
				}
				auto writeRecent = false;
				auto &recent = session->data().stickers().getRecentPack();
				for (auto i = recent.begin(); i != recent.cend();) {
					if (set->stickers.indexOf(i->first) >= 0) {
						i = recent.erase(i);
						writeRecent = true;
					} else {
						++i;
					}
				}
				set->flags &= ~SetFlag::Installed;
				set->installDate = TimeId(0);
				auto &orderRef = (set->type() == Data::StickersType::Emoji)
					? session->data(


.24-4.24 1.41 1.41L10.94 18zM13 9V3.5L18.5 9H13z"},child:[]}]})(t)}function g(t){return(0,c.w_)({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M18 13c-2.76 0-5 2.24-5 5s2.24 5 5 5 5-2.24 5-5-2.24-5-5-5zm3 5.5h-2.5V21h-1v-2.5H15v-1h2.5V15h1v2.5H21v1zM7 5h13v2H7z"},child:[]},{tag:"circle",attr:{cx:"3.5",cy:"18",r:"1.5"},child:[]},{tag:"path",attr:{d:"M18 11H7v2h6.11c1.26-1.24 2.99-2 4.89-2zM7 17v2h4.08c-.05-.33-.08-.66-.08-1s.03-.67.08-1H7z"},child:[]},{tag:"circle",attr:{cx:"3.5",cy:"6",r:"1.5"},child:[]},{tag:"circle",attr:{cx:"3.5",cy:"12",r:"1.5"},child:[]}]})(t)}function u(t){return(0,c.w_)({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M3 17.25V21h3.75L17.81 9.94l-3.75-3.75L3 17.25zM20.71 7.04a.996.996 0 0 0 0-1.41l-2.34-2.34a.996.996 0 0 0-1.41 0l-1.83 1.83 3.75 3.75 1.83-1.83z"},child:[]}]})(t)}function o(t){return(0,c.w_)({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"M20.11 8 23 3H1l2.89 5zM7.95 15 12 22l4.05-7zM18.95 10H5.05l1.74 3h10.42z"},child:[]}]})(t)}function f(t){return(0,c.w_)({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0V0z"},child:[]},{tag:"path",attr:{d:"M20 2H4c-1.1 0-1.99.9-1.99 2L2 22l4-4h14c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm0 14H5.17l-.59.59-.58.58V4h16v12zm-9-4h2v2h-2zm0-6h2v4h-2z"},child:[]}]})(t)}function H(t){return(0,c.w_)({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0V0z"},child:[]},{tag:"path",attr:{d:"M5 2c0-.55-.45-1-1-1s-1 .45-1 1v4H1v10c0 1.3.84 2.


.club.v1.membership.AdvanceStreamMentionViewTimeRequest)
  // optional .bgs.protocol.account.v1.AccountId agent_id = 1;
  if (has_agent_id()) {
    target = ::google::protobuf::internal::WireFormatLite::
      WriteMessageNoVirtualToArray(
        1, this->agent_id(), target);
  }

  if (!unknown_fields().empty()) {
    target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
        unknown_fields(), target);
  }
  // @@protoc_insertion_point(serialize_to_array_end:bgs.protocol.club.v1.membership.AdvanceStreamMentionViewTimeRequest)
  return target;
}

int AdvanceStreamMentionViewTimeRequest::ByteSize() const {
  int total_size = 0;

  if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
    // optional .bgs.protocol.account.v1.AccountId agent_id = 1;
    if (has_agent_id()) {
      total_size += 1 +
        ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
          this->agent_id());
    }

  }
  if (!unknown_fields().empty()) {
    total_size +=
      ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
        unknown_fields());
  }
  GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
  _cached_size_ = total_size;
  GOOGLE_SAFE_CONCURRENT_WRITES_END();
  return total_size;
}

void AdvanceStreamMentionViewTimeRequest::MergeFrom(const ::google::protobuf::Message& from) {
  GOOGLE_CHECK_NE(&from, this);
  const AdvanceStreamMentionViewTimeRequest* source =
    ::google::protobuf::internal::dynamic_cast_if_available<const AdvanceStreamMentionViewTimeRequest*>(
      &from);
  if (source == NULL) {
    ::google::protobuf::internal::ReflectionOps::Merge(from, this);
  } else {
    MergeFrom(*source);
  }
}

void AdvanceStreamMentionViewTimeRequest::MergeFrom(const AdvanceStreamMentionViewTimeRequest& from) {
  GOOGLE_CHECK_NE(&from, this);
  if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) {
    if (from.has_agent_id()) {
      mutable_agent_id()->::bgs::protocol::account::v1::AccountId::MergeFrom(from.agent_id());
    }
  }
  mutable_unknown_fields()->MergeFrom(from.unknown_fields());
}

void AdvanceStreamMentionViewTimeRequest::CopyFrom(const ::google::protobuf::Message& from) {
  if (&from == this) return;
  Clear();
  MergeFrom(from);
}

void AdvanceStreamMentionViewTimeRequest::CopyFrom(const AdvanceStreamMentionViewTimeRequest& from) {
  if (&from == this) return;
  Clear();
  MergeFrom(from);
}

bool AdvanceStreamMentionViewTimeRequest::IsInitialized() const {

  if (has_agent_id()) {
    if (!this->agent_id().IsInitialized()) return false;
  }
  return true;
}

void AdvanceStreamMentionViewTimeRequest::Swap(AdvanceStreamMentionViewTimeRequest* other) {
  if (other != this) {
    std::swap(agent_id_, other->agent_id_);
    std::swap(_has_bits_[0], other->_has_bits_[0]);
    _unknown_fields_.Swap(&other->_unknown_fields_);
    std::swap(_cached_size_, other->_cached_size_);
  }
}

::google::protobuf::Metadata AdvanceStreamMentionViewTimeRequest::GetMetadata() const {
  protobuf_AssignDescriptorsOnce();
  ::google::protobuf::Metadata metadata;
  metadata.descriptor = AdvanceStreamMentionViewTimeRequest_descriptor_;
  metadata.reflection = AdvanceStreamMentionViewTimeRequest_reflection_;
  return metadata;
}

// ===================================================================

ClubMembershipService::ClubMembershipService(bool use_original_hash) : service_hash_(use_original_hash ? OriginalHash::value : NameHash::value) {
}

ClubMembershipServic


y.TryToCreatePath(settings.ProjectGameModsFullPath)) {
                    return UniTask.FromResult(StepResult.Failure);
                }

                if (!PatcherUtility.TryToCreatePath(Path.Combine(settings.ProjectGameModsFullPath, "plugins"))) {
                    return UniTask.FromResult(StepResult.Failure);
                }

                if (!PatcherUtility.TryToCreatePath(settings.ProjectGameToolsFullPath)) {
                    return UniTask.FromResult(StepResult.Failure);
                }

                var assetsPath = settings.ProjectGameAssetsPath;
                var arSettings = this.GetAssetRipperSettings();

                // unsort folders so the path matching works properly
                SortAssetTypesSteps.UnsortFolder(assetsPath, "MonoBehaviour", "ScriptableObject", arSettings);
                SortAssetTypesSteps.UnsortFolder(assetsPath, "PrefabInstance", "Prefab", arSettings);
            } catch {
                Debug.LogError("Failed to create default project paths");
                throw;
            }

            return UniTask.FromResult(StepResult.Success);
        }

        public void OnComplete(bool failed) { }
    }
}


// lpBuf2 is ignored.
			PRINTACTION_PROPERTIES			= 1,	// The properties for the printer specified by the name in lpBuf1
													// will be displayed. lpBuf2 can either be NULL or specify.
			PRINTACTION_NETINSTALL			= 2,	// The network printer specified by the name in lpBuf1 will be
													// installed. lpBuf2 is ignored.
			PRINTACTION_NETINSTALLLINK		= 3,	// A shortcut to the network printer specified by the name in lpBuf1
													// will be created. lpBuf2 specifies the drive and path of the folder
													// in which the shortcut will be created. The network printer must
													// have already been installed on the local computer.
			PRINTACTION_TESTPAGE			= 4,	// A test page will be printed on the printer specified by the name
													// in lpBuf1. lpBuf2 is ignored.
			PRINTACTION_OPENNETPRN			= 5,	// The network printer specified by the name in lpBuf1 will be
													// opened. lpBuf2 is ignored.
			PRINTACTION_DOCUMENTDEFAULTS	= 6,	// Microsoft Windows NT only. The default document properties for
													// the printer specified by the name in lpBuf1 will be displayed.
													// lpBuf2 is ignored.
			PRINTACTION_SERVERPROPERTIES	= 7		// Windows NT only. The properties for the server of the printer
													// specified by the name in lpBuf1 will be displayed. lpBuf2
													// is ignored.
		}

	}

}


        if (header == null) {

            byte[] bytes = htsgetReader.readHeader();
            if (bytes != null && bytes.length >= 2 && bytes[0] == (byte) 0x1F && bytes[1] == (byte) 0x8B) {
                BlockCompressedInputStream bis = new BlockCompressedInputStream(new ByteArrayInputStream(bytes));
                bytes = bis.readAllBytes();
            }
            String headerText = new String(bytes);

            LineIterator iter = new LineIteratorImpl(new StringLineReader(headerText));
            header = (VCFHeader) codec.readActualHeader(iter);

            // We need to parse the vcf version, its not in the header read by the codec. Perhaps an htsjdk bug?
            String formatLine = headerText.split("\\R")[0];
            VCFHeaderVersion version = VCFHeaderVersion.getHeaderVersion(formatLine);
            codec.setVCFHeader(header, version);
        }
        return header;

    }
}

class StringLineReader implements LineReader {

    String[] lines;
    int lineNumber;

    public StringLineReader(String text) {
        this.lines = text.split("\\R");
        this.lineNumber = 0;
    }

    @Override
    public String readLine() throws IOException {
        if (lineNumber < lines.length) {
            return lines[lineNumber++];
        } else {
            return null;
        }

    }

    @Override
    public void close() {

    }
}
/*
 * The MIT License (MIT)
 *
 * Copyright (c) 2007-2015 Broad Institute
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 */

package org.broad.igv.util;

/**
 * User: jrobinso
 * Date: Feb 21, 2010
 */
public class SOLIDUtils {
    /**
     * Return the sequence in Color Space (SOLID alignment encoding)
     */
    public static byte[] convertToColorSpace(byte[] baseSequence) {
        // We need to know the base just to the left of the start

        if (baseSequence == null || baseSequence.length == 0) {
            return baseSequence;
        }

        byte[] csSequence = new byte[baseSequence.length];
        // Can't know the first base
        csSequence[0] = baseSequence[0]; //
        int c1 = baseToCS(baseSequence[0]);
        for (int i = 1; i < baseSequence.length; i++) {
            int c2 = baseToCS(baseSequence[i]);
            if (c2 == 4 && c1 != 4) {
              csSequence[i] = 4;
            } else if (c1 == 4 && c2 != 4) {
              csSequence[i] = 5;
            } else if (c1 == 4 && c2 == 4) {
             csSequence[i] = 6;
            } else {
                csSequence[i] = (byte) (c1 ^ c2);
            }
            c1 = c2;
        }
        return csSequence;

    }

    public static int baseToCS(byte base) {
        switch (base) {
            case 'A':
            case 'a':
                return 0;
            case 'C':


	.bundle_unlock
.endr
.bundle_align_mode 0
.org idt_irq_vector_stubs + (APIC_IRQ_BASE - 0x28) * 16

.previous

.p2align 4
.type	.Lall_irqs, @function
.type	__generic_irq_entry, @function
.global	__generic_irq_entry
.Lall_irqs:
__generic_irq_entry:
	cld
	pushl	%edx
	pushl	%ecx
	RESET_KERNEL_SEGMENTS_FORCE_DS_ES
	movl	12(%esp), %edx          /* ARG2: eip */
	call	irq_interrupt           /* Enter with disabled irqs */
in_interrupt:
	CHECK_SANITY 16(%esp)           /* Scratches ecx */
	popl	%ecx
	popl	%edx
	popl	%eax

entry_int_pic_ignore:
	iret

.global	entry_int_pic_ignore
.global	entry_int7
.global	entry_intf

/* System calls */

GATE_ENTRY	0x30, entry_sys_ipc_c, (ACC_PL_U | ACC_INTR_GATE)

.p2align 4
.globl	entry_sys_ipc_c
entry_sys_ipc_c:
	cld
	pushl	%eax
	SAVE_STATE
	RESET_KERNEL_SEGMENTS_FORCE_DS_ES
	ESP_TO_TCB_AT %ebx
	testl	$VAL__Thread_alien_or_vcpu_user, OFS__THREAD__STATE (%ebx)
	jnz	.Lalien_or_vcpu_user_sys_ipc_c
	RESET_THREAD_CANCEL_AT %ebx
	call	sys_ipc_wrapper         /* ipc_short_cut_wrapper */
in_sc_ipc1:
	CHECK_SANITY $3                 /* Scratches ecx */
	RESTORE_STATE_AFTER_IPC
	popl	%eax
	iret

.globl	in_sc_ipc1

#ifdef CONFIG_JDB
/* The slow variant of sys_ipc_entry is used when logging IPC */
.p2align 4
.globl	entry_sys_ipc_log
entry_sys_ipc_log:
	cld
	pushl	%eax
	SAVE_STATE
	RESET_KERNEL_SEGMENTS_FORCE_DS_ES
	ESP_TO_TCB_AT %ebx
	testl	$VAL__Thread_alien_or_vcpu_user, OFS__THREAD__STATE (%ebx)
	jnz	.Lalien_or_vcpu_user_sys_ipc_log
	RESET_THREAD_CANCEL_AT %ebx
	call	*syscall_table
in_slow_ipc4:
	CHECK_SANITY $3                 /* Scratches ecx */
	RESTORE_STATE_AFTER_IPC
	popl	%eax
	iret

.globl	in_slow_ipc4
#endif // CONFIG_JDB

/* These labels help show_tcb to guess the thread state */
.globl	in_slowtrap
.globl	in_page_fault
.globl	in_handle_fputrap
.globl	in_interrupt
.globl	in_timer_interrupt
.globl	in_timer_interrupt_slow

/* These functions are implemented in entry-native.S */
GATE_ENTRY	0x0a, entry_vec0a_invalid_tss, (ACC_PL_K | ACC_INTR_GATE)
GATE_ENTRY	0x0f, entry_vec0f_apic_spurious_interrupt_bug, (ACC_PL_K | ACC_INTR_GATE)
GATE_ENTRY	(APIC_IRQ_BASE + 3), entry_apic_error_interrupt, (ACC_PL_K | ACC_INTR_GATE)
GATE_ENTRY	(APIC_IRQ_BASE + 4), entry_apic_spurious_interrupt, (ACC_PL_K | ACC_INTR_GATE)

#ifdef CONFIG_MP
GATE_ENTRY	(APIC_IRQ_BASE + 2), entry_ipi, (ACC_PL_K | ACC_INTR_GATE)
GATE_


 = false;
    update();
  }
}
// Package imports:
import 'package:flutter_neumorphic_plus/flutter_neumorphic.dart';

// Project imports:
import 'package:analog_clock/src/public/constants.dart';

class PickDay extends StatefulWidget {
  const PickDay({super.key});

  @override
  State<StatefulWidget> createState() => _PickDayState();
}

class _PickDayState extends State<PickDay> {
  List<String> values = ['M', 'T', 'W', 'T', 'F', 'S', 'S'];
  List<bool> picked = List.generate(7, (index) => index < 3);

  pickDay(index) {
    setState(() {
      picked[index] = !picked[index];
    });
  }

  @override
  Widget build(BuildContext context) {
    return Container(
      padding: const EdgeInsets.symmetric(horizontal: 10.0),
      child: Row(
        mainAxisAlignment: MainAxisAlignment.spaceBetween,
        children: [
          _buildAction(context, 0),
          _buildAction(context, 1),
          _buildAction(context, 2),
          _buildAction(context, 3),
          _buildAction(context, 4),
          _buildAction(context, 5),
          _buildAction(context, 6),
        ],
      ),
    );
  }

  Widget _buildAction(context, index) {
    return Container(
      height: width / 8,
      width: width / 8,
      alignment: Alignment.center,
      child: NeumorphicButton(
        onPressed: () => pickDay(index),
        style: NeumorphicStyle(
          shape: NeumorphicShape.convex,
          boxShape: const NeumorphicBoxShape.circle(),
          depth: 6.0,
          intensity: .25,
          color: picked[index]
              ? Theme.of(context).primaryColor
              : Theme.of(context).colorScheme.secondary,
        ),
        child: Text(
          values[index],
          style: Theme.of(context).textTheme.displayMedium?.copyWith(
                fontSize: width / 23.0,
                fontFamily: 'Lato',
                fontWeight: FontWeight.w400,
              ),
        ),
      ),
    );
  }
}
// ignore_for_file: depend_on_referenced_packages

// Dart imports:
import 'dart:io';

// Flutter imports:
import 'package:flutter/services.dart';

// Package imports:
import 'package:path_provider/path_provider.dart';

// Project imports:
import 'package:streamskit_mobile/core/util/logger.dart';

class PathHelper {
  static Future<void> deleteCacheImageDir(String path) async {
    final cacheDir = Directory(path);
    if (cacheDir.existsSync()) {
      cacheDir.deleteSync(recursive: true);
    }
  }

  static Future<void> createDirStreamOS() async {
    String tempAskanyDir = await tempDirStreamOS;
    String localStoreAskanyDir = await localStoreDirStreamOS;
    Directory myDir = Directory(tempAskanyDir);
    Directory localDir = Directory(localStoreAskanyDir);
    if (!myDir.existsSync()) {
      await myDir.create();
    }

    if (!localDir.existsSync()) {
      await localDir.create();
    }
  }

  static Future<String> get tempDirStreamOS async =>
      '${(await getTemporaryDirectory()).path}/streamOS';

  static Future<String> get localStoreDirStreamOS async =>
      '${(await getTemporaryDirectory()).path}/hive';

  static Future<Directory> get appDir async =>
      await getApplicationDocumentsDirectory();

  static Future<Directory?> get downloadsDir async {


slot_select_0 = 0;
    let mut profile_slot_select_1 = 0;
    let code = c_MotController_GetMotionProfileStatus_2(
        handle,
        raw_field!(status_to_fill, MotionProfileStatus, top_buffer_rem) as *mut _,
        raw_field!(status_to_fill, MotionProfileStatus, top_buffer_cnt) as *mut _,
        raw_field!(status_to_fill, MotionProfileStatus, btm_buffer_cnt) as *mut _,
        raw_field!(status_to_fill, MotionProfileStatus, has_underrun) as *mut _,
        raw_field!(status_to_fill, MotionProfileStatus, is_underrun) as *mut _,
        raw_field!(status_to_fill, MotionProfileStatus, active_point_valid) as *mut _,
        raw_field!(status_to_fill, MotionProfileStatus, is_last) as *mut _,
        &mut profile_slot_select_0,
        &mut output_enable,
        raw_field!(status_to_fill, MotionProfileStatus, time_dur_ms) as *mut _,
        &mut profile_slot_select_1,
    );
    (*status_to_fill).output_enable = output_enable.into();
    (*status_to_fill).profile_slot_select_0 = profile_slot_select_0;
    (*status_to_fill).profile_slot_select_1 = profile_slot_select_1;
    code
}

/// Base motor controller features for all CTRE CAN motor controllers.
///
/// This trait is sealed and cannot be implemented for types outside this crate.
pub trait MotorController: private::Sealed {
    #[doc(hidden)]
    fn handle(&self) -> Handle;
    #[doc(hidden)]
    fn base_id(&self) -> i32;
    fn device_id(&self) -> i32 {
        cci_get_only!(c_MotController_GetDeviceNumber(self.handle(), _: i32))
    }

    /**
     * # Parameters
     *
     * - `mode`: Sets the appropriate output on the talon, depending on the mode.
     * - `demand0`: The output value to apply.
     *   such as advanced feed forward and/or auxiliary close-looping in firmware.
     *   * In PercentOutput, the output is between -1.0 and 1.0, with 0.0 as stopped.
     *   * In Current mode, output value is in amperes.
     *   * In Velocity mode, output value is in position change / 100ms.
     *   * In Position mode, output value is in encoder ticks or an analog value,
     *     depending on the sensor. See
     *   * In Follower mode, the output value is the integer device ID of the talon to duplicate.
     * - `demand1`: Supplmental output value.  Units match the set mode.
     *
     * # Examples
     *
     * Standard Driving Example:
     * ```
     * # use ctre::mot::prelude::*;
     * let mut talon_left = TalonSRX::new(0);
     * let mut talon_rght = TalonSRX::new(1);
     * # let left_joy = 0.5;
     * # let rght_joy = 0.5;
     * talon_left.set(ControlMode::PercentOutput, left_joy, Demand::Neutral);
     * talon_rght.set(ControlMode::PercentOutput, rght_joy, Demand::Neutral);
     * ```
     *
     * Arcade Drive Example:
     * ```
     * # use ctre::mot::prelude::*;
     * let mut talon_left = TalonSRX::new(0);
     * let mut talon_rght = TalonSRX::new(1);
     * # let joy_fwd = 0.5;
     * # let joy_turn = 0.1;
     * talon_left.set(ControlMode::PercentOutput, joy_fwd, Demand::ArbitraryFeedForward(joy_turn));
     * talon_rght.set(ControlMode::PercentOutput, joy_fwd, Demand::ArbitraryFeedForward(-joy_turn));
     * ```
     *
     * Drive Straight E


Shr_rm64_1 = 451,
	/// `SAL r/m16, 1`
	///
	/// `o16 D1 /6`
	///
	/// `8086+`
	///
	/// `16/32/64-bit`
	Sal_rm16_1 = 452,
	/// `SAL r/m32, 1`
	///
	/// `o32 D1 /6`
	///
	/// `386+`
	///
	/// `16/32/64-bit`
	Sal_rm32_1 = 453,
	/// `SAL r/m64, 1`
	///
	/// `o64 D1 /6`
	///
	/// `X64`
	///
	/// `64-bit`
	Sal_rm64_1 = 454,
	/// `SAR r/m16, 1`
	///
	/// `o16 D1 /7`
	///
	/// `8086+`
	///
	/// `16/32/64-bit`
	Sar_rm16_1 = 455,
	/// `SAR r/m32, 1`
	///
	/// `o32 D1 /7`
	///
	/// `386+`
	///
	/// `16/32/64-bit`
	Sar_rm32_1 = 456,
	/// `SAR r/m64, 1`
	///
	/// `o64 D1 /7`
	///
	/// `X64`
	///
	/// `64-bit`
	Sar_rm64_1 = 457,
	/// `ROL r/m8, CL`
	///
	/// `D2 /0`
	///
	/// `8086+`
	///
	/// `16/32/64-bit`
	Rol_rm8_CL = 458,
	/// `ROR r/m8, CL`
	///
	/// `D2 /1`
	///
	/// `8086+`
	///
	/// `16/32/64-bit`
	Ror_rm8_CL = 459,
	/// `RCL r/m8, CL`
	///
	/// `D2 /2`
	///
	/// `8086+`
	///
	/// `16/32/64-bit`
	Rcl_rm8_CL = 460,
	/// `RCR r/m8, CL`
	///
	/// `D2 /3`
	///
	/// `8086+`
	///
	/// `16/32/64-bit`
	Rcr_rm8_CL = 461,
	/// `SHL r/m8, CL`
	///
	/// `D2 /4`
	///
	/// `8086+`
	///
	/// `16/32/64-bit`
	Shl_rm8_CL = 462,
	/// `SHR r/m8, CL`
	///
	/// `D2 /5`
	///
	/// `8086+`
	///
	/// `16/32/64-bit`
	Shr_rm8_CL = 463,
	/// `SAL r/m8, CL`
	///
	/// `D2 /6`
	///
	/// `8086+`
	///
	/// `16/32/64-bit`
	Sal_rm8_CL = 464,
	/// `SAR r/m8, CL`
	///
	/// `D2 /7`
	///
	/// `8086+`
	///
	/// `16/32/64-bit`
	Sar_rm8_CL = 465,
	/// `ROL r/m16, CL`
	///
	/// `o16 D3 /0`
	///
	/// `8086+`
	///
	/// `16/32/64-bit`
	Rol_rm16_CL = 466,
	/// `ROL r/m32, CL`
	///
	/// `o32 D3 /0`
	///
	/// `386+`
	///
	/// `16/32/64-bit`
	Rol_rm32_C


import { GestureResponderEvent } from 'react-native'
import { Store } from 'redux'
import Direction from './@types/Direction'
import GesturePath from './@types/GesturePath'
import Index from './@types/IndexType'
import Key from './@types/Key'
import Shortcut from './@types/Shortcut'
import ShortcutId from './@types/ShortcutId'
import State from './@types/State'
import alert from './action-creators/alert'
import showLatestShortcuts from './action-creators/showLatestShortcuts'
import suppressExpansion from './action-creators/suppressExpansion'
import { isMac } from './browser'
import { AlertType, GESTURE_CANCEL_ALERT_TEXT, GESTURE_HINT_EXTENDED_TIMEOUT, Settings } from './constants'
import globals from './globals'
import getUserSetting from './selectors/getUserSetting'
import * as shortcutObject from './shortcuts/index'
import keyValueBy from './util/keyValueBy'

export const globalShortcuts = Object.values(shortcutObject) as Shortcut[]

export const shortcutEmitter = new Emitter()

/* A mapping of key codes to uppercase letters.
 * {
 *   65: 'A',
 *   66: 'B',
 *   67: 'C',
 *   ...
 * }
 */
const letters = keyValueBy(Array(26).fill(0), (n, i) => ({
  [65 + i]: String.fromCharCode(65 + i).toUpperCase(),
}))

/* A mapping of key codes to digits.
 * {
 *   48: '0',
 *   49: '1',
 *   50: '2',
 *   ...
 * }
 */
const digits = keyValueBy(Array(58 - 48).fill(0), (n, i) => ({
  [48 + i]: i.toString(),
}))

/** Hash all the properties of a shortcut into a string. */
const hashShortcut = (shortcut: Shortcut): string => {
  const keyboard = typeof shortcut.keyboard === 'string' ? { key: shortcut.keyboard } : shortcut.keyboard || ({} as Key)
  return (
    (keyboard.meta ? 'META_' : '') +
    (keyboard.alt ? 'ALT_' : '') +
    (keyboard.shift ? 'SHIFT_' : '') +
    keyboard.key?.toUpperCase()
  )
}

/** Hash all the properties of a keydown event into a string that matches hashShortcut. */
const hashKeyDown = (e: KeyboardEvent): string =>
  (e.metaKey || e.ctrlKey ? 'META_' : '') +
  (e.altKey ? 'ALT_' : '') +
  (e.shiftKey ? 'SHIFT_' : '') +
  // for some reason, e.key returns 'Dead' in some cases, perhaps because of alternate keyboard settings
  // e.g. alt + meta + n
  // use e.keyCode if available instead
  (letters[e.keyCode] || digits[e.keyCode] || e.key || '').toUpperCase()

/** Initializes shortcut indices and stores conflicts. */
const index = (): {
  shortcutKeyIndex: Index<Shortcut>
  shortcutIdIndex: Index<Shortcut>
  shortcutGestureIndex: Index<Shortcut>
} => {
  // index shortcuts for O(1) lookup by keyboard
  const shortcutKeyIndex: Index<Shortcut> = keyValueBy(globalShortcuts, (shortcut, i, accum) => {
    if (!shortcut.keyboard) return null

    const hash = hashShortcut(shortcut)
    const conflict = !!accum[hash]

    if (conflict) {
      console.error(
        `"${shortcut.id}" uses the same shortcut as "${accum[hash].id}": ${formatKeyboardShortcut(shortcut.keyboard)}"`,
      )
    }

    return {
      // if there is a conflict, append the shortcut id to the conflicts property so that the conflicts can be displayed to the user
      [hash]: conflict
        ? {
            ...shortcut,
            conflicts: [...(shortcut.conflicts || [accum[hash].id]),


nviron;

TEST_GROUP(ShifterTestGroup) {
};

TEST(ShifterTestGroup, CopyEnv_basic) {
    MemoryLeakWarningPlugin::turnOffNewDeleteOverloads();
    setenv("TESTENV0", "gfedcba", 1);
    char **origEnv = shifter_copyenv();
    CHECK(origEnv != NULL);
    clearenv();
    setenv("TESTENV1", "abcdefg", 1);
    CHECK(getenv("TESTENV0") == NULL);
    CHECK(getenv("TESTENV1") != NULL);
    for (char **ptr = origEnv; *ptr != NULL; ptr++) {
        putenv(*ptr);
        /* not free'ing *ptr, since *ptr is becoming part of the environment
           it is owned by environ now */
    }
    free(origEnv);
    CHECK(getenv("TESTENV0") != NULL);
    CHECK(strcmp(getenv("TESTENV0"), "gfedcba") == 0);
    MemoryLeakWarningPlugin::turnOnNewDeleteOverloads();
}

TEST(ShifterTestGroup, adoptPATH_test) {

    CHECK(adoptPATH(NULL) != 0);

    char **tmpenv = (char **) malloc(sizeof(char *) * 4);
    tmpenv[0] = strdup("fakeEnv=1");
    tmpenv[1] = strdup("LD_LIBRARY_PATH=/test");
    tmpenv[2] = strdup("PATH=/usr/bin:/usr/sbin:/fakePath");
    tmpenv[3] = NULL;
    char *savepath = strdup(getenv("PATH"));

    CHECK(adoptPATH(tmpenv) == 0);
    CHECK(strcmp(getenv("PATH"), "/usr/bin:/usr/sbin:/fakePath") == 0);

    setenv("PATH", savepath, 1);
    free(savepath);
    free(tmpenv[0]);
    free(tmpenv[1]);
    free(tmpenv[2]);
    free(tmpenv);
}

#if 0
TEST(ShifterTestGroup, LocalPutEnv_basic) {
    setenv("TESTENV0", "qwerty123", 1);
    unsetenv("TESTENV2");
    char **altEnv = copyenv();
    CHECK(altEnv != NULL);
    char *testenv0Ptr = NULL;
    char *testenv2Ptr = NULL;
    char **ptr = NULL;
    int nEnvVar = 0;
    int nEnvVar2 = 0;
    for (ptr = altEnv; *ptr != NULL; ptr++) {
        if (strncmp(*ptr, "TESTENV0", 8) == 0) {
            testenv0Ptr = *ptr;
        }
        nEnvVar++;
    }
    CHECK(testenv0Ptr != NULL);
    CHECK(strcmp(testenv0Ptr, "TESTENV0=qwerty123") == 0);

    int ret = local_putenv(&altEnv, "TESTENV0=abcdefg321");
    CHECK(ret == 0);
    ret = local_putenv(&altEnv, "TESTENV2=asdfghjkl;");
    CHECK(ret == 0);
    ret = local_putenv(&altEnv, NULL);
    CHECK(ret != 0);
    ret = local_putenv(NULL, "TESTENV2=qwerty123");
    CHECK(ret != 0);

    for (ptr = altEnv; *ptr != NULL; ptr++) {
        if (strncmp(*ptr, "TESTENV0", 8) == 0) {
            testenv0Ptr = *ptr;
        } else if (strncmp(*ptr, "TESTENV2", 8) == 0) {
            testenv2Ptr = *ptr;
        } else {
            free(*ptr);
        }
        nEnvVar2++;
    }
    free(altEnv);
    CHECK(testenv0Ptr != NULL);
    CHECK(testenv2Ptr != NULL);
    CHECK(nEnvVar2 - nEnvVar == 1);
    CHECK(strcmp(testenv0Ptr, "TESTENV0=abcdefg321") == 0);
    CHECK(strcmp(testenv2Ptr, "TESTENV2=asdfghjkl;") == 0);

    free(testenv0Ptr);
    free(testenv2Ptr);
}
#endif

int main(int argc, char **argv) {
    return CommandLineTestRunner::RunAllTests(argc, argv);
}
/* Shifter, Copyright (c) 2015, The Regents of the University of California,
## through Lawrence Berkeley National Laboratory (subject to receipt of any
## required approvals from the U.S. Dept. of Energy).  All rights reserved.


// Copyright lowRISC contributors.
// Licensed under the Apache License, Version 2.0, see LICENSE for details.
// SPDX-License-Identifier: Apache-2.0

#ifdef __cplusplus
extern "C" {
#endif  // __cplusplus

#include "memory.h"

// Some symbols below are only defined for device builds. For host builds, we
// their implementations will be provided by the host's libc implementation.
//
// If you are getting missing symbol linker errors for these symbols, it's
// likely because you have specified `-nostdlib` for a host build. Host builds
// must be linked against the system libc.
//
// This approach is used so that DIFs can depend on `memory.h`, but also be
// built for host-side software.

#if !defined(HOST_BUILD)
void *memcpy(void *__restrict dest, const void *__restrict src, size_t len) {
  uint8_t *dest8 = (uint8_t *)dest;
  uint8_t *src8 = (uint8_t *)src;
  for (size_t i = 0; i < len; ++i) {
    dest8[i] = src8[i];
  }
  return dest;
}
#endif  // !defined(HOST_BUILD)

#if !defined(HOST_BUILD)
void *memset(void *dest, int value, size_t len) {
  uint8_t *dest8 = (uint8_t *)dest;
  uint8_t value8 = (uint8_t)value;
  for (size_t i = 0; i < len; ++i) {
    dest8[i] = value8;
  }
  return dest;
}
#endif  // !defined(HOST_BUILD)

#if !defined(HOST_BUILD)
enum {
  kMemCmpEq = 0,
  kMemCmpLt = -42,
  kMemCmpGt = 42,
};

int memcmp(const void *lhs, const void *rhs, size_t len) {
  const uint8_t *lhs8 = (uint8_t *)lhs;
  const uint8_t *rhs8 = (uint8_t *)rhs;
  for (size_t i = 0; i < len; ++i) {
    if (lhs8[i] < rhs8[i]) {
      return kMemCmpLt;
    } else if (lhs8[i] > rhs8[i]) {
      return kMemCmpGt;
    }
  }
  return kMemCmpEq;
}
#endif  // !defined(HOST_BUILD)

#if !defined(HOST_BUILD)
void *memchr(const void *ptr, int value, size_t len) {
  uint8_t *ptr8 = (uint8_t *)ptr;
  uint8_t value8 = (uint8_t)value;
  for (size_t i = 0; i < len; ++i) {
    if (ptr8[i] == value8) {
      return ptr8 + i;
    }
  }
  return NULL;
}
#endif  // !defined(HOST_BUILD)

void *memrchr(const void *ptr, int value, size_t len) {
  uint8_t *ptr8 = (uint8_t *)ptr;
  uint8_t value8 = (uint8_t)value;
  for (size_t i = 0; i < len; ++i) {
    size_t idx = len - i - 1;
    if (ptr8[idx] == value8) {
      return ptr8 + idx;
    }
  }
  return NULL;
}

#ifdef __cplusplus
}
#endif  // __cplusplus


import copy
from typing import List

from ..layers import DoNothingOptimizer
from ..utils import common_functions as c_f
from .base_container import BaseContainer

class Optimizers(BaseContainer):
    """
    A container for model optimizers.
    """

    def __init__(self, *args, multipliers=None, **kwargs):
        """
        Arguments:
            *args: [```BaseContainer```][pytorch_adapt.containers.BaseContainer] arguments.
            multipliers: A dictionary mapping from
                optimizer name to lr multiplier. Each
                optimizer will have ```lr = lr * multiplier```
                upon initialization. If ```None```,
                then multiplier is 1.
            **kwargs:  [```BaseContainer```][pytorch_adapt.containers.BaseContainer]
                keyword arguments.
        """
        self.multipliers = c_f.default(multipliers, {})
        super().__init__(*args, **kwargs)

    def _create_with(self, other):
        c_f.assert_keys_are_present_cls(self, "multipliers", self)
        for k, v in self.items():
            if c_f.is_optimizer(v):
                continue
            class_ref, kwargs = v
            model = other[k]
            if c_f.has_no_parameters(model):
                self[k] = DoNothingOptimizer()
            else:
                kwargs = copy.deepcopy(kwargs)
                kwargs["lr"] *= self.multipliers.get(k, 1)
                self[k] = class_ref(model.parameters(), **kwargs)

    def step(self):
        """
        Calls ```.step()``` on all optimizers.
        """
        for v in self.values():
            v.step()

    def zero_grad(self):
        """
        Calls ```.zero_grad()``` on all optimizers.
        """
        for v in self.values():
            v.zero_grad()

    def merge(self, other):
        super().merge(other)
        self.multipliers.update(other.multipliers)

    def zero_back_step(self, loss, keys: List[str] = None):
        """
        Zeros gradients, computes gradients, and updates model weights.
        Arguments:
            loss: The loss on which ```.backward()``` is called.
            keys: The subset of optimizers on which to call
                ```.zero_grad()``` and ```.step()```.
                If ```None```, then all optimizers are used.
        """
        keys = c_f.default(keys, self.keys())
        optimizers = [self[k] for k in keys]
        c_f.zero_back_step(loss, optimizers)


nty of
*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
*  GNU Affero General Public License for more details.
*
*  You should have received a copy of the GNU Affero General Public License
*  along with this program.  If not, see <https://www.gnu.org/licenses/>.
*/

/* THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. */

namespace Arrowgene.MonsterHunterOnline.Service.CsProto.Enums
{
    public enum CS_SKILL_RESULT_TYPE
    {
        /// <summary>
        /// 偷取物品
        /// </summary>
        CS_SKILL_RESULT_STEAL_ITEM = 0,

        /// <summary>
        /// 程序使用
        /// </summary>
        CS_SKILL_RESULT_MAX = 1,

    }
}


//\n// Does my thing.\n// Deprecated: this is a proper deprecation notice.\n",
			deprecated: true,
		},
		{
			in:         "",
			want:       "//\n// MyService is deprecated.\n//\n// Deprecated: MyService may be removed in a future version.\n",
			deprecated: true,
		},
	} {
		g.comments[serv] = tst.in
		serv.Options = &descriptorpb.ServiceOptions{
			Deprecated: proto.Bool(tst.deprecated),
		}
		g.pt.Reset()
		g.serviceDoc(serv)
		if diff := cmp.Diff(g.pt.String(), tst.want); diff != "" {
			t.Errorf("comment() got(-),want(+):\n%s", diff)
		}
	}
}

func TestClientInit(t *testing.T) {

	cop := &descriptorpb.DescriptorProto{
		Name: proto.String("Operation"),
	}

	servPlain := &descriptorpb.ServiceDescriptorProto{
		Name: proto.String("Foo"),
		Method: []*descriptorpb.MethodDescriptorProto{
			{
				Name:       proto.String("Zip"),
				InputType:  proto.String(".mypackage.Bar"),
				OutputType: proto.String(".mypackage.Foo"),
				Options:    &descriptorpb.MethodOptions{},
			},
		},
		Options: &descriptorpb.ServiceOptions{},
	}
	proto.SetExtension(servPlain.Options, annotations.E_ApiVersion, "v1_20240425")

	servLRO := &descriptorpb.ServiceDescriptorProto{
		Name: proto.String("Foo"),
		Method: []*descriptorpb.MethodDescriptorProto{
			{
				Name:       proto.String("Zip"),
				InputType:  proto.String(".mypackage.Bar"),
				OutputType: proto.String(".google.longrunning.Operation"),
				Options:    &descriptorpb.MethodOptions{},
			},
		},
		Options: &descriptorpb.ServiceOptions{},
	}
	proto.SetExtension(servLRO.Options, annotations.E_ApiVersion, "v1_20240425")

	servDeprecated := &descriptorpb.ServiceDescriptorProto{
		Name: proto.String("Foo"),
		Method: []*descriptorpb.MethodDescriptorProto{
			{
				Name:       proto.String("Zip"),
				InputType:  proto.String(".mypackage.Bar"),
				OutputType: proto.String(".mypackage.Foo"),
				Options:    &descriptorpb.MethodOptions{},
			},
		},
		Options: &descriptorpb.ServiceOptions{
			Deprecated: proto.Bool(true),
		},
	}

	opS := &descriptorpb.ServiceDescriptorProto{
		Name:   proto.String("FooOperationService"),
		Method: []*descriptorpb.MethodDescriptorProto{},
	}

	customOpOpts := &descriptorpb.MethodOptions{}
	servCustomOp := &descriptorpb.ServiceDescriptorProto{
		Name: proto.String("Foo"),
		Method: []*descriptorpb.MethodDescriptorProto{
			{
				Name:       proto.String("Zip"),
				InputType:  proto.String(".mypackage.Bar"),
				OutputType: proto.String(".mypackage.Operation"),
				Options:    customOpOpts,
			},
		},
	}
	for _, s := range []*descriptorpb.ServiceDescriptorProto{servPlain, servDeprecated, servLRO} {
		proto.SetExtension(s.Method[0].GetOptions(), annotations.E_Http, &annotations.HttpRule{
			Pattern: &annotations.HttpRule_Get{
				Get: "/zip",
			},
		})
	}

	for _, tst := range []struct {
		tstName      string
		servName     string
		mixins       mixins
		serv         *descriptorpb.ServiceDescriptorProto
		customOpServ *descriptorpb.ServiceDescriptorProto
		parameter    *string
		imports      map[pbinfo.ImportSpec]bool
		wantNumSnps  int
		setExt       func() (protoreflect.ExtensionType, interface{})
	}{
		{
			tstName: "foo_client_init",
			mixins: mixins{
				"google.cloud.location.Locations": locationMethods(),
				"google.iam.v1.IAMPolicy":         iamPolicyMethods(),
			},


ر در کوکی ذخیره میشود. با این حال، کوکیها در اندازه محدود شدهاند. وقتی که دیکشنری کاربری بزرگ میشود و به نقطهای که نمیتواند در کوکی ذخیره شود، پس از آن دیکشنری ممکن است بر روی سرور ما ذخیره شود. برای ذخیره دیکشنری شخصی شما بر روی سرور ما، باید یک نام برای دیکشنری خود مشخص نمایید. اگر شما قبلا یک دیکشنری روی سرور ما ذخیره کردهاید، لطفا نام آنرا درج و روی دکمه بازیافت کلیک نمایید.","dic_rename":"تغییر نام","dic_restore":"بازیافت","dictionariesTab":"دیکشنریها","disable":"غیرفعالسازی SCAYT","emptyDic":"نام دیکشنری نباید خالی باشد.","enable":"فعالسازی SCAYT","ignore":"عبور کردن","ignoreAll":"عبور کردن از همه","ignoreDomainNames":"عبور از نامهای دامنه","langs":"زبانها","languagesTab":"زبانها","mixedCase":"عبور از کلماتی مرکب از حروف بزرگ و کوچک","mixedWithDigits":"عبور از کلمات به همراه عدد","moreSuggestions":"پیشنهادهای بیشتر","opera_title":"توسط اپرا پشتیبانی نمیشود","options":"گزینهها","optionsTab":"گزینهها","title":"بررسی املای تایپ شما","toggle":"ضامن SCAYT","noSuggestions":"No suggestion"},"stylescombo":{"label":"سبک","panelTitle":"سبکهای قالببندی","panelTitle1":"سبکهای بلوک","panelTitle2":"سبکهای درونخطی","panelTitle3":"سبکهای شیء"},"table":{"border":"اندازهٴ لبه","caption":"عنوان","cell":{"menu":"سلول","insertBefore":"افزودن سلول قبل از","insertAfter":"افزودن سلول بعد از","deleteCell":"حذف سلولها","merge":"ادغام سلولها","mergeRight":"ادغام به راست","mergeDown":"ادغام به پایین","splitHorizontal":"جدا کردن افقی سلول","splitVertical":"جدا کردن عمودی سلول","title":"ویژگیهای سلول","cellType":"نوع سلول","rowSpan":"محدوده ردیفها","colSpan":"محدوده ستونها","wordWrap":"شکستن کلمه","hAlign":"چینش افقی","vAlign":"چینش عمودی","alignBaseline":"خط مبنا","bgColor":"رنگ زمینه","borderColor":"رنگ خطوط","data":"اطلاعات","header":"سرنویس","yes":"بله","no":"خیر","invalidWidth":"عرض سلول باید یک عدد باشد.","invali


// -*- C++ -*-
//===----------------------------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

#ifndef _LIBCPP___ALGORITHM_MIN_MAX_RESULT_H
#define _LIBCPP___ALGORITHM_MIN_MAX_RESULT_H

#include <__concepts/convertible_to.h>
#include <__config>
#include <__utility/move.h>

#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#  pragma GCC system_header
#endif

_LIBCPP_PUSH_MACROS
#include <__undef_macros>

_LIBCPP_BEGIN_NAMESPACE_STD

#if _LIBCPP_STD_VER >= 20

namespace ranges {

template <class _T1>
struct min_max_result {
  _LIBCPP_NO_UNIQUE_ADDRESS _T1 min;
  _LIBCPP_NO_UNIQUE_ADDRESS _T1 max;

  template <class _T2>
    requires convertible_to<const _T1&, _T2>
  _LIBCPP_HIDE_FROM_ABI constexpr operator min_max_result<_T2>() const & {
    return {min, max};
  }

  template <class _T2>
    requires convertible_to<_T1, _T2>
  _LIBCPP_HIDE_FROM_ABI constexpr operator min_max_result<_T2>() && {
    return {std::move(min), std::move(max)};
  }
};

} // namespace ranges

#endif // _LIBCPP_STD_VER >= 20

_LIBCPP_END_NAMESPACE_STD

_LIBCPP_POP_MACROS

#endif // _LIBCPP___ALGORITHM_MIN_MAX_RESULT_H


er = BrotliBitReader {
        val_: 0xf5917f07daaaeabb,
        bit_pos_: 33,
        avail_in: 29,
        next_in: 3,
      };
      let ret = BrotliReadBits(&mut bit_reader, 8, &data[..]);
      assert_eq!(ret, 0x83);
      if super::BROTLI_ALIGNED_READ == 0 {
        assert_eq!(bit_reader.bit_pos_, 41);
        assert_eq!(bit_reader.avail_in, 29);
        assert_eq!(bit_reader.next_in, 3);

      } else {
        assert_eq!(bit_reader.bit_pos_, 9);
        assert_eq!(bit_reader.avail_in, 25);
        assert_eq!(bit_reader.next_in, 7);
      }
    }
    {
      let data: [u8; 28] = [0xba, 0xaa, 0xaa, 0xad, 0x74, 0x40, 0x8e, 0xee, 0xd2, 0x38, 0xf1,
                            0xf4, 0xf8, 0x1d, 0x9f, 0x24, 0x48, 0x1e, 0x82, 0xce, 0x48, 0x88,
                            0xd7, 0x25, 0x74, 0xaf, 0xe3, 0xea];
      let mut bit_reader = BrotliBitReader {
        val_: 0x27e33b2440d3feaf,
        bit_pos_: 18,
        avail_in: 24,
        next_in: 4,
      };
      let ret = BrotliReadBits(&mut bit_reader, 15, &data[..]);
      assert_eq!(ret, 0x1034);
      assert_eq!(bit_reader.bit_pos_, 33);
      assert_eq!(bit_reader.avail_in, 24);
      assert_eq!(bit_reader.next_in, 4);
    }
  }
  #[test]
  fn const_fill_bit_window_tests() {
    {
      let data: [u8; 36] = [0xff, 0x9a, 0xa0, 0xde, 0x50, 0x99, 0x67, 0x67, 0x69, 0x87, 0x0e,
                            0x69, 0xeb, 0x6a, 0xd1, 0x56, 0xc0, 0x32, 0x96, 0xed, 0x78, 0x0e,
                            0x19, 0xdd, 0x0b, 0xe8, 0xf8, 0x33, 0x9f, 0xe0, 0x69, 0x55, 0x59,
                            0x3f, 0x5d, 0xc8];
      let mut bit_reader = BrotliBitReader {
        val_: 0xb3fc441e0181dc4,
        bit_pos_: 59,
        avail_in: 33,
        next_in: 1,
      };
      let ret = BrotliReadConstantNBits(&mut bit_reader, 4, &data[..]);
      assert_eq!(ret, 0x1);
      assert_eq!(bit_reader.bit_pos_, 7);
      assert_eq!(bit_reader.avail_in, 26);
      assert_eq!(bit_reader.next_in, 8);
    }
    {
      let data: [u8; 67] = [0xf0, 0x0d, 0x7e, 0x18, 0x70, 0x1c, 0x18, 0x57, 0xbd, 0x73, 0x47,
                            0xc1, 0xb4, 0xf7, 0xe2, 0xbe, 0x17, 0x6e, 0x26, 0x01, 0xb2, 0xd5,
                            0x55, 0xd8, 0x68, 0x1b, 0xc2, 0x87, 0xb4, 0xb1, 0xd9, 0x42, 0xac,
                            0x0d, 0x67, 0xb1, 0x93


the caller's account to [recipient]. Returns a boolean value indicating whether the operation succeeded. Emits a [Transfer] event.
  ///
  /// The optional [transaction] parameter can be used to override parameters
  /// like the gas price, nonce and max gas. The `data` and `to` fields will be
  /// set by the contract.
  Future<String> transfer(_i1.EthereumAddress recipient, BigInt amount,
      {required _i1.Credentials credentials,
      _i1.Transaction? transaction}) async {
    final function = self.abi.functions[4];
    assert(checkSignature(function, 'a9059cbb'));
    final params = [recipient, amount];
    return write(credentials, transaction, function, params);
  }

  /// Moves [amount] tokens from [sender] to [recipient] using the allowance mechanism. [amount] is then deducted from the caller's allowance. Returns a boolean value indicating whether the operation succeeded. Emits a [Transfer] event.
  ///
  /// The optional [transaction] parameter can be used to override parameters
  /// like the gas price, nonce and max gas. The `data` and `to` fields will be
  /// set by the contract.
  Future<String> transferFrom(
      _i1.EthereumAddress sender, _i1.EthereumAddress recipient, BigInt amount,
      {required _i1.Credentials credentials,
      _i1.Transaction? transaction}) async {
    final function = self.abi.functions[5];
    assert(checkSignature(function, '23b872dd'));
    final params = [sender, recipient, amount];
    return write(credentials, transaction, function, params);
  }

  /// Returns a live stream of all Approval events emitted by this contract.
  Stream<Approval> approvalEvents(
      {_i1.BlockNum? fromBlock, _i1.BlockNum? toBlock}) {
    final event = self.event('Approval');
    final filter = _i1.FilterOptions.events(
        contract: self, event: event, fromBlock: fromBlock, toBlock: toBlock);
    return client.events(filter).map((_i1.FilterEvent result) {
      final decoded = event.decodeResults(result.topics!, result.data!);
      return Approval(decoded);
    });
  }

  /// Returns a live stream of all Transfer events emitted by this contract.
  Stream<Transfer> transferEvents(
      {_i1.BlockNum? fromBlock, _i1.BlockNum? toBlock}) {
    final event = self.event('Transfer');
    final filter = _i1.FilterOptions.events(
        contract: self, event: event, fromBlock: fromBlock, toBlock: toBlock);
    return client.events(filter).map((_i1.FilterEvent result) {
      final decoded = event.decodeResults(result.topics!, result.data!);
      return Transfer(decoded);
    });
  }
}

/// Emitted when the allowance of a [spender] for an [owner] is set by a call to [Erc20.approve]. [value] is the new allowance.
class Approval {
  Approval(List<dynamic> response)
      : owner = (response[0] as _i1.EthereumAddress),
        spender = (response[1] as _i1.EthereumAddress),
        value = (response[2] as BigInt);

  final _i1.EthereumAddress owner;

  final _i1.EthereumAddress spender;

  final BigInt value;
}

/// Emitted when [value] tokens are moved from one account ([from]) to another ([to]). Note that [value] may be zero.
class Transfer {
  Transfer(List<dynamic> response)
      : from = (response[0] as _i1.EthereumAddress),
        to = (response[1] as _i1.EthereumAddress),
        value = (response[2] as BigInt);

  final _i1.EthereumAddress from;

  final _i1.EthereumAddress to;

  final BigInt value;
}
// dart format width=80
// coverage:ignore-file

// GENERATED CODE, DO NOT EDIT BY HAND.
// ignore_for_file: type=lint
import 'package:drift/drift.dart


 01: continued
    Expect.equals('xyz', new Sub().shadow_y_closureParam('z')); /// 01: continued
    Expect.equals('xyz', new Sub().shadow_y_localInsideClosure('z')); /// 01: continued
    Expect.equals('xyz', new Sub().shadow_x_parameter('z')); /// 01: continued
    Expect.equals('xyz', new Sub().shadow_x_local('z')); /// 01: continued
    Expect.equals('xyz', new Sub().shadow_x_capturedLocal('z')); /// 01: continued
    Expect.equals('xyz', new Sub().shadow_x_closureParam('z')); /// 01: continued
    Expect.equals('xyz', new Sub().shadow_x_localInsideClosure('z')); /// 01: continued

    Expect.equals('xyAB', new Sub().shadow_x_toplevel()); /// 01: continued
}
// Copyright (c) 2014, 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.

// Check that compile-time evaluation of constants is consistent with runtime
// evaluation.

import 'dart:mirrors';

import 'package:expect/expect.dart';

const top_const = identical(-0.0, 0);
final top_final = identical(-0.0, 0);
var top_var = identical(-0.0, 0);

@top_const
class C {
  static const static_const = identical(-0.0, 0);
  static final static_final = identical(-0.0, 0);
  static var static_var = identical(-0.0, 0);

  final instance_final = identical(-0.0, 0);
  var instance_var = identical(-0.0, 0);

  void test() {
    const local_const = identical(-0.0, 0);
    final local_final = identical(-0.0, 0);
    var local_var = identical(-0.0, 0);

    Expect.equals(identical(-0.0, 0), top_const);
    Expect.equals(top_const, top_final);
    Expect.equals(top_final, top_var);
    Expect.equals(top_var, static_const);
    Expect.equals(static_const, static_final);
    Expect.equals(static_final, static_var);
    Expect.equals(static_var, instance_final);
    Expect.equals(instance_final, instance_var);
    Expect.equals(instance_var, local_const);
    Expect.equals(local_const, local_final);
    Expect.equals(local_final, local_var);
    var metadata = reflectClass(C).metadata[0].reflectee; /// 01: ok
    Expect.equals(top_const, metadata);                   /// 01: continued
    Expect.equals(local_var, metadata);                   /// 01: continued
  }
}

void main() {
  new C().test();
}
// 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.
// VMOptions=--optimization-counter-threshold=10 --no-use-osr

import "package:expect/expect.dart";

// Test optimized [] on strings.

var a = "abc";
var b = "øbc";
var c = new String.fromCharCodes([123, 456, 789]);

test_charat(s, i) {
  return s[i];
}

test_const_str(i) {
  return "abc"[i];
}

test_const_index(s) {
  return s[0];
}

test_const_index2(s) {
  return s[3];
}

main() {
  Expect.equals("a", test_charat(a, 0));
  for (var i = 0; i < 20; i++) test_charat(a, 0);
  Expect.equals("a", test_charat(


settingType = null;
        switch (radioId)
        {
            case 0:
                settingType = ProfileSettingsKeys.IntercomChannel;
                break;
            case 1:
                settingType = ProfileSettingsKeys.Radio1Channel;
                break;
            case 2:
                settingType = ProfileSettingsKeys.Radio2Channel;
                break;
            case 3:
                settingType = ProfileSettingsKeys.Radio3Channel;
                break;
            case 4:
                settingType = ProfileSettingsKeys.Radio4Channel;
                break;
            case 5:
                settingType = ProfileSettingsKeys.Radio5Channel;
                break;
            case 6:
                settingType = ProfileSettingsKeys.Radio6Channel;
                break;
            case 7:
                settingType = ProfileSettingsKeys.Radio7Channel;
                break;
            case 8:
                settingType = ProfileSettingsKeys.Radio8Channel;
                break;
            case 9:
                s


r pagination */
.paging_full_numbers a:active {
	outline: none
}
.paging_full_numbers a:hover {
	text-decoration: none;
}

.paging_full_numbers a.paginate_button,
.paging_full_numbers a.paginate_active {
	border: 1px solid #aaa;
	-webkit-border-radius: 5px;
	-moz-border-radius: 5px;
	border-radius: 5px;
	padding: 2px 5px;
	margin: 0 3px;
	cursor: pointer;
	*cursor: hand;
	color: #333 !important;
}

.paging_full_numbers a.paginate_button {
	background-color: #ddd;
}

.paging_full_numbers a.paginate_button:hover {
	background-color: #ccc;
	text-decoration: none !important;
}

.paging_full_numbers a.paginate_active {
	background-color: #99B3FF;
}

/*
 * Processing indicator
 */
.dataTables_processing {
	position: absolute;
	top: 50%;
	left: 50%;
	width: 250px;
	height: 30px;
	margin-left: -125px;
	margin-top: -15px;
	padding: 14px 0 2px 0;
	border: 1px solid #ddd;
	text-align: center;
	color: #999;
	font-size: 14px;
	background-color: white;
}

/*
 * Sorting
 */
table.dataTable thead th div.DataTables_sort_wrapper {
	position: relative;
	padding-right: 20px;
	padding-right: 20px;
}

table.dataTable thead th div.DataTables_sort_wrapper span {
	position: absolute;
	top: 50%;
	margin-top: -8px;
	right: 0;
}

table.dataTable th:active {
	outline: none;
}

/*
 * Scrolling
 */
.dataTables_scroll {
	clear: both;
}

.dataTables_scrollBody {
	*margin-top: -1px;
}

/* Linux Libertine O */
@font-face {
  font-family: 'Linux Libertine O';
  src: url("linlib-r-subset-2ca891d0a3c77919532630108be2153c0ebd6c5d6dd50a4985291517ccfd1add.woff");
  font-weight: normal;
  font-style: normal;
}

@font-face {
  font-family: 'Linux Libertine O';
  src: url("linlib-ri-subset-758e855f93382848480ceeacb368f54ec6da5520920667ef8b6748c7fac81c97.woff");
  font-weight: normal;
  font-style: italic;
}

@font-face {
  font-family: 'Linux Libertine O';
  src: url("linlib-rb-subset-99de13d167ea6f5c576c07854184fa9ac3e70f94ea93904285fbcba8ecedae7a.woff");
  font-weight: bold;
  font-style: normal;
}

@font-face {
  font-family: 'Linux Libertine Capitals O';
  src: url("linlib-as-subset-c15e991694c9569e1f2b8c16ff1adb7a13c1d4a3ab7f479c8b8e49ceb0926217.woff");
  font-weight: normal;
  font-style: normal;
}

/* Linux Biolinum O */
@font-face {
  font-family: 'Linux Biolinum O';
  src: url("linbio-r-subset-2af6cb05ff2e194caf1a61f4300f3ebb4fca00bfbe993422aae2f10ade07aa78.woff");
  font-weight: normal;
  font-style: normal;
}

@font-face {
  font-family: 'Linux Biolinum O';
  src: url("linbio-ri-subset-b8c9bbd29d34f255d3eb479c9000ac4c55bae79f


/*
 *  Copyright 2011 The WebRTC project authors. All Rights Reserved.
 *
 *  Use of this source code is governed by a BSD-style license
 *  that can be found in the LICENSE file in the root of the source
 *  tree. An additional intellectual property rights grant can be found
 *  in the file PATENTS.  All contributing project authors may
 *  be found in the AUTHORS file in the root of the source tree.
 */

#ifndef WEBRTC_API_MEDIASTREAMPROXY_H_
#define WEBRTC_API_MEDIASTREAMPROXY_H_

#include "webrtc/api/mediastreaminterface.h"
#include "webrtc/api/proxy.h"

namespace webrtc {

BEGIN_SIGNALING_PROXY_MAP(MediaStream)
  PROXY_CONSTMETHOD0(std::string, label)
  PROXY_METHOD0(AudioTrackVector, GetAudioTracks)
  PROXY_METHOD0(VideoTrackVector, GetVideoTracks)
  PROXY_METHOD1(rtc::scoped_refptr<AudioTrackInterface>,
                FindAudioTrack, const std::string&)
  PROXY_METHOD1(rtc::scoped_refptr<VideoTrackInterface>,
                FindVideoTrack, const std::string&)
  PROXY_METHOD1(bool, AddTrack, AudioTrackInterface*)
  PROXY_METHOD1(bool, AddTrack, VideoTrackInterface*)
  PROXY_METHOD1(bool, RemoveTrack, AudioTrackInterface*)
  PROXY_METHOD1(bool, RemoveTrack, VideoTrackInterface*)
  PROXY_METHOD1(void, RegisterObserver, ObserverInterface*)
  PROXY_METHOD1(void, UnregisterObserver, ObserverInterface*)
END_SIGNALING_PROXY()

}  // namespace webrtc

#endif  // WEBRTC_API_MEDIASTREAMPROXY_H_


::Equal }
    , std::pair{ "!="_h, TokenType::NotEqual }
    , std::pair{ "||"_h, TokenType::LogicalOr }
    , std::pair{ "&&"_h, TokenType::LogicalAnd }
    , std::pair{ "render_state"_h, TokenType::RenderState }
    , std::pair{ "sampler_state"_h, TokenType::SamplerState }
    , std::pair{ "program"_h, TokenType::Program }
    , std::pair{ "//"_h, TokenType::CommentRow}
    , std::pair{ "/*"_h, TokenType::CommentBlockStart}
    , std::pair{ "*/"_h, TokenType::CommentBlockEnd}
    , std::pair{ "rgba16"_h, TokenType::Rgba16 }
    , std::pair{ "rgb10_a2"_h, TokenType::Rgb10_A2 }
    , std::pair{ "rgba8"_h, TokenType::Rgba8 }
    , std::pair{ "rg16"_h, TokenType::Rg16 }
    , std::pair{ "rg8"_h, TokenType::Rg8 }
    , std::pair{ "r16"_h, TokenType::R16 }
    , std::pair{ "r8"_h, TokenType::R8 }
    , std::pair{ "rgba16_snorm"_h, TokenType::Rgba16_Snorm }
    , std::pair{ "rgba8_snorm"_h, TokenType::Rgba8_Snorm }
    , std::pair{ "rg16_snorm"_h, TokenType::Rg16_Snorm }
    , std::pair{ "rg8_snorm"_h, TokenType::Rg8_Snorm }
    , std::pair{ "r16_snorm"_h, TokenType::R16_Snorm }
    , std::pair{ "r8_snorm"_h, TokenType::R8_Snorm }
    , std::pair{ "rgba32f"_h, TokenType::Rgba32F }
    , std::pair{ "rgba16f"_h, TokenType::Rgba16F }
    , std::pair{ "rg32f"_h, TokenType::Rg32F }
    , std::pair{ "rg16f"_h, TokenType::Rg16F }
    , std::pair{ "r11g11b10f"_h, TokenType::R11G11B10F }
    , std::pair{ "r32f"_h, TokenType::R32F }
    , std::pair{ "r16f"_h, TokenType::R16F }
    , std::pair{ "rga32i"_h, TokenType::Rgba32I }
    , std::pair{ "rgba16i"_h, TokenType::Rgba16I }
    , std::pair{ "rgba8i"_h, TokenType::Rgba8I }
    , std::pair{ "rg32i"_h, TokenType::Rg32I }
    , std::pair{ "rg16i"_h, TokenType::Rg16I }
    , std::pair{ "rg8i"_h, TokenType::Rg8I }
    , std::pair{ "r32i"_h, TokenType::R32I }
    , std::pair{ "r16i"_h, TokenType::R16I }
    , std::pair{ "r8i"_h, TokenType::R8I }
    , std::pair{ "rga32u"_h, TokenType::Rgba32U }
    , std::pair{ "rgba16u"_h, TokenType::Rgba16U }
    , std::pair{ "rgb10_a2u"_h, TokenType::Rgb10_A2U }
    , std::pair{ "rgba8u"_h, TokenType::Rgba8U }
    , std::pair{ "rg32u"_h, TokenType::Rg32U }
    , std::pair{ "rg16u"_h, TokenType::Rg16U }
    , std::pair{ "rg8u"_h, TokenType::Rg8U }
    , std::pair{ "r32u"_h, TokenType::R32U }
    , std::pair{ "r16u"_h, TokenType::R16U }
    , std::pair{ "r8u"_h, TokenType::R8U }
    , std::pair{ "unknown"_h, TokenType::UnknownFormat }
};

static


Port = m.NodePort
	if rhs := m.ExternalIps; rhs != nil {
		tmpContainer := make([]string, len(rhs))
		copy(tmpContainer, rhs)
		r.ExternalIps = tmpContainer
	}
	if rhs := m.ExternalHostnames; rhs != nil {
		tmpContainer := make([]string, len(rhs))
		copy(tmpContainer, rhs)
		r.ExternalHostnames = tmpContainer
	}
	if len(m.unknownFields) > 0 {
		r.unknownFields = make([]byte, len(m.unknownFields))
		copy(r.unknownFields, m.unknownFields)
	}
	return r
}

func (m *PortConfig_ExposureInfo) CloneMessageVT() proto.Message {
	return m.CloneVT()
}

func (m *PortConfig) CloneVT() *PortConfig {
	if m == nil {
		return (*PortConfig)(nil)
	}
	r := new(PortConfig)
	r.Name = m.Name
	r.ContainerPort = m.ContainerPort
	r.Protocol = m.Protocol
	r.Exposure = m.Exposure
	r.ExposedPort = m.ExposedPort
	if rhs := m.ExposureInfos; rhs != nil {
		tmpContainer := make([]*PortConfig_ExposureInfo, len(rhs))
		for k, v := range rhs {
			tmpContainer[k] = v.CloneVT()
		}
		r.ExposureInfos = tmpContainer
	}
	if len(m.unknownFields) > 0 {
		r.unknownFields = make([]byte, len(m.unknownFields))
		copy(r.unknownFields, m.unknownFields)
	}
	return r
}

func (m *PortConfig) CloneMessageVT() proto.Message {
	return m.CloneVT()
}

func (m *ContainerConfig_EnvironmentConfig) CloneVT() *ContainerConfig_EnvironmentConfig {
	if m == nil {
		return (*ContainerConfig_EnvironmentConfig)(nil)
	}
	r := new(ContainerConfig_EnvironmentConfig)
	r.Key = m.Key
	r.Value = m.Value
	r.EnvVarSource = m.EnvVarSource
	if len(m.unknownFields) > 0 {
		r.unknownFields = make([]byte, len(m.unknownFields))
		copy(r.unknownFields, m.unknownFields)
	}
	return r
}

func (m *ContainerConfig_EnvironmentConfig) CloneMessageVT() proto.Message {
	return m.CloneVT()
}

func (m *ContainerConfig) CloneVT() *ContainerConfig {
	if m == nil {
		return (*ContainerConfig)(nil)
	}
	r := new(ContainerConfig)
	r.Directory = m.Directory
	r.User = m.User
	r.Uid = m.Uid
	r.AppArmorProfile = m.AppArmorProfile
	if rhs := m.Env; rhs != nil {
		tmpContainer := make([]*ContainerConfig_EnvironmentConfig, len(rhs))
		for k, v := range rhs {
			tmpContainer[k] = v.CloneVT()
		}
		r.Env = tmpContainer
	}
	if rhs := m.Command; rhs != nil {
		tmpContainer := make([]string, len(rhs))
		copy(tmpContainer, rhs)
		r.Command = tmpContainer
	}
	if rhs := m.Args; rhs != nil {
		tmpContainer := make([]string, len(rhs))
		copy(tmpContainer, rhs)
		r.Args = tmpContainer
	}
	if len(m.unknownFields) > 0 {
		r.unknownFields = make([]byte, len(m.unknownFields))
		copy(r.unknownFields, m.unknownFields)
	}
	return r
}

func (m *ContainerConfig) CloneMessageVT() proto.Message {
	return m.CloneVT()
}

func (m *SecurityContext_SELinux) CloneVT() *SecurityContext_SELinux {
	if m == n


infinitive: string) => irregularVerbFilter(state, infinitive))
    .filter((infinitive: string) => reflexiveVerbFilter(state, infinitive))
    .filter((infinitive: string) => commonVerbFilter(state, infinitive))
    .filter((infinitive: string) => filterVerbForEnding(state, infinitive));

export const getNumberOfVerbsInPlay = (state: any): number =>
  getVerbsFilteredByUserOptions(state).length;
import type { JsonType } from 'farrow-schema'

export { JsonType }

// __introspection__ = true is no need since we have tag now.
export type IntrospectionCalling = {
  type: 'Introspection'
}

export type SingleCalling = {
  type: 'Single'
  path: string[]
  input: Readonly<JsonType>
}

// __batch__ = true is no need since we have tag now
export type BatchCalling = {
  type: 'Batch'
  callings: Readonly<SingleCalling[]>
}

export type Calling = SingleCalling | BatchCalling | IntrospectionCalling

export type ApiRequest = {
  url: string
  calling: Calling
  options?: RequestInit
}

export type ApiErrorResponse = {
  type: 'ApiErrorResponse'
  error: {
    message: string
  }
}

export const ApiError = (message: string): ApiErrorResponse => {
  return {
    type: 'ApiErrorResponse',
    error: { message },
  }
}

export const isApiError = (input: any): input is ApiErrorResponse => {
  return input?.type === 'ApiErrorResponse'
}

export type ApiSuccessResponse = {
  type: 'ApiSuccessResponse'
  output: JsonType
}

export const ApiSuccess = (output: JsonType): ApiSuccessResponse => {
  return {
    type: 'ApiSuccessResponse',
    output,
  }
}

export const isApiSuccess = (input: any): input is ApiSuccessResponse => {
  return input?.type === 'ApiSuccessResponse'
}

export const BatchResponse = (result: ApiResponseSingle[]): ApiResponseBatch => {
  return {
    type: 'Batch',
    result,
  }
}

export type ApiResponseSingle = ApiErrorResponse | ApiSuccessResponse

export type ApiResponseBatch = {
  type: 'Batch'
  result: ApiResponseSingle[]
}

export type ApiResponse = ApiResponseSingle | ApiResponseBatch
import { Difficulty } from './difficulty';
import { Injectable } from '@angular/core';
import { GameCell } from './game-cell/game-cell';

@Injectable({
  providedIn: 'root'
})
export class MinesweeperService {

  difficulties: Difficulty[];

  constructor() {
    this.difficulties = [
      new Difficulty('getting started', 9, 9, 5),
      new Difficulty('easy', 9, 9, 10),
      new Difficulty('medium', 16, 16 , 40),
      new Difficulty('hard', 30, 16, 99)
    ];
  }

  getGameField(difficulty: Difficulty): GameCell[][] {
    const rowCount = difficulty.rowCount;
    const columnCount = difficulty.columnCount;
    const bombCount = difficulty.bombCount;
    const gameCells = [];
    const bombIndexes = this.getBombIndexes(rowCount * columnCount, bombCount);

    let i = 0;
    for (let row = 0; row < rowCount; row++) {
      gameCells[row] = [];
      for (let column = 0; column < columnCount; column++) {
        gameCells[row][column] = new GameCell(bombIndexes.includes(i));
        i++;
      }
    }
    this.updateNeighbors(gameCells);
    return