Spaces:
Running
Running
Update src/App.tsx
Browse files- src/App.tsx +326 -227
src/App.tsx
CHANGED
@@ -1,30 +1,330 @@
|
|
1 |
/**
|
2 |
Copyright 2024 Google LLC
|
3 |
-
|
4 |
-
you may not use this file except in compliance with the License.
|
5 |
-
You may obtain a copy of the License at
|
6 |
-
http://www.apache.org/licenses/LICENSE-2.0
|
7 |
-
Unless required by applicable law or agreed to in writing, software
|
8 |
-
distributed under the License is distributed on an "AS IS" BASIS,
|
9 |
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
10 |
-
See the License for the specific language governing permissions and
|
11 |
-
limitations under the License.
|
12 |
*/
|
13 |
|
14 |
import React, { useEffect, useRef, useState, useCallback } from "react";
|
15 |
-
import "./App.scss";
|
16 |
-
import { LiveAPIProvider
|
17 |
-
// import SidePanel from "./components/side-panel/SidePanel"; //
|
18 |
import { Altair } from "./components/altair/Altair";
|
19 |
-
import ControlTray from "./components/control-tray/ControlTray";
|
20 |
import { IOSModal } from "./components/ios-modal/IOSModal";
|
21 |
import { isIOS } from "./lib/platform";
|
|
|
22 |
import { LiveConfig } from "./multimodal-live-types";
|
|
|
23 |
|
24 |
-
// --- 👇 دامنه
|
25 |
-
const
|
26 |
// --- 👆 ---
|
27 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
28 |
// --- 👇 دستورالعمل شخصیسازی شما (بدون تغییر) 👇 ---
|
29 |
const myCustomInstruction = `
|
30 |
ت1. هویت دستیار:
|
@@ -98,222 +398,21 @@ const myCustomInstruction = `
|
|
98 |
`.trim();
|
99 |
// --- 👆 ---
|
100 |
|
|
|
101 |
const initialAppConfig: LiveConfig = {
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
};
|
107 |
-
|
108 |
-
const NotificationIcon = () => (
|
109 |
-
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round"><circle cx="12" cy="12" r="10"></circle><line x1="12" y1="8" x2="12" y2="12"></line><line x1="12" y1="16" x2="12.01" y2="16"></line></svg>
|
110 |
-
);
|
111 |
-
|
112 |
-
const BackIcon = () => (
|
113 |
-
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round"><path d="m15 18-6-6 6-6"></path></svg>
|
114 |
-
);
|
115 |
-
|
116 |
-
const HumanIconSVG = ({ width = 70, height = 70 }: { width?: number, height?: number }) => (
|
117 |
-
<svg width={width} height={height} viewBox="0 0 88 89" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M75.1481 81.6361H12.9259C9.66667 81.6361 7 78.9721 7 75.7161V58.5112C7 57.5862 7 57.1052 7.44444 56.2172C8.85185 52.9612 13 50.2232 19.4815 47.8922C24.1111 56.6982 33.3704 62.6921 44 62.6921C54.6296 62.6921 63.9259 56.6982 68.5185 47.8922C75 50.1862 79.1852 52.9982 80.5556 56.2172C81 56.6612 81 57.6232 81 58.5112V75.7161C81 78.9721 78.3333 81.6361 75.0741 81.6361H75.1481Z" stroke="#FCFCFC" strokeWidth="6.42146" strokeLinecap="round" strokeLinejoin="round" /><path d="M44.0371 50.1862C33.8519 50.1862 25.5186 41.8612 25.5186 31.6863V26.1363C25.5186 15.9613 33.8519 7.63635 44.0371 7.63635C54.2223 7.63635 62.5556 15.9613 62.5556 26.1363V31.6863C62.5556 41.8612 54.2223 50.1862 44.0371 50.1862Z" stroke="#FCFCFC" strokeWidth="6.42146" strokeLinecap="round" strokeLinejoin="round" /></svg>
|
118 |
-
);
|
119 |
-
|
120 |
-
const LogoDisplay = ({ isMini, isHumanActive }: { isMini: boolean, isHumanActive: boolean }) => {
|
121 |
-
if (!isHumanActive) return null;
|
122 |
-
const size = isMini ? 80 : 200;
|
123 |
-
const iconSize = isMini ? 35 : 70;
|
124 |
-
const insetBase = isMini
|
125 |
-
? { ping: 10, outer: 0, mid: 5, inner: 12, icon: 22.5 }
|
126 |
-
: { ping: 40, outer: 0, mid: 20, inner: 50, icon: 65 };
|
127 |
-
const bgColorBase = 'blue';
|
128 |
-
|
129 |
-
return (
|
130 |
-
<div className="relative" style={{ width: `${size}px`, height: `${size}px` }}>
|
131 |
-
<div className={`absolute rounded-full opacity-50 animate-ping bg-${bgColorBase}-200 dark:bg-${bgColorBase}-700`} style={{ inset: `${insetBase.ping}px` }}></div>
|
132 |
-
<div className={`absolute rounded-full opacity-50 bg-${bgColorBase}-200 dark:bg-${bgColorBase}-700`} style={{ inset: `${insetBase.outer}px` }}></div>
|
133 |
-
<div className={`absolute rounded-full opacity-50 bg-${bgColorBase}-300 dark:bg-${bgColorBase}-600`} style={{ inset: `${insetBase.mid}px` }}></div>
|
134 |
-
<div className={`absolute rounded-full opacity-50 bg-${bgColorBase}-400 dark:bg-${bgColorBase}-500`} style={{ inset: `${insetBase.inner}px` }}></div>
|
135 |
-
<div className="z-10 absolute" style={{ top: `${insetBase.icon}px`, left: `${insetBase.icon}px` }}>
|
136 |
-
<HumanIconSVG width={iconSize} height={iconSize} />
|
137 |
-
</div>
|
138 |
-
</div>
|
139 |
-
);
|
140 |
-
};
|
141 |
-
|
142 |
-
function AppContent() {
|
143 |
-
const videoRef = useRef<HTMLVideoElement>(null);
|
144 |
-
const [showIOSModal, setShowIOSModal] = useState(false);
|
145 |
-
const [isAllowedOrigin, setIsAllowedOrigin] = useState<boolean | null>(null); // true: allowed, false: blocked
|
146 |
-
const [isNotificationOpen, setIsNotificationOpen] = useState(false);
|
147 |
-
const notificationPopoverRef = useRef<HTMLDivElement>(null);
|
148 |
-
const notificationButtonRef = useRef<HTMLButtonElement>(null);
|
149 |
-
|
150 |
-
const [isMicActive, setIsMicActive] = useState(false);
|
151 |
-
const [isCamActive, setIsCamActive] = useState(false);
|
152 |
-
|
153 |
-
const { connected, volume } = useLiveAPIContext();
|
154 |
-
|
155 |
-
useEffect(() => {
|
156 |
-
if (isIOS()) {
|
157 |
-
setShowIOSModal(true);
|
158 |
-
}
|
159 |
-
|
160 |
-
// --- 👇 منطق بررسی دامنه مجاز (معکوس شده) 👇 ---
|
161 |
-
try {
|
162 |
-
if (window.self !== window.top) { // App is in an iframe
|
163 |
-
if (window.location.ancestorOrigins && window.location.ancestorOrigins.length > 0) {
|
164 |
-
const parentOrigin = window.location.ancestorOrigins[0];
|
165 |
-
console.log("Parent Origin:", parentOrigin);
|
166 |
-
if (parentOrigin === FORBIDDEN_ORIGIN) {
|
167 |
-
console.warn(`Blocked load from forbidden origin: ${parentOrigin}`);
|
168 |
-
setIsAllowedOrigin(false); // Block if from forbidden origin
|
169 |
-
} else {
|
170 |
-
console.log(`Allowed load from origin: ${parentOrigin}`);
|
171 |
-
setIsAllowedOrigin(true); // Allow if from any other origin
|
172 |
-
}
|
173 |
-
} else {
|
174 |
-
// Cannot verify parent origin, but it's in an iframe.
|
175 |
-
// For "allow everywhere except specific site", we can assume allow here.
|
176 |
-
console.warn("Cannot verify parent origin (ancestorOrigins not available/empty), but in iframe. Allowing.");
|
177 |
-
setIsAllowedOrigin(true);
|
178 |
-
}
|
179 |
-
} else { // App loaded directly, not in an iframe
|
180 |
-
console.log("App loaded directly. Allowing.");
|
181 |
-
setIsAllowedOrigin(true); // Allow if loaded directly
|
182 |
-
}
|
183 |
-
} catch (e) {
|
184 |
-
// Cross-origin access error. This usually happens if the iframe has sandbox attributes
|
185 |
-
// that prevent accessing ancestorOrigins. In this "allow everywhere except" scenario,
|
186 |
-
// it's safer to allow if we can't determine, or block if you prefer higher security.
|
187 |
-
// Let's allow for wider compatibility, assuming it's not the forbidden one.
|
188 |
-
console.error("Cross-origin access error, cannot verify parent. Allowing by default.", e);
|
189 |
-
setIsAllowedOrigin(true);
|
190 |
-
}
|
191 |
-
// --- 👆 ---
|
192 |
-
|
193 |
-
const handleClickOutside = (event: MouseEvent) => {
|
194 |
-
if (isNotificationOpen &&
|
195 |
-
notificationPopoverRef.current &&
|
196 |
-
!notificationPopoverRef.current.contains(event.target as Node) &&
|
197 |
-
notificationButtonRef.current &&
|
198 |
-
!notificationButtonRef.current.contains(event.target as Node)
|
199 |
-
) {
|
200 |
-
setIsNotificationOpen(false);
|
201 |
-
}
|
202 |
-
};
|
203 |
-
document.addEventListener('click', handleClickOutside);
|
204 |
-
return () => {
|
205 |
-
document.removeEventListener('click', handleClickOutside);
|
206 |
-
};
|
207 |
-
|
208 |
-
}, [isNotificationOpen]);
|
209 |
-
|
210 |
-
const handleVideoStreamChange = useCallback((stream: MediaStream | null) => {
|
211 |
-
setIsCamActive(!!stream);
|
212 |
-
if (videoRef.current) {
|
213 |
-
videoRef.current.srcObject = stream;
|
214 |
-
if (stream) {
|
215 |
-
videoRef.current.play().catch(e => console.warn("Video play failed:", e));
|
216 |
-
}
|
217 |
-
}
|
218 |
-
}, []);
|
219 |
-
|
220 |
-
useEffect(() => {
|
221 |
-
// This effect is for potential output volume visualization, not currently used for mic pulse
|
222 |
-
}, [volume]);
|
223 |
-
|
224 |
-
if (isAllowedOrigin === null) {
|
225 |
-
return <div style={{ padding: '20px', textAlign: 'center' }}>در حال بررسی دسترسی...</div>;
|
226 |
-
}
|
227 |
-
|
228 |
-
// --- 👇 رندر شرطی با پیام خطای جدید 👇 ---
|
229 |
-
if (isAllowedOrigin === false) {
|
230 |
-
// این پیام زمانی نمایش داده میشود که برنامه در iframe سایت ممنوعه (aisada.ir) بارگذاری شود.
|
231 |
-
return (
|
232 |
-
<div style={{ padding: '20px', textAlign: 'center', color: 'red', direction: 'rtl' }}>
|
233 |
-
دسترسی به این محتوا از دامنه شما ({FORBIDDEN_ORIGIN}) مجاز نمیباشد.
|
234 |
-
<br />
|
235 |
-
لطفا این اسپیس را مستقیما یا از طریق دامنههای مجاز دیگر باز کنید.
|
236 |
-
</div>
|
237 |
-
);
|
238 |
-
}
|
239 |
-
// --- 👆 ---
|
240 |
-
|
241 |
-
// اگر isAllowedOrigin === true بود، برنامه اصلی رندر میشود
|
242 |
-
return (
|
243 |
-
<div className="App">
|
244 |
-
{/* <SidePanel /> */}
|
245 |
-
<main>
|
246 |
-
<div className="main-app-area">
|
247 |
-
<Altair />
|
248 |
-
<div className="header-controls">
|
249 |
-
<button
|
250 |
-
id="notification-button"
|
251 |
-
ref={notificationButtonRef}
|
252 |
-
aria-label="Notifications"
|
253 |
-
className="header-button"
|
254 |
-
onClick={(e) => {
|
255 |
-
e.stopPropagation();
|
256 |
-
setIsNotificationOpen(!isNotificationOpen);
|
257 |
-
}}
|
258 |
-
>
|
259 |
-
<NotificationIcon />
|
260 |
-
</button>
|
261 |
-
<button className="header-button" onClick={() => alert('Back clicked (TODO: implement)')}>
|
262 |
-
<BackIcon />
|
263 |
-
</button>
|
264 |
-
</div>
|
265 |
-
|
266 |
-
<div id="notification-popover-wrapper" className="notification-popover-wrapper">
|
267 |
-
<div
|
268 |
-
id="notification-popover"
|
269 |
-
ref={notificationPopoverRef}
|
270 |
-
className={`popover-content ${isNotificationOpen ? 'open' : ''}`}
|
271 |
-
>
|
272 |
-
<div className="notification-popover-text-content">
|
273 |
-
مدلهای هوش مصنوعی میتوانند اشتباه کنند، صحت اطلاعات مهم را بررسی کنید و از وارد کردن اطلاعات حساس بپرهیزید.
|
274 |
-
</div>
|
275 |
-
</div>
|
276 |
-
</div>
|
277 |
-
|
278 |
-
<div className="media-toggle-area">
|
279 |
-
<video
|
280 |
-
id="video-feed"
|
281 |
-
ref={videoRef}
|
282 |
-
autoPlay
|
283 |
-
playsInline
|
284 |
-
className={`video-feed ${!isCamActive ? 'hidden' : ''}`}
|
285 |
-
/>
|
286 |
-
{!isCamActive && isMicActive && (
|
287 |
-
<div id="large-logo-container" className="large-logo-container">
|
288 |
-
<LogoDisplay isMini={false} isHumanActive={true} />
|
289 |
-
</div>
|
290 |
-
)}
|
291 |
-
</div>
|
292 |
-
</div>
|
293 |
-
|
294 |
-
<ControlTray
|
295 |
-
videoRef={videoRef}
|
296 |
-
onVideoStreamChange={handleVideoStreamChange}
|
297 |
-
setIsMicActive={setIsMicActive}
|
298 |
-
setIsCamActiveExternal={setIsCamActive}
|
299 |
-
isCamActiveApp={isCamActive}
|
300 |
-
/>
|
301 |
-
</main>
|
302 |
-
|
303 |
-
<IOSModal
|
304 |
-
isOpen={showIOSModal}
|
305 |
-
onClose={() => setShowIOSModal(false)}
|
306 |
-
/>
|
307 |
-
</div>
|
308 |
-
);
|
309 |
-
}
|
310 |
|
311 |
function App() {
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
}
|
318 |
|
319 |
export default App;
|
|
|
1 |
/**
|
2 |
Copyright 2024 Google LLC
|
3 |
+
(لایسنس مثل قبل)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
*/
|
5 |
|
6 |
import React, { useEffect, useRef, useState, useCallback } from "react";
|
7 |
+
import "./App.scss"; // استایلهای جدید اینجا خواهند بود
|
8 |
+
import { LiveAPIProvider } from "./contexts/LiveAPIContext";
|
9 |
+
// import SidePanel from "./components/side-panel/SidePanel"; // فعلا حذف شد
|
10 |
import { Altair } from "./components/altair/Altair";
|
11 |
+
import ControlTray from "./components/control-tray/ControlTray"; // همچنان برای منطق استفاده میشود
|
12 |
import { IOSModal } from "./components/ios-modal/IOSModal";
|
13 |
import { isIOS } from "./lib/platform";
|
14 |
+
import cn from "classnames";
|
15 |
import { LiveConfig } from "./multimodal-live-types";
|
16 |
+
import { useLiveAPIContext } from "./contexts/LiveAPIContext"; // برای دسترسی به توابع اتصال و ...
|
17 |
|
18 |
+
// --- 👇 دامنه مجاز خودتان را اینجا قرار دهید (با https یا http) 👇 ---
|
19 |
+
const ALLOWED_ORIGIN = "https://www.aisada.ir";
|
20 |
// --- 👆 ---
|
21 |
|
22 |
+
// SVG Icons as React Components or inline
|
23 |
+
const SvgPauseIcon = () => <svg width="37" height="37" viewBox="0 0 37 37" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M15.9872 29.6198V8.28342C15.9872 6.25781 15.132 5.44757 12.9713 5.44757H7.52469C5.36404 5.44757 4.50879 6.25781 4.50879 8.28342V29.6198C4.50879 31.6454 5.36404 32.4556 7.52469 32.4556H12.9713C15.132 32.4556 15.9872 31.6454 15.9872 29.6198Z" fill="#BE123C"/><path opacity="0.4" d="M31.5175 29.6198V8.28342C31.5175 6.25781 30.6622 5.44757 28.5016 5.44757H23.055C20.9093 5.44757 20.0391 6.25781 20.0391 8.28342V29.6198C20.0391 31.6454 20.8943 32.4556 23.055 32.4556H28.5016C30.6622 32.4556 31.5175 31.6454 31.5175 29.6198Z" fill="#BE123C"/></svg>;
|
24 |
+
const SvgMicrophoneIcon = () => <svg width="69" height="68" viewBox="0 0 69 68" fill="none" xmlns="http://www.w3.org/2000/svg"><path opacity="0.4" d="M49.9479 27.1824C49.0803 27.1824 48.3907 27.872 48.3907 28.7396V32.2544C48.3907 40.1293 41.984 46.5361 34.109 46.5361C26.234 46.5361 19.8273 40.1293 19.8273 32.2544V28.7173C19.8273 27.8497 19.1377 27.1601 18.2701 27.1601C17.4025 27.1601 16.7129 27.8497 16.7129 28.7173V32.2321C16.7129 41.2861 23.6758 48.7384 32.5518 49.5393V54.2776C32.5518 55.1452 33.2414 55.8348 34.109 55.8348C34.9766 55.8348 35.6662 55.1452 35.6662 54.2776V49.5393C44.52 48.7607 51.5051 41.2861 51.5051 32.2321V28.7173C51.4829 27.872 50.7933 27.1824 49.9479 27.1824Z" fill="#BE123C"/><path d="M34.1099 11.3434C28.682 11.3434 24.2773 15.7481 24.2773 21.176V32.5658C24.2773 37.9938 28.682 42.3984 34.1099 42.3984C39.5379 42.3984 43.9425 37.9938 43.9425 32.5658V21.176C43.9425 15.7481 39.5379 11.3434 34.1099 11.3434ZM37.0241 26.8042C36.8684 27.3826 36.3567 27.7608 35.7784 27.7608C35.6671 27.7608 35.5559 27.7385 35.4447 27.7163C34.5771 27.4716 33.665 27.4716 32.7974 27.7163C32.0856 27.9165 31.396 27.4938 31.218 26.8042C31.0178 26.1146 31.4404 25.4027 32.1301 25.2247C33.4426 24.8688 34.8218 24.8688 36.1343 25.2247C36.8017 25.4027 37.2021 26.1146 37.0241 26.8042ZM38.2031 22.4885C38.0029 23.0224 37.5135 23.3339 36.9796 23.3339C36.8239 23.3339 36.6904 23.3116 36.5347 23.2671C34.9775 22.6887 33.2423 22.6887 31.6852 23.2671C31.0178 23.5118 30.2614 23.1559 30.0167 22.4885C29.772 21.8212 30.128 21.0648 30.7953 20.8423C32.9309 20.0637 35.289 20.0637 37.4245 20.8423C38.0919 21.087 38.4478 21.8212 38.2031 22.4885Z" fill="#BE123C"/></svg>;
|
25 |
+
const SvgCameraIcon = () => <svg width="40" height="40" viewBox="0 0 40 40" fill="none" xmlns="http://www.w3.org/2000/svg"><path opacity="0.4" d="M21.8118 5.52235H11.9265C6.29183 5.52235 4.10059 7.7136 4.10059 13.3482V26.5286C4.10059 30.318 6.16002 34.3545 11.9265 34.3545H21.8118C27.4464 34.3545 29.6376 32.1633 29.6376 26.5286V13.3482C29.6376 7.7136 27.4464 5.52235 21.8118 5.52235Z" fill="#2252A0"/><path d="M19.3406 18.9169C21.0512 18.9169 22.438 17.5302 22.438 15.8195C22.438 14.1089 21.0512 12.7222 19.3406 12.7222C17.6299 12.7222 16.2432 14.1089 16.2432 15.8195C16.2432 17.5302 17.6299 18.9169 19.3406 18.9169Z" fill="#2252A0"/><path d="M36.0629 10.3332C35.3874 9.98721 33.9705 9.5918 32.0429 10.9428L29.6045 12.6562C29.621 12.8869 29.6374 13.1011 29.6374 13.3482V26.5286C29.6374 26.7758 29.6045 26.9899 29.6045 27.2206L32.0429 28.934C33.0643 29.659 33.954 29.8896 34.6625 29.8896C35.2721 29.8896 35.7499 29.7249 36.0629 29.5601C36.7384 29.2141 37.8752 28.275 37.8752 25.919V13.9743C37.8752 11.6183 36.7384 10.6792 36.0629 10.3332Z" fill="#2252A0"/></svg>;
|
26 |
+
const SvgStopCamIcon = () => <svg width="40" height="40" viewBox="0 0 40 40" fill="none" xmlns="http://www.w3.org/2000/svg"><path opacity="0.4" d="M29.0785 10.8076L6.91966 32.9665C4.61316 31.5002 3.70703 28.8807 3.70703 26.36V13.18C3.70703 7.54555 5.89821 5.35437 11.5327 5.35437H21.4177C26.1789 5.35437 28.4854 6.9195 29.0785 10.8076Z" fill="#2252A0"/><path opacity="0.4" d="M29.2427 15.2394V26.36C29.2427 26.4918 29.2262 26.5907 29.2262 26.706C29.2262 26.8213 29.2097 26.9366 29.2097 27.052H29.2262C29.045 32.1757 26.8208 34.1856 21.417 34.1856H11.532C11.1202 34.1856 10.7412 34.1692 10.3623 34.1197L29.2427 15.2394Z" fill="#2252A0"/><path opacity="0.4" d="M29.21 27.052C29.21 26.9366 29.2264 26.8213 29.2264 26.706C29.2429 26.8213 29.2429 26.9366 29.2264 27.052H29.21Z" fill="#2252A0"/><path opacity="0.4" d="M29.2264 12.4716C29.2429 12.5869 29.2429 12.7187 29.2264 12.834C29.2264 12.7187 29.21 12.6034 29.21 12.488L29.2264 12.4716Z" fill="#2252A0"/><path d="M37.4804 13.8061V25.734C37.4804 28.0899 36.3436 29.029 35.6682 29.3749C35.3551 29.5397 34.8774 29.7209 34.2678 29.7209C33.5594 29.7209 32.6697 29.4903 31.6483 28.7654L29.2264 27.052H29.21C29.21 26.9366 29.2264 26.8213 29.2264 26.706C29.2264 26.5907 29.2429 26.4918 29.2429 26.36V15.2394L34.6302 9.85205C35.0751 9.885 35.421 10.0168 35.6682 10.1651C36.3436 10.5111 37.4804 11.4501 37.4804 13.8061Z" fill="#2252A0"/><path d="M35.8666 3.67393C35.3723 3.17968 34.565 3.17968 34.0708 3.67393L3.6744 34.0868C3.18015 34.581 3.18015 35.3883 3.6744 35.8826C3.92152 36.1132 4.23455 36.245 4.56405 36.245C4.89355 36.245 5.20657 36.1132 5.4537 35.8661L35.8666 5.45323C36.3773 4.95898 36.3773 4.16818 35.8666 3.67393Z" fill="#2252A0"/></svg>;
|
27 |
+
const SvgHumanIcon = () => <svg width="70" height="70" viewBox="0 0 88 89" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M75.1481 81.6361H12.9259C9.66667 81.6361 7 78.9721 7 75.7161V58.5112C7 57.5862 7 57.1052 7.44444 56.2172C8.85185 52.9612 13 50.2232 19.4815 47.8922C24.1111 56.6982 33.3704 62.6921 44 62.6921C54.6296 62.6921 63.9259 56.6982 68.5185 47.8922C75 50.1862 79.1852 52.9982 80.5556 56.2172C81 56.6612 81 57.6232 81 58.5112V75.7161C81 78.9721 78.3333 81.6361 75.0741 81.6361H75.1481Z" stroke="#FCFCFC" strokeWidth="6.42146" strokeLinecap="round" strokeLinejoin="round"/><path d="M44.0371 50.1862C33.8519 50.1862 25.5186 41.8612 25.5186 31.6863V26.1363C25.5186 15.9613 33.8519 7.63635 44.0371 7.63635C54.2223 7.63635 62.5556 15.9613 62.5556 26.1363V31.6863C62.5556 41.8612 54.2223 50.1862 44.0371 50.1862Z" stroke="#FCFCFC" strokeWidth="6.42146" strokeLinecap="round" strokeLinejoin="round"/></svg>;
|
28 |
+
const SvgSwitchCameraIcon = () => <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round"> <path d="M11 19H4a2 2 0 0 1-2-2V7a2 2 0 0 1 2-2h5"/><path d="M13 5h7a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2h-5"/><path d="m17 12-3-3 3-3"/><path d="m7 12 3 3-3 3"/></svg>;
|
29 |
+
|
30 |
+
const LogoDisplay = ({ isMini, isHumanActive, isAiActive }: { isMini: boolean; isHumanActive: boolean; isAiActive: boolean; }) => {
|
31 |
+
if (!isHumanActive && !isAiActive) return null;
|
32 |
+
const size = isMini ? 80 : 200;
|
33 |
+
const iconSize = isMini ? 35 : 70;
|
34 |
+
const insetBase = isMini ? { ping: 10, outer: 0, mid: 5, inner: 12, icon: 22 }
|
35 |
+
: { ping: 40, outer: 0, mid: 20, inner: 50, icon: 65 };
|
36 |
+
const bgColorBase = isHumanActive ? 'blue' : (isAiActive ? 'green' : 'gray');
|
37 |
+
|
38 |
+
return (
|
39 |
+
<>
|
40 |
+
{/* Dummy divs for Tailwind JIT compiler to pick up classes */}
|
41 |
+
<div className="hidden bg-green-200 bg-green-300 bg-green-400 bg-blue-200 bg-blue-300 bg-blue-400"></div>
|
42 |
+
<div className="relative" style={{ width: `${size}px`, height: `${size}px` }}>
|
43 |
+
<div className={`absolute rounded-full opacity-50 animate-ping bg-${bgColorBase}-200`} style={{ inset: `${insetBase.ping}px` }}></div>
|
44 |
+
<div className={`absolute inset-0 rounded-full opacity-50 bg-${bgColorBase}-200`}></div>
|
45 |
+
<div className={`absolute rounded-full opacity-50 bg-${bgColorBase}-300`} style={{ inset: `${insetBase.mid}px` }}></div>
|
46 |
+
<div className={`absolute rounded-full opacity-50 bg-${bgColorBase}-400`} style={{ inset: `${insetBase.inner}px` }}></div>
|
47 |
+
<div className="z-10 absolute" style={{ inset: `${insetBase.icon}px`, display: 'flex', alignItems: 'center', justifyContent: 'center' }}>
|
48 |
+
{ (isHumanActive || isAiActive) && <SvgHumanIcon /> /* Placeholder for AI icon if needed */ }
|
49 |
+
</div>
|
50 |
+
</div>
|
51 |
+
</>
|
52 |
+
);
|
53 |
+
};
|
54 |
+
|
55 |
+
|
56 |
+
function AppInternal() {
|
57 |
+
const videoRef = useRef<HTMLVideoElement>(null);
|
58 |
+
const [appVideoStream, setAppVideoStream] = useState<MediaStream | null>(null); // Renamed to avoid conflict
|
59 |
+
const [showIOSModal, setShowIOSModal] = useState(false);
|
60 |
+
const [isAllowedOrigin, setIsAllowedOrigin] = useState<boolean | null>(null);
|
61 |
+
|
62 |
+
// States from new HTML/JS
|
63 |
+
const [isMicActive, setIsMicActive] = useState(false);
|
64 |
+
const [isCamActive, setIsCamActive] = useState(false);
|
65 |
+
const [isNotificationOpen, setIsNotificationOpen] = useState(false);
|
66 |
+
const [isDarkMode, setIsDarkMode] = useState(false); // Example: for dark mode toggle
|
67 |
+
|
68 |
+
const { connected, connect, disconnect, setMuted, client, currentFacingMode, rotateWebcam, changeStreams } = useLiveAPIContext();
|
69 |
+
|
70 |
+
useEffect(() => {
|
71 |
+
if (isIOS()) {
|
72 |
+
setShowIOSModal(true);
|
73 |
+
}
|
74 |
+
// Origin check logic
|
75 |
+
try {
|
76 |
+
if (window.self !== window.top) {
|
77 |
+
if (window.location.ancestorOrigins && window.location.ancestorOrigins.length > 0) {
|
78 |
+
const parentOrigin = window.location.ancestorOrigins[0];
|
79 |
+
console.log("Parent Origin:", parentOrigin);
|
80 |
+
if (parentOrigin === ALLOWED_ORIGIN) {
|
81 |
+
setIsAllowedOrigin(true);
|
82 |
+
} else {
|
83 |
+
console.warn(`Blocked load from origin: ${parentOrigin}`);
|
84 |
+
setIsAllowedOrigin(false);
|
85 |
+
}
|
86 |
+
} else {
|
87 |
+
console.warn("Cannot verify parent origin (ancestorOrigins not available/empty). Blocking.");
|
88 |
+
setIsAllowedOrigin(false);
|
89 |
+
}
|
90 |
+
} else {
|
91 |
+
// For local development and direct access if needed for testing
|
92 |
+
// WARNING: In production, you might want to strictly enforce iframe embedding.
|
93 |
+
// For Hugging Face Spaces, it's usually embedded.
|
94 |
+
if (process.env.NODE_ENV === 'development' || window.location.hostname === 'localhost' || window.location.hostname.includes('hf.space')) {
|
95 |
+
console.warn("App loaded directly or on hf.space. Allowing for dev/test.");
|
96 |
+
setIsAllowedOrigin(true);
|
97 |
+
} else {
|
98 |
+
console.warn("App loaded directly, not in an iframe from allowed origin. Blocking.");
|
99 |
+
setIsAllowedOrigin(false);
|
100 |
+
}
|
101 |
+
}
|
102 |
+
} catch (e) {
|
103 |
+
console.error("Cross-origin access error, cannot verify parent. Blocking.", e);
|
104 |
+
setIsAllowedOrigin(false);
|
105 |
+
}
|
106 |
+
}, []);
|
107 |
+
|
108 |
+
// Sync mic active state with Gemini's muted state
|
109 |
+
useEffect(() => {
|
110 |
+
setIsMicActive(connected && !client?.isMuted); // Assuming client has an isMuted property or similar
|
111 |
+
}, [connected, client?.isMuted]);
|
112 |
+
|
113 |
+
// Sync cam active state with appVideoStream
|
114 |
+
useEffect(() => {
|
115 |
+
setIsCamActive(!!appVideoStream);
|
116 |
+
}, [appVideoStream]);
|
117 |
+
|
118 |
+
|
119 |
+
const handleToggleMic = () => {
|
120 |
+
if (!connected) {
|
121 |
+
// Try to connect first if not connected
|
122 |
+
handleConnectToggle().then(() => {
|
123 |
+
setMuted(isMicActive); // Toggle mute state after connection attempt
|
124 |
+
setIsMicActive(!isMicActive);
|
125 |
+
});
|
126 |
+
} else {
|
127 |
+
setMuted(isMicActive); // If already connected, just toggle mute
|
128 |
+
setIsMicActive(!isMicActive);
|
129 |
+
}
|
130 |
+
};
|
131 |
+
|
132 |
+
const handleToggleCam = async () => {
|
133 |
+
if (!isCamActive) {
|
134 |
+
if (!connected) await handleConnectToggle(); // Ensure connection before starting cam
|
135 |
+
// Use the changeStreams function from context/ControlTray
|
136 |
+
if (changeStreams) changeStreams('webcam')();
|
137 |
+
} else {
|
138 |
+
if (changeStreams) changeStreams('none')();
|
139 |
+
}
|
140 |
+
// The isCamActive state will be updated by the useEffect watching appVideoStream
|
141 |
+
};
|
142 |
+
|
143 |
+
const handleSwitchCamera = () => {
|
144 |
+
if (isCamActive && rotateWebcam) {
|
145 |
+
rotateWebcam();
|
146 |
+
}
|
147 |
+
};
|
148 |
+
|
149 |
+
const handleConnectToggle = async () => {
|
150 |
+
try {
|
151 |
+
if (connected) {
|
152 |
+
await disconnect();
|
153 |
+
setIsMicActive(false); // Deactivate mic on disconnect
|
154 |
+
// Camera will be stopped by ControlTray's logic on disconnect
|
155 |
+
} else {
|
156 |
+
await connect();
|
157 |
+
// Mic/Cam can be enabled after connection if desired, or let user do it
|
158 |
+
}
|
159 |
+
} catch (err) {
|
160 |
+
console.error('Connection/Disconnection error:', err);
|
161 |
+
}
|
162 |
+
};
|
163 |
+
|
164 |
+
const handleNotificationToggle = (event?: React.MouseEvent) => {
|
165 |
+
event?.stopPropagation();
|
166 |
+
setIsNotificationOpen(prev => !prev);
|
167 |
+
};
|
168 |
+
|
169 |
+
useEffect(() => {
|
170 |
+
const handleClickOutside = (event: MouseEvent) => {
|
171 |
+
const popoverWrapper = document.getElementById('notification-popover-wrapper');
|
172 |
+
const notificationButton = document.getElementById('notification-button');
|
173 |
+
if (isNotificationOpen && popoverWrapper && !popoverWrapper.contains(event.target as Node) && notificationButton && !notificationButton.contains(event.target as Node) ) {
|
174 |
+
setIsNotificationOpen(false);
|
175 |
+
}
|
176 |
+
};
|
177 |
+
if (isNotificationOpen) {
|
178 |
+
document.addEventListener('click', handleClickOutside);
|
179 |
+
}
|
180 |
+
return () => {
|
181 |
+
document.removeEventListener('click', handleClickOutside);
|
182 |
+
};
|
183 |
+
}, [isNotificationOpen]);
|
184 |
+
|
185 |
+
// Dark mode
|
186 |
+
useEffect(() => {
|
187 |
+
if (isDarkMode) {
|
188 |
+
document.documentElement.classList.add('dark');
|
189 |
+
} else {
|
190 |
+
document.documentElement.classList.remove('dark');
|
191 |
+
}
|
192 |
+
}, [isDarkMode]);
|
193 |
+
|
194 |
+
|
195 |
+
if (isAllowedOrigin === null) {
|
196 |
+
return <div style={{ padding: '20px', textAlign: 'center' }}>در حال بررسی دسترسی...</div>;
|
197 |
+
}
|
198 |
+
|
199 |
+
if (isAllowedOrigin === false) {
|
200 |
+
return <div style={{ padding: '20px', textAlign: 'center', color: 'red' }}>دسترسی غیرمجاز! اگر چت صوتی و تصویری برای شما باز نمیشود این لینک رو با مرورگر کروم باز کنید و همچنین مرورگر کروم رو به عنوان مرورگر پیشفرض گوشی خود قرار دهید تا هر بار زدن روی دکمه شروع داخل برنامه لینک با مرورگر کروم باز بشه، برای پیشفرض قرار دادن مرورگر کروم وارد تنظیمات گوشی خود شوید قسمت برنامه ها ، مدیریت برنامه ها رو کلیک کنید بالای صفحه روی سه نقطه بزنید و تنظیمات بیشتر رو انتخاب کنید بعدا وارد قسمت برنامه های پیش فرض شوید و مرورگر کروم رو به عنوان مرورگر پیشفرض خود قرار دهید، اگر مشکلی بود حتماً به پشتیبانی برنامه پیام بفرستید</div>;
|
201 |
+
}
|
202 |
+
|
203 |
+
return (
|
204 |
+
<div className={`App w-full flex flex-col items-center justify-center min-h-[90dvh] md:min-h-screen antialiased ${isDarkMode ? 'dark' : ''}`}>
|
205 |
+
<div className="max-w-3xl w-full flex flex-col items-center justify-center h-full relative">
|
206 |
+
{/* Header */}
|
207 |
+
<div className="header-controls">
|
208 |
+
<div id="notification-trigger-container" className="notification-trigger-container">
|
209 |
+
<button id="notification-button" aria-label="Notifications" className="header-button" onClick={handleNotificationToggle}>
|
210 |
+
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round"><circle cx="12" cy="12" r="10"></circle><line x1="12" y1="8" x2="12" y2="12"></line><line x1="12" y1="16" x2="12.01" y2="16"></line></svg>
|
211 |
+
</button>
|
212 |
+
</div>
|
213 |
+
<div className="back-button-container">
|
214 |
+
<div className="header-button" onClick={() => alert('Back clicked (or implement navigation)')}>
|
215 |
+
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round"><path d="m15 18-6-6 6-6"></path></svg>
|
216 |
+
</div>
|
217 |
+
</div>
|
218 |
+
</div>
|
219 |
+
|
220 |
+
{/* Notification Popover */}
|
221 |
+
<div id="notification-popover-wrapper" className="notification-popover-wrapper">
|
222 |
+
<div
|
223 |
+
id="notification-popover"
|
224 |
+
className={cn("popover-content", {
|
225 |
+
'open animate-popover-open-top-center': isNotificationOpen,
|
226 |
+
'animate-popover-close-top-center': !isNotificationOpen && document.getElementById('notification-popover')?.classList.contains('open') // Only animate close if it was open
|
227 |
+
})}
|
228 |
+
>
|
229 |
+
<div className="notification-popover-text-content">
|
230 |
+
مدلهای هوش مصنوعی میتوانند اشتباه کنند، صحت اطلاعات مهم را بررسی کنید و از وارد کردن اطلاعات حساس بپرهیزید.
|
231 |
+
</div>
|
232 |
+
</div>
|
233 |
+
</div>
|
234 |
+
|
235 |
+
{/* Main Media Area */}
|
236 |
+
<div className="w-full flex flex-col items-center justify-center h-[90dvh] bg-background top-0 left-0 relative">
|
237 |
+
<video
|
238 |
+
id="video-feed"
|
239 |
+
ref={videoRef}
|
240 |
+
autoPlay
|
241 |
+
playsInline
|
242 |
+
className={cn("absolute top-0 left-0 w-full h-full object-cover", {
|
243 |
+
"scale-x-[-1]": currentFacingMode === "user", // Mirror if user facing
|
244 |
+
"hidden": !isCamActive
|
245 |
+
})}
|
246 |
+
/>
|
247 |
+
|
248 |
+
{/* Altair Chat UI - Position and style as needed */}
|
249 |
+
<div className="absolute inset-0 flex items-center justify-center pointer-events-none">
|
250 |
+
{connected && <Altair className="w-full max-w-md p-4 pointer-events-auto" />} {/* Adjust styling and conditional rendering */}
|
251 |
+
</div>
|
252 |
+
|
253 |
+
|
254 |
+
{(!isCamActive && isMicActive) && (
|
255 |
+
<div id="large-logo-container" className="flex items-center justify-center w-full h-full absolute top-0 left-0">
|
256 |
+
<LogoDisplay isMini={false} isHumanActive={true} isAiActive={false} />
|
257 |
+
</div>
|
258 |
+
)}
|
259 |
+
|
260 |
+
{/* Footer Controls */}
|
261 |
+
<div
|
262 |
+
id="footer-controls"
|
263 |
+
className={cn("footer-controls", {
|
264 |
+
"layout-default": !isCamActive,
|
265 |
+
"layout-with-small-logo": isCamActive
|
266 |
+
})}
|
267 |
+
>
|
268 |
+
<div id="cam-button-wrapper" className="relative flex justify-center">
|
269 |
+
<button id="cam-button" className="control-button cam-button-color" onClick={handleToggleCam} disabled={!connected && !isCamActive /* Allow turning off if active but disconnected */}>
|
270 |
+
{isCamActive ? <SvgStopCamIcon /> : <SvgCameraIcon />}
|
271 |
+
</button>
|
272 |
+
<div id="switch-camera-button-container" className={cn("switch-camera-button-container", { "visible": isCamActive && connected })}>
|
273 |
+
<button id="switch-camera-button" aria-label="Switch Camera" className="switch-camera-button-content" onClick={handleSwitchCamera} disabled={!isCamActive || !connected}>
|
274 |
+
<SvgSwitchCameraIcon/>
|
275 |
+
</button>
|
276 |
+
</div>
|
277 |
+
</div>
|
278 |
+
|
279 |
+
{isCamActive && (
|
280 |
+
<div id="small-logo-container" className="flex items-center justify-center">
|
281 |
+
<LogoDisplay isMini={true} isHumanActive={true} isAiActive={false} />
|
282 |
+
</div>
|
283 |
+
)}
|
284 |
+
|
285 |
+
<button id="mic-button" className="control-button mic-button-color" onClick={handleToggleMic} disabled={!connected && !isMicActive}>
|
286 |
+
{isMicActive ? <SvgPauseIcon /> : <SvgMicrophoneIcon />}
|
287 |
+
</button>
|
288 |
+
</div>
|
289 |
+
</div>
|
290 |
+
</div>
|
291 |
+
|
292 |
+
{/* ControlTray is now mostly for logic, not UI, but needs videoRef and stream changes */}
|
293 |
+
<ControlTray
|
294 |
+
videoRef={videoRef}
|
295 |
+
supportsVideo={true} // You can make this dynamic if needed
|
296 |
+
onVideoStreamChange={setAppVideoStream} // Pass the renamed state setter
|
297 |
+
isUiHidden={true} // A new prop to hide its default UI
|
298 |
+
/>
|
299 |
+
|
300 |
+
<IOSModal
|
301 |
+
isOpen={showIOSModal}
|
302 |
+
onClose={() => setShowIOSModal(false)}
|
303 |
+
/>
|
304 |
+
|
305 |
+
{/* Example Dark Mode Toggle - remove or place elsewhere */}
|
306 |
+
<button
|
307 |
+
onClick={() => setIsDarkMode(!isDarkMode)}
|
308 |
+
className="absolute top-4 right-20 p-2 bg-gray-500 text-white rounded z-50"
|
309 |
+
>
|
310 |
+
Toggle Dark
|
311 |
+
</button>
|
312 |
+
{/* Connect/Disconnect Button (from original ControlTray, adapted) */}
|
313 |
+
<button
|
314 |
+
onClick={handleConnectToggle}
|
315 |
+
className="absolute bottom-28 left-1/2 transform -translate-x-1/2 z-50 p-3 rounded-full shadow-lg"
|
316 |
+
style={{ backgroundColor: connected ? 'var(--accent-red)' : 'var(--Blue-500)', color: 'white' }}
|
317 |
+
title={connected ? "Disconnect Stream" : "Connect Stream"}
|
318 |
+
>
|
319 |
+
<span className="material-symbols-outlined filled" style={{ fontSize: '30px' }}>
|
320 |
+
{connected ? "pause" : "play_arrow"}
|
321 |
+
</span>
|
322 |
+
</button>
|
323 |
+
</div>
|
324 |
+
);
|
325 |
+
}
|
326 |
+
|
327 |
+
|
328 |
// --- 👇 دستورالعمل شخصیسازی شما (بدون تغییر) 👇 ---
|
329 |
const myCustomInstruction = `
|
330 |
ت1. هویت دستیار:
|
|
|
398 |
`.trim();
|
399 |
// --- 👆 ---
|
400 |
|
401 |
+
// --- 👇 تنظیمات اولیه (بدون تغییر) 👇 ---
|
402 |
const initialAppConfig: LiveConfig = {
|
403 |
+
model: "models/gemini-2.0-flash-exp", // یا هر مدلی که استفاده میکنید
|
404 |
+
systemInstruction: {
|
405 |
+
parts: [{ text: myCustomInstruction }]
|
406 |
+
}
|
407 |
};
|
408 |
+
// --- 👆 ---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
409 |
|
410 |
function App() {
|
411 |
+
return (
|
412 |
+
<LiveAPIProvider initialConfig={initialAppConfig}>
|
413 |
+
<AppInternal />
|
414 |
+
</LiveAPIProvider>
|
415 |
+
);
|
416 |
}
|
417 |
|
418 |
export default App;
|