put): IterableIterator<Point> {
  const w = Math.max(...input.map(x => x.length));
  const h = input.length;
  for (let y = 0; y < h; y++) {
    for (let x = 0; x < w; x++) {
      if (input[y][x] !== "#") continue;
      const r = [x, y] as Point;
      yield r;
    }
  }
};

const gcd = (z: Point): number => {
  const [x, y] = z.map(Math.abs);
  return !y ? x : gcd([y, x % y]);
};

const gen_path = function*(
  spot0: Point,
  target: Point
): IterableIterator<Point> {
  if (eq_points(spot0, target)) return;
  const spot = [...spot0] as Point;
  let step = [target[0] - spot[0], target[1] - spot[1]] as Point;
  const k = gcd(step);
  step = step.map(z => Math.floor(z / k)) as Point;
  while (!eq_points(spot, target)) {
    spot[0] += step[0];
    spot[1] += step[1];
    yield [...spot] as Point;
  }
};

const eq_points = (a: Point, b: Point): boolean =>
  a[0] === b[0] && a[1] === b[1];

const visible = (input: Input, spot: Point): Array<Point> => {
  const ret = new Set<string>();
  for (const target of asteroids(input)) {
    if (eq_points(spot, target)) continue;
    for (const z of gen_path(spot, target)) {
      if (input[z[1]][z[0]] === "#") {
        ret.add(z.join("x"));
        break;
      }
    }
  }
  const r = [...ret].map(x => x.split("x").map(Number) as Point);
  return r;
};

const exec1 = (input: Input): any => {
  let best = [[0, 0], 0];
  for (const target of asteroids(input)) {
    const r = visible(input, target);
    if (r.length > best[1]) {
      best = [target, r.length];
    }
  }
  return best;
};

const part1 = (input0: Input): any => {
  const r = exec1([...input0]);
  return r[1];
};

const exec2 = (input0: Input, spot: Point, nth: number): Point => {
  const input = input0.map(x => [...x]);
  const angle = (x: Point): number => {
    const r1 = Math.atan2(x[1] - spot[1], x[0] - spot[0]);
    const r2 = r1 < 0 ? r1 + 2 * Math.PI : r1;
    const r3 = (r2 + Math.PI / 2) % (2 * Math.PI);
    return r3;
  };
  let last: Point;
  let count = 0;
  loop: while (true) {
    const vis = visible(input, spot);
    if (!vis.length) break;
    const angles = vis.map(x => [x, angle(x)] as [Point, number]);
    angles.sort((a, b) => a[1] - b[1]);
    for (const [t, _] of angles) {
      last = t;
      input[t[1]][t[0]] = ".";
      count += 1;
      if (count >= nth) {
        break loop;
      }
    }
  }
  return last;
};

const part2 = (input0: Input): any => {
  const [spot, _] = exec1(input0);
  const r = exec2(input0, spot, 200);
  return r[0] * 100 + r[1];
};

{
  const utf8_decoder = new TextDecoder();
  const input0 = utf8_decoder.decode(Deno.readFileSync("input/10.txt"));
  const input = parse_input(input0);
  // p("input", input);
  p(`Part1:`, part1(input));
  p(`Part2:`, part2(input));
}

