@eyepop.ai/eyepop 0.14.1 → 0.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -10,9 +10,9 @@ var __commonJS = (cb, mod) => function __require2() {
10
10
  return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
11
11
  };
12
12
 
13
- // node_modules/mime-db/db.json
13
+ // ../../node_modules/mime-db/db.json
14
14
  var require_db = __commonJS({
15
- "node_modules/mime-db/db.json"(exports, module) {
15
+ "../../node_modules/mime-db/db.json"(exports, module) {
16
16
  module.exports = {
17
17
  "application/1d-interleaved-parityfec": {
18
18
  source: "iana"
@@ -8535,17 +8535,17 @@ var require_db = __commonJS({
8535
8535
  }
8536
8536
  });
8537
8537
 
8538
- // node_modules/mime-db/index.js
8538
+ // ../../node_modules/mime-db/index.js
8539
8539
  var require_mime_db = __commonJS({
8540
- "node_modules/mime-db/index.js"(exports, module) {
8540
+ "../../node_modules/mime-db/index.js"(exports, module) {
8541
8541
  "use strict";
8542
8542
  module.exports = require_db();
8543
8543
  }
8544
8544
  });
8545
8545
 
8546
- // node_modules/mime-types/index.js
8546
+ // ../../node_modules/mime-types/index.js
8547
8547
  var require_mime_types = __commonJS({
8548
- "node_modules/mime-types/index.js"(exports) {
8548
+ "../../node_modules/mime-types/index.js"(exports) {
8549
8549
  "use strict";
8550
8550
  var db = require_mime_db();
8551
8551
  var extname = __require("path").extname;
@@ -8634,7 +8634,7 @@ var require_mime_types = __commonJS({
8634
8634
  }
8635
8635
  });
8636
8636
 
8637
- // src/types.ts
8637
+ // types.ts
8638
8638
  var EndpointState = /* @__PURE__ */ ((EndpointState2) => {
8639
8639
  EndpointState2["Idle"] = "Idle";
8640
8640
  EndpointState2["Busy"] = "Busy";
@@ -8645,7 +8645,7 @@ var EndpointState = /* @__PURE__ */ ((EndpointState2) => {
8645
8645
  return EndpointState2;
8646
8646
  })(EndpointState || {});
8647
8647
 
8648
- // src/streaming.ts
8648
+ // streaming.ts
8649
8649
  var Stream = class _Stream {
8650
8650
  constructor(iterator, controller) {
8651
8651
  this.iterator = iterator;
@@ -8896,7 +8896,7 @@ function readableStreamAsyncIterable(stream) {
8896
8896
  };
8897
8897
  }
8898
8898
 
8899
- // src/jobs.ts
8899
+ // jobs.ts
8900
8900
  var AbstractJob = class {
8901
8901
  constructor(getSession, client, requestLogger) {
8902
8902
  this._responseStream = null;
@@ -9069,7 +9069,7 @@ var LoadLiveIngressJob = class extends AbstractJob {
9069
9069
  }
9070
9070
  };
9071
9071
 
9072
- // src/shims/http_client.ts
9072
+ // shims/http_client.ts
9073
9073
  var createHttpClient;
9074
9074
  if ("document" in globalThis && "implementation" in globalThis.document) {
9075
9075
  class HttpClient2 {
@@ -9108,7 +9108,7 @@ if ("document" in globalThis && "implementation" in globalThis.document) {
9108
9108
  };
9109
9109
  }
9110
9110
 
9111
- // src/semaphore.ts
9111
+ // semaphore.ts
9112
9112
  var Semaphore = class {
9113
9113
  /**
9114
9114
  * Creates a semaphore.
@@ -9236,7 +9236,7 @@ var Semaphore = class {
9236
9236
  }
9237
9237
  };
9238
9238
 
9239
- // node_modules/uuid/dist/esm-node/rng.js
9239
+ // ../../node_modules/uuid/dist/esm-node/rng.js
9240
9240
  import crypto from "crypto";
9241
9241
  var rnds8Pool = new Uint8Array(256);
9242
9242
  var poolPtr = rnds8Pool.length;
@@ -9248,7 +9248,7 @@ function rng() {
9248
9248
  return rnds8Pool.slice(poolPtr, poolPtr += 16);
9249
9249
  }
9250
9250
 
9251
- // node_modules/uuid/dist/esm-node/stringify.js
9251
+ // ../../node_modules/uuid/dist/esm-node/stringify.js
9252
9252
  var byteToHex = [];
9253
9253
  for (let i = 0; i < 256; ++i) {
9254
9254
  byteToHex.push((i + 256).toString(16).slice(1));
@@ -9257,13 +9257,13 @@ function unsafeStringify(arr, offset = 0) {
9257
9257
  return byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + "-" + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + "-" + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + "-" + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + "-" + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]];
9258
9258
  }
9259
9259
 
9260
- // node_modules/uuid/dist/esm-node/native.js
9260
+ // ../../node_modules/uuid/dist/esm-node/native.js
9261
9261
  import crypto2 from "crypto";
9262
9262
  var native_default = {
9263
9263
  randomUUID: crypto2.randomUUID
9264
9264
  };
9265
9265
 
9266
- // node_modules/uuid/dist/esm-node/v4.js
9266
+ // ../../node_modules/uuid/dist/esm-node/v4.js
9267
9267
  function v4(options, buf, offset) {
9268
9268
  if (native_default.randomUUID && !buf && !options) {
9269
9269
  return native_default.randomUUID();
@@ -9283,7 +9283,7 @@ function v4(options, buf, offset) {
9283
9283
  }
9284
9284
  var v4_default = v4;
9285
9285
 
9286
- // src/webrtc_base.ts
9286
+ // webrtc_base.ts
9287
9287
  import path from "path";
9288
9288
  var WebrtcBase = class _WebrtcBase {
9289
9289
  constructor(getSession, client, ingressId, urlBasePath, requestLogger) {
@@ -9524,7 +9524,7 @@ var WebrtcBase = class _WebrtcBase {
9524
9524
  }
9525
9525
  };
9526
9526
 
9527
- // src/webrtc_whip.ts
9527
+ // webrtc_whip.ts
9528
9528
  var WebrtcWhip = class extends WebrtcBase {
9529
9529
  constructor(stream, getSession, client, requestLogger) {
9530
9530
  super(getSession, client, v4_default().toString(), "/liveIngress/whip", requestLogger);
@@ -9610,7 +9610,7 @@ var WebrtcWhip = class extends WebrtcBase {
9610
9610
  }
9611
9611
  };
9612
9612
 
9613
- // src/webrtc_whep.ts
9613
+ // webrtc_whep.ts
9614
9614
  var WebrtcWhep = class extends WebrtcBase {
9615
9615
  constructor(ingressId, getSession, client, requestLogger) {
9616
9616
  super(getSession, client, ingressId, "/liveIngress/whep", requestLogger);
@@ -9696,7 +9696,7 @@ var WebrtcWhep = class extends WebrtcBase {
9696
9696
  }
9697
9697
  };
9698
9698
 
9699
- // src/shims/local_file.ts
9699
+ // shims/local_file.ts
9700
9700
  var resolvePath;
9701
9701
  if ("document" in globalThis && "implementation" in globalThis.document) {
9702
9702
  resolvePath = async (source) => {
@@ -9716,10 +9716,10 @@ if ("document" in globalThis && "implementation" in globalThis.document) {
9716
9716
  };
9717
9717
  }
9718
9718
 
9719
- // src/endpoint.ts
9719
+ // endpoint.ts
9720
9720
  import { pino } from "pino";
9721
9721
 
9722
- // src/shims/browser_session.ts
9722
+ // shims/browser_session.ts
9723
9723
  import { createAuth0Client } from "@auth0/auth0-spa-js";
9724
9724
  var authenticateBrowserSession;
9725
9725
  if ("document" in globalThis && "implementation" in globalThis.document) {
@@ -9754,7 +9754,7 @@ if ("document" in globalThis && "implementation" in globalThis.document) {
9754
9754
  };
9755
9755
  }
9756
9756
 
9757
- // src/endpoint.ts
9757
+ // endpoint.ts
9758
9758
  var Endpoint = class {
9759
9759
  constructor(options) {
9760
9760
  this._options = options;
@@ -10003,7 +10003,6 @@ var Endpoint = class {
10003
10003
  }
10004
10004
  async uploadPath(source) {
10005
10005
  if (!this._baseUrl || !this._pipelineId || !this._client || !this._limit) {
10006
- console.log(this);
10007
10006
  throw new Error("endpoint not connected, use connect() before process()");
10008
10007
  }
10009
10008
  await this._limit.acquire();
@@ -10202,133 +10201,25 @@ var Endpoint = class {
10202
10201
  }
10203
10202
  };
10204
10203
 
10205
- // src/visualize.ts
10206
- var _EyePopPlot = class _EyePopPlot {
10207
- constructor(context) {
10208
- this._context = context;
10209
- const textSize = Math.floor(Math.max(1, 0.03 * Math.min(context.canvas.width, context.canvas.height)));
10210
- this._font = textSize + "px Poppins";
10211
- }
10212
- prediction(p) {
10213
- if (p && p.objects) {
10214
- const x_scale = this._context.canvas.width / p.source_width;
10215
- const y_scale = this._context.canvas.height / p.source_height;
10216
- for (let i = 0; i < p.objects.length; i++) {
10217
- this.object(p.objects[i], x_scale, y_scale);
10218
- }
10219
- }
10220
- }
10221
- object(obj, x_scale = 1, y_scale = 1) {
10222
- const context = this._context;
10223
- const x = obj.x * x_scale;
10224
- const y = obj.y * y_scale;
10225
- const w = obj.width * x_scale;
10226
- const h = obj.height * y_scale;
10227
- context.beginPath();
10228
- context.rect(obj.x, obj.y, obj.width, obj.height);
10229
- context.lineWidth = 1;
10230
- context.strokeStyle = _EyePopPlot.colors.opacity_color;
10231
- context.fillStyle = _EyePopPlot.colors.opacity_color;
10232
- context.fill();
10233
- context.stroke();
10234
- const mindim = Math.min(obj.height, obj.width);
10235
- let corner_size = Math.max(15, mindim / 5.33333);
10236
- var corners = [
10237
- //top left corner
10238
- [{ x, y: y + corner_size }, { x, y }, { x: x + corner_size, y }],
10239
- //bottom left corner
10240
- [{ x, y: y + h - corner_size }, { x, y: y + h }, { x: x + corner_size, y: y + h }],
10241
- //top right corner
10242
- [{ x: x + w - corner_size, y }, { x: x + w, y }, { x: x + w, y: y + corner_size }],
10243
- //bottom right corner
10244
- [{ x: x + w, y: y + h - corner_size }, { x: x + w, y: y + h }, { x: x + w - corner_size, y: y + h }]
10245
- ];
10246
- corners.forEach((corner) => {
10247
- context.beginPath();
10248
- context.moveTo(corner[0].x, corner[0].y);
10249
- context.lineTo(corner[1].x, corner[1].y);
10250
- context.lineTo(corner[2].x, corner[2].y);
10251
- context.strokeStyle = _EyePopPlot.colors.primary_color;
10252
- context.lineWidth = 1;
10253
- context.stroke();
10254
- });
10255
- const padding = Math.max(mindim * 0.02, 5);
10256
- corner_size = corner_size - padding;
10257
- var corners2 = [
10258
- //2nd top left corner
10259
- [{ x: x + padding, y: y + padding + corner_size }, {
10260
- x: x + padding,
10261
- y: y + padding
10262
- }, { x: x + padding + corner_size, y: y + padding }],
10263
- //2nd bottom left corner
10264
- [{ x: x + padding, y: y - padding + h - corner_size }, {
10265
- x: x + padding,
10266
- y: y - padding + h
10267
- }, { x: x + padding + corner_size, y: y - padding + h }],
10268
- //2nd top right corner
10269
- [{ x: x - padding + w - corner_size, y: y + padding }, {
10270
- x: x - padding + w,
10271
- y: y + padding
10272
- }, { x: x - padding + w, y: y + padding + corner_size }],
10273
- //2nd bottom right corner
10274
- [{ x: x - padding + w, y: y - padding + h - corner_size }, {
10275
- x: x - padding + w,
10276
- y: y - padding + h
10277
- }, { x: x - padding + w - corner_size, y: y - padding + h }]
10278
- ];
10279
- corners2.forEach((corner) => {
10280
- context.beginPath();
10281
- context.moveTo(corner[0].x, corner[0].y);
10282
- context.lineTo(corner[1].x, corner[1].y);
10283
- context.lineTo(corner[2].x, corner[2].y);
10284
- context.strokeStyle = _EyePopPlot.colors.secondary_color;
10285
- context.lineWidth = 1;
10286
- context.stroke();
10287
- });
10288
- let trackingLabel = "";
10289
- if (obj.traceId) {
10290
- trackingLabel = `#${obj.traceId}`;
10291
- }
10292
- context.font = this._font;
10293
- context.fillStyle = "#ffffff";
10294
- context.textAlign = "left";
10295
- context.textBaseline = "top";
10296
- context.fillText(_EyePopPlot.toTitleCase(obj.classLabel + " " + trackingLabel), obj.x + 1.5 * padding, obj.y + 1.5 * padding);
10297
- }
10298
- static toTitleCase(str) {
10299
- if (!str)
10300
- return "";
10301
- return str.replace(/\w\S*/g, function(txt) {
10302
- return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();
10303
- });
10304
- }
10305
- };
10306
- _EyePopPlot.colors = {
10307
- primary_color: "#2fa7d7",
10308
- secondary_color: "#94e0ff",
10309
- right_color: "#a1f542",
10310
- left_color: "#e32740",
10311
- opacity_color: "rgba(47, 167, 215, 0.2)",
10312
- white: "#FFFFFF",
10313
- black: "#111111",
10314
- blank_color: "#000000"
10315
- };
10316
- var EyePopPlot = _EyePopPlot;
10317
-
10318
- // src/index.ts
10204
+ // index.ts
10319
10205
  var readEnv = (env) => {
10320
10206
  if (typeof process !== "undefined") {
10321
10207
  return process.env?.[env] ?? void 0;
10322
10208
  }
10323
10209
  return void 0;
10324
10210
  };
10325
- var _EyePopSdk = class _EyePopSdk {
10326
- static endpoint(opts = {}) {
10211
+ var EyePop;
10212
+ ((EyePop2) => {
10213
+ const envSecretKey = readEnv("EYEPOP_SECRET_KEY");
10214
+ const defaultAuth = envSecretKey ? {
10215
+ secretKey: envSecretKey
10216
+ } : void 0;
10217
+ function endpoint(opts = {}) {
10327
10218
  if (typeof opts.auth == "undefined") {
10328
- if (typeof _EyePopSdk.defaultAuth == "undefined") {
10219
+ if (typeof defaultAuth == "undefined") {
10329
10220
  throw new Error("auth option or EYEPOP_SECRET_KEY environment variable is required");
10330
10221
  }
10331
- opts.auth = _EyePopSdk.defaultAuth;
10222
+ opts.auth = defaultAuth;
10332
10223
  }
10333
10224
  if (typeof opts.popId == "undefined") {
10334
10225
  opts.popId = readEnv("EYEPOP_POP_ID");
@@ -10376,23 +10267,16 @@ var _EyePopSdk = class _EyePopSdk {
10376
10267
  opts.eyepopUrl = opts.auth.session.eyepopUrl;
10377
10268
  }
10378
10269
  }
10379
- const endpoint = new Endpoint(opts);
10380
- return endpoint;
10270
+ const endpoint2 = new Endpoint(opts);
10271
+ return endpoint2;
10381
10272
  }
10382
- static plot(context) {
10383
- return new EyePopPlot(context);
10384
- }
10385
- };
10386
- _EyePopSdk.envSecretKey = readEnv("EYEPOP_SECRET_KEY");
10387
- _EyePopSdk.defaultAuth = _EyePopSdk.envSecretKey ? {
10388
- secretKey: _EyePopSdk.envSecretKey
10389
- } : void 0;
10390
- var EyePopSdk = _EyePopSdk;
10391
- var src_default = EyePopSdk;
10273
+ EyePop2.endpoint = endpoint;
10274
+ })(EyePop || (EyePop = {}));
10275
+ var eyepop_default = EyePop;
10392
10276
  export {
10393
10277
  EndpointState,
10394
- EyePopSdk,
10395
- src_default as default
10278
+ EyePop,
10279
+ eyepop_default as default
10396
10280
  };
10397
10281
  /*! Bundled license information:
10398
10282
 
@@ -10412,4 +10296,4 @@ mime-types/index.js:
10412
10296
  * MIT Licensed
10413
10297
  *)
10414
10298
  */
10415
- //# sourceMappingURL=index.mjs.map
10299
+ //# sourceMappingURL=eyepop.index.mjs.map