--  ╭──────────────────────────────────────────────────────────╮
--  │   Completion                                             │
--  ╰──────────────────────────────────────────────────────────╯

local has_words_before = function()
  if vim.api.nvim_buf_get_option(0, "buftype") == "prompt" then
    return false
  end
  local line, col = unpack(vim.api.nvim_win_get_cursor(0))
  return col ~= 0
    and vim.api.nvim_buf_get_text(0, line - 1, 0, line - 1, col, {})[1]:match("^%s*$") == nil
end

return {
  {
    "jackMort/ChatGPT.nvim",
    event = "VeryLazy",
    config = function()
      require("chatgpt").setup()
    end,
    dependencies = {
      "MunifTanjim/nui.nvim",
      "nvim-lua/plenary.nvim",
      "nvim-telescope/telescope.nvim",
    },
  },
  {
    "hrsh7th/nvim-cmp",
    dependencies = {
      "hrsh7th/cmp-nvim-lsp",
      {
        "L3MON4D3/LuaSnip",
        config = function()
          local ls = require("luasnip")
          ls.setup({})

          ls.add_snippets("all", {
            ls.snippet("todo", { ls.text_node("TODO(dbalatero): ") }),
          })
        end,
      },
      "saadparwaiz1/cmp_luasnip",
      "lukas-reineke/cmp-under-comparator",
      "hrsh7th/cmp-buffer",
      {
        -- add vscode-style icons to completion menu
        "onsails/lspkind-nvim",
        config = function()
          require("lspkind").init()
        end,
      },
    },
    config = function()
      local cmp = require("cmp")
      local cmp_buffer = require("cmp_buffer")
      local compare = require("cmp.config.compare")
      local luasnip = require("luasnip")

      luasnip.config.setup({})

      cmp.setup({
        formatting = {
          format = require("lspkind").cmp_format({
            mode = "symbol_text",
            max_width = 50,
          }),
        },
        snippet = {
          expand = function(args)
            luasnip.lsp_expand(args.body)
          end,
        },
        mapping = cmp.mapping.preset.insert({


tem.disabled .page-link,.accent-dark .page-item.disabled a{background-color:#fff;border-color:#dee2e6;color:#6c757d}.accent-dark [class*=sidebar-dark-] .sidebar a:not(.dropdown-item):not(.btn-app):not(.nav-link):not(.brand-link){color:#c2c7d0}.accent-dark [class*=sidebar-dark-] .sidebar a:not(.dropdown-item):not(.btn-app):not(.nav-link):not(.brand-link):hover{color:#fff}.accent-dark [class*=sidebar-light-] .sidebar a:not(.dropdown-item):not(.btn-app):not(.nav-link):not(.brand-link){color:#343a40}.accent-dark [class*=sidebar-light-] .sidebar a:not(.dropdown-item):not(.btn-app):not(.nav-link):not(.brand-link):hover{color:#212529}.dark-mode.accent-dark .page-item .page-link:focus,.dark-mode.accent-dark .page-item .page-link:hover{color:#3f474e}.accent-lightblue .btn-link,.accent-lightblue .nav-tabs .nav-link,.accent-lightblue a:not(.dropdown-item):not(.btn-app):not(.nav-link):not(.brand-link):not(.page-link):not(.btn){color:#3c8dbc}.accent-lightblue .btn-link:hover,.accent-lightblue .nav-tabs .nav-link:hover,.accent-lightblue a:not(.dropdown-item):not(.btn-app):not(.nav-link):not(.brand-link):not(.page-link):not(.btn):hover{color:#296282}.accent-lightblue .dropdown-item.active,.accent-lightblue .dropdown-item:active{background-color:#3c8dbc;color:#fff}.accent-lightblue .custom-control-input:checked~.custom-control-label::before{background-color:#3c8dbc;border-color:#23536f}.accent-lightblue .custom-control-input:checked~.custom-control-label::after{background-image:url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'%3E%3Cpath fill='%23fff' d='M6.564.75l-3.59 3.612-1.538-1.55L0 4.26 2.974 7.25 8 2.193z'/%3E%3C/svg%3E")}.accent-lightblue .custom-control-input:focus:not(:checked)~.custom-control-label::before,.accent-lightblue .custom-file-input:focus~.custom-file-label,.accent-lightblue .custom-select:focus,.accent-lightblue .form-control:focus:not(.is-invalid):not(.is-warning):not(.is-valid){border-color:#99c5de}.accent-lightblue .page-item .page-link{color:#3c8dbc}.accent-lightblue .page-item.active .page-link,.accent-lightblue .page-item.active a{background-color:#3c8dbc;border-color:#3c8dbc;color:#fff}.accent-lightblue .page-item.disabled .page-link,.accent-lightblue .page-item.disabled a{background-color:#fff;border-color:#dee2e6;color:#6c757d}.accent-lightblue [class*=sidebar-dark-] .sidebar a:not(.dropdown-item):not(.btn-app):not(.nav-link):not(.brand-link){color:#c2c7d0}.accent-lightblue [class*=sidebar-dark-] .sidebar a:not(.dropdown-item):not(.btn-app):not(.nav-link):not(.brand-link):hover{color:#fff}.accent-lightblue [class*=sidebar-light-] .sidebar a:not(.dropdown-item):not(.btn-app):not(.nav


75rem,    // 12px
  sm: 0.875rem,   // 14px
  base: 1rem,     // 16px
  lg: 1.125rem,   // 18px
  xl: 1.25rem,    // 20px
  '2xl': 1.5rem,  // 24px
  '3xl': 1.875rem, // 30px
  '4xl': 2.25rem,  // 36px
  '5xl': 3rem,     // 48px
  '6xl': 3.75rem,  // 60px
  '7xl': 4.5rem,   // 72px
  '8xl': 6rem,     // 96px
  '9xl': 8rem      // 128px
);

$ivory-font-weights: (
  'thin': 100,
  'extralight': 200,
  'light': 300,
  'normal': 400,
  'medium': 500,
  'semibold': 600,
  'bold': 700,
  'extrabold': 800,
  'black': 900
);

$ivory-line-heights: (
  none: 1,
  tight: 1.25,
  snug: 1.375,
  normal: 1.5,
  relaxed: 1.625,
  loose: 2
);

// =============================================================================
// BORDER TOKENS
// =============================================================================

$ivory-border-widths: (
  0: 0,
  1: 1px,
  2: 2px,
  4: 4px,
  8: 8px
);

$ivory-border-radius: (
  none: 0,
  sm: 0.125rem,   // 2px
  base: 0.25rem,  // 4px
  md: 0.375rem,   // 6px
  lg: 0.5rem,     // 8px
  xl: 0.75rem,    // 12px
  '2xl': 1rem,    // 16px
  '3xl': 1.5rem,  // 24px
  full: 9999px
);

// =============================================================================
// SHADOW TOKENS
// =============================================================================

$ivory-shadows: (
  none: none,
  sm: '0 1px 2px 0 rgb(0 0 0 / 0.05)',
  base: '0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1)',
  md: '0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1)',
  lg: '0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1)',
  xl: '0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1)',
  '2xl': '0 25px 50px -12px rgb(0 0 0 / 0.25)',
  inner: 'inset 0 2px 4px 0 rgb(0 0 0 / 0.05)'
);

// =============================================================================
// BREAKPOINT TOKENS
// =============================================================================

$ivory-breakpoints: (
  sm: 640px,
  md: 768px,
  lg: 1024px,
  xl: 1280px
);

// =============================================================================
// Z-INDEX TOKENS
// =============================================================================

$ivory-z-index: (
  auto: auto,
  0: 0,
  10: 10,
  20: 20,
  30: 30,
  40: 40,
  50: 50,
  dropdown: 1000,
  sticky: 1020,
  fixed: 1030,
  modal-backdrop: 1040,
  modal: 1050,
  popover: 1060,
  tooltip: 1070
);

// =============================================================================
// ANIMATION TOKENS
// =============================================================================

$ivory-transitions: (
  none: none,
  all: all 150ms cubic-bezier(0.4, 0, 0.2, 1),
  colors: color 150ms cubic-bezier(0.4, 0, 0.2, 1),
  opacity: opacity 150ms cubic-bezier(


namespace RTCV.UI
{
    using System;
    using System.Windows.Forms;
    using RTCV.CorruptCore;
    using RTCV.Common;
    using RTCV.UI.Modular;

    public partial class SettingsAboutForm : ComponentForm, IBlockable
    {
        private new void HandleMouseDown(object s, MouseEventArgs e) => base.HandleMouseDown(s, e);
        private new void HandleFormClosing(object s, FormClosingEventArgs e) => base.HandleFormClosing(s, e);

        public SettingsAboutForm()
        {
            InitializeComponent();
        }

        private void OnFormLoad(object sender, EventArgs e)
        {
            lbVe


	packets := make([]string, 0, len(q.Packets))
		for _, p := range q.Packets {
			packets = append(packets, string(p.Raw))
		}
		return packets
	}

	require.Empty(t, getPackets())
	now := monotime.Now()

	q.Add(packetEntry{Time: now, Raw: []byte("p3")})
	require.Equal(t, []string{"p3"}, getPackets())
	q.Add(packetEntry{Time: now.Add(time.Second), Raw: []byte("p4")})
	require.Equal(t, []string{"p3", "p4"}, getPackets())
	q.Add(packetEntry{Time: now.Add(-time.Second), Raw: []byte("p1")})
	require.Equal(t, []string{"p1", "p3", "p4"}, getPackets())
	q.Add(packetEntry{Time: now.Add(time.Second), Raw: []byte("p5")})
	require.Equal(t, []string{"p1", "p3", "p4", "p5"}, getPackets())
	q.Add(packetEntry{Time: now.Add(-time.Second), Raw: []byte("p2")})
	require.Equal(t, []string{"p1", "p2", "p3", "p4", "p5"}, getPackets())
}

func newUPDConnLocalhost(t testing.TB) *net.UDPConn {
	t.Helper()
	conn, err := net.ListenUDP("udp", &net.UDPAddr{IP: net.IPv4(127, 0, 0, 1), Port: 0})
	require.NoError(t, err)
	t.Cleanup(func() { conn.Close() })
	return conn
}

func makePacket(t *testing.T, p protocol.PacketNumber, payload []byte) []byte {
	t.Helper()
	hdr := wire.ExtendedHeader{
		Header: wire.Header{
			Type:             protocol.PacketTypeInitial,
			Version:          protocol.Version1,
			Length:           4 + protocol.ByteCount(len(payload)),
			DestConnectionID: protocol.ParseConnectionID([]byte{0xde, 0xad, 0xbe, 0xef, 0, 0, 0x13, 0x37}),
			SrcConnectionID:  protocol.ParseConnectionID([]byte{0xde, 0xad, 0xbe, 0xef, 0, 0, 0x13, 0x37}),
		},
		PacketNumber:    p,
		PacketNumberLen: protocol.PacketNumberLen4,
	}
	b, err := hdr.Append(nil, protocol.Version1)
	require.NoError(t, err)
	b = append(b, payload...)
	return b
}

func readPacketNumber(t *testing.T, b []byte) protocol.PacketNumber {
	t.Helper()
	hdr, data, _, err := wire.ParsePacket(b)
	require.NoError(t, err)
	require.Equal(t, protocol.PacketTypeInitial, hdr.Type)
	extHdr, err := hdr.ParseExtended(data)
	require.NoError(t, err)
	return extHdr.PacketNumber
}

// Set up a dumb UDP server.
// In production this would be a QUIC server.
func runServer(t *testing.T) (*net.UDPAddr, chan []byte) {
	done := make(chan struct{})
	t.Cleanup(func() {
		select {
		case <-done:
		case <-time.After(time.Second):
			t.Fatal("timeout")
		}
	})

	serverConn := newUPDConnLocalhost(t)
	serverReceivedPackets := make(chan []byte, 100)
	go func() {
		defer close(done)
		for {
			buf := make([]byte, protocol.MaxPacketBufferSize)
			// the ReadFromUDP will error as soon as the UDP conn is closed
			n, addr, err := serverConn.ReadFromUDP(buf)
			if err != nil {
				return
			}
			serverReceivedPackets


      # encoding: [0x01,0x20,0x01,0xf4]
# CHECK-TRAP: ddiv $zero, $zero, $9       # encoding: [0x00,0x09,0x00,0x1e]
# CHECK-TRAP: addiu $1, $zero, -1         # encoding: [0x24,0x01,0xff,0xff]
# CHECK-TRAP: bne $9, $1, 12              # encoding: [0x15,0x21,0x00,0x03]
# CHECK-TRAP: addiu $1, $zero, 1          # encoding: [0x24,0x01,0x00,0x01]
# CHECK-TRAP: dsll32 $1, $1, 31           # encoding: [0x00,0x01,0x0f,0xfc]
# CHECK-TRAP: teq $zero, $1, 6            # encoding: [0x00,0x01,0x01,0xb4]
# CHECK-TRAP: mflo $zero                  # encoding: [0x00,0x00,0x00,0x12]

  ddiv $0,$0
# CHECK-TRAP: teq $zero, $zero, 7         # encoding: [0x00,0x00,0x01,0xf4]

  ddiv  $4,$5,$6
# CHECK-TRAP: teq $6, $zero, 7            # encoding: [0x00,0xc0,0x01,0xf4]
# CHECK-TRAP: ddiv $zero, $5, $6          # encoding: [0x00,0xa6,0x00,0x1e]
# CHECK-TRAP: addiu $1, $zero, -1         # encoding: [0x24,0x01,0xff,0xff]
# CHECK-TRAP: bne $6, $1, 12              # encoding: [0x14,0xc1,0x00,0x03]
# CHECK-TRAP: addiu $1, $zero, 1          # encoding: [0x24,0x01,0x00,0x01]
# CHECK-TRAP: dsll32 $1, $1, 31           # encoding: [0x00,0x01,0x0f,0xfc]
# CHECK-TRAP: teq $5, $1, 6               # encoding: [0x00,0xa1,0x01,0xb4]
# CHECK-TRAP: mflo $4                     # encoding: [0x00,0x00,0x20,0x12]

  ddiv  $4,$5,$0
# CHECK-TRAP: teq $zero, $zero, 7         # encoding: [0x00,0x00,0x01,0xf4]

  ddiv  $4,$0,$0
# CHECK-TRAP: teq $zero, $zero, 7         # encoding: [0x00,0x00,0x01,0xf4]

  ddiv $0, $4, $5
# CHECK-TRAP: ddiv $zero, $4, $5          # encoding: [0x00,0x85,0x00,0x1e]


data).into_iter::<Value>();
///
///     for value in stream {
///         println!("{}", value.unwrap());
///     }
/// }
/// ```
pub struct StreamDeserializer<'de, R, T> {
    de: Deserializer<R>,
    offset: usize,
    failed: bool,
    output: PhantomData<T>,
    lifetime: PhantomData<&'de ()>,
}

impl<'de, R, T> StreamDeserializer<'de, R, T>
where
    R: read::Read<'de>,
    T: de::Deserialize<'de>,
{
    /// Create a JSON stream deserializer from one of the possible serde_json
    /// input sources.
    ///
    /// Typically it is more convenient to use one of these methods instead:
    ///
    ///   - Deserializer::from_str(...).into_iter()
    ///   - Deserializer::from_bytes(...).into_iter()
    ///   - Deserializer::from_reader(...).into_iter()
    pub fn new(read: R) -> Self {
        let offset = read.byte_offset();
        StreamDeserializer {
            de: Deserializer::new(read),
            offset: offset,
            failed: false,
            output: PhantomData,
            lifetime: PhantomData,
        }
    }

    /// Returns the number of bytes so far deserialized into a successful `T`.
    ///
    /// If a stream deserializer returns an EOF error, new data can be joined to
    /// `old_data[stream.byte_offset()..]` to try again.
    ///
    /// ```
    /// let data = b"[0] [1] [";
    ///
    /// let de = serde_json::Deserializer::from_slice(data);
    /// let mut stream = de.into_iter::<Vec<i32>>();
    /// assert_eq!(0, stream.byte_offset());
    ///
    /// println!("{:?}", stream.next()); // [0]
    /// assert_eq!(3, stream.byte_offset());
    ///
    /// println!("{:?}", stream.next()); // [1]
    /// assert_eq!(7, stream.byte_offset());
    ///
    /// println!("{:?}", stream.next()); // error
    /// assert_eq!(8, stream.byte_offset());
    ///
    /// // If err.is_eof(), can join the remaining data to new data and continue.
    /// let remaining = &data[stream.byte_offset()..];
    /// ```
    ///
    /// *Note:* In the future this method may be changed to return the number of
    /// bytes so far deserialized into a successful T *or* syntactically valid
    /// JSON skipped over due to a type error. See [serde-rs/json#70] for an
    /// example illustrating this.
    ///
    /// [serde-rs/json#70]: https://github.com/serde-rs/json/issues/70
    pub fn byte_offset(&self) -> usize {
        self.offset
    }

    fn peek_end_of_value(&mut self) -> Result<()> {
        match tri!(self.de.peek()) {
            Some(b' ') | Some(b'\n') | Some(b'\t') | Some(b'\r') | Some(b'"') | Some(b'[')
            | Some(b']') | Some(b'{') | Some(b'}') | Some(b',') | Some(b':') | None => Ok(()),
            Some(_) => {
                let position = self.de.read.peek_position();
                Err(Error::syntax(
                    ErrorCode::TrailingCharacters,
                    position.line,
                    position.column,
                ))
            }
        }
    }
}

impl<'de, R, T> Iterator for StreamDeserializer<'de, R, T>
where
    R: Read<'de>,
    T: de::Deserialize<'de>,
{
    type Item = Result<T>;

    fn next(&mut self) -> Option<Result<T>> {
        if R::should_early_return_if_failed && self.failed {
            return None;
        }

        // skip whitespaces, if any
        // this helps with trailing whitespaces, since whitespaces between


reInterrupts
/* 80382F20 0037EB80  39 61 00 30 */	addi r11, r1, 0x30
/* 80382F24 0037EB84  4B E4 42 51 */	bl _restgpr_27
/* 80382F28 0037EB88  80 01 00 34 */	lwz r0, 0x34(r1)
/* 80382F2C 0037EB8C  7C 08 03 A6 */	mtlr r0
/* 80382F30 0037EB90  38 21 00 30 */	addi r1, r1, 0x30
/* 80382F34 0037EB94  4E 80 00 20 */	blr

.global UpdateAllVoicesSync__Q44nw4r3snd6detail12VoiceManagerFUl
UpdateAllVoicesSync__Q44nw4r3snd6detail12VoiceManagerFUl:
/* 80382F38 0037EB98  94 21 FF F0 */	stwu r1, -0x10(r1)
/* 80382F3C 0037EB9C  7C 08 02 A6 */	mflr r0
/* 80382F40 0037EBA0  90 01 00 14 */	stw r0, 0x14(r1)
/* 80382F44 0037EBA4  93 E1 00 0C */	stw r31, 0xc(r1)
/* 80382F48 0037EBA8  7C 9F 23 78 */	mr r31, r4
/* 80382F4C 0037EBAC  93 C1 00 08 */	stw r30, 8(r1)
/* 80382F50 0037EBB0  7C 7E 1B 78 */	mr r30, r3
/* 80382F54 0037EBB4  4B EE B8 09 */	bl OSDisableInterrupts
/* 80382F58 0037EBB8  80 9E 00 08 */	lwz r4, 8(r30)
/* 80382F5C 0037EBBC  38 1E 00 08 */	addi r0, r30, 8
/* 80382F60 0037EBC0  48 00 00 24 */	b lbl_80382F84
lbl_80382F64:
/* 80382F64 0037EBC4  7C 86 23 78 */	mr r6, r4
/* 80382F68 0037EBC8  80 84 00 00 */	lwz r4, 0(r4)
/* 80382F6C 0037EBCC  88 A6 FF 88 */	lbz r5, -0x78(r6)
/* 80382F70 0037EBD0  2C 05 00 00 */	cmpwi r5, 0
/* 80382F74 0037EBD4  41 82 00 10 */	beq lbl_80382F84
/* 80382F78 0037EBD8  88 A6 FF 8D */	lbz r5, -0x73(r6)
/* 80382F7C 0037EBDC  7C A5 FB 78 */	or r5, r5, r31
/* 80382F80 0037EBE0  98 A6 FF 8D */	stb r5, -0x73(r6)
lbl_80382F84:
/* 80382F84 0037EBE4  7C 04 00 40 */	cmplw r4, r0
/* 80382F88 0037EBE8  40 82 FF DC */	bne lbl_80382F64
/* 80382F8C 0037EBEC  4B EE B7 F9 */	bl OSRestoreInterrupts
/* 80382F90 0037EBF0  80 01 00 14 */	lwz r0, 0x14(r1)
/* 80382F94 0037EBF4  83 E1 00 0C */	lwz r31, 0xc(r1)
/* 80382F98 0037EBF8  83 C1 00 08 */	lwz r30, 8(r1)
/* 80382F9C 0037EBFC  7C 08 03 A6 */	mtlr r0
/* 80382FA0 0037EC00  38 21 00 10 */	addi r1, r1, 0x10
/* 80382FA4 0037EC04  4E 80 00 20


	// The SDK's default minimum gas price is set to "" (empty value) inside
	// app.toml. If left empty by validators, the node will halt on startup.
	// However, the chain developer can set a default app.toml value for their
	// validators here.
	//
	// In summary:
	// - if you leave srvCfg.MinGasPrices = "", all validators MUST tweak their
	//   own app.toml config,
	// - if you set srvCfg.MinGasPrices non-empty, validators CAN tweak their
	//   own app.toml to override, or use this default value.
	//
	// In tests, we set the min gas prices to 0.
	// srvCfg.MinGasPrices = "0stake"
	// srvCfg.BaseConfig.IAVLDisableFastNode = true // disable fastnode by default

	customAppConfig := CustomAppConfig{
		Config: *srvCfg,
	}

	customAppTemplate := serverconfig.DefaultConfigTemplate
	// Edit the default template file
	//
	// customAppTemplate := serverconfig.DefaultConfigTemplate + `
	// [wasm]
	// # This is the maximum sdk gas (wasm and storage) that we allow for any x/wasm "smart" queries
	// query_gas_limit = 300000
	// # This is the number of wasm vm instances we keep cached in memory for speed-up
	// # Warning: this is currently unstable and may lead to crashes, best to keep for 0 unless testing locally
	// lru_size = 0`

	return customAppTemplate, customAppConfig
}
package cmd

import (
	"errors"
	"io"

	"cosmossdk.io/log"
	confixcmd "cosmossdk.io/tools/confix/cmd"
	dbm "github.com/cosmos/cosmos-db"
	"github.com/cosmos/cosmos-sdk/client"
	"github.com/cosmos/cosmos-sdk/client/debug"
	"github.com/cosmos/cosmos-sdk/client/flags"
	"github.com/cosmos/cosmos-sdk/client/keys"
	"github.com/cosmos/cosmos-sdk/client/pruning"
	"github.com/cosmos/cosmos-sdk/client/rpc"
	"github.com/cosmos/cosmos-sdk/client/snapshot"
	"github.com/cosmos/cosmos-sdk/server"
	servertypes "github.com/cosmos/cosmos-sdk/server/types"
	"github.com/cosmos/cosmos-sdk/types/module"
	authcmd "github.com/cosmos/cosmos-sdk/x/auth/client/cli"
	"github.com/cosmos/cosmos-sdk/x/crisis"
	genutilcli "github.com/cosmos/cosmos-sdk/x/genutil/client/cli"
	"github.com/spf13/cobra"
	"github.com/spf13/viper"

	"defund/app"

	rollserv "github.com/rollkit/cosmos-sdk-starter/server"
	rollconf "github.com/rollkit/rollkit/config"
)

func initRootCmd(
	rootCmd *cobra.Command,
	txConfig client.TxConfig,
	basicManager module.BasicManager,
) {
	rootCmd.AddCommand(
		genutilcli.InitCmd(basicManager, app.DefaultNodeHome),
		debug.Cmd(),
		confixcmd.ConfigCommand(),
		pruning.Cmd(newApp, app.DefaultNodeHome),
		snapshot.Cmd(newApp),
	)

	server.AddCommandsWithStartCmdOptions(
		rootCmd,
		app.DefaultNodeHome,
		newApp, appExport,
		server.StartCmdOptions{
			AddFlags: func(cmd *cobra.Command) {
				rollconf.AddFlags(cmd)
				addModuleInitFlags(cmd)
			},
			StartCommandHandler: rollserv.StartHandler[servertypes.Application],
		})

	// add keybase, auxiliary RPC, query, genesis, and tx child commands
	rootCmd.AddCommand(
		server.StatusCommand(),
		genesisCommand(txConfig, basicManager)


 v[v_wei_os], s[s_p_wei:s_p_wei+3], s[s_tmp] offen offset:0
    s_or_b64 exec, exec, s[s_tmp+4:s_tmp+5]

L_igemm_wrw_gtcx_nchw_fp16_bx4_ex0_bt128x32x16_wt64x16x4_ws1x1_wr1x1_ta1x2x1x4_1x8x1x32_tb1x2x1x1_1x8x1x32_out:
    s_endpgm
.rodata
.p2align 6
.amdhsa_kernel igemm_wrw_gtcx_nchw_fp16_bx4_ex0_bt128x32x16_wt64x16x4_ws1x1_wr1x1_ta1x2x1x4_1x8x1x32_tb1x2x1x1_1x8x1x32
    .amdhsa_group_segment_fixed_size 16384
    .amdhsa_user_sgpr_kernarg_segment_ptr 1
    .amdhsa_system_sgpr_workgroup_id_x 1
    .amdhsa_system_vgpr_workitem_id 0
    .amdhsa_next_free_vgpr 58
    .amdhsa_next_free_sgpr 60
    .amdhsa_ieee_mode 0
    .amdhsa_dx10_clamp 0
.end_amdhsa_kernel

.amdgpu_metadata
---
amdhsa.version: [ 1, 0 ]
amdhsa.kernels:
  - .name: igemm_wrw_gtcx_nchw_fp16_bx4_ex0_bt128x32x16_wt64x16x4_ws1x1_wr1x1_ta1x2x1x4_1x8x1x32_tb1x2x1x1_1x8x1x32
    .symbol: igemm_wrw_gtcx_nchw_fp16_bx4_ex0_bt128x32x16_wt64x16x4_ws1x1_wr1x1_ta1x2x1x4_1x8x1x32_tb1x2x1x1_1x8x1x32.kd
    .sgpr_count: 66
    .vgpr_count: 58
    .kernarg_segment_align: 8
    .kernarg_segment_size: 96
    .group_segment_fixed_size: 16384
    .private_segment_fixed_size: 0
    .wavefront_size: 64
    .reqd_workgroup_size : [256, 1, 1]
    .max_flat_workgroup_size: 256
    .args:
    - { .name: p_in      , .size: 8, .offset:   0, .value_kind: global_buffer, .value_type: f32, .address_space: global, .is_const: false}
    - { .name: p_wei     , .size: 8, .offset:   8, .value_kind: global_buffer, .value_type: f32, .address_space: global, .is_const: true}
    - { .name: p_out     , .size: 8, .offset:  16, .value_kind: global_buffer, .value_type: f32, .address_space: global, .is_const: true}
    - { .name: hi        , .size: 4, .offset:  24, .value_kind: by_value, .value_type: i32}
    - { .name: wi        , .size: 4, .offset:  28, .value_


ill be disconnected so answer will be No
Node 0 and 2 will be connected through node
1 so answer will be Yes similarly for other
queries we can find whether two nodes are
connected or not

```

为了解决增量连接[的问题，使用了不相交的数据结构](https://www.geeksforgeeks.org/union-find/)。 在此，每个连通组件代表一个集合，如果两个节点属于同一集合，则表示它们已连接。

下面给出了实现，此处我们通过等级压缩和路径压缩使用[并集](https://www.geeksforgeeks.org/union-find-algorithm-set-2-union-by-rank/)

## C++

```cpp

// C++ implementation of incremental connectivity
#include<bits/stdc++.h>
using namespace std;

// Finding the root of node i
int root(int arr[], int i)
{
    while (arr[i] != i)
    {
       arr[i] = arr[arr[i]];
       i = arr[i];
    }
    return i;
}

// union of two nodes a and b
void weighted_union(int arr[], int rank[],
                            int a, int b)
{
    int root_a = root (arr, a);
    int root_b = root (arr, b);

    // union based on rank
    if (rank[root_a] < rank[root_b])
    {
       arr[root_a] = arr[root_b];
       rank[root_b] += rank[root_a];
    }
    else
    {
        arr[root_b] = arr[root_a];
        rank[root_a] += rank[root_b];
    }
}

// Returns true if two nodes have same root
bool areSame(int arr[], int a, int b)
{
    return (root(arr, a) == root(arr, b));
}

// Performing an operation according to query type
void query(int type, int x, int y, int arr[], int rank[])
{
    // type 1 query means checking if node x and y
    // are connected or not
    if (type == 1)
    {
        // If roots of x and y is same then yes
        // is the answer
        if (areSame(arr, x, y) == true)
            cout << "Yes" << endl;
        else
           cout << "No" << endl;
    }

    // type 2 query refers union of x and y
    else if (type == 2)
    {
        // If x and y have different roots then
        // union them
        if (areSame(arr, x, y) == false)
            weighted_union(arr, rank, x, y);
    }
}

// Driver function
int main()
{
    // No.of nodes
    int n = 7;

    // The following two arrays are used to
    // implement disjoint set data structure.
    // arr[] holds the parent nodes while rank
    // array holds the rank of subset
    int arr[n], rank[n];

    // initializing both array and rank
    for (int i=0; i<n; i++)
    {
        arr[i] = i;
        rank[i] = 1;
    }

    // number of queries
    int q = 11;
    query(1, 0, 1, arr, rank);
    query(2, 0, 1, arr, rank);
    query(2, 1, 2, arr, rank);
    query(1, 0, 2, arr, rank);
    query(2, 0, 2, arr, rank);
    query(2, 2, 3, arr, rank);
    query(2, 3, 4,


_code/Document_DuplicateComputeFields_failure.a");
    return cached_DuplicateComputeFields_2;
  }

  @Test
  public void testDuplicateComputeFieldsFailure() {
    assertLiveFail(get_DuplicateComputeFields_2());
  }

  @Test
  public void testDuplicateComputeFieldsNotTerribleLineNumbers() {
    assertNotTerribleLineNumbers(get_DuplicateComputeFields_2());
  }

  @Test
  public void testDuplicateComputeFieldsExceptionFree() {
    assertExceptionFree(get_DuplicateComputeFields_2());
  }

  @Test
  public void testDuplicateComputeFieldsTODOFree() {
    assertTODOFree(get_DuplicateComputeFields_2());
  }

  @Test
  public void stable_DuplicateComputeFields_2() {
    String live = get_DuplicateComputeFields_2();
    StringBuilder gold = new StringBuilder();
    gold.append("Path:Document_DuplicateComputeFields_failure.a");
    gold.append("\n--ISSUES-------------------------------------------");
    gold.append("\n[{\"range\":{\"start\":{\"line\":1,\"character\":0,\"byte\":14},\"end\":{\"line\":1,\"character\":13,\"byte\":27}},\"severity\":1,\"source\":\"error\",\"message\":\"Global field 'x' was already defined\",\"file\":\"./test_code/Document_DuplicateComputeFields_failure.a\"},{\"range\":{\"start\":{\"line\":3,\"character\":0,\"byte\":42},\"end\":{\"line\":3,\"character\":13,\"byte\":55}},\"severity\":1,\"source\":\"error\",\"message\":\"Global field 'y' was already defined\",\"file\":\"./test_code/Document_DuplicateComputeFields_failure.a\"}]\"--JAVA---------------------------------------------");
    gold.append("\n");
    gold.append("\nFailedValidation");
    assertStable(live, gold);
  }
  private String cached_DuplicateEnums_3 = null;
  private String get_DuplicateEnums_3() {
    if (cached_DuplicateEnums_3 != null) {
      return cached_DuplicateEnums_3;
    }
    cached_DuplicateEnums_3 = generateTestOutput(false, "DuplicateEnums_3", "./test_code/Document_DuplicateEnums_failure.a");
    return cached_DuplicateEnums_3;
  }

  @Test
  public void testDuplicateEnumsFailure() {
    assertLiveFail(get_DuplicateEnums_3());
  }

  @Test
  public void testDuplicateEnumsNotTerribleLineNumbers() {
    assertNotTerribleLineNumbers(get_DuplicateEnums_3());
  }

  @Test
  public void testDuplicateEnumsExceptionFree() {
    assertExceptionFree(get_DuplicateEnums_3());
  }

  @Test
  public void testDuplicateEnumsTODOFree() {
    assertTODOFree(get_DuplicateEnums_3());
  }

  @Test
  public void stable_DuplicateEnums_3() {
    String live = get_DuplicateEnums_3();
    StringBuilder gold = new StringBuilder();
    gold.append("Path:Document_DuplicateEnums_failure.a");
    gold.append("\n--ISSUES-------------------------------------------");
    gold.append("\n[{\"range\":{\"start\":{\"line\":1,\"character\":0,\"byte\":13},\"end\":{\"line\":1,\"character\":12,\"byte\":25}},\"severity\":1,\"source\":\"error\",\"message\":\"The enumeration 'X' was already defined.\",\"file\":\"./test_code/Document_DuplicateEnums_failure.a\"},{\"range\":{\"start\":{\"line\":0,\"character\":0,\"byte\":0},\"end\":{\"line\":0,\"character\":12,\"byte\":12}},\"severity\":1,\"source\":\"error\",\"message\":\"The enumeration 'X' was defined here.\",\"file\":\"./test_code/Document_DuplicateEnums_failure.a\"}]\"--JAVA---------------------------------------------");
    gold.append("\n");
    gold.append("\nFailedValidation");
    assertStable


dwhisper',3876,3876,58,58,4,nil,nil,0,nil,nil,35,"AH",nil,0},
[1850] = {'Putridius',3589,3589,58,58,2,{[28]={{48.05,67.39}}},nil,28,nil,nil,14,nil,nil,0},
[1851] = {'The Husk',4370,4370,62,62,4,{[28]={{62.15,36.31}}},nil,28,nil,nil,14,nil,nil,0},
[1852] = {'Araj the Summoner',8300,8300,61,61,1,{[28]={{45.27,69.21}}},nil,28,nil,nil,21,nil,nil,0},
[1853] = {'Darkmaster Gandling',50300,50300,61,61,1,nil,nil,0,nil,nil,21,nil,nil,0},
[1854] = {'High Priest Thel\'danis',3101,3101,58,58,0,{[28]={{52.05,83.27}}},{[28]={{{52.01,83.34},{51.92,83.52},{51.91,83.76},{52.01,83.94},{52.15,84.04},{52.29,83.95},{52.4,83.76},{52.4,83.52},{52.31,83.34},{52.16,83.31},{52.03,83.36}}}},28,{8416},{8414},12,"A",nil,2},
[1855] = {'Tirion Fordring',2000,2000,61,61,1,{[139]={{4.73,38.4}}},nil,139,{5542,5543,5544,5742,5781,5845,5846,5861},{5542,5543,5544,5742,5781,5845,5848},250,"AH",nil,3},
[1857] = {'Pissed Vendor',5000,5000,1,1,0,nil,nil,0,nil,nil,35,"AH","Pissed Vendor",0},
[1858] = {'Pissed not a Vendor',5000,5000,1,1,0,nil,nil,0,nil,nil,35,"AH","Pissed Vendor",0},
[1860] = {'Voidwalker',490,490,17,17,0,nil,nil,0,nil,nil,14,nil,nil,0},
[1861] = {'Greater Voidwalker',5000,5000,1,1,0,nil,nil,0,nil,nil,35,"AH",nil,0},
[1862] = {'Lesser Netherwalker',5000,5000,1,1,0,nil,nil,0,nil,nil,35,"AH",nil,0},
[1863] = {'Succubus',303,303,70,70,0,nil,nil,0,nil,nil,14,nil,nil,0},
[1864] = {'Greater Succubus',5000,5000,1,1,0,nil,nil,0,nil,nil,35,"AH",nil,0},
[1865] = {'Ravenclaw Raider',247,273,12,13,0,{[130]={{46.04,54.15},{46.22,54.13},{46.68,54.2},{47.48,55.83},{45.59,56.39},{45.83,55.04},{46.14,55.66},{46.93,55.54},{46.56,53.23},{47.53,54.58},{47.98,52.91}}},nil,130,nil,nil,21,nil,nil,0},
[1866] = {'Ravenclaw Slave',222,247,11,12,0,{[130]={{45.83,54.42},{45.68,54.45},{46.24,54.63},{46.96,54.1},{53.02,16.19},{52.91,15.3},{53.41,14.99},{53.99


trchr(str, '<');
	if(busy)
	{
		if(!extra)
			extra = str + strlen(str), *extra++ = ' ';
		strcpy(extra, "<BUSY>");
	}
	else
	{
		if(extra)
			extra[-1] = 0;
	}
	SetWindowText(hDlg, str);
#endif
}

#define HOOKCOUNT 4096
#define MAX_WORRY_COUNT 6000
void LuaRescueHook(lua_State* L, lua_Debug *dbg)
{
	LuaContextInfo& info = GetCurrentInfo();

	info.worryCount++;

	if(info.stopWorrying && !info.panic)
	{
		if(info.worryCount > (MAX_WORRY_COUNT >> 2))
		{
			// the user already said they're OK with the script being frozen,
			// but we don't trust their judgement completely,
			// so periodically update the main loop so they have a chance to manually stop it
			info.worryCount = 0;
//			gens_wait(L);
			info.stopWorrying = true;
		}
		return;
	}

	if(info.worryCount > MAX_WORRY_COUNT || info.panic)
	{
		info.worryCount = 0;
		info.stopWorrying = false;

		bool stoprunning = true;
		bool stopworrying = true;
		if(!info.panic)
		{
//			Clear_Sound_Buffer();
#if defined(ASK_USER_ON_FREEZE) && defined(_WIN32)
			DialogsOpen++;
			int answer = MessageBox(HWnd, "A Lua script has been running for quite a while. Maybe it is in an infinite loop.\n\nWould you like to stop the script?\n\n(Yes to stop it now,\n No to keep running and not ask again,\n Cancel to keep running but ask again later)", "Lua Alert", MB_YESNOCANCEL | MB_DEFBUTTON3 | MB_ICONASTERISK);
			DialogsOpen--;
			if(answer == IDNO)
				stoprunning = false;
			if(answer == IDCANCEL)
				stopworrying = false;
#else
			stoprunning = false;
#endif
		}

		if(!stoprunning && stopworrying)
		{
			info.stopWorrying = true; // don't remove the hook because we need it still running for RequestAbortLuaScript to work
			indicateBusy(info.L, true);
		}

		if(stoprunning)
		{
			//lua_sethook(L, NULL, 0, 0);
			assert(L->errfunc || L->errorJmp);
			luaL_error(L, info.panic ? info.panicMessage : "terminated by user");
		}

		info.panic = false;
	}
}

void printfToOutput(const char* fmt, ...)
{
	va_list list;
	va_start(list, fmt);
	int len = vscprintf(fmt, list);
	char* str = new char[len+1];
	vsprintf(str, fmt, list);
	va_end(list);
	LuaContextInfo& info = GetCurrentInfo();
	if(info.print)
	{
		lua_State* L = info.L;
		int uid = luaStateToUIDMap[L];
		info.print(uid, str);
		info.print(uid, "\r\n");
		worry(L,300);
	}
	else
	{
		fprintf(stdout, "%s\n", str);
	}
	delete[] str;
}

bool FailVerifyAtFrameBoundary(lua_State* L, const char* funcName, int unstartedSeverity=2, int inframeSeverity=2)
{//TODO
/*	if (!((Genesis_Started)||(SegaCD_Started)||


/*
 * Copyright 2024 GoatBytes.IO
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 */

package external

import org.gradle.api.Project
import org.gradle.api.provider.ListProperty
import org.gradle.api.provider.ValueSource
import org.gradle.api.provider.ValueSourceParameters
import org.gradle.process.ExecOperations
import java.io.ByteArrayOutputStream
import javax.inject.Inject

/**
 * A class for executing commands in Gradle and capturing their output.
 *
 * This class provides a convenient way to run commands within Gradle builds
 * and access the standard output, standard error, and exit code of the executed command.
 */
class CommandLine(private val project: Project) {

  /**
   * Executes a command in the shell and returns the result.
   *
   * This function takes a variable number of strings as arguments, representing
   * the command and its arguments. It constructs a [Source] object with these arguments
   * and retrieves the execution result using Gradle's provider mechanism.
   *
   * @param command The command and its arguments as a list of strings.
   * @return A [Result] object containing the standard output, standard error,
   * and exit code of the executed command.
   */
  fun execute(vararg command: String): Result = project.providers.of(Source::class.java) {
    parameters.commands.set(listOf("sh", "-c") + command.toList())
  }.get()

  /**
   * An interface extending ValueSourceParameters, meant to specify parameters for
   * [CommandLineValueSource]. It includes a commands parameter, representing the executable and
   * its arguments as a list of strings.
   *
   * Example:
   * To execute a git status command:
   *
   * ```kotlin
   * spec.parameters.commands.set(listOf("git", "status"))
   * ```
   */
  interface Params : ValueSourceParameters {
    /** A list property containing the command and its arguments as strings. */
    val commands: ListProperty<String>
  }

  /**
   * The result of executing a command in a shell.
   *
   * @property stdout The standard output
   * @property stderr The standard error
   * @property exitCode The exit status of the command
   */
  data class Result(
    val stdout: String,
    val stderr: String,
    val exitCode: Int
  ) {
    /** If the command returned a success status code */
    val isSuccess = exitCode == 0
  }

  /**
   * This ValueSource implementation allows for the execution of command-line operations within
   * Gradle's configuration phase and captures their output. Utilizing Gradle's ExecOperations, it
   * executes a specified command line and returns the output as a string.
   *
   * Usage:
   *
   * ```kotlin
   * val commandOutput: String = project.providers.of(CommandLine.Source::class.java) {
   *   parameters.commands.set(listOf("echo", "Hello, World!"))
   * }.get()
   * println("Command Output: $commandOutput")
   * ```
   */
  abstract class Source : ValueSource<Result, Params> {

    @get:Inject
    abstract val execOperations: ExecOperations

    override fun


"ON" | "OFF",
        redirect?: [redirect: "REDIRECT", client_id: number],
        prefix?: Array<[prefix: "PREFIX", prefix: string]>,
        bcast?: "BCAST",
        optout?: "OPTOUT",
        noloop?: "NOLOOP"
    ): Result<unknown, Context>;

    /**
     * Enable or disable server assisted client side caching support
     * - _group_: connection
     * - _complexity_: O(1). Some options may introduce additional complexity.
     * - _since_: 6.0.0
     *
     * [Full docs](https://redis.io/commands/client-tracking)
     */
    client(
        client_subcommand: "TRACKING",
        status: "ON" | "OFF",
        redirect?: [redirect: "REDIRECT", client_id: number],
        prefix?: Array<[prefix: "PREFIX", prefix: string]>,
        bcast?: "BCAST",
        optin?: "OPTIN",
        noloop?: "NOLOOP"
    ): Result<unknown, Context>;

    /**
     * Enable or disable server assisted client side caching support
     * - _group_: connection
     * - _complexity_: O(1). Some options may introduce additional complexity.
     * - _since_: 6.0.0
     *
     * [Full docs](https://redis.io/commands/client-tracking)
     */
    client(
        client_subcommand: "TRACKING",
        status: "ON" | "OFF",
        redirect?: [redirect: "REDIRECT", client_id: number],
        prefix?: Array<[prefix: "PREFIX", prefix: string]>,
        bcast?: "BCAST",
        optin?: "OPTIN",
        optout?: "OPTOUT",
        noloop?: "NOLOOP"
    ): Result<unknown, Context>;

    /**
     * Return information about server assisted client side caching for the current connection
     * - _group_: connection
     * - _complexity_: O(1)
     * - _since_: 6.2.0
     *
     * [Full docs](https://redis.io/commands/client-trackinginfo)
     */
    client(client_subcommand: "TRACKINGINFO"): Result<unknown, Context>;

    /**
     * Unblock a client blocked in a blocking command from a different connection
     * - _group_: connection
     * - _complexity_: O(log N) where N is the number of client connections
     * - _since_: 5.0.0
     *
     * [Full docs](https://redis.io/commands/client-unblock)
     */
    client(
        client_subcommand: "UNBLOCK",
        client_id: number,
        unblock_type?: "TIMEOUT" | "ERROR"
    ): Result<unknown, Context>;

    /**
     * Assign new hash slots to receiving node
     * - _group_: cluster
     * - _complexity_: O(N) where N is the total number of hash slot arguments
     * - _since_: 3.0.0
     *
     * [Full docs](https://redis.io/commands/cluster-addslots)
     */
    cluster(cluster_subcommand: "ADDSLOTS", ...slot: Array<number>): Result<unknown, Context>;

    /**
     * Advance the cluster config epoch
     * - _group_: cluster
     * - _complexity_: O(1)
     * - _since_: 3.0.0
     *
     * [Full docs](https://redis.io/commands/cluster-bumpepoch)
     */
    cluster(cluster_subcommand: "BUMPEPOCH"): Result<unknown, Context>;

    /**
     * Return the number of failure reports active for a given node
     * - _group_: cluster
     * - _complexity_: O(N) where N is the number of failure reports
     * - _since_: 3.0.0
     *
     * [Full docs](https://redis.io/commands/cluster-count-failure-reports)
     */
    cluster(cluster_subcommand: "COUNT-FAILURE-REPORTS", node_id: string): Result<unknown, Context>;

    /**


..
    'response', 0,...
    'left_scatter', false,...
    'right_scatter', false,...
    'photostim', Photostim); % can have multiple photostim
%%
for unit_id = unit_ids'
%%
% We first extract trial IDs from the Unit IDs.

    unit_trial_id = unit_trials(unit_id);
%%
% Then filter out outliers from the Sample, Delay, and Response time points
% with which we derive a "good enough" estimate.

    trial = nwb.intervals_trials.getRow(unit_trial_id, 'useId', true,...
        'columns', {'PoleInTime', 'PoleOutTime', 'CueTime', 'GoodTrials'});
    unit_sample = trial.PoleInTime;
    unit_delay = trial.PoleOutTime;
    unit_response = trial.CueTime;
    unit_good_trials = trial.GoodTrials;

    % Subjective parameters
    delay_threshold = 0.064;
    response_threshold = 0.43;
    expected_delay_offset = 1.3; % determined from figure 1a
    expected_response_offset = 1.3;

    expected_delay = unit_sample + expected_delay_offset;
    expected_response = unit_delay + expected_response_offset;
    good_delay = (unit_delay > expected_delay - delay_threshold) &...
        (unit_delay < expected_delay + delay_threshold);
    good_response = (unit_response > expected_response - response_threshold) &...
        (unit_response < expected_response + response_threshold);
    avg_sample = mean(unit_sample(good_delay & good_response));
    avg_delay = mean(unit_delay(good_delay & good_response));
    avg_response = mean(unit_response(good_delay & good_response));
%%
% Filter the rest of the data by "good" trials.

    unit_good_trials = unit_good_trials & good_delay & good_response;

    unit_trial_id = unit_trial_id(unit_good_trials);

    unit_spike_time = unit_times(unit_id);
    unit_spike_time = unit_spike_time(unit_good_trials);
%%
% Retrieve good trial data and organize by stimulation type.

    trial = nwb.intervals_trials.getRow(unit_trial_id, 'useId', true,...
        'columns', {'start_time', 'HitR', 'HitL', 'StimTrials', 'PhotostimulationType'});
    unit_is_photostim = logical(trial.StimTrials);
    unit_stim_type = trial.PhotostimulationType;

    unit_no_stim = ~unit_is_photostim & 0 == unit_stim_type;
    unit_sample_stim = unit_is_photostim & 1 == unit_stim_type;
    unit_early_stim = unit_is_photostim & 2 == unit_stim_type;
    unit_middle_stim = unit_is_photostim & 3 == unit_stim_type;
%%
% Compose Scatter Plots and the Peristimulus Time Histogram zeroed on the Response
% time.

    xs = unit_spike_time - trial.start_time - avg_response;
    ys = unit_trial_id;

    curr_unit = unit_struct;

    curr_unit.xs = xs;
    curr_unit.ys = ys;
    curr_unit.left_scatter = logical(trial.HitL);
    curr_unit.right_scatter = logical(trial.HitR);
    curr_unit.sample = avg_sample - avg_response;
    curr_unit.delay = avg_delay - avg_response;
    curr_unit.response = 0;

    % Photostim periods
    curr_unit.photostim.ind = unit_no_stim;

    % Sample
    if any(unit_sample_stim)
        SampleStim = Photostim;
        SampleStim.ind = unit_sample_stim;
        SampleStim.period = 'Sample';
        SampleStim.duration = 0.5;
        SampleStim.ramp_offset = 0.1;
        curr_unit.phot


 != dyr[iarray]) {
					vwarn("For receiver array %li: calculated dyrcv=%f given=%f", iarray, dyrcv, dyr[iarray]);
					vwarn("The calculated receiver distance %f is used", dyrcv);
				}
			}

			// calculate coordinates
			for (ir=0; ir<nrcv; ir++) {
				rec->xr[nrec]=xrcv1[iarray]-sub_x0+ir*dxrcv;
				rec->yr[nrec]=yrcv1[iarray]-sub_y0+ir*dyrcv;
				rec->zr[nrec]=zrcv1[iarray]-sub_z0+ir*dzrcv;

				rec->x[nrec]=NINT((rec->xr[nrec])/dx);
				rec->y[nrec]=NINT((rec->yr[nrec])/dy);
				rec->z[nrec]=NINT((rec->zr[nrec])/dz);
				nrec++;
			}
		}
		free(xrcv1);
		free(xrcv2);
		free(yrcv1);
		free(yrcv2);
		free(zrcv1);
		free(zrcv2);
		free(dxr);
		free(dyr);
		free(dzr);
        free(nlrcv);
	}

    rec->n=rec->max_nrec;
	return 0;
}


    let _ = qiniu_ng_str_list_t::from(strlist2);
    is_eql
}

/// @brief 复制字符串列表实例
/// @param[in] strlist 字符串列表实例
/// @retval qiniu_ng_str_list_t 返回复制的字符串列表实例。在使用完毕后，两个字符串列表实例必须分别调用 `qiniu_ng_str_list_free()` 方法释放内存
#[no_mangle]
pub extern "C" fn qiniu_ng_str_list_clone(strlist: qiniu_ng_str_list_t) -> qiniu_ng_str_list_t {
    let strlist = Option::<Box<[Box<ucstr>]>>::from(strlist);
    qiniu_ng_str_list_t::from(strlist.clone()).tap(|_| {
        let _ = qiniu_ng_str_list_t::from(strlist);
    })
}

/// @brief 释放字符串列表实例
/// @param[in,out] strlist 字符串列表实例地址，释放完毕后该字符串列表实例将不再可用
#[no_mangle]
pub extern "C" fn qiniu_ng_str_list_free(strlist: *mut qiniu_ng_str_list_t) {
    if let Some(strlist) = unsafe { strlist.as_mut() } {
        let _ = Option::<Box<[Box<ucstr>]>>::from(*strlist);
        *strlist = qiniu_ng_str_list_t::default();
    }
}

/// @brief 判断字符串列表是否是 NULL
/// @param[in] strlist 字符串列表实例
/// @retval bool 如果返回 `true` 则表示字符串列表是 `NULL`
#[no_mangle]
pub extern "C" fn qiniu_ng_str_list_is_null(strlist: qiniu_ng_str_list_t) -> bool {
    strlist.is_null()
}

/// @brief 判断字符串列表实例是否已经被释放
/// @param[in] strlist 字符串列表实例
/// @retval bool 如果返回 `true` 则表示字符串列表实例已经被释放，该实例不再可用
#[no_mangle]
pub extern "C" fn qiniu_ng_str_list_is_freed(strlist: qiniu_ng_str_list_t) -> bool {
    strlist.is_null()
}

/// @brief 字符串映射
/// @details 封装一个 C 字符串映射
/// @note
///   * 当 SDK 的 API 返回字符串映射实例后，调用 `qiniu_ng_str_map_each_entry()` 逐一获得字符串映射的键值对。
///   * 当 `qiniu_ng_str_map_t` 使用完毕后，请务必调用 `qiniu_ng_str_map_free()` 方法释放内存。
/// @note
///   * 调用 `qiniu_ng_str_map_new()` 创建一个字符串映射实例
///   * 多次调用 `qiniu_ng_str_map_set()` 向字符串映射实例输入键值对
///   * 当 `qiniu_ng_str_map_t` 使用完毕后，请务必调用 `qiniu_ng_str_map_free()` 方法释放内存。
/// @note 对该结构体不可跨线程修改数据，这一过程不保证线程安全性。
#[repr(C)]
#[derive(Copy, Clone)]
pub struct qiniu_ng_str_map_t(*mut c_void);

impl Default for qiniu_ng_str_map_t {
    #[inline]
    fn defaul


           3 => MethodHandleKind::PutField,
            4 => MethodHandleKind::PutStatic,
            5 => MethodHandleKind::InvokeVirtual,
            6 => MethodHandleKind::InvokeStatic,
            7 => MethodHandleKind::InvokeSpecial,
            8 => MethodHandleKind::NewInvokeSpecial,
            9 => MethodHandleKind::InvokeInterface,
            other => return Err(ClassError::UnknownMethodHandleType(other)),
        })
    }
}

#[derive(Clone, Debug, PartialEq)]
pub enum Constant {
    /// Just here to occupy the space that would be occupied by the upper half
    /// of a 64-bit constant table entry. It is not part of the spec, and an
    /// implementation detail.
    Nothing,

    Integer(i32),
    Float(f32),
    Long(i64),
    Double(f64),
    String(PoolIndex),

    StringData(String),

    Class(PoolIndex),
    MethodType(PoolIndex),
    FieldRef {
        class: PoolIndex,
        name_and_type: PoolIndex,
    },
    MethodRef {
        class: PoolIndex,
        name_and_type: PoolIndex,
    },
    InterfaceMethodRef {
        class: PoolIndex,
        name_and_type: PoolIndex,
    },
    NameAndType {
        name: PoolIndex,
        ty: PoolIndex,
    },

    MethodHandle {
        kind: MethodHandleKind,
        index: PoolIndex,
    },

    InvokeDynamic {
        bootstrap_method_attr: PoolIndex,
        name_and_type: PoolIndex,
    },
}

impl Constant {
    pub fn is_nothing(&self) -> bool {
        self == &Constant::Nothing
    }

    pub fn as_string_data(&self) -> Option<&str> {
        match self {
            Constant::StringData(data) => Some(&**data),
            _ => None,
        }
    }
}

pub fn parse_constant<'src>(input: &mut ByteParser<'src>) -> ClassResult<Constant> {
    Ok(match input.parse_u8()? {
        CONSTANT_UTF8 => {
            let len = input.parse_u16()? as usize;
            Constant::StringData(parse::parse_mutf8(input.take(len)?)?.into())
        }
        CONSTANT_INTEGER => input.parse_i32().map(Constant::Integer)?,
        CONSTANT_FLOAT => input.parse_f32().map(Constant::Float)?,
        CONSTANT_LONG => input.parse_i64().map(Constant::Long)?,
        CONSTANT_DOUBLE => input.parse_f64().map(Constant::Double)?,

        CONSTANT_CLASS => input.parse_u16().map(|x| Constant::Class(x as usize))?,
        CONSTANT_STRING => input.parse_u16().map(|x| Constant::String(x as usize))?,
        CONSTANT_METHOD_TYPE => input
            .parse_u16()
            .map(|x| Constant::MethodType(x as usize))?,

        CONSTANT_FIELD_REF => Constant::FieldRef {
            class: input.parse_u16()? as usize,
            name_and_type: input.parse_u16()? as usize,
        },

        CONSTANT_METHOD_REF => Constant::MethodRef {
            class: input.parse_u16()? as usize,
            name_and_type: input.parse_u16()? as usize,
        },

        CONSTANT_INTERFACE_METHOD_REF => Constant::InterfaceMethodRef {
            class: input.parse_u16()? as usize,
            name_and_type: input.parse_u16()? as usize,
        },

        CONSTANT_NAME_AND_TYPE => Constant::NameAndType


Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -Version

```yaml
Type: Version
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -WhatIf

Shows what would happen if the cmdlet runs.
The cmdlet is not run.

```yaml
Type: SwitchParameter
Parameter Sets: (All)
Aliases: wi

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
```

### CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](https://go.microsoft.com/fwlink/?LinkID=113216).

## INPUTS

## OUTPUTS

### Microsoft.HyperV.PowerShell.VirtualMachine

## NOTES

## RELATED LINKS
---
UID: NF:ndis.NdisInterlockedRemoveHeadList
title: NdisInterlockedRemoveHeadList macro (ndis.h)
description: The NdisInterlockedRemoveHeadList function removes an entry, usually a packet, from the head of a doubly linked list so that access to the list is synchronized in a multiprocessor-safe way.
old-location: netvista\ndisinterlockedremoveheadlist.htm
tech.root: netvista
ms.date: 05/02/2018
keywords: ["NdisInterlockedRemoveHeadList macro"]
ms.keywords: NdisInterlockedRemoveHeadList, NdisInterlockedRemoveHeadList macro [Network Drivers Starting with Windows Vista], ndis/NdisInterlockedRemoveHeadList, ndis_interlocked_ref_5aacd492-068c-4cfe-afa6-4e0e63cf66e9.xml, netvista.ndisinterlockedremoveheadlist
req.header: ndis.h
req.include-header: Ndis.h
req.target-type: Universal
req.target-min-winverclnt: Supported for NDIS 6.0 and NDIS 5.1 drivers (see       NdisInterlockedRemoveHeadList (NDIS 5.1)) in Windows Vista. Supported for NDIS 5.1 drivers (see       NdisInterlockedRemoveHeadList (NDIS 5.1)) in Windows XP.
req.target-min-winversvr:
req.kmdf-ver:
req.umdf-ver:
req.ddi-compliance:
req.unicode-ansi:
req.idl:
req.max-support:
req.namespace:
req.assembly:
req.type-library:
req.lib: Ndis.lib
req.dll:
req.irql: Any level
targetos: Windows
req.typenames:
returns-override: true
f1_keywords:
 - NdisInterlockedRemoveHeadList
 - ndis/NdisInterlockedRemoveHeadList
topic_type:
 - APIRef
 - kbSyntax
api_type:
 - LibDef
api_location:
 - ndis.lib
 - ndis.dll
api_name:
 - NdisInterlockedRemoveHeadList
---

# NdisInterlockedRemoveHeadList macro

## -description

The
  <b>NdisInterlockedRemoveHeadList</b> function removes an entry, usually a packet, from the head of a doubly
  linked list so that access to the list is synchronized in a multiprocessor-safe way.

## -syntax
```cpp
PLIST_ENTRY NdisInterlockedRemoveHeadList(
  [in]  _ListHead,
  [in]  _SpinLock
);
```

## -parameters

### -param _ListHead [in]

A pointer to the head of the doubly linked list from which an entry is to be removed.

### -param _SpinLock [in]

A pointer to a caller-supplied spin lock, used to synchronize access to the list.

#


check attachment to arcs
                foreach(BeatmapSliderEnd a in sliderEndsOnBeat)
                {
                    if(!a.HasAttachment && a.AttachToObject(b))
                    {
                        a.StartY = newBomb.StartY;
                        a.HasAttachment = true;
                    }
                }

                if(ReplayManager.IsReplayMode)
                {
                    const int bombColor = 3;
                    const int altBombColor = 0;

                    //Ignore the 1s place since direction doesn't matter
                    int noteID = ((int)ScoringType.NoScore * 10000) + (b.x * 1000) + (b.y * 100) + (bombColor * 10);
                    ScoringEvent matchingEvent = scoringEventsOnBeat.Find(x => x.ID - (x.ID % 10) == noteID);

                    if(matchingEvent == null)
                    {
                        const int altDifference = bombColor - altBombColor;
                        noteID -= altDifference * 10;

                        matchingEvent = scoringEventsOnBeat.Find(x => x.ID - (x.ID % 10) == noteID);
                    }

                    if(matchingEvent != null && matchingEvent.noteEventType == NoteEventType.bomb)
                    {
                        newBomb.WasHit = true;
                        newBomb.WasBadCut = true;
                        newBomb.HitOffset = matchingEvent.ObjectTime - matchingEvent.Time;

                        Vector2 worldPosition = Instance.ObjectSpaceToWorldSpace(newBomb.Position);
                        matchingEvent.SetEventValues(ScoringType.NoScore, worldPosition);
                    }
                    scoringEventsOnBeat.Remove(matchingEvent);
                }

                bombs.Add(newBomb);
            }

            //Check arc attachment to chain tails
            for(int bi = 0; bi < burstSlidersOnBeat.Count; bi++)
            {
                BeatmapBurstSlider b = burstSlidersOnBeat[bi];
                Chain chain = newChains[bi];

                foreach(BeatmapSliderEnd a in sliderEndsOnBeat)
                {
                    if(!a.HasAttachment && a.AttachToObject(b))
                    {
                        a.StartY = chain.StartY;
                        a.HasAttachment = true;
                    }
                }
            }
            chains.AddRange(newChains);

            foreach(BeatmapObstacle o in obstaclesOnBeat)
            {
                Wall newWall = new Wall(o);
                walls.Add(newWall);
            }
        }

        // pair slider heads/tails back up and make final arcs
        for(int i = 0; i < beatmapSliderHeads.Count; i++)
        {
            const float halfNoteOffset = 0.225f;

            BeatmapSliderEnd head = beatmapSliderHeads[i];
            BeatmapSliderEnd tail = beatmapSliderTails[i];

            Arc newArc = new Arc(beatmapSliders[i]);

            if(head.HasAttachment)
            {
                Vector2 offset = newArc.HeadOffsetDirection * halfNoteOffset;
                newArc.Position += offset;
                newArc.HeadControlPoint += offset;
                newArc.HeadStartY = head.StartY + offset.y;
                newArc.HasHeadAttachment = true;
            }
            if(tail.HasAttachment)
            {
                Vector2 offset = newArc.TailOffsetDirection * halfNoteOffset;
                newArc.T


HTML
            + "\n"
            + "";

        loadPageVerifyTitle2(html);
    }
}
/*
 * Copyright (c) 2002-2025 Gargoyle Software Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * https://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.htmlunit.javascript.host.event;

import org.htmlunit.WebDriverTestCase;
import org.htmlunit.junit.annotation.Alerts;
import org.junit.jupiter.api.Test;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.interactions.Actions;

/**
 * Unit tests for {@link UIEvent}.
 *
 * @author Daniel Gredler
 * @author Frank Danek
 * @author Ronald Brill
 */
public class UIEventTest extends WebDriverTestCase {

    private static final String DUMP_EVENT_FUNCTION = "  function dump(event) {\n"
            + "    log(event);\n"
            + "    log(event.type);\n"
            + "    log(event.bubbles);\n"
            + "    log(event.cancelable);\n"
            + "    log(event.composed);\n"

            + "    log(event.view == window);\n"
            + "  }\n";

    /**
     * @throws Exception if the test fails
     */
    @Test
    @Alerts({"[object UIEvent]", "event", "false", "false", "false", "false"})
    public void create_ctor() throws Exception {
        final String html = DOCTYPE_HTML
            + "\n"
            + "";

        loadPageVerifyTitle2(html);
    }

    /**
     * @throws Exception if the test fails
     */
    @Test
    @Alerts({"[object UIEvent]", "event", "true", "false", "false", "true"})
    public void create_ctorWithDetails() throws Exception {
        final String html = DOCTYPE_HTML
            + "


  3C 60 80 4B */	lis r3, "__vt__7Parm<f>"@ha
/* 80131CFC 0012EC3C  3C A0 66 30 */	lis r5, 0x66303038@ha
/* 80131D00 0012EC40  38 03 AC BC */	addi r0, r3, "__vt__7Parm<f>"@l
/* 80131D04 0012EC44  C0 02 9E 54 */	lfs f0, lbl_805181B4@sda21(r2)
/* 80131D08 0012EC48  90 1E 01 4C */	stw r0, 0x14c(r30)
/* 80131D0C 0012EC4C  7F C4 F3 78 */	mr r4, r30
/* 80131D10 0012EC50  C0 22 9E 08 */	lfs f1, lbl_80518168@sda21(r2)
/* 80131D14 0012EC54  38 7E 01 74 */	addi r3, r30, 0x174
/* 80131D18 0012EC58  D0 1E 01 64 */	stfs f0, 0x164(r30)
/* 80131D1C 0012EC5C  38 A5 30 38 */	addi r5, r5, 0x66303038@l
/* 80131D20 0012EC60  C0 02 9E 50 */	lfs f0, lbl_805181B0@sda21(r2)
/* 80131D24 0012EC64  38 DF 01 34 */	addi r6, r31, 0x134
/* 80131D28 0012EC68  D0 3E 01 6C */	stfs f1, 0x16c(r30)
/* 80131D2C 0012EC6C  D0 1E 01 70 */	stfs f0, 0x170(r30)
/* 80131D30 0012EC70  48 2E 19 29 */	bl __ct__8BaseParmFP10ParametersUlPc
/* 80131D34 0012EC74  3C 60 80 4B */	lis r3, "__vt__7Parm<f>"@ha
/* 80131D38 0012EC78  3C A0 66 30 */	lis r5, 0x66303130@ha
/* 80131D3C 0012EC7C  38 03 AC BC */	addi r0, r3, "__vt__7Parm<f>"@l
/* 80131D40 0012EC80  C0 22 9E 50 */	lfs f1, lbl_805181B0@sda21(r2)
/* 80131D44 0012EC84  90 1E 01 74 */	stw r0, 0x174(r30)
/* 80131D48 0012EC88  7F C4 F3 78 */	mr r4, r30
/* 80131D4C 0012EC8C  C0 02 9E 08 */	lfs f0, lbl_80518168@sda21(r2)
/* 80131D50 0012EC90  38 7E 01 9C */	addi r3, r30, 0x19c
/* 80131D54 0012EC94  D0 3E 01 8C */	stfs f1, 0x18c(r30)
/* 80131D58 0012EC98  38 A5 31 30 */	addi r5, r5, 0x66303130@l
/* 80131D5C 0012EC9C  38 DF 01 44 */	addi r6, r31, 0x144
/* 80131D60 0012ECA0  D0 1E 01 94 */	stfs f0, 0x194(r30)
/* 80131D64 0012ECA4  D0 3E 01 98 */	stfs f1, 0x198(r30)
/* 80131D68 0012ECA8  48 2E 18 F1 */	bl __ct__8BaseParmFP10ParametersUlPc
/* 80131D6C 0012ECAC  3C 60 80 4B */	lis r3, "__vt__7Parm<f>"@ha
/* 80131D70 0012EC


oke_width=stroke_width,
                stroke_fill="black",
            )
            y += line_height

    if bottom_lines:
        y = image_height - char_height * len(bottom_lines) - 15
        for line in bottom_lines:
            line_width, line_height = font.getsize(line)
            x = (image_width - line_width) / 2
            draw.text(
                (x, y),
                line,
                fill="white",
                font=font,
                stroke_width=stroke_width,
                stroke_fill="black",
            )
            y += line_height

    final_image = os.path.join("memify.webp")
    img.save(final_image, **img_info)
    return final_image

async def aexec(code, client, message):
    exec(
        "async def __aexec(client, message): "
        + "".join(f"\n {l_}" for l_ in code.split("\n"))
    )
    return await locals()["__aexec"](client, message)

async def bash(cmd):
    process = await asyncio.create_subprocess_shell(
        cmd,
        stdout=asyncio.subprocess.PIPE,
        stderr=asyncio.subprocess.PIPE,
    )
    stdout, stderr = await process.communicate()
    err = stderr.decode().strip()
    out = stdout.decode().strip()
    return out, err

async def run_cmd(cmd):
    args = shlex.split(cmd)
    process = await asyncio.create_subprocess_exec(
        *args, stdout=asyncio.subprocess.PIPE, stderr=asyncio.subprocess.PIPE
    )
    stdout, stderr = await process.communicate()
    return (
        stdout.decode("utf-8", "replace").strip(),
        stderr.decode("utf-8", "replace").strip(),
        process.returncode,
        process.pid,
    )

def get_size(bytes, suffix="B"):
    factor = 1024
    for unit in ["", "K", "M", "G", "T", "P"]:
        if bytes < factor:
            return f"{bytes:.2f}{unit}{suffix}"
        bytes /= factor

async def dl_pic(client, download):
    path = await client.download_media(download)
    with open(path, "rb") as f:
        content = f.read()
    os.remove(path)
    get_photo = BytesIO(content)
    return get_photo

async def get_data_id(client, query):
    chat_types = {
        "global": [ChatType.CHANNEL, ChatType.GROUP, ChatType.SUPERGROUP],
        "all": [ChatType.GROUP, ChatType.SUPERGROUP, ChatType.PRIVATE],
        "gc": [ChatType.GROUP, ChatType.SUPERGROUP],
        "pv": [ChatType.PRIVATE],
    }
    return [dialog.chat.id async for dialog in client.get_dialogs() if dialog.chat.type in chat_types.get(query, [])]


import sys
import torch
from transformers import AutoModelForCausalLM
import warnings
from .base import BaseModel
from ..smp import *

class DeepSeekVL(BaseModel):

    INSTALL_REQ = True
    INTERLEAVE = True

    def check_install(self):
        try:
            import deepseek_vl
        except Exception as e:
            logging.critical(
                'Please first install deepseek_vl from source codes in: https://github.com/deepseek-ai/DeepSeek-VL')
            raise e

    def __init__(self, model_path='deepseek-ai/deepseek-vl-1.3b-chat', **kwargs):
        self.check_install()
        assert model_path is not None
        self.model_path = model_path
        from deepseek_vl.models import VLChatProcessor

        self.vl_chat_processor = VLChatProcessor.from_pretrained(model_path)
        self.tokenizer = self.vl_chat_processor.tokenizer

        model = AutoModelForCausalLM.from_pretrained(model_path, trust_remote_code=True)
        self.model = model.to(torch.bfloat16).cuda().eval()

        torch.cuda.empty_cache()
        default_kwargs = dict(max_new_tokens=512, do_sample=False, use_cache=True)
        default_kwargs.update(kwargs)
        self.kwargs = default_kwargs
        warnings.warn(f'Following kwargs received: {self.kwargs}, will use as generation config. ')

    def prepare_inputs(self, message):
        def prepare_itlist(msgs):
            content, images = '', []
            for s in msgs:
                if s['type'] == 'image':
                    images.append(s['value'])
                    content += '<image_placeholder>'
                elif s['type'] == 'text':
                    content += s['value']
            return content, images
        conversation = []
        if 'role' not in message[0]:
            content, images = prepare_itlist(message)
            conversation.append(dict(role='User', content=content, images=images))
        else:
            role_map = {'user': 'User', 'assistant': 'Assistant'}
            for msgs in message:
                role = role_map[msgs['role']]
                content, images = prepare_itlist(msgs['content'])
                conversation.append(dict(role=role, content=content, images=images))
        conversation.append(dict(role='Assistant', content=''))
        return conversation

    def generate_inner(self, message, dataset=None):
        conversation = self.prepare_inputs(message)
        from deepseek_vl.utils.io import load_pil_images
        pil_images = load_pil_images(conversation)
        prepare_inputs = self.vl_chat_processor(conversations=conversation, images=pil_images, force_batchify=True)
        prepare_inputs = prepare_inputs.to(self.model.device)
        inputs_embeds = self.model.prepare_inputs_embeds(**prepare_inputs)

        outputs = self.model.language_model.generate(
            inputs_embeds=inputs_embeds,
            attention_mask=prepare_inputs.attention_mask,
            pad_token_id=self.tokenizer.eos_token_id,
            bos_token_id=self.tokenizer.bos_token_id,
            eos_token_id=self.tokenizer.eos_token_id,
            **self.kwargs)
        answer = self.tokenizer.decode(outputs[0].cpu().tolist(), skip_special_tokens=True)
        return answer

    def chat_inner(self, message, dataset=None):
        return self.generate_inner(message, dataset=dataset)


dfb4774a64bf3decdcbab42a4111
---

{{ PreviousNext("Web/SVG/Tutorials/SVG_from_scratch/Patterns", "Web/SVG/Tutorials/SVG_from_scratch/Basic_transformations") }}

Beim Sprechen über Text in SVG müssen wir zwischen zwei fast völlig getrennten Themen unterscheiden. Das eine ist die Einbeziehung und Anzeige von Text in einem Bild, und das andere sind SVG-Schriftarten. Letzteres wird in einem späteren Abschnitt des Tutorials beschrieben, während sich diese Seite auf den ersten Teil konzentriert: das Einfügen von Text in ein SVG-Bild.

## Grundlagen

Wir haben im [Einführungsbeispiel](/de/docs/Web/SVG/Tutorials/SVG_from_scratch/Getting_started) gesehen, dass das `text`-Element verwendet werden kann, um beliebigen Text in SVG-Dokumente einzufügen:

```xml
<text x="10" y="10">Hello World!</text>
```

Die Attribute `x` und `y` bestimmen, wo im Viewport der Text erscheint. Das Attribut {{SVGAttr("text-anchor")}}, das die Werte `"start"`, `"middle"`, `"end"` oder `"inherit"` haben kann, entscheidet, in welche Richtung der Text von diesem Punkt an fließt. Das Attribut {{SVGAttr("dominant-baseline")}} entscheidet die vertikale Ausrichtung.

Wie bei den Formelementen kann Text mit dem `fill`-Attribut koloriert und mit dem `stroke`-Attribut gestrichen werden. Beide können auch auf Verläufe oder Muster verweisen, was das Kolorieren von Text in SVG sehr mächtig macht.

## Festlegen von Schriftarteigenschaften

Ein wesentlicher Teil von Text ist die Schriftart, in der er angezeigt wird. SVG bietet eine Reihe von Attributen, die vielen ihrer CSS-Gegenstücke ähneln, um die Schriftauswahl zu ermöglichen. Jedes der folgenden Eigenschaften kann als Attribut oder über eine CSS-Deklaration gesetzt werden: {{SVGAttr("font-family")}}, {{SVGAttr("font-style")}}, {{SVGAttr("font-weight")}}, {{SVGAttr("font-variant")}}, {{SVGAttr("font-stretch")}}, {{SVGAttr("font-size")}}, {{SVGAttr("font-size-adjust")}}, {{SVGAttr("letter-spacing")}}, {{SVGAttr("word-spacing")}} und {{SVGAttr("text-decoration")}}.

## Andere textbezogene Elemente

### tspan

Dieses Element wird verwendet, um Teilbereiche eines größeren Textes zu markieren. Es muss ein Kind eines `text`-Elements oder eines anderen `tspan`-Elements sein. Ein typischer Anwendungsfall ist es, ein Wort eines Satzes fett und rot zu färben.

```html
<svg width="350" height="60" xmlns="http://www.w3.org/2000/svg">
  <text>
    This is
    <tspan font-weight="bold" fill="red">bold and red</tspan>
  </text>

  <style>
    <![CDATA[
      text {
        dominant-baseline: hanging;
        font: 28px Verdana, Helvetica, Arial, sans-serif;
      }
    ]]>
  </style>
</svg>
```

{{ EmbedLiveSample('tspan', '100%', 100) }}

Das `tspan`-Element hat die folgenden benutzerdefinierten Attribute:

- `x`
  - : Setzt eine neue absolute `x`-Koordinate für den enthaltenen Text. Dies


-- [3]
											"NE_Glaive04.M2", -- [4]
										},
										["N"] = "Nightelfweapons",
									}, -- [5]
									{
										["T"] = {
											"NovaGrave1.m2", -- [1]
										},
										["N"] = "Novagrave",
									}, -- [6]
									{
										["T"] = {
											"Horde_package01.M2", -- [1]
										},
										["N"] = "Package",
									}, -- [7]
									{
										["T"] = {
											"PaladinShrine.m2", -- [1]
										},
										["N"] = "Paladinshrine",
									}, -- [8]
									{
										["T"] = {
											"Generic_Steam_Cloud_Deepholm.M2", -- [1]
											"Generic_Steam_Cloud_Purple.M2", -- [2]
											"Generic_Steam_Cloud_Small.M2", -- [3]
											"Generic_Steam_Cloud_Teal.M2", -- [4]
											"Generic_Steam_Cloud_Thin.M2", -- [5]
											"Generic_Steam_Cloud_Thinner.M2", -- [6]
											"Generic_Steam_Cloud_Thinnest.M2", -- [7]
										},
										["N"] = "Steamclouds",
									}, -- [9]
								},
								["N"] = "Generaldoodads",
							}, -- [3]
							{
								["T"] = {
									"IcyRune01.m2", -- [1]
								},
								["N"] = "Naxxramas",
							}, -- [4]
							{
								["T"] = {
									{
										["T"] = {
											"PlagueCauldronActive.m2", -- [1]
											"PlagueCauldronActiveBase.m2", -- [2]
										},
										["N"] = "Activedoodads",
									}, -- [1]
								},
								["N"] = "Plaguelands",
							}, -- [5]
							{
								["T"] = {
									{
										["T"] = {
											"cracked_ice01.m2", -- [1]
										},
										["N"] = "Crackedice",
									}, -- [1]
								},
								["N"] = "Winterspringgrove",
							}, -- [6]
						},
						["N"] = "Doodad",
					}, -- [1]
				},
				["N"] = "Environment",
			}, -- [9]
			{
				["T"] = {
					{
						["T"] = {
							{
								["T"] = {
									{
										["T"] = {
											{
												["T"] = {
													"Arakkoahouse_InteriorGlow.m2", -- [1]
													"Arakkoahut_InteriorGlow.M2", -- [2]
													"Arakkoashack_InsideGlow.m2", -- [3]
												},
												["N"] = "Arakkoa_hut_glow",
											}, -- [1]
										},
										["N"] = "Passivedoodads",
									}, -- [1]
								},
								["N"] = "Arakkoa",
							}, -- [1]
							{
								["T"] = {
									{
										["T"] = {
											{
												["T"] = {
													"Auchindoun_Bridge_FX.M2", -- [1]
													"Auchindoun_Bridge_Spirits_Floating.m2", -- [2]
													"Auchindoun_Bridge_Spirits_Flying.M2", -


hitSide=!0;break}g+=5*c}return b}function x(a,b,c,d){q.defaults[a]=b;c&&(Ka[a]=d?function(a,b,d){d!=Fd&&c(a,b,d)}:c)}function Wf(a){var b=a.split(/-(?!$)/);a=b[b.length-1];for(var c,d,e,f,g=0;g<b.length-1;g++){var h=b[g];if(/^(cmd|meta|m)$/i.test(h))f=!0;else if(/^a(lt)?$/i.test(h))c=!0;else if(/^(c|ctrl|control)$/i.test(h))d=!0;else if(/^s(hift)$/i.test(h))e=!0;else throw Error("Unrecognized modifier name: "+h);}c&&(a="Alt-"+a);d&&(a="Ctrl-"+a);f&&(a="Cmd-"+a);e&&(a="Shift-"+
a);return a}function pc(a){return"string"==typeof a?ua[a]:a}function Wa(a,b,c,d,e){if(d&&d.shared)return Xf(a,b,c,d,e);if(a.cm&&!a.cm.curOp)return G(a.cm,Wa)(a,b,c,d,e);var f=new Ha(a,e);e=y(b,c);d&&V(d,f,!1);if(0<e||0==e&&!1!==f.clearWhenEmpty)return f;f.replacedWith&&(f.collapsed=!0,f.widgetNode=t("span",[f.replacedWith],"CodeMirror-widget"),d.handleMouseEvents||f.widgetNode.setAttribute("cm-ignore-events","true"),d.insertLeft&&(f.widgetNode.insertLeft=!0));if(f.collapsed){if(Qe(a,b.line,b,c,f)||
b.line!=c.line&&Qe(a,c.line,b,c,f))throw Error("Inserting collapsed marker partially overlapping an existing one");ra=!0}f.addToHistory&&Ie(a,{from:b,to:c,origin:"markText"},a.sel,NaN);var g=b.line,h=a.cm,k;a.iter(g,c.line+1,function(a){h&&f.collapsed&&!h.options.lineWrapping&&ia(a)==h.display.maxLine&&(k=!0);f.collapsed&&g!=b.line&&ca(a,0);var d=new qc(f,g==b.line?b.ch:null,g==c.line?c.ch:null);a.markedSpans=a.markedSpans?a.markedSpans.concat([d]):[d];d.marker.attachLine(a);++g});f.collapsed&&a.iter(b.line,
c.line+1,function(b){ya(a,b)&&ca(b,0)});f.clearOnEnter&&v(f,"beforeCursorEnter",function(){f.clear()});f.readOnly&&(Ge=!0,(a.history.done.length||a.history.undone.length)&&a.clearHistory());f.collapsed&&(f.id=++sd,f.atomic=!0);if(h){k&&(h.curOp.updateMaxLine=!0);if(f.collapsed)Q(h,b.line,c.line+1);else if(f.className||f.title||f.startStyle||f.endStyle||f.css)for(d=b.line;d<=c.line;d++)na(h,d,"text");f.atomic&&ge


>

Curve

随时间控制效果强度的曲线。换言之，此项将定义震动的模式。值大于0.0将产生震动，值小于0.0则不震动。

创建力反馈效果资源

使用 内容浏览器 创建力反馈效果资源：

在 内容浏览器中，点击 新增 并选择 杂项 > 力反馈效果，并打开刚创建的资源。

<picture>
		<source data-srcset="./../../../Images/InteractiveExperiences/ForceFeedback/CreateForceFeedbackEffect.jpg">

</picture>

资源默认包含一个通道，但可以进行添加。可为每个通道选择其将影响的4个输出组合。

<picture>
		<source data-srcset="./../../../Images/InteractiveExperiences/ForceFeedback/FFChannels.jpg">

</picture>

长按 Shift 并在曲线上点击 鼠标左键 添加一个或多个键。

直接输入键的值，或将键拖入曲线编辑器中进行操作。

如需调整键之间的曲线，在曲线片段上点击右键修改其曲线函数，然后以常规方法调整切线行。

播放力反馈

在编辑器中预览

将鼠标悬停在力反馈效果图标的中央时将出现"播放"按钮，点击即可在编辑器中预览力反馈效果。

<picture>
		<source data-srcset="./../../../Images/InteractiveExperiences/ForceFeedback/PreviewForceFeedbackEffect.jpg">

</picture>

直接向玩家播放

力反馈在。需要访问本地 Player Controller 类，以便在目标设备或控制器上播放力反馈。使用者需要访问到本地玩家控制器才能在目标设备或控制器上


AEoOfVJF7dOaRS5zwg1J4WD/ubW5WBOi0z1yUa850H7A1zoY9HUYHcrI84pJMaPRVMD4Q6p+JXp/DyEQXYDt6ySRL3dNT4j3rgoGY2P0GosUd4UFJXCFD6EfsfhmDLkweTFV/H+ASSIjs0qUGjRMQCTNvHOB1QoaqE7KvB6BjQFFcnfYj2chSAGbUVA=="
//   }
//   ]
//   }

// swagger:operation POST /ca-certificates CACertificates CreateCACertificate
// ---
// description: |
//   Imports an existing CA certificate into the Certificate store.
//   Returns - The imported CA Certificate from the store.
//
// consumes:
//   - application/json
// produces:
//   - application/json
// x-permissions: cacertificates:create
// security:
//   - bearerAuth: []
// parameters:
//   - name: CreateCACertificate
//     required: true
//     in: body
//     schema:
//       $ref: "#/definitions/CaCertificate"
//   - name: Content-Type
//     description: Content-Type header
//     in: header
//     type: string
//     required: true
//     enum:
//       - application/json
//   - name: Accept
//     description: Accept header
//     in: header
//     type: string
//     required: true
//     enum:
//       - application/json
// responses:
//   '200':
//     description: Successfully created the CA Certificate in CertStore.
//     content:
//       application/json
//     schema:
//       $ref: "#/definitions/CaCertificate"
//   '400':
//     description: Invalid CACertificate in request body/Invalid type, only root or endorsement ca certificate can be added
//   '415':
//     description: Invalid Accept/Content-Type Header in Request - should be application/json
//   '500':
//     description: Internal server error - Error persisting Certificate in CertStore
//
// x-sample-call-endpoint: https://hvs.com:8443/hvs/v2/ca-certificates
// x-sample-call-input: |
//   {
//   "name": "HVS Root Certificate - New",
//   "type": "root",
//   "certificate": "MIIEBjCCAm6gAwIBAgIQN0rzaln9PujeaZe6mfzrezANBgkqhkiG9w0BAQsFADAmMSQwIgYDVQQDExtI


, #16
	asr     r1, r1, #16
	add     pc, r1
@ 0x224473e

Jumppoints_224473e:
.hword branch_224476a - Jumppoints_224473e - 2
.hword branch_2244748 - Jumppoints_224473e - 2
.hword branch_2244748 - Jumppoints_224473e - 2
.hword branch_2244748 - Jumppoints_224473e - 2
.hword branch_224475e - Jumppoints_224473e - 2
.thumb
branch_2244748: @ 2244748 :thumb
	mov     r1, #0xc
	mov     r2, r4
	mul     r2, r1
	ldr     r1, [pc, #0x2c] @ 0x224477c, (=0x2249fe4)
	ldr     r1, [r1, r2]
	cmp     r0, r1
	bcc     branch_224475a
	mov     r1, #0x1
	b       branch_224476c
@ 0x224475a

.thumb
branch_224475a: @ 224475a :thumb
	mov     r1, #0x2
	b       branch_224476c
@ 0x224475e

.thumb
branch_224475e: @ 224475e :thumb
	cmp     r0, #0x3
	bne     branch_2244766
	mov     r1, #0x2
	b       branch_224476c
@ 0x2244766

.thumb
branch_2244766: @ 2244766 :thumb
	mov     r1, #0x1
	b       branch_224476c
@ 0x224476a

.thumb
branch_224476a: @ 224476a :thumb
	mov     r1, #0x1
.thumb
branch_224476c: @ 224476c :thumb
	mov     r0, r6
	mov     r2, #0xf
	mov     r3, #0x2
	bl      Function_20013d8
	add     sp, #0x4
	pop     {r3-r6,pc}
@ 0x224477a

.align 2

.word 0x2249fe4 @ 0x224477c
.thumb
Function_2244780: @ 2244780 :thumb
	push    {r3-r7,lr}
	mov     r5, r0
	mov     r0, #0x0
	mov     r1, r0
	bl      Function_2019120
	mov     r1, #0x1
	lsl     r1, r1, #8
	ldr     r0, [r5, #0x4c]
	add     r1, r5, r1
	bl      Function_2249d84
	mov     r0, #0x1
	lsl     r0, r0, #8
	add     r0, r5, r0
	mov     r1, #0xf
	bl      Function_201ada4_ClearTextBox
	mov     r0, #0x4
	mov     r1, #0x64
	bl      Function_2013a04
	mov     r1, #0x67
	lsl     r1, r1, #2
	ldr     r4, [pc, #0xa8] @ 0x224485c, (=0x2249f54)
	str     r0, [r5, r1]
	mov     r6, #0x0
	mov     r7, r1
.thumb
branch_22447b8: @ 22447b8 :thumb
	ldr     r0, [r5, r7]
	ldr     r1, [r5, #


lValue = 0;
						for (Recipe tRecipe : tRecipes) if (tRecipe.mEnabled && tRecipe.mFluidInputs[0] != null) tFuelValue = Math.max(tFuelValue, (tRecipe.getAbsoluteTotalPower() * U) / tRecipe.mFluidInputs[0].amount);
						if (tFuelValue > 0) {
							if (tAmount > 1) {
								aList.add(LH.Chat.RED + LH.get(tMap.mNameInternal) + ": " + LH.Chat.WHITE + UT.Code.makeString(tFuelValue / U) + LH.Chat.YELLOW + " GU/L; " + LH.Chat.WHITE + UT.Code.makeString((tFuelValue * tAmount) / U) + LH.Chat.YELLOW + " GU total");
							} else {
								aList.add(LH.Chat.RED + LH.get(tMap.mNameInternal) + ": " + LH.Chat.WHITE + UT.Code.makeString(tFuelValue / U) + LH.Chat.YELLOW + " GU/L ");
							}
						}
					}
				}
			}

			if (aFluid instanceof FluidGT) {
				aList.add(LH.Chat.DGRAY + "Fluid owned by GT6");
			} else {
				if (FL.Water.is(aFluid) || FL.Lava.is(aFluid)) {
					aList.add(LH.Chat.DGRAY + "Fluid owned by vanilla Minecraft");
				} else {
					aList.add(LH.Chat.DGRAY + "Fluid NOT owned by GT6");
				}
			}
		}

		if (UT.Entities.hasInfiniteItems(aPlayer)) {
			aList.add(LH.Chat.RAINBOW_SLOW + "Rightclick Blocks to fill their Tanks with this Fluid!");
		}

		while (aList.remove(null));
	}

	@Override
	@SideOnly(Side.CLIENT)
	public void registerIcons(IIconRegister aIconRegister) {
		// Useful hack to register Block Icons. That is why the Fluid Display Item has to always exist.
		if (Abstract_Mod.sFinalized >= Abstract_Mod.sModCountUsingGTAPI) {
			// Setting up and loading Icon Register for Blocks
			GT_API.sBlockIcons = aIconRegister;
			for (Runnable tRunnable : GT_API.sBlockIconload) {
				try {
					tRunnable.run();
				} catch(Throwable e) {
					e.printStackTrace(ERR);
				}
			}
			if (MD.IC2.mLoaded) {
				try {
					for (gregapi.old.GT_BaseCrop tCrop : gregapi.old.GT_BaseCrop.sCropList) tCrop.registerSprites(aIconRegister);
				} catch(Throwable e) {
					e.printStackTrace(ERR);
				}
			}
		}
	}

	@Override
	@SideOnly(Side.CLIENT)
	public IIcon getIconFromDamage(int aMeta) {
		Fluid aFluid = FluidRegistry.getFluid(aMeta);
		if (aFluid == null) return FluidRegistry.WATER.getStillIcon();
		Block tBlock = aFluid.getBlock();
		return tBlock != null && tBlock != NB ? tBlock.getIcon(0, 0) : aFluid.getStillIcon();
	}

	@Override
	@SideOnly(Side.CLIENT)
	public int getColorFromItemStack(ItemStack aStack, int aRenderPass) {
		Fluid aFluid = FL.fluid(ST.meta_(aStack));
		if (aFluid == null) return 16777215;
		Block tBlock = aFluid.getBlock();
		return tBlock != null && tBlock != NB ? tBlock.getRenderColor(0) : aFluid.getColor();
	}


  newComponents:setYear(dateComponents:year())
  newComponents:setMonth(dateComponents:month())
  newComponents:setDay(dateComponents:day())
  newComponents:setHour(24)
  newComponents:setMinute(59)
  newComponents:setSecond(59)

  return calendar:dateFromComponents(newComponents)
end

function wax.time.timeAgoInWords(firstDate, secondDate)
  local difference = (secondDate or NSDate:date()):timeIntervalSince1970() - firstDate:timeIntervalSince1970()
  local seconds = math.abs(difference)
  local minutes = math.floor(seconds / 60)
  local hours = math.floor(minutes / 60)
  local days = math.floor(hours / 24)
  local months = math.floor(days / 30)

  if minutes <= 1 then return "less than a minute"
  elseif minutes <= 44 then return ("%d minutes"):format(minutes)
  elseif minutes <= 89 then return "about 1 hour"
  elseif hours <= 24 then return ("about %d hours"):format(hours)
  elseif hours <= 47 then return "1 day"
  elseif days <= 29 then return ("%d days"):format(days)
  elseif days <= 59 then return "about 1 month"
  elseif months <= 15 then return "about 1 year"
  elseif months <= 22 then return "over 1 year"
  elseif years < 2 then return "almost 2 years"
  elseif minutes <= 1051199 then return "about 1 year"
  else return ("over %d years"):format(years)
  end
end

function wax.time.since(date, referenceDate)
  referenceDate = referenceDate or NSDate:date()
  local difference = referenceDate:timeIntervalSince1970() - date:timeIntervalSince1970()
  local timeSinceMidnight = date:timeIntervalSince1970() - wax.time.beginingOfDay():timeIntervalSince1970()

  -- Also returns the preposition as second arg
  if difference < wax.time.days(1) and timeSinceMidnight > 0 then return wax.time.formatDate(date, "h:mm a"), "at"
  elseif difference < wax.time.days(2) then return "Yesterday", ""
  elseif difference < wax.time.days(7) then return wax.time.formatDate(date, "EEEE"), "on"
  else return wax.time.formatDate(date, "MM/dd/yy"), "on"
  end
end


on is met before continuing. Should be used to indicate
 * fatal errors.
 * @param  assertion
 *         An assertion that must be met
 * @param  message
 *         A message to display if the assertion is not met
 * @param  resultCode
 *         The NS_ERROR_* value to throw if the assertion is not met
 * @throws resultCode
 */
function ENSURE_WARN(assertion, message, resultCode) {
  NS_ASSERT(assertion, SEARCH_LOG_PREFIX + message);
  if (!assertion)
    throw Components.Exception(message, resultCode);
}

function loadListener(aChannel, aEngine, aCallback) {
  this._channel = aChannel;
  this._bytes = [];
  this._engine = aEngine;
  this._callback = aCallback;
}
loadListener.prototype = {
  _callback: null,
  _channel: null,
  _countRead: 0,
  _engine: null,
  _stream: null,

  QueryInterface: function SRCH_loadQI(aIID) {
    if (aIID.equals(Ci.nsISupports)           ||
        aIID.equals(Ci.nsIRequestObserver)    ||
        aIID.equals(Ci.nsIStreamListener)     ||
        aIID.equals(Ci.nsIChannelEventSink)   ||
        aIID.equals(Ci.nsIInterfaceRequestor) ||
        aIID.equals(Ci.nsIBadCertListener2)   ||
        aIID.equals(Ci.nsISSLErrorListener)   ||
        // See FIXME comment below
        aIID.equals(Ci.nsIHttpEventSink)      ||
        aIID.equals(Ci.nsIProgressEventSink)  ||
        false)
      return this;

    throw Cr.NS_ERROR_NO_INTERFACE;
  },

  // nsIRequestObserver
  onStartRequest: function SRCH_loadStartR(aRequest, aContext) {
    LOG("loadListener: Starting request: " + aRequest.name);
    this._stream = Cc["@mozilla.org/binaryinputstream;1"].
                   createInstance(Ci.nsIBinaryInputStream);
  },

  onStopRequest: function SRCH_loadStopR(aRequest, aContext, aStatusCode) {
    LOG("loadListener: Stopping request: " + aRequest.name);

    var requestFailed = !Components.isSuccessCode(aStatusCode);
    if (!requestFailed && (aRequest instanceof Ci.nsIHttpChannel))
      requestFailed = !aRequest.requestSucceeded;

    if (requestFailed || this._countRead == 0) {
      LOG("loadListener: request failed!");
      // send null so the callback can deal with the failure
      this._callback(null, this._engine);
    } else
      this._callback(this._bytes, this._engine);
    this._channel = null;
    this._engine  = null;
  },

  // nsIStreamListener
  onDataAvailable: function SRCH_loadDAvailable(aRequest, aContext,
                                                aInputStream, aOffset,
                                                aCount) {
    this._stream.setInputStream(aInputStream);

    // Get a byte array of the data
    this._bytes = this._bytes.concat(this._stream.readByteArray(aCount));
    this._countRead += aCount;
  },

  // nsIChannelEventSink
  asyncOnChannelRedirect: function SRCH_loadCRedirect(aOldChannel, aNewChannel,
                                                      aFlags, callback) {
    this._channel = aNewChannel;
    callback.onRedirectVerifyCallback(Components.results.NS_OK);
  },

  // nsIInterfaceRequestor
  getInterface: function SRCH_load_GI(aIID) {
    return this.QueryInterface(aIID);
  },

  // nsIBadCertListener2
  notifyCertProblem: function SRCH_certProblem(socketInfo, status, targetSite) {
    return true;
  },

  // nsISSLErrorListener


      "Maximum Bayer pattern size exceeded."};
  }

  m_components.resize(size_t{m_pattern_width} * m_pattern_height);

  for (uint16_t i = 0; i < m_pattern_height; i++) {
    for (uint16_t j = 0; j < m_pattern_width; j++) {
      PatternComponent component{};
      component.component_index = range.read32();
      component.component_gain = range.read_float32();
      m_components[i] = component;
    }
  }

  return range.get_error();
}

std::string Box_cpat::dump(Indent& indent) const
{
  std::ostringstream sstr;

  sstr << FullBox::dump(indent);
  sstr << indent << "pattern_width: " << get_pattern_width() << "\n";
  sstr << indent << "pattern_height: " << get_pattern_height() << "\n";

  for (const auto& component : m_components) {
    sstr << indent << "component index: " << component.component_index << ", gain: " << component.component_gain << "\n";
  }
  return sstr.str();
}

Error Box_cpat::write(StreamWriter& writer) const
{
  size_t box_start = reserve_box_header_space(writer);

  if (m_pattern_width * size_t{m_pattern_height} != m_components.size()) {
    // needs to be rectangular
    return {heif_error_Usage_error,
            heif_suberror_Invalid_parameter_value,
            "incorrect number of pattern components"};
  }

  writer.write16(m_pattern_width);
  writer.write16(m_pattern_height);

  for (const auto& component : m_components) {
    writer.write32(component.component_index);
    writer.write_float32(component.component_gain);
  }

  prepend_header(writer, box_start);

  return Error::Ok;
}
/*****************************************************************************
 * matroska_segment.cpp : matroska demuxer
 *****************************************************************************
 * Copyright (C) 2003-2010 VLC authors and VideoLAN
 * $Id: d9685e561e1cbd1f081918d7b9afc0c56d92dc79 $
 *
 * Authors: Laurent Aimar <fenrir@via.ecp.fr>
 *          Steve Lhomme <steve.lhomme@free.fr>
 *
 * This program is free software; you can redistribute it and/or modify it
 * under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation; either version 2.1 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this program; if not, write to the Free Software Foundation,
 * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
 *****************************************************************************/

#include "matroska_segment.hpp"
#include "chapters.hpp"
#include "demux.hpp"
#include "util.hpp"
#include "Ebml_parser.hpp"

matroska_segment_c::matroska_segment_c( demux_sys_t & demuxer, Ebml


ee_attr;

err_pd:
	ib_dealloc_pd(srp_dev->pd);

free_dev:
	kfree(srp_dev);

free_attr:
	kfree(dev_attr);
}

static void srp_remove_one(struct ib_device *device)
{
	struct srp_device *srp_dev;
	struct srp_host *host, *tmp_host;
	LIST_HEAD(target_list);
	struct srp_target_port *target, *tmp_target;

	srp_dev = ib_get_client_data(device, &srp_client);

	list_for_each_entry_safe(host, tmp_host, &srp_dev->dev_list, list) {
		device_unregister(&host->dev);
		/*
		 * Wait for the sysfs entry to go away, so that no new
		 * target ports can be created.
		 */
		wait_for_completion(&host->released);

		/*
		 * Mark all target ports as removed, so we stop queueing
		 * commands and don't try to reconnect.
		 */
		spin_lock(&host->target_lock);
		list_for_each_entry(target, &host->target_list, list) {
			spin_lock_irq(&target->lock);
			target->state = SRP_TARGET_REMOVED;
			spin_unlock_irq(&target->lock);
		}
		spin_unlock(&host->target_lock);

		/*
		 * Wait for any reconnection tasks that may have
		 * started before we marked our target ports as
		 * removed, and any target port removal tasks.
		 */
		flush_workqueue(ib_wq);

		list_for_each_entry_safe(target, tmp_target,
					 &host->target_list, list) {
			srp_del_scsi_host_attr(target->scsi_host);
			srp_remove_host(target->scsi_host);
			scsi_remove_host(target->scsi_host);
			srp_disconnect_target(target);
			ib_destroy_cm_id(target->cm_id);
			srp_free_target_ib(target);
			srp_free_req_data(target);
			scsi_host_put(target->scsi_host);
		}

		kfree(host);
	}

	if (srp_dev->fmr_pool)
		ib_destroy_fmr_pool(srp_dev->fmr_pool);
	ib_dereg_mr(srp_dev->mr);
	ib_dealloc_pd(srp_dev->pd);

	kfree(srp_dev);
}

static struct srp_function_template ib_srp_transport_functions = {
};

static int __init srp_init_module(void)
{
	int ret;

	BUILD_BUG_ON(FIELD_SIZEOF(struct ib_wc, wr_id) < sizeof(void *));

	if (srp_sg_tablesize) {
		pr_warn("srp_sg_tablesize is deprecated, please use cmd_sg_entries\n");
		if (!cmd_sg_entries)
			cmd_sg_entries = srp_sg_tablesize;
	}

	if (!cmd_sg_entries)
		cmd_sg_entries = SRP_DEF_SG_TABLESIZE;

	if (cmd_sg_entries > 255) {
		pr_warn("Clamping cmd_sg_entries to 255\n");
		cmd_sg_entries = 255;
	}

	if (!indirect_sg_entries)
		indirect_sg_entries = cmd_sg_entries;
	else if (indirect_sg_entries < cmd_sg_entries) {
		pr_warn("Bumping up indirect_sg_entries to match cmd_sg_entries (%u)\n",
			cmd_sg_entries);
		indirect_sg_entries = cmd_sg_entries;
	}

	ib_srp_transport_template =
		srp_attach_transport(&ib_srp_transport_functions);
	if (!ib_srp_transport_template)
		return -ENOMEM;

	ret = class_register(&srp_class);
	if (ret) {
		pr_err("couldn't register class infiniband_srp\n");
		srp_release_transport(ib_srp_transport_template);
		return ret;
	}

	ib_sa_register_client(&srp_sa_client);

	ret = ib_register_client(&srp_client);
	if (ret) {
		pr_err("couldn't register IB client\n");
		srp_release_transport(ib_srp_transport_template);
		ib_sa_unregister_client(&srp_sa_client);
		class_unregister(&srp_class);
		return ret;
	}

	return 0;
}

static void __exit srp_cleanup_module(void)
{
	ib_unregister_client(&srp_client);
	ib_sa_unregister_client(&srp_sa_client);
	class_unregister(&srp_class);
	srp_release_transport(ib_srp_transport_template);
}

module_init(srp_init_module);
module_exit(srp_cleanup_module);


Palette.fromHex('#aaa'), 1, 1)]);
    gameboardMock.isFree = () => false;
    block.init(gameboardMock);
    block.drop(gameboardMock);
    expect(gameboardMock.signalFreeze).toHaveBeenCalled();
  });

  it('hardDrop() should drop points until canDrop()', () => {
    const block = new TestBlock([new Point(Palette.fromHex('#aaa'), 1, 1)]);
    // Return canMove false after three calls
    let callCount = 0;
    gameboardMock.isFree = () => {
      callCount++;
      return callCount != 4;
    };
    block.init(gameboardMock);
    block.hardDrop(gameboardMock);
    expect(block.blocks[0]).toEqual(new Point(Palette.fromHex('#aaa'), 1, 1).down().down().down());
    // Hmmm...
    // expect(gameboardMock.signalFreeze).toHaveBeenCalled();
  });

  it('left() should move points left', () => {
    const block = new TestBlock([new Point(Palette.fromHex('#aaa'), 1, 1)]);
    block.init(gameboardMock);
    block.left(gameboardMock);
    expect(block.blocks[0]).toEqual(new Point(Palette.fromHex('#aaa'), 1, 1).left());
  });

  it('left() should not move if point is not free', () => {
    const block = new TestBlock([new Point(Palette.fromHex('#aaa'), 1, 1)]);
    gameboardMock.isFree = () => false;
    block.init(gameboardMock);
    block.left(gameboardMock);
    expect(block.blocks[0]).toEqual(new Point(Palette.fromHex('#aaa'), 1, 1));
  });

  it('right() should move points left', () => {
    const block = new TestBlock([new Point(Palette.fromHex('#aaa'), 1, 1)]);
    block.init(gameboardMock);
    block.right(gameboardMock);
    expect(block.blocks[0]).toEqual(new Point(Palette.fromHex('#aaa'), 1, 1).right());
  });

  it('right() should not move if point is not free', () => {
    const block = new TestBlock([new Point(Palette.fromHex('#aaa'), 1, 1)]);
    gameboardMock.isFree = () => false;
    block.init(gameboardMock);
    block.right(gameboardMock);
    expect(block.blocks[0]).toEqual(new Point(Palette.fromHex('#aaa'), 1, 1));
  });
});
export function isError<E extends Error, O>(
  value: Error,
  error: { new (...args: any[]): E },
  func: (e?: E) => O
): O {
  if (value instanceof error) {
    return func(value);
  }

  throw value;
}
function sqrarray(arr:number[]):number[]{
    var result:number[];
    return arr.map(ele=>ele*ele)

}

console.log(sqrarray([1,2,3,4,5]));export const isScrollableElement = (node : HTMLElement) : boolean => {
  const p = node.parentElement as HTMLElement;
  const style = window.getComputedStyle(p);
  return (
    (
      p.scrollHeight > p.clientHeight ||
      p.scrollWidth > p.clientWidth
    ) &&
    (
      style.overflow === 'auto' ||
      style.overflow === 'scroll' ||
      style.overflowX === 'auto' ||
      style.overflowY === 'auto' ||
      style.overflowX === 'scroll' ||
      style.overflowY === 'scroll'
    )
  );
}import { InputType, Field, ID } from '@nestjs/graphql';
import { IsNotEmpty, IsString, MaxLength, IsOptional, IsUUID } from 'class-validator';
@InputType()
export class UpdateSubjectInput {
  @IsUUID()
  @IsString()
  @IsNotEmpty()
  @Field(() => ID)
  id: string;

  @MaxLength(255)
  @IsString()
  @IsOptional()
  @Field({ nullable: true })
  enName?: string;

  @MaxLength(255)
  @IsString()
  @IsOptional()
  @Field({ nullable: true })
  arName?: string;

  @IsOptional()
  @Field({ nullable: true })
  arDescription?: string;

  @IsOptional()
  @Field({ nullable: true })
  enDescription?: string;
}
import { DailyForecast } from './daily-forecast';
import { IForecast } from './interfaces/forecast';

describe('DailyFor


_INFO_102 {
    DWORD   wki102_platform_id;
    LMSTR   wki102_computername;
    LMSTR   wki102_langroup;
    DWORD   wki102_ver_major;
    DWORD   wki102_ver_minor;
    LMSTR   wki102_lanroot;
    DWORD   wki102_logged_on_users;
}WKSTA_INFO_102, *PWKSTA_INFO_102, *LPWKSTA_INFO_102;

//
// Down-level NetWkstaGetInfo and NetWkstaSetInfo.
//
// DOS specific workstation information -
//    admin or domain operator access
//
typedef struct _WKSTA_INFO_302{
    DWORD   wki302_char_wait;
    DWORD   wki302_collection_time;
    DWORD   wki302_maximum_collection_count;
    DWORD   wki302_keep_conn;
    DWORD   wki302_keep_search;
    DWORD   wki302_max_cmds;
    DWORD   wki302_num_work_buf;
    DWORD   wki302_siz_work_buf;
    DWORD   wki302_max_wrk_cache;
    DWORD   wki302_sess_timeout;
    DWORD   wki302_siz_error;
    DWORD   wki302_num_alerts;
    DWORD   wki302_num_services;
    DWORD   wki302_errlog_sz;
    DWORD   wki302_print_buf_time;
    DWORD   wki302_num_char_buf;
    DWORD   wki302_siz_char_buf;
    LMSTR   wki302_wrk_heuristics;
    DWORD   wki302_mailslots;
    DWORD   wki302_num_dgram_buf;
}WKSTA_INFO_302, *PWKSTA_INFO_302, *LPWKSTA_INFO_302;

//
// Down-level NetWkstaGetInfo and NetWkstaSetInfo
//
// OS/2 specific workstation information -
//    admin or domain operator access
//
typedef struct _WKSTA_INFO_402{
    DWORD   wki402_char_wait;
    DWORD   wki402_collection_time;
    DWORD   wki402_maximum_collection_count;
    DWORD   wki402_keep_conn;
    DWORD   wki402_keep_search;
    DWORD   wki402_max_cmds;
    DWORD   wki402_num_work_buf;
    DWORD   wki402_siz_work_buf;
    DWORD   wki402_max_wrk_cache;
    DWORD   wki402_sess_timeout;
    DWORD   wki402_siz_error;
    DWORD   wki402_num_alerts;
    DWORD   wki402_num_services;
    DWORD   wki402_errlog_sz;
    DWORD   wki402_print_buf_time;
    DWORD   wki402_num_char_buf;
    DWORD   wki402_siz_char_buf;
    LMSTR   wki402_wrk_heuristics;
    DWORD   wki402_mailslots;
    DWORD   wki402_num_dgram_buf;
    DWORD   wki402_max_threads;
}WKSTA_INFO_402, *PWKSTA_INFO_402, *LPWKSTA_INFO_402;

//
// Same-level NetWkstaGetInfo and NetWkstaSetInfo.
//
// NT specific workstation information -
//    admin or domain operator access
//
typedef struct _WKSTA_INFO_502{
    DWORD   wki502_char_wait;
    DWORD   wki502_collection_time;
    DWORD   wki502_maximum_collection_count;
    DWORD   wki502_keep_conn;
    DWORD   wki502_max_cmds;
    DWORD   wki502_sess_timeout;


isEmpty
			    && adapter.getHasOmittedReplies(root.item.item)
					&& adapter.getIsPageStub(root.item.item)) {
				unloadedPages.add(root.item);
			}
			else {
				if (unloadedPages.isNotEmpty) {
					treeRoots.addAll(_groupUnloadedPages(unloadedPages).map((g) => _TreeNode(g, g.id, false)));
					unloadedPages.clear();
				}
				treeRoots.add(root);
			}
		}
		if (unloadedPages.isNotEmpty) {
			treeRoots.addAll(_groupUnloadedPages(unloadedPages).map((g) => _TreeNode(g, g.id, false)));
		}

		final stubRoots = <_TreeNode<RefreshableListItem<T>>>[];

		if (!adapter.isPaged) {
			final lastTreeOrder = _lastTreeOrder;
			if (lastTreeOrder != null) {
				const infiniteIndex = 1 << 50;
				mergeSort(treeRoots, compare: (a, b) {
					final idxA = lastTreeOrder.treeRootIndexLookup[a.id] ?? infiniteIndex;
					final idxB = lastTreeOrder.treeRootIndexLookup[b.id] ?? infiniteIndex;
					return idxA.compareTo(idxB);
				});
				for (final entry in treeMap.entries) {
					mergeSort(entry.value.children, compare: (a, b) {
						final idxA = lastTreeOrder.treeChildrenIndexLookup[entry.key]?[a.id] ?? infiniteIndex;
						final idxB = lastTreeOrder.treeChildrenIndexLookup[entry.key]?[b.id] ?? infiniteIndex;
						return idxA.compareTo(idxB);
					});
				}
			}

			final newOrder = _lastTreeOrder = (
				treeRootIndexLookup: {
					for (int i = 0; i < treeRoots.length; i++)
						treeRoots[i].id: i
				},
				treeChildrenIndexLookup: treeMap.map((k, v) => MapEntry(k, {
					for (int i = 0; i < v.children.length; i++)
						v.children[i].id: i
				}))
			);
			if (lastTreeOrder != null) {
				// The cause of treeOrder is to avoid position change on update due to
				// upvotes difference or something.
				// In case of add/remove, we want to preserve position to make
				// filtering/unfiltering look better, instead of always having the
				// unfiltered item go to the bottom.
				void mergeTreeOrders({required Map<int, int> current, required Map<int, int> old}) {
					if (old.isEmpty) {
						return;
					}
					final oldCurrentLength = current.length;
					current.addAll(old);
					final offset = current.length - oldCurrentLength;
					for (final key in current.keys) {
						if (!old.containsKey(key)) {
							// This is a new item, fix the index due to newly inserted items
							current[key] = current[key]! + offset;
						}
					}
				}
				mergeTreeOrders(current: newOrder.treeRootIndexLookup, old: lastTreeOrder.treeRootIndexLookup);
				for (final order in newOrder.treeChildrenIndexLookup.entries) {
					final old = lastTreeOrder.treeChildrenIndexLookup[order.key];
					if (old != null) {
						mergeTreeOrders(current: order.value, old: old);
					}
				}
			}
		}

		final out = <RefreshableListItem<T>>[];
		final Map<int, RefreshableListItem<T>> encountered = {};
		final precollapseCache = <T, bool>{};
		final automaticallyCollapsed = <List<int>>[];
		final Set<int> automaticallyTopLevelCollapsed = {};
		Set<int> dumpNode(_TreeNode<RefreshableListItem<T>> node, List<int> parentIds, {bool addOmittedChildNode = true}) {
			if (out.length