{
  let input = null;

  input = `.#..#
.....
#####
....#
...##`;
  assertEquals(visible(parse_input(input), [3, 4]).length, 8);

  input = `......#.#.
#..#.#....
..#######.
.#.#.###..


 {
	alice := registerNewUser(t)
	// the account had 16 rooms, so do this now
	var roomIDs []string // most recent first
	for i := 0; i < 16; i++ {
		time.Sleep(time.Millisecond) // ensure creation timestamp changes
		roomIDs = append([]string{alice.MustCreateRoom(t, map[string]interface{}{
			"preset": "public_chat",
			"name":   fmt.Sprintf("Room %d", i),
		})}, roomIDs...)
	}
	firstList := sync3.RequestList{
		Sort:   []string{sync3.SortByRecency, sync3.SortByName},
		Ranges: sync3.SliceRanges{{0, 20}},
		RoomSubscription: sync3.RoomSubscription{
			RequiredState: [][2]string{{"m.room.avatar", ""}, {"m.room.encryption", ""}},
			TimelineLimit: 10,
		},
	}
	secondList := sync3.RequestList{
		Sort:   []string{sync3.SortByRecency, sync3.SortByName},
		Ranges: sync3.SliceRanges{{0, 16}},
		RoomSubscription: sync3.RoomSubscription{
			RequiredState: [][2]string{{"m.room.avatar", ""}, {"m.room.encryption", ""}},
		},
	}
	res := alice.SlidingSync(t, sync3.Request{
		Lists: map[string]sync3.RequestList{
			"1": firstList, "2": secondList,
		},
	})
	m.MatchResponse(t, res,
		m.MatchList("1", m.MatchV3Count(16), m.MatchV3Ops(
			m.MatchV3SyncOp(0, 15, roomIDs, false),
		)),
		m.MatchList("2", m.MatchV3Count(16), m.MatchV3Ops(
			m.MatchV3SyncOp(0, 15, roomIDs, false),
		)),
	)
	// now change both list ranges in a valid but strange way, and get back bad responses
	firstList.Ranges = sync3.SliceRanges{{2, 15}}  // from [0,20]
	secondList.Ranges = sync3.SliceRanges{{0, 20}} // from [0,16]
	res = alice.SlidingSync(t, sync3.Request{
		Lists: map[string]sync3.RequestList{
			"1": firstList, "2": secondList,
		},
	}, WithPos(res.Pos))
	m.MatchResponse(t, res,
		m.MatchList("1", m.MatchV3Count(16), m.MatchV3Ops(
			m.MatchV3InvalidateOp(0, 1),
		)),
		m.MatchList("2", m.MatchV3Count(16), m.MatchV3Ops()),
	)
}

// NB: assumes bump_event_types is sticky
func TestBumpEventTypesHandling(t *testing.T) {
	alice := registerNamedUser(t, "alice")
	bob := registerNamedUser(t, "bob")
	charlie := registerNamedUser(t, "charlie")

	t.Log("Alice creates two rooms")
	room1 := alice.MustCreateRoom(
		t,
		map[string]interface{}{
			"preset": "public_chat",
			"name":   "room1",
		},
	)
	room2 := alice.MustCreateRoom(
		t,
		map[string]interface{}{
			"preset": "public_chat",
			"name":   "room2",
		},
	)
	t.Logf("room1=%s room2=%s", room1, room2)
	t.Log("Bob joins both rooms.")
	bob.JoinRoom(t, room1, nil)
	bob.JoinRoom(t, room2, nil)

	t.Log("Bob sends a message in room 2 then room 1.")
	bob.SendEventSynced(t, room2, b.Event{
		Type: "m.room.message",
		Content: map[string]interface{}{
			"body":    "Hi room 2",


b66"), "clickup-api"),
    Pair(UUID.fromString("6babfc42-c734-4ef6-a817-6eca15f0f9b7"), "everhour"),
    Pair(UUID.fromString("8a5d48f6-03bb-4038-a942-a8d3f175cca3"), "freshcaller"),
    Pair(UUID.fromString("69d9eb65-8026-47dc-baf1-e4bf67901fd6"), "pexels-api"),
    Pair(UUID.fromString("492b56d1-937c-462e-8076-21ad2031e784"), "hellobaton"),
    Pair(UUID.fromString("9c74c2d7-531a-4ebf-b6d8-6181f805ecdc"), "younium"),
    Pair(UUID.fromString("ed9dfefa-1bbc-419d-8c5e-4d78f0ef6734"), "google-workspace-admin-reports"),
    Pair(UUID.fromString("e87ffa8e-a3b5-f69c-9076-6011339de1f6"), "redshift"),
    Pair(UUID.fromString("dd4632f4-15e0-4649-9b71-41719fb1fdee"), "surveycto"),
    Pair(UUID.fromString("db385323-9333-4fec-bec3-9e0ca9326c90"), "alpha-vantage"),
    Pair(UUID.fromString("45e0b135-615c-40ac-b38e-e65b0944197f"), "lokalise"),
    Pair(UUID.fromString("d8313939-3782-41b0-be29-b3ca20d8dd3a"), "intercom"),
    Pair(UUID.fromString("b2e713cd-cc36-4c0a-b5bd-b47cb8a0561e"), "mongodb-v2"),
    Pair(UUID.fromString("acb5f973-a565-441e-992f-4946f3e65662"), "firebase-realtime-database"),
    Pair(UUID.fromString("3b046ac7-d8d3-4eb3-b122-f96b2a16d8a8"), "recruitee"),
    Pair(UUID.fromString("7f0455fb-4518-4ec0-b7a3-d808bf8081cc"), "orb"),
    Pair(UUID.fromString("686473f1-76d9-4994-9cc7-9b13da46147c"), "chargebee"),
    Pair(UUID.fromString("fe2b4084-3386-4d3b-9ad6-308f61a6f1e6"), "harvest"),
    Pair(UUID.fromString("8097ceb9-383f-42f6-9f92-d3fd4bcc7689"), "hubplanner"),
    Pair(UUID.fromString("3c0c3cd1-b3e0-464a-9090-d3ceb5f92346"), "tyntec-sms"),
    Pair(UUID.fromString("263fd456-02d1-4a26-a35e-52ccaedad778"), "fullstory"),
    Pair(UUID.fromString("e1a3866b-d3b2-43b6-b6d7-8c1ee4d7f53f"), "getlago"),
    Pair(UUID.fromString("b08e4776-d1de-4e80-ab5c-1e51dad934a2"), "qualaroo"),
    Pair(UUID.fromString("6ec2acea-7fd1-4378-b403-41a666e0c028"), "mailjet-sms"),
    Pair(UUID.fromString("aa8ba6fd-4875-d94e-fc8d-4e1e09aa2503"), "teradata"),
    Pair(UUID


erride;
    QStringList mimeTypes() const override;
    Qt::DropActions supportedDragActions() const override;
    Qt::DropActions supportedDropActions() const override;

Q_SIGNALS:
    void sourceModelChanged(QPrivateSignal);

protected Q_SLOTS:
    void resetInternalData();

protected:
    QAbstractProxyModel(QAbstractProxyModelPrivate &, QObject *parent);

private:
    Q_DECLARE_PRIVATE(QAbstractProxyModel)
    Q_DISABLE_COPY(QAbstractProxyModel)
    Q_PRIVATE_SLOT(d_func(), void _q_sourceModelDestroyed())
};

QT_END_NAMESPACE

#endif // QABSTRACTPROXYMODEL_H


 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

package net.pterodactylus.sone.web.notification

import com.google.common.eventbus.*
import net.pterodactylus.sone.core.event.*
import net.pterodactylus.sone.data.*
import net.pterodactylus.sone.notify.*
import net.pterodactylus.util.notify.*
import javax.inject.*

/**
 * Handler for [SoneLockedOnStartup][net.pterodactylus.sone.core.event.SoneLockedOnStartup] events
 * that adds the appropriate notification to the [NotificationManager].
 */
class SoneLockedOnStartupHandler @Inject constructor(private val notificationManager: NotificationManager, @Named("soneLockedOnStartup") private val notification: ListNotification<Sone>) {

	@Subscribe
	@Suppress("UnstableApiUsage")
	fun soneLockedOnStartup(soneLockedOnStartup: SoneLockedOnStartup) {
		notification.add(soneLockedOnStartup.sone)
		notificationManager.addNotification(notification)
	}

}
package com.bonepeople.android.sdcardcleaner.data

import com.bonepeople.android.sdcardcleaner.global.utils.CommonUtil

/**
 * 文件信息
 */
data class FileTreeInfo(
    var name: String = "", //文件名
    var path: String = "", //文件路径
    var size: Long = 0L, //文件大小 //多线程操作时需要注意线程安全
    var fileCount: Int = 0, //文件夹内文件的总数量，包括子文件夹 //多线程操作时需要注意线程安全
    var type: Int = FileType.UNKNOWN, //文件类型
    val cleanState: CleanStateInfo = CleanStateInfo(), //该文件的自动清理信息
    var sorted: Int = SortType.NONE, //当前排序类型
    var parent: FileTreeInfo? = null, //父目录
    val children: ArrayList<FileTreeInfo> = ArrayList(), //子文件列表 //多线程操作时需要注意线程安全
    var largestFile: FileTreeInfo? = null //当前目录中最大的文件
) {
    fun updateLargestFile() {
        largestFile = null
        children.forEach { child ->
            if (largestFile == null) {
                largestFile = child
            } else {
                if (child.size > largestFile!!.size) {
                    largestFile = child
                }
            }
        }
    }

    //排序类型
    object SortType {
        const val NONE = 0//未排序
        const val NAME_ASC = 1//按文件名称升序排序
        const val SIZE_DESC = 2//按文件大小降序排序
    }

    //文件类型
    object FileType {
        const val UNKNOWN = 0//未知
        const val DIRECTORY = 1//文件夹
        const val IMAGE = 2//图片
        const val VIDEO = 3//视频
        const val ANDROID = 4//安卓apk安装包
    }

    /**
     * 文件名升序比较器
     */
    object NameAscComparator : Comparator<FileTreeInfo> {
        override fun compare(file1: FileTreeInfo, file2: FileTreeInfo): Int {
            return if (file1.type == FileType.DIRECTORY && file2.type == FileType.DIRECTORY) { //两个对比项都是文件夹，按照文件夹名称排序
                CommonUtil.comparePath(file1.name, file2.name)
            } else if (file1.type == FileType.DIRECTORY) { //file1是文件夹，file2是文件，file1排在前面
                -1
            } else if (file2.type == FileType.DIRECTORY) { //file2是文件夹，file1是文件，file2排在前面
                1
            } else { //两个对比项都是文件，按照文件名称排序
                CommonUtil.comparePath(file1.name, file2.name)
            }
        }
    }

    /**
     * 文件大小降序比较器
     */


#include <stdio.h>

typedef char pin_t;
#define IN const pin_t *
#define OUT pin_t *
#define PIN(X) pin_t _##X; pin_t *X = & _##X;
#define V(X) (*(X))

/* a NOT that does not soil the rest of the host of the single bit */
#define NOT(X) (~(X)&1)

/* a shortcut to "implement" a XOR using only NOT, AND and OR gates, as
   task requirements constrain */
#define XOR(X,Y) ((NOT(X)&(Y)) | ((X)&NOT(Y)))

void halfadder(IN a, IN b, OUT s, OUT c)
{
  V(s) = XOR(V(a), V(b));
  V(c) = V(a) & V(b);
}

void fulladder(IN a, IN b, IN ic, OUT s, OUT oc)
{
  PIN(ps); PIN(pc); PIN(tc);

  halfadder(/*INPUT*/a, b, /*OUTPUT*/ps, pc);
  halfadder(/*INPUT*/ps, ic, /*OUTPUT*/s, tc);
  V(oc) = V(tc) | V(pc);
}

void fourbitsadder(IN a0, IN a1, IN a2, IN a3,
		   IN b0, IN b1, IN b2, IN b3,
		   OUT o0, OUT o1, OUT o2, OUT o3,
		   OUT overflow)
{
  PIN(zero); V(zero) = 0;
  PIN(tc0); PIN(tc1); PIN(tc2);

  fulladder(/*INPUT*/a0, b0, zero, /*OUTPUT*/o0, tc0);
  fulladder(/*INPUT*/a1, b1, tc0,  /*OUTPUT*/o1, tc1);
  fulladder(/*INPUT*/a2, b2, tc1,  /*OUTPUT*/o2, tc2);
  fulladder(/*INPUT*/a3, b3, tc2,  /*OUTPUT*/o3, overflow);
}

int main()
{
  PIN(a0); PIN(a1); PIN(a2); PIN(a3);
  PIN(b0); PIN(b1); PIN(b2); PIN(b3);
  PIN(s0); PIN(s1); PIN(s2); PIN(s3);
  PIN(overflow);

  V(a3) = 0; V(b3) = 1;
  V(a2) = 0; V(b2) = 1;
  V(a1) = 1; V(b1) = 1;
  V(a0) = 0; V(b0) = 0;

  fourbitsadder(a0, a1, a2, a3, /* INPUT */
		b0, b1, b2, b3,
		s0, s1, s2, s3, /* OUTPUT */
		overflow);

  printf("%d%d%d%d + %d%d%d%d = %d%d%d%d, overflow = %d\n",
	 V(a3), V(a2), V(a1), V(a0),
	 V(b3), V(b2), V(b1), V(b0),
	 V(s3), V(s2), V(s1), V(s0),
	 V(overflow));

  return 0;
}


package pl.hypeapp.episodie.navigation

import android.annotation.TargetApi
import android.app.Activity
import android.content.Intent
import android.os.Build
import android.support.v4.app.ActivityOptionsCompat
import android.view.View
import pl.hypeapp.domain.model.tvshow.TvShowModel
import pl.hypeapp.episodie.R
import pl.hypeapp.episodie.ui.features.mainfeed.MainFeedActivity
import pl.hypeapp.episodie.ui.features.search.SearchActivity
import pl.hypeapp.episodie.ui.features.seasontracker.SeasonTrackerActivity
import pl.hypeapp.episodie.ui.features.timecalculator.TimeCalculatorActivity
import pl.hypeapp.episodie.ui.features.tvshowdetails.TvShowDetailsActivity
import pl.hypeapp.episodie.ui.features.yourlibrary.YourLibraryActivity
import pl.hypeapp.episodie.ui.viewmodel.TvShowModelParcelable

object Navigator {

    fun startTvShowDetails(activity: Activity, tvShowModel: TvShowModel) {
        val intent = Intent(activity, TvShowDetailsActivity::class.java)
        intent.putExtra(EXTRA_INTENT_TV_SHOW_MODEL, TvShowModelParcelable(tvShowModel))
        activity.startActivityForResult(intent, 1)
    }

    @TargetApi(Build.VERSION_CODES.LOLLIPOP)
    fun startTvShowDetailsWithSharedElements(activity: Activity, tvShowModel: TvShowModel, transitionViews: Array<out View>) {
        val intent = Intent(activity, TvShowDetailsActivity::class.java)
        intent.putExtra(EXTRA_INTENT_TV_SHOW_MODEL, TvShowModelParcelable(tvShowModel))
        val p1 = android.support.v4.util.Pair.create(transitionViews[0], activity.getString(R.string.cover_transition))
        val p2 = android.support.v4.util.Pair.create(transitionViews[1], activity.getString(R.string.title_transition))
        val p3 = android.support.v4.util.Pair.create(transitionViews[2], "no_transition")
        val activityOptions: ActivityOptionsCompat = ActivityOptionsCompat.makeSceneTransitionAnimation(activity, p1, p2, p3)
        activity.startActivity(intent, activityOptions.toBundle())
    }

    @TargetApi(Build.VERSION_CODES.LOLLIPOP)
    fun startTvShowDetailsWithSharedElement(activity: Activity, tvShowModel: TvShowModel, transitionView: View) {
        val intent = Intent(activity, TvShowDetailsActivity::class.java)
        intent.putExtra(EXTRA_INTENT_TV_SHOW_MODEL, TvShowModelParcelable(tvShowModel))
        val p1 = android.support.v4.util.Pair.create(transitionView, activity.getString(R.string.cover_transition))
        val activityOptions: ActivityOptionsCompat = ActivityOptionsCompat.makeSceneTransitionAnimation(activity, p1)
        activity.startActivity(intent, activityOptions.toBundle())
    }

    fun startFeedActivity(callingActivity: Activity) {
        val intent = Intent(callingActivity, MainFeedActivity::class.java)
        callingActivity.startActivity(intent)
        if (callingActivity !is MainFeedActivity) callingActivity.finish()
    }

    fun startSearchActivity(callingActivity: Activity) {
        val intent = Intent(callingActivity, SearchActivity::class.java)
        intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK and Intent.FLAG_ACTIVITY_NEW_TASK)
        callingActivity.startActivity(intent)
        if (callingActivity !is MainFeedActivity) callingActivity.finish()
    }

    fun startTimeCalculatorActivity(callingActivity: Activity) {
        val int


#txtId").val("");
		$("#txtMarca").val("");
    	$("#txtModelo").val("");
    	$("#txtPrecio").val("");
		$("#btnAgregar").show();
		$("#btnModificar").hide();

    	$("#header2").html("Alta Vehiculo");
	}

	function borrar(event:Event)
	{
		let elemento = event.target;
    	let nodo = $(elemento).parent();
		let tr = $(nodo).parent();
		let td =$(tr).children();
		let id:string =String ($(td[0]).text());
		let toParse=localStorage.getItem("lista");
		var carga = JSON.parse(toParse);
		localStorage.clear();
		lista=[];
		for(let i=0;i<carga.length; i++)
		{

			if(id!=carga[i].id)
		{
			LocalStorage(carga[i]);
		}
		}
		mostrarVehiculos();
	}

	function LocalStorage(vehiculo:Vehiculo)
	{
        if (localStorage.getItem("lista") === null)
        {
            lista.push(vehiculo);
            localStorage.setItem('lista', JSON.stringify(lista));
        }
        else
        {
            let toParse:any = localStorage.getItem('lista');
            lista = JSON.parse(toParse);
            lista.push(vehiculo);
            localStorage.setItem('lista', JSON.stringify(lista));
        }
    }
}class Die{

    private _faceUpValue:number;

    /**
     * Creates the die with a random number 1 - 6
     */
    constructor(){
        this.roll();
    }

    get faceUpValue(){
        return this._faceUpValue;
    }

    /**
     * Rolls a random number between 1 - 6
     * assigns it to the faceUpValue and returns the number
     */
    roll():number{
        this._faceUpValue = Math.floor((Math.random() * 6) + 1);
        return this._faceUpValue;
    }
}import day, { extractKeyValues, validatePassport } from ".";
import sampleinput from "./input/sample";
import sampleoutput from "./output/sample";

import exerciseinput from "./input/exercise";
import part1output from "./output/part1";
// import part2output from "./output/part2";

describe("solution", () => {
  it("extractKeyValues should convert a string to object", () => {
    const input = "ecl:gry pid:860033327 eyr:2020 hcl:#fffffd";
    const expected = {
      ecl: "gry",
      pid: "860033327",
      eyr: "2020",
      hcl: "#fffffd",
    };
    expect(extractKeyValues(input)).toEqual(expected);

    const input2 = "byr:1937 iyr:2017 cid:147 hgt:183cm";
    const expected2 = {
      byr: "1937",
      iyr: "2017",
      cid: "147",
      hgt: "183cm",
    };
    expect(extractKeyValues(input2)).toEqual(expected2);
  });

  it("validatePasport checks required fields (valid)", () => {
    const input = {
      ecl: "gry",
      pid: "860033327",
      eyr: "2020",
      hcl: "#fffffd",
      byr: "1937",
      iyr: "2017",
      cid: "147",
      hgt: "183cm",
    };
    expect(


0.3] <CHARACTER TABULATION> (BA) × [7.01] SPACE (SP) × [7.02] ZERO WIDTH SPACE (ZW) ÷ [0.3]
× 0009 × 0308 × 200B ÷	#  × [0.3] <CHARACTER TABULATION> (BA) × [9.0] COMBINING DIAERESIS (CM1_CM) × [7.02] ZERO WIDTH SPACE (ZW) ÷ [0.3]
× 0009 × 0308 × 0020 × 200B ÷	#  × [0.3] <CHARACTER TABULATION> (BA) × [9.0] COMBINING DIAERESIS (CM1_CM) × [7.01] SPACE (SP) × [7.02] ZERO WIDTH SPACE (ZW) ÷ [0.3]
× 0009 ÷ 1F1E6 ÷	#  × [0.3] <CHARACTER TABULATION> (BA) ÷ [999.0] REGIONAL INDICATOR SYMBOL LETTER A (RI) ÷ [0.3]
× 0009 × 0020 ÷ 1F1E6 ÷	#  × [0.3] <CHARACTER TABULATION> (BA) × [7.01] SPACE (SP) ÷ [18.0] REGIONAL INDICATOR SYMBOL LETTER A (RI) ÷ [0.3]
× 0009 × 0308 ÷ 1F1E6 ÷	#  × [0.3] <CHARACTER TABULATION> (BA) × [9.0] COMBINING DIAERESIS (CM1_CM) ÷ [999.0] REGIONAL INDICATOR SYMBOL LETTER A (RI) ÷ [0.3]
× 0009 × 0308 × 0020 ÷ 1F1E6 ÷	#  × [0.3] <CHARACTER TABULATION> (BA) × [9.0] COMBINING DIAERESIS (CM1_CM) × [7.01] SPACE (SP) ÷ [18.0] REGIONAL INDICATOR SYMBOL LETTER A (RI) ÷ [0.3]
× 0009 ÷ 261D ÷	#  × [0.3] <CHARACTER TABULATION> (BA) ÷ [999.0] WHITE UP POINTING INDEX (EB) ÷ [0.3]
× 0009 × 0020 ÷ 261D ÷	#  × [0.3] <CHARACTER TABULATION> (BA) × [7.01] SPACE (SP) ÷ [18.0] WHITE UP POINTING INDEX (EB) ÷ [0.3]
× 0009 × 0308 ÷ 261D ÷	#  × [0.3] <CHARACTER TABULATION> (BA) × [9.0] COMBINING DIAERESIS (CM1_CM) ÷ [999.0] WHITE UP POINTING INDEX (EB) ÷ [0.3]
× 0009 × 0308 × 0020 ÷ 261D ÷	#  × [0.3] <CHARACTER TABULATION> (BA) × [9.0] COMBINING DIAERESIS (CM1_CM) × [7.01] SPACE (SP) ÷ [18.0] WHITE UP POINTING INDEX (EB) ÷ [0.3]
× 0009 ÷ 1F3FB ÷	#  × [0.3] <CHARACTER TABULATION> (BA) ÷ [999.0] EMOJI MODIFIER FITZPATRICK TYPE-1-2 (EM) ÷ [0.3]
× 0009 × 0020 ÷ 1F3FB ÷	#  × [0.3] <CHARACTER TABULATION> (BA) × [7.01] SPACE (SP) ÷ [18.0] EMOJI MODIFIER FITZPATRICK TYPE-1-2 (EM) ÷ [0.3]
× 0009 × 0308 ÷ 1F3FB ÷	#  × [0.3] <CHARACTER TABULA


port Engine

public func play() {
MainEngine().run() // 同じパッケージ内であるためrunにアクセスできる。これは意図した通り
}
```

`appPkg`のクライアントアプリ:

```swift
import Game
import Engine

let engine = MainEngine()
engine.run() // アプリからrunにアクセスできるが、これは意図しないアクセスである
Game.play()
print(engine.stats) // 意図した通りにstatsにアクセスできる
```

上記のシナリオでは、`App`は`Engine`(`gamePkg`内のユーティリティモジュール)をインポートし、パッケージ外で使用されることが意図されていないヘルパーAPIに直接アクセスできてしまう。

このような意図しないパッケージAPIの公開を許可することは特に問題である。なぜなら、パッケージはコードの分配単位であり、Swiftは、明確に定義されたインターフェースを持つモジュールにプログラムを分割することを奨励するため、アクセス制御でモジュールの境界を強制する。しかし、このように分割された場合でも、密接に関連するモジュールを密接に関連する(または同じ)人々が作成することは珍しくない。このようなモジュール間のアクセス制御は、関心の分離を促進する目的を果たすが、モジュールのインターフェースを修正する必要がある場合、それは通常、単一のコミットなどで簡単に調整できる。しかし、パッケージでは、コードを単一の小規模組織よりもはるかに広く共有できる。そのため、パッケージ間の境界はしばしばプログラマ間の重要な違いを表し、APIの変更に関する調整がより困難になる。たとえば、オープンソースパッケージの開発者は、ほとんどのクライアントを知らないことが一般的であり、そのようなパッケージでは既存のAPIをメジャーバージョンリリースでのみ削除することが標準的な推奨事項である。したがって、プログラマがこれらのパッケージ間の境界を強制できるようにすることが特に重要である。

##  プロポーザル内容

私たちの目標は、アクセス制御の側面からパッケージを単位として認識する仕組みをSwiftに導入することである。我々は、`package`と呼ばれる新しいアクセス修飾子を導入することによって、これを行うことを提案する。`package`アクセス修飾子は、シンボルを定義するモジュールの外からアクセスすることを許可するが、同じパッケージ内の他のモジュールからしかアクセスできない。これにより、パッケージ間の境界を明確に設定することができる。

## 詳細設計

### `package`キーワード

`package`はアクセス修飾子として導入される。`package`は文脈キーワードであるため、`package`という名前の既存の宣言は引き続


(pvc *core.PersistentVolumeClaim) int {
	if idx, exists := pvc.Annotations[planbase.AnnDiskIndex]; exists {
		if val, err := strconv.Atoi(idx); err == nil {
			return val
		}
	}
	return -1 // Return -1 for PVCs without index annotation
}

// Return PersistentVolumeClaims associated with a VM.
func (r *KubeVirt) getPVCs(vmRef ref.Ref) (pvcs []*core.PersistentVolumeClaim, err error) {
	pvcsList := &core.PersistentVolumeClaimList{}
	// Add VM uuid
	labelSelector := map[string]string{
		kVM: vmRef.ID,
	}
	// We need to have this in getPVCs so we create VM with corect disks, this will also help us with the guest generation
	if r.Plan.Spec.Type == api.MigrationOnlyConversion {
		v, err := r.Source.Inventory.VM(&vmRef)
		if err != nil {
			err = liberr.Wrap(err)
			return nil, err
		}
		if vm, ok := v.(*model.VM); ok {
			labelSelector[kVmUuid] = vm.UUID
		} else {
			return nil, fmt.Errorf("failed to parse the VM for only conversion mode, we need to UUID to prevent accidental overwrites, stopping migration")
		}
	} else {
		labelSelector[kMigration] = string(r.Migration.UID)
	}
	err = r.Destination.Client.List(
		context.TODO(),
		pvcsList,
		&client.ListOptions{
			LabelSelector: k8slabels.SelectorFromSet(labelSelector),
			Namespace:     r.Plan.Spec.TargetNamespace,
		},
	)

	if err != nil {
		err = liberr.Wrap(err)
		return
	}

	pvcs = make([]*core.PersistentVolumeClaim, len(pvcsList.Items))
	for i, pvc := range pvcsList.Items {
		// loopvar
		pvc := pvc
		pvcs[i] = &pvc
	}

	// Sort the pvcs slice by disk index
	sort.Slice(pvcs, func(i, j int) bool {
		iIdx := getDiskIndex(pvcs[i])
		jIdx := getDiskIndex(pvcs[j])
		return iIdx < jIdx
	})

	return
}

// Creates the PVs and PVCs for LUN disks.
func (r *KubeVirt) createLunDisks(vmRef ref.Ref) (err error) {
	lunPvcs, err := r.Builder.LunPersistentVolumeClaims(vmRef)
	if err != nil {
		return
	}
	err = r.EnsurePersistentVolumeClaim(vmRef, lunPvcs)
	if err != nil {
		return
	}
	lunPvs, err := r.Builder.LunPersistentVolumes(vmRef)
	if err != nil {
		return
	}
	err = r.EnsurePersistentVolume(vmRef, lunPvs)
	if err != nil {
		return
	}
	return
}

// Creates a pod associated with PVCs to create node bind (wait for consumer)
func (r *KubeVirt) createPodToBindPVCs(vm *plan.VMStatus, pvcNames []string) (err error) {
	if len(pvcNames) == 0 {
		return
	}
	volumes := []core.Volume{}
	for _, pvcName := range pvcNames {
		volumes = append(volumes, core.Volume{
			Name: pvcName,
			VolumeSource: core.VolumeSource{
				PersistentVolumeClaim: &core.PersistentVolumeClaimVolumeSource{
					ClaimName: pvcName,
				},
			},
		})
	}
	nonRoot := true
	user := qemuUser
	allowPrivilageEscalation := false
	pod := &core.Pod{
		ObjectMeta:


 to do this: **derive macros**.

## Macros

You've already encountered a few macros in past exercises:

- `assert_eq!` and `assert!`, in the test cases
- `println!`, to print to the console

Rust macros are **code generators**.\
They generate new Rust code based on the input you provide, and that generated code is then compiled alongside
the rest of your program. Some macros are built into Rust's standard library, but you can also
write your own. We won't be creating our own macro in this course, but you can find some useful
pointers in the ["Further reading" section](#further-reading).

### Inspection

Some IDEs let you expand a macro to inspect the generated code. If that's not possible, you can use
[`cargo-expand`](https://github.com/dtolnay/cargo-expand).

### Derive macros

A **derive macro** is a particular flavour of Rust macro. It is specified as an **attribute** on top of a struct.

```rust
#[derive(PartialEq)]
struct Ticket {
    title: String,
    description: String,
    status: String
}
```

Derive macros are used to automate the implementation of common (and "obvious") traits for custom types.
In the example above, the `PartialEq` trait is automatically implemented for `Ticket`.
If you expand the macro, you'll see that the generated code is functionally equivalent to the one you wrote manually,
although a bit more cumbersome to read:

```rust
#[automatically_derived]
impl ::core::cmp::PartialEq for Ticket {
    #[inline]
    fn eq(&self, other: &Ticket) -> bool {
        self.title == other.title
            && self.description == other.description
            && self.status == other.status
    }
}
```

The compiler will nudge you to derive traits when possible.

## Further reading

- [The little book of Rust macros](https://veykril.github.io/tlborm/)
- [Proc macro workshop](https://github.com/dtolnay/proc-macro-workshop)
# Scoped threads

All the lifetime issues we discussed so far have a common source:
the spawned thread can outlive its parent.\
We can sidestep this issue by using **scoped threads**.

```rust
let v = vec![1, 2, 3];
let midpoint = v.len() / 2;

std::thread::scope(|scope| {
    scope.spawn(|| {
        let first = &v[..midpoint];
        println!("Here's the first half of v: {first:?}");
    });
    scope.spawn(|| {
        let second = &v[midpoint..];
        println!("Here's the second half of v: {second:?}");
    });
});

println!("Here's v: {v:?}");
```

Let's unpack what's happening.

## `scope`

The `std::thread::scope` function creates a new **scope**.\
`std::thread::scope` takes as input a closure, with a single argument: a `Scope` instance.

## Scoped spawns

`Scope` exposes a `spawn` method.\
Unlike `std::thread::spawn`, all threads spawned using a `Scope` will be
**automatically joined** when the scope ends.

If we were to "translate" the previous example to `std::thread::spawn`,
it'd look like this:

```rust
let v = vec![1, 2, 3];
let midpoint = v.len() / 2;

let handle1 = std::thread::spawn(|| {
    let first = &v[..midpoint];
    println!("Here's the first half of v: {first:?}");
});
let handle2 = std::thread::spawn(|| {
    let second = &v[midpoint..];
    println!("Here's the second half of v: {second:?}");
});

handle1.join().unwrap();
handle2.join().unwrap();

println!("Here's v: {v:?}");
```

## Borrowing from the environment

The translated example wouldn't compile, though: the compiler would complain
that `&v` can't be us


dab_nsdata
My data is <> - ok since we can handle a nil

default 13:36:58.000000 +0100   icdab_nsdata
-[__NSCFConstantString _isDispatchData]:
unrecognized selector sent to instance 0x3f054

default 13:36:58.000000 +0100   icdab_nsdata
     *** Terminating app due to uncaught exception
    'NSInvalidArgumentException', reason:
    '-[__NSCFConstantString _isDispatchData]:
     unrecognized selector sent to instance 0x3f054'

    *** First throw call stack:
    (0x25aa391b 0x2523ee17 0x25aa92b5 0x25aa6ee1 0x259d2238
     0x2627e9a5 0x3d997
     0x2a093785 0x2a2bb2d1 0x2a2bf285 0x2a2d383d 0x2a2bc7b3
      0x27146c07
      0x27146ab9 0x27146db9 0x25a65dff 0x25a659ed 0x25a63d5b
       0x259b3229
      0x259b3015 0x2a08cc3d 0x2a087189 0x3d80d 0x2565b873)

default 13:36:58.000000 +0100
    SpringBoard Application
  'UIKitApplication:www.perivalebluebell.icdab-nsdata[0x51b9]'
    crashed.

default 13:36:58.000000 +0100
UserEventAgent
     2769630555571: id=www.perivalebluebell.icdab-nsdata
   pid=386, state=0

default 13:36:58.000000 +0000   ReportCrash
     Formulating report for corpse[386] icdab_nsdata

default 13:36:58.000000 +0000   ReportCrash
     Saved type '109(109_icdab_nsdata)'
    report (2 of max 25) at
    /var/mobile/Library/Logs/CrashReporter/
    icdab_nsdata-2018-07-27-133658.ips

From here we can see the problem is that __NSCFConstantString is unable to respond to _isDispatchData because NSString is not a data providing object.

The Apple SDKs have private implementation classes to support the public abstractions we consume. Error reports will refer to these private classes. Therefore, their names can be unfamiliar.

An easy way to gather our compass, and figure out what concrete representations map to which abstraction is to search for the class type definition.

Conveniently, other engineers have run a tool over all frameworks to generate the Objective-C class definitions and have stored them on GitHub. They use the class-dump tool. This makes all private framework symbols for Objective-C easily searchable.

We can find the definition of _isDispatchData. (“NSDispatchData.h in Foundation.framework” 2018)

/* Generated by RuntimeBrowser
   Image: /System/Library/Frameworks/Foundation.framework/
   Foundation
 */

@interface _NSDispatchData : NSData

+ (bool)supportsSecureCoding;

- (bool)_allowsDirectEncoding;
- (id)_createDispatchData;
- (bool)_isDispatchData;
- (Class)classForCoder;
- (id)copyWithZone:(struct _NSZone { }*)arg1;
- (void)encodeWithCoder:(id)arg1;
- (void)enumerateByteRangesUsingBlock:(id /* block */)arg1;
- (void)getBytes:(void*)arg1;
- (void)getBytes:(void*)arg1 length:(unsigned long long)arg2;
- (void)getBytes:(void*)arg1 range:(struct _NSRange
   { unsigned long long x1; unsigned long long x2; })arg2;
- (unsigned long long)hash;
- (id)initWithCoder:(id)arg


70_1 = L70_1()
L68_1[L69_1] = L70_1
_ENV["CAAD7A09C980C2598"]["prototype"]["F0E47A597FB435DB7"] = function(A0_2)

  local L1_2, L2_2
  L1_2 = C368EEDD37E362639
  L1_2 = L1_2.prototype
  L1_2 = L1_2.F0E47A597FB435DB7
  L2_2 = A0_2
  L1_2(L2_2)
end

_ENV["CAAD7A09C980C2598"]["prototype"]["F7C68FEDB79AB6396"] = function(A0_2, A1_2)

  local L2_2, L3_2, L4_2
  L2_2 = C368EEDD37E362639
  L2_2 = L2_2.prototype
  L2_2 = L2_2.F7C68FEDB79AB6396
  L3_2 = A0_2
  L4_2 = A1_2
  L2_2(L3_2, L4_2)
  A0_2[5] = A1_2
end

_ENV["CAAD7A09C980C2598"]["prototype"]["FA01CDBE48E99223E"] = function(A0_2)

  local L1_2
  L1_2 = A0_2[5]
  return L1_2
end

L68_1 = _ENV["CAAD7A09C980C2598"]["prototype"]
L69_1 = _ENV["CAAD7A09C980C2598"]
L68_1.__class__ = L69_1
L68_1 = _ENV["CAAD7A09C980C2598"]
L69_1 = "__super__"
L69_1 = _ENV["CAAD7A09C980C2598"]["prototype"]
L70_1 = {}
L71_1 = "__index"


crossAxisAlignment: CrossAxisAlignment.center,
                      children: [
                        _buildTabContent(),
                        Obx((() => _CloseButton(
                              visible: hover.value && widget.closable,
                              tabSelected: isSelected,
                              onClose: () => widget.onClose(),
                            )))
                      ])).paddingSymmetric(horizontal: 10),
              Offstage(
                offstage: !showDivider,
                child: VerticalDivider(
                  width: 1,
                  indent: _kDividerIndent,
                  endIndent: _kDividerIndent,
                  color: MyTheme.tabbar(context).dividerColor,
                  thickness: 1,
                ),
              )
            ],
          ),
        ),
      ),
    );
  }

  @override
  String? get restorationId => "_Tab${widget.label.value}";

  @override
  void restoreState(RestorationBucket? oldBucket, bool initialRestore) {
    registerForRestoration(restoreHover, 'restoreHover');
  }
}

