"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.OXY_CLOUD_URL = exports.OXY_API_URL = void 0;
Object.defineProperty(exports, "OxyAuthenticationError", {
  enumerable: true,
  get: function () {
    return _OxyServices.OxyAuthenticationError;
  }
});
Object.defineProperty(exports, "OxyAuthenticationTimeoutError", {
  enumerable: true,
  get: function () {
    return _OxyServices.OxyAuthenticationTimeoutError;
  }
});
exports.oxyClient = exports.OxyServices = void 0;
var _OxyServices = require("./OxyServices.errors");
var _mixins = require("./mixins");
/**
 * OxyServices - Unified client for Oxy API and Oxy Cloud
 *
 * # Usage Examples
 *
 * ## Browser (ESM/TypeScript)
 *
 * ```typescript
 * import { OxyServices } from './core/OxyServices';
 *
 * const oxy = new OxyServices({
 *   baseURL: 'https://api.oxy.so',
 *   cloudURL: 'https://cloud.oxy.so',
 * });
 *
 * // Authenticate and fetch user
 * await oxy.setTokens('ACCESS_TOKEN');
 * const user = await oxy.getCurrentUser();
 *
 * // Upload a file (browser File API)
 * const fileInput = document.querySelector('input[type=file]');
 * const file = fileInput.files[0];
 * await oxy.uploadRawFile(file);
 *
 * // Get a file download URL for <img src>
 * const url = oxy.getFileDownloadUrl('fileId', 'thumb');
 * ```
 *
 * ## Node.js (CommonJS/TypeScript)
 *
 * ```typescript
 * import { OxyServices } from './core/OxyServices';
 * import fs from 'fs';
 *
 * const oxy = new OxyServices({
 *   baseURL: 'https://api.oxy.so',
 *   cloudURL: 'https://cloud.oxy.so',
 * });
 *
 * // Authenticate and fetch user
 * await oxy.setTokens('ACCESS_TOKEN');
 * const user = await oxy.getCurrentUser();
 *
 * // Upload a file (Node.js Buffer)
 * const buffer = fs.readFileSync('myfile.png');
 * const blob = new Blob([buffer]);
 * await oxy.uploadRawFile(blob, { filename: 'myfile.png' });
 *
 * // Get a file download URL
 * const url = oxy.getFileDownloadUrl('fileId');
 * ```
 *
 * ## Configuration
 * - `baseURL`: Oxy API endpoint (e.g., https://api.oxy.so)
 * - `cloudURL`: Oxy Cloud/CDN endpoint (e.g., https://cloud.oxy.so)
 *
 * See method JSDoc for more details and options.
 */

// Import mixin composition helper

/**
 * OxyServices - Unified client library for interacting with the Oxy API
 * 
 * This class provides all API functionality in one simple, easy-to-use interface.
 * 
 * ## Architecture
 * - **HttpService**: Unified HTTP service handling authentication, caching, deduplication, queuing, and retry
 * - **OxyServices**: Provides high-level API methods
 * 
 * ## Mixin Composition
 * The class is composed using TypeScript mixins for better code organization:
 * - **Base**: Core infrastructure (HTTP client, request management, error handling)
 * - **Auth**: Authentication and session management
 * - **User**: User profiles, follow, notifications
 * - **Privacy**: Blocked and restricted users
 * - **Language**: Language detection and metadata
 * - **Payment**: Payment processing
 * - **Karma**: Karma system
 * - **Assets**: File upload and asset management
 * - **Developer**: Developer API management
 * - **Location**: Location-based features
 * - **Analytics**: Analytics tracking
 * - **Devices**: Device management
 * - **Utility**: Utility methods and Express middleware
 * 
 * @example
 * ```typescript
 * const oxy = new OxyServices({
 *   baseURL: 'https://api.oxy.so',
 *   cloudURL: 'https://cloud.oxy.so'
 * });
 * ```
 */
// Compose all mixins into the final OxyServices class
const OxyServicesComposed = (0, _mixins.composeOxyServices)();

// Export as a named class to avoid TypeScript issues with anonymous class types
class OxyServices extends OxyServicesComposed {
  constructor(config) {
    super(config);
  }
}

// Re-export error classes for convenience
exports.OxyServices = OxyServices;
/**
 * Export the default Oxy Cloud URL (for backward compatibility)
 */
const OXY_CLOUD_URL = exports.OXY_CLOUD_URL = 'https://cloud.oxy.so';

/**
 * Export the default Oxy API URL (for documentation)
 */
const OXY_API_URL = exports.OXY_API_URL = typeof process !== 'undefined' && process.env && process.env.OXY_API_URL || 'https://api.oxy.so';

/**
 * Pre-configured client instance for easy import
 * Uses OXY_API_URL as baseURL and OXY_CLOUD_URL as cloudURL
 */
const oxyClient = exports.oxyClient = new OxyServices({
  baseURL: OXY_API_URL,
  cloudURL: OXY_CLOUD_URL
});
//# sourceMappingURL=OxyServices.js.map