module.exports = {

"[project]/.next-internal/server/app/api/adminapi/transactions/ausertransaction/route/actions.js [app-rsc] (server actions loader, ecmascript)": (function(__turbopack_context__) {

var { g: global, __dirname, m: module, e: exports } = __turbopack_context__;
{
}}),
"[externals]/next/dist/compiled/next-server/app-route-turbo.runtime.dev.js [external] (next/dist/compiled/next-server/app-route-turbo.runtime.dev.js, cjs)": (function(__turbopack_context__) {

var { g: global, __dirname, m: module, e: exports } = __turbopack_context__;
{
const mod = __turbopack_context__.x("next/dist/compiled/next-server/app-route-turbo.runtime.dev.js", () => require("next/dist/compiled/next-server/app-route-turbo.runtime.dev.js"));

module.exports = mod;
}}),
"[externals]/next/dist/compiled/@opentelemetry/api [external] (next/dist/compiled/@opentelemetry/api, cjs)": (function(__turbopack_context__) {

var { g: global, __dirname, m: module, e: exports } = __turbopack_context__;
{
const mod = __turbopack_context__.x("next/dist/compiled/@opentelemetry/api", () => require("next/dist/compiled/@opentelemetry/api"));

module.exports = mod;
}}),
"[externals]/next/dist/compiled/next-server/app-page-turbo.runtime.dev.js [external] (next/dist/compiled/next-server/app-page-turbo.runtime.dev.js, cjs)": (function(__turbopack_context__) {

var { g: global, __dirname, m: module, e: exports } = __turbopack_context__;
{
const mod = __turbopack_context__.x("next/dist/compiled/next-server/app-page-turbo.runtime.dev.js", () => require("next/dist/compiled/next-server/app-page-turbo.runtime.dev.js"));

module.exports = mod;
}}),
"[externals]/next/dist/server/app-render/work-unit-async-storage.external.js [external] (next/dist/server/app-render/work-unit-async-storage.external.js, cjs)": (function(__turbopack_context__) {

var { g: global, __dirname, m: module, e: exports } = __turbopack_context__;
{
const mod = __turbopack_context__.x("next/dist/server/app-render/work-unit-async-storage.external.js", () => require("next/dist/server/app-render/work-unit-async-storage.external.js"));

module.exports = mod;
}}),
"[externals]/next/dist/server/app-render/work-async-storage.external.js [external] (next/dist/server/app-render/work-async-storage.external.js, cjs)": (function(__turbopack_context__) {

var { g: global, __dirname, m: module, e: exports } = __turbopack_context__;
{
const mod = __turbopack_context__.x("next/dist/server/app-render/work-async-storage.external.js", () => require("next/dist/server/app-render/work-async-storage.external.js"));

module.exports = mod;
}}),
"[externals]/next/dist/server/app-render/after-task-async-storage.external.js [external] (next/dist/server/app-render/after-task-async-storage.external.js, cjs)": (function(__turbopack_context__) {

var { g: global, __dirname, m: module, e: exports } = __turbopack_context__;
{
const mod = __turbopack_context__.x("next/dist/server/app-render/after-task-async-storage.external.js", () => require("next/dist/server/app-render/after-task-async-storage.external.js"));

module.exports = mod;
}}),
"[externals]/mongoose [external] (mongoose, cjs)": (function(__turbopack_context__) {

var { g: global, __dirname, m: module, e: exports } = __turbopack_context__;
{
const mod = __turbopack_context__.x("mongoose", () => require("mongoose"));

module.exports = mod;
}}),
"[project]/lib/connectdb.ts [app-route] (ecmascript)": ((__turbopack_context__) => {
"use strict";

var { g: global, __dirname } = __turbopack_context__;
{
__turbopack_context__.s({
    "default": (()=>__TURBOPACK__default__export__)
});
var __TURBOPACK__imported__module__$5b$externals$5d2f$mongoose__$5b$external$5d$__$28$mongoose$2c$__cjs$29$__ = __turbopack_context__.i("[externals]/mongoose [external] (mongoose, cjs)");
;
const MONGODB_URI = process.env.MONGODB_URI;
let isConnected = false;
const dbConnect = async ()=>{
    __TURBOPACK__imported__module__$5b$externals$5d2f$mongoose__$5b$external$5d$__$28$mongoose$2c$__cjs$29$__["default"].set("strictQuery", true);
    if (isConnected) {
        return;
    }
    try {
        await __TURBOPACK__imported__module__$5b$externals$5d2f$mongoose__$5b$external$5d$__$28$mongoose$2c$__cjs$29$__["default"].connect(MONGODB_URI, {
            dbName: "VTUAPP"
        });
        isConnected = true;
    } catch (error) {
        throw error;
    }
};
const __TURBOPACK__default__export__ = dbConnect;
}}),
"[project]/models/transactions.ts [app-route] (ecmascript)": ((__turbopack_context__) => {
"use strict";

var { g: global, __dirname } = __turbopack_context__;
{
__turbopack_context__.s({
    "default": (()=>__TURBOPACK__default__export__)
});
var __TURBOPACK__imported__module__$5b$externals$5d2f$mongoose__$5b$external$5d$__$28$mongoose$2c$__cjs$29$__ = __turbopack_context__.i("[externals]/mongoose [external] (mongoose, cjs)");
;
const transactionSchema = new __TURBOPACK__imported__module__$5b$externals$5d2f$mongoose__$5b$external$5d$__$28$mongoose$2c$__cjs$29$__["Schema"]({
    type: {
        type: String,
        required: true,
        enum: [
            "CableSubscription",
            "BillPayment",
            "ManualFunding",
            "AutomaticFunding",
            "DataTransaction",
            "AirtimeTransaction",
            "WithdrawalTransaction",
            "ReferalBonus",
            "RefundTransaction"
        ]
    },
    amount: {
        type: Number
    },
    balanceBefore: {
        type: Number
    },
    balanceAfter: {
        type: Number
    },
    adminEmail: {
        type: String
    },
    status: {
        type: String,
        required: true,
        enum: [
            "Pending",
            "Successful",
            "Failed"
        ]
    },
    referenceId: {
        type: String,
        unique: true
    },
    // Airtime Subscription Field
    airtimeType: {
        type: String
    },
    buyingPrice: {
        type: Number
    },
    // Cable Subscription Fields
    iucOrSmartcardNumber: {
        type: Number
    },
    request_id: {
        type: String
    },
    provider: {
        type: String
    },
    cablePlan: {
        type: String
    },
    action: {
        type: String
    },
    userId: {
        type: String
    },
    userEmail: {
        type: String
    },
    refund: {
        type: Boolean,
        default: false
    },
    bypass: {
        type: Boolean,
        default: false
    },
    // Bill Payment Fields
    meterNumber: {
        type: Number
    },
    token: {
        type: String
    },
    customerPhone: {
        type: Number
    },
    meterType: {
        type: String
    },
    customerName: {
        type: String
    },
    customerAddress: {
        type: String
    },
    discoName: {
        type: String
    },
    // Data Transaction Fields
    planType: {
        type: String
    },
    mobileNumber: {
        type: Number
    },
    medium: {
        type: String
    },
    network: {
        type: String
    },
    plansize: {
        type: String
    },
    // Funding Transaction Fields
    fundingType: {
        type: String,
        enum: [
            "Manual",
            "Automatic"
        ]
    },
    fundingSource: {
        type: String,
        enum: [
            "API",
            "Admin",
            "Referral",
            "ONE TIME PAYMENT"
        ]
    }
}, {
    timestamps: true
});
// Create the model if it doesn't already exist
const Transaction = __TURBOPACK__imported__module__$5b$externals$5d2f$mongoose__$5b$external$5d$__$28$mongoose$2c$__cjs$29$__["default"].models.Transaction || (0, __TURBOPACK__imported__module__$5b$externals$5d2f$mongoose__$5b$external$5d$__$28$mongoose$2c$__cjs$29$__["model"])("Transaction", transactionSchema);
const __TURBOPACK__default__export__ = Transaction;
}}),
"[externals]/crypto [external] (crypto, cjs)": (function(__turbopack_context__) {

var { g: global, __dirname, m: module, e: exports } = __turbopack_context__;
{
const mod = __turbopack_context__.x("crypto", () => require("crypto"));

module.exports = mod;
}}),
"[project]/models/user.ts [app-route] (ecmascript)": ((__turbopack_context__) => {
"use strict";

var { g: global, __dirname } = __turbopack_context__;
{
__turbopack_context__.s({
    "AdminSettings": (()=>AdminSettings),
    "Referral": (()=>Referral),
    "ReferralDeposit": (()=>ReferralDeposit),
    "User": (()=>User)
});
var __TURBOPACK__imported__module__$5b$externals$5d2f$mongoose__$5b$external$5d$__$28$mongoose$2c$__cjs$29$__ = __turbopack_context__.i("[externals]/mongoose [external] (mongoose, cjs)");
var __TURBOPACK__imported__module__$5b$project$5d2f$node_modules$2f$bcryptjs$2f$index$2e$js__$5b$app$2d$route$5d$__$28$ecmascript$29$__ = __turbopack_context__.i("[project]/node_modules/bcryptjs/index.js [app-route] (ecmascript)");
;
;
const authenticatorSchema = new __TURBOPACK__imported__module__$5b$externals$5d2f$mongoose__$5b$external$5d$__$28$mongoose$2c$__cjs$29$__["Schema"]({
    credentialID: {
        type: Buffer,
        required: true
    },
    credentialPublicKey: {
        type: Buffer,
        required: true
    },
    counter: {
        type: Number,
        required: true
    },
    transports: {
        type: [
            String
        ]
    }
});
const referralSchema = new __TURBOPACK__imported__module__$5b$externals$5d2f$mongoose__$5b$external$5d$__$28$mongoose$2c$__cjs$29$__["Schema"]({
    referrerId: {
        type: __TURBOPACK__imported__module__$5b$externals$5d2f$mongoose__$5b$external$5d$__$28$mongoose$2c$__cjs$29$__["default"].Schema.Types.ObjectId,
        ref: "User"
    },
    referredId: {
        type: __TURBOPACK__imported__module__$5b$externals$5d2f$mongoose__$5b$external$5d$__$28$mongoose$2c$__cjs$29$__["default"].Schema.Types.ObjectId,
        ref: "User"
    }
}, {
    timestamps: true
});
const referralDepositSchema = new __TURBOPACK__imported__module__$5b$externals$5d2f$mongoose__$5b$external$5d$__$28$mongoose$2c$__cjs$29$__["Schema"]({
    referredId: {
        type: __TURBOPACK__imported__module__$5b$externals$5d2f$mongoose__$5b$external$5d$__$28$mongoose$2c$__cjs$29$__["default"].Schema.Types.ObjectId,
        ref: "User"
    },
    amount: {
        type: Number
    },
    referrerCredit: {
        type: Number
    }
}, {
    timestamps: true
});
const reservedAccountDetailsSchema = new __TURBOPACK__imported__module__$5b$externals$5d2f$mongoose__$5b$external$5d$__$28$mongoose$2c$__cjs$29$__["Schema"]({
    accountName: {
        type: String,
        default: ""
    },
    accountReferences: {
        type: String,
        default: ""
    },
    reservationReference: {
        type: String,
        default: ""
    },
    accounts: [
        {
            bankCode: {
                type: String,
                default: ""
            },
            bankName: {
                type: String,
                default: ""
            },
            accountNumber: {
                type: String,
                default: ""
            },
            accountName: {
                type: String,
                default: ""
            }
        }
    ]
});
// const webAuthCredentialSchema = new Schema<WebAuthCredential>({
//   credentialID: { type: String, required: true }, // Base64URL
//   credentialPublicKey: { type: String, required: true }, // Base64URL
//   transports: { type: [String], default: [] },
//   counter: { type: Number, required: true },
// });
const userSchema = new __TURBOPACK__imported__module__$5b$externals$5d2f$mongoose__$5b$external$5d$__$28$mongoose$2c$__cjs$29$__["Schema"]({
    username: {
        type: String,
        unique: true
    },
    firstName: {
        type: String
    },
    middleName: {
        type: String
    },
    lastName: {
        type: String
    },
    name: {
        type: String
    },
    email: {
        type: String,
        unique: true
    },
    role: {
        type: String,
        enum: [
            "admin",
            "user"
        ]
    },
    userType: {
        type: String,
        enum: [
            "Smart Earner",
            "TopUser",
            "API User",
            "Affiliate User"
        ],
        default: "Smart Earner"
    },
    mobileNumber: {
        type: String
    },
    accountBalance: {
        type: Number,
        default: 0
    },
    reservedAccountDetails: [
        reservedAccountDetailsSchema
    ],
    bvn: {
        type: String
    },
    nin: {
        type: String
    },
    image: {
        type: String,
        default: ""
    },
    dateOfBirth: {
        type: Date
    },
    transactionPin: {
        type: String
    },
    referralCode: {
        type: String,
        unique: true
    },
    referredBy: [
        {
            type: __TURBOPACK__imported__module__$5b$externals$5d2f$mongoose__$5b$external$5d$__$28$mongoose$2c$__cjs$29$__["default"].Schema.Types.ObjectId,
            ref: "User",
            default: []
        }
    ],
    refererBonus: {
        type: Number,
        default: 0
    },
    thumbprintStatus: {
        type: Boolean,
        default: false
    },
    transactionStatus: {
        type: Boolean,
        default: false
    },
    lastLogin: {
        type: Date,
        default: null
    },
    dateJoined: {
        type: Date,
        default: Date.now
    },
    webhookUrl: {
        type: String
    },
    currentChallenge: {
        type: String
    },
    authenticators: [
        authenticatorSchema
    ],
    hasSeenModal: {
        type: Boolean,
        default: false
    },
    hasTransactionPin: {
        type: Boolean,
        default: false
    },
    transactionPinResetCode: {
        type: Number
    },
    transactionPinResetExpires: {
        type: Date
    },
    failedResetAttempts: {
        type: Number,
        default: 0
    }
}, {
    timestamps: true,
    toJSON: {
        virtuals: true
    },
    toObject: {
        virtuals: true
    }
});
const adminSettingsSchema = new __TURBOPACK__imported__module__$5b$externals$5d2f$mongoose__$5b$external$5d$__$28$mongoose$2c$__cjs$29$__["Schema"]({
    firstDepositPercentage: {
        type: Number,
        default: 1.5
    },
    subsequentDepositPercentage: {
        type: Number,
        default: 0.5
    },
    depositFeePercentage: {
        type: Number,
        default: 1.5
    }
});
userSchema.pre("save", async function(next) {
    if (this.isModified("transactionPin")) {
        const salt = await __TURBOPACK__imported__module__$5b$project$5d2f$node_modules$2f$bcryptjs$2f$index$2e$js__$5b$app$2d$route$5d$__$28$ecmascript$29$__["default"].genSalt(10);
        this.transactionPin = await __TURBOPACK__imported__module__$5b$project$5d2f$node_modules$2f$bcryptjs$2f$index$2e$js__$5b$app$2d$route$5d$__$28$ecmascript$29$__["default"].hash(this.transactionPin, salt);
    }
    next();
});
userSchema.virtual("referrals", {
    ref: "Referral",
    localField: "_id",
    foreignField: "referrerId"
});
const User = __TURBOPACK__imported__module__$5b$externals$5d2f$mongoose__$5b$external$5d$__$28$mongoose$2c$__cjs$29$__["default"].models.User || (0, __TURBOPACK__imported__module__$5b$externals$5d2f$mongoose__$5b$external$5d$__$28$mongoose$2c$__cjs$29$__["model"])("User", userSchema);
const Referral = __TURBOPACK__imported__module__$5b$externals$5d2f$mongoose__$5b$external$5d$__$28$mongoose$2c$__cjs$29$__["default"].models.Referral || (0, __TURBOPACK__imported__module__$5b$externals$5d2f$mongoose__$5b$external$5d$__$28$mongoose$2c$__cjs$29$__["model"])("Referral", referralSchema);
const ReferralDeposit = __TURBOPACK__imported__module__$5b$externals$5d2f$mongoose__$5b$external$5d$__$28$mongoose$2c$__cjs$29$__["default"].models.ReferralDeposit || (0, __TURBOPACK__imported__module__$5b$externals$5d2f$mongoose__$5b$external$5d$__$28$mongoose$2c$__cjs$29$__["model"])("ReferralDeposit", referralDepositSchema);
const AdminSettings = __TURBOPACK__imported__module__$5b$externals$5d2f$mongoose__$5b$external$5d$__$28$mongoose$2c$__cjs$29$__["default"].models.AdminSettings || (0, __TURBOPACK__imported__module__$5b$externals$5d2f$mongoose__$5b$external$5d$__$28$mongoose$2c$__cjs$29$__["model"])("AdminSettings", adminSettingsSchema);
}}),
"[externals]/util [external] (util, cjs)": (function(__turbopack_context__) {

var { g: global, __dirname, m: module, e: exports } = __turbopack_context__;
{
const mod = __turbopack_context__.x("util", () => require("util"));

module.exports = mod;
}}),
"[externals]/url [external] (url, cjs)": (function(__turbopack_context__) {

var { g: global, __dirname, m: module, e: exports } = __turbopack_context__;
{
const mod = __turbopack_context__.x("url", () => require("url"));

module.exports = mod;
}}),
"[externals]/http [external] (http, cjs)": (function(__turbopack_context__) {

var { g: global, __dirname, m: module, e: exports } = __turbopack_context__;
{
const mod = __turbopack_context__.x("http", () => require("http"));

module.exports = mod;
}}),
"[externals]/assert [external] (assert, cjs)": (function(__turbopack_context__) {

var { g: global, __dirname, m: module, e: exports } = __turbopack_context__;
{
const mod = __turbopack_context__.x("assert", () => require("assert"));

module.exports = mod;
}}),
"[externals]/querystring [external] (querystring, cjs)": (function(__turbopack_context__) {

var { g: global, __dirname, m: module, e: exports } = __turbopack_context__;
{
const mod = __turbopack_context__.x("querystring", () => require("querystring"));

module.exports = mod;
}}),
"[externals]/buffer [external] (buffer, cjs)": (function(__turbopack_context__) {

var { g: global, __dirname, m: module, e: exports } = __turbopack_context__;
{
const mod = __turbopack_context__.x("buffer", () => require("buffer"));

module.exports = mod;
}}),
"[externals]/zlib [external] (zlib, cjs)": (function(__turbopack_context__) {

var { g: global, __dirname, m: module, e: exports } = __turbopack_context__;
{
const mod = __turbopack_context__.x("zlib", () => require("zlib"));

module.exports = mod;
}}),
"[externals]/https [external] (https, cjs)": (function(__turbopack_context__) {

var { g: global, __dirname, m: module, e: exports } = __turbopack_context__;
{
const mod = __turbopack_context__.x("https", () => require("https"));

module.exports = mod;
}}),
"[externals]/events [external] (events, cjs)": (function(__turbopack_context__) {

var { g: global, __dirname, m: module, e: exports } = __turbopack_context__;
{
const mod = __turbopack_context__.x("events", () => require("events"));

module.exports = mod;
}}),
"[externals]/fs [external] (fs, cjs)": (function(__turbopack_context__) {

var { g: global, __dirname, m: module, e: exports } = __turbopack_context__;
{
const mod = __turbopack_context__.x("fs", () => require("fs"));

module.exports = mod;
}}),
"[externals]/stream [external] (stream, cjs)": (function(__turbopack_context__) {

var { g: global, __dirname, m: module, e: exports } = __turbopack_context__;
{
const mod = __turbopack_context__.x("stream", () => require("stream"));

module.exports = mod;
}}),
"[externals]/net [external] (net, cjs)": (function(__turbopack_context__) {

var { g: global, __dirname, m: module, e: exports } = __turbopack_context__;
{
const mod = __turbopack_context__.x("net", () => require("net"));

module.exports = mod;
}}),
"[externals]/dns [external] (dns, cjs)": (function(__turbopack_context__) {

var { g: global, __dirname, m: module, e: exports } = __turbopack_context__;
{
const mod = __turbopack_context__.x("dns", () => require("dns"));

module.exports = mod;
}}),
"[externals]/os [external] (os, cjs)": (function(__turbopack_context__) {

var { g: global, __dirname, m: module, e: exports } = __turbopack_context__;
{
const mod = __turbopack_context__.x("os", () => require("os"));

module.exports = mod;
}}),
"[externals]/path [external] (path, cjs)": (function(__turbopack_context__) {

var { g: global, __dirname, m: module, e: exports } = __turbopack_context__;
{
const mod = __turbopack_context__.x("path", () => require("path"));

module.exports = mod;
}}),
"[externals]/tls [external] (tls, cjs)": (function(__turbopack_context__) {

var { g: global, __dirname, m: module, e: exports } = __turbopack_context__;
{
const mod = __turbopack_context__.x("tls", () => require("tls"));

module.exports = mod;
}}),
"[externals]/child_process [external] (child_process, cjs)": (function(__turbopack_context__) {

var { g: global, __dirname, m: module, e: exports } = __turbopack_context__;
{
const mod = __turbopack_context__.x("child_process", () => require("child_process"));

module.exports = mod;
}}),
"[externals]/mongodb [external] (mongodb, cjs)": (function(__turbopack_context__) {

var { g: global, __dirname, m: module, e: exports } = __turbopack_context__;
{
const mod = __turbopack_context__.x("mongodb", () => require("mongodb"));

module.exports = mod;
}}),
"[project]/lib/db.ts [app-route] (ecmascript)": ((__turbopack_context__) => {
"use strict";

var { g: global, __dirname } = __turbopack_context__;
{
// This approach is taken from https://github.com/vercel/next.js/tree/canary/examples/with-mongodb
__turbopack_context__.s({
    "default": (()=>__TURBOPACK__default__export__)
});
var __TURBOPACK__imported__module__$5b$externals$5d2f$mongodb__$5b$external$5d$__$28$mongodb$2c$__cjs$29$__ = __turbopack_context__.i("[externals]/mongodb [external] (mongodb, cjs)");
;
if (!process.env.MONGODB_URI) {
    throw new Error('Invalid/Missing environment variable: "MONGODB_URI"');
}
const uri = process.env.MONGODB_URI;
const options = {
    serverApi: {
        version: __TURBOPACK__imported__module__$5b$externals$5d2f$mongodb__$5b$external$5d$__$28$mongodb$2c$__cjs$29$__["ServerApiVersion"].v1,
        strict: true,
        deprecationErrors: true
    }
};
let client;
if ("TURBOPACK compile-time truthy", 1) {
    // In development mode, use a global variable so that the value
    // is preserved across module reloads caused by HMR (Hot Module Replacement).
    const globalWithMongo = global;
    if (!globalWithMongo._mongoClient) {
        globalWithMongo._mongoClient = new __TURBOPACK__imported__module__$5b$externals$5d2f$mongodb__$5b$external$5d$__$28$mongodb$2c$__cjs$29$__["MongoClient"](uri, options);
    }
    client = globalWithMongo._mongoClient;
} else {
    "TURBOPACK unreachable";
}
const __TURBOPACK__default__export__ = client;
}}),
"[project]/lib/clearStaleTokensServerAction.ts [app-route] (ecmascript)": ((__turbopack_context__) => {
"use strict";

var { g: global, __dirname } = __turbopack_context__;
{
/* __next_internal_action_entry_do_not_use__ [{"7f7a09e0bfded8dae64a06e315d4f92e1680b61789":"clearStaleTokens"},"",""] */ __turbopack_context__.s({
    "clearStaleTokens": (()=>clearStaleTokens)
});
var __TURBOPACK__imported__module__$5b$project$5d2f$node_modules$2f$next$2f$dist$2f$build$2f$webpack$2f$loaders$2f$next$2d$flight$2d$loader$2f$server$2d$reference$2e$js__$5b$app$2d$route$5d$__$28$ecmascript$29$__ = __turbopack_context__.i("[project]/node_modules/next/dist/build/webpack/loaders/next-flight-loader/server-reference.js [app-route] (ecmascript)");
var __TURBOPACK__imported__module__$5b$project$5d2f$node_modules$2f$next$2f$dist$2f$server$2f$app$2d$render$2f$encryption$2e$js__$5b$app$2d$route$5d$__$28$ecmascript$29$__ = __turbopack_context__.i("[project]/node_modules/next/dist/server/app-render/encryption.js [app-route] (ecmascript)");
var __TURBOPACK__imported__module__$5b$project$5d2f$lib$2f$db$2e$ts__$5b$app$2d$route$5d$__$28$ecmascript$29$__ = __turbopack_context__.i("[project]/lib/db.ts [app-route] (ecmascript)");
var __TURBOPACK__imported__module__$5b$project$5d2f$node_modules$2f$next$2f$dist$2f$build$2f$webpack$2f$loaders$2f$next$2d$flight$2d$loader$2f$action$2d$validate$2e$js__$5b$app$2d$route$5d$__$28$ecmascript$29$__ = __turbopack_context__.i("[project]/node_modules/next/dist/build/webpack/loaders/next-flight-loader/action-validate.js [app-route] (ecmascript)");
;
;
;
const clearStaleTokens = async ()=>{
    try {
        const db = __TURBOPACK__imported__module__$5b$project$5d2f$lib$2f$db$2e$ts__$5b$app$2d$route$5d$__$28$ecmascript$29$__["default"].db("VTUAPP");
        const verificationTokenCollection = db.collection("verification_token");
        // Delete all tokens where the expiration date is in the past
        const result = await verificationTokenCollection.deleteMany({
            expires: {
                $lt: new Date()
            }
        });
    } catch (error) {
        console.error("Failed to clear stale tokens:", error);
        throw error;
    }
};
;
(0, __TURBOPACK__imported__module__$5b$project$5d2f$node_modules$2f$next$2f$dist$2f$build$2f$webpack$2f$loaders$2f$next$2d$flight$2d$loader$2f$action$2d$validate$2e$js__$5b$app$2d$route$5d$__$28$ecmascript$29$__["ensureServerEntryExports"])([
    clearStaleTokens
]);
(0, __TURBOPACK__imported__module__$5b$project$5d2f$node_modules$2f$next$2f$dist$2f$build$2f$webpack$2f$loaders$2f$next$2d$flight$2d$loader$2f$server$2d$reference$2e$js__$5b$app$2d$route$5d$__$28$ecmascript$29$__["registerServerReference"])(clearStaleTokens, "7f7a09e0bfded8dae64a06e315d4f92e1680b61789", null);
}}),
"[project]/utils/junkfunctions.ts [app-route] (ecmascript)": ((__turbopack_context__) => {
"use strict";

var { g: global, __dirname } = __turbopack_context__;
{
__turbopack_context__.s({
    "extractPlanDetails": (()=>extractPlanDetails),
    "generateReferenceId": (()=>generateReferenceId),
    "generateReferralCode": (()=>generateReferralCode),
    "generateRequestId": (()=>generateRequestId)
});
var __TURBOPACK__imported__module__$5b$project$5d2f$node_modules$2f$date$2d$fns$2f$format$2e$js__$5b$app$2d$route$5d$__$28$ecmascript$29$__$3c$locals$3e$__ = __turbopack_context__.i("[project]/node_modules/date-fns/format.js [app-route] (ecmascript) <locals>");
var __TURBOPACK__imported__module__$5b$project$5d2f$node_modules$2f$uuid$2f$dist$2f$esm$2d$node$2f$v4$2e$js__$5b$app$2d$route$5d$__$28$ecmascript$29$__$3c$export__default__as__v4$3e$__ = __turbopack_context__.i("[project]/node_modules/uuid/dist/esm-node/v4.js [app-route] (ecmascript) <export default as v4>");
var __TURBOPACK__imported__module__$5b$project$5d2f$node_modules$2f$date$2d$fns$2d$tz$2f$dist$2f$esm$2f$index$2e$js__$5b$app$2d$route$5d$__$28$ecmascript$29$__$3c$module__evaluation$3e$__ = __turbopack_context__.i("[project]/node_modules/date-fns-tz/dist/esm/index.js [app-route] (ecmascript) <module evaluation>");
var __TURBOPACK__imported__module__$5b$project$5d2f$node_modules$2f$date$2d$fns$2d$tz$2f$dist$2f$esm$2f$toZonedTime$2f$index$2e$js__$5b$app$2d$route$5d$__$28$ecmascript$29$__ = __turbopack_context__.i("[project]/node_modules/date-fns-tz/dist/esm/toZonedTime/index.js [app-route] (ecmascript)");
;
;
;
async function extractPlanDetails(planString) {
    console.log("Extracting plan details from:", planString);
    const match = planString.match(/(\d+(?:GB|MB))\s+N(\d+)/);
    if (match) {
        console.log("Match found:", match);
        // Extracting the plan size and amount from the matched groups
        console.log("Plan size:", match[1], "Amount:", match[2]);
        // Return the extracted details as an object
        // Convert the amount to a number
        console.log("Parsed amount:", parseFloat(match[2]));
        // Return the plan size and amount
        console.log("Returning plan details:", {
            plansize: match[1],
            amount: parseFloat(match[2])
        });
        return {
            plansize: match[1],
            amount: parseFloat(match[2])
        };
    }
    return {
        plansize: null,
        amount: 0
    };
}
async function generateReferenceId() {
    return "TXN-" + Math.random().toString(36).slice(2, 12).toUpperCase();
}
async function generateRequestId() {
    const timeZone = "Africa/Lagos";
    const now = (0, __TURBOPACK__imported__module__$5b$project$5d2f$node_modules$2f$date$2d$fns$2d$tz$2f$dist$2f$esm$2f$toZonedTime$2f$index$2e$js__$5b$app$2d$route$5d$__$28$ecmascript$29$__["toZonedTime"])(new Date(), timeZone);
    const timestamp = (0, __TURBOPACK__imported__module__$5b$project$5d2f$node_modules$2f$date$2d$fns$2f$format$2e$js__$5b$app$2d$route$5d$__$28$ecmascript$29$__$3c$locals$3e$__["format"])(now, "yyyyMMddHHmm");
    const uniqueId = (0, __TURBOPACK__imported__module__$5b$project$5d2f$node_modules$2f$uuid$2f$dist$2f$esm$2d$node$2f$v4$2e$js__$5b$app$2d$route$5d$__$28$ecmascript$29$__$3c$export__default__as__v4$3e$__["v4"])().replace(/-/g, "").slice(0, 8);
    return `${timestamp}${uniqueId}`;
}
async function generateReferralCode() {
    const chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
    let code = "";
    for(let i = 0; i < 8; i++){
        code += chars.charAt(Math.floor(Math.random() * chars.length));
    }
    return code;
}
}}),
"[project]/auth.ts [app-route] (ecmascript)": ((__turbopack_context__) => {
"use strict";

var { g: global, __dirname } = __turbopack_context__;
{
__turbopack_context__.s({
    "authOptions": (()=>authOptions)
});
var __TURBOPACK__imported__module__$5b$project$5d2f$node_modules$2f$next$2d$auth$2f$providers$2f$google$2e$js__$5b$app$2d$route$5d$__$28$ecmascript$29$__ = __turbopack_context__.i("[project]/node_modules/next-auth/providers/google.js [app-route] (ecmascript)");
var __TURBOPACK__imported__module__$5b$project$5d2f$node_modules$2f$next$2d$auth$2f$providers$2f$email$2e$js__$5b$app$2d$route$5d$__$28$ecmascript$29$__ = __turbopack_context__.i("[project]/node_modules/next-auth/providers/email.js [app-route] (ecmascript)");
var __TURBOPACK__imported__module__$5b$project$5d2f$lib$2f$db$2e$ts__$5b$app$2d$route$5d$__$28$ecmascript$29$__ = __turbopack_context__.i("[project]/lib/db.ts [app-route] (ecmascript)");
var __TURBOPACK__imported__module__$5b$project$5d2f$node_modules$2f40$auth$2f$mongodb$2d$adapter$2f$index$2e$js__$5b$app$2d$route$5d$__$28$ecmascript$29$__ = __turbopack_context__.i("[project]/node_modules/@auth/mongodb-adapter/index.js [app-route] (ecmascript)");
var __TURBOPACK__imported__module__$5b$project$5d2f$lib$2f$clearStaleTokensServerAction$2e$ts__$5b$app$2d$route$5d$__$28$ecmascript$29$__ = __turbopack_context__.i("[project]/lib/clearStaleTokensServerAction.ts [app-route] (ecmascript)");
var __TURBOPACK__imported__module__$5b$project$5d2f$lib$2f$connectdb$2e$ts__$5b$app$2d$route$5d$__$28$ecmascript$29$__ = __turbopack_context__.i("[project]/lib/connectdb.ts [app-route] (ecmascript)");
var __TURBOPACK__imported__module__$5b$project$5d2f$models$2f$user$2e$ts__$5b$app$2d$route$5d$__$28$ecmascript$29$__ = __turbopack_context__.i("[project]/models/user.ts [app-route] (ecmascript)");
var __TURBOPACK__imported__module__$5b$project$5d2f$node_modules$2f$nodemailer$2f$lib$2f$nodemailer$2e$js__$5b$app$2d$route$5d$__$28$ecmascript$29$__ = __turbopack_context__.i("[project]/node_modules/nodemailer/lib/nodemailer.js [app-route] (ecmascript)");
var __TURBOPACK__imported__module__$5b$project$5d2f$utils$2f$junkfunctions$2e$ts__$5b$app$2d$route$5d$__$28$ecmascript$29$__ = __turbopack_context__.i("[project]/utils/junkfunctions.ts [app-route] (ecmascript)");
;
;
;
;
;
;
;
;
;
const authOptions = {
    adapter: (0, __TURBOPACK__imported__module__$5b$project$5d2f$node_modules$2f40$auth$2f$mongodb$2d$adapter$2f$index$2e$js__$5b$app$2d$route$5d$__$28$ecmascript$29$__["MongoDBAdapter"])(__TURBOPACK__imported__module__$5b$project$5d2f$lib$2f$db$2e$ts__$5b$app$2d$route$5d$__$28$ecmascript$29$__["default"]),
    secret: process.env.AUTH_SECRET,
    session: {
        strategy: "jwt",
        maxAge: 30 * 1 * 60 * 60
    },
    pages: {
        signIn: "/auth/sign-in",
        verifyRequest: "/auth/auth-success",
        error: "/auth/auth-error"
    },
    providers: [
        (0, __TURBOPACK__imported__module__$5b$project$5d2f$node_modules$2f$next$2d$auth$2f$providers$2f$google$2e$js__$5b$app$2d$route$5d$__$28$ecmascript$29$__["default"])({
            clientId: process.env.AUTH_GOOGLE_ID,
            clientSecret: process.env.AUTH_GOOGLE_SECRET,
            allowDangerousEmailAccountLinking: true,
            authorization: {
                params: {
                    prompt: "select_account",
                    access_type: "offline",
                    response_type: "code"
                }
            },
            async profile (profile) {
                const blockedEmails = [
                    "wintosam@gmail.com",
                    "williamwoodland33@gmail.com",
                    "jochebedapps@gmail.com",
                    "princeichulo@gmail.com"
                ];
                const email = profile.email ?? "";
                const isProsperSeries = /^prosperjasper\d{3}@gmail\.com$/.test(email) || email === "prosperjasper@gmail.com";
                if (blockedEmails.includes(email) || isProsperSeries) {
                    throw new Error("Blocked email address");
                }
                return {
                    id: profile.sub,
                    username: profile.sub,
                    email: profile.email,
                    emailVerified: profile.email_verified,
                    name: profile.name,
                    image: profile.picture,
                    role: profile.role ?? "user",
                    provider: profile.provider ?? "google",
                    lastLogin: null,
                    hasSeenModal: false,
                    referralCode: await (0, __TURBOPACK__imported__module__$5b$project$5d2f$utils$2f$junkfunctions$2e$ts__$5b$app$2d$route$5d$__$28$ecmascript$29$__["generateReferralCode"])()
                };
            },
            httpOptions: {
                timeout: 20000
            }
        }),
        (0, __TURBOPACK__imported__module__$5b$project$5d2f$node_modules$2f$next$2d$auth$2f$providers$2f$email$2e$js__$5b$app$2d$route$5d$__$28$ecmascript$29$__["default"])({
            server: {
                host: process.env.EMAIL_SERVER_HOST,
                port: parseInt(process.env.EMAIL_SERVER_PORT, 10),
                auth: {
                    user: process.env.EMAIL_SERVER_USER,
                    pass: process.env.EMAIL_SERVER_PASSWORD
                }
            },
            from: process.env.EMAIL_FROM,
            sendVerificationRequest: async ({ identifier, url, provider })=>{
                await (0, __TURBOPACK__imported__module__$5b$project$5d2f$lib$2f$connectdb$2e$ts__$5b$app$2d$route$5d$__$28$ecmascript$29$__["default"])();
                // Check if the user already exists
                let user = await __TURBOPACK__imported__module__$5b$project$5d2f$models$2f$user$2e$ts__$5b$app$2d$route$5d$__$28$ecmascript$29$__["User"].findOne({
                    email: identifier
                });
                if (!user) {
                    // Create a new user if they don't exist
                    user = await __TURBOPACK__imported__module__$5b$project$5d2f$models$2f$user$2e$ts__$5b$app$2d$route$5d$__$28$ecmascript$29$__["User"].create({
                        email: identifier,
                        referralCode: (0, __TURBOPACK__imported__module__$5b$project$5d2f$utils$2f$junkfunctions$2e$ts__$5b$app$2d$route$5d$__$28$ecmascript$29$__["generateReferralCode"])()
                    });
                }
                const { host } = new URL(url);
                const transport = (0, __TURBOPACK__imported__module__$5b$project$5d2f$node_modules$2f$nodemailer$2f$lib$2f$nodemailer$2e$js__$5b$app$2d$route$5d$__$28$ecmascript$29$__["createTransport"])(provider.server);
                await transport.sendMail({
                    to: identifier,
                    from: provider.from,
                    subject: `Sign in to ${host}`,
                    text: `Sign in by clicking on the link below:\n\n${url}\n\n`,
                    html: `<p>Sign in by clicking on the link below:</p><p><a href="${url}">Sign in</a></p>`
                });
            }
        })
    ],
    callbacks: {
        async signIn ({ user }) {
            const blockedEmails = [
                "wintosam@gmail.com",
                "williamwoodland33@gmail.com",
                "jochebedapps@gmail.com",
                "princeichulo@gmail.com"
            ];
            const email = user.email ?? "";
            const isProsperSeries = /^prosperjasper\d{3}@gmail\.com$/.test(email) || email === "prosperjasper@gmail.com";
            if (blockedEmails.includes(email) || isProsperSeries) {
                console.warn(`Blocked login attempt from: ${email}`);
                return false; // Block sign-in
            }
            return true; // Allow sign-in
        },
        async redirect ({ url, baseUrl }) {
            return baseUrl + "/dashboard";
        },
        async jwt ({ token, trigger, session, user }) {
            if (user) {
                token.email = user.email;
                token.name = user.name;
                token.id = user.id;
                token.image = user.image;
                token.role = user.role;
                token.hasSeenModal = user.hasSeenModal;
                token.lastLogin = user.lastLogin;
                await (0, __TURBOPACK__imported__module__$5b$project$5d2f$lib$2f$clearStaleTokensServerAction$2e$ts__$5b$app$2d$route$5d$__$28$ecmascript$29$__["clearStaleTokens"])();
            }
            return token;
        },
        async session ({ session, token }) {
            await (0, __TURBOPACK__imported__module__$5b$project$5d2f$lib$2f$connectdb$2e$ts__$5b$app$2d$route$5d$__$28$ecmascript$29$__["default"])();
            const user = await __TURBOPACK__imported__module__$5b$project$5d2f$models$2f$user$2e$ts__$5b$app$2d$route$5d$__$28$ecmascript$29$__["User"].findOne({
                email: session?.user?.email
            });
            if (user) {
                user.lastLogin = new Date();
                await user.save();
                session.user = {
                    id: user._id.toString(),
                    name: user.name,
                    email: user.email,
                    image: user.image,
                    role: user.role,
                    hasSeenModal: user.hasSeenModal,
                    lastLogin: user.lastLogin,
                    provider: token.provider
                };
            // session.user = { ...session.user, ...user.toObject() };
            } else {
                session.user = {
                    hasSeenModal: token.hasSeenModal,
                    email: token.email,
                    name: token.name,
                    id: token.id,
                    image: token.image,
                    role: token.role,
                    lastLogin: token.lastLogin,
                    provider: token.provider
                };
            }
            return session;
        }
    },
    debug: true
};
}}),
"[project]/app/api/adminapi/transactions/ausertransaction/route.ts [app-route] (ecmascript)": ((__turbopack_context__) => {
"use strict";

var { g: global, __dirname } = __turbopack_context__;
{
__turbopack_context__.s({
    "GET": (()=>GET)
});
var __TURBOPACK__imported__module__$5b$project$5d2f$node_modules$2f$next$2f$server$2e$js__$5b$app$2d$route$5d$__$28$ecmascript$29$__ = __turbopack_context__.i("[project]/node_modules/next/server.js [app-route] (ecmascript)");
var __TURBOPACK__imported__module__$5b$project$5d2f$lib$2f$connectdb$2e$ts__$5b$app$2d$route$5d$__$28$ecmascript$29$__ = __turbopack_context__.i("[project]/lib/connectdb.ts [app-route] (ecmascript)");
var __TURBOPACK__imported__module__$5b$project$5d2f$models$2f$transactions$2e$ts__$5b$app$2d$route$5d$__$28$ecmascript$29$__ = __turbopack_context__.i("[project]/models/transactions.ts [app-route] (ecmascript)");
var __TURBOPACK__imported__module__$5b$project$5d2f$models$2f$user$2e$ts__$5b$app$2d$route$5d$__$28$ecmascript$29$__ = __turbopack_context__.i("[project]/models/user.ts [app-route] (ecmascript)"); // Import User model
var __TURBOPACK__imported__module__$5b$project$5d2f$node_modules$2f$next$2d$auth$2f$index$2e$js__$5b$app$2d$route$5d$__$28$ecmascript$29$__ = __turbopack_context__.i("[project]/node_modules/next-auth/index.js [app-route] (ecmascript)");
var __TURBOPACK__imported__module__$5b$project$5d2f$auth$2e$ts__$5b$app$2d$route$5d$__$28$ecmascript$29$__ = __turbopack_context__.i("[project]/auth.ts [app-route] (ecmascript)");
;
;
;
;
;
;
async function GET(req) {
    await (0, __TURBOPACK__imported__module__$5b$project$5d2f$lib$2f$connectdb$2e$ts__$5b$app$2d$route$5d$__$28$ecmascript$29$__["default"])();
    try {
        const session = await (0, __TURBOPACK__imported__module__$5b$project$5d2f$node_modules$2f$next$2d$auth$2f$index$2e$js__$5b$app$2d$route$5d$__$28$ecmascript$29$__["getServerSession"])(__TURBOPACK__imported__module__$5b$project$5d2f$auth$2e$ts__$5b$app$2d$route$5d$__$28$ecmascript$29$__["authOptions"]);
        if (!session) {
            return __TURBOPACK__imported__module__$5b$project$5d2f$node_modules$2f$next$2f$server$2e$js__$5b$app$2d$route$5d$__$28$ecmascript$29$__["NextResponse"].json({
                message: "Unauthorized"
            }, {
                status: 401
            });
        }
        // Check if user is admin
        const userRole = session.user.role;
        if (userRole !== "admin") {
            return __TURBOPACK__imported__module__$5b$project$5d2f$node_modules$2f$next$2f$server$2e$js__$5b$app$2d$route$5d$__$28$ecmascript$29$__["NextResponse"].json({
                message: "Admin access required"
            }, {
                status: 403
            });
        }
        // Get search query from URL parameters
        const { searchParams } = new URL(req.url);
        const searchQuery = searchParams.get("search");
        let transactions;
        let userWalletBalance = null;
        if (searchQuery) {
            // Search for user by email, name, or userId
            const user = await __TURBOPACK__imported__module__$5b$project$5d2f$models$2f$user$2e$ts__$5b$app$2d$route$5d$__$28$ecmascript$29$__["User"].findOne({
                $or: [
                    {
                        email: {
                            $regex: searchQuery,
                            $options: "i"
                        }
                    },
                    {
                        name: {
                            $regex: searchQuery,
                            $options: "i"
                        }
                    },
                    {
                        userId: searchQuery
                    }
                ]
            });
            if (user) {
                // Get user's wallet balance
                userWalletBalance = user.accountBalance;
                // Get transactions for this user
                transactions = await __TURBOPACK__imported__module__$5b$project$5d2f$models$2f$transactions$2e$ts__$5b$app$2d$route$5d$__$28$ecmascript$29$__["default"].find({
                    userId: user._id
                });
            } else {
                // If no user found, return empty transactions
                transactions = [];
            }
        } else {
            // If no search query, get all transactions
            transactions = await __TURBOPACK__imported__module__$5b$project$5d2f$models$2f$transactions$2e$ts__$5b$app$2d$route$5d$__$28$ecmascript$29$__["default"].find({});
        }
        // Return transactions and user wallet balance if available
        return __TURBOPACK__imported__module__$5b$project$5d2f$node_modules$2f$next$2f$server$2e$js__$5b$app$2d$route$5d$__$28$ecmascript$29$__["NextResponse"].json({
            transactions,
            ...userWalletBalance !== null && {
                userWalletBalance
            }
        }, {
            status: 200
        });
    } catch (error) {
        console.error("Error fetching transactions:", error);
        return __TURBOPACK__imported__module__$5b$project$5d2f$node_modules$2f$next$2f$server$2e$js__$5b$app$2d$route$5d$__$28$ecmascript$29$__["NextResponse"].json({
            message: "Error fetching transactions",
            error
        }, {
            status: 500
        });
    }
}
}}),

};

//# sourceMappingURL=%5Broot-of-the-server%5D__50032cfe._.js.map