class _CloseButton extends StatelessWidget {
  final bool visible;
  final bool tabSelected;
  final Function onClose;

  const _CloseButton({
    Key? key,
    required this.visible,
    required this.tabSelected,
    required this.onClose,
  }) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return SizedBox(
        width: _kIconSize,
        child: Offstage(
          offstage: !visible,
          child: InkWell(
            customBorder: const RoundedRectangleBorder(),
            onTap: () => onClose(),
            child: Icon(
              Icons.close,
              size: _kIconSize,
              color: tabSelected
                  ? MyTheme.tabbar(context).selectedIconColor
                  : MyTheme.tabbar(context).unSelectedIconColor,
            ),
          ),
        )).paddingOnly(left: 5);
  }
}

class ActionIcon extends StatefulWidget {
  final String? message;
  final IconData icon;
  final Function() onTap;
  final bool isClose;
  final double iconSize;
  final double boxSize;

  const ActionIcon(
      {Key? key,
      this.message,
      required this.icon,
      required this.onTap,
      this.isClose = false,
      this.iconSize = _kActionIconSize,
      this.boxSize = _kTabBarHeight - 1})
      : super(key: key);

  @override
  State<ActionIcon> createState() => _ActionIconState();
}

class _ActionIconState extends State<ActionIcon> {
  var hover = false.obs;

  @override
  void initState() {
    super.initState();
    hover.value = false;
  }

  @override
  Widget build(BuildContext context) {
    return Tooltip(
      message: widget.message != null ? translate(widget.message!) : "",
      waitDuration: const Duration(seconds: 1),
      child: Obx(
        () => InkWell(
          hoverColor: widget.isClose
              ? const Color.fromARGB(255, 196, 43, 28)
              : MyTheme.tabbar(context).hoverColor,
          onHover: (value) => hover.value = value,
          onTap: widget.onTap,
          child: SizedBox(
            height: widget.boxSize,
            width: widget.boxSize,
            child: Icon(
              widget.icon,
              color: hover.value && widget.isClose
                  ? Colors.white
                  : MyTheme.tabbar(context).unSelectedIconColor,
              size: widget.iconSize,
            ),
          ),
        ),
      ),
    );
  }
}

