@closerepo/radar-contracts 4.3.0 → 6.0.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.
- package/dist/index.d.ts +15 -1
- package/dist/index.js +6 -6
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -5985,8 +5985,9 @@ declare const radarResetManagementOperationSchema: z.ZodEnum<{
|
|
|
5985
5985
|
restore_preview: "restore_preview";
|
|
5986
5986
|
set_auto_notification: "set_auto_notification";
|
|
5987
5987
|
notify: "notify";
|
|
5988
|
+
confirm: "confirm";
|
|
5988
5989
|
}>;
|
|
5989
|
-
/**
|
|
5990
|
+
/** Manual confirmation supplies execution time without rewriting the source post or claiming an official confirmation. */
|
|
5990
5991
|
declare const radarResetManualDraftSchema: z.ZodObject<{
|
|
5991
5992
|
resetActionId: z.ZodString;
|
|
5992
5993
|
operation: z.ZodEnum<{
|
|
@@ -5994,6 +5995,7 @@ declare const radarResetManualDraftSchema: z.ZodObject<{
|
|
|
5994
5995
|
restore_preview: "restore_preview";
|
|
5995
5996
|
set_auto_notification: "set_auto_notification";
|
|
5996
5997
|
notify: "notify";
|
|
5998
|
+
confirm: "confirm";
|
|
5997
5999
|
}>;
|
|
5998
6000
|
expectedRevision: z.ZodInt;
|
|
5999
6001
|
copy: z.ZodNullable<z.ZodObject<{
|
|
@@ -6007,6 +6009,7 @@ declare const radarResetManualDraftSchema: z.ZodObject<{
|
|
|
6007
6009
|
}, z.core.$strict>;
|
|
6008
6010
|
}, z.core.$strict>>;
|
|
6009
6011
|
automaticNotification: z.ZodNullable<z.ZodBoolean>;
|
|
6012
|
+
executedAt: z.ZodOptional<z.ZodNullable<z.ZodISODateTime>>;
|
|
6010
6013
|
}, z.core.$strict>;
|
|
6011
6014
|
declare const radarResetManualPreviewReqSchema: z.ZodObject<{
|
|
6012
6015
|
resetActionId: z.ZodString;
|
|
@@ -6015,6 +6018,7 @@ declare const radarResetManualPreviewReqSchema: z.ZodObject<{
|
|
|
6015
6018
|
restore_preview: "restore_preview";
|
|
6016
6019
|
set_auto_notification: "set_auto_notification";
|
|
6017
6020
|
notify: "notify";
|
|
6021
|
+
confirm: "confirm";
|
|
6018
6022
|
}>;
|
|
6019
6023
|
expectedRevision: z.ZodInt;
|
|
6020
6024
|
copy: z.ZodNullable<z.ZodObject<{
|
|
@@ -6028,6 +6032,7 @@ declare const radarResetManualPreviewReqSchema: z.ZodObject<{
|
|
|
6028
6032
|
}, z.core.$strict>;
|
|
6029
6033
|
}, z.core.$strict>>;
|
|
6030
6034
|
automaticNotification: z.ZodNullable<z.ZodBoolean>;
|
|
6035
|
+
executedAt: z.ZodOptional<z.ZodNullable<z.ZodISODateTime>>;
|
|
6031
6036
|
}, z.core.$strict>;
|
|
6032
6037
|
declare const radarResetManualDraftSeedSchema: z.ZodObject<{
|
|
6033
6038
|
resetActionId: z.ZodString;
|
|
@@ -6036,6 +6041,7 @@ declare const radarResetManualDraftSeedSchema: z.ZodObject<{
|
|
|
6036
6041
|
restore_preview: "restore_preview";
|
|
6037
6042
|
set_auto_notification: "set_auto_notification";
|
|
6038
6043
|
notify: "notify";
|
|
6044
|
+
confirm: "confirm";
|
|
6039
6045
|
}>;
|
|
6040
6046
|
expectedRevision: z.ZodInt;
|
|
6041
6047
|
copy: z.ZodNullable<z.ZodObject<{
|
|
@@ -6049,6 +6055,7 @@ declare const radarResetManualDraftSeedSchema: z.ZodObject<{
|
|
|
6049
6055
|
}, z.core.$strict>;
|
|
6050
6056
|
}, z.core.$strict>>;
|
|
6051
6057
|
automaticNotification: z.ZodNullable<z.ZodBoolean>;
|
|
6058
|
+
executedAt: z.ZodOptional<z.ZodNullable<z.ZodISODateTime>>;
|
|
6052
6059
|
}, z.core.$strict>;
|
|
6053
6060
|
declare const radarResetManualPreviewResSchema: z.ZodObject<{
|
|
6054
6061
|
digest: z.ZodString;
|
|
@@ -6060,6 +6067,7 @@ declare const radarResetManualPreviewResSchema: z.ZodObject<{
|
|
|
6060
6067
|
restore_preview: "restore_preview";
|
|
6061
6068
|
set_auto_notification: "set_auto_notification";
|
|
6062
6069
|
notify: "notify";
|
|
6070
|
+
confirm: "confirm";
|
|
6063
6071
|
}>;
|
|
6064
6072
|
expectedRevision: z.ZodInt;
|
|
6065
6073
|
copy: z.ZodNullable<z.ZodObject<{
|
|
@@ -6073,6 +6081,7 @@ declare const radarResetManualPreviewResSchema: z.ZodObject<{
|
|
|
6073
6081
|
}, z.core.$strict>;
|
|
6074
6082
|
}, z.core.$strict>>;
|
|
6075
6083
|
automaticNotification: z.ZodNullable<z.ZodBoolean>;
|
|
6084
|
+
executedAt: z.ZodOptional<z.ZodNullable<z.ZodISODateTime>>;
|
|
6076
6085
|
}, z.core.$strict>;
|
|
6077
6086
|
}, z.core.$strict>;
|
|
6078
6087
|
declare const radarResetManualApplyReqSchema: z.ZodObject<{
|
|
@@ -6087,6 +6096,7 @@ declare const radarResetManualApplyReqSchema: z.ZodObject<{
|
|
|
6087
6096
|
restore_preview: "restore_preview";
|
|
6088
6097
|
set_auto_notification: "set_auto_notification";
|
|
6089
6098
|
notify: "notify";
|
|
6099
|
+
confirm: "confirm";
|
|
6090
6100
|
}>;
|
|
6091
6101
|
expectedRevision: z.ZodInt;
|
|
6092
6102
|
copy: z.ZodNullable<z.ZodObject<{
|
|
@@ -6100,6 +6110,7 @@ declare const radarResetManualApplyReqSchema: z.ZodObject<{
|
|
|
6100
6110
|
}, z.core.$strict>;
|
|
6101
6111
|
}, z.core.$strict>>;
|
|
6102
6112
|
automaticNotification: z.ZodNullable<z.ZodBoolean>;
|
|
6113
|
+
executedAt: z.ZodOptional<z.ZodNullable<z.ZodISODateTime>>;
|
|
6103
6114
|
}, z.core.$strict>;
|
|
6104
6115
|
}, z.core.$strict>;
|
|
6105
6116
|
}, z.core.$strict>;
|
|
@@ -6123,6 +6134,7 @@ declare const radarResetManagementActionSchema: z.ZodObject<{
|
|
|
6123
6134
|
restore_preview: "restore_preview";
|
|
6124
6135
|
set_auto_notification: "set_auto_notification";
|
|
6125
6136
|
notify: "notify";
|
|
6137
|
+
confirm: "confirm";
|
|
6126
6138
|
}>>;
|
|
6127
6139
|
notificationOperationId: z.ZodNullable<z.ZodUUID>;
|
|
6128
6140
|
}, z.core.$strict>;
|
|
@@ -6147,6 +6159,7 @@ declare const radarResetManagementResSchema: z.ZodObject<{
|
|
|
6147
6159
|
restore_preview: "restore_preview";
|
|
6148
6160
|
set_auto_notification: "set_auto_notification";
|
|
6149
6161
|
notify: "notify";
|
|
6162
|
+
confirm: "confirm";
|
|
6150
6163
|
}>>;
|
|
6151
6164
|
notificationOperationId: z.ZodNullable<z.ZodUUID>;
|
|
6152
6165
|
}, z.core.$strict>>;
|
|
@@ -6163,6 +6176,7 @@ declare const radarResetManualResultResSchema: z.ZodDiscriminatedUnion<[z.ZodObj
|
|
|
6163
6176
|
restore_preview: "restore_preview";
|
|
6164
6177
|
set_auto_notification: "set_auto_notification";
|
|
6165
6178
|
notify: "notify";
|
|
6179
|
+
confirm: "confirm";
|
|
6166
6180
|
}>;
|
|
6167
6181
|
revision: z.ZodNumber;
|
|
6168
6182
|
notification: z.ZodObject<{
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import{z as e}from"zod";function t(e,t,n){let r=(e,t)=>{try{return n(e,t)}catch{return}};e.noticeCount!==e.noticeTimeline.length&&t.addIssue({code:`custom`,message:`action_notice_count_mismatch`,path:[`noticeCount`]});for(let[n,i]of e.noticeTimeline.entries())if(n===0){let n=r(i.authoredAt,e.firstAnnouncedAt);n!==void 0&&n!==0&&t.addIssue({code:`custom`,message:`notice_timeline_first_announcement_mismatch`,path:[`noticeTimeline`,0,`authoredAt`]})}else{let a=r(e.noticeTimeline.at(n-1).authoredAt,i.authoredAt);a!==void 0&&a>0&&t.addIssue({code:`custom`,message:`notice_timeline_not_ascending`,path:[`noticeTimeline`,n,`authoredAt`]})}}const n=1,r=4,i=Object.freeze({exportUtf8Bytes:2*1024*1024,analysis:Object.freeze({actions:512,intervals:511}),actionDetail:Object.freeze({noticeTimeline:64,reasons:128}),text:Object.freeze({publicTextCodePoints:500,evidenceExcerptCodePoints:500,urlCodePoints:2048})}),a=[`all`,`hard_reset`,`banked_reset`],o=[`hard_reset`,`banked_reset`],s=[`codex`,`chatgpt_work`],c=[`all_users`,`paid_users`,`named_plans`,`affected_subset`],l=[`plus`,`pro`],u=[`incident_compensation`,`user_milestone`,`celebration`],d=[`explicit_in_reset_post`,`explicit_in_related_source`,`contextual_inference`,`unknown`],f=[`weekday`,`weekday_group`,`hour`,`six_hour_block`,`month`,`day_of_month`,`week_of_month`,`weekday_hour`,`minute_of_hour`,`five_minute_bucket`,`half_hour_slot`,`time_of_day_minute`],ee=[`month`,`weekday`,`hour`,`six_hour_block`],p=e.number().finite(),m=p.min(0),h=e.number().int().min(0),g=e.number().int().positive(),_=p.min(0).max(1),v=e.iso.datetime({offset:!0}).refine(e=>e.endsWith(`Z`),{message:`utc_timestamp_required`}).refine(e=>/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?Z$/.test(e),{message:`utc_timestamp_seconds_required`}),y=e.string().min(1).max(128).refine(e=>e===e.trim()&&!/[\p{Cc}\p{Cf}]/u.test(e),{message:`public_id_invalid`}),b=e.enum(a),te=e.enum(u),ne=e.enum(d),re=e.object({contractVersion:e.literal(1),eventId:y,eventType:e.literal(`reset_analysis_snapshot_available`),analysisSnapshotId:y,sourceWatermark:y,occurredAt:v}).strict();function ie(e){return re.parse(e)}function ae(e){return[...e].length}function oe(e){return new TextEncoder().encode(JSON.stringify(e)).byteLength}const se=e.string().refine(e=>ae(e)<=i.text.evidenceExcerptCodePoints,{message:`evidence_excerpt_too_long`}),ce=e.string().refine(e=>e.trim().length>0,{message:`source_text_empty`}),le=e.string().refine(e=>ae(e)<=i.text.publicTextCodePoints,{message:`public_text_too_long`}),ue=e.string().refine(e=>e.trim().length>0,{message:`source_account_display_name_blank`}).refine(e=>ae(e)<=i.text.publicTextCodePoints,{message:`source_account_display_name_too_long`}),de=e.string().refine(e=>ae(e)<=i.text.urlCodePoints,{message:`source_url_too_long`}).refine(e=>{if([...e].some(e=>{let t=e.codePointAt(0);return t===void 0||t<=31||t===127}))return!1;try{let t=new URL(e);return t.protocol===`https:`&&t.username.length===0&&t.password.length===0}catch{return!1}},{message:`https_url_required`});function x(e){return new Set(e).size===e.length}const fe=e.discriminatedUnion(`state`,[e.object({state:e.literal(`known`),values:e.array(e.enum(o)).min(1).refine(x,{message:`reset_effects_must_be_unique`})}).strict(),e.object({state:e.literal(`unknown`),values:e.tuple([])}).strict()]),pe=e.object({products:e.array(e.enum(s)).refine(x,{message:`products_must_be_unique`}),audienceClaims:e.array(e.object({audience:e.enum(c),plans:e.array(e.enum(l)).refine(x,{message:`plans_must_be_unique`}),subsetSummary:le.nullable()}).strict())}).strict(),me=e.object({resetActionId:y,firstAnnouncedAt:v,effectiveAt:v.nullable(),resetEffects:fe,actionScope:pe,reasonCategories:e.array(te).refine(x,{message:`reason_categories_must_be_unique`}),noticeCount:g,previousAllActionDays:m.nullable(),previousHardResetActionDays:m.nullable(),previousBankedResetActionDays:m.nullable()}).strict(),he=e.object({series:b,previousActionId:y,actionId:y,fromFirstAnnouncedAt:v,toFirstAnnouncedAt:v,days:m}).strict(),ge=e.object({count:g,min:m,max:m,mean:m,median:m,percentile25:m,percentile75:m,percentile90:m,standardDeviation:m,coefficientOfVariation:m.nullable(),interquartileRange:m}).strict(),_e=e.object({lower:m,upper:m}).strict(),ve=e.object({iterations:g,seed:e.number().int(),mean95:_e,median95:_e}).strict(),ye=e.object({bucket:e.string().min(1),lowerInclusive:m,upperExclusive:m.nullable(),count:h,share:_}).strict(),be=e.object({endingIndex:h,windowSize:g,mean:m,median:m}).strict(),xe=e.object({firstHalf:ge.nullable(),secondHalf:ge.nullable(),meanChangeDays:p.nullable(),meanChangePercent:p.nullable()}).strict(),Se=e.object({series:b,actionCount:h,completedIntervalCount:h,intervalSummary:ge.nullable(),bootstrap95:ve.nullable(),intervalHistogram:e.array(ye),shortestIntervals:e.array(he),longestIntervals:e.array(he),rolling3:e.array(be),rolling5:e.array(be),linearSlopeDaysPerInterval:p.nullable(),halfComparison:xe,survivalCurve:e.array(e.object({elapsedDays:m,survivalProbability:_}).strict())}).strict(),Ce=e.object({series:b,elapsedDays:m,horizonDays:m,sampleAtRisk:h,eventsWithinWindow:h,probability:_.nullable()}).strict(),we=e.object({key:e.string(),count:h,share:_,timeZone:e.string().min(1),series:b,dimension:e.enum(f)}).strict(),Te=e.object({timeZone:e.string().min(1),series:b,dimension:e.enum(f),categoryCount:g,nonZeroCategoryCount:h,maxShare:_,herfindahlIndex:_,normalizedEntropy:_}).strict(),Ee=e.object({startMinute:e.number().int().min(0).max(1439),endMinute:e.number().int().min(0).max(1439),wrapsMidnight:e.boolean(),eventCount:h,share:_}).strict(),De=e.object({timeZone:e.string().min(1),series:b,eventCount:g,slotMinutes:g,fixedWindows:e.array(e.object({durationMinutes:g,bestWindows:e.array(Ee)}).strict()),coverageWindows:e.array(e.object({targetShare:_,requiredEventCount:g,durationMinutes:g,bestWindows:e.array(Ee)}).strict())}).strict(),Oe=e.object({series:b,thresholdDays:m,clusterCount:h,multiEventClusterCount:h,largestClusterSize:h,eventsInMultiEventClusters:h,eventShareInMultiEventClusters:_}).strict(),ke=e.object({category:te,actionCount:h,actionShare:_,hardResetActionCount:h,bankedResetActionCount:h,explicitInResetPostCount:h,explicitInRelatedSourceCount:h,contextualInferenceCount:h,unknownCount:h}).strict(),Ae=e.object({category:te,series:b,timeZone:e.string().min(1),dimension:e.enum(ee),key:e.string(),eventCount:h,reasonEventCount:h,binEventCount:h,seriesEventCount:h,shareWithinReason:_.nullable(),shareWithinBin:_.nullable(),shareOfSeries:_.nullable()}).strict(),je=e.object({overview:e.object({actionCount:g,hardResetActionCount:h,bankedResetActionCount:h,firstAnnouncedAt:v,lastAnnouncedAt:v,coverageDays:m,sourceNoticeCount:g}).strict(),actions:e.array(me).min(1).max(i.analysis.actions),intervals:e.array(he).max(i.analysis.intervals),series:e.object({all:Se,hard_reset:Se,banked_reset:Se}).strict(),historicalConditionalFrequencies:e.array(Ce),calendars:e.array(we),calendarConcentrations:e.array(Te),intradayRanges:e.array(De),clusters:e.array(Oe),reasons:e.object({summary:e.array(ke),crossTabs:e.array(Ae)}).strict(),caveats:e.array(le.min(1))}).strict(),Me=e.object({contractVersion:e.literal(1),analyzerContractVersion:e.literal(4),generatedAt:v,analysisWindow:e.object({startAt:v,startInclusive:e.boolean(),timeBasis:e.literal(`first_announcement`),throughFirstAnnouncedAt:v}).strict(),result:je}).strict().superRefine((e,t)=>{let n=e.result.actions,r=e.result.overview;n.length!==r.actionCount&&t.addIssue({code:`custom`,message:`analysis_action_count_mismatch`,path:[`result`,`actions`]});let i=new Set;for(let e=0;e<n.length;e+=1){let r=n[e];i.has(r.resetActionId)&&t.addIssue({code:`custom`,message:`analysis_action_identity_duplicate`,path:[`result`,`actions`,e,`resetActionId`]}),i.add(r.resetActionId);let a=n[e-1];a!==void 0&&(a.firstAnnouncedAt>r.firstAnnouncedAt||a.firstAnnouncedAt===r.firstAnnouncedAt&&a.resetActionId>r.resetActionId)&&t.addIssue({code:`custom`,message:`analysis_actions_not_stably_sorted`,path:[`result`,`actions`,e]})}let o=(e,r,i)=>{i!==void 0&&e.series!==i&&t.addIssue({code:`custom`,message:`analysis_interval_series_mismatch`,path:[...r,`series`]});let a=i??e.series,o=a===`all`?n:n.filter(e=>e.resetEffects.state===`known`&&e.resetEffects.values.includes(a)),s=o.findIndex(t=>t.resetActionId===e.actionId),c=o[s];if(c===void 0){t.addIssue({code:`custom`,message:`analysis_interval_action_mismatch`,path:[...r,`actionId`]});return}let l=o[s-1];(l===void 0||e.previousActionId!==l.resetActionId)&&t.addIssue({code:`custom`,message:`analysis_interval_previous_action_mismatch`,path:[...r,`previousActionId`]}),l!==void 0&&e.fromFirstAnnouncedAt!==l.firstAnnouncedAt&&t.addIssue({code:`custom`,message:`analysis_interval_from_first_announcement_mismatch`,path:[...r,`fromFirstAnnouncedAt`]}),e.toFirstAnnouncedAt!==c.firstAnnouncedAt&&t.addIssue({code:`custom`,message:`analysis_interval_to_first_announcement_mismatch`,path:[...r,`toFirstAnnouncedAt`]})};e.result.intervals.forEach((e,t)=>o(e,[`result`,`intervals`,t]));for(let t of a){let n=e.result.series[t];for(let e of[`shortestIntervals`,`longestIntervals`])n[e].forEach((n,r)=>o(n,[`result`,`series`,t,e,r],t))}n[0]?.firstAnnouncedAt!==r.firstAnnouncedAt&&t.addIssue({code:`custom`,message:`analysis_first_action_mismatch`,path:[`result`,`overview`,`firstAnnouncedAt`]}),(n.at(-1)?.firstAnnouncedAt!==r.lastAnnouncedAt||e.analysisWindow.throughFirstAnnouncedAt!==r.lastAnnouncedAt)&&t.addIssue({code:`custom`,message:`analysis_last_action_mismatch`,path:[`result`,`overview`,`lastAnnouncedAt`]});for(let[n,r]of Object.entries({all:`all`,hard_reset:`hard_reset`,banked_reset:`banked_reset`}))e.result.series[n].series!==r&&t.addIssue({code:`custom`,message:`analysis_series_identity_mismatch`,path:[`result`,`series`,n,`series`]})}),Ne=e.object({excerpt:se,sourceUrl:de}).strict();function Pe(e,t){try{return He(e,t)}catch{return}}function Fe(e,t){try{return w(e,t)}catch{return}}const S=e.object({contractVersion:e.literal(1),resetActionId:y,firstAnnouncedAt:v,effectiveAt:v.nullable(),resetEffects:fe,actionScope:pe,noticeCount:g,reasons:e.array(e.object({category:te,summary:le.min(1),basis:ne,evidence:e.array(Ne).min(1)}).strict()).max(i.actionDetail.reasons),noticeTimeline:e.array(e.object({phase:e.enum([`preview`,`executed`]),authoredAt:v,contentCompleteness:e.enum([`verified_full_text`,`verified_excerpt`]),sourceText:ce,sourceTextZh:ce.nullable(),sourceUrl:de,sourceAccount:e.object({displayName:ue}).strict()}).strict()).min(1).max(i.actionDetail.noticeTimeline)}).strict().superRefine((e,n)=>t(e,n,w)),Ie=[`preview`,`executed`,`schedule_change`,`scope_change`,`cancel_preview`,`delivery_issue`,`make_up`,`repair`,`update`],Le=e.object({resolution:e.enum([`resolved`,`unbounded`,`unresolved`]),evidence:e.string().trim().min(1).max(300).nullable(),precision:e.enum([`exact`,`approximate`,`range`]).nullable(),relation:e.enum([`instant`,`interval`,`deadline`,`not_before`,`unbounded`]).nullable(),effectiveWindow:e.object({earliestAt:e.iso.datetime(),latestAt:e.iso.datetime()}).strict().refine(e=>Date.parse(e.earliestAt)<=Date.parse(e.latestAt),{message:`publication_timing_window_inverted`}).nullable()}).strict().superRefine((e,t)=>{let n=e=>t.addIssue({code:`custom`,message:e});e.resolution===`resolved`!=(e.effectiveWindow!==null)&&n(`publication_timing_resolution_window_mismatch`),e.resolution===`unbounded`&&e.relation!==`unbounded`&&n(`publication_timing_unbounded_relation_required`);let r=e.effectiveWindow;e.resolution===`resolved`&&((e.relation===null||e.relation===`unbounded`)&&n(`publication_timing_bounded_relation_required`),r!==null&&e.relation===`interval`==(r.earliestAt===r.latestAt)&&n(`publication_timing_relation_window_mismatch`))}),C=e.object({resetActionId:y,state:e.enum([`preview`,`executed`]),resetEffects:fe,executedEffects:e.array(e.enum(o)).refine(x),pendingEffects:e.array(e.enum(o)).refine(x),plannedTiming:Le.nullable(),noticeTimeline:e.array(S.shape.noticeTimeline.element.omit({phase:!0}).extend({kinds:e.array(e.enum(Ie)).min(1).refine(x)}).strict()).min(1).max(i.actionDetail.noticeTimeline)}).strict().superRefine((e,t)=>{e.state===`preview`&&e.executedEffects.length>0&&t.addIssue({code:`custom`,message:`pending_preview_has_executed_effects`}),e.state===`executed`&&e.pendingEffects.length===0&&t.addIssue({code:`custom`,message:`pending_executed_action_has_no_pending_effects`});for(let n of[...e.executedEffects,...e.pendingEffects])new Set(e.resetEffects.values).has(n)||t.addIssue({code:`custom`,message:`pending_effect_not_declared`});e.executedEffects.some(t=>e.pendingEffects.includes(t))&&t.addIssue({code:`custom`,message:`pending_effect_already_executed`});for(let n=1;n<e.noticeTimeline.length;n+=1){let r=e.noticeTimeline[n-1],i=e.noticeTimeline[n],a=Fe(r.authoredAt,i.authoredAt);a!==void 0&&a>0&&t.addIssue({code:`custom`,message:`pending_notice_timeline_not_ascending`,path:[`noticeTimeline`,n]})}}),Re=e.object({contractVersion:e.literal(1),generatedAt:v,analysis:Me,actions:e.array(S).min(1).max(i.analysis.actions),pendingResetActions:e.array(C).max(i.analysis.actions)}).strict();function ze(e,t){oe(e)>i.exportUtf8Bytes&&t.addIssue({code:`custom`,message:`export_utf8_size_limit_exceeded`,path:[]});let n=Fe(e.generatedAt,e.analysis.generatedAt);n!==void 0&&n<0&&t.addIssue({code:`custom`,message:`export_generated_at_before_analysis`,path:[`generatedAt`]})}function Be(e,t,n,r){(e.resetActionId!==t.resetActionId||e.firstAnnouncedAt!==t.firstAnnouncedAt||e.effectiveAt!==t.effectiveAt||e.noticeCount!==t.noticeCount||JSON.stringify(e.resetEffects)!==JSON.stringify(t.resetEffects)||JSON.stringify(e.actionScope)!==JSON.stringify(t.actionScope))&&r.addIssue({code:`custom`,message:`export_action_summary_mismatch`,path:[`actions`,n]});let i=[...new Set(e.reasons.map(e=>e.category))].sort();JSON.stringify(i)!==JSON.stringify([...t.reasonCategories].sort())&&r.addIssue({code:`custom`,message:`export_action_reason_categories_mismatch`,path:[`actions`,n,`reasons`]})}const Ve=Re.superRefine((e,t)=>{ze(e,t),x(e.pendingResetActions.map(e=>e.resetActionId))||t.addIssue({code:`custom`,message:`export_pending_action_identity_duplicate`,path:[`pendingResetActions`]});let n=new Map,r=new Set(e.analysis.result.actions.map(e=>e.resetActionId));for(let i=0;i<e.actions.length;i+=1){let a=e.actions[i];n.has(a.resetActionId)?t.addIssue({code:`custom`,message:`export_action_identity_duplicate`,path:[`actions`,i,`resetActionId`]}):n.set(a.resetActionId,i);let o=e.actions[i-1],s=o===void 0?void 0:Pe(o,a);s!==void 0&&s>0&&t.addIssue({code:`custom`,message:`export_actions_not_stably_sorted`,path:[`actions`,i]});let c=Fe(a.firstAnnouncedAt,e.analysis.analysisWindow.throughFirstAnnouncedAt);c!==void 0&&c>0&&t.addIssue({code:`custom`,message:`export_action_after_analysis_snapshot`,path:[`actions`,i,`firstAnnouncedAt`]});let l=Fe(a.firstAnnouncedAt,e.analysis.analysisWindow.startAt);l!==void 0&&(e.analysis.analysisWindow.startInclusive?l>=0:l>0)&&!r.has(a.resetActionId)&&t.addIssue({code:`custom`,message:`export_window_action_not_in_analysis`,path:[`actions`,i,`resetActionId`]})}for(let r of e.analysis.result.actions){let i=n.get(r.resetActionId);if(i===void 0){t.addIssue({code:`custom`,message:`export_analysis_action_missing`,path:[`actions`]});continue}Be(e.actions[i],r,i,t)}});function w(e,t){let n=/^(\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2})(?:\.(\d+))?Z$/,r=n.exec(e),i=n.exec(t);if(r===null||i===null)throw Error(`radar_reset_v1_timestamp_invalid`);let a=r[1],o=i[1];if(a<o)return-1;if(a>o)return 1;let s=r[2]??``,c=i[2]??``,l=Math.max(s.length,c.length);for(let e=0;e<l;e+=1){let t=s.charCodeAt(e)||48,n=c.charCodeAt(e)||48;if(t<n)return-1;if(t>n)return 1}return 0}function He(e,t){let n=w(e.firstAnnouncedAt,t.firstAnnouncedAt);return n===0?e.resetActionId<t.resetActionId?-1:+(e.resetActionId>t.resetActionId):n}function Ue(e){return Me.parse(e)}function We(e){return S.parse(e)}function Ge(e){return Ve.parse(e)}function Ke(e){return C.parse(e)}function qe(e){let t;try{t=We(e)}catch(e){throw Error(`radar_reset_primary_source_action_invalid`,{cause:e})}let n=t.noticeTimeline[0];if(n===void 0)throw Error(`radar_reset_primary_source_notice_missing`);return Object.freeze({displayName:n.sourceAccount.displayName,sourceUrl:n.sourceUrl,excerpt:[...n.sourceText.trim()].slice(0,i.text.publicTextCodePoints).join(``)})}const Je=2,Ye=30,Xe=256,Ze=512*1024,Qe=256,$e=256*1024,et=32,tt=2*1024*1024,nt=9223372036854775807n,rt=e.string().regex(/^(?:0|[1-9][0-9]{0,18})$/,`uint64_decimal_noncanonical`).refine(e=>BigInt(e)<=nt,`uint64_decimal_out_of_range`),T=e.string().regex(/^[1-9][0-9]{0,18}$/,`positive_decimal_noncanonical`).refine(e=>BigInt(e)<=nt,`positive_decimal_out_of_range`);function it(e){return rt.parse(e)}function at(e){return T.parse(e)}function ot(e){return BigInt(it(e))}function st(e){if(e<0n||e>nt)throw RangeError(`uint64_decimal_out_of_range`);return e.toString()}function ct(e){if(e<1n||e>nt)throw RangeError(`positive_decimal_out_of_range`);return e.toString()}const E=e.iso.datetime({offset:!0}).refine(e=>e.endsWith(`Z`),`utc_timestamp_required`).refine(e=>/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?Z$/.test(e),`utc_timestamp_seconds_required`),D=e.string().min(1).max(128).refine(e=>e===e.trim()&&!/[\p{Cc}\p{Cf}]/u.test(e),`public_id_invalid`),O=e.string().regex(/^sha256:[0-9a-f]{64}$/,`sha256_noncanonical`);function lt(e){return new Set(e).size===e.length}const ut=t=>e.array(t).refine(lt,`array_values_must_be_unique`),dt=t=>e.string().refine(e=>[...e].length<=t,`string_exceeds_${t}_code_points`),ft=e.number().finite().min(0),pt=e.number().int().min(0).max(2**53-1),mt=e.number().int().positive().max(2**53-1),ht=e.enum([`hard_reset`,`banked_reset`]),gt=e.enum([`codex`,`chatgpt_work`]),_t=e.enum([`all_users`,`paid_users`,`named_plans`,`affected_subset`]),vt=e.enum([`plus`,`pro`]),yt=e.enum([`incident_compensation`,`user_milestone`,`celebration`]),bt=e.object({resetActionId:D,firstAnnouncedAt:E,effectiveAt:E.nullable(),resetEffects:e.union([e.object({state:e.literal(`known`),values:ut(ht).nonempty()}).strict(),e.object({state:e.literal(`unknown`),values:e.tuple([])}).strict()]),actionScope:e.object({products:ut(gt),audienceClaims:e.array(e.object({audience:_t,plans:ut(vt),subsetSummary:dt(500).nullable()}).strict())}).strict(),reasonCategories:ut(yt),noticeCount:mt,previousAllActionDays:ft.nullable(),previousHardResetActionDays:ft.nullable(),previousBankedResetActionDays:ft.nullable()}).strict();function xt(e){return bt.parse(e)}const St=e.object({generatedAt:E,availableRange:e.object({firstAnnouncedAt:E,lastAnnouncedAt:E}).strict().nullable(),current:e.object({summary:bt,status:e.object({phase:e.enum([`preview`,`executed`]),statusAt:E}).strict()}).strict().nullable()}).strict().superRefine((e,t)=>{if(e.availableRange===null!=(e.current===null)){t.addIssue({code:`custom`,message:`home_empty_state_inconsistent`});return}e.availableRange!==null&&e.current!==null&&e.current.summary.firstAnnouncedAt!==e.availableRange.lastAnnouncedAt&&t.addIssue({code:`custom`,message:`home_current_range_inconsistent`})});function Ct(e){return St.parse(e)}const wt=e.object({ordinal:pt,sha256:O,byteSize:mt}).strict(),Tt=e.object({sha256:O,byteSize:mt,chunkCount:mt,chunks:e.array(wt).min(1)}).strict().superRefine((e,t)=>{e.chunkCount!==e.chunks.length&&t.addIssue({code:`custom`,message:`chunk_count_mismatch`});let n=0;for(let[r,i]of e.chunks.entries())i.ordinal!==r&&t.addIssue({code:`custom`,message:`chunk_ordinal_invalid`}),n+=i.byteSize;n!==e.byteSize&&t.addIssue({code:`custom`,message:`detail_byte_size_mismatch`})}),Et=e.object({lifecycleState:e.literal(`active`),actionOrdinal:T,summary:bt,detailManifest:Tt}).strict(),Dt=e.object({lifecycleState:e.literal(`withdrawn`),actionOrdinal:T,resetActionId:D,lastActiveFirstAnnouncedAt:E}).strict(),Ot=e.discriminatedUnion(`lifecycleState`,[Et,Dt]),kt=e.object({contractVersion:e.literal(2)}).strict(),At=e.object({contractVersion:e.literal(2),revision:D,cursor:T.nullable()}).strict(),jt=e.object({contractVersion:e.literal(2),revision:D,afterSequence:rt}).strict(),Mt=e.object({resetActionId:D,ordinal:pt,sha256:O,byteSize:mt}).strict(),Nt=e.object({contractVersion:e.literal(2),revision:D,chunks:e.array(Mt).min(1).max(32)}).strict().superRefine((e,t)=>{e.chunks.reduce((e,t)=>e+t.byteSize,0)>2097152&&t.addIssue({code:`custom`,message:`detail_batch_too_large`}),lt(e.chunks.map(e=>`${e.resetActionId}\u0000${e.ordinal}`))||t.addIssue({code:`custom`,message:`detail_chunk_duplicate`})}),Pt=e.object({lifecycleState:e.enum([`active`,`withdrawn`]),firstAnnouncedAt:E.nullable(),contentSha256:O.nullable()}).strict().superRefine((e,t)=>{e.lifecycleState===`active`&&(e.firstAnnouncedAt===null||e.contentSha256===null)&&t.addIssue({code:`custom`,message:`active_change_state_incomplete`})}),Ft=e.object({sourceChangeSequence:T,introducedByRevision:D,resetActionId:D,kind:e.enum([`create`,`upsert`,`withdraw`]),activationKind:e.enum([`initial`,`restored`]).nullable(),activationOrdinal:T.nullable(),before:Pt.nullable(),after:Pt.nullable()}).strict().superRefine((e,t)=>{e.activationKind===null!=(e.activationOrdinal===null)&&t.addIssue({code:`custom`,message:`activation_pair_invalid`}),e.kind===`create`&&(e.activationKind!==`initial`||e.before!==null||e.after?.lifecycleState!==`active`)&&t.addIssue({code:`custom`,message:`create_change_invalid`}),e.kind===`withdraw`&&(e.activationKind!==null||e.before?.lifecycleState!==`active`||e.after?.lifecycleState!==`withdrawn`)&&t.addIssue({code:`custom`,message:`withdraw_change_invalid`}),e.kind===`upsert`&&e.activationKind===`initial`&&t.addIssue({code:`custom`,message:`upsert_activation_invalid`})}),It=e.object({minSequence:e.literal(`1`),maxSequence:T}).strict(),Lt=e.object({revision:D,projectionFingerprint:O,actionCount:pt,activeActionCount:pt,changeCoverage:It.nullable(),home:St}).strict().superRefine((e,t)=>{e.activeActionCount>e.actionCount&&t.addIssue({code:`custom`,message:`active_action_count_invalid`}),e.activeActionCount===0!=(e.home.availableRange===null)&&t.addIssue({code:`custom`,message:`head_home_count_inconsistent`})}),Rt=e.object({revision:D,items:e.array(Ot).max(256),nextCursor:T.nullable()}).strict().superRefine((e,t)=>{for(let n=1;n<e.items.length;n+=1){let r=e.items.at(n-1),i=e.items.at(n);if(r!==void 0&&i!==void 0&&BigInt(r.actionOrdinal)>=BigInt(i.actionOrdinal)){t.addIssue({code:`custom`,message:`action_ordinal_order_invalid`});break}}let n=e.items.at(-1);e.nextCursor!==null&&n?.actionOrdinal!==e.nextCursor&&t.addIssue({code:`custom`,message:`action_cursor_invalid`})}),zt=e.object({revision:D,coverage:It.nullable(),items:e.array(Ft).max(256),nextAfterSequence:T.nullable()}).strict().superRefine((e,t)=>{for(let n=1;n<e.items.length;n+=1){let r=e.items.at(n-1),i=e.items.at(n);if(r!==void 0&&i!==void 0&&BigInt(r.sourceChangeSequence)+1n!==BigInt(i.sourceChangeSequence)){t.addIssue({code:`custom`,message:`change_sequence_gap`});break}}let n=e.items.at(-1);e.nextAfterSequence!==null&&n?.sourceChangeSequence!==e.nextAfterSequence&&t.addIssue({code:`custom`,message:`change_cursor_invalid`})}),Bt=t=>e.object({contractVersion:e.literal(2),ok:e.literal(!0),data:t}).strict(),Vt=Bt(Lt),Ht=Bt(Rt),Ut=Bt(zt),Wt=[`source_invalid_request`,`source_revision_unknown`,`source_cursor_invalid`,`source_chunk_mismatch`,`source_response_over_capacity`,`source_integrity_conflict`,`source_revision_identity_conflict`,`source_sequence_exhausted`,`source_temporarily_unavailable`,`source_rpc_transport_failure`,`source_stream_incomplete`];function Gt(e,t=0,n=new Set){if(t>4)return!1;if(e===null||typeof e==`boolean`)return!0;if(typeof e==`string`)return[...e].length<=1024;if(typeof e==`number`)return Number.isFinite(e);if(typeof e!=`object`||n.has(e))return!1;if(n.add(e),Array.isArray(e))return e.length>16?!1:e.every(e=>Gt(e,t+1,n));let r=Object.entries(e);return r.length>16?!1:r.every(([,e])=>Gt(e,t+1,n))}const Kt=e.record(e.string(),e.unknown()).refine(e=>Gt(e),`safe_cause_invalid`).refine(e=>new TextEncoder().encode(JSON.stringify(e)).byteLength<=8192,`safe_cause_too_large`),qt=e.object({code:e.enum(Wt),operation:D,stage:D,revision:D.optional(),retryable:e.boolean(),correlationId:D,cause:Kt}).strict(),Jt=e.object({contractVersion:e.literal(2),ok:e.literal(!1),error:qt}).strict(),Yt=e.object({contractVersion:e.literal(2),eventType:e.literal(`reset_publication_revision_available`),eventId:e.string().regex(/^reset_pub_v2_[0-9a-f]{64}$/),revision:D,changeHighWater:rt,projectionFingerprint:O,occurredAt:E}).strict();function Xt(e){return kt.parse(e)}function Zt(e){return At.parse(e)}function Qt(e){return jt.parse(e)}function $t(e){return Nt.parse(e)}function en(e){return Vt.parse(e)}function tn(e){return Ht.parse(e)}function nn(e){return Ut.parse(e)}function rn(e){return Jt.parse(e)}function an(e){return Yt.parse(e)}var on=class extends Error{code;operation;stage;retryable;constructor(e){super(`${e.code}:${e.stage}`,{cause:e.cause}),this.name=`RadarResetSourceContractErrorV2`,this.code=e.code,this.operation=e.operation,this.stage=e.stage,this.retryable=e.retryable}};const k=new TextEncoder,sn=new TextDecoder(`utf-8`,{fatal:!0});function cn(e,t,n){if(n+t.byteLength>e.byteLength)return!1;for(let r=0;r<t.byteLength;r+=1)if(e.at(n+r)!==t.at(r))return!1;return!0}function ln(e,t){if(t.byteLength===0)return!0;for(let n=0;n<=e.byteLength-t.byteLength;n+=1)if(cn(e,t,n))return!0;return!1}function un(e){let t=e.reduce((e,t)=>e+t.byteLength,0),n=new Uint8Array(t),r=0;for(let t of e)n.set(t,r),r+=t.byteLength;return n}function dn(e){let t=``;for(let n=0;n<e.byteLength;n+=32768)t+=String.fromCharCode(...e.slice(n,n+32768));return btoa(t).replaceAll(`+`,`-`).replaceAll(`/`,`_`).replace(/=+$/u,``)}function fn(e){if(!/^[A-Za-z0-9_-]+$/u.test(e))throw Error(`base64url_noncanonical`);let t=(4-e.length%4)%4,n=`${e.replaceAll(`-`,`+`).replaceAll(`_`,`/`)}${`=`.repeat(t)}`,r=atob(n),i=Uint8Array.from(r,e=>e.charCodeAt(0));if(dn(i)!==e)throw Error(`base64url_noncanonical`);return i}async function pn(e){let t=e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength);return`sha256:${[...new Uint8Array(await crypto.subtle.digest(`SHA-256`,t))].map(e=>e.toString(16).padStart(2,`0`)).join(``)}`}function mn(e){for(let t=0;t<64;t+=1){let t=`radar-reset-v2-${[...crypto.getRandomValues(new Uint8Array(24))].map(e=>e.toString(16).padStart(2,`0`)).join(``)}`,n=k.encode(`--${t}`);if(!e.some(e=>ln(e,n)))return t}throw Error(`multipart_boundary_generation_failed`)}async function hn(e){let t=D.parse(e.revision),n=D.parse(e.correlationId),r=Nt.parse({contractVersion:2,revision:t,chunks:e.parts.map(({bytes:e,...t})=>t)}),i=e.parts.map((e,t)=>({...r.chunks[t],bytes:new Uint8Array(e.bytes)}));for(let e of i)if(e.bytes.byteLength!==e.byteSize||await pn(e.bytes)!==e.sha256)throw new on({code:`source_chunk_mismatch`,operation:`readDetailBatch`,stage:`detail_encode`,retryable:!1});let a=mn(i.map(e=>e.bytes)),o=[];for(let e of i)o.push(k.encode(`--${a}\r\nContent-Type: application/octet-stream\r
|
|
2
|
-
X-Radar-Reset-Action-Id-B64: ${
|
|
3
|
-
`));o.push(
|
|
4
|
-
`)){let t=e.indexOf(`:`);if(t<=0||e.slice(t+1,t+2)!==` `)return
|
|
1
|
+
import{z as e}from"zod";function t(e,t,n){let r=(e,t)=>{try{return n(e,t)}catch{return}};e.noticeCount!==e.noticeTimeline.length&&t.addIssue({code:`custom`,message:`action_notice_count_mismatch`,path:[`noticeCount`]});for(let[n,i]of e.noticeTimeline.entries())if(n===0){let n=r(i.authoredAt,e.firstAnnouncedAt);n!==void 0&&n!==0&&t.addIssue({code:`custom`,message:`notice_timeline_first_announcement_mismatch`,path:[`noticeTimeline`,0,`authoredAt`]})}else{let a=r(e.noticeTimeline.at(n-1).authoredAt,i.authoredAt);a!==void 0&&a>0&&t.addIssue({code:`custom`,message:`notice_timeline_not_ascending`,path:[`noticeTimeline`,n,`authoredAt`]})}}const n=1,r=4,i=Object.freeze({exportUtf8Bytes:2*1024*1024,analysis:Object.freeze({actions:512,intervals:511}),actionDetail:Object.freeze({noticeTimeline:64,reasons:128}),text:Object.freeze({publicTextCodePoints:500,evidenceExcerptCodePoints:500,urlCodePoints:2048})}),a=[`all`,`hard_reset`,`banked_reset`],o=[`hard_reset`,`banked_reset`],s=[`codex`,`chatgpt_work`],c=[`all_users`,`paid_users`,`named_plans`,`affected_subset`],l=[`plus`,`pro`],u=[`incident_compensation`,`user_milestone`,`celebration`],d=[`explicit_in_reset_post`,`explicit_in_related_source`,`contextual_inference`,`unknown`],f=[`weekday`,`weekday_group`,`hour`,`six_hour_block`,`month`,`day_of_month`,`week_of_month`,`weekday_hour`,`minute_of_hour`,`five_minute_bucket`,`half_hour_slot`,`time_of_day_minute`],ee=[`month`,`weekday`,`hour`,`six_hour_block`],p=e.number().finite(),m=p.min(0),h=e.number().int().min(0),g=e.number().int().positive(),_=p.min(0).max(1),v=e.iso.datetime({offset:!0}).refine(e=>e.endsWith(`Z`),{message:`utc_timestamp_required`}).refine(e=>/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?Z$/.test(e),{message:`utc_timestamp_seconds_required`}),y=e.string().min(1).max(128).refine(e=>e===e.trim()&&!/[\p{Cc}\p{Cf}]/u.test(e),{message:`public_id_invalid`}),b=e.enum(a),te=e.enum(u),ne=e.enum(d),re=e.object({contractVersion:e.literal(1),eventId:y,eventType:e.literal(`reset_analysis_snapshot_available`),analysisSnapshotId:y,sourceWatermark:y,occurredAt:v}).strict();function ie(e){return re.parse(e)}function ae(e){return[...e].length}function oe(e){return new TextEncoder().encode(JSON.stringify(e)).byteLength}const se=e.string().refine(e=>ae(e)<=i.text.evidenceExcerptCodePoints,{message:`evidence_excerpt_too_long`}),ce=e.string().refine(e=>e.trim().length>0,{message:`source_text_empty`}),le=e.string().refine(e=>ae(e)<=i.text.publicTextCodePoints,{message:`public_text_too_long`}),ue=e.string().refine(e=>e.trim().length>0,{message:`source_account_display_name_blank`}).refine(e=>ae(e)<=i.text.publicTextCodePoints,{message:`source_account_display_name_too_long`}),de=e.string().refine(e=>ae(e)<=i.text.urlCodePoints,{message:`source_url_too_long`}).refine(e=>{if([...e].some(e=>{let t=e.codePointAt(0);return t===void 0||t<=31||t===127}))return!1;try{let t=new URL(e);return t.protocol===`https:`&&t.username.length===0&&t.password.length===0}catch{return!1}},{message:`https_url_required`});function x(e){return new Set(e).size===e.length}const fe=e.discriminatedUnion(`state`,[e.object({state:e.literal(`known`),values:e.array(e.enum(o)).min(1).refine(x,{message:`reset_effects_must_be_unique`})}).strict(),e.object({state:e.literal(`unknown`),values:e.tuple([])}).strict()]),pe=e.object({products:e.array(e.enum(s)).refine(x,{message:`products_must_be_unique`}),audienceClaims:e.array(e.object({audience:e.enum(c),plans:e.array(e.enum(l)).refine(x,{message:`plans_must_be_unique`}),subsetSummary:le.nullable()}).strict())}).strict(),me=e.object({resetActionId:y,firstAnnouncedAt:v,effectiveAt:v.nullable(),resetEffects:fe,actionScope:pe,reasonCategories:e.array(te).refine(x,{message:`reason_categories_must_be_unique`}),noticeCount:g,previousAllActionDays:m.nullable(),previousHardResetActionDays:m.nullable(),previousBankedResetActionDays:m.nullable()}).strict(),he=e.object({series:b,previousActionId:y,actionId:y,fromFirstAnnouncedAt:v,toFirstAnnouncedAt:v,days:m}).strict(),ge=e.object({count:g,min:m,max:m,mean:m,median:m,percentile25:m,percentile75:m,percentile90:m,standardDeviation:m,coefficientOfVariation:m.nullable(),interquartileRange:m}).strict(),_e=e.object({lower:m,upper:m}).strict(),ve=e.object({iterations:g,seed:e.number().int(),mean95:_e,median95:_e}).strict(),ye=e.object({bucket:e.string().min(1),lowerInclusive:m,upperExclusive:m.nullable(),count:h,share:_}).strict(),be=e.object({endingIndex:h,windowSize:g,mean:m,median:m}).strict(),xe=e.object({firstHalf:ge.nullable(),secondHalf:ge.nullable(),meanChangeDays:p.nullable(),meanChangePercent:p.nullable()}).strict(),Se=e.object({series:b,actionCount:h,completedIntervalCount:h,intervalSummary:ge.nullable(),bootstrap95:ve.nullable(),intervalHistogram:e.array(ye),shortestIntervals:e.array(he),longestIntervals:e.array(he),rolling3:e.array(be),rolling5:e.array(be),linearSlopeDaysPerInterval:p.nullable(),halfComparison:xe,survivalCurve:e.array(e.object({elapsedDays:m,survivalProbability:_}).strict())}).strict(),Ce=e.object({series:b,elapsedDays:m,horizonDays:m,sampleAtRisk:h,eventsWithinWindow:h,probability:_.nullable()}).strict(),we=e.object({key:e.string(),count:h,share:_,timeZone:e.string().min(1),series:b,dimension:e.enum(f)}).strict(),Te=e.object({timeZone:e.string().min(1),series:b,dimension:e.enum(f),categoryCount:g,nonZeroCategoryCount:h,maxShare:_,herfindahlIndex:_,normalizedEntropy:_}).strict(),Ee=e.object({startMinute:e.number().int().min(0).max(1439),endMinute:e.number().int().min(0).max(1439),wrapsMidnight:e.boolean(),eventCount:h,share:_}).strict(),De=e.object({timeZone:e.string().min(1),series:b,eventCount:g,slotMinutes:g,fixedWindows:e.array(e.object({durationMinutes:g,bestWindows:e.array(Ee)}).strict()),coverageWindows:e.array(e.object({targetShare:_,requiredEventCount:g,durationMinutes:g,bestWindows:e.array(Ee)}).strict())}).strict(),Oe=e.object({series:b,thresholdDays:m,clusterCount:h,multiEventClusterCount:h,largestClusterSize:h,eventsInMultiEventClusters:h,eventShareInMultiEventClusters:_}).strict(),ke=e.object({category:te,actionCount:h,actionShare:_,hardResetActionCount:h,bankedResetActionCount:h,explicitInResetPostCount:h,explicitInRelatedSourceCount:h,contextualInferenceCount:h,unknownCount:h}).strict(),Ae=e.object({category:te,series:b,timeZone:e.string().min(1),dimension:e.enum(ee),key:e.string(),eventCount:h,reasonEventCount:h,binEventCount:h,seriesEventCount:h,shareWithinReason:_.nullable(),shareWithinBin:_.nullable(),shareOfSeries:_.nullable()}).strict(),je=e.object({overview:e.object({actionCount:g,hardResetActionCount:h,bankedResetActionCount:h,firstAnnouncedAt:v,lastAnnouncedAt:v,coverageDays:m,sourceNoticeCount:g}).strict(),actions:e.array(me).min(1).max(i.analysis.actions),intervals:e.array(he).max(i.analysis.intervals),series:e.object({all:Se,hard_reset:Se,banked_reset:Se}).strict(),historicalConditionalFrequencies:e.array(Ce),calendars:e.array(we),calendarConcentrations:e.array(Te),intradayRanges:e.array(De),clusters:e.array(Oe),reasons:e.object({summary:e.array(ke),crossTabs:e.array(Ae)}).strict(),caveats:e.array(le.min(1))}).strict(),Me=e.object({contractVersion:e.literal(1),analyzerContractVersion:e.literal(4),generatedAt:v,analysisWindow:e.object({startAt:v,startInclusive:e.boolean(),timeBasis:e.literal(`first_announcement`),throughFirstAnnouncedAt:v}).strict(),result:je}).strict().superRefine((e,t)=>{let n=e.result.actions,r=e.result.overview;n.length!==r.actionCount&&t.addIssue({code:`custom`,message:`analysis_action_count_mismatch`,path:[`result`,`actions`]});let i=new Set;for(let e=0;e<n.length;e+=1){let r=n[e];i.has(r.resetActionId)&&t.addIssue({code:`custom`,message:`analysis_action_identity_duplicate`,path:[`result`,`actions`,e,`resetActionId`]}),i.add(r.resetActionId);let a=n[e-1];a!==void 0&&(a.firstAnnouncedAt>r.firstAnnouncedAt||a.firstAnnouncedAt===r.firstAnnouncedAt&&a.resetActionId>r.resetActionId)&&t.addIssue({code:`custom`,message:`analysis_actions_not_stably_sorted`,path:[`result`,`actions`,e]})}let o=(e,r,i)=>{i!==void 0&&e.series!==i&&t.addIssue({code:`custom`,message:`analysis_interval_series_mismatch`,path:[...r,`series`]});let a=i??e.series,o=a===`all`?n:n.filter(e=>e.resetEffects.state===`known`&&e.resetEffects.values.includes(a)),s=o.findIndex(t=>t.resetActionId===e.actionId),c=o[s];if(c===void 0){t.addIssue({code:`custom`,message:`analysis_interval_action_mismatch`,path:[...r,`actionId`]});return}let l=o[s-1];(l===void 0||e.previousActionId!==l.resetActionId)&&t.addIssue({code:`custom`,message:`analysis_interval_previous_action_mismatch`,path:[...r,`previousActionId`]}),l!==void 0&&e.fromFirstAnnouncedAt!==l.firstAnnouncedAt&&t.addIssue({code:`custom`,message:`analysis_interval_from_first_announcement_mismatch`,path:[...r,`fromFirstAnnouncedAt`]}),e.toFirstAnnouncedAt!==c.firstAnnouncedAt&&t.addIssue({code:`custom`,message:`analysis_interval_to_first_announcement_mismatch`,path:[...r,`toFirstAnnouncedAt`]})};e.result.intervals.forEach((e,t)=>o(e,[`result`,`intervals`,t]));for(let t of a){let n=e.result.series[t];for(let e of[`shortestIntervals`,`longestIntervals`])n[e].forEach((n,r)=>o(n,[`result`,`series`,t,e,r],t))}n[0]?.firstAnnouncedAt!==r.firstAnnouncedAt&&t.addIssue({code:`custom`,message:`analysis_first_action_mismatch`,path:[`result`,`overview`,`firstAnnouncedAt`]}),(n.at(-1)?.firstAnnouncedAt!==r.lastAnnouncedAt||e.analysisWindow.throughFirstAnnouncedAt!==r.lastAnnouncedAt)&&t.addIssue({code:`custom`,message:`analysis_last_action_mismatch`,path:[`result`,`overview`,`lastAnnouncedAt`]});for(let[n,r]of Object.entries({all:`all`,hard_reset:`hard_reset`,banked_reset:`banked_reset`}))e.result.series[n].series!==r&&t.addIssue({code:`custom`,message:`analysis_series_identity_mismatch`,path:[`result`,`series`,n,`series`]})}),Ne=e.object({excerpt:se,sourceUrl:de}).strict();function Pe(e,t){try{return T(e,t)}catch{return}}function Fe(e,t){try{return w(e,t)}catch{return}}const S=e.object({contractVersion:e.literal(1),resetActionId:y,firstAnnouncedAt:v,effectiveAt:v.nullable(),resetEffects:fe,actionScope:pe,noticeCount:g,reasons:e.array(e.object({category:te,summary:le.min(1),basis:ne,evidence:e.array(Ne).min(1)}).strict()).max(i.actionDetail.reasons),noticeTimeline:e.array(e.object({phase:e.enum([`preview`,`executed`]),authoredAt:v,contentCompleteness:e.enum([`verified_full_text`,`verified_excerpt`]),sourceText:ce,sourceTextZh:ce.nullable(),sourceUrl:de,sourceAccount:e.object({displayName:ue}).strict()}).strict()).min(1).max(i.actionDetail.noticeTimeline)}).strict().superRefine((e,n)=>t(e,n,w)),Ie=[`preview`,`executed`,`schedule_change`,`scope_change`,`cancel_preview`,`delivery_issue`,`make_up`,`repair`,`update`],Le=e.object({resolution:e.enum([`resolved`,`unbounded`,`unresolved`]),evidence:e.string().trim().min(1).max(300).nullable(),precision:e.enum([`exact`,`approximate`,`range`]).nullable(),relation:e.enum([`instant`,`interval`,`deadline`,`not_before`,`unbounded`]).nullable(),effectiveWindow:e.object({earliestAt:e.iso.datetime(),latestAt:e.iso.datetime()}).strict().refine(e=>Date.parse(e.earliestAt)<=Date.parse(e.latestAt),{message:`publication_timing_window_inverted`}).nullable()}).strict().superRefine((e,t)=>{let n=e=>t.addIssue({code:`custom`,message:e});e.resolution===`resolved`!=(e.effectiveWindow!==null)&&n(`publication_timing_resolution_window_mismatch`),e.resolution===`unbounded`&&e.relation!==`unbounded`&&n(`publication_timing_unbounded_relation_required`);let r=e.effectiveWindow;e.resolution===`resolved`&&((e.relation===null||e.relation===`unbounded`)&&n(`publication_timing_bounded_relation_required`),r!==null&&e.relation===`interval`==(r.earliestAt===r.latestAt)&&n(`publication_timing_relation_window_mismatch`))}),C=e.object({resetActionId:y,state:e.enum([`preview`,`executed`]),resetEffects:fe,executedEffects:e.array(e.enum(o)).refine(x),pendingEffects:e.array(e.enum(o)).refine(x),plannedTiming:Le.nullable(),noticeTimeline:e.array(S.shape.noticeTimeline.element.omit({phase:!0}).extend({kinds:e.array(e.enum(Ie)).min(1).refine(x)}).strict()).min(1).max(i.actionDetail.noticeTimeline)}).strict().superRefine((e,t)=>{e.state===`preview`&&e.executedEffects.length>0&&t.addIssue({code:`custom`,message:`pending_preview_has_executed_effects`}),e.state===`executed`&&e.pendingEffects.length===0&&t.addIssue({code:`custom`,message:`pending_executed_action_has_no_pending_effects`});for(let n of[...e.executedEffects,...e.pendingEffects])new Set(e.resetEffects.values).has(n)||t.addIssue({code:`custom`,message:`pending_effect_not_declared`});e.executedEffects.some(t=>e.pendingEffects.includes(t))&&t.addIssue({code:`custom`,message:`pending_effect_already_executed`});for(let n=1;n<e.noticeTimeline.length;n+=1){let r=e.noticeTimeline[n-1],i=e.noticeTimeline[n],a=Fe(r.authoredAt,i.authoredAt);a!==void 0&&a>0&&t.addIssue({code:`custom`,message:`pending_notice_timeline_not_ascending`,path:[`noticeTimeline`,n]})}}),Re=e.object({contractVersion:e.literal(1),generatedAt:v,analysis:Me,actions:e.array(S).min(1).max(i.analysis.actions),pendingResetActions:e.array(C).max(i.analysis.actions)}).strict();function ze(e,t){oe(e)>i.exportUtf8Bytes&&t.addIssue({code:`custom`,message:`export_utf8_size_limit_exceeded`,path:[]});let n=Fe(e.generatedAt,e.analysis.generatedAt);n!==void 0&&n<0&&t.addIssue({code:`custom`,message:`export_generated_at_before_analysis`,path:[`generatedAt`]})}function Be(e,t,n,r){(e.resetActionId!==t.resetActionId||e.firstAnnouncedAt!==t.firstAnnouncedAt||e.effectiveAt!==t.effectiveAt||e.noticeCount!==t.noticeCount||JSON.stringify(e.resetEffects)!==JSON.stringify(t.resetEffects)||JSON.stringify(e.actionScope)!==JSON.stringify(t.actionScope))&&r.addIssue({code:`custom`,message:`export_action_summary_mismatch`,path:[`actions`,n]});let i=[...new Set(e.reasons.map(e=>e.category))].sort();JSON.stringify(i)!==JSON.stringify([...t.reasonCategories].sort())&&r.addIssue({code:`custom`,message:`export_action_reason_categories_mismatch`,path:[`actions`,n,`reasons`]})}const Ve=Re.superRefine((e,t)=>{ze(e,t),x(e.pendingResetActions.map(e=>e.resetActionId))||t.addIssue({code:`custom`,message:`export_pending_action_identity_duplicate`,path:[`pendingResetActions`]});let n=new Map,r=new Set(e.analysis.result.actions.map(e=>e.resetActionId));for(let i=0;i<e.actions.length;i+=1){let a=e.actions[i];n.has(a.resetActionId)?t.addIssue({code:`custom`,message:`export_action_identity_duplicate`,path:[`actions`,i,`resetActionId`]}):n.set(a.resetActionId,i);let o=e.actions[i-1],s=o===void 0?void 0:Pe(o,a);s!==void 0&&s>0&&t.addIssue({code:`custom`,message:`export_actions_not_stably_sorted`,path:[`actions`,i]});let c=Fe(a.firstAnnouncedAt,e.analysis.analysisWindow.throughFirstAnnouncedAt);c!==void 0&&c>0&&t.addIssue({code:`custom`,message:`export_action_after_analysis_snapshot`,path:[`actions`,i,`firstAnnouncedAt`]});let l=Fe(a.firstAnnouncedAt,e.analysis.analysisWindow.startAt);l!==void 0&&(e.analysis.analysisWindow.startInclusive?l>=0:l>0)&&!r.has(a.resetActionId)&&t.addIssue({code:`custom`,message:`export_window_action_not_in_analysis`,path:[`actions`,i,`resetActionId`]})}for(let r of e.analysis.result.actions){let i=n.get(r.resetActionId);if(i===void 0){t.addIssue({code:`custom`,message:`export_analysis_action_missing`,path:[`actions`]});continue}Be(e.actions[i],r,i,t)}});function w(e,t){let n=/^(\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2})(?:\.(\d+))?Z$/,r=n.exec(e),i=n.exec(t);if(r===null||i===null)throw Error(`radar_reset_v1_timestamp_invalid`);let a=r[1],o=i[1];if(a<o)return-1;if(a>o)return 1;let s=r[2]??``,c=i[2]??``,l=Math.max(s.length,c.length);for(let e=0;e<l;e+=1){let t=s.charCodeAt(e)||48,n=c.charCodeAt(e)||48;if(t<n)return-1;if(t>n)return 1}return 0}function T(e,t){let n=w(e.firstAnnouncedAt,t.firstAnnouncedAt);return n===0?e.resetActionId<t.resetActionId?-1:+(e.resetActionId>t.resetActionId):n}function He(e){return Me.parse(e)}function Ue(e){return S.parse(e)}function We(e){return Ve.parse(e)}function Ge(e){return C.parse(e)}function Ke(e){let t;try{t=Ue(e)}catch(e){throw Error(`radar_reset_primary_source_action_invalid`,{cause:e})}let n=t.noticeTimeline[0];if(n===void 0)throw Error(`radar_reset_primary_source_notice_missing`);return Object.freeze({displayName:n.sourceAccount.displayName,sourceUrl:n.sourceUrl,excerpt:[...n.sourceText.trim()].slice(0,i.text.publicTextCodePoints).join(``)})}const qe=2,Je=30,Ye=256,Xe=512*1024,Ze=256,Qe=256*1024,$e=32,et=2*1024*1024,tt=9223372036854775807n,nt=e.string().regex(/^(?:0|[1-9][0-9]{0,18})$/,`uint64_decimal_noncanonical`).refine(e=>BigInt(e)<=tt,`uint64_decimal_out_of_range`),E=e.string().regex(/^[1-9][0-9]{0,18}$/,`positive_decimal_noncanonical`).refine(e=>BigInt(e)<=tt,`positive_decimal_out_of_range`);function rt(e){return nt.parse(e)}function it(e){return E.parse(e)}function at(e){return BigInt(rt(e))}function ot(e){if(e<0n||e>tt)throw RangeError(`uint64_decimal_out_of_range`);return e.toString()}function st(e){if(e<1n||e>tt)throw RangeError(`positive_decimal_out_of_range`);return e.toString()}const D=e.iso.datetime({offset:!0}).refine(e=>e.endsWith(`Z`),`utc_timestamp_required`).refine(e=>/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?Z$/.test(e),`utc_timestamp_seconds_required`),O=e.string().min(1).max(128).refine(e=>e===e.trim()&&!/[\p{Cc}\p{Cf}]/u.test(e),`public_id_invalid`),k=e.string().regex(/^sha256:[0-9a-f]{64}$/,`sha256_noncanonical`);function ct(e){return new Set(e).size===e.length}const lt=t=>e.array(t).refine(ct,`array_values_must_be_unique`),ut=t=>e.string().refine(e=>[...e].length<=t,`string_exceeds_${t}_code_points`),dt=e.number().finite().min(0),ft=e.number().int().min(0).max(2**53-1),pt=e.number().int().positive().max(2**53-1),mt=e.enum([`hard_reset`,`banked_reset`]),ht=e.enum([`codex`,`chatgpt_work`]),gt=e.enum([`all_users`,`paid_users`,`named_plans`,`affected_subset`]),_t=e.enum([`plus`,`pro`]),vt=e.enum([`incident_compensation`,`user_milestone`,`celebration`]),yt=e.object({resetActionId:O,firstAnnouncedAt:D,effectiveAt:D.nullable(),resetEffects:e.union([e.object({state:e.literal(`known`),values:lt(mt).nonempty()}).strict(),e.object({state:e.literal(`unknown`),values:e.tuple([])}).strict()]),actionScope:e.object({products:lt(ht),audienceClaims:e.array(e.object({audience:gt,plans:lt(_t),subsetSummary:ut(500).nullable()}).strict())}).strict(),reasonCategories:lt(vt),noticeCount:pt,previousAllActionDays:dt.nullable(),previousHardResetActionDays:dt.nullable(),previousBankedResetActionDays:dt.nullable()}).strict();function bt(e){return yt.parse(e)}const xt=e.object({generatedAt:D,availableRange:e.object({firstAnnouncedAt:D,lastAnnouncedAt:D}).strict().nullable(),current:e.object({summary:yt,status:e.object({phase:e.enum([`preview`,`executed`]),statusAt:D}).strict()}).strict().nullable()}).strict().superRefine((e,t)=>{if(e.availableRange===null!=(e.current===null)){t.addIssue({code:`custom`,message:`home_empty_state_inconsistent`});return}e.availableRange!==null&&e.current!==null&&e.current.summary.firstAnnouncedAt!==e.availableRange.lastAnnouncedAt&&t.addIssue({code:`custom`,message:`home_current_range_inconsistent`})});function St(e){return xt.parse(e)}const Ct=e.object({ordinal:ft,sha256:k,byteSize:pt}).strict(),wt=e.object({sha256:k,byteSize:pt,chunkCount:pt,chunks:e.array(Ct).min(1)}).strict().superRefine((e,t)=>{e.chunkCount!==e.chunks.length&&t.addIssue({code:`custom`,message:`chunk_count_mismatch`});let n=0;for(let[r,i]of e.chunks.entries())i.ordinal!==r&&t.addIssue({code:`custom`,message:`chunk_ordinal_invalid`}),n+=i.byteSize;n!==e.byteSize&&t.addIssue({code:`custom`,message:`detail_byte_size_mismatch`})}),Tt=e.object({lifecycleState:e.literal(`active`),actionOrdinal:E,summary:yt,detailManifest:wt}).strict(),Et=e.object({lifecycleState:e.literal(`withdrawn`),actionOrdinal:E,resetActionId:O,lastActiveFirstAnnouncedAt:D}).strict(),Dt=e.discriminatedUnion(`lifecycleState`,[Tt,Et]),Ot=e.object({contractVersion:e.literal(2)}).strict(),kt=e.object({contractVersion:e.literal(2),revision:O,cursor:E.nullable()}).strict(),At=e.object({contractVersion:e.literal(2),revision:O,afterSequence:nt}).strict(),jt=e.object({resetActionId:O,ordinal:ft,sha256:k,byteSize:pt}).strict(),Mt=e.object({contractVersion:e.literal(2),revision:O,chunks:e.array(jt).min(1).max(32)}).strict().superRefine((e,t)=>{e.chunks.reduce((e,t)=>e+t.byteSize,0)>2097152&&t.addIssue({code:`custom`,message:`detail_batch_too_large`}),ct(e.chunks.map(e=>`${e.resetActionId}\u0000${e.ordinal}`))||t.addIssue({code:`custom`,message:`detail_chunk_duplicate`})}),Nt=e.object({lifecycleState:e.enum([`active`,`withdrawn`]),firstAnnouncedAt:D.nullable(),contentSha256:k.nullable()}).strict().superRefine((e,t)=>{e.lifecycleState===`active`&&(e.firstAnnouncedAt===null||e.contentSha256===null)&&t.addIssue({code:`custom`,message:`active_change_state_incomplete`})}),Pt=e.object({sourceChangeSequence:E,introducedByRevision:O,resetActionId:O,kind:e.enum([`create`,`upsert`,`withdraw`]),activationKind:e.enum([`initial`,`restored`]).nullable(),activationOrdinal:E.nullable(),before:Nt.nullable(),after:Nt.nullable()}).strict().superRefine((e,t)=>{e.activationKind===null!=(e.activationOrdinal===null)&&t.addIssue({code:`custom`,message:`activation_pair_invalid`}),e.kind===`create`&&(e.activationKind!==`initial`||e.before!==null||e.after?.lifecycleState!==`active`)&&t.addIssue({code:`custom`,message:`create_change_invalid`}),e.kind===`withdraw`&&(e.activationKind!==null||e.before?.lifecycleState!==`active`||e.after?.lifecycleState!==`withdrawn`)&&t.addIssue({code:`custom`,message:`withdraw_change_invalid`}),e.kind===`upsert`&&e.activationKind===`initial`&&t.addIssue({code:`custom`,message:`upsert_activation_invalid`})}),Ft=e.object({minSequence:e.literal(`1`),maxSequence:E}).strict(),It=e.object({revision:O,projectionFingerprint:k,actionCount:ft,activeActionCount:ft,changeCoverage:Ft.nullable(),home:xt}).strict().superRefine((e,t)=>{e.activeActionCount>e.actionCount&&t.addIssue({code:`custom`,message:`active_action_count_invalid`}),e.activeActionCount===0!=(e.home.availableRange===null)&&t.addIssue({code:`custom`,message:`head_home_count_inconsistent`})}),Lt=e.object({revision:O,items:e.array(Dt).max(256),nextCursor:E.nullable()}).strict().superRefine((e,t)=>{for(let n=1;n<e.items.length;n+=1){let r=e.items.at(n-1),i=e.items.at(n);if(r!==void 0&&i!==void 0&&BigInt(r.actionOrdinal)>=BigInt(i.actionOrdinal)){t.addIssue({code:`custom`,message:`action_ordinal_order_invalid`});break}}let n=e.items.at(-1);e.nextCursor!==null&&n?.actionOrdinal!==e.nextCursor&&t.addIssue({code:`custom`,message:`action_cursor_invalid`})}),Rt=e.object({revision:O,coverage:Ft.nullable(),items:e.array(Pt).max(256),nextAfterSequence:E.nullable()}).strict().superRefine((e,t)=>{for(let n=1;n<e.items.length;n+=1){let r=e.items.at(n-1),i=e.items.at(n);if(r!==void 0&&i!==void 0&&BigInt(r.sourceChangeSequence)+1n!==BigInt(i.sourceChangeSequence)){t.addIssue({code:`custom`,message:`change_sequence_gap`});break}}let n=e.items.at(-1);e.nextAfterSequence!==null&&n?.sourceChangeSequence!==e.nextAfterSequence&&t.addIssue({code:`custom`,message:`change_cursor_invalid`})}),zt=t=>e.object({contractVersion:e.literal(2),ok:e.literal(!0),data:t}).strict(),Bt=zt(It),Vt=zt(Lt),Ht=zt(Rt),Ut=[`source_invalid_request`,`source_revision_unknown`,`source_cursor_invalid`,`source_chunk_mismatch`,`source_response_over_capacity`,`source_integrity_conflict`,`source_revision_identity_conflict`,`source_sequence_exhausted`,`source_temporarily_unavailable`,`source_rpc_transport_failure`,`source_stream_incomplete`];function Wt(e,t=0,n=new Set){if(t>4)return!1;if(e===null||typeof e==`boolean`)return!0;if(typeof e==`string`)return[...e].length<=1024;if(typeof e==`number`)return Number.isFinite(e);if(typeof e!=`object`||n.has(e))return!1;if(n.add(e),Array.isArray(e))return e.length>16?!1:e.every(e=>Wt(e,t+1,n));let r=Object.entries(e);return r.length>16?!1:r.every(([,e])=>Wt(e,t+1,n))}const Gt=e.record(e.string(),e.unknown()).refine(e=>Wt(e),`safe_cause_invalid`).refine(e=>new TextEncoder().encode(JSON.stringify(e)).byteLength<=8192,`safe_cause_too_large`),Kt=e.object({code:e.enum(Ut),operation:O,stage:O,revision:O.optional(),retryable:e.boolean(),correlationId:O,cause:Gt}).strict(),qt=e.object({contractVersion:e.literal(2),ok:e.literal(!1),error:Kt}).strict(),Jt=e.object({contractVersion:e.literal(2),eventType:e.literal(`reset_publication_revision_available`),eventId:e.string().regex(/^reset_pub_v2_[0-9a-f]{64}$/),revision:O,changeHighWater:nt,projectionFingerprint:k,occurredAt:D}).strict();function Yt(e){return Ot.parse(e)}function Xt(e){return kt.parse(e)}function Zt(e){return At.parse(e)}function Qt(e){return Mt.parse(e)}function $t(e){return Bt.parse(e)}function en(e){return Vt.parse(e)}function tn(e){return Ht.parse(e)}function nn(e){return qt.parse(e)}function rn(e){return Jt.parse(e)}var an=class extends Error{code;operation;stage;retryable;constructor(e){super(`${e.code}:${e.stage}`,{cause:e.cause}),this.name=`RadarResetSourceContractErrorV2`,this.code=e.code,this.operation=e.operation,this.stage=e.stage,this.retryable=e.retryable}};const A=new TextEncoder,on=new TextDecoder(`utf-8`,{fatal:!0});function j(e,t,n){if(n+t.byteLength>e.byteLength)return!1;for(let r=0;r<t.byteLength;r+=1)if(e.at(n+r)!==t.at(r))return!1;return!0}function sn(e,t){if(t.byteLength===0)return!0;for(let n=0;n<=e.byteLength-t.byteLength;n+=1)if(j(e,t,n))return!0;return!1}function cn(e){let t=e.reduce((e,t)=>e+t.byteLength,0),n=new Uint8Array(t),r=0;for(let t of e)n.set(t,r),r+=t.byteLength;return n}function ln(e){let t=``;for(let n=0;n<e.byteLength;n+=32768)t+=String.fromCharCode(...e.slice(n,n+32768));return btoa(t).replaceAll(`+`,`-`).replaceAll(`/`,`_`).replace(/=+$/u,``)}function un(e){if(!/^[A-Za-z0-9_-]+$/u.test(e))throw Error(`base64url_noncanonical`);let t=(4-e.length%4)%4,n=`${e.replaceAll(`-`,`+`).replaceAll(`_`,`/`)}${`=`.repeat(t)}`,r=atob(n),i=Uint8Array.from(r,e=>e.charCodeAt(0));if(ln(i)!==e)throw Error(`base64url_noncanonical`);return i}async function dn(e){let t=e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength);return`sha256:${[...new Uint8Array(await crypto.subtle.digest(`SHA-256`,t))].map(e=>e.toString(16).padStart(2,`0`)).join(``)}`}function fn(e){for(let t=0;t<64;t+=1){let t=`radar-reset-v2-${[...crypto.getRandomValues(new Uint8Array(24))].map(e=>e.toString(16).padStart(2,`0`)).join(``)}`,n=A.encode(`--${t}`);if(!e.some(e=>sn(e,n)))return t}throw Error(`multipart_boundary_generation_failed`)}async function pn(e){let t=O.parse(e.revision),n=O.parse(e.correlationId),r=Mt.parse({contractVersion:2,revision:t,chunks:e.parts.map(({bytes:e,...t})=>t)}),i=e.parts.map((e,t)=>({...r.chunks[t],bytes:new Uint8Array(e.bytes)}));for(let e of i)if(e.bytes.byteLength!==e.byteSize||await dn(e.bytes)!==e.sha256)throw new an({code:`source_chunk_mismatch`,operation:`readDetailBatch`,stage:`detail_encode`,retryable:!1});let a=fn(i.map(e=>e.bytes)),o=[];for(let e of i)o.push(A.encode(`--${a}\r\nContent-Type: application/octet-stream\r
|
|
2
|
+
X-Radar-Reset-Action-Id-B64: ${ln(A.encode(e.resetActionId))}\r\nX-Radar-Detail-Ordinal: ${e.ordinal}\r\nX-Radar-Byte-Size: ${e.byteSize}\r\nX-Radar-SHA-256: ${e.sha256}\r\n\r\n`)),o.push(e.bytes,A.encode(`\r
|
|
3
|
+
`));o.push(A.encode(`--${a}--\r\n`));let s=cn(o),c=s.buffer.slice(s.byteOffset,s.byteOffset+s.byteLength);return new Response(c,{status:200,headers:{"Cache-Control":`no-store`,"Content-Type":`multipart/mixed; boundary=${a}`,"X-Radar-Correlation-Id":n,"X-Radar-Part-Count":String(i.length),"X-Radar-Revision-B64":ln(A.encode(t))}})}function M(e,t,n){throw new an({code:e,operation:`readDetailBatch`,stage:`detail_stream`,retryable:t,cause:n})}async function mn(e){if(e.body===null)return M(`source_stream_incomplete`,!0);let t=e.body.getReader(),n=[],r=0;try{for(;;){let e=await t.read();if(e.done)break;if(r+=e.value.byteLength,r>2162688){try{await t.cancel()}catch{}return M(`source_response_over_capacity`,!1)}n.push(e.value)}}catch(e){return M(`source_stream_incomplete`,!0,e)}finally{t.releaseLock()}return cn(n)}function hn(e,t){let n=e.headers.get(t);return n===null||n.includes(`,`)?M(`source_chunk_mismatch`,!1):n}function gn(e){if([...e].some(e=>e>127))return M(`source_chunk_mismatch`,!1);let t=String.fromCharCode(...e),n=new Map,r=new Set([`content-type`,`x-radar-reset-action-id-b64`,`x-radar-detail-ordinal`,`x-radar-byte-size`,`x-radar-sha-256`]);for(let e of t.split(`\r
|
|
4
|
+
`)){let t=e.indexOf(`:`);if(t<=0||e.slice(t+1,t+2)!==` `)return M(`source_chunk_mismatch`,!1);let i=e.slice(0,t).toLowerCase(),a=e.slice(t+2);if(!r.has(i)||n.has(i)||a.length===0)return M(`source_chunk_mismatch`,!1);n.set(i,a)}return n.size===r.size?n:M(`source_chunk_mismatch`,!1)}function _n(e,t,n){for(let r=n;r<=e.byteLength-t.byteLength;r+=1)if(j(e,t,r))return r;return-1}async function vn(e,t){let n=Mt.parse({contractVersion:2,revision:t.revision,chunks:t.chunks});if(e.status!==200)return M(`source_chunk_mismatch`,!1);let r=hn(e,`Content-Type`),i=/^multipart\/mixed; boundary=(radar-reset-v2-[0-9a-f]{48})$/u.exec(r);if(i===null)return M(`source_chunk_mismatch`,!1);let a=i[1];if(hn(e,`Cache-Control`)!==`no-store`)return M(`source_chunk_mismatch`,!1);O.parse(hn(e,`X-Radar-Correlation-Id`));let o=hn(e,`X-Radar-Part-Count`);if(!/^[1-9][0-9]*$/u.test(o)||Number(o)>32||Number(o)!==n.chunks.length)return M(`source_chunk_mismatch`,!1);let s;try{s=on.decode(un(hn(e,`X-Radar-Revision-B64`)))}catch(e){return M(`source_chunk_mismatch`,!1,e)}if(s!==n.revision)return M(`source_chunk_mismatch`,!1);let c=await mn(e),l=A.encode(`--${a}\r\n`),u=A.encode(`--${a}--\r\n`),d=A.encode(`\r
|
|
5
5
|
\r
|
|
6
|
-
`),f=
|
|
7
|
-
`),ee=[],p=0;for(let e of n.chunks){if(!cn(c,l,p))return A(`source_stream_incomplete`,!0);p+=l.byteLength;let t=yn(c,d,p);if(t<0)return A(`source_stream_incomplete`,!0);let n=vn(c.slice(p,t));if(p=t+d.byteLength,n.get(`content-type`)!==`application/octet-stream`)return A(`source_chunk_mismatch`,!1);let r;try{r=sn.decode(fn(n.get(`x-radar-reset-action-id-b64`)))}catch(e){return A(`source_chunk_mismatch`,!1,e)}if(r!==e.resetActionId||n.get(`x-radar-detail-ordinal`)!==String(e.ordinal)||n.get(`x-radar-byte-size`)!==String(e.byteSize)||n.get(`x-radar-sha-256`)!==e.sha256)return A(`source_chunk_mismatch`,!1);if(p+e.byteSize+f.byteLength>c.byteLength)return A(`source_stream_incomplete`,!0);let i=c.slice(p,p+e.byteSize);if(p+=e.byteSize,!cn(c,f,p)||(p+=f.byteLength,await pn(i)!==e.sha256))return A(`source_chunk_mismatch`,!1);ee.push({...e,bytes:i})}return!cn(c,u,p)||p+u.byteLength!==c.byteLength?A(`source_stream_incomplete`,!0):ee}const xn=/authorization|cookie|token|secret|password|api[-_]?key/iu;function Sn(e,t){let n=[...e].slice(0,1024),r=``;for(let e of n){let n=k.encode(e).byteLength;if(n>t.remaining)break;t.remaining-=n,r+=e}return r}function Cn(e,t,n,r){if(e===null||typeof e==`boolean`)return e;if(typeof e==`string`)return Sn(e,n);if(typeof e==`number`)return Number.isFinite(e)?e:String(e);if(typeof e==`bigint`||typeof e==`symbol`)return Sn(String(e),n);if(e===void 0)return`undefined`;if(typeof e==`function`)return`[Function ${e.name||`anonymous`}]`;if(r.has(e))return`[Circular]`;if(t>=4)return`[DepthLimit]`;if(r.add(e),Array.isArray(e))return e.slice(0,16).map(e=>Cn(e,t+1,n,r));let i={},a=e instanceof Error?[[`type`,e.constructor.name],[`name`,e.name],[`message`,e.message],...e.cause===void 0?[]:[[`cause`,e.cause]],...Object.entries(e)]:Object.entries(e);for(let[e,o]of a.slice(0,16)){let a=Sn(String(e),n);if(!(a.length===0||Object.hasOwn(i,a))&&(n.remaining-=Math.min(n.remaining,8),i[a]=xn.test(a)?`[REDACTED]`:Cn(o,t+1,n,r),n.remaining<=0))break}return i}function wn(e){let t=Cn(e,0,{remaining:7e3},new Set),n=typeof t==`object`&&t&&!Array.isArray(t)?t:{type:e===null?`null`:typeof e,message:t};return Kt.parse(n),n}function Tn(e){return e===`source_temporarily_unavailable`||e===`source_rpc_transport_failure`||e===`source_stream_incomplete`}function En(e){switch(e){case`source_invalid_request`:return 400;case`source_revision_unknown`:return 404;case`source_cursor_invalid`:case`source_chunk_mismatch`:return 409;case`source_response_over_capacity`:return 413;case`source_temporarily_unavailable`:case`source_rpc_transport_failure`:case`source_stream_incomplete`:return 503;case`source_integrity_conflict`:case`source_revision_identity_conflict`:case`source_sequence_exhausted`:return 500}}function Dn(e){let t={contractVersion:2,ok:!1,error:{code:e.code,operation:e.operation,stage:e.stage,...e.revision===void 0?{}:{revision:e.revision},retryable:Tn(e.code),correlationId:e.correlationId,cause:wn(e.cause)}};return Jt.parse(t)}const On=e.strictObject({en:e.string().trim().min(1),zh:e.string().trim().min(1)}),kn=e.iso.date(),j=e.strictObject({category:e.enum([`improvement`,`direct_reset`,`reset_card`]),deliveryState:e.enum([`preview`,`landed`]),description:On,dateBasis:e.enum([`occurrence`,`announcement`,`unresolved`]),sourceUrls:e.array(e.url({protocol:/^https?$/})).min(1)}),An=e.discriminatedUnion(`state`,[e.strictObject({state:e.literal(`ready`),text:On}),e.strictObject({state:e.enum([`pending`,`failed`,`not_applicable`]),text:e.null()})]),M=e.strictObject({contractVersion:e.literal(1),generatedAt:e.iso.datetime(),timeZone:e.string().refine(e=>{try{return new Intl.DateTimeFormat(`en`,{timeZone:e}),!0}catch{return!1}},`Invalid source time zone`),startDate:kn,endDate:kn,processing:e.strictObject({hasPending:e.boolean(),hasFailures:e.boolean()}),days:e.array(e.strictObject({date:kn,dayNumber:e.number().int().min(1).max(28),outcome:e.enum([`unconfirmed`,`improvement`,`reset`,`both`]),entries:e.array(j),summary:An})).length(28),undatedEntries:e.array(j)}).superRefine((e,t)=>{let n=Date.parse(`${e.startDate}T00:00:00Z`);for(let[r,i]of e.days.entries()){let e=new Date(n+r*864e5).toISOString().slice(0,10);(i.date!==e||i.dayNumber!==r+1)&&t.addIssue({code:`custom`,path:[`days`,r],message:`Days must be contiguous and numbered in order`}),i.entries.some(e=>e.dateBasis===`unresolved`)&&t.addIssue({code:`custom`,path:[`days`,r,`entries`],message:`Unresolved dates belong in undatedEntries`});let a=i.entries.filter(e=>e.deliveryState===`landed`),o=a.some(e=>e.category===`improvement`),s=a.some(e=>e.category!==`improvement`),c=o?s?`both`:`improvement`:s?`reset`:`unconfirmed`;(i.outcome!==c||a.length===0!=(i.summary.state===`not_applicable`))&&t.addIssue({code:`custom`,path:[`days`,r],message:`Outcome and summary must reflect landed evidence`})}e.days.at(-1)?.date!==e.endDate&&t.addIssue({code:`custom`,path:[`endDate`],message:`End must match the last activity day`}),e.undatedEntries.some(e=>e.dateBasis!==`unresolved`)&&t.addIssue({code:`custom`,path:[`undatedEntries`],message:`Undated entries must have unresolved dates`})});function jn(e){return M.parse(e)}function Mn(e){let t=e.filter(e=>e.deliveryState===`landed`),n=t.some(e=>e.category===`improvement`),r=t.some(e=>e.category!==`improvement`);return n?r?`both`:`improvement`:r?`reset`:`unconfirmed`}const Nn=524288,Pn=M.shape,Fn=Pn.days.element,In=j.extend({date:Pn.startDate.nullable()}).superRefine((e,t)=>{e.date===null!=(e.dateBasis===`unresolved`)&&t.addIssue({code:`custom`,path:[`date`],message:`Date must agree with its evidence basis`})}),Ln=e.strictObject({state:e.enum([`unconfirmed`,`ongoing`,`ended`]),sourceUrls:e.array(j.shape.sourceUrls.element)}).superRefine((e,t)=>{e.state!==`unconfirmed`&&e.sourceUrls.length===0&&t.addIssue({code:`custom`,path:[`sourceUrls`],message:`Confirmed lifecycle states require source evidence`})}),Rn=Fn.omit({date:!0,entries:!0}).extend({entries:e.array(In),lifecycle:Ln}),zn=e.strictObject({contractVersion:e.literal(2),generatedAt:Pn.generatedAt,timeZone:Pn.timeZone,processing:Pn.processing,days:e.array(Rn).length(28),unassignedEntries:e.array(In)}).superRefine((e,t)=>{for(let[n,r]of e.days.entries()){r.dayNumber!==n+1&&t.addIssue({code:`custom`,path:[`days`,n,`dayNumber`],message:`Official days must be numbered in order`});let e=r.entries.filter(e=>e.deliveryState===`landed`),i=Mn(r.entries);(r.outcome!==i||e.length===0!=(r.summary.state===`not_applicable`))&&t.addIssue({code:`custom`,path:[`days`,n],message:`Outcome and summary must reflect landed evidence`})}});function Bn(e){return zn.parse(e)}const Vn=Nn,N=e.strictObject({en:e.string().trim().min(1),zh:e.string().trim().min(1)}),Hn=j.extend({title:N}),Un=zn.shape,Wn=Un.days.element,Gn=Wn.shape.entries.element.safeExtend({title:N}),Kn=Wn.extend({title:N.nullable(),entries:e.array(Gn)}).superRefine((e,t)=>{e.title!==null!=(e.summary.state===`ready`)&&t.addIssue({code:`custom`,path:[`title`],message:`A daily title is available exactly when its summary is ready`})}),qn=e.strictObject({...Un,contractVersion:e.literal(3),days:e.array(Kn),unassignedEntries:e.array(Gn)}).superRefine((e,t)=>{let n=zn.safeParse({contractVersion:2,generatedAt:e.generatedAt,timeZone:e.timeZone,processing:e.processing,days:e.days.map(({title:e,...t})=>({...t,entries:t.entries.map(({title:e,...t})=>t)})),unassignedEntries:e.unassignedEntries.map(({title:e,...t})=>t)});if(!n.success)for(let e of n.error.issues)t.addIssue({...e})});function Jn(e){return{improvementDays:e.days.filter(e=>e.outcome===`improvement`||e.outcome===`both`).length,resetDays:e.days.filter(e=>e.outcome===`reset`||e.outcome===`both`).length}}function Yn(e){return qn.parse(e)}const Xn=Vn,Zn=zn.shape,Qn=qn.shape.unassignedEntries,$n=Zn.days.element.omit({summary:!0}).extend({entries:Qn}),P=e.strictObject({...Zn,contractVersion:e.literal(4),days:e.array($n).length(28),unassignedEntries:Qn}).superRefine((e,t)=>{for(let[n,r]of e.days.entries())r.dayNumber!==n+1&&t.addIssue({code:`custom`,path:[`days`,n,`dayNumber`],message:`Official days must be numbered in order`}),r.outcome!==Mn(r.entries)&&t.addIssue({code:`custom`,path:[`days`,n],message:`Outcome must reflect landed evidence`})});function er(e){return P.parse(e)}function tr(e,t){let n=new Set;for(let r of e)n.has(r.eventId)&&t.addIssue({code:`custom`,message:`Duplicate activity eventId`}),n.add(r.eventId)}function nr(e,t,n){let r=n.reduce((t,n)=>t+e.reactionCounts[n],0);(!Number.isSafeInteger(r)||r!==e.reactionTotal)&&t.addIssue({code:`custom`,path:[`reactionTotal`],message:`Total must equal all reaction counts`})}async function rr(e,t,n){if(e.status!==200){let t={status:e.status,statusText:e.statusText};try{await e.body?.cancel()}catch(e){throw Error(`activity_file_http_error`,{cause:{...t,cancellationCause:e}})}throw Error(`activity_file_http_error`,{cause:t})}if(e.body===null)throw Error(`activity_file_body_missing`);let r=e.body.getReader(),i=[],a=0;try{for(;;){let e=await r.read();if(e.done)break;if(a+=e.value.byteLength,a>n)throw Error(`activity_file_too_large`,{cause:{maxBytes:n,observedBytes:a}});i.push(e.value)}let e=new Uint8Array(a),o=0;for(let t of i)e.set(t,o),o+=t.byteLength;return t.parse(JSON.parse(new TextDecoder(`utf-8`,{fatal:!0}).decode(e)))}catch(e){try{await r.cancel()}catch{}throw Error(`activity_file_read_failed`,{cause:e})}finally{r.releaseLock()}}function ir(e,t,n){let r=new TextEncoder().encode(JSON.stringify(t.parse(e)));if(r.byteLength>n)throw Error(`activity_file_too_large`,{cause:{byteLength:r.byteLength}});return r}const F=[`👍`,`😂`,`🤡`,`💀`,`😭`,`🔥`,`🎉`,`👀`,`🙏`,`🫠`],ar=e.enum(F),I=e.string().min(1).max(128),L=524288,or=`https://data.radarultra.com/activity/v1/latest.json`,sr=`https://data.radarultra.com/activity/v2/latest.json`,cr=j.extend({eventId:I}),lr=M.safeExtend({days:e.array(M.shape.days.element.extend({entries:e.array(cr)})).length(28),undatedEntries:e.array(cr)});function ur(e,t){tr([...e.days.flatMap(e=>e.entries),...e.undatedEntries],t)}const dr=lr.superRefine(ur),fr=e.record(ar,e.number().int().nonnegative()),pr=e.strictObject({reactionCounts:fr,reactionTotal:e.number().int().nonnegative()});function mr(e,t){nr(e,t,F)}const hr=cr.extend(pr.shape).superRefine(mr),gr=lr.safeExtend({days:e.array(lr.shape.days.element.extend({entries:e.array(hr)})).length(28),undatedEntries:e.array(hr)}).superRefine(ur),R=e.strictObject({publishedAt:e.iso.datetime(),reactionIds:e.array(ar).length(F.length).refine(e=>new Set(e).size===F.length,`Every reaction must occur exactly once`),progress:gr}),_r=qn.shape,vr=_r.unassignedEntries.element.safeExtend({eventId:I}),yr=e.strictObject({..._r,days:e.array(_r.days.element.safeExtend({entries:e.array(vr)})).length(28),unassignedEntries:e.array(vr)}),br=yr.superRefine((e,t)=>{let n=({eventId:e,...t})=>t,r=qn.safeParse({...e,days:e.days.map(e=>({...e,entries:e.entries.map(n)})),unassignedEntries:e.unassignedEntries.map(n)});if(!r.success)for(let e of r.error.issues)t.addIssue({...e});tr([...e.days.flatMap(e=>e.entries),...e.unassignedEntries],t)}),xr=vr.safeExtend(pr.shape).superRefine(mr),Sr=yr.safeExtend({days:e.array(_r.days.element.safeExtend({entries:e.array(xr)})).length(28),unassignedEntries:e.array(xr)}).superRefine((e,t)=>{let n=({reactionCounts:e,reactionTotal:t,...n})=>n,r=br.safeParse({...e,days:e.days.map(e=>({...e,entries:e.entries.map(n)})),unassignedEntries:e.unassignedEntries.map(n)});if(!r.success)for(let e of r.error.issues)t.addIssue({...e})}),Cr=R.extend({progress:Sr}),wr=P.shape,Tr=wr.unassignedEntries.element.safeExtend({eventId:I}),Er=P.safeExtend({days:e.array(wr.days.element.safeExtend({entries:e.array(Tr)})).length(28),unassignedEntries:e.array(Tr)}).superRefine((e,t)=>{tr([...e.days.flatMap(e=>e.entries),...e.unassignedEntries],t)}),Dr=Tr.safeExtend(pr.shape).superRefine(mr),Or=Er.safeExtend({days:e.array(wr.days.element.safeExtend({entries:e.array(Dr)})).length(28),unassignedEntries:e.array(Dr)}),kr=R.extend({progress:Or});async function Ar(e){return rr(e,R,L)}async function jr(e){return rr(e,Cr,L)}async function Mr(e){return rr(e,kr,L)}function Nr(e){return ir(e,R,L)}function Pr(e){return ir(e,Cr,L)}function Fr(e){return ir(e,kr,L)}const Ir=e.strictObject({changeId:e.string().min(1).max(128),eventId:e.string().min(1).max(128),revision:e.int().positive(),kind:e.enum([`created`,`updated`,`withdrawn`]),date:e.iso.date().nullable(),entry:j,receivedAt:e.iso.datetime().nullable(),acceptedAt:e.iso.datetime()}),Lr=e.strictObject({contractVersion:e.literal(1),changes:e.array(Ir),nextCursor:e.string().min(1),hasMore:e.boolean()}),Rr=Ir.extend({dayNumber:M.shape.days.element.shape.dayNumber.nullable()}),zr=Lr.extend({contractVersion:e.literal(2),changes:e.array(Rr)}),Br=e.int().min(0).max(2**53-1),Vr=e.int().min(1).max(28),Hr=e.enum([`yes`,`no`]).nullable(),Ur=e.strictObject({choice:Hr}),Wr=e.strictObject({yes:Br,no:Br,total:Br}).superRefine((e,t)=>{(!Number.isSafeInteger(e.yes+e.no)||e.total!==e.yes+e.no)&&t.addIssue({code:`custom`,path:[`total`],message:`Total must equal the effective choices.`})}),Gr=e.strictObject({dayNumber:Vr,state:e.enum([`unopened`,`open`,`closed`]),choice:Hr,outcome:e.enum([`unconfirmed`,`yes`,`no`]),personalResult:e.enum([`none`,`waiting`,`correct`,`incorrect`]),corrected:e.boolean(),counts:Wr}).superRefine((e,t)=>{let n=e.choice===null?`none`:e.outcome===`unconfirmed`?`waiting`:e.choice===e.outcome?`correct`:`incorrect`;e.personalResult!==n&&t.addIssue({code:`custom`,path:[`personalResult`],message:`Personal result must match the confirmed outcome and choice.`}),e.state!==`closed`&&e.outcome!==`unconfirmed`&&t.addIssue({code:`custom`,path:[`outcome`],message:`An open or unopened day cannot have a confirmed result.`}),e.state===`unopened`&&(e.choice!==null||e.counts.total!==0)&&t.addIssue({code:`custom`,path:[`state`],message:`An unopened day cannot have choices.`})}),Kr=e.strictObject({revision:Br,openDayNumber:Vr.nullable(),days:e.array(Gr).length(28)}).superRefine((e,t)=>{for(let[n,r]of e.days.entries()){r.dayNumber!==n+1&&t.addIssue({code:`custom`,path:[`days`,n,`dayNumber`],message:`Every official day must occur once, in order.`});let i=e.openDayNumber===null||r.dayNumber<e.openDayNumber?`closed`:r.dayNumber===e.openDayNumber?`open`:`unopened`;r.state!==i&&t.addIssue({code:`custom`,path:[`days`,n,`state`],message:`Only the next official day may be open.`})}}),qr=e.strictObject({error:e.strictObject({code:e.enum([`invalid_request`,`payload_too_large`,`unsupported_media_type`,`origin_not_allowed`,`rate_limited`,`dependency_unavailable`,`internal_error`,`day_closed`,`identity_unavailable`]),message:e.string().min(1).max(2048),requestId:e.string().min(1).max(128),operation:e.enum([`get_guesses`,`set_guess`]),stage:e.string().min(1).max(128),cause:e.record(e.string(),e.unknown()),saveOutcome:e.enum([`not_saved`,`unknown`]).optional()})}).superRefine(({error:e},t)=>{e.operation===`set_guess`!=(e.saveOutcome!==void 0)&&t.addIssue({code:`custom`,path:[`error`,`saveOutcome`],message:`Only save failures must include a save outcome.`})}),Jr=e.strictObject({"zh-Hans":S.shape.noticeTimeline.element.shape.sourceTextZh,"zh-Hant":S.shape.noticeTimeline.element.shape.sourceTextZh,ja:S.shape.noticeTimeline.element.shape.sourceTextZh,ko:S.shape.noticeTimeline.element.shape.sourceTextZh}),Yr=S.shape.noticeTimeline.element.omit({sourceTextZh:!0}).extend({sourceTranslations:Jr}).strict(),Xr=e.strictObject({...S.shape,contractVersion:e.literal(2),noticeTimeline:e.array(Yr).min(1).max(i.actionDetail.noticeTimeline)}),Zr=Yr.omit({phase:!0}).extend({kinds:C.shape.noticeTimeline.element.shape.kinds}).strict(),Qr=e.strictObject({...C.shape,noticeTimeline:e.array(Zr).min(1).max(i.actionDetail.noticeTimeline)}),$r=e=>{let{sourceTranslations:t,...n}=e;return{...n,sourceTextZh:t[`zh-Hans`]}},ei=e=>({...e,contractVersion:1,noticeTimeline:e.noticeTimeline.map($r)}),ti=e=>({...e,noticeTimeline:e.noticeTimeline.map($r)}),ni=(e,t)=>{for(let n of e.error?.issues??[])t.addIssue({...n})},z=Xr.superRefine((e,t)=>{ni(S.safeParse(ei(e)),t)}),B=Qr.superRefine((e,t)=>{ni(C.safeParse(ti(e)),t)}),V=e.strictObject({...Ve.shape,contractVersion:e.literal(2),actions:e.array(z).min(1).max(i.analysis.actions),pendingResetActions:e.array(B).max(i.analysis.actions)}).superRefine((e,t)=>{ni(Ve.safeParse({...e,contractVersion:1,actions:e.actions.map(ei),pendingResetActions:e.pendingResetActions.map(ti)}),t),new TextEncoder().encode(JSON.stringify(e)).byteLength>i.exportUtf8Bytes&&t.addIssue({code:`custom`,message:`export_utf8_size_limit_exceeded`,path:[]})}),ri=e=>z.parse(e),ii=e=>B.parse(e),ai=e=>V.parse(e);function oi(e){let t=ai(e);return Ve.parse({...t,contractVersion:1,actions:t.actions.map(ei),pendingResetActions:t.pendingResetActions.map(ti)})}const si=e.object(z.shape).omit({actionScope:!0,reasons:!0}).extend({contractVersion:e.literal(3)}).strict().superRefine((e,n)=>t(e,n,w)),ci=V.shape.generatedAt,li=e.strictObject({resetActionId:S.shape.resetActionId,effect:S.shape.resetEffects.options[0].shape.values.element.nullable(),at:ci,basis:e.enum([`execution_confirmation`,`announcement`]),sourceUrl:S.shape.noticeTimeline.element.shape.sourceUrl}),ui=e.number().int().nonnegative(),di=e.number().finite().nonnegative();function H(e,t){try{return w(e,t)}catch{return}}function fi(e,t){return e<t?-1:+(e>t)}const pi=e.strictObject({timeBasis:e.literal(`confirmation_priority`),startAt:ci,total:ui,hardResetCount:ui,bankedResetCount:ui,unknownCount:ui,records:e.array(li).max(i.analysis.actions*2),intervalSummary:e.strictObject({mean:di,max:di}).nullable()});function mi(e,t){let n=(e,n=[])=>t.addIssue({code:`custom`,message:e,path:n}),r={hard_reset:0,banked_reset:0,unknown:0},a=new Set,o=new Map,s=new Set,c=new Set;for(let[t,i]of e.records.entries()){r[i.effect??`unknown`]+=1;let l=JSON.stringify([i.resetActionId,i.effect]);a.has(l)&&n(`statistics_record_identity_duplicate`,[`records`,t]),a.add(l),i.effect===null?s.add(i.resetActionId):c.add(i.resetActionId),H(i.at,e.startAt)===-1&&n(`statistics_record_before_window`,[`records`,t,`at`]);let u=e.records.at(t-1);if(t>0&&u!==void 0){let e=H(u.at,i.at);e!==void 0&&(e>0||e===0&&(fi(u.resetActionId,i.resetActionId)>0||u.resetActionId===i.resetActionId&&fi(u.effect??``,i.effect??``)>0))&&n(`statistics_records_not_stably_sorted`,[`records`,t])}let d=o.get(i.resetActionId);(d===void 0||H(i.at,d)===-1)&&o.set(i.resetActionId,i.at)}o.size>i.analysis.actions&&n(`statistics_event_limit_exceeded`),[...s].some(e=>c.has(e))&&n(`statistics_event_effect_state_mismatch`),e.total!==e.records.length&&n(`statistics_total_mismatch`,[`total`]),e.hardResetCount!==r.hard_reset&&n(`statistics_hard_reset_count_mismatch`,[`hardResetCount`]),e.bankedResetCount!==r.banked_reset&&n(`statistics_banked_reset_count_mismatch`,[`bankedResetCount`]),e.unknownCount!==r.unknown&&n(`statistics_unknown_count_mismatch`,[`unknownCount`]);let l=[...o.values()].sort((e,t)=>H(e,t)??0),u=l.slice(1).map((e,t)=>Number(((Date.parse(e)-Date.parse(l.at(t)))/864e5).toFixed(6)));if(u.length===0)e.intervalSummary!==null&&n(`statistics_interval_summary_must_be_null`,[`intervalSummary`]);else if(u.every(Number.isFinite)){let t=Number((u.reduce((e,t)=>e+t,0)/u.length).toFixed(6)),r=Math.max(...u);(e.intervalSummary===null||Math.abs(e.intervalSummary.mean-t)>1e-9||Math.abs(e.intervalSummary.max-r)>1e-9)&&n(`statistics_interval_summary_mismatch`,[`intervalSummary`])}}const hi=pi.superRefine(mi),gi=e.object(V.shape).omit({analysis:!0}).extend({contractVersion:e.literal(3),statistics:hi,actions:e.array(si).min(1).max(i.analysis.actions)}).strict().superRefine((e,t)=>{let n=(e,n=[])=>t.addIssue({code:`custom`,message:e,path:n});new TextEncoder().encode(JSON.stringify(e)).byteLength>i.exportUtf8Bytes&&n(`export_utf8_size_limit_exceeded`);let r=new Map(e.actions.map(e=>[e.resetActionId,e])),a=new Set(e.statistics.records.map(e=>e.resetActionId));r.size!==e.actions.length&&n(`export_action_identity_duplicate`,[`actions`]),new Set(e.pendingResetActions.map(e=>e.resetActionId)).size!==e.pendingResetActions.length&&n(`export_pending_action_identity_duplicate`,[`pendingResetActions`]);for(let[t,r]of e.actions.entries()){let i=e.actions.at(t-1);t>0&&i!==void 0&&ci.safeParse(i.firstAnnouncedAt).success&&ci.safeParse(r.firstAnnouncedAt).success&&He(i,r)>0&&n(`export_actions_not_stably_sorted`,[`actions`,t]),H(r.firstAnnouncedAt,e.generatedAt)===1&&n(`export_action_after_snapshot`,[`actions`,t,`firstAnnouncedAt`]);let o=H(r.firstAnnouncedAt,e.statistics.startAt);o!==void 0&&o>=0&&!a.has(r.resetActionId)&&n(`export_statistics_window_action_missing`,[`actions`,t,`resetActionId`])}for(let[t,i]of e.statistics.records.entries()){let a=[`statistics`,`records`,t],o=r.get(i.resetActionId);if(o===void 0){n(`export_statistics_action_missing`,a);continue}(o.resetEffects.state===`unknown`!=(i.effect===null)||i.effect!==null&&!o.resetEffects.values.some(e=>e===i.effect))&&n(`export_statistics_effect_mismatch`,[...a,`effect`]);let s=o.noticeTimeline.filter(e=>e.sourceUrl===i.sourceUrl&&H(e.authoredAt,i.at)===0);s.length===0&&n(`export_statistics_source_mismatch`,a),i.basis===`execution_confirmation`&&!s.some(e=>e.phase===`executed`)&&n(`export_statistics_confirmation_source_invalid`,a),i.basis===`announcement`&&H(i.at,o.firstAnnouncedAt)!==0&&n(`export_statistics_announcement_time_mismatch`,a),H(i.at,e.generatedAt)===1&&n(`export_statistics_record_after_snapshot`,[...a,`at`])}}),_i=e.strictObject({contractVersion:e.literal(1),data:e.strictObject({sourceWatermark:re.shape.sourceWatermark,statistics:hi}),meta:e.strictObject({observedAt:ci})}),vi=e=>gi.parse(e);function yi(e,t){let n=V.parse(e);return vi({contractVersion:3,generatedAt:n.generatedAt,statistics:t,pendingResetActions:n.pendingResetActions,actions:n.actions.map(({actionScope:e,reasons:t,...n})=>({...n,contractVersion:3}))})}const bi=e=>si.parse(e),xi=`/api/v1/codex-reset-public-records`,Si=e.array(Zr).min(1).max(i.actionDetail.noticeTimeline),Ci=e.strictObject(z.shape).omit({contractVersion:!0,noticeCount:!0,noticeTimeline:!0}).extend({noticeTimeline:Si}).strict();function wi(e){let t=e.noticeTimeline.filter(e=>e.kinds.includes(`executed`)||e.kinds.includes(`preview`)).map(({kinds:e,...t})=>({...t,phase:e.includes(`executed`)?`executed`:`preview`}));return{...e,contractVersion:2,noticeCount:t.length,noticeTimeline:t}}const Ti=e=>z.parse(wi(e));function Ei(e,t){let n=new Set;for(let[r,i]of e.entries()){n.has(i.sourceUrl)&&t.addIssue({code:`custom`,message:`public_notice_source_duplicate`,path:[`noticeTimeline`,r]}),n.add(i.sourceUrl);let a=e.at(r-1),o=z.shape.firstAnnouncedAt;r>0&&a!==void 0&&o.safeParse(a.authoredAt).success&&o.safeParse(i.authoredAt).success&&w(a.authoredAt,i.authoredAt)>0&&t.addIssue({code:`custom`,message:`public_notice_timeline_not_ascending`,path:[`noticeTimeline`,r]})}}const Di=Ci.superRefine((e,t)=>{Ei(e.noticeTimeline,t);let n=z.safeParse(wi(e));for(let e of n.error?.issues??[])t.addIssue({...e})}),Oi=e.strictObject(B.shape).omit({state:!0,executedEffects:!0,pendingEffects:!0}).superRefine((e,t)=>{Ei(e.noticeTimeline,t)}),ki=e.strictObject(z.shape).pick({resetActionId:!0}).extend({lastActiveFirstAnnouncedAt:z.shape.firstAnnouncedAt,withdrawnAt:z.shape.firstAnnouncedAt}).strict(),Ai=i.analysis.actions,ji=e.strictObject({contractVersion:e.literal(1),sourceWatermark:z.shape.resetActionId,generatedAt:z.shape.firstAnnouncedAt,actions:e.array(Di).min(1).max(Ai),pendingResetActions:e.array(B).max(Ai),unexecutedResetActions:e.array(Oi).max(Ai),withdrawnResetActions:e.array(ki).max(Ai)}).superRefine((e,t)=>{for(let n of[`actions`,`pendingResetActions`,`unexecutedResetActions`,`withdrawnResetActions`])new Set(e[n].map(e=>e.resetActionId)).size!==e[n].length&&t.addIssue({code:`custom`,message:`public_reset_identity_duplicate`,path:[n]});let n=new Set(e.actions.map(e=>e.resetActionId));for(let n of e.pendingResetActions)Ei(n.noticeTimeline,t);(e.unexecutedResetActions.some(e=>n.has(e.resetActionId))||e.withdrawnResetActions.some(e=>n.has(e.resetActionId)))&&t.addIssue({code:`custom`,message:`public_reset_lifecycle_conflict`});for(let[n,r]of e.actions.entries()){let i=e.actions.at(n-1),a=z.shape.firstAnnouncedAt;n>0&&i!==void 0&&a.safeParse(i.firstAnnouncedAt).success&&a.safeParse(r.firstAnnouncedAt).success&&He(i,r)>=0&&t.addIssue({code:`custom`,message:`public_reset_actions_not_ascending`,path:[`actions`,n]})}new TextEncoder().encode(JSON.stringify(e)).byteLength>i.exportUtf8Bytes&&t.addIssue({code:`custom`,message:`public_reset_records_utf8_size_limit_exceeded`})}),Mi=z.shape,Ni=e.strictObject({title:e.string(),body:e.string()}),Pi=e.strictObject({zh:Ni,en:Ni}),Fi=e.enum([`end_preview`,`restore_preview`,`set_auto_notification`,`notify`]),Ii=e.strictObject({resetActionId:Mi.resetActionId,operation:Fi,expectedRevision:e.int().nonnegative(),copy:Pi.nullable(),automaticNotification:e.boolean().nullable()}).superRefine((e,t)=>{e.operation===`notify`!=(e.copy!==null)&&t.addIssue({code:`custom`,path:[`copy`],message:`notification_copy_operation_mismatch`}),e.operation===`set_auto_notification`!=(e.automaticNotification!==null)&&t.addIssue({code:`custom`,path:[`automaticNotification`],message:`notification_policy_operation_mismatch`})}),Li=Ii,Ri=Ii,zi=e.strictObject({digest:e.string().regex(/^sha256:[a-f0-9]{64}$/),sourceWatermark:e.string().min(1),draft:Ii}),Bi=e.strictObject({operationId:e.uuid(),preview:zi}),Vi=e.strictObject({resetActionId:Mi.resetActionId,revision:e.number().int().nonnegative(),state:e.enum([`preview`,`executed`,`cancelled`,`undetermined`]),firstAnnouncedAt:E.nullable(),officialConfirmed:e.boolean(),pendingPreview:e.boolean(),previewClosed:e.boolean(),automaticNotification:e.boolean(),sourceUrls:e.array(Mi.noticeTimeline.element.shape.sourceUrl),availableOperations:e.array(Fi),notificationOperationId:e.uuid().nullable()}),Hi=e.strictObject({actions:e.array(Vi)}),Ui=e.discriminatedUnion(`status`,[e.strictObject({status:e.literal(`unknown`),operationId:e.uuid()}),e.strictObject({status:e.literal(`saved`),operationId:e.uuid(),resetActionId:Mi.resetActionId,operation:Fi,revision:e.number().int().positive(),notification:e.strictObject({state:e.enum([`disabled`,`pending`,`claimed`,`retry_wait`,`accepted`,`rejected`,`expired`]),resultCode:e.string().nullable(),diagnostic:e.record(e.string(),e.unknown()).nullable()})})]),Wi=S.shape.noticeTimeline.element.shape,Gi=e.enum([`initial`,`supplement`,`correction`]).nullable(),Ki=e.strictObject({authoredAt:Wi.authoredAt,role:Gi,sourceUrl:Wi.sourceUrl,sourceText:Wi.sourceText,sourceTextZh:Wi.sourceTextZh}),qi=e.array(Ki).min(1).superRefine((e,t)=>{let n=new Set,r;for(let[i,a]of e.entries()){if(n.has(a.sourceUrl)&&t.addIssue({code:`custom`,path:[i,`sourceUrl`],message:`An original post may appear only once per improvement`}),n.add(a.sourceUrl),!Wi.authoredAt.safeParse(a.authoredAt).success){r=void 0;continue}if(r!==void 0){let e=w(r.authoredAt,a.authoredAt);(e>0||e===0&&r.sourceUrl>a.sourceUrl)&&t.addIssue({code:`custom`,path:[i],message:`Posts must be ordered by authoredAt and sourceUrl`})}r=a}}),Ji=Xn,Yi=j.omit({description:!0}).extend({category:e.literal(`improvement`),title:N,posts:qi}),Xi=j.extend({category:e.enum([`direct_reset`,`reset_card`]),title:N}),Zi=e.discriminatedUnion(`category`,[Yi,Xi]),Qi=P.shape,$i=Qi.unassignedEntries.element.shape.date;function ea(e,t){e.date===null!=(e.dateBasis===`unresolved`)&&t.addIssue({code:`custom`,path:[`date`],message:`Date must agree with its evidence basis`})}const ta=e.discriminatedUnion(`category`,[Yi.extend({date:$i}).superRefine(ea),Xi.extend({date:$i}).superRefine(ea)]),na=e.strictObject({...Qi,contractVersion:e.literal(5),days:e.array(Qi.days.element.extend({entries:e.array(ta)})).length(28),unassignedEntries:e.array(ta)}).superRefine((e,t)=>{for(let[n,r]of e.days.entries())r.dayNumber!==n+1&&t.addIssue({code:`custom`,path:[`days`,n,`dayNumber`],message:`Official days must be numbered in order`}),r.outcome!==Mn(r.entries)&&t.addIssue({code:`custom`,path:[`days`,n],message:`Outcome must reflect landed evidence`})});function ra(e){return na.parse(e)}const ia=`https://data.radarultra.com/activity/v3/latest.json`,aa=na.shape,[oa,sa]=aa.unassignedEntries.element.options,ca=oa.safeExtend({eventId:I}),la=sa.safeExtend({eventId:I}),ua=e.discriminatedUnion(`category`,[ca,la]),da=na.safeExtend({days:e.array(aa.days.element.extend({entries:e.array(ua)})).length(28),unassignedEntries:e.array(ua)}).superRefine((e,t)=>{tr([...e.days.flatMap(e=>e.entries),...e.unassignedEntries],t)}),fa={reactionCounts:fr,reactionTotal:e.number().int().nonnegative()},pa=(e,t)=>nr(e,t,F),ma=e.discriminatedUnion(`category`,[ca.safeExtend(fa).superRefine(pa),la.safeExtend(fa).superRefine(pa)]),ha=da.safeExtend({days:e.array(aa.days.element.extend({entries:e.array(ma)})).length(28),unassignedEntries:e.array(ma)}),ga=R.extend({progress:ha});async function _a(e){return rr(e,ga,L)}function va(e){return ir(e,ga,L)}const ya=e.discriminatedUnion(`category`,[Yi,j.extend({category:e.enum([`direct_reset`,`reset_card`])})]),ba=Rr.extend({entry:ya}),xa=zr.extend({contractVersion:e.literal(3),changes:e.array(ba)});function Sa(e){return ba.parse(e)}function Ca(e){return xa.parse(e)}const wa=`https://radarultra.com`,Ta=[`zh-Hans`,`zh-Hant`,`en`,`ja`,`ko`],Ea={"zh-Hans":`zh-hans`,"zh-Hant":`zh-hant`,en:`en`,ja:`ja`,ko:`ko`},Da={"zh-Hans":`/${Ea[`zh-Hans`]}`,"zh-Hant":`/${Ea[`zh-Hant`]}`,en:``,ja:`/${Ea.ja}`,ko:`/${Ea.ko}`},Oa=`/zh`,ka={reset:`/codex`,improvement:`/codex/28-day-challenge`,changelog:`/codex/changelog`,models:`/codex/models`,community:`/codex/community`},Aa=e.discriminatedUnion(`product`,[e.strictObject({product:e.literal(`cli`),version:e.string().regex(/^\d+\.\d+\.\d+$/)}),e.strictObject({product:e.literal(`app`),version:e.string().regex(/^\d{2}\.\d{3,4}$/)})]),ja=e.string().regex(/^(?!\.{1,2}$)[a-z0-9.-]+$/);function Ma(e,t){return wa+Da[t]+ka[e]}function Na(e,t){let n=t===`zh-Hans`?`/zh`:Da[t];return wa+n+ka[e]}function Pa(e,t,n){let r=Aa.parse({product:e,version:t});return`${Ma(`changelog`,n)}/${r.product}/${r.version}`}function Fa(e,t){return`${Ma(`models`,t)}/${ja.parse(e)}`}const Ia=Object.freeze({timeZone:`America/Los_Angeles`,startDate:`2026-10-05`,endDate:`2026-11-01`}),La=Date.parse(`${Ia.startDate}T00:00:00Z`),Ra=(Date.parse(`${Ia.endDate}T00:00:00Z`)-La)/864e5+1,za=new Intl.DateTimeFormat(`en-CA`,{timeZone:Ia.timeZone,year:`numeric`,month:`2-digit`,day:`2-digit`});function Ba(e){let t=za.formatToParts(e),n=e=>Number(t.find(t=>t.type===e).value),r=(Date.UTC(n(`year`),n(`month`)-1,n(`day`))-La)/864e5,i=r<0?`before`:r>=Ra?`ended`:`live`,a=Math.min(Ra,Math.max(1,r+1));return{phase:i,today:a,ongoingDay:i===`live`?a:null}}const Va=e.enum([`reset`,`improvement`]),Ha=e.array(Va).min(1).max(2).refine(e=>new Set(e).size===e.length,`notification_topic_duplicate`),Ua=e=>new Set(Ta.flatMap(t=>[Ma(e,t),Na(e,t)])),Wa={reset:Ua(`reset`),improvement:Ua(`improvement`)},Ga=t=>e.url().refine(e=>Wa[t].has(e),`notification_target_url_invalid`),Ka=e.url().refine(e=>Object.values(Wa).some(t=>t.has(e)),`notification_target_not_owned`),qa=e.discriminatedUnion(`kind`,[e.object({kind:e.literal(`reset`),webUrl:Ga(`reset`),miniPath:e.literal(`pages/index/index`)}).strict(),e.object({kind:e.literal(`improvement`),webUrl:Ga(`improvement`),miniPath:e.literal(`pages/index/index?page=challenge`)}).strict()]),Ja=e.object({topics:Ha,target:qa}).strict().refine(e=>e.topics.includes(e.target.kind),`notification_target_topic_mismatch`),Ya=e.enum([`reset`,`improvement`,`clue`]),Xa=e.object({topics:e.array(Ya).min(1).max(2).refine(e=>new Set(e).size===e.length,`notification_topic_duplicate`),target:qa}).strict().refine(e=>e.topics.some(t=>(t===`clue`?`reset`:t)===e.target.kind),`notification_target_topic_mismatch`);function Za(e,t){let n=Qa(e===`clue`?`reset`:e,t);return Xa.parse({...n,topics:[e],target:{...n.target,webUrl:Na(n.target.kind,t)}})}function Qa(e,t){return Ja.parse({topics:[e],target:{kind:e,webUrl:Ma(e,t),miniPath:e===`reset`?`pages/index/index`:`pages/index/index?page=challenge`}})}const $a=e.object({notificationId:e.uuid(),eventId:e.uuid(),title:e.string().trim().min(1).max(512),createdAt:e.iso.datetime(),deliverBy:e.iso.datetime(),...Ja.shape}).strict().superRefine((e,t)=>{e.topics.includes(e.target.kind)||t.addIssue({code:`custom`,message:`notification_target_topic_mismatch`}),w(e.deliverBy,e.createdAt)<=0&&t.addIssue({code:`custom`,message:`notification_task_deadline_invalid`})});function eo(e,t){return w(e.createdAt,t.createdAt)||(e.notificationId<t.notificationId?-1:+(e.notificationId>t.notificationId))}const to=`/api/v1/notification-tasks`,no=100,ro=e.string().min(1).max(8192),io=e.object({cursor:ro.optional()}).strict(),ao=e.object({contractVersion:e.literal(1),roundCursor:ro,notifications:e.array($a).max(100),nextCursor:ro.nullable()}).strict().superRefine((e,t)=>{new Set(e.notifications.map(e=>e.notificationId)).size!==e.notifications.length&&t.addIssue({code:`custom`,message:`notification_task_duplicate`});for(let n=1;n<e.notifications.length;n++)eo(e.notifications.at(n-1),e.notifications.at(n))>=0&&t.addIssue({code:`custom`,message:`notification_task_order_invalid`});e.nextCursor!==null&&e.notifications.length===0&&t.addIssue({code:`custom`,message:`notification_task_empty_continuation`})}),oo=`/api/browser-notifications`,so=e.string().min(1).max(128),co=e.uuid(),lo=e.enum(Ta),U=e.strictObject({reset:e.boolean(),improvement:e.boolean()}),uo=`[cdef][\\w-]{21}`,fo=e.strictObject({fid:e.string().regex(RegExp(`^${uo}$`))});function po(e){return e.replace(RegExp(`(^|[^\\w-])${uo}(?![\\w-])`,`g`),`$1[registration]`)}const W={operationId:co,expectedRevision:so},mo=e.discriminatedUnion(`action`,[e.strictObject({...W,action:e.literal(`register`),topics:U.refine(e=>e.reset||e.improvement,`subscription_topic_required`),locale:lo,registration:fo}),e.strictObject({...W,action:e.literal(`set_topics`),topics:U}),e.strictObject({...W,action:e.literal(`set_locale`),locale:lo}),e.strictObject({...W,action:e.literal(`restore`),registration:fo}),e.strictObject({...W,action:e.literal(`retry`)}),e.strictObject({...W,action:e.literal(`cancel`)})]),ho=e.strictObject({operationId:co.optional(),expectedRevision:so.optional()}).refine(e=>e.operationId===void 0==(e.expectedRevision===void 0),`subscription_operation_reference_incomplete`),go=e.strictObject({code:e.enum([`invalid_request`,`identity_unavailable`,`origin_not_allowed`,`rate_limited`,`revision_conflict`,`operation_conflict`,`registration_conflict`,`dependency_unavailable`,`provider_rejected`,`provider_rate_limited`,`provider_unavailable`,`provider_timeout`,`internal_error`]),operationId:co.optional(),correlationId:e.uuid(),stage:e.string().min(1).max(128),saveOutcome:e.enum([`not_saved`,`unknown`]),reasonSummary:e.string().min(1).max(2048),retryable:e.boolean(),cause:e.record(e.string(),e.unknown())}),_o=e.strictObject({id:co,state:e.enum([`pending`,`applied`,`rejected`,`unknown`,`superseded`,`not_found`]),error:go.optional()}),vo=e.strictObject({topicSettings:e.strictObject({state:e.enum([`initial`,`saved`]),revision:so,topics:U,locale:lo.nullable()}),registrationState:e.enum([`none`,`ready`,`invalid`,`changing`]),registrationKey:e.string().regex(/^[a-f0-9]{64}$/).nullable(),manualRetryRequired:e.boolean(),operation:_o.nullable()});function yo(e,t){return{topics:t.action===`register`||t.action===`set_topics`?t.topics:e.topics,locale:t.action===`register`||t.action===`set_locale`?t.locale:e.locale}}const bo=e.strictObject({data:vo}),xo=e.strictObject({error:go});function So(e){return{topicSettings:{state:`initial`,revision:e,topics:{reset:!0,improvement:!1},locale:null},registrationState:`none`,registrationKey:null,manualRetryRequired:!1,operation:null}}const Co=U.extend({clue:e.boolean().default(!1)}),[wo,To,...Eo]=mo.options,Do=e.discriminatedUnion(`action`,[wo.extend({topics:Co.refine(e=>Object.values(e).some(Boolean),`subscription_topic_required`)}),To.extend({topics:Co}),...Eo]),Oo=vo.extend({topicSettings:vo.shape.topicSettings.extend({topics:Co})}),ko=e.strictObject({data:Oo});function Ao(e){return Oo.parse(So(e))}function jo(e){let{clue:t,...n}=e.topicSettings.topics;return vo.parse({...e,topicSettings:{...e.topicSettings,topics:n}})}function Mo(e,t){return e.action!==`register`&&e.action!==`set_topics`?e:{...e,topics:{...e.topics,clue:e.action!==`register`&&(e.topics.reset||e.topics.improvement)&&t.clue}}}const No=20,Po=2*1024*1024,Fo=`/api/v1/improvements`,Io=e.string().min(1).max(1024),[Lo]=da.shape.unassignedEntries.element.options,Ro=Lo.safeExtend({date:e.iso.date().refine(e=>e>Ia.endDate,`improvement_must_follow_campaign`)}),zo=e.strictObject({}),Bo=e.strictObject({challengeEnded:e.boolean(),observedAt:e.iso.datetime()}),Vo=e.strictObject({cursor:Io.nullable(),limit:e.literal(20)}),Ho=Bo.extend({entries:e.array(Ro).max(20),nextCursor:Io.nullable()}).superRefine((e,t)=>{new Set(e.entries.map(e=>e.eventId)).size!==e.entries.length&&t.addIssue({code:`custom`,path:[`entries`],message:`Duplicate improvement identity`})}),Uo=e.strictObject({eventIds:e.array(I).min(1).max(128)}),Wo=e.strictObject({eventIds:e.array(I).max(128)}),Go=e.strictObject({error:e.strictObject({code:e.enum([`invalid_request`,`dependency_unavailable`,`internal_error`]),message:e.string(),requestId:e.uuid(),operation:e.string(),stage:e.string(),cause:e.record(e.string(),e.unknown())})}),Ko=`/tibo-source/v1/latest.json`,qo=512*1024,Jo=e.iso.datetime({offset:!0}),Yo=S.shape.noticeTimeline.element,Xo=e.strictObject({contractVersion:e.literal(1),observedAt:Jo,check:e.strictObject({checkedAt:Jo,freshUntil:Jo,active:e.boolean()}).nullable(),latestPost:e.strictObject({authoredAt:Jo,sourceUrl:Yo.shape.sourceUrl,sourceText:e.string(),sourceTranslations:Jr,resetRelevance:e.enum([`related`,`unrelated`,`unknown`])}).nullable()});async function Zo(e){let t=e.body?.getReader();if(t===void 0)throw Error(`tibo_source_status_body_missing`,{cause:{status:e.status}});let n=[],r=0;try{for(;;){let i=await t.read();if(i.done)break;if(r+=i.value.byteLength,r>524288)throw Error(`tibo_source_status_too_large`,{cause:{status:e.status,bytes:r}});n.push(i.value)}}finally{try{await t.cancel()}catch{}t.releaseLock()}let i=new Uint8Array(r),a=0;for(let e of n)i.set(e,a),a+=e.byteLength;let o=new TextDecoder(`utf-8`,{fatal:!0}).decode(i);if(!e.ok)throw Error(`tibo_source_status_http_error`,{cause:{status:e.status,upstream:o.slice(0,4e3)}});return Xo.parse(JSON.parse(o))}const Qo=`/reset-clue/v1/latest.json`,$o=4320*60*1e3,es=i.exportUtf8Bytes,ts=z.shape.noticeTimeline.element.pick({authoredAt:!0,sourceUrl:!0,sourceText:!0,sourceTranslations:!0,contentCompleteness:!0}).extend({plannedTiming:Le.nullable(),expiresAt:z.shape.noticeTimeline.element.shape.authoredAt}).strict().superRefine((e,t)=>{Date.parse(e.expiresAt)!==Date.parse(e.authoredAt)+2592e5&&t.addIssue({code:`custom`,message:`reset_clue_expiry_mismatch`,path:[`expiresAt`]})}),ns=e.strictObject({contractVersion:e.literal(1),clue:ts.nullable()}),rs=e=>ns.parse(e);function is(e,t){return e.clue!==null&&t.getTime()<Date.parse(e.clue.expiresAt)?e.clue:null}async function as(e){let t=e.body?.getReader();if(t===void 0)throw Error(`reset_clue_body_missing`,{cause:{status:e.status}});let n=[],r=0;try{for(;;){let i=await t.read();if(i.done)break;if(r+=i.value.byteLength,r>es)throw Error(`reset_clue_too_large`,{cause:{status:e.status,bytes:r}});n.push(i.value)}}finally{try{await t.cancel()}catch{}t.releaseLock()}let i=new Uint8Array(r),a=0;for(let e of n)i.set(e,a),a+=e.byteLength;let o=new TextDecoder(`utf-8`,{fatal:!0}).decode(i);if(!e.ok)throw Error(`reset_clue_http_error`,{cause:{status:e.status,upstream:o.slice(0,4e3)}});return rs(JSON.parse(o))}const G=e.enum(Ta),K=e.string().regex(/^\d{4}-(?:0[1-9]|1[0-2])$/),q=e.string().trim().min(1),os=e.url({protocol:/^https$/}),J=e.discriminatedUnion(`kind`,[e.strictObject({kind:e.literal(`instant`),at:e.iso.datetime()}),e.strictObject({kind:e.literal(`date`),date:e.iso.date()})]),ss=e.strictObject({operation:q,stage:q,cause:Kt});function cs(t){return e.discriminatedUnion(`state`,[e.strictObject({state:e.literal(`ready`),value:t}),e.strictObject({state:e.literal(`pending`)}),e.strictObject({state:e.literal(`failed`),failure:ss})])}function Y(e,t){return e.superRefine((e,n)=>{new TextEncoder().encode(JSON.stringify(e)).byteLength>t&&n.addIssue({code:`custom`,message:`publication_utf8_size_limit_exceeded`})})}async function X(e,t,n,r){let i=e.body?.getReader();if(i===void 0)throw Error(`${t}_body_missing`,{cause:{operation:t,stage:`read`,status:e.status}});let a=[],o=0;try{for(;;){let e=await i.read();if(e.done)break;if(o+=e.value.byteLength,o>n)throw Error(`publication_utf8_size_limit_exceeded`);a.push(e.value)}}catch(n){throw Error(`${t}_read_failed`,{cause:{operation:t,stage:`read`,status:e.status,bytes:o,cause:n}})}finally{try{await i.cancel()}catch{}i.releaseLock()}let s=new Uint8Array(o),c=0;for(let e of a)s.set(e,c),c+=e.byteLength;let l;try{l=new TextDecoder(`utf-8`,{fatal:!0}).decode(s)}catch(n){throw Error(`${t}_decode_failed`,{cause:{operation:t,stage:`decode`,status:e.status,cause:n}})}if(!e.ok)throw Error(`${t}_http_error`,{cause:{operation:t,stage:`http`,status:e.status,upstream:l.slice(0,4e3)}});try{return r.parse(JSON.parse(l))}catch(n){throw Error(`${t}_parse_failed`,{cause:{operation:t,stage:`parse`,status:e.status,cause:n}})}}const ls=`/codex-releases/v2/directory.json`,us=128*1024,ds=128*1024,fs=256*1024,ps=J,ms={product:e.enum([`app`,`cli`]),version:q,published:J,month:K,revision:q},hs=e.strictObject(ms).superRefine(gs);function gs(e,t){let n=Aa.safeParse({product:e.product,version:e.version});if(!n.success)for(let e of n.error.issues)t.addIssue({...e});e.product===`cli`!=(e.published.kind===`instant`)&&t.addIssue({code:`custom`,path:[`published`],message:`product_date_precision_mismatch`}),(e.published.kind===`instant`?e.published.at:e.published.date).slice(0,7)!==e.month&&t.addIssue({code:`custom`,path:[`month`],message:`published_month_mismatch`})}function _s(e,t){let n=new Set,r=1/0;for(let[i,a]of e.entries()){let e=`${a.product}/${a.version}`;n.has(e)&&t.addIssue({code:`custom`,path:[`releases`,i],message:`duplicate_release_identity`}),n.add(e);let o=Date.parse(a.published.kind===`instant`?a.published.at:`${a.published.date}T00:00:00Z`);o>r&&t.addIssue({code:`custom`,path:[`releases`,i],message:`release_order_mismatch`}),r=o}}const vs=Y(e.strictObject({contractVersion:e.literal(2),releases:e.array(hs),latest:e.strictObject({app:e.string().nullable(),cli:e.string().nullable()})}).superRefine((e,t)=>{_s(e.releases,t);for(let n of[`app`,`cli`]){let r=e.releases.find(e=>e.product===n)?.version??null;e.latest[n]!==r&&t.addIssue({code:`custom`,path:[`latest`,n],message:`latest_release_mismatch`})}}),us),ys=e.strictObject({state:e.literal(`not_applicable`),reason:e.literal(`no_curated_notes`)}),bs=e.union([cs(e.strictObject({locale:G,points:e.array(q).min(1).max(5)})),ys]),xs=e.strictObject({...ms,source:e.strictObject({kind:e.enum([`github`,`official`]),url:os}),summary:bs,notesCount:e.number().int().nonnegative()}).superRefine((e,t)=>{gs(e,t),e.product===`cli`!=(e.source.kind===`github`)&&t.addIssue({code:`custom`,path:[`source`,`kind`],message:`product_source_mismatch`}),e.notesCount===0!=(e.summary.state===`not_applicable`)&&t.addIssue({code:`custom`,path:[`summary`],message:`curated_notes_summary_state_mismatch`})}),Ss=Y(e.strictObject({contractVersion:e.literal(2),locale:G,month:K,releases:e.array(xs)}).superRefine((e,t)=>{_s(e.releases,t);for(let[n,r]of e.releases.entries())r.month!==e.month&&t.addIssue({code:`custom`,path:[`releases`,n,`month`],message:`file_month_mismatch`}),r.summary.state===`ready`&&r.summary.value.locale!==e.locale&&r.summary.value.locale!==`en`&&t.addIssue({code:`custom`,path:[`releases`,n,`summary`,`value`,`locale`],message:`summary_locale_mismatch`})}),ds),Cs=e.array(e.strictObject({title:q.nullable(),items:e.array(e.strictObject({text:q,refs:q.nullable()})).min(1)})).min(1),ws=Y(e.strictObject({contractVersion:e.literal(2),product:e.enum([`app`,`cli`]),version:q,revision:q,locale:G,original:e.array(Cs.element),translation:e.union([cs(Cs),ys]).nullable()}).superRefine((e,t)=>{let n=Aa.safeParse({product:e.product,version:e.version});if(!n.success)for(let e of n.error.issues)t.addIssue({...e});if(e.locale===`en`!=(e.translation===null)&&t.addIssue({code:`custom`,path:[`translation`],message:`translation_locale_mismatch`}),e.locale!==`en`&&e.original.length===0!=(e.translation?.state===`not_applicable`)&&t.addIssue({code:`custom`,path:[`translation`],message:`curated_notes_translation_state_mismatch`}),e.translation?.state===`ready`){let n=e.translation.value;(n.length!==e.original.length||e.original.some((e,t)=>{let r=n.at(t);return r===void 0||e.title===null!=(r.title===null)||e.items.length!==r.items.length||e.items.some((e,t)=>e.refs!==r.items.at(t)?.refs)}))&&t.addIssue({code:`custom`,path:[`translation`],message:`translation_structure_mismatch`})}}),fs),Ts=e=>vs.parse(e),Es=e=>Ss.parse(e),Ds=e=>ws.parse(e),Os=e=>X(e,`codex_release_directory`,us,vs),ks=e=>X(e,`codex_release_month`,ds,Ss),As=e=>X(e,`codex_release_notes`,fs,ws);function js(e,t){return`/codex-releases/v2/${G.parse(e)}/${K.parse(t)}.json`}function Ms(e,t,n){let r=Aa.parse({product:t,version:n});return`/codex-releases/v2/${G.parse(e)}/notes/${r.product}/${r.version}.json`}const Ns=128*1024;function Z(t){return e.discriminatedUnion(`state`,[e.strictObject({state:e.literal(`known`),value:t,source:os}),e.strictObject({state:e.literal(`unavailable`),reason:e.enum([`not_announced`,`not_listed`]),source:os.nullable()})])}const Ps=e.strictObject({input:q,cached:q,output:q}),Fs=e.strictObject({modelId:ja,name:q,group:e.enum([`current`,`retired`]),status:e.enum([`available`,`retiring`,`retired`]),launched:Z(J),chatgptRetirement:Z(J),apiRetirement:Z(J),credits:Z(Ps),apiPrice:Z(Ps),multiple:e.string().regex(/^(?:0|[1-9]\d*)(?:\.\d+)?$/).refine(e=>Number.isFinite(Number(e))&&Number(e)>0).nullable(),plans:Z(e.array(q).min(1)),surfaces:Z(e.array(q).min(1)),about:cs(e.strictObject({locale:G,paragraphs:e.array(q).min(1)})),sources:e.array(e.strictObject({label:q,url:os})).min(1)}).superRefine((e,t)=>{e.status===`retired`!=(e.group===`retired`)&&t.addIssue({code:`custom`,path:[`group`],message:`model_group_status_mismatch`}),e.status===`retiring`&&e.chatgptRetirement.state!==`known`&&t.addIssue({code:`custom`,path:[`chatgptRetirement`],message:`retiring_model_requires_announced_date`})}),Is=Y(e.strictObject({contractVersion:e.literal(1),locale:G,models:e.array(Fs),multipleBase:e.strictObject({modelId:ja,name:q}).nullable(),upcomingRetirement:e.strictObject({names:q,modelIds:e.array(ja).min(1),surface:e.enum([`api`,`chatgpt`]),at:J}).nullable()}).superRefine((e,t)=>{let n=new Set;for(let[r,i]of e.models.entries())n.has(i.modelId)&&t.addIssue({code:`custom`,path:[`models`,r,`modelId`],message:`duplicate_model_identity`}),n.add(i.modelId),i.about.state===`ready`&&i.about.value.locale!==e.locale&&i.about.value.locale!==`en`&&t.addIssue({code:`custom`,path:[`models`,r,`about`,`value`,`locale`],message:`model_description_locale_mismatch`}),i.multiple!==null&&(e.multipleBase===null||i.credits.state!==`known`)&&t.addIssue({code:`custom`,path:[`models`,r,`multiple`],message:`multiple_requires_base_and_credits`});if(e.multipleBase!==null){let n=e.models.find(t=>t.modelId===e.multipleBase?.modelId);(n===void 0||n.group!==`current`||n.credits.state!==`known`||n.multiple!==`1`||n.name!==e.multipleBase.name)&&t.addIssue({code:`custom`,path:[`multipleBase`],message:`multiple_base_mismatch`})}let r=e.upcomingRetirement;if(r!==null){new Set(r.modelIds).size!==r.modelIds.length&&t.addIssue({code:`custom`,path:[`upcomingRetirement`,`modelIds`],message:`duplicate_retirement_model`});for(let n of r.modelIds){let i=e.models.find(e=>e.modelId===n),a=r.surface===`api`?i?.apiRetirement:i?.chatgptRetirement;(a?.state!==`known`||JSON.stringify(a.value)!==JSON.stringify(r.at))&&t.addIssue({code:`custom`,path:[`upcomingRetirement`],message:`retirement_model_date_mismatch`})}}}),Ns),Ls=e=>Is.parse(e),Rs=e=>X(e,`codex_models`,Ns,Is),zs=e=>`/codex-models/v1/${G.parse(e)}.json`,Bs=256*1024,Vs=512*1024,Hs=3600*1e3,Q=e.string().regex(/^[a-z][a-z0-9-]{0,63}$/),Us=e.enum([`x`,`hn`,`github`,`v2ex`,`reddit`,`linuxdo`]),Ws=e.enum([`debate`,`tip`,`showcase`,`comparison`,`news`]),$=e.string().trim().min(1),Gs=e.strictObject({id:$,topic:Q,platform:Us,kind:Ws,url:os,author:e.strictObject({name:$,handle:$.nullable()}),venue:$.nullable(),title:$.nullable(),summary:e.strictObject({zh:$.max(600),en:$.max(600)}),authoredAt:e.iso.datetime(),heat:e.strictObject({metrics:e.array(e.strictObject({kind:e.enum([`likes`,`points`,`comments`,`reactions`,`replies`]),value:e.number().int().nonnegative()})).min(1),ratio:e.number().finite().nonnegative()}).nullable()}).superRefine((e,t)=>{(!e.id.startsWith(`${e.platform}:`)||e.id.length<=e.platform.length+1)&&t.addIssue({code:`custom`,path:[`id`],message:`entry_platform_identity_mismatch`})});function Ks(e,t){let n=new Set,r=1/0;for(let[i,a]of e.entries.entries()){n.has(a.id)&&t.addIssue({code:`custom`,path:[`entries`,i],message:`duplicate_entry`}),n.add(a.id),a.topic!==e.topic&&t.addIssue({code:`custom`,path:[`entries`,i],message:`entry_topic_mismatch`});let o=Date.parse(a.authoredAt);o>r&&t.addIssue({code:`custom`,path:[`entries`,i],message:`entry_order_mismatch`}),r=o}}const qs=e.strictObject({id:$,platform:Us,label:$,lastSuccessAt:e.iso.datetime().nullable()}),Js=Y(e.strictObject({contractVersion:e.literal(1),topic:Q,generatedAt:e.iso.datetime(),overview:e.strictObject({weekCount:e.number().int().nonnegative(),debateCount:e.number().int().nonnegative(),hottestId:$.nullable()}),sources:e.array(qs),coverage:e.strictObject({from:e.iso.date(),months:e.array(K)}),entries:e.array(Gs)}).superRefine((e,t)=>{Ks(e,t);let n=Date.parse(e.generatedAt),r=e.entries.filter(e=>Date.parse(e.authoredAt)>=n-7*864e5),i=[...r].sort(nc).at(0)?.id??null;(e.overview.weekCount!==r.length||e.overview.debateCount!==r.filter(e=>e.kind===`debate`).length||e.overview.hottestId!==i)&&t.addIssue({code:`custom`,path:[`overview`],message:`overview_entries_mismatch`}),new Set(e.sources.map(e=>e.id)).size!==e.sources.length&&t.addIssue({code:`custom`,path:[`sources`],message:`duplicate_source`}),(new Set(e.coverage.months).size!==e.coverage.months.length||e.coverage.months.some((t,n)=>n>0&&t>=e.coverage.months.at(n-1)))&&t.addIssue({code:`custom`,path:[`coverage`],message:`coverage_order_mismatch`});for(let r of e.entries){let i=Date.parse(r.authoredAt);(i>n||i<n-30*864e5||!e.coverage.months.includes(r.authoredAt.slice(0,7))||r.authoredAt.slice(0,10)<e.coverage.from)&&t.addIssue({code:`custom`,path:[`entries`],message:`entry_coverage_mismatch`})}}),Bs),Ys=Y(e.strictObject({contractVersion:e.literal(1),topic:Q,month:K,entries:e.array(Gs)}).superRefine((e,t)=>{Ks(e,t),e.entries.some(t=>t.authoredAt.slice(0,7)!==e.month)&&t.addIssue({code:`custom`,path:[`entries`],message:`entry_month_mismatch`})}),Vs),Xs=e=>`/community-trending/v1/${Q.parse(e)}/latest.json`,Zs=(e,t)=>`/community-trending/v1/${Q.parse(e)}/${K.parse(t)}.json`,Qs=e=>Js.parse(e),$s=e=>Ys.parse(e),ec=e=>X(e,`community_trending_latest`,Bs,Js),tc=e=>X(e,`community_trending_month`,Vs,Ys);function nc(e,t){return e.heat===null&&t.heat!==null?1:e.heat!==null&&t.heat===null?-1:(t.heat?.ratio??0)-(e.heat?.ratio??0)||t.authoredAt.localeCompare(e.authoredAt)||e.id.localeCompare(t.id)}const rc=(e,t)=>e.summary[t===`zh-Hans`?`zh`:`en`],ic=e.object({revision:e.string().min(1).max(160),digest:e.string().regex(/^[a-f0-9]{64}$/)}).strict(),ac=e.discriminatedUnion(`kind`,[e.object({publicationId:e.string().min(1).max(160),kind:e.literal(`content`),sources:e.object({"reset-v1":ic,"reset-v2":ic,"reset-v3":ic,"reset-v4":ic.optional()}).strict()}).strict(),e.object({publicationId:e.string().min(1).max(160),kind:e.literal(`reset-clue`),sources:e.object({"reset-clue":ic}).strict()}).strict()]),oc=e.object({resource:e.enum([`content-v1`,`content-v2`,`content-v3`,`content-v4`,`reset-clue`]),sourceRevision:e.string().min(1).max(160),sourceDigest:e.string().regex(/^[a-f0-9]{64}$/),targetVersion:e.iso.datetime().nullable(),targetDigest:e.string().regex(/^[a-f0-9]{64}$/).nullable(),outcome:e.enum([`published`,`unchanged`,`busy`,`superseded`,`failed`]),error:e.object({operation:e.string().min(1),stage:e.string().min(1),code:e.string().min(1),summary:e.string().min(1),correlationId:e.string().min(1),cause:e.unknown(),upstreamStatus:e.number().int().optional(),upstreamCode:e.string().optional()}).strict().optional()}).strict().superRefine((e,t)=>{(e.outcome===`published`||e.outcome===`unchanged`)&&(e.targetVersion===null||e.targetDigest===null)&&t.addIssue({code:`custom`,message:`completed publication requires a target receipt`}),e.outcome===`failed`&&e.error===void 0&&t.addIssue({code:`custom`,message:`failed publication requires a cause`})}),sc=e.object({publicationId:e.string().min(1).max(160),results:e.array(oc).min(1).max(4)}).strict().superRefine((e,t)=>{new Set(e.results.map(e=>e.resource)).size!==e.results.length&&t.addIssue({code:`custom`,message:`duplicate resource`})}),cc=`/api/v1/internal/publications/wechat/dispatch`,lc=`/__radar/wechat-publication/dispatch`,uc=gi.shape.generatedAt,dc=hi.shape.records.element,fc=e.strictObject({id:e.string().min(1),resetActionId:dc.shape.resetActionId,at:uc,effects:e.array(dc.shape.effect).min(1).max(2),source:e.discriminatedUnion(`kind`,[e.strictObject({kind:e.literal(`official_post`),sourceUrl:dc.shape.sourceUrl}),e.strictObject({kind:e.literal(`manual`),officialConfirmationMissing:e.boolean()})])}),pc=e.strictObject(hi.shape).extend({records:e.array(e.strictObject(dc.shape).extend({sourceUrl:dc.shape.sourceUrl.nullable(),confirmationId:e.string().min(1).nullable()})).max(i.analysis.actions*2)}).superRefine((e,t)=>{mi(e,t);for(let[n,r]of e.records.entries())r.basis===`execution_confirmation`!=(r.confirmationId!==null)&&t.addIssue({code:`custom`,message:`statistics_confirmation_identity_mismatch`,path:[`records`,n]}),r.basis===`announcement`&&r.sourceUrl===null&&t.addIssue({code:`custom`,message:`statistics_announcement_source_missing`,path:[`records`,n]})}),mc=e.strictObject({sourceWatermark:re.shape.sourceWatermark,confirmations:e.array(fc),statistics:pc}),hc=e.strictObject(gi.shape).extend({contractVersion:e.literal(4),statistics:pc,confirmations:e.array(fc)}).superRefine((e,t)=>{let n=e=>t.addIssue({code:`custom`,message:e});new TextEncoder().encode(JSON.stringify(e)).byteLength>i.exportUtf8Bytes&&n(`export_utf8_size_limit_exceeded`);let r=new Map(e.confirmations.map(e=>[e.id,e])),a=new Map(e.actions.map(e=>[e.resetActionId,e]));a.size!==e.actions.length&&n(`export_action_identity_duplicate`),new Set(e.pendingResetActions.map(e=>e.resetActionId)).size!==e.pendingResetActions.length&&n(`export_pending_action_identity_duplicate`);let o=new Set(e.statistics.records.map(e=>e.resetActionId));for(let[t,r]of e.actions.entries()){Date.parse(r.firstAnnouncedAt)>Date.parse(e.generatedAt)&&n(`export_action_after_snapshot`);let i=e.actions.at(t-1);t>0&&i!==void 0&&uc.safeParse(i.firstAnnouncedAt).success&&uc.safeParse(r.firstAnnouncedAt).success&&He(i,r)>0&&n(`export_actions_not_stably_sorted`),Date.parse(r.firstAnnouncedAt)>=Date.parse(e.statistics.startAt)&&!o.has(r.resetActionId)&&n(`export_statistics_window_action_missing`)}r.size!==e.confirmations.length&&t.addIssue({code:`custom`,message:`confirmation_identity_duplicate`});for(let r of e.confirmations){let i=a.get(r.resetActionId);(i===void 0||Date.parse(r.at)>Date.parse(e.generatedAt))&&t.addIssue({code:`custom`,message:`confirmation_action_or_time_invalid`}),(new Set(r.effects).size!==r.effects.length||r.effects.some(e=>i!==void 0&&(e===null!=(i.resetEffects.state===`unknown`)||e!==null&&!i.resetEffects.values.some(t=>t===e))))&&n(`confirmation_effect_mismatch`);let o=r.source;o.kind===`official_post`&&!i?.noticeTimeline.some(e=>e.phase===`executed`&&e.sourceUrl===o.sourceUrl&&e.authoredAt===r.at)&&t.addIssue({code:`custom`,message:`confirmation_official_source_invalid`})}for(let i of e.statistics.records){let o=a.get(i.resetActionId),s=i.confirmationId===null?void 0:r.get(i.confirmationId);Date.parse(i.at)>Date.parse(e.generatedAt)&&n(`export_statistics_record_after_snapshot`),o!==void 0&&(o.resetEffects.state===`unknown`!=(i.effect===null)||i.effect!==null&&!o.resetEffects.values.some(e=>e===i.effect))&&n(`export_statistics_effect_mismatch`),(o===void 0||i.confirmationId!==null&&(s===void 0||s.resetActionId!==i.resetActionId||s.at!==i.at||!s.effects.includes(i.effect)))&&t.addIssue({code:`custom`,message:`statistics_confirmation_missing_or_mismatched`}),s!==void 0&&i.sourceUrl!==(s.source.kind===`official_post`?s.source.sourceUrl:null)&&n(`statistics_confirmation_source_mismatch`),i.basis===`announcement`&&!o?.noticeTimeline.some(e=>e.sourceUrl===i.sourceUrl&&e.authoredAt===i.at&&o.firstAnnouncedAt===i.at)&&t.addIssue({code:`custom`,message:`statistics_announcement_source_invalid`})}}),gc=e=>hc.parse(e);export{on as RadarResetSourceContractErrorV2,is as activeRadarResetClue,nc as compareRadarCommunityTrendingEntries,eo as compareRadarNotificationTasks,He as compareRadarResetActionDetailsV1,w as compareRadarResetUtcTimestampsV1,Za as createRadarBrowserNotificationProjection,Ba as createRadarCodexProgressCalendar,Qa as createRadarNotificationProjection,Dn as createRadarResetSourceErrorEnvelopeV2,Nr as encodeRadarActivityFile,Fr as encodeRadarActivityFileV2,va as encodeRadarActivityFileV3,hn as encodeRadarResetDetailMultipartV2,Pr as encodeRadarTitledActivityFile,ct as formatRadarResetPositiveDecimalV2,st as formatRadarResetUInt64DecimalV2,So as initialRadarBrowserSubscription,Ao as initialRadarBrowserSubscriptionV2,Ls as parseRadarCodexModels,Sa as parseRadarCodexProgressChangeV3,Ca as parseRadarCodexProgressChangesV3,jn as parseRadarCodexProgressV1,Bn as parseRadarCodexProgressV2,Yn as parseRadarCodexProgressV3,er as parseRadarCodexProgressV4,ra as parseRadarCodexProgressV5,Ts as parseRadarCodexReleaseDirectory,Es as parseRadarCodexReleaseMonth,Ds as parseRadarCodexReleaseNotes,Qs as parseRadarCommunityTrendingLatest,$s as parseRadarCommunityTrendingMonth,We as parseRadarResetActionDetailV1,ri as parseRadarResetActionDetailV2,bi as parseRadarResetActionDetailV3,xt as parseRadarResetActionSummaryV2,Ue as parseRadarResetAnalysisV1,rs as parseRadarResetClueSnapshot,bn as parseRadarResetDetailMultipartV2,Ge as parseRadarResetExportV1,ai as parseRadarResetExportV2,vi as parseRadarResetExportV3,gc as parseRadarResetExportV4,Ke as parseRadarResetPendingActionV1,ii as parseRadarResetPendingActionV2,at as parseRadarResetPositiveDecimalV2,Ct as parseRadarResetPublicationHomeFactsV2,an as parseRadarResetPublicationRevisionAvailableV2,Zt as parseRadarResetReadActionsRequestV2,tn as parseRadarResetReadActionsSuccessV2,Qt as parseRadarResetReadChangesRequestV2,nn as parseRadarResetReadChangesSuccessV2,$t as parseRadarResetReadDetailBatchRequestV2,Xt as parseRadarResetReadHeadRequestV2,en as parseRadarResetReadHeadSuccessV2,ie as parseRadarResetSnapshotAvailableV1,rn as parseRadarResetSourceErrorEnvelopeV2,it as parseRadarResetUInt64DecimalV2,yo as projectRadarBrowserSubscriptionSelection,jo as projectRadarBrowserSubscriptionV1,oi as projectRadarResetExportV1FromV2,yi as projectRadarResetExportV3FromV2,qe as projectRadarResetPrimarySourceV1,Ti as projectRadarResetPublicActionToV2,I as radarActivityEventIdSchema,R as radarActivityFileSchema,or as radarActivityFileUrl,kr as radarActivityFileV2Schema,sr as radarActivityFileV2Url,ga as radarActivityFileV3Schema,ia as radarActivityFileV3Url,L as radarActivityMaxBytes,dr as radarActivityProgressSchema,Er as radarActivityProgressV2Schema,da as radarActivityProgressV3Schema,fr as radarActivityReactionCountsSchema,ar as radarActivityReactionIdSchema,F as radarActivityReactionIds,Na as radarBrowserNotificationPageUrl,Xa as radarBrowserNotificationProjectionSchema,Ka as radarBrowserNotificationTargetUrlSchema,Ya as radarBrowserNotificationTopicSchema,fo as radarBrowserRegistrationSchema,xo as radarBrowserSubscriptionErrorRes,go as radarBrowserSubscriptionFailureSchema,_o as radarBrowserSubscriptionOperationSchema,ho as radarBrowserSubscriptionReadReq,bo as radarBrowserSubscriptionRes,mo as radarBrowserSubscriptionSaveReq,Do as radarBrowserSubscriptionSaveV2Req,ko as radarBrowserSubscriptionV2Res,vo as radarBrowserSubscriptionViewSchema,Oo as radarBrowserSubscriptionViewV2Schema,oo as radarBrowserSubscriptionsPath,U as radarBrowserTopicsSchema,Co as radarBrowserTopicsV2Schema,Hr as radarCodexGuessChoiceSchema,qr as radarCodexGuessErrorSchema,Ur as radarCodexGuessSaveReqSchema,Kr as radarCodexGuessViewSchema,ja as radarCodexModelIdSchema,Fa as radarCodexModelUrl,Ns as radarCodexModelsMaxBytes,zs as radarCodexModelsPath,Is as radarCodexModelsSchema,Ia as radarCodexProgressCalendar,Ir as radarCodexProgressChangeSchema,Rr as radarCodexProgressChangeV2Schema,ba as radarCodexProgressChangeV3Schema,Lr as radarCodexProgressChangesV1Schema,zr as radarCodexProgressChangesV2Schema,xa as radarCodexProgressChangesV3Schema,j as radarCodexProgressEntrySchema,Hn as radarCodexProgressEntryV3Schema,Zi as radarCodexProgressEntryV5Schema,Yi as radarCodexProgressImprovementV5Schema,Gi as radarCodexProgressPostRoleV5Schema,Ki as radarCodexProgressPostV5Schema,qi as radarCodexProgressPostsV5Schema,Xi as radarCodexProgressResetEntryV5Schema,Jn as radarCodexProgressScore,N as radarCodexProgressTitleV3Schema,M as radarCodexProgressV1Schema,Nn as radarCodexProgressV2MaxBytes,zn as radarCodexProgressV2Schema,Vn as radarCodexProgressV3MaxBytes,qn as radarCodexProgressV3Schema,Xn as radarCodexProgressV4MaxBytes,P as radarCodexProgressV4Schema,Ji as radarCodexProgressV5MaxBytes,na as radarCodexProgressV5Schema,us as radarCodexReleaseDirectoryMaxBytes,ls as radarCodexReleaseDirectoryPath,vs as radarCodexReleaseDirectorySchema,Aa as radarCodexReleaseIdentitySchema,ds as radarCodexReleaseMonthMaxBytes,js as radarCodexReleaseMonthPath,Ss as radarCodexReleaseMonthSchema,fs as radarCodexReleaseNotesMaxBytes,Ms as radarCodexReleaseNotesPath,ws as radarCodexReleaseNotesSchema,Cs as radarCodexReleaseSectionsSchema,Pa as radarCodexReleaseUrl,ps as radarCodexTimePointSchema,Gs as radarCommunityTrendingEntrySchema,Ws as radarCommunityTrendingKindSchema,Bs as radarCommunityTrendingLatestMaxBytes,Xs as radarCommunityTrendingLatestPath,Js as radarCommunityTrendingLatestSchema,Vs as radarCommunityTrendingMonthMaxBytes,Zs as radarCommunityTrendingMonthPath,Ys as radarCommunityTrendingMonthSchema,Us as radarCommunityTrendingPlatformSchema,qs as radarCommunityTrendingSourceSchema,Hs as radarCommunityTrendingSourceStaleMs,rc as radarCommunityTrendingSummary,Q as radarCommunityTrendingTopicSchema,Fo as radarImprovementColumnPath,Uo as radarImprovementEligibilityReq,Wo as radarImprovementEligibilityRes,Ro as radarImprovementEntrySchema,Go as radarImprovementErrorRes,zo as radarImprovementHeadReq,Bo as radarImprovementHeadRes,Po as radarImprovementPageMaxBytes,Vo as radarImprovementPageReq,Ho as radarImprovementPageRes,No as radarImprovementPageSize,Ja as radarNotificationProjectionSchema,qa as radarNotificationTargetSchema,no as radarNotificationTaskPageSize,$a as radarNotificationTaskSchema,to as radarNotificationTasksPath,io as radarNotificationTasksReq,ao as radarNotificationTasksRes,Va as radarNotificationTopicSchema,Ha as radarNotificationTopicsSchema,S as radarResetActionDetailV1Schema,z as radarResetActionDetailV2Schema,si as radarResetActionDetailV3Schema,Ot as radarResetActionItemV2Schema,Ze as radarResetActionPageMaxBytesV2,Xe as radarResetActionPageMaxItemsV2,bt as radarResetActionSummaryV2Schema,Et as radarResetActiveActionItemV2Schema,Me as radarResetAnalysisV1Schema,r as radarResetAnalyzerContractVersionV1,c as radarResetAudienceValues,It as radarResetChangeCoverageV2Schema,$e as radarResetChangePageMaxBytesV2,Qe as radarResetChangePageMaxItemsV2,$o as radarResetClueLifetimeMs,es as radarResetClueMaxBytes,Qo as radarResetCluePath,ts as radarResetClueSchema,ns as radarResetClueSnapshotSchema,fc as radarResetConfirmationSchema,mc as radarResetConfirmationsResponseSchema,n as radarResetContractVersionV1,Je as radarResetContractVersionV2,tt as radarResetDetailBatchMaxBytesV2,et as radarResetDetailBatchMaxChunksV2,wt as radarResetDetailChunkReferenceV2Schema,Mt as radarResetDetailChunkRequestV2Schema,Tt as radarResetDetailManifestV2Schema,o as radarResetEffectValues,Ve as radarResetExportV1Schema,V as radarResetExportV2Schema,gi as radarResetExportV3Schema,hc as radarResetExportV4Schema,Zr as radarResetKindNoticeV2Schema,Vi as radarResetManagementActionSchema,Fi as radarResetManagementOperationSchema,Hi as radarResetManagementResSchema,Bi as radarResetManualApplyReqSchema,Pi as radarResetManualCopySchema,Ii as radarResetManualDraftSchema,Ri as radarResetManualDraftSeedSchema,Li as radarResetManualPreviewReqSchema,zi as radarResetManualPreviewResSchema,Ui as radarResetManualResultResSchema,Ie as radarResetNoticeKindValues,C as radarResetPendingActionV1Schema,B as radarResetPendingActionV2Schema,l as radarResetPlanValues,T as radarResetPositiveDecimalV2Schema,s as radarResetProductValues,Di as radarResetPublicActionV1Schema,i as radarResetPublicDataLimits,D as radarResetPublicIdV2Schema,xi as radarResetPublicRecordsCorePath,ji as radarResetPublicRecordsV1Schema,St as radarResetPublicationHomeFactsV2Schema,Yt as radarResetPublicationRevisionAvailableV2Schema,Le as radarResetPublicationTimingSchema,Rt as radarResetReadActionsDataV2Schema,At as radarResetReadActionsRequestV2Schema,Ht as radarResetReadActionsSuccessV2Schema,zt as radarResetReadChangesDataV2Schema,jt as radarResetReadChangesRequestV2Schema,Ut as radarResetReadChangesSuccessV2Schema,Nt as radarResetReadDetailBatchRequestV2Schema,Lt as radarResetReadHeadDataV2Schema,kt as radarResetReadHeadRequestV2Schema,Vt as radarResetReadHeadSuccessV2Schema,d as radarResetReasonBasisValues,u as radarResetReasonCategoryValues,Kt as radarResetSafeCauseSnapshotV2Schema,a as radarResetSeriesValues,O as radarResetSha256V2Schema,re as radarResetSnapshotAvailableV1Schema,Ft as radarResetSourceChangeV2Schema,Wt as radarResetSourceErrorCodeValuesV2,Jt as radarResetSourceErrorEnvelopeV2Schema,En as radarResetSourceErrorHttpStatusV2,Tn as radarResetSourceErrorIsRetryableV2,qt as radarResetSourceErrorV2Schema,Ye as radarResetSourceMaxRpcCallsV2,Jr as radarResetSourceTranslationsSchema,_i as radarResetStatisticsResponseV3Schema,hi as radarResetStatisticsV1Schema,pc as radarResetStatisticsV2Schema,rt as radarResetUInt64DecimalV2Schema,ot as radarResetUInt64DecimalV2ToBigInt,Oi as radarResetUnexecutedActionV1Schema,E as radarResetUtcTimestampV2Schema,Dt as radarResetWithdrawnActionItemV2Schema,ki as radarResetWithdrawnActionV1Schema,qo as radarTiboSourceStatusMaxBytes,Ko as radarTiboSourceStatusPath,Xo as radarTiboSourceStatusSchema,Cr as radarTitledActivityFileSchema,br as radarTitledActivityProgressSchema,Oa as radarWebsiteLegacyChinesePrefix,Da as radarWebsiteLocalePrefixes,Ea as radarWebsiteLocaleSlugs,Ta as radarWebsiteLocales,wa as radarWebsiteOrigin,ka as radarWebsitePagePaths,Ma as radarWebsitePageUrl,cc as radarWechatDispatchPath,ac as radarWechatDispatchRequestSchema,sc as radarWechatDispatchResponseSchema,oc as radarWechatDispatchResultSchema,lc as radarWechatPrivateDispatchPath,Ar as readRadarActivityFile,Mr as readRadarActivityFileV2,_a as readRadarActivityFileV3,Rs as readRadarCodexModels,Os as readRadarCodexReleaseDirectory,ks as readRadarCodexReleaseMonth,As as readRadarCodexReleaseNotes,ec as readRadarCommunityTrendingLatest,tc as readRadarCommunityTrendingMonth,as as readRadarResetClueSnapshot,Zo as readRadarTiboSourceStatus,jr as readRadarTitledActivityFile,po as redactRadarBrowserRegistrationReferences,mi as refineRadarResetStatistics,wn as toSafeCauseSnapshotV2,Mo as upgradeRadarBrowserSubscriptionCommandV1};
|
|
6
|
+
`),f=A.encode(`\r
|
|
7
|
+
`),ee=[],p=0;for(let e of n.chunks){if(!j(c,l,p))return M(`source_stream_incomplete`,!0);p+=l.byteLength;let t=_n(c,d,p);if(t<0)return M(`source_stream_incomplete`,!0);let n=gn(c.slice(p,t));if(p=t+d.byteLength,n.get(`content-type`)!==`application/octet-stream`)return M(`source_chunk_mismatch`,!1);let r;try{r=on.decode(un(n.get(`x-radar-reset-action-id-b64`)))}catch(e){return M(`source_chunk_mismatch`,!1,e)}if(r!==e.resetActionId||n.get(`x-radar-detail-ordinal`)!==String(e.ordinal)||n.get(`x-radar-byte-size`)!==String(e.byteSize)||n.get(`x-radar-sha-256`)!==e.sha256)return M(`source_chunk_mismatch`,!1);if(p+e.byteSize+f.byteLength>c.byteLength)return M(`source_stream_incomplete`,!0);let i=c.slice(p,p+e.byteSize);if(p+=e.byteSize,!j(c,f,p)||(p+=f.byteLength,await dn(i)!==e.sha256))return M(`source_chunk_mismatch`,!1);ee.push({...e,bytes:i})}return!j(c,u,p)||p+u.byteLength!==c.byteLength?M(`source_stream_incomplete`,!0):ee}const yn=/authorization|cookie|token|secret|password|api[-_]?key/iu;function bn(e,t){let n=[...e].slice(0,1024),r=``;for(let e of n){let n=A.encode(e).byteLength;if(n>t.remaining)break;t.remaining-=n,r+=e}return r}function xn(e,t,n,r){if(e===null||typeof e==`boolean`)return e;if(typeof e==`string`)return bn(e,n);if(typeof e==`number`)return Number.isFinite(e)?e:String(e);if(typeof e==`bigint`||typeof e==`symbol`)return bn(String(e),n);if(e===void 0)return`undefined`;if(typeof e==`function`)return`[Function ${e.name||`anonymous`}]`;if(r.has(e))return`[Circular]`;if(t>=4)return`[DepthLimit]`;if(r.add(e),Array.isArray(e))return e.slice(0,16).map(e=>xn(e,t+1,n,r));let i={},a=e instanceof Error?[[`type`,e.constructor.name],[`name`,e.name],[`message`,e.message],...e.cause===void 0?[]:[[`cause`,e.cause]],...Object.entries(e)]:Object.entries(e);for(let[e,o]of a.slice(0,16)){let a=bn(String(e),n);if(!(a.length===0||Object.hasOwn(i,a))&&(n.remaining-=Math.min(n.remaining,8),i[a]=yn.test(a)?`[REDACTED]`:xn(o,t+1,n,r),n.remaining<=0))break}return i}function Sn(e){let t=xn(e,0,{remaining:7e3},new Set),n=typeof t==`object`&&t&&!Array.isArray(t)?t:{type:e===null?`null`:typeof e,message:t};return Gt.parse(n),n}function Cn(e){return e===`source_temporarily_unavailable`||e===`source_rpc_transport_failure`||e===`source_stream_incomplete`}function wn(e){switch(e){case`source_invalid_request`:return 400;case`source_revision_unknown`:return 404;case`source_cursor_invalid`:case`source_chunk_mismatch`:return 409;case`source_response_over_capacity`:return 413;case`source_temporarily_unavailable`:case`source_rpc_transport_failure`:case`source_stream_incomplete`:return 503;case`source_integrity_conflict`:case`source_revision_identity_conflict`:case`source_sequence_exhausted`:return 500}}function Tn(e){let t={contractVersion:2,ok:!1,error:{code:e.code,operation:e.operation,stage:e.stage,...e.revision===void 0?{}:{revision:e.revision},retryable:Cn(e.code),correlationId:e.correlationId,cause:Sn(e.cause)}};return qt.parse(t)}const En=e.strictObject({en:e.string().trim().min(1),zh:e.string().trim().min(1)}),Dn=e.iso.date(),N=e.strictObject({category:e.enum([`improvement`,`direct_reset`,`reset_card`]),deliveryState:e.enum([`preview`,`landed`]),description:En,dateBasis:e.enum([`occurrence`,`announcement`,`unresolved`]),sourceUrls:e.array(e.url({protocol:/^https?$/})).min(1)}),On=e.discriminatedUnion(`state`,[e.strictObject({state:e.literal(`ready`),text:En}),e.strictObject({state:e.enum([`pending`,`failed`,`not_applicable`]),text:e.null()})]),P=e.strictObject({contractVersion:e.literal(1),generatedAt:e.iso.datetime(),timeZone:e.string().refine(e=>{try{return new Intl.DateTimeFormat(`en`,{timeZone:e}),!0}catch{return!1}},`Invalid source time zone`),startDate:Dn,endDate:Dn,processing:e.strictObject({hasPending:e.boolean(),hasFailures:e.boolean()}),days:e.array(e.strictObject({date:Dn,dayNumber:e.number().int().min(1).max(28),outcome:e.enum([`unconfirmed`,`improvement`,`reset`,`both`]),entries:e.array(N),summary:On})).length(28),undatedEntries:e.array(N)}).superRefine((e,t)=>{let n=Date.parse(`${e.startDate}T00:00:00Z`);for(let[r,i]of e.days.entries()){let e=new Date(n+r*864e5).toISOString().slice(0,10);(i.date!==e||i.dayNumber!==r+1)&&t.addIssue({code:`custom`,path:[`days`,r],message:`Days must be contiguous and numbered in order`}),i.entries.some(e=>e.dateBasis===`unresolved`)&&t.addIssue({code:`custom`,path:[`days`,r,`entries`],message:`Unresolved dates belong in undatedEntries`});let a=i.entries.filter(e=>e.deliveryState===`landed`),o=a.some(e=>e.category===`improvement`),s=a.some(e=>e.category!==`improvement`),c=o?s?`both`:`improvement`:s?`reset`:`unconfirmed`;(i.outcome!==c||a.length===0!=(i.summary.state===`not_applicable`))&&t.addIssue({code:`custom`,path:[`days`,r],message:`Outcome and summary must reflect landed evidence`})}e.days.at(-1)?.date!==e.endDate&&t.addIssue({code:`custom`,path:[`endDate`],message:`End must match the last activity day`}),e.undatedEntries.some(e=>e.dateBasis!==`unresolved`)&&t.addIssue({code:`custom`,path:[`undatedEntries`],message:`Undated entries must have unresolved dates`})});function kn(e){return P.parse(e)}function An(e){let t=e.filter(e=>e.deliveryState===`landed`),n=t.some(e=>e.category===`improvement`),r=t.some(e=>e.category!==`improvement`);return n?r?`both`:`improvement`:r?`reset`:`unconfirmed`}const jn=524288,Mn=P.shape,Nn=Mn.days.element,Pn=N.extend({date:Mn.startDate.nullable()}).superRefine((e,t)=>{e.date===null!=(e.dateBasis===`unresolved`)&&t.addIssue({code:`custom`,path:[`date`],message:`Date must agree with its evidence basis`})}),Fn=e.strictObject({state:e.enum([`unconfirmed`,`ongoing`,`ended`]),sourceUrls:e.array(N.shape.sourceUrls.element)}).superRefine((e,t)=>{e.state!==`unconfirmed`&&e.sourceUrls.length===0&&t.addIssue({code:`custom`,path:[`sourceUrls`],message:`Confirmed lifecycle states require source evidence`})}),In=Nn.omit({date:!0,entries:!0}).extend({entries:e.array(Pn),lifecycle:Fn}),Ln=e.strictObject({contractVersion:e.literal(2),generatedAt:Mn.generatedAt,timeZone:Mn.timeZone,processing:Mn.processing,days:e.array(In).length(28),unassignedEntries:e.array(Pn)}).superRefine((e,t)=>{for(let[n,r]of e.days.entries()){r.dayNumber!==n+1&&t.addIssue({code:`custom`,path:[`days`,n,`dayNumber`],message:`Official days must be numbered in order`});let e=r.entries.filter(e=>e.deliveryState===`landed`),i=An(r.entries);(r.outcome!==i||e.length===0!=(r.summary.state===`not_applicable`))&&t.addIssue({code:`custom`,path:[`days`,n],message:`Outcome and summary must reflect landed evidence`})}});function Rn(e){return Ln.parse(e)}const zn=jn,F=e.strictObject({en:e.string().trim().min(1),zh:e.string().trim().min(1)}),Bn=N.extend({title:F}),Vn=Ln.shape,Hn=Vn.days.element,Un=Hn.shape.entries.element.safeExtend({title:F}),Wn=Hn.extend({title:F.nullable(),entries:e.array(Un)}).superRefine((e,t)=>{e.title!==null!=(e.summary.state===`ready`)&&t.addIssue({code:`custom`,path:[`title`],message:`A daily title is available exactly when its summary is ready`})}),Gn=e.strictObject({...Vn,contractVersion:e.literal(3),days:e.array(Wn),unassignedEntries:e.array(Un)}).superRefine((e,t)=>{let n=Ln.safeParse({contractVersion:2,generatedAt:e.generatedAt,timeZone:e.timeZone,processing:e.processing,days:e.days.map(({title:e,...t})=>({...t,entries:t.entries.map(({title:e,...t})=>t)})),unassignedEntries:e.unassignedEntries.map(({title:e,...t})=>t)});if(!n.success)for(let e of n.error.issues)t.addIssue({...e})});function Kn(e){return{improvementDays:e.days.filter(e=>e.outcome===`improvement`||e.outcome===`both`).length,resetDays:e.days.filter(e=>e.outcome===`reset`||e.outcome===`both`).length}}function qn(e){return Gn.parse(e)}const Jn=zn,Yn=Ln.shape,Xn=Gn.shape.unassignedEntries,Zn=Yn.days.element.omit({summary:!0}).extend({entries:Xn}),Qn=e.strictObject({...Yn,contractVersion:e.literal(4),days:e.array(Zn).length(28),unassignedEntries:Xn}).superRefine((e,t)=>{for(let[n,r]of e.days.entries())r.dayNumber!==n+1&&t.addIssue({code:`custom`,path:[`days`,n,`dayNumber`],message:`Official days must be numbered in order`}),r.outcome!==An(r.entries)&&t.addIssue({code:`custom`,path:[`days`,n],message:`Outcome must reflect landed evidence`})});function $n(e){return Qn.parse(e)}function er(e,t){let n=new Set;for(let r of e)n.has(r.eventId)&&t.addIssue({code:`custom`,message:`Duplicate activity eventId`}),n.add(r.eventId)}function tr(e,t,n){let r=n.reduce((t,n)=>t+e.reactionCounts[n],0);(!Number.isSafeInteger(r)||r!==e.reactionTotal)&&t.addIssue({code:`custom`,path:[`reactionTotal`],message:`Total must equal all reaction counts`})}async function nr(e,t,n){if(e.status!==200){let t={status:e.status,statusText:e.statusText};try{await e.body?.cancel()}catch(e){throw Error(`activity_file_http_error`,{cause:{...t,cancellationCause:e}})}throw Error(`activity_file_http_error`,{cause:t})}if(e.body===null)throw Error(`activity_file_body_missing`);let r=e.body.getReader(),i=[],a=0;try{for(;;){let e=await r.read();if(e.done)break;if(a+=e.value.byteLength,a>n)throw Error(`activity_file_too_large`,{cause:{maxBytes:n,observedBytes:a}});i.push(e.value)}let e=new Uint8Array(a),o=0;for(let t of i)e.set(t,o),o+=t.byteLength;return t.parse(JSON.parse(new TextDecoder(`utf-8`,{fatal:!0}).decode(e)))}catch(e){try{await r.cancel()}catch{}throw Error(`activity_file_read_failed`,{cause:e})}finally{r.releaseLock()}}function rr(e,t,n){let r=new TextEncoder().encode(JSON.stringify(t.parse(e)));if(r.byteLength>n)throw Error(`activity_file_too_large`,{cause:{byteLength:r.byteLength}});return r}const I=[`👍`,`😂`,`🤡`,`💀`,`😭`,`🔥`,`🎉`,`👀`,`🙏`,`🫠`],ir=e.enum(I),L=e.string().min(1).max(128),R=524288,ar=`https://data.radarultra.com/activity/v1/latest.json`,or=`https://data.radarultra.com/activity/v2/latest.json`,sr=N.extend({eventId:L}),cr=P.safeExtend({days:e.array(P.shape.days.element.extend({entries:e.array(sr)})).length(28),undatedEntries:e.array(sr)});function lr(e,t){er([...e.days.flatMap(e=>e.entries),...e.undatedEntries],t)}const ur=cr.superRefine(lr),dr=e.record(ir,e.number().int().nonnegative()),fr=e.strictObject({reactionCounts:dr,reactionTotal:e.number().int().nonnegative()});function pr(e,t){tr(e,t,I)}const mr=sr.extend(fr.shape).superRefine(pr),hr=cr.safeExtend({days:e.array(cr.shape.days.element.extend({entries:e.array(mr)})).length(28),undatedEntries:e.array(mr)}).superRefine(lr),z=e.strictObject({publishedAt:e.iso.datetime(),reactionIds:e.array(ir).length(I.length).refine(e=>new Set(e).size===I.length,`Every reaction must occur exactly once`),progress:hr}),gr=Gn.shape,_r=gr.unassignedEntries.element.safeExtend({eventId:L}),vr=e.strictObject({...gr,days:e.array(gr.days.element.safeExtend({entries:e.array(_r)})).length(28),unassignedEntries:e.array(_r)}),yr=vr.superRefine((e,t)=>{let n=({eventId:e,...t})=>t,r=Gn.safeParse({...e,days:e.days.map(e=>({...e,entries:e.entries.map(n)})),unassignedEntries:e.unassignedEntries.map(n)});if(!r.success)for(let e of r.error.issues)t.addIssue({...e});er([...e.days.flatMap(e=>e.entries),...e.unassignedEntries],t)}),br=_r.safeExtend(fr.shape).superRefine(pr),xr=vr.safeExtend({days:e.array(gr.days.element.safeExtend({entries:e.array(br)})).length(28),unassignedEntries:e.array(br)}).superRefine((e,t)=>{let n=({reactionCounts:e,reactionTotal:t,...n})=>n,r=yr.safeParse({...e,days:e.days.map(e=>({...e,entries:e.entries.map(n)})),unassignedEntries:e.unassignedEntries.map(n)});if(!r.success)for(let e of r.error.issues)t.addIssue({...e})}),Sr=z.extend({progress:xr}),Cr=Qn.shape,wr=Cr.unassignedEntries.element.safeExtend({eventId:L}),Tr=Qn.safeExtend({days:e.array(Cr.days.element.safeExtend({entries:e.array(wr)})).length(28),unassignedEntries:e.array(wr)}).superRefine((e,t)=>{er([...e.days.flatMap(e=>e.entries),...e.unassignedEntries],t)}),Er=wr.safeExtend(fr.shape).superRefine(pr),Dr=Tr.safeExtend({days:e.array(Cr.days.element.safeExtend({entries:e.array(Er)})).length(28),unassignedEntries:e.array(Er)}),Or=z.extend({progress:Dr});async function kr(e){return nr(e,z,R)}async function Ar(e){return nr(e,Sr,R)}async function jr(e){return nr(e,Or,R)}function Mr(e){return rr(e,z,R)}function Nr(e){return rr(e,Sr,R)}function Pr(e){return rr(e,Or,R)}const Fr=e.strictObject({changeId:e.string().min(1).max(128),eventId:e.string().min(1).max(128),revision:e.int().positive(),kind:e.enum([`created`,`updated`,`withdrawn`]),date:e.iso.date().nullable(),entry:N,receivedAt:e.iso.datetime().nullable(),acceptedAt:e.iso.datetime()}),Ir=e.strictObject({contractVersion:e.literal(1),changes:e.array(Fr),nextCursor:e.string().min(1),hasMore:e.boolean()}),Lr=Fr.extend({dayNumber:P.shape.days.element.shape.dayNumber.nullable()}),Rr=Ir.extend({contractVersion:e.literal(2),changes:e.array(Lr)}),zr=e.int().min(0).max(2**53-1),Br=e.int().min(1).max(28),Vr=e.enum([`yes`,`no`]).nullable(),Hr=e.strictObject({choice:Vr}),Ur=e.strictObject({yes:zr,no:zr,total:zr}).superRefine((e,t)=>{(!Number.isSafeInteger(e.yes+e.no)||e.total!==e.yes+e.no)&&t.addIssue({code:`custom`,path:[`total`],message:`Total must equal the effective choices.`})}),Wr=e.strictObject({dayNumber:Br,state:e.enum([`unopened`,`open`,`closed`]),choice:Vr,outcome:e.enum([`unconfirmed`,`yes`,`no`]),personalResult:e.enum([`none`,`waiting`,`correct`,`incorrect`]),corrected:e.boolean(),counts:Ur}).superRefine((e,t)=>{let n=e.choice===null?`none`:e.outcome===`unconfirmed`?`waiting`:e.choice===e.outcome?`correct`:`incorrect`;e.personalResult!==n&&t.addIssue({code:`custom`,path:[`personalResult`],message:`Personal result must match the confirmed outcome and choice.`}),e.state!==`closed`&&e.outcome!==`unconfirmed`&&t.addIssue({code:`custom`,path:[`outcome`],message:`An open or unopened day cannot have a confirmed result.`}),e.state===`unopened`&&(e.choice!==null||e.counts.total!==0)&&t.addIssue({code:`custom`,path:[`state`],message:`An unopened day cannot have choices.`})}),Gr=e.strictObject({revision:zr,openDayNumber:Br.nullable(),days:e.array(Wr).length(28)}).superRefine((e,t)=>{for(let[n,r]of e.days.entries()){r.dayNumber!==n+1&&t.addIssue({code:`custom`,path:[`days`,n,`dayNumber`],message:`Every official day must occur once, in order.`});let i=e.openDayNumber===null||r.dayNumber<e.openDayNumber?`closed`:r.dayNumber===e.openDayNumber?`open`:`unopened`;r.state!==i&&t.addIssue({code:`custom`,path:[`days`,n,`state`],message:`Only the next official day may be open.`})}}),Kr=e.strictObject({error:e.strictObject({code:e.enum([`invalid_request`,`payload_too_large`,`unsupported_media_type`,`origin_not_allowed`,`rate_limited`,`dependency_unavailable`,`internal_error`,`day_closed`,`identity_unavailable`]),message:e.string().min(1).max(2048),requestId:e.string().min(1).max(128),operation:e.enum([`get_guesses`,`set_guess`]),stage:e.string().min(1).max(128),cause:e.record(e.string(),e.unknown()),saveOutcome:e.enum([`not_saved`,`unknown`]).optional()})}).superRefine(({error:e},t)=>{e.operation===`set_guess`!=(e.saveOutcome!==void 0)&&t.addIssue({code:`custom`,path:[`error`,`saveOutcome`],message:`Only save failures must include a save outcome.`})}),qr=e.strictObject({"zh-Hans":S.shape.noticeTimeline.element.shape.sourceTextZh,"zh-Hant":S.shape.noticeTimeline.element.shape.sourceTextZh,ja:S.shape.noticeTimeline.element.shape.sourceTextZh,ko:S.shape.noticeTimeline.element.shape.sourceTextZh}),Jr=S.shape.noticeTimeline.element.omit({sourceTextZh:!0}).extend({sourceTranslations:qr}).strict(),Yr=e.strictObject({...S.shape,contractVersion:e.literal(2),noticeTimeline:e.array(Jr).min(1).max(i.actionDetail.noticeTimeline)}),Xr=Jr.omit({phase:!0}).extend({kinds:C.shape.noticeTimeline.element.shape.kinds}).strict(),Zr=e.strictObject({...C.shape,noticeTimeline:e.array(Xr).min(1).max(i.actionDetail.noticeTimeline)}),Qr=e=>{let{sourceTranslations:t,...n}=e;return{...n,sourceTextZh:t[`zh-Hans`]}},$r=e=>({...e,contractVersion:1,noticeTimeline:e.noticeTimeline.map(Qr)}),ei=e=>({...e,noticeTimeline:e.noticeTimeline.map(Qr)}),ti=(e,t)=>{for(let n of e.error?.issues??[])t.addIssue({...n})},B=Yr.superRefine((e,t)=>{ti(S.safeParse($r(e)),t)}),V=Zr.superRefine((e,t)=>{ti(C.safeParse(ei(e)),t)}),H=e.strictObject({...Ve.shape,contractVersion:e.literal(2),actions:e.array(B).min(1).max(i.analysis.actions),pendingResetActions:e.array(V).max(i.analysis.actions)}).superRefine((e,t)=>{ti(Ve.safeParse({...e,contractVersion:1,actions:e.actions.map($r),pendingResetActions:e.pendingResetActions.map(ei)}),t),new TextEncoder().encode(JSON.stringify(e)).byteLength>i.exportUtf8Bytes&&t.addIssue({code:`custom`,message:`export_utf8_size_limit_exceeded`,path:[]})}),ni=e=>B.parse(e),ri=e=>V.parse(e),ii=e=>H.parse(e);function ai(e){let t=ii(e);return Ve.parse({...t,contractVersion:1,actions:t.actions.map($r),pendingResetActions:t.pendingResetActions.map(ei)})}const oi=e.object(B.shape).omit({actionScope:!0,reasons:!0}).extend({contractVersion:e.literal(3)}).strict().superRefine((e,n)=>t(e,n,w)),si=H.shape.generatedAt,ci=e.strictObject({resetActionId:S.shape.resetActionId,effect:S.shape.resetEffects.options[0].shape.values.element.nullable(),at:si,basis:e.enum([`execution_confirmation`,`announcement`]),sourceUrl:S.shape.noticeTimeline.element.shape.sourceUrl}),li=e.number().int().nonnegative(),ui=e.number().finite().nonnegative();function U(e,t){try{return w(e,t)}catch{return}}function di(e,t){return e<t?-1:+(e>t)}const fi=e.strictObject({timeBasis:e.literal(`confirmation_priority`),startAt:si,total:li,hardResetCount:li,bankedResetCount:li,unknownCount:li,records:e.array(ci).max(i.analysis.actions*2),intervalSummary:e.strictObject({mean:ui,max:ui}).nullable()});function pi(e,t){let n=(e,n=[])=>t.addIssue({code:`custom`,message:e,path:n}),r={hard_reset:0,banked_reset:0,unknown:0},a=new Set,o=new Map,s=new Set,c=new Set;for(let[t,i]of e.records.entries()){r[i.effect??`unknown`]+=1;let l=JSON.stringify([i.resetActionId,i.effect]);a.has(l)&&n(`statistics_record_identity_duplicate`,[`records`,t]),a.add(l),i.effect===null?s.add(i.resetActionId):c.add(i.resetActionId),U(i.at,e.startAt)===-1&&n(`statistics_record_before_window`,[`records`,t,`at`]);let u=e.records.at(t-1);if(t>0&&u!==void 0){let e=U(u.at,i.at);e!==void 0&&(e>0||e===0&&(di(u.resetActionId,i.resetActionId)>0||u.resetActionId===i.resetActionId&&di(u.effect??``,i.effect??``)>0))&&n(`statistics_records_not_stably_sorted`,[`records`,t])}let d=o.get(i.resetActionId);(d===void 0||U(i.at,d)===-1)&&o.set(i.resetActionId,i.at)}o.size>i.analysis.actions&&n(`statistics_event_limit_exceeded`),[...s].some(e=>c.has(e))&&n(`statistics_event_effect_state_mismatch`),e.total!==e.records.length&&n(`statistics_total_mismatch`,[`total`]),e.hardResetCount!==r.hard_reset&&n(`statistics_hard_reset_count_mismatch`,[`hardResetCount`]),e.bankedResetCount!==r.banked_reset&&n(`statistics_banked_reset_count_mismatch`,[`bankedResetCount`]),e.unknownCount!==r.unknown&&n(`statistics_unknown_count_mismatch`,[`unknownCount`]);let l=[...o.values()].sort((e,t)=>U(e,t)??0),u=l.slice(1).map((e,t)=>Number(((Date.parse(e)-Date.parse(l.at(t)))/864e5).toFixed(6)));if(u.length===0)e.intervalSummary!==null&&n(`statistics_interval_summary_must_be_null`,[`intervalSummary`]);else if(u.every(Number.isFinite)){let t=Number((u.reduce((e,t)=>e+t,0)/u.length).toFixed(6)),r=Math.max(...u);(e.intervalSummary===null||Math.abs(e.intervalSummary.mean-t)>1e-9||Math.abs(e.intervalSummary.max-r)>1e-9)&&n(`statistics_interval_summary_mismatch`,[`intervalSummary`])}}const mi=fi.superRefine(pi),hi=e.object(H.shape).omit({analysis:!0}).extend({contractVersion:e.literal(3),statistics:mi,actions:e.array(oi).min(1).max(i.analysis.actions)}).strict().superRefine((e,t)=>{let n=(e,n=[])=>t.addIssue({code:`custom`,message:e,path:n});new TextEncoder().encode(JSON.stringify(e)).byteLength>i.exportUtf8Bytes&&n(`export_utf8_size_limit_exceeded`);let r=new Map(e.actions.map(e=>[e.resetActionId,e])),a=new Set(e.statistics.records.map(e=>e.resetActionId));r.size!==e.actions.length&&n(`export_action_identity_duplicate`,[`actions`]),new Set(e.pendingResetActions.map(e=>e.resetActionId)).size!==e.pendingResetActions.length&&n(`export_pending_action_identity_duplicate`,[`pendingResetActions`]);for(let[t,r]of e.actions.entries()){let i=e.actions.at(t-1);t>0&&i!==void 0&&si.safeParse(i.firstAnnouncedAt).success&&si.safeParse(r.firstAnnouncedAt).success&&T(i,r)>0&&n(`export_actions_not_stably_sorted`,[`actions`,t]),U(r.firstAnnouncedAt,e.generatedAt)===1&&n(`export_action_after_snapshot`,[`actions`,t,`firstAnnouncedAt`]);let o=U(r.firstAnnouncedAt,e.statistics.startAt);o!==void 0&&o>=0&&!a.has(r.resetActionId)&&n(`export_statistics_window_action_missing`,[`actions`,t,`resetActionId`])}for(let[t,i]of e.statistics.records.entries()){let a=[`statistics`,`records`,t],o=r.get(i.resetActionId);if(o===void 0){n(`export_statistics_action_missing`,a);continue}(o.resetEffects.state===`unknown`!=(i.effect===null)||i.effect!==null&&!o.resetEffects.values.some(e=>e===i.effect))&&n(`export_statistics_effect_mismatch`,[...a,`effect`]);let s=o.noticeTimeline.filter(e=>e.sourceUrl===i.sourceUrl&&U(e.authoredAt,i.at)===0);s.length===0&&n(`export_statistics_source_mismatch`,a),i.basis===`execution_confirmation`&&!s.some(e=>e.phase===`executed`)&&n(`export_statistics_confirmation_source_invalid`,a),i.basis===`announcement`&&U(i.at,o.firstAnnouncedAt)!==0&&n(`export_statistics_announcement_time_mismatch`,a),U(i.at,e.generatedAt)===1&&n(`export_statistics_record_after_snapshot`,[...a,`at`])}}),gi=e.strictObject({contractVersion:e.literal(1),data:e.strictObject({sourceWatermark:re.shape.sourceWatermark,statistics:mi}),meta:e.strictObject({observedAt:si})}),_i=e=>hi.parse(e);function vi(e,t){let n=H.parse(e);return _i({contractVersion:3,generatedAt:n.generatedAt,statistics:t,pendingResetActions:n.pendingResetActions,actions:n.actions.map(({actionScope:e,reasons:t,...n})=>({...n,contractVersion:3}))})}const yi=e=>oi.parse(e),bi=`/api/v1/codex-reset-public-records`,xi=e.array(Xr).min(1).max(i.actionDetail.noticeTimeline),Si=e.strictObject(B.shape).omit({contractVersion:!0,noticeCount:!0,noticeTimeline:!0}).extend({noticeTimeline:xi}).strict();function Ci(e){let t=e.noticeTimeline.filter(e=>e.kinds.includes(`executed`)||e.kinds.includes(`preview`)).map(({kinds:e,...t})=>({...t,phase:e.includes(`executed`)?`executed`:`preview`}));return{...e,contractVersion:2,noticeCount:t.length,noticeTimeline:t}}const wi=e=>B.parse(Ci(e));function Ti(e,t){let n=new Set;for(let[r,i]of e.entries()){n.has(i.sourceUrl)&&t.addIssue({code:`custom`,message:`public_notice_source_duplicate`,path:[`noticeTimeline`,r]}),n.add(i.sourceUrl);let a=e.at(r-1),o=B.shape.firstAnnouncedAt;r>0&&a!==void 0&&o.safeParse(a.authoredAt).success&&o.safeParse(i.authoredAt).success&&w(a.authoredAt,i.authoredAt)>0&&t.addIssue({code:`custom`,message:`public_notice_timeline_not_ascending`,path:[`noticeTimeline`,r]})}}const Ei=Si.superRefine((e,t)=>{Ti(e.noticeTimeline,t);let n=B.safeParse(Ci(e));for(let e of n.error?.issues??[])t.addIssue({...e})}),Di=e.strictObject(V.shape).omit({state:!0,executedEffects:!0,pendingEffects:!0}).superRefine((e,t)=>{Ti(e.noticeTimeline,t)}),Oi=e.strictObject(B.shape).pick({resetActionId:!0}).extend({lastActiveFirstAnnouncedAt:B.shape.firstAnnouncedAt,withdrawnAt:B.shape.firstAnnouncedAt}).strict(),ki=i.analysis.actions,Ai=e.strictObject({contractVersion:e.literal(1),sourceWatermark:B.shape.resetActionId,generatedAt:B.shape.firstAnnouncedAt,actions:e.array(Ei).min(1).max(ki),pendingResetActions:e.array(V).max(ki),unexecutedResetActions:e.array(Di).max(ki),withdrawnResetActions:e.array(Oi).max(ki)}).superRefine((e,t)=>{for(let n of[`actions`,`pendingResetActions`,`unexecutedResetActions`,`withdrawnResetActions`])new Set(e[n].map(e=>e.resetActionId)).size!==e[n].length&&t.addIssue({code:`custom`,message:`public_reset_identity_duplicate`,path:[n]});let n=new Set(e.actions.map(e=>e.resetActionId));for(let n of e.pendingResetActions)Ti(n.noticeTimeline,t);(e.unexecutedResetActions.some(e=>n.has(e.resetActionId))||e.withdrawnResetActions.some(e=>n.has(e.resetActionId)))&&t.addIssue({code:`custom`,message:`public_reset_lifecycle_conflict`});for(let[n,r]of e.actions.entries()){let i=e.actions.at(n-1),a=B.shape.firstAnnouncedAt;n>0&&i!==void 0&&a.safeParse(i.firstAnnouncedAt).success&&a.safeParse(r.firstAnnouncedAt).success&&T(i,r)>=0&&t.addIssue({code:`custom`,message:`public_reset_actions_not_ascending`,path:[`actions`,n]})}new TextEncoder().encode(JSON.stringify(e)).byteLength>i.exportUtf8Bytes&&t.addIssue({code:`custom`,message:`public_reset_records_utf8_size_limit_exceeded`})}),ji=B.shape,Mi=e.strictObject({title:e.string(),body:e.string()}),Ni=e.strictObject({zh:Mi,en:Mi}),Pi=e.enum([`end_preview`,`restore_preview`,`set_auto_notification`,`notify`,`confirm`]),Fi=e.strictObject({resetActionId:ji.resetActionId,operation:Pi,expectedRevision:e.int().nonnegative(),copy:Ni.nullable(),automaticNotification:e.boolean().nullable(),executedAt:D.nullable().optional()}).superRefine((e,t)=>{e.operation===`notify`!=(e.copy!==null)&&t.addIssue({code:`custom`,path:[`copy`],message:`notification_copy_operation_mismatch`}),e.operation===`set_auto_notification`!=(e.automaticNotification!==null)&&t.addIssue({code:`custom`,path:[`automaticNotification`],message:`notification_policy_operation_mismatch`}),e.operation!==`notify`&&e.operation!==`confirm`&&e.executedAt!=null&&t.addIssue({code:`custom`,path:[`executedAt`],message:`execution_time_operation_mismatch`})}),Ii=Fi.superRefine((e,t)=>{(e.operation===`notify`||e.operation===`confirm`)&&e.executedAt==null&&t.addIssue({code:`custom`,path:[`executedAt`],message:`execution_time_required`})}),Li=Fi,Ri=e.strictObject({digest:e.string().regex(/^sha256:[a-f0-9]{64}$/),sourceWatermark:e.string().min(1),draft:Ii}),zi=e.strictObject({operationId:e.uuid(),preview:Ri}),Bi=e.strictObject({resetActionId:ji.resetActionId,revision:e.number().int().nonnegative(),state:e.enum([`preview`,`executed`,`cancelled`,`undetermined`]),firstAnnouncedAt:D.nullable(),officialConfirmed:e.boolean(),pendingPreview:e.boolean(),previewClosed:e.boolean(),automaticNotification:e.boolean(),sourceUrls:e.array(ji.noticeTimeline.element.shape.sourceUrl),availableOperations:e.array(Pi),notificationOperationId:e.uuid().nullable()}),Vi=e.strictObject({actions:e.array(Bi)}),Hi=e.discriminatedUnion(`status`,[e.strictObject({status:e.literal(`unknown`),operationId:e.uuid()}),e.strictObject({status:e.literal(`saved`),operationId:e.uuid(),resetActionId:ji.resetActionId,operation:Pi,revision:e.number().int().positive(),notification:e.strictObject({state:e.enum([`disabled`,`pending`,`claimed`,`retry_wait`,`accepted`,`rejected`,`expired`]),resultCode:e.string().nullable(),diagnostic:e.record(e.string(),e.unknown()).nullable()})})]),Ui=S.shape.noticeTimeline.element.shape,Wi=e.enum([`initial`,`supplement`,`correction`]).nullable(),Gi=e.strictObject({authoredAt:Ui.authoredAt,role:Wi,sourceUrl:Ui.sourceUrl,sourceText:Ui.sourceText,sourceTextZh:Ui.sourceTextZh}),Ki=e.array(Gi).min(1).superRefine((e,t)=>{let n=new Set,r;for(let[i,a]of e.entries()){if(n.has(a.sourceUrl)&&t.addIssue({code:`custom`,path:[i,`sourceUrl`],message:`An original post may appear only once per improvement`}),n.add(a.sourceUrl),!Ui.authoredAt.safeParse(a.authoredAt).success){r=void 0;continue}if(r!==void 0){let e=w(r.authoredAt,a.authoredAt);(e>0||e===0&&r.sourceUrl>a.sourceUrl)&&t.addIssue({code:`custom`,path:[i],message:`Posts must be ordered by authoredAt and sourceUrl`})}r=a}}),qi=Jn,Ji=N.omit({description:!0}).extend({category:e.literal(`improvement`),title:F,posts:Ki}),Yi=N.extend({category:e.enum([`direct_reset`,`reset_card`]),title:F}),Xi=e.discriminatedUnion(`category`,[Ji,Yi]),Zi=Qn.shape,Qi=Zi.unassignedEntries.element.shape.date;function $i(e,t){e.date===null!=(e.dateBasis===`unresolved`)&&t.addIssue({code:`custom`,path:[`date`],message:`Date must agree with its evidence basis`})}const ea=e.discriminatedUnion(`category`,[Ji.extend({date:Qi}).superRefine($i),Yi.extend({date:Qi}).superRefine($i)]),ta=e.strictObject({...Zi,contractVersion:e.literal(5),days:e.array(Zi.days.element.extend({entries:e.array(ea)})).length(28),unassignedEntries:e.array(ea)}).superRefine((e,t)=>{for(let[n,r]of e.days.entries())r.dayNumber!==n+1&&t.addIssue({code:`custom`,path:[`days`,n,`dayNumber`],message:`Official days must be numbered in order`}),r.outcome!==An(r.entries)&&t.addIssue({code:`custom`,path:[`days`,n],message:`Outcome must reflect landed evidence`})});function na(e){return ta.parse(e)}const ra=`https://data.radarultra.com/activity/v3/latest.json`,ia=ta.shape,[aa,oa]=ia.unassignedEntries.element.options,sa=aa.safeExtend({eventId:L}),ca=oa.safeExtend({eventId:L}),la=e.discriminatedUnion(`category`,[sa,ca]),ua=ta.safeExtend({days:e.array(ia.days.element.extend({entries:e.array(la)})).length(28),unassignedEntries:e.array(la)}).superRefine((e,t)=>{er([...e.days.flatMap(e=>e.entries),...e.unassignedEntries],t)}),da={reactionCounts:dr,reactionTotal:e.number().int().nonnegative()},fa=(e,t)=>tr(e,t,I),pa=e.discriminatedUnion(`category`,[sa.safeExtend(da).superRefine(fa),ca.safeExtend(da).superRefine(fa)]),ma=ua.safeExtend({days:e.array(ia.days.element.extend({entries:e.array(pa)})).length(28),unassignedEntries:e.array(pa)}),ha=z.extend({progress:ma});async function ga(e){return nr(e,ha,R)}function _a(e){return rr(e,ha,R)}const va=e.discriminatedUnion(`category`,[Ji,N.extend({category:e.enum([`direct_reset`,`reset_card`])})]),ya=Lr.extend({entry:va}),ba=Rr.extend({contractVersion:e.literal(3),changes:e.array(ya)});function xa(e){return ya.parse(e)}function Sa(e){return ba.parse(e)}const Ca=`https://radarultra.com`,wa=[`zh-Hans`,`zh-Hant`,`en`,`ja`,`ko`],Ta={"zh-Hans":`zh-hans`,"zh-Hant":`zh-hant`,en:`en`,ja:`ja`,ko:`ko`},Ea={"zh-Hans":`/${Ta[`zh-Hans`]}`,"zh-Hant":`/${Ta[`zh-Hant`]}`,en:``,ja:`/${Ta.ja}`,ko:`/${Ta.ko}`},Da=`/zh`,Oa={reset:`/codex`,improvement:`/codex/28-day-challenge`,changelog:`/codex/changelog`,models:`/codex/models`,community:`/codex/community`},ka=e.discriminatedUnion(`product`,[e.strictObject({product:e.literal(`cli`),version:e.string().regex(/^\d+\.\d+\.\d+$/)}),e.strictObject({product:e.literal(`app`),version:e.string().regex(/^\d{2}\.\d{3,4}$/)})]),Aa=e.string().regex(/^(?!\.{1,2}$)[a-z0-9.-]+$/);function ja(e,t){return Ca+Ea[t]+Oa[e]}function Ma(e,t){let n=t===`zh-Hans`?`/zh`:Ea[t];return Ca+n+Oa[e]}function Na(e,t,n){let r=ka.parse({product:e,version:t});return`${ja(`changelog`,n)}/${r.product}/${r.version}`}function Pa(e,t){return`${ja(`models`,t)}/${Aa.parse(e)}`}const Fa=Object.freeze({timeZone:`America/Los_Angeles`,startDate:`2026-10-05`,endDate:`2026-11-01`}),Ia=Date.parse(`${Fa.startDate}T00:00:00Z`),La=(Date.parse(`${Fa.endDate}T00:00:00Z`)-Ia)/864e5+1,Ra=new Intl.DateTimeFormat(`en-CA`,{timeZone:Fa.timeZone,year:`numeric`,month:`2-digit`,day:`2-digit`});function za(e){let t=Ra.formatToParts(e),n=e=>Number(t.find(t=>t.type===e).value),r=(Date.UTC(n(`year`),n(`month`)-1,n(`day`))-Ia)/864e5,i=r<0?`before`:r>=La?`ended`:`live`,a=Math.min(La,Math.max(1,r+1));return{phase:i,today:a,ongoingDay:i===`live`?a:null}}const Ba=e.enum([`reset`,`improvement`]),Va=e.array(Ba).min(1).max(2).refine(e=>new Set(e).size===e.length,`notification_topic_duplicate`),Ha=e=>new Set(wa.flatMap(t=>[ja(e,t),Ma(e,t)])),Ua={reset:Ha(`reset`),improvement:Ha(`improvement`)},Wa=t=>e.url().refine(e=>Ua[t].has(e),`notification_target_url_invalid`),Ga=e.url().refine(e=>Object.values(Ua).some(t=>t.has(e)),`notification_target_not_owned`),Ka=e.discriminatedUnion(`kind`,[e.object({kind:e.literal(`reset`),webUrl:Wa(`reset`),miniPath:e.literal(`pages/index/index`)}).strict(),e.object({kind:e.literal(`improvement`),webUrl:Wa(`improvement`),miniPath:e.literal(`pages/index/index?page=challenge`)}).strict()]),qa=e.object({topics:Va,target:Ka}).strict().refine(e=>e.topics.includes(e.target.kind),`notification_target_topic_mismatch`),Ja=e.enum([`reset`,`improvement`,`clue`]),Ya=e.object({topics:e.array(Ja).min(1).max(2).refine(e=>new Set(e).size===e.length,`notification_topic_duplicate`),target:Ka}).strict().refine(e=>e.topics.some(t=>(t===`clue`?`reset`:t)===e.target.kind),`notification_target_topic_mismatch`);function Xa(e,t){let n=Za(e===`clue`?`reset`:e,t);return Ya.parse({...n,topics:[e],target:{...n.target,webUrl:Ma(n.target.kind,t)}})}function Za(e,t){return qa.parse({topics:[e],target:{kind:e,webUrl:ja(e,t),miniPath:e===`reset`?`pages/index/index`:`pages/index/index?page=challenge`}})}const Qa=e.object({notificationId:e.uuid(),eventId:e.uuid(),title:e.string().trim().min(1).max(512),createdAt:e.iso.datetime(),deliverBy:e.iso.datetime(),...qa.shape}).strict().superRefine((e,t)=>{e.topics.includes(e.target.kind)||t.addIssue({code:`custom`,message:`notification_target_topic_mismatch`}),w(e.deliverBy,e.createdAt)<=0&&t.addIssue({code:`custom`,message:`notification_task_deadline_invalid`})});function $a(e,t){return w(e.createdAt,t.createdAt)||(e.notificationId<t.notificationId?-1:+(e.notificationId>t.notificationId))}const eo=`/api/v1/notification-tasks`,to=100,no=e.string().min(1).max(8192),ro=e.object({cursor:no.optional()}).strict(),io=e.object({contractVersion:e.literal(1),roundCursor:no,notifications:e.array(Qa).max(100),nextCursor:no.nullable()}).strict().superRefine((e,t)=>{new Set(e.notifications.map(e=>e.notificationId)).size!==e.notifications.length&&t.addIssue({code:`custom`,message:`notification_task_duplicate`});for(let n=1;n<e.notifications.length;n++)$a(e.notifications.at(n-1),e.notifications.at(n))>=0&&t.addIssue({code:`custom`,message:`notification_task_order_invalid`});e.nextCursor!==null&&e.notifications.length===0&&t.addIssue({code:`custom`,message:`notification_task_empty_continuation`})}),ao=`/api/browser-notifications`,oo=e.string().min(1).max(128),so=e.uuid(),co=e.enum(wa),lo=e.strictObject({reset:e.boolean(),improvement:e.boolean()}),uo=`[cdef][\\w-]{21}`,fo=e.strictObject({fid:e.string().regex(RegExp(`^${uo}$`))});function po(e){return e.replace(RegExp(`(^|[^\\w-])${uo}(?![\\w-])`,`g`),`$1[registration]`)}const W={operationId:so,expectedRevision:oo},mo=e.discriminatedUnion(`action`,[e.strictObject({...W,action:e.literal(`register`),topics:lo.refine(e=>e.reset||e.improvement,`subscription_topic_required`),locale:co,registration:fo}),e.strictObject({...W,action:e.literal(`set_topics`),topics:lo}),e.strictObject({...W,action:e.literal(`set_locale`),locale:co}),e.strictObject({...W,action:e.literal(`restore`),registration:fo}),e.strictObject({...W,action:e.literal(`retry`)}),e.strictObject({...W,action:e.literal(`cancel`)})]),ho=e.strictObject({operationId:so.optional(),expectedRevision:oo.optional()}).refine(e=>e.operationId===void 0==(e.expectedRevision===void 0),`subscription_operation_reference_incomplete`),go=e.strictObject({code:e.enum([`invalid_request`,`identity_unavailable`,`origin_not_allowed`,`rate_limited`,`revision_conflict`,`operation_conflict`,`registration_conflict`,`dependency_unavailable`,`provider_rejected`,`provider_rate_limited`,`provider_unavailable`,`provider_timeout`,`internal_error`]),operationId:so.optional(),correlationId:e.uuid(),stage:e.string().min(1).max(128),saveOutcome:e.enum([`not_saved`,`unknown`]),reasonSummary:e.string().min(1).max(2048),retryable:e.boolean(),cause:e.record(e.string(),e.unknown())}),_o=e.strictObject({id:so,state:e.enum([`pending`,`applied`,`rejected`,`unknown`,`superseded`,`not_found`]),error:go.optional()}),vo=e.strictObject({topicSettings:e.strictObject({state:e.enum([`initial`,`saved`]),revision:oo,topics:lo,locale:co.nullable()}),registrationState:e.enum([`none`,`ready`,`invalid`,`changing`]),registrationKey:e.string().regex(/^[a-f0-9]{64}$/).nullable(),manualRetryRequired:e.boolean(),operation:_o.nullable()});function yo(e,t){return{topics:t.action===`register`||t.action===`set_topics`?t.topics:e.topics,locale:t.action===`register`||t.action===`set_locale`?t.locale:e.locale}}const bo=e.strictObject({data:vo}),xo=e.strictObject({error:go});function So(e){return{topicSettings:{state:`initial`,revision:e,topics:{reset:!0,improvement:!1},locale:null},registrationState:`none`,registrationKey:null,manualRetryRequired:!1,operation:null}}const Co=lo.extend({clue:e.boolean().default(!1)}),[wo,To,...Eo]=mo.options,Do=e.discriminatedUnion(`action`,[wo.extend({topics:Co.refine(e=>Object.values(e).some(Boolean),`subscription_topic_required`)}),To.extend({topics:Co}),...Eo]),Oo=vo.extend({topicSettings:vo.shape.topicSettings.extend({topics:Co})}),ko=e.strictObject({data:Oo});function Ao(e){return Oo.parse(So(e))}function jo(e){let{clue:t,...n}=e.topicSettings.topics;return vo.parse({...e,topicSettings:{...e.topicSettings,topics:n}})}function Mo(e,t){return e.action!==`register`&&e.action!==`set_topics`?e:{...e,topics:{...e.topics,clue:e.action!==`register`&&(e.topics.reset||e.topics.improvement)&&t.clue}}}const No=20,Po=2*1024*1024,Fo=`/api/v1/improvements`,Io=e.string().min(1).max(1024),[Lo]=ua.shape.unassignedEntries.element.options,Ro=Lo.safeExtend({date:e.iso.date().refine(e=>e>Fa.endDate,`improvement_must_follow_campaign`)}),zo=e.strictObject({}),Bo=e.strictObject({challengeEnded:e.boolean(),observedAt:e.iso.datetime()}),Vo=e.strictObject({cursor:Io.nullable(),limit:e.literal(20)}),Ho=Bo.extend({entries:e.array(Ro).max(20),nextCursor:Io.nullable()}).superRefine((e,t)=>{new Set(e.entries.map(e=>e.eventId)).size!==e.entries.length&&t.addIssue({code:`custom`,path:[`entries`],message:`Duplicate improvement identity`})}),Uo=e.strictObject({eventIds:e.array(L).min(1).max(128)}),Wo=e.strictObject({eventIds:e.array(L).max(128)}),Go=e.strictObject({error:e.strictObject({code:e.enum([`invalid_request`,`dependency_unavailable`,`internal_error`]),message:e.string(),requestId:e.uuid(),operation:e.string(),stage:e.string(),cause:e.record(e.string(),e.unknown())})}),Ko=`/tibo-source/v1/latest.json`,qo=512*1024,Jo=e.iso.datetime({offset:!0}),Yo=S.shape.noticeTimeline.element,Xo=e.strictObject({contractVersion:e.literal(1),observedAt:Jo,check:e.strictObject({checkedAt:Jo,freshUntil:Jo,active:e.boolean()}).nullable(),latestPost:e.strictObject({authoredAt:Jo,sourceUrl:Yo.shape.sourceUrl,sourceText:e.string(),sourceTranslations:qr,resetRelevance:e.enum([`related`,`unrelated`,`unknown`])}).nullable()});async function Zo(e){let t=e.body?.getReader();if(t===void 0)throw Error(`tibo_source_status_body_missing`,{cause:{status:e.status}});let n=[],r=0;try{for(;;){let i=await t.read();if(i.done)break;if(r+=i.value.byteLength,r>524288)throw Error(`tibo_source_status_too_large`,{cause:{status:e.status,bytes:r}});n.push(i.value)}}finally{try{await t.cancel()}catch{}t.releaseLock()}let i=new Uint8Array(r),a=0;for(let e of n)i.set(e,a),a+=e.byteLength;let o=new TextDecoder(`utf-8`,{fatal:!0}).decode(i);if(!e.ok)throw Error(`tibo_source_status_http_error`,{cause:{status:e.status,upstream:o.slice(0,4e3)}});return Xo.parse(JSON.parse(o))}const Qo=`/reset-clue/v1/latest.json`,$o=4320*60*1e3,es=i.exportUtf8Bytes,ts=B.shape.noticeTimeline.element.pick({authoredAt:!0,sourceUrl:!0,sourceText:!0,sourceTranslations:!0,contentCompleteness:!0}).extend({plannedTiming:Le.nullable(),expiresAt:B.shape.noticeTimeline.element.shape.authoredAt}).strict().superRefine((e,t)=>{Date.parse(e.expiresAt)!==Date.parse(e.authoredAt)+2592e5&&t.addIssue({code:`custom`,message:`reset_clue_expiry_mismatch`,path:[`expiresAt`]})}),ns=e.strictObject({contractVersion:e.literal(1),clue:ts.nullable()}),rs=e=>ns.parse(e);function is(e,t){return e.clue!==null&&t.getTime()<Date.parse(e.clue.expiresAt)?e.clue:null}async function as(e){let t=e.body?.getReader();if(t===void 0)throw Error(`reset_clue_body_missing`,{cause:{status:e.status}});let n=[],r=0;try{for(;;){let i=await t.read();if(i.done)break;if(r+=i.value.byteLength,r>es)throw Error(`reset_clue_too_large`,{cause:{status:e.status,bytes:r}});n.push(i.value)}}finally{try{await t.cancel()}catch{}t.releaseLock()}let i=new Uint8Array(r),a=0;for(let e of n)i.set(e,a),a+=e.byteLength;let o=new TextDecoder(`utf-8`,{fatal:!0}).decode(i);if(!e.ok)throw Error(`reset_clue_http_error`,{cause:{status:e.status,upstream:o.slice(0,4e3)}});return rs(JSON.parse(o))}const G=e.enum(wa),K=e.string().regex(/^\d{4}-(?:0[1-9]|1[0-2])$/),q=e.string().trim().min(1),os=e.url({protocol:/^https$/}),J=e.discriminatedUnion(`kind`,[e.strictObject({kind:e.literal(`instant`),at:e.iso.datetime()}),e.strictObject({kind:e.literal(`date`),date:e.iso.date()})]),ss=e.strictObject({operation:q,stage:q,cause:Gt});function cs(t){return e.discriminatedUnion(`state`,[e.strictObject({state:e.literal(`ready`),value:t}),e.strictObject({state:e.literal(`pending`)}),e.strictObject({state:e.literal(`failed`),failure:ss})])}function Y(e,t){return e.superRefine((e,n)=>{new TextEncoder().encode(JSON.stringify(e)).byteLength>t&&n.addIssue({code:`custom`,message:`publication_utf8_size_limit_exceeded`})})}async function X(e,t,n,r){let i=e.body?.getReader();if(i===void 0)throw Error(`${t}_body_missing`,{cause:{operation:t,stage:`read`,status:e.status}});let a=[],o=0;try{for(;;){let e=await i.read();if(e.done)break;if(o+=e.value.byteLength,o>n)throw Error(`publication_utf8_size_limit_exceeded`);a.push(e.value)}}catch(n){throw Error(`${t}_read_failed`,{cause:{operation:t,stage:`read`,status:e.status,bytes:o,cause:n}})}finally{try{await i.cancel()}catch{}i.releaseLock()}let s=new Uint8Array(o),c=0;for(let e of a)s.set(e,c),c+=e.byteLength;let l;try{l=new TextDecoder(`utf-8`,{fatal:!0}).decode(s)}catch(n){throw Error(`${t}_decode_failed`,{cause:{operation:t,stage:`decode`,status:e.status,cause:n}})}if(!e.ok)throw Error(`${t}_http_error`,{cause:{operation:t,stage:`http`,status:e.status,upstream:l.slice(0,4e3)}});try{return r.parse(JSON.parse(l))}catch(n){throw Error(`${t}_parse_failed`,{cause:{operation:t,stage:`parse`,status:e.status,cause:n}})}}const ls=`/codex-releases/v2/directory.json`,us=128*1024,ds=128*1024,fs=256*1024,ps=J,ms={product:e.enum([`app`,`cli`]),version:q,published:J,month:K,revision:q},hs=e.strictObject(ms).superRefine(gs);function gs(e,t){let n=ka.safeParse({product:e.product,version:e.version});if(!n.success)for(let e of n.error.issues)t.addIssue({...e});e.product===`cli`!=(e.published.kind===`instant`)&&t.addIssue({code:`custom`,path:[`published`],message:`product_date_precision_mismatch`}),(e.published.kind===`instant`?e.published.at:e.published.date).slice(0,7)!==e.month&&t.addIssue({code:`custom`,path:[`month`],message:`published_month_mismatch`})}function _s(e,t){let n=new Set,r=1/0;for(let[i,a]of e.entries()){let e=`${a.product}/${a.version}`;n.has(e)&&t.addIssue({code:`custom`,path:[`releases`,i],message:`duplicate_release_identity`}),n.add(e);let o=Date.parse(a.published.kind===`instant`?a.published.at:`${a.published.date}T00:00:00Z`);o>r&&t.addIssue({code:`custom`,path:[`releases`,i],message:`release_order_mismatch`}),r=o}}const vs=Y(e.strictObject({contractVersion:e.literal(2),releases:e.array(hs),latest:e.strictObject({app:e.string().nullable(),cli:e.string().nullable()})}).superRefine((e,t)=>{_s(e.releases,t);for(let n of[`app`,`cli`]){let r=e.releases.find(e=>e.product===n)?.version??null;e.latest[n]!==r&&t.addIssue({code:`custom`,path:[`latest`,n],message:`latest_release_mismatch`})}}),us),ys=e.strictObject({state:e.literal(`not_applicable`),reason:e.literal(`no_curated_notes`)}),bs=e.union([cs(e.strictObject({locale:G,points:e.array(q).min(1).max(5)})),ys]),xs=e.strictObject({...ms,source:e.strictObject({kind:e.enum([`github`,`official`]),url:os}),summary:bs,notesCount:e.number().int().nonnegative()}).superRefine((e,t)=>{gs(e,t),e.product===`cli`!=(e.source.kind===`github`)&&t.addIssue({code:`custom`,path:[`source`,`kind`],message:`product_source_mismatch`}),e.notesCount===0!=(e.summary.state===`not_applicable`)&&t.addIssue({code:`custom`,path:[`summary`],message:`curated_notes_summary_state_mismatch`})}),Ss=Y(e.strictObject({contractVersion:e.literal(2),locale:G,month:K,releases:e.array(xs)}).superRefine((e,t)=>{_s(e.releases,t);for(let[n,r]of e.releases.entries())r.month!==e.month&&t.addIssue({code:`custom`,path:[`releases`,n,`month`],message:`file_month_mismatch`}),r.summary.state===`ready`&&r.summary.value.locale!==e.locale&&r.summary.value.locale!==`en`&&t.addIssue({code:`custom`,path:[`releases`,n,`summary`,`value`,`locale`],message:`summary_locale_mismatch`})}),ds),Cs=e.array(e.strictObject({title:q.nullable(),items:e.array(e.strictObject({text:q,refs:q.nullable()})).min(1)})).min(1),ws=Y(e.strictObject({contractVersion:e.literal(2),product:e.enum([`app`,`cli`]),version:q,revision:q,locale:G,original:e.array(Cs.element),translation:e.union([cs(Cs),ys]).nullable()}).superRefine((e,t)=>{let n=ka.safeParse({product:e.product,version:e.version});if(!n.success)for(let e of n.error.issues)t.addIssue({...e});if(e.locale===`en`!=(e.translation===null)&&t.addIssue({code:`custom`,path:[`translation`],message:`translation_locale_mismatch`}),e.locale!==`en`&&e.original.length===0!=(e.translation?.state===`not_applicable`)&&t.addIssue({code:`custom`,path:[`translation`],message:`curated_notes_translation_state_mismatch`}),e.translation?.state===`ready`){let n=e.translation.value;(n.length!==e.original.length||e.original.some((e,t)=>{let r=n.at(t);return r===void 0||e.title===null!=(r.title===null)||e.items.length!==r.items.length||e.items.some((e,t)=>e.refs!==r.items.at(t)?.refs)}))&&t.addIssue({code:`custom`,path:[`translation`],message:`translation_structure_mismatch`})}}),fs),Ts=e=>vs.parse(e),Es=e=>Ss.parse(e),Ds=e=>ws.parse(e),Os=e=>X(e,`codex_release_directory`,us,vs),ks=e=>X(e,`codex_release_month`,ds,Ss),As=e=>X(e,`codex_release_notes`,fs,ws);function js(e,t){return`/codex-releases/v2/${G.parse(e)}/${K.parse(t)}.json`}function Ms(e,t,n){let r=ka.parse({product:t,version:n});return`/codex-releases/v2/${G.parse(e)}/notes/${r.product}/${r.version}.json`}const Ns=128*1024;function Z(t){return e.discriminatedUnion(`state`,[e.strictObject({state:e.literal(`known`),value:t,source:os}),e.strictObject({state:e.literal(`unavailable`),reason:e.enum([`not_announced`,`not_listed`]),source:os.nullable()})])}const Ps=e.strictObject({input:q,cached:q,output:q}),Fs=e.strictObject({modelId:Aa,name:q,group:e.enum([`current`,`retired`]),status:e.enum([`available`,`retiring`,`retired`]),launched:Z(J),chatgptRetirement:Z(J),apiRetirement:Z(J),credits:Z(Ps),apiPrice:Z(Ps),multiple:e.string().regex(/^(?:0|[1-9]\d*)(?:\.\d+)?$/).refine(e=>Number.isFinite(Number(e))&&Number(e)>0).nullable(),plans:Z(e.array(q).min(1)),surfaces:Z(e.array(q).min(1)),about:cs(e.strictObject({locale:G,paragraphs:e.array(q).min(1)})),sources:e.array(e.strictObject({label:q,url:os})).min(1)}).superRefine((e,t)=>{e.status===`retired`!=(e.group===`retired`)&&t.addIssue({code:`custom`,path:[`group`],message:`model_group_status_mismatch`}),e.status===`retiring`&&e.chatgptRetirement.state!==`known`&&t.addIssue({code:`custom`,path:[`chatgptRetirement`],message:`retiring_model_requires_announced_date`})}),Is=Y(e.strictObject({contractVersion:e.literal(1),locale:G,models:e.array(Fs),multipleBase:e.strictObject({modelId:Aa,name:q}).nullable(),upcomingRetirement:e.strictObject({names:q,modelIds:e.array(Aa).min(1),surface:e.enum([`api`,`chatgpt`]),at:J}).nullable()}).superRefine((e,t)=>{let n=new Set;for(let[r,i]of e.models.entries())n.has(i.modelId)&&t.addIssue({code:`custom`,path:[`models`,r,`modelId`],message:`duplicate_model_identity`}),n.add(i.modelId),i.about.state===`ready`&&i.about.value.locale!==e.locale&&i.about.value.locale!==`en`&&t.addIssue({code:`custom`,path:[`models`,r,`about`,`value`,`locale`],message:`model_description_locale_mismatch`}),i.multiple!==null&&(e.multipleBase===null||i.credits.state!==`known`)&&t.addIssue({code:`custom`,path:[`models`,r,`multiple`],message:`multiple_requires_base_and_credits`});if(e.multipleBase!==null){let n=e.models.find(t=>t.modelId===e.multipleBase?.modelId);(n===void 0||n.group!==`current`||n.credits.state!==`known`||n.multiple!==`1`||n.name!==e.multipleBase.name)&&t.addIssue({code:`custom`,path:[`multipleBase`],message:`multiple_base_mismatch`})}let r=e.upcomingRetirement;if(r!==null){new Set(r.modelIds).size!==r.modelIds.length&&t.addIssue({code:`custom`,path:[`upcomingRetirement`,`modelIds`],message:`duplicate_retirement_model`});for(let n of r.modelIds){let i=e.models.find(e=>e.modelId===n),a=r.surface===`api`?i?.apiRetirement:i?.chatgptRetirement;(a?.state!==`known`||JSON.stringify(a.value)!==JSON.stringify(r.at))&&t.addIssue({code:`custom`,path:[`upcomingRetirement`],message:`retirement_model_date_mismatch`})}}}),Ns),Ls=e=>Is.parse(e),Rs=e=>X(e,`codex_models`,Ns,Is),zs=e=>`/codex-models/v1/${G.parse(e)}.json`,Bs=256*1024,Vs=512*1024,Hs=3600*1e3,Q=e.string().regex(/^[a-z][a-z0-9-]{0,63}$/),Us=e.enum([`x`,`hn`,`github`,`v2ex`,`reddit`,`linuxdo`]),Ws=e.enum([`debate`,`tip`,`showcase`,`comparison`,`news`]),$=e.string().trim().min(1),Gs=e.strictObject({id:$,topic:Q,platform:Us,kind:Ws,url:os,author:e.strictObject({name:$,handle:$.nullable()}),venue:$.nullable(),title:$.nullable(),summary:e.strictObject({zh:$.max(600),en:$.max(600)}),authoredAt:e.iso.datetime(),heat:e.strictObject({metrics:e.array(e.strictObject({kind:e.enum([`likes`,`points`,`comments`,`reactions`,`replies`]),value:e.number().int().nonnegative()})).min(1),ratio:e.number().finite().nonnegative()}).nullable()}).superRefine((e,t)=>{(!e.id.startsWith(`${e.platform}:`)||e.id.length<=e.platform.length+1)&&t.addIssue({code:`custom`,path:[`id`],message:`entry_platform_identity_mismatch`})});function Ks(e,t){let n=new Set,r=1/0;for(let[i,a]of e.entries.entries()){n.has(a.id)&&t.addIssue({code:`custom`,path:[`entries`,i],message:`duplicate_entry`}),n.add(a.id),a.topic!==e.topic&&t.addIssue({code:`custom`,path:[`entries`,i],message:`entry_topic_mismatch`});let o=Date.parse(a.authoredAt);o>r&&t.addIssue({code:`custom`,path:[`entries`,i],message:`entry_order_mismatch`}),r=o}}const qs=e.strictObject({id:$,platform:Us,label:$,lastSuccessAt:e.iso.datetime().nullable()}),Js=Y(e.strictObject({contractVersion:e.literal(1),topic:Q,generatedAt:e.iso.datetime(),overview:e.strictObject({weekCount:e.number().int().nonnegative(),debateCount:e.number().int().nonnegative(),hottestId:$.nullable()}),sources:e.array(qs),coverage:e.strictObject({from:e.iso.date(),months:e.array(K)}),entries:e.array(Gs)}).superRefine((e,t)=>{Ks(e,t);let n=Date.parse(e.generatedAt),r=e.entries.filter(e=>Date.parse(e.authoredAt)>=n-7*864e5),i=[...r].sort(nc).at(0)?.id??null;(e.overview.weekCount!==r.length||e.overview.debateCount!==r.filter(e=>e.kind===`debate`).length||e.overview.hottestId!==i)&&t.addIssue({code:`custom`,path:[`overview`],message:`overview_entries_mismatch`}),new Set(e.sources.map(e=>e.id)).size!==e.sources.length&&t.addIssue({code:`custom`,path:[`sources`],message:`duplicate_source`}),(new Set(e.coverage.months).size!==e.coverage.months.length||e.coverage.months.some((t,n)=>n>0&&t>=e.coverage.months.at(n-1)))&&t.addIssue({code:`custom`,path:[`coverage`],message:`coverage_order_mismatch`});for(let r of e.entries){let i=Date.parse(r.authoredAt);(i>n||i<n-30*864e5||!e.coverage.months.includes(r.authoredAt.slice(0,7))||r.authoredAt.slice(0,10)<e.coverage.from)&&t.addIssue({code:`custom`,path:[`entries`],message:`entry_coverage_mismatch`})}}),Bs),Ys=Y(e.strictObject({contractVersion:e.literal(1),topic:Q,month:K,entries:e.array(Gs)}).superRefine((e,t)=>{Ks(e,t),e.entries.some(t=>t.authoredAt.slice(0,7)!==e.month)&&t.addIssue({code:`custom`,path:[`entries`],message:`entry_month_mismatch`})}),Vs),Xs=e=>`/community-trending/v1/${Q.parse(e)}/latest.json`,Zs=(e,t)=>`/community-trending/v1/${Q.parse(e)}/${K.parse(t)}.json`,Qs=e=>Js.parse(e),$s=e=>Ys.parse(e),ec=e=>X(e,`community_trending_latest`,Bs,Js),tc=e=>X(e,`community_trending_month`,Vs,Ys);function nc(e,t){return e.heat===null&&t.heat!==null?1:e.heat!==null&&t.heat===null?-1:(t.heat?.ratio??0)-(e.heat?.ratio??0)||t.authoredAt.localeCompare(e.authoredAt)||e.id.localeCompare(t.id)}const rc=(e,t)=>e.summary[t===`zh-Hans`?`zh`:`en`],ic=e.object({revision:e.string().min(1).max(160),digest:e.string().regex(/^[a-f0-9]{64}$/)}).strict(),ac=e.discriminatedUnion(`kind`,[e.object({publicationId:e.string().min(1).max(160),kind:e.literal(`content`),sources:e.object({"reset-v1":ic,"reset-v2":ic,"reset-v3":ic,"reset-v4":ic.optional()}).strict()}).strict(),e.object({publicationId:e.string().min(1).max(160),kind:e.literal(`reset-clue`),sources:e.object({"reset-clue":ic}).strict()}).strict()]),oc=e.object({resource:e.enum([`content-v1`,`content-v2`,`content-v3`,`content-v4`,`reset-clue`]),sourceRevision:e.string().min(1).max(160),sourceDigest:e.string().regex(/^[a-f0-9]{64}$/),targetVersion:e.iso.datetime().nullable(),targetDigest:e.string().regex(/^[a-f0-9]{64}$/).nullable(),outcome:e.enum([`published`,`unchanged`,`busy`,`superseded`,`failed`]),error:e.object({operation:e.string().min(1),stage:e.string().min(1),code:e.string().min(1),summary:e.string().min(1),correlationId:e.string().min(1),cause:e.unknown(),upstreamStatus:e.number().int().optional(),upstreamCode:e.string().optional()}).strict().optional()}).strict().superRefine((e,t)=>{(e.outcome===`published`||e.outcome===`unchanged`)&&(e.targetVersion===null||e.targetDigest===null)&&t.addIssue({code:`custom`,message:`completed publication requires a target receipt`}),e.outcome===`failed`&&e.error===void 0&&t.addIssue({code:`custom`,message:`failed publication requires a cause`})}),sc=e.object({publicationId:e.string().min(1).max(160),results:e.array(oc).min(1).max(4)}).strict().superRefine((e,t)=>{new Set(e.results.map(e=>e.resource)).size!==e.results.length&&t.addIssue({code:`custom`,message:`duplicate resource`})}),cc=`/api/v1/internal/publications/wechat/dispatch`,lc=`/__radar/wechat-publication/dispatch`,uc=hi.shape.generatedAt,dc=mi.shape.records.element,fc=e.strictObject({id:e.string().min(1),resetActionId:dc.shape.resetActionId,at:uc,effects:e.array(dc.shape.effect).min(1).max(2),source:e.discriminatedUnion(`kind`,[e.strictObject({kind:e.literal(`official_post`),sourceUrl:dc.shape.sourceUrl}),e.strictObject({kind:e.literal(`manual`),officialConfirmationMissing:e.boolean()})])}),pc=e.strictObject(mi.shape).extend({records:e.array(e.strictObject(dc.shape).extend({sourceUrl:dc.shape.sourceUrl.nullable(),confirmationId:e.string().min(1).nullable()})).max(i.analysis.actions*2)}).superRefine((e,t)=>{pi(e,t);for(let[n,r]of e.records.entries())r.basis===`execution_confirmation`!=(r.confirmationId!==null)&&t.addIssue({code:`custom`,message:`statistics_confirmation_identity_mismatch`,path:[`records`,n]}),r.basis===`announcement`&&r.sourceUrl===null&&t.addIssue({code:`custom`,message:`statistics_announcement_source_missing`,path:[`records`,n]})}),mc=e.strictObject({sourceWatermark:re.shape.sourceWatermark,confirmations:e.array(fc),statistics:pc}),hc=e.strictObject(hi.shape).extend({contractVersion:e.literal(4),statistics:pc,confirmations:e.array(fc)}).superRefine((e,t)=>{let n=e=>t.addIssue({code:`custom`,message:e});new TextEncoder().encode(JSON.stringify(e)).byteLength>i.exportUtf8Bytes&&n(`export_utf8_size_limit_exceeded`);let r=new Map(e.confirmations.map(e=>[e.id,e])),a=new Map(e.actions.map(e=>[e.resetActionId,e]));a.size!==e.actions.length&&n(`export_action_identity_duplicate`),new Set(e.pendingResetActions.map(e=>e.resetActionId)).size!==e.pendingResetActions.length&&n(`export_pending_action_identity_duplicate`);let o=new Set(e.statistics.records.map(e=>e.resetActionId));for(let[t,r]of e.actions.entries()){Date.parse(r.firstAnnouncedAt)>Date.parse(e.generatedAt)&&n(`export_action_after_snapshot`);let i=e.actions.at(t-1);t>0&&i!==void 0&&uc.safeParse(i.firstAnnouncedAt).success&&uc.safeParse(r.firstAnnouncedAt).success&&T(i,r)>0&&n(`export_actions_not_stably_sorted`),Date.parse(r.firstAnnouncedAt)>=Date.parse(e.statistics.startAt)&&!o.has(r.resetActionId)&&n(`export_statistics_window_action_missing`)}r.size!==e.confirmations.length&&t.addIssue({code:`custom`,message:`confirmation_identity_duplicate`});for(let r of e.confirmations){let i=a.get(r.resetActionId);(i===void 0||Date.parse(r.at)>Date.parse(e.generatedAt))&&t.addIssue({code:`custom`,message:`confirmation_action_or_time_invalid`}),(new Set(r.effects).size!==r.effects.length||r.effects.some(e=>i!==void 0&&(e===null!=(i.resetEffects.state===`unknown`)||e!==null&&!i.resetEffects.values.some(t=>t===e))))&&n(`confirmation_effect_mismatch`);let o=r.source;o.kind===`official_post`&&!i?.noticeTimeline.some(e=>e.phase===`executed`&&e.sourceUrl===o.sourceUrl&&e.authoredAt===r.at)&&t.addIssue({code:`custom`,message:`confirmation_official_source_invalid`})}for(let i of e.statistics.records){let o=a.get(i.resetActionId),s=i.confirmationId===null?void 0:r.get(i.confirmationId);Date.parse(i.at)>Date.parse(e.generatedAt)&&n(`export_statistics_record_after_snapshot`),o!==void 0&&(o.resetEffects.state===`unknown`!=(i.effect===null)||i.effect!==null&&!o.resetEffects.values.some(e=>e===i.effect))&&n(`export_statistics_effect_mismatch`),(o===void 0||i.confirmationId!==null&&(s===void 0||s.resetActionId!==i.resetActionId||s.at!==i.at||!s.effects.includes(i.effect)))&&t.addIssue({code:`custom`,message:`statistics_confirmation_missing_or_mismatched`}),s!==void 0&&i.sourceUrl!==(s.source.kind===`official_post`?s.source.sourceUrl:null)&&n(`statistics_confirmation_source_mismatch`),i.basis===`announcement`&&!o?.noticeTimeline.some(e=>e.sourceUrl===i.sourceUrl&&e.authoredAt===i.at&&o.firstAnnouncedAt===i.at)&&t.addIssue({code:`custom`,message:`statistics_announcement_source_invalid`})}}),gc=e=>hc.parse(e);export{an as RadarResetSourceContractErrorV2,is as activeRadarResetClue,nc as compareRadarCommunityTrendingEntries,$a as compareRadarNotificationTasks,T as compareRadarResetActionDetailsV1,w as compareRadarResetUtcTimestampsV1,Xa as createRadarBrowserNotificationProjection,za as createRadarCodexProgressCalendar,Za as createRadarNotificationProjection,Tn as createRadarResetSourceErrorEnvelopeV2,Mr as encodeRadarActivityFile,Pr as encodeRadarActivityFileV2,_a as encodeRadarActivityFileV3,pn as encodeRadarResetDetailMultipartV2,Nr as encodeRadarTitledActivityFile,st as formatRadarResetPositiveDecimalV2,ot as formatRadarResetUInt64DecimalV2,So as initialRadarBrowserSubscription,Ao as initialRadarBrowserSubscriptionV2,Ls as parseRadarCodexModels,xa as parseRadarCodexProgressChangeV3,Sa as parseRadarCodexProgressChangesV3,kn as parseRadarCodexProgressV1,Rn as parseRadarCodexProgressV2,qn as parseRadarCodexProgressV3,$n as parseRadarCodexProgressV4,na as parseRadarCodexProgressV5,Ts as parseRadarCodexReleaseDirectory,Es as parseRadarCodexReleaseMonth,Ds as parseRadarCodexReleaseNotes,Qs as parseRadarCommunityTrendingLatest,$s as parseRadarCommunityTrendingMonth,Ue as parseRadarResetActionDetailV1,ni as parseRadarResetActionDetailV2,yi as parseRadarResetActionDetailV3,bt as parseRadarResetActionSummaryV2,He as parseRadarResetAnalysisV1,rs as parseRadarResetClueSnapshot,vn as parseRadarResetDetailMultipartV2,We as parseRadarResetExportV1,ii as parseRadarResetExportV2,_i as parseRadarResetExportV3,gc as parseRadarResetExportV4,Ge as parseRadarResetPendingActionV1,ri as parseRadarResetPendingActionV2,it as parseRadarResetPositiveDecimalV2,St as parseRadarResetPublicationHomeFactsV2,rn as parseRadarResetPublicationRevisionAvailableV2,Xt as parseRadarResetReadActionsRequestV2,en as parseRadarResetReadActionsSuccessV2,Zt as parseRadarResetReadChangesRequestV2,tn as parseRadarResetReadChangesSuccessV2,Qt as parseRadarResetReadDetailBatchRequestV2,Yt as parseRadarResetReadHeadRequestV2,$t as parseRadarResetReadHeadSuccessV2,ie as parseRadarResetSnapshotAvailableV1,nn as parseRadarResetSourceErrorEnvelopeV2,rt as parseRadarResetUInt64DecimalV2,yo as projectRadarBrowserSubscriptionSelection,jo as projectRadarBrowserSubscriptionV1,ai as projectRadarResetExportV1FromV2,vi as projectRadarResetExportV3FromV2,Ke as projectRadarResetPrimarySourceV1,wi as projectRadarResetPublicActionToV2,L as radarActivityEventIdSchema,z as radarActivityFileSchema,ar as radarActivityFileUrl,Or as radarActivityFileV2Schema,or as radarActivityFileV2Url,ha as radarActivityFileV3Schema,ra as radarActivityFileV3Url,R as radarActivityMaxBytes,ur as radarActivityProgressSchema,Tr as radarActivityProgressV2Schema,ua as radarActivityProgressV3Schema,dr as radarActivityReactionCountsSchema,ir as radarActivityReactionIdSchema,I as radarActivityReactionIds,Ma as radarBrowserNotificationPageUrl,Ya as radarBrowserNotificationProjectionSchema,Ga as radarBrowserNotificationTargetUrlSchema,Ja as radarBrowserNotificationTopicSchema,fo as radarBrowserRegistrationSchema,xo as radarBrowserSubscriptionErrorRes,go as radarBrowserSubscriptionFailureSchema,_o as radarBrowserSubscriptionOperationSchema,ho as radarBrowserSubscriptionReadReq,bo as radarBrowserSubscriptionRes,mo as radarBrowserSubscriptionSaveReq,Do as radarBrowserSubscriptionSaveV2Req,ko as radarBrowserSubscriptionV2Res,vo as radarBrowserSubscriptionViewSchema,Oo as radarBrowserSubscriptionViewV2Schema,ao as radarBrowserSubscriptionsPath,lo as radarBrowserTopicsSchema,Co as radarBrowserTopicsV2Schema,Vr as radarCodexGuessChoiceSchema,Kr as radarCodexGuessErrorSchema,Hr as radarCodexGuessSaveReqSchema,Gr as radarCodexGuessViewSchema,Aa as radarCodexModelIdSchema,Pa as radarCodexModelUrl,Ns as radarCodexModelsMaxBytes,zs as radarCodexModelsPath,Is as radarCodexModelsSchema,Fa as radarCodexProgressCalendar,Fr as radarCodexProgressChangeSchema,Lr as radarCodexProgressChangeV2Schema,ya as radarCodexProgressChangeV3Schema,Ir as radarCodexProgressChangesV1Schema,Rr as radarCodexProgressChangesV2Schema,ba as radarCodexProgressChangesV3Schema,N as radarCodexProgressEntrySchema,Bn as radarCodexProgressEntryV3Schema,Xi as radarCodexProgressEntryV5Schema,Ji as radarCodexProgressImprovementV5Schema,Wi as radarCodexProgressPostRoleV5Schema,Gi as radarCodexProgressPostV5Schema,Ki as radarCodexProgressPostsV5Schema,Yi as radarCodexProgressResetEntryV5Schema,Kn as radarCodexProgressScore,F as radarCodexProgressTitleV3Schema,P as radarCodexProgressV1Schema,jn as radarCodexProgressV2MaxBytes,Ln as radarCodexProgressV2Schema,zn as radarCodexProgressV3MaxBytes,Gn as radarCodexProgressV3Schema,Jn as radarCodexProgressV4MaxBytes,Qn as radarCodexProgressV4Schema,qi as radarCodexProgressV5MaxBytes,ta as radarCodexProgressV5Schema,us as radarCodexReleaseDirectoryMaxBytes,ls as radarCodexReleaseDirectoryPath,vs as radarCodexReleaseDirectorySchema,ka as radarCodexReleaseIdentitySchema,ds as radarCodexReleaseMonthMaxBytes,js as radarCodexReleaseMonthPath,Ss as radarCodexReleaseMonthSchema,fs as radarCodexReleaseNotesMaxBytes,Ms as radarCodexReleaseNotesPath,ws as radarCodexReleaseNotesSchema,Cs as radarCodexReleaseSectionsSchema,Na as radarCodexReleaseUrl,ps as radarCodexTimePointSchema,Gs as radarCommunityTrendingEntrySchema,Ws as radarCommunityTrendingKindSchema,Bs as radarCommunityTrendingLatestMaxBytes,Xs as radarCommunityTrendingLatestPath,Js as radarCommunityTrendingLatestSchema,Vs as radarCommunityTrendingMonthMaxBytes,Zs as radarCommunityTrendingMonthPath,Ys as radarCommunityTrendingMonthSchema,Us as radarCommunityTrendingPlatformSchema,qs as radarCommunityTrendingSourceSchema,Hs as radarCommunityTrendingSourceStaleMs,rc as radarCommunityTrendingSummary,Q as radarCommunityTrendingTopicSchema,Fo as radarImprovementColumnPath,Uo as radarImprovementEligibilityReq,Wo as radarImprovementEligibilityRes,Ro as radarImprovementEntrySchema,Go as radarImprovementErrorRes,zo as radarImprovementHeadReq,Bo as radarImprovementHeadRes,Po as radarImprovementPageMaxBytes,Vo as radarImprovementPageReq,Ho as radarImprovementPageRes,No as radarImprovementPageSize,qa as radarNotificationProjectionSchema,Ka as radarNotificationTargetSchema,to as radarNotificationTaskPageSize,Qa as radarNotificationTaskSchema,eo as radarNotificationTasksPath,ro as radarNotificationTasksReq,io as radarNotificationTasksRes,Ba as radarNotificationTopicSchema,Va as radarNotificationTopicsSchema,S as radarResetActionDetailV1Schema,B as radarResetActionDetailV2Schema,oi as radarResetActionDetailV3Schema,Dt as radarResetActionItemV2Schema,Xe as radarResetActionPageMaxBytesV2,Ye as radarResetActionPageMaxItemsV2,yt as radarResetActionSummaryV2Schema,Tt as radarResetActiveActionItemV2Schema,Me as radarResetAnalysisV1Schema,r as radarResetAnalyzerContractVersionV1,c as radarResetAudienceValues,Ft as radarResetChangeCoverageV2Schema,Qe as radarResetChangePageMaxBytesV2,Ze as radarResetChangePageMaxItemsV2,$o as radarResetClueLifetimeMs,es as radarResetClueMaxBytes,Qo as radarResetCluePath,ts as radarResetClueSchema,ns as radarResetClueSnapshotSchema,fc as radarResetConfirmationSchema,mc as radarResetConfirmationsResponseSchema,n as radarResetContractVersionV1,qe as radarResetContractVersionV2,et as radarResetDetailBatchMaxBytesV2,$e as radarResetDetailBatchMaxChunksV2,Ct as radarResetDetailChunkReferenceV2Schema,jt as radarResetDetailChunkRequestV2Schema,wt as radarResetDetailManifestV2Schema,o as radarResetEffectValues,Ve as radarResetExportV1Schema,H as radarResetExportV2Schema,hi as radarResetExportV3Schema,hc as radarResetExportV4Schema,Xr as radarResetKindNoticeV2Schema,Bi as radarResetManagementActionSchema,Pi as radarResetManagementOperationSchema,Vi as radarResetManagementResSchema,zi as radarResetManualApplyReqSchema,Ni as radarResetManualCopySchema,Fi as radarResetManualDraftSchema,Li as radarResetManualDraftSeedSchema,Ii as radarResetManualPreviewReqSchema,Ri as radarResetManualPreviewResSchema,Hi as radarResetManualResultResSchema,Ie as radarResetNoticeKindValues,C as radarResetPendingActionV1Schema,V as radarResetPendingActionV2Schema,l as radarResetPlanValues,E as radarResetPositiveDecimalV2Schema,s as radarResetProductValues,Ei as radarResetPublicActionV1Schema,i as radarResetPublicDataLimits,O as radarResetPublicIdV2Schema,bi as radarResetPublicRecordsCorePath,Ai as radarResetPublicRecordsV1Schema,xt as radarResetPublicationHomeFactsV2Schema,Jt as radarResetPublicationRevisionAvailableV2Schema,Le as radarResetPublicationTimingSchema,Lt as radarResetReadActionsDataV2Schema,kt as radarResetReadActionsRequestV2Schema,Vt as radarResetReadActionsSuccessV2Schema,Rt as radarResetReadChangesDataV2Schema,At as radarResetReadChangesRequestV2Schema,Ht as radarResetReadChangesSuccessV2Schema,Mt as radarResetReadDetailBatchRequestV2Schema,It as radarResetReadHeadDataV2Schema,Ot as radarResetReadHeadRequestV2Schema,Bt as radarResetReadHeadSuccessV2Schema,d as radarResetReasonBasisValues,u as radarResetReasonCategoryValues,Gt as radarResetSafeCauseSnapshotV2Schema,a as radarResetSeriesValues,k as radarResetSha256V2Schema,re as radarResetSnapshotAvailableV1Schema,Pt as radarResetSourceChangeV2Schema,Ut as radarResetSourceErrorCodeValuesV2,qt as radarResetSourceErrorEnvelopeV2Schema,wn as radarResetSourceErrorHttpStatusV2,Cn as radarResetSourceErrorIsRetryableV2,Kt as radarResetSourceErrorV2Schema,Je as radarResetSourceMaxRpcCallsV2,qr as radarResetSourceTranslationsSchema,gi as radarResetStatisticsResponseV3Schema,mi as radarResetStatisticsV1Schema,pc as radarResetStatisticsV2Schema,nt as radarResetUInt64DecimalV2Schema,at as radarResetUInt64DecimalV2ToBigInt,Di as radarResetUnexecutedActionV1Schema,D as radarResetUtcTimestampV2Schema,Et as radarResetWithdrawnActionItemV2Schema,Oi as radarResetWithdrawnActionV1Schema,qo as radarTiboSourceStatusMaxBytes,Ko as radarTiboSourceStatusPath,Xo as radarTiboSourceStatusSchema,Sr as radarTitledActivityFileSchema,yr as radarTitledActivityProgressSchema,Da as radarWebsiteLegacyChinesePrefix,Ea as radarWebsiteLocalePrefixes,Ta as radarWebsiteLocaleSlugs,wa as radarWebsiteLocales,Ca as radarWebsiteOrigin,Oa as radarWebsitePagePaths,ja as radarWebsitePageUrl,cc as radarWechatDispatchPath,ac as radarWechatDispatchRequestSchema,sc as radarWechatDispatchResponseSchema,oc as radarWechatDispatchResultSchema,lc as radarWechatPrivateDispatchPath,kr as readRadarActivityFile,jr as readRadarActivityFileV2,ga as readRadarActivityFileV3,Rs as readRadarCodexModels,Os as readRadarCodexReleaseDirectory,ks as readRadarCodexReleaseMonth,As as readRadarCodexReleaseNotes,ec as readRadarCommunityTrendingLatest,tc as readRadarCommunityTrendingMonth,as as readRadarResetClueSnapshot,Zo as readRadarTiboSourceStatus,Ar as readRadarTitledActivityFile,po as redactRadarBrowserRegistrationReferences,pi as refineRadarResetStatistics,Sn as toSafeCauseSnapshotV2,Mo as upgradeRadarBrowserSubscriptionCommandV1};
|