"use strict";
/**
 * AU Online Safety Act 2021
 *
 * Primary statute: Online Safety Act 2021 (Cth) (OSA), effective 23 January 2022.
 *
 * Key instruments:
 *   - Basic Online Safety Expectations (BOSE) Determination 2022 (s.48)
 *   - Online Safety (Relevant Electronic Services) Determination
 *   - Online Safety (Designated Internet Services) Determination
 *   - eSafety Commissioner enforcement guidelines
 *
 * Covered services: Social media services, relevant electronic services (private
 * messaging, online gaming, email, dating), and designated internet services
 * (hosting, search, content aggregation) with AU end-users. AI systems operating
 * as or within these services: AI chat, AI moderation, AI recommendation engines,
 * AI-generated content platforms, AI companions/virtual agents.
 *
 * Key AI obligations:
 *   - Part 4 (Cyberbullying): 48-hour removal obligation after notice targeting AU child.
 *   - Part 5 (Adult Cyber Abuse): 48-hour removal after eSafety notice.
 *   - Part 6 (NCII + Deepfake): 2024 amendments extend to AI-generated deepfake
 *     intimate images; removal on notice.
 *   - Part 9 (Class 1 CSAM): Absolute prohibition; proactive detection required.
 *     AI generation systems need active safeguards against Class 1 production.
 *   - BOSE s.8-10: Age assurance/verification and safety by design for minors.
 *   - BOSE s.11-12: Transparency reporting on eSafety request.
 *
 * [CITATION TO VERIFY]: NCII deepfake commencement date (2024 amendments) — verify
 * exact commencement date and current eSafety guidance on technical age-assurance
 * requirements. Physical e-commerce platforms with incidental messaging — verify
 * scope exclusion under current determinations.
 *
 * Cross-pack interactions:
 *   - au-online-safety + au-privacy-act: Moderation records contain PI; APP 11
 *     applies. eSafety investigation powers (s.173-183) may override APP 6
 *     secondary-use restrictions for investigations.
 *   - au-online-safety + coppa: AU platforms with US under-13 users: OSA minor
 *     protections for AU; COPPA for US under-13. Both regimes run simultaneously.
 *   - au-online-safety + euaiact: GPAI providers with systemic-risk classification
 *     face EU AI Act Art. 53/55 obligations complementary to BOSE. AU 48-hour
 *     removal more operationally demanding than EU AI Act transparency obligations.
 *
 * Authority: eSafety Commissioner (Australia)
 * Sovereignty: Australian Federal
 *
 * @connexum/ai-governance
 */