class AddButton extends StatelessWidget {
  const AddButton({
    Key? key,
  }) : super(key: key);

  @


#--depends-on commands
#--require-config bighugethesaurus-api-key

from src import ModuleManager, utils

URL_THESAURUS = "http://words.bighugelabs.com/api/2/%s/%s/json"

class Module(ModuleManager.BaseModule):
    @utils.hook("received.command.synonym", min_args=1)
    @utils.hook("received.command.antonym", min_args=1)
    def thesaurus(self, event):
        """
        :help: Get synonyms/antonyms for a provided phrase
        :usage: <word> [type]
        """
        phrase = event["args_split"][0]
        page = utils.http.request(URL_THESAURUS % (
            self.bot.config["bighugethesaurus-api-key"], phrase))
        syn_ant = event["command"][:3]
        if page:
            if page.code == 404:
                raise utils.EventError("Word not found")
            page = page.json()

            if not len(event["args_split"]) > 1:
                word_types = []
                for word_type in page.keys():
                    if syn_ant in page[word_type]:
                        word_types.append(word_type)
                if word_types:
                    word_types = sorted(word_types)
                    event["stdout"].write(
                        "Available categories for %s: %s" % (
                        phrase, ", ".join(word_types)))
                else:
                    event["stderr"].write("No categories available")
            else:
                category = event["args_split"][1].lower()
                if category in page:
                    if syn_ant in page[category]:
                        event["stdout"].write("%ss for %s: %s" % (
                            event["command"].title(), phrase, ", ".join(
                            page[category][syn_ant])))
                    else:
                        event["stderr"].write("No %ss for %s" % (
                            event["command"], phrase))
                else:
                    event["stderr"].write("Category not found")
        else:
            raise utils.EventResultsError()


   { -- Right
            awful.titlebar.widget.floatingbutton (c),
            awful.titlebar.widget.maximizedbutton(c),
            awful.titlebar.widget.stickybutton   (c),
            awful.titlebar.widget.ontopbutton    (c),
            awful.titlebar.widget.closebutton    (c),
            layout = wibox.layout.fixed.horizontal()
        },
        layout = wibox.layout.align.horizontal
    }
end)
-- }}}

-- {{{ Notifications

ruled.notification.connect_signal('request::rules', function()
    -- All notifications will match this rule.
    ruled.notification.append_rule {
        rule       = { },
        properties = {
            screen           = awful.screen.preferred,
            implicit_timeout = 5,
        }
    }
end)

naughty.connect_signal("request::display", function(n)
    naughty.layout.box { notification = n }
end)

-- }}}

-- Enable sloppy focus, so that focus follows mouse.
client.connect_signal("mouse::enter", function(c)
    c:activate { context = "mouse_enter", raise = false }
end)


## DestroyModelMixin

Предоставляет метод `.destroy(request, *args, **kwargs)`, который реализует удаление существующего экземпляра модели.

Если объект удален, возвращается ответ `204 No Content`, в противном случае возвращается ответ `404 Not Found`.

---

# Классы специфичных представлений

Следующие классы являются специфичными общими представлениями. Если вы используете общие представления, то обычно вы работаете именно на этом уровне, если только вам не нужно сильно измененное поведение.

Классы представления могут быть импортированы из `rest_framework.generics`.

## CreateAPIView

Используется только для **создания** конечных точек.

Предоставляет обработчик метода `post`.

