"use strict";exports.id=603,exports.ids=[603],exports.modules={16603:(e,t,r)=>{r(9447);var i,n=r(7862);r(57075);!function(e){e[e.boolTrue=0]="boolTrue",e[e.boolFalse=1]="boolFalse",e[e.byte=2]="byte",e[e.short=3]="short",e[e.integer=4]="integer",e[e.long=5]="long",e[e.byteArray=6]="byteArray",e[e.string=7]="string",e[e.timestamp=8]="timestamp",e[e.uuid=9]="uuid"}(i||(i={}));Symbol.asyncIterator;Symbol.asyncIterator;Symbol.asyncIterator;Symbol.asyncIterator;t.EventStreamSerde=class{marshaller;serializer;deserializer;serdeContext;defaultContentType;constructor({marshaller:e,serializer:t,deserializer:r,serdeContext:i,defaultContentType:n}){this.marshaller=e,this.serializer=t,this.deserializer=r,this.serdeContext=i,this.defaultContentType=n}async serializeEventStream({eventStream:e,requestSchema:t,initialRequest:r}){const i=this.marshaller,n=t.getEventStreamMember(),s=t.getMemberSchema(n),a=this.serializer,o=this.defaultContentType,l=Symbol("initialRequestMarker"),c={async*[Symbol.asyncIterator](){if(r){const e={":event-type":{type:"string",value:"initial-request"},":message-type":{type:"string",value:"event"},":content-type":{type:"string",value:o}};a.write(t,r);const i=a.flush();yield{[l]:!0,headers:e,body:i}}for await(const t of e)yield t}};return i.serialize(c,e=>{if(e[l])return{headers:e.headers,body:e.body};let t="";for(const r in e)if("__type"!==r){t=r;break}const{additionalHeaders:r,body:i,eventType:n,explicitPayloadContentType:a}=this.writeEventBody(t,s,e);return{headers:{":event-type":{type:"string",value:n},":message-type":{type:"string",value:"event"},":content-type":{type:"string",value:a??o},...r},body:i}})}async deserializeEventStream({response:e,responseSchema:t,initialResponseContainer:r}){const i=this.marshaller,s=t.getEventStreamMember(),a=t.getMemberSchema(s).getMemberSchemas(),o=Symbol("initialResponseMarker"),l=i.deserialize(e.body,async e=>{let r="";for(const t in e)if("__type"!==t){r=t;break}const i=e[r].body;if("initial-response"===r){const e=await this.deserializer.read(t,i);return delete e[s],{[o]:!0,...e}}if(r in a){const t=a[r];if(t.isStructSchema()){const s={};let a=!1;for(const[o,l]of t.structIterator()){const{eventHeader:t,eventPayload:c}=l.getMergedTraits();if(a=a||Boolean(t||c),c)l.isBlobSchema()?s[o]=i:l.isStringSchema()?s[o]=(this.serdeContext?.utf8Encoder??n.toUtf8)(i):l.isStructSchema()&&(s[o]=await this.deserializer.read(l,i));else if(t){const t=e[r].headers[o]?.value;null!=t&&(l.isNumericSchema()?s[o]=t&&"object"==typeof t&&"bytes"in t?BigInt(t.toString()):Number(t):s[o]=t)}}if(a)return{[r]:s};if(0===i.byteLength)return{[r]:{}}}return{[r]:await this.deserializer.read(t,i)}}return{$unknown:e}}),c=l[Symbol.asyncIterator](),y=await c.next();if(y.done)return l;if(y.value?.[o]){if(!t)throw new Error("@smithy::core/protocols - initial-response event encountered in event stream but no response schema given.");for(const e in y.value)r[e]=y.value[e]}return{async*[Symbol.asyncIterator](){for(y?.value?.[o]||(yield y.value);;){const{done:e,value:t}=await c.next();if(e)break;yield t}}}}writeEventBody(e,t,r){const i=this.serializer;let s,a=e,o=null;const l={};if(t.getSchema()[4].includes(e)){const n=t.getMemberSchema(e);if(n.isStructSchema()){for(const[t,i]of n.structIterator()){const{eventHeader:n,eventPayload:s}=i.getMergedTraits();if(s)o=t;else if(n){const n=r[e][t];let s="binary";i.isNumericSchema()?s=(-2)**31<=n&&n<=2**31-1?"integer":"long":i.isTimestampSchema()?s="timestamp":i.isStringSchema()?s="string":i.isBooleanSchema()&&(s="boolean"),null!=n&&(l[t]={type:s,value:n},delete r[e][t])}}if(null!==o){const t=n.getMemberSchema(o);t.isBlobSchema()?s="application/octet-stream":t.isStringSchema()&&(s="text/plain"),i.write(t,r[e][o])}else i.write(n,r[e])}else{if(!n.isUnitSchema())throw new Error("@smithy/core/event-streams - non-struct member not supported in event stream union.");i.write(n,{})}}else{const[t,n]=r[e];a=t,i.write(15,n)}const c=i.flush()??new Uint8Array;return{body:"string"==typeof c?(this.serdeContext?.utf8Decoder??n.fromUtf8)(c):c,eventType:a,explicitPayloadContentType:s,additionalHeaders:l}}}}};
//# sourceMappingURL=http://go/sourcemap/sourcemaps/fc2563ec93d793fc275eef734405a4fdf8b47b20/extensions/cursor-agent-exec/dist/603.js.map