@mulanjs/mulanjs 1.0.1-dev.20260212143840
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/LICENSE +21 -0
- package/README.md +1 -0
- package/dist/compiler/compiler.js +90 -0
- package/dist/compiler/script-compiler.js +314 -0
- package/dist/compiler/sfc-parser.js +93 -0
- package/dist/compiler/style-compiler.js +56 -0
- package/dist/compiler/template-compiler.js +442 -0
- package/dist/components/bloch-sphere.js +252 -0
- package/dist/core/component.js +145 -0
- package/dist/core/hooks.js +229 -0
- package/dist/core/quantum.js +284 -0
- package/dist/core/query.js +63 -0
- package/dist/core/reactive.js +105 -0
- package/dist/core/renderer.js +70 -0
- package/dist/core/vault.js +81 -0
- package/dist/index.js +52 -0
- package/dist/mulan.esm.js +1948 -0
- package/dist/mulan.js +215 -0
- package/dist/router/index.js +210 -0
- package/dist/security/sanitizer.js +47 -0
- package/dist/store/index.js +42 -0
- package/dist/types/compiler/compiler.d.ts +7 -0
- package/dist/types/compiler/script-compiler.d.ts +8 -0
- package/dist/types/compiler/sfc-parser.d.ts +21 -0
- package/dist/types/compiler/style-compiler.d.ts +7 -0
- package/dist/types/compiler/template-compiler.d.ts +7 -0
- package/dist/types/compiler.d.ts +7 -0
- package/dist/types/components/bloch-sphere.d.ts +16 -0
- package/dist/types/core/component.d.ts +54 -0
- package/dist/types/core/hooks.d.ts +49 -0
- package/dist/types/core/quantum.d.ts +50 -0
- package/dist/types/core/query.d.ts +14 -0
- package/dist/types/core/reactive.d.ts +21 -0
- package/dist/types/core/renderer.d.ts +4 -0
- package/dist/types/core/vault.d.ts +12 -0
- package/dist/types/index.d.ts +70 -0
- package/dist/types/router/index.d.ts +24 -0
- package/dist/types/script-compiler.d.ts +8 -0
- package/dist/types/security/sanitizer.d.ts +17 -0
- package/dist/types/sfc-parser.d.ts +21 -0
- package/dist/types/store/index.d.ts +10 -0
- package/dist/types/style-compiler.d.ts +7 -0
- package/dist/types/template-compiler.d.ts +7 -0
- package/package.json +64 -0
- package/src/cli/extensions/mulanjs-vscode-1.0.0.vsix +0 -0
- package/src/cli/index.js +600 -0
- package/src/compiler/compiler.ts +102 -0
- package/src/compiler/script-compiler.ts +336 -0
- package/src/compiler/sfc-parser.ts +118 -0
- package/src/compiler/style-compiler.ts +66 -0
- package/src/compiler/template-compiler.ts +519 -0
- package/src/compiler/tsconfig.json +13 -0
- package/src/loader/index.js +81 -0
|
@@ -0,0 +1,1948 @@
|
|
|
1
|
+
/******/ var __webpack_modules__ = ({
|
|
2
|
+
|
|
3
|
+
/***/ "./src/components/bloch-sphere.ts"
|
|
4
|
+
/*!****************************************!*\
|
|
5
|
+
!*** ./src/components/bloch-sphere.ts ***!
|
|
6
|
+
\****************************************/
|
|
7
|
+
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
8
|
+
|
|
9
|
+
__webpack_require__.r(__webpack_exports__);
|
|
10
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
11
|
+
/* harmony export */ MuBlochSphereElement: () => (/* binding */ MuBlochSphereElement)
|
|
12
|
+
/* harmony export */ });
|
|
13
|
+
/* harmony import */ var _core_reactive__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../core/reactive */ "./src/core/reactive.ts");
|
|
14
|
+
|
|
15
|
+
class MuBlochSphereElement extends HTMLElement {
|
|
16
|
+
static get observedAttributes() {
|
|
17
|
+
return ['size'];
|
|
18
|
+
}
|
|
19
|
+
constructor() {
|
|
20
|
+
super();
|
|
21
|
+
this._arrow = null;
|
|
22
|
+
this._container = null;
|
|
23
|
+
this._disposeEffect = null;
|
|
24
|
+
this.attachShadow({ mode: 'open' });
|
|
25
|
+
}
|
|
26
|
+
connectedCallback() {
|
|
27
|
+
this.render();
|
|
28
|
+
}
|
|
29
|
+
disconnectedCallback() {
|
|
30
|
+
if (this._disposeEffect) {
|
|
31
|
+
this._disposeEffect();
|
|
32
|
+
this._disposeEffect = null;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
// Property setter for 'qubit' (passed as .qubit="${q}" in Mulan)
|
|
36
|
+
set qubit(val) {
|
|
37
|
+
this._qubit = val;
|
|
38
|
+
this.initReactivity();
|
|
39
|
+
}
|
|
40
|
+
get qubit() {
|
|
41
|
+
return this._qubit;
|
|
42
|
+
}
|
|
43
|
+
attributeChangedCallback(name, oldValue, newValue) {
|
|
44
|
+
if (name === 'size' && this._container) {
|
|
45
|
+
this._container.style.width = newValue + 'px';
|
|
46
|
+
this._container.style.height = newValue + 'px';
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
initReactivity() {
|
|
50
|
+
if (this._disposeEffect)
|
|
51
|
+
this._disposeEffect();
|
|
52
|
+
if (!this._qubit)
|
|
53
|
+
return;
|
|
54
|
+
// MulanJS Effect: Run whenever the qubit state changes
|
|
55
|
+
this._disposeEffect = (0,_core_reactive__WEBPACK_IMPORTED_MODULE_0__.effect)(() => {
|
|
56
|
+
const state = this._qubit.value; // Access reactive proxy
|
|
57
|
+
if (!state || !state.amplitudes)
|
|
58
|
+
return;
|
|
59
|
+
// Assume Single Qubit for Visualizer (Index 0 if passed a register)
|
|
60
|
+
// If passed a register, we visualize the first qubit's logical projection (partial trace simplified)
|
|
61
|
+
// Or assume input IS a specific qubit projection?
|
|
62
|
+
// For simplified demo, we assume the register is size 1 OR we visualize Q0 of the register.
|
|
63
|
+
const amps = state.amplitudes;
|
|
64
|
+
// Support 1-qubit visualization from N-qubit register requires partial trace.
|
|
65
|
+
// For now, let's assume the user passes a 1-qubit register OR we visualize index 0.
|
|
66
|
+
// |psi> = a|0> + b|1>
|
|
67
|
+
// a = amps[0] (re, im)
|
|
68
|
+
// b = amps[1] (re, im)
|
|
69
|
+
// Dealing with multi-qubit registers (naive projection for visualization):
|
|
70
|
+
// We sum up probabilities for 0xxxx vs 1xxxx to get Z-axis.
|
|
71
|
+
// This is "marginal probability".
|
|
72
|
+
let p0 = 0;
|
|
73
|
+
let p1 = 0;
|
|
74
|
+
// Calculate Probabilities
|
|
75
|
+
for (let i = 0; i < amps.length; i++) {
|
|
76
|
+
const mag = amps[i].re * amps[i].re + amps[i].im * amps[i].im;
|
|
77
|
+
if ((i & 1) === 0)
|
|
78
|
+
p0 += mag;
|
|
79
|
+
else
|
|
80
|
+
p1 += mag;
|
|
81
|
+
}
|
|
82
|
+
// Theta from Z-projection
|
|
83
|
+
// P0 = cos^2(theta/2) -> theta = 2 * acos(sqrt(P0))
|
|
84
|
+
const theta = 2 * Math.acos(Math.min(1, Math.sqrt(p0)));
|
|
85
|
+
// Phi?
|
|
86
|
+
// Phase is relative phase between |0> and |1>.
|
|
87
|
+
// We can look at the phase of the '1' component relative to '0'.
|
|
88
|
+
// Simple approach: Look at amps[1] phase vs amps[0] phase.
|
|
89
|
+
// But with entanglement, pure state phase is tricky.
|
|
90
|
+
// Let's implement full density matrix if needed, but for now:
|
|
91
|
+
// naive: atan2(amps[1].im, amps[1].re) - atan2(amps[0].im, amps[0].re)
|
|
92
|
+
// We use the first pair (0 and 1) as proxy if multiple.
|
|
93
|
+
const a0 = amps[0];
|
|
94
|
+
const a1 = amps[1]; // Valid for N>=1
|
|
95
|
+
const phase0 = Math.atan2(a0.im, a0.re);
|
|
96
|
+
const phase1 = Math.atan2(a1.im, a1.re);
|
|
97
|
+
let phi = phase1 - phase0;
|
|
98
|
+
// Update Arrow
|
|
99
|
+
this.updateArrow(theta, phi);
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
updateArrow(theta, phi) {
|
|
103
|
+
if (!this._arrow)
|
|
104
|
+
return;
|
|
105
|
+
// Convert Quantum Coords (Theta, Phi) to CSS Transforms
|
|
106
|
+
// Theta 0 = Top (|0>)
|
|
107
|
+
// Theta PI = Bottom (|1>)
|
|
108
|
+
// Theta PI/2 = Equator
|
|
109
|
+
// CSS Rotate sequence:
|
|
110
|
+
// 1. Start pointing UP (Y or Z axis in CSS?)
|
|
111
|
+
// Let's say Arrow starts pointing UP (Y-).
|
|
112
|
+
// Rotate Z by Phi (Azimuth)
|
|
113
|
+
// Rotate X by Theta (Polar) - No, that's not standard Euler.
|
|
114
|
+
// Standard Physics:
|
|
115
|
+
// Z is Up (in Bloch), but CSS 3D Y is usually 'Down' or 'Up'.
|
|
116
|
+
// Let's Map:
|
|
117
|
+
// Bloch Z+ (|0>) -> CSS Y- (Top)
|
|
118
|
+
// Bloch Z- (|1>) -> CSS Y+ (Bottom)
|
|
119
|
+
// Bloch X+ (|+>) -> CSS Z+ (Front)
|
|
120
|
+
// Transform:
|
|
121
|
+
// rotateY(phi) ? No, phi rotates around Z-axis (Vertical).
|
|
122
|
+
// theta rotates from Z-axis down.
|
|
123
|
+
// CSS:
|
|
124
|
+
// rotateY(phi) -> Rotates around Vertical axis.
|
|
125
|
+
// rotateZ(theta) -> Rotates "down" from up?
|
|
126
|
+
// Let's simplify:
|
|
127
|
+
// transform: rotateY(${phi}rad) rotateZ(${theta}rad)
|
|
128
|
+
// Note: CSS rotations order matters.
|
|
129
|
+
const degTheta = theta * (180 / Math.PI);
|
|
130
|
+
const degPhi = phi * (180 / Math.PI);
|
|
131
|
+
// Adjustment for visual alignment
|
|
132
|
+
this._arrow.style.transform = `rotateY(${degPhi}deg) rotateZ(${degTheta}deg)`;
|
|
133
|
+
// Color based on state
|
|
134
|
+
const isSuperposition = Math.abs(theta - Math.PI / 2) < 0.1;
|
|
135
|
+
this._arrow.style.backgroundColor = isSuperposition ? '#00ffff' : '#ff00ff';
|
|
136
|
+
}
|
|
137
|
+
render() {
|
|
138
|
+
if (!this.shadowRoot)
|
|
139
|
+
return;
|
|
140
|
+
const size = this.getAttribute('size') || '200';
|
|
141
|
+
this.shadowRoot.innerHTML = `
|
|
142
|
+
<style>
|
|
143
|
+
:host {
|
|
144
|
+
display: inline-block;
|
|
145
|
+
perspective: 1000px;
|
|
146
|
+
}
|
|
147
|
+
.sphere-container {
|
|
148
|
+
width: ${size}px;
|
|
149
|
+
height: ${size}px;
|
|
150
|
+
position: relative;
|
|
151
|
+
transform-style: preserve-3d;
|
|
152
|
+
margin: 0 auto;
|
|
153
|
+
}
|
|
154
|
+
.sphere {
|
|
155
|
+
width: 100%;
|
|
156
|
+
height: 100%;
|
|
157
|
+
border-radius: 50%;
|
|
158
|
+
border: 1px solid rgba(255, 255, 255, 0.2);
|
|
159
|
+
position: absolute;
|
|
160
|
+
background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.1), rgba(0, 0, 0, 0.8));
|
|
161
|
+
box-shadow: inset 0 0 20px rgba(255, 255, 255, 0.05);
|
|
162
|
+
transform: rotateX(15deg) rotateY(15deg); /* Initial tilt for view */
|
|
163
|
+
}
|
|
164
|
+
/* Equator Ring */
|
|
165
|
+
.equator {
|
|
166
|
+
position: absolute;
|
|
167
|
+
top: 50%;
|
|
168
|
+
left: 0;
|
|
169
|
+
width: 100%;
|
|
170
|
+
height: 100%;
|
|
171
|
+
border: 1px dashed rgba(255, 255, 255, 0.3);
|
|
172
|
+
border-radius: 50%;
|
|
173
|
+
transform: rotateX(90deg);
|
|
174
|
+
pointer-events: none;
|
|
175
|
+
}
|
|
176
|
+
/* Axis Lines */
|
|
177
|
+
.axis {
|
|
178
|
+
position: absolute;
|
|
179
|
+
background: rgba(255, 255, 255, 0.1);
|
|
180
|
+
}
|
|
181
|
+
.z-axis { width: 2px; height: 100%; left: 50%; top: 0; }
|
|
182
|
+
|
|
183
|
+
/* The Quantum Arrow */
|
|
184
|
+
.arrow-container {
|
|
185
|
+
position: absolute;
|
|
186
|
+
top: 50%;
|
|
187
|
+
left: 50%;
|
|
188
|
+
width: 0;
|
|
189
|
+
height: 0;
|
|
190
|
+
transform-style: preserve-3d;
|
|
191
|
+
transform: rotateX(15deg) rotateY(15deg); /* Match sphere tilt */
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
.arrow-pivot {
|
|
195
|
+
position: absolute;
|
|
196
|
+
top: 0;
|
|
197
|
+
left: 0;
|
|
198
|
+
width: 4px;
|
|
199
|
+
height: 50%; /* Length of radius */
|
|
200
|
+
/* Pivot logic: we want to rotate around the center point */
|
|
201
|
+
/* CSS Default transform-origin is 50% 50% */
|
|
202
|
+
/* We construct the arrow such that it points UP from center */
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
.arrow-rod {
|
|
206
|
+
width: 4px;
|
|
207
|
+
height: ${parseInt(size) / 2 - 10}px;
|
|
208
|
+
background: #ff00ff;
|
|
209
|
+
position: absolute;
|
|
210
|
+
bottom: 0;
|
|
211
|
+
left: -2px;
|
|
212
|
+
transform-origin: bottom center;
|
|
213
|
+
transition: transform 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275), background-color 0.3s;
|
|
214
|
+
border-radius: 2px;
|
|
215
|
+
box-shadow: 0 0 10px currentColor;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
.arrow-head {
|
|
219
|
+
width: 0;
|
|
220
|
+
height: 0;
|
|
221
|
+
border-left: 6px solid transparent;
|
|
222
|
+
border-right: 6px solid transparent;
|
|
223
|
+
border-bottom: 12px solid #ff00ff;
|
|
224
|
+
position: absolute;
|
|
225
|
+
top: -10px;
|
|
226
|
+
left: -6px;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
.label {
|
|
230
|
+
position: absolute;
|
|
231
|
+
color: #aaa;
|
|
232
|
+
font-family: monospace;
|
|
233
|
+
font-size: 10px;
|
|
234
|
+
}
|
|
235
|
+
.label-0 { top: 5px; left: 50%; transform: translateX(-50%); }
|
|
236
|
+
.label-1 { bottom: 5px; left: 50%; transform: translateX(-50%); }
|
|
237
|
+
</style>
|
|
238
|
+
|
|
239
|
+
<div class="sphere-container">
|
|
240
|
+
<div class="sphere">
|
|
241
|
+
<div class="equator"></div>
|
|
242
|
+
<div class="axis z-axis"></div>
|
|
243
|
+
<div class="label label-0">|0></div>
|
|
244
|
+
<div class="label label-1">|1></div>
|
|
245
|
+
</div>
|
|
246
|
+
|
|
247
|
+
<div class="arrow-container">
|
|
248
|
+
<!-- The rod is the actual rotating element -->
|
|
249
|
+
<div class="arrow-rod">
|
|
250
|
+
<div class="arrow-head"></div>
|
|
251
|
+
</div>
|
|
252
|
+
</div>
|
|
253
|
+
</div>
|
|
254
|
+
`;
|
|
255
|
+
this._container = this.shadowRoot.querySelector('.sphere-container');
|
|
256
|
+
this._arrow = this.shadowRoot.querySelector('.arrow-rod');
|
|
257
|
+
// Re-init reactivity if qubit was set before render
|
|
258
|
+
if (this._qubit)
|
|
259
|
+
this.initReactivity();
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
// Register the custom element
|
|
263
|
+
if (typeof customElements !== 'undefined') {
|
|
264
|
+
customElements.define('mu-bloch-sphere', MuBlochSphereElement);
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
|
|
268
|
+
/***/ },
|
|
269
|
+
|
|
270
|
+
/***/ "./src/core/component.ts"
|
|
271
|
+
/*!*******************************!*\
|
|
272
|
+
!*** ./src/core/component.ts ***!
|
|
273
|
+
\*******************************/
|
|
274
|
+
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
275
|
+
|
|
276
|
+
__webpack_require__.r(__webpack_exports__);
|
|
277
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
278
|
+
/* harmony export */ MuComponent: () => (/* binding */ MuComponent),
|
|
279
|
+
/* harmony export */ defineComponent: () => (/* binding */ defineComponent)
|
|
280
|
+
/* harmony export */ });
|
|
281
|
+
/* harmony import */ var _renderer__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./renderer */ "./src/core/renderer.ts");
|
|
282
|
+
/* harmony import */ var _hooks__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./hooks */ "./src/core/hooks.ts");
|
|
283
|
+
/* harmony import */ var _reactive__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./reactive */ "./src/core/reactive.ts");
|
|
284
|
+
|
|
285
|
+
|
|
286
|
+
|
|
287
|
+
// Or a simple component that returns an object of state/methods used by template?
|
|
288
|
+
// For Mulan 2.0, let's say functional component returns a template string render function explicitly.
|
|
289
|
+
class MuComponent {
|
|
290
|
+
constructor(container) {
|
|
291
|
+
this._hooks = {};
|
|
292
|
+
this._effects = [];
|
|
293
|
+
this._isDestroyed = false;
|
|
294
|
+
this._propsQueue = [];
|
|
295
|
+
this._eventQueue = [];
|
|
296
|
+
this.container = container;
|
|
297
|
+
this.state = {};
|
|
298
|
+
this.$uid = 'mu_' + Math.random().toString(36).substr(2, 9);
|
|
299
|
+
// MULAN INSIGHT: Global Registry for Debugging
|
|
300
|
+
if (typeof window !== 'undefined') {
|
|
301
|
+
const global = window;
|
|
302
|
+
global.__MULAN_INSIGHT__ = global.__MULAN_INSIGHT__ || { components: new Map() };
|
|
303
|
+
global.__MULAN_INSIGHT__.components.set(this.$uid, this);
|
|
304
|
+
}
|
|
305
|
+
// Setup context for hooks
|
|
306
|
+
(0,_hooks__WEBPACK_IMPORTED_MODULE_1__.setCurrentInstance)(this);
|
|
307
|
+
this.setup();
|
|
308
|
+
(0,_hooks__WEBPACK_IMPORTED_MODULE_1__.setCurrentInstance)(null);
|
|
309
|
+
}
|
|
310
|
+
// Optional setup method for class components wanting to use hooks
|
|
311
|
+
setup() { }
|
|
312
|
+
onMount() {
|
|
313
|
+
var _a, _c;
|
|
314
|
+
// Mulan Cycle: Init
|
|
315
|
+
(_a = this._hooks.onMuInit) === null || _a === void 0 ? void 0 : _a.forEach(fn => fn());
|
|
316
|
+
// Mulan Cycle: Mount (Simulated immediately after init for now in this version)
|
|
317
|
+
(_c = this._hooks.onMuMount) === null || _c === void 0 ? void 0 : _c.forEach(fn => fn());
|
|
318
|
+
}
|
|
319
|
+
onUpdate() { }
|
|
320
|
+
onDestroy() {
|
|
321
|
+
var _a, _c;
|
|
322
|
+
if (this._isDestroyed)
|
|
323
|
+
return;
|
|
324
|
+
this._isDestroyed = true;
|
|
325
|
+
console.log(`[Mulan Cycle] Destroying component ${this.$uid} (${this.constructor.name})`);
|
|
326
|
+
// MULAN INSIGHT: Cleanup
|
|
327
|
+
if (typeof window !== 'undefined') {
|
|
328
|
+
const global = window;
|
|
329
|
+
(_a = global.__MULAN_INSIGHT__) === null || _a === void 0 ? void 0 : _a.components.delete(this.$uid);
|
|
330
|
+
}
|
|
331
|
+
// Mulan Cycle: Stop all effects to prevent leaks
|
|
332
|
+
console.log(`[Mulan Cycle] Stopping ${this._effects.length} effects for ${this.$uid}`);
|
|
333
|
+
this._effects.forEach(stop => stop());
|
|
334
|
+
this._effects = [];
|
|
335
|
+
// Mulan Cycle: Destroy hooks
|
|
336
|
+
(_c = this._hooks.onMuDestroy) === null || _c === void 0 ? void 0 : _c.forEach(fn => fn());
|
|
337
|
+
}
|
|
338
|
+
// Helper for compiler to register property bindings
|
|
339
|
+
_b(id, prop, value) {
|
|
340
|
+
this._propsQueue.push([id, prop, value]);
|
|
341
|
+
return "";
|
|
342
|
+
}
|
|
343
|
+
// Helper for compiler to register event bindings
|
|
344
|
+
_e(id, type, handler) {
|
|
345
|
+
this._eventQueue.push([id, type, handler]);
|
|
346
|
+
return "";
|
|
347
|
+
}
|
|
348
|
+
mount() {
|
|
349
|
+
console.log(`[Mulan Cycle] Mounting component ${this.$uid}`);
|
|
350
|
+
const stop = (0,_reactive__WEBPACK_IMPORTED_MODULE_2__.effect)(() => {
|
|
351
|
+
console.log(`[Mulan Reactivity] Triggering update for ${this.$uid}`);
|
|
352
|
+
this.update();
|
|
353
|
+
});
|
|
354
|
+
this._effects.push(stop);
|
|
355
|
+
this.onMount();
|
|
356
|
+
}
|
|
357
|
+
update() {
|
|
358
|
+
if (this._isDestroyed) {
|
|
359
|
+
console.warn(`[Mulan Warning] Update called on destroyed component ${this.$uid}. Blocking render.`);
|
|
360
|
+
return;
|
|
361
|
+
}
|
|
362
|
+
// Clear queues before render
|
|
363
|
+
this._propsQueue = [];
|
|
364
|
+
this._eventQueue = [];
|
|
365
|
+
const template = this.template();
|
|
366
|
+
// Render HTML
|
|
367
|
+
(0,_renderer__WEBPACK_IMPORTED_MODULE_0__.render)(template, this.container);
|
|
368
|
+
// Flush Side Effects
|
|
369
|
+
this.flushProps();
|
|
370
|
+
this.flushEvents();
|
|
371
|
+
this.onUpdate();
|
|
372
|
+
}
|
|
373
|
+
flushProps() {
|
|
374
|
+
for (const [id, prop, value] of this._propsQueue) {
|
|
375
|
+
const el = this.container.querySelector(`[data-mu-id="${id}"]`);
|
|
376
|
+
if (el) {
|
|
377
|
+
// @ts-ignore
|
|
378
|
+
el[prop] = value;
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
this._propsQueue = [];
|
|
382
|
+
}
|
|
383
|
+
flushEvents() {
|
|
384
|
+
for (const [id, type, handler] of this._eventQueue) {
|
|
385
|
+
const el = this.container.querySelector(`[data-mu-id="${id}"]`);
|
|
386
|
+
if (el) {
|
|
387
|
+
// Bind handler to this component instance to ensure 'this' works in methods
|
|
388
|
+
el.addEventListener(type, handler.bind(this));
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
this._eventQueue = [];
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
// Helper to create functional components wrapped in the class system
|
|
395
|
+
// Helper to create functional components wrapped in the class system
|
|
396
|
+
// Supports both () => render and { setup() } signatures
|
|
397
|
+
function defineComponent(optionsOrSetup) {
|
|
398
|
+
return class UniversalComponent extends MuComponent {
|
|
399
|
+
constructor(container) {
|
|
400
|
+
super(container);
|
|
401
|
+
// setup() is called by super constructor
|
|
402
|
+
}
|
|
403
|
+
setup() {
|
|
404
|
+
let setupResult;
|
|
405
|
+
if (typeof optionsOrSetup === 'function') {
|
|
406
|
+
// It's a setup function returning render fn
|
|
407
|
+
setupResult = optionsOrSetup.call(this);
|
|
408
|
+
}
|
|
409
|
+
else if (typeof optionsOrSetup === 'object' && optionsOrSetup.setup) {
|
|
410
|
+
// It's an options object with setup()
|
|
411
|
+
setupResult = optionsOrSetup.setup.call(this);
|
|
412
|
+
}
|
|
413
|
+
// Handle result
|
|
414
|
+
if (typeof setupResult === 'function') {
|
|
415
|
+
// It's a render function
|
|
416
|
+
this.template = setupResult;
|
|
417
|
+
}
|
|
418
|
+
else if (setupResult && typeof setupResult === 'object') {
|
|
419
|
+
// It's bindings
|
|
420
|
+
Object.assign(this, setupResult);
|
|
421
|
+
// We assume template is assigned to prototype by compiler
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
template() {
|
|
425
|
+
return '';
|
|
426
|
+
}
|
|
427
|
+
};
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
|
|
431
|
+
/***/ },
|
|
432
|
+
|
|
433
|
+
/***/ "./src/core/hooks.ts"
|
|
434
|
+
/*!***************************!*\
|
|
435
|
+
!*** ./src/core/hooks.ts ***!
|
|
436
|
+
\***************************/
|
|
437
|
+
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
438
|
+
|
|
439
|
+
__webpack_require__.r(__webpack_exports__);
|
|
440
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
441
|
+
/* harmony export */ getCurrentInstance: () => (/* binding */ getCurrentInstance),
|
|
442
|
+
/* harmony export */ muEffect: () => (/* binding */ muEffect),
|
|
443
|
+
/* harmony export */ muGeom: () => (/* binding */ muGeom),
|
|
444
|
+
/* harmony export */ muMemo: () => (/* binding */ muMemo),
|
|
445
|
+
/* harmony export */ muPulse: () => (/* binding */ muPulse),
|
|
446
|
+
/* harmony export */ muState: () => (/* binding */ muState),
|
|
447
|
+
/* harmony export */ muVault: () => (/* binding */ muVault),
|
|
448
|
+
/* harmony export */ onMuDestroy: () => (/* binding */ onMuDestroy),
|
|
449
|
+
/* harmony export */ onMuIdle: () => (/* binding */ onMuIdle),
|
|
450
|
+
/* harmony export */ onMuInit: () => (/* binding */ onMuInit),
|
|
451
|
+
/* harmony export */ onMuMount: () => (/* binding */ onMuMount),
|
|
452
|
+
/* harmony export */ onMuResume: () => (/* binding */ onMuResume),
|
|
453
|
+
/* harmony export */ onMuShake: () => (/* binding */ onMuShake),
|
|
454
|
+
/* harmony export */ onMuVoice: () => (/* binding */ onMuVoice),
|
|
455
|
+
/* harmony export */ setCurrentInstance: () => (/* binding */ setCurrentInstance)
|
|
456
|
+
/* harmony export */ });
|
|
457
|
+
/* harmony import */ var _reactive__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./reactive */ "./src/core/reactive.ts");
|
|
458
|
+
/* harmony import */ var _vault__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./vault */ "./src/core/vault.ts");
|
|
459
|
+
|
|
460
|
+
|
|
461
|
+
// Global context to track the current component instance
|
|
462
|
+
let currentInstance = null;
|
|
463
|
+
function setCurrentInstance(instance) {
|
|
464
|
+
currentInstance = instance;
|
|
465
|
+
}
|
|
466
|
+
function getCurrentInstance() {
|
|
467
|
+
return currentInstance;
|
|
468
|
+
}
|
|
469
|
+
// --- Mulan Unique Reactivity Hooks ---
|
|
470
|
+
function muState(initialValue) {
|
|
471
|
+
if (typeof initialValue === 'object' && initialValue !== null) {
|
|
472
|
+
return (0,_reactive__WEBPACK_IMPORTED_MODULE_0__.reactive)(initialValue);
|
|
473
|
+
}
|
|
474
|
+
// Core reactive state container for primitives
|
|
475
|
+
return (0,_reactive__WEBPACK_IMPORTED_MODULE_0__.reactive)({ value: initialValue });
|
|
476
|
+
}
|
|
477
|
+
function muMemo(computeFn) {
|
|
478
|
+
const signal = (0,_reactive__WEBPACK_IMPORTED_MODULE_0__.reactive)({ value: undefined });
|
|
479
|
+
const stop = (0,_reactive__WEBPACK_IMPORTED_MODULE_0__.effect)(() => {
|
|
480
|
+
signal.value = computeFn();
|
|
481
|
+
});
|
|
482
|
+
const instance = getCurrentInstance();
|
|
483
|
+
if (instance) {
|
|
484
|
+
if (!instance._effects)
|
|
485
|
+
instance._effects = [];
|
|
486
|
+
instance._effects.push(stop);
|
|
487
|
+
}
|
|
488
|
+
return signal;
|
|
489
|
+
}
|
|
490
|
+
function muEffect(fn) {
|
|
491
|
+
const stop = (0,_reactive__WEBPACK_IMPORTED_MODULE_0__.effect)(fn);
|
|
492
|
+
const instance = getCurrentInstance();
|
|
493
|
+
if (instance) {
|
|
494
|
+
if (!instance._effects)
|
|
495
|
+
instance._effects = [];
|
|
496
|
+
instance._effects.push(stop);
|
|
497
|
+
}
|
|
498
|
+
}
|
|
499
|
+
// --- The "Mulan Cycle" (Lifecycle) ---
|
|
500
|
+
function onMuInit(fn) {
|
|
501
|
+
const instance = getCurrentInstance();
|
|
502
|
+
if (instance) {
|
|
503
|
+
if (!instance._hooks)
|
|
504
|
+
instance._hooks = {};
|
|
505
|
+
if (!instance._hooks.onMuInit)
|
|
506
|
+
instance._hooks.onMuInit = [];
|
|
507
|
+
instance._hooks.onMuInit.push(fn);
|
|
508
|
+
}
|
|
509
|
+
else {
|
|
510
|
+
console.warn('onMuInit called outside of component setup context.');
|
|
511
|
+
}
|
|
512
|
+
}
|
|
513
|
+
function onMuMount(fn) {
|
|
514
|
+
// New hook for when component is actually in DOM (simulated for now via update)
|
|
515
|
+
const instance = getCurrentInstance();
|
|
516
|
+
if (instance) {
|
|
517
|
+
if (!instance._hooks)
|
|
518
|
+
instance._hooks = {};
|
|
519
|
+
if (!instance._hooks.onMuMount)
|
|
520
|
+
instance._hooks.onMuMount = [];
|
|
521
|
+
instance._hooks.onMuMount.push(fn);
|
|
522
|
+
}
|
|
523
|
+
}
|
|
524
|
+
function onMuDestroy(fn) {
|
|
525
|
+
const instance = getCurrentInstance();
|
|
526
|
+
if (instance) {
|
|
527
|
+
if (!instance._hooks)
|
|
528
|
+
instance._hooks = {};
|
|
529
|
+
if (!instance._hooks.onMuDestroy)
|
|
530
|
+
instance._hooks.onMuDestroy = [];
|
|
531
|
+
instance._hooks.onMuDestroy.push(fn);
|
|
532
|
+
}
|
|
533
|
+
}
|
|
534
|
+
/**
|
|
535
|
+
* onMuIdle - The "Environment Life" Hook.
|
|
536
|
+
* Executes heavy logic ONLY when the browser is taking a nap (idle).
|
|
537
|
+
*/
|
|
538
|
+
function onMuIdle(fn) {
|
|
539
|
+
const instance = getCurrentInstance();
|
|
540
|
+
// Polyfill for Safari/Old Browsers
|
|
541
|
+
const requestIdleCallback = window.requestIdleCallback || function (cb) {
|
|
542
|
+
return setTimeout(() => {
|
|
543
|
+
cb({
|
|
544
|
+
didTimeout: false,
|
|
545
|
+
timeRemaining: function () { return 50; }
|
|
546
|
+
});
|
|
547
|
+
}, 1);
|
|
548
|
+
};
|
|
549
|
+
const cancelIdleCallback = window.cancelIdleCallback || function (id) {
|
|
550
|
+
clearTimeout(id);
|
|
551
|
+
};
|
|
552
|
+
const idleId = requestIdleCallback(() => {
|
|
553
|
+
fn();
|
|
554
|
+
});
|
|
555
|
+
// Auto-cleanup if component dies before idle time
|
|
556
|
+
if (instance) {
|
|
557
|
+
onMuDestroy(() => {
|
|
558
|
+
cancelIdleCallback(idleId);
|
|
559
|
+
});
|
|
560
|
+
}
|
|
561
|
+
}
|
|
562
|
+
/**
|
|
563
|
+
* onMuResume - The "Tab Life" Hook.
|
|
564
|
+
* Executes when the user switches BACK to this tab.
|
|
565
|
+
* Perfect for refreshing data or resuming animations to save battery.
|
|
566
|
+
*/
|
|
567
|
+
function onMuResume(fn) {
|
|
568
|
+
const handler = () => {
|
|
569
|
+
if (document.visibilityState === 'visible') {
|
|
570
|
+
fn();
|
|
571
|
+
}
|
|
572
|
+
};
|
|
573
|
+
document.addEventListener('visibilitychange', handler);
|
|
574
|
+
onMuDestroy(() => document.removeEventListener('visibilitychange', handler));
|
|
575
|
+
}
|
|
576
|
+
/**
|
|
577
|
+
* onMuShake - The "Physical Life" Hook.
|
|
578
|
+
* Executes when the device is shaken.
|
|
579
|
+
* Usage: Undo, Refresh, or "Rage Quit" easter eggs.
|
|
580
|
+
*/
|
|
581
|
+
function onMuShake(fn) {
|
|
582
|
+
// Threshold for shake detection
|
|
583
|
+
const threshold = 15;
|
|
584
|
+
let lastX = 0, lastY = 0, lastZ = 0;
|
|
585
|
+
let lastTime = 0;
|
|
586
|
+
const handler = (e) => {
|
|
587
|
+
const current = e.accelerationIncludingGravity;
|
|
588
|
+
if (!current)
|
|
589
|
+
return;
|
|
590
|
+
const time = Date.now();
|
|
591
|
+
if ((time - lastTime) > 100) {
|
|
592
|
+
const diffTime = time - lastTime;
|
|
593
|
+
lastTime = time;
|
|
594
|
+
const x = current.x || 0;
|
|
595
|
+
const y = current.y || 0;
|
|
596
|
+
const z = current.z || 0;
|
|
597
|
+
const speed = Math.abs(x + y + z - lastX - lastY - lastZ) / diffTime * 10000;
|
|
598
|
+
if (speed > threshold) {
|
|
599
|
+
fn();
|
|
600
|
+
}
|
|
601
|
+
lastX = x;
|
|
602
|
+
lastY = y;
|
|
603
|
+
lastZ = z;
|
|
604
|
+
}
|
|
605
|
+
};
|
|
606
|
+
if (window.DeviceMotionEvent) {
|
|
607
|
+
window.addEventListener('devicemotion', handler);
|
|
608
|
+
onMuDestroy(() => window.removeEventListener('devicemotion', handler));
|
|
609
|
+
}
|
|
610
|
+
else {
|
|
611
|
+
console.warn("[MulanJS] Device Motion not supported on this device.");
|
|
612
|
+
}
|
|
613
|
+
}
|
|
614
|
+
/**
|
|
615
|
+
* onMuVoice - The "Sound Life" Hook.
|
|
616
|
+
* Executes when a specific word is spoken.
|
|
617
|
+
* @param command The word to listen for (e.g., "save", "next")
|
|
618
|
+
* @param fn The action to take
|
|
619
|
+
*/
|
|
620
|
+
function onMuVoice(command, fn) {
|
|
621
|
+
const SpeechRecognition = window.SpeechRecognition || window.webkitSpeechRecognition;
|
|
622
|
+
if (!SpeechRecognition) {
|
|
623
|
+
console.warn("[MulanJS] Voice Control (Web Speech API) not supported in this browser.");
|
|
624
|
+
return;
|
|
625
|
+
}
|
|
626
|
+
const recognition = new SpeechRecognition();
|
|
627
|
+
recognition.continuous = true;
|
|
628
|
+
recognition.lang = 'en-US';
|
|
629
|
+
recognition.interimResults = false;
|
|
630
|
+
recognition.onresult = (event) => {
|
|
631
|
+
const last = event.results.length - 1;
|
|
632
|
+
const spoken = event.results[last][0].transcript.trim().toLowerCase();
|
|
633
|
+
console.log(`[Mulan Voice] Heard: "${spoken}"`);
|
|
634
|
+
if (spoken.includes(command.toLowerCase())) {
|
|
635
|
+
fn();
|
|
636
|
+
}
|
|
637
|
+
};
|
|
638
|
+
recognition.start();
|
|
639
|
+
// Auto-restart if it stops (Continuous listening)
|
|
640
|
+
recognition.onend = () => {
|
|
641
|
+
// Simple check to see if we should still be listening
|
|
642
|
+
// In a real app we might want more control
|
|
643
|
+
// recognition.start();
|
|
644
|
+
};
|
|
645
|
+
onMuDestroy(() => {
|
|
646
|
+
recognition.stop();
|
|
647
|
+
});
|
|
648
|
+
}
|
|
649
|
+
// --- "Outside The Box" Hooks (Mulan Exclusives) ---
|
|
650
|
+
/**
|
|
651
|
+
* muGeom - Tracks window or element dimensions reactively.
|
|
652
|
+
*/
|
|
653
|
+
function muGeom() {
|
|
654
|
+
const dims = muState({ width: window.innerWidth, height: window.innerHeight });
|
|
655
|
+
const handler = () => {
|
|
656
|
+
dims.width = window.innerWidth;
|
|
657
|
+
dims.height = window.innerHeight;
|
|
658
|
+
};
|
|
659
|
+
window.addEventListener('resize', handler);
|
|
660
|
+
// Auto-cleanup
|
|
661
|
+
onMuDestroy(() => {
|
|
662
|
+
window.removeEventListener('resize', handler);
|
|
663
|
+
});
|
|
664
|
+
return dims;
|
|
665
|
+
}
|
|
666
|
+
/**
|
|
667
|
+
* muPulse - Reactive network status.
|
|
668
|
+
*/
|
|
669
|
+
function muPulse() {
|
|
670
|
+
const status = muState({ online: navigator.onLine });
|
|
671
|
+
const setOnline = () => status.online = true;
|
|
672
|
+
const setOffline = () => status.online = false;
|
|
673
|
+
window.addEventListener('online', setOnline);
|
|
674
|
+
window.addEventListener('offline', setOffline);
|
|
675
|
+
onMuDestroy(() => {
|
|
676
|
+
window.removeEventListener('online', setOnline);
|
|
677
|
+
window.removeEventListener('offline', setOffline);
|
|
678
|
+
});
|
|
679
|
+
return status;
|
|
680
|
+
}
|
|
681
|
+
/**
|
|
682
|
+
* muVault - Secure reactive LocalStorage wrapper.
|
|
683
|
+
* Powered by the Iron Fortress persistent primitive.
|
|
684
|
+
*/
|
|
685
|
+
function muVault(key, initial, options = {}) {
|
|
686
|
+
return (0,_vault__WEBPACK_IMPORTED_MODULE_1__.persistent)(key, initial, options);
|
|
687
|
+
}
|
|
688
|
+
|
|
689
|
+
|
|
690
|
+
/***/ },
|
|
691
|
+
|
|
692
|
+
/***/ "./src/core/quantum.ts"
|
|
693
|
+
/*!*****************************!*\
|
|
694
|
+
!*** ./src/core/quantum.ts ***!
|
|
695
|
+
\*****************************/
|
|
696
|
+
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
697
|
+
|
|
698
|
+
__webpack_require__.r(__webpack_exports__);
|
|
699
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
700
|
+
/* harmony export */ muEntangle: () => (/* binding */ muEntangle),
|
|
701
|
+
/* harmony export */ muGate: () => (/* binding */ muGate),
|
|
702
|
+
/* harmony export */ muMeasure: () => (/* binding */ muMeasure),
|
|
703
|
+
/* harmony export */ muQubit: () => (/* binding */ muQubit),
|
|
704
|
+
/* harmony export */ muRegister: () => (/* binding */ muRegister),
|
|
705
|
+
/* harmony export */ muSearch: () => (/* binding */ muSearch),
|
|
706
|
+
/* harmony export */ muTeleport: () => (/* binding */ muTeleport)
|
|
707
|
+
/* harmony export */ });
|
|
708
|
+
/* harmony import */ var _hooks__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./hooks */ "./src/core/hooks.ts");
|
|
709
|
+
|
|
710
|
+
/**
|
|
711
|
+
* Creates a quantum register of size n.
|
|
712
|
+
* State vector will have 2^n amplitudes.
|
|
713
|
+
*/
|
|
714
|
+
function muRegister(n) {
|
|
715
|
+
const numStates = Math.pow(2, n);
|
|
716
|
+
const amplitudes = new Array(numStates).fill(0).map((_, i) => ({
|
|
717
|
+
re: i === 0 ? 1 : 0,
|
|
718
|
+
im: 0
|
|
719
|
+
}));
|
|
720
|
+
return (0,_hooks__WEBPACK_IMPORTED_MODULE_0__.muState)({
|
|
721
|
+
value: {
|
|
722
|
+
size: n,
|
|
723
|
+
amplitudes
|
|
724
|
+
}
|
|
725
|
+
});
|
|
726
|
+
}
|
|
727
|
+
/**
|
|
728
|
+
* Backward compatible muQubit (Single Qubit Register)
|
|
729
|
+
*/
|
|
730
|
+
function muQubit(initial = 0) {
|
|
731
|
+
const q = muRegister(1);
|
|
732
|
+
if (initial === 1) {
|
|
733
|
+
muGate(q, 'X', 0);
|
|
734
|
+
}
|
|
735
|
+
// Add compatibility properties for Phase 1 components
|
|
736
|
+
// These properties are getters that dynamically access the amplitudes array
|
|
737
|
+
Object.defineProperty(q.value, 'alpha', { get: () => q.value.amplitudes[0] });
|
|
738
|
+
Object.defineProperty(q.value, 'beta', { get: () => q.value.amplitudes[1] });
|
|
739
|
+
return q;
|
|
740
|
+
}
|
|
741
|
+
/**
|
|
742
|
+
* Internal helper to update register state while maintaining compatibility
|
|
743
|
+
*/
|
|
744
|
+
function updateState(reg, newState) {
|
|
745
|
+
if (newState.size === 1) {
|
|
746
|
+
// Re-inject compatibility getters for muQubit users
|
|
747
|
+
Object.defineProperty(newState, 'alpha', {
|
|
748
|
+
get: () => newState.amplitudes[0],
|
|
749
|
+
configurable: true,
|
|
750
|
+
enumerable: true
|
|
751
|
+
});
|
|
752
|
+
Object.defineProperty(newState, 'beta', {
|
|
753
|
+
get: () => newState.amplitudes[1],
|
|
754
|
+
configurable: true,
|
|
755
|
+
enumerable: true
|
|
756
|
+
});
|
|
757
|
+
}
|
|
758
|
+
reg.value = newState;
|
|
759
|
+
}
|
|
760
|
+
function muGate(reg, type, target = 0, control) {
|
|
761
|
+
const state = reg.value;
|
|
762
|
+
const n = state.size;
|
|
763
|
+
const amplitudes = state.amplitudes;
|
|
764
|
+
const newAmps = amplitudes.map(a => (Object.assign({}, a)));
|
|
765
|
+
// Helper: Check if all control bits are 1
|
|
766
|
+
const checkControl = (index, ctrl) => {
|
|
767
|
+
if (ctrl === undefined)
|
|
768
|
+
return true;
|
|
769
|
+
if (typeof ctrl === 'number') {
|
|
770
|
+
return ((index >> ctrl) & 1) === 1;
|
|
771
|
+
}
|
|
772
|
+
return ctrl.every(c => ((index >> c) & 1) === 1);
|
|
773
|
+
};
|
|
774
|
+
// SWAP Gate (Unique case: affects 2 targets)
|
|
775
|
+
if (type === 'SWAP') {
|
|
776
|
+
const t1 = target;
|
|
777
|
+
const t2 = control; // SWAP uses control arg as second target
|
|
778
|
+
// Iterate only half to avoid double swapping
|
|
779
|
+
for (let i = 0; i < amplitudes.length; i++) {
|
|
780
|
+
const bit1 = (i >> t1) & 1;
|
|
781
|
+
const bit2 = (i >> t2) & 1;
|
|
782
|
+
if (bit1 !== bit2) {
|
|
783
|
+
// Determine the swap partner index
|
|
784
|
+
// If i has (0,1), partner has (1,0) at those positions
|
|
785
|
+
const partner = i ^ (1 << t1) ^ (1 << t2);
|
|
786
|
+
if (i < partner) {
|
|
787
|
+
const temp = newAmps[i];
|
|
788
|
+
newAmps[i] = newAmps[partner];
|
|
789
|
+
newAmps[partner] = temp;
|
|
790
|
+
}
|
|
791
|
+
}
|
|
792
|
+
}
|
|
793
|
+
updateState(reg, Object.assign(Object.assign({}, state), { amplitudes: newAmps }));
|
|
794
|
+
return;
|
|
795
|
+
}
|
|
796
|
+
// Standard Single-Qubit & Controlled Gates
|
|
797
|
+
if (type === 'H') {
|
|
798
|
+
const s = 1 / Math.sqrt(2);
|
|
799
|
+
const processed = new Set();
|
|
800
|
+
for (let i = 0; i < state.amplitudes.length; i++) {
|
|
801
|
+
if (processed.has(i))
|
|
802
|
+
continue;
|
|
803
|
+
// Check Controls first
|
|
804
|
+
if (!checkControl(i, control))
|
|
805
|
+
continue;
|
|
806
|
+
const targetBit = (i >> target) & 1;
|
|
807
|
+
const pairedIndex = targetBit ? (i & ~(1 << target)) : (i | (1 << target));
|
|
808
|
+
const a = state.amplitudes[i];
|
|
809
|
+
const b = state.amplitudes[pairedIndex];
|
|
810
|
+
if (targetBit === 0) {
|
|
811
|
+
newAmps[i] = { re: s * (a.re + b.re), im: s * (a.im + b.im) };
|
|
812
|
+
newAmps[pairedIndex] = { re: s * (a.re - b.re), im: s * (a.im - b.im) };
|
|
813
|
+
}
|
|
814
|
+
else {
|
|
815
|
+
newAmps[pairedIndex] = { re: s * (b.re + a.re), im: s * (b.im + a.im) };
|
|
816
|
+
newAmps[i] = { re: s * (b.re - a.re), im: s * (b.im - a.im) };
|
|
817
|
+
}
|
|
818
|
+
processed.add(i);
|
|
819
|
+
processed.add(pairedIndex);
|
|
820
|
+
}
|
|
821
|
+
}
|
|
822
|
+
else if (type === 'X' || type === 'CNOT') {
|
|
823
|
+
// CNOT is just Controlled-X
|
|
824
|
+
for (let i = 0; i < amplitudes.length; i++) {
|
|
825
|
+
if (!checkControl(i, control))
|
|
826
|
+
continue;
|
|
827
|
+
const targetBit = (i >> target) & 1;
|
|
828
|
+
const pairedIndex = targetBit ? (i & ~(1 << target)) : (i | (1 << target));
|
|
829
|
+
if (i < pairedIndex) {
|
|
830
|
+
const temp = newAmps[i];
|
|
831
|
+
newAmps[i] = newAmps[pairedIndex];
|
|
832
|
+
newAmps[pairedIndex] = temp;
|
|
833
|
+
}
|
|
834
|
+
}
|
|
835
|
+
}
|
|
836
|
+
else if (type === 'Z' || type === 'CZ') {
|
|
837
|
+
// Z and CZ are Phase Flips
|
|
838
|
+
for (let i = 0; i < amplitudes.length; i++) {
|
|
839
|
+
if (!checkControl(i, control))
|
|
840
|
+
continue;
|
|
841
|
+
const targetBit = (i >> target) & 1;
|
|
842
|
+
// Z Gate acts on |1>
|
|
843
|
+
if (targetBit === 1) {
|
|
844
|
+
newAmps[i] = { re: -amplitudes[i].re, im: -amplitudes[i].im };
|
|
845
|
+
}
|
|
846
|
+
}
|
|
847
|
+
}
|
|
848
|
+
else if (type === 'Y') {
|
|
849
|
+
// Y: |0> -> i|1>, |1> -> -i|0>
|
|
850
|
+
for (let i = 0; i < amplitudes.length; i++) {
|
|
851
|
+
if (!checkControl(i, control))
|
|
852
|
+
continue;
|
|
853
|
+
const targetBit = (i >> target) & 1;
|
|
854
|
+
const pairedIndex = targetBit ? (i & ~(1 << target)) : (i | (1 << target));
|
|
855
|
+
if (i < pairedIndex) {
|
|
856
|
+
// We process pairs (i, pairedIndex) where i has 0 at target, paired has 1
|
|
857
|
+
const a = newAmps[i]; // Coeff of |0>
|
|
858
|
+
const b = newAmps[pairedIndex]; // Coeff of |1>
|
|
859
|
+
// New |0> = -i * Old |1>
|
|
860
|
+
newAmps[i] = { re: b.im, im: -b.re };
|
|
861
|
+
// New |1> = i * Old |0>
|
|
862
|
+
newAmps[pairedIndex] = { re: -a.im, im: a.re };
|
|
863
|
+
}
|
|
864
|
+
}
|
|
865
|
+
}
|
|
866
|
+
updateState(reg, Object.assign(Object.assign({}, state), { amplitudes: newAmps }));
|
|
867
|
+
}
|
|
868
|
+
/**
|
|
869
|
+
* Mulan Search Logic (Grover's Operator)
|
|
870
|
+
* Automatically constructs a multi-controlled Phase Flip (Z) for a specific target state.
|
|
871
|
+
* This is the core of the "Quantum Switch" or "Quantum Search" capability.
|
|
872
|
+
* @param reg Quantum Register
|
|
873
|
+
* @param targetState The integer state to "search" and mark (e.g. 2 for |10>)
|
|
874
|
+
*/
|
|
875
|
+
function muSearch(reg, targetState) {
|
|
876
|
+
const n = reg.value.size;
|
|
877
|
+
const controls = [];
|
|
878
|
+
// 1. Identify which bits are 0 and need wrapping with X gates
|
|
879
|
+
// Logic: To mark |010>, we want C-C-Z to trigger on 111.
|
|
880
|
+
// So we apply X to bits that are 0, then C-C-Z, then X again.
|
|
881
|
+
// We treat the last bit as the 'target' for the Z gate, rest as controls
|
|
882
|
+
const targetQubit = n - 1;
|
|
883
|
+
for (let i = 0; i < n; i++) {
|
|
884
|
+
const bit = (targetState >> i) & 1;
|
|
885
|
+
if (i === targetQubit) {
|
|
886
|
+
// If target bit logic requires 0, we flip it to 1 for the Z gate to work
|
|
887
|
+
if (bit === 0)
|
|
888
|
+
muGate(reg, 'X', i);
|
|
889
|
+
}
|
|
890
|
+
else {
|
|
891
|
+
controls.push(i);
|
|
892
|
+
if (bit === 0)
|
|
893
|
+
muGate(reg, 'X', i);
|
|
894
|
+
}
|
|
895
|
+
}
|
|
896
|
+
// 2. Apply Multi-Controlled Z
|
|
897
|
+
muGate(reg, 'Z', targetQubit, controls);
|
|
898
|
+
// 3. Uncompute (Restore 0s)
|
|
899
|
+
for (let i = 0; i < n; i++) {
|
|
900
|
+
const bit = (targetState >> i) & 1;
|
|
901
|
+
if (bit === 0)
|
|
902
|
+
muGate(reg, 'X', i);
|
|
903
|
+
}
|
|
904
|
+
// --- GROVER DIFFUSER (Amplification) ---
|
|
905
|
+
// This flips the probability amplitudes around the mean, boosting the target state.
|
|
906
|
+
// 1. Apply H to all
|
|
907
|
+
for (let i = 0; i < n; i++)
|
|
908
|
+
muGate(reg, 'H', i);
|
|
909
|
+
// 2. Apply X to all
|
|
910
|
+
for (let i = 0; i < n; i++)
|
|
911
|
+
muGate(reg, 'X', i);
|
|
912
|
+
// 3. Multi-Controlled Z (Reflection about |0...0>)
|
|
913
|
+
// We want to flip phase of |11...1> state after X transformation (which corresponds to |00...0> original)
|
|
914
|
+
// Target is last qubit, controls are 0 to n-2
|
|
915
|
+
const diffControls = [];
|
|
916
|
+
for (let i = 0; i < n - 1; i++)
|
|
917
|
+
diffControls.push(i);
|
|
918
|
+
muGate(reg, 'Z', n - 1, diffControls);
|
|
919
|
+
// 4. Uncompute X
|
|
920
|
+
for (let i = 0; i < n; i++)
|
|
921
|
+
muGate(reg, 'X', i);
|
|
922
|
+
// 5. Uncompute H
|
|
923
|
+
for (let i = 0; i < n; i++)
|
|
924
|
+
muGate(reg, 'H', i);
|
|
925
|
+
}
|
|
926
|
+
function muEntangle(reg, i, j) {
|
|
927
|
+
muGate(reg, 'H', i);
|
|
928
|
+
muGate(reg, 'CNOT', j, i);
|
|
929
|
+
}
|
|
930
|
+
/**
|
|
931
|
+
* Quantum Teleportation Protocol
|
|
932
|
+
* Transfers the state of `msgIdx` to `targetIdx` using `ancillaIdx` as a resource.
|
|
933
|
+
* @param reg Register
|
|
934
|
+
* @param msgIdx The qubit containing the state to teleport (Alice)
|
|
935
|
+
* @param ancillaIdx The helper qubit (Alice's half of entanglement)
|
|
936
|
+
* @param targetIdx The destination qubit (Bob)
|
|
937
|
+
*/
|
|
938
|
+
function muTeleport(reg, msgIdx, ancillaIdx, targetIdx) {
|
|
939
|
+
// 1. Create Bell Pair (Entanglement) between Ancilla and Target
|
|
940
|
+
// Represents the shared link between Alice and Bob
|
|
941
|
+
muEntangle(reg, ancillaIdx, targetIdx);
|
|
942
|
+
// 2. Bell Measurement on Message + Ancilla (Alice's side)
|
|
943
|
+
muGate(reg, 'CNOT', ancillaIdx, msgIdx); // Control: msg, Target: ancilla
|
|
944
|
+
muGate(reg, 'H', msgIdx);
|
|
945
|
+
// 3. Measure Alice's qubits (This collapses them)
|
|
946
|
+
const m1 = muMeasure(reg, msgIdx); // Measures "Z" component
|
|
947
|
+
const m2 = muMeasure(reg, ancillaIdx); // Measures "X" component
|
|
948
|
+
// 4. Classical Communication & Correction (Bob's side)
|
|
949
|
+
// Apply corrections to Target based on measurements
|
|
950
|
+
if (m2 === 1)
|
|
951
|
+
muGate(reg, 'X', targetIdx);
|
|
952
|
+
if (m1 === 1)
|
|
953
|
+
muGate(reg, 'Z', targetIdx);
|
|
954
|
+
}
|
|
955
|
+
/**
|
|
956
|
+
* Measures a specific qubit in the register, collapsing the superposition.
|
|
957
|
+
* @param reg Quantum Register
|
|
958
|
+
* @param target Index of qubit to measure
|
|
959
|
+
* @returns 0 or 1
|
|
960
|
+
*/
|
|
961
|
+
function muMeasure(reg, target = 0) {
|
|
962
|
+
const state = reg.value;
|
|
963
|
+
const amplitudes = state.amplitudes;
|
|
964
|
+
let prob0 = 0;
|
|
965
|
+
// 1. Calculate Probability of |0>
|
|
966
|
+
for (let i = 0; i < amplitudes.length; i++) {
|
|
967
|
+
if (((i >> target) & 1) === 0) {
|
|
968
|
+
const a = amplitudes[i];
|
|
969
|
+
prob0 += (a.re * a.re) + (a.im * a.im);
|
|
970
|
+
}
|
|
971
|
+
}
|
|
972
|
+
// 2. Determine Outcome
|
|
973
|
+
const result = Math.random() < prob0 ? 0 : 1;
|
|
974
|
+
const resultProb = result === 0 ? prob0 : (1 - prob0);
|
|
975
|
+
const normFactor = resultProb > 0 ? (1 / Math.sqrt(resultProb)) : 0;
|
|
976
|
+
// 3. Collapse the State (Wavefunction Collapse)
|
|
977
|
+
const newAmps = amplitudes.map((a, i) => {
|
|
978
|
+
const bit = (i >> target) & 1;
|
|
979
|
+
if (bit !== result) {
|
|
980
|
+
return { re: 0, im: 0 };
|
|
981
|
+
}
|
|
982
|
+
else {
|
|
983
|
+
return { re: a.re * normFactor, im: a.im * normFactor };
|
|
984
|
+
}
|
|
985
|
+
});
|
|
986
|
+
// We need to call updateState to ensure reactivity if specialized getters exist
|
|
987
|
+
// But since this file has updateState internal, we can just call it.
|
|
988
|
+
// However, the internal updateState function needs to be in scope.
|
|
989
|
+
// It is defined at line 60. So we are good.
|
|
990
|
+
updateState(reg, Object.assign(Object.assign({}, state), { amplitudes: newAmps }));
|
|
991
|
+
return result;
|
|
992
|
+
}
|
|
993
|
+
|
|
994
|
+
|
|
995
|
+
/***/ },
|
|
996
|
+
|
|
997
|
+
/***/ "./src/core/query.ts"
|
|
998
|
+
/*!***************************!*\
|
|
999
|
+
!*** ./src/core/query.ts ***!
|
|
1000
|
+
\***************************/
|
|
1001
|
+
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
1002
|
+
|
|
1003
|
+
__webpack_require__.r(__webpack_exports__);
|
|
1004
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
1005
|
+
/* harmony export */ useMutation: () => (/* binding */ useMutation),
|
|
1006
|
+
/* harmony export */ useQuery: () => (/* binding */ useQuery)
|
|
1007
|
+
/* harmony export */ });
|
|
1008
|
+
/* harmony import */ var _reactive__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./reactive */ "./src/core/reactive.ts");
|
|
1009
|
+
var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
1010
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
1011
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
1012
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
1013
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
1014
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
1015
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
1016
|
+
});
|
|
1017
|
+
};
|
|
1018
|
+
|
|
1019
|
+
function useQuery(queryFn, options = { enabled: true }) {
|
|
1020
|
+
const state = (0,_reactive__WEBPACK_IMPORTED_MODULE_0__.reactive)({
|
|
1021
|
+
data: null,
|
|
1022
|
+
isLoading: false,
|
|
1023
|
+
error: null
|
|
1024
|
+
});
|
|
1025
|
+
const execute = () => __awaiter(this, void 0, void 0, function* () {
|
|
1026
|
+
state.isLoading = true;
|
|
1027
|
+
state.error = null;
|
|
1028
|
+
try {
|
|
1029
|
+
const result = yield queryFn();
|
|
1030
|
+
state.data = result;
|
|
1031
|
+
}
|
|
1032
|
+
catch (err) {
|
|
1033
|
+
state.error = err;
|
|
1034
|
+
}
|
|
1035
|
+
finally {
|
|
1036
|
+
state.isLoading = false;
|
|
1037
|
+
}
|
|
1038
|
+
});
|
|
1039
|
+
if (options.enabled) {
|
|
1040
|
+
// Run automatically
|
|
1041
|
+
(0,_reactive__WEBPACK_IMPORTED_MODULE_0__.effect)(() => {
|
|
1042
|
+
// Basic effect wrapper to allow reactivity if queryFn relies on signals
|
|
1043
|
+
execute();
|
|
1044
|
+
});
|
|
1045
|
+
}
|
|
1046
|
+
return Object.assign(Object.assign({}, state), { refetch: execute });
|
|
1047
|
+
}
|
|
1048
|
+
function useMutation(mutationFn) {
|
|
1049
|
+
const state = (0,_reactive__WEBPACK_IMPORTED_MODULE_0__.reactive)({
|
|
1050
|
+
data: null,
|
|
1051
|
+
isLoading: false,
|
|
1052
|
+
error: null
|
|
1053
|
+
});
|
|
1054
|
+
const mutate = (args) => __awaiter(this, void 0, void 0, function* () {
|
|
1055
|
+
state.isLoading = true;
|
|
1056
|
+
state.error = null;
|
|
1057
|
+
try {
|
|
1058
|
+
const result = yield mutationFn(args);
|
|
1059
|
+
state.data = result;
|
|
1060
|
+
return result;
|
|
1061
|
+
}
|
|
1062
|
+
catch (err) {
|
|
1063
|
+
state.error = err;
|
|
1064
|
+
throw err;
|
|
1065
|
+
}
|
|
1066
|
+
finally {
|
|
1067
|
+
state.isLoading = false;
|
|
1068
|
+
}
|
|
1069
|
+
});
|
|
1070
|
+
return Object.assign(Object.assign({}, state), { mutate });
|
|
1071
|
+
}
|
|
1072
|
+
|
|
1073
|
+
|
|
1074
|
+
/***/ },
|
|
1075
|
+
|
|
1076
|
+
/***/ "./src/core/reactive.ts"
|
|
1077
|
+
/*!******************************!*\
|
|
1078
|
+
!*** ./src/core/reactive.ts ***!
|
|
1079
|
+
\******************************/
|
|
1080
|
+
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
1081
|
+
|
|
1082
|
+
__webpack_require__.r(__webpack_exports__);
|
|
1083
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
1084
|
+
/* harmony export */ Signal: () => (/* binding */ Signal),
|
|
1085
|
+
/* harmony export */ effect: () => (/* binding */ effect),
|
|
1086
|
+
/* harmony export */ reactive: () => (/* binding */ reactive),
|
|
1087
|
+
/* harmony export */ ref: () => (/* binding */ ref)
|
|
1088
|
+
/* harmony export */ });
|
|
1089
|
+
// MulanJS 2.0: Signal-Powered Reactivity Engine
|
|
1090
|
+
// "Compatible Surface, World-Class Engine"
|
|
1091
|
+
let activeEffect = null;
|
|
1092
|
+
const targetMap = new WeakMap();
|
|
1093
|
+
// --- Signal Core (The Engine) ---
|
|
1094
|
+
class Signal {
|
|
1095
|
+
constructor(initialValue) {
|
|
1096
|
+
this._subscribers = new Set();
|
|
1097
|
+
this._value = initialValue;
|
|
1098
|
+
}
|
|
1099
|
+
get value() {
|
|
1100
|
+
if (activeEffect) {
|
|
1101
|
+
this._subscribers.add(activeEffect);
|
|
1102
|
+
}
|
|
1103
|
+
return this._value;
|
|
1104
|
+
}
|
|
1105
|
+
set value(newValue) {
|
|
1106
|
+
if (newValue !== this._value) {
|
|
1107
|
+
this._value = newValue;
|
|
1108
|
+
this.notify();
|
|
1109
|
+
}
|
|
1110
|
+
}
|
|
1111
|
+
notify() {
|
|
1112
|
+
this._subscribers.forEach(fn => fn());
|
|
1113
|
+
}
|
|
1114
|
+
}
|
|
1115
|
+
// --- Compatibility Layer (The Surface) ---
|
|
1116
|
+
function effect(fn) {
|
|
1117
|
+
let stopped = false;
|
|
1118
|
+
const run = () => {
|
|
1119
|
+
if (stopped)
|
|
1120
|
+
return;
|
|
1121
|
+
const prev = activeEffect;
|
|
1122
|
+
activeEffect = run;
|
|
1123
|
+
try {
|
|
1124
|
+
fn();
|
|
1125
|
+
}
|
|
1126
|
+
finally {
|
|
1127
|
+
activeEffect = prev;
|
|
1128
|
+
}
|
|
1129
|
+
};
|
|
1130
|
+
run();
|
|
1131
|
+
return () => {
|
|
1132
|
+
stopped = true;
|
|
1133
|
+
};
|
|
1134
|
+
}
|
|
1135
|
+
function track(target, key) {
|
|
1136
|
+
if (activeEffect) {
|
|
1137
|
+
let depsMap = targetMap.get(target);
|
|
1138
|
+
if (!depsMap) {
|
|
1139
|
+
targetMap.set(target, (depsMap = new Map()));
|
|
1140
|
+
}
|
|
1141
|
+
let dep = depsMap.get(key);
|
|
1142
|
+
if (!dep) {
|
|
1143
|
+
depsMap.set(key, (dep = new Set()));
|
|
1144
|
+
}
|
|
1145
|
+
dep.add(activeEffect);
|
|
1146
|
+
}
|
|
1147
|
+
}
|
|
1148
|
+
function trigger(target, key) {
|
|
1149
|
+
const depsMap = targetMap.get(target);
|
|
1150
|
+
if (!depsMap)
|
|
1151
|
+
return;
|
|
1152
|
+
const dep = depsMap.get(key);
|
|
1153
|
+
if (dep) {
|
|
1154
|
+
dep.forEach((fn) => fn());
|
|
1155
|
+
}
|
|
1156
|
+
}
|
|
1157
|
+
/**
|
|
1158
|
+
* Creates a reactive proxy object (Vue-compatible).
|
|
1159
|
+
* Now optimized to respect Mulan Cycle.
|
|
1160
|
+
*/
|
|
1161
|
+
function reactive(target) {
|
|
1162
|
+
return new Proxy(target, {
|
|
1163
|
+
get(obj, prop, receiver) {
|
|
1164
|
+
// IRON FORTRESS: Prototype Pollution Protection (Read)
|
|
1165
|
+
if (prop === '__proto__' || prop === 'constructor' || prop === 'prototype') {
|
|
1166
|
+
return undefined;
|
|
1167
|
+
}
|
|
1168
|
+
track(obj, prop);
|
|
1169
|
+
const val = Reflect.get(obj, prop, receiver);
|
|
1170
|
+
if (val !== null && typeof val === 'object') {
|
|
1171
|
+
return reactive(val);
|
|
1172
|
+
}
|
|
1173
|
+
return val;
|
|
1174
|
+
},
|
|
1175
|
+
set(obj, prop, value, receiver) {
|
|
1176
|
+
// IRON FORTRESS: Prototype Pollution Protection
|
|
1177
|
+
if (prop === '__proto__' || prop === 'constructor' || prop === 'prototype') {
|
|
1178
|
+
console.warn(`[Iron Fortress] Blocked attempt to modify dangerous property: ${String(prop)}`);
|
|
1179
|
+
return false;
|
|
1180
|
+
}
|
|
1181
|
+
const result = Reflect.set(obj, prop, value, receiver);
|
|
1182
|
+
trigger(obj, prop);
|
|
1183
|
+
return result;
|
|
1184
|
+
},
|
|
1185
|
+
});
|
|
1186
|
+
}
|
|
1187
|
+
/**
|
|
1188
|
+
* Creates a standalone reactive reference.
|
|
1189
|
+
* Backed by the Mulan Signal Engine.
|
|
1190
|
+
*/
|
|
1191
|
+
function ref(value) {
|
|
1192
|
+
return new Signal(value);
|
|
1193
|
+
}
|
|
1194
|
+
|
|
1195
|
+
|
|
1196
|
+
/***/ },
|
|
1197
|
+
|
|
1198
|
+
/***/ "./src/core/renderer.ts"
|
|
1199
|
+
/*!******************************!*\
|
|
1200
|
+
!*** ./src/core/renderer.ts ***!
|
|
1201
|
+
\******************************/
|
|
1202
|
+
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
1203
|
+
|
|
1204
|
+
__webpack_require__.r(__webpack_exports__);
|
|
1205
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
1206
|
+
/* harmony export */ hydrate: () => (/* binding */ hydrate),
|
|
1207
|
+
/* harmony export */ render: () => (/* binding */ render),
|
|
1208
|
+
/* harmony export */ renderToString: () => (/* binding */ renderToString),
|
|
1209
|
+
/* harmony export */ sanitize: () => (/* binding */ sanitize)
|
|
1210
|
+
/* harmony export */ });
|
|
1211
|
+
function render(template, container) {
|
|
1212
|
+
// Focus Preservation (The "Mulan Glance" Technique)
|
|
1213
|
+
let focusedId = null;
|
|
1214
|
+
let selectionStart = null;
|
|
1215
|
+
let selectionEnd = null;
|
|
1216
|
+
let preservedValue = null;
|
|
1217
|
+
if (document.activeElement && container.contains(document.activeElement)) {
|
|
1218
|
+
const el = document.activeElement;
|
|
1219
|
+
if (el.hasAttribute('data-mu-id')) {
|
|
1220
|
+
focusedId = el.getAttribute('data-mu-id');
|
|
1221
|
+
if (el instanceof HTMLInputElement || el instanceof HTMLTextAreaElement) {
|
|
1222
|
+
selectionStart = el.selectionStart;
|
|
1223
|
+
selectionEnd = el.selectionEnd;
|
|
1224
|
+
preservedValue = el.value;
|
|
1225
|
+
}
|
|
1226
|
+
}
|
|
1227
|
+
}
|
|
1228
|
+
container.innerHTML = template;
|
|
1229
|
+
// Restore Focus and Value
|
|
1230
|
+
if (focusedId) {
|
|
1231
|
+
const el = container.querySelector(`[data-mu-id="${focusedId}"]`);
|
|
1232
|
+
if (el) {
|
|
1233
|
+
// Restore value first to ensure cursor positioning works correctly
|
|
1234
|
+
if (preservedValue !== null && (el instanceof HTMLInputElement || el instanceof HTMLTextAreaElement)) {
|
|
1235
|
+
el.value = preservedValue;
|
|
1236
|
+
}
|
|
1237
|
+
el.focus();
|
|
1238
|
+
if ((el instanceof HTMLInputElement || el instanceof HTMLTextAreaElement) && selectionStart !== null) {
|
|
1239
|
+
try {
|
|
1240
|
+
el.setSelectionRange(selectionStart, selectionEnd);
|
|
1241
|
+
}
|
|
1242
|
+
catch (e) {
|
|
1243
|
+
// input types that don't support selection (e.g. number/email) might throw
|
|
1244
|
+
}
|
|
1245
|
+
}
|
|
1246
|
+
}
|
|
1247
|
+
}
|
|
1248
|
+
}
|
|
1249
|
+
function hydrate(template, container) {
|
|
1250
|
+
// In a string-based framework, hydration is often just "take over".
|
|
1251
|
+
// For now, we'll verify if the server content matches (simple check)
|
|
1252
|
+
// and then assume control. In a more advanced version, we'd attach listeners without re-rendering.
|
|
1253
|
+
if (container.innerHTML.trim() !== template.trim()) {
|
|
1254
|
+
console.warn('Hydration Mismatch: Server rendered content differs from Client.');
|
|
1255
|
+
container.innerHTML = template; // Fallback to full render
|
|
1256
|
+
}
|
|
1257
|
+
else {
|
|
1258
|
+
// console.log('Hydration Successful.');
|
|
1259
|
+
}
|
|
1260
|
+
// Future: Attach event listeners here if we had a mechanism for it.
|
|
1261
|
+
}
|
|
1262
|
+
function renderToString(template) {
|
|
1263
|
+
// SSR Function: returns the HTML string for the server to send.
|
|
1264
|
+
// Can include additional sanitization or metadata injection here.
|
|
1265
|
+
return template;
|
|
1266
|
+
}
|
|
1267
|
+
function sanitize(str) {
|
|
1268
|
+
// Check if we are in a browser environment
|
|
1269
|
+
if (typeof document !== 'undefined') {
|
|
1270
|
+
const temp = document.createElement('div');
|
|
1271
|
+
temp.textContent = str;
|
|
1272
|
+
return temp.innerHTML;
|
|
1273
|
+
}
|
|
1274
|
+
// Simple SSR fallback sanitizer (rudimentary)
|
|
1275
|
+
return str.replace(/&/g, "&")
|
|
1276
|
+
.replace(/</g, "<")
|
|
1277
|
+
.replace(/>/g, ">")
|
|
1278
|
+
.replace(/"/g, """)
|
|
1279
|
+
.replace(/'/g, "'");
|
|
1280
|
+
}
|
|
1281
|
+
|
|
1282
|
+
|
|
1283
|
+
/***/ },
|
|
1284
|
+
|
|
1285
|
+
/***/ "./src/core/vault.ts"
|
|
1286
|
+
/*!***************************!*\
|
|
1287
|
+
!*** ./src/core/vault.ts ***!
|
|
1288
|
+
\***************************/
|
|
1289
|
+
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
1290
|
+
|
|
1291
|
+
__webpack_require__.r(__webpack_exports__);
|
|
1292
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
1293
|
+
/* harmony export */ persistent: () => (/* binding */ persistent)
|
|
1294
|
+
/* harmony export */ });
|
|
1295
|
+
/* harmony import */ var _hooks__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./hooks */ "./src/core/hooks.ts");
|
|
1296
|
+
/* harmony import */ var _reactive__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./reactive */ "./src/core/reactive.ts");
|
|
1297
|
+
|
|
1298
|
+
|
|
1299
|
+
const MULAN_SECRET = 'b3ast_mulan_s3cur1ty_k3y';
|
|
1300
|
+
function beastXOR(str) {
|
|
1301
|
+
let result = '';
|
|
1302
|
+
for (let i = 0; i < str.length; i++) {
|
|
1303
|
+
result += String.fromCharCode(str.charCodeAt(i) ^ MULAN_SECRET.charCodeAt(i % MULAN_SECRET.length));
|
|
1304
|
+
}
|
|
1305
|
+
return btoa(result);
|
|
1306
|
+
}
|
|
1307
|
+
function beastDecode(encoded) {
|
|
1308
|
+
const str = atob(encoded);
|
|
1309
|
+
let result = '';
|
|
1310
|
+
for (let i = 0; i < str.length; i++) {
|
|
1311
|
+
result += String.fromCharCode(str.charCodeAt(i) ^ MULAN_SECRET.charCodeAt(i % MULAN_SECRET.length));
|
|
1312
|
+
}
|
|
1313
|
+
return result;
|
|
1314
|
+
}
|
|
1315
|
+
/**
|
|
1316
|
+
* Mulan Vault: The World's First Native Persistent State Primitive.
|
|
1317
|
+
* Now fortified with Iron Fortress Obfuscation.
|
|
1318
|
+
*/
|
|
1319
|
+
function persistent(key, initialValue, options = {}) {
|
|
1320
|
+
const storage = options.storage || window.localStorage;
|
|
1321
|
+
// 1. Load from Storage
|
|
1322
|
+
const stored = storage.getItem(key);
|
|
1323
|
+
let startVal = initialValue;
|
|
1324
|
+
if (stored) {
|
|
1325
|
+
try {
|
|
1326
|
+
const raw = options.encrypt ? beastDecode(stored) : stored;
|
|
1327
|
+
startVal = JSON.parse(raw);
|
|
1328
|
+
}
|
|
1329
|
+
catch (e) {
|
|
1330
|
+
console.warn(`[Iron Fortress] Corrupt persistent data for key "${key}", resetting.`);
|
|
1331
|
+
}
|
|
1332
|
+
}
|
|
1333
|
+
// 2. Create Reactive State (Follow muState pattern for consistency)
|
|
1334
|
+
const isObject = typeof startVal === 'object' && startVal !== null;
|
|
1335
|
+
const state = isObject ? (0,_reactive__WEBPACK_IMPORTED_MODULE_1__.reactive)(startVal) : (0,_reactive__WEBPACK_IMPORTED_MODULE_1__.reactive)({ value: startVal });
|
|
1336
|
+
// 3. Auto-Save on Change
|
|
1337
|
+
(0,_hooks__WEBPACK_IMPORTED_MODULE_0__.muEffect)(() => {
|
|
1338
|
+
try {
|
|
1339
|
+
const payload = isObject ? state : state.value;
|
|
1340
|
+
const raw = JSON.stringify(payload);
|
|
1341
|
+
const toSave = options.encrypt ? beastXOR(raw) : raw;
|
|
1342
|
+
storage.setItem(key, toSave);
|
|
1343
|
+
}
|
|
1344
|
+
catch (e) {
|
|
1345
|
+
console.error(`[Iron Fortress] Failed to save key "${key}"`);
|
|
1346
|
+
}
|
|
1347
|
+
});
|
|
1348
|
+
// 4. Sync across Tabs
|
|
1349
|
+
const sync = (e) => {
|
|
1350
|
+
if (e.key === key && e.newValue) {
|
|
1351
|
+
try {
|
|
1352
|
+
const raw = options.encrypt ? beastDecode(e.newValue) : e.newValue;
|
|
1353
|
+
const newVal = JSON.parse(raw);
|
|
1354
|
+
if (isObject) {
|
|
1355
|
+
Object.assign(state, newVal);
|
|
1356
|
+
}
|
|
1357
|
+
else {
|
|
1358
|
+
state.value = newVal;
|
|
1359
|
+
}
|
|
1360
|
+
}
|
|
1361
|
+
catch (e) { }
|
|
1362
|
+
}
|
|
1363
|
+
};
|
|
1364
|
+
window.addEventListener('storage', sync);
|
|
1365
|
+
// Auto-cleanup if used inside a component
|
|
1366
|
+
try {
|
|
1367
|
+
const { onMuDestroy } = __webpack_require__(/*! ./hooks */ "./src/core/hooks.ts");
|
|
1368
|
+
onMuDestroy(() => {
|
|
1369
|
+
window.removeEventListener('storage', sync);
|
|
1370
|
+
});
|
|
1371
|
+
}
|
|
1372
|
+
catch (e) {
|
|
1373
|
+
// muVault might be used outside component setup in some advanced cases,
|
|
1374
|
+
// fallback to manual or no-cleanup if so.
|
|
1375
|
+
}
|
|
1376
|
+
return state;
|
|
1377
|
+
}
|
|
1378
|
+
|
|
1379
|
+
|
|
1380
|
+
/***/ },
|
|
1381
|
+
|
|
1382
|
+
/***/ "./src/router/index.ts"
|
|
1383
|
+
/*!*****************************!*\
|
|
1384
|
+
!*** ./src/router/index.ts ***!
|
|
1385
|
+
\*****************************/
|
|
1386
|
+
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
1387
|
+
|
|
1388
|
+
__webpack_require__.r(__webpack_exports__);
|
|
1389
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
1390
|
+
/* harmony export */ MuRouter: () => (/* binding */ MuRouter),
|
|
1391
|
+
/* harmony export */ createRouter: () => (/* binding */ createRouter)
|
|
1392
|
+
/* harmony export */ });
|
|
1393
|
+
/* harmony import */ var _core_renderer__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../core/renderer */ "./src/core/renderer.ts");
|
|
1394
|
+
/* harmony import */ var _security_sanitizer__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../security/sanitizer */ "./src/security/sanitizer.ts");
|
|
1395
|
+
var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
1396
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
1397
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
1398
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
1399
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
1400
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
1401
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
1402
|
+
});
|
|
1403
|
+
};
|
|
1404
|
+
|
|
1405
|
+
|
|
1406
|
+
class MuRouter {
|
|
1407
|
+
constructor(routes, rootContainer = null) {
|
|
1408
|
+
this.currentPath = '';
|
|
1409
|
+
this.currentComponent = null;
|
|
1410
|
+
this.lastRouteId = 0;
|
|
1411
|
+
this.routes = routes;
|
|
1412
|
+
this.rootContainer = rootContainer;
|
|
1413
|
+
this.isServer = rootContainer === null; // If no container, assume server/headless mode
|
|
1414
|
+
if (!this.isServer) {
|
|
1415
|
+
window.addEventListener('hashchange', this.handleRoute.bind(this));
|
|
1416
|
+
this.handleRoute(); // Initial load
|
|
1417
|
+
}
|
|
1418
|
+
}
|
|
1419
|
+
// SSR Method: Simulate a route visit on the server
|
|
1420
|
+
serverLookup(path) {
|
|
1421
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1422
|
+
this.currentPath = path;
|
|
1423
|
+
const { route, params } = this.matchRoute(path);
|
|
1424
|
+
if (route) {
|
|
1425
|
+
// Run guards/resolvers here if needed
|
|
1426
|
+
let componentToRender = route.component;
|
|
1427
|
+
// Support Lazy Loading
|
|
1428
|
+
if (typeof componentToRender === 'function' && !componentToRender.prototype) {
|
|
1429
|
+
const module = yield componentToRender();
|
|
1430
|
+
componentToRender = module.default || module;
|
|
1431
|
+
}
|
|
1432
|
+
if (typeof componentToRender === 'function') {
|
|
1433
|
+
// Class component SSR
|
|
1434
|
+
// We need a dummy container for the component to "render" into its own buffer
|
|
1435
|
+
// For simplicity in this string-based framework, we mock the container
|
|
1436
|
+
const mockContainer = { innerHTML: '' };
|
|
1437
|
+
const instance = new componentToRender(mockContainer);
|
|
1438
|
+
if (instance.setParams)
|
|
1439
|
+
instance.setParams(params);
|
|
1440
|
+
// Manually trigger mount logic without DOM effects if possible, or just template()
|
|
1441
|
+
// Ideally, we just want the template string.
|
|
1442
|
+
return instance.template();
|
|
1443
|
+
}
|
|
1444
|
+
else {
|
|
1445
|
+
return componentToRender;
|
|
1446
|
+
}
|
|
1447
|
+
}
|
|
1448
|
+
return '<!-- 404 -->';
|
|
1449
|
+
});
|
|
1450
|
+
}
|
|
1451
|
+
matchRoute(hash) {
|
|
1452
|
+
// Simple exact match first
|
|
1453
|
+
let route = this.routes.find((r) => r.path === hash);
|
|
1454
|
+
if (route)
|
|
1455
|
+
return { route, params: {} };
|
|
1456
|
+
// Regex match for params e.g. /user/:id
|
|
1457
|
+
for (const r of this.routes) {
|
|
1458
|
+
const paramNames = [];
|
|
1459
|
+
const regexPath = r.path.replace(/:([^/]+)/g, (_, key) => {
|
|
1460
|
+
paramNames.push(key);
|
|
1461
|
+
return '([^/]+)';
|
|
1462
|
+
});
|
|
1463
|
+
const match = new RegExp(`^${regexPath}$`).exec(hash);
|
|
1464
|
+
if (match) {
|
|
1465
|
+
const params = {};
|
|
1466
|
+
paramNames.forEach((name, i) => {
|
|
1467
|
+
// SECURE: Automatically sanitize all route parameters
|
|
1468
|
+
params[name] = _security_sanitizer__WEBPACK_IMPORTED_MODULE_1__.Security.sanitize(match[i + 1]);
|
|
1469
|
+
});
|
|
1470
|
+
return { route: r, params };
|
|
1471
|
+
}
|
|
1472
|
+
}
|
|
1473
|
+
return { route: undefined, params: {} };
|
|
1474
|
+
}
|
|
1475
|
+
handleRoute() {
|
|
1476
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1477
|
+
if (this.isServer)
|
|
1478
|
+
return;
|
|
1479
|
+
const currentRouteId = ++this.lastRouteId;
|
|
1480
|
+
const hash = window.location.hash.slice(1) || '/';
|
|
1481
|
+
const { route, params } = this.matchRoute(hash);
|
|
1482
|
+
// Security Check: Validate URL to prevent malicious hash injection
|
|
1483
|
+
if (hash !== '/' && !_security_sanitizer__WEBPACK_IMPORTED_MODULE_1__.Security.validateUrl('http://dummy.com' + hash)) {
|
|
1484
|
+
console.error("Security Alert: Malformed URL detected.");
|
|
1485
|
+
return;
|
|
1486
|
+
}
|
|
1487
|
+
// Navigation Guard (Middleware)
|
|
1488
|
+
if (route === null || route === void 0 ? void 0 : route.beforeEnter) {
|
|
1489
|
+
yield new Promise((resolve) => {
|
|
1490
|
+
route.beforeEnter(hash, this.currentPath, (allow) => {
|
|
1491
|
+
if (allow)
|
|
1492
|
+
resolve();
|
|
1493
|
+
else {
|
|
1494
|
+
console.warn(`Navigation to ${hash} blocked by guard.`);
|
|
1495
|
+
// Ideally redirect or stay, here we just stop processing
|
|
1496
|
+
throw new Error('Navigation Blocked');
|
|
1497
|
+
}
|
|
1498
|
+
});
|
|
1499
|
+
}).catch(() => { return; }); // Stop execution if blocked
|
|
1500
|
+
}
|
|
1501
|
+
this.currentPath = hash;
|
|
1502
|
+
if (route) {
|
|
1503
|
+
if (route.title) {
|
|
1504
|
+
document.title = route.title;
|
|
1505
|
+
}
|
|
1506
|
+
else if (route.meta && route.meta.title) {
|
|
1507
|
+
// Fallback to meta.title if used
|
|
1508
|
+
document.title = route.meta.title;
|
|
1509
|
+
}
|
|
1510
|
+
if (this.rootContainer) {
|
|
1511
|
+
// Mulan Cycle: Destroy previous component before rendering new one
|
|
1512
|
+
if (this.currentComponent) {
|
|
1513
|
+
console.log(`[Router] Navigation from ${this.currentPath} to ${hash}. Destroying previous component.`);
|
|
1514
|
+
if (this.currentComponent.onDestroy) {
|
|
1515
|
+
this.currentComponent.onDestroy();
|
|
1516
|
+
}
|
|
1517
|
+
}
|
|
1518
|
+
this.rootContainer.innerHTML = ''; // Clear previous content
|
|
1519
|
+
}
|
|
1520
|
+
let componentToRender = route.component;
|
|
1521
|
+
// Support Lazy Loading
|
|
1522
|
+
if (typeof componentToRender === 'function' && !componentToRender.prototype) {
|
|
1523
|
+
try {
|
|
1524
|
+
const module = yield componentToRender();
|
|
1525
|
+
if (currentRouteId !== this.lastRouteId) {
|
|
1526
|
+
console.log(`[Router] Navigation to ${hash} interrupted by newer navigation. Abandoning.`);
|
|
1527
|
+
return;
|
|
1528
|
+
}
|
|
1529
|
+
componentToRender = module.default || module;
|
|
1530
|
+
}
|
|
1531
|
+
catch (e) {
|
|
1532
|
+
console.error("Failed to lazy load component", e);
|
|
1533
|
+
return;
|
|
1534
|
+
}
|
|
1535
|
+
}
|
|
1536
|
+
if (typeof componentToRender === 'function') {
|
|
1537
|
+
// It's a class component
|
|
1538
|
+
if (this.rootContainer) {
|
|
1539
|
+
const instance = new componentToRender(this.rootContainer);
|
|
1540
|
+
this.currentComponent = instance;
|
|
1541
|
+
// Inject params if the component accepts them
|
|
1542
|
+
if (instance.setParams) {
|
|
1543
|
+
instance.setParams(params);
|
|
1544
|
+
}
|
|
1545
|
+
instance.mount();
|
|
1546
|
+
}
|
|
1547
|
+
}
|
|
1548
|
+
else if (typeof componentToRender === 'object' && componentToRender.template) {
|
|
1549
|
+
// Object Component (Simple SFC without script or Options API)
|
|
1550
|
+
const html = componentToRender.template();
|
|
1551
|
+
if (this.rootContainer)
|
|
1552
|
+
(0,_core_renderer__WEBPACK_IMPORTED_MODULE_0__.render)(html, this.rootContainer);
|
|
1553
|
+
this.currentComponent = null;
|
|
1554
|
+
}
|
|
1555
|
+
else {
|
|
1556
|
+
// Simple HTML string/template
|
|
1557
|
+
if (this.rootContainer)
|
|
1558
|
+
(0,_core_renderer__WEBPACK_IMPORTED_MODULE_0__.render)(componentToRender, this.rootContainer);
|
|
1559
|
+
this.currentComponent = null; // String templates don't have lifecycle instances
|
|
1560
|
+
}
|
|
1561
|
+
}
|
|
1562
|
+
else {
|
|
1563
|
+
if (this.rootContainer)
|
|
1564
|
+
(0,_core_renderer__WEBPACK_IMPORTED_MODULE_0__.render)('<div style="text-align:center; padding:50px;"><h1>404</h1><p>Page Not Found</p></div>', this.rootContainer);
|
|
1565
|
+
}
|
|
1566
|
+
});
|
|
1567
|
+
}
|
|
1568
|
+
navigate(path) {
|
|
1569
|
+
if (this.isServer) {
|
|
1570
|
+
this.currentPath = path;
|
|
1571
|
+
}
|
|
1572
|
+
else {
|
|
1573
|
+
window.location.hash = path;
|
|
1574
|
+
}
|
|
1575
|
+
}
|
|
1576
|
+
}
|
|
1577
|
+
// --- Factory for Easy Usage ---
|
|
1578
|
+
const createRouter = (options) => {
|
|
1579
|
+
return new MuRouter(options.routes, options.rootContainer);
|
|
1580
|
+
};
|
|
1581
|
+
// --- Web Component: <mu-link> ---
|
|
1582
|
+
// Usage: <mu-link to="/about">About Us</mu-link>
|
|
1583
|
+
if (typeof window !== 'undefined' && !customElements.get('mu-link')) {
|
|
1584
|
+
class MuLink extends HTMLElement {
|
|
1585
|
+
constructor() {
|
|
1586
|
+
super();
|
|
1587
|
+
this.addEventListener('click', (e) => {
|
|
1588
|
+
e.preventDefault();
|
|
1589
|
+
const to = this.getAttribute('to');
|
|
1590
|
+
if (to) {
|
|
1591
|
+
// Update Hash for SPA Navigation
|
|
1592
|
+
window.location.hash = to;
|
|
1593
|
+
}
|
|
1594
|
+
});
|
|
1595
|
+
}
|
|
1596
|
+
connectedCallback() {
|
|
1597
|
+
this.style.cursor = 'pointer';
|
|
1598
|
+
this.style.color = 'var(--primary, #9C27B0)'; // Default to brand color if available
|
|
1599
|
+
this.style.textDecoration = 'none';
|
|
1600
|
+
}
|
|
1601
|
+
static get observedAttributes() { return ['to']; }
|
|
1602
|
+
}
|
|
1603
|
+
customElements.define('mu-link', MuLink);
|
|
1604
|
+
}
|
|
1605
|
+
|
|
1606
|
+
|
|
1607
|
+
/***/ },
|
|
1608
|
+
|
|
1609
|
+
/***/ "./src/security/sanitizer.ts"
|
|
1610
|
+
/*!***********************************!*\
|
|
1611
|
+
!*** ./src/security/sanitizer.ts ***!
|
|
1612
|
+
\***********************************/
|
|
1613
|
+
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
1614
|
+
|
|
1615
|
+
__webpack_require__.r(__webpack_exports__);
|
|
1616
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
1617
|
+
/* harmony export */ Security: () => (/* binding */ Security)
|
|
1618
|
+
/* harmony export */ });
|
|
1619
|
+
class Security {
|
|
1620
|
+
static sanitize(input) {
|
|
1621
|
+
// 1. Basic entity encoding
|
|
1622
|
+
let secure = input
|
|
1623
|
+
.replace(/&/g, "&")
|
|
1624
|
+
.replace(/</g, "<")
|
|
1625
|
+
.replace(/>/g, ">")
|
|
1626
|
+
.replace(/"/g, """)
|
|
1627
|
+
.replace(/'/g, "'");
|
|
1628
|
+
// 2. Remove dangerous events (extra layer if encoding fails)
|
|
1629
|
+
const dangerousEvents = ['onload', 'onclick', 'onerror', 'onmouseover', 'onfocus'];
|
|
1630
|
+
dangerousEvents.forEach(event => {
|
|
1631
|
+
const regex = new RegExp(event, 'gi');
|
|
1632
|
+
secure = secure.replace(regex, 'data-blocked-' + event);
|
|
1633
|
+
});
|
|
1634
|
+
return secure;
|
|
1635
|
+
}
|
|
1636
|
+
/**
|
|
1637
|
+
* Generates a strict Content Security Policy header value.
|
|
1638
|
+
* @param options Configuration for allowed sources
|
|
1639
|
+
*/
|
|
1640
|
+
static generateCSP(options = {}) {
|
|
1641
|
+
const scriptSrc = ["'self'", ...(options.scriptSrc || [])].join(" ");
|
|
1642
|
+
const styleSrc = ["'self'", "'unsafe-inline'", ...(options.styleSrc || [])].join(" ");
|
|
1643
|
+
return `default-src 'self'; script-src ${scriptSrc}; style-src ${styleSrc}; object-src 'none'; base-uri 'self';`;
|
|
1644
|
+
}
|
|
1645
|
+
static validateUrl(url) {
|
|
1646
|
+
// Basic URL validation
|
|
1647
|
+
const pattern = new RegExp('^(https?:\\/\\/)?' + // protocol
|
|
1648
|
+
'((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.)+[a-z]{2,}|' + // domain name
|
|
1649
|
+
'((\\d{1,3}\\.){3}\\d{1,3}))' + // OR ip (v4) address
|
|
1650
|
+
'(\\:\\d+)?(\\/[-a-z\\d%_.~+]*)*' + // port and path
|
|
1651
|
+
'(\\?[;&a-z\\d%_.~+=-]*)?' + // query string
|
|
1652
|
+
'(\\#[-a-z\\d_]*)?$', 'i'); // fragment locator
|
|
1653
|
+
return !!pattern.test(url);
|
|
1654
|
+
}
|
|
1655
|
+
/**
|
|
1656
|
+
* Prevents XSS by sanitizing common input fields on blur.
|
|
1657
|
+
* Can be used as a utility in forms.
|
|
1658
|
+
*/
|
|
1659
|
+
static preventXSS(inputElement) {
|
|
1660
|
+
inputElement.addEventListener('blur', (e) => {
|
|
1661
|
+
const target = e.target;
|
|
1662
|
+
target.value = Security.sanitize(target.value);
|
|
1663
|
+
});
|
|
1664
|
+
}
|
|
1665
|
+
}
|
|
1666
|
+
|
|
1667
|
+
|
|
1668
|
+
/***/ },
|
|
1669
|
+
|
|
1670
|
+
/***/ "./src/store/index.ts"
|
|
1671
|
+
/*!****************************!*\
|
|
1672
|
+
!*** ./src/store/index.ts ***!
|
|
1673
|
+
\****************************/
|
|
1674
|
+
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
1675
|
+
|
|
1676
|
+
__webpack_require__.r(__webpack_exports__);
|
|
1677
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
1678
|
+
/* harmony export */ MuStore: () => (/* binding */ MuStore)
|
|
1679
|
+
/* harmony export */ });
|
|
1680
|
+
/* harmony import */ var _core_reactive__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../core/reactive */ "./src/core/reactive.ts");
|
|
1681
|
+
|
|
1682
|
+
class MuStore {
|
|
1683
|
+
constructor(initialState, options) {
|
|
1684
|
+
this.subscribers = [];
|
|
1685
|
+
// Load from local storage if persist is true
|
|
1686
|
+
let loadedState = initialState;
|
|
1687
|
+
if (options === null || options === void 0 ? void 0 : options.persist) {
|
|
1688
|
+
const key = options.key || 'mulan-store';
|
|
1689
|
+
try {
|
|
1690
|
+
const stored = localStorage.getItem(key);
|
|
1691
|
+
if (stored) {
|
|
1692
|
+
loadedState = Object.assign(Object.assign({}, initialState), JSON.parse(stored));
|
|
1693
|
+
}
|
|
1694
|
+
}
|
|
1695
|
+
catch (e) {
|
|
1696
|
+
console.error("Failed to load state", e);
|
|
1697
|
+
}
|
|
1698
|
+
// Auto-save effect
|
|
1699
|
+
(0,_core_reactive__WEBPACK_IMPORTED_MODULE_0__.effect)(() => {
|
|
1700
|
+
localStorage.setItem(key, JSON.stringify(this.state));
|
|
1701
|
+
});
|
|
1702
|
+
}
|
|
1703
|
+
this.state = (0,_core_reactive__WEBPACK_IMPORTED_MODULE_0__.reactive)(loadedState);
|
|
1704
|
+
}
|
|
1705
|
+
// Subscribe to changes
|
|
1706
|
+
subscribe(fn) {
|
|
1707
|
+
this.subscribers.push(fn);
|
|
1708
|
+
(0,_core_reactive__WEBPACK_IMPORTED_MODULE_0__.effect)(() => {
|
|
1709
|
+
fn(this.state);
|
|
1710
|
+
});
|
|
1711
|
+
}
|
|
1712
|
+
// Action dispatcher pattern
|
|
1713
|
+
dispatch(action) {
|
|
1714
|
+
const result = action(this.state);
|
|
1715
|
+
if (result instanceof Promise) {
|
|
1716
|
+
result.then(() => {
|
|
1717
|
+
// Optional: Notify subscribers of async completion if needed manually?
|
|
1718
|
+
// But reactive() handles updates automatically.
|
|
1719
|
+
});
|
|
1720
|
+
}
|
|
1721
|
+
}
|
|
1722
|
+
}
|
|
1723
|
+
|
|
1724
|
+
|
|
1725
|
+
/***/ }
|
|
1726
|
+
|
|
1727
|
+
/******/ });
|
|
1728
|
+
/************************************************************************/
|
|
1729
|
+
/******/ // The module cache
|
|
1730
|
+
/******/ var __webpack_module_cache__ = {};
|
|
1731
|
+
/******/
|
|
1732
|
+
/******/ // The require function
|
|
1733
|
+
/******/ function __webpack_require__(moduleId) {
|
|
1734
|
+
/******/ // Check if module is in cache
|
|
1735
|
+
/******/ var cachedModule = __webpack_module_cache__[moduleId];
|
|
1736
|
+
/******/ if (cachedModule !== undefined) {
|
|
1737
|
+
/******/ return cachedModule.exports;
|
|
1738
|
+
/******/ }
|
|
1739
|
+
/******/ // Check if module exists (development only)
|
|
1740
|
+
/******/ if (__webpack_modules__[moduleId] === undefined) {
|
|
1741
|
+
/******/ var e = new Error("Cannot find module '" + moduleId + "'");
|
|
1742
|
+
/******/ e.code = 'MODULE_NOT_FOUND';
|
|
1743
|
+
/******/ throw e;
|
|
1744
|
+
/******/ }
|
|
1745
|
+
/******/ // Create a new module (and put it into the cache)
|
|
1746
|
+
/******/ var module = __webpack_module_cache__[moduleId] = {
|
|
1747
|
+
/******/ // no module.id needed
|
|
1748
|
+
/******/ // no module.loaded needed
|
|
1749
|
+
/******/ exports: {}
|
|
1750
|
+
/******/ };
|
|
1751
|
+
/******/
|
|
1752
|
+
/******/ // Execute the module function
|
|
1753
|
+
/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
|
|
1754
|
+
/******/
|
|
1755
|
+
/******/ // Return the exports of the module
|
|
1756
|
+
/******/ return module.exports;
|
|
1757
|
+
/******/ }
|
|
1758
|
+
/******/
|
|
1759
|
+
/************************************************************************/
|
|
1760
|
+
/******/ /* webpack/runtime/define property getters */
|
|
1761
|
+
/******/ (() => {
|
|
1762
|
+
/******/ // define getter functions for harmony exports
|
|
1763
|
+
/******/ __webpack_require__.d = (exports, definition) => {
|
|
1764
|
+
/******/ for(var key in definition) {
|
|
1765
|
+
/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
|
|
1766
|
+
/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
|
|
1767
|
+
/******/ }
|
|
1768
|
+
/******/ }
|
|
1769
|
+
/******/ };
|
|
1770
|
+
/******/ })();
|
|
1771
|
+
/******/
|
|
1772
|
+
/******/ /* webpack/runtime/hasOwnProperty shorthand */
|
|
1773
|
+
/******/ (() => {
|
|
1774
|
+
/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
|
|
1775
|
+
/******/ })();
|
|
1776
|
+
/******/
|
|
1777
|
+
/******/ /* webpack/runtime/make namespace object */
|
|
1778
|
+
/******/ (() => {
|
|
1779
|
+
/******/ // define __esModule on exports
|
|
1780
|
+
/******/ __webpack_require__.r = (exports) => {
|
|
1781
|
+
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
|
1782
|
+
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
1783
|
+
/******/ }
|
|
1784
|
+
/******/ Object.defineProperty(exports, '__esModule', { value: true });
|
|
1785
|
+
/******/ };
|
|
1786
|
+
/******/ })();
|
|
1787
|
+
/******/
|
|
1788
|
+
/************************************************************************/
|
|
1789
|
+
var __webpack_exports__ = {};
|
|
1790
|
+
// This entry needs to be wrapped in an IIFE because it needs to be isolated against other modules in the chunk.
|
|
1791
|
+
(() => {
|
|
1792
|
+
/*!**********************!*\
|
|
1793
|
+
!*** ./src/index.ts ***!
|
|
1794
|
+
\**********************/
|
|
1795
|
+
__webpack_require__.r(__webpack_exports__);
|
|
1796
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
1797
|
+
/* harmony export */ Component: () => (/* reexport safe */ _core_component__WEBPACK_IMPORTED_MODULE_1__.MuComponent),
|
|
1798
|
+
/* harmony export */ MuBlochSphereElement: () => (/* reexport safe */ _components_bloch_sphere__WEBPACK_IMPORTED_MODULE_10__.MuBlochSphereElement),
|
|
1799
|
+
/* harmony export */ MuComponent: () => (/* reexport safe */ _core_component__WEBPACK_IMPORTED_MODULE_1__.MuComponent),
|
|
1800
|
+
/* harmony export */ MuRouter: () => (/* reexport safe */ _router_index__WEBPACK_IMPORTED_MODULE_3__.MuRouter),
|
|
1801
|
+
/* harmony export */ MuStore: () => (/* reexport safe */ _store_index__WEBPACK_IMPORTED_MODULE_4__.MuStore),
|
|
1802
|
+
/* harmony export */ Router: () => (/* reexport safe */ _router_index__WEBPACK_IMPORTED_MODULE_3__.MuRouter),
|
|
1803
|
+
/* harmony export */ Security: () => (/* reexport safe */ _security_sanitizer__WEBPACK_IMPORTED_MODULE_5__.Security),
|
|
1804
|
+
/* harmony export */ Signal: () => (/* reexport safe */ _core_reactive__WEBPACK_IMPORTED_MODULE_0__.Signal),
|
|
1805
|
+
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__),
|
|
1806
|
+
/* harmony export */ defineComponent: () => (/* reexport safe */ _core_component__WEBPACK_IMPORTED_MODULE_1__.defineComponent),
|
|
1807
|
+
/* harmony export */ effect: () => (/* reexport safe */ _core_reactive__WEBPACK_IMPORTED_MODULE_0__.effect),
|
|
1808
|
+
/* harmony export */ getCurrentInstance: () => (/* reexport safe */ _core_hooks__WEBPACK_IMPORTED_MODULE_6__.getCurrentInstance),
|
|
1809
|
+
/* harmony export */ hydrate: () => (/* reexport safe */ _core_renderer__WEBPACK_IMPORTED_MODULE_2__.hydrate),
|
|
1810
|
+
/* harmony export */ muEffect: () => (/* reexport safe */ _core_hooks__WEBPACK_IMPORTED_MODULE_6__.muEffect),
|
|
1811
|
+
/* harmony export */ muEntangle: () => (/* reexport safe */ _core_quantum__WEBPACK_IMPORTED_MODULE_9__.muEntangle),
|
|
1812
|
+
/* harmony export */ muGate: () => (/* reexport safe */ _core_quantum__WEBPACK_IMPORTED_MODULE_9__.muGate),
|
|
1813
|
+
/* harmony export */ muGeom: () => (/* reexport safe */ _core_hooks__WEBPACK_IMPORTED_MODULE_6__.muGeom),
|
|
1814
|
+
/* harmony export */ muMeasure: () => (/* reexport safe */ _core_quantum__WEBPACK_IMPORTED_MODULE_9__.muMeasure),
|
|
1815
|
+
/* harmony export */ muMemo: () => (/* reexport safe */ _core_hooks__WEBPACK_IMPORTED_MODULE_6__.muMemo),
|
|
1816
|
+
/* harmony export */ muPulse: () => (/* reexport safe */ _core_hooks__WEBPACK_IMPORTED_MODULE_6__.muPulse),
|
|
1817
|
+
/* harmony export */ muQubit: () => (/* reexport safe */ _core_quantum__WEBPACK_IMPORTED_MODULE_9__.muQubit),
|
|
1818
|
+
/* harmony export */ muRegister: () => (/* reexport safe */ _core_quantum__WEBPACK_IMPORTED_MODULE_9__.muRegister),
|
|
1819
|
+
/* harmony export */ muSearch: () => (/* reexport safe */ _core_quantum__WEBPACK_IMPORTED_MODULE_9__.muSearch),
|
|
1820
|
+
/* harmony export */ muState: () => (/* reexport safe */ _core_hooks__WEBPACK_IMPORTED_MODULE_6__.muState),
|
|
1821
|
+
/* harmony export */ muTeleport: () => (/* reexport safe */ _core_quantum__WEBPACK_IMPORTED_MODULE_9__.muTeleport),
|
|
1822
|
+
/* harmony export */ muVault: () => (/* reexport safe */ _core_hooks__WEBPACK_IMPORTED_MODULE_6__.muVault),
|
|
1823
|
+
/* harmony export */ onMuDestroy: () => (/* reexport safe */ _core_hooks__WEBPACK_IMPORTED_MODULE_6__.onMuDestroy),
|
|
1824
|
+
/* harmony export */ onMuIdle: () => (/* reexport safe */ _core_hooks__WEBPACK_IMPORTED_MODULE_6__.onMuIdle),
|
|
1825
|
+
/* harmony export */ onMuInit: () => (/* reexport safe */ _core_hooks__WEBPACK_IMPORTED_MODULE_6__.onMuInit),
|
|
1826
|
+
/* harmony export */ onMuMount: () => (/* reexport safe */ _core_hooks__WEBPACK_IMPORTED_MODULE_6__.onMuMount),
|
|
1827
|
+
/* harmony export */ onMuResume: () => (/* reexport safe */ _core_hooks__WEBPACK_IMPORTED_MODULE_6__.onMuResume),
|
|
1828
|
+
/* harmony export */ onMuShake: () => (/* reexport safe */ _core_hooks__WEBPACK_IMPORTED_MODULE_6__.onMuShake),
|
|
1829
|
+
/* harmony export */ onMuVoice: () => (/* reexport safe */ _core_hooks__WEBPACK_IMPORTED_MODULE_6__.onMuVoice),
|
|
1830
|
+
/* harmony export */ persistent: () => (/* reexport safe */ _core_vault__WEBPACK_IMPORTED_MODULE_8__.persistent),
|
|
1831
|
+
/* harmony export */ reactive: () => (/* reexport safe */ _core_reactive__WEBPACK_IMPORTED_MODULE_0__.reactive),
|
|
1832
|
+
/* harmony export */ ref: () => (/* reexport safe */ _core_reactive__WEBPACK_IMPORTED_MODULE_0__.ref),
|
|
1833
|
+
/* harmony export */ render: () => (/* reexport safe */ _core_renderer__WEBPACK_IMPORTED_MODULE_2__.render),
|
|
1834
|
+
/* harmony export */ renderToString: () => (/* reexport safe */ _core_renderer__WEBPACK_IMPORTED_MODULE_2__.renderToString),
|
|
1835
|
+
/* harmony export */ sanitize: () => (/* reexport safe */ _core_renderer__WEBPACK_IMPORTED_MODULE_2__.sanitize),
|
|
1836
|
+
/* harmony export */ setCurrentInstance: () => (/* reexport safe */ _core_hooks__WEBPACK_IMPORTED_MODULE_6__.setCurrentInstance),
|
|
1837
|
+
/* harmony export */ useMutation: () => (/* reexport safe */ _core_query__WEBPACK_IMPORTED_MODULE_7__.useMutation),
|
|
1838
|
+
/* harmony export */ useQuery: () => (/* reexport safe */ _core_query__WEBPACK_IMPORTED_MODULE_7__.useQuery)
|
|
1839
|
+
/* harmony export */ });
|
|
1840
|
+
/* harmony import */ var _core_reactive__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./core/reactive */ "./src/core/reactive.ts");
|
|
1841
|
+
/* harmony import */ var _core_component__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./core/component */ "./src/core/component.ts");
|
|
1842
|
+
/* harmony import */ var _core_renderer__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./core/renderer */ "./src/core/renderer.ts");
|
|
1843
|
+
/* harmony import */ var _router_index__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./router/index */ "./src/router/index.ts");
|
|
1844
|
+
/* harmony import */ var _store_index__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./store/index */ "./src/store/index.ts");
|
|
1845
|
+
/* harmony import */ var _security_sanitizer__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./security/sanitizer */ "./src/security/sanitizer.ts");
|
|
1846
|
+
/* harmony import */ var _core_hooks__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./core/hooks */ "./src/core/hooks.ts");
|
|
1847
|
+
/* harmony import */ var _core_query__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./core/query */ "./src/core/query.ts");
|
|
1848
|
+
/* harmony import */ var _core_vault__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./core/vault */ "./src/core/vault.ts");
|
|
1849
|
+
/* harmony import */ var _core_quantum__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./core/quantum */ "./src/core/quantum.ts");
|
|
1850
|
+
/* harmony import */ var _components_bloch_sphere__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./components/bloch-sphere */ "./src/components/bloch-sphere.ts");
|
|
1851
|
+
|
|
1852
|
+
|
|
1853
|
+
|
|
1854
|
+
|
|
1855
|
+
|
|
1856
|
+
|
|
1857
|
+
|
|
1858
|
+
|
|
1859
|
+
|
|
1860
|
+
|
|
1861
|
+
|
|
1862
|
+
// Global Mulan Object for non-module usage
|
|
1863
|
+
|
|
1864
|
+
|
|
1865
|
+
|
|
1866
|
+
|
|
1867
|
+
|
|
1868
|
+
|
|
1869
|
+
|
|
1870
|
+
|
|
1871
|
+
const Mulan = Object.assign(Object.assign(Object.assign(Object.assign({ reactive: _core_reactive__WEBPACK_IMPORTED_MODULE_0__.reactive,
|
|
1872
|
+
effect: _core_reactive__WEBPACK_IMPORTED_MODULE_0__.effect, Component: _core_component__WEBPACK_IMPORTED_MODULE_1__.MuComponent, defineComponent: _core_component__WEBPACK_IMPORTED_MODULE_1__.defineComponent, Router: _router_index__WEBPACK_IMPORTED_MODULE_3__.MuRouter, Store: _store_index__WEBPACK_IMPORTED_MODULE_4__.MuStore, Security: _security_sanitizer__WEBPACK_IMPORTED_MODULE_5__.Security }, _core_hooks__WEBPACK_IMPORTED_MODULE_6__), _core_query__WEBPACK_IMPORTED_MODULE_7__), _core_quantum__WEBPACK_IMPORTED_MODULE_9__), {
|
|
1873
|
+
// MULAN INSIGHT: Branded Logging
|
|
1874
|
+
log: (msg, ...args) => {
|
|
1875
|
+
console.log(`%c[MulanJS]%c ${msg}`, "color: #ff3e00; font-weight: bold; background: #222; padding: 2px 4px; border-radius: 3px;", "", ...args);
|
|
1876
|
+
}, warn: (msg, ...args) => {
|
|
1877
|
+
console.warn(`%c[MulanJS]%c ${msg}`, "color: #ffcc00; font-weight: bold; background: #222; padding: 2px 4px; border-radius: 3px;", "", ...args);
|
|
1878
|
+
}, error: (msg, ...args) => {
|
|
1879
|
+
console.error(`%c[MulanJS]%c ${msg}`, "color: #ff0000; font-weight: bold; background: #222; padding: 2px 4px; border-radius: 3px;", "", ...args);
|
|
1880
|
+
} });
|
|
1881
|
+
// Security: Freeze the object to prevent runtime tampering
|
|
1882
|
+
Object.freeze(Mulan);
|
|
1883
|
+
Object.freeze(Mulan.Security);
|
|
1884
|
+
// MULAN INSIGHT: Initialize Global Registry
|
|
1885
|
+
if (typeof window !== 'undefined') {
|
|
1886
|
+
window.__MULAN_INSIGHT__ = window.__MULAN_INSIGHT__ || { components: new Map() };
|
|
1887
|
+
// MULAN INSIGHT: HMR Support
|
|
1888
|
+
window.__MULAN_REFRESH__ = () => {
|
|
1889
|
+
var _a;
|
|
1890
|
+
const components = (_a = window.__MULAN_INSIGHT__) === null || _a === void 0 ? void 0 : _a.components;
|
|
1891
|
+
if (components) {
|
|
1892
|
+
components.forEach((comp) => {
|
|
1893
|
+
if (comp && typeof comp.update === 'function') {
|
|
1894
|
+
// Force refresh
|
|
1895
|
+
comp.update();
|
|
1896
|
+
}
|
|
1897
|
+
});
|
|
1898
|
+
}
|
|
1899
|
+
};
|
|
1900
|
+
}
|
|
1901
|
+
window.Mulan = Mulan;
|
|
1902
|
+
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (Mulan);
|
|
1903
|
+
|
|
1904
|
+
})();
|
|
1905
|
+
|
|
1906
|
+
const __webpack_exports__Component = __webpack_exports__.Component;
|
|
1907
|
+
const __webpack_exports__MuBlochSphereElement = __webpack_exports__.MuBlochSphereElement;
|
|
1908
|
+
const __webpack_exports__MuComponent = __webpack_exports__.MuComponent;
|
|
1909
|
+
const __webpack_exports__MuRouter = __webpack_exports__.MuRouter;
|
|
1910
|
+
const __webpack_exports__MuStore = __webpack_exports__.MuStore;
|
|
1911
|
+
const __webpack_exports__Router = __webpack_exports__.Router;
|
|
1912
|
+
const __webpack_exports__Security = __webpack_exports__.Security;
|
|
1913
|
+
const __webpack_exports__Signal = __webpack_exports__.Signal;
|
|
1914
|
+
const __webpack_exports__default = __webpack_exports__["default"];
|
|
1915
|
+
const __webpack_exports__defineComponent = __webpack_exports__.defineComponent;
|
|
1916
|
+
const __webpack_exports__effect = __webpack_exports__.effect;
|
|
1917
|
+
const __webpack_exports__getCurrentInstance = __webpack_exports__.getCurrentInstance;
|
|
1918
|
+
const __webpack_exports__hydrate = __webpack_exports__.hydrate;
|
|
1919
|
+
const __webpack_exports__muEffect = __webpack_exports__.muEffect;
|
|
1920
|
+
const __webpack_exports__muEntangle = __webpack_exports__.muEntangle;
|
|
1921
|
+
const __webpack_exports__muGate = __webpack_exports__.muGate;
|
|
1922
|
+
const __webpack_exports__muGeom = __webpack_exports__.muGeom;
|
|
1923
|
+
const __webpack_exports__muMeasure = __webpack_exports__.muMeasure;
|
|
1924
|
+
const __webpack_exports__muMemo = __webpack_exports__.muMemo;
|
|
1925
|
+
const __webpack_exports__muPulse = __webpack_exports__.muPulse;
|
|
1926
|
+
const __webpack_exports__muQubit = __webpack_exports__.muQubit;
|
|
1927
|
+
const __webpack_exports__muRegister = __webpack_exports__.muRegister;
|
|
1928
|
+
const __webpack_exports__muSearch = __webpack_exports__.muSearch;
|
|
1929
|
+
const __webpack_exports__muState = __webpack_exports__.muState;
|
|
1930
|
+
const __webpack_exports__muTeleport = __webpack_exports__.muTeleport;
|
|
1931
|
+
const __webpack_exports__muVault = __webpack_exports__.muVault;
|
|
1932
|
+
const __webpack_exports__onMuDestroy = __webpack_exports__.onMuDestroy;
|
|
1933
|
+
const __webpack_exports__onMuIdle = __webpack_exports__.onMuIdle;
|
|
1934
|
+
const __webpack_exports__onMuInit = __webpack_exports__.onMuInit;
|
|
1935
|
+
const __webpack_exports__onMuMount = __webpack_exports__.onMuMount;
|
|
1936
|
+
const __webpack_exports__onMuResume = __webpack_exports__.onMuResume;
|
|
1937
|
+
const __webpack_exports__onMuShake = __webpack_exports__.onMuShake;
|
|
1938
|
+
const __webpack_exports__onMuVoice = __webpack_exports__.onMuVoice;
|
|
1939
|
+
const __webpack_exports__persistent = __webpack_exports__.persistent;
|
|
1940
|
+
const __webpack_exports__reactive = __webpack_exports__.reactive;
|
|
1941
|
+
const __webpack_exports__ref = __webpack_exports__.ref;
|
|
1942
|
+
const __webpack_exports__render = __webpack_exports__.render;
|
|
1943
|
+
const __webpack_exports__renderToString = __webpack_exports__.renderToString;
|
|
1944
|
+
const __webpack_exports__sanitize = __webpack_exports__.sanitize;
|
|
1945
|
+
const __webpack_exports__setCurrentInstance = __webpack_exports__.setCurrentInstance;
|
|
1946
|
+
const __webpack_exports__useMutation = __webpack_exports__.useMutation;
|
|
1947
|
+
const __webpack_exports__useQuery = __webpack_exports__.useQuery;
|
|
1948
|
+
export { __webpack_exports__Component as Component, __webpack_exports__MuBlochSphereElement as MuBlochSphereElement, __webpack_exports__MuComponent as MuComponent, __webpack_exports__MuRouter as MuRouter, __webpack_exports__MuStore as MuStore, __webpack_exports__Router as Router, __webpack_exports__Security as Security, __webpack_exports__Signal as Signal, __webpack_exports__default as default, __webpack_exports__defineComponent as defineComponent, __webpack_exports__effect as effect, __webpack_exports__getCurrentInstance as getCurrentInstance, __webpack_exports__hydrate as hydrate, __webpack_exports__muEffect as muEffect, __webpack_exports__muEntangle as muEntangle, __webpack_exports__muGate as muGate, __webpack_exports__muGeom as muGeom, __webpack_exports__muMeasure as muMeasure, __webpack_exports__muMemo as muMemo, __webpack_exports__muPulse as muPulse, __webpack_exports__muQubit as muQubit, __webpack_exports__muRegister as muRegister, __webpack_exports__muSearch as muSearch, __webpack_exports__muState as muState, __webpack_exports__muTeleport as muTeleport, __webpack_exports__muVault as muVault, __webpack_exports__onMuDestroy as onMuDestroy, __webpack_exports__onMuIdle as onMuIdle, __webpack_exports__onMuInit as onMuInit, __webpack_exports__onMuMount as onMuMount, __webpack_exports__onMuResume as onMuResume, __webpack_exports__onMuShake as onMuShake, __webpack_exports__onMuVoice as onMuVoice, __webpack_exports__persistent as persistent, __webpack_exports__reactive as reactive, __webpack_exports__ref as ref, __webpack_exports__render as render, __webpack_exports__renderToString as renderToString, __webpack_exports__sanitize as sanitize, __webpack_exports__setCurrentInstance as setCurrentInstance, __webpack_exports__useMutation as useMutation, __webpack_exports__useQuery as useQuery };
|