Расширяет: [GenericAPIView](#genericapiview), [CreateModelMixin](#createmodelmixin)

## ListAPIView

Используется для конечных точек **только для чтения** для представления **коллекции экземпляров модели**.

Предоставляет обработчик метода `get`.

Расширяет: [GenericAPIView](#genericapiview), [ListModelMixin](#listmodelmixin)

## RetrieveAPIView

Используется для конечных точек **только для чтения** для представления **одного экземпляра модели**.

Предоставляет обработчик метода `get`.

Расширяет: [GenericAPIView](#genericapiview), [RetrieveModelMixin](#retrievemodelmixin)

## DestroyAPIView

Используется для **только для удаления** конечных точек для **одного экземпляра модели**.

Предоставляет обработчик метода `delete`.

Расширяет: [GenericAPIView](#genericapiview), [DestroyModelMixin](#destroymodelmixin)

## UpdateAPIView

Используется для **только для обновления** конечных точек для **одного экземпляра модели**.

Предоставляет обработчики методов `put` и `patch`.

Расширяет: [GenericAPIView](#genericapiview), [UpdateModelMixin](#updatemodelmixin)

## ListCreateAPIView

Используется для конечных точек **чтения-записи** для представления **коллекции экземпляров модели**.

Предоставляет обработчики методов `get` и `post`.

Расширяет: [GenericAPIView](#genericapiview), [ListModelMixin](#listmodelmixin), [CreateModelMixin](#createmodelmixin)

## RetrieveUpdateAPIView

Используется для **чтения или обновления** конечных точек для представления **одного экземпляра модели**.

Предоставляет обработчики методов `get`, `put` и `patch`.

Расширяет: [GenericAPIView](#genericapiview), [RetrieveModelMixin](#


using System.IO;

namespace MoonSharp.Interpreter.CoreLib.IO
{
	/// <summary>
	/// Abstract class implementing a file Lua userdata. Methods are meant to be called by Lua code.
	/// </summary>
	internal abstract class StreamFileUserDataBase : FileUserDataBase
	{
		protected Stream m_Stream;
		protected StreamReader m_Reader;
		protected StreamWriter m_Writer;
		protected bool m_Closed = false;

		protected void Initialize(Stream stream, StreamReader reader, StreamWriter writer)
		{
			m_Stream = stream;
			m_Reader = reader;
			m_Writer = writer;
		}

		private void CheckFileIsNotClosed()
		{
			if (m_Closed)
				throw new ScriptRuntimeException("attempt to use a closed file");
		}

		protected override bool Eof()
		{
			CheckFileIsNotClosed();

			if (m_Reader != null)
				return m_Reader.EndOfStream;
			else
				return false;
		}

		protected override string ReadLine()
		{
			CheckFileIsNotClosed();
			return m_Reader.ReadLine();
		}

		protected override string ReadToEnd()
		{
			CheckFileIsNotClosed();
			return m_Reader.ReadToEnd();
		}

		protected override string ReadBuffer(int p)
		{
			CheckFileIsNotClosed();
			char[] buffer = new char[p];
			int length = m_Reader.ReadBlock(buffer, 0, p);
			return new string(buffer, 0, length);
		}

		protected override char Peek()
		{
			CheckFi


vec![7, 4, 1],
                vec![8, 5, 2],
                vec![9, 6, 3],
            ],
        );
    }

    #[test]
    fn test_exammple2() {
        let mut m = vec![
            vec![ 5, 1, 9,11],
            vec![ 2, 4, 8,10],
            vec![13, 3, 6, 7],
            vec![15,14,12,16],
        ];

        Solution::rotate(&mut m);

        assert_eq!(
            m,
            vec![
                [15,13, 2, 5],
                [14, 3, 4, 1],
                [12, 6, 8, 9],
                [16, 7,10,11],
            ],
        );
    }
}
use std::{
    fmt,
    collections::HashSet,
    hash::Hash,
};
use crate::slot::SlotId;

/// This is quite the supertrait.
/// [`Value`] represents any arbitrary data that
/// the network is trying to reach consensus on.
/// In addition to all the traits the data must implement,
/// it must implement [`Value::combine`]
/// which must combine itself with another to form
/// a new Value in a deterministic and communative manner.
/// (e.g. taking the union of two sets, or using the older item).
pub trait Value: Hash + Eq + Ord + fmt::Debug + Clone {
    fn combine(this: Self, that: Self, slot_id: SlotId) -> Self;
}

pub fn combine<T: Value>(value_set: HashSet<T>, slot_id: &SlotId) -> Option<T> {
    let mut acc = None;
    for value in value_set.into_iter() {
        acc = if let Some(so_far) = acc {
            Some(Value::combine(so_far, value, *slot_id))
        } else {
            Some(value)
        };
    }
    return acc;
}
<filename>src/php/types/mod.rs<gh_stars>0
//! Contains all the different types that are introduced into PHP.
//! Introduces functions for converting between Zend values and Rust values.

pub mod array;
pub mod binary;
pub mod callable;
#[cfg(any(docs, feature = "closure"))]
#[cfg_attr(docs, doc(cfg(feature = "closure")))]
pub mod closure;
pub mod long;
pub mod object;
pub mod string;
pub mod zval;

use std::{
    ffi::{c_void, CString},
    ptr,
};

use crate::bindings::{
    zend_type, IS_MIXED, MAY_BE_ANY, MAY_BE_BOOL, _IS_BOOL, _ZEND_IS_VARIADIC_BIT,
    _ZEND_SEND_MODE_SHIFT, _ZEND_TYPE_NAME_BIT, _ZEND_TYPE_NULLABLE_BIT,
};

use super::enums::DataType;

/// Internal Zend type.
pub type ZendType = zend_type;

impl ZendType {
    /// Builds an empty Zend type container.
    ///
    /// # Parameters
    ///
    /// * `pass_by_ref` - Whether the value should be passed by reference.
    /// * `is_variadic` - Whether this type represents a variadic argument.
    pub fn empty(pass_by_ref: bool, is_variadic: bool) -> Self {
        Self {
            ptr: ptr::null::<c_void>() as *mut c_void,
            type_mask: Self::arg_info_flags(pass_by_ref, is_variadic),
        }
    }

    /// Attempts to create a zend type for a given datatype. Returns an option containing the type.
    ///
    /// Returns [`None`] if the data type was a class object where the class name could not be converted
    /// into a C string (i.e. contained NUL-bytes).
    ///
    /// # Parameters
    ///
    /// *


36.12-1.067.242-1.591.365v-6.866l-1.591 1.579h-7.956v7.826c-.598.177-1.134.338-1.592.479V3.875h20.674V2H12v60h37.134V43.289c1.976-4.571 4.906-8.213.772-11.27m-1.475 8.109c-1.448 2.984-3.346 6.895-2.411 11.457-5.341-.162-7.493-3.03-10.199-6.635-2.662-3.545-5.813-7.742-12.553-9.62 5.999-1.501 13.392-2.997 19.024-2.997 3.881 0 5.653.709 6.456 1.303 1.893 1.399 1.63 2.479-.317 6.492M13.859 60.125V36.508c.334.018.647.048.968.075 1.927.264 6.377 1.084 10.024 3.316 1.749 1.229 3.125 2.691 4.316 4.24a30.558 30.558 0 001.779 2.503c3.374 5.063 6.03 10.116 14.469 10.116-.748-.912-1.238-2.075-1.548-3.379.806.137 1.677.213 2.636.213.249 0 .511-.011.771-.021v6.554H13.859"/></svg>';
  static const String christmas_tree =
      '<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="64" height="64" preserveAspectRatio="xMidYMid meet" viewBox="0 0 64 64"><path fill="currentColor" d="M59.123 48.933c-7.229 0-13.138-5.549-17.309-11.258a9.536 9.536 0 003.216.558h.001c3.195 0 5.473-1.581 5.568-1.648l2.36-1.666h-2.878c-4.386 0-8.042-3.171-10.729-6.627.437.089.88.149 1.334.149h.001c2.223 0 3.817-1.106 3.885-1.154l2.36-1.666h-2.878c-3.25 0-5.905-2.681-7.815-5.541l1.112.593-.464-2.741-.558-3.291 2.364-2.332 1.968-1.941-2.72-.4-3.266-.481-1.462-2.995L32 4l-1.216 2.493-1.46 2.995-3.266.481-2.719.4 1.968 1.941 2.364 2.331-.559 3.291-.465 2.741 1.115-.594c-1.909 2.859-4.565 5.542-7.815 5.542h-2.879l2.362 1.666c.06.042 1.351.929 3.218 1.115a4.361 4.361 0 00-3.21 4.21c0 .192.032.376.056.562-1.688 1.066-3.552 1.745-5.574 1.745h-2.878l2.361 1.666c.095.067 2.373 1.648 5.568 1.648a9.521 9.521 0 003.217-.558c-4.171 5.709-10.079 11.258-17.309 11.258H2l2.361 1.664c.138.099 3.441 2.391 8.092 2.391 2.098 0 4.119-.471 6.048-1.387.21.186.437.35.68.492a217.838 217.838 0 01-3.241 6.879l-.557 1.151 1.26.166s.


-dialog-title {
    float: left;
    margin: .1em 16px .1em 0;
}
.ui-dialog .ui-dialog-titlebar-close {
    position: absolute;
    right: .3em;
    top: 50%;
    width: 19px;
    margin: -10px 0 0 0;
    padding: 1px;
    height: 18px;
}
.ui-dialog .ui-dialog-titlebar-close span {
    display: block;
    margin: 1px;
}
.ui-dialog .ui-dialog-titlebar-close:hover,
.ui-dialog .ui-dialog-titlebar-close:focus { padding: 0 }
.ui-dialog .ui-dialog-content {
    position: relative;
    border: 0;
    padding: .5em 1em;
    background: none;
    overflow: auto;
    zoom: 1;
}
.ui-dialog .ui-dialog-buttonpane {
    text-align: left;
    border-width: 1px 0 0 0;
    background-image: none;
    margin: .5em 0 0 0;
    padding: .3em 1em .5em .4em;
}
.ui-dialog .ui-dialog-buttonpane .ui-dialog-buttonset { float: right }
.ui-dialog .ui-dialog-buttonpane button {
    margin: .5em .4em .5em 0;
    cursor: pointer;
}
.ui-dialog .ui-resizable-se {
    width: 14px;
    height: 14px;
    right: 3px;
    bottom: 3px;
}
.ui-draggable .ui-dialog-titlebar { cursor: move }

/* --- JQUERY UI MENU CUSTOMIZATION -----------------
 *
 * ======================================================================================================================*/
.ui-menu {
    list-style: none;
    margin: 0;
    display: block;
    outline: none;
    padding: 0;
}
.ui-menu.ui-widget-content {
    border-color: #ccc;
}
.ui-menu .ui-menu {
    margin-top: -3px;
    position: absolute;
}
.ui-menu .ui-menu-item {
    margin: 0;
    padding: 0;
    zoom: 1;
    width: 100%;
}
.ui-menu .ui-menu-divider {
    margin: 5px -2px 5px -2px;
    height: 0;
    font-size: 0;
    line-height: 0;
    border-width: 1px 0 0 0;
}
.ui-menu .ui-menu-item a {
    text-decoration: none;
    display: block;
    line-height: 1.5;
    zoom: 1;
    font-weight: normal;
    padding: .5em .5em;
    -moz-border-radius: 0;
    -webkit-border-radius: 0;
    border-radius: 0;
}
.ui-menu .ui-menu-item a:hover {
    background: #f9f9f9;
    background: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/Pgo8c3ZnIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAw


shouldBePresent = true;
            }
        }

        LOGGER.info(String.format("Detected %s on %s, expect Shenandoah to be present: %s",
                jdkVersion, jdkPlatform, shouldBePresent));

        List<String> command = new ArrayList<>();
        command.add(String.format("%s/bin/java", testJdkHome));
        command.add("-XX:+UseShenandoahGC");
        command.add("-version");

        try {
            ProcessBuilder processBuilder = new ProcessBuilder(command);
            processBuilder.inheritIO();

            int retCode = processBuilder.start().waitFor();
            if (shouldBePresent) {
                assertEquals(retCode, 0, "Expected Shenandoah to be present but it is absent.");
            } else {
                assertTrue(retCode > 0, "Expected Shenandoah to be absent but it is present.");
            }
        } catch (InterruptedException | IOException e) {
            throw new RuntimeException("Failed to launch JVM", e);
        }
    }

    /**
     * Tests whether Z Garbage Collector is available.
     *

     * Z Garbage Collector was enabled by default with JDK 15 (JEP 377).
     *
     * @see JEP 377: ZGC: A Scalable Low-Latency Garbage Collector
     * (Production)
     */
    @Test
    public void testZGCAvailable() {

        boolean shouldBePresent = false;
        if (jdkVersion.isNewerOrEqual(15)) {
            if (jdkPlatform.runsOn(OperatingSystem.LINUX, Architecture.AARCH64)
                    || jdkPlatform.runsOn(OperatingSystem.LINUX, Architecture.X64)
                    || jdkPlatform.runsOn(OperatingSystem.MACOS, Architecture.X64)
                    || jdkPlatform.runsOn(OperatingSystem.LINUX, Architecture.PPC64LE)
                    || jdkPlatform.runsOn(OperatingSystem.MACOS, Architecture.AARCH64)
                    /*
                     * Windows is disabled until we can get 2019 Visual Studio
                     * and O/S levels in Adoptium infrastructure
                     * TODO revert https://github.com/adoptium/temurin-build/pull/2767
                     */
                    // || jdkPlatform.runsOn(OperatingSystem.WINDOWS, Architecture.X64)
            ) {
                shouldBePresent = true;
            }
        }
        if (jdkVersion.isNewerOrEqual(19) || jdkVersion.isNewerOrEqualSameFeature(17, 0, 9)) {
            if (jdkPlatform.runsOn(OperatingSystem.LINUX, Architecture.RISCV64)) {
                shouldBePresent = true;
            }
        }

        LOGGER.info(String.format("Detected %s on %s, expect ZGC to be present: %s",
                jdkVersion, jdkPlatform, shouldBePresent));

        List<String> command = new ArrayList<>();
        command.add(String.format("%s/bin/java", testJdkHome));
        command.add("-XX:+UseZGC");
        command.add("-version");

        try {
            ProcessBuilder processBuilder = new ProcessBuilder(command);
            processBuilder.inheritIO();

            int retCode = processBuilder.start().waitFor();
            if (!jdkPlatform.runsOn(OperatingSystem.WINDOWS, Architecture.X64)
                && !jdkPlatform.runsOn(OperatingSystem.WINDOWS, Architecture.AARCH64)
            ) {
                if (shouldBePresent) {
                    assertEquals(retCode, 0, "Expected ZGC to be present but it is absent.");
                } else {
                    assertTrue(retCode > 0, "Expected ZGC to be absent but it is present.");
                }
            } else {
                // TODO Windows is complicated because only later versions of Windows supports ZGC, we need to find a way to detect that.


using UnityEngine;
using System;
using System.Runtime.InteropServices;

public class ProceduralTextureUnsafe : MonoBehaviour
{
	public GameObject Quad;
	public int Width = 128;
	public int Height = 128;
	[Range(1, 16)] public int Quality = 12;

	private Texture2D _Texture;
	private int _Size;
	private IntPtr _Data;
	private unsafe int* _Pixels;

	unsafe void Init()
	{
		_Size = Width * Height * sizeof(int);
		_Data = Marshal.AllocHGlobal(_Size);
		_Texture = new Texture2D(Width, Height, TextureFormat.RGBA32, false);
		_Pixels = (int*)_Data.ToPointer();
		Quad.GetComponent<Renderer>().material.mainTexture = _Texture;
	}

	float SandWaves(float x, float y, float h, float time, int octaves, float amplitude, float scale)
	{
		float radius = 8.0f;
		float frequency = 0.03f;
		float speed = -0.05f;
		for (int i = 0; i < octaves; i++)
		{
			float s = Mathf.Sin(time * 0.021f) * 0.1f + 0.41f * Mathf.Sin(i * 0.71f + time * 0.02f);
			float angle = 1.8f + s * amplitude;
			float dx = Mathf.Cos(angle);
			float dy = Mathf.Sin(angle);
			float t = -1.0f * ((x - scale) * dx + (y - scale) * dy);
			float sineWave = Mathf.Sin(time * speed + t


1] = x+1;
				indexPtr[2] = y;
				indexPtr[3] = y;
				indexPtr[4] = x+1;
				indexPtr[5] = y+1;

				indexPtr += 6;
				x++;
				y++;

				//	연못의 최소최대 위치 구함
				if(StX>ptVtx->x) StX = ptVtx->x;
				if(EnX<ptVtx->x) EnX = ptVtx->x;
				if(StZ>ptVtx->z) StZ = ptVtx->z;
				if(EnZ<ptVtx->z) EnZ = ptVtx->z;
				ptVtx++;
			}
			x++;
			y++;
		}

		float fmin,fmax,fmaxcal,fmincal;
		if(ptmpPondMesh->m_pfMaxHeight>0.0f)
		{
			fmax = ptmpPondMesh->m_pfMaxHeight*0.04f;
			fmin = -fmax;
			fmaxcal = fmax*ATISQRT;
			fmincal = -fmaxcal;
		}
		else if(ptmpPondMesh->m_pfMaxHeight<0.0f)
		{
			fmin = ptmpPondMesh->m_pfMaxHeight*0.04f;
			fmax = -fmin;
			fmincal = fmin*ATISQRT;
			fmaxcal = -fmincal;
		}
		else
		{
			fmax = 0.04f;
			fmin = -fmax;
			fmaxcal = fmax*ATISQRT;
			fmincal = -fmaxcal;
		}

		ptmpPondMesh->m_fmin = fmin;
		ptmpPondMesh->m_fmax = fmax;
		ptmpPondMesh->m_fmaxcal = fmaxcal;
		ptmpPondMesh->m_fmincal = fmincal;

		ptmpPondMesh->m_vCenterPo.Set(((EnX-StX)/2.0f) + StX
									 ,ptmpPondMesh->m_pVertices[1].y
									 ,((EnZ-StZ)/2.0f) + StZ);
		if(EnX-StX > EnZ-StZ)
			ptmpPondMesh->m_fRadius = EnX-StX;
		else ptmpPondMesh->m_fRadius = EnZ-StZ;

		ptmpPondMesh->m_bTick2Rand = TRUE;		///

		if(m_iMaxVtxNum<iVC) m_iMaxVtxNum=iVC;	//	가장큰 계산범위 구함
	}

	m_pfMaxVtx = new float [m_iMaxVtxNum];
	m_iMaxVtxNum *= sizeof(float);

#ifdef _DEBUG
	for (int x = 0; x < 2000; x++)
		UpdateWaterPositions();
#endif

	if (m_iPondMeshNum <= 0)
		return false;

	std::string szFileName;
	for (int i = 0; i < MAX_POND_TEX; i++)
	{
		szFileName = fmt::format("misc\\river\\caust{:02}.dxt", i);
		m_pTexPond[i] = CN3Base::s_MngTex.Get(szFileName);
		__ASSERT(m_pTexPond[i], "CN3Pond::texture load failed");
	}

	return true;
}

void CN3Pond::Tick()
{
	if(m_iPondMeshNum==0) return;

	float frame;

	m_fTexIndex += s_fSecPerFrm*15.0f;
	if (m_fTexIndex >= 32.0f)
	{
		m_fTexIndex -= 32.0f;
	}

	// 프레임이 임계값보다 작으면 버린다..
	if ( CN3Base::s_fFrmPerSec < 0.1f ) retur


 Derby will see the execution of the outer query before that of the inner, and won't allow fetching of the inner before that of the outer... i.e. deadlock
//							Thread.sleep(10);

							String dsWrappperID = SUBQUERY_PREFIX+"_"+(-1<targetCID.indexOf('\'')?targetCID.hashCode():targetCID);
							logger.logInfo("Creating rsmd for generated " + (null==rs?"update count":"ResultSet"));

							if ( null != rs ) {
								// A ResultSet was returned by the procedure - hold on to it until we need it...
								// NOTE! The resultSet rs is derived from a child connection spawed in the stored procedure, NOT from the parent connection c.
								metaData = new GaianResultSetMetaData( rs, dsWrappperID, resultModifiers.endsWith("falsefalse"), c );
								// *CRUCIAL STEP*: DO NOT recycle this connection yet as it has a retained result - recycling happens after resultSet is fetched...
								c = null;
							} else {
								// The procedure just returned an update count so the connection can be recycled immediately.
								metaData = new GaianResultSetMetaData( s.getUpdateCount(), dsWrappperID );
								s.close(); // Close the statement, making the connection ready to be recycled (in finally{} block)
							}

							// DRV 06/02/2015 - CACHE the MD for stored procedures because they have already been run and have a retained result.
							derivedMetaData.put( sqlQuery+targetCID+resultModifiers, metaData );
						}

					} else {
						// This is a query (may be select/with/values/xquery)...
						// Note some RDBMS drivers (e.g. ojdbc14.jar) don't support c.prepareStatement( sqlQuery ).getMetaData()
						// The only way around this is to execute the statement before we can get the table def...
						// Solution: wrap subquery in another subquery, adding predicate "where 0=1" then execute this to only get the meta-data.
						PreparedStatement ps = null;
						try {
							logger.logInfo("Preparing subquery to get RSMD: " + sqlQuery);
							ps = c.prepareStatement( sqlQuery );
							metaData = new GaianResultSetMetaData( ps.getMetaData(), GaianDBConfig.getSpecialColumnsDef(null), provider );

						} catch (Exception e1) {
							logger.logImportant("Unable to prepare or get metadata for subquery: " + sqlQuery + ", cause: " + e1);
							String subSubQuery = "select * from (" + sqlQuery + ") S where 0=1";
							ResultSet rs = null;
							try {
								logger.logInfo("Attempting to get metadata using sub-subquery instead: " + subSubQuery);
								rs = c.createStatement().executeQuery(subSubQuery);
								metaData = new GaianResultSetMetaData( rs.getMetaData(), GaianDBConfig.getSpecialColumnsDef(null), provider );

							} catch ( Exception e2 ) {
								throw new Exception("Unable to get MD for subquery: "+e1+
										". Also unable to get MD using SUB-subquery: " + subSubQuery + ": " + e2);

							} finally { if ( null != rs ) rs.close(); }
						} finally { if ( null != ps ) ps.close(); }
					}
				} finally {
					// return Connection to pool for re-use (this won't apply for procedure calls returning ResultSets which still need processing...)
					if ( null != c ) synchronized( connectionPool ) { connectionPool.push( c ); }
				}
			}

//			CallableStatement cs = c.prepareCall(sqlQuery);
//			metaData = new GaianResultSetMetaData( cs.getMetaData(), GaianDBConfig.getSpecialColumnsDef(null) );

			// DRV 11/09/2014 - Don't cache subquery result structure - because referenced tables may change or be dropped
			// DRV 03/10/2014 - Another reason not to cache it: because we now create it for RDBMS connection details passe


using System.Collections.Generic;
using System.Linq;
using AElf.Types;
using Volo.Abp.DependencyInjection;

namespace AElf.CrossChain.Indexing.Infrastructure;

internal class TransactionInputForBlockMiningDataProvider : ITransactionInputForBlockMiningDataProvider,
    ISingletonDependency
{
    private readonly Dictionary<Hash, CrossChainTransactionInput> _indexedCrossChainBlockData = new();

    public void AddTransactionInputForBlockMining(Hash blockHash, CrossChainTransactionInput crossChainTransactionInput)
    {
        _indexedCrossChainBlockData[blockHash] = crossChain


rPanZoomStart(PointerPanZoomStartEvent e) {
    _lastScale = 1.0;
    _stopFling = true;
    if (isViewOnly) return;
    if (isViewCamera) return;
    if (peerPlatform == kPeerPlatformAndroid) {
      handlePointerEvent('touch', kMouseEventTypePanStart, e.position);
    }
  }

  // https://docs.flutter.dev/release/breaking-changes/trackpad-gestures
  void onPointerPanZoomUpdate(PointerPanZoomUpdateEvent e) {
    if (isViewOnly) return;
    if (isViewCamera) return;
    if (peerPlatform != kPeerPlatformAndroid) {
      final scale = ((e.scale - _lastScale) * 1000).toInt();
      _lastScale = e.scale;

      if (scale != 0) {
        bind.sessionSendPointer(
            sessionId: sessionId,
            msg: json.encode(
                PointerEventToRust(kPointerEventKindTouch, 'scale', scale)
                    .toJson()));
        return;
      }
    }

    var delta = e.panDelta * _trackpadSpeedInner;
    if (isMacOS && peerPlatform == kPeerPlatformWindows) {
      delta *= _trackpadAdjustMacToWin;
    }
    _trackpadLastDelta = delta;

    var x = delta.dx.toInt();
    var y = delta.dy.toInt();
    if (peerPlatform == kPeerPlatformLinux) {
      _trackpadScrollUnsent += (delta * _trackpadAdjustPeerLinux);
      x = _trackpadScrollUnsent.dx.truncate();
      y = _trackpadScrollUnsent.dy.truncate();
      _trackpadScrollUnsent -= Offset(x.toDouble(), y.toDouble());
    } else {
      if (x == 0 && y == 0) {
        final thr = 0.1;
        if (delta.dx.abs() > delta.dy.abs()) {
          x = delta.dx > thr ? 1 : (delta.dx < -thr ? -1 : 0);
        } else {
          y = delta.dy > thr ? 1 : (delta.dy < -thr ? -1 : 0);
        }
      }
    }
    if (x != 0 || y != 0) {
      if (peerPlatform == kPeerPlatformAndroid) {
        handlePointerEvent('touch', kMouseEventTypePanUpdate,
            Offset(x.toDouble(), y.toDouble()));
      } else {
        if (isViewCamera) return;
        bind.sessionSendMouse(
            sessionId: sessionId,
            msg: '{"type": "trackpad", "x": "$x", "y": "$y"}');
      }
    }
  }

  void _scheduleFling(double x, double y, int delay) {
    if (isViewCamera) return;
    if ((x == 0 && y == 0) || _stopFling) {
      _fling = false;
      return;
    }

    _flingTimer = Timer(Duration(milliseconds: delay), () {
      if (_stopFling) {
        _fling = false;
        return;
      }

      final d = 0.97;
      x *= d;
      y *= d;

      // Try set delta (x,y) and delay.
      var dx = x.toInt();
      var dy = y.toInt();
      if (parent.target?.ffiModel.pi.platform == kPeerPlatformLinux) {
        dx = (x * _trackpadAdjustPeerLinux).toInt();
        dy = (y * _trackpadAdjustPeerLinux).toInt();
      }

      var delay = _flingBaseDelay;

      if (dx == 0 && dy == 0) {
        _fling = false;
        return;
      }

      bind.sessionSendMouse(
          sessionId: sessionId,
          msg: '{"type": "trackpad", "x": "$dx", "y": "$dy"}');
      _scheduleFling(x, y, delay);
    });
  }

  void waitLastFlingDone() {
    if (_fling) {
      _stopFling = true;
    }


def.name.value;

  if (dict[name] === undefined) {
    dict[name] = {
      name,
      type: 'ENUM',
      fields: []
    }
  }

  const t = dict[name];

  for(const value of def.values) {
    t.fields.push(`    ${value.name.value} = "${value.name.value}"`)
  }
}

function createTypeScriptFromInput(dict, def) {
  const name = def.name.value;

  if (dict[name] === undefined) {
    dict[name] = {
      name,
      type: 'TYPE',
      fields: []
    }
  }

  const t = dict[name];

  for(const field of def.fields) {
    const field_name = field.name.value;
    const field_type = mapGraphQLType(field.type);
    const optional = field_type.indexOf('null') >= 0 ? '?' : '';
    t.fields.push(`    ${field_name}${optional}: ${field_type}`);
  }
}

function mapGraphQLType(type) {
  if (type.kind === 'ListType') {
    return `${mapGraphQLNonNullType(type.type)}[]`;
  } else if (type.kind === 'NonNullType') {
    return mapGraphQLNonNullType(type.type);
  } else {
    return ['null', mapGraphQLNonNullType(type)].join(' | ');
  }
}

function mapGraphQLNonNullType(type) {
  const map = {
    "String": "string",
    "Int": "number",
    "Boolean": "boolean"
  }

  if (map[type.name.value] === undefined) {
    return prefix + type.name.value;
  }

  return map[type.name.value];
}
export enum GsmSignalStrength {
  NO_SIGNAL = 'NO_SIGNAL',
  EXTEMELY_WEAK_SIGNAL = 'EXTEMELY_WEAK_SIGNAL',
  WEAK_SIGNAL = 'WEAK_SIGNAL',
  GOOD_SIGNAL = 'GOOD_SIGNAL',
  STRONG_SIGNAL = 'STRONG_SIGNAL'
}

export function gsmSignalStrengthFromCode(code: number): GsmSignalStrength {
  switch(code) {
    case 0x00: return GsmSignalStrength.NO_SIGNAL;
    case 0x01: return GsmSignalStrength.EXTEMELY_WEAK_SIGNAL;
    case 0x02: return GsmSignalStrength.WEAK_SIGNAL;
    case 0x03: return GsmSignalStrength.GOOD_SIGNAL;
    case 0x04: return GsmSignalStrength.STRONG_SIGNAL;
    default: return null;
  }
}import { Router } from 'express';

import ensureAuthenticated from '@shared/middlewares/ensureAuthenticated';

import AlteraAgendamentoController from '../controllers/agendamentoControllers/AlteraAgendamentoController';
import ExcluiAgendamentoController from '../controllers/agendamentoControllers/ExcluiAgendamentoController';
import IncluiAgendamentoController from '../controllers/agendamentoControllers/IncluiAgendamentoController';
import ListaAgendamentoController from '../controllers/agendamentoControllers/ListaAgendamentoController';

const agendamentoRouter = Router();
agendamentoRouter.use(ensureAuthenticated);

/**
 * @swagger
 * tags:
 *   name: Agendamentos
 *   description: API - Agendamentos
 */

/**
 * @swagger
 *  components:
 *    schemas:
 *      Agendamento:
 *        type: object
 *        properties:
 *          id:
 *            type: string
 *            description: ID do Agendamento - NotNull.
 *          paciente_id:
 *            type: string
 *            description: ID do Paciente do Agendamento - NotNull.
 *          data:
 *            type: Date
 *            description: Data do Agendamento no form


的半深。
     */
    public static void drawFilledCuboid(final Matrix4f matrix, VertexConsumer consumer,
                                        float r, float g, float b, float a,
                                        float halfWidth, float halfHeight, float halfDepth) {
        float x_neg = -halfWidth;
        float y_neg = -halfHeight;
        float z_neg = -halfDepth;
        float x_pos = halfWidth;
        float y_pos = halfHeight;
        float z_pos = halfDepth;

        // 前面 (负Z轴方向)
        consumer.vertex(matrix, x_neg, y_neg, z_neg).color(r, g, b, a).normal(0, 0, -1).endVertex();
        consumer.vertex(matrix, x_pos, y_neg, z_neg).color(r, g, b, a).normal(0, 0, -1).endVertex();
        consumer.vertex(matrix, x_pos, y_pos, z_neg).color(r, g, b, a).normal(0, 0, -1).endVertex();
        consumer.vertex(matrix, x_neg, y_pos, z_neg).color(r, g, b, a).normal(0, 0, -1).endVertex();

        // 后面 (正Z轴方向)
        consumer.vertex(matrix, x_neg, y_neg, z_pos).color(r, g, b, a).normal(0, 0, 1).endVertex();
        consumer.vertex(matrix, x_neg, y_pos, z_pos).color(r, g, b, a).normal(0, 0, 1).endVertex();
        consumer.vertex(matrix, x_pos, y_pos, z_pos).color(r, g, b, a).normal(0, 0, 1).endVertex();
        consumer.vertex(matrix, x_pos, y_neg, z_pos).color(r, g, b, a).normal(0, 0, 1).endVertex();

        // 左侧 (负X轴方向)
        consumer.vertex(matrix, x_neg, y_neg, z_pos).color(r, g, b, a).normal(-1, 0, 0).endVertex();
        consumer.vertex(matrix, x_neg, y_pos, z_pos).color(r, g, b, a).normal(-1, 0, 0).endVertex();
        consumer.vertex(matrix, x_neg, y_pos, z_neg).color(r, g, b, a).normal(-1, 0, 0).endVertex();
        consumer.vertex(matrix, x_neg, y_neg, z_neg).color(r, g, b, a).normal(-1, 0, 0).endVertex();

        // 右侧 (正X轴方向)
        consumer.vertex(matrix, x_pos, y_neg, z_neg).color(r, g, b, a).normal(1, 0, 0).endVertex();
        consumer.vertex(matrix, x_pos, y_pos, z_neg).color(r, g, b, a).normal(1, 0, 0).endVertex();
        consumer.vertex(matrix, x_pos, y_pos, z_pos).color(r, g, b, a).normal(1, 0, 0).endVertex();
        consumer.vertex(matrix, x_pos, y_neg, z_pos).color(r, g, b, a).normal(1, 0, 0).endVertex();

        // 顶面 (正Y方向)
        consumer.vertex(matrix, x_neg, y_pos, z_neg).color(r, g, b, a).normal(0, 1, 0).endVertex();
        consumer.vertex(matrix, x_pos, y_pos, z_neg).color(r, g, b, a).normal(0, 1, 0).endVertex();
        consumer.vertex(matrix, x_pos, y_pos, z_pos).color(r,


 state            */
    "utf16",                     /* csname           */
    "utf16_unicode_nopad_ci",    /* name             */
    "",                          /* comment          */
    "",                          /* tailoring        */
    NULL,                        /* ctype            */
    NULL,                        /* to_lower         */
    NULL,                        /* to_upper         */
    NULL,                        /* sort_order       */
    NULL,                        /* uca              */
    NULL,                        /* tab_to_uni       */
    NULL,                        /* tab_from_uni     */
    &my_unicase_default,         /* caseinfo         */
    NULL,                        /* state_map        */
    NULL,                        /* ident_map        */
    8,                           /* strxfrm_multiply */
    1,                           /* caseup_multiply  */
    1,                           /* casedn_multiply  */
    2,                           /* mbminlen         */
    4,                           /* mbmaxlen         */
    9,                           /* min_sort_char    */
    0xFFFF,                      /* max_sort_char    */
    ' ',                         /* pad char         */
    0,                           /* escape_with_backslash_is_dangerous */
    1,                           /* levels_for_order */
    &my_charset_utf16_handler,
    &my_uca_collation_handler_nopad_utf16
};

struct charset_info_st my_charset_utf16_unicode_520_nopad_ci=
{
    MY_NOPAD_ID(123),0,0,        /* number           */
    MY_CS_UTF16_UCA_NOPAD_FLAGS, /* state            */
    "utf16",                     /* csname           */
    "utf16_unicode_520_nopad_ci",/* name             */
    "",                          /* comment          */
    "",                          /* tailoring        */
    NULL,                        /* ctype            */
    NULL,                        /* to_lower         */
    NULL,                        /* to_upper         */
    NULL,                        /* sort_order       */
    &my_uca_v520,                /* uca              */
    NULL,                        /* tab_to_uni       */
    NULL,                        /* tab_from_uni     */
    &my_unicase_unicode520,      /* caseinfo         */
    NULL,                        /* state_map        */
    NULL,                        /* ident_map        */
    8,                           /* strxfrm_multiply */
    1,                           /* caseup_multiply  */
    1,                           /* casedn_multiply  */
    2,                           /* mbminlen         */
    4,                           /* mbmaxlen         */
    9,                           /* min_sort_char    */
    0x10FFFF,                    /* max_sort_char    */
    ' ',                         /* pad char         */
    0,                           /* escape_with_backslash_is_dangerous */
    1,                           /* levels_for_order */
    &my_charset_utf16_handler,
    &my_uca_collation_handler_nopad_utf16
};

#endif /* HAVE_CHARSET_utf16 */

#endif /* HAVE_UCA_COLLATIONS */


GamePlay());
                },
                child: const Text('Play'),
              ),
            ),
            SizedBox(
              width: 120,
              child: ElevatedButton(
                onPressed: () {
                  game.overlays.remove(id);
                  game.overlays.add(Settings.id);
                },
                child: const Text('Settings'),
              ),
            ),
          ],
        ),
      ),
    );
  }
}
import 'package:flutter/material.dart';

