carriera-intern-components 1.1.162 → 1.1.163

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.
@@ -1,5 +1,6 @@
1
1
  import * as i0 from "@angular/core";
2
2
  export declare class DocumentService {
3
+ constructor();
3
4
  /**
4
5
  * Generates a data URL thumbnail for a given file.
5
6
  * Handles PDFs, videos, and images.
@@ -3208,8 +3208,37 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImpo
3208
3208
  type: Input
3209
3209
  }] } });
3210
3210
 
3211
- pdfjsLib.GlobalWorkerOptions.workerSrc = '/pdfjs/pdf.worker.min.mjs';
3212
3211
  class DocumentService {
3212
+ constructor() {
3213
+ if (typeof window !== 'undefined' && typeof Worker !== 'undefined') {
3214
+ try {
3215
+ const baseHref = (document.querySelector('base')?.getAttribute('href') ?? '/');
3216
+ const candidatePaths = [
3217
+ 'pdfjs/pdf.worker.min.mjs',
3218
+ 'assets/pdfjs/pdf.worker.min.mjs',
3219
+ ];
3220
+ let workerInitialized = false;
3221
+ for (const candidate of candidatePaths) {
3222
+ try {
3223
+ const resolvedUrl = new URL(candidate, baseHref).toString();
3224
+ const worker = new Worker(resolvedUrl, { type: 'module' });
3225
+ pdfjsLib.GlobalWorkerOptions.workerPort = worker;
3226
+ workerInitialized = true;
3227
+ break;
3228
+ }
3229
+ catch (innerError) {
3230
+ // try next candidate
3231
+ }
3232
+ }
3233
+ if (!workerInitialized) {
3234
+ throw new Error('No PDF.js worker could be initialized from known paths.');
3235
+ }
3236
+ }
3237
+ catch (error) {
3238
+ console.warn('PDF.js worker initialization failed:', error);
3239
+ }
3240
+ }
3241
+ }
3213
3242
  /**
3214
3243
  * Generates a data URL thumbnail for a given file.
3215
3244
  * Handles PDFs, videos, and images.
@@ -3350,7 +3379,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImpo
3350
3379
  args: [{
3351
3380
  providedIn: 'root',
3352
3381
  }]
3353
- }] });
3382
+ }], ctorParameters: () => [] });
3354
3383
 
3355
3384
  /**
3356
3385
  * A component that provides a user interface for file uploading via