@mborecki/sliding-puzzle 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/app-globals-V2Kpy_OQ.js +5 -0
- package/dist/cjs/index-C425pVBv.js +3053 -0
- package/dist/cjs/index.cjs.js +2 -0
- package/dist/cjs/loader.cjs.js +13 -0
- package/dist/cjs/mb-sliding-puzzle.cjs.entry.js +170 -0
- package/dist/cjs/sliding-puzzle.cjs.js +25 -0
- package/dist/collection/collection-manifest.json +12 -0
- package/dist/collection/components/sliding-puzzle/sliding-puzzle.css +25 -0
- package/dist/collection/components/sliding-puzzle/sliding-puzzle.js +119 -0
- package/dist/collection/components/sliding-puzzle/types.js +1 -0
- package/dist/collection/index.js +1 -0
- package/dist/components/index.d.ts +35 -0
- package/dist/components/index.js +1 -0
- package/dist/components/mb-sliding-puzzle.d.ts +11 -0
- package/dist/components/mb-sliding-puzzle.js +1 -0
- package/dist/esm/app-globals-DQuL1Twl.js +3 -0
- package/dist/esm/index-CoGw-MK9.js +3047 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/loader.js +11 -0
- package/dist/esm/mb-sliding-puzzle.entry.js +168 -0
- package/dist/esm/sliding-puzzle.js +21 -0
- package/dist/index.cjs.js +1 -0
- package/dist/index.js +1 -0
- package/dist/sliding-puzzle/index.esm.js +0 -0
- package/dist/sliding-puzzle/p-CoGw-MK9.js +2 -0
- package/dist/sliding-puzzle/p-DQuL1Twl.js +1 -0
- package/dist/sliding-puzzle/p-a6576773.entry.js +1 -0
- package/dist/sliding-puzzle/sliding-puzzle.esm.js +1 -0
- package/dist/types/components/sliding-puzzle/sliding-puzzle.d.ts +11 -0
- package/dist/types/components/sliding-puzzle/types.d.ts +10 -0
- package/dist/types/components.d.ts +48 -0
- package/dist/types/index.d.ts +10 -0
- package/dist/types/roboczy/mb-puzzle/apps/sliding-puzzle/.stencil/apps/sliding-puzzle/vitest.config.d.ts +2 -0
- package/dist/types/roboczy/mb-puzzle/apps/sliding-puzzle/.stencil/shared/grid/src/grid.d.ts +14 -0
- package/dist/types/roboczy/mb-puzzle/apps/sliding-puzzle/.stencil/shared/grid/vitest.config.d.ts +2 -0
- package/dist/types/roboczy/mb-puzzle/apps/sliding-puzzle/.stencil/shared/vec2/src/vec2.d.ts +24 -0
- package/dist/types/roboczy/mb-puzzle/apps/sliding-puzzle/.stencil/shared/vec2/src/vec2.test.d.ts +1 -0
- package/dist/types/roboczy/mb-puzzle/apps/sliding-puzzle/.stencil/shared/vec2/vitest.config.d.ts +2 -0
- package/dist/types/stencil-public-runtime.d.ts +1839 -0
- package/dist/vitest.config.js +4 -0
- package/loader/cdn.js +1 -0
- package/loader/index.cjs.js +1 -0
- package/loader/index.d.ts +24 -0
- package/loader/index.es2017.js +1 -0
- package/loader/index.js +2 -0
- package/package.json +53 -0
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var index = require('./index-C425pVBv.js');
|
|
4
|
+
var appGlobals = require('./app-globals-V2Kpy_OQ.js');
|
|
5
|
+
|
|
6
|
+
const defineCustomElements = async (win, options) => {
|
|
7
|
+
if (typeof window === 'undefined') return undefined;
|
|
8
|
+
await appGlobals.globalScripts();
|
|
9
|
+
return index.bootstrapLazy([["mb-sliding-puzzle.cjs",[[513,"mb-sliding-puzzle",{"tiles":[1040],"size":[32],"checkAnswer":[64]}]]]], options);
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
exports.setNonce = index.setNonce;
|
|
13
|
+
exports.defineCustomElements = defineCustomElements;
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var index = require('./index-C425pVBv.js');
|
|
4
|
+
|
|
5
|
+
class Vec2 {
|
|
6
|
+
x;
|
|
7
|
+
y;
|
|
8
|
+
get 0() {
|
|
9
|
+
return this.x;
|
|
10
|
+
}
|
|
11
|
+
set 0(x) {
|
|
12
|
+
this.x = x;
|
|
13
|
+
}
|
|
14
|
+
get 1() {
|
|
15
|
+
return this.y;
|
|
16
|
+
}
|
|
17
|
+
set 1(y) {
|
|
18
|
+
this.y = y;
|
|
19
|
+
}
|
|
20
|
+
get width() {
|
|
21
|
+
return this.x;
|
|
22
|
+
}
|
|
23
|
+
set width(x) {
|
|
24
|
+
this.x = x;
|
|
25
|
+
}
|
|
26
|
+
get height() {
|
|
27
|
+
return this.y;
|
|
28
|
+
}
|
|
29
|
+
set height(y) {
|
|
30
|
+
this.y = y;
|
|
31
|
+
}
|
|
32
|
+
get xy() {
|
|
33
|
+
return [this.x, this.y];
|
|
34
|
+
}
|
|
35
|
+
*[Symbol.iterator]() {
|
|
36
|
+
yield this.x;
|
|
37
|
+
yield this.y;
|
|
38
|
+
}
|
|
39
|
+
constructor(x, y) {
|
|
40
|
+
this.x = x;
|
|
41
|
+
this.y = y;
|
|
42
|
+
}
|
|
43
|
+
add(v) {
|
|
44
|
+
return new Vec2(this.x + v.x, this.y + v.y);
|
|
45
|
+
}
|
|
46
|
+
eq(v) {
|
|
47
|
+
return this.x === v.x && this.y === v.y;
|
|
48
|
+
}
|
|
49
|
+
clone() {
|
|
50
|
+
return new Vec2(this.x, this.y);
|
|
51
|
+
}
|
|
52
|
+
static from(source) {
|
|
53
|
+
if (typeof source === 'number') {
|
|
54
|
+
return new Vec2(source, source);
|
|
55
|
+
}
|
|
56
|
+
if (Array.isArray(source)) {
|
|
57
|
+
return new Vec2(source[0] ?? 0, source[1] ?? 0);
|
|
58
|
+
}
|
|
59
|
+
if (typeof source === 'object' && typeof source.x === 'number' && typeof source.y === 'number') {
|
|
60
|
+
return new Vec2(source.x, source.y);
|
|
61
|
+
}
|
|
62
|
+
throw new Error('Wrong Vec2 source');
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
class Grid {
|
|
67
|
+
size;
|
|
68
|
+
constructor(size) {
|
|
69
|
+
if (size.x <= 0 || size.y <= 0) {
|
|
70
|
+
throw new Error(`Invalid grid size: width and height must be positive (got ${size.x}x${size.y})`);
|
|
71
|
+
}
|
|
72
|
+
this.size = size;
|
|
73
|
+
}
|
|
74
|
+
getIndexFromVec(v) {
|
|
75
|
+
return Grid.getIndexFromVec(v, this.size.width);
|
|
76
|
+
}
|
|
77
|
+
getVecFromIndex(index) {
|
|
78
|
+
return Grid.getVecFromIndex(index, this.size.width);
|
|
79
|
+
}
|
|
80
|
+
isBlack(v) {
|
|
81
|
+
return Boolean((v.x + v.y) % 2);
|
|
82
|
+
}
|
|
83
|
+
isWhite(v) {
|
|
84
|
+
return !Boolean((v.x + v.y) % 2);
|
|
85
|
+
}
|
|
86
|
+
isInGrid(v) {
|
|
87
|
+
return Grid.isInGrid(v, this.size);
|
|
88
|
+
}
|
|
89
|
+
static getVecFromIndex(index, width) {
|
|
90
|
+
const _w = width instanceof Vec2 ? width.width : width;
|
|
91
|
+
const x = index % _w;
|
|
92
|
+
const y = Math.floor(index / _w);
|
|
93
|
+
return new Vec2(x, y);
|
|
94
|
+
}
|
|
95
|
+
static getIndexFromVec(v, width) {
|
|
96
|
+
const _w = width instanceof Vec2 ? width.width : width;
|
|
97
|
+
return v.y * _w + v.x;
|
|
98
|
+
}
|
|
99
|
+
static isInGrid(v, size) {
|
|
100
|
+
return v.x >= 0 && size.x > v.x && v.y >= 0 && size.y > v.y;
|
|
101
|
+
}
|
|
102
|
+
static getOrtoSiblings(v, size) {
|
|
103
|
+
const dirs = [
|
|
104
|
+
new Vec2(-1, 0),
|
|
105
|
+
new Vec2(1, 0),
|
|
106
|
+
new Vec2(0, -1),
|
|
107
|
+
new Vec2(0, 1),
|
|
108
|
+
];
|
|
109
|
+
return dirs.map(d => d.add(v))
|
|
110
|
+
.filter(v => Grid.isInGrid(v, size));
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
const slidingPuzzleCss = () => `.board{width:100%;height:100%;display:inline-block;aspect-ratio:calc(var(--width, 1) / var(--height, 1));border:1px solid black;position:relative;container-type:size}.tile{position:absolute;width:calc(100cqw / var(--width, 1));height:calc(100cqh / var(--height, 1));padding:0;border:none;transform:translate(calc(100% * var(--x)), calc(100% * var(--y)));transition:transform 0.5s}.tile img{display:block;width:100%;height:100%;pointer-events:none}`;
|
|
115
|
+
|
|
116
|
+
const MbSlidingPuzzle = class {
|
|
117
|
+
constructor(hostRef) {
|
|
118
|
+
index.registerInstance(this, hostRef);
|
|
119
|
+
}
|
|
120
|
+
size = new Vec2(3, 3);
|
|
121
|
+
tiles = [];
|
|
122
|
+
async checkAnswer() {
|
|
123
|
+
return this.tiles.every(t => t.position === t.correctPosition);
|
|
124
|
+
}
|
|
125
|
+
getTileById(id) {
|
|
126
|
+
const tile = this.tiles.find(t => t.id === id);
|
|
127
|
+
if (!tile) {
|
|
128
|
+
throw new Error('Tile not found');
|
|
129
|
+
}
|
|
130
|
+
return tile;
|
|
131
|
+
}
|
|
132
|
+
onTileClicked(id) {
|
|
133
|
+
const tile = this.getTileById(id);
|
|
134
|
+
const v = Grid.getVecFromIndex(tile.position, this.size.width);
|
|
135
|
+
const siblings = Grid.getOrtoSiblings(v, this.size);
|
|
136
|
+
const emptySibling = siblings.find(v => {
|
|
137
|
+
const index = Grid.getIndexFromVec(v, this.size.width);
|
|
138
|
+
return this.tiles.every(t => t.position !== index);
|
|
139
|
+
});
|
|
140
|
+
if (emptySibling) {
|
|
141
|
+
this.setTilePosition(tile, Grid.getIndexFromVec(emptySibling, this.size));
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
setTilePosition(tile, position) {
|
|
145
|
+
const id = typeof tile === 'string' ? tile : tile.id;
|
|
146
|
+
this.tiles = this.tiles.map(t => {
|
|
147
|
+
if (t.id !== id)
|
|
148
|
+
return t;
|
|
149
|
+
return {
|
|
150
|
+
...t,
|
|
151
|
+
position
|
|
152
|
+
};
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
render() {
|
|
156
|
+
return index.h("div", { key: 'b22497e26d2ce6f7aeadc788f9475bb9fcd92e76', class: "board", style: {
|
|
157
|
+
'--width': `${this.size.width}`,
|
|
158
|
+
'--height': `${this.size.height}`,
|
|
159
|
+
} }, this.tiles.map(tile => {
|
|
160
|
+
const v = Grid.getVecFromIndex(tile.position, this.size.width);
|
|
161
|
+
return index.h("button", { key: tile.id, class: "tile", style: {
|
|
162
|
+
'--x': `${v.x}`,
|
|
163
|
+
'--y': `${v.y}`
|
|
164
|
+
}, onClick: this.onTileClicked.bind(this, tile.id) }, index.h("img", { src: tile.imageSrc, alt: "" }));
|
|
165
|
+
}));
|
|
166
|
+
}
|
|
167
|
+
};
|
|
168
|
+
MbSlidingPuzzle.style = slidingPuzzleCss();
|
|
169
|
+
|
|
170
|
+
exports.mb_sliding_puzzle = MbSlidingPuzzle;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var index = require('./index-C425pVBv.js');
|
|
4
|
+
var appGlobals = require('./app-globals-V2Kpy_OQ.js');
|
|
5
|
+
|
|
6
|
+
var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
|
|
7
|
+
/*
|
|
8
|
+
Stencil Client Patch Browser v4.41.0 | MIT Licensed | https://stenciljs.com
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
var patchBrowser = () => {
|
|
12
|
+
const importMeta = (typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('sliding-puzzle.cjs.js', document.baseURI).href));
|
|
13
|
+
const opts = {};
|
|
14
|
+
if (importMeta !== "") {
|
|
15
|
+
opts.resourcesUrl = new URL(".", importMeta).href;
|
|
16
|
+
}
|
|
17
|
+
return index.promiseResolve(opts);
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
patchBrowser().then(async (options) => {
|
|
21
|
+
await appGlobals.globalScripts();
|
|
22
|
+
return index.bootstrapLazy([["mb-sliding-puzzle.cjs",[[513,"mb-sliding-puzzle",{"tiles":[1040],"size":[32],"checkAnswer":[64]}]]]], options);
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
exports.setNonce = index.setNonce;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
.board {
|
|
2
|
+
width: 100%;
|
|
3
|
+
height: 100%;
|
|
4
|
+
display: inline-block;
|
|
5
|
+
aspect-ratio: calc(var(--width, 1) / var(--height, 1));
|
|
6
|
+
border: 1px solid black;
|
|
7
|
+
position: relative;
|
|
8
|
+
container-type: size;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.tile {
|
|
12
|
+
position: absolute;
|
|
13
|
+
width: calc(100cqw / var(--width, 1));
|
|
14
|
+
height: calc(100cqh / var(--height, 1));
|
|
15
|
+
padding: 0;
|
|
16
|
+
border: none;
|
|
17
|
+
transform: translate(calc(100% * var(--x)), calc(100% * var(--y)));
|
|
18
|
+
transition: transform 0.5s;
|
|
19
|
+
}
|
|
20
|
+
.tile img {
|
|
21
|
+
display: block;
|
|
22
|
+
width: 100%;
|
|
23
|
+
height: 100%;
|
|
24
|
+
pointer-events: none;
|
|
25
|
+
}
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { h } from "@stencil/core";
|
|
2
|
+
import { Vec2 } from "@mb-puzzle/vec2";
|
|
3
|
+
import { Grid } from "@mb-puzzle/grid";
|
|
4
|
+
export class MbSlidingPuzzle {
|
|
5
|
+
size = new Vec2(3, 3);
|
|
6
|
+
tiles = [];
|
|
7
|
+
async checkAnswer() {
|
|
8
|
+
return this.tiles.every(t => t.position === t.correctPosition);
|
|
9
|
+
}
|
|
10
|
+
getTileById(id) {
|
|
11
|
+
const tile = this.tiles.find(t => t.id === id);
|
|
12
|
+
if (!tile) {
|
|
13
|
+
throw new Error('Tile not found');
|
|
14
|
+
}
|
|
15
|
+
return tile;
|
|
16
|
+
}
|
|
17
|
+
onTileClicked(id) {
|
|
18
|
+
const tile = this.getTileById(id);
|
|
19
|
+
const v = Grid.getVecFromIndex(tile.position, this.size.width);
|
|
20
|
+
const siblings = Grid.getOrtoSiblings(v, this.size);
|
|
21
|
+
const emptySibling = siblings.find(v => {
|
|
22
|
+
const index = Grid.getIndexFromVec(v, this.size.width);
|
|
23
|
+
return this.tiles.every(t => t.position !== index);
|
|
24
|
+
});
|
|
25
|
+
if (emptySibling) {
|
|
26
|
+
this.setTilePosition(tile, Grid.getIndexFromVec(emptySibling, this.size));
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
setTilePosition(tile, position) {
|
|
30
|
+
const id = typeof tile === 'string' ? tile : tile.id;
|
|
31
|
+
this.tiles = this.tiles.map(t => {
|
|
32
|
+
if (t.id !== id)
|
|
33
|
+
return t;
|
|
34
|
+
return {
|
|
35
|
+
...t,
|
|
36
|
+
position
|
|
37
|
+
};
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
render() {
|
|
41
|
+
return h("div", { key: 'b22497e26d2ce6f7aeadc788f9475bb9fcd92e76', class: "board", style: {
|
|
42
|
+
'--width': `${this.size.width}`,
|
|
43
|
+
'--height': `${this.size.height}`,
|
|
44
|
+
} }, this.tiles.map(tile => {
|
|
45
|
+
const v = Grid.getVecFromIndex(tile.position, this.size.width);
|
|
46
|
+
return h("button", { key: tile.id, class: "tile", style: {
|
|
47
|
+
'--x': `${v.x}`,
|
|
48
|
+
'--y': `${v.y}`
|
|
49
|
+
}, onClick: this.onTileClicked.bind(this, tile.id) }, h("img", { src: tile.imageSrc, alt: "" }));
|
|
50
|
+
}));
|
|
51
|
+
}
|
|
52
|
+
static get is() { return "mb-sliding-puzzle"; }
|
|
53
|
+
static get encapsulation() { return "shadow"; }
|
|
54
|
+
static get originalStyleUrls() {
|
|
55
|
+
return {
|
|
56
|
+
"$": ["sliding-puzzle.scss"]
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
static get styleUrls() {
|
|
60
|
+
return {
|
|
61
|
+
"$": ["sliding-puzzle.css"]
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
static get properties() {
|
|
65
|
+
return {
|
|
66
|
+
"tiles": {
|
|
67
|
+
"type": "unknown",
|
|
68
|
+
"mutable": true,
|
|
69
|
+
"complexType": {
|
|
70
|
+
"original": "TileData[]",
|
|
71
|
+
"resolved": "TileData[]",
|
|
72
|
+
"references": {
|
|
73
|
+
"TileData": {
|
|
74
|
+
"location": "import",
|
|
75
|
+
"path": "./types",
|
|
76
|
+
"id": "src/components/sliding-puzzle/types.ts::TileData",
|
|
77
|
+
"referenceLocation": "TileData"
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
"required": false,
|
|
82
|
+
"optional": false,
|
|
83
|
+
"docs": {
|
|
84
|
+
"tags": [],
|
|
85
|
+
"text": ""
|
|
86
|
+
},
|
|
87
|
+
"getter": false,
|
|
88
|
+
"setter": false,
|
|
89
|
+
"defaultValue": "[]"
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
static get states() {
|
|
94
|
+
return {
|
|
95
|
+
"size": {}
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
static get methods() {
|
|
99
|
+
return {
|
|
100
|
+
"checkAnswer": {
|
|
101
|
+
"complexType": {
|
|
102
|
+
"signature": "() => Promise<boolean>",
|
|
103
|
+
"parameters": [],
|
|
104
|
+
"references": {
|
|
105
|
+
"Promise": {
|
|
106
|
+
"location": "global",
|
|
107
|
+
"id": "global::Promise"
|
|
108
|
+
}
|
|
109
|
+
},
|
|
110
|
+
"return": "Promise<boolean>"
|
|
111
|
+
},
|
|
112
|
+
"docs": {
|
|
113
|
+
"text": "",
|
|
114
|
+
"tags": []
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Get the base path to where the assets can be found. Use "setAssetPath(path)"
|
|
3
|
+
* if the path needs to be customized.
|
|
4
|
+
*/
|
|
5
|
+
export declare const getAssetPath: (path: string) => string;
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Used to manually set the base path where assets can be found.
|
|
9
|
+
* If the script is used as "module", it's recommended to use "import.meta.url",
|
|
10
|
+
* such as "setAssetPath(import.meta.url)". Other options include
|
|
11
|
+
* "setAssetPath(document.currentScript.src)", or using a bundler's replace plugin to
|
|
12
|
+
* dynamically set the path at build time, such as "setAssetPath(process.env.ASSET_PATH)".
|
|
13
|
+
* But do note that this configuration depends on how your script is bundled, or lack of
|
|
14
|
+
* bundling, and where your assets can be loaded from. Additionally custom bundling
|
|
15
|
+
* will have to ensure the static assets are copied to its build directory.
|
|
16
|
+
*/
|
|
17
|
+
export declare const setAssetPath: (path: string) => void;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Used to specify a nonce value that corresponds with an application's CSP.
|
|
21
|
+
* When set, the nonce will be added to all dynamically created script and style tags at runtime.
|
|
22
|
+
* Alternatively, the nonce value can be set on a meta tag in the DOM head
|
|
23
|
+
* (<meta name="csp-nonce" content="{ nonce value here }" />) which
|
|
24
|
+
* will result in the same behavior.
|
|
25
|
+
*/
|
|
26
|
+
export declare const setNonce: (nonce: string) => void
|
|
27
|
+
|
|
28
|
+
export interface SetPlatformOptions {
|
|
29
|
+
raf?: (c: FrameRequestCallback) => number;
|
|
30
|
+
ael?: (el: EventTarget, eventName: string, listener: EventListenerOrEventListenerObject, options: boolean | AddEventListenerOptions) => void;
|
|
31
|
+
rel?: (el: EventTarget, eventName: string, listener: EventListenerOrEventListenerObject, options: boolean | AddEventListenerOptions) => void;
|
|
32
|
+
}
|
|
33
|
+
export declare const setPlatformOptions: (opts: SetPlatformOptions) => void;
|
|
34
|
+
|
|
35
|
+
export * from '../types';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var t,e,i,n,s,r,o,l,h,f,c,u,a,p,d,v,m,w=Object.create,b=Object.defineProperty,g=Object.getOwnPropertyDescriptor,$=Object.getOwnPropertyNames,y=Object.getPrototypeOf,O=Object.prototype.hasOwnProperty,j=t=>{throw TypeError(t)},S=(t,e)=>function(){return e||(0,t[$(t)[0]])((e={exports:{}}).exports,e),e.exports},E=(t,e,i)=>e.has(t)||j("Cannot "+i),M=(t,e,i)=>(E(t,e,"read from private field"),i?i.call(t):e.get(t)),k=(t,e,i)=>e.has(t)?j("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,i),x=(t,e,i)=>(E(t,e,"write to private field"),e.set(t,i),i),N=(t,e,i)=>(E(t,e,"access private method"),i),P=S({"node_modules/balanced-match/index.js"(t,e){function i(t,e,i){t instanceof RegExp&&(t=n(t,i)),e instanceof RegExp&&(e=n(e,i));var r=s(t,e,i);return r&&{start:r[0],end:r[1],pre:i.slice(0,r[0]),body:i.slice(r[0]+t.length,r[1]),post:i.slice(r[1]+e.length)}}function n(t,e){var i=e.match(t);return i?i[0]:null}function s(t,e,i){var n,s,r,o,l,h=i.indexOf(t),f=i.indexOf(e,h+1),c=h;if(h>=0&&f>0){if(t===e)return[h,f];for(n=[],r=i.length;c>=0&&!l;)c==h?(n.push(c),h=i.indexOf(t,c+1)):1==n.length?l=[n.pop(),f]:((s=n.pop())<r&&(r=s,o=f),f=i.indexOf(e,c+1)),c=h<f&&h>=0?h:f;n.length&&(l=[r,o])}return l}e.exports=i,i.range=s}}),W=S({"node_modules/brace-expansion/index.js"(t,e){var i=P();e.exports=function(t){return t?("{}"===t.substr(0,2)&&(t="\\{\\}"+t.substr(2)),v(function(t){return t.split("\\\\").join(n).split("\\{").join(s).split("\\}").join(r).split("\\,").join(o).split("\\.").join(l)}(t),!0).map(f)):[]};var n="\0SLASH"+Math.random()+"\0",s="\0OPEN"+Math.random()+"\0",r="\0CLOSE"+Math.random()+"\0",o="\0COMMA"+Math.random()+"\0",l="\0PERIOD"+Math.random()+"\0";function h(t){return parseInt(t,10)==t?parseInt(t,10):t.charCodeAt(0)}function f(t){return t.split(n).join("\\").split(s).join("{").split(r).join("}").split(o).join(",").split(l).join(".")}function c(t){if(!t)return[""];var e=[],n=i("{","}",t);if(!n)return t.split(",");var s=n.body,r=n.post,o=n.pre.split(",");o[o.length-1]+="{"+s+"}";var l=c(r);return r.length&&(o[o.length-1]+=l.shift(),o.push.apply(o,l)),e.push.apply(e,o),e}function u(t){return"{"+t+"}"}function a(t){return/^-?0\d/.test(t)}function p(t,e){return t<=e}function d(t,e){return t>=e}function v(t,e){var n=[],s=i("{","}",t);if(!s)return[t];var o=s.pre,l=s.post.length?v(s.post,!1):[""];if(/\$$/.test(s.pre))for(var f=0;f<l.length;f++)n.push(z=o+"{"+s.body+"}"+l[f]);else{var m,w,b=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(s.body),g=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(s.body),$=b||g,y=s.body.indexOf(",")>=0;if(!$&&!y)return s.post.match(/,(?!,).*\}/)?v(t=s.pre+"{"+s.body+r+s.post):[t];if($)m=s.body.split(/\.\./);else if(1===(m=c(s.body)).length&&1===(m=v(m[0],!1).map(u)).length)return l.map((function(t){return s.pre+m[0]+t}));if($){var O=h(m[0]),j=h(m[1]),S=Math.max(m[0].length,m[1].length),E=3==m.length?Math.abs(h(m[2])):1,M=p;j<O&&(E*=-1,M=d);var k=m.some(a);w=[];for(var x=O;M(x,j);x+=E){var N;if(g)"\\"===(N=String.fromCharCode(x))&&(N="");else if(N=x+"",k){var P=S-N.length;if(P>0){var W=Array(P+1).join("0");N=x<0?"-"+W+N.slice(1):W+N}}w.push(N)}}else{w=[];for(var R=0;R<m.length;R++)w.push.apply(w,v(m[R],!1))}for(R=0;R<w.length;R++)for(f=0;f<l.length;f++){var z=o+w[R]+l[f];(!e||$||z)&&n.push(z)}}return n}}}),R=(t,e)=>{var i;Object.entries(null!=(i=e.i.t)?i:{}).map((([i,[n]])=>{if(31&n||32&n){const n=t[i],s=function(t,e){for(;t;){const i=Object.getOwnPropertyDescriptor(t,e);if(null==i?void 0:i.get)return i;t=Object.getPrototypeOf(t)}}(Object.getPrototypeOf(t),i)||Object.getOwnPropertyDescriptor(t,i);s&&Object.defineProperty(t,i,{get(){return s.get.call(this)},set(t){s.set.call(this,t)},configurable:!0,enumerable:!0}),t[i]=e.o.has(i)?e.o.get(i):n}}))},z=t=>{if(t.__stencil__getHostRef)return t.__stencil__getHostRef()},A=(t,e)=>e in t,C=(t,e)=>(0,console.error)(t,e),L=new Map,_="undefined"!=typeof window?window:{},T=_.HTMLElement||class{},D={l:0,h:"",jmp:t=>t(),raf:t=>requestAnimationFrame(t),ael:(t,e,i,n)=>t.addEventListener(e,i,n),rel:(t,e,i,n)=>t.removeEventListener(e,i,n),ce:(t,e)=>new CustomEvent(t,e)},U=(()=>{try{return!!_.document.adoptedStyleSheets&&(new CSSStyleSheet,"function"==typeof(new CSSStyleSheet).replaceSync)}catch(t){}return!1})(),G=!!U&&(()=>!!_.document&&Object.getOwnPropertyDescriptor(_.document.adoptedStyleSheets,"length").writable)(),I=!1,Z=[],F=[],H=(t,e)=>i=>{t.push(i),I||(I=!0,e&&4&D.l?B(q):D.raf(q))},V=t=>{for(let e=0;e<t.length;e++)try{t[e](performance.now())}catch(t){C(t)}t.length=0},q=()=>{V(Z),V(F),(I=Z.length>0)&&D.raf(q)},B=t=>Promise.resolve(void 0).then(t),J=H(F,!0),Y=t=>{const e=new URL(t,D.h);return e.origin!==_.location.origin?e.href:e.pathname},K=t=>D.h=t,Q=t=>"object"==(t=typeof t)||"function"===t,X=((t,e,i)=>(i=null!=t?w(y(t)):{},((t,e,i,n)=>{if(e&&"object"==typeof e||"function"==typeof e)for(let i of $(e))O.call(t,i)||undefined===i||b(t,i,{get:()=>e[i],enumerable:!(n=g(e,i))||n.enumerable});return t})(b(i,"default",{value:t,enumerable:!0}),t)))(W()),tt=t=>{if("string"!=typeof t)throw new TypeError("invalid pattern");if(t.length>65536)throw new TypeError("pattern is too long")},et={"[:alnum:]":["\\p{L}\\p{Nl}\\p{Nd}",!0],"[:alpha:]":["\\p{L}\\p{Nl}",!0],"[:ascii:]":["\\x00-\\x7f",!1],"[:blank:]":["\\p{Zs}\\t",!0],"[:cntrl:]":["\\p{Cc}",!0],"[:digit:]":["\\p{Nd}",!0],"[:graph:]":["\\p{Z}\\p{C}",!0,!0],"[:lower:]":["\\p{Ll}",!0],"[:print:]":["\\p{C}",!0],"[:punct:]":["\\p{P}",!0],"[:space:]":["\\p{Z}\\t\\r\\n\\v\\f",!0],"[:upper:]":["\\p{Lu}",!0],"[:word:]":["\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}",!0],"[:xdigit:]":["A-Fa-f0-9",!1]},it=t=>t.replace(/[[\]\\-]/g,"\\$&"),nt=t=>t.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),st=t=>t.join(""),rt=(t,e)=>{const i=e;if("["!==t.charAt(i))throw Error("not in a brace expression");const n=[],s=[];let r=i+1,o=!1,l=!1,h=!1,f=!1,c=i,u="";t:for(;r<t.length;){const e=t.charAt(r);if("!"!==e&&"^"!==e||r!==i+1){if("]"===e&&o&&!h){c=r+1;break}if(o=!0,"\\"!==e||h){if("["===e&&!h)for(const[e,[o,h,f]]of Object.entries(et))if(t.startsWith(e,r)){if(u)return["$.",!1,t.length-i,!0];r+=e.length,f?s.push(o):n.push(o),l=l||h;continue t}h=!1,u?(e>u?n.push(it(u)+"-"+it(e)):e===u&&n.push(it(e)),u="",r++):t.startsWith("-]",r+1)?(n.push(it(e+"-")),r+=2):t.startsWith("-",r+1)?(u=e,r+=2):(n.push(it(e)),r++)}else h=!0,r++}else f=!0,r++}if(c<r)return["",!1,0,!1];if(!n.length&&!s.length)return["$.",!1,t.length-i,!0];if(0===s.length&&1===n.length&&/^\\?.$/.test(n[0])&&!f){const t=2===n[0].length?n[0].slice(-1):n[0];return[nt(t),!1,c-i,!1]}const a="["+(f?"^":"")+st(n)+"]",p="["+(f?"":"^")+st(s)+"]";return[n.length&&s.length?"("+a+"|"+p+")":n.length?a:p,l,c-i,!0]},ot=(t,{windowsPathsNoEscape:e=!1}={})=>e?t.replace(/\[([^\/\\])\]/g,"$1"):t.replace(/((?!\\).|^)\[([^\/\\])\]/g,"$1$2").replace(/\\([^\/])/g,"$1"),lt=new Set(["!","?","+","*","@"]),ht=t=>lt.has(t),ft="(?!\\.)",ct=new Set(["[","."]),ut=new Set(["..","."]),at=new Set("().*{}+?[]^$\\!"),pt=t=>t.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),dt="[^/]",vt=dt+"*?",mt=dt+"+?",wt=class w{constructor(a,p,d={}){k(this,u),((t,e,i)=>{((t,e,i)=>{e in t?b(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i})(t,e+"",i)})(this,"type"),k(this,t),k(this,e),k(this,i,!1),k(this,n,[]),k(this,s),k(this,r),k(this,o),k(this,l,!1),k(this,h),k(this,f),k(this,c,!1),this.type=a,a&&x(this,e,!0),x(this,s,p),x(this,t,M(this,s)?M(M(this,s),t):this),x(this,h,M(this,t)===this?d:M(M(this,t),h)),x(this,o,M(this,t)===this?[]:M(M(this,t),o)),"!"!==a||M(M(this,t),l)||M(this,o).push(this),x(this,r,M(this,s)?M(M(this,s),n).length:0)}get hasMagic(){if(void 0!==M(this,e))return M(this,e);for(const t of M(this,n))if("string"!=typeof t&&(t.type||t.hasMagic))return x(this,e,!0);return M(this,e)}toString(){return void 0!==M(this,f)?M(this,f):x(this,f,this.type?this.type+"("+M(this,n).map((t=>t+"")).join("|")+")":M(this,n).map((t=>t+"")).join(""))}push(...t){for(const e of t)if(""!==e){if("string"!=typeof e&&!(e instanceof w&&M(e,s)===this))throw Error("invalid part: "+e);M(this,n).push(e)}}toJSON(){var e;const i=null===this.type?M(this,n).slice().map((t=>"string"==typeof t?t:t.toJSON())):[this.type,...M(this,n).map((t=>t.toJSON()))];return this.isStart()&&!this.type&&i.unshift([]),this.isEnd()&&(this===M(this,t)||M(M(this,t),l)&&"!"===(null==(e=M(this,s))?void 0:e.type))&&i.push({}),i}isStart(){var e;if(M(this,t)===this)return!0;if(!(null==(e=M(this,s))?void 0:e.isStart()))return!1;if(0===M(this,r))return!0;const i=M(this,s);for(let t=0;t<M(this,r);t++){const e=M(i,n)[t];if(!(e instanceof w&&"!"===e.type))return!1}return!0}isEnd(){var e,i,o;if(M(this,t)===this)return!0;if("!"===(null==(e=M(this,s))?void 0:e.type))return!0;if(!(null==(i=M(this,s))?void 0:i.isEnd()))return!1;if(!this.type)return null==(o=M(this,s))?void 0:o.isEnd();const l=M(this,s)?M(M(this,s),n).length:0;return M(this,r)===l-1}copyIn(t){this.push("string"==typeof t?t:t.clone(this))}clone(t){const e=new w(this.type,t);for(const t of M(this,n))e.copyIn(t);return e}static fromGlob(t,e={}){var i;const n=new w(null,void 0,e);return N(i=w,p,d).call(i,t,n,0,e),n}toMMPattern(){if(this!==M(this,t))return M(this,t).toMMPattern();const i=""+this,[n,s,r,o]=this.toRegExpSource();if(!(r||M(this,e)||M(this,h).nocase&&!M(this,h).nocaseMagicOnly&&i.toUpperCase()!==i.toLowerCase()))return s;const l=(M(this,h).nocase?"i":"")+(o?"u":"");return Object.assign(RegExp(`^${n}$`,l),{_src:n,_glob:i})}get options(){return M(this,h)}toRegExpSource(r){var o;const f=null!=r?r:!!M(this,h).dot;if(M(this,t)===this&&N(this,u,a).call(this),!this.type){const h=this.isStart()&&this.isEnd(),c=M(this,n).map((t=>{var n;const[s,o,l,f]="string"==typeof t?N(n=w,p,m).call(n,t,M(this,e),h):t.toRegExpSource(r);return x(this,e,M(this,e)||l),x(this,i,M(this,i)||f),s})).join("");let u="";if(this.isStart()&&"string"==typeof M(this,n)[0]&&(1!==M(this,n).length||!ut.has(M(this,n)[0]))){const t=ct,e=f&&t.has(c.charAt(0))||c.startsWith("\\.")&&t.has(c.charAt(2))||c.startsWith("\\.\\.")&&t.has(c.charAt(4)),i=!f&&!r&&t.has(c.charAt(0));u=e?"(?!(?:^|/)\\.\\.?(?:$|/))":i?ft:""}let a="";return this.isEnd()&&M(M(this,t),l)&&"!"===(null==(o=M(this,s))?void 0:o.type)&&(a="(?:$|\\/)"),[u+c+a,ot(c),x(this,e,!!M(this,e)),M(this,i)]}const d="*"===this.type||"+"===this.type,b="!"===this.type?"(?:(?!(?:":"(?:";let g=N(this,u,v).call(this,f);if(this.isStart()&&this.isEnd()&&!g&&"!"!==this.type){const t=""+this;return x(this,n,[t]),this.type=null,x(this,e,void 0),[t,ot(""+this),!1,!1]}let $=!d||r||f?"":N(this,u,v).call(this,!0);$===g&&($=""),$&&(g=`(?:${g})(?:${$})*?`);let y="";return y="!"===this.type&&M(this,c)?(this.isStart()&&!f?ft:"")+mt:b+g+("!"===this.type?"))"+(!this.isStart()||f||r?"":ft)+vt+")":"@"===this.type?")":"?"===this.type?")?":"+"===this.type&&$?")":"*"===this.type&&$?")?":")"+this.type),[y,ot(g),x(this,e,!!M(this,e)),M(this,i)]}};t=new WeakMap,e=new WeakMap,i=new WeakMap,n=new WeakMap,s=new WeakMap,r=new WeakMap,o=new WeakMap,l=new WeakMap,h=new WeakMap,f=new WeakMap,c=new WeakMap,u=new WeakSet,a=function(){if(this!==M(this,t))throw Error("should only call on root");if(M(this,l))return this;let e;for(x(this,l,!0);e=M(this,o).pop();){if("!"!==e.type)continue;let t=e,i=M(t,s);for(;i;){for(let s=M(t,r)+1;!i.type&&s<M(i,n).length;s++)for(const t of M(e,n)){if("string"==typeof t)throw Error("string part in extglob AST??");t.copyIn(M(i,n)[s])}t=i,i=M(t,s)}}return this},p=new WeakSet,d=function(t,i,s,r){var o,l;let h=!1,f=!1,u=-1,a=!1;if(null===i.type){let e=s,n="";for(;e<t.length;){const s=t.charAt(e++);if(h||"\\"===s)h=!h,n+=s;else if(f)e===u+1?"^"!==s&&"!"!==s||(a=!0):"]"!==s||e===u+2&&a||(f=!1),n+=s;else if("["!==s)if(r.noext||!ht(s)||"("!==t.charAt(e))n+=s;else{i.push(n),n="";const l=new wt(s,i);e=N(o=wt,p,d).call(o,t,l,e,r),i.push(l)}else f=!0,u=e,a=!1,n+=s}return i.push(n),e}let v=s+1,m=new wt(null,i);const w=[];let b="";for(;v<t.length;){const e=t.charAt(v++);if(h||"\\"===e)h=!h,b+=e;else if(f)v===u+1?"^"!==e&&"!"!==e||(a=!0):"]"!==e||v===u+2&&a||(f=!1),b+=e;else if("["!==e)if(ht(e)&&"("===t.charAt(v)){m.push(b),b="";const i=new wt(e,m);m.push(i),v=N(l=wt,p,d).call(l,t,i,v,r)}else if("|"!==e){if(")"===e)return""===b&&0===M(i,n).length&&x(i,c,!0),m.push(b),b="",i.push(...w,m),v;b+=e}else m.push(b),b="",w.push(m),m=new wt(null,i);else f=!0,u=v,a=!1,b+=e}return i.type=null,x(i,e,void 0),x(i,n,[t.substring(s-1)]),v},v=function(t){return M(this,n).map((e=>{if("string"==typeof e)throw Error("string type in extglob ast??");const[n,s,r,o]=e.toRegExpSource(t);return x(this,i,M(this,i)||o),n})).filter((t=>!(this.isStart()&&this.isEnd()&&!t))).join("|")},m=function(t,e,i=!1){let n=!1,s="",r=!1;for(let o=0;o<t.length;o++){const l=t.charAt(o);if(n)n=!1,s+=(at.has(l)?"\\":"")+l;else if("\\"!==l){if("["===l){const[i,n,l,h]=rt(t,o);if(l){s+=i,r=r||n,o+=l-1,e=e||h;continue}}"*"!==l?"?"!==l?s+=pt(l):(s+=dt,e=!0):(s+=i&&"*"===t?mt:vt,e=!0)}else o===t.length-1?s+="\\\\":n=!0}return[s,ot(t),!!e,r]},k(wt,p);var bt=wt,gt=(t,e,i={})=>(tt(e),!(!i.nocomment&&"#"===e.charAt(0))&&new Ht(e,i).match(t)),$t=/^\*+([^+@!?\*\[\(]*)$/,yt=t=>e=>!e.startsWith(".")&&e.endsWith(t),Ot=t=>e=>e.endsWith(t),jt=t=>(t=t.toLowerCase(),e=>!e.startsWith(".")&&e.toLowerCase().endsWith(t)),St=t=>(t=t.toLowerCase(),e=>e.toLowerCase().endsWith(t)),Et=/^\*+\.\*+$/,Mt=t=>!t.startsWith(".")&&t.includes("."),kt=t=>"."!==t&&".."!==t&&t.includes("."),xt=/^\.\*+$/,Nt=t=>"."!==t&&".."!==t&&t.startsWith("."),Pt=/^\*+$/,Wt=t=>0!==t.length&&!t.startsWith("."),Rt=t=>0!==t.length&&"."!==t&&".."!==t,zt=/^\?+([^+@!?\*\[\(]*)?$/,At=([t,e=""])=>{const i=Tt([t]);return e?(e=e.toLowerCase(),t=>i(t)&&t.toLowerCase().endsWith(e)):i},Ct=([t,e=""])=>{const i=Dt([t]);return e?(e=e.toLowerCase(),t=>i(t)&&t.toLowerCase().endsWith(e)):i},Lt=([t,e=""])=>{const i=Dt([t]);return e?t=>i(t)&&t.endsWith(e):i},_t=([t,e=""])=>{const i=Tt([t]);return e?t=>i(t)&&t.endsWith(e):i},Tt=([t])=>{const e=t.length;return t=>t.length===e&&!t.startsWith(".")},Dt=([t])=>{const e=t.length;return t=>t.length===e&&"."!==t&&".."!==t},Ut="object"==typeof process&&process?"object"==typeof process.env&&process.env&&process.env.__MINIMATCH_TESTING_PLATFORM__||process.platform:"posix";gt.sep="win32"===Ut?"\\":"/";var Gt=Symbol("globstar **");gt.GLOBSTAR=Gt,gt.filter=(t,e={})=>i=>gt(i,t,e);var It=(t,e={})=>Object.assign({},t,e);gt.defaults=t=>{if(!t||"object"!=typeof t||!Object.keys(t).length)return gt;const e=gt;return Object.assign(((i,n,s={})=>e(i,n,It(t,s))),{Minimatch:class extends e.Minimatch{constructor(e,i={}){super(e,It(t,i))}static defaults(i){return e.defaults(It(t,i)).Minimatch}},AST:class extends e.AST{constructor(e,i,n={}){super(e,i,It(t,n))}static fromGlob(i,n={}){return e.AST.fromGlob(i,It(t,n))}},unescape:(i,n={})=>e.unescape(i,It(t,n)),escape:(i,n={})=>e.escape(i,It(t,n)),filter:(i,n={})=>e.filter(i,It(t,n)),defaults:i=>e.defaults(It(t,i)),makeRe:(i,n={})=>e.makeRe(i,It(t,n)),braceExpand:(i,n={})=>e.braceExpand(i,It(t,n)),match:(i,n,s={})=>e.match(i,n,It(t,s)),sep:e.sep,GLOBSTAR:Gt})};var Zt=(t,e={})=>(tt(t),e.nobrace||!/\{(?:(?!\{).)*\}/.test(t)?[t]:(0,X.default)(t));gt.braceExpand=Zt,gt.makeRe=(t,e={})=>new Ht(t,e).makeRe(),gt.match=(t,e,i={})=>{const n=new Ht(e,i);return t=t.filter((t=>n.match(t))),n.options.nonull&&!t.length&&t.push(e),t};var Ft=/[?*]|[+@!]\(.*?\)|\[|\]/,Ht=class{options;set;pattern;windowsPathsNoEscape;nonegate;negate;comment;empty;preserveMultipleSlashes;partial;globSet;globParts;nocase;isWindows;platform;windowsNoMagicRoot;regexp;constructor(t,e={}){tt(t),this.options=e=e||{},this.pattern=t,this.platform=e.platform||Ut,this.isWindows="win32"===this.platform,this.windowsPathsNoEscape=!!e.windowsPathsNoEscape||!1===e.allowWindowsEscape,this.windowsPathsNoEscape&&(this.pattern=this.pattern.replace(/\\/g,"/")),this.preserveMultipleSlashes=!!e.preserveMultipleSlashes,this.regexp=null,this.negate=!1,this.nonegate=!!e.nonegate,this.comment=!1,this.empty=!1,this.partial=!!e.partial,this.nocase=!!this.options.nocase,this.windowsNoMagicRoot=void 0!==e.windowsNoMagicRoot?e.windowsNoMagicRoot:!(!this.isWindows||!this.nocase),this.globSet=[],this.globParts=[],this.set=[],this.make()}hasMagic(){if(this.options.magicalBraces&&this.set.length>1)return!0;for(const t of this.set)for(const e of t)if("string"!=typeof e)return!0;return!1}debug(...t){}make(){const t=this.pattern,e=this.options;if(!e.nocomment&&"#"===t.charAt(0))return void(this.comment=!0);if(!t)return void(this.empty=!0);this.parseNegate(),this.globSet=[...new Set(this.braceExpand())],e.debug&&(this.debug=(...t)=>console.error(...t)),this.debug(this.pattern,this.globSet);const i=this.globSet.map((t=>this.slashSplit(t)));this.globParts=this.preprocess(i),this.debug(this.pattern,this.globParts);let n=this.globParts.map((t=>{if(this.isWindows&&this.windowsNoMagicRoot){const e=!(""!==t[0]||""!==t[1]||"?"!==t[2]&&Ft.test(t[2])||Ft.test(t[3])),i=/^[a-z]:/i.test(t[0]);if(e)return[...t.slice(0,4),...t.slice(4).map((t=>this.parse(t)))];if(i)return[t[0],...t.slice(1).map((t=>this.parse(t)))]}return t.map((t=>this.parse(t)))}));if(this.debug(this.pattern,n),this.set=n.filter((t=>-1===t.indexOf(!1))),this.isWindows)for(let t=0;t<this.set.length;t++){const e=this.set[t];""===e[0]&&""===e[1]&&"?"===this.globParts[t][2]&&"string"==typeof e[3]&&/^[a-z]:$/i.test(e[3])&&(e[2]="?")}this.debug(this.pattern,this.set)}preprocess(t){if(this.options.noglobstar)for(let e=0;e<t.length;e++)for(let i=0;i<t[e].length;i++)"**"===t[e][i]&&(t[e][i]="*");const{optimizationLevel:e=1}=this.options;return e>=2?(t=this.firstPhasePreProcess(t),t=this.secondPhasePreProcess(t)):t=e>=1?this.levelOneOptimize(t):this.adjascentGlobstarOptimize(t),t}adjascentGlobstarOptimize(t){return t.map((t=>{let e=-1;for(;-1!==(e=t.indexOf("**",e+1));){let i=e;for(;"**"===t[i+1];)i++;i!==e&&t.splice(e,i-e)}return t}))}levelOneOptimize(t){return t.map((t=>0===(t=t.reduce(((t,e)=>{const i=t[t.length-1];return"**"===e&&"**"===i?t:".."===e&&i&&".."!==i&&"."!==i&&"**"!==i?(t.pop(),t):(t.push(e),t)}),[])).length?[""]:t))}levelTwoFileOptimize(t){Array.isArray(t)||(t=this.slashSplit(t));let e=!1;do{if(e=!1,!this.preserveMultipleSlashes){for(let i=1;i<t.length-1;i++){const n=t[i];1===i&&""===n&&""===t[0]||"."!==n&&""!==n||(e=!0,t.splice(i,1),i--)}"."!==t[0]||2!==t.length||"."!==t[1]&&""!==t[1]||(e=!0,t.pop())}let i=0;for(;-1!==(i=t.indexOf("..",i+1));){const n=t[i-1];n&&"."!==n&&".."!==n&&"**"!==n&&(e=!0,t.splice(i-1,2),i-=2)}}while(e);return 0===t.length?[""]:t}firstPhasePreProcess(t){let e=!1;do{e=!1;for(let i of t){let n=-1;for(;-1!==(n=i.indexOf("**",n+1));){let s=n;for(;"**"===i[s+1];)s++;s>n&&i.splice(n+1,s-n);const r=i[n+2],o=i[n+3];if(".."!==i[n+1])continue;if(!r||"."===r||".."===r||!o||"."===o||".."===o)continue;e=!0,i.splice(n,1);const l=i.slice(0);l[n]="**",t.push(l),n--}if(!this.preserveMultipleSlashes){for(let t=1;t<i.length-1;t++){const n=i[t];1===t&&""===n&&""===i[0]||"."!==n&&""!==n||(e=!0,i.splice(t,1),t--)}"."!==i[0]||2!==i.length||"."!==i[1]&&""!==i[1]||(e=!0,i.pop())}let s=0;for(;-1!==(s=i.indexOf("..",s+1));){const t=i[s-1];t&&"."!==t&&".."!==t&&"**"!==t&&(e=!0,i.splice(s-1,2,...1===s&&"**"===i[s+1]?["."]:[]),0===i.length&&i.push(""),s-=2)}}}while(e);return t}secondPhasePreProcess(t){for(let e=0;e<t.length-1;e++)for(let i=e+1;i<t.length;i++){const n=this.partsMatch(t[e],t[i],!this.preserveMultipleSlashes);n&&(t[e]=n,t[i]=[])}return t.filter((t=>t.length))}partsMatch(t,e,i=!1){let n=0,s=0,r=[],o="";for(;n<t.length&&s<e.length;)if(t[n]===e[s])r.push("b"===o?e[s]:t[n]),n++,s++;else if(i&&"**"===t[n]&&e[s]===t[n+1])r.push(t[n]),n++;else if(i&&"**"===e[s]&&t[n]===e[s+1])r.push(e[s]),s++;else if("*"!==t[n]||!e[s]||!this.options.dot&&e[s].startsWith(".")||"**"===e[s]){if("*"!==e[s]||!t[n]||!this.options.dot&&t[n].startsWith(".")||"**"===t[n])return!1;if("a"===o)return!1;o="b",r.push(e[s]),n++,s++}else{if("b"===o)return!1;o="a",r.push(t[n]),n++,s++}return t.length===e.length&&r}parseNegate(){if(this.nonegate)return;const t=this.pattern;let e=!1,i=0;for(let n=0;n<t.length&&"!"===t.charAt(n);n++)e=!e,i++;i&&(this.pattern=t.slice(i)),this.negate=e}matchOne(t,e,i=!1){const n=this.options;if(this.isWindows){const i="string"==typeof t[0]&&/^[a-z]:$/i.test(t[0]),n=!i&&""===t[0]&&""===t[1]&&"?"===t[2]&&/^[a-z]:$/i.test(t[3]),s="string"==typeof e[0]&&/^[a-z]:$/i.test(e[0]),r=n?3:i?0:void 0,o=!s&&""===e[0]&&""===e[1]&&"?"===e[2]&&"string"==typeof e[3]&&/^[a-z]:$/i.test(e[3])?3:s?0:void 0;if("number"==typeof r&&"number"==typeof o){const[i,n]=[t[r],e[o]];i.toLowerCase()===n.toLowerCase()&&(e[o]=i,o>r?e=e.slice(o):r>o&&(t=t.slice(r)))}}const{optimizationLevel:s=1}=this.options;s>=2&&(t=this.levelTwoFileOptimize(t)),this.debug("matchOne",this,{file:t,pattern:e}),this.debug("matchOne",t.length,e.length);for(var r=0,o=0,l=t.length,h=e.length;r<l&&o<h;r++,o++){this.debug("matchOne loop");var f=e[o],c=t[r];if(this.debug(e,f,c),!1===f)return!1;if(f===Gt){this.debug("GLOBSTAR",[e,f,c]);var u=r,a=o+1;if(a===h){for(this.debug("** at the end");r<l;r++)if("."===t[r]||".."===t[r]||!n.dot&&"."===t[r].charAt(0))return!1;return!0}for(;u<l;){var p=t[u];if(this.debug("\nglobstar while",t,u,e,a,p),this.matchOne(t.slice(u),e.slice(a),i))return this.debug("globstar found match!",u,l,p),!0;if("."===p||".."===p||!n.dot&&"."===p.charAt(0)){this.debug("dot detected!",t,u,e,a);break}this.debug("globstar swallow a segment, and continue"),u++}return!(!i||(this.debug("\n>>> no match, partial?",t,u,e,a),u!==l))}let s;if("string"==typeof f?(s=c===f,this.debug("string match",f,c,s)):(s=f.test(c),this.debug("pattern match",f,c,s)),!s)return!1}if(r===l&&o===h)return!0;if(r===l)return i;if(o===h)return r===l-1&&""===t[r];throw Error("wtf?")}braceExpand(){return Zt(this.pattern,this.options)}parse(t){tt(t);const e=this.options;if("**"===t)return Gt;if(""===t)return"";let i,n=null;(i=t.match(Pt))?n=e.dot?Rt:Wt:(i=t.match($t))?n=(e.nocase?e.dot?St:jt:e.dot?Ot:yt)(i[1]):(i=t.match(zt))?n=(e.nocase?e.dot?Ct:At:e.dot?Lt:_t)(i):(i=t.match(Et))?n=e.dot?kt:Mt:(i=t.match(xt))&&(n=Nt);const s=bt.fromGlob(t,this.options).toMMPattern();return n&&"object"==typeof s&&Reflect.defineProperty(s,"test",{value:n}),s}makeRe(){if(this.regexp||!1===this.regexp)return this.regexp;const t=this.set;if(!t.length)return this.regexp=!1,this.regexp;const e=this.options,i=e.noglobstar?"[^/]*?":e.dot?"(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?":"(?:(?!(?:\\/|^)\\.).)*?",n=new Set(e.nocase?["i"]:[]);let s=t.map((t=>{const e=t.map((t=>{if(t instanceof RegExp)for(const e of t.flags.split(""))n.add(e);return"string"==typeof t?(t=>t.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"))(t):t===Gt?Gt:t._src}));return e.forEach(((t,n)=>{const s=e[n+1],r=e[n-1];t===Gt&&r!==Gt&&(void 0===r?void 0!==s&&s!==Gt?e[n+1]="(?:\\/|"+i+"\\/)?"+s:e[n]=i:void 0===s?e[n-1]=r+"(?:\\/|"+i+")?":s!==Gt&&(e[n-1]=r+"(?:\\/|\\/"+i+"\\/)"+s,e[n+1]=Gt))})),e.filter((t=>t!==Gt)).join("/")})).join("|");const[r,o]=t.length>1?["(?:",")"]:["",""];s="^"+r+s+o+"$",this.negate&&(s="^(?!"+s+").+$");try{this.regexp=RegExp(s,[...n].join(""))}catch(t){this.regexp=!1}return this.regexp}slashSplit(t){return this.preserveMultipleSlashes?t.split("/"):this.isWindows&&/^\/\/[^\/]+/.test(t)?["",...t.split(/\/+/)]:t.split(/\/+/)}match(t,e=this.partial){if(this.debug("match",t,this.pattern),this.comment)return!1;if(this.empty)return""===t;if("/"===t&&e)return!0;const i=this.options;this.isWindows&&(t=t.split("\\").join("/"));const n=this.slashSplit(t);this.debug(this.pattern,"split",n);const s=this.set;this.debug(this.pattern,"set",s);let r=n[n.length-1];if(!r)for(let t=n.length-2;!r&&t>=0;t--)r=n[t];for(let t=0;t<s.length;t++){const o=s[t];let l=n;if(i.matchBase&&1===o.length&&(l=[r]),this.matchOne(l,o,e))return!!i.flipNegate||!this.negate}return!i.flipNegate&&this.negate}static defaults(t){return gt.defaults(t).Minimatch}};gt.AST=bt,gt.Minimatch=Ht,gt.escape=(t,{windowsPathsNoEscape:e=!1}={})=>e?t.replace(/[?*()[\]]/g,"[$&]"):t.replace(/[?*()[\]\\]/g,"\\$&"),gt.unescape=ot,((t,e)=>{for(var i in e)b(t,i,{get:e[i],enumerable:!0})})({},{err:()=>qt,map:()=>Bt,ok:()=>Vt,unwrap:()=>Yt,unwrapErr:()=>Kt});var Vt=t=>({isOk:!0,isErr:!1,value:t}),qt=t=>({isOk:!1,isErr:!0,value:t});function Bt(t,e){if(t.isOk){const i=e(t.value);return i instanceof Promise?i.then((t=>Vt(t))):Vt(i)}if(t.isErr)return qt(t.value);throw"should never get here"}var Jt,Yt=t=>{if(t.isOk)return t.value;throw t.value},Kt=t=>{if(t.isErr)return t.value;throw t.value};function Qt(){const t=this.attachShadow({mode:"open"});void 0===Jt&&(Jt=null),Jt&&(G?t.adoptedStyleSheets.push(Jt):t.adoptedStyleSheets=[...t.adoptedStyleSheets,Jt])}function Xt(t,e,i){let n,s=0,r=[];for(;s<t.length;s++){if(n=t[s],n["s-sr"]&&(!e||n["s-hn"]===e)&&(void 0===i||te(n)===i)&&(r.push(n),void 0!==i))return r;r=[...r,...Xt(n.childNodes,e,i)]}return r}var te=t=>"string"==typeof t["s-sn"]?t["s-sn"]:1===t.nodeType&&t.getAttribute("slot")||void 0;var ee=new WeakMap,ie=t=>"sc-"+t.u,ne=(t,e,...i)=>{let n=null,s=null,r=!1,o=!1;const l=[],h=e=>{for(let i=0;i<e.length;i++)n=e[i],Array.isArray(n)?h(n):null!=n&&"boolean"!=typeof n&&((r="function"!=typeof t&&!Q(n))&&(n+=""),r&&o?l[l.length-1].p+=n:l.push(r?se(null,n):n),o=r)};if(h(i),e){e.key&&(s=e.key);{const t=e.className||e.class;t&&(e.class="object"!=typeof t?t:Object.keys(t).filter((e=>t[e])).join(" "))}}const f=se(t,null);return f.v=e,l.length>0&&(f.m=l),f.$=s,f},se=(t,e)=>({l:0,O:t,p:e,j:null,m:null,v:null,$:null}),re={},oe=t=>{const e=(t=>t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"))(t);return RegExp(`(^|[^@]|@(?!supports\\s+selector\\s*\\([^{]*?${e}))(${e}\\b)`,"g")};oe("::slotted"),oe(":host"),oe(":host-context");var le,he=t=>(null==t||Q(t),t),fe=(t,e,i,n,s,r)=>{if(i===n)return;let o=A(t,e),l=e.toLowerCase();if("class"===e){const e=t.classList,s=ue(i);let r=ue(n);e.remove(...s.filter((t=>t&&!r.includes(t)))),e.add(...r.filter((t=>t&&!s.includes(t))))}else if("style"===e){for(const e in i)n&&null!=n[e]||(e.includes("-")?t.style.removeProperty(e):t.style[e]="");for(const e in n)i&&n[e]===i[e]||(e.includes("-")?t.style.setProperty(e,n[e]):t.style[e]=n[e])}else if("key"===e);else if(t.__lookupSetter__(e)||"o"!==e[0]||"n"!==e[1]){const l=Q(n);if(o||l&&null!==n)try{if(t.tagName.includes("-"))t[e]!==n&&(t[e]=n);else{const s=null==n?"":n;"list"===e?o=!1:null!=i&&t[e]==s||("function"==typeof t.__lookupSetter__(e)?t[e]=s:t.setAttribute(e,s))}}catch(t){}null==n||!1===n?!1===n&&""!==t.getAttribute(e)||t.removeAttribute(e):(!o||4&r||s)&&!l&&1===t.nodeType&&t.setAttribute(e,n=!0===n?"":n)}else if(e="-"===e[2]?e.slice(3):A(_,l)?l.slice(2):l[2]+e.slice(3),i||n){const s=e.endsWith(ae);e=e.replace(pe,""),i&&D.rel(t,e,i,s),n&&D.ael(t,e,n,s)}},ce=/\s/,ue=t=>("object"==typeof t&&t&&"baseVal"in t&&(t=t.baseVal),t&&"string"==typeof t?t.split(ce):[]),ae="Capture",pe=RegExp(ae+"$"),de=(t,e,i)=>{const n=11===e.j.nodeType&&e.j.host?e.j.host:e.j,s=t&&t.v||{},r=e.v||{};for(const t of ve(Object.keys(s)))t in r||fe(n,t,s[t],void 0,i,e.l);for(const t of ve(Object.keys(r)))fe(n,t,s[t],r[t],i,e.l)};function ve(t){return t.includes("ref")?[...t.filter((t=>"ref"!==t)),"ref"]:t}var me=!1,we=(t,e,i)=>{const n=e.m[i];let s,r,o=0;if(null!==n.p)s=n.j=_.document.createTextNode(n.p);else{if(!_.document)throw Error("You are trying to render a Stencil component in an environment that doesn't support the DOM. Make sure to populate the [`window`](https://developer.mozilla.org/en-US/docs/Web/API/Window/window) object before rendering a component.");if(s=n.j=_.document.createElement(n.O),de(null,n,me),n.m){const e="template"===n.O?s.content:s;for(o=0;o<n.m.length;++o)r=we(t,n,o),r&&e.appendChild(r)}}return s["s-hn"]=le,s},be=(t,e,i,n,s,r)=>{let o,l=t;for(l.shadowRoot&&l.tagName===le&&(l=l.shadowRoot),"template"===i.O&&(l=l.content);s<=r;++s)n[s]&&(o=we(null,i,s),o&&(n[s].j=o,Oe(l,o,e)))},ge=(t,e,i)=>{for(let n=e;n<=i;++n){const e=t[n];if(e){const t=e.j;t&&t.remove()}}},$e=(t,e,i=!1)=>t.O===e.O&&(i?(i&&!t.$&&e.$&&(t.$=e.$),!0):t.$===e.$),ye=(t,e,i=!1)=>{const n=e.j=t.j,s=t.m,r=e.m,o=e.p;null===o?(de(t,e,me),null!==s&&null!==r?((t,e,i,n,s=!1)=>{let r,o,l=0,h=0,f=0,c=0,u=e.length-1,a=e[0],p=e[u],d=n.length-1,v=n[0],m=n[d];const w="template"===i.O?t.content:t;for(;l<=u&&h<=d;)if(null==a)a=e[++l];else if(null==p)p=e[--u];else if(null==v)v=n[++h];else if(null==m)m=n[--d];else if($e(a,v,s))ye(a,v,s),a=e[++l],v=n[++h];else if($e(p,m,s))ye(p,m,s),p=e[--u],m=n[--d];else if($e(a,m,s))ye(a,m,s),Oe(w,a.j,p.j.nextSibling),a=e[++l],m=n[--d];else if($e(p,v,s))ye(p,v,s),Oe(w,p.j,a.j),p=e[--u],v=n[++h];else{for(f=-1,c=l;c<=u;++c)if(e[c]&&null!==e[c].$&&e[c].$===v.$){f=c;break}f>=0?(o=e[f],o.O!==v.O?r=we(e&&e[h],i,f):(ye(o,v,s),e[f]=void 0,r=o.j),v=n[++h]):(r=we(e&&e[h],i,h),v=n[++h]),r&&Oe(a.j.parentNode,r,a.j)}l>u?be(t,null==n[d+1]?null:n[d+1].j,i,n,h,d):h>d&&ge(e,l,u)})(n,s,e,r,i):null!==r?(null!==t.p&&(n.textContent=""),be(n,null,e,r,0,r.length-1)):!i&&null!==s&&ge(s,0,s.length-1)):t.p!==o&&(n.data=o)},Oe=(t,e,i)=>{if("string"==typeof e["s-sn"]){t.insertBefore(e,i);const{slotNode:n}=function(t,e){var i;if(!(e=e||(null==(i=t["s-ol"])?void 0:i.parentElement)))return{slotNode:null,slotName:""};const n=t["s-sn"]=te(t)||"";return{slotNode:Xt(function(t,e){if("__"+e in t){const i=t["__"+e];return"function"!=typeof i?i:i.bind(t)}return"function"!=typeof t[e]?t[e]:t[e].bind(t)}(e,"childNodes"),e.tagName,n)[0],slotName:n}}(e);return n&&function(t){t.dispatchEvent(new CustomEvent("slotchange",{bubbles:!1,cancelable:!1,composed:!1}))}(n),e}return t.__insertBefore?t.__insertBefore(e,i):null==t?void 0:t.insertBefore(e,i)},je=(t,e,i=!1)=>{const n=t.$hostElement$,s=t.S||se(null,null),r=(t=>t&&t.O===re)(e)?e:ne(null,null,e);if(le=n.tagName,i&&r.v)for(const t of Object.keys(r.v))n.hasAttribute(t)&&!["key","ref","style","class"].includes(t)&&(r.v[t]=n[t]);r.O=null,r.l|=4,t.S=r,r.j=s.j=n.shadowRoot||n,ye(s,r,i)},Se=(t,e)=>{if(e&&!t.M&&e["s-p"]){const i=e["s-p"].push(new Promise((n=>t.M=()=>{e["s-p"].splice(i-1,1),n()})))}},Ee=(t,e)=>{if(t.l|=16,4&t.l)return void(t.l|=512);Se(t,t.k);const i=()=>Me(t,e);if(!e)return J(i);queueMicrotask((()=>{i()}))},Me=(t,e)=>{const i=t.$hostElement$,n=i;if(!n)throw Error(`Can't render component <${i.tagName.toLowerCase()} /> with invalid Stencil runtime! Make sure this imported component is compiled with a \`externalRuntime: true\` flag. For more information, please refer to https://stenciljs.com/docs/custom-elements#externalruntime`);let s;return s=ze(n,e?"componentWillLoad":"componentWillUpdate",void 0,i),s=ke(s,(()=>ze(n,"componentWillRender",void 0,i))),ke(s,(()=>Ne(t,n,e)))},ke=(t,e)=>xe(t)?t.then(e).catch((t=>{console.error(t),e()})):e(),xe=t=>t instanceof Promise||t&&t.then&&"function"==typeof t.then,Ne=async(t,e,i)=>{var n;const s=t.$hostElement$,r=s["s-rc"];i&&(t=>{const e=t.i,i=t.$hostElement$,n=e.l,s=((t,e)=>{var i,n,s;const r=ie(e),o=L.get(r);if(!_.document)return r;if(t=11===t.nodeType?t:_.document,o)if("string"==typeof o){let s,l=ee.get(t=t.head||t);if(l||ee.set(t,l=new Set),!l.has(r)){s=_.document.createElement("style"),s.innerHTML=o;const h=null!=(i=D.N)?i:function(){var t,e,i;return null!=(i=null==(e=null==(t=_.document.head)?void 0:t.querySelector('meta[name="csp-nonce"]'))?void 0:e.getAttribute("content"))?i:void 0}();if(null!=h&&s.setAttribute("nonce",h),!(1&e.l))if("HEAD"===t.nodeName){const e=t.querySelectorAll("link[rel=preconnect]"),i=e.length>0?e[e.length-1].nextSibling:t.querySelector("style");t.insertBefore(s,(null==i?void 0:i.parentNode)===t?i:null)}else if("host"in t)if(U){const e=new(null!=(n=t.defaultView)?n:t.ownerDocument.defaultView).CSSStyleSheet;e.replaceSync(o),G?t.adoptedStyleSheets.unshift(e):t.adoptedStyleSheets=[e,...t.adoptedStyleSheets]}else{const e=t.querySelector("style");e?e.innerHTML=o+e.innerHTML:t.prepend(s)}else t.append(s);1&e.l&&t.insertBefore(s,null),4&e.l&&(s.innerHTML+="slot-fb{display:contents}slot-fb[hidden]{display:none}"),l&&l.add(r)}}else{let e=ee.get(t);if(e||ee.set(t,e=new Set),!e.has(r)){const i=null!=(s=t.defaultView)?s:t.ownerDocument.defaultView;let n;if(o.constructor===i.CSSStyleSheet)n=o;else{n=new i.CSSStyleSheet;for(let t=0;t<o.cssRules.length;t++)n.insertRule(o.cssRules[t].cssText,t)}G?t.adoptedStyleSheets.push(n):t.adoptedStyleSheets=[...t.adoptedStyleSheets,n],e.add(r)}}return r})(i.shadowRoot?i.shadowRoot:i.getRootNode(),e);10&n&&(i["s-sc"]=s,i.classList.add(s+"-h"))})(t);Pe(t,e,s,i),r&&(r.map((t=>t())),s["s-rc"]=void 0);{const e=null!=(n=s["s-p"])?n:[],i=()=>We(t);0===e.length?i():(Promise.all(e).then(i),t.l|=4,e.length=0)}},Pe=(t,e,i,n)=>{try{e=e.render(),t.l&=-17,t.l|=2,je(t,e,n)}catch(e){C(e,t.$hostElement$)}return null},We=t=>{const e=t.$hostElement$,i=e,n=t.k;ze(i,"componentDidRender",void 0,e),64&t.l?ze(i,"componentDidUpdate",void 0,e):(t.l|=64,Ae(e),ze(i,"componentDidLoad",void 0,e),t.P(e),n||Re()),t.M&&(t.M(),t.M=void 0),512&t.l&&B((()=>Ee(t,!1))),t.l&=-517},Re=()=>{B((()=>(t=>{const e=D.ce("appload",{detail:{namespace:"sliding-puzzle"}});return t.dispatchEvent(e),e})(_)))},ze=(t,e,i,n)=>{if(t&&t[e])try{return t[e](i)}catch(t){C(t,n)}},Ae=t=>t.classList.add("hydrated"),Ce=(t,e,i)=>{const n=z(t);if(!n)return;const s=t,r=n.o.get(e),o=n.l,l=s;if(!((i=he(i))===r||Number.isNaN(r)&&Number.isNaN(i)||(n.o.set(e,i),2!=(18&o)))){if(l.componentShouldUpdate&&!1===l.componentShouldUpdate(i,r,e))return;Ee(n,!1)}},Le=(t,e)=>{var i;const n=t.prototype;return e.t&&Object.entries(null!=(i=e.t)?i:{}).map((([t,[i]])=>{if(31&i||32&i){const{get:s,set:r}=Object.getOwnPropertyDescriptor(n,t)||{};s&&(e.t[t][0]|=2048),r&&(e.t[t][0]|=4096),Object.defineProperty(n,t,{get(){return s?s.apply(this):((t,e)=>z(this).o.get(e))(0,t)},configurable:!0,enumerable:!0}),Object.defineProperty(n,t,{set(e){const n=z(this);if(n){if(r)return void 0===(32&i?this[t]:n.$hostElement$[t])&&n.o.get(t)&&(e=n.o.get(t)),r.call(this,he(e)),void Ce(this,t,e=32&i?this[t]:n.$hostElement$[t]);Ce(this,t,e)}}})}})),t},_e=(t,e)=>{const i={l:e[0],u:e[1]};i.t=e[2];const n=t.prototype.connectedCallback,s=t.prototype.disconnectedCallback;return Object.assign(t.prototype,{__hasHostListenerAttached:!1,__registerHost(){((t,e)=>{const i={l:0,$hostElement$:t,i:e,o:new Map,W:new Map};i.R=new Promise((t=>i.P=t)),t["s-p"]=[],t["s-rc"]=[];const n=i;t.__stencil__getHostRef=()=>n,512&e.l&&R(t,i)})(this,i)},connectedCallback(){if(!this.__hasHostListenerAttached){if(!z(this))return;this.__hasHostListenerAttached=!0}(t=>{if(!(1&D.l)){const e=z(t);if(!e)return;const i=e.i,n=()=>{};if(1&e.l)(null==e?void 0:e.A)||(null==e?void 0:e.R)&&e.R.then((()=>{}));else{e.l|=1;{let i=t;for(;i=i.parentNode||i.host;)if(i["s-p"]){Se(e,e.k=i);break}}i.t&&Object.entries(i.t).map((([e,[i]])=>{if(31&i&&e in t&&t[e]!==Object.prototype[e]){const i=t[e];delete t[e],t[e]=i}})),(async(t,e,i)=>{let n;if(!(32&e.l)&&(e.l|=32,n=t.constructor,customElements.whenDefined(t.localName).then((()=>e.l|=128)),n&&n.style)){let t;"string"==typeof n.style&&(t=n.style);const e=ie(i);if(!L.has(e)){const n=()=>{};((t,e,i)=>{let n=L.get(t);U&&i?(n=n||new CSSStyleSheet,"string"==typeof n?n=e:n.replaceSync(e)):n=e,L.set(t,n)})(e,t,!!(1&i.l)),n()}}const s=e.k,r=()=>Ee(e,!0);s&&s["s-rc"]?s["s-rc"].push(r):r()})(t,e,i)}n()}})(this),n&&n.call(this)},disconnectedCallback(){(async t=>{ee.has(t)&&ee.delete(t),t.shadowRoot&&ee.has(t.shadowRoot)&&ee.delete(t.shadowRoot)})(this),s&&s.call(this)},__attachShadow(){if(this.shadowRoot){if("open"!==this.shadowRoot.mode)throw Error(`Unable to re-use existing shadow root for ${i.u}! Mode is set to ${this.shadowRoot.mode} but Stencil only supports open shadow roots.`)}else Qt.call(this,i)}}),t.is=i.u,Le(t,i)},Te=t=>D.N=t,De=t=>Object.assign(D,t);function Ue(t,e){je({$hostElement$:e},t)}function Ge(t){return t}export{T as H,Y as getAssetPath,ne as h,_e as p,Ue as render,K as setAssetPath,Te as setNonce,De as setPlatformOptions,Ge as t}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Components, JSX } from "../types/components";
|
|
2
|
+
|
|
3
|
+
interface MbSlidingPuzzle extends Components.MbSlidingPuzzle, HTMLElement {}
|
|
4
|
+
export const MbSlidingPuzzle: {
|
|
5
|
+
prototype: MbSlidingPuzzle;
|
|
6
|
+
new (): MbSlidingPuzzle;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Used to define this component and all nested components recursively.
|
|
10
|
+
*/
|
|
11
|
+
export const defineCustomElement: () => void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t,p as e,H as i,h as s}from"./index.js";class r{x;y;get 0(){return this.x}set 0(t){this.x=t}get 1(){return this.y}set 1(t){this.y=t}get width(){return this.x}set width(t){this.x=t}get height(){return this.y}set height(t){this.y=t}get xy(){return[this.x,this.y]}*[Symbol.iterator](){yield this.x,yield this.y}constructor(t,e){this.x=t,this.y=e}add(t){return new r(this.x+t.x,this.y+t.y)}eq(t){return this.x===t.x&&this.y===t.y}clone(){return new r(this.x,this.y)}static from(t){if("number"==typeof t)return new r(t,t);if(Array.isArray(t))return new r(t[0]??0,t[1]??0);if("object"==typeof t&&"number"==typeof t.x&&"number"==typeof t.y)return new r(t.x,t.y);throw Error("Wrong Vec2 source")}}class n{size;constructor(t){if(t.x<=0||t.y<=0)throw Error(`Invalid grid size: width and height must be positive (got ${t.x}x${t.y})`);this.size=t}getIndexFromVec(t){return n.getIndexFromVec(t,this.size.width)}getVecFromIndex(t){return n.getVecFromIndex(t,this.size.width)}isBlack(t){return!!((t.x+t.y)%2)}isWhite(t){return!((t.x+t.y)%2)}isInGrid(t){return n.isInGrid(t,this.size)}static getVecFromIndex(t,e){const i=e instanceof r?e.width:e;return new r(t%i,Math.floor(t/i))}static getIndexFromVec(t,e){return t.y*(e instanceof r?e.width:e)+t.x}static isInGrid(t,e){return t.x>=0&&e.x>t.x&&t.y>=0&&e.y>t.y}static getOrtoSiblings(t,e){return[new r(-1,0),new r(1,0),new r(0,-1),new r(0,1)].map((e=>e.add(t))).filter((t=>n.isInGrid(t,e)))}}const h=e(class extends i{constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow()}size=new r(3,3);tiles=[];async checkAnswer(){return this.tiles.every((t=>t.position===t.correctPosition))}getTileById(t){const e=this.tiles.find((e=>e.id===t));if(!e)throw Error("Tile not found");return e}onTileClicked(t){const e=this.getTileById(t),i=n.getVecFromIndex(e.position,this.size.width),s=n.getOrtoSiblings(i,this.size).find((t=>{const e=n.getIndexFromVec(t,this.size.width);return this.tiles.every((t=>t.position!==e))}));s&&this.setTilePosition(e,n.getIndexFromVec(s,this.size))}setTilePosition(t,e){const i="string"==typeof t?t:t.id;this.tiles=this.tiles.map((t=>t.id!==i?t:{...t,position:e}))}render(){return s("div",{key:"b22497e26d2ce6f7aeadc788f9475bb9fcd92e76",class:"board",style:{"--width":""+this.size.width,"--height":""+this.size.height}},this.tiles.map((t=>{const e=n.getVecFromIndex(t.position,this.size.width);return s("button",{key:t.id,class:"tile",style:{"--x":""+e.x,"--y":""+e.y},onClick:this.onTileClicked.bind(this,t.id)},s("img",{src:t.imageSrc,alt:""}))})))}static get style(){return".board{width:100%;height:100%;display:inline-block;aspect-ratio:calc(var(--width, 1) / var(--height, 1));border:1px solid black;position:relative;container-type:size}.tile{position:absolute;width:calc(100cqw / var(--width, 1));height:calc(100cqh / var(--height, 1));padding:0;border:none;transform:translate(calc(100% * var(--x)), calc(100% * var(--y)));transition:transform 0.5s}.tile img{display:block;width:100%;height:100%;pointer-events:none}"}},[513,"mb-sliding-puzzle",{tiles:[1040],size:[32],checkAnswer:[64]}]);function o(){"undefined"!=typeof customElements&&["mb-sliding-puzzle"].forEach((e=>{"mb-sliding-puzzle"===e&&(customElements.get(t(e))||customElements.define(t(e),h))}))}o();const c=h,a=o;export{c as MbSlidingPuzzle,a as defineCustomElement}
|