import 'settings_menu.dart';
import 'select_spaceship.dart';

// Represents the main menu screen of Spacescape, allowing
// players to start the game or modify in-game settings.
class MainMenu extends StatelessWidget {
  const MainMenu({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: [
            // Game title.
            const Padding(
              padding: EdgeInsets.symmetric(vertical: 50.0),
              child: Text(
                'Spacescape',
                style: TextStyle(
                  fontSize: 50.0,
                  color: Colors.black,
                  shadows: [
                    Shadow(
                      blurRadius: 20.0,
                      color: Colors.white,
                      offset: Offset(0, 0),
                    ),
                  ],
                ),
              ),
            ),

            // Play button.
            SizedBox(
              width: MediaQuery.of(context).size.width / 3,
              child: ElevatedButton(
                onPressed: () {
                  // Push and replace current screen (i.e MainMenu) with
                  // SelectSpaceship(), so that player can select a spaceship.
                  Navigator.of(context).pushReplacement(
                    MaterialPageRoute(
                      builder: (context) => const SelectSpaceship(),
                    ),
                  );
                },
                child: const Text('Play'),
              ),
            ),

            // Settings button.
            SizedBox(
              width: MediaQuery.of(context).size.width / 3,
              child: ElevatedButton(
                onPressed: () {
                  Navigator.of(context).push(
                    MaterialPageRoute(
                      builder: (context) => const SettingsMenu(),
                    ),
                  );
                },
                child: const Text('Settings'),
              ),
            ),
          ],
        ),
      ),
    );
  }
}
import 'package:flame/components.dart';
import 'package:flame_audio/flame_audio.dart';
import 'package:provider/provider.dart';

import 'game.dart';

import '../models/settings.dart';

