{"version":3,"file":"useRights-2iW8A6VG.mjs","names":[],"sources":["../src/components/composable/useRights.ts"],"sourcesContent":["import { Mix } from \"../../stores/class/radio/mix\";\nimport { useAuthStore } from \"../../stores/AuthStore\";\nimport type { Emission } from \"../../stores/class/general/emission\";\nimport type { Podcast } from \"../../stores/class/general/podcast\";\nimport { PlaylistMedia } from \"../../stores/class/radio/playlistMedia\";\nimport { Cartouchier } from \"../../stores/class/cartouchier/cartouchier\";\nimport { Media } from \"../../stores/class/general/media\";\nimport { Conference } from \"../../stores/class/conference/conference\";\nimport { Rubrique } from \"@/stores/class/rubrique/rubrique\";\nimport { Rubriquage } from \"@/stores/class/rubrique/rubriquage\";\n\ntype Role =\n    'ADMIN'|'ORGANISATION'|\n    'PRODUCTION'|'RESTRICTED_PRODUCTION'|'PODCAST_CRUD'|'PODCAST_VALIDATION'|\n    'PLAYLISTS'|'ANIMATION'|'RESTRICTED_ANIMATION'|'RADIO'|'LIVE'|\n    'EDITION'\n    ;\n\nexport enum ActionRight {\n    /** User can perform the action */\n    Allowed = 'allowed',\n    /** User lacks the required role */\n    DeniedNoRight = 'no_right',  \n    /** User has a restricted role but does not own the resource **/\n    DeniedNotOwner = 'not_owner',\n    /** User is scoped to specific rubriques */\n    DeniedInsufficientScope = 'no_scope'\n}\n\n// Constraint type for the object passed to deriveCanFunctions.\n// any[] is intentional: it allows functions with any parameter signature to satisfy\n// the constraint while still enforcing that the return type is ActionRight.\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\ntype SyncRightFns = Record<string, (...args: any[]) => ActionRight>;\n\n// Maps every key of the form `get${A}Right` to `can${A}`, preserving the parameter\n// types of the original function but changing the return type to boolean.\n// Keys that do not match the naming convention are dropped (mapped to never).\ntype CanFns<T extends SyncRightFns> = {\n    [K in keyof T as K extends `get${infer A}Right` ? `can${A}` : never]:\n        T[K] extends (...args: infer P) => ActionRight ? (...args: P) => boolean : never;\n};\n\n/**\n * Generates boolean shortcut functions from a set of `getRightXxx` functions.\n *\n * Convention: `get${Action}Right(…args) → ActionRight`\n *         becomes `can${Action}(…args) → boolean`\n *\n * The generated function returns true when the underlying getRightXxx returns\n * ActionRight.Allowed, and false otherwise. This means callers that only need\n * a simple yes/no answer can use canXxx(), while callers that need the specific\n * denial reason (DeniedNoRight vs DeniedNotOwner) can call getRightXxx() directly.\n *\n * Only synchronous functions should be passed here; async rights functions must\n * be wrapped manually.\n */\nfunction deriveCanFunctions<T extends SyncRightFns>(fns: T): CanFns<T> {\n    const result = {} as CanFns<T>;\n    for (const key of Object.keys(fns) as (keyof T & string)[]) {\n        if (key.startsWith('get') && key.endsWith('Right')) {\n            const canKey = `can${key.slice(3, -5)}` as keyof CanFns<T>;\n            // eslint-disable-next-line @typescript-eslint/no-explicit-any\n            (result as any)[canKey] = (...args: unknown[]) =>\n                // eslint-disable-next-line @typescript-eslint/no-explicit-any\n                (fns as any)[key](...args) === ActionRight.Allowed;\n        }\n    }\n    return result;\n}\n\n/**\n * Composable to manage rights.\n * Based on AuthStore, but converts roles to easily usable tests for various\n * actions.\n */\nexport const useRights = () => {\n    const authStore = useAuthStore();\n\n    function roleContainsAny(...roles: Role[]): boolean {\n        return (authStore.authRole as Role[]).findIndex((r: Role) => roles.includes(r)) > -1;\n    }\n\n    function hasSufficientScope(elementRubriques: Array<number> = [], parentRubriques: Array<number> = []): boolean {\n        const ids = elementRubriques.concat(parentRubriques);\n        const scope = authStore.userScope;\n        if (scope.length === 0) {\n            return true;\n        }\n\n        for (const id of scope) {\n            if (ids.includes(id)) {\n                return true;\n            }\n        }\n\n        return false;\n    }\n\n    ////////////////////////////\n    // Emission rights\n    ////////////////////////////\n    function getCreateEmissionRight(): ActionRight {\n        return roleContainsAny('ADMIN', 'ORGANISATION', 'PRODUCTION', 'RESTRICTED_PRODUCTION')\n            ? ActionRight.Allowed\n            : ActionRight.DeniedNoRight;\n    }\n\n    function getEditEmissionRight(emission: Emission): ActionRight {\n        if (!hasSufficientScope(emission.rubriqueIds)) {\n            return ActionRight.DeniedInsufficientScope;\n        }\n        \n        if (\n            (!emission.emissionId && getCreateEmissionRight() === ActionRight.Allowed) ||\n            roleContainsAny('ADMIN', 'ORGANISATION', 'PRODUCTION')\n        ) {\n            return ActionRight.Allowed;\n        }\n\n        if (roleContainsAny('RESTRICTED_PRODUCTION')) {\n            return emission.createdByUserId === authStore.authProfile?.userId\n                ? ActionRight.Allowed\n                : ActionRight.DeniedNotOwner;\n        }\n        return ActionRight.DeniedNoRight;\n    }\n\n    function getDeleteEmissionRight(emission: Emission): ActionRight {\n        // In case of restricted production, it will only delete podcasts\n        // created by user, and delete the emission only if empty afterwards\n        if (roleContainsAny('ADMIN', 'ORGANISATION')) {\n            return ActionRight.Allowed;\n        } else if (roleContainsAny('PRODUCTION', 'RESTRICTED_PRODUCTION')) {\n            return hasSufficientScope(emission.rubriqueIds)\n                ? ActionRight.Allowed\n                : ActionRight.DeniedInsufficientScope;\n        } else {\n            return ActionRight.DeniedNoRight;\n        }\n    }\n\n    function getEditCommentsConfigEmissionRight(): ActionRight {\n        return roleContainsAny('ADMIN', 'ORGANISATION', 'PRODUCTION')\n            ? ActionRight.Allowed\n            : ActionRight.DeniedNoRight;\n    }\n\n    // Podcast rights\n    function getCreatePodcastRight(emission?: Emission): ActionRight {\n        if(roleContainsAny('ADMIN', 'ORGANISATION')) {\n            return ActionRight.Allowed;\n        } else if (roleContainsAny('PRODUCTION', 'PODCAST_CRUD', 'RESTRICTED_PRODUCTION', 'RESTRICTED_ANIMATION')) {\n            return !emission || hasSufficientScope(emission.rubriqueIds)\n                ? ActionRight.Allowed\n                : ActionRight.DeniedInsufficientScope;\n        } else {\n            return ActionRight.DeniedNoRight;\n        }\n    }\n\n    function getDuplicatePodcastRight(): ActionRight {\n        // Same as creation but notably without PODCAST_CRUD and RESTRICTED_ANIMATION\n        return roleContainsAny('ADMIN', 'ORGANISATION', 'PRODUCTION', 'RESTRICTED_PRODUCTION')\n            ? ActionRight.Allowed\n            : ActionRight.DeniedNoRight;\n    }\n\n    function getEditPodcastRight(podcast: Podcast): ActionRight {\n        if (!hasSufficientScope(podcast.rubriqueIds, podcast.emission.rubriqueIds)) {\n            return ActionRight.DeniedInsufficientScope;\n        }\n\n        if (roleContainsAny('ADMIN', 'ORGANISATION', 'PRODUCTION')) {\n            return ActionRight.Allowed;\n        }\n        if (roleContainsAny('RESTRICTED_PRODUCTION', 'RESTRICTED_ANIMATION')) {\n            return podcast.createdByUserId === authStore.authProfile?.userId\n                ? ActionRight.Allowed\n                : ActionRight.DeniedNotOwner;\n        }\n        if (roleContainsAny('PODCAST_CRUD')) {\n            return podcast.valid === false && podcast.publisher?.userId === authStore.authProfile?.userId\n                ? ActionRight.Allowed\n                : ActionRight.DeniedNotOwner;\n        }\n        return ActionRight.DeniedNoRight;\n    }\n\n    function getDeletePodcastRight(podcast: Podcast): ActionRight {\n        return getEditPodcastRight(podcast);\n    }\n\n    function getValidatePodcastRight(): ActionRight {\n        return roleContainsAny('ADMIN', 'ORGANISATION', 'PRODUCTION', 'PODCAST_VALIDATION')\n            ? ActionRight.Allowed\n            : ActionRight.DeniedNoRight;\n    }\n\n    function getEditCommentsConfigPodcastRight(): ActionRight {\n        return roleContainsAny('ADMIN', 'ORGANISATION', 'PRODUCTION')\n            ? ActionRight.Allowed\n            : ActionRight.DeniedNoRight;\n    }\n\n    ////////////////////////////\n    // Playlist rights\n    ////////////////////////////\n    function getCreatePlaylistRight(): ActionRight {\n        return roleContainsAny('ADMIN', 'ORGANISATION', 'PLAYLISTS')\n            ? ActionRight.Allowed\n            : ActionRight.DeniedNoRight;\n    }\n\n    function getEditPlaylistRight(): ActionRight {\n        return roleContainsAny('ADMIN', 'ORGANISATION', 'PLAYLISTS')\n            ? ActionRight.Allowed\n            : ActionRight.DeniedNoRight;\n    }\n\n    function getDeletePlaylistRight(): ActionRight {\n        return roleContainsAny('ADMIN', 'ORGANISATION', 'PLAYLISTS')\n            ? ActionRight.Allowed\n            : ActionRight.DeniedNoRight;\n    }\n\n    ////////////////////////////\n    // Participant rights\n    ////////////////////////////\n    function getCreateParticipantRight(): ActionRight {\n        return roleContainsAny('ADMIN', 'ORGANISATION', 'PRODUCTION', 'RESTRICTED_PRODUCTION')\n            ? ActionRight.Allowed\n            : ActionRight.DeniedNoRight;\n    }\n\n    async function getParticipantEditRight(participantId: number|undefined): Promise<ActionRight> {\n        // New participants can be edited, and also with sufficient rights\n        return (!participantId || roleContainsAny('ADMIN', 'ORGANISATION', 'PRODUCTION', 'RESTRICTED_PRODUCTION'))\n            ? ActionRight.Allowed\n            : ActionRight.DeniedNoRight;\n    }\n\n    async function canEditParticipant(participantId: number|undefined): Promise<boolean> {\n        return await getParticipantEditRight(participantId) === ActionRight.Allowed;\n    }\n\n    async function canDeleteParticipant(participantId: number|undefined): Promise<boolean> {\n        return await getParticipantEditRight(participantId) === ActionRight.Allowed;\n    }\n\n    ////////////////////////////\n    // Rubriques/rubriquage rights\n    ////////////////////////////\n    function getCreateRubriquesRight(): ActionRight {\n        return roleContainsAny('ADMIN', 'ORGANISATION', 'EDITION')\n            ? ActionRight.Allowed\n            : ActionRight.DeniedNoRight;\n    }\n\n    // eslint-disable-next-line @typescript-eslint/no-unused-vars\n    function getEditRubriquesRight(_element: Rubrique|Rubriquage): ActionRight {\n        return getCreateRubriquesRight();\n    }\n\n    ////////////////////////////\n    // Aggregator rights\n    ////////////////////////////\n    function getCreateAggregatorRight(): ActionRight {\n        return roleContainsAny('ADMIN', 'ORGANISATION')\n            ? ActionRight.Allowed\n            : ActionRight.DeniedNoRight;\n    }\n\n    function getEditAggregatorRight(): ActionRight {\n        return roleContainsAny('ADMIN', 'ORGANISATION')\n            ? ActionRight.Allowed\n            : ActionRight.DeniedNoRight;\n    }\n\n    function getDeleteAggregatorRight(): ActionRight {\n        return roleContainsAny('ADMIN', 'ORGANISATION')\n            ? ActionRight.Allowed\n            : ActionRight.DeniedNoRight;\n    }\n\n    ////////////////////////////\n    // Cartouchier rights\n    ////////////////////////////\n    function getCreateCartouchierRight(): ActionRight {\n        return roleContainsAny(\n            'ADMIN', 'ORGANISATION', 'PRODUCTION', 'RADIO', 'ANIMATION',\n            'PODCAST_CRUD', 'RESTRICTED_PRODUCTION', 'RESTRICTED_ANIMATION'\n        )\n            ? ActionRight.Allowed\n            : ActionRight.DeniedNoRight;\n    }\n\n    function getEditCartouchierRight(element: Cartouchier): ActionRight {\n        if (roleContainsAny('ADMIN', 'ORGANISATION', 'PRODUCTION', 'RADIO', 'ANIMATION')) {\n            return ActionRight.Allowed;\n        }\n        if (roleContainsAny('RESTRICTED_PRODUCTION', 'RESTRICTED_ANIMATION', 'PODCAST_CRUD')) {\n            return element.ownerId !== undefined && element.ownerId !== null && element.ownerId === authStore.authProfile?.userId\n                ? ActionRight.Allowed\n                : ActionRight.DeniedNotOwner;\n        }\n        return ActionRight.DeniedNoRight;\n    }\n\n    function getDeleteCartouchierRight(element: Cartouchier): ActionRight {\n        return getEditCartouchierRight(element);\n    }\n\n    ////////////////////////////\n    // PlaylistMedia rights\n    ////////////////////////////\n    function getCreatePlaylistMediaRight(): ActionRight {\n        return roleContainsAny(\n            'ADMIN', 'ORGANISATION', 'PRODUCTION', 'RADIO', 'ANIMATION',\n            'PODCAST_CRUD', 'RESTRICTED_PRODUCTION', 'RESTRICTED_ANIMATION'\n        )\n            ? ActionRight.Allowed\n            : ActionRight.DeniedNoRight;\n    }\n\n    function getEditPlaylistMediaRight(element: PlaylistMedia): ActionRight {\n        if (roleContainsAny('ADMIN', 'ORGANISATION', 'PRODUCTION', 'RADIO', 'ANIMATION')) {\n            return ActionRight.Allowed;\n        }\n        if (roleContainsAny('RESTRICTED_PRODUCTION', 'RESTRICTED_ANIMATION', 'PODCAST_CRUD')) {\n            return element.ownerId !== undefined && element.ownerId !== null && element.ownerId === authStore.authProfile?.userId\n                ? ActionRight.Allowed\n                : ActionRight.DeniedNotOwner;\n        }\n        return ActionRight.DeniedNoRight;\n    }\n\n    function getDeletePlaylistMediaRight(element: PlaylistMedia): ActionRight {\n        return getEditPlaylistMediaRight(element);\n    }\n\n    ////////////////////////////\n    // Media rights\n    ////////////////////////////\n    function getCreateMediaRight(): ActionRight {\n        return roleContainsAny(\n            'ADMIN', 'ORGANISATION', 'PRODUCTION', 'RADIO', 'ANIMATION',\n            'PODCAST_CRUD', 'RESTRICTED_PRODUCTION', 'RESTRICTED_ANIMATION'\n        )\n            ? ActionRight.Allowed\n            : ActionRight.DeniedNoRight;\n    }\n\n    function getEditMediaRight(element: Media): ActionRight {\n        if (roleContainsAny('ADMIN', 'ORGANISATION', 'PRODUCTION', 'RADIO', 'ANIMATION')) {\n            return ActionRight.Allowed;\n        }\n        if (roleContainsAny('RESTRICTED_PRODUCTION', 'RESTRICTED_ANIMATION', 'PODCAST_CRUD')) {\n            return element.ownerId !== undefined && element.ownerId !== null && element.ownerId === authStore.authProfile?.userId\n                ? ActionRight.Allowed\n                : ActionRight.DeniedNotOwner;\n        }\n        return ActionRight.DeniedNoRight;\n    }\n\n    function getDeleteMediaRight(element: Media): ActionRight {\n        return getEditMediaRight(element);\n    }\n\n    ////////////////////////////\n    // Mix rights\n    ////////////////////////////\n    function getCreateMixRight(): ActionRight {\n        return roleContainsAny('ADMIN', 'ORGANISATION', 'RADIO')\n            ? ActionRight.Allowed\n            : ActionRight.DeniedNoRight;\n    }\n\n    function getEditMixRight(_element: Mix): ActionRight {\n        return getCreateMixRight();\n    }\n\n    function getDeleteMixRight(element: Mix): ActionRight {\n        return getEditMixRight(element);\n    }\n\n    ////////////////////////////\n    // Transcript/translation rights\n    ////////////////////////////\n    function getEditTranscriptRight(podcast: Podcast): ActionRight {\n        if (!hasSufficientScope(podcast.rubriqueIds, podcast.emission.rubriqueIds)) {\n            return ActionRight.DeniedInsufficientScope;\n        }\n        if (roleContainsAny('ADMIN', 'ORGANISATION', 'PRODUCTION')) {\n            return ActionRight.Allowed;\n        }\n        if (roleContainsAny('RESTRICTED_PRODUCTION', 'PODCAST_CRUD')) {\n            return podcast.createdByUserId === authStore.authProfile?.userId\n                ? ActionRight.Allowed\n                : ActionRight.DeniedNotOwner;\n        }\n        return ActionRight.DeniedNoRight;\n    }\n\n    function getEditTranscriptVisibilityRight(podcast: Podcast): ActionRight {\n        if (!hasSufficientScope(podcast.rubriqueIds, podcast.emission.rubriqueIds)) {\n            return ActionRight.DeniedInsufficientScope;\n        }\n\n        return roleContainsAny('ADMIN', 'ORGANISATION', 'PRODUCTION')\n            ? ActionRight.Allowed\n            : ActionRight.DeniedNoRight;\n    }\n\n    function getEditTranslationRight(podcast: Podcast): ActionRight {\n        return getEditTranscriptRight(podcast);\n    }\n\n    ////////////////////////////\n    // Live\n    ////////////////////////////\n    function getAccessRecordingRight(conference: Conference, isLive: boolean): ActionRight {\n        if (isLive) {\n            return roleContainsAny('LIVE') ? ActionRight.Allowed : ActionRight.DeniedNoRight;\n        } else {\n            return roleContainsAny('ANIMATION', 'RESTRICTED_ANIMATION') ? ActionRight.Allowed : ActionRight.DeniedNoRight;\n        }\n    }\n\n    ////////////////////////////\n    // Other action rights\n    ////////////////////////////\n    function getEditCodeInsertPlayerRight(): ActionRight {\n        return roleContainsAny('ADMIN', 'ORGANISATION')\n            ? ActionRight.Allowed\n            : ActionRight.DeniedNoRight;\n    }\n\n    function getEditChapteringRight(podcast: Podcast): ActionRight {\n        return getEditPodcastRight(podcast);\n    }\n\n    function getCreatePromoVideoRight(podcast: Podcast): ActionRight {\n        if (!hasSufficientScope(podcast.rubriqueIds, podcast.emission.rubriqueIds)) {\n            return ActionRight.DeniedInsufficientScope;\n        } else if (roleContainsAny('ADMIN', 'ORGANISATION', 'PRODUCTION')) {\n            return ActionRight.Allowed;\n        } else {\n            return ActionRight.DeniedNoRight;\n        }\n    }\n\n    function getEditPromoVideoRight(podcast: Podcast): ActionRight {\n        return getCreatePromoVideoRight(podcast);\n    }\n\n    function getDeletePromoVideoRight(podcast: Podcast): ActionRight {\n        return getCreatePromoVideoRight(podcast);\n    }\n\n    // View/utility checks — outside the action pattern\n    function canSeeHistory(): boolean {\n        return roleContainsAny('ADMIN', 'ORGANISATION');\n    }\n\n    function isRestrictedProduction(): boolean {\n        return roleContainsAny('RESTRICTED_PRODUCTION') && !roleContainsAny('ADMIN', 'ORGANISATION', 'PRODUCTION');\n    }\n\n    const rightFns = {\n        // Emissions\n        getCreateEmissionRight,\n        getEditEmissionRight,\n        getDeleteEmissionRight,\n        getEditCommentsConfigEmissionRight,\n        // Podcasts\n        getCreatePodcastRight,\n        getDuplicatePodcastRight,\n        getEditPodcastRight,\n        getDeletePodcastRight,\n        getValidatePodcastRight,\n        getEditCommentsConfigPodcastRight,\n        // Playlists\n        getCreatePlaylistRight,\n        getEditPlaylistRight,\n        getDeletePlaylistRight,\n        // Participants (sync only)\n        getCreateParticipantRight,\n        // Rubriques/Rubriquages\n        getCreateRubriquesRight,\n        getEditRubriquesRight,\n        // Aggregators\n        getCreateAggregatorRight,\n        getEditAggregatorRight,\n        getDeleteAggregatorRight,\n        // Cartouchier\n        getCreateCartouchierRight,\n        getEditCartouchierRight,\n        getDeleteCartouchierRight,\n        // PlaylistMedia\n        getCreatePlaylistMediaRight,\n        getEditPlaylistMediaRight,\n        getDeletePlaylistMediaRight,\n        // Media\n        getCreateMediaRight,\n        getEditMediaRight,\n        getDeleteMediaRight,\n        // Mix\n        getCreateMixRight,\n        getEditMixRight,\n        getDeleteMixRight,\n        // Translation/transcription\n        getEditTranscriptRight,\n        getEditTranscriptVisibilityRight,\n        getEditTranslationRight,\n        // Other\n        getAccessRecordingRight,\n        getEditCodeInsertPlayerRight,\n        getEditChapteringRight,\n        getCreatePromoVideoRight,\n        getEditPromoVideoRight,\n        getDeletePromoVideoRight\n    };\n\n    const canFns = deriveCanFunctions(rightFns);\n\n    function canReadRSSRules(): boolean {\n        return roleContainsAny('ADMIN', 'ORGANISATION', 'PRODUCTION');\n    }\n\n    function canEditRSSRules(): boolean {\n        return canReadRSSRules();\n    }\n\n    return {\n        ...rightFns,\n        ...canFns,\n        // Async participant (kept manually — async functions excluded from deriveCanFunctions)\n        getParticipantEditRight,\n        canEditParticipant,\n        canDeleteParticipant,\n        // RSS Rules (manual — outside the getRightXxx convention)\n        canReadRSSRules,\n        canEditRSSRules,\n        // View/utility checks\n        canSeeHistory,\n        isRestrictedProduction,\n    };\n};\n"],"mappings":";;AAkBA,IAAY,cAAL,yBAAA,aAAA;;CAEH,YAAA,aAAA;;CAEA,YAAA,mBAAA;;CAEA,YAAA,oBAAA;;CAEA,YAAA,6BAAA;;AACJ,EAAA,CAAA,CAAA;;;;;;;;;;;;;;;AA8BA,SAAS,mBAA2C,KAAmB;CACnE,MAAM,SAAS,CAAC;CAChB,KAAK,MAAM,OAAO,OAAO,KAAK,GAAG,GAC7B,IAAI,IAAI,WAAW,KAAK,KAAK,IAAI,SAAS,OAAO,GAAG;EAChD,MAAM,SAAS,MAAM,IAAI,MAAM,GAAG,EAAE;EAEpC,OAAgB,WAAW,GAAG,SAEzB,IAAY,KAAK,GAAG,IAAI,MAAA;CACjC;CAEJ,OAAO;AACX;;;;;;AAOA,IAAa,kBAAkB;CAC3B,MAAM,YAAY,aAAa;CAE/B,SAAS,gBAAgB,GAAG,OAAwB;EAChD,OAAQ,UAAU,SAAoB,WAAW,MAAY,MAAM,SAAS,CAAC,CAAC,IAAI;CACtF;CAEA,SAAS,mBAAmB,mBAAkC,CAAC,GAAG,kBAAiC,CAAC,GAAY;EAC5G,MAAM,MAAM,iBAAiB,OAAO,eAAe;EACnD,MAAM,QAAQ,UAAU;EACxB,IAAI,MAAM,WAAW,GACjB,OAAO;EAGX,KAAK,MAAM,MAAM,OACb,IAAI,IAAI,SAAS,EAAE,GACf,OAAO;EAIf,OAAO;CACX;CAKA,SAAS,yBAAsC;EAC3C,OAAO,gBAAgB,SAAS,gBAAgB,cAAc,uBAAuB,IAAA,YAAA;CAGzF;CAEA,SAAS,qBAAqB,UAAiC;EAC3D,IAAI,CAAC,mBAAmB,SAAS,WAAW,GACxC,OAAA;EAGJ,IACK,CAAC,SAAS,cAAc,uBAAuB,M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