Object.defineProperty(exports, "__esModule", { value: true });
exports.AU_ONLINE_SAFETY_PACK = exports.AU_ONLINE_SAFETY_CATEGORY_CLASSIFIERS = void 0;
exports.AU_ONLINE_SAFETY_CATEGORY_CLASSIFIERS = {
    OSA_CSAM: {
        references: ['OSA 2021 Part 9 — Class 1 material (CSAM) absolute prohibition + proactive detection'],
        classifier: (input) => {
            // Content indicating CSAM classification or risk
            if (/\b(?:class[_\-\s]?1\s+material|csam|child\s+(?:sexual\s+abuse\s+material|exploitation\s+material|sex(?:ual)?\s+content)|child\s+(?:pornography|abuse\s+image))/i.test(input))
                return true;
            return false;
        },
    },
    OSA_CLASS2_MATERIAL: {
        references: ['OSA 2021 Part 9 — Class 2 material: pro-terror, NCII, abusive targeted content'],
        classifier: (input) => {
            if (/\b(?:class[_\-\s]?2\s+material|pro[_\-\s]?terror(?:ism)?\s+content|osa\s+class\s*2|violent\s+extremist\s+content.*online\s+safety)/i.test(input))
                return true;
            return false;
        },
    },
    OSA_CYBERBULLYING_CHILD: {
        references: ['OSA 2021 Part 4 — cyberbullying targeting AU child; 48-hour removal'],
        classifier: (input) => {
            if (/\b(?:cyberbullying.*(?:child|minor|under[_\-\s]?18|au\s+child)|targeting.*(?:child|minor).*(?:online|digital|cyber)|online\s+(?:bullying|abuse|harassment).*(?:child|minor|au\s+child))/i.test(input))
                return true;
            return false;
        },
    },
    OSA_NCII: {
        references: ['OSA 2021 Part 6 — NCII; 2024 amendments extend to AI deepfake intimate images [CITATION TO VERIFY commencement]'],
        classifier: (input) => {
            if (/\b(?:ncii|non[_\-\s]?consensual\s+intimate\s+image|deepfake\s+(?:intimate|nude|sexual)|revenge\s+porn|intimate\s+image.*without\s+consent)/i.test(input))
                return true;
            return false;
        },
    },
    OSA_ESAFETY_NOTICE: {
        references: ['OSA 2021 s.194-201 — formal eSafety compliance notice; BOSE compliance notice'],
        classifier: (input) => {
            if (/\b(?:esafety\s+(?:notice|commissioner\s+notice|compliance\s+notice|information\s+request)|formal\s+notice.*(?:esafety|online\s+safety\s+act))/i.test(input))
                return true;
            return false;
        },
    },
    OSA_BOSE_GAP: {
        references: ['OSA 2021 s.48 BOSE Determination 2022 — 22 basic online safety expectations'],
        classifier: (input) => {
            if (/\b(?:bose\s+(?:gap|compliance|expectation|coverage)|basic\s+online\s+safety\s+expectation|bose\s+2022.*(?:gap|missing|not\s+met))/i.test(input))
                return true;
            return false;
        },
    },
    OSA_MINOR_USER: {
        references: ['OSA 2021 BOSE s.8-10 — children\'s safety; age assurance [CITATION TO VERIFY technical requirements]'],
        classifier: (input) => {
            if (/\b(?:minor\s+(?:user|account|profile)|under[_\-\s]?18\s+user|child\s+(?:user|account)|age\s+(?:gate|assurance|verification).*(?:minor|child|under[_\-\s]?18))/i.test(input))
                return true;
            return false;
        },
    },
};
exports.AU_ONLINE_SAFETY_PACK = {
    categoryClassifiers: exports.AU_ONLINE_SAFETY_CATEGORY_CLASSIFIERS,
    /**
     * P3.5: Content-keyed categories (CSAM, Class 2, NCII, cyberbullying) are
     * subject-keyed by content target or by content ID to maintain eSafety
     * investigation audit trail. Minor user is subject-keyed. BOSE gap is
     * system-level (non-subject-keyed).
     *
     * [CITATION TO VERIFY]: NCII deepfake commencement date; eSafety technical
     * age-assurance standard; scope of designated internet services determination.
     */
    subjectKeyedCategories: [
        'OSA_CSAM',
        'OSA_CLASS2_MATERIAL',
        'OSA_CYBERBULLYING_CHILD',
        'OSA_NCII',
        'OSA_MINOR_USER',
    ],
    id: 'au-online-safety',
    name: 'AU Online Safety Act 2021',
    version: '1.0.0',
    description: 'Online Safety Act 2021 compliance for AI systems deployed on or as social media, messaging, gaming, or content hosting services with AU users. Enforces absolute CSAM block (Part 9), NCII and deepfake intimate image block (Part 6, 2024 amendments [CITATION TO VERIFY commencement]), 48-hour cyberbullying removal (Part 4), minor user protection controls (BOSE s.8-10), eSafety notice routing, and BOSE coverage documentation.',
    authority: 'eSafety Commissioner (Australia)',
    industries: [
        'social-media', 'saas', 'consumer-apps', 'gaming',
        'edtech', 'media', 'messaging', 'ai-platforms',
    ],
    requiredModules: [
        {
            name: 'governance-runtime',
            required: true,
            reason: 'CSAM absolute block; NCII/deepfake block; 48-hour removal protocol; eSafety notice routing; minor user enhanced controls',
            reference: 'OSA 2021 Part 4 (48h); Part 6 (NCII); Part 9 (CSAM); BOSE s.8-10 (minors)',
        },
        {
            name: 'audit-integrity',
            required: true,
            reason: 'Content moderation records 3 years; eSafety notice records 7 years; CSAM detection/referral records 7 years',
            reference: 'OSA 2021; law enforcement retention requirements for CSAM records',
        },
        {
            name: 'data-classifier',
            required: true,
            reason: 'Detect CSAM, Class 2 material, NCII/deepfake, cyberbullying targeting children, minor users, eSafety notices',
            reference: 'OSA 2021 Part 4, 5, 6, 9; BOSE 2022',
        },
        {
            name: 'approval-queue',
            required: true,
            reason: 'eSafety notice legal and senior management review; minor user enhanced-restriction approval',
            reference: 'OSA 2021 s.194-201 (compliance notice); BOSE s.8-10',
        },
        {
            name: 'event-bus',
            required: true,
            reason: 'CSAM detection referral stream; 48-hour removal timer events; eSafety notice events; minor user context events',
            reference: 'OSA 2021 Part 4 (48h); Part 9 (CSAM prompt referral)',
        },
    ],
    moduleConfig: {
        'data-classifier': {
            enabledCategories: [
                'OSA_CSAM',
                'OSA_CLASS2_MATERIAL',
                'OSA_CYBERBULLYING_CHILD',
                'OSA_NCII',
                'OSA_ESAFETY_NOTICE',
                'OSA_BOSE_GAP',
                'OSA_MINOR_USER',
            ],
            csamBlockEnabled: true,
            nciiBlockEnabled: true,
            contentRemoval48hActive: true,
            esafetyNoticeRoutingEnabled: true,
            minorUserProtectionsEnabled: true,
            boseCoverageDocumented: true,
            moderationLoggingActive: true,
        },
        'governance-runtime': {
            csamBlockEnabled: true,
            nciiBlockEnabled: true,
            contentRemoval48hActive: true,
            esafetyNoticeRoutingEnabled: true,
            minorUserProtectionsEnabled: true,
            boseCoverageDocumented: true,
            moderationLoggingActive: true,
        },
        'approval-queue': {
            esafetyNoticeApprovalRequired: true,
            minorUserRestrictionApprovalRequired: true,
        },
    },
    providerPolicy: {
        blockedProviders: [],
        requiredCapabilities: [
            'CSAM-PROACTIVE-DETECTION',
            'NCII-DEEPFAKE-SAFEGUARDS',
            'ESAFETY-NOTICE-COOPERATION',
            'MINOR-AGE-ASSURANCE',
        ],
        blockReasons: {},
    },
    dataPolicy: {
        scanCategories: [
            'OSA_CSAM',
            'OSA_CLASS2_MATERIAL',
            'OSA_CYBERBULLYING_CHILD',
            'OSA_NCII',
            'OSA_ESAFETY_NOTICE',
            'OSA_BOSE_GAP',
            'OSA_MINOR_USER',
        ],
        categoryActions: {
            OSA_CSAM: 'BLOCK',
            OSA_CLASS2_MATERIAL: 'BLOCK',
            OSA_CYBERBULLYING_CHILD: 'BLOCK',
            OSA_NCII: 'BLOCK',
            OSA_ESAFETY_NOTICE: 'REQUIRE_APPROVAL',
            OSA_BOSE_GAP: 'WARN',
            OSA_MINOR_USER: 'REQUIRE_APPROVAL',
        },
        encryptionRequired: true,
        encryptionStandard: 'AES-256',
        minimumClassification: 'CONFIDENTIAL',
    },
    retentionPolicy: {
        sovereignty: ['AU'],
        auditLogRetentionDays: 2555, // 7 years (eSafety notice records, CSAM detection records)
        sessionRetentionDays: 1095, // 3 years (moderation records, BOSE compliance docs)
        incidentRetentionDays: 2555,
        reference: 'OSA 2021: content moderation records 3y; eSafety notice records 7y; CSAM detection/referral records 7y (law enforcement)',
    },
    incidentPolicy: {
        notificationDeadlineHours: 48, // Part 4/5/6: 48-hour removal obligation on notice
        reference: 'OSA 2021 s.67 (Part 4/5 cyberbullying/adult abuse 48h); Part 6 (NCII removal on notice); Part 9 (CSAM immediate)',
        requiredRecipients: ['esafety-commissioner', 'afp'],
        formalNotificationRequired: true,
    },
    validators: [
        {
            id: 'au-online-safety-csam-block',
            description: 'CSAM generation and hosting absolutely blocked; proactive detection active',
            reference: 'OSA 2021 Part 9',
            check: 'au_online_safety_csam_block_active',
            failSeverity: 'CRITICAL',
        },
        {
            id: 'au-online-safety-ncii-block',
            description: 'NCII and AI-generated deepfake intimate images blocked [CITATION TO VERIFY: 2024 amendment commencement]',
            reference: 'OSA 2021 Part 6 (2024 amendments)',
            check: 'au_online_safety_ncii_block_active',
            failSeverity: 'CRITICAL',
        },
        {
            id: 'au-online-safety-48h-removal',
            description: 'Cyberbullying targeting AU children and Class 2 material removal protocol active within 48 hours',
            reference: 'OSA 2021 s.67',
            check: 'au_online_safety_48h_removal_active',
            failSeverity: 'HIGH',
        },
        {
            id: 'au-online-safety-esafety-notice',
            description: 'Formal eSafety notice triggers REQUIRE_APPROVAL with legal and senior management routing',
            reference: 'OSA 2021 s.194-201',
            check: 'au_online_safety_esafety_notice_active',
            failSeverity: 'HIGH',
        },
        {
            id: 'au-online-safety-minor-protections',
            description: 'Minor user context activates enhanced safety controls and age-appropriate restrictions',
            reference: 'OSA 2021 BOSE s.8-10',
            check: 'au_online_safety_minor_protections_active',
            failSeverity: 'HIGH',
        },
        {
            id: 'au-online-safety-bose-coverage',
            description: 'BOSE compliance documented for all 22 basic online safety expectations',
            reference: 'OSA 2021 BOSE Determination 2022',
            check: 'au_online_safety_bose_coverage_active',
            failSeverity: 'MEDIUM',
        },
        {
            id: 'au-online-safety-moderation-logging',
            description: 'All content moderation events logged with content classification and outcome',
            reference: 'OSA 2021 eSafety enforcement guidance',
            check: 'au_online_safety_moderation_logging_active',
            failSeverity: 'MEDIUM',
        },
    ],
};
//# sourceMappingURL=au-online-safety.js.map