@jaak.ai/stamps 2.0.0-dev.30 → 2.0.0-dev.32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/jaak-stamps-webcomponent.cjs.js +1 -1
- package/dist/cjs/jaak-stamps.cjs.entry.js +1493 -1254
- package/dist/cjs/jaak-stamps.cjs.entry.js.map +1 -1
- package/dist/cjs/jaak-stamps.entry.cjs.js.map +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/components/my-component/my-component.css +325 -126
- package/dist/collection/components/my-component/my-component.js +645 -1389
- package/dist/collection/components/my-component/my-component.js.map +1 -1
- package/dist/collection/services/CameraService.js +292 -0
- package/dist/collection/services/CameraService.js.map +1 -0
- package/dist/collection/services/DetectionService.js +369 -0
- package/dist/collection/services/DetectionService.js.map +1 -0
- package/dist/collection/services/EventBusService.js +42 -0
- package/dist/collection/services/EventBusService.js.map +1 -0
- package/dist/collection/services/LoggerService.js +40 -0
- package/dist/collection/services/LoggerService.js.map +1 -0
- package/dist/collection/services/ServiceContainer.js +66 -0
- package/dist/collection/services/ServiceContainer.js.map +1 -0
- package/dist/collection/services/StateManagerService.js +109 -0
- package/dist/collection/services/StateManagerService.js.map +1 -0
- package/dist/collection/services/factories/DeviceStrategyFactory.js +16 -0
- package/dist/collection/services/factories/DeviceStrategyFactory.js.map +1 -0
- package/dist/collection/services/interfaces/ICameraService.js +2 -0
- package/dist/collection/services/interfaces/ICameraService.js.map +1 -0
- package/dist/collection/services/interfaces/IDetectionService.js +2 -0
- package/dist/collection/services/interfaces/IDetectionService.js.map +1 -0
- package/dist/collection/services/interfaces/IEventBus.js +2 -0
- package/dist/collection/services/interfaces/IEventBus.js.map +1 -0
- package/dist/collection/services/interfaces/ILogger.js +2 -0
- package/dist/collection/services/interfaces/ILogger.js.map +1 -0
- package/dist/collection/services/interfaces/IStateManager.js +2 -0
- package/dist/collection/services/interfaces/IStateManager.js.map +1 -0
- package/dist/collection/services/strategies/HighPerformanceDeviceStrategy.js +30 -0
- package/dist/collection/services/strategies/HighPerformanceDeviceStrategy.js.map +1 -0
- package/dist/collection/services/strategies/IDeviceStrategy.js +2 -0
- package/dist/collection/services/strategies/IDeviceStrategy.js.map +1 -0
- package/dist/collection/services/strategies/LowMemoryDeviceStrategy.js +30 -0
- package/dist/collection/services/strategies/LowMemoryDeviceStrategy.js.map +1 -0
- package/dist/components/jaak-stamps.js +1501 -1275
- package/dist/components/jaak-stamps.js.map +1 -1
- package/dist/esm/jaak-stamps-webcomponent.js +1 -1
- package/dist/esm/jaak-stamps.entry.js +1493 -1254
- package/dist/esm/jaak-stamps.entry.js.map +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/jaak-stamps-webcomponent/jaak-stamps-webcomponent.esm.js +1 -1
- package/dist/jaak-stamps-webcomponent/jaak-stamps.entry.esm.js.map +1 -1
- package/dist/jaak-stamps-webcomponent/p-9d1c45a9.entry.js +2 -0
- package/dist/jaak-stamps-webcomponent/p-9d1c45a9.entry.js.map +1 -0
- package/dist/types/components/my-component/my-component.d.ts +68 -100
- package/dist/types/components.d.ts +3 -3
- package/dist/types/services/CameraService.d.ts +41 -0
- package/dist/types/services/DetectionService.d.ts +35 -0
- package/dist/types/services/EventBusService.d.ts +9 -0
- package/dist/types/services/LoggerService.d.ts +12 -0
- package/dist/types/services/ServiceContainer.d.ts +26 -0
- package/dist/types/services/StateManagerService.d.ts +15 -0
- package/dist/types/services/factories/DeviceStrategyFactory.d.ts +4 -0
- package/dist/types/services/interfaces/ICameraService.d.ts +32 -0
- package/dist/types/services/interfaces/IDetectionService.d.ts +31 -0
- package/dist/types/services/interfaces/IEventBus.d.ts +16 -0
- package/dist/types/services/interfaces/ILogger.d.ts +8 -0
- package/dist/types/services/interfaces/IStateManager.d.ts +35 -0
- package/dist/types/services/strategies/HighPerformanceDeviceStrategy.d.ts +6 -0
- package/dist/types/services/strategies/IDeviceStrategy.d.ts +21 -0
- package/dist/types/services/strategies/LowMemoryDeviceStrategy.d.ts +6 -0
- package/package.json +3 -3
- package/dist/jaak-stamps-webcomponent/p-b62b53f8.entry.js +0 -2
- package/dist/jaak-stamps-webcomponent/p-b62b53f8.entry.js.map +0 -1
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
export class StateManagerService {
|
|
2
|
+
eventBus;
|
|
3
|
+
captureState = {
|
|
4
|
+
step: 'front',
|
|
5
|
+
isCapturing: false,
|
|
6
|
+
isDetectionPaused: false,
|
|
7
|
+
isVideoActive: false,
|
|
8
|
+
isLoading: false,
|
|
9
|
+
showFlipAnimation: false,
|
|
10
|
+
showSuccessAnimation: false,
|
|
11
|
+
bestScore: 0,
|
|
12
|
+
hasScreenshotTaken: false
|
|
13
|
+
};
|
|
14
|
+
capturedImages = {
|
|
15
|
+
front: {
|
|
16
|
+
fullFrame: null,
|
|
17
|
+
cropped: null
|
|
18
|
+
},
|
|
19
|
+
back: {
|
|
20
|
+
fullFrame: null,
|
|
21
|
+
cropped: null
|
|
22
|
+
},
|
|
23
|
+
metadata: {
|
|
24
|
+
totalImages: 0,
|
|
25
|
+
processCompleted: false,
|
|
26
|
+
backCaptureSkipped: false
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
constructor(eventBus) {
|
|
30
|
+
this.eventBus = eventBus;
|
|
31
|
+
}
|
|
32
|
+
getCaptureState() {
|
|
33
|
+
return { ...this.captureState };
|
|
34
|
+
}
|
|
35
|
+
updateCaptureState(updates) {
|
|
36
|
+
const previousState = { ...this.captureState };
|
|
37
|
+
this.captureState = { ...this.captureState, ...updates };
|
|
38
|
+
// Emit state change event
|
|
39
|
+
this.eventBus.emit('state-changed', {
|
|
40
|
+
previous: previousState,
|
|
41
|
+
current: this.captureState,
|
|
42
|
+
changes: updates
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
getCapturedImages() {
|
|
46
|
+
return JSON.parse(JSON.stringify(this.capturedImages));
|
|
47
|
+
}
|
|
48
|
+
setCapturedImages(images) {
|
|
49
|
+
this.capturedImages = {
|
|
50
|
+
...this.capturedImages,
|
|
51
|
+
...images,
|
|
52
|
+
metadata: {
|
|
53
|
+
...this.capturedImages.metadata,
|
|
54
|
+
...images.metadata
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
// Update total images count
|
|
58
|
+
let totalImages = 0;
|
|
59
|
+
if (this.capturedImages.front.fullFrame && this.capturedImages.front.cropped) {
|
|
60
|
+
totalImages += 2;
|
|
61
|
+
}
|
|
62
|
+
if (this.capturedImages.back.fullFrame && this.capturedImages.back.cropped) {
|
|
63
|
+
totalImages += 2;
|
|
64
|
+
}
|
|
65
|
+
this.capturedImages.metadata.totalImages = totalImages;
|
|
66
|
+
}
|
|
67
|
+
reset() {
|
|
68
|
+
this.captureState = {
|
|
69
|
+
step: 'front',
|
|
70
|
+
isCapturing: false,
|
|
71
|
+
isDetectionPaused: false,
|
|
72
|
+
isVideoActive: false,
|
|
73
|
+
isLoading: false,
|
|
74
|
+
showFlipAnimation: false,
|
|
75
|
+
showSuccessAnimation: false,
|
|
76
|
+
bestScore: 0,
|
|
77
|
+
hasScreenshotTaken: false
|
|
78
|
+
};
|
|
79
|
+
this.capturedImages = {
|
|
80
|
+
front: {
|
|
81
|
+
fullFrame: null,
|
|
82
|
+
cropped: null
|
|
83
|
+
},
|
|
84
|
+
back: {
|
|
85
|
+
fullFrame: null,
|
|
86
|
+
cropped: null
|
|
87
|
+
},
|
|
88
|
+
metadata: {
|
|
89
|
+
totalImages: 0,
|
|
90
|
+
processCompleted: false,
|
|
91
|
+
backCaptureSkipped: false
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
this.eventBus.emit('state-changed', {
|
|
95
|
+
previous: null,
|
|
96
|
+
current: this.captureState,
|
|
97
|
+
changes: { reset: true }
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
isProcessCompleted() {
|
|
101
|
+
return this.captureState.step === 'completed';
|
|
102
|
+
}
|
|
103
|
+
canProceedToBack() {
|
|
104
|
+
return this.captureState.step === 'front' &&
|
|
105
|
+
this.capturedImages.front.fullFrame !== null &&
|
|
106
|
+
this.capturedImages.front.cropped !== null;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
//# sourceMappingURL=StateManagerService.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StateManagerService.js","sourceRoot":"","sources":["../../src/services/StateManagerService.ts"],"names":[],"mappings":"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","sourcesContent":["import { IStateManager, CaptureState, CapturedImages } from './interfaces/IStateManager';\nimport { IEventBus } from './interfaces/IEventBus';\n\nexport class StateManagerService implements IStateManager {\n private captureState: CaptureState = {\n step: 'front',\n isCapturing: false,\n isDetectionPaused: false,\n isVideoActive: false,\n isLoading: false,\n showFlipAnimation: false,\n showSuccessAnimation: false,\n bestScore: 0,\n hasScreenshotTaken: false\n };\n\n private capturedImages: CapturedImages = {\n front: {\n fullFrame: null,\n cropped: null\n },\n back: {\n fullFrame: null,\n cropped: null\n },\n metadata: {\n totalImages: 0,\n processCompleted: false,\n backCaptureSkipped: false\n }\n };\n\n constructor(private eventBus: IEventBus) {}\n\n getCaptureState(): CaptureState {\n return { ...this.captureState };\n }\n\n updateCaptureState(updates: Partial<CaptureState>): void {\n const previousState = { ...this.captureState };\n this.captureState = { ...this.captureState, ...updates };\n \n // Emit state change event\n this.eventBus.emit('state-changed', {\n previous: previousState,\n current: this.captureState,\n changes: updates\n });\n }\n\n getCapturedImages(): CapturedImages {\n return JSON.parse(JSON.stringify(this.capturedImages));\n }\n\n setCapturedImages(images: Partial<CapturedImages>): void {\n this.capturedImages = {\n ...this.capturedImages,\n ...images,\n metadata: {\n ...this.capturedImages.metadata,\n ...images.metadata\n }\n };\n\n // Update total images count\n let totalImages = 0;\n if (this.capturedImages.front.fullFrame && this.capturedImages.front.cropped) {\n totalImages += 2;\n }\n if (this.capturedImages.back.fullFrame && this.capturedImages.back.cropped) {\n totalImages += 2;\n }\n this.capturedImages.metadata.totalImages = totalImages;\n }\n\n reset(): void {\n this.captureState = {\n step: 'front',\n isCapturing: false,\n isDetectionPaused: false,\n isVideoActive: false,\n isLoading: false,\n showFlipAnimation: false,\n showSuccessAnimation: false,\n bestScore: 0,\n hasScreenshotTaken: false\n };\n\n this.capturedImages = {\n front: {\n fullFrame: null,\n cropped: null\n },\n back: {\n fullFrame: null,\n cropped: null\n },\n metadata: {\n totalImages: 0,\n processCompleted: false,\n backCaptureSkipped: false\n }\n };\n\n this.eventBus.emit('state-changed', {\n previous: null,\n current: this.captureState,\n changes: { reset: true }\n });\n }\n\n isProcessCompleted(): boolean {\n return this.captureState.step === 'completed';\n }\n\n canProceedToBack(): boolean {\n return this.captureState.step === 'front' && \n this.capturedImages.front.fullFrame !== null && \n this.capturedImages.front.cropped !== null;\n }\n}"]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { LowMemoryDeviceStrategy } from "../strategies/LowMemoryDeviceStrategy";
|
|
2
|
+
import { HighPerformanceDeviceStrategy } from "../strategies/HighPerformanceDeviceStrategy";
|
|
3
|
+
export class DeviceStrategyFactory {
|
|
4
|
+
static createStrategy() {
|
|
5
|
+
const nav = navigator;
|
|
6
|
+
const memory = nav.deviceMemory || nav.hardwareConcurrency || 4;
|
|
7
|
+
const isLowMemory = memory <= 4;
|
|
8
|
+
if (isLowMemory) {
|
|
9
|
+
return new LowMemoryDeviceStrategy();
|
|
10
|
+
}
|
|
11
|
+
else {
|
|
12
|
+
return new HighPerformanceDeviceStrategy();
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=DeviceStrategyFactory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DeviceStrategyFactory.js","sourceRoot":"","sources":["../../../src/services/factories/DeviceStrategyFactory.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,uBAAuB,EAAE,MAAM,uCAAuC,CAAC;AAChF,OAAO,EAAE,6BAA6B,EAAE,MAAM,6CAA6C,CAAC;AAE5F,MAAM,OAAO,qBAAqB;IAChC,MAAM,CAAC,cAAc;QACnB,MAAM,GAAG,GAAG,SAAgB,CAAC;QAC7B,MAAM,MAAM,GAAG,GAAG,CAAC,YAAY,IAAI,GAAG,CAAC,mBAAmB,IAAI,CAAC,CAAC;QAChE,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,CAAC;QAEhC,IAAI,WAAW,EAAE,CAAC;YAChB,OAAO,IAAI,uBAAuB,EAAE,CAAC;QACvC,CAAC;aAAM,CAAC;YACN,OAAO,IAAI,6BAA6B,EAAE,CAAC;QAC7C,CAAC;IACH,CAAC;CACF","sourcesContent":["import { IDeviceStrategy } from '../strategies/IDeviceStrategy';\nimport { LowMemoryDeviceStrategy } from '../strategies/LowMemoryDeviceStrategy';\nimport { HighPerformanceDeviceStrategy } from '../strategies/HighPerformanceDeviceStrategy';\n\nexport class DeviceStrategyFactory {\n static createStrategy(): IDeviceStrategy {\n const nav = navigator as any;\n const memory = nav.deviceMemory || nav.hardwareConcurrency || 4;\n const isLowMemory = memory <= 4;\n \n if (isLowMemory) {\n return new LowMemoryDeviceStrategy();\n } else {\n return new HighPerformanceDeviceStrategy();\n }\n }\n}"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ICameraService.js","sourceRoot":"","sources":["../../../src/services/interfaces/ICameraService.ts"],"names":[],"mappings":"","sourcesContent":["export interface CameraInfo {\n id: string;\n label: string;\n selected: boolean;\n}\n\nexport interface CameraPreference {\n cameraId: string;\n facing: 'environment' | 'user' | null;\n timestamp: number;\n}\n\nexport interface ICameraService {\n detectDeviceType(): Promise<'mobile' | 'desktop' | 'tablet'>;\n enumerateDevices(): Promise<MediaDeviceInfo[]>;\n getAvailableCameras(): MediaDeviceInfo[];\n isMultipleCamerasAvailable(): boolean;\n getSelectedCameraId(): string | null;\n setSelectedCamera(cameraId: string): Promise<void>;\n getPreferredFacing(): 'environment' | 'user' | null;\n setupCamera(constraints?: MediaTrackConstraints): Promise<MediaStream>;\n switchCamera(cameraId: string): Promise<void>;\n flipToNextCamera(): Promise<void>;\n savePreference(): void;\n loadPreference(): void;\n isRearCamera(stream: MediaStream): boolean;\n getCameraInfo(): {\n availableCameras: CameraInfo[];\n selectedCameraId: string | null;\n deviceType: string;\n isMultipleCamerasAvailable: boolean;\n preferredFacing: 'environment' | 'user' | null;\n };\n}"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IDetectionService.js","sourceRoot":"","sources":["../../../src/services/interfaces/IDetectionService.ts"],"names":[],"mappings":"","sourcesContent":["export interface DetectionBox {\n x: number;\n y: number;\n w: number;\n h: number;\n score: number;\n classId?: number;\n}\n\nexport interface SideAlignment {\n top: boolean;\n right: boolean;\n bottom: boolean;\n left: boolean;\n}\n\nexport interface ClassificationResult {\n class: string;\n confidence: number;\n classIndex: number;\n}\n\nexport interface IDetectionService {\n loadModel(): Promise<void>;\n loadClassificationModel(): Promise<void>;\n isModelLoaded(): boolean;\n preprocess(video: HTMLVideoElement): any;\n runInference(inputTensor: any): Promise<DetectionBox[]>;\n classifyDocument(canvas: HTMLCanvasElement): Promise<ClassificationResult | null>;\n checkSideAlignment(box: DetectionBox, maskConfig: any): SideAlignment;\n isCardInFrame(box: DetectionBox): boolean;\n areAllSidesAligned(alignment: SideAlignment): boolean;\n cleanup(): void;\n}"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IEventBus.js","sourceRoot":"","sources":["../../../src/services/interfaces/IEventBus.ts"],"names":[],"mappings":"","sourcesContent":["export type EventCallback<T = any> = (data: T) => void;\n\nexport interface IEventBus {\n on<T = any>(event: string, callback: EventCallback<T>): void;\n off(event: string, callback: EventCallback): void;\n emit<T = any>(event: string, data?: T): void;\n once<T = any>(event: string, callback: EventCallback<T>): void;\n clear(): void;\n}\n\n// Event types\nexport interface ComponentEvents {\n 'capture-completed': any;\n 'ready': boolean;\n 'camera-changed': string;\n 'detection-updated': any[];\n 'state-changed': any;\n 'error': Error;\n}"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ILogger.js","sourceRoot":"","sources":["../../../src/services/interfaces/ILogger.ts"],"names":[],"mappings":"","sourcesContent":["export interface ILogger {\n info(...args: any[]): void;\n warn(...args: any[]): void;\n error(...args: any[]): void;\n debug(...args: any[]): void;\n state(state: string, data?: any): void;\n performance(operation: string, duration: number): void;\n}"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IStateManager.js","sourceRoot":"","sources":["../../../src/services/interfaces/IStateManager.ts"],"names":[],"mappings":"","sourcesContent":["export interface CaptureState {\n step: 'front' | 'back' | 'completed';\n isCapturing: boolean;\n isDetectionPaused: boolean;\n isVideoActive: boolean;\n isLoading: boolean;\n showFlipAnimation: boolean;\n showSuccessAnimation: boolean;\n bestScore: number;\n hasScreenshotTaken: boolean;\n}\n\nexport interface CapturedImages {\n front: {\n fullFrame: string | null;\n cropped: string | null;\n };\n back: {\n fullFrame: string | null;\n cropped: string | null;\n };\n metadata: {\n totalImages: number;\n processCompleted: boolean;\n backCaptureSkipped: boolean;\n };\n}\n\nexport interface IStateManager {\n getCaptureState(): CaptureState;\n updateCaptureState(updates: Partial<CaptureState>): void;\n getCapturedImages(): CapturedImages;\n setCapturedImages(images: Partial<CapturedImages>): void;\n reset(): void;\n isProcessCompleted(): boolean;\n canProceedToBack(): boolean;\n}"]}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export class HighPerformanceDeviceStrategy {
|
|
2
|
+
getDeviceInfo() {
|
|
3
|
+
const nav = navigator;
|
|
4
|
+
const memory = nav.deviceMemory || nav.hardwareConcurrency || 4;
|
|
5
|
+
const connection = nav.connection || nav.mozConnection || nav.webkitConnection;
|
|
6
|
+
const isSlowConnection = connection && (connection.effectiveType === 'slow-2g' || connection.effectiveType === '2g');
|
|
7
|
+
return {
|
|
8
|
+
estimatedRAM: memory,
|
|
9
|
+
isLowMemory: false,
|
|
10
|
+
isSlowConnection: isSlowConnection
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
getSessionOptions(debug) {
|
|
14
|
+
return {
|
|
15
|
+
executionProviders: ['webgl', 'wasm'],
|
|
16
|
+
graphOptimizationLevel: 'all',
|
|
17
|
+
logSeverityLevel: debug ? 2 : 4,
|
|
18
|
+
logVerbosityLevel: 0,
|
|
19
|
+
enableCpuMemArena: true,
|
|
20
|
+
enableMemPattern: true,
|
|
21
|
+
executionMode: 'parallel',
|
|
22
|
+
interOpNumThreads: 2,
|
|
23
|
+
intraOpNumThreads: 2,
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
shouldUseSequentialLoading() {
|
|
27
|
+
return false;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=HighPerformanceDeviceStrategy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HighPerformanceDeviceStrategy.js","sourceRoot":"","sources":["../../../src/services/strategies/HighPerformanceDeviceStrategy.ts"],"names":[],"mappings":"AAEA,MAAM,OAAO,6BAA6B;IACxC,aAAa;QACX,MAAM,GAAG,GAAG,SAAgB,CAAC;QAC7B,MAAM,MAAM,GAAG,GAAG,CAAC,YAAY,IAAI,GAAG,CAAC,mBAAmB,IAAI,CAAC,CAAC;QAChE,MAAM,UAAU,GAAG,GAAG,CAAC,UAAU,IAAI,GAAG,CAAC,aAAa,IAAI,GAAG,CAAC,gBAAgB,CAAC;QAC/E,MAAM,gBAAgB,GAAG,UAAU,IAAI,CAAC,UAAU,CAAC,aAAa,KAAK,SAAS,IAAI,UAAU,CAAC,aAAa,KAAK,IAAI,CAAC,CAAC;QAErH,OAAO;YACL,YAAY,EAAE,MAAM;YACpB,WAAW,EAAE,KAAK;YAClB,gBAAgB,EAAE,gBAAgB;SACnC,CAAC;IACJ,CAAC;IAED,iBAAiB,CAAC,KAAc;QAC9B,OAAO;YACL,kBAAkB,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC;YACrC,sBAAsB,EAAE,KAAK;YAC7B,gBAAgB,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;YAC/B,iBAAiB,EAAE,CAAC;YACpB,iBAAiB,EAAE,IAAI;YACvB,gBAAgB,EAAE,IAAI;YACtB,aAAa,EAAE,UAAU;YACzB,iBAAiB,EAAE,CAAC;YACpB,iBAAiB,EAAE,CAAC;SACrB,CAAC;IACJ,CAAC;IAED,0BAA0B;QACxB,OAAO,KAAK,CAAC;IACf,CAAC;CACF","sourcesContent":["import { IDeviceStrategy, DeviceInfo, SessionOptions } from './IDeviceStrategy';\n\nexport class HighPerformanceDeviceStrategy implements IDeviceStrategy {\n getDeviceInfo(): DeviceInfo {\n const nav = navigator as any;\n const memory = nav.deviceMemory || nav.hardwareConcurrency || 4;\n const connection = nav.connection || nav.mozConnection || nav.webkitConnection;\n const isSlowConnection = connection && (connection.effectiveType === 'slow-2g' || connection.effectiveType === '2g');\n \n return {\n estimatedRAM: memory,\n isLowMemory: false,\n isSlowConnection: isSlowConnection\n };\n }\n\n getSessionOptions(debug: boolean): SessionOptions {\n return {\n executionProviders: ['webgl', 'wasm'],\n graphOptimizationLevel: 'all',\n logSeverityLevel: debug ? 2 : 4,\n logVerbosityLevel: 0,\n enableCpuMemArena: true,\n enableMemPattern: true,\n executionMode: 'parallel',\n interOpNumThreads: 2,\n intraOpNumThreads: 2,\n };\n }\n\n shouldUseSequentialLoading(): boolean {\n return false;\n }\n}"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IDeviceStrategy.js","sourceRoot":"","sources":["../../../src/services/strategies/IDeviceStrategy.ts"],"names":[],"mappings":"","sourcesContent":["export interface DeviceInfo {\n estimatedRAM: number;\n isLowMemory: boolean;\n isSlowConnection: boolean;\n}\n\nexport interface SessionOptions {\n executionProviders: string[];\n graphOptimizationLevel: string;\n logSeverityLevel: number;\n logVerbosityLevel?: number;\n enableCpuMemArena: boolean;\n enableMemPattern: boolean;\n executionMode: string;\n interOpNumThreads: number;\n intraOpNumThreads: number;\n}\n\nexport interface IDeviceStrategy {\n getDeviceInfo(): DeviceInfo;\n getSessionOptions(debug: boolean): SessionOptions;\n shouldUseSequentialLoading(): boolean;\n}"]}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export class LowMemoryDeviceStrategy {
|
|
2
|
+
getDeviceInfo() {
|
|
3
|
+
const nav = navigator;
|
|
4
|
+
const memory = nav.deviceMemory || nav.hardwareConcurrency || 4;
|
|
5
|
+
const connection = nav.connection || nav.mozConnection || nav.webkitConnection;
|
|
6
|
+
const isSlowConnection = connection && (connection.effectiveType === 'slow-2g' || connection.effectiveType === '2g');
|
|
7
|
+
return {
|
|
8
|
+
estimatedRAM: memory,
|
|
9
|
+
isLowMemory: true,
|
|
10
|
+
isSlowConnection: isSlowConnection
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
getSessionOptions(_debug) {
|
|
14
|
+
return {
|
|
15
|
+
executionProviders: ['wasm'],
|
|
16
|
+
graphOptimizationLevel: 'basic',
|
|
17
|
+
logSeverityLevel: 4,
|
|
18
|
+
logVerbosityLevel: 0,
|
|
19
|
+
enableCpuMemArena: false,
|
|
20
|
+
enableMemPattern: false,
|
|
21
|
+
executionMode: 'sequential',
|
|
22
|
+
interOpNumThreads: 1,
|
|
23
|
+
intraOpNumThreads: 1,
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
shouldUseSequentialLoading() {
|
|
27
|
+
return true;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=LowMemoryDeviceStrategy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LowMemoryDeviceStrategy.js","sourceRoot":"","sources":["../../../src/services/strategies/LowMemoryDeviceStrategy.ts"],"names":[],"mappings":"AAEA,MAAM,OAAO,uBAAuB;IAClC,aAAa;QACX,MAAM,GAAG,GAAG,SAAgB,CAAC;QAC7B,MAAM,MAAM,GAAG,GAAG,CAAC,YAAY,IAAI,GAAG,CAAC,mBAAmB,IAAI,CAAC,CAAC;QAChE,MAAM,UAAU,GAAG,GAAG,CAAC,UAAU,IAAI,GAAG,CAAC,aAAa,IAAI,GAAG,CAAC,gBAAgB,CAAC;QAC/E,MAAM,gBAAgB,GAAG,UAAU,IAAI,CAAC,UAAU,CAAC,aAAa,KAAK,SAAS,IAAI,UAAU,CAAC,aAAa,KAAK,IAAI,CAAC,CAAC;QAErH,OAAO;YACL,YAAY,EAAE,MAAM;YACpB,WAAW,EAAE,IAAI;YACjB,gBAAgB,EAAE,gBAAgB;SACnC,CAAC;IACJ,CAAC;IAED,iBAAiB,CAAC,MAAe;QAC/B,OAAO;YACL,kBAAkB,EAAE,CAAC,MAAM,CAAC;YAC5B,sBAAsB,EAAE,OAAO;YAC/B,gBAAgB,EAAE,CAAC;YACnB,iBAAiB,EAAE,CAAC;YACpB,iBAAiB,EAAE,KAAK;YACxB,gBAAgB,EAAE,KAAK;YACvB,aAAa,EAAE,YAAY;YAC3B,iBAAiB,EAAE,CAAC;YACpB,iBAAiB,EAAE,CAAC;SACrB,CAAC;IACJ,CAAC;IAED,0BAA0B;QACxB,OAAO,IAAI,CAAC;IACd,CAAC;CACF","sourcesContent":["import { IDeviceStrategy, DeviceInfo, SessionOptions } from './IDeviceStrategy';\n\nexport class LowMemoryDeviceStrategy implements IDeviceStrategy {\n getDeviceInfo(): DeviceInfo {\n const nav = navigator as any;\n const memory = nav.deviceMemory || nav.hardwareConcurrency || 4;\n const connection = nav.connection || nav.mozConnection || nav.webkitConnection;\n const isSlowConnection = connection && (connection.effectiveType === 'slow-2g' || connection.effectiveType === '2g');\n \n return {\n estimatedRAM: memory,\n isLowMemory: true,\n isSlowConnection: isSlowConnection\n };\n }\n\n getSessionOptions(_debug: boolean): SessionOptions {\n return {\n executionProviders: ['wasm'],\n graphOptimizationLevel: 'basic',\n logSeverityLevel: 4,\n logVerbosityLevel: 0,\n enableCpuMemArena: false,\n enableMemPattern: false,\n executionMode: 'sequential',\n interOpNumThreads: 1,\n intraOpNumThreads: 1,\n };\n }\n\n shouldUseSequentialLoading(): boolean {\n return true;\n }\n}"]}
|