{"version":3,"sources":["../../../src/experimental/testmode/server.ts"],"names":["interceptTestApis","wrapRequestHandlerWorker","wrapRequestHandlerNode","testStorage","AsyncLocalStorage","getTestStack","stack","Error","split","i","length","slice","filter","f","includes","map","s","replace","trim","join","buildProxyRequest","testData","request","url","method","headers","body","cache","credentials","integrity","mode","redirect","referrer","referrerPolicy","api","Array","from","Buffer","arrayBuffer","toString","buildResponse","proxyResponse","status","response","Response","Headers","handleFetch","originalFetch","testInfo","getStore","proxyPort","proxyRequest","resp","JSON","stringify","next","internal","ok","json","interceptFetch","global","fetch","testFetch","input","init","Request","clientRequestInterceptor","ClientRequestInterceptor","on","respondWith","apply","dispose","handler","req","res","proxyPortHeader","Number","testReqInfo","run","parsedUrl"],"mappings":";;;;;;;;;;;;;;;;IA6IgBA,iBAAiB;eAAjBA;;IAkBAC,wBAAwB;eAAxBA;;IAsBAC,sBAAsB;eAAtBA;;;6BArLkB;+BAMO;AAUzC,MAAMC,cAAc,IAAIC,8BAAiB;AAMzC,SAASC;IACP,IAAIC,QAAQ,AAAC,CAAA,IAAIC,QAAQD,KAAK,IAAI,EAAC,EAAGE,KAAK,CAAC;IAC5C,qDAAqD;IACrD,IAAK,IAAIC,IAAI,GAAGA,IAAIH,MAAMI,MAAM,EAAED,IAAK;QACrC,IAAIH,KAAK,CAACG,EAAE,CAACC,MAAM,GAAG,GAAG;YACvBJ,QAAQA,MAAMK,KAAK,CAACF;YACpB;QACF;IACF;IACA,+BAA+B;IAC/BH,QAAQA,MAAMM,MAAM,CAAC,CAACC,IAAM,CAACA,EAAEC,QAAQ,CAAC;IACxC,mBAAmB;IACnBR,QAAQA,MAAMK,KAAK,CAAC,GAAG;IACvB,uCAAuC;IACvCL,QAAQA,MAAMS,GAAG,CAAC,CAACC,IAAMA,EAAEC,OAAO,CAAC,8BAA8B,IAAIC,IAAI;IACzE,OAAOZ,MAAMa,IAAI,CAAC;AACpB;AAEA,eAAeC,kBACbC,QAAgB,EAChBC,OAAgB;IAEhB,MA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