class AudioPlayerComponent extends Component
    with HasGameReference<SpacescapeGame> {
  @override
  Future<void>? onLoad() async {
    FlameAudio.bgm.initialize();

    await FlameAudio.audioCache.loadAll([
      'laser1.ogg',
      'powerUp6.ogg',
      'laserSmall_001.ogg',
    ]);

    try {
      await FlameAudio.audioCache.load('9. Space Invaders.wav');
    } catch (_) {
      // ignore: avoid_print
      print(
        'Missing VOiD1 Gaming music pack: '
        'https://void1gaming.itch.io/free-synthwave-music-pack '
        'See assets/audio/README.md for more information.',
      );
    }

    return super.onLoad();
  }

  void playBgm(String filename) {
    if (!FlameAudio.audioCache.loadedFiles.containsKey(filename)) return;

    if (game.b


*c3c9*/, "ssyelp" /*c3ca*/, "ssyelh" /*c3cb*/, "ssyem" /*c3cc*/, "ssyeb" /*c3cd*/, "ssyebs" /*c3ce*/, "ssyes" /*c3cf*/, "ssyess" /*c3d0*/, "ssyeng" /*c3d1*/, "ssyej" /*c3d2*/, "ssyec" /*c3d3*/, "ssyek" /*c3d4*/, "ssyet" /*c3d5*/, "ssyep" /*c3d6*/, "ssyeh" /*c3d7*/, "sso" /*c3d8*/, "ssog" /*c3d9*/, "ssogg" /*c3da*/, "ssogs" /*c3db*/, "sson" /*c3dc*/, "ssonj" /*c3dd*/, "ssonh" /*c3de*/, "ssod" /*c3df*/, "ssol" /*c3e0*/, "ssolg" /*c3e1*/, "ssolm" /*c3e2*/, "ssolb" /*c3e3*/, "ssols" /*c3e4*/, "ssolt" /*c3e5*/, "ssolp" /*c3e6*/, "ssolh" /*c3e7*/, "ssom" /*c3e8*/, "ssob" /*c3e9*/, "ssobs" /*c3ea*/, "ssos" /*c3eb*/, "ssoss" /*c3ec*/, "ssong" /*c3ed*/, "ssoj" /*c3ee*/, "ssoc" /*c3ef*/, "ssok" /*c3f0*/, "ssot" /*c3f1*/, "ssop" /*c3f2*/, "ssoh" /*c3f3*/, "sswa" /*c3f4*/, "sswag" /*c3f5*/, "sswagg" /*c3f6*/, "sswags" /*c3f7*/, "sswan" /*c3f8*/, "sswanj" /*c3f9*/, "sswanh" /*c3fa*/, "sswad" /*c3fb*/, "sswal" /*c3fc*/, "sswalg" /*c3fd*/, "sswalm" /*c3fe*/, "sswalb" /*c3ff*/ }},

                {196 /*50176 0c4*/, new[]{
"sswals" /*c400*/, "sswalt" /*c401*/, "sswalp" /*c402*/, "sswalh" /*c403*/, "sswam" /*c404*/, "sswab" /*c405*/, "sswabs" /*c406*/, "sswas" /*c407*/, "sswass" /*c408*/, "sswang" /*c409*/, "sswaj" /*c40a*/, "sswac" /*c40b*/, "sswak" /*c40c*/, "sswat" /*c40d*/, "sswap" /*c40e*/, "sswah" /*c40f*/, "sswae" /*c410*/, "sswaeg" /*c411*/, "sswaegg" /*c412*/, "sswaegs" /*c413*/, "sswaen" /*c414*/, "sswaenj" /*c415*/, "sswaenh" /*c416*/, "sswaed" /*c417*/, "sswael" /*c418*/, "sswaelg" /*c419*/, "sswaelm" /*c41a*/, "sswaelb" /*c41b*/, "sswaels" /*c41c*/, "sswaelt" /*c41d*/, "sswaelp" /*c41e*/, "sswaelh" /*c41f*/, "sswaem" /*c420*/, "sswaeb" /*c421*/, "sswaebs" /*c422*/, "sswaes" /*


ENSMUSG00000026483" target="_blank">ENSMUSG00000026483
      Fam129a
      family with sequence similarity 129, member A
      NCBIGene:63913

      ENSMUSG00000050821
      Fam131a
      family with sequence similarity 131, member A
      NCBIGene:78408

      ENSMUSG00000029861
      Fam131b
      family with sequence similarity 131, member B
      NCBIGene:76156

      ENSMUSG00000006218
      Fam131c
      family with sequence similarity 131, member C
      NCBIGene:277743

      ENSMUSG00000036800
      Fam135b
      family with sequence similarity 135, member B
      NCBIGene:70363

      ENSMUSG00000037709
      Fam13a
      family with sequence similarity 13, member A
      NCBIGene:58909

      ENSMUSG00000043259
      Fam13c
      family with sequence similarity 13, member C
      NCBIGene:71721

      ENSMUSG00000070044
      Fam149a
      family with sequence similarity 149, member A
      NCBIGene:212326

      <a href="https://identifiers.org/ENSEMBL:ENSMUSG000


\x01(\x08R\tencrypted\x12\x12\n\x04text\x18\x05\
    \x20\x01(\tR\x04text\x12\x12\n\x04data\x18\x06\x20\x01(\x0cR\x04data\"\
    \x8d\x01\n\x06Record\x12\x18\n\x07version\x18\x01\x20\x01(\x04R\x07versi\
    on\x12\x12\n\x04host\x18\x02\x20\x01(\tR\x04host\x12\x12\n\x04port\x18\
    \x03\x20\x01(\x04R\x04port\x12\x1b\n\tlast_seen\x18\x04\x20\x01(\x04R\
    \x08lastSeen\x12$\n\x0elast_seen_hash\x18\x05\x20\x01(\tR\x0clastSeenHas\
    h\"\x91\x01\n\x06Config\x12\x18\n\x07version\x18\x01\x20\x01(\x04R\x07ve\
    rsion\x12!\n\x0csecure_admin\x18\x02\x20\x01(\tR\x0bsecureAdmin\x12!\n\
    \x0csecure_group\x18\x03\x20\x01(\tR\x0bsecureGroup\x12'\n\x08services\
    \x18\x04\x20\x03(\x0b2\x0b.bc.ServiceR\x08services\"\x92\x01\n\tPutConfi\
    g\x12\x18\n\x07version\x18\x01\x20\x01(\x04R\x07version\x12\x14\n\x05adm\
    in\x18\x02\x20\x01(\x08R\x05admin\x12)\n\x10secure_signature\x18\x03\x20\
    \x01(\tR\x0fsecureSignature\x12*\n\x08services\x18\x04\x20\x03(\x0b2\x0e\
    .bc.PutServiceR\x08servicesb\x06proto3\
";

static mut file_descriptor_proto_lazy: ::protobuf::lazy::Lazy<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::lazy::Lazy {
    lock: ::protobuf::lazy::ONCE_INIT,
    ptr: 0 as *const ::protobuf::descriptor::FileDescriptorProto,
};

fn parse_descriptor_proto() -> ::protobuf::descriptor::FileDescriptorProto {
    ::protobuf::parse_from_bytes(file_descriptor_proto_data).unwrap()
}

pub fn file_descriptor_proto() -> &'static ::protobuf::descriptor::FileDescriptorProto {
    unsafe {
        file_descriptor_proto_lazy.get(|| {
            parse_descriptor_proto()
        })
    }
}
#![cfg(feature = "full")]

use crate::{
    process_instruction::BpfComputeBudget,
    transaction::{Transaction, TransactionError},
};
use borsh::{BorshDeserialize, BorshSchema, BorshSerialize};
use solana_sdk::{
    borsh::try_from_slice_unchecked,
    instruction::{Instruction, InstructionError},
};

crate::declare_id!("ComputeBudget111111111111111111111111111111");

const MAX_UNITS: u64 = 1_000_000;

/// Compute Budget Instructions
#[derive(
    Serialize,
    Deserialize,
    BorshSerialize,
    BorshDeserialize,
    BorshSchema,
    Debug,
    Clone,
    PartialEq,
    AbiExample,
    AbiEnumVisitor,
)]
pub enum ComputeBudgetInstruction {
    /// Request a specific maximum number of compute units the transaction is
    /// allowed to consume.
    RequestUnits(u64),
}

/// Create a `ComputeBudgetInstruction::RequestUnits` `Instruction`
pub fn request_units(units: u64) -> Instruction {
    Instruction::new_with_borsh(id(), &ComputeBudgetInstruction::RequestUnits(units), vec![])
}

pub fn process_request(
    compute_budget: &mut BpfComputeBudget,
    tx: &Transaction,
) -> Result<(), TransactionError> {
    let error = TransactionError::InstructionError(0, InstructionError::InvalidInstructionData);
    // Compute budget instruction must be in 1st or 2nd instruction (avoid nonce ma


0,0xff,0xdc,0xc4]
# CHECK-LE: xsminjdp 7, 63, 27                 # encoding: [0xc4,0xdc,0xff,0xf0]
            xsminjdp 7, 63, 27

# Vector Byte-Reverse H/W/D/Q Word
# CHECK-BE: xxbrh 7, 63                        # encoding: [0xf0,0xe7,0xff,0x6e]
# CHECK-LE: xxbrh 7, 63                        # encoding: [0x6e,0xff,0xe7,0xf0]
            xxbrh 7, 63
# CHECK-BE: xxbrw 7, 63                        # encoding: [0xf0,0xef,0xff,0x6e]
# CHECK-LE: xxbrw 7, 63                        # encoding: [0x6e,0xff,0xef,0xf0]
            xxbrw 7, 63
# CHECK-BE: xxbrd 7, 63                        # encoding: [0xf0,0xf7,0xff,0x6e]
# CHECK-LE: xxbrd 7, 63                        # encoding: [0x6e,0xff,0xf7,0xf0]
            xxbrd 7, 63
# CHECK-BE: xxbrq 7, 63                        # encoding: [0xf0,0xff,0xff,0x6e]
# CHECK-LE: xxbrq 7, 63                        # encoding: [0x6e,0xff,0xff,0xf0]
            xxbrq 7, 63

# Vector Permute
# CHECK-BE: xxperm 7, 63, 27                   # encoding: [0xf0,0xff,0xd8,0xd4]
# CHECK-LE: xxperm 7, 63, 27                   # encoding: [0xd4,0xd8,0xff,0xf0]
            xxperm 7, 63, 27
# CHECK-BE: xxpermr 7, 63, 27                  # encoding: [0xf0,0xff,0xd9,0xd4]
# CHECK-LE: xxpermr 7, 63, 27                  # encoding: [0xd4,0xd9,0xff,0xf0]
            xxpermr 7, 63, 27

# Vector Splat Immediate Byte
# CHECK-BE: xxspltib 63, 255                   # encoding: [0xf3,0xe7,0xfa,0xd1]
# CHECK-LE: xxspltib 63, 255                   # encoding: [0xd1,0xfa,0xe7,0xf3]
            xxspltib 63, 255

# Load/Store Vector, test maximum and minimum displacement value
# CHECK-BE: lxv 61, 32752(31)                  # encoding: [0xf7,0xbf,0x7f,0xf9]
# CHECK-LE: lxv 61, 32752(31)                  # encoding: [0xf9,0x7f,0xbf,0xf7]
            lxv 61, 32752(31)
# CHECK-BE: lxv 61, -32768(0)                  # encoding: [0xf7,0xa0,0x80,0x09]
# CHECK-LE: lxv 61, -32768(0)                  # encoding: [0x09,0x80,0xa0,0xf7]
            lxv 61, -32768(0)
# CHECK-BE: stxv 61, 32752(31)                 # encoding: [0xf7,0xbf,0x7f,0xfd]
# CHECK-LE: stxv 61, 32752(31)                 # encoding: [0xfd,0x7f,0xbf,0xf7]
            stxv 61, 32752(31)
# CHECK-BE: stxv 61, -32768(0)                 # encoding: [0xf7,0xa0,0x80,0x0d]
# CHECK-LE: stxv 61, -32768(0)                 # encoding: [0x0d,


 */
@font-face {
  font-family: 'Roboto';
  font-style: normal;
  font-weight: 400;
  src: local('Roboto'), local('Roboto-Regular'), url(https://fonts.gstatic.com/s/roboto/v18/KFOmCnqEu92Fr1Mu4WxKOzY.woff2) format('woff2');
  unicode-range: U+0370-03FF;
}
/* vietnamese */
@font-face {
  font-family: 'Roboto';
  font-style: normal;
  font-weight: 400;
  src: local('Roboto'), local('Roboto-Regular'), url(https://fonts.gstatic.com/s/roboto/v18/KFOmCnqEu92Fr1Mu7WxKOzY.woff2) format('woff2');
  unicode-range: U+0102-0103, U+0110-0111, U+1EA0-1EF9, U+20AB;
}
/* latin-ext */
@font-face {
  font-family: 'Roboto';
  font-style: normal;
  font-weight: 400;
  src: local('Roboto'), local('Roboto-Regular'), url(https://fonts.gstatic.com/s/roboto/v18/KFOmCnqEu92Fr1Mu7GxKOzY.woff2) format('woff2');
  unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* latin */
@font-face {
  font-family: 'Roboto';
  font-style: normal;
  font-weight: 400;
  src: local('Roboto'), local('Roboto-Regular'), url(https://fonts.gstatic.com/s/roboto/v18/KFOmCnqEu92Fr1Mu4mxK.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
body.material-dark, .material-dark #sb-header-text,
.material-dark .control-name, .material-dark .control-section,
.material-dark .sample-navigation,
.material-dark .sf-list .sf-list-li .sf-text-content,
.material-dark .sb-left-pane .sf-tree-expand-icon,
.material-dark .sb-left-pane .sf-tree-collapse-icon,
.material-dark .sb-left-pane .sf-tree-text,
.material-dark .sf-text-content, .material-dark .sb-sample-text,
.material-dark .sf-search-container .sf-list-li, .material-dark .sb-home-text,
.material-dark .property-section, .material-dark .sb-tab-content,
.material-dark .sb-notification-item .sf-clear-icon::before,
.material-dark .sf-search-no-data, .material-dark .github-logo::after,
.material-dark .sf-list-group-li > span, .material-dark .sb-notification-content,
.material-dark .sf-dropdown-input,
body.fabric-dark, .fabric-dark #sb-header-text,
.fabric-dark .control-name, .fabric-dark .control-section,
.fabric-dark .sample-navigation,
.fabric-dark .sf-list .sf-list-li .sf-text-content,
.fabric-dark .sb-left-pane .sf-tree-expand-icon,
.fabric-dark .sb-left-pane .sf-tree-collapse-icon,
.fabric-dark .sb-left-pane .sf-tree-text,
.fabric-dark .sf-text-content, .fabric-dark .sb-sample-text,
.fabric-dark .sf-search-container .sf-list-li, .fabric-dark .


he midway backend tests
grunt test # launch all the testsuite
```
## Fixtures

Fixtures can be configured in the fixtures folder and injected in the system using `grunt`:

``` sh
grunt fixtures
```

Note that this will override all the current configuration resources with the fixtures ones.

## Develop

Running `grunt dev` will start the server in development mode. Whenever you
make changes to server files, the server will be restarted. Make sure you have
started the `mongodb` and `redis` services beforehand.

### Updating files for distribution

`grunt` plugins are used to process files and generate distribution.
You will have to follow some rules to not break the distribution generation which are defined here.

#### Frontend

Any project frontend JS file which is under `frontend/js` and used in a web page must be placed between generator tags.
For example, in `frontend/views/meetings/index.pug` file:

``` html
// <!--build:js({.tmp,frontend}) meetings.js-->
script(src='/js/modules/user/user.js')
...
script(src='/js/meetings/app.js')
// <!--endbuild-->
```

The files placed between the two comment lines will be used to generate a `meetings.js` file (concatenate and minify all).

### Backend

All the files from backend are copied into the `dist/backend` folder without any change.

### Static files

These folders are pushed in the distribution:

- `config`
- `templates`

If you need to add more, you will have to change the `copy:dist` and `dist-files` tasks in `Gruntfile.js`

## Create a distribution

To create a distribution with clean environment, minified files and install production dependencies:

``` sh
grunt dist-all
cd dist
npm install --production
```

Then you can start the server with `npm start`, `node server`, or your favorite tool (Kudos to forever).

## Docker

Hubl.in is available on the Docker Hub as `linagora/hublin`, so you can pull it from there:

``` sh
docker pull linagora/hublin
```

Or you can build it from the current git repository

```
docker build -t linagora/hublin .
```

The `linagora/hublin` container is configured to get the mongodb connection from `mongodb://mongo:27017` URL. You can modify the `config/db.json` file and adapt to use your own instance, or continue to use Docker and use one of the solutions below.

### docker-compose

`docker-compose` allows to describe and run distributed applications (cf `docker-compose.yml` file).

You can launch Hublin with compose from the current directory:

``` sh
DOCKER_IP=<YOUR DOCKER IP> docker-compose up
```

Where `DOCKER_IP` is the public IP address where Docker services can be reached. This will be used by Janus to send back the right IP to Web clients (ICE candidates) so that they can communicate with Janus correctly.

### Janus with docker

The docker image configured for Janus is available on the Hub as `linagora/hublin:janus`.

``` sh
docker pull linagora/hublin:janus
```

Or you can build it from the current repository

``` sh
docker build -t linagora/hublin:janus -f Dockerfile.janus .
```

You can launch Hublin with Janus and all required services with Docker compose like:

``` sh
DOCKER_IP=<YOUR DOCKER IP> docker-compose -f docker-compose.yml -f docker-compose.janus.yml up
```

If you want to launch required services except Hublin container to start it on your own for development purposes for example, you can do:

```sh
DOCKER_IP=<YOUR DOCKER IP> docker-compose -f docker-compose


using System;
using System.Collections.Generic;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Windows.Forms;
using System.Text.RegularExpressions;
using Triggernometry.Variables;
using System.Runtime.InteropServices;
using System.Globalization;
using System.ComponentModel;

namespace Triggernometry.CustomControls
{
    public partial class ExpressionTextBox : UserControl
    {

        #region Autofill Text

        public static List<string> math = new List<string>()
        {
            // numeric const
            "pi", "π", "pi2", "pi05", "pi025", "pi0125", "pitorad", "piofrad",
            "phi", "major", "minor", "ETmin2sec", "semitone", "cent",

            // numeric func: basic
            "sqrt(x)", "pow(x, y)", "root(x, y)", "exp(x)", "log(x, base=e)",
            "abs(x)", "sign(x)", "rem(x, y)", "mod(x, y)", "random(start, end)",
            "truncate(x)", "floor(x)", "ceiling(x)", "round(x, digits=0)",
            "max(...)", "min(...)", "or(...)", "and(...)", "if(condition, trueVal, falseVal)",

            // numeric func: trigonometric
            "sin(x)", "cos(x)", "tan(x)", "cot(x)", "cotan(x)", "sec(x)", "csc(x)", "cosec(x)",
            "arcsin(x)", "arccos(x)", "arctan(x)", "atan2(x, y)", "arctan2(x, y)",
            "sinh(x)", "cosh(x)", "tanh(x)",

            // numeric func: distance
            "distance(x0, y0, x1, y1)", "distance(x0, y0, z0..., x1, y1, z1...)",
            "d(x0, y0, x1, y1)", "d(x0, y0, z0..., x1, y1, z1...)",
            "l1d(x0, y0, z0..., x1, y1, z1...)", "l∞d(x0, y0, z0..., x1, y1, z1...)",
            "manhattandistance(x0, y0, z0..., x1, y1, z1...)", "chebyshevdistance(x0, y0, z0..., x1, y1, z1...)",
            "projd(srcX, srcY, θ, tgtX, tgtY)", "projh(srcX, srcY, θ, tgtX, tgtY)", "ispointinray(srcX, srcY, θ, width, tgtX, tgtY)",
            "projectdistance(srcX, srcY, θ, tgtX, tgtY)", "projectheight(srcX, srcY, θ, tgtX, tgtY)",

            // numeric func: angle
            "radtodeg(rad)", "degtorad(deg)",
            "angle(srcX, srcY, tgtX, tgtY)", "θ(srcX, srcY, tgtX, tgtY)", "relangle(srcθ, tgtθ)", "relθ(srcθ, tgtθ)",
            "roundir(θ, ±n, digits=0)", "roundvec(dx, dy, ±n, digits=0)", "dir2rad(direction, ±n)",
            "isanglebetween(θ, minθ, maxθ)", "isθbetween(θ, minθ, maxθ)",

            // numeric string func
            "hex2dec(hex)", "hex2float(hex)", "hex2double(hex)", "X8float(hex)", "parsedmg(hex)", "len(alphanumstr)",
            "freq(note, semitones=0)", "nextETms(XX:XX)", "nextETms(ETmin)",
        };

        public static List<string> prefixes = new List<string>() // right after "${"
        {
            "numeric:", "n:", "string:", "s:", "func:", "f:",
            "var:", "pvar:", "evar:", "epvar:", "v:", "pv:", "ev:", "epv:",
            "lvar:", "plvar:", "elvar:", "


eOnDiskRecord {
    len: usize,
    has_next: bool,
    next_location: u64,
    bytes: Vec<u8>,
}

fn binerrfrom(e: Box<bincode::ErrorKind>) -> io::Error {
    match *e {
        bincode::ErrorKind::Io(e1) => e1,
        e1 @ _ => io::Error::new(io::ErrorKind::Other, format!("{:?}", e1)),
    }
}

impl ProxyTraceOnDiskRecord {
    // i don't normally structure it like that
    fn write<W: io::Write>(&self, b: &mut W) -> io::Result<u64> {
        let sz = bincode::serialized_size(self).map_err(binerrfrom)?;
        bincode::serialize_into(b, self)
            .map(|_| sz)
            .map_err(binerrfrom)
    }
}

#[derive(Debug, PartialEq, Deserialize, Serialize)]
struct ProxyTraceRecord {
    id: String,
    timestamp: u64,
    payload: TraceRecordPayload,
}

impl ProxyTraceRecord {
    fn request_line(id: &str, ts: u64, method: &str, uri: &str, version: &str) -> ProxyTraceRecord {
        ProxyTraceRecord {
            id: String::from(id),
            timestamp: ts,
            payload: TraceRecordPayload::RequestLine(
                String::from(method),
                String::from(uri),
                String::from(version),
            ),
        }
    }

    fn body(id: &str, ts: u64, chunk: Vec<u8>, last_chunk: bool) -> ProxyTraceRecord {
        ProxyTraceRecord {
            id: String::from(id),
            timestamp: ts,
            payload: TraceRecordPayload::Body {
                chunk: chunk,
                is_final: last_chunk,
            },
        }
    }
}

#[derive(Debug, PartialEq, Deserialize, Serialize)]
pub enum TraceRecordPayload {
    /** Open a tracing stream for request_id */
    BeginTrace(String),
    /** These are very HTTP/1 focused, refactor when I really look at http/2 support */
    RequestLine(String, String, String),
    ResponseLine(String, String, String),
    // TODO(matt) - trailers, chunk headers, etc
    Headers(Vec<(String, String)>),
    /** A chunk of the body and a mark if this is the last chunk */
    Body {
        chunk: Vec<u8>,
        is_final: bool,
    },
}

struct ProxyTraceRecordRequestIndexRecord {
    request_id: String,
    start_time: u64,
    method: String,
    url: String,
    known_status_codes: Vec<u16>,
    request_line: ProxyTraceRecordLocation,
    headers: ProxyTraceRecordLocation,
    body_start: ProxyTraceRecordLocation,
}

struct ProxyTraceRecordResponseIndexRecord {
    response_id: String,
    related_request: String,
    start_time: u64,
    status_code: u16,
    status_line: ProxyTraceRecordLocation,
    headers: ProxyTraceRecordLocation,
    body_start: ProxyTraceRecordLocation,
}

#[test]
fn test_basic_wr() {
    let tmp_dir = TempDir::new("rrdbtest").expect("success");
    let mut ds =
        ProxyTraceDatastoreWriter::new(tmp_dir.path().to_str().expect("dir not ok")).expect("Ok");

    let rl = ProxyTraceRecord::request_line(
        "abc",
        1,
        "GET",
        "http://foo.bar.com/blah/blah/",
        "HTTP/1.1",
    );
    let loc1 = ds.output_record(&rl).expect("is ok");
    assert_eq!(loc1.location, 0);

    let r2 = ProxyTraceRecord::request_line(
        "abc2",
        2,
        "GET",
        "http://foo.bar.com/blah/blah/",
        "HTTP/1.1",
    );


 st.storage().ExpandPaths(hf.Path)
		if err != nil {
			return nil, err
		}
		if len(matches) == 0 {
			err := fmt.Errorf("no matches for path: %s", hf.Path)
			if *st.getMissingFileHandler() == "Error" {
				return nil, err
			}
			st.logger.Warnf("no matches for path: %s", hf.Path)
			continue
		}
		for _, match := range matches {
			newHelmfile := hf
			newHelmfile.Path = match
			helmfiles = append(helmfiles, newHelmfile)
		}
	}

	return helmfiles, nil
}

func (st *HelmState) removeFiles(files []string) {
	dirsToClean := map[string]int{}
	for _, f := range files {
		dirsToClean[filepath.Dir(f)] = 1
		if err := st.fs.DeleteFile(f); err != nil {
			st.logger.Warnf("Removing %s: %v", f, err)
		} else {
			st.logger.Debugf("Removed %s", f)
		}
	}
	for d := range dirsToClean {
		// check if the directory is empty
		des, err := st.fs.ReadDir(d)
		if err != nil {
			st.logger.Warnf("Reading dir %s: %v", d, err)
			continue
		}

		if len(des) > 0 {
			st.logger.Debugf("Not removing %s because it's not empty", d)
			continue
		}

		if err := st.fs.DeleteFile(d); err != nil {
			st.logger.Warnf("Removing %s: %v", d, err)
		} else {
			st.logger.Debugf("Removed %s", d)
		}
	}
}

func (c *MissingFileHandlerConfig) resolveFileOptions() []resolveFileOption {
	if c == nil {
		return []resolveFileOption{
			ignoreMissingGitBranch(false),
		}
	}
	return []resolveFileOption{
		ignoreMissingGitBranch(c.IgnoreMissingGitBranch),
	}
}

// getReleaseMissingFileHandlerConfig returns the first non-nil MissingFileHandlerConfig in the following order:
// - release.MissingFileHandlerConfig
// - st.MissingFileHandlerConfig
func (st *HelmState) getReleaseMissingFileHandlerConfig(release *ReleaseSpec) *MissingFileHandlerConfig {
	switch {
	case release.MissingFileHandlerConfig != nil:
		return release.MissingFileHandlerConfig
	case st.MissingFileHandlerConfig != nil:
		return st.MissingFileHandlerConfig
	default:
		return nil
	}
}

// getReleaseMissingFileHandler returns the first non-nil MissingFileHandler in the following order:
// - release.MissingFileHandler
// - st.MissingFileHandler
// - "Error"
func (st *HelmState) getReleaseMissingFileHandler(release *ReleaseSpec) *string {
	defaultMissingFileHandler := "Error"
	switch {
	case release.MissingFileHandler != nil:
		return release.MissingFileHandler
	case st.MissingFileHandler != nil:
		return st.MissingFileHandler
	default:
		return &defaultMissingFileHandler
	}
}

// getMissingFileHandler returns the first non-nil MissingFileHandler in the following order:
// - st.MissingFileHandler
// - "Error"
func (st *HelmState) getMissingFileHandler() *string {
	defaultMissingFileHandler := "Error"
	switch {
	case st.MissingFileHandler != nil:
		return st.MissingFileHandler
	default:
		return &defaultMissingFileHandler
	}
}

func (st *HelmState) generateTemporaryReleaseValuesFiles(release *ReleaseSpec, values []any) ([]string, error) {
	generatedFiles := []string{}

	for _, value := range values {
		switch typedValue := value.(type) {
		case string:
			paths, skip, err := st.storage().resolveFile(st.getReleaseMissingFileHandler(release), "values", typedValue, st.getReleaseMissingFileHandlerConfig


 typeof(string),
                true,
                "default value",
                "a description",
                directives);

            var newParentField = Substitute.For<ISchemaItem>();
            newParentField.Route.Returns(new SchemaItemPath("[type]/GraphType2/Field1"));
            newParentField.Name.Returns("Field1");

            var clonedArg = arg.Clone(newParentField) as GraphFieldArgument;

            Assert.AreEqual(arg.Name, clonedArg.Name);
            Assert.AreEqual(arg.Description, clonedArg.Description);
            Assert.AreEqual(arg.DefaultValue, clonedArg.DefaultValue);
            Assert.AreEqual(arg.ObjectType, clonedArg.ObjectType);
            Assert.AreEqual(arg.InternalName, clonedArg.InternalName);
            Assert.AreEqual(arg.ArgumentModifiers, clonedArg.ArgumentModifiers);
            Assert.AreEqual(arg.TypeExpression, clonedArg.TypeExpression);
            Assert.AreEqual(arg.ParameterName, clonedArg.ParameterName);
            Assert.AreEqual(arg.AppliedDirectives.Count, arg.AppliedDirectives.Count);

            Assert.IsFalse(object.ReferenceEquals(arg.AppliedDirectives, clonedArg.AppliedDirectives));
            Assert.IsFalse(object.ReferenceEquals(arg.Parent, clonedArg.Parent));
            Assert.IsFalse(object.ReferenceEquals(arg.TypeExpression, clonedArg.TypeExpression));
        